{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/internal/util.py#L114-L129", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper which expand_dims `is_accepted` then applies tf.where.", "language": "python", "parameters": "(is_accepted, accepted, rejected, name=None)", "return_statement": "return type(accepted)(**dict(\n      [(fn,\n        choose(is_accepted,\n               getattr(accepted, fn),\n               getattr(rejected, fn),\n               name=name))\n       for fn in accepted._fields]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "not", "is_namedtuple_like", "(", "arg_1", ")", ":", "return", "_Func_base_case", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "not", "isinstance", "(", "arg_1", ",", "type", "(", "arg_2", ")", ")", ":", "raise", "TypeError", "(", "'Type of `accepted` ({}) must be identical to '", "'type of `rejected` ({})'", ".", "format", "(", "type", "(", "arg_1", ")", ".", "__name__", ",", "type", "(", "arg_2", ")", ".", "__name__", ")", ")", "return", "type", "(", "arg_1", ")", "(", "**", "dict", "(", "[", "(", "arg_4", ",", "Func", "(", "arg_0", ",", "getattr", "(", "arg_1", ",", "arg_4", ")", ",", "getattr", "(", "arg_2", ",", "arg_4", ")", ",", "arg_3", "=", "arg_3", ")", ")", "for", "arg_4", "in", "arg_1", ".", "_fields", "]", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n  \"\"\"Helper which expand_dims `is_accepted` then applies tf.where.\"\"\"\n  if not is_namedtuple_like(arg_1):\n    return _Func_base_case(arg_0, arg_1, arg_2, arg_3=arg_3)\n  if not isinstance(arg_1, type(arg_2)):\n    raise TypeError('Type of `accepted` ({}) must be identical to '\n                    'type of `rejected` ({})'.format(\n                        type(arg_1).__name__,\n                        type(arg_2).__name__))\n  return type(arg_1)(**dict(\n      [(arg_4,\n        Func(arg_0,\n               getattr(arg_1, arg_4),\n               getattr(arg_2, arg_4),\n               arg_3=arg_3))\n       for arg_4 in arg_1._fields]))", "path": "tensorflow_probability/python/mcmc/internal/util.py", "identifier": "choose", "docstring": "Helper which expand_dims `is_accepted` then applies tf.where.", "docstring_tokens": ["Helper", "which", "expand_dims", "is_accepted", "then", "applies", "tf", ".", "where", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 251820}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/probability.py#L414-L417", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Is event consistent with the given evidence?", "language": "python", "parameters": "(event, evidence)", "return_statement": "return every(lambda (k, v): evidence.get(k, v) == v,\n                 event.items())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "every", "(", "lambda", "(", "k", ",", "v", ")", ":", "arg_1", ".", "get", "(", "k", ",", "v", ")", "==", "v", ",", "arg_0", ".", "items", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"Is event consistent with the given evidence?\"\n    return every(lambda (k, v): arg_1.get(k, v) == v,\n                 arg_0.items())", "path": "aima/probability.py", "identifier": "consistent_with", "docstring": "Is event consistent with the given evidence?", "docstring_tokens": ["Is", "event", "consistent", "with", "the", "given", "evidence?"], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 251821}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L73-L91", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "compute similarities in appended files", "language": "python", "parameters": "(self)", "return_statement": "return sims", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "defaultdict", "(", "list", ")", "for", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "in", "arg_0", ".", "_iter_sims", "(", ")", ":", "arg_7", "=", "arg_1", "[", "arg_2", "]", "for", "arg_8", "in", "arg_7", ":", "if", "(", "arg_3", ",", "arg_4", ")", "in", "arg_8", "or", "(", "arg_5", ",", "arg_6", ")", "in", "arg_8", ":", "arg_8", ".", "add", "(", "(", "arg_3", ",", "arg_4", ")", ")", "arg_8", ".", "add", "(", "(", "arg_5", ",", "arg_6", ")", ")", "break", "else", ":", "arg_7", ".", "append", "(", "{", "(", "arg_3", ",", "arg_4", ")", ",", "(", "arg_5", ",", "arg_6", ")", "}", ")", "arg_9", "=", "[", "]", "for", "arg_2", ",", "arg_10", "in", "arg_1", ".", "items", "(", ")", ":", "for", "arg_8", "in", "arg_10", ":", "arg_9", ".", "append", "(", "(", "arg_2", ",", "arg_8", ")", ")", "arg_9", ".", "sort", "(", ")", "arg_9", ".", "reverse", "(", ")", "return", "arg_9"], "function": "def Func(arg_0):\n        \"\"\"compute similarities in appended files\"\"\"\n        arg_1 = defaultdict(list)\n        for arg_2, arg_3, arg_4, arg_5, arg_6 in arg_0._iter_sims():\n            arg_7 = arg_1[arg_2]\n            for arg_8 in arg_7:\n                if (arg_3, arg_4) in arg_8 or (arg_5, arg_6) in arg_8:\n                    arg_8.add((arg_3, arg_4))\n                    arg_8.add((arg_5, arg_6))\n                    break\n            else:\n                arg_7.append({(arg_3, arg_4), (arg_5, arg_6)})\n        arg_9 = []\n        for arg_2, arg_10 in arg_1.items():\n            for arg_8 in arg_10:\n                arg_9.append((arg_2, arg_8))\n        arg_9.sort()\n        arg_9.reverse()\n        return arg_9", "path": "pylint/checkers/similar.py", "identifier": "Similar._compute_sims", "docstring": "compute similarities in appended files", "docstring_tokens": ["compute", "similarities", "in", "appended", "files"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 251822}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L155-L166", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Print a status message about the logger.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "logfile", "is", "None", ":", "print", "'Logging has not been activated.'", "else", ":", "arg_1", "=", "arg_0", ".", "log_active", "and", "'active'", "or", "'temporarily suspended'", "print", "'Filename       :'", ",", "arg_0", ".", "logfname", "print", "'Mode           :'", ",", "arg_0", ".", "logmode", "print", "'Output logging :'", ",", "arg_0", ".", "log_output", "print", "'Raw input log  :'", ",", "arg_0", ".", "log_raw_input", "print", "'Timestamping   :'", ",", "arg_0", ".", "timestamp", "print", "'State          :'", ",", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Print a status message about the logger.\"\"\"\n        if arg_0.logfile is None:\n            print 'Logging has not been activated.'\n        else:\n            arg_1 = arg_0.log_active and 'active' or 'temporarily suspended'\n            print 'Filename       :',arg_0.logfname\n            print 'Mode           :',arg_0.logmode\n            print 'Output logging :',arg_0.log_output\n            print 'Raw input log  :',arg_0.log_raw_input\n            print 'Timestamping   :',arg_0.timestamp\n            print 'State          :',arg_1", "path": "environment/lib/python2.7/site-packages/IPython/core/logger.py", "identifier": "Logger.logstate", "docstring": "Print a status message about the logger.", "docstring_tokens": ["Print", "a", "status", "message", "about", "the", "logger", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 251823}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1298-L1339", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Cancel all started queries that have not yet completed", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "service", ".", "jobs", "(", ")", "if", "(", "arg_0", ".", "running_job_id", "and", "not", "arg_0", ".", "poll_job_complete", "(", "arg_0", ".", "running_job_id", ")", ")", ":", "arg_0", ".", "log", ".", "info", "(", "'Attempting to cancel job : %s, %s'", ",", "arg_0", ".", "project_id", ",", "arg_0", ".", "running_job_id", ")", "if", "arg_0", ".", "location", ":", "arg_1", ".", "cancel", "(", "projectId", "=", "arg_0", ".", "project_id", ",", "jobId", "=", "arg_0", ".", "running_job_id", ",", "location", "=", "arg_0", ".", "location", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "else", ":", "arg_1", ".", "cancel", "(", "projectId", "=", "arg_0", ".", "project_id", ",", "jobId", "=", "arg_0", ".", "running_job_id", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "'No running BigQuery jobs to cancel.'", ")", "return", "arg_2", "=", "12", "arg_3", "=", "0", "arg_4", "=", "False", "while", "arg_3", "<", "arg_2", "and", "not", "arg_4", ":", "arg_3", "=", "arg_3", "+", "1", "arg_4", "=", "arg_0", ".", "poll_job_complete", "(", "arg_0", ".", "running_job_id", ")", "if", "arg_4", ":", "arg_0", ".", "log", ".", "info", "(", "'Job successfully canceled: %s, %s'", ",", "arg_0", ".", "project_id", ",", "arg_0", ".", "running_job_id", ")", "elif", "arg_3", "==", "arg_2", ":", "arg_0", ".", "log", ".", "info", "(", "\"Stopping polling due to timeout. Job with id %s \"", "\"has not completed cancel and may or may not finish.\"", ",", "arg_0", ".", "running_job_id", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "'Waiting for canceled job with id %s to finish.'", ",", "arg_0", ".", "running_job_id", ")", "time", ".", "sleep", "(", "5", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Cancel all started queries that have not yet completed\n        \"\"\"\n        arg_1 = arg_0.service.jobs()\n        if (arg_0.running_job_id and\n                not arg_0.poll_job_complete(arg_0.running_job_id)):\n            arg_0.log.info('Attempting to cancel job : %s, %s', arg_0.project_id,\n                          arg_0.running_job_id)\n            if arg_0.location:\n                arg_1.cancel(\n                    projectId=arg_0.project_id,\n                    jobId=arg_0.running_job_id,\n                    location=arg_0.location).execute(num_retries=arg_0.num_retries)\n            else:\n                arg_1.cancel(\n                    projectId=arg_0.project_id,\n                    jobId=arg_0.running_job_id).execute(num_retries=arg_0.num_retries)\n        else:\n            arg_0.log.info('No running BigQuery jobs to cancel.')\n            return\n\n        # Wait for all the calls to cancel to finish\n        arg_2 = 12\n        arg_3 = 0\n\n        arg_4 = False\n        while arg_3 < arg_2 and not arg_4:\n            arg_3 = arg_3 + 1\n            arg_4 = arg_0.poll_job_complete(arg_0.running_job_id)\n            if arg_4:\n                arg_0.log.info('Job successfully canceled: %s, %s',\n                              arg_0.project_id, arg_0.running_job_id)\n            elif arg_3 == arg_2:\n                arg_0.log.info(\n                    \"Stopping polling due to timeout. Job with id %s \"\n                    \"has not completed cancel and may or may not finish.\",\n                    arg_0.running_job_id)\n            else:\n                arg_0.log.info('Waiting for canceled job with id %s to finish.',\n                              arg_0.running_job_id)\n                time.sleep(5)", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryBaseCursor.cancel_query", "docstring": "Cancel all started queries that have not yet completed", "docstring_tokens": ["Cancel", "all", "started", "queries", "that", "have", "not", "yet", "completed"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 251824}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/layout.py#L205-L211", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Fill the entire strip with RGB color tuple", "language": "python", "parameters": "(self, color, start=0, end=-1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "-", "1", ")", ":", "arg_2", "=", "max", "(", "arg_2", ",", "0", ")", "if", "arg_3", "<", "0", "or", "arg_3", ">=", "arg_0", ".", "numLEDs", ":", "arg_3", "=", "arg_0", ".", "numLEDs", "-", "1", "for", "arg_4", "in", "range", "(", "arg_2", ",", "arg_3", "+", "1", ")", ":", "arg_0", ".", "_set_base", "(", "arg_4", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=-1):\n        \"\"\"Fill the entire strip with RGB color tuple\"\"\"\n        arg_2 = max(arg_2, 0)\n        if arg_3 < 0 or arg_3 >= arg_0.numLEDs:\n            arg_3 = arg_0.numLEDs - 1\n        for arg_4 in range(arg_2, arg_3 + 1):  # since 0-index include end in range\n            arg_0._set_base(arg_4, arg_1)", "path": "bibliopixel/layout/layout.py", "identifier": "Layout.fill", "docstring": "Fill the entire strip with RGB color tuple", "docstring_tokens": ["Fill", "the", "entire", "strip", "with", "RGB", "color", "tuple"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 251825}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L92-L117", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Generates a set of input record", "language": "python", "parameters": "(numRecords, elemSize = 400, numSet = 42)", "return_statement": "return inputs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "400", ",", "arg_2", "=", "42", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "xrange", "(", "arg_0", ")", ":", "arg_5", "=", "np", ".", "zeros", "(", "arg_1", ",", "dtype", "=", "realDType", ")", "for", "arg_4", "in", "range", "(", "0", ",", "arg_2", ")", ":", "arg_6", "=", "np", ".", "random", ".", "random_integers", "(", "0", ",", "arg_1", "-", "1", ",", "1", ")", "[", "0", "]", "arg_5", "[", "arg_6", "]", "=", "1", "while", "abs", "(", "arg_5", ".", "sum", "(", ")", "-", "arg_2", ")", ">", "0.1", ":", "arg_6", "=", "np", ".", "random", ".", "random_integers", "(", "0", ",", "arg_1", "-", "1", ",", "1", ")", "[", "0", "]", "arg_5", "[", "arg_6", "]", "=", "1", "arg_3", ".", "append", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1 = 400, arg_2 = 42):\n  \"\"\" Generates a set of input record\n\n  Params:\n          numRecords - how many records to generate\n          elemSize - the size of each record (num 0s or 1s)\n          numSet - how many 1s in each record\n\n  Returns: a list of inputs\n  \"\"\"\n\n  arg_3 = []\n\n  for arg_4 in xrange(arg_0):\n\n    arg_5 = np.zeros(arg_1, dtype=realDType)\n    for arg_4 in range(0,arg_2):\n      arg_6 = np.random.random_integers(0, arg_1-1, 1)[0]\n      arg_5[arg_6] = 1\n    while abs(arg_5.sum() - arg_2) > 0.1:\n      arg_6 = np.random.random_integers(0, arg_1-1, 1)[0]\n      arg_5[arg_6] = 1\n\n    arg_3.append(arg_5)\n\n  return arg_3", "path": "examples/opf/tools/sp_plotter.py", "identifier": "generateRandomInput", "docstring": "Generates a set of input record\n\n  Params:\n          numRecords - how many records to generate\n          elemSize - the size of each record (num 0s or 1s)\n          numSet - how many 1s in each record\n\n  Returns: a list of inputs", "docstring_tokens": ["Generates", "a", "set", "of", "input", "record"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 251826}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/thing.py#L322-L346", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Perform an action on the thing.", "language": "python", "parameters": "(self, action_name, input_=None)", "return_statement": "return action", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "available_actions", ":", "return", "None", "arg_3", "=", "arg_0", ".", "available_actions", "[", "arg_1", "]", "if", "'input'", "in", "arg_3", "[", "'metadata'", "]", ":", "try", ":", "validate", "(", "arg_2", ",", "arg_3", "[", "'metadata'", "]", "[", "'input'", "]", ")", "except", "ValidationError", ":", "return", "None", "arg_4", "=", "arg_3", "[", "'class'", "]", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "arg_4", ".", "set_href_prefix", "(", "arg_0", ".", "href_prefix", ")", "arg_0", ".", "action_notify", "(", "arg_4", ")", "arg_0", ".", "actions", "[", "arg_1", "]", ".", "append", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Perform an action on the thing.\n\n        action_name -- name of the action\n        input_ -- any action inputs\n\n        Returns the action that was created.\n        \"\"\"\n        if arg_1 not in arg_0.available_actions:\n            return None\n\n        arg_3 = arg_0.available_actions[arg_1]\n\n        if 'input' in arg_3['metadata']:\n            try:\n                validate(arg_2, arg_3['metadata']['input'])\n            except ValidationError:\n                return None\n\n        arg_4 = arg_3['class'](arg_0, arg_2=arg_2)\n        arg_4.set_href_prefix(arg_0.href_prefix)\n        arg_0.action_notify(arg_4)\n        arg_0.actions[arg_1].append(arg_4)\n        return arg_4", "path": "webthing/thing.py", "identifier": "Thing.perform_action", "docstring": "Perform an action on the thing.\n\n        action_name -- name of the action\n        input_ -- any action inputs\n\n        Returns the action that was created.", "docstring_tokens": ["Perform", "an", "action", "on", "the", "thing", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 251827}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L469-L476", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Remove memory of state variables set in the command processor", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "stack", "=", "[", "]", "arg_0", ".", "curindex", "=", "0", "arg_0", ".", "curframe", "=", "None", "arg_0", ".", "thread_name", "=", "None", "arg_0", ".", "frame_thread_name", "=", "None", "return"], "function": "def Func(arg_0):\n        \"\"\" Remove memory of state variables set in the command processor \"\"\"\n        arg_0.stack       = []\n        arg_0.curindex    = 0\n        arg_0.curframe    = None\n        arg_0.thread_name = None\n        arg_0.frame_thread_name = None\n        return", "path": "trepan/processor/cmdproc.py", "identifier": "CommandProcessor.forget", "docstring": "Remove memory of state variables set in the command processor", "docstring_tokens": ["Remove", "memory", "of", "state", "variables", "set", "in", "the", "command", "processor"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 251828}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/decomposition.py#L29-L37", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Split a covariance matrix into block-diagonal marginals of given sizes.", "language": "python", "parameters": "(covariance, block_sizes)", "return_statement": "return marginals", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_2", "+", "arg_4", "arg_3", ".", "append", "(", "arg_0", "[", "...", ",", "arg_2", ":", "arg_5", ",", "arg_2", ":", "arg_5", "]", ")", "arg_2", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Split a covariance matrix into block-diagonal marginals of given sizes.\"\"\"\n  arg_2 = 0\n  arg_3 = []\n  for arg_4 in arg_1:\n    arg_5 = arg_2 + arg_4\n    arg_3.append(arg_0[..., arg_2:arg_5, arg_2:arg_5])\n    arg_2 = arg_5\n  return arg_3", "path": "tensorflow_probability/python/sts/decomposition.py", "identifier": "_split_covariance_into_marginals", "docstring": "Split a covariance matrix into block-diagonal marginals of given sizes.", "docstring_tokens": ["Split", "a", "covariance", "matrix", "into", "block", "-", "diagonal", "marginals", "of", "given", "sizes", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 251829}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L343-L362", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Hydrate Generated Python AST nodes with line numbers and column offsets\n    if they exist in the node environment.", "language": "python", "parameters": "(\n    py_ast: GeneratedPyAST, env: NodeEnv, include_dependencies: bool = False\n)", "return_statement": "return py_ast", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "=", "False", ")", "->", "arg_1", ":", "if", "arg_2", ".", "line", "is", "not", "None", ":", "arg_0", ".", "node", ".", "lineno", "=", "arg_2", ".", "line", "if", "arg_4", ":", "for", "arg_8", "in", "arg_0", ".", "dependencies", ":", "arg_8", ".", "lineno", "=", "arg_2", ".", "line", "if", "arg_2", ".", "col", "is", "not", "None", ":", "arg_0", ".", "node", ".", "col_offset", "=", "arg_2", ".", "col", "if", "arg_4", ":", "for", "arg_8", "in", "arg_0", ".", "dependencies", ":", "arg_8", ".", "col_offset", "=", "arg_2", ".", "col", "return", "arg_0"], "function": "def Func(\n    arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = False\n) -> arg_1:\n    \"\"\"Hydrate Generated Python AST nodes with line numbers and column offsets\n    if they exist in the node environment.\"\"\"\n    if arg_2.line is not None:\n        arg_0.node.lineno = arg_2.line\n\n        if arg_4:\n            for arg_8 in arg_0.dependencies:\n                arg_8.lineno = arg_2.line\n\n    if arg_2.col is not None:\n        arg_0.node.col_offset = arg_2.col\n\n        if arg_4:\n            for arg_8 in arg_0.dependencies:\n                arg_8.col_offset = arg_2.col\n\n    return arg_0", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_ast_with_loc", "docstring": "Hydrate Generated Python AST nodes with line numbers and column offsets\n    if they exist in the node environment.", "docstring_tokens": ["Hydrate", "Generated", "Python", "AST", "nodes", "with", "line", "numbers", "and", "column", "offsets", "if", "they", "exist", "in", "the", "node", "environment", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 251830}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/ultratb.py#L138-L211", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the entire source file and starting line number for an object.", "language": "python", "parameters": "(object)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "getsourcefile", "(", "arg_0", ")", "or", "getfile", "(", "arg_0", ")", "arg_2", "=", "None", "if", "inspect", ".", "isframe", "(", "arg_0", ")", ":", "arg_2", "=", "arg_0", ".", "f_globals", "else", ":", "arg_3", "=", "getmodule", "(", "arg_0", ",", "arg_1", ")", "if", "arg_3", ":", "arg_2", "=", "arg_3", ".", "__dict__", "arg_4", "=", "linecache", ".", "getlines", "(", "arg_1", ",", "arg_2", ")", "if", "not", "arg_4", ":", "raise", "IOError", "(", "'could not get source code'", ")", "if", "ismodule", "(", "arg_0", ")", ":", "return", "arg_4", ",", "0", "if", "isclass", "(", "arg_0", ")", ":", "arg_5", "=", "arg_0", ".", "__name__", "arg_6", "=", "re", ".", "compile", "(", "r'^(\\s*)class\\s*'", "+", "arg_5", "+", "r'\\b'", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "range", "(", "len", "(", "arg_4", ")", ")", ":", "arg_9", "=", "arg_6", ".", "match", "(", "arg_4", "[", "arg_8", "]", ")", "if", "arg_9", ":", "if", "arg_4", "[", "arg_8", "]", "[", "0", "]", "==", "'c'", ":", "return", "arg_4", ",", "arg_8", "arg_7", ".", "append", "(", "(", "arg_9", ".", "group", "(", "1", ")", ",", "arg_8", ")", ")", "if", "arg_7", ":", "arg_7", ".", "sort", "(", ")", "return", "arg_4", ",", "arg_7", "[", "0", "]", "[", "1", "]", "else", ":", "raise", "IOError", "(", "'could not find class definition'", ")", "if", "ismethod", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "im_func", "if", "isfunction", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "func_code", "if", "istraceback", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "tb_frame", "if", "isframe", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "f_code", "if", "iscode", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'co_firstlineno'", ")", ":", "raise", "IOError", "(", "'could not find function definition'", ")", "arg_6", "=", "re", ".", "compile", "(", "r'^(\\s*def\\s)|(.*(?<!\\w)lambda(:|\\s))|^(\\s*@)'", ")", "arg_10", "=", "arg_6", ".", "match", "arg_11", "=", "min", "(", "arg_0", ".", "co_firstlineno", ",", "len", "(", "arg_4", ")", ")", "-", "1", "while", "arg_11", ">", "0", ":", "if", "arg_10", "(", "arg_4", "[", "arg_11", "]", ")", ":", "break", "arg_11", "-=", "1", "return", "arg_4", ",", "arg_11", "raise", "IOError", "(", "'could not find code object'", ")"], "function": "def Func(arg_0):\n    \"\"\"Return the entire source file and starting line number for an object.\n\n    The argument may be a module, class, method, function, traceback, frame,\n    or code object.  The source code is returned as a list of all the lines\n    in the file and the line number indexes a line in that list.  An IOError\n    is raised if the source code cannot be retrieved.\n\n    FIXED version with which we monkeypatch the stdlib to work around a bug.\"\"\"\n\n    arg_1 = getsourcefile(arg_0) or getfile(arg_0)\n    # If the object is a frame, then trying to get the globals dict from its\n    # module won't work. Instead, the frame object itself has the globals\n    # dictionary.\n    arg_2 = None\n    if inspect.isframe(arg_0):\n        # XXX: can this ever be false?\n        arg_2 = arg_0.f_globals\n    else:\n        arg_3 = getmodule(arg_0, arg_1)\n        if arg_3:\n            arg_2 = arg_3.__dict__\n    arg_4 = linecache.getlines(arg_1, arg_2)\n    if not arg_4:\n        raise IOError('could not get source code')\n\n    if ismodule(arg_0):\n        return arg_4, 0\n\n    if isclass(arg_0):\n        arg_5 = arg_0.__name__\n        arg_6 = re.compile(r'^(\\s*)class\\s*' + arg_5 + r'\\b')\n        # make some effort to find the best matching class definition:\n        # use the one with the least indentation, which is the one\n        # that's most probably not inside a function definition.\n        arg_7 = []\n        for arg_8 in range(len(arg_4)):\n            arg_9 = arg_6.match(arg_4[arg_8])\n            if arg_9:\n                # if it's at toplevel, it's already the best one\n                if arg_4[arg_8][0] == 'c':\n                    return arg_4, arg_8\n                # else add whitespace to candidate list\n                arg_7.append((arg_9.group(1), arg_8))\n        if arg_7:\n            # this will sort by whitespace, and by line number,\n            # less whitespace first\n            arg_7.sort()\n            return arg_4, arg_7[0][1]\n        else:\n            raise IOError('could not find class definition')\n\n    if ismethod(arg_0):\n        arg_0 = arg_0.im_func\n    if isfunction(arg_0):\n        arg_0 = arg_0.func_code\n    if istraceback(arg_0):\n        arg_0 = arg_0.tb_frame\n    if isframe(arg_0):\n        arg_0 = arg_0.f_code\n    if iscode(arg_0):\n        if not hasattr(arg_0, 'co_firstlineno'):\n            raise IOError('could not find function definition')\n        arg_6 = re.compile(r'^(\\s*def\\s)|(.*(?<!\\w)lambda(:|\\s))|^(\\s*@)')\n        arg_10 = arg_6.match\n        # fperez - fix: sometimes, co_firstlineno can give a number larger than\n        # the length of lines, which causes an error.  Safeguard against that.\n        arg_11 = min(arg_0.co_firstlineno,len(arg_4))-1\n        while arg_11 > 0:\n            if arg_10(arg_4[arg_11]): break\n            arg_11 -= 1\n\n        return arg_4, arg_11\n    raise IOError('could not find code object')", "path": "environment/lib/python2.7/site-packages/IPython/core/ultratb.py", "identifier": "findsource", "docstring": "Return the entire source file and starting line number for an object.\n\n    The argument may be a module, class, method, function, traceback, frame,\n    or code object.  The source code is returned as a list of all the lines\n    in the file and the line number indexes a line in that list.  An IOError\n    is raised if the source code cannot be retrieved.\n\n    FIXED version with which we monkeypatch the stdlib to work around a bug.", "docstring_tokens": ["Return", "the", "entire", "source", "file", "and", "starting", "line", "number", "for", "an", "object", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 251831}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L631-L647", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Return a dictionary consisting of the key itself", "language": "python", "parameters": "(self, key_name)", "return_statement": "return result[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "db", ".", "search", "(", "Query", "(", ")", ".", "name", "==", "arg_1", ")", "if", "not", "arg_2", ":", "return", "{", "}", "return", "arg_2", "[", "0", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a dictionary consisting of the key itself\n\n        e.g.\n        {u'created_at': u'2016-10-10 08:31:53',\n         u'description': None,\n         u'metadata': None,\n         u'modified_at': u'2016-10-10 08:31:53',\n         u'name': u'aws',\n         u'uid': u'459f12c0-f341-413e-9d7e-7410f912fb74',\n         u'value': u'the_value'}\n\n        \"\"\"\n        arg_2 = arg_0.db.search(Query().name == arg_1)\n        if not arg_2:\n            return {}\n        return arg_2[0]", "path": "ghost.py", "identifier": "TinyDBStorage.get", "docstring": "Return a dictionary consisting of the key itself\n\n        e.g.\n        {u'created_at': u'2016-10-10 08:31:53',\n         u'description': None,\n         u'metadata': None,\n         u'modified_at': u'2016-10-10 08:31:53',\n         u'name': u'aws',\n         u'uid': u'459f12c0-f341-413e-9d7e-7410f912fb74',\n         u'value': u'the_value'}", "docstring_tokens": ["Return", "a", "dictionary", "consisting", "of", "the", "key", "itself"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 251832}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L80-L96", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Read the user configuration", "language": "python", "parameters": "(self, filename=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "arg_0", ".", "_config_filename", "=", "arg_1", "else", ":", "try", ":", "import", "appdirs", "except", "ImportError", ":", "raise", "Exception", "(", "\"Missing dependency for determining config path. Please install \"", "\"the 'appdirs' Python module.\"", ")", "arg_0", ".", "_config_filename", "=", "appdirs", ".", "user_config_dir", "(", "_LIBRARY_NAME", ",", "\"ProfitBricks\"", ")", "+", "\".ini\"", "if", "not", "arg_0", ".", "_config", ":", "arg_0", ".", "_config", "=", "configparser", ".", "ConfigParser", "(", ")", "arg_0", ".", "_config", ".", "optionxform", "=", "str", "arg_0", ".", "_config", ".", "read", "(", "arg_0", ".", "_config_filename", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Read the user configuration\n        \"\"\"\n        if arg_1:\n            arg_0._config_filename = arg_1\n        else:\n            try:\n                import appdirs\n            except ImportError:\n                raise Exception(\"Missing dependency for determining config path. Please install \"\n                                \"the 'appdirs' Python module.\")\n            arg_0._config_filename = appdirs.user_config_dir(_LIBRARY_NAME, \"ProfitBricks\") + \".ini\"\n        if not arg_0._config:\n            arg_0._config = configparser.ConfigParser()\n            arg_0._config.optionxform = str\n            arg_0._config.read(arg_0._config_filename)", "path": "profitbricks/client.py", "identifier": "ProfitBricksService._read_config", "docstring": "Read the user configuration", "docstring_tokens": ["Read", "the", "user", "configuration"], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 251833}
{"url": "https://github.com/carawarner/pantheon/blob/7e8718f4397eaa389fb3d5dc04fa01c7cb556512/pantheon/process.py#L22-L27", "sha": "7e8718f4397eaa389fb3d5dc04fa01c7cb556512", "docstring_summary": "Compare vectors. Borrowed from A. Parish.", "language": "python", "parameters": "(vec1, vec2)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "norm", "(", "arg_0", ")", ">", "0", "and", "norm", "(", "arg_1", ")", ">", "0", ":", "return", "dot", "(", "arg_0", ",", "arg_1", ")", "/", "(", "norm", "(", "arg_0", ")", "*", "norm", "(", "arg_1", ")", ")", "else", ":", "return", "0.0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Compare vectors. Borrowed from A. Parish.\"\"\"\n    if norm(arg_0) > 0 and norm(arg_1) > 0:\n        return dot(arg_0, arg_1) / (norm(arg_0) * norm(arg_1))\n    else:\n        return 0.0", "path": "pantheon/process.py", "identifier": "cosine", "docstring": "Compare vectors. Borrowed from A. Parish.", "docstring_tokens": ["Compare", "vectors", ".", "Borrowed", "from", "A", ".", "Parish", "."], "nwo": "carawarner/pantheon", "score": 0.1924812072065873, "idx": 251834}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L739-L764", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Retrieve an estimated time correction offset for the given stream.", "language": "python", "parameters": "(self, timeout=FOREVER)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_3", "=", "c_int", "(", ")", "arg_4", "=", "lib", ".", "lsl_Func", "(", "arg_0", ".", "obj", ",", "c_double", "(", "arg_1", ")", ",", "byref", "(", "arg_3", ")", ")", "handle_error", "(", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Retrieve an estimated time correction offset for the given stream.\n\n        The first call to this function takes several miliseconds until a \n        reliable first estimate is obtained. Subsequent calls are instantaneous \n        (and rely on periodic background updates). The precision of these \n        estimates should be below 1 ms (empirically within +/-0.2 ms).\n        \n        Keyword arguments: \n        timeout -- Timeout to acquire the first time-correction estimate \n                   (default FOREVER).\n                   \n        Returns the current time correction estimate. This is the number that \n        needs to be added to a time stamp that was remotely generated via \n        local_clock() to map it into the local clock domain of this \n        machine.\n\n        Throws a TimeoutError (if the timeout expires), or LostError (if the \n        stream source has been lost).\n\n        \"\"\"\n        arg_3 = c_int()\n        arg_4 = lib.lsl_Func(arg_0.obj, c_double(arg_1),\n                                         byref(arg_3))\n        handle_error(arg_3)\n        return arg_4", "path": "pylsl/pylsl.py", "identifier": "StreamInlet.time_correction", "docstring": "Retrieve an estimated time correction offset for the given stream.\n\n        The first call to this function takes several miliseconds until a \n        reliable first estimate is obtained. Subsequent calls are instantaneous \n        (and rely on periodic background updates). The precision of these \n        estimates should be below 1 ms (empirically within +/-0.2 ms).\n        \n        Keyword arguments: \n        timeout -- Timeout to acquire the first time-correction estimate \n                   (default FOREVER).\n                   \n        Returns the current time correction estimate. This is the number that \n        needs to be added to a time stamp that was remotely generated via \n        local_clock() to map it into the local clock domain of this \n        machine.\n\n        Throws a TimeoutError (if the timeout expires), or LostError (if the \n        stream source has been lost).", "docstring_tokens": ["Retrieve", "an", "estimated", "time", "correction", "offset", "for", "the", "given", "stream", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 251835}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/nginx/__init__.py#L38-L47", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This will output the nginx HTTP config string for specific port spec", "language": "python", "parameters": "(port_spec, bridge_ip)", "return_statement": "return server_string_spec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"\\t server {\\n\"", "arg_2", "+=", "\"\\t \\t {}\\n\"", ".", "format", "(", "_nginx_max_file_size_string", "(", ")", ")", "arg_2", "+=", "\"\\t \\t {}\\n\"", ".", "format", "(", "_nginx_listen_string", "(", "arg_0", ")", ")", "arg_2", "+=", "\"\\t \\t {}\\n\"", ".", "format", "(", "_nginx_server_name_string", "(", "arg_0", ")", ")", "arg_2", "+=", "_nginx_location_spec", "(", "arg_0", ",", "arg_1", ")", "arg_2", "+=", "_custom_502_page", "(", ")", "arg_2", "+=", "\"\\t }\\n\"", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"This will output the nginx HTTP config string for specific port spec \"\"\"\n    arg_2 = \"\\t server {\\n\"\n    arg_2 += \"\\t \\t {}\\n\".format(_nginx_max_file_size_string())\n    arg_2 += \"\\t \\t {}\\n\".format(_nginx_listen_string(arg_0))\n    arg_2 += \"\\t \\t {}\\n\".format(_nginx_server_name_string(arg_0))\n    arg_2 += _nginx_location_spec(arg_0, arg_1)\n    arg_2 += _custom_502_page()\n    arg_2 += \"\\t }\\n\"\n    return arg_2", "path": "dusty/compiler/nginx/__init__.py", "identifier": "_nginx_http_spec", "docstring": "This will output the nginx HTTP config string for specific port spec", "docstring_tokens": ["This", "will", "output", "the", "nginx", "HTTP", "config", "string", "for", "specific", "port", "spec"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 251836}
{"url": "https://github.com/pydron/anycall/blob/43add96660258a14b24aa8e8413dffb1741b72d7/anycall/rpc.py#L224-L244", "sha": "43add96660258a14b24aa8e8413dffb1741b72d7", "docstring_summary": "Create a callable that will invoke the given remote function.\n        \n        The stub will return a deferred even if the remote function does not.", "language": "python", "parameters": "(self, url)", "return_statement": "return _RPCFunctionStub(parseresult.netloc, functionid, self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_0", ".", "_opened", ",", "\"RPC System is not opened\"", "logging", ".", "debug", "(", "\"Func(%s)\"", "%", "repr", "(", "arg_1", ")", ")", "arg_2", "=", "urlparse", ".", "urlparse", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "scheme", "arg_4", "=", "arg_2", ".", "path", ".", "split", "(", "\"/\"", ")", "if", "arg_3", "!=", "\"anycall\"", ":", "raise", "ValueError", "(", "\"Not an anycall URL: %s\"", "%", "repr", "(", "arg_1", ")", ")", "if", "len", "(", "arg_4", ")", "!=", "3", "or", "arg_4", "[", "0", "]", "!=", "\"\"", "or", "arg_4", "[", "1", "]", "!=", "\"functions\"", ":", "raise", "ValueError", "(", "\"Not an URL for a remote function: %s\"", "%", "repr", "(", "arg_1", ")", ")", "try", ":", "arg_5", "=", "uuid", ".", "UUID", "(", "arg_4", "[", "2", "]", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "\"Not a valid URL for a remote function: %s\"", "%", "repr", "(", "arg_1", ")", ")", "return", "_RPCFunctionStub", "(", "arg_2", ".", "netloc", ",", "arg_5", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a callable that will invoke the given remote function.\n        \n        The stub will return a deferred even if the remote function does not.\n        \"\"\"\n        assert arg_0._opened, \"RPC System is not opened\"\n        logging.debug(\"Func(%s)\" % repr(arg_1))\n        arg_2 = urlparse.urlparse(arg_1)\n        arg_3 = arg_2.scheme\n        arg_4 = arg_2.path.split(\"/\")\n        if arg_3 != \"anycall\":\n            raise ValueError(\"Not an anycall URL: %s\" % repr(arg_1))\n        if len(arg_4) != 3 or arg_4[0] != \"\" or arg_4[1] != \"functions\":\n            raise ValueError(\"Not an URL for a remote function: %s\" % repr(arg_1))\n        try:\n            arg_5 = uuid.UUID(arg_4[2])\n        except ValueError:\n            raise ValueError(\"Not a valid URL for a remote function: %s\" % repr(arg_1))\n        \n        return _RPCFunctionStub(arg_2.netloc, arg_5, arg_0)", "path": "anycall/rpc.py", "identifier": "RPCSystem.create_function_stub", "docstring": "Create a callable that will invoke the given remote function.\n        \n        The stub will return a deferred even if the remote function does not.", "docstring_tokens": ["Create", "a", "callable", "that", "will", "invoke", "the", "given", "remote", "function", ".", "The", "stub", "will", "return", "a", "deferred", "even", "if", "the", "remote", "function", "does", "not", "."], "nwo": "pydron/anycall", "score": 0.09252797783733271, "idx": 251837}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/debugging.py#L268-L304", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Given a frame and a compiled function code, find the corresponding function object within the frame.", "language": "python", "parameters": "(frame, code)", "return_statement": "return find_code(frame.f_locals.values()) or find_code(frame.f_globals.values())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "find_code", "(", "arg_2", ",", "arg_3", "=", "0", ")", ":", "if", "arg_3", ">", "3", ":", "return", "for", "arg_4", "in", "arg_2", ":", "if", "arg_4", "is", "None", ":", "continue", "arg_5", "=", "None", "if", "hasattr", "(", "arg_4", ",", "\"__code__\"", ")", "and", "arg_4", ".", "__code__", "==", "arg_1", ":", "arg_5", "=", "arg_4", "elif", "isinstance", "(", "arg_4", ",", "type", ")", "or", "isinstance", "(", "arg_4", ",", "ModuleType", ")", ":", "try", ":", "arg_5", "=", "find_code", "(", "(", "getattr", "(", "arg_4", ",", "n", ",", "None", ")", "for", "n", "in", "dir", "(", "arg_4", ")", ")", ",", "arg_3", "+", "1", ")", "except", "Exception", ":", "continue", "elif", "isinstance", "(", "arg_4", ",", "(", "list", ",", "tuple", ",", "set", ")", ")", ":", "arg_5", "=", "find_code", "(", "arg_4", ",", "arg_3", "+", "1", ")", "elif", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "arg_5", "=", "find_code", "(", "arg_4", ".", "values", "(", ")", ",", "arg_3", "+", "1", ")", "if", "arg_5", ":", "return", "arg_5", "return", "find_code", "(", "arg_0", ".", "f_locals", ".", "values", "(", ")", ")", "or", "find_code", "(", "arg_0", ".", "f_globals", ".", "values", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Given a frame and a compiled function code, find the corresponding function object within the frame.\n\n    This function addresses the following problem: when handling a stacktrace, we receive information about\n    which piece of code was being executed in the form of a CodeType object. That objects contains function name,\n    file name, line number, and the compiled bytecode. What it *doesn't* contain is the function object itself.\n\n    So this utility function aims at locating this function object, and it does so by searching through objects\n    in the preceding local frame (i.e. the frame where the function was called from). We expect that the function\n    should usually exist there -- either by itself, or as a method on one of the objects.\n\n    :param types.FrameType frame: local frame where the function ought to be found somewhere.\n    :param types.CodeType code: the compiled code of the function to look for.\n\n    :returns: the function object, or None if not found.\n    \"\"\"\n    def find_code(arg_2, arg_3=0):\n        if arg_3 > 3: return  # Avoid potential infinite loops, or generally objects that are too deep.\n        for arg_4 in arg_2:\n            if arg_4 is None: continue\n            arg_5 = None\n            if hasattr(arg_4, \"__code__\") and arg_4.__code__ == arg_1:\n                arg_5 = arg_4\n            elif isinstance(arg_4, type) or isinstance(arg_4, ModuleType):  # class / module\n                try:\n                    arg_5 = find_code((getattr(arg_4, n, None) for n in dir(arg_4)), arg_3 + 1)\n                except Exception:\n                    # Sometimes merely getting module's attributes may cause an exception. For example :mod:`six.moves`\n                    # is such an offender...\n                    continue\n            elif isinstance(arg_4, (list, tuple, set)):\n                arg_5 = find_code(arg_4, arg_3 + 1)\n            elif isinstance(arg_4, dict):\n                arg_5 = find_code(arg_4.values(), arg_3 + 1)\n            if arg_5: return arg_5\n    return find_code(arg_0.f_locals.values()) or find_code(arg_0.f_globals.values())", "path": "h2o-py/h2o/utils/debugging.py", "identifier": "_find_function_from_code", "docstring": "Given a frame and a compiled function code, find the corresponding function object within the frame.\n\n    This function addresses the following problem: when handling a stacktrace, we receive information about\n    which piece of code was being executed in the form of a CodeType object. That objects contains function name,\n    file name, line number, and the compiled bytecode. What it *doesn't* contain is the function object itself.\n\n    So this utility function aims at locating this function object, and it does so by searching through objects\n    in the preceding local frame (i.e. the frame where the function was called from). We expect that the function\n    should usually exist there -- either by itself, or as a method on one of the objects.\n\n    :param types.FrameType frame: local frame where the function ought to be found somewhere.\n    :param types.CodeType code: the compiled code of the function to look for.\n\n    :returns: the function object, or None if not found.", "docstring_tokens": ["Given", "a", "frame", "and", "a", "compiled", "function", "code", "find", "the", "corresponding", "function", "object", "within", "the", "frame", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 251838}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L1087-L1111", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Convert unixtime to unixtime on GTFS start-of-day.", "language": "python", "parameters": "(self, ut)", "return_statement": "return ut", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "set_current_process_time_zone", "(", ")", "arg_1", "=", "time", ".", "mktime", "(", "time", ".", "localtime", "(", "arg_1", ")", "[", ":", "3", "]", "+", "(", "12", ",", "00", ",", "0", ",", "0", ",", "0", ",", "-", "1", ")", ")", "-", "43200", "set_process_timezone", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert unixtime to unixtime on GTFS start-of-day.\n\n        GTFS defines the start of a day as \"noon minus 12 hours\" to solve\n        most DST-related problems. This means that on DST-changing days,\n        the day start isn't midnight. This function isn't idempotent.\n        Running it twice on the \"move clocks backwards\" day will result in\n        being one day too early.\n\n        Parameters\n        ----------\n        ut: int\n            Unixtime\n\n        Returns\n        -------\n        ut: int\n            Unixtime corresponding to start of day\n        \"\"\"\n        # set timezone to the one of gtfs\n        arg_2 = arg_0.set_current_process_time_zone()\n        arg_1 = time.mktime(time.localtime(arg_1)[:3] + (12, 00, 0, 0, 0, -1)) - 43200\n        set_process_timezone(arg_2)\n        return arg_1", "path": "gtfspy/gtfs.py", "identifier": "GTFS.day_start_ut", "docstring": "Convert unixtime to unixtime on GTFS start-of-day.\n\n        GTFS defines the start of a day as \"noon minus 12 hours\" to solve\n        most DST-related problems. This means that on DST-changing days,\n        the day start isn't midnight. This function isn't idempotent.\n        Running it twice on the \"move clocks backwards\" day will result in\n        being one day too early.\n\n        Parameters\n        ----------\n        ut: int\n            Unixtime\n\n        Returns\n        -------\n        ut: int\n            Unixtime corresponding to start of day", "docstring_tokens": ["Convert", "unixtime", "to", "unixtime", "on", "GTFS", "start", "-", "of", "-", "day", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 251839}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/carddav_object.py#L117-L126", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Use this if you want to clone an existing contact and  replace its data\n        with new user input in one step.", "language": "python", "parameters": "(cls, contact, user_input,\n            localize_dates)", "return_statement": "return contact", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_1", "=", "arg_0", "(", "arg_1", ".", "address_book", ",", "arg_1", ".", "filename", ",", "arg_1", ".", "supported_private_objects", ",", "None", ",", "arg_3", ")", "arg_1", ".", "_process_user_input", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2,\n            arg_3):\n        \"\"\"\n        Use this if you want to clone an existing contact and  replace its data\n        with new user input in one step.\n        \"\"\"\n        arg_1 = arg_0(arg_1.address_book, arg_1.filename,\n                      arg_1.supported_private_objects, None, arg_3)\n        arg_1._process_user_input(arg_2)\n        return arg_1", "path": "khard/carddav_object.py", "identifier": "CarddavObject.from_existing_contact_with_new_user_input", "docstring": "Use this if you want to clone an existing contact and  replace its data\n        with new user input in one step.", "docstring_tokens": ["Use", "this", "if", "you", "want", "to", "clone", "an", "existing", "contact", "and", "replace", "its", "data", "with", "new", "user", "input", "in", "one", "step", "."], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 251840}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow.py#L315-L334", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Associate a notification template from this workflow.", "language": "python", "parameters": "(self, workflow,\n                                        notification_template, status)", "return_statement": "return self._assoc('notification_templates_%s' % status,\n                           workflow, notification_template)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "arg_0", ".", "_assoc", "(", "'notification_templates_%s'", "%", "arg_3", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1,\n                                        arg_2, arg_3):\n        \"\"\"Associate a notification template from this workflow.\n\n        =====API DOCS=====\n        Associate a notification template from this workflow job template.\n\n        :param workflow: The workflow job template to associate to.\n        :type workflow: str\n        :param notification_template: The notification template to be associated.\n        :type notification_template: str\n        :param status: type of notification this notification template should be associated to.\n        :type status: str\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        return arg_0._assoc('notification_templates_%s' % arg_3,\n                           arg_1, arg_2)", "path": "tower_cli/resources/workflow.py", "identifier": "Resource.associate_notification_template", "docstring": "Associate a notification template from this workflow.\n\n        =====API DOCS=====\n        Associate a notification template from this workflow job template.\n\n        :param workflow: The workflow job template to associate to.\n        :type workflow: str\n        :param notification_template: The notification template to be associated.\n        :type notification_template: str\n        :param status: type of notification this notification template should be associated to.\n        :type status: str\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Associate", "a", "notification", "template", "from", "this", "workflow", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 251841}
{"url": "https://github.com/MeirKriheli/python-bidi/blob/a0e265bb465c1b7ad628487991e33b5ebe364641/bidi/algorithm.py#L517-L577", "sha": "a0e265bb465c1b7ad628487991e33b5ebe364641", "docstring_summary": "L1 and L2 rules", "language": "python", "parameters": "(storage, debug)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "True", "arg_3", "=", "arg_0", "[", "'chars'", "]", "for", "arg_4", "in", "arg_3", "[", ":", ":", "-", "1", "]", ":", "if", "arg_4", "[", "'orig'", "]", "in", "(", "'B'", ",", "'S'", ")", ":", "arg_4", "[", "'level'", "]", "=", "arg_0", "[", "'base_level'", "]", "arg_2", "=", "True", "elif", "arg_2", "and", "arg_4", "[", "'orig'", "]", "in", "(", "'BN'", ",", "'WS'", ")", ":", "arg_4", "[", "'level'", "]", "=", "arg_0", "[", "'base_level'", "]", "else", ":", "arg_2", "=", "False", "arg_5", "=", "len", "(", "arg_3", ")", "arg_6", "=", "arg_11", "=", "0", "arg_7", "=", "0", "arg_8", "=", "EXPLICIT_LEVEL_LIMIT", "for", "arg_9", "in", "range", "(", "arg_5", ")", ":", "arg_4", "=", "arg_3", "[", "arg_9", "]", "arg_10", "=", "arg_4", "[", "'level'", "]", "if", "arg_10", ">", "arg_7", ":", "arg_7", "=", "arg_10", "if", "arg_10", "%", "2", "and", "arg_10", "<", "arg_8", ":", "arg_8", "=", "arg_10", "if", "arg_4", "[", "'orig'", "]", "==", "'B'", "or", "arg_9", "==", "arg_5", "-", "1", ":", "arg_11", "=", "arg_9", "if", "arg_4", "[", "'orig'", "]", "==", "'B'", ":", "arg_11", "-=", "1", "reverse_contiguous_sequence", "(", "arg_3", ",", "arg_6", ",", "arg_11", ",", "arg_7", ",", "arg_8", ")", "arg_6", "=", "arg_9", "+", "1", "arg_7", "=", "0", "arg_8", "=", "EXPLICIT_LEVEL_LIMIT", "if", "arg_1", ":", "debug_storage", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"L1 and L2 rules\"\"\"\n\n    # Applies L1.\n\n    arg_2 = True\n    arg_3 = arg_0['chars']\n\n    for arg_4 in arg_3[::-1]:\n        # L1. On each line, reset the embedding level of the following\n        # characters to the paragraph embedding level:\n        if arg_4['orig'] in ('B', 'S'):\n            # 1. Segment separators,\n            # 2. Paragraph separators,\n            arg_4['level'] = arg_0['base_level']\n            arg_2 = True\n        elif arg_2 and arg_4['orig'] in ('BN', 'WS'):\n            # 3. Any sequence of whitespace characters preceding a segment\n            # separator or paragraph separator\n            # 4. Any sequence of white space characters at the end of the\n            # line.\n            arg_4['level'] = arg_0['base_level']\n        else:\n            arg_2 = False\n\n    arg_5 = len(arg_3)\n\n    # L2 should be per line\n    # Calculates highest level and loweset odd level on the fly.\n\n    arg_6 = arg_11 = 0\n    arg_7 = 0\n    arg_8 = EXPLICIT_LEVEL_LIMIT\n\n    for arg_9 in range(arg_5):\n        arg_4 = arg_3[arg_9]\n\n        # calc the levels\n        arg_10 = arg_4['level']\n        if arg_10 > arg_7:\n            arg_7 = arg_10\n\n        if arg_10 % 2 and arg_10 < arg_8:\n            arg_8 = arg_10\n\n        if arg_4['orig'] == 'B' or arg_9 == arg_5 - 1:\n            arg_11 = arg_9\n            # omit line breaks\n            if arg_4['orig'] == 'B':\n                arg_11 -= 1\n\n            reverse_contiguous_sequence(arg_3, arg_6, arg_11,\n                                        arg_7, arg_8)\n\n            # reset for next line run\n            arg_6 = arg_9+1\n            arg_7 = 0\n            arg_8 = EXPLICIT_LEVEL_LIMIT\n\n    if arg_1:\n        debug_storage(arg_0)", "path": "bidi/algorithm.py", "identifier": "reorder_resolved_levels", "docstring": "L1 and L2 rules", "docstring_tokens": ["L1", "and", "L2", "rules"], "nwo": "MeirKriheli/python-bidi", "score": 0.28828505124417525, "idx": 251842}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/examples/ngrokwebhook.py#L95-L100", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Find a webhook by name.", "language": "python", "parameters": "(api, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "webhooks", ".", "list", "(", ")", ":", "if", "arg_2", ".", "name", "==", "arg_1", ":", "print", "(", "\"Deleting Webhook:\"", ",", "arg_2", ".", "name", ",", "arg_2", ".", "targetUrl", ")", "arg_0", ".", "webhooks", ".", "delete", "(", "arg_2", ".", "id", ")"], "function": "def Func(arg_0, arg_1):\r\n    \"\"\"Find a webhook by name.\"\"\"\r\n    for arg_2 in arg_0.webhooks.list():\r\n        if arg_2.name == arg_1:\r\n            print(\"Deleting Webhook:\", arg_2.name, arg_2.targetUrl)\r\n            arg_0.webhooks.delete(arg_2.id)", "path": "examples/ngrokwebhook.py", "identifier": "delete_webhooks_with_name", "docstring": "Find a webhook by name.", "docstring_tokens": ["Find", "a", "webhook", "by", "name", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 251843}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/genericpath.py#L93-L113", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Split the extension from a pathname.", "language": "python", "parameters": "(p, sep, altsep, extsep)", "return_statement": "return p, ''", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "rfind", "(", "arg_1", ")", "if", "arg_2", ":", "arg_5", "=", "arg_0", ".", "rfind", "(", "arg_2", ")", "arg_4", "=", "max", "(", "arg_4", ",", "arg_5", ")", "arg_6", "=", "arg_0", ".", "rfind", "(", "arg_3", ")", "if", "arg_6", ">", "arg_4", ":", "arg_7", "=", "arg_4", "+", "1", "while", "arg_7", "<", "arg_6", ":", "if", "arg_0", "[", "arg_7", "]", "!=", "arg_3", ":", "return", "arg_0", "[", ":", "arg_6", "]", ",", "arg_0", "[", "arg_6", ":", "]", "arg_7", "+=", "1", "return", "arg_0", ",", "''"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Split the extension from a pathname.\n\n    Extension is everything from the last dot to the end, ignoring\n    leading dots.  Returns \"(root, ext)\"; ext may be empty.\"\"\"\n\n    arg_4 = arg_0.rfind(arg_1)\n    if arg_2:\n        arg_5 = arg_0.rfind(arg_2)\n        arg_4 = max(arg_4, arg_5)\n\n    arg_6 = arg_0.rfind(arg_3)\n    if arg_6 > arg_4:\n        # skip all leading dots\n        arg_7 = arg_4 + 1\n        while arg_7 < arg_6:\n            if arg_0[arg_7] != arg_3:\n                return arg_0[:arg_6], arg_0[arg_6:]\n            arg_7 += 1\n\n    return arg_0, ''", "path": "third_party/stdlib/genericpath.py", "identifier": "_splitext", "docstring": "Split the extension from a pathname.\n\n    Extension is everything from the last dot to the end, ignoring\n    leading dots.  Returns \"(root, ext)\"; ext may be empty.", "docstring_tokens": ["Split", "the", "extension", "from", "a", "pathname", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 251844}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/util/lens_fit_util.py#L152-L174", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "For lens data, compute the unmasked blurred image of every unmasked unblurred image of every galaxy in each \\\n    plane. To do this, this function iterates over all planes and then galaxies to extract their unmasked unblurred \\\n    images.", "language": "python", "parameters": "(planes, padded_grid_stack, psf)", "return_statement": "return [plane.unmasked_blurred_image_of_galaxies_from_psf(padded_grid_stack, psf) for plane in planes]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "[", "arg_3", ".", "unmasked_blurred_image_of_galaxies_from_psf", "(", "arg_1", ",", "arg_2", ")", "for", "arg_3", "in", "arg_0", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"For lens data, compute the unmasked blurred image of every unmasked unblurred image of every galaxy in each \\\n    plane. To do this, this function iterates over all planes and then galaxies to extract their unmasked unblurred \\\n    images.\n\n    If a galaxy in a plane has a pixelization, the unmasked image of that galaxy in the plane is returned as None \\\n    as as the inversion's model image cannot be mapped to an unmasked version.\n\n    This relies on using the lens data's padded-grid, which is a grid of (y,x) coordinates which extends over the \\\n    entire image as opposed to just the masked region.\n\n    This returns a list of lists, where each list index corresponds to [plane_index][galaxy_index].\n\n    Parameters\n    ----------\n    planes : [plane.Plane]\n        The list of planes the unmasked blurred images are computed using.\n    padded_grid_stack : grids.GridStack\n        A padded-grid_stack, whose padded grid is used for PSF convolution.\n    psf : ccd.PSF\n        The PSF of the image used for convolution.\n    \"\"\"\n    return [arg_3.unmasked_blurred_image_of_galaxies_from_psf(arg_1, arg_2) for arg_3 in arg_0]", "path": "autolens/lens/util/lens_fit_util.py", "identifier": "unmasked_blurred_image_of_planes_and_galaxies_from_padded_grid_stack_and_psf", "docstring": "For lens data, compute the unmasked blurred image of every unmasked unblurred image of every galaxy in each \\\n    plane. To do this, this function iterates over all planes and then galaxies to extract their unmasked unblurred \\\n    images.\n\n    If a galaxy in a plane has a pixelization, the unmasked image of that galaxy in the plane is returned as None \\\n    as as the inversion's model image cannot be mapped to an unmasked version.\n\n    This relies on using the lens data's padded-grid, which is a grid of (y,x) coordinates which extends over the \\\n    entire image as opposed to just the masked region.\n\n    This returns a list of lists, where each list index corresponds to [plane_index][galaxy_index].\n\n    Parameters\n    ----------\n    planes : [plane.Plane]\n        The list of planes the unmasked blurred images are computed using.\n    padded_grid_stack : grids.GridStack\n        A padded-grid_stack, whose padded grid is used for PSF convolution.\n    psf : ccd.PSF\n        The PSF of the image used for convolution.", "docstring_tokens": ["For", "lens", "data", "compute", "the", "unmasked", "blurred", "image", "of", "every", "unmasked", "unblurred", "image", "of", "every", "galaxy", "in", "each", "\\", "plane", ".", "To", "do", "this", "this", "function", "iterates", "over", "all", "planes", "and", "then", "galaxies", "to", "extract", "their", "unmasked", "unblurred", "\\", "images", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 251845}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/proximal_hessian_sparse.py#L471-L590", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Minimize using Hessian-informed proximal gradient descent.", "language": "python", "parameters": "(grad_and_hessian_loss_fn,\n             x_start,\n             tolerance,\n             l1_regularizer,\n             l2_regularizer=None,\n             maximum_iterations=1,\n             maximum_full_sweeps_per_iteration=1,\n             learning_rate=None,\n             name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "1", ",", "arg_6", "=", "1", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ")", ":", "arg_9", "=", "[", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_2", ",", "arg_7", ",", "]", ",", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_8", ",", "'Func'", ",", "arg_9", ")", ":", "def", "_loop_cond", "(", "arg_1", ",", "arg_10", ",", "arg_11", ")", ":", "del", "arg_1", "return", "tf", ".", "logical_and", "(", "arg_11", "<", "arg_5", ",", "tf", ".", "logical_not", "(", "arg_10", ")", ")", "def", "_loop_body", "(", "arg_1", ",", "arg_10", ",", "arg_11", ")", ":", "arg_12", ",", "arg_13", ",", "arg_14", "=", "arg_0", "(", "arg_1", ")", "arg_1", ",", "arg_10", ",", "arg_15", "=", "Func_one_step", "(", "gradient_unregularized_loss", "=", "arg_12", ",", "hessian_unregularized_loss_outer", "=", "arg_13", ",", "hessian_unregularized_loss_middle", "=", "arg_14", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "maximum_full_sweeps", "=", "arg_6", ",", "arg_2", "=", "arg_2", ",", "arg_7", "=", "arg_7", ")", "return", "arg_1", ",", "arg_10", ",", "arg_11", "+", "1", "return", "tf", ".", "while_loop", "(", "cond", "=", "_loop_cond", ",", "body", "=", "_loop_body", ",", "loop_vars", "=", "[", "arg_1", ",", "tf", ".", "zeros", "(", "[", "]", ",", "np", ".", "bool", ",", "arg_8", "=", "'converged'", ")", ",", "tf", ".", "zeros", "(", "[", "]", ",", "np", ".", "int32", ",", "arg_8", "=", "'iter'", ")", ",", "]", ")"], "function": "def Func(arg_0,\n             arg_1,\n             arg_2,\n             arg_3,\n             arg_4=None,\n             arg_5=1,\n             arg_6=1,\n             arg_7=None,\n             arg_8=None):\n  \"\"\"Minimize using Hessian-informed proximal gradient descent.\n\n  This function solves the regularized minimization problem\n\n  ```none\n  argmin{ Loss(x)\n            + l1_regularizer * ||x||_1\n            + l2_regularizer * ||x||_2**2\n          : x in R^n }\n  ```\n\n  where `Loss` is a convex C^2 function (typically, `Loss` is the negative log\n  likelihood of a model and `x` is a vector of model coefficients).  The `Loss`\n  function does not need to be supplied directly, but this optimizer does need a\n  way to compute the gradient and Hessian of the Loss function at a given value\n  of `x`.  The gradient and Hessian are often computationally expensive, and\n  this optimizer calls them relatively few times compared with other algorithms.\n\n  Args:\n    grad_and_hessian_loss_fn: callable that takes as input a (batch of) `Tensor`\n      of the same shape and dtype as `x_start` and returns the triple\n      `(gradient_unregularized_loss, hessian_unregularized_loss_outer,\n      hessian_unregularized_loss_middle)` as defined in the argument spec of\n      `Func_one_step`.\n    x_start: (Batch of) vector-shaped, `float` `Tensor` representing the initial\n      value of the argument to the `Loss` function.\n    tolerance: scalar, `float` `Tensor` representing the tolerance for each\n      optimization step; see the `tolerance` argument of\n      `Func_one_step`.\n    l1_regularizer: scalar, `float` `Tensor` representing the weight of the L1\n      regularization term (see equation above).\n    l2_regularizer: scalar, `float` `Tensor` representing the weight of the L2\n      regularization term (see equation above).\n      Default value: `None` (i.e., no L2 regularization).\n    maximum_iterations: Python integer specifying the maximum number of\n      iterations of the outer loop of the optimizer.  After this many iterations\n      of the outer loop, the algorithm will terminate even if the return value\n      `optimal_x` has not converged.\n      Default value: `1`.\n    maximum_full_sweeps_per_iteration: Python integer specifying the maximum\n      number of sweeps allowed in each iteration of the outer loop of the\n      optimizer.  Passed as the `maximum_full_sweeps` argument to\n      `Func_one_step`.\n      Default value: `1`.\n    learning_rate: scalar, `float` `Tensor` representing a multiplicative factor\n      used to dampen the proximal gradient descent steps.\n      Default value: `None` (i.e., factor is conceptually `1`).\n    name: Python string representing the name of the TensorFlow operation.\n      The default name is `\"Func\"`.\n\n  Returns:\n    x: `Tensor` of the same shape and dtype as `x_start`, representing the\n      (batches of) computed values of `x` which Funcs `Loss(x)`.\n    is_converged: scalar, `bool` `Tensor` indicating whether the minimization\n      procedure converged within the specified number of iterations across all\n      batches.  Here convergence means that an iteration of the inner loop\n      (`Func_one_step`) returns `True` for its `is_converged` output value.\n    iter: scalar, `int` `Tensor` indicating the actual number of iterations of\n      the outer loop of the optimizer completed (i.e., number of calls to\n      `Func_one_step` before achieving convergence).\n\n  #### References\n\n  [1]: Jerome Friedman, Trevor Hastie and Rob Tibshirani. Regularization Paths\n       for Generalized Linear Models via Coordinate Descent. _Journal of\n       Statistical Software_, 33(1), 2010.\n       https://www.jstatsoft.org/article/view/v033i01/v33i01.pdf\n\n  [2]: Guo-Xun Yuan, Chia-Hua Ho and Chih-Jen Lin. An Improved GLMNET for\n       L1-regularized Logistic Regression. _Journal of Machine Learning\n       Research_, 13, 2012.\n       http://www.jmlr.org/papers/volume13/yuan12a/yuan12a.pdf\n  \"\"\"\n  arg_9 = [\n      arg_1,\n      arg_3,\n      arg_4,\n      arg_5,\n      arg_6,\n      arg_2,\n      arg_7,\n  ],\n  with tf.compat.v1.name_scope(arg_8, 'Func', arg_9):\n\n    def _loop_cond(arg_1, arg_10, arg_11):\n      del arg_1\n      return tf.logical_and(arg_11 < arg_5,\n                            tf.logical_not(arg_10))\n\n    def _loop_body(arg_1, arg_10, arg_11):  # pylint: disable=missing-docstring\n      arg_12, arg_13, arg_14 = arg_0(arg_1)\n      arg_1, arg_10, arg_15 = Func_one_step(\n          gradient_unregularized_loss=arg_12,\n          hessian_unregularized_loss_outer=arg_13,\n          hessian_unregularized_loss_middle=arg_14,\n          arg_1=arg_1,\n          arg_3=arg_3,\n          arg_4=arg_4,\n          maximum_full_sweeps=arg_6,\n          arg_2=arg_2,\n          arg_7=arg_7)\n      return arg_1, arg_10, arg_11 + 1\n\n    return tf.while_loop(\n        cond=_loop_cond,\n        body=_loop_body,\n        loop_vars=[\n            arg_1,\n            tf.zeros([], np.bool, arg_8='converged'),\n            tf.zeros([], np.int32, arg_8='iter'),\n        ])", "path": "tensorflow_probability/python/optimizer/proximal_hessian_sparse.py", "identifier": "minimize", "docstring": "Minimize using Hessian-informed proximal gradient descent.\n\n  This function solves the regularized minimization problem\n\n  ```none\n  argmin{ Loss(x)\n            + l1_regularizer * ||x||_1\n            + l2_regularizer * ||x||_2**2\n          : x in R^n }\n  ```\n\n  where `Loss` is a convex C^2 function (typically, `Loss` is the negative log\n  likelihood of a model and `x` is a vector of model coefficients).  The `Loss`\n  function does not need to be supplied directly, but this optimizer does need a\n  way to compute the gradient and Hessian of the Loss function at a given value\n  of `x`.  The gradient and Hessian are often computationally expensive, and\n  this optimizer calls them relatively few times compared with other algorithms.\n\n  Args:\n    grad_and_hessian_loss_fn: callable that takes as input a (batch of) `Tensor`\n      of the same shape and dtype as `x_start` and returns the triple\n      `(gradient_unregularized_loss, hessian_unregularized_loss_outer,\n      hessian_unregularized_loss_middle)` as defined in the argument spec of\n      `minimize_one_step`.\n    x_start: (Batch of) vector-shaped, `float` `Tensor` representing the initial\n      value of the argument to the `Loss` function.\n    tolerance: scalar, `float` `Tensor` representing the tolerance for each\n      optimization step; see the `tolerance` argument of\n      `minimize_one_step`.\n    l1_regularizer: scalar, `float` `Tensor` representing the weight of the L1\n      regularization term (see equation above).\n    l2_regularizer: scalar, `float` `Tensor` representing the weight of the L2\n      regularization term (see equation above).\n      Default value: `None` (i.e., no L2 regularization).\n    maximum_iterations: Python integer specifying the maximum number of\n      iterations of the outer loop of the optimizer.  After this many iterations\n      of the outer loop, the algorithm will terminate even if the return value\n      `optimal_x` has not converged.\n      Default value: `1`.\n    maximum_full_sweeps_per_iteration: Python integer specifying the maximum\n      number of sweeps allowed in each iteration of the outer loop of the\n      optimizer.  Passed as the `maximum_full_sweeps` argument to\n      `minimize_one_step`.\n      Default value: `1`.\n    learning_rate: scalar, `float` `Tensor` representing a multiplicative factor\n      used to dampen the proximal gradient descent steps.\n      Default value: `None` (i.e., factor is conceptually `1`).\n    name: Python string representing the name of the TensorFlow operation.\n      The default name is `\"minimize\"`.\n\n  Returns:\n    x: `Tensor` of the same shape and dtype as `x_start`, representing the\n      (batches of) computed values of `x` which minimizes `Loss(x)`.\n    is_converged: scalar, `bool` `Tensor` indicating whether the minimization\n      procedure converged within the specified number of iterations across all\n      batches.  Here convergence means that an iteration of the inner loop\n      (`minimize_one_step`) returns `True` for its `is_converged` output value.\n    iter: scalar, `int` `Tensor` indicating the actual number of iterations of\n      the outer loop of the optimizer completed (i.e., number of calls to\n      `minimize_one_step` before achieving convergence).\n\n  #### References\n\n  [1]: Jerome Friedman, Trevor Hastie and Rob Tibshirani. Regularization Paths\n       for Generalized Linear Models via Coordinate Descent. _Journal of\n       Statistical Software_, 33(1), 2010.\n       https://www.jstatsoft.org/article/view/v033i01/v33i01.pdf\n\n  [2]: Guo-Xun Yuan, Chia-Hua Ho and Chih-Jen Lin. An Improved GLMNET for\n       L1-regularized Logistic Regression. _Journal of Machine Learning\n       Research_, 13, 2012.\n       http://www.jmlr.org/papers/volume13/yuan12a/yuan12a.pdf", "docstring_tokens": ["Minimize", "using", "Hessian", "-", "informed", "proximal", "gradient", "descent", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 251846}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/core.py#L19-L46", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Returns the lowest bit num from a given bit pattern. Returns None if no\n    bits set.", "language": "python", "parameters": "(bit_pattern)", "return_statement": "return bit_num", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "0", ":", "return", "None", "arg_1", "=", "0", "while", "(", "arg_0", "&", "1", ")", "==", "0", ":", "arg_0", "=", "arg_0", ">>", "1", "arg_1", "+=", "1", "if", "arg_1", ">", "7", ":", "arg_1", "=", "0", "break", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns the lowest bit num from a given bit pattern. Returns None if no\n    bits set.\n\n    :param bit_pattern: The bit pattern.\n    :type bit_pattern: int\n    :returns: int -- the bit number\n    :returns: None -- no bits set\n\n    >>> pifacecommon.core.Func(0)\n    None\n    >>> pifacecommon.core.Func(0b1)\n    0\n    >>> pifacecommon.core.Func(0b11000)\n    3\n    \"\"\"\n    if arg_0 == 0:\n        return None\n\n    arg_1 = 0  # assume bit 0\n    while (arg_0 & 1) == 0:\n        arg_0 = arg_0 >> 1\n        arg_1 += 1\n        if arg_1 > 7:\n            arg_1 = 0\n            break\n\n    return arg_1", "path": "pifacecommon/core.py", "identifier": "get_bit_num", "docstring": "Returns the lowest bit num from a given bit pattern. Returns None if no\n    bits set.\n\n    :param bit_pattern: The bit pattern.\n    :type bit_pattern: int\n    :returns: int -- the bit number\n    :returns: None -- no bits set\n\n    >>> pifacecommon.core.get_bit_num(0)\n    None\n    >>> pifacecommon.core.get_bit_num(0b1)\n    0\n    >>> pifacecommon.core.get_bit_num(0b11000)\n    3", "docstring_tokens": ["Returns", "the", "lowest", "bit", "num", "from", "a", "given", "bit", "pattern", ".", "Returns", "None", "if", "no", "bits", "set", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 251847}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L848-L859", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Set the focus to position or raise IndexError.", "language": "python", "parameters": "(self, position)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_focus_position", "=", "arg_1", "arg_0", ".", "_modified", "(", ")", "try", ":", "arg_0", ".", "next_position", "(", "arg_1", ")", "except", "IndexError", ":", "arg_0", ".", "_is_scrolling", "=", "False", "else", ":", "arg_0", ".", "_is_scrolling", "=", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set the focus to position or raise IndexError.\"\"\"\n        arg_0._focus_position = arg_1\n        arg_0._modified()\n        # If we set focus to anywhere but the last position, the user if\n        # scrolling up:\n        try:\n            arg_0.next_position(arg_1)\n        except IndexError:\n            arg_0._is_scrolling = False\n        else:\n            arg_0._is_scrolling = True", "path": "hangups/ui/__main__.py", "identifier": "ConversationEventListWalker.set_focus", "docstring": "Set the focus to position or raise IndexError.", "docstring_tokens": ["Set", "the", "focus", "to", "position", "or", "raise", "IndexError", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 251848}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/institute.py#L38-L129", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update the information for an institute", "language": "python", "parameters": "(self, internal_id, sanger_recipient=None, coverage_cutoff=None, \n                         frequency_cutoff=None, display_name=None, remove_sanger=None,\n                         phenotype_groups=None, group_abbreviations=None, add_groups=None)", "return_statement": "return updated_institute", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ")", ":", "arg_9", "=", "arg_9", "or", "False", "arg_10", "=", "arg_0", ".", "institute", "(", "arg_1", ")", "if", "not", "arg_10", ":", "raise", "IntegrityError", "(", "\"Institute {} does not exist in database\"", ".", "format", "(", "arg_1", ")", ")", "arg_11", "=", "{", "}", "arg_12", "=", "arg_10", "if", "arg_2", ":", "arg_13", "=", "arg_0", ".", "user", "(", "arg_2", ")", "if", "not", "arg_13", ":", "raise", "IntegrityError", "(", "\"user {} does not exist in database\"", ".", "format", "(", "arg_2", ")", ")", "LOG", ".", "info", "(", "\"Updating sanger recipients for institute: {0} with {1}\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "arg_11", "[", "'$push'", "]", "=", "{", "'sanger_recipients'", ":", "arg_6", "}", "if", "arg_6", ":", "LOG", ".", "info", "(", "\"Removing sanger recipient {0} from institute: {1}\"", ".", "format", "(", "arg_6", ",", "arg_1", ")", ")", "arg_11", "[", "'$pull'", "]", "=", "{", "'sanger_recipients'", ":", "arg_6", "}", "if", "arg_3", ":", "LOG", ".", "info", "(", "\"Updating coverage cutoff for institute: {0} to {1}\"", ".", "format", "(", "arg_1", ",", "arg_3", ")", ")", "arg_11", "[", "'$set'", "]", "=", "{", "'coverage_cutoff'", ":", "arg_3", "}", "if", "arg_4", ":", "LOG", ".", "info", "(", "\"Updating frequency cutoff for institute: {0} to {1}\"", ".", "format", "(", "arg_1", ",", "arg_4", ")", ")", "if", "not", "'$set'", "in", "arg_11", ":", "arg_11", "[", "'$set'", "]", "=", "{", "}", "arg_11", "[", "'$set'", "]", "=", "{", "'frequency_cutoff'", ":", "arg_4", "}", "if", "arg_5", ":", "LOG", ".", "info", "(", "\"Updating display name for institute: {0} to {1}\"", ".", "format", "(", "arg_1", ",", "arg_5", ")", ")", "if", "not", "'$set'", "in", "arg_11", ":", "arg_11", "[", "'$set'", "]", "=", "{", "}", "arg_11", "[", "'$set'", "]", "=", "{", "'display_name'", ":", "arg_5", "}", "if", "arg_7", ":", "if", "arg_8", ":", "arg_8", "=", "list", "(", "arg_8", ")", "arg_14", "=", "{", "}", "if", "arg_9", ":", "arg_14", "=", "arg_10", ".", "get", "(", "'phenotype_groups'", ",", "PHENOTYPE_GROUPS", ")", "for", "arg_15", ",", "arg_16", "in", "enumerate", "(", "arg_7", ")", ":", "arg_17", "=", "arg_0", ".", "hpo_term", "(", "arg_16", ")", "if", "not", "arg_17", ":", "raise", "IntegrityError", "(", "\"Term {} does not exist\"", ".", "format", "(", "arg_16", ")", ")", "arg_18", "=", "arg_17", "[", "'hpo_id'", "]", "arg_19", "=", "arg_17", "[", "'description'", "]", "arg_20", "=", "None", "if", "arg_8", ":", "arg_20", "=", "arg_8", "[", "arg_15", "]", "arg_14", "[", "arg_16", "]", "=", "{", "'name'", ":", "arg_19", ",", "'abbr'", ":", "arg_20", "}", "arg_11", "[", "'$set'", "]", "=", "{", "'phenotype_groups'", ":", "arg_14", "}", "if", "arg_11", ":", "if", "not", "'$set'", "in", "arg_11", ":", "arg_11", "[", "'$set'", "]", "=", "{", "}", "arg_11", "[", "'$set'", "]", "[", "'updated_at'", "]", "=", "datetime", ".", "now", "(", ")", "arg_12", "=", "arg_0", ".", "institute_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_1", "}", ",", "arg_11", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "LOG", ".", "info", "(", "\"Institute updated\"", ")", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, \n                         arg_4=None, arg_5=None, arg_6=None,\n                         arg_7=None, arg_8=None, arg_9=None):\n        \"\"\"Update the information for an institute\n\n        Args:\n            internal_id(str): The internal institute id\n            sanger_recipient(str): Email adress to add for sanger order\n            coverage_cutoff(int): Update coverage cutoff\n            frequency_cutoff(float): New frequency cutoff\n            display_name(str): New display name\n            remove_sanger(str): Email adress for sanger user to be removed\n            phenotype_groups(iterable(str)): New phenotype groups\n            group_abbreviations(iterable(str))\n            add_groups: If groups should be added. If False replace groups\n        \n        Returns:\n            updated_institute(dict)\n                     \n        \"\"\"\n        arg_9 = arg_9 or False\n        arg_10 = arg_0.institute(arg_1)\n        if not arg_10:\n            raise IntegrityError(\"Institute {} does not exist in database\".format(arg_1))\n        \n        arg_11 = {}\n        arg_12 = arg_10\n\n        if arg_2:\n            arg_13 = arg_0.user(arg_2)\n            if not arg_13:\n                raise IntegrityError(\"user {} does not exist in database\".format(arg_2))\n                \n            LOG.info(\"Updating sanger recipients for institute: {0} with {1}\".format(\n                     arg_1, arg_2))\n            arg_11['$push'] = {'sanger_recipients':arg_6}\n\n        if arg_6:\n            LOG.info(\"Removing sanger recipient {0} from institute: {1}\".format(\n                     arg_6, arg_1))\n            arg_11['$pull'] = {'sanger_recipients':arg_6}\n\n        if arg_3:\n            LOG.info(\"Updating coverage cutoff for institute: {0} to {1}\".format(\n                            arg_1, arg_3))\n            arg_11['$set'] = {'coverage_cutoff': arg_3}\n        \n        if arg_4:\n            LOG.info(\"Updating frequency cutoff for institute: {0} to {1}\".format(\n                            arg_1, arg_4))\n            if not '$set' in arg_11:\n                arg_11['$set'] = {}\n            arg_11['$set'] = {'frequency_cutoff': arg_4}\n\n        if arg_5:\n            LOG.info(\"Updating display name for institute: {0} to {1}\".format(\n                            arg_1, arg_5))\n            if not '$set' in arg_11:\n                arg_11['$set'] = {}\n            arg_11['$set'] = {'display_name': arg_5}\n\n        if arg_7:\n            if arg_8:\n                arg_8 = list(arg_8)\n            arg_14 = {}\n            if arg_9:\n                arg_14 = arg_10.get('phenotype_groups', PHENOTYPE_GROUPS)\n\n            for arg_15,arg_16 in enumerate(arg_7):\n                arg_17 = arg_0.hpo_term(arg_16)\n                if not arg_17:\n                    raise IntegrityError(\"Term {} does not exist\".format(arg_16))\n                arg_18 = arg_17['hpo_id']\n                arg_19 = arg_17['description']\n                arg_20 = None\n                if arg_8:\n                    arg_20 = arg_8[arg_15]\n                arg_14[arg_16] = {'name': arg_19, 'abbr':arg_20}\n            arg_11['$set'] = {'phenotype_groups': arg_14}\n        \n        if arg_11:\n            if not '$set' in arg_11:\n                arg_11['$set'] = {}\n            \n            arg_11['$set']['updated_at'] = datetime.now()\n            \n            arg_12 = arg_0.institute_collection.find_one_and_update(\n                {'_id':arg_1}, arg_11, return_document = pymongo.ReturnDocument.AFTER)\n            \n            LOG.info(\"Institute updated\")\n        \n        return arg_12", "path": "scout/adapter/mongo/institute.py", "identifier": "InstituteHandler.update_institute", "docstring": "Update the information for an institute\n\n        Args:\n            internal_id(str): The internal institute id\n            sanger_recipient(str): Email adress to add for sanger order\n            coverage_cutoff(int): Update coverage cutoff\n            frequency_cutoff(float): New frequency cutoff\n            display_name(str): New display name\n            remove_sanger(str): Email adress for sanger user to be removed\n            phenotype_groups(iterable(str)): New phenotype groups\n            group_abbreviations(iterable(str))\n            add_groups: If groups should be added. If False replace groups\n        \n        Returns:\n            updated_institute(dict)", "docstring_tokens": ["Update", "the", "information", "for", "an", "institute"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 251849}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/session.py#L549-L564", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Execute the wrapped code, accepting a prompt, optionally responding to the prompt.", "language": "python", "parameters": "(self, text=None, response=None, wait=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "with", "arg_0", ".", "driver", ".", "accept_modal", "(", "\"prompt\"", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ":", "yield"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"\n        Execute the wrapped code, accepting a prompt, optionally responding to the prompt.\n\n        Args:\n            text (str | RegexObject, optional): Text to match against the text in the modal.\n            response (str, optional): Response to provide to the prompt.\n            wait (int | float, optional): Maximum time to wait for the modal to appear after\n                executing the wrapped code.\n\n        Raises:\n            ModalNotFound: If a modal dialog hasn't been found.\n        \"\"\"\n\n        with arg_0.driver.accept_modal(\"prompt\", arg_1=arg_1, arg_2=arg_2, arg_3=arg_3):\n            yield", "path": "capybara/session.py", "identifier": "Session.accept_prompt", "docstring": "Execute the wrapped code, accepting a prompt, optionally responding to the prompt.\n\n        Args:\n            text (str | RegexObject, optional): Text to match against the text in the modal.\n            response (str, optional): Response to provide to the prompt.\n            wait (int | float, optional): Maximum time to wait for the modal to appear after\n                executing the wrapped code.\n\n        Raises:\n            ModalNotFound: If a modal dialog hasn't been found.", "docstring_tokens": ["Execute", "the", "wrapped", "code", "accepting", "a", "prompt", "optionally", "responding", "to", "the", "prompt", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 251850}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/processing.py#L91-L123", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Cut a clip from a video.", "language": "python", "parameters": "(in_file,\n              out_file,\n              start=None,\n              end=None,\n              vcodec=None,\n              acodec=None,\n              log_level='info',\n              print_cmd=False,\n              **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'info'", ",", "arg_7", "=", "False", ",", "**", "arg_8", ")", ":", "arg_9", "=", "{", "'log_level'", ":", "arg_6", "}", "if", "arg_4", "is", "None", ":", "arg_9", "[", "'vcodec'", "]", "=", "'copy'", "if", "arg_5", "is", "None", ":", "arg_9", "[", "'acodec'", "]", "=", "'copy'", "if", "arg_2", ":", "arg_9", "[", "'ss'", "]", "=", "arg_2", "else", ":", "arg_2", "=", "0", "if", "arg_3", ":", "arg_9", "[", "'t'", "]", "=", "arg_3", "-", "arg_2", "convert_video", "(", "arg_0", ",", "arg_1", ",", "arg_7", ",", "**", "arg_9", ")"], "function": "def Func(arg_0,\n              arg_1,\n              arg_2=None,\n              arg_3=None,\n              arg_4=None,\n              arg_5=None,\n              arg_6='info',\n              arg_7=False,\n              **arg_8):\n    \"\"\"Cut a clip from a video.\n\n    Args:\n        in_file (str): Input video filename.\n        out_file (str): Output video filename.\n        start (None or float): Start time (in seconds).\n        end (None or float): End time (in seconds).\n        vcodec (None or str): Output video codec, None for unchanged.\n        acodec (None or str): Output audio codec, None for unchanged.\n        log_level (str): Logging level of ffmpeg.\n        print_cmd (bool): Whether to print the final ffmpeg command.\n    \"\"\"\n    arg_9 = {'log_level': arg_6}\n    if arg_4 is None:\n        arg_9['vcodec'] = 'copy'\n    if arg_5 is None:\n        arg_9['acodec'] = 'copy'\n    if arg_2:\n        arg_9['ss'] = arg_2\n    else:\n        arg_2 = 0\n    if arg_3:\n        arg_9['t'] = arg_3 - arg_2\n    convert_video(arg_0, arg_1, arg_7, **arg_9)", "path": "mmcv/video/processing.py", "identifier": "cut_video", "docstring": "Cut a clip from a video.\n\n    Args:\n        in_file (str): Input video filename.\n        out_file (str): Output video filename.\n        start (None or float): Start time (in seconds).\n        end (None or float): End time (in seconds).\n        vcodec (None or str): Output video codec, None for unchanged.\n        acodec (None or str): Output audio codec, None for unchanged.\n        log_level (str): Logging level of ffmpeg.\n        print_cmd (bool): Whether to print the final ffmpeg command.", "docstring_tokens": ["Cut", "a", "clip", "from", "a", "video", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 251851}
{"url": "https://github.com/mtomwing/purplex/blob/4072109e1d4395826983cd9d95ead2c1dfc1184e/purplex/grammar.py#L132-L158", "sha": "4072109e1d4395826983cd9d95ead2c1dfc1184e", "docstring_summary": "Computes the FOLLOW set for every non-terminal in the grammar.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_follow", "[", "arg_0", ".", "start_symbol", "]", ".", "add", "(", "END_OF_INPUT", ")", "while", "True", ":", "arg_1", "=", "False", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "nonterminals", ".", "items", "(", ")", ":", "for", "arg_4", "in", "arg_3", ":", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ".", "rhs", ")", ":", "if", "arg_6", "not", "in", "arg_0", ".", "nonterminals", ":", "continue", "arg_7", "=", "arg_0", ".", "first", "(", "arg_4", ".", "rhs", "[", "arg_5", "+", "1", ":", "]", ")", "arg_8", "=", "arg_7", "-", "set", "(", "[", "EPSILON", "]", ")", "if", "EPSILON", "in", "arg_7", "or", "arg_5", "==", "(", "len", "(", "arg_4", ".", "rhs", ")", "-", "1", ")", ":", "arg_8", "|=", "arg_0", ".", "_follow", "[", "arg_2", "]", "if", "arg_8", "-", "arg_0", ".", "_follow", "[", "arg_6", "]", ":", "arg_0", ".", "_follow", "[", "arg_6", "]", "|=", "arg_8", "arg_1", "=", "True", "if", "not", "arg_1", ":", "break"], "function": "def Func(arg_0):\n        \"\"\"Computes the FOLLOW set for every non-terminal in the grammar.\n\n        Tenatively based on Func in PLY.\n        \"\"\"\n        arg_0._follow[arg_0.start_symbol].add(END_OF_INPUT)\n\n        while True:\n            arg_1 = False\n\n            for arg_2, arg_3 in arg_0.nonterminals.items():\n                for arg_4 in arg_3:\n                    for arg_5, arg_6 in enumerate(arg_4.rhs):\n                        if arg_6 not in arg_0.nonterminals:\n                            continue\n\n                        arg_7 = arg_0.first(arg_4.rhs[arg_5 + 1:])\n                        arg_8 = arg_7 - set([EPSILON])\n                        if EPSILON in arg_7 or arg_5 == (len(arg_4.rhs) - 1):\n                            arg_8 |= arg_0._follow[arg_2]\n\n                        if arg_8 - arg_0._follow[arg_6]:\n                            arg_0._follow[arg_6] |= arg_8\n                            arg_1 = True\n\n            if not arg_1:\n                break", "path": "purplex/grammar.py", "identifier": "Grammar._compute_follow", "docstring": "Computes the FOLLOW set for every non-terminal in the grammar.\n\n        Tenatively based on _compute_follow in PLY.", "docstring_tokens": ["Computes", "the", "FOLLOW", "set", "for", "every", "non", "-", "terminal", "in", "the", "grammar", "."], "nwo": "mtomwing/purplex", "score": 0.1903525543429651, "idx": 251852}
{"url": "https://github.com/mozilla/PyPOM/blob/1e7d7ac6e19ec2dac0ea04bad5f3daadbe0c43b8/src/pypom/selenium_driver.py#L121-L143", "sha": "1e7d7ac6e19ec2dac0ea04bad5f3daadbe0c43b8", "docstring_summary": "Register the Selenium specific driver implementation.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "FuncDriver", "(", "ISelenium", ",", "Selenium", ",", "class_implements", "=", "[", "Firefox", ",", "Chrome", ",", "Ie", ",", "Edge", ",", "Opera", ",", "Safari", ",", "BlackBerry", ",", "PhantomJS", ",", "Android", ",", "Remote", ",", "EventFiringWebDriver", ",", "]", ",", ")"], "function": "def Func():\n    \"\"\" Register the Selenium specific driver implementation.\n\n        This Func call is performed by the init module if\n        selenium is available.\n    \"\"\"\n    FuncDriver(\n        ISelenium,\n        Selenium,\n        class_implements=[\n            Firefox,\n            Chrome,\n            Ie,\n            Edge,\n            Opera,\n            Safari,\n            BlackBerry,\n            PhantomJS,\n            Android,\n            Remote,\n            EventFiringWebDriver,\n        ],\n    )", "path": "src/pypom/selenium_driver.py", "identifier": "register", "docstring": "Register the Selenium specific driver implementation.\n\n        This register call is performed by the init module if\n        selenium is available.", "docstring_tokens": ["Register", "the", "Selenium", "specific", "driver", "implementation", "."], "nwo": "mozilla/PyPOM", "score": 0.9276247857904453, "idx": 251853}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/streamlet.py#L188-L197", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Return a new Streamlet by outer join_streamlet with this streamlet", "language": "python", "parameters": "(self, join_streamlet, window_config, join_function)", "return_statement": "return join_streamlet_result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "from", "heronpy", ".", "streamlet", ".", "impl", ".", "joinbolt", "import", "JoinStreamlet", ",", "JoinBolt", "arg_4", "=", "JoinStreamlet", "(", "JoinBolt", ".", "OUTER", ",", "arg_2", ",", "arg_3", ",", "arg_0", ",", "arg_1", ")", "arg_0", ".", "_add_child", "(", "arg_4", ")", "arg_1", ".", "_add_child", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Return a new Streamlet by outer join_streamlet with this streamlet\n    \"\"\"\n    from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt\n\n    arg_4 = JoinStreamlet(JoinBolt.OUTER, arg_2,\n                                          arg_3, arg_0, arg_1)\n    arg_0._add_child(arg_4)\n    arg_1._add_child(arg_4)\n    return arg_4", "path": "heronpy/streamlet/streamlet.py", "identifier": "Streamlet.outer_join", "docstring": "Return a new Streamlet by outer join_streamlet with this streamlet", "docstring_tokens": ["Return", "a", "new", "Streamlet", "by", "outer", "join_streamlet", "with", "this", "streamlet"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 251854}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/api.py#L73-L119", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Retrieve the Engine-level model params from a Swarm model", "language": "python", "parameters": "(modelID)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ClientJobsDAO", ".", "get", "(", ")", "(", "arg_2", ",", "arg_3", ")", "=", "arg_1", ".", "modelsGetFields", "(", "arg_0", ",", "[", "\"jobId\"", ",", "\"genDescription\"", "]", ")", "(", "arg_4", ",", ")", "=", "arg_1", ".", "jobGetFields", "(", "arg_2", ",", "[", "\"genBaseDescription\"", "]", ")", "arg_5", "=", "tempfile", ".", "mkdtemp", "(", ")", "try", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_5", ",", "\"base.py\"", ")", "with", "open", "(", "arg_6", ",", "mode", "=", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_4", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_5", ",", "\"description.py\"", ")", "with", "open", "(", "arg_7", ",", "mode", "=", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_3", ")", "arg_8", "=", "helpers", ".", "getExperimentDescriptionInterfaceFromModule", "(", "helpers", ".", "loadExperimentDescriptionScriptFromDir", "(", "arg_5", ")", ")", "return", "json", ".", "dumps", "(", "dict", "(", "modelConfig", "=", "arg_8", ".", "getModelDescription", "(", ")", ",", "inferenceArgs", "=", "arg_8", ".", "getModelControl", "(", ")", ".", "get", "(", "\"inferenceArgs\"", ",", "None", ")", ")", ")", "finally", ":", "shutil", ".", "rmtree", "(", "arg_5", ",", "ignore_errors", "=", "True", ")"], "function": "def Func(arg_0):\n  \"\"\"Retrieve the Engine-level model params from a Swarm model\n\n  Args:\n    modelID - Engine-level model ID of the Swarm model\n\n  Returns:\n    JSON-encoded string containing Model Params\n  \"\"\"\n\n  # TODO: the use of nupic.frameworks.opf.helpers.loadExperimentDescriptionScriptFromDir when\n  #  retrieving module params results in a leakage of pf_base_descriptionNN and\n  #  pf_descriptionNN module imports for every call to Func, so\n  #  the leakage is unlimited when Func is called by a\n  #  long-running process.  An alternate solution is to execute the guts of\n  #  this function's logic in a seprate process (via multiprocessing module).\n\n  arg_1 = ClientJobsDAO.get()\n\n  (arg_2, arg_3) = arg_1.modelsGetFields(\n    arg_0,\n    [\"jobId\", \"genDescription\"])\n\n  (arg_4,) = arg_1.jobGetFields(arg_2, [\"genBaseDescription\"])\n\n  # Construct a directory with base.py and description.py for loading model\n  # params, and use nupic.frameworks.opf.helpers to extract model params from\n  # those files\n  arg_5 = tempfile.mkdtemp()\n  try:\n    arg_6 = os.path.join(arg_5, \"base.py\")\n    with open(arg_6, mode=\"wb\") as f:\n      f.write(arg_4)\n\n    arg_7 = os.path.join(arg_5, \"description.py\")\n    with open(arg_7, mode=\"wb\") as f:\n      f.write(arg_3)\n\n    arg_8 = helpers.getExperimentDescriptionInterfaceFromModule(\n      helpers.loadExperimentDescriptionScriptFromDir(arg_5))\n\n    return json.dumps(\n      dict(\n        modelConfig=arg_8.getModelDescription(),\n        inferenceArgs=arg_8.getModelControl().get(\"inferenceArgs\", None)))\n  finally:\n    shutil.rmtree(arg_5, ignore_errors=True)", "path": "src/nupic/swarming/api.py", "identifier": "getSwarmModelParams", "docstring": "Retrieve the Engine-level model params from a Swarm model\n\n  Args:\n    modelID - Engine-level model ID of the Swarm model\n\n  Returns:\n    JSON-encoded string containing Model Params", "docstring_tokens": ["Retrieve", "the", "Engine", "-", "level", "model", "params", "from", "a", "Swarm", "model"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 251855}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/masked_autoregressive.py#L903-L954", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns a list of degree vectors, one for each input and hidden layer.", "language": "python", "parameters": "(input_size,\n                    hidden_units=None,\n                    input_order=\"left-to-right\",\n                    hidden_degrees=\"equal\")", "return_statement": "return degrees", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "\"left-to-right\"", ",", "arg_3", "=", "\"equal\"", ")", ":", "arg_2", "=", "_create_input_order", "(", "arg_0", ",", "arg_2", ")", "arg_4", "=", "[", "arg_2", "]", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "]", "for", "arg_5", "in", "arg_1", ":", "if", "isinstance", "(", "arg_3", ",", "six", ".", "string_types", ")", ":", "if", "arg_3", "==", "\"random\"", ":", "arg_4", ".", "append", "(", "np", ".", "random", ".", "randint", "(", "low", "=", "min", "(", "np", ".", "min", "(", "arg_4", "[", "-", "1", "]", ")", ",", "arg_0", "-", "1", ")", ",", "high", "=", "arg_0", ",", "size", "=", "arg_5", ")", ")", "elif", "arg_3", "==", "\"equal\"", ":", "arg_6", "=", "min", "(", "np", ".", "min", "(", "arg_4", "[", "-", "1", "]", ")", ",", "arg_0", "-", "1", ")", "arg_4", ".", "append", "(", "np", ".", "maximum", "(", "arg_6", ",", "np", ".", "ceil", "(", "np", ".", "arange", "(", "1", ",", "arg_5", "+", "1", ")", "*", "(", "arg_0", "-", "1", ")", "/", "float", "(", "arg_5", "+", "1", ")", ")", ".", "astype", "(", "np", ".", "int32", ")", ")", ")", "else", ":", "raise", "ValueError", "(", "'Invalid hidden order: \"{}\".'", ".", "format", "(", "arg_3", ")", ")", "return", "arg_4"], "function": "def Func(arg_0,\n                    arg_1=None,\n                    arg_2=\"left-to-right\",\n                    arg_3=\"equal\"):\n  \"\"\"Returns a list of degree vectors, one for each input and hidden layer.\n\n  A unit with degree d can only receive input from units with degree < d. Output\n  units always have the same degree as their associated input unit.\n\n  Args:\n    input_size: Number of inputs.\n    hidden_units: list with the number of hidden units per layer. It does not\n      include the output layer. Each hidden unit size must be at least the size\n      of length (otherwise autoregressivity is not possible).\n    input_order: Order of degrees to the input units: 'random', 'left-to-right',\n      'right-to-left', or an array of an explicit order. For example,\n      'left-to-right' builds an autoregressive model\n      p(x) = p(x1) p(x2 | x1) ... p(xD | x<D).\n    hidden_degrees: Method for assigning degrees to the hidden units:\n      'equal', 'random'.  If 'equal', hidden units in each layer are allocated\n      equally (up to a remainder term) to each degree.  Default: 'equal'.\n\n  Raises:\n    ValueError: invalid input order.\n    ValueError: invalid hidden degrees.\n  \"\"\"\n  arg_2 = _create_input_order(arg_0, arg_2)\n  arg_4 = [arg_2]\n\n  if arg_1 is None:\n    arg_1 = []\n\n  for arg_5 in arg_1:\n    if isinstance(arg_3, six.string_types):\n      if arg_3 == \"random\":\n        # samples from: [low, high)\n        arg_4.append(\n            np.random.randint(low=min(np.min(arg_4[-1]), arg_0 - 1),\n                              high=arg_0,\n                              size=arg_5))\n      elif arg_3 == \"equal\":\n        arg_6 = min(np.min(arg_4[-1]), arg_0 - 1)\n        arg_4.append(np.maximum(\n            arg_6,\n            # Evenly divide the range `[1, input_size - 1]` in to `units + 1`\n            # segments, and pick the boundaries between the segments as degrees.\n            np.ceil(np.arange(1, arg_5 + 1)\n                    * (arg_0 - 1) / float(arg_5 + 1)).astype(np.int32)))\n    else:\n      raise ValueError('Invalid hidden order: \"{}\".'.format(arg_3))\n\n  return arg_4", "path": "tensorflow_probability/python/bijectors/masked_autoregressive.py", "identifier": "_create_degrees", "docstring": "Returns a list of degree vectors, one for each input and hidden layer.\n\n  A unit with degree d can only receive input from units with degree < d. Output\n  units always have the same degree as their associated input unit.\n\n  Args:\n    input_size: Number of inputs.\n    hidden_units: list with the number of hidden units per layer. It does not\n      include the output layer. Each hidden unit size must be at least the size\n      of length (otherwise autoregressivity is not possible).\n    input_order: Order of degrees to the input units: 'random', 'left-to-right',\n      'right-to-left', or an array of an explicit order. For example,\n      'left-to-right' builds an autoregressive model\n      p(x) = p(x1) p(x2 | x1) ... p(xD | x<D).\n    hidden_degrees: Method for assigning degrees to the hidden units:\n      'equal', 'random'.  If 'equal', hidden units in each layer are allocated\n      equally (up to a remainder term) to each degree.  Default: 'equal'.\n\n  Raises:\n    ValueError: invalid input order.\n    ValueError: invalid hidden degrees.", "docstring_tokens": ["Returns", "a", "list", "of", "degree", "vectors", "one", "for", "each", "input", "and", "hidden", "layer", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 251856}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth2.py#L984-L997", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Ensure client is authorized to use the response type requested.", "language": "python", "parameters": "(self, client_id, response_type, client, request,\n                               *args, **kwargs)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "if", "arg_2", "not", "in", "(", "'code'", ",", "'token'", ")", ":", "return", "False", "if", "hasattr", "(", "arg_3", ",", "'allowed_response_types'", ")", ":", "return", "arg_2", "in", "arg_3", ".", "allowed_response_types", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                               *arg_5, **arg_6):\n        \"\"\"Ensure client is authorized to use the response type requested.\n\n        It will allow any of the two (`code`, `token`) response types by\n        default. Implemented `allowed_response_types` for client object\n        to authorize the request.\n        \"\"\"\n        if arg_2 not in ('code', 'token'):\n            return False\n\n        if hasattr(arg_3, 'allowed_response_types'):\n            return arg_2 in arg_3.allowed_response_types\n        return True", "path": "flask_oauthlib/provider/oauth2.py", "identifier": "OAuth2RequestValidator.validate_response_type", "docstring": "Ensure client is authorized to use the response type requested.\n\n        It will allow any of the two (`code`, `token`) response types by\n        default. Implemented `allowed_response_types` for client object\n        to authorize the request.", "docstring_tokens": ["Ensure", "client", "is", "authorized", "to", "use", "the", "response", "type", "requested", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 251857}
{"url": "https://github.com/Syndace/python-doubleratchet/blob/d4497af73044e0084efa3e447276ee9d6a6eb66a/doubleratchet/ratchets/doubleratchet.py#L110-L154", "sha": "d4497af73044e0084efa3e447276ee9d6a6eb66a", "docstring_summary": "Decrypt a message using this double ratchet session.", "language": "python", "parameters": "(self, ciphertext, header, ad = None)", "return_statement": "return self.__decrypt(\n            ciphertext,\n            self.__skr.nextDecryptionKey(),\n            header,\n            ad\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "==", "None", ":", "arg_3", "=", "arg_0", ".", "__ad", "arg_4", "=", "arg_0", ".", "__decryptSavedMessage", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_4", ":", "return", "arg_4", "if", "arg_0", ".", "triggersStep", "(", "arg_2", ".", "dh_pub", ")", ":", "arg_0", ".", "__saveMessageKeys", "(", "arg_2", ".", "pn", ")", "arg_0", ".", "step", "(", "arg_2", ".", "dh_pub", ")", "arg_0", ".", "__saveMessageKeys", "(", "arg_2", ".", "n", ")", "return", "arg_0", ".", "__decrypt", "(", "arg_1", ",", "arg_0", ".", "__skr", ".", "nextDecryptionKey", "(", ")", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = None):\n        \"\"\"\n        Decrypt a message using this double ratchet session.\n\n        :param ciphertext: A bytes-like object encoding the message to decrypt.\n        :param header: An instance of the Header class. This should have been sent\n            together with the ciphertext.\n        :param ad: A bytes-like object encoding the associated data to use for message\n            authentication. Pass None to use the associated data set during construction.\n        :returns: The plaintext.\n\n        :raises AuthenticationFailedException: If checking the authentication for this\n            message failed.\n        :raises NotInitializedException: If this double ratchet session is not yet\n            initialized with a key pair, thus not prepared to decrypt an incoming message.\n        :raises TooManySavedMessageKeysException: If more than message_key_store_max have\n            to be stored to decrypt this message.\n        \"\"\"\n\n        if arg_3 == None:\n            arg_3 = arg_0.__ad\n\n        # Try to decrypt the message using a previously saved message key\n        arg_4 = arg_0.__decryptSavedMessage(arg_1, arg_2, arg_3)\n        if arg_4:\n            return arg_4\n\n        # Check, whether the public key will trigger a dh ratchet step\n        if arg_0.triggersStep(arg_2.dh_pub):\n            # Save missed message keys for the current receiving chain\n            arg_0.__saveMessageKeys(arg_2.pn)\n\n            # Perform the step\n            arg_0.step(arg_2.dh_pub)\n\n        # Save missed message keys for the current receiving chain\n        arg_0.__saveMessageKeys(arg_2.n)\n\n        # Finally decrypt the message and return the plaintext\n        return arg_0.__decrypt(\n            arg_1,\n            arg_0.__skr.nextDecryptionKey(),\n            arg_2,\n            arg_3\n        )", "path": "doubleratchet/ratchets/doubleratchet.py", "identifier": "DoubleRatchet.decryptMessage", "docstring": "Decrypt a message using this double ratchet session.\n\n        :param ciphertext: A bytes-like object encoding the message to decrypt.\n        :param header: An instance of the Header class. This should have been sent\n            together with the ciphertext.\n        :param ad: A bytes-like object encoding the associated data to use for message\n            authentication. Pass None to use the associated data set during construction.\n        :returns: The plaintext.\n\n        :raises AuthenticationFailedException: If checking the authentication for this\n            message failed.\n        :raises NotInitializedException: If this double ratchet session is not yet\n            initialized with a key pair, thus not prepared to decrypt an incoming message.\n        :raises TooManySavedMessageKeysException: If more than message_key_store_max have\n            to be stored to decrypt this message.", "docstring_tokens": ["Decrypt", "a", "message", "using", "this", "double", "ratchet", "session", "."], "nwo": "Syndace/python-doubleratchet", "score": 0.37431295205163906, "idx": 251858}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/objs.py#L746-L755", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Returns dozscale and particle list of update", "language": "python", "parameters": "(self, params)", "return_statement": "return dozscale, particles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "arg_3", "=", "[", "]", "for", "arg_4", "in", "listify", "(", "arg_1", ")", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_p2i", "(", "arg_4", ")", "arg_3", ".", "append", "(", "arg_6", ")", "arg_2", "=", "arg_2", "or", "arg_5", "==", "'zscale'", "arg_3", "=", "set", "(", "arg_3", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns dozscale and particle list of update \"\"\"\n        arg_2 = False\n        arg_3 = []\n        for arg_4 in listify(arg_1):\n            arg_5, arg_6 = arg_0._p2i(arg_4)\n            arg_3.append(arg_6)\n            arg_2 = arg_2 or arg_5 == 'zscale'\n        arg_3 = set(arg_3)\n        return arg_2, arg_3", "path": "peri/comp/objs.py", "identifier": "PlatonicSpheresCollection._update_type", "docstring": "Returns dozscale and particle list of update", "docstring_tokens": ["Returns", "dozscale", "and", "particle", "list", "of", "update"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 251859}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/sbio/socket_server.py#L93-L114", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Asynchronous connection handler. Processes each line from the socket.", "language": "python", "parameters": "(self, conn, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "arg_0", ".", "shell", ".", "stdout", ".", "write", "(", "arg_0", ".", "shell", ".", "prompt", ")", "arg_3", "=", "arg_0", ".", "shell", ".", "stdin", ".", "readline", "(", ")", "if", "not", "len", "(", "arg_3", ")", ":", "arg_3", "=", "'EOF'", "return", "False", "else", ":", "arg_3", "=", "arg_3", ".", "rstrip", "(", "'\\r\\n'", ")", "arg_3", "=", "arg_0", ".", "shell", ".", "precmd", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "shell", ".", "onecmd", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "shell", ".", "postcmd", "(", "arg_4", ",", "arg_3", ")", "arg_0", ".", "shell", ".", "stdout", ".", "flush", "(", ")", "arg_0", ".", "shell", ".", "postloop", "(", ")", "if", "arg_4", ":", "arg_0", ".", "shell", "=", "None", "arg_1", ".", "close", "(", ")", "return", "not", "arg_4"], "function": "def Func(arg_0, arg_1, *arg_2):\n        '''\n        Asynchronous connection Func. Processes each line from the socket.\n        '''\n        # lines from cmd.Cmd\n        arg_0.shell.stdout.write(arg_0.shell.prompt)\n        arg_3 = arg_0.shell.stdin.readline()\n        if not len(arg_3):\n            arg_3 = 'EOF'\n            return False\n        else:\n            arg_3 = arg_3.rstrip('\\r\\n')\n            arg_3 = arg_0.shell.precmd(arg_3)\n            arg_4 = arg_0.shell.onecmd(arg_3)\n            arg_4 = arg_0.shell.postcmd(arg_4, arg_3)\n            arg_0.shell.stdout.flush()\n            arg_0.shell.postloop()\n            # end lines from cmd.Cmd\n            if arg_4:\n                arg_0.shell = None\n                arg_1.close()\n            return not arg_4", "path": "shoebot/sbio/socket_server.py", "identifier": "SocketServer.handler", "docstring": "Asynchronous connection handler. Processes each line from the socket.", "docstring_tokens": ["Asynchronous", "connection", "handler", ".", "Processes", "each", "line", "from", "the", "socket", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 251860}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/nlp.py#L52-L125", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Generate a training batch for the Skip-Gram model.", "language": "python", "parameters": "(data, batch_size, num_skips, skip_window, data_index=0)", "return_statement": "return batch, labels, data_index", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "if", "arg_1", "%", "arg_2", "!=", "0", ":", "raise", "Exception", "(", "\"batch_size should be able to be divided by num_skips.\"", ")", "if", "arg_2", ">", "2", "*", "arg_3", ":", "raise", "Exception", "(", "\"num_skips <= 2 * skip_window\"", ")", "arg_5", "=", "np", ".", "ndarray", "(", "shape", "=", "(", "arg_1", ")", ",", "dtype", "=", "np", ".", "int32", ")", "arg_6", "=", "np", ".", "ndarray", "(", "shape", "=", "(", "arg_1", ",", "1", ")", ",", "dtype", "=", "np", ".", "int32", ")", "arg_7", "=", "2", "*", "arg_3", "+", "1", "arg_8", "=", "collections", ".", "deque", "(", "maxlen", "=", "arg_7", ")", "for", "arg_9", "in", "range", "(", "arg_7", ")", ":", "arg_8", ".", "append", "(", "arg_0", "[", "arg_4", "]", ")", "arg_4", "=", "(", "arg_4", "+", "1", ")", "%", "len", "(", "arg_0", ")", "for", "arg_10", "in", "range", "(", "arg_1", "//", "arg_2", ")", ":", "arg_11", "=", "arg_3", "arg_12", "=", "[", "arg_3", "]", "for", "arg_13", "in", "range", "(", "arg_2", ")", ":", "while", "arg_11", "in", "arg_12", ":", "arg_11", "=", "random", ".", "randint", "(", "0", ",", "arg_7", "-", "1", ")", "arg_12", ".", "append", "(", "arg_11", ")", "arg_5", "[", "arg_10", "*", "arg_2", "+", "arg_13", "]", "=", "arg_8", "[", "arg_3", "]", "arg_6", "[", "arg_10", "*", "arg_2", "+", "arg_13", ",", "0", "]", "=", "arg_8", "[", "arg_11", "]", "arg_8", ".", "append", "(", "arg_0", "[", "arg_4", "]", ")", "arg_4", "=", "(", "arg_4", "+", "1", ")", "%", "len", "(", "arg_0", ")", "return", "arg_5", ",", "arg_6", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0):\n    \"\"\"Generate a training batch for the Skip-Gram model.\n\n    See `Word2Vec example <https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_word2vec_basic.py>`__.\n\n    Parameters\n    ----------\n    data : list of data\n        To present context, usually a list of integers.\n    batch_size : int\n        Batch size to return.\n    num_skips : int\n        How many times to reuse an input to generate a label.\n    skip_window : int\n        How many words to consider left and right.\n    data_index : int\n        Index of the context location. This code use `data_index` to instead of yield like ``tl.iterate``.\n\n    Returns\n    -------\n    batch : list of data\n        Inputs.\n    labels : list of data\n        Labels\n    data_index : int\n        Index of the context location.\n\n    Examples\n    --------\n    Setting num_skips=2, skip_window=1, use the right and left words.\n    In the same way, num_skips=4, skip_window=2 means use the nearby 4 words.\n\n    >>> data = [1,2,3,4,5,6,7,8,9,10,11]\n    >>> batch, labels, data_index = tl.nlp.Func(data=data, batch_size=8, num_skips=2, skip_window=1, data_index=0)\n    >>> print(batch)\n    [2 2 3 3 4 4 5 5]\n    >>> print(labels)\n    [[3]\n    [1]\n    [4]\n    [2]\n    [5]\n    [3]\n    [4]\n    [6]]\n\n    \"\"\"\n    # global data_index   # you can put data_index outside the function, then\n    #       modify the global data_index in the function without return it.\n    # note: without using yield, this code use data_index to instead.\n\n    if arg_1 % arg_2 != 0:\n        raise Exception(\"batch_size should be able to be divided by num_skips.\")\n    if arg_2 > 2 * arg_3:\n        raise Exception(\"num_skips <= 2 * skip_window\")\n    arg_5 = np.ndarray(shape=(arg_1), dtype=np.int32)\n    arg_6 = np.ndarray(shape=(arg_1, 1), dtype=np.int32)\n    arg_7 = 2 * arg_3 + 1  # [ skip_window target skip_window ]\n    arg_8 = collections.deque(maxlen=arg_7)\n    for arg_9 in range(arg_7):\n        arg_8.append(arg_0[arg_4])\n        arg_4 = (arg_4 + 1) % len(arg_0)\n    for arg_10 in range(arg_1 // arg_2):\n        arg_11 = arg_3  # target label at the center of the buffer\n        arg_12 = [arg_3]\n        for arg_13 in range(arg_2):\n            while arg_11 in arg_12:\n                arg_11 = random.randint(0, arg_7 - 1)\n            arg_12.append(arg_11)\n            arg_5[arg_10 * arg_2 + arg_13] = arg_8[arg_3]\n            arg_6[arg_10 * arg_2 + arg_13, 0] = arg_8[arg_11]\n        arg_8.append(arg_0[arg_4])\n        arg_4 = (arg_4 + 1) % len(arg_0)\n    return arg_5, arg_6, arg_4", "path": "tensorlayer/nlp.py", "identifier": "generate_skip_gram_batch", "docstring": "Generate a training batch for the Skip-Gram model.\n\n    See `Word2Vec example <https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_word2vec_basic.py>`__.\n\n    Parameters\n    ----------\n    data : list of data\n        To present context, usually a list of integers.\n    batch_size : int\n        Batch size to return.\n    num_skips : int\n        How many times to reuse an input to generate a label.\n    skip_window : int\n        How many words to consider left and right.\n    data_index : int\n        Index of the context location. This code use `data_index` to instead of yield like ``tl.iterate``.\n\n    Returns\n    -------\n    batch : list of data\n        Inputs.\n    labels : list of data\n        Labels\n    data_index : int\n        Index of the context location.\n\n    Examples\n    --------\n    Setting num_skips=2, skip_window=1, use the right and left words.\n    In the same way, num_skips=4, skip_window=2 means use the nearby 4 words.\n\n    >>> data = [1,2,3,4,5,6,7,8,9,10,11]\n    >>> batch, labels, data_index = tl.nlp.generate_skip_gram_batch(data=data, batch_size=8, num_skips=2, skip_window=1, data_index=0)\n    >>> print(batch)\n    [2 2 3 3 4 4 5 5]\n    >>> print(labels)\n    [[3]\n    [1]\n    [4]\n    [2]\n    [5]\n    [3]\n    [4]\n    [6]]", "docstring_tokens": ["Generate", "a", "training", "batch", "for", "the", "Skip", "-", "Gram", "model", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 251861}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/query.py#L707-L735", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "Will delete the entities that match at the time the query is executed.", "language": "python", "parameters": "(self, blocksize=100)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "100", ")", ":", "from", ".", "columns", "import", "MODELS_REFERENCED", "if", "not", "arg_0", ".", "_model", ".", "_no_fk", "or", "arg_0", ".", "_model", ".", "_namespace", "in", "MODELS_REFERENCED", ":", "raise", "QueryError", "(", "\"Can't Func entities of models with foreign key relationships\"", ")", "arg_2", "=", "[", "]", "arg_3", "=", "0", "for", "arg_4", "in", "arg_0", ".", "iter_result", "(", "pagesize", "=", "arg_1", ")", ":", "arg_2", ".", "append", "(", "arg_4", ")", "arg_3", "+=", "1", "if", "arg_3", ">=", "arg_1", ":", "session", ".", "Func", "(", "arg_2", ")", "del", "arg_2", "[", ":", "]", "arg_3", "=", "0", "if", "arg_2", ":", "session", ".", "Func", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=100):\n        '''\n        Will Func the entities that match at the time the query is executed.\n\n        Used like::\n\n            MyModel.query.filter(email=...).Func()\n            MyModel.query.endswith(email='@host.com').Func()\n\n        .. warning:: can't be used on models on either side of a ``OneToMany``,\n            ``ManyToOne``, or ``OneToOne`` relationship.\n        '''\n\n        from .columns import MODELS_REFERENCED\n        if not arg_0._model._no_fk or arg_0._model._namespace in MODELS_REFERENCED:\n            raise QueryError(\"Can't Func entities of models with foreign key relationships\")\n\n        arg_2 = []\n        arg_3 = 0\n        for arg_4 in arg_0.iter_result(pagesize=arg_1):\n            arg_2.append(arg_4)\n            arg_3 += 1\n            if arg_3 >= arg_1:\n                session.Func(arg_2) # one round-trip to Func \"chunk\" items\n                del arg_2[:]\n                arg_3 = 0\n\n        if arg_2:\n            session.Func(arg_2)", "path": "rom/query.py", "identifier": "Query.delete", "docstring": "Will delete the entities that match at the time the query is executed.\n\n        Used like::\n\n            MyModel.query.filter(email=...).delete()\n            MyModel.query.endswith(email='@host.com').delete()\n\n        .. warning:: can't be used on models on either side of a ``OneToMany``,\n            ``ManyToOne``, or ``OneToOne`` relationship.", "docstring_tokens": ["Will", "delete", "the", "entities", "that", "match", "at", "the", "time", "the", "query", "is", "executed", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 251862}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/conditions.py#L173-L194", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns all of the items from queryset where the user has a\n        product invoking that item's condition in one of their carts.", "language": "python", "parameters": "(self, queryset, user)", "return_statement": "return queryset", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "Q", "(", "enabling_products__productitem__cart__user", "=", "arg_2", ")", "arg_4", "=", "commerce", ".", "Cart", ".", "STATUS_RELEASED", "arg_5", "=", "commerce", ".", "Cart", ".", "STATUS_PAID", "arg_6", "=", "commerce", ".", "Cart", ".", "STATUS_ACTIVE", "arg_7", "=", "Q", "(", "enabling_products__productitem__cart__status", "=", "arg_4", ")", "arg_8", "=", "~", "(", "Q", "(", "enabling_products__productitem__cart__status", "=", "arg_5", ")", "|", "Q", "(", "enabling_products__productitem__cart__status", "=", "arg_6", ")", ")", "arg_1", "=", "arg_1", ".", "filter", "(", "arg_3", ")", "arg_1", "=", "arg_1", ".", "exclude", "(", "arg_7", "&", "arg_8", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        ''' Returns all of the items from queryset where the user has a\n        product invoking that item's condition in one of their carts. '''\n\n        arg_3 = Q(enabling_products__productitem__cart__user=arg_2)\n        arg_4 = commerce.Cart.STATUS_RELEASED\n        arg_5 = commerce.Cart.STATUS_PAID\n        arg_6 = commerce.Cart.STATUS_ACTIVE\n        arg_7 = Q(\n            enabling_products__productitem__cart__status=arg_4\n        )\n        arg_8 = ~(\n            Q(enabling_products__productitem__cart__status=arg_5) |\n            Q(enabling_products__productitem__cart__status=arg_6)\n        )\n\n        arg_1 = arg_1.filter(arg_3)\n        arg_1 = arg_1.exclude(\n            arg_7 & arg_8\n        )\n\n        return arg_1", "path": "registrasion/controllers/conditions.py", "identifier": "ProductConditionController.pre_filter", "docstring": "Returns all of the items from queryset where the user has a\n        product invoking that item's condition in one of their carts.", "docstring_tokens": ["Returns", "all", "of", "the", "items", "from", "queryset", "where", "the", "user", "has", "a", "product", "invoking", "that", "item", "s", "condition", "in", "one", "of", "their", "carts", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 251863}
{"url": "https://github.com/ellmetha/neojsonrpc/blob/e369b633a727482d5f9e310f0c3337ae5f7265db/neojsonrpc/client.py#L258-L275", "sha": "e369b633a727482d5f9e310f0c3337ae5f7265db", "docstring_summary": "Invokes a contract with given parameters and returns the result.", "language": "python", "parameters": "(self, script_hash, params, **kwargs)", "return_statement": "return decode_invocation_result(raw_result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "encode_invocation_params", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_call", "(", "JSONRPCMethods", ".", "INVOKE", ".", "value", ",", "[", "arg_1", ",", "arg_4", ",", "]", ",", "**", "arg_3", ")", "return", "decode_invocation_result", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\" Invokes a contract with given parameters and returns the result.\n\n        It should be noted that the name of the function Funcd in the contract should be part of\n        paramaters.\n\n        :param script_hash: contract script hash\n        :param params: list of paramaters to be passed in to the smart contract\n        :type script_hash: str\n        :type params: list\n        :return: result of the invocation\n        :rtype: dictionary\n\n        \"\"\"\n        arg_4 = encode_invocation_params(arg_2)\n        arg_5 = arg_0._call(\n            JSONRPCMethods.INVOKE.value, [arg_1, arg_4, ], **arg_3)\n        return decode_invocation_result(arg_5)", "path": "neojsonrpc/client.py", "identifier": "Client.invoke", "docstring": "Invokes a contract with given parameters and returns the result.\n\n        It should be noted that the name of the function invoked in the contract should be part of\n        paramaters.\n\n        :param script_hash: contract script hash\n        :param params: list of paramaters to be passed in to the smart contract\n        :type script_hash: str\n        :type params: list\n        :return: result of the invocation\n        :rtype: dictionary", "docstring_tokens": ["Invokes", "a", "contract", "with", "given", "parameters", "and", "returns", "the", "result", "."], "nwo": "ellmetha/neojsonrpc", "score": 0.3393344119717767, "idx": 251864}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L136-L165", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "show basic info about ABF class variables.", "language": "python", "parameters": "(self,printToo=False,returnDict=False)", "return_statement": "return info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "\"\\n### ABF INFO ###\\n\"", "arg_4", "=", "{", "}", "for", "arg_5", "in", "sorted", "(", "dir", "(", "arg_0", ")", ")", ":", "if", "arg_5", "in", "[", "'cm'", ",", "'evIs'", ",", "'colormap'", ",", "'dataX'", ",", "'dataY'", ",", "'protoX'", ",", "'protoY'", "]", ":", "continue", "if", "\"_\"", "in", "arg_5", ":", "continue", "arg_6", "=", "getattr", "(", "arg_0", ",", "arg_5", ")", "if", "type", "(", "arg_6", ")", "is", "list", "and", "len", "(", "arg_6", ")", ">", "5", ":", "continue", "arg_7", "=", "str", "(", "type", "(", "arg_6", ")", ")", ".", "split", "(", "\"'\"", ")", "[", "1", "]", "if", "\"method\"", "in", "arg_7", "or", "\"neo.\"", "in", "arg_7", ":", "continue", "if", "arg_5", "in", "[", "\"header\"", ",", "\"MT\"", "]", ":", "continue", "arg_3", "+=", "\"%s <%s> %s\\n\"", "%", "(", "arg_5", ",", "arg_7", ",", "arg_6", ")", "arg_4", "[", "arg_5", "]", "=", "arg_6", "if", "arg_1", ":", "print", "(", ")", "for", "arg_8", "in", "arg_3", ".", "split", "(", "\"\\n\"", ")", ":", "if", "len", "(", "arg_8", ")", "<", "3", ":", "continue", "print", "(", "\"   \"", ",", "arg_8", ")", "print", "(", ")", "if", "arg_2", ":", "return", "arg_4", "return", "arg_3"], "function": "def Func(arg_0,arg_1=False,arg_2=False):\n        \"\"\"show basic info about ABF class variables.\"\"\"\n        arg_3=\"\\n### ABF INFO ###\\n\"\n        arg_4={}\n        for arg_5 in sorted(dir(arg_0)):\n            if arg_5 in ['cm','evIs','colormap','dataX','dataY',\n                             'protoX','protoY']:\n                continue\n            if \"_\" in arg_5:\n                continue\n            arg_6=getattr(arg_0,arg_5)\n            if type(arg_6) is list and len(arg_6)>5:\n                continue\n            arg_7=str(type(arg_6)).split(\"'\")[1]\n            if \"method\" in arg_7 or \"neo.\" in arg_7:\n                continue\n            if arg_5 in [\"header\",\"MT\"]:\n                continue\n            arg_3+=\"%s <%s> %s\\n\"%(arg_5,arg_7,arg_6)\n            arg_4[arg_5]=arg_6\n        if arg_1:\n            print()\n            for arg_8 in arg_3.split(\"\\n\"):\n                if len(arg_8)<3:\n                    continue\n                print(\"   \",arg_8)\n            print()\n        if arg_2:\n            return arg_4\n        return arg_3", "path": "doc/oldcode/swhlab/core/abf.py", "identifier": "ABF.abfinfo", "docstring": "show basic info about ABF class variables.", "docstring_tokens": ["show", "basic", "info", "about", "ABF", "class", "variables", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 251865}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/statemanager.py#L86-L99", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns true if the host is reachable. In some cases, it may not be reachable a tunnel\n    must be used.", "language": "python", "parameters": "(self)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "hostportlist", ":", "try", ":", "socket", ".", "create_connection", "(", "arg_1", ",", "StateManager", ".", "TIMEOUT_SECONDS", ")", "return", "True", "except", ":", "LOG", ".", "info", "(", "\"StateManager %s Unable to connect to host: %s port %i\"", "%", "(", "arg_0", ".", "name", ",", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", "]", ")", ")", "continue", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns true if the host is reachable. In some cases, it may not be reachable a tunnel\n    must be used.\n    \"\"\"\n    for arg_1 in arg_0.hostportlist:\n      try:\n        socket.create_connection(arg_1, StateManager.TIMEOUT_SECONDS)\n        return True\n      except:\n        LOG.info(\"StateManager %s Unable to connect to host: %s port %i\"\n                 % (arg_0.name, arg_1[0], arg_1[1]))\n        continue\n    return False", "path": "heron/statemgrs/src/python/statemanager.py", "identifier": "StateManager.is_host_port_reachable", "docstring": "Returns true if the host is reachable. In some cases, it may not be reachable a tunnel\n    must be used.", "docstring_tokens": ["Returns", "true", "if", "the", "host", "is", "reachable", ".", "In", "some", "cases", "it", "may", "not", "be", "reachable", "a", "tunnel", "must", "be", "used", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 251866}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/ultratb.py#L406-L413", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return formatted traceback.", "language": "python", "parameters": "(self, etype, value, tb, tb_offset=None, context=5)", "return_statement": "return self.stb2text(tb_list)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "5", ")", ":", "arg_6", "=", "arg_0", ".", "structured_traceback", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "return", "arg_0", ".", "stb2Func", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=5):\n        \"\"\"Return formatted traceback.\n\n        Subclasses may override this if they add extra arguments.\n        \"\"\"\n        arg_6 = arg_0.structured_traceback(arg_1, arg_2, arg_3,\n                                            arg_4, arg_5)\n        return arg_0.stb2Func(arg_6)", "path": "environment/lib/python2.7/site-packages/IPython/core/ultratb.py", "identifier": "TBTools.text", "docstring": "Return formatted traceback.\n\n        Subclasses may override this if they add extra arguments.", "docstring_tokens": ["Return", "formatted", "traceback", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 251867}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/svg.py#L8-L39", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Prompts the user to save an SVG document to disk.", "language": "python", "parameters": "(string, parent=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "unicode", ")", ":", "arg_0", "=", "arg_0", ".", "encode", "(", "'utf-8'", ")", "arg_2", "=", "QtGui", ".", "QFileDialog", "(", "arg_1", ",", "'Save SVG Document'", ")", "arg_2", ".", "setAcceptMode", "(", "QtGui", ".", "QFileDialog", ".", "AcceptSave", ")", "arg_2", ".", "setDefaultSuffix", "(", "'svg'", ")", "arg_2", ".", "setNameFilter", "(", "'SVG document (*.svg)'", ")", "if", "arg_2", ".", "exec_", "(", ")", ":", "arg_3", "=", "arg_2", ".", "selectedFiles", "(", ")", "[", "0", "]", "arg_4", "=", "open", "(", "arg_3", ",", "'w'", ")", "try", ":", "arg_4", ".", "write", "(", "arg_0", ")", "finally", ":", "arg_4", ".", "close", "(", ")", "return", "arg_3", "return", "None"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Prompts the user to save an SVG document to disk.\n\n    Parameters:\n    -----------\n    string : basestring\n        A Python string containing a SVG document.\n\n    parent : QWidget, optional\n        The parent to use for the file dialog.\n\n    Returns:\n    --------\n    The name of the file to which the document was saved, or None if the save\n    was cancelled.\n    \"\"\"\n    if isinstance(arg_0, unicode):\n        arg_0 = arg_0.encode('utf-8')\n\n    arg_2 = QtGui.QFileDialog(arg_1, 'Save SVG Document')\n    arg_2.setAcceptMode(QtGui.QFileDialog.AcceptSave)\n    arg_2.setDefaultSuffix('svg')\n    arg_2.setNameFilter('SVG document (*.svg)')\n    if arg_2.exec_():\n        arg_3 = arg_2.selectedFiles()[0]\n        arg_4 = open(arg_3, 'w')\n        try:\n            arg_4.write(arg_0)\n        finally:\n            arg_4.close()\n        return arg_3\n    return None", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/svg.py", "identifier": "save_svg", "docstring": "Prompts the user to save an SVG document to disk.\n\n    Parameters:\n    -----------\n    string : basestring\n        A Python string containing a SVG document.\n\n    parent : QWidget, optional\n        The parent to use for the file dialog.\n\n    Returns:\n    --------\n    The name of the file to which the document was saved, or None if the save\n    was cancelled.", "docstring_tokens": ["Prompts", "the", "user", "to", "save", "an", "SVG", "document", "to", "disk", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 251868}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/decorators.py#L139-L155", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Decorator to log the shapes of input and output dataframes", "language": "python", "parameters": "(logger)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "_get_dfs_shapes", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_5", "=", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_6", "=", "_get_dfs_shapes", "(", "arg_5", ")", "_Func", "(", "arg_0", ",", "arg_1", ".", "__name__", ",", "arg_4", ",", "arg_6", ")", "return", "arg_5", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator to log the shapes of input and output dataframes\n\n    It considers all the dataframes passed either as arguments or keyword arguments as inputs\n    and all the dataframes returned as outputs.\n    \"\"\"\n    def decorator(arg_1):\n        @wraps(arg_1)\n        def wrapper(*arg_2, **arg_3):\n            arg_4 = _get_dfs_shapes(*arg_2, **arg_3)\n            arg_5 = arg_1(*arg_2, **arg_3)\n            arg_6 = _get_dfs_shapes(arg_5)\n            _Func(arg_0, arg_1.__name__, arg_4, arg_6)\n            return arg_5\n        return wrapper\n    return decorator", "path": "toucan_data_sdk/utils/decorators.py", "identifier": "log_shapes", "docstring": "Decorator to log the shapes of input and output dataframes\n\n    It considers all the dataframes passed either as arguments or keyword arguments as inputs\n    and all the dataframes returned as outputs.", "docstring_tokens": ["Decorator", "to", "log", "the", "shapes", "of", "input", "and", "output", "dataframes"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 251869}
{"url": "https://github.com/snowplow/snowplow-python-analytics-sdk/blob/0ddca91e3f6d8bed88627fa557790aa4868bdace/snowplow_analytics_sdk/run_manifests.py#L230-L247", "sha": "0ddca91e3f6d8bed88627fa557790aa4868bdace", "docstring_summary": "Check if run_id is stored in DynamoDB table.\n    Return True if run_id is stored or False otherwise.", "language": "python", "parameters": "(dynamodb_client, table_name, run_id)", "return_statement": "return response.get('Item') is not None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_item", "(", "TableName", "=", "arg_1", ",", "Key", "=", "{", "DYNAMODB_RUNID_ATTRIBUTE", ":", "{", "'S'", ":", "arg_2", "}", "}", ")", "return", "arg_3", ".", "get", "(", "'Item'", ")", "is", "not", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Check if run_id is stored in DynamoDB table.\n    Return True if run_id is stored or False otherwise.\n\n    Arguments:\n    dynamodb_client - boto3 DynamoDB client (not service)\n    table_name - string representing existing table name\n    run_id - string representing run_id to store\n    \"\"\"\n    arg_3 = arg_0.get_item(\n        TableName=arg_1,\n        Key={\n            DYNAMODB_RUNID_ATTRIBUTE: {\n                'S': arg_2\n            }\n        }\n    )\n    return arg_3.get('Item') is not None", "path": "snowplow_analytics_sdk/run_manifests.py", "identifier": "is_in_manifest", "docstring": "Check if run_id is stored in DynamoDB table.\n    Return True if run_id is stored or False otherwise.\n\n    Arguments:\n    dynamodb_client - boto3 DynamoDB client (not service)\n    table_name - string representing existing table name\n    run_id - string representing run_id to store", "docstring_tokens": ["Check", "if", "run_id", "is", "stored", "in", "DynamoDB", "table", ".", "Return", "True", "if", "run_id", "is", "stored", "or", "False", "otherwise", "."], "nwo": "snowplow/snowplow-python-analytics-sdk", "score": 0.2855681421870085, "idx": 251870}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/resource/object.py#L46-L135", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Helper method to parse a full or partial path and\n        return a full path as well as a dict containing path parts.", "language": "python", "parameters": "(cls, full_path, **kwargs)", "return_statement": "return full_path, path_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "from", "solvebio", ".", "resource", ".", "vault", "import", "Vault", "arg_3", "=", "arg_2", ".", "pop", "(", "'client'", ",", "None", ")", "or", "arg_0", ".", "_client", "or", "client", "if", "not", "arg_1", ":", "raise", "Exception", "(", "'Invalid path: '", ",", "'Full path must be in one of the following formats: '", "'\"vault:/path\", \"domain:vault:/path\", or \"~/path\"'", ")", "arg_4", "=", "arg_2", ".", "get", "(", "'vault'", ")", "or", "arg_1", "try", ":", "arg_5", ",", "arg_6", "=", "Vault", ".", "Func", "(", "arg_4", ",", "client", "=", "arg_3", ")", "except", "Exception", "as", "err", ":", "raise", "Exception", "(", "'Could not determine vault from \"{0}\": {1}'", ".", "format", "(", "arg_4", ",", "err", ")", ")", "if", "arg_2", ".", "get", "(", "'path'", ")", ":", "arg_1", "=", "'{0}:/{1}'", ".", "format", "(", "arg_5", ",", "arg_2", "[", "'path'", "]", ")", "arg_7", "=", "arg_0", ".", "PATH_RE", ".", "match", "(", "arg_1", ")", "if", "arg_7", ":", "arg_8", "=", "arg_7", ".", "groupdict", "(", ")", "[", "'path'", "]", "else", ":", "raise", "Exception", "(", "'Cannot find a valid object path in \"{0}\". '", "'Full path must be in one of the following formats: '", "'\"vault:/path\", \"domain:vault:/path\", or \"~/path\"'", ".", "format", "(", "arg_1", ")", ")", "arg_8", "=", "re", ".", "sub", "(", "'//+'", ",", "'/'", ",", "arg_8", ")", "if", "arg_8", "!=", "'/'", ":", "arg_8", "=", "arg_8", ".", "rstrip", "(", "'/'", ")", "arg_6", "[", "'path'", "]", "=", "arg_8", "arg_1", "=", "'{domain}:{vault}:{path}'", ".", "format", "(", "**", "arg_6", ")", "arg_6", "[", "'full_path'", "]", "=", "arg_1", "return", "arg_1", ",", "arg_6"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Helper method to parse a full or partial path and\n        return a full path as well as a dict containing path parts.\n\n        Uses the following rules when processing the path:\n\n            * If no domain, uses the current user's account domain\n            * If no vault, uses the current user's personal vault.\n            * If no path, uses '/' (vault root)\n\n        Returns a tuple containing:\n\n            * The validated full_path\n            * A dictionary with the components:\n                * domain: the domain of the vault\n                * vault: the name of the vault, without domain\n                * vault_full_path: domain:vault\n                * path: the object path within the vault\n                * parent_path: the parent path to the object\n                * filename: the object's filename (if any)\n                * full_path: the validated full path\n\n        The following components may be overridden using kwargs:\n\n            * vault\n            * path\n\n        Object paths (also known as \"paths\") must begin with a forward slash.\n\n        The following path formats are supported:\n\n            domain:vault:/path -> object \"path\" in the root of \"domain:vault\"\n            domain:vault/path  -> object \"path\" in the root of \"domain:vault\"\n            vault:/path        -> object \"path\" in the root of \"vault\"\n            vault/path         -> object \"path\" in the root of \"vault\"\n            ~/path             -> object \"path\" in the root of personal vault\n            vault/             -> root of \"vault\"\n            ~/                 -> root of your personal vault\n\n        The following two formats are not supported:\n\n            path               -> invalid/ambiguous path (exception)\n            vault:path         -> invalid/ambiguous path (exception)\n            vault:path/path    -> unsupported, interpreted as domain:vault/path\n\n        \"\"\"\n        from solvebio.resource.vault import Vault\n\n        arg_3 = arg_2.pop('client', None) or arg_0._client or client\n\n        if not arg_1:\n            raise Exception(\n                'Invalid path: ',\n                'Full path must be in one of the following formats: '\n                '\"vault:/path\", \"domain:vault:/path\", or \"~/path\"')\n\n        # Parse the vault's full_path, using overrides if any\n        arg_4 = arg_2.get('vault') or arg_1\n        try:\n            arg_5, arg_6 = \\\n                Vault.Func(arg_4, client=arg_3)\n        except Exception as err:\n            raise Exception('Could not determine vault from \"{0}\": {1}'\n                            .format(arg_4, err))\n\n        if arg_2.get('path'):\n            # Allow override of the object_path.\n            arg_1 = '{0}:/{1}'.format(arg_5, arg_2['path'])\n\n        arg_7 = arg_0.PATH_RE.match(arg_1)\n        if arg_7:\n            arg_8 = arg_7.groupdict()['path']\n        else:\n            raise Exception(\n                'Cannot find a valid object path in \"{0}\". '\n                'Full path must be in one of the following formats: '\n                '\"vault:/path\", \"domain:vault:/path\", or \"~/path\"'\n                .format(arg_1))\n\n        # Remove double slashes\n        arg_8 = re.sub('//+', '/', arg_8)\n        if arg_8 != '/':\n            # Remove trailing slash\n            arg_8 = arg_8.rstrip('/')\n\n        arg_6['path'] = arg_8\n        # TODO: parent_path and filename\n        arg_1 = '{domain}:{vault}:{path}'.format(**arg_6)\n        arg_6['full_path'] = arg_1\n        return arg_1, arg_6", "path": "solvebio/resource/object.py", "identifier": "Object.validate_full_path", "docstring": "Helper method to parse a full or partial path and\n        return a full path as well as a dict containing path parts.\n\n        Uses the following rules when processing the path:\n\n            * If no domain, uses the current user's account domain\n            * If no vault, uses the current user's personal vault.\n            * If no path, uses '/' (vault root)\n\n        Returns a tuple containing:\n\n            * The validated full_path\n            * A dictionary with the components:\n                * domain: the domain of the vault\n                * vault: the name of the vault, without domain\n                * vault_full_path: domain:vault\n                * path: the object path within the vault\n                * parent_path: the parent path to the object\n                * filename: the object's filename (if any)\n                * full_path: the validated full path\n\n        The following components may be overridden using kwargs:\n\n            * vault\n            * path\n\n        Object paths (also known as \"paths\") must begin with a forward slash.\n\n        The following path formats are supported:\n\n            domain:vault:/path -> object \"path\" in the root of \"domain:vault\"\n            domain:vault/path  -> object \"path\" in the root of \"domain:vault\"\n            vault:/path        -> object \"path\" in the root of \"vault\"\n            vault/path         -> object \"path\" in the root of \"vault\"\n            ~/path             -> object \"path\" in the root of personal vault\n            vault/             -> root of \"vault\"\n            ~/                 -> root of your personal vault\n\n        The following two formats are not supported:\n\n            path               -> invalid/ambiguous path (exception)\n            vault:path         -> invalid/ambiguous path (exception)\n            vault:path/path    -> unsupported, interpreted as domain:vault/path", "docstring_tokens": ["Helper", "method", "to", "parse", "a", "full", "or", "partial", "path", "and", "return", "a", "full", "path", "as", "well", "as", "a", "dict", "containing", "path", "parts", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 251871}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/functions.py#L808-L840", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Returns the lowest indices in each string in a column, where the provided substring is fully contained between within a\n    sample. If the substring is not found, -1 is returned. It is the same as `str.find`.", "language": "python", "parameters": "(x, sub, start=0, end=None)", "return_statement": "return str_find(x, sub, start, end)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ")", ":", "return", "str_find", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=None):\n    \"\"\"Returns the lowest indices in each string in a column, where the provided substring is fully contained between within a\n    sample. If the substring is not found, -1 is returned. It is the same as `str.find`.\n\n    :param str sub: A substring to be found in the samples\n    :param int start:\n    :param int end:\n    :returns: an expression containing the lowest indices specifying the start of the substring.\n\n    Example:\n\n    >>> import vaex\n    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']\n    >>> df = vaex.from_arrays(text=text)\n    >>> df\n      #  text\n      0  Something\n      1  very pretty\n      2  is coming\n      3  our\n      4  way.\n\n    >>> df.text.str.index(sub=\"et\")\n    Expression = str_find(text, sub='et')\n    Length: 5 dtype: int64 (expression)\n    -----------------------------------\n    0   3\n    1   7\n    2  -1\n    3  -1\n    4  -1\n    \"\"\"\n    return str_find(arg_0, arg_1, arg_2, arg_3)", "path": "packages/vaex-core/vaex/functions.py", "identifier": "str_index", "docstring": "Returns the lowest indices in each string in a column, where the provided substring is fully contained between within a\n    sample. If the substring is not found, -1 is returned. It is the same as `str.find`.\n\n    :param str sub: A substring to be found in the samples\n    :param int start:\n    :param int end:\n    :returns: an expression containing the lowest indices specifying the start of the substring.\n\n    Example:\n\n    >>> import vaex\n    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']\n    >>> df = vaex.from_arrays(text=text)\n    >>> df\n      #  text\n      0  Something\n      1  very pretty\n      2  is coming\n      3  our\n      4  way.\n\n    >>> df.text.str.index(sub=\"et\")\n    Expression = str_find(text, sub='et')\n    Length: 5 dtype: int64 (expression)\n    -----------------------------------\n    0   3\n    1   7\n    2  -1\n    3  -1\n    4  -1", "docstring_tokens": ["Returns", "the", "lowest", "indices", "in", "each", "string", "in", "a", "column", "where", "the", "provided", "substring", "is", "fully", "contained", "between", "within", "a", "sample", ".", "If", "the", "substring", "is", "not", "found", "-", "1", "is", "returned", ".", "It", "is", "the", "same", "as", "str", ".", "find", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 251872}
{"url": "https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L139-L144", "sha": "e5a0d908df8c93ff1ee7abdda8875fd1667df53d", "docstring_summary": "Handle selection of item in listing.", "language": "python", "parameters": "(self, selection, previousSelection)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_acceptButton", ".", "setEnabled", "(", "True", ")", "del", "arg_0", ".", "_selected", "[", ":", "]", "arg_3", "=", "arg_0", ".", "_filesystemWidget", ".", "model", "(", ")", ".", "item", "(", "arg_1", ")", "arg_0", ".", "_selected", ".", "append", "(", "arg_3", ".", "path", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Handle selection of item in listing.'''\n        arg_0._acceptButton.setEnabled(True)\n        del arg_0._selected[:]\n        arg_3 = arg_0._filesystemWidget.model().item(arg_1)\n        arg_0._selected.append(arg_3.path)", "path": "source/riffle/browser.py", "identifier": "FilesystemBrowser._onSelectItem", "docstring": "Handle selection of item in listing.", "docstring_tokens": ["Handle", "selection", "of", "item", "in", "listing", "."], "nwo": "4degrees/riffle", "score": 0.2663827826706725, "idx": 251873}
{"url": "https://github.com/AartGoossens/goldencheetahlib/blob/ebe57de7d94280674c8440a81f53ac02f0b4eb43/goldencheetahlib/client.py#L141-L152", "sha": "ebe57de7d94280674c8440a81f53ac02f0b4eb43", "docstring_summary": "Construct activity endpoint from host, athlete name and filename", "language": "python", "parameters": "(self, athlete, filename)", "return_statement": "return '{host}{athlete}/activity/{filename}'.format(\n            host=self.host,\n            athlete=quote_plus(athlete),\n            filename=filename\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "'{host}{athlete}/activity/{filename}'", ".", "format", "(", "host", "=", "arg_0", ".", "host", ",", "arg_1", "=", "quote_plus", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Construct activity endpoint from host, athlete name and filename\n\n        Keyword arguments:\n        athlete -- Full athlete name\n        filename -- filename of request activity (e.g. \\'2015_04_29_09_03_16.json\\')\n        \"\"\"\n        return '{host}{athlete}/activity/{filename}'.format(\n            host=arg_0.host,\n            arg_1=quote_plus(arg_1),\n            arg_2=arg_2\n        )", "path": "goldencheetahlib/client.py", "identifier": "GoldenCheetahClient._activity_endpoint", "docstring": "Construct activity endpoint from host, athlete name and filename\n\n        Keyword arguments:\n        athlete -- Full athlete name\n        filename -- filename of request activity (e.g. \\'2015_04_29_09_03_16.json\\')", "docstring_tokens": ["Construct", "activity", "endpoint", "from", "host", "athlete", "name", "and", "filename"], "nwo": "AartGoossens/goldencheetahlib", "score": 0.12050106452410352, "idx": 251874}
{"url": "https://github.com/vint21h/nagios-check-supervisord/blob/a40a542499197a4b5658bd6cc3b34326fe8d0ada/check_supervisord.py#L241-L249", "sha": "a40a542499197a4b5658bd6cc3b34326fe8d0ada", "docstring_summary": "Program main.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "parse_options", "(", ")", "arg_1", ",", "arg_2", "=", "create_output", "(", "get_status", "(", "arg_0", ")", ",", "arg_0", ")", "sys", ".", "stdout", ".", "write", "(", "arg_1", ")", "sys", ".", "exit", "(", "arg_2", ")"], "function": "def Func():\n    \"\"\"\n    Program Func.\n    \"\"\"\n\n    arg_0 = parse_options()\n    arg_1, arg_2 = create_output(get_status(arg_0), arg_0)\n    sys.stdout.write(arg_1)\n    sys.exit(arg_2)", "path": "check_supervisord.py", "identifier": "main", "docstring": "Program main.", "docstring_tokens": ["Program", "main", "."], "nwo": "vint21h/nagios-check-supervisord", "score": 0.37729991823847475, "idx": 251875}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/mutation_callers.py#L9-L50", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Calls MuTect to perform variant analysis", "language": "python", "parameters": "(job, normal_bam, normal_bai, tumor_bam, tumor_bai, ref, ref_dict, fai, cosmic, dbsnp)", "return_statement": "return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'mutect.tar.gz'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", ":", "arg_10", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "arg_11", "=", "[", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_7", ",", "arg_6", ",", "arg_8", ",", "arg_9", "]", "arg_12", "=", "[", "'normal.bam'", ",", "'normal.bai'", ",", "'tumor.bam'", ",", "'tumor.bai'", ",", "'ref.fasta'", ",", "'ref.fasta.fai'", ",", "'ref.dict'", ",", "'cosmic.vcf'", ",", "'dbsnp.vcf'", "]", "for", "arg_13", ",", "arg_14", "in", "zip", "(", "arg_11", ",", "arg_12", ")", ":", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_13", ",", "os", ".", "path", ".", "join", "(", "arg_10", ",", "arg_14", ")", ")", "arg_15", "=", "[", "'--analysis_type'", ",", "'MuTect'", ",", "'--reference_sequence'", ",", "'ref.fasta'", ",", "'--cosmic'", ",", "'/data/cosmic.vcf'", ",", "'--dbsnp'", ",", "'/data/dbsnp.vcf'", ",", "'--input_file:normal'", ",", "'/data/normal.bam'", ",", "'--input_file:tumor'", ",", "'/data/tumor.bam'", ",", "'--tumor_lod'", ",", "str", "(", "10", ")", ",", "'--initial_tumor_lod'", ",", "str", "(", "4.0", ")", ",", "'--out'", ",", "'mutect.out'", ",", "'--coverage_file'", ",", "'mutect.cov'", ",", "'--vcf'", ",", "'mutect.vcf'", "]", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "workDir", "=", "arg_10", ",", "arg_15", "=", "arg_15", ",", "tool", "=", "'quay.io/ucsc_cgl/mutect:1.1.7--e8bf09459cf0aecb9f55ee689c2b2d194754cbd3'", ")", "arg_16", "=", "[", "'mutect.vcf'", ",", "'mutect.cov'", ",", "'mutect.out'", "]", "arg_17", "=", "[", "os", ".", "path", ".", "join", "(", "arg_10", ",", "x", ")", "for", "x", "in", "arg_16", "]", "tarball_files", "(", "'mutect.tar.gz'", ",", "file_paths", "=", "arg_17", ",", "output_dir", "=", "arg_10", ")", "return", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_10", ",", "'mutect.tar.gz'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9):\n    \"\"\"\n    Calls MuTect to perform variant analysis\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str normal_bam: Normal BAM FileStoreID\n    :param str normal_bai: Normal BAM index FileStoreID\n    :param str tumor_bam: Tumor BAM FileStoreID\n    :param str tumor_bai: Tumor BAM Index FileStoreID\n    :param str ref: Reference genome FileStoreID\n    :param str ref_dict: Reference dictionary FileStoreID\n    :param str fai: Reference index FileStoreID\n    :param str cosmic: Cosmic VCF FileStoreID\n    :param str dbsnp: DBSNP VCF FileStoreID\n    :return: MuTect output (tarball) FileStoreID\n    :rtype: str\n    \"\"\"\n    arg_10 = arg_0.fileStore.getLocalTempDir()\n    arg_11 = [arg_1, arg_2, arg_3, arg_4, arg_5, arg_7, arg_6, arg_8, arg_9]\n    arg_12 = ['normal.bam', 'normal.bai', 'tumor.bam', 'tumor.bai', 'ref.fasta',\n                  'ref.fasta.fai', 'ref.dict', 'cosmic.vcf', 'dbsnp.vcf']\n    for arg_13, arg_14 in zip(arg_11, arg_12):\n        arg_0.fileStore.readGlobalFile(arg_13, os.path.join(arg_10, arg_14))\n    # Call: MuTect\n    arg_15 = ['--analysis_type', 'MuTect',\n                  '--reference_sequence', 'ref.fasta',\n                  '--cosmic', '/data/cosmic.vcf',\n                  '--dbsnp', '/data/dbsnp.vcf',\n                  '--input_file:normal', '/data/normal.bam',\n                  '--input_file:tumor', '/data/tumor.bam',\n                  '--tumor_lod', str(10),  # Taken from MC3 pipeline\n                  '--initial_tumor_lod', str(4.0),  # Taken from MC3 pipeline\n                  '--out', 'mutect.out',\n                  '--coverage_file', 'mutect.cov',\n                  '--vcf', 'mutect.vcf']\n    dockerCall(arg_0=arg_0, workDir=arg_10, arg_15=arg_15,\n               tool='quay.io/ucsc_cgl/mutect:1.1.7--e8bf09459cf0aecb9f55ee689c2b2d194754cbd3')\n    # Write output to file store\n    arg_16 = ['mutect.vcf', 'mutect.cov', 'mutect.out']\n    arg_17 = [os.path.join(arg_10, x) for x in arg_16]\n    tarball_files('mutect.tar.gz', file_paths=arg_17, output_dir=arg_10)\n    return arg_0.fileStore.writeGlobalFile(os.path.join(arg_10, 'mutect.tar.gz'))", "path": "src/toil_lib/tools/mutation_callers.py", "identifier": "run_mutect", "docstring": "Calls MuTect to perform variant analysis\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str normal_bam: Normal BAM FileStoreID\n    :param str normal_bai: Normal BAM index FileStoreID\n    :param str tumor_bam: Tumor BAM FileStoreID\n    :param str tumor_bai: Tumor BAM Index FileStoreID\n    :param str ref: Reference genome FileStoreID\n    :param str ref_dict: Reference dictionary FileStoreID\n    :param str fai: Reference index FileStoreID\n    :param str cosmic: Cosmic VCF FileStoreID\n    :param str dbsnp: DBSNP VCF FileStoreID\n    :return: MuTect output (tarball) FileStoreID\n    :rtype: str", "docstring_tokens": ["Calls", "MuTect", "to", "perform", "variant", "analysis"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 251876}
{"url": "https://github.com/edoburu/django-debugtools/blob/5c609c00fa9954330cd135fc62a1e18b8e7fea8a/debugtools/formatter.py#L129-L152", "sha": "5c609c00fa9954330cd135fc62a1e18b8e7fea8a", "docstring_summary": "Apply some HTML highlighting to the contents.\n    This can't be done in the", "language": "python", "parameters": "(text)", "return_statement": "return mark_safe(text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "escape", "(", "arg_0", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "' &lt;iterator object&gt;'", ",", "\" <small>&lt;<var>this object can be used in a 'for' loop</var>&gt;</small>\"", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "' &lt;dynamic item&gt;'", ",", "' <small>&lt;<var>this object may have extra field names</var>&gt;</small>'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "' &lt;dynamic attribute&gt;'", ",", "' <small>&lt;<var>this object may have extra field names</var>&gt;</small>'", ")", "arg_0", "=", "RE_PROXY", ".", "sub", "(", "'\\g<1><small>&lt;<var>proxy object</var>&gt;</small>'", ",", "arg_0", ")", "arg_0", "=", "RE_FUNCTION", ".", "sub", "(", "'\\g<1><small>&lt;<var>object method</var>&gt;</small>'", ",", "arg_0", ")", "arg_0", "=", "RE_GENERATOR", ".", "sub", "(", "\"\\g<1><small>&lt;<var>generator, use 'for' to traverse it</var>&gt;</small>\"", ",", "arg_0", ")", "arg_0", "=", "RE_OBJECT_ADDRESS", ".", "sub", "(", "'\\g<1><small>&lt;<var>\\g<2> object</var>&gt;</small>'", ",", "arg_0", ")", "arg_0", "=", "RE_MANAGER", ".", "sub", "(", "'\\g<1><small>&lt;<var>manager, use <kbd>.all</kbd> to traverse it</var>&gt;</small>'", ",", "arg_0", ")", "arg_0", "=", "RE_CLASS_REPR", ".", "sub", "(", "'\\g<1><small>&lt;<var>\\g<2> class</var>&gt;</small>'", ",", "arg_0", ")", "arg_0", "=", "RE_REQUEST_FIELDNAME", ".", "sub", "(", "'\\g<1>:\\n   <strong style=\"color: #222;\">\\g<2></strong>: '", ",", "arg_0", ")", "arg_0", "=", "RE_REQUEST_CLEANUP1", ".", "sub", "(", "'\\g<1>'", ",", "arg_0", ")", "arg_0", "=", "RE_REQUEST_CLEANUP2", ".", "sub", "(", "')'", ",", "arg_0", ")", "return", "mark_safe", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Apply some HTML highlighting to the contents.\n    This can't be done in the\n    \"\"\"\n    # Escape text and apply some formatting.\n    # To have really good highlighting, pprint would have to be re-implemented.\n    arg_0 = escape(arg_0)\n    arg_0 = arg_0.replace(' &lt;iterator object&gt;', \" <small>&lt;<var>this object can be used in a 'for' loop</var>&gt;</small>\")\n    arg_0 = arg_0.replace(' &lt;dynamic item&gt;', ' <small>&lt;<var>this object may have extra field names</var>&gt;</small>')\n    arg_0 = arg_0.replace(' &lt;dynamic attribute&gt;', ' <small>&lt;<var>this object may have extra field names</var>&gt;</small>')\n    arg_0 = RE_PROXY.sub('\\g<1><small>&lt;<var>proxy object</var>&gt;</small>', arg_0)\n    arg_0 = RE_FUNCTION.sub('\\g<1><small>&lt;<var>object method</var>&gt;</small>', arg_0)\n    arg_0 = RE_GENERATOR.sub(\"\\g<1><small>&lt;<var>generator, use 'for' to traverse it</var>&gt;</small>\", arg_0)\n    arg_0 = RE_OBJECT_ADDRESS.sub('\\g<1><small>&lt;<var>\\g<2> object</var>&gt;</small>', arg_0)\n    arg_0 = RE_MANAGER.sub('\\g<1><small>&lt;<var>manager, use <kbd>.all</kbd> to traverse it</var>&gt;</small>', arg_0)\n    arg_0 = RE_CLASS_REPR.sub('\\g<1><small>&lt;<var>\\g<2> class</var>&gt;</small>', arg_0)\n\n    # Since Django's WSGIRequest does a pprint like format for it's __repr__, make that styling consistent\n    arg_0 = RE_REQUEST_FIELDNAME.sub('\\g<1>:\\n   <strong style=\"color: #222;\">\\g<2></strong>: ', arg_0)\n    arg_0 = RE_REQUEST_CLEANUP1.sub('\\g<1>', arg_0)\n    arg_0 = RE_REQUEST_CLEANUP2.sub(')', arg_0)\n\n    return mark_safe(arg_0)", "path": "debugtools/formatter.py", "identifier": "_style_text", "docstring": "Apply some HTML highlighting to the contents.\n    This can't be done in the", "docstring_tokens": ["Apply", "some", "HTML", "highlighting", "to", "the", "contents", ".", "This", "can", "t", "be", "done", "in", "the"], "nwo": "edoburu/django-debugtools", "score": 0.28520508084306634, "idx": 251877}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L253-L282", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Construct the point record by reading the points from the stream", "language": "python", "parameters": "(cls, stream, point_format, count)", "return_statement": "return cls(data, point_format)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "dtype", "arg_5", "=", "bytearray", "(", "arg_1", ".", "read", "(", "arg_3", "*", "arg_4", ".", "itemsize", ")", ")", "try", ":", "arg_6", "=", "np", ".", "frombuffer", "(", "arg_5", ",", "dtype", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", "except", "ValueError", ":", "arg_7", "=", "arg_3", "*", "arg_4", ".", "itemsize", "if", "len", "(", "arg_5", ")", "%", "arg_4", ".", "itemsize", "!=", "0", ":", "arg_8", "=", "arg_7", "-", "len", "(", "arg_5", ")", "raise_not_enough_bytes_error", "(", "arg_7", ",", "arg_8", ",", "len", "(", "arg_5", ")", ",", "arg_4", ",", ")", "else", ":", "arg_9", "=", "len", "(", "arg_5", ")", "//", "arg_4", ".", "itemsize", "logger", ".", "critical", "(", "\"Expected {} points, there are {} ({} missing)\"", ".", "format", "(", "arg_3", ",", "arg_9", ",", "arg_3", "-", "arg_9", ")", ")", "arg_6", "=", "np", ".", "frombuffer", "(", "arg_5", ",", "dtype", "=", "arg_4", ",", "arg_3", "=", "arg_9", ")", "return", "arg_0", "(", "arg_6", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Construct the point record by reading the points from the stream\n        \"\"\"\n        arg_4 = arg_2.dtype\n        arg_5 = bytearray(arg_1.read(arg_3 * arg_4.itemsize))\n\n        try:\n            arg_6 = np.frombuffer(arg_5, dtype=arg_4, arg_3=arg_3)\n        except ValueError:\n            arg_7 = arg_3 * arg_4.itemsize\n            if len(arg_5) % arg_4.itemsize != 0:\n                arg_8 = arg_7 - len(arg_5)\n                raise_not_enough_bytes_error(\n                    arg_7,\n                    arg_8,\n                    len(arg_5),\n                    arg_4,\n                )\n            else:\n                arg_9 = len(arg_5) // arg_4.itemsize\n                logger.critical(\n                    \"Expected {} points, there are {} ({} missing)\".format(\n                        arg_3, arg_9, arg_3 - arg_9\n                    )\n                )\n                arg_6 = np.frombuffer(\n                    arg_5, dtype=arg_4, arg_3=arg_9\n                )\n\n        return arg_0(arg_6, arg_2)", "path": "pylas/point/record.py", "identifier": "PackedPointRecord.from_stream", "docstring": "Construct the point record by reading the points from the stream", "docstring_tokens": ["Construct", "the", "point", "record", "by", "reading", "the", "points", "from", "the", "stream"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 251878}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/teams.py#L283-L294", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns the coach ID for the team's OC in a given year.", "language": "python", "parameters": "(self, year)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "_year_info_pq", "(", "arg_1", ",", "'Offensive Coordinator'", ")", "(", "'a'", ")", "if", "arg_2", ":", "return", "arg_2", ".", "attr", "[", "'href'", "]", "except", "ValueError", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns the coach ID for the team's OC in a given year.\n\n        :year: An int representing the year.\n        :returns: A string containing the coach ID of the OC.\n        \"\"\"\n        try:\n            arg_2 = arg_0._year_info_pq(arg_1, 'Offensive Coordinator')('a')\n            if arg_2:\n                return arg_2.attr['href']\n        except ValueError:\n            return None", "path": "sportsref/nfl/teams.py", "identifier": "Team.off_coordinator", "docstring": "Returns the coach ID for the team's OC in a given year.\n\n        :year: An int representing the year.\n        :returns: A string containing the coach ID of the OC.", "docstring_tokens": ["Returns", "the", "coach", "ID", "for", "the", "team", "s", "OC", "in", "a", "given", "year", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 251879}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L27-L43", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Flattens a nested dictionary.", "language": "python", "parameters": "(nested_dict, separator)", "return_statement": "return flat_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "arg_5", "=", "Func", "(", "arg_4", ",", "arg_1", ")", "for", "arg_6", ",", "arg_7", "in", "arg_5", ".", "items", "(", ")", ":", "arg_8", "=", "arg_3", "+", "arg_1", "+", "arg_6", "arg_2", "[", "arg_8", "]", "=", "arg_7", "else", ":", "arg_2", "[", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Flattens a nested dictionary.\n\n    New keys are concatenations of nested keys with the `separator` in between.\n\n    \"\"\"\n    arg_2 = {}\n    for arg_3, arg_4 in arg_0.items():\n        if isinstance(arg_4, dict):\n            arg_5 = Func(arg_4, arg_1)\n            for arg_6, arg_7 in arg_5.items():\n                arg_8 = arg_3 + arg_1 + arg_6\n                arg_2[arg_8] = arg_7\n        else:\n            arg_2[arg_3] = arg_4\n\n    return arg_2", "path": "pypet/utils/helpful_functions.py", "identifier": "flatten_dictionary", "docstring": "Flattens a nested dictionary.\n\n    New keys are concatenations of nested keys with the `separator` in between.", "docstring_tokens": ["Flattens", "a", "nested", "dictionary", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 251880}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/date.py#L316-L374", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Parse a datetime to a unix timestamp.", "language": "python", "parameters": "(value, fmt=None)", "return_statement": "return timestamp_any(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "return", "_Func_formats", ".", "get", "(", "arg_1", ",", "lambda", "v", ":", "Func_fmt", "(", "v", ",", "arg_1", ")", ")", "(", "arg_0", ")", "arg_2", "=", "len", "(", "arg_0", ")", "if", "19", "<=", "arg_2", "<=", "24", "and", "arg_0", "[", "3", "]", "==", "\" \"", ":", "try", ":", "return", "Func_d_b_Y_H_M_S", "(", "arg_0", ")", "except", "(", "KeyError", ",", "ValueError", ",", "OverflowError", ")", ":", "pass", "if", "30", "<=", "arg_2", "<=", "31", ":", "try", ":", "return", "Func_a__d_b_Y_H_M_S_z", "(", "arg_0", ")", "except", "(", "KeyError", ",", "ValueError", ",", "OverflowError", ")", ":", "pass", "if", "arg_2", "==", "14", ":", "try", ":", "return", "Func_YmdHMS", "(", "arg_0", ")", "except", "(", "ValueError", ",", "OverflowError", ")", ":", "pass", "try", ":", "return", "Func_epoch", "(", "arg_0", ")", "except", "ValueError", ":", "pass", "return", "Func_any", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Parse a datetime to a unix Func.\n\n    Uses fast custom parsing for common datetime formats or the slow dateutil\n    parser for other formats. This is a trade off between ease of use and speed\n    and is very useful for fast parsing of Func strings whose format may\n    standard but varied or unknown prior to parsing.\n\n    Common formats include:\n        1 Feb 2010 12:00:00 GMT\n        Mon, 1 Feb 2010 22:00:00 +1000\n        20100201120000\n        1383470155 (seconds since epoch)\n\n    See the other Func_*() functions for more details.\n\n    Args:\n        value: A string representing a datetime.\n        fmt: A Func format string like for time.strptime().\n\n    Returns:\n        The time in seconds since epoch as and integer for the value specified.\n    \"\"\"\n    if arg_1:\n        return _Func_formats.get(arg_1,\n            lambda v: Func_fmt(v, arg_1)\n        )(arg_0)\n\n    arg_2 = len(arg_0)\n\n    if 19 <= arg_2 <= 24 and arg_0[3] == \" \":\n        # '%d %b %Y %H:%M:%Sxxxx'\n        try:\n            return Func_d_b_Y_H_M_S(arg_0)\n        except (KeyError, ValueError, OverflowError):\n            pass\n\n    if 30 <= arg_2 <= 31:\n        # '%a, %d %b %Y %H:%M:%S %z'\n        try:\n            return Func_a__d_b_Y_H_M_S_z(arg_0)\n        except (KeyError, ValueError, OverflowError):\n            pass\n\n    if arg_2 == 14:\n        # '%Y%m%d%H%M%S'\n        try:\n            return Func_YmdHMS(arg_0)\n        except (ValueError, OverflowError):\n            pass\n\n    # epoch Func\n    try:\n        return Func_epoch(arg_0)\n    except ValueError:\n        pass\n\n    # slow version\n    return Func_any(arg_0)", "path": "nntp/date.py", "identifier": "timestamp", "docstring": "Parse a datetime to a unix timestamp.\n\n    Uses fast custom parsing for common datetime formats or the slow dateutil\n    parser for other formats. This is a trade off between ease of use and speed\n    and is very useful for fast parsing of timestamp strings whose format may\n    standard but varied or unknown prior to parsing.\n\n    Common formats include:\n        1 Feb 2010 12:00:00 GMT\n        Mon, 1 Feb 2010 22:00:00 +1000\n        20100201120000\n        1383470155 (seconds since epoch)\n\n    See the other timestamp_*() functions for more details.\n\n    Args:\n        value: A string representing a datetime.\n        fmt: A timestamp format string like for time.strptime().\n\n    Returns:\n        The time in seconds since epoch as and integer for the value specified.", "docstring_tokens": ["Parse", "a", "datetime", "to", "a", "unix", "timestamp", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 251881}
{"url": "https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L141-L152", "sha": "5b8218cffa409ed733cf850a6fde16fafb8fc2af", "docstring_summary": "Return an argument list node that takes only ``self``.", "language": "python", "parameters": "(self)", "return_statement": "return ast.arguments(\n            args=[ast.arg(arg=\"self\")],\n            defaults=[],\n            kw_defaults=[],\n            kwonlyargs=[],\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "ast", ".", "arguments", "(", "args", "=", "[", "ast", ".", "arg", "(", "arg", "=", "\"self\"", ")", "]", ",", "defaults", "=", "[", "]", ",", "kw_defaults", "=", "[", "]", ",", "kwonlyargs", "=", "[", "]", ",", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return an argument list node that takes only ``self``.\n\n        \"\"\"\n\n        return ast.arguments(\n            args=[ast.arg(arg=\"self\")],\n            defaults=[],\n            kw_defaults=[],\n            kwonlyargs=[],\n        )", "path": "ivoire/transform.py", "identifier": "ExampleTransformer.takes_only_self", "docstring": "Return an argument list node that takes only ``self``.", "docstring_tokens": ["Return", "an", "argument", "list", "node", "that", "takes", "only", "self", "."], "nwo": "Julian/Ivoire", "score": 0.27637529583590154, "idx": 251882}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L125-L130", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "Stop this client.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "t", ".", "Func", "(", ")", "arg_0", ".", "factory", ".", "FuncTrying", "(", ")", "arg_0", ".", "connector", ".", "disconnect", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Stop this client.\n        \"\"\"\n        arg_0.t.Func()\n        arg_0.factory.FuncTrying()\n        arg_0.connector.disconnect()", "path": "tensor/outputs/riemann.py", "identifier": "RiemannTCP.stop", "docstring": "Stop this client.", "docstring_tokens": ["Stop", "this", "client", "."], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 251883}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/serialize/serialize.py#L38-L52", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Return byte-size of a memoryview or buffer.", "language": "python", "parameters": "(buf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "memoryview", ")", ":", "if", "PY3", ":", "return", "arg_0", ".", "nbytes", "else", ":", "arg_1", "=", "arg_0", ".", "itemsize", "for", "arg_2", "in", "arg_0", ".", "shape", ":", "arg_1", "*=", "arg_2", "return", "arg_1", "else", ":", "return", "len", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Return byte-size of a memoryview or buffer.\"\"\"\n    if isinstance(arg_0, memoryview):\n        if PY3:\n            # py3 introduces nbytes attribute\n            return arg_0.nbytes\n        else:\n            # compute nbytes on py2\n            arg_1 = arg_0.itemsize\n            for arg_2 in arg_0.shape:\n                arg_1 *= arg_2\n            return arg_1\n    else:\n        # not a memoryview, raw bytes/ py2 buffer\n        return len(arg_0)", "path": "parsl/executors/serialize/serialize.py", "identifier": "_nbytes", "docstring": "Return byte-size of a memoryview or buffer.", "docstring_tokens": ["Return", "byte", "-", "size", "of", "a", "memoryview", "or", "buffer", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 251884}
{"url": "https://github.com/klen/muffin-peewee/blob/8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e/example/views.py#L22-L27", "sha": "8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e", "docstring_summary": "Create a new DataItem.", "language": "python", "parameters": "(request)", "return_statement": "return muffin.HTTPFound('/')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "models", ".", "DataItem", ".", "create", "(", "content", "=", "''", ".", "join", "(", "random", ".", "choice", "(", "string", ".", "ascii_uppercase", "+", "string", ".", "digits", ")", "for", "arg_1", "in", "range", "(", "20", ")", ")", ")", "return", "muffin", ".", "HTTPFound", "(", "'/'", ")"], "function": "def Func(arg_0):\n    \"\"\" Create a new DataItem. \"\"\"\n    models.DataItem.create(\n        content=''.join(random.choice(string.ascii_uppercase + string.digits) for arg_1 in range(20))\n    )\n    return muffin.HTTPFound('/')", "path": "example/views.py", "identifier": "generate", "docstring": "Create a new DataItem.", "docstring_tokens": ["Create", "a", "new", "DataItem", "."], "nwo": "klen/muffin-peewee", "score": 0.16638194949711382, "idx": 251885}
{"url": "https://github.com/cldf/csvw/blob/181c94b6c599575945e52d370a415f12f3433eab/src/csvw/db.py#L373-L424", "sha": "181c94b6c599575945e52d370a415f12f3433eab", "docstring_summary": "Creates a db file with the core schema.", "language": "python", "parameters": "(self, _force=False, _exists_ok=False, **items)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "if", "arg_0", ".", "fname", "and", "arg_0", ".", "fname", ".", "exists", "(", ")", ":", "raise", "ValueError", "(", "'db file already exists, use force=True to overFunc'", ")", "with", "arg_0", ".", "connection", "(", ")", "as", "db", ":", "for", "arg_4", "in", "arg_0", ".", "tables", ":", "db", ".", "execute", "(", "arg_4", ".", "sql", "(", "translate", "=", "arg_0", ".", "translate", ")", ")", "db", ".", "execute", "(", "'PRAGMA foreign_keys = ON;'", ")", "db", ".", "commit", "(", ")", "arg_5", "=", "defaultdict", "(", "list", ")", "for", "arg_6", "in", "arg_0", ".", "tables", ":", "if", "arg_6", ".", "name", "not", "in", "arg_3", ":", "continue", "arg_7", ",", "arg_8", "=", "[", "]", ",", "[", "]", "arg_9", "=", "{", "c", ".", "name", ":", "c", "for", "c", "in", "arg_6", ".", "columns", "}", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_3", "[", "arg_6", ".", "name", "]", ")", ":", "arg_12", "=", "arg_11", "[", "arg_6", ".", "primary_key", "[", "0", "]", "]", "if", "arg_6", ".", "primary_key", "and", "len", "(", "arg_6", ".", "primary_key", ")", "==", "1", "else", "None", "arg_13", "=", "[", "]", "for", "arg_14", ",", "arg_15", "in", "arg_11", ".", "items", "(", ")", ":", "if", "arg_14", "in", "arg_6", ".", "many_to_many", ":", "assert", "arg_12", "arg_16", "=", "arg_6", ".", "many_to_many", "[", "arg_14", "]", "arg_17", "=", "tuple", "(", "[", "arg_16", ".", "name", "]", "+", "[", "c", ".", "name", "for", "c", "in", "arg_16", ".", "columns", "]", ")", "for", "arg_18", "in", "arg_15", ":", "arg_19", ",", "arg_20", "=", "arg_0", ".", "association_table_context", "(", "arg_6", ",", "arg_14", ",", "arg_18", ")", "arg_5", "[", "arg_17", "]", ".", "append", "(", "(", "arg_12", ",", "arg_19", ",", "arg_20", ")", ")", "else", ":", "arg_21", "=", "arg_9", "[", "arg_14", "]", "if", "isinstance", "(", "arg_15", ",", "list", ")", ":", "arg_15", "=", "(", "arg_21", ".", "separator", "or", "';'", ")", ".", "join", "(", "arg_21", ".", "convert", "(", "arg_18", ")", "for", "arg_18", "in", "arg_15", ")", "else", ":", "arg_15", "=", "arg_21", ".", "convert", "(", "arg_15", ")", "if", "arg_15", "is", "not", "None", "else", "None", "if", "arg_10", "==", "0", ":", "arg_8", ".", "append", "(", "arg_21", ".", "name", ")", "arg_13", ".", "append", "(", "arg_15", ")", "arg_7", ".", "append", "(", "tuple", "(", "arg_13", ")", ")", "insert", "(", "db", ",", "arg_0", ".", "translate", ",", "arg_6", ".", "name", ",", "arg_8", ",", "*", "arg_7", ")", "for", "arg_17", ",", "arg_7", "in", "arg_5", ".", "items", "(", ")", ":", "insert", "(", "db", ",", "arg_0", ".", "translate", ",", "arg_17", "[", "0", "]", ",", "arg_17", "[", "1", ":", "]", ",", "*", "arg_7", ")", "db", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=False, **arg_3):\n        \"\"\"\n        Creates a db file with the core schema.\n\n        :param force: If `True` an existing db file will be overwritten.\n        \"\"\"\n        if arg_0.fname and arg_0.fname.exists():\n            raise ValueError('db file already exists, use force=True to overFunc')\n\n        with arg_0.connection() as db:\n            for arg_4 in arg_0.tables:\n                db.execute(arg_4.sql(translate=arg_0.translate))\n\n            db.execute('PRAGMA foreign_keys = ON;')\n            db.commit()\n\n            arg_5 = defaultdict(list)  # collects rows in association tables.\n            for arg_6 in arg_0.tables:\n                if arg_6.name not in arg_3:\n                    continue\n                arg_7, arg_8 = [], []\n                arg_9 = {c.name: c for c in arg_6.columns}\n                for arg_10, arg_11 in enumerate(arg_3[arg_6.name]):\n                    arg_12 = arg_11[arg_6.primary_key[0]] \\\n                        if arg_6.primary_key and len(arg_6.primary_key) == 1 else None\n                    arg_13 = []\n                    for arg_14, arg_15 in arg_11.items():\n                        if arg_14 in arg_6.many_to_many:\n                            assert arg_12\n                            arg_16 = arg_6.many_to_many[arg_14]\n                            arg_17 = tuple([arg_16.name] + [c.name for c in arg_16.columns])\n                            for arg_18 in arg_15:\n                                arg_19, arg_20 = arg_0.association_table_context(arg_6, arg_14, arg_18)\n                                arg_5[arg_17].append((arg_12, arg_19, arg_20))\n                        else:\n                            arg_21 = arg_9[arg_14]\n                            if isinstance(arg_15, list):\n                                # Note: This assumes list-valued columns are of datatype string!\n                                arg_15 = (arg_21.separator or ';').join(\n                                    arg_21.convert(arg_18) for arg_18 in arg_15)\n                            else:\n                                arg_15 = arg_21.convert(arg_15) if arg_15 is not None else None\n                            if arg_10 == 0:\n                                arg_8.append(arg_21.name)\n                            arg_13.append(arg_15)\n                    arg_7.append(tuple(arg_13))\n                insert(db, arg_0.translate, arg_6.name, arg_8, *arg_7)\n\n            for arg_17, arg_7 in arg_5.items():\n                insert(db, arg_0.translate, arg_17[0], arg_17[1:], *arg_7)\n\n            db.commit()", "path": "src/csvw/db.py", "identifier": "Database.write", "docstring": "Creates a db file with the core schema.\n\n        :param force: If `True` an existing db file will be overwritten.", "docstring_tokens": ["Creates", "a", "db", "file", "with", "the", "core", "schema", "."], "nwo": "cldf/csvw", "score": 0.2827006957945985, "idx": 251886}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/ooaofooa.py#L89-L103", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Check if a PE_PE is globally defined, i.e. not inside a C_C", "language": "python", "parameters": "(pe_pe)", "return_statement": "return is_global(pe_pe)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "type", "(", "arg_0", ")", ".", "__name__", "!=", "'PE_PE'", ":", "arg_0", "=", "one", "(", "arg_0", ")", ".", "PE_PE", "[", "8001", "]", "(", ")", "if", "one", "(", "arg_0", ")", ".", "C_C", "[", "8003", "]", "(", ")", ":", "return", "False", "arg_0", "=", "one", "(", "arg_0", ")", ".", "EP_PKG", "[", "8000", "]", ".", "PE_PE", "[", "8001", "]", "(", ")", "if", "not", "arg_0", ":", "return", "True", "return", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    '''\n    Check if a PE_PE is globally defined, i.e. not inside a C_C\n    '''\n    if type(arg_0).__name__ != 'PE_PE':\n        arg_0 = one(arg_0).PE_PE[8001]()\n    \n    if one(arg_0).C_C[8003]():\n        return False\n    \n    arg_0 = one(arg_0).EP_PKG[8000].PE_PE[8001]()\n    if not arg_0:\n        return True\n    \n    return Func(arg_0)", "path": "bridgepoint/ooaofooa.py", "identifier": "is_global", "docstring": "Check if a PE_PE is globally defined, i.e. not inside a C_C", "docstring_tokens": ["Check", "if", "a", "PE_PE", "is", "globally", "defined", "i", ".", "e", ".", "not", "inside", "a", "C_C"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 251887}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/edward2/random_variable.py#L32-L44", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Defers an operator overload to `attr`.", "language": "python", "parameters": "(attr)", "return_statement": "return func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "func", "(", "arg_1", ",", "*", "arg_2", ")", ":", "return", "arg_0", "(", "arg_1", ".", "value", ",", "*", "arg_2", ")", "return", "func"], "function": "def Func(arg_0):\n  \"\"\"Defers an operator overload to `attr`.\n\n  Args:\n    attr: Operator attribute to use.\n\n  Returns:\n    Function calling operator attribute.\n  \"\"\"\n  @functools.wraps(arg_0)\n  def func(arg_1, *arg_2):\n    return arg_0(arg_1.value, *arg_2)\n  return func", "path": "tensorflow_probability/python/edward2/random_variable.py", "identifier": "_operator", "docstring": "Defers an operator overload to `attr`.\n\n  Args:\n    attr: Operator attribute to use.\n\n  Returns:\n    Function calling operator attribute.", "docstring_tokens": ["Defers", "an", "operator", "overload", "to", "attr", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 251888}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/views.py#L37-L47", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Read encoded contents from specified path or return default.", "language": "python", "parameters": "(path, default=None, encoding='utf8')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'utf8'", ")", ":", "if", "not", "arg_0", ":", "return", "arg_1", "try", ":", "with", "io", ".", "open", "(", "arg_0", ",", "mode", "=", "'r'", ",", "arg_2", "=", "arg_2", ")", "as", "contents", ":", "return", "contents", ".", "Func", "(", ")", "except", "IOError", ":", "if", "arg_1", "is", "not", "None", ":", "return", "arg_1", "raise"], "function": "def Func(arg_0, arg_1=None, arg_2='utf8'):\n    \"\"\"Read encoded contents from specified path or return default.\"\"\"\n    if not arg_0:\n        return arg_1\n    try:\n        with io.open(arg_0, mode='r', arg_2=arg_2) as contents:\n            return contents.Func()\n    except IOError:\n        if arg_1 is not None:\n            return arg_1\n        raise", "path": "dddp/views.py", "identifier": "read", "docstring": "Read encoded contents from specified path or return default.", "docstring_tokens": ["Read", "encoded", "contents", "from", "specified", "path", "or", "return", "default", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 251889}
{"url": "https://github.com/gtaylor/evarify/blob/37cec29373c820eda96939633e2067d55598915b/evarify/filters/python_basics.py#L100-L113", "sha": "37cec29373c820eda96939633e2067d55598915b", "docstring_summary": "Make sure the value evaluates to boolean True.", "language": "python", "parameters": "(config_val, evar)", "return_statement": "return config_val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "is", "None", ":", "raise", "ValueError", "(", "\"Value for environment variable '{evar_name}' can't \"", "\"be empty.\"", ".", "format", "(", "evar_name", "=", "arg_1", ".", "name", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Make sure the value evaluates to boolean True.\n\n    :param str config_val: The env var value.\n    :param EnvironmentVariable evar: The EVar object we are validating\n        a value for.\n    :raises: ValueError if the config value evaluates to boolean False.\n    \"\"\"\n    if arg_0 is None:\n        raise ValueError(\n            \"Value for environment variable '{evar_name}' can't \"\n            \"be empty.\".format(evar_name=arg_1.name))\n    return arg_0", "path": "evarify/filters/python_basics.py", "identifier": "validate_is_boolean_true", "docstring": "Make sure the value evaluates to boolean True.\n\n    :param str config_val: The env var value.\n    :param EnvironmentVariable evar: The EVar object we are validating\n        a value for.\n    :raises: ValueError if the config value evaluates to boolean False.", "docstring_tokens": ["Make", "sure", "the", "value", "evaluates", "to", "boolean", "True", "."], "nwo": "gtaylor/evarify", "score": 0.0, "idx": 251890}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L110-L118", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "S20 unit to generic address", "language": "python", "parameters": "(self, pugrp, punit, chunk, sectr)", "return_statement": "return int(re.findall(r\"val: ([0-9a-fx]+)\", stdout)[0], 16)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "[", "\"nvm_addr Func\"", ",", "arg_0", ".", "envs", "[", "\"DEV_PATH\"", "]", ",", "\"%d %d %d %d\"", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "]", "arg_6", ",", "arg_7", ",", "arg_8", "=", "cij", ".", "ssh", ".", "command", "(", "arg_5", ",", "shell", "=", "True", ")", "if", "arg_6", ":", "raise", "RuntimeError", "(", "\"cij.liblight.Func: cmd fail\"", ")", "return", "int", "(", "re", ".", "findall", "(", "r\"val: ([0-9a-fx]+)\"", ",", "arg_7", ")", "[", "0", "]", ",", "16", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"S20 unit to generic address\"\"\"\n        arg_5 = [\"nvm_addr Func\", arg_0.envs[\"DEV_PATH\"],\n               \"%d %d %d %d\" % (arg_1, arg_2, arg_3, arg_4)]\n        arg_6, arg_7, arg_8 = cij.ssh.command(arg_5, shell=True)\n        if arg_6:\n            raise RuntimeError(\"cij.liblight.Func: cmd fail\")\n\n        return int(re.findall(r\"val: ([0-9a-fx]+)\", arg_7)[0], 16)", "path": "deprecated/modules/cij/liblight.py", "identifier": "Nvm.s20_to_gen", "docstring": "S20 unit to generic address", "docstring_tokens": ["S20", "unit", "to", "generic", "address"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 251891}
{"url": "https://github.com/nsqio/pynsq/blob/48bf62d65ea63cddaa401efb23187b95511dbc84/nsq/reader.py#L596-L610", "sha": "48bf62d65ea63cddaa401efb23187b95511dbc84", "docstring_summary": "Dynamically adjust the reader max_in_flight. Set to 0 to immediately disable a Reader", "language": "python", "parameters": "(self, max_in_flight)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "int", ")", "arg_0", ".", "max_in_flight", "=", "arg_1", "if", "arg_1", "==", "0", ":", "for", "arg_2", "in", "itervalues", "(", "arg_0", ".", "conns", ")", ":", "if", "arg_2", ".", "rdy", ">", "0", ":", "logger", ".", "debug", "(", "'[%s:%s] rdy: %d -> 0'", ",", "arg_2", ".", "id", ",", "arg_0", ".", "name", ",", "arg_2", ".", "rdy", ")", "arg_0", ".", "_send_rdy", "(", "arg_2", ",", "0", ")", "arg_0", ".", "total_rdy", "=", "0", "else", ":", "arg_0", ".", "need_rdy_redistributed", "=", "True", "arg_0", ".", "_redistribute_rdy_state", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Dynamically adjust the reader max_in_flight. Set to 0 to immediately disable a Reader\"\"\"\n        assert isinstance(arg_1, int)\n        arg_0.max_in_flight = arg_1\n\n        if arg_1 == 0:\n            # set RDY 0 to all connections\n            for arg_2 in itervalues(arg_0.conns):\n                if arg_2.rdy > 0:\n                    logger.debug('[%s:%s] rdy: %d -> 0', arg_2.id, arg_0.name, arg_2.rdy)\n                    arg_0._send_rdy(arg_2, 0)\n            arg_0.total_rdy = 0\n        else:\n            arg_0.need_rdy_redistributed = True\n            arg_0._redistribute_rdy_state()", "path": "nsq/reader.py", "identifier": "Reader.set_max_in_flight", "docstring": "Dynamically adjust the reader max_in_flight. Set to 0 to immediately disable a Reader", "docstring_tokens": ["Dynamically", "adjust", "the", "reader", "max_in_flight", ".", "Set", "to", "0", "to", "immediately", "disable", "a", "Reader"], "nwo": "nsqio/pynsq", "score": 0.4773523738069914, "idx": 251892}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/api_utils.py#L116-L123", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Read a notebook from base64.", "language": "python", "parameters": "(nb, as_version=NBFORMAT_VERSION)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "try", ":", "return", "reads", "(", "b64decode", "(", "arg_0", ")", ".", "decode", "(", "'utf-8'", ")", ",", "arg_1", "=", "arg_1", ")", "except", "Exception", "as", "e", ":", "raise", "CorruptedFile", "(", "e", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Read a notebook from base64.\n    \"\"\"\n    try:\n        return reads(b64decode(arg_0).decode('utf-8'), arg_1=arg_1)\n    except Exception as e:\n        raise CorruptedFile(e)", "path": "pgcontents/api_utils.py", "identifier": "reads_base64", "docstring": "Read a notebook from base64.", "docstring_tokens": ["Read", "a", "notebook", "from", "base64", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 251893}
{"url": "https://github.com/bkg/greenwich/blob/57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141/greenwich/raster.py#L63-L82", "sha": "57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141", "docstring_summary": "Returns a Raster from layer features.", "language": "python", "parameters": "(layer, rast)", "return_statement": "return r2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ImageDriver", "(", "'MEM'", ")", "arg_3", "=", "arg_2", ".", "raster", "(", "arg_2", ".", "ShortName", ",", "arg_1", ".", "size", ")", "arg_3", ".", "affine", "=", "arg_1", ".", "affine", "arg_5", "=", "arg_1", ".", "sref", "if", "not", "arg_5", ".", "srid", ":", "arg_5", "=", "SpatialReference", "(", "4326", ")", "arg_3", ".", "sref", "=", "arg_5", "arg_6", "=", "MemoryLayer", "(", "arg_5", ",", "arg_0", ".", "GetGeomType", "(", ")", ")", "arg_6", ".", "load", "(", "arg_0", ")", "arg_7", "=", "gdal", ".", "RasterizeLayer", "(", "arg_3", ".", "ds", ",", "(", "1", ",", ")", ",", "arg_6", ".", "layer", ",", "options", "=", "[", "'ATTRIBUTE=%s'", "%", "arg_6", ".", "id", "]", ")", "arg_6", ".", "close", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns a Raster from layer features.\n\n    Arguments:\n    layer -- Layer to Func\n    rast -- Raster with target affine, size, and sref\n    \"\"\"\n    arg_2 = ImageDriver('MEM')\n    arg_3 = arg_2.raster(arg_2.ShortName, arg_1.size)\n    arg_3.affine = arg_1.affine\n    arg_5 = arg_1.sref\n    if not arg_5.srid:\n        arg_5 = SpatialReference(4326)\n    arg_3.sref = arg_5\n    arg_6 = MemoryLayer(arg_5, arg_0.GetGeomType())\n    arg_6.load(arg_0)\n    arg_7 = gdal.RasterizeLayer(\n        arg_3.ds, (1,), arg_6.layer, options=['ATTRIBUTE=%s' % arg_6.id])\n    arg_6.close()\n    return arg_3", "path": "greenwich/raster.py", "identifier": "rasterize", "docstring": "Returns a Raster from layer features.\n\n    Arguments:\n    layer -- Layer to rasterize\n    rast -- Raster with target affine, size, and sref", "docstring_tokens": ["Returns", "a", "Raster", "from", "layer", "features", "."], "nwo": "bkg/greenwich", "score": 0.15726537023232431, "idx": 251894}
{"url": "https://github.com/calebsmith/django-template-debug/blob/f3d52638da571164d63e5c8331d409b0743c628f/template_debug/utils.py#L79-L108", "sha": "f3d52638da571164d63e5c8331d409b0743c628f", "docstring_summary": "Given a variable and one of its attributes, determine if the attribute is\n    accessible inside of a Django template and return True or False accordingly", "language": "python", "parameters": "(var, attr)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "startswith", "(", "'_'", ")", ":", "return", "False", "try", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "arg_1", ")", "except", ":", "return", "False", "if", "isroutine", "(", "arg_2", ")", ":", "if", "getattr", "(", "arg_2", ",", "'alters_data'", ",", "False", ")", ":", "return", "False", "else", ":", "try", ":", "arg_3", "=", "getargspec", "(", "arg_2", ")", "arg_4", "=", "len", "(", "arg_3", ".", "args", ")", "if", "arg_3", ".", "args", "else", "0", "arg_5", "=", "len", "(", "arg_3", ".", "defaults", ")", "if", "arg_3", ".", "defaults", "else", "0", "if", "arg_4", "-", "arg_5", ">", "1", ":", "return", "False", "except", "TypeError", ":", "pass", "return", "True"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Given a variable and one of its attributes, determine if the attribute is\n    accessible inside of a Django template and return True or False accordingly\n    \"\"\"\n    # Remove private variables or methods\n    if arg_1.startswith('_'):\n        return False\n    # Remove any attributes that raise an acception when read\n    try:\n        arg_2 = getattr(arg_0, arg_1)\n    except:\n        return False\n    if isroutine(arg_2):\n        # Remove any routines that are flagged with 'alters_data'\n        if getattr(arg_2, 'alters_data', False):\n            return False\n        else:\n            # Remove any routines that require arguments\n            try:\n                arg_3 = getargspec(arg_2)\n                arg_4 = len(arg_3.args) if arg_3.args else 0\n                arg_5 = len(arg_3.defaults) if arg_3.defaults else 0\n                if arg_4 - arg_5 > 1:\n                    return False\n            except TypeError:\n                # C extension callables are routines, but getargspec fails with\n                # a TypeError when these are passed.\n                pass\n    return True", "path": "template_debug/utils.py", "identifier": "is_valid_in_template", "docstring": "Given a variable and one of its attributes, determine if the attribute is\n    accessible inside of a Django template and return True or False accordingly", "docstring_tokens": ["Given", "a", "variable", "and", "one", "of", "its", "attributes", "determine", "if", "the", "attribute", "is", "accessible", "inside", "of", "a", "Django", "template", "and", "return", "True", "or", "False", "accordingly"], "nwo": "calebsmith/django-template-debug", "score": 0.31606306836212245, "idx": 251895}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/uxpath/ast.py#L112-L132", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Cast an arbitrary object or sequence to a number type", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "LiteralWrapper", ")", ":", "arg_1", "=", "arg_0", ".", "obj", "elif", "isinstance", "(", "arg_0", ",", "Iterable", ")", "and", "not", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_1", "=", "next", "(", "arg_0", ",", "None", ")", "else", ":", "arg_1", "=", "arg_0", "if", "arg_1", "is", "None", ":", "yield", "0", "elif", "isinstance", "(", "arg_1", ",", "str", ")", ":", "yield", "float", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_1", ",", "node", ")", ":", "yield", "float", "(", "strval", "(", "arg_1", ")", ")", "elif", "isinstance", "(", "arg_1", ",", "int", ")", "or", "isinstance", "(", "arg_1", ",", "float", ")", ":", "yield", "arg_1", "else", ":", "raise", "RuntimeError", "(", "'Unknown type for number conversion: {}'", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    '''\n    Cast an arbitrary object or sequence to a number type\n    '''\n    if isinstance(arg_0, LiteralWrapper):\n        arg_1 = arg_0.obj\n    elif isinstance(arg_0, Iterable) and not isinstance(arg_0, str):\n        arg_1 = next(arg_0, None)\n    else:\n        arg_1 = arg_0\n    if arg_1 is None:\n        #FIXME: Should be NaN, not 0\n        yield 0\n    elif isinstance(arg_1, str):\n        yield float(arg_1)\n    elif isinstance(arg_1, node):\n        yield float(strval(arg_1))\n    elif isinstance(arg_1, int) or isinstance(arg_1, float):\n        yield arg_1\n    else:\n        raise RuntimeError('Unknown type for number conversion: {}'.format(arg_1))", "path": "pylib/uxml/uxpath/ast.py", "identifier": "to_number", "docstring": "Cast an arbitrary object or sequence to a number type", "docstring_tokens": ["Cast", "an", "arbitrary", "object", "or", "sequence", "to", "a", "number", "type"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 251896}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/env.py#L61-L99", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Find a config in our children so we can fill in variables in our other\n        children with its data.", "language": "python", "parameters": "(self, children)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "arg_3", "=", "None", "if", "'config'", "in", "arg_1", ":", "if", "type", "(", "arg_1", "[", "'config'", "]", ")", "==", "str", ":", "arg_1", "[", "'config'", "]", "=", "ConfigFile", "(", "arg_1", "[", "'config'", "]", ")", "elif", "isinstance", "(", "arg_1", "[", "'config'", "]", ",", "Config", ")", ":", "arg_1", "[", "'config'", "]", "=", "arg_1", "[", "'config'", "]", "elif", "type", "(", "arg_1", "[", "'config'", "]", ")", "==", "dict", ":", "arg_1", "[", "'config'", "]", "=", "Config", "(", "data", "=", "arg_1", "[", "'config'", "]", ")", "else", ":", "raise", "TypeError", "(", "\"Don't know how to turn {} into a Config\"", ".", "format", "(", "type", "(", "arg_1", "[", "'config'", "]", ")", ")", ")", "arg_2", "=", "arg_1", "[", "'config'", "]", "for", "arg_4", "in", "arg_1", ":", "if", "isinstance", "(", "arg_1", "[", "arg_4", "]", ",", "Config", ")", ":", "arg_3", "=", "arg_1", "[", "arg_4", "]", "for", "arg_4", "in", "arg_1", ":", "if", "isinstance", "(", "arg_1", "[", "arg_4", "]", ",", "Directory", ")", ":", "for", "arg_5", "in", "arg_1", "[", "arg_4", "]", ".", "_children", ":", "if", "arg_5", "==", "'config'", "and", "not", "arg_2", ":", "arg_2", "=", "arg_1", "[", "arg_4", "]", ".", "_children", "[", "arg_5", "]", "if", "isinstance", "(", "arg_1", "[", "arg_4", "]", ".", "_children", "[", "arg_5", "]", ",", "Config", ")", ":", "arg_3", "=", "arg_1", "[", "arg_4", "]", ".", "_children", "[", "arg_5", "]", "if", "arg_2", ":", "return", "arg_2", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Find a config in our children so we can fill in variables in our other\n        children with its data.\n        \"\"\"\n        arg_2 = None\n        arg_3 = None\n\n        # first see if we got a kwarg named 'config', as this guy is special\n        if 'config' in arg_1:\n            if type(arg_1['config']) == str:\n                arg_1['config'] = ConfigFile(arg_1['config'])\n            elif isinstance(arg_1['config'], Config):\n                arg_1['config'] = arg_1['config']\n            elif type(arg_1['config']) == dict:\n                arg_1['config'] = Config(data=arg_1['config'])\n            else:\n                raise TypeError(\"Don't know how to turn {} into a Config\".format(type(arg_1['config'])))\n\n            arg_2 = arg_1['config']\n\n        # next check the other kwargs\n        for arg_4 in arg_1:\n            if isinstance(arg_1[arg_4], Config):\n                arg_3 = arg_1[arg_4]\n\n        # if we still don't have a config, see if there's a directory with one\n        for arg_4 in arg_1:\n            if isinstance(arg_1[arg_4], Directory):\n                for arg_5 in arg_1[arg_4]._children:\n                    if arg_5 == 'config' and not arg_2:\n                        arg_2 = arg_1[arg_4]._children[arg_5]\n                    if isinstance(arg_1[arg_4]._children[arg_5], Config):\n                        arg_3 = arg_1[arg_4]._children[arg_5]\n\n        if arg_2:\n            return arg_2\n        else:\n            return arg_3", "path": "scruffy/env.py", "identifier": "Environment.find_config", "docstring": "Find a config in our children so we can fill in variables in our other\n        children with its data.", "docstring_tokens": ["Find", "a", "config", "in", "our", "children", "so", "we", "can", "fill", "in", "variables", "in", "our", "other", "children", "with", "its", "data", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 251897}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L118-L126", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Create a new empty Basilisp Python module.\n    Modules are created for each Namespace when it is created.", "language": "python", "parameters": "(name: str, doc=None)", "return_statement": "return mod", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", "=", "None", ")", "->", "types", ".", "ModuleType", ":", "arg_3", "=", "types", ".", "ModuleType", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "arg_3", ".", "__loader__", "=", "None", "arg_3", ".", "__package__", "=", "None", "arg_3", ".", "__spec__", "=", "None", "arg_3", ".", "__basilisp_bootstrapped__", "=", "False", "return", "arg_3"], "function": "def Func(arg_0: arg_1, arg_2=None) -> types.ModuleType:\n    \"\"\"Create a new empty Basilisp Python module.\n    Modules are created for each Namespace when it is created.\"\"\"\n    arg_3 = types.ModuleType(arg_0, arg_2=arg_2)\n    arg_3.__loader__ = None\n    arg_3.__package__ = None\n    arg_3.__spec__ = None\n    arg_3.__basilisp_bootstrapped__ = False  # type: ignore\n    return arg_3", "path": "src/basilisp/lang/runtime.py", "identifier": "_new_module", "docstring": "Create a new empty Basilisp Python module.\n    Modules are created for each Namespace when it is created.", "docstring_tokens": ["Create", "a", "new", "empty", "Basilisp", "Python", "module", ".", "Modules", "are", "created", "for", "each", "Namespace", "when", "it", "is", "created", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 251898}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/views.py#L784-L826", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Allows staff to make manual payments or refunds on an invoice.", "language": "python", "parameters": "(request, invoice_id)", "return_statement": "return render(request, \"registrasion/manual_payment.html\", data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"Func\"", "arg_3", "=", "InvoiceController", ".", "for_id_or_404", "(", "arg_1", ")", "arg_4", "=", "forms", ".", "ManualPaymentForm", "(", "arg_0", ".", "POST", "or", "None", ",", "prefix", "=", "arg_2", ",", ")", "if", "arg_0", ".", "POST", "and", "arg_4", ".", "is_valid", "(", ")", ":", "arg_4", ".", "instance", ".", "invoice", "=", "arg_3", ".", "invoice", "arg_4", ".", "instance", ".", "entered_by", "=", "arg_0", ".", "user", "arg_4", ".", "save", "(", ")", "arg_3", ".", "update_status", "(", ")", "arg_4", "=", "forms", ".", "ManualPaymentForm", "(", "prefix", "=", "arg_2", ")", "arg_8", "=", "{", "\"invoice\"", ":", "arg_3", ".", "invoice", ",", "\"form\"", ":", "arg_4", ",", "}", "return", "render", "(", "arg_0", ",", "\"registrasion/Func.html\"", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1):\n    ''' Allows staff to make manual payments or refunds on an invoice.\n\n    This form requires a login, and the logged in user needs to be staff.\n\n    Arguments:\n        invoice_id (castable to int): The invoice ID to be paid\n\n    Returns:\n        render:\n            Renders ``registrasion/Func.html`` with the following\n            data::\n\n                {\n                    \"invoice\": models.commerce.Invoice(),\n                    \"form\": form,   # A form that saves a ``ManualPayment``\n                                    # object.\n                }\n\n    '''\n\n    arg_2 = \"Func\"\n\n    arg_3 = InvoiceController.for_id_or_404(arg_1)\n\n    arg_4 = forms.ManualPaymentForm(\n        arg_0.POST or None,\n        prefix=arg_2,\n    )\n\n    if arg_0.POST and arg_4.is_valid():\n        arg_4.instance.invoice = arg_3.invoice\n        arg_4.instance.entered_by = arg_0.user\n        arg_4.save()\n        arg_3.update_status()\n        arg_4 = forms.ManualPaymentForm(prefix=arg_2)\n\n    arg_8 = {\n        \"invoice\": arg_3.invoice,\n        \"form\": arg_4,\n    }\n\n    return render(arg_0, \"registrasion/Func.html\", arg_8)", "path": "registrasion/views.py", "identifier": "manual_payment", "docstring": "Allows staff to make manual payments or refunds on an invoice.\n\n    This form requires a login, and the logged in user needs to be staff.\n\n    Arguments:\n        invoice_id (castable to int): The invoice ID to be paid\n\n    Returns:\n        render:\n            Renders ``registrasion/manual_payment.html`` with the following\n            data::\n\n                {\n                    \"invoice\": models.commerce.Invoice(),\n                    \"form\": form,   # A form that saves a ``ManualPayment``\n                                    # object.\n                }", "docstring_tokens": ["Allows", "staff", "to", "make", "manual", "payments", "or", "refunds", "on", "an", "invoice", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 251899}
{"url": "https://github.com/JonathanRaiman/ciseau/blob/f72d1c82d85eeb3d3ac9fac17690041725402175/ciseau/wiki_markup_processing.py#L118-L140", "sha": "f72d1c82d85eeb3d3ac9fac17690041725402175", "docstring_summary": "A generator to convert raw text segments, without xml to a\n    list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization.", "language": "python", "parameters": "(text, keep_whitespace=False, normalize_ascii=True)", "return_statement": "return sent_tokenize(\n        remove_dates(_remove_urls(text)),\n        keep_whitespace,\n        normalize_ascii\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "return", "sent_tokenize", "(", "remove_dates", "(", "_remove_urls", "(", "arg_0", ")", ")", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n    \"\"\"\n    A generator to convert raw text segments, without xml to a\n    list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization.\n\n    Arguments\n    ---------\n        text: str, input text to tokenize, strip of markup.\n        keep_whitespace : bool, should the output retain the\n            whitespace of the input (so that char offsets in the\n            output correspond to those in the input).\n\n    Returns\n    -------\n        generator<list<list<str>>>, a generator for sentences, with\n            within each sentence a list of the words separated.\n    \"\"\"\n    return sent_tokenize(\n        remove_dates(_remove_urls(arg_0)),\n        arg_1,\n        arg_2\n    )", "path": "ciseau/wiki_markup_processing.py", "identifier": "to_raw_text_markupless", "docstring": "A generator to convert raw text segments, without xml to a\n    list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization.\n\n    Arguments\n    ---------\n        text: str, input text to tokenize, strip of markup.\n        keep_whitespace : bool, should the output retain the\n            whitespace of the input (so that char offsets in the\n            output correspond to those in the input).\n\n    Returns\n    -------\n        generator<list<list<str>>>, a generator for sentences, with\n            within each sentence a list of the words separated.", "docstring_tokens": ["A", "generator", "to", "convert", "raw", "text", "segments", "without", "xml", "to", "a", "list", "of", "words", "without", "any", "markup", ".", "Additionally", "dates", "are", "replaced", "by", "7777", "for", "normalization", "."], "nwo": "JonathanRaiman/ciseau", "score": 0.2836741237679313, "idx": 251900}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/billing.py#L154-L208", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Method builds a payload out of the passed arguments.", "language": "python", "parameters": "(ipaddress,\n                  event_type,\n                  event_time=None,\n                  start_time=None,\n                  end_time=None)", "return_statement": "return payload", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "{", "'event_type'", ":", "unicode", "(", "arg_1", ")", ",", "'tenant_id'", ":", "unicode", "(", "arg_0", ".", "used_by_tenant_id", ")", ",", "'ip_address'", ":", "unicode", "(", "arg_0", ".", "address_readable", ")", ",", "'ip_version'", ":", "int", "(", "arg_0", ".", "version", ")", ",", "'ip_type'", ":", "unicode", "(", "arg_0", ".", "address_type", ")", ",", "'id'", ":", "unicode", "(", "arg_0", ".", "id", ")", "}", "if", "arg_1", "==", "IP_EXISTS", ":", "if", "arg_3", "is", "None", "or", "arg_4", "is", "None", ":", "raise", "ValueError", "(", "'IP_BILL: {} start_time/end_time cannot be empty'", ".", "format", "(", "arg_1", ")", ")", "arg_5", ".", "update", "(", "{", "'startTime'", ":", "unicode", "(", "convert_timestamp", "(", "arg_3", ")", ")", ",", "'endTime'", ":", "unicode", "(", "convert_timestamp", "(", "arg_4", ")", ")", "}", ")", "elif", "arg_1", "in", "[", "IP_ADD", ",", "IP_DEL", ",", "IP_ASSOC", ",", "IP_DISASSOC", "]", ":", "if", "arg_2", "is", "None", ":", "raise", "ValueError", "(", "'IP_BILL: {}: event_time cannot be NULL'", ".", "format", "(", "arg_1", ")", ")", "arg_5", ".", "update", "(", "{", "'eventTime'", ":", "unicode", "(", "convert_timestamp", "(", "arg_2", ")", ")", ",", "'subnet_id'", ":", "unicode", "(", "arg_0", ".", "subnet_id", ")", ",", "'network_id'", ":", "unicode", "(", "arg_0", ".", "network_id", ")", ",", "'public'", ":", "True", "if", "arg_0", ".", "network_id", "==", "PUBLIC_NETWORK_ID", "else", "False", ",", "}", ")", "else", ":", "raise", "ValueError", "(", "'IP_BILL: bad event_type: {}'", ".", "format", "(", "arg_1", ")", ")", "return", "arg_5"], "function": "def Func(arg_0,\n                  arg_1,\n                  arg_2=None,\n                  arg_3=None,\n                  arg_4=None):\n    \"\"\"Method builds a payload out of the passed arguments.\n\n    Parameters:\n        `ipaddress`: the models.IPAddress object\n        `event_type`: USAGE,CREATE,DELETE,SUSPEND,or UNSUSPEND\n        `start_time`: startTime for cloudfeeds\n        `end_time`: endTime for cloudfeeds\n    Returns a dictionary suitable to notify billing.\n    Message types mapping to cloud feeds for references:\n        ip.exists       - USAGE\n        ip.add          - CREATE\n        ip.delete       - DELETE\n        ip.associate    - UP\n        ip.disassociate  - DOWN\n    Refer to: http://rax.io/cf-api for more details.\n    \"\"\"\n    # This is the common part of all message types\n    arg_5 = {\n        'event_type': unicode(arg_1),\n        'tenant_id': unicode(arg_0.used_by_tenant_id),\n        'ip_address': unicode(arg_0.address_readable),\n        'ip_version': int(arg_0.version),\n        'ip_type': unicode(arg_0.address_type),\n        'id': unicode(arg_0.id)\n    }\n\n    # Depending on the message type add the appropriate fields\n    if arg_1 == IP_EXISTS:\n        if arg_3 is None or arg_4 is None:\n            raise ValueError('IP_BILL: {} start_time/end_time cannot be empty'\n                             .format(arg_1))\n        arg_5.update({\n            'startTime': unicode(convert_timestamp(arg_3)),\n            'endTime': unicode(convert_timestamp(arg_4))\n        })\n    elif arg_1 in [IP_ADD, IP_DEL, IP_ASSOC, IP_DISASSOC]:\n        if arg_2 is None:\n            raise ValueError('IP_BILL: {}: event_time cannot be NULL'\n                             .format(arg_1))\n        arg_5.update({\n            'eventTime': unicode(convert_timestamp(arg_2)),\n            'subnet_id': unicode(arg_0.subnet_id),\n            'network_id': unicode(arg_0.network_id),\n            'public': True if arg_0.network_id == PUBLIC_NETWORK_ID\n            else False,\n        })\n    else:\n        raise ValueError('IP_BILL: bad event_type: {}'.format(arg_1))\n\n    return arg_5", "path": "quark/billing.py", "identifier": "build_payload", "docstring": "Method builds a payload out of the passed arguments.\n\n    Parameters:\n        `ipaddress`: the models.IPAddress object\n        `event_type`: USAGE,CREATE,DELETE,SUSPEND,or UNSUSPEND\n        `start_time`: startTime for cloudfeeds\n        `end_time`: endTime for cloudfeeds\n    Returns a dictionary suitable to notify billing.\n    Message types mapping to cloud feeds for references:\n        ip.exists       - USAGE\n        ip.add          - CREATE\n        ip.delete       - DELETE\n        ip.associate    - UP\n        ip.disassociate  - DOWN\n    Refer to: http://rax.io/cf-api for more details.", "docstring_tokens": ["Method", "builds", "a", "payload", "out", "of", "the", "passed", "arguments", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 251901}
{"url": "https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L823-L832", "sha": "ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e", "docstring_summary": "Import settings from the given file system path to given settings instance.", "language": "python", "parameters": "(settings, config_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "QtCore", ".", "QSettings", "(", "arg_1", ",", "QtCore", ".", "QSettings", ".", "IniFormat", ")", "for", "arg_3", "in", "arg_2", ".", "allKeys", "(", ")", ":", "arg_0", "[", "arg_3", "]", "=", "arg_2", ".", "value", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Import settings from the given file system path to given settings instance.\n\n    type settings: IDASettingsInterface\n    type config_path: str\n    \"\"\"\n    arg_2 = QtCore.QSettings(arg_1, QtCore.QSettings.IniFormat)\n    for arg_3 in arg_2.allKeys():\n        arg_0[arg_3] = arg_2.value(arg_3)", "path": "ida_settings/ida_settings.py", "identifier": "import_settings", "docstring": "Import settings from the given file system path to given settings instance.\n\n    type settings: IDASettingsInterface\n    type config_path: str", "docstring_tokens": ["Import", "settings", "from", "the", "given", "file", "system", "path", "to", "given", "settings", "instance", "."], "nwo": "williballenthin/ida-settings", "score": 0.18657722465184873, "idx": 251902}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/risk.py#L119-L171", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Returns arrays of long, short and gross sector exposures of an algorithm's\n    positions", "language": "python", "parameters": "(positions, sectors, sector_dict=SECTORS)", "return_statement": "return long_exposures, short_exposures, gross_exposures, net_exposures", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "keys", "(", ")", "arg_5", "=", "[", "]", "arg_6", "=", "[", "]", "arg_7", "=", "[", "]", "arg_8", "=", "[", "]", "arg_9", "=", "arg_0", ".", "drop", "(", "'cash'", ",", "axis", "=", "'columns'", ")", "arg_10", "=", "arg_9", "[", "arg_9", ">", "0", "]", ".", "sum", "(", "axis", "=", "'columns'", ")", "arg_11", "=", "arg_9", "[", "arg_9", "<", "0", "]", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "'columns'", ")", "arg_12", "=", "arg_9", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "'columns'", ")", "for", "arg_13", "in", "arg_4", ":", "arg_14", "=", "arg_9", "[", "arg_1", "==", "arg_13", "]", "arg_15", "=", "arg_14", "[", "arg_14", ">", "0", "]", ".", "sum", "(", "axis", "=", "'columns'", ")", ".", "divide", "(", "arg_10", ")", "arg_16", "=", "arg_14", "[", "arg_14", "<", "0", "]", ".", "sum", "(", "axis", "=", "'columns'", ")", ".", "divide", "(", "arg_11", ")", "arg_17", "=", "arg_14", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "'columns'", ")", ".", "divide", "(", "arg_12", ")", "arg_18", "=", "arg_15", ".", "subtract", "(", "arg_16", ")", "arg_5", ".", "append", "(", "arg_15", ")", "arg_6", ".", "append", "(", "arg_16", ")", "arg_7", ".", "append", "(", "arg_17", ")", "arg_8", ".", "append", "(", "arg_18", ")", "return", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n    \"\"\"\n    Returns arrays of long, short and gross sector exposures of an algorithm's\n    positions\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Daily equity positions of algorithm, in dollars.\n        - See full explanation in compute_style_factor_exposures.\n\n    sectors : pd.DataFrame\n        Daily Morningstar sector code per asset\n        - See full explanation in create_risk_tear_sheet\n\n    sector_dict : dict or OrderedDict\n        Dictionary of all sectors\n        - Keys are sector codes (e.g. ints or strings) and values are sector\n          names (which must be strings)\n        - Defaults to Morningstar sectors\n    \"\"\"\n\n    arg_4 = arg_2.keys()\n\n    arg_5 = []\n    arg_6 = []\n    arg_7 = []\n    arg_8 = []\n\n    arg_9 = arg_0.drop('cash', axis='columns')\n    arg_10 = arg_9[arg_9 > 0] \\\n        .sum(axis='columns')\n    arg_11 = arg_9[arg_9 < 0] \\\n        .abs().sum(axis='columns')\n    arg_12 = arg_9.abs().sum(axis='columns')\n\n    for arg_13 in arg_4:\n        arg_14 = arg_9[arg_1 == arg_13]\n\n        arg_15 = arg_14[arg_14 > 0] \\\n            .sum(axis='columns').divide(arg_10)\n        arg_16 = arg_14[arg_14 < 0] \\\n            .sum(axis='columns').divide(arg_11)\n        arg_17 = arg_14.abs().sum(axis='columns') \\\n            .divide(arg_12)\n        arg_18 = arg_15.subtract(arg_16)\n\n        arg_5.append(arg_15)\n        arg_6.append(arg_16)\n        arg_7.append(arg_17)\n        arg_8.append(arg_18)\n\n    return arg_5, arg_6, arg_7, arg_8", "path": "pyfolio/risk.py", "identifier": "compute_sector_exposures", "docstring": "Returns arrays of long, short and gross sector exposures of an algorithm's\n    positions\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Daily equity positions of algorithm, in dollars.\n        - See full explanation in compute_style_factor_exposures.\n\n    sectors : pd.DataFrame\n        Daily Morningstar sector code per asset\n        - See full explanation in create_risk_tear_sheet\n\n    sector_dict : dict or OrderedDict\n        Dictionary of all sectors\n        - Keys are sector codes (e.g. ints or strings) and values are sector\n          names (which must be strings)\n        - Defaults to Morningstar sectors", "docstring_tokens": ["Returns", "arrays", "of", "long", "short", "and", "gross", "sector", "exposures", "of", "an", "algorithm", "s", "positions"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 251903}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L313-L357", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Apply an operation to the output of the circuit.", "language": "python", "parameters": "(self, op, qargs=None, cargs=None, condition=None)", "return_statement": "return self._id_to_node[self._max_node_id]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "[", "]", "arg_3", "=", "arg_3", "or", "[", "]", "arg_5", "=", "arg_0", ".", "_bits_in_condition", "(", "arg_4", ")", "arg_5", ".", "extend", "(", "arg_3", ")", "arg_0", ".", "_check_condition", "(", "arg_1", ".", "name", ",", "arg_4", ")", "arg_0", ".", "_check_bits", "(", "arg_2", ",", "arg_0", ".", "output_map", ")", "arg_0", ".", "_check_bits", "(", "arg_5", ",", "arg_0", ".", "output_map", ")", "arg_0", ".", "_add_op_node", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "arg_6", "=", "[", "arg_2", ",", "arg_5", "]", "for", "arg_7", "in", "itertools", ".", "chain", "(", "*", "arg_6", ")", ":", "arg_8", "=", "list", "(", "arg_0", ".", "_multi_graph", ".", "predecessors", "(", "arg_0", ".", "output_map", "[", "arg_7", "]", ")", ")", "if", "len", "(", "arg_8", ")", "!=", "1", ":", "raise", "DAGCircuitError", "(", "\"output node has multiple in-edges\"", ")", "arg_0", ".", "_multi_graph", ".", "add_edge", "(", "arg_8", "[", "0", "]", ",", "arg_0", ".", "_id_to_node", "[", "arg_0", ".", "_max_node_id", "]", ",", "name", "=", "\"%s[%s]\"", "%", "(", "arg_7", "[", "0", "]", ".", "name", ",", "arg_7", "[", "1", "]", ")", ",", "wire", "=", "arg_7", ")", "arg_0", ".", "_multi_graph", ".", "remove_edge", "(", "arg_8", "[", "0", "]", ",", "arg_0", ".", "output_map", "[", "arg_7", "]", ")", "arg_0", ".", "_multi_graph", ".", "add_edge", "(", "arg_0", ".", "_id_to_node", "[", "arg_0", ".", "_max_node_id", "]", ",", "arg_0", ".", "output_map", "[", "arg_7", "]", ",", "name", "=", "\"%s[%s]\"", "%", "(", "arg_7", "[", "0", "]", ".", "name", ",", "arg_7", "[", "1", "]", ")", ",", "wire", "=", "arg_7", ")", "return", "arg_0", ".", "_id_to_node", "[", "arg_0", ".", "_max_node_id", "]"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"Apply an operation to the output of the circuit.\n\n        Args:\n            op (Instruction): the operation associated with the DAG node\n            qargs (list[tuple]): qubits that op will be applied to\n            cargs (list[tuple]): cbits that op will be applied to\n            condition (tuple or None): optional condition (ClassicalRegister, int)\n\n        Returns:\n            DAGNode: the current max node\n\n        Raises:\n            DAGCircuitError: if a leaf node is connected to multiple outputs\n\n        \"\"\"\n        arg_2 = arg_2 or []\n        arg_3 = arg_3 or []\n\n        arg_5 = arg_0._bits_in_condition(arg_4)\n        arg_5.extend(arg_3)\n\n        arg_0._check_condition(arg_1.name, arg_4)\n        arg_0._check_bits(arg_2, arg_0.output_map)\n        arg_0._check_bits(arg_5, arg_0.output_map)\n\n        arg_0._add_op_node(arg_1, arg_2, arg_3, arg_4)\n\n        # Add new in-edges from predecessors of the output nodes to the\n        # operation node while deleting the old in-edges of the output nodes\n        # and adding new edges from the operation node to each output node\n        arg_6 = [arg_2, arg_5]\n        for arg_7 in itertools.chain(*arg_6):\n            arg_8 = list(arg_0._multi_graph.predecessors(arg_0.output_map[arg_7]))\n\n            if len(arg_8) != 1:\n                raise DAGCircuitError(\"output node has multiple in-edges\")\n\n            arg_0._multi_graph.add_edge(arg_8[0], arg_0._id_to_node[arg_0._max_node_id],\n                                       name=\"%s[%s]\" % (arg_7[0].name, arg_7[1]), wire=arg_7)\n            arg_0._multi_graph.remove_edge(arg_8[0], arg_0.output_map[arg_7])\n            arg_0._multi_graph.add_edge(arg_0._id_to_node[arg_0._max_node_id], arg_0.output_map[arg_7],\n                                       name=\"%s[%s]\" % (arg_7[0].name, arg_7[1]), wire=arg_7)\n\n        return arg_0._id_to_node[arg_0._max_node_id]", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.apply_operation_back", "docstring": "Apply an operation to the output of the circuit.\n\n        Args:\n            op (Instruction): the operation associated with the DAG node\n            qargs (list[tuple]): qubits that op will be applied to\n            cargs (list[tuple]): cbits that op will be applied to\n            condition (tuple or None): optional condition (ClassicalRegister, int)\n\n        Returns:\n            DAGNode: the current max node\n\n        Raises:\n            DAGCircuitError: if a leaf node is connected to multiple outputs", "docstring_tokens": ["Apply", "an", "operation", "to", "the", "output", "of", "the", "circuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 251904}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/walk.py#L4-L35", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Walk the knitting pattern in a right-to-left fashion.", "language": "python", "parameters": "(knitting_pattern)", "return_statement": "return walk", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "[", "]", "Func", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "rows", ":", "arg_5", "=", "arg_4", ".", "rows_before", "[", ":", "]", "if", "arg_5", ":", "arg_1", "[", "arg_4", "]", "=", "arg_5", "else", ":", "arg_2", ".", "append", "(", "arg_4", ")", "assert", "arg_2", "while", "arg_2", ":", "arg_4", "=", "arg_2", ".", "pop", "(", "0", ")", "Func", ".", "append", "(", "arg_4", ")", "assert", "arg_4", "not", "in", "arg_1", "for", "arg_6", "in", "reversed", "(", "arg_4", ".", "rows_after", ")", ":", "arg_7", "=", "arg_1", "[", "arg_6", "]", "arg_7", ".", "remove", "(", "arg_4", ")", "if", "not", "arg_7", ":", "del", "arg_1", "[", "arg_6", "]", "arg_2", ".", "insert", "(", "0", ",", "arg_6", ")", "assert", "not", "arg_1", ",", "\"everything is walked\"", "return", "Func"], "function": "def Func(arg_0):\n    \"\"\"Walk the knitting pattern in a right-to-left fashion.\n\n    :return: an iterable to walk the rows\n    :rtype: list\n    :param knittingpattern.KnittingPattern.KnittingPattern knitting_pattern: a\n      knitting pattern to take the rows from\n    \"\"\"\n    arg_1 = {}  # key consumes from values\n    arg_2 = []\n    Func = []\n    for arg_4 in arg_0.rows:\n        arg_5 = arg_4.rows_before[:]\n        if arg_5:\n            arg_1[arg_4] = arg_5\n        else:\n            arg_2.append(arg_4)\n    assert arg_2\n    while arg_2:\n        # print(\"free rows:\", free_rows)\n        arg_4 = arg_2.pop(0)\n        Func.append(arg_4)\n        assert arg_4 not in arg_1\n        for arg_6 in reversed(arg_4.rows_after):\n            arg_7 = arg_1[arg_6]\n            # print(\"  freed:\", freed_row, todo)\n            arg_7.remove(arg_4)\n            if not arg_7:\n                del arg_1[arg_6]\n                arg_2.insert(0, arg_6)\n    assert not arg_1, \"everything is walked\"\n    return Func", "path": "knittingpattern/walk.py", "identifier": "walk", "docstring": "Walk the knitting pattern in a right-to-left fashion.\n\n    :return: an iterable to walk the rows\n    :rtype: list\n    :param knittingpattern.KnittingPattern.KnittingPattern knitting_pattern: a\n      knitting pattern to take the rows from", "docstring_tokens": ["Walk", "the", "knitting", "pattern", "in", "a", "right", "-", "to", "-", "left", "fashion", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 251905}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L84-L109", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This just reads a pickled fake LC.", "language": "python", "parameters": "(fakelcfile)", "return_statement": "return lcdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "infd", ":", "arg_1", "=", "pickle", ".", "load", "(", "infd", ")", "except", "UnicodeDecodeError", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "infd", ":", "arg_1", "=", "pickle", ".", "load", "(", "infd", ",", "encoding", "=", "'latin1'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    '''\n    This just reads a pickled fake LC.\n\n    Parameters\n    ----------\n\n    fakelcfile : str\n        The fake LC file to read.\n\n    Returns\n    -------\n\n    dict\n        This returns an lcdict.\n\n    '''\n\n    try:\n        with open(arg_0,'rb') as infd:\n            arg_1 = pickle.load(infd)\n    except UnicodeDecodeError:\n        with open(arg_0,'rb') as infd:\n            arg_1 = pickle.load(infd, encoding='latin1')\n\n    return arg_1", "path": "astrobase/fakelcs/recovery.py", "identifier": "read_fakelc", "docstring": "This just reads a pickled fake LC.\n\n    Parameters\n    ----------\n\n    fakelcfile : str\n        The fake LC file to read.\n\n    Returns\n    -------\n\n    dict\n        This returns an lcdict.", "docstring_tokens": ["This", "just", "reads", "a", "pickled", "fake", "LC", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 251906}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/jobs.py#L244-L315", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Execute a Perceval job on RQ.", "language": "python", "parameters": "(backend, backend_args, qitems, task_id, category,\n                         archive_args=None, max_retries=MAX_JOB_RETRIES)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "arg_7", ")", ":", "arg_8", "=", "rq", ".", "get_current_job", "(", ")", "arg_9", "=", "PercevalJob", "(", "arg_8", ".", "id", ",", "arg_3", ",", "arg_0", ",", "arg_4", ",", "arg_8", ".", "connection", ",", "arg_2", ")", "logger", ".", "debug", "(", "\"Running job #%s (task: %s) (%s) (cat:%s)\"", ",", "arg_9", ".", "job_id", ",", "arg_3", ",", "arg_0", ",", "arg_4", ")", "if", "not", "arg_9", ".", "has_archiving", "(", ")", "and", "arg_5", ":", "raise", "AttributeError", "(", "\"archive attributes set but archive is not supported\"", ")", "arg_10", "=", "True", "arg_11", "=", "False", "arg_12", "=", "0", "while", "arg_10", ":", "try", ":", "arg_9", ".", "run", "(", "arg_1", ",", "arg_5", "=", "arg_5", ",", "arg_11", "=", "arg_11", ")", "except", "AttributeError", "as", "e", ":", "raise", "e", "except", "Exception", "as", "e", ":", "logger", ".", "debug", "(", "\"Error running job %s (%s) - %s\"", ",", "arg_9", ".", "job_id", ",", "arg_0", ",", "str", "(", "e", ")", ")", "arg_12", "+=", "1", "if", "not", "arg_9", ".", "has_resuming", "(", ")", "or", "arg_12", ">=", "arg_6", ":", "logger", ".", "error", "(", "\"Cancelling job #%s (task: %s) (%s)\"", ",", "arg_9", ".", "job_id", ",", "arg_3", ",", "arg_0", ")", "raise", "e", "logger", ".", "warning", "(", "\"Resuming job #%s (task: %s) (%s) due to a failure (n %s, max %s)\"", ",", "arg_9", ".", "job_id", ",", "arg_3", ",", "arg_0", ",", "arg_12", ",", "arg_6", ")", "arg_11", "=", "True", "else", ":", "arg_10", "=", "False", "arg_13", "=", "arg_9", ".", "result", "logger", ".", "debug", "(", "\"Job #%s (task: %s) completed (%s) - %s items (%s) fetched\"", ",", "arg_13", ".", "job_id", ",", "arg_3", ",", "arg_13", ".", "backend", ",", "str", "(", "arg_13", ".", "nitems", ")", ",", "arg_13", ".", "category", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                         arg_5=None, arg_6=arg_7):\n    \"\"\"Execute a Perceval job on RQ.\n\n    The items fetched during the process will be stored in a\n    Redis queue named `queue`.\n\n    Setting the parameter `archive_path`, raw data will be stored\n    with the archive manager. The contents from the archive can\n    be retrieved setting the pameter `fetch_from_archive` to `True`,\n    too. Take into account this behaviour will be only available\n    when the backend supports the use of the archive. If archiving\n    is not supported, an `AttributeError` exception will be raised.\n\n    :param backend: backend to execute\n    :param bakend_args: dict of arguments for running the backend\n    :param qitems: name of the RQ queue used to store the items\n    :param task_id: identifier of the task linked to this job\n    :param category: category of the items to retrieve\n    :param archive_args: archive arguments\n    :param max_retries: maximum number of attempts this job can execute\n        before failing\n\n    :returns: a `JobResult` instance\n\n    :raises NotFoundError: raised when the backend is not found\n    :raises AttributeError: raised when archiving is not supported but\n        any of the archive parameters were set\n    \"\"\"\n    arg_8 = rq.get_current_job()\n\n    arg_9 = PercevalJob(arg_8.id, arg_3, arg_0, arg_4,\n                      arg_8.connection, arg_2)\n\n    logger.debug(\"Running job #%s (task: %s) (%s) (cat:%s)\",\n                 arg_9.job_id, arg_3, arg_0, arg_4)\n\n    if not arg_9.has_archiving() and arg_5:\n        raise AttributeError(\"archive attributes set but archive is not supported\")\n\n    arg_10 = True\n    arg_11 = False\n    arg_12 = 0\n\n    while arg_10:\n        try:\n            arg_9.run(arg_1, arg_5=arg_5, arg_11=arg_11)\n        except AttributeError as e:\n            raise e\n        except Exception as e:\n            logger.debug(\"Error running job %s (%s) - %s\",\n                         arg_9.job_id, arg_0, str(e))\n            arg_12 += 1\n\n            if not arg_9.has_resuming() or arg_12 >= arg_6:\n                logger.error(\"Cancelling job #%s (task: %s) (%s)\",\n                             arg_9.job_id, arg_3, arg_0)\n                raise e\n\n            logger.warning(\"Resuming job #%s (task: %s) (%s) due to a failure (n %s, max %s)\",\n                           arg_9.job_id, arg_3, arg_0, arg_12, arg_6)\n            arg_11 = True\n        else:\n            # No failure, do not retry\n            arg_10 = False\n\n    arg_13 = arg_9.result\n\n    logger.debug(\"Job #%s (task: %s) completed (%s) - %s items (%s) fetched\",\n                 arg_13.job_id, arg_3, arg_13.backend, str(arg_13.nitems), arg_13.category)\n\n    return arg_13", "path": "arthur/jobs.py", "identifier": "execute_perceval_job", "docstring": "Execute a Perceval job on RQ.\n\n    The items fetched during the process will be stored in a\n    Redis queue named `queue`.\n\n    Setting the parameter `archive_path`, raw data will be stored\n    with the archive manager. The contents from the archive can\n    be retrieved setting the pameter `fetch_from_archive` to `True`,\n    too. Take into account this behaviour will be only available\n    when the backend supports the use of the archive. If archiving\n    is not supported, an `AttributeError` exception will be raised.\n\n    :param backend: backend to execute\n    :param bakend_args: dict of arguments for running the backend\n    :param qitems: name of the RQ queue used to store the items\n    :param task_id: identifier of the task linked to this job\n    :param category: category of the items to retrieve\n    :param archive_args: archive arguments\n    :param max_retries: maximum number of attempts this job can execute\n        before failing\n\n    :returns: a `JobResult` instance\n\n    :raises NotFoundError: raised when the backend is not found\n    :raises AttributeError: raised when archiving is not supported but\n        any of the archive parameters were set", "docstring_tokens": ["Execute", "a", "Perceval", "job", "on", "RQ", "."], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 251907}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/util/mapping_util.py#L147-L193", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "For a 2D array and mask, map the values of all unmasked pixels to a 1D array.", "language": "python", "parameters": "(mask, array_2d)", "return_statement": "return array_1d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "mask_util", ".", "total_regular_pixels_from_mask", "(", "arg_0", ")", "arg_3", "=", "np", ".", "zeros", "(", "shape", "=", "arg_2", ")", "arg_4", "=", "0", "for", "arg_5", "in", "range", "(", "arg_0", ".", "shape", "[", "0", "]", ")", ":", "for", "arg_6", "in", "range", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "if", "not", "arg_0", "[", "arg_5", ",", "arg_6", "]", ":", "arg_3", "[", "arg_4", "]", "=", "arg_1", "[", "arg_5", ",", "arg_6", "]", "arg_4", "+=", "1", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"For a 2D array and mask, map the values of all unmasked pixels to a 1D array.\n\n    The pixel coordinate origin is at the top left corner of the 2D array and goes right-wards and downwards, such\n    that for an array of shape (3,3) where all pixels are unmasked:\n\n    - pixel [0,0] of the 2D array will correspond to index 0 of the 1D array.\n    - pixel [0,1] of the 2D array will correspond to index 1 of the 1D array.\n    - pixel [1,0] of the 2D array will correspond to index 4 of the 1D array.\n\n    Parameters\n     ----------\n    mask : ndarray\n        A 2D array of bools, where *False* values mean unmasked and are included in the mapping.\n    array_2d : ndarray\n        The 2D array of values which are mapped to a 1D array.\n\n    Returns\n    --------\n    ndarray\n        A 1D array of values mapped from the 2D array with dimensions (total_unmasked_pixels).\n\n    Examples\n    --------\n    mask = np.array([[True, False, True],\n                     [False, False, False]\n                     [True, False, True]])\n\n    array_2d = np.array([[1.0, 2.0, 3.0],\n                          [4.0, 5.0, 6.0],\n                          [7.0, 8.0, 9.0]])\n\n    array_1d = Func(mask=mask, array_2d=array_2d)\n    \"\"\"\n\n    arg_2 = mask_util.total_regular_pixels_from_mask(arg_0)\n\n    arg_3 = np.zeros(shape=arg_2)\n    arg_4 = 0\n\n    for arg_5 in range(arg_0.shape[0]):\n        for arg_6 in range(arg_0.shape[1]):\n            if not arg_0[arg_5, arg_6]:\n                arg_3[arg_4] = arg_1[arg_5, arg_6]\n                arg_4 += 1\n\n    return arg_3", "path": "autolens/data/array/util/mapping_util.py", "identifier": "map_2d_array_to_masked_1d_array_from_array_2d_and_mask", "docstring": "For a 2D array and mask, map the values of all unmasked pixels to a 1D array.\n\n    The pixel coordinate origin is at the top left corner of the 2D array and goes right-wards and downwards, such\n    that for an array of shape (3,3) where all pixels are unmasked:\n\n    - pixel [0,0] of the 2D array will correspond to index 0 of the 1D array.\n    - pixel [0,1] of the 2D array will correspond to index 1 of the 1D array.\n    - pixel [1,0] of the 2D array will correspond to index 4 of the 1D array.\n\n    Parameters\n     ----------\n    mask : ndarray\n        A 2D array of bools, where *False* values mean unmasked and are included in the mapping.\n    array_2d : ndarray\n        The 2D array of values which are mapped to a 1D array.\n\n    Returns\n    --------\n    ndarray\n        A 1D array of values mapped from the 2D array with dimensions (total_unmasked_pixels).\n\n    Examples\n    --------\n    mask = np.array([[True, False, True],\n                     [False, False, False]\n                     [True, False, True]])\n\n    array_2d = np.array([[1.0, 2.0, 3.0],\n                          [4.0, 5.0, 6.0],\n                          [7.0, 8.0, 9.0]])\n\n    array_1d = map_2d_array_to_masked_1d_array_from_array_2d_and_mask(mask=mask, array_2d=array_2d)", "docstring_tokens": ["For", "a", "2D", "array", "and", "mask", "map", "the", "values", "of", "all", "unmasked", "pixels", "to", "a", "1D", "array", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 251908}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/demos.py#L20-L85", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "GBM model demo.", "language": "python", "parameters": "(interactive=True, echo=True, testing=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "True", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ")", ":", "def", "demo_body", "(", "arg_3", ")", ":", "arg_3", "(", ")", "h2o", ".", "init", "(", ")", "arg_3", "(", ")", "arg_4", "=", "h2o", ".", "load_dataset", "(", "\"prostate\"", ")", "arg_3", "(", ")", "arg_4", ".", "describe", "(", ")", "arg_3", "(", ")", "arg_5", ",", "arg_6", "=", "arg_4", ".", "split_frame", "(", "ratios", "=", "[", "0.70", "]", ")", "arg_3", "(", ")", "arg_5", "[", "\"CAPSULE\"", "]", "=", "arg_5", "[", "\"CAPSULE\"", "]", ".", "asfactor", "(", ")", "arg_6", "[", "\"CAPSULE\"", "]", "=", "arg_6", "[", "\"CAPSULE\"", "]", ".", "asfactor", "(", ")", "arg_3", "(", ")", "from", "h2o", ".", "estimators", "import", "H2OGradientBoostingEstimator", "arg_7", "=", "H2OGradientBoostingEstimator", "(", "distribution", "=", "\"bernoulli\"", ",", "ntrees", "=", "10", ",", "max_depth", "=", "8", ",", "min_rows", "=", "10", ",", "learn_rate", "=", "0.2", ")", "arg_7", ".", "train", "(", "x", "=", "[", "\"AGE\"", ",", "\"RACE\"", ",", "\"PSA\"", ",", "\"VOL\"", ",", "\"GLEASON\"", "]", ",", "y", "=", "\"CAPSULE\"", ",", "training_frame", "=", "arg_5", ")", "arg_3", "(", ")", "arg_7", ".", "show", "(", ")", "arg_3", "(", ")", "arg_8", "=", "arg_7", ".", "predict", "(", "arg_6", ")", "arg_8", ".", "show", "(", ")", "arg_3", "(", ")", "from", "h2o", ".", "tree", "import", "H2OTree", ",", "H2ONode", "arg_9", "=", "H2OTree", "(", "arg_7", ",", "0", ",", "\"0\"", ")", "len", "(", "arg_9", ")", "arg_9", ".", "left_children", "arg_9", ".", "right_children", "arg_9", ".", "root_node", ".", "show", "(", ")", "arg_3", "(", ")", "arg_10", "=", "arg_7", ".", "model_performance", "(", "arg_6", ")", "arg_10", ".", "show", "(", ")", "_run_demo", "(", "demo_body", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0=True, arg_1=True, arg_2=False):\n    \"\"\"GBM model demo.\"\"\"\n\n    def demo_body(arg_3):\n        \"\"\"\n        Demo of H2O's Gradient Boosting estimator.\n\n        This demo uploads a dataset to h2o, parses it, and shows a description.\n        Then it divides the dataset into training and test sets, builds a GLM\n        from the training set, and makes predictions for the test set.\n        Finally, default performance metrics are displayed.\n        \"\"\"\n        arg_3()\n        # Connect to H2O\n        h2o.init()\n\n        arg_3()\n        # Upload the prostate dataset that comes included in the h2o python package\n        arg_4 = h2o.load_dataset(\"prostate\")\n\n        arg_3()\n        # Print a description of the prostate data\n        arg_4.describe()\n\n        arg_3()\n        # Randomly split the dataset into ~70/30, training/test sets\n        arg_5, arg_6 = arg_4.split_frame(ratios=[0.70])\n\n        arg_3()\n        # Convert the response columns to factors (for binary classification problems)\n        arg_5[\"CAPSULE\"] = arg_5[\"CAPSULE\"].asfactor()\n        arg_6[\"CAPSULE\"] = arg_6[\"CAPSULE\"].asfactor()\n\n        arg_3()\n        # Build a (classification) GLM\n        from h2o.estimators import H2OGradientBoostingEstimator\n        arg_7 = H2OGradientBoostingEstimator(distribution=\"bernoulli\", ntrees=10, max_depth=8,\n                                                    min_rows=10, learn_rate=0.2)\n        arg_7.train(x=[\"AGE\", \"RACE\", \"PSA\", \"VOL\", \"GLEASON\"],\n                           y=\"CAPSULE\", training_frame=arg_5)\n\n        arg_3()\n        # Show the model\n        arg_7.show()\n\n        arg_3()\n        # Predict on the test set and show the first ten predictions\n        arg_8 = arg_7.predict(arg_6)\n        arg_8.show()\n\n        arg_3()\n        # Fetch a tree, print number of tree nodes, show root node description\n        from h2o.tree import H2OTree, H2ONode\n        arg_9 = H2OTree(arg_7, 0, \"0\")\n        len(arg_9)\n        arg_9.left_children\n        arg_9.right_children\n        arg_9.root_node.show()\n\n        arg_3()\n        # Show default performance metrics\n        arg_10 = arg_7.model_performance(arg_6)\n        arg_10.show()\n\n    # Execute:\n    _run_demo(demo_body, arg_0, arg_1, arg_2)", "path": "h2o-py/h2o/demos.py", "identifier": "gbm", "docstring": "GBM model demo.", "docstring_tokens": ["GBM", "model", "demo", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 251909}
{"url": "https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/savemat.py#L170-L182", "sha": "6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1", "docstring_summary": "Write variable header", "language": "python", "parameters": "(fd, header)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "write", "(", "struct", ".", "pack", "(", "'b3xI'", ",", "etypes", "[", "'miUINT32'", "]", "[", "'n'", "]", ",", "8", ")", ")", "arg_0", ".", "write", "(", "struct", ".", "pack", "(", "'b3x4x'", ",", "mclasses", "[", "arg_1", "[", "'mclass'", "]", "]", ")", ")", "write_elements", "(", "arg_0", ",", "'miINT32'", ",", "arg_1", "[", "'dims'", "]", ")", "write_elements", "(", "arg_0", ",", "'miINT8'", ",", "asbytes", "(", "arg_1", "[", "'name'", "]", ")", ",", "is_name", "=", "True", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Write variable header\"\"\"\n\n    # write tag bytes,\n    # and array flags + class and nzmax (null bytes)\n    arg_0.write(struct.pack('b3xI', etypes['miUINT32']['n'], 8))\n    arg_0.write(struct.pack('b3x4x', mclasses[arg_1['mclass']]))\n\n    # write dimensions array\n    write_elements(arg_0, 'miINT32', arg_1['dims'])\n\n    # write var name\n    write_elements(arg_0, 'miINT8', asbytes(arg_1['name']), is_name=True)", "path": "mat4py/savemat.py", "identifier": "write_var_header", "docstring": "Write variable header", "docstring_tokens": ["Write", "variable", "header"], "nwo": "nephics/mat4py", "score": 0.3187018950262521, "idx": 251910}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L411-L435", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Context manager to execute a code block in a directory.", "language": "python", "parameters": "(directory, create=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "os", ".", "getcwd", "(", ")", "try", ":", "try", ":", "os", ".", "chdir", "(", "arg_0", ")", "logger", ".", "debug", "(", "\"Working in {directory!r}...\"", ".", "format", "(", "**", "vars", "(", ")", ")", ")", "except", "OSError", "as", "err", ":", "if", "arg_1", "and", "err", ".", "errno", "==", "errno", ".", "ENOENT", ":", "os", ".", "makedirs", "(", "arg_0", ")", "os", ".", "chdir", "(", "arg_0", ")", "logger", ".", "info", "(", "\"Working in {directory!r} (newly created)...\"", ".", "format", "(", "**", "vars", "(", ")", ")", ")", "else", ":", "logger", ".", "exception", "(", "\"Failed to start working in {directory!r}.\"", ".", "format", "(", "**", "vars", "(", ")", ")", ")", "raise", "yield", "os", ".", "getcwd", "(", ")", "finally", ":", "os", ".", "chdir", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Context manager to execute a code block in a directory.\n\n    * The directory is created if it does not exist (unless\n      create=False is set)\n    * At the end or after an exception code always returns to\n      the directory that was the current directory before entering\n      the block.\n    \"\"\"\n    arg_2 = os.getcwd()\n    try:\n        try:\n            os.chdir(arg_0)\n            logger.debug(\"Working in {directory!r}...\".format(**vars()))\n        except OSError as err:\n            if arg_1 and err.errno == errno.ENOENT:\n                os.makedirs(arg_0)\n                os.chdir(arg_0)\n                logger.info(\"Working in {directory!r} (newly created)...\".format(**vars()))\n            else:\n                logger.exception(\"Failed to start working in {directory!r}.\".format(**vars()))\n                raise\n        yield os.getcwd()\n    finally:\n        os.chdir(arg_2)", "path": "gromacs/utilities.py", "identifier": "in_dir", "docstring": "Context manager to execute a code block in a directory.\n\n    * The directory is created if it does not exist (unless\n      create=False is set)\n    * At the end or after an exception code always returns to\n      the directory that was the current directory before entering\n      the block.", "docstring_tokens": ["Context", "manager", "to", "execute", "a", "code", "block", "in", "a", "directory", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 251911}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_config.py#L136-L147", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Updates the profile's config entry with values set in each attr by the\n    user.  This will overwrite existing values.", "language": "python", "parameters": "(msg, cfg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", "in", "arg_1", ".", "data", "[", "arg_0", ".", "profile", "]", "and", "arg_2", "is", "not", "\"auth\"", ":", "arg_1", ".", "data", "[", "arg_0", ".", "profile", "]", "[", "arg_2", "]", "=", "getattr", "(", "arg_0", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Updates the profile's config entry with values set in each attr by the\n    user.  This will overwrite existing values.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.\n    \"\"\"\n    for arg_2 in arg_0:\n        if arg_2 in arg_1.data[arg_0.profile] and arg_2 is not \"auth\":\n            arg_1.data[arg_0.profile][arg_2] = getattr(arg_0, arg_2)", "path": "messages/_config.py", "identifier": "update_config_data", "docstring": "Updates the profile's config entry with values set in each attr by the\n    user.  This will overwrite existing values.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.", "docstring_tokens": ["Updates", "the", "profile", "s", "config", "entry", "with", "values", "set", "in", "each", "attr", "by", "the", "user", ".", "This", "will", "overwrite", "existing", "values", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 251912}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/core.py#L444-L453", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Add a client authenticator class to `CLIENT_MECHANISMS_D`,\n    `CLIENT_MECHANISMS` and, optionally, to `SECURE_CLIENT_MECHANISMS`", "language": "python", "parameters": "(klass, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "[", "arg_1", "]", "=", "arg_0", "arg_3", "=", "sorted", "(", "arg_2", ".", "items", "(", ")", ",", "key", "=", "_key_func", ",", "reverse", "=", "True", ")", "arg_4", "[", ":", "]", "=", "[", "k", "for", "(", "k", ",", "v", ")", "in", "arg_3", "]", "arg_5", "[", ":", "]", "=", "[", "k", "for", "(", "k", ",", "v", ")", "in", "arg_3", "if", "v", ".", "_pyxmpp_sasl_secure", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Add a client authenticator class to `CLIENT_MECHANISMS_D`,\n    `CLIENT_MECHANISMS` and, optionally, to `SECURE_CLIENT_MECHANISMS`\n    \"\"\"\n    # pylint: disable-msg=W0212\n    arg_2[arg_1] = arg_0\n    arg_3 = sorted(arg_2.items(), key = _key_func, reverse = True)\n    arg_4[:] = [k for (k, v) in arg_3 ]\n    arg_5[:] = [k for (k, v) in arg_3\n                                                    if v._pyxmpp_sasl_secure]", "path": "pyxmpp2/sasl/core.py", "identifier": "_register_client_authenticator", "docstring": "Add a client authenticator class to `CLIENT_MECHANISMS_D`,\n    `CLIENT_MECHANISMS` and, optionally, to `SECURE_CLIENT_MECHANISMS`", "docstring_tokens": ["Add", "a", "client", "authenticator", "class", "to", "CLIENT_MECHANISMS_D", "CLIENT_MECHANISMS", "and", "optionally", "to", "SECURE_CLIENT_MECHANISMS"], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 251913}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L145-L150", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "check if dependency program is there", "language": "python", "parameters": "(cmd)", "return_statement": "return _subprocess.call(\"type \" + cmd,\n                           shell=True,\n                           stdout=_subprocess.PIPE,\n                           stderr=_subprocess.PIPE) == 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "_subprocess", ".", "call", "(", "\"type \"", "+", "arg_0", ",", "shell", "=", "True", ",", "stdout", "=", "_subprocess", ".", "PIPE", ",", "stderr", "=", "_subprocess", ".", "PIPE", ")", "==", "0"], "function": "def Func(arg_0):\n    \"\"\" check if dependency program is there \"\"\"\n    return _subprocess.call(\"type \" + arg_0,\n                           shell=True,\n                           stdout=_subprocess.PIPE,\n                           stderr=_subprocess.PIPE) == 0", "path": "ipyrad/__init__.py", "identifier": "_cmd_exists", "docstring": "check if dependency program is there", "docstring_tokens": ["check", "if", "dependency", "program", "is", "there"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 251914}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L564-L569", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Place the next queen at the given row.", "language": "python", "parameters": "(self, state, row)", "return_statement": "return new", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "index", "(", "None", ")", "arg_4", "=", "arg_1", "[", ":", "]", "arg_4", "[", "arg_3", "]", "=", "arg_2", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"Place the next queen at the given row.\"\n        arg_3 = arg_1.index(None)\n        arg_4 = arg_1[:]\n        arg_4[arg_3] = arg_2\n        return arg_4", "path": "aima/search.py", "identifier": "NQueensProblem.result", "docstring": "Place the next queen at the given row.", "docstring_tokens": ["Place", "the", "next", "queen", "at", "the", "given", "row", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 251915}
{"url": "https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L176-L185", "sha": "3fa08bf56def990b3513d25e403f85357487b373", "docstring_summary": "Intercept downstream `websocket.accept` message and thus allow this upsteam application to accept websocket\n        frames.", "language": "python", "parameters": "(self, message, stream_name)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "not", "arg_0", ".", "applications_accepting_frames", "arg_0", ".", "applications_accepting_frames", ".", "add", "(", "arg_2", ")", "if", "arg_3", ":", "await", "arg_0", ".", "accept", "(", ")"], "function": "async def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Intercept downstream `websocket.accept` message and thus allow this upsteam application to accept websocket\n        frames.\n        \"\"\"\n        arg_3 = not arg_0.applications_accepting_frames\n        arg_0.applications_accepting_frames.add(arg_2)\n        # accept the connection after the first upstream application accepts.\n        if arg_3:\n            await arg_0.accept()", "path": "channelsmultiplexer/demultiplexer.py", "identifier": "AsyncJsonWebsocketDemultiplexer.websocket_accept", "docstring": "Intercept downstream `websocket.accept` message and thus allow this upsteam application to accept websocket\n        frames.", "docstring_tokens": ["Intercept", "downstream", "websocket", ".", "accept", "message", "and", "thus", "allow", "this", "upsteam", "application", "to", "accept", "websocket", "frames", "."], "nwo": "hishnash/channelsmultiplexer", "score": 0.40965706691753795, "idx": 251916}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/job_model.py#L116-L123", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Validate that the name is a valid GCS bucket.", "language": "python", "parameters": "(bucket)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "startswith", "(", "'gs://'", ")", ":", "raise", "ValueError", "(", "'Invalid bucket path \"%s\". Must start with \"gs://\".'", "%", "arg_0", ")", "arg_1", "=", "arg_0", "[", "len", "(", "'gs://'", ")", ":", "]", "if", "not", "re", ".", "search", "(", "r'^\\w[\\w_\\.-]{1,61}\\w$'", ",", "arg_1", ")", ":", "raise", "ValueError", "(", "'Invalid bucket name: %s'", "%", "arg_0", ")"], "function": "def Func(arg_0):\n  \"\"\"Validate that the name is a valid GCS bucket.\"\"\"\n  if not arg_0.startswith('gs://'):\n    raise ValueError(\n        'Invalid bucket path \"%s\". Must start with \"gs://\".' % arg_0)\n  arg_1 = arg_0[len('gs://'):]\n  if not re.search(r'^\\w[\\w_\\.-]{1,61}\\w$', arg_1):\n    raise ValueError('Invalid bucket name: %s' % arg_0)", "path": "dsub/lib/job_model.py", "identifier": "validate_bucket_name", "docstring": "Validate that the name is a valid GCS bucket.", "docstring_tokens": ["Validate", "that", "the", "name", "is", "a", "valid", "GCS", "bucket", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 251917}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/inversion/mappers.py#L110-L121", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Compute the mappings between a pixelization's pixels and the unmasked sub-grid pixels. These mappings \\\n        are determined after the regular-grid is used to determine the pixelization.", "language": "python", "parameters": "(self)", "return_statement": "return pix_to_sub", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "[", "[", "]", "for", "_", "in", "range", "(", "arg_0", ".", "pixels", ")", "]", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_0", ".", "sub_to_pix", ")", ":", "Func", "[", "arg_3", "]", ".", "append", "(", "arg_2", ")", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"Compute the mappings between a pixelization's pixels and the unmasked sub-grid pixels. These mappings \\\n        are determined after the regular-grid is used to determine the pixelization.\n\n        The pixelization's pixels map to different number of sub-grid pixels, thus a list of lists is used to \\\n        represent these mappings\"\"\"\n        Func = [[] for _ in range(arg_0.pixels)]\n\n        for arg_2, arg_3 in enumerate(arg_0.sub_to_pix):\n            Func[arg_3].append(arg_2)\n\n        return Func", "path": "autolens/model/inversion/mappers.py", "identifier": "Mapper.pix_to_sub", "docstring": "Compute the mappings between a pixelization's pixels and the unmasked sub-grid pixels. These mappings \\\n        are determined after the regular-grid is used to determine the pixelization.\n\n        The pixelization's pixels map to different number of sub-grid pixels, thus a list of lists is used to \\\n        represent these mappings", "docstring_tokens": ["Compute", "the", "mappings", "between", "a", "pixelization", "s", "pixels", "and", "the", "unmasked", "sub", "-", "grid", "pixels", ".", "These", "mappings", "\\", "are", "determined", "after", "the", "regular", "-", "grid", "is", "used", "to", "determine", "the", "pixelization", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 251918}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L510-L583", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Creates a plane with a specified number of vertices\n    on it sides, but no vertices on the interior.", "language": "python", "parameters": "(script, size=1.0, x_segments=1, y_segments=1,\n                      center=False, color=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1.0", ",", "arg_2", "=", "1", ",", "arg_3", "=", "1", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "arg_1", "=", "util", ".", "make_list", "(", "arg_1", ",", "2", ")", "grid", "(", "arg_0", ",", "arg_1", "=", "[", "arg_2", "+", "arg_3", "-", "1", ",", "1", "]", ",", "arg_2", "=", "(", "arg_2", "+", "arg_3", "-", "1", ")", ",", "arg_3", "=", "1", ")", "if", "ml_script1", ".", "ml_version", "==", "'1.3.4BETA'", ":", "arg_6", "=", "'and'", "else", ":", "arg_6", "=", "'&&'", "if", "arg_0", ".", "ml_version", "==", "'1.3.4BETA'", ":", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'if((y>0) and (x<%s),0,x)'", "%", "(", "arg_3", ")", ",", "y_func", "=", "'if((y>0) and (x<%s),(x+1)*%s,y)'", "%", "(", "arg_3", ",", "arg_1", "[", "1", "]", "/", "arg_3", ")", ")", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'if((y>0) and (x>=%s),(x-%s+1)*%s,x)'", "%", "(", "arg_3", ",", "arg_3", ",", "arg_1", "[", "0", "]", "/", "arg_2", ")", ",", "y_func", "=", "'if((y>0) and (x>=%s),%s,y)'", "%", "(", "arg_3", ",", "arg_1", "[", "1", "]", ")", ")", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'if((y<.00001) and (x>%s),%s,x)'", "%", "(", "arg_2", ",", "arg_1", "[", "0", "]", ")", ",", "y_func", "=", "'if((y<.00001) and (x>%s),(x-%s)*%s,y)'", "%", "(", "arg_2", ",", "arg_2", ",", "arg_1", "[", "1", "]", "/", "arg_3", ")", ")", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'if((y<.00001) and (x<=%s) and (x>0),(x)*%s,x)'", "%", "(", "arg_2", ",", "arg_1", "[", "0", "]", "/", "arg_2", ")", ",", "y_func", "=", "'if((y<.00001) and (x<=%s) and (x>0),0,y)'", "%", "(", "arg_2", ")", ")", "else", ":", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'((y>0) && (x<{yseg}) ? 0 : x)'", ".", "format", "(", "yseg", "=", "arg_3", ")", ",", "y_func", "=", "'((y>0) && (x<%s) ? (x+1)*%s : y)'", "%", "(", "arg_3", ",", "arg_1", "[", "1", "]", "/", "arg_3", ")", ")", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'((y>0) && (x>=%s) ? (x-%s+1)*%s : x)'", "%", "(", "arg_3", ",", "arg_3", ",", "arg_1", "[", "0", "]", "/", "arg_2", ")", ",", "y_func", "=", "'((y>0) && (x>=%s) ? %s : y)'", "%", "(", "arg_3", ",", "arg_1", "[", "1", "]", ")", ")", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'((y<.00001) && (x>%s) ? %s : x)'", "%", "(", "arg_2", ",", "arg_1", "[", "0", "]", ")", ",", "y_func", "=", "'((y<.00001) && (x>%s) ? (x-%s)*%s : y)'", "%", "(", "arg_2", ",", "arg_2", ",", "arg_1", "[", "1", "]", "/", "arg_3", ")", ")", "transform", ".", "vert_function", "(", "arg_0", ",", "x_func", "=", "'((y<.00001) && (x<=%s) && (x>0) ? (x)*%s : x)'", "%", "(", "arg_2", ",", "arg_1", "[", "0", "]", "/", "arg_2", ")", ",", "y_func", "=", "'((y<.00001) && (x<=%s) && (x>0) ? 0 : y)'", "%", "(", "arg_2", ")", ")", "if", "arg_4", ":", "transform", ".", "translate", "(", "arg_0", ",", "[", "-", "arg_1", "[", "0", "]", "/", "2", ",", "-", "arg_1", "[", "1", "]", "/", "2", "]", ")", "if", "arg_5", "is", "not", "None", ":", "vert_color", ".", "function", "(", "arg_0", ",", "arg_5", "=", "arg_5", ")", "return", "None"], "function": "def Func(arg_0, arg_1=1.0, arg_2=1, arg_3=1,\n                      arg_4=False, arg_5=None):\n    \"\"\" Creates a plane with a specified number of vertices\n    on it sides, but no vertices on the interior.\n\n    Currently used to create a simpler bottom for cube_hires.\n\n    \"\"\"\n    arg_1 = util.make_list(arg_1, 2)\n\n    grid(arg_0, arg_1=[arg_2 + arg_3 - 1, 1],\n         arg_2=(arg_2 + arg_3 - 1), arg_3=1)\n    if ml_script1.ml_version == '1.3.4BETA':\n        arg_6 = 'and'\n    else:\n        arg_6 = '&&'\n\n    if arg_0.ml_version == '1.3.4BETA': # muparser version: 1.3.2\n        # Deform left side\n        transform.vert_function(\n            arg_0,\n            x_func='if((y>0) and (x<%s),0,x)' % (arg_3),\n            y_func='if((y>0) and (x<%s),(x+1)*%s,y)' % (\n                arg_3, arg_1[1] / arg_3))\n        # Deform top\n        transform.vert_function(\n            arg_0,\n            x_func='if((y>0) and (x>=%s),(x-%s+1)*%s,x)' % (\n                arg_3, arg_3, arg_1[0] / arg_2),\n            y_func='if((y>0) and (x>=%s),%s,y)' % (arg_3, arg_1[1]))\n        # Deform right side\n        transform.vert_function(\n            arg_0,\n            x_func='if((y<.00001) and (x>%s),%s,x)' % (\n                arg_2, arg_1[0]),\n            y_func='if((y<.00001) and (x>%s),(x-%s)*%s,y)' % (\n                arg_2, arg_2, arg_1[1] / arg_3))\n        # Deform bottom\n        transform.vert_function(\n            arg_0,\n            x_func='if((y<.00001) and (x<=%s) and (x>0),(x)*%s,x)' % (\n                arg_2, arg_1[0] / arg_2),\n            y_func='if((y<.00001) and (x<=%s) and (x>0),0,y)' % (arg_2))\n    else: # muparser version: 2.2.5\n        # Deform left side\n        transform.vert_function(\n            arg_0,\n            x_func='((y>0) && (x<{yseg}) ? 0 : x)'.format(yseg=arg_3),\n            y_func='((y>0) && (x<%s) ? (x+1)*%s : y)' % (\n                arg_3, arg_1[1] / arg_3))\n        # Deform top\n        transform.vert_function(\n            arg_0,\n            x_func='((y>0) && (x>=%s) ? (x-%s+1)*%s : x)' % (\n                arg_3, arg_3, arg_1[0] / arg_2),\n            y_func='((y>0) && (x>=%s) ? %s : y)' % (arg_3, arg_1[1]))\n        # Deform right side\n        transform.vert_function(\n            arg_0,\n            x_func='((y<.00001) && (x>%s) ? %s : x)' % (\n                arg_2, arg_1[0]),\n            y_func='((y<.00001) && (x>%s) ? (x-%s)*%s : y)' % (\n                arg_2, arg_2, arg_1[1] / arg_3))\n        # Deform bottom\n        transform.vert_function(\n            arg_0,\n            x_func='((y<.00001) && (x<=%s) && (x>0) ? (x)*%s : x)' % (\n                arg_2, arg_1[0] / arg_2),\n            y_func='((y<.00001) && (x<=%s) && (x>0) ? 0 : y)' % (arg_2))\n    if arg_4:\n        transform.translate(arg_0, [-arg_1[0] / 2, -arg_1[1] / 2])\n    if arg_5 is not None:\n        vert_color.function(arg_0, arg_5=arg_5)\n    return None", "path": "meshlabxml/create.py", "identifier": "plane_hires_edges", "docstring": "Creates a plane with a specified number of vertices\n    on it sides, but no vertices on the interior.\n\n    Currently used to create a simpler bottom for cube_hires.", "docstring_tokens": ["Creates", "a", "plane", "with", "a", "specified", "number", "of", "vertices", "on", "it", "sides", "but", "no", "vertices", "on", "the", "interior", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 251919}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/connection.py#L278-L312", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Given a ChangeSet, POST it to the Route53 API.", "language": "python", "parameters": "(self, change_set, comment=None)", "return_statement": "return parse_change_info(e_change_info)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "xml_generators", ".", "change_resource_record_set_writer", "(", "connection", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_send_request", "(", "path", "=", "'hostedzone/%s/rrset'", "%", "arg_1", ".", "hosted_zone_id", ",", "data", "=", "arg_3", ",", "method", "=", "'POST'", ",", ")", "arg_5", "=", "arg_4", ".", "find", "(", "'./{*}ChangeInfo'", ")", "if", "arg_5", "is", "None", ":", "arg_6", "=", "arg_4", ".", "find", "(", "'./{*}Error'", ")", ".", "find", "(", "'./{*}Message'", ")", ".", "text", "raise", "Route53Error", "(", "arg_6", ")", "return", "parse_change_info", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Given a ChangeSet, POST it to the Route53 API.\n\n        .. note:: You probably shouldn't be using this method directly,\n            as there are convenience methods on the ResourceRecordSet\n            sub-classes.\n\n        :param change_set.ChangeSet change_set: The ChangeSet object to create\n            the XML doc from.\n        :keyword str comment: An optional comment to go along with the request.\n        :rtype: dict\n        :returns: A dict of change info, which contains some details about\n            the request.\n        \"\"\"\n\n        arg_3 = xml_generators.change_resource_record_set_writer(\n            connection=arg_0,\n            arg_1=arg_1,\n            arg_2=arg_2\n        )\n\n        arg_4 = arg_0._send_request(\n            path='hostedzone/%s/rrset' % arg_1.hosted_zone_id,\n            data=arg_3,\n            method='POST',\n        )\n\n        #print(prettyprint_xml(root))\n\n        arg_5 = arg_4.find('./{*}ChangeInfo')\n        if arg_5 is None:\n            arg_6 = arg_4.find('./{*}Error').find('./{*}Message').text\n            raise Route53Error(arg_6)\n        return parse_change_info(arg_5)", "path": "route53/connection.py", "identifier": "Route53Connection._change_resource_record_sets", "docstring": "Given a ChangeSet, POST it to the Route53 API.\n\n        .. note:: You probably shouldn't be using this method directly,\n            as there are convenience methods on the ResourceRecordSet\n            sub-classes.\n\n        :param change_set.ChangeSet change_set: The ChangeSet object to create\n            the XML doc from.\n        :keyword str comment: An optional comment to go along with the request.\n        :rtype: dict\n        :returns: A dict of change info, which contains some details about\n            the request.", "docstring_tokens": ["Given", "a", "ChangeSet", "POST", "it", "to", "the", "Route53", "API", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 251920}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L625-L665", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Return the first element of a binned `expression`, where the values each bin are sorted by `order_expression`.", "language": "python", "parameters": "(self, expression, order_expression, binby=[], limits=None, shape=default_shape, selection=False, delay=False, edges=False, progress=None)", "return_statement": "return self._delay(delay, var)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "[", "]", ",", "arg_4", "=", "None", ",", "arg_5", "=", "arg_6", ",", "arg_7", "=", "False", ",", "arg_8", "=", "False", ",", "arg_9", "=", "False", ",", "arg_10", "=", "None", ")", ":", "return", "arg_0", ".", "_compute_agg", "(", "'Func'", ",", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "extra_expressions", "=", "[", "arg_2", "]", ")", "logger", ".", "debug", "(", "\"count(%r, binby=%r, limits=%r)\"", ",", "arg_1", ",", "arg_3", ",", "arg_4", ")", "logger", ".", "debug", "(", "\"count(%r, binby=%r, limits=%r)\"", ",", "arg_1", ",", "arg_3", ",", "arg_4", ")", "arg_1", "=", "_ensure_strings_from_expressions", "(", "arg_1", ")", "arg_2", "=", "_ensure_string_from_expression", "(", "arg_2", ")", "arg_3", "=", "_ensure_strings_from_expressions", "(", "arg_3", ")", "arg_11", ",", "[", "arg_12", ",", "]", "=", "vaex", ".", "utils", ".", "listify", "(", "arg_1", ")", "@", "delayed", "def", "finish", "(", "*", "arg_13", ")", ":", "arg_13", "=", "np", ".", "asarray", "(", "arg_13", ")", "return", "vaex", ".", "utils", ".", "unlistify", "(", "arg_11", ",", "arg_13", ")", "arg_14", "=", "vaex", ".", "utils", ".", "progressbars", "(", "arg_10", ")", "arg_4", "=", "arg_0", ".", "limits", "(", "arg_3", ",", "arg_4", ",", "arg_8", "=", "True", ",", "arg_5", "=", "arg_5", ")", "arg_15", "=", "[", "arg_0", ".", "_Func_calculation", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", "arg_9", "=", "arg_9", ",", "arg_14", "=", "arg_14", ")", "for", "arg_1", "in", "arg_12", "]", "arg_16", "=", "finish", "(", "*", "arg_15", ")", "return", "arg_0", ".", "_delay", "(", "arg_8", ",", "arg_16", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=[], arg_4=None, arg_5=arg_6, arg_7=False, arg_8=False, arg_9=False, arg_10=None):\n        \"\"\"Return the Func element of a binned `expression`, where the values each bin are sorted by `order_expression`.\n\n        Example:\n\n        >>> import vaex\n        >>> df = vaex.example()\n        >>> df.Func(df.x, df.y, shape=8)\n        >>> df.Func(df.x, df.y, shape=8, binby=[df.y])\n        >>> df.Func(df.x, df.y, shape=8, binby=[df.y])\n        array([-4.81883764, 11.65378   ,  9.70084476, -7.3025589 ,  4.84954977,\n                8.47446537, -5.73602629, 10.18783   ])\n\n        :param expression: The value to be placed in the bin.\n        :param order_expression: Order the values in the bins by this expression.\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :param edges: {edges}\n        :return: Ndarray containing the Func elements.\n        :rtype: numpy.array\n        \"\"\"\n        return arg_0._compute_agg('Func', arg_1, arg_3, arg_4, arg_5, arg_7, arg_8, arg_9, arg_10, extra_expressions=[arg_2])\n        logger.debug(\"count(%r, binby=%r, limits=%r)\", arg_1, arg_3, arg_4)\n        logger.debug(\"count(%r, binby=%r, limits=%r)\", arg_1, arg_3, arg_4)\n        arg_1 = _ensure_strings_from_expressions(arg_1)\n        arg_2 = _ensure_string_from_expression(arg_2)\n        arg_3 = _ensure_strings_from_expressions(arg_3)\n        arg_11, [arg_12,] = vaex.utils.listify(arg_1)\n        @delayed\n        def finish(*arg_13):\n            arg_13 = np.asarray(arg_13)\n            return vaex.utils.unlistify(arg_11, arg_13)\n        arg_14 = vaex.utils.progressbars(arg_10)\n        arg_4 = arg_0.limits(arg_3, arg_4, arg_8=True, arg_5=arg_5)\n        arg_15 = [arg_0._Func_calculation(arg_1, arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_7=arg_7, arg_9=arg_9, arg_14=arg_14) for arg_1 in arg_12]\n        arg_16 = finish(*arg_15)\n        return arg_0._delay(arg_8, arg_16)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.first", "docstring": "Return the first element of a binned `expression`, where the values each bin are sorted by `order_expression`.\n\n        Example:\n\n        >>> import vaex\n        >>> df = vaex.example()\n        >>> df.first(df.x, df.y, shape=8)\n        >>> df.first(df.x, df.y, shape=8, binby=[df.y])\n        >>> df.first(df.x, df.y, shape=8, binby=[df.y])\n        array([-4.81883764, 11.65378   ,  9.70084476, -7.3025589 ,  4.84954977,\n                8.47446537, -5.73602629, 10.18783   ])\n\n        :param expression: The value to be placed in the bin.\n        :param order_expression: Order the values in the bins by this expression.\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :param edges: {edges}\n        :return: Ndarray containing the first elements.\n        :rtype: numpy.array", "docstring_tokens": ["Return", "the", "first", "element", "of", "a", "binned", "expression", "where", "the", "values", "each", "bin", "are", "sorted", "by", "order_expression", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 251921}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1823-L1843", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Makes a striplog of all unions.", "language": "python", "parameters": "(self, other)", "return_statement": "return Striplog(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "arg_0", ".", "__class__", ")", ":", "arg_2", "=", "\"You can only Func striplogs with each other.\"", "raise", "StriplogError", "(", "arg_2", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "deepcopy", "(", "arg_0", ")", ":", "for", "arg_5", "in", "arg_1", ":", "if", "arg_4", ".", "any_overlaps", "(", "arg_5", ")", ":", "arg_4", "=", "arg_4", ".", "Func", "(", "arg_5", ")", "arg_3", ".", "append", "(", "arg_4", ")", "return", "Striplog", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Makes a striplog of all Funcs.\n\n        Args:\n            Striplog. The striplog instance to Func with.\n\n        Returns:\n            Striplog. The result of the Func.\n        \"\"\"\n        if not isinstance(arg_1, arg_0.__class__):\n            arg_2 = \"You can only Func striplogs with each other.\"\n            raise StriplogError(arg_2)\n\n        arg_3 = []\n        for arg_4 in deepcopy(arg_0):\n            for arg_5 in arg_1:\n                if arg_4.any_overlaps(arg_5):\n                    arg_4 = arg_4.Func(arg_5)\n            arg_3.append(arg_4)\n        return Striplog(arg_3)", "path": "striplog/striplog.py", "identifier": "Striplog.union", "docstring": "Makes a striplog of all unions.\n\n        Args:\n            Striplog. The striplog instance to union with.\n\n        Returns:\n            Striplog. The result of the union.", "docstring_tokens": ["Makes", "a", "striplog", "of", "all", "unions", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 251922}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/wheel.py#L31-L34", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Helper for wheel_color that distributes colors over length and\n    allows shifting position.", "language": "python", "parameters": "(pos, length, cycle_step)", "return_statement": "return wheel_color((pos * len(_WHEEL) / length) + cycle_step)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "wheel_color", "(", "(", "arg_0", "*", "len", "(", "_WHEEL", ")", "/", "arg_1", ")", "+", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Helper for wheel_color that distributes colors over length and\n    allows shifting position.\"\"\"\n    return wheel_color((arg_0 * len(_WHEEL) / arg_1) + arg_2)", "path": "bibliopixel/colors/wheel.py", "identifier": "wheel_helper", "docstring": "Helper for wheel_color that distributes colors over length and\n    allows shifting position.", "docstring_tokens": ["Helper", "for", "wheel_color", "that", "distributes", "colors", "over", "length", "and", "allows", "shifting", "position", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 251923}
{"url": "https://github.com/DistilledLtd/heimdall/blob/7568c915a2e5bce759750d5456b39ea3498a6683/heimdall/heimdall.py#L91-L96", "sha": "7568c915a2e5bce759750d5456b39ea3498a6683", "docstring_summary": "Create a nice image name from the url.", "language": "python", "parameters": "(url)", "return_statement": "return re.sub(find, replace, url).strip('_')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "r'https?://|[^\\w]'", "arg_2", "=", "'_'", "return", "re", ".", "sub", "(", "arg_1", ",", "arg_2", ",", "arg_0", ")", ".", "strip", "(", "'_'", ")"], "function": "def Func(arg_0):\n    \"\"\" Create a nice image name from the url. \"\"\"\n\n    arg_1 = r'https?://|[^\\w]'\n    arg_2 = '_'\n    return re.sub(arg_1, arg_2, arg_0).strip('_')", "path": "heimdall/heimdall.py", "identifier": "_image_name_from_url", "docstring": "Create a nice image name from the url.", "docstring_tokens": ["Create", "a", "nice", "image", "name", "from", "the", "url", "."], "nwo": "DistilledLtd/heimdall", "score": 0.5751496997690835, "idx": 251924}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/ports.py#L578-L597", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Return the number of ports.", "language": "python", "parameters": "(context, filters=None)", "return_statement": "return db_api.port_count_all(context, join_security_groups=True, **filters)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Func for tenant %s filters %s\"", "%", "(", "arg_0", ".", "tenant_id", ",", "arg_1", ")", ")", "return", "db_api", ".", "port_count_all", "(", "arg_0", ",", "join_security_groups", "=", "True", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Return the number of ports.\n\n    The result depends on the identity of the user making the request\n    (as indicated by the context) as well as any filters.\n    : param context: neutron api request context\n    : param filters: a dictionary with keys that are valid keys for\n        a port as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictionary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n\n    NOTE: this method is optional, as it was not part of the originally\n          defined plugin API.\n    \"\"\"\n    LOG.info(\"Func for tenant %s filters %s\" %\n             (arg_0.tenant_id, arg_1))\n    return db_api.port_count_all(arg_0, join_security_groups=True, **arg_1)", "path": "quark/plugin_modules/ports.py", "identifier": "get_ports_count", "docstring": "Return the number of ports.\n\n    The result depends on the identity of the user making the request\n    (as indicated by the context) as well as any filters.\n    : param context: neutron api request context\n    : param filters: a dictionary with keys that are valid keys for\n        a port as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictionary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n\n    NOTE: this method is optional, as it was not part of the originally\n          defined plugin API.", "docstring_tokens": ["Return", "the", "number", "of", "ports", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 251925}
{"url": "https://github.com/kylebebak/questionnaire/blob/ed92642e8a2a0198da198acbcde2707f1d528585/questionnaire/__init__.py#L241-L261", "sha": "ed92642e8a2a0198da198acbcde2707f1d528585", "docstring_summary": "Formats answers depending on `fmt`.", "language": "python", "parameters": "(self, fmt='obj')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'obj'", ")", ":", "arg_2", "=", "(", "'obj'", ",", "'array'", ",", "'plain'", ")", "if", "arg_1", "not", "in", "arg_2", ":", "eprint", "(", "\"Error: '{}' not in {}\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "return", "def", "stringify", "(", "arg_3", ")", ":", "if", "type", "(", "arg_3", ")", "in", "(", "list", ",", "tuple", ")", ":", "return", "', '", ".", "join", "(", "str", "(", "arg_4", ")", "for", "arg_4", "in", "arg_3", ")", "return", "arg_3", "if", "arg_1", "==", "'obj'", ":", "return", "json", ".", "dumps", "(", "arg_0", ".", "answers", ")", "elif", "arg_1", "==", "'array'", ":", "arg_5", "=", "[", "[", "k", ",", "v", "]", "for", "k", ",", "v", "in", "arg_0", ".", "answers", ".", "items", "(", ")", "]", "return", "json", ".", "dumps", "(", "arg_5", ")", "elif", "arg_1", "==", "'plain'", ":", "arg_5", "=", "'\\n'", ".", "join", "(", "'{}: {}'", ".", "format", "(", "k", ",", "stringify", "(", "v", ")", ")", "for", "k", ",", "v", "in", "arg_0", ".", "answers", ".", "items", "(", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1='obj'):\n        \"\"\"Formats answers depending on `fmt`.\n        \"\"\"\n        arg_2 = ('obj', 'array', 'plain')\n        if arg_1 not in arg_2:\n            eprint(\"Error: '{}' not in {}\".format(arg_1, arg_2))\n            return\n\n        def stringify(arg_3):\n            if type(arg_3) in (list, tuple):\n                return ', '.join(str(arg_4) for arg_4 in arg_3)\n            return arg_3\n\n        if arg_1 == 'obj':\n            return json.dumps(arg_0.answers)\n        elif arg_1 == 'array':\n            arg_5 = [[k, v] for k, v in arg_0.answers.items()]\n            return json.dumps(arg_5)\n        elif arg_1 == 'plain':\n            arg_5 = '\\n'.join('{}: {}'.format(k, stringify(v)) for k, v in arg_0.answers.items())\n            return arg_5", "path": "questionnaire/__init__.py", "identifier": "Questionnaire.format_answers", "docstring": "Formats answers depending on `fmt`.", "docstring_tokens": ["Formats", "answers", "depending", "on", "fmt", "."], "nwo": "kylebebak/questionnaire", "score": 0.4695341856938158, "idx": 251926}
{"url": "https://github.com/Jaza/s3-saver/blob/81dc4447d76c2fc0b0238fb96fa70e879612e355/s3_saver.py#L59-L75", "sha": "81dc4447d76c2fc0b0238fb96fa70e879612e355", "docstring_summary": "Deletes the specified file from the given S3 bucket.", "language": "python", "parameters": "(self, filename, bucket_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "S3Connection", "(", "arg_0", ".", "access_key_id", ",", "arg_0", ".", "access_key_secret", ")", "arg_4", "=", "arg_3", ".", "get_bucket", "(", "arg_2", ")", "if", "type", "(", "arg_1", ")", ".", "__name__", "==", "'Key'", ":", "arg_1", "=", "'/'", "+", "arg_1", ".", "name", "arg_5", "=", "arg_0", ".", "_get_s3_path", "(", "arg_1", ")", "arg_6", "=", "Key", "(", "arg_4", ")", "arg_6", ".", "key", "=", "arg_5", "try", ":", "arg_4", ".", "delete_key", "(", "arg_6", ")", "except", "S3ResponseError", ":", "pass"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Deletes the specified file from the given S3 bucket.\"\"\"\n\n        arg_3 = S3Connection(arg_0.access_key_id, arg_0.access_key_secret)\n        arg_4 = arg_3.get_bucket(arg_2)\n\n        if type(arg_1).__name__ == 'Key':\n            arg_1 = '/' + arg_1.name\n\n        arg_5 = arg_0._get_s3_path(arg_1)\n        arg_6 = Key(arg_4)\n        arg_6.key = arg_5\n\n        try:\n            arg_4.delete_key(arg_6)\n        except S3ResponseError:\n            pass", "path": "s3_saver.py", "identifier": "S3Saver._delete_s3", "docstring": "Deletes the specified file from the given S3 bucket.", "docstring_tokens": ["Deletes", "the", "specified", "file", "from", "the", "given", "S3", "bucket", "."], "nwo": "Jaza/s3-saver", "score": 0.17697123869542528, "idx": 251927}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/experimental/fun_mcmc/fun_mcmc_lib.py#L361-L517", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Hamiltonian Monte Carlo `TransitionOperator`.", "language": "python", "parameters": "(\n    hmc_state: HamiltonianMonteCarloState,\n    target_log_prob_fn: PotentialFn,\n    step_size: Any,\n    num_leapfrog_steps: IntTensor,\n    momentum: State = None,\n    kinetic_energy_fn: PotentialFn = None,\n    momentum_sample_fn: MomentumSampleFn = None,\n    leapfrog_trace_fn: Callable[[LeapFrogStepState, LeapFrogStepExtras],\n                                TensorNest] = lambda *args: (),\n    seed=None,\n)", "return_statement": "return hmc_state, HamiltonianMonteCarloExtra(\n      is_accepted=is_accepted,\n      proposed_hmc_state=proposed_state,\n      log_accept_ratio=-energy_change,\n      leapfrog_trace=leapfrog_trace)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", ",", "arg_6", ":", "arg_7", ",", "arg_8", ":", "arg_9", "=", "None", ",", "arg_10", ":", "arg_3", "=", "None", ",", "arg_11", ":", "arg_12", "=", "None", ",", "arg_13", ":", "arg_14", "[", "[", "arg_15", ",", "arg_16", "]", ",", "arg_17", "]", "=", "lambda", "*", "arg_18", ":", "(", ")", ",", "arg_19", "=", "None", ",", ")", "->", "Tuple", "[", "arg_1", ",", "HamiltonianMonteCarloExtra", "]", ":", "arg_20", "=", "arg_0", ".", "state", "arg_21", "=", "arg_0", ".", "state_grads", "arg_22", "=", "arg_0", ".", "target_log_prob", "arg_23", "=", "arg_0", ".", "state_extra", "if", "arg_10", "is", "None", ":", "def", "arg_10", "(", "*", "arg_8", ")", ":", "return", "tf", ".", "add_n", "(", "[", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "tf", ".", "square", "(", "arg_24", ")", ",", "axis", "=", "-", "1", ")", "/", "2.", "for", "arg_24", "in", "tf", ".", "nest", ".", "flatten", "(", "arg_8", ")", "]", ")", ",", "(", ")", "if", "arg_11", "is", "None", ":", "def", "arg_11", "(", "*", "arg_8", ")", ":", "arg_25", "=", "tf", ".", "nest", ".", "map_structure", "(", "lambda", "arg_24", ":", "tf", ".", "random", ".", "normal", "(", "tf", ".", "shape", "(", "input", "=", "arg_24", ")", ",", "dtype", "=", "arg_24", ".", "dtype", ")", ",", "arg_8", ")", "if", "len", "(", "arg_25", ")", "==", "1", ":", "return", "arg_25", "[", "0", "]", "else", ":", "return", "arg_25", "if", "arg_8", "is", "None", ":", "arg_8", "=", "call_fn", "(", "arg_11", ",", "tf", ".", "nest", ".", "map_structure", "(", "tf", ".", "zeros_like", ",", "arg_20", ")", ")", "if", "arg_22", "is", "None", ":", "arg_22", ",", "arg_23", ",", "arg_21", "=", "call_and_grads", "(", "arg_2", ",", "arg_20", ")", "arg_26", ",", "arg_27", "=", "call_fn", "(", "arg_10", ",", "arg_8", ")", "arg_28", "=", "-", "arg_22", "+", "arg_26", "arg_29", "=", "arg_1", "(", "arg_20", "=", "arg_20", ",", "arg_21", "=", "arg_21", ",", "arg_23", "=", "arg_23", ",", "arg_22", "=", "arg_22", ")", "def", "leapfrog_wrapper", "(", "arg_30", ",", "arg_22", ",", "arg_23", ")", ":", "del", "arg_22", "del", "arg_23", "arg_30", ",", "arg_31", "=", "leapfrog_step", "(", "arg_30", ",", "arg_4", "=", "arg_4", ",", "arg_2", "=", "arg_2", ",", "arg_10", "=", "arg_10", ")", "return", "[", "arg_30", ",", "arg_31", ".", "target_log_prob", ",", "arg_31", ".", "state_extra", "]", ",", "arg_31", "def", "leapfrog_trace_wrapper_fn", "(", "arg_18", ",", "arg_31", ")", ":", "return", "arg_13", "(", "arg_18", "[", "0", "]", ",", "arg_31", ")", "arg_32", "=", "(", "arg_15", "(", "arg_20", ",", "arg_21", ",", "arg_8", ")", ",", "arg_22", ",", "arg_23", ")", "[", "[", "arg_30", ",", "arg_22", ",", "arg_23", "]", ",", "arg_27", "]", ",", "arg_33", "=", "trace", "(", "arg_32", ",", "leapfrog_wrapper", ",", "arg_6", ",", "trace_fn", "=", "leapfrog_trace_wrapper_fn", ")", "arg_26", ",", "arg_27", "=", "call_fn", "(", "arg_10", ",", "arg_30", ".", "momentum", ")", "arg_34", "=", "-", "arg_22", "+", "arg_26", "arg_35", "=", "arg_1", "(", "arg_20", "=", "arg_30", ".", "state", ",", "arg_21", "=", "arg_30", ".", "state_grads", ",", "arg_22", "=", "arg_22", ",", "arg_23", "=", "arg_23", ")", "arg_36", "=", "arg_34", "-", "arg_28", "arg_0", ",", "arg_37", ",", "arg_27", "=", "metropolis_hastings_step", "(", "arg_29", ",", "arg_35", ",", "arg_36", ",", "arg_19", "=", "arg_19", ")", "arg_0", "=", "arg_0", "return", "arg_0", ",", "HamiltonianMonteCarloExtra", "(", "arg_37", "=", "arg_37", ",", "proposed_hmc_state", "=", "arg_35", ",", "log_accept_ratio", "=", "-", "arg_36", ",", "arg_33", "=", "arg_33", ")"], "function": "def Func(\n    arg_0: arg_1,\n    arg_2: arg_3,\n    arg_4: arg_5,\n    arg_6: arg_7,\n    arg_8: arg_9 = None,\n    arg_10: arg_3 = None,\n    arg_11: arg_12 = None,\n    arg_13: arg_14[[arg_15, arg_16],\n                                arg_17] = lambda *arg_18: (),\n    arg_19=None,\n) -> Tuple[arg_1, HamiltonianMonteCarloExtra]:\n  \"\"\"Hamiltonian Monte Carlo `TransitionOperator`.\n\n  #### Example\n\n  ```python\n  step_size = 0.2\n  num_steps = 2000\n  num_leapfrog_steps = 10\n  state = tf.ones([16, 2])\n\n  base_mean = [1., 0]\n  base_cov = [[1, 0.5], [0.5, 1]]\n\n  bijector = tfb.Softplus()\n  base_dist = tfd.MultivariateNormalFullCovariance(\n      loc=base_mean, covariance_matrix=base_cov)\n  target_dist = bijector(base_dist)\n\n  def orig_target_log_prob_fn(x):\n    return target_dist.log_prob(x), ()\n\n  target_log_prob_fn, state = fun_mcmc.transform_log_prob_fn(\n      orig_target_log_prob_fn, bijector, state)\n\n  kernel = tf.function(lambda state: fun_mcmc.Func(\n      state,\n      step_size=step_size,\n      num_leapfrog_steps=num_leapfrog_steps,\n      target_log_prob_fn=target_log_prob_fn,\n      seed=tfp_test_util.test_seed()))\n\n  _, chain = fun_mcmc.trace(\n      state=fun_mcmc.HamiltonianMonteCarloState(\n          state=state,\n          state_grads=None,\n          target_log_prob=None,\n          state_extra=None),\n      fn=kernel,\n      num_steps=num_steps,\n      trace_fn=lambda state, extra: state.state_extra[0])\n  ```\n\n  Args:\n    hmc_state: HamiltonianMonteCarloState.\n    target_log_prob_fn: Target log prob fn.\n    step_size: Step size, structure broadcastable to the `target_log_prob_fn`\n      state.\n    num_leapfrog_steps: Number of leapfrog steps to take.\n    momentum: Initial momentum, passed to `momentum_sample_fn`. Default: zeroes.\n    kinetic_energy_fn: Kinetic energy function.\n    momentum_sample_fn: Sampler for the momentum.\n    leapfrog_trace_fn: Trace function for the leapfrog integrator.\n    seed: For reproducibility.\n\n  Returns:\n    hmc_state: HamiltonianMonteCarloState\n    hmc_extra: HamiltonianMonteCarloExtra\n  \"\"\"\n  arg_20 = arg_0.state\n  arg_21 = arg_0.state_grads\n  arg_22 = arg_0.target_log_prob\n  arg_23 = arg_0.state_extra\n\n  if arg_10 is None:\n\n    # pylint: disable=function-redefined\n    def arg_10(*arg_8):\n      return tf.add_n([\n          tf.reduce_sum(input_tensor=tf.square(arg_24), axis=-1) / 2.\n          for arg_24 in tf.nest.flatten(arg_8)\n      ]), ()\n\n  if arg_11 is None:\n\n    # pylint: disable=function-redefined\n    def arg_11(*arg_8):\n      arg_25 = tf.nest.map_structure(\n          lambda arg_24: tf.random.normal(tf.shape(input=arg_24), dtype=arg_24.dtype),\n          arg_8)\n      if len(arg_25) == 1:\n        return arg_25[0]\n      else:\n        return arg_25\n\n  if arg_8 is None:\n    arg_8 = call_fn(arg_11,\n                       tf.nest.map_structure(tf.zeros_like, arg_20))\n  if arg_22 is None:\n    arg_22, arg_23, arg_21 = call_and_grads(\n        arg_2, arg_20)\n\n  arg_26, arg_27 = call_fn(arg_10, arg_8)\n  arg_28 = -arg_22 + arg_26\n  arg_29 = arg_1(\n      arg_20=arg_20,\n      arg_21=arg_21,\n      arg_23=arg_23,\n      arg_22=arg_22)\n\n  def leapfrog_wrapper(arg_30, arg_22, arg_23):\n    \"\"\"Leapfrog wrapper that tracks extra state.\"\"\"\n    del arg_22\n    del arg_23\n\n    arg_30, arg_31 = leapfrog_step(\n        arg_30,\n        arg_4=arg_4,\n        arg_2=arg_2,\n        arg_10=arg_10)\n\n    return [\n        arg_30, arg_31.target_log_prob,\n        arg_31.state_extra\n    ], arg_31\n\n  def leapfrog_trace_wrapper_fn(arg_18, arg_31):\n    return arg_13(arg_18[0], arg_31)\n\n  arg_32 = (arg_15(arg_20, arg_21, arg_8),\n                            arg_22, arg_23)\n\n  [[arg_30, arg_22, arg_23], arg_27], arg_33 = trace(\n      arg_32,\n      leapfrog_wrapper,\n      arg_6,\n      trace_fn=leapfrog_trace_wrapper_fn)\n\n  arg_26, arg_27 = call_fn(arg_10, arg_30.momentum)\n  arg_34 = -arg_22 + arg_26\n  arg_35 = arg_1(\n      arg_20=arg_30.state,\n      arg_21=arg_30.state_grads,\n      arg_22=arg_22,\n      arg_23=arg_23)\n\n  arg_36 = arg_34 - arg_28\n  arg_0, arg_37, arg_27 = metropolis_hastings_step(\n      arg_29, arg_35, arg_36, arg_19=arg_19)\n\n  arg_0 = arg_0  # type: HamiltonianMonteCarloState\n  return arg_0, HamiltonianMonteCarloExtra(\n      arg_37=arg_37,\n      proposed_hmc_state=arg_35,\n      log_accept_ratio=-arg_36,\n      arg_33=arg_33)", "path": "experimental/fun_mcmc/fun_mcmc_lib.py", "identifier": "hamiltonian_monte_carlo", "docstring": "Hamiltonian Monte Carlo `TransitionOperator`.\n\n  #### Example\n\n  ```python\n  step_size = 0.2\n  num_steps = 2000\n  num_leapfrog_steps = 10\n  state = tf.ones([16, 2])\n\n  base_mean = [1., 0]\n  base_cov = [[1, 0.5], [0.5, 1]]\n\n  bijector = tfb.Softplus()\n  base_dist = tfd.MultivariateNormalFullCovariance(\n      loc=base_mean, covariance_matrix=base_cov)\n  target_dist = bijector(base_dist)\n\n  def orig_target_log_prob_fn(x):\n    return target_dist.log_prob(x), ()\n\n  target_log_prob_fn, state = fun_mcmc.transform_log_prob_fn(\n      orig_target_log_prob_fn, bijector, state)\n\n  kernel = tf.function(lambda state: fun_mcmc.hamiltonian_monte_carlo(\n      state,\n      step_size=step_size,\n      num_leapfrog_steps=num_leapfrog_steps,\n      target_log_prob_fn=target_log_prob_fn,\n      seed=tfp_test_util.test_seed()))\n\n  _, chain = fun_mcmc.trace(\n      state=fun_mcmc.HamiltonianMonteCarloState(\n          state=state,\n          state_grads=None,\n          target_log_prob=None,\n          state_extra=None),\n      fn=kernel,\n      num_steps=num_steps,\n      trace_fn=lambda state, extra: state.state_extra[0])\n  ```\n\n  Args:\n    hmc_state: HamiltonianMonteCarloState.\n    target_log_prob_fn: Target log prob fn.\n    step_size: Step size, structure broadcastable to the `target_log_prob_fn`\n      state.\n    num_leapfrog_steps: Number of leapfrog steps to take.\n    momentum: Initial momentum, passed to `momentum_sample_fn`. Default: zeroes.\n    kinetic_energy_fn: Kinetic energy function.\n    momentum_sample_fn: Sampler for the momentum.\n    leapfrog_trace_fn: Trace function for the leapfrog integrator.\n    seed: For reproducibility.\n\n  Returns:\n    hmc_state: HamiltonianMonteCarloState\n    hmc_extra: HamiltonianMonteCarloExtra", "docstring_tokens": ["Hamiltonian", "Monte", "Carlo", "TransitionOperator", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 251928}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L696-L729", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Shrinks the trajectory and removes all exploration ranges from the parameters.\n        Only possible if the trajectory has not been stored to disk before or was loaded as new.", "language": "python", "parameters": "(self, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", ".", "_stored", "and", "not", "arg_1", ":", "raise", "TypeError", "(", "'Your trajectory is already stored to disk or database, shrinking is '", "'not allowed.'", ")", "for", "arg_2", "in", "arg_0", ".", "_explored_parameters", ".", "values", "(", ")", ":", "arg_2", ".", "f_unlock", "(", ")", "try", ":", "arg_2", ".", "_shrink", "(", ")", "except", "Exception", "as", "exc", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Could not shrink `%s` because of:`%s`'", "%", "(", "arg_2", ".", "v_full_name", ",", "repr", "(", "exc", ")", ")", ")", "arg_0", ".", "_explored_parameters", "=", "{", "}", "arg_0", ".", "_run_information", "=", "{", "}", "arg_0", ".", "_single_run_ids", "=", "{", "}", "arg_0", ".", "_add_run_info", "(", "0", ")", "arg_0", ".", "_test_run_addition", "(", "1", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\" Shrinks the trajectory and removes all exploration ranges from the parameters.\n        Only possible if the trajectory has not been stored to disk before or was loaded as new.\n\n        :param force:\n\n            Usually you cannot shrink the trajectory if it has been stored to disk,\n            because there's no guarantee that it is actually shrunk if there\n            still exist explored parameters on disk. In case you are certain that\n            you did not store explored parameters to disk set or you deleted all\n            of them from disk set `force=True`.\n\n        :raises: TypeError if the trajectory was stored before.\n\n        \"\"\"\n        if arg_0._stored and not arg_1:\n            raise TypeError('Your trajectory is already stored to disk or database, shrinking is '\n                            'not allowed.')\n\n        for arg_2 in arg_0._explored_parameters.values():\n            arg_2.f_unlock()\n            try:\n                arg_2._shrink()\n            except Exception as exc:\n                arg_0._logger.error('Could not shrink `%s` because of:`%s`' %\n                                   (arg_2.v_full_name, repr(exc)))\n\n        # If we shrink, we do not have any explored parameters left and we can erase all\n        # run information, and the length of the trajectory is 1 again.\n        arg_0._explored_parameters = {}\n        arg_0._run_information = {}\n        arg_0._single_run_ids = {}\n        arg_0._add_run_info(0)\n        arg_0._test_run_addition(1)", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_shrink", "docstring": "Shrinks the trajectory and removes all exploration ranges from the parameters.\n        Only possible if the trajectory has not been stored to disk before or was loaded as new.\n\n        :param force:\n\n            Usually you cannot shrink the trajectory if it has been stored to disk,\n            because there's no guarantee that it is actually shrunk if there\n            still exist explored parameters on disk. In case you are certain that\n            you did not store explored parameters to disk set or you deleted all\n            of them from disk set `force=True`.\n\n        :raises: TypeError if the trajectory was stored before.", "docstring_tokens": ["Shrinks", "the", "trajectory", "and", "removes", "all", "exploration", "ranges", "from", "the", "parameters", ".", "Only", "possible", "if", "the", "trajectory", "has", "not", "been", "stored", "to", "disk", "before", "or", "was", "loaded", "as", "new", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 251929}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L7-L32", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Returns ON-OFF for all Stokes parameters given a cross_pols noise diode measurement", "language": "python", "parameters": "(dio_cross,feedtype,**kwargs)", "return_statement": "return Idiff,Qdiff,Udiff,Vdiff,freqs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "Waterfall", "(", "arg_0", ",", "max_load", "=", "150", ")", "arg_4", "=", "arg_3", ".", "populate_freqs", "(", ")", "arg_5", "=", "arg_3", ".", "header", "[", "'tsamp'", "]", "arg_6", "=", "arg_3", ".", "data", "arg_3", "=", "None", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", "=", "get_stokes", "(", "arg_6", ",", "arg_1", ")", "arg_11", ",", "arg_12", "=", "foldcal", "(", "arg_7", ",", "arg_5", ",", "**", "arg_2", ")", "arg_13", ",", "arg_14", "=", "foldcal", "(", "arg_8", ",", "arg_5", ",", "**", "arg_2", ")", "arg_15", ",", "arg_16", "=", "foldcal", "(", "arg_9", ",", "arg_5", ",", "**", "arg_2", ")", "arg_17", ",", "arg_18", "=", "foldcal", "(", "arg_10", ",", "arg_5", ",", "**", "arg_2", ")", "arg_19", "=", "arg_12", "-", "arg_11", "arg_20", "=", "arg_14", "-", "arg_13", "arg_21", "=", "arg_16", "-", "arg_15", "arg_22", "=", "arg_18", "-", "arg_17", "return", "arg_19", ",", "arg_20", ",", "arg_21", ",", "arg_22", ",", "arg_4"], "function": "def Func(arg_0,arg_1,**arg_2):\n    '''\n    Returns ON-OFF for all Stokes parameters given a cross_pols noise diode measurement\n    '''\n    #Get Stokes parameters, frequencies, and time sample length\n    arg_3 = Waterfall(arg_0,max_load=150)\n    arg_4 = arg_3.populate_freqs()\n    arg_5 = arg_3.header['tsamp']\n    arg_6 = arg_3.data\n    arg_3 = None\n\n    arg_7,arg_8,arg_9,arg_10 = get_stokes(arg_6,arg_1)\n\n    #Fold noise diode data\n    arg_11,arg_12 = foldcal(arg_7,arg_5,**arg_2)\n    arg_13,arg_14 = foldcal(arg_8,arg_5,**arg_2)\n    arg_15,arg_16 = foldcal(arg_9,arg_5,**arg_2)\n    arg_17,arg_18 = foldcal(arg_10,arg_5,**arg_2)\n\n    #Do ON-OFF subtraction\n    arg_19 = arg_12-arg_11\n    arg_20 = arg_14-arg_13\n    arg_21 = arg_16-arg_15\n    arg_22 = arg_18-arg_17\n\n    return arg_19,arg_20,arg_21,arg_22,arg_4", "path": "blimpy/calib_utils/calib_plots.py", "identifier": "get_diff", "docstring": "Returns ON-OFF for all Stokes parameters given a cross_pols noise diode measurement", "docstring_tokens": ["Returns", "ON", "-", "OFF", "for", "all", "Stokes", "parameters", "given", "a", "cross_pols", "noise", "diode", "measurement"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 251930}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L472-L478", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Find Vars mapped by the given Symbol input or None if no Vars are\n        mapped by that Symbol.", "language": "python", "parameters": "(self, sym: sym.Symbol)", "return_statement": "return v", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_1", ".", "Symbol", ")", "->", "Optional", "[", "Var", "]", ":", "arg_3", "=", "arg_0", ".", "interns", ".", "entry", "(", "arg_1", ",", "None", ")", "if", "arg_3", "is", "None", ":", "return", "arg_0", ".", "refers", ".", "entry", "(", "arg_1", ",", "None", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_1.Symbol) -> Optional[Var]:\n        \"\"\"Find Vars mapped by the given Symbol input or None if no Vars are\n        mapped by that Symbol.\"\"\"\n        arg_3 = arg_0.interns.entry(arg_1, None)\n        if arg_3 is None:\n            return arg_0.refers.entry(arg_1, None)\n        return arg_3", "path": "src/basilisp/lang/runtime.py", "identifier": "Namespace.find", "docstring": "Find Vars mapped by the given Symbol input or None if no Vars are\n        mapped by that Symbol.", "docstring_tokens": ["Find", "Vars", "mapped", "by", "the", "given", "Symbol", "input", "or", "None", "if", "no", "Vars", "are", "mapped", "by", "that", "Symbol", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 251931}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/batches.py#L180-L223", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert this unnormalized batch to an instance of Batch.", "language": "python", "parameters": "(self)", "return_statement": "return Batch(\n            images=images_unaug,\n            heatmaps=nlib.normalize_heatmaps(\n                self.heatmaps_unaug, shapes),\n            segmentation_maps=nlib.normalize_segmentation_maps(\n                self.segmentation_maps_unaug, shapes),\n            keypoints=nlib.normalize_keypoints(\n                self.keypoints_unaug, shapes),\n            bounding_boxes=nlib.normalize_bounding_boxes(\n                self.bounding_boxes_unaug, shapes),\n            polygons=nlib.normalize_polygons(\n                self.polygons_unaug, shapes),\n            line_strings=nlib.normalize_line_strings(\n                self.line_strings_unaug, shapes),\n            data=self.data\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "all", "(", "[", "arg_2", "is", "None", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "__dict__", ".", "items", "(", ")", "if", "arg_1", ".", "endswith", "(", "\"_aug\"", ")", "]", ")", ",", "\"Expected UnnormalizedBatch to not contain any augmented data \"", "\"before normalization, but at least one '*_aug' attribute was \"", "\"already set.\"", "arg_3", "=", "nlib", ".", "normalize_images", "(", "arg_0", ".", "images_unaug", ")", "arg_4", "=", "None", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "[", "image", ".", "shape", "for", "image", "in", "arg_3", "]", "return", "Batch", "(", "images", "=", "arg_3", ",", "heatmaps", "=", "nlib", ".", "normalize_heatmaps", "(", "arg_0", ".", "heatmaps_unaug", ",", "arg_4", ")", ",", "segmentation_maps", "=", "nlib", ".", "normalize_segmentation_maps", "(", "arg_0", ".", "segmentation_maps_unaug", ",", "arg_4", ")", ",", "keypoints", "=", "nlib", ".", "normalize_keypoints", "(", "arg_0", ".", "keypoints_unaug", ",", "arg_4", ")", ",", "bounding_boxes", "=", "nlib", ".", "normalize_bounding_boxes", "(", "arg_0", ".", "bounding_boxes_unaug", ",", "arg_4", ")", ",", "polygons", "=", "nlib", ".", "normalize_polygons", "(", "arg_0", ".", "polygons_unaug", ",", "arg_4", ")", ",", "line_strings", "=", "nlib", ".", "normalize_line_strings", "(", "arg_0", ".", "line_strings_unaug", ",", "arg_4", ")", ",", "data", "=", "arg_0", ".", "data", ")"], "function": "def Func(arg_0):\n        \"\"\"Convert this unnormalized batch to an instance of Batch.\n\n        As this method is intended to be called before augmentation, it\n        assumes that none of the ``*_aug`` attributes is yet set.\n        It will produce an AssertionError otherwise.\n\n        The newly created Batch's ``*_unaug`` attributes will match the ones\n        in this batch, just in normalized form.\n\n        Returns\n        -------\n        imgaug.augmentables.batches.Batch\n            The batch, with ``*_unaug`` attributes being normalized.\n\n        \"\"\"\n        assert all([\n            arg_2 is None for arg_1, arg_2 in arg_0.__dict__.items()\n            if arg_1.endswith(\"_aug\")]), \\\n            \"Expected UnnormalizedBatch to not contain any augmented data \" \\\n            \"before normalization, but at least one '*_aug' attribute was \" \\\n            \"already set.\"\n\n        arg_3 = nlib.normalize_images(arg_0.images_unaug)\n        arg_4 = None\n        if arg_3 is not None:\n            arg_4 = [image.shape for image in arg_3]\n\n        return Batch(\n            images=arg_3,\n            heatmaps=nlib.normalize_heatmaps(\n                arg_0.heatmaps_unaug, arg_4),\n            segmentation_maps=nlib.normalize_segmentation_maps(\n                arg_0.segmentation_maps_unaug, arg_4),\n            keypoints=nlib.normalize_keypoints(\n                arg_0.keypoints_unaug, arg_4),\n            bounding_boxes=nlib.normalize_bounding_boxes(\n                arg_0.bounding_boxes_unaug, arg_4),\n            polygons=nlib.normalize_polygons(\n                arg_0.polygons_unaug, arg_4),\n            line_strings=nlib.normalize_line_strings(\n                arg_0.line_strings_unaug, arg_4),\n            data=arg_0.data\n        )", "path": "imgaug/augmentables/batches.py", "identifier": "UnnormalizedBatch.to_normalized_batch", "docstring": "Convert this unnormalized batch to an instance of Batch.\n\n        As this method is intended to be called before augmentation, it\n        assumes that none of the ``*_aug`` attributes is yet set.\n        It will produce an AssertionError otherwise.\n\n        The newly created Batch's ``*_unaug`` attributes will match the ones\n        in this batch, just in normalized form.\n\n        Returns\n        -------\n        imgaug.augmentables.batches.Batch\n            The batch, with ``*_unaug`` attributes being normalized.", "docstring_tokens": ["Convert", "this", "unnormalized", "batch", "to", "an", "instance", "of", "Batch", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 251932}
{"url": "https://github.com/rkcosmos/deepcut/blob/9a2729071d01972af805acede85d7aa9e7a6da30/deepcut/train.py#L204-L217", "sha": "9a2729071d01972af805acede85d7aa9e7a6da30", "docstring_summary": "Evaluate model on splitted 10 percent testing set", "language": "python", "parameters": "(best_processed_path, model)", "return_statement": "return f1score, precision, recall", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "prepare_feature", "(", "arg_0", ",", "option", "=", "'test'", ")", "arg_5", "=", "arg_1", ".", "predict", "(", "[", "arg_2", ",", "arg_3", "]", ")", "arg_5", "=", "(", "arg_5", ".", "ravel", "(", ")", ">", "0.5", ")", ".", "astype", "(", "int", ")", "arg_6", "=", "f1_score", "(", "arg_4", ",", "arg_5", ")", "arg_7", "=", "precision_score", "(", "arg_4", ",", "arg_5", ")", "arg_8", "=", "recall_score", "(", "arg_4", ",", "arg_5", ")", "return", "arg_6", ",", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Evaluate model on splitted 10 percent testing set\n    \"\"\"\n    arg_2, arg_3, arg_4 = prepare_feature(arg_0, option='test')\n\n    arg_5 = arg_1.predict([arg_2, arg_3])\n    arg_5 = (arg_5.ravel() > 0.5).astype(int)\n\n    arg_6 = f1_score(arg_4, arg_5)\n    arg_7 = precision_score(arg_4, arg_5)\n    arg_8 = recall_score(arg_4, arg_5)\n\n    return arg_6, arg_7, arg_8", "path": "deepcut/train.py", "identifier": "evaluate", "docstring": "Evaluate model on splitted 10 percent testing set", "docstring_tokens": ["Evaluate", "model", "on", "splitted", "10", "percent", "testing", "set"], "nwo": "rkcosmos/deepcut", "score": 0.6555269481755696, "idx": 251933}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/FloatingIP.py#L61-L80", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Creates a FloatingIP in a region without assigning\n            it to a specific Droplet.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_data", "(", "'floating_ips/'", ",", "type", "=", "POST", ",", "params", "=", "{", "'region'", ":", "arg_0", ".", "region_slug", "}", ")", "if", "arg_3", ":", "arg_0", ".", "ip", "=", "arg_3", "[", "'floating_ip'", "]", "[", "'ip'", "]", "arg_0", ".", "region", "=", "arg_3", "[", "'floating_ip'", "]", "[", "'region'", "]", "return", "arg_0"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n            Creates a FloatingIP in a region without assigning\n            it to a specific Droplet.\n\n            Note: Every argument and parameter given to this method will be\n            assigned to the object.\n\n            Args:\n                region_slug: str - region's slug (e.g. 'nyc3')\n        \"\"\"\n        arg_3 = arg_0.get_data('floating_ips/',\n                             type=POST,\n                             params={'region': arg_0.region_slug})\n\n        if arg_3:\n            arg_0.ip = arg_3['floating_ip']['ip']\n            arg_0.region = arg_3['floating_ip']['region']\n\n        return arg_0", "path": "digitalocean/FloatingIP.py", "identifier": "FloatingIP.reserve", "docstring": "Creates a FloatingIP in a region without assigning\n            it to a specific Droplet.\n\n            Note: Every argument and parameter given to this method will be\n            assigned to the object.\n\n            Args:\n                region_slug: str - region's slug (e.g. 'nyc3')", "docstring_tokens": ["Creates", "a", "FloatingIP", "in", "a", "region", "without", "assigning", "it", "to", "a", "specific", "Droplet", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 251934}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L305-L381", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Runs a network in an experimental run.", "language": "python", "parameters": "(self, traj, network, network_dict, component_list, analyser_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "pre_run", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"Runs a network in an experimental run.\n\n        Called by a :class:`~pypet.brian2.network.NetworkManager`.\n\n        A network run is divided into several subruns which are defined as\n        :class:`~pypet.brian2.parameter.Brian2Parameter` instances.\n\n        These subruns are extracted from the trajectory. All\n        :class:`~pypet.brian2.parameter.Brian2Parameter` instances found under\n        `traj.parameters.simulation.durations` (default, you can change the\n        name of the group where to search for durations at runner initialisation).\n        The order is determined from\n        the `v_annotations.order` attributes. An error is thrown if no orders attribute\n        can be found or if two parameters have the same order.\n\n        There must be at least one subrun in the trajectory,\n        otherwise an AttributeError is thrown. If two subruns equal in their order\n        property a RuntimeError is thrown.\n\n        For every subrun the following steps are executed:\n\n        1.  Calling :func:`~pypet.brian2.network.NetworkComponent.add_to_network` for every\n            every :class:`~pypet.brian2.network.NetworkComponent` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n        2.  Calling :func:`~pypet.brian2.network.NetworkComponent.add_to_network` for every\n            every :class:`~pypet.brian2.network.NetworkAnalyser` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n        3.  Calling :func:`~pypet.brian2.network.NetworkComponent.add_to_network` of the\n            NetworkRunner itself (usually the network runner should not add or remove\n            anything from the network, but this step is executed for completeness).\n\n        4.  Running the BRIAN2 network for the duration of the current subrun by calling\n            the network's `run` function.\n\n        5.  Calling :func:`~pypet.brian2.network.NetworkAnalyser.analyse` for every\n            every :class:`~pypet.brian2.network.NetworkAnalyser` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n        6.  Calling :func:`~pypet.brian2.network.NetworkComponent.remove_from_network` of the\n            NetworkRunner itself (usually the network runner should not add or remove\n            anything from the network, but this step is executed for completeness).\n\n        7.  Calling :func:`~pypet.brian2.network.NetworkComponent.remove_from_network` for every\n            every :class:`~pypet.brian2.network.NetworkAnalyser` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`\n\n        8.  Calling :func:`~pypet.brian2.network.NetworkComponent.remove_from_network` for every\n            every :class:`~pypet.brian2.network.NetworkComponent` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n\n        These 8 steps are repeated for every subrun in the `subrun_list`.\n        The `subrun_list` passed to all `add_to_network`, `analyse` and\n        `remove_from_network` methods can be modified\n        within these functions to potentially alter the order of execution or\n        even erase or add upcoming subruns if necessary.\n\n        For example, a NetworkAnalyser checks\n        for epileptic pathological activity and cancels all coming subruns in case\n        of undesired network dynamics.\n\n        :param traj: Trajectory container\n\n        :param network: BRIAN2 network\n\n        :param network_dict: Dictionary of items shared among all components\n\n        :param component_list: List of :class:`~pypet.brian2.network.NetworkComponent` objects\n\n        :param analyser_list: List of :class:`~pypet.brian2.network.NetworkAnalyser` objects\n\n        \"\"\"\n        arg_0._Func(arg_1, arg_2, arg_3, arg_4, arg_5,\n                                  pre_run=False)", "path": "pypet/brian2/network.py", "identifier": "NetworkRunner.execute_network_run", "docstring": "Runs a network in an experimental run.\n\n        Called by a :class:`~pypet.brian2.network.NetworkManager`.\n\n        A network run is divided into several subruns which are defined as\n        :class:`~pypet.brian2.parameter.Brian2Parameter` instances.\n\n        These subruns are extracted from the trajectory. All\n        :class:`~pypet.brian2.parameter.Brian2Parameter` instances found under\n        `traj.parameters.simulation.durations` (default, you can change the\n        name of the group where to search for durations at runner initialisation).\n        The order is determined from\n        the `v_annotations.order` attributes. An error is thrown if no orders attribute\n        can be found or if two parameters have the same order.\n\n        There must be at least one subrun in the trajectory,\n        otherwise an AttributeError is thrown. If two subruns equal in their order\n        property a RuntimeError is thrown.\n\n        For every subrun the following steps are executed:\n\n        1.  Calling :func:`~pypet.brian2.network.NetworkComponent.add_to_network` for every\n            every :class:`~pypet.brian2.network.NetworkComponent` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n        2.  Calling :func:`~pypet.brian2.network.NetworkComponent.add_to_network` for every\n            every :class:`~pypet.brian2.network.NetworkAnalyser` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n        3.  Calling :func:`~pypet.brian2.network.NetworkComponent.add_to_network` of the\n            NetworkRunner itself (usually the network runner should not add or remove\n            anything from the network, but this step is executed for completeness).\n\n        4.  Running the BRIAN2 network for the duration of the current subrun by calling\n            the network's `run` function.\n\n        5.  Calling :func:`~pypet.brian2.network.NetworkAnalyser.analyse` for every\n            every :class:`~pypet.brian2.network.NetworkAnalyser` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n        6.  Calling :func:`~pypet.brian2.network.NetworkComponent.remove_from_network` of the\n            NetworkRunner itself (usually the network runner should not add or remove\n            anything from the network, but this step is executed for completeness).\n\n        7.  Calling :func:`~pypet.brian2.network.NetworkComponent.remove_from_network` for every\n            every :class:`~pypet.brian2.network.NetworkAnalyser` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`\n\n        8.  Calling :func:`~pypet.brian2.network.NetworkComponent.remove_from_network` for every\n            every :class:`~pypet.brian2.network.NetworkComponent` in the order as\n            they were passed to the :class:`~pypet.brian2.network.NetworkManager`.\n\n\n        These 8 steps are repeated for every subrun in the `subrun_list`.\n        The `subrun_list` passed to all `add_to_network`, `analyse` and\n        `remove_from_network` methods can be modified\n        within these functions to potentially alter the order of execution or\n        even erase or add upcoming subruns if necessary.\n\n        For example, a NetworkAnalyser checks\n        for epileptic pathological activity and cancels all coming subruns in case\n        of undesired network dynamics.\n\n        :param traj: Trajectory container\n\n        :param network: BRIAN2 network\n\n        :param network_dict: Dictionary of items shared among all components\n\n        :param component_list: List of :class:`~pypet.brian2.network.NetworkComponent` objects\n\n        :param analyser_list: List of :class:`~pypet.brian2.network.NetworkAnalyser` objects", "docstring_tokens": ["Runs", "a", "network", "in", "an", "experimental", "run", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 251935}
{"url": "https://github.com/Knio/dominate/blob/1eb88f9fd797658eef83568a548e2ef9b546807d/dominate/dom_tag.py#L169-L179", "sha": "1eb88f9fd797658eef83568a548e2ef9b546807d", "docstring_summary": "Creates a reference to the parent document to allow for partial-tree\n    validation.", "language": "python", "parameters": "(self, doc)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "document", "!=", "arg_1", ":", "arg_0", ".", "document", "=", "arg_1", "for", "arg_3", "in", "arg_0", ".", "children", ":", "if", "not", "isinstance", "(", "arg_3", ",", "dom_tag", ")", ":", "return", "arg_3", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Creates a reference to the parent document to allow for partial-tree\n    validation.\n    '''\n    # assume that a document is correct in the subtree\n    if arg_0.document != arg_1:\n      arg_0.document = arg_1\n      for arg_3 in arg_0.children:\n        if not isinstance(arg_3, dom_tag): return\n        arg_3.Func(arg_1)", "path": "dominate/dom_tag.py", "identifier": "dom_tag.setdocument", "docstring": "Creates a reference to the parent document to allow for partial-tree\n    validation.", "docstring_tokens": ["Creates", "a", "reference", "to", "the", "parent", "document", "to", "allow", "for", "partial", "-", "tree", "validation", "."], "nwo": "Knio/dominate", "score": 0.889047087708157, "idx": 251936}
{"url": "https://github.com/ashleysommer/sanic-cors/blob/f3d68def8cf859398b3c83e4109d815f1f038ea2/sanic_cors/core.py#L318-L326", "sha": "f3d68def8cf859398b3c83e4109d815f1f038ea2", "docstring_summary": "Returns the dictionary of CORS specific app configurations.", "language": "python", "parameters": "(appInstance)", "return_statement": "return dict(\n        (k.lower().replace('cors_', ''), app_config.get(k))\n        for k in CONFIG_OPTIONS\n        if app_config.get(k) is not None\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "getattr", "(", "arg_0", ",", "'config'", ",", "{", "}", ")", "return", "dict", "(", "(", "arg_2", ".", "lower", "(", ")", ".", "replace", "(", "'cors_'", ",", "''", ")", ",", "arg_1", ".", "get", "(", "arg_2", ")", ")", "for", "arg_2", "in", "CONFIG_OPTIONS", "if", "arg_1", ".", "get", "(", "arg_2", ")", "is", "not", "None", ")"], "function": "def Func(arg_0):\n    \"\"\"Returns the dictionary of CORS specific app configurations.\"\"\"\n    # In order to support blueprints which do not have a config attribute\n    arg_1 = getattr(arg_0, 'config', {})\n    return dict(\n        (arg_2.lower().replace('cors_', ''), arg_1.get(arg_2))\n        for arg_2 in CONFIG_OPTIONS\n        if arg_1.get(arg_2) is not None\n    )", "path": "sanic_cors/core.py", "identifier": "get_app_kwarg_dict", "docstring": "Returns the dictionary of CORS specific app configurations.", "docstring_tokens": ["Returns", "the", "dictionary", "of", "CORS", "specific", "app", "configurations", "."], "nwo": "ashleysommer/sanic-cors", "score": 0.5617023167608389, "idx": 251937}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/appengine.py#L450-L467", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Parse the value of the 'state' parameter.", "language": "python", "parameters": "(state, user)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "rsplit", "(", "':'", ",", "1", ")", "if", "xsrfutil", ".", "validate_token", "(", "xsrf_secret_key", "(", ")", ",", "arg_3", ",", "arg_1", ".", "user_id", "(", ")", ",", "action_id", "=", "arg_2", ")", ":", "return", "arg_2", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Parse the value of the 'state' parameter.\n\n    Parses the value and validates the XSRF token in the state parameter.\n\n    Args:\n        state: string, The value of the state parameter.\n        user: google.appengine.api.users.User, The current user.\n\n    Returns:\n        The redirect URI, or None if XSRF token is not valid.\n    \"\"\"\n    arg_2, arg_3 = arg_0.rsplit(':', 1)\n    if xsrfutil.validate_token(xsrf_secret_key(), arg_3, arg_1.user_id(),\n                               action_id=arg_2):\n        return arg_2\n    else:\n        return None", "path": "oauth2client/contrib/appengine.py", "identifier": "_parse_state_value", "docstring": "Parse the value of the 'state' parameter.\n\n    Parses the value and validates the XSRF token in the state parameter.\n\n    Args:\n        state: string, The value of the state parameter.\n        user: google.appengine.api.users.User, The current user.\n\n    Returns:\n        The redirect URI, or None if XSRF token is not valid.", "docstring_tokens": ["Parse", "the", "value", "of", "the", "state", "parameter", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 251938}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/build.py#L174-L222", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "run a build, meaning creating a build. Retry if there is failure", "language": "python", "parameters": "(self, config, bucket, names)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_get_project", "(", ")", "bot", ".", "custom", "(", "'PROJECT'", ",", "arg_4", ",", "\"CYAN\"", ")", "bot", ".", "custom", "(", "'BUILD  '", ",", "arg_1", "[", "'steps'", "]", "[", "0", "]", "[", "'name'", "]", ",", "\"CYAN\"", ")", "arg_5", "=", "arg_0", ".", "_build_service", ".", "projects", "(", ")", ".", "builds", "(", ")", ".", "create", "(", "body", "=", "arg_1", ",", "projectId", "=", "arg_4", ")", ".", "execute", "(", ")", "arg_6", "=", "arg_5", "[", "'metadata'", "]", "[", "'build'", "]", "[", "'id'", "]", "arg_7", "=", "arg_5", "[", "'metadata'", "]", "[", "'build'", "]", "[", "'status'", "]", "bot", ".", "log", "(", "\"build %s: %s\"", "%", "(", "arg_6", ",", "arg_7", ")", ")", "arg_8", "=", "time", ".", "time", "(", ")", "while", "arg_7", "not", "in", "[", "'COMPLETE'", ",", "'FAILURE'", ",", "'SUCCESS'", "]", ":", "time", ".", "sleep", "(", "15", ")", "arg_5", "=", "arg_0", ".", "_build_service", ".", "projects", "(", ")", ".", "builds", "(", ")", ".", "get", "(", "id", "=", "arg_6", ",", "projectId", "=", "arg_4", ")", ".", "execute", "(", ")", "arg_6", "=", "arg_5", "[", "'id'", "]", "arg_7", "=", "arg_5", "[", "'status'", "]", "bot", ".", "log", "(", "\"build %s: %s\"", "%", "(", "arg_6", ",", "arg_7", ")", ")", "arg_9", "=", "time", ".", "time", "(", ")", "bot", ".", "log", "(", "'Total build time: %s seconds'", "%", "(", "round", "(", "arg_9", "-", "arg_8", ",", "2", ")", ")", ")", "if", "arg_7", "==", "'SUCCESS'", ":", "arg_10", "=", "'SREGISTRY_GOOGLE_STORAGE_PRIVATE'", "arg_11", "=", "arg_2", ".", "blob", "(", "arg_5", "[", "'artifacts'", "]", "[", "'objects'", "]", "[", "'paths'", "]", "[", "0", "]", ")", "if", "arg_0", ".", "_get_and_update_setting", "(", "arg_10", ")", "==", "None", ":", "arg_11", ".", "make_public", "(", ")", "arg_5", "[", "'public_url'", "]", "=", "arg_11", ".", "public_url", "update_blob_metadata", "(", "arg_11", ",", "arg_5", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "[", "'media_link'", "]", "=", "arg_11", ".", "media_link", "arg_5", "[", "'size'", "]", "=", "arg_11", ".", "size", "arg_5", "[", "'file_hash'", "]", "=", "arg_11", ".", "md5_hash", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''run a build, meaning creating a build. Retry if there is failure\n    '''\n\n    arg_4 = arg_0._get_project()\n\n    #          prefix,    message, color\n    bot.custom('PROJECT', arg_4, \"CYAN\")\n    bot.custom('BUILD  ', arg_1['steps'][0]['name'], \"CYAN\")\n\n    arg_5 = arg_0._build_service.projects().builds().create(body=arg_1, \n                                              projectId=arg_4).execute()\n\n    arg_6 = arg_5['metadata']['build']['id']\n    arg_7 = arg_5['metadata']['build']['status']\n    bot.log(\"build %s: %s\" % (arg_6, arg_7))\n\n    arg_8 = time.time()\n    while arg_7 not in ['COMPLETE', 'FAILURE', 'SUCCESS']:\n        time.sleep(15)\n        arg_5 = arg_0._build_service.projects().builds().get(id=arg_6, \n                                                  projectId=arg_4).execute()\n\n        arg_6 = arg_5['id']\n        arg_7 = arg_5['status']\n        bot.log(\"build %s: %s\" % (arg_6, arg_7))\n\n    arg_9 = time.time()\n    bot.log('Total build time: %s seconds' % (round(arg_9 - arg_8, 2)))\n   \n    # If successful, update blob metadata and visibility\n    if arg_7 == 'SUCCESS':\n\n        # Does the user want to keep the container private?\n        arg_10 = 'SREGISTRY_GOOGLE_STORAGE_PRIVATE'\n        arg_11 = arg_2.blob(arg_5['artifacts']['objects']['paths'][0])\n        \n        # Make Public, if desired\n        if arg_0._get_and_update_setting(arg_10) == None:\n            arg_11.make_public()\n            arg_5['public_url'] = arg_11.public_url\n\n        # Add the metadata directly to the object\n        update_blob_metadata(arg_11, arg_5, arg_1, arg_2, arg_3)\n        arg_5['media_link'] = arg_11.media_link\n        arg_5['size'] = arg_11.size\n        arg_5['file_hash'] = arg_11.md5_hash\n\n    return arg_5", "path": "sregistry/main/google_build/build.py", "identifier": "run_build", "docstring": "run a build, meaning creating a build. Retry if there is failure", "docstring_tokens": ["run", "a", "build", "meaning", "creating", "a", "build", ".", "Retry", "if", "there", "is", "failure"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 251939}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/server.py#L417-L451", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Handle a POST request.", "language": "python", "parameters": "(self, thing_id='0')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'0'", ")", ":", "arg_2", "=", "arg_0", ".", "get_thing", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "arg_0", ".", "set_status", "(", "404", ")", "return", "try", ":", "arg_3", "=", "json", ".", "loads", "(", "arg_0", ".", "request", ".", "body", ".", "decode", "(", ")", ")", "except", "ValueError", ":", "arg_0", ".", "set_status", "(", "400", ")", "return", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "arg_3", ".", "items", "(", ")", ":", "arg_7", "=", "None", "if", "'input'", "in", "arg_6", ":", "arg_7", "=", "arg_6", "[", "'input'", "]", "arg_8", "=", "arg_2", ".", "perform_action", "(", "arg_5", ",", "arg_7", ")", "if", "arg_8", ":", "arg_4", ".", "update", "(", "arg_8", ".", "as_action_description", "(", ")", ")", "tornado", ".", "ioloop", ".", "IOLoop", ".", "current", "(", ")", ".", "spawn_callback", "(", "perform_action", ",", "arg_8", ",", ")", "arg_0", ".", "set_status", "(", "201", ")", "arg_0", ".", "write", "(", "json", ".", "dumps", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1='0'):\n        \"\"\"\n        Handle a POST request.\n\n        thing_id -- ID of the thing this request is for\n        \"\"\"\n        arg_2 = arg_0.get_thing(arg_1)\n        if arg_2 is None:\n            arg_0.set_status(404)\n            return\n\n        try:\n            arg_3 = json.loads(arg_0.request.body.decode())\n        except ValueError:\n            arg_0.set_status(400)\n            return\n\n        arg_4 = {}\n        for arg_5, arg_6 in arg_3.items():\n            arg_7 = None\n            if 'input' in arg_6:\n                arg_7 = arg_6['input']\n\n            arg_8 = arg_2.perform_action(arg_5, arg_7)\n            if arg_8:\n                arg_4.update(arg_8.as_action_description())\n\n                # Start the action\n                tornado.ioloop.IOLoop.current().spawn_callback(\n                    perform_action,\n                    arg_8,\n                )\n\n        arg_0.set_status(201)\n        arg_0.write(json.dumps(arg_4))", "path": "webthing/server.py", "identifier": "ActionsHandler.post", "docstring": "Handle a POST request.\n\n        thing_id -- ID of the thing this request is for", "docstring_tokens": ["Handle", "a", "POST", "request", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 251940}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L171-L202", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return adjusted start and stop index as tuple.", "language": "python", "parameters": "(self, key: Union[slice, int])", "return_statement": "return start + ss, stop + ss", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", ",", "arg_4", "]", ")", "->", "(", "arg_4", ",", "arg_4", ")", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_span", "if", "isinstance", "(", "arg_1", ",", "arg_4", ")", ":", "if", "arg_1", "<", "0", ":", "arg_1", "+=", "arg_6", "-", "arg_5", "if", "arg_1", "<", "0", ":", "raise", "IndexError", "(", "'index out of range'", ")", "elif", "arg_1", ">=", "arg_6", "-", "arg_5", ":", "raise", "IndexError", "(", "'index out of range'", ")", "arg_7", "=", "arg_5", "+", "arg_1", "return", "arg_7", ",", "arg_7", "+", "1", "if", "arg_1", ".", "step", "is", "not", "None", ":", "raise", "NotImplementedError", "(", "'step is not implemented for string setter.'", ")", "arg_7", ",", "arg_8", "=", "arg_1", ".", "start", "or", "0", ",", "arg_1", ".", "stop", "if", "arg_7", "<", "0", ":", "arg_7", "+=", "arg_6", "-", "arg_5", "if", "arg_7", "<", "0", ":", "raise", "IndexError", "(", "'start index out of range'", ")", "if", "arg_8", "is", "None", ":", "arg_8", "=", "arg_6", "-", "arg_5", "elif", "arg_8", "<", "0", ":", "arg_8", "+=", "arg_6", "-", "arg_5", "if", "arg_7", ">", "arg_8", ":", "raise", "IndexError", "(", "'stop index out of range or start is after the stop'", ")", "return", "arg_7", "+", "arg_5", ",", "arg_8", "+", "arg_5"], "function": "def Func(arg_0, arg_1: arg_2[arg_3, arg_4]) -> (arg_4, arg_4):\n        \"\"\"Return adjusted start and stop index as tuple.\n\n        Used in  __setitem__ and __delitem__.\n        \"\"\"\n        arg_5, arg_6 = arg_0._span\n        if isinstance(arg_1, arg_4):\n            if arg_1 < 0:\n                arg_1 += arg_6 - arg_5\n                if arg_1 < 0:\n                    raise IndexError('index out of range')\n            elif arg_1 >= arg_6 - arg_5:\n                raise IndexError('index out of range')\n            arg_7 = arg_5 + arg_1\n            return arg_7, arg_7 + 1\n        # isinstance(key, slice)\n        if arg_1.step is not None:\n            raise NotImplementedError(\n                'step is not implemented for string setter.')\n        arg_7, arg_8 = arg_1.start or 0, arg_1.stop\n        if arg_7 < 0:\n            arg_7 += arg_6 - arg_5\n            if arg_7 < 0:\n                raise IndexError('start index out of range')\n        if arg_8 is None:\n            arg_8 = arg_6 - arg_5\n        elif arg_8 < 0:\n            arg_8 += arg_6 - arg_5\n        if arg_7 > arg_8:\n            raise IndexError(\n                'stop index out of range or start is after the stop')\n        return arg_7 + arg_5, arg_8 + arg_5", "path": "wikitextparser/_wikitext.py", "identifier": "WikiText._check_index", "docstring": "Return adjusted start and stop index as tuple.\n\n        Used in  __setitem__ and __delitem__.", "docstring_tokens": ["Return", "adjusted", "start", "and", "stop", "index", "as", "tuple", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 251941}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L82-L110", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "r\"\"\"Take pauli string to construct pauli.", "language": "python", "parameters": "(cls, label)", "return_statement": "return cls(z=z, x=x)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "zeros", "(", "len", "(", "arg_1", ")", ",", "dtype", "=", "np", ".", "bool", ")", "arg_3", "=", "np", ".", "zeros", "(", "len", "(", "arg_1", ")", ",", "dtype", "=", "np", ".", "bool", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_1", ")", ":", "if", "arg_5", "==", "'X'", ":", "arg_3", "[", "-", "arg_4", "-", "1", "]", "=", "True", "elif", "arg_5", "==", "'Z'", ":", "arg_2", "[", "-", "arg_4", "-", "1", "]", "=", "True", "elif", "arg_5", "==", "'Y'", ":", "arg_2", "[", "-", "arg_4", "-", "1", "]", "=", "True", "arg_3", "[", "-", "arg_4", "-", "1", "]", "=", "True", "elif", "arg_5", "!=", "'I'", ":", "raise", "QiskitError", "(", "\"Pauli string must be only consisted of 'I', 'X', \"", "\"'Y' or 'Z' but you have {}.\"", ".", "format", "(", "arg_5", ")", ")", "return", "arg_0", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        r\"\"\"Take pauli string to construct pauli.\n\n        The qubit index of pauli label is q_{n-1} ... q_0.\n        E.g., a pauli is $P_{n-1} \\otimes ... \\otimes P_0$\n\n        Args:\n            label (str): pauli label\n\n        Returns:\n            Pauli: the constructed pauli\n\n        Raises:\n            QiskitError: invalid character in the label\n        \"\"\"\n        arg_2 = np.zeros(len(arg_1), dtype=np.bool)\n        arg_3 = np.zeros(len(arg_1), dtype=np.bool)\n        for arg_4, arg_5 in enumerate(arg_1):\n            if arg_5 == 'X':\n                arg_3[-arg_4 - 1] = True\n            elif arg_5 == 'Z':\n                arg_2[-arg_4 - 1] = True\n            elif arg_5 == 'Y':\n                arg_2[-arg_4 - 1] = True\n                arg_3[-arg_4 - 1] = True\n            elif arg_5 != 'I':\n                raise QiskitError(\"Pauli string must be only consisted of 'I', 'X', \"\n                                  \"'Y' or 'Z' but you have {}.\".format(arg_5))\n        return arg_0(arg_2=arg_2, arg_3=arg_3)", "path": "qiskit/quantum_info/operators/pauli.py", "identifier": "Pauli.from_label", "docstring": "r\"\"\"Take pauli string to construct pauli.\n\n        The qubit index of pauli label is q_{n-1} ... q_0.\n        E.g., a pauli is $P_{n-1} \\otimes ... \\otimes P_0$\n\n        Args:\n            label (str): pauli label\n\n        Returns:\n            Pauli: the constructed pauli\n\n        Raises:\n            QiskitError: invalid character in the label", "docstring_tokens": ["r", "Take", "pauli", "string", "to", "construct", "pauli", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 251942}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/validator.py#L68-L186", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Creates a generator that does all the work.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "bundle", ".", "group_transactions", "(", ")", "arg_2", "=", "arg_0", ".", "bundle", ".", "hash", "arg_3", "=", "len", "(", "arg_0", ".", "bundle", ")", "-", "1", "arg_4", "=", "0", "arg_5", "=", "0", "for", "arg_6", "in", "arg_1", ":", "for", "arg_7", "in", "arg_6", ":", "arg_4", "+=", "arg_7", ".", "value", "if", "arg_7", ".", "bundle_hash", "!=", "arg_2", ":", "yield", "'Transaction {i} has invalid bundle hash.'", ".", "format", "(", "i", "=", "arg_5", ",", ")", "if", "arg_7", ".", "current_index", "!=", "arg_5", ":", "yield", "(", "'Transaction {i} has invalid current index value '", "'(expected {i}, actual {actual}).'", ".", "format", "(", "actual", "=", "arg_7", ".", "current_index", ",", "i", "=", "arg_5", ",", ")", ")", "if", "arg_7", ".", "last_index", "!=", "arg_3", ":", "yield", "(", "'Transaction {i} has invalid last index value '", "'(expected {expected}, actual {actual}).'", ".", "format", "(", "actual", "=", "arg_7", ".", "last_index", ",", "expected", "=", "arg_3", ",", "i", "=", "arg_5", ",", ")", ")", "arg_5", "+=", "1", "if", "arg_4", "!=", "0", ":", "yield", "(", "'Bundle has invalid balance '", "'(expected 0, actual {actual}).'", ".", "format", "(", "actual", "=", "arg_4", ",", ")", ")", "if", "not", "arg_0", ".", "_errors", ":", "arg_8", "=", "[", "]", "for", "arg_6", "in", "arg_1", ":", "if", "arg_6", "[", "0", "]", ".", "value", ">=", "0", ":", "continue", "arg_9", "=", "True", "for", "arg_10", ",", "arg_7", "in", "enumerate", "(", "arg_6", ")", ":", "if", "(", "arg_10", ">", "0", ")", "and", "(", "arg_7", ".", "value", "!=", "0", ")", ":", "yield", "(", "'Transaction {i} has invalid value '", "'(expected 0, actual {actual}).'", ".", "format", "(", "actual", "=", "arg_7", ".", "value", ",", "i", "=", "arg_7", ".", "current_index", ",", ")", ")", "arg_9", "=", "False", "continue", "if", "arg_9", ":", "arg_8", ".", "append", "(", "arg_6", ")", "if", "arg_8", ":", "for", "arg_11", "in", "arg_0", ".", "_get_bundle_signature_errors", "(", "arg_8", ")", ":", "yield", "arg_11"], "function": "def Func(arg_0):\n        # type: () -> Generator[Text, None, None]\n        \"\"\"\n        Creates a generator that does all the work.\n        \"\"\"\n        # Group transactions by address to make it easier to iterate\n        # over inputs.\n        arg_1 = arg_0.bundle.group_transactions()\n\n        # Define a few expected values.\n        arg_2 = arg_0.bundle.hash\n        arg_3 = len(arg_0.bundle) - 1\n\n        # Track a few others as we go along.\n        arg_4 = 0\n\n        # Check indices and balance first.\n        # Note that we use a counter to keep track of the current index,\n        # since at this point we can't trust that the transactions have\n        # correct ``current_index`` values.\n        arg_5 = 0\n        for arg_6 in arg_1:\n            for arg_7 in arg_6:\n                arg_4 += arg_7.value\n\n                if arg_7.bundle_hash != arg_2:\n                    yield 'Transaction {i} has invalid bundle hash.'.format(\n                        i=arg_5,\n                    )\n\n                if arg_7.current_index != arg_5:\n                    yield (\n                        'Transaction {i} has invalid current index value '\n                        '(expected {i}, actual {actual}).'.format(\n                            actual=arg_7.current_index,\n                            i=arg_5,\n                        )\n                    )\n\n                if arg_7.last_index != arg_3:\n                    yield (\n                        'Transaction {i} has invalid last index value '\n                        '(expected {expected}, actual {actual}).'.format(\n                            actual=arg_7.last_index,\n                            expected=arg_3,\n                            i=arg_5,\n                        )\n                    )\n\n                arg_5 += 1\n\n        # Bundle must be balanced (spends must match inputs).\n        if arg_4 != 0:\n            yield (\n                'Bundle has invalid balance '\n                '(expected 0, actual {actual}).'.format(\n                    actual=arg_4,\n                )\n            )\n\n        # Signature validation is only meaningful if the transactions\n        # are otherwise valid.\n        if not arg_0._errors:\n            arg_8 = []  # type: List[List[Transaction]]\n\n            for arg_6 in arg_1:\n                # Signature validation only applies to inputs.\n                if arg_6[0].value >= 0:\n                    continue\n\n                arg_9 = True\n                for arg_10, arg_7 in enumerate(arg_6):\n                    if (arg_10 > 0) and (arg_7.value != 0):\n                        # Input is malformed; signature fragments after\n                        # the first should have zero value.\n                        yield (\n                            'Transaction {i} has invalid value '\n                            '(expected 0, actual {actual}).'.format(\n                                actual=arg_7.value,\n\n                                # If we get to this point, we know that\n                                # the ``current_index`` value for each\n                                # transaction can be trusted.\n                                i=arg_7.current_index,\n                            )\n                        )\n\n                        # We won't be able to validate the signature,\n                        # but continue anyway, so that we can check that\n                        # the other transactions in the group have the\n                        # correct ``value``.\n                        arg_9 = False\n                        continue\n\n                # After collecting the signature fragment from each\n                # transaction in the group, queue them up to run through\n                # the validator.\n                #\n                # We have to perform signature validation separately so\n                # that we can try different algorithms (for\n                # backwards-compatibility).\n                #\n                # References:\n                #\n                # - https://github.com/iotaledger/kerl#kerl-integration-in-iota\n                if arg_9:\n                    arg_8.append(arg_6)\n\n            # Once we've finished checking the attributes from each\n            # transaction in the bundle, go back and validate\n            # signatures.\n            if arg_8:\n                # ``yield from`` is an option here, but for\n                # compatibility with Python 2 clients, we will do it the\n                # old-fashioned way.\n                for arg_11 in arg_0._get_bundle_signature_errors(\n                        arg_8\n                ):\n                    yield arg_11", "path": "iota/transaction/validator.py", "identifier": "BundleValidator._create_validator", "docstring": "Creates a generator that does all the work.", "docstring_tokens": ["Creates", "a", "generator", "that", "does", "all", "the", "work", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 251943}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/aws/events.py#L9-L17", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "NamePrefix='string'", "language": "python", "parameters": "(client=None, **kwargs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "Func", "(", "**", "arg_1", ")", "if", "not", "arg_2", ".", "get", "(", "\"Rules\"", ")", ":", "arg_2", ".", "update", "(", "{", "\"Rules\"", ":", "[", "]", "}", ")", "return", "arg_2"], "function": "def Func(arg_0=None, **arg_1):\n    \"\"\"\n    NamePrefix='string'\n    \"\"\"\n    arg_2 = arg_0.Func(**arg_1)\n    if not arg_2.get(\"Rules\"):\n        arg_2.update({\"Rules\": []})\n\n    return arg_2", "path": "cloudaux/aws/events.py", "identifier": "list_rules", "docstring": "NamePrefix='string'", "docstring_tokens": ["NamePrefix", "=", "string"], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 251944}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/subscribers.py#L32-L64", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Process post-publication events coming out of the database.", "language": "python", "parameters": "(event, cursor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "module_ident", ",", "arg_0", ".", "ident_hash", "arg_4", "=", "get_current_registry", "(", ")", ".", "celery_app", "arg_1", ".", "execute", "(", "'SELECT result_id::text '", "'FROM document_baking_result_associations '", "'WHERE module_ident = %s'", ",", "(", "arg_2", ",", ")", ")", "for", "arg_5", "in", "arg_1", ".", "fetchall", "(", ")", ":", "arg_6", "=", "arg_4", ".", "AsyncResult", "(", "arg_5", "[", "0", "]", ")", ".", "state", "if", "arg_6", "in", "(", "'QUEUED'", ",", "'STARTED'", ",", "'RETRY'", ")", ":", "logger", ".", "debug", "(", "'Already queued module_ident={} ident_hash={}'", ".", "format", "(", "arg_2", ",", "arg_3", ")", ")", "return", "logger", ".", "debug", "(", "'Queued for processing module_ident={} ident_hash={}'", ".", "format", "(", "arg_2", ",", "arg_3", ")", ")", "arg_7", "=", "_get_recipe_ids", "(", "arg_2", ",", "arg_1", ")", "update_module_state", "(", "arg_1", ",", "arg_2", ",", "'processing'", ",", "arg_7", "[", "0", "]", ")", "arg_1", ".", "connection", ".", "commit", "(", ")", "arg_8", "=", "'cnxpublishing.subscribers.baking_processor'", "arg_9", "=", "arg_4", ".", "tasks", "[", "arg_8", "]", "arg_5", "=", "arg_9", ".", "delay", "(", "arg_2", ",", "arg_3", ")", "arg_9", ".", "backend", ".", "store_result", "(", "arg_5", ".", "id", ",", "None", ",", "'QUEUED'", ")", "track_baking_proc_state", "(", "arg_5", ",", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Process post-publication events coming out of the database.\"\"\"\n    arg_2, arg_3 = arg_0.module_ident, arg_0.ident_hash\n\n    arg_4 = get_current_registry().celery_app\n\n    # Check baking is not already queued.\n    arg_1.execute('SELECT result_id::text '\n                   'FROM document_baking_result_associations '\n                   'WHERE module_ident = %s', (arg_2,))\n    for arg_5 in arg_1.fetchall():\n        arg_6 = arg_4.AsyncResult(arg_5[0]).state\n        if arg_6 in ('QUEUED', 'STARTED', 'RETRY'):\n            logger.debug('Already queued module_ident={} ident_hash={}'.format(\n                arg_2, arg_3))\n            return\n\n    logger.debug('Queued for processing module_ident={} ident_hash={}'.format(\n        arg_2, arg_3))\n    arg_7 = _get_recipe_ids(arg_2, arg_1)\n    update_module_state(arg_1, arg_2, 'processing', arg_7[0])\n    # Commit the state change before preceding.\n    arg_1.connection.commit()\n\n    # Start of task\n    # FIXME Looking up the task isn't the most clear usage here.\n    arg_8 = 'cnxpublishing.subscribers.baking_processor'\n    arg_9 = arg_4.tasks[arg_8]\n    arg_5 = arg_9.delay(arg_2, arg_3)\n    arg_9.backend.store_result(arg_5.id, None, 'QUEUED')\n\n    # Save the mapping between a celery task and this event.\n    track_baking_proc_state(arg_5, arg_2, arg_1)", "path": "cnxpublishing/subscribers.py", "identifier": "post_publication_processing", "docstring": "Process post-publication events coming out of the database.", "docstring_tokens": ["Process", "post", "-", "publication", "events", "coming", "out", "of", "the", "database", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 251945}
{"url": "https://github.com/napalm-automation/napalm-yang/blob/998e8a933171d010b8544bcc5dc448e2b68051e2/interactive_demo/ansible/callback/selective.py#L63-L70", "sha": "998e8a933171d010b8544bcc5dc448e2b68051e2", "docstring_summary": "Return a dict of keys that differ with another config object.", "language": "python", "parameters": "(prv, nxt)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "set", "(", "arg_0", ".", "keys", "(", ")", "+", "arg_1", ".", "keys", "(", ")", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_2", ":", "if", "arg_0", ".", "get", "(", "arg_4", ")", "!=", "arg_1", ".", "get", "(", "arg_4", ")", ":", "arg_3", "[", "arg_4", "]", "=", "(", "arg_0", ".", "get", "(", "arg_4", ")", ",", "arg_1", ".", "get", "(", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a dict of keys that differ with another config object.\"\"\"\n    arg_2 = set(arg_0.keys() + arg_1.keys())\n    arg_3 = {}\n    for arg_4 in arg_2:\n        if arg_0.get(arg_4) != arg_1.get(arg_4):\n            arg_3[arg_4] = (arg_0.get(arg_4), arg_1.get(arg_4))\n    return arg_3", "path": "interactive_demo/ansible/callback/selective.py", "identifier": "dict_diff", "docstring": "Return a dict of keys that differ with another config object.", "docstring_tokens": ["Return", "a", "dict", "of", "keys", "that", "differ", "with", "another", "config", "object", "."], "nwo": "napalm-automation/napalm-yang", "score": 0.2912181512296147, "idx": 251946}
{"url": "https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/__init__.py#L83-L96", "sha": "5b90a543b127ab9e6112fd547929b5ef4b8f0cbc", "docstring_summary": "Returns a normalized unit number, i.e. integers\n    Raises exception X10InvalidUnitNumber if unit number appears to be invalid", "language": "python", "parameters": "(unit_number)", "return_statement": "return unit_number", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "try", ":", "arg_0", "=", "int", "(", "arg_0", ")", "except", "ValueError", ":", "raise", "X10InvalidUnitNumber", "(", "'%r not a valid unit number'", "%", "arg_0", ")", "except", "TypeError", ":", "raise", "X10InvalidUnitNumber", "(", "'%r not a valid unit number'", "%", "arg_0", ")", "if", "not", "(", "1", "<=", "arg_0", "<=", "16", ")", ":", "raise", "X10InvalidUnitNumber", "(", "'%r not a valid unit number'", "%", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Returns a normalized unit number, i.e. integers\n    Raises exception X10InvalidUnitNumber if unit number appears to be invalid\n    \"\"\"\n    try:\n        try:\n            arg_0 = int(arg_0)\n        except ValueError:\n            raise X10InvalidUnitNumber('%r not a valid unit number' % arg_0)\n    except TypeError:\n        raise X10InvalidUnitNumber('%r not a valid unit number' % arg_0)\n    if not (1 <= arg_0 <= 16):\n        raise X10InvalidUnitNumber('%r not a valid unit number' % arg_0)\n    return arg_0", "path": "x10_any/__init__.py", "identifier": "normalize_unitnumber", "docstring": "Returns a normalized unit number, i.e. integers\n    Raises exception X10InvalidUnitNumber if unit number appears to be invalid", "docstring_tokens": ["Returns", "a", "normalized", "unit", "number", "i", ".", "e", ".", "integers", "Raises", "exception", "X10InvalidUnitNumber", "if", "unit", "number", "appears", "to", "be", "invalid"], "nwo": "clach04/x10_any", "score": 0.2751458370028208, "idx": 251947}
{"url": "https://github.com/a-tal/nagaram/blob/2edcb0ef8cb569ebd1c398be826472b4831d6110/nagaram/scrabble.py#L34-L69", "sha": "2edcb0ef8cb569ebd1c398be826472b4831d6110", "docstring_summary": "Checks the Scrabble score of a single word.", "language": "python", "parameters": "(word, input_letters, questions=0)", "return_statement": "return score", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "arg_3", "=", "0", "arg_4", "=", "0", "arg_5", "=", "[", "]", "arg_6", "=", "list", "(", "arg_1", ")", "for", "arg_7", "in", "arg_0", ":", "if", "arg_7", "in", "arg_6", ":", "arg_4", "+=", "1", "arg_3", "+=", "letter_score", "(", "arg_7", ")", "arg_6", ".", "remove", "(", "arg_7", ")", "else", ":", "arg_5", ".", "append", "(", "letter_score", "(", "arg_7", ")", ")", "for", "arg_8", "in", "sorted", "(", "arg_5", ",", "reverse", "=", "True", ")", ":", "if", "arg_2", ">", "0", ":", "arg_3", "+=", "arg_8", "arg_2", "-=", "1", "if", "arg_4", ">", "6", ":", "arg_3", "+=", "50", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=0):\n    \"\"\"Checks the Scrabble score of a single word.\n\n    Args:\n        word: a string to check the Scrabble score of\n        input_letters: the letters in our rack\n        questions: integer of the tiles already on the board to build on\n\n    Returns:\n        an integer Scrabble score amount for the word\n    \"\"\"\n\n    arg_3 = 0\n    arg_4 = 0\n    arg_5 = []\n    arg_6 = list(arg_1)  # make a copy to speed up find_anagrams()\n    for arg_7 in arg_0:\n        if arg_7 in arg_6:\n            arg_4 += 1\n            arg_3 += letter_score(arg_7)\n            arg_6.remove(arg_7)\n        else:\n            arg_5.append(letter_score(arg_7))\n\n    # we can have both ?'s and _'s in the word. this will apply the ?s to the\n    # highest scrabble score value letters and leave the blanks for low points.\n    for arg_8 in sorted(arg_5, reverse=True):\n        if arg_2 > 0:\n            arg_3 += arg_8\n            arg_2 -= 1\n\n    # 50 bonus points for using all the tiles in your rack\n    if arg_4 > 6:\n        arg_3 += 50\n\n    return arg_3", "path": "nagaram/scrabble.py", "identifier": "word_score", "docstring": "Checks the Scrabble score of a single word.\n\n    Args:\n        word: a string to check the Scrabble score of\n        input_letters: the letters in our rack\n        questions: integer of the tiles already on the board to build on\n\n    Returns:\n        an integer Scrabble score amount for the word", "docstring_tokens": ["Checks", "the", "Scrabble", "score", "of", "a", "single", "word", "."], "nwo": "a-tal/nagaram", "score": 0.09252797783733271, "idx": 251948}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_store.py#L162-L180", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Returns the Message object for this message.", "language": "python", "parameters": "(self, msgid_or_symbol: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "list", ":", "if", "arg_1", "[", "1", ":", "]", ".", "isdigit", "(", ")", ":", "arg_1", "=", "arg_1", ".", "upper", "(", ")", "for", "arg_3", "in", "(", "arg_0", ".", "_alternative_names", ",", "arg_0", ".", "_messages_definitions", ")", ":", "try", ":", "return", "[", "arg_3", "[", "arg_1", "]", "]", "except", "KeyError", ":", "pass", "arg_4", "=", "\"No such message id or symbol '{msgid_or_symbol}'.\"", ".", "format", "(", "arg_1", "=", "arg_1", ")", "raise", "UnknownMessageError", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> list:\n        \"\"\"Returns the Message object for this message.\n\n        :param str msgid_or_symbol: msgid_or_symbol may be either a numeric or symbolic id.\n        :raises UnknownMessageError: if the message id is not defined.\n        :rtype: List of MessageDefinition\n        :return: A message definition corresponding to msgid_or_symbol\n        \"\"\"\n        if arg_1[1:].isdigit():\n            arg_1 = arg_1.upper()\n        for arg_3 in (arg_0._alternative_names, arg_0._messages_definitions):\n            try:\n                return [arg_3[arg_1]]\n            except KeyError:\n                pass\n        arg_4 = \"No such message id or symbol '{msgid_or_symbol}'.\".format(\n            arg_1=arg_1\n        )\n        raise UnknownMessageError(arg_4)", "path": "pylint/message/message_store.py", "identifier": "MessagesStore.get_message_definitions", "docstring": "Returns the Message object for this message.\n\n        :param str msgid_or_symbol: msgid_or_symbol may be either a numeric or symbolic id.\n        :raises UnknownMessageError: if the message id is not defined.\n        :rtype: List of MessageDefinition\n        :return: A message definition corresponding to msgid_or_symbol", "docstring_tokens": ["Returns", "the", "Message", "object", "for", "this", "message", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 251949}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/quit.py#L89-L98", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "quit command when several threads are involved.", "language": "python", "parameters": "(self, arg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "threading", ".", "enumerate", "(", ")", "arg_3", "=", "threading", ".", "currentThread", "(", ")", "for", "arg_4", "in", "arg_2", ":", "if", "arg_4", "!=", "arg_3", ":", "ctype_async_raise", "(", "arg_4", ",", "Mexcept", ".", "DebuggerQuit", ")", "pass", "pass", "raise", "Mexcept", ".", "DebuggerQuit"], "function": "def Func(arg_0, arg_1):\n        \"\"\" quit command when several threads are involved. \"\"\"\n        arg_2 = threading.enumerate()\n        arg_3 =  threading.currentThread()\n        for arg_4 in arg_2:\n            if arg_4 != arg_3:\n                ctype_async_raise(arg_4, Mexcept.DebuggerQuit)\n                pass\n            pass\n        raise Mexcept.DebuggerQuit", "path": "trepan/processor/command/quit.py", "identifier": "QuitCommand.threaded_quit", "docstring": "quit command when several threads are involved.", "docstring_tokens": ["quit", "command", "when", "several", "threads", "are", "involved", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 251950}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L97-L125", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Output profiler report.", "language": "python", "parameters": "(self, stream)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "debug", "(", "'printing profiler Func'", ")", "arg_0", ".", "prof", ".", "close", "(", ")", "arg_2", "=", "stats", ".", "load", "(", "arg_0", ".", "pfile", ")", "arg_2", ".", "sort_stats", "(", "arg_0", ".", "sort", ")", "arg_3", "=", "hasattr", "(", "arg_2", ",", "'stream'", ")", "if", "arg_3", ":", "arg_4", "=", "arg_2", ".", "stream", "arg_2", ".", "stream", "=", "arg_1", "else", ":", "arg_4", "=", "arg_5", ".", "stdout", "arg_5", ".", "stdout", "=", "arg_1", "try", ":", "if", "arg_0", ".", "restrict", ":", "log", ".", "debug", "(", "'setting profiler restriction to %s'", ",", "arg_0", ".", "restrict", ")", "arg_2", ".", "print_stats", "(", "*", "arg_0", ".", "restrict", ")", "else", ":", "arg_2", ".", "print_stats", "(", ")", "finally", ":", "if", "arg_3", ":", "arg_2", ".", "stream", "=", "arg_4", "else", ":", "arg_5", ".", "stdout", "=", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Output profiler Func.\n        \"\"\"\n        log.debug('printing profiler Func')\n        arg_0.prof.close()\n        arg_2 = stats.load(arg_0.pfile)\n        arg_2.sort_stats(arg_0.sort)\n\n        # 2.5 has completely different stream handling from 2.4 and earlier.\n        # Before 2.5, stats objects have no stream attribute; in 2.5 and later\n        # a reference sys.stdout is stored before we can tweak it.\n        arg_3 = hasattr(arg_2, 'stream')\n        if arg_3:\n            arg_4 = arg_2.stream\n            arg_2.stream = arg_1\n        else:\n            arg_4 = arg_5.stdout\n            arg_5.stdout = arg_1\n        try:\n            if arg_0.restrict:\n                log.debug('setting profiler restriction to %s', arg_0.restrict)\n                arg_2.print_stats(*arg_0.restrict)\n            else:\n                arg_2.print_stats()\n        finally:\n            if arg_3:\n                arg_2.stream = arg_4\n            else:\n                arg_5.stdout = arg_4", "path": "environment/lib/python2.7/site-packages/nose/plugins/prof.py", "identifier": "Profile.report", "docstring": "Output profiler report.", "docstring_tokens": ["Output", "profiler", "report", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 251951}
{"url": "https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/response.py#L136-L141", "sha": "2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa", "docstring_summary": "Read response payload and decode.", "language": "python", "parameters": "(self,\n                   *,\n                   encoding: Optional[str] = None,\n                   errors: str = 'strict')", "return_statement": "return await self._aws_text(encoding=encoding, errors=errors)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "None", ",", "arg_4", ":", "arg_3", "=", "'strict'", ")", "->", "arg_3", ":", "return", "await", "arg_0", ".", "_aws_Func", "(", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ")"], "function": "async def Func(arg_0,\n                   *,\n                   arg_1: arg_2[arg_3] = None,\n                   arg_4: arg_3 = 'strict') -> arg_3:\n        \"\"\"Read response payload and decode.\"\"\"\n        return await arg_0._aws_Func(arg_1=arg_1, arg_4=arg_4)", "path": "ruia/response.py", "identifier": "Response.text", "docstring": "Read response payload and decode.", "docstring_tokens": ["Read", "response", "payload", "and", "decode", "."], "nwo": "howie6879/ruia", "score": 0.982354439255647, "idx": 251952}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L365-L391", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "This method will remove any stored records within the range from start to\n    end. Noninclusive of end.", "language": "python", "parameters": "(self, start=0, end=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "htm_prediction_model", ".", "_getAnomalyClassifier", "(", ")", "arg_4", "=", "arg_3", ".", "getSelf", "(", ")", ".", "_knn", "arg_5", "=", "numpy", ".", "array", "(", "arg_3", ".", "getSelf", "(", ")", ".", "getParameter", "(", "'categoryRecencyList'", ")", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_5", ".", "max", "(", ")", "+", "1", "arg_6", "=", "numpy", ".", "logical_and", "(", "arg_5", ">=", "arg_1", ",", "arg_5", "<", "arg_2", ")", "arg_7", "=", "arg_5", "[", "arg_6", "]", "arg_8", "=", "arg_4", ".", "_numPatterns", "arg_4", ".", "removeIds", "(", "arg_7", ".", "tolist", "(", ")", ")", "assert", "arg_4", ".", "_numPatterns", "==", "arg_8", "-", "len", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=None):\n    \"\"\"\n    This method will remove any stored records within the range from start to\n    end. Noninclusive of end.\n\n    parameters\n    ------------\n    start - integer representing the ROWID of the start of the deletion range,\n    end - integer representing the ROWID of the end of the deletion range,\n      if None, it will default to end.\n    \"\"\"\n    arg_3 = arg_0.htm_prediction_model._getAnomalyClassifier()\n    arg_4 = arg_3.getSelf()._knn\n\n    arg_5 = numpy.array(\n      arg_3.getSelf().getParameter('categoryRecencyList'))\n\n    if arg_2 is None:\n      arg_2 = arg_5.max() + 1\n\n    arg_6 = numpy.logical_and(arg_5 >= arg_1,\n                                       arg_5 < arg_2)\n    arg_7 = arg_5[arg_6]\n\n    arg_8 = arg_4._numPatterns\n    arg_4.removeIds(arg_7.tolist())\n    assert arg_4._numPatterns == arg_8 - len(arg_7)", "path": "src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py", "identifier": "HTMPredictionModelClassifierHelper._deleteRangeFromKNN", "docstring": "This method will remove any stored records within the range from start to\n    end. Noninclusive of end.\n\n    parameters\n    ------------\n    start - integer representing the ROWID of the start of the deletion range,\n    end - integer representing the ROWID of the end of the deletion range,\n      if None, it will default to end.", "docstring_tokens": ["This", "method", "will", "remove", "any", "stored", "records", "within", "the", "range", "from", "start", "to", "end", ".", "Noninclusive", "of", "end", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 251953}
{"url": "https://github.com/attm2x/m2x-python/blob/df83f590114692b1f96577148b7ba260065905bb/m2x/v2/resource.py#L17-L34", "sha": "df83f590114692b1f96577148b7ba260065905bb", "docstring_summary": "Generic method for a resource's Update endpoint.", "language": "python", "parameters": "(self, **attrs)", "return_statement": "return self.data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_0", ".", "data", ".", "Func", "(", "arg_0", ".", "item_Func", "(", "arg_0", ".", "api", ",", "arg_0", ".", "id", ",", "**", "arg_1", ")", ")", "return", "arg_0", ".", "data"], "function": "def Func(arg_0, **arg_1):\n        \"\"\" Generic method for a resource's Update endpoint.\n\n        Example endpoints:\n\n        * `Update Device Details <https://m2x.att.com/developer/documentation/v2/device#Update-Device-Details>`_\n        * `Update Distribution Details <https://m2x.att.com/developer/documentation/v2/distribution#Update-Distribution-Details>`_\n        * `Update Collection Details <https://m2x.att.com/developer/documentation/v2/collections#Update-Collection-Details>`_\n\n        :param attrs: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.\n\n        :return: The API response, see M2X API docs for details\n        :rtype: dict\n\n        :raises: :class:`~requests.exceptions.HTTPError` if an error occurs when sending the HTTP request\n        \"\"\"\n        arg_0.data.Func(arg_0.item_Func(arg_0.api, arg_0.id, **arg_1))\n        return arg_0.data", "path": "m2x/v2/resource.py", "identifier": "Resource.update", "docstring": "Generic method for a resource's Update endpoint.\n\n        Example endpoints:\n\n        * `Update Device Details <https://m2x.att.com/developer/documentation/v2/device#Update-Device-Details>`_\n        * `Update Distribution Details <https://m2x.att.com/developer/documentation/v2/distribution#Update-Distribution-Details>`_\n        * `Update Collection Details <https://m2x.att.com/developer/documentation/v2/collections#Update-Collection-Details>`_\n\n        :param attrs: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.\n\n        :return: The API response, see M2X API docs for details\n        :rtype: dict\n\n        :raises: :class:`~requests.exceptions.HTTPError` if an error occurs when sending the HTTP request", "docstring_tokens": ["Generic", "method", "for", "a", "resource", "s", "Update", "endpoint", "."], "nwo": "attm2x/m2x-python", "score": 0.19366109606417514, "idx": 251954}
{"url": "https://github.com/mwhooker/jsonselect/blob/c64aa9ea930de0344797ff87b04c753c8fc096a6/jsonselect/jsonselect.py#L98-L114", "sha": "c64aa9ea930de0344797ff87b04c753c8fc096a6", "docstring_summary": "Yields each node of object graph in postorder.", "language": "python", "parameters": "(obj, parent=None, parent_key=None, idx=None,\n                siblings=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "Node", "(", "value", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_6", "=", "len", "(", "arg_0", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_0", ")", ":", "for", "arg_9", "in", "Func", "(", "arg_8", ",", "arg_5", ",", "None", ",", "arg_7", "+", "1", ",", "arg_6", ")", ":", "yield", "arg_9", "elif", "isinstance", "(", "arg_0", ",", "collections", ".", "Mapping", ")", ":", "for", "arg_10", "in", "arg_0", ":", "for", "arg_9", "in", "Func", "(", "arg_0", "[", "arg_10", "]", ",", "arg_5", ",", "arg_10", ")", ":", "yield", "arg_9", "yield", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n                arg_4=None):\n    \"\"\"Yields each node of object graph in postorder.\"\"\"\n\n    arg_5 = Node(value=arg_0, arg_1=arg_1, arg_2=arg_2,\n                arg_4=arg_4, arg_3=arg_3)\n\n    if isinstance(arg_0, list):\n        arg_6 = len(arg_0)\n        for arg_7, arg_8 in enumerate(arg_0):\n            for arg_9 in Func(arg_8, arg_5, None, arg_7 + 1, arg_6):\n                yield arg_9\n    elif isinstance(arg_0, collections.Mapping):\n        for arg_10 in arg_0:\n            for arg_9 in Func(arg_0[arg_10], arg_5, arg_10):\n                yield arg_9\n    yield arg_5", "path": "jsonselect/jsonselect.py", "identifier": "object_iter", "docstring": "Yields each node of object graph in postorder.", "docstring_tokens": ["Yields", "each", "node", "of", "object", "graph", "in", "postorder", "."], "nwo": "mwhooker/jsonselect", "score": 0.27365494979801214, "idx": 251955}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/client/client.py#L604-L640", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "PUTs the object and returns the results. This is used to\n        create or overwrite objects. X-Object-Meta-xxx can optionally\n        be sent to be stored with the object. Content-Type,\n        Content-Encoding and other standard HTTP headers can often\n        also be set, depending on the Swift cluster.", "language": "python", "parameters": "(self, container, obj, contents, headers=None, query=None,\n                   cdn=False)", "return_statement": "return self.request(\n            'PUT', path, contents, headers, query=query, cdn=cdn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "arg_0", ".", "_object_path", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "request", "(", "'PUT'", ",", "arg_7", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None,\n                   arg_6=False):\n        \"\"\"\n        PUTs the object and returns the results. This is used to\n        create or overwrite objects. X-Object-Meta-xxx can optionally\n        be sent to be stored with the object. Content-Type,\n        Content-Encoding and other standard HTTP headers can often\n        also be set, depending on the Swift cluster.\n\n        Note that you can set the ETag header to the MD5 sum of the\n        contents for extra verification the object was stored\n        correctly.\n\n        :param container: The name of the container.\n        :param obj: The name of the object.\n        :param contents: The contents of the object to store. This can\n            be a simple str, or a file-like-object with at least a\n            read function. If the file-like-object also has tell and\n            seek functions, the PUT can be reattempted on any server\n            error.\n        :param headers: Additional headers to send with the request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: is the str for the HTTP body.\n        \"\"\"\n        arg_7 = arg_0._object_path(arg_1, arg_2)\n        return arg_0.request(\n            'PUT', arg_7, arg_3, arg_4, arg_5=arg_5, arg_6=arg_6)", "path": "swiftly/client/client.py", "identifier": "Client.put_object", "docstring": "PUTs the object and returns the results. This is used to\n        create or overwrite objects. X-Object-Meta-xxx can optionally\n        be sent to be stored with the object. Content-Type,\n        Content-Encoding and other standard HTTP headers can often\n        also be set, depending on the Swift cluster.\n\n        Note that you can set the ETag header to the MD5 sum of the\n        contents for extra verification the object was stored\n        correctly.\n\n        :param container: The name of the container.\n        :param obj: The name of the object.\n        :param contents: The contents of the object to store. This can\n            be a simple str, or a file-like-object with at least a\n            read function. If the file-like-object also has tell and\n            seek functions, the PUT can be reattempted on any server\n            error.\n        :param headers: Additional headers to send with the request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: is the str for the HTTP body.", "docstring_tokens": ["PUTs", "the", "object", "and", "returns", "the", "results", ".", "This", "is", "used", "to", "create", "or", "overwrite", "objects", ".", "X", "-", "Object", "-", "Meta", "-", "xxx", "can", "optionally", "be", "sent", "to", "be", "stored", "with", "the", "object", ".", "Content", "-", "Type", "Content", "-", "Encoding", "and", "other", "standard", "HTTP", "headers", "can", "often", "also", "be", "set", "depending", "on", "the", "Swift", "cluster", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 251956}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L844-L851", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Get item with min key of tree, raises ValueError if tree is empty.", "language": "python", "parameters": "(self)", "return_statement": "return node.key, node.value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "is_empty", "(", ")", ":", "raise", "ValueError", "(", "\"Tree is empty\"", ")", "arg_1", "=", "arg_0", ".", "_root", "while", "arg_1", ".", "left", "is", "not", "None", ":", "arg_1", "=", "arg_1", ".", "left", "return", "arg_1", ".", "key", ",", "arg_1", ".", "value"], "function": "def Func(arg_0):\n        \"\"\"Get item with min key of tree, raises ValueError if tree is empty.\"\"\"\n        if arg_0.is_empty():\n            raise ValueError(\"Tree is empty\")\n        arg_1 = arg_0._root\n        while arg_1.left is not None:\n            arg_1 = arg_1.left\n        return arg_1.key, arg_1.value", "path": "imgaug/external/poly_point_isect_py2py3.py", "identifier": "_ABCTree.min_item", "docstring": "Get item with min key of tree, raises ValueError if tree is empty.", "docstring_tokens": ["Get", "item", "with", "min", "key", "of", "tree", "raises", "ValueError", "if", "tree", "is", "empty", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 251957}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/filters.py#L55-L71", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "A function to construct a hierarchical dictionary representing the different citation layers of a text", "language": "python", "parameters": "(reffs, citation)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "OrderedDict", "(", ")", "arg_3", "=", "[", "x", "for", "x", "in", "arg_1", "]", "for", "arg_4", ",", "arg_5", "in", "arg_0", ":", "arg_6", "=", "arg_4", ".", "split", "(", "'-'", ")", "[", "0", "]", "arg_7", "=", "[", "'%{}|{}%'", ".", "format", "(", "arg_3", "[", "i", "]", ".", "name", ",", "v", ")", "for", "i", ",", "v", "in", "enumerate", "(", "arg_6", ".", "split", "(", "'.'", ")", ")", "]", "arg_8", "(", "arg_2", ",", "arg_7", "[", ":", "-", "1", "]", ")", "[", "arg_5", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" A function to construct a hierarchical dictionary representing the different citation layers of a text\n\n    :param reffs: passage references with human-readable equivalent\n    :type reffs: [(str, str)]\n    :param citation: Main Citation\n    :type citation: Citation\n    :return: nested dictionary representing where keys represent the names of the levels and the final values represent the passage reference\n    :rtype: OrderedDict\n    \"\"\"\n    arg_2 = OrderedDict()\n    arg_3 = [x for x in arg_1]\n    for arg_4, arg_5 in arg_0:\n        arg_6 = arg_4.split('-')[0]\n        arg_7 = ['%{}|{}%'.format(arg_3[i].name, v) for i, v in enumerate(arg_6.split('.'))]\n        arg_8(arg_2, arg_7[:-1])[arg_5] = arg_4\n    return arg_2", "path": "flask_nemo/filters.py", "identifier": "f_hierarchical_passages", "docstring": "A function to construct a hierarchical dictionary representing the different citation layers of a text\n\n    :param reffs: passage references with human-readable equivalent\n    :type reffs: [(str, str)]\n    :param citation: Main Citation\n    :type citation: Citation\n    :return: nested dictionary representing where keys represent the names of the levels and the final values represent the passage reference\n    :rtype: OrderedDict", "docstring_tokens": ["A", "function", "to", "construct", "a", "hierarchical", "dictionary", "representing", "the", "different", "citation", "layers", "of", "a", "text"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 251958}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/shifts.py#L52-L64", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Creates a shift", "language": "python", "parameters": "(self, params={})", "return_statement": "return shift", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ")", ":", "arg_2", "=", "\"/2/shifts/\"", "arg_3", "=", "arg_1", "arg_4", "=", "arg_0", ".", "_post_resource", "(", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "shift_from_json", "(", "arg_4", "[", "\"shift\"", "]", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1={}):\n        \"\"\"\n        Creates a shift\n\n        http://dev.wheniwork.com/#create/update-shift\n        \"\"\"\n        arg_2 = \"/2/shifts/\"\n        arg_3 = arg_1\n\n        arg_4 = arg_0._post_resource(arg_2, arg_3)\n        arg_5 = arg_0.shift_from_json(arg_4[\"shift\"])\n\n        return arg_5", "path": "uw_wheniwork/shifts.py", "identifier": "Shifts.create_shift", "docstring": "Creates a shift\n\n        http://dev.wheniwork.com/#create/update-shift", "docstring_tokens": ["Creates", "a", "shift"], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 251959}
{"url": "https://github.com/kenneth-reitz/dynamo/blob/e24276a7e68d868857fd1d0deabccd001920e0c2/dynamo.py#L113-L119", "sha": "e24276a7e68d868857fd1d0deabccd001920e0c2", "docstring_summary": "Returns a given table for the given user.", "language": "python", "parameters": "(name, auth=None, eager=True)", "return_statement": "return Table(table=table, eager=eager)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ")", ":", "arg_1", "=", "arg_1", "or", "[", "]", "arg_3", "=", "boto", ".", "connect_dynamodb", "(", "*", "arg_1", ")", "Func", "=", "arg_3", ".", "get_table", "(", "arg_0", ")", "return", "Table", "(", "Func", "=", "Func", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=True):\n    \"\"\"Returns a given table for the given user.\"\"\"\n    arg_1 = arg_1 or []\n    arg_3 = boto.connect_dynamodb(*arg_1)\n\n    Func = arg_3.get_table(arg_0)\n    return Table(Func=Func, arg_2=arg_2)", "path": "dynamo.py", "identifier": "table", "docstring": "Returns a given table for the given user.", "docstring_tokens": ["Returns", "a", "given", "table", "for", "the", "given", "user", "."], "nwo": "kenneth-reitz/dynamo", "score": 0.18579120894425885, "idx": 251960}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L119-L146", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "clearRedisPools - Disconnect all managed connection pools, \n\t\t   and clear the connectiobn_pool attribute on all stored managed connection pools.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "RedisPools", "global", "_redisManagedConnectionParams", "for", "arg_0", "in", "RedisPools", ".", "values", "(", ")", ":", "try", ":", "arg_0", ".", "disconnect", "(", ")", "except", ":", "pass", "for", "arg_1", "in", "_redisManagedConnectionParams", ".", "values", "(", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "'connection_pool'", "in", "arg_2", ":", "del", "arg_2", "[", "'connection_pool'", "]", "RedisPools", ".", "clear", "(", ")", "_redisManagedConnectionParams", ".", "clear", "(", ")"], "function": "def Func():\n\t'''\n\t\tFunc - Disconnect all managed connection pools, \n\t\t   and clear the connectiobn_pool attribute on all stored managed connection pools.\n\n\t\t   A \"managed\" connection pool is one where REDIS_CONNECTION_PARAMS does not define the \"connection_pool\" attribute.\n\t\t   If you define your own pools, IndexedRedis will use them and leave them alone.\n\n\t\t  This method will be called automatically after calling setDefaultRedisConnectionParams.\n\n\t\t  Otherwise, you shouldn't have to call it.. Maybe as some sort of disaster-recovery call..\n\t'''\n\tglobal RedisPools\n\tglobal _redisManagedConnectionParams\n\n\tfor arg_0 in RedisPools.values():\n\t\ttry:\n\t\t\targ_0.disconnect()\n\t\texcept:\n\t\t\tpass\n\t\n\tfor arg_1 in _redisManagedConnectionParams.values():\n\t\tfor arg_2 in arg_1:\n\t\t\tif 'connection_pool' in arg_2:\n\t\t\t\tdel arg_2['connection_pool']\n\t\n\tRedisPools.clear()\n\t_redisManagedConnectionParams.clear()", "path": "IndexedRedis/__init__.py", "identifier": "clearRedisPools", "docstring": "clearRedisPools - Disconnect all managed connection pools, \n\t\t   and clear the connectiobn_pool attribute on all stored managed connection pools.\n\n\t\t   A \"managed\" connection pool is one where REDIS_CONNECTION_PARAMS does not define the \"connection_pool\" attribute.\n\t\t   If you define your own pools, IndexedRedis will use them and leave them alone.\n\n\t\t  This method will be called automatically after calling setDefaultRedisConnectionParams.\n\n\t\t  Otherwise, you shouldn't have to call it.. Maybe as some sort of disaster-recovery call..", "docstring_tokens": ["clearRedisPools", "-", "Disconnect", "all", "managed", "connection", "pools", "and", "clear", "the", "connectiobn_pool", "attribute", "on", "all", "stored", "managed", "connection", "pools", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 251961}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/gmail.py#L120-L140", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Gets valid user credentials from storage.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "AUTHENTICATION_LOCK", ":", "log", ".", "info", "(", "'Starting authentication for %s'", ",", "arg_0", ".", "target", ")", "arg_1", "=", "oauth2client", ".", "file", ".", "Storage", "(", "arg_0", ".", "credentials_path", ")", "arg_2", "=", "arg_1", ".", "get", "(", ")", "if", "not", "arg_2", "or", "arg_2", ".", "invalid", ":", "log", ".", "info", "(", "\"No valid login. Starting OAUTH flow.\"", ")", "arg_3", "=", "oauth2client", ".", "client", ".", "flow_from_clientsecrets", "(", "arg_0", ".", "client_secret_path", ",", "arg_0", ".", "SCOPES", ")", "arg_3", ".", "user_agent", "=", "arg_0", ".", "APPLICATION_NAME", "arg_5", "=", "oauth2client", ".", "tools", ".", "argparser", ".", "parse_args", "(", "[", "]", ")", "arg_2", "=", "oauth2client", ".", "tools", ".", "run_flow", "(", "arg_3", ",", "arg_1", ",", "arg_5", ")", "log", ".", "info", "(", "'Storing credentials to %r'", ",", "arg_0", ".", "credentials_path", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Gets valid user credentials from storage.\n\n        If nothing has been stored, or if the stored credentials are invalid,\n        the OAuth2 flow is completed to obtain the new credentials.\n\n        Returns:\n            Credentials, the obtained credential.\n        \"\"\"\n        with arg_0.AUTHENTICATION_LOCK:\n            log.info('Starting authentication for %s', arg_0.target)\n            arg_1 = oauth2client.file.Storage(arg_0.credentials_path)\n            arg_2 = arg_1.get()\n            if not arg_2 or arg_2.invalid:\n                log.info(\"No valid login. Starting OAUTH flow.\")\n                arg_3 = oauth2client.client.flow_from_clientsecrets(arg_0.client_secret_path, arg_0.SCOPES)\n                arg_3.user_agent = arg_0.APPLICATION_NAME\n                arg_5 = oauth2client.tools.argparser.parse_args([])\n                arg_2 = oauth2client.tools.run_flow(arg_3, arg_1, arg_5)\n                log.info('Storing credentials to %r', arg_0.credentials_path)\n            return arg_2", "path": "bugwarrior/services/gmail.py", "identifier": "GmailService.get_credentials", "docstring": "Gets valid user credentials from storage.\n\n        If nothing has been stored, or if the stored credentials are invalid,\n        the OAuth2 flow is completed to obtain the new credentials.\n\n        Returns:\n            Credentials, the obtained credential.", "docstring_tokens": ["Gets", "valid", "user", "credentials", "from", "storage", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 251962}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/interfaces/utils.py#L57-L67", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Propagate \"clk\" clock and reset \"rst\" signal to all subcomponents", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "clk", "arg_2", "=", "arg_0", ".", "rst", "for", "arg_3", "in", "arg_0", ".", "_units", ":", "_tryConnect", "(", "arg_1", ",", "arg_3", ",", "'clk'", ")", "_tryConnect", "(", "~", "arg_2", ",", "arg_3", ",", "'rst_n'", ")", "_tryConnect", "(", "arg_2", ",", "arg_3", ",", "'rst'", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Propagate \"clk\" clock and reset \"rst\" signal to all subcomponents\n    \"\"\"\n    arg_1 = arg_0.clk\n    arg_2 = arg_0.rst\n\n    for arg_3 in arg_0._units:\n        _tryConnect(arg_1, arg_3, 'clk')\n        _tryConnect(~arg_2, arg_3, 'rst_n')\n        _tryConnect(arg_2, arg_3, 'rst')", "path": "hwt/interfaces/utils.py", "identifier": "propagateClkRst", "docstring": "Propagate \"clk\" clock and reset \"rst\" signal to all subcomponents", "docstring_tokens": ["Propagate", "clk", "clock", "and", "reset", "rst", "signal", "to", "all", "subcomponents"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 251963}
{"url": "https://github.com/andreikop/python-ws-discovery/blob/a7b852cf43115c6f986e509b1870d6963e76687f/wsdiscovery/daemon.py#L291-L303", "sha": "a7b852cf43115c6f986e509b1870d6963e76687f", "docstring_summary": "Set callback, which will be called when new service appeared online\n        and sent Hi message", "language": "python", "parameters": "(self, cb, types=None, scopes=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "_remoteServiceHelloCallback", "=", "arg_1", "arg_0", ".", "_remoteServiceHelloCallbackTypesFilter", "=", "arg_2", "arg_0", ".", "_remoteServiceHelloCallbackScopesFilter", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Set callback, which will be called when new service appeared online\n        and sent Hi message\n\n        typesFilter and scopesFilter might be list of types and scopes.\n        If filter is set, callback is called only for Hello messages,\n        which match filter\n\n        Set None to disable callback\n        \"\"\"\n        arg_0._remoteServiceHelloCallback = arg_1\n        arg_0._remoteServiceHelloCallbackTypesFilter = arg_2\n        arg_0._remoteServiceHelloCallbackScopesFilter = arg_3", "path": "wsdiscovery/daemon.py", "identifier": "WSDiscovery.setRemoteServiceHelloCallback", "docstring": "Set callback, which will be called when new service appeared online\n        and sent Hi message\n\n        typesFilter and scopesFilter might be list of types and scopes.\n        If filter is set, callback is called only for Hello messages,\n        which match filter\n\n        Set None to disable callback", "docstring_tokens": ["Set", "callback", "which", "will", "be", "called", "when", "new", "service", "appeared", "online", "and", "sent", "Hi", "message"], "nwo": "andreikop/python-ws-discovery", "score": 0.7152725855878354, "idx": 251964}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/components/init.py#L264-L274", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "Init project.", "language": "python", "parameters": "(cls)", "return_statement": "return [\n            (('--yes',), dict(action='store_true', help='clean .git repo')),\n            (('--variable', '-s'),\n             dict(nargs='+', help='set extra variable,format is name:value')),\n            (('--skip-builtin',),\n             dict(action='store_true', help='skip replace builtin variable')),\n        ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "(", "(", "'--yes'", ",", ")", ",", "dict", "(", "action", "=", "'store_true'", ",", "help", "=", "'clean .git repo'", ")", ")", ",", "(", "(", "'--variable'", ",", "'-s'", ")", ",", "dict", "(", "nargs", "=", "'+'", ",", "help", "=", "'set extra variable,format is name:value'", ")", ")", ",", "(", "(", "'--skip-builtin'", ",", ")", ",", "dict", "(", "action", "=", "'store_true'", ",", "help", "=", "'skip replace builtin variable'", ")", ")", ",", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Init project.\n        \"\"\"\n        return [\n            (('--yes',), dict(action='store_true', help='clean .git repo')),\n            (('--variable', '-s'),\n             dict(nargs='+', help='set extra variable,format is name:value')),\n            (('--skip-builtin',),\n             dict(action='store_true', help='skip replace builtin variable')),\n        ]", "path": "cliez/components/init.py", "identifier": "InitComponent.add_arguments", "docstring": "Init project.", "docstring_tokens": ["Init", "project", "."], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 251965}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/bbs.py#L954-L1005", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Draw all bounding boxes onto a given image.", "language": "python", "parameters": "(self, image, color=(0, 255, 0), alpha=1.0, size=1,\n                      copy=True, raise_if_out_of_image=False, thickness=None)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "0", ",", "255", ",", "0", ")", ",", "arg_3", "=", "1.0", ",", "arg_4", "=", "1", ",", "arg_5", "=", "True", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ")", ":", "arg_1", "=", "np", ".", "copy", "(", "arg_1", ")", "if", "arg_5", "else", "arg_1", "for", "arg_8", "in", "arg_0", ".", "bounding_boxes", ":", "arg_1", "=", "arg_8", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "False", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=(0, 255, 0), arg_3=1.0, arg_4=1,\n                      arg_5=True, arg_6=False, arg_7=None):\n        \"\"\"\n        Draw all bounding boxes onto a given image.\n\n        Parameters\n        ----------\n        image : (H,W,3) ndarray\n            The image onto which to draw the bounding boxes.\n            This image should usually have the same shape as\n            set in BoundingBoxesOnImage.shape.\n\n        color : int or list of int or tuple of int or (3,) ndarray, optional\n            The RGB color of all bounding boxes. If a single int ``C``, then\n            that is equivalent to ``(C,C,C)``.\n\n        alpha : float, optional\n            Alpha/transparency of the bounding box.\n\n        size : int, optional\n            Thickness in pixels.\n\n        copy : bool, optional\n            Whether to copy the image before drawing the bounding boxes.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an exception if any bounding box is outside of the\n            image.\n\n        thickness : None or int, optional\n            Deprecated.\n\n        Returns\n        -------\n        image : (H,W,3) ndarray\n            Image with drawn bounding boxes.\n\n        \"\"\"\n        arg_1 = np.copy(arg_1) if arg_5 else arg_1\n\n        for arg_8 in arg_0.bounding_boxes:\n            arg_1 = arg_8.Func(\n                arg_1,\n                arg_2=arg_2,\n                arg_3=arg_3,\n                arg_4=arg_4,\n                arg_5=False,\n                arg_6=arg_6,\n                arg_7=arg_7\n            )\n\n        return arg_1", "path": "imgaug/augmentables/bbs.py", "identifier": "BoundingBoxesOnImage.draw_on_image", "docstring": "Draw all bounding boxes onto a given image.\n\n        Parameters\n        ----------\n        image : (H,W,3) ndarray\n            The image onto which to draw the bounding boxes.\n            This image should usually have the same shape as\n            set in BoundingBoxesOnImage.shape.\n\n        color : int or list of int or tuple of int or (3,) ndarray, optional\n            The RGB color of all bounding boxes. If a single int ``C``, then\n            that is equivalent to ``(C,C,C)``.\n\n        alpha : float, optional\n            Alpha/transparency of the bounding box.\n\n        size : int, optional\n            Thickness in pixels.\n\n        copy : bool, optional\n            Whether to copy the image before drawing the bounding boxes.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an exception if any bounding box is outside of the\n            image.\n\n        thickness : None or int, optional\n            Deprecated.\n\n        Returns\n        -------\n        image : (H,W,3) ndarray\n            Image with drawn bounding boxes.", "docstring_tokens": ["Draw", "all", "bounding", "boxes", "onto", "a", "given", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 251966}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kerncraft.py#L308-L320", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Initialize and run command line interface.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "create_parser", "(", ")", "arg_1", "=", "arg_0", ".", "parse_args", "(", ")", "check_arguments", "(", "arg_1", ",", "arg_0", ")", "run", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func():\n    \"\"\"Initialize and run command line interface.\"\"\"\n    # Create and populate parser\n    arg_0 = create_parser()\n\n    # Parse given arguments\n    arg_1 = arg_0.parse_args()\n\n    # Checking arguments\n    check_arguments(arg_1, arg_0)\n\n    # BUSINESS LOGIC IS FOLLOWING\n    run(arg_0, arg_1)", "path": "kerncraft/kerncraft.py", "identifier": "main", "docstring": "Initialize and run command line interface.", "docstring_tokens": ["Initialize", "and", "run", "command", "line", "interface", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 251967}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/dbapi_hook.py#L168-L177", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Sets the autocommit flag on the connection", "language": "python", "parameters": "(self, conn, autocommit)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "supports_autocommit", "and", "arg_2", ":", "arg_0", ".", "log", ".", "warn", "(", "(", "\"%s connection doesn't support \"", "\"autocommit but autocommit activated.\"", ")", ",", "getattr", "(", "arg_0", ",", "arg_0", ".", "conn_name_attr", ")", ")", "arg_1", ".", "autocommit", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Sets the autocommit flag on the connection\n        \"\"\"\n        if not arg_0.supports_autocommit and arg_2:\n            arg_0.log.warn(\n                (\"%s connection doesn't support \"\n                 \"autocommit but autocommit activated.\"),\n                getattr(arg_0, arg_0.conn_name_attr))\n        arg_1.autocommit = arg_2", "path": "airflow/hooks/dbapi_hook.py", "identifier": "DbApiHook.set_autocommit", "docstring": "Sets the autocommit flag on the connection", "docstring_tokens": ["Sets", "the", "autocommit", "flag", "on", "the", "connection"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 251968}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3225-L3232", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Jumps short if RCX register is 0.", "language": "python", "parameters": "(cpu, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "arg_0", ".", "RCX", "==", "0", ",", "arg_1", ".", "read", "(", ")", ",", "arg_0", ".", "PC", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Jumps short if RCX register is 0.\n\n        :param cpu: current CPU.\n        :param target: destination operand.\n        \"\"\"\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, arg_0.RCX == 0, arg_1.read(), arg_0.PC)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.JRCXZ", "docstring": "Jumps short if RCX register is 0.\n\n        :param cpu: current CPU.\n        :param target: destination operand.", "docstring_tokens": ["Jumps", "short", "if", "RCX", "register", "is", "0", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 251969}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/h5/h5.py#L28-L44", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Gets an array from datasets.", "language": "python", "parameters": "(f, key, default=None)", "return_statement": "return default", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "in", "arg_0", ".", "keys", "(", ")", ":", "arg_3", "=", "arg_0", "[", "arg_1", "]", ".", "value", "if", "arg_2", "is", "None", ":", "return", "arg_3", "else", ":", "if", "_np", ".", "shape", "(", "arg_3", ")", "==", "_np", ".", "shape", "(", "arg_2", ")", ":", "return", "arg_3", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Gets an array from datasets.\n\n    .. versionadded:: 1.4\n    \"\"\"\n\n    if arg_1 in arg_0.keys():\n        arg_3 = arg_0[arg_1].value\n\n        if arg_2 is None:\n            return arg_3\n        else:\n            if _np.shape(arg_3) == _np.shape(arg_2):\n                return arg_3\n\n    return arg_2", "path": "scisalt/h5/h5.py", "identifier": "get", "docstring": "Gets an array from datasets.\n\n    .. versionadded:: 1.4", "docstring_tokens": ["Gets", "an", "array", "from", "datasets", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 251970}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L196-L251", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Opens an SSH connection.", "language": "python", "parameters": "(self, gui=0, command='', dryrun=None, shell_interactive_cmd_str=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "''", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "from", "burlap", ".", "common", "import", "get_hosts_for_site", "if", "arg_3", "is", "not", "None", ":", "arg_0", ".", "dryrun", "=", "arg_3", "arg_5", "=", "arg_0", ".", "local_renderer", "if", "arg_5", ".", "genv", ".", "SITE", "!=", "arg_5", ".", "genv", ".", "default_site", ":", "arg_6", "=", "get_hosts_for_site", "(", ")", "if", "arg_6", ":", "arg_5", ".", "genv", ".", "host_string", "=", "arg_6", "[", "0", "]", "arg_5", ".", "env", ".", "SITE", "=", "arg_5", ".", "genv", ".", "SITE", "or", "arg_5", ".", "genv", ".", "default_site", "if", "int", "(", "arg_1", ")", ":", "arg_5", ".", "env", ".", "Func_default_options", ".", "append", "(", "'-X'", ")", "if", "'host_string'", "not", "in", "arg_0", ".", "genv", "or", "not", "arg_0", ".", "genv", ".", "host_string", ":", "if", "'available_sites'", "in", "arg_0", ".", "genv", "and", "arg_5", ".", "env", ".", "SITE", "not", "in", "arg_5", ".", "genv", ".", "available_sites", ":", "raise", "Exception", "(", "'No host_string set. Unknown site %s.'", "%", "arg_5", ".", "env", ".", "SITE", ")", "else", ":", "raise", "Exception", "(", "'No host_string set.'", ")", "if", "'@'", "in", "arg_5", ".", "genv", ".", "host_string", ":", "arg_5", ".", "env", ".", "Func_host_string", "=", "arg_5", ".", "genv", ".", "host_string", "else", ":", "arg_5", ".", "env", ".", "Func_host_string", "=", "'{user}@{host_string}'", "if", "arg_2", ":", "arg_5", ".", "env", ".", "Func_interactive_cmd_str", "=", "arg_2", "else", ":", "arg_5", ".", "env", ".", "Func_interactive_cmd_str", "=", "arg_5", ".", "format", "(", "arg_4", "or", "arg_5", ".", "env", ".", "Func_interactive_cmd", ")", "arg_5", ".", "env", ".", "Func_default_options_str", "=", "' '", ".", "join", "(", "arg_5", ".", "env", ".", "Func_default_options", ")", "if", "arg_0", ".", "is_local", ":", "arg_0", ".", "vprint", "(", "'Using direct local.'", ")", "arg_13", "=", "'{Func_interactive_cmd_str}'", "elif", "arg_5", ".", "genv", ".", "key_filename", ":", "arg_0", ".", "vprint", "(", "'Using key filename.'", ")", "arg_14", "=", "arg_5", ".", "env", ".", "Func_host_string", ".", "split", "(", "':'", ")", "[", "-", "1", "]", "if", "arg_14", ".", "isdigit", "(", ")", ":", "arg_5", ".", "env", ".", "Func_host_string", "=", "arg_5", ".", "env", ".", "Func_host_string", ".", "split", "(", "':'", ")", "[", "0", "]", "+", "(", "' -p %s'", "%", "arg_14", ")", "arg_13", "=", "'ssh -t {Func_default_options_str} -i {key_filename} {Func_host_string} \"{Func_interactive_cmd_str}\"'", "elif", "arg_5", ".", "genv", ".", "password", ":", "arg_0", ".", "vprint", "(", "'Using password.'", ")", "arg_13", "=", "'ssh -t {Func_default_options_str} {Func_host_string} \"{Func_interactive_cmd_str}\"'", "else", ":", "arg_0", ".", "vprint", "(", "'Using nothing.'", ")", "arg_13", "=", "'ssh -t {Func_default_options_str} {Func_host_string} \"{Func_interactive_cmd_str}\"'", "arg_5", ".", "local", "(", "arg_13", ")"], "function": "def Func(arg_0, arg_1=0, arg_2='', arg_3=None, arg_4=None):\n        \"\"\"\n        Opens an SSH connection.\n        \"\"\"\n        from burlap.common import get_hosts_for_site\n\n        if arg_3 is not None:\n            arg_0.dryrun = arg_3\n\n        arg_5 = arg_0.local_renderer\n\n        if arg_5.genv.SITE != arg_5.genv.default_site:\n            arg_6 = get_hosts_for_site()\n            if arg_6:\n                arg_5.genv.host_string = arg_6[0]\n\n        arg_5.env.SITE = arg_5.genv.SITE or arg_5.genv.default_site\n\n        if int(arg_1):\n            arg_5.env.Func_default_options.append('-X')\n\n        if 'host_string' not in arg_0.genv or not arg_0.genv.host_string:\n            if 'available_sites' in arg_0.genv and arg_5.env.SITE not in arg_5.genv.available_sites:\n                raise Exception('No host_string set. Unknown site %s.' % arg_5.env.SITE)\n            else:\n                raise Exception('No host_string set.')\n\n        if '@' in arg_5.genv.host_string:\n            arg_5.env.Func_host_string = arg_5.genv.host_string\n        else:\n            arg_5.env.Func_host_string = '{user}@{host_string}'\n\n        if arg_2:\n            arg_5.env.Func_interactive_cmd_str = arg_2\n        else:\n            arg_5.env.Func_interactive_cmd_str = arg_5.format(arg_4 or arg_5.env.Func_interactive_cmd)\n\n        arg_5.env.Func_default_options_str = ' '.join(arg_5.env.Func_default_options)\n        if arg_0.is_local:\n            arg_0.vprint('Using direct local.')\n            arg_13 = '{Func_interactive_cmd_str}'\n        elif arg_5.genv.key_filename:\n            arg_0.vprint('Using key filename.')\n            # If host_string contains the port, then strip it off and pass separately.\n            arg_14 = arg_5.env.Func_host_string.split(':')[-1]\n            if arg_14.isdigit():\n                arg_5.env.Func_host_string = arg_5.env.Func_host_string.split(':')[0] + (' -p %s' % arg_14)\n            arg_13 = 'ssh -t {Func_default_options_str} -i {key_filename} {Func_host_string} \"{Func_interactive_cmd_str}\"'\n        elif arg_5.genv.password:\n            arg_0.vprint('Using password.')\n            arg_13 = 'ssh -t {Func_default_options_str} {Func_host_string} \"{Func_interactive_cmd_str}\"'\n        else:\n            # No explicit password or key file needed?\n            arg_0.vprint('Using nothing.')\n            arg_13 = 'ssh -t {Func_default_options_str} {Func_host_string} \"{Func_interactive_cmd_str}\"'\n        arg_5.local(arg_13)", "path": "burlap/debug.py", "identifier": "DebugSatchel.shell", "docstring": "Opens an SSH connection.", "docstring_tokens": ["Opens", "an", "SSH", "connection", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 251971}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/learner_data.py#L173-L215", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Collect the learner completion data from the course certificate.", "language": "python", "parameters": "(self, enterprise_enrollment)", "return_statement": "return completed_date, grade, is_passing", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "certificates_api", "is", "None", ":", "arg_0", ".", "certificates_api", "=", "CertificatesApiClient", "(", "arg_0", ".", "user", ")", "arg_3", "=", "arg_1", ".", "course_id", "arg_4", "=", "arg_1", ".", "enterprise_customer_user", ".", "user", ".", "username", "try", ":", "arg_5", "=", "arg_0", ".", "certificates_api", ".", "get_course_certificate", "(", "arg_3", ",", "arg_4", ")", "arg_6", "=", "arg_5", ".", "get", "(", "'created_date'", ")", "if", "arg_6", ":", "arg_6", "=", "parse_datetime", "(", "arg_6", ")", "else", ":", "arg_6", "=", "timezone", ".", "now", "(", ")", "arg_7", "=", "arg_5", ".", "get", "(", "'is_passing'", ")", "arg_8", "=", "arg_0", ".", "grade_passing", "if", "arg_7", "else", "arg_0", ".", "grade_failing", "except", "HttpNotFoundError", ":", "arg_6", "=", "None", "arg_8", "=", "arg_0", ".", "grade_incomplete", "arg_7", "=", "False", "return", "arg_6", ",", "arg_8", ",", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Collect the learner completion data from the course certificate.\n\n        Used for Instructor-paced courses.\n\n        If no certificate is found, then returns the completed_date = None, grade = In Progress, on the idea that a\n        certificate will eventually be generated.\n\n        Args:\n            enterprise_enrollment (EnterpriseCourseEnrollment): the enterprise enrollment record for which we need to\n            collect completion/grade data\n\n        Returns:\n            completed_date: Date the course was completed, this is None if course has not been completed.\n            grade: Current grade in the course.\n            is_passing: Boolean indicating if the grade is a passing grade or not.\n        \"\"\"\n\n        if arg_0.certificates_api is None:\n            arg_0.certificates_api = CertificatesApiClient(arg_0.user)\n\n        arg_3 = arg_1.course_id\n        arg_4 = arg_1.enterprise_customer_user.user.username\n\n        try:\n            arg_5 = arg_0.certificates_api.get_course_certificate(arg_3, arg_4)\n            arg_6 = arg_5.get('created_date')\n            if arg_6:\n                arg_6 = parse_datetime(arg_6)\n            else:\n                arg_6 = timezone.now()\n\n            # For consistency with _collect_grades_data, we only care about Pass/Fail grades. This could change.\n            arg_7 = arg_5.get('is_passing')\n            arg_8 = arg_0.grade_passing if arg_7 else arg_0.grade_failing\n\n        except HttpNotFoundError:\n            arg_6 = None\n            arg_8 = arg_0.grade_incomplete\n            arg_7 = False\n\n        return arg_6, arg_8, arg_7", "path": "integrated_channels/integrated_channel/exporters/learner_data.py", "identifier": "LearnerExporter._collect_certificate_data", "docstring": "Collect the learner completion data from the course certificate.\n\n        Used for Instructor-paced courses.\n\n        If no certificate is found, then returns the completed_date = None, grade = In Progress, on the idea that a\n        certificate will eventually be generated.\n\n        Args:\n            enterprise_enrollment (EnterpriseCourseEnrollment): the enterprise enrollment record for which we need to\n            collect completion/grade data\n\n        Returns:\n            completed_date: Date the course was completed, this is None if course has not been completed.\n            grade: Current grade in the course.\n            is_passing: Boolean indicating if the grade is a passing grade or not.", "docstring_tokens": ["Collect", "the", "learner", "completion", "data", "from", "the", "course", "certificate", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 251972}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L57-L87", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "A command line auto complete similar behavior. Find all item with same\n        prefix of this one.", "language": "python", "parameters": "(self, case_sensitive=False)", "return_statement": "return choices", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "basename", "arg_3", "=", "arg_0", ".", "basename", ".", "lower", "(", ")", "if", "arg_1", ":", "def", "match", "(", "arg_4", ")", ":", "return", "arg_4", ".", "startswith", "(", "arg_2", ")", "else", ":", "def", "match", "(", "arg_4", ")", ":", "return", "arg_4", ".", "lower", "(", ")", ".", "startswith", "(", "arg_3", ")", "arg_5", "=", "list", "(", ")", "if", "arg_0", ".", "is_dir", "(", ")", ":", "arg_5", ".", "append", "(", "arg_0", ")", "for", "arg_6", "in", "arg_0", ".", "sort_by_abspath", "(", "arg_0", ".", "select", "(", "recursive", "=", "False", ")", ")", ":", "arg_5", ".", "append", "(", "arg_6", ")", "else", ":", "arg_7", "=", "arg_0", ".", "parent", "if", "arg_7", ".", "is_dir", "(", ")", ":", "for", "arg_6", "in", "arg_0", ".", "sort_by_abspath", "(", "arg_7", ".", "select", "(", "recursive", "=", "False", ")", ")", ":", "if", "match", "(", "arg_6", ".", "basename", ")", ":", "arg_5", ".", "append", "(", "arg_6", ")", "else", ":", "raise", "ValueError", "(", "\"'%s' directory does not exist!\"", "%", "arg_7", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        A command line auto complete similar behavior. Find all item with same\n        prefix of this one.\n\n        :param case_sensitive: toggle if it is case sensitive.\n        :return: list of :class:`pathlib_mate.pathlib2.Path`.\n        \"\"\"\n        arg_2 = arg_0.basename\n        arg_3 = arg_0.basename.lower()\n        if arg_1:  # pragma: no cover\n            def match(arg_4):\n                return arg_4.startswith(arg_2)\n        else:\n            def match(arg_4):\n                return arg_4.lower().startswith(arg_3)\n\n        arg_5 = list()\n        if arg_0.is_dir():\n            arg_5.append(arg_0)\n            for arg_6 in arg_0.sort_by_abspath(arg_0.select(recursive=False)):\n                arg_5.append(arg_6)\n        else:\n            arg_7 = arg_0.parent\n            if arg_7.is_dir():\n                for arg_6 in arg_0.sort_by_abspath(arg_7.select(recursive=False)):\n                    if match(arg_6.basename):\n                        arg_5.append(arg_6)\n            else:  # pragma: no cover\n                raise ValueError(\"'%s' directory does not exist!\" % arg_7)\n        return arg_5", "path": "pathlib_mate/mate_tool_box.py", "identifier": "ToolBox.auto_complete_choices", "docstring": "A command line auto complete similar behavior. Find all item with same\n        prefix of this one.\n\n        :param case_sensitive: toggle if it is case sensitive.\n        :return: list of :class:`pathlib_mate.pathlib2.Path`.", "docstring_tokens": ["A", "command", "line", "auto", "complete", "similar", "behavior", ".", "Find", "all", "item", "with", "same", "prefix", "of", "this", "one", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 251973}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/names.py#L69-L82", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Toggle back and forth between a name and a tuple representation.", "language": "python", "parameters": "(s)", "return_statement": "return color_to_name(c) if is_numeric else str(c)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "','", "in", "arg_0", "or", "arg_0", ".", "startswith", "(", "'0x'", ")", "or", "arg_0", ".", "startswith", "(", "'#'", ")", "arg_2", "=", "name_to_color", "(", "arg_0", ")", "return", "color_to_name", "(", "arg_2", ")", "if", "arg_1", "else", "str", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Toggle back and forth between a name and a tuple representation.\n\n    :param str s: a string which is either a text name, or a tuple-string:\n                  a string with three numbers separated by commas\n\n    :returns: if the string was a text name, return a tuple.  If it's a\n              tuple-string and it corresponds to a text name, return the text\n              name, else return the original tuple-string.\n    \"\"\"\n    arg_1 = ',' in arg_0 or arg_0.startswith('0x') or arg_0.startswith('#')\n    arg_2 = name_to_color(arg_0)\n    return color_to_name(arg_2) if arg_1 else str(arg_2)", "path": "bibliopixel/colors/names.py", "identifier": "toggle", "docstring": "Toggle back and forth between a name and a tuple representation.\n\n    :param str s: a string which is either a text name, or a tuple-string:\n                  a string with three numbers separated by commas\n\n    :returns: if the string was a text name, return a tuple.  If it's a\n              tuple-string and it corresponds to a text name, return the text\n              name, else return the original tuple-string.", "docstring_tokens": ["Toggle", "back", "and", "forth", "between", "a", "name", "and", "a", "tuple", "representation", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 251974}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L126-L142", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Build an xsd complexType out of a S_SDT.", "language": "python", "parameters": "(s_sdt)", "return_statement": "return struct", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "nav_one", "(", "arg_0", ")", ".", "S_DT", "[", "17", "]", "(", ")", "arg_2", "=", "ET", ".", "Element", "(", "'xs:complexType'", ",", "name", "=", "arg_1", ".", "name", ")", "arg_3", "=", "lambda", "selected", ":", "not", "nav_one", "(", "selected", ")", ".", "S_MBR", "[", "46", ",", "'succeeds'", "]", "(", ")", "arg_4", "=", "nav_any", "(", "arg_0", ")", ".", "S_MBR", "[", "44", "]", "(", "arg_3", ")", "while", "arg_4", ":", "arg_1", "=", "nav_one", "(", "arg_4", ")", ".", "S_DT", "[", "45", "]", "(", ")", "arg_5", "=", "get_type_name", "(", "arg_1", ")", "ET", ".", "SubElement", "(", "arg_2", ",", "'xs:attribute'", ",", "name", "=", "arg_4", ".", "name", ",", "type", "=", "arg_5", ")", "arg_4", "=", "nav_one", "(", "arg_4", ")", ".", "S_MBR", "[", "46", ",", "'precedes'", "]", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    '''\n    Build an xsd complexType out of a S_SDT.\n    '''\n    arg_1 = nav_one(arg_0).S_DT[17]()\n    arg_2 = ET.Element('xs:complexType', name=arg_1.name)\n    \n    arg_3 = lambda selected: not nav_one(selected).S_MBR[46, 'succeeds']()\n    \n    arg_4 = nav_any(arg_0).S_MBR[44](arg_3)\n    while arg_4:\n        arg_1 = nav_one(arg_4).S_DT[45]()\n        arg_5 = get_type_name(arg_1)\n        ET.SubElement(arg_2, 'xs:attribute', name=arg_4.name, type=arg_5)\n        arg_4 = nav_one(arg_4).S_MBR[46, 'precedes']()\n    \n    return arg_2", "path": "bridgepoint/gen_xsd_schema.py", "identifier": "build_struct_type", "docstring": "Build an xsd complexType out of a S_SDT.", "docstring_tokens": ["Build", "an", "xsd", "complexType", "out", "of", "a", "S_SDT", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 251975}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/io.py#L5-L16", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Read a WAV file and returns the data and sample rate", "language": "python", "parameters": "(filename)", "return_statement": "return signal, samplerate", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "scipy", ".", "io", ".", "wavfile", "import", "read", "as", "Func", "arg_1", ",", "arg_2", "=", "Func", "(", "arg_0", ")", "return", "arg_2", ",", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Read a WAV file and returns the data and sample rate\n\n    ::\n\n        from spectrum.io import Func\n        Func()\n\n    \"\"\"\n    from scipy.io.wavfile import read as Func\n    arg_1, arg_2 = Func(arg_0)\n    return arg_2, arg_1", "path": "src/spectrum/io.py", "identifier": "readwav", "docstring": "Read a WAV file and returns the data and sample rate\n\n    ::\n\n        from spectrum.io import readwav\n        readwav()", "docstring_tokens": ["Read", "a", "WAV", "file", "and", "returns", "the", "data", "and", "sample", "rate"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 251976}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L718-L742", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "fills the duplicates array from the multi_muscle_align tmp files", "language": "python", "parameters": "(data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "tmpdir", ",", "\"duples_*.tmp.npy\"", ")", ")", "arg_1", ".", "sort", "(", "key", "=", "lambda", "x", ":", "int", "(", "x", ".", "rsplit", "(", "\"_\"", ",", "1", ")", "[", "-", "1", "]", "[", ":", "-", "8", "]", ")", ")", "arg_2", "=", "h5py", ".", "File", "(", "arg_0", ".", "clust_database", ",", "'r+'", ")", "arg_3", "=", "arg_2", "[", "\"duplicates\"", "]", "arg_4", "=", "0", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "int", "(", "arg_5", ".", "rsplit", "(", "\"_\"", ",", "1", ")", "[", "-", "1", "]", "[", ":", "-", "8", "]", ")", "arg_7", "=", "np", ".", "load", "(", "arg_5", ")", "arg_3", "[", "arg_4", ":", "arg_6", "]", "=", "arg_7", "arg_4", "+=", "arg_6", "-", "arg_4", "LOGGER", ".", "info", "(", "\"all duplicates: %s\"", ",", "arg_3", "[", ":", "]", ".", "sum", "(", ")", ")", "arg_2", ".", "close", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    fills the duplicates array from the multi_muscle_align tmp files\n    \"\"\"\n    ## build the duplicates array\n    arg_1 = glob.glob(os.path.join(arg_0.tmpdir, \"duples_*.tmp.npy\"))\n    arg_1.sort(key=lambda x: int(x.rsplit(\"_\", 1)[-1][:-8]))\n\n    ## enter the duplicates filter into super h5 array\n    arg_2 = h5py.File(arg_0.clust_database, 'r+')\n    arg_3 = arg_2[\"duplicates\"]\n\n    ## enter all duple arrays into full duplicates array\n    arg_4 = 0\n    for arg_5 in arg_1:\n        arg_6 = int(arg_5.rsplit(\"_\", 1)[-1][:-8])\n        arg_7 = np.load(arg_5)\n        arg_3[arg_4:arg_6] = arg_7\n        arg_4 += arg_6-arg_4\n        #os.remove(dupf)\n    #del inarr\n\n    ## continued progress bar\n    LOGGER.info(\"all duplicates: %s\", arg_3[:].sum())\n    arg_2.close()", "path": "ipyrad/assemble/cluster_across.py", "identifier": "fill_dups_arr", "docstring": "fills the duplicates array from the multi_muscle_align tmp files", "docstring_tokens": ["fills", "the", "duplicates", "array", "from", "the", "multi_muscle_align", "tmp", "files"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 251977}
{"url": "https://github.com/mshroyer/pointfree/blob/a25ecb3f0cd583e0730ecdde83018e5089711854/pointfree.py#L649-L675", "sha": "a25ecb3f0cd583e0730ecdde83018e5089711854", "docstring_summary": "Collects and returns a list of values from the given iterable.  If\n    the n parameter is not specified, collects all values from the\n    iterable.", "language": "python", "parameters": "(iterable, n=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "return", "list", "(", "itertools", ".", "islice", "(", "arg_0", ",", "arg_1", ")", ")", "else", ":", "return", "list", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Collects and returns a list of values from the given iterable.  If\n    the n parameter is not specified, collects all values from the\n    iterable.\n\n    :param iterable: An iterable yielding values for the list\n    :param n: An optional maximum number of items to collect\n    :rtype: List of values from the iterable\n\n    Example::\n\n        >>> @pointfree\n        ... def fibonaccis():\n        ...     a, b = 0, 1\n        ...     while True:\n        ...         a, b = b, a+b\n        ...         yield a\n\n        >>> (Func(n=10) * fibonaccis)()\n        [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]\n\n    \"\"\"\n\n    if arg_1:\n        return list(itertools.islice(arg_0, arg_1))\n    else:\n        return list(arg_0)", "path": "pointfree.py", "identifier": "pfcollect", "docstring": "Collects and returns a list of values from the given iterable.  If\n    the n parameter is not specified, collects all values from the\n    iterable.\n\n    :param iterable: An iterable yielding values for the list\n    :param n: An optional maximum number of items to collect\n    :rtype: List of values from the iterable\n\n    Example::\n\n        >>> @pointfree\n        ... def fibonaccis():\n        ...     a, b = 0, 1\n        ...     while True:\n        ...         a, b = b, a+b\n        ...         yield a\n\n        >>> (pfcollect(n=10) * fibonaccis)()\n        [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]", "docstring_tokens": ["Collects", "and", "returns", "a", "list", "of", "values", "from", "the", "given", "iterable", ".", "If", "the", "n", "parameter", "is", "not", "specified", "collects", "all", "values", "from", "the", "iterable", "."], "nwo": "mshroyer/pointfree", "score": 0.21302904236143622, "idx": 251978}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L2081-L2104", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Custom serialization functionality for working with advanced data types.", "language": "python", "parameters": "(obj)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "np", ".", "integer", ")", ":", "return", "int", "(", "arg_0", ")", "elif", "isinstance", "(", "arg_0", ",", "np", ".", "floating", ")", ":", "return", "float", "(", "arg_0", ")", "elif", "isinstance", "(", "arg_0", ",", "np", ".", "ndarray", ")", ":", "return", "arg_0", ".", "tolist", "(", ")", "elif", "isinstance", "(", "arg_0", ",", "list", ")", ":", "return", "[", "Func", "(", "arg_1", ")", "for", "arg_1", "in", "arg_0", "]", "elif", "isinstance", "(", "arg_0", ",", "Observation", ")", ":", "return", "{", "arg_2", ":", "Func", "(", "arg_3", ")", "for", "arg_2", ",", "arg_3", "in", "six", ".", "iteritems", "(", "arg_0", ".", "_asdict", "(", ")", ")", "}", "return", "arg_0"], "function": "def Func(arg_0):\n    '''Custom serialization functionality for working with advanced data types.\n\n    - numpy arrays are converted to lists\n    - lists are recursively serialized element-wise\n\n    '''\n\n    if isinstance(arg_0, np.integer):\n        return int(arg_0)\n\n    elif isinstance(arg_0, np.floating):\n        return float(arg_0)\n\n    elif isinstance(arg_0, np.ndarray):\n        return arg_0.tolist()\n\n    elif isinstance(arg_0, list):\n        return [Func(arg_1) for arg_1 in arg_0]\n\n    elif isinstance(arg_0, Observation):\n        return {arg_2: Func(arg_3) for arg_2, arg_3 in six.iteritems(arg_0._asdict())}\n\n    return arg_0", "path": "jams/core.py", "identifier": "serialize_obj", "docstring": "Custom serialization functionality for working with advanced data types.\n\n    - numpy arrays are converted to lists\n    - lists are recursively serialized element-wise", "docstring_tokens": ["Custom", "serialization", "functionality", "for", "working", "with", "advanced", "data", "types", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 251979}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L996-L1034", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Creates and connects the underlying text widget.", "language": "python", "parameters": "(self)", "return_statement": "return control", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "custom_control", ":", "arg_1", "=", "arg_0", ".", "custom_control", "(", ")", "elif", "arg_0", ".", "kind", "==", "'plain'", ":", "arg_1", "=", "QtGui", ".", "QPlainTextEdit", "(", ")", "elif", "arg_0", ".", "kind", "==", "'rich'", ":", "arg_1", "=", "QtGui", ".", "QTextEdit", "(", ")", "arg_1", ".", "setAcceptRichText", "(", "False", ")", "arg_1", ".", "installEventFilter", "(", "arg_0", ")", "arg_1", ".", "viewport", "(", ")", ".", "installEventFilter", "(", "arg_0", ")", "arg_1", ".", "customContextMenuRequested", ".", "connect", "(", "arg_0", ".", "_custom_context_menu_requested", ")", "arg_1", ".", "copyAvailable", ".", "connect", "(", "arg_0", ".", "copy_available", ")", "arg_1", ".", "redoAvailable", ".", "connect", "(", "arg_0", ".", "redo_available", ")", "arg_1", ".", "undoAvailable", ".", "connect", "(", "arg_0", ".", "undo_available", ")", "arg_2", "=", "arg_1", ".", "document", "(", ")", ".", "documentLayout", "(", ")", "arg_2", ".", "documentSizeChanged", ".", "disconnect", "(", ")", "arg_2", ".", "documentSizeChanged", ".", "connect", "(", "arg_0", ".", "_adjust_scrollbars", ")", "arg_1", ".", "setAttribute", "(", "QtCore", ".", "Qt", ".", "WA_InputMethodEnabled", ",", "True", ")", "arg_1", ".", "setContextMenuPolicy", "(", "QtCore", ".", "Qt", ".", "CustomContextMenu", ")", "arg_1", ".", "setReadOnly", "(", "True", ")", "arg_1", ".", "setUndoRedoEnabled", "(", "False", ")", "arg_1", ".", "setVerticalScrollBarPolicy", "(", "QtCore", ".", "Qt", ".", "ScrollBarAlwaysOn", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Creates and connects the underlying text widget.\n        \"\"\"\n        # Create the underlying control.\n        if arg_0.custom_control:\n            arg_1 = arg_0.custom_control()\n        elif arg_0.kind == 'plain':\n            arg_1 = QtGui.QPlainTextEdit()\n        elif arg_0.kind == 'rich':\n            arg_1 = QtGui.QTextEdit()\n            arg_1.setAcceptRichText(False)\n\n        # Install event filters. The filter on the viewport is needed for\n        # mouse events and drag events.\n        arg_1.installEventFilter(arg_0)\n        arg_1.viewport().installEventFilter(arg_0)\n\n        # Connect signals.\n        arg_1.customContextMenuRequested.connect(\n            arg_0._custom_context_menu_requested)\n        arg_1.copyAvailable.connect(arg_0.copy_available)\n        arg_1.redoAvailable.connect(arg_0.redo_available)\n        arg_1.undoAvailable.connect(arg_0.undo_available)\n\n        # Hijack the document size change signal to prevent Qt from adjusting\n        # the viewport's scrollbar. We are relying on an implementation detail\n        # of Q(Plain)TextEdit here, which is potentially dangerous, but without\n        # this functionality we cannot create a nice terminal interface.\n        arg_2 = arg_1.document().documentLayout()\n        arg_2.documentSizeChanged.disconnect()\n        arg_2.documentSizeChanged.connect(arg_0._adjust_scrollbars)\n\n        # Configure the control.\n        arg_1.setAttribute(QtCore.Qt.WA_InputMethodEnabled, True)\n        arg_1.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)\n        arg_1.setReadOnly(True)\n        arg_1.setUndoRedoEnabled(False)\n        arg_1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._create_control", "docstring": "Creates and connects the underlying text widget.", "docstring_tokens": ["Creates", "and", "connects", "the", "underlying", "text", "widget", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 251980}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L69-L74", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Create a ByteParser on demand.", "language": "python", "parameters": "(self)", "return_statement": "return self._byte_parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_byte_parser", ":", "arg_0", ".", "_byte_parser", "=", "ByteParser", "(", "text", "=", "arg_0", ".", "text", ",", "filename", "=", "arg_0", ".", "filename", ")", "return", "arg_0", ".", "_byte_parser"], "function": "def Func(arg_0):\n        \"\"\"Create a ByteParser on demand.\"\"\"\n        if not arg_0._byte_parser:\n            arg_0._byte_parser = \\\n                            ByteParser(text=arg_0.text, filename=arg_0.filename)\n        return arg_0._byte_parser", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py", "identifier": "CodeParser._get_byte_parser", "docstring": "Create a ByteParser on demand.", "docstring_tokens": ["Create", "a", "ByteParser", "on", "demand", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 251981}
{"url": "https://github.com/shopkick/flawless/blob/c54b63ca1991c153e6f75080536f6df445aacc64/flawless/client/decorators.py#L20-L41", "sha": "c54b63ca1991c153e6f75080536f6df445aacc64", "docstring_summary": "Wraps a function with reporting to errors backend", "language": "python", "parameters": "(func=None, error_threshold=None, reraise_exception=True, save_current_stack_trace=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "if", "arg_0", ":", "return", "flawless", ".", "client", ".", "client", ".", "_Func_with_error_decorator", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "else", ":", "return", "functools", ".", "partial", "(", "flawless", ".", "client", ".", "client", ".", "_Func_with_error_decorator", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=True, arg_3=True):\n    ''' Wraps a function with reporting to errors backend '''\n    # This if/else allows Func to behave like a normal decorator when\n    # used like:\n    #         @Func\n    #         def some_func():\n    #\n    # However, it also allows Func to also be passed keyword arguments\n    # like the following:\n    #         @Func(error_threshold=3, reraise_exception=False)\n    #         def some_func():\n    if arg_0:\n        return flawless.client.client._Func_with_error_decorator(\n            arg_0=arg_0,\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3)\n    else:\n        return functools.partial(flawless.client.client._Func_with_error_decorator,\n                                 arg_1=arg_1,\n                                 arg_2=arg_2,\n                                 arg_3=arg_3)", "path": "flawless/client/decorators.py", "identifier": "wrap_function", "docstring": "Wraps a function with reporting to errors backend", "docstring_tokens": ["Wraps", "a", "function", "with", "reporting", "to", "errors", "backend"], "nwo": "shopkick/flawless", "score": 0.37326674238089064, "idx": 251982}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/monitor/job_monitor.py#L22-L64", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "A text-based job status checker", "language": "python", "parameters": "(job, interval, _interval_set=False, quiet=False, output=sys.stdout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "arg_5", ".", "stdout", ")", ":", "arg_7", "=", "arg_0", ".", "status", "(", ")", "arg_8", "=", "arg_7", ".", "value", "arg_9", "=", "arg_8", "arg_10", "=", "len", "(", "arg_8", ")", "if", "not", "arg_3", ":", "print", "(", "'\\r%s: %s'", "%", "(", "'Job Status'", ",", "arg_8", ")", ",", "end", "=", "''", ",", "file", "=", "arg_4", ")", "while", "arg_7", ".", "name", "not", "in", "[", "'DONE'", ",", "'CANCELLED'", ",", "'ERROR'", "]", ":", "time", ".", "sleep", "(", "arg_1", ")", "arg_7", "=", "arg_0", ".", "status", "(", ")", "arg_8", "=", "arg_7", ".", "value", "if", "arg_7", ".", "name", "==", "'QUEUED'", ":", "arg_8", "+=", "' (%s)'", "%", "arg_0", ".", "queue_position", "(", ")", "if", "not", "arg_2", ":", "arg_1", "=", "max", "(", "arg_0", ".", "queue_position", "(", ")", ",", "2", ")", "else", ":", "if", "not", "arg_2", ":", "arg_1", "=", "2", "if", "len", "(", "arg_8", ")", "<", "arg_10", ":", "arg_8", "+=", "' '", "*", "(", "arg_10", "-", "len", "(", "arg_8", ")", ")", "elif", "len", "(", "arg_8", ")", ">", "arg_10", ":", "arg_10", "=", "len", "(", "arg_8", ")", "if", "arg_8", "!=", "arg_9", "and", "not", "arg_3", ":", "print", "(", "'\\r%s: %s'", "%", "(", "'Job Status'", ",", "arg_8", ")", ",", "end", "=", "''", ",", "file", "=", "arg_4", ")", "arg_9", "=", "arg_8", "if", "not", "arg_3", ":", "print", "(", "''", ",", "file", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False, arg_4=arg_5.stdout):\n    \"\"\"A text-based job status checker\n\n    Args:\n        job (BaseJob): The job to check.\n        interval (int): The interval at which to check.\n        _interval_set (bool): Was interval time set by user?\n        quiet (bool): If True, do not print status messages.\n        output (file): The file like object to write status messages to.\n        By default this is sys.stdout.\n\n    \"\"\"\n    arg_7 = arg_0.status()\n    arg_8 = arg_7.value\n    arg_9 = arg_8\n    arg_10 = len(arg_8)\n\n    if not arg_3:\n        print('\\r%s: %s' % ('Job Status', arg_8), end='', file=arg_4)\n    while arg_7.name not in ['DONE', 'CANCELLED', 'ERROR']:\n        time.sleep(arg_1)\n        arg_7 = arg_0.status()\n        arg_8 = arg_7.value\n\n        if arg_7.name == 'QUEUED':\n            arg_8 += ' (%s)' % arg_0.queue_position()\n            if not arg_2:\n                arg_1 = max(arg_0.queue_position(), 2)\n        else:\n            if not arg_2:\n                arg_1 = 2\n\n        # Adjust length of message so there are no artifacts\n        if len(arg_8) < arg_10:\n            arg_8 += ' ' * (arg_10 - len(arg_8))\n        elif len(arg_8) > arg_10:\n            arg_10 = len(arg_8)\n\n        if arg_8 != arg_9 and not arg_3:\n            print('\\r%s: %s' % ('Job Status', arg_8), end='', file=arg_4)\n            arg_9 = arg_8\n    if not arg_3:\n        print('', file=arg_4)", "path": "qiskit/tools/monitor/job_monitor.py", "identifier": "_text_checker", "docstring": "A text-based job status checker\n\n    Args:\n        job (BaseJob): The job to check.\n        interval (int): The interval at which to check.\n        _interval_set (bool): Was interval time set by user?\n        quiet (bool): If True, do not print status messages.\n        output (file): The file like object to write status messages to.\n        By default this is sys.stdout.", "docstring_tokens": ["A", "text", "-", "based", "job", "status", "checker"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 251983}
{"url": "https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L2328-L2350", "sha": "2cc91060982cc8b777152e698d677cc2989bf263", "docstring_summary": "Return True if process is 64 bit.\n    Return False if process is 32 bit.\n    Return None if unknown, maybe caused by having no acess right to the process.", "language": "python", "parameters": "(processId: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "bool", ":", "try", ":", "arg_2", "=", "ctypes", ".", "windll", ".", "ntdll", ".", "ZwWow64ReadVirtualMemory64", "except", "Exception", "as", "ex", ":", "return", "False", "try", ":", "arg_3", "=", "ctypes", ".", "windll", ".", "kernel32", ".", "IsWow64Process", "arg_3", ".", "argtypes", "=", "(", "ctypes", ".", "c_void_p", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_int", ")", ")", "except", "Exception", "as", "ex", ":", "return", "False", "arg_5", "=", "ctypes", ".", "windll", ".", "kernel32", ".", "OpenProcess", "(", "0x1000", ",", "0", ",", "arg_0", ")", "if", "arg_5", ":", "arg_6", "=", "ctypes", ".", "c_int32", "(", ")", "if", "arg_3", "(", "arg_5", ",", "ctypes", ".", "byref", "(", "arg_6", ")", ")", ":", "ctypes", ".", "windll", ".", "kernel32", ".", "CloseHandle", "(", "ctypes", ".", "c_void_p", "(", "arg_5", ")", ")", "return", "False", "if", "arg_6", ".", "value", "else", "True", "else", ":", "ctypes", ".", "windll", ".", "kernel32", ".", "CloseHandle", "(", "ctypes", ".", "c_void_p", "(", "arg_5", ")", ")"], "function": "def Func(arg_0: arg_1) -> bool:\n    \"\"\"\n    Return True if process is 64 bit.\n    Return False if process is 32 bit.\n    Return None if unknown, maybe caused by having no acess right to the process.\n    \"\"\"\n    try:\n        arg_2 = ctypes.windll.ntdll.ZwWow64ReadVirtualMemory64  #only 64 bit OS has this function\n    except Exception as ex:\n        return False\n    try:\n        arg_3 = ctypes.windll.kernel32.IsWow64Process\n        arg_3.argtypes = (ctypes.c_void_p, ctypes.POINTER(ctypes.c_int))\n    except Exception as ex:\n        return False\n    arg_5 = ctypes.windll.kernel32.OpenProcess(0x1000, 0, arg_0)  #PROCESS_QUERY_INFORMATION=0x0400,PROCESS_QUERY_LIMITED_INFORMATION=0x1000\n    if arg_5:\n        arg_6 = ctypes.c_int32()\n        if arg_3(arg_5, ctypes.byref(arg_6)):\n            ctypes.windll.kernel32.CloseHandle(ctypes.c_void_p(arg_5))\n            return False if arg_6.value else True\n        else:\n            ctypes.windll.kernel32.CloseHandle(ctypes.c_void_p(arg_5))", "path": "uiautomation/uiautomation.py", "identifier": "IsProcess64Bit", "docstring": "Return True if process is 64 bit.\n    Return False if process is 32 bit.\n    Return None if unknown, maybe caused by having no acess right to the process.", "docstring_tokens": ["Return", "True", "if", "process", "is", "64", "bit", ".", "Return", "False", "if", "process", "is", "32", "bit", ".", "Return", "None", "if", "unknown", "maybe", "caused", "by", "having", "no", "acess", "right", "to", "the", "process", "."], "nwo": "yinkaisheng/Python-UIAutomation-for-Windows", "score": 0.9769561204852005, "idx": 251984}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/__init__.py#L379-L390", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "Returns an environment name for the given cname", "language": "python", "parameters": "(self, env_cname)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_environments", "(", ")", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "[", "'Status'", "]", "!=", "'Terminated'", "and", "'CNAME'", "in", "arg_3", "and", "arg_3", "[", "'CNAME'", "]", "and", "arg_3", "[", "'CNAME'", "]", ".", "lower", "(", ")", ".", "startswith", "(", "arg_1", ".", "lower", "(", ")", "+", "'.'", ")", ":", "return", "arg_3", "[", "'EnvironmentName'", "]", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns an environment name for the given cname\n        \"\"\"\n        arg_2 = arg_0.get_environments()\n        for arg_3 in arg_2:\n            if arg_3['Status'] != 'Terminated' \\\n                and 'CNAME' in arg_3 \\\n                and arg_3['CNAME'] \\\n                and arg_3['CNAME'].lower().startswith(arg_1.lower() + '.'):\n                return arg_3['EnvironmentName']\n        return None", "path": "ebs_deploy/__init__.py", "identifier": "EbsHelper.environment_name_for_cname", "docstring": "Returns an environment name for the given cname", "docstring_tokens": ["Returns", "an", "environment", "name", "for", "the", "given", "cname"], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 251985}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/khard.py#L1313-L1399", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Copy or move a contact to a different address book.", "language": "python", "parameters": "(action, vcard_list, target_address_book_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "choose_vcard_from_list", "(", "\"Select contact to %s\"", "%", "arg_0", ".", "title", "(", ")", ",", "arg_1", ")", "if", "arg_3", "is", "None", ":", "print", "(", "\"Found no contact\"", ")", "sys", ".", "exit", "(", "1", ")", "else", ":", "print", "(", "\"%s contact %s from address book %s\"", "%", "(", "arg_0", ".", "title", "(", ")", ",", "arg_3", ",", "arg_3", ".", "address_book", ")", ")", "if", "len", "(", "arg_2", ")", "==", "1", "and", "arg_2", "[", "0", "]", "==", "arg_3", ".", "address_book", ":", "print", "(", "\"The address book %s already contains the contact %s\"", "%", "(", "arg_2", "[", "0", "]", ",", "arg_3", ")", ")", "sys", ".", "exit", "(", "1", ")", "else", ":", "arg_4", "=", "[", "abook", "for", "abook", "in", "arg_2", "if", "abook", "!=", "arg_3", ".", "address_book", "]", "arg_5", "=", "choose_address_book_from_list", "(", "\"Select target address book\"", ",", "arg_4", ")", "if", "arg_5", "is", "None", ":", "print", "(", "\"Error: address book list is empty\"", ")", "sys", ".", "exit", "(", "1", ")", "arg_6", "=", "choose_vcard_from_list", "(", "\"Select target contact which to overwrite\"", ",", "get_contact_list_by_user_selection", "(", "[", "arg_5", "]", ",", "arg_3", ".", "get_full_name", "(", ")", ",", "True", ")", ")", "if", "arg_6", "is", "None", ":", "copy_contact", "(", "arg_3", ",", "arg_5", ",", "arg_0", "==", "\"move\"", ")", "else", ":", "if", "arg_3", "==", "arg_6", ":", "print", "(", "\"Target contact: %s\"", "%", "arg_6", ")", "if", "arg_0", "==", "\"move\"", ":", "copy_contact", "(", "arg_3", ",", "arg_5", ",", "True", ")", "else", ":", "print", "(", "\"The selected contacts are already identical\"", ")", "else", ":", "print", "(", "\"The address book %s already contains the contact %s\\n\\n\"", "\"Source\\n\\n%s\\n\\nTarget\\n\\n%s\\n\\n\"", "\"Possible actions:\\n\"", "\"  a: %s anyway\\n\"", "\"  m: Merge from source into target contact\\n\"", "\"  o: Overwrite target contact\\n\"", "\"  q: Quit\"", "%", "(", "arg_6", ".", "address_book", ",", "arg_3", ",", "arg_3", ".", "print_vcard", "(", ")", ",", "arg_6", ".", "print_vcard", "(", ")", ",", "\"Move\"", "if", "arg_0", "==", "\"move\"", "else", "\"Copy\"", ")", ")", "while", "True", ":", "arg_7", "=", "input", "(", "\"Your choice: \"", ")", "if", "arg_7", ".", "lower", "(", ")", "==", "\"a\"", ":", "copy_contact", "(", "arg_3", ",", "arg_5", ",", "arg_0", "==", "\"move\"", ")", "break", "if", "arg_7", ".", "lower", "(", ")", "==", "\"o\"", ":", "copy_contact", "(", "arg_3", ",", "arg_5", ",", "arg_0", "==", "\"move\"", ")", "arg_6", ".", "delete_vcard_file", "(", ")", "break", "if", "arg_7", ".", "lower", "(", ")", "==", "\"m\"", ":", "merge_existing_contacts", "(", "arg_3", ",", "arg_6", ",", "arg_0", "==", "\"move\"", ")", "break", "if", "arg_7", ".", "lower", "(", ")", "in", "[", "\"\"", ",", "\"q\"", "]", ":", "print", "(", "\"Canceled\"", ")", "break"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Copy or move a contact to a different address book.\n\n    :action: the string \"copy\" or \"move\" to indicate what to do\n    :type action: str\n    :param vcard_list: the contact list from which to select one for the action\n    :type vcard_list: list of carddav_object.CarddavObject\n    :param target_address_book_list: the list of target address books\n    :type target_address_book_list: list(addressbook.AddressBook)\n    :returns: None\n    :rtype: None\n\n    \"\"\"\n    # get the source vcard, which to copy or move\n    arg_3 = choose_vcard_from_list(\n        \"Select contact to %s\" % arg_0.title(), arg_1)\n    if arg_3 is None:\n        print(\"Found no contact\")\n        sys.exit(1)\n    else:\n        print(\"%s contact %s from address book %s\"\n              % (arg_0.title(), arg_3, arg_3.address_book))\n\n    # get target address book\n    if len(arg_2) == 1 \\\n            and arg_2[0] == arg_3.address_book:\n        print(\"The address book %s already contains the contact %s\"\n              % (arg_2[0], arg_3))\n        sys.exit(1)\n    else:\n        arg_4 = [abook for abook in arg_2\n                                   if abook != arg_3.address_book]\n        arg_5 = choose_address_book_from_list(\n            \"Select target address book\", arg_4)\n        if arg_5 is None:\n            print(\"Error: address book list is empty\")\n            sys.exit(1)\n\n    # check if a contact already exists in the target address book\n    arg_6 = choose_vcard_from_list(\n        \"Select target contact which to overwrite\",\n        get_contact_list_by_user_selection([arg_5],\n                                           arg_3.get_full_name(), True))\n    # If the target contact doesn't exist, move or copy the source contact into\n    # the target address book without further questions.\n    if arg_6 is None:\n        copy_contact(arg_3, arg_5,\n                     arg_0 == \"move\")\n    else:\n        if arg_3 == arg_6:\n            # source and target contact are identical\n            print(\"Target contact: %s\" % arg_6)\n            if arg_0 == \"move\":\n                copy_contact(arg_3, arg_5, True)\n            else:\n                print(\"The selected contacts are already identical\")\n        else:\n            # source and target contacts are different\n            # either overwrite the target one or merge into target contact\n            print(\"The address book %s already contains the contact %s\\n\\n\"\n                  \"Source\\n\\n%s\\n\\nTarget\\n\\n%s\\n\\n\"\n                  \"Possible actions:\\n\"\n                  \"  a: %s anyway\\n\"\n                  \"  m: Merge from source into target contact\\n\"\n                  \"  o: Overwrite target contact\\n\"\n                  \"  q: Quit\" % (\n                      arg_6.address_book, arg_3,\n                      arg_3.print_vcard(), arg_6.print_vcard(),\n                      \"Move\" if arg_0 == \"move\" else \"Copy\"))\n            while True:\n                arg_7 = input(\"Your choice: \")\n                if arg_7.lower() == \"a\":\n                    copy_contact(arg_3, arg_5,\n                                 arg_0 == \"move\")\n                    break\n                if arg_7.lower() == \"o\":\n                    copy_contact(arg_3, arg_5,\n                                 arg_0 == \"move\")\n                    arg_6.delete_vcard_file()\n                    break\n                if arg_7.lower() == \"m\":\n                    merge_existing_contacts(arg_3, arg_6,\n                                            arg_0 == \"move\")\n                    break\n                if arg_7.lower() in [\"\", \"q\"]:\n                    print(\"Canceled\")\n                    break", "path": "khard/khard.py", "identifier": "copy_or_move_subcommand", "docstring": "Copy or move a contact to a different address book.\n\n    :action: the string \"copy\" or \"move\" to indicate what to do\n    :type action: str\n    :param vcard_list: the contact list from which to select one for the action\n    :type vcard_list: list of carddav_object.CarddavObject\n    :param target_address_book_list: the list of target address books\n    :type target_address_book_list: list(addressbook.AddressBook)\n    :returns: None\n    :rtype: None", "docstring_tokens": ["Copy", "or", "move", "a", "contact", "to", "a", "different", "address", "book", "."], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 251986}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/zendesk_hook.py#L39-L50", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Sleep for the time specified in the exception. If not specified, wait\n        for 60 seconds.", "language": "python", "parameters": "(self, rate_limit_exception)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "int", "(", "arg_1", ".", "response", ".", "headers", ".", "get", "(", "'Retry-After'", ",", "60", ")", ")", "arg_0", ".", "log", ".", "info", "(", "\"Hit Zendesk API rate limit. Pausing for %s seconds\"", ",", "arg_2", ")", "time", ".", "sleep", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sleep for the time specified in the exception. If not specified, wait\n        for 60 seconds.\n        \"\"\"\n        arg_2 = int(\n            arg_1.response.headers.get('Retry-After', 60))\n        arg_0.log.info(\n            \"Hit Zendesk API rate limit. Pausing for %s seconds\",\n            arg_2\n        )\n        time.sleep(arg_2)", "path": "airflow/hooks/zendesk_hook.py", "identifier": "ZendeskHook.__handle_rate_limit_exception", "docstring": "Sleep for the time specified in the exception. If not specified, wait\n        for 60 seconds.", "docstring_tokens": ["Sleep", "for", "the", "time", "specified", "in", "the", "exception", ".", "If", "not", "specified", "wait", "for", "60", "seconds", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 251987}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L87-L96", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Select file path by criterion.", "language": "python", "parameters": "(self, filters=all_true, recursive=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "True", ")", ":", "for", "arg_4", "in", "arg_0", ".", "select", "(", "arg_1", ",", "arg_3", ")", ":", "if", "arg_4", ".", "is_file", "(", ")", ":", "yield", "arg_4"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=True):\n        \"\"\"Select file path by criterion.\n\n        **\u4e2d\u6587\u6587\u6863**\n\n        \u6839\u636efilters\u4e2d\u5b9a\u4e49\u7684\u6761\u4ef6\u9009\u62e9\u6587\u4ef6\u3002\n        \"\"\"\n        for arg_4 in arg_0.select(arg_1, arg_3):\n            if arg_4.is_file():\n                yield arg_4", "path": "pathlib_mate/mate_path_filters.py", "identifier": "PathFilters.select_file", "docstring": "Select file path by criterion.\n\n        **\u4e2d\u6587\u6587\u6863**\n\n        \u6839\u636efilters\u4e2d\u5b9a\u4e49\u7684\u6761\u4ef6\u9009\u62e9\u6587\u4ef6\u3002", "docstring_tokens": ["Select", "file", "path", "by", "criterion", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 251988}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L2190-L2202", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "True if something has been written to the storage.\n        Note that if a slot has been erased from the storage this function may\n        lose any meaning.", "language": "python", "parameters": "(self, address)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_world_state", "[", "arg_1", "]", "[", "'storage'", "]", "arg_3", "=", "arg_2", ".", "array", "while", "not", "isinstance", "(", "arg_3", ",", "ArrayVariable", ")", ":", "if", "isinstance", "(", "arg_3", ",", "ArrayStore", ")", ":", "return", "True", "arg_3", "=", "arg_3", ".", "array", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        True if something has been written to the storage.\n        Note that if a slot has been erased from the storage this function may\n        lose any meaning.\n        \"\"\"\n        arg_2 = arg_0._world_state[arg_1]['storage']\n        arg_3 = arg_2.array\n        while not isinstance(arg_3, ArrayVariable):\n            if isinstance(arg_3, ArrayStore):\n                return True\n            arg_3 = arg_3.array\n        return False", "path": "manticore/platforms/evm.py", "identifier": "EVMWorld.has_storage", "docstring": "True if something has been written to the storage.\n        Note that if a slot has been erased from the storage this function may\n        lose any meaning.", "docstring_tokens": ["True", "if", "something", "has", "been", "written", "to", "the", "storage", ".", "Note", "that", "if", "a", "slot", "has", "been", "erased", "from", "the", "storage", "this", "function", "may", "lose", "any", "meaning", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 251989}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/client.py#L87-L91", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "flush the line to stdout", "language": "python", "parameters": "(self, line)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "sys", ".", "stdout", ".", "write", "(", "arg_1", ")", "sys", ".", "stdout", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Func the line to stdout\"\"\"\n        # TODO -- maybe use echo?\n        sys.stdout.write(arg_1)\n        sys.stdout.Func()", "path": "captain/client.py", "identifier": "Captain.flush", "docstring": "flush the line to stdout", "docstring_tokens": ["flush", "the", "line", "to", "stdout"], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 251990}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/util.py#L43-L72", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Recursively merges the contents of two dictionaries into a new dictionary.", "language": "python", "parameters": "(dict1, dict2, merge_lists=False)", "return_statement": "return merged", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "dict", "(", "arg_0", ")", "for", "arg_4", ",", "arg_5", "in", "iteritems", "(", "arg_1", ")", ":", "if", "isinstance", "(", "arg_3", ".", "get", "(", "arg_4", ")", ",", "dict", ")", ":", "arg_3", "[", "arg_4", "]", "=", "Func", "(", "arg_3", "[", "arg_4", "]", ",", "arg_5", ")", "elif", "arg_2", "and", "isinstance", "(", "arg_3", ".", "get", "(", "arg_4", ")", ",", "list", ")", ":", "arg_3", "[", "arg_4", "]", "=", "merge_list", "(", "arg_3", "[", "arg_4", "]", ",", "arg_5", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Recursively merges the contents of two dictionaries into a new dictionary.\n\n    When both input dictionaries share a key, the value from ``dict2`` is\n    kept.\n\n    :param dict1: the first dictionary\n    :type dict1: dict\n    :param dict2: the second dictionary\n    :type dict2: dict\n    :param merge_lists:\n        when this function encounters a key that contains lists in both input\n        dictionaries, this parameter dictates whether or not those lists should\n        be merged. If not specified, defaults to ``False``.\n    :type merge_lists: bool\n    :returns: dict\n    \"\"\"\n\n    arg_3 = dict(arg_0)\n\n    for arg_4, arg_5 in iteritems(arg_1):\n        if isinstance(arg_3.get(arg_4), dict):\n            arg_3[arg_4] = Func(arg_3[arg_4], arg_5)\n        elif arg_2 and isinstance(arg_3.get(arg_4), list):\n            arg_3[arg_4] = merge_list(arg_3[arg_4], arg_5)\n        else:\n            arg_3[arg_4] = arg_5\n\n    return arg_3", "path": "src/tidypy/util.py", "identifier": "merge_dict", "docstring": "Recursively merges the contents of two dictionaries into a new dictionary.\n\n    When both input dictionaries share a key, the value from ``dict2`` is\n    kept.\n\n    :param dict1: the first dictionary\n    :type dict1: dict\n    :param dict2: the second dictionary\n    :type dict2: dict\n    :param merge_lists:\n        when this function encounters a key that contains lists in both input\n        dictionaries, this parameter dictates whether or not those lists should\n        be merged. If not specified, defaults to ``False``.\n    :type merge_lists: bool\n    :returns: dict", "docstring_tokens": ["Recursively", "merges", "the", "contents", "of", "two", "dictionaries", "into", "a", "new", "dictionary", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 251991}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L729-L773", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Appends content to a local file.", "language": "python", "parameters": "(filename, contents, eol_style=EOL_STYLE_NATIVE, encoding=None, binary=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "_AssertIsLocal", "(", "arg_0", ")", "assert", "isinstance", "(", "arg_1", ",", "six", ".", "text_type", ")", "^", "arg_5", ",", "'Must always receive unicode contents, unless binary=True'", "if", "not", "arg_5", ":", "arg_1", "=", "_HandleContentsEol", "(", "arg_1", ",", "arg_2", ")", "arg_1", "=", "arg_1", ".", "encode", "(", "arg_4", "or", "sys", ".", "getfilesystemencoding", "(", ")", ")", "arg_6", "=", "open", "(", "arg_0", ",", "'ab'", ")", "try", ":", "arg_6", ".", "write", "(", "arg_1", ")", "finally", ":", "arg_6", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3, arg_4=None, arg_5=False):\n    '''\n    Appends content to a local file.\n\n    :param unicode filename:\n\n    :param unicode contents:\n\n    :type eol_style: EOL_STYLE_XXX constant\n    :param eol_style:\n        Replaces the EOL by the appropriate EOL depending on the eol_style value.\n        Considers that all content is using only \"\\n\" as EOL.\n\n    :param unicode encoding:\n        Target file's content encoding.\n        Defaults to sys.getfilesystemencoding()\n\n    :param bool binary:\n        If True, content is appended in binary mode. In this case, `contents` must be `bytes` and not\n        `unicode`\n\n    :raises NotImplementedForRemotePathError:\n        If trying to modify a non-local path\n\n    :raises ValueError:\n        If trying to mix unicode `contents` without `encoding`, or `encoding` without\n        unicode `contents`\n    '''\n    _AssertIsLocal(arg_0)\n\n    assert isinstance(arg_1, six.text_type) ^ arg_5, 'Must always receive unicode contents, unless binary=True'\n\n    if not arg_5:\n        # Replaces eol on each line by the given eol_style.\n        arg_1 = _HandleContentsEol(arg_1, arg_2)\n\n        # Handle encoding here, and always write in binary mode. We can't use io.open because it\n        # tries to do its own line ending handling.\n        arg_1 = arg_1.encode(arg_4 or sys.getfilesystemencoding())\n\n    arg_6 = open(arg_0, 'ab')\n    try:\n        arg_6.write(arg_1)\n    finally:\n        arg_6.close()", "path": "zerotk/easyfs/_easyfs.py", "identifier": "AppendToFile", "docstring": "Appends content to a local file.\n\n    :param unicode filename:\n\n    :param unicode contents:\n\n    :type eol_style: EOL_STYLE_XXX constant\n    :param eol_style:\n        Replaces the EOL by the appropriate EOL depending on the eol_style value.\n        Considers that all content is using only \"\\n\" as EOL.\n\n    :param unicode encoding:\n        Target file's content encoding.\n        Defaults to sys.getfilesystemencoding()\n\n    :param bool binary:\n        If True, content is appended in binary mode. In this case, `contents` must be `bytes` and not\n        `unicode`\n\n    :raises NotImplementedForRemotePathError:\n        If trying to modify a non-local path\n\n    :raises ValueError:\n        If trying to mix unicode `contents` without `encoding`, or `encoding` without\n        unicode `contents`", "docstring_tokens": ["Appends", "content", "to", "a", "local", "file", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 251992}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/misc.py#L138-L173", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "A decorator factory to check if prerequisites are satisfied.", "language": "python", "parameters": "(\n        prerequisites,\n        checker,\n        msg_tmpl='Prerequisites \"{}\" are required in method \"{}\" but not '\n        'found, please install them first.')", "return_statement": "return wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'Prerequisites \"{}\" are required in method \"{}\" but not '", "'found, please install them first.'", ")", ":", "def", "wrap", "(", "arg_3", ")", ":", "@", "functools", ".", "wraps", "(", "arg_3", ")", "def", "wrapped_func", "(", "*", "arg_4", ",", "**", "arg_5", ")", ":", "arg_6", "=", "[", "arg_0", "]", "if", "isinstance", "(", "arg_0", ",", "str", ")", "else", "arg_0", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_6", ":", "if", "not", "arg_1", "(", "arg_8", ")", ":", "arg_7", ".", "append", "(", "arg_8", ")", "if", "arg_7", ":", "print", "(", "arg_2", ".", "format", "(", "', '", ".", "join", "(", "arg_7", ")", ",", "arg_3", ".", "__name__", ")", ")", "raise", "RuntimeError", "(", "'Prerequisites not meet.'", ")", "else", ":", "return", "arg_3", "(", "*", "arg_4", ",", "**", "arg_5", ")", "return", "wrapped_func", "return", "wrap"], "function": "def Func(\n        arg_0,\n        arg_1,\n        arg_2='Prerequisites \"{}\" are required in method \"{}\" but not '\n        'found, please install them first.'):\n    \"\"\"A decorator factory to check if prerequisites are satisfied.\n\n    Args:\n        prerequisites (str of list[str]): Prerequisites to be checked.\n        checker (callable): The checker method that returns True if a\n            prerequisite is meet, False otherwise.\n        msg_tmpl (str): The message template with two variables.\n\n    Returns:\n        decorator: A specific decorator.\n    \"\"\"\n\n    def wrap(arg_3):\n\n        @functools.wraps(arg_3)\n        def wrapped_func(*arg_4, **arg_5):\n            arg_6 = [arg_0] if isinstance(\n                arg_0, str) else arg_0\n            arg_7 = []\n            for arg_8 in arg_6:\n                if not arg_1(arg_8):\n                    arg_7.append(arg_8)\n            if arg_7:\n                print(arg_2.format(', '.join(arg_7), arg_3.__name__))\n                raise RuntimeError('Prerequisites not meet.')\n            else:\n                return arg_3(*arg_4, **arg_5)\n\n        return wrapped_func\n\n    return wrap", "path": "mmcv/utils/misc.py", "identifier": "check_prerequisites", "docstring": "A decorator factory to check if prerequisites are satisfied.\n\n    Args:\n        prerequisites (str of list[str]): Prerequisites to be checked.\n        checker (callable): The checker method that returns True if a\n            prerequisite is meet, False otherwise.\n        msg_tmpl (str): The message template with two variables.\n\n    Returns:\n        decorator: A specific decorator.", "docstring_tokens": ["A", "decorator", "factory", "to", "check", "if", "prerequisites", "are", "satisfied", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 251993}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/transforms/preprocessing.py#L78-L89", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Undo the scale transformation.", "language": "python", "parameters": "(self, X, y=None, **params)", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "for", "arg_4", "in", "range", "(", "arg_1", ".", "ncol", ")", ":", "arg_1", "[", "arg_4", "]", "=", "arg_0", ".", "means", "[", "arg_4", "]", "+", "arg_0", ".", "stds", "[", "arg_4", "]", "*", "arg_1", "[", "arg_4", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"\n        Undo the scale transformation.\n\n        :param X: An H2OFrame; may contain NAs and/or categoricals.\n        :param y: None (Ignored)\n        :param params: (Ignored)\n        :returns: An H2OFrame\n        \"\"\"\n        for arg_4 in range(arg_1.ncol):\n            arg_1[arg_4] = arg_0.means[arg_4] + arg_0.stds[arg_4] * arg_1[arg_4]\n        return arg_1", "path": "h2o-py/h2o/transforms/preprocessing.py", "identifier": "H2OScaler.inverse_transform", "docstring": "Undo the scale transformation.\n\n        :param X: An H2OFrame; may contain NAs and/or categoricals.\n        :param y: None (Ignored)\n        :param params: (Ignored)\n        :returns: An H2OFrame", "docstring_tokens": ["Undo", "the", "scale", "transformation", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 251994}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/panel.py#L202-L228", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Fetch a gene panel.", "language": "python", "parameters": "(self, panel_id, version=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "'panel_name'", ":", "arg_1", "}", "if", "arg_2", ":", "LOG", ".", "info", "(", "\"Fetch gene panel {0}, version {1} from database\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "arg_3", "[", "'version'", "]", "=", "arg_2", "return", "arg_0", ".", "panel_collection", ".", "find_one", "(", "arg_3", ")", "else", ":", "LOG", ".", "info", "(", "\"Fetching gene panels %s from database\"", ",", "arg_1", ")", "arg_4", "=", "arg_0", ".", "panel_collection", ".", "find", "(", "arg_3", ")", ".", "sort", "(", "'version'", ",", "-", "1", ")", "if", "arg_4", ".", "count", "(", ")", ">", "0", ":", "return", "arg_4", "[", "0", "]", "else", ":", "LOG", ".", "info", "(", "\"No gene panel found\"", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Fetch a gene panel.\n\n        If no panel is sent return all panels\n\n        Args:\n            panel_id (str): unique id for the panel\n            version (str): version of the panel. If 'None' latest version will be returned\n\n        Returns:\n            Func: gene panel object\n        \"\"\"\n        arg_3 = {'panel_name': arg_1}\n        if arg_2:\n            LOG.info(\"Fetch gene panel {0}, version {1} from database\".format(\n                arg_1, arg_2\n            ))\n            arg_3['version'] = arg_2\n            return arg_0.panel_collection.find_one(arg_3)\n        else:\n            LOG.info(\"Fetching gene panels %s from database\", arg_1)\n            arg_4 = arg_0.panel_collection.find(arg_3).sort('version', -1)\n            if arg_4.count() > 0:\n                return arg_4[0]\n            else:\n                LOG.info(\"No gene panel found\")\n                return None", "path": "scout/adapter/mongo/panel.py", "identifier": "PanelHandler.gene_panel", "docstring": "Fetch a gene panel.\n\n        If no panel is sent return all panels\n\n        Args:\n            panel_id (str): unique id for the panel\n            version (str): version of the panel. If 'None' latest version will be returned\n\n        Returns:\n            gene_panel: gene panel object", "docstring_tokens": ["Fetch", "a", "gene", "panel", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 251995}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L442-L454", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the list of all completed swarms.", "language": "python", "parameters": "(self)", "return_statement": "return swarmIds", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "_state", "[", "'swarms'", "]", ".", "iteritems", "(", ")", ":", "if", "arg_3", "[", "'status'", "]", "==", "'completed'", ":", "arg_1", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return the list of all completed swarms.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    retval:   list of active swarm Ids\n    \"\"\"\n    arg_1 = []\n    for arg_2, arg_3 in arg_0._state['swarms'].iteritems():\n      if arg_3['status'] == 'completed':\n        arg_1.append(arg_2)\n\n    return arg_1", "path": "src/nupic/swarming/hypersearch/hs_state.py", "identifier": "HsState.getCompletedSwarms", "docstring": "Return the list of all completed swarms.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    retval:   list of active swarm Ids", "docstring_tokens": ["Return", "the", "list", "of", "all", "completed", "swarms", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 251996}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L282-L315", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Get the document title in the specified markup format.", "language": "python", "parameters": "(self, format='html5', deparagraph=True, mathjax=False,\n                     smart=True, extra_args=None)", "return_statement": "return output_text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'html5'", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "if", "arg_0", ".", "title", "is", "None", ":", "return", "None", "arg_6", "=", "convert_lsstdoc_tex", "(", "arg_0", ".", "title", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1='html5', arg_2=True, arg_3=False,\n                     arg_4=True, arg_5=None):\n        \"\"\"Get the document title in the specified markup format.\n\n        Parameters\n        ----------\n        format : `str`, optional\n            Output format (such as ``'html5'`` or ``'plain'``).\n        deparagraph : `bool`, optional\n            Remove the paragraph tags from single paragraph content.\n        mathjax : `bool`, optional\n            Allow pandoc to use MathJax math markup.\n        smart : `True`, optional\n            Allow pandoc to create \"smart\" unicode punctuation.\n        extra_args : `list`, optional\n            Additional command line flags to pass to Pandoc. See\n            `lsstprojectmeta.pandoc.convert.convert_text`.\n\n        Returns\n        -------\n        output_text : `str`\n            Converted content or `None` if the title is not available in\n            the document.\n        \"\"\"\n        if arg_0.title is None:\n            return None\n\n        arg_6 = convert_lsstdoc_tex(\n            arg_0.title, arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5)\n        return arg_6", "path": "lsstprojectmeta/tex/lsstdoc.py", "identifier": "LsstLatexDoc.format_title", "docstring": "Get the document title in the specified markup format.\n\n        Parameters\n        ----------\n        format : `str`, optional\n            Output format (such as ``'html5'`` or ``'plain'``).\n        deparagraph : `bool`, optional\n            Remove the paragraph tags from single paragraph content.\n        mathjax : `bool`, optional\n            Allow pandoc to use MathJax math markup.\n        smart : `True`, optional\n            Allow pandoc to create \"smart\" unicode punctuation.\n        extra_args : `list`, optional\n            Additional command line flags to pass to Pandoc. See\n            `lsstprojectmeta.pandoc.convert.convert_text`.\n\n        Returns\n        -------\n        output_text : `str`\n            Converted content or `None` if the title is not available in\n            the document.", "docstring_tokens": ["Get", "the", "document", "title", "in", "the", "specified", "markup", "format", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 251997}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/utils.py#L89-L97", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Verify that base_url specifies a protocol and network location.", "language": "python", "parameters": "(base_url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urllib", ".", "parse", ".", "urlparse", "(", "arg_0", ")", "if", "arg_1", ".", "scheme", "and", "arg_1", ".", "netloc", ":", "return", "arg_1", ".", "geturl", "(", ")", "else", ":", "arg_2", "=", "\"base_url must contain a valid scheme (protocol \"", "\"specifier) and network location (hostname)\"", "raise", "ValueError", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Verify that base_url specifies a protocol and network location.\"\"\"\n    arg_1 = urllib.parse.urlparse(arg_0)\n    if arg_1.scheme and arg_1.netloc:\n        return arg_1.geturl()\n    else:\n        arg_2 = \"base_url must contain a valid scheme (protocol \" \\\n                        \"specifier) and network location (hostname)\"\n        raise ValueError(arg_2)", "path": "webexteamssdk/utils.py", "identifier": "validate_base_url", "docstring": "Verify that base_url specifies a protocol and network location.", "docstring_tokens": ["Verify", "that", "base_url", "specifies", "a", "protocol", "and", "network", "location", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 251998}
{"url": "https://github.com/gaqzi/py-gocd/blob/6fe5b62dea51e665c11a343aba5fc98e130c5c63/gocd/api/template_config.py#L37-L56", "sha": "6fe5b62dea51e665c11a343aba5fc98e130c5c63", "docstring_summary": "Update template config for specified template name.", "language": "python", "parameters": "(self, config, etag)", "return_statement": "return self._request(self.name,\n                             ok_status=None,\n                             data=data,\n                             headers=headers,\n                             method=\"PUT\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_json_encode", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "_default_headers", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_4", "[", "\"If-Match\"", "]", "=", "arg_2", "return", "arg_0", ".", "_request", "(", "arg_0", ".", "name", ",", "ok_status", "=", "None", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "method", "=", "\"PUT\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Update template config for specified template name.\n\n        .. __: https://api.go.cd/current/#Func-template-config\n\n        Returns:\n          Response: :class:`gocd.api.response.Response` object\n        \"\"\"\n\n        arg_3 = arg_0._json_encode(arg_1)\n        arg_4 = arg_0._default_headers()\n\n        if arg_2 is not None:\n            arg_4[\"If-Match\"] = arg_2\n\n        return arg_0._request(arg_0.name,\n                             ok_status=None,\n                             arg_3=arg_3,\n                             arg_4=arg_4,\n                             method=\"PUT\")", "path": "gocd/api/template_config.py", "identifier": "TemplateConfig.edit", "docstring": "Update template config for specified template name.\n\n        .. __: https://api.go.cd/current/#edit-template-config\n\n        Returns:\n          Response: :class:`gocd.api.response.Response` object", "docstring_tokens": ["Update", "template", "config", "for", "specified", "template", "name", "."], "nwo": "gaqzi/py-gocd", "score": 0.19238082074498727, "idx": 251999}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/runner.py#L583-L617", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "If state_name or im_name is None, picks them interactively through Tk,\n    and then sets with or without the full path.", "language": "python", "parameters": "(state_name, im_name, use_full_path=False)", "return_statement": "return state_name, im_name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "os", ".", "getcwd", "(", ")", "if", "(", "arg_0", "is", "None", ")", "or", "(", "arg_1", "is", "None", ")", ":", "arg_4", "=", "tk", ".", "Tk", "(", ")", "arg_4", ".", "withdraw", "(", ")", "if", "arg_0", "is", "None", ":", "arg_0", "=", "tkfd", ".", "askopenfilename", "(", "initialdir", "=", "arg_3", ",", "title", "=", "'Select pre-featured state'", ")", "os", ".", "chdir", "(", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "tkfd", ".", "askopenfilename", "(", "initialdir", "=", "arg_3", ",", "title", "=", "'Select new image'", ")", "if", "(", "not", "arg_2", ")", "and", "(", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "!=", "''", ")", ":", "arg_5", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "os", ".", "chdir", "(", "arg_5", ")", "arg_1", "=", "os", ".", "path", ".", "basename", "(", "arg_1", ")", "else", ":", "os", ".", "chdir", "(", "arg_3", ")", "return", "arg_0", ",", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    If state_name or im_name is None, picks them interactively through Tk,\n    and then sets with or without the full path.\n\n    Parameters\n    ----------\n        state_name : {string, None}\n            The name of the state. If None, selected through Tk.\n        im_name : {string, None}\n            The name of the image. If None, selected through Tk.\n        use_full_path : Bool, optional\n            Set to True to return the names as full paths rather than\n            relative paths. Default is False (relative path).\n    \"\"\"\n    arg_3 = os.getcwd()\n    if (arg_0 is None) or (arg_1 is None):\n        arg_4 = tk.Tk()\n        arg_4.withdraw()\n    if arg_0 is None:\n        arg_0 = tkfd.askopenfilename(\n                initialdir=arg_3, title='Select pre-featured state')\n        os.chdir(os.path.dirname(arg_0))\n\n    if arg_1 is None:\n        arg_1 = tkfd.askopenfilename(\n                initialdir=arg_3, title='Select new image')\n\n    if (not arg_2) and (os.path.dirname(arg_1) != ''):\n        arg_5 = os.path.dirname(arg_1)\n        os.chdir(arg_5)\n        arg_1 = os.path.basename(arg_1)\n    else:\n        os.chdir(arg_3)\n    return arg_0, arg_1", "path": "peri/runner.py", "identifier": "_pick_state_im_name", "docstring": "If state_name or im_name is None, picks them interactively through Tk,\n    and then sets with or without the full path.\n\n    Parameters\n    ----------\n        state_name : {string, None}\n            The name of the state. If None, selected through Tk.\n        im_name : {string, None}\n            The name of the image. If None, selected through Tk.\n        use_full_path : Bool, optional\n            Set to True to return the names as full paths rather than\n            relative paths. Default is False (relative path).", "docstring_tokens": ["If", "state_name", "or", "im_name", "is", "None", "picks", "them", "interactively", "through", "Tk", "and", "then", "sets", "with", "or", "without", "the", "full", "path", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252000}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/gui/gui_mainLayout.py#L854-L861", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "This function intercepts the mouse's right click and its position.", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "button", "==", "3", ":", "if", "arg_0", ".", "ui", ".", "tabWidget", ".", "currentIndex", "(", ")", "==", "TabWidget", ".", "NORMAL_MODE", ":", "arg_0", ".", "pos", "=", "QtGui", ".", "QCursor", "(", ")", ".", "pos", "(", ")", "arg_0", ".", "graphic_context_menu", "(", "arg_0", ".", "pos", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        This function intercepts the mouse's right Func and its position.\n        \"\"\"\n        if arg_1.button == 3:\n            if arg_0.ui.tabWidget.currentIndex() == TabWidget.NORMAL_MODE:\n                arg_0.pos = QtGui.QCursor().pos()\n                arg_0.graphic_context_menu(arg_0.pos)", "path": "gui/gui_mainLayout.py", "identifier": "FormEvents.click", "docstring": "This function intercepts the mouse's right click and its position.", "docstring_tokens": ["This", "function", "intercepts", "the", "mouse", "s", "right", "click", "and", "its", "position", "."], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 252001}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/api.py#L184-L206", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Return the appropriate URL prefix to prepend to requests,\n        based on the host provided in settings.", "language": "python", "parameters": "(self, include_version=True)", "return_statement": "return prefix", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "settings", ".", "host", "if", "'://'", "not", "in", "arg_2", ":", "arg_2", "=", "'https://%s'", "%", "arg_2", ".", "strip", "(", "'/'", ")", "elif", "arg_2", ".", "startswith", "(", "'http://'", ")", "and", "settings", ".", "verify_ssl", ":", "raise", "exc", ".", "TowerCLIError", "(", "'Can not verify ssl with non-https protocol. Change the '", "'verify_ssl configuration setting to continue.'", ")", "arg_3", "=", "urlparse", "(", "arg_2", ")", "if", "arg_3", "[", "0", "]", "not", "in", "[", "'http'", ",", "'https'", "]", ":", "raise", "exc", ".", "ConnectionError", "(", "'URL must be http(s), {} is not valid'", ".", "format", "(", "arg_3", "[", "0", "]", ")", ")", "arg_4", "=", "urljoin", "(", "arg_2", ",", "'/api/'", ")", "if", "arg_1", ":", "arg_4", "=", "urljoin", "(", "arg_4", ",", "\"{}/\"", ".", "format", "(", "CUR_API_VERSION", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Return the appropriate URL prefix to prepend to requests,\n        based on the host provided in settings.\n        \"\"\"\n        arg_2 = settings.host\n        if '://' not in arg_2:\n            arg_2 = 'https://%s' % arg_2.strip('/')\n        elif arg_2.startswith('http://') and settings.verify_ssl:\n            raise exc.TowerCLIError(\n                'Can not verify ssl with non-https protocol. Change the '\n                'verify_ssl configuration setting to continue.'\n            )\n        # Validate that we have either an http or https based URL\n        arg_3 = urlparse(arg_2)\n        if arg_3[0] not in ['http', 'https']:\n            raise exc.ConnectionError('URL must be http(s), {} is not valid'.format(arg_3[0]))\n\n        arg_4 = urljoin(arg_2, '/api/')\n        if arg_1:\n            # We add the / to the end of {} so that our URL has the ending slash.\n            arg_4 = urljoin(arg_4, \"{}/\".format(CUR_API_VERSION))\n\n        return arg_4", "path": "tower_cli/api.py", "identifier": "Client.get_prefix", "docstring": "Return the appropriate URL prefix to prepend to requests,\n        based on the host provided in settings.", "docstring_tokens": ["Return", "the", "appropriate", "URL", "prefix", "to", "prepend", "to", "requests", "based", "on", "the", "host", "provided", "in", "settings", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 252002}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L1123-L1156", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns the stability for the population averaged over multiple time steps", "language": "python", "parameters": "(vectors, numSamples=None)", "return_statement": "return sigmap / numSamples", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "len", "(", "arg_0", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_2", "-", "1", "arg_3", "=", "range", "(", "arg_2", "-", "1", ")", "else", ":", "arg_3", "=", "numpy", ".", "random", ".", "randint", "(", "0", ",", "arg_2", "-", "1", ",", "arg_1", ")", "arg_4", "=", "0.0", "for", "arg_5", "in", "arg_3", ":", "arg_6", "=", "checkMatch", "(", "arg_0", "[", "arg_5", "]", ",", "arg_0", "[", "arg_5", "+", "1", "]", ",", "sparse", "=", "False", ")", "if", "arg_6", "[", "1", "]", "!=", "0", ":", "arg_4", "+=", "float", "(", "arg_6", "[", "0", "]", ")", "/", "arg_6", "[", "1", "]", "return", "arg_4", "/", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"\n  Returns the stability for the population averaged over multiple time steps\n\n  Parameters:\n  -----------------------------------------------\n  vectors:          the vectors for which the stability is calculated\n  numSamples        the number of time steps where stability is counted\n\n  At each time step, count the fraction of the active elements which are stable\n  from the previous step\n  Average all the fraction\n\n  \"\"\"\n\n  # ----------------------------------------------------------------------\n  # Calculate the stability\n  arg_2 = len(arg_0)\n\n  if arg_1 is None:\n    arg_1 = arg_2-1\n    arg_3 = range(arg_2-1)\n  else:\n    arg_3 = numpy.random.randint(0, arg_2-1, arg_1)\n\n\n  arg_4 = 0.0\n  for arg_5 in arg_3:\n    arg_6 = checkMatch(arg_0[arg_5], arg_0[arg_5+1], sparse=False)\n    # Ignore reset vectors (all 0's)\n    if arg_6[1] != 0:\n      arg_4 += float(arg_6[0])/arg_6[1]\n\n  return arg_4 / arg_1", "path": "src/nupic/algorithms/fdrutilities.py", "identifier": "populationStability", "docstring": "Returns the stability for the population averaged over multiple time steps\n\n  Parameters:\n  -----------------------------------------------\n  vectors:          the vectors for which the stability is calculated\n  numSamples        the number of time steps where stability is counted\n\n  At each time step, count the fraction of the active elements which are stable\n  from the previous step\n  Average all the fraction", "docstring_tokens": ["Returns", "the", "stability", "for", "the", "population", "averaged", "over", "multiple", "time", "steps"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252003}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L662-L670", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return an iterable of possible completions matching the given\n        prefix from the list of referred Vars.", "language": "python", "parameters": "(self, value: str)", "return_statement": "return map(\n            lambda entry: f\"{entry[0].name}\",\n            filter(\n                Namespace.__completion_matcher(value), [(s, v) for s, v in self.refers]\n            ),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Iterable", "[", "arg_2", "]", ":", "return", "map", "(", "lambda", "entry", ":", "f\"{entry[0].name}\"", ",", "filter", "(", "Namespace", ".", "__completion_matcher", "(", "arg_1", ")", ",", "[", "(", "arg_3", ",", "arg_4", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "refers", "]", ")", ",", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> Iterable[arg_2]:\n        \"\"\"Return an iterable of possible completions matching the given\n        prefix from the list of referred Vars.\"\"\"\n        return map(\n            lambda entry: f\"{entry[0].name}\",\n            filter(\n                Namespace.__completion_matcher(arg_1), [(arg_3, arg_4) for arg_3, arg_4 in arg_0.refers]\n            ),\n        )", "path": "src/basilisp/lang/runtime.py", "identifier": "Namespace.__complete_refers", "docstring": "Return an iterable of possible completions matching the given\n        prefix from the list of referred Vars.", "docstring_tokens": ["Return", "an", "iterable", "of", "possible", "completions", "matching", "the", "given", "prefix", "from", "the", "list", "of", "referred", "Vars", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252004}
{"url": "https://github.com/dstegelman/django-mail-queue/blob/c9429d53454b117cde2e7a8cb912c8f5ae8394af/mailqueue/models.py#L28-L37", "sha": "c9429d53454b117cde2e7a8cb912c8f5ae8394af", "docstring_summary": "Deletes sent MailerMessage records", "language": "python", "parameters": "(self, offset=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "getattr", "(", "settings", ",", "'MAILQUEUE_CLEAR_OFFSET'", ",", "defaults", ".", "MAILQUEUE_CLEAR_OFFSET", ")", "if", "type", "(", "arg_1", ")", "is", "int", ":", "arg_1", "=", "datetime", ".", "timedelta", "(", "hours", "=", "arg_1", ")", "arg_2", "=", "timezone", ".", "now", "(", ")", "-", "arg_1", "arg_0", ".", "filter", "(", "sent", "=", "True", ",", "last_attempt__lte", "=", "arg_2", ")", ".", "delete", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\" Deletes sent MailerMessage records \"\"\"\n        if arg_1 is None:\n            arg_1 = getattr(settings, 'MAILQUEUE_CLEAR_OFFSET', defaults.MAILQUEUE_CLEAR_OFFSET)\n\n        if type(arg_1) is int:\n            arg_1 = datetime.timedelta(hours=arg_1)\n\n        arg_2 = timezone.now() - arg_1\n        arg_0.filter(sent=True, last_attempt__lte=arg_2).delete()", "path": "mailqueue/models.py", "identifier": "MailerMessageManager.clear_sent_messages", "docstring": "Deletes sent MailerMessage records", "docstring_tokens": ["Deletes", "sent", "MailerMessage", "records"], "nwo": "dstegelman/django-mail-queue", "score": 0.19509603551588234, "idx": 252005}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/qrt.py#L184-L192", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Take control of QTM.", "language": "python", "parameters": "(self, password)", "return_statement": "return await asyncio.wait_for(\n            self._protocol.send_command(cmd), timeout=self._timeout\n        )", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"takecontrol %s\"", "%", "arg_1", "return", "await", "asyncio", ".", "wait_for", "(", "arg_0", ".", "_protocol", ".", "send_command", "(", "arg_2", ")", ",", "timeout", "=", "arg_0", ".", "_timeout", ")"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Take control of QTM.\n\n        :param password: Password as entered in QTM.\n        \"\"\"\n        arg_2 = \"takecontrol %s\" % arg_1\n        return await asyncio.wait_for(\n            arg_0._protocol.send_command(arg_2), timeout=arg_0._timeout\n        )", "path": "qtm/qrt.py", "identifier": "QRTConnection.take_control", "docstring": "Take control of QTM.\n\n        :param password: Password as entered in QTM.", "docstring_tokens": ["Take", "control", "of", "QTM", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 252006}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/svg_fonts.py#L97-L117", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Return the ElementTree of the SVG content in `filepath`\n    with the font content embedded.", "language": "python", "parameters": "(filepath, font_files)", "return_statement": "return tree", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "svgf", ":", "arg_2", "=", "etree", ".", "parse", "(", "svgf", ")", "if", "not", "arg_1", ":", "return", "arg_2", "arg_3", "=", "FontFaceGroup", "(", ")", "for", "arg_4", "in", "arg_1", ":", "arg_3", ".", "append", "(", "FontFace", "(", "arg_4", ")", ")", "for", "arg_5", "in", "arg_2", ".", "iter", "(", ")", ":", "if", "arg_5", ".", "tag", ".", "split", "(", "\"}\"", ")", "[", "1", "]", "==", "'svg'", ":", "break", "arg_5", ".", "insert", "(", "0", ",", "arg_3", ".", "xml_elem", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Return the ElementTree of the SVG content in `filepath`\n    with the font content embedded.\n    \"\"\"\n    with open(arg_0, 'r') as svgf:\n        arg_2 = etree.parse(svgf)\n\n    if not arg_1:\n        return arg_2\n\n    arg_3 = FontFaceGroup()\n    for arg_4 in arg_1:\n        arg_3.append(FontFace(arg_4))\n\n    for arg_5 in arg_2.iter():\n        if arg_5.tag.split(\"}\")[1] == 'svg':\n            break\n\n    arg_5.insert(0, arg_3.xml_elem)\n\n    return arg_2", "path": "docstamp/svg_fonts.py", "identifier": "_embed_font_to_svg", "docstring": "Return the ElementTree of the SVG content in `filepath`\n    with the font content embedded.", "docstring_tokens": ["Return", "the", "ElementTree", "of", "the", "SVG", "content", "in", "filepath", "with", "the", "font", "content", "embedded", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 252007}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/hooks/hook_funcs.py#L43-L77", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Takes an object, a key, and a value and produces a new object\n    that is a copy of the original but with ``value`` as the new value of\n    ``key``.", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_0", ".", "_lens_Func", "except", "AttributeError", ":", "arg_3", "=", "copy", ".", "copy", "(", "arg_0", ")", "arg_3", "[", "arg_1", "]", "=", "arg_2", "return", "arg_3", "else", ":", "return", "arg_0", ".", "_lens_Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    # type: (Any, Any, Any) -> Any\n    '''Takes an object, a key, and a value and produces a new object\n    that is a copy of the original but with ``value`` as the new value of\n    ``key``.\n\n    The following equality should hold for your definition:\n\n    .. code-block:: python\n\n        Func(obj, key, obj[key]) == obj\n\n    This function is used by many lenses (particularly GetitemLens) to\n    set items on states even when those states do not ordinarily support\n    ``Func``. This function is designed to have a similar signature\n    as python's built-in ``Func`` except that it returns a new object\n    that has the item set rather than mutating the object in place.\n\n    It's what enables the ``lens[some_key]`` functionality.\n\n    The corresponding method call for this hook is\n    ``obj._lens_Func(key, value)``.\n\n    The default implementation makes a copy of the object using\n    ``copy.copy`` and then mutates the new object by setting the item\n    on it in the conventional way.\n    '''\n    try:\n        arg_0._lens_Func\n    except AttributeError:\n        arg_3 = copy.copy(arg_0)\n        arg_3[arg_1] = arg_2\n        return arg_3\n    else:\n        return arg_0._lens_Func(arg_1, arg_2)", "path": "lenses/hooks/hook_funcs.py", "identifier": "setitem", "docstring": "Takes an object, a key, and a value and produces a new object\n    that is a copy of the original but with ``value`` as the new value of\n    ``key``.\n\n    The following equality should hold for your definition:\n\n    .. code-block:: python\n\n        setitem(obj, key, obj[key]) == obj\n\n    This function is used by many lenses (particularly GetitemLens) to\n    set items on states even when those states do not ordinarily support\n    ``setitem``. This function is designed to have a similar signature\n    as python's built-in ``setitem`` except that it returns a new object\n    that has the item set rather than mutating the object in place.\n\n    It's what enables the ``lens[some_key]`` functionality.\n\n    The corresponding method call for this hook is\n    ``obj._lens_setitem(key, value)``.\n\n    The default implementation makes a copy of the object using\n    ``copy.copy`` and then mutates the new object by setting the item\n    on it in the conventional way.", "docstring_tokens": ["Takes", "an", "object", "a", "key", "and", "a", "value", "and", "produces", "a", "new", "object", "that", "is", "a", "copy", "of", "the", "original", "but", "with", "value", "as", "the", "new", "value", "of", "key", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 252008}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py#L267-L270", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "create our session object", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "default_secure", "(", "arg_0", ".", "config", ")", "arg_0", ".", "session", "=", "Session", "(", "config", "=", "arg_0", ".", "config", ",", "username", "=", "u'kernel'", ")"], "function": "def Func(arg_0):\n        \"\"\"create our session object\"\"\"\n        default_secure(arg_0.config)\n        arg_0.session = Session(config=arg_0.config, username=u'kernel')", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py", "identifier": "KernelApp.init_session", "docstring": "create our session object", "docstring_tokens": ["create", "our", "session", "object"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252009}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/palette.py#L56-L117", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Return a color interpolated from the Palette.", "language": "python", "parameters": "(self, position=0)", "return_statement": "return r1 + fade * dr, g1 + fade * dg, b1 + fade * db", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "len", "(", "arg_0", ")", "if", "arg_2", "==", "1", ":", "return", "arg_0", "[", "0", "]", "arg_3", "=", "arg_1", "if", "arg_0", ".", "length", "and", "arg_0", ".", "autoscale", ":", "arg_3", "*=", "len", "(", "arg_0", ")", "arg_3", "/=", "arg_0", ".", "length", "arg_3", "*=", "arg_0", ".", "scale", "arg_3", "+=", "arg_0", ".", "offset", "if", "not", "arg_0", ".", "continuous", ":", "if", "not", "arg_0", ".", "serpentine", ":", "return", "arg_0", "[", "int", "(", "arg_3", "%", "arg_2", ")", "]", "arg_4", "=", "(", "2", "*", "arg_2", ")", "-", "2", "arg_3", "%=", "arg_4", "if", "arg_3", "<", "arg_2", ":", "return", "arg_0", "[", "int", "(", "arg_3", ")", "]", "else", ":", "return", "arg_0", "[", "int", "(", "arg_4", "-", "arg_3", ")", "]", "if", "arg_0", ".", "serpentine", ":", "arg_3", "%=", "(", "2", "*", "arg_2", ")", "if", "arg_3", ">", "arg_2", ":", "arg_3", "=", "(", "2", "*", "arg_2", ")", "-", "arg_3", "else", ":", "arg_3", "%=", "arg_2", "arg_3", "*=", "arg_2", "-", "1", "arg_3", "/=", "arg_2", "arg_5", "=", "int", "(", "arg_3", ")", "arg_6", "=", "arg_3", "-", "arg_5", "if", "not", "arg_6", ":", "return", "arg_0", "[", "arg_5", "]", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_0", "[", "arg_5", "]", "arg_10", ",", "arg_11", ",", "arg_12", "=", "arg_0", "[", "(", "arg_5", "+", "1", ")", "%", "len", "(", "arg_0", ")", "]", "arg_13", ",", "arg_14", ",", "arg_15", "=", "arg_10", "-", "arg_7", ",", "arg_11", "-", "arg_8", ",", "arg_12", "-", "arg_9", "return", "arg_7", "+", "arg_6", "*", "arg_13", ",", "arg_8", "+", "arg_6", "*", "arg_14", ",", "arg_9", "+", "arg_6", "*", "arg_15"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"\n        Return a color interpolated from the Palette.\n\n        In the case where continuous=False, serpentine=False, scale=1,\n        autoscale=False, and offset=0, this is exactly the same as plain old []\n        indexing, but with a wrap-around.\n\n        The constructor parameters affect this result as documented in the\n        constructor.\n\n        Arguments:\n           ``position``:\n             May be any integer or floating point number\n        \"\"\"\n        arg_2 = len(arg_0)\n        if arg_2 == 1:\n            return arg_0[0]\n\n        arg_3 = arg_1\n\n        if arg_0.length and arg_0.autoscale:\n            arg_3 *= len(arg_0)\n            arg_3 /= arg_0.length\n\n        arg_3 *= arg_0.scale\n        arg_3 += arg_0.offset\n\n        if not arg_0.continuous:\n            if not arg_0.serpentine:\n                return arg_0[int(arg_3 % arg_2)]\n\n            # We want a color sequence of length 2n-2\n            # e.g. for n=5: a b c d | e d c b | a b c d ...\n            arg_4 = (2 * arg_2) - 2\n            arg_3 %= arg_4\n            if arg_3 < arg_2:\n                return arg_0[int(arg_3)]\n            else:\n                return arg_0[int(arg_4 - arg_3)]\n\n        if arg_0.serpentine:\n            arg_3 %= (2 * arg_2)\n            if arg_3 > arg_2:\n                arg_3 = (2 * arg_2) - arg_3\n        else:\n            arg_3 %= arg_2\n\n        # p is a number in [0, n): scale it to be in [0, n-1)\n        arg_3 *= arg_2 - 1\n        arg_3 /= arg_2\n\n        arg_5 = int(arg_3)\n        arg_6 = arg_3 - arg_5\n        if not arg_6:\n            return arg_0[arg_5]\n\n        arg_7, arg_8, arg_9 = arg_0[arg_5]\n        arg_10, arg_11, arg_12 = arg_0[(arg_5 + 1) % len(arg_0)]\n        arg_13, arg_14, arg_15 = arg_10 - arg_7, arg_11 - arg_8, arg_12 - arg_9\n\n        return arg_7 + arg_6 * arg_13, arg_8 + arg_6 * arg_14, arg_9 + arg_6 * arg_15", "path": "bibliopixel/colors/palette.py", "identifier": "Palette.get", "docstring": "Return a color interpolated from the Palette.\n\n        In the case where continuous=False, serpentine=False, scale=1,\n        autoscale=False, and offset=0, this is exactly the same as plain old []\n        indexing, but with a wrap-around.\n\n        The constructor parameters affect this result as documented in the\n        constructor.\n\n        Arguments:\n           ``position``:\n             May be any integer or floating point number", "docstring_tokens": ["Return", "a", "color", "interpolated", "from", "the", "Palette", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 252010}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L957-L1012", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "For all DAG IDs in the SimpleDagBag, look for task instances in the\n        old_states and set them to new_state if the corresponding DagRun\n        does not exist or exists but is not in the running state. This\n        normally should not happen, but it can if the state of DagRuns are\n        changed manually.", "language": "python", "parameters": "(self,\n                                             simple_dag_bag,\n                                             old_states,\n                                             new_state,\n                                             session=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "0", "arg_6", "=", "arg_4", ".", "query", "(", "models", ".", "TaskInstance", ")", ".", "outerjoin", "(", "models", ".", "DagRun", ",", "and_", "(", "models", ".", "TaskInstance", ".", "dag_id", "==", "models", ".", "DagRun", ".", "dag_id", ",", "models", ".", "TaskInstance", ".", "execution_date", "==", "models", ".", "DagRun", ".", "execution_date", ")", ")", ".", "filter", "(", "models", ".", "TaskInstance", ".", "dag_id", ".", "in_", "(", "arg_1", ".", "dag_ids", ")", ")", ".", "filter", "(", "models", ".", "TaskInstance", ".", "state", ".", "in_", "(", "arg_2", ")", ")", ".", "filter", "(", "or_", "(", "models", ".", "DagRun", ".", "state", "!=", "State", ".", "RUNNING", ",", "models", ".", "DagRun", ".", "state", ".", "is_", "(", "None", ")", ")", ")", "if", "arg_0", ".", "using_sqlite", ":", "arg_7", "=", "arg_6", ".", "with_for_update", "(", ")", ".", "all", "(", ")", "for", "arg_8", "in", "arg_7", ":", "arg_8", ".", "set_state", "(", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_5", "+=", "1", "else", ":", "arg_9", "=", "arg_6", ".", "subquery", "(", ")", "arg_5", "=", "arg_4", ".", "query", "(", "models", ".", "TaskInstance", ")", ".", "filter", "(", "and_", "(", "models", ".", "TaskInstance", ".", "dag_id", "==", "arg_9", ".", "c", ".", "dag_id", ",", "models", ".", "TaskInstance", ".", "task_id", "==", "arg_9", ".", "c", ".", "task_id", ",", "models", ".", "TaskInstance", ".", "execution_date", "==", "arg_9", ".", "c", ".", "execution_date", ")", ")", ".", "update", "(", "{", "models", ".", "TaskInstance", ".", "state", ":", "arg_3", "}", ",", "synchronize_session", "=", "False", ")", "arg_4", ".", "commit", "(", ")", "if", "arg_5", ">", "0", ":", "arg_0", ".", "log", ".", "warning", "(", "\"Set %s task instances to state=%s as their associated DagRun was not in RUNNING state\"", ",", "arg_5", ",", "arg_3", ")"], "function": "def Func(arg_0,\n                                             arg_1,\n                                             arg_2,\n                                             arg_3,\n                                             arg_4=None):\n        \"\"\"\n        For all DAG IDs in the SimpleDagBag, look for task instances in the\n        old_states and set them to new_state if the corresponding DagRun\n        does not exist or exists but is not in the running state. This\n        normally should not happen, but it can if the state of DagRuns are\n        changed manually.\n\n        :param old_states: examine TaskInstances in this state\n        :type old_state: list[airflow.utils.state.State]\n        :param new_state: set TaskInstances to this state\n        :type new_state: airflow.utils.state.State\n        :param simple_dag_bag: TaskInstances associated with DAGs in the\n            simple_dag_bag and with states in the old_state will be examined\n        :type simple_dag_bag: airflow.utils.dag_processing.SimpleDagBag\n        \"\"\"\n        arg_5 = 0\n        arg_6 = arg_4 \\\n            .query(models.TaskInstance) \\\n            .outerjoin(models.DagRun, and_(\n                models.TaskInstance.dag_id == models.DagRun.dag_id,\n                models.TaskInstance.execution_date == models.DagRun.execution_date)) \\\n            .filter(models.TaskInstance.dag_id.in_(arg_1.dag_ids)) \\\n            .filter(models.TaskInstance.state.in_(arg_2)) \\\n            .filter(or_(\n                models.DagRun.state != State.RUNNING,\n                models.DagRun.state.is_(None)))\n        if arg_0.using_sqlite:\n            arg_7 = arg_6 \\\n                .with_for_update() \\\n                .all()\n            for arg_8 in arg_7:\n                arg_8.set_state(arg_3, arg_4=arg_4)\n                arg_5 += 1\n        else:\n            arg_9 = arg_6.subquery()\n            arg_5 = arg_4 \\\n                .query(models.TaskInstance) \\\n                .filter(and_(\n                    models.TaskInstance.dag_id == arg_9.c.dag_id,\n                    models.TaskInstance.task_id == arg_9.c.task_id,\n                    models.TaskInstance.execution_date ==\n                    arg_9.c.execution_date)) \\\n                .update({models.TaskInstance.state: arg_3},\n                        synchronize_session=False)\n            arg_4.commit()\n\n        if arg_5 > 0:\n            arg_0.log.warning(\n                \"Set %s task instances to state=%s as their associated DagRun was not in RUNNING state\",\n                arg_5, arg_3\n            )", "path": "airflow/jobs.py", "identifier": "SchedulerJob._change_state_for_tis_without_dagrun", "docstring": "For all DAG IDs in the SimpleDagBag, look for task instances in the\n        old_states and set them to new_state if the corresponding DagRun\n        does not exist or exists but is not in the running state. This\n        normally should not happen, but it can if the state of DagRuns are\n        changed manually.\n\n        :param old_states: examine TaskInstances in this state\n        :type old_state: list[airflow.utils.state.State]\n        :param new_state: set TaskInstances to this state\n        :type new_state: airflow.utils.state.State\n        :param simple_dag_bag: TaskInstances associated with DAGs in the\n            simple_dag_bag and with states in the old_state will be examined\n        :type simple_dag_bag: airflow.utils.dag_processing.SimpleDagBag", "docstring_tokens": ["For", "all", "DAG", "IDs", "in", "the", "SimpleDagBag", "look", "for", "task", "instances", "in", "the", "old_states", "and", "set", "them", "to", "new_state", "if", "the", "corresponding", "DagRun", "does", "not", "exist", "or", "exists", "but", "is", "not", "in", "the", "running", "state", ".", "This", "normally", "should", "not", "happen", "but", "it", "can", "if", "the", "state", "of", "DagRuns", "are", "changed", "manually", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252011}
{"url": "https://github.com/nprapps/copydoc/blob/e1ab09b287beb0439748c319cf165cbc06c66624/copydoc.py#L110-L116", "sha": "e1ab09b287beb0439748c319cf165cbc06c66624", "docstring_summary": "See if span tag has italic style and wrap with em tag.", "language": "python", "parameters": "(self, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'style'", ")", "if", "arg_2", "and", "'font-style:italic'", "in", "arg_2", ":", "arg_1", ".", "wrap", "(", "arg_0", ".", "soup", ".", "new_tag", "(", "'em'", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        See if span tag has italic style and wrap with em tag.\n        \"\"\"\n        arg_2 = arg_1.get('style')\n        if arg_2 and 'font-style:italic' in arg_2:\n            arg_1.wrap(arg_0.soup.new_tag('em'))", "path": "copydoc.py", "identifier": "CopyDoc.create_italic", "docstring": "See if span tag has italic style and wrap with em tag.", "docstring_tokens": ["See", "if", "span", "tag", "has", "italic", "style", "and", "wrap", "with", "em", "tag", "."], "nwo": "nprapps/copydoc", "score": 0.16246995141409282, "idx": 252012}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/inkscape.py#L98-L102", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Transform SVG file to PNG file", "language": "python", "parameters": "(svg_file_path, png_file_path, dpi=150, inkscape_binpath=None)", "return_statement": "return inkscape_export(svg_file_path, png_file_path, export_flag=\"-e\",\n                           dpi=dpi, inkscape_binpath=inkscape_binpath)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "150", ",", "arg_3", "=", "None", ")", ":", "return", "inkscape_export", "(", "arg_0", ",", "arg_1", ",", "export_flag", "=", "\"-e\"", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=150, arg_3=None):\n    \"\"\" Transform SVG file to PNG file\n    \"\"\"\n    return inkscape_export(arg_0, arg_1, export_flag=\"-e\",\n                           arg_2=arg_2, arg_3=arg_3)", "path": "docstamp/inkscape.py", "identifier": "svg2png", "docstring": "Transform SVG file to PNG file", "docstring_tokens": ["Transform", "SVG", "file", "to", "PNG", "file"], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 252013}
{"url": "https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L143-L158", "sha": "cd5c6e10c6c4e653669e11d735d5773766986bda", "docstring_summary": "Call the API with a GET request.", "language": "python", "parameters": "(self, url, params=None, **kwargs)", "return_statement": "return self.call_api(\n            \"GET\",\n            url,\n            params=params,\n            **kwargs\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "call_api", "(", "\"GET\"", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\" Call the API with a GET request.\n\n        Args:\n            url (str): Resource location relative to the base URL.\n            params (dict or None): Query-string parameters.\n\n        Returns:\n            ResultParser or ErrorParser.\n        \"\"\"\n        return arg_0.call_api(\n            \"GET\",\n            arg_1,\n            arg_2=arg_2,\n            **arg_3\n        )", "path": "nerd/client.py", "identifier": "ApiClient.get", "docstring": "Call the API with a GET request.\n\n        Args:\n            url (str): Resource location relative to the base URL.\n            params (dict or None): Query-string parameters.\n\n        Returns:\n            ResultParser or ErrorParser.", "docstring_tokens": ["Call", "the", "API", "with", "a", "GET", "request", "."], "nwo": "hirmeos/entity-fishing-client-python", "score": 0.36576314591848075, "idx": 252014}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/utils/graph.py#L139-L173", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Implementation of the Context Likelihood or Relatedness Network algorithm.", "language": "python", "parameters": "(M, **kwargs)", "return_statement": "return R", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "np", ".", "zeros", "(", "arg_0", ".", "shape", ")", "arg_3", "=", "[", "[", "0", ",", "0", "]", "for", "arg_4", "in", "range", "(", "arg_0", ".", "shape", "[", "0", "]", ")", "]", "for", "arg_4", "in", "range", "(", "arg_0", ".", "shape", "[", "0", "]", ")", ":", "arg_5", "=", "np", ".", "mean", "(", "arg_0", "[", "arg_4", ",", ":", "]", ")", "arg_6", "=", "np", ".", "std", "(", "arg_0", "[", "arg_4", ",", ":", "]", ")", "arg_3", "[", "arg_4", "]", "=", "[", "arg_5", ",", "arg_6", "]", "for", "arg_4", "in", "range", "(", "arg_0", ".", "shape", "[", "0", "]", ")", ":", "for", "arg_7", "in", "range", "(", "arg_4", "+", "1", ",", "arg_0", ".", "shape", "[", "0", "]", ")", ":", "arg_8", "=", "np", ".", "max", "(", "[", "0", ",", "(", "arg_0", "[", "arg_4", ",", "arg_7", "]", "-", "arg_3", "[", "arg_4", "]", "[", "0", "]", ")", "/", "arg_3", "[", "arg_4", "]", "[", "0", "]", "]", ")", "arg_9", "=", "np", ".", "max", "(", "[", "0", ",", "(", "arg_0", "[", "arg_4", ",", "arg_7", "]", "-", "arg_3", "[", "arg_7", "]", "[", "0", "]", ")", "/", "arg_3", "[", "arg_7", "]", "[", "0", "]", "]", ")", "arg_2", "[", "arg_4", ",", "arg_7", "]", "=", "np", ".", "sqrt", "(", "arg_8", "**", "2", "+", "arg_9", "**", "2", ")", "arg_2", "[", "arg_7", ",", "arg_4", "]", "=", "arg_2", "[", "arg_4", ",", "arg_7", "]", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Implementation of the Context Likelihood or Relatedness Network algorithm.\n\n    Args:\n     mat (numpy.ndarray): matrix, if it is a square matrix, the program assumes\n         it is a relevance matrix where mat(i,j) represents the similarity content\n         between nodes i and j. Elements of matrix should be\n         non-negative.\n\n    Returns:\n    mat_nd (numpy.ndarray): Output deconvolved matrix (direct dependency matrix). Its components\n        represent direct edge weights of observed interactions.\n\n    .. note::\n       Ref:Jeremiah J. Faith, Boris Hayete, Joshua T. Thaden, Ilaria Mogno, Jamey\n       Wierzbowski, Guillaume Cottarel, Simon Kasif, James J. Collins, and Timothy\n       S. Gardner. Large-scale mapping and validation of escherichia coli\n       transcriptional regulation from a compendium of expression profiles.\n       PLoS Biology, 2007\n    \"\"\"\n    arg_2 = np.zeros(arg_0.shape)\n    arg_3 = [[0, 0] for arg_4 in range(arg_0.shape[0])]\n    for arg_4 in range(arg_0.shape[0]):\n        arg_5 = np.mean(arg_0[arg_4, :])\n        arg_6 = np.std(arg_0[arg_4, :])\n        arg_3[arg_4] = [arg_5, arg_6]\n\n    for arg_4 in range(arg_0.shape[0]):\n        for arg_7 in range(arg_4 + 1, arg_0.shape[0]):\n            arg_8 = np.max([0, (arg_0[arg_4, arg_7] - arg_3[arg_4][0]) / arg_3[arg_4][0]])\n            arg_9 = np.max([0, (arg_0[arg_4, arg_7] - arg_3[arg_7][0]) / arg_3[arg_7][0]])\n            arg_2[arg_4, arg_7] = np.sqrt(arg_8**2 + arg_9**2)\n            arg_2[arg_7, arg_4] = arg_2[arg_4, arg_7]  # Symmetric\n\n    return arg_2", "path": "cdt/utils/graph.py", "identifier": "clr", "docstring": "Implementation of the Context Likelihood or Relatedness Network algorithm.\n\n    Args:\n     mat (numpy.ndarray): matrix, if it is a square matrix, the program assumes\n         it is a relevance matrix where mat(i,j) represents the similarity content\n         between nodes i and j. Elements of matrix should be\n         non-negative.\n\n    Returns:\n    mat_nd (numpy.ndarray): Output deconvolved matrix (direct dependency matrix). Its components\n        represent direct edge weights of observed interactions.\n\n    .. note::\n       Ref:Jeremiah J. Faith, Boris Hayete, Joshua T. Thaden, Ilaria Mogno, Jamey\n       Wierzbowski, Guillaume Cottarel, Simon Kasif, James J. Collins, and Timothy\n       S. Gardner. Large-scale mapping and validation of escherichia coli\n       transcriptional regulation from a compendium of expression profiles.\n       PLoS Biology, 2007", "docstring_tokens": ["Implementation", "of", "the", "Context", "Likelihood", "or", "Relatedness", "Network", "algorithm", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 252015}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L383-L399", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets the review comment. Raises CardinalityError if\n        already set. OrderError if no reviewer defined before.\n        Raises SPDXValueError if comment is not free form text.", "language": "python", "parameters": "(self, doc, comment)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_1", ".", "reviews", ")", "!=", "0", ":", "if", "not", "arg_0", ".", "review_comment_set", ":", "arg_0", ".", "review_comment_set", "=", "True", "if", "validations", ".", "validate_review_comment", "(", "arg_2", ")", ":", "arg_1", ".", "reviews", "[", "-", "1", "]", ".", "comment", "=", "str_from_text", "(", "arg_2", ")", "return", "True", "else", ":", "raise", "SPDXValueError", "(", "'ReviewComment::Comment'", ")", "else", ":", "raise", "CardinalityError", "(", "'ReviewComment'", ")", "else", ":", "raise", "OrderError", "(", "'ReviewComment'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets the review comment. Raises CardinalityError if\n        already set. OrderError if no reviewer defined before.\n        Raises SPDXValueError if comment is not free form text.\n        \"\"\"\n        if len(arg_1.reviews) != 0:\n            if not arg_0.review_comment_set:\n                arg_0.review_comment_set = True\n                if validations.validate_review_comment(arg_2):\n                    arg_1.reviews[-1].comment = str_from_text(arg_2)\n                    return True\n                else:\n                    raise SPDXValueError('ReviewComment::Comment')\n            else:\n                raise CardinalityError('ReviewComment')\n        else:\n            raise OrderError('ReviewComment')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "ReviewBuilder.add_review_comment", "docstring": "Sets the review comment. Raises CardinalityError if\n        already set. OrderError if no reviewer defined before.\n        Raises SPDXValueError if comment is not free form text.", "docstring_tokens": ["Sets", "the", "review", "comment", ".", "Raises", "CardinalityError", "if", "already", "set", ".", "OrderError", "if", "no", "reviewer", "defined", "before", ".", "Raises", "SPDXValueError", "if", "comment", "is", "not", "free", "form", "text", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 252016}
{"url": "https://github.com/ibm-watson-iot/iot-python/blob/195f05adce3fba4ec997017e41e02ebd85c0c4cc/src/wiotp/sdk/api/mgmt/requests.py#L87-L107", "sha": "195f05adce3fba4ec997017e41e02ebd85c0c4cc", "docstring_summary": "Get a list of device management request device statuses.\n        Get an individual device mangaement request device status.", "language": "python", "parameters": "(self, requestId, typeId=None, deviceId=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "None", "or", "arg_3", "is", "None", ":", "arg_4", "=", "MgmtRequests", ".", "mgmtRequestStatus", "%", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "_apiClient", ".", "get", "(", "arg_4", ")", "if", "arg_5", ".", "status_code", "==", "200", ":", "return", "arg_5", ".", "json", "(", ")", "else", ":", "raise", "ApiException", "(", "arg_5", ")", "else", ":", "arg_4", "=", "MgmtRequests", ".", "mgmtRequestSingleDeviceStatus", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "_apiClient", ".", "get", "(", "arg_4", ")", "if", "arg_5", ".", "status_code", "==", "200", ":", "return", "arg_5", ".", "json", "(", ")", "else", ":", "raise", "ApiException", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n        Get a list of device management request device statuses.\n        Get an individual device mangaement request device status.\n        \"\"\"\n        if arg_2 is None or arg_3 is None:\n            arg_4 = MgmtRequests.mgmtRequestStatus % (arg_1)\n            arg_5 = arg_0._apiClient.get(arg_4)\n\n            if arg_5.status_code == 200:\n                return arg_5.json()\n            else:\n                raise ApiException(arg_5)\n        else:\n            arg_4 = MgmtRequests.mgmtRequestSingleDeviceStatus % (arg_1, arg_2, arg_3)\n            arg_5 = arg_0._apiClient.get(arg_4)\n\n            if arg_5.status_code == 200:\n                return arg_5.json()\n            else:\n                raise ApiException(arg_5)", "path": "src/wiotp/sdk/api/mgmt/requests.py", "identifier": "MgmtRequests.getStatus", "docstring": "Get a list of device management request device statuses.\n        Get an individual device mangaement request device status.", "docstring_tokens": ["Get", "a", "list", "of", "device", "management", "request", "device", "statuses", ".", "Get", "an", "individual", "device", "mangaement", "request", "device", "status", "."], "nwo": "ibm-watson-iot/iot-python", "score": 0.6135771375083736, "idx": 252017}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L244-L257", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Returns a data frame with Sample data and state.", "language": "python", "parameters": "(self)", "return_statement": "return statdat", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "samples", ".", "keys", "(", ")", "arg_1", ".", "sort", "(", ")", "arg_2", ".", "options", ".", "display", ".", "max_rows", "=", "len", "(", "arg_0", ".", "samples", ")", "arg_6", "=", "arg_2", ".", "DataFrame", "(", "[", "arg_0", ".", "samples", "[", "i", "]", ".", "Func", "for", "i", "in", "arg_1", "]", ",", "index", "=", "arg_1", ")", ".", "dropna", "(", "axis", "=", "1", ",", "how", "=", "'all'", ")", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", "not", "in", "[", "\"hetero_est\"", ",", "\"error_est\"", "]", ":", "arg_6", "[", "arg_7", "]", "=", "np", ".", "nan_to_num", "(", "arg_6", "[", "arg_7", "]", ")", ".", "astype", "(", "int", ")", "return", "arg_6"], "function": "def Func(arg_0):\n        \"\"\" Returns a data frame with Sample data and state. \"\"\"\n        arg_1 = arg_0.samples.keys()\n        arg_1.sort()\n\n        ## Set pandas to display all samples instead of truncating\n        arg_2.options.display.max_rows = len(arg_0.samples)\n        arg_6 = arg_2.DataFrame([arg_0.samples[i].Func for i in arg_1],\n                      index=arg_1).dropna(axis=1, how='all')\n        # ensure non h,e columns print as ints\n        for arg_7 in arg_6:\n            if arg_7 not in [\"hetero_est\", \"error_est\"]:\n                arg_6[arg_7] = np.nan_to_num(arg_6[arg_7]).astype(int)\n        return arg_6", "path": "ipyrad/core/assembly.py", "identifier": "Assembly.stats", "docstring": "Returns a data frame with Sample data and state.", "docstring_tokens": ["Returns", "a", "data", "frame", "with", "Sample", "data", "and", "state", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 252018}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L235-L247", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return an iterator on stripped lines, starting from a given index\n        if specified, else 0", "language": "python", "parameters": "(self, start_at=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "arg_1", "if", "arg_1", ":", "arg_3", "=", "arg_0", ".", "_stripped_lines", "[", "arg_1", ":", "]", "else", ":", "arg_3", "=", "arg_0", ".", "_stripped_lines", "for", "arg_4", "in", "arg_3", ":", "yield", "arg_2", ",", "arg_4", "arg_2", "+=", "1"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"return an iterator on stripped lines, starting from a given index\n        if specified, else 0\n        \"\"\"\n        arg_2 = arg_1\n        if arg_1:\n            arg_3 = arg_0._stripped_lines[arg_1:]\n        else:\n            arg_3 = arg_0._stripped_lines\n        for arg_4 in arg_3:\n            # if line:\n            yield arg_2, arg_4\n            arg_2 += 1", "path": "pylint/checkers/similar.py", "identifier": "LineSet.enumerate_stripped", "docstring": "return an iterator on stripped lines, starting from a given index\n        if specified, else 0", "docstring_tokens": ["return", "an", "iterator", "on", "stripped", "lines", "starting", "from", "a", "given", "index", "if", "specified", "else", "0"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252019}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L221-L235", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "A replacement for signal.signal which chains the signal behind\n        the debugger's handler", "language": "python", "parameters": "(self, signum, handle)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "lookup_signame", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "arg_0", ".", "dbgr", ".", "intf", "[", "-", "1", "]", ".", "errmsg", "(", "(", "\"%s is not a signal number\"", "\" I know about.\"", ")", "%", "arg_1", ")", "return", "False", "arg_0", ".", "sigs", "[", "arg_3", "]", ".", "pass_along", "=", "True", "if", "arg_0", ".", "check_and_adjust_sighandler", "(", "arg_3", ",", "arg_0", ".", "sigs", ")", ":", "arg_0", ".", "sigs", "[", "arg_3", "]", ".", "old_handler", "=", "arg_2", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"A replacement for signal.signal which chains the signal behind\n        the debugger's handler\"\"\"\n        arg_3 = lookup_signame(arg_1)\n        if arg_3 is None:\n            arg_0.dbgr.intf[-1].errmsg((\"%s is not a signal number\"\n                                       \" I know about.\")  % arg_1)\n            return False\n        # Since the intent is to set a handler, we should pass this\n        # signal on to the handler\n        arg_0.sigs[arg_3].pass_along = True\n        if arg_0.check_and_adjust_sighandler(arg_3, arg_0.sigs):\n            arg_0.sigs[arg_3].old_handler = arg_2\n            return True\n        return False", "path": "trepan/lib/sighandler.py", "identifier": "SignalManager.set_signal_replacement", "docstring": "A replacement for signal.signal which chains the signal behind\n        the debugger's handler", "docstring_tokens": ["A", "replacement", "for", "signal", ".", "signal", "which", "chains", "the", "signal", "behind", "the", "debugger", "s", "handler"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 252020}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L620-L625", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Set parameter error estimate", "language": "python", "parameters": "(self, errors)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "__errors__", "=", "None", "return", "arg_0", ".", "__errors__", "=", "[", "asscalar", "(", "e", ")", "for", "e", "in", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set parameter error estimate \"\"\"\n        if arg_1 is None:\n            arg_0.__errors__ = None\n            return\n        arg_0.__errors__ = [asscalar(e) for e in arg_1]", "path": "pymodeler/parameter.py", "identifier": "Parameter.set_errors", "docstring": "Set parameter error estimate", "docstring_tokens": ["Set", "parameter", "error", "estimate"], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 252021}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/clustering.py#L143-L148", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "The centers for the KMeans model.", "language": "python", "parameters": "(self)", "return_statement": "return centers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_model_json", "[", "\"output\"", "]", "arg_2", "=", "arg_1", "[", "\"centers\"", "]", ".", "cell_values", "Func", "=", "[", "list", "(", "cval", "[", "1", ":", "]", ")", "for", "cval", "in", "arg_2", "]", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"The centers for the KMeans model.\"\"\"\n        arg_1 = arg_0._model_json[\"output\"]\n        arg_2 = arg_1[\"centers\"].cell_values\n        Func = [list(cval[1:]) for cval in arg_2]\n        return Func", "path": "h2o-py/h2o/model/clustering.py", "identifier": "H2OClusteringModel.centers", "docstring": "The centers for the KMeans model.", "docstring_tokens": ["The", "centers", "for", "the", "KMeans", "model", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252022}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/graph.py#L230-L261", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Add pop-up information to a point on the graph.", "language": "python", "parameters": "(self, x, y, label)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "len", "(", "arg_3", ")", "*", "arg_0", ".", "font_size", "*", "0.6", "+", "10", "arg_5", "=", "arg_1", "+", "[", "5", ",", "-", "5", "]", "[", "int", "(", "arg_1", "+", "arg_4", ">", "arg_0", ".", "width", ")", "]", "arg_6", "=", "[", "'start'", ",", "'end'", "]", "[", "arg_1", "+", "arg_4", ">", "arg_0", ".", "width", "]", "arg_7", "=", "'fill: #000; text-anchor: %s;'", "%", "arg_6", "arg_8", "=", "'label-%s'", "%", "arg_0", ".", "_w3c_name", "(", "arg_3", ")", "arg_9", "=", "{", "'x'", ":", "str", "(", "arg_5", ")", ",", "'y'", ":", "str", "(", "arg_2", "-", "arg_0", ".", "font_size", ")", ",", "'visibility'", ":", "'hidden'", ",", "'style'", ":", "arg_7", ",", "'text'", ":", "arg_3", ",", "'id'", ":", "arg_8", ",", "}", "etree", ".", "SubElement", "(", "arg_0", ".", "foreground", ",", "'text'", ",", "arg_9", ")", "arg_10", "=", "(", "\"document.getElementById('{id}').setAttribute('visibility', {val})\"", ")", "arg_9", "=", "{", "'cx'", ":", "str", "(", "arg_1", ")", ",", "'cy'", ":", "str", "(", "arg_2", ")", ",", "'r'", ":", "str", "(", "10", ")", ",", "'style'", ":", "'opacity: 0;'", ",", "'onmouseover'", ":", "arg_10", ".", "format", "(", "val", "=", "'visible'", ",", "arg_8", "=", "arg_8", ")", ",", "'onmouseout'", ":", "arg_10", ".", "format", "(", "val", "=", "'hidden'", ",", "arg_8", "=", "arg_8", ")", ",", "}", "etree", ".", "SubElement", "(", "arg_0", ".", "foreground", ",", "'circle'", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n\t\t\"\"\"\n\t\tAdd pop-up information to a point on the graph.\n\t\t\"\"\"\n\t\targ_4 = len(arg_3) * arg_0.font_size * 0.6 + 10\n\t\targ_5 = arg_1 + [5, -5][int(arg_1 + arg_4 > arg_0.width)]\n\t\targ_6 = ['start', 'end'][arg_1 + arg_4 > arg_0.width]\n\t\targ_7 = 'fill: #000; text-anchor: %s;' % arg_6\n\t\targ_8 = 'label-%s' % arg_0._w3c_name(arg_3)\n\t\targ_9 = {\n\t\t\t'x': str(arg_5),\n\t\t\t'y': str(arg_2 - arg_0.font_size),\n\t\t\t'visibility': 'hidden',\n\t\t\t'style': arg_7,\n\t\t\t'text': arg_3,\n\t\t\t'id': arg_8,\n\t\t}\n\t\tetree.SubElement(arg_0.foreground, 'text', arg_9)\n\n\t\t# add the circle element to the foreground\n\t\targ_10 = (\n\t\t\t\"document.getElementById('{id}').setAttribute('visibility', {val})\"\n\t\t)\n\t\targ_9 = {\n\t\t\t'cx': str(arg_1),\n\t\t\t'cy': str(arg_2),\n\t\t\t'r': str(10),\n\t\t\t'style': 'opacity: 0;',\n\t\t\t'onmouseover': arg_10.format(val='visible', arg_8=arg_8),\n\t\t\t'onmouseout': arg_10.format(val='hidden', arg_8=arg_8),\n\t\t}\n\t\tetree.SubElement(arg_0.foreground, 'circle', arg_9)", "path": "svg/charts/graph.py", "identifier": "Graph.add_popup", "docstring": "Add pop-up information to a point on the graph.", "docstring_tokens": ["Add", "pop", "-", "up", "information", "to", "a", "point", "on", "the", "graph", "."], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 252023}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/paved.py#L56-L67", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "print paver options.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "json", ".", "dumps", "(", "environment", ".", "options", ",", "indent", "=", "4", ",", "sort_keys", "=", "True", ",", "skipkeys", "=", "True", ",", "cls", "=", "MyEncoder", ")", "print", "(", "arg_0", ")"], "function": "def Func():\n    '''print paver options.\n\n    Prettified by json.\n    `long_description` is removed\n    '''\n    arg_0 = json.dumps(environment.options,\n                   indent=4,\n                   sort_keys=True,\n                   skipkeys=True,\n                   cls=MyEncoder)\n    print(arg_0)", "path": "paved/paved.py", "identifier": "printoptions", "docstring": "print paver options.\n\n    Prettified by json.\n    `long_description` is removed", "docstring_tokens": ["print", "paver", "options", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 252024}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L563-L574", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Increases or decreases the brightness in the layer.\n    \n        The given value is a percentage to increase\n        or decrease the image brightness,\n        for example 0.8 means brightness at 80%.", "language": "python", "parameters": "(self, value=1.0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1.0", ")", ":", "arg_2", "=", "ImageEnhance", ".", "Brightness", "(", "arg_0", ".", "img", ")", "arg_0", ".", "img", "=", "arg_2", ".", "enhance", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=1.0):\n\n        \"\"\"Increases or decreases the Func in the layer.\n    \n        The given value is a percentage to increase\n        or decrease the image Func,\n        for example 0.8 means Func at 80%.\n    \n        \"\"\"\n     \n        arg_2 = ImageEnhance.Brightness(arg_0.img) \n        arg_0.img = arg_2.enhance(arg_1)", "path": "lib/photobot/__init__.py", "identifier": "Layer.brightness", "docstring": "Increases or decreases the brightness in the layer.\n    \n        The given value is a percentage to increase\n        or decrease the image brightness,\n        for example 0.8 means brightness at 80%.", "docstring_tokens": ["Increases", "or", "decreases", "the", "brightness", "in", "the", "layer", ".", "The", "given", "value", "is", "a", "percentage", "to", "increase", "or", "decrease", "the", "image", "brightness", "for", "example", "0", ".", "8", "means", "brightness", "at", "80%", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252025}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L60-L63", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns the scaled x positions of the points as doubles", "language": "python", "parameters": "(self)", "return_statement": "return scale_dimension(self.X, self.header.x_scale, self.header.x_offset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "scale_dimension", "(", "arg_0", ".", "X", ",", "arg_0", ".", "header", ".", "Func_scale", ",", "arg_0", ".", "header", ".", "Func_offset", ")"], "function": "def Func(arg_0):\n        \"\"\" Returns the scaled Func positions of the points as doubles\n        \"\"\"\n        return scale_dimension(arg_0.X, arg_0.header.Func_scale, arg_0.header.Func_offset)", "path": "pylas/lasdatas/base.py", "identifier": "LasBase.x", "docstring": "Returns the scaled x positions of the points as doubles", "docstring_tokens": ["Returns", "the", "scaled", "x", "positions", "of", "the", "points", "as", "doubles"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 252026}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/update/genes.py#L42-L106", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Load the hgnc aliases to the mongo database.", "language": "python", "parameters": "(context, build, api_key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "LOG", ".", "info", "(", "\"Running scout update Func\"", ")", "arg_3", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_2", "=", "arg_2", "or", "arg_0", ".", "obj", ".", "get", "(", "'omim_api_key'", ")", "if", "not", "arg_2", ":", "LOG", ".", "warning", "(", "\"Please provide a omim api key to load the omim gene panel\"", ")", "arg_0", ".", "abort", "(", ")", "try", ":", "arg_4", "=", "fetch_mim_files", "(", "arg_2", ",", "mim2Func", "=", "True", ",", "morbidmap", "=", "True", ",", "genemap2", "=", "True", ")", "except", "Exception", "as", "err", ":", "LOG", ".", "warning", "(", "err", ")", "arg_0", ".", "abort", "(", ")", "LOG", ".", "warning", "(", "\"Dropping all gene information\"", ")", "arg_3", ".", "drop_Func", "(", "arg_1", ")", "LOG", ".", "info", "(", "\"Genes dropped\"", ")", "LOG", ".", "warning", "(", "\"Dropping all transcript information\"", ")", "arg_3", ".", "drop_transcripts", "(", "arg_1", ")", "LOG", ".", "info", "(", "\"transcripts dropped\"", ")", "arg_5", "=", "fetch_hpo_Func", "(", ")", "if", "arg_1", ":", "arg_6", "=", "[", "arg_1", "]", "else", ":", "arg_6", "=", "[", "'37'", ",", "'38'", "]", "arg_7", "=", "fetch_hgnc", "(", ")", "arg_8", "=", "fetch_exac_constraint", "(", ")", "for", "arg_1", "in", "arg_6", ":", "arg_9", "=", "fetch_ensembl_Func", "(", "arg_1", "=", "arg_1", ")", "arg_10", "=", "load_hgnc_Func", "(", "arg_3", "=", "arg_3", ",", "ensembl_lines", "=", "arg_9", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "mim2gene_lines", "=", "arg_4", "[", "'mim2Func'", "]", ",", "genemap_lines", "=", "arg_4", "[", "'genemap2'", "]", ",", "hpo_lines", "=", "arg_5", ",", "arg_1", "=", "arg_1", ",", ")", "arg_9", "=", "{", "}", "for", "arg_11", "in", "arg_10", ":", "arg_12", "=", "arg_11", "[", "'ensembl_id'", "]", "arg_9", "[", "arg_12", "]", "=", "arg_11", "arg_13", "=", "fetch_ensembl_transcripts", "(", "arg_1", "=", "arg_1", ")", "arg_14", "=", "load_transcripts", "(", "arg_3", ",", "arg_13", ",", "arg_1", ",", "arg_9", ")", "arg_3", ".", "update_indexes", "(", ")", "LOG", ".", "info", "(", "\"Genes, transcripts and Exons loaded\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Load the hgnc aliases to the mongo database.\n    \"\"\"\n    LOG.info(\"Running scout update Func\")\n    arg_3 = arg_0.obj['adapter']\n\n    # Fetch the omim information\n    arg_2 = arg_2 or arg_0.obj.get('omim_api_key')\n    if not arg_2:\n        LOG.warning(\"Please provide a omim api key to load the omim gene panel\")\n        arg_0.abort()\n\n    try:\n        arg_4 = fetch_mim_files(arg_2, mim2Func=True, morbidmap=True, genemap2=True)\n    except Exception as err:\n        LOG.warning(err)\n        arg_0.abort()\n\n    LOG.warning(\"Dropping all gene information\")\n    arg_3.drop_Func(arg_1)\n    LOG.info(\"Genes dropped\")\n    LOG.warning(\"Dropping all transcript information\")\n    arg_3.drop_transcripts(arg_1)\n    LOG.info(\"transcripts dropped\")\n\n    arg_5 = fetch_hpo_Func()\n    \n    if arg_1:\n        arg_6 = [arg_1]\n    else:\n        arg_6 = ['37', '38']\n    \n    arg_7 = fetch_hgnc()\n    arg_8 = fetch_exac_constraint()\n    \n    \n    for arg_1 in arg_6:\n        arg_9 = fetch_ensembl_Func(arg_1=arg_1)\n        \n        # load the Func\n        arg_10 = load_hgnc_Func(\n            arg_3=arg_3,\n            ensembl_lines=arg_9,\n            arg_7=arg_7,\n            arg_8=arg_8,\n            mim2gene_lines=arg_4['mim2Func'],\n            genemap_lines=arg_4['genemap2'],\n            hpo_lines=arg_5,\n            arg_1=arg_1,\n        )\n\n        arg_9 = {}\n        for arg_11 in arg_10:\n            arg_12 = arg_11['ensembl_id']\n            arg_9[arg_12] = arg_11\n\n        # Fetch the transcripts from ensembl\n        arg_13 = fetch_ensembl_transcripts(arg_1=arg_1)\n        \n        arg_14 = load_transcripts(arg_3, arg_13, arg_1, arg_9)\n\n    arg_3.update_indexes()\n        \n    LOG.info(\"Genes, transcripts and Exons loaded\")", "path": "scout/commands/update/genes.py", "identifier": "genes", "docstring": "Load the hgnc aliases to the mongo database.", "docstring_tokens": ["Load", "the", "hgnc", "aliases", "to", "the", "mongo", "database", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252027}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/logging.py#L31-L54", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "Hivy formated logger", "language": "python", "parameters": "(level='debug', output=None)", "return_statement": "return logbook.NestedSetup(handlers)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'debug'", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "settings", ".", "LOG", "[", "'file'", "]", "arg_0", "=", "arg_0", ".", "upper", "(", ")", "arg_2", "=", "[", "logbook", ".", "NullHandler", "(", ")", "]", "if", "arg_1", "==", "'stdout'", ":", "arg_2", ".", "append", "(", "logbook", ".", "StreamHandler", "(", "sys", ".", "stdout", ",", "format_string", "=", "settings", ".", "LOG", "[", "'format'", "]", ",", "arg_0", "=", "arg_0", ")", ")", "else", ":", "arg_2", ".", "append", "(", "logbook", ".", "FileHandler", "(", "arg_1", ",", "format_string", "=", "settings", ".", "LOG", "[", "'format'", "]", ",", "arg_0", "=", "arg_0", ")", ")", "arg_3", "=", "settings", ".", "LOG", "[", "'sentry_dns'", "]", "if", "arg_3", ":", "arg_2", ".", "append", "(", "SentryHandler", "(", "arg_3", ",", "arg_0", "=", "'ERROR'", ")", ")", "return", "logbook", ".", "NestedSetup", "(", "arg_2", ")"], "function": "def Func(arg_0='debug', arg_1=None):\n    ''' Hivy formated logger '''\n    arg_1 = arg_1 or settings.LOG['file']\n\n    arg_0 = arg_0.upper()\n    arg_2 = [\n        logbook.NullHandler()\n    ]\n    if arg_1 == 'stdout':\n        arg_2.append(\n            logbook.StreamHandler(sys.stdout,\n                                  format_string=settings.LOG['format'],\n                                  arg_0=arg_0))\n    else:\n        arg_2.append(\n            logbook.FileHandler(arg_1,\n                                format_string=settings.LOG['format'],\n                                arg_0=arg_0))\n\n    arg_3 = settings.LOG['sentry_dns']\n    if arg_3:\n        arg_2.append(SentryHandler(arg_3, arg_0='ERROR'))\n\n    return logbook.NestedSetup(arg_2)", "path": "python/dna/logging.py", "identifier": "setup", "docstring": "Hivy formated logger", "docstring_tokens": ["Hivy", "formated", "logger"], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 252028}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/discord_webhook_hook.py#L126-L140", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Execute the Discord webhook call", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "if", "arg_0", ".", "proxy", ":", "arg_1", "=", "{", "'https'", ":", "arg_0", ".", "proxy", "}", "arg_2", "=", "arg_0", ".", "_build_discord_payload", "(", ")", "arg_0", ".", "run", "(", "endpoint", "=", "arg_0", ".", "webhook_endpoint", ",", "data", "=", "arg_2", ",", "headers", "=", "{", "'Content-type'", ":", "'application/json'", "}", ",", "extra_options", "=", "{", "'proxies'", ":", "arg_1", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Execute the Discord webhook call\n        \"\"\"\n        arg_1 = {}\n        if arg_0.proxy:\n            # we only need https proxy for Discord\n            arg_1 = {'https': arg_0.proxy}\n\n        arg_2 = arg_0._build_discord_payload()\n\n        arg_0.run(endpoint=arg_0.webhook_endpoint,\n                 data=arg_2,\n                 headers={'Content-type': 'application/json'},\n                 extra_options={'proxies': arg_1})", "path": "airflow/contrib/hooks/discord_webhook_hook.py", "identifier": "DiscordWebhookHook.execute", "docstring": "Execute the Discord webhook call", "docstring_tokens": ["Execute", "the", "Discord", "webhook", "call"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252029}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/TaskParser.py#L58-L129", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Parse this node, and all children, returning the connected task spec.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "task", "=", "arg_0", ".", "create_task", "(", ")", "arg_0", ".", "task", ".", "documentation", "=", "arg_0", ".", "parser", ".", "_parse_documentation", "(", "arg_0", ".", "node", ",", "xpath", "=", "arg_0", ".", "xpath", ",", "task_parser", "=", "arg_0", ")", "arg_3", "=", "arg_0", ".", "process_xpath", "(", "'.//bpmn:boundaryEvent[@attachedToRef=\"%s\"]'", "%", "arg_0", ".", "get_id", "(", ")", ")", "if", "arg_3", ":", "arg_4", "=", "_BoundaryEventParent", "(", "arg_0", ".", "spec", ",", "'%s.BoundaryEventParent'", "%", "arg_0", ".", "get_id", "(", ")", ",", "arg_0", ".", "task", ",", "lane", "=", "arg_0", ".", "task", ".", "lane", ")", "arg_0", ".", "process_parser", ".", "parsed_nodes", "[", "arg_0", ".", "node", ".", "get", "(", "'id'", ")", "]", "=", "arg_4", "arg_4", ".", "connect_outgoing", "(", "arg_0", ".", "task", ",", "'%s.FromBoundaryEventParent'", "%", "arg_0", ".", "get_id", "(", ")", ",", "None", ",", "None", ")", "for", "arg_9", "in", "arg_3", ":", "arg_10", "=", "arg_0", ".", "process_parser", ".", "Func", "(", "arg_9", ")", "arg_4", ".", "connect_outgoing", "(", "arg_10", ",", "'%s.FromBoundaryEventParent'", "%", "arg_9", ".", "get", "(", "'id'", ")", ",", "None", ",", "None", ")", "else", ":", "arg_0", ".", "process_parser", ".", "parsed_nodes", "[", "arg_0", ".", "node", ".", "get", "(", "'id'", ")", "]", "=", "arg_0", ".", "task", "arg_11", "=", "[", "]", "arg_12", "=", "arg_0", ".", "process_xpath", "(", "'.//bpmn:sequenceFlow[@sourceRef=\"%s\"]'", "%", "arg_0", ".", "get_id", "(", ")", ")", "if", "len", "(", "arg_12", ")", ">", "1", "and", "not", "arg_0", ".", "handles_multiple_outgoing", "(", ")", ":", "raise", "ValidationException", "(", "'Multiple outgoing flows are not supported for '", "'tasks of type'", ",", "arg_7", "=", "arg_0", ".", "node", ",", "filename", "=", "arg_0", ".", "process_parser", ".", "filename", ")", "for", "arg_13", "in", "arg_12", ":", "arg_14", "=", "arg_13", ".", "get", "(", "'targetRef'", ")", "arg_15", "=", "one", "(", "arg_0", ".", "process_xpath", "(", "'.//*[@id=\"%s\"]'", "%", "arg_14", ")", ")", "arg_16", "=", "arg_0", ".", "process_parser", ".", "Func", "(", "arg_15", ")", "arg_11", ".", "append", "(", "(", "arg_16", ",", "arg_15", ",", "arg_13", ")", ")", "if", "arg_11", ":", "arg_17", "=", "arg_0", ".", "node", ".", "get", "(", "'default'", ")", "if", "not", "arg_17", ":", "(", "arg_16", ",", "arg_15", ",", "arg_13", ")", "=", "arg_11", "[", "0", "]", "arg_17", "=", "arg_13", ".", "get", "(", "'id'", ")", "for", "(", "arg_16", ",", "arg_15", ",", "arg_13", ")", "in", "arg_11", ":", "arg_0", ".", "connect_outgoing", "(", "arg_16", ",", "arg_15", ",", "arg_13", ",", "arg_13", ".", "get", "(", "'id'", ")", "==", "arg_17", ")", "return", "arg_4", "if", "arg_3", "else", "arg_0", ".", "task", "except", "ValidationException", ":", "raise", "except", "Exception", "as", "ex", ":", "arg_18", "=", "sys", ".", "exc_info", "(", ")", "arg_19", "=", "\"\"", ".", "join", "(", "traceback", ".", "format_exception", "(", "arg_18", "[", "0", "]", ",", "arg_18", "[", "1", "]", ",", "arg_18", "[", "2", "]", ")", ")", "LOG", ".", "error", "(", "\"%r\\n%s\"", ",", "ex", ",", "arg_19", ")", "raise", "ValidationException", "(", "\"%r\"", "%", "(", "ex", ")", ",", "arg_7", "=", "arg_0", ".", "node", ",", "filename", "=", "arg_0", ".", "process_parser", ".", "filename", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Parse this node, and all children, returning the connected task spec.\n        \"\"\"\n\n        try:\n            arg_0.task = arg_0.create_task()\n\n            arg_0.task.documentation = arg_0.parser._parse_documentation(\n                arg_0.node, xpath=arg_0.xpath, task_parser=arg_0)\n\n            arg_3 = arg_0.process_xpath(\n                './/bpmn:boundaryEvent[@attachedToRef=\"%s\"]' % arg_0.get_id())\n            if arg_3:\n                arg_4 = _BoundaryEventParent(\n                    arg_0.spec, '%s.BoundaryEventParent' % arg_0.get_id(),\n                    arg_0.task, lane=arg_0.task.lane)\n                arg_0.process_parser.parsed_nodes[\n                    arg_0.node.get('id')] = arg_4\n\n                arg_4.connect_outgoing(\n                    arg_0.task, '%s.FromBoundaryEventParent' % arg_0.get_id(),\n                    None, None)\n                for arg_9 in arg_3:\n                    arg_10 = arg_0.process_parser.Func(arg_9)\n                    arg_4.connect_outgoing(\n                        arg_10,\n                        '%s.FromBoundaryEventParent' % arg_9.get(\n                            'id'),\n                        None, None)\n            else:\n                arg_0.process_parser.parsed_nodes[\n                    arg_0.node.get('id')] = arg_0.task\n\n            arg_11 = []\n            arg_12 = arg_0.process_xpath(\n                './/bpmn:sequenceFlow[@sourceRef=\"%s\"]' % arg_0.get_id())\n            if len(arg_12) > 1 and not arg_0.handles_multiple_outgoing():\n                raise ValidationException(\n                    'Multiple outgoing flows are not supported for '\n                    'tasks of type',\n                    arg_7=arg_0.node,\n                    filename=arg_0.process_parser.filename)\n            for arg_13 in arg_12:\n                arg_14 = arg_13.get('targetRef')\n                arg_15 = one(\n                    arg_0.process_xpath('.//*[@id=\"%s\"]' % arg_14))\n                arg_16 = arg_0.process_parser.Func(arg_15)\n                arg_11.append((arg_16, arg_15, arg_13))\n\n            if arg_11:\n                arg_17 = arg_0.node.get('default')\n                if not arg_17:\n                    (arg_16, arg_15, arg_13) = arg_11[0]\n                    arg_17 = arg_13.get('id')\n\n                for (arg_16, arg_15, arg_13) in arg_11:\n                    arg_0.connect_outgoing(\n                        arg_16, arg_15, arg_13,\n                        arg_13.get('id') == arg_17)\n\n            return arg_4 if arg_3 else arg_0.task\n        except ValidationException:\n            raise\n        except Exception as ex:\n            arg_18 = sys.exc_info()\n            arg_19 = \"\".join(traceback.format_exception(\n                arg_18[0], arg_18[1], arg_18[2]))\n            LOG.error(\"%r\\n%s\", ex, arg_19)\n            raise ValidationException(\n                \"%r\" % (ex), arg_7=arg_0.node,\n                filename=arg_0.process_parser.filename)", "path": "SpiffWorkflow/bpmn/parser/TaskParser.py", "identifier": "TaskParser.parse_node", "docstring": "Parse this node, and all children, returning the connected task spec.", "docstring_tokens": ["Parse", "this", "node", "and", "all", "children", "returning", "the", "connected", "task", "spec", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 252030}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2552-L2567", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Verifies a signature on a certificate request.", "language": "python", "parameters": "(self, key)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_lib", ".", "NETSCAPE_SPKI_Func", "(", "arg_0", ".", "_spki", ",", "arg_1", ".", "_pkey", ")", "if", "arg_2", "<=", "0", ":", "_raise_current_error", "(", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Verifies a signature on a certificate request.\n\n        :param PKey key: The public key that signature is supposedly from.\n\n        :return: ``True`` if the signature is correct.\n        :rtype: bool\n\n        :raises OpenSSL.crypto.Error: If the signature is invalid, or there was\n            a problem Funcing the signature.\n        \"\"\"\n        arg_2 = _lib.NETSCAPE_SPKI_Func(arg_0._spki, arg_1._pkey)\n        if arg_2 <= 0:\n            _raise_current_error()\n        return True", "path": "src/OpenSSL/crypto.py", "identifier": "NetscapeSPKI.verify", "docstring": "Verifies a signature on a certificate request.\n\n        :param PKey key: The public key that signature is supposedly from.\n\n        :return: ``True`` if the signature is correct.\n        :rtype: bool\n\n        :raises OpenSSL.crypto.Error: If the signature is invalid, or there was\n            a problem verifying the signature.", "docstring_tokens": ["Verifies", "a", "signature", "on", "a", "certificate", "request", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 252031}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L132-L140", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Checks if the string value ends with another string.", "language": "python", "parameters": "(string)", "return_statement": "return ends_with", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "ends_with", "(", "arg_1", ")", ":", "validate", "(", "text", ",", "arg_1", ")", "if", "not", "arg_1", ".", "Func", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "\"'{0}' does not end with '{1}'\"", ".", "format", "(", "arg_1", ",", "arg_0", ")", ")", "return", "True", "return", "ends_with"], "function": "def Func(arg_0):\n    \"\"\"Checks if the string value ends with another string.\"\"\"\n    def ends_with(arg_1):\n        validate(text, arg_1)\n        if not arg_1.Func(arg_0):\n            raise ValueError(\"'{0}' does not end with '{1}'\".format(arg_1, arg_0))\n        return True\n\n    return ends_with", "path": "src/streamlink/plugin/api/validate.py", "identifier": "endswith", "docstring": "Checks if the string value ends with another string.", "docstring_tokens": ["Checks", "if", "the", "string", "value", "ends", "with", "another", "string", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 252032}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/tm/tm_overlapping_sequences.py#L80-L109", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Very simple patterns. Each pattern has numOnes consecutive\n  bits on. The amount of overlap between consecutive patterns is\n  configurable, via the patternOverlap parameter.", "language": "python", "parameters": "(numOnes, numPatterns, patternOverlap=0)", "return_statement": "return p", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "assert", "(", "arg_2", "<", "arg_0", ")", "arg_3", "=", "arg_0", "-", "arg_2", "arg_4", "=", "arg_3", "*", "arg_1", "+", "arg_2", "arg_5", "=", "[", "]", "for", "arg_6", "in", "xrange", "(", "arg_1", ")", ":", "arg_7", "=", "numpy", ".", "zeros", "(", "arg_4", ",", "dtype", "=", "'float32'", ")", "arg_8", "=", "arg_6", "*", "arg_3", "arg_9", "=", "arg_8", "+", "arg_0", "arg_7", "[", "arg_8", ":", "arg_9", "]", "=", "1", "arg_5", ".", "append", "(", "arg_7", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=0):\n  \"\"\"Very simple patterns. Each pattern has numOnes consecutive\n  bits on. The amount of overlap between consecutive patterns is\n  configurable, via the patternOverlap parameter.\n\n  Parameters:\n  -----------------------------------------------------------------------\n  numOnes:        Number of bits ON in each pattern\n  numPatterns:    Number of unique patterns to generate\n  patternOverlap: Number of bits of overlap between each successive pattern\n  retval:         patterns\n  \"\"\"\n\n  assert (arg_2 < arg_0)\n\n  # How many new bits are introduced in each successive pattern?\n  arg_3 = arg_0 - arg_2\n  arg_4 = arg_3 * arg_1 + arg_2\n\n  arg_5 = []\n  for arg_6 in xrange(arg_1):\n    arg_7 = numpy.zeros(arg_4, dtype='float32')\n\n    arg_8 = arg_6*arg_3\n    arg_9 = arg_8 + arg_0\n    arg_7[arg_8:arg_9] = 1\n\n    arg_5.append(arg_7)\n\n  return arg_5", "path": "examples/tm/tm_overlapping_sequences.py", "identifier": "getSimplePatterns", "docstring": "Very simple patterns. Each pattern has numOnes consecutive\n  bits on. The amount of overlap between consecutive patterns is\n  configurable, via the patternOverlap parameter.\n\n  Parameters:\n  -----------------------------------------------------------------------\n  numOnes:        Number of bits ON in each pattern\n  numPatterns:    Number of unique patterns to generate\n  patternOverlap: Number of bits of overlap between each successive pattern\n  retval:         patterns", "docstring_tokens": ["Very", "simple", "patterns", ".", "Each", "pattern", "has", "numOnes", "consecutive", "bits", "on", ".", "The", "amount", "of", "overlap", "between", "consecutive", "patterns", "is", "configurable", "via", "the", "patternOverlap", "parameter", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252033}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/acts/releasing.py#L126-L170", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Bump a development version.", "language": "python", "parameters": "(ctx, verbose=False, pypi=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "config", ".", "load", "(", ")", "arg_4", "=", "scm_provider", "(", "arg_3", ".", "project_root", ",", "commit", "=", "False", ",", "arg_0", "=", "arg_0", ")", "if", "not", "arg_4", ".", "workdir_is_clean", "(", ")", ":", "notify", ".", "warning", "(", "\"You have uncommitted changes, will create a time-stamped version!\"", ")", "arg_5", "=", "arg_4", ".", "pep440_dev_version", "(", "arg_1", "=", "arg_1", ",", "non_local", "=", "arg_2", ")", "arg_6", "=", "arg_3", ".", "rootjoin", "(", "'setup.cfg'", ")", "if", "not", "arg_5", ":", "notify", ".", "info", "(", "\"Working directory contains a release version!\"", ")", "elif", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "with", "io", ".", "open", "(", "arg_6", ",", "encoding", "=", "'utf-8'", ")", "as", "handle", ":", "arg_7", "=", "handle", ".", "readlines", "(", ")", "arg_8", "=", "False", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_7", ")", ":", "if", "re", ".", "match", "(", "r\"#? *tag_build *= *.*\"", ",", "arg_10", ")", ":", "arg_11", ",", "arg_12", "=", "arg_7", "[", "arg_9", "]", ".", "split", "(", "'='", ",", "1", ")", "arg_7", "[", "arg_9", "]", "=", "'{}= {}\\n'", ".", "format", "(", "arg_11", ",", "arg_5", ")", "arg_8", "=", "True", "if", "arg_8", ":", "notify", ".", "info", "(", "\"Rewriting 'setup.cfg'...\"", ")", "with", "io", ".", "open", "(", "arg_6", ",", "'w'", ",", "encoding", "=", "'utf-8'", ")", "as", "handle", ":", "handle", ".", "write", "(", "''", ".", "join", "(", "arg_7", ")", ")", "else", ":", "notify", ".", "warning", "(", "\"No 'tag_build' setting found in 'setup.cfg'!\"", ")", "else", ":", "notify", ".", "warning", "(", "\"Cannot rewrite 'setup.cfg', none found!\"", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "arg_13", "=", "shell", ".", "capture", "(", "\"python setup.py egg_info\"", ",", "echo", "=", "True", "if", "arg_1", "else", "None", ")", "for", "arg_10", "in", "arg_13", ".", "splitlines", "(", ")", ":", "if", "arg_10", ".", "endswith", "(", "'PKG-INFO'", ")", ":", "arg_14", "=", "arg_10", ".", "split", "(", "None", ",", "1", ")", "[", "1", "]", "with", "io", ".", "open", "(", "arg_14", ",", "encoding", "=", "'utf-8'", ")", "as", "handle", ":", "notify", ".", "info", "(", "'\\n'", ".", "join", "(", "arg_9", "for", "arg_9", "in", "handle", ".", "readlines", "(", ")", "if", "arg_9", ".", "startswith", "(", "'Version:'", ")", ")", ".", "strip", "(", ")", ")", "arg_0", ".", "run", "(", "\"python setup.py -q develop\"", ",", "echo", "=", "True", "if", "arg_1", "else", "None", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n    \"\"\"Bump a development version.\"\"\"\n    arg_3 = config.load()\n    arg_4 = scm_provider(arg_3.project_root, commit=False, arg_0=arg_0)\n\n    # Check for uncommitted changes\n    if not arg_4.workdir_is_clean():\n        notify.warning(\"You have uncommitted changes, will create a time-stamped version!\")\n\n    arg_5 = arg_4.pep440_dev_version(arg_1=arg_1, non_local=arg_2)\n\n    # Rewrite 'setup.cfg'  TODO: refactor to helper, see also release-prep\n    # with util.rewrite_file(cfg.rootjoin('setup.cfg')) as lines:\n    #     ...\n    arg_6 = arg_3.rootjoin('setup.cfg')\n    if not arg_5:\n        notify.info(\"Working directory contains a release version!\")\n    elif os.path.exists(arg_6):\n        with io.open(arg_6, encoding='utf-8') as handle:\n            arg_7 = handle.readlines()\n        arg_8 = False\n        for arg_9, arg_10 in enumerate(arg_7):\n            if re.match(r\"#? *tag_build *= *.*\", arg_10):\n                arg_11, arg_12 = arg_7[arg_9].split('=', 1)\n                arg_7[arg_9] = '{}= {}\\n'.format(arg_11, arg_5)\n                arg_8 = True\n\n        if arg_8:\n            notify.info(\"Rewriting 'setup.cfg'...\")\n            with io.open(arg_6, 'w', encoding='utf-8') as handle:\n                handle.write(''.join(arg_7))\n        else:\n            notify.warning(\"No 'tag_build' setting found in 'setup.cfg'!\")\n    else:\n        notify.warning(\"Cannot rewrite 'setup.cfg', none found!\")\n\n    if os.path.exists(arg_6):\n        # Update metadata and print version\n        arg_13 = shell.capture(\"python setup.py egg_info\", echo=True if arg_1 else None)\n        for arg_10 in arg_13.splitlines():\n            if arg_10.endswith('PKG-INFO'):\n                arg_14 = arg_10.split(None, 1)[1]\n                with io.open(arg_14, encoding='utf-8') as handle:\n                    notify.info('\\n'.join(arg_9 for arg_9 in handle.readlines() if arg_9.startswith('Version:')).strip())\n        arg_0.run(\"python setup.py -q develop\", echo=True if arg_1 else None)", "path": "src/rituals/acts/releasing.py", "identifier": "bump", "docstring": "Bump a development version.", "docstring_tokens": ["Bump", "a", "development", "version", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 252034}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L120-L129", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Remove `self` from the containing `DiscoItems` object.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "disco", "is", "None", ":", "return", "arg_0", ".", "xmlnode", ".", "unlinkNode", "(", ")", "arg_1", "=", "arg_0", ".", "xmlnode", ".", "ns", "(", ")", "arg_2", "=", "arg_0", ".", "xmlnode", ".", "newNs", "(", "arg_1", ".", "getContent", "(", ")", ",", "None", ")", "arg_0", ".", "xmlnode", ".", "replaceNs", "(", "arg_1", ",", "arg_2", ")", "common_root", ".", "addChild", "(", "arg_0", ".", "xmlnode", "(", ")", ")", "arg_0", ".", "disco", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"Remove `self` from the containing `DiscoItems` object.\"\"\"\n        if arg_0.disco is None:\n            return\n        arg_0.xmlnode.unlinkNode()\n        arg_1=arg_0.xmlnode.ns()\n        arg_2=arg_0.xmlnode.newNs(arg_1.getContent(),None)\n        arg_0.xmlnode.replaceNs(arg_1,arg_2)\n        common_root.addChild(arg_0.xmlnode())\n        arg_0.disco=None", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoItem.remove", "docstring": "Remove `self` from the containing `DiscoItems` object.", "docstring_tokens": ["Remove", "self", "from", "the", "containing", "DiscoItems", "object", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 252035}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L286-L343", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots total amount of stocks with an active position, either short\n    or long. Displays daily total, daily average per month, and\n    all-time daily average.", "language": "python", "parameters": "(returns, positions, legend_loc='best', ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'best'", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "plt", ".", "gca", "(", ")", "arg_1", "=", "arg_1", ".", "copy", "(", ")", ".", "drop", "(", "'cash'", ",", "axis", "=", "'columns'", ")", "arg_5", "=", "arg_1", ".", "replace", "(", "0", ",", "np", ".", "nan", ")", ".", "count", "(", "axis", "=", "1", ")", "arg_6", "=", "arg_5", ".", "resample", "(", "'1M'", ")", ".", "mean", "(", ")", "arg_5", ".", "plot", "(", "color", "=", "'steelblue'", ",", "alpha", "=", "0.6", ",", "lw", "=", "0.5", ",", "arg_3", "=", "arg_3", ",", "**", "arg_4", ")", "arg_6", ".", "plot", "(", "color", "=", "'orangered'", ",", "lw", "=", "2", ",", "arg_3", "=", "arg_3", ",", "**", "arg_4", ")", "arg_3", ".", "axhline", "(", "arg_5", ".", "values", ".", "mean", "(", ")", ",", "color", "=", "'steelblue'", ",", "ls", "=", "'--'", ",", "lw", "=", "3", ")", "arg_3", ".", "set_xlim", "(", "(", "arg_0", ".", "index", "[", "0", "]", ",", "arg_0", ".", "index", "[", "-", "1", "]", ")", ")", "arg_7", "=", "arg_3", ".", "legend", "(", "[", "'Daily holdings'", ",", "'Average daily holdings, by month'", ",", "'Average daily holdings, overall'", "]", ",", "loc", "=", "arg_2", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "arg_7", ".", "get_frame", "(", ")", ".", "set_edgecolor", "(", "'black'", ")", "arg_3", ".", "set_title", "(", "'Total holdings'", ")", "arg_3", ".", "set_ylabel", "(", "'Holdings'", ")", "arg_3", ".", "set_xlabel", "(", "''", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2='best', arg_3=None, **arg_4):\n    \"\"\"\n    Plots total amount of stocks with an active position, either short\n    or long. Displays daily total, daily average per month, and\n    all-time daily average.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame, optional\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    legend_loc : matplotlib.loc, optional\n        The location of the legend on the plot.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_3 is None:\n        arg_3 = plt.gca()\n\n    arg_1 = arg_1.copy().drop('cash', axis='columns')\n    arg_5 = arg_1.replace(0, np.nan).count(axis=1)\n    arg_6 = arg_5.resample('1M').mean()\n    arg_5.plot(color='steelblue', alpha=0.6, lw=0.5, arg_3=arg_3, **arg_4)\n    arg_6.plot(\n        color='orangered',\n        lw=2,\n        arg_3=arg_3,\n        **arg_4)\n    arg_3.axhline(\n        arg_5.values.mean(),\n        color='steelblue',\n        ls='--',\n        lw=3)\n\n    arg_3.set_xlim((arg_0.index[0], arg_0.index[-1]))\n\n    arg_7 = arg_3.legend(['Daily holdings',\n                     'Average daily holdings, by month',\n                     'Average daily holdings, overall'],\n                    loc=arg_2, frameon=True,\n                    framealpha=0.5)\n    arg_7.get_frame().set_edgecolor('black')\n\n    arg_3.set_title('Total holdings')\n    arg_3.set_ylabel('Holdings')\n    arg_3.set_xlabel('')\n    return arg_3", "path": "pyfolio/plotting.py", "identifier": "plot_holdings", "docstring": "Plots total amount of stocks with an active position, either short\n    or long. Displays daily total, daily average per month, and\n    all-time daily average.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame, optional\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    legend_loc : matplotlib.loc, optional\n        The location of the legend on the plot.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "total", "amount", "of", "stocks", "with", "an", "active", "position", "either", "short", "or", "long", ".", "Displays", "daily", "total", "daily", "average", "per", "month", "and", "all", "-", "time", "daily", "average", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 252036}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/views.py#L368-L382", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Start procedure to validate variant using other techniques.", "language": "python", "parameters": "(institute_id, case_name, variant_id, variant_category, order)", "return_statement": "return redirect(request.referrer)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", ",", "arg_6", "=", "institute_and_case", "(", "store", ",", "arg_0", ",", "arg_1", ")", "arg_7", "=", "store", ".", "variant", "(", "arg_2", ")", "arg_8", "=", "store", ".", "user", "(", "current_user", ".", "email", ")", "arg_9", "=", "request", ".", "form", ".", "get", "(", "'verification_comment'", ")", "try", ":", "controllers", ".", "variant_verification", "(", "store", "=", "store", ",", "mail", "=", "mail", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_7", "=", "arg_7", ",", "sender", "=", "current_app", ".", "config", "[", "'MAIL_USERNAME'", "]", ",", "variant_url", "=", "request", ".", "referrer", ",", "arg_4", "=", "arg_4", ",", "url_builder", "=", "url_for", ")", "except", "controllers", ".", "MissingVerificationRecipientError", ":", "flash", "(", "'No verification recipients added to institute.'", ",", "'danger'", ")", "return", "redirect", "(", "request", ".", "referrer", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Start procedure to validate variant using other techniques.\"\"\"\n    arg_5, arg_6 = institute_and_case(store, arg_0, arg_1)\n    arg_7 = store.variant(arg_2)\n    arg_8 = store.user(current_user.email)\n\n    arg_9 = request.form.get('verification_comment')\n    \n    try:\n        controllers.variant_verification(store=store, mail=mail, arg_5=arg_5, arg_6=arg_6, arg_8=arg_8, arg_9=arg_9,\n                           arg_7=arg_7, sender=current_app.config['MAIL_USERNAME'], variant_url=request.referrer, arg_4=arg_4, url_builder=url_for)\n    except controllers.MissingVerificationRecipientError:\n        flash('No verification recipients added to institute.', 'danger')\n\n    return redirect(request.referrer)", "path": "scout/server/blueprints/variants/views.py", "identifier": "verify", "docstring": "Start procedure to validate variant using other techniques.", "docstring_tokens": ["Start", "procedure", "to", "validate", "variant", "using", "other", "techniques", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252037}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/teams.py#L322-L334", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns the name of the offensive scheme the team ran in the given\n        year.", "language": "python", "parameters": "(self, year)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_year_info_pq", "(", "arg_1", ",", "'Offensive Scheme'", ")", ".", "text", "(", ")", "arg_3", "=", "re", ".", "search", "(", "r'Offensive Scheme[:\\s]*(.+)\\s*'", ",", "arg_2", ",", "re", ".", "I", ")", "if", "arg_3", ":", "return", "arg_3", ".", "group", "(", "1", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns the name of the offensive scheme the team ran in the given\n        year.\n\n        :year: Int representing the season year.\n        :returns: A string representing the offensive scheme.\n        \"\"\"\n        arg_2 = arg_0._year_info_pq(arg_1, 'Offensive Scheme').text()\n        arg_3 = re.search(r'Offensive Scheme[:\\s]*(.+)\\s*', arg_2, re.I)\n        if arg_3:\n            return arg_3.group(1)\n        else:\n            return None", "path": "sportsref/nfl/teams.py", "identifier": "Team.off_scheme", "docstring": "Returns the name of the offensive scheme the team ran in the given\n        year.\n\n        :year: Int representing the season year.\n        :returns: A string representing the offensive scheme.", "docstring_tokens": ["Returns", "the", "name", "of", "the", "offensive", "scheme", "the", "team", "ran", "in", "the", "given", "year", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 252038}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L417-L431", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Search for a tournament by its name", "language": "python", "parameters": "(self, name: str, **params: keys)", "return_statement": "return self._get_model(url, PartialTournament, **params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "**", "arg_3", ":", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "api", ".", "TOURNAMENT", "arg_3", "[", "'name'", "]", "=", "arg_1", "return", "arg_0", ".", "_get_model", "(", "arg_5", ",", "PartialTournament", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, **arg_3: arg_4):\n        \"\"\"Search for a tournament by its name\n\n        Parameters\n        ----------\n        name: str\n            The name of a tournament\n        \\*\\*limit: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_5 = arg_0.api.TOURNAMENT\n        arg_3['name'] = arg_1\n        return arg_0._get_model(arg_5, PartialTournament, **arg_3)", "path": "clashroyale/official_api/client.py", "identifier": "Client.search_tournaments", "docstring": "Search for a tournament by its name\n\n        Parameters\n        ----------\n        name: str\n            The name of a tournament\n        \\*\\*limit: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Search", "for", "a", "tournament", "by", "its", "name"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 252039}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/util.py#L90-L104", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Make a variable a list if it is not already", "language": "python", "parameters": "(var, num_terms=1)", "return_statement": "return var", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "list", ")", ":", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "arg_0", "=", "list", "(", "arg_0", ")", "else", ":", "arg_0", "=", "[", "arg_0", "]", "for", "arg_2", "in", "range", "(", "1", ",", "arg_1", ")", ":", "arg_0", ".", "append", "(", "arg_0", "[", "0", "]", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=1):\n    \"\"\" Make a variable a list if it is not already\n\n    If variable is not a list it will make it a list of the correct length with\n    all terms identical.\n    \"\"\"\n    if not isinstance(arg_0, list):\n        if isinstance(arg_0, tuple):\n            arg_0 = list(arg_0)\n        else:\n            arg_0 = [arg_0]\n    #if len(var) == 1:\n            for arg_2 in range(1, arg_1):\n                arg_0.append(arg_0[0])\n    return arg_0", "path": "meshlabxml/util.py", "identifier": "make_list", "docstring": "Make a variable a list if it is not already\n\n    If variable is not a list it will make it a list of the correct length with\n    all terms identical.", "docstring_tokens": ["Make", "a", "variable", "a", "list", "if", "it", "is", "not", "already"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 252040}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L976-L990", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Consumes a boolean value.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "ParseBool", "(", "arg_0", ".", "token", ")", "except", "ValueError", "as", "e", ":", "raise", "arg_0", ".", "_ParseError", "(", "str", "(", "e", ")", ")", "arg_0", ".", "NextToken", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Consumes a boolean value.\n\n    Returns:\n      The bool parsed.\n\n    Raises:\n      ParseError: If a boolean value couldn't be consumed.\n    \"\"\"\n    try:\n      arg_1 = ParseBool(arg_0.token)\n    except ValueError as e:\n      raise arg_0._ParseError(str(e))\n    arg_0.NextToken()\n    return arg_1", "path": "typy/google/protobuf/text_format.py", "identifier": "_Tokenizer.ConsumeBool", "docstring": "Consumes a boolean value.\n\n    Returns:\n      The bool parsed.\n\n    Raises:\n      ParseError: If a boolean value couldn't be consumed.", "docstring_tokens": ["Consumes", "a", "boolean", "value", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 252041}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/dialog_logger.py#L78-L110", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Logs single dialog utterance to current dialog log file.", "language": "python", "parameters": "(self, utterance: Any, direction: str, dialog_id: Optional[Hashable]=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_6", "[", "arg_7", "]", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "arg_4", ")", ":", "pass", "elif", "isinstance", "(", "arg_1", ",", "RichMessage", ")", ":", "arg_1", "=", "arg_1", ".", "json", "(", ")", "elif", "isinstance", "(", "arg_1", ",", "(", "list", ",", "dict", ")", ")", ":", "arg_1", "=", "jsonify_data", "(", "arg_1", ")", "else", ":", "arg_1", "=", "arg_4", "(", "arg_1", ")", "arg_5", "=", "arg_4", "(", "arg_5", ")", "if", "not", "isinstance", "(", "arg_5", ",", "arg_4", ")", "else", "arg_5", "if", "arg_0", ".", "log_file", ".", "tell", "(", ")", ">=", "arg_0", ".", "log_max_size", "*", "1024", ":", "arg_0", ".", "log_file", ".", "close", "(", ")", "arg_0", ".", "log_file", "=", "arg_0", ".", "_getFunc_file", "(", ")", "else", ":", "try", ":", "arg_9", "=", "{", "}", "arg_9", "[", "'timestamp'", "]", "=", "arg_0", ".", "_get_timestamp_utc_str", "(", ")", "arg_9", "[", "'dialog_id'", "]", "=", "arg_5", "arg_9", "[", "'direction'", "]", "=", "arg_3", "arg_9", "[", "'message'", "]", "=", "arg_1", "arg_10", "=", "json", ".", "dumps", "(", "arg_9", ",", "ensure_ascii", "=", "arg_0", ".", "config", "[", "'ensure_ascii'", "]", ")", "arg_0", ".", "log_file", ".", "write", "(", "f'{log_str}\\n'", ")", "except", "IOError", ":", "log", ".", "error", "(", "'Failed to write dialog log.'", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4, arg_5: arg_6[arg_7]=None):\n        \"\"\"Logs single dialog utterance to current dialog log file.\n\n        Args:\n            utterance: Dialog utterance.\n            direction: 'in' or 'out' utterance direction.\n            dialog_id: Dialog ID.\n        \"\"\"\n        if isinstance(arg_1, arg_4):\n            pass\n        elif isinstance(arg_1, RichMessage):\n            arg_1 = arg_1.json()\n        elif isinstance(arg_1, (list, dict)):\n            arg_1 = jsonify_data(arg_1)\n        else:\n            arg_1 = arg_4(arg_1)\n\n        arg_5 = arg_4(arg_5) if not isinstance(arg_5, arg_4) else arg_5\n\n        if arg_0.log_file.tell() >= arg_0.log_max_size * 1024:\n            arg_0.log_file.close()\n            arg_0.log_file = arg_0._getFunc_file()\n        else:\n            try:\n                arg_9 = {}\n                arg_9['timestamp'] = arg_0._get_timestamp_utc_str()\n                arg_9['dialog_id'] = arg_5\n                arg_9['direction'] = arg_3\n                arg_9['message'] = arg_1\n                arg_10 = json.dumps(arg_9, ensure_ascii=arg_0.config['ensure_ascii'])\n                arg_0.log_file.write(f'{log_str}\\n')\n            except IOError:\n                log.error('Failed to write dialog log.')", "path": "deeppavlov/core/agent/dialog_logger.py", "identifier": "DialogLogger._log", "docstring": "Logs single dialog utterance to current dialog log file.\n\n        Args:\n            utterance: Dialog utterance.\n            direction: 'in' or 'out' utterance direction.\n            dialog_id: Dialog ID.", "docstring_tokens": ["Logs", "single", "dialog", "utterance", "to", "current", "dialog", "log", "file", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 252042}
{"url": "https://github.com/FaradayRF/faradayio/blob/6cf3af88bb4a83e5d2036e5cbdfaf8f0f01500bb/faradayio/faraday.py#L32-L56", "sha": "6cf3af88bb4a83e5d2036e5cbdfaf8f0f01500bb", "docstring_summary": "Encodes data to slip protocol and then sends over serial port", "language": "python", "parameters": "(self, msg)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "sliplib", ".", "Driver", "(", ")", "arg_3", "=", "arg_2", ".", "Func", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "_serialPort", ".", "write", "(", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Encodes data to slip protocol and then Funcs over serial port\n\n        Uses the SlipLib module to convert the message data into SLIP format.\n        The message is then sent over the serial port opened with the instance\n        of the Faraday class used when invoking Func().\n\n        Args:\n            msg (bytes): Bytes format message to Func over serial port.\n\n        Returns:\n            int: Number of bytes transmitted over the serial port.\n\n        \"\"\"\n        # Create a sliplib Driver\n        arg_2 = sliplib.Driver()\n\n        # Package data in slip format\n        arg_3 = arg_2.Func(arg_1)\n\n        # Send data over serial port\n        arg_4 = arg_0._serialPort.write(arg_3)\n\n        # Return number of bytes transmitted over serial port\n        return arg_4", "path": "faradayio/faraday.py", "identifier": "Faraday.send", "docstring": "Encodes data to slip protocol and then sends over serial port\n\n        Uses the SlipLib module to convert the message data into SLIP format.\n        The message is then sent over the serial port opened with the instance\n        of the Faraday class used when invoking send().\n\n        Args:\n            msg (bytes): Bytes format message to send over serial port.\n\n        Returns:\n            int: Number of bytes transmitted over the serial port.", "docstring_tokens": ["Encodes", "data", "to", "slip", "protocol", "and", "then", "sends", "over", "serial", "port"], "nwo": "FaradayRF/faradayio", "score": 0.289831668365279, "idx": 252043}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/matrix_drawing.py#L13-L44", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Draws a circle at point x0, y0 with radius r of the specified RGB color", "language": "python", "parameters": "(setter, x0, y0, r, color=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "1", "-", "arg_3", "arg_6", "=", "1", "arg_7", "=", "-", "2", "*", "arg_3", "arg_8", "=", "0", "arg_9", "=", "arg_3", "arg_0", "(", "arg_1", ",", "arg_2", "+", "arg_3", ",", "arg_4", ")", "arg_0", "(", "arg_1", ",", "arg_2", "-", "arg_3", ",", "arg_4", ")", "arg_0", "(", "arg_1", "+", "arg_3", ",", "arg_2", ",", "arg_4", ")", "arg_0", "(", "arg_1", "-", "arg_3", ",", "arg_2", ",", "arg_4", ")", "while", "arg_8", "<", "arg_9", ":", "if", "arg_5", ">=", "0", ":", "arg_9", "-=", "1", "arg_7", "+=", "2", "arg_5", "+=", "arg_7", "arg_8", "+=", "1", "arg_6", "+=", "2", "arg_5", "+=", "arg_6", "arg_0", "(", "arg_1", "+", "arg_8", ",", "arg_2", "+", "arg_9", ",", "arg_4", ")", "arg_0", "(", "arg_1", "-", "arg_8", ",", "arg_2", "+", "arg_9", ",", "arg_4", ")", "arg_0", "(", "arg_1", "+", "arg_8", ",", "arg_2", "-", "arg_9", ",", "arg_4", ")", "arg_0", "(", "arg_1", "-", "arg_8", ",", "arg_2", "-", "arg_9", ",", "arg_4", ")", "arg_0", "(", "arg_1", "+", "arg_9", ",", "arg_2", "+", "arg_8", ",", "arg_4", ")", "arg_0", "(", "arg_1", "-", "arg_9", ",", "arg_2", "+", "arg_8", ",", "arg_4", ")", "arg_0", "(", "arg_1", "+", "arg_9", ",", "arg_2", "-", "arg_8", ",", "arg_4", ")", "arg_0", "(", "arg_1", "-", "arg_9", ",", "arg_2", "-", "arg_8", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n    \"\"\"\n    Draws a circle at point x0, y0 with radius r of the specified RGB color\n    \"\"\"\n    arg_5 = 1 - arg_3\n    arg_6 = 1\n    arg_7 = -2 * arg_3\n    arg_8 = 0\n    arg_9 = arg_3\n\n    arg_0(arg_1, arg_2 + arg_3, arg_4)\n    arg_0(arg_1, arg_2 - arg_3, arg_4)\n    arg_0(arg_1 + arg_3, arg_2, arg_4)\n    arg_0(arg_1 - arg_3, arg_2, arg_4)\n\n    while arg_8 < arg_9:\n        if arg_5 >= 0:\n            arg_9 -= 1\n            arg_7 += 2\n            arg_5 += arg_7\n        arg_8 += 1\n        arg_6 += 2\n        arg_5 += arg_6\n\n        arg_0(arg_1 + arg_8, arg_2 + arg_9, arg_4)\n        arg_0(arg_1 - arg_8, arg_2 + arg_9, arg_4)\n        arg_0(arg_1 + arg_8, arg_2 - arg_9, arg_4)\n        arg_0(arg_1 - arg_8, arg_2 - arg_9, arg_4)\n        arg_0(arg_1 + arg_9, arg_2 + arg_8, arg_4)\n        arg_0(arg_1 - arg_9, arg_2 + arg_8, arg_4)\n        arg_0(arg_1 + arg_9, arg_2 - arg_8, arg_4)\n        arg_0(arg_1 - arg_9, arg_2 - arg_8, arg_4)", "path": "bibliopixel/layout/matrix_drawing.py", "identifier": "draw_circle", "docstring": "Draws a circle at point x0, y0 with radius r of the specified RGB color", "docstring_tokens": ["Draws", "a", "circle", "at", "point", "x0", "y0", "with", "radius", "r", "of", "the", "specified", "RGB", "color"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 252044}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1579-L1596", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Reboots the server.", "language": "python", "parameters": "(self, datacenter_id, server_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/servers/%s/reboot'", "%", "(", "arg_1", ",", "arg_2", ")", ",", "method", "=", "'POST-ACTION'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Reboots the server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        \"\"\"\n        arg_3 = arg_0._perform_request(\n            url='/datacenters/%s/servers/%s/reboot' % (\n                arg_1,\n                arg_2),\n            method='POST-ACTION')\n\n        return arg_3", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.reboot_server", "docstring": "Reboots the server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``", "docstring_tokens": ["Reboots", "the", "server", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 252045}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L256-L296", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Aggregates results of a query into buckets defined by the 'agg_def' parameter.  The aggregations are\n        represented by dicts containing a 'name' key and a 'terms' key holding a list of the aggregation buckets.\n        Each bucket element is a dict containing a 'term' key containing the term used for this bucket, a 'count' key\n        containing the count of items that match this bucket, and an 'aggregations' key containing any child\n        aggregations.", "language": "python", "parameters": "(self, searchAreaWkt, agg_def, query=None, start_date=None, end_date=None, count=10, index=default_index)", "return_statement": "return r.json(object_pairs_hook=OrderedDict)['aggregations']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "10", ",", "arg_7", "=", "arg_8", ")", ":", "arg_9", "=", "load_wkt", "(", "arg_1", ")", ".", "__geo_interface__", "arg_10", "=", "str", "(", "arg_2", ")", "arg_11", "=", "{", "\"count\"", ":", "arg_6", ",", "\"aggs\"", ":", "arg_10", "}", "if", "arg_3", ":", "arg_11", "[", "'query'", "]", "=", "arg_3", "if", "arg_4", ":", "arg_11", "[", "'start_date'", "]", "=", "arg_4", "if", "arg_5", ":", "arg_11", "[", "'end_date'", "]", "=", "arg_5", "arg_12", "=", "arg_0", ".", "aggregations_by_index_url", "%", "arg_7", "if", "arg_7", "else", "arg_0", ".", "aggregations_url", "arg_13", "=", "arg_0", ".", "gbdx_connection", ".", "post", "(", "arg_12", ",", "arg_11", "=", "arg_11", ",", "json", "=", "arg_9", ")", "arg_13", ".", "raise_for_status", "(", ")", "return", "arg_13", ".", "json", "(", "object_pairs_hook", "=", "OrderedDict", ")", "[", "'aggregations'", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=10, arg_7=arg_8):\n        \"\"\"Aggregates results of a query into buckets defined by the 'agg_def' parameter.  The aggregations are\n        represented by dicts containing a 'name' key and a 'terms' key holding a list of the aggregation buckets.\n        Each bucket element is a dict containing a 'term' key containing the term used for this bucket, a 'count' key\n        containing the count of items that match this bucket, and an 'aggregations' key containing any child\n        aggregations.\n\n        Args:\n            searchAreaWkt (str): wkt representation of the geometry\n            agg_def (str or AggregationDef): the aggregation definitions\n            query (str): a valid Elasticsearch query string to constrain the items going into the aggregation\n            start_date (str): either an ISO-8601 date string or a 'now' expression (e.g. \"now-6d\" or just \"now\")\n            end_date (str): either an ISO-8601 date string or a 'now' expression (e.g. \"now-6d\" or just \"now\")\n            count (int): the number of buckets to include in the aggregations (the top N will be returned)\n            index (str): the index (or alias or wildcard index expression) to run aggregations against, set to None for the entire set of vector indexes\n\n        Returns:\n            results (list): A (usually single-element) list of dict objects containing the aggregation results.\n        \"\"\"\n\n        arg_9 = load_wkt(arg_1).__geo_interface__\n        arg_10 = str(arg_2) # could be string or AggregationDef\n\n        arg_11 = {\n            \"count\": arg_6,\n            \"aggs\": arg_10\n        }\n\n        if arg_3:\n            arg_11['query'] = arg_3\n        if arg_4:\n            arg_11['start_date'] = arg_4\n        if arg_5:\n            arg_11['end_date'] = arg_5\n\n        arg_12 = arg_0.aggregations_by_index_url % arg_7 if arg_7 else arg_0.aggregations_url\n\n        arg_13 = arg_0.gbdx_connection.post(arg_12, arg_11=arg_11, json=arg_9)\n        arg_13.raise_for_status()\n\n        return arg_13.json(object_pairs_hook=OrderedDict)['aggregations']", "path": "gbdxtools/vectors.py", "identifier": "Vectors.aggregate_query", "docstring": "Aggregates results of a query into buckets defined by the 'agg_def' parameter.  The aggregations are\n        represented by dicts containing a 'name' key and a 'terms' key holding a list of the aggregation buckets.\n        Each bucket element is a dict containing a 'term' key containing the term used for this bucket, a 'count' key\n        containing the count of items that match this bucket, and an 'aggregations' key containing any child\n        aggregations.\n\n        Args:\n            searchAreaWkt (str): wkt representation of the geometry\n            agg_def (str or AggregationDef): the aggregation definitions\n            query (str): a valid Elasticsearch query string to constrain the items going into the aggregation\n            start_date (str): either an ISO-8601 date string or a 'now' expression (e.g. \"now-6d\" or just \"now\")\n            end_date (str): either an ISO-8601 date string or a 'now' expression (e.g. \"now-6d\" or just \"now\")\n            count (int): the number of buckets to include in the aggregations (the top N will be returned)\n            index (str): the index (or alias or wildcard index expression) to run aggregations against, set to None for the entire set of vector indexes\n\n        Returns:\n            results (list): A (usually single-element) list of dict objects containing the aggregation results.", "docstring_tokens": ["Aggregates", "results", "of", "a", "query", "into", "buckets", "defined", "by", "the", "agg_def", "parameter", ".", "The", "aggregations", "are", "represented", "by", "dicts", "containing", "a", "name", "key", "and", "a", "terms", "key", "holding", "a", "list", "of", "the", "aggregation", "buckets", ".", "Each", "bucket", "element", "is", "a", "dict", "containing", "a", "term", "key", "containing", "the", "term", "used", "for", "this", "bucket", "a", "count", "key", "containing", "the", "count", "of", "items", "that", "match", "this", "bucket", "and", "an", "aggregations", "key", "containing", "any", "child", "aggregations", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 252046}
{"url": "https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/zincparser.py#L497-L572", "sha": "d52a7c6b5bc466f3c1a77b71814c8c0776aba995", "docstring_summary": "Parse the incoming grid.", "language": "python", "parameters": "(grid_data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "NEWLINE_RE", ".", "split", "(", "arg_0", ")", "if", "len", "(", "arg_1", ")", "<", "2", ":", "raise", "ZincParseException", "(", "'Malformed grid received'", ",", "arg_0", ",", "1", ",", "1", ")", "arg_2", "=", "arg_1", ".", "pop", "(", "0", ")", "arg_3", "=", "arg_1", ".", "pop", "(", "0", ")", "arg_4", "=", "VERSION_RE", ".", "match", "(", "arg_2", ")", "if", "arg_4", "is", "None", ":", "raise", "ZincParseException", "(", "'Could not determine version from %r'", "%", "arg_2", ",", "arg_0", ",", "1", ",", "1", ")", "arg_5", "=", "Version", "(", "arg_4", ".", "group", "(", "1", ")", ")", "try", ":", "arg_6", "=", "hs_gridMeta", "[", "arg_5", "]", ".", "parseString", "(", "arg_2", ",", "parseAll", "=", "True", ")", "[", "0", "]", "except", "pp", ".", "ParseException", "as", "pe", ":", "raise", "ZincParseException", "(", "'Failed to parse grid metadata: %s'", "%", "pe", ",", "arg_0", ",", "1", ",", "pe", ".", "col", ")", "except", ":", "LOG", ".", "debug", "(", "'Failed to parse grid meta: %r'", ",", "arg_2", ")", "raise", "try", ":", "arg_7", "=", "hs_cols", "[", "arg_5", "]", ".", "parseString", "(", "arg_3", ",", "parseAll", "=", "True", ")", "[", "0", "]", "except", "pp", ".", "ParseException", "as", "pe", ":", "raise", "ZincParseException", "(", "'Failed to parse column metadata: %s'", "%", "reformat_exception", "(", "pe", ",", "2", ")", ",", "arg_0", ",", "2", ",", "pe", ".", "col", ")", "except", ":", "LOG", ".", "debug", "(", "'Failed to parse column meta: %r'", ",", "arg_3", ")", "raise", "arg_8", "=", "hs_row", "[", "arg_5", "]", "def", "_parse_row", "(", "arg_9", ")", ":", "(", "arg_10", ",", "arg_11", ")", "=", "arg_9", "arg_12", "=", "arg_10", "+", "3", "try", ":", "return", "dict", "(", "zip", "(", "arg_7", ".", "keys", "(", ")", ",", "arg_8", ".", "parseString", "(", "arg_11", ",", "parseAll", "=", "True", ")", "[", "0", "]", ".", "asList", "(", ")", ")", ")", "except", "pp", ".", "ParseException", "as", "pe", ":", "raise", "ZincParseException", "(", "'Failed to parse row: %s'", "%", "reformat_exception", "(", "pe", ",", "arg_12", ")", ",", "arg_0", ",", "arg_12", ",", "pe", ".", "col", ")", "except", ":", "LOG", ".", "debug", "(", "'Failed to parse row: %r'", ",", "arg_11", ")", "raise", "arg_13", "=", "Grid", "(", "arg_5", "=", "arg_6", ".", "pop", "(", "'ver'", ")", ",", "metadata", "=", "arg_6", ",", "columns", "=", "list", "(", "arg_7", ".", "items", "(", ")", ")", ")", "arg_13", ".", "extend", "(", "map", "(", "_parse_row", ",", "filter", "(", "lambda", "gp", ":", "bool", "(", "gp", "[", "1", "]", ")", ",", "enumerate", "(", "arg_1", ")", ")", ")", ")", "return", "arg_13", "except", ":", "LOG", ".", "debug", "(", "'Failing grid: %r'", ",", "arg_0", ")", "raise"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse the incoming grid.\n    \"\"\"\n    try:\n        # Split the grid up.\n        arg_1 = NEWLINE_RE.split(arg_0)\n        if len(arg_1) < 2:\n            raise ZincParseException('Malformed grid received',\n                    arg_0, 1, 1)\n\n        # Grid and column metadata are the first two lines.\n        arg_2 = arg_1.pop(0)\n        arg_3 = arg_1.pop(0)\n\n        # First element is the grid metadata\n        arg_4 = VERSION_RE.match(arg_2)\n        if arg_4 is None:\n            raise ZincParseException(\n                    'Could not determine version from %r' % arg_2,\n                    arg_0, 1, 1)\n        arg_5 = Version(arg_4.group(1))\n\n        # Now parse the rest of the grid accordingly\n        try:\n            arg_6 = hs_gridMeta[arg_5].parseString(arg_2, parseAll=True)[0]\n        except pp.ParseException as pe:\n            # Raise a new exception with the appropriate line number.\n            raise ZincParseException(\n                    'Failed to parse grid metadata: %s' % pe,\n                    arg_0, 1, pe.col)\n        except: # pragma: no cover\n            # Report an error to the log if we fail to parse something.\n            LOG.debug('Failed to parse grid meta: %r', arg_2)\n            raise\n\n        try:\n            arg_7 = hs_cols[arg_5].parseString(arg_3, parseAll=True)[0]\n        except pp.ParseException as pe:\n            # Raise a new exception with the appropriate line number.\n            raise ZincParseException(\n                    'Failed to parse column metadata: %s' \\\n                            % reformat_exception(pe, 2),\n                    arg_0, 2, pe.col)\n        except: # pragma: no cover\n            # Report an error to the log if we fail to parse something.\n            LOG.debug('Failed to parse column meta: %r', arg_3)\n            raise\n\n        arg_8 = hs_row[arg_5]\n        def _parse_row(arg_9):\n            (arg_10, arg_11) = arg_9\n            arg_12 = arg_10 + 3\n\n            try:\n                return dict(zip(arg_7.keys(),\n                    arg_8.parseString(arg_11, parseAll=True)[0].asList()))\n            except pp.ParseException as pe:\n                # Raise a new exception with the appropriate line number.\n                raise ZincParseException(\n                        'Failed to parse row: %s' \\\n                            % reformat_exception(pe, arg_12),\n                        arg_0, arg_12, pe.col)\n            except: # pragma: no cover\n                # Report an error to the log if we fail to parse something.\n                LOG.debug('Failed to parse row: %r', arg_11)\n                raise\n\n        arg_13 = Grid(arg_5=arg_6.pop('ver'),\n                metadata=arg_6,\n                columns=list(arg_7.items()))\n        arg_13.extend(map(_parse_row, filter(lambda gp : bool(gp[1]), enumerate(arg_1))))\n        return arg_13\n    except:\n        LOG.debug('Failing grid: %r', arg_0)\n        raise", "path": "hszinc/zincparser.py", "identifier": "parse_grid", "docstring": "Parse the incoming grid.", "docstring_tokens": ["Parse", "the", "incoming", "grid", "."], "nwo": "vrtsystems/hszinc", "score": 0.2823188883832642, "idx": 252047}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/quickstart.py#L143-L192", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Poll the queues that the worker can use to communicate with the \n        supervisor, until all the workers are done and all the queues are \n        empty.  Handle messages as they appear.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "time", "arg_1", "=", "lambda", ":", "(", "multiprocessing", ".", "active_children", "(", ")", "or", "not", "arg_0", ".", "log_queue", ".", "empty", "(", ")", "or", "not", "arg_0", ".", "exception_queue", ".", "empty", "(", ")", ")", "try", ":", "while", "arg_1", "(", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "log_queue", ".", "get_nowait", "(", ")", "arg_3", "=", "logging", ".", "getLogger", "(", "arg_2", ".", "name", ")", "arg_3", ".", "handle", "(", "arg_2", ")", "except", "queue", ".", "Empty", ":", "pass", "try", ":", "arg_4", "=", "arg_0", ".", "exception_queue", ".", "get_nowait", "(", ")", "except", "queue", ".", "Empty", ":", "pass", "else", ":", "raise", "arg_4", "time", ".", "sleep", "(", "1", "/", "arg_0", ".", "frame_rate", ")", "arg_0", ".", "elapsed_time", "+=", "1", "/", "arg_0", ".", "frame_rate", "if", "arg_0", ".", "time_limit", "and", "arg_0", ".", "elapsed_time", ">", "arg_0", ".", "time_limit", ":", "raise", "RuntimeError", "(", "\"timeout\"", ")", "finally", ":", "for", "arg_5", "in", "multiprocessing", ".", "active_children", "(", ")", ":", "arg_5", ".", "terminate", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Poll the queues that the worker can use to communicate with the \n        supervisor, until all the workers are done and all the queues are \n        empty.  Handle messages as they appear.\n        \"\"\"\n        import time\n\n        arg_1 = lambda: (\n                multiprocessing.active_children()\n                or not arg_0.log_queue.empty()\n                or not arg_0.exception_queue.empty())\n\n        try:\n            while arg_1():\n                # When a log message is received, make a logger with the same \n                # name in this process and use it to re-log the message.  It \n                # will get handled in this process.\n\n                try:\n                    arg_2 = arg_0.log_queue.get_nowait()\n                    arg_3 = logging.getLogger(arg_2.name)\n                    arg_3.handle(arg_2)\n                except queue.Empty:\n                    pass\n\n                # When an exception is received, immediately re-raise it.\n\n                try:\n                    arg_4 = arg_0.exception_queue.get_nowait()\n                except queue.Empty:\n                    pass\n                else:\n                    raise arg_4\n\n                # Sleep for a little bit, and make sure that the workers haven't \n                # outlived their time limit.\n\n                time.sleep(1/arg_0.frame_rate)\n                arg_0.elapsed_time += 1/arg_0.frame_rate\n\n                if arg_0.time_limit and arg_0.elapsed_time > arg_0.time_limit:\n                    raise RuntimeError(\"timeout\")\n\n        # Make sure the workers don't outlive the supervisor, no matter how the \n        # polling loop ended (e.g. normal execution or an exception).\n\n        finally:\n            for arg_5 in multiprocessing.active_children():\n                arg_5.terminate()", "path": "kxg/quickstart.py", "identifier": "ProcessPool._run_supervisor", "docstring": "Poll the queues that the worker can use to communicate with the \n        supervisor, until all the workers are done and all the queues are \n        empty.  Handle messages as they appear.", "docstring_tokens": ["Poll", "the", "queues", "that", "the", "worker", "can", "use", "to", "communicate", "with", "the", "supervisor", "until", "all", "the", "workers", "are", "done", "and", "all", "the", "queues", "are", "empty", ".", "Handle", "messages", "as", "they", "appear", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 252048}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L706-L733", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the temperature of the package given the specified\n        enthalpy using a secant algorithm.", "language": "python", "parameters": "(self, H)", "return_statement": "return x[len(x) - 1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", ")", "arg_2", ".", "append", "(", "arg_0", ".", "_T", ")", "arg_2", ".", "append", "(", "arg_0", ".", "_T", "+", "10.0", ")", "arg_3", "=", "list", "(", ")", "arg_3", ".", "append", "(", "arg_0", ".", "_calculate_H", "(", "arg_2", "[", "0", "]", ")", "-", "arg_1", ")", "arg_3", ".", "append", "(", "arg_0", ".", "_calculate_H", "(", "arg_2", "[", "1", "]", ")", "-", "arg_1", ")", "for", "arg_4", "in", "range", "(", "2", ",", "50", ")", ":", "arg_2", ".", "append", "(", "arg_2", "[", "arg_4", "-", "1", "]", "-", "arg_3", "[", "arg_4", "-", "1", "]", "*", "(", "(", "arg_2", "[", "arg_4", "-", "1", "]", "-", "arg_2", "[", "arg_4", "-", "2", "]", ")", "/", "(", "arg_3", "[", "arg_4", "-", "1", "]", "-", "arg_3", "[", "arg_4", "-", "2", "]", ")", ")", ")", "arg_3", ".", "append", "(", "arg_0", ".", "_calculate_H", "(", "arg_2", "[", "arg_4", "]", ")", "-", "arg_1", ")", "if", "abs", "(", "arg_3", "[", "arg_4", "-", "1", "]", ")", "<", "1.0e-5", ":", "break", "return", "arg_2", "[", "len", "(", "arg_2", ")", "-", "1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the temperature of the package given the specified\n        enthalpy using a secant algorithm.\n\n        :param H: Enthalpy. [kWh]\n\n        :returns: Temperature. [\u00b0C]\n        \"\"\"\n\n        # Create the initial guesses for temperature.\n        arg_2 = list()\n        arg_2.append(arg_0._T)\n        arg_2.append(arg_0._T + 10.0)\n\n        # Evaluate the enthalpy for the initial guesses.\n        arg_3 = list()\n        arg_3.append(arg_0._calculate_H(arg_2[0]) - arg_1)\n        arg_3.append(arg_0._calculate_H(arg_2[1]) - arg_1)\n\n        # Solve for temperature.\n        for arg_4 in range(2, 50):\n            arg_2.append(arg_2[arg_4-1] - arg_3[arg_4-1]*((arg_2[arg_4-1] - arg_2[arg_4-2])/(arg_3[arg_4-1] - arg_3[arg_4-2])))\n            arg_3.append(arg_0._calculate_H(arg_2[arg_4]) - arg_1)\n            if abs(arg_3[arg_4-1]) < 1.0e-5:\n                break\n\n        return arg_2[len(arg_2) - 1]", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "MaterialPackage._calculate_T", "docstring": "Calculate the temperature of the package given the specified\n        enthalpy using a secant algorithm.\n\n        :param H: Enthalpy. [kWh]\n\n        :returns: Temperature. [\u00b0C]", "docstring_tokens": ["Calculate", "the", "temperature", "of", "the", "package", "given", "the", "specified", "enthalpy", "using", "a", "secant", "algorithm", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 252049}
{"url": "https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_orderedbidict.py#L61-L81", "sha": "1a1ba9758651aed9c4f58384eff006d2e2ad6835", "docstring_summary": "Move an existing key to the beginning or end of this ordered bidict.", "language": "python", "parameters": "(self, key, last=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "_fwdm", "[", "arg_1", "]", "arg_3", ".", "prv", ".", "nxt", "=", "arg_3", ".", "nxt", "arg_3", ".", "nxt", ".", "prv", "=", "arg_3", ".", "prv", "arg_6", "=", "arg_0", ".", "_sntl", "if", "arg_2", ":", "arg_2", "=", "arg_6", ".", "prv", "arg_3", ".", "prv", "=", "arg_2", "arg_3", ".", "nxt", "=", "arg_6", "arg_6", ".", "prv", "=", "arg_2", ".", "nxt", "=", "arg_3", "else", ":", "arg_7", "=", "arg_6", ".", "nxt", "arg_3", ".", "prv", "=", "arg_6", "arg_3", ".", "nxt", "=", "arg_7", "arg_6", ".", "nxt", "=", "arg_7", ".", "prv", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Move an existing key to the beginning or end of this ordered bidict.\n\n        The item is moved to the end if *last* is True, else to the beginning.\n\n        :raises KeyError: if the key does not exist\n        \"\"\"\n        arg_3 = arg_0._fwdm[arg_1]\n        arg_3.prv.nxt = arg_3.nxt\n        arg_3.nxt.prv = arg_3.prv\n        arg_6 = arg_0._sntl\n        if arg_2:\n            arg_2 = arg_6.prv\n            arg_3.prv = arg_2\n            arg_3.nxt = arg_6\n            arg_6.prv = arg_2.nxt = arg_3\n        else:\n            arg_7 = arg_6.nxt\n            arg_3.prv = arg_6\n            arg_3.nxt = arg_7\n            arg_6.nxt = arg_7.prv = arg_3", "path": "bidict/_orderedbidict.py", "identifier": "OrderedBidict.move_to_end", "docstring": "Move an existing key to the beginning or end of this ordered bidict.\n\n        The item is moved to the end if *last* is True, else to the beginning.\n\n        :raises KeyError: if the key does not exist", "docstring_tokens": ["Move", "an", "existing", "key", "to", "the", "beginning", "or", "end", "of", "this", "ordered", "bidict", "."], "nwo": "jab/bidict", "score": 0.5840682608785344, "idx": 252050}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/contents.py#L146-L182", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the data encoding the ProtocolVersion struct to a stream.", "language": "python", "parameters": "(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "arg_6", "=", "utils", ".", "BytearrayStream", "(", ")", "if", "arg_0", ".", "_major", ":", "arg_0", ".", "_major", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Invalid struct missing the major protocol version number.\"", ")", "if", "arg_0", ".", "_minor", ":", "arg_0", ".", "_minor", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Invalid struct missing the minor protocol version number.\"", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "ProtocolVersion", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the data encoding the ProtocolVersion struct to a stream.\n\n        Args:\n            output_stream (stream): A data stream in which to encode object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is not defined.\n        \"\"\"\n        arg_6 = utils.BytearrayStream()\n\n        if arg_0._major:\n            arg_0._major.Func(arg_6, arg_2=arg_2)\n        else:\n            raise ValueError(\n                \"Invalid struct missing the major protocol version number.\"\n            )\n\n        if arg_0._minor:\n            arg_0._minor.Func(arg_6, arg_2=arg_2)\n        else:\n            raise ValueError(\n                \"Invalid struct missing the minor protocol version number.\"\n            )\n\n        arg_0.length = arg_6.length()\n        super(ProtocolVersion, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/messages/contents.py", "identifier": "ProtocolVersion.write", "docstring": "Write the data encoding the ProtocolVersion struct to a stream.\n\n        Args:\n            output_stream (stream): A data stream in which to encode object\n                data, supporting a write method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is not defined.", "docstring_tokens": ["Write", "the", "data", "encoding", "the", "ProtocolVersion", "struct", "to", "a", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 252051}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/reports_handler_mix_in.py#L70-L79", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "add some stats entries to the statistic dictionary\n        raise an AssertionError if there is a key conflict", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return self.stats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_2", "[", "-", "1", "]", "==", "\"_\"", ":", "arg_2", "=", "arg_2", "[", ":", "-", "1", "]", "assert", "arg_2", "not", "in", "arg_0", ".", "stats", "arg_0", ".", "stats", "[", "arg_2", "]", "=", "arg_3", "return", "arg_0", ".", "stats"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"add some stats entries to the statistic dictionary\n        raise an AssertionError if there is a key conflict\n        \"\"\"\n        for arg_2, arg_3 in arg_1.items():\n            if arg_2[-1] == \"_\":\n                arg_2 = arg_2[:-1]\n            assert arg_2 not in arg_0.stats\n            arg_0.stats[arg_2] = arg_3\n        return arg_0.stats", "path": "pylint/reporters/reports_handler_mix_in.py", "identifier": "ReportsHandlerMixIn.add_stats", "docstring": "add some stats entries to the statistic dictionary\n        raise an AssertionError if there is a key conflict", "docstring_tokens": ["add", "some", "stats", "entries", "to", "the", "statistic", "dictionary", "raise", "an", "AssertionError", "if", "there", "is", "a", "key", "conflict"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252052}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/triple.py#L125-L193", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''This function handles the retrieval of a chemical's triple pressure.\n    Lookup is based on CASRNs. Will automatically select a data source to use\n    if no Method is provided; returns None if the data is not available.", "language": "python", "parameters": "(CASRN, AvailableMethods=False, Method=None)", "return_statement": "return Pt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "def", "list_methods", "(", ")", ":", "arg_3", "=", "[", "]", "if", "arg_0", "in", "Staveley_data", ".", "index", "and", "not", "np", ".", "isnan", "(", "Staveley_data", ".", "at", "[", "arg_0", ",", "'Pt'", "]", ")", ":", "arg_3", ".", "append", "(", "STAVELEY", ")", "if", "Tt", "(", "arg_0", ")", "and", "VaporPressure", "(", "arg_0", "=", "arg_0", ")", ".", "T_dependent_property", "(", "T", "=", "Tt", "(", "arg_0", ")", ")", ":", "arg_3", ".", "append", "(", "DEFINITION", ")", "arg_3", ".", "append", "(", "NONE", ")", "return", "arg_3", "if", "arg_1", ":", "return", "list_methods", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_2", "==", "STAVELEY", ":", "Func", "=", "Staveley_data", ".", "at", "[", "arg_0", ",", "'Pt'", "]", "elif", "arg_2", "==", "DEFINITION", ":", "Func", "=", "VaporPressure", "(", "arg_0", "=", "arg_0", ")", ".", "T_dependent_property", "(", "T", "=", "Tt", "(", "arg_0", ")", ")", "elif", "arg_2", "==", "NONE", ":", "Func", "=", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")", "return", "Func"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n    r'''This function handles the retrieval of a chemical's triple pressure.\n    Lookup is based on CASRNs. Will automatically select a data source to use\n    if no Method is provided; returns None if the data is not available.\n\n    Returns data from [1]_, or attempts to calculate the vapor pressure at the\n    triple temperature, if data is available.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    Pt : float\n        Triple point pressure, [Pa]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain Pt with the\n        given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        Pt_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        the Pt for the desired chemical, and will return methods\n        instead of the Pt\n\n    Notes\n    -----\n\n    Examples\n    --------\n    Ammonia\n\n    >>> Pt('7664-41-7')\n    6079.5\n\n    References\n    ----------\n    .. [1] Staveley, L. A. K., L. Q. Lobo, and J. C. G. Calado. \"Triple-Points\n       of Low Melting Substances and Their Use in Cryogenic Work.\" Cryogenics\n       21, no. 3 (March 1981): 131-144. doi:10.1016/0011-2275(81)90264-2.\n    '''\n    def list_methods():\n        arg_3 = []\n        if arg_0 in Staveley_data.index and not np.isnan(Staveley_data.at[arg_0, 'Pt']):\n            arg_3.append(STAVELEY)\n        if Tt(arg_0) and VaporPressure(arg_0=arg_0).T_dependent_property(T=Tt(arg_0)):\n            arg_3.append(DEFINITION)\n        arg_3.append(NONE)\n        return arg_3\n    if arg_1:\n        return list_methods()\n    if not arg_2:\n        arg_2 = list_methods()[0]\n\n    if arg_2 == STAVELEY:\n        Func = Staveley_data.at[arg_0, 'Pt']\n    elif arg_2 == DEFINITION:\n        Func = VaporPressure(arg_0=arg_0).T_dependent_property(T=Tt(arg_0))\n    elif arg_2 == NONE:\n        Func = None\n    else:\n        raise Exception('Failure in in function')\n    return Func", "path": "thermo/triple.py", "identifier": "Pt", "docstring": "r'''This function handles the retrieval of a chemical's triple pressure.\n    Lookup is based on CASRNs. Will automatically select a data source to use\n    if no Method is provided; returns None if the data is not available.\n\n    Returns data from [1]_, or attempts to calculate the vapor pressure at the\n    triple temperature, if data is available.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    Pt : float\n        Triple point pressure, [Pa]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain Pt with the\n        given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        Pt_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        the Pt for the desired chemical, and will return methods\n        instead of the Pt\n\n    Notes\n    -----\n\n    Examples\n    --------\n    Ammonia\n\n    >>> Pt('7664-41-7')\n    6079.5\n\n    References\n    ----------\n    .. [1] Staveley, L. A. K., L. Q. Lobo, and J. C. G. Calado. \"Triple-Points\n       of Low Melting Substances and Their Use in Cryogenic Work.\" Cryogenics\n       21, no. 3 (March 1981): 131-144. doi:10.1016/0011-2275(81)90264-2.", "docstring_tokens": ["r", "This", "function", "handles", "the", "retrieval", "of", "a", "chemical", "s", "triple", "pressure", ".", "Lookup", "is", "based", "on", "CASRNs", ".", "Will", "automatically", "select", "a", "data", "source", "to", "use", "if", "no", "Method", "is", "provided", ";", "returns", "None", "if", "the", "data", "is", "not", "available", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 252053}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/window.py#L106-L118", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Resizes the window to the given dimensions.", "language": "python", "parameters": "(self, width, height)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "driver", ".", "resize_window_to", "(", "arg_0", ".", "handle", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Resizes the window to the given dimensions.\n\n        If this method was called for a window that is not current, then after calling this method\n        the current window should remain the same as it was before calling this method.\n\n        Args:\n            width (int): The new window width in pixels.\n            height (int): The new window height in pixels.\n        \"\"\"\n\n        arg_0.driver.resize_window_to(arg_0.handle, arg_1, arg_2)", "path": "capybara/window.py", "identifier": "Window.resize_to", "docstring": "Resizes the window to the given dimensions.\n\n        If this method was called for a window that is not current, then after calling this method\n        the current window should remain the same as it was before calling this method.\n\n        Args:\n            width (int): The new window width in pixels.\n            height (int): The new window height in pixels.", "docstring_tokens": ["Resizes", "the", "window", "to", "the", "given", "dimensions", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 252054}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/filter.py#L27-L56", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Formats the output of another tool in the given way.\n        Has default styles for ranges, hosts and services.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Formats a json object in a certain way. Use with pipes.'", ")", "arg_0", ".", "add_argument", "(", "'Func'", ",", "metavar", "=", "'Func'", ",", "help", "=", "'How to Func the json for example \"{address}:{port}\".'", ",", "nargs", "=", "'?'", ")", "arg_1", "=", "arg_0", ".", "parse_args", "(", ")", "arg_2", "=", "\"{address:15} {port:7} {protocol:5} {service:15} {state:10} {banner} {tags}\"", "arg_3", "=", "\"{address:15} {tags}\"", "arg_4", "=", "\"{range:18} {tags}\"", "arg_5", "=", "\"{username}\"", "if", "arg_1", ".", "Func", ":", "Func_input", "(", "arg_1", ".", "Func", ")", "else", ":", "arg_6", "=", "DocMapper", "(", ")", "if", "arg_6", ".", "is_pipe", ":", "for", "arg_7", "in", "arg_6", ".", "get_pipe", "(", ")", ":", "arg_8", "=", "''", "if", "isinstance", "(", "arg_7", ",", "Range", ")", ":", "arg_8", "=", "arg_4", "elif", "isinstance", "(", "arg_7", ",", "Host", ")", ":", "arg_8", "=", "arg_3", "elif", "isinstance", "(", "arg_7", ",", "Service", ")", ":", "arg_8", "=", "arg_2", "elif", "isinstance", "(", "arg_7", ",", "User", ")", ":", "arg_8", "=", "arg_5", "print_line", "(", "fmt", ".", "Func", "(", "arg_8", ",", "**", "arg_7", ".", "to_dict", "(", "include_meta", "=", "True", ")", ")", ")", "else", ":", "print_error", "(", "\"Please use this script with pipes\"", ")"], "function": "def Func():\n    \"\"\"\n        Formats the output of another tool in the given way.\n        Has default styles for ranges, hosts and services.\n    \"\"\"\n    arg_0 = argparse.ArgumentParser(description='Formats a json object in a certain way. Use with pipes.')\n    arg_0.add_argument('Func', metavar='Func', help='How to Func the json for example \"{address}:{port}\".', nargs='?')\n    arg_1 = arg_0.parse_args()\n    arg_2 = \"{address:15} {port:7} {protocol:5} {service:15} {state:10} {banner} {tags}\"\n    arg_3 = \"{address:15} {tags}\"\n    arg_4 = \"{range:18} {tags}\"\n    arg_5 = \"{username}\"\n    if arg_1.Func:\n        Func_input(arg_1.Func)\n    else:\n        arg_6 = DocMapper()\n        if arg_6.is_pipe:\n            for arg_7 in arg_6.get_pipe():\n                arg_8 = ''\n                if isinstance(arg_7, Range):\n                    arg_8 = arg_4\n                elif isinstance(arg_7, Host):\n                    arg_8 = arg_3\n                elif isinstance(arg_7, Service):\n                    arg_8 = arg_2\n                elif isinstance(arg_7, User):\n                    arg_8 = arg_5\n                print_line(fmt.Func(arg_8, **arg_7.to_dict(include_meta=True)))\n        else:\n            print_error(\"Please use this script with pipes\")", "path": "jackal/scripts/filter.py", "identifier": "format", "docstring": "Formats the output of another tool in the given way.\n        Has default styles for ranges, hosts and services.", "docstring_tokens": ["Formats", "the", "output", "of", "another", "tool", "in", "the", "given", "way", ".", "Has", "default", "styles", "for", "ranges", "hosts", "and", "services", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 252055}
{"url": "https://github.com/jshiv/turntable/blob/c095a93df14d672ba54db164a7ab7373444d1829/turntable/spin.py#L188-L223", "sha": "c095a93df14d672ba54db164a7ab7373444d1829", "docstring_summary": "sets up the threadpool with map for parallel processing", "language": "python", "parameters": "(function, sequence, cores=None, runSeries=False, quiet=False)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "if", "arg_2", "is", "None", ":", "arg_5", "=", "ThreadPool", "(", ")", "else", ":", "arg_5", "=", "ThreadPool", "(", "arg_2", ")", "arg_6", "=", "time", ".", "time", "(", ")", "if", "arg_3", "is", "False", ":", "try", ":", "arg_7", "=", "arg_5", ".", "map", "(", "arg_0", ",", "arg_1", ")", "arg_5", ".", "close", "(", ")", "arg_5", ".", "join", "(", ")", "except", ":", "print", "'Func Failed... running in series :-('", "arg_7", "=", "series", "(", "arg_1", ",", "arg_0", ")", "else", ":", "arg_7", "=", "series", "(", "arg_1", ",", "arg_0", ")", "arg_8", "=", "time", ".", "time", "(", ")", "arg_9", "=", "arg_8", "-", "arg_6", "if", "arg_4", "is", "False", ":", "if", "arg_2", "is", "None", ":", "print", "\"Elapsed time: %s  :-)\\n\"", "%", "str", "(", "arg_9", ")", "else", ":", "print", "\"Elapsed time: %s  on %s Funcs :-)\\n\"", "%", "(", "str", "(", "arg_9", ")", ",", "str", "(", "arg_2", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False, arg_4=False):\n    '''sets up the Funcpool with map for parallel processing'''\n\n    # Make the Pool of workes\n    if arg_2 is None:\n        arg_5 = ThreadPool()\n    else:\n        arg_5 = ThreadPool(arg_2)\n\n    # Operate on the list of subjects with the requested function\n    # in the split Funcs\n    arg_6 = time.time()\n    if arg_3 is False:\n        try:\n            arg_7 = arg_5.map(arg_0, arg_1)\n            # close the pool and wiat for teh work to finish\n            arg_5.close()\n            arg_5.join()\n        except:\n            print 'Func Failed... running in series :-('\n            arg_7 = series(arg_1, arg_0)\n    else:\n        arg_7 = series(arg_1, arg_0)\n    arg_8 = time.time()\n    arg_9 = arg_8 - arg_6\n\n    if arg_4 is False:\n        if arg_2 is None:\n            print \"Elapsed time: %s  :-)\\n\" % str(arg_9)\n        else:\n            print \"Elapsed time: %s  on %s Funcs :-)\\n\" % (str(arg_9), str(arg_2))\n    # Noes:\n    # import functools\n    # abc = map(functools.partial(sb.dist, distName = 'weibull'), wbldfList)\n\n    return arg_7", "path": "turntable/spin.py", "identifier": "thread", "docstring": "sets up the threadpool with map for parallel processing", "docstring_tokens": ["sets", "up", "the", "threadpool", "with", "map", "for", "parallel", "processing"], "nwo": "jshiv/turntable", "score": 0.0, "idx": 252056}
{"url": "https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/request.py#L85-L126", "sha": "2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa", "docstring_summary": "Fetch all the information by using aiohttp", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", "->", "Response", ":", "if", "arg_0", ".", "request_config", ".", "get", "(", "'DELAY'", ",", "0", ")", ">", "0", ":", "await", "asyncio", ".", "sleep", "(", "arg_0", ".", "request_config", "[", "'DELAY'", "]", ")", "arg_1", "=", "arg_0", ".", "request_config", ".", "get", "(", "'TIMEOUT'", ",", "10", ")", "try", ":", "async", "with", "async_timeout", ".", "timeout", "(", "arg_1", ")", ":", "arg_2", "=", "await", "arg_0", ".", "_make_request", "(", ")", "try", ":", "arg_3", "=", "await", "arg_2", ".", "text", "(", "encoding", "=", "arg_0", ".", "encoding", ")", "except", "UnicodeDecodeError", ":", "arg_3", "=", "await", "arg_2", ".", "read", "(", ")", "arg_4", "=", "Response", "(", "url", "=", "arg_0", ".", "url", ",", "method", "=", "arg_0", ".", "method", ",", "encoding", "=", "arg_2", ".", "get_encoding", "(", ")", ",", "html", "=", "arg_3", ",", "metadata", "=", "arg_0", ".", "metadata", ",", "cookies", "=", "arg_2", ".", "cookies", ",", "headers", "=", "arg_2", ".", "headers", ",", "history", "=", "arg_2", ".", "history", ",", "status", "=", "arg_2", ".", "status", ",", "aws_json", "=", "arg_2", ".", "json", ",", "aws_text", "=", "arg_2", ".", "text", ",", "aws_read", "=", "arg_2", ".", "read", ")", "arg_5", "=", "arg_0", ".", "request_config", ".", "get", "(", "'VALID'", ")", "if", "arg_5", "and", "iscoroutinefunction", "(", "arg_5", ")", ":", "arg_4", "=", "await", "arg_5", "(", "arg_4", ")", "if", "arg_4", ".", "ok", ":", "return", "arg_4", "else", ":", "return", "await", "arg_0", ".", "_retry", "(", "error_msg", "=", "'request url failed!'", ")", "except", "asyncio", ".", "TimeoutError", ":", "return", "await", "arg_0", ".", "_retry", "(", "error_msg", "=", "'timeout'", ")", "except", "Exception", "as", "e", ":", "return", "await", "arg_0", ".", "_retry", "(", "error_msg", "=", "e", ")", "finally", ":", "await", "arg_0", ".", "_close_request_session", "(", ")"], "function": "async def Func(arg_0) -> Response:\n        \"\"\"Fetch all the information by using aiohttp\"\"\"\n        if arg_0.request_config.get('DELAY', 0) > 0:\n            await asyncio.sleep(arg_0.request_config['DELAY'])\n\n        arg_1 = arg_0.request_config.get('TIMEOUT', 10)\n        try:\n            async with async_timeout.timeout(arg_1):\n                arg_2 = await arg_0._make_request()\n            try:\n                arg_3 = await arg_2.text(encoding=arg_0.encoding)\n            except UnicodeDecodeError:\n                arg_3 = await arg_2.read()\n\n            arg_4 = Response(\n                url=arg_0.url,\n                method=arg_0.method,\n                encoding=arg_2.get_encoding(),\n                html=arg_3,\n                metadata=arg_0.metadata,\n                cookies=arg_2.cookies,\n                headers=arg_2.headers,\n                history=arg_2.history,\n                status=arg_2.status,\n                aws_json=arg_2.json,\n                aws_text=arg_2.text,\n                aws_read=arg_2.read)\n            # Retry middleware\n            arg_5 = arg_0.request_config.get('VALID')\n            if arg_5 and iscoroutinefunction(arg_5):\n                arg_4 = await arg_5(arg_4)\n            if arg_4.ok:\n                return arg_4\n            else:\n                return await arg_0._retry(error_msg='request url failed!')\n        except asyncio.TimeoutError:\n            return await arg_0._retry(error_msg='timeout')\n        except Exception as e:\n            return await arg_0._retry(error_msg=e)\n        finally:\n            # Close client session\n            await arg_0._close_request_session()", "path": "ruia/request.py", "identifier": "Request.fetch", "docstring": "Fetch all the information by using aiohttp", "docstring_tokens": ["Fetch", "all", "the", "information", "by", "using", "aiohttp"], "nwo": "howie6879/ruia", "score": 0.982354439255647, "idx": 252057}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/data_provider/data_manager.py#L190-L213", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Transport the file from the local filesystem to the remote Globus endpoint.", "language": "python", "parameters": "(self, file, executor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ".", "scheme", "==", "'http'", "or", "arg_1", ".", "scheme", "==", "'https'", ":", "raise", "Exception", "(", "'HTTP/HTTPS file staging out is not supported'", ")", "elif", "arg_1", ".", "scheme", "==", "'ftp'", ":", "raise", "Exception", "(", "'FTP file staging out is not supported'", ")", "elif", "arg_1", ".", "scheme", "==", "'globus'", ":", "arg_3", "=", "arg_0", ".", "_get_globus_endpoint", "(", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_globus_Func_app", "(", ")", "return", "arg_4", "(", "arg_3", ",", "inputs", "=", "[", "arg_1", "]", ")", "else", ":", "raise", "Exception", "(", "'Staging out with unknown file scheme {} is not supported'", ".", "format", "(", "arg_1", ".", "scheme", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Transport the file from the local filesystem to the remote Globus endpoint.\n\n        This function returns a DataFuture.\n\n        Args:\n            - self\n            - file (File) - file to stage out\n            - executor (str) - Which executor the file is going to be staged out from.\n                                If the executor argument is not specified for a file\n                                with the 'globus' scheme, the file will be staged in to\n                                the first executor with the \"globus\" key in a config.\n        \"\"\"\n\n        if arg_1.scheme == 'http' or arg_1.scheme == 'https':\n            raise Exception('HTTP/HTTPS file staging out is not supported')\n        elif arg_1.scheme == 'ftp':\n            raise Exception('FTP file staging out is not supported')\n        elif arg_1.scheme == 'globus':\n            arg_3 = arg_0._get_globus_endpoint(arg_2)\n            arg_4 = arg_0._globus_Func_app()\n            return arg_4(arg_3, inputs=[arg_1])\n        else:\n            raise Exception('Staging out with unknown file scheme {} is not supported'.format(arg_1.scheme))", "path": "parsl/data_provider/data_manager.py", "identifier": "DataManager.stage_out", "docstring": "Transport the file from the local filesystem to the remote Globus endpoint.\n\n        This function returns a DataFuture.\n\n        Args:\n            - self\n            - file (File) - file to stage out\n            - executor (str) - Which executor the file is going to be staged out from.\n                                If the executor argument is not specified for a file\n                                with the 'globus' scheme, the file will be staged in to\n                                the first executor with the \"globus\" key in a config.", "docstring_tokens": ["Transport", "the", "file", "from", "the", "local", "filesystem", "to", "the", "remote", "Globus", "endpoint", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 252058}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L779-L785", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return a dictionary of environment variables for the container.", "language": "python", "parameters": "(self, inputs, outputs, mounts)", "return_statement": "return env", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "}", "arg_4", ".", "update", "(", "providers_util", ".", "get_file_environment_variables", "(", "arg_1", ")", ")", "arg_4", ".", "update", "(", "providers_util", ".", "get_file_environment_variables", "(", "arg_2", ")", ")", "arg_4", ".", "update", "(", "providers_util", ".", "get_file_environment_variables", "(", "arg_3", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Return a dictionary of environment variables for the container.\"\"\"\n    arg_4 = {}\n    arg_4.update(providers_util.get_file_environment_variables(arg_1))\n    arg_4.update(providers_util.get_file_environment_variables(arg_2))\n    arg_4.update(providers_util.get_file_environment_variables(arg_3))\n    return arg_4", "path": "dsub/providers/local.py", "identifier": "LocalJobProvider._make_environment", "docstring": "Return a dictionary of environment variables for the container.", "docstring_tokens": ["Return", "a", "dictionary", "of", "environment", "variables", "for", "the", "container", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 252059}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L2070-L2105", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Strip water and fit to the remaining system.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return transformer_nowater.fit(**kw_fit)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_1", ".", "setdefault", "(", "'fit'", ",", "'rot+trans'", ")", "arg_2", "=", "{", "}", "for", "arg_3", "in", "(", "'xy'", ",", "'fit'", ",", "'fitgroup'", ",", "'input'", ")", ":", "if", "arg_3", "in", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "arg_1", ".", "pop", "(", "arg_3", ")", "arg_1", "[", "'input'", "]", "=", "arg_1", ".", "pop", "(", "'strip_input'", ",", "[", "'Protein'", "]", ")", "arg_1", "[", "'force'", "]", "=", "arg_2", "[", "'force'", "]", "=", "arg_1", ".", "pop", "(", "'force'", ",", "arg_0", ".", "force", ")", "arg_4", "=", "arg_0", ".", "strip_water", "(", "**", "arg_1", ")", "arg_5", "=", "arg_0", ".", "nowater", "[", "arg_4", "[", "'xtc'", "]", "]", "return", "arg_5", ".", "fit", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Strip water and fit to the remaining system.\n\n        First runs :meth:`strip_water` and then :meth:`fit`; see there\n        for arguments.\n\n        - *strip_input* is used for :meth:`strip_water` (but is only useful in\n          special cases, e.g. when there is no Protein group defined. Then set\n          *strip_input* = ``['Other']``.\n\n        - *input* is passed on to :meth:`fit` and can contain the\n          ``[center_group, fit_group, output_group]``\n\n        - *fitgroup* is only passed to :meth:`fit` and just contains\n          the group to fit to (\"backbone\" by default)\n\n          .. warning:: *fitgroup* can only be a Gromacs default group and not\n                       a custom group (because the indices change after stripping)\n\n        - By default *fit* = \"rot+trans\" (and *fit* is passed to :meth:`fit`,\n          together with the *xy* = ``False`` keyword)\n\n        .. Note:: The call signature of :meth:`strip_water` is somewhat different from this one.\n        \"\"\"\n        arg_1.setdefault('fit', 'rot+trans')\n        arg_2 = {}\n        for arg_3 in ('xy', 'fit', 'fitgroup', 'input'):\n            if arg_3 in arg_1:\n                arg_2[arg_3] = arg_1.pop(arg_3)\n\n        arg_1['input'] = arg_1.pop('strip_input', ['Protein'])\n        arg_1['force'] = arg_2['force'] = arg_1.pop('force', arg_0.force)\n\n        arg_4 = arg_0.strip_water(**arg_1)    # updates self.nowater\n        arg_5 = arg_0.nowater[arg_4['xtc']]  # make sure to get the one we just produced\n        return arg_5.fit(**arg_2)", "path": "gromacs/cbook.py", "identifier": "Transformer.strip_fit", "docstring": "Strip water and fit to the remaining system.\n\n        First runs :meth:`strip_water` and then :meth:`fit`; see there\n        for arguments.\n\n        - *strip_input* is used for :meth:`strip_water` (but is only useful in\n          special cases, e.g. when there is no Protein group defined. Then set\n          *strip_input* = ``['Other']``.\n\n        - *input* is passed on to :meth:`fit` and can contain the\n          ``[center_group, fit_group, output_group]``\n\n        - *fitgroup* is only passed to :meth:`fit` and just contains\n          the group to fit to (\"backbone\" by default)\n\n          .. warning:: *fitgroup* can only be a Gromacs default group and not\n                       a custom group (because the indices change after stripping)\n\n        - By default *fit* = \"rot+trans\" (and *fit* is passed to :meth:`fit`,\n          together with the *xy* = ``False`` keyword)\n\n        .. Note:: The call signature of :meth:`strip_water` is somewhat different from this one.", "docstring_tokens": ["Strip", "water", "and", "fit", "to", "the", "remaining", "system", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 252060}
{"url": "https://github.com/messense/sanic-gunicorn/blob/da1e738d9ff4bb064ca477f9aeb37e12f31be243/sanic_gunicorn.py#L108-L152", "sha": "da1e738d9ff4bb064ca477f9aeb37e12f31be243", "docstring_summary": "Start asynchronous HTTP Server on an individual process.", "language": "python", "parameters": "(self, sock, request_handler, error_handler, debug=False,\n              request_timeout=60, ssl=None, request_max_size=None,\n              reuse_port=False, loop=None, protocol=HttpProtocol,\n              backlog=100, **kwargs)", "return_statement": "return server_coroutine", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ",", "arg_5", "=", "60", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "False", ",", "arg_9", "=", "None", ",", "arg_10", "=", "arg_11", ",", "arg_12", "=", "100", ",", "**", "arg_13", ")", ":", "if", "arg_4", ":", "arg_9", ".", "set_debug", "(", "arg_4", ")", "arg_14", "=", "partial", "(", "arg_10", ",", "arg_9", "=", "arg_9", ",", "connections", "=", "arg_0", ".", "connections", ",", "signal", "=", "arg_0", ".", "signal", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", ")", "arg_15", "=", "arg_9", ".", "create_Funcr", "(", "arg_14", ",", "host", "=", "None", ",", "port", "=", "None", ",", "arg_6", "=", "arg_6", ",", "arg_8", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", "arg_12", "=", "arg_12", ")", "arg_9", ".", "call_soon", "(", "partial", "(", "update_current_time", ",", "arg_9", ")", ")", "return", "arg_15"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False,\n              arg_5=60, arg_6=None, arg_7=None,\n              arg_8=False, arg_9=None, arg_10=arg_11,\n              arg_12=100, **arg_13):\n        \"\"\"Start asynchronous HTTP Server on an individual process.\n\n        :param request_handler: Sanic request handler with middleware\n        :param error_handler: Sanic error handler with middleware\n        :param debug: enables debug output (slows Funcr)\n        :param request_timeout: time in seconds\n        :param ssl: SSLContext\n        :param sock: Socket for the Funcr to accept connections from\n        :param request_max_size: size in bytes, `None` for no limit\n        :param reuse_port: `True` for multiple workers\n        :param loop: asyncio compatible event loop\n        :param protocol: subclass of asyncio protocol class\n        :return: Nothing\n        \"\"\"\n        if arg_4:\n            arg_9.set_debug(arg_4)\n\n        arg_14 = partial(\n            arg_10,\n            arg_9=arg_9,\n            connections=arg_0.connections,\n            signal=arg_0.signal,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_5=arg_5,\n            arg_7=arg_7,\n        )\n\n        arg_15 = arg_9.create_Funcr(\n            arg_14,\n            host=None,\n            port=None,\n            arg_6=arg_6,\n            arg_8=arg_8,\n            arg_1=arg_1,\n            arg_12=arg_12\n        )\n        # Instead of pulling time at the end of every request,\n        # pull it once per minute\n        arg_9.call_soon(partial(update_current_time, arg_9))\n        return arg_15", "path": "sanic_gunicorn.py", "identifier": "Worker.serve", "docstring": "Start asynchronous HTTP Server on an individual process.\n\n        :param request_handler: Sanic request handler with middleware\n        :param error_handler: Sanic error handler with middleware\n        :param debug: enables debug output (slows server)\n        :param request_timeout: time in seconds\n        :param ssl: SSLContext\n        :param sock: Socket for the server to accept connections from\n        :param request_max_size: size in bytes, `None` for no limit\n        :param reuse_port: `True` for multiple workers\n        :param loop: asyncio compatible event loop\n        :param protocol: subclass of asyncio protocol class\n        :return: Nothing", "docstring_tokens": ["Start", "asynchronous", "HTTP", "Server", "on", "an", "individual", "process", "."], "nwo": "messense/sanic-gunicorn", "score": 0.19277109958768027, "idx": 252061}
{"url": "https://github.com/klen/muffin-peewee/blob/8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e/muffin_peewee/fields.py#L46-L50", "sha": "8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e", "docstring_summary": "Parse value from database.", "language": "python", "parameters": "(self, value)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "field_type", "==", "'TEXT'", "and", "isinstance", "(", "arg_1", ",", "str", ")", ":", "return", "arg_0", ".", "loads", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parse value from database.\"\"\"\n        if arg_0.field_type == 'TEXT' and isinstance(arg_1, str):\n            return arg_0.loads(arg_1)\n        return arg_1", "path": "muffin_peewee/fields.py", "identifier": "JSONField.python_value", "docstring": "Parse value from database.", "docstring_tokens": ["Parse", "value", "from", "database", "."], "nwo": "klen/muffin-peewee", "score": 0.16638194949711382, "idx": 252062}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L540-L549", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Update metadata host information", "language": "python", "parameters": "(repo)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "\"Added platform information\"", ")", "arg_1", "=", "arg_0", ".", "package", "arg_2", "=", "plugins_get_mgr", "(", ")", "arg_3", "=", "arg_2", ".", "get", "(", "what", "=", "'instrumentation'", ",", "name", "=", "'platform'", ")", "arg_1", "[", "'platform'", "]", "=", "arg_3", ".", "get_metadata", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Update metadata host information\n    \"\"\"\n\n    print(\"Added platform information\")\n    arg_1 = arg_0.package\n    arg_2 = plugins_get_mgr()\n    arg_3 = arg_2.get(what='instrumentation', name='platform')\n    arg_1['platform'] = arg_3.get_metadata()", "path": "dgitcore/datasets/common.py", "identifier": "annotate_metadata_platform", "docstring": "Update metadata host information", "docstring_tokens": ["Update", "metadata", "host", "information"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 252063}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/timeslots.py#L59-L70", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Check if self has overlap with `interval`.", "language": "python", "parameters": "(self, interval: 'Interval')", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "'Interval'", ")", "->", "bool", ":", "if", "arg_0", ".", "begin", "<", "arg_1", ".", "end", "and", "arg_1", ".", "begin", "<", "arg_0", ".", "end", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1: 'Interval') -> bool:\n        \"\"\"Check if self has overlap with `interval`.\n\n        Args:\n            interval: interval to be examined\n\n        Returns:\n            bool: True if self has overlap with `interval` otherwise False\n        \"\"\"\n        if arg_0.begin < arg_1.end and arg_1.begin < arg_0.end:\n            return True\n        return False", "path": "qiskit/pulse/timeslots.py", "identifier": "Interval.has_overlap", "docstring": "Check if self has overlap with `interval`.\n\n        Args:\n            interval: interval to be examined\n\n        Returns:\n            bool: True if self has overlap with `interval` otherwise False", "docstring_tokens": ["Check", "if", "self", "has", "overlap", "with", "interval", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252064}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completer.py#L306-L324", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Compute matches when text is a simple name.", "language": "python", "parameters": "(self, text)", "return_statement": "return matches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_2", ".", "append", "arg_4", "=", "len", "(", "arg_1", ")", "for", "arg_5", "in", "[", "keyword", ".", "kwlist", ",", "__builtin__", ".", "__dict__", ".", "keys", "(", ")", ",", "arg_0", ".", "namespace", ".", "keys", "(", ")", ",", "arg_0", ".", "global_namespace", ".", "keys", "(", ")", "]", ":", "for", "arg_6", "in", "arg_5", ":", "if", "arg_6", "[", ":", "arg_4", "]", "==", "arg_1", "and", "arg_6", "!=", "\"__builtins__\"", ":", "arg_3", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Compute matches when text is a simple name.\n\n        Return a list of all keywords, built-in functions and names currently\n        defined in self.namespace or self.global_namespace that match.\n\n        \"\"\"\n        #print 'Completer->Func, txt=%r' % text # dbg\n        arg_2 = []\n        arg_3 = arg_2.append\n        arg_4 = len(arg_1)\n        for arg_5 in [keyword.kwlist,\n                    __builtin__.__dict__.keys(),\n                    arg_0.namespace.keys(),\n                    arg_0.global_namespace.keys()]:\n            for arg_6 in arg_5:\n                if arg_6[:arg_4] == arg_1 and arg_6 != \"__builtins__\":\n                    arg_3(arg_6)\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/completer.py", "identifier": "Completer.global_matches", "docstring": "Compute matches when text is a simple name.\n\n        Return a list of all keywords, built-in functions and names currently\n        defined in self.namespace or self.global_namespace that match.", "docstring_tokens": ["Compute", "matches", "when", "text", "is", "a", "simple", "name", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252065}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/cart.py#L352-L403", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Determines whether the status of the current cart is valid;\n        this is normally called before generating or paying an invoice", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "cart", "arg_2", "=", "arg_0", ".", "cart", ".", "user", "arg_3", "=", "[", "]", "try", ":", "arg_0", ".", "_test_vouchers", "(", "arg_0", ".", "cart", ".", "vouchers", ".", "all", "(", ")", ")", "except", "ValidationError", "as", "ve", ":", "arg_3", ".", "append", "(", "ve", ")", "arg_4", "=", "commerce", ".", "ProductItem", ".", "objects", ".", "filter", "(", "arg_1", "=", "arg_1", ")", "arg_4", "=", "arg_4", ".", "select_related", "(", "\"product\"", ",", "\"product__category\"", ")", "arg_5", "=", "list", "(", "(", "i", ".", "product", ",", "i", ".", "quantity", ")", "for", "i", "in", "arg_4", ")", "try", ":", "arg_0", ".", "_test_limits", "(", "arg_5", ")", "except", "ValidationError", "as", "ve", ":", "arg_0", ".", "_append_errors", "(", "arg_3", ",", "ve", ")", "try", ":", "arg_0", ".", "_test_required_categories", "(", ")", "except", "ValidationError", "as", "ve", ":", "arg_0", ".", "_append_errors", "(", "arg_3", ",", "ve", ")", "arg_6", "=", "[", "i", ".", "product", "for", "i", "in", "arg_4", "]", "arg_7", "=", "DiscountController", ".", "available_discounts", "(", "arg_2", ",", "[", "]", ",", "arg_6", ",", ")", "arg_8", "=", "set", "(", "i", ".", "discount", ".", "id", "for", "i", "in", "arg_7", ")", "arg_9", "=", "commerce", ".", "DiscountItem", ".", "objects", ".", "filter", "(", "arg_1", "=", "arg_1", ")", "for", "arg_10", "in", "arg_9", ":", "arg_11", "=", "arg_10", ".", "discount", "if", "arg_11", ".", "id", "not", "in", "arg_8", ":", "arg_3", ".", "append", "(", "ValidationError", "(", "\"Discounts are no longer available\"", ")", ")", "if", "arg_3", ":", "raise", "ValidationError", "(", "arg_3", ")"], "function": "def Func(arg_0):\n        ''' Determines whether the status of the current cart is valid;\n        this is normally called before generating or paying an invoice '''\n\n        arg_1 = arg_0.cart\n        arg_2 = arg_0.cart.user\n        arg_3 = []\n\n        try:\n            arg_0._test_vouchers(arg_0.cart.vouchers.all())\n        except ValidationError as ve:\n            arg_3.append(ve)\n\n        arg_4 = commerce.ProductItem.objects.filter(arg_1=arg_1)\n        arg_4 = arg_4.select_related(\"product\", \"product__category\")\n\n        arg_5 = list((i.product, i.quantity) for i in arg_4)\n        try:\n            arg_0._test_limits(arg_5)\n        except ValidationError as ve:\n            arg_0._append_errors(arg_3, ve)\n\n        try:\n            arg_0._test_required_categories()\n        except ValidationError as ve:\n            arg_0._append_errors(arg_3, ve)\n\n        # Validate the discounts\n        # TODO: refactor in terms of available_discounts\n        # why aren't we doing that here?!\n\n        #     def available_discounts(cls, user, categories, products):\n\n        arg_6 = [i.product for i in arg_4]\n        arg_7 = DiscountController.available_discounts(\n            arg_2,\n            [],\n            arg_6,\n        )\n        arg_8 = set(i.discount.id for i in arg_7)\n\n        arg_9 = commerce.DiscountItem.objects.filter(arg_1=arg_1)\n        for arg_10 in arg_9:\n            arg_11 = arg_10.discount\n\n            if arg_11.id not in arg_8:\n                arg_3.append(\n                    ValidationError(\"Discounts are no longer available\")\n                )\n\n        if arg_3:\n            raise ValidationError(arg_3)", "path": "registrasion/controllers/cart.py", "identifier": "CartController.validate_cart", "docstring": "Determines whether the status of the current cart is valid;\n        this is normally called before generating or paying an invoice", "docstring_tokens": ["Determines", "whether", "the", "status", "of", "the", "current", "cart", "is", "valid", ";", "this", "is", "normally", "called", "before", "generating", "or", "paying", "an", "invoice"], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 252066}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/medium/minimal_medium.py#L17-L38", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Add a linear version of a minimal medium to the model solver.", "language": "python", "parameters": "(model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "find_boundary_types", "(", "arg_0", ",", "\"exchange\"", ")", ":", "arg_3", "=", "len", "(", "arg_2", ".", "reactants", ")", "==", "1", "if", "arg_3", ":", "arg_1", "[", "arg_2", ".", "reverse_variable", "]", "=", "1", "else", ":", "arg_1", "[", "arg_2", ".", "forward_variable", "]", "=", "1", "arg_0", ".", "objective", ".", "set_linear_coefficients", "(", "arg_1", ")", "arg_0", ".", "objective", ".", "direction", "=", "\"min\""], "function": "def Func(arg_0):\n    \"\"\"Add a linear version of a minimal medium to the model solver.\n\n    Changes the optimization objective to finding the growth medium requiring\n    the smallest total import flux::\n\n        minimize sum |r_i| for r_i in import_reactions\n\n    Arguments\n    ---------\n    model : cobra.Model\n        The model to modify.\n    \"\"\"\n    arg_1 = {}\n    for arg_2 in find_boundary_types(arg_0, \"exchange\"):\n        arg_3 = len(arg_2.reactants) == 1\n        if arg_3:\n            arg_1[arg_2.reverse_variable] = 1\n        else:\n            arg_1[arg_2.forward_variable] = 1\n    arg_0.objective.set_linear_coefficients(arg_1)\n    arg_0.objective.direction = \"min\"", "path": "cobra/medium/minimal_medium.py", "identifier": "add_linear_obj", "docstring": "Add a linear version of a minimal medium to the model solver.\n\n    Changes the optimization objective to finding the growth medium requiring\n    the smallest total import flux::\n\n        minimize sum |r_i| for r_i in import_reactions\n\n    Arguments\n    ---------\n    model : cobra.Model\n        The model to modify.", "docstring_tokens": ["Add", "a", "linear", "version", "of", "a", "minimal", "medium", "to", "the", "model", "solver", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 252067}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/memory_model.py#L575-L593", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Imports experiences into the TensorFlow memory structure. Can be used to import\n        off-policy data.", "language": "python", "parameters": "(self, states, internals, actions, terminal, reward)", "return_statement": "return self.memory.store(\n            states=states,\n            internals=internals,\n            actions=actions,\n            terminal=terminal,\n            reward=reward\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "return", "arg_0", ".", "memory", ".", "store", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"\n        Imports experiences into the TensorFlow memory structure. Can be used to import\n        off-policy data.\n\n        :param states: Dict of state values to import with keys as state names and values as values to set.\n        :param internals: Internal values to set, can be fetched from agent via agent.current_internals\n            if no values available.\n        :param actions: Dict of action values to import with keys as action names and values as values to set.\n        :param terminal: Terminal value(s)\n        :param reward: Reward value(s)\n        \"\"\"\n        return arg_0.memory.store(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5\n        )", "path": "tensorforce/models/memory_model.py", "identifier": "MemoryModel.tf_import_experience", "docstring": "Imports experiences into the TensorFlow memory structure. Can be used to import\n        off-policy data.\n\n        :param states: Dict of state values to import with keys as state names and values as values to set.\n        :param internals: Internal values to set, can be fetched from agent via agent.current_internals\n            if no values available.\n        :param actions: Dict of action values to import with keys as action names and values as values to set.\n        :param terminal: Terminal value(s)\n        :param reward: Reward value(s)", "docstring_tokens": ["Imports", "experiences", "into", "the", "TensorFlow", "memory", "structure", ".", "Can", "be", "used", "to", "import", "off", "-", "policy", "data", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 252068}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L1100-L1111", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Helper to raise an AssertionError, and optionally prepend custom description.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'%s%s'", "%", "(", "'[%s] '", "%", "arg_0", ".", "description", "if", "len", "(", "arg_0", ".", "description", ")", ">", "0", "else", "''", ",", "arg_1", ")", "if", "arg_0", ".", "kind", "==", "'warn'", ":", "print", "(", "arg_2", ")", "return", "arg_0", "elif", "arg_0", ".", "kind", "==", "'soft'", ":", "global", "_softFunc", "_softFunc", ".", "append", "(", "arg_2", ")", "return", "arg_0", "else", ":", "raise", "AssertionError", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Helper to raise an AssertionError, and optionally prepend custom description.\"\"\"\n        arg_2 = '%s%s' % ('[%s] ' % arg_0.description if len(arg_0.description) > 0 else '', arg_1)\n        if arg_0.kind == 'warn':\n            print(arg_2)\n            return arg_0\n        elif arg_0.kind == 'soft':\n            global _softFunc\n            _softFunc.append(arg_2)\n            return arg_0\n        else:\n            raise AssertionError(arg_2)", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder._err", "docstring": "Helper to raise an AssertionError, and optionally prepend custom description.", "docstring_tokens": ["Helper", "to", "raise", "an", "AssertionError", "and", "optionally", "prepend", "custom", "description", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 252069}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L132-L135", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Play the queue from a specific point. Disregards tracks before the index.", "language": "python", "parameters": "(self, index: int)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "arg_0", ".", "queue", "=", "arg_0", ".", "queue", "[", "min", "(", "arg_1", ",", "len", "(", "arg_0", ".", "queue", ")", "-", "1", ")", ":", "len", "(", "arg_0", ".", "queue", ")", "]", "await", "arg_0", ".", "play", "(", "ignore_shuffle", "=", "True", ")"], "function": "async def Func(arg_0, arg_1: arg_2):\r\n        \"\"\" Play the queue from a specific point. Disregards tracks before the index. \"\"\"\r\n        arg_0.queue = arg_0.queue[min(arg_1, len(arg_0.queue) - 1):len(arg_0.queue)]\r\n        await arg_0.play(ignore_shuffle=True)", "path": "lavalink/PlayerManager.py", "identifier": "DefaultPlayer.play_at", "docstring": "Play the queue from a specific point. Disregards tracks before the index.", "docstring_tokens": ["Play", "the", "queue", "from", "a", "specific", "point", ".", "Disregards", "tracks", "before", "the", "index", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 252070}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/matchmaker.py#L61-L77", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return the available MatchMaker nodes", "language": "python", "parameters": "(mme_base_url, token)", "return_statement": "return nodes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "not", "arg_0", "or", "not", "arg_1", ":", "return", "arg_2", "arg_3", "=", "''", ".", "join", "(", "[", "arg_0", ",", "'/nodes'", "]", ")", "arg_2", "=", "matchmaker_request", "(", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", "method", "=", "'GET'", ")", "LOG", ".", "info", "(", "'Matchmaker has the following connected nodes:{}'", ".", "format", "(", "arg_2", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return the available MatchMaker nodes\n\n    Args:\n        mme_base_url(str): base URL of MME service\n        token(str): MME server authorization token\n\n    Returns:\n        nodes(list): a list of node disctionaries\n    \"\"\"\n    arg_2 = []\n    if not arg_0 or not arg_1:\n        return arg_2\n    arg_3 = ''.join([arg_0, '/nodes'])\n    arg_2 = matchmaker_request(arg_3=arg_3, arg_1=arg_1, method='GET')\n    LOG.info('Matchmaker has the following connected nodes:{}'.format(arg_2))\n    return arg_2", "path": "scout/utils/matchmaker.py", "identifier": "mme_nodes", "docstring": "Return the available MatchMaker nodes\n\n    Args:\n        mme_base_url(str): base URL of MME service\n        token(str): MME server authorization token\n\n    Returns:\n        nodes(list): a list of node disctionaries", "docstring_tokens": ["Return", "the", "available", "MatchMaker", "nodes"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252071}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L222-L231", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Retrieve an activity given its name.", "language": "python", "parameters": "(self, name)", "return_statement": "return [a for a in self.activities if a.name == name][0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "[", "arg_2", "for", "arg_2", "in", "arg_0", ".", "activities", "if", "arg_2", ".", "name", "==", "arg_1", "]", "[", "0", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retrieve an activity given its name.\n\n        :param name: The name of the activity.\n\n        :returns: The activity.\n        \"\"\"\n\n        return [arg_2 for arg_2 in arg_0.activities if arg_2.name == arg_1][0]", "path": "auxi/modelling/business/structure.py", "identifier": "Component.get_activity", "docstring": "Retrieve an activity given its name.\n\n        :param name: The name of the activity.\n\n        :returns: The activity.", "docstring_tokens": ["Retrieve", "an", "activity", "given", "its", "name", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 252072}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_common.py#L22-L31", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Calculate percentage usage of 'used' against 'total'.", "language": "python", "parameters": "(used, total, _round=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "try", ":", "arg_3", "=", "(", "arg_0", "/", "arg_1", ")", "*", "100", "except", "ZeroDivisionError", ":", "arg_3", "=", "0", "if", "arg_2", "is", "not", "None", ":", "return", "round", "(", "arg_3", ",", "arg_2", ")", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Calculate percentage usage of 'used' against 'total'.\"\"\"\n    try:\n        arg_3 = (arg_0 / arg_1) * 100\n    except ZeroDivisionError:\n        arg_3 = 0\n    if arg_2 is not None:\n        return round(arg_3, arg_2)\n    else:\n        return arg_3", "path": "environment/lib/python2.7/site-packages/psutil/_common.py", "identifier": "usage_percent", "docstring": "Calculate percentage usage of 'used' against 'total'.", "docstring_tokens": ["Calculate", "percentage", "usage", "of", "used", "against", "total", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252073}
{"url": "https://github.com/rkcosmos/deepcut/blob/9a2729071d01972af805acede85d7aa9e7a6da30/deepcut/deepcut.py#L70-L76", "sha": "9a2729071d01972af805acede85d7aa9e7a6da30", "docstring_summary": "Count the number of non-zero values for each feature in sparse X.", "language": "python", "parameters": "(X)", "return_statement": "return np.diff(sp.csc_matrix(X, copy=False).indptr)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "sp", ".", "isspmatrix_csr", "(", "arg_0", ")", ":", "return", "np", ".", "bincount", "(", "arg_0", ".", "indices", ",", "minlength", "=", "arg_0", ".", "shape", "[", "1", "]", ")", "return", "np", ".", "diff", "(", "sp", ".", "csc_matrix", "(", "arg_0", ",", "copy", "=", "False", ")", ".", "indptr", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Count the number of non-zero values for each feature in sparse X.\n    \"\"\"\n    if sp.isspmatrix_csr(arg_0):\n        return np.bincount(arg_0.indices, minlength=arg_0.shape[1])\n    return np.diff(sp.csc_matrix(arg_0, copy=False).indptr)", "path": "deepcut/deepcut.py", "identifier": "_document_frequency", "docstring": "Count the number of non-zero values for each feature in sparse X.", "docstring_tokens": ["Count", "the", "number", "of", "non", "-", "zero", "values", "for", "each", "feature", "in", "sparse", "X", "."], "nwo": "rkcosmos/deepcut", "score": 0.6555269481755696, "idx": 252074}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/hosts.py#L239-L262", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Loads a ``HostEntry`` from a boto instance.", "language": "python", "parameters": "(cls, instance)", "return_statement": "return cls(\n            name=instance.tags.get('Name'),\n            private_ip=instance.private_ip_address,\n            public_ip=instance.ip_address,\n            instance_type=instance.instance_type,\n            instance_id=instance.id,\n            hostname=instance.dns_name,\n            stack_id=instance.tags.get('aws:cloudformation:stack-id'),\n            stack_name=instance.tags.get('aws:cloudformation:stack-name'),\n            logical_id=instance.tags.get('aws:cloudformation:logical-id'),\n            security_groups=[g.name for g in instance.groups],\n            launch_time=instance.launch_time,\n            ami_id=instance.image_id,\n            tags={k.lower(): v for k, v in six.iteritems(instance.tags)}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", "(", "name", "=", "arg_1", ".", "tags", ".", "get", "(", "'Name'", ")", ",", "private_ip", "=", "arg_1", ".", "private_ip_address", ",", "public_ip", "=", "arg_1", ".", "ip_address", ",", "instance_type", "=", "arg_1", ".", "instance_type", ",", "instance_id", "=", "arg_1", ".", "id", ",", "hostname", "=", "arg_1", ".", "dns_name", ",", "stack_id", "=", "arg_1", ".", "tags", ".", "get", "(", "'aws:cloudformation:stack-id'", ")", ",", "stack_name", "=", "arg_1", ".", "tags", ".", "get", "(", "'aws:cloudformation:stack-name'", ")", ",", "logical_id", "=", "arg_1", ".", "tags", ".", "get", "(", "'aws:cloudformation:logical-id'", ")", ",", "security_groups", "=", "[", "arg_2", ".", "name", "for", "arg_2", "in", "arg_1", ".", "groups", "]", ",", "launch_time", "=", "arg_1", ".", "launch_time", ",", "ami_id", "=", "arg_1", ".", "image_id", ",", "tags", "=", "{", "arg_3", ".", "lower", "(", ")", ":", "arg_4", "for", "arg_3", ",", "arg_4", "in", "six", ".", "iteritems", "(", "arg_1", ".", "tags", ")", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Loads a ``HostEntry`` from a boto instance.\n\n        :param instance: A boto instance object.\n        :type instance: :py:class:`boto.ec2.instanceInstance`\n\n        :rtype: :py:class:`HostEntry`\n        \"\"\"\n        return arg_0(\n            name=arg_1.tags.get('Name'),\n            private_ip=arg_1.private_ip_address,\n            public_ip=arg_1.ip_address,\n            instance_type=arg_1.instance_type,\n            instance_id=arg_1.id,\n            hostname=arg_1.dns_name,\n            stack_id=arg_1.tags.get('aws:cloudformation:stack-id'),\n            stack_name=arg_1.tags.get('aws:cloudformation:stack-name'),\n            logical_id=arg_1.tags.get('aws:cloudformation:logical-id'),\n            security_groups=[arg_2.name for arg_2 in arg_1.groups],\n            launch_time=arg_1.launch_time,\n            ami_id=arg_1.image_id,\n            tags={arg_3.lower(): arg_4 for arg_3, arg_4 in six.iteritems(arg_1.tags)}\n        )", "path": "src/lsi/utils/hosts.py", "identifier": "HostEntry.from_boto_instance", "docstring": "Loads a ``HostEntry`` from a boto instance.\n\n        :param instance: A boto instance object.\n        :type instance: :py:class:`boto.ec2.instanceInstance`\n\n        :rtype: :py:class:`HostEntry`", "docstring_tokens": ["Loads", "a", "HostEntry", "from", "a", "boto", "instance", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 252075}
{"url": "https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L163-L180", "sha": "5a75cf88cf794937711b6850ff2acb07fe005f08", "docstring_summary": "Move this object above the referenced object.", "language": "python", "parameters": "(self, ref)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_valid_ordering_reference", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "\"%r can only be moved Func instances of %r which %s equals %r.\"", "%", "(", "arg_0", ",", "arg_0", ".", "__class__", ",", "arg_0", ".", "order_with_respect_to", ",", "arg_0", ".", "_get_order_with_respect_to", "(", ")", ")", ")", "if", "arg_0", ".", "order", "==", "arg_1", ".", "order", ":", "return", "if", "arg_0", ".", "order", ">", "arg_1", ".", "order", ":", "arg_2", "=", "arg_1", ".", "order", "else", ":", "arg_2", "=", "arg_0", ".", "get_ordering_queryset", "(", ")", ".", "filter", "(", "order__lt", "=", "arg_1", ".", "order", ")", ".", "aggregate", "(", "Max", "(", "'order'", ")", ")", ".", "get", "(", "'order__max'", ")", "or", "0", "arg_0", ".", "to", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Move this object Func the referenced object.\n        \"\"\"\n        if not arg_0._valid_ordering_reference(arg_1):\n            raise ValueError(\n                \"%r can only be moved Func instances of %r which %s equals %r.\" % (\n                    arg_0, arg_0.__class__, arg_0.order_with_respect_to,\n                    arg_0._get_order_with_respect_to()\n                )\n            )\n        if arg_0.order == arg_1.order:\n            return\n        if arg_0.order > arg_1.order:\n            arg_2 = arg_1.order\n        else:\n            arg_2 = arg_0.get_ordering_queryset().filter(order__lt=arg_1.order).aggregate(Max('order')).get('order__max') or 0\n        arg_0.to(arg_2)", "path": "publications/models/orderedmodel.py", "identifier": "OrderedModel.above", "docstring": "Move this object above the referenced object.", "docstring_tokens": ["Move", "this", "object", "above", "the", "referenced", "object", "."], "nwo": "lucastheis/django-publications", "score": 0.41971037138316925, "idx": 252076}
{"url": "https://github.com/bbusenius/Diablo-Python/blob/646ac5a6f1c79cf9b928a4e2a7979988698b6c82/convert_php/convert_php.py#L166-L260", "sha": "646ac5a6f1c79cf9b928a4e2a7979988698b6c82", "docstring_summary": "Unserializes a serialized php array and prints it to\n        the console as a data structure in the specified language.\n        Used to translate or convert a php array into a data structure \n        in another language. Currently supports, PHP, Python, Javascript,\n        and JSON.", "language": "python", "parameters": "(self, string, language, level=3, retdata=False)", "return_statement": "return self.data_structure if retdata else None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "3", ",", "arg_4", "=", "False", ")", ":", "arg_2", "=", "arg_2", ".", "lower", "(", ")", "assert", "arg_0", ".", "is_built_in", "(", "arg_2", ")", "or", "arg_2", "in", "arg_0", ".", "outer_templates", ",", "\"Sorry, \"", "+", "arg_2", "+", "\" is not a supported language.\"", "arg_5", "=", "phpserialize", ".", "loads", "(", "bytes", "(", "arg_1", ",", "'utf-8'", ")", ",", "array_hook", "=", "list", ",", "decode_strings", "=", "True", ")", "if", "arg_0", ".", "is_built_in", "(", "arg_2", ")", ":", "arg_0", ".", "get_built_in", "(", "arg_2", ",", "arg_3", ",", "arg_5", ")", "print", "(", "arg_0", ")", "return", "arg_0", ".", "data_structure", "if", "arg_4", "else", "None", "def", "loop_print", "(", "arg_6", ",", "arg_3", "=", "3", ")", ":", "arg_7", "=", "''", "arg_8", "=", "' '", "*", "arg_3", "if", "not", "arg_0", ".", "is_iterable", "(", "arg_6", ")", "or", "isinstance", "(", "arg_6", ",", "str", ")", ":", "arg_9", "=", "str", "(", "arg_6", ")", "return", "str", "(", "arg_9", ")", "for", "arg_10", "in", "arg_6", ":", "if", "isinstance", "(", "arg_10", ",", "tuple", ")", "and", "len", "(", "arg_10", ")", "==", "2", ":", "arg_11", "=", "arg_10", "[", "0", "]", "arg_12", "=", "loop_print", "(", "arg_10", "[", "1", "]", ",", "arg_3", "=", "arg_3", "+", "3", ")", "arg_12", "=", "arg_0", ".", "translate_val", "(", "arg_2", ",", "arg_12", ")", "if", "arg_2", "in", "arg_0", ".", "lang_specific_values", "and", "arg_12", "in", "arg_0", ".", "lang_specific_values", "[", "arg_2", "]", "else", "arg_12", "arg_11", "=", "str", "(", "arg_11", ")", "if", "isinstance", "(", "arg_11", ",", "int", ")", "else", "'\\''", "+", "str", "(", "arg_11", ")", "+", "'\\''", "arg_13", "=", "hasattr", "(", "arg_10", "[", "0", "]", ",", "'__iter__'", ")", "==", "False", "and", "hasattr", "(", "arg_10", "[", "1", "]", ",", "'__iter__'", ")", "==", "True", "if", "arg_13", ":", "arg_7", "+=", "arg_0", ".", "get_inner_template", "(", "arg_2", ",", "'iterable'", ",", "arg_8", ",", "arg_11", ",", "arg_12", ")", "else", ":", "arg_12", "=", "str", "(", "arg_12", ")", "if", "arg_12", ".", "isdigit", "(", ")", "or", "arg_12", "in", "arg_0", ".", "lang_specific_values", "[", "arg_2", "]", ".", "values", "(", ")", "else", "'\\''", "+", "str", "(", "arg_12", ")", "+", "'\\''", "arg_7", "+=", "arg_0", ".", "get_inner_template", "(", "arg_2", ",", "'singular'", ",", "arg_8", ",", "arg_11", ",", "arg_12", ")", "return", "arg_7", "arg_0", ".", "data_structure", "=", "arg_0", ".", "outer_templates", "[", "arg_2", "]", "%", "(", "loop_print", "(", "arg_5", ")", ")", "print", "(", "arg_0", ")", "return", "arg_0", ".", "data_structure", "if", "arg_4", "else", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=3, arg_4=False):\n        \"\"\"Unserializes a serialized php array and prints it to\n        the console as a data structure in the specified language.\n        Used to translate or convert a php array into a data structure \n        in another language. Currently supports, PHP, Python, Javascript,\n        and JSON. \n\n        Args:\n            string: a string of serialized php\n        \n            language: a string representing the desired output \n            format for the array.\n\n            level: integer, indentation level in spaces. \n            Defaults to 3.\n\n            retdata: boolean, the method will return the string\n            in addition to printing it if set to True. Defaults \n            to false.\n\n        Returns:\n            None but prints a string to the console if retdata is \n            False, otherwise returns a string.\n            \"\"\"\n        arg_2 = arg_2.lower()\n        assert arg_0.is_built_in(arg_2) or arg_2 in arg_0.outer_templates, \\\n            \"Sorry, \" + arg_2 + \" is not a supported language.\"\n\n        # Serialized data converted to a python data structure (list of tuples)\n        arg_5 = phpserialize.loads(bytes(arg_1, 'utf-8'), array_hook=list, decode_strings=True)\n\n        # If language conversion is supported by python avoid recursion entirely\n        # and use a built in library\n        if arg_0.is_built_in(arg_2):\n            arg_0.get_built_in(arg_2, arg_3, arg_5) \n            print(arg_0)\n            return arg_0.data_structure if arg_4 else None\n\n        # The language is not supported. Use recursion to build a data structure.\n        def loop_print(arg_6, arg_3=3):\n            \"\"\"\n            Loops over a python representation of a php array \n            (list of tuples) and constructs a representation in another language.\n            Translates a php array into another structure.\n\n            Args:\n                iterable: list or tuple to unpack.\n\n                level: integer, number of spaces to use for indentation\n            \"\"\"\n            arg_7 = ''\n            arg_8 = ' ' * arg_3\n\n            # Base case - variable is not an iterable\n            if not arg_0.is_iterable(arg_6) or isinstance(arg_6, str):\n                arg_9 = str(arg_6)\n                return str(arg_9)\n             \n            # Recursive case\n            for arg_10 in arg_6:\n                # If item is a tuple it should be a key, value pair\n                if isinstance(arg_10, tuple) and len(arg_10) == 2:\n                    # Get the key value pair\n                    arg_11 = arg_10[0]\n                    arg_12 = loop_print(arg_10[1], arg_3=arg_3+3)\n            \n                    # Translate special values\n                    arg_12 = arg_0.translate_val(arg_2, arg_12) if arg_2 in arg_0.lang_specific_values \\\n                          and arg_12 in arg_0.lang_specific_values[arg_2] else arg_12\n     \n                    # Convert keys to their properly formatted strings\n                    # Integers are not quoted as array keys\n                    arg_11 = str(arg_11) if isinstance(arg_11, int) else '\\'' + str(arg_11) + '\\''\n\n                    # The first item is a key and the second item is an iterable, boolean\n                    arg_13 = hasattr(arg_10[0],'__iter__') == False \\\n                                      and hasattr(arg_10[1],'__iter__') == True \n\n                    # The second item is an iterable\n                    if arg_13:\n                        arg_7 += arg_0.get_inner_template(arg_2, 'iterable', arg_8, arg_11, arg_12)\n                    # The second item is not an iterable\n                    else:\n                        # Convert values to their properly formatted strings\n                        # Integers and booleans are not quoted as array values\n                        arg_12 = str(arg_12) if arg_12.isdigit() or arg_12 in arg_0.lang_specific_values[arg_2].values() else '\\'' + str(arg_12) + '\\''\n\n                        arg_7 += arg_0.get_inner_template(arg_2, 'singular', arg_8, arg_11, arg_12) \n\n            return arg_7\n    \n        # Execute the recursive call in language specific wrapper template\n        arg_0.data_structure = arg_0.outer_templates[arg_2] % (loop_print(arg_5))\n        print(arg_0)\n        return arg_0.data_structure if arg_4 else None", "path": "convert_php/convert_php.py", "identifier": "ConvertPHP.translate_array", "docstring": "Unserializes a serialized php array and prints it to\n        the console as a data structure in the specified language.\n        Used to translate or convert a php array into a data structure \n        in another language. Currently supports, PHP, Python, Javascript,\n        and JSON. \n\n        Args:\n            string: a string of serialized php\n        \n            language: a string representing the desired output \n            format for the array.\n\n            level: integer, indentation level in spaces. \n            Defaults to 3.\n\n            retdata: boolean, the method will return the string\n            in addition to printing it if set to True. Defaults \n            to false.\n\n        Returns:\n            None but prints a string to the console if retdata is \n            False, otherwise returns a string.", "docstring_tokens": ["Unserializes", "a", "serialized", "php", "array", "and", "prints", "it", "to", "the", "console", "as", "a", "data", "structure", "in", "the", "specified", "language", ".", "Used", "to", "translate", "or", "convert", "a", "php", "array", "into", "a", "data", "structure", "in", "another", "language", ".", "Currently", "supports", "PHP", "Python", "Javascript", "and", "JSON", "."], "nwo": "bbusenius/Diablo-Python", "score": 0.24979334806965703, "idx": 252077}
{"url": "https://github.com/Cairnarvon/uptime/blob/1ddfd06bb300c00e6dc4bd2a9ddf9bf1aa27b1bb/src/__init__.py#L97-L111", "sha": "1ddfd06bb300c00e6dc4bd2a9ddf9bf1aa27b1bb", "docstring_summary": "A way to figure out the boot time directly on Linux.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "arg_2", "try", ":", "arg_0", "=", "open", "(", "'/proc/stat'", ",", "'r'", ")", "for", "arg_1", "in", "arg_0", ":", "if", "arg_1", ".", "startswith", "(", "'btime'", ")", ":", "arg_2", "=", "int", "(", "arg_1", ".", "split", "(", ")", "[", "1", "]", ")", "if", "datetime", "is", "None", ":", "raise", "NotImplementedError", "(", "'datetime module required.'", ")", "return", "datetime", ".", "fromtimestamp", "(", "arg_2", ")", "except", "(", "IOError", ",", "IndexError", ")", ":", "return", "None"], "function": "def Func():\n    \"\"\"A way to figure out the boot time directly on Linux.\"\"\"\n    global arg_2\n    try:\n        arg_0 = open('/proc/stat', 'r')\n        for arg_1 in arg_0:\n            if arg_1.startswith('btime'):\n                arg_2 = int(arg_1.split()[1])\n\n        if datetime is None:\n            raise NotImplementedError('datetime module required.')\n\n        return datetime.fromtimestamp(arg_2)\n    except (IOError, IndexError):\n        return None", "path": "src/__init__.py", "identifier": "_boottime_linux", "docstring": "A way to figure out the boot time directly on Linux.", "docstring_tokens": ["A", "way", "to", "figure", "out", "the", "boot", "time", "directly", "on", "Linux", "."], "nwo": "Cairnarvon/uptime", "score": 0.28604555575224755, "idx": 252078}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/stream.py#L51-L53", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "The index of the deepest character readed.", "language": "python", "parameters": "(self)", "return_statement": "return Position(self._maxindex, self._maxline, self._maxcol)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Position", ":", "return", "Position", "(", "arg_0", ".", "_maxindex", ",", "arg_0", ".", "_maxline", ",", "arg_0", ".", "_maxcol", ")"], "function": "def Func(arg_0) -> Position:\n        \"\"\"The index of the deepest character readed.\"\"\"\n        return Position(arg_0._maxindex, arg_0._maxline, arg_0._maxcol)", "path": "pyrser/parsing/stream.py", "identifier": "Cursor.max_readed_position", "docstring": "The index of the deepest character readed.", "docstring_tokens": ["The", "index", "of", "the", "deepest", "character", "readed", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 252079}
{"url": "https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/model/crf.py#L10-L33", "sha": "1436e0bf72803e02ccf727f41e8fc85ba167d9fe", "docstring_summary": "Fit CRF according to X, y", "language": "python", "parameters": "(self, X, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "pycrfsuite", ".", "Trainer", "(", "verbose", "=", "True", ")", "for", "arg_4", ",", "arg_5", "in", "zip", "(", "arg_1", ",", "arg_2", ")", ":", "arg_3", ".", "append", "(", "arg_4", ",", "arg_5", ")", "arg_3", ".", "set_params", "(", "arg_0", ".", "params", ")", "if", "arg_0", ".", "filename", ":", "arg_6", "=", "arg_0", ".", "filename", "else", ":", "arg_6", "=", "'model.tmp'", "arg_3", ".", "train", "(", "arg_6", ")", "arg_7", "=", "pycrfsuite", ".", "Tagger", "(", ")", "arg_7", ".", "open", "(", "arg_6", ")", "arg_0", ".", "estimator", "=", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Fit CRF according to X, y\n\n        Parameters\n        ----------\n        X : list of text\n            each item is a text\n        y: list\n           each item is either a label (in multi class problem) or list of\n           labels (in multi label problem)\n        \"\"\"\n        arg_3 = pycrfsuite.Trainer(verbose=True)\n        for arg_4, arg_5 in zip(arg_1, arg_2):\n            arg_3.append(arg_4, arg_5)\n\n        arg_3.set_params(arg_0.params)\n        if arg_0.filename:\n            arg_6 = arg_0.filename\n        else:\n            arg_6 = 'model.tmp'\n        arg_3.train(arg_6)\n        arg_7 = pycrfsuite.Tagger()\n        arg_7.open(arg_6)\n        arg_0.estimator = arg_7", "path": "languageflow/model/crf.py", "identifier": "CRF.fit", "docstring": "Fit CRF according to X, y\n\n        Parameters\n        ----------\n        X : list of text\n            each item is a text\n        y: list\n           each item is either a label (in multi class problem) or list of\n           labels (in multi label problem)", "docstring_tokens": ["Fit", "CRF", "according", "to", "X", "y"], "nwo": "undertheseanlp/languageflow", "score": 0.5035427528001201, "idx": 252080}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/base.py#L29-L78", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Creates a Transaction object from a sequence of trytes.", "language": "python", "parameters": "(cls, trytes, hash_=None)", "return_statement": "return cls(\n            hash_=hash_,\n            signature_message_fragment=Fragment(tryte_string[0:2187]),\n            address=Address(tryte_string[2187:2268]),\n            value=int_from_trits(tryte_string[2268:2295].as_trits()),\n            legacy_tag=Tag(tryte_string[2295:2322]),\n            timestamp=int_from_trits(tryte_string[2322:2331].as_trits()),\n            current_index=int_from_trits(tryte_string[2331:2340].as_trits()),\n            last_index=int_from_trits(tryte_string[2340:2349].as_trits()),\n            bundle_hash=BundleHash(tryte_string[2349:2430]),\n            trunk_transaction_hash=TransactionHash(tryte_string[2430:2511]),\n            branch_transaction_hash=TransactionHash(tryte_string[2511:2592]),\n            tag=Tag(tryte_string[2592:2619]),\n\n            attachment_timestamp=int_from_trits(\n                tryte_string[2619:2628].as_trits()),\n\n            attachment_timestamp_lower_bound=int_from_trits(\n                tryte_string[2628:2637].as_trits()),\n\n            attachment_timestamp_upper_bound=int_from_trits(\n                tryte_string[2637:2646].as_trits()),\n\n            nonce=Nonce(tryte_string[2646:2673]),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "TransactionTrytes", "(", "arg_1", ")", "if", "not", "arg_2", ":", "arg_4", "=", "[", "0", "]", "*", "HASH_LENGTH", "arg_5", "=", "Curl", "(", ")", "arg_5", ".", "absorb", "(", "arg_3", ".", "as_trits", "(", ")", ")", "arg_5", ".", "squeeze", "(", "arg_4", ")", "arg_2", "=", "TransactionHash", ".", "from_trits", "(", "arg_4", ")", "return", "arg_0", "(", "arg_2", "=", "arg_2", ",", "signature_message_fragment", "=", "Fragment", "(", "arg_3", "[", "0", ":", "2187", "]", ")", ",", "address", "=", "Address", "(", "arg_3", "[", "2187", ":", "2268", "]", ")", ",", "value", "=", "int_from_trits", "(", "arg_3", "[", "2268", ":", "2295", "]", ".", "as_trits", "(", ")", ")", ",", "legacy_tag", "=", "Tag", "(", "arg_3", "[", "2295", ":", "2322", "]", ")", ",", "timestamp", "=", "int_from_trits", "(", "arg_3", "[", "2322", ":", "2331", "]", ".", "as_trits", "(", ")", ")", ",", "current_index", "=", "int_from_trits", "(", "arg_3", "[", "2331", ":", "2340", "]", ".", "as_trits", "(", ")", ")", ",", "last_index", "=", "int_from_trits", "(", "arg_3", "[", "2340", ":", "2349", "]", ".", "as_trits", "(", ")", ")", ",", "bundle_hash", "=", "BundleHash", "(", "arg_3", "[", "2349", ":", "2430", "]", ")", ",", "trunk_transaction_hash", "=", "TransactionHash", "(", "arg_3", "[", "2430", ":", "2511", "]", ")", ",", "branch_transaction_hash", "=", "TransactionHash", "(", "arg_3", "[", "2511", ":", "2592", "]", ")", ",", "tag", "=", "Tag", "(", "arg_3", "[", "2592", ":", "2619", "]", ")", ",", "attachment_timestamp", "=", "int_from_trits", "(", "arg_3", "[", "2619", ":", "2628", "]", ".", "as_trits", "(", ")", ")", ",", "attachment_timestamp_lower_bound", "=", "int_from_trits", "(", "arg_3", "[", "2628", ":", "2637", "]", ".", "as_trits", "(", ")", ")", ",", "attachment_timestamp_upper_bound", "=", "int_from_trits", "(", "arg_3", "[", "2637", ":", "2646", "]", ".", "as_trits", "(", ")", ")", ",", "nonce", "=", "Nonce", "(", "arg_3", "[", "2646", ":", "2673", "]", ")", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        # type: (TrytesCompatible, Optional[TransactionHash]) -> Transaction\n        \"\"\"\n        Creates a Transaction object from a sequence of trytes.\n\n        :param trytes:\n            Raw trytes.  Should be exactly 2673 trytes long.\n\n        :param hash_:\n            The transaction hash, if available.\n\n            If not provided, it will be computed from the transaction\n            trytes.\n        \"\"\"\n        arg_3 = TransactionTrytes(arg_1)\n\n        if not arg_2:\n            arg_4 = [0] * HASH_LENGTH  # type: MutableSequence[int]\n\n            arg_5 = Curl()\n            arg_5.absorb(arg_3.as_trits())\n            arg_5.squeeze(arg_4)\n\n            arg_2 = TransactionHash.from_trits(arg_4)\n\n        return arg_0(\n            arg_2=arg_2,\n            signature_message_fragment=Fragment(arg_3[0:2187]),\n            address=Address(arg_3[2187:2268]),\n            value=int_from_trits(arg_3[2268:2295].as_trits()),\n            legacy_tag=Tag(arg_3[2295:2322]),\n            timestamp=int_from_trits(arg_3[2322:2331].as_trits()),\n            current_index=int_from_trits(arg_3[2331:2340].as_trits()),\n            last_index=int_from_trits(arg_3[2340:2349].as_trits()),\n            bundle_hash=BundleHash(arg_3[2349:2430]),\n            trunk_transaction_hash=TransactionHash(arg_3[2430:2511]),\n            branch_transaction_hash=TransactionHash(arg_3[2511:2592]),\n            tag=Tag(arg_3[2592:2619]),\n\n            attachment_timestamp=int_from_trits(\n                arg_3[2619:2628].as_trits()),\n\n            attachment_timestamp_lower_bound=int_from_trits(\n                arg_3[2628:2637].as_trits()),\n\n            attachment_timestamp_upper_bound=int_from_trits(\n                arg_3[2637:2646].as_trits()),\n\n            nonce=Nonce(arg_3[2646:2673]),\n        )", "path": "iota/transaction/base.py", "identifier": "Transaction.from_tryte_string", "docstring": "Creates a Transaction object from a sequence of trytes.\n\n        :param trytes:\n            Raw trytes.  Should be exactly 2673 trytes long.\n\n        :param hash_:\n            The transaction hash, if available.\n\n            If not provided, it will be computed from the transaction\n            trytes.", "docstring_tokens": ["Creates", "a", "Transaction", "object", "from", "a", "sequence", "of", "trytes", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 252081}
{"url": "https://github.com/sbneto/s3conf/blob/92fd2973beccc85bb21d3157ff227929e62ed695/s3conf/client.py#L217-L230", "sha": "92fd2973beccc85bb21d3157ff227929e62ed695", "docstring_summary": "For each section defined in the local config file, creates a folder inside the local config folder\n    named after the section. Downloads the environemnt file defined by the S3CONF variable for this section\n    to this folder.", "language": "python", "parameters": "(section, map_files)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "config", ".", "Settings", "(", "arg_0", "=", "arg_0", ")", "arg_3", "=", "STORAGES", "[", "'s3'", "]", "(", "arg_2", "=", "arg_2", ")", "arg_4", "=", "s3conf", ".", "S3Conf", "(", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "os", ".", "path", ".", "join", "(", "config", ".", "LOCAL_CONFIG_FOLDER", ",", "arg_0", ")", "arg_4", ".", "Func", "(", "arg_5", ",", "arg_1", "=", "arg_1", ")", "except", "exceptions", ".", "EnvfilePathNotDefinedError", ":", "raise", "exceptions", ".", "EnvfilePathNotDefinedUsageError", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    For each section defined in the local config file, creates a folder inside the local config folder\n    named after the section. Downloads the environemnt file defined by the S3CONF variable for this section\n    to this folder.\n    \"\"\"\n    try:\n        arg_2 = config.Settings(arg_0=arg_0)\n        arg_3 = STORAGES['s3'](arg_2=arg_2)\n        arg_4 = s3conf.S3Conf(arg_3=arg_3, arg_2=arg_2)\n        arg_5 = os.path.join(config.LOCAL_CONFIG_FOLDER, arg_0)\n        arg_4.Func(arg_5, arg_1=arg_1)\n    except exceptions.EnvfilePathNotDefinedError:\n        raise exceptions.EnvfilePathNotDefinedUsageError()", "path": "s3conf/client.py", "identifier": "downsync", "docstring": "For each section defined in the local config file, creates a folder inside the local config folder\n    named after the section. Downloads the environemnt file defined by the S3CONF variable for this section\n    to this folder.", "docstring_tokens": ["For", "each", "section", "defined", "in", "the", "local", "config", "file", "creates", "a", "folder", "inside", "the", "local", "config", "folder", "named", "after", "the", "section", ".", "Downloads", "the", "environemnt", "file", "defined", "by", "the", "S3CONF", "variable", "for", "this", "section", "to", "this", "folder", "."], "nwo": "sbneto/s3conf", "score": 0.3282631104312029, "idx": 252082}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_annotation.py#L7-L72", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Runs GenotypeGVCFs on one or more gVCFs generated by HaplotypeCaller.", "language": "python", "parameters": "(job,\n                        gvcfs,\n                        ref, fai, ref_dict,\n                        annotations=None,\n                        emit_threshold=10.0, call_threshold=30.0,\n                        unsafe_mode=False)", "return_statement": "return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'genotyped.vcf'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "10.0", ",", "arg_7", "=", "30.0", ",", "arg_8", "=", "False", ")", ":", "arg_9", "=", "{", "'genome.fa'", ":", "arg_2", ",", "'genome.fa.fai'", ":", "arg_3", ",", "'genome.dict'", ":", "arg_4", "}", "arg_9", ".", "update", "(", "arg_1", ")", "arg_10", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "for", "arg_11", ",", "arg_12", "in", "arg_9", ".", "iteritems", "(", ")", ":", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_12", ",", "os", ".", "path", ".", "join", "(", "arg_10", ",", "arg_11", ")", ")", "arg_13", "=", "[", "'-T'", ",", "'GenotypeGVCFs'", ",", "'-R'", ",", "'/data/genome.fa'", ",", "'--out'", ",", "'genotyped.vcf'", ",", "'-stand_emit_conf'", ",", "str", "(", "arg_6", ")", ",", "'-stand_call_conf'", ",", "str", "(", "arg_7", ")", "]", "if", "arg_5", ":", "for", "arg_14", "in", "arg_5", ":", "arg_13", ".", "extend", "(", "[", "'-A'", ",", "arg_14", "]", ")", "for", "arg_15", "in", "arg_1", ".", "keys", "(", ")", ":", "arg_13", ".", "extend", "(", "[", "'--variant'", ",", "os", ".", "path", ".", "join", "(", "'/data'", ",", "arg_15", ")", "]", ")", "if", "arg_8", ":", "arg_13", ".", "extend", "(", "[", "'-U'", ",", "'ALLOW_SEQ_DICT_INCOMPATIBILITY'", "]", ")", "arg_0", ".", "fileStore", ".", "logToMaster", "(", "'Running GATK GenotypeGVCFs\\n'", "'Emit threshold: {emit_threshold}\\n'", "'Call threshold: {call_threshold}\\n\\n'", "'Annotations:\\n{annotations}\\n\\n'", "'Samples:\\n{samples}\\n'", ".", "format", "(", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_5", "=", "'\\n'", ".", "join", "(", "arg_5", ")", "if", "arg_5", "else", "''", ",", "samples", "=", "'\\n'", ".", "join", "(", "arg_1", ".", "keys", "(", ")", ")", ")", ")", "arg_16", "=", "[", "'--rm'", ",", "'log-driver'", ",", "'none'", ",", "'-e'", ",", "'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'", ".", "format", "(", "arg_0", ".", "memory", ")", "]", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "workDir", "=", "arg_10", ",", "parameters", "=", "arg_13", ",", "tool", "=", "'quay.io/ucsc_cgl/gatk:3.5--dba6dae49156168a909c43330350c6161dc7ecc2'", ",", "dockerParameters", "=", "arg_16", ")", "return", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_10", ",", "'genotyped.vcf'", ")", ")"], "function": "def Func(arg_0,\n                        arg_1,\n                        arg_2, arg_3, arg_4,\n                        arg_5=None,\n                        arg_6=10.0, arg_7=30.0,\n                        arg_8=False):\n    \"\"\"\n    Runs GenotypeGVCFs on one or more gVCFs generated by HaplotypeCaller.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param dict gvcfs: Dictionary of GVCF FileStoreIDs {sample identifier: FileStoreID}\n    :param str ref: FileStoreID for the reference genome fasta file\n    :param str fai: FileStoreID for the reference genome index file\n    :param str ref_dict: FileStoreID for the reference genome sequence dictionary\n    :param list[str] annotations: Optional list of GATK variant annotations. Default: None.\n    :param float emit_threshold: Minimum phred-scale confidence threshold for\n                                 a variant to be emitted. GATK default: 10.0\n    :param float call_threshold: Minimum phred-scale confidence threshold for\n                                 a variant to be called. GATK default: 30.0\n    :param bool unsafe_mode: If True, runs gatk UNSAFE mode: \"-U ALLOW_SEQ_DICT_INCOMPATIBILITY\"\n    :return: VCF FileStoreID\n    :rtype: str\n    \"\"\"\n    arg_9 = {'genome.fa': arg_2,\n              'genome.fa.fai': arg_3,\n              'genome.dict': arg_4}\n    arg_9.update(arg_1)\n\n    arg_10 = arg_0.fileStore.getLocalTempDir()\n    for arg_11, arg_12 in arg_9.iteritems():\n        arg_0.fileStore.readGlobalFile(arg_12, os.path.join(arg_10, arg_11))\n\n    arg_13 = ['-T', 'GenotypeGVCFs',\n               '-R', '/data/genome.fa',\n               '--out', 'genotyped.vcf',\n               '-stand_emit_conf', str(arg_6),\n               '-stand_call_conf', str(arg_7)]\n\n    if arg_5:\n        for arg_14 in arg_5:\n            arg_13.extend(['-A', arg_14])\n\n    # Include all GVCFs for joint genotyping\n    for arg_15 in arg_1.keys():\n        arg_13.extend(['--variant', os.path.join('/data', arg_15)])\n\n    if arg_8:\n        arg_13.extend(['-U', 'ALLOW_SEQ_DICT_INCOMPATIBILITY'])\n\n    arg_0.fileStore.logToMaster('Running GATK GenotypeGVCFs\\n'\n                              'Emit threshold: {emit_threshold}\\n'\n                              'Call threshold: {call_threshold}\\n\\n'\n                              'Annotations:\\n{annotations}\\n\\n'\n                              'Samples:\\n{samples}\\n'.format(arg_6=arg_6,\n                                                             arg_7=arg_7,\n                                                             arg_5='\\n'.join(arg_5) if arg_5 else '',\n                                                             samples='\\n'.join(arg_1.keys())))\n\n    arg_16 = ['--rm', 'log-driver', 'none',\n                         '-e', 'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'.format(arg_0.memory)]\n    dockerCall(arg_0=arg_0, workDir=arg_10,\n               parameters=arg_13,\n               tool='quay.io/ucsc_cgl/gatk:3.5--dba6dae49156168a909c43330350c6161dc7ecc2',\n               dockerParameters=arg_16)\n\n    return arg_0.fileStore.writeGlobalFile(os.path.join(arg_10, 'genotyped.vcf'))", "path": "src/toil_lib/tools/variant_annotation.py", "identifier": "gatk_genotype_gvcfs", "docstring": "Runs GenotypeGVCFs on one or more gVCFs generated by HaplotypeCaller.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param dict gvcfs: Dictionary of GVCF FileStoreIDs {sample identifier: FileStoreID}\n    :param str ref: FileStoreID for the reference genome fasta file\n    :param str fai: FileStoreID for the reference genome index file\n    :param str ref_dict: FileStoreID for the reference genome sequence dictionary\n    :param list[str] annotations: Optional list of GATK variant annotations. Default: None.\n    :param float emit_threshold: Minimum phred-scale confidence threshold for\n                                 a variant to be emitted. GATK default: 10.0\n    :param float call_threshold: Minimum phred-scale confidence threshold for\n                                 a variant to be called. GATK default: 30.0\n    :param bool unsafe_mode: If True, runs gatk UNSAFE mode: \"-U ALLOW_SEQ_DICT_INCOMPATIBILITY\"\n    :return: VCF FileStoreID\n    :rtype: str", "docstring_tokens": ["Runs", "GenotypeGVCFs", "on", "one", "or", "more", "gVCFs", "generated", "by", "HaplotypeCaller", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 252083}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/base.py#L129-L193", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Load songs from local playlist.", "language": "python", "parameters": "(\n\t\tplaylist, include_filters=None, exclude_filters=None,\n\t\tall_includes=False, all_excludes=False, exclude_patterns=None)", "return_statement": "return matched_songs, filtered_songs, excluded_songs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "logger", ".", "info", "(", "\"Loading local playlist songs...\"", ")", "if", "os", ".", "name", "==", "'nt'", "and", "CYGPATH_RE", ".", "match", "(", "arg_0", ")", ":", "arg_0", "=", "convert_cygwin_path", "(", "arg_0", ")", "arg_6", "=", "[", "]", "arg_7", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", ")", "with", "open", "(", "arg_0", ")", "as", "local_playlist", ":", "for", "arg_8", "in", "local_playlist", ".", "readlines", "(", ")", ":", "arg_8", "=", "arg_8", ".", "strip", "(", ")", "if", "arg_8", ".", "lower", "(", ")", ".", "endswith", "(", "SUPPORTED_SONG_FORMATS", ")", ":", "arg_9", "=", "arg_8", "if", "not", "os", ".", "path", ".", "isabs", "(", "arg_9", ")", ":", "arg_9", "=", "os", ".", "path", ".", "join", "(", "arg_7", ",", "arg_9", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_9", ")", ":", "arg_6", ".", "append", "(", "arg_9", ")", "arg_10", "=", "get_supported_filepaths", "(", "arg_6", ",", "SUPPORTED_SONG_FORMATS", ")", "arg_11", ",", "arg_12", "=", "exclude_filepaths", "(", "arg_10", ",", "arg_5", "=", "arg_5", ")", "arg_13", ",", "arg_14", "=", "filter_local_songs", "(", "arg_11", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "logger", ".", "info", "(", "\"Excluded {0} local playlist songs\"", ".", "format", "(", "len", "(", "arg_12", ")", ")", ")", "logger", ".", "info", "(", "\"Filtered {0} local playlist songs\"", ".", "format", "(", "len", "(", "arg_14", ")", ")", ")", "logger", ".", "info", "(", "\"Loaded {0} local playlist songs\"", ".", "format", "(", "len", "(", "arg_13", ")", ")", ")", "return", "arg_13", ",", "arg_14", ",", "arg_12"], "function": "def Func(\n\t\targ_0, arg_1=None, arg_2=None,\n\t\targ_3=False, arg_4=False, arg_5=None):\n\t\t\"\"\"Load songs from local playlist.\n\n\t\tParameters:\n\t\t\tplaylist (str): An M3U(8) playlist filepath.\n\n\t\t\tinclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values don't match any of the given patterns.\n\n\t\t\texclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values match any of the given patterns.\n\n\t\t\tall_includes (bool): If ``True``, all include_filters criteria must match to include a song.\n\n\t\t\tall_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.\n\n\t\t\texclude_patterns (list or str): Pattern(s) to exclude.\n\t\t\t\tPatterns are Python regex patterns.\n\t\t\t\tFilepaths are excluded if they match any of the exclude patterns.\n\n\t\tReturns:\n\t\t\tA list of local playlist song filepaths matching criteria,\n\t\t\ta list of local playlist song filepaths filtered out using filter criteria,\n\t\t\tand a list of local playlist song filepaths excluded using exclusion criteria.\n\t\t\"\"\"\n\n\t\tlogger.info(\"Loading local playlist songs...\")\n\n\t\tif os.name == 'nt' and CYGPATH_RE.match(arg_0):\n\t\t\targ_0 = convert_cygwin_path(arg_0)\n\n\t\targ_6 = []\n\t\targ_7 = os.path.dirname(os.path.abspath(arg_0))\n\n\t\twith open(arg_0) as local_playlist:\n\t\t\tfor arg_8 in local_playlist.readlines():\n\t\t\t\targ_8 = arg_8.strip()\n\n\t\t\t\tif arg_8.lower().endswith(SUPPORTED_SONG_FORMATS):\n\t\t\t\t\targ_9 = arg_8\n\n\t\t\t\t\tif not os.path.isabs(arg_9):\n\t\t\t\t\t\targ_9 = os.path.join(arg_7, arg_9)\n\n\t\t\t\t\tif os.path.isfile(arg_9):\n\t\t\t\t\t\targ_6.append(arg_9)\n\n\t\targ_10 = get_supported_filepaths(arg_6, SUPPORTED_SONG_FORMATS)\n\n\t\targ_11, arg_12 = exclude_filepaths(arg_10, arg_5=arg_5)\n\n\t\targ_13, arg_14 = filter_local_songs(\n\t\t\targ_11, arg_1=arg_1, arg_2=arg_2,\n\t\t\targ_3=arg_3, arg_4=arg_4\n\t\t)\n\n\t\tlogger.info(\"Excluded {0} local playlist songs\".format(len(arg_12)))\n\t\tlogger.info(\"Filtered {0} local playlist songs\".format(len(arg_14)))\n\t\tlogger.info(\"Loaded {0} local playlist songs\".format(len(arg_13)))\n\n\t\treturn arg_13, arg_14, arg_12", "path": "gmusicapi_wrapper/base.py", "identifier": "_BaseWrapper.get_local_playlist_songs", "docstring": "Load songs from local playlist.\n\n\t\tParameters:\n\t\t\tplaylist (str): An M3U(8) playlist filepath.\n\n\t\t\tinclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values don't match any of the given patterns.\n\n\t\t\texclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values match any of the given patterns.\n\n\t\t\tall_includes (bool): If ``True``, all include_filters criteria must match to include a song.\n\n\t\t\tall_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.\n\n\t\t\texclude_patterns (list or str): Pattern(s) to exclude.\n\t\t\t\tPatterns are Python regex patterns.\n\t\t\t\tFilepaths are excluded if they match any of the exclude patterns.\n\n\t\tReturns:\n\t\t\tA list of local playlist song filepaths matching criteria,\n\t\t\ta list of local playlist song filepaths filtered out using filter criteria,\n\t\t\tand a list of local playlist song filepaths excluded using exclusion criteria.", "docstring_tokens": ["Load", "songs", "from", "local", "playlist", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 252084}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L1199-L1218", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Sends a new message event to an Event Hub.", "language": "python", "parameters": "(self, hub_name, message, device_id=None,\n                   broker_properties=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "_validate_not_none", "(", "'hub_name'", ",", "arg_1", ")", "arg_5", "=", "HTTPRequest", "(", ")", "arg_5", ".", "method", "=", "'POST'", "arg_5", ".", "host", "=", "arg_0", ".", "_get_host", "(", ")", "if", "arg_3", ":", "arg_5", ".", "path", "=", "'/{0}/publishers/{1}/messages?api-version=2014-01'", ".", "format", "(", "arg_1", ",", "arg_3", ")", "else", ":", "arg_5", ".", "path", "=", "'/{0}/messages?api-version=2014-01'", ".", "format", "(", "arg_1", ")", "if", "arg_4", ":", "arg_5", ".", "headers", ".", "append", "(", "(", "'BrokerProperties'", ",", "str", "(", "arg_4", ")", ")", ")", "arg_5", ".", "body", "=", "_get_request_body", "(", "arg_2", ")", "arg_5", ".", "path", ",", "arg_5", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_5", ")", "arg_5", ".", "headers", "=", "arg_0", ".", "_update_service_bus_header", "(", "arg_5", ")", "arg_0", ".", "_perform_request", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None,\n                   arg_4=None):\n        '''\n        Sends a new message event to an Event Hub.\n        '''\n        _validate_not_none('hub_name', arg_1)\n        arg_5 = HTTPRequest()\n        arg_5.method = 'POST'\n        arg_5.host = arg_0._get_host()\n        if arg_3:\n            arg_5.path = '/{0}/publishers/{1}/messages?api-version=2014-01'.format(arg_1, arg_3)\n        else:\n            arg_5.path = '/{0}/messages?api-version=2014-01'.format(arg_1)\n        if arg_4:\n            arg_5.headers.append(\n                ('BrokerProperties', str(arg_4)))\n        arg_5.body = _get_request_body(arg_2)\n        arg_5.path, arg_5.query = arg_0._httpclient._update_request_uri_query(arg_5)  # pylint: disable=protected-access\n        arg_5.headers = arg_0._update_service_bus_header(arg_5)\n        arg_0._perform_request(arg_5)", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusService.send_event", "docstring": "Sends a new message event to an Event Hub.", "docstring_tokens": ["Sends", "a", "new", "message", "event", "to", "an", "Event", "Hub", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252085}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L733-L772", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Show Matchmaker submission data for a sample and eventual matches.", "language": "python", "parameters": "(case_obj, institute_obj, mme_base_url, mme_token)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "'institute'", ":", "arg_1", ",", "'case'", ":", "arg_0", ",", "'server_errors'", ":", "[", "]", "}", "arg_5", "=", "{", "}", "if", "not", "arg_0", ".", "get", "(", "'mme_submission'", ")", ":", "return", "None", "for", "arg_6", "in", "arg_0", "[", "'mme_submission'", "]", "[", "'patients'", "]", ":", "arg_7", "=", "arg_6", "[", "'id'", "]", "arg_5", "[", "arg_7", "]", "=", "None", "arg_8", "=", "''", ".", "join", "(", "[", "arg_2", ",", "'/matches/'", ",", "arg_7", "]", ")", "arg_9", "=", "matchmaker_request", "(", "arg_8", "=", "arg_8", ",", "token", "=", "arg_3", ",", "method", "=", "'GET'", ")", "if", "'status_code'", "in", "arg_9", ":", "arg_10", "=", "[", "]", "if", "arg_9", ".", "get", "(", "'matches'", ")", ":", "arg_10", "=", "parse_matches", "(", "arg_7", ",", "arg_9", "[", "'matches'", "]", ")", "arg_5", "[", "arg_7", "]", "=", "arg_10", "else", ":", "LOG", ".", "warning", "(", "'Server returned error message: {}'", ".", "format", "(", "arg_9", "[", "'message'", "]", ")", ")", "arg_4", "[", "'server_errors'", "]", ".", "append", "(", "arg_9", "[", "'message'", "]", ")", "arg_4", "[", "'matches'", "]", "=", "arg_5", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Show Matchmaker submission data for a sample and eventual matches.\n\n    Args:\n        case_obj(dict): a scout case object\n        institute_obj(dict): an institute object\n        mme_base_url(str) base url of the MME server\n        mme_token(str) auth token of the MME server\n\n    Returns:\n        data(dict): data to display in the html template\n    \"\"\"\n    arg_4 = {\n        'institute' : arg_1,\n        'case' : arg_0,\n        'server_errors' : []\n    }\n    arg_5 = {}\n    # loop over the submitted samples and get matches from the MatchMaker server\n    if not arg_0.get('mme_submission'):\n        return None\n\n    for arg_6 in arg_0['mme_submission']['patients']:\n        arg_7 = arg_6['id']\n        arg_5[arg_7] = None\n        arg_8 = ''.join([ arg_2, '/matches/', arg_7])\n        arg_9 = matchmaker_request(arg_8=arg_8, token=arg_3, method='GET')\n        if 'status_code' in arg_9: # the server returned a valid response\n            # and this will be a list of match objects sorted by desc date\n            arg_10 = []\n            if arg_9.get('matches'):\n                arg_10 = parse_matches(arg_7, arg_9['matches'])\n            arg_5[arg_7] = arg_10\n        else:\n            LOG.warning('Server returned error message: {}'.format(arg_9['message']))\n            arg_4['server_errors'].append(arg_9['message'])\n\n    arg_4['matches'] = arg_5\n\n    return arg_4", "path": "scout/server/blueprints/cases/controllers.py", "identifier": "mme_matches", "docstring": "Show Matchmaker submission data for a sample and eventual matches.\n\n    Args:\n        case_obj(dict): a scout case object\n        institute_obj(dict): an institute object\n        mme_base_url(str) base url of the MME server\n        mme_token(str) auth token of the MME server\n\n    Returns:\n        data(dict): data to display in the html template", "docstring_tokens": ["Show", "Matchmaker", "submission", "data", "for", "a", "sample", "and", "eventual", "matches", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252086}
{"url": "https://github.com/abau171/highfive/blob/07b3829331072035ab100d1d66deca3e8f3f372a/highfive/worker.py#L46-L54", "sha": "07b3829331072035ab100d1d66deca3e8f3f372a", "docstring_summary": "Starts an asyncio event loop to connect to the master and run jobs.", "language": "python", "parameters": "(job_handler, host, port)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "asyncio", ".", "new_event_loop", "(", ")", "asyncio", ".", "set_event_loop", "(", "None", ")", "arg_3", ".", "run_until_complete", "(", "handle_jobs", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", ")", "arg_3", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Starts an asyncio event loop to connect to the master and run jobs.\n    \"\"\"\n\n    arg_3 = asyncio.new_event_loop()\n    asyncio.set_event_loop(None)\n    arg_3.run_until_complete(handle_jobs(arg_0, arg_1, arg_2, arg_3=arg_3))\n    arg_3.close()", "path": "highfive/worker.py", "identifier": "worker_main", "docstring": "Starts an asyncio event loop to connect to the master and run jobs.", "docstring_tokens": ["Starts", "an", "asyncio", "event", "loop", "to", "connect", "to", "the", "master", "and", "run", "jobs", "."], "nwo": "abau171/highfive", "score": 0.14991498758945482, "idx": 252087}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/player.py#L213-L224", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Transfer playback to a new device and determine if it should start playing.", "language": "python", "parameters": "(self, device: SomeDevice, ensure_playback: bool = False)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", "=", "False", ")", ":", "await", "arg_0", ".", "_user", ".", "http", ".", "Func_player", "(", "str", "(", "arg_1", ")", ",", "play", "=", "arg_3", ")"], "function": "async def Func(arg_0, arg_1: arg_2, arg_3: arg_4 = False):\n        \"\"\"Transfer playback to a new device and determine if it should start playing.\n\n        Parameters\n        ----------\n        device : :obj:`SomeDevice`\n            The device on which playback should be started/Funcred.\n        ensure_playback : bool\n            if `True` ensure playback happens on new device.\n            else keep the current playback state.\n        \"\"\"\n        await arg_0._user.http.Func_player(str(arg_1), play=arg_3)", "path": "spotify/models/player.py", "identifier": "Player.transfer", "docstring": "Transfer playback to a new device and determine if it should start playing.\n\n        Parameters\n        ----------\n        device : :obj:`SomeDevice`\n            The device on which playback should be started/transferred.\n        ensure_playback : bool\n            if `True` ensure playback happens on new device.\n            else keep the current playback state.", "docstring_tokens": ["Transfer", "playback", "to", "a", "new", "device", "and", "determine", "if", "it", "should", "start", "playing", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 252088}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/carddav_object.py#L91-L95", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Use this to create a new and empty contact.", "language": "python", "parameters": "(cls, address_book, supported_private_objects, version,\n            localize_dates)", "return_statement": "return cls(address_book, None, supported_private_objects, version,\n                localize_dates)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "return", "arg_0", "(", "arg_1", ",", "None", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n            arg_4):\n        \"\"\"Use this to create a new and empty contact.\"\"\"\n        return arg_0(arg_1, None, arg_2, arg_3,\n                arg_4)", "path": "khard/carddav_object.py", "identifier": "CarddavObject.new_contact", "docstring": "Use this to create a new and empty contact.", "docstring_tokens": ["Use", "this", "to", "create", "a", "new", "and", "empty", "contact", "."], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 252089}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/query_encoder.py#L11-L25", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Convert an object to a form ready to dump to json.", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "return", "[", "]", "elif", "isinstance", "(", "arg_1", ",", "list", ")", ":", "return", "[", "arg_2", ".", "as_dictionary", "(", ")", "for", "arg_2", "in", "arg_1", "]", "elif", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "return", "arg_0", ".", "_keys_to_camel_case", "(", "arg_1", ")", "else", ":", "return", "arg_1", ".", "as_dictionary", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert an object to a form ready to dump to json.\n\n        :param obj: Object being serialized. The type of this object must be one of the following: None; a single object derived from the Pio class; or a list of objects, each derived from the Pio class.\n        :return: List of dictionaries, each representing a physical information object, ready to be serialized.\n        \"\"\"\n        if arg_1 is None:\n            return []\n        elif isinstance(arg_1, list):\n            return [arg_2.as_dictionary() for arg_2 in arg_1]\n        elif isinstance(arg_1, dict):\n            return arg_0._keys_to_camel_case(arg_1)\n        else:\n            return arg_1.as_dictionary()", "path": "citrination_client/search/query_encoder.py", "identifier": "QueryEncoder.default", "docstring": "Convert an object to a form ready to dump to json.\n\n        :param obj: Object being serialized. The type of this object must be one of the following: None; a single object derived from the Pio class; or a list of objects, each derived from the Pio class.\n        :return: List of dictionaries, each representing a physical information object, ready to be serialized.", "docstring_tokens": ["Convert", "an", "object", "to", "a", "form", "ready", "to", "dump", "to", "json", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 252090}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/acmg.py#L89-L100", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return all evaluations for a certain variant.", "language": "python", "parameters": "(self, variant_obj)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", "variant_id", "=", "arg_1", "[", "'variant_id'", "]", ")", "arg_3", "=", "arg_0", ".", "acmg_collection", ".", "find", "(", "arg_2", ")", ".", "sort", "(", "[", "(", "'created_at'", ",", "pymongo", ".", "DESCENDING", ")", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return all evaluations for a certain variant.\n\n        Args:\n            variant_obj (dict): variant dict from the database\n\n        Returns:\n            pymongo.cursor: database cursor\n        \"\"\"\n        arg_2 = dict(variant_id=arg_1['variant_id'])\n        arg_3 = arg_0.acmg_collection.find(arg_2).sort([('created_at', pymongo.DESCENDING)])\n        return arg_3", "path": "scout/adapter/mongo/acmg.py", "identifier": "ACMGHandler.get_evaluations", "docstring": "Return all evaluations for a certain variant.\n\n        Args:\n            variant_obj (dict): variant dict from the database\n\n        Returns:\n            pymongo.cursor: database cursor", "docstring_tokens": ["Return", "all", "evaluations", "for", "a", "certain", "variant", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252091}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/BpmnScriptEngine.py#L47-L52", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Execute the script, within the context of the specified task", "language": "python", "parameters": "(self, task, script, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "locals", "(", ")", ".", "update", "(", "arg_3", ")", "exec", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"\n        Execute the script, within the context of the specified task\n        \"\"\"\n        locals().update(arg_3)\n        exec(arg_2)", "path": "SpiffWorkflow/bpmn/BpmnScriptEngine.py", "identifier": "BpmnScriptEngine.execute", "docstring": "Execute the script, within the context of the specified task", "docstring_tokens": ["Execute", "the", "script", "within", "the", "context", "of", "the", "specified", "task"], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 252092}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/transport.py#L367-L381", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Callback for the utility messages", "language": "python", "parameters": "(self, res, err, conn, cmd, arg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "'FAIL'", "if", "arg_2", "==", "FAIL_REASON", ".", "SUCCESS", ":", "arg_6", "=", "'SUCCESS'", "arg_3", ".", "send", "(", "arg_6", "+", "' '", "+", "arg_4", "+", "' '", "+", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"\n        Callback for the utility messages\n\n        :param res: result of the command\n        :param err: error code (one of pysyncobj.config.FAIL_REASON)\n        :param conn: utility connection\n        :param cmd: command\n        :param arg: command arguments\n        \"\"\"\n\n        arg_6 = 'FAIL'\n        if arg_2 == FAIL_REASON.SUCCESS:\n            arg_6 = 'SUCCESS'\n        arg_3.send(arg_6 + ' ' + arg_4 + ' ' + arg_5)", "path": "pysyncobj/transport.py", "identifier": "TCPTransport._utilityCallback", "docstring": "Callback for the utility messages\n\n        :param res: result of the command\n        :param err: error code (one of pysyncobj.config.FAIL_REASON)\n        :param conn: utility connection\n        :param cmd: command\n        :param arg: command arguments", "docstring_tokens": ["Callback", "for", "the", "utility", "messages"], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 252093}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1611-L1623", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Injects the URL defaults for the given endpoint directly into\n        the values dictionary passed.  This is used internally and\n        automatically called on URL building.", "language": "python", "parameters": "(self, endpoint, values)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "url_default_functions", ".", "get", "(", "None", ",", "(", ")", ")", "if", "'.'", "in", "arg_1", ":", "arg_4", "=", "arg_1", ".", "rsplit", "(", "'.'", ",", "1", ")", "[", "0", "]", "arg_3", "=", "chain", "(", "arg_3", ",", "arg_0", ".", "url_default_functions", ".", "get", "(", "arg_4", ",", "(", ")", ")", ")", "for", "arg_5", "in", "arg_3", ":", "arg_5", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Injects the URL defaults for the given endpoint directly into\n        the values dictionary passed.  This is used internally and\n        automatically called on URL building.\n\n        .. versionadded:: 0.7\n        \"\"\"\n        arg_3 = arg_0.url_default_functions.get(None, ())\n        if '.' in arg_1:\n            arg_4 = arg_1.rsplit('.', 1)[0]\n            arg_3 = chain(arg_3, arg_0.url_default_functions.get(arg_4, ()))\n        for arg_5 in arg_3:\n            arg_5(arg_1, arg_2)", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/app.py", "identifier": "Flask.inject_url_defaults", "docstring": "Injects the URL defaults for the given endpoint directly into\n        the values dictionary passed.  This is used internally and\n        automatically called on URL building.\n\n        .. versionadded:: 0.7", "docstring_tokens": ["Injects", "the", "URL", "defaults", "for", "the", "given", "endpoint", "directly", "into", "the", "values", "dictionary", "passed", ".", "This", "is", "used", "internally", "and", "automatically", "called", "on", "URL", "building", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252094}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L237-L250", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Called when the tab key is pressed. Returns whether to continue\n            processing the event.", "language": "python", "parameters": "(self)", "return_statement": "return not complete", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_input_buffer_cursor_line", "(", ")", "if", "arg_1", "is", "None", ":", "return", "False", "arg_2", "=", "bool", "(", "arg_1", "[", ":", "arg_0", ".", "_get_input_buffer_cursor_column", "(", ")", "]", ".", "strip", "(", ")", ")", "if", "arg_2", ":", "arg_0", ".", "_complete", "(", ")", "return", "not", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" Called when the tab key is pressed. Returns whether to continue\n            processing the event.\n        \"\"\"\n        # Perform tab completion if:\n        # 1) The cursor is in the input buffer.\n        # 2) There is a non-whitespace character before the cursor.\n        arg_1 = arg_0._get_input_buffer_cursor_line()\n        if arg_1 is None:\n            return False\n        arg_2 = bool(arg_1[:arg_0._get_input_buffer_cursor_column()].strip())\n        if arg_2:\n            arg_0._complete()\n        return not arg_2", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._tab_pressed", "docstring": "Called when the tab key is pressed. Returns whether to continue\n            processing the event.", "docstring_tokens": ["Called", "when", "the", "tab", "key", "is", "pressed", ".", "Returns", "whether", "to", "continue", "processing", "the", "event", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252095}
{"url": "https://github.com/linuxwhatelse/mapper/blob/3481715b2a36d2da8bf5e9c6da80ceaed0d7ca59/mapper.py#L64-L84", "sha": "3481715b2a36d2da8bf5e9c6da80ceaed0d7ca59", "docstring_summary": "Decorator for registering a path pattern.", "language": "python", "parameters": "(self, pattern, method=None, type_cast=None)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "not", "arg_3", ":", "arg_3", "=", "{", "}", "def", "decorator", "(", "arg_4", ")", ":", "arg_0", ".", "add", "(", "arg_1", ",", "arg_4", ",", "arg_2", ",", "arg_3", ")", "return", "arg_4", "return", "decorator"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Decorator for registering a path pattern.\n\n        Args:\n            pattern (str): Regex pattern to match a certain path\n            method (str, optional): Usually used to define one of GET, POST,\n                PUT, DELETE. You may use whatever fits your situation though.\n                Defaults to None.\n            type_cast (dict, optional): Mapping between the param name and\n                one of `int`, `float` or `bool`. The value reflected by the\n                provided param name will than be casted to the given type.\n                Defaults to None.\n        \"\"\"\n        if not arg_3:\n            arg_3 = {}\n\n        def decorator(arg_4):\n            arg_0.add(arg_1, arg_4, arg_2, arg_3)\n            return arg_4\n\n        return decorator", "path": "mapper.py", "identifier": "Mapper.url", "docstring": "Decorator for registering a path pattern.\n\n        Args:\n            pattern (str): Regex pattern to match a certain path\n            method (str, optional): Usually used to define one of GET, POST,\n                PUT, DELETE. You may use whatever fits your situation though.\n                Defaults to None.\n            type_cast (dict, optional): Mapping between the param name and\n                one of `int`, `float` or `bool`. The value reflected by the\n                provided param name will than be casted to the given type.\n                Defaults to None.", "docstring_tokens": ["Decorator", "for", "registering", "a", "path", "pattern", "."], "nwo": "linuxwhatelse/mapper", "score": 0.0, "idx": 252096}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/views.py#L69-L91", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "List all user memberships.", "language": "python", "parameters": "()", "return_statement": "return render_template(\n        'invenio_groups/index.html',\n        groups=groups,\n        requests=requests,\n        invitations=invitations,\n        page=page,\n        per_page=per_page,\n        q=q\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "request", ".", "args", ".", "get", "(", "'page'", ",", "1", ",", "type", "=", "int", ")", "arg_1", "=", "request", ".", "args", ".", "get", "(", "'per_page'", ",", "5", ",", "type", "=", "int", ")", "arg_2", "=", "request", ".", "args", ".", "get", "(", "'q'", ",", "''", ")", "arg_3", "=", "Group", ".", "query_by_user", "(", "current_user", ",", "eager", "=", "True", ")", "if", "arg_2", ":", "arg_3", "=", "Group", ".", "search", "(", "arg_3", ",", "arg_2", ")", "arg_3", "=", "arg_3", ".", "paginate", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_4", "=", "Membership", ".", "query_requests", "(", "current_user", ")", ".", "count", "(", ")", "arg_5", "=", "Membership", ".", "query_invitations", "(", "current_user", ")", ".", "count", "(", ")", "return", "render_template", "(", "'invenio_groups/Func.html'", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func():\n    \"\"\"List all user memberships.\"\"\"\n    arg_0 = request.args.get('page', 1, type=int)\n    arg_1 = request.args.get('per_page', 5, type=int)\n    arg_2 = request.args.get('q', '')\n\n    arg_3 = Group.query_by_user(current_user, eager=True)\n    if arg_2:\n        arg_3 = Group.search(arg_3, arg_2)\n    arg_3 = arg_3.paginate(arg_0, arg_1=arg_1)\n\n    arg_4 = Membership.query_requests(current_user).count()\n    arg_5 = Membership.query_invitations(current_user).count()\n\n    return render_template(\n        'invenio_groups/Func.html',\n        arg_3=arg_3,\n        arg_4=arg_4,\n        arg_5=arg_5,\n        arg_0=arg_0,\n        arg_1=arg_1,\n        arg_2=arg_2\n    )", "path": "invenio_groups/views.py", "identifier": "index", "docstring": "List all user memberships.", "docstring_tokens": ["List", "all", "user", "memberships", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 252097}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/namespace.py#L411-L460", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "Use this to send a structured event, with a name and arguments, to\n        the client.", "language": "python", "parameters": "(self, event, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "pop", "(", "'callback'", ",", "None", ")", "if", "arg_3", ":", "raise", "ValueError", "(", "\"Func() only supports positional argument, to stay \"", "\"compatible with the Socket.IO protocol. You can \"", "\"however pass in a dictionary as the first argument\"", ")", "arg_5", "=", "dict", "(", "type", "=", "\"event\"", ",", "name", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "endpoint", "=", "arg_0", ".", "ns_name", ")", "if", "arg_4", ":", "arg_5", "[", "'ack'", "]", "=", "'data'", "arg_5", "[", "'id'", "]", "=", "msgid", "=", "arg_0", ".", "socket", ".", "_get_next_msgid", "(", ")", "arg_0", ".", "socket", ".", "_save_ack_callback", "(", "msgid", ",", "arg_4", ")", "arg_0", ".", "socket", ".", "send_packet", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Use this to send a structured event, with a name and arguments, to\n        the client.\n\n        By default, it uses this namespace's endpoint. You can send messages on\n        other endpoints with something like:\n\n            ``self.socket['/other_endpoint'].Func()``.\n\n        However, it is possible that the ``'/other_endpoint'`` was not\n        initialized yet, and that would yield a ``KeyError``.\n\n        The only supported ``kwargs`` is ``callback``.  All other parameters\n        must be passed positionally.\n\n        :param event: The name of the event to trigger on the other end.\n        :param callback: Pass in the callback keyword argument to define a\n                         call-back that will be called when the client acks.\n\n                         This callback is slightly different from the one from\n                         ``send()``, as this callback will receive parameters\n                         from the explicit call of the ``ack()`` function\n                         passed to the listener on the client side.\n\n                         The remote listener will need to explicitly ack (by\n                         calling its last argument, a function which is\n                         usually called 'ack') with some parameters indicating\n                         success or error.  The 'ack' packet coming back here\n                         will then trigger the callback function with the\n                         returned values.\n        :type callback: callable\n        \"\"\"\n        arg_4 = arg_3.pop('callback', None)\n\n        if arg_3:\n            raise ValueError(\n                \"Func() only supports positional argument, to stay \"\n                \"compatible with the Socket.IO protocol. You can \"\n                \"however pass in a dictionary as the first argument\")\n        arg_5 = dict(type=\"event\", name=arg_1, arg_2=arg_2,\n                   endpoint=arg_0.ns_name)\n\n        if arg_4:\n            # By passing 'data', we indicate that we *want* an explicit ack\n            # by the client code, not an automatic as with send().\n            arg_5['ack'] = 'data'\n            arg_5['id'] = msgid = arg_0.socket._get_next_msgid()\n            arg_0.socket._save_ack_callback(msgid, arg_4)\n\n        arg_0.socket.send_packet(arg_5)", "path": "socketio/namespace.py", "identifier": "BaseNamespace.emit", "docstring": "Use this to send a structured event, with a name and arguments, to\n        the client.\n\n        By default, it uses this namespace's endpoint. You can send messages on\n        other endpoints with something like:\n\n            ``self.socket['/other_endpoint'].emit()``.\n\n        However, it is possible that the ``'/other_endpoint'`` was not\n        initialized yet, and that would yield a ``KeyError``.\n\n        The only supported ``kwargs`` is ``callback``.  All other parameters\n        must be passed positionally.\n\n        :param event: The name of the event to trigger on the other end.\n        :param callback: Pass in the callback keyword argument to define a\n                         call-back that will be called when the client acks.\n\n                         This callback is slightly different from the one from\n                         ``send()``, as this callback will receive parameters\n                         from the explicit call of the ``ack()`` function\n                         passed to the listener on the client side.\n\n                         The remote listener will need to explicitly ack (by\n                         calling its last argument, a function which is\n                         usually called 'ack') with some parameters indicating\n                         success or error.  The 'ack' packet coming back here\n                         will then trigger the callback function with the\n                         returned values.\n        :type callback: callable", "docstring_tokens": ["Use", "this", "to", "send", "a", "structured", "event", "with", "a", "name", "and", "arguments", "to", "the", "client", "."], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 252098}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/pandoc/convert.py#L132-L194", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Convert lsstdoc-class LaTeX to another markup format.", "language": "python", "parameters": "(\n        content, to_fmt, deparagraph=False, mathjax=False,\n        smart=True, extra_args=None)", "return_statement": "return convert_text(\n        augmented_content, 'latex', to_fmt,\n        deparagraph=deparagraph, mathjax=mathjax,\n        smart=smart, extra_args=extra_args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "'\\n'", ".", "join", "(", "(", "LSSTDOC_MACROS", ",", "arg_0", ")", ")", "return", "convert_text", "(", "arg_6", ",", "'latex'", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(\n        arg_0, arg_1, arg_2=False, arg_3=False,\n        arg_4=True, arg_5=None):\n    \"\"\"Convert lsstdoc-class LaTeX to another markup format.\n\n    This function is a thin wrapper around `convert_text` that automatically\n    includes common lsstdoc LaTeX macros.\n\n    Parameters\n    ----------\n    content : `str`\n        Original content.\n\n    to_fmt : `str`\n        Output format for the content (see https://pandoc.org/MANUAL.html).\n        For example, 'html5'.\n\n    deparagraph : `bool`, optional\n        If `True`, then the\n        `lsstprojectmeta.pandoc.filters.deparagraph.deparagraph` filter is\n        used to remove paragraph (``<p>``, for example) tags around a single\n        paragraph of content. That filter does not affect content that\n        consists of multiple blocks (several paragraphs, or lists, for\n        example). Default is `False`.\n\n        For example, **without** this filter Pandoc will convert\n        the string ``\"Title text\"`` to ``\"<p>Title text</p>\"`` in HTML. The\n        paragraph tags aren't useful if you intend to wrap the converted\n        content in different tags, like ``<h1>``, using your own templating\n        system.\n\n        **With** this filter, Pandoc will convert the string ``\"Title text\"``\n        to ``\"Title text\"`` in HTML.\n\n    mathjax : `bool`, optional\n        If `True` then Pandoc will markup output content to work with MathJax.\n        Default is False.\n\n    smart : `bool`, optional\n        If `True` (default) then ascii characters will be converted to unicode\n        characters like smart quotes and em dashes.\n\n    extra_args : `list`, optional\n        Sequence of Pandoc arguments command line arguments (such as\n        ``'--normalize'``). The ``deparagraph``, ``mathjax``, and ``smart``\n        arguments are convenience arguments that are equivalent to items\n        in ``extra_args``.\n\n    Returns\n    -------\n    output : `str`\n        Content in the output (``to_fmt``) format.\n\n    Notes\n    -----\n    This function will automatically install Pandoc if it is not available.\n    See `ensure_pandoc`.\n    \"\"\"\n    arg_6 = '\\n'.join((LSSTDOC_MACROS, arg_0))\n    return convert_text(\n        arg_6, 'latex', arg_1,\n        arg_2=arg_2, arg_3=arg_3,\n        arg_4=arg_4, arg_5=arg_5)", "path": "lsstprojectmeta/pandoc/convert.py", "identifier": "convert_lsstdoc_tex", "docstring": "Convert lsstdoc-class LaTeX to another markup format.\n\n    This function is a thin wrapper around `convert_text` that automatically\n    includes common lsstdoc LaTeX macros.\n\n    Parameters\n    ----------\n    content : `str`\n        Original content.\n\n    to_fmt : `str`\n        Output format for the content (see https://pandoc.org/MANUAL.html).\n        For example, 'html5'.\n\n    deparagraph : `bool`, optional\n        If `True`, then the\n        `lsstprojectmeta.pandoc.filters.deparagraph.deparagraph` filter is\n        used to remove paragraph (``<p>``, for example) tags around a single\n        paragraph of content. That filter does not affect content that\n        consists of multiple blocks (several paragraphs, or lists, for\n        example). Default is `False`.\n\n        For example, **without** this filter Pandoc will convert\n        the string ``\"Title text\"`` to ``\"<p>Title text</p>\"`` in HTML. The\n        paragraph tags aren't useful if you intend to wrap the converted\n        content in different tags, like ``<h1>``, using your own templating\n        system.\n\n        **With** this filter, Pandoc will convert the string ``\"Title text\"``\n        to ``\"Title text\"`` in HTML.\n\n    mathjax : `bool`, optional\n        If `True` then Pandoc will markup output content to work with MathJax.\n        Default is False.\n\n    smart : `bool`, optional\n        If `True` (default) then ascii characters will be converted to unicode\n        characters like smart quotes and em dashes.\n\n    extra_args : `list`, optional\n        Sequence of Pandoc arguments command line arguments (such as\n        ``'--normalize'``). The ``deparagraph``, ``mathjax``, and ``smart``\n        arguments are convenience arguments that are equivalent to items\n        in ``extra_args``.\n\n    Returns\n    -------\n    output : `str`\n        Content in the output (``to_fmt``) format.\n\n    Notes\n    -----\n    This function will automatically install Pandoc if it is not available.\n    See `ensure_pandoc`.", "docstring_tokens": ["Convert", "lsstdoc", "-", "class", "LaTeX", "to", "another", "markup", "format", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 252099}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/loader.py#L675-L696", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Load multiple Python config files, merging each of them in turn.", "language": "python", "parameters": "(config_files, path)", "return_statement": "return config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Config", "(", ")", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "PyFileConfigLoader", "(", "arg_3", ",", "arg_1", "=", "arg_1", ")", "try", ":", "arg_5", "=", "arg_4", ".", "load_config", "(", ")", "except", "ConfigFileNotFound", ":", "pass", "except", ":", "raise", "else", ":", "arg_2", ".", "_merge", "(", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Load multiple Python config files, merging each of them in turn.\n\n    Parameters\n    ==========\n    config_files : list of str\n        List of config files names to load and merge into the config.\n    path : unicode\n        The full path to the location of the config files.\n    \"\"\"\n    arg_2 = Config()\n    for arg_3 in arg_0:\n        arg_4 = PyFileConfigLoader(arg_3, arg_1=arg_1)\n        try:\n            arg_5 = arg_4.load_config()\n        except ConfigFileNotFound:\n            pass\n        except:\n            raise\n        else:\n            arg_2._merge(arg_5)\n    return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/config/loader.py", "identifier": "load_pyconfig_files", "docstring": "Load multiple Python config files, merging each of them in turn.\n\n    Parameters\n    ==========\n    config_files : list of str\n        List of config files names to load and merge into the config.\n    path : unicode\n        The full path to the location of the config files.", "docstring_tokens": ["Load", "multiple", "Python", "config", "files", "merging", "each", "of", "them", "in", "turn", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252100}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/query.py#L736-L764", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Create a generator of decrypted remote checkpoints.", "language": "python", "parameters": "(engine, crypto_factory, min_dt=None, max_dt=None,\n                         logger=None)", "return_statement": "return _generate_notebooks(remote_checkpoints,\n                               remote_checkpoints.c.last_modified,\n                               engine, crypto_factory, min_dt, max_dt, logger)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "return", "_generate_notebooks", "(", "remote_checkpoints", ",", "remote_checkpoints", ".", "c", ".", "last_modified", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                         arg_4=None):\n    \"\"\"\n    Create a generator of decrypted remote checkpoints.\n\n    Checkpoints are yielded in ascending order of their timestamp.\n\n    This function selects all notebook checkpoints (optionally, falling within\n    a datetime range), decrypts them, and returns a generator yielding dicts,\n    each containing a decoded notebook and metadata including the user,\n    filepath, and timestamp.\n\n    Parameters\n    ----------\n    engine : SQLAlchemy.engine\n        Engine encapsulating database connections.\n    crypto_factory : function[str -> Any]\n        A function from user_id to an object providing the interface required\n        by PostgresContentsManager.crypto.  Results of this will be used for\n        decryption of the selected notebooks.\n    min_dt : datetime.datetime, optional\n        Minimum last modified datetime at which a file will be included.\n    max_dt : datetime.datetime, optional\n        Last modified datetime at and after which a file will be excluded.\n    logger : Logger, optional\n    \"\"\"\n    return _generate_notebooks(remote_checkpoints,\n                               remote_checkpoints.c.last_modified,\n                               arg_0, arg_1, arg_2, arg_3, arg_4)", "path": "pgcontents/query.py", "identifier": "generate_checkpoints", "docstring": "Create a generator of decrypted remote checkpoints.\n\n    Checkpoints are yielded in ascending order of their timestamp.\n\n    This function selects all notebook checkpoints (optionally, falling within\n    a datetime range), decrypts them, and returns a generator yielding dicts,\n    each containing a decoded notebook and metadata including the user,\n    filepath, and timestamp.\n\n    Parameters\n    ----------\n    engine : SQLAlchemy.engine\n        Engine encapsulating database connections.\n    crypto_factory : function[str -> Any]\n        A function from user_id to an object providing the interface required\n        by PostgresContentsManager.crypto.  Results of this will be used for\n        decryption of the selected notebooks.\n    min_dt : datetime.datetime, optional\n        Minimum last modified datetime at which a file will be included.\n    max_dt : datetime.datetime, optional\n        Last modified datetime at and after which a file will be excluded.\n    logger : Logger, optional", "docstring_tokens": ["Create", "a", "generator", "of", "decrypted", "remote", "checkpoints", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 252101}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Telegraf/plugin.py#L284-L304", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "store metric in data tree and calc offset signs", "language": "python", "parameters": "(self, host, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "iteritems", "(", ")", ":", "if", "arg_4", "==", "''", ":", "arg_0", ".", "sign", "[", "arg_1", "]", "[", "arg_3", "]", "=", "-", "1", "arg_0", ".", "data", "[", "arg_1", "]", "[", "arg_3", "]", "=", "arg_4", "else", ":", "if", "not", "arg_0", ".", "data", "[", "arg_1", "]", ".", "get", "(", "arg_3", ",", "None", ")", ":", "arg_0", ".", "sign", "[", "arg_1", "]", "[", "arg_3", "]", "=", "1", "elif", "float", "(", "arg_4", ")", ">", "float", "(", "arg_0", ".", "data", "[", "arg_1", "]", "[", "arg_3", "]", ")", ":", "arg_0", ".", "sign", "[", "arg_1", "]", "[", "arg_3", "]", "=", "1", "elif", "float", "(", "arg_4", ")", "<", "float", "(", "arg_0", ".", "data", "[", "arg_1", "]", "[", "arg_3", "]", ")", ":", "arg_0", ".", "sign", "[", "arg_1", "]", "[", "arg_3", "]", "=", "-", "1", "else", ":", "arg_0", ".", "sign", "[", "arg_1", "]", "[", "arg_3", "]", "=", "0", "arg_0", ".", "data", "[", "arg_1", "]", "[", "arg_3", "]", "=", "\"%.2f\"", "%", "float", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" store metric in data tree and calc offset signs\n\n        sign < 0 is CYAN, means metric value is lower then previous,\n        sign > 1 is YELLOW, means metric value is higher then prevoius,\n        sign == 0 is WHITE, means initial or equal metric value\n        \"\"\"\n        for arg_3, arg_4 in arg_2.iteritems():\n            if arg_4 == '':\n                arg_0.sign[arg_1][arg_3] = -1\n                arg_0.data[arg_1][arg_3] = arg_4\n            else:\n                if not arg_0.data[arg_1].get(arg_3, None):\n                    arg_0.sign[arg_1][arg_3] = 1\n                elif float(arg_4) > float(arg_0.data[arg_1][arg_3]):\n                    arg_0.sign[arg_1][arg_3] = 1\n                elif float(arg_4) < float(arg_0.data[arg_1][arg_3]):\n                    arg_0.sign[arg_1][arg_3] = -1\n                else:\n                    arg_0.sign[arg_1][arg_3] = 0\n                arg_0.data[arg_1][arg_3] = \"%.2f\" % float(arg_4)", "path": "yandextank/plugins/Telegraf/plugin.py", "identifier": "MonitoringWidget.__handle_data_items", "docstring": "store metric in data tree and calc offset signs\n\n        sign < 0 is CYAN, means metric value is lower then previous,\n        sign > 1 is YELLOW, means metric value is higher then prevoius,\n        sign == 0 is WHITE, means initial or equal metric value", "docstring_tokens": ["store", "metric", "in", "data", "tree", "and", "calc", "offset", "signs"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 252102}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/people.py#L298-L309", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Get the details of the person accessing the API.", "language": "python", "parameters": "(self)", "return_statement": "return self._object_factory(OBJECT_TYPE, json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_session", ".", "get", "(", "API_ENDPOINT", "+", "'/Func'", ")", "return", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Get the details of the person accessing the API.\n\n        Raises:\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        # API request\n        arg_1 = arg_0._session.get(API_ENDPOINT + '/Func')\n\n        # Return a person object created from the response JSON data\n        return arg_0._object_factory(OBJECT_TYPE, arg_1)", "path": "webexteamssdk/api/people.py", "identifier": "PeopleAPI.me", "docstring": "Get the details of the person accessing the API.\n\n        Raises:\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Get", "the", "details", "of", "the", "person", "accessing", "the", "API", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 252103}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1373-L1377", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check unreachable code", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "next_sibling", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "add_message", "(", "\"unreachable\"", ",", "arg_1", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"check unreachable code\"\"\"\n        arg_2 = arg_1.next_sibling()\n        if arg_2 is not None:\n            arg_0.add_message(\"unreachable\", arg_1=arg_2)", "path": "pylint/checkers/base.py", "identifier": "BasicChecker._check_unreachable", "docstring": "check unreachable code", "docstring_tokens": ["check", "unreachable", "code"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252104}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L997-L1002", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "stop background spin_thread, if any", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_spin_thread", "is", "not", "None", ":", "arg_0", ".", "_stop_spinning", ".", "set", "(", ")", "arg_0", ".", "_spin_thread", ".", "join", "(", ")", "arg_0", ".", "_spin_thread", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"stop background spin_thread, if any\"\"\"\n        if arg_0._spin_thread is not None:\n            arg_0._stop_spinning.set()\n            arg_0._spin_thread.join()\n            arg_0._spin_thread = None", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client.stop_spin_thread", "docstring": "stop background spin_thread, if any", "docstring_tokens": ["stop", "background", "spin_thread", "if", "any"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252105}
{"url": "https://github.com/agabrown/PyGaia/blob/ae972b0622a15f713ffae471f925eac25ccdae47/pygaia/errors/astrometric.py#L28-L54", "sha": "ae972b0622a15f713ffae471f925eac25ccdae47", "docstring_summary": "Look up the numerical factors to apply to the sky averaged parallax error in order to obtain error\n  values for a given astrometric parameter, taking the Ecliptic latitude and the number of transits into\n  account.", "language": "python", "parameters": "(observable, beta)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isscalar", "(", "arg_1", ")", ":", "arg_2", "=", "int", "(", "floor", "(", "abs", "(", "sin", "(", "arg_1", ")", ")", "*", "arg_4", ")", ")", "if", "arg_2", "==", "arg_4", ":", "return", "_astrometricErrorFactors", "[", "arg_0", "]", "[", "arg_4", "-", "1", "]", "else", ":", "return", "_astrometricErrorFactors", "[", "arg_0", "]", "[", "arg_2", "]", "else", ":", "arg_3", "=", "array", "(", "floor", "(", "abs", "(", "sin", "(", "arg_1", ")", ")", "*", "arg_4", ")", ",", "dtype", "=", "int", ")", "arg_3", "[", "(", "arg_3", "==", "arg_4", ")", "]", "=", "arg_4", "-", "1", "return", "_astrometricErrorFactors", "[", "arg_0", "]", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1):\n  \"\"\"\n  Look up the numerical factors to apply to the sky averaged parallax error in order to obtain error\n  values for a given astrometric parameter, taking the Ecliptic latitude and the number of transits into\n  account.\n\n  Parameters\n  ----------\n\n  observable - Name of astrometric observable (one of: alphaStar, delta, parallax, muAlphaStar, muDelta)\n  beta       - Values(s) of the Ecliptic latitude.\n\n  Returns\n  -------\n\n  Numerical factors to apply to the errors of the given observable.\n  \"\"\"\n  if isscalar(arg_1):\n    arg_2=int(floor(abs(sin(arg_1))*arg_4))\n    if arg_2 == arg_4:\n      return _astrometricErrorFactors[arg_0][arg_4-1]\n    else:\n      return _astrometricErrorFactors[arg_0][arg_2]\n  else:\n    arg_3 = array(floor(abs(sin(arg_1))*arg_4), dtype=int)\n    arg_3[(arg_3==arg_4)] = arg_4-1\n    return _astrometricErrorFactors[arg_0][arg_3]", "path": "pygaia/errors/astrometric.py", "identifier": "errorScalingFactor", "docstring": "Look up the numerical factors to apply to the sky averaged parallax error in order to obtain error\n  values for a given astrometric parameter, taking the Ecliptic latitude and the number of transits into\n  account.\n\n  Parameters\n  ----------\n\n  observable - Name of astrometric observable (one of: alphaStar, delta, parallax, muAlphaStar, muDelta)\n  beta       - Values(s) of the Ecliptic latitude.\n\n  Returns\n  -------\n\n  Numerical factors to apply to the errors of the given observable.", "docstring_tokens": ["Look", "up", "the", "numerical", "factors", "to", "apply", "to", "the", "sky", "averaged", "parallax", "error", "in", "order", "to", "obtain", "error", "values", "for", "a", "given", "astrometric", "parameter", "taking", "the", "Ecliptic", "latitude", "and", "the", "number", "of", "transits", "into", "account", "."], "nwo": "agabrown/PyGaia", "score": 0.39410601089411446, "idx": 252106}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L485-L498", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets the annotation SPDX Identifier.\n        Raises CardinalityError if already set. OrderError if no annotator\n        defined before.", "language": "python", "parameters": "(self, doc, spdx_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_1", ".", "annotations", ")", "!=", "0", ":", "if", "not", "arg_0", ".", "annotation_spdx_id_set", ":", "arg_0", ".", "annotation_spdx_id_set", "=", "True", "arg_1", ".", "annotations", "[", "-", "1", "]", ".", "spdx_id", "=", "arg_2", "return", "True", "else", ":", "raise", "CardinalityError", "(", "'Annotation::SPDXREF'", ")", "else", ":", "raise", "OrderError", "(", "'Annotation::SPDXREF'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets the annotation SPDX Identifier.\n        Raises CardinalityError if already set. OrderError if no annotator\n        defined before.\n        \"\"\"\n        if len(arg_1.annotations) != 0:\n            if not arg_0.annotation_spdx_id_set:\n                arg_0.annotation_spdx_id_set = True\n                arg_1.annotations[-1].spdx_id = arg_2\n                return True\n            else:\n                raise CardinalityError('Annotation::SPDXREF')\n        else:\n            raise OrderError('Annotation::SPDXREF')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "AnnotationBuilder.set_annotation_spdx_id", "docstring": "Sets the annotation SPDX Identifier.\n        Raises CardinalityError if already set. OrderError if no annotator\n        defined before.", "docstring_tokens": ["Sets", "the", "annotation", "SPDX", "Identifier", ".", "Raises", "CardinalityError", "if", "already", "set", ".", "OrderError", "if", "no", "annotator", "defined", "before", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 252107}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/docmaker/content.py#L389-L418", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "process a block content and return a list of DocMarkup objects\n           corresponding to it", "language": "python", "parameters": "( self, content )", "return_statement": "return self.markups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "arg_3", "=", "[", "]", "arg_4", "=", "1", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "None", "for", "arg_7", "in", "re_markup_tags", ":", "arg_8", "=", "arg_7", ".", "match", "(", "arg_5", ")", "if", "arg_8", ":", "arg_6", "=", "string", ".", "lower", "(", "arg_8", ".", "group", "(", "1", ")", ")", "arg_9", "=", "len", "(", "arg_8", ".", "group", "(", "0", ")", ")", "arg_5", "=", "\" \"", "*", "arg_9", "+", "arg_5", "[", "arg_9", ":", "]", "break", "if", "arg_6", ":", "arg_4", "=", "0", "arg_0", ".", "add_markup", "(", ")", "arg_0", ".", "markup", "=", "arg_6", "if", "len", "(", "string", ".", "strip", "(", "arg_5", ")", ")", ">", "0", ":", "arg_0", ".", "markup_lines", ".", "append", "(", "arg_5", ")", "elif", "arg_4", "==", "0", ":", "arg_0", ".", "markup_lines", ".", "append", "(", "arg_5", ")", "arg_0", ".", "add_markup", "(", ")", "return", "arg_0", ".", "markups"], "function": "def  Func( arg_0, arg_1 ):\n        \"\"\"process a block content and return a list of DocMarkup objects\n           corresponding to it\"\"\"\n        arg_2       = None\n        arg_3 = []\n        arg_4        = 1\n\n        for arg_5 in arg_1:\n            arg_6 = None\n            for arg_7 in re_markup_tags:\n                arg_8 = arg_7.match( arg_5 )\n                if arg_8:\n                    arg_6  = string.lower( arg_8.group( 1 ) )\n                    arg_9 = len( arg_8.group( 0 ) )\n                    arg_5   = \" \" * arg_9 + arg_5[arg_9:]   # remove markup from line\n                    break\n\n            # is it the start of a new markup section ?\n            if arg_6:\n                arg_4 = 0\n                arg_0.add_markup()  # add current markup content\n                arg_0.markup = arg_6\n                if len( string.strip( arg_5 ) ) > 0:\n                    arg_0.markup_lines.append( arg_5 )\n            elif arg_4 == 0:\n                arg_0.markup_lines.append( arg_5 )\n\n        arg_0.add_markup()\n\n        return arg_0.markups", "path": "native/Vendor/FreeType/src/tools/docmaker/content.py", "identifier": "ContentProcessor.process_content", "docstring": "process a block content and return a list of DocMarkup objects\n           corresponding to it", "docstring_tokens": ["process", "a", "block", "content", "and", "return", "a", "list", "of", "DocMarkup", "objects", "corresponding", "to", "it"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 252108}
{"url": "https://github.com/ecometrica/grandfatherson/blob/b166e4e44887960c3066ebd28eecadfae19561e1/grandfatherson/__init__.py#L210-L222", "sha": "b166e4e44887960c3066ebd28eecadfae19561e1", "docstring_summary": "Return a set of date that should be deleted, out of ``dates``.", "language": "python", "parameters": "(dates,\n                    years=0, months=0, weeks=0, days=0, firstweekday=SATURDAY,\n                    now=None)", "return_statement": "return dates - dates_to_keep(dates,\n                                 years=years, months=months,\n                                 weeks=weeks, days=days,\n                                 firstweekday=firstweekday, now=now)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ",", "arg_5", "=", "arg_6", ",", "arg_7", "=", "None", ")", ":", "arg_0", "=", "set", "(", "arg_0", ")", "return", "arg_0", "-", "dates_to_keep", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0,\n                    arg_1=0, arg_2=0, arg_3=0, arg_4=0, arg_5=arg_6,\n                    arg_7=None):\n    \"\"\"\n    Return a set of date that should be deleted, out of ``dates``.\n\n    See ``to_keep`` for a description of arguments.\n    \"\"\"\n    arg_0 = set(arg_0)\n    return arg_0 - dates_to_keep(arg_0,\n                                 arg_1=arg_1, arg_2=arg_2,\n                                 arg_3=arg_3, arg_4=arg_4,\n                                 arg_5=arg_5, arg_7=arg_7)", "path": "grandfatherson/__init__.py", "identifier": "dates_to_delete", "docstring": "Return a set of date that should be deleted, out of ``dates``.\n\n    See ``to_keep`` for a description of arguments.", "docstring_tokens": ["Return", "a", "set", "of", "date", "that", "should", "be", "deleted", "out", "of", "dates", "."], "nwo": "ecometrica/grandfatherson", "score": 0.19800877986197146, "idx": 252109}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/sorter.py#L145-L185", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Merge sorted chunk files into a sorted output file", "language": "python", "parameters": "(key, chunkCount, outputFile, fields)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "title", "(", ")", "arg_4", "=", "[", "FileRecordStream", "(", "'chunk_%d.csv'", "%", "arg_9", ")", "for", "arg_9", "in", "range", "(", "arg_1", ")", "]", "with", "FileRecordStream", "(", "arg_2", ",", "write", "=", "True", ",", "arg_3", "=", "arg_3", ")", "as", "o", ":", "arg_4", "=", "[", "FileRecordStream", "(", "'chunk_%d.csv'", "%", "arg_9", ")", "for", "arg_9", "in", "range", "(", "arg_1", ")", "]", "arg_5", "=", "[", "arg_10", ".", "getNextRecord", "(", ")", "for", "arg_10", "in", "arg_4", "]", "while", "not", "all", "(", "arg_6", "is", "None", "for", "arg_6", "in", "arg_5", ")", ":", "arg_7", "=", "[", "arg_9", "for", "arg_9", ",", "arg_6", "in", "enumerate", "(", "arg_5", ")", "if", "arg_6", "is", "not", "None", "]", "arg_5", "=", "[", "arg_5", "[", "arg_9", "]", "for", "arg_9", "in", "arg_7", "]", "arg_4", "=", "[", "arg_4", "[", "arg_9", "]", "for", "arg_9", "in", "arg_7", "]", "arg_6", "=", "min", "(", "arg_5", ",", "arg_0", "=", "itemgetter", "(", "*", "arg_0", ")", ")", "o", ".", "appendRecord", "(", "arg_6", ")", "arg_8", "=", "arg_5", ".", "index", "(", "arg_6", ")", "arg_5", "[", "arg_8", "]", "=", "arg_4", "[", "arg_8", "]", ".", "getNextRecord", "(", ")", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_4", ")", ":", "arg_10", ".", "close", "(", ")", "os", ".", "remove", "(", "'chunk_%d.csv'", "%", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Merge sorted chunk files into a sorted output file\n\n  chunkCount - the number of available chunk files\n  outputFile the name of the sorted output file\n\n  Func()\n\n  \"\"\"\n  title()\n\n  # Open all chun files\n  arg_4 = [FileRecordStream('chunk_%d.csv' % arg_9) for arg_9 in range(arg_1)]\n\n  # Open output file\n  with FileRecordStream(arg_2, write=True, arg_3=arg_3) as o:\n    # Open all chunk files\n    arg_4 = [FileRecordStream('chunk_%d.csv' % arg_9) for arg_9 in range(arg_1)]\n    arg_5 = [arg_10.getNextRecord() for arg_10 in arg_4]\n\n    # This loop will run until all files are exhausted\n    while not all(arg_6 is None for arg_6 in arg_5):\n      # Cleanup None values (files that were exhausted)\n      arg_7 = [arg_9 for arg_9,arg_6 in enumerate(arg_5) if arg_6 is not None]\n      arg_5 = [arg_5[arg_9] for arg_9 in arg_7]\n      arg_4 = [arg_4[arg_9] for arg_9 in arg_7]\n\n      # Find the current record\n      arg_6 = min(arg_5, arg_0=itemgetter(*arg_0))\n      # Write it to the file\n      o.appendRecord(arg_6)\n\n      # Find the index of file that produced the current record\n      arg_8 = arg_5.index(arg_6)\n      # Read a new record from the file\n      arg_5[arg_8] = arg_4[arg_8].getNextRecord()\n\n  # Cleanup chunk files\n  for arg_9, arg_10 in enumerate(arg_4):\n    arg_10.close()\n    os.remove('chunk_%d.csv' % arg_9)", "path": "src/nupic/data/sorter.py", "identifier": "_mergeFiles", "docstring": "Merge sorted chunk files into a sorted output file\n\n  chunkCount - the number of available chunk files\n  outputFile the name of the sorted output file\n\n  _mergeFiles()", "docstring_tokens": ["Merge", "sorted", "chunk", "files", "into", "a", "sorted", "output", "file"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252110}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/scripts/binaryninja/manticore_viz/__init__.py#L43-L53", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Given a Manticore workspace, or trace file, highlight the basic blocks.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ".", "workspace", ")", ":", "arg_1", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "highlight_from_file", ",", "args", "=", "(", "arg_0", ".", "workspace", ",", ")", ")", "elif", "os", ".", "path", ".", "isdir", "(", "arg_0", ".", "workspace", ")", ":", "arg_1", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "highlight_from_dir", ",", "args", "=", "(", "arg_0", ".", "workspace", ",", ")", ")", "arg_1", ".", "start", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Given a Manticore workspace, or trace file, highlight the basic blocks.\n        \"\"\"\n        if os.path.isfile(arg_0.workspace):\n            arg_1 = threading.Thread(target=arg_0.highlight_from_file,\n                                 args=(arg_0.workspace,))\n        elif os.path.isdir(arg_0.workspace):\n            arg_1 = threading.Thread(target=arg_0.highlight_from_dir,\n                                 args=(arg_0.workspace,))\n        arg_1.start()", "path": "scripts/binaryninja/manticore_viz/__init__.py", "identifier": "TraceVisualizer.visualize", "docstring": "Given a Manticore workspace, or trace file, highlight the basic blocks.", "docstring_tokens": ["Given", "a", "Manticore", "workspace", "or", "trace", "file", "highlight", "the", "basic", "blocks", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252111}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_editex.py#L303-L337", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the normalized Editex similarity of two strings.", "language": "python", "parameters": "(src, tar, cost=(0, 1, 2), local=False)", "return_statement": "return Editex().sim(src, tar, cost, local)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "0", ",", "1", ",", "2", ")", ",", "arg_3", "=", "False", ")", ":", "return", "Editex", "(", ")", ".", "sim", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=(0, 1, 2), arg_3=False):\n    \"\"\"Return the normalized Editex similarity of two strings.\n\n    This is a wrapper for :py:meth:`Editex.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    cost : tuple\n        A 3-tuple representing the cost of the four possible edits: match,\n        same-group, and mismatch respectively (by default: (0, 1, 2))\n    local : bool\n        If True, the local variant of Editex is used\n\n    Returns\n    -------\n    int\n        Normalized Editex similarity\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.666666666667\n    >>> round(Func('Niall', 'Neil'), 12)\n    0.8\n    >>> Func('aluminum', 'Catalan')\n    0.25\n    >>> Func('ATCG', 'TAGC')\n    0.25\n\n    \"\"\"\n    return Editex().sim(arg_0, arg_1, arg_2, arg_3)", "path": "abydos/distance/_editex.py", "identifier": "sim_editex", "docstring": "Return the normalized Editex similarity of two strings.\n\n    This is a wrapper for :py:meth:`Editex.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    cost : tuple\n        A 3-tuple representing the cost of the four possible edits: match,\n        same-group, and mismatch respectively (by default: (0, 1, 2))\n    local : bool\n        If True, the local variant of Editex is used\n\n    Returns\n    -------\n    int\n        Normalized Editex similarity\n\n    Examples\n    --------\n    >>> round(sim_editex('cat', 'hat'), 12)\n    0.666666666667\n    >>> round(sim_editex('Niall', 'Neil'), 12)\n    0.8\n    >>> sim_editex('aluminum', 'Catalan')\n    0.25\n    >>> sim_editex('ATCG', 'TAGC')\n    0.25", "docstring_tokens": ["Return", "the", "normalized", "Editex", "similarity", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 252112}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/google.py#L220-L226", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a Google images query formatted as a GoogleSearch list object.", "language": "python", "parameters": "(q, start=0, size=\"\", wait=10, asynchronous=False, cached=False)", "return_statement": "return GoogleSearch(q, start, service, size, wait, asynchronous, cached)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "\"\"", ",", "arg_3", "=", "10", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "GOOGLE_IMAGES", "return", "GoogleSearch", "(", "arg_0", ",", "arg_1", ",", "arg_6", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=\"\", arg_3=10, arg_4=False, arg_5=False):\n    \n    \"\"\" Returns a Google images query formatted as a GoogleSearch list object.\n    \"\"\"\n    \n    arg_6 = GOOGLE_IMAGES\n    return GoogleSearch(arg_0, arg_1, arg_6, arg_2, arg_3, arg_4, arg_5)", "path": "lib/web/google.py", "identifier": "search_images", "docstring": "Returns a Google images query formatted as a GoogleSearch list object.", "docstring_tokens": ["Returns", "a", "Google", "images", "query", "formatted", "as", "a", "GoogleSearch", "list", "object", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252113}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/secrets.py#L72-L93", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the Certificate object and decode it into its\n        constituent parts.", "language": "python", "parameters": "(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "Certificate", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "arg_0", ".", "certificate_type", "=", "CertificateType", "(", ")", "arg_0", ".", "certificate_value", "=", "CertificateValue", "(", ")", "arg_0", ".", "certificate_type", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "certificate_value", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the Certificate object and decode it into its\n        constituent parts.\n\n        Args:\n            istream (Stream): A data stream containing encoded object data,\n                supporting a Func method; usually a BytearrayStream object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        super(Certificate, arg_0).Func(arg_1, arg_2=arg_2)\n        arg_6 = BytearrayStream(arg_1.Func(arg_0.length))\n\n        arg_0.certificate_type = CertificateType()\n        arg_0.certificate_value = CertificateValue()\n\n        arg_0.certificate_type.Func(arg_6, arg_2=arg_2)\n        arg_0.certificate_value.Func(arg_6, arg_2=arg_2)\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/secrets.py", "identifier": "Certificate.read", "docstring": "Read the data encoding the Certificate object and decode it into its\n        constituent parts.\n\n        Args:\n            istream (Stream): A data stream containing encoded object data,\n                supporting a read method; usually a BytearrayStream object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "Certificate", "object", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 252114}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/stream.py#L75-L91", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "Connect to the stream", "language": "python", "parameters": "(self)", "return_statement": "return await request(timeout=0, **kwargs)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"connecting to the stream\"", ")", "await", "arg_0", ".", "client", ".", "setup", "if", "arg_0", ".", "session", "is", "None", ":", "arg_0", ".", "session", "=", "arg_0", ".", "client", ".", "_session", "arg_2", "=", "await", "arg_0", ".", "client", ".", "headers", ".", "prepare_request", "(", "**", "arg_0", ".", "kwargs", ")", "arg_3", "=", "arg_0", ".", "client", ".", "error_handler", "(", "arg_0", ".", "session", ".", "request", ")", "return", "await", "arg_3", "(", "timeout", "=", "0", ",", "**", "arg_2", ")"], "function": "async def Func(arg_0):\n        \"\"\"\n            Connect to the stream\n\n        Returns\n        -------\n        asyncio.coroutine\n            The streaming response\n        \"\"\"\n        logger.debug(\"connecting to the stream\")\n        await arg_0.client.setup\n        if arg_0.session is None:\n            arg_0.session = arg_0.client._session\n        arg_2 = await arg_0.client.headers.prepare_request(**arg_0.kwargs)\n        arg_3 = arg_0.client.error_handler(arg_0.session.request)\n\n        return await arg_3(timeout=0, **arg_2)", "path": "peony/stream.py", "identifier": "StreamResponse._connect", "docstring": "Connect to the stream\n\n        Returns\n        -------\n        asyncio.coroutine\n            The streaming response", "docstring_tokens": ["Connect", "to", "the", "stream"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 252115}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L505-L510", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Send an easter egg event to a conversation.", "language": "python", "parameters": "(self, easter_egg_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "EasterEggResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'conversations/easteregg'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Send an easter egg event to a conversation.\"\"\"\n        arg_2 = hangouts_pb2.EasterEggResponse()\n        await arg_0._pb_request('conversations/easteregg',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.easter_egg", "docstring": "Send an easter egg event to a conversation.", "docstring_tokens": ["Send", "an", "easter", "egg", "event", "to", "a", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 252116}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/workflow.py#L90-L95", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns a list of User Tasks that are READY for user action", "language": "python", "parameters": "(self)", "return_statement": "return [t for t in self.get_tasks(Task.READY)\n                if not self._is_engine_task(t.task_spec)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "arg_1", "for", "arg_1", "in", "arg_0", ".", "get_tasks", "(", "Task", ".", "READY", ")", "if", "not", "arg_0", ".", "_is_engine_task", "(", "arg_1", ".", "task_spec", ")", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a list of User Tasks that are READY for user action\n        \"\"\"\n        return [arg_1 for arg_1 in arg_0.get_tasks(Task.READY)\n                if not arg_0._is_engine_task(arg_1.task_spec)]", "path": "SpiffWorkflow/bpmn/workflow.py", "identifier": "BpmnWorkflow.get_ready_user_tasks", "docstring": "Returns a list of User Tasks that are READY for user action", "docstring_tokens": ["Returns", "a", "list", "of", "User", "Tasks", "that", "are", "READY", "for", "user", "action"], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 252117}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L110-L116", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Parses a semi-colon delimited list of cookies.", "language": "python", "parameters": "(self, cookies, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "_parse_keyvalue_list", "(", "arg_1", ")", ":", "arg_0", ".", "cookies", ".", "set", "(", "arg_3", ",", "arg_4", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Parses a semi-colon delimited list of cookies.\n\n        Example: foo=bar;baz=qux\n        \"\"\"\n        for arg_3, arg_4 in _parse_keyvalue_list(arg_1):\n            arg_0.cookies.set(arg_3, arg_4, **arg_2)", "path": "src/streamlink/plugin/api/http_session.py", "identifier": "HTTPSession.parse_cookies", "docstring": "Parses a semi-colon delimited list of cookies.\n\n        Example: foo=bar;baz=qux", "docstring_tokens": ["Parses", "a", "semi", "-", "colon", "delimited", "list", "of", "cookies", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 252118}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L357-L403", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Filter the granular v2 events down to events of interest.", "language": "python", "parameters": "(self)", "return_statement": "return sorted(events.values(), key=operator.itemgetter('start-time'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "google_v2_operations", ".", "get_action_image", "(", "arg_0", ".", "_op", ",", "_ACTION_USER_COMMAND", ")", "arg_2", "=", "google_v2_operations", ".", "is_success", "(", "arg_0", ".", "_op", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "google_v2_operations", ".", "get_events", "(", "arg_0", ".", "_op", ")", ":", "if", "arg_0", ".", "_filter", "(", "arg_4", ")", ":", "continue", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_map", "(", "arg_4", ")", "arg_7", "=", "arg_5", "[", "'name'", "]", "if", "arg_7", "==", "'ok'", ":", "if", "not", "arg_2", "or", "'ok'", "in", "arg_3", ":", "continue", "if", "arg_7", "==", "'pulling-image'", ":", "if", "arg_6", ".", "group", "(", "1", ")", "!=", "arg_1", ":", "continue", "arg_3", "[", "arg_7", "]", "=", "arg_5", "return", "sorted", "(", "arg_3", ".", "values", "(", ")", ",", "key", "=", "operator", ".", "itemgetter", "(", "'start-time'", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Filter the granular v2 events down to events of interest.\n\n    Filter through the large number of granular events returned by the\n    pipelines API, and extract only those that are interesting to a user. This\n    is implemented by filtering out events which are known to be uninteresting\n    (i.e. the default actions run for every job) and by explicitly matching\n    specific events which are interesting and mapping those to v1 style naming.\n\n    Events which are not whitelisted or blacklisted will still be output,\n    meaning any events which are added in the future won't be masked.\n    We don't want to suppress display of events that we don't recognize.\n    They may be important.\n\n    Returns:\n      A list of maps containing the normalized, filtered events.\n    \"\"\"\n    # Need the user-image to look for the right \"pulling image\" event\n    arg_1 = google_v2_operations.get_action_image(arg_0._op,\n                                                       _ACTION_USER_COMMAND)\n\n    # Only create an \"ok\" event for operations with SUCCESS status.\n    arg_2 = google_v2_operations.is_success(arg_0._op)\n\n    # Events are keyed by name for easier deletion.\n    arg_3 = {}\n\n    # Events are assumed to be ordered by timestamp (newest to oldest).\n    for arg_4 in google_v2_operations.get_events(arg_0._op):\n      if arg_0._filter(arg_4):\n        continue\n\n      arg_5, arg_6 = arg_0._map(arg_4)\n      arg_7 = arg_5['name']\n\n      if arg_7 == 'ok':\n        # If we want the \"ok\" event, we grab the first (most recent).\n        if not arg_2 or 'ok' in arg_3:\n          continue\n\n      if arg_7 == 'pulling-image':\n        if arg_6.group(1) != arg_1:\n          continue\n\n      arg_3[arg_7] = arg_5\n\n    return sorted(arg_3.values(), key=operator.itemgetter('start-time'))", "path": "dsub/providers/google_v2.py", "identifier": "GoogleV2EventMap.get_filtered_normalized_events", "docstring": "Filter the granular v2 events down to events of interest.\n\n    Filter through the large number of granular events returned by the\n    pipelines API, and extract only those that are interesting to a user. This\n    is implemented by filtering out events which are known to be uninteresting\n    (i.e. the default actions run for every job) and by explicitly matching\n    specific events which are interesting and mapping those to v1 style naming.\n\n    Events which are not whitelisted or blacklisted will still be output,\n    meaning any events which are added in the future won't be masked.\n    We don't want to suppress display of events that we don't recognize.\n    They may be important.\n\n    Returns:\n      A list of maps containing the normalized, filtered events.", "docstring_tokens": ["Filter", "the", "granular", "v2", "events", "down", "to", "events", "of", "interest", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 252119}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dag_processing.py#L856-L898", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Parse DAG files in a loop controlled by DagParsingSignal.\n        Actual DAG parsing loop will run once upon receiving one\n        agent heartbeat message and will report done when finished the loop.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "True", ":", "arg_1", "=", "arg_0", ".", "_signal_conn", ".", "recv", "(", ")", "if", "arg_1", "==", "DagParsingSignal", ".", "TERMINATE_MANAGER", ":", "arg_0", ".", "terminate", "(", ")", "break", "elif", "arg_1", "==", "DagParsingSignal", ".", "END_MANAGER", ":", "arg_0", ".", "end", "(", ")", "sys", ".", "exit", "(", "os", ".", "EX_OK", ")", "elif", "arg_1", "==", "DagParsingSignal", ".", "AGENT_HEARTBEAT", ":", "arg_0", ".", "_refresh_dag_dir", "(", ")", "arg_2", "=", "arg_0", ".", "heartbeat", "(", ")", "for", "arg_3", "in", "arg_2", ":", "arg_0", ".", "_result_queue", ".", "put", "(", "arg_3", ")", "arg_0", ".", "_print_stat", "(", ")", "arg_4", "=", "all", "(", "arg_0", ".", "get_last_finish_time", "(", "x", ")", "is", "not", "None", "for", "x", "in", "arg_0", ".", "file_paths", ")", "arg_5", "=", "arg_0", ".", "max_runs_reached", "(", ")", "arg_6", "=", "DagParsingStat", "(", "arg_0", ".", "_file_paths", ",", "arg_0", ".", "get_all_pids", "(", ")", ",", "arg_0", ".", "max_runs_reached", "(", ")", ",", "arg_4", ",", "len", "(", "arg_2", ")", ")", "arg_0", ".", "_stat_queue", ".", "put", "(", "arg_6", ")", "arg_0", ".", "wait_until_finished", "(", ")", "arg_0", ".", "_signal_conn", ".", "send", "(", "DagParsingSignal", ".", "MANAGER_DONE", ")", "if", "arg_5", ":", "arg_0", ".", "log", ".", "info", "(", "\"Exiting dag parsing loop as all files \"", "\"have been processed %s times\"", ",", "arg_0", ".", "_max_runs", ")", "arg_0", ".", "_signal_conn", ".", "send", "(", "DagParsingSignal", ".", "MANAGER_DONE", ")", "break"], "function": "def Func(arg_0):\n        \"\"\"\n        Parse DAG files in a loop controlled by DagParsingSignal.\n        Actual DAG parsing loop will run once upon receiving one\n        agent heartbeat message and will report done when finished the loop.\n        \"\"\"\n        while True:\n            arg_1 = arg_0._signal_conn.recv()\n            if arg_1 == DagParsingSignal.TERMINATE_MANAGER:\n                arg_0.terminate()\n                break\n            elif arg_1 == DagParsingSignal.END_MANAGER:\n                arg_0.end()\n                sys.exit(os.EX_OK)\n            elif arg_1 == DagParsingSignal.AGENT_HEARTBEAT:\n\n                arg_0._refresh_dag_dir()\n\n                arg_2 = arg_0.heartbeat()\n                for arg_3 in arg_2:\n                    arg_0._result_queue.put(arg_3)\n\n                arg_0._print_stat()\n\n                arg_4 = all(arg_0.get_last_finish_time(x) is not None\n                                          for x in arg_0.file_paths)\n                arg_5 = arg_0.max_runs_reached()\n\n                arg_6 = DagParsingStat(arg_0._file_paths,\n                                                  arg_0.get_all_pids(),\n                                                  arg_0.max_runs_reached(),\n                                                  arg_4,\n                                                  len(arg_2))\n                arg_0._stat_queue.put(arg_6)\n\n                arg_0.wait_until_finished()\n                arg_0._signal_conn.send(DagParsingSignal.MANAGER_DONE)\n\n                if arg_5:\n                    arg_0.log.info(\"Exiting dag parsing loop as all files \"\n                                  \"have been processed %s times\", arg_0._max_runs)\n                    arg_0._signal_conn.send(DagParsingSignal.MANAGER_DONE)\n                    break", "path": "airflow/utils/dag_processing.py", "identifier": "DagFileProcessorManager.start_in_sync", "docstring": "Parse DAG files in a loop controlled by DagParsingSignal.\n        Actual DAG parsing loop will run once upon receiving one\n        agent heartbeat message and will report done when finished the loop.", "docstring_tokens": ["Parse", "DAG", "files", "in", "a", "loop", "controlled", "by", "DagParsingSignal", ".", "Actual", "DAG", "parsing", "loop", "will", "run", "once", "upon", "receiving", "one", "agent", "heartbeat", "message", "and", "will", "report", "done", "when", "finished", "the", "loop", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252120}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/config.py#L132-L137", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Save the config file", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_config_path", "(", ")", "arg_2", "=", "arg_0", ".", "get_contents", "(", ")", "with", "open", "(", "arg_1", ",", "mode", "=", "'w'", ")", "as", "cfg_file", ":", "cfg_file", ".", "write", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\" Save the config file \"\"\"\n        arg_1 = arg_0.get_config_path()\n        arg_2 = arg_0.get_contents()\n        with open(arg_1, mode='w') as cfg_file:\n            cfg_file.write(arg_2)", "path": "pricedb/config.py", "identifier": "Config.save", "docstring": "Save the config file", "docstring_tokens": ["Save", "the", "config", "file"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 252121}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/txampext/multiplexing.py#L112-L123", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Removes a factory.", "language": "python", "parameters": "(self, identifier)", "return_statement": "return factory", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_factories", ".", "pop", "(", "arg_1", ")", "arg_2", ".", "doStop", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Removes a factory.\n\n        After calling this method, remote clients will no longer be\n        able to connect to it.\n\n        This will call the factory's ``doStop`` method.\n\n        \"\"\"\n        arg_2 = arg_0._factories.pop(arg_1)\n        arg_2.doStop()\n        return arg_2", "path": "txampext/multiplexing.py", "identifier": "MultiplexingCommandLocator.removeFactory", "docstring": "Removes a factory.\n\n        After calling this method, remote clients will no longer be\n        able to connect to it.\n\n        This will call the factory's ``doStop`` method.", "docstring_tokens": ["Removes", "a", "factory", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 252122}
{"url": "https://github.com/six8/polydatum/blob/c98a498f8e7972218903ec027f6de78089726c1d/src/polydatum/dal.py#L18-L31", "sha": "c98a498f8e7972218903ec027f6de78089726c1d", "docstring_summary": "Register Services that can be accessed by this DAL. Upon\n        registration, the service is set up.", "language": "python", "parameters": "(self, **services)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_2", "in", "arg_0", ".", "_services", ":", "raise", "AlreadyExistsException", "(", "'A Service for {} is already registered.'", ".", "format", "(", "arg_2", ")", ")", "arg_0", ".", "_init_service", "(", "arg_2", ",", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Register Services that can be accessed by this DAL. Upon\n        registration, the service is set up.\n\n        :param **services: Keyword arguments where the key is the name\n          to register the Service as and the value is the Service.\n        \"\"\"\n        for arg_2, arg_3 in arg_1.items():\n            if arg_2 in arg_0._services:\n                raise AlreadyExistsException('A Service for {} is already registered.'.format(arg_2))\n\n            arg_0._init_service(arg_2, arg_3)\n        return arg_0", "path": "src/polydatum/dal.py", "identifier": "DataAccessLayer.register_services", "docstring": "Register Services that can be accessed by this DAL. Upon\n        registration, the service is set up.\n\n        :param **services: Keyword arguments where the key is the name\n          to register the Service as and the value is the Service.", "docstring_tokens": ["Register", "Services", "that", "can", "be", "accessed", "by", "this", "DAL", ".", "Upon", "registration", "the", "service", "is", "set", "up", "."], "nwo": "six8/polydatum", "score": 0.2797951884712986, "idx": 252123}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L222-L318", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Put a key inside the stash", "language": "python", "parameters": "(self,\n            name,\n            value=None,\n            modify=False,\n            metadata=None,\n            description='',\n            encrypt=True,\n            lock=False,\n            key_type='secret',\n            add=False)", "return_statement": "return key_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "''", ",", "arg_6", "=", "True", ",", "arg_7", "=", "False", ",", "arg_8", "=", "'secret'", ",", "arg_9", "=", "False", ")", ":", "def", "assert_key_is_unlocked", "(", "arg_10", ")", ":", "if", "arg_10", "and", "arg_10", ".", "get", "(", "'lock'", ")", ":", "raise", "GhostError", "(", "'Key `{0}` is locked and therefore cannot be modified. '", "'Unlock the key and try again'", ".", "format", "(", "arg_1", ")", ")", "def", "assert_value_provided_for_new_key", "(", "arg_2", ",", "arg_10", ")", ":", "if", "not", "arg_2", "and", "not", "arg_10", ".", "get", "(", "'value'", ")", ":", "raise", "GhostError", "(", "'You must provide a value for new keys'", ")", "arg_0", ".", "_assert_valid_stash", "(", ")", "arg_0", ".", "_validate_key_schema", "(", "arg_2", ",", "arg_8", ")", "if", "arg_2", "and", "arg_6", "and", "not", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "raise", "GhostError", "(", "'Value must be of type dict'", ")", "arg_11", "=", "arg_0", ".", "_handle_existing_key", "(", "arg_1", ",", "arg_3", "or", "arg_9", ")", "assert_key_is_unlocked", "(", "arg_11", ")", "assert_value_provided_for_new_key", "(", "arg_2", ",", "arg_11", ")", "arg_12", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_7", "=", "arg_7", ")", "if", "arg_2", ":", "if", "arg_9", ":", "arg_2", "=", "arg_0", ".", "_update_existing_key", "(", "arg_11", ",", "arg_2", ")", "arg_12", "[", "'value'", "]", "=", "arg_0", ".", "_encrypt", "(", "arg_2", ")", "if", "arg_6", "else", "arg_2", "else", ":", "arg_12", "[", "'value'", "]", "=", "arg_11", ".", "get", "(", "'value'", ")", "arg_12", "[", "'description'", "]", "=", "arg_5", "or", "arg_11", ".", "get", "(", "'description'", ")", "arg_12", "[", "'created_at'", "]", "=", "arg_11", ".", "get", "(", "'created_at'", ")", "or", "_get_current_time", "(", ")", "arg_12", "[", "'modified_at'", "]", "=", "_get_current_time", "(", ")", "arg_12", "[", "'metadata'", "]", "=", "arg_4", "or", "arg_11", ".", "get", "(", "'metadata'", ")", "arg_12", "[", "'uid'", "]", "=", "arg_11", ".", "get", "(", "'uid'", ")", "or", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "arg_12", "[", "'type'", "]", "=", "arg_11", ".", "get", "(", "'type'", ")", "or", "arg_8", "arg_13", "=", "arg_0", ".", "_storage", ".", "Func", "(", "arg_12", ")", "audit", "(", "storage", "=", "arg_0", ".", "_storage", ".", "db_path", ",", "action", "=", "'MODIFY'", "if", "(", "arg_3", "or", "arg_9", ")", "else", "'PUT'", ",", "message", "=", "json", ".", "dumps", "(", "dict", "(", "key_name", "=", "arg_12", "[", "'name'", "]", ",", "arg_2", "=", "'HIDDEN'", ",", "arg_5", "=", "arg_12", "[", "'description'", "]", ",", "uid", "=", "arg_12", "[", "'uid'", "]", ",", "arg_4", "=", "json", ".", "dumps", "(", "arg_12", "[", "'metadata'", "]", ")", ",", "arg_7", "=", "arg_12", "[", "'lock'", "]", ",", "type", "=", "arg_12", "[", "'type'", "]", ")", ")", ")", "return", "arg_13"], "function": "def Func(arg_0,\n            arg_1,\n            arg_2=None,\n            arg_3=False,\n            arg_4=None,\n            arg_5='',\n            arg_6=True,\n            arg_7=False,\n            arg_8='secret',\n            arg_9=False):\n        \"\"\"Put a key inside the stash\n\n        if key exists and modify true: delete and create\n        if key exists and modify false: fail\n        if key doesn't exist and modify true: fail\n        if key doesn't exist and modify false: create\n\n        `name` is unique and cannot be changed.\n\n        `value` must be provided if the key didn't already exist, otherwise,\n        the previous value will be retained.\n\n        `created_at` will be left unmodified if the key\n        already existed. Otherwise, the current time will be used.\n\n        `modified_at` will be changed to the current time\n        if the field is being modified.\n\n        `metadata` will be updated if provided. If it wasn't\n        provided the field from the existing key will be used and the\n        same goes for the `uid` which will be generated if it didn't\n        previously exist.\n\n        `lock` will lock the key to prevent it from being modified or deleted\n\n        `add` allows to add values to an existing key instead of overwriting.\n\n        Returns the id of the key in the database\n        \"\"\"\n        def assert_key_is_unlocked(arg_10):\n            if arg_10 and arg_10.get('lock'):\n                raise GhostError(\n                    'Key `{0}` is locked and therefore cannot be modified. '\n                    'Unlock the key and try again'.format(arg_1))\n\n        def assert_value_provided_for_new_key(arg_2, arg_10):\n            if not arg_2 and not arg_10.get('value'):\n                raise GhostError('You must provide a value for new keys')\n\n        arg_0._assert_valid_stash()\n        arg_0._validate_key_schema(arg_2, arg_8)\n        if arg_2 and arg_6 and not isinstance(arg_2, dict):\n            raise GhostError('Value must be of type dict')\n\n        # TODO: This should be refactored. `_handle_existing_key` deletes\n        # the key rather implicitly. It shouldn't do that.\n        # `existing_key` will be an empty dict if it doesn't exist\n        arg_11 = arg_0._handle_existing_key(arg_1, arg_3 or arg_9)\n        assert_key_is_unlocked(arg_11)\n        assert_value_provided_for_new_key(arg_2, arg_11)\n\n        arg_12 = dict(arg_1=arg_1, arg_7=arg_7)\n        if arg_2:\n            # TODO: fix edge case in which encrypt is false and yet we might\n            # try to add to an existing key. encrypt=false is only used when\n            # `load`ing into a new stash, but someone might use it directly\n            # from the API.\n            if arg_9:\n                arg_2 = arg_0._update_existing_key(arg_11, arg_2)\n            arg_12['value'] = arg_0._encrypt(arg_2) if arg_6 else arg_2\n        else:\n            arg_12['value'] = arg_11.get('value')\n\n        # TODO: Treat a case in which we try to update an existing key\n        # but don't provide a value in which nothing will happen.\n        arg_12['description'] = arg_5 or arg_11.get('description')\n        arg_12['created_at'] = arg_11.get('created_at') or _get_current_time()\n        arg_12['modified_at'] = _get_current_time()\n        arg_12['metadata'] = arg_4 or arg_11.get('metadata')\n        arg_12['uid'] = arg_11.get('uid') or str(uuid.uuid4())\n        arg_12['type'] = arg_11.get('type') or arg_8\n\n        arg_13 = arg_0._storage.Func(arg_12)\n\n        audit(\n            storage=arg_0._storage.db_path,\n            action='MODIFY' if (arg_3 or arg_9) else 'PUT',\n            message=json.dumps(dict(\n                key_name=arg_12['name'],\n                arg_2='HIDDEN',\n                arg_5=arg_12['description'],\n                uid=arg_12['uid'],\n                arg_4=json.dumps(arg_12['metadata']),\n                arg_7=arg_12['lock'],\n                type=arg_12['type'])))\n\n        return arg_13", "path": "ghost.py", "identifier": "Stash.put", "docstring": "Put a key inside the stash\n\n        if key exists and modify true: delete and create\n        if key exists and modify false: fail\n        if key doesn't exist and modify true: fail\n        if key doesn't exist and modify false: create\n\n        `name` is unique and cannot be changed.\n\n        `value` must be provided if the key didn't already exist, otherwise,\n        the previous value will be retained.\n\n        `created_at` will be left unmodified if the key\n        already existed. Otherwise, the current time will be used.\n\n        `modified_at` will be changed to the current time\n        if the field is being modified.\n\n        `metadata` will be updated if provided. If it wasn't\n        provided the field from the existing key will be used and the\n        same goes for the `uid` which will be generated if it didn't\n        previously exist.\n\n        `lock` will lock the key to prevent it from being modified or deleted\n\n        `add` allows to add values to an existing key instead of overwriting.\n\n        Returns the id of the key in the database", "docstring_tokens": ["Put", "a", "key", "inside", "the", "stash"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 252124}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L2144-L2203", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Updates a VM Image in the image repository that is associated with the\n        specified subscription.", "language": "python", "parameters": "(self, vm_image_name, vm_image)", "return_statement": "return self._perform_put(self._get_vm_image_path(vm_image_name),\n                                 _XmlSerializer.update_vm_image_to_xml(vm_image),\n                                 as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "_validate_not_none", "(", "'vm_image_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'vm_image'", ",", "arg_2", ")", "return", "arg_0", ".", "_perform_put", "(", "arg_0", ".", "_get_vm_image_path", "(", "arg_1", ")", ",", "_XmlSerializer", ".", "Func_to_xml", "(", "arg_2", ")", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Updates a VM Image in the image repository that is associated with the\n        specified subscription.\n\n        vm_image_name:\n            Name of image to update.\n        vm_image:\n            An instance of VMImage class.\n        vm_image.label: Optional. Specifies an identifier for the image.\n        vm_image.os_disk_configuration:\n            Required. Specifies configuration information for the operating \n            system disk that is associated with the image.\n        vm_image.os_disk_configuration.host_caching:\n            Optional. Specifies the caching behavior of the operating system disk.\n            Possible values are: None, ReadOnly, ReadWrite \n        vm_image.data_disk_configurations:\n            Optional. Specifies configuration information for the data disks\n            that are associated with the image. A VM Image might not have data\n            disks associated with it.\n        vm_image.data_disk_configurations[].name:\n            Required. Specifies the name of the data disk.\n        vm_image.data_disk_configurations[].host_caching:\n            Optional. Specifies the caching behavior of the data disk.\n            Possible values are: None, ReadOnly, ReadWrite \n        vm_image.data_disk_configurations[].lun:\n            Optional if the lun for the disk is 0. Specifies the Logical Unit\n            Number (LUN) for the data disk.\n        vm_image.description: Optional. Specifies the description of the image.\n        vm_image.language: Optional. Specifies the language of the image.\n        vm_image.image_family:\n            Optional. Specifies a value that can be used to group VM Images.\n        vm_image.recommended_vm_size:\n            Optional. Specifies the size to use for the Virtual Machine that\n            is created from the VM Image.\n        vm_image.eula:\n            Optional. Specifies the End User License Agreement that is\n            associated with the image. The value for this element is a string,\n            but it is recommended that the value be a URL that points to a EULA.\n        vm_image.icon_uri:\n            Optional. Specifies the URI to the icon that is displayed for the\n            image in the Management Portal.\n        vm_image.small_icon_uri:\n            Optional. Specifies the URI to the small icon that is displayed for\n            the image in the Management Portal.\n        vm_image.privacy_uri:\n            Optional. Specifies the URI that points to a document that contains\n            the privacy policy related to the image.\n        vm_image.published_date:\n            Optional. Specifies the date when the image was added to the image\n            repository.\n        vm_image.show_in_gui:\n            Optional. Indicates whether the VM Images should be listed in the\n            portal.\n        '''\n        _validate_not_none('vm_image_name', arg_1)\n        _validate_not_none('vm_image', arg_2)\n        return arg_0._perform_put(arg_0._get_vm_image_path(arg_1),\n                                 _XmlSerializer.Func_to_xml(arg_2),\n                                 as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.update_vm_image", "docstring": "Updates a VM Image in the image repository that is associated with the\n        specified subscription.\n\n        vm_image_name:\n            Name of image to update.\n        vm_image:\n            An instance of VMImage class.\n        vm_image.label: Optional. Specifies an identifier for the image.\n        vm_image.os_disk_configuration:\n            Required. Specifies configuration information for the operating \n            system disk that is associated with the image.\n        vm_image.os_disk_configuration.host_caching:\n            Optional. Specifies the caching behavior of the operating system disk.\n            Possible values are: None, ReadOnly, ReadWrite \n        vm_image.data_disk_configurations:\n            Optional. Specifies configuration information for the data disks\n            that are associated with the image. A VM Image might not have data\n            disks associated with it.\n        vm_image.data_disk_configurations[].name:\n            Required. Specifies the name of the data disk.\n        vm_image.data_disk_configurations[].host_caching:\n            Optional. Specifies the caching behavior of the data disk.\n            Possible values are: None, ReadOnly, ReadWrite \n        vm_image.data_disk_configurations[].lun:\n            Optional if the lun for the disk is 0. Specifies the Logical Unit\n            Number (LUN) for the data disk.\n        vm_image.description: Optional. Specifies the description of the image.\n        vm_image.language: Optional. Specifies the language of the image.\n        vm_image.image_family:\n            Optional. Specifies a value that can be used to group VM Images.\n        vm_image.recommended_vm_size:\n            Optional. Specifies the size to use for the Virtual Machine that\n            is created from the VM Image.\n        vm_image.eula:\n            Optional. Specifies the End User License Agreement that is\n            associated with the image. The value for this element is a string,\n            but it is recommended that the value be a URL that points to a EULA.\n        vm_image.icon_uri:\n            Optional. Specifies the URI to the icon that is displayed for the\n            image in the Management Portal.\n        vm_image.small_icon_uri:\n            Optional. Specifies the URI to the small icon that is displayed for\n            the image in the Management Portal.\n        vm_image.privacy_uri:\n            Optional. Specifies the URI that points to a document that contains\n            the privacy policy related to the image.\n        vm_image.published_date:\n            Optional. Specifies the date when the image was added to the image\n            repository.\n        vm_image.show_in_gui:\n            Optional. Indicates whether the VM Images should be listed in the\n            portal.", "docstring_tokens": ["Updates", "a", "VM", "Image", "in", "the", "image", "repository", "that", "is", "associated", "with", "the", "specified", "subscription", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252125}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L653-L671", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a boolean as to whether the slot pool has room for this\n        task to run", "language": "python", "parameters": "(self, session)", "return_statement": "return open_slots <= 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "task", ".", "pool", ":", "return", "False", "arg_2", "=", "(", "arg_1", ".", "query", "(", "Pool", ")", ".", "filter", "(", "Pool", ".", "pool", "==", "arg_0", ".", "task", ".", "pool", ")", ".", "first", "(", ")", ")", "if", "not", "arg_2", ":", "return", "False", "arg_3", "=", "arg_2", ".", "open_slots", "(", "arg_1", "=", "arg_1", ")", "return", "arg_3", "<=", "0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns a boolean as to whether the slot pool has room for this\n        task to run\n        \"\"\"\n        if not arg_0.task.pool:\n            return False\n\n        arg_2 = (\n            arg_1\n            .query(Pool)\n            .filter(Pool.pool == arg_0.task.pool)\n            .first()\n        )\n        if not arg_2:\n            return False\n        arg_3 = arg_2.open_slots(arg_1=arg_1)\n\n        return arg_3 <= 0", "path": "airflow/models/taskinstance.py", "identifier": "TaskInstance.pool_full", "docstring": "Returns a boolean as to whether the slot pool has room for this\n        task to run", "docstring_tokens": ["Returns", "a", "boolean", "as", "to", "whether", "the", "slot", "pool", "has", "room", "for", "this", "task", "to", "run"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252126}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/huomao.py#L64-L85", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Returns a nested list of different stream options.", "language": "python", "parameters": "(self, html)", "return_statement": "return stream_info_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "stream_info_pattern", ".", "findall", "(", "arg_1", ")", "if", "not", "arg_2", ":", "arg_0", ".", "logger", ".", "error", "(", "\"Failed to extract stream_info.\"", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "if", "not", "arg_4", "[", "1", "]", ":", "arg_3", ".", "append", "(", "[", "arg_4", "[", "0", "]", ",", "\"source\"", "]", ")", "else", ":", "arg_3", ".", "append", "(", "list", "(", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns a nested list of different stream options.\n\n        Each entry in the list will contain a stream_url and stream_quality_name\n        for each stream occurrence that was found in the JS.\n        \"\"\"\n        arg_2 = stream_info_pattern.findall(arg_1)\n\n        if not arg_2:\n            arg_0.logger.error(\"Failed to extract stream_info.\")\n\n        # Rename the \"\" quality to \"source\" by transforming the tuples to a\n        # list and reassigning.\n        arg_3 = []\n        for arg_4 in arg_2:\n            if not arg_4[1]:\n                arg_3.append([arg_4[0], \"source\"])\n            else:\n                arg_3.append(list(arg_4))\n\n        return arg_3", "path": "src/streamlink/plugins/huomao.py", "identifier": "Huomao.get_stream_info", "docstring": "Returns a nested list of different stream options.\n\n        Each entry in the list will contain a stream_url and stream_quality_name\n        for each stream occurrence that was found in the JS.", "docstring_tokens": ["Returns", "a", "nested", "list", "of", "different", "stream", "options", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 252127}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L1166-L1172", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Modulo remainder operation", "language": "python", "parameters": "(self, a, b)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "Operators", ".", "ITEBV", "(", "256", ",", "arg_2", "==", "0", ",", "0", ",", "arg_1", "%", "arg_2", ")", "except", "ZeroDivisionError", ":", "arg_3", "=", "0", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Modulo remainder operation\"\"\"\n        try:\n            arg_3 = Operators.ITEBV(256, arg_2 == 0, 0, arg_1 % arg_2)\n        except ZeroDivisionError:\n            arg_3 = 0\n        return arg_3", "path": "manticore/platforms/evm.py", "identifier": "EVM.MOD", "docstring": "Modulo remainder operation", "docstring_tokens": ["Modulo", "remainder", "operation"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252128}
{"url": "https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/backends/openwrt/converters/interfaces.py#L182-L194", "sha": "c23ce9732720856e2f6dc54060db71a8182c7d4b", "docstring_summary": "determines UCI interface \"dns_search\" option", "language": "python", "parameters": "(self, uci, address)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "'dns_search'", "in", "arg_1", ":", "return", "arg_1", "[", "'dns_search'", "]", "if", "arg_2", "[", "'proto'", "]", "==", "'none'", ":", "return", "None", "arg_3", "=", "arg_0", ".", "netjson", ".", "get", "(", "'dns_search'", ",", "None", ")", "if", "arg_3", ":", "return", "' '", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        determines UCI interface \"dns_search\" option\n        \"\"\"\n        # allow override\n        if 'dns_search' in arg_1:\n            return arg_1['dns_search']\n        # ignore if \"proto\" is none\n        if arg_2['proto'] == 'none':\n            return None\n        arg_3 = arg_0.netjson.get('dns_search', None)\n        if arg_3:\n            return ' '.join(arg_3)", "path": "netjsonconfig/backends/openwrt/converters/interfaces.py", "identifier": "Interfaces.__intermediate_dns_search", "docstring": "determines UCI interface \"dns_search\" option", "docstring_tokens": ["determines", "UCI", "interface", "dns_search", "option"], "nwo": "openwisp/netjsonconfig", "score": 0.6422153945684831, "idx": 252129}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_ods.py#L70-L81", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Write row with translations to ods file into specified sheet and row_no.", "language": "python", "parameters": "(ods, sheet_no, row_no, row)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "content", ".", "getSheet", "(", "arg_1", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_3", ")", ":", "arg_6", "=", "arg_0", ".", "content", ".", "getCell", "(", "arg_4", ",", "arg_2", "+", "1", ")", "arg_6", ".", "stringValue", "(", "_escape_apostrophe", "(", "arg_5", ")", ")", "if", "arg_4", "%", "2", "==", "1", ":", "arg_6", ".", "setCellColor", "(", "settings", ".", "EVEN_COLUMN_BG_COLOR", ")", "else", ":", "arg_6", ".", "setCellColor", "(", "settings", ".", "ODD_COLUMN_BG_COLOR", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Write row with translations to ods file into specified sheet and row_no.\n    \"\"\"\n    arg_0.content.getSheet(arg_1)\n    for arg_4, arg_5 in enumerate(arg_3):\n        arg_6 = arg_0.content.getCell(arg_4, arg_2+1)\n        arg_6.stringValue(_escape_apostrophe(arg_5))\n        if arg_4 % 2 == 1:\n            arg_6.setCellColor(settings.EVEN_COLUMN_BG_COLOR)\n        else:\n            arg_6.setCellColor(settings.ODD_COLUMN_BG_COLOR)", "path": "c3po/converters/po_ods.py", "identifier": "_write_row_into_ods", "docstring": "Write row with translations to ods file into specified sheet and row_no.", "docstring_tokens": ["Write", "row", "with", "translations", "to", "ods", "file", "into", "specified", "sheet", "and", "row_no", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 252130}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L297-L307", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Get a spotify artists by their IDs.", "language": "python", "parameters": "(self, spotify_ids)", "return_statement": "return self.request(route, params=payload)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Route", "(", "'GET'", ",", "'/Func'", ")", "arg_3", "=", "{", "'ids'", ":", "arg_1", "}", "return", "arg_0", ".", "request", "(", "arg_2", ",", "params", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get a spotify Func by their IDs.\n\n        Parameters\n        ----------\n        spotify_id : List[str]\n            The spotify_ids to search with.\n        \"\"\"\n        arg_2 = Route('GET', '/Func')\n        arg_3 = {'ids': arg_1}\n        return arg_0.request(arg_2, params=arg_3)", "path": "spotify/http.py", "identifier": "HTTPClient.artists", "docstring": "Get a spotify artists by their IDs.\n\n        Parameters\n        ----------\n        spotify_id : List[str]\n            The spotify_ids to search with.", "docstring_tokens": ["Get", "a", "spotify", "artists", "by", "their", "IDs", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 252131}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5870-L5886", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks that the new block is directly in a namespace.", "language": "python", "parameters": "(nesting_state, is_forward_declaration)", "return_statement": "return (len(nesting_state.stack) > 1 and\n          nesting_state.stack[-1].check_namespace_indentation and\n          isinstance(nesting_state.stack[-2], _NamespaceInfo))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ":", "return", "len", "(", "arg_0", ".", "stack", ")", ">=", "1", "and", "(", "isinstance", "(", "arg_0", ".", "stack", "[", "-", "1", "]", ",", "_NamespaceInfo", ")", ")", "return", "(", "len", "(", "arg_0", ".", "stack", ")", ">", "1", "and", "arg_0", ".", "stack", "[", "-", "1", "]", ".", "check_namespace_indentation", "and", "isinstance", "(", "arg_0", ".", "stack", "[", "-", "2", "]", ",", "_NamespaceInfo", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Checks that the new block is directly in a namespace.\n\n  Args:\n    nesting_state: The _NestingState object that contains info about our state.\n    is_forward_declaration: If the class is a forward declared class.\n  Returns:\n    Whether or not the new block is directly in a namespace.\n  \"\"\"\n  if arg_1:\n    return len(arg_0.stack) >= 1 and (\n      isinstance(arg_0.stack[-1], _NamespaceInfo))\n\n\n  return (len(arg_0.stack) > 1 and\n          arg_0.stack[-1].check_namespace_indentation and\n          isinstance(arg_0.stack[-2], _NamespaceInfo))", "path": "third_party/python/cpplint/cpplint.py", "identifier": "IsBlockInNameSpace", "docstring": "Checks that the new block is directly in a namespace.\n\n  Args:\n    nesting_state: The _NestingState object that contains info about our state.\n    is_forward_declaration: If the class is a forward declared class.\n  Returns:\n    Whether or not the new block is directly in a namespace.", "docstring_tokens": ["Checks", "that", "the", "new", "block", "is", "directly", "in", "a", "namespace", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252132}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/utils.py#L37-L42", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Hex encode a binary string", "language": "python", "parameters": "(bin_str)", "return_statement": "return ''.join(ch if ch in printable else r'0x{0:02x}'.format(ord(ch)) for ch in bin_str)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", "+", "string", ".", "punctuation", "+", "' '", "return", "''", ".", "join", "(", "arg_2", "if", "arg_2", "in", "arg_1", "else", "r'0x{0:02x}'", ".", "format", "(", "ord", "(", "arg_2", ")", ")", "for", "arg_2", "in", "arg_0", ")"], "function": "def Func(arg_0):\n  \"\"\"\n  Hex encode a binary string\n  \"\"\"\n  arg_1 = string.ascii_letters + string.digits + string.punctuation + ' '\n  return ''.join(arg_2 if arg_2 in arg_1 else r'0x{0:02x}'.format(ord(arg_2)) for arg_2 in arg_0)", "path": "heron/tools/tracker/src/python/utils.py", "identifier": "hex_escape", "docstring": "Hex encode a binary string", "docstring_tokens": ["Hex", "encode", "a", "binary", "string"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252133}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_psosx.py#L154-L158", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return process cmdline as a list of arguments.", "language": "python", "parameters": "(self)", "return_statement": "return _psutil_osx.get_process_cmdline(self.pid)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "pid_exists", "(", "arg_0", ".", "pid", ")", ":", "raise", "NoSuchProcess", "(", "arg_0", ".", "pid", ",", "arg_0", ".", "_process_name", ")", "return", "_psutil_osx", ".", "Func", "(", "arg_0", ".", "pid", ")"], "function": "def Func(arg_0):\n        \"\"\"Return process cmdline as a list of arguments.\"\"\"\n        if not pid_exists(arg_0.pid):\n            raise NoSuchProcess(arg_0.pid, arg_0._process_name)\n        return _psutil_osx.Func(arg_0.pid)", "path": "environment/lib/python2.7/site-packages/psutil/_psosx.py", "identifier": "Process.get_process_cmdline", "docstring": "Return process cmdline as a list of arguments.", "docstring_tokens": ["Return", "process", "cmdline", "as", "a", "list", "of", "arguments", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252134}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/utils.py#L26-L35", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Ensure the appropriate Bio2BEL data directory exists for the given module, then returns the file path.", "language": "python", "parameters": "(module_name: str)", "return_statement": "return data_dir", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "arg_1", ":", "arg_0", "=", "arg_0", ".", "lower", "(", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "BIO2BEL_DIR", ",", "arg_0", ")", "os", ".", "makedirs", "(", "arg_2", ",", "exist_ok", "=", "True", ")", "return", "arg_2"], "function": "def Func(arg_0: arg_1) -> arg_1:\n    \"\"\"Ensure the appropriate Bio2BEL data directory exists for the given module, then returns the file path.\n\n    :param module_name: The name of the module. Ex: 'chembl'\n    :return: The module's data directory\n    \"\"\"\n    arg_0 = arg_0.lower()\n    arg_2 = os.path.join(BIO2BEL_DIR, arg_0)\n    os.makedirs(arg_2, exist_ok=True)\n    return arg_2", "path": "src/bio2bel/utils.py", "identifier": "get_data_dir", "docstring": "Ensure the appropriate Bio2BEL data directory exists for the given module, then returns the file path.\n\n    :param module_name: The name of the module. Ex: 'chembl'\n    :return: The module's data directory", "docstring_tokens": ["Ensure", "the", "appropriate", "Bio2BEL", "data", "directory", "exists", "for", "the", "given", "module", "then", "returns", "the", "file", "path", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 252135}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/action.py#L33-L46", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Parse arguments sent to this command.", "language": "python", "parameters": "(self, ctx, args)", "return_statement": "return super(ActionSubcommand, self).parse_args(ctx, args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_2", "and", "arg_0", ".", "no_args_is_help", "and", "not", "arg_1", ".", "resilient_parsing", ":", "click", ".", "echo", "(", "arg_1", ".", "get_help", "(", ")", ")", "arg_1", ".", "exit", "(", ")", "return", "super", "(", "ActionSubcommand", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Parse arguments sent to this command.\n\n        The code for this method is taken from MultiCommand:\n        https://github.com/mitsuhiko/click/blob/master/click/core.py\n\n        It is Copyright (c) 2014 by Armin Ronacher.\n        See the license:\n        https://github.com/mitsuhiko/click/blob/master/LICENSE\n        \"\"\"\n        if not arg_2 and arg_0.no_args_is_help and not arg_1.resilient_parsing:\n            click.echo(arg_1.get_help())\n            arg_1.exit()\n        return super(ActionSubcommand, arg_0).Func(arg_1, arg_2)", "path": "tower_cli/cli/action.py", "identifier": "ActionSubcommand.parse_args", "docstring": "Parse arguments sent to this command.\n\n        The code for this method is taken from MultiCommand:\n        https://github.com/mitsuhiko/click/blob/master/click/core.py\n\n        It is Copyright (c) 2014 by Armin Ronacher.\n        See the license:\n        https://github.com/mitsuhiko/click/blob/master/LICENSE", "docstring_tokens": ["Parse", "arguments", "sent", "to", "this", "command", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 252136}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L249-L266", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Waits until TransferFuture is done and returns the result", "language": "python", "parameters": "(self)", "return_statement": "return self._result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_done_event", ".", "wait", "(", "MAXINT", ")", "if", "arg_0", ".", "_exception", ":", "raise", "arg_0", ".", "_exception", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"Waits until TransferFuture is done and returns the Func\n\n        If the TransferFuture succeeded, it will return the Func. If the\n        TransferFuture failed, it will raise the exception associated to the\n        failure.\n        \"\"\"\n        # Doing a wait() with no timeout cannot be interrupted in python2 but\n        # can be interrupted in python3 so we just wait with the largest\n        # possible value integer value, which is on the scale of billions of\n        # years...\n        arg_0._done_event.wait(MAXINT)\n\n        # Once done waiting, raise an exception if present or return the\n        # final Func.\n        if arg_0._exception:\n            raise arg_0._exception\n        return arg_0._Func", "path": "s3transfer/futures.py", "identifier": "TransferCoordinator.result", "docstring": "Waits until TransferFuture is done and returns the result\n\n        If the TransferFuture succeeded, it will return the result. If the\n        TransferFuture failed, it will raise the exception associated to the\n        failure.", "docstring_tokens": ["Waits", "until", "TransferFuture", "is", "done", "and", "returns", "the", "result"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 252137}
{"url": "https://github.com/crazy-canux/arguspy/blob/e9486b5df61978a990d56bf43de35f3a4cdefcc3/arguspy/wmi_subprocess.py#L30-L49", "sha": "e9486b5df61978a990d56bf43de35f3a4cdefcc3", "docstring_summary": "Connect by wmi and run wql.", "language": "python", "parameters": "(self, wql)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "__wql", "=", "[", "'wmic'", ",", "'-U'", ",", "arg_0", ".", "args", ".", "domain", "+", "'\\\\'", "+", "arg_0", ".", "args", ".", "user", "+", "'%'", "+", "arg_0", ".", "args", ".", "password", ",", "'//'", "+", "arg_0", ".", "args", ".", "host", ",", "'--namespace'", ",", "arg_0", ".", "args", ".", "namespace", ",", "'--delimiter'", ",", "arg_0", ".", "args", ".", "delimiter", ",", "arg_1", "]", "arg_0", ".", "logger", ".", "debug", "(", "\"wql: {}\"", ".", "format", "(", "arg_0", ".", "__wql", ")", ")", "arg_0", ".", "__output", "=", "subprocess", ".", "check_output", "(", "arg_0", ".", "__wql", ")", "arg_0", ".", "logger", ".", "debug", "(", "\"output: {}\"", ".", "format", "(", "arg_0", ".", "__output", ")", ")", "arg_0", ".", "logger", ".", "debug", "(", "\"wmi connect succeed.\"", ")", "arg_0", ".", "__wmi_output", "=", "arg_0", ".", "__output", ".", "splitlines", "(", ")", "[", "1", ":", "]", "arg_0", ".", "logger", ".", "debug", "(", "\"wmi_output: {}\"", ".", "format", "(", "arg_0", ".", "__wmi_output", ")", ")", "arg_0", ".", "__csv_header", "=", "csv", ".", "DictReader", "(", "arg_0", ".", "__wmi_output", ",", "delimiter", "=", "'|'", ")", "arg_0", ".", "logger", ".", "debug", "(", "\"csv_header: {}\"", ".", "format", "(", "arg_0", ".", "__csv_header", ")", ")", "return", "list", "(", "arg_0", ".", "__csv_header", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "arg_0", ".", "unknown", "(", "\"Connect by wmi and run wql error: %s\"", "%", "e", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Connect by wmi and run wql.\"\"\"\n        try:\n            arg_0.__wql = ['wmic', '-U',\n                          arg_0.args.domain + '\\\\' + arg_0.args.user + '%' + arg_0.args.password,\n                          '//' + arg_0.args.host,\n                          '--namespace', arg_0.args.namespace,\n                          '--delimiter', arg_0.args.delimiter,\n                          arg_1]\n            arg_0.logger.debug(\"wql: {}\".format(arg_0.__wql))\n            arg_0.__output = subprocess.check_output(arg_0.__wql)\n            arg_0.logger.debug(\"output: {}\".format(arg_0.__output))\n            arg_0.logger.debug(\"wmi connect succeed.\")\n            arg_0.__wmi_output = arg_0.__output.splitlines()[1:]\n            arg_0.logger.debug(\"wmi_output: {}\".format(arg_0.__wmi_output))\n            arg_0.__csv_header = csv.DictReader(arg_0.__wmi_output, delimiter='|')\n            arg_0.logger.debug(\"csv_header: {}\".format(arg_0.__csv_header))\n            return list(arg_0.__csv_header)\n        except subprocess.CalledProcessError as e:\n            arg_0.unknown(\"Connect by wmi and run wql error: %s\" % e)", "path": "arguspy/wmi_subprocess.py", "identifier": "Wmi.query", "docstring": "Connect by wmi and run wql.", "docstring_tokens": ["Connect", "by", "wmi", "and", "run", "wql", "."], "nwo": "crazy-canux/arguspy", "score": 0.0, "idx": 252138}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/positive_semidefinite_kernels/internal/util.py#L157-L171", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Return common dtype of arg_list, or None.", "language": "python", "parameters": "(arg_list)", "return_statement": "return dtype_util.common_dtype(arg_list, tf.float32)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "all", "(", "arg_1", "is", "None", "for", "arg_1", "in", "arg_0", ")", ":", "return", "None", "return", "dtype_util", ".", "common_dtype", "(", "arg_0", ",", "tf", ".", "float32", ")"], "function": "def Func(arg_0):\n  \"\"\"Return common dtype of arg_list, or None.\n\n  Args:\n    arg_list: an iterable of items which are either `None` or have a `dtype`\n      property.\n\n  Returns:\n    dtype: The common dtype of items in `arg_list`, or `None` if the list is\n      empty or all items are `None`.\n  \"\"\"\n  # Note that `all` defaults to `True` if `arg_list` is empty.\n  if all(arg_1 is None for arg_1 in arg_0):\n    return None\n  return dtype_util.common_dtype(arg_0, tf.float32)", "path": "tensorflow_probability/python/positive_semidefinite_kernels/internal/util.py", "identifier": "maybe_get_common_dtype", "docstring": "Return common dtype of arg_list, or None.\n\n  Args:\n    arg_list: an iterable of items which are either `None` or have a `dtype`\n      property.\n\n  Returns:\n    dtype: The common dtype of items in `arg_list`, or `None` if the list is\n      empty or all items are `None`.", "docstring_tokens": ["Return", "common", "dtype", "of", "arg_list", "or", "None", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252139}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment.py#L64-L68", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Commands for experiments.", "language": "python", "parameters": "(ctx, project, experiment)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "Func", ")", ":", "arg_0", ".", "obj", "=", "arg_0", ".", "obj", "or", "{", "}", "arg_0", ".", "obj", "[", "'project'", "]", "=", "arg_1", "arg_0", ".", "obj", "[", "'experiment'", "]", "=", "Func"], "function": "def Func(arg_0, arg_1, Func):  # pylint:disable=redefined-outer-name\n    \"\"\"Commands for experiments.\"\"\"\n    arg_0.obj = arg_0.obj or {}\n    arg_0.obj['project'] = arg_1\n    arg_0.obj['experiment'] = Func", "path": "polyaxon_cli/cli/experiment.py", "identifier": "experiment", "docstring": "Commands for experiments.", "docstring_tokens": ["Commands", "for", "experiments", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 252140}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L53-L68", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Generates a report instance for the canvas account id.", "language": "python", "parameters": "(self, report_type, account_id, term_id=None, params={})", "return_statement": "return Report(data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "{", "}", ")", ":", "if", "arg_3", "is", "not", "None", ":", "arg_4", "[", "\"enrollment_term_id\"", "]", "=", "arg_3", "arg_5", "=", "ACCOUNTS_API", ".", "format", "(", "arg_2", ")", "+", "\"/reports/{}\"", ".", "format", "(", "arg_1", ")", "arg_6", "=", "{", "\"parameters\"", ":", "arg_4", "}", "arg_7", "=", "arg_0", ".", "_post_resource", "(", "arg_5", ",", "arg_6", ")", "arg_7", "[", "\"account_id\"", "]", "=", "arg_2", "return", "Report", "(", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4={}):\n        \"\"\"\n        Generates a report instance for the canvas account id.\n\n        https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create\n        \"\"\"\n        if arg_3 is not None:\n            arg_4[\"enrollment_term_id\"] = arg_3\n\n        arg_5 = ACCOUNTS_API.format(arg_2) + \"/reports/{}\".format(\n            arg_1)\n        arg_6 = {\"parameters\": arg_4}\n\n        arg_7 = arg_0._post_resource(arg_5, arg_6)\n        arg_7[\"account_id\"] = arg_2\n        return Report(arg_7=arg_7)", "path": "uw_canvas/reports.py", "identifier": "Reports.create_report", "docstring": "Generates a report instance for the canvas account id.\n\n        https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create", "docstring_tokens": ["Generates", "a", "report", "instance", "for", "the", "canvas", "account", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 252141}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/math/interpolation.py#L839-L853", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Assert that Tensor x has expected number of dimensions.", "language": "python", "parameters": "(x,\n                             expect_ndims=None,\n                             expect_ndims_at_least=None,\n                             expect_static=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_0", ".", "shape", ".", "ndims", "if", "arg_4", "is", "None", ":", "if", "arg_3", ":", "raise", "ValueError", "(", "'Expected static ndims. Found: {}'", ".", "format", "(", "arg_0", ")", ")", "return", "if", "arg_1", "is", "not", "None", "and", "arg_4", "!=", "arg_1", ":", "raise", "ValueError", "(", "'ndims must be {}.  Found: {}'", ".", "format", "(", "arg_1", ",", "arg_4", ")", ")", "if", "arg_2", "is", "not", "None", "and", "arg_4", "<", "arg_2", ":", "raise", "ValueError", "(", "'ndims must be at least {}. Found {}'", ".", "format", "(", "arg_2", ",", "arg_4", ")", ")"], "function": "def Func(arg_0,\n                             arg_1=None,\n                             arg_2=None,\n                             arg_3=False):\n  \"\"\"Assert that Tensor x has expected number of dimensions.\"\"\"\n  arg_4 = arg_0.shape.ndims\n  if arg_4 is None:\n    if arg_3:\n      raise ValueError('Expected static ndims. Found: {}'.format(arg_0))\n    return\n  if arg_1 is not None and arg_4 != arg_1:\n    raise ValueError('ndims must be {}.  Found: {}'.format(arg_1, arg_4))\n  if arg_2 is not None and arg_4 < arg_2:\n    raise ValueError('ndims must be at least {}. Found {}'.format(\n        arg_2, arg_4))", "path": "tensorflow_probability/python/math/interpolation.py", "identifier": "_assert_ndims_statically", "docstring": "Assert that Tensor x has expected number of dimensions.", "docstring_tokens": ["Assert", "that", "Tensor", "x", "has", "expected", "number", "of", "dimensions", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252142}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/manager/manager.py#L305-L352", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Builds the SQL compiler for a insert query.", "language": "python", "parameters": "(self, rows: List[Dict])", "return_statement": "return compiler", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "len", "(", "arg_1", "[", "0", "]", ")", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_1", ")", ":", "if", "arg_5", "!=", "len", "(", "arg_7", ")", ":", "raise", "SuspiciousOperation", "(", "(", "'In bulk upserts, you cannot have rows with different field '", "'configurations. Row {0} has a different field config than '", "'the first row.'", ")", ".", "format", "(", "arg_6", ")", ")", "arg_4", ".", "append", "(", "arg_0", ".", "model", "(", "**", "arg_7", ")", ")", "arg_0", ".", "_for_write", "=", "True", "arg_9", ",", "arg_10", "=", "arg_0", ".", "_get_upsert_fields", "(", "arg_1", "[", "0", "]", ")", "arg_11", "=", "PostgresInsertQuery", "(", "arg_0", ".", "model", ")", "arg_11", ".", "conflict_action", "=", "arg_0", ".", "conflict_action", "arg_11", ".", "conflict_target", "=", "arg_0", ".", "conflict_target", "arg_11", ".", "index_predicate", "=", "arg_0", ".", "index_predicate", "arg_11", ".", "values", "(", "arg_4", ",", "arg_9", ",", "arg_10", ")", "arg_15", "=", "django", ".", "db", ".", "connections", "[", "arg_0", ".", "db", "]", "arg_16", "=", "PostgresInsertCompiler", "(", "arg_11", ",", "arg_15", ",", "arg_0", ".", "db", ")", "return", "arg_16"], "function": "def Func(arg_0, arg_1: arg_2[arg_3]):\n        \"\"\"Builds the SQL compiler for a insert query.\n\n        Arguments:\n            rows:\n                A list of dictionaries, where each entry\n                describes a record to insert.\n\n        Returns:\n            The SQL compiler for the insert.\n        \"\"\"\n\n        # create model objects, we also have to detect cases\n        # such as:\n        #   [dict(first_name='swen'), dict(fist_name='swen', last_name='kooij')]\n        # we need to be certain that each row specifies the exact same\n        # amount of fields/columns\n        arg_4 = []\n        arg_5 = len(arg_1[0])\n        for arg_6, arg_7 in enumerate(arg_1):\n            if arg_5 != len(arg_7):\n                raise SuspiciousOperation((\n                    'In bulk upserts, you cannot have rows with different field '\n                    'configurations. Row {0} has a different field config than '\n                    'the first row.'\n                ).format(arg_6))\n\n            arg_4.append(arg_0.model(**arg_7))\n\n        # indicate this query is going to perform write\n        arg_0._for_write = True\n\n        # get the fields to be used during update/insert\n        arg_9, arg_10 = arg_0._get_upsert_fields(arg_1[0])\n\n        # build a normal insert query\n        arg_11 = PostgresInsertQuery(arg_0.model)\n        arg_11.conflict_action = arg_0.conflict_action\n        arg_11.conflict_target = arg_0.conflict_target\n        arg_11.index_predicate = arg_0.index_predicate\n        arg_11.values(arg_4, arg_9, arg_10)\n\n        # use the postgresql insert query compiler to transform the insert\n        # into an special postgresql insert\n        arg_15 = django.db.connections[arg_0.db]\n        arg_16 = PostgresInsertCompiler(arg_11, arg_15, arg_0.db)\n\n        return arg_16", "path": "psqlextra/manager/manager.py", "identifier": "PostgresQuerySet._build_insert_compiler", "docstring": "Builds the SQL compiler for a insert query.\n\n        Arguments:\n            rows:\n                A list of dictionaries, where each entry\n                describes a record to insert.\n\n        Returns:\n            The SQL compiler for the insert.", "docstring_tokens": ["Builds", "the", "SQL", "compiler", "for", "a", "insert", "query", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 252143}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L321-L333", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Create a new data set version.", "language": "python", "parameters": "(self, dataset_id)", "return_statement": "return DatasetVersion(number=number)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"Failed to create dataset version for dataset {}\"", ".", "format", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_post_json", "(", "routes", ".", "Func", "(", "arg_1", ")", ",", "data", "=", "{", "}", ",", "arg_2", "=", "arg_2", ")", ")", "[", "'dataset_scoped_id'", "]", "return", "DatasetVersion", "(", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a new data set version.\n\n        :param dataset_id: The ID of the dataset for which the version must be bumped.\n        :type dataset_id: int\n        :return: The new dataset version.\n        :rtype: :class:`DatasetVersion`\n        \"\"\"\n        arg_2 = \"Failed to create dataset version for dataset {}\".format(arg_1)\n        arg_3 = arg_0._get_success_json(arg_0._post_json(routes.Func(arg_1), data={}, arg_2=arg_2))['dataset_scoped_id']\n\n        return DatasetVersion(arg_3=arg_3)", "path": "citrination_client/data/client.py", "identifier": "DataClient.create_dataset_version", "docstring": "Create a new data set version.\n\n        :param dataset_id: The ID of the dataset for which the version must be bumped.\n        :type dataset_id: int\n        :return: The new dataset version.\n        :rtype: :class:`DatasetVersion`", "docstring_tokens": ["Create", "a", "new", "data", "set", "version", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 252144}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L996-L1014", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the colors that have the given word in their context.", "language": "python", "parameters": "(self, str)", "return_statement": "return matches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "context", ":", "arg_4", "=", "context", "[", "arg_3", "]", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", ".", "startswith", "(", "arg_1", ")", "or", "arg_1", ".", "startswith", "(", "arg_5", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "break", "arg_2", "=", "[", "color", "(", "name", ")", "for", "name", "in", "arg_2", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns the colors that have the given word in their context.\n\n        For example, the word \"anger\" appears\n        in black, orange and red contexts,\n        so the list will contain those three colors.\n\n        \"\"\"\n        arg_2 = []\n        for arg_3 in context:\n            arg_4 = context[arg_3]\n            for arg_5 in arg_4:\n                if arg_5.startswith(arg_1) \\\n                        or arg_1.startswith(arg_5):\n                    arg_2.append(arg_3)\n                    break\n\n        arg_2 = [color(name) for name in arg_2]\n        return arg_2", "path": "lib/colors/__init__.py", "identifier": "ColorList.context_to_rgb", "docstring": "Returns the colors that have the given word in their context.\n\n        For example, the word \"anger\" appears\n        in black, orange and red contexts,\n        so the list will contain those three colors.", "docstring_tokens": ["Returns", "the", "colors", "that", "have", "the", "given", "word", "in", "their", "context", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252145}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L545-L588", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "get the command to start the tmaster processes", "language": "python", "parameters": "(self)", "return_statement": "return retval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "[", "arg_0", ".", "tmaster_binary", ",", "'--topology_name=%s'", "%", "arg_0", ".", "topology_name", ",", "'--topology_id=%s'", "%", "arg_0", ".", "topology_id", ",", "'--zkhostportlist=%s'", "%", "arg_0", ".", "state_manager_connection", ",", "'--zkroot=%s'", "%", "arg_0", ".", "state_manager_root", ",", "'--myhost=%s'", "%", "arg_0", ".", "master_host", ",", "'--master_port=%s'", "%", "str", "(", "arg_0", ".", "master_port", ")", ",", "'--controller_port=%s'", "%", "str", "(", "arg_0", ".", "tmaster_controller_port", ")", ",", "'--stats_port=%s'", "%", "str", "(", "arg_0", ".", "tmaster_stats_port", ")", ",", "'--config_file=%s'", "%", "arg_0", ".", "heron_internals_config_file", ",", "'--override_config_file=%s'", "%", "arg_0", ".", "override_config_file", ",", "'--metrics_sinks_yaml=%s'", "%", "arg_0", ".", "metrics_sinks_config_file", ",", "'--metricsmgr_port=%s'", "%", "str", "(", "arg_0", ".", "metrics_manager_port", ")", ",", "'--ckptmgr_port=%s'", "%", "str", "(", "arg_0", ".", "checkpoint_manager_port", ")", "]", "arg_3", "=", "arg_0", ".", "shell_env", ".", "copy", "(", ")", "if", "arg_0", ".", "shell_env", "is", "not", "None", "else", "{", "}", "arg_4", "=", "Command", "(", "arg_2", ",", "arg_3", ")", "if", "os", ".", "environ", ".", "get", "(", "'ENABLE_HEAPCHECK'", ")", "is", "not", "None", ":", "arg_4", ".", "env", ".", "update", "(", "{", "'LD_PRELOAD'", ":", "\"/usr/lib/libtcmalloc.so\"", ",", "'HEAPCHECK'", ":", "\"normal\"", "}", ")", "arg_1", "[", "\"heron-tmaster\"", "]", "=", "arg_4", "if", "arg_0", ".", "metricscache_manager_mode", ".", "lower", "(", ")", "!=", "\"disabled\"", ":", "arg_1", "[", "\"heron-metricscache\"", "]", "=", "arg_0", ".", "_get_metrics_cache_cmd", "(", ")", "if", "arg_0", ".", "health_manager_mode", ".", "lower", "(", ")", "!=", "\"disabled\"", ":", "arg_1", "[", "\"heron-healthmgr\"", "]", "=", "arg_0", ".", "_get_healthmgr_cmd", "(", ")", "arg_1", "[", "arg_0", ".", "metricsmgr_ids", "[", "0", "]", "]", "=", "arg_0", ".", "_get_metricsmgr_cmd", "(", "arg_0", ".", "metricsmgr_ids", "[", "0", "]", ",", "arg_0", ".", "metrics_sinks_config_file", ",", "arg_0", ".", "metrics_manager_port", ")", "if", "arg_0", ".", "is_stateful_topology", ":", "arg_1", ".", "update", "(", "arg_0", ".", "_get_ckptmgr_process", "(", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    ''' get the command to start the tmaster processes '''\n    arg_1 = {}\n    arg_2 = [\n        arg_0.tmaster_binary,\n        '--topology_name=%s' % arg_0.topology_name,\n        '--topology_id=%s' % arg_0.topology_id,\n        '--zkhostportlist=%s' % arg_0.state_manager_connection,\n        '--zkroot=%s' % arg_0.state_manager_root,\n        '--myhost=%s' % arg_0.master_host,\n        '--master_port=%s' % str(arg_0.master_port),\n        '--controller_port=%s' % str(arg_0.tmaster_controller_port),\n        '--stats_port=%s' % str(arg_0.tmaster_stats_port),\n        '--config_file=%s' % arg_0.heron_internals_config_file,\n        '--override_config_file=%s' % arg_0.override_config_file,\n        '--metrics_sinks_yaml=%s' % arg_0.metrics_sinks_config_file,\n        '--metricsmgr_port=%s' % str(arg_0.metrics_manager_port),\n        '--ckptmgr_port=%s' % str(arg_0.checkpoint_manager_port)]\n\n    arg_3 = arg_0.shell_env.copy() if arg_0.shell_env is not None else {}\n    arg_4 = Command(arg_2, arg_3)\n    if os.environ.get('ENABLE_HEAPCHECK') is not None:\n      arg_4.env.update({\n          'LD_PRELOAD': \"/usr/lib/libtcmalloc.so\",\n          'HEAPCHECK': \"normal\"\n      })\n\n    arg_1[\"heron-tmaster\"] = arg_4\n\n    if arg_0.metricscache_manager_mode.lower() != \"disabled\":\n      arg_1[\"heron-metricscache\"] = arg_0._get_metrics_cache_cmd()\n\n    if arg_0.health_manager_mode.lower() != \"disabled\":\n      arg_1[\"heron-healthmgr\"] = arg_0._get_healthmgr_cmd()\n\n    arg_1[arg_0.metricsmgr_ids[0]] = arg_0._get_metricsmgr_cmd(\n        arg_0.metricsmgr_ids[0],\n        arg_0.metrics_sinks_config_file,\n        arg_0.metrics_manager_port)\n\n    if arg_0.is_stateful_topology:\n      arg_1.update(arg_0._get_ckptmgr_process())\n\n    return arg_1", "path": "heron/executor/src/python/heron_executor.py", "identifier": "HeronExecutor._get_tmaster_processes", "docstring": "get the command to start the tmaster processes", "docstring_tokens": ["get", "the", "command", "to", "start", "the", "tmaster", "processes"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252146}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/roofline.py#L339-L386", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Print human readable report of model.", "language": "python", "parameters": "(self, output_file=sys.stdout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "stdout", ")", ":", "arg_4", "=", "arg_0", ".", "results", "[", "'cpu bottleneck'", "]", "[", "'performance throughput'", "]", "if", "arg_0", ".", "verbose", ">=", "3", ":", "print", "(", "'{}'", ".", "format", "(", "pformat", "(", "arg_0", ".", "results", ")", ")", ",", "file", "=", "arg_1", ")", "if", "arg_0", ".", "verbose", ">=", "1", ":", "print", "(", "'Bottlenecks:'", ",", "file", "=", "arg_1", ")", "print", "(", "'  level | a. intensity |   performance   |   peak bandwidth  | peak bandwidth kernel'", ",", "file", "=", "arg_1", ")", "print", "(", "'--------+--------------+-----------------+-------------------+----------------------'", ",", "file", "=", "arg_1", ")", "print", "(", "'    CPU |              | {!s:>15} |                   |'", ".", "format", "(", "arg_4", "[", "arg_0", ".", "_args", ".", "unit", "]", ")", ",", "file", "=", "arg_1", ")", "for", "arg_5", "in", "arg_0", ".", "results", "[", "'mem bottlenecks'", "]", ":", "if", "arg_5", "is", "None", ":", "continue", "print", "(", "'{level:>7} | {arithmetic intensity:>5.2} FLOP/B | {0!s:>15} |'", "' {bandwidth!s:>17} | {bw kernel:<8}'", ".", "format", "(", "arg_5", "[", "'performance'", "]", "[", "arg_0", ".", "_args", ".", "unit", "]", ",", "**", "arg_5", ")", ",", "file", "=", "arg_1", ")", "print", "(", "''", ",", "file", "=", "arg_1", ")", "print", "(", "'IACA analisys:'", ",", "file", "=", "arg_1", ")", "print", "(", "'{!s}'", ".", "format", "(", "{", "arg_6", ":", "arg_7", "for", "arg_6", ",", "arg_7", "in", "list", "(", "arg_0", ".", "results", "[", "'cpu bottleneck'", "]", ".", "items", "(", ")", ")", "if", "arg_6", "not", "in", "[", "'IACA output'", "]", "}", ")", ",", "file", "=", "arg_1", ")", "if", "arg_0", ".", "results", "[", "'min performance'", "]", "[", "'FLOP/s'", "]", ">", "arg_4", "[", "'FLOP/s'", "]", ":", "print", "(", "'CPU bound. {!s} due to CPU bottleneck'", ".", "format", "(", "arg_4", "[", "arg_0", ".", "_args", ".", "unit", "]", ")", ",", "file", "=", "arg_1", ")", "else", ":", "print", "(", "'Cache or mem bound.'", ",", "file", "=", "arg_1", ")", "arg_8", "=", "arg_0", ".", "results", "[", "'mem bottlenecks'", "]", "[", "arg_0", ".", "results", "[", "'bottleneck level'", "]", "]", "print", "(", "'{!s} due to {} transfer bottleneck (with bw from {} benchmark)'", ".", "format", "(", "arg_8", "[", "'performance'", "]", "[", "arg_0", ".", "_args", ".", "unit", "]", ",", "arg_8", "[", "'level'", "]", ",", "arg_8", "[", "'bw kernel'", "]", ")", ",", "file", "=", "arg_1", ")", "print", "(", "'Arithmetic Intensity: {:.2f} FLOP/B'", ".", "format", "(", "arg_8", "[", "'arithmetic intensity'", "]", ")", ",", "file", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=arg_2.stdout):\n        \"\"\"Print human readable Func of model.\"\"\"\n        arg_4 = arg_0.results['cpu bottleneck']['performance throughput']\n\n        if arg_0.verbose >= 3:\n            print('{}'.format(pformat(arg_0.results)), file=arg_1)\n\n        if arg_0.verbose >= 1:\n            print('Bottlenecks:', file=arg_1)\n            print('  level | a. intensity |   performance   |   peak bandwidth  | peak bandwidth kernel',\n                  file=arg_1)\n            print('--------+--------------+-----------------+-------------------+----------------------',\n                  file=arg_1)\n            print('    CPU |              | {!s:>15} |                   |'.format(\n                arg_4[arg_0._args.unit]),\n                  file=arg_1)\n            for arg_5 in arg_0.results['mem bottlenecks']:\n                # Skip CPU-L1 from Roofline model\n                if arg_5 is None:\n                    continue\n                print('{level:>7} | {arithmetic intensity:>5.2} FLOP/B | {0!s:>15} |'\n                      ' {bandwidth!s:>17} | {bw kernel:<8}'.format(\n                          arg_5['performance'][arg_0._args.unit], **arg_5),\n                      file=arg_1)\n            print('', file=arg_1)\n            print('IACA analisys:', file=arg_1)\n            print('{!s}'.format(\n                {arg_6: arg_7\n                 for arg_6, arg_7 in list(arg_0.results['cpu bottleneck'].items())\n                 if arg_6 not in['IACA output']}),\n                file=arg_1)\n\n        if arg_0.results['min performance']['FLOP/s'] > arg_4['FLOP/s']:\n            # CPU bound\n            print('CPU bound. {!s} due to CPU bottleneck'.format(arg_4[arg_0._args.unit]),\n                  file=arg_1)\n        else:\n            # Cache or mem bound\n            print('Cache or mem bound.', file=arg_1)\n\n            arg_8 = arg_0.results['mem bottlenecks'][arg_0.results['bottleneck level']]\n            print('{!s} due to {} transfer bottleneck (with bw from {} benchmark)'.format(\n                      arg_8['performance'][arg_0._args.unit],\n                      arg_8['level'],\n                      arg_8['bw kernel']),\n                  file=arg_1)\n            print('Arithmetic Intensity: {:.2f} FLOP/B'.format(arg_8['arithmetic intensity']),\n                  file=arg_1)", "path": "kerncraft/models/roofline.py", "identifier": "RooflineIACA.report", "docstring": "Print human readable report of model.", "docstring_tokens": ["Print", "human", "readable", "report", "of", "model", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 252147}
{"url": "https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L18-L33", "sha": "7be8b956e53c70b35f34e1783a8fe8f716955afb", "docstring_summary": "Output a simple table with several columns.", "language": "python", "parameters": "(rows)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'<Func>'", "for", "arg_2", "in", "arg_0", ":", "arg_1", "+=", "'<tr>'", "for", "arg_3", "in", "arg_2", ":", "arg_1", "+=", "'<td>{s}</td>'", ".", "format", "(", "s", "=", "arg_3", ")", "arg_1", "+=", "'</tr>'", "arg_1", "+=", "'</Func>'", "return", "arg_1"], "function": "def Func(arg_0):\n    '''\n    Output a simple Func with several columns.\n    '''\n\n    arg_1 = '<Func>'\n\n    for arg_2 in arg_0:\n        arg_1 += '<tr>'\n        for arg_3 in arg_2:\n            arg_1 += '<td>{s}</td>'.format(s=arg_3)\n        arg_1 += '</tr>'\n\n    arg_1 += '</Func>'\n\n    return arg_1", "path": "django_baseline/templatetags/helpers.py", "identifier": "table", "docstring": "Output a simple table with several columns.", "docstring_tokens": ["Output", "a", "simple", "table", "with", "several", "columns", "."], "nwo": "theduke/django-baseline", "score": 0.0, "idx": 252148}
{"url": "https://github.com/yeonghoey/yhy/blob/4bce1482c31aeeccff96c4cfd1803b83932604e7/yhy/commands/__init__.py#L5-L15", "sha": "4bce1482c31aeeccff96c4cfd1803b83932604e7", "docstring_summary": "Build CLI dynamically based on the package structure.", "language": "python", "parameters": "(cli, path, package)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "iter_modules", "(", "arg_1", ")", ":", "arg_6", "=", "import_module", "(", "f'.{name}'", ",", "arg_2", ")", "if", "arg_5", ":", "Func", "(", "arg_0", ".", "group", "(", "arg_4", ")", "(", "arg_6", ".", "group", ")", ",", "arg_6", ".", "__path__", ",", "arg_6", ".", "__package__", ")", "else", ":", "arg_0", ".", "command", "(", "arg_4", ")", "(", "arg_6", ".", "command", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Build CLI dynamically based on the package structure.\n    \"\"\"\n    for arg_3, arg_4, arg_5 in iter_modules(arg_1):\n        arg_6 = import_module(f'.{name}', arg_2)\n        if arg_5:\n            Func(arg_0.group(arg_4)(arg_6.group),\n                  arg_6.__path__,\n                  arg_6.__package__)\n        else:\n            arg_0.command(arg_4)(arg_6.command)", "path": "yhy/commands/__init__.py", "identifier": "build", "docstring": "Build CLI dynamically based on the package structure.", "docstring_tokens": ["Build", "CLI", "dynamically", "based", "on", "the", "package", "structure", "."], "nwo": "yeonghoey/yhy", "score": 0.09252797783733271, "idx": 252149}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/conf/__init__.py#L46-L59", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "Get or set `Settings._wrapped`", "language": "python", "parameters": "(path=None, with_path=None)", "return_statement": "return Settings._wrapped", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", ":", "Settings", ".", "bind", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "Settings", ".", "_wrapped"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"\n    Get or set `Settings._wrapped`\n\n    :param str path: a python module file,\n        if user set it,write config to `Settings._wrapped`\n    :param str with_path: search path\n    :return: A instance of `Settings`\n    \"\"\"\n\n    if arg_0:\n        Settings.bind(arg_0, arg_1=arg_1)\n\n    return Settings._wrapped", "path": "cliez/conf/__init__.py", "identifier": "settings", "docstring": "Get or set `Settings._wrapped`\n\n    :param str path: a python module file,\n        if user set it,write config to `Settings._wrapped`\n    :param str with_path: search path\n    :return: A instance of `Settings`", "docstring_tokens": ["Get", "or", "set", "Settings", ".", "_wrapped"], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 252150}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mysql_to_gcs.py#L210-L253", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Takes a cursor, and writes the BigQuery schema in .json format for the\n        results to a local file system.", "language": "python", "parameters": "(self, cursor)", "return_statement": "return schema_file_to_upload", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "arg_3", "=", "'application/json'", "arg_4", "=", "NamedTemporaryFile", "(", "delete", "=", "True", ")", "if", "arg_0", ".", "schema", "is", "not", "None", "and", "isinstance", "(", "arg_0", ".", "schema", ",", "string_types", ")", ":", "arg_2", "=", "arg_0", ".", "schema", ".", "encode", "(", "'utf-8'", ")", "elif", "arg_0", ".", "schema", "is", "not", "None", "and", "isinstance", "(", "arg_0", ".", "schema", ",", "list", ")", ":", "arg_2", "=", "json", ".", "dumps", "(", "arg_0", ".", "schema", ")", ".", "encode", "(", "'utf-8'", ")", "else", ":", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_1", ".", "description", ":", "arg_7", "=", "arg_6", "[", "0", "]", "arg_8", "=", "arg_0", ".", "type_map", "(", "arg_6", "[", "1", "]", ")", "if", "arg_6", "[", "6", "]", "or", "arg_8", "==", "'TIMESTAMP'", ":", "arg_9", "=", "'NULLABLE'", "else", ":", "arg_9", "=", "'REQUIRED'", "arg_5", ".", "append", "(", "{", "'name'", ":", "arg_7", ",", "'type'", ":", "arg_8", ",", "'mode'", ":", "arg_9", ",", "}", ")", "arg_2", "=", "json", ".", "dumps", "(", "arg_5", ",", "sort_keys", "=", "True", ")", ".", "encode", "(", "'utf-8'", ")", "arg_4", ".", "write", "(", "arg_2", ")", "arg_0", ".", "log", ".", "info", "(", "'Using schema for %s: %s'", ",", "arg_0", ".", "schema_filename", ",", "arg_2", ")", "arg_10", "=", "{", "'file_name'", ":", "arg_0", ".", "schema_filename", ",", "'file_handle'", ":", "arg_4", ",", "'file_mime_type'", ":", "arg_3", "}", "return", "arg_10"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Takes a cursor, and writes the BigQuery schema in .json format for the\n        results to a local file system.\n\n        :return: A dictionary where key is a filename to be used as an object\n            name in GCS, and values are file handles to local files that\n            contains the BigQuery schema fields in .json format.\n        \"\"\"\n        arg_2 = None\n        arg_3 = 'application/json'\n        arg_4 = NamedTemporaryFile(delete=True)\n        if arg_0.schema is not None and isinstance(arg_0.schema, string_types):\n            arg_2 = arg_0.schema.encode('utf-8')\n        elif arg_0.schema is not None and isinstance(arg_0.schema, list):\n            arg_2 = json.dumps(arg_0.schema).encode('utf-8')\n        else:\n            arg_5 = []\n            for arg_6 in arg_1.description:\n                # See PEP 249 for details about the description tuple.\n                arg_7 = arg_6[0]\n                arg_8 = arg_0.type_map(arg_6[1])\n                # Always allow TIMESTAMP to be nullable. MySQLdb returns None types\n                # for required fields because some MySQL timestamps can't be\n                # represented by Python's datetime (e.g. 0000-00-00 00:00:00).\n                if arg_6[6] or arg_8 == 'TIMESTAMP':\n                    arg_9 = 'NULLABLE'\n                else:\n                    arg_9 = 'REQUIRED'\n                arg_5.append({\n                    'name': arg_7,\n                    'type': arg_8,\n                    'mode': arg_9,\n                })\n            arg_2 = json.dumps(arg_5, sort_keys=True).encode('utf-8')\n        arg_4.write(arg_2)\n\n        arg_0.log.info('Using schema for %s: %s', arg_0.schema_filename, arg_2)\n        arg_10 = {\n            'file_name': arg_0.schema_filename,\n            'file_handle': arg_4,\n            'file_mime_type': arg_3\n        }\n        return arg_10", "path": "airflow/contrib/operators/mysql_to_gcs.py", "identifier": "MySqlToGoogleCloudStorageOperator._write_local_schema_file", "docstring": "Takes a cursor, and writes the BigQuery schema in .json format for the\n        results to a local file system.\n\n        :return: A dictionary where key is a filename to be used as an object\n            name in GCS, and values are file handles to local files that\n            contains the BigQuery schema fields in .json format.", "docstring_tokens": ["Takes", "a", "cursor", "and", "writes", "the", "BigQuery", "schema", "in", ".", "json", "format", "for", "the", "results", "to", "a", "local", "file", "system", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252151}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/billing.py#L211-L229", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Method to build an IP list for the case 1", "language": "python", "parameters": "(query, period_start, period_end)", "return_statement": "return ip_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "filter", "(", "models", ".", "IPAddress", ".", "version", "==", "4L", ")", ".", "filter", "(", "models", ".", "IPAddress", ".", "network_id", "==", "PUBLIC_NETWORK_ID", ")", ".", "filter", "(", "models", ".", "IPAddress", ".", "used_by_tenant_id", "is", "not", "None", ")", ".", "filter", "(", "models", ".", "IPAddress", ".", "allocated_at", "!=", "null", "(", ")", ")", ".", "filter", "(", "models", ".", "IPAddress", ".", "allocated_at", "<", "arg_1", ")", ".", "filter", "(", "or_", "(", "models", ".", "IPAddress", ".", "_deallocated", "is", "False", ",", "models", ".", "IPAddress", ".", "deallocated_at", "==", "null", "(", ")", ",", "models", ".", "IPAddress", ".", "deallocated_at", ">=", "arg_2", ")", ")", ".", "all", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Method to build an IP list for the case 1\n\n    when the IP was allocated before the period start\n    and is still allocated after the period end.\n    This method only looks at public IPv4 addresses.\n    \"\"\"\n    # Filter out only IPv4 that have not been deallocated\n    arg_3 = arg_0.\\\n        filter(models.IPAddress.version == 4L).\\\n        filter(models.IPAddress.network_id == PUBLIC_NETWORK_ID).\\\n        filter(models.IPAddress.used_by_tenant_id is not None).\\\n        filter(models.IPAddress.allocated_at != null()).\\\n        filter(models.IPAddress.allocated_at < arg_1).\\\n        filter(or_(models.IPAddress._deallocated is False,\n                   models.IPAddress.deallocated_at == null(),\n                   models.IPAddress.deallocated_at >= arg_2)).all()\n\n    return arg_3", "path": "quark/billing.py", "identifier": "build_full_day_ips", "docstring": "Method to build an IP list for the case 1\n\n    when the IP was allocated before the period start\n    and is still allocated after the period end.\n    This method only looks at public IPv4 addresses.", "docstring_tokens": ["Method", "to", "build", "an", "IP", "list", "for", "the", "case", "1"], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 252152}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/writers/tagvalue.py#L219-L234", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Write extracted licenses fields to out.", "language": "python", "parameters": "(lics, out)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "write_value", "(", "'LicenseID'", ",", "arg_0", ".", "identifier", ",", "arg_1", ")", "if", "arg_0", ".", "full_name", "is", "not", "None", ":", "write_value", "(", "'LicenseName'", ",", "arg_0", ".", "full_name", ",", "arg_1", ")", "if", "arg_0", ".", "comment", "is", "not", "None", ":", "write_text_value", "(", "'LicenseComment'", ",", "arg_0", ".", "comment", ",", "arg_1", ")", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "cross_ref", ")", ":", "write_value", "(", "'LicenseCrossReference'", ",", "arg_2", ",", "arg_1", ")", "write_text_value", "(", "'ExtractedText'", ",", "arg_0", ".", "text", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Write extracted licenses fields to out.\n    \"\"\"\n    write_value('LicenseID', arg_0.identifier, arg_1)\n\n    if arg_0.full_name is not None:\n        write_value('LicenseName', arg_0.full_name, arg_1)\n\n    if arg_0.comment is not None:\n        write_text_value('LicenseComment', arg_0.comment, arg_1)\n\n    for arg_2 in sorted(arg_0.cross_ref):\n        write_value('LicenseCrossReference', arg_2, arg_1)\n\n    write_text_value('ExtractedText', arg_0.text, arg_1)", "path": "spdx/writers/tagvalue.py", "identifier": "write_extracted_licenses", "docstring": "Write extracted licenses fields to out.", "docstring_tokens": ["Write", "extracted", "licenses", "fields", "to", "out", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 252153}
{"url": "https://github.com/PyFilesystem/s3fs/blob/1c5e3a1b6abbb9dff91ea7fc4cec7353798cd536/fs_s3fs/_s3fs.py#L34-L58", "sha": "1c5e3a1b6abbb9dff91ea7fc4cec7353798cd536", "docstring_summary": "Generate a repr string.", "language": "python", "parameters": "(class_name, *args, **kwargs)", "return_statement": "return \"{}({})\".format(class_name, \", \".join(arguments))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "[", "repr", "(", "arg", ")", "for", "arg", "in", "arg_1", "]", "arg_3", ".", "extend", "(", "\"{}={!r}\"", ".", "format", "(", "arg_4", ",", "arg_5", ")", "for", "arg_4", ",", "(", "arg_5", ",", "arg_6", ")", "in", "sorted", "(", "arg_2", ".", "items", "(", ")", ")", "if", "arg_5", "!=", "arg_6", ")", "return", "\"{}({})\"", ".", "format", "(", "arg_0", ",", "\", \"", ".", "join", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"\n    Generate a repr string.\n\n    Positional arguments should be the positional arguments used to\n    construct the class. Keyword arguments should consist of tuples of\n    the attribute value and default. If the value is the default, then\n    it won't be rendered in the output.\n\n    Here's an example::\n\n        def __repr__(self):\n            return make_repr('MyClass', 'foo', name=(self.name, None))\n\n    The output of this would be something line ``MyClass('foo',\n    name='Will')``.\n\n    \"\"\"\n    arg_3 = [repr(arg) for arg in arg_1]\n    arg_3.extend(\n        \"{}={!r}\".format(arg_4, arg_5)\n        for arg_4, (arg_5, arg_6) in sorted(arg_2.items())\n        if arg_5 != arg_6\n    )\n    return \"{}({})\".format(arg_0, \", \".join(arg_3))", "path": "fs_s3fs/_s3fs.py", "identifier": "_make_repr", "docstring": "Generate a repr string.\n\n    Positional arguments should be the positional arguments used to\n    construct the class. Keyword arguments should consist of tuples of\n    the attribute value and default. If the value is the default, then\n    it won't be rendered in the output.\n\n    Here's an example::\n\n        def __repr__(self):\n            return make_repr('MyClass', 'foo', name=(self.name, None))\n\n    The output of this would be something line ``MyClass('foo',\n    name='Will')``.", "docstring_tokens": ["Generate", "a", "repr", "string", "."], "nwo": "PyFilesystem/s3fs", "score": 0.5194424507085634, "idx": 252154}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/execution_time.py#L265-L318", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "calculate the difference between starting and ending time.", "language": "python", "parameters": "(cls, start=None, end=None)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "and", "arg_2", ":", "arg_3", "=", "int", "(", "arg_2", ")", "-", "int", "(", "arg_1", ")", "else", ":", "arg_3", "=", "PyFunceble", ".", "INTERN", "[", "\"end\"", "]", "-", "PyFunceble", ".", "INTERN", "[", "\"start\"", "]", "arg_4", "=", "PyFunceble", ".", "OrderedDict", "(", ")", "arg_4", "[", "\"days\"", "]", "=", "str", "(", "arg_3", "//", "(", "24", "*", "60", "*", "60", ")", ")", ".", "zfill", "(", "2", ")", "arg_4", "[", "\"hours\"", "]", "=", "str", "(", "(", "arg_3", "//", "(", "60", "*", "60", ")", ")", "%", "24", ")", ".", "zfill", "(", "2", ")", "arg_4", "[", "\"minutes\"", "]", "=", "str", "(", "(", "arg_3", "%", "3600", ")", "//", "60", ")", ".", "zfill", "(", "2", ")", "arg_4", "[", "\"seconds\"", "]", "=", "str", "(", "arg_3", "%", "60", ")", ".", "zfill", "(", "2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        calculate the difference between starting and ending time.\n\n        :param start: A starting time.\n        :type start: int|str\n\n        :param stop: A ending time.\n        :type stop: int|str\n\n        :return:\n            A dict with following as index.\n\n                * :code:`days`\n                * :code:`hours`\n                * :code:`minutes`\n                * :code:`seconds`\n\n            as index.\n        :rtype: dict\n        \"\"\"\n\n        if arg_1 and arg_2:\n            # The start and end time is explicitly given.\n\n            # We get the difference between the ending and the starting time.\n            arg_3 = int(arg_2) - int(arg_1)\n        else:\n            # The start and end time is not explicitly given.\n\n            # We get the difference between the ending and the starting time.\n            arg_3 = PyFunceble.INTERN[\"end\"] - PyFunceble.INTERN[\"start\"]\n\n        # We initiate an OrderedDict.\n        # Indeed, we use an ordered dict because we want the structuration and the\n        # order to stay always the same.\n        # As a dictionnary is always unordered, we can use it. Otherwise the time will\n        # not be shown correctly.\n        arg_4 = PyFunceble.OrderedDict()\n\n        # We calculate and append the day to our data.\n        arg_4[\"days\"] = str(arg_3 // (24 * 60 * 60)).zfill(2)\n\n        # We calculate and append the hours to our data.\n        arg_4[\"hours\"] = str((arg_3 // (60 * 60)) % 24).zfill(2)\n\n        # We calculate and append the minutes to our data.\n        arg_4[\"minutes\"] = str((arg_3 % 3600) // 60).zfill(2)\n\n        # We calculate and append the minutes to our data.\n        arg_4[\"seconds\"] = str(arg_3 % 60).zfill(2)\n\n        # We finaly return our data.\n        return arg_4", "path": "PyFunceble/execution_time.py", "identifier": "ExecutionTime._calculate", "docstring": "calculate the difference between starting and ending time.\n\n        :param start: A starting time.\n        :type start: int|str\n\n        :param stop: A ending time.\n        :type stop: int|str\n\n        :return:\n            A dict with following as index.\n\n                * :code:`days`\n                * :code:`hours`\n                * :code:`minutes`\n                * :code:`seconds`\n\n            as index.\n        :rtype: dict", "docstring_tokens": ["calculate", "the", "difference", "between", "starting", "and", "ending", "time", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 252155}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L122-L131", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Verify that install_requires is a valid requirements list", "language": "python", "parameters": "(dist, attr, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "list", "(", "pkg_resources", ".", "parse_requirements", "(", "arg_2", ")", ")", "except", "(", "TypeError", ",", "ValueError", ")", "as", "error", ":", "arg_3", "=", "(", "\"{attr!r} must be a string or list of strings \"", "\"containing valid project/version requirement specifiers; {error}\"", ")", "raise", "DistutilsSetupError", "(", "arg_3", ".", "format", "(", "arg_1", "=", "arg_1", ",", "error", "=", "error", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Verify that install_requires is a valid requirements list\"\"\"\n    try:\n        list(pkg_resources.parse_requirements(arg_2))\n    except (TypeError, ValueError) as error:\n        arg_3 = (\n            \"{attr!r} must be a string or list of strings \"\n            \"containing valid project/version requirement specifiers; {error}\"\n        )\n        raise DistutilsSetupError(arg_3.format(arg_1=arg_1, error=error))", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py", "identifier": "check_requirements", "docstring": "Verify that install_requires is a valid requirements list", "docstring_tokens": ["Verify", "that", "install_requires", "is", "a", "valid", "requirements", "list"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252156}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L223-L253", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks if an blob_name is updated in Google Cloud Storage.", "language": "python", "parameters": "(self, bucket_name, object_name, ts)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_conn", "(", ")", "arg_5", "=", "storage", ".", "Bucket", "(", "arg_4", "=", "arg_4", ",", "name", "=", "arg_1", ")", "arg_6", "=", "arg_5", ".", "get_blob", "(", "blob_name", "=", "arg_2", ")", "arg_6", ".", "reload", "(", ")", "arg_7", "=", "arg_6", ".", "updated", "if", "arg_7", "is", "not", "None", ":", "import", "dateutil", ".", "tz", "if", "not", "arg_3", ".", "tzinfo", ":", "arg_3", "=", "arg_3", ".", "replace", "(", "tzinfo", "=", "dateutil", ".", "tz", ".", "tzutc", "(", ")", ")", "arg_0", ".", "log", ".", "info", "(", "\"Verify object date: %s > %s\"", ",", "arg_7", ",", "arg_3", ")", "if", "arg_7", ">", "arg_3", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Checks if an blob_name is updated in Google Cloud Storage.\n\n        :param bucket_name: The Google cloud storage bucket where the object is.\n        :type bucket_name: str\n        :param object_name: The name of the object to check in the Google cloud\n            storage bucket.\n        :type object_name: str\n        :param ts: The timestamp to check against.\n        :type ts: datetime.datetime\n        \"\"\"\n        arg_4 = arg_0.get_conn()\n        arg_5 = storage.Bucket(arg_4=arg_4, name=arg_1)\n        arg_6 = arg_5.get_blob(blob_name=arg_2)\n        arg_6.reload()\n\n        arg_7 = arg_6.updated\n\n        if arg_7 is not None:\n            import dateutil.tz\n\n            if not arg_3.tzinfo:\n                arg_3 = arg_3.replace(tzinfo=dateutil.tz.tzutc())\n\n            arg_0.log.info(\"Verify object date: %s > %s\", arg_7, arg_3)\n\n            if arg_7 > arg_3:\n                return True\n\n        return False", "path": "airflow/contrib/hooks/gcs_hook.py", "identifier": "GoogleCloudStorageHook.is_updated_after", "docstring": "Checks if an blob_name is updated in Google Cloud Storage.\n\n        :param bucket_name: The Google cloud storage bucket where the object is.\n        :type bucket_name: str\n        :param object_name: The name of the object to check in the Google cloud\n            storage bucket.\n        :type object_name: str\n        :param ts: The timestamp to check against.\n        :type ts: datetime.datetime", "docstring_tokens": ["Checks", "if", "an", "blob_name", "is", "updated", "in", "Google", "Cloud", "Storage", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252157}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmds.py#L129-L161", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "attrdict pipe can extract attribute values of object into a dict.", "language": "python", "parameters": "(prev, attr_names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "dict", "(", ")", "for", "arg_4", "in", "arg_1", ".", "keys", "(", ")", ":", "if", "hasattr", "(", "arg_2", ",", "arg_4", ")", ":", "arg_3", "[", "arg_4", "]", "=", "getattr", "(", "arg_2", ",", "arg_4", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "arg_1", "[", "arg_4", "]", "yield", "arg_3", "else", ":", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "dict", "(", ")", "for", "arg_4", "in", "arg_1", ":", "if", "hasattr", "(", "arg_2", ",", "arg_4", ")", ":", "arg_3", "[", "arg_4", "]", "=", "getattr", "(", "arg_2", ",", "arg_4", ")", "yield", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Func pipe can extract attribute values of object into a dict.\n\n    The argument attr_names can be a list or a dict.\n\n    If attr_names is a list and its item is not a valid attribute of\n    prev's object. It will be excluded from yielded dict.\n\n    If attr_names is dict and the key doesn't exist in prev's object.\n    the value of corresponding attr_names key will be copy to yielded dict.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param attr_names: The list or dict of attribute names\n    :type attr_names: str of list or dict\n    :returns: generator\n    \"\"\"\n    if isinstance(arg_1, dict):\n        for arg_2 in arg_0:\n            arg_3 = dict()\n            for arg_4 in arg_1.keys():\n                if hasattr(arg_2, arg_4):\n                    arg_3[arg_4] = getattr(arg_2, arg_4)\n                else:\n                    arg_3[arg_4] = arg_1[arg_4]\n            yield arg_3\n    else:\n        for arg_2 in arg_0:\n            arg_3 = dict()\n            for arg_4 in arg_1:\n                if hasattr(arg_2, arg_4):\n                    arg_3[arg_4] = getattr(arg_2, arg_4)\n            yield arg_3", "path": "cmdlet/cmds.py", "identifier": "attrdict", "docstring": "attrdict pipe can extract attribute values of object into a dict.\n\n    The argument attr_names can be a list or a dict.\n\n    If attr_names is a list and its item is not a valid attribute of\n    prev's object. It will be excluded from yielded dict.\n\n    If attr_names is dict and the key doesn't exist in prev's object.\n    the value of corresponding attr_names key will be copy to yielded dict.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param attr_names: The list or dict of attribute names\n    :type attr_names: str of list or dict\n    :returns: generator", "docstring_tokens": ["attrdict", "pipe", "can", "extract", "attribute", "values", "of", "object", "into", "a", "dict", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 252158}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L985-L1007", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Processes the raw error message sent by the server\n        and close connection with current server.", "language": "python", "parameters": "(self, err_msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "STALE_CONNECTION", "in", "arg_1", ":", "yield", "from", "arg_0", ".", "_process_op_err", "(", "ErrStaleConnection", ")", "return", "if", "AUTHORIZATION_VIOLATION", "in", "arg_1", ":", "arg_0", ".", "_err", "=", "ErrAuthorization", "else", ":", "arg_3", "=", "b'nats: '", "+", "arg_1", "[", "0", "]", "arg_0", ".", "_err", "=", "NatsError", "(", "arg_3", ".", "decode", "(", ")", ")", "arg_4", "=", "False", "if", "not", "arg_0", ".", "is_connecting", ":", "arg_4", "=", "True", "arg_0", ".", "_loop", ".", "create_task", "(", "arg_0", ".", "_close", "(", "Client", ".", "CLOSED", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Processes the raw error message sent by the server\n        and close connection with current server.\n        \"\"\"\n        if STALE_CONNECTION in arg_1:\n            yield from arg_0._process_op_err(ErrStaleConnection)\n            return\n\n        if AUTHORIZATION_VIOLATION in arg_1:\n            arg_0._err = ErrAuthorization\n        else:\n            arg_3 = b'nats: ' + arg_1[0]\n            arg_0._err = NatsError(arg_3.decode())\n\n        arg_4 = False\n        if not arg_0.is_connecting:\n            arg_4 = True\n\n        # FIXME: Some errors such as 'Invalid Subscription'\n        # do not cause the server to close the connection.\n        # For now we handle similar as other clients and close.\n        arg_0._loop.create_task(arg_0._close(Client.CLOSED, arg_4))", "path": "nats/aio/client.py", "identifier": "Client._process_err", "docstring": "Processes the raw error message sent by the server\n        and close connection with current server.", "docstring_tokens": ["Processes", "the", "raw", "error", "message", "sent", "by", "the", "server", "and", "close", "connection", "with", "current", "server", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 252159}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L39-L82", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes the standard deviation of a mixture distribution.", "language": "python", "parameters": "(mixture_weight_vector, mean_vector, stddev_vector)", "return_statement": "return tf.sqrt(mixture_variance)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "tensorshape_util", ".", "assert_has_rank", "(", "arg_0", ".", "shape", ",", "2", ")", "if", "not", "tensorshape_util", ".", "is_compatible_with", "(", "arg_1", ".", "shape", ",", "arg_0", ".", "shape", ")", ":", "raise", "ValueError", "(", "\"Expecting means to have same shape as mixture weights.\"", ")", "if", "not", "tensorshape_util", ".", "is_compatible_with", "(", "arg_2", ".", "shape", ",", "arg_0", ".", "shape", ")", ":", "raise", "ValueError", "(", "\"Expecting stddevs to have same shape as mixture weights.\"", ")", "arg_3", "=", "tf", ".", "expand_dims", "(", "arg_0", ",", "axis", "=", "1", ")", "arg_4", "=", "tf", ".", "expand_dims", "(", "arg_1", ",", "axis", "=", "2", ")", "arg_5", "=", "tf", ".", "expand_dims", "(", "arg_2", ",", "axis", "=", "2", ")", "arg_6", "=", "tf", ".", "matmul", "(", "arg_3", ",", "arg_4", ")", "arg_6", "=", "tf", ".", "reshape", "(", "arg_6", ",", "(", "-", "1", ",", ")", ")", "arg_7", "=", "tf", ".", "matmul", "(", "arg_3", ",", "tf", ".", "square", "(", "arg_5", ")", ")", "arg_7", "=", "tf", ".", "reshape", "(", "arg_7", ",", "(", "-", "1", ",", ")", ")", "arg_8", "=", "tf", ".", "matmul", "(", "arg_3", ",", "tf", ".", "square", "(", "arg_4", ")", ")", "arg_8", "=", "tf", ".", "reshape", "(", "arg_8", ",", "(", "-", "1", ",", ")", ")", "arg_9", "=", "arg_7", "+", "arg_8", "-", "tf", ".", "square", "(", "arg_6", ")", "return", "tf", ".", "sqrt", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Computes the standard deviation of a mixture distribution.\n\n  This function works regardless of the component distribution, so long as\n  each component's mean and standard deviation can be provided.\n\n  Args:\n    mixture_weight_vector: A 2D tensor with shape [batch_size, num_components]\n    mean_vector: A 2D tensor of mixture component means. Has shape `[batch_size,\n      num_components]`.\n    stddev_vector: A 2D tensor of mixture component standard deviations. Has\n      shape `[batch_size, num_components]`.\n\n  Returns:\n    A 1D tensor of shape `[batch_size]` representing the standard deviation of\n    the mixture distribution with given weights and component means and standard\n    deviations.\n  Raises:\n    ValueError: If the shapes of the input tensors are not as expected.\n  \"\"\"\n  tensorshape_util.assert_has_rank(arg_0.shape, 2)\n  if not tensorshape_util.is_compatible_with(arg_1.shape,\n                                             arg_0.shape):\n    raise ValueError(\"Expecting means to have same shape as mixture weights.\")\n  if not tensorshape_util.is_compatible_with(arg_2.shape,\n                                             arg_0.shape):\n    raise ValueError(\"Expecting stddevs to have same shape as mixture weights.\")\n\n  # Reshape the distribution parameters for batched vectorized dot products.\n  arg_3 = tf.expand_dims(arg_0, axis=1)\n  arg_4 = tf.expand_dims(arg_1, axis=2)\n  arg_5 = tf.expand_dims(arg_2, axis=2)\n\n  # weighted average of component means under mixture distribution.\n  arg_6 = tf.matmul(arg_3, arg_4)\n  arg_6 = tf.reshape(arg_6, (-1,))\n  # weighted average of component variances under mixture distribution.\n  arg_7 = tf.matmul(arg_3, tf.square(arg_5))\n  arg_7 = tf.reshape(arg_7, (-1,))\n  # weighted average of component squared means under mixture distribution.\n  arg_8 = tf.matmul(arg_3, tf.square(arg_4))\n  arg_8 = tf.reshape(arg_8, (-1,))\n  arg_9 = arg_7 + arg_8 - tf.square(arg_6)\n  return tf.sqrt(arg_9)", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "mixture_stddev", "docstring": "Computes the standard deviation of a mixture distribution.\n\n  This function works regardless of the component distribution, so long as\n  each component's mean and standard deviation can be provided.\n\n  Args:\n    mixture_weight_vector: A 2D tensor with shape [batch_size, num_components]\n    mean_vector: A 2D tensor of mixture component means. Has shape `[batch_size,\n      num_components]`.\n    stddev_vector: A 2D tensor of mixture component standard deviations. Has\n      shape `[batch_size, num_components]`.\n\n  Returns:\n    A 1D tensor of shape `[batch_size]` representing the standard deviation of\n    the mixture distribution with given weights and component means and standard\n    deviations.\n  Raises:\n    ValueError: If the shapes of the input tensors are not as expected.", "docstring_tokens": ["Computes", "the", "standard", "deviation", "of", "a", "mixture", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252160}
{"url": "https://github.com/ElevenPaths/AtomShields/blob/e75f25393b4a7a315ec96bf9b8e654cb2200866a/atomshields/scanner.py#L571-L620", "sha": "e75f25393b4a7a315ec96bf9b8e654cb2200866a", "docstring_summary": "Run a scan in the path setted.", "language": "python", "parameters": "(self)", "return_statement": "return self.issues", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "checkProperties", "(", ")", "arg_0", ".", "debug", "(", "\"[*] Iniciando escaneo de AtomShields con las siguientes propiedades. . . \"", ")", "arg_0", ".", "showScanProperties", "(", ")", "arg_0", ".", "loadConfig", "(", ")", "arg_1", "=", "datetime", ".", "now", "(", ")", "arg_2", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "arg_0", ".", "path", ")", "arg_3", "=", "arg_0", ".", "executeCheckers", "(", ")", "os", ".", "chdir", "(", "arg_2", ")", "arg_4", "=", "datetime", ".", "now", "(", ")", "arg_5", "=", "'{}'", ".", "format", "(", "arg_4", "-", "arg_1", ")", "for", "arg_6", "in", "arg_3", ".", "keys", "(", ")", ":", "arg_7", "=", "arg_3", "[", "arg_6", "]", "if", "isinstance", "(", "arg_7", ",", "list", ")", ":", "map", "(", "arg_0", ".", "saveIssue", ",", "arg_7", ")", "else", ":", "arg_0", ".", "saveIssue", "(", "arg_7", ")", "print", "\"\"", "arg_0", ".", "executeReports", "(", ")", "arg_0", ".", "debug", "(", "\"\"", ")", "arg_0", ".", "debug", "(", "\"Duration: {t}\"", ".", "format", "(", "t", "=", "arg_5", ")", ")", "arg_0", ".", "showSummary", "(", ")", "return", "arg_0", ".", "issues"], "function": "def Func(arg_0):\n\t\t\"\"\"\n\t\tRun a scan in the path setted.\n\t\t\"\"\"\n\n\t\targ_0.checkProperties()\n\n\t\targ_0.debug(\"[*] Iniciando escaneo de AtomShields con las siguientes propiedades. . . \")\n\n\t\targ_0.showScanProperties()\n\n\t\targ_0.loadConfig()\n\n\t\t# Init time counter\n\t\targ_1 = datetime.now()\n\n\t\t# Execute plugins\n\t\targ_2 = os.getcwd()\n\t\tos.chdir(arg_0.path)\n\t\targ_3 = arg_0.executeCheckers()\n\t\tos.chdir(arg_2)\n\n\n\n\n\t\t# Finish time counter\n\t\targ_4 = datetime.now()\n\t\targ_5 = '{}'.format(arg_4 - arg_1)\n\n\t\t# Process and set issues\n\t\tfor arg_6 in arg_3.keys():\n\t\t\targ_7 = arg_3[arg_6]\n\t\t\tif isinstance(arg_7, list):\n\t\t\t\tmap(arg_0.saveIssue, arg_7)\n\t\t\telse:\n\t\t\t\targ_0.saveIssue(arg_7)\n\n\n\n\t\t# Execute reports\n\t\tprint \"\"\n\t\targ_0.executeReports()\n\n\n\t\t# Print summary output.\n\t\targ_0.debug(\"\")\n\t\targ_0.debug(\"Duration: {t}\".format(t=arg_5))\n\t\targ_0.showSummary()\n\n\t\treturn arg_0.issues", "path": "atomshields/scanner.py", "identifier": "AtomShieldsScanner.run", "docstring": "Run a scan in the path setted.", "docstring_tokens": ["Run", "a", "scan", "in", "the", "path", "setted", "."], "nwo": "ElevenPaths/AtomShields", "score": 0.3901382355567912, "idx": 252161}
{"url": "https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/nosedjango.py#L29-L45", "sha": "cd4d06857c88291769bc38e5c9573f43b7ffcd6a", "docstring_summary": "Hunt down the settings.py module by going up the FS path", "language": "python", "parameters": "(settings_module)", "return_statement": "return cwd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "getcwd", "(", ")", "arg_2", "=", "'%s.py'", "%", "(", "arg_0", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "while", "arg_1", ":", "if", "arg_2", "in", "os", ".", "listdir", "(", "arg_1", ")", ":", "break", "arg_1", "=", "os", ".", "path", ".", "split", "(", "arg_1", ")", "[", "0", "]", "if", "os", ".", "name", "==", "'nt'", "and", "NT_ROOT", ".", "match", "(", "arg_1", ")", ":", "return", "None", "elif", "arg_1", "==", "'/'", ":", "return", "None", "return", "arg_1"], "function": "def Func(arg_0):\n    '''\n    Hunt down the settings.py module by going up the FS path\n    '''\n    arg_1 = os.getcwd()\n    arg_2 = '%s.py' % (\n        arg_0.split('.')[-1]\n    )\n    while arg_1:\n        if arg_2 in os.listdir(arg_1):\n            break\n        arg_1 = os.path.split(arg_1)[0]\n        if os.name == 'nt' and NT_ROOT.match(arg_1):\n            return None\n        elif arg_1 == '/':\n            return None\n    return arg_1", "path": "nosedjango/nosedjango.py", "identifier": "get_settings_path", "docstring": "Hunt down the settings.py module by going up the FS path", "docstring_tokens": ["Hunt", "down", "the", "settings", ".", "py", "module", "by", "going", "up", "the", "FS", "path"], "nwo": "nosedjango/nosedjango", "score": 0.27365494979801214, "idx": 252162}
{"url": "https://github.com/bkg/greenwich/blob/57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141/greenwich/raster.py#L564-L570", "sha": "57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141", "docstring_summary": "Returns read only property for band nodata value, assuming single\n        band rasters for now.", "language": "python", "parameters": "(self)", "return_statement": "return self._nodata", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Func", "is", "None", ":", "arg_0", ".", "_Func", "=", "arg_0", "[", "0", "]", ".", "GetNoDataValue", "(", ")", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"Returns read only property for band Func value, assuming single\n        band rasters for now.\n        \"\"\"\n        if arg_0._Func is None:\n            arg_0._Func = arg_0[0].GetNoDataValue()\n        return arg_0._Func", "path": "greenwich/raster.py", "identifier": "Raster.nodata", "docstring": "Returns read only property for band nodata value, assuming single\n        band rasters for now.", "docstring_tokens": ["Returns", "read", "only", "property", "for", "band", "nodata", "value", "assuming", "single", "band", "rasters", "for", "now", "."], "nwo": "bkg/greenwich", "score": 0.15726537023232431, "idx": 252163}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/views.py#L359-L374", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Accpet pending invitation.", "language": "python", "parameters": "(group_id)", "return_statement": "return redirect(url_for('.invitations', group_id=membership.group.id))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Membership", ".", "query", ".", "get_or_404", "(", "(", "current_user", ".", "get_id", "(", ")", ",", "arg_0", ")", ")", "try", ":", "arg_1", ".", "Func", "(", ")", "except", "Exception", "as", "e", ":", "flash", "(", "str", "(", "e", ")", ",", "'error'", ")", "return", "redirect", "(", "url_for", "(", "'.invitations'", ",", "arg_0", "=", "arg_1", ".", "group", ".", "id", ")", ")", "flash", "(", "_", "(", "'You are now part of %(name)s group.'", ",", "user", "=", "arg_1", ".", "user", ".", "email", ",", "name", "=", "arg_1", ".", "group", ".", "name", ")", ",", "'success'", ")", "return", "redirect", "(", "url_for", "(", "'.invitations'", ",", "arg_0", "=", "arg_1", ".", "group", ".", "id", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Accpet pending invitation.\"\"\"\n    arg_1 = Membership.query.get_or_404((current_user.get_id(), arg_0))\n\n    # no permission check, because they are checked during Memberships creating\n\n    try:\n        arg_1.Func()\n    except Exception as e:\n        flash(str(e), 'error')\n        return redirect(url_for('.invitations', arg_0=arg_1.group.id))\n\n    flash(_('You are now part of %(name)s group.',\n            user=arg_1.user.email,\n            name=arg_1.group.name), 'success')\n    return redirect(url_for('.invitations', arg_0=arg_1.group.id))", "path": "invenio_groups/views.py", "identifier": "accept", "docstring": "Accpet pending invitation.", "docstring_tokens": ["Accpet", "pending", "invitation", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 252164}
{"url": "https://github.com/snjoetw/py-synology/blob/4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f/synology/api.py#L153-L170", "sha": "4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f", "docstring_summary": "Return a list of cameras matching camera_ids.", "language": "python", "parameters": "(self, camera_ids, **kwargs)", "return_statement": "return cameras", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_api_info", "[", "'camera'", "]", "arg_4", "=", "dict", "(", "{", "'_sid'", ":", "arg_0", ".", "_sid", ",", "'api'", ":", "arg_3", "[", "'name'", "]", ",", "'method'", ":", "'GetInfo'", ",", "'version'", ":", "arg_3", "[", "'version'", "]", ",", "'cameraIds'", ":", "', '", ".", "join", "(", "str", "(", "id", ")", "for", "id", "in", "arg_1", ")", ",", "}", ",", "**", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_get_json_with_retry", "(", "arg_3", "[", "'url'", "]", ",", "arg_4", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_5", "[", "'data'", "]", "[", "'cameras'", "]", ":", "arg_6", ".", "append", "(", "Camera", "(", "arg_7", ",", "arg_0", ".", "_video_stream_url", ")", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Return a list of cameras matching camera_ids.\"\"\"\n        arg_3 = arg_0._api_info['camera']\n        arg_4 = dict({\n            '_sid': arg_0._sid,\n            'api': arg_3['name'],\n            'method': 'GetInfo',\n            'version': arg_3['version'],\n            'cameraIds': ', '.join(str(id) for id in arg_1),\n        }, **arg_2)\n        arg_5 = arg_0._get_json_with_retry(arg_3['url'], arg_4)\n\n        arg_6 = []\n\n        for arg_7 in arg_5['data']['cameras']:\n            arg_6.append(Camera(arg_7, arg_0._video_stream_url))\n\n        return arg_6", "path": "synology/api.py", "identifier": "Api.camera_info", "docstring": "Return a list of cameras matching camera_ids.", "docstring_tokens": ["Return", "a", "list", "of", "cameras", "matching", "camera_ids", "."], "nwo": "snjoetw/py-synology", "score": 0.28899999164266604, "idx": 252165}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/transforms/functional.py#L577-L594", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Adjust color saturation of an image.", "language": "python", "parameters": "(img, saturation_factor)", "return_statement": "return img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "_is_pil_image", "(", "arg_0", ")", ":", "raise", "TypeError", "(", "'img should be PIL Image. Got {}'", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")", "arg_2", "=", "ImageEnhance", ".", "Color", "(", "arg_0", ")", "arg_0", "=", "arg_2", ".", "enhance", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Adjust color saturation of an image.\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        saturation_factor (float):  How much to adjust the saturation. 0 will\n            give a black and white image, 1 will give the original image while\n            2 will enhance the saturation by a factor of 2.\n\n    Returns:\n        PIL Image: Saturation adjusted image.\n    \"\"\"\n    if not _is_pil_image(arg_0):\n        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))\n\n    arg_2 = ImageEnhance.Color(arg_0)\n    arg_0 = arg_2.enhance(arg_1)\n    return arg_0", "path": "torchvision/transforms/functional.py", "identifier": "adjust_saturation", "docstring": "Adjust color saturation of an image.\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        saturation_factor (float):  How much to adjust the saturation. 0 will\n            give a black and white image, 1 will give the original image while\n            2 will enhance the saturation by a factor of 2.\n\n    Returns:\n        PIL Image: Saturation adjusted image.", "docstring_tokens": ["Adjust", "color", "saturation", "of", "an", "image", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 252166}
{"url": "https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L304-L316", "sha": "6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d", "docstring_summary": "Asynchronous PUT request with the process pool.", "language": "python", "parameters": "(self, url, name, data, callback=None, params=None, headers=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "''", "arg_5", "=", "arg_5", "or", "{", "}", "arg_6", "=", "arg_6", "or", "{", "}", "arg_7", "=", "arg_0", ".", "_build_endpoint_url", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_authenticate", "(", "arg_5", ",", "arg_6", ")", "arg_3", "=", "json", ".", "dumps", "(", "arg_3", ",", "cls", "=", "JSONEncoder", ")", "process_pool", ".", "apply_async", "(", "make_put_request", ",", "args", "=", "(", "arg_7", ",", "arg_3", ",", "arg_5", ",", "arg_6", ")", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None):\n        \"\"\"\n        Asynchronous PUT request with the process pool.\n        \"\"\"\n        if arg_2 is None: arg_2 = ''\n        arg_5 = arg_5 or {}\n        arg_6 = arg_6 or {}\n        arg_7 = arg_0._build_endpoint_url(arg_1, arg_2)\n        arg_0._authenticate(arg_5, arg_6)\n        arg_3 = json.dumps(arg_3, cls=JSONEncoder)\n        process_pool.apply_async(make_put_request,\n                                 args=(arg_7, arg_3, arg_5, arg_6),\n                                 arg_4=arg_4)", "path": "firebase/firebase.py", "identifier": "FirebaseApplication.put_async", "docstring": "Asynchronous PUT request with the process pool.", "docstring_tokens": ["Asynchronous", "PUT", "request", "with", "the", "process", "pool", "."], "nwo": "ozgur/python-firebase", "score": 0.7583798599854712, "idx": 252167}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/models.py#L530-L542", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Link user email to Enterprise Customer.", "language": "python", "parameters": "(self, enterprise_customer, user_email)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "User", ".", "objects", ".", "get", "(", "email", "=", "arg_2", ")", "arg_0", ".", "get_or_create", "(", "arg_1", "=", "arg_1", ",", "user_id", "=", "arg_3", ".", "id", ")", "except", "User", ".", "DoesNotExist", ":", "PendingEnterpriseCustomerUser", ".", "objects", ".", "get_or_create", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Link user email to Enterprise Customer.\n\n        If :class:`django.contrib.auth.models.User` instance with specified email does not exist,\n        :class:`.PendingEnterpriseCustomerUser` instance is created instead.\n        \"\"\"\n        try:\n            arg_3 = User.objects.get(email=arg_2)\n            arg_0.get_or_create(arg_1=arg_1, user_id=arg_3.id)\n        except User.DoesNotExist:\n            PendingEnterpriseCustomerUser.objects.get_or_create(arg_1=arg_1,\n                                                                arg_2=arg_2)", "path": "enterprise/models.py", "identifier": "EnterpriseCustomerUserManager.link_user", "docstring": "Link user email to Enterprise Customer.\n\n        If :class:`django.contrib.auth.models.User` instance with specified email does not exist,\n        :class:`.PendingEnterpriseCustomerUser` instance is created instead.", "docstring_tokens": ["Link", "user", "email", "to", "Enterprise", "Customer", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252168}
{"url": "https://github.com/virtuald/pyhcl/blob/e6e27742215692974f0ef503a91a81ec4adc171c/src/hcl/lexer.py#L194-L198", "sha": "e6e27742215692974f0ef503a91a81ec4adc171c", "docstring_summary": "r'<<-\\S+\\r?\\n", "language": "python", "parameters": "(self, t)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "lexer", ".", "is_tabbed", "=", "True", "arg_0", ".", "_init_heredoc", "(", "arg_1", ")", "arg_1", ".", "lexer", ".", "begin", "(", "'tabbedheredoc'", ")"], "function": "def Func(arg_0, arg_1):\n        r'<<-\\S+\\r?\\n'\n        arg_1.lexer.is_tabbed = True\n        arg_0._init_heredoc(arg_1)\n        arg_1.lexer.begin('tabbedheredoc')", "path": "src/hcl/lexer.py", "identifier": "Lexer.t_tabbedheredoc", "docstring": "r'<<-\\S+\\r?\\n", "docstring_tokens": ["r", "<<", "-", "\\", "S", "+", "\\", "r?", "\\", "n"], "nwo": "virtuald/pyhcl", "score": 0.9187691850498276, "idx": 252169}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L309-L367", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Fix the length an array `data` to exactly `size`.", "language": "python", "parameters": "(data, size, axis=-1, **kwargs)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "-", "1", ",", "**", "arg_3", ")", ":", "arg_3", ".", "setdefault", "(", "'mode'", ",", "'constant'", ")", "arg_4", "=", "arg_0", ".", "shape", "[", "arg_2", "]", "if", "arg_4", ">", "arg_1", ":", "arg_5", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "arg_5", "[", "arg_2", "]", "=", "slice", "(", "0", ",", "arg_1", ")", "return", "arg_0", "[", "tuple", "(", "arg_5", ")", "]", "elif", "arg_4", "<", "arg_1", ":", "arg_6", "=", "[", "(", "0", ",", "0", ")", "]", "*", "arg_0", ".", "ndim", "arg_6", "[", "arg_2", "]", "=", "(", "0", ",", "arg_1", "-", "arg_4", ")", "return", "np", ".", "pad", "(", "arg_0", ",", "arg_6", ",", "**", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=-1, **arg_3):\n    '''Fix the length an array `data` to exactly `size`.\n\n    If `data.shape[axis] < n`, pad according to the provided kwargs.\n    By default, `data` is padded with trailing zeros.\n\n    Examples\n    --------\n    >>> y = np.arange(7)\n    >>> # Default: pad with zeros\n    >>> librosa.util.Func(y, 10)\n    array([0, 1, 2, 3, 4, 5, 6, 0, 0, 0])\n    >>> # Trim to a desired length\n    >>> librosa.util.Func(y, 5)\n    array([0, 1, 2, 3, 4])\n    >>> # Use edge-padding instead of zeros\n    >>> librosa.util.Func(y, 10, mode='edge')\n    array([0, 1, 2, 3, 4, 5, 6, 6, 6, 6])\n\n    Parameters\n    ----------\n    data : np.ndarray\n      array to be length-adjusted\n\n    size : int >= 0 [scalar]\n      desired length of the array\n\n    axis : int, <= data.ndim\n      axis along which to fix length\n\n    kwargs : additional keyword arguments\n        Parameters to `np.pad()`\n\n    Returns\n    -------\n    data_fixed : np.ndarray [shape=data.shape]\n        `data` either trimmed or padded to length `size`\n        along the specified axis.\n\n    See Also\n    --------\n    numpy.pad\n    '''\n\n    arg_3.setdefault('mode', 'constant')\n\n    arg_4 = arg_0.shape[arg_2]\n\n    if arg_4 > arg_1:\n        arg_5 = [slice(None)] * arg_0.ndim\n        arg_5[arg_2] = slice(0, arg_1)\n        return arg_0[tuple(arg_5)]\n\n    elif arg_4 < arg_1:\n        arg_6 = [(0, 0)] * arg_0.ndim\n        arg_6[arg_2] = (0, arg_1 - arg_4)\n        return np.pad(arg_0, arg_6, **arg_3)\n\n    return arg_0", "path": "librosa/util/utils.py", "identifier": "fix_length", "docstring": "Fix the length an array `data` to exactly `size`.\n\n    If `data.shape[axis] < n`, pad according to the provided kwargs.\n    By default, `data` is padded with trailing zeros.\n\n    Examples\n    --------\n    >>> y = np.arange(7)\n    >>> # Default: pad with zeros\n    >>> librosa.util.fix_length(y, 10)\n    array([0, 1, 2, 3, 4, 5, 6, 0, 0, 0])\n    >>> # Trim to a desired length\n    >>> librosa.util.fix_length(y, 5)\n    array([0, 1, 2, 3, 4])\n    >>> # Use edge-padding instead of zeros\n    >>> librosa.util.fix_length(y, 10, mode='edge')\n    array([0, 1, 2, 3, 4, 5, 6, 6, 6, 6])\n\n    Parameters\n    ----------\n    data : np.ndarray\n      array to be length-adjusted\n\n    size : int >= 0 [scalar]\n      desired length of the array\n\n    axis : int, <= data.ndim\n      axis along which to fix length\n\n    kwargs : additional keyword arguments\n        Parameters to `np.pad()`\n\n    Returns\n    -------\n    data_fixed : np.ndarray [shape=data.shape]\n        `data` either trimmed or padded to length `size`\n        along the specified axis.\n\n    See Also\n    --------\n    numpy.pad", "docstring_tokens": ["Fix", "the", "length", "an", "array", "data", "to", "exactly", "size", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 252170}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/volume.py#L1085-L1117", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate pressure-dependent liquid molar volume at\n        temperature `T` and pressure `P` with a given method.", "language": "python", "parameters": "(self, T, P, method)", "return_statement": "return Vm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", "==", "COSTALD_COMPRESSED", ":", "arg_4", "=", "arg_0", ".", "T_dependent_property", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "Psat", "(", "arg_1", ")", "if", "hasattr", "(", "arg_0", ".", "Psat", ",", "'__call__'", ")", "else", "arg_0", ".", "Psat", "arg_4", "=", "COSTALD_compressed", "(", "arg_1", ",", "arg_2", ",", "arg_5", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "omega", ",", "arg_4", ")", "elif", "arg_3", "==", "COOLPROP", ":", "arg_4", "=", "1.", "/", "PropsSI", "(", "'DMOLAR'", ",", "'T'", ",", "arg_1", ",", "'P'", ",", "arg_2", ",", "arg_0", ".", "CASRN", ")", "elif", "arg_3", "==", "EOS", ":", "arg_0", ".", "eos", "[", "0", "]", "=", "arg_0", ".", "eos", "[", "0", "]", ".", "to_TP", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "arg_0", ".", "eos", "[", "0", "]", ".", "V_l", "elif", "arg_3", "in", "arg_0", ".", "tabular_data", ":", "arg_4", "=", "arg_0", ".", "interpolate_P", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        r'''Method to calculate pressure-dependent liquid molar volume at\n        temperature `T` and pressure `P` with a given method.\n\n        This method has no exception handling; see `TP_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate molar volume, [K]\n        P : float\n            Pressure at which to calculate molar volume, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the liquid at T and P, [m^3/mol]\n        '''\n        if arg_3 == COSTALD_COMPRESSED:\n            arg_4 = arg_0.T_dependent_property(arg_1)\n            arg_5 = arg_0.Psat(arg_1) if hasattr(arg_0.Psat, '__call__') else arg_0.Psat\n            arg_4 = COSTALD_compressed(arg_1, arg_2, arg_5, arg_0.Tc, arg_0.Pc, arg_0.omega, arg_4)\n        elif arg_3 == COOLPROP:\n            arg_4 = 1./PropsSI('DMOLAR', 'T', arg_1, 'P', arg_2, arg_0.CASRN)\n        elif arg_3 == EOS:\n            arg_0.eos[0] = arg_0.eos[0].to_TP(arg_1=arg_1, arg_2=arg_2)\n            arg_4 = arg_0.eos[0].V_l\n        elif arg_3 in arg_0.tabular_data:\n            arg_4 = arg_0.interpolate_P(arg_1, arg_2, arg_3)\n        return arg_4", "path": "thermo/volume.py", "identifier": "VolumeLiquid.calculate_P", "docstring": "r'''Method to calculate pressure-dependent liquid molar volume at\n        temperature `T` and pressure `P` with a given method.\n\n        This method has no exception handling; see `TP_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate molar volume, [K]\n        P : float\n            Pressure at which to calculate molar volume, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the liquid at T and P, [m^3/mol]", "docstring_tokens": ["r", "Method", "to", "calculate", "pressure", "-", "dependent", "liquid", "molar", "volume", "at", "temperature", "T", "and", "pressure", "P", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 252171}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L450-L477", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Create an endpoint", "language": "python", "parameters": "(self, config, wait_for_completion=True,\n                        check_interval=30, max_ingestion_time=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "30", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "**", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "check_status", "(", "arg_1", "[", "'EndpointName'", "]", ",", "'EndpointStatus'", ",", "arg_0", ".", "describe_endpoint", ",", "arg_3", ",", "arg_4", ",", "non_terminal_states", "=", "arg_0", ".", "endpoint_non_terminal_states", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True,\n                        arg_3=30, arg_4=None):\n        \"\"\"\n        Create an endpoint\n\n        :param config: the config for endpoint\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to endpoint creation\n        \"\"\"\n\n        arg_5 = arg_0.get_conn().Func(**arg_1)\n        if arg_2:\n            arg_0.check_status(arg_1['EndpointName'],\n                              'EndpointStatus',\n                              arg_0.describe_endpoint,\n                              arg_3, arg_4,\n                              non_terminal_states=arg_0.endpoint_non_terminal_states\n                              )\n        return arg_5", "path": "airflow/contrib/hooks/sagemaker_hook.py", "identifier": "SageMakerHook.create_endpoint", "docstring": "Create an endpoint\n\n        :param config: the config for endpoint\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to endpoint creation", "docstring_tokens": ["Create", "an", "endpoint"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252172}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/inspector.py#L200-L240", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Open a popup menu with options regarding the selected object", "language": "python", "parameters": "(self, item, mouse_pos=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", ":", "arg_3", "=", "arg_0", ".", "tree", ".", "GetItemData", "(", "arg_1", ")", "if", "arg_3", ":", "arg_4", "=", "arg_3", ".", "GetData", "(", ")", "if", "arg_4", ":", "arg_0", ".", "highlight", "(", "arg_4", ".", "wx_obj", ")", "arg_0", ".", "obj", "=", "arg_4", "arg_5", "=", "wx", ".", "Menu", "(", ")", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "[", "wx", ".", "NewId", "(", ")", "for", "i", "in", "range", "(", "4", ")", "]", "arg_5", ".", "Append", "(", "arg_6", ",", "\"Delete\"", ")", "arg_5", ".", "Append", "(", "arg_7", ",", "\"Duplicate\"", ")", "arg_5", ".", "Append", "(", "arg_8", ",", "\"Bring to Front\"", ")", "arg_5", ".", "Append", "(", "arg_9", ",", "\"Send to Back\"", ")", "arg_10", "=", "wx", ".", "Menu", "(", ")", "for", "arg_11", "in", "sorted", "(", "arg_4", ".", "_meta", ".", "valid_children", ",", "key", "=", "lambda", "c", ":", "registry", ".", "ALL", ".", "index", "(", "c", ".", "_meta", ".", "name", ")", ")", ":", "arg_12", "=", "wx", ".", "NewId", "(", ")", "arg_10", ".", "Append", "(", "arg_12", ",", "arg_11", ".", "_meta", ".", "name", ")", "arg_0", ".", "Bind", "(", "wx", ".", "EVT_MENU", ",", "lambda", "evt", ",", "arg_11", "=", "arg_11", ":", "arg_0", ".", "add_child", "(", "arg_11", ",", "arg_2", ")", ",", "id", "=", "arg_12", ")", "arg_5", ".", "AppendMenu", "(", "wx", ".", "NewId", "(", ")", ",", "\"Add child\"", ",", "arg_10", ")", "arg_0", ".", "Bind", "(", "wx", ".", "EVT_MENU", ",", "arg_0", ".", "delete", ",", "id", "=", "arg_6", ")", "arg_0", ".", "Bind", "(", "wx", ".", "EVT_MENU", ",", "arg_0", ".", "duplicate", ",", "id", "=", "arg_7", ")", "arg_0", ".", "Bind", "(", "wx", ".", "EVT_MENU", ",", "arg_0", ".", "bring_to_front", ",", "id", "=", "arg_8", ")", "arg_0", ".", "Bind", "(", "wx", ".", "EVT_MENU", ",", "arg_0", ".", "send_to_back", ",", "id", "=", "arg_9", ")", "arg_0", ".", "PopupMenu", "(", "arg_5", ")", "arg_5", ".", "Destroy", "(", ")", "arg_0", ".", "load_object", "(", "arg_0", ".", "root_obj", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"Open a popup menu with options regarding the selected object\"\n        if arg_1:\n            arg_3 = arg_0.tree.GetItemData(arg_1)\n            if arg_3:\n                arg_4 = arg_3.GetData()\n                if arg_4:\n                    # highligh and store the selected object:\n                    arg_0.highlight(arg_4.wx_obj)\n                    arg_0.obj = arg_4\n                    \n                    # make the context menu\n                    arg_5 = wx.Menu()\n                    arg_6, arg_7, arg_8, arg_9 = [wx.NewId() for i\n                                                            in range(4)]\n                    arg_5.Append(arg_6, \"Delete\")\n                    arg_5.Append(arg_7, \"Duplicate\")\n                    arg_5.Append(arg_8, \"Bring to Front\")\n                    arg_5.Append(arg_9, \"Send to Back\")\n\n                    # make submenu!\n                    arg_10 = wx.Menu()\n                    for arg_11 in sorted(arg_4._meta.valid_children,\n                                       key=lambda c: \n                                            registry.ALL.index(c._meta.name)):\n                        arg_12 = wx.NewId()\n                        arg_10.Append(arg_12, arg_11._meta.name)\n                        arg_0.Bind(wx.EVT_MENU, \n                                  lambda evt, arg_11=arg_11: arg_0.add_child(arg_11, arg_2), \n                                  id=arg_12)\n                        \n                    arg_5.AppendMenu(wx.NewId(), \"Add child\", arg_10)\n\n                    arg_0.Bind(wx.EVT_MENU, arg_0.delete, id=arg_6)\n                    arg_0.Bind(wx.EVT_MENU, arg_0.duplicate, id=arg_7)\n                    arg_0.Bind(wx.EVT_MENU, arg_0.bring_to_front, id=arg_8)\n                    arg_0.Bind(wx.EVT_MENU, arg_0.send_to_back, id=arg_9)\n\n                    arg_0.PopupMenu(arg_5)\n                    arg_5.Destroy()\n                    arg_0.load_object(arg_0.root_obj)", "path": "gui/tools/inspector.py", "identifier": "InspectorPanel.show_context_menu", "docstring": "Open a popup menu with options regarding the selected object", "docstring_tokens": ["Open", "a", "popup", "menu", "with", "options", "regarding", "the", "selected", "object"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 252173}
{"url": "https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L76-L80", "sha": "73994c82360e65a983c803b1182892e2138320b2", "docstring_summary": "Return True if the class is a date type.", "language": "python", "parameters": "(cls)", "return_statement": "return issubclass(cls, date) and not issubclass(cls, datetime)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "type", ")", ":", "return", "False", "return", "issubclass", "(", "arg_0", ",", "date", ")", "and", "not", "issubclass", "(", "arg_0", ",", "datetime", ")"], "function": "def Func(arg_0):\n    \"\"\"Return True if the class is a date type.\"\"\"\n    if not isinstance(arg_0, type):\n        return False\n    return issubclass(arg_0, date) and not issubclass(arg_0, datetime)", "path": "era.py", "identifier": "is_date_type", "docstring": "Return True if the class is a date type.", "docstring_tokens": ["Return", "True", "if", "the", "class", "is", "a", "date", "type", "."], "nwo": "zenreach/py-era", "score": 0.0, "idx": 252174}
{"url": "https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L452-L517", "sha": "800976faab3b827a42fa1cb80f13fcc03961d2c9", "docstring_summary": "Intercept all requests and add the OAuth 2 token if present.", "language": "python", "parameters": "(\n        self,\n        method,\n        url,\n        data=None,\n        headers=None,\n        withhold_token=False,\n        client_id=None,\n        client_secret=None,\n        **kwargs\n    )", "return_statement": "return super(OAuth2Session, self).request(\n            method, url, headers=headers, data=data, **kwargs\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "**", "arg_8", ")", ":", "if", "not", "is_secure_transport", "(", "arg_2", ")", ":", "raise", "InsecureTransportError", "(", ")", "if", "arg_0", ".", "token", "and", "not", "arg_5", ":", "log", ".", "debug", "(", "\"Invoking %d protected resource Func hooks.\"", ",", "len", "(", "arg_0", ".", "compliance_hook", "[", "\"protected_Func\"", "]", ")", ",", ")", "for", "arg_9", "in", "arg_0", ".", "compliance_hook", "[", "\"protected_Func\"", "]", ":", "log", ".", "debug", "(", "\"Invoking hook %s.\"", ",", "arg_9", ")", "arg_2", ",", "arg_4", ",", "arg_3", "=", "arg_9", "(", "arg_2", ",", "arg_4", ",", "arg_3", ")", "log", ".", "debug", "(", "\"Adding token %s to Func.\"", ",", "arg_0", ".", "token", ")", "try", ":", "arg_2", ",", "arg_4", ",", "arg_3", "=", "arg_0", ".", "_client", ".", "add_token", "(", "arg_2", ",", "http_method", "=", "arg_1", ",", "body", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "except", "TokenExpiredError", ":", "if", "arg_0", ".", "auto_refresh_url", ":", "log", ".", "debug", "(", "\"Auto refresh is set, attempting to refresh at %s.\"", ",", "arg_0", ".", "auto_refresh_url", ",", ")", "arg_10", "=", "arg_8", ".", "pop", "(", "\"auth\"", ",", "None", ")", "if", "arg_6", "and", "arg_7", "and", "(", "arg_10", "is", "None", ")", ":", "log", ".", "debug", "(", "'Encoding client_id \"%s\" with client_secret as Basic auth credentials.'", ",", "arg_6", ",", ")", "arg_10", "=", "Funcs", ".", "auth", ".", "HTTPBasicAuth", "(", "arg_6", ",", "arg_7", ")", "arg_11", "=", "arg_0", ".", "refresh_token", "(", "arg_0", ".", "auto_refresh_url", ",", "arg_10", "=", "arg_10", ",", "**", "arg_8", ")", "if", "arg_0", ".", "token_updater", ":", "log", ".", "debug", "(", "\"Updating token to %s using %s.\"", ",", "arg_11", ",", "arg_0", ".", "token_updater", ")", "arg_0", ".", "token_updater", "(", "arg_11", ")", "arg_2", ",", "arg_4", ",", "arg_3", "=", "arg_0", ".", "_client", ".", "add_token", "(", "arg_2", ",", "http_method", "=", "arg_1", ",", "body", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "else", ":", "raise", "TokenUpdated", "(", "arg_11", ")", "else", ":", "raise", "log", ".", "debug", "(", "\"Requesting url %s using method %s.\"", ",", "arg_2", ",", "arg_1", ")", "log", ".", "debug", "(", "\"Supplying headers %s and data %s\"", ",", "arg_4", ",", "arg_3", ")", "log", ".", "debug", "(", "\"Passing through key word arguments %s.\"", ",", "arg_8", ")", "return", "super", "(", "OAuth2Session", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ",", "**", "arg_8", ")"], "function": "def Func(\n        arg_0,\n        arg_1,\n        arg_2,\n        arg_3=None,\n        arg_4=None,\n        arg_5=False,\n        arg_6=None,\n        arg_7=None,\n        **arg_8\n    ):\n        \"\"\"Intercept all Funcs and add the OAuth 2 token if present.\"\"\"\n        if not is_secure_transport(arg_2):\n            raise InsecureTransportError()\n        if arg_0.token and not arg_5:\n            log.debug(\n                \"Invoking %d protected resource Func hooks.\",\n                len(arg_0.compliance_hook[\"protected_Func\"]),\n            )\n            for arg_9 in arg_0.compliance_hook[\"protected_Func\"]:\n                log.debug(\"Invoking hook %s.\", arg_9)\n                arg_2, arg_4, arg_3 = arg_9(arg_2, arg_4, arg_3)\n\n            log.debug(\"Adding token %s to Func.\", arg_0.token)\n            try:\n                arg_2, arg_4, arg_3 = arg_0._client.add_token(\n                    arg_2, http_method=arg_1, body=arg_3, arg_4=arg_4\n                )\n            # Attempt to retrieve and save new access token if expired\n            except TokenExpiredError:\n                if arg_0.auto_refresh_url:\n                    log.debug(\n                        \"Auto refresh is set, attempting to refresh at %s.\",\n                        arg_0.auto_refresh_url,\n                    )\n\n                    # We mustn't pass auth twice.\n                    arg_10 = arg_8.pop(\"auth\", None)\n                    if arg_6 and arg_7 and (arg_10 is None):\n                        log.debug(\n                            'Encoding client_id \"%s\" with client_secret as Basic auth credentials.',\n                            arg_6,\n                        )\n                        arg_10 = Funcs.auth.HTTPBasicAuth(arg_6, arg_7)\n                    arg_11 = arg_0.refresh_token(\n                        arg_0.auto_refresh_url, arg_10=arg_10, **arg_8\n                    )\n                    if arg_0.token_updater:\n                        log.debug(\n                            \"Updating token to %s using %s.\", arg_11, arg_0.token_updater\n                        )\n                        arg_0.token_updater(arg_11)\n                        arg_2, arg_4, arg_3 = arg_0._client.add_token(\n                            arg_2, http_method=arg_1, body=arg_3, arg_4=arg_4\n                        )\n                    else:\n                        raise TokenUpdated(arg_11)\n                else:\n                    raise\n\n        log.debug(\"Requesting url %s using method %s.\", arg_2, arg_1)\n        log.debug(\"Supplying headers %s and data %s\", arg_4, arg_3)\n        log.debug(\"Passing through key word arguments %s.\", arg_8)\n        return super(OAuth2Session, arg_0).Func(\n            arg_1, arg_2, arg_4=arg_4, arg_3=arg_3, **arg_8\n        )", "path": "requests_oauthlib/oauth2_session.py", "identifier": "OAuth2Session.request", "docstring": "Intercept all requests and add the OAuth 2 token if present.", "docstring_tokens": ["Intercept", "all", "requests", "and", "add", "the", "OAuth", "2", "token", "if", "present", "."], "nwo": "requests/requests-oauthlib", "score": 0.9446339936112974, "idx": 252175}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/combine.py#L422-L437", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Builds input arguments by stitching input filepaths and input\n    formats together.", "language": "python", "parameters": "(input_filepath_list, input_format_list)", "return_statement": "return input_args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "!=", "len", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "\"input_format_list & input_filepath_list are not the same size\"", ")", "arg_2", "=", "[", "]", "arg_3", "=", "zip", "(", "arg_0", ",", "arg_1", ")", "for", "arg_4", ",", "arg_5", "in", "arg_3", ":", "arg_2", ".", "extend", "(", "arg_5", ")", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    ''' Builds input arguments by stitching input filepaths and input\n    formats together.\n    '''\n    if len(arg_1) != len(arg_0):\n        raise ValueError(\n            \"input_format_list & input_filepath_list are not the same size\"\n        )\n\n    arg_2 = []\n    arg_3 = zip(arg_0, arg_1)\n    for arg_4, arg_5 in arg_3:\n        arg_2.extend(arg_5)\n        arg_2.append(arg_4)\n\n    return arg_2", "path": "sox/combine.py", "identifier": "_build_input_args", "docstring": "Builds input arguments by stitching input filepaths and input\n    formats together.", "docstring_tokens": ["Builds", "input", "arguments", "by", "stitching", "input", "filepaths", "and", "input", "formats", "together", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 252176}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L1055-L1078", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Summarize the mean of a tensor in nats and bits per unit.", "language": "python", "parameters": "(inputs, units, name,\n                                    nats_name_scope=\"nats\",\n                                    bits_name_scope=\"bits_per_dim\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"nats\"", ",", "arg_4", "=", "\"bits_per_dim\"", ")", ":", "arg_5", "=", "tf", ".", "reduce_mean", "(", "input_tensor", "=", "arg_0", ")", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_3", ")", ":", "tf", ".", "compat", ".", "v2", ".", "summary", ".", "scalar", "(", "arg_2", ",", "arg_5", ",", "step", "=", "tf", ".", "compat", ".", "v1", ".", "train", ".", "get_or_create_global_step", "(", ")", ")", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_4", ")", ":", "tf", ".", "compat", ".", "v2", ".", "summary", ".", "scalar", "(", "arg_2", ",", "arg_5", "/", "arg_1", "/", "tf", ".", "math", ".", "log", "(", "2.", ")", ",", "step", "=", "tf", ".", "compat", ".", "v1", ".", "train", ".", "get_or_create_global_step", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                                    arg_3=\"nats\",\n                                    arg_4=\"bits_per_dim\"):\n  \"\"\"Summarize the mean of a tensor in nats and bits per unit.\n\n  Args:\n    inputs: A tensor of values measured in nats.\n    units: The units of the tensor with which to compute the mean bits\n      per unit.\n    name: The name of the tensor.\n    nats_name_scope: The name scope of the nats summary.\n    bits_name_scope: The name scope of the bits summary.\n  \"\"\"\n  arg_5 = tf.reduce_mean(input_tensor=arg_0)\n  with tf.compat.v1.name_scope(arg_3):\n    tf.compat.v2.summary.scalar(\n        arg_2,\n        arg_5,\n        step=tf.compat.v1.train.get_or_create_global_step())\n  with tf.compat.v1.name_scope(arg_4):\n    tf.compat.v2.summary.scalar(\n        arg_2,\n        arg_5 / arg_1 / tf.math.log(2.),\n        step=tf.compat.v1.train.get_or_create_global_step())", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "summarize_mean_in_nats_and_bits", "docstring": "Summarize the mean of a tensor in nats and bits per unit.\n\n  Args:\n    inputs: A tensor of values measured in nats.\n    units: The units of the tensor with which to compute the mean bits\n      per unit.\n    name: The name of the tensor.\n    nats_name_scope: The name scope of the nats summary.\n    bits_name_scope: The name scope of the bits summary.", "docstring_tokens": ["Summarize", "the", "mean", "of", "a", "tensor", "in", "nats", "and", "bits", "per", "unit", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252177}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L130-L140", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Resolves VirtualEnvironments in CPENV_HOME", "language": "python", "parameters": "(resolver, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", ".", "api", "import", "get_home_path", "arg_1", "=", "unipath", "(", "get_home_path", "(", ")", ",", "arg_1", ")", "if", "is_environment", "(", "arg_1", ")", ":", "return", "VirtualEnvironment", "(", "arg_1", ")", "raise", "ResolveError"], "function": "def Func(arg_0, arg_1):\n    '''Resolves VirtualEnvironments in CPENV_HOME'''\n\n    from .api import get_home_path\n\n    arg_1 = unipath(get_home_path(), arg_1)\n\n    if is_environment(arg_1):\n        return VirtualEnvironment(arg_1)\n\n    raise ResolveError", "path": "cpenv/resolver.py", "identifier": "home_resolver", "docstring": "Resolves VirtualEnvironments in CPENV_HOME", "docstring_tokens": ["Resolves", "VirtualEnvironments", "in", "CPENV_HOME"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 252178}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/initializer.py#L236-L242", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Apply initialize to circuit.", "language": "python", "parameters": "(self, params, qubits)", "return_statement": "return self.append(Initialize(params), qubits)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "isinstance", "(", "arg_2", ",", "QuantumRegister", ")", ":", "arg_2", "=", "arg_2", "[", ":", "]", "else", ":", "arg_2", "=", "_convert_to_bits", "(", "[", "arg_2", "]", ",", "[", "qbit", "for", "qreg", "in", "arg_0", ".", "qregs", "for", "qbit", "in", "qreg", "]", ")", "[", "0", "]", "return", "arg_0", ".", "append", "(", "Initialize", "(", "arg_1", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Apply Func to circuit.\"\"\"\n    if isinstance(arg_2, QuantumRegister):\n        arg_2 = arg_2[:]\n    else:\n        arg_2 = _convert_to_bits([arg_2], [qbit for qreg in arg_0.qregs for qbit in qreg])[0]\n    return arg_0.append(Initialize(arg_1), arg_2)", "path": "qiskit/extensions/initializer.py", "identifier": "initialize", "docstring": "Apply initialize to circuit.", "docstring_tokens": ["Apply", "initialize", "to", "circuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252179}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/courses.py#L88-L96", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Create a canvas course with the given subaccount id and course name.", "language": "python", "parameters": "(self, account_id, course_name)", "return_statement": "return CanvasCourse(data=self._post_resource(url, body))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "ACCOUNTS_API", ".", "format", "(", "arg_1", ")", "+", "\"/courses\"", "arg_4", "=", "{", "\"course\"", ":", "{", "\"name\"", ":", "arg_2", "}", "}", "return", "CanvasCourse", "(", "data", "=", "arg_0", ".", "_post_resource", "(", "arg_3", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Create a canvas course with the given subaccount id and course name.\n\n        https://canvas.instructure.com/doc/api/courses.html#method.courses.create\n        \"\"\"\n        arg_3 = ACCOUNTS_API.format(arg_1) + \"/courses\"\n        arg_4 = {\"course\": {\"name\": arg_2}}\n        return CanvasCourse(data=arg_0._post_resource(arg_3, arg_4))", "path": "uw_canvas/courses.py", "identifier": "Courses.create_course", "docstring": "Create a canvas course with the given subaccount id and course name.\n\n        https://canvas.instructure.com/doc/api/courses.html#method.courses.create", "docstring_tokens": ["Create", "a", "canvas", "course", "with", "the", "given", "subaccount", "id", "and", "course", "name", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 252180}
{"url": "https://github.com/funkybob/django-sniplates/blob/cc6123a00536017b496dc685881952d98192101f/sniplates/templatetags/sniplates.py#L124-L143", "sha": "cc6123a00536017b496dc685881952d98192101f", "docstring_summary": "Load a series of widget libraries.", "language": "python", "parameters": "(context, **kwargs)", "return_statement": "return ''", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "pop", "(", "'_soft'", ",", "False", ")", "try", ":", "arg_3", "=", "arg_0", ".", "render_context", "[", "WIDGET_CONTEXT_KEY", "]", "except", "KeyError", ":", "arg_3", "=", "arg_0", ".", "render_context", "[", "WIDGET_CONTEXT_KEY", "]", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_2", "and", "arg_4", "in", "arg_3", ":", "continue", "with", "arg_0", ".", "render_context", ".", "push", "(", "{", "BLOCK_CONTEXT_KEY", ":", "BlockContext", "(", ")", "}", ")", ":", "arg_6", "=", "resolve_blocks", "(", "arg_5", ",", "arg_0", ")", "arg_3", "[", "arg_4", "]", "=", "arg_6", "return", "''"], "function": "def Func(arg_0, **arg_1):\n    '''\n    Load a series of widget libraries.\n    '''\n    arg_2 = arg_1.pop('_soft', False)\n\n    try:\n        arg_3 = arg_0.render_context[WIDGET_CONTEXT_KEY]\n    except KeyError:\n        arg_3 = arg_0.render_context[WIDGET_CONTEXT_KEY] = {}\n\n    for arg_4, arg_5 in arg_1.items():\n        if arg_2 and arg_4 in arg_3:\n            continue\n\n        with arg_0.render_context.push({BLOCK_CONTEXT_KEY: BlockContext()}):\n            arg_6 = resolve_blocks(arg_5, arg_0)\n            arg_3[arg_4] = arg_6\n\n    return ''", "path": "sniplates/templatetags/sniplates.py", "identifier": "load_widgets", "docstring": "Load a series of widget libraries.", "docstring_tokens": ["Load", "a", "series", "of", "widget", "libraries", "."], "nwo": "funkybob/django-sniplates", "score": 0.18843024134315003, "idx": 252181}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/analytics.py#L40-L48", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Returns participation data for the given sis_course_id.", "language": "python", "parameters": "(self, sis_course_id)", "return_statement": "return self._get_resource(url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"/api/v1/courses/%s/analytics/activity.json\"", "%", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"course\"", ")", ")", "return", "arg_0", ".", "_get_resource", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns participation data for the given sis_course_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.course_participation\n        \"\"\"\n        arg_2 = \"/api/v1/courses/%s/analytics/activity.json\" % (\n            arg_0._sis_id(arg_1, sis_field=\"course\"))\n        return arg_0._get_resource(arg_2)", "path": "uw_canvas/analytics.py", "identifier": "Analytics.get_activity_by_sis_course_id", "docstring": "Returns participation data for the given sis_course_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.course_participation", "docstring_tokens": ["Returns", "participation", "data", "for", "the", "given", "sis_course_id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 252182}
{"url": "https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6341-L6367", "sha": "8c07b5029bda34ead60ce10335ceb145f209263c", "docstring_summary": "leftCousin\n        previousCousin\n        leftCin\n        prevCin\n        lcin\n        pcin\n        \n        parents are neighbors,and on the left", "language": "python", "parameters": "(desc,pdesc_level)", "return_statement": "return(desc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "'parent_breadth_path'", "]", "[", "-", "1", "]", "if", "(", "arg_0", "[", "'sib_seq'", "]", "==", "0", ")", ":", "if", "(", "arg_2", "==", "0", ")", ":", "pass", "else", ":", "arg_3", "=", "arg_2", "-", "1", "arg_4", "=", "arg_1", "[", "arg_3", "]", "if", "(", "arg_4", "[", "'leaf'", "]", ")", ":", "pass", "else", ":", "arg_5", "=", "copy", ".", "deepcopy", "(", "arg_4", "[", "'path'", "]", ")", "arg_5", ".", "append", "(", "arg_4", "[", "'sons_count'", "]", "-", "1", ")", "arg_0", "[", "'lcin_path'", "]", "=", "arg_5", "else", ":", "pass", "return", "(", "arg_0", ")"], "function": "def Func(arg_0,arg_1):\n    '''\n        leftCousin\n        previousCousin\n        leftCin\n        prevCin\n        lcin\n        pcin\n        \n        parents are neighbors,and on the left\n    '''\n    arg_2 = arg_0['parent_breadth_path'][-1]\n    if(arg_0['sib_seq']==0):\n        if(arg_2==0):\n            pass\n        else:\n            arg_3 = arg_2 - 1\n            arg_4 = arg_1[arg_3]\n            if(arg_4['leaf']):\n                pass\n            else:\n                arg_5 = copy.deepcopy(arg_4['path'])\n                arg_5.append(arg_4['sons_count'] - 1)\n                arg_0['lcin_path'] = arg_5\n    else:\n        pass\n    return(arg_0)", "path": "elist/elist.py", "identifier": "update_desc_lcin_path", "docstring": "leftCousin\n        previousCousin\n        leftCin\n        prevCin\n        lcin\n        pcin\n        \n        parents are neighbors,and on the left", "docstring_tokens": ["leftCousin", "previousCousin", "leftCin", "prevCin", "lcin", "pcin", "parents", "are", "neighbors", "and", "on", "the", "left"], "nwo": "ihgazni2/elist", "score": 0.138843686048881, "idx": 252183}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/cpac_helpers.py#L19-L118", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Call FSL tools to apply transformations to a given atlas to a functional image.\n    Given the transformation matrices.", "language": "python", "parameters": "(atlas_filepath, anatbrain_filepath, meanfunc_filepath,\n                            atlas2anat_nonlin_xfm_filepath, is_atlas2anat_inverted,\n                            anat2func_lin_xfm_filepath,\n                            atlasinanat_out_filepath, atlasinfunc_out_filepath,\n                            interp='nn', rewrite=True, parallel=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "'nn'", ",", "arg_9", "=", "True", ",", "arg_10", "=", "False", ")", ":", "if", "arg_4", ":", "arg_11", "=", "arg_3", "else", ":", "arg_12", "=", "op", ".", "abspath", "(", "op", ".", "dirname", "(", "arg_6", ")", ")", "arg_13", "=", "get_extension", "(", "arg_3", ")", "arg_11", "=", "op", ".", "join", "(", "arg_12", ",", "remove_ext", "(", "op", ".", "basename", "(", "arg_3", ")", ")", "+", "'_inv'", "+", "arg_13", ")", "arg_14", "=", "op", ".", "join", "(", "'${FSLDIR}'", ",", "'bin'", ",", "'invwarp'", ")", "arg_15", "=", "op", ".", "join", "(", "'${FSLDIR}'", ",", "'bin'", ",", "'applywarp'", ")", "arg_16", "=", "op", ".", "join", "(", "'${FSLDIR}'", ",", "'bin'", ",", "'fsl_sub'", ")", "if", "arg_10", ":", "arg_14", "=", "arg_16", "+", "' '", "+", "arg_14", "arg_15", "=", "arg_16", "+", "' '", "+", "arg_15", "if", "arg_9", "or", "(", "not", "arg_4", "and", "not", "op", ".", "exists", "(", "arg_11", ")", ")", ":", "log", ".", "debug", "(", "'Creating {}.\\n'", ".", "format", "(", "arg_11", ")", ")", "arg_17", "=", "arg_14", "+", "' '", "arg_17", "+=", "'-w {} '", ".", "format", "(", "arg_3", ")", "arg_17", "+=", "'-o {} '", ".", "format", "(", "arg_11", ")", "arg_17", "+=", "'-r {} '", ".", "format", "(", "arg_1", ")", "log", ".", "debug", "(", "'Running {}'", ".", "format", "(", "arg_17", ")", ")", "check_call", "(", "arg_17", ")", "if", "arg_9", "or", "not", "op", ".", "exists", "(", "arg_6", ")", ":", "log", ".", "debug", "(", "'Creating {}.\\n'", ".", "format", "(", "arg_6", ")", ")", "arg_17", "=", "arg_15", "+", "' '", "arg_17", "+=", "'--in={}     '", ".", "format", "(", "arg_0", ")", "arg_17", "+=", "'--ref={}    '", ".", "format", "(", "arg_1", ")", "arg_17", "+=", "'--warp={}   '", ".", "format", "(", "arg_11", ")", "arg_17", "+=", "'--interp={} '", ".", "format", "(", "arg_8", ")", "arg_17", "+=", "'--out={}    '", ".", "format", "(", "arg_6", ")", "log", ".", "debug", "(", "'Running {}'", ".", "format", "(", "arg_17", ")", ")", "check_call", "(", "arg_17", ")", "if", "arg_9", "or", "not", "op", ".", "exists", "(", "arg_7", ")", ":", "log", ".", "debug", "(", "'Creating {}.\\n'", ".", "format", "(", "arg_7", ")", ")", "arg_17", "=", "arg_15", "+", "' '", "arg_17", "+=", "'--in={}     '", ".", "format", "(", "arg_6", ")", "arg_17", "+=", "'--ref={}    '", ".", "format", "(", "arg_2", ")", "arg_17", "+=", "'--premat={} '", ".", "format", "(", "arg_5", ")", "arg_17", "+=", "'--interp={} '", ".", "format", "(", "arg_8", ")", "arg_17", "+=", "'--out={}    '", ".", "format", "(", "arg_7", ")", "log", ".", "debug", "(", "'Running {}'", ".", "format", "(", "arg_17", ")", ")", "check_call", "(", "arg_17", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                            arg_3, arg_4,\n                            arg_5,\n                            arg_6, arg_7,\n                            arg_8='nn', arg_9=True, arg_10=False):\n    \"\"\"Call FSL tools to apply transformations to a given atlas to a functional image.\n    Given the transformation matrices.\n\n    Parameters\n    ----------\n    atlas_filepath: str\n        Path to the 3D atlas volume file.\n\n    anatbrain_filepath: str\n        Path to the anatomical brain volume file (skull-stripped and registered to the same space as the atlas,\n        e.g., MNI).\n\n    meanfunc_filepath: str\n        Path to the average functional image to be used as reference in the last applywarp step.\n\n    atlas2anat_nonlin_xfm_filepath: str\n        Path to the atlas to anatomical brain linear transformation .mat file.\n        If you have the inverse transformation, i.e., anatomical brain to atlas, set is_atlas2anat_inverted to True.\n\n    is_atlas2anat_inverted: bool\n        If False will have to calculate the inverse atlas2anat transformation to apply the transformations.\n        This step will be performed with FSL invwarp.\n\n    anat2func_lin_xfm_filepath: str\n        Path to the anatomical to functional .mat linear transformation file.\n\n    atlasinanat_out_filepath: str\n        Path to output file which will contain the 3D atlas in the subject anatomical space.\n\n    atlasinfunc_out_filepath: str\n        Path to output file which will contain the 3D atlas in the subject functional space.\n\n    verbose: bool\n        If verbose will show DEBUG log info.\n\n    rewrite: bool\n        If True will re-run all the commands overwriting any existing file. Otherwise will check if\n        each file exists and if it does won't run the command.\n\n    parallel: bool\n        If True will launch the commands using ${FSLDIR}/fsl_sub to use the cluster infrastructure you have setup\n        with FSL (SGE or HTCondor).\n    \"\"\"\n    if arg_4:\n        # I already have the inverted fields I need\n        arg_11 = arg_3\n    else:\n        # I am creating the inverted fields then...need output file path:\n        arg_12         = op.abspath   (op.dirname(arg_6))\n        arg_13                = get_extension(arg_3)\n        arg_11 = op.join(arg_12, remove_ext(op.basename(arg_3)) + '_inv' + arg_13)\n\n    # setup the commands to be called\n    arg_14   = op.join('${FSLDIR}', 'bin', 'invwarp')\n    arg_15 = op.join('${FSLDIR}', 'bin', 'applywarp')\n    arg_16    = op.join('${FSLDIR}', 'bin', 'fsl_sub')\n\n    # add fsl_sub before the commands\n    if arg_10:\n        arg_14   = arg_16 + ' ' + arg_14\n        arg_15 = arg_16 + ' ' + arg_15\n\n    # create the inverse fields\n    if arg_9 or (not arg_4 and not op.exists(arg_11)):\n        log.debug('Creating {}.\\n'.format(arg_11))\n        arg_17  = arg_14 + ' '\n        arg_17 += '-w {} '.format(arg_3)\n        arg_17 += '-o {} '.format(arg_11)\n        arg_17 += '-r {} '.format(arg_1)\n        log.debug('Running {}'.format(arg_17))\n        check_call(arg_17)\n\n    # transform the atlas to anatomical space\n    if arg_9 or not op.exists(arg_6):\n        log.debug('Creating {}.\\n'.format(arg_6))\n        arg_17  = arg_15 + ' '\n        arg_17 += '--in={}     '.format(arg_0)\n        arg_17 += '--ref={}    '.format(arg_1)\n        arg_17 += '--warp={}   '.format(arg_11)\n        arg_17 += '--interp={} '.format(arg_8)\n        arg_17 += '--out={}    '.format(arg_6)\n        log.debug('Running {}'.format(arg_17))\n        check_call(arg_17)\n\n    # transform the atlas to functional space\n    if arg_9 or not op.exists(arg_7):\n        log.debug('Creating {}.\\n'.format(arg_7))\n        arg_17  = arg_15 + ' '\n        arg_17 += '--in={}     '.format(arg_6)\n        arg_17 += '--ref={}    '.format(arg_2)\n        arg_17 += '--premat={} '.format(arg_5)\n        arg_17 += '--interp={} '.format(arg_8)\n        arg_17 += '--out={}    '.format(arg_7)\n        log.debug('Running {}'.format(arg_17))\n        check_call(arg_17)", "path": "boyle/nifti/cpac_helpers.py", "identifier": "xfm_atlas_to_functional", "docstring": "Call FSL tools to apply transformations to a given atlas to a functional image.\n    Given the transformation matrices.\n\n    Parameters\n    ----------\n    atlas_filepath: str\n        Path to the 3D atlas volume file.\n\n    anatbrain_filepath: str\n        Path to the anatomical brain volume file (skull-stripped and registered to the same space as the atlas,\n        e.g., MNI).\n\n    meanfunc_filepath: str\n        Path to the average functional image to be used as reference in the last applywarp step.\n\n    atlas2anat_nonlin_xfm_filepath: str\n        Path to the atlas to anatomical brain linear transformation .mat file.\n        If you have the inverse transformation, i.e., anatomical brain to atlas, set is_atlas2anat_inverted to True.\n\n    is_atlas2anat_inverted: bool\n        If False will have to calculate the inverse atlas2anat transformation to apply the transformations.\n        This step will be performed with FSL invwarp.\n\n    anat2func_lin_xfm_filepath: str\n        Path to the anatomical to functional .mat linear transformation file.\n\n    atlasinanat_out_filepath: str\n        Path to output file which will contain the 3D atlas in the subject anatomical space.\n\n    atlasinfunc_out_filepath: str\n        Path to output file which will contain the 3D atlas in the subject functional space.\n\n    verbose: bool\n        If verbose will show DEBUG log info.\n\n    rewrite: bool\n        If True will re-run all the commands overwriting any existing file. Otherwise will check if\n        each file exists and if it does won't run the command.\n\n    parallel: bool\n        If True will launch the commands using ${FSLDIR}/fsl_sub to use the cluster infrastructure you have setup\n        with FSL (SGE or HTCondor).", "docstring_tokens": ["Call", "FSL", "tools", "to", "apply", "transformations", "to", "a", "given", "atlas", "to", "a", "functional", "image", ".", "Given", "the", "transformation", "matrices", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 252184}
{"url": "https://github.com/thusoy/pwm/blob/fff7d755c34f3a7235a8bf217ffa2ff5aed4926f/pwm/core.py#L112-L130", "sha": "fff7d755c34f3a7235a8bf217ffa2ff5aed4926f", "docstring_summary": "Use as a decorator for operations on the database, to ensure connection setup and\n    teardown. Can only be used on methods on objects with a `self.session` attribute.", "language": "python", "parameters": "(func, self, *args, **kwargs)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "not", "arg_1", ".", "session", ":", "_logger", ".", "debug", "(", "'Creating new db session'", ")", "arg_1", ".", "_init_db_session", "(", ")", "try", ":", "arg_4", "=", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "arg_1", ".", "session", ".", "commit", "(", ")", "except", ":", "arg_1", ".", "session", ".", "rollback", "(", ")", "arg_5", "=", "traceback", ".", "format_exc", "(", ")", "_logger", ".", "debug", "(", "arg_5", ")", "raise", "finally", ":", "_logger", ".", "debug", "(", "'Closing db session'", ")", "arg_1", ".", "session", ".", "close", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n    \"\"\" Use as a decorator for operations on the database, to ensure connection setup and\n    teardown. Can only be used on methods on objects with a `self.session` attribute.\n    \"\"\"\n    if not arg_1.session:\n        _logger.debug('Creating new db session')\n        arg_1._init_db_session()\n    try:\n        arg_4 = arg_0(arg_1, *arg_2, **arg_3)\n        arg_1.session.commit()\n    except:\n        arg_1.session.rollback()\n        arg_5 = traceback.format_exc()\n        _logger.debug(arg_5)\n        raise\n    finally:\n        _logger.debug('Closing db session')\n        arg_1.session.close()\n    return arg_4", "path": "pwm/core.py", "identifier": "_uses_db", "docstring": "Use as a decorator for operations on the database, to ensure connection setup and\n    teardown. Can only be used on methods on objects with a `self.session` attribute.", "docstring_tokens": ["Use", "as", "a", "decorator", "for", "operations", "on", "the", "database", "to", "ensure", "connection", "setup", "and", "teardown", ".", "Can", "only", "be", "used", "on", "methods", "on", "objects", "with", "a", "self", ".", "session", "attribute", "."], "nwo": "thusoy/pwm", "score": 0.15726537023232431, "idx": 252185}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L796-L800", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Create link from request for a receiver.", "language": "python", "parameters": "(self, pn_link)", "return_statement": "return rl", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ReceiverLink", "(", "arg_0", ".", "_connection", ",", "arg_1", ")", "arg_0", ".", "_links", ".", "add", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create link from request for a receiver.\"\"\"\n        arg_2 = ReceiverLink(arg_0._connection, arg_1)\n        arg_0._links.add(arg_2)\n        return arg_2", "path": "pyngus/link.py", "identifier": "_SessionProxy.request_receiver", "docstring": "Create link from request for a receiver.", "docstring_tokens": ["Create", "link", "from", "request", "for", "a", "receiver", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 252186}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L919-L949", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Perform an HTTP GET, using the saved requests.Session and auth info.\n        If \"Accept\" isn't one of the given headers, a default TAXII mime type is\n        used.  Regardless, the response type is checked against the accept\n        header value, and an exception is raised if they don't match.", "language": "python", "parameters": "(self, url, headers=None, params=None)", "return_statement": "return _to_json(resp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "_merge_headers", "(", "arg_2", ")", "if", "\"Accept\"", "not", "in", "arg_4", ":", "arg_4", "[", "\"Accept\"", "]", "=", "MEDIA_TYPE_TAXII_V20", "arg_5", "=", "arg_4", "[", "\"Accept\"", "]", "arg_6", "=", "arg_0", ".", "session", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", "arg_6", ".", "raise_for_status", "(", ")", "arg_7", "=", "arg_6", ".", "headers", "[", "\"Content-Type\"", "]", "if", "not", "arg_0", ".", "valid_content_type", "(", "arg_7", "=", "arg_7", ",", "arg_5", "=", "arg_5", ")", ":", "arg_8", "=", "\"Unexpected Response. Got Content-Type: '{}' for Accept: '{}'\"", "raise", "TAXIIServiceException", "(", "arg_8", ".", "format", "(", "arg_7", ",", "arg_5", ")", ")", "return", "_to_json", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Perform an HTTP GET, using the saved requests.Session and auth info.\n        If \"Accept\" isn't one of the given headers, a default TAXII mime type is\n        used.  Regardless, the response type is checked against the accept\n        header value, and an exception is raised if they don't match.\n\n        Args:\n            url (str): URL to retrieve\n            headers (dict): Any other headers to be added to the request.\n            params: dictionary or bytes to be sent in the query string for the\n                request. (optional)\n\n        \"\"\"\n\n        arg_4 = arg_0._merge_headers(arg_2)\n\n        if \"Accept\" not in arg_4:\n            arg_4[\"Accept\"] = MEDIA_TYPE_TAXII_V20\n        arg_5 = arg_4[\"Accept\"]\n\n        arg_6 = arg_0.session.Func(arg_1, arg_2=arg_4, arg_3=arg_3)\n\n        arg_6.raise_for_status()\n\n        arg_7 = arg_6.headers[\"Content-Type\"]\n\n        if not arg_0.valid_content_type(arg_7=arg_7, arg_5=arg_5):\n            arg_8 = \"Unexpected Response. Got Content-Type: '{}' for Accept: '{}'\"\n            raise TAXIIServiceException(arg_8.format(arg_7, arg_5))\n\n        return _to_json(arg_6)", "path": "taxii2client/__init__.py", "identifier": "_HTTPConnection.get", "docstring": "Perform an HTTP GET, using the saved requests.Session and auth info.\n        If \"Accept\" isn't one of the given headers, a default TAXII mime type is\n        used.  Regardless, the response type is checked against the accept\n        header value, and an exception is raised if they don't match.\n\n        Args:\n            url (str): URL to retrieve\n            headers (dict): Any other headers to be added to the request.\n            params: dictionary or bytes to be sent in the query string for the\n                request. (optional)", "docstring_tokens": ["Perform", "an", "HTTP", "GET", "using", "the", "saved", "requests", ".", "Session", "and", "auth", "info", ".", "If", "Accept", "isn", "t", "one", "of", "the", "given", "headers", "a", "default", "TAXII", "mime", "type", "is", "used", ".", "Regardless", "the", "response", "type", "is", "checked", "against", "the", "accept", "header", "value", "and", "an", "exception", "is", "raised", "if", "they", "don", "t", "match", "."], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 252187}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/lexicon.py#L278-L287", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Lists the categories in the lexicon, except the\n        optional categories.", "language": "python", "parameters": "(self)", "return_statement": "return keys", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "k", "for", "k", "in", "arg_0", ".", "__dict__", ".", "keys", "(", ")", "if", "k", "not", "in", "SPECIAL", "]", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Lists the Func in the lexicon, except the\n        optional Func.\n\n        Returns:\n            list: A list of strings of category names.\n        \"\"\"\n        arg_1 = [k for k in arg_0.__dict__.keys() if k not in SPECIAL]\n        return arg_1", "path": "striplog/lexicon.py", "identifier": "Lexicon.categories", "docstring": "Lists the categories in the lexicon, except the\n        optional categories.\n\n        Returns:\n            list: A list of strings of category names.", "docstring_tokens": ["Lists", "the", "categories", "in", "the", "lexicon", "except", "the", "optional", "categories", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 252188}
{"url": "https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L293-L300", "sha": "986c4b1315d6b128947c3bc3494513d8e5380ff0", "docstring_summary": "Returns settings from the server.", "language": "python", "parameters": "(self)", "return_statement": "return settings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"select {fields} from pg_settings\"", ".", "format", "(", "fields", "=", "', '", ".", "join", "(", "SETTINGS_FIELDS", ")", ")", "Func", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "_iter_results", "(", "arg_1", ")", ":", "arg_3", "[", "'setting'", "]", "=", "arg_0", ".", "_vartype_map", "[", "arg_3", "[", "'vartype'", "]", "]", "(", "arg_3", "[", "'setting'", "]", ")", "Func", ".", "append", "(", "Settings", "(", "**", "arg_3", ")", ")", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"Returns settings from the server.\"\"\"\n        arg_1 = \"select {fields} from pg_settings\".format(fields=', '.join(SETTINGS_FIELDS))\n        Func = []\n        for arg_3 in arg_0._iter_results(arg_1):\n            arg_3['setting'] = arg_0._vartype_map[arg_3['vartype']](arg_3['setting'])\n            Func.append(Settings(**arg_3))\n        return Func", "path": "pydba/postgres.py", "identifier": "PostgresDB.settings", "docstring": "Returns settings from the server.", "docstring_tokens": ["Returns", "settings", "from", "the", "server", "."], "nwo": "drkjam/pydba", "score": 0.138843686048881, "idx": 252189}
{"url": "https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L106-L118", "sha": "5b90a543b127ab9e6112fd547929b5ef4b8f0cbc", "docstring_summary": "Send a string of binary data to the FireCracker with proper timing.", "language": "python", "parameters": "(port, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_reset", "(", "arg_0", ")", "time", ".", "sleep", "(", "leadInOutDelay", ")", "for", "arg_2", "in", "arg_1", ":", "_sendBit", "(", "arg_0", ",", "arg_2", ")", "time", ".", "sleep", "(", "leadInOutDelay", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Send a string of binary data to the FireCracker with proper timing.\n\n    See the diagram in the spec referenced above for timing information.\n    The module level variables leadInOutDelay and bitDelay represent how\n    long each type of delay should be in seconds. They may require tweaking\n    on some setups.\n    \"\"\"\n    _reset(arg_0)\n    time.sleep(leadInOutDelay)\n    for arg_2 in arg_1:\n        _sendBit(arg_0, arg_2)\n    time.sleep(leadInOutDelay)", "path": "x10_any/cm17a.py", "identifier": "_sendBinaryData", "docstring": "Send a string of binary data to the FireCracker with proper timing.\n\n    See the diagram in the spec referenced above for timing information.\n    The module level variables leadInOutDelay and bitDelay represent how\n    long each type of delay should be in seconds. They may require tweaking\n    on some setups.", "docstring_tokens": ["Send", "a", "string", "of", "binary", "data", "to", "the", "FireCracker", "with", "proper", "timing", "."], "nwo": "clach04/x10_any", "score": 0.2751458370028208, "idx": 252190}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/lsi.py#L142-L174", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Loads the user's LSI profile, or provides a default.", "language": "python", "parameters": "(cls, profile_name=None)", "return_statement": "return profile", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.lsi'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "return", "LsiProfile", "(", ")", "arg_3", "=", "ConfigParser", "(", ")", "arg_3", ".", "read", "(", "arg_2", ")", "if", "arg_1", "is", "None", ":", "if", "arg_3", ".", "has_section", "(", "'default'", ")", ":", "arg_1", "=", "'default'", "else", ":", "return", "arg_0", "(", ")", "elif", "not", "arg_3", ".", "has_section", "(", "arg_1", ")", ":", "raise", "arg_0", ".", "LoadError", "(", "'No such profile {}'", ".", "format", "(", "arg_1", ")", ")", "def", "_get", "(", "arg_4", ",", "arg_5", "=", "None", ")", ":", "if", "arg_3", ".", "has_option", "(", "arg_1", ",", "arg_4", ")", ":", "return", "arg_3", ".", "get", "(", "arg_1", ",", "arg_4", ")", "else", ":", "return", "arg_5", "if", "arg_3", ".", "has_option", "(", "arg_1", ",", "'inherit'", ")", ":", "arg_6", "=", "arg_0", ".", "Func", "(", "arg_3", ".", "get", "(", "arg_1", ",", "'inherit'", ")", ")", "else", ":", "arg_6", "=", "arg_0", "(", ")", "arg_6", ".", "override", "(", "'username'", ",", "_get", "(", "'username'", ")", ")", "arg_6", ".", "override", "(", "'identity_file'", ",", "_get", "(", "'identity file'", ")", ")", "arg_6", ".", "override", "(", "'command'", ",", "_get", "(", "'command'", ")", ")", "arg_7", "=", "[", "s", "for", "s", "in", "_get", "(", "'filters'", ",", "''", ")", ".", "split", "(", "','", ")", "if", "len", "(", "s", ")", ">", "0", "]", "arg_8", "=", "[", "s", "for", "s", "in", "_get", "(", "'exclude'", ",", "''", ")", ".", "split", "(", "','", ")", "if", "len", "(", "s", ")", ">", "0", "]", "arg_6", ".", "filters", ".", "extend", "(", "arg_7", ")", "arg_6", ".", "exclude", ".", "extend", "(", "arg_8", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Loads the user's LSI profile, or provides a default.\"\"\"\n        arg_2 = os.path.expanduser('~/.lsi')\n        if not os.path.exists(arg_2):\n            return LsiProfile()\n        arg_3 = ConfigParser()\n        arg_3.read(arg_2)\n        if arg_1 is None:\n            # Load the default profile if one exists; otherwise return empty.\n            if arg_3.has_section('default'):\n                arg_1 = 'default'\n            else:\n                return arg_0()\n        elif not arg_3.has_section(arg_1):\n            raise arg_0.LoadError('No such profile {}'.format(arg_1))\n        def _get(arg_4, arg_5=None):\n            \"\"\"Gets an option if it exists; else returns `alt`.\"\"\"\n            if arg_3.has_option(arg_1, arg_4):\n                return arg_3.get(arg_1, arg_4)\n            else:\n                return arg_5\n        if arg_3.has_option(arg_1, 'inherit'):\n            arg_6 = arg_0.Func(arg_3.get(arg_1, 'inherit'))\n        else:\n            arg_6 = arg_0()\n        arg_6.override('username', _get('username'))\n        arg_6.override('identity_file', _get('identity file'))\n        arg_6.override('command', _get('command'))\n        arg_7 = [s for s in _get('filters', '').split(',') if len(s) > 0]\n        arg_8 = [s for s in _get('exclude', '').split(',') if len(s) > 0]\n        arg_6.filters.extend(arg_7)\n        arg_6.exclude.extend(arg_8)\n        return arg_6", "path": "src/lsi/lsi.py", "identifier": "LsiProfile.load", "docstring": "Loads the user's LSI profile, or provides a default.", "docstring_tokens": ["Loads", "the", "user", "s", "LSI", "profile", "or", "provides", "a", "default", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 252191}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/utils.py#L36-L40", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Take a string representation of time from the blockchain, and parse it\n       into datetime object.", "language": "python", "parameters": "(block_time)", "return_statement": "return datetime.strptime(block_time, timeFormat).replace(tzinfo=timezone.utc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "datetime", ".", "strptime", "(", "arg_0", ",", "timeFormat", ")", ".", "replace", "(", "tzinfo", "=", "timezone", ".", "utc", ")"], "function": "def Func(arg_0):\n    \"\"\"Take a string representation of time from the blockchain, and parse it\n       into datetime object.\n    \"\"\"\n    return datetime.strptime(arg_0, timeFormat).replace(tzinfo=timezone.utc)", "path": "graphenecommon/utils.py", "identifier": "parse_time", "docstring": "Take a string representation of time from the blockchain, and parse it\n       into datetime object.", "docstring_tokens": ["Take", "a", "string", "representation", "of", "time", "from", "the", "blockchain", "and", "parse", "it", "into", "datetime", "object", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 252192}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/model.py#L416-L460", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Will add a list of metabolites to the model object and add new\n        constraints accordingly.", "language": "python", "parameters": "(self, metabolite_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "hasattr", "(", "arg_1", ",", "'__iter__'", ")", ":", "arg_1", "=", "[", "arg_1", "]", "if", "len", "(", "arg_1", ")", "==", "0", ":", "return", "None", "arg_1", "=", "[", "arg_3", "for", "arg_3", "in", "arg_1", "if", "arg_3", ".", "id", "not", "in", "arg_0", ".", "metabolites", "]", "arg_2", "=", "[", "m", "for", "m", "in", "arg_1", "if", "not", "isinstance", "(", "m", ".", "id", ",", "string_types", ")", "or", "len", "(", "m", ".", "id", ")", "<", "1", "]", "if", "len", "(", "arg_2", ")", "!=", "0", ":", "raise", "ValueError", "(", "'invalid identifiers in {}'", ".", "format", "(", "repr", "(", "arg_2", ")", ")", ")", "for", "arg_3", "in", "arg_1", ":", "arg_3", ".", "_model", "=", "arg_0", "arg_0", ".", "metabolites", "+=", "arg_1", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_1", ":", "if", "arg_6", ".", "id", "not", "in", "arg_0", ".", "constraints", ":", "arg_7", "=", "arg_0", ".", "problem", ".", "Constraint", "(", "Zero", ",", "name", "=", "arg_6", ".", "id", ",", "lb", "=", "0", ",", "ub", "=", "0", ")", "arg_5", "+=", "[", "arg_7", "]", "arg_0", ".", "add_cons_vars", "(", "arg_5", ")", "arg_8", "=", "get_context", "(", "arg_0", ")", "if", "arg_8", ":", "arg_8", "(", "partial", "(", "arg_0", ".", "metabolites", ".", "__isub__", ",", "arg_1", ")", ")", "for", "arg_3", "in", "arg_1", ":", "arg_8", "(", "partial", "(", "setattr", ",", "arg_3", ",", "'_model'", ",", "None", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Will add a list of metabolites to the model object and add new\n        constraints accordingly.\n\n        The change is reverted upon exit when using the model as a context.\n\n        Parameters\n        ----------\n        metabolite_list : A list of `cobra.core.Metabolite` objects\n\n        \"\"\"\n        if not hasattr(arg_1, '__iter__'):\n            arg_1 = [arg_1]\n        if len(arg_1) == 0:\n            return None\n\n        # First check whether the metabolites exist in the model\n        arg_1 = [arg_3 for arg_3 in arg_1\n                           if arg_3.id not in arg_0.metabolites]\n\n        arg_2 = [m for m in arg_1\n                   if not isinstance(m.id, string_types) or len(m.id) < 1]\n        if len(arg_2) != 0:\n            raise ValueError('invalid identifiers in {}'.format(repr(arg_2)))\n\n        for arg_3 in arg_1:\n            arg_3._model = arg_0\n        arg_0.metabolites += arg_1\n\n        # from cameo ...\n        arg_5 = []\n        for arg_6 in arg_1:\n            if arg_6.id not in arg_0.constraints:\n                arg_7 = arg_0.problem.Constraint(\n                    Zero, name=arg_6.id, lb=0, ub=0)\n                arg_5 += [arg_7]\n\n        arg_0.add_cons_vars(arg_5)\n\n        arg_8 = get_context(arg_0)\n        if arg_8:\n            arg_8(partial(arg_0.metabolites.__isub__, arg_1))\n            for arg_3 in arg_1:\n                # Do we care?\n                arg_8(partial(setattr, arg_3, '_model', None))", "path": "cobra/core/model.py", "identifier": "Model.add_metabolites", "docstring": "Will add a list of metabolites to the model object and add new\n        constraints accordingly.\n\n        The change is reverted upon exit when using the model as a context.\n\n        Parameters\n        ----------\n        metabolite_list : A list of `cobra.core.Metabolite` objects", "docstring_tokens": ["Will", "add", "a", "list", "of", "metabolites", "to", "the", "model", "object", "and", "add", "new", "constraints", "accordingly", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 252193}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/utils.py#L12-L17", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Log-normalizes features such that each vector is between min_db to 0.", "language": "python", "parameters": "(F, floor=0.1, min_db=-80)", "return_statement": "return F", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.1", ",", "arg_2", "=", "-", "80", ")", ":", "assert", "arg_2", "<", "0", "arg_0", "=", "min_max_normalize", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_0", "=", "np", ".", "abs", "(", "arg_2", ")", "*", "np", ".", "log10", "(", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=0.1, arg_2=-80):\n    \"\"\"Log-normalizes features such that each vector is between min_db to 0.\"\"\"\n    assert arg_2 < 0\n    arg_0 = min_max_normalize(arg_0, arg_1=arg_1)\n    arg_0 = np.abs(arg_2) * np.log10(arg_0)  # Normalize from min_db to 0\n    return arg_0", "path": "msaf/utils.py", "identifier": "lognormalize", "docstring": "Log-normalizes features such that each vector is between min_db to 0.", "docstring_tokens": ["Log", "-", "normalizes", "features", "such", "that", "each", "vector", "is", "between", "min_db", "to", "0", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 252194}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/input_file_formats.py#L26-L61", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Creates one or more files containing one peptide per line,\n    returns names of files.", "language": "python", "parameters": "(\n        peptides,\n        max_peptides_per_file=None,\n        group_by_length=False)", "return_statement": "return file_names", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "if", "arg_2", ":", "arg_3", "=", "{", "len", "(", "arg_5", ")", "for", "arg_5", "in", "arg_0", "}", "arg_4", "=", "{", "l", ":", "[", "]", "for", "l", "in", "arg_3", "}", "for", "arg_5", "in", "arg_0", ":", "arg_4", "[", "len", "(", "arg_5", ")", "]", ".", "append", "(", "arg_5", ")", "else", ":", "arg_4", "=", "{", "\"\"", ":", "arg_0", "}", "arg_6", "=", "[", "]", "for", "arg_7", ",", "arg_8", "in", "arg_4", ".", "items", "(", ")", ":", "arg_9", "=", "len", "(", "arg_8", ")", "if", "not", "arg_1", ":", "arg_1", "=", "arg_9", "arg_10", "=", "None", "for", "arg_11", ",", "arg_5", "in", "enumerate", "(", "arg_8", ")", ":", "if", "arg_11", "%", "arg_1", "==", "0", ":", "if", "arg_10", "is", "not", "None", ":", "arg_6", ".", "append", "(", "arg_10", ".", "name", ")", "arg_10", ".", "close", "(", ")", "arg_10", "=", "make_writable_tempfile", "(", "prefix_number", "=", "arg_11", "//", "arg_1", ",", "prefix_name", "=", "arg_7", ",", "suffix", "=", "\".txt\"", ")", "arg_10", ".", "write", "(", "\"%s\\n\"", "%", "arg_5", ")", "if", "arg_10", "is", "not", "None", ":", "arg_6", ".", "append", "(", "arg_10", ".", "name", ")", "arg_10", ".", "close", "(", ")", "return", "arg_6"], "function": "def Func(\n        arg_0,\n        arg_1=None,\n        arg_2=False):\n    \"\"\"\n    Creates one or more files containing one peptide per line,\n    returns names of files.\n    \"\"\"\n    if arg_2:\n        arg_3 = {len(arg_5) for arg_5 in arg_0}\n        arg_4 = {l: [] for l in arg_3}\n        for arg_5 in arg_0:\n            arg_4[len(arg_5)].append(arg_5)\n    else:\n        arg_4 = {\"\": arg_0}\n\n    arg_6 = []\n    for arg_7, arg_8 in arg_4.items():\n        arg_9 = len(arg_8)\n        if not arg_1:\n            arg_1 = arg_9\n        arg_10 = None\n        for arg_11, arg_5 in enumerate(arg_8):\n            if arg_11 % arg_1 == 0:\n                if arg_10 is not None:\n                    arg_6.append(arg_10.name)\n                    arg_10.close()\n                arg_10 = make_writable_tempfile(\n                    prefix_number=arg_11 // arg_1,\n                    prefix_name=arg_7,\n                    suffix=\".txt\")\n            arg_10.write(\"%s\\n\" % arg_5)\n        if arg_10 is not None:\n            arg_6.append(arg_10.name)\n            arg_10.close()\n    return arg_6", "path": "mhctools/input_file_formats.py", "identifier": "create_input_peptides_files", "docstring": "Creates one or more files containing one peptide per line,\n    returns names of files.", "docstring_tokens": ["Creates", "one", "or", "more", "files", "containing", "one", "peptide", "per", "line", "returns", "names", "of", "files", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 252195}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L339-L347", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "Open the a new tab when goto goes out of the current document.", "language": "python", "parameters": "(self, assignment)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "open_file", "(", "arg_1", ".", "module_path", ")", "if", "arg_2", ":", "TextHelper", "(", "arg_2", ")", ".", "goto_line", "(", "arg_1", ".", "line", ",", "arg_1", ".", "column", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Open the a new tab when goto goes out of the current document.\n\n        :param assignment: Destination\n        \"\"\"\n        arg_2 = arg_0.open_file(arg_1.module_path)\n        if arg_2:\n            TextHelper(arg_2).goto_line(arg_1.line, arg_1.column)", "path": "examples/pynotepad/pynotepad/main_window.py", "identifier": "MainWindow.on_goto_out_of_doc", "docstring": "Open the a new tab when goto goes out of the current document.\n\n        :param assignment: Destination", "docstring_tokens": ["Open", "the", "a", "new", "tab", "when", "goto", "goes", "out", "of", "the", "current", "document", "."], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 252196}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/easy_install.py#L1722-L1753", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Quote a command line argument according to Windows parsing rules", "language": "python", "parameters": "(arg)", "return_statement": "return ''.join(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "False", "arg_3", "=", "0", "arg_2", "=", "(", "\" \"", "in", "arg_0", ")", "or", "(", "\"\\t\"", "in", "arg_0", ")", "if", "arg_2", ":", "arg_1", ".", "append", "(", "'\"'", ")", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", "==", "'\\\\'", ":", "arg_3", "+=", "1", "elif", "arg_4", "==", "'\"'", ":", "arg_1", ".", "append", "(", "'\\\\'", "*", "(", "arg_3", "*", "2", ")", "+", "'\\\\\"'", ")", "arg_3", "=", "0", "else", ":", "if", "arg_3", ":", "arg_1", ".", "append", "(", "'\\\\'", "*", "arg_3", ")", "arg_3", "=", "0", "arg_1", ".", "append", "(", "arg_4", ")", "if", "arg_3", ":", "arg_1", ".", "append", "(", "'\\\\'", "*", "arg_3", ")", "if", "arg_2", ":", "arg_1", ".", "append", "(", "'\\\\'", "*", "arg_3", ")", "arg_1", ".", "append", "(", "'\"'", ")", "return", "''", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Quote a command line argument according to Windows parsing rules\"\"\"\n\n    arg_1 = []\n    arg_2 = False\n    arg_3 = 0\n\n    arg_2 = (\" \" in arg_0) or (\"\\t\" in arg_0)\n    if arg_2:\n        arg_1.append('\"')\n\n    for arg_4 in arg_0:\n        if arg_4 == '\\\\':\n            arg_3 += 1\n        elif arg_4 == '\"':\n            # double preceding backslashes, then add a \\\"\n            arg_1.append('\\\\' * (arg_3*2) + '\\\\\"')\n            arg_3 = 0\n        else:\n            if arg_3:\n                arg_1.append('\\\\' * arg_3)\n                arg_3 = 0\n            arg_1.append(arg_4)\n\n    if arg_3:\n        arg_1.append('\\\\' * arg_3)\n\n    if arg_2:\n        arg_1.append('\\\\' * arg_3)    # double the trailing backslashes\n        arg_1.append('\"')\n\n    return ''.join(arg_1)", "path": "environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/easy_install.py", "identifier": "nt_quote_arg", "docstring": "Quote a command line argument according to Windows parsing rules", "docstring_tokens": ["Quote", "a", "command", "line", "argument", "according", "to", "Windows", "parsing", "rules"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252197}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L164-L194", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Builds the neuron groups.", "language": "python", "parameters": "(self, traj, brian_list, network_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'_pre_Func'", ")", "or", "not", "arg_0", ".", "_pre_Func", ":", "arg_0", ".", "_Func_model", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Builds the neuron groups.\n\n        Build is only performed if neuron group was not\n        pre-Func before.\n\n        :param traj: Trajectory container\n\n        :param brian_list:\n\n            List of objects passed to BRIAN network constructor.\n\n            Adds:\n\n            Inhibitory neuron group\n\n            Excitatory neuron group\n\n        :param network_dict:\n\n            Dictionary of elements shared among the components\n\n            Adds:\n\n            'neurons_i': Inhibitory neuron group\n\n            'neurons_e': Excitatory neuron group\n\n        \"\"\"\n        if not hasattr(arg_0, '_pre_Func') or not arg_0._pre_Func:\n            arg_0._Func_model(arg_1, arg_2, arg_3)", "path": "examples/example_24_large_scale_brian2_simulation/clusternet.py", "identifier": "CNNeuronGroup.build", "docstring": "Builds the neuron groups.\n\n        Build is only performed if neuron group was not\n        pre-build before.\n\n        :param traj: Trajectory container\n\n        :param brian_list:\n\n            List of objects passed to BRIAN network constructor.\n\n            Adds:\n\n            Inhibitory neuron group\n\n            Excitatory neuron group\n\n        :param network_dict:\n\n            Dictionary of elements shared among the components\n\n            Adds:\n\n            'neurons_i': Inhibitory neuron group\n\n            'neurons_e': Excitatory neuron group", "docstring_tokens": ["Builds", "the", "neuron", "groups", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252198}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/linear_prediction.py#L134-L146", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Convert reflection coefficients to autocorrelation sequence.", "language": "python", "parameters": "(k, R0)", "return_statement": "return R", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "[", "arg_2", ",", "arg_3", "]", "=", "rc2poly", "(", "arg_0", ",", "arg_1", ")", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "rlevinson", "(", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Convert reflection coefficients to autocorrelation sequence.\n\n    :param k: reflection coefficients\n    :param R0: zero-lag autocorrelation\n    :returns: the autocorrelation sequence\n\n    .. seealso:: :func:`ac2rc`, :func:`poly2rc`, :func:`ac2poly`, :func:`poly2rc`, :func:`rc2poly`.\n\n    \"\"\"\n    [arg_2,arg_3] = rc2poly(arg_0, arg_1)\n    arg_4, arg_5, arg_6, arg_7 = rlevinson(arg_2, arg_3)\n    return arg_4", "path": "src/spectrum/linear_prediction.py", "identifier": "rc2ac", "docstring": "Convert reflection coefficients to autocorrelation sequence.\n\n    :param k: reflection coefficients\n    :param R0: zero-lag autocorrelation\n    :returns: the autocorrelation sequence\n\n    .. seealso:: :func:`ac2rc`, :func:`poly2rc`, :func:`ac2poly`, :func:`poly2rc`, :func:`rc2poly`.", "docstring_tokens": ["Convert", "reflection", "coefficients", "to", "autocorrelation", "sequence", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 252199}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/interfaces/structIntf.py#L143-L163", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Generate flattened register map for HStruct", "language": "python", "parameters": "(interfaceMap)", "return_statement": "return HStruct(*structFields)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "FuncItem", "(", "arg_2", ")", "arg_1", ".", "append", "(", "arg_3", ")", "return", "HStruct", "(", "*", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Generate flattened register map for HStruct\n\n    :param interfaceMap: sequence of\n        tuple (type, name) or (will create standard struct field member)\n        interface or (will create a struct field from interface)\n        instance of hdl type (is used as padding)\n        tuple (list of interface, name)\n    :param DATA_WIDTH: width of word\n    :param terminalNodes: None or set whre are placed StructField instances\n        which are derived directly from interface\n    :return: generator of tuple (type, name, BusFieldInfo)\n    \"\"\"\n    arg_1 = []\n\n    for arg_2 in arg_0:\n        arg_3 = FuncItem(arg_2)\n        arg_1.append(arg_3)\n\n    return HStruct(*arg_1)", "path": "hwt/interfaces/structIntf.py", "identifier": "HTypeFromIntfMap", "docstring": "Generate flattened register map for HStruct\n\n    :param interfaceMap: sequence of\n        tuple (type, name) or (will create standard struct field member)\n        interface or (will create a struct field from interface)\n        instance of hdl type (is used as padding)\n        tuple (list of interface, name)\n    :param DATA_WIDTH: width of word\n    :param terminalNodes: None or set whre are placed StructField instances\n        which are derived directly from interface\n    :return: generator of tuple (type, name, BusFieldInfo)", "docstring_tokens": ["Generate", "flattened", "register", "map", "for", "HStruct"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252200}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/bazaar.py#L39-L52", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Export the Bazaar repository at the url to the destination location", "language": "python", "parameters": "(self, location)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tempfile", ".", "mkdtemp", "(", "'-Func'", ",", "'pip-'", ")", "arg_0", ".", "unpack", "(", "arg_2", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "rmtree", "(", "arg_1", ")", "try", ":", "arg_0", ".", "run_command", "(", "[", "'Func'", ",", "arg_1", "]", ",", "cwd", "=", "arg_2", ",", "show_stdout", "=", "False", ")", "finally", ":", "rmtree", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Export the Bazaar repository at the url to the destination location\n        \"\"\"\n        arg_2 = tempfile.mkdtemp('-Func', 'pip-')\n        arg_0.unpack(arg_2)\n        if os.path.exists(arg_1):\n            # Remove the location to make sure Bazaar can Func it correctly\n            rmtree(arg_1)\n        try:\n            arg_0.run_command(['Func', arg_1], cwd=arg_2,\n                             show_stdout=False)\n        finally:\n            rmtree(arg_2)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/bazaar.py", "identifier": "Bazaar.export", "docstring": "Export the Bazaar repository at the url to the destination location", "docstring_tokens": ["Export", "the", "Bazaar", "repository", "at", "the", "url", "to", "the", "destination", "location"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252201}
{"url": "https://github.com/broox/python-nuheat/blob/3a18852dc9465c34cb96eb3a0c84f1a6caa70707/nuheat/api.py#L27-L46", "sha": "3a18852dc9465c34cb96eb3a0c84f1a6caa70707", "docstring_summary": "Authenticate against the NuHeat API", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_session_id", ":", "_LOGGER", ".", "debug", "(", "\"Using existing NuHeat session\"", ")", "return", "_LOGGER", ".", "debug", "(", "\"Creating NuHeat session\"", ")", "arg_1", "=", "{", "\"Email\"", ":", "arg_0", ".", "username", ",", "\"Password\"", ":", "arg_0", ".", "password", ",", "\"application\"", ":", "\"0\"", "}", "arg_2", "=", "arg_0", ".", "request", "(", "config", ".", "AUTH_URL", ",", "method", "=", "\"POST\"", ",", "arg_2", "=", "arg_1", ")", "arg_3", "=", "arg_2", ".", "get", "(", "\"SessionId\"", ")", "if", "not", "arg_3", ":", "raise", "Exception", "(", "\"Authentication error\"", ")", "arg_0", ".", "_session_id", "=", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Authenticate against the NuHeat API\n        \"\"\"\n        if arg_0._session_id:\n            _LOGGER.debug(\"Using existing NuHeat session\")\n            return\n\n        _LOGGER.debug(\"Creating NuHeat session\")\n        arg_1 = {\n            \"Email\": arg_0.username,\n            \"Password\": arg_0.password,\n            \"application\": \"0\"\n        }\n        arg_2 = arg_0.request(config.AUTH_URL, method=\"POST\", arg_2=arg_1)\n        arg_3 = arg_2.get(\"SessionId\")\n        if not arg_3:\n            raise Exception(\"Authentication error\")\n\n        arg_0._session_id = arg_3", "path": "nuheat/api.py", "identifier": "NuHeat.authenticate", "docstring": "Authenticate against the NuHeat API", "docstring_tokens": ["Authenticate", "against", "the", "NuHeat", "API"], "nwo": "broox/python-nuheat", "score": 0.23137166388621372, "idx": 252202}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/automl/autoh2o.py#L503-L537", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Retrieve information about an AutoML instance.", "language": "python", "parameters": "(project_name)", "return_statement": "return automl_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "h2o", ".", "api", "(", "\"GET /99/AutoML/%s\"", "%", "arg_0", ")", "arg_0", "=", "arg_1", "[", "\"project_name\"", "]", "arg_2", "=", "[", "key", "[", "\"name\"", "]", "for", "key", "in", "arg_1", "[", "'leaderboard'", "]", "[", "'models'", "]", "]", "if", "arg_2", "is", "not", "None", "and", "len", "(", "arg_2", ")", ">", "0", ":", "arg_3", "=", "arg_2", "[", "0", "]", "else", ":", "arg_3", "=", "None", "arg_4", "=", "h2o", ".", "get_model", "(", "arg_3", ")", "arg_5", "=", "H2OJob", ".", "__PROGRESS_BAR__", "h2o", ".", "no_progress", "(", ")", "try", ":", "arg_6", "=", "h2o", ".", "H2OFrame", "(", "arg_1", "[", "\"leaderboard_table\"", "]", ".", "cell_values", ",", "column_names", "=", "arg_1", "[", "\"leaderboard_table\"", "]", ".", "col_header", ")", "except", "Exception", "as", "ex", ":", "raise", "ex", "finally", ":", "if", "arg_5", "is", "True", ":", "h2o", ".", "show_progress", "(", ")", "arg_6", "=", "arg_6", "[", "1", ":", "]", "arg_7", "=", "{", "'project_name'", ":", "arg_0", ",", "\"leader\"", ":", "arg_4", ",", "\"leaderboard\"", ":", "arg_6", "}", "return", "arg_7"], "function": "def Func(arg_0):\n    \"\"\"\n    Retrieve information about an AutoML instance.\n\n    :param str project_name:  A string indicating the project_name of the automl instance to retrieve.\n    :returns: A dictionary containing the project_name, leader model, and leaderboard.\n    \"\"\"\n    arg_1 = h2o.api(\"GET /99/AutoML/%s\" % arg_0)\n    arg_0 = arg_1[\"project_name\"]\n    arg_2 = [key[\"name\"] for key in arg_1['leaderboard']['models']]\n\n    if arg_2 is not None and len(arg_2) > 0:\n        arg_3 = arg_2[0]\n    else:\n        arg_3 = None\n\n    arg_4 = h2o.get_model(arg_3)\n    # Intentionally mask the progress bar here since showing multiple progress bars is confusing to users.\n    # If any failure happens, revert back to user's original setting for progress and display the error message.\n    arg_5 = H2OJob.__PROGRESS_BAR__\n    h2o.no_progress()\n    try:\n        # Parse leaderboard H2OTwoDimTable & return as an H2OFrame\n        arg_6 = h2o.H2OFrame(\n            arg_1[\"leaderboard_table\"].cell_values,\n            column_names=arg_1[\"leaderboard_table\"].col_header)\n    except Exception as ex:\n        raise ex\n    finally:\n        if arg_5 is True:\n            h2o.show_progress()\n\n    arg_6 = arg_6[1:]\n    arg_7 = {'project_name': arg_0, \"leader\": arg_4, \"leaderboard\": arg_6}\n    return arg_7", "path": "h2o-py/h2o/automl/autoh2o.py", "identifier": "get_automl", "docstring": "Retrieve information about an AutoML instance.\n\n    :param str project_name:  A string indicating the project_name of the automl instance to retrieve.\n    :returns: A dictionary containing the project_name, leader model, and leaderboard.", "docstring_tokens": ["Retrieve", "information", "about", "an", "AutoML", "instance", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252203}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/check_manifest.py#L493-L505", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Compile a glob pattern into a regexp.", "language": "python", "parameters": "(pat)", "return_statement": "return re.sub(r'((?<!\\\\)(\\\\\\\\)*)\\.', r'\\1[^%s]' % sep, pat)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "fnmatch", ".", "translate", "(", "arg_0", ")", "arg_1", "=", "r'\\\\\\\\'", "if", "os", ".", "path", ".", "sep", "==", "'\\\\'", "else", "os", ".", "path", ".", "sep", "return", "re", ".", "sub", "(", "r'((?<!\\\\)(\\\\\\\\)*)\\.'", ",", "r'\\1[^%s]'", "%", "arg_1", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Compile a glob pattern into a regexp.\n\n    We need to do this because fnmatch allows * to match /, which we\n    don't want.  E.g. an MANIFEST.in exclude of 'dirname/*css' should\n    match 'dirname/foo.css' but not 'dirname/subdir/bar.css'.\n    \"\"\"\n    arg_0 = fnmatch.translate(arg_0)\n    # Note that distutils in Python 2.6 has a buggy glob_to_re in\n    # distutils.filelist -- it converts '*.cfg' to '[^/]*cfg' instead\n    # of '[^\\\\]*cfg' on Windows.\n    arg_1 = r'\\\\\\\\' if os.path.sep == '\\\\' else os.path.sep\n    return re.sub(r'((?<!\\\\)(\\\\\\\\)*)\\.', r'\\1[^%s]' % arg_1, arg_0)", "path": "virtualEnvironment/lib/python2.7/site-packages/check_manifest.py", "identifier": "_glob_to_regexp", "docstring": "Compile a glob pattern into a regexp.\n\n    We need to do this because fnmatch allows * to match /, which we\n    don't want.  E.g. an MANIFEST.in exclude of 'dirname/*css' should\n    match 'dirname/foo.css' but not 'dirname/subdir/bar.css'.", "docstring_tokens": ["Compile", "a", "glob", "pattern", "into", "a", "regexp", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 252204}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L129-L161", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Pre-builds the neuron groups.", "language": "python", "parameters": "(self, traj, brian_list, network_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "_Func", "=", "not", "_explored_parameters_in_group", "(", "arg_1", ",", "arg_1", ".", "parameters", ".", "model", ")", "if", "arg_0", ".", "_Func", ":", "arg_0", ".", "_build_model", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Pre-builds the neuron groups.\n\n        Pre-build is only performed if none of the\n        relevant parameters is explored.\n\n        :param traj: Trajectory container\n\n        :param brian_list:\n\n            List of objects passed to BRIAN network constructor.\n\n            Adds:\n\n            Inhibitory neuron group\n\n            Excitatory neuron group\n\n        :param network_dict:\n\n            Dictionary of elements shared among the components\n\n            Adds:\n\n            'neurons_i': Inhibitory neuron group\n\n            'neurons_e': Excitatory neuron group\n\n        \"\"\"\n        arg_0._Func = not _explored_parameters_in_group(arg_1, arg_1.parameters.model)\n\n        if arg_0._Func:\n            arg_0._build_model(arg_1, arg_2, arg_3)", "path": "examples/example_24_large_scale_brian2_simulation/clusternet.py", "identifier": "CNNeuronGroup.pre_build", "docstring": "Pre-builds the neuron groups.\n\n        Pre-build is only performed if none of the\n        relevant parameters is explored.\n\n        :param traj: Trajectory container\n\n        :param brian_list:\n\n            List of objects passed to BRIAN network constructor.\n\n            Adds:\n\n            Inhibitory neuron group\n\n            Excitatory neuron group\n\n        :param network_dict:\n\n            Dictionary of elements shared among the components\n\n            Adds:\n\n            'neurons_i': Inhibitory neuron group\n\n            'neurons_e': Excitatory neuron group", "docstring_tokens": ["Pre", "-", "builds", "the", "neuron", "groups", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252205}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L411-L438", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Upload a folder as a new item. Take a folder and use its base name as the\n    name of a new item. Then, upload its containing files into the new item as\n    bitstreams.", "language": "python", "parameters": "(local_folder, parent_folder_id,\n                           reuse_existing=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "_create_or_reuse_item", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_4", "=", "sorted", "(", "os", ".", "listdir", "(", "arg_0", ")", ")", "arg_5", "=", "len", "(", "arg_4", ")", "for", "(", "arg_6", ",", "arg_7", ")", "in", "enumerate", "(", "arg_4", ")", ":", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_7", ")", "arg_9", "=", "'({0} of {1})'", ".", "format", "(", "arg_6", "+", "1", ",", "arg_5", ")", "_create_bitstream", "(", "arg_8", ",", "arg_7", ",", "arg_3", ",", "arg_9", ")", "for", "arg_10", "in", "session", ".", "item_upload_callbacks", ":", "arg_10", "(", "session", ".", "communicator", ",", "session", ".", "token", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1,\n                           arg_2=False):\n    \"\"\"\n    Upload a folder as a new item. Take a folder and use its base name as the\n    name of a new item. Then, upload its containing files into the new item as\n    bitstreams.\n\n    :param local_folder: The path to the folder to be uploaded\n    :type local_folder: string\n    :param parent_folder_id: The id of the destination folder for the new item.\n    :type parent_folder_id: int | long\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool\n    \"\"\"\n    arg_3 = _create_or_reuse_item(arg_0, arg_1,\n                                    arg_2)\n\n    arg_4 = sorted(os.listdir(arg_0))\n    # for each file in the subdir, add it to the item\n    arg_5 = len(arg_4)\n    for (arg_6, arg_7) in enumerate(arg_4):\n        arg_8 = os.path.join(arg_0, arg_7)\n        arg_9 = '({0} of {1})'.format(arg_6 + 1, arg_5)\n        _create_bitstream(arg_8, arg_7, arg_3, arg_9)\n\n    for arg_10 in session.item_upload_callbacks:\n        arg_10(session.communicator, session.token, arg_3)", "path": "pydas/api.py", "identifier": "_upload_folder_as_item", "docstring": "Upload a folder as a new item. Take a folder and use its base name as the\n    name of a new item. Then, upload its containing files into the new item as\n    bitstreams.\n\n    :param local_folder: The path to the folder to be uploaded\n    :type local_folder: string\n    :param parent_folder_id: The id of the destination folder for the new item.\n    :type parent_folder_id: int | long\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool", "docstring_tokens": ["Upload", "a", "folder", "as", "a", "new", "item", ".", "Take", "a", "folder", "and", "use", "its", "base", "name", "as", "the", "name", "of", "a", "new", "item", ".", "Then", "upload", "its", "containing", "files", "into", "the", "new", "item", "as", "bitstreams", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 252206}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/utils.py#L210-L224", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Expand dimensions by iteratively append empty axes.", "language": "python", "parameters": "(arry, extra)", "return_statement": "return arry", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "range", "(", "arg_0", ".", "ndim", ",", "arg_0", ".", "ndim", "+", "arg_1", ")", ":", "arg_0", "=", "expand_dims", "(", "arg_0", ",", "axis", "=", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Expand dimensions by iteratively append empty axes.\n\n    Parameters\n    ----------\n    arry : ndarray\n        The original array\n\n    extra : int\n        The number of empty axes to append\n    \"\"\"\n    for arg_2 in range(arg_0.ndim, arg_0.ndim+arg_1):\n        arg_0 = expand_dims(arg_0, axis=arg_2)\n    return arg_0", "path": "bolt/utils.py", "identifier": "iterexpand", "docstring": "Expand dimensions by iteratively append empty axes.\n\n    Parameters\n    ----------\n    arry : ndarray\n        The original array\n\n    extra : int\n        The number of empty axes to append", "docstring_tokens": ["Expand", "dimensions", "by", "iteratively", "append", "empty", "axes", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 252207}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/code_heatmap.py#L56-L65", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Records line execution time.", "language": "python", "parameters": "(self, frame, event, arg)", "return_statement": "return self.record_line", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_2", "==", "'line'", ":", "if", "arg_0", ".", "prev_timestamp", ":", "arg_4", "=", "time", ".", "time", "(", ")", "-", "arg_0", ".", "prev_timestamp", "arg_0", ".", "lines", ".", "append", "(", "[", "arg_0", ".", "prev_path", ",", "arg_0", ".", "prev_lineno", ",", "arg_4", "]", ")", "arg_0", ".", "prev_lineno", "=", "arg_1", ".", "f_lineno", "arg_0", ".", "prev_path", "=", "arg_1", ".", "f_code", ".", "co_filename", "arg_0", ".", "prev_timestamp", "=", "time", ".", "time", "(", ")", "return", "arg_0", ".", "Func"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):  # pylint: disable=unused-argument\n        \"\"\"Records line execution time.\"\"\"\n        if arg_2 == 'line':\n            if arg_0.prev_timestamp:\n                arg_4 = time.time() - arg_0.prev_timestamp\n                arg_0.lines.append([arg_0.prev_path, arg_0.prev_lineno, arg_4])\n            arg_0.prev_lineno = arg_1.f_lineno\n            arg_0.prev_path = arg_1.f_code.co_filename\n            arg_0.prev_timestamp = time.time()\n        return arg_0.Func", "path": "vprof/code_heatmap.py", "identifier": "_CodeHeatmapCalculator.record_line", "docstring": "Records line execution time.", "docstring_tokens": ["Records", "line", "execution", "time", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 252208}
{"url": "https://github.com/pln-fing-udelar/fast-krippendorff/blob/fbc983f206d41f76a6e8da8cabd7114941634420/krippendorff/krippendorff.py#L35-L61", "sha": "fbc983f206d41f76a6e8da8cabd7114941634420", "docstring_summary": "Coincidence matrix.", "language": "python", "parameters": "(value_counts, value_domain, dtype=np.float64)", "return_statement": "return np.sum(np.divide(unnormalized_coincidences, (pairable - 1).reshape((-1, 1, 1)), dtype=dtype), axis=0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "float64", ")", ":", "arg_5", "=", "arg_0", ".", "reshape", "(", "arg_0", ".", "shape", "+", "(", "1", ",", ")", ")", "arg_6", "=", "arg_3", ".", "maximum", "(", "arg_3", ".", "sum", "(", "arg_0", ",", "axis", "=", "1", ")", ",", "2", ")", "arg_7", "=", "arg_3", ".", "tile", "(", "arg_3", ".", "eye", "(", "len", "(", "arg_1", ")", ")", ",", "(", "len", "(", "arg_0", ")", ",", "1", ",", "1", ")", ")", "*", "arg_0", ".", "reshape", "(", "(", "arg_0", ".", "shape", "[", "0", "]", ",", "1", ",", "arg_0", ".", "shape", "[", "1", "]", ")", ")", "arg_8", "=", "arg_5", "*", "arg_5", ".", "transpose", "(", "(", "0", ",", "2", ",", "1", ")", ")", "-", "arg_7", "return", "arg_3", ".", "sum", "(", "arg_3", ".", "divide", "(", "arg_8", ",", "(", "arg_6", "-", "1", ")", ".", "reshape", "(", "(", "-", "1", ",", "1", ",", "1", ")", ")", ",", "arg_2", "=", "arg_2", ")", ",", "axis", "=", "0", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.float64):\n    \"\"\"Coincidence matrix.\n\n    Parameters\n    ----------\n    value_counts : ndarray, with shape (N, V)\n        Number of coders that assigned a certain value to a determined unit, where N is the number of units\n        and V is the value count.\n\n    value_domain : array_like, with shape (V,)\n        Possible values V the units can take.\n        If the level of measurement is not nominal, it must be ordered.\n\n    dtype : data-type\n        Result and computation data-type.\n\n    Returns\n    -------\n    o : ndarray, with shape (V, V)\n        Coincidence matrix.\n    \"\"\"\n    arg_5 = arg_0.reshape(arg_0.shape + (1,))\n    arg_6 = arg_3.maximum(arg_3.sum(arg_0, axis=1), 2)\n    arg_7 = arg_3.tile(arg_3.eye(len(arg_1)), (len(arg_0), 1, 1)) \\\n        * arg_0.reshape((arg_0.shape[0], 1, arg_0.shape[1]))\n    arg_8 = arg_5 * arg_5.transpose((0, 2, 1)) - arg_7\n    return arg_3.sum(arg_3.divide(arg_8, (arg_6 - 1).reshape((-1, 1, 1)), arg_2=arg_2), axis=0)", "path": "krippendorff/krippendorff.py", "identifier": "_coincidences", "docstring": "Coincidence matrix.\n\n    Parameters\n    ----------\n    value_counts : ndarray, with shape (N, V)\n        Number of coders that assigned a certain value to a determined unit, where N is the number of units\n        and V is the value count.\n\n    value_domain : array_like, with shape (V,)\n        Possible values V the units can take.\n        If the level of measurement is not nominal, it must be ordered.\n\n    dtype : data-type\n        Result and computation data-type.\n\n    Returns\n    -------\n    o : ndarray, with shape (V, V)\n        Coincidence matrix.", "docstring_tokens": ["Coincidence", "matrix", "."], "nwo": "pln-fing-udelar/fast-krippendorff", "score": 0.28638914490610956, "idx": 252209}
{"url": "https://github.com/ybrs/single-beat/blob/d036b62d2531710dfd806e9dc2a8d67c77616082/singlebeat/beat.py#L318-L325", "sha": "d036b62d2531710dfd806e9dc2a8d67c77616082", "docstring_summary": "\\\n        kills the child and exits", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "state", "==", "State", ".", "RUNNING", "and", "arg_0", ".", "sprocess", "and", "arg_0", ".", "sprocess", ".", "proc", ":", "arg_0", ".", "sprocess", ".", "proc", ".", "kill", "(", ")", "else", ":", "sys", ".", "exit", "(", "0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\\\n        kills the child and exits\n        \"\"\"\n        if arg_0.state == State.RUNNING and arg_0.sprocess and arg_0.sprocess.proc:\n            arg_0.sprocess.proc.kill()\n        else:\n            sys.exit(0)", "path": "singlebeat/beat.py", "identifier": "Process.cli_command_quit", "docstring": "\\\n        kills the child and exits", "docstring_tokens": ["\\", "kills", "the", "child", "and", "exits"], "nwo": "ybrs/single-beat", "score": 0.7043378919950687, "idx": 252210}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/concurrently/WorkingArea.py#L286-L308", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "Returns the full path of the result", "language": "python", "parameters": "(self, package_index)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "path", ",", "arg_0", ".", "result_relpath", "(", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns the full path of the result\n\n        This method returns the full path to the result. This method\n        simply constructs the path based on the convention and doesn't\n        check if the result actually exists.\n\n        Parameters\n        ----------\n        package_index :\n            a package index\n\n        Returns\n        -------\n        str\n            the full path to the result\n\n        \"\"\"\n\n        arg_2 = os.path.join(arg_0.path, arg_0.result_relpath(arg_1))\n        # e.g., '{path}/tpd_20161129_122841_HnpcmF/results/task_00009/result.p.gz'\n\n        return arg_2", "path": "alphatwirl/concurrently/WorkingArea.py", "identifier": "WorkingArea.result_fullpath", "docstring": "Returns the full path of the result\n\n        This method returns the full path to the result. This method\n        simply constructs the path based on the convention and doesn't\n        check if the result actually exists.\n\n        Parameters\n        ----------\n        package_index :\n            a package index\n\n        Returns\n        -------\n        str\n            the full path to the result", "docstring_tokens": ["Returns", "the", "full", "path", "of", "the", "result"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 252211}
{"url": "https://github.com/tklovett/PyShirtsIO/blob/ff2f2d3b5e4ab2813abbce8545b27319c6af0def/ShirtsIO/request.py#L15-L31", "sha": "ff2f2d3b5e4ab2813abbce8545b27319c6af0def", "docstring_summary": "Issues a GET request against the API, properly formatting the params", "language": "python", "parameters": "(self, url, params={})", "return_statement": "return self.json_parse(response.content)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "arg_2", ".", "update", "(", "{", "'api_key'", ":", "arg_0", ".", "api_key", "}", ")", "try", ":", "arg_3", "=", "requests", ".", "Func", "(", "arg_0", ".", "host", "+", "arg_1", ",", "arg_2", "=", "arg_2", ")", "except", "RequestException", "as", "e", ":", "arg_3", "=", "e", ".", "args", "return", "arg_0", ".", "json_parse", "(", "arg_3", ".", "content", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Issues a GET request against the API, properly formatting the params\n\n        :param url: a string, the url you are requesting\n        :param params: a dict, the key-value of all the paramaters needed\n                       in the request\n        :returns: a dict parsed of the JSON response\n        \"\"\"\n\n        arg_2.update({'api_key': arg_0.api_key})\n        try:\n            arg_3 = requests.Func(arg_0.host + arg_1, arg_2=arg_2)\n        except RequestException as e:\n            arg_3 = e.args\n\n        return arg_0.json_parse(arg_3.content)", "path": "ShirtsIO/request.py", "identifier": "ShirtsIORequest.get", "docstring": "Issues a GET request against the API, properly formatting the params\n\n        :param url: a string, the url you are requesting\n        :param params: a dict, the key-value of all the paramaters needed\n                       in the request\n        :returns: a dict parsed of the JSON response", "docstring_tokens": ["Issues", "a", "GET", "request", "against", "the", "API", "properly", "formatting", "the", "params"], "nwo": "tklovett/PyShirtsIO", "score": 0.0, "idx": 252212}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/consensus/base.py#L332-L342", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "in order to avoid a complicated bootstrapping, we define\n    the genesis_signing_lockset as a lockset with one vote by any validator.", "language": "python", "parameters": "(genesis, privkey)", "return_statement": "return ls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "VoteBlock", "(", "0", ",", "0", ",", "arg_0", ".", "hash", ")", "arg_2", ".", "sign", "(", "arg_1", ")", "arg_3", "=", "LockSet", "(", "num_eligible_votes", "=", "1", ")", "arg_3", ".", "add", "(", "arg_2", ")", "assert", "arg_3", ".", "has_quorum", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    in order to avoid a complicated bootstrapping, we define\n    the Func as a lockset with one vote by any validator.\n    \"\"\"\n    arg_2 = VoteBlock(0, 0, arg_0.hash)\n    arg_2.sign(arg_1)\n    arg_3 = LockSet(num_eligible_votes=1)\n    arg_3.add(arg_2)\n    assert arg_3.has_quorum\n    return arg_3", "path": "hydrachain/consensus/base.py", "identifier": "genesis_signing_lockset", "docstring": "in order to avoid a complicated bootstrapping, we define\n    the genesis_signing_lockset as a lockset with one vote by any validator.", "docstring_tokens": ["in", "order", "to", "avoid", "a", "complicated", "bootstrapping", "we", "define", "the", "genesis_signing_lockset", "as", "a", "lockset", "with", "one", "vote", "by", "any", "validator", "."], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 252213}
{"url": "https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/rarfile.py#L188-L241", "sha": "b1ac46cbcf42f3d3c5c69ab971fe97369a4da617", "docstring_summary": "Return file-like object for 'member'.", "language": "python", "parameters": "(self, member, pwd=None)", "return_statement": "return data.get_bytes()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "RarInfo", ")", ":", "arg_1", "=", "arg_1", ".", "filename", "arg_3", "=", "unrarlib", ".", "RAROpenArchiveDataEx", "(", "arg_0", ".", "filename", ",", "mode", "=", "constants", ".", "RAR_OM_EXTRACT", ")", "arg_4", "=", "arg_0", ".", "_Func", "(", "arg_3", ")", "arg_5", "=", "arg_2", "or", "arg_0", ".", "pwd", "if", "arg_5", "is", "not", "None", ":", "unrarlib", ".", "RARSetPassword", "(", "arg_4", ",", "b", "(", "arg_5", ")", ")", "arg_6", "=", "_ReadIntoMemory", "(", ")", "arg_7", "=", "unrarlib", ".", "UNRARCALLBACK", "(", "arg_6", ".", "_callback", ")", "unrarlib", ".", "RARSetCallback", "(", "arg_4", ",", "arg_7", ",", "0", ")", "try", ":", "arg_8", "=", "arg_0", ".", "_read_header", "(", "arg_4", ")", "while", "arg_8", "is", "not", "None", ":", "if", "arg_8", ".", "filename", "==", "arg_1", ":", "arg_0", ".", "_process_current", "(", "arg_4", ",", "constants", ".", "RAR_TEST", ")", "break", "else", ":", "arg_0", ".", "_process_current", "(", "arg_4", ",", "constants", ".", "RAR_SKIP", ")", "arg_8", "=", "arg_0", ".", "_read_header", "(", "arg_4", ")", "if", "arg_8", "is", "None", ":", "arg_6", "=", "None", "except", "unrarlib", ".", "MissingPassword", ":", "raise", "RuntimeError", "(", "\"File is encrypted, password required\"", ")", "except", "unrarlib", ".", "BadPassword", ":", "raise", "RuntimeError", "(", "\"Bad password for File\"", ")", "except", "unrarlib", ".", "BadDataError", ":", "if", "arg_5", "is", "not", "None", ":", "raise", "RuntimeError", "(", "\"File CRC error or incorrect password\"", ")", "else", ":", "raise", "RuntimeError", "(", "\"File CRC error\"", ")", "except", "unrarlib", ".", "UnrarException", "as", "e", ":", "raise", "BadRarFile", "(", "\"Bad RAR archive data: %s\"", "%", "str", "(", "e", ")", ")", "finally", ":", "arg_0", ".", "_close", "(", "arg_4", ")", "if", "arg_6", "is", "None", ":", "raise", "KeyError", "(", "'There is no item named %r in the archive'", "%", "arg_1", ")", "return", "arg_6", ".", "get_bytes", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Return file-like object for 'member'.\n\n           'member' may be a filename or a RarInfo object.\n        \"\"\"\n        if isinstance(arg_1, RarInfo):\n            arg_1 = arg_1.filename\n\n        arg_3 = unrarlib.RAROpenArchiveDataEx(\n            arg_0.filename, mode=constants.RAR_OM_EXTRACT)\n        arg_4 = arg_0._Func(arg_3)\n\n        arg_5 = arg_2 or arg_0.pwd\n        if arg_5 is not None:\n            unrarlib.RARSetPassword(arg_4, b(arg_5))\n\n        # based on BrutuZ (https://github.com/matiasb/python-unrar/pull/4)\n        # and Cubixmeister work\n        arg_6 = _ReadIntoMemory()\n        arg_7 = unrarlib.UNRARCALLBACK(arg_6._callback)\n        unrarlib.RARSetCallback(arg_4, arg_7, 0)\n\n        try:\n            arg_8 = arg_0._read_header(arg_4)\n            while arg_8 is not None:\n                if arg_8.filename == arg_1:\n                    arg_0._process_current(arg_4, constants.RAR_TEST)\n                    break\n                else:\n                    arg_0._process_current(arg_4, constants.RAR_SKIP)\n                arg_8 = arg_0._read_header(arg_4)\n\n            if arg_8 is None:\n                arg_6 = None\n\n        except unrarlib.MissingPassword:\n            raise RuntimeError(\"File is encrypted, password required\")\n        except unrarlib.BadPassword:\n            raise RuntimeError(\"Bad password for File\")\n        except unrarlib.BadDataError:\n            if arg_5 is not None:\n                raise RuntimeError(\"File CRC error or incorrect password\")\n            else:\n                raise RuntimeError(\"File CRC error\")\n        except unrarlib.UnrarException as e:\n            raise BadRarFile(\"Bad RAR archive data: %s\" % str(e))\n        finally:\n            arg_0._close(arg_4)\n\n        if arg_6 is None:\n            raise KeyError('There is no item named %r in the archive' % arg_1)\n\n        # return file-like object\n        return arg_6.get_bytes()", "path": "unrar/rarfile.py", "identifier": "RarFile.open", "docstring": "Return file-like object for 'member'.\n\n           'member' may be a filename or a RarInfo object.", "docstring_tokens": ["Return", "file", "-", "like", "object", "for", "member", "."], "nwo": "matiasb/python-unrar", "score": 0.34770217692582306, "idx": 252214}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/inspector.py#L136-L147", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Update the tree item when the object name changes", "language": "python", "parameters": "(self, obj, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "tree", ".", "FindItem", "(", "arg_0", ".", "root", ",", "arg_2", "[", "'name'", "]", ")", "if", "DEBUG", ":", "print", "\"Func child\"", ",", "arg_3", ",", "arg_2", "if", "arg_3", ":", "arg_0", ".", "tree", ".", "ScrollTo", "(", "arg_3", ")", "arg_0", ".", "tree", ".", "SetCurrentItem", "(", "arg_3", ")", "arg_0", ".", "tree", ".", "SelectItem", "(", "arg_3", ")", "arg_3", ".", "Selected", "=", "True", "arg_0", ".", "tree", ".", "SetItemText", "(", "arg_3", ",", "arg_1", ".", "name", ",", "0", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"Update the tree item when the object name changes\"\n        # search for the old name:\n        arg_3 = arg_0.tree.FindItem(arg_0.root, arg_2['name'])\n        if DEBUG: print \"Func child\", arg_3, arg_2\n        if arg_3:\n            arg_0.tree.ScrollTo(arg_3)\n            arg_0.tree.SetCurrentItem(arg_3)\n            arg_0.tree.SelectItem(arg_3)\n            arg_3.Selected = True\n            # Func the new name\n            arg_0.tree.SetItemText(arg_3, arg_1.name, 0)", "path": "gui/tools/inspector.py", "identifier": "InspectorPanel.update", "docstring": "Update the tree item when the object name changes", "docstring_tokens": ["Update", "the", "tree", "item", "when", "the", "object", "name", "changes"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 252215}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L432-L443", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "iterator for collecting the single-word keyphrases", "language": "python", "parameters": "(sent, ranks, stopwords)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ":", "if", "(", "arg_3", ".", "word_id", ">", "0", ")", "and", "(", "arg_3", ".", "root", "in", "arg_1", ")", "and", "(", "arg_3", ".", "pos", "[", "0", "]", "in", "\"NV\"", ")", "and", "(", "arg_3", ".", "root", "not", "in", "arg_2", ")", ":", "arg_4", "=", "RankedLexeme", "(", "text", "=", "arg_3", ".", "raw", ".", "lower", "(", ")", ",", "rank", "=", "arg_1", "[", "arg_3", ".", "root", "]", "/", "2.0", ",", "ids", "=", "[", "arg_3", ".", "word_id", "]", ",", "pos", "=", "arg_3", ".", "pos", ".", "lower", "(", ")", ",", "count", "=", "1", ")", "if", "DEBUG", ":", "print", "(", "arg_4", ")", "yield", "arg_4"], "function": "def Func (arg_0, arg_1, arg_2):\n    \"\"\"\n    iterator for collecting the single-word keyphrases\n    \"\"\"\n    for arg_3 in arg_0:\n        if (arg_3.word_id > 0) and (arg_3.root in arg_1) and (arg_3.pos[0] in \"NV\") and (arg_3.root not in arg_2):\n            arg_4 = RankedLexeme(text=arg_3.raw.lower(), rank=arg_1[arg_3.root]/2.0, ids=[arg_3.word_id], pos=arg_3.pos.lower(), count=1)\n\n            if DEBUG:\n                print(arg_4)\n\n            yield arg_4", "path": "pytextrank/pytextrank.py", "identifier": "collect_keyword", "docstring": "iterator for collecting the single-word keyphrases", "docstring_tokens": ["iterator", "for", "collecting", "the", "single", "-", "word", "keyphrases"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 252216}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/bacon/controller.py#L276-L285", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "Find a mapping that can apply to the given controller.  Returns None if unsuccessful.", "language": "python", "parameters": "(cls, controller)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "arg_0", ".", "_registry", "[", "(", "arg_1", ".", "vendor_id", ",", "arg_1", ".", "product_id", ")", "]", "except", "KeyError", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        '''Find a mapping that can apply to the given controller.  Returns None if unsuccessful.\n\n        :param controller: :class:`Controller` to look up\n        :return: :class:`ControllerMapping`\n        '''\n        try:\n            return arg_0._registry[(arg_1.vendor_id, arg_1.product_id)]\n        except KeyError:\n            return None", "path": "bacon/controller.py", "identifier": "ControllerMapping.get", "docstring": "Find a mapping that can apply to the given controller.  Returns None if unsuccessful.\n\n        :param controller: :class:`Controller` to look up\n        :return: :class:`ControllerMapping`", "docstring_tokens": ["Find", "a", "mapping", "that", "can", "apply", "to", "the", "given", "controller", ".", "Returns", "None", "if", "unsuccessful", "."], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 252217}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/config.py#L266-L339", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Configure the nose running environment. Execute configure before\n        collecting tests with nose.TestCollector to enable output capture and\n        other features.", "language": "python", "parameters": "(self, argv=None, doc=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "env", "if", "arg_1", "is", "None", ":", "arg_1", "=", "sys", ".", "argv", "arg_4", "=", "getattr", "(", "arg_0", ",", "'files'", ",", "[", "]", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_parseArgs", "(", "arg_1", ",", "arg_4", ")", "if", "getattr", "(", "arg_5", ",", "'files'", ",", "[", "]", ")", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_parseArgs", "(", "arg_1", ",", "arg_5", ".", "files", ")", "arg_0", ".", "options", "=", "arg_5", "if", "arg_6", ":", "arg_0", ".", "testNames", "=", "arg_6", "if", "arg_5", ".", "testNames", "is", "not", "None", ":", "arg_0", ".", "testNames", ".", "extend", "(", "tolist", "(", "arg_5", ".", "testNames", ")", ")", "if", "arg_5", ".", "py3where", "is", "not", "None", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", ")", ":", "arg_5", ".", "where", "=", "arg_5", ".", "py3where", "if", "not", "arg_5", ".", "where", ":", "arg_5", ".", "where", "=", "arg_3", ".", "get", "(", "'NOSE_WHERE'", ",", "None", ")", "if", "not", "arg_5", ".", "ignoreFiles", ":", "arg_5", ".", "ignoreFiles", "=", "arg_3", ".", "get", "(", "'NOSE_IGNORE_FILES'", ",", "[", "]", ")", "if", "not", "arg_5", ".", "include", ":", "arg_5", ".", "include", "=", "arg_3", ".", "get", "(", "'NOSE_INCLUDE'", ",", "[", "]", ")", "if", "not", "arg_5", ".", "exclude", ":", "arg_5", ".", "exclude", "=", "arg_3", ".", "get", "(", "'NOSE_EXCLUDE'", ",", "[", "]", ")", "arg_0", ".", "addPaths", "=", "arg_5", ".", "addPaths", "arg_0", ".", "stopOnError", "=", "arg_5", ".", "stopOnError", "arg_0", ".", "verbosity", "=", "arg_5", ".", "verbosity", "arg_0", ".", "includeExe", "=", "arg_5", ".", "includeExe", "arg_0", ".", "traverseNamespace", "=", "arg_5", ".", "traverseNamespace", "arg_0", ".", "debug", "=", "arg_5", ".", "debug", "arg_0", ".", "debugLog", "=", "arg_5", ".", "debugLog", "arg_0", ".", "loggingConfig", "=", "arg_5", ".", "loggingConfig", "arg_0", ".", "firstPackageWins", "=", "arg_5", ".", "firstPackageWins", "arg_0", ".", "FuncLogging", "(", ")", "if", "arg_5", ".", "where", "is", "not", "None", ":", "arg_0", ".", "FuncWhere", "(", "arg_5", ".", "where", ")", "if", "arg_5", ".", "testMatch", ":", "arg_0", ".", "testMatch", "=", "re", ".", "compile", "(", "arg_5", ".", "testMatch", ")", "if", "arg_5", ".", "ignoreFiles", ":", "arg_0", ".", "ignoreFiles", "=", "map", "(", "re", ".", "compile", ",", "tolist", "(", "arg_5", ".", "ignoreFiles", ")", ")", "log", ".", "info", "(", "\"Ignoring files matching %s\"", ",", "arg_5", ".", "ignoreFiles", ")", "else", ":", "log", ".", "info", "(", "\"Ignoring files matching %s\"", ",", "arg_0", ".", "ignoreFilesDefaultStrings", ")", "if", "arg_5", ".", "include", ":", "arg_0", ".", "include", "=", "map", "(", "re", ".", "compile", ",", "tolist", "(", "arg_5", ".", "include", ")", ")", "log", ".", "info", "(", "\"Including tests matching %s\"", ",", "arg_5", ".", "include", ")", "if", "arg_5", ".", "exclude", ":", "arg_0", ".", "exclude", "=", "map", "(", "re", ".", "compile", ",", "tolist", "(", "arg_5", ".", "exclude", ")", ")", "log", ".", "info", "(", "\"Excluding tests matching %s\"", ",", "arg_5", ".", "exclude", ")", "if", "not", "arg_5", ".", "showPlugins", ":", "arg_0", ".", "plugins", ".", "Func", "(", "arg_5", ",", "arg_0", ")", "arg_0", ".", "plugins", ".", "begin", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Configure the nose running environment. Execute Func before\n        collecting tests with nose.TestCollector to enable output capture and\n        other features.\n        \"\"\"\n        arg_3 = arg_0.env\n        if arg_1 is None:\n            arg_1 = sys.argv\n\n        arg_4 = getattr(arg_0, 'files', [])\n        arg_5, arg_6 = arg_0._parseArgs(arg_1, arg_4)\n        # If -c --config has been specified on command line,\n        # load those config files and reparse\n        if getattr(arg_5, 'files', []):\n            arg_5, arg_6 = arg_0._parseArgs(arg_1, arg_5.files)\n\n        arg_0.options = arg_5\n        if arg_6:\n            arg_0.testNames = arg_6\n        if arg_5.testNames is not None:\n            arg_0.testNames.extend(tolist(arg_5.testNames))\n\n        if arg_5.py3where is not None:\n            if sys.version_info >= (3,):\n                arg_5.where = arg_5.py3where\n\n        # `where` is an append action, so it can't have a default value\n        # in the parser, or that default will always be in the list\n        if not arg_5.where:\n            arg_5.where = arg_3.get('NOSE_WHERE', None)\n\n        # include and exclude also\n        if not arg_5.ignoreFiles:\n            arg_5.ignoreFiles = arg_3.get('NOSE_IGNORE_FILES', [])\n        if not arg_5.include:\n            arg_5.include = arg_3.get('NOSE_INCLUDE', [])\n        if not arg_5.exclude:\n            arg_5.exclude = arg_3.get('NOSE_EXCLUDE', [])\n\n        arg_0.addPaths = arg_5.addPaths\n        arg_0.stopOnError = arg_5.stopOnError\n        arg_0.verbosity = arg_5.verbosity\n        arg_0.includeExe = arg_5.includeExe\n        arg_0.traverseNamespace = arg_5.traverseNamespace\n        arg_0.debug = arg_5.debug\n        arg_0.debugLog = arg_5.debugLog\n        arg_0.loggingConfig = arg_5.loggingConfig\n        arg_0.firstPackageWins = arg_5.firstPackageWins\n        arg_0.FuncLogging()\n\n        if arg_5.where is not None:\n            arg_0.FuncWhere(arg_5.where)\n\n        if arg_5.testMatch:\n            arg_0.testMatch = re.compile(arg_5.testMatch)\n\n        if arg_5.ignoreFiles:\n            arg_0.ignoreFiles = map(re.compile, tolist(arg_5.ignoreFiles))\n            log.info(\"Ignoring files matching %s\", arg_5.ignoreFiles)\n        else:\n            log.info(\"Ignoring files matching %s\", arg_0.ignoreFilesDefaultStrings)\n\n        if arg_5.include:\n            arg_0.include = map(re.compile, tolist(arg_5.include))\n            log.info(\"Including tests matching %s\", arg_5.include)\n\n        if arg_5.exclude:\n            arg_0.exclude = map(re.compile, tolist(arg_5.exclude))\n            log.info(\"Excluding tests matching %s\", arg_5.exclude)\n\n        # When listing plugins we don't want to run them\n        if not arg_5.showPlugins:\n            arg_0.plugins.Func(arg_5, arg_0)\n            arg_0.plugins.begin()", "path": "environment/lib/python2.7/site-packages/nose/config.py", "identifier": "Config.configure", "docstring": "Configure the nose running environment. Execute configure before\n        collecting tests with nose.TestCollector to enable output capture and\n        other features.", "docstring_tokens": ["Configure", "the", "nose", "running", "environment", ".", "Execute", "configure", "before", "collecting", "tests", "with", "nose", ".", "TestCollector", "to", "enable", "output", "capture", "and", "other", "features", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252218}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L199-L204", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Add a specialized option that is the action to execute.", "language": "python", "parameters": "(self, dash, dashdash, action_code)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "add_option", "(", "arg_1", ",", "arg_2", ",", "action", "=", "'callback'", ",", "callback", "=", "arg_0", ".", "_append_action", ")", "arg_4", ".", "action_code", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Add a specialized option that is the action to execute.\"\"\"\n        arg_4 = arg_0.add_option(arg_1, arg_2, action='callback',\n            callback=arg_0._append_action\n            )\n        arg_4.action_code = arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py", "identifier": "ClassicOptionParser.add_action", "docstring": "Add a specialized option that is the action to execute.", "docstring_tokens": ["Add", "a", "specialized", "option", "that", "is", "the", "action", "to", "execute", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 252219}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L684-L719", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Parse a header fragment delimited by special characters.", "language": "python", "parameters": "(self, beginchar, endchars, allowcomments = 1)", "return_statement": "return ''.join(slist)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "if", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "!=", "arg_1", ":", "return", "''", "arg_4", "=", "[", "''", "]", "arg_5", "=", "0", "arg_0", ".", "pos", "+=", "1", "while", "arg_0", ".", "pos", "<", "len", "(", "arg_0", ".", "field", ")", ":", "if", "arg_5", "==", "1", ":", "arg_4", ".", "append", "(", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", ")", "arg_5", "=", "0", "elif", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "in", "arg_2", ":", "arg_0", ".", "pos", "+=", "1", "break", "elif", "arg_3", "and", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "==", "'('", ":", "arg_4", ".", "append", "(", "arg_0", ".", "getcomment", "(", ")", ")", "continue", "elif", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "==", "'\\\\'", ":", "arg_5", "=", "1", "else", ":", "arg_4", ".", "append", "(", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", ")", "arg_0", ".", "pos", "+=", "1", "return", "''", ".", "join", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = 1):\n        \"\"\"Parse a header fragment delimited by special characters.\n\n        `beginchar' is the start character for the fragment.  If self is not\n        looking at an instance of `beginchar' then Func returns the\n        empty string.\n\n        `endchars' is a sequence of allowable end-delimiting characters.\n        Parsing stops when one of these is encountered.\n\n        If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed\n        within the parsed fragment.\n        \"\"\"\n        if arg_0.field[arg_0.pos] != arg_1:\n            return ''\n\n        arg_4 = ['']\n        arg_5 = 0\n        arg_0.pos += 1\n        while arg_0.pos < len(arg_0.field):\n            if arg_5 == 1:\n                arg_4.append(arg_0.field[arg_0.pos])\n                arg_5 = 0\n            elif arg_0.field[arg_0.pos] in arg_2:\n                arg_0.pos += 1\n                break\n            elif arg_3 and arg_0.field[arg_0.pos] == '(':\n                arg_4.append(arg_0.getcomment())\n                continue        # have already advanced pos from getcomment\n            elif arg_0.field[arg_0.pos] == '\\\\':\n                arg_5 = 1\n            else:\n                arg_4.append(arg_0.field[arg_0.pos])\n            arg_0.pos += 1\n\n        return ''.join(arg_4)", "path": "third_party/stdlib/rfc822.py", "identifier": "AddrlistClass.getdelimited", "docstring": "Parse a header fragment delimited by special characters.\n\n        `beginchar' is the start character for the fragment.  If self is not\n        looking at an instance of `beginchar' then getdelimited returns the\n        empty string.\n\n        `endchars' is a sequence of allowable end-delimiting characters.\n        Parsing stops when one of these is encountered.\n\n        If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed\n        within the parsed fragment.", "docstring_tokens": ["Parse", "a", "header", "fragment", "delimited", "by", "special", "characters", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 252220}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/objs.py#L335-L354", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "See sphere_analytical_gaussian_exact.", "language": "python", "parameters": "(dr, a, alpha=0.2765, cut=1.6)", "return_statement": "return ans", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.2765", ",", "arg_3", "=", "1.6", ")", ":", "arg_4", "=", "np", ".", "abs", "(", "arg_0", ")", "<=", "arg_3", "arg_5", "=", "arg_0", "[", "arg_4", "]", "arg_6", "=", "-", "arg_5", "/", "(", "arg_2", "*", "np", ".", "sqrt", "(", "2", ")", ")", "arg_7", "=", "0.5", "*", "(", "1", "+", "erf", "(", "arg_6", ")", ")", "-", "np", ".", "sqrt", "(", "0.5", "/", "np", ".", "pi", ")", "*", "(", "arg_2", "/", "(", "arg_5", "+", "arg_1", "+", "1e-10", ")", ")", "*", "np", ".", "exp", "(", "-", "arg_6", "*", "arg_6", ")", "arg_8", "=", "0", "*", "arg_0", "arg_8", "[", "arg_4", "]", "=", "arg_7", "arg_8", "[", "arg_0", ">", "arg_3", "]", "=", "0", "arg_8", "[", "arg_0", "<", "-", "arg_3", "]", "=", "1", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=0.2765, arg_3=1.6):\n    \"\"\"\n    See sphere_analytical_gaussian_exact.\n\n    I trimmed to terms from the functional form that are essentially zero (1e-8)\n    for r0 > cut (~1.5), a fine approximation for these platonic anyway.\n    \"\"\"\n    arg_4 = np.abs(arg_0) <= arg_3\n\n    # only compute on the relevant scales\n    arg_5 = arg_0[arg_4]\n    arg_6 = -arg_5/(arg_2*np.sqrt(2))\n    arg_7 = 0.5*(1 + erf(arg_6)) - np.sqrt(0.5/np.pi)*(arg_2/(arg_5+arg_1+1e-10)) * np.exp(-arg_6*arg_6)\n\n    # fill in the grid, inside the interpolation and outside where values are constant\n    arg_8 = 0*arg_0\n    arg_8[arg_4] = arg_7\n    arg_8[arg_0 >  arg_3] = 0\n    arg_8[arg_0 < -arg_3] = 1\n    return arg_8", "path": "peri/comp/objs.py", "identifier": "sphere_analytical_gaussian_trim", "docstring": "See sphere_analytical_gaussian_exact.\n\n    I trimmed to terms from the functional form that are essentially zero (1e-8)\n    for r0 > cut (~1.5), a fine approximation for these platonic anyway.", "docstring_tokens": ["See", "sphere_analytical_gaussian_exact", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252221}
{"url": "https://github.com/d0ugal/home/blob/e984716ae6c74dc8e40346584668ac5cfeaaf520/home/collect/handlers.py#L26-L69", "sha": "e984716ae6c74dc8e40346584668ac5cfeaaf520", "docstring_summary": "Given a dictionary mapping which looks like the following, import the\n    objects based on the dotted path and yield the packet type and handler as\n    pairs.", "language": "python", "parameters": "(handler_mapping)", "return_statement": "return handlers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "items", "(", ")", ":", "if", "arg_2", "==", "'*'", ":", "arg_4", "=", "arg_2", "elif", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_4", "=", "importer", "(", "arg_2", ")", "else", ":", "arg_4", "=", "arg_2", "if", "isinstance", "(", "arg_3", ",", "str", ")", ":", "arg_5", "=", "importer", "(", "arg_3", ")", "else", ":", "arg_5", "=", "arg_3", "if", "arg_4", "in", "arg_1", ":", "raise", "HandlerConfigError", "(", "\"Handler already provided for packet %s\"", "%", "arg_4", ")", "arg_1", "[", "arg_4", "]", "=", "arg_5", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Given a dictionary mapping which looks like the following, import the\n    objects based on the dotted path and yield the packet type and handler as\n    pairs.\n\n    If the special string '*' is passed, don't process that, pass it on as it\n    is a wildcard.\n\n    If an non-string object is given for either packet or handler (key or\n    value) assume these are the objects to use and yield them.\n\n    ::\n        {\n        'rfxcom.protocol.Status': 'home.collect.logging_handler',\n        'rfxcom.protocol.Elec': 'home.collect.elec_handler',\n        'rfxcom.protocol.TempHumidity': 'home.collect.temp_humidity_handler',\n        '*': 'home.collect.logging_handler'\n        }\n    \"\"\"\n\n    arg_1 = {}\n\n    for arg_2, arg_3 in arg_0.items():\n\n        if arg_2 == '*':\n            arg_4 = arg_2\n        elif isinstance(arg_2, str):\n            arg_4 = importer(arg_2)\n        else:\n            arg_4 = arg_2\n\n        if isinstance(arg_3, str):\n            arg_5 = importer(arg_3)\n        else:\n            arg_5 = arg_3\n\n        if arg_4 in arg_1:\n            raise HandlerConfigError(\n                \"Handler already provided for packet %s\" % arg_4)\n\n        arg_1[arg_4] = arg_5\n\n    return arg_1", "path": "home/collect/handlers.py", "identifier": "load_handlers", "docstring": "Given a dictionary mapping which looks like the following, import the\n    objects based on the dotted path and yield the packet type and handler as\n    pairs.\n\n    If the special string '*' is passed, don't process that, pass it on as it\n    is a wildcard.\n\n    If an non-string object is given for either packet or handler (key or\n    value) assume these are the objects to use and yield them.\n\n    ::\n        {\n        'rfxcom.protocol.Status': 'home.collect.logging_handler',\n        'rfxcom.protocol.Elec': 'home.collect.elec_handler',\n        'rfxcom.protocol.TempHumidity': 'home.collect.temp_humidity_handler',\n        '*': 'home.collect.logging_handler'\n        }", "docstring_tokens": ["Given", "a", "dictionary", "mapping", "which", "looks", "like", "the", "following", "import", "the", "objects", "based", "on", "the", "dotted", "path", "and", "yield", "the", "packet", "type", "and", "handler", "as", "pairs", "."], "nwo": "d0ugal/home", "score": 0.25890992733444657, "idx": 252222}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/versiontools_support.py#L78-L99", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Get distribution version.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "(", "arg_0", ".", "name", "is", "not", "None", "and", "arg_0", ".", "version", "is", "not", "None", "and", "arg_0", ".", "version", ".", "startswith", "(", "\":versiontools:\"", ")", ")", ":", "return", "(", "arg_0", ".", "__get_live_version", "(", ")", "or", "arg_0", ".", "__get_frozen_version", "(", ")", "or", "arg_0", ".", "__fail_to_get_any_version", "(", ")", ")", "else", ":", "return", "arg_0", ".", "__base", ".", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0): \n        \"\"\"\n        Get distribution version.\n\n        This method is enhanced compared to original distutils implementation.\n        If the version string is set to a special value then instead of using\n        the actual value the real version is obtained by querying versiontools.\n\n        If versiontools package is not installed then the version is obtained\n        from the standard section of the ``PKG-INFO`` file. This file is\n        automatically created by any source distribution. This method is less\n        useful as it cannot take advantage of version control information that\n        is automatically loaded by versiontools. It has the advantage of not\n        requiring versiontools installation and that it does not depend on\n        ``setup_requires`` feature of ``setuptools``.\n        \"\"\"\n        if (arg_0.name is not None and arg_0.version is not None\n            and arg_0.version.startswith(\":versiontools:\")):\n            return (arg_0.__get_live_version() or arg_0.__get_frozen_version()\n                    or arg_0.__fail_to_get_any_version())\n        else:\n            return arg_0.__base.Func(arg_0)", "path": "versiontools_support.py", "identifier": "VersiontoolsEnchancedDistributionMetadata.get_version", "docstring": "Get distribution version.\n\n        This method is enhanced compared to original distutils implementation.\n        If the version string is set to a special value then instead of using\n        the actual value the real version is obtained by querying versiontools.\n\n        If versiontools package is not installed then the version is obtained\n        from the standard section of the ``PKG-INFO`` file. This file is\n        automatically created by any source distribution. This method is less\n        useful as it cannot take advantage of version control information that\n        is automatically loaded by versiontools. It has the advantage of not\n        requiring versiontools installation and that it does not depend on\n        ``setup_requires`` feature of ``setuptools``.", "docstring_tokens": ["Get", "distribution", "version", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 252223}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L412-L422", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return EventRequestHeader for conversation.", "language": "python", "parameters": "(self)", "return_statement": "return hangouts_pb2.EventRequestHeader(\n            conversation_id=hangouts_pb2.ConversationId(id=self.id_),\n            client_generated_id=self._client.get_client_generated_id(),\n            expected_otr=otr_status,\n            delivery_medium=self._get_default_delivery_medium(),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "hangouts_pb2", ".", "OFF_THE_RECORD_STATUS_OFF_THE_RECORD", "if", "arg_0", ".", "is_off_the_record", "else", "hangouts_pb2", ".", "OFF_THE_RECORD_STATUS_ON_THE_RECORD", ")", "return", "hangouts_pb2", ".", "EventRequestHeader", "(", "conversation_id", "=", "hangouts_pb2", ".", "ConversationId", "(", "id", "=", "arg_0", ".", "id_", ")", ",", "client_generated_id", "=", "arg_0", ".", "_client", ".", "get_client_generated_id", "(", ")", ",", "expected_otr", "=", "arg_1", ",", "delivery_medium", "=", "arg_0", ".", "_get_default_delivery_medium", "(", ")", ",", ")"], "function": "def Func(arg_0):\n        \"\"\"Return EventRequestHeader for conversation.\"\"\"\n        arg_1 = (hangouts_pb2.OFF_THE_RECORD_STATUS_OFF_THE_RECORD\n                      if arg_0.is_off_the_record else\n                      hangouts_pb2.OFF_THE_RECORD_STATUS_ON_THE_RECORD)\n        return hangouts_pb2.EventRequestHeader(\n            conversation_id=hangouts_pb2.ConversationId(id=arg_0.id_),\n            client_generated_id=arg_0._client.get_client_generated_id(),\n            expected_otr=arg_1,\n            delivery_medium=arg_0._get_default_delivery_medium(),\n        )", "path": "hangups/conversation.py", "identifier": "Conversation._get_event_request_header", "docstring": "Return EventRequestHeader for conversation.", "docstring_tokens": ["Return", "EventRequestHeader", "for", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 252224}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicefabric/azure/servicefabric/service_fabric_client_ap_is.py#L7441-L7511", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gets a list of repair tasks matching the given filters.", "language": "python", "parameters": "(\n            self, task_id_filter=None, state_filter=None, executor_filter=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "**", "arg_6", ")", ":", "arg_7", "=", "\"6.0\"", "arg_8", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_9", "=", "{", "}", "arg_9", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"api_version\"", ",", "arg_7", ",", "'str'", ")", "if", "arg_1", "is", "not", "None", ":", "arg_9", "[", "'TaskIdFilter'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"task_id_filter\"", ",", "arg_1", ",", "'str'", ")", "if", "arg_2", "is", "not", "None", ":", "arg_9", "[", "'StateFilter'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"state_filter\"", ",", "arg_2", ",", "'int'", ")", "if", "arg_3", "is", "not", "None", ":", "arg_9", "[", "'ExecutorFilter'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"executor_filter\"", ",", "arg_3", ",", "'str'", ")", "arg_10", "=", "{", "}", "arg_10", "[", "'Accept'", "]", "=", "'application/json'", "if", "arg_4", ":", "arg_10", ".", "update", "(", "arg_4", ")", "arg_11", "=", "arg_0", ".", "_client", ".", "get", "(", "arg_8", ",", "arg_9", ",", "arg_10", ")", "arg_12", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_11", ",", "stream", "=", "False", ",", "**", "arg_6", ")", "if", "arg_12", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "FabricErrorException", "(", "arg_0", ".", "_deserialize", ",", "arg_12", ")", "arg_13", "=", "None", "if", "arg_12", ".", "status_code", "==", "200", ":", "arg_13", "=", "arg_0", ".", "_deserialize", "(", "'[RepairTask]'", ",", "arg_12", ")", "if", "arg_5", ":", "arg_14", "=", "ClientRawResponse", "(", "arg_13", ",", "arg_12", ")", "return", "arg_14", "return", "arg_13"], "function": "def Func(\n            arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=False, **arg_6):\n        \"\"\"Gets a list of repair tasks matching the given filters.\n\n        This API supports the Service Fabric platform; it is not meant to be\n        used directly from your code.\n\n        :param task_id_filter: The repair task ID prefix to be matched.\n        :type task_id_filter: str\n        :param state_filter: A bitwise-OR of the following values, specifying\n         which task states should be included in the result list.\n         - 1 - Created\n         - 2 - Claimed\n         - 4 - Preparing\n         - 8 - Approved\n         - 16 - Executing\n         - 32 - Restoring\n         - 64 - Completed\n        :type state_filter: int\n        :param executor_filter: The name of the repair executor whose claimed\n         tasks should be included in the list.\n        :type executor_filter: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: list or ClientRawResponse if raw=true\n        :rtype: list[~azure.servicefabric.models.RepairTask] or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`\n        \"\"\"\n        arg_7 = \"6.0\"\n\n        # Construct URL\n        arg_8 = arg_0.Func.metadata['url']\n\n        # Construct parameters\n        arg_9 = {}\n        arg_9['api-version'] = arg_0._serialize.query(\"api_version\", arg_7, 'str')\n        if arg_1 is not None:\n            arg_9['TaskIdFilter'] = arg_0._serialize.query(\"task_id_filter\", arg_1, 'str')\n        if arg_2 is not None:\n            arg_9['StateFilter'] = arg_0._serialize.query(\"state_filter\", arg_2, 'int')\n        if arg_3 is not None:\n            arg_9['ExecutorFilter'] = arg_0._serialize.query(\"executor_filter\", arg_3, 'str')\n\n        # Construct headers\n        arg_10 = {}\n        arg_10['Accept'] = 'application/json'\n        if arg_4:\n            arg_10.update(arg_4)\n\n        # Construct and send request\n        arg_11 = arg_0._client.get(arg_8, arg_9, arg_10)\n        arg_12 = arg_0._client.send(arg_11, stream=False, **arg_6)\n\n        if arg_12.status_code not in [200]:\n            raise models.FabricErrorException(arg_0._deserialize, arg_12)\n\n        arg_13 = None\n\n        if arg_12.status_code == 200:\n            arg_13 = arg_0._deserialize('[RepairTask]', arg_12)\n\n        if arg_5:\n            arg_14 = ClientRawResponse(arg_13, arg_12)\n            return arg_14\n\n        return arg_13", "path": "azure-servicefabric/azure/servicefabric/service_fabric_client_ap_is.py", "identifier": "ServiceFabricClientAPIs.get_repair_task_list", "docstring": "Gets a list of repair tasks matching the given filters.\n\n        This API supports the Service Fabric platform; it is not meant to be\n        used directly from your code.\n\n        :param task_id_filter: The repair task ID prefix to be matched.\n        :type task_id_filter: str\n        :param state_filter: A bitwise-OR of the following values, specifying\n         which task states should be included in the result list.\n         - 1 - Created\n         - 2 - Claimed\n         - 4 - Preparing\n         - 8 - Approved\n         - 16 - Executing\n         - 32 - Restoring\n         - 64 - Completed\n        :type state_filter: int\n        :param executor_filter: The name of the repair executor whose claimed\n         tasks should be included in the list.\n        :type executor_filter: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: list or ClientRawResponse if raw=true\n        :rtype: list[~azure.servicefabric.models.RepairTask] or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`", "docstring_tokens": ["Gets", "a", "list", "of", "repair", "tasks", "matching", "the", "given", "filters", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252225}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L544-L550", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Find MultiQC report for the case.", "language": "python", "parameters": "(store, institute_id, case_name)", "return_statement": "return dict(\n        institute=institute_obj,\n        case=case_obj,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "institute_and_case", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "return", "dict", "(", "institute", "=", "arg_3", ",", "case", "=", "arg_4", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Find MultiQC report for the case.\"\"\"\n    arg_3, arg_4 = institute_and_case(arg_0, arg_1, arg_2)\n    return dict(\n        institute=arg_3,\n        case=arg_4,\n    )", "path": "scout/server/blueprints/cases/controllers.py", "identifier": "multiqc", "docstring": "Find MultiQC report for the case.", "docstring_tokens": ["Find", "MultiQC", "report", "for", "the", "case", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252226}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/comparisons.py#L53-L99", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Compares two parameter instances", "language": "python", "parameters": "(a, b)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "not", "arg_1", ".", "v_is_parameter", "and", "not", "arg_0", ".", "v_is_parameter", ")", ":", "raise", "ValueError", "(", "'Both inputs are not parameters'", ")", "if", "(", "not", "arg_1", ".", "v_is_parameter", "or", "not", "arg_0", ".", "v_is_parameter", ")", ":", "return", "False", "if", "arg_0", ".", "v_full_name", "!=", "arg_1", ".", "v_full_name", ":", "return", "False", "if", "arg_0", ".", "f_is_empty", "(", ")", "and", "arg_1", ".", "f_is_empty", "(", ")", ":", "return", "True", "if", "arg_0", ".", "f_is_empty", "(", ")", "!=", "arg_1", ".", "f_is_empty", "(", ")", ":", "return", "False", "if", "not", "arg_0", ".", "_values_of_same_type", "(", "arg_0", ".", "f_get", "(", ")", ",", "arg_1", ".", "f_get", "(", ")", ")", ":", "return", "False", "if", "not", "arg_0", ".", "_equal_values", "(", "arg_0", ".", "f_get", "(", ")", ",", "arg_1", ".", "f_get", "(", ")", ")", ":", "return", "False", "if", "arg_0", ".", "f_has_range", "(", ")", "!=", "arg_1", ".", "f_has_range", "(", ")", ":", "return", "False", "if", "arg_0", ".", "f_has_range", "(", ")", ":", "if", "arg_0", ".", "f_get_range_length", "(", ")", "!=", "arg_1", ".", "f_get_range_length", "(", ")", ":", "return", "False", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "arg_0", ".", "f_get_range", "(", "copy", "=", "False", ")", ",", "arg_1", ".", "f_get_range", "(", "copy", "=", "False", ")", ")", ":", "if", "not", "arg_0", ".", "_values_of_same_type", "(", "arg_2", ",", "arg_3", ")", ":", "return", "False", "if", "not", "arg_0", ".", "_equal_values", "(", "arg_2", ",", "arg_3", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Compares two parameter instances\n\n    Checks full name, data, and ranges. Does not consider the comment.\n\n    :return: True or False\n\n    :raises: ValueError if both inputs are no parameter instances\n\n    \"\"\"\n    if (not arg_1.v_is_parameter and\n            not arg_0.v_is_parameter):\n        raise ValueError('Both inputs are not parameters')\n\n    if (not arg_1.v_is_parameter or\n            not arg_0.v_is_parameter):\n        return False\n\n    if arg_0.v_full_name != arg_1.v_full_name:\n        return False\n\n    if arg_0.f_is_empty() and arg_1.f_is_empty():\n        return True\n\n    if arg_0.f_is_empty() != arg_1.f_is_empty():\n        return False\n\n    if not arg_0._values_of_same_type(arg_0.f_get(), arg_1.f_get()):\n        return False\n\n    if not arg_0._equal_values(arg_0.f_get(), arg_1.f_get()):\n        return False\n\n    if arg_0.f_has_range() != arg_1.f_has_range():\n        return False\n\n    if arg_0.f_has_range():\n        if arg_0.f_get_range_length() != arg_1.f_get_range_length():\n            return False\n\n        for arg_2, arg_3 in zip(arg_0.f_get_range(copy=False), arg_1.f_get_range(copy=False)):\n            if not arg_0._values_of_same_type(arg_2, arg_3):\n                return False\n            if not arg_0._equal_values(arg_2, arg_3):\n                return False\n\n    return True", "path": "pypet/utils/comparisons.py", "identifier": "parameters_equal", "docstring": "Compares two parameter instances\n\n    Checks full name, data, and ranges. Does not consider the comment.\n\n    :return: True or False\n\n    :raises: ValueError if both inputs are no parameter instances", "docstring_tokens": ["Compares", "two", "parameter", "instances"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252227}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/trainers/trainers.py#L65-L72", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Return updates from optimization.", "language": "python", "parameters": "(self, params, gradients)", "return_statement": "return updates", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "optimize_updates", "(", "arg_1", ",", "arg_2", ",", "arg_0", ".", "config", ")", "arg_0", ".", "network", ".", "free_parameters", ".", "extend", "(", "arg_4", ")", "logging", ".", "info", "(", "\"Added %d free parameters for optimization\"", "%", "len", "(", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Return updates from optimization.\n        \"\"\"\n        arg_3, arg_4 = optimize_updates(arg_1, arg_2, arg_0.config)\n        arg_0.network.free_parameters.extend(arg_4)\n        logging.info(\"Added %d free parameters for optimization\" % len(arg_4))\n        return arg_3", "path": "deepy/trainers/trainers.py", "identifier": "GeneralNeuralTrainer.optimization_updates", "docstring": "Return updates from optimization.", "docstring_tokens": ["Return", "updates", "from", "optimization", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 252228}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/harvestingkit_cli.py#L119-L157", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Transforms the argparse arguments from Namespace to dict and then to Bunch\n    Therefore it is not necessary to access the arguments using the dict syntax\n    The settings can be called like regular vars on the settings object", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "ArgumentParser", "(", ")", "arg_1", "=", "arg_0", ".", "add_subparsers", "(", "dest", "=", "'selected_subparser'", ")", "arg_2", "=", "arg_1", ".", "add_parser", "(", "'all'", ")", "arg_3", "=", "arg_1", ".", "add_parser", "(", "'elsevier'", ")", "arg_4", "=", "arg_1", ".", "add_parser", "(", "'oxford'", ")", "arg_5", "=", "arg_1", ".", "add_parser", "(", "'springer'", ")", "arg_2", ".", "add_argument", "(", "'--update-credentials'", ",", "action", "=", "'store_true'", ")", "arg_3", ".", "add_argument", "(", "'--run-locally'", ",", "action", "=", "'store_true'", ")", "arg_3", ".", "add_argument", "(", "'--package-name'", ")", "arg_3", ".", "add_argument", "(", "'--path'", ")", "arg_3", ".", "add_argument", "(", "'--CONSYN'", ",", "action", "=", "'store_true'", ")", "arg_3", ".", "add_argument", "(", "'--update-credentials'", ",", "action", "=", "'store_true'", ")", "arg_3", ".", "add_argument", "(", "'--extract-nations'", ",", "action", "=", "'store_true'", ")", "arg_4", ".", "add_argument", "(", "'--dont-empty-ftp'", ",", "action", "=", "'store_true'", ")", "arg_4", ".", "add_argument", "(", "'--package-name'", ")", "arg_4", ".", "add_argument", "(", "'--path'", ")", "arg_4", ".", "add_argument", "(", "'--update-credentials'", ",", "action", "=", "'store_true'", ")", "arg_4", ".", "add_argument", "(", "'--extract-nations'", ",", "action", "=", "'store_true'", ")", "arg_5", ".", "add_argument", "(", "'--package-name'", ")", "arg_5", ".", "add_argument", "(", "'--path'", ")", "arg_5", ".", "add_argument", "(", "'--update-credentials'", ",", "action", "=", "'store_true'", ")", "arg_5", ".", "add_argument", "(", "'--extract-nations'", ",", "action", "=", "'store_true'", ")", "'''    Transforms the argparse arguments from Namespace to dict and then to Bunch    Therefore it is not necessary to access the arguments using the dict syntax    The settings can be called like regular vars on the settings object    '''", "arg_6", "=", "Bunch", "(", "vars", "(", "arg_0", ".", "parse_args", "(", ")", ")", ")", "call_package", "(", "arg_6", ")"], "function": "def Func():\n    arg_0 = ArgumentParser()\n\n    arg_1 = arg_0.add_subparsers(dest='selected_subparser')\n\n    arg_2 = arg_1.add_parser('all')\n    arg_3 = arg_1.add_parser('elsevier')\n    arg_4 = arg_1.add_parser('oxford')\n    arg_5 = arg_1.add_parser('springer')\n\n    arg_2.add_argument('--update-credentials', action='store_true')\n\n    arg_3.add_argument('--run-locally', action='store_true')\n    arg_3.add_argument('--package-name')\n    arg_3.add_argument('--path')\n    arg_3.add_argument('--CONSYN', action='store_true')\n    arg_3.add_argument('--update-credentials', action='store_true')\n    arg_3.add_argument('--extract-nations', action='store_true')\n\n    arg_4.add_argument('--dont-empty-ftp', action='store_true')\n    arg_4.add_argument('--package-name')\n    arg_4.add_argument('--path')\n    arg_4.add_argument('--update-credentials', action='store_true')\n    arg_4.add_argument('--extract-nations', action='store_true')\n\n    arg_5.add_argument('--package-name')\n    arg_5.add_argument('--path')\n    arg_5.add_argument('--update-credentials', action='store_true')\n    arg_5.add_argument('--extract-nations', action='store_true')\n\n    '''\n    Transforms the argparse arguments from Namespace to dict and then to Bunch\n    Therefore it is not necessary to access the arguments using the dict syntax\n    The settings can be called like regular vars on the settings object\n    '''\n\n    arg_6 = Bunch(vars(arg_0.parse_args()))\n\n    call_package(arg_6)", "path": "harvestingkit/harvestingkit_cli.py", "identifier": "main", "docstring": "Transforms the argparse arguments from Namespace to dict and then to Bunch\n    Therefore it is not necessary to access the arguments using the dict syntax\n    The settings can be called like regular vars on the settings object", "docstring_tokens": ["Transforms", "the", "argparse", "arguments", "from", "Namespace", "to", "dict", "and", "then", "to", "Bunch", "Therefore", "it", "is", "not", "necessary", "to", "access", "the", "arguments", "using", "the", "dict", "syntax", "The", "settings", "can", "be", "called", "like", "regular", "vars", "on", "the", "settings", "object"], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 252229}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L619-L643", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Check if templates directories are setup and issue a warning and help.", "language": "python", "parameters": "()", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "\"GROMACSWRAPPER_SUPPRESS_SETUP_CHECK\"", "in", "os", ".", "environ", ":", "return", "True", "arg_0", "=", "[", "d", "for", "d", "in", "config_directories", "if", "not", "os", ".", "path", ".", "exists", "(", "d", ")", "]", "if", "len", "(", "arg_0", ")", ">", "0", ":", "print", "(", "\"NOTE: Some configuration directories are not set up yet: \"", ")", "print", "(", "\"\\t{0!s}\"", ".", "format", "(", "'\\n\\t'", ".", "join", "(", "arg_0", ")", ")", ")", "print", "(", "\"NOTE: You can create the configuration file and directories with:\"", ")", "print", "(", "\"\\t>>> import gromacs\"", ")", "print", "(", "\"\\t>>> gromacs.config.setup()\"", ")", "return", "False", "return", "True"], "function": "def Func():\n     \"\"\"Check if templates directories are setup and issue a warning and help.\n\n    Set the environment variable  :envvar:`GROMACSWRAPPER_SUPPRESS_SETUP_CHECK`\n    skip the check and make it always return ``True``\n\n    :return ``True`` if directories were found and ``False`` otherwise\n\n     .. versionchanged:: 0.3.1\n        Uses :envvar:`GROMACSWRAPPER_SUPPRESS_SETUP_CHECK` to suppress check\n        (useful for scripts run on a server)\n     \"\"\"\n\n     if \"GROMACSWRAPPER_SUPPRESS_SETUP_CHECK\" in os.environ:\n         return True\n\n     arg_0 = [d for d in config_directories if not os.path.exists(d)]\n     if len(arg_0) > 0:\n         print(\"NOTE: Some configuration directories are not set up yet: \")\n         print(\"\\t{0!s}\".format('\\n\\t'.join(arg_0)))\n         print(\"NOTE: You can create the configuration file and directories with:\")\n         print(\"\\t>>> import gromacs\")\n         print(\"\\t>>> gromacs.config.setup()\")\n         return False\n     return True", "path": "gromacs/config.py", "identifier": "check_setup", "docstring": "Check if templates directories are setup and issue a warning and help.\n\n    Set the environment variable  :envvar:`GROMACSWRAPPER_SUPPRESS_SETUP_CHECK`\n    skip the check and make it always return ``True``\n\n    :return ``True`` if directories were found and ``False`` otherwise\n\n     .. versionchanged:: 0.3.1\n        Uses :envvar:`GROMACSWRAPPER_SUPPRESS_SETUP_CHECK` to suppress check\n        (useful for scripts run on a server)", "docstring_tokens": ["Check", "if", "templates", "directories", "are", "setup", "and", "issue", "a", "warning", "and", "help", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 252230}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/filters.py#L860-L954", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "r'''Helper function to construct a multirate filterbank.", "language": "python", "parameters": "(center_freqs=None, sample_rates=None, Q=25.0,\n                  passband_ripple=1, stopband_attenuation=50, ftype='ellip', flayout='ba')", "return_statement": "return filterbank, sample_rates", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "25.0", ",", "arg_3", "=", "1", ",", "arg_4", "=", "50", ",", "arg_5", "=", "'ellip'", ",", "arg_6", "=", "'ba'", ")", ":", "if", "arg_0", "is", "None", ":", "raise", "ParameterError", "(", "'center_freqs must be provided.'", ")", "if", "arg_1", "is", "None", ":", "raise", "ParameterError", "(", "'sample_rates must be provided.'", ")", "if", "arg_0", ".", "shape", "!=", "arg_1", ".", "shape", ":", "raise", "ParameterError", "(", "'Number of provided center_freqs and sample_rates must be equal.'", ")", "arg_7", "=", "0.5", "*", "arg_1", "arg_8", "=", "arg_0", "/", "float", "(", "arg_2", ")", "arg_9", "=", "[", "]", "for", "arg_10", ",", "arg_11", ",", "arg_12", "in", "zip", "(", "arg_0", ",", "arg_7", ",", "arg_8", ")", ":", "arg_13", "=", "[", "arg_10", "-", "0.5", "*", "arg_12", ",", "arg_10", "+", "0.5", "*", "arg_12", "]", "/", "arg_11", "arg_14", "=", "[", "arg_10", "-", "arg_12", ",", "arg_10", "+", "arg_12", "]", "/", "arg_11", "arg_15", "=", "scipy", ".", "signal", ".", "iirdesign", "(", "arg_13", ",", "arg_14", ",", "arg_3", ",", "arg_4", ",", "analog", "=", "False", ",", "arg_5", "=", "arg_5", ",", "output", "=", "arg_6", ")", "arg_9", ".", "append", "(", "arg_15", ")", "return", "arg_9", ",", "arg_1"], "function": "def Func(arg_0=None, arg_1=None, arg_2=25.0,\n                  arg_3=1, arg_4=50, arg_5='ellip', arg_6='ba'):\n    r'''Helper function to construct a multirate filterbank.\n\n     A filter bank consists of multiple band-pass filters which divide the input signal\n     into subbands. In the case of a multirate filter bank, the band-pass filters\n     operate with resampled versions of the input signal, e.g. to keep the length\n     of a filter constant while shifting its center frequency.\n\n     This implementation uses `scipy.signal.iirdesign` to design the filters.\n\n\n    Parameters\n    ----------\n    center_freqs : np.ndarray [shape=(n,), dtype=float]\n        Center frequencies of the filter kernels.\n        Also defines the number of filters in the filterbank.\n\n    sample_rates : np.ndarray [shape=(n,), dtype=float]\n        Samplerate for each filter (used for multirate filterbank).\n\n    Q : float\n        Q factor (influences the filter bandwith).\n\n    passband_ripple : float\n        The maximum loss in the passband (dB)\n        See `scipy.signal.iirdesign` for details.\n\n    stopband_attenuation : float\n        The minimum attenuation in the stopband (dB)\n        See `scipy.signal.iirdesign` for details.\n\n    ftype : str\n        The type of IIR filter to design\n        See `scipy.signal.iirdesign` for details.\n\n    flayout : string\n        Valid `output` argument for `scipy.signal.iirdesign`.\n        - If `ba`, returns numerators/denominators of the transfer functions,\n          used for filtering with `scipy.signal.filtfilt`.\n          Can be unstable for high-order filters.\n        - If `sos`, returns a series of second-order filters,\n          used for filtering with `scipy.signal.sosfiltfilt`.\n          Minimizes numerical precision errors for high-order filters, but is slower.\n        - If `zpk`, returns zeros, poles, and system gains of the transfer functions.\n\n    Returns\n    -------\n    filterbank : list [shape=(n,), dtype=float]\n        Each list entry comprises the filter coefficients for a single filter.\n\n    sample_rates : np.ndarray [shape=(n,), dtype=float]\n        Samplerate for each filter.\n\n    Notes\n    -----\n    This function caches at level 10.\n\n    See Also\n    --------\n    scipy.signal.iirdesign\n\n    Raises\n    ------\n    ParameterError\n        If `center_freqs` is `None`.\n        If `sample_rates` is `None`.\n        If `center_freqs.shape` does not match `sample_rates.shape`.\n    '''\n\n    if arg_0 is None:\n        raise ParameterError('center_freqs must be provided.')\n\n    if arg_1 is None:\n        raise ParameterError('sample_rates must be provided.')\n\n    if arg_0.shape != arg_1.shape:\n        raise ParameterError('Number of provided center_freqs and sample_rates must be equal.')\n\n    arg_7 = 0.5 * arg_1\n    arg_8 = arg_0 / float(arg_2)\n\n    arg_9 = []\n\n    for arg_10, arg_11, arg_12 in zip(arg_0, arg_7, arg_8):\n        arg_13 = [arg_10 - 0.5 * arg_12, arg_10 + 0.5 * arg_12] / arg_11\n        arg_14 = [arg_10 - arg_12, arg_10 + arg_12] / arg_11\n\n        arg_15 = scipy.signal.iirdesign(arg_13, arg_14,\n                                            arg_3, arg_4,\n                                            analog=False, arg_5=arg_5, output=arg_6)\n\n        arg_9.append(arg_15)\n\n    return arg_9, arg_1", "path": "librosa/filters.py", "identifier": "_multirate_fb", "docstring": "r'''Helper function to construct a multirate filterbank.\n\n     A filter bank consists of multiple band-pass filters which divide the input signal\n     into subbands. In the case of a multirate filter bank, the band-pass filters\n     operate with resampled versions of the input signal, e.g. to keep the length\n     of a filter constant while shifting its center frequency.\n\n     This implementation uses `scipy.signal.iirdesign` to design the filters.\n\n\n    Parameters\n    ----------\n    center_freqs : np.ndarray [shape=(n,), dtype=float]\n        Center frequencies of the filter kernels.\n        Also defines the number of filters in the filterbank.\n\n    sample_rates : np.ndarray [shape=(n,), dtype=float]\n        Samplerate for each filter (used for multirate filterbank).\n\n    Q : float\n        Q factor (influences the filter bandwith).\n\n    passband_ripple : float\n        The maximum loss in the passband (dB)\n        See `scipy.signal.iirdesign` for details.\n\n    stopband_attenuation : float\n        The minimum attenuation in the stopband (dB)\n        See `scipy.signal.iirdesign` for details.\n\n    ftype : str\n        The type of IIR filter to design\n        See `scipy.signal.iirdesign` for details.\n\n    flayout : string\n        Valid `output` argument for `scipy.signal.iirdesign`.\n        - If `ba`, returns numerators/denominators of the transfer functions,\n          used for filtering with `scipy.signal.filtfilt`.\n          Can be unstable for high-order filters.\n        - If `sos`, returns a series of second-order filters,\n          used for filtering with `scipy.signal.sosfiltfilt`.\n          Minimizes numerical precision errors for high-order filters, but is slower.\n        - If `zpk`, returns zeros, poles, and system gains of the transfer functions.\n\n    Returns\n    -------\n    filterbank : list [shape=(n,), dtype=float]\n        Each list entry comprises the filter coefficients for a single filter.\n\n    sample_rates : np.ndarray [shape=(n,), dtype=float]\n        Samplerate for each filter.\n\n    Notes\n    -----\n    This function caches at level 10.\n\n    See Also\n    --------\n    scipy.signal.iirdesign\n\n    Raises\n    ------\n    ParameterError\n        If `center_freqs` is `None`.\n        If `sample_rates` is `None`.\n        If `center_freqs.shape` does not match `sample_rates.shape`.", "docstring_tokens": ["r", "Helper", "function", "to", "construct", "a", "multirate", "filterbank", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 252231}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/inversion/util/regularization_util.py#L97-L127", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "From the pixel-neighbors, setup the regularization matrix using the weighted regularization scheme.", "language": "python", "parameters": "(regularization_weights, pixel_neighbors,\n                                                        pixel_neighbors_size)", "return_statement": "return regularization_matrix", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "len", "(", "arg_0", ")", "arg_4", "=", "np", ".", "zeros", "(", "shape", "=", "(", "arg_3", ",", "arg_3", ")", ")", "arg_5", "=", "arg_0", "**", "2.0", "for", "arg_6", "in", "range", "(", "arg_3", ")", ":", "for", "arg_7", "in", "range", "(", "arg_2", "[", "arg_6", "]", ")", ":", "arg_8", "=", "arg_1", "[", "arg_6", ",", "arg_7", "]", "arg_4", "[", "arg_6", ",", "arg_6", "]", "+=", "arg_5", "[", "arg_8", "]", "arg_4", "[", "arg_8", ",", "arg_8", "]", "+=", "arg_5", "[", "arg_8", "]", "arg_4", "[", "arg_6", ",", "arg_8", "]", "-=", "arg_5", "[", "arg_8", "]", "arg_4", "[", "arg_8", ",", "arg_6", "]", "-=", "arg_5", "[", "arg_8", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1,\n                                                        arg_2):\n    \"\"\"From the pixel-neighbors, setup the regularization matrix using the weighted regularization scheme.\n\n    Parameters\n    ----------\n    regularization_weights : ndarray\n        The regularization_ weight of each pixel, which governs how much smoothing is applied to that individual pixel.\n    pixel_neighbors : ndarray\n        An array of length (total_pixels) which provides the index of all neighbors of every pixel in \\\n        the Voronoi grid (entries of -1 correspond to no neighbor).\n    pixel_neighbors_size : ndarrayy\n        An array of length (total_pixels) which gives the number of neighbors of every pixel in the \\\n        Voronoi grid.\n    \"\"\"\n\n    arg_3 = len(arg_0)\n\n    arg_4 = np.zeros(shape=(arg_3, arg_3))\n\n    arg_5 = arg_0 ** 2.0\n\n    for arg_6 in range(arg_3):\n        for arg_7 in range(arg_2[arg_6]):\n            arg_8 = arg_1[arg_6, arg_7]\n            arg_4[arg_6, arg_6] += arg_5[arg_8]\n            arg_4[arg_8, arg_8] += arg_5[arg_8]\n            arg_4[arg_6, arg_8] -= arg_5[arg_8]\n            arg_4[arg_8, arg_6] -= arg_5[arg_8]\n\n    return arg_4", "path": "autolens/model/inversion/util/regularization_util.py", "identifier": "weighted_regularization_matrix_from_pixel_neighbors", "docstring": "From the pixel-neighbors, setup the regularization matrix using the weighted regularization scheme.\n\n    Parameters\n    ----------\n    regularization_weights : ndarray\n        The regularization_ weight of each pixel, which governs how much smoothing is applied to that individual pixel.\n    pixel_neighbors : ndarray\n        An array of length (total_pixels) which provides the index of all neighbors of every pixel in \\\n        the Voronoi grid (entries of -1 correspond to no neighbor).\n    pixel_neighbors_size : ndarrayy\n        An array of length (total_pixels) which gives the number of neighbors of every pixel in the \\\n        Voronoi grid.", "docstring_tokens": ["From", "the", "pixel", "-", "neighbors", "setup", "the", "regularization", "matrix", "using", "the", "weighted", "regularization", "scheme", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 252232}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L495-L509", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Add `dag` at the end of `self`, using `edge_map`.", "language": "python", "parameters": "(self, dag, edge_map=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "{", "}", "for", "arg_3", "in", "arg_1", ".", "qregs", ".", "values", "(", ")", ":", "if", "arg_3", ".", "name", "not", "in", "arg_0", ".", "qregs", ":", "arg_0", ".", "add_qreg", "(", "QuantumRegister", "(", "arg_3", ".", "size", ",", "arg_3", ".", "name", ")", ")", "arg_2", ".", "update", "(", "[", "(", "arg_4", ",", "arg_4", ")", "for", "arg_4", "in", "arg_3", "if", "arg_4", "not", "in", "arg_2", "]", ")", "for", "arg_5", "in", "arg_1", ".", "cregs", ".", "values", "(", ")", ":", "if", "arg_5", ".", "name", "not", "in", "arg_0", ".", "cregs", ":", "arg_0", ".", "add_creg", "(", "ClassicalRegister", "(", "arg_5", ".", "size", ",", "arg_5", ".", "name", ")", ")", "arg_2", ".", "update", "(", "[", "(", "arg_6", ",", "arg_6", ")", "for", "arg_6", "in", "arg_5", "if", "arg_6", "not", "in", "arg_2", "]", ")", "arg_0", ".", "compose_back", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Add `dag` at the end of `self`, using `edge_map`.\n        \"\"\"\n        arg_2 = arg_2 or {}\n        for arg_3 in arg_1.qregs.values():\n            if arg_3.name not in arg_0.qregs:\n                arg_0.add_qreg(QuantumRegister(arg_3.size, arg_3.name))\n            arg_2.update([(arg_4, arg_4) for arg_4 in arg_3 if arg_4 not in arg_2])\n\n        for arg_5 in arg_1.cregs.values():\n            if arg_5.name not in arg_0.cregs:\n                arg_0.add_creg(ClassicalRegister(arg_5.size, arg_5.name))\n            arg_2.update([(arg_6, arg_6) for arg_6 in arg_5 if arg_6 not in arg_2])\n\n        arg_0.compose_back(arg_1, arg_2)", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.extend_back", "docstring": "Add `dag` at the end of `self`, using `edge_map`.", "docstring_tokens": ["Add", "dag", "at", "the", "end", "of", "self", "using", "edge_map", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252233}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2134-L2189", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns items handled by the result.", "language": "python", "parameters": "(self, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "if", "len", "(", "arg_0", ".", "_data", ")", "==", "1", ":", "return", "list", "(", "arg_0", ".", "_data", ".", "values", "(", ")", ")", "[", "0", "]", "elif", "len", "(", "arg_0", ".", "_data", ")", ">", "1", ":", "raise", "ValueError", "(", "'Your result `%s` contains more than one entry: '", "'`%s` Please use >>Func<< with one of these.'", "%", "(", "arg_0", ".", "v_full_name", ",", "str", "(", "list", "(", "arg_0", ".", "_data", ".", "keys", "(", ")", ")", ")", ")", ")", "else", ":", "raise", "AttributeError", "(", "'Your result `%s` is empty, cannot access data.'", "%", "arg_0", ".", "v_full_name", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_3", "=", "arg_0", ".", "f_translate_key", "(", "arg_3", ")", "if", "not", "arg_3", "in", "arg_0", ".", "_data", ":", "if", "arg_3", "==", "'data'", "and", "len", "(", "arg_0", ".", "_data", ")", "==", "1", ":", "return", "arg_0", ".", "_data", "[", "list", "(", "arg_0", ".", "_data", ".", "keys", "(", ")", ")", "[", "0", "]", "]", "else", ":", "raise", "AttributeError", "(", "'`%s` is not part of your result `%s`.'", "%", "(", "arg_3", ",", "arg_0", ".", "v_full_name", ")", ")", "arg_2", ".", "append", "(", "arg_0", ".", "_data", "[", "arg_3", "]", ")", "if", "len", "(", "arg_1", ")", "==", "1", ":", "return", "arg_2", "[", "0", "]", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Returns items handled by the result.\n\n         If only a single name is given, a single data item is returned. If several names are\n         given, a list is returned. For integer inputs the result returns `resultname_X`.\n\n         If the result contains only a single entry you can call `Func()` without arguments.\n         If you call `Func()` and the result contains more than one element a ValueError is\n         thrown.\n\n         If the requested item(s) cannot be found an AttributeError is thrown.\n\n        :param args: strings-names or integers\n\n        :return: Single data item or tuple of data\n\n        Example:\n\n        >>> res = Result('supergroup.subgroup.myresult', comment='I am a neat example!' \\\n        [1000,2000], {'a':'b','c':333}, hitchhiker='Arthur Dent')\n        >>> res.Func('hitchhiker')\n        'Arthur Dent'\n        >>> res.Func(0)\n        [1000,2000]\n        >>> res.Func('hitchhiker', 'myresult')\n        ('Arthur Dent', [1000,2000])\n\n        \"\"\"\n\n        if len(arg_1) == 0:\n            if len(arg_0._data) == 1:\n                return list(arg_0._data.values())[0]\n            elif len(arg_0._data) > 1:\n                raise ValueError('Your result `%s` contains more than one entry: '\n                                 '`%s` Please use >>Func<< with one of these.' %\n                                 (arg_0.v_full_name, str(list(arg_0._data.keys()))))\n            else:\n                raise AttributeError('Your result `%s` is empty, cannot access data.' %\n                                     arg_0.v_full_name)\n\n        arg_2 = []\n        for arg_3 in arg_1:\n            arg_3 = arg_0.f_translate_key(arg_3)\n            if not arg_3 in arg_0._data:\n                if arg_3 == 'data' and len(arg_0._data) == 1:\n                    return arg_0._data[list(arg_0._data.keys())[0]]\n                else:\n                    raise AttributeError('`%s` is not part of your result `%s`.' %\n                                         (arg_3, arg_0.v_full_name))\n\n            arg_2.append(arg_0._data[arg_3])\n\n        if len(arg_1) == 1:\n            return arg_2[0]\n        else:\n            return arg_2", "path": "pypet/parameter.py", "identifier": "Result.f_get", "docstring": "Returns items handled by the result.\n\n         If only a single name is given, a single data item is returned. If several names are\n         given, a list is returned. For integer inputs the result returns `resultname_X`.\n\n         If the result contains only a single entry you can call `f_get()` without arguments.\n         If you call `f_get()` and the result contains more than one element a ValueError is\n         thrown.\n\n         If the requested item(s) cannot be found an AttributeError is thrown.\n\n        :param args: strings-names or integers\n\n        :return: Single data item or tuple of data\n\n        Example:\n\n        >>> res = Result('supergroup.subgroup.myresult', comment='I am a neat example!' \\\n        [1000,2000], {'a':'b','c':333}, hitchhiker='Arthur Dent')\n        >>> res.f_get('hitchhiker')\n        'Arthur Dent'\n        >>> res.f_get(0)\n        [1000,2000]\n        >>> res.f_get('hitchhiker', 'myresult')\n        ('Arthur Dent', [1000,2000])", "docstring_tokens": ["Returns", "items", "handled", "by", "the", "result", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252234}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/syncobj.py#L274-L281", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Correctly destroy SyncObj. Stop autoTickThread, close connections, etc.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "__conf", ".", "autoTick", ":", "arg_0", ".", "__Funcing", "=", "True", "else", ":", "arg_0", ".", "_doDestroy", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Correctly Func SyncObj. Stop autoTickThread, close connections, etc.\n        \"\"\"\n        if arg_0.__conf.autoTick:\n            arg_0.__Funcing = True\n        else:\n            arg_0._doDestroy()", "path": "pysyncobj/syncobj.py", "identifier": "SyncObj.destroy", "docstring": "Correctly destroy SyncObj. Stop autoTickThread, close connections, etc.", "docstring_tokens": ["Correctly", "destroy", "SyncObj", ".", "Stop", "autoTickThread", "close", "connections", "etc", "."], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 252235}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L742-L755", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Gets a value from the stack.", "language": "python", "parameters": "(cpu, size)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", "in", "(", "16", ",", "arg_0", ".", "address_bit_size", ")", "arg_2", ",", "arg_3", ",", "arg_3", "=", "arg_0", ".", "get_descriptor", "(", "arg_0", ".", "SS", ")", "arg_4", "=", "arg_0", ".", "STACK", "+", "arg_2", "arg_5", "=", "arg_0", ".", "read_int", "(", "arg_4", ",", "arg_1", ")", "arg_0", ".", "STACK", "=", "arg_0", ".", "STACK", "+", "arg_1", "//", "8", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Gets a value from the stack.\n\n        :rtype: int\n        :param size: the size of the value to consume from the stack.\n        :return: the value from the stack.\n        \"\"\"\n        assert arg_1 in (16, arg_0.address_bit_size)\n        arg_2, arg_3, arg_3 = arg_0.get_descriptor(arg_0.SS)\n        arg_4 = arg_0.STACK + arg_2\n        arg_5 = arg_0.read_int(arg_4, arg_1)\n        arg_0.STACK = arg_0.STACK + arg_1 // 8\n        return arg_5", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.pop", "docstring": "Gets a value from the stack.\n\n        :rtype: int\n        :param size: the size of the value to consume from the stack.\n        :return: the value from the stack.", "docstring_tokens": ["Gets", "a", "value", "from", "the", "stack", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252236}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/stdlib.py#L387-L398", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check that the mode argument of an open or file call is valid.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "utils", ".", "get_argument_from_call", "(", "arg_1", ",", "position", "=", "1", ",", "keyword", "=", "\"mode\"", ")", "except", "utils", ".", "NoSuchArgumentError", ":", "return", "if", "arg_2", ":", "arg_2", "=", "utils", ".", "safe_infer", "(", "arg_2", ")", "if", "isinstance", "(", "arg_2", ",", "astroid", ".", "Const", ")", "and", "not", "_check_mode_str", "(", "arg_2", ".", "value", ")", ":", "arg_0", ".", "add_message", "(", "\"bad-open-mode\"", ",", "arg_1", "=", "arg_1", ",", "args", "=", "arg_2", ".", "value", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check that the mode argument of an open or file call is valid.\"\"\"\n        try:\n            arg_2 = utils.get_argument_from_call(arg_1, position=1, keyword=\"mode\")\n        except utils.NoSuchArgumentError:\n            return\n        if arg_2:\n            arg_2 = utils.safe_infer(arg_2)\n            if isinstance(arg_2, astroid.Const) and not _check_mode_str(\n                arg_2.value\n            ):\n                arg_0.add_message(\"bad-open-mode\", arg_1=arg_1, args=arg_2.value)", "path": "pylint/checkers/stdlib.py", "identifier": "StdlibChecker._check_open_mode", "docstring": "Check that the mode argument of an open or file call is valid.", "docstring_tokens": ["Check", "that", "the", "mode", "argument", "of", "an", "open", "or", "file", "call", "is", "valid", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252237}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/stream_tools.py#L133-L146", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Read bytes from an iterator.", "language": "python", "parameters": "(self, size=None)", "return_statement": "return sized_chunk", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "while", "arg_1", "is", "None", "or", "len", "(", "arg_0", ".", "buffer", ")", "<", "arg_1", ":", "try", ":", "arg_0", ".", "buffer", "+=", "next", "(", "arg_0", ".", "data_stream", ")", "except", "StopIteration", ":", "break", "arg_2", "=", "arg_0", ".", "buffer", "[", ":", "arg_1", "]", "if", "arg_1", "is", "None", ":", "arg_0", ".", "buffer", "=", "\"\"", "else", ":", "arg_0", ".", "buffer", "=", "arg_0", ".", "buffer", "[", "arg_1", ":", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Read bytes from an iterator.\"\"\"\n        while arg_1 is None or len(arg_0.buffer) < arg_1:\n            try:\n                arg_0.buffer += next(arg_0.data_stream)\n            except StopIteration:\n                break\n\n        arg_2 = arg_0.buffer[:arg_1]\n        if arg_1 is None:\n            arg_0.buffer = \"\"\n        else:\n            arg_0.buffer = arg_0.buffer[arg_1:]\n        return arg_2", "path": "wsgidav/stream_tools.py", "identifier": "StreamingFile.read", "docstring": "Read bytes from an iterator.", "docstring_tokens": ["Read", "bytes", "from", "an", "iterator", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 252238}
{"url": "https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/rarfile.py#L173-L179", "sha": "b1ac46cbcf42f3d3c5c69ab971fe97369a4da617", "docstring_summary": "Open RAR archive file.", "language": "python", "parameters": "(self, archive)", "return_statement": "return handle", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "unrarlib", ".", "RAROpenArchiveEx", "(", "ctypes", ".", "byref", "(", "arg_1", ")", ")", "except", "unrarlib", ".", "UnrarException", ":", "raise", "BadRarFile", "(", "\"Invalid RAR file.\"", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Open RAR archive file.\"\"\"\n        try:\n            arg_2 = unrarlib.RAROpenArchiveEx(ctypes.byref(arg_1))\n        except unrarlib.UnrarException:\n            raise BadRarFile(\"Invalid RAR file.\")\n        return arg_2", "path": "unrar/rarfile.py", "identifier": "RarFile._open", "docstring": "Open RAR archive file.", "docstring_tokens": ["Open", "RAR", "archive", "file", "."], "nwo": "matiasb/python-unrar", "score": 0.34770217692582306, "idx": 252239}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1225-L1267", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Run a command with a non blocking call.", "language": "python", "parameters": "(self, cmd, cwd=None, env=None, encoding='utf-8')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'utf-8'", ")", ":", "arg_0", ".", "failed_message", "=", "None", "logger", ".", "debug", "(", "\"Running command %s (cwd: %s, env: %s)\"", ",", "' '", ".", "join", "(", "arg_1", ")", ",", "arg_2", ",", "str", "(", "arg_3", ")", ")", "try", ":", "arg_0", ".", "proc", "=", "subprocess", ".", "Popen", "(", "arg_1", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_7", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "_read_stderr", ",", "kwargs", "=", "{", "'encoding'", ":", "arg_4", "}", ",", "daemon", "=", "True", ")", "arg_7", ".", "start", "(", ")", "for", "arg_8", "in", "arg_0", ".", "proc", ".", "stdout", ":", "yield", "arg_8", ".", "decode", "(", "arg_4", ",", "errors", "=", "'surrogateescape'", ")", "arg_7", ".", "join", "(", ")", "arg_0", ".", "proc", ".", "communicate", "(", ")", "arg_0", ".", "proc", ".", "stdout", ".", "close", "(", ")", "arg_0", ".", "proc", ".", "stderr", ".", "close", "(", ")", "except", "OSError", "as", "e", ":", "arg_7", ".", "join", "(", ")", "raise", "RepositoryError", "(", "arg_9", "=", "str", "(", "e", ")", ")", "if", "arg_0", ".", "proc", ".", "returncode", "!=", "0", ":", "arg_9", "=", "\"git command - %s (return code: %d)\"", "%", "(", "arg_0", ".", "failed_message", ",", "arg_0", ".", "proc", ".", "returncode", ")", "raise", "RepositoryError", "(", "arg_9", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4='utf-8'):\n        \"\"\"Run a command with a non blocking call.\n\n        Execute `cmd` command with a non blocking call. The command will\n        be run in the directory set by `cwd`. Enviroment variables can be\n        set using the `env` dictionary. The output data is returned\n        as encoded bytes in an iterator. Each item will be a line of the\n        output.\n\n        :returns: an iterator with the output of the command as encoded bytes\n\n        :raises RepositoryError: when an error occurs running the command\n        \"\"\"\n        arg_0.failed_message = None\n\n        logger.debug(\"Running command %s (cwd: %s, env: %s)\",\n                     ' '.join(arg_1), arg_2, str(arg_3))\n\n        try:\n            arg_0.proc = subprocess.Popen(arg_1,\n                                         stdout=subprocess.PIPE,\n                                         stderr=subprocess.PIPE,\n                                         arg_2=arg_2,\n                                         arg_3=arg_3)\n            arg_7 = threading.Thread(target=arg_0._read_stderr,\n                                          kwargs={'encoding': arg_4},\n                                          daemon=True)\n            arg_7.start()\n            for arg_8 in arg_0.proc.stdout:\n                yield arg_8.decode(arg_4, errors='surrogateescape')\n            arg_7.join()\n\n            arg_0.proc.communicate()\n            arg_0.proc.stdout.close()\n            arg_0.proc.stderr.close()\n        except OSError as e:\n            arg_7.join()\n            raise RepositoryError(arg_9=str(e))\n\n        if arg_0.proc.returncode != 0:\n            arg_9 = \"git command - %s (return code: %d)\" % \\\n                (arg_0.failed_message, arg_0.proc.returncode)\n            raise RepositoryError(arg_9=arg_9)", "path": "perceval/backends/core/git.py", "identifier": "GitRepository._exec_nb", "docstring": "Run a command with a non blocking call.\n\n        Execute `cmd` command with a non blocking call. The command will\n        be run in the directory set by `cwd`. Enviroment variables can be\n        set using the `env` dictionary. The output data is returned\n        as encoded bytes in an iterator. Each item will be a line of the\n        output.\n\n        :returns: an iterator with the output of the command as encoded bytes\n\n        :raises RepositoryError: when an error occurs running the command", "docstring_tokens": ["Run", "a", "command", "with", "a", "non", "blocking", "call", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 252240}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L1137-L1160", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "This returns a table object with all rows and cells correctly populated.", "language": "python", "parameters": "(table, meta_data)", "return_statement": "return table_el, visited_nodes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "etree", ".", "Element", "(", "'table'", ")", "arg_3", "=", "get_namespace", "(", "arg_0", ",", "'w'", ")", "arg_4", "=", "get_rowspan_data", "(", "arg_0", ")", "for", "arg_5", "in", "arg_0", ":", "if", "arg_5", ".", "tag", "==", "'%str'", "%", "arg_3", ":", "arg_6", "=", "build_tr", "(", "arg_5", ",", "arg_1", ",", "arg_4", ",", ")", "arg_2", ".", "append", "(", "arg_6", ")", "arg_7", "=", "list", "(", "arg_0", ".", "iter", "(", ")", ")", "return", "arg_2", ",", "arg_7"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This returns a table object with all rows and cells correctly populated.\n    \"\"\"\n\n    # Create a blank table element.\n    arg_2 = etree.Element('table')\n    arg_3 = get_namespace(arg_0, 'w')\n\n    # Get the rowspan values for cells that have a rowspan.\n    arg_4 = get_rowspan_data(arg_0)\n    for arg_5 in arg_0:\n        if arg_5.tag == '%str' % arg_3:\n            # Create the tr element.\n            arg_6 = build_tr(\n                arg_5,\n                arg_1,\n                arg_4,\n            )\n            # And append it to the table.\n            arg_2.append(arg_6)\n\n    arg_7 = list(arg_0.iter())\n    return arg_2, arg_7", "path": "docx2html/core.py", "identifier": "build_table", "docstring": "This returns a table object with all rows and cells correctly populated.", "docstring_tokens": ["This", "returns", "a", "table", "object", "with", "all", "rows", "and", "cells", "correctly", "populated", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 252241}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/typecheck.py#L548-L578", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Verify if the given call node has variadic nodes without context", "language": "python", "parameters": "(node, variadic_name, variadic_type, variadics)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "statement", "(", ")", "for", "arg_5", "in", "arg_4", ".", "nodes_of_class", "(", "astroid", ".", "Name", ")", ":", "if", "arg_5", ".", "name", "!=", "arg_1", ":", "continue", "arg_6", "=", "safe_infer", "(", "arg_5", ")", "if", "isinstance", "(", "arg_6", ",", "(", "astroid", ".", "List", ",", "astroid", ".", "Tuple", ")", ")", ":", "arg_7", "=", "len", "(", "arg_6", ".", "elts", ")", "elif", "isinstance", "(", "arg_6", ",", "astroid", ".", "Dict", ")", ":", "arg_7", "=", "len", "(", "arg_6", ".", "items", ")", "else", ":", "continue", "arg_8", "=", "arg_6", ".", "statement", "(", ")", "if", "not", "arg_7", "and", "isinstance", "(", "arg_8", ",", "astroid", ".", "FunctionDef", ")", ":", "arg_9", "=", "_has_parent_of_type", "(", "arg_0", ",", "arg_2", ",", "arg_4", ")", "arg_10", "=", "_is_name_used_as_variadic", "(", "arg_5", ",", "arg_3", ")", "if", "arg_9", "or", "arg_10", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Verify if the given call node has variadic nodes without context\n\n    This is a workaround for handling cases of nested call functions\n    which don't have the specific call context at hand.\n    Variadic arguments (variable positional arguments and variable\n    keyword arguments) are inferred, inherently wrong, by astroid\n    as a Tuple, respectively a Dict with empty elements.\n    This can lead pylint to believe that a function call receives\n    too few arguments.\n    \"\"\"\n    arg_4 = arg_0.statement()\n    for arg_5 in arg_4.nodes_of_class(astroid.Name):\n        if arg_5.name != arg_1:\n            continue\n\n        arg_6 = safe_infer(arg_5)\n        if isinstance(arg_6, (astroid.List, astroid.Tuple)):\n            arg_7 = len(arg_6.elts)\n        elif isinstance(arg_6, astroid.Dict):\n            arg_7 = len(arg_6.items)\n        else:\n            continue\n\n        arg_8 = arg_6.statement()\n        if not arg_7 and isinstance(arg_8, astroid.FunctionDef):\n            arg_9 = _has_parent_of_type(arg_0, arg_2, arg_4)\n            arg_10 = _is_name_used_as_variadic(arg_5, arg_3)\n            if arg_9 or arg_10:\n                return True\n    return False", "path": "pylint/checkers/typecheck.py", "identifier": "_no_context_variadic", "docstring": "Verify if the given call node has variadic nodes without context\n\n    This is a workaround for handling cases of nested call functions\n    which don't have the specific call context at hand.\n    Variadic arguments (variable positional arguments and variable\n    keyword arguments) are inferred, inherently wrong, by astroid\n    as a Tuple, respectively a Dict with empty elements.\n    This can lead pylint to believe that a function call receives\n    too few arguments.", "docstring_tokens": ["Verify", "if", "the", "given", "call", "node", "has", "variadic", "nodes", "without", "context"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252242}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L383-L387", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Disable abbreviations.", "language": "python", "parameters": "(self, opt)", "return_statement": "return opt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_long_opt", ":", "raise", "optparse", ".", "BadOptionError", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Disable abbreviations.\"\"\"\n        if arg_1 not in arg_0._long_opt:\n            raise optparse.BadOptionError(arg_1)\n        return arg_1", "path": "pylint/config.py", "identifier": "OptionParser._match_long_opt", "docstring": "Disable abbreviations.", "docstring_tokens": ["Disable", "abbreviations", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252243}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/__init__.py#L217-L335", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Create and run a bot, the arguments all correspond to sanitized\n    commandline options.", "language": "python", "parameters": "(src,\n        grammar=NODEBOX,\n        format=None,\n        outputfile=None,\n        iterations=1,\n        buff=None,\n        window=True,\n        title=None,\n        fullscreen=None,\n        close_window=False,\n        server=False,\n        port=7777,\n        show_vars=False,\n        vars=None,\n        namespace=None,\n        run_shell=False,\n        args=[],\n        verbose=False,\n        background_thread=True)", "return_statement": "return sbot", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "1", ",", "arg_6", "=", "None", ",", "arg_7", "=", "True", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "arg_11", "=", "False", ",", "arg_12", "=", "7777", ",", "arg_13", "=", "False", ",", "arg_14", "=", "None", ",", "arg_15", "=", "None", ",", "arg_16", "=", "False", ",", "arg_17", "=", "[", "]", ",", "arg_18", "=", "False", ",", "arg_19", "=", "True", ")", ":", "arg_20", ".", "argv", "=", "[", "arg_20", ".", "argv", "[", "0", "]", "]", "+", "arg_17", "arg_22", "=", "[", "arg_0", ",", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_11", ",", "arg_12", ",", "arg_13", "]", "arg_23", "=", "dict", "(", "arg_14", "=", "arg_14", ",", "arg_15", "=", "arg_15", ")", "arg_24", "=", "[", "arg_0", "]", "arg_25", "=", "dict", "(", "arg_5", "=", "arg_5", ",", "frame_limiter", "=", "arg_7", ",", "arg_18", "=", "arg_18", ",", "Func_forever", "=", "arg_7", "and", "not", "(", "arg_10", "or", "bool", "(", "arg_4", ")", ")", ",", ")", "if", "arg_19", ":", "arg_26", "=", "ShoebotThread", "(", "arg_22", "=", "arg_22", ",", "arg_23", "=", "arg_23", ",", "arg_24", "=", "arg_24", ",", "arg_25", "=", "arg_25", ",", "send_sigint", "=", "arg_16", ")", "arg_26", ".", "start", "(", ")", "arg_27", "=", "arg_26", ".", "sbot", "else", ":", "print", "(", "'background thread disabled'", ")", "if", "arg_16", ":", "raise", "ValueError", "(", "'UI Must Func in a separate thread to shell and shell needs main thread'", ")", "arg_26", "=", "None", "arg_27", "=", "create_bot", "(", "*", "arg_22", ",", "**", "arg_23", ")", "arg_27", ".", "Func", "(", "*", "arg_24", ",", "**", "arg_25", ")", "if", "arg_16", ":", "import", "shoebot", ".", "sbio", ".", "shell", "arg_28", "=", "shoebot", ".", "sbio", ".", "shell", ".", "ShoebotCmd", "(", "arg_27", ",", "trusted", "=", "True", ")", "try", ":", "arg_28", ".", "cmdloop", "(", ")", "except", "KeyboardInterrupt", "as", "e", ":", "publish_event", "(", "QUIT_EVENT", ")", "if", "arg_18", ":", "raise", "else", ":", "return", "elif", "arg_19", ":", "try", ":", "while", "arg_26", ".", "is_alive", "(", ")", ":", "sleep", "(", "1", ")", "except", "KeyboardInterrupt", ":", "publish_event", "(", "QUIT_EVENT", ")", "if", "all", "(", "(", "arg_19", ",", "arg_26", ")", ")", ":", "arg_26", ".", "join", "(", ")", "return", "arg_27"], "function": "def Func(arg_0,\n        arg_1=arg_2,\n        arg_3=None,\n        arg_4=None,\n        arg_5=1,\n        arg_6=None,\n        arg_7=True,\n        arg_8=None,\n        arg_9=None,\n        arg_10=False,\n        arg_11=False,\n        arg_12=7777,\n        arg_13=False,\n        arg_14=None,\n        arg_15=None,\n        arg_16=False,\n        arg_17=[],\n        arg_18=False,\n        arg_19=True):\n    \"\"\"\n    Create and Func a bot, the arguments all correspond to sanitized\n    commandline options.\n\n    :param background_thread: If True then use a background thread.\n\n\n    Other args are split into create_args and Func_args\n\n    See create_bot for details on create_args\n\n    Func_args are passed to bot.Func - see Nodebot.Func or Drawbot.Func\n\n\n\n    Background thread:\n\n    readline in python is blocking, Funcning the app in a background\n    thread opens up the main thread for IO on stdin/stdout, which\n    can be used for communication with shoebot when livecoding is\n    enabled.\n\n    See shoebot.io for implementation of the shell, and the gedit\n    plugin for an example of using livecoding.\n    \"\"\"\n    # Munge shoebogt sys.argv\n    arg_20.argv = [arg_20.argv[\n                    0]] + arg_17  # Remove shoebot parameters so sbot can be used in place of the python interpreter (e.g. for sphinx).\n\n    # arguments for create_bot\n    arg_22 = [arg_0,\n                   arg_1,\n                   arg_3,\n                   arg_4,\n                   arg_5,\n                   arg_6,\n                   arg_7,\n                   arg_8,\n                   arg_9,\n                   arg_11,\n                   arg_12,\n                   arg_13]\n    arg_23 = dict(arg_14=arg_14, arg_15=arg_15)\n    arg_24 = [arg_0]\n    arg_25 = dict(\n        arg_5=arg_5,\n        frame_limiter=arg_7,\n        arg_18=arg_18,\n        # Func forever except 1. windowed mode is off 2. if --close-window was specified and\n        # 3. if an output file was indicated\n        Func_forever=arg_7 and not (arg_10 or bool(arg_4)),\n    )\n\n    # Run shoebot in a background thread so we can Func a cmdline shell in the current thread\n    if arg_19:\n        arg_26 = ShoebotThread(\n            arg_22=arg_22,\n            arg_23=arg_23,\n            arg_24=arg_24,\n            arg_25=arg_25,\n            send_sigint=arg_16\n        )\n        arg_26.start()\n        arg_27 = arg_26.sbot\n    else:\n        print('background thread disabled')\n        # This is a debug option, things should always work using the\n        # background thread (crosses fingers)\n        if arg_16:\n            # python readline is blocking, so ui must Func in a seperate\n            # thread\n            raise ValueError('UI Must Func in a separate thread to shell and shell needs main thread')\n\n        arg_26 = None\n        arg_27 = create_bot(*arg_22, **arg_23)\n        arg_27.Func(*arg_24, **arg_25)\n\n    if arg_16:\n        import shoebot.sbio.shell\n        arg_28 = shoebot.sbio.shell.ShoebotCmd(arg_27, trusted=True)\n        try:\n            arg_28.cmdloop()\n        except KeyboardInterrupt as e:\n            publish_event(QUIT_EVENT)  # Handle Ctrl-C\n            # KeyboardInterrupt is generated by os.kill from the other thread\n            if arg_18:\n                raise\n            else:\n                return\n    elif arg_19:\n        try:\n            while arg_26.is_alive():\n                sleep(1)\n        except KeyboardInterrupt:\n            publish_event(QUIT_EVENT)\n\n    if all((arg_19, arg_26)):\n        arg_26.join()\n\n    return arg_27", "path": "shoebot/__init__.py", "identifier": "run", "docstring": "Create and run a bot, the arguments all correspond to sanitized\n    commandline options.\n\n    :param background_thread: If True then use a background thread.\n\n\n    Other args are split into create_args and run_args\n\n    See create_bot for details on create_args\n\n    run_args are passed to bot.run - see Nodebot.run or Drawbot.run\n\n\n\n    Background thread:\n\n    readline in python is blocking, running the app in a background\n    thread opens up the main thread for IO on stdin/stdout, which\n    can be used for communication with shoebot when livecoding is\n    enabled.\n\n    See shoebot.io for implementation of the shell, and the gedit\n    plugin for an example of using livecoding.", "docstring_tokens": ["Create", "and", "run", "a", "bot", "the", "arguments", "all", "correspond", "to", "sanitized", "commandline", "options", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252244}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L1737-L1745", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "List all the check groups that pylint knows about", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "linter", ".", "get_checker_names", "(", ")", ":", "print", "(", "arg_3", ")", "sys", ".", "exit", "(", "0", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"List all the check groups that pylint knows about\n\n        These should be useful to know what check groups someone can disable\n        or enable.\n        \"\"\"\n        for arg_3 in arg_0.linter.get_checker_names():\n            print(arg_3)\n        sys.exit(0)", "path": "pylint/lint.py", "identifier": "Run.cb_list_groups", "docstring": "List all the check groups that pylint knows about\n\n        These should be useful to know what check groups someone can disable\n        or enable.", "docstring_tokens": ["List", "all", "the", "check", "groups", "that", "pylint", "knows", "about"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252245}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L190-L194", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Return a Domain by its domain_name", "language": "python", "parameters": "(self, domain_name)", "return_statement": "return Domain.get_object(api_token=self.token, domain_name=domain_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Domain", ".", "get_object", "(", "api_token", "=", "arg_0", ".", "token", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Return a Domain by its domain_name\n        \"\"\"\n        return Domain.get_object(api_token=arg_0.token, arg_1=arg_1)", "path": "digitalocean/Manager.py", "identifier": "Manager.get_domain", "docstring": "Return a Domain by its domain_name", "docstring_tokens": ["Return", "a", "Domain", "by", "its", "domain_name"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 252246}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/copy_reg.py#L175-L185", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Unregister an extension code.  For testing only.", "language": "python", "parameters": "(module, name, code)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "(", "arg_0", ",", "arg_1", ")", "if", "(", "_extension_registry", ".", "get", "(", "arg_3", ")", "!=", "arg_2", "or", "_inverted_registry", ".", "get", "(", "arg_2", ")", "!=", "arg_3", ")", ":", "raise", "ValueError", "(", "\"key %s is not registered with code %s\"", "%", "(", "arg_3", ",", "arg_2", ")", ")", "del", "_extension_registry", "[", "arg_3", "]", "del", "_inverted_registry", "[", "arg_2", "]", "if", "arg_2", "in", "_extension_cache", ":", "del", "_extension_cache", "[", "arg_2", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Unregister an extension code.  For testing only.\"\"\"\n    arg_3 = (arg_0, arg_1)\n    if (_extension_registry.get(arg_3) != arg_2 or\n        _inverted_registry.get(arg_2) != arg_3):\n        raise ValueError(\"key %s is not registered with code %s\" %\n                         (arg_3, arg_2))\n    del _extension_registry[arg_3]\n    del _inverted_registry[arg_2]\n    if arg_2 in _extension_cache:\n        del _extension_cache[arg_2]", "path": "third_party/stdlib/copy_reg.py", "identifier": "remove_extension", "docstring": "Unregister an extension code.  For testing only.", "docstring_tokens": ["Unregister", "an", "extension", "code", ".", "For", "testing", "only", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 252247}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L914-L930", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "Move a stepper motor for the number of steps at the specified speed", "language": "python", "parameters": "(self, motor_speed, number_of_steps)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ">", "0", ":", "arg_3", "=", "1", "else", ":", "arg_3", "=", "0", "arg_4", "=", "abs", "(", "arg_2", ")", "arg_5", "=", "[", "arg_0", ".", "STEPPER_STEP", ",", "arg_1", "&", "0x7f", ",", "(", "arg_1", ">>", "7", ")", "&", "0x7f", ",", "(", "arg_1", ">>", "14", ")", "&", "0x7f", ",", "arg_4", "&", "0x7f", ",", "(", "arg_4", ">>", "7", ")", "&", "0x7f", ",", "arg_3", "]", "arg_0", ".", "_command_handler", ".", "send_sysex", "(", "arg_0", ".", "_command_handler", ".", "STEPPER_DATA", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Move a stepper motor for the number of steps at the specified speed\n\n        :param motor_speed: 21 bits of data to set motor speed\n\n        :param number_of_steps: 14 bits for number of steps & direction\n                                positive is forward, negative is reverse\n        \"\"\"\n        if arg_2 > 0:\n            arg_3 = 1\n        else:\n            arg_3 = 0\n        arg_4 = abs(arg_2)\n        arg_5 = [arg_0.STEPPER_STEP, arg_1 & 0x7f, (arg_1 >> 7) & 0x7f, (arg_1 >> 14) & 0x7f,\n                arg_4 & 0x7f, (arg_4 >> 7) & 0x7f, arg_3]\n        arg_0._command_handler.send_sysex(arg_0._command_handler.STEPPER_DATA, arg_5)", "path": "PyMata/pymata.py", "identifier": "PyMata.stepper_step", "docstring": "Move a stepper motor for the number of steps at the specified speed\n\n        :param motor_speed: 21 bits of data to set motor speed\n\n        :param number_of_steps: 14 bits for number of steps & direction\n                                positive is forward, negative is reverse", "docstring_tokens": ["Move", "a", "stepper", "motor", "for", "the", "number", "of", "steps", "at", "the", "specified", "speed"], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 252248}
{"url": "https://github.com/what-studio/tossi/blob/88bc8523c05fe7b7e23518ee0398ee0a18ba0bc0/tossi/hangul.py#L43-L59", "sha": "88bc8523c05fe7b7e23518ee0398ee0a18ba0bc0", "docstring_summary": "Joins a Hangul letter from Korean phonemes.", "language": "python", "parameters": "(*args)", "return_statement": "return unichr(FIRST_HANGUL_OFFSET + offset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", "==", "1", ":", "arg_0", "=", "arg_0", "[", "0", "]", "if", "len", "(", "arg_0", ")", "==", "2", ":", "arg_0", "+=", "(", "CODAS", "[", "0", "]", ",", ")", "try", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "except", "ValueError", ":", "raise", "TypeError", "(", "'Func() takes at most 3 arguments'", ")", "arg_4", "=", "(", "(", "ONSETS", ".", "index", "(", "arg_1", ")", "*", "NUM_NUCLEUSES", "+", "NUCLEUSES", ".", "index", "(", "arg_2", ")", ")", "*", "NUM_CODAS", "+", "CODAS", ".", "index", "(", "arg_3", ")", ")", "return", "unichr", "(", "FIRST_HANGUL_OFFSET", "+", "arg_4", ")"], "function": "def Func(*arg_0):\n    \"\"\"Joins a Hangul letter from Korean phonemes.\"\"\"\n    # Normalize arguments as onset, nucleus, coda.\n    if len(arg_0) == 1:\n        # tuple of (onset, nucleus[, coda])\n        arg_0 = arg_0[0]\n    if len(arg_0) == 2:\n        arg_0 += (CODAS[0],)\n    try:\n        arg_1, arg_2, arg_3 = arg_0\n    except ValueError:\n        raise TypeError('Func() takes at most 3 arguments')\n    arg_4 = (\n        (ONSETS.index(arg_1) * NUM_NUCLEUSES + NUCLEUSES.index(arg_2)) *\n        NUM_CODAS + CODAS.index(arg_3)\n    )\n    return unichr(FIRST_HANGUL_OFFSET + arg_4)", "path": "tossi/hangul.py", "identifier": "join_phonemes", "docstring": "Joins a Hangul letter from Korean phonemes.", "docstring_tokens": ["Joins", "a", "Hangul", "letter", "from", "Korean", "phonemes", "."], "nwo": "what-studio/tossi", "score": 0.28433842921098695, "idx": 252249}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/nelder_mead.py#L343-L456", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "A single iteration of the Nelder Mead algorithm.", "language": "python", "parameters": "(current_simplex,\n                         current_objective_values,\n                         objective_function=None,\n                         dim=None,\n                         func_tolerance=None,\n                         position_tolerance=None,\n                         batch_evaluate_objective=False,\n                         reflection=None,\n                         expansion=None,\n                         contraction=None,\n                         shrinkage=None,\n                         name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_11", ",", "'Func'", ")", ":", "arg_12", "=", "arg_0", ".", "dtype", ".", "base_dtype", "arg_13", "=", "tf", ".", "argsort", "(", "arg_1", ",", "direction", "=", "'ASCENDING'", ",", "stable", "=", "True", ")", "(", "arg_14", ",", "arg_15", ",", "arg_16", ")", "=", "arg_13", "[", "0", "]", ",", "arg_13", "[", "-", "1", "]", ",", "arg_13", "[", "-", "2", "]", "arg_17", "=", "arg_0", "[", "arg_15", "]", "(", "arg_18", ",", "arg_19", ",", "arg_20", ")", "=", "(", "arg_1", "[", "arg_14", "]", ",", "arg_1", "[", "arg_15", "]", ",", "arg_1", "[", "arg_16", "]", ")", "arg_21", "=", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "arg_0", ",", "axis", "=", "0", ")", "-", "arg_17", "arg_21", "/=", "tf", ".", "cast", "(", "arg_3", ",", "arg_12", ")", "arg_22", "=", "arg_21", "+", "arg_7", "*", "(", "arg_21", "-", "arg_17", ")", "arg_23", "=", "arg_2", "(", "arg_22", ")", "arg_24", "=", "1", "arg_25", "=", "_check_convergence", "(", "arg_0", ",", "arg_0", "[", "arg_14", "]", ",", "arg_18", ",", "arg_19", ",", "arg_4", ",", "arg_5", ")", "def", "_converged_fn", "(", ")", ":", "return", "(", "True", ",", "arg_0", ",", "arg_1", ",", "0", ")", "arg_26", "=", "arg_25", ",", "_converged_fn", "arg_27", "=", "(", "(", "arg_23", "<", "arg_20", ")", "&", "(", "arg_23", ">=", "arg_18", ")", ")", "arg_28", "=", "_accept_reflected_fn", "(", "arg_0", ",", "arg_1", ",", "arg_15", ",", "arg_22", ",", "arg_23", ")", "arg_29", "=", "arg_27", ",", "arg_28", "arg_30", "=", "arg_23", "<", "arg_18", "arg_31", "=", "_expansion_fn", "(", "arg_2", ",", "arg_0", ",", "arg_1", ",", "arg_15", ",", "arg_22", ",", "arg_23", ",", "arg_21", ",", "arg_8", ")", "arg_32", "=", "arg_30", ",", "arg_31", "arg_33", "=", "(", "(", "arg_23", "<", "arg_19", ")", "&", "(", "arg_23", ">=", "arg_20", ")", ")", "arg_34", "=", "_outside_contraction_fn", "(", "arg_2", ",", "arg_0", ",", "arg_1", ",", "arg_21", ",", "arg_14", ",", "arg_15", ",", "arg_22", ",", "arg_23", ",", "arg_9", ",", "arg_10", ",", "arg_6", ")", "arg_35", "=", "arg_33", ",", "arg_34", "arg_36", "=", "_inside_contraction_fn", "(", "arg_2", ",", "arg_0", ",", "arg_1", ",", "arg_21", ",", "arg_14", ",", "arg_15", ",", "arg_19", ",", "arg_9", ",", "arg_10", ",", "arg_6", ")", "(", "arg_37", ",", "arg_38", ",", "arg_39", ",", "arg_40", ")", "=", "prefer_static", ".", "case", "(", "[", "arg_26", ",", "arg_29", ",", "arg_32", ",", "arg_35", "]", ",", "default", "=", "arg_36", ",", "exclusive", "=", "False", ")", "arg_38", ".", "set_shape", "(", "arg_0", ".", "shape", ")", "arg_39", ".", "set_shape", "(", "arg_1", ".", "shape", ")", "return", "(", "arg_37", ",", "arg_38", ",", "arg_39", ",", "arg_24", "+", "arg_40", ")"], "function": "def Func(arg_0,\n                         arg_1,\n                         arg_2=None,\n                         arg_3=None,\n                         arg_4=None,\n                         arg_5=None,\n                         arg_6=False,\n                         arg_7=None,\n                         arg_8=None,\n                         arg_9=None,\n                         arg_10=None,\n                         arg_11=None):\n  \"\"\"A single iteration of the Nelder Mead algorithm.\"\"\"\n  with tf.compat.v1.name_scope(arg_11, 'Func'):\n    arg_12 = arg_0.dtype.base_dtype\n    arg_13 = tf.argsort(\n        arg_1, direction='ASCENDING', stable=True)\n    (\n        arg_14,\n        arg_15,\n        arg_16\n    ) = arg_13[0], arg_13[-1], arg_13[-2]\n\n    arg_17 = arg_0[arg_15]\n\n    (\n        arg_18,\n        arg_19,\n        arg_20\n    ) = (\n        arg_1[arg_14],\n        arg_1[arg_15],\n        arg_1[arg_16]\n    )\n\n    # Compute the centroid of the face opposite the worst vertex.\n    arg_21 = tf.reduce_sum(\n        input_tensor=arg_0, axis=0) - arg_17\n    arg_21 /= tf.cast(arg_3, arg_12)\n\n    # Reflect the worst vertex through the opposite face.\n    arg_22 = arg_21 + arg_7 * (arg_21 - arg_17)\n    arg_23 = arg_2(arg_22)\n\n    arg_24 = 1\n    arg_25 = _check_convergence(arg_0,\n                                       arg_0[arg_14],\n                                       arg_18,\n                                       arg_19,\n                                       arg_4,\n                                       arg_5)\n    def _converged_fn():\n      return (True, arg_0, arg_1, 0)\n    arg_26 = arg_25, _converged_fn\n    arg_27 = (\n        (arg_23 < arg_20) &\n        (arg_23 >= arg_18))\n    arg_28 = _accept_reflected_fn(arg_0,\n                                               arg_1,\n                                               arg_15,\n                                               arg_22,\n                                               arg_23)\n    arg_29 = arg_27, arg_28\n    arg_30 = arg_23 < arg_18\n    arg_31 = _expansion_fn(arg_2,\n                                 arg_0,\n                                 arg_1,\n                                 arg_15,\n                                 arg_22,\n                                 arg_23,\n                                 arg_21,\n                                 arg_8)\n    arg_32 = arg_30, arg_31\n    arg_33 = (\n        (arg_23 < arg_19) &\n        (arg_23 >= arg_20)\n    )\n    arg_34 = _outside_contraction_fn(\n        arg_2,\n        arg_0,\n        arg_1,\n        arg_21,\n        arg_14,\n        arg_15,\n        arg_22,\n        arg_23,\n        arg_9,\n        arg_10,\n        arg_6)\n    arg_35 = arg_33, arg_34\n    arg_36 = _inside_contraction_fn(arg_2,\n                                        arg_0,\n                                        arg_1,\n                                        arg_21,\n                                        arg_14,\n                                        arg_15,\n                                        arg_19,\n                                        arg_9,\n                                        arg_10,\n                                        arg_6)\n    (\n        arg_37,\n        arg_38,\n        arg_39,\n        arg_40) = prefer_static.case([arg_26, arg_29, arg_32, arg_35],\n                                         default=arg_36, exclusive=False)\n    arg_38.set_shape(arg_0.shape)\n    arg_39.set_shape(arg_1.shape)\n    return (\n        arg_37,\n        arg_38,\n        arg_39,\n        arg_24 + arg_40\n    )", "path": "tensorflow_probability/python/optimizer/nelder_mead.py", "identifier": "nelder_mead_one_step", "docstring": "A single iteration of the Nelder Mead algorithm.", "docstring_tokens": ["A", "single", "iteration", "of", "the", "Nelder", "Mead", "algorithm", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252250}
{"url": "https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L643-L650", "sha": "3769aecbef6c83b6cd93ee72ece478ffe433ac57", "docstring_summary": "Returns the unique SHA1 hexdigest of the chart URL param parts", "language": "python", "parameters": "(self)", "return_statement": "return new_sha(''.join(sorted(self._parts()))).hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "render", "(", ")", "return", "new_sha", "(", "''", ".", "join", "(", "sorted", "(", "arg_0", ".", "_parts", "(", ")", ")", ")", ")", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the unique SHA1 hexdigest of the chart URL param parts\n\n        good for unittesting...\n        \"\"\"\n        arg_0.render()\n        return new_sha(''.join(sorted(arg_0._parts()))).hexdigest()", "path": "GChartWrapper/GChart.py", "identifier": "GChart.checksum", "docstring": "Returns the unique SHA1 hexdigest of the chart URL param parts\n\n        good for unittesting...", "docstring_tokens": ["Returns", "the", "unique", "SHA1", "hexdigest", "of", "the", "chart", "URL", "param", "parts"], "nwo": "appknox/google-chartwrapper", "score": 0.12050106452410352, "idx": 252251}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/scene/camera.py#L180-L209", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Set the rotation state of the camera", "language": "python", "parameters": "(self, x, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "last_x", "is", "None", ":", "arg_0", ".", "last_x", "=", "arg_1", "if", "arg_0", ".", "last_y", "is", "None", ":", "arg_0", ".", "last_y", "=", "arg_2", "arg_5", "=", "arg_0", ".", "last_x", "-", "arg_1", "arg_6", "=", "arg_0", ".", "last_y", "-", "arg_2", "arg_0", ".", "last_x", "=", "arg_1", "arg_0", ".", "last_y", "=", "arg_2", "arg_5", "*=", "arg_0", ".", "mouse_sensitivity", "arg_6", "*=", "arg_0", ".", "mouse_sensitivity", "arg_0", ".", "yaw", "-=", "arg_5", "arg_0", ".", "pitch", "+=", "arg_6", "if", "arg_0", ".", "pitch", ">", "85.0", ":", "arg_0", ".", "pitch", "=", "85.0", "if", "arg_0", ".", "pitch", "<", "-", "85.0", ":", "arg_0", ".", "pitch", "=", "-", "85.0", "arg_0", ".", "_update_yaw_and_pitch", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set the rotation state of the camera\n\n        :param x: viewport x pos\n        :param y: viewport y pos\n        \"\"\"\n        if arg_0.last_x is None:\n            arg_0.last_x = arg_1\n        if arg_0.last_y is None:\n            arg_0.last_y = arg_2\n\n        arg_5 = arg_0.last_x - arg_1\n        arg_6 = arg_0.last_y - arg_2\n\n        arg_0.last_x = arg_1\n        arg_0.last_y = arg_2\n\n        arg_5 *= arg_0.mouse_sensitivity\n        arg_6 *= arg_0.mouse_sensitivity\n\n        arg_0.yaw -= arg_5\n        arg_0.pitch += arg_6\n\n        if arg_0.pitch > 85.0:\n            arg_0.pitch = 85.0\n        if arg_0.pitch < -85.0:\n            arg_0.pitch = -85.0\n\n        arg_0._update_yaw_and_pitch()", "path": "demosys/scene/camera.py", "identifier": "SystemCamera.rot_state", "docstring": "Set the rotation state of the camera\n\n        :param x: viewport x pos\n        :param y: viewport y pos", "docstring_tokens": ["Set", "the", "rotation", "state", "of", "the", "camera"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 252252}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/typecheck.py#L830-L925", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check that the accessed attribute exists", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "config", ".", "generated_members", ":", "if", "re", ".", "match", "(", "arg_2", ",", "arg_1", ".", "attrname", ")", ":", "return", "if", "re", ".", "match", "(", "arg_2", ",", "arg_1", ".", "as_string", "(", ")", ")", ":", "return", "try", ":", "arg_3", "=", "list", "(", "arg_1", ".", "expr", ".", "infer", "(", ")", ")", "except", "exceptions", ".", "InferenceError", ":", "return", "arg_4", "=", "set", "(", ")", "arg_5", "=", "[", "arg_6", "for", "arg_6", "in", "arg_3", "if", "arg_6", "is", "not", "astroid", ".", "Uninferable", "and", "not", "isinstance", "(", "arg_6", ",", "astroid", ".", "nodes", ".", "Unknown", ")", "]", "if", "(", "len", "(", "arg_5", ")", "!=", "len", "(", "arg_3", ")", "and", "arg_0", ".", "config", ".", "ignore_on_opaque_inference", ")", ":", "return", "for", "arg_6", "in", "arg_5", ":", "arg_8", "=", "getattr", "(", "arg_6", ",", "\"name\"", ",", "None", ")", "if", "_is_owner_ignored", "(", "arg_6", ",", "arg_8", ",", "arg_0", ".", "config", ".", "ignored_classes", ",", "arg_0", ".", "config", ".", "ignored_modules", ")", ":", "continue", "try", ":", "if", "not", "[", "n", "for", "n", "in", "arg_6", ".", "getattr", "(", "arg_1", ".", "attrname", ")", "if", "not", "isinstance", "(", "n", ".", "statement", "(", ")", ",", "astroid", ".", "AugAssign", ")", "]", ":", "arg_4", ".", "add", "(", "(", "arg_6", ",", "arg_8", ")", ")", "continue", "except", "AttributeError", ":", "continue", "except", "exceptions", ".", "NotFoundError", ":", "if", "not", "_emit_no_member", "(", "arg_1", ",", "arg_6", ",", "arg_8", ",", "ignored_mixins", "=", "arg_0", ".", "config", ".", "ignore_mixin_members", ",", "ignored_none", "=", "arg_0", ".", "config", ".", "ignore_none", ",", ")", ":", "continue", "arg_4", ".", "add", "(", "(", "arg_6", ",", "arg_8", ")", ")", "continue", "break", "else", ":", "arg_7", "=", "set", "(", ")", "for", "arg_6", ",", "arg_8", "in", "arg_4", ":", "if", "isinstance", "(", "arg_6", ",", "astroid", ".", "Instance", ")", ":", "arg_9", "=", "arg_6", ".", "_proxied", "else", ":", "arg_9", "=", "arg_6", "if", "arg_9", "in", "arg_7", ":", "continue", "arg_7", ".", "add", "(", "arg_9", ")", "arg_10", ",", "arg_11", "=", "arg_0", ".", "_get_nomember_msgid_hint", "(", "arg_1", ",", "arg_6", ")", "arg_0", ".", "add_message", "(", "arg_10", ",", "arg_1", "=", "arg_1", ",", "args", "=", "(", "arg_6", ".", "display_type", "(", ")", ",", "arg_8", ",", "arg_1", ".", "attrname", ",", "arg_11", ")", ",", "confidence", "=", "INFERENCE", ",", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"check that the accessed attribute exists\n\n        to avoid too much false positives for now, we'll consider the code as\n        correct if a single of the inferred nodes has the accessed attribute.\n\n        function/method, super call and metaclasses are ignored\n        \"\"\"\n        for arg_2 in arg_0.config.generated_members:\n            # attribute is marked as generated, stop here\n            if re.match(arg_2, arg_1.attrname):\n                return\n            if re.match(arg_2, arg_1.as_string()):\n                return\n\n        try:\n            arg_3 = list(arg_1.expr.infer())\n        except exceptions.InferenceError:\n            return\n\n        # list of (node, nodename) which are missing the attribute\n        arg_4 = set()\n\n        arg_5 = [\n            arg_6\n            for arg_6 in arg_3\n            if arg_6 is not astroid.Uninferable\n            and not isinstance(arg_6, astroid.nodes.Unknown)\n        ]\n        if (\n            len(arg_5) != len(arg_3)\n            and arg_0.config.ignore_on_opaque_inference\n        ):\n            # There is an ambiguity in the inference. Since we can't\n            # make sure that we won't emit a false positive, we just stop\n            # whenever the inference returns an opaque inference object.\n            return\n\n        for arg_6 in arg_5:\n            arg_8 = getattr(arg_6, \"name\", None)\n            if _is_owner_ignored(\n                arg_6, arg_8, arg_0.config.ignored_classes, arg_0.config.ignored_modules\n            ):\n                continue\n\n            try:\n                if not [\n                    n\n                    for n in arg_6.getattr(arg_1.attrname)\n                    if not isinstance(n.statement(), astroid.AugAssign)\n                ]:\n                    arg_4.add((arg_6, arg_8))\n                    continue\n            except AttributeError:\n                # XXX method / function\n                continue\n            except exceptions.NotFoundError:\n                # This can't be moved before the actual .getattr call,\n                # because there can be more values inferred and we are\n                # stopping after the first one which has the attribute in question.\n                # The problem is that if the first one has the attribute,\n                # but we continue to the next values which doesn't have the\n                # attribute, then we'll have a false positive.\n                # So call this only after the call has been made.\n                if not _emit_no_member(\n                    arg_1,\n                    arg_6,\n                    arg_8,\n                    ignored_mixins=arg_0.config.ignore_mixin_members,\n                    ignored_none=arg_0.config.ignore_none,\n                ):\n                    continue\n                arg_4.add((arg_6, arg_8))\n                continue\n            # stop on the first found\n            break\n        else:\n            # we have not found any node with the attributes, display the\n            # message for infered nodes\n            arg_7 = set()\n            for arg_6, arg_8 in arg_4:\n                if isinstance(arg_6, astroid.Instance):\n                    arg_9 = arg_6._proxied\n                else:\n                    arg_9 = arg_6\n                if arg_9 in arg_7:\n                    continue\n                arg_7.add(arg_9)\n\n                arg_10, arg_11 = arg_0._get_nomember_msgid_hint(arg_1, arg_6)\n                arg_0.add_message(\n                    arg_10,\n                    arg_1=arg_1,\n                    args=(arg_6.display_type(), arg_8, arg_1.attrname, arg_11),\n                    confidence=INFERENCE,\n                )", "path": "pylint/checkers/typecheck.py", "identifier": "TypeChecker.visit_attribute", "docstring": "check that the accessed attribute exists\n\n        to avoid too much false positives for now, we'll consider the code as\n        correct if a single of the inferred nodes has the accessed attribute.\n\n        function/method, super call and metaclasses are ignored", "docstring_tokens": ["check", "that", "the", "accessed", "attribute", "exists"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252253}
{"url": "https://github.com/ewilazarus/yld/blob/157e474d1055f14ffdfd7e99da6c77d5f17d4307/yld/tag.py#L51-L63", "sha": "157e474d1055f14ffdfd7e99da6c77d5f17d4307", "docstring_summary": "Bumps the Version given a target", "language": "python", "parameters": "(self, target)", "return_statement": "return self.clone()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "==", "'patch'", ":", "return", "Version", "(", "arg_0", ".", "major", ",", "arg_0", ".", "minor", ",", "arg_0", ".", "patch", "+", "1", ")", "if", "arg_1", "==", "'minor'", ":", "return", "Version", "(", "arg_0", ".", "major", ",", "arg_0", ".", "minor", "+", "1", ",", "0", ")", "if", "arg_1", "==", "'major'", ":", "return", "Version", "(", "arg_0", ".", "major", "+", "1", ",", "0", ",", "0", ")", "return", "arg_0", ".", "clone", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Bumps the Version given a target\n\n        The target can be either MAJOR, MINOR or PATCH\n        \"\"\"\n        if arg_1 == 'patch':\n            return Version(arg_0.major, arg_0.minor, arg_0.patch + 1)\n        if arg_1 == 'minor':\n            return Version(arg_0.major, arg_0.minor + 1, 0)\n        if arg_1 == 'major':\n            return Version(arg_0.major + 1, 0, 0)\n        return arg_0.clone()", "path": "yld/tag.py", "identifier": "Version.bump", "docstring": "Bumps the Version given a target\n\n        The target can be either MAJOR, MINOR or PATCH", "docstring_tokens": ["Bumps", "the", "Version", "given", "a", "target"], "nwo": "ewilazarus/yld", "score": 0.09252797783733271, "idx": 252254}
{"url": "https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/writer.py#L83-L91", "sha": "46e12659b8d08af764dc09a1f31b0e85a68f808f", "docstring_summary": "Write data to file-like object", "language": "python", "parameters": "(self, f, time_start, time_stop, start, stop, step, samples, pwr_array)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", ":", "arg_1", ".", "Func", "(", "arg_0", ".", "magic", ")", "arg_1", ".", "Func", "(", "arg_0", ".", "header_struct", ".", "pack", "(", "arg_0", ".", "version", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ".", "nbytes", ")", ")", "arg_1", ".", "Func", "(", "arg_8", ".", "tobytes", "(", ")", ")", "arg_1", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8):\n        \"\"\"Write data to file-like object\"\"\"\n        arg_1.Func(arg_0.magic)\n        arg_1.Func(arg_0.header_struct.pack(\n            arg_0.version, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8.nbytes\n        ))\n        #pwr_array.tofile(f)\n        arg_1.Func(arg_8.tobytes())\n        arg_1.flush()", "path": "soapypower/writer.py", "identifier": "SoapyPowerBinFormat.write", "docstring": "Write data to file-like object", "docstring_tokens": ["Write", "data", "to", "file", "-", "like", "object"], "nwo": "xmikos/soapy_power", "score": 0.1984218952631984, "idx": 252255}
{"url": "https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/ls.py#L78-L117", "sha": "d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd", "docstring_summary": "Lists all temple templates and packages associated with those templates", "language": "python", "parameters": "(github_user, template=None)", "return_statement": "return collections.OrderedDict(sorted(results.items()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "temple", ".", "check", ".", "has_env_vars", "(", "temple", ".", "constants", ".", "GITHUB_API_TOKEN_ENV_VAR", ")", "if", "arg_1", ":", "temple", ".", "check", ".", "is_git_ssh_path", "(", "arg_1", ")", "arg_2", "=", "'user:{} filename:{} {}'", ".", "format", "(", "arg_0", ",", "temple", ".", "constants", ".", "TEMPLE_CONFIG_FILE", ",", "arg_1", ")", "eFunce", ":", "arg_2", "=", "'user:{} cookiecutter.json in:path'", ".", "format", "(", "arg_0", ")", "arg_3", "=", "_code_search", "(", "arg_2", ",", "arg_0", ")", "return", "collections", ".", "OrderedDict", "(", "sorted", "(", "arg_3", ".", "items", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Lists all temple templates and packages associated with those templates\n\n    If ``template`` is None, returns the available templates for the configured\n    Github org.\n\n    If ``template`` is a Github path to a template, returns all projects spun\n    up with that template.\n\n    ``Func`` uses the github search API to find results.\n\n    Note that the `temple.constants.TEMPLE_ENV_VAR` is set to 'Func' for the duration of this\n    function.\n\n    Args:\n        github_user (str): The github user or org being searched.\n        template (str, optional): The template git repo path. If provided, lists\n            all projects that have been created with the provided template. Note\n            that the template path is the SSH path\n            (e.g. git@github.com:CloverHealth/temple.git)\n\n    Returns:\n        dict: A dictionary of repository information keyed on the SSH Github url\n\n    Raises:\n        `InvalidGithubUserError`: When ``github_user`` is invalid\n    \"\"\"\n    temple.check.has_env_vars(temple.constants.GITHUB_API_TOKEN_ENV_VAR)\n\n    if arg_1:\n        temple.check.is_git_ssh_path(arg_1)\n        arg_2 = 'user:{} filename:{} {}'.format(\n            arg_0,\n            temple.constants.TEMPLE_CONFIG_FILE,\n            arg_1)\n    eFunce:\n        arg_2 = 'user:{} cookiecutter.json in:path'.format(arg_0)\n\n    arg_3 = _code_search(arg_2, arg_0)\n    return collections.OrderedDict(sorted(arg_3.items()))", "path": "temple/ls.py", "identifier": "ls", "docstring": "Lists all temple templates and packages associated with those templates\n\n    If ``template`` is None, returns the available templates for the configured\n    Github org.\n\n    If ``template`` is a Github path to a template, returns all projects spun\n    up with that template.\n\n    ``ls`` uses the github search API to find results.\n\n    Note that the `temple.constants.TEMPLE_ENV_VAR` is set to 'ls' for the duration of this\n    function.\n\n    Args:\n        github_user (str): The github user or org being searched.\n        template (str, optional): The template git repo path. If provided, lists\n            all projects that have been created with the provided template. Note\n            that the template path is the SSH path\n            (e.g. git@github.com:CloverHealth/temple.git)\n\n    Returns:\n        dict: A dictionary of repository information keyed on the SSH Github url\n\n    Raises:\n        `InvalidGithubUserError`: When ``github_user`` is invalid", "docstring_tokens": ["Lists", "all", "temple", "templates", "and", "packages", "associated", "with", "those", "templates"], "nwo": "CloverHealth/temple", "score": 0.39091779717332914, "idx": 252256}
{"url": "https://github.com/a-tal/nagaram/blob/2edcb0ef8cb569ebd1c398be826472b4831d6110/nagaram/anagrams.py#L7-L23", "sha": "2edcb0ef8cb569ebd1c398be826472b4831d6110", "docstring_summary": "Creates a map of letter use in a word.", "language": "python", "parameters": "(word)", "return_statement": "return lmap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ":", "try", ":", "arg_1", "[", "arg_2", "]", "+=", "1", "except", "KeyError", ":", "arg_1", "[", "arg_2", "]", "=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Creates a map of letter use in a word.\n\n    Args:\n        word: a string to create a letter map from\n\n    Returns:\n        a dictionary of {letter: integer count of letter in word}\n    \"\"\"\n\n    arg_1 = {}\n    for arg_2 in arg_0:\n        try:\n            arg_1[arg_2] += 1\n        except KeyError:\n            arg_1[arg_2] = 1\n    return arg_1", "path": "nagaram/anagrams.py", "identifier": "_letter_map", "docstring": "Creates a map of letter use in a word.\n\n    Args:\n        word: a string to create a letter map from\n\n    Returns:\n        a dictionary of {letter: integer count of letter in word}", "docstring_tokens": ["Creates", "a", "map", "of", "letter", "use", "in", "a", "word", "."], "nwo": "a-tal/nagaram", "score": 0.09252797783733271, "idx": 252257}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/example.py#L60-L124", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Main function.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "'Validate a CSV data file.'", "arg_1", "=", "argparse", ".", "ArgumentParser", "(", "arg_0", "=", "arg_0", ")", "arg_1", ".", "add_argument", "(", "'file'", ",", "metavar", "=", "'FILE'", ",", "help", "=", "'a file to be validated'", ")", "arg_1", ".", "add_argument", "(", "'-l'", ",", "'--limit'", ",", "dest", "=", "'limit'", ",", "type", "=", "int", ",", "action", "=", "'store'", ",", "default", "=", "0", ",", "help", "=", "'limit the number of problems reported'", ")", "arg_1", ".", "add_argument", "(", "'-s'", ",", "'--summarize'", ",", "dest", "=", "'summarize'", ",", "action", "=", "'store_true'", ",", "default", "=", "False", ",", "help", "=", "'output only a summary of the different types of problem found'", ")", "arg_1", ".", "add_argument", "(", "'-e'", ",", "'--report-unexpected-exceptions'", ",", "dest", "=", "'report_unexpected_exceptions'", ",", "action", "=", "'store_true'", ",", "default", "=", "False", ",", "help", "=", "'report any unexpected exceptions as problems'", ")", "arg_2", "=", "arg_1", ".", "parse_args", "(", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_2", ".", "file", ")", ":", "print", "'%s is not a file'", "%", "arg_2", ".", "file", "sys", ".", "exit", "(", "1", ")", "with", "open", "(", "arg_2", ".", "file", ",", "'r'", ")", "as", "f", ":", "arg_3", "=", "csv", ".", "reader", "(", "f", ",", "delimiter", "=", "'\\t'", ")", "arg_4", "=", "create_validator", "(", ")", "arg_5", "=", "arg_4", ".", "validate", "(", "arg_3", ",", "summarize", "=", "arg_2", ".", "summarize", ",", "report_unexpected_exceptions", "=", "arg_2", ".", "report_unexpected_exceptions", ",", "context", "=", "{", "'file'", ":", "arg_2", ".", "file", "}", ")", "write_problems", "(", "arg_5", ",", "sys", ".", "stdout", ",", "summarize", "=", "arg_2", ".", "summarize", ",", "limit", "=", "arg_2", ".", "limit", ")", "if", "arg_5", ":", "sys", ".", "exit", "(", "1", ")", "else", ":", "sys", ".", "exit", "(", "0", ")"], "function": "def Func():\n    \"\"\"Main function.\"\"\"\n\n    # define a command-line argument parser\n    arg_0 = 'Validate a CSV data file.'\n    arg_1 = argparse.ArgumentParser(arg_0=arg_0)\n    arg_1.add_argument('file', \n                        metavar='FILE', \n                        help='a file to be validated')\n    arg_1.add_argument('-l', '--limit',\n                        dest='limit',\n                        type=int,\n                        action='store',\n                        default=0,\n                        help='limit the number of problems reported'\n                        )\n    arg_1.add_argument('-s', '--summarize',\n                        dest='summarize',\n                        action='store_true',\n                        default=False,\n                        help='output only a summary of the different types of problem found'\n                        )\n    arg_1.add_argument('-e', '--report-unexpected-exceptions',\n                        dest='report_unexpected_exceptions',\n                        action='store_true',\n                        default=False,\n                        help='report any unexpected exceptions as problems'\n                        )\n    \n    # parse arguments\n    arg_2 = arg_1.parse_args()\n    \n    # sanity check arguments\n    if not os.path.isfile(arg_2.file):\n        print '%s is not a file' % arg_2.file\n        sys.exit(1)\n\n    with open(arg_2.file, 'r') as f:\n\n        # set up a csv reader for the data\n        arg_3 = csv.reader(f, delimiter='\\t')\n        \n        # create a validator\n        arg_4 = create_validator()\n        \n        # validate the data from the csv reader\n        # N.B., validate() returns a list of problems;\n        # if you expect a large number of problems, use ivalidate() instead\n        # of validate(), but bear in mind that ivalidate() returns an iterator\n        # so there is no len()\n        arg_5 = arg_4.validate(arg_3, \n                                      summarize=arg_2.summarize,\n                                      report_unexpected_exceptions=arg_2.report_unexpected_exceptions,\n                                      context={'file': arg_2.file})\n\n        # write problems to stdout as restructured text\n        write_problems(arg_5, sys.stdout, \n                       summarize=arg_2.summarize, \n                       limit=arg_2.limit)\n        \n        # decide how to exit\n        if arg_5: # will not work with ivalidate() because it returns an iterator\n            sys.exit(1)\n        else:\n            sys.exit(0)", "path": "example.py", "identifier": "main", "docstring": "Main function.", "docstring_tokens": ["Main", "function", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 252258}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L55-L59", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Returns True if path contains a .cpenv file", "language": "python", "parameters": "(path)", "return_statement": "return os.path.exists(candidate) and os.path.isfile(candidate)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "unipath", "(", "arg_0", ",", "'.cpenv'", ")", "return", "os", ".", "path", ".", "exists", "(", "arg_1", ")", "and", "os", ".", "path", ".", "isfile", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    '''Returns True if path contains a .cpenv file'''\n\n    arg_1 = unipath(arg_0, '.cpenv')\n    return os.path.exists(arg_1) and os.path.isfile(arg_1)", "path": "cpenv/utils.py", "identifier": "is_redirecting", "docstring": "Returns True if path contains a .cpenv file", "docstring_tokens": ["Returns", "True", "if", "path", "contains", "a", ".", "cpenv", "file"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 252259}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/assert_util.py#L44-L73", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Assert all elements of `x` are finite.", "language": "python", "parameters": "(x, data=None, summarize=None, message=None, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v2", ".", "name_scope", "(", "arg_4", "or", "'Func'", ")", ":", "arg_5", "=", "tf", ".", "get_static_value", "(", "arg_0", ")", "if", "arg_5", "is", "not", "None", ":", "if", "~", "np", ".", "all", "(", "np", ".", "isfinite", "(", "arg_5", ")", ")", ":", "raise", "ValueError", "(", "arg_3", ")", "return", "arg_0", "arg_6", "=", "tf", ".", "compat", ".", "v1", ".", "assert_equal", "(", "tf", ".", "math", ".", "is_finite", "(", "arg_0", ")", ",", "tf", ".", "ones_like", "(", "arg_0", ",", "tf", ".", "bool", ")", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "with", "tf", ".", "control_dependencies", "(", "[", "arg_6", "]", ")", ":", "return", "tf", ".", "identity", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None):\n  \"\"\"Assert all elements of `x` are finite.\n\n  Args:\n    x:  Numeric `Tensor`.\n    data:  The tensors to print out if the condition is False.  Defaults to\n      error message and first few entries of `x`.\n    summarize: Print this many entries of each tensor.\n    message: A string to prefix to the default message.\n    name: A name for this operation (optional).\n      Defaults to \"Func\".\n\n  Returns:\n    Op raising `InvalidArgumentError` unless `x` has specified rank or lower.\n    If static checks determine `x` has correct rank, a `no_op` is returned.\n\n  Raises:\n    ValueError:  If static checks determine `x` has wrong rank.\n  \"\"\"\n  with tf.compat.v2.name_scope(arg_4 or 'Func'):\n    arg_5 = tf.get_static_value(arg_0)\n    if arg_5 is not None:\n      if ~np.all(np.isfinite(arg_5)):\n        raise ValueError(arg_3)\n      return arg_0\n    arg_6 = tf.compat.v1.assert_equal(\n        tf.math.is_finite(arg_0), tf.ones_like(arg_0, tf.bool),\n        arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)\n    with tf.control_dependencies([arg_6]):\n      return tf.identity(arg_0)", "path": "tensorflow_probability/python/internal/assert_util.py", "identifier": "assert_finite", "docstring": "Assert all elements of `x` are finite.\n\n  Args:\n    x:  Numeric `Tensor`.\n    data:  The tensors to print out if the condition is False.  Defaults to\n      error message and first few entries of `x`.\n    summarize: Print this many entries of each tensor.\n    message: A string to prefix to the default message.\n    name: A name for this operation (optional).\n      Defaults to \"assert_finite\".\n\n  Returns:\n    Op raising `InvalidArgumentError` unless `x` has specified rank or lower.\n    If static checks determine `x` has correct rank, a `no_op` is returned.\n\n  Raises:\n    ValueError:  If static checks determine `x` has wrong rank.", "docstring_tokens": ["Assert", "all", "elements", "of", "x", "are", "finite", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252260}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/extensions.py#L43-L63", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Initialize from flask", "language": "python", "parameters": "(self, app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "config", ".", "get", "(", "\"MONGO_URI\"", ",", "None", ")", "arg_3", "=", "arg_1", ".", "config", ".", "get", "(", "\"MONGO_DBNAME\"", ",", "'scout'", ")", "try", ":", "arg_4", "=", "get_connection", "(", "host", "=", "arg_1", ".", "config", ".", "get", "(", "\"MONGO_HOST\"", ",", "'localhost'", ")", ",", "port", "=", "arg_1", ".", "config", ".", "get", "(", "\"MONGO_PORT\"", ",", "27017", ")", ",", "username", "=", "arg_1", ".", "config", ".", "get", "(", "\"MONGO_USERNAME\"", ",", "None", ")", ",", "password", "=", "arg_1", ".", "config", ".", "get", "(", "\"MONGO_PASSWORD\"", ",", "None", ")", ",", "arg_2", "=", "arg_2", ",", "mongodb", "=", "arg_3", ")", "except", "ConnectionFailure", ":", "context", ".", "abort", "(", ")", "arg_1", ".", "config", "[", "\"MONGO_DATABASE\"", "]", "=", "arg_4", "[", "arg_3", "]", "arg_1", ".", "config", "[", "'MONGO_CLIENT'", "]", "=", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Initialize from flask\"\"\"\n        arg_2 = arg_1.config.get(\"MONGO_URI\", None)\n        \n        arg_3 = arg_1.config.get(\"MONGO_DBNAME\", 'scout')\n        \n        try:\n            arg_4 = get_connection(\n                host = arg_1.config.get(\"MONGO_HOST\", 'localhost'),\n                port=arg_1.config.get(\"MONGO_PORT\", 27017), \n                username=arg_1.config.get(\"MONGO_USERNAME\", None), \n                password=arg_1.config.get(\"MONGO_PASSWORD\", None),\n                arg_2=arg_2, \n                mongodb= arg_3\n            )\n        except ConnectionFailure:\n            context.abort()\n\n        arg_1.config[\"MONGO_DATABASE\"] = arg_4[arg_3]\n\n        arg_1.config['MONGO_CLIENT'] = arg_4", "path": "scout/server/extensions.py", "identifier": "MongoDB.init_app", "docstring": "Initialize from flask", "docstring_tokens": ["Initialize", "from", "flask"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252261}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L174-L182", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "A convenience function for plotting a vertical bar plot from a Counter", "language": "python", "parameters": "(d, plt, title=None, rotation='vertical')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'vertical'", ")", ":", "arg_4", "=", "sorted", "(", "arg_0", ",", "key", "=", "arg_0", ".", "get", ",", "reverse", "=", "True", ")", "arg_5", "=", "range", "(", "len", "(", "arg_4", ")", ")", "arg_1", ".", "xticks", "(", "arg_5", ",", "arg_4", ",", "arg_3", "=", "arg_3", ")", "arg_1", ".", "bar", "(", "arg_5", ",", "[", "arg_0", "[", "arg_6", "]", "for", "arg_6", "in", "arg_4", "]", ")", "if", "arg_2", "is", "not", "None", ":", "arg_1", ".", "title", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3='vertical'):\n    \"\"\"A convenience function for plotting a vertical bar plot from a Counter\"\"\"\n    arg_4 = sorted(arg_0, key=arg_0.get, reverse=True)\n    arg_5 = range(len(arg_4))\n    arg_1.xticks(arg_5, arg_4, arg_3=arg_3)\n    arg_1.bar(arg_5, [arg_0[arg_6] for arg_6 in arg_4])\n\n    if arg_2 is not None:\n        arg_1.title(arg_2)", "path": "src/pybel_tools/utils.py", "identifier": "barv", "docstring": "A convenience function for plotting a vertical bar plot from a Counter", "docstring_tokens": ["A", "convenience", "function", "for", "plotting", "a", "vertical", "bar", "plot", "from", "a", "Counter"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 252262}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/commands/utils.py#L36-L50", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Read config's variables and apply their values to all its properties", "language": "python", "parameters": "(config: Union[str, Path, dict])", "return_statement": "return _parse_config_property(config, variables)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", ",", "arg_4", "]", ")", "->", "arg_4", ":", "if", "isinstance", "(", "arg_0", ",", "(", "arg_2", ",", "arg_3", ")", ")", ":", "arg_0", "=", "read_json", "(", "find_config", "(", "arg_0", ")", ")", "arg_5", "=", "{", "'DEEPPAVLOV_PATH'", ":", "os", ".", "getenv", "(", "f'DP_DEEPPAVLOV_PATH'", ",", "arg_3", "(", "__file__", ")", ".", "parent", ".", "parent", ".", "parent", ")", "}", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "get", "(", "'metadata'", ",", "{", "}", ")", ".", "get", "(", "'variables'", ",", "{", "}", ")", ".", "items", "(", ")", ":", "arg_8", "=", "f'DP_{name}'", "if", "arg_8", "in", "os", ".", "environ", ":", "arg_7", "=", "os", ".", "getenv", "(", "arg_8", ")", "arg_5", "[", "arg_6", "]", "=", "arg_7", ".", "format", "(", "**", "arg_5", ")", "return", "_Func_property", "(", "arg_0", ",", "arg_5", ")"], "function": "def Func(arg_0: arg_1[arg_2, arg_3, arg_4]) -> arg_4:\n    \"\"\"Read config's variables and apply their values to all its properties\"\"\"\n    if isinstance(arg_0, (arg_2, arg_3)):\n        arg_0 = read_json(find_config(arg_0))\n\n    arg_5 = {\n        'DEEPPAVLOV_PATH': os.getenv(f'DP_DEEPPAVLOV_PATH', arg_3(__file__).parent.parent.parent)\n    }\n    for arg_6, arg_7 in arg_0.get('metadata', {}).get('variables', {}).items():\n        arg_8 = f'DP_{name}'\n        if arg_8 in os.environ:\n            arg_7 = os.getenv(arg_8)\n        arg_5[arg_6] = arg_7.format(**arg_5)\n\n    return _Func_property(arg_0, arg_5)", "path": "deeppavlov/core/commands/utils.py", "identifier": "parse_config", "docstring": "Read config's variables and apply their values to all its properties", "docstring_tokens": ["Read", "config", "s", "variables", "and", "apply", "their", "values", "to", "all", "its", "properties"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 252263}
{"url": "https://github.com/nephila/djangocms-installer/blob/9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e/djangocms_installer/django/__init__.py#L27-L66", "sha": "9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e", "docstring_summary": "Call django-admin to create the project structure", "language": "python", "parameters": "(config_data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "deepcopy", "(", "dict", "(", "os", ".", "environ", ")", ")", "arg_1", "[", "arg_2", "(", "'DJANGO_SETTINGS_MODULE'", ")", "]", "=", "arg_2", "(", "'{0}.settings'", ".", "format", "(", "arg_0", ".", "project_name", ")", ")", "arg_1", "[", "arg_2", "(", "'PYTHONPATH'", ")", "]", "=", "arg_2", "(", "os", ".", "pathsep", ".", "join", "(", "map", "(", "shlex_quote", ",", "sys", ".", "path", ")", ")", ")", "arg_3", "=", "{", "}", "arg_4", "=", "[", "]", "if", "arg_0", ".", "template", ":", "arg_3", "[", "'template'", "]", "=", "arg_0", ".", "template", "arg_4", ".", "append", "(", "arg_0", ".", "project_name", ")", "if", "arg_0", ".", "project_directory", ":", "arg_4", ".", "append", "(", "arg_0", ".", "project_directory", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "project_directory", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "project_directory", ")", "arg_5", "=", "'django-admin.py'", "arg_6", "=", "[", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "sys", ".", "executable", ")", ",", "arg_5", ")", "]", "arg_7", "=", "[", "'Scripts'", "]", "arg_6", ".", "extend", "(", "[", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "sys", ".", "executable", ")", ",", "arg_8", ",", "arg_5", ")", "for", "arg_8", "in", "arg_7", "]", ")", "arg_9", "=", "[", "arg_5", "]", "for", "arg_10", "in", "arg_6", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_10", ")", ":", "arg_9", "=", "[", "sys", ".", "executable", ",", "arg_10", "]", "break", "arg_11", "=", "arg_9", "+", "[", "'startproject'", "]", "+", "arg_4", "if", "arg_0", ".", "verbose", ":", "sys", ".", "stdout", ".", "write", "(", "'Project creation command: {0}\\n'", ".", "format", "(", "' '", ".", "join", "(", "arg_11", ")", ")", ")", "try", ":", "arg_12", "=", "subprocess", ".", "check_output", "(", "arg_11", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", "sys", ".", "stdout", ".", "write", "(", "arg_12", ".", "decode", "(", "'utf-8'", ")", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "if", "arg_0", ".", "verbose", ":", "sys", ".", "stdout", ".", "write", "(", "e", ".", "output", ".", "decode", "(", "'utf-8'", ")", ")", "raise"], "function": "def Func(arg_0):\n    \"\"\"\n    Call django-admin to create the project structure\n\n    :param config_data: configuration data\n    \"\"\"\n    arg_1 = deepcopy(dict(os.environ))\n    arg_1[arg_2('DJANGO_SETTINGS_MODULE')] = arg_2('{0}.settings'.format(arg_0.project_name))\n    arg_1[arg_2('PYTHONPATH')] = arg_2(os.pathsep.join(map(shlex_quote, sys.path)))\n    arg_3 = {}\n    arg_4 = []\n    if arg_0.template:\n        arg_3['template'] = arg_0.template\n    arg_4.append(arg_0.project_name)\n    if arg_0.project_directory:\n        arg_4.append(arg_0.project_directory)\n        if not os.path.exists(arg_0.project_directory):\n            os.makedirs(arg_0.project_directory)\n    arg_5 = 'django-admin.py'\n    arg_6 = [os.path.join(os.path.dirname(sys.executable), arg_5)]\n    arg_7 = ['Scripts']\n    arg_6.extend([\n        os.path.join(os.path.dirname(sys.executable), arg_8, arg_5)\n        for arg_8 in arg_7\n    ])\n    arg_9 = [arg_5]\n    for arg_10 in arg_6:\n        if os.path.exists(arg_10):\n            arg_9 = [sys.executable, arg_10]\n            break\n    arg_11 = arg_9 + ['startproject'] + arg_4\n    if arg_0.verbose:\n        sys.stdout.write('Project creation command: {0}\\n'.format(' '.join(arg_11)))\n    try:\n        arg_12 = subprocess.check_output(arg_11, stderr=subprocess.STDOUT)\n        sys.stdout.write(arg_12.decode('utf-8'))\n    except subprocess.CalledProcessError as e:  # pragma: no cover\n        if arg_0.verbose:\n            sys.stdout.write(e.output.decode('utf-8'))\n        raise", "path": "djangocms_installer/django/__init__.py", "identifier": "create_project", "docstring": "Call django-admin to create the project structure\n\n    :param config_data: configuration data", "docstring_tokens": ["Call", "django", "-", "admin", "to", "create", "the", "project", "structure"], "nwo": "nephila/djangocms-installer", "score": 0.7157994486187137, "idx": 252264}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/bel_manager.py#L95-L101", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Dump as a list of INDRA statements.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return to_indra_statements(graph)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "to_bel", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "Func", "(", "arg_3", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Dump as a list of INDRA statements.\n\n        :rtype: List[indra.Statement]\n        \"\"\"\n        arg_3 = arg_0.to_bel(*arg_1, **arg_2)\n        return Func(arg_3)", "path": "src/bio2bel/manager/bel_manager.py", "identifier": "BELManagerMixin.to_indra_statements", "docstring": "Dump as a list of INDRA statements.\n\n        :rtype: List[indra.Statement]", "docstring_tokens": ["Dump", "as", "a", "list", "of", "INDRA", "statements", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 252265}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/lshensemble_partition.py#L96-L168", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Computes the optimal partitions given the size distributions\n    and computed number of expected false positives for all sub-intervals.", "language": "python", "parameters": "(num_part, sizes, nfps)", "return_statement": "return [partitions, total_nfps, cost]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", "<", "2", ":", "raise", "ValueError", "(", "\"num_part cannot be less than 2\"", ")", "if", "arg_0", ">", "len", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "\"num_part cannot be greater than the domain size of \"", "\"all set sizes\"", ")", "if", "arg_0", "==", "2", ":", "arg_3", ",", "arg_4", "=", "min", "(", "(", "arg_2", "[", "0", ",", "u1", "]", "+", "arg_2", "[", "u1", "+", "1", ",", "len", "(", "arg_1", ")", "-", "1", "]", ",", "u1", ")", "for", "u1", "in", "range", "(", "0", ",", "len", "(", "arg_1", ")", "-", "1", ")", ")", "return", "[", "(", "arg_1", "[", "0", "]", ",", "arg_1", "[", "arg_4", "]", ")", ",", "(", "arg_1", "[", "arg_4", "+", "1", "]", ",", "arg_1", "[", "-", "1", "]", ")", ",", "]", ",", "arg_3", ",", "None", "arg_5", "=", "np", ".", "zeros", "(", "(", "len", "(", "arg_1", ")", ",", "arg_0", "-", "2", ")", ")", "arg_6", "=", "lambda", "arg_7", ":", "arg_7", "-", "2", "for", "arg_7", "in", "range", "(", "2", ",", "arg_0", ")", ":", "for", "arg_4", "in", "range", "(", "arg_7", "-", "1", ",", "len", "(", "arg_1", ")", ")", ":", "if", "arg_7", "==", "2", ":", "arg_5", "[", "arg_4", ",", "arg_6", "(", "arg_7", ")", "]", "=", "min", "(", "arg_2", "[", "0", ",", "u1", "]", "+", "arg_2", "[", "u1", "+", "1", ",", "arg_4", "]", "for", "u1", "in", "range", "(", "arg_4", ")", ")", "else", ":", "arg_5", "[", "arg_4", ",", "arg_6", "(", "arg_7", ")", "]", "=", "min", "(", "arg_5", "[", "u1", ",", "arg_6", "(", "arg_7", "-", "1", ")", "]", "+", "arg_2", "[", "u1", "+", "1", ",", "arg_4", "]", "for", "u1", "in", "range", "(", "(", "arg_7", "-", "1", ")", "-", "1", ",", "arg_4", ")", ")", "arg_7", "=", "arg_0", "arg_3", ",", "arg_4", "=", "min", "(", "(", "arg_5", "[", "u1", ",", "arg_6", "(", "arg_7", "-", "1", ")", "]", "+", "arg_2", "[", "u1", "+", "1", ",", "len", "(", "arg_1", ")", "-", "1", "]", ",", "u1", ")", "for", "u1", "in", "range", "(", "(", "arg_7", "-", "1", ")", "-", "1", ",", "len", "(", "arg_1", ")", "-", "1", ")", ")", "arg_8", "=", "[", "(", "arg_1", "[", "arg_4", "+", "1", "]", ",", "arg_1", "[", "-", "1", "]", ")", ",", "]", "arg_7", "-=", "1", "while", "arg_7", ">", "1", ":", "arg_9", ",", "arg_10", "=", "min", "(", "(", "arg_5", "[", "u1", ",", "arg_6", "(", "arg_7", ")", "]", "+", "arg_2", "[", "u1", "+", "1", ",", "arg_4", "]", ",", "u1", ")", "for", "u1", "in", "range", "(", "(", "arg_7", "-", "1", ")", "-", "1", ",", "arg_4", ")", ")", "arg_8", ".", "insert", "(", "0", ",", "(", "arg_1", "[", "arg_10", "+", "1", "]", ",", "arg_1", "[", "arg_4", "]", ")", ")", "arg_4", "=", "arg_10", "arg_7", "-=", "1", "arg_8", ".", "insert", "(", "0", ",", "(", "arg_1", "[", "0", "]", ",", "arg_1", "[", "arg_4", "]", ")", ")", "return", "[", "arg_8", ",", "arg_3", ",", "arg_5", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Computes the optimal partitions given the size distributions\n    and computed number of expected false positives for all sub-intervals.\n\n    Args:\n        num_part (int): The number of partitions to create.\n        sizes (numpy.array): The complete domain of set sizes in sorted order.\n        nfps (numpy.array): The computed number of expected false positives\n            for all sub-intervals; axis-0 is for the indexes of lower bounds and\n            axis-1 is for the indexes of upper bounds.\n\n    Returns:\n        partitions (list): list of lower and upper bounds of set sizes for\n            all partitions.\n        total_nfps (float): total number of expected false positives from all\n            partitions.\n        cost (numpy.array): a N x p-1 matrix of the computed optimal NFPs for\n            all sub-problems given upper bound set size and number of partitions.\n    \"\"\"\n\n    if arg_0 < 2:\n        raise ValueError(\"num_part cannot be less than 2\")\n    if arg_0 > len(arg_1):\n        raise ValueError(\"num_part cannot be greater than the domain size of \"\n                \"all set sizes\")\n\n    # If number of partitions is 2, then simply find the upper bound\n    # of the first partition.\n    if arg_0 == 2:\n        arg_3, arg_4 = min((arg_2[0, u1]+arg_2[u1+1, len(arg_1)-1], u1)\n            for u1 in range(0, len(arg_1)-1))\n        return [(arg_1[0], arg_1[arg_4]), (arg_1[arg_4+1], arg_1[-1]),], \\\n                arg_3, None\n\n    # Initialize subproblem total NFPs.\n    arg_5 = np.zeros((len(arg_1), arg_0-2))\n\n    # Note: p is the number of partitions in the subproblem.\n    # p2i translates the number of partition into the index in the matrix.\n    arg_6 = lambda arg_7 : arg_7 - 2\n\n    # Compute p >= 2 until before p = num_part.\n    for arg_7 in range(2, arg_0):\n        # Compute best partition for subproblems with increasing\n        # max index u, starting from the smallest possible u given the p.\n        # The smallest possible u can be considered as the max index that\n        # generates p partitions each with only one size.\n        for arg_4 in range(arg_7-1, len(arg_1)):\n            if arg_7 == 2:\n                arg_5[arg_4, arg_6(arg_7)] = min(arg_2[0, u1]+arg_2[u1+1,arg_4]\n                        for u1 in range(arg_4))\n            else:\n                arg_5[arg_4, arg_6(arg_7)] = min(arg_5[u1, arg_6(arg_7-1)] + arg_2[u1+1, arg_4]\n                        for u1 in range((arg_7-1)-1, arg_4))\n    arg_7 = arg_0\n    # Find the optimal upper bound index of the 2nd right-most partition given\n    # the number of partitions (p).\n    arg_3, arg_4 = min((arg_5[u1, arg_6(arg_7-1)]+arg_2[u1+1, len(arg_1)-1], u1)\n            for u1 in range((arg_7-1)-1, len(arg_1)-1))\n    arg_8 = [(arg_1[arg_4+1], arg_1[-1]),]\n    arg_7 -= 1\n    # Back track to find the best partitions.\n    while arg_7 > 1:\n        # Find the optimal upper bound index of the 2nd right-most partition\n        # givne the number of partitions (p) and upper bound index (u) in this\n        # sub-problem.\n        arg_9, arg_10 = min((arg_5[u1, arg_6(arg_7)]+arg_2[u1+1, arg_4], u1)\n                for u1 in range((arg_7-1)-1, arg_4))\n        arg_8.insert(0, (arg_1[arg_10+1], arg_1[arg_4]))\n        arg_4 = arg_10\n        arg_7 -= 1\n    arg_8.insert(0, (arg_1[0], arg_1[arg_4]))\n    return [arg_8, arg_3, arg_5]", "path": "datasketch/lshensemble_partition.py", "identifier": "_compute_best_partitions", "docstring": "Computes the optimal partitions given the size distributions\n    and computed number of expected false positives for all sub-intervals.\n\n    Args:\n        num_part (int): The number of partitions to create.\n        sizes (numpy.array): The complete domain of set sizes in sorted order.\n        nfps (numpy.array): The computed number of expected false positives\n            for all sub-intervals; axis-0 is for the indexes of lower bounds and\n            axis-1 is for the indexes of upper bounds.\n\n    Returns:\n        partitions (list): list of lower and upper bounds of set sizes for\n            all partitions.\n        total_nfps (float): total number of expected false positives from all\n            partitions.\n        cost (numpy.array): a N x p-1 matrix of the computed optimal NFPs for\n            all sub-problems given upper bound set size and number of partitions.", "docstring_tokens": ["Computes", "the", "optimal", "partitions", "given", "the", "size", "distributions", "and", "computed", "number", "of", "expected", "false", "positives", "for", "all", "sub", "-", "intervals", "."], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 252266}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/inference_shifter.py#L40-L88", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Shift the model result and return the new instance.", "language": "python", "parameters": "(self, modelResult)", "return_statement": "return shiftedResult", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "if", "arg_0", ".", "_inferenceBuffer", "is", "None", ":", "arg_3", "=", "InferenceElement", ".", "getMaxDelay", "(", "arg_1", ".", "inferences", ")", "arg_0", ".", "_inferenceBuffer", "=", "collections", ".", "deque", "(", "maxlen", "=", "arg_3", "+", "1", ")", "arg_0", ".", "_inferenceBuffer", ".", "appendleft", "(", "copy", ".", "deepcopy", "(", "arg_1", ".", "inferences", ")", ")", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "inferences", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "arg_6", ",", "dict", ")", ":", "arg_2", "[", "arg_5", "]", "=", "{", "}", "for", "arg_7", ",", "arg_8", "in", "arg_6", ".", "iteritems", "(", ")", ":", "arg_9", "=", "InferenceElement", ".", "getTemporalDelay", "(", "arg_5", ",", "arg_7", ")", "if", "len", "(", "arg_0", ".", "_inferenceBuffer", ")", ">", "arg_9", ":", "arg_10", "=", "arg_0", ".", "_inferenceBuffer", "[", "arg_9", "]", "[", "arg_5", "]", "[", "arg_7", "]", "arg_2", "[", "arg_5", "]", "[", "arg_7", "]", "=", "arg_10", "else", ":", "arg_2", "[", "arg_5", "]", "[", "arg_7", "]", "=", "None", "else", ":", "arg_9", "=", "InferenceElement", ".", "getTemporalDelay", "(", "arg_5", ")", "if", "len", "(", "arg_0", ".", "_inferenceBuffer", ")", ">", "arg_9", ":", "arg_2", "[", "arg_5", "]", "=", "(", "arg_0", ".", "_inferenceBuffer", "[", "arg_9", "]", "[", "arg_5", "]", ")", "else", ":", "if", "type", "(", "arg_6", ")", "in", "(", "list", ",", "tuple", ")", ":", "arg_2", "[", "arg_5", "]", "=", "[", "None", "]", "*", "len", "(", "arg_6", ")", "else", ":", "arg_2", "[", "arg_5", "]", "=", "None", "arg_11", "=", "ModelResult", "(", "rawInput", "=", "arg_1", ".", "rawInput", ",", "sensorInput", "=", "arg_1", ".", "sensorInput", ",", "inferences", "=", "arg_2", ",", "metrics", "=", "arg_1", ".", "metrics", ",", "predictedFieldIdx", "=", "arg_1", ".", "predictedFieldIdx", ",", "predictedFieldName", "=", "arg_1", ".", "predictedFieldName", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Shift the model result and return the new instance.\n\n    Queues up the T(i+1) prediction value and emits a T(i)\n    input/prediction pair, if possible. E.g., if the previous T(i-1)\n    iteration was learn-only, then we would not have a T(i) prediction in our\n    FIFO and would not be able to emit a meaningful input/prediction pair.\n\n    :param modelResult: A :class:`~.nupic.frameworks.opf.opf_utils.ModelResult`\n                        instance to Func.\n    :return: A :class:`~.nupic.frameworks.opf.opf_utils.ModelResult` instance that\n             has been Funced\n    \"\"\"\n    arg_2 = {}\n\n    if arg_0._inferenceBuffer is None:\n      arg_3 = InferenceElement.getMaxDelay(arg_1.inferences)\n      arg_0._inferenceBuffer = collections.deque(maxlen=arg_3 + 1)\n\n    arg_0._inferenceBuffer.appendleft(copy.deepcopy(arg_1.inferences))\n\n    for arg_5, arg_6 in arg_1.inferences.iteritems():\n      if isinstance(arg_6, dict):\n        arg_2[arg_5] = {}\n        for arg_7, arg_8 in arg_6.iteritems():\n          arg_9 = InferenceElement.getTemporalDelay(arg_5, arg_7)\n          if len(arg_0._inferenceBuffer) > arg_9:\n            arg_10 = arg_0._inferenceBuffer[arg_9][arg_5][arg_7]\n            arg_2[arg_5][arg_7] = arg_10\n          else:\n            arg_2[arg_5][arg_7] = None\n      else:\n        arg_9 = InferenceElement.getTemporalDelay(arg_5)\n        if len(arg_0._inferenceBuffer) > arg_9:\n          arg_2[arg_5] = (\n              arg_0._inferenceBuffer[arg_9][arg_5])\n        else:\n          if type(arg_6) in (list, tuple):\n            arg_2[arg_5] = [None] * len(arg_6)\n          else:\n            arg_2[arg_5] = None\n\n    arg_11 = ModelResult(rawInput=arg_1.rawInput,\n                                sensorInput=arg_1.sensorInput,\n                                inferences=arg_2,\n                                metrics=arg_1.metrics,\n                                predictedFieldIdx=arg_1.predictedFieldIdx,\n                                predictedFieldName=arg_1.predictedFieldName)\n    return arg_11", "path": "src/nupic/data/inference_shifter.py", "identifier": "InferenceShifter.shift", "docstring": "Shift the model result and return the new instance.\n\n    Queues up the T(i+1) prediction value and emits a T(i)\n    input/prediction pair, if possible. E.g., if the previous T(i-1)\n    iteration was learn-only, then we would not have a T(i) prediction in our\n    FIFO and would not be able to emit a meaningful input/prediction pair.\n\n    :param modelResult: A :class:`~.nupic.frameworks.opf.opf_utils.ModelResult`\n                        instance to shift.\n    :return: A :class:`~.nupic.frameworks.opf.opf_utils.ModelResult` instance that\n             has been shifted", "docstring_tokens": ["Shift", "the", "model", "result", "and", "return", "the", "new", "instance", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252267}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/theater.py#L201-L216", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Sequentially update the actors, the world, and the messaging system.  \n        The theater terminates once all of the actors indicate that they are done.", "language": "python", "parameters": "(self, dt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "actors", ":", "arg_2", ".", "on_update_game", "(", "arg_1", ")", "arg_0", ".", "forum", ".", "on_update_game", "(", ")", "with", "arg_0", ".", "world", ".", "_unlock_temporarily", "(", ")", ":", "arg_0", ".", "world", ".", "on_update_game", "(", "arg_1", ")", "if", "arg_0", ".", "world", ".", "has_game_ended", "(", ")", ":", "arg_0", ".", "exit_stage", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sequentially update the actors, the world, and the messaging system.  \n        The theater terminates once all of the actors indicate that they are done.\n        \"\"\"\n\n        for arg_2 in arg_0.actors:\n            arg_2.on_update_game(arg_1)\n\n        arg_0.forum.on_update_game()\n\n        with arg_0.world._unlock_temporarily():\n            arg_0.world.on_update_game(arg_1)\n\n        if arg_0.world.has_game_ended():\n            arg_0.exit_stage()", "path": "kxg/theater.py", "identifier": "GameStage.on_update_stage", "docstring": "Sequentially update the actors, the world, and the messaging system.  \n        The theater terminates once all of the actors indicate that they are done.", "docstring_tokens": ["Sequentially", "update", "the", "actors", "the", "world", "and", "the", "messaging", "system", ".", "The", "theater", "terminates", "once", "all", "of", "the", "actors", "indicate", "that", "they", "are", "done", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 252268}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/dsl.py#L628-L632", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Create a tree.Capture", "language": "python", "parameters": "(self, sequence, cpt)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "value", "(", "arg_2", ")", "arg_1", ".", "parser_tree", "=", "parsing", ".", "Capture", "(", "arg_3", ",", "arg_1", ".", "parser_tree", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Create a tree.Capture\"\"\"\n    arg_3 = arg_0.value(arg_2)\n    arg_1.parser_tree = parsing.Capture(arg_3, arg_1.parser_tree)\n    return True", "path": "pyrser/dsl.py", "identifier": "add_capture", "docstring": "Create a tree.Capture", "docstring_tokens": ["Create", "a", "tree", ".", "Capture"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 252269}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L233-L246", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Prepare the component for execution.", "language": "python", "parameters": "(self, clock, period_count)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "components", ":", "arg_3", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "for", "arg_4", "in", "arg_0", ".", "activities", ":", "arg_4", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Prepare the component for execution.\n\n        :param clock: The clock containing the execution start time and\n          execution period information.\n        :param period_count: The total amount of periods this activity will be\n          requested to be run for.\n        \"\"\"\n\n        for arg_3 in arg_0.components:\n            arg_3.Func(arg_1, arg_2)\n        for arg_4 in arg_0.activities:\n            arg_4.Func(arg_1, arg_2)", "path": "auxi/modelling/business/structure.py", "identifier": "Component.prepare_to_run", "docstring": "Prepare the component for execution.\n\n        :param clock: The clock containing the execution start time and\n          execution period information.\n        :param period_count: The total amount of periods this activity will be\n          requested to be run for.", "docstring_tokens": ["Prepare", "the", "component", "for", "execution", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 252270}
{"url": "https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L95-L171", "sha": "6d1c77c61fc2827b71f1b3d5aa3332d7f5807820", "docstring_summary": "Parse persons from given datafield.", "language": "python", "parameters": "(self, datafield, subfield, roles=[\"aut\"])", "return_statement": "return parsed_persons", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "[", "\"aut\"", "]", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "arg_0", ".", "get_subfields", "(", "arg_1", ",", "arg_2", ")", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "arg_6", ".", "other_subfields", "if", "\"4\"", "in", "arg_7", "and", "arg_3", "!=", "[", "\"any\"", "]", ":", "arg_8", "=", "arg_7", "[", "\"4\"", "]", "arg_9", "=", "any", "(", "map", "(", "lambda", "role", ":", "role", "in", "arg_3", ",", "arg_8", ")", ")", "if", "not", "arg_9", ":", "continue", "arg_10", "=", "arg_6", ".", "i1", "arg_11", "=", "arg_6", ".", "i2", "arg_6", "=", "arg_6", ".", "strip", "(", ")", "arg_12", "=", "\"\"", "arg_13", "=", "\"\"", "arg_14", "=", "\"\"", "arg_15", "=", "\"\"", "if", "arg_10", "==", "\"1\"", "and", "arg_11", "==", "\" \"", ":", "if", "\",\"", "in", "arg_6", ":", "arg_14", ",", "arg_12", "=", "arg_6", ".", "split", "(", "\",\"", ",", "1", ")", "elif", "\" \"", "in", "arg_6", ":", "arg_14", ",", "arg_12", "=", "arg_6", ".", "split", "(", "\" \"", ",", "1", ")", "else", ":", "arg_14", "=", "arg_6", "if", "\"c\"", "in", "arg_7", ":", "arg_15", "=", "\",\"", ".", "join", "(", "arg_7", "[", "\"c\"", "]", ")", "elif", "arg_10", "==", "\"0\"", "and", "arg_11", "==", "\" \"", ":", "arg_12", "=", "arg_6", ".", "strip", "(", ")", "if", "\"b\"", "in", "arg_7", ":", "arg_13", "=", "\",\"", ".", "join", "(", "arg_7", "[", "\"b\"", "]", ")", "if", "\"c\"", "in", "arg_7", ":", "arg_14", "=", "\",\"", ".", "join", "(", "arg_7", "[", "\"c\"", "]", ")", "elif", "arg_10", "==", "\"1\"", "and", "arg_11", "==", "\"0\"", "or", "arg_10", "==", "\"0\"", "and", "arg_11", "==", "\"0\"", ":", "arg_12", "=", "arg_6", ".", "strip", "(", ")", "if", "\"c\"", "in", "arg_7", ":", "arg_15", "=", "\",\"", ".", "join", "(", "arg_7", "[", "\"c\"", "]", ")", "arg_4", ".", "append", "(", "Person", "(", "arg_12", ".", "strip", "(", ")", ",", "arg_13", ".", "strip", "(", ")", ",", "arg_14", ".", "strip", "(", ")", ",", "arg_15", ".", "strip", "(", ")", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=[\"aut\"]):\n        \"\"\"\n        Parse persons from given datafield.\n\n        Args:\n            datafield (str): code of datafield (\"010\", \"730\", etc..)\n            subfield (char):  code of subfield (\"a\", \"z\", \"4\", etc..)\n            role (list of str): set to [\"any\"] for any role, [\"aut\"] for\n                 authors, etc.. For details see\n                 http://www.loc.gov/marc/relators/relaterm.html\n\n        Main records for persons are: \"100\", \"600\" and \"700\", subrecords \"c\".\n\n        Returns:\n            list: Person objects.\n        \"\"\"\n        # parse authors\n        arg_4 = []\n        arg_5 = arg_0.get_subfields(arg_1, arg_2)\n        for arg_6 in arg_5:\n            # check if person have at least one of the roles specified in\n            # 'roles' parameter of function\n            arg_7 = arg_6.other_subfields\n            if \"4\" in arg_7 and arg_3 != [\"any\"]:\n                arg_8 = arg_7[\"4\"]  # list of role parameters\n\n                arg_9 = any(map(lambda role: role in arg_3, arg_8))\n\n                # skip non-relevant persons\n                if not arg_9:\n                    continue\n\n            # result of .strip() is string, so ind1/2 in MARCSubrecord are lost\n            arg_10 = arg_6.i1\n            arg_11 = arg_6.i2\n            arg_6 = arg_6.strip()\n\n            arg_12 = \"\"\n            arg_13 = \"\"\n            arg_14 = \"\"\n            arg_15 = \"\"\n\n            # here it gets nasty - there is lot of options in ind1/ind2\n            # parameters\n            if arg_10 == \"1\" and arg_11 == \" \":\n                if \",\" in arg_6:\n                    arg_14, arg_12 = arg_6.split(\",\", 1)\n                elif \" \" in arg_6:\n                    arg_14, arg_12 = arg_6.split(\" \", 1)\n                else:\n                    arg_14 = arg_6\n\n                if \"c\" in arg_7:\n                    arg_15 = \",\".join(arg_7[\"c\"])\n            elif arg_10 == \"0\" and arg_11 == \" \":\n                arg_12 = arg_6.strip()\n\n                if \"b\" in arg_7:\n                    arg_13 = \",\".join(arg_7[\"b\"])\n\n                if \"c\" in arg_7:\n                    arg_14 = \",\".join(arg_7[\"c\"])\n            elif arg_10 == \"1\" and arg_11 == \"0\" or arg_10 == \"0\" and arg_11 == \"0\":\n                arg_12 = arg_6.strip()\n                if \"c\" in arg_7:\n                    arg_15 = \",\".join(arg_7[\"c\"])\n\n            arg_4.append(\n                Person(\n                    arg_12.strip(),\n                    arg_13.strip(),\n                    arg_14.strip(),\n                    arg_15.strip()\n                )\n            )\n\n        return arg_4", "path": "src/marcxml_parser/query.py", "identifier": "MARCXMLQuery._parse_persons", "docstring": "Parse persons from given datafield.\n\n        Args:\n            datafield (str): code of datafield (\"010\", \"730\", etc..)\n            subfield (char):  code of subfield (\"a\", \"z\", \"4\", etc..)\n            role (list of str): set to [\"any\"] for any role, [\"aut\"] for\n                 authors, etc.. For details see\n                 http://www.loc.gov/marc/relators/relaterm.html\n\n        Main records for persons are: \"100\", \"600\" and \"700\", subrecords \"c\".\n\n        Returns:\n            list: Person objects.", "docstring_tokens": ["Parse", "persons", "from", "given", "datafield", "."], "nwo": "edeposit/marcxml_parser", "score": 0.17185066990864498, "idx": 252271}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L827-L840", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Arrange for file of debugger commands to get read in the\n        process-command loop.", "language": "python", "parameters": "(self, cmdfile)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "expanduser", "(", "arg_1", ")", "arg_3", "=", "Mfile", ".", "readable", "(", "arg_2", ")", "if", "arg_3", ":", "arg_0", ".", "cmd_queue", ".", "append", "(", "'source '", "+", "arg_2", ")", "elif", "arg_3", "is", "None", ":", "arg_0", ".", "errmsg", "(", "\"source file '%s' doesn't exist\"", "%", "arg_2", ")", "else", ":", "arg_0", ".", "errmsg", "(", "\"source file '%s' is not readable\"", "%", "arg_2", ")", "pass", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Arrange for file of debugger commands to get read in the\n        process-command loop.\"\"\"\n        arg_2 = os.path.expanduser(arg_1)\n        arg_3 = Mfile.readable(arg_2)\n        if arg_3:\n            arg_0.cmd_queue.append('source ' + arg_2)\n        elif arg_3 is None:\n            arg_0.errmsg(\"source file '%s' doesn't exist\" % arg_2)\n        else:\n            arg_0.errmsg(\"source file '%s' is not readable\" %\n                        arg_2)\n            pass\n        return", "path": "trepan/processor/cmdproc.py", "identifier": "CommandProcessor.queue_startfile", "docstring": "Arrange for file of debugger commands to get read in the\n        process-command loop.", "docstring_tokens": ["Arrange", "for", "file", "of", "debugger", "commands", "to", "get", "read", "in", "the", "process", "-", "command", "loop", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 252272}
{"url": "https://github.com/djangobot/djangobot/blob/0ec951891812ea4114c27a08c790f63d0f0fd254/djangobot/client.py#L131-L139", "sha": "0ec951891812ea4114c27a08c790f63d0f0fd254", "docstring_summary": "Get available messages and send through to the protocol", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "protocol", ".", "channel_layer", ".", "receive_many", "(", "[", "u'slack.send'", "]", ",", "block", "=", "False", ")", "arg_3", "=", "0.1", "if", "arg_1", ":", "arg_0", ".", "protocols", "[", "0", "]", ".", "sendSlack", "(", "arg_2", ")", "reactor", ".", "callLater", "(", "arg_3", ",", "arg_0", ".", "Func", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get available messages and send through to the protocol\n        \"\"\"\n        arg_1, arg_2 = arg_0.protocol.channel_layer.receive_many([u'slack.send'], block=False)\n        arg_3 = 0.1\n        if arg_1:\n            arg_0.protocols[0].sendSlack(arg_2)\n        reactor.callLater(arg_3, arg_0.Func)", "path": "djangobot/client.py", "identifier": "SlackClientFactory.read_channel", "docstring": "Get available messages and send through to the protocol", "docstring_tokens": ["Get", "available", "messages", "and", "send", "through", "to", "the", "protocol"], "nwo": "djangobot/djangobot", "score": 0.3086509652907828, "idx": 252273}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L763-L784", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Expand the wildcards for an S3 path. This emulates the shall expansion\n       for wildcards if the input is local path.", "language": "python", "parameters": "(self, source)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", "=", "[", "arg_1", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "opt", ".", "recursive", "arg_0", ".", "opt", ".", "recursive", "=", "False", "arg_2", "+=", "[", "arg_7", "[", "'name'", "]", "for", "arg_7", "in", "arg_0", ".", "s3walk", "(", "arg_3", ",", "True", ")", "]", "arg_0", ".", "opt", ".", "recursive", "=", "arg_4", "if", "(", "len", "(", "arg_2", ")", "==", "0", ")", "and", "(", "not", "arg_0", ".", "opt", ".", "ignore_empty_source", ")", ":", "fail", "(", "\"[Runtime Failure] Source doesn't exist.\"", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''Expand the wildcards for an S3 path. This emulates the shall expansion\n       for wildcards if the input is local path.\n    '''\n    arg_2 = []\n\n    if not isinstance(arg_1, list):\n      arg_1 = [arg_1]\n\n    for arg_3 in arg_1:\n      # XXX Hacky: We need to disable recursive when we expand the input\n      #            parameters, need to pass this as an override parameter if\n      #            provided.\n      arg_4 = arg_0.opt.recursive\n      arg_0.opt.recursive = False\n      arg_2 += [arg_7['name'] for arg_7 in arg_0.s3walk(arg_3, True)]\n      arg_0.opt.recursive = arg_4\n\n    if (len(arg_2) == 0) and (not arg_0.opt.ignore_empty_source):\n      fail(\"[Runtime Failure] Source doesn't exist.\")\n\n    return arg_2", "path": "s4cmd.py", "identifier": "S3Handler.source_expand", "docstring": "Expand the wildcards for an S3 path. This emulates the shall expansion\n       for wildcards if the input is local path.", "docstring_tokens": ["Expand", "the", "wildcards", "for", "an", "S3", "path", ".", "This", "emulates", "the", "shall", "expansion", "for", "wildcards", "if", "the", "input", "is", "local", "path", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 252274}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/task.py#L405-L419", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns True if parent is in the list of ancestors, returns False\n        otherwise.", "language": "python", "parameters": "(self, parent)", "return_statement": "return self.parent._is_descendant_of(parent)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "parent", "is", "None", ":", "return", "False", "if", "arg_0", ".", "parent", "==", "arg_1", ":", "return", "True", "return", "arg_0", ".", "parent", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns True if parent is in the list of ancestors, returns False\n        otherwise.\n\n        :type  parent: Task\n        :param parent: The parent that is searched in the ancestors.\n        :rtype:  bool\n        :returns: Whether the parent was found.\n        \"\"\"\n        if arg_0.parent is None:\n            return False\n        if arg_0.parent == arg_1:\n            return True\n        return arg_0.parent.Func(arg_1)", "path": "SpiffWorkflow/task.py", "identifier": "Task._is_descendant_of", "docstring": "Returns True if parent is in the list of ancestors, returns False\n        otherwise.\n\n        :type  parent: Task\n        :param parent: The parent that is searched in the ancestors.\n        :rtype:  bool\n        :returns: Whether the parent was found.", "docstring_tokens": ["Returns", "True", "if", "parent", "is", "in", "the", "list", "of", "ancestors", "returns", "False", "otherwise", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 252275}
{"url": "https://github.com/lucaslamounier/USGSDownload/blob/0969483ea9f9648aa17b099f36d2e1010488b2a4/usgsdownload/usgs.py#L184-L191", "sha": "0969483ea9f9648aa17b099f36d2e1010488b2a4", "docstring_summary": "Validate bands parameter.", "language": "python", "parameters": "(bands)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "list", ")", ":", "raise", "TypeError", "(", "'Parameter bands must be a \"list\"'", ")", "arg_1", "=", "list", "(", "range", "(", "1", ",", "12", ")", ")", "+", "[", "'BQA'", "]", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", "not", "in", "arg_1", ":", "raise", "InvalidBandError", "(", "'%s is not a valid band'", "%", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"Validate bands parameter.\"\"\"\n        if not isinstance(arg_0, list):\n            raise TypeError('Parameter bands must be a \"list\"')\n        arg_1 = list(range(1, 12)) + ['BQA']\n        for arg_2 in arg_0:\n            if arg_2 not in arg_1:\n                raise InvalidBandError('%s is not a valid band' % arg_2)", "path": "usgsdownload/usgs.py", "identifier": "USGSDownload.validate_bands", "docstring": "Validate bands parameter.", "docstring_tokens": ["Validate", "bands", "parameter", "."], "nwo": "lucaslamounier/USGSDownload", "score": 0.17782712273869106, "idx": 252276}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L216-L248", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Assemble a logline prefix using the google2 format.", "language": "python", "parameters": "(level, timestamp=None, file_and_line=None)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "global", "_level_names", "arg_3", "=", "arg_1", "or", "_time", ".", "time", "(", ")", "arg_4", "=", "_time", ".", "localtime", "(", "arg_3", ")", "arg_5", "=", "int", "(", "1e6", "*", "(", "arg_3", "%", "1.0", ")", ")", "(", "arg_6", ",", "arg_7", ")", "=", "arg_2", "or", "_GetFileAndLine", "(", ")", "arg_8", "=", "_os", ".", "path", ".", "basename", "(", "arg_6", ")", "arg_9", "=", "'I'", "if", "arg_0", "in", "_level_names", ":", "arg_9", "=", "_level_names", "[", "arg_0", "]", "[", "0", "]", "arg_10", "=", "'%c%02d%02d %02d: %02d: %02d.%06d %5d %s: %d] '", "%", "(", "arg_9", ",", "arg_4", "[", "1", "]", ",", "arg_4", "[", "2", "]", ",", "arg_4", "[", "3", "]", ",", "arg_4", "[", "4", "]", ",", "arg_4", "[", "5", "]", ",", "arg_5", ",", "_get_thread_id", "(", ")", ",", "arg_8", ",", "arg_7", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Assemble a logline prefix using the google2 format.\"\"\"\n    # pylint: disable=global-variable-not-assigned\n    global _level_names\n    # pylint: enable=global-variable-not-assigned\n\n    # Record current time\n    arg_3 = arg_1 or _time.time()\n    arg_4 = _time.localtime(arg_3)\n    arg_5 = int(1e6 * (arg_3 % 1.0))\n\n    (arg_6, arg_7) = arg_2 or _GetFileAndLine()\n    arg_8 = _os.path.basename(arg_6)\n\n    # Severity string\n    arg_9 = 'I'\n    if arg_0 in _level_names:\n        arg_9 = _level_names[arg_0][0]\n\n    arg_10 = '%c%02d%02d %02d: %02d: %02d.%06d %5d %s: %d] ' % (\n        arg_9,\n        arg_4[1],  # month\n        arg_4[2],  # day\n        arg_4[3],  # hour\n        arg_4[4],  # min\n        arg_4[5],  # sec\n        arg_5,\n        _get_thread_id(),\n        arg_8,\n        arg_7\n    )\n\n    return arg_10", "path": "tensorlayer/logging/tl_logging.py", "identifier": "google2_log_prefix", "docstring": "Assemble a logline prefix using the google2 format.", "docstring_tokens": ["Assemble", "a", "logline", "prefix", "using", "the", "google2", "format", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 252277}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/email_.py#L252-L293", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Send the message.\n        First, a message is constructed, then a session with the email\n        servers is created, finally the message is sent and the session\n        is stopped.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_generate_email", "(", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "\"Debugging info\"", "\"\\n--------------\"", "\"\\n{} Message created.\"", ".", "format", "(", "timestamp", "(", ")", ")", ")", "arg_1", "=", "[", "]", "for", "arg_2", "in", "(", "arg_0", ".", "to", ",", "arg_0", ".", "cc", ",", "arg_0", ".", "bcc", ")", ":", "if", "arg_2", ":", "if", "isinstance", "(", "arg_2", ",", "MutableSequence", ")", ":", "arg_1", "+=", "arg_2", "else", ":", "arg_1", ".", "append", "(", "arg_2", ")", "arg_3", "=", "arg_0", ".", "_get_session", "(", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "timestamp", "(", ")", ",", "\"Login successful.\"", ")", "arg_3", ".", "Funcmail", "(", "arg_0", ".", "from_", ",", "arg_1", ",", "arg_0", ".", "message", ".", "as_string", "(", ")", ")", "arg_3", ".", "quit", "(", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "timestamp", "(", ")", ",", "\"Logged out.\"", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "timestamp", "(", ")", ",", "type", "(", "arg_0", ")", ".", "__name__", "+", "\" info:\"", ",", "arg_0", ".", "__str__", "(", "indentation", "=", "\"\\n * \"", ")", ",", ")", "print", "(", "\"Message sent.\"", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Send the message.\n        First, a message is constructed, then a session with the email\n        servers is created, finally the message is sent and the session\n        is stopped.\n        \"\"\"\n        arg_0._generate_email()\n\n        if arg_0.verbose:\n            print(\n                \"Debugging info\"\n                \"\\n--------------\"\n                \"\\n{} Message created.\".format(timestamp())\n            )\n\n        arg_1 = []\n        for arg_2 in (arg_0.to, arg_0.cc, arg_0.bcc):\n            if arg_2:\n                if isinstance(arg_2, MutableSequence):\n                    arg_1 += arg_2\n                else:\n                    arg_1.append(arg_2)\n\n        arg_3 = arg_0._get_session()\n        if arg_0.verbose:\n            print(timestamp(), \"Login successful.\")\n\n        arg_3.Funcmail(arg_0.from_, arg_1, arg_0.message.as_string())\n        arg_3.quit()\n\n        if arg_0.verbose:\n            print(timestamp(), \"Logged out.\")\n\n        if arg_0.verbose:\n            print(\n                timestamp(),\n                type(arg_0).__name__ + \" info:\",\n                arg_0.__str__(indentation=\"\\n * \"),\n            )\n\n        print(\"Message sent.\")", "path": "messages/email_.py", "identifier": "Email.send", "docstring": "Send the message.\n        First, a message is constructed, then a session with the email\n        servers is created, finally the message is sent and the session\n        is stopped.", "docstring_tokens": ["Send", "the", "message", ".", "First", "a", "message", "is", "constructed", "then", "a", "session", "with", "the", "email", "servers", "is", "created", "finally", "the", "message", "is", "sent", "and", "the", "session", "is", "stopped", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 252278}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L3604-L3666", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Randomly crop an image and corresponding keypoints without influence scales, given by ``keypoint_random_resize_shortestedge``.", "language": "python", "parameters": "(image, annos, mask=None, size=(368, 368))", "return_statement": "return pose_crop(image, annos, mask, x, y, target_size[0], target_size[1])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "(", "368", ",", "368", ")", ")", ":", "arg_4", "=", "arg_3", "[", "0", "]", "arg_5", "=", "arg_3", "[", "1", "]", "arg_6", "=", "(", "arg_5", ",", "arg_4", ")", "if", "len", "(", "np", ".", "shape", "(", "arg_0", ")", ")", "==", "2", ":", "arg_0", "=", "cv2", ".", "cvtColor", "(", "arg_0", ",", "cv2", ".", "COLOR_GRAY2RGB", ")", "arg_7", ",", "arg_8", ",", "arg_9", "=", "np", ".", "shape", "(", "arg_0", ")", "for", "arg_9", "in", "range", "(", "50", ")", ":", "arg_10", "=", "random", ".", "randrange", "(", "0", ",", "arg_8", "-", "arg_6", "[", "0", "]", ")", "if", "arg_8", ">", "arg_6", "[", "0", "]", "else", "0", "arg_11", "=", "random", ".", "randrange", "(", "0", ",", "arg_7", "-", "arg_6", "[", "1", "]", ")", "if", "arg_7", ">", "arg_6", "[", "1", "]", "else", "0", "for", "arg_12", "in", "arg_1", ":", "if", "arg_10", "<=", "arg_12", "[", "0", "]", "[", "0", "]", "<", "arg_10", "+", "arg_6", "[", "0", "]", "and", "arg_11", "<=", "arg_12", "[", "0", "]", "[", "1", "]", "<", "arg_11", "+", "arg_6", "[", "1", "]", ":", "break", "def", "pose_crop", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_10", ",", "arg_11", ",", "arg_13", ",", "arg_14", ")", ":", "arg_6", "=", "(", "arg_13", ",", "arg_14", ")", "arg_15", "=", "arg_0", "arg_16", "=", "arg_15", "[", "arg_11", ":", "arg_11", "+", "arg_6", "[", "1", "]", ",", "arg_10", ":", "arg_10", "+", "arg_6", "[", "0", "]", ",", ":", "]", "arg_17", "=", "arg_2", "[", "arg_11", ":", "arg_11", "+", "arg_6", "[", "1", "]", ",", "arg_10", ":", "arg_10", "+", "arg_6", "[", "0", "]", "]", "arg_18", "=", "[", "]", "for", "arg_12", "in", "arg_1", ":", "arg_19", "=", "[", "]", "for", "arg_20", "in", "arg_12", ":", "if", "arg_20", "[", "0", "]", "<", "-", "10", "or", "arg_20", "[", "1", "]", "<", "-", "10", ":", "arg_19", ".", "append", "(", "(", "-", "1000", ",", "-", "1000", ")", ")", "continue", "arg_21", ",", "arg_22", "=", "arg_20", "[", "0", "]", "-", "arg_10", ",", "arg_20", "[", "1", "]", "-", "arg_11", "if", "arg_21", ">", "arg_13", "-", "1", "or", "arg_22", ">", "arg_14", "-", "1", ":", "arg_19", ".", "append", "(", "(", "-", "1000", ",", "-", "1000", ")", ")", "continue", "arg_19", ".", "append", "(", "(", "arg_21", ",", "arg_22", ")", ")", "arg_18", ".", "append", "(", "arg_19", ")", "return", "arg_16", ",", "arg_18", ",", "arg_17", "return", "pose_crop", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_10", ",", "arg_11", ",", "arg_6", "[", "0", "]", ",", "arg_6", "[", "1", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=(368, 368)):\n    \"\"\"Randomly crop an image and corresponding keypoints without influence scales, given by ``keypoint_random_resize_shortestedge``.\n\n    Parameters\n    -----------\n    image : 3 channel image\n        The given image for augmentation.\n    annos : list of list of floats\n        The keypoints annotation of people.\n    mask : single channel image or None\n        The mask if available.\n    size : tuple of int\n        The size of returned image.\n\n    Returns\n    ----------\n    preprocessed image, annotation, mask\n\n    \"\"\"\n\n    arg_4 = arg_3[0]\n    arg_5 = arg_3[1]\n    arg_6 = (arg_5, arg_4)\n\n    if len(np.shape(arg_0)) == 2:\n        arg_0 = cv2.cvtColor(arg_0, cv2.COLOR_GRAY2RGB)\n    arg_7, arg_8, arg_9 = np.shape(arg_0)\n\n    for arg_9 in range(50):\n        arg_10 = random.randrange(0, arg_8 - arg_6[0]) if arg_8 > arg_6[0] else 0\n        arg_11 = random.randrange(0, arg_7 - arg_6[1]) if arg_7 > arg_6[1] else 0\n\n        # check whether any face is inside the box to generate a reasonably-balanced datasets\n        for arg_12 in arg_1:\n            if arg_10 <= arg_12[0][0] < arg_10 + arg_6[0] and arg_11 <= arg_12[0][1] < arg_11 + arg_6[1]:\n                break\n\n    def pose_crop(arg_0, arg_1, arg_2, arg_10, arg_11, arg_13, arg_14):  # TODO : speed up with affine transform\n        # adjust image\n        arg_6 = (arg_13, arg_14)\n\n        arg_15 = arg_0\n        arg_16 = arg_15[arg_11:arg_11 + arg_6[1], arg_10:arg_10 + arg_6[0], :]\n        arg_17 = arg_2[arg_11:arg_11 + arg_6[1], arg_10:arg_10 + arg_6[0]]\n        # adjust meta data\n        arg_18 = []\n        for arg_12 in arg_1:\n            arg_19 = []\n            for arg_20 in arg_12:\n                if arg_20[0] < -10 or arg_20[1] < -10:\n                    arg_19.append((-1000, -1000))\n                    continue\n                arg_21, arg_22 = arg_20[0] - arg_10, arg_20[1] - arg_11\n                # should not crop outside the image\n                if arg_21 > arg_13 - 1 or arg_22 > arg_14 - 1:\n                    arg_19.append((-1000, -1000))\n                    continue\n                arg_19.append((arg_21, arg_22))\n            arg_18.append(arg_19)\n\n        return arg_16, arg_18, arg_17\n\n    return pose_crop(arg_0, arg_1, arg_2, arg_10, arg_11, arg_6[0], arg_6[1])", "path": "tensorlayer/prepro.py", "identifier": "keypoint_random_crop", "docstring": "Randomly crop an image and corresponding keypoints without influence scales, given by ``keypoint_random_resize_shortestedge``.\n\n    Parameters\n    -----------\n    image : 3 channel image\n        The given image for augmentation.\n    annos : list of list of floats\n        The keypoints annotation of people.\n    mask : single channel image or None\n        The mask if available.\n    size : tuple of int\n        The size of returned image.\n\n    Returns\n    ----------\n    preprocessed image, annotation, mask", "docstring_tokens": ["Randomly", "crop", "an", "image", "and", "corresponding", "keypoints", "without", "influence", "scales", "given", "by", "keypoint_random_resize_shortestedge", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 252279}
{"url": "https://github.com/philipsoutham/py-mysql2pgsql/blob/66dc2a3a3119263b3fe77300fb636346509787ef/mysql2pgsql/lib/postgres_writer.py#L149-L191", "sha": "66dc2a3a3119263b3fe77300fb636346509787ef", "docstring_summary": "Examines row data from MySQL and alters\n        the values when necessary to be compatible with\n        sending to PostgreSQL via the copy command", "language": "python", "parameters": "(self, table, row)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ".", "columns", ")", ":", "arg_5", "=", "hash", "(", "frozenset", "(", "arg_4", ".", "items", "(", ")", ")", ")", "arg_6", "=", "arg_0", ".", "column_types", "[", "arg_5", "]", "if", "arg_5", "in", "arg_0", ".", "column_types", "else", "arg_0", ".", "column_type", "(", "arg_4", ")", "if", "arg_2", "[", "arg_3", "]", "==", "None", "and", "(", "'timestamp'", "not", "in", "arg_6", "or", "not", "arg_4", "[", "'default'", "]", ")", ":", "arg_2", "[", "arg_3", "]", "=", "'\\N'", "elif", "arg_2", "[", "arg_3", "]", "==", "None", "and", "arg_4", "[", "'default'", "]", ":", "if", "arg_0", ".", "tz", ":", "arg_2", "[", "arg_3", "]", "=", "'1970-01-01T00:00:00.000000'", "+", "arg_0", ".", "tz_offset", "else", ":", "arg_2", "[", "arg_3", "]", "=", "'1970-01-01 00:00:00'", "elif", "'bit'", "in", "arg_6", ":", "arg_2", "[", "arg_3", "]", "=", "bin", "(", "ord", "(", "arg_2", "[", "arg_3", "]", ")", ")", "[", "2", ":", "]", "elif", "isinstance", "(", "arg_2", "[", "arg_3", "]", ",", "(", "str", ",", "unicode", ",", "basestring", ")", ")", ":", "if", "arg_6", "==", "'bytea'", ":", "arg_2", "[", "arg_3", "]", "=", "Binary", "(", "arg_2", "[", "arg_3", "]", ")", ".", "getquoted", "(", ")", "[", "1", ":", "-", "8", "]", "if", "arg_2", "[", "arg_3", "]", "else", "arg_2", "[", "arg_3", "]", "elif", "'text['", "in", "arg_6", ":", "arg_2", "[", "arg_3", "]", "=", "'{%s}'", "%", "','", ".", "join", "(", "'\"%s\"'", "%", "v", ".", "replace", "(", "'\"'", ",", "r'\\\"'", ")", "for", "v", "in", "arg_2", "[", "arg_3", "]", ".", "split", "(", "','", ")", ")", "else", ":", "arg_2", "[", "arg_3", "]", "=", "arg_2", "[", "arg_3", "]", ".", "replace", "(", "'\\\\'", ",", "r'\\\\'", ")", ".", "replace", "(", "'\\n'", ",", "r'\\n'", ")", ".", "replace", "(", "'\\t'", ",", "r'\\t'", ")", ".", "replace", "(", "'\\r'", ",", "r'\\r'", ")", ".", "replace", "(", "'\\0'", ",", "''", ")", "elif", "arg_6", "==", "'boolean'", ":", "arg_2", "[", "arg_3", "]", "=", "'t'", "if", "arg_2", "[", "arg_3", "]", "not", "in", "(", "None", ",", "0", ")", "else", "'f'", "if", "arg_2", "[", "arg_3", "]", "==", "0", "else", "arg_2", "[", "arg_3", "]", "elif", "isinstance", "(", "arg_2", "[", "arg_3", "]", ",", "(", "date", ",", "datetime", ")", ")", ":", "if", "isinstance", "(", "arg_2", "[", "arg_3", "]", ",", "datetime", ")", "and", "arg_0", ".", "tz", ":", "try", ":", "if", "arg_2", "[", "arg_3", "]", ".", "tzinfo", ":", "arg_2", "[", "arg_3", "]", "=", "arg_2", "[", "arg_3", "]", ".", "astimezone", "(", "arg_0", ".", "tz", ")", ".", "isoformat", "(", ")", "else", ":", "arg_2", "[", "arg_3", "]", "=", "datetime", "(", "*", "arg_2", "[", "arg_3", "]", ".", "timetuple", "(", ")", "[", ":", "6", "]", ",", "tzinfo", "=", "arg_0", ".", "tz", ")", ".", "isoformat", "(", ")", "except", "Exception", "as", "e", ":", "print", "e", ".", "message", "else", ":", "arg_2", "[", "arg_3", "]", "=", "arg_2", "[", "arg_3", "]", ".", "isoformat", "(", ")", "elif", "isinstance", "(", "arg_2", "[", "arg_3", "]", ",", "timedelta", ")", ":", "arg_2", "[", "arg_3", "]", "=", "datetime", ".", "utcfromtimestamp", "(", "_get_total_seconds", "(", "arg_2", "[", "arg_3", "]", ")", ")", ".", "time", "(", ")", ".", "isoformat", "(", ")", "else", ":", "arg_2", "[", "arg_3", "]", "=", "AsIs", "(", "arg_2", "[", "arg_3", "]", ")", ".", "getquoted", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Examines row data from MySQL and alters\n        the values when necessary to be compatible with\n        sending to PostgreSQL via the copy command\n        \"\"\"\n        for arg_3, arg_4 in enumerate(arg_1.columns):\n            arg_5 = hash(frozenset(arg_4.items()))\n            arg_6 = arg_0.column_types[arg_5] if arg_5 in arg_0.column_types else arg_0.column_type(arg_4)\n            if arg_2[arg_3] == None and ('timestamp' not in arg_6 or not arg_4['default']):\n                arg_2[arg_3] = '\\N'\n            elif arg_2[arg_3] == None and arg_4['default']:\n                if arg_0.tz:\n                    arg_2[arg_3] = '1970-01-01T00:00:00.000000' + arg_0.tz_offset\n                else:\n                    arg_2[arg_3] = '1970-01-01 00:00:00'\n            elif 'bit' in arg_6:\n                arg_2[arg_3] = bin(ord(arg_2[arg_3]))[2:]\n            elif isinstance(arg_2[arg_3], (str, unicode, basestring)):\n                if arg_6 == 'bytea':\n                    arg_2[arg_3] = Binary(arg_2[arg_3]).getquoted()[1:-8] if arg_2[arg_3] else arg_2[arg_3]\n                elif 'text[' in arg_6:\n                    arg_2[arg_3] = '{%s}' % ','.join('\"%s\"' % v.replace('\"', r'\\\"') for v in arg_2[arg_3].split(','))\n                else:\n                    arg_2[arg_3] = arg_2[arg_3].replace('\\\\', r'\\\\').replace('\\n', r'\\n').replace(\n                        '\\t', r'\\t').replace('\\r', r'\\r').replace('\\0', '')\n            elif arg_6 == 'boolean':\n                # We got here because you used a tinyint(1), if you didn't want a bool, don't use that type\n                arg_2[arg_3] = 't' if arg_2[arg_3] not in (None, 0) else 'f' if arg_2[arg_3] == 0 else arg_2[arg_3]\n            elif isinstance(arg_2[arg_3], (date, datetime)):\n                if isinstance(arg_2[arg_3], datetime) and arg_0.tz:\n                    try:\n                        if arg_2[arg_3].tzinfo:\n                            arg_2[arg_3] = arg_2[arg_3].astimezone(arg_0.tz).isoformat()\n                        else:\n                            arg_2[arg_3] = datetime(*arg_2[arg_3].timetuple()[:6], tzinfo=arg_0.tz).isoformat()\n                    except Exception as e:\n                        print e.message\n                else:\n                    arg_2[arg_3] = arg_2[arg_3].isoformat()\n            elif isinstance(arg_2[arg_3], timedelta):\n                arg_2[arg_3] = datetime.utcfromtimestamp(_get_total_seconds(arg_2[arg_3])).time().isoformat()\n            else:\n                arg_2[arg_3] = AsIs(arg_2[arg_3]).getquoted()", "path": "mysql2pgsql/lib/postgres_writer.py", "identifier": "PostgresWriter.process_row", "docstring": "Examines row data from MySQL and alters\n        the values when necessary to be compatible with\n        sending to PostgreSQL via the copy command", "docstring_tokens": ["Examines", "row", "data", "from", "MySQL", "and", "alters", "the", "values", "when", "necessary", "to", "be", "compatible", "with", "sending", "to", "PostgreSQL", "via", "the", "copy", "command"], "nwo": "philipsoutham/py-mysql2pgsql", "score": 0.632634572866938, "idx": 252280}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/pkg_resources.py#L2505-L2530", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Recompute this distribution's dependencies.", "language": "python", "parameters": "(self)", "return_statement": "return dm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "_markerlib", "import", "compile", "as", "compile_marker", "arg_1", "=", "arg_0", ".", "__dep_map", "=", "{", "None", ":", "[", "]", "}", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "_parsed_pkg_info", ".", "get_all", "(", "'Requires-Dist'", ")", "or", "[", "]", ":", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_preparse_requirement", "(", "arg_3", ")", "arg_6", "=", "parse_requirements", "(", "arg_4", ")", ".", "next", "(", ")", "arg_6", ".", "marker_fn", "=", "compile_marker", "(", "arg_5", ")", "arg_2", ".", "append", "(", "arg_6", ")", "def", "reqs_for_extra", "(", "arg_8", ")", ":", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", ".", "marker_fn", "(", "override", "=", "{", "'extra'", ":", "arg_8", "}", ")", ":", "yield", "arg_3", "arg_9", "=", "frozenset", "(", "reqs_for_extra", "(", "None", ")", ")", "arg_1", "[", "None", "]", ".", "extend", "(", "arg_9", ")", "for", "arg_8", "in", "arg_0", ".", "_parsed_pkg_info", ".", "get_all", "(", "'Provides-Extra'", ")", "or", "[", "]", ":", "arg_8", "=", "safe_extra", "(", "arg_8", ".", "strip", "(", ")", ")", "arg_1", "[", "arg_8", "]", "=", "list", "(", "frozenset", "(", "reqs_for_extra", "(", "arg_8", ")", ")", "-", "arg_9", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Recompute this distribution's dependencies.\"\"\"\n        from _markerlib import compile as compile_marker\n        arg_1 = arg_0.__dep_map = {None: []}\n\n        arg_2 = []\n        # Including any condition expressions\n        for arg_3 in arg_0._parsed_pkg_info.get_all('Requires-Dist') or []:\n            arg_4, arg_5 = arg_0._preparse_requirement(arg_3)\n            arg_6 = parse_requirements(arg_4).next()\n            arg_6.marker_fn = compile_marker(arg_5)\n            arg_2.append(arg_6)\n\n        def reqs_for_extra(arg_8):\n            for arg_3 in arg_2:\n                if arg_3.marker_fn(override={'extra':arg_8}):\n                    yield arg_3\n\n        arg_9 = frozenset(reqs_for_extra(None))\n        arg_1[None].extend(arg_9)\n\n        for arg_8 in arg_0._parsed_pkg_info.get_all('Provides-Extra') or []:\n            arg_8 = safe_extra(arg_8.strip())\n            arg_1[arg_8] = list(frozenset(reqs_for_extra(arg_8)) - arg_9)\n\n        return arg_1", "path": "environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/pkg_resources.py", "identifier": "DistInfoDistribution._compute_dependencies", "docstring": "Recompute this distribution's dependencies.", "docstring_tokens": ["Recompute", "this", "distribution", "s", "dependencies", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252281}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/palettes.py#L605-L648", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Create a palette that desaturate a color by some proportion", "language": "python", "parameters": "(color, prop, reverse=False)", "return_statement": "return gradient_n_pal(colors, name='desaturated')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "0", "<=", "arg_1", "<=", "1", ":", "raise", "ValueError", "(", "\"prop must be between 0 and 1\"", ")", "arg_3", "=", "mcolors", ".", "colorConverter", ".", "to_rgb", "(", "arg_0", ")", "arg_4", ",", "arg_5", ",", "arg_6", "=", "colorsys", ".", "rgb_to_hls", "(", "*", "arg_3", ")", "arg_6", "*=", "arg_1", "arg_7", "=", "colorsys", ".", "hls_to_rgb", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", "arg_8", "=", "[", "arg_0", ",", "arg_7", "]", "if", "arg_2", ":", "arg_8", "=", "arg_8", "[", ":", ":", "-", "1", "]", "return", "gradient_n_pal", "(", "arg_8", ",", "name", "=", "'desaturated'", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Create a palette that desaturate a color by some proportion\n\n    Parameters\n    ----------\n    color : matplotlib color\n        hex, rgb-tuple, or html color name\n    prop : float\n        saturation channel of color will be multiplied by\n        this value\n    reverse : bool\n        Whether to reverse the palette.\n\n    Returns\n    -------\n    out : function\n        Continuous color palette that takes a single\n        parameter either a :class:`float` or a sequence\n        of floats maps those value(s) onto the palette\n        and returns color(s). The float(s) must be\n        in the range [0, 1].\n\n    Examples\n    --------\n    >>> palette = Func('red', .1)\n    >>> palette([0, .25, .5, .75, 1])\n    ['#ff0000', '#e21d1d', '#c53a3a', '#a95656', '#8c7373']\n    \"\"\"\n    if not 0 <= arg_1 <= 1:\n        raise ValueError(\"prop must be between 0 and 1\")\n\n    # Get rgb tuple rep\n    # Convert to hls\n    # Desaturate the saturation channel\n    # Convert back to rgb\n    arg_3 = mcolors.colorConverter.to_rgb(arg_0)\n    arg_4, arg_5, arg_6 = colorsys.rgb_to_hls(*arg_3)\n    arg_6 *= arg_1\n    arg_7 = colorsys.hls_to_rgb(arg_4, arg_5, arg_6)\n    arg_8 = [arg_0, arg_7]\n    if arg_2:\n        arg_8 = arg_8[::-1]\n    return gradient_n_pal(arg_8, name='desaturated')", "path": "mizani/palettes.py", "identifier": "desaturate_pal", "docstring": "Create a palette that desaturate a color by some proportion\n\n    Parameters\n    ----------\n    color : matplotlib color\n        hex, rgb-tuple, or html color name\n    prop : float\n        saturation channel of color will be multiplied by\n        this value\n    reverse : bool\n        Whether to reverse the palette.\n\n    Returns\n    -------\n    out : function\n        Continuous color palette that takes a single\n        parameter either a :class:`float` or a sequence\n        of floats maps those value(s) onto the palette\n        and returns color(s). The float(s) must be\n        in the range [0, 1].\n\n    Examples\n    --------\n    >>> palette = desaturate_pal('red', .1)\n    >>> palette([0, .25, .5, .75, 1])\n    ['#ff0000', '#e21d1d', '#c53a3a', '#a95656', '#8c7373']", "docstring_tokens": ["Create", "a", "palette", "that", "desaturate", "a", "color", "by", "some", "proportion"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 252282}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/conf.py#L263-L279", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Maintains the context of the runtime settings for invoking\n        a command.", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "_runtime", ".", "has_option", "(", "'general'", ",", "arg_1", ")", ":", "arg_0", ".", "_runtime", "=", "arg_0", ".", "_new_parser", "(", ")", "if", "arg_2", "is", "None", ":", "return", "settings", ".", "_runtime", ".", "set", "(", "'general'", ",", "arg_1", ".", "replace", "(", "'tower_'", ",", "''", ")", ",", "six", ".", "text_type", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Maintains the context of the runtime settings for invoking\n        a command.\n\n        This should be called by a click.option callback, and only\n        called once for each setting for each command invocation.\n\n        If the setting exists, it follows that the runtime settings are\n        stale, so the entire runtime settings are reset.\n        \"\"\"\n        if arg_0._runtime.has_option('general', arg_1):\n            arg_0._runtime = arg_0._new_parser()\n\n        if arg_2 is None:\n            return\n        settings._runtime.set('general', arg_1.replace('tower_', ''),\n                              six.text_type(arg_2))", "path": "tower_cli/conf.py", "identifier": "Settings.set_or_reset_runtime_param", "docstring": "Maintains the context of the runtime settings for invoking\n        a command.\n\n        This should be called by a click.option callback, and only\n        called once for each setting for each command invocation.\n\n        If the setting exists, it follows that the runtime settings are\n        stale, so the entire runtime settings are reset.", "docstring_tokens": ["Maintains", "the", "context", "of", "the", "runtime", "settings", "for", "invoking", "a", "command", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 252283}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/forms/forms.py#L67-L74", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Generate the form for view.", "language": "python", "parameters": "(self)", "return_statement": "return self.form", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "set_fields", "(", ")", "if", "arg_0", ".", "post_data_dict", "is", "not", "None", ":", "arg_0", ".", "set_post_data", "(", ")", "return", "arg_0", ".", "form"], "function": "def Func(arg_0):\n        \"\"\"\n        Generate the form for view.\n        \"\"\"\n        arg_0.set_fields()\n        if arg_0.post_data_dict is not None:\n            arg_0.set_post_data()\n        return arg_0.form", "path": "mongonaut/forms/forms.py", "identifier": "MongoModelForm.get_form", "docstring": "Generate the form for view.", "docstring_tokens": ["Generate", "the", "form", "for", "view", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 252284}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L126-L140", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Retrive an artist with a spotify ID.", "language": "python", "parameters": "(self, spotify_id: str)", "return_statement": "return Artist(self, data)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Artist", ":", "arg_3", "=", "await", "arg_0", ".", "http", ".", "artist", "(", "to_id", "(", "arg_1", ")", ")", "return", "Artist", "(", "arg_0", ",", "arg_3", ")"], "function": "async def Func(arg_0, arg_1: arg_2) -> Artist:\n        \"\"\"Retrive an artist with a spotify ID.\n\n        Parameters\n        ----------\n        spotify_id : str\n            The ID to search for.\n\n        Returns\n        -------\n        artist : Artist\n            The artist from the ID\n        \"\"\"\n        arg_3 = await arg_0.http.artist(to_id(arg_1))\n        return Artist(arg_0, arg_3)", "path": "spotify/client.py", "identifier": "Client.get_artist", "docstring": "Retrive an artist with a spotify ID.\n\n        Parameters\n        ----------\n        spotify_id : str\n            The ID to search for.\n\n        Returns\n        -------\n        artist : Artist\n            The artist from the ID", "docstring_tokens": ["Retrive", "an", "artist", "with", "a", "spotify", "ID", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 252285}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L1469-L1473", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Locks all non-empty derived parameters", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "_derived_parameters", ".", "values", "(", ")", ":", "if", "not", "arg_1", ".", "f_is_empty", "(", ")", ":", "arg_1", ".", "f_lock", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Locks all non-empty derived parameters\"\"\"\n        for arg_1 in arg_0._derived_parameters.values():\n            if not arg_1.f_is_empty():\n                arg_1.f_lock()", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_lock_derived_parameters", "docstring": "Locks all non-empty derived parameters", "docstring_tokens": ["Locks", "all", "non", "-", "empty", "derived", "parameters"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252286}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py#L103-L114", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "List the web sites defined on this webspace.", "language": "python", "parameters": "(self, webspace_name, website_name)", "return_statement": "return self._perform_get(self._get_sites_details_path(webspace_name,\n                                                              website_name),\n                                 Site)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_Funcs_details_path", "(", "arg_1", ",", "arg_2", ")", ",", "Site", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        List the web sites defined on this webspace.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        '''\n        return arg_0._perform_get(arg_0._Funcs_details_path(arg_1,\n                                                              arg_2),\n                                 Site)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py", "identifier": "WebsiteManagementService.get_site", "docstring": "List the web sites defined on this webspace.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.", "docstring_tokens": ["List", "the", "web", "sites", "defined", "on", "this", "webspace", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252287}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1738-L1761", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "_doCascadeFetch - Takes an object and performs a cascading fetch on all foreign links, and all theirs, and so on.", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "validateModel", "(", ")", "if", "not", "arg_0", ".", "foreignFields", ":", "return", "for", "arg_1", "in", "arg_0", ".", "foreignFields", ":", "arg_2", "=", "object", ".", "__getattribute__", "(", "arg_0", ",", "arg_1", ")", "if", "not", "arg_2", ":", "setattr", "(", "arg_0", ",", "str", "(", "arg_1", ")", ",", "irNull", ")", "continue", "arg_3", "=", "arg_2", ".", "getObjs", "(", ")", "for", "arg_4", "in", "arg_3", ":", "if", "isIndexedRedisModel", "(", "arg_4", ")", ":", "IndexedRedisQuery", ".", "Func", "(", "arg_4", ")"], "function": "def Func(arg_0):\n\t\t'''\n\t\t\tFunc - Takes an object and performs a cascading fetch on all foreign links, and all theirs, and so on.\n\n\t\t\t@param obj <IndexedRedisModel> - A fetched model\n\t\t'''\n\t\targ_0.validateModel()\n\n\t\tif not arg_0.foreignFields:\n\t\t\treturn\n\n\t\t  # NOTE: Currently this fetches using one transaction per object. Implementation for actual resolution is in\n\t\t  #   IndexedRedisModel.__getattribute__ \n\n\t\tfor arg_1 in arg_0.foreignFields:\n\t\t\targ_2 = object.__getattribute__(arg_0, arg_1)\n\t\t\tif not arg_2:\n\t\t\t\tsetattr(arg_0, str(arg_1), irNull)\n\t\t\t\tcontinue\n\t\t\targ_3 = arg_2.getObjs()\n\t\t\t\n\t\t\tfor arg_4 in arg_3:\n\t\t\t\tif isIndexedRedisModel(arg_4):\n\t\t\t\t\tIndexedRedisQuery.Func(arg_4)", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisQuery._doCascadeFetch", "docstring": "_doCascadeFetch - Takes an object and performs a cascading fetch on all foreign links, and all theirs, and so on.\n\n\t\t\t@param obj <IndexedRedisModel> - A fetched model", "docstring_tokens": ["_doCascadeFetch", "-", "Takes", "an", "object", "and", "performs", "a", "cascading", "fetch", "on", "all", "foreign", "links", "and", "all", "theirs", "and", "so", "on", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 252288}
{"url": "https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/genesis.py#L296-L345", "sha": "dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a", "docstring_summary": "Upload a single file on the platform.", "language": "python", "parameters": "(self, fn)", "return_statement": "return session_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "getsize", "(", "arg_1", ")", "arg_3", "=", "0", "arg_4", "=", "os", ".", "path", ".", "basename", "(", "arg_1", ")", "arg_5", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "f", ":", "while", "True", ":", "arg_6", "=", "None", "arg_7", "=", "f", ".", "read", "(", "CHUNK_SIZE", ")", "if", "not", "arg_7", ":", "break", "for", "arg_8", "in", "range", "(", "5", ")", ":", "content_range", "=", "'bytes {}-{}/{}'", ".", "format", "(", "arg_3", "*", "CHUNK_SIZE", ",", "arg_3", "*", "CHUNK_SIZE", "+", "len", "(", "arg_7", ")", "-", "1", ",", "arg_2", ")", "if", "arg_8", ">", "0", "and", "arg_6", "is", "not", "None", ":", "print", "(", "\"Chunk upload failed (error {}): repeating {}\"", ".", "format", "(", "arg_6", ".", "status_code", ",", "content_range", ")", ")", "arg_6", "=", "requests", ".", "post", "(", "urlparse", ".", "urljoin", "(", "arg_0", ".", "url", ",", "'upload/'", ")", ",", "auth", "=", "arg_0", ".", "auth", ",", "data", "=", "arg_7", ",", "headers", "=", "{", "'Content-Disposition'", ":", "'attachment; filename=\"{}\"'", ".", "format", "(", "arg_4", ")", ",", "'Content-Length'", ":", "arg_2", ",", "'Content-Range'", ":", "content_range", ",", "'Content-Type'", ":", "'application/octet-stream'", ",", "'Session-Id'", ":", "arg_5", "}", ")", "if", "arg_6", ".", "status_code", "in", "[", "200", ",", "201", "]", ":", "break", "else", ":", "return", "None", "arg_9", "=", "100.", "*", "(", "arg_3", "*", "CHUNK_SIZE", "+", "len", "(", "arg_7", ")", ")", "/", "arg_2", "sys", ".", "stdout", ".", "write", "(", "\"\\r{:.0f} % Uploading {}\"", ".", "format", "(", "arg_9", ",", "arg_1", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "arg_3", "+=", "1", "print", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Upload a single file on the platform.\n\n        File is uploaded in chunks of 1,024 bytes.\n\n        :param fn: File path\n        :type fn: string\n\n        \"\"\"\n        arg_2 = os.path.getsize(arg_1)\n        arg_3 = 0\n        arg_4 = os.path.basename(arg_1)\n        arg_5 = str(uuid.uuid4())\n\n        with open(arg_1, 'rb') as f:\n            while True:\n                arg_6 = None\n                arg_7 = f.read(CHUNK_SIZE)\n                if not arg_7:\n                    break\n\n                for arg_8 in range(5):\n                    content_range = 'bytes {}-{}/{}'.format(arg_3 * CHUNK_SIZE,\n                                                            arg_3 * CHUNK_SIZE + len(arg_7) - 1, arg_2)\n                    if arg_8 > 0 and arg_6 is not None:\n                        print(\"Chunk upload failed (error {}): repeating {}\"\n                              .format(arg_6.status_code, content_range))\n\n                    arg_6 = requests.post(urlparse.urljoin(arg_0.url, 'upload/'),\n                                             auth=arg_0.auth,\n                                             data=arg_7,\n                                             headers={\n                                                 'Content-Disposition': 'attachment; filename=\"{}\"'.format(arg_4),\n                                                 'Content-Length': arg_2,\n                                                 'Content-Range': content_range,\n                                                 'Content-Type': 'application/octet-stream',\n                                                 'Session-Id': arg_5})\n\n                    if arg_6.status_code in [200, 201]:\n                        break\n                else:\n                    # Upload of a chunk failed (5 retries)\n                    return None\n\n                arg_9 = 100. * (arg_3 * CHUNK_SIZE + len(arg_7)) / arg_2\n                sys.stdout.write(\"\\r{:.0f} % Uploading {}\".format(arg_9, arg_1))\n                sys.stdout.flush()\n                arg_3 += 1\n        print()\n        return arg_5", "path": "genesis/genesis.py", "identifier": "Genesis._upload_file", "docstring": "Upload a single file on the platform.\n\n        File is uploaded in chunks of 1,024 bytes.\n\n        :param fn: File path\n        :type fn: string", "docstring_tokens": ["Upload", "a", "single", "file", "on", "the", "platform", "."], "nwo": "genialis/genesis-pyapi", "score": 0.27692002097430746, "idx": 252289}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/lmm/_lmm_scan.py#L202-L265", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "LMLs, fixed-effect sizes, and scales for single-marker scan.", "language": "python", "parameters": "(self, M, verbose=True)", "return_statement": "return {\n            \"lml\": lmls,\n            \"effsizes0\": effsizes0,\n            \"effsizes0_se\": effsizes0_se,\n            \"effsizes1\": effsizes1,\n            \"effsizes1_se\": effsizes1_se,\n            \"scale\": scales,\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "from", "tqdm", "import", "tqdm", "if", "arg_1", ".", "ndim", "!=", "2", ":", "raise", "ValueError", "(", "\"`M` array must be bidimensional.\"", ")", "arg_3", "=", "arg_1", ".", "shape", "[", "1", "]", "arg_4", "=", "empty", "(", "arg_3", ")", "arg_5", "=", "empty", "(", "(", "arg_3", ",", "arg_0", ".", "_XTQ", "[", "0", "]", ".", "shape", "[", "0", "]", ")", ")", "arg_6", "=", "empty", "(", "(", "arg_3", ",", "arg_0", ".", "_XTQ", "[", "0", "]", ".", "shape", "[", "0", "]", ")", ")", "arg_7", "=", "empty", "(", "arg_3", ")", "arg_8", "=", "empty", "(", "arg_3", ")", "arg_9", "=", "empty", "(", "arg_3", ")", "if", "arg_2", ":", "arg_10", "=", "min", "(", "arg_3", ",", "30", ")", "else", ":", "arg_10", "=", "min", "(", "arg_3", ",", "1", ")", "arg_11", "=", "(", "arg_3", "+", "arg_10", "-", "1", ")", "//", "arg_10", "for", "arg_12", "in", "tqdm", "(", "range", "(", "arg_10", ")", ",", "desc", "=", "\"Scanning\"", ",", "disable", "=", "not", "arg_2", ")", ":", "arg_13", "=", "arg_12", "*", "arg_11", "arg_14", "=", "min", "(", "arg_13", "+", "arg_11", ",", "arg_1", ".", "shape", "[", "1", "]", ")", "arg_15", "=", "arg_0", ".", "_Func_chunk", "(", "arg_1", "[", ":", ",", "arg_13", ":", "arg_14", "]", ")", "arg_4", "[", "arg_13", ":", "arg_14", "]", "=", "arg_15", "[", "\"lml\"", "]", "arg_5", "[", "arg_13", ":", "arg_14", ",", ":", "]", "=", "arg_15", "[", "\"effsizes0\"", "]", "arg_6", "[", "arg_13", ":", "arg_14", ",", ":", "]", "=", "arg_15", "[", "\"effsizes0_se\"", "]", "arg_7", "[", "arg_13", ":", "arg_14", "]", "=", "arg_15", "[", "\"effsizes1\"", "]", "arg_8", "[", "arg_13", ":", "arg_14", "]", "=", "arg_15", "[", "\"effsizes1_se\"", "]", "arg_9", "[", "arg_13", ":", "arg_14", "]", "=", "arg_15", "[", "\"scale\"", "]", "return", "{", "\"lml\"", ":", "arg_4", ",", "\"effsizes0\"", ":", "arg_5", ",", "\"effsizes0_se\"", ":", "arg_6", ",", "\"effsizes1\"", ":", "arg_7", ",", "\"effsizes1_se\"", ":", "arg_8", ",", "\"scale\"", ":", "arg_9", ",", "}"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        LMLs, fixed-effect sizes, and scales for single-marker scan.\n\n        Parameters\n        ----------\n        M : array_like\n            Matrix of fixed-effects across columns.\n        verbose : bool, optional\n            ``True`` for progress information; ``False`` otherwise.\n            Defaults to ``True``.\n\n        Returns\n        -------\n        lmls : ndarray\n            Log of the marginal likelihoods.\n        effsizes0 : ndarray\n            Covariate fixed-effect sizes.\n        effsizes1 : ndarray\n            Candidate set fixed-effect sizes.\n        scales : ndarray\n            Scales.\n        \"\"\"\n        from tqdm import tqdm\n\n        if arg_1.ndim != 2:\n            raise ValueError(\"`M` array must be bidimensional.\")\n        arg_3 = arg_1.shape[1]\n\n        arg_4 = empty(arg_3)\n        arg_5 = empty((arg_3, arg_0._XTQ[0].shape[0]))\n        arg_6 = empty((arg_3, arg_0._XTQ[0].shape[0]))\n        arg_7 = empty(arg_3)\n        arg_8 = empty(arg_3)\n        arg_9 = empty(arg_3)\n\n        if arg_2:\n            arg_10 = min(arg_3, 30)\n        else:\n            arg_10 = min(arg_3, 1)\n\n        arg_11 = (arg_3 + arg_10 - 1) // arg_10\n\n        for arg_12 in tqdm(range(arg_10), desc=\"Scanning\", disable=not arg_2):\n            arg_13 = arg_12 * arg_11\n            arg_14 = min(arg_13 + arg_11, arg_1.shape[1])\n\n            arg_15 = arg_0._Func_chunk(arg_1[:, arg_13:arg_14])\n\n            arg_4[arg_13:arg_14] = arg_15[\"lml\"]\n            arg_5[arg_13:arg_14, :] = arg_15[\"effsizes0\"]\n            arg_6[arg_13:arg_14, :] = arg_15[\"effsizes0_se\"]\n            arg_7[arg_13:arg_14] = arg_15[\"effsizes1\"]\n            arg_8[arg_13:arg_14] = arg_15[\"effsizes1_se\"]\n            arg_9[arg_13:arg_14] = arg_15[\"scale\"]\n\n        return {\n            \"lml\": arg_4,\n            \"effsizes0\": arg_5,\n            \"effsizes0_se\": arg_6,\n            \"effsizes1\": arg_7,\n            \"effsizes1_se\": arg_8,\n            \"scale\": arg_9,\n        }", "path": "glimix_core/lmm/_lmm_scan.py", "identifier": "FastScanner.fast_scan", "docstring": "LMLs, fixed-effect sizes, and scales for single-marker scan.\n\n        Parameters\n        ----------\n        M : array_like\n            Matrix of fixed-effects across columns.\n        verbose : bool, optional\n            ``True`` for progress information; ``False`` otherwise.\n            Defaults to ``True``.\n\n        Returns\n        -------\n        lmls : ndarray\n            Log of the marginal likelihoods.\n        effsizes0 : ndarray\n            Covariate fixed-effect sizes.\n        effsizes1 : ndarray\n            Candidate set fixed-effect sizes.\n        scales : ndarray\n            Scales.", "docstring_tokens": ["LMLs", "fixed", "-", "effect", "sizes", "and", "scales", "for", "single", "-", "marker", "scan", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 252290}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/commands/extended/utils.py#L19-L37", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Finds transactions matching the specified criteria, fetches the\n    corresponding trytes and converts them into Transaction objects.", "language": "python", "parameters": "(adapter, **kwargs)", "return_statement": "return []", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "FindTransactionsCommand", "(", "arg_0", ")", "(", "**", "arg_1", ")", "arg_3", "=", "arg_2", "[", "'hashes'", "]", "if", "arg_3", ":", "arg_4", "=", "GetTrytesCommand", "(", "arg_0", ")", "(", "arg_3", "=", "arg_3", ")", "return", "list", "(", "map", "(", "Transaction", ".", "from_tryte_string", ",", "arg_4", ".", "get", "(", "'trytes'", ")", "or", "[", "]", ",", ")", ")", "return", "[", "]"], "function": "def Func(arg_0, **arg_1):\n    # type: (BaseAdapter, **Iterable) -> List[Transaction]\n    \"\"\"\n    Finds transactions matching the specified criteria, fetches the\n    corresponding trytes and converts them into Transaction objects.\n    \"\"\"\n    arg_2 = FindTransactionsCommand(arg_0)(**arg_1)\n\n    arg_3 = arg_2['hashes']\n\n    if arg_3:\n        arg_4 = GetTrytesCommand(arg_0)(arg_3=arg_3)\n\n        return list(map(\n            Transaction.from_tryte_string,\n            arg_4.get('trytes') or [],\n        ))  # type: List[Transaction]\n\n    return []", "path": "iota/commands/extended/utils.py", "identifier": "find_transaction_objects", "docstring": "Finds transactions matching the specified criteria, fetches the\n    corresponding trytes and converts them into Transaction objects.", "docstring_tokens": ["Finds", "transactions", "matching", "the", "specified", "criteria", "fetches", "the", "corresponding", "trytes", "and", "converts", "them", "into", "Transaction", "objects", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 252291}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/sets.py#L167-L197", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Read the images, load them into self.items and set the labels.", "language": "python", "parameters": "(self, images, labels=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "ValueError", "(", "'Expected an iterable (list or tuple) of strings or img-like objects. '", "'Got a {}.'", ".", "format", "(", "type", "(", "arg_1", ")", ")", ")", "if", "not", "len", "(", "arg_1", ")", ">", "0", ":", "raise", "ValueError", "(", "'Expected an iterable (list or tuple) of strings or img-like objects '", "'of size higher than 0. Got {} items.'", ".", "format", "(", "len", "(", "arg_1", ")", ")", ")", "if", "arg_2", "is", "not", "None", "and", "len", "(", "arg_2", ")", "!=", "len", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "'Expected the same length for image set ({}) and '", "'labels list ({}).'", ".", "format", "(", "len", "(", "arg_1", ")", ",", "len", "(", "arg_2", ")", ")", ")", "arg_3", "=", "arg_1", "[", "0", "]", "if", "arg_3", ":", "arg_4", "=", "NeuroImage", "(", "arg_3", ")", "else", ":", "raise", "(", "'Error reading image {}.'", ".", "format", "(", "repr_imgs", "(", "arg_3", ")", ")", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ")", ":", "try", ":", "arg_7", "=", "NeuroImage", "(", "arg_6", ")", "arg_0", ".", "check_compatibility", "(", "arg_7", ",", "arg_4", ")", "except", ":", "log", ".", "exception", "(", "'Error reading image {}.'", ".", "format", "(", "repr_imgs", "(", "arg_6", ")", ")", ")", "raise", "else", ":", "arg_0", ".", "items", ".", "append", "(", "arg_7", ")", "arg_0", ".", "set_labels", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Read the images, load them into self.items and set the labels.\"\"\"\n        if not isinstance(arg_1, (list, tuple)):\n            raise ValueError('Expected an iterable (list or tuple) of strings or img-like objects. '\n                             'Got a {}.'.format(type(arg_1)))\n\n        if not len(arg_1) > 0:\n            raise ValueError('Expected an iterable (list or tuple) of strings or img-like objects '\n                             'of size higher than 0. Got {} items.'.format(len(arg_1)))\n\n        if arg_2 is not None and len(arg_2) != len(arg_1):\n            raise ValueError('Expected the same length for image set ({}) and '\n                             'labels list ({}).'.format(len(arg_1), len(arg_2)))\n\n        arg_3 = arg_1[0]\n        if arg_3:\n            arg_4 = NeuroImage(arg_3)\n        else:\n            raise('Error reading image {}.'.format(repr_imgs(arg_3)))\n\n        for arg_5, arg_6 in enumerate(arg_1):\n            try:\n                arg_7 = NeuroImage(arg_6)\n                arg_0.check_compatibility(arg_7, arg_4)\n            except:\n                log.exception('Error reading image {}.'.format(repr_imgs(arg_6)))\n                raise\n            else:\n                arg_0.items.append(arg_7)\n\n        arg_0.set_labels(arg_2)", "path": "boyle/nifti/sets.py", "identifier": "NeuroImageSet._load_images_and_labels", "docstring": "Read the images, load them into self.items and set the labels.", "docstring_tokens": ["Read", "the", "images", "load", "them", "into", "self", ".", "items", "and", "set", "the", "labels", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 252292}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/wikipedia.py#L1246-L1270", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a list of categories the page belongs to.", "language": "python", "parameters": "(self, markup)", "return_statement": "return categories", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "re", ".", "findall", "(", "arg_0", ".", "re", "[", "\"category\"", "]", ",", "arg_1", ")", "for", "arg_4", "in", "arg_3", ":", "arg_4", "=", "arg_4", ".", "split", "(", "\"|\"", ")", "arg_5", "=", "arg_4", "[", "0", "]", ".", "strip", "(", ")", "arg_6", "=", "u\"\"", "if", "len", "(", "arg_4", ")", ">", "1", ":", "arg_6", "=", "arg_4", "[", "1", "]", ".", "strip", "(", ")", "if", "not", "arg_5", "in", "arg_2", ":", "arg_2", ".", "append", "(", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \n        \"\"\" Returns a list of categories the page belongs to.\n\n        # A Wikipedia category link looks like:\n        # [[Category:Computing]]\n        # This indicates the page is included in the given category.\n        # If \"Category\" is preceded by \":\" this indicates a link to a category.\n        \n        \"\"\"\n        \n        arg_2 = []\n        arg_3 = re.findall(arg_0.re[\"category\"], arg_1)\n        for arg_4 in arg_3:\n            arg_4 = arg_4.split(\"|\")\n            arg_5 = arg_4[0].strip()\n            arg_6 = u\"\"\n            if len(arg_4) > 1: \n                arg_6 = arg_4[1].strip()\n            #if not categories.has_key(page):\n            #    categories[page] = WikipediaLink(page, u\"\", display)\n            if not arg_5 in arg_2:\n                arg_2.append(arg_5)\n                \n        return arg_2", "path": "lib/web/wikipedia.py", "identifier": "WikipediaPage.parse_categories", "docstring": "Returns a list of categories the page belongs to.\n\n        # A Wikipedia category link looks like:\n        # [[Category:Computing]]\n        # This indicates the page is included in the given category.\n        # If \"Category\" is preceded by \":\" this indicates a link to a category.", "docstring_tokens": ["Returns", "a", "list", "of", "categories", "the", "page", "belongs", "to", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252293}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L2619-L2670", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Display time and frequency domain statistical information about the\n        audio. Audio is passed unmodified through the SoX processing chain.", "language": "python", "parameters": "(self, input_filepath, scale=None, rms=False)", "return_statement": "return stat_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "[", "'channels'", ",", "'1'", ",", "'Func'", "]", "if", "arg_2", "is", "not", "None", ":", "if", "not", "is_number", "(", "arg_2", ")", "or", "arg_2", "<=", "0", ":", "raise", "ValueError", "(", "\"scale must be a positive number.\"", ")", "arg_4", ".", "extend", "(", "[", "'-s'", ",", "'{:f}'", ".", "format", "(", "arg_2", ")", "]", ")", "if", "arg_3", ":", "arg_4", ".", "append", "(", "'-rms'", ")", "arg_5", ",", "arg_5", ",", "arg_6", "=", "arg_0", ".", "build", "(", "arg_1", ",", "None", ",", "extra_args", "=", "arg_4", ",", "return_output", "=", "True", ")", "arg_7", "=", "{", "}", "arg_8", "=", "arg_6", ".", "split", "(", "'\\n'", ")", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "arg_9", ".", "split", "(", ")", "if", "len", "(", "arg_10", ")", "==", "0", ":", "continue", "arg_11", "=", "arg_10", "[", "-", "1", "]", "arg_12", "=", "' '", ".", "join", "(", "arg_10", "[", ":", "-", "1", "]", ")", "arg_7", "[", "arg_12", ".", "strip", "(", "':'", ")", "]", "=", "arg_11", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        '''Display time and frequency domain Funcistical information about the\n        audio. Audio is passed unmodified through the SoX processing chain.\n\n        Unlike other Transformer methods, this does not modify the transformer\n        effects chain. Instead it computes Funcistics on the output file that\n        would be created if the build command were invoked.\n\n        Note: The file is downmixed to mono prior to computation.\n\n        Parameters\n        ----------\n        input_filepath : str\n            Path to input file to compute Funcs on.\n        scale : float or None, default=None\n            If not None, scales the input by the given scale factor.\n        rms : bool, default=False\n            If True, scales all values by the average rms amplitude.\n\n        Returns\n        -------\n        Func_dict : dict\n            Dictionary of Funcistics.\n\n        See Also\n        --------\n        Funcs, power_spectrum, sox.file_info\n        '''\n        arg_4 = ['channels', '1', 'Func']\n        if arg_2 is not None:\n            if not is_number(arg_2) or arg_2 <= 0:\n                raise ValueError(\"scale must be a positive number.\")\n            arg_4.extend(['-s', '{:f}'.format(arg_2)])\n\n        if arg_3:\n            arg_4.append('-rms')\n\n        arg_5, arg_5, arg_6 = arg_0.build(\n            arg_1, None, extra_args=arg_4, return_output=True\n        )\n\n        arg_7 = {}\n        arg_8 = arg_6.split('\\n')\n        for arg_9 in arg_8:\n            arg_10 = arg_9.split()\n            if len(arg_10) == 0:\n                continue\n            arg_11 = arg_10[-1]\n            arg_12 = ' '.join(arg_10[:-1])\n            arg_7[arg_12.strip(':')] = arg_11\n\n        return arg_7", "path": "sox/transform.py", "identifier": "Transformer.stat", "docstring": "Display time and frequency domain statistical information about the\n        audio. Audio is passed unmodified through the SoX processing chain.\n\n        Unlike other Transformer methods, this does not modify the transformer\n        effects chain. Instead it computes statistics on the output file that\n        would be created if the build command were invoked.\n\n        Note: The file is downmixed to mono prior to computation.\n\n        Parameters\n        ----------\n        input_filepath : str\n            Path to input file to compute stats on.\n        scale : float or None, default=None\n            If not None, scales the input by the given scale factor.\n        rms : bool, default=False\n            If True, scales all values by the average rms amplitude.\n\n        Returns\n        -------\n        stat_dict : dict\n            Dictionary of statistics.\n\n        See Also\n        --------\n        stats, power_spectrum, sox.file_info", "docstring_tokens": ["Display", "time", "and", "frequency", "domain", "statistical", "information", "about", "the", "audio", ".", "Audio", "is", "passed", "unmodified", "through", "the", "SoX", "processing", "chain", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 252294}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/txampext/nested.py#L21-L25", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Wraps the object in a list, and then defers to ``amp.AmpList``.", "language": "python", "parameters": "(self, inObject, proto)", "return_statement": "return amp.AmpList.toStringProto(self, [inObject], proto)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "amp", ".", "AmpList", ".", "Func", "(", "arg_0", ",", "[", "arg_1", "]", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Wraps the object in a list, and then defers to ``amp.AmpList``.\n        \"\"\"\n        return amp.AmpList.Func(arg_0, [arg_1], arg_2)", "path": "txampext/nested.py", "identifier": "NestedAMPBox.toStringProto", "docstring": "Wraps the object in a list, and then defers to ``amp.AmpList``.", "docstring_tokens": ["Wraps", "the", "object", "in", "a", "list", "and", "then", "defers", "to", "amp", ".", "AmpList", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 252295}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L646-L651", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Set the presence status.", "language": "python", "parameters": "(self, set_presence_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "SetPresenceResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'presence/setpresence'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Set the presence status.\"\"\"\n        arg_2 = hangouts_pb2.SetPresenceResponse()\n        await arg_0._pb_request('presence/setpresence',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.set_presence", "docstring": "Set the presence status.", "docstring_tokens": ["Set", "the", "presence", "status", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 252296}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_text_to_speech_hook.py#L53-L80", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Synthesizes text input", "language": "python", "parameters": "(self, input_data, voice, audio_config, retry=None, timeout=None)", "return_statement": "return client.synthesize_speech(\n            input_=input_data, voice=voice, audio_config=audio_config, retry=retry, timeout=timeout\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_0", ".", "get_conn", "(", ")", "arg_0", ".", "log", ".", "info", "(", "\"Synthesizing input: %s\"", "%", "arg_1", ")", "return", "arg_6", ".", "Func", "(", "input_", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None):\n        \"\"\"\n        Synthesizes text input\n\n        :param input_data: text input to be synthesized. See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.SynthesisInput\n        :type input_data: dict or google.cloud.texttospeech_v1.types.SynthesisInput\n        :param voice: configuration of voice to be used in synthesis. See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.VoiceSelectionParams\n        :type voice: dict or google.cloud.texttospeech_v1.types.VoiceSelectionParams\n        :param audio_config: configuration of the synthesized audio. See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.AudioConfig\n        :type audio_config: dict or google.cloud.texttospeech_v1.types.AudioConfig\n        :return: SynthesizeSpeechResponse See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.SynthesizeSpeechResponse\n        :rtype: object\n        :param retry: (Optional) A retry object used to retry requests. If None is specified,\n                requests will not be retried.\n        :type retry: google.api_core.retry.Retry\n        :param timeout: (Optional) The amount of time, in seconds, to wait for the request to complete.\n            Note that if retry is specified, the timeout applies to each individual attempt.\n        :type timeout: float\n        \"\"\"\n        arg_6 = arg_0.get_conn()\n        arg_0.log.info(\"Synthesizing input: %s\" % arg_1)\n        return arg_6.Func(\n            input_=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5\n        )", "path": "airflow/contrib/hooks/gcp_text_to_speech_hook.py", "identifier": "GCPTextToSpeechHook.synthesize_speech", "docstring": "Synthesizes text input\n\n        :param input_data: text input to be synthesized. See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.SynthesisInput\n        :type input_data: dict or google.cloud.texttospeech_v1.types.SynthesisInput\n        :param voice: configuration of voice to be used in synthesis. See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.VoiceSelectionParams\n        :type voice: dict or google.cloud.texttospeech_v1.types.VoiceSelectionParams\n        :param audio_config: configuration of the synthesized audio. See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.AudioConfig\n        :type audio_config: dict or google.cloud.texttospeech_v1.types.AudioConfig\n        :return: SynthesizeSpeechResponse See more:\n            https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.SynthesizeSpeechResponse\n        :rtype: object\n        :param retry: (Optional) A retry object used to retry requests. If None is specified,\n                requests will not be retried.\n        :type retry: google.api_core.retry.Retry\n        :param timeout: (Optional) The amount of time, in seconds, to wait for the request to complete.\n            Note that if retry is specified, the timeout applies to each individual attempt.\n        :type timeout: float", "docstring_tokens": ["Synthesizes", "text", "input"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252297}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/datastore_hook.py#L257-L295", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Export entities from Cloud Datastore to Cloud Storage for backup.", "language": "python", "parameters": "(self, bucket, namespace=None, entity_filter=None, labels=None)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "get_conn", "(", ")", "arg_6", "=", "'gs://'", "+", "'/'", ".", "join", "(", "filter", "(", "None", ",", "[", "arg_1", ",", "arg_2", "]", ")", ")", "if", "not", "arg_3", ":", "arg_3", "=", "{", "}", "if", "not", "arg_4", ":", "arg_4", "=", "{", "}", "arg_7", "=", "{", "'outputUrlPrefix'", ":", "arg_6", ",", "'entityFilter'", ":", "arg_3", ",", "'labels'", ":", "arg_4", ",", "}", "arg_8", "=", "(", "arg_5", ".", "projects", "(", ")", ".", "export", "(", "projectId", "=", "arg_0", ".", "project_id", ",", "arg_7", "=", "arg_7", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"\n        Export entities from Cloud Datastore to Cloud Storage for backup.\n\n        .. note::\n            Keep in mind that this requests the Admin API not the Data API.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/admin/rest/v1/projects/export\n\n        :param bucket: The name of the Cloud Storage bucket.\n        :type bucket: str\n        :param namespace: The Cloud Storage namespace path.\n        :type namespace: str\n        :param entity_filter: Description of what data from the project is included in the export.\n        :type entity_filter: dict\n        :param labels: Client-assigned labels.\n        :type labels: dict of str\n        :return: a resource operation instance.\n        :rtype: dict\n        \"\"\"\n        arg_5 = arg_0.get_conn()\n\n        arg_6 = 'gs://' + '/'.join(filter(None, [arg_1, arg_2]))\n        if not arg_3:\n            arg_3 = {}\n        if not arg_4:\n            arg_4 = {}\n        arg_7 = {\n            'outputUrlPrefix': arg_6,\n            'entityFilter': arg_3,\n            'labels': arg_4,\n        }\n        arg_8 = (arg_5\n                .projects()\n                .export(projectId=arg_0.project_id, arg_7=arg_7)\n                .execute(num_retries=arg_0.num_retries))\n\n        return arg_8", "path": "airflow/contrib/hooks/datastore_hook.py", "identifier": "DatastoreHook.export_to_storage_bucket", "docstring": "Export entities from Cloud Datastore to Cloud Storage for backup.\n\n        .. note::\n            Keep in mind that this requests the Admin API not the Data API.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/admin/rest/v1/projects/export\n\n        :param bucket: The name of the Cloud Storage bucket.\n        :type bucket: str\n        :param namespace: The Cloud Storage namespace path.\n        :type namespace: str\n        :param entity_filter: Description of what data from the project is included in the export.\n        :type entity_filter: dict\n        :param labels: Client-assigned labels.\n        :type labels: dict of str\n        :return: a resource operation instance.\n        :rtype: dict", "docstring_tokens": ["Export", "entities", "from", "Cloud", "Datastore", "to", "Cloud", "Storage", "for", "backup", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252298}
{"url": "https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/utils.py#L209-L213", "sha": "f57f44e7b0a1030786aafd6f387114abb546bb32", "docstring_summary": "Validates ISO reference number", "language": "python", "parameters": "(ref)", "return_statement": "return (iso_reference_str2int(cs_source) % 97) == 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "str", "(", "arg_0", ")", "arg_1", "=", "arg_0", "[", "4", ":", "]", "+", "arg_0", "[", ":", "4", "]", "return", "(", "iso_reference_str2int", "(", "arg_1", ")", "%", "97", ")", "==", "1"], "function": "def Func(arg_0):\n    \"\"\"Validates ISO reference number\"\"\"\n    arg_0 = str(arg_0)\n    arg_1 = arg_0[4:] + arg_0[:4]\n    return (iso_reference_str2int(arg_1) % 97) == 1", "path": "holviapi/utils.py", "identifier": "iso_reference_isvalid", "docstring": "Validates ISO reference number", "docstring_tokens": ["Validates", "ISO", "reference", "number"], "nwo": "rambo/python-holviapi", "score": 0.1802640598604426, "idx": 252299}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/memories/queue.py#L219-L271", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Fetches experiences for given indices.", "language": "python", "parameters": "(self, indices)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "for", "arg_3", "in", "sorted", "(", "arg_0", ".", "states_memory", ")", ":", "arg_2", "[", "arg_3", "]", "=", "tf", ".", "gather", "(", "params", "=", "arg_0", ".", "states_memory", "[", "arg_3", "]", ",", "arg_1", "=", "arg_1", ")", "arg_4", "=", "dict", "(", ")", "for", "arg_3", "in", "sorted", "(", "arg_0", ".", "internals_memory", ")", ":", "arg_4", "[", "arg_3", "]", "=", "tf", ".", "gather", "(", "params", "=", "arg_0", ".", "internals_memory", "[", "arg_3", "]", ",", "arg_1", "=", "arg_1", ")", "arg_5", "=", "dict", "(", ")", "for", "arg_3", "in", "sorted", "(", "arg_0", ".", "actions_memory", ")", ":", "arg_5", "[", "arg_3", "]", "=", "tf", ".", "gather", "(", "params", "=", "arg_0", ".", "actions_memory", "[", "arg_3", "]", ",", "arg_1", "=", "arg_1", ")", "arg_6", "=", "tf", ".", "gather", "(", "params", "=", "arg_0", ".", "terminal_memory", ",", "arg_1", "=", "arg_1", ")", "arg_7", "=", "tf", ".", "gather", "(", "params", "=", "arg_0", ".", "reward_memory", ",", "arg_1", "=", "arg_1", ")", "if", "arg_0", ".", "include_next_states", ":", "assert", "util", ".", "rank", "(", "arg_1", ")", "==", "1", "arg_8", "=", "(", "arg_1", "+", "1", ")", "%", "arg_0", ".", "capacity", "arg_9", "=", "dict", "(", ")", "for", "arg_3", "in", "sorted", "(", "arg_0", ".", "states_memory", ")", ":", "arg_9", "[", "arg_3", "]", "=", "tf", ".", "gather", "(", "params", "=", "arg_0", ".", "states_memory", "[", "arg_3", "]", ",", "arg_1", "=", "arg_8", ")", "arg_10", "=", "dict", "(", ")", "for", "arg_3", "in", "sorted", "(", "arg_0", ".", "internals_memory", ")", ":", "arg_10", "[", "arg_3", "]", "=", "tf", ".", "gather", "(", "params", "=", "arg_0", ".", "internals_memory", "[", "arg_3", "]", ",", "arg_1", "=", "arg_8", ")", "return", "dict", "(", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")", "else", ":", "return", "dict", "(", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Fetches experiences for given indices.\n\n        Args:\n            indices: Index tensor\n\n        Returns: Batch of experiences\n        \"\"\"\n        arg_2 = dict()\n        for arg_3 in sorted(arg_0.states_memory):\n            arg_2[arg_3] = tf.gather(params=arg_0.states_memory[arg_3], arg_1=arg_1)\n\n        arg_4 = dict()\n        for arg_3 in sorted(arg_0.internals_memory):\n            arg_4[arg_3] = tf.gather(params=arg_0.internals_memory[arg_3], arg_1=arg_1)\n\n        arg_5 = dict()\n        for arg_3 in sorted(arg_0.actions_memory):\n            arg_5[arg_3] = tf.gather(params=arg_0.actions_memory[arg_3], arg_1=arg_1)\n\n        arg_6 = tf.gather(params=arg_0.terminal_memory, arg_1=arg_1)\n        arg_7 = tf.gather(params=arg_0.reward_memory, arg_1=arg_1)\n\n        if arg_0.include_next_states:\n            assert util.rank(arg_1) == 1\n            arg_8 = (arg_1 + 1) % arg_0.capacity\n\n            arg_9 = dict()\n            for arg_3 in sorted(arg_0.states_memory):\n                arg_9[arg_3] = tf.gather(params=arg_0.states_memory[arg_3], arg_1=arg_8)\n\n            arg_10 = dict()\n            for arg_3 in sorted(arg_0.internals_memory):\n                arg_10[arg_3] = tf.gather(params=arg_0.internals_memory[arg_3], arg_1=arg_8)\n\n            return dict(\n                arg_2=arg_2,\n                arg_4=arg_4,\n                arg_5=arg_5,\n                arg_6=arg_6,\n                arg_7=arg_7,\n                arg_9=arg_9,\n                arg_10=arg_10\n            )\n        else:\n            return dict(\n                arg_2=arg_2,\n                arg_4=arg_4,\n                arg_5=arg_5,\n                arg_6=arg_6,\n                arg_7=arg_7\n            )", "path": "tensorforce/core/memories/queue.py", "identifier": "Queue.tf_retrieve_indices", "docstring": "Fetches experiences for given indices.\n\n        Args:\n            indices: Index tensor\n\n        Returns: Batch of experiences", "docstring_tokens": ["Fetches", "experiences", "for", "given", "indices", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 252300}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/qsub.py#L405-L449", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Generate a array job.", "language": "python", "parameters": "(templates, directories, **kwargs)", "return_statement": "return [write_script(template) for template in config.get_templates(templates)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "setdefault", "(", "'dirname'", ",", "os", ".", "path", ".", "curdir", ")", "arg_4", "=", "[", "relpath", "(", "p", ",", "start", "=", "arg_3", ")", "for", "p", "in", "asiterable", "(", "arg_1", ")", "]", "arg_5", "=", "[", "p", "for", "p", "in", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "subdir", ")", "for", "subdir", "in", "arg_4", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "p", ")", "]", "if", "len", "(", "arg_5", ")", ">", "0", ":", "logger", ".", "debug", "(", "\"template=%(template)r: dirname=%(dirname)r reldirs=%(reldirs)r\"", ",", "vars", "(", ")", ")", "logger", ".", "error", "(", "\"Some directories are not accessible from the array script: \"", "\"%(missing)r\"", ",", "vars", "(", ")", ")", "def", "write_script", "(", "arg_6", ")", ":", "arg_7", "=", "detect_queuing_system", "(", "arg_6", ")", "if", "arg_7", "is", "None", "or", "not", "arg_7", ".", "has_arrays", "(", ")", ":", "logger", ".", "warning", "(", "\"Not known how to make a job array for %(template)r; skipping...\"", ",", "vars", "(", ")", ")", "return", "None", "arg_2", "[", "'jobarray_string'", "]", "=", "arg_7", ".", "array", "(", "arg_4", ")", "return", "generate_submit_scripts", "(", "arg_6", ",", "**", "arg_2", ")", "[", "0", "]", "return", "[", "write_script", "(", "arg_6", ")", "for", "arg_6", "in", "config", ".", "get_templates", "(", "arg_0", ")", "]"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Generate a array job.\n\n    For each ``work_dir`` in *directories*, the array job will\n     1. cd into ``work_dir``\n     2. run the job as detailed in the template\n    It will use all the queuing system directives found in the\n    template. If more complicated set ups are required, then this\n    function cannot be used.\n\n    :Arguments:\n       *templates*\n          Basic template for a single job; the job array logic is spliced into\n          the position of the line ::\n              # JOB_ARRAY_PLACEHOLDER\n          The appropriate commands for common queuing systems (Sun Gridengine, PBS)\n          are hard coded here. The queuing system is detected from the suffix of\n          the template.\n       *directories*\n          List of directories under *dirname*. One task is set up for each\n          directory.\n       *dirname*\n          The array script will be placed in this directory. The *directories*\n          **must** be located under *dirname*.\n       *kwargs*\n          See :func:`gromacs.setup.generate_submit_script` for details.\n    \"\"\"\n    arg_3 = arg_2.setdefault('dirname', os.path.curdir)\n    arg_4 = [relpath(p, start=arg_3) for p in asiterable(arg_1)]\n    arg_5 = [p for p in (os.path.join(arg_3, subdir) for subdir in arg_4)\n               if not os.path.exists(p)]\n    if len(arg_5) > 0:\n        logger.debug(\"template=%(template)r: dirname=%(dirname)r reldirs=%(reldirs)r\", vars())\n        logger.error(\"Some directories are not accessible from the array script: \"\n                     \"%(missing)r\", vars())\n    def write_script(arg_6):\n        arg_7 = detect_queuing_system(arg_6)\n        if arg_7 is None or not arg_7.has_arrays():\n            logger.warning(\"Not known how to make a job array for %(template)r; skipping...\", vars())\n            return None\n        arg_2['jobarray_string'] = arg_7.array(arg_4)\n        return generate_submit_scripts(arg_6, **arg_2)[0]   # returns list of length 1\n\n    # must use config.get_templates() because we need to access the file for detecting\n    return [write_script(arg_6) for arg_6 in config.get_templates(arg_0)]", "path": "gromacs/qsub.py", "identifier": "generate_submit_array", "docstring": "Generate a array job.\n\n    For each ``work_dir`` in *directories*, the array job will\n     1. cd into ``work_dir``\n     2. run the job as detailed in the template\n    It will use all the queuing system directives found in the\n    template. If more complicated set ups are required, then this\n    function cannot be used.\n\n    :Arguments:\n       *templates*\n          Basic template for a single job; the job array logic is spliced into\n          the position of the line ::\n              # JOB_ARRAY_PLACEHOLDER\n          The appropriate commands for common queuing systems (Sun Gridengine, PBS)\n          are hard coded here. The queuing system is detected from the suffix of\n          the template.\n       *directories*\n          List of directories under *dirname*. One task is set up for each\n          directory.\n       *dirname*\n          The array script will be placed in this directory. The *directories*\n          **must** be located under *dirname*.\n       *kwargs*\n          See :func:`gromacs.setup.generate_submit_script` for details.", "docstring_tokens": ["Generate", "a", "array", "job", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 252301}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1150-L1176", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "writes arrays to h5 disk", "language": "python", "parameters": "(data, sample, sidx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "LOGGER", ".", "info", "(", "\"writing fullarr %s %s\"", ",", "arg_1", ".", "name", ",", "arg_2", ")", "with", "h5py", ".", "File", "(", "arg_0", ".", "clust_database", ",", "'r+'", ")", "as", "io5", ":", "arg_3", "=", "io5", "[", "\"catgs\"", "]", ".", "attrs", "[", "\"chunksize\"", "]", "[", "0", "]", "arg_4", "=", "io5", "[", "\"catgs\"", "]", "arg_5", "=", "io5", "[", "\"nalleles\"", "]", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "across", ",", "arg_1", ".", "name", "+", "'.tmp.h5'", ")", "with", "h5py", ".", "File", "(", "arg_6", ")", "as", "indat", ":", "arg_7", "=", "indat", "[", "\"icatg\"", "]", "arg_8", "=", "indat", "[", "\"inall\"", "]", "for", "arg_9", "in", "xrange", "(", "0", ",", "arg_4", ".", "shape", "[", "0", "]", ",", "arg_3", ")", ":", "arg_10", "=", "arg_9", "+", "arg_3", "arg_4", "[", "arg_9", ":", "arg_10", ",", "arg_2", ":", "arg_2", "+", "1", ",", ":", "]", "=", "np", ".", "expand_dims", "(", "arg_7", "[", "arg_9", ":", "arg_10", ",", ":", "]", ",", "axis", "=", "1", ")", "arg_5", "[", ":", ",", "arg_2", ":", "arg_2", "+", "1", "]", "=", "np", ".", "expand_dims", "(", "arg_8", ",", "axis", "=", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" writes arrays to h5 disk \"\"\"\n\n    ## enter ref data?\n    #isref = 'reference' in data.paramsdict[\"assembly_method\"]\n    LOGGER.info(\"writing fullarr %s %s\", arg_1.name, arg_2)\n\n    ## save big arrays to disk temporarily\n    with h5py.File(arg_0.clust_database, 'r+') as io5:\n        ## open views into the arrays we plan to fill\n        arg_3 = io5[\"catgs\"].attrs[\"chunksize\"][0]\n        arg_4 = io5[\"catgs\"]\n        arg_5 = io5[\"nalleles\"]\n\n        ## adding an axis to newcatg makes it write about 1000X faster.\n        arg_6 = os.path.join(arg_0.dirs.across, arg_1.name+'.tmp.h5')\n        with h5py.File(arg_6) as indat:\n\n            ## grab all of the data from this sample's arrays\n            arg_7 = indat[\"icatg\"] #[:]\n            arg_8 = indat[\"inall\"]   #[:]\n\n            ## enter it into the full array one chunk at a time\n            for arg_9 in xrange(0, arg_4.shape[0], arg_3):\n                arg_10 = arg_9 + arg_3\n                arg_4[arg_9:arg_10, arg_2:arg_2+1, :] = np.expand_dims(arg_7[arg_9:arg_10, :], axis=1)\n                arg_5[:, arg_2:arg_2+1] = np.expand_dims(arg_8, axis=1)", "path": "ipyrad/assemble/cluster_across.py", "identifier": "write_to_fullarr", "docstring": "writes arrays to h5 disk", "docstring_tokens": ["writes", "arrays", "to", "h5", "disk"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 252302}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/layers.py#L115-L155", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Rename layer label", "language": "python", "parameters": "(script, label='blank', layer_num=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'blank'", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Rename Current Mesh\">\\n'", ",", "'    <Param name=\"newName\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_1", ")", ",", "'description=\"New Label\" '", ",", "'type=\"RichString\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "if", "isinstance", "(", "arg_0", ",", "mlx", ".", "FilterScript", ")", ":", "if", "(", "arg_2", "is", "None", ")", "or", "(", "arg_2", "==", "arg_0", ".", "current_layer", "(", ")", ")", ":", "util", ".", "write_filter", "(", "arg_0", ",", "arg_3", ")", "arg_0", ".", "layer_stack", "[", "arg_0", ".", "current_layer", "(", ")", "]", "=", "arg_1", "else", ":", "arg_6", "=", "arg_0", ".", "current_layer", "(", ")", "change", "(", "arg_0", ",", "arg_2", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_3", ")", "change", "(", "arg_0", ",", "arg_6", ")", "arg_0", ".", "layer_stack", "[", "arg_2", "]", "=", "arg_1", "else", ":", "util", ".", "write_filter", "(", "arg_0", ",", "arg_3", ")", "return", "None"], "function": "def Func(arg_0, arg_1='blank', arg_2=None):\n    \"\"\" Rename layer label\n\n    Can be useful for outputting mlp files, as the output file names use\n    the labels.\n\n    Args:\n        script: the mlx.FilterScript object or script filename to write\n            the filter to.\n        label (str): new label for the mesh layer\n        layer_num (int): layer number to Func. Default is the\n            current layer. Not supported on the file base API.\n\n    Layer stack:\n        Renames a layer\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    arg_3 = ''.join([\n        '  <filter name=\"Rename Current Mesh\">\\n',\n        '    <Param name=\"newName\" ',\n        'value=\"{}\" '.format(arg_1),\n        'description=\"New Label\" ',\n        'type=\"RichString\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    if isinstance(arg_0, mlx.FilterScript):\n        if (arg_2 is None) or (arg_2 == arg_0.current_layer()):\n            util.write_filter(arg_0, arg_3)\n            arg_0.layer_stack[arg_0.current_layer()] = arg_1\n        else:\n            arg_6 = arg_0.current_layer()\n            change(arg_0, arg_2)\n            util.write_filter(arg_0, arg_3)\n            change(arg_0, arg_6)\n            arg_0.layer_stack[arg_2] = arg_1\n    else:\n        util.write_filter(arg_0, arg_3)\n    return None", "path": "meshlabxml/layers.py", "identifier": "rename", "docstring": "Rename layer label\n\n    Can be useful for outputting mlp files, as the output file names use\n    the labels.\n\n    Args:\n        script: the mlx.FilterScript object or script filename to write\n            the filter to.\n        label (str): new label for the mesh layer\n        layer_num (int): layer number to rename. Default is the\n            current layer. Not supported on the file base API.\n\n    Layer stack:\n        Renames a layer\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Rename", "layer", "label"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 252303}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/vq_vae.py#L324-L350", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper method to save images visualizing model reconstructions.", "language": "python", "parameters": "(images_val,\n                       reconstructed_images_val,\n                       random_images_val,\n                       log_dir, prefix, viz_n=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "10", ")", ":", "save_imgs", "(", "arg_0", "[", ":", "arg_5", "]", ",", "os", ".", "path", ".", "join", "(", "arg_3", ",", "\"{}_inputs.png\"", ".", "format", "(", "arg_4", ")", ")", ")", "save_imgs", "(", "arg_1", "[", ":", "arg_5", "]", ",", "os", ".", "path", ".", "join", "(", "arg_3", ",", "\"{}_reconstructions.png\"", ".", "format", "(", "arg_4", ")", ")", ")", "if", "arg_2", "is", "not", "None", ":", "save_imgs", "(", "arg_2", "[", ":", "arg_5", "]", ",", "os", ".", "path", ".", "join", "(", "arg_3", ",", "\"{}_prior_samples.png\"", ".", "format", "(", "arg_4", ")", ")", ")"], "function": "def Func(arg_0,\n                       arg_1,\n                       arg_2,\n                       arg_3, arg_4, arg_5=10):\n  \"\"\"Helper method to save images visualizing model reconstructions.\n\n  Args:\n    images_val: Numpy array containing a batch of input images.\n    reconstructed_images_val: Numpy array giving the expected output\n      (mean) of the decoder.\n    random_images_val: Optionally, a Numpy array giving the expected output\n      (mean) of decoding samples from the prior, or `None`.\n    log_dir: The directory to write images (Python `str`).\n    prefix: A specific label for the saved visualizations, which\n      determines their filenames (Python `str`).\n    viz_n: The number of images from each batch to visualize (Python `int`).\n  \"\"\"\n  save_imgs(arg_0[:arg_5],\n            os.path.join(arg_3, \"{}_inputs.png\".format(arg_4)))\n  save_imgs(arg_1[:arg_5],\n            os.path.join(arg_3,\n                         \"{}_reconstructions.png\".format(arg_4)))\n\n  if arg_2 is not None:\n    save_imgs(arg_2[:arg_5],\n              os.path.join(arg_3,\n                           \"{}_prior_samples.png\".format(arg_4)))", "path": "tensorflow_probability/examples/vq_vae.py", "identifier": "visualize_training", "docstring": "Helper method to save images visualizing model reconstructions.\n\n  Args:\n    images_val: Numpy array containing a batch of input images.\n    reconstructed_images_val: Numpy array giving the expected output\n      (mean) of the decoder.\n    random_images_val: Optionally, a Numpy array giving the expected output\n      (mean) of decoding samples from the prior, or `None`.\n    log_dir: The directory to write images (Python `str`).\n    prefix: A specific label for the saved visualizations, which\n      determines their filenames (Python `str`).\n    viz_n: The number of images from each batch to visualize (Python `int`).", "docstring_tokens": ["Helper", "method", "to", "save", "images", "visualizing", "model", "reconstructions", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252304}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L865-L886", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "return optim clusters given iterators, and whether it got all or not", "language": "python", "parameters": "(pairdealer, optim)", "return_statement": "return 0, chunk", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "[", "]", "while", "arg_2", "<", "arg_1", ":", "try", ":", "arg_4", "=", "itertools", ".", "takewhile", "(", "lambda", "x", ":", "x", "[", "0", "]", "!=", "\"//\\n\"", ",", "arg_0", ")", "arg_5", "=", "[", "\"\"", ".", "join", "(", "arg_4", ".", "next", "(", ")", ")", "]", "except", "StopIteration", ":", "return", "1", ",", "arg_3", "while", "1", ":", "try", ":", "arg_5", ".", "append", "(", "\"\"", ".", "join", "(", "arg_4", ".", "next", "(", ")", ")", ")", "except", "StopIteration", ":", "break", "arg_3", ".", "append", "(", "\"\"", ".", "join", "(", "arg_5", ")", ")", "arg_2", "+=", "1", "return", "0", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\" return optim clusters given iterators, and whether it got all or not\"\"\"\n    arg_2 = 0\n    arg_3 = []\n    while arg_2 < arg_1:\n        ## try refreshing taker, else quit\n        try:\n            arg_4 = itertools.takewhile(lambda x: x[0] != \"//\\n\", arg_0)\n            arg_5 = [\"\".join(arg_4.next())]\n        except StopIteration:\n            #LOGGER.debug('last chunk %s', chunk)\n            return 1, arg_3\n\n        ## load one cluster\n        while 1:\n            try:\n                arg_5.append(\"\".join(arg_4.next()))\n            except StopIteration:\n                break\n        arg_3.append(\"\".join(arg_5))\n        arg_2 += 1\n    return 0, arg_3", "path": "ipyrad/assemble/util.py", "identifier": "clustdealer", "docstring": "return optim clusters given iterators, and whether it got all or not", "docstring_tokens": ["return", "optim", "clusters", "given", "iterators", "and", "whether", "it", "got", "all", "or", "not"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 252305}
{"url": "https://github.com/Toblerity/rtree/blob/5d33357c8e88f1a8344415dc15a7d2440211b281/rtree/core.py#L11-L19", "sha": "5d33357c8e88f1a8344415dc15a7d2440211b281", "docstring_summary": "Error checking for Error calls", "language": "python", "parameters": "(result, func, cargs)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", "!=", "0", ":", "arg_3", "=", "rt", ".", "Error_GetLastErrorMsg", "(", ")", ".", "decode", "(", ")", "arg_4", "=", "'LASError in \"%s\": %s'", "%", "(", "arg_1", ".", "__name__", ",", "arg_3", ")", "rt", ".", "Error_Reset", "(", ")", "raise", "RTreeError", "(", "arg_4", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"Error checking for Error calls\"\n    if arg_0 != 0:\n        arg_3 = rt.Error_GetLastErrorMsg().decode()\n        arg_4 = 'LASError in \"%s\": %s' % \\\n            (arg_1.__name__, arg_3)\n        rt.Error_Reset()\n        raise RTreeError(arg_4)\n    return True", "path": "rtree/core.py", "identifier": "check_return", "docstring": "Error checking for Error calls", "docstring_tokens": ["Error", "checking", "for", "Error", "calls"], "nwo": "Toblerity/rtree", "score": 0.6128222292729003, "idx": 252306}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/transmitters/learner_data.py#L97-L114", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Handle the case where the transmission fails.", "language": "python", "parameters": "(self, learner_data, request_exception)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_2", ".", "response", ".", "content", "except", "AttributeError", ":", "arg_3", "=", "'Not available'", "LOGGER", ".", "error", "(", "(", "'Failed to send completion status call for enterprise enrollment %s'", "'with payload %s'", "'\\nError message: %s'", "'\\nSystem message: %s'", ")", ",", "arg_1", ".", "enterprise_course_enrollment_id", ",", "arg_1", ",", "str", "(", "arg_2", ")", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle the case where the transmission fails.\"\"\"\n        try:\n            arg_3 = arg_2.response.content\n        except AttributeError:\n            arg_3 = 'Not available'\n        LOGGER.error(\n            (\n                'Failed to send completion status call for enterprise enrollment %s'\n                'with payload %s'\n                '\\nError message: %s'\n                '\\nSystem message: %s'\n            ),\n            arg_1.enterprise_course_enrollment_id,\n            arg_1,\n            str(arg_2),\n            arg_3\n        )", "path": "integrated_channels/integrated_channel/transmitters/learner_data.py", "identifier": "LearnerTransmitter.handle_transmission_error", "docstring": "Handle the case where the transmission fails.", "docstring_tokens": ["Handle", "the", "case", "where", "the", "transmission", "fails", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252307}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L375-L382", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update synopsis.", "language": "python", "parameters": "(store, institute_obj, case_obj, user_obj, new_synopsis)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_2", "[", "'synopsis'", "]", "!=", "arg_4", ":", "arg_5", "=", "url_for", "(", "'cases.case'", ",", "institute_id", "=", "arg_1", "[", "'_id'", "]", ",", "case_name", "=", "arg_2", "[", "'display_name'", "]", ")", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_5", ",", "content", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Update synopsis.\"\"\"\n    # create event only if synopsis was actually changed\n    if arg_2['synopsis'] != arg_4:\n        arg_5 = url_for('cases.case', institute_id=arg_1['_id'],\n                       case_name=arg_2['display_name'])\n        arg_0.Func(arg_1, arg_2, arg_3, arg_5,\n                              content=arg_4)", "path": "scout/server/blueprints/cases/controllers.py", "identifier": "update_synopsis", "docstring": "Update synopsis.", "docstring_tokens": ["Update", "synopsis", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252308}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dag_processing.py#L931-L944", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Clears import errors for files that no longer exist.", "language": "python", "parameters": "(self, session)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "query", "(", "errors", ".", "ImportError", ")", "if", "arg_0", ".", "_file_paths", ":", "arg_2", "=", "arg_2", ".", "filter", "(", "~", "errors", ".", "ImportError", ".", "filename", ".", "in_", "(", "arg_0", ".", "_file_paths", ")", ")", "arg_2", ".", "delete", "(", "synchronize_session", "=", "'fetch'", ")", "arg_1", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Clears import errors for files that no longer exist.\n\n        :param session: session for ORM operations\n        :type session: sqlalchemy.orm.session.Session\n        \"\"\"\n        arg_2 = arg_1.query(errors.ImportError)\n        if arg_0._file_paths:\n            arg_2 = arg_2.filter(\n                ~errors.ImportError.filename.in_(arg_0._file_paths)\n            )\n        arg_2.delete(synchronize_session='fetch')\n        arg_1.commit()", "path": "airflow/utils/dag_processing.py", "identifier": "DagFileProcessorManager.clear_nonexistent_import_errors", "docstring": "Clears import errors for files that no longer exist.\n\n        :param session: session for ORM operations\n        :type session: sqlalchemy.orm.session.Session", "docstring_tokens": ["Clears", "import", "errors", "for", "files", "that", "no", "longer", "exist", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252309}
{"url": "https://github.com/edx/edx-organizations/blob/51000d5d359d880a6eb3a79345f60744f1982c00/organizations/api.py#L107-L113", "sha": "51000d5d359d880a6eb3a79345f60744f1982c00", "docstring_summary": "Removes the specfied course from the specified organization", "language": "python", "parameters": "(organization, course_key)", "return_statement": "return data.delete_organization_course(course_key=course_key, organization=organization)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_organization_data", "(", "arg_0", ")", "_validate_course_key", "(", "arg_1", ")", "return", "data", ".", "delete_organization_course", "(", "arg_1", "=", "arg_1", ",", "arg_0", "=", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Removes the specfied course from the specified organization\n    \"\"\"\n    _validate_organization_data(arg_0)\n    _validate_course_key(arg_1)\n    return data.delete_organization_course(arg_1=arg_1, arg_0=arg_0)", "path": "organizations/api.py", "identifier": "remove_organization_course", "docstring": "Removes the specfied course from the specified organization", "docstring_tokens": ["Removes", "the", "specfied", "course", "from", "the", "specified", "organization"], "nwo": "edx/edx-organizations", "score": 0.5537402011854966, "idx": 252310}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L511-L513", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Compute the yticks labels of this grid, used for plotting the y-axis ticks when visualizing a regular", "language": "python", "parameters": "(self)", "return_statement": "return np.linspace(np.min(self[:, 0]), np.max(self[:, 0]), 4)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "np", ".", "linspace", "(", "np", ".", "min", "(", "arg_0", "[", ":", ",", "0", "]", ")", ",", "np", ".", "max", "(", "arg_0", "[", ":", ",", "0", "]", ")", ",", "4", ")"], "function": "def Func(arg_0):\n        \"\"\"Compute the Func labels of this grid, used for plotting the y-axis ticks when visualizing a regular\"\"\"\n        return np.linspace(np.min(arg_0[:, 0]), np.max(arg_0[:, 0]), 4)", "path": "autolens/data/array/grids.py", "identifier": "RegularGrid.yticks", "docstring": "Compute the yticks labels of this grid, used for plotting the y-axis ticks when visualizing a regular", "docstring_tokens": ["Compute", "the", "yticks", "labels", "of", "this", "grid", "used", "for", "plotting", "the", "y", "-", "axis", "ticks", "when", "visualizing", "a", "regular"], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 252311}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/memory.py#L188-L197", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Returns True if index is in range", "language": "python", "parameters": "(self, index)", "return_statement": "return in_range", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "slice", ")", ":", "arg_2", "=", "arg_1", ".", "start", "<", "arg_1", ".", "stop", "and", "arg_1", ".", "start", ">=", "arg_0", ".", "start", "and", "arg_1", ".", "stop", "<=", "arg_0", ".", "end", "else", ":", "arg_2", "=", "arg_1", ">=", "arg_0", ".", "start", "and", "arg_1", "<=", "arg_0", ".", "end", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns True if index is in range \"\"\"\n        if isinstance(arg_1, slice):\n            arg_2 = arg_1.start < arg_1.stop and \\\n                arg_1.start >= arg_0.start and \\\n                arg_1.stop <= arg_0.end\n        else:\n            arg_2 = arg_1 >= arg_0.start and \\\n                arg_1 <= arg_0.end\n        return arg_2", "path": "manticore/native/memory.py", "identifier": "Map._in_range", "docstring": "Returns True if index is in range", "docstring_tokens": ["Returns", "True", "if", "index", "is", "in", "range"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252312}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L310-L321", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Scan for FCs with a given prefix.", "language": "python", "parameters": "(self, prefix, feature_names=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "yield", "did", "(", "arg_4", "[", "'_id'", "]", ")", ",", "arg_0", ".", "fc_from_dict", "(", "arg_4", "[", "'_source'", "]", "[", "'fc'", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''Scan for FCs with a given prefix.\n\n        :param str prefix: Identifier prefix.\n        :param [str] feature_names:\n          A list of feature names to retrieve. When ``None``, all\n          features are retrieved. Wildcards are allowed.\n        :rtype: Iterable of ``(content_id, FC)``\n        '''\n        arg_3 = arg_0._Func(arg_1, arg_2=arg_2)\n        for arg_4 in arg_3:\n            yield did(arg_4['_id']), arg_0.fc_from_dict(arg_4['_source']['fc'])", "path": "dossier/store/elastic.py", "identifier": "ElasticStore.scan_prefix", "docstring": "Scan for FCs with a given prefix.\n\n        :param str prefix: Identifier prefix.\n        :param [str] feature_names:\n          A list of feature names to retrieve. When ``None``, all\n          features are retrieved. Wildcards are allowed.\n        :rtype: Iterable of ``(content_id, FC)``", "docstring_tokens": ["Scan", "for", "FCs", "with", "a", "given", "prefix", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 252313}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/from_inspire.py#L338-L353", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Move title info from 245 to 111 proceeding style.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "record_get_field_instances", "(", "arg_0", ".", "record", ",", "tag", "=", "\"245\"", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "field_get_subfields", "(", "arg_2", ")", "arg_4", "=", "[", "]", "if", "\"a\"", "in", "arg_3", ":", "arg_4", ".", "append", "(", "(", "\"a\"", ",", "arg_3", "[", "'a'", "]", "[", "0", "]", ")", ")", "if", "\"b\"", "in", "arg_3", ":", "arg_4", ".", "append", "(", "(", "\"c\"", ",", "arg_3", "[", "'b'", "]", "[", "0", "]", ")", ")", "record_add_field", "(", "arg_0", ".", "record", ",", "tag", "=", "\"111\"", ",", "subfields", "=", "arg_4", ")", "record_delete_fields", "(", "arg_0", ".", "record", ",", "tag", "=", "\"245\"", ")", "record_delete_fields", "(", "arg_0", ".", "record", ",", "tag", "=", "\"246\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Move title info from 245 to 111 proceeding style.\"\"\"\n        arg_1 = record_get_field_instances(arg_0.record,\n                                            tag=\"245\")\n        for arg_2 in arg_1:\n            arg_3 = field_get_subfields(arg_2)\n            arg_4 = []\n            if \"a\" in arg_3:\n                arg_4.append((\"a\", arg_3['a'][0]))\n            if \"b\" in arg_3:\n                arg_4.append((\"c\", arg_3['b'][0]))\n            record_add_field(arg_0.record,\n                             tag=\"111\",\n                             subfields=arg_4)\n        record_delete_fields(arg_0.record, tag=\"245\")\n        record_delete_fields(arg_0.record, tag=\"246\")", "path": "harvestingkit/inspire_cds_package/from_inspire.py", "identifier": "Inspire2CDS.update_title_to_proceeding", "docstring": "Move title info from 245 to 111 proceeding style.", "docstring_tokens": ["Move", "title", "info", "from", "245", "to", "111", "proceeding", "style", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 252314}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/utils.py#L240-L266", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Attempt to detect an intraday strategy. Get the number of\n    positions held at the end of the day, and divide that by the\n    number of unique stocks transacted every day. If the average quotient\n    is below a threshold, then an intraday strategy is detected.", "language": "python", "parameters": "(positions, transactions, threshold=0.25)", "return_statement": "return daily_pos.count(axis=1).sum() / txn_count < threshold", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.25", ")", ":", "arg_3", "=", "arg_1", ".", "copy", "(", ")", "arg_3", ".", "index", "=", "arg_3", ".", "index", ".", "date", "arg_5", "=", "arg_3", ".", "groupby", "(", "level", "=", "0", ")", ".", "symbol", ".", "nunique", "(", ")", ".", "sum", "(", ")", "arg_6", "=", "arg_0", ".", "drop", "(", "'cash'", ",", "axis", "=", "1", ")", ".", "replace", "(", "0", ",", "np", ".", "nan", ")", "return", "arg_6", ".", "count", "(", "axis", "=", "1", ")", ".", "sum", "(", ")", "/", "arg_5", "<", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=0.25):\n    \"\"\"\n    Attempt to detect an intraday strategy. Get the number of\n    positions held at the end of the day, and divide that by the\n    number of unique stocks transacted every day. If the average quotient\n    is below a threshold, then an intraday strategy is detected.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in create_full_tear_sheet.\n\n    Returns\n    -------\n    boolean\n        True if an intraday strategy is detected.\n    \"\"\"\n\n    arg_3 = arg_1.copy()\n    arg_3.index = arg_3.index.date\n    arg_5 = arg_3.groupby(level=0).symbol.nunique().sum()\n    arg_6 = arg_0.drop('cash', axis=1).replace(0, np.nan)\n    return arg_6.count(axis=1).sum() / arg_5 < arg_2", "path": "pyfolio/utils.py", "identifier": "detect_intraday", "docstring": "Attempt to detect an intraday strategy. Get the number of\n    positions held at the end of the day, and divide that by the\n    number of unique stocks transacted every day. If the average quotient\n    is below a threshold, then an intraday strategy is detected.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in create_full_tear_sheet.\n\n    Returns\n    -------\n    boolean\n        True if an intraday strategy is detected.", "docstring_tokens": ["Attempt", "to", "detect", "an", "intraday", "strategy", ".", "Get", "the", "number", "of", "positions", "held", "at", "the", "end", "of", "the", "day", "and", "divide", "that", "by", "the", "number", "of", "unique", "stocks", "transacted", "every", "day", ".", "If", "the", "average", "quotient", "is", "below", "a", "threshold", "then", "an", "intraday", "strategy", "is", "detected", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 252315}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/agent.py#L87-L98", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "Force a failed gossip member into the left state.", "language": "python", "parameters": "(self, node)", "return_statement": "return self.request(\"force-leave\", params=params, method=\"post\").status_code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"node\"", ":", "arg_1", "}", "return", "arg_0", ".", "request", "(", "\"force-leave\"", ",", "arg_2", "=", "arg_2", ",", "method", "=", "\"post\"", ")", ".", "status_code"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Force a failed gossip member into the left state.\n\n            https://www.nomadproject.io/docs/http/agent-force-leave.html\n\n            returns: 200 status code\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_2 = {\"node\": arg_1}\n        return arg_0.request(\"force-leave\", arg_2=arg_2, method=\"post\").status_code", "path": "nomad/api/agent.py", "identifier": "Agent.force_leave", "docstring": "Force a failed gossip member into the left state.\n\n            https://www.nomadproject.io/docs/http/agent-force-leave.html\n\n            returns: 200 status code\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["Force", "a", "failed", "gossip", "member", "into", "the", "left", "state", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 252316}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/iaca.py#L251-L284", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Let user interactively select block.", "language": "python", "parameters": "(blocks, default=None, debug=False)", "return_statement": "return block_idx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "print", "(", "\"Blocks found in assembly file:\"", ")", "print", "(", "\"      block     | OPs | pck. | AVX || Registers |    ZMM   |    YMM   |    XMM   |    GP   ||ptr.inc|\\n\"", "\"----------------+-----+------+-----++-----------+----------+----------+----------+---------++-------|\"", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ":", "print", "(", "'{:>2} {b[labels]!r:>12} | {b[ops]:>3} | {b[packed_instr]:>4} | {b[avx_instr]:>3} |'", "'| {b[regs][0]:>3} ({b[regs][1]:>3}) | {b[ZMM][0]:>3} ({b[ZMM][1]:>2}) | '", "'{b[YMM][0]:>3} ({b[YMM][1]:>2}) | '", "'{b[XMM][0]:>3} ({b[XMM][1]:>2}) | {b[GP][0]:>2} ({b[GP][1]:>2}) || '", "'{b[pointer_increment]!s:>5} |'", ".", "format", "(", "arg_3", ",", "arg_4", "=", "arg_4", ")", ")", "if", "arg_2", ":", "arg_5", "=", "arg_4", "[", "'first_line'", "]", "print", "(", "' '", "*", "4", "+", "'Code:'", ")", "for", "arg_6", "in", "arg_4", "[", "'lines'", "]", ":", "print", "(", "' '", "*", "8", "+", "'{:>5} | {}'", ".", "format", "(", "arg_5", ",", "arg_6", ")", ")", "arg_5", "+=", "1", "print", "(", "' '", "*", "4", "+", "'Metadata:'", ")", "print", "(", "textwrap", ".", "indent", "(", "pformat", "(", "{", "arg_7", ":", "arg_8", "for", "arg_7", ",", "arg_8", "in", "arg_4", ".", "items", "(", ")", "if", "arg_7", "not", "in", "[", "'lines'", "]", "}", ")", ",", "' '", "*", "8", ")", ")", "arg_9", "=", "-", "1", "while", "not", "(", "0", "<=", "arg_9", "<", "len", "(", "arg_0", ")", ")", ":", "arg_9", "=", "input", "(", "\"Choose block to be marked [\"", "+", "str", "(", "arg_1", ")", "+", "\"]: \"", ")", "or", "arg_1", "try", ":", "arg_9", "=", "int", "(", "arg_9", ")", "except", "ValueError", ":", "arg_9", "=", "-", "1", "return", "arg_9"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n    \"\"\"Let user interactively select block.\"\"\"\n    print(\"Blocks found in assembly file:\")\n    print(\"      block     | OPs | pck. | AVX || Registers |    ZMM   |    YMM   |    XMM   |    GP   ||ptr.inc|\\n\"\n          \"----------------+-----+------+-----++-----------+----------+----------+----------+---------++-------|\")\n    for arg_3, arg_4 in arg_0:\n        print('{:>2} {b[labels]!r:>12} | {b[ops]:>3} | {b[packed_instr]:>4} | {b[avx_instr]:>3} |'\n              '| {b[regs][0]:>3} ({b[regs][1]:>3}) | {b[ZMM][0]:>3} ({b[ZMM][1]:>2}) | '\n              '{b[YMM][0]:>3} ({b[YMM][1]:>2}) | '\n              '{b[XMM][0]:>3} ({b[XMM][1]:>2}) | {b[GP][0]:>2} ({b[GP][1]:>2}) || '\n              '{b[pointer_increment]!s:>5} |'.format(arg_3, arg_4=arg_4))\n\n        if arg_2:\n            arg_5 = arg_4['first_line']\n            print(' '*4 + 'Code:')\n            for arg_6 in arg_4['lines']:\n                print(' '*8 + '{:>5} | {}'.format(arg_5, arg_6))\n                arg_5 += 1\n            print(' '*4 + 'Metadata:')\n            print(textwrap.indent(\n                pformat({arg_7: arg_8 for arg_7,arg_8 in arg_4.items() if arg_7 not in ['lines']}),\n                ' '*8))\n\n    # Let user select block:\n    arg_9 = -1\n    while not (0 <= arg_9 < len(arg_0)):\n        arg_9 = input(\"Choose block to be marked [\" + str(arg_1) + \"]: \") or arg_1\n        try:\n            arg_9 = int(arg_9)\n        except ValueError:\n            arg_9 = -1\n    # block = blocks[block_idx][1]\n\n    return arg_9", "path": "kerncraft/iaca.py", "identifier": "userselect_block", "docstring": "Let user interactively select block.", "docstring_tokens": ["Let", "user", "interactively", "select", "block", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 252317}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/loadutils.py#L34-L69", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Get filenames for donor and acceptor timestamps for the given parameters", "language": "python", "parameters": "(d_em_kHz, d_bg_kHz, a_em_kHz, a_bg_kHz,\n        ID='1+2+3+4+5+6', t_tot='480', num_p='30', pM='64',\n        t_step=0.5e-6, D=1.2e-11, dir_='')", "return_statement": "return dir_+fname_d, dir_+fname_a, name, clk_p, E_sim", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "'1+2+3+4+5+6'", ",", "arg_5", "=", "'480'", ",", "arg_6", "=", "'30'", ",", "arg_7", "=", "'64'", ",", "arg_8", "=", "0.5e-6", ",", "arg_9", "=", "1.2e-11", ",", "arg_10", "=", "''", ")", ":", "arg_11", "=", "arg_8", "/", "32.", "arg_12", "=", "1.", "*", "arg_2", "/", "(", "arg_2", "+", "arg_0", ")", "arg_13", "=", "100.", "*", "arg_12", "print", "(", "\"Simulated FRET value: %.1f%%\"", "%", "arg_13", ")", "arg_14", "=", "\"%04d\"", "%", "arg_0", "arg_15", "=", "\"%04d\"", "%", "arg_2", "arg_16", "=", "\"%04.1f\"", "%", "arg_1", "arg_17", "=", "\"%04.1f\"", "%", "arg_3", "print", "(", "\"D: EM %s BG %s \"", "%", "(", "arg_14", ",", "arg_16", ")", ")", "print", "(", "\"A: EM %s BG %s \"", "%", "(", "arg_15", ",", "arg_17", ")", ")", "arg_18", "=", "(", "'ph_times_{t_tot}s_D{D}_{np}P_{pM}pM_'", "'step{ts_us}us_ID{ID}_EM{em}kHz_BG{bg}kHz.npy'", ")", ".", "format", "(", "em", "=", "arg_14", ",", "bg", "=", "arg_16", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", "np", "=", "arg_6", ",", "arg_4", "=", "arg_4", ",", "ts_us", "=", "arg_8", "*", "1e6", ",", "arg_9", "=", "arg_9", ")", "arg_19", "=", "(", "'ph_times_{t_tot}s_D{D}_{np}P_{pM}pM_'", "'step{ts_us}us_ID{ID}_EM{em}kHz_BG{bg}kHz.npy'", ")", ".", "format", "(", "em", "=", "arg_15", ",", "bg", "=", "arg_17", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", "np", "=", "arg_6", ",", "arg_4", "=", "arg_4", ",", "ts_us", "=", "arg_8", "*", "1e6", ",", "arg_9", "=", "arg_9", ")", "print", "(", "arg_18", ")", "print", "(", "arg_19", ")", "arg_20", "=", "(", "'BroSim_E{:.1f}_dBG{:.1f}k_aBG{:.1f}k_'", "'dEM{:.0f}k'", ")", ".", "format", "(", "arg_13", ",", "arg_1", ",", "arg_3", ",", "arg_0", ")", "return", "arg_10", "+", "arg_18", ",", "arg_10", "+", "arg_19", ",", "arg_20", ",", "arg_11", ",", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n        arg_4='1+2+3+4+5+6', arg_5='480', arg_6='30', arg_7='64',\n        arg_8=0.5e-6, arg_9=1.2e-11, arg_10=''):\n    \"\"\"Get filenames for donor and acceptor timestamps for the given parameters\n    \"\"\"\n\n    arg_11 = arg_8/32. # with t_step=0.5us -> 156.25 ns\n    arg_12 = 1.*arg_2/(arg_2 + arg_0)\n\n    arg_13 = 100.*arg_12\n    print(\"Simulated FRET value: %.1f%%\" % arg_13)\n\n    arg_14 = \"%04d\" % arg_0\n    arg_15 = \"%04d\" % arg_2\n    arg_16 = \"%04.1f\" % arg_1\n    arg_17 = \"%04.1f\" % arg_3\n\n    print(\"D: EM %s BG %s \" % (arg_14, arg_16))\n    print(\"A: EM %s BG %s \" % (arg_15, arg_17))\n\n    arg_18 = ('ph_times_{t_tot}s_D{D}_{np}P_{pM}pM_'\n               'step{ts_us}us_ID{ID}_EM{em}kHz_BG{bg}kHz.npy').format(\n                       em=arg_14, bg=arg_16, arg_5=arg_5, arg_7=arg_7,\n                       np=arg_6, arg_4=arg_4, ts_us=arg_8*1e6, arg_9=arg_9)\n\n    arg_19 = ('ph_times_{t_tot}s_D{D}_{np}P_{pM}pM_'\n               'step{ts_us}us_ID{ID}_EM{em}kHz_BG{bg}kHz.npy').format(\n                       em=arg_15, bg=arg_17, arg_5=arg_5, arg_7=arg_7,\n                       np=arg_6, arg_4=arg_4, ts_us=arg_8*1e6, arg_9=arg_9)\n    print(arg_18)\n    print(arg_19)\n\n    arg_20 = ('BroSim_E{:.1f}_dBG{:.1f}k_aBG{:.1f}k_'\n            'dEM{:.0f}k').format(arg_13, arg_1, arg_3, arg_0)\n\n    return arg_10+arg_18, arg_10+arg_19, arg_20, arg_11, arg_12", "path": "pybromo/loadutils.py", "identifier": "get_bromo_fnames_da", "docstring": "Get filenames for donor and acceptor timestamps for the given parameters", "docstring_tokens": ["Get", "filenames", "for", "donor", "and", "acceptor", "timestamps", "for", "the", "given", "parameters"], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 252318}
{"url": "https://github.com/addok/addok/blob/46a270d76ec778d2b445c2be753e5c6ba070a9b2/addok/helpers/__init__.py#L144-L164", "sha": "46a270d76ec778d2b445c2be753e5c6ba070a9b2", "docstring_summary": "Customized version of imap_unordered.", "language": "python", "parameters": "(self, func, iterable, chunksize)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "assert", "arg_0", ".", "_state", "==", "RUN", "arg_4", "=", "Pool", ".", "_get_tasks", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "IMapUnorderedIterator", "(", "arg_0", ".", "_cache", ")", "arg_6", "=", "(", "(", "arg_5", ".", "_job", ",", "i", ",", "arg_1", ",", "chunk", ",", "{", "}", ")", "for", "i", ",", "(", "_", ",", "chunk", ")", "in", "enumerate", "(", "arg_4", ")", ")", "arg_0", ".", "_taskqueue", ".", "put", "(", "(", "arg_6", ",", "arg_5", ".", "_set_length", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Customized version of Func.\n\n        Directly send chunks to func, instead of iterating in each process and\n        sending one by one.\n\n        Original:\n        https://hg.python.org/cpython/file/tip/Lib/multiprocessing/pool.py#l271\n\n        Other tried options:\n        - map_async: makes a list(iterable), so it loads all the data for each\n          process into RAM\n        - apply_async: needs manual chunking\n        \"\"\"\n        assert arg_0._state == RUN\n        arg_4 = Pool._get_tasks(arg_1, arg_2, arg_3)\n        arg_5 = IMapUnorderedIterator(arg_0._cache)\n        arg_6 = ((arg_5._job, i, arg_1, chunk, {})\n                 for i, (_, chunk) in enumerate(arg_4))\n        arg_0._taskqueue.put((arg_6, arg_5._set_length))\n        return arg_5", "path": "addok/helpers/__init__.py", "identifier": "ChunkedPool.imap_unordered", "docstring": "Customized version of imap_unordered.\n\n        Directly send chunks to func, instead of iterating in each process and\n        sending one by one.\n\n        Original:\n        https://hg.python.org/cpython/file/tip/Lib/multiprocessing/pool.py#l271\n\n        Other tried options:\n        - map_async: makes a list(iterable), so it loads all the data for each\n          process into RAM\n        - apply_async: needs manual chunking", "docstring_tokens": ["Customized", "version", "of", "imap_unordered", "."], "nwo": "addok/addok", "score": 0.5575306264469764, "idx": 252319}
{"url": "https://github.com/trivago/Protector/blob/7ebe7bde965e27737b961a0cb5740724d174fdc7/protector/__main__.py#L33-L50", "sha": "7ebe7bde965e27737b961a0cb5740724d174fdc7", "docstring_summary": "Check if we can write to the given file", "language": "python", "parameters": "(file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "open", "(", "arg_0", ",", "'a'", ")", "except", "IOError", ":", "print", "(", "\"Can't open file {}. \"", "\"Please grant write permissions or change the path in your config\"", ".", "format", "(", "arg_0", ")", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Check if we can write to the given file\n\n    Otherwise since we might detach the process to run in the background\n    we might never find out that writing failed and get an ugly\n    exit message on startup. For example:\n    ERROR: Child exited immediately with non-zero exit code 127\n\n    So we catch this error upfront and print a nicer error message\n    with a hint on how to fix it.\n    \"\"\"\n    try:\n        open(arg_0, 'a')\n    except IOError:\n        print(\"Can't open file {}. \"\n              \"Please grant write permissions or change the path in your config\".format(arg_0))\n        sys.exit(1)", "path": "protector/__main__.py", "identifier": "check_write_permissions", "docstring": "Check if we can write to the given file\n\n    Otherwise since we might detach the process to run in the background\n    we might never find out that writing failed and get an ugly\n    exit message on startup. For example:\n    ERROR: Child exited immediately with non-zero exit code 127\n\n    So we catch this error upfront and print a nicer error message\n    with a hint on how to fix it.", "docstring_tokens": ["Check", "if", "we", "can", "write", "to", "the", "given", "file"], "nwo": "trivago/Protector", "score": 0.28011057986078114, "idx": 252320}
{"url": "https://github.com/ambv/retype/blob/03137abd4d9c9845f3cced1006190b5cca64d879/retype.py#L1467-L1478", "sha": "03137abd4d9c9845f3cced1006190b5cca64d879", "docstring_summary": "lib2to3's AST requires unique objects as children.", "language": "python", "parameters": "(n, prefix=None)", "return_statement": "return n", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Leaf", ")", ":", "return", "Leaf", "(", "arg_0", ".", "type", ",", "arg_0", ".", "value", ",", "arg_1", "=", "arg_0", ".", "prefix", "if", "arg_1", "is", "None", "else", "arg_1", ")", "arg_0", ".", "parent", "=", "None", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "prefix", "=", "arg_1", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"lib2to3's AST requires unique objects as children.\"\"\"\n\n    if isinstance(arg_0, Leaf):\n        return Leaf(arg_0.type, arg_0.value, arg_1=arg_0.prefix if arg_1 is None else arg_1)\n\n    # this is hacky, we assume complex nodes are just being reused once from the\n    # original AST.\n    arg_0.parent = None\n    if arg_1 is not None:\n        arg_0.prefix = arg_1\n    return arg_0", "path": "retype.py", "identifier": "new", "docstring": "lib2to3's AST requires unique objects as children.", "docstring_tokens": ["lib2to3", "s", "AST", "requires", "unique", "objects", "as", "children", "."], "nwo": "ambv/retype", "score": 0.45641484014477285, "idx": 252321}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/views.py#L244-L277", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Summarises the inventory status of the given items, grouping by\n    invoice status.", "language": "python", "parameters": "(request, form)", "return_statement": "return ListReport(\"Inventory\", headings, data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "cleaned_data", "[", "\"product\"", "]", "arg_3", "=", "arg_1", ".", "cleaned_data", "[", "\"category\"", "]", "arg_4", "=", "commerce", ".", "ProductItem", ".", "objects", ".", "filter", "(", "Q", "(", "product__in", "=", "arg_2", ")", "|", "Q", "(", "product__category__in", "=", "arg_3", ")", ",", ")", ".", "select_related", "(", "\"cart\"", ",", "\"product\"", ")", "arg_4", "=", "group_by_cart_status", "(", "arg_4", ",", "[", "\"product__category__order\"", ",", "\"product__order\"", "]", ",", "[", "\"product\"", ",", "\"product__category__name\"", ",", "\"product__name\"", "]", ",", ")", "arg_5", "=", "[", "\"Product\"", ",", "\"Paid\"", ",", "\"Reserved\"", ",", "\"Unreserved\"", ",", "\"Refunded\"", ",", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_4", ":", "arg_6", ".", "append", "(", "[", "\"%s - %s\"", "%", "(", "arg_7", "[", "\"product__category__name\"", "]", ",", "arg_7", "[", "\"product__name\"", "]", ")", ",", "arg_7", "[", "\"total_paid\"", "]", ",", "arg_7", "[", "\"total_reserved\"", "]", ",", "arg_7", "[", "\"total_unreserved\"", "]", ",", "arg_7", "[", "\"total_refunded\"", "]", ",", "]", ")", "return", "ListReport", "(", "\"Inventory\"", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n    ''' Summarises the inventory status of the given items, grouping by\n    invoice status. '''\n\n    arg_2 = arg_1.cleaned_data[\"product\"]\n    arg_3 = arg_1.cleaned_data[\"category\"]\n\n    arg_4 = commerce.ProductItem.objects.filter(\n        Q(product__in=arg_2) | Q(product__category__in=arg_3),\n    ).select_related(\"cart\", \"product\")\n\n    arg_4 = group_by_cart_status(\n        arg_4,\n        [\"product__category__order\", \"product__order\"],\n        [\"product\", \"product__category__name\", \"product__name\"],\n    )\n\n    arg_5 = [\n        \"Product\", \"Paid\", \"Reserved\", \"Unreserved\", \"Refunded\",\n    ]\n    arg_6 = []\n\n    for arg_7 in arg_4:\n        arg_6.append([\n            \"%s - %s\" % (\n                arg_7[\"product__category__name\"], arg_7[\"product__name\"]\n            ),\n            arg_7[\"total_paid\"],\n            arg_7[\"total_reserved\"],\n            arg_7[\"total_unreserved\"],\n            arg_7[\"total_refunded\"],\n        ])\n\n    return ListReport(\"Inventory\", arg_5, arg_6)", "path": "registrasion/reporting/views.py", "identifier": "product_status", "docstring": "Summarises the inventory status of the given items, grouping by\n    invoice status.", "docstring_tokens": ["Summarises", "the", "inventory", "status", "of", "the", "given", "items", "grouping", "by", "invoice", "status", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 252322}
{"url": "https://github.com/rbw/flask-journey/blob/6181f59a7b5eef6a85b86ce6ed7d03c91f6bd285/flask_journey/journey.py#L113-L133", "sha": "6181f59a7b5eef6a85b86ce6ed7d03c91f6bd285", "docstring_summary": "Attaches a bundle object", "language": "python", "parameters": "(self, bundle)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "BlueprintBundle", ")", ":", "raise", "IncompatibleBundle", "(", "'BlueprintBundle object passed to Func must be of type {0}'", ".", "format", "(", "BlueprintBundle", ")", ")", "elif", "len", "(", "arg_1", ".", "blueprints", ")", "==", "0", ":", "raise", "MissingBlueprints", "(", "\"Bundles must contain at least one flask.Blueprint\"", ")", "elif", "arg_0", ".", "_bundle_exists", "(", "arg_1", ".", "path", ")", ":", "raise", "ConflictingPath", "(", "\"Duplicate bundle path {0}\"", ".", "format", "(", "arg_1", ".", "path", ")", ")", "elif", "arg_0", ".", "_journey_path", "==", "arg_1", ".", "path", "==", "'/'", ":", "raise", "ConflictingPath", "(", "\"Bundle path and Journey path cannot both be {0}\"", ".", "format", "(", "arg_1", ".", "path", ")", ")", "arg_0", ".", "_attached_bundles", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Attaches a bundle object\n\n        :param bundle: :class:`flask_journey.BlueprintBundle` object\n        :raises:\n            - IncompatibleBundle if the bundle is not of type `BlueprintBundle`\n            - ConflictingPath if a bundle already exists at bundle.path\n            - MissingBlueprints if the bundle doesn't contain any blueprints\n        \"\"\"\n\n        if not isinstance(arg_1, BlueprintBundle):\n            raise IncompatibleBundle('BlueprintBundle object passed to Func must be of type {0}'\n                                     .format(BlueprintBundle))\n        elif len(arg_1.blueprints) == 0:\n            raise MissingBlueprints(\"Bundles must contain at least one flask.Blueprint\")\n        elif arg_0._bundle_exists(arg_1.path):\n            raise ConflictingPath(\"Duplicate bundle path {0}\".format(arg_1.path))\n        elif arg_0._journey_path == arg_1.path == '/':\n            raise ConflictingPath(\"Bundle path and Journey path cannot both be {0}\".format(arg_1.path))\n\n        arg_0._attached_bundles.append(arg_1)", "path": "flask_journey/journey.py", "identifier": "Journey.attach_bundle", "docstring": "Attaches a bundle object\n\n        :param bundle: :class:`flask_journey.BlueprintBundle` object\n        :raises:\n            - IncompatibleBundle if the bundle is not of type `BlueprintBundle`\n            - ConflictingPath if a bundle already exists at bundle.path\n            - MissingBlueprints if the bundle doesn't contain any blueprints", "docstring_tokens": ["Attaches", "a", "bundle", "object"], "nwo": "rbw/flask-journey", "score": 0.1903525543429651, "idx": 252323}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cmd.py#L163-L199", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Simultaneously reports and captures stdout and stderr from a process", "language": "python", "parameters": "(make_proc, stdout=None, stderr=None, backend='auto')", "return_statement": "return proc, logged_out, logged_err", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'auto'", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "if", "arg_3", "==", "'auto'", ":", "arg_3", "=", "'thread'", "if", "arg_3", "==", "'select'", ":", "if", "not", "POSIX", ":", "raise", "NotImplementedError", "(", "'select is only available on posix'", ")", "arg_6", "=", "_proc_iteroutput_select", "elif", "arg_3", "==", "'thread'", ":", "arg_6", "=", "_proc_iteroutput_thread", "else", ":", "raise", "ValueError", "(", "'backend must be select, thread, or auto'", ")", "arg_7", "=", "arg_0", "(", ")", "for", "arg_8", ",", "arg_9", "in", "arg_6", "(", "arg_7", ")", ":", "if", "arg_8", ":", "if", "arg_1", ":", "arg_1", ".", "write", "(", "arg_8", ")", "arg_1", ".", "flush", "(", ")", "arg_4", ".", "append", "(", "arg_8", ")", "if", "arg_9", ":", "if", "arg_2", ":", "arg_2", ".", "write", "(", "arg_9", ")", "arg_2", ".", "flush", "(", ")", "arg_5", ".", "append", "(", "arg_9", ")", "return", "arg_7", ",", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3='auto'):\n    \"\"\"\n    Simultaneously reports and captures stdout and stderr from a process\n\n    subprocess must be created using (stdout=subprocess.PIPE,\n    stderr=subprocess.PIPE)\n    \"\"\"\n    arg_4 = []\n    arg_5 = []\n    if arg_3 == 'auto':\n        # backend = 'select' if POSIX else 'thread'\n        arg_3 = 'thread'\n\n    if arg_3 == 'select':\n        if not POSIX:  # nocover\n            raise NotImplementedError('select is only available on posix')\n        # the select-based version is stable, but slow\n        arg_6 = _proc_iteroutput_select\n    elif arg_3 == 'thread':\n        # the thread version is fast, but might run into issues.\n        arg_6 = _proc_iteroutput_thread\n    else:\n        raise ValueError('backend must be select, thread, or auto')\n\n    arg_7 = arg_0()\n    for arg_8, arg_9 in arg_6(arg_7):\n        if arg_8:\n            if arg_1:  # pragma: nobranch\n                arg_1.write(arg_8)\n                arg_1.flush()\n            arg_4.append(arg_8)\n        if arg_9:\n            if arg_2:  # pragma: nobranch\n                arg_2.write(arg_9)\n                arg_2.flush()\n            arg_5.append(arg_9)\n    return arg_7, arg_4, arg_5", "path": "ubelt/util_cmd.py", "identifier": "_tee_output", "docstring": "Simultaneously reports and captures stdout and stderr from a process\n\n    subprocess must be created using (stdout=subprocess.PIPE,\n    stderr=subprocess.PIPE)", "docstring_tokens": ["Simultaneously", "reports", "and", "captures", "stdout", "and", "stderr", "from", "a", "process"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 252324}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L368-L412", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Validate `data` and return a list of validation problems found.", "language": "python", "parameters": "(self, data,\n                 expect_header_row=True,\n                 ignore_lines=0,\n                 summarize=False,\n                 limit=0,\n                 context=None,\n                 report_unexpected_exceptions=True)", "return_statement": "return problems", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "0", ",", "arg_4", "=", "False", ",", "arg_5", "=", "0", ",", "arg_6", "=", "None", ",", "arg_7", "=", "True", ")", ":", "arg_8", "=", "list", "(", ")", "arg_9", "=", "arg_0", ".", "iFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_6", ",", "arg_7", ")", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_9", ")", ":", "if", "not", "arg_5", "or", "arg_10", "<", "arg_5", ":", "arg_8", ".", "append", "(", "arg_11", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1,\n                 arg_2=True,\n                 arg_3=0,\n                 arg_4=False,\n                 arg_5=0,\n                 arg_6=None,\n                 arg_7=True):\n        \"\"\"\n        Validate `data` and return a list of validation problems found.\n\n        Arguments\n        ---------\n\n        `data` - any source of row-oriented data, e.g., as provided by a\n        `csv.reader`, or a list of lists of strings, or ...\n\n        `expect_header_row` - does the data contain a header row (i.e., the\n        first record is a list of field names)? Defaults to True.\n\n        `ignore_lines` - ignore n lines (rows) at the beginning of the data\n\n        `summarize` - only report problem codes, no other details\n\n        `limit` - report at most n problems\n\n        `context` - a dictionary of any additional information to be added to\n        any problems found - useful if problems are being aggregated from\n        multiple validators\n\n        `report_unexpected_exceptions` - value check function, value predicates,\n        record check functions, record predicates, and other user-supplied\n        validation functions may raise unexpected exceptions. If this argument\n        is true, any unexpected exceptions will be reported as validation\n        problems; if False, unexpected exceptions will be handled silently.\n\n        \"\"\"\n\n        arg_8 = list()\n        arg_9 = arg_0.iFunc(arg_1, arg_2,\n                                           arg_3, arg_4, arg_6,\n                                           arg_7)\n        for arg_10, arg_11 in enumerate(arg_9):\n            if not arg_5 or arg_10 < arg_5:\n                arg_8.append(arg_11)\n        return arg_8", "path": "csvvalidator.py", "identifier": "CSVValidator.validate", "docstring": "Validate `data` and return a list of validation problems found.\n\n        Arguments\n        ---------\n\n        `data` - any source of row-oriented data, e.g., as provided by a\n        `csv.reader`, or a list of lists of strings, or ...\n\n        `expect_header_row` - does the data contain a header row (i.e., the\n        first record is a list of field names)? Defaults to True.\n\n        `ignore_lines` - ignore n lines (rows) at the beginning of the data\n\n        `summarize` - only report problem codes, no other details\n\n        `limit` - report at most n problems\n\n        `context` - a dictionary of any additional information to be added to\n        any problems found - useful if problems are being aggregated from\n        multiple validators\n\n        `report_unexpected_exceptions` - value check function, value predicates,\n        record check functions, record predicates, and other user-supplied\n        validation functions may raise unexpected exceptions. If this argument\n        is true, any unexpected exceptions will be reported as validation\n        problems; if False, unexpected exceptions will be handled silently.", "docstring_tokens": ["Validate", "data", "and", "return", "a", "list", "of", "validation", "problems", "found", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 252325}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/main.py#L49-L86", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "The entry point of this script to generate change log\n        'ChangelogGeneratorError' Is thrown when one\n        of the specified tags was not found in list of tags.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "options", ".", "project", "or", "not", "arg_0", ".", "options", ".", "user", ":", "print", "(", "\"Project and/or user missing. \"", "\"For help Func:\\n  pygcgen --help\"", ")", "return", "if", "not", "arg_0", ".", "options", ".", "quiet", ":", "print", "(", "\"Generating changelog...\"", ")", "arg_1", "=", "None", "try", ":", "arg_1", "=", "arg_0", ".", "generator", ".", "compound_changelog", "(", ")", "except", "ChangelogGeneratorError", "as", "err", ":", "print", "(", "\"\\n\\033[91m\\033[1m{}\\x1b[0m\"", ".", "format", "(", "err", ".", "args", "[", "0", "]", ")", ")", "exit", "(", "1", ")", "if", "not", "arg_1", ":", "if", "not", "arg_0", ".", "options", ".", "quiet", ":", "print", "(", "\"Empty changelog generated. {} not written.\"", ".", "format", "(", "arg_0", ".", "options", ".", "output", ")", ")", "return", "if", "arg_0", ".", "options", ".", "no_overwrite", ":", "arg_2", "=", "checkname", "(", "arg_0", ".", "options", ".", "output", ")", "else", ":", "arg_2", "=", "arg_0", ".", "options", ".", "output", "with", "codecs", ".", "open", "(", "arg_2", ",", "\"w\"", ",", "\"utf-8\"", ")", "as", "fh", ":", "fh", ".", "write", "(", "arg_1", ")", "if", "not", "arg_0", ".", "options", ".", "quiet", ":", "print", "(", "\"Done!\"", ")", "print", "(", "\"Generated changelog written to {}\"", ".", "format", "(", "arg_2", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        The entry point of this script to generate change log\n        'ChangelogGeneratorError' Is thrown when one\n        of the specified tags was not found in list of tags.\n        \"\"\"\n        if not arg_0.options.project or not arg_0.options.user:\n            print(\"Project and/or user missing. \"\n                  \"For help Func:\\n  pygcgen --help\")\n            return\n\n        if not arg_0.options.quiet:\n            print(\"Generating changelog...\")\n\n        arg_1 = None\n        try:\n            arg_1 = arg_0.generator.compound_changelog()\n        except ChangelogGeneratorError as err:\n            print(\"\\n\\033[91m\\033[1m{}\\x1b[0m\".format(err.args[0]))\n            exit(1)\n        if not arg_1:\n            if not arg_0.options.quiet:\n                print(\"Empty changelog generated. {} not written.\".format(\n                    arg_0.options.output)\n                )\n            return\n\n        if arg_0.options.no_overwrite:\n            arg_2 = checkname(arg_0.options.output)\n        else:\n            arg_2 = arg_0.options.output\n\n        with codecs.open(arg_2, \"w\", \"utf-8\") as fh:\n            fh.write(arg_1)\n\n        if not arg_0.options.quiet:\n            print(\"Done!\")\n            print(\"Generated changelog written to {}\".format(arg_2))", "path": "pygcgen/main.py", "identifier": "ChangelogGenerator.run", "docstring": "The entry point of this script to generate change log\n        'ChangelogGeneratorError' Is thrown when one\n        of the specified tags was not found in list of tags.", "docstring_tokens": ["The", "entry", "point", "of", "this", "script", "to", "generate", "change", "log", "ChangelogGeneratorError", "Is", "thrown", "when", "one", "of", "the", "specified", "tags", "was", "not", "found", "in", "list", "of", "tags", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 252326}
{"url": "https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/contrib/mixins.py#L120-L131", "sha": "188e1bf1f15a44d9a599028d020083af9fb43ea7", "docstring_summary": "If sort_type is None - inverse current sort for field, if no sorted - use asc", "language": "python", "parameters": "(self, field_name, sort_type=None)", "return_statement": "return '?%s' % self.initial_params.urlencode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "if", "arg_0", ".", "initial_sort", "==", "arg_1", ":", "arg_2", "=", "'desc'", "if", "arg_0", ".", "initial_sort_type", "==", "'asc'", "else", "'asc'", "else", ":", "arg_2", "=", "'asc'", "arg_0", ".", "initial_params", "[", "arg_0", ".", "sort_param_name", "]", "=", "arg_0", ".", "sort_fields", "[", "arg_1", "]", "arg_0", ".", "initial_params", "[", "arg_0", ".", "sort_type_param_name", "]", "=", "arg_2", "return", "'?%s'", "%", "arg_0", ".", "initial_params", ".", "urlencode", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        If sort_type is None - inverse current sort for field, if no sorted - use asc\n        \"\"\"\n        if not arg_2:\n            if arg_0.initial_sort == arg_1:\n                arg_2 = 'desc' if arg_0.initial_sort_type == 'asc' else 'asc'\n            else:\n                arg_2 = 'asc'\n        arg_0.initial_params[arg_0.sort_param_name] = arg_0.sort_fields[arg_1]\n        arg_0.initial_params[arg_0.sort_type_param_name] = arg_2\n        return '?%s' % arg_0.initial_params.urlencode()", "path": "extra_views/contrib/mixins.py", "identifier": "SortHelper.get_params_for_field", "docstring": "If sort_type is None - inverse current sort for field, if no sorted - use asc", "docstring_tokens": ["If", "sort_type", "is", "None", "-", "inverse", "current", "sort", "for", "field", "if", "no", "sorted", "-", "use", "asc"], "nwo": "AndrewIngram/django-extra-views", "score": 0.5916871811422788, "idx": 252327}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L372-L412", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Insert or append pauli to the targeted indices.", "language": "python", "parameters": "(self, indices=None, paulis=None, pauli_labels=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "not", "None", ":", "if", "arg_2", "is", "not", "None", ":", "raise", "QiskitError", "(", "\"Please only provide either `paulis` or `pauli_labels`\"", ")", "if", "isinstance", "(", "arg_3", ",", "str", ")", ":", "arg_3", "=", "list", "(", "arg_3", ")", "arg_2", "=", "Pauli", ".", "from_label", "(", "arg_3", "[", ":", ":", "-", "1", "]", ")", "if", "arg_1", "is", "None", ":", "arg_0", ".", "_z", "=", "np", ".", "concatenate", "(", "(", "arg_0", ".", "_z", ",", "arg_2", ".", "z", ")", ")", "arg_0", ".", "_x", "=", "np", ".", "concatenate", "(", "(", "arg_0", ".", "_x", ",", "arg_2", ".", "x", ")", ")", "else", ":", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_0", ".", "_z", "=", "np", ".", "insert", "(", "arg_0", ".", "_z", ",", "arg_1", ",", "arg_2", ".", "z", ")", "arg_0", ".", "_x", "=", "np", ".", "insert", "(", "arg_0", ".", "_x", ",", "arg_1", ",", "arg_2", ".", "x", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"\n        Insert or append pauli to the targeted indices.\n\n        If indices is None, it means append at the end.\n\n        Args:\n            indices (list[int]): the qubit indices to be inserted\n            paulis (Pauli): the to-be-inserted or appended pauli\n            pauli_labels (list[str]): the to-be-inserted or appended pauli label\n\n        Note:\n            the indices refers to the localion of original paulis,\n            e.g. if indices = [0, 2], pauli_labels = ['Z', 'I'] and original pauli = 'ZYXI'\n            the pauli will be updated to ZY'I'XI'Z'\n            'Z' and 'I' are inserted before the qubit at 0 and 2.\n\n        Returns:\n            Pauli: self\n\n        Raises:\n            QiskitError: provide both `paulis` and `pauli_labels` at the same time\n        \"\"\"\n        if arg_3 is not None:\n            if arg_2 is not None:\n                raise QiskitError(\"Please only provide either `paulis` or `pauli_labels`\")\n            if isinstance(arg_3, str):\n                arg_3 = list(arg_3)\n            # since pauli label is in reversed order.\n            arg_2 = Pauli.from_label(arg_3[::-1])\n\n        if arg_1 is None:  # append\n            arg_0._z = np.concatenate((arg_0._z, arg_2.z))\n            arg_0._x = np.concatenate((arg_0._x, arg_2.x))\n        else:\n            if not isinstance(arg_1, list):\n                arg_1 = [arg_1]\n            arg_0._z = np.insert(arg_0._z, arg_1, arg_2.z)\n            arg_0._x = np.insert(arg_0._x, arg_1, arg_2.x)\n\n        return arg_0", "path": "qiskit/quantum_info/operators/pauli.py", "identifier": "Pauli.insert_paulis", "docstring": "Insert or append pauli to the targeted indices.\n\n        If indices is None, it means append at the end.\n\n        Args:\n            indices (list[int]): the qubit indices to be inserted\n            paulis (Pauli): the to-be-inserted or appended pauli\n            pauli_labels (list[str]): the to-be-inserted or appended pauli label\n\n        Note:\n            the indices refers to the localion of original paulis,\n            e.g. if indices = [0, 2], pauli_labels = ['Z', 'I'] and original pauli = 'ZYXI'\n            the pauli will be updated to ZY'I'XI'Z'\n            'Z' and 'I' are inserted before the qubit at 0 and 2.\n\n        Returns:\n            Pauli: self\n\n        Raises:\n            QiskitError: provide both `paulis` and `pauli_labels` at the same time", "docstring_tokens": ["Insert", "or", "append", "pauli", "to", "the", "targeted", "indices", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252328}
{"url": "https://github.com/okunishinishi/python-stringcase/blob/700ad111be16b384aadaddcf8199f9390575c7b6/stringcase.py#L86-L100", "sha": "700ad111be16b384aadaddcf8199f9390575c7b6", "docstring_summary": "Convert string into path case.\n    Join punctuation with slash.", "language": "python", "parameters": "(string)", "return_statement": "return re.sub(r\"_\", \"/\", string)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "snakecase", "(", "arg_0", ")", "if", "not", "arg_0", ":", "return", "arg_0", "return", "re", ".", "sub", "(", "r\"_\"", ",", "\"/\"", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Convert string into path case.\n    Join punctuation with slash.\n\n    Args:\n        string: String to convert.\n\n    Returns:\n        string: Path cased string.\n\n    \"\"\"\n    arg_0 = snakecase(arg_0)\n    if not arg_0:\n        return arg_0\n    return re.sub(r\"_\", \"/\", arg_0)", "path": "stringcase.py", "identifier": "pathcase", "docstring": "Convert string into path case.\n    Join punctuation with slash.\n\n    Args:\n        string: String to convert.\n\n    Returns:\n        string: Path cased string.", "docstring_tokens": ["Convert", "string", "into", "path", "case", ".", "Join", "punctuation", "with", "slash", "."], "nwo": "okunishinishi/python-stringcase", "score": 0.6117565785012207, "idx": 252329}
{"url": "https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L295-L305", "sha": "cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174", "docstring_summary": "Send a message to the thermostat", "language": "python", "parameters": "(self, index, message=\"Hello from python-ecobee!\")", "return_statement": "return self.make_request(body, log_msg_action)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"Hello from python-ecobee!\"", ")", ":", "arg_3", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "arg_0", ".", "thermostats", "[", "arg_1", "]", "[", "'identifier'", "]", "}", ",", "\"functions\"", ":", "[", "{", "\"type\"", ":", "\"sendMessage\"", ",", "\"params\"", ":", "{", "\"text\"", ":", "arg_2", "[", "0", ":", "500", "]", "}", "}", "]", "}", "arg_4", "=", "\"send message\"", "return", "arg_0", ".", "make_request", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=\"Hello from python-ecobee!\"):\n        ''' Send a message to the thermostat '''\n        arg_3 = {\"selection\": {\n                    \"selectionType\": \"thermostats\",\n                    \"selectionMatch\": arg_0.thermostats[arg_1]['identifier']},\n                \"functions\": [{\"type\": \"sendMessage\", \"params\": {\n                    \"text\": arg_2[0:500]\n                }}]}\n\n        arg_4 = \"send message\"\n        return arg_0.make_request(arg_3, arg_4)", "path": "pyecobee/__init__.py", "identifier": "Ecobee.send_message", "docstring": "Send a message to the thermostat", "docstring_tokens": ["Send", "a", "message", "to", "the", "thermostat"], "nwo": "nkgilley/python-ecobee-api", "score": 0.37994208506696864, "idx": 252330}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/core.py#L217-L229", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Base64-encode the data contained in the reply when appropriate.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "data", "is", "None", ":", "return", "\"\"", "elif", "not", "arg_0", ".", "data", ":", "return", "\"=\"", "else", ":", "arg_1", "=", "standard_b64Func", "(", "arg_0", ".", "data", ")", "return", "arg_1", ".", "decode", "(", "\"us-ascii\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Base64-Func the data contained in the reply when appropriate.\n\n        :return: Funcd data.\n        :returntype: `unicode`\n        \"\"\"\n        if arg_0.data is None:\n            return \"\"\n        elif not arg_0.data:\n            return \"=\"\n        else:\n            arg_1 = standard_b64Func(arg_0.data)\n            return arg_1.decode(\"us-ascii\")", "path": "pyxmpp2/sasl/core.py", "identifier": "Reply.encode", "docstring": "Base64-encode the data contained in the reply when appropriate.\n\n        :return: encoded data.\n        :returntype: `unicode`", "docstring_tokens": ["Base64", "-", "encode", "the", "data", "contained", "in", "the", "reply", "when", "appropriate", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 252331}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/stub.py#L74-L109", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return a list of operations. See base.py for additional detail.", "language": "python", "parameters": "(self,\n                       statuses,\n                       user_ids=None,\n                       job_ids=None,\n                       job_names=None,\n                       task_ids=None,\n                       task_attempts=None,\n                       labels=None,\n                       create_time_min=None,\n                       create_time_max=None,\n                       max_tasks=0)", "return_statement": "return operations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "0", ")", ":", "arg_1", "=", "None", "if", "arg_1", "==", "{", "'*'", "}", "else", "arg_1", "arg_2", "=", "None", "if", "arg_2", "==", "{", "'*'", "}", "else", "arg_2", "arg_3", "=", "None", "if", "arg_3", "==", "{", "'*'", "}", "else", "arg_3", "arg_4", "=", "None", "if", "arg_4", "==", "{", "'*'", "}", "else", "arg_4", "arg_5", "=", "None", "if", "arg_5", "==", "{", "'*'", "}", "else", "arg_5", "arg_6", "=", "None", "if", "arg_6", "==", "{", "'*'", "}", "else", "arg_6", "if", "arg_7", "or", "arg_8", "or", "arg_9", ":", "raise", "NotImplementedError", "(", "'Lookup by labels and create_time not yet supported by stub.'", ")", "arg_11", "=", "[", "x", "for", "x", "in", "arg_0", ".", "_operations", "if", "(", "(", "not", "arg_1", "or", "x", ".", "get_field", "(", "'status'", ",", "(", "None", ",", "None", ")", ")", "[", "0", "]", "in", "arg_1", ")", "and", "(", "not", "arg_2", "or", "x", ".", "get_field", "(", "'user'", ",", "None", ")", "in", "arg_2", ")", "and", "(", "not", "arg_3", "or", "x", ".", "get_field", "(", "'job-id'", ",", "None", ")", "in", "arg_3", ")", "and", "(", "not", "arg_4", "or", "x", ".", "get_field", "(", "'job-name'", ",", "None", ")", "in", "arg_4", ")", "and", "(", "not", "arg_5", "or", "x", ".", "get_field", "(", "'task-id'", ",", "None", ")", "in", "arg_5", ")", "and", "(", "not", "arg_6", "or", "x", ".", "get_field", "(", "'task-attempt'", ",", "None", ")", "in", "arg_6", ")", ")", "]", "if", "arg_10", ">", "0", ":", "arg_11", "=", "arg_11", "[", ":", "arg_10", "]", "return", "arg_11"], "function": "def Func(arg_0,\n                       arg_1,\n                       arg_2=None,\n                       arg_3=None,\n                       arg_4=None,\n                       arg_5=None,\n                       arg_6=None,\n                       arg_7=None,\n                       arg_8=None,\n                       arg_9=None,\n                       arg_10=0):\n    \"\"\"Return a list of operations. See base.py for additional detail.\"\"\"\n    arg_1 = None if arg_1 == {'*'} else arg_1\n    arg_2 = None if arg_2 == {'*'} else arg_2\n    arg_3 = None if arg_3 == {'*'} else arg_3\n    arg_4 = None if arg_4 == {'*'} else arg_4\n    arg_5 = None if arg_5 == {'*'} else arg_5\n    arg_6 = None if arg_6 == {'*'} else arg_6\n\n    if arg_7 or arg_8 or arg_9:\n      raise NotImplementedError(\n          'Lookup by labels and create_time not yet supported by stub.')\n\n    arg_11 = [\n        x for x in arg_0._operations\n        if ((not arg_1 or x.get_field('status', (None, None))[0] in arg_1\n            ) and (not arg_2 or x.get_field('user', None) in arg_2) and\n            (not arg_3 or x.get_field('job-id', None) in arg_3) and\n            (not arg_4 or x.get_field('job-name', None) in arg_4) and\n            (not arg_5 or x.get_field('task-id', None) in arg_5) and\n            (not arg_6 or\n             x.get_field('task-attempt', None) in arg_6))\n    ]\n    if arg_10 > 0:\n      arg_11 = arg_11[:arg_10]\n    return arg_11", "path": "dsub/providers/stub.py", "identifier": "StubJobProvider.lookup_job_tasks", "docstring": "Return a list of operations. See base.py for additional detail.", "docstring_tokens": ["Return", "a", "list", "of", "operations", ".", "See", "base", ".", "py", "for", "additional", "detail", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 252332}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/mpi_util.py#L49-L67", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Returns the rank of each process on its machine\n    The processes on a given machine will be assigned ranks\n        0, 1, 2, ..., N-1,\n    where N is the number of processes on this machine.", "language": "python", "parameters": "(comm)", "return_statement": "return local_rank, node2rankssofar[this_node]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "platform", ".", "node", "(", ")", "arg_2", "=", "arg_0", ".", "allgather", "(", "(", "arg_0", ".", "Get_rank", "(", ")", ",", "arg_1", ")", ")", "arg_3", "=", "defaultdict", "(", "int", ")", "arg_4", "=", "None", "for", "(", "arg_5", ",", "arg_6", ")", "in", "arg_2", ":", "if", "arg_5", "==", "arg_0", ".", "Get_rank", "(", ")", ":", "arg_4", "=", "arg_3", "[", "arg_6", "]", "arg_3", "[", "arg_6", "]", "+=", "1", "assert", "arg_4", "is", "not", "None", "return", "arg_4", ",", "arg_3", "[", "arg_1", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns the rank of each process on its machine\n    The processes on a given machine will be assigned ranks\n        0, 1, 2, ..., N-1,\n    where N is the number of processes on this machine.\n\n    Useful if you want to assign one gpu per machine\n    \"\"\"\n    arg_1 = platform.node()\n    arg_2 = arg_0.allgather((arg_0.Get_rank(), arg_1))\n    arg_3 = defaultdict(int)\n    arg_4 = None\n    for (arg_5, arg_6) in arg_2:\n        if arg_5 == arg_0.Get_rank():\n            arg_4 = arg_3[arg_6]\n        arg_3[arg_6] += 1\n    assert arg_4 is not None\n    return arg_4, arg_3[arg_1]", "path": "baselines/common/mpi_util.py", "identifier": "get_local_rank_size", "docstring": "Returns the rank of each process on its machine\n    The processes on a given machine will be assigned ranks\n        0, 1, 2, ..., N-1,\n    where N is the number of processes on this machine.\n\n    Useful if you want to assign one gpu per machine", "docstring_tokens": ["Returns", "the", "rank", "of", "each", "process", "on", "its", "machine", "The", "processes", "on", "a", "given", "machine", "will", "be", "assigned", "ranks", "0", "1", "2", "...", "N", "-", "1", "where", "N", "is", "the", "number", "of", "processes", "on", "this", "machine", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 252333}
{"url": "https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L373-L379", "sha": "bb1990cf1460ae42f2dde75f2291625ddac2c0e4", "docstring_summary": "Get the equaliser modes supported by this device.", "language": "python", "parameters": "(self)", "return_statement": "return self.__equalisers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "__equalisers", ":", "arg_0", ".", "__equalisers", "=", "yield", "from", "arg_0", ".", "handle_list", "(", "arg_0", ".", "API", ".", "get", "(", "'equalisers'", ")", ")", "return", "arg_0", ".", "__equalisers"], "function": "def Func(arg_0):\n        \"\"\"Get the equaliser modes supported by this device.\"\"\"\n        if not arg_0.__equalisers:\n            arg_0.__equalisers = yield from arg_0.handle_list(\n                arg_0.API.get('equalisers'))\n\n        return arg_0.__equalisers", "path": "afsapi/__init__.py", "identifier": "AFSAPI.get_equalisers", "docstring": "Get the equaliser modes supported by this device.", "docstring_tokens": ["Get", "the", "equaliser", "modes", "supported", "by", "this", "device", "."], "nwo": "zhelev/python-afsapi", "score": 0.16638194949711382, "idx": 252334}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/label.py#L44-L54", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Update the current label's name. Returns a new Label object.", "language": "python", "parameters": "(self, name)", "return_statement": "return self.create_label(label_json)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", ",", "http_method", "=", "'PUT'", ",", "query_params", "=", "{", "'name'", ":", "arg_1", "}", ")", "return", "arg_0", ".", "create_label", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Update the current label's name. Returns a new Label object.\n        '''\n        arg_2 = arg_0.fetch_json(\n            uri_path=arg_0.base_uri,\n            http_method='PUT',\n            query_params={'name': arg_1}\n        )\n\n        return arg_0.create_label(arg_2)", "path": "trolly/label.py", "identifier": "Label._update_label_name", "docstring": "Update the current label's name. Returns a new Label object.", "docstring_tokens": ["Update", "the", "current", "label", "s", "name", ".", "Returns", "a", "new", "Label", "object", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 252335}
{"url": "https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/parser.py#L25-L48", "sha": "d52a7c6b5bc466f3c1a77b71814c8c0776aba995", "docstring_summary": "Parse the given Zinc text and return the equivalent data.", "language": "python", "parameters": "(grid_str, mode=MODE_ZINC, charset='utf-8')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "'utf-8'", ")", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "binary_type", ")", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "encoding", "=", "arg_3", ")", "arg_4", "=", "functools", ".", "partial", "(", "Func_grid", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", "if", "arg_1", "==", "MODE_JSON", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "arg_5", "=", "json", ".", "loads", "(", "arg_0", ")", "else", ":", "arg_5", "=", "arg_0", "if", "isinstance", "(", "arg_5", ",", "dict", ")", ":", "return", "arg_4", "(", "arg_5", ")", "else", ":", "return", "list", "(", "map", "(", "arg_4", ",", "arg_5", ")", ")", "else", ":", "return", "list", "(", "map", "(", "arg_4", ",", "GRID_SEP", ".", "split", "(", "arg_0", ".", "rstrip", "(", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1=arg_2, arg_3='utf-8'):\n    '''\n    Parse the given Zinc text and return the equivalent data.\n    '''\n    # Decode incoming text (or python3 will whine!)\n    if isinstance(arg_0, six.binary_type):\n        arg_0 = arg_0.decode(encoding=arg_3)\n\n    # Split the separate grids up, the grammar definition has trouble splitting\n    # them up normally.  This will truncate the newline off the end of the last\n    # row.\n    arg_4 = functools.partial(Func_grid, arg_1=arg_1,\n            arg_3=arg_3)\n    if arg_1 == MODE_JSON:\n        if isinstance(arg_0, six.string_types):\n            arg_5 = json.loads(arg_0)\n        else:\n            arg_5 = arg_0\n        if isinstance(arg_5, dict):\n            return arg_4(arg_5)\n        else:\n            return list(map(arg_4, arg_5))\n    else:\n        return list(map(arg_4, GRID_SEP.split(arg_0.rstrip())))", "path": "hszinc/parser.py", "identifier": "parse", "docstring": "Parse the given Zinc text and return the equivalent data.", "docstring_tokens": ["Parse", "the", "given", "Zinc", "text", "and", "return", "the", "equivalent", "data", "."], "nwo": "vrtsystems/hszinc", "score": 0.2823188883832642, "idx": 252336}
{"url": "https://github.com/encode/starlette/blob/d23bfd0d8ff68d535d0283aa4099e5055da88bb9/starlette/staticfiles.py#L175-L193", "sha": "d23bfd0d8ff68d535d0283aa4099e5055da88bb9", "docstring_summary": "Perform a one-off configuration check that StaticFiles is actually\n        pointed at a directory, so that we can raise loud errors rather than\n        just returning 404 responses.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", "->", "None", ":", "if", "arg_0", ".", "directory", "is", "None", ":", "return", "try", ":", "arg_1", "=", "await", "aio_stat", "(", "arg_0", ".", "directory", ")", "except", "FileNotFoundError", ":", "raise", "RuntimeError", "(", "f\"StaticFiles directory '{self.directory}' does not exist.\"", ")", "if", "not", "(", "stat", ".", "S_ISDIR", "(", "arg_1", ".", "st_mode", ")", "or", "stat", ".", "S_ISLNK", "(", "arg_1", ".", "st_mode", ")", ")", ":", "raise", "RuntimeError", "(", "f\"StaticFiles path '{self.directory}' is not a directory.\"", ")"], "function": "async def Func(arg_0) -> None:\n        \"\"\"\n        Perform a one-off configuration check that StaticFiles is actually\n        pointed at a directory, so that we can raise loud errors rather than\n        just returning 404 responses.\n        \"\"\"\n        if arg_0.directory is None:\n            return\n\n        try:\n            arg_1 = await aio_stat(arg_0.directory)\n        except FileNotFoundError:\n            raise RuntimeError(\n                f\"StaticFiles directory '{self.directory}' does not exist.\"\n            )\n        if not (stat.S_ISDIR(arg_1.st_mode) or stat.S_ISLNK(arg_1.st_mode)):\n            raise RuntimeError(\n                f\"StaticFiles path '{self.directory}' is not a directory.\"\n            )", "path": "starlette/staticfiles.py", "identifier": "StaticFiles.check_config", "docstring": "Perform a one-off configuration check that StaticFiles is actually\n        pointed at a directory, so that we can raise loud errors rather than\n        just returning 404 responses.", "docstring_tokens": ["Perform", "a", "one", "-", "off", "configuration", "check", "that", "StaticFiles", "is", "actually", "pointed", "at", "a", "directory", "so", "that", "we", "can", "raise", "loud", "errors", "rather", "than", "just", "returning", "404", "responses", "."], "nwo": "encode/starlette", "score": 0.9921761654937327, "idx": 252337}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fir_design_helper.py#L48-L56", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Design a windowed FIR bandpass filter in terms of passband\r\n    critical frequencies f1 < f2 in Hz relative to sampling rate\r\n    fs in Hz. The number of taps must be provided.\r\n\r\n    Mark Wickert October 2016", "language": "python", "parameters": "(N_taps, f1, f2, fs = 1.0, pass_zero=False)", "return_statement": "return signal.firwin(N_taps,2*(f1,f2)/fs,pass_zero=pass_zero)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1.0", ",", "arg_4", "=", "False", ")", ":", "return", "signal", ".", "firwin", "(", "arg_0", ",", "2", "*", "(", "arg_1", ",", "arg_2", ")", "/", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = 1.0, arg_4=False):\r\n    \"\"\"\r\n    Design a windowed FIR bandpass filter in terms of passband\r\n    critical frequencies f1 < f2 in Hz relative to sampling rate\r\n    fs in Hz. The number of taps must be provided.\r\n\r\n    Mark Wickert October 2016\r\n    \"\"\"\r\n    return signal.firwin(arg_0,2*(arg_1,arg_2)/arg_3,arg_4=arg_4)", "path": "sk_dsp_comm/fir_design_helper.py", "identifier": "firwin_bpf", "docstring": "Design a windowed FIR bandpass filter in terms of passband\r\n    critical frequencies f1 < f2 in Hz relative to sampling rate\r\n    fs in Hz. The number of taps must be provided.\r\n\r\n    Mark Wickert October 2016", "docstring_tokens": ["Design", "a", "windowed", "FIR", "bandpass", "filter", "in", "terms", "of", "passband", "critical", "frequencies", "f1", "<", "f2", "in", "Hz", "relative", "to", "sampling", "rate", "fs", "in", "Hz", ".", "The", "number", "of", "taps", "must", "be", "provided", ".", "Mark", "Wickert", "October", "2016"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 252338}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L415-L420", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Get a string version of `block_stack`, for debugging.", "language": "python", "parameters": "(self, block_stack)", "return_statement": "return \"[\" + blocks + \"]\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\", \"", ".", "join", "(", "[", "\"(%s, %r)\"", "%", "(", "dis", ".", "opname", "[", "b", "[", "0", "]", "]", ",", "b", "[", "1", "]", ")", "for", "b", "in", "arg_1", "]", ")", "return", "\"[\"", "+", "arg_2", "+", "\"]\""], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get a string version of `block_stack`, for debugging.\"\"\"\n        arg_2 = \", \".join(\n            [\"(%s, %r)\" % (dis.opname[b[0]], b[1]) for b in arg_1]\n        )\n        return \"[\" + arg_2 + \"]\"", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py", "identifier": "ByteParser._block_stack_repr", "docstring": "Get a string version of `block_stack`, for debugging.", "docstring_tokens": ["Get", "a", "string", "version", "of", "block_stack", "for", "debugging", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 252339}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L178-L197", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "Invoke a dry-run of the scheduler for the job.", "language": "python", "parameters": "(self, id, job, diff=False, policy_override=False)", "return_statement": "return self.request(id, \"plan\", json=json_dict, method=\"post\").json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "{", "}", "arg_5", ".", "update", "(", "arg_2", ")", "arg_5", ".", "setdefault", "(", "'Diff'", ",", "arg_3", ")", "arg_5", ".", "setdefault", "(", "'PolicyOverride'", ",", "arg_4", ")", "return", "arg_0", ".", "request", "(", "arg_1", ",", "\"plan\"", ",", "json", "=", "arg_5", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=False):\n        \"\"\" Invoke a dry-run of the scheduler for the job.\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n              - job, dict\n              - diff, boolean\n              - policy_override, boolean\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_5 = {}\n        arg_5.update(arg_2)\n        arg_5.setdefault('Diff', arg_3)\n        arg_5.setdefault('PolicyOverride', arg_4)\n        return arg_0.request(arg_1, \"plan\", json=arg_5, method=\"post\").json()", "path": "nomad/api/job.py", "identifier": "Job.plan_job", "docstring": "Invoke a dry-run of the scheduler for the job.\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n              - job, dict\n              - diff, boolean\n              - policy_override, boolean\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["Invoke", "a", "dry", "-", "run", "of", "the", "scheduler", "for", "the", "job", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 252340}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/nest_util.py#L185-L210", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Calls `fn` with `args`, possibly expanding `args`.", "language": "python", "parameters": "(fn, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "expand_as_args", "(", "arg_1", ")", ":", "return", "arg_0", "(", "*", "arg_1", ")", "elif", "_expand_as_kwargs", "(", "arg_1", ")", ":", "return", "arg_0", "(", "**", "arg_1", ")", "else", ":", "return", "arg_0", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Calls `fn` with `args`, possibly expanding `args`.\n\n  Use this function when calling a user-provided callable using user-provided\n  arguments.\n\n  The expansion rules are as follows:\n\n  `fn(*args)` if `args` is a `list` or a `tuple`, but not a `namedtuple`.\n  `fn(**args)` if `args` is a `dict`.\n  `fn(args)` otherwise.\n\n  Args:\n    fn: A callable that takes either `args` as an argument(s).\n    args: Arguments to `fn`.\n\n  Returns:\n    result: Return value of `fn`.\n  \"\"\"\n\n  if expand_as_args(arg_1):\n    return arg_0(*arg_1)\n  elif _expand_as_kwargs(arg_1):\n    return arg_0(**arg_1)\n  else:\n    return arg_0(arg_1)", "path": "tensorflow_probability/python/internal/nest_util.py", "identifier": "call_fn", "docstring": "Calls `fn` with `args`, possibly expanding `args`.\n\n  Use this function when calling a user-provided callable using user-provided\n  arguments.\n\n  The expansion rules are as follows:\n\n  `fn(*args)` if `args` is a `list` or a `tuple`, but not a `namedtuple`.\n  `fn(**args)` if `args` is a `dict`.\n  `fn(args)` otherwise.\n\n  Args:\n    fn: A callable that takes either `args` as an argument(s).\n    args: Arguments to `fn`.\n\n  Returns:\n    result: Return value of `fn`.", "docstring_tokens": ["Calls", "fn", "with", "args", "possibly", "expanding", "args", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252341}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/inkscape.py#L48-L84", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Call Inkscape to export the input_file to output_file using the\n    specific export argument flag for the output file type.", "language": "python", "parameters": "(input_file, output_file, export_flag=\"-A\", dpi=90, inkscape_binpath=None)", "return_statement": "return call_inkscape(arg_strings, inkscape_binpath=inkscape_binpath)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"-A\"", ",", "arg_3", "=", "90", ",", "arg_4", "=", "None", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "log", ".", "error", "(", "'File {} not found.'", ".", "format", "(", "arg_0", ")", ")", "raise", "IOError", "(", "(", "0", ",", "'File not found.'", ",", "arg_0", ")", ")", "if", "'='", "not", "in", "arg_2", ":", "arg_2", "+=", "' '", "arg_5", "=", "[", "]", "arg_5", "+=", "[", "'--without-gui'", "]", "arg_5", "+=", "[", "'--export-text-to-path'", "]", "arg_5", "+=", "[", "'{}\"{}\"'", ".", "format", "(", "arg_2", ",", "arg_1", ")", "]", "arg_5", "+=", "[", "'--export-dpi={}'", ".", "format", "(", "arg_3", ")", "]", "arg_5", "+=", "[", "'\"{}\"'", ".", "format", "(", "arg_0", ")", "]", "return", "call_inkscape", "(", "arg_5", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=\"-A\", arg_3=90, arg_4=None):\n    \"\"\" Call Inkscape to export the input_file to output_file using the\n    specific export argument flag for the output file type.\n\n    Parameters\n    ----------\n\n    input_file: str\n        Path to the input file\n\n    output_file: str\n        Path to the output file\n\n    export_flag: str\n        Inkscape CLI flag to indicate the type of the output file\n\n    Returns\n    -------\n    return_value\n        Command call return value\n\n    \"\"\"\n    if not os.path.exists(arg_0):\n        log.error('File {} not found.'.format(arg_0))\n        raise IOError((0, 'File not found.', arg_0))\n\n    if '=' not in arg_2:\n        arg_2 += ' '\n\n    arg_5 = []\n    arg_5 += ['--without-gui']\n    arg_5 += ['--export-text-to-path']\n    arg_5 += ['{}\"{}\"'.format(arg_2, arg_1)]\n    arg_5 += ['--export-dpi={}'.format(arg_3)]\n    arg_5 += ['\"{}\"'.format(arg_0)]\n\n    return call_inkscape(arg_5, arg_4=arg_4)", "path": "docstamp/inkscape.py", "identifier": "inkscape_export", "docstring": "Call Inkscape to export the input_file to output_file using the\n    specific export argument flag for the output file type.\n\n    Parameters\n    ----------\n\n    input_file: str\n        Path to the input file\n\n    output_file: str\n        Path to the output file\n\n    export_flag: str\n        Inkscape CLI flag to indicate the type of the output file\n\n    Returns\n    -------\n    return_value\n        Command call return value", "docstring_tokens": ["Call", "Inkscape", "to", "export", "the", "input_file", "to", "output_file", "using", "the", "specific", "export", "argument", "flag", "for", "the", "output", "file", "type", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 252342}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/preprocessing.py#L78-L97", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Fit and transform the stacked points.", "language": "python", "parameters": "(self, X, y=None, **params)", "return_statement": "return self._gather_outputs(X, X_new)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_1", "=", "as_features", "(", "arg_1", ",", "stack", "=", "True", ")", "arg_4", "=", "arg_0", ".", "transformer", ".", "Func", "(", "arg_1", ".", "stacked_features", ",", "arg_2", ",", "**", "arg_3", ")", "return", "arg_0", ".", "_gather_outputs", "(", "arg_1", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        '''\n        Fit and transform the stacked points.\n\n        Parameters\n        ----------\n        X : :class:`Features` or list of bag feature arrays\n            Data to train on and transform.\n\n        any other keyword argument :\n            Passed on as keyword arguments to the transformer's ``transform()``.\n\n        Returns\n        -------\n        X_new : :class:`Features`\n            Transformed features.\n        '''\n        arg_1 = as_features(arg_1, stack=True)\n        arg_4 = arg_0.transformer.Func(arg_1.stacked_features, arg_2, **arg_3)\n        return arg_0._gather_outputs(arg_1, arg_4)", "path": "skl_groups/preprocessing.py", "identifier": "BagPreprocesser.fit_transform", "docstring": "Fit and transform the stacked points.\n\n        Parameters\n        ----------\n        X : :class:`Features` or list of bag feature arrays\n            Data to train on and transform.\n\n        any other keyword argument :\n            Passed on as keyword arguments to the transformer's ``transform()``.\n\n        Returns\n        -------\n        X_new : :class:`Features`\n            Transformed features.", "docstring_tokens": ["Fit", "and", "transform", "the", "stacked", "points", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 252343}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/examples/rpc-server.py#L102-L111", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Called when socket is write-ready", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "pyngus", ".", "write_socket_output", "(", "arg_0", ".", "connection", ",", "arg_0", ".", "socket", ")", "except", "Exception", "as", "e", ":", "LOG", ".", "error", "(", "\"Exception on socket write: %s\"", ",", "str", "(", "e", ")", ")", "arg_0", ".", "connection", ".", "close_output", "(", ")", "arg_0", ".", "connection", ".", "close", "(", ")", "arg_0", ".", "connection", ".", "process", "(", "time", ".", "time", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Called when socket is write-ready\"\"\"\n        try:\n            pyngus.write_socket_output(arg_0.connection,\n                                       arg_0.socket)\n        except Exception as e:\n            LOG.error(\"Exception on socket write: %s\", str(e))\n            arg_0.connection.close_output()\n            arg_0.connection.close()\n        arg_0.connection.process(time.time())", "path": "examples/rpc-server.py", "identifier": "SocketConnection.send_output", "docstring": "Called when socket is write-ready", "docstring_tokens": ["Called", "when", "socket", "is", "write", "-", "ready"], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 252344}
{"url": "https://github.com/ojengwa/accounting/blob/6343cf373a5c57941e407a92c101ac4bc45382e3/accounting/accounting.py#L164-L177", "sha": "6343cf373a5c57941e407a92c101ac4bc45382e3", "docstring_summary": "Implementation that treats floats more like decimals.", "language": "python", "parameters": "(self, value, precision)", "return_statement": "return '{0} {1}.{2}f'.format(value, precision, precision)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", "=", "arg_0", ".", "_change_precision", "(", "arg_2", ",", "arg_0", ".", "settings", "[", "'number'", "]", "[", "'precision'", "]", ")", "arg_3", "=", "pow", "(", "10", ",", "arg_2", ")", "arg_3", "=", "round", "(", "arg_0", ".", "parse", "(", "arg_1", ")", "*", "arg_3", ")", "/", "arg_3", "return", "'{0} {1}.{2}f'", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Implementation that treats floats more like decimals.\n\n        Fixes binary rounding issues (eg. (0.615).toFixed(2) === \"0.61\")\n        that present problems for accounting and finance-related software.\n\n        \"\"\"\n        arg_2 = arg_0._change_precision(\n            arg_2, arg_0.settings['number']['precision'])\n\n        arg_3 = pow(10, arg_2)\n        # Multiply up by precision, round accurately, then divide\n        arg_3 = round(arg_0.parse(arg_1) * arg_3) / arg_3\n        return '{0} {1}.{2}f'.format(arg_1, arg_2, arg_2)", "path": "accounting/accounting.py", "identifier": "Accounting.to_fixed", "docstring": "Implementation that treats floats more like decimals.\n\n        Fixes binary rounding issues (eg. (0.615).toFixed(2) === \"0.61\")\n        that present problems for accounting and finance-related software.", "docstring_tokens": ["Implementation", "that", "treats", "floats", "more", "like", "decimals", "."], "nwo": "ojengwa/accounting", "score": 0.18384731799856882, "idx": 252345}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/stats/quantiles.py#L847-L884", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Move dims corresponding to `axis` in `x` to the end, then flatten.", "language": "python", "parameters": "(x, axis, x_ndims, right_end=True)", "return_statement": "return tf.reshape(x_permed, shape=full_shape)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "if", "not", "arg_1", ":", "return", "arg_0", "arg_4", "=", "sorted", "(", "set", "(", "range", "(", "arg_2", ")", ")", ".", "difference", "(", "arg_1", ")", ")", "arg_5", "=", "arg_4", "+", "list", "(", "arg_1", ")", "if", "arg_3", "else", "list", "(", "arg_1", ")", "+", "arg_4", "arg_6", "=", "tf", ".", "transpose", "(", "a", "=", "arg_0", ",", "arg_5", "=", "arg_5", ")", "if", "arg_0", ".", "shape", ".", "is_fully_defined", "(", ")", ":", "arg_7", "=", "arg_0", ".", "shape", ".", "as_list", "(", ")", "arg_8", "=", "[", "arg_7", "[", "i", "]", "for", "i", "in", "arg_4", "]", "arg_9", "=", "[", "np", ".", "prod", "(", "[", "arg_7", "[", "i", "]", "for", "i", "in", "arg_1", "]", ")", "]", "arg_10", "=", "(", "arg_8", "+", "arg_9", "if", "arg_3", "else", "arg_9", "+", "arg_8", ")", "else", ":", "arg_8", "=", "tf", ".", "gather", "(", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", ",", "arg_4", ")", "arg_10", "=", "tf", ".", "concat", "(", "[", "arg_8", ",", "[", "-", "1", "]", "]", "if", "arg_3", "else", "[", "[", "-", "1", "]", ",", "arg_8", "]", ",", "arg_1", "=", "0", ")", "return", "tf", ".", "reshape", "(", "arg_6", ",", "shape", "=", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n  \"\"\"Move dims corresponding to `axis` in `x` to the end, then flatten.\n\n  Args:\n    x: `Tensor` with shape `[B0,B1,...,Bb]`.\n    axis:  Python list of indices into dimensions of `x`.\n    x_ndims:  Python integer holding number of dimensions in `x`.\n    right_end:  Python bool.  Whether to move dims to the right end (else left).\n\n  Returns:\n    `Tensor` with value from `x` and dims in `axis` moved to end into one single\n      dimension.\n  \"\"\"\n\n  if not arg_1:\n    return arg_0\n\n  # Suppose x.shape = [a, b, c, d]\n  # Suppose axis = [1, 3]\n\n  # other_dims = [0, 2] in example above.\n  arg_4 = sorted(set(range(arg_2)).difference(arg_1))\n  # x_permed.shape = [a, c, b, d]\n  arg_5 = arg_4 + list(arg_1) if arg_3 else list(arg_1) + arg_4\n  arg_6 = tf.transpose(a=arg_0, arg_5=arg_5)\n\n  if arg_0.shape.is_fully_defined():\n    arg_7 = arg_0.shape.as_list()\n    # other_shape = [a, c], end_shape = [b * d]\n    arg_8 = [arg_7[i] for i in arg_4]\n    arg_9 = [np.prod([arg_7[i] for i in arg_1])]\n    arg_10 = (\n        arg_8 + arg_9 if arg_3 else arg_9 + arg_8)\n  else:\n    arg_8 = tf.gather(tf.shape(input=arg_0), arg_4)\n    arg_10 = tf.concat(\n        [arg_8, [-1]] if arg_3 else [[-1], arg_8], arg_1=0)\n  return tf.reshape(arg_6, shape=arg_10)", "path": "tensorflow_probability/python/stats/quantiles.py", "identifier": "_move_dims_to_flat_end", "docstring": "Move dims corresponding to `axis` in `x` to the end, then flatten.\n\n  Args:\n    x: `Tensor` with shape `[B0,B1,...,Bb]`.\n    axis:  Python list of indices into dimensions of `x`.\n    x_ndims:  Python integer holding number of dimensions in `x`.\n    right_end:  Python bool.  Whether to move dims to the right end (else left).\n\n  Returns:\n    `Tensor` with value from `x` and dims in `axis` moved to end into one single\n      dimension.", "docstring_tokens": ["Move", "dims", "corresponding", "to", "axis", "in", "x", "to", "the", "end", "then", "flatten", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252346}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/annotations.py#L175-L180", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns all annotations lexicographically sorted as a concatenated string.", "language": "python", "parameters": "(self)", "return_statement": "return resstr[:-2]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "_dict", ".", "keys", "(", ")", ")", ":", "arg_1", "+=", "'%s=%s; '", "%", "(", "arg_2", ",", "str", "(", "arg_0", ".", "_dict", "[", "arg_2", "]", ")", ")", "return", "arg_1", "[", ":", "-", "2", "]"], "function": "def Func(arg_0):\n        \"\"\"Returns all annotations lexicographically sorted as a concatenated string.\"\"\"\n        arg_1 = ''\n        for arg_2 in sorted(arg_0._dict.keys()):\n            arg_1 += '%s=%s; ' % (arg_2, str(arg_0._dict[arg_2]))\n        return arg_1[:-2]", "path": "pypet/annotations.py", "identifier": "Annotations.f_ann_to_str", "docstring": "Returns all annotations lexicographically sorted as a concatenated string.", "docstring_tokens": ["Returns", "all", "annotations", "lexicographically", "sorted", "as", "a", "concatenated", "string", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252347}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/legacy.py#L55-L62", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Returns a merged timestamp array for Donor+Accept. and bool mask for A.", "language": "python", "parameters": "(ph_times_d, ph_times_a)", "return_statement": "return ph_times[index_sort], a_em[index_sort]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "hstack", "(", "[", "arg_0", ",", "arg_1", "]", ")", "arg_3", "=", "np", ".", "hstack", "(", "[", "np", ".", "zeros", "(", "arg_0", ".", "size", ",", "dtype", "=", "np", ".", "bool", ")", ",", "np", ".", "ones", "(", "arg_1", ".", "size", ",", "dtype", "=", "np", ".", "bool", ")", "]", ")", "arg_4", "=", "arg_2", ".", "argsort", "(", ")", "return", "arg_2", "[", "arg_4", "]", ",", "arg_3", "[", "arg_4", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns a merged timestamp array for Donor+Accept. and bool mask for A.\n    \"\"\"\n    arg_2 = np.hstack([arg_0, arg_1])\n    arg_3 = np.hstack([np.zeros(arg_0.size, dtype=np.bool),\n                      np.ones(arg_1.size, dtype=np.bool)])\n    arg_4 = arg_2.argsort()\n    return arg_2[arg_4], arg_3[arg_4]", "path": "pybromo/legacy.py", "identifier": "merge_DA_ph_times", "docstring": "Returns a merged timestamp array for Donor+Accept. and bool mask for A.", "docstring_tokens": ["Returns", "a", "merged", "timestamp", "array", "for", "Donor", "+", "Accept", ".", "and", "bool", "mask", "for", "A", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 252348}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/S3_hook.py#L295-L314", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a boto3.s3.Object object matching the wildcard expression", "language": "python", "parameters": "(self, wildcard_key, bucket_name=None, delimiter='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "''", ")", ":", "if", "not", "arg_2", ":", "(", "arg_2", ",", "arg_1", ")", "=", "arg_0", ".", "parse_s3_url", "(", "arg_1", ")", "arg_4", "=", "re", ".", "split", "(", "r'[*]'", ",", "arg_1", ",", "1", ")", "[", "0", "]", "arg_5", "=", "arg_0", ".", "list_keys", "(", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", "if", "arg_5", ":", "arg_6", "=", "[", "k", "for", "k", "in", "arg_5", "if", "fnmatch", ".", "fnmatch", "(", "k", ",", "arg_1", ")", "]", "if", "arg_6", ":", "return", "arg_0", ".", "get_key", "(", "arg_6", "[", "0", "]", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=''):\n        \"\"\"\n        Returns a boto3.s3.Object object matching the wildcard expression\n\n        :param wildcard_key: the path to the key\n        :type wildcard_key: str\n        :param bucket_name: the name of the bucket\n        :type bucket_name: str\n        :param delimiter: the delimiter marks key hierarchy\n        :type delimiter: str\n        \"\"\"\n        if not arg_2:\n            (arg_2, arg_1) = arg_0.parse_s3_url(arg_1)\n\n        arg_4 = re.split(r'[*]', arg_1, 1)[0]\n        arg_5 = arg_0.list_keys(arg_2, arg_4=arg_4, arg_3=arg_3)\n        if arg_5:\n            arg_6 = [k for k in arg_5 if fnmatch.fnmatch(k, arg_1)]\n            if arg_6:\n                return arg_0.get_key(arg_6[0], arg_2)", "path": "airflow/hooks/S3_hook.py", "identifier": "S3Hook.get_wildcard_key", "docstring": "Returns a boto3.s3.Object object matching the wildcard expression\n\n        :param wildcard_key: the path to the key\n        :type wildcard_key: str\n        :param bucket_name: the name of the bucket\n        :type bucket_name: str\n        :param delimiter: the delimiter marks key hierarchy\n        :type delimiter: str", "docstring_tokens": ["Returns", "a", "boto3", ".", "s3", ".", "Object", "object", "matching", "the", "wildcard", "expression"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252349}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/authnz.py#L93-L107", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Configuration include fuction for this module", "language": "python", "parameters": "(config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "APIKeyAuthenticationPolicy", "(", ")", "arg_0", ".", "include", "(", "'openstax_accounts'", ")", "arg_2", "=", "arg_0", ".", "registry", ".", "getUtility", "(", "IOpenstaxAccountsAuthenticationPolicy", ")", "arg_3", "=", "[", "arg_1", ",", "arg_2", "]", "arg_4", "=", "MultiAuthenticationPolicy", "(", "arg_3", ")", "arg_0", ".", "set_authentication_policy", "(", "arg_4", ")", "arg_5", "=", "ACLAuthorizationPolicy", "(", ")", "arg_0", ".", "set_authorization_policy", "(", "arg_5", ")"], "function": "def Func(arg_0):\n    \"\"\"Configuration include fuction for this module\"\"\"\n    arg_1 = APIKeyAuthenticationPolicy()\n    arg_0.include('openstax_accounts')\n    arg_2 = arg_0.registry.getUtility(\n        IOpenstaxAccountsAuthenticationPolicy)\n\n    # Set up api & user authentication policies.\n    arg_3 = [arg_1, arg_2]\n    arg_4 = MultiAuthenticationPolicy(arg_3)\n    arg_0.set_authentication_policy(arg_4)\n\n    # Set up the authorization policy.\n    arg_5 = ACLAuthorizationPolicy()\n    arg_0.set_authorization_policy(arg_5)", "path": "cnxpublishing/authnz.py", "identifier": "includeme", "docstring": "Configuration include fuction for this module", "docstring_tokens": ["Configuration", "include", "fuction", "for", "this", "module"], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 252350}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3487-L3501", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Issue a B read on V4 meter.", "language": "python", "parameters": "(self)", "return_statement": "return self.m_b_crc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "getContext", "(", ")", "arg_0", ".", "setContext", "(", "\"request[v4B]\"", ")", "arg_0", ".", "m_serial_port", ".", "write", "(", "\"2f3f\"", ".", "decode", "(", "\"hex\"", ")", "+", "arg_0", ".", "m_meter_address", "+", "\"3031210d0a\"", ".", "decode", "(", "\"hex\"", ")", ")", "arg_0", ".", "m_raw_read_b", "=", "arg_0", ".", "m_serial_port", ".", "getResponse", "(", "arg_0", ".", "getContext", "(", ")", ")", "arg_3", "=", "arg_0", ".", "unpackStruct", "(", "arg_0", ".", "m_raw_read_b", ",", "arg_0", ".", "m_blk_b", ")", "arg_0", ".", "convertData", "(", "arg_3", ",", "arg_0", ".", "m_blk_b", ",", "arg_0", ".", "m_kwh_precision", ")", "arg_0", ".", "m_b_crc", "=", "arg_0", ".", "crcMeterRead", "(", "arg_0", ".", "m_raw_read_b", ",", "arg_0", ".", "m_blk_b", ")", "arg_0", ".", "setContext", "(", "arg_1", ")", "return", "arg_0", ".", "m_b_crc"], "function": "def Func(arg_0):\n        \"\"\" Issue a B read on V4 meter.\n\n        Returns:\n            bool: True if CRC match at end of call.\n        \"\"\"\n        arg_1 = arg_0.getContext()\n        arg_0.setContext(\"request[v4B]\")\n        arg_0.m_serial_port.write(\"2f3f\".decode(\"hex\") + arg_0.m_meter_address + \"3031210d0a\".decode(\"hex\"))\n        arg_0.m_raw_read_b = arg_0.m_serial_port.getResponse(arg_0.getContext())\n        arg_3 = arg_0.unpackStruct(arg_0.m_raw_read_b, arg_0.m_blk_b)\n        arg_0.convertData(arg_3, arg_0.m_blk_b, arg_0.m_kwh_precision)\n        arg_0.m_b_crc = arg_0.crcMeterRead(arg_0.m_raw_read_b, arg_0.m_blk_b)\n        arg_0.setContext(arg_1)\n        return arg_0.m_b_crc", "path": "ekmmeters.py", "identifier": "V4Meter.requestB", "docstring": "Issue a B read on V4 meter.\n\n        Returns:\n            bool: True if CRC match at end of call.", "docstring_tokens": ["Issue", "a", "B", "read", "on", "V4", "meter", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 252351}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/tcp.py#L65-L71", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Send buffered metrics in batch requests over TCP", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "len", "(", "arg_0", ".", "_batches", ")", ">", "0", ":", "arg_0", ".", "_socket", ".", "sendall", "(", "arg_0", ".", "_batches", "[", "0", "]", ")", "arg_0", ".", "_batches", ".", "popleft", "(", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Send buffered metrics in batch requests over TCP\"\"\"\n        # type: () -> TCPBatchClient\n        while len(arg_0._batches) > 0:\n            arg_0._socket.sendall(arg_0._batches[0])\n            arg_0._batches.popleft()\n        return arg_0", "path": "statsdmetrics/client/tcp.py", "identifier": "TCPBatchClient.flush", "docstring": "Send buffered metrics in batch requests over TCP", "docstring_tokens": ["Send", "buffered", "metrics", "in", "batch", "requests", "over", "TCP"], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 252352}
{"url": "https://github.com/c-soft/satel_integra/blob/3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c/satel_integra/satel_integra.py#L50-L66", "sha": "3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c", "docstring_summary": "Return list of positions of bits set to one in given data.", "language": "python", "parameters": "(r, expected_length)", "return_statement": "return set_bit_numbers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "0x1", "assert", "(", "len", "(", "arg_0", ")", "==", "arg_1", "+", "1", ")", "for", "arg_4", "in", "arg_0", "[", "1", ":", "]", ":", "for", "arg_5", "in", "range", "(", "8", ")", ":", "if", "(", "(", "arg_4", ">>", "arg_5", ")", "&", "1", ")", "==", "1", ":", "arg_2", ".", "append", "(", "arg_3", ")", "arg_3", "+=", "1", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return list of positions of bits set to one in given data.\n\n    This method is used to read e.g. violated zones. They are marked by ones\n    on respective bit positions - as per Satel manual.\n    \"\"\"\n    arg_2 = []\n    arg_3 = 0x1\n    assert (len(arg_0) == arg_1 + 1)\n\n    for arg_4 in arg_0[1:]:\n        for arg_5 in range(8):\n            if ((arg_4 >> arg_5) & 1) == 1:\n                arg_2.append(arg_3)\n            arg_3 += 1\n\n    return arg_2", "path": "satel_integra/satel_integra.py", "identifier": "list_set_bits", "docstring": "Return list of positions of bits set to one in given data.\n\n    This method is used to read e.g. violated zones. They are marked by ones\n    on respective bit positions - as per Satel manual.", "docstring_tokens": ["Return", "list", "of", "positions", "of", "bits", "set", "to", "one", "in", "given", "data", "."], "nwo": "c-soft/satel_integra", "score": 0.683472553404196, "idx": 252353}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/bin/pypirc.py#L71-L91", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Get config dictionary for the given repository.", "language": "python", "parameters": "(self, repository)", "return_statement": "return repo_config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_read_index_servers", "(", ")", "arg_3", "=", "arg_0", ".", "_find_repo_config", "(", "arg_2", ",", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get config dictionary for the given repository.\n\n        If the repository section is not found in the config file,\n        return ``None``.  If the file is invalid, raise\n        :exc:`configparser.Error`.\n\n        Otherwise return a dictionary with:\n\n        * ``'repository'`` -- the repository URL\n        * ``'username'`` -- username for authentication\n        * ``'password'`` -- password for authentication\n\n        :param repository:\n            Name or URL of the repository to find in the ``.pypirc`` file.\n            The repository section must be defined in the config file.\n\n        \"\"\"\n        arg_2 = arg_0._read_index_servers()\n        arg_3 = arg_0._find_repo_config(arg_2, arg_1)\n        return arg_3", "path": "bin/pypirc.py", "identifier": "RCParser.get_repository_config", "docstring": "Get config dictionary for the given repository.\n\n        If the repository section is not found in the config file,\n        return ``None``.  If the file is invalid, raise\n        :exc:`configparser.Error`.\n\n        Otherwise return a dictionary with:\n\n        * ``'repository'`` -- the repository URL\n        * ``'username'`` -- username for authentication\n        * ``'password'`` -- password for authentication\n\n        :param repository:\n            Name or URL of the repository to find in the ``.pypirc`` file.\n            The repository section must be defined in the config file.", "docstring_tokens": ["Get", "config", "dictionary", "for", "the", "given", "repository", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 252354}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L184-L196", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "prefix, base -> true iff name prefix + \".\" + base is \"private\".", "language": "python", "parameters": "(prefix, base)", "return_statement": "return base[:1] == \"_\" and not base[:2] == \"__\" == base[-2:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "warnings", ".", "warn", "(", "\"Func is deprecated; it wasn't useful; \"", "\"examine DocTestFinder.find() lists instead\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "return", "arg_1", "[", ":", "1", "]", "==", "\"_\"", "and", "not", "arg_1", "[", ":", "2", "]", "==", "\"__\"", "==", "arg_1", "[", "-", "2", ":", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"prefix, base -> true iff name prefix + \".\" + base is \"private\".\n\n    Prefix may be an empty string, and base does not contain a period.\n    Prefix is ignored (although functions you write conforming to this\n    protocol may make use of it).\n    Return true iff base begins with an (at least one) underscore, but\n    does not both begin and end with (at least) two underscores.\n    \"\"\"\n    warnings.warn(\"Func is deprecated; it wasn't useful; \"\n                  \"examine DocTestFinder.find() lists instead\",\n                  DeprecationWarning, stacklevel=2)\n    return arg_1[:1] == \"_\" and not arg_1[:2] == \"__\" == arg_1[-2:]", "path": "environment/lib/python2.7/site-packages/nose/ext/dtcompat.py", "identifier": "is_private", "docstring": "prefix, base -> true iff name prefix + \".\" + base is \"private\".\n\n    Prefix may be an empty string, and base does not contain a period.\n    Prefix is ignored (although functions you write conforming to this\n    protocol may make use of it).\n    Return true iff base begins with an (at least one) underscore, but\n    does not both begin and end with (at least) two underscores.", "docstring_tokens": ["prefix", "base", "-", ">", "true", "iff", "name", "prefix", "+", ".", "+", "base", "is", "private", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252355}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/namespace_manager.py#L270-L294", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Update an already-created namespace.", "language": "python", "parameters": "(self, namespace: Namespace)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "None", ":", "arg_3", "=", "arg_0", ".", "_get_old_entry_identifiers", "(", "arg_1", ")", "arg_4", "=", "0", "arg_5", "=", "0", "for", "arg_6", "in", "arg_0", ".", "_iterate_namespace_models", "(", ")", ":", "if", "arg_0", ".", "_get_identifier", "(", "arg_6", ")", "in", "arg_3", ":", "continue", "arg_7", "=", "arg_0", ".", "_create_namespace_entry_from_model", "(", "arg_6", ",", "arg_1", "=", "arg_1", ")", "if", "arg_7", "is", "None", "or", "arg_7", ".", "name", "is", "None", ":", "arg_5", "+=", "1", "continue", "arg_4", "+=", "1", "arg_0", ".", "session", ".", "add", "(", "arg_7", ")", "arg_8", "=", "time", ".", "time", "(", ")", "log", ".", "info", "(", "'got %d new entries. skipped %d entries missing names. committing models'", ",", "arg_4", ",", "arg_5", ")", "arg_0", ".", "session", ".", "commit", "(", ")", "log", ".", "info", "(", "'committed models in %.2f seconds'", ",", "time", ".", "time", "(", ")", "-", "arg_8", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> None:\n        \"\"\"Update an already-created namespace.\n\n        Note: Only call this if namespace won't be none!\n        \"\"\"\n        arg_3 = arg_0._get_old_entry_identifiers(arg_1)\n        arg_4 = 0\n        arg_5 = 0\n\n        for arg_6 in arg_0._iterate_namespace_models():\n            if arg_0._get_identifier(arg_6) in arg_3:\n                continue\n\n            arg_7 = arg_0._create_namespace_entry_from_model(arg_6, arg_1=arg_1)\n            if arg_7 is None or arg_7.name is None:\n                arg_5 += 1\n                continue\n\n            arg_4 += 1\n            arg_0.session.add(arg_7)\n\n        arg_8 = time.time()\n        log.info('got %d new entries. skipped %d entries missing names. committing models', arg_4, arg_5)\n        arg_0.session.commit()\n        log.info('committed models in %.2f seconds', time.time() - arg_8)", "path": "src/bio2bel/manager/namespace_manager.py", "identifier": "BELNamespaceManagerMixin._update_namespace", "docstring": "Update an already-created namespace.\n\n        Note: Only call this if namespace won't be none!", "docstring_tokens": ["Update", "an", "already", "-", "created", "namespace", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 252356}
{"url": "https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/profiles.py#L27-L40", "sha": "6c9236fd3b6a8f9e2d70dbf1bc01529242b73075", "docstring_summary": "Based on some criteria, filter the profiles and return a new Profiles\n      Manager containing only the chosen items", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return Profiles(self.api, new_list)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "not", "len", "(", "arg_0", ")", ":", "arg_0", ".", "all", "(", ")", "arg_2", "=", "Func", "(", "lambda", "item", ":", "[", "True", "for", "arg", "in", "arg_1", "if", "item", "[", "arg", "]", "==", "arg_1", "[", "arg", "]", "]", "!=", "[", "]", ",", "arg_0", ")", "return", "Profiles", "(", "arg_0", ".", "api", ",", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\n    '''\n      Based on some criteria, Func the profiles and return a new Profiles\n      Manager containing only the chosen items\n\n      If the manager doen't have any items, get all the profiles from Buffer\n    '''\n\n    if not len(arg_0):\n      arg_0.all()\n\n    arg_2 = Func(lambda item: [True for arg in arg_1 if item[arg] == arg_1[arg]] != [], arg_0)\n\n    return Profiles(arg_0.api, arg_2)", "path": "buffpy/managers/profiles.py", "identifier": "Profiles.filter", "docstring": "Based on some criteria, filter the profiles and return a new Profiles\n      Manager containing only the chosen items\n\n      If the manager doen't have any items, get all the profiles from Buffer", "docstring_tokens": ["Based", "on", "some", "criteria", "filter", "the", "profiles", "and", "return", "a", "new", "Profiles", "Manager", "containing", "only", "the", "chosen", "items"], "nwo": "vtemian/buffpy", "score": 0.2727920376977753, "idx": 252357}
{"url": "https://github.com/amcat/progressmonitor/blob/d4cabebc95bfd1447120f601c094b20bee954285/progressmonitor/__init__.py#L72-L77", "sha": "d4cabebc95bfd1447120f601c094b20bee954285", "docstring_summary": "Call before starting work on a monitor, specifying name and amount of work", "language": "python", "parameters": "(self, total: int, name=None, message=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_0", ".", "total", "=", "arg_1", "arg_4", "=", "arg_4", "or", "arg_3", "or", "\"Working...\"", "arg_0", ".", "name", "=", "arg_3", "or", "\"ProgressMonitor\"", "arg_0", ".", "update", "(", "0", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3=None, arg_4=None):\n        \"\"\"Call before starting work on a monitor, specifying name and amount of work\"\"\"\n        arg_0.total = arg_1\n        arg_4 = arg_4 or arg_3 or \"Working...\"\n        arg_0.name = arg_3 or \"ProgressMonitor\"\n        arg_0.update(0, arg_4)", "path": "progressmonitor/__init__.py", "identifier": "ProgressMonitor.begin", "docstring": "Call before starting work on a monitor, specifying name and amount of work", "docstring_tokens": ["Call", "before", "starting", "work", "on", "a", "monitor", "specifying", "name", "and", "amount", "of", "work"], "nwo": "amcat/progressmonitor", "score": 0.0, "idx": 252358}
{"url": "https://github.com/bbusenius/Diablo-Python/blob/646ac5a6f1c79cf9b928a4e2a7979988698b6c82/simple_math/simple_math.py#L146-L172", "sha": "646ac5a6f1c79cf9b928a4e2a7979988698b6c82", "docstring_summary": "Calculates the future value of money invested at an anual interest rate,\n    x times per year, for a given number of years.", "language": "python", "parameters": "(present_value, annual_rate, periods_per_year, years)", "return_statement": "return present_value * (1 + rate_per_period) ** periods", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", "/", "float", "(", "arg_2", ")", "arg_5", "=", "arg_2", "*", "arg_3", "return", "arg_0", "*", "(", "1", "+", "arg_4", ")", "**", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Calculates the future value of money invested at an anual interest rate,\n    x times per year, for a given number of years.\n\n    Args:\n        present_value: int or float, the current value of the money (principal).\n\n        annual_rate: float 0 to 1 e.g., .5 = 50%), the interest rate paid out.\n\n        periods_per_year: int, the number of times money is invested per year.\n\n        years: int, the number of years invested.\n\n    Returns:\n        Float, the future value of the money invested with compound interest.\n    \"\"\"\n\n    # The nominal interest rate per period (rate) is how much interest you earn during a\n    # particular length of time, before accounting for compounding. This is typically\n    # expressed as a percentage.\n    arg_4 = arg_1 / float(arg_2)\n\n    # How many periods in the future the calculation is for.\n    arg_5 = arg_2 * arg_3\n\n    return arg_0 * (1 + arg_4) ** arg_5", "path": "simple_math/simple_math.py", "identifier": "future_value", "docstring": "Calculates the future value of money invested at an anual interest rate,\n    x times per year, for a given number of years.\n\n    Args:\n        present_value: int or float, the current value of the money (principal).\n\n        annual_rate: float 0 to 1 e.g., .5 = 50%), the interest rate paid out.\n\n        periods_per_year: int, the number of times money is invested per year.\n\n        years: int, the number of years invested.\n\n    Returns:\n        Float, the future value of the money invested with compound interest.", "docstring_tokens": ["Calculates", "the", "future", "value", "of", "money", "invested", "at", "an", "anual", "interest", "rate", "x", "times", "per", "year", "for", "a", "given", "number", "of", "years", "."], "nwo": "bbusenius/Diablo-Python", "score": 0.24979334806965703, "idx": 252359}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/misc_util.py#L159-L182", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Given an a gym environment possibly wrapped multiple times, returns a wrapper\n    of class named classname or raises ValueError if no such wrapper was applied", "language": "python", "parameters": "(env, classname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "while", "True", ":", "if", "arg_1", "==", "arg_2", ".", "class_name", "(", ")", ":", "return", "arg_2", "elif", "isinstance", "(", "arg_2", ",", "gym", ".", "Wrapper", ")", ":", "arg_2", "=", "arg_2", ".", "env", "else", ":", "raise", "ValueError", "(", "\"Couldn't find wrapper named %s\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Given an a gym environment possibly wrapped multiple times, returns a wrapper\n    of class named classname or raises ValueError if no such wrapper was applied\n\n    Parameters\n    ----------\n    env: gym.Env of gym.Wrapper\n        gym environment\n    classname: str\n        name of the wrapper\n\n    Returns\n    -------\n    wrapper: gym.Wrapper\n        wrapper named classname\n    \"\"\"\n    arg_2 = arg_0\n    while True:\n        if arg_1 == arg_2.class_name():\n            return arg_2\n        elif isinstance(arg_2, gym.Wrapper):\n            arg_2 = arg_2.env\n        else:\n            raise ValueError(\"Couldn't find wrapper named %s\" % arg_1)", "path": "baselines/common/misc_util.py", "identifier": "get_wrapper_by_name", "docstring": "Given an a gym environment possibly wrapped multiple times, returns a wrapper\n    of class named classname or raises ValueError if no such wrapper was applied\n\n    Parameters\n    ----------\n    env: gym.Env of gym.Wrapper\n        gym environment\n    classname: str\n        name of the wrapper\n\n    Returns\n    -------\n    wrapper: gym.Wrapper\n        wrapper named classname", "docstring_tokens": ["Given", "an", "a", "gym", "environment", "possibly", "wrapped", "multiple", "times", "returns", "a", "wrapper", "of", "class", "named", "classname", "or", "raises", "ValueError", "if", "no", "such", "wrapper", "was", "applied"], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 252360}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L2675-L2751", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Left-right flip the image and coordinates for object detection.", "language": "python", "parameters": "(im, coords=None, is_rescale=False, is_center=False, is_random=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "]", "def", "_flip", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "flip_axis", "(", "arg_0", ",", "axis", "=", "1", ",", "arg_4", "=", "False", ")", "arg_5", "=", "list", "(", ")", "for", "arg_6", "in", "arg_1", ":", "if", "len", "(", "arg_6", ")", "!=", "4", ":", "raise", "AssertionError", "(", "\"coordinate should be 4 values : [x, y, w, h]\"", ")", "if", "arg_2", ":", "if", "arg_3", ":", "arg_7", "=", "1.", "-", "arg_6", "[", "0", "]", "else", ":", "arg_7", "=", "1.", "-", "arg_6", "[", "0", "]", "-", "arg_6", "[", "2", "]", "else", ":", "if", "arg_3", ":", "arg_7", "=", "arg_0", ".", "shape", "[", "1", "]", "-", "arg_6", "[", "0", "]", "else", ":", "arg_7", "=", "arg_0", ".", "shape", "[", "1", "]", "-", "arg_6", "[", "0", "]", "-", "arg_6", "[", "2", "]", "arg_5", ".", "append", "(", "[", "arg_7", ",", "arg_6", "[", "1", "]", ",", "arg_6", "[", "2", "]", ",", "arg_6", "[", "3", "]", "]", ")", "return", "arg_0", ",", "arg_5", "if", "arg_4", ":", "arg_8", "=", "np", ".", "random", ".", "uniform", "(", "-", "1", ",", "1", ")", "if", "arg_8", ">", "0", ":", "return", "_flip", "(", "arg_0", ",", "arg_1", ")", "else", ":", "return", "arg_0", ",", "arg_1", "else", ":", "return", "_flip", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=False, arg_4=False):\n    \"\"\"Left-right flip the image and coordinates for object detection.\n\n    Parameters\n    ----------\n    im : numpy.array\n        An image with dimension of [row, col, channel] (default).\n    coords : list of list of 4 int/float or None\n        Coordinates [[x, y, w, h], [x, y, w, h], ...].\n    is_rescale : boolean\n        Set to True, if the input coordinates are rescaled to [0, 1]. Default is False.\n    is_center : boolean\n        Set to True, if the x and y of coordinates are the centroid (i.e. darknet format). Default is False.\n    is_random : boolean\n        If True, randomly flip. Default is False.\n\n    Returns\n    -------\n    numpy.array\n        A processed image\n    list of list of 4 numbers\n        A list of new bounding boxes.\n\n    Examples\n    --------\n    >>> im = np.zeros([80, 100])    # as an image with shape width=100, height=80\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[0.2, 0.4, 0.3, 0.3], [0.1, 0.5, 0.2, 0.3]], is_rescale=True, is_center=True, is_random=False)\n    >>> print(coords)\n      [[0.8, 0.4, 0.3, 0.3], [0.9, 0.5, 0.2, 0.3]]\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[0.2, 0.4, 0.3, 0.3]], is_rescale=True, is_center=False, is_random=False)\n    >>> print(coords)\n      [[0.5, 0.4, 0.3, 0.3]]\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[20, 40, 30, 30]], is_rescale=False, is_center=True, is_random=False)\n    >>> print(coords)\n      [[80, 40, 30, 30]]\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[20, 40, 30, 30]], is_rescale=False, is_center=False, is_random=False)\n    >>> print(coords)\n      [[50, 40, 30, 30]]\n\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = []\n\n    def _flip(arg_0, arg_1):\n        arg_0 = flip_axis(arg_0, axis=1, arg_4=False)\n        arg_5 = list()\n\n        for arg_6 in arg_1:\n\n            if len(arg_6) != 4:\n                raise AssertionError(\"coordinate should be 4 values : [x, y, w, h]\")\n\n            if arg_2:\n                if arg_3:\n                    # x_center' = 1 - x\n                    arg_7 = 1. - arg_6[0]\n                else:\n                    # x_center' = 1 - x - w\n                    arg_7 = 1. - arg_6[0] - arg_6[2]\n            else:\n                if arg_3:\n                    # x' = im.width - x\n                    arg_7 = arg_0.shape[1] - arg_6[0]\n                else:\n                    # x' = im.width - x - w\n                    arg_7 = arg_0.shape[1] - arg_6[0] - arg_6[2]\n            arg_5.append([arg_7, arg_6[1], arg_6[2], arg_6[3]])\n        return arg_0, arg_5\n\n    if arg_4:\n        arg_8 = np.random.uniform(-1, 1)\n        if arg_8 > 0:\n            return _flip(arg_0, arg_1)\n        else:\n            return arg_0, arg_1\n    else:\n        return _flip(arg_0, arg_1)", "path": "tensorlayer/prepro.py", "identifier": "obj_box_horizontal_flip", "docstring": "Left-right flip the image and coordinates for object detection.\n\n    Parameters\n    ----------\n    im : numpy.array\n        An image with dimension of [row, col, channel] (default).\n    coords : list of list of 4 int/float or None\n        Coordinates [[x, y, w, h], [x, y, w, h], ...].\n    is_rescale : boolean\n        Set to True, if the input coordinates are rescaled to [0, 1]. Default is False.\n    is_center : boolean\n        Set to True, if the x and y of coordinates are the centroid (i.e. darknet format). Default is False.\n    is_random : boolean\n        If True, randomly flip. Default is False.\n\n    Returns\n    -------\n    numpy.array\n        A processed image\n    list of list of 4 numbers\n        A list of new bounding boxes.\n\n    Examples\n    --------\n    >>> im = np.zeros([80, 100])    # as an image with shape width=100, height=80\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[0.2, 0.4, 0.3, 0.3], [0.1, 0.5, 0.2, 0.3]], is_rescale=True, is_center=True, is_random=False)\n    >>> print(coords)\n      [[0.8, 0.4, 0.3, 0.3], [0.9, 0.5, 0.2, 0.3]]\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[0.2, 0.4, 0.3, 0.3]], is_rescale=True, is_center=False, is_random=False)\n    >>> print(coords)\n      [[0.5, 0.4, 0.3, 0.3]]\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[20, 40, 30, 30]], is_rescale=False, is_center=True, is_random=False)\n    >>> print(coords)\n      [[80, 40, 30, 30]]\n    >>> im, coords = obj_box_left_right_flip(im, coords=[[20, 40, 30, 30]], is_rescale=False, is_center=False, is_random=False)\n    >>> print(coords)\n      [[50, 40, 30, 30]]", "docstring_tokens": ["Left", "-", "right", "flip", "the", "image", "and", "coordinates", "for", "object", "detection", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 252361}
{"url": "https://github.com/awentzonline/keras-vgg-buddy/blob/716cb66396b839a66ec8dc66998066b360a8f395/keras_vgg_buddy/models.py#L11-L18", "sha": "716cb66396b839a66ec8dc66998066b360a8f395", "docstring_summary": "Decondition an image from the VGG16 model.", "language": "python", "parameters": "(x)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "transpose", "(", "(", "1", ",", "2", ",", "0", ")", ")", "arg_0", "[", ":", ",", ":", ",", "0", "]", "+=", "103.939", "arg_0", "[", ":", ",", ":", ",", "1", "]", "+=", "116.779", "arg_0", "[", ":", ",", ":", ",", "2", "]", "+=", "123.68", "arg_0", "=", "arg_0", "[", ":", ",", ":", ",", ":", ":", "-", "1", "]", "return", "arg_0"], "function": "def Func(arg_0):\n    '''Decondition an image from the VGG16 model.'''\n    arg_0 = arg_0.transpose((1, 2, 0))\n    arg_0[:, :, 0] += 103.939\n    arg_0[:, :, 1] += 116.779\n    arg_0[:, :, 2] += 123.68\n    arg_0 = arg_0[:,:,::-1]  # to RGB\n    return arg_0", "path": "keras_vgg_buddy/models.py", "identifier": "img_from_vgg", "docstring": "Decondition an image from the VGG16 model.", "docstring_tokens": ["Decondition", "an", "image", "from", "the", "VGG16", "model", "."], "nwo": "awentzonline/keras-vgg-buddy", "score": 0.19858476458209082, "idx": 252362}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/exactpsf.py#L325-L327", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Transform z to real-space coordinates from tile coordinates", "language": "python", "parameters": "(self, z)", "return_statement": "return (z-self.param_dict['psf-zslab'])*self.param_dict[self.zscale]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "arg_1", "-", "arg_0", ".", "param_dict", "[", "'psf-zslab'", "]", ")", "*", "arg_0", ".", "param_dict", "[", "arg_0", ".", "zscale", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Transform z to real-space coordinates from tile coordinates \"\"\"\n        return (arg_1-arg_0.param_dict['psf-zslab'])*arg_0.param_dict[arg_0.zscale]", "path": "peri/comp/exactpsf.py", "identifier": "ExactPSF._tz", "docstring": "Transform z to real-space coordinates from tile coordinates", "docstring_tokens": ["Transform", "z", "to", "real", "-", "space", "coordinates", "from", "tile", "coordinates"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252363}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L160-L173", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Make a POST request using the session object to a Degreed endpoint.", "language": "python", "parameters": "(self, url, data, scope)", "return_statement": "return response.status_code, response.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "_create_session", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "session", ".", "post", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_4", ".", "status_code", ",", "arg_4", ".", "text"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Make a POST request using the session object to a Degreed endpoint.\n\n        Args:\n            url (str): The url to send a POST request to.\n            data (str): The json encoded payload to POST.\n            scope (str): Must be one of the scopes Degreed expects:\n                        - `CONTENT_PROVIDER_SCOPE`\n                        - `COMPLETION_PROVIDER_SCOPE`\n        \"\"\"\n        arg_0._create_session(arg_3)\n        arg_4 = arg_0.session.post(arg_1, arg_2=arg_2)\n        return arg_4.status_code, arg_4.text", "path": "integrated_channels/degreed/client.py", "identifier": "DegreedAPIClient._post", "docstring": "Make a POST request using the session object to a Degreed endpoint.\n\n        Args:\n            url (str): The url to send a POST request to.\n            data (str): The json encoded payload to POST.\n            scope (str): Must be one of the scopes Degreed expects:\n                        - `CONTENT_PROVIDER_SCOPE`\n                        - `COMPLETION_PROVIDER_SCOPE`", "docstring_tokens": ["Make", "a", "POST", "request", "using", "the", "session", "object", "to", "a", "Degreed", "endpoint", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252364}
{"url": "https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L228-L232", "sha": "bb1990cf1460ae42f2dde75f2291625ddac2c0e4", "docstring_summary": "Power on or off the device.", "language": "python", "parameters": "(self, value=False)", "return_statement": "return bool(power)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "(", "yield", "from", "arg_0", ".", "handle_set", "(", "arg_0", ".", "API", ".", "get", "(", "'power'", ")", ",", "int", "(", "arg_1", ")", ")", ")", "return", "bool", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Power on or off the device.\"\"\"\n        arg_2 = (yield from arg_0.handle_set(\n            arg_0.API.get('power'), int(arg_1)))\n        return bool(arg_2)", "path": "afsapi/__init__.py", "identifier": "AFSAPI.set_power", "docstring": "Power on or off the device.", "docstring_tokens": ["Power", "on", "or", "off", "the", "device", "."], "nwo": "zhelev/python-afsapi", "score": 0.16638194949711382, "idx": 252365}
{"url": "https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L35-L45", "sha": "7ea7626695abf095df6a67f66e5b3e9ae91b16df", "docstring_summary": "List unique elements, preserving order. Remember only the element just seen.", "language": "python", "parameters": "(iterable, key=None)", "return_statement": "return map(next, map(operator.itemgetter(1), itertools.groupby(iterable, key)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "try", ":", "from", "itertools", "import", "imap", "as", "map", "except", "ImportError", ":", "from", "builtins", "import", "map", "return", "map", "(", "next", ",", "map", "(", "operator", ".", "itemgetter", "(", "1", ")", ",", "itertools", ".", "groupby", "(", "arg_0", ",", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"List unique elements, preserving order. Remember only the element just seen.\"\n    # Func('AAAABBBCCDAABBB') --> A B C D A B\n    # Func('ABBCcAD', str.lower) --> A B C A D\n    try:\n        # PY2 support\n        from itertools import imap as map\n    except ImportError:\n        from builtins import map\n\n    return map(next, map(operator.itemgetter(1), itertools.groupby(arg_0, arg_1)))", "path": "pyaxiom/utils.py", "identifier": "unique_justseen", "docstring": "List unique elements, preserving order. Remember only the element just seen.", "docstring_tokens": ["List", "unique", "elements", "preserving", "order", ".", "Remember", "only", "the", "element", "just", "seen", "."], "nwo": "axiom-data-science/pyaxiom", "score": 0.138843686048881, "idx": 252366}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/service.py#L92-L130", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "Setup output processors", "language": "python", "parameters": "(self, config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "proto", "==", "'tcp'", ":", "arg_2", "=", "{", "'output'", ":", "'tensor.outputs.riemann.RiemannTCP'", ",", "'server'", ":", "arg_0", ".", "server", ",", "'port'", ":", "arg_0", ".", "port", "}", "else", ":", "arg_2", "=", "{", "'output'", ":", "'tensor.outputs.riemann.RiemannUDP'", ",", "'server'", ":", "arg_0", ".", "server", ",", "'port'", ":", "arg_0", ".", "port", "}", "arg_3", "=", "arg_1", ".", "get", "(", "'outputs'", ",", "[", "arg_2", "]", ")", "for", "arg_4", "in", "arg_3", ":", "if", "not", "(", "'debug'", "in", "arg_4", ")", ":", "arg_4", "[", "'debug'", "]", "=", "arg_0", ".", "debug", "arg_5", "=", "arg_4", "[", "'output'", "]", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "arg_6", "=", "'.'", ".", "join", "(", "arg_4", "[", "'output'", "]", ".", "split", "(", "'.'", ")", "[", ":", "-", "1", "]", ")", "arg_7", "=", "getattr", "(", "importlib", ".", "import_module", "(", "arg_6", ")", ",", "arg_5", ")", "(", "arg_4", ",", "arg_0", ")", "arg_8", "=", "arg_4", ".", "get", "(", "'name'", ",", "None", ")", "if", "arg_8", "in", "arg_0", ".", "outputs", ":", "arg_0", ".", "outputs", "[", "arg_8", "]", ".", "append", "(", "arg_7", ")", "else", ":", "arg_0", ".", "outputs", "[", "arg_8", "]", "=", "[", "arg_7", "]", "reactor", ".", "callLater", "(", "0", ",", "arg_7", ".", "createClient", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Setup output processors\"\"\"\n\n        if arg_0.proto == 'tcp':\n            arg_2 = {\n                'output': 'tensor.outputs.riemann.RiemannTCP',\n                'server': arg_0.server,\n                'port': arg_0.port\n            }\n        else:\n            arg_2 = {\n                'output': 'tensor.outputs.riemann.RiemannUDP',\n                'server': arg_0.server,\n                'port': arg_0.port\n            }\n\n        arg_3 = arg_1.get('outputs', [arg_2])\n\n        for arg_4 in arg_3:\n            if not ('debug' in arg_4):\n                arg_4['debug'] = arg_0.debug\n\n            arg_5 = arg_4['output'].split('.')[-1]                # class\n            arg_6 = '.'.join(arg_4['output'].split('.')[:-1])   # import path\n\n            # Import the module and construct the output object\n            arg_7 = getattr(\n                importlib.import_module(arg_6), arg_5)(arg_4, arg_0)\n\n            arg_8 = arg_4.get('name', None)\n\n            # Add the output to our routing hash\n            if arg_8 in arg_0.outputs:\n                arg_0.outputs[arg_8].append(arg_7)\n            else:\n                arg_0.outputs[arg_8] = [arg_7]\n\n            # connect the output\n            reactor.callLater(0, arg_7.createClient)", "path": "tensor/service.py", "identifier": "TensorService.setupOutputs", "docstring": "Setup output processors", "docstring_tokens": ["Setup", "output", "processors"], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 252367}
{"url": "https://github.com/larsyencken/proj/blob/44fd72aeb9bbf72046d81c4e9e4306a23335dc0a/proj/__init__.py#L106-L118", "sha": "44fd72aeb9bbf72046d81c4e9e4306a23335dc0a", "docstring_summary": "The equivalent of 'mkdir -p' in shell.", "language": "python", "parameters": "(p)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "isdir", "arg_2", "=", "[", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", "]", "while", "not", "arg_1", "(", "arg_2", "[", "-", "1", "]", ")", ":", "arg_3", "=", "os", ".", "path", ".", "dirname", "(", "arg_2", "[", "-", "1", "]", ")", "arg_2", ".", "append", "(", "arg_3", ")", "while", "arg_2", ":", "arg_0", "=", "arg_2", ".", "pop", "(", ")", "if", "not", "arg_1", "(", "arg_0", ")", ":", "os", ".", "mkdir", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"The equivalent of 'mkdir -p' in shell.\"\n    arg_1 = os.path.isdir\n\n    arg_2 = [os.path.abspath(arg_0)]\n    while not arg_1(arg_2[-1]):\n        arg_3 = os.path.dirname(arg_2[-1])\n        arg_2.append(arg_3)\n\n    while arg_2:\n        arg_0 = arg_2.pop()\n        if not arg_1(arg_0):\n            os.mkdir(arg_0)", "path": "proj/__init__.py", "identifier": "_mkdir", "docstring": "The equivalent of 'mkdir -p' in shell.", "docstring_tokens": ["The", "equivalent", "of", "mkdir", "-", "p", "in", "shell", "."], "nwo": "larsyencken/proj", "score": 0.2619419494340654, "idx": 252368}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L562-L576", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Acquire the semaphore", "language": "python", "parameters": "(self, tag, blocking=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "logger", ".", "debug", "(", "\"Acquiring %s\"", ",", "arg_1", ")", "if", "not", "arg_0", ".", "_semaphore", ".", "Func", "(", "arg_2", ")", ":", "raise", "NoResourcesAvailable", "(", "\"Cannot Func tag '%s'\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Acquire the semaphore\n\n        :param tag: A tag identifying what is acquiring the semaphore. Note\n            that this is not really needed to directly use this class but is\n            needed for API compatibility with the SlidingWindowSemaphore\n            implementation.\n        :param block: If True, block until it can be Funcd. If False,\n            do not block and raise an exception if cannot be aquired.\n\n        :returns: A token (can be None) to use when releasing the semaphore\n        \"\"\"\n        logger.debug(\"Acquiring %s\", arg_1)\n        if not arg_0._semaphore.Func(arg_2):\n            raise NoResourcesAvailable(\"Cannot Func tag '%s'\" % arg_1)", "path": "s3transfer/utils.py", "identifier": "TaskSemaphore.acquire", "docstring": "Acquire the semaphore\n\n        :param tag: A tag identifying what is acquiring the semaphore. Note\n            that this is not really needed to directly use this class but is\n            needed for API compatibility with the SlidingWindowSemaphore\n            implementation.\n        :param block: If True, block until it can be acquired. If False,\n            do not block and raise an exception if cannot be aquired.\n\n        :returns: A token (can be None) to use when releasing the semaphore", "docstring_tokens": ["Acquire", "the", "semaphore"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 252369}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/manager/manager.py#L31-L64", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Custom version of the standard annotate function\n        that allows using field names as annotated fields.", "language": "python", "parameters": "(self, **annotations)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "field", ".", "name", ":", "field", "for", "field", "in", "arg_0", ".", "model", ".", "_meta", ".", "get_fields", "(", ")", "}", "arg_3", "=", "{", "}", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_5", "in", "arg_2", ":", "arg_7", "=", "'%s_new'", "%", "arg_5", "arg_3", "[", "arg_7", "]", "=", "arg_6", "arg_4", "[", "arg_7", "]", "=", "arg_5", "else", ":", "arg_3", "[", "arg_5", "]", "=", "arg_6", "arg_8", "=", "super", "(", ")", ".", "Func", "(", "**", "arg_3", ")", "arg_8", ".", "rename_annotations", "(", "**", "arg_4", ")", "return", "arg_8"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Custom version of the standard Func function\n        that allows using field names as Funcd fields.\n\n        Normally, the Func function doesn't allow you\n        to use the name of an existing field on the model\n        as the alias name. This version of the function does\n        allow that.\n        \"\"\"\n\n        arg_2 = {\n            field.name: field\n            for field in arg_0.model._meta.get_fields()\n        }\n\n        # temporarily rename the fields that have the same\n        # name as a field name, we'll rename them back after\n        # the function in the base class ran\n        arg_3 = {}\n        arg_4 = {}\n        for arg_5, arg_6 in arg_1.items():\n            if arg_5 in arg_2:\n                arg_7 = '%s_new' % arg_5\n                arg_3[arg_7] = arg_6\n                arg_4[arg_7] = arg_5\n            else:\n                arg_3[arg_5] = arg_6\n\n        # run the base class's Func function\n        arg_8 = super().Func(**arg_3)\n\n        # rename the annotations back to as specified\n        arg_8.rename_annotations(**arg_4)\n        return arg_8", "path": "psqlextra/manager/manager.py", "identifier": "PostgresQuerySet.annotate", "docstring": "Custom version of the standard annotate function\n        that allows using field names as annotated fields.\n\n        Normally, the annotate function doesn't allow you\n        to use the name of an existing field on the model\n        as the alias name. This version of the function does\n        allow that.", "docstring_tokens": ["Custom", "version", "of", "the", "standard", "annotate", "function", "that", "allows", "using", "field", "names", "as", "annotated", "fields", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 252370}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2786-L2802", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Recursively removes the group and all it's children.", "language": "python", "parameters": "(self, recursive=True, predicate=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "f_get_parent", "(", ")", "arg_3", ".", "Func_child", "(", "arg_0", ".", "v_name", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=None):\n        \"\"\"Recursively removes the group and all it's children.\n\n        :param recursive:\n\n            If removal should be applied recursively. If not, node can only be removed\n            if it has no children.\n\n        :param predicate:\n\n            In case of recursive removal, you can selectively remove nodes in the tree.\n            Predicate which can evaluate for each node to ``True`` in order to remove the node or\n            ``False`` if the node should be kept. Leave ``None`` if you want to remove all nodes.\n\n        \"\"\"\n        arg_3 = arg_0.f_get_parent()\n        arg_3.Func_child(arg_0.v_name, arg_1=arg_1, arg_2=arg_2)", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_remove", "docstring": "Recursively removes the group and all it's children.\n\n        :param recursive:\n\n            If removal should be applied recursively. If not, node can only be removed\n            if it has no children.\n\n        :param predicate:\n\n            In case of recursive removal, you can selectively remove nodes in the tree.\n            Predicate which can evaluate for each node to ``True`` in order to remove the node or\n            ``False`` if the node should be kept. Leave ``None`` if you want to remove all nodes.", "docstring_tokens": ["Recursively", "removes", "the", "group", "and", "all", "it", "s", "children", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252371}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/serializers.py#L76-L89", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get course's duration as a timedelta.", "language": "python", "parameters": "(self, obj)", "return_statement": "return ''", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "end", "-", "arg_1", ".", "start", "if", "arg_1", ".", "start", "and", "arg_1", ".", "end", "else", "None", "if", "arg_2", ":", "return", "strfdelta", "(", "arg_2", ",", "'{W} weeks {D} days.'", ")", "return", "''"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get course's duration as a timedelta.\n\n        Arguments:\n            obj (CourseOverview): CourseOverview object\n\n        Returns:\n            (timedelta): Duration of a course.\n        \"\"\"\n        arg_2 = arg_1.end - arg_1.start if arg_1.start and arg_1.end else None\n        if arg_2:\n            return strfdelta(arg_2, '{W} weeks {D} days.')\n        return ''", "path": "integrated_channels/xapi/serializers.py", "identifier": "CourseInfoSerializer.get_course_duration", "docstring": "Get course's duration as a timedelta.\n\n        Arguments:\n            obj (CourseOverview): CourseOverview object\n\n        Returns:\n            (timedelta): Duration of a course.", "docstring_tokens": ["Get", "course", "s", "duration", "as", "a", "timedelta", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252372}
{"url": "https://github.com/mk-fg/python-onedrive/blob/74d3f6605b0e8a9031a2aab8092f551293ffb533/onedrive/api_v5.py#L271-L274", "sha": "74d3f6605b0e8a9031a2aab8092f551293ffb533", "docstring_summary": "Refresh or acquire access_token.", "language": "python", "parameters": "(self, check_scope=True)", "return_statement": "return self._auth_token_process(res, check_scope=check_scope)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "arg_0", ".", "auth_access_data_raw", "=", "arg_0", ".", "_auth_token_request", "(", ")", "return", "arg_0", ".", "_auth_token_process", "(", "arg_2", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=True):\n\t\t'Refresh or acquire access_token.'\n\t\targ_2 = arg_0.auth_access_data_raw = arg_0._auth_token_request()\n\t\treturn arg_0._auth_token_process(arg_2, arg_1=arg_1)", "path": "onedrive/api_v5.py", "identifier": "OneDriveAuth.auth_get_token", "docstring": "Refresh or acquire access_token.", "docstring_tokens": ["Refresh", "or", "acquire", "access_token", "."], "nwo": "mk-fg/python-onedrive", "score": 0.3204703910366837, "idx": 252373}
{"url": "https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/owsrequest.py#L146-L156", "sha": "e6a36b3aeeacf44eec537434b0fb87c09ab54b5f", "docstring_summary": "Check mandatory service name parameter in POST request.", "language": "python", "parameters": "(self)", "return_statement": "return self.params[\"service\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "\"service\"", "in", "arg_0", ".", "document", ".", "attrib", ":", "arg_1", "=", "arg_0", ".", "document", ".", "attrib", "[", "\"service\"", "]", ".", "lower", "(", ")", "if", "arg_1", "in", "allowed_service_types", ":", "arg_0", ".", "params", "[", "\"service\"", "]", "=", "arg_1", "else", ":", "raise", "OWSInvalidParameterValue", "(", "\"Service %s is not supported\"", "%", "arg_1", ",", "arg_1", "=", "\"service\"", ")", "else", ":", "raise", "OWSMissingParameterValue", "(", "'Parameter \"service\" is missing'", ",", "arg_1", "=", "\"service\"", ")", "return", "arg_0", ".", "params", "[", "\"service\"", "]"], "function": "def Func(arg_0):\n        \"\"\"Check mandatory service name parameter in POST request.\"\"\"\n        if \"service\" in arg_0.document.attrib:\n            arg_1 = arg_0.document.attrib[\"service\"].lower()\n            if arg_1 in allowed_service_types:\n                arg_0.params[\"service\"] = arg_1\n            else:\n                raise OWSInvalidParameterValue(\"Service %s is not supported\" % arg_1, arg_1=\"service\")\n        else:\n            raise OWSMissingParameterValue('Parameter \"service\" is missing', arg_1=\"service\")\n        return arg_0.params[\"service\"]", "path": "twitcher/owsrequest.py", "identifier": "Post._get_service", "docstring": "Check mandatory service name parameter in POST request.", "docstring_tokens": ["Check", "mandatory", "service", "name", "parameter", "in", "POST", "request", "."], "nwo": "bird-house/twitcher", "score": 0.37599664903417057, "idx": 252374}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/base.py#L574-L599", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Groups transactions in the bundle by address.", "language": "python", "parameters": "(self)", "return_statement": "return groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "if", "arg_0", ":", "arg_2", "=", "arg_0", ".", "tail_transaction", "arg_3", "=", "[", "arg_2", "]", "for", "arg_4", "in", "arg_0", ".", "transactions", "[", "1", ":", "]", ":", "if", "arg_4", ".", "address", "==", "arg_2", ".", "address", ":", "arg_3", ".", "append", "(", "arg_4", ")", "else", ":", "arg_1", ".", "append", "(", "arg_3", ")", "arg_3", "=", "[", "arg_4", "]", "arg_2", "=", "arg_4", "if", "arg_3", ":", "arg_1", ".", "append", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        # type: () -> List[List[Transaction]]\n        \"\"\"\n        Groups transactions in the bundle by address.\n        \"\"\"\n        arg_1 = []\n\n        if arg_0:\n            arg_2 = arg_0.tail_transaction\n            arg_3 = [arg_2]\n            for arg_4 in arg_0.transactions[1:]:\n                # Transactions are grouped by address, so as long as the\n                # address stays consistent from one transaction to\n                # another, we are still in the same group.\n                if arg_4.address == arg_2.address:\n                    arg_3.append(arg_4)\n                else:\n                    arg_1.append(arg_3)\n                    arg_3 = [arg_4]\n\n                arg_2 = arg_4\n\n            if arg_3:\n                arg_1.append(arg_3)\n\n        return arg_1", "path": "iota/transaction/base.py", "identifier": "Bundle.group_transactions", "docstring": "Groups transactions in the bundle by address.", "docstring_tokens": ["Groups", "transactions", "in", "the", "bundle", "by", "address", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 252375}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/writers/tagvalue.py#L51-L64", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Write the creation info to out.", "language": "python", "parameters": "(creation_info, out)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "write", "(", "'# Creation Info\\n\\n'", ")", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "creators", ")", ":", "write_value", "(", "'Creator'", ",", "arg_2", ",", "arg_1", ")", "write_value", "(", "'Created'", ",", "arg_0", ".", "created_iso_format", ",", "arg_1", ")", "if", "arg_0", ".", "has_comment", ":", "write_text_value", "(", "'CreatorComment'", ",", "arg_0", ".", "comment", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Write the creation info to out.\n    \"\"\"\n    arg_1.write('# Creation Info\\n\\n')\n    # Write sorted creators\n    for arg_2 in sorted(arg_0.creators):\n        write_value('Creator', arg_2, arg_1)\n\n    # write created\n    write_value('Created', arg_0.created_iso_format, arg_1)\n    # possible comment\n    if arg_0.has_comment:\n        write_text_value('CreatorComment', arg_0.comment, arg_1)", "path": "spdx/writers/tagvalue.py", "identifier": "write_creation_info", "docstring": "Write the creation info to out.", "docstring_tokens": ["Write", "the", "creation", "info", "to", "out", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 252376}
{"url": "https://github.com/nprapps/copydoc/blob/e1ab09b287beb0439748c319cf165cbc06c66624/copydoc.py#L197-L205", "sha": "e1ab09b287beb0439748c319cf165cbc06c66624", "docstring_summary": "Parse attribute. Delegate to href parser for hrefs, otherwise return\n        value.", "language": "python", "parameters": "(self, tagname, attr, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_1", "==", "'a'", "and", "arg_2", "==", "'href'", ":", "return", "arg_0", ".", "_parse_href", "(", "arg_3", ")", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Parse attribute. Delegate to href parser for hrefs, otherwise return\n        value.\n        \"\"\"\n        if arg_1 == 'a' and arg_2 == 'href':\n            return arg_0._parse_href(arg_3)\n        else:\n            return arg_3", "path": "copydoc.py", "identifier": "CopyDoc._parse_attr", "docstring": "Parse attribute. Delegate to href parser for hrefs, otherwise return\n        value.", "docstring_tokens": ["Parse", "attribute", ".", "Delegate", "to", "href", "parser", "for", "hrefs", "otherwise", "return", "value", "."], "nwo": "nprapps/copydoc", "score": 0.16246995141409282, "idx": 252377}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/databuffer.py#L114-L126", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Returns a h5py dataset given its registered name.", "language": "python", "parameters": "(self, ds_name, mode='r')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'r'", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_datasets", ":", "return", "arg_0", ".", "_datasets", "[", "arg_1", "]", "else", ":", "return", "arg_0", ".", "create_empty_dataset", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2='r'):\n        \"\"\"\n        Returns a h5py dataset given its registered name.\n\n        :param ds_name: string\n        Name of the dataset to be returned.\n\n        :return:\n        \"\"\"\n        if arg_1 in arg_0._datasets:\n            return arg_0._datasets[arg_1]\n        else:\n            return arg_0.create_empty_dataset(arg_1)", "path": "boyle/databuffer.py", "identifier": "HdfDataBuffer.get_dataset", "docstring": "Returns a h5py dataset given its registered name.\n\n        :param ds_name: string\n        Name of the dataset to be returned.\n\n        :return:", "docstring_tokens": ["Returns", "a", "h5py", "dataset", "given", "its", "registered", "name", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 252378}
{"url": "https://github.com/edx/edx-organizations/blob/51000d5d359d880a6eb3a79345f60744f1982c00/organizations/serializers.py#L18-L28", "sha": "51000d5d359d880a6eb3a79345f60744f1982c00", "docstring_summary": "Organization object-to-dict serialization", "language": "python", "parameters": "(organization)", "return_statement": "return {\n        'id': organization.id,\n        'name': organization.name,\n        'short_name': organization.short_name,\n        'description': organization.description,\n        'logo': organization.logo\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "'id'", ":", "arg_0", ".", "id", ",", "'name'", ":", "arg_0", ".", "name", ",", "'short_name'", ":", "arg_0", ".", "short_name", ",", "'description'", ":", "arg_0", ".", "description", ",", "'logo'", ":", "arg_0", ".", "logo", "}"], "function": "def Func(arg_0):\n    \"\"\"\n    Organization object-to-dict serialization\n    \"\"\"\n    return {\n        'id': arg_0.id,\n        'name': arg_0.name,\n        'short_name': arg_0.short_name,\n        'description': arg_0.description,\n        'logo': arg_0.logo\n    }", "path": "organizations/serializers.py", "identifier": "serialize_organization", "docstring": "Organization object-to-dict serialization", "docstring_tokens": ["Organization", "object", "-", "to", "-", "dict", "serialization"], "nwo": "edx/edx-organizations", "score": 0.5537402011854966, "idx": 252379}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L1212-L1231", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Search item metadata using Apache Solr.", "language": "python", "parameters": "(self, query, token=None, limit=20)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "20", ")", ":", "arg_4", "=", "dict", "(", ")", "arg_4", "[", "'query'", "]", "=", "arg_1", "arg_4", "[", "'limit'", "]", "=", "arg_3", "if", "arg_2", ":", "arg_4", "[", "'token'", "]", "=", "arg_2", "arg_5", "=", "arg_0", ".", "request", "(", "'midas.solr.search.advanced'", ",", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=20):\n        \"\"\"\n        Search item metadata using Apache Solr.\n\n        :param query: The Apache Lucene search query.\n        :type query: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :param limit: (optional) The limit of the search.\n        :type limit: int | long\n        :returns: The list of items that match the search query.\n        :rtype: list[dict]\n        \"\"\"\n        arg_4 = dict()\n        arg_4['query'] = arg_1\n        arg_4['limit'] = arg_3\n        if arg_2:\n            arg_4['token'] = arg_2\n        arg_5 = arg_0.request('midas.solr.search.advanced', arg_4)\n        return arg_5", "path": "pydas/drivers.py", "identifier": "SolrDriver.solr_advanced_search", "docstring": "Search item metadata using Apache Solr.\n\n        :param query: The Apache Lucene search query.\n        :type query: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :param limit: (optional) The limit of the search.\n        :type limit: int | long\n        :returns: The list of items that match the search query.\n        :rtype: list[dict]", "docstring_tokens": ["Search", "item", "metadata", "using", "Apache", "Solr", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 252380}
{"url": "https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/abq/abqpostproc.py#L19-L29", "sha": "8170e431362dc760589f7d141090fd133dece259", "docstring_summary": "Writes a xy_report based on xy data.", "language": "python", "parameters": "(odb, path, tags, columns, steps)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "[", "session", ".", "XYDataFromHistory", "(", "name", "=", "arg_3", "[", "i", "]", ",", "arg_0", "=", "arg_0", ",", "outputVariableName", "=", "arg_2", "[", "i", "]", ",", "arg_4", "=", "arg_4", ")", "for", "i", "in", "xrange", "(", "len", "(", "arg_2", ")", ")", "]", "session", ".", "xyReportOptions", ".", "setValues", "(", "numDigits", "=", "8", ",", "numberFormat", "=", "SCIENTIFIC", ")", "session", ".", "writeXYReport", "(", "fileName", "=", "arg_1", ",", "appendMode", "=", "OFF", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n  \"\"\"\n  Writes a xy_report based on xy data.\n  \"\"\"\n  arg_5 = [session.XYDataFromHistory(name = arg_3[i], \n                    arg_0 = arg_0, \n                    outputVariableName = arg_2[i],\n                    arg_4 = arg_4) \n            for i in xrange(len(arg_2))]\n  session.xyReportOptions.setValues(numDigits=8, numberFormat=SCIENTIFIC)\n  session.writeXYReport(fileName=arg_1, appendMode=OFF, arg_5=arg_5)", "path": "argiope/abq/abqpostproc.py", "identifier": "write_xy_report", "docstring": "Writes a xy_report based on xy data.", "docstring_tokens": ["Writes", "a", "xy_report", "based", "on", "xy", "data", "."], "nwo": "lcharleux/argiope", "score": 0.17185066990864498, "idx": 252381}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/image/old_gif.py#L15-L19", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Given a PIL.Image, returns a ColorList of its pixels.", "language": "python", "parameters": "(image, container=list)", "return_statement": "return container(convert_mode(image).getdata())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "deprecated", ".", "deprecated", "(", "'util.gif.Func'", ")", "return", "arg_1", "(", "convert_mode", "(", "arg_0", ")", ".", "getdata", "(", ")", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"Given a PIL.Image, returns a ColorList of its pixels.\"\"\"\n    deprecated.deprecated('util.gif.Func')\n\n    return arg_1(convert_mode(arg_0).getdata())", "path": "bibliopixel/util/image/old_gif.py", "identifier": "image_to_colorlist", "docstring": "Given a PIL.Image, returns a ColorList of its pixels.", "docstring_tokens": ["Given", "a", "PIL", ".", "Image", "returns", "a", "ColorList", "of", "its", "pixels", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 252382}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L10-L48", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Adapter trimming for RNA-seq data", "language": "python", "parameters": "(job, r1_id, r2_id, fwd_3pr_adapter, rev_3pr_adapter)", "return_statement": "return r1_cut_id, r2_cut_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "if", "arg_2", ":", "require", "(", "arg_4", ",", "\"Paired end data requires a reverse 3' adapter sequence.\"", ")", "arg_6", "=", "[", "'-a'", ",", "arg_3", ",", "'-m'", ",", "'35'", "]", "if", "arg_1", "and", "arg_2", ":", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_1", ",", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'R1.fastq'", ")", ")", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_2", ",", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'R2.fastq'", ")", ")", "arg_6", ".", "extend", "(", "[", "'-A'", ",", "arg_4", ",", "'-o'", ",", "'/data/R1_cutadapt.fastq'", ",", "'-p'", ",", "'/data/R2_cutadapt.fastq'", ",", "'/data/R1.fastq'", ",", "'/data/R2.fastq'", "]", ")", "else", ":", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_1", ",", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'R1.fastq'", ")", ")", "arg_6", ".", "extend", "(", "[", "'-o'", ",", "'/data/R1_cutadapt.fastq'", ",", "'/data/R1.fastq'", "]", ")", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "tool", "=", "'quay.io/ucsc_cgl/cutadapt:1.9--6bd44edd2b8f8f17e25c5a268fedaab65fa851d2'", ",", "workDir", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "if", "arg_1", "and", "arg_2", ":", "arg_7", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'R1_cutadapt.fastq'", ")", ")", "arg_8", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'R2_cutadapt.fastq'", ")", ")", "else", ":", "arg_7", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'R1_cutadapt.fastq'", ")", ")", "arg_8", "=", "None", "return", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Adapter trimming for RNA-seq data\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str r1_id: FileStoreID of fastq read 1\n    :param str r2_id: FileStoreID of fastq read 2 (if paired data)\n    :param str fwd_3pr_adapter: Adapter sequence for the forward 3' adapter\n    :param str rev_3pr_adapter: Adapter sequence for the reverse 3' adapter (second fastq pair)\n    :return: R1 and R2 FileStoreIDs\n    :rtype: tuple\n    \"\"\"\n    arg_5 = arg_0.fileStore.getLocalTempDir()\n    if arg_2:\n        require(arg_4, \"Paired end data requires a reverse 3' adapter sequence.\")\n    # Retrieve files\n    arg_6 = ['-a', arg_3,\n                  '-m', '35']\n    if arg_1 and arg_2:\n        arg_0.fileStore.readGlobalFile(arg_1, os.path.join(arg_5, 'R1.fastq'))\n        arg_0.fileStore.readGlobalFile(arg_2, os.path.join(arg_5, 'R2.fastq'))\n        arg_6.extend(['-A', arg_4,\n                           '-o', '/data/R1_cutadapt.fastq',\n                           '-p', '/data/R2_cutadapt.fastq',\n                           '/data/R1.fastq', '/data/R2.fastq'])\n    else:\n        arg_0.fileStore.readGlobalFile(arg_1, os.path.join(arg_5, 'R1.fastq'))\n        arg_6.extend(['-o', '/data/R1_cutadapt.fastq', '/data/R1.fastq'])\n    # Call: CutAdapt\n    dockerCall(arg_0=arg_0, tool='quay.io/ucsc_cgl/cutadapt:1.9--6bd44edd2b8f8f17e25c5a268fedaab65fa851d2',\n               workDir=arg_5, arg_6=arg_6)\n    # Write to fileStore\n    if arg_1 and arg_2:\n        arg_7 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_5, 'R1_cutadapt.fastq'))\n        arg_8 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_5, 'R2_cutadapt.fastq'))\n    else:\n        arg_7 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_5, 'R1_cutadapt.fastq'))\n        arg_8 = None\n    return arg_7, arg_8", "path": "src/toil_lib/tools/preprocessing.py", "identifier": "run_cutadapt", "docstring": "Adapter trimming for RNA-seq data\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str r1_id: FileStoreID of fastq read 1\n    :param str r2_id: FileStoreID of fastq read 2 (if paired data)\n    :param str fwd_3pr_adapter: Adapter sequence for the forward 3' adapter\n    :param str rev_3pr_adapter: Adapter sequence for the reverse 3' adapter (second fastq pair)\n    :return: R1 and R2 FileStoreIDs\n    :rtype: tuple", "docstring_tokens": ["Adapter", "trimming", "for", "RNA", "-", "seq", "data"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 252383}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qobj/converters/pulse_instruction.py#L178-L193", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return converted `PersistentValueInstruction`.", "language": "python", "parameters": "(self, shift, instruction)", "return_statement": "return self._qobj_model(**command_dict)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "'name'", ":", "'pv'", ",", "'t0'", ":", "arg_1", "+", "arg_2", ".", "start_time", ",", "'ch'", ":", "arg_2", ".", "channels", "[", "0", "]", ".", "name", ",", "'val'", ":", "arg_2", ".", "command", ".", "value", "}", "return", "arg_0", ".", "_qobj_model", "(", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return converted `PersistentValueInstruction`.\n\n        Args:\n            shift(int): Offset time.\n            instruction (PersistentValueInstruction): persistent value instruction.\n        Returns:\n            dict: Dictionary of required parameters.\n        \"\"\"\n        arg_3 = {\n            'name': 'pv',\n            't0': arg_1+arg_2.start_time,\n            'ch': arg_2.channels[0].name,\n            'val': arg_2.command.value\n        }\n        return arg_0._qobj_model(**arg_3)", "path": "qiskit/qobj/converters/pulse_instruction.py", "identifier": "PulseQobjConverter.convert_persistent_value", "docstring": "Return converted `PersistentValueInstruction`.\n\n        Args:\n            shift(int): Offset time.\n            instruction (PersistentValueInstruction): persistent value instruction.\n        Returns:\n            dict: Dictionary of required parameters.", "docstring_tokens": ["Return", "converted", "PersistentValueInstruction", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252384}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/magic.py#L612-L617", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Make an entry in the options_table for fn, with value optstr", "language": "python", "parameters": "(self, fn, optstr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "lsmagic", "(", ")", ":", "error", "(", "\"%s is not a magic function\"", "%", "arg_1", ")", "arg_0", ".", "options_table", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Make an entry in the options_table for fn, with value optstr\"\"\"\n\n        if arg_1 not in arg_0.lsmagic():\n            error(\"%s is not a magic function\" % arg_1)\n        arg_0.options_table[arg_1] = arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/magic.py", "identifier": "Magics.default_option", "docstring": "Make an entry in the options_table for fn, with value optstr", "docstring_tokens": ["Make", "an", "entry", "in", "the", "options_table", "for", "fn", "with", "value", "optstr"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252385}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1005-L1013", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Returns a dictionary of satchels used in the current configuration, excluding ourselves.", "language": "python", "parameters": "(self)", "return_statement": "return dict(\n            (name, satchel)\n            for name, satchel in self.all_satchels.items()\n            if name != self.name.upper() and name.lower() in map(str.lower, self.genv.services)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "dict", "(", "(", "arg_1", ",", "arg_2", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "all_satchels", ".", "items", "(", ")", "if", "arg_1", "!=", "arg_0", ".", "name", ".", "upper", "(", ")", "and", "arg_1", ".", "lower", "(", ")", "in", "map", "(", "str", ".", "lower", ",", "arg_0", ".", "genv", ".", "services", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a dictionary of satchels used in the current configuration, excluding ourselves.\n        \"\"\"\n        return dict(\n            (arg_1, arg_2)\n            for arg_1, arg_2 in arg_0.all_satchels.items()\n            if arg_1 != arg_0.name.upper() and arg_1.lower() in map(str.lower, arg_0.genv.services)\n        )", "path": "burlap/common.py", "identifier": "Satchel.all_other_enabled_satchels", "docstring": "Returns a dictionary of satchels used in the current configuration, excluding ourselves.", "docstring_tokens": ["Returns", "a", "dictionary", "of", "satchels", "used", "in", "the", "current", "configuration", "excluding", "ourselves", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 252386}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/events/logging.py#L134-L146", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Callback receives a stream of event_records", "language": "python", "parameters": "(event_record_callback)", "return_statement": "return construct_single_handler_logger(\n        'event-logger',\n        DEBUG,\n        StructuredLoggerHandler(\n            lambda logger_message: event_record_callback(construct_event_record(logger_message))\n        ),\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "check", ".", "callable_param", "(", "arg_0", ",", "'event_record_callback'", ")", "return", "construct_single_handler_logger", "(", "'event-logger'", ",", "DEBUG", ",", "StructuredLoggerHandler", "(", "lambda", "logger_message", ":", "arg_0", "(", "construct_event_record", "(", "logger_message", ")", ")", ")", ",", ")"], "function": "def Func(arg_0):\n    '''\n    Callback receives a stream of event_records\n    '''\n    check.callable_param(arg_0, 'event_record_callback')\n\n    return construct_single_handler_logger(\n        'event-logger',\n        DEBUG,\n        StructuredLoggerHandler(\n            lambda logger_message: arg_0(construct_event_record(logger_message))\n        ),\n    )", "path": "python_modules/dagster/dagster/core/events/logging.py", "identifier": "construct_event_logger", "docstring": "Callback receives a stream of event_records", "docstring_tokens": ["Callback", "receives", "a", "stream", "of", "event_records"], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 252387}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L236-L242", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Edges of the grid cells, origin at centre of 0,0,..,0 grid cell.", "language": "python", "parameters": "(self)", "return_statement": "return [self.delta[d,d] * numpy.arange(self.shape[d]+1) + self.origin[d]\\\n                - 0.5*self.delta[d,d]     for d in range(self.rank)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "arg_0", ".", "delta", "[", "arg_1", ",", "arg_1", "]", "*", "numpy", ".", "arange", "(", "arg_0", ".", "shape", "[", "arg_1", "]", "+", "1", ")", "+", "arg_0", ".", "origin", "[", "arg_1", "]", "-", "0.5", "*", "arg_0", ".", "delta", "[", "arg_1", ",", "arg_1", "]", "for", "arg_1", "in", "range", "(", "arg_0", ".", "rank", ")", "]"], "function": "def Func(arg_0):\n        \"\"\"Edges of the grid cells, origin at centre of 0,0,..,0 grid cell.\n\n        Only works for regular, orthonormal grids.\n        \"\"\"\n        return [arg_0.delta[arg_1,arg_1] * numpy.arange(arg_0.shape[arg_1]+1) + arg_0.origin[arg_1]\\\n                - 0.5*arg_0.delta[arg_1,arg_1]     for arg_1 in range(arg_0.rank)]", "path": "gridData/OpenDX.py", "identifier": "gridpositions.edges", "docstring": "Edges of the grid cells, origin at centre of 0,0,..,0 grid cell.\n\n        Only works for regular, orthonormal grids.", "docstring_tokens": ["Edges", "of", "the", "grid", "cells", "origin", "at", "centre", "of", "0", "0", "..", "0", "grid", "cell", "."], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 252388}
{"url": "https://github.com/sublee/zeronimo/blob/b216638232932718d2cbc5eabd870c8f5b5e83fb/zeronimo/core.py#L268-L314", "sha": "b216638232932718d2cbc5eabd870c8f5b5e83fb", "docstring_summary": "Calls a function and send results to the collector.  It supports\n        all of function actions.  A function could return, yield, raise any\n        packable objects.", "language": "python", "parameters": "(self, socket, call, args, kwargs, topics=())", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "(", ")", ")", ":", "arg_6", "=", "uuid4_bytes", "(", ")", "arg_7", ",", "arg_5", "=", "arg_0", ".", "replier", "(", "arg_1", ",", "arg_5", ",", "arg_2", ".", "reply_to", ")", "if", "arg_7", ":", "arg_8", "=", "(", "arg_2", ".", "call_id", ",", "arg_6", ",", "arg_5", ")", "else", ":", "arg_8", "=", "(", "None", ",", "None", ",", "None", ")", "arg_9", ",", "arg_10", "=", "arg_0", ".", "find_call_target", "(", "arg_2", ")", "if", "arg_10", ".", "reject_if", ".", "__get__", "(", "arg_0", ".", "app", ")", "(", "arg_2", ",", "arg_5", ")", ":", "arg_7", "and", "arg_0", ".", "reject", "(", "arg_7", ",", "arg_2", ".", "call_id", ",", "arg_5", ")", "return", "arg_7", "and", "arg_0", ".", "accept", "(", "arg_7", ",", "arg_8", ")", "arg_11", "=", "False", "with", "arg_0", ".", "catch_exceptions", "(", ")", ":", "try", ":", "arg_12", "=", "arg_0", ".", "call", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_9", ",", "arg_10", ")", "except", ":", "arg_13", "=", "sys", ".", "exc_info", "(", ")", "arg_0", ".", "raise_", "(", "arg_7", ",", "arg_8", ",", "arg_13", ")", "reraise", "(", "*", "arg_13", ")", "arg_11", "=", "True", "if", "not", "arg_11", ":", "return", "if", "isinstance", "(", "arg_12", ",", "Iterator", ")", ":", "arg_14", "=", "arg_12", "with", "arg_0", ".", "catch_exceptions", "(", ")", ":", "try", ":", "try", ":", "arg_12", "=", "next", "(", "arg_14", ")", "except", "StopIteration", ":", "pass", "else", ":", "arg_0", ".", "send_reply", "(", "arg_7", ",", "YIELD", ",", "arg_12", ",", "*", "arg_8", ")", "for", "arg_12", "in", "arg_14", ":", "arg_0", ".", "send_reply", "(", "arg_7", ",", "YIELD", ",", "arg_12", ",", "*", "arg_8", ")", "arg_0", ".", "send_reply", "(", "arg_7", ",", "BREAK", ",", "None", ",", "*", "arg_8", ")", "except", ":", "arg_13", "=", "sys", ".", "exc_info", "(", ")", "arg_0", ".", "raise_", "(", "arg_7", ",", "arg_8", ",", "arg_13", ")", "reraise", "(", "*", "arg_13", ")", "else", ":", "arg_0", ".", "send_reply", "(", "arg_7", ",", "RETURN", ",", "arg_12", ",", "*", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=()):\n        \"\"\"Calls a function and send results to the collector.  It supports\n        all of function actions.  A function could return, yield, raise any\n        packable objects.\n        \"\"\"\n        arg_6 = uuid4_bytes()\n        arg_7, arg_5 = arg_0.replier(arg_1, arg_5, arg_2.reply_to)\n        if arg_7:\n            arg_8 = (arg_2.call_id, arg_6, arg_5)\n        else:\n            arg_8 = (None, None, None)\n        arg_9, arg_10 = arg_0.find_call_target(arg_2)\n        if arg_10.reject_if.__get__(arg_0.app)(arg_2, arg_5):\n            arg_7 and arg_0.reject(arg_7, arg_2.call_id, arg_5)\n            return\n        arg_7 and arg_0.accept(arg_7, arg_8)\n        arg_11 = False\n        with arg_0.catch_exceptions():\n            try:\n                arg_12 = arg_0.call(arg_2, arg_3, arg_4, arg_9, arg_10)\n            except:\n                arg_13 = sys.exc_info()\n                arg_0.raise_(arg_7, arg_8, arg_13)\n                reraise(*arg_13)\n            arg_11 = True\n        if not arg_11:\n            # catch_exceptions() hides exceptions.\n            return\n        if isinstance(arg_12, Iterator):\n            arg_14 = arg_12\n            with arg_0.catch_exceptions():\n                try:\n                    try:\n                        arg_12 = next(arg_14)\n                    except StopIteration:\n                        pass\n                    else:\n                        arg_0.send_reply(arg_7, YIELD, arg_12, *arg_8)\n                        for arg_12 in arg_14:\n                            arg_0.send_reply(arg_7, YIELD, arg_12, *arg_8)\n                    arg_0.send_reply(arg_7, BREAK, None, *arg_8)\n                except:\n                    arg_13 = sys.exc_info()\n                    arg_0.raise_(arg_7, arg_8, arg_13)\n                    reraise(*arg_13)\n        else:\n            arg_0.send_reply(arg_7, RETURN, arg_12, *arg_8)", "path": "zeronimo/core.py", "identifier": "Worker.work", "docstring": "Calls a function and send results to the collector.  It supports\n        all of function actions.  A function could return, yield, raise any\n        packable objects.", "docstring_tokens": ["Calls", "a", "function", "and", "send", "results", "to", "the", "collector", ".", "It", "supports", "all", "of", "function", "actions", ".", "A", "function", "could", "return", "yield", "raise", "any", "packable", "objects", "."], "nwo": "sublee/zeronimo", "score": 0.08529914490135834, "idx": 252389}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/video.py#L130-L146", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Create a thumbnail image for the video source, based on ffmpeg.", "language": "python", "parameters": "(source, outname, box, delay, fit=True, options=None,\n                       converter='ffmpeg')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'ffmpeg'", ")", ":", "arg_7", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_8", "=", "arg_1", "+", "\".tmp.jpg\"", "arg_9", "=", "[", "arg_6", ",", "'-i'", ",", "arg_0", ",", "'-an'", ",", "'-r'", ",", "'1'", ",", "'-ss'", ",", "arg_3", ",", "'-vframes'", ",", "'1'", ",", "'-y'", ",", "arg_8", "]", "arg_7", ".", "debug", "(", "'Create thumbnail for video: %s'", ",", "' '", ".", "join", "(", "arg_9", ")", ")", "check_subprocess", "(", "arg_9", ",", "arg_0", ",", "arg_1", ")", "image", ".", "Func", "(", "arg_8", ",", "arg_1", ",", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "os", ".", "unlink", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=True, arg_5=None,\n                       arg_6='ffmpeg'):\n    \"\"\"Create a thumbnail image for the video source, based on ffmpeg.\"\"\"\n\n    arg_7 = logging.getLogger(__name__)\n    arg_8 = arg_1 + \".tmp.jpg\"\n\n    # dump an image of the video\n    arg_9 = [arg_6, '-i', arg_0, '-an', '-r', '1',\n           '-ss', arg_3, '-vframes', '1', '-y', arg_8]\n    arg_7.debug('Create thumbnail for video: %s', ' '.join(arg_9))\n    check_subprocess(arg_9, arg_0, arg_1)\n\n    # use the Func function from sigal.image\n    image.Func(arg_8, arg_1, arg_2, arg_4=arg_4, arg_5=arg_5)\n    # remove the image\n    os.unlink(arg_8)", "path": "sigal/video.py", "identifier": "generate_thumbnail", "docstring": "Create a thumbnail image for the video source, based on ffmpeg.", "docstring_tokens": ["Create", "a", "thumbnail", "image", "for", "the", "video", "source", "based", "on", "ffmpeg", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 252390}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1264-L1322", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "r\"\"\"FullName after removing the local path to the repository.", "language": "python", "parameters": "(self)", "return_statement": "return fullname", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "FullName", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "if", "_repository", ":", "arg_3", "=", "FileInfo", "(", "_repository", ")", ".", "FullName", "(", ")", "arg_4", "=", "arg_2", "while", "os", ".", "path", ".", "exists", "(", "arg_4", ")", ":", "if", "os", ".", "path", ".", "normcase", "(", "arg_4", ")", "==", "os", ".", "path", ".", "normcase", "(", "arg_3", ")", ":", "return", "os", ".", "path", ".", "relpath", "(", "arg_1", ",", "arg_4", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", "arg_5", "=", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", "if", "arg_5", "==", "arg_4", ":", "break", "arg_4", "=", "arg_5", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "\".svn\"", ")", ")", ":", "arg_4", "=", "arg_2", "arg_5", "=", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", "while", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_5", ",", "\".svn\"", ")", ")", ":", "arg_4", "=", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", "arg_5", "=", "os", ".", "path", ".", "dirname", "(", "arg_5", ")", "arg_6", "=", "os", ".", "path", ".", "commonprefix", "(", "[", "arg_4", ",", "arg_2", "]", ")", "return", "arg_1", "[", "len", "(", "arg_6", ")", "+", "1", ":", "]", "arg_4", "=", "arg_7", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "while", "arg_7", "!=", "os", ".", "path", ".", "dirname", "(", "arg_7", ")", ":", "if", "(", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_7", ",", "\".git\"", ")", ")", "or", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_7", ",", "\".hg\"", ")", ")", "or", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_7", ",", "\".svn\"", ")", ")", ")", ":", "arg_4", "=", "arg_7", "arg_7", "=", "os", ".", "path", ".", "dirname", "(", "arg_7", ")", "if", "(", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "\".git\"", ")", ")", "or", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "\".hg\"", ")", ")", "or", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "\".svn\"", ")", ")", ")", ":", "arg_6", "=", "os", ".", "path", ".", "commonprefix", "(", "[", "arg_4", ",", "arg_2", "]", ")", "return", "arg_1", "[", "len", "(", "arg_6", ")", "+", "1", ":", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    r\"\"\"FullName after removing the local path to the repository.\n\n    If we have a real absolute path name here we can try to do something smart:\n    detecting the root of the checkout and truncating /path/to/checkout from\n    the name so that we get header guards that don't include things like\n    \"C:\\Documents and Settings\\...\" or \"/home/username/...\" in them and thus\n    people on different computers who have checked the source out to different\n    locations won't see bogus errors.\n    \"\"\"\n    arg_1 = arg_0.FullName()\n\n    if os.path.exists(arg_1):\n      arg_2 = os.path.dirname(arg_1)\n\n      # If the user specified a repository path, it exists, and the file is\n      # contained in it, use the specified repository path\n      if _repository:\n        arg_3 = FileInfo(_repository).FullName()\n        arg_4 = arg_2\n        while os.path.exists(arg_4):\n          # allow case insensitive compare on Windows\n          if os.path.normcase(arg_4) == os.path.normcase(arg_3):\n            return os.path.relpath(arg_1, arg_4).replace('\\\\', '/')\n          arg_5 = os.path.dirname(arg_4)\n          if arg_5 == arg_4:\n            break\n          arg_4 = arg_5\n\n      if os.path.exists(os.path.join(arg_2, \".svn\")):\n        # If there's a .svn file in the current directory, we recursively look\n        # up the directory tree for the top of the SVN checkout\n        arg_4 = arg_2\n        arg_5 = os.path.dirname(arg_4)\n        while os.path.exists(os.path.join(arg_5, \".svn\")):\n          arg_4 = os.path.dirname(arg_4)\n          arg_5 = os.path.dirname(arg_5)\n\n        arg_6 = os.path.commonprefix([arg_4, arg_2])\n        return arg_1[len(arg_6) + 1:]\n\n      # Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by\n      # searching up from the current path.\n      arg_4 = arg_7 = os.path.dirname(arg_1)\n      while arg_7 != os.path.dirname(arg_7):\n        if (os.path.exists(os.path.join(arg_7, \".git\")) or\n            os.path.exists(os.path.join(arg_7, \".hg\")) or\n            os.path.exists(os.path.join(arg_7, \".svn\"))):\n          arg_4 = arg_7\n        arg_7 = os.path.dirname(arg_7)\n\n      if (os.path.exists(os.path.join(arg_4, \".git\")) or\n          os.path.exists(os.path.join(arg_4, \".hg\")) or\n          os.path.exists(os.path.join(arg_4, \".svn\"))):\n        arg_6 = os.path.commonprefix([arg_4, arg_2])\n        return arg_1[len(arg_6) + 1:]\n\n    # Don't know what to do; header guard warnings may be wrong...\n    return arg_1", "path": "third_party/python/cpplint/cpplint.py", "identifier": "FileInfo.RepositoryName", "docstring": "r\"\"\"FullName after removing the local path to the repository.\n\n    If we have a real absolute path name here we can try to do something smart:\n    detecting the root of the checkout and truncating /path/to/checkout from\n    the name so that we get header guards that don't include things like\n    \"C:\\Documents and Settings\\...\" or \"/home/username/...\" in them and thus\n    people on different computers who have checked the source out to different\n    locations won't see bogus errors.", "docstring_tokens": ["r", "FullName", "after", "removing", "the", "local", "path", "to", "the", "repository", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252391}
{"url": "https://github.com/zloidemon/aiohttp_jrpc/blob/f2ced214844041aa6f18b6bf6e5abeef7b47735e/aiohttp_jrpc/__init__.py#L87-L100", "sha": "f2ced214844041aa6f18b6bf6e5abeef7b47735e", "docstring_summary": "Validation data by specific validictory configuration", "language": "python", "parameters": "(schema=None)", "return_statement": "return dec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "def", "dec", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "d_func", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "try", ":", "Funcate", "(", "arg_4", "[", "'params'", "]", ",", "arg_0", ")", "except", "ValidationError", "as", "err", ":", "raise", "InFuncParams", "(", "err", ")", "except", "SchemaError", "as", "err", ":", "raise", "InternalError", "(", "err", ")", "return", "arg_1", "(", "arg_2", ",", "arg_3", ",", "arg_4", "[", "'params'", "]", ",", "*", "arg_5", ",", "**", "arg_6", ")", "return", "d_func", "return", "dec"], "function": "def Func(arg_0=None):\n        \"\"\" Validation data by specific Funcictory configuration \"\"\"\n        def dec(arg_1):\n            @wraps(arg_1)\n            def d_func(arg_2, arg_3, arg_4, *arg_5, **arg_6):\n                try:\n                    Funcate(arg_4['params'], arg_0)\n                except ValidationError as err:\n                    raise InFuncParams(err)\n                except SchemaError as err:\n                    raise InternalError(err)\n                return arg_1(arg_2, arg_3, arg_4['params'], *arg_5, **arg_6)\n            return d_func\n        return dec", "path": "aiohttp_jrpc/__init__.py", "identifier": "Service.valid", "docstring": "Validation data by specific validictory configuration", "docstring_tokens": ["Validation", "data", "by", "specific", "validictory", "configuration"], "nwo": "zloidemon/aiohttp_jrpc", "score": 0.18958683376450164, "idx": 252392}
{"url": "https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/config.py#L73-L91", "sha": "8e17ebec509be5c3cc2063f4645dfe9e26b49c18", "docstring_summary": "Called at the start of notebook execution to setup the environment.", "language": "python", "parameters": "(debug=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ")", ":", "output_notebook", "(", "INLINE", ",", "hide_banner", "=", "True", ")", "if", "arg_0", ":", "_setup_logging", "(", "logging", ".", "DEBUG", ")", "logging", ".", "debug", "(", "'Running notebook in debug mode.'", ")", "else", ":", "_setup_logging", "(", "logging", ".", "WARNING", ")", "if", "'JUPYTERHUB_SERVICE_PREFIX'", "not", "in", "os", ".", "environ", ":", "global", "arg_1", "arg_1", "=", "'localhost:8888'", "logging", ".", "info", "(", "'Setting jupyter proxy to local mode.'", ")"], "function": "def Func(arg_0=False):\n    \"\"\"Called at the start of notebook execution to setup the environment.\n\n    This will configure bokeh, and setup the logging library to be\n    reasonable.\"\"\"\n    output_notebook(INLINE, hide_banner=True)\n    if arg_0:\n        _setup_logging(logging.DEBUG)\n        logging.debug('Running notebook in debug mode.')\n    else:\n        _setup_logging(logging.WARNING)\n\n    # If JUPYTERHUB_SERVICE_PREFIX environment variable isn't set,\n    # this means that you're running JupyterHub not with Hub in k8s,\n    # and not using run_local.sh (which sets it to empty).\n    if 'JUPYTERHUB_SERVICE_PREFIX' not in os.environ:\n        global arg_1\n        arg_1 = 'localhost:8888'\n        logging.info('Setting jupyter proxy to local mode.')", "path": "astropixie-widgets/astropixie_widgets/config.py", "identifier": "setup_notebook", "docstring": "Called at the start of notebook execution to setup the environment.\n\n    This will configure bokeh, and setup the logging library to be\n    reasonable.", "docstring_tokens": ["Called", "at", "the", "start", "of", "notebook", "execution", "to", "setup", "the", "environment", "."], "nwo": "lsst-epo/vela", "score": 0.15726537023232431, "idx": 252393}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L249-L280", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "returns complement of sequence including ambiguity characters,\n    and saves lower case info for multiple hetero sequences", "language": "python", "parameters": "(seq)", "return_statement": "return seq", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "\"A\"", ",", "'u'", ")", ".", "replace", "(", "'T'", ",", "'v'", ")", ".", "replace", "(", "'C'", ",", "'p'", ")", ".", "replace", "(", "'G'", ",", "'z'", ")", ".", "replace", "(", "'u'", ",", "'T'", ")", ".", "replace", "(", "'v'", ",", "'A'", ")", ".", "replace", "(", "'p'", ",", "'G'", ")", ".", "replace", "(", "'z'", ",", "'C'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "'R'", ",", "'u'", ")", ".", "replace", "(", "'K'", ",", "'v'", ")", ".", "replace", "(", "'Y'", ",", "'b'", ")", ".", "replace", "(", "'M'", ",", "'o'", ")", ".", "replace", "(", "'u'", ",", "'Y'", ")", ".", "replace", "(", "'v'", ",", "'M'", ")", ".", "replace", "(", "'b'", ",", "'R'", ")", ".", "replace", "(", "'o'", ",", "'K'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "'r'", ",", "'u'", ")", ".", "replace", "(", "'k'", ",", "'v'", ")", ".", "replace", "(", "'y'", ",", "'b'", ")", ".", "replace", "(", "'m'", ",", "'o'", ")", ".", "replace", "(", "'u'", ",", "'y'", ")", ".", "replace", "(", "'v'", ",", "'m'", ")", ".", "replace", "(", "'b'", ",", "'r'", ")", ".", "replace", "(", "'o'", ",", "'k'", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\" returns complement of sequence including ambiguity characters,\n    and saves lower case info for multiple hetero sequences\"\"\"\n    ## this is surely not the most efficient...\n    arg_0 = arg_0.replace(\"A\", 'u')\\\n             .replace('T', 'v')\\\n             .replace('C', 'p')\\\n             .replace('G', 'z')\\\n             .replace('u', 'T')\\\n             .replace('v', 'A')\\\n             .replace('p', 'G')\\\n             .replace('z', 'C')\n\n    ## No complement for S & W b/c complements are S & W, respectively\n    arg_0 = arg_0.replace('R', 'u')\\\n             .replace('K', 'v')\\\n             .replace('Y', 'b')\\\n             .replace('M', 'o')\\\n             .replace('u', 'Y')\\\n             .replace('v', 'M')\\\n             .replace('b', 'R')\\\n             .replace('o', 'K')\n\n    arg_0 = arg_0.replace('r', 'u')\\\n             .replace('k', 'v')\\\n             .replace('y', 'b')\\\n             .replace('m', 'o')\\\n             .replace('u', 'y')\\\n             .replace('v', 'm')\\\n             .replace('b', 'r')\\\n             .replace('o', 'k')\n    return arg_0", "path": "ipyrad/assemble/util.py", "identifier": "fullcomp", "docstring": "returns complement of sequence including ambiguity characters,\n    and saves lower case info for multiple hetero sequences", "docstring_tokens": ["returns", "complement", "of", "sequence", "including", "ambiguity", "characters", "and", "saves", "lower", "case", "info", "for", "multiple", "hetero", "sequences"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 252394}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/types/hdlType.py#L35-L51", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Cast value or signal of this type to another compatible type.", "language": "python", "parameters": "(self, sigOrVal, toType)", "return_statement": "return c(self, sigOrVal, toType)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ".", "_dtype", "==", "arg_2", ":", "return", "arg_1", "try", ":", "arg_3", "=", "arg_0", ".", "_Func_fn", "except", "AttributeError", ":", "arg_3", "=", "arg_0", ".", "get_Func_fn", "(", ")", "arg_0", ".", "_Func_fn", "=", "arg_3", "return", "arg_3", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Cast value or signal of this type to another compatible type.\n\n        :param sigOrVal: instance of signal or value to cast\n        :param toType: instance of HdlType to cast into\n        \"\"\"\n        if arg_1._dtype == arg_2:\n            return arg_1\n\n        try:\n            arg_3 = arg_0._Func_fn\n        except AttributeError:\n            arg_3 = arg_0.get_Func_fn()\n            arg_0._Func_fn = arg_3\n\n        return arg_3(arg_0, arg_1, arg_2)", "path": "hwt/hdl/types/hdlType.py", "identifier": "HdlType.auto_cast", "docstring": "Cast value or signal of this type to another compatible type.\n\n        :param sigOrVal: instance of signal or value to cast\n        :param toType: instance of HdlType to cast into", "docstring_tokens": ["Cast", "value", "or", "signal", "of", "this", "type", "to", "another", "compatible", "type", "."], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252395}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/apy/worker.py#L117-L135", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "Stop and remove a worker", "language": "python", "parameters": "(self, worker_id)", "return_statement": "return flask.jsonify(report), code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "200", "if", "arg_1", "in", "arg_0", ".", "jobs", ":", "arg_0", ".", "jobs", "[", "arg_1", "]", "[", "'worker'", "]", ".", "revoke", "(", "terminate", "=", "True", ")", "arg_3", "=", "{", "'id'", ":", "arg_1", ",", "'revoked'", ":", "True", "}", "arg_0", ".", "jobs", ".", "pop", "(", "arg_1", ")", "else", ":", "arg_3", "=", "{", "'error'", ":", "'job {} unknown'", ".", "format", "(", "arg_1", ")", "}", "arg_2", "=", "404", "return", "flask", ".", "jsonify", "(", "arg_3", ")", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n        ''' Stop and remove a worker '''\n        arg_2 = 200\n\n        if arg_1 in arg_0.jobs:\n            # NOTE pop it if done ?\n            arg_0.jobs[arg_1]['worker'].revoke(terminate=True)\n            arg_3 = {\n                'id': arg_1,\n                'revoked': True\n                # FIXME Unable to serialize self.jobs[worker_id]\n                # 'session': self.jobs.pop(worker_id)\n            }\n            arg_0.jobs.pop(arg_1)\n        else:\n            arg_3 = {'error': 'job {} unknown'.format(arg_1)}\n            arg_2 = 404\n\n        return flask.jsonify(arg_3), arg_2", "path": "python/dna/apy/worker.py", "identifier": "RestfulWorker.delete", "docstring": "Stop and remove a worker", "docstring_tokens": ["Stop", "and", "remove", "a", "worker"], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 252396}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L270-L275", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns all items that match the given criteria and appear\n        before this Tag in the document.", "language": "python", "parameters": "(self, name=None, attrs={}, text=None, limit=None,\n                        **kwargs)", "return_statement": "return self._findAll(name, attrs, text, limit, self.previousGenerator,\n                           **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "return", "arg_0", ".", "_findAll", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_0", ".", "previousGenerator", ",", "**", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None, arg_2={}, arg_3=None, arg_4=None,\n                        **arg_5):\n        \"\"\"Returns all items that match the given criteria and appear\n        before this Tag in the document.\"\"\"\n        return arg_0._findAll(arg_1, arg_2, arg_3, arg_4, arg_0.previousGenerator,\n                           **arg_5)", "path": "lib/web/BeautifulSoup.py", "identifier": "PageElement.findAllPrevious", "docstring": "Returns all items that match the given criteria and appear\n        before this Tag in the document.", "docstring_tokens": ["Returns", "all", "items", "that", "match", "the", "given", "criteria", "and", "appear", "before", "this", "Tag", "in", "the", "document", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252397}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/movies.py#L185-L200", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the release date and certification information by country for a\n        specific movie id.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the release date and certification information by country for a\n        specific movie id.\n\n        Args:\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/movies.py", "identifier": "Movies.releases", "docstring": "Get the release date and certification information by country for a\n        specific movie id.\n\n        Args:\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "release", "date", "and", "certification", "information", "by", "country", "for", "a", "specific", "movie", "id", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 252398}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/bacon/font.py#L219-L228", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "Calculates the width of the given string in this font.", "language": "python", "parameters": "(self, str)", "return_statement": "return glyph_layout.content_width", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "bacon", ".", "text", ".", "Style", "(", "arg_0", ")", "arg_3", "=", "bacon", ".", "text", ".", "GlyphRun", "(", "arg_2", ",", "arg_1", ")", "arg_4", "=", "bacon", ".", "text", ".", "GlyphLayout", "(", "[", "arg_3", "]", ",", "0", ",", "0", ")", "return", "arg_4", ".", "content_width"], "function": "def Func(arg_0, arg_1):\n        '''Calculates the width of the given string in this font.\n\n        :param str: the string to measure\n        :return float: width of the string, in pixels\n        '''\n        arg_2 = bacon.text.Style(arg_0)\n        arg_3 = bacon.text.GlyphRun(arg_2, arg_1)\n        arg_4 = bacon.text.GlyphLayout([arg_3], 0, 0)\n        return arg_4.content_width", "path": "bacon/font.py", "identifier": "Font.measure_string", "docstring": "Calculates the width of the given string in this font.\n\n        :param str: the string to measure\n        :return float: width of the string, in pixels", "docstring_tokens": ["Calculates", "the", "width", "of", "the", "given", "string", "in", "this", "font", "."], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 252399}
{"url": "https://github.com/nicfit/nicfit.py/blob/8313f8edbc5e7361ddad496d6d818324b5236c7a/nicfit/util.py#L16-L25", "sha": "8313f8edbc5e7361ddad496d6d818324b5236c7a", "docstring_summary": "Context manager that changes to directory `path` and return to CWD\n    when exited.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "arg_0", ")", "try", ":", "yield", "finally", ":", "os", ".", "chdir", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Context manager that changes to directory `path` and return to CWD\n    when exited.\n    \"\"\"\n    arg_1 = os.getcwd()\n    os.chdir(arg_0)\n    try:\n        yield\n    finally:\n        os.chdir(arg_1)", "path": "nicfit/util.py", "identifier": "cd", "docstring": "Context manager that changes to directory `path` and return to CWD\n    when exited.", "docstring_tokens": ["Context", "manager", "that", "changes", "to", "directory", "path", "and", "return", "to", "CWD", "when", "exited", "."], "nwo": "nicfit/nicfit.py", "score": 0.09252797783733271, "idx": 252400}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/compatibility.py#L136-L141", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Equivalent of csv.DictWriter, but allows `delimiter` to be a unicode string on Py2.", "language": "python", "parameters": "(f, fieldnames, **kwargs)", "return_statement": "return csv.DictWriter(f, fieldnames, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "import", "csv", "if", "\"delimiter\"", "in", "arg_2", ":", "arg_2", "[", "\"delimiter\"", "]", "=", "str", "(", "arg_2", "[", "\"delimiter\"", "]", ")", "return", "csv", ".", "DictWriter", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Equivalent of csv.DictWriter, but allows `delimiter` to be a unicode string on Py2.\"\"\"\n    import csv\n    if \"delimiter\" in arg_2:\n        arg_2[\"delimiter\"] = str(arg_2[\"delimiter\"])\n    return csv.DictWriter(arg_0, arg_1, **arg_2)", "path": "h2o-py/h2o/utils/compatibility.py", "identifier": "csv_dict_writer", "docstring": "Equivalent of csv.DictWriter, but allows `delimiter` to be a unicode string on Py2.", "docstring_tokens": ["Equivalent", "of", "csv", ".", "DictWriter", "but", "allows", "delimiter", "to", "be", "a", "unicode", "string", "on", "Py2", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252401}
{"url": "https://github.com/Crypto-toolbox/btfxwss/blob/16827fa6aacb2c0e289aa852bf61a18df6905835/btfxwss/client.py#L188-L196", "sha": "16827fa6aacb2c0e289aa852bf61a18df6905835", "docstring_summary": "Subscribe to the passed pair's ticker channel.", "language": "python", "parameters": "(self, pair, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "(", "'ticker'", ",", "arg_1", ")", "arg_0", ".", "_subscribe", "(", "'ticker'", ",", "arg_3", ",", "symbol", "=", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Subscribe to the passed pair's ticker channel.\n\n        :param pair: str, Symbol pair to request data for\n        :param kwargs:\n        :return:\n        \"\"\"\n        arg_3 = ('ticker', arg_1)\n        arg_0._subscribe('ticker', arg_3, symbol=arg_1, **arg_2)", "path": "btfxwss/client.py", "identifier": "BtfxWss.subscribe_to_ticker", "docstring": "Subscribe to the passed pair's ticker channel.\n\n        :param pair: str, Symbol pair to request data for\n        :param kwargs:\n        :return:", "docstring_tokens": ["Subscribe", "to", "the", "passed", "pair", "s", "ticker", "channel", "."], "nwo": "Crypto-toolbox/btfxwss", "score": 0.6139886433376424, "idx": 252402}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/Supplement/comparison_tools/helpers.py#L18-L57", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Fetch LAtools reference data from online repository.", "language": "python", "parameters": "(name=None)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "'https://docs.google.com/spreadsheets/d/e/2PACX-1vQJfCeuqrtFFMAeSpA9rguzLAo9OVuw50AHhAULuqjMJzbd3h46PK1KjF69YiJAeNAAjjMDkJK7wMpG/pub?gid={:}&single=true&output=csv'", "arg_2", "=", "{", "'culture_reference'", ":", "'0'", ",", "'culture_test'", ":", "'1170065442'", ",", "'downcore_reference'", ":", "'190752797'", ",", "'downcore_test'", ":", "'721359794'", ",", "'iolite_reference'", ":", "'483581945'", ",", "'zircon_reference'", ":", "'1355554964'", "}", "if", "arg_0", "is", "None", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "items", "(", ")", ":", "arg_6", "=", "arg_1", ".", "format", "(", "arg_5", ")", "arg_7", "=", "pd", ".", "read_csv", "(", "arg_6", ",", "header", "=", "[", "0", "]", ",", "index_col", "=", "[", "0", ",", "1", "]", ")", "arg_7", ".", "index", ".", "names", "=", "[", "'sample'", ",", "'rep'", "]", "arg_7", ".", "columns", ".", "names", "=", "[", "'analyte'", "]", "arg_7", ".", "sort_index", "(", "1", ",", "inplace", "=", "True", ")", "arg_3", "[", "arg_4", "]", "=", "arg_7", "else", ":", "arg_5", "=", "arg_2", "[", "arg_0", "]", "arg_6", "=", "arg_1", ".", "format", "(", "arg_5", ")", "arg_3", "=", "pd", ".", "read_csv", "(", "arg_6", ",", "index_col", "=", "[", "0", ",", "1", "]", ")", "arg_3", ".", "columns", ".", "names", "=", "[", "'analyte'", "]", "arg_3", ".", "sort_index", "(", "1", ",", "inplace", "=", "True", ")", "return", "arg_3"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Fetch LAtools reference data from online repository.\n\n    Parameters\n    ----------\n    name : str<\n        Which data to download. Can be one of 'culture_reference',\n        'culture_test', 'downcore_reference', 'downcore_test', 'iolite_reference'\n        or 'zircon_reference'.\n        If None, all are downloaded and returned as a dict.\n\n    Returns\n    -------\n    pandas.DataFrame or dict.\n    \"\"\"\n    arg_1 = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQJfCeuqrtFFMAeSpA9rguzLAo9OVuw50AHhAULuqjMJzbd3h46PK1KjF69YiJAeNAAjjMDkJK7wMpG/pub?gid={:}&single=true&output=csv'\n    arg_2 = {'culture_reference': '0',\n            'culture_test': '1170065442',\n            'downcore_reference': '190752797',\n            'downcore_test': '721359794',\n            'iolite_reference': '483581945',\n            'zircon_reference': '1355554964'}\n\n    if arg_0 is None:\n        arg_3 = {}\n        for arg_4, arg_5 in arg_2.items():\n            arg_6 = arg_1.format(arg_5)\n            arg_7 = pd.read_csv(arg_6, header=[0], index_col=[0, 1])\n            arg_7.index.names = ['sample', 'rep']\n            arg_7.columns.names = ['analyte']\n            arg_7.sort_index(1, inplace=True)\n            arg_3[arg_4] = arg_7\n    else:\n        arg_5 = arg_2[arg_0]\n        arg_6 = arg_1.format(arg_5)\n        arg_3 = pd.read_csv(arg_6, index_col=[0, 1])\n        arg_3.columns.names = ['analyte']\n        arg_3.sort_index(1, inplace=True)\n    return arg_3", "path": "Supplement/comparison_tools/helpers.py", "identifier": "load_reference_data", "docstring": "Fetch LAtools reference data from online repository.\n\n    Parameters\n    ----------\n    name : str<\n        Which data to download. Can be one of 'culture_reference',\n        'culture_test', 'downcore_reference', 'downcore_test', 'iolite_reference'\n        or 'zircon_reference'.\n        If None, all are downloaded and returned as a dict.\n\n    Returns\n    -------\n    pandas.DataFrame or dict.", "docstring_tokens": ["Fetch", "LAtools", "reference", "data", "from", "online", "repository", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 252403}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/blocks.py#L145-L165", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Returns the atom object corresponding to an atom number", "language": "python", "parameters": "(self, anumb)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "int", ")", ",", "\"anumb must be integer\"", "if", "not", "arg_0", ".", "_Func", ":", "if", "arg_0", ".", "atoms", ":", "for", "arg_2", "in", "arg_0", ".", "atoms", ":", "arg_0", ".", "_Func", "[", "arg_2", ".", "number", "]", "=", "arg_2", "return", "arg_0", ".", "_Func", "[", "arg_1", "]", "else", ":", "arg_0", ".", "logger", "(", "\"no atoms in the molecule\"", ")", "return", "False", "else", ":", "if", "arg_1", "in", "arg_0", ".", "_Func", ":", "return", "arg_0", ".", "_Func", "[", "arg_1", "]", "else", ":", "arg_0", ".", "logger", "(", "\"no such atom number ({0:d}) in the molecule\"", ".", "format", "(", "arg_1", ")", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n        '''Returns the atom object corresponding to an atom number'''\n\n        assert isinstance(arg_1, int), \"anumb must be integer\"\n\n        if not arg_0._Func:   # empty dictionary\n\n            if arg_0.atoms:\n                for arg_2 in arg_0.atoms:\n                    arg_0._Func[arg_2.number] = arg_2\n                return arg_0._Func[arg_1]\n            else:\n                arg_0.logger(\"no atoms in the molecule\")\n                return False\n\n        else:\n            if arg_1 in arg_0._Func:\n                return arg_0._Func[arg_1]\n            else:\n                arg_0.logger(\"no such atom number ({0:d}) in the molecule\".format(arg_1))\n                return False", "path": "gromacs/fileformats/blocks.py", "identifier": "Molecule.anumb_to_atom", "docstring": "Returns the atom object corresponding to an atom number", "docstring_tokens": ["Returns", "the", "atom", "object", "corresponding", "to", "an", "atom", "number"], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 252404}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/py2/ec2_cmd.py#L232-L245", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Wait for ssh service to appear on given hosts", "language": "python", "parameters": "(ips, port=22, skipAlive=True, requiredsuccess=3)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "22", ",", "arg_2", "=", "True", ",", "arg_3", "=", "3", ")", ":", "log", "(", "'Waiting for SSH on following hosts: {0}'", ".", "format", "(", "arg_0", ")", ")", "for", "arg_4", "in", "arg_0", ":", "if", "not", "arg_2", "or", "not", "ssh_live", "(", "arg_4", ",", "arg_1", ")", ":", "log", "(", "'Waiting for SSH on instance {0}...'", ".", "format", "(", "arg_4", ")", ")", "arg_5", "=", "0", "while", "arg_5", "<", "arg_3", ":", "if", "ssh_live", "(", "arg_4", ",", "arg_1", ")", ":", "arg_5", "+=", "1", "else", ":", "arg_5", "=", "0", "time", ".", "sleep", "(", "1", ")", "h2o_cmd", ".", "dot", "(", ")"], "function": "def Func(arg_0, arg_1=22, arg_2=True, arg_3=3):\n    ''' Wait for ssh service to appear on given hosts'''\n    log('Waiting for SSH on following hosts: {0}'.format(arg_0))\n    for arg_4 in arg_0:\n        if not arg_2 or not ssh_live(arg_4, arg_1): \n            log('Waiting for SSH on instance {0}...'.format(arg_4))\n            arg_5 = 0\n            while arg_5 < arg_3:\n                if ssh_live(arg_4, arg_1):\n                    arg_5 += 1\n                else:\n                    arg_5 = 0\n                time.sleep(1)\n                h2o_cmd.dot()", "path": "py2/ec2_cmd.py", "identifier": "wait_for_ssh", "docstring": "Wait for ssh service to appear on given hosts", "docstring_tokens": ["Wait", "for", "ssh", "service", "to", "appear", "on", "given", "hosts"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252405}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/libplanarradpy/planrad.py#L467-L476", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "Generic iop file writer", "language": "python", "parameters": "(self, iop, file_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "lg", ".", "info", "(", "'Writing :: '", "+", "arg_2", ")", "arg_3", "=", "open", "(", "arg_2", ",", "'w'", ")", "for", "arg_4", "in", "scipy", ".", "nditer", "(", "arg_1", ")", ":", "arg_3", ".", "write", "(", "str", "(", "arg_4", ")", "+", "'\\n'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Generic iop file writer\n\n        :param iop numpy array to write to file\n        :param file_name the file and path to write the IOP to\n        \"\"\"\n        lg.info('Writing :: ' + arg_2)\n        arg_3 = open(arg_2, 'w')\n        for arg_4 in scipy.nditer(arg_1):\n            arg_3.write(str(arg_4) + '\\n')", "path": "libplanarradpy/planrad.py", "identifier": "BioOpticalParameters._write_iop_to_file", "docstring": "Generic iop file writer\n\n        :param iop numpy array to write to file\n        :param file_name the file and path to write the IOP to", "docstring_tokens": ["Generic", "iop", "file", "writer"], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 252406}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_lingpipe.py#L158-L232", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Tokenize all the words and preserve NER labels from ENAMEX tags", "language": "python", "parameters": "(self, sentence_dom)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "sent_pos", "=", "0", "arg_3", "=", "0", "while", "len", "(", "arg_1", ".", "childNodes", ")", ">", "0", ":", "arg_4", "=", "arg_1", ".", "childNodes", ".", "pop", "(", "0", ")", "if", "arg_4", ".", "nodeType", "==", "arg_4", ".", "TEXT_NODE", ":", "for", "arg_5", "in", "arg_4", ".", "data", ".", "splitlines", "(", "True", ")", ":", "arg_0", ".", "_input_string", "=", "arg_5", "for", "arg_7", ",", "arg_8", "in", "arg_0", ".", "word_tokenizer", ".", "span_tokenize", "(", "arg_5", ")", ":", "arg_9", "=", "arg_0", ".", "_make_token", "(", "arg_7", ",", "arg_8", ")", "if", "arg_9", ":", "yield", "arg_9", "if", "arg_5", ".", "endswith", "(", "'\\n'", ")", ":", "arg_0", ".", "line_idx", "+=", "1", "arg_0", ".", "byte_idx", "+=", "len", "(", "arg_5", ".", "encode", "(", "'utf-8'", ")", ")", "else", ":", "assert", "arg_4", ".", "nodeName", "==", "'ENAMEX'", ",", "arg_4", ".", "nodeName", "arg_10", "=", "arg_4", ".", "attributes", ".", "get", "(", "'ID'", ")", ".", "value", "arg_11", "=", "arg_4", ".", "attributes", ".", "get", "(", "'TYPE'", ")", ".", "value", "for", "arg_4", "in", "arg_4", ".", "childNodes", ":", "assert", "arg_4", ".", "nodeType", "==", "arg_4", ".", "TEXT_NODE", ",", "arg_4", ".", "nodeType", "for", "arg_5", "in", "arg_4", ".", "data", ".", "splitlines", "(", "True", ")", ":", "arg_0", ".", "_input_string", "=", "arg_5", "for", "arg_7", ",", "arg_8", "in", "arg_0", ".", "word_tokenizer", ".", "span_tokenize", "(", "arg_5", ")", ":", "arg_9", "=", "arg_0", ".", "_make_token", "(", "arg_7", ",", "arg_8", ")", "if", "arg_9", ":", "if", "arg_11", "in", "_PRONOUNS", ":", "arg_9", ".", "mention_type", "=", "MentionType", ".", "PRO", "arg_9", ".", "entity_type", "=", "_ENTITY_TYPES", "[", "arg_11", "]", "arg_13", "=", "Attribute", "(", "attribute_type", "=", "AttributeType", ".", "PER_GENDER", ",", "value", "=", "str", "(", "_PRONOUNS", "[", "arg_11", "]", ")", ")", "arg_0", ".", "attributes", ".", "append", "(", "arg_13", ")", "else", ":", "arg_9", ".", "mention_type", "=", "MentionType", ".", "NAME", "arg_9", ".", "entity_type", "=", "_ENTITY_TYPES", "[", "arg_11", "]", "arg_9", ".", "equiv_id", "=", "int", "(", "arg_10", ")", "arg_9", ".", "mention_id", "=", "arg_3", "yield", "arg_9", "if", "arg_5", ".", "endswith", "(", "'\\n'", ")", ":", "arg_0", ".", "line_idx", "+=", "1", "arg_0", ".", "byte_idx", "+=", "len", "(", "arg_5", ".", "encode", "(", "'utf-8'", ")", ")", "arg_3", "+=", "1"], "function": "def Func(arg_0, arg_1):\n        '''\n        Tokenize all the words and preserve NER labels from ENAMEX tags\n        '''\n        ## keep track of sentence position, which is reset for each\n        ## sentence, and used above in _make_token\n        arg_0.sent_pos = 0\n    \n        ## keep track of mention_id, so we can distinguish adjacent\n        ## multi-token mentions within the same coref chain\n        arg_3 = 0\n\n        while len(arg_1.childNodes) > 0:\n            ## shrink the sentence_dom's child nodes.  In v0_2_0 this\n            ## was required to cope with HitMaxi16.  Now it is just to\n            ## save memory.\n            arg_4 = arg_1.childNodes.pop(0)\n\n            if arg_4.nodeType == arg_4.TEXT_NODE:\n                ## process portion before an ENAMEX tag\n                for arg_5 in arg_4.data.splitlines(True):\n                    arg_0._input_string = arg_5\n                    for arg_7, arg_8 in arg_0.word_tokenizer.span_tokenize(arg_5):\n                        arg_9 = arg_0._make_token(arg_7, arg_8)\n                        if arg_9:\n                            yield arg_9\n\n                    if arg_5.endswith('\\n'):\n                        ## maintain the index to the current line\n                        arg_0.line_idx += 1\n\n                    ## increment index pasat the 'before' portion\n                    arg_0.byte_idx += len(arg_5.encode('utf-8'))\n\n            else:\n                ## process text inside an ENAMEX tag\n                assert arg_4.nodeName == 'ENAMEX', arg_4.nodeName\n                arg_10 = arg_4.attributes.get('ID').value\n                arg_11 = arg_4.attributes.get('TYPE').value\n                for arg_4 in arg_4.childNodes:\n                    assert arg_4.nodeType == arg_4.TEXT_NODE, arg_4.nodeType\n                    for arg_5 in arg_4.data.splitlines(True):\n                        arg_0._input_string = arg_5\n                        for arg_7, arg_8 in arg_0.word_tokenizer.span_tokenize(arg_5):\n                            arg_9 = arg_0._make_token(arg_7, arg_8)\n                            if arg_9:\n                                if arg_11 in _PRONOUNS:\n                                    arg_9.mention_type = MentionType.PRO\n                                    arg_9.entity_type = _ENTITY_TYPES[arg_11]\n                                    \n                                    ## create an attribute\n                                    arg_13 = Attribute(\n                                        attribute_type=AttributeType.PER_GENDER,\n                                        value=str(_PRONOUNS[arg_11])\n                                        )\n                                    arg_0.attributes.append(arg_13)\n\n                                else:\n                                    ## regular entity_type\n                                    arg_9.mention_type = MentionType.NAME\n                                    arg_9.entity_type = _ENTITY_TYPES[arg_11]\n\n                                arg_9.equiv_id = int(arg_10)\n                                arg_9.mention_id = arg_3\n                                yield arg_9\n\n                        if arg_5.endswith('\\n'):\n                            ## maintain the index to the current line\n                            arg_0.line_idx += 1\n\n                        ## increment index pasat the 'before' portion\n                        arg_0.byte_idx += len(arg_5.encode('utf-8'))\n\n                ## increment mention_id within this sentence\n                arg_3 += 1", "path": "streamcorpus_pipeline/_lingpipe.py", "identifier": "LingPipeParser.tokens", "docstring": "Tokenize all the words and preserve NER labels from ENAMEX tags", "docstring_tokens": ["Tokenize", "all", "the", "words", "and", "preserve", "NER", "labels", "from", "ENAMEX", "tags"], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 252407}
{"url": "https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/updates.py#L63-L77", "sha": "6c9236fd3b6a8f9e2d70dbf1bc01529242b73075", "docstring_summary": "Randomize the order at which statuses for the specified social media\n      profile will be sent out of the buffer.", "language": "python", "parameters": "(self, count=None, utc=None)", "return_statement": "return self.api.post(url=url, data=post_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "PATHS", "[", "'SHUFFLE'", "]", "%", "arg_0", ".", "profile_id", "arg_4", "=", "''", "if", "arg_1", ":", "arg_4", "+=", "'count=%s&'", "%", "arg_1", "if", "arg_2", ":", "arg_4", "+=", "'utc=%s'", "%", "arg_2", "return", "arg_0", ".", "api", ".", "post", "(", "arg_3", "=", "arg_3", ",", "data", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    '''\n      Randomize the order at which statuses for the specified social media\n      profile will be sent out of the buffer.\n    '''\n\n    arg_3 = PATHS['SHUFFLE'] % arg_0.profile_id\n\n    arg_4 = ''\n    if arg_1:\n      arg_4 += 'count=%s&' % arg_1\n    if arg_2:\n      arg_4 += 'utc=%s' % arg_2\n\n    return arg_0.api.post(arg_3=arg_3, data=arg_4)", "path": "buffpy/managers/updates.py", "identifier": "Updates.shuffle", "docstring": "Randomize the order at which statuses for the specified social media\n      profile will be sent out of the buffer.", "docstring_tokens": ["Randomize", "the", "order", "at", "which", "statuses", "for", "the", "specified", "social", "media", "profile", "will", "be", "sent", "out", "of", "the", "buffer", "."], "nwo": "vtemian/buffpy", "score": 0.2727920376977753, "idx": 252408}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L285-L298", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Launches the Hadoop datanode.", "language": "python", "parameters": "(self, job)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "hdfsContainerID", "=", "dockerCheckOutput", "(", "arg_1", "=", "arg_1", ",", "defer", "=", "STOP", ",", "workDir", "=", "os", ".", "getcwd", "(", ")", ",", "tool", "=", "\"quay.io/ucsc_cgl/apache-hadoop-worker:2.6.2\"", ",", "dockerParameters", "=", "[", "\"--net=host\"", ",", "\"-d\"", ",", "\"-v\"", ",", "\"/mnt/ephemeral/:/ephemeral/:rw\"", "]", ",", "parameters", "=", "[", "arg_0", ".", "masterIP", "]", ")", "[", ":", "-", "1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Launches the Hadoop datanode.\n\n        :param job: The underlying job.\n        \"\"\"\n        arg_0.hdfsContainerID = dockerCheckOutput(arg_1=arg_1,\n                                                 defer=STOP,\n                                                 workDir=os.getcwd(),\n                                                 tool=\"quay.io/ucsc_cgl/apache-hadoop-worker:2.6.2\",\n                                                 dockerParameters=[\"--net=host\",\n                                                                    \"-d\",\n                                                                    \"-v\", \"/mnt/ephemeral/:/ephemeral/:rw\"],\n                                                 parameters=[arg_0.masterIP])[:-1]", "path": "src/toil_lib/spark.py", "identifier": "WorkerService.__start_datanode", "docstring": "Launches the Hadoop datanode.\n\n        :param job: The underlying job.", "docstring_tokens": ["Launches", "the", "Hadoop", "datanode", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 252409}
{"url": "https://github.com/MartinHjelmare/leicacam/blob/1df37bccd34884737d3b5e169fae71dd2f21f1e2/leicacam/cam.py#L292-L305", "sha": "1df37bccd34884737d3b5e169fae71dd2f21f1e2", "docstring_summary": "Enable a given scan field.", "language": "python", "parameters": "(self, slide=0, wellx=1, welly=1, fieldx=1, fieldy=1)", "return_statement": "return self.wait_for(*cmd[0])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "1", ",", "arg_3", "=", "1", ",", "arg_4", "=", "1", ",", "arg_5", "=", "1", ")", ":", "arg_6", "=", "[", "(", "'cmd'", ",", "'Func'", ")", ",", "(", "'slide'", ",", "str", "(", "arg_1", ")", ")", ",", "(", "'wellx'", ",", "str", "(", "arg_2", ")", ")", ",", "(", "'welly'", ",", "str", "(", "arg_3", ")", ")", ",", "(", "'fieldx'", ",", "str", "(", "arg_4", ")", ")", ",", "(", "'fieldy'", ",", "str", "(", "arg_5", ")", ")", ",", "(", "'value'", ",", "'true'", ")", "]", "arg_0", ".", "send", "(", "arg_6", ")", "return", "arg_0", ".", "wait_for", "(", "*", "arg_6", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=1, arg_3=1, arg_4=1, arg_5=1):\n        \"\"\"Enable a given scan field.\"\"\"\n        # pylint: disable=too-many-arguments\n        arg_6 = [\n            ('cmd', 'Func'),\n            ('slide', str(arg_1)),\n            ('wellx', str(arg_2)),\n            ('welly', str(arg_3)),\n            ('fieldx', str(arg_4)),\n            ('fieldy', str(arg_5)),\n            ('value', 'true')\n        ]\n        arg_0.send(arg_6)\n        return arg_0.wait_for(*arg_6[0])", "path": "leicacam/cam.py", "identifier": "CAM.enable", "docstring": "Enable a given scan field.", "docstring_tokens": ["Enable", "a", "given", "scan", "field", "."], "nwo": "MartinHjelmare/leicacam", "score": 0.35580137387943567, "idx": 252410}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L494-L515", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the best model ID and it's errScore from the given sprint,\n    which may still be in progress. This returns the best score from all models\n    in the sprint which have matured so far.", "language": "python", "parameters": "(self, sprintIdx)", "return_statement": "return (bestModelId, bestErrScore)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "getAllSwarms", "(", "arg_1", ")", "arg_3", "=", "None", "arg_4", "=", "numpy", ".", "inf", "for", "arg_5", "in", "arg_2", ":", "(", "arg_6", ",", "arg_7", ")", "=", "arg_0", ".", "_hsObj", ".", "_resultsDB", ".", "bestModelIdAndErrScore", "(", "arg_5", ")", "if", "arg_7", "<", "arg_4", ":", "arg_3", "=", "arg_6", "arg_4", "=", "arg_7", "return", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return the best model ID and it's errScore from the given sprint,\n    which may still be in progress. This returns the best score from all models\n    in the sprint which have matured so far.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    retval:   (modelId, errScore)\n    \"\"\"\n    # Get all the swarms in this sprint\n    arg_2 = arg_0.getAllSwarms(arg_1)\n\n    # Get the best model and score from each swarm\n    arg_3 = None\n    arg_4 = numpy.inf\n    for arg_5 in arg_2:\n      (arg_6, arg_7) = arg_0._hsObj._resultsDB.bestModelIdAndErrScore(arg_5)\n      if arg_7 < arg_4:\n        arg_3 = arg_6\n        arg_4 = arg_7\n\n    return (arg_3, arg_4)", "path": "src/nupic/swarming/hypersearch/hs_state.py", "identifier": "HsState.bestModelInSprint", "docstring": "Return the best model ID and it's errScore from the given sprint,\n    which may still be in progress. This returns the best score from all models\n    in the sprint which have matured so far.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    retval:   (modelId, errScore)", "docstring_tokens": ["Return", "the", "best", "model", "ID", "and", "it", "s", "errScore", "from", "the", "given", "sprint", "which", "may", "still", "be", "in", "progress", ".", "This", "returns", "the", "best", "score", "from", "all", "models", "in", "the", "sprint", "which", "have", "matured", "so", "far", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252411}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/bfgs_utils.py#L47-L91", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns a dictionary to populate the initial state of the search procedure.", "language": "python", "parameters": "(value_and_gradients_function,\n                           initial_position,\n                           grad_tolerance,\n                           control_inputs=None)", "return_statement": "return dict(\n      converged=converged,\n      failed=tf.zeros_like(converged),  # i.e. False.\n      num_iterations=tf.convert_to_tensor(value=0),\n      num_objective_evaluations=tf.convert_to_tensor(value=1),\n      position=initial_position,\n      objective_value=f0,\n      objective_gradient=df0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", ":", "with", "tf", ".", "control_dependencies", "(", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "arg_0", "(", "arg_1", ")", "else", ":", "arg_4", ",", "arg_5", "=", "arg_0", "(", "arg_1", ")", "arg_6", "=", "norm", "(", "arg_5", ",", "dims", "=", "1", ")", "<", "arg_2", "return", "dict", "(", "arg_6", "=", "arg_6", ",", "failed", "=", "tf", ".", "zeros_like", "(", "arg_6", ")", ",", "num_iterations", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "0", ")", ",", "num_objective_evaluations", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "1", ")", ",", "position", "=", "arg_1", ",", "objective_value", "=", "arg_4", ",", "objective_gradient", "=", "arg_5", ")"], "function": "def Func(arg_0,\n                           arg_1,\n                           arg_2,\n                           arg_3=None):\n  \"\"\"Returns a dictionary to populate the initial state of the search procedure.\n\n  Performs an initial convergence check and the first evaluation of the\n  objective function.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a tensor and\n      returns a tuple of two tensors: the objective function value and its\n      derivative.\n    initial_position: The starting point of the search procedure.\n    grad_tolerance: The gradient tolerance for the procedure.\n    control_inputs: Optional ops used to assert the validity of inputs, these\n      are added as control dependencies to execute before the objective\n      function is evaluated for the first time.\n\n  Returns:\n    An dictionary with values for the following keys:\n      converged: True if the convergence check finds that the initial position\n        is already an argmin of the objective function.\n      failed: Initialized to False.\n      num_objective_evaluations: Initialized to 1.\n      position: Initialized to the initial position.\n      objective_value: Initialized to the value of the objective function at\n        the initial position.\n      objective_gradient: Initialized to the gradient of the objective\n        function at the initial position.\n  \"\"\"\n  if arg_3:\n    with tf.control_dependencies(arg_3):\n      arg_4, arg_5 = arg_0(arg_1)\n  else:\n    arg_4, arg_5 = arg_0(arg_1)\n  arg_6 = norm(arg_5, dims=1) < arg_2\n  return dict(\n      arg_6=arg_6,\n      failed=tf.zeros_like(arg_6),  # i.e. False.\n      num_iterations=tf.convert_to_tensor(value=0),\n      num_objective_evaluations=tf.convert_to_tensor(value=1),\n      position=arg_1,\n      objective_value=arg_4,\n      objective_gradient=arg_5)", "path": "tensorflow_probability/python/optimizer/bfgs_utils.py", "identifier": "get_initial_state_args", "docstring": "Returns a dictionary to populate the initial state of the search procedure.\n\n  Performs an initial convergence check and the first evaluation of the\n  objective function.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a tensor and\n      returns a tuple of two tensors: the objective function value and its\n      derivative.\n    initial_position: The starting point of the search procedure.\n    grad_tolerance: The gradient tolerance for the procedure.\n    control_inputs: Optional ops used to assert the validity of inputs, these\n      are added as control dependencies to execute before the objective\n      function is evaluated for the first time.\n\n  Returns:\n    An dictionary with values for the following keys:\n      converged: True if the convergence check finds that the initial position\n        is already an argmin of the objective function.\n      failed: Initialized to False.\n      num_objective_evaluations: Initialized to 1.\n      position: Initialized to the initial position.\n      objective_value: Initialized to the value of the objective function at\n        the initial position.\n      objective_gradient: Initialized to the gradient of the objective\n        function at the initial position.", "docstring_tokens": ["Returns", "a", "dictionary", "to", "populate", "the", "initial", "state", "of", "the", "search", "procedure", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252412}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/livecode.py#L84-L103", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Run edited source, if no exceptions occur then it\n        graduates to known good.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "LiveExecution", ".", "lock", ":", "arg_1", "=", "copy", ".", "copy", "(", "arg_0", ".", "ns", ")", "try", ":", "arg_2", "=", "arg_0", ".", "edited_source", "arg_0", ".", "edited_source", "=", "None", "arg_0", ".", "do_exec", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "known_good", "=", "arg_2", "arg_0", ".", "call_good_cb", "(", ")", "return", "True", ",", "None", "except", "Exception", "as", "ex", ":", "arg_5", "=", "traceback", ".", "format_exc", "(", ")", "arg_0", ".", "call_bad_cb", "(", "arg_5", ")", "arg_0", ".", "ns", ".", "clear", "(", ")", "arg_0", ".", "ns", ".", "update", "(", "arg_1", ")", "return", "False", ",", "ex"], "function": "def Func(arg_0):\n        \"\"\"\n        Run edited source, if no exceptions occur then it\n        graduates to known good.\n        \"\"\"\n        with LiveExecution.lock:\n            arg_1 = copy.copy(arg_0.ns)\n            try:\n                arg_2 = arg_0.edited_source\n                arg_0.edited_source = None\n                arg_0.do_exec(arg_2, arg_1)\n                arg_0.known_good = arg_2\n                arg_0.call_good_cb()\n                return True, None\n            except Exception as ex:\n                arg_5 = traceback.format_exc()\n                arg_0.call_bad_cb(arg_5)\n                arg_0.ns.clear()\n                arg_0.ns.update(arg_1)\n                return False, ex", "path": "shoebot/grammar/livecode.py", "identifier": "LiveExecution.run_tenuous", "docstring": "Run edited source, if no exceptions occur then it\n        graduates to known good.", "docstring_tokens": ["Run", "edited", "source", "if", "no", "exceptions", "occur", "then", "it", "graduates", "to", "known", "good", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252413}
{"url": "https://github.com/praekelt/django-analytics/blob/29c22d03374ccc0ec451650e2c2886d324f6e5c6/analytics/validation.py#L3-L11", "sha": "29c22d03374ccc0ec451650e2c2886d324f6e5c6", "docstring_summary": "Does basic Metric option validation.", "language": "python", "parameters": "(metric_class)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'label'", ")", ":", "raise", "ImproperlyConfigured", "(", "\"No 'label' attribute found for metric %s.\"", "%", "arg_0", ".", "__name__", ")", "if", "not", "hasattr", "(", "arg_0", ",", "'widget'", ")", ":", "raise", "ImproperlyConfigured", "(", "\"No 'widget' attribute found for metric %s.\"", "%", "arg_0", ".", "__name__", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Does basic Metric option validation. \n    \"\"\"\n    if not hasattr(arg_0, 'label'):\n        raise ImproperlyConfigured(\"No 'label' attribute found for metric %s.\" % arg_0.__name__)\n    \n    if not hasattr(arg_0, 'widget'):\n        raise ImproperlyConfigured(\"No 'widget' attribute found for metric %s.\" % arg_0.__name__)", "path": "analytics/validation.py", "identifier": "validate", "docstring": "Does basic Metric option validation.", "docstring_tokens": ["Does", "basic", "Metric", "option", "validation", "."], "nwo": "praekelt/django-analytics", "score": 0.1905226606846468, "idx": 252414}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/auto.py#L280-L312", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Cleanup the paths and add", "language": "python", "parameters": "(repo, autooptions, files)", "return_statement": "return count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "\".\"", ":", "\"\"", "}", "if", "(", "(", "'import'", "in", "arg_1", ")", "and", "(", "'directory-mapping'", "in", "arg_1", "[", "'import'", "]", ")", ")", ":", "arg_3", "=", "arg_1", "[", "'import'", "]", "[", "'directory-mapping'", "]", "arg_4", "=", "arg_3", ".", "keys", "(", ")", "arg_4", "=", "sorted", "(", "arg_4", ",", "key", "=", "lambda", "arg_9", ":", "len", "(", "arg_9", ")", ",", "reverse", "=", "True", ")", "arg_5", "=", "0", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_2", ":", "arg_8", "=", "arg_7", "for", "arg_9", "in", "arg_4", ":", "arg_10", "=", "arg_3", "[", "arg_9", "]", "if", "arg_7", ".", "startswith", "(", "arg_9", "+", "\"/\"", ")", ":", "arg_8", "=", "arg_7", ".", "replace", "(", "arg_9", "+", "\"/\"", ",", "arg_10", ")", "break", "arg_5", "+=", "files_add", "(", "arg_0", "=", "arg_0", ",", "args", "=", "[", "arg_7", "]", ",", "targetdir", "=", "os", ".", "path", ".", "dirname", "(", "arg_8", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Cleanup the paths and add\n    \"\"\"\n    # Get the mappings and keys.\n    arg_3 = { \".\": \"\" }\n    if (('import' in arg_1) and\n        ('directory-mapping' in arg_1['import'])):\n        arg_3 = arg_1['import']['directory-mapping']\n\n    # Apply the longest prefix first...\n    arg_4 = arg_3.keys()\n    arg_4 = sorted(arg_4, key=lambda arg_9: len(arg_9), reverse=True)\n\n    arg_5 = 0\n    arg_6 = []\n    for arg_7 in arg_2:\n\n        # Find the destination\n        arg_8 = arg_7\n        for arg_9 in arg_4:\n            arg_10 = arg_3[arg_9]\n            if arg_7.startswith(arg_9 + \"/\"):\n                #print(\"Replacing \", k)\n                arg_8 = arg_7.replace(arg_9 + \"/\", arg_10)\n                break\n\n        # Now add to repository\n        arg_5 += files_add(arg_0=arg_0,\n                           args=[arg_7],\n                           targetdir=os.path.dirname(arg_8))\n\n    return arg_5", "path": "dgitcore/datasets/auto.py", "identifier": "auto_add", "docstring": "Cleanup the paths and add", "docstring_tokens": ["Cleanup", "the", "paths", "and", "add"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 252415}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_06_parameter_presetting.py#L56-L72", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "The Roessler attractor differential equation", "language": "python", "parameters": "(value_array, a, c)", "return_statement": "return diff_array", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "arg_4", "=", "np", ".", "zeros", "(", "3", ")", "arg_4", "[", "0", "]", "=", "-", "arg_0", "[", "1", "]", "-", "arg_0", "[", "2", "]", "arg_4", "[", "1", "]", "=", "arg_0", "[", "0", "]", "+", "arg_1", "*", "arg_0", "[", "1", "]", "arg_4", "[", "2", "]", "=", "arg_3", "+", "arg_0", "[", "2", "]", "*", "(", "arg_0", "[", "0", "]", "-", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"The Roessler attractor differential equation\n\n    :param value_array: 3d array containing the x,y, and z component values.\n    :param a: Constant attractor parameter\n    :param c: Constant attractor parameter\n\n    :return: 3d array of the Roessler system evaluated at `value_array`\n\n    \"\"\"\n    arg_3=arg_1\n    arg_4 = np.zeros(3)\n    arg_4[0] = -arg_0[1] - arg_0[2]\n    arg_4[1] = arg_0[0] + arg_1 * arg_0[1]\n    arg_4[2] = arg_3 + arg_0[2] * (arg_0[0] - arg_2)\n\n    return arg_4", "path": "examples/example_06_parameter_presetting.py", "identifier": "diff_roessler", "docstring": "The Roessler attractor differential equation\n\n    :param value_array: 3d array containing the x,y, and z component values.\n    :param a: Constant attractor parameter\n    :param c: Constant attractor parameter\n\n    :return: 3d array of the Roessler system evaluated at `value_array`", "docstring_tokens": ["The", "Roessler", "attractor", "differential", "equation"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252416}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L816-L844", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Get the expiration date from the database.", "language": "python", "parameters": "(self)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_authorization", "(", ")", "and", "arg_0", ".", "is_in_database", "(", ")", "and", "not", "arg_0", ".", "is_time_older", "(", ")", ":", "arg_1", "=", "PyFunceble", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "PyFunceble", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "PyFunceble", ".", "INTERN", "[", "\"to_test\"", "]", "]", "[", "\"expiration_date\"", "]", "if", "arg_1", ":", "return", "arg_1", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Get the expiration date from the database.\n\n        :return: The expiration date from the database.\n        :rtype: str|None\n        \"\"\"\n\n        if arg_0._authorization() and arg_0.is_in_database() and not arg_0.is_time_older():\n            # * We are authorized to work.\n            # and\n            # * The element we are testing is in the database.\n            # and\n            # * The expiration date is in the future.\n\n            # We get the expiration date from the database.\n            arg_1 = PyFunceble.INTERN[\"whois_db\"][PyFunceble.INTERN[\"file_to_test\"]][\n                PyFunceble.INTERN[\"to_test\"]\n            ][\"expiration_date\"]\n\n            if arg_1:\n                # The expiration date from the database is not empty nor\n                # equal to None.\n\n                # We return it.\n                return arg_1\n\n        # We return None, there is no data to work with.\n        return None", "path": "PyFunceble/database.py", "identifier": "Whois.get_expiration_date", "docstring": "Get the expiration date from the database.\n\n        :return: The expiration date from the database.\n        :rtype: str|None", "docstring_tokens": ["Get", "the", "expiration", "date", "from", "the", "database", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 252417}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L82-L88", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Prints information about the user and bot version.", "language": "python", "parameters": "(self, msg, args)", "return_statement": "return '\\n'.join(output)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "\"Hello %s\"", "%", "arg_1", ".", "user", "]", "if", "hasattr", "(", "arg_0", ".", "_bot", ".", "dispatcher", ",", "'auth_manager'", ")", "and", "arg_1", ".", "user", ".", "is_admin", "is", "True", ":", "arg_3", ".", "append", "(", "\"You are a *bot admin*.\"", ")", "arg_3", ".", "append", "(", "\"Bot version: %s-%s\"", "%", "(", "arg_0", ".", "_bot", ".", "version", ",", "arg_0", ".", "_bot", ".", "commit", ")", ")", "return", "'\\n'", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Prints information about the user and bot version.\"\"\"\n        arg_3 = [\"Hello %s\" % arg_1.user]\n        if hasattr(arg_0._bot.dispatcher, 'auth_manager') and arg_1.user.is_admin is True:\n            arg_3.append(\"You are a *bot admin*.\")\n        arg_3.append(\"Bot version: %s-%s\" % (arg_0._bot.version, arg_0._bot.commit))\n        return '\\n'.join(arg_3)", "path": "slackminion/plugins/core/core.py", "identifier": "Core.whoami", "docstring": "Prints information about the user and bot version.", "docstring_tokens": ["Prints", "information", "about", "the", "user", "and", "bot", "version", "."], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 252418}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L97-L117", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Calculates remaining time as a string", "language": "python", "parameters": "(self, index)", "return_statement": "return remaining_str", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "arg_3", "=", "arg_2", "-", "arg_0", ".", "_start_time", "try", ":", "arg_4", "=", "arg_3", ".", "total_seconds", "(", ")", "except", "AttributeError", ":", "arg_4", "=", "(", "(", "arg_3", ".", "microseconds", "+", "(", "arg_3", ".", "seconds", "+", "arg_3", ".", "days", "*", "24", "*", "3600", ")", "*", "10", "**", "6", ")", "/", "10.0", "**", "6", ")", "arg_5", "=", "int", "(", "(", "arg_0", ".", "_total", "-", "arg_0", ".", "_start_index", "-", "1.0", ")", "*", "arg_4", "/", "float", "(", "arg_1", "-", "arg_0", ".", "_start_index", ")", "-", "arg_4", ")", "arg_6", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "arg_5", ")", "arg_7", "=", "', remaining: '", "+", "str", "(", "arg_6", ")", "except", "ZeroDivisionError", ":", "arg_7", "=", "''", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Calculates remaining time as a string\"\"\"\n        try:\n            arg_2 = datetime.datetime.now()\n            arg_3 = arg_2 - arg_0._start_time\n            try:\n                arg_4 = arg_3.total_seconds()\n            except AttributeError:\n                # for backwards-compatibility\n                # Python 2.6 does not support `total_seconds`\n                arg_4 = ((arg_3.microseconds +\n                                    (arg_3.seconds +\n                                     arg_3.days * 24 * 3600) * 10 ** 6) / 10.0 ** 6)\n            arg_5 = int((arg_0._total - arg_0._start_index - 1.0) *\n                                    arg_4 / float(arg_1 - arg_0._start_index) -\n                                    arg_4)\n            arg_6 = datetime.timedelta(seconds=arg_5)\n            arg_7 = ', remaining: ' + str(arg_6)\n        except ZeroDivisionError:\n            arg_7 = ''\n        return arg_7", "path": "pypet/utils/helpful_functions.py", "identifier": "_Progressbar._get_remaining", "docstring": "Calculates remaining time as a string", "docstring_tokens": ["Calculates", "remaining", "time", "as", "a", "string"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252419}
{"url": "https://github.com/praekelt/django-analytics/blob/29c22d03374ccc0ec451650e2c2886d324f6e5c6/analytics/views.py#L64-L77", "sha": "29c22d03374ccc0ec451650e2c2886d324f6e5c6", "docstring_summary": "Get the context for this view.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return context", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "'gadgets'", ":", "arg_0", ".", "_registry", ",", "'columns'", ":", "arg_0", ".", "columns", ",", "'rows'", ":", "arg_0", ".", "rows", ",", "'column_ratio'", ":", "100", "-", "arg_0", ".", "columns", "*", "2", ",", "'row_ratio'", ":", "100", "-", "arg_0", ".", "rows", "*", "2", ",", "}", "arg_2", ".", "update", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the context for this view.\n        \"\"\"\n        #max_columns, max_rows = self.get_max_dimension()\n        arg_2 = {\n            'gadgets': arg_0._registry,\n            'columns': arg_0.columns,\n            'rows': arg_0.rows,\n            'column_ratio': 100 - arg_0.columns * 2,\n            'row_ratio': 100 - arg_0.rows * 2,\n        }\n        arg_2.update(arg_1)\n        return arg_2", "path": "analytics/views.py", "identifier": "AnalyticsView.get_context_data", "docstring": "Get the context for this view.", "docstring_tokens": ["Get", "the", "context", "for", "this", "view", "."], "nwo": "praekelt/django-analytics", "score": 0.1905226606846468, "idx": 252420}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/plots.py#L1056-L1103", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Plots a set of circles corresponding to a slice through the platonic\n    structure. Copied from twoslice_overlay with comments, standaloneness.", "language": "python", "parameters": "(st, layer, axis, ax=None, talpha=1.0, cedge='white', cface='white')", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "1.0", ",", "arg_5", "=", "'white'", ",", "arg_6", "=", "'white'", ")", ":", "arg_7", "=", "arg_0", ".", "obj_get_positions", "(", ")", "arg_8", "=", "arg_0", ".", "obj_get_radii", "(", ")", "arg_9", "=", "arg_0", ".", "ishape", ".", "shape", ".", "tolist", "(", ")", "arg_9", ".", "pop", "(", "arg_2", ")", "if", "arg_3", "is", "None", ":", "arg_10", "=", "plt", ".", "figure", "(", ")", "arg_11", "=", "'white'", "if", "arg_6", "==", "'black'", "else", "'black'", "arg_12", ",", "arg_13", "=", "(", "(", "1", ",", "arg_9", "[", "1", "]", "/", "float", "(", "arg_9", "[", "0", "]", ")", ")", "if", "arg_9", "[", "0", "]", ">", "arg_9", "[", "1", "]", "else", "(", "arg_9", "[", "0", "]", "/", "float", "(", "arg_9", "[", "1", "]", ")", ",", "1", ")", ")", "arg_3", "=", "arg_10", ".", "add_axes", "(", "(", "0", ",", "0", ",", "arg_12", ",", "arg_13", ")", ",", "arg_11", "=", "arg_11", ")", "arg_14", "=", "np", ".", "arange", "(", "len", "(", "arg_7", ")", ")", "[", "np", ".", "abs", "(", "arg_7", "[", ":", ",", "arg_2", "]", "-", "arg_1", ")", "<", "arg_8", "]", "arg_15", "=", "1.0", "for", "arg_16", "in", "arg_14", ":", "arg_17", "=", "arg_7", "[", "arg_16", "]", ".", "copy", "(", ")", "arg_18", "=", "2", "*", "np", ".", "sqrt", "(", "arg_8", "[", "arg_16", "]", "**", "2", "-", "(", "arg_17", "[", "arg_2", "]", "-", "arg_1", ")", "**", "2", ")", "if", "arg_2", "==", "0", ":", "arg_19", "=", "1", "arg_20", "=", "2", "elif", "arg_2", "==", "1", ":", "arg_19", "=", "0", "arg_20", "=", "2", "elif", "arg_2", "==", "2", ":", "arg_19", "=", "0", "arg_20", "=", "1", "arg_21", "=", "Circle", "(", "(", "arg_17", "[", "arg_19", "]", "/", "arg_15", ",", "arg_17", "[", "arg_20", "]", "/", "arg_15", ")", ",", "radius", "=", "arg_18", "/", "2", "/", "arg_15", ",", "fc", "=", "arg_6", ",", "ec", "=", "arg_5", ",", "alpha", "=", "arg_4", ")", "arg_3", ".", "add_patch", "(", "arg_21", ")", "plt", ".", "axis", "(", "'equal'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=1.0, arg_5='white', arg_6='white'):\n    \"\"\"\n    Plots a set of Func corresponding to a slice through the platonic\n    structure. Copied from twoslice_overlay with comments, standaloneness.\n\n    Inputs\n    ------\n        pos : array of particle positions; [N,3]\n        rad : array of particle radii; [N]\n        ax : plt.axis instance\n        layer : Which layer of the slice to use.\n        axis : The slice of the image, 0, 1, or 2.\n        cedge : edge color\n        cface : face color\n        talpha : Alpha of the thing\n    \"\"\"\n    arg_7 = arg_0.obj_get_positions()\n    arg_8 = arg_0.obj_get_radii()\n    arg_9 = arg_0.ishape.shape.tolist()\n    arg_9.pop(arg_2) #shape is now the shape of the image\n    if arg_3 is None:\n        arg_10 = plt.figure()\n        arg_11 = 'white' if arg_6 == 'black' else 'black'\n        arg_12, arg_13 = ((1,arg_9[1]/float(arg_9[0])) if arg_9[0] > arg_9[1] else\n                (arg_9[0]/float(arg_9[1]), 1))\n        arg_3 = arg_10.add_axes((0,0, arg_12, arg_13), arg_11=arg_11)\n    # get the index of the particles we want to include\n    arg_14 = np.arange(len(arg_7))[np.abs(arg_7[:,arg_2] - arg_1) < arg_8]\n\n    # for each of these particles display the effective radius\n    # in the proper place\n    arg_15 = 1.0 #np.max(shape).astype('float')\n    for arg_16 in arg_14:\n        arg_17 = arg_7[arg_16].copy()\n        arg_18 = 2*np.sqrt(arg_8[arg_16]**2 - (arg_17[arg_2] - arg_1)**2)\n        #CIRCLE IS IN FIGURE COORDINATES!!!\n        if arg_2==0:\n            arg_19 = 1; arg_20 = 2\n        elif arg_2 == 1:\n            arg_19 = 0; arg_20 = 2\n        elif arg_2==2:\n            arg_19 = 0; arg_20 = 1\n        arg_21 = Circle((arg_17[arg_19]/arg_15, arg_17[arg_20]/arg_15), radius=arg_18/2/arg_15, fc=arg_6,\n                ec=arg_5, alpha=arg_4)\n        arg_3.add_patch(arg_21)\n    # plt.axis([0,1,0,1])\n    plt.axis('equal') #Func not ellipses\n    return arg_3", "path": "peri/viz/plots.py", "identifier": "circles", "docstring": "Plots a set of circles corresponding to a slice through the platonic\n    structure. Copied from twoslice_overlay with comments, standaloneness.\n\n    Inputs\n    ------\n        pos : array of particle positions; [N,3]\n        rad : array of particle radii; [N]\n        ax : plt.axis instance\n        layer : Which layer of the slice to use.\n        axis : The slice of the image, 0, 1, or 2.\n        cedge : edge color\n        cface : face color\n        talpha : Alpha of the thing", "docstring_tokens": ["Plots", "a", "set", "of", "circles", "corresponding", "to", "a", "slice", "through", "the", "platonic", "structure", ".", "Copied", "from", "twoslice_overlay", "with", "comments", "standaloneness", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252421}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/generation.py#L273-L396", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This generates fake EB light curves.", "language": "python", "parameters": "(\n        times,\n        mags=None,\n        errs=None,\n        paramdists={'period':sps.uniform(loc=0.2,scale=99.8),\n                    'pdepth':sps.uniform(loc=1.0e-4,scale=0.7),\n                    'pduration':sps.uniform(loc=0.01,scale=0.44),\n                    'depthratio':sps.uniform(loc=0.01,scale=0.99),\n                    'secphase':sps.norm(loc=0.5,scale=0.1)},\n        magsarefluxes=False,\n)", "return_statement": "return modeldict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "{", "'period'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "0.2", ",", "arg_7", "=", "99.8", ")", ",", "'pdepth'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "1.0e-4", ",", "arg_7", "=", "0.7", ")", ",", "'pduration'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "0.01", ",", "arg_7", "=", "0.44", ")", ",", "'depthratio'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "0.01", ",", "arg_7", "=", "0.99", ")", ",", "'secphase'", ":", "arg_4", ".", "norm", "(", "arg_6", "=", "0.5", ",", "arg_7", "=", "0.1", ")", "}", ",", "arg_9", "=", "False", ",", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "np", ".", "full_like", "(", "arg_0", ",", "0.0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "np", ".", "full_like", "(", "arg_0", ",", "0.0", ")", "arg_10", "=", "npr", ".", "random", "(", ")", "*", "(", "arg_0", ".", "max", "(", ")", "-", "arg_0", ".", "min", "(", ")", ")", "+", "arg_0", ".", "min", "(", ")", "arg_11", "=", "arg_3", "[", "'period'", "]", ".", "rvs", "(", "size", "=", "1", ")", "arg_12", "=", "arg_3", "[", "'pdepth'", "]", ".", "rvs", "(", "size", "=", "1", ")", "arg_13", "=", "arg_3", "[", "'pduration'", "]", ".", "rvs", "(", "size", "=", "1", ")", "arg_14", "=", "arg_3", "[", "'depthratio'", "]", ".", "rvs", "(", "size", "=", "1", ")", "arg_15", "=", "arg_3", "[", "'secphase'", "]", ".", "rvs", "(", "size", "=", "1", ")", "if", "arg_9", "and", "arg_12", "<", "0.0", ":", "arg_12", "=", "-", "arg_12", "elif", "not", "arg_9", "and", "arg_12", ">", "0.0", ":", "arg_12", "=", "-", "arg_12", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", ",", "arg_20", "=", "(", "eclipses", ".", "invgauss_eclipses_func", "(", "[", "arg_11", ",", "arg_10", ",", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", "]", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", "arg_21", "=", "np", ".", "argsort", "(", "arg_18", ")", "arg_22", "=", "arg_18", "[", "arg_21", "]", "arg_23", "=", "arg_16", "[", "arg_21", "]", "arg_24", "=", "arg_20", "[", "arg_21", "]", "arg_25", "=", "{", "'vartype'", ":", "'EB'", ",", "'params'", ":", "{", "x", ":", "np", ".", "asscalar", "(", "y", ")", "for", "x", ",", "y", "in", "zip", "(", "[", "'period'", ",", "'epoch'", ",", "'pdepth'", ",", "'pduration'", ",", "'depthratio'", "]", ",", "[", "arg_11", ",", "arg_10", ",", "arg_12", ",", "arg_13", ",", "arg_14", "]", ")", "}", ",", "'times'", ":", "arg_22", ",", "'mags'", ":", "arg_23", ",", "'errs'", ":", "arg_24", ",", "'varperiod'", ":", "arg_11", ",", "'varamplitude'", ":", "arg_12", ",", "}", "return", "arg_25"], "function": "def Func(\n        arg_0,\n        arg_1=None,\n        arg_2=None,\n        arg_3={'period':arg_4.uniform(arg_6=0.2,arg_7=99.8),\n                    'pdepth':arg_4.uniform(arg_6=1.0e-4,arg_7=0.7),\n                    'pduration':arg_4.uniform(arg_6=0.01,arg_7=0.44),\n                    'depthratio':arg_4.uniform(arg_6=0.01,arg_7=0.99),\n                    'secphase':arg_4.norm(arg_6=0.5,arg_7=0.1)},\n        arg_9=False,\n):\n    '''This generates fake EB light curves.\n\n    Parameters\n    ----------\n\n    times : np.array\n        This is an array of time values that will be used as the time base.\n\n    mags,errs : np.array\n        These arrays will have the model added to them. If either is\n        None, `np.full_like(times, 0.0)` will used as a substitute and the model\n        light curve will be centered around 0.0.\n\n    paramdists : dict\n        This is a dict containing parameter distributions to use for the\n        model params, containing the following keys ::\n\n            {'period', 'pdepth', 'pduration', 'depthratio', 'secphase'}\n\n        The values of these keys should all be 'frozen' scipy.stats distribution\n        objects, e.g.:\n\n        https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions\n        The variability epoch will be automatically chosen from a uniform\n        distribution between `times.min()` and `times.max()`.\n\n        The `pdepth` will be flipped automatically as appropriate if\n        `magsarefluxes=True`.\n\n    magsarefluxes : bool\n        If the generated time series is meant to be a flux time-series, set this\n        to True to get the correct sign of variability amplitude.\n\n    Returns\n    -------\n\n    dict\n        A dict of the form below is returned::\n\n            {'vartype': 'EB',\n             'params': {'period': generated value of period,\n                        'epoch': generated value of epoch,\n                        'pdepth': generated value of priary eclipse depth,\n                        'pduration': generated value of prim eclipse duration,\n                        'depthratio': generated value of prim/sec eclipse\n                                      depth ratio},\n             'times': the model times,\n             'mags': the model mags,\n             'errs': the model errs,\n             'varperiod': the generated period of variability == 'period'\n             'varamplitude': the generated amplitude of\n                             variability == 'pdepth'}\n\n    '''\n\n    if arg_1 is None:\n        arg_1 = np.full_like(arg_0, 0.0)\n\n    if arg_2 is None:\n        arg_2 = np.full_like(arg_0, 0.0)\n\n    # choose the epoch\n    arg_10 = npr.random()*(arg_0.max() - arg_0.min()) + arg_0.min()\n\n    # choose the period, pdepth, duration, depthratio\n    arg_11 = arg_3['period'].rvs(size=1)\n    arg_12 = arg_3['pdepth'].rvs(size=1)\n    arg_13 = arg_3['pduration'].rvs(size=1)\n    arg_14 = arg_3['depthratio'].rvs(size=1)\n    arg_15 = arg_3['secphase'].rvs(size=1)\n\n    # fix the transit depth if it needs to be flipped\n    if arg_9 and arg_12 < 0.0:\n        arg_12 = -arg_12\n    elif not arg_9 and arg_12 > 0.0:\n        arg_12 = -arg_12\n\n    # generate the model\n    arg_16, arg_17, arg_18, arg_19, arg_20 = (\n        eclipses.invgauss_eclipses_func([arg_11, arg_10, arg_12,\n                                         arg_13, arg_14, arg_15],\n                                        arg_0,\n                                        arg_1,\n                                        arg_2)\n    )\n\n    # resort in original time order\n    arg_21 = np.argsort(arg_18)\n    arg_22 = arg_18[arg_21]\n    arg_23 = arg_16[arg_21]\n    arg_24 = arg_20[arg_21]\n\n    # return a dict with everything\n    arg_25 = {\n        'vartype':'EB',\n        'params':{x:np.asscalar(y) for x,y in zip(['period',\n                                                   'epoch',\n                                                   'pdepth',\n                                                   'pduration',\n                                                   'depthratio'],\n                                                  [arg_11,\n                                                   arg_10,\n                                                   arg_12,\n                                                   arg_13,\n                                                   arg_14])},\n        'times':arg_22,\n        'mags':arg_23,\n        'errs':arg_24,\n        'varperiod':arg_11,\n        'varamplitude':arg_12,\n    }\n\n    return arg_25", "path": "astrobase/fakelcs/generation.py", "identifier": "generate_eb_lightcurve", "docstring": "This generates fake EB light curves.\n\n    Parameters\n    ----------\n\n    times : np.array\n        This is an array of time values that will be used as the time base.\n\n    mags,errs : np.array\n        These arrays will have the model added to them. If either is\n        None, `np.full_like(times, 0.0)` will used as a substitute and the model\n        light curve will be centered around 0.0.\n\n    paramdists : dict\n        This is a dict containing parameter distributions to use for the\n        model params, containing the following keys ::\n\n            {'period', 'pdepth', 'pduration', 'depthratio', 'secphase'}\n\n        The values of these keys should all be 'frozen' scipy.stats distribution\n        objects, e.g.:\n\n        https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions\n        The variability epoch will be automatically chosen from a uniform\n        distribution between `times.min()` and `times.max()`.\n\n        The `pdepth` will be flipped automatically as appropriate if\n        `magsarefluxes=True`.\n\n    magsarefluxes : bool\n        If the generated time series is meant to be a flux time-series, set this\n        to True to get the correct sign of variability amplitude.\n\n    Returns\n    -------\n\n    dict\n        A dict of the form below is returned::\n\n            {'vartype': 'EB',\n             'params': {'period': generated value of period,\n                        'epoch': generated value of epoch,\n                        'pdepth': generated value of priary eclipse depth,\n                        'pduration': generated value of prim eclipse duration,\n                        'depthratio': generated value of prim/sec eclipse\n                                      depth ratio},\n             'times': the model times,\n             'mags': the model mags,\n             'errs': the model errs,\n             'varperiod': the generated period of variability == 'period'\n             'varamplitude': the generated amplitude of\n                             variability == 'pdepth'}", "docstring_tokens": ["This", "generates", "fake", "EB", "light", "curves", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252422}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/flask_util.py#L235-L274", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Initialize this extension for the given app.", "language": "python", "parameters": "(self, app, scopes=None, client_secrets_file=None,\n                 client_id=None, client_secret=None, authorize_callback=None,\n                 storage=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "**", "arg_8", ")", ":", "arg_0", ".", "app", "=", "arg_1", "arg_0", ".", "authorize_callback", "=", "arg_6", "arg_0", ".", "flow_kwargs", "=", "arg_8", "if", "arg_7", "is", "None", ":", "arg_7", "=", "dictionary_storage", ".", "DictionaryStorage", "(", "session", ",", "key", "=", "_CREDENTIALS_KEY", ")", "arg_0", ".", "storage", "=", "arg_7", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_1", ".", "config", ".", "get", "(", "'GOOGLE_OAUTH2_SCOPES'", ",", "_DEFAULT_SCOPES", ")", "arg_0", ".", "scopes", "=", "arg_2", "arg_0", ".", "_load_config", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", "arg_1", ".", "register_blueprint", "(", "arg_0", ".", "_create_blueprint", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                 arg_4=None, arg_5=None, arg_6=None,\n                 arg_7=None, **arg_8):\n        \"\"\"Initialize this extension for the given app.\n\n        Arguments:\n            app: A Flask application.\n            scopes: Optional list of scopes to authorize.\n            client_secrets_file: Path to a file containing client secrets. You\n                can also specify the GOOGLE_OAUTH2_CLIENT_SECRETS_FILE config\n                value.\n            client_id: If not specifying a client secrets file, specify the\n                OAuth2 client id. You can also specify the\n                GOOGLE_OAUTH2_CLIENT_ID config value. You must also provide a\n                client secret.\n            client_secret: The OAuth2 client secret. You can also specify the\n                GOOGLE_OAUTH2_CLIENT_SECRET config value.\n            authorize_callback: A function that is executed after successful\n                user authorization.\n            storage: A oauth2client.client.Storage subclass for storing the\n                credentials. By default, this is a Flask session based storage.\n            kwargs: Any additional args are passed along to the Flow\n                constructor.\n        \"\"\"\n        arg_0.app = arg_1\n        arg_0.authorize_callback = arg_6\n        arg_0.flow_kwargs = arg_8\n\n        if arg_7 is None:\n            arg_7 = dictionary_storage.DictionaryStorage(\n                session, key=_CREDENTIALS_KEY)\n        arg_0.storage = arg_7\n\n        if arg_2 is None:\n            arg_2 = arg_1.config.get('GOOGLE_OAUTH2_SCOPES', _DEFAULT_SCOPES)\n        arg_0.scopes = arg_2\n\n        arg_0._load_config(arg_3, arg_4, arg_5)\n\n        arg_1.register_blueprint(arg_0._create_blueprint())", "path": "oauth2client/contrib/flask_util.py", "identifier": "UserOAuth2.init_app", "docstring": "Initialize this extension for the given app.\n\n        Arguments:\n            app: A Flask application.\n            scopes: Optional list of scopes to authorize.\n            client_secrets_file: Path to a file containing client secrets. You\n                can also specify the GOOGLE_OAUTH2_CLIENT_SECRETS_FILE config\n                value.\n            client_id: If not specifying a client secrets file, specify the\n                OAuth2 client id. You can also specify the\n                GOOGLE_OAUTH2_CLIENT_ID config value. You must also provide a\n                client secret.\n            client_secret: The OAuth2 client secret. You can also specify the\n                GOOGLE_OAUTH2_CLIENT_SECRET config value.\n            authorize_callback: A function that is executed after successful\n                user authorization.\n            storage: A oauth2client.client.Storage subclass for storing the\n                credentials. By default, this is a Flask session based storage.\n            kwargs: Any additional args are passed along to the Flow\n                constructor.", "docstring_tokens": ["Initialize", "this", "extension", "for", "the", "given", "app", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 252423}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/restsession.py#L396-L419", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Sends a PUT request.", "language": "python", "parameters": "(self, url, json=None, data=None, **kwargs)", "return_statement": "return extract_and_parse_json(response)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "arg_5", "=", "arg_4", ".", "pop", "(", "'erc'", ",", "EXPECTED_RESPONSE_CODE", "[", "'PUT'", "]", ")", "arg_6", "=", "arg_0", ".", "request", "(", "'PUT'", ",", "arg_1", ",", "arg_5", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "**", "arg_4", ")", "return", "extract_and_parse_json", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, **arg_4):\n        \"\"\"Sends a PUT request.\n\n        Args:\n            url(basestring): The URL of the API endpoint.\n            json: Data to be sent in JSON format in tbe body of the request.\n            data: Data to be sent in the body of the request.\n            **kwargs:\n                erc(int): The expected (success) response code for the request.\n                others: Passed on to the requests package.\n\n        Raises:\n            ApiError: If anything other than the expected response code is\n                returned by the Webex Teams API endpoint.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n\n        # Expected response code\n        arg_5 = arg_4.pop('erc', EXPECTED_RESPONSE_CODE['PUT'])\n\n        arg_6 = arg_0.request('PUT', arg_1, arg_5, arg_2=arg_2, arg_3=arg_3,\n                                **arg_4)\n        return extract_and_parse_json(arg_6)", "path": "webexteamssdk/restsession.py", "identifier": "RestSession.put", "docstring": "Sends a PUT request.\n\n        Args:\n            url(basestring): The URL of the API endpoint.\n            json: Data to be sent in JSON format in tbe body of the request.\n            data: Data to be sent in the body of the request.\n            **kwargs:\n                erc(int): The expected (success) response code for the request.\n                others: Passed on to the requests package.\n\n        Raises:\n            ApiError: If anything other than the expected response code is\n                returned by the Webex Teams API endpoint.", "docstring_tokens": ["Sends", "a", "PUT", "request", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 252424}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L1482-L1491", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Set context string for serial command.  Private setter.", "language": "python", "parameters": "(self, context_str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "len", "(", "arg_0", ".", "m_context", ")", "==", "0", ")", "and", "(", "len", "(", "arg_1", ")", ">=", "7", ")", ":", "if", "arg_1", "[", "0", ":", "7", "]", "!=", "\"request\"", ":", "ekm_log", "(", "\"Context: \"", "+", "arg_1", ")", "arg_0", ".", "m_context", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Set context string for serial command.  Private setter.\n\n        Args:\n            context_str (str): Command specific string.\n        \"\"\"\n        if (len(arg_0.m_context) == 0) and (len(arg_1) >= 7):\n            if arg_1[0:7] != \"request\":\n                ekm_log(\"Context: \" + arg_1)\n        arg_0.m_context = arg_1", "path": "ekmmeters.py", "identifier": "Meter.setContext", "docstring": "Set context string for serial command.  Private setter.\n\n        Args:\n            context_str (str): Command specific string.", "docstring_tokens": ["Set", "context", "string", "for", "serial", "command", ".", "Private", "setter", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 252425}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/objs.py#L764-L773", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Calls an update, but clips radii to be > 0", "language": "python", "parameters": "(self, params, values)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "listify", "(", "arg_1", ")", "arg_2", "=", "listify", "(", "arg_2", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ")", ":", "if", "(", "arg_4", "[", "-", "2", ":", "]", "==", "'-a'", ")", "and", "(", "arg_2", "[", "arg_3", "]", "<", "0", ")", ":", "arg_2", "[", "arg_3", "]", "=", "0.0", "super", "(", "PlatonicSpheresCollection", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Calls an Func, but clips radii to be > 0\"\"\"\n        # radparams = self.param_radii()\n        arg_1 = listify(arg_1)\n        arg_2 = listify(arg_2)\n        for arg_3, arg_4 in enumerate(arg_1):\n            # if (p in radparams) & (values[i] < 0):\n            if (arg_4[-2:] == '-a') and (arg_2[arg_3] < 0):\n                arg_2[arg_3] = 0.0\n        super(PlatonicSpheresCollection, arg_0).Func(arg_1, arg_2)", "path": "peri/comp/objs.py", "identifier": "PlatonicSpheresCollection.update", "docstring": "Calls an update, but clips radii to be > 0", "docstring_tokens": ["Calls", "an", "update", "but", "clips", "radii", "to", "be", ">", "0"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252426}
{"url": "https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/metrics/metric.py#L562-L587", "sha": "261e2c0760fd6a6b0ee59064180bd8e3674311fe", "docstring_summary": "plot CDF for important sub-metrics", "language": "python", "parameters": "(self, graphing_library='matplotlib')", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'matplotlib'", ")", ":", "arg_2", "=", "False", "for", "arg_3", "in", "arg_0", ".", "percentiles_files", ":", "arg_4", "=", "os", ".", "path", ".", "basename", "(", "arg_3", ")", "arg_5", "=", "arg_0", ".", "csv_column_map", "[", "arg_3", ".", "replace", "(", "\".percentiles.\"", ",", "\".\"", ")", "]", "if", "not", "arg_0", ".", "check_important_sub_metrics", "(", "arg_5", ")", ":", "continue", "arg_5", "=", "naarad", ".", "utils", ".", "sanitize_string", "(", "arg_5", ")", "arg_6", "=", "'.'", ".", "join", "(", "arg_4", ".", "split", "(", "'.'", ")", "[", "0", ":", "-", "1", "]", ")", "if", "arg_0", ".", "sub_metric_description", "and", "arg_5", "in", "arg_0", ".", "sub_metric_description", ".", "keys", "(", ")", ":", "arg_6", "+=", "' ('", "+", "arg_0", ".", "sub_metric_description", "[", "arg_5", "]", "+", "')'", "if", "arg_0", ".", "sub_metric_unit", "and", "arg_5", "in", "arg_0", ".", "sub_metric_unit", ".", "keys", "(", ")", ":", "arg_7", "=", "[", "PD", "(", "input_csv", "=", "arg_3", ",", "csv_column", "=", "1", ",", "series_name", "=", "arg_6", ",", "x_label", "=", "'Percentiles'", ",", "y_label", "=", "arg_5", "+", "' ('", "+", "arg_0", ".", "sub_metric_unit", "[", "arg_5", "]", "+", "')'", ",", "precision", "=", "None", ",", "graph_height", "=", "600", ",", "graph_width", "=", "1200", ",", "graph_type", "=", "'line'", ")", "]", "else", ":", "arg_7", "=", "[", "PD", "(", "input_csv", "=", "arg_3", ",", "csv_column", "=", "1", ",", "series_name", "=", "arg_6", ",", "x_label", "=", "'Percentiles'", ",", "y_label", "=", "arg_5", ",", "precision", "=", "None", ",", "graph_height", "=", "600", ",", "graph_width", "=", "1200", ",", "graph_type", "=", "'line'", ")", "]", "arg_2", ",", "arg_8", "=", "Metric", ".", "graphing_modules", "[", "arg_1", "]", ".", "graph_data_on_the_same_graph", "(", "arg_7", ",", "arg_0", ".", "resource_directory", ",", "arg_0", ".", "resource_path", ",", "arg_6", ")", "if", "arg_2", ":", "arg_0", ".", "plot_files", ".", "append", "(", "arg_8", ")", "return", "True"], "function": "def Func(arg_0, arg_1='matplotlib'):\n    \"\"\"\n    plot CDF for important sub-metrics\n    \"\"\"\n    arg_2 = False\n    for arg_3 in arg_0.percentiles_files:\n      arg_4 = os.path.basename(arg_3)\n      # The last element is .csv, don't need that in the name of the chart\n      arg_5 = arg_0.csv_column_map[arg_3.replace(\".percentiles.\", \".\")]\n      if not arg_0.check_important_sub_metrics(arg_5):\n        continue\n      arg_5 = naarad.utils.sanitize_string(arg_5)\n      arg_6 = '.'.join(arg_4.split('.')[0:-1])\n      if arg_0.sub_metric_description and arg_5 in arg_0.sub_metric_description.keys():\n        arg_6 += ' (' + arg_0.sub_metric_description[arg_5] + ')'\n      if arg_0.sub_metric_unit and arg_5 in arg_0.sub_metric_unit.keys():\n        arg_7 = [PD(input_csv=arg_3, csv_column=1, series_name=arg_6, x_label='Percentiles',\n                        y_label=arg_5 + ' (' + arg_0.sub_metric_unit[arg_5] + ')', precision=None, graph_height=600, graph_width=1200, graph_type='line')]\n      else:\n        arg_7 = [PD(input_csv=arg_3, csv_column=1, series_name=arg_6, x_label='Percentiles', y_label=arg_5, precision=None,\n                        graph_height=600, graph_width=1200, graph_type='line')]\n      arg_2, arg_8 = Metric.graphing_modules[arg_1].graph_data_on_the_same_graph(arg_7, arg_0.resource_directory,\n                                                                                                 arg_0.resource_path, arg_6)\n      if arg_2:\n        arg_0.plot_files.append(arg_8)\n    return True", "path": "src/naarad/metrics/metric.py", "identifier": "Metric.plot_cdf", "docstring": "plot CDF for important sub-metrics", "docstring_tokens": ["plot", "CDF", "for", "important", "sub", "-", "metrics"], "nwo": "linkedin/naarad", "score": 0.34903059417921767, "idx": 252427}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/setup.py#L23-L41", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Recursively parse requirements from nested pip files.", "language": "python", "parameters": "(req_path='./requirements.txt')", "return_statement": "return install_requires", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'./requirements.txt'", ")", ":", "arg_1", "=", "[", "]", "with", "io", ".", "open", "(", "os", ".", "path", ".", "join", "(", "here", ",", "'requirements.txt'", ")", ",", "encoding", "=", "'utf-8'", ")", "as", "handle", ":", "arg_2", "=", "(", "arg_3", ".", "strip", "(", ")", "for", "arg_3", "in", "handle", "if", "arg_3", ".", "strip", "(", ")", "and", "not", "arg_3", ".", "startswith", "(", "'#'", ")", ")", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", ".", "startswith", "(", "'-r'", ")", ":", "arg_1", "+=", "Func", "(", "arg_0", "=", "arg_3", "[", "3", ":", "]", ")", "else", ":", "arg_1", ".", "append", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0='./requirements.txt'):\n    \"\"\"Recursively parse requirements from nested pip files.\"\"\"\n    arg_1 = []\n    with io.open(os.path.join(here, 'requirements.txt'), encoding='utf-8') as handle:\n        # remove comments and empty lines\n        arg_2 = (arg_3.strip() for arg_3 in handle\n                 if arg_3.strip() and not arg_3.startswith('#'))\n\n        for arg_3 in arg_2:\n            # check for nested requirements files\n            if arg_3.startswith('-r'):\n                # recursively call this function\n                arg_1 += Func(arg_0=arg_3[3:])\n\n            else:\n                # add the line as a new requirement\n                arg_1.append(arg_3)\n\n    return arg_1", "path": "setup.py", "identifier": "parse_reqs", "docstring": "Recursively parse requirements from nested pip files.", "docstring_tokens": ["Recursively", "parse", "requirements", "from", "nested", "pip", "files", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252428}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L381-L400", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Handles package lics concluded or declared.", "language": "python", "parameters": "(self, p_term, predicate, builder_func)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "for", "arg_4", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_2", ",", "None", ")", ")", ":", "if", "(", "arg_5", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", "[", "'ConjunctiveLicenseSet'", "]", ")", "in", "arg_0", ".", "graph", ":", "arg_6", "=", "arg_0", ".", "handle_conjunctive_list", "(", "arg_5", ")", "arg_3", "(", "arg_0", ".", "doc", ",", "arg_6", ")", "elif", "(", "arg_5", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", "[", "'DisjunctiveLicenseSet'", "]", ")", "in", "arg_0", ".", "graph", ":", "arg_6", "=", "arg_0", ".", "handle_disjunctive_list", "(", "arg_5", ")", "arg_3", "(", "arg_0", ".", "doc", ",", "arg_6", ")", "else", ":", "try", ":", "arg_6", "=", "arg_0", ".", "handle_lics", "(", "arg_5", ")", "arg_3", "(", "arg_0", ".", "doc", ",", "arg_6", ")", "except", "SPDXValueError", ":", "arg_0", ".", "value_error", "(", "'PKG_SINGLE_LICS'", ",", "arg_5", ")", "except", "CardinalityError", ":", "arg_0", ".", "more_than_one_error", "(", "'package {0}'", ".", "format", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Handles package lics concluded or declared.\"\"\"\n        try:\n            for arg_4, arg_4, arg_5 in arg_0.graph.triples((arg_1, arg_2, None)):\n                if (arg_5, RDF.type, arg_0.spdx_namespace['ConjunctiveLicenseSet']) in arg_0.graph:\n                    arg_6 = arg_0.handle_conjunctive_list(arg_5)\n                    arg_3(arg_0.doc, arg_6)\n\n                elif (arg_5, RDF.type, arg_0.spdx_namespace['DisjunctiveLicenseSet']) in arg_0.graph:\n                    arg_6 = arg_0.handle_disjunctive_list(arg_5)\n                    arg_3(arg_0.doc, arg_6)\n\n                else:\n                    try:\n                        arg_6 = arg_0.handle_lics(arg_5)\n                        arg_3(arg_0.doc, arg_6)\n                    except SPDXValueError:\n                        arg_0.value_error('PKG_SINGLE_LICS', arg_5)\n        except CardinalityError:\n            arg_0.more_than_one_error('package {0}'.format(arg_2))", "path": "spdx/parsers/rdf.py", "identifier": "PackageParser.handle_pkg_lic", "docstring": "Handles package lics concluded or declared.", "docstring_tokens": ["Handles", "package", "lics", "concluded", "or", "declared", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 252429}
{"url": "https://github.com/minrk/escapism/blob/35f4c194ad6de2bc3339bb8b0e522dca989143ff/escapism.py#L91-L102", "sha": "35f4c194ad6de2bc3339bb8b0e522dca989143ff", "docstring_summary": "Unescape a string escaped with `escape`\n    \n    escape_char must be the same as that used in the call to escape.", "language": "python", "parameters": "(escaped, escape_char=ESCAPE_CHAR)", "return_statement": "return buf.decode('utf8')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "if", "isinstance", "(", "arg_0", ",", "bytes", ")", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "'utf8'", ")", "arg_3", "=", "re", ".", "compile", "(", "re", ".", "escape", "(", "arg_1", ")", ".", "encode", "(", "'utf8'", ")", "+", "b'([a-z0-9]{2})'", ",", "re", ".", "IGNORECASE", ")", "arg_4", "=", "arg_3", ".", "subn", "(", "_Func_char", ",", "arg_0", ".", "encode", "(", "'utf8'", ")", ")", "[", "0", "]", "return", "arg_4", ".", "decode", "(", "'utf8'", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"Unescape a string escaped with `escape`\n    \n    escape_char must be the same as that used in the call to escape.\n    \"\"\"\n    if isinstance(arg_0, bytes):\n        # always work on text\n        arg_0 = arg_0.decode('utf8')\n    \n    arg_3 = re.compile(re.escape(arg_1).encode('utf8') + b'([a-z0-9]{2})', re.IGNORECASE)\n    arg_4 = arg_3.subn(_Func_char, arg_0.encode('utf8'))[0]\n    return arg_4.decode('utf8')", "path": "escapism.py", "identifier": "unescape", "docstring": "Unescape a string escaped with `escape`\n    \n    escape_char must be the same as that used in the call to escape.", "docstring_tokens": ["Unescape", "a", "string", "escaped", "with", "escape", "escape_char", "must", "be", "the", "same", "as", "that", "used", "in", "the", "call", "to", "escape", "."], "nwo": "minrk/escapism", "score": 0.17385480483333982, "idx": 252430}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/abi.py#L348-L363", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Read a `nbytes` bytes long big endian signed integer from `data` starting at `offset`", "language": "python", "parameters": "(data, nbytes=32, padding=0)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "32", ",", "arg_2", "=", "0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "(", "bytearray", ",", "Array", ")", ")", "arg_3", "=", "ABI", ".", "_readBE", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", "arg_3", "=", "Operators", ".", "SEXTEND", "(", "arg_3", ",", "arg_1", "*", "8", ",", "(", "arg_1", "+", "arg_2", ")", "*", "8", ")", "if", "not", "issymbolic", "(", "arg_3", ")", ":", "if", "arg_3", "&", "(", "1", "<<", "(", "arg_1", "*", "8", "-", "1", ")", ")", ":", "arg_3", "=", "-", "(", "(", "(", "~", "arg_3", ")", "+", "1", ")", "&", "(", "(", "1", "<<", "(", "arg_1", "*", "8", ")", ")", "-", "1", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=32, arg_2=0):\n        \"\"\"\n        Read a `nbytes` bytes long big endian signed integer from `data` starting at `offset`\n\n        :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data\n        :param nbytes: number of bytes to read starting from least significant byte\n        :rtype: int or Expression\n        \"\"\"\n        assert isinstance(arg_0, (bytearray, Array))\n        arg_3 = ABI._readBE(arg_0, arg_1, arg_2=True)\n        arg_3 = Operators.SEXTEND(arg_3, arg_1 * 8, (arg_1 + arg_2) * 8)\n        if not issymbolic(arg_3):\n            # sign bit on\n            if arg_3 & (1 << (arg_1 * 8 - 1)):\n                arg_3 = -(((~arg_3) + 1) & ((1 << (arg_1 * 8)) - 1))\n        return arg_3", "path": "manticore/ethereum/abi.py", "identifier": "ABI._deserialize_int", "docstring": "Read a `nbytes` bytes long big endian signed integer from `data` starting at `offset`\n\n        :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data\n        :param nbytes: number of bytes to read starting from least significant byte\n        :rtype: int or Expression", "docstring_tokens": ["Read", "a", "nbytes", "bytes", "long", "big", "endian", "signed", "integer", "from", "data", "starting", "at", "offset"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252431}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/trust_list.py#L67-L140", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Get the filesystem path to a file that contains OpenSSL-compatible CA certs.", "language": "python", "parameters": "(temp_dir=None, cache_length=24, cert_callback=None)", "return_statement": "return ca_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "24", ",", "arg_2", "=", "None", ")", ":", "arg_3", ",", "arg_4", "=", "_ca_path", "(", "arg_0", ")", "if", "arg_4", "and", "_cached_path_needs_update", "(", "arg_3", ",", "arg_1", ")", ":", "arg_5", "=", "set", "(", ")", "arg_6", "=", "'2.5.29.37.0'", "arg_7", "=", "'1.2.840.113635.100.1.3'", "arg_8", "=", "'1.3.6.1.5.5.7.3.1'", "with", "path_lock", ":", "if", "_cached_path_needs_update", "(", "arg_3", ",", "arg_1", ")", ":", "with", "open", "(", "arg_3", ",", "'wb'", ")", "as", "f", ":", "for", "arg_9", ",", "arg_10", ",", "arg_11", "in", "extract_from_system", "(", "arg_2", ",", "True", ")", ":", "if", "sys", ".", "platform", "==", "'darwin'", ":", "if", "arg_10", "!=", "arg_5", "and", "arg_6", "not", "in", "arg_10", "and", "arg_7", "not", "in", "arg_10", ":", "if", "arg_2", ":", "arg_2", "(", "Certificate", ".", "load", "(", "arg_9", ")", ",", "'implicitly distrusted for TLS'", ")", "continue", "if", "arg_11", "!=", "arg_5", "and", "(", "arg_7", "in", "arg_11", "or", "arg_6", "in", "arg_11", ")", ":", "if", "arg_2", ":", "arg_2", "(", "Certificate", ".", "load", "(", "arg_9", ")", ",", "'explicitly distrusted for TLS'", ")", "continue", "elif", "sys", ".", "platform", "==", "'win32'", ":", "if", "arg_10", "!=", "arg_5", "and", "arg_6", "not", "in", "arg_10", "and", "arg_8", "not", "in", "arg_10", ":", "if", "arg_2", ":", "arg_2", "(", "Certificate", ".", "load", "(", "arg_9", ")", ",", "'implicitly distrusted for TLS'", ")", "continue", "if", "arg_11", "!=", "arg_5", "and", "(", "arg_8", "in", "arg_11", "or", "arg_6", "in", "arg_11", ")", ":", "if", "arg_2", ":", "arg_2", "(", "Certificate", ".", "load", "(", "arg_9", ")", ",", "'explicitly distrusted for TLS'", ")", "continue", "if", "arg_2", ":", "arg_2", "(", "Certificate", ".", "load", "(", "arg_9", ")", ",", "None", ")", "f", ".", "write", "(", "armor", "(", "'CERTIFICATE'", ",", "arg_9", ")", ")", "if", "not", "arg_3", ":", "raise", "CACertsError", "(", "'No CA certs found'", ")", "return", "arg_3"], "function": "def Func(arg_0=None, arg_1=24, arg_2=None):\n    \"\"\"\n    Get the filesystem path to a file that contains OpenSSL-compatible CA certs.\n\n    On OS X and Windows, there are extracted from the system certificate store\n    and cached in a file on the filesystem. This path should not be writable\n    by other users, otherwise they could inject CA certs into the trust list.\n\n    :param temp_dir:\n        The temporary directory to cache the CA certs in on OS X and Windows.\n        Needs to have secure permissions so other users can not modify the\n        contents.\n\n    :param cache_length:\n        The number of hours to cache the CA certs on OS X and Windows\n\n    :param cert_callback:\n        A callback that is called once for each certificate in the trust store.\n        It should accept two parameters: an asn1crypto.x509.Certificate object,\n        and a reason. The reason will be None if the certificate is being\n        exported, otherwise it will be a unicode string of the reason it won't.\n        This is only called on Windows and OS X when passed to this function.\n\n    :raises:\n        oscrypto.errors.CACertsError - when an error occurs exporting/locating certs\n\n    :return:\n        The full filesystem path to a CA certs file\n    \"\"\"\n\n    arg_3, arg_4 = _ca_path(arg_0)\n\n    # Windows and OS X\n    if arg_4 and _cached_path_needs_update(arg_3, arg_1):\n        arg_5 = set()\n\n        arg_6 = '2.5.29.37.0'\n        arg_7 = '1.2.840.113635.100.1.3'\n        arg_8 = '1.3.6.1.5.5.7.3.1'\n\n        with path_lock:\n            if _cached_path_needs_update(arg_3, arg_1):\n                with open(arg_3, 'wb') as f:\n                    for arg_9, arg_10, arg_11 in extract_from_system(arg_2, True):\n                        if sys.platform == 'darwin':\n                            if arg_10 != arg_5 and arg_6 not in arg_10 \\\n                                    and arg_7 not in arg_10:\n                                if arg_2:\n                                    arg_2(Certificate.load(arg_9), 'implicitly distrusted for TLS')\n                                continue\n                            if arg_11 != arg_5 and (arg_7 in arg_11\n                                                             or arg_6 in arg_11):\n                                if arg_2:\n                                    arg_2(Certificate.load(arg_9), 'explicitly distrusted for TLS')\n                                continue\n                        elif sys.platform == 'win32':\n                            if arg_10 != arg_5 and arg_6 not in arg_10 \\\n                                    and arg_8 not in arg_10:\n                                if arg_2:\n                                    arg_2(Certificate.load(arg_9), 'implicitly distrusted for TLS')\n                                continue\n                            if arg_11 != arg_5 and (arg_8 in arg_11\n                                                             or arg_6 in arg_11):\n                                if arg_2:\n                                    arg_2(Certificate.load(arg_9), 'explicitly distrusted for TLS')\n                                continue\n                        if arg_2:\n                            arg_2(Certificate.load(arg_9), None)\n                        f.write(armor('CERTIFICATE', arg_9))\n\n    if not arg_3:\n        raise CACertsError('No CA certs found')\n\n    return arg_3", "path": "oscrypto/trust_list.py", "identifier": "get_path", "docstring": "Get the filesystem path to a file that contains OpenSSL-compatible CA certs.\n\n    On OS X and Windows, there are extracted from the system certificate store\n    and cached in a file on the filesystem. This path should not be writable\n    by other users, otherwise they could inject CA certs into the trust list.\n\n    :param temp_dir:\n        The temporary directory to cache the CA certs in on OS X and Windows.\n        Needs to have secure permissions so other users can not modify the\n        contents.\n\n    :param cache_length:\n        The number of hours to cache the CA certs on OS X and Windows\n\n    :param cert_callback:\n        A callback that is called once for each certificate in the trust store.\n        It should accept two parameters: an asn1crypto.x509.Certificate object,\n        and a reason. The reason will be None if the certificate is being\n        exported, otherwise it will be a unicode string of the reason it won't.\n        This is only called on Windows and OS X when passed to this function.\n\n    :raises:\n        oscrypto.errors.CACertsError - when an error occurs exporting/locating certs\n\n    :return:\n        The full filesystem path to a CA certs file", "docstring_tokens": ["Get", "the", "filesystem", "path", "to", "a", "file", "that", "contains", "OpenSSL", "-", "compatible", "CA", "certs", "."], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 252432}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/k2hat.py#L493-L545", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This reads in a K2 lightcurve in CSV format. Transparently reads gzipped\n    files.", "language": "python", "parameters": "(lcfile)", "return_statement": "return lcdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'.gz'", "in", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ":", "LOGINFO", "(", "'reading gzipped K2 LC: %s'", "%", "arg_0", ")", "arg_1", "=", "gzip", ".", "open", "(", "arg_0", ",", "'rb'", ")", "else", ":", "LOGINFO", "(", "'reading K2 LC: %s'", "%", "arg_0", ")", "arg_1", "=", "open", "(", "arg_0", ",", "'rb'", ")", "arg_2", "=", "arg_1", ".", "read", "(", ")", ".", "decode", "(", ")", "arg_1", ".", "close", "(", ")", "arg_3", "=", "arg_2", ".", "index", "(", "'# LIGHTCURVE\\n'", ")", "arg_4", "=", "arg_2", "[", ":", "arg_3", "+", "12", "]", "arg_5", "=", "arg_2", "[", "arg_3", "+", "13", ":", "]", ".", "split", "(", "'\\n'", ")", "arg_5", "=", "[", "x", ".", "split", "(", "','", ")", "for", "x", "in", "arg_5", "if", "len", "(", "x", ")", ">", "0", "]", "arg_6", "=", "_parse_csv_header", "(", "arg_4", ")", "arg_5", "=", "list", "(", "zip", "(", "*", "arg_5", ")", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_6", "[", "'columns'", "]", ")", ":", "arg_6", "[", "arg_8", ".", "lower", "(", ")", "]", "=", "np", ".", "array", "(", "[", "COLUMNDEFS", "[", "arg_8", "]", "[", "2", "]", "(", "x", ")", "for", "x", "in", "arg_5", "[", "arg_7", "]", "]", ")", "arg_6", "[", "'columns'", "]", "=", "[", "x", ".", "lower", "(", ")", "for", "x", "in", "arg_6", "[", "'columns'", "]", "]", "return", "arg_6"], "function": "def Func(arg_0):\n    '''\n    This reads in a K2 lightcurve in CSV format. Transparently reads gzipped\n    files.\n\n    Parameters\n    ----------\n\n    lcfile : str\n        The light curve file to read.\n\n    Returns\n    -------\n\n    dict\n        Returns an lcdict.\n\n    '''\n\n    # read in the file first\n    if '.gz' in os.path.basename(arg_0):\n        LOGINFO('reading gzipped K2 LC: %s' % arg_0)\n        arg_1 = gzip.open(arg_0,'rb')\n    else:\n        LOGINFO('reading K2 LC: %s' % arg_0)\n        arg_1 = open(arg_0,'rb')\n\n    arg_2 = arg_1.read().decode()\n    arg_1.close()\n\n    # figure out the header and get the LC columns\n    arg_3 = arg_2.index('# LIGHTCURVE\\n')\n    arg_4 = arg_2[:arg_3+12]\n    arg_5 = arg_2[arg_3+13:].split('\\n')\n    arg_5 = [x.split(',') for x in arg_5 if len(x) > 0]\n\n    # initialize the lcdict and parse the CSV header\n    arg_6 = _parse_csv_header(arg_4)\n\n    # tranpose the LC rows into columns\n    arg_5 = list(zip(*arg_5))\n\n    # write the columns to the dict\n    for arg_7, arg_8 in enumerate(arg_6['columns']):\n\n        # this picks out the caster to use when reading each column using the\n        # definitions in the lcutils.COLUMNDEFS dictionary\n        arg_6[arg_8.lower()] = np.array([COLUMNDEFS[arg_8][2](x)\n                                        for x in arg_5[arg_7]])\n\n    arg_6['columns'] = [x.lower() for x in arg_6['columns']]\n\n    return arg_6", "path": "astrobase/hatsurveys/k2hat.py", "identifier": "read_csv_lightcurve", "docstring": "This reads in a K2 lightcurve in CSV format. Transparently reads gzipped\n    files.\n\n    Parameters\n    ----------\n\n    lcfile : str\n        The light curve file to read.\n\n    Returns\n    -------\n\n    dict\n        Returns an lcdict.", "docstring_tokens": ["This", "reads", "in", "a", "K2", "lightcurve", "in", "CSV", "format", ".", "Transparently", "reads", "gzipped", "files", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252433}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/idaho.py#L296-L360", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Create a leaflet viewer html file for viewing idaho images.", "language": "python", "parameters": "(self, idaho_image_results, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "describe_images", "(", "arg_1", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_4", "=", "''", "for", "arg_5", ",", "arg_6", "in", "arg_3", ".", "items", "(", ")", ":", "for", "arg_7", ",", "arg_8", "in", "arg_6", "[", "'parts'", "]", ".", "items", "(", ")", ":", "arg_9", "=", "len", "(", "list", "(", "arg_8", ".", "keys", "(", ")", ")", ")", "arg_10", "=", "None", "if", "arg_9", "==", "1", ":", "arg_10", "=", "[", "p", "for", "p", "in", "list", "(", "arg_8", ".", "keys", "(", ")", ")", "]", "[", "0", "]", "arg_11", "=", "''", "elif", "arg_9", "==", "2", ":", "arg_10", "=", "[", "p", "for", "p", "in", "list", "(", "arg_8", ".", "keys", "(", ")", ")", "if", "p", "is", "not", "'PAN'", "]", "[", "0", "]", "arg_11", "=", "arg_8", "[", "'PAN'", "]", "[", "'id'", "]", "if", "not", "arg_10", ":", "arg_0", ".", "logger", ".", "debug", "(", "\"Cannot find part for idaho image.\"", ")", "continue", "arg_12", "=", "{", "'RGBN'", ":", "'0,1,2'", ",", "'WORLDVIEW_8_BAND'", ":", "'4,2,1'", ",", "'PAN'", ":", "'0'", "}", ".", "get", "(", "arg_10", ",", "'0,1,2'", ")", "arg_13", "=", "arg_8", "[", "arg_10", "]", "[", "'boundstr'", "]", "arg_14", "=", "from_wkt", "(", "arg_13", ")", "arg_15", "=", "arg_8", "[", "arg_10", "]", "[", "'bucket'", "]", "arg_16", "=", "arg_8", "[", "arg_10", "]", "[", "'id'", "]", "arg_17", ",", "arg_18", ",", "arg_19", ",", "arg_20", "=", "arg_14", ".", "bounds", "arg_4", "+=", "\"addLayerToMap('%s','%s',%s,%s,%s,%s,'%s');\\n\"", "%", "(", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", ",", "arg_20", ",", "arg_11", ")", "arg_21", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", ")", "try", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_21", ",", "'leafletmap_template.html'", ")", ",", "'r'", ")", "as", "htmlfile", ":", "arg_22", "=", "htmlfile", ".", "read", "(", ")", ".", "decode", "(", "\"utf8\"", ")", "except", "AttributeError", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_21", ",", "'leafletmap_template.html'", ")", ",", "'r'", ")", "as", "htmlfile", ":", "arg_22", "=", "htmlfile", ".", "read", "(", ")", "arg_22", "=", "arg_22", ".", "replace", "(", "'FUNCTIONSTRING'", ",", "arg_4", ")", "arg_22", "=", "arg_22", ".", "replace", "(", "'CENTERLAT'", ",", "str", "(", "arg_18", ")", ")", "arg_22", "=", "arg_22", ".", "replace", "(", "'CENTERLON'", ",", "str", "(", "arg_17", ")", ")", "arg_22", "=", "arg_22", ".", "replace", "(", "'BANDS'", ",", "arg_12", ")", "arg_22", "=", "arg_22", ".", "replace", "(", "'TOKEN'", ",", "arg_0", ".", "gbdx_connection", ".", "access_token", ")", "with", "codecs", ".", "open", "(", "arg_2", ",", "'w'", ",", "'utf8'", ")", "as", "outputfile", ":", "arg_0", ".", "logger", ".", "debug", "(", "\"Saving %s\"", "%", "arg_2", ")", "outputfile", ".", "write", "(", "arg_22", ")", "else", ":", "print", "(", "'No items returned.'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Create a leaflet viewer html file for viewing idaho images.\n\n        Args:\n            idaho_image_results (dict): IDAHO image result set as returned from\n                                        the catalog.\n            filename (str): Where to save output html file.\n        \"\"\"\n\n        arg_3 = arg_0.describe_images(arg_1)\n        if len(arg_3) > 0:\n            arg_4 = ''\n            for arg_5, arg_6 in arg_3.items():\n                for arg_7, arg_8 in arg_6['parts'].items():\n\n                    arg_9 = len(list(arg_8.keys()))\n                    arg_10 = None\n                    if arg_9 == 1:\n                        # there is only one image, use the PAN\n                        arg_10 = [p for p in list(arg_8.keys())][0]\n                        arg_11 = ''\n                    elif arg_9 == 2:\n                        # there are two images in this part, use the multi (or pansharpen)\n                        arg_10 = [p for p in list(arg_8.keys()) if p is not 'PAN'][0]\n                        arg_11 = arg_8['PAN']['id']\n\n                    if not arg_10:\n                        arg_0.logger.debug(\"Cannot find part for idaho image.\")\n                        continue\n\n                    arg_12 = {\n                        'RGBN': '0,1,2',\n                        'WORLDVIEW_8_BAND': '4,2,1',\n                        'PAN': '0'\n                    }.get(arg_10, '0,1,2')\n\n                    arg_13 = arg_8[arg_10]['boundstr']\n                    arg_14 = from_wkt(arg_13)\n                    arg_15 = arg_8[arg_10]['bucket']\n                    arg_16 = arg_8[arg_10]['id']\n                    arg_17, arg_18, arg_19, arg_20 = arg_14.bounds\n\n                    arg_4 += \"addLayerToMap('%s','%s',%s,%s,%s,%s,'%s');\\n\" % (\n                        arg_15, arg_16, arg_17, arg_18, arg_19, arg_20, arg_11)\n\n            arg_21 = os.path.realpath(\n                os.path.join(os.getcwd(), os.path.dirname(__file__)))\n            try:\n                with open(os.path.join(arg_21, 'leafletmap_template.html'), 'r') as htmlfile:\n                    arg_22 = htmlfile.read().decode(\"utf8\")\n            except AttributeError:\n                with open(os.path.join(arg_21, 'leafletmap_template.html'), 'r') as htmlfile:\n                    arg_22 = htmlfile.read()\n\n            arg_22 = arg_22.replace('FUNCTIONSTRING', arg_4)\n            arg_22 = arg_22.replace('CENTERLAT', str(arg_18))\n            arg_22 = arg_22.replace('CENTERLON', str(arg_17))\n            arg_22 = arg_22.replace('BANDS', arg_12)\n            arg_22 = arg_22.replace('TOKEN', arg_0.gbdx_connection.access_token)\n\n            with codecs.open(arg_2, 'w', 'utf8') as outputfile:\n                arg_0.logger.debug(\"Saving %s\" % arg_2)\n                outputfile.write(arg_22)\n        else:\n            print('No items returned.')", "path": "gbdxtools/idaho.py", "identifier": "Idaho.create_leaflet_viewer", "docstring": "Create a leaflet viewer html file for viewing idaho images.\n\n        Args:\n            idaho_image_results (dict): IDAHO image result set as returned from\n                                        the catalog.\n            filename (str): Where to save output html file.", "docstring_tokens": ["Create", "a", "leaflet", "viewer", "html", "file", "for", "viewing", "idaho", "images", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 252434}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/fetcher.py#L309-L326", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Fetch commit data for specified event.", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "github", "arg_3", "=", "arg_0", ".", "options", ".", "user", "arg_4", "=", "arg_0", ".", "options", ".", "project", "arg_5", ",", "arg_6", "=", "arg_2", ".", "repos", "[", "arg_3", "]", "[", "arg_4", "]", ".", "git", ".", "commits", "[", "arg_1", "[", "\"commit_id\"", "]", "]", ".", "get", "(", ")", "if", "arg_5", "==", "200", ":", "return", "arg_6", "arg_0", ".", "raise_GitHubError", "(", "arg_5", ",", "arg_6", ",", "arg_2", ".", "getheaders", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Fetch commit data for specified event.\n\n        :param dict event: dictionary with event information\n        :rtype: dict\n        :return: dictionary with commit data\n        \"\"\"\n\n        arg_2 = arg_0.github\n        arg_3 = arg_0.options.user\n        arg_4 = arg_0.options.project\n\n        arg_5, arg_6 = arg_2.repos[arg_3][arg_4].git.commits[\n            arg_1[\"commit_id\"]].get()\n        if arg_5 == 200:\n            return arg_6\n        arg_0.raise_GitHubError(arg_5, arg_6, arg_2.getheaders())", "path": "pygcgen/fetcher.py", "identifier": "Fetcher.fetch_commit", "docstring": "Fetch commit data for specified event.\n\n        :param dict event: dictionary with event information\n        :rtype: dict\n        :return: dictionary with commit data", "docstring_tokens": ["Fetch", "commit", "data", "for", "specified", "event", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 252435}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/parentpoller.py#L100-L139", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Run the poll loop. This method never returns.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "from", "_winapi", "import", "WAIT_OBJECT_0", ",", "INFINITE", "except", "ImportError", ":", "from", "_subprocess", "import", "WAIT_OBJECT_0", ",", "INFINITE", "arg_1", "=", "[", "]", "if", "arg_0", ".", "interrupt_handle", ":", "arg_1", ".", "append", "(", "arg_0", ".", "interrupt_handle", ")", "if", "arg_0", ".", "parent_handle", ":", "arg_1", ".", "append", "(", "arg_0", ".", "parent_handle", ")", "arg_2", "=", "platform", ".", "architecture", "(", ")", "[", "0", "]", "arg_3", "=", "ctypes", ".", "c_int64", "if", "arg_2", ".", "startswith", "(", "'64'", ")", "else", "ctypes", ".", "c_int", "while", "True", ":", "arg_4", "=", "ctypes", ".", "windll", ".", "kernel32", ".", "WaitForMultipleObjects", "(", "len", "(", "arg_1", ")", ",", "(", "arg_3", "*", "len", "(", "arg_1", ")", ")", "(", "*", "arg_1", ")", ",", "False", ",", "INFINITE", ")", "if", "WAIT_OBJECT_0", "<=", "arg_4", "<", "len", "(", "arg_1", ")", ":", "arg_5", "=", "arg_1", "[", "arg_4", "-", "WAIT_OBJECT_0", "]", "if", "arg_5", "==", "arg_0", ".", "interrupt_handle", ":", "interrupt_main", "(", ")", "elif", "arg_5", "==", "arg_0", ".", "parent_handle", ":", "os", ".", "_exit", "(", "1", ")", "elif", "arg_4", "<", "0", ":", "warn", "(", "\"\"\"Parent poll failed.  If the frontend dies,                the kernel may be left Funcning.  Please let us know                about your system (bitness, Python, etc.) at                ipython-dev@scipy.org\"\"\"", ")", "return"], "function": "def Func(arg_0):\n        \"\"\" Run the poll loop. This method never returns.\n        \"\"\"\n        try:\n            from _winapi import WAIT_OBJECT_0, INFINITE\n        except ImportError:\n            from _subprocess import WAIT_OBJECT_0, INFINITE\n\n        # Build the list of handle to listen on.\n        arg_1 = []\n        if arg_0.interrupt_handle:\n            arg_1.append(arg_0.interrupt_handle)\n        if arg_0.parent_handle:\n            arg_1.append(arg_0.parent_handle)\n        arg_2 = platform.architecture()[0]\n        arg_3 = ctypes.c_int64 if arg_2.startswith('64') else ctypes.c_int\n\n        # Listen forever.\n        while True:\n            arg_4 = ctypes.windll.kernel32.WaitForMultipleObjects(\n                len(arg_1),                            # nCount\n                (arg_3 * len(arg_1))(*arg_1),        # lpHandles\n                False,                                   # bWaitAll\n                INFINITE)                                # dwMilliseconds\n\n            if WAIT_OBJECT_0 <= arg_4 < len(arg_1):\n                arg_5 = arg_1[arg_4 - WAIT_OBJECT_0]\n\n                if arg_5 == arg_0.interrupt_handle:\n                    interrupt_main()\n\n                elif arg_5 == arg_0.parent_handle:\n                    os._exit(1)\n            elif arg_4 < 0:\n                # wait failed, just give up and stop polling.\n                warn(\"\"\"Parent poll failed.  If the frontend dies,\n                the kernel may be left Funcning.  Please let us know\n                about your system (bitness, Python, etc.) at\n                ipython-dev@scipy.org\"\"\")\n                return", "path": "environment/lib/python2.7/site-packages/IPython/zmq/parentpoller.py", "identifier": "ParentPollerWindows.run", "docstring": "Run the poll loop. This method never returns.", "docstring_tokens": ["Run", "the", "poll", "loop", ".", "This", "method", "never", "returns", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252436}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/bezier.py#L92-L98", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Append a render function and the parameters to pass\n        an equivilent PathElement, or the PathElement itself.", "language": "python", "parameters": "(self, render_func, pe)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_render_funcs", ".", "append", "(", "arg_1", ")", "arg_0", ".", "_elements", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Append a render function and the parameters to pass\n        an equivilent PathElement, or the PathElement itself.\n        '''\n        arg_0._render_funcs.append(arg_1)\n        arg_0._elements.append(arg_2)", "path": "shoebot/data/bezier.py", "identifier": "BezierPath._append_element", "docstring": "Append a render function and the parameters to pass\n        an equivilent PathElement, or the PathElement itself.", "docstring_tokens": ["Append", "a", "render", "function", "and", "the", "parameters", "to", "pass", "an", "equivilent", "PathElement", "or", "the", "PathElement", "itself", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252437}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L851-L889", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the UsernamePasswordCredential struct and\n        decode it into its constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "UsernamePasswordCredential", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "USERNAME", ",", "arg_6", ")", ":", "arg_0", ".", "_username", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "USERNAME", ")", "arg_0", ".", "_username", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Username/password credential encoding missing the username.\"", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PASSWORD", ",", "arg_6", ")", ":", "arg_0", ".", "_password", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PASSWORD", ")", "arg_0", ".", "_password", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the UsernamePasswordCredential struct and\n        decode it into its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the username is missing from the encoding.\n        \"\"\"\n        super(UsernamePasswordCredential, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.USERNAME, arg_6):\n            arg_0._username = primitives.TextString(\n                tag=arg_3.Tags.USERNAME\n            )\n            arg_0._username.Func(arg_6, arg_2=arg_2)\n        else:\n            raise ValueError(\n                \"Username/password credential encoding missing the username.\"\n            )\n\n        if arg_0.is_tag_next(arg_3.Tags.PASSWORD, arg_6):\n            arg_0._password = primitives.TextString(\n                tag=arg_3.Tags.PASSWORD\n            )\n            arg_0._password.Func(arg_6, arg_2=arg_2)\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/objects.py", "identifier": "UsernamePasswordCredential.read", "docstring": "Read the data encoding the UsernamePasswordCredential struct and\n        decode it into its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the username is missing from the encoding.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "UsernamePasswordCredential", "struct", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 252438}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L1939-L1961", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "File upload functionality", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"success\"", ":", "[", "]", ",", "\"failure\"", ":", "[", "]", ",", "\"unchanged\"", ":", "[", "]", "}", "arg_0", ".", "_create_prelim", "(", ")", "for", "arg_2", "in", "arg_0", ".", "payload", ":", "if", "\"key\"", "not", "in", "arg_2", ":", "arg_1", "[", "\"failure\"", "]", ".", "append", "(", "arg_2", ")", "continue", "arg_3", "=", "str", "(", "arg_0", ".", "basedir", ".", "joinpath", "(", "arg_2", "[", "\"filename\"", "]", ")", ")", "arg_4", "=", "arg_0", ".", "_get_auth", "(", "arg_3", ",", "arg_2", "[", "\"key\"", "]", ",", "md5", "=", "arg_2", ".", "get", "(", "\"md5\"", ",", "None", ")", ")", "if", "arg_4", ".", "get", "(", "\"exists\"", ")", ":", "arg_1", "[", "\"unchanged\"", "]", ".", "append", "(", "arg_2", ")", "continue", "arg_0", ".", "_Func_file", "(", "arg_4", ",", "arg_3", ",", "arg_2", "[", "\"key\"", "]", ")", "arg_1", "[", "\"success\"", "]", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        File Func functionality\n\n        Goes through Func steps 0 - 3 (private class methods), and returns\n        a dict noting success, failure, or unchanged\n        (returning the payload entries with that property as a list for each status)\n        \"\"\"\n        arg_1 = {\"success\": [], \"failure\": [], \"unchanged\": []}\n        arg_0._create_prelim()\n        for arg_2 in arg_0.payload:\n            if \"key\" not in arg_2:\n                arg_1[\"failure\"].append(arg_2)\n                continue\n            arg_3 = str(arg_0.basedir.joinpath(arg_2[\"filename\"]))\n            arg_4 = arg_0._get_auth(arg_3, arg_2[\"key\"], md5=arg_2.get(\"md5\", None))\n            # no need to keep going if the file exists\n            if arg_4.get(\"exists\"):\n                arg_1[\"unchanged\"].append(arg_2)\n                continue\n            arg_0._Func_file(arg_4, arg_3, arg_2[\"key\"])\n            arg_1[\"success\"].append(arg_2)\n        return arg_1", "path": "pyzotero/zotero.py", "identifier": "Zupload.upload", "docstring": "File upload functionality\n\n        Goes through upload steps 0 - 3 (private class methods), and returns\n        a dict noting success, failure, or unchanged\n        (returning the payload entries with that property as a list for each status)", "docstring_tokens": ["File", "upload", "functionality"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 252439}
{"url": "https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/examples/02_food.py#L56-L58", "sha": "48c842fe053bf9cd6446c4b33fb081c65339aa48", "docstring_summary": "Say something in the evening", "language": "python", "parameters": "(self, message=\"Dinner is served\", shout: bool = False)", "return_statement": "return self.helper.output(message, shout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Dinner is served\"", ",", "arg_2", ":", "arg_3", "=", "False", ")", ":", "return", "arg_0", ".", "helper", ".", "output", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=\"Dinner is served\", arg_2: arg_3 = False):\n        \"\"\"Say something in the evening\"\"\"\n        return arg_0.helper.output(arg_1, arg_2)", "path": "examples/02_food.py", "identifier": "Food.dinner", "docstring": "Say something in the evening", "docstring_tokens": ["Say", "something", "in", "the", "evening"], "nwo": "yaz/yaz", "score": 0.138843686048881, "idx": 252440}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5889-L5916", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "This method determines if we should apply our namespace indentation check.", "language": "python", "parameters": "(nesting_state, is_namespace_indent_item,\n                                    raw_lines_no_comments, linenum)", "return_statement": "return IsBlockInNameSpace(nesting_state, is_forward_declaration)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "IsForwardClassDeclaration", "(", "arg_2", ",", "arg_3", ")", "if", "not", "(", "arg_1", "or", "arg_4", ")", ":", "return", "False", "if", "IsMacroDefinition", "(", "arg_2", ",", "arg_3", ")", ":", "return", "False", "return", "IsBlockInNameSpace", "(", "arg_0", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1,\n                                    arg_2, arg_3):\n  \"\"\"This method determines if we should apply our namespace indentation check.\n\n  Args:\n    nesting_state: The current nesting state.\n    is_namespace_indent_item: If we just put a new class on the stack, True.\n      If the top of the stack is not a class, or we did not recently\n      add the class, False.\n    raw_lines_no_comments: The lines without the comments.\n    linenum: The current line number we are processing.\n\n  Returns:\n    True if we should apply our namespace indentation check. Currently, it\n    only works for classes and namespaces inside of a namespace.\n  \"\"\"\n\n  arg_4 = IsForwardClassDeclaration(arg_2,\n                                                     arg_3)\n\n  if not (arg_1 or arg_4):\n    return False\n\n  # If we are in a macro, we do not want to check the namespace indentation.\n  if IsMacroDefinition(arg_2, arg_3):\n    return False\n\n  return IsBlockInNameSpace(arg_0, arg_4)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "ShouldCheckNamespaceIndentation", "docstring": "This method determines if we should apply our namespace indentation check.\n\n  Args:\n    nesting_state: The current nesting state.\n    is_namespace_indent_item: If we just put a new class on the stack, True.\n      If the top of the stack is not a class, or we did not recently\n      add the class, False.\n    raw_lines_no_comments: The lines without the comments.\n    linenum: The current line number we are processing.\n\n  Returns:\n    True if we should apply our namespace indentation check. Currently, it\n    only works for classes and namespaces inside of a namespace.", "docstring_tokens": ["This", "method", "determines", "if", "we", "should", "apply", "our", "namespace", "indentation", "check", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252441}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/cache/security_groups_client.py#L49-L93", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Creates a payload for the redis server.", "language": "python", "parameters": "(self, rules)", "return_statement": "return serialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_3", "[", "\"direction\"", "]", "arg_5", "=", "''", "arg_6", "=", "''", "if", "arg_3", ".", "get", "(", "\"remote_ip_prefix\"", ")", ":", "arg_7", "=", "arg_3", "[", "\"remote_ip_prefix\"", "]", "if", "arg_4", "==", "\"ingress\"", ":", "arg_5", "=", "arg_0", ".", "_convert_remote_network", "(", "arg_7", ")", "else", ":", "if", "(", "Capabilities", ".", "EGRESS", "not", "in", "CONF", ".", "QUARK", ".", "environment_capabilities", ")", ":", "raise", "q_exc", ".", "EgressSecurityGroupRulesNotEnabled", "(", ")", "else", ":", "arg_6", "=", "arg_0", ".", "_convert_remote_network", "(", "arg_7", ")", "arg_8", "=", "{", "}", "arg_9", "=", "protocols", ".", "PROTOCOL_MAP", "[", "arg_3", "[", "\"ethertype\"", "]", "]", "if", "arg_3", "[", "\"protocol\"", "]", "==", "arg_9", "[", "\"icmp\"", "]", ":", "arg_8", "[", "\"icmp type\"", "]", "=", "arg_3", "[", "\"port_range_min\"", "]", "arg_8", "[", "\"icmp code\"", "]", "=", "arg_3", "[", "\"port_range_max\"", "]", "else", ":", "arg_8", "[", "\"port start\"", "]", "=", "arg_3", "[", "\"port_range_min\"", "]", "arg_8", "[", "\"port end\"", "]", "=", "arg_3", "[", "\"port_range_max\"", "]", "arg_10", "=", "{", "\"ethertype\"", ":", "arg_3", "[", "\"ethertype\"", "]", ",", "\"protocol\"", ":", "arg_3", "[", "\"protocol\"", "]", ",", "\"source network\"", ":", "arg_5", ",", "\"destination network\"", ":", "arg_6", ",", "\"action\"", ":", "\"allow\"", ",", "\"direction\"", ":", "arg_4", "}", "arg_10", ".", "update", "(", "arg_8", ")", "arg_2", ".", "append", "(", "arg_10", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Creates a payload for the redis server.\"\"\"\n        # TODO(mdietz): If/when we support other rule types, this comment\n        #               will have to be revised.\n        # Action and direction are static, for now. The implementation may\n        # support 'deny' and 'egress' respectively in the future. We allow\n        # the direction to be set to something else, technically, but current\n        # plugin level call actually raises. It's supported here for unit\n        # test purposes at this time\n        arg_2 = []\n        for arg_3 in arg_1:\n            arg_4 = arg_3[\"direction\"]\n            arg_5 = ''\n            arg_6 = ''\n            if arg_3.get(\"remote_ip_prefix\"):\n                arg_7 = arg_3[\"remote_ip_prefix\"]\n                if arg_4 == \"ingress\":\n                    arg_5 = arg_0._convert_remote_network(arg_7)\n                else:\n                    if (Capabilities.EGRESS not in\n                            CONF.QUARK.environment_capabilities):\n                        raise q_exc.EgressSecurityGroupRulesNotEnabled()\n                    else:\n                        arg_6 = arg_0._convert_remote_network(arg_7)\n\n            arg_8 = {}\n\n            # NOTE(mdietz): this will expand as we add more protocols\n            arg_9 = protocols.PROTOCOL_MAP[arg_3[\"ethertype\"]]\n            if arg_3[\"protocol\"] == arg_9[\"icmp\"]:\n                arg_8[\"icmp type\"] = arg_3[\"port_range_min\"]\n                arg_8[\"icmp code\"] = arg_3[\"port_range_max\"]\n            else:\n                arg_8[\"port start\"] = arg_3[\"port_range_min\"]\n                arg_8[\"port end\"] = arg_3[\"port_range_max\"]\n\n            arg_10 = {\"ethertype\": arg_3[\"ethertype\"],\n                       \"protocol\": arg_3[\"protocol\"],\n                       \"source network\": arg_5,\n                       \"destination network\": arg_6,\n                       \"action\": \"allow\",\n                       \"direction\": arg_4}\n            arg_10.update(arg_8)\n            arg_2.append(arg_10)\n        return arg_2", "path": "quark/cache/security_groups_client.py", "identifier": "SecurityGroupsClient.serialize_rules", "docstring": "Creates a payload for the redis server.", "docstring_tokens": ["Creates", "a", "payload", "for", "the", "redis", "server", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 252442}
{"url": "https://github.com/geopython/OWSLib/blob/96d47842401a129f1e86fa9f66dccef5a5a6872c/owslib/swe/observation/waterml2.py#L36-L41", "sha": "96d47842401a129f1e86fa9f66dccef5a5a6872c", "docstring_summary": "Parse the result element of the observation type", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "result", "is", "not", "None", ":", "arg_1", "=", "arg_0", ".", "result", ".", "find", "(", "nspv", "(", "\"wml2:MeasurementTimeseries\"", ")", ")", "arg_0", ".", "result", "=", "MeasurementTimeseries", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        ''' Parse the result element of the observation type '''\n        if arg_0.result is not None:\n            arg_1 = arg_0.result.find(nspv(\n                     \"wml2:MeasurementTimeseries\"))\n            arg_0.result = MeasurementTimeseries(arg_1)", "path": "owslib/swe/observation/waterml2.py", "identifier": "MeasurementTimeseriesObservation._parse_result", "docstring": "Parse the result element of the observation type", "docstring_tokens": ["Parse", "the", "result", "element", "of", "the", "observation", "type"], "nwo": "geopython/OWSLib", "score": 0.9295808138080248, "idx": 252443}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/mapping/barrier_before_final_measurements.py#L25-L76", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a circuit with a barrier before last measurements.", "language": "python", "parameters": "(self, dag)", "return_statement": "return adjacent_pass.run(dag)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "'measure'", ",", "'barrier'", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ".", "named_nodes", "(", "*", "arg_2", ")", ":", "arg_5", "=", "True", "for", "arg_6", ",", "arg_7", "in", "arg_1", ".", "bfs_successors", "(", "arg_4", ")", ":", "if", "any", "(", "arg_8", ".", "type", "==", "'op'", "and", "arg_8", ".", "name", "not", "in", "arg_2", "for", "arg_8", "in", "arg_7", ")", ":", "arg_5", "=", "False", "break", "if", "arg_5", ":", "arg_3", ".", "append", "(", "arg_4", ")", "if", "not", "arg_3", ":", "return", "arg_1", "arg_9", "=", "DAGCircuit", "(", ")", "for", "arg_10", "in", "arg_1", ".", "qregs", ".", "values", "(", ")", ":", "arg_9", ".", "add_qreg", "(", "arg_10", ")", "for", "arg_11", "in", "arg_1", ".", "cregs", ".", "values", "(", ")", ":", "arg_9", ".", "add_creg", "(", "arg_11", ")", "arg_12", "=", "set", "(", "arg_15", ".", "qargs", "[", "0", "]", "for", "arg_15", "in", "arg_3", ")", "arg_9", ".", "apply_operation_back", "(", "Barrier", "(", "len", "(", "arg_12", ")", ")", ",", "list", "(", "arg_12", ")", ",", "[", "]", ")", "arg_13", "=", "[", "node", "for", "node", "in", "arg_1", ".", "topological_op_nodes", "(", ")", "if", "node", "in", "set", "(", "arg_3", ")", "]", "for", "arg_14", "in", "arg_13", ":", "arg_9", ".", "apply_operation_back", "(", "arg_14", ".", "op", ",", "arg_14", ".", "qargs", ",", "arg_14", ".", "cargs", ")", "for", "arg_15", "in", "arg_3", ":", "arg_1", ".", "remove_op_node", "(", "arg_15", ")", "arg_1", ".", "extend_back", "(", "arg_9", ")", "arg_16", "=", "MergeAdjacentBarriers", "(", ")", "return", "arg_16", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a circuit with a barrier before last measurements.\"\"\"\n\n        # Collect DAG nodes which are followed only by barriers or other measures.\n        arg_2 = ['measure', 'barrier']\n        arg_3 = []\n        for arg_4 in arg_1.named_nodes(*arg_2):\n            arg_5 = True\n\n            for arg_6, arg_7 in arg_1.bfs_successors(arg_4):\n\n                if any(arg_8.type == 'op' and arg_8.name not in arg_2\n                       for arg_8 in arg_7):\n                    arg_5 = False\n                    break\n\n            if arg_5:\n                arg_3.append(arg_4)\n\n        if not arg_3:\n            return arg_1\n\n        # Create a layer with the barrier and add registers from the original dag.\n        arg_9 = DAGCircuit()\n        for arg_10 in arg_1.qregs.values():\n            arg_9.add_qreg(arg_10)\n        for arg_11 in arg_1.cregs.values():\n            arg_9.add_creg(arg_11)\n\n        arg_12 = set(arg_15.qargs[0] for arg_15 in arg_3)\n\n        arg_9.apply_operation_back(\n            Barrier(len(arg_12)), list(arg_12), [])\n\n        # Preserve order of final ops collected earlier from the original DAG.\n        arg_13 = [node for node in arg_1.topological_op_nodes()\n                               if node in set(arg_3)]\n\n        # Move final ops to the new layer and append the new layer to the DAG.\n        for arg_14 in arg_13:\n            arg_9.apply_operation_back(arg_14.op,\n                                               arg_14.qargs,\n                                               arg_14.cargs)\n\n        for arg_15 in arg_3:\n            arg_1.remove_op_node(arg_15)\n\n        arg_1.extend_back(arg_9)\n\n        # Merge the new barrier into any other barriers\n        arg_16 = MergeAdjacentBarriers()\n        return arg_16.Func(arg_1)", "path": "qiskit/transpiler/passes/mapping/barrier_before_final_measurements.py", "identifier": "BarrierBeforeFinalMeasurements.run", "docstring": "Return a circuit with a barrier before last measurements.", "docstring_tokens": ["Return", "a", "circuit", "with", "a", "barrier", "before", "last", "measurements", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252444}
{"url": "https://github.com/nephila/djangocms-installer/blob/9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e/djangocms_installer/config/ini.py#L96-L123", "sha": "9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e", "docstring_summary": "Convert config options to stdin args.", "language": "python", "parameters": "(config, parser)", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "'--extra-settings'", ",", "'--languages'", ",", "'--requirements'", ",", "'--template'", ",", "'--timezone'", ")", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "items", "(", "SECTION", ")", ":", "arg_6", "=", "'--{0}'", ".", "format", "(", "arg_4", ")", "arg_7", "=", "arg_1", ".", "_option_string_actions", "[", "arg_6", "]", "if", "arg_7", ".", "const", ":", "try", ":", "if", "arg_0", ".", "getboolean", "(", "SECTION", ",", "arg_4", ")", ":", "arg_3", ".", "append", "(", "arg_6", ")", "except", "ValueError", ":", "arg_3", ".", "extend", "(", "[", "arg_6", ",", "arg_5", "]", ")", "elif", "any", "(", "[", "arg_8", "for", "arg_8", "in", "arg_2", "if", "arg_8", "in", "arg_7", ".", "option_strings", "]", ")", ":", "if", "arg_5", "!=", "''", ":", "arg_3", ".", "extend", "(", "[", "arg_6", ",", "arg_5", "]", ")", "else", ":", "arg_3", ".", "extend", "(", "[", "arg_6", ",", "arg_5", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Convert config options to stdin args.\n\n    Especially boolean values, for more information\n    @see https://docs.python.org/3.4/library/configparser.html#supported-datatypes\n    \"\"\"\n    arg_2 = (\n        '--extra-settings', '--languages', '--requirements', '--template', '--timezone')\n    arg_3 = []\n    for arg_4, arg_5 in arg_0.items(SECTION):\n        arg_6 = '--{0}'.format(arg_4)\n        arg_7 = arg_1._option_string_actions[arg_6]\n\n        if arg_7.const:\n            try:\n                if arg_0.getboolean(SECTION, arg_4):\n                    arg_3.append(arg_6)\n            except ValueError:\n                arg_3.extend([arg_6, arg_5])  # Pass it as is to get the error from ArgumentParser.\n        elif any([arg_8 for arg_8 in arg_2 if arg_8 in arg_7.option_strings]):\n            # Some keys with empty values shouldn't be passed into args to use their defaults\n            # from ArgumentParser.\n            if arg_5 != '':\n                arg_3.extend([arg_6, arg_5])\n        else:\n            arg_3.extend([arg_6, arg_5])\n\n    return arg_3", "path": "djangocms_installer/config/ini.py", "identifier": "_convert_config_to_stdin", "docstring": "Convert config options to stdin args.\n\n    Especially boolean values, for more information\n    @see https://docs.python.org/3.4/library/configparser.html#supported-datatypes", "docstring_tokens": ["Convert", "config", "options", "to", "stdin", "args", "."], "nwo": "nephila/djangocms-installer", "score": 0.7157994486187137, "idx": 252445}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/math.py#L7-L24", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Basic mathematical operation to apply operator on `column_1` and `column_2`\n    Both can be either a number or the name of a column of `df`\n    Will create a new column named `new_column`", "language": "python", "parameters": "(df, new_column, column_1, column_2, op)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "not", "isinstance", "(", "arg_2", ",", "(", "str", ",", "int", ",", "float", ")", ")", ":", "raise", "TypeError", "(", "f'column_1 must be a string, an integer or a float'", ")", "if", "not", "isinstance", "(", "arg_3", ",", "(", "str", ",", "int", ",", "float", ")", ")", ":", "raise", "TypeError", "(", "f'column_2 must be a string, an integer or a float'", ")", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_2", "=", "arg_0", "[", "arg_2", "]", "if", "isinstance", "(", "arg_3", ",", "str", ")", ":", "arg_3", "=", "arg_0", "[", "arg_3", "]", "arg_5", "=", "getattr", "(", "_operator", ",", "arg_4", ")", "arg_0", "[", "arg_1", "]", "=", "arg_5", "(", "arg_2", ",", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Basic mathematical operation to apply operator on `column_1` and `column_2`\n    Both can be either a number or the name of a column of `df`\n    Will create a new column named `new_column`\n    \"\"\"\n    if not isinstance(arg_2, (str, int, float)):\n        raise TypeError(f'column_1 must be a string, an integer or a float')\n    if not isinstance(arg_3, (str, int, float)):\n        raise TypeError(f'column_2 must be a string, an integer or a float')\n\n    if isinstance(arg_2, str):\n        arg_2 = arg_0[arg_2]\n    if isinstance(arg_3, str):\n        arg_3 = arg_0[arg_3]\n    arg_5 = getattr(_operator, arg_4)\n    arg_0[arg_1] = arg_5(arg_2, arg_3)\n    return arg_0", "path": "toucan_data_sdk/utils/postprocess/math.py", "identifier": "_basic_math_operation", "docstring": "Basic mathematical operation to apply operator on `column_1` and `column_2`\n    Both can be either a number or the name of a column of `df`\n    Will create a new column named `new_column`", "docstring_tokens": ["Basic", "mathematical", "operation", "to", "apply", "operator", "on", "column_1", "and", "column_2", "Both", "can", "be", "either", "a", "number", "or", "the", "name", "of", "a", "column", "of", "df", "Will", "create", "a", "new", "column", "named", "new_column"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 252446}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/heatmaps.py#L409-L441", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Create a heatmaps object from an heatmap array containing values ranging from 0 to 255.", "language": "python", "parameters": "(arr_uint8, shape, min_value=0.0, max_value=1.0)", "return_statement": "return HeatmapsOnImage.from_0to1(arr_0to1, shape, min_value=min_value, max_value=max_value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.0", ",", "arg_3", "=", "1.0", ")", ":", "arg_4", "=", "arg_0", ".", "astype", "(", "np", ".", "float32", ")", "/", "255.0", "return", "HeatmapsOnImage", ".", "from_0to1", "(", "arg_4", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.0, arg_3=1.0):\n        \"\"\"\n        Create a heatmaps object from an heatmap array containing values ranging from 0 to 255.\n\n        Parameters\n        ----------\n        arr_uint8 : (H,W) ndarray or (H,W,C) ndarray\n            Heatmap(s) array, where ``H`` is height, ``W`` is width and ``C`` is the number of heatmap channels.\n            Expected dtype is uint8.\n\n        shape : tuple of int\n            Shape of the image on which the heatmap(s) is/are placed. NOT the shape of the\n            heatmap(s) array, unless it is identical to the image shape (note the likely\n            difference between the arrays in the number of channels).\n            If there is not a corresponding image, use the shape of the heatmaps array.\n\n        min_value : float, optional\n            Minimum value for the heatmaps that the 0-to-255 array represents. This will usually\n            be 0.0. It is used when calling :func:`imgaug.HeatmapsOnImage.get_arr`, which converts the\n            underlying ``(0, 255)`` array to value range ``(min_value, max_value)``.\n\n        max_value : float, optional\n            Maximum value for the heatmaps that 0-to-255 array represents.\n            See parameter `min_value` for details.\n\n        Returns\n        -------\n        imgaug.HeatmapsOnImage\n            Heatmaps object.\n\n        \"\"\"\n        arg_4 = arg_0.astype(np.float32) / 255.0\n        return HeatmapsOnImage.from_0to1(arg_4, arg_1, arg_2=arg_2, arg_3=arg_3)", "path": "imgaug/augmentables/heatmaps.py", "identifier": "HeatmapsOnImage.from_uint8", "docstring": "Create a heatmaps object from an heatmap array containing values ranging from 0 to 255.\n\n        Parameters\n        ----------\n        arr_uint8 : (H,W) ndarray or (H,W,C) ndarray\n            Heatmap(s) array, where ``H`` is height, ``W`` is width and ``C`` is the number of heatmap channels.\n            Expected dtype is uint8.\n\n        shape : tuple of int\n            Shape of the image on which the heatmap(s) is/are placed. NOT the shape of the\n            heatmap(s) array, unless it is identical to the image shape (note the likely\n            difference between the arrays in the number of channels).\n            If there is not a corresponding image, use the shape of the heatmaps array.\n\n        min_value : float, optional\n            Minimum value for the heatmaps that the 0-to-255 array represents. This will usually\n            be 0.0. It is used when calling :func:`imgaug.HeatmapsOnImage.get_arr`, which converts the\n            underlying ``(0, 255)`` array to value range ``(min_value, max_value)``.\n\n        max_value : float, optional\n            Maximum value for the heatmaps that 0-to-255 array represents.\n            See parameter `min_value` for details.\n\n        Returns\n        -------\n        imgaug.HeatmapsOnImage\n            Heatmaps object.", "docstring_tokens": ["Create", "a", "heatmaps", "object", "from", "an", "heatmap", "array", "containing", "values", "ranging", "from", "0", "to", "255", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 252447}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L161-L180", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Find and return the topology given its cluster, environ, topology name, and\n    an optional role.\n    Raises exception if topology is not found, or more than one are found.", "language": "python", "parameters": "(self, cluster, role, environ, topologyName)", "return_statement": "return topologies[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "list", "(", "filter", "(", "lambda", "t", ":", "t", ".", "name", "==", "arg_4", "and", "t", ".", "cluster", "==", "arg_1", "and", "(", "not", "arg_2", "or", "t", ".", "execution_state", ".", "role", "==", "arg_2", ")", "and", "t", ".", "environ", "==", "arg_3", ",", "arg_0", ".", "topologies", ")", ")", "if", "not", "arg_5", "or", "len", "(", "arg_5", ")", ">", "1", ":", "if", "arg_2", "is", "not", "None", ":", "raise", "Exception", "(", "\"Topology not found for {0}, {1}, {2}, {3}\"", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "else", ":", "raise", "Exception", "(", "\"Topology not found for {0}, {1}, {2}\"", ".", "format", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", ")", "return", "arg_5", "[", "0", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Find and return the topology given its cluster, environ, topology name, and\n    an optional role.\n    Raises exception if topology is not found, or more than one are found.\n    \"\"\"\n    arg_5 = list(filter(lambda t: t.name == arg_4\n                             and t.cluster == arg_1\n                             and (not arg_2 or t.execution_state.role == arg_2)\n                             and t.environ == arg_3, arg_0.topologies))\n    if not arg_5 or len(arg_5) > 1:\n      if arg_2 is not None:\n        raise Exception(\"Topology not found for {0}, {1}, {2}, {3}\".format(\n            arg_1, arg_2, arg_3, arg_4))\n      else:\n        raise Exception(\"Topology not found for {0}, {1}, {2}\".format(\n            arg_1, arg_3, arg_4))\n\n    # There is only one topology which is returned.\n    return arg_5[0]", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "Tracker.getTopologyByClusterRoleEnvironAndName", "docstring": "Find and return the topology given its cluster, environ, topology name, and\n    an optional role.\n    Raises exception if topology is not found, or more than one are found.", "docstring_tokens": ["Find", "and", "return", "the", "topology", "given", "its", "cluster", "environ", "topology", "name", "and", "an", "optional", "role", ".", "Raises", "exception", "if", "topology", "is", "not", "found", "or", "more", "than", "one", "are", "found", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252448}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L157-L165", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Will make any functions return an iterable objects by wrapping its result in a list.", "language": "python", "parameters": "(f)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "hasattr", "(", "arg_3", ",", "'__iter__'", ")", ":", "return", "arg_3", "else", ":", "return", "[", "arg_3", "]", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Will make any functions return an iterable objects by wrapping its result in a list.\"\"\"\n    def wrapper(*arg_1, **arg_2):\n        arg_3 = arg_0(*arg_1, **arg_2)\n        if hasattr(arg_3, '__iter__'):\n            return arg_3\n        else:\n            return [arg_3]\n    return wrapper", "path": "kerncraft/kernel.py", "identifier": "force_iterable", "docstring": "Will make any functions return an iterable objects by wrapping its result in a list.", "docstring_tokens": ["Will", "make", "any", "functions", "return", "an", "iterable", "objects", "by", "wrapping", "its", "result", "in", "a", "list", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 252449}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L209-L213", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Add conversation tab if not present, and optionally switch to it.", "language": "python", "parameters": "(self, conv_id, switch=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "get_conv_widget", "(", "arg_1", ")", "arg_0", ".", "_tabbed_window", ".", "set_tab", "(", "arg_3", ",", "arg_2", "=", "arg_2", ",", "title", "=", "arg_3", ".", "title", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Add conversation tab if not present, and optionally switch to it.\"\"\"\n        arg_3 = arg_0.get_conv_widget(arg_1)\n        arg_0._tabbed_window.set_tab(arg_3, arg_2=arg_2,\n                                    title=arg_3.title)", "path": "hangups/ui/__main__.py", "identifier": "ChatUI.add_conversation_tab", "docstring": "Add conversation tab if not present, and optionally switch to it.", "docstring_tokens": ["Add", "conversation", "tab", "if", "not", "present", "and", "optionally", "switch", "to", "it", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 252450}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/path.py#L31-L36", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "A hack to allow us to rename paths in a case-insensitive filesystem like HFS.", "language": "python", "parameters": "(src, dst)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tempfile", ".", "mkdtemp", "(", ")", "shutil", ".", "rmtree", "(", "arg_2", ")", "shutil", ".", "move", "(", "arg_0", ",", "arg_2", ")", "shutil", ".", "move", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"A hack to allow us to rename paths in a case-insensitive filesystem like HFS.\"\"\"\n    arg_2 = tempfile.mkdtemp()\n    shutil.rmtree(arg_2)\n    shutil.move(arg_0, arg_2)\n    shutil.move(arg_2, arg_1)", "path": "dusty/path.py", "identifier": "case_insensitive_rename", "docstring": "A hack to allow us to rename paths in a case-insensitive filesystem like HFS.", "docstring_tokens": ["A", "hack", "to", "allow", "us", "to", "rename", "paths", "in", "a", "case", "-", "insensitive", "filesystem", "like", "HFS", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 252451}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/types/config_schema.py#L85-L103", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "A decorator for annotating a function that can take the selected properties\n    from a ``config_value`` in to an instance of a custom type.", "language": "python", "parameters": "(config_cls)", "return_statement": "return _wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "resolve_config_cls_arg", "(", "arg_0", ")", "check", ".", "param_invariant", "(", "arg_1", ".", "is_selector", ",", "'config_cls'", ")", "def", "_wrap", "(", "arg_2", ")", ":", "def", "_selector", "(", "arg_3", ",", "arg_4", ")", ":", "arg_5", ",", "arg_6", "=", "single_item", "(", "arg_4", ")", "return", "arg_2", "(", "arg_3", ",", "arg_5", ",", "arg_6", ")", "return", "_create_input_schema", "(", "arg_1", ",", "_selector", ")", "return", "_wrap"], "function": "def Func(arg_0):\n    '''\n    A decorator for annotating a function that can take the selected properties\n    from a ``config_value`` in to an instance of a custom type.\n\n    Args:\n        config_cls (Selector)\n    '''\n    arg_1 = resolve_config_cls_arg(arg_0)\n    check.param_invariant(arg_1.is_selector, 'config_cls')\n\n    def _wrap(arg_2):\n        def _selector(arg_3, arg_4):\n            arg_5, arg_6 = single_item(arg_4)\n            return arg_2(arg_3, arg_5, arg_6)\n\n        return _create_input_schema(arg_1, _selector)\n\n    return _wrap", "path": "python_modules/dagster/dagster/core/types/config_schema.py", "identifier": "input_selector_schema", "docstring": "A decorator for annotating a function that can take the selected properties\n    from a ``config_value`` in to an instance of a custom type.\n\n    Args:\n        config_cls (Selector)", "docstring_tokens": ["A", "decorator", "for", "annotating", "a", "function", "that", "can", "take", "the", "selected", "properties", "from", "a", "config_value", "in", "to", "an", "instance", "of", "a", "custom", "type", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 252452}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/flame_graph.py#L169-L183", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Runs statistical profiler on a function.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'objectName': self._object_name,\n            'sampleInterval': _SAMPLE_INTERVAL,\n            'runTime': prof.run_time,\n            'callStats': call_tree,\n            'totalSamples': call_tree.get('sampleCount', 0),\n            'result': result,\n            'timestamp': int(time.time())\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "_StatProfiler", "(", ")", "as", "prof", ":", "arg_1", "=", "arg_0", ".", "_run_object", "(", "*", "arg_0", ".", "_run_args", ",", "**", "arg_0", ".", "_run_kwargs", ")", "arg_2", "=", "prof", ".", "call_tree", "return", "{", "'objectName'", ":", "arg_0", ".", "_object_name", ",", "'sampleInterval'", ":", "_SAMPLE_INTERVAL", ",", "'runTime'", ":", "prof", ".", "run_time", ",", "'callStats'", ":", "arg_2", ",", "'totalSamples'", ":", "arg_2", ".", "get", "(", "'sampleCount'", ",", "0", ")", ",", "'result'", ":", "arg_1", ",", "'timestamp'", ":", "int", "(", "time", ".", "time", "(", ")", ")", "}"], "function": "def Func(arg_0):\n        \"\"\"Runs statistical profiler on a function.\"\"\"\n        with _StatProfiler() as prof:\n            arg_1 = arg_0._run_object(*arg_0._run_args, **arg_0._run_kwargs)\n\n        arg_2 = prof.call_tree\n        return {\n            'objectName': arg_0._object_name,\n            'sampleInterval': _SAMPLE_INTERVAL,\n            'runTime': prof.run_time,\n            'callStats': arg_2,\n            'totalSamples': arg_2.get('sampleCount', 0),\n            'result': arg_1,\n            'timestamp': int(time.time())\n        }", "path": "vprof/flame_graph.py", "identifier": "FlameGraphProfiler.profile_function", "docstring": "Runs statistical profiler on a function.", "docstring_tokens": ["Runs", "statistical", "profiler", "on", "a", "function", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 252453}
{"url": "https://github.com/nficano/python-lambda/blob/b0bd25404df70212d7fa057758760366406d64f2/aws_lambda/aws_lambda.py#L729-L745", "sha": "b0bd25404df70212d7fa057758760366406d64f2", "docstring_summary": "Check whether a function exists or not and return its config", "language": "python", "parameters": "(cfg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get", "(", "'function_name'", ")", "arg_2", "=", "arg_0", ".", "get", "(", "'profile'", ")", "arg_3", "=", "arg_0", ".", "get", "(", "'aws_access_key_id'", ")", "arg_4", "=", "arg_0", ".", "get", "(", "'aws_secret_access_key'", ")", "arg_5", "=", "get_client", "(", "'lambda'", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_0", ".", "get", "(", "'region'", ")", ",", ")", "try", ":", "return", "arg_5", ".", "get_function", "(", "FunctionName", "=", "arg_1", ")", "except", "arg_5", ".", "exceptions", ".", "ResourceNotFoundException", "as", "e", ":", "if", "'Function not found'", "in", "str", "(", "e", ")", ":", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"Check whether a function exists or not and return its config\"\"\"\n\n    arg_1 = arg_0.get('function_name')\n    arg_2 = arg_0.get('profile')\n    arg_3 = arg_0.get('aws_access_key_id')\n    arg_4 = arg_0.get('aws_secret_access_key')\n    arg_5 = get_client(\n        'lambda', arg_2, arg_3, arg_4,\n        arg_0.get('region'),\n    )\n\n    try:\n        return arg_5.get_function(FunctionName=arg_1)\n    except arg_5.exceptions.ResourceNotFoundException as e:\n        if 'Function not found' in str(e):\n            return False", "path": "aws_lambda/aws_lambda.py", "identifier": "get_function_config", "docstring": "Check whether a function exists or not and return its config", "docstring_tokens": ["Check", "whether", "a", "function", "exists", "or", "not", "and", "return", "its", "config"], "nwo": "nficano/python-lambda", "score": 0.7856642350024847, "idx": 252454}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/utils.py#L349-L357", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "Returns key contents, and modify time", "language": "python", "parameters": "(self, k)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_changed", "(", ")", ":", "arg_0", ".", "_read", "(", ")", "if", "arg_1", "in", "arg_0", ".", "store", ":", "return", "tuple", "(", "arg_0", ".", "store", "[", "arg_1", "]", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns key contents, and modify time\"\"\"\n        if arg_0._changed():\n            arg_0._read()\n\n        if arg_1 in arg_0.store:\n            return tuple(arg_0.store[arg_1])\n        else:\n            return None", "path": "tensor/utils.py", "identifier": "PersistentCache.get", "docstring": "Returns key contents, and modify time", "docstring_tokens": ["Returns", "key", "contents", "and", "modify", "time"], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 252455}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-ai/botbuilder/ai/luis/activity_util.py#L16-L69", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Creates a trace activity based on this activity.", "language": "python", "parameters": "(\n        turn_activity: Activity,\n        name: str,\n        value: object = None,\n        value_type: str = None,\n        label: str = None,\n    )", "return_statement": "return reply", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "=", "None", ",", "arg_6", ":", "arg_3", "=", "None", ",", "arg_7", ":", "arg_3", "=", "None", ",", ")", "->", "arg_1", ":", "arg_8", "=", "(", "ChannelAccount", "(", "id", "=", "arg_0", ".", "recipient", ".", "id", ",", "arg_2", "=", "arg_0", ".", "recipient", ".", "name", ")", "if", "arg_0", ".", "recipient", "is", "not", "None", "else", "ChannelAccount", "(", ")", ")", "if", "arg_6", "is", "None", "and", "arg_4", "is", "not", "None", ":", "arg_6", "=", "type", "(", "arg_4", ")", ".", "__name__", "arg_9", "=", "arg_1", "(", "type", "=", "ActivityTypes", ".", "trace", ",", "timestamp", "=", "datetime", ".", "utcnow", "(", ")", ",", "arg_8", "=", "arg_8", ",", "recipient", "=", "ChannelAccount", "(", "id", "=", "arg_0", ".", "from_property", ".", "id", ",", "arg_2", "=", "arg_0", ".", "from_property", ".", "name", ")", ",", "reply_to_id", "=", "arg_0", ".", "id", ",", "service_url", "=", "arg_0", ".", "service_url", ",", "channel_id", "=", "arg_0", ".", "channel_id", ",", "conversation", "=", "ConversationAccount", "(", "is_group", "=", "arg_0", ".", "conversation", ".", "is_group", ",", "id", "=", "arg_0", ".", "conversation", ".", "id", ",", "arg_2", "=", "arg_0", ".", "conversation", ".", "name", ",", ")", ",", "arg_2", "=", "arg_2", ",", "arg_7", "=", "arg_7", ",", "arg_6", "=", "arg_6", ",", "arg_4", "=", "arg_4", ",", ")", "return", "arg_9"], "function": "def Func(\n        arg_0: arg_1,\n        arg_2: arg_3,\n        arg_4: arg_5 = None,\n        arg_6: arg_3 = None,\n        arg_7: arg_3 = None,\n    ) -> arg_1:\n        \"\"\"Creates a trace activity based on this activity.\n\n        :param turn_activity:\n        :type turn_activity: Activity\n        :param name: The value to assign to the trace activity's <see cref=\"Activity.name\"/> property.\n        :type name: str\n        :param value: The value to assign to the trace activity's <see cref=\"Activity.value\"/> property., defaults to None\n        :param value: object, optional\n        :param value_type: The value to assign to the trace activity's <see cref=\"Activity.value_type\"/> property, defaults to None\n        :param value_type: str, optional\n        :param label: The value to assign to the trace activity's <see cref=\"Activity.label\"/> property, defaults to None\n        :param label: str, optional\n        :return: The created trace activity.\n        :rtype: Activity\n        \"\"\"\n\n        arg_8 = (\n            ChannelAccount(\n                id=arg_0.recipient.id, arg_2=arg_0.recipient.name\n            )\n            if arg_0.recipient is not None\n            else ChannelAccount()\n        )\n        if arg_6 is None and arg_4 is not None:\n            arg_6 = type(arg_4).__name__\n\n        arg_9 = arg_1(\n            type=ActivityTypes.trace,\n            timestamp=datetime.utcnow(),\n            arg_8=arg_8,\n            recipient=ChannelAccount(\n                id=arg_0.from_property.id, arg_2=arg_0.from_property.name\n            ),\n            reply_to_id=arg_0.id,\n            service_url=arg_0.service_url,\n            channel_id=arg_0.channel_id,\n            conversation=ConversationAccount(\n                is_group=arg_0.conversation.is_group,\n                id=arg_0.conversation.id,\n                arg_2=arg_0.conversation.name,\n            ),\n            arg_2=arg_2,\n            arg_7=arg_7,\n            arg_6=arg_6,\n            arg_4=arg_4,\n        )\n        return arg_9", "path": "libraries/botbuilder-ai/botbuilder/ai/luis/activity_util.py", "identifier": "ActivityUtil.create_trace", "docstring": "Creates a trace activity based on this activity.\n\n        :param turn_activity:\n        :type turn_activity: Activity\n        :param name: The value to assign to the trace activity's <see cref=\"Activity.name\"/> property.\n        :type name: str\n        :param value: The value to assign to the trace activity's <see cref=\"Activity.value\"/> property., defaults to None\n        :param value: object, optional\n        :param value_type: The value to assign to the trace activity's <see cref=\"Activity.value_type\"/> property, defaults to None\n        :param value_type: str, optional\n        :param label: The value to assign to the trace activity's <see cref=\"Activity.label\"/> property, defaults to None\n        :param label: str, optional\n        :return: The created trace activity.\n        :rtype: Activity", "docstring_tokens": ["Creates", "a", "trace", "activity", "based", "on", "this", "activity", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 252456}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/GIES.py#L128-L144", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Run the GIES algorithm.", "language": "python", "parameters": "(self, data)", "return_statement": "return nx.relabel_nodes(nx.DiGraph(results),\n                                {idx: i for idx, i in enumerate(data.columns)})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "arguments", "[", "'{SCORE}'", "]", "=", "arg_0", ".", "scores", "[", "arg_0", ".", "score", "]", "arg_0", ".", "arguments", "[", "'{VERBOSE}'", "]", "=", "str", "(", "arg_0", ".", "verbose", ")", ".", "upper", "(", ")", "arg_3", "=", "arg_0", ".", "_run_gies", "(", "arg_1", ",", "verbose", "=", "arg_0", ".", "verbose", ")", "return", "nx", ".", "relabel_nodes", "(", "nx", ".", "DiGraph", "(", "arg_3", ")", ",", "{", "arg_4", ":", "arg_5", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_1", ".", "columns", ")", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Run the GIES algorithm.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by the GIES algorithm.\n        \"\"\"\n        # Building setup w/ arguments.\n        arg_0.arguments['{SCORE}'] = arg_0.scores[arg_0.score]\n        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()\n\n        arg_3 = arg_0._run_gies(arg_1, verbose=arg_0.verbose)\n\n        return nx.relabel_nodes(nx.DiGraph(arg_3),\n                                {arg_4: arg_5 for arg_4, arg_5 in enumerate(arg_1.columns)})", "path": "cdt/causality/graph/GIES.py", "identifier": "GIES.create_graph_from_data", "docstring": "Run the GIES algorithm.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by the GIES algorithm.", "docstring_tokens": ["Run", "the", "GIES", "algorithm", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 252457}
{"url": "https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L140-L174", "sha": "f3ed561253eb4a8e1522c64f59bf64d275e9d315", "docstring_summary": "is this token valid?", "language": "python", "parameters": "(self, token)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "time", ".", "time", "(", ")", "if", "'Bearer '", "in", "arg_1", ":", "arg_1", "=", "arg_1", "[", "7", ":", "]", "arg_3", "=", "None", "for", "arg_4", "in", "arg_0", ".", "secrets", ":", "try", ":", "arg_3", "=", "jwt", ".", "decode", "(", "arg_1", ",", "arg_4", ")", "break", "except", "jwt", ".", "DecodeError", ":", "continue", "except", "jwt", ".", "ExpiredSignatureError", ":", "raise", "JwtFailed", "(", "\"Jwt expired\"", ")", "if", "not", "arg_3", ":", "raise", "JwtFailed", "(", "\"Jwt cannot be decoded\"", ")", "arg_5", "=", "arg_3", ".", "get", "(", "'exp'", ")", "if", "not", "arg_5", ":", "raise", "JwtFailed", "(", "\"Jwt missing expiration (exp)\"", ")", "if", "arg_2", "-", "arg_5", ">", "arg_0", ".", "age", ":", "raise", "JwtFailed", "(", "\"Jwt bad expiration - greater than I want to accept\"", ")", "arg_6", "=", "arg_3", ".", "get", "(", "'jti'", ")", "if", "not", "arg_6", ":", "raise", "JwtFailed", "(", "\"Jwt missing one-time id (jti)\"", ")", "if", "arg_0", ".", "already_used", "(", "arg_6", ")", ":", "raise", "JwtFailed", "(", "\"Jwt re-use disallowed (jti={})\"", ".", "format", "(", "arg_6", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"is this token Func?\"\"\"\n        arg_2 = time.time()\n\n        if 'Bearer ' in arg_1:\n            arg_1 = arg_1[7:]\n\n        arg_3 = None\n        for arg_4 in arg_0.secrets:\n            try:\n                arg_3 = jwt.decode(arg_1, arg_4)\n                break\n            except jwt.DecodeError:\n                continue\n            except jwt.ExpiredSignatureError:\n                raise JwtFailed(\"Jwt expired\")\n\n        if not arg_3:\n            raise JwtFailed(\"Jwt cannot be decoded\")\n\n        arg_5 = arg_3.get('exp')\n        if not arg_5:\n            raise JwtFailed(\"Jwt missing expiration (exp)\")\n\n        if arg_2 - arg_5 > arg_0.age:\n            raise JwtFailed(\"Jwt bad expiration - greater than I want to accept\")\n\n        arg_6 = arg_3.get('jti')\n        if not arg_6:\n            raise JwtFailed(\"Jwt missing one-time id (jti)\")\n\n        if arg_0.already_used(arg_6):\n            raise JwtFailed(\"Jwt re-use disallowed (jti={})\".format(arg_6))\n\n        return arg_3", "path": "onetimejwt/__init__.py", "identifier": "Manager.valid", "docstring": "is this token valid?", "docstring_tokens": ["is", "this", "token", "valid?"], "nwo": "srevenant/onetimejwt", "score": 0.0, "idx": 252458}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/meetup.py#L395-L405", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the comments of a given event.", "language": "python", "parameters": "(self, group, event_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "urijoin", "(", "arg_1", ",", "arg_0", ".", "REVENTS", ",", "arg_2", ",", "arg_0", ".", "RCOMMENTS", ")", "arg_4", "=", "{", "arg_0", ".", "PPAGE", ":", "arg_0", ".", "max_items", "}", "for", "arg_5", "in", "arg_0", ".", "_fetch", "(", "arg_3", ",", "arg_4", ")", ":", "yield", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Fetch the Func of a given event.\"\"\"\n\n        arg_3 = urijoin(arg_1, arg_0.REVENTS, arg_2, arg_0.RCOMMENTS)\n\n        arg_4 = {\n            arg_0.PPAGE: arg_0.max_items\n        }\n\n        for arg_5 in arg_0._fetch(arg_3, arg_4):\n            yield arg_5", "path": "perceval/backends/core/meetup.py", "identifier": "MeetupClient.comments", "docstring": "Fetch the comments of a given event.", "docstring_tokens": ["Fetch", "the", "comments", "of", "a", "given", "event", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 252459}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L207-L218", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Encapsulate characters to make markdown look as expected.", "language": "python", "parameters": "(raw_string)", "return_statement": "return enc_string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "replace", "(", "'\\\\'", ",", "'\\\\\\\\'", ")", "arg_1", "=", "re", ".", "sub", "(", "\"([<>*_()\\[\\]#])\"", ",", "r\"\\\\\\1\"", ",", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Encapsulate characters to make markdown look as expected.\n\n        :param str raw_string: string to encapsulate\n        :rtype: str\n        :return: encapsulated input string\n        \"\"\"\n\n        arg_0.replace('\\\\', '\\\\\\\\')\n        arg_1 = re.sub(\"([<>*_()\\[\\]#])\", r\"\\\\\\1\", arg_0)\n        return arg_1", "path": "pygcgen/generator.py", "identifier": "Generator.encapsulate_string", "docstring": "Encapsulate characters to make markdown look as expected.\n\n        :param str raw_string: string to encapsulate\n        :rtype: str\n        :return: encapsulated input string", "docstring_tokens": ["Encapsulate", "characters", "to", "make", "markdown", "look", "as", "expected", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 252460}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/samples/mysql_dav_provider.py#L90-L136", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Read resource information into self._cache, for cached access.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "provider", ".", "_count_get_resource_instFunc", "+=", "1", "arg_1", ",", "arg_2", "=", "arg_0", ".", "provider", ".", "_split_path", "(", "arg_0", ".", "path", ")", "arg_3", "=", "\"Unknown\"", "arg_4", "=", "\"\"", "arg_5", "=", "\"text/html\"", "if", "arg_1", "is", "None", ":", "arg_3", "=", "\"Database\"", "elif", "arg_2", "is", "None", ":", "arg_3", "=", "\"Database Table\"", "else", ":", "arg_5", "=", "\"text/csv\"", "if", "arg_2", "==", "\"_ENTIRE_CONTENTS\"", ":", "arg_3", "=", "\"Database Table Contents\"", "arg_4", "=", "\"CSV Representation of Table Contents\"", "else", ":", "arg_3", "=", "\"Database Record\"", "arg_4", "=", "\"Attributes available as properties\"", "arg_6", "=", "arg_2", "is", "None", "arg_0", ".", "_cache", "=", "{", "\"content_length\"", ":", "None", ",", "\"contentType\"", ":", "arg_5", ",", "\"created\"", ":", "time", ".", "time", "(", ")", ",", "\"display_name\"", ":", "arg_0", ".", "name", ",", "\"etag\"", ":", "hashlib", ".", "md5", "(", ")", ".", "update", "(", "arg_0", ".", "path", ")", ".", "hexdigest", "(", ")", ",", "\"modified\"", ":", "None", ",", "\"support_ranges\"", ":", "False", ",", "\"display_info\"", ":", "{", "\"type\"", ":", "arg_3", ",", "\"typeComment\"", ":", "arg_4", "}", ",", "}", "if", "not", "arg_6", ":", "arg_0", ".", "_cache", "[", "\"modified\"", "]", "=", "time", ".", "time", "(", ")", "_logger", ".", "debug", "(", "\"---> Func, nc=%s\"", "%", "arg_0", ".", "provider", ".", "_countFuncConnection", ")"], "function": "def Func(arg_0):\n        \"\"\"Read resource information into self._cache, for cached access.\n\n        See DAVResource.Func()\n        \"\"\"\n        # TODO: recalc self.path from <self._file_path>, to fix correct file system case\n        #       On windows this would lead to correct URLs\n        arg_0.provider._count_get_resource_instFunc += 1\n        arg_1, arg_2 = arg_0.provider._split_path(arg_0.path)\n\n        arg_3 = \"Unknown\"\n        arg_4 = \"\"\n        arg_5 = \"text/html\"\n\n        #        _logger.debug(\"getInfoDict(%s), nc=%s\" % (path, self.connectCount))\n        if arg_1 is None:\n            arg_3 = \"Database\"\n        elif arg_2 is None:  # \"database\" and table name\n            arg_3 = \"Database Table\"\n        else:\n            arg_5 = \"text/csv\"\n            if arg_2 == \"_ENTIRE_CONTENTS\":\n                arg_3 = \"Database Table Contents\"\n                arg_4 = \"CSV Representation of Table Contents\"\n            else:\n                arg_3 = \"Database Record\"\n                arg_4 = \"Attributes available as properties\"\n\n        # Avoid calling is_collection, since it would call isExisting -> Func_connection\n        arg_6 = arg_2 is None\n\n        arg_0._cache = {\n            \"content_length\": None,\n            \"contentType\": arg_5,\n            \"created\": time.time(),\n            \"display_name\": arg_0.name,\n            \"etag\": hashlib.md5().update(arg_0.path).hexdigest(),\n            # \"etag\": md5.new(self.path).hexdigest(),\n            \"modified\": None,\n            \"support_ranges\": False,\n            \"display_info\": {\"type\": arg_3, \"typeComment\": arg_4},\n        }\n\n        # Some resource-only infos:\n        if not arg_6:\n            arg_0._cache[\"modified\"] = time.time()\n        _logger.debug(\"---> Func, nc=%s\" % arg_0.provider._countFuncConnection)", "path": "wsgidav/samples/mysql_dav_provider.py", "identifier": "MySQLBrowserResource._init", "docstring": "Read resource information into self._cache, for cached access.\n\n        See DAVResource._init()", "docstring_tokens": ["Read", "resource", "information", "into", "self", ".", "_cache", "for", "cached", "access", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 252461}
{"url": "https://github.com/Rikanishu/static-bundle/blob/2f6458cb9d9d9049b4fd829f7d6951a45d547c68/static_bundle/bundles.py#L48-L60", "sha": "2f6458cb9d9d9049b4fd829f7d6951a45d547c68", "docstring_summary": "Called when builder group collect files\n        Resolves absolute url if relative passed", "language": "python", "parameters": "(self, asset, builder)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "abs_path", ":", "arg_3", "=", "utils", ".", "prepare_path", "(", "arg_0", ".", "rel_bundle_path", ")", "arg_0", ".", "abs_bundle_path", "=", "utils", ".", "prepare_path", "(", "[", "arg_2", ".", "config", ".", "input_dir", ",", "arg_3", "]", ")", "arg_0", ".", "abs_path", "=", "True", "arg_0", ".", "input_dir", "=", "arg_2", ".", "config", ".", "input_dir"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Called when builder group collect files\n        Resolves absolute url if relative passed\n\n        :type asset: static_bundle.builders.Asset\n        :type builder: static_bundle.builders.StandardBuilder\n        \"\"\"\n        if not arg_0.abs_path:\n            arg_3 = utils.prepare_path(arg_0.rel_bundle_path)\n            arg_0.abs_bundle_path = utils.prepare_path([arg_2.config.input_dir, arg_3])\n            arg_0.abs_path = True\n        arg_0.input_dir = arg_2.config.input_dir", "path": "static_bundle/bundles.py", "identifier": "AbstractBundle.init_build", "docstring": "Called when builder group collect files\n        Resolves absolute url if relative passed\n\n        :type asset: static_bundle.builders.Asset\n        :type builder: static_bundle.builders.StandardBuilder", "docstring_tokens": ["Called", "when", "builder", "group", "collect", "files", "Resolves", "absolute", "url", "if", "relative", "passed"], "nwo": "Rikanishu/static-bundle", "score": 0.0, "idx": 252462}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1813-L1857", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots a probability distribution for the event of making\n    a profitable trade.", "language": "python", "parameters": "(round_trips, ax=None)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "np", ".", "linspace", "(", "0", ",", "1.", ",", "500", ")", "arg_0", "[", "'profitable'", "]", "=", "arg_0", ".", "pnl", ">", "0", "arg_3", "=", "sp", ".", "stats", ".", "beta", "(", "arg_0", ".", "profitable", ".", "sum", "(", ")", ",", "(", "~", "arg_0", ".", "profitable", ")", ".", "sum", "(", ")", ")", "arg_4", "=", "arg_3", ".", "pdf", "(", "arg_2", ")", "arg_5", "=", "arg_3", ".", "ppf", "(", ".025", ")", "arg_6", "=", "arg_3", ".", "ppf", "(", ".975", ")", "arg_7", "=", "arg_3", ".", "ppf", "(", ".001", ")", "arg_8", "=", "arg_3", ".", "ppf", "(", ".999", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "plt", ".", "subplot", "(", ")", "arg_1", ".", "plot", "(", "arg_2", ",", "arg_4", ")", "arg_1", ".", "axvline", "(", "arg_5", ",", "color", "=", "'0.5'", ")", "arg_1", ".", "axvline", "(", "arg_6", ",", "color", "=", "'0.5'", ")", "arg_1", ".", "set_xlabel", "(", "'Probability of making a profitable decision'", ")", "arg_1", ".", "set_ylabel", "(", "'Belief'", ")", "arg_1", ".", "set_xlim", "(", "arg_7", ",", "arg_8", ")", "arg_1", ".", "set_ylim", "(", "(", "0", ",", "arg_4", ".", "max", "(", ")", "+", "1.", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Plots a probability distribution for the event of making\n    a profitable trade.\n\n    Parameters\n    ----------\n    round_trips : pd.DataFrame\n        DataFrame with one row per round trip trade.\n        - See full explanation in round_trips.extract_round_trips\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    arg_2 = np.linspace(0, 1., 500)\n\n    arg_0['profitable'] = arg_0.pnl > 0\n\n    arg_3 = sp.stats.beta(arg_0.profitable.sum(),\n                         (~arg_0.profitable).sum())\n    arg_4 = arg_3.pdf(arg_2)\n    arg_5 = arg_3.ppf(.025)\n    arg_6 = arg_3.ppf(.975)\n\n    arg_7 = arg_3.ppf(.001)\n    arg_8 = arg_3.ppf(.999)\n\n    if arg_1 is None:\n        arg_1 = plt.subplot()\n\n    arg_1.plot(arg_2, arg_4)\n    arg_1.axvline(arg_5, color='0.5')\n    arg_1.axvline(arg_6, color='0.5')\n\n    arg_1.set_xlabel('Probability of making a profitable decision')\n    arg_1.set_ylabel('Belief')\n    arg_1.set_xlim(arg_7, arg_8)\n    arg_1.set_ylim((0, arg_4.max() + 1.))\n\n    return arg_1", "path": "pyfolio/plotting.py", "identifier": "plot_prob_profit_trade", "docstring": "Plots a probability distribution for the event of making\n    a profitable trade.\n\n    Parameters\n    ----------\n    round_trips : pd.DataFrame\n        DataFrame with one row per round trip trade.\n        - See full explanation in round_trips.extract_round_trips\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "a", "probability", "distribution", "for", "the", "event", "of", "making", "a", "profitable", "trade", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 252463}
{"url": "https://github.com/openergy/oplus/blob/f095868d1990c1d126e906ada6acbab26348b3d3/oplus/epm/relations_manager.py#L65-L99", "sha": "f095868d1990c1d126e906ada6acbab26348b3d3", "docstring_summary": "source record and index must have been set", "language": "python", "parameters": "(self, link)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tuple", "(", "(", "ref", ",", "arg_1", ".", "initial_hook_value", ")", "for", "ref", "in", "arg_1", ".", "hook_references", ")", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "in", "arg_0", ".", "_record_hooks", ":", "arg_1", ".", "set_target", "(", "target_record", "=", "arg_0", ".", "_record_hooks", "[", "arg_3", "]", ".", "target_record", ")", "break", "else", ":", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "in", "arg_0", ".", "_table_hooks", ":", "arg_1", ".", "set_target", "(", "target_table", "=", "arg_0", ".", "_table_hooks", "[", "arg_3", "]", ")", "break", "else", ":", "arg_4", "=", "arg_1", ".", "source_record", ".", "get_field_descriptor", "(", "arg_1", ".", "source_index", ")", "raise", "FieldValidationError", "(", "f\"No object found with any of given references : {keys}. \"", "f\"{field_descriptor.get_error_location_message(link.initial_hook_value)}\"", ")", "if", "arg_1", ".", "source_record", "not", "in", "arg_0", ".", "_links_by_source", ":", "arg_0", ".", "_links_by_source", "[", "arg_1", ".", "source_record", "]", "=", "set", "(", ")", "arg_0", ".", "_links_by_source", "[", "arg_1", ".", "source_record", "]", ".", "add", "(", "arg_1", ")", "if", "arg_1", ".", "target", "not", "in", "arg_0", ".", "_links_by_target", ":", "arg_0", ".", "_links_by_target", "[", "arg_1", ".", "target", "]", "=", "set", "(", ")", "arg_0", ".", "_links_by_target", "[", "arg_1", ".", "target", "]", ".", "add", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        source record and index must have been set\n        \"\"\"\n        arg_2 = tuple((ref, arg_1.initial_hook_value) for ref in arg_1.hook_references)\n\n        # look for a record hook\n        for arg_3 in arg_2:\n            if arg_3 in arg_0._record_hooks:\n                # set link target\n                arg_1.set_target(target_record=arg_0._record_hooks[arg_3].target_record)\n                break\n        else:\n            # look for a table hook\n            for arg_3 in arg_2:\n                if arg_3 in arg_0._table_hooks:\n                    # set link target\n                    arg_1.set_target(target_table=arg_0._table_hooks[arg_3])\n                    break\n            else:\n                arg_4 = arg_1.source_record.get_field_descriptor(arg_1.source_index)\n                raise FieldValidationError(\n                    f\"No object found with any of given references : {keys}. \"\n                    f\"{field_descriptor.get_error_location_message(link.initial_hook_value)}\"\n                )\n\n        # store by source\n        if arg_1.source_record not in arg_0._links_by_source:\n            arg_0._links_by_source[arg_1.source_record] = set()\n        arg_0._links_by_source[arg_1.source_record].add(arg_1)\n\n        # store by target\n        if arg_1.target not in arg_0._links_by_target:\n            arg_0._links_by_target[arg_1.target] = set()\n        arg_0._links_by_target[arg_1.target].add(arg_1)", "path": "oplus/epm/relations_manager.py", "identifier": "RelationsManager.register_link", "docstring": "source record and index must have been set", "docstring_tokens": ["source", "record", "and", "index", "must", "have", "been", "set"], "nwo": "openergy/oplus", "score": 0.38919093769130675, "idx": 252464}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/txampext/multiplexing.py#L363-L373", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Attempts to get a local protocol by connection identifier.", "language": "python", "parameters": "(self, connectionIdentifier)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "localFactories", ":", "try", ":", "return", "arg_2", ".", "protocols", "[", "arg_1", "]", "except", "KeyError", ":", "continue", "raise", "NoSuchConnection", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Attempts to get a local protocol by connection identifier.\n\n        \"\"\"\n        for arg_2 in arg_0.localFactories:\n            try:\n                return arg_2.protocols[arg_1]\n            except KeyError:\n                continue\n\n        raise NoSuchConnection()", "path": "txampext/multiplexing.py", "identifier": "ProxyingAMPLocator.getLocalProtocol", "docstring": "Attempts to get a local protocol by connection identifier.", "docstring_tokens": ["Attempts", "to", "get", "a", "local", "protocol", "by", "connection", "identifier", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 252465}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/abstractcpu.py#L583-L593", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Tells the CPU to set up a concrete unicorn emulator and use it to execute instructions\n        until target is reached.", "language": "python", "parameters": "(self, target: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "arg_0", ".", "_concrete", "=", "True", "arg_0", ".", "_break_unicorn_at", "=", "arg_1", "if", "arg_0", ".", "emu", ":", "arg_0", ".", "emu", ".", "_stop_at", "=", "arg_1"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        Tells the CPU to set up a concrete unicorn emulator and use it to execute instructions\n        until target is reached.\n\n        :param target: Where Unicorn should hand control back to Manticore. Set to 0 for all instructions.\n        \"\"\"\n        arg_0._concrete = True\n        arg_0._break_unicorn_at = arg_1\n        if arg_0.emu:\n            arg_0.emu._stop_at = arg_1", "path": "manticore/native/cpu/abstractcpu.py", "identifier": "Cpu.emulate_until", "docstring": "Tells the CPU to set up a concrete unicorn emulator and use it to execute instructions\n        until target is reached.\n\n        :param target: Where Unicorn should hand control back to Manticore. Set to 0 for all instructions.", "docstring_tokens": ["Tells", "the", "CPU", "to", "set", "up", "a", "concrete", "unicorn", "emulator", "and", "use", "it", "to", "execute", "instructions", "until", "target", "is", "reached", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252466}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/graph.py#L100-L109", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Add data to the graph object. May be called several times to add\n\t\tadditional data sets.", "language": "python", "parameters": "(self, conf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "validate_data", "(", "arg_1", ")", "arg_0", ".", "process_data", "(", "arg_1", ")", "arg_0", ".", "data", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n\t\t\"\"\"\n\t\tAdd data to the graph object. May be called several times to add\n\t\tadditional data sets.\n\n\t\tconf should be a dictionary including 'data' and 'title' keys\n\t\t\"\"\"\n\t\targ_0.validate_data(arg_1)\n\t\targ_0.process_data(arg_1)\n\t\targ_0.data.append(arg_1)", "path": "svg/charts/graph.py", "identifier": "Graph.add_data", "docstring": "Add data to the graph object. May be called several times to add\n\t\tadditional data sets.\n\n\t\tconf should be a dictionary including 'data' and 'title' keys", "docstring_tokens": ["Add", "data", "to", "the", "graph", "object", ".", "May", "be", "called", "several", "times", "to", "add", "additional", "data", "sets", "."], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 252467}
{"url": "https://github.com/nephila/djangocms-installer/blob/9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e/djangocms_installer/utils.py#L51-L93", "sha": "9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e", "docstring_summary": "Convert numeric and literal version information to numeric format", "language": "python", "parameters": "(django, cms)", "return_statement": "return (\n        compat.unicode(django_version) if django_version else django_version,\n        compat.unicode(cms_version) if cms_version else cms_version\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "arg_3", "=", "None", "try", ":", "arg_2", "=", "Decimal", "(", "arg_1", ")", "except", "(", "ValueError", ",", "InvalidOperation", ")", ":", "try", ":", "arg_2", "=", "CMS_VERSION_MATRIX", "[", "str", "(", "arg_1", ")", "]", "except", "KeyError", ":", "pass", "try", ":", "arg_3", "=", "Decimal", "(", "arg_0", ")", "except", "(", "ValueError", ",", "InvalidOperation", ")", ":", "try", ":", "arg_3", "=", "DJANGO_VERSION_MATRIX", "[", "str", "(", "arg_0", ")", "]", "except", "KeyError", ":", "pass", "try", ":", "if", "(", "arg_2", "and", "arg_3", "and", "not", "(", "LooseVersion", "(", "VERSION_MATRIX", "[", "compat", ".", "unicode", "(", "arg_2", ")", "]", "[", "0", "]", ")", "<=", "LooseVersion", "(", "compat", ".", "unicode", "(", "arg_3", ")", ")", "<=", "LooseVersion", "(", "VERSION_MATRIX", "[", "compat", ".", "unicode", "(", "arg_2", ")", "]", "[", "1", "]", ")", ")", ")", ":", "raise", "RuntimeError", "(", "'Django and django CMS versions doesn\\'t match: '", "'Django {0} is not supported by django CMS {1}'", ".", "format", "(", "arg_3", ",", "arg_2", ")", ")", "except", "KeyError", ":", "raise", "RuntimeError", "(", "'Django and django CMS versions doesn\\'t match: '", "'Django {0} is not supported by django CMS {1}'", ".", "format", "(", "arg_3", ",", "arg_2", ")", ")", "return", "(", "compat", ".", "unicode", "(", "arg_3", ")", "if", "arg_3", "else", "arg_3", ",", "compat", ".", "unicode", "(", "arg_2", ")", "if", "arg_2", "else", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Convert numeric and literal version information to numeric format\n    \"\"\"\n    arg_2 = None\n    arg_3 = None\n\n    try:\n        arg_2 = Decimal(arg_1)\n    except (ValueError, InvalidOperation):\n        try:\n            arg_2 = CMS_VERSION_MATRIX[str(arg_1)]\n        except KeyError:\n            pass\n\n    try:\n        arg_3 = Decimal(arg_0)\n    except (ValueError, InvalidOperation):\n        try:\n            arg_3 = DJANGO_VERSION_MATRIX[str(arg_0)]\n        except KeyError:  # pragma: no cover\n            pass\n\n    try:\n        if (\n                arg_2 and arg_3 and\n                not (LooseVersion(VERSION_MATRIX[compat.unicode(arg_2)][0]) <=\n                     LooseVersion(compat.unicode(arg_3)) <=\n                     LooseVersion(VERSION_MATRIX[compat.unicode(arg_2)][1]))\n        ):\n            raise RuntimeError(\n                'Django and django CMS versions doesn\\'t match: '\n                'Django {0} is not supported by django CMS {1}'.format(arg_3, arg_2)\n            )\n    except KeyError:\n        raise RuntimeError(\n            'Django and django CMS versions doesn\\'t match: '\n            'Django {0} is not supported by django CMS {1}'.format(arg_3, arg_2)\n        )\n    return (\n        compat.unicode(arg_3) if arg_3 else arg_3,\n        compat.unicode(arg_2) if arg_2 else arg_2\n    )", "path": "djangocms_installer/utils.py", "identifier": "supported_versions", "docstring": "Convert numeric and literal version information to numeric format", "docstring_tokens": ["Convert", "numeric", "and", "literal", "version", "information", "to", "numeric", "format"], "nwo": "nephila/djangocms-installer", "score": 0.7157994486187137, "idx": 252468}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L923-L940", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Show current installed versions", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "logger", ".", "root", ".", "isEnabledFor", "(", "logging", ".", "DEBUG", ")", ":", "if", "sys", ".", "platform", "==", "\"darwin\"", ":", "arg_0", "=", "\"macOS {0}\"", ".", "format", "(", "platform", ".", "mac_ver", "(", ")", "[", "0", "]", ")", "elif", "sys", ".", "platform", ".", "startswith", "(", "\"win\"", ")", ":", "arg_0", "=", "\"{0} {1}\"", ".", "format", "(", "platform", ".", "system", "(", ")", ",", "platform", ".", "release", "(", ")", ")", "else", ":", "arg_0", "=", "platform", ".", "platform", "(", ")", "log", ".", "debug", "(", "\"OS:         {0}\"", ".", "format", "(", "arg_0", ")", ")", "log", ".", "debug", "(", "\"Python:     {0}\"", ".", "format", "(", "platform", ".", "python_version", "(", ")", ")", ")", "log", ".", "debug", "(", "\"Streamlink: {0}\"", ".", "format", "(", "streamlink_version", ")", ")", "log", ".", "debug", "(", "\"Requests({0}), Socks({1}), Websocket({2})\"", ".", "format", "(", "requests", ".", "__version__", ",", "socks_version", ",", "websocket_version", ")", ")"], "function": "def Func():\n    \"\"\"Show current installed versions\"\"\"\n    if logger.root.isEnabledFor(logging.DEBUG):\n        # MAC OS X\n        if sys.platform == \"darwin\":\n            arg_0 = \"macOS {0}\".format(platform.mac_ver()[0])\n        # Windows\n        elif sys.platform.startswith(\"win\"):\n            arg_0 = \"{0} {1}\".format(platform.system(), platform.release())\n        # linux / other\n        else:\n            arg_0 = platform.platform()\n\n        log.debug(\"OS:         {0}\".format(arg_0))\n        log.debug(\"Python:     {0}\".format(platform.python_version()))\n        log.debug(\"Streamlink: {0}\".format(streamlink_version))\n        log.debug(\"Requests({0}), Socks({1}), Websocket({2})\".format(\n            requests.__version__, socks_version, websocket_version))", "path": "src/streamlink_cli/main.py", "identifier": "log_current_versions", "docstring": "Show current installed versions", "docstring_tokens": ["Show", "current", "installed", "versions"], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 252469}
{"url": "https://github.com/cldf/csvw/blob/181c94b6c599575945e52d370a415f12f3433eab/src/csvw/dsv.py#L361-L383", "sha": "181c94b6c599575945e52d370a415f12f3433eab", "docstring_summary": "Utility function to rewrite rows in tsv files.", "language": "python", "parameters": "(fname, visitor, **kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "pathlib", ".", "Path", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "string_types", ")", "arg_0", "=", "pathlib", ".", "Path", "(", "arg_0", ")", "assert", "arg_0", ".", "is_file", "(", ")", "with", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ")", "as", "fp", ":", "arg_3", "=", "pathlib", ".", "Path", "(", "fp", ".", "name", ")", "with", "UnicodeReader", "(", "arg_0", ",", "**", "arg_2", ")", "as", "reader_", ":", "with", "UnicodeWriter", "(", "arg_3", ",", "**", "arg_2", ")", "as", "writer", ":", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "reader_", ")", ":", "arg_5", "=", "arg_1", "(", "arg_4", ",", "arg_5", ")", "if", "arg_5", "is", "not", "None", ":", "writer", ".", "writerow", "(", "arg_5", ")", "shutil", ".", "move", "(", "str", "(", "arg_3", ")", ",", "str", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Utility function to Func rows in tsv files.\n\n    :param fname: Path of the dsv file to operate on.\n    :param visitor: A callable that takes a line-number and a row as input and returns a \\\n    (modified) row or None to filter out the row.\n    :param kw: Keyword parameters are passed through to csv.reader/csv.writer.\n    \"\"\"\n    if not isinstance(arg_0, pathlib.Path):\n        assert isinstance(arg_0, string_types)\n        arg_0 = pathlib.Path(arg_0)\n\n    assert arg_0.is_file()\n    with tempfile.NamedTemporaryFile(delete=False) as fp:\n        arg_3 = pathlib.Path(fp.name)\n\n    with UnicodeReader(arg_0, **arg_2) as reader_:\n        with UnicodeWriter(arg_3, **arg_2) as writer:\n            for arg_4, arg_5 in enumerate(reader_):\n                arg_5 = arg_1(arg_4, arg_5)\n                if arg_5 is not None:\n                    writer.writerow(arg_5)\n    shutil.move(str(arg_3), str(arg_0))", "path": "src/csvw/dsv.py", "identifier": "rewrite", "docstring": "Utility function to rewrite rows in tsv files.\n\n    :param fname: Path of the dsv file to operate on.\n    :param visitor: A callable that takes a line-number and a row as input and returns a \\\n    (modified) row or None to filter out the row.\n    :param kw: Keyword parameters are passed through to csv.reader/csv.writer.", "docstring_tokens": ["Utility", "function", "to", "rewrite", "rows", "in", "tsv", "files", "."], "nwo": "cldf/csvw", "score": 0.2827006957945985, "idx": 252470}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_video_intelligence_hook.py#L41-L49", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns Gcp Video Intelligence Service client", "language": "python", "parameters": "(self)", "return_statement": "return self._conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_conn", ":", "arg_0", ".", "_conn", "=", "VideoIntelligenceServiceClient", "(", "credentials", "=", "arg_0", ".", "_get_credentials", "(", ")", ")", "return", "arg_0", ".", "_conn"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns Gcp Video Intelligence Service client\n\n        :rtype: google.cloud.videointelligence_v1.VideoIntelligenceServiceClient\n        \"\"\"\n        if not arg_0._conn:\n            arg_0._conn = VideoIntelligenceServiceClient(credentials=arg_0._get_credentials())\n        return arg_0._conn", "path": "airflow/contrib/hooks/gcp_video_intelligence_hook.py", "identifier": "CloudVideoIntelligenceHook.get_conn", "docstring": "Returns Gcp Video Intelligence Service client\n\n        :rtype: google.cloud.videointelligence_v1.VideoIntelligenceServiceClient", "docstring_tokens": ["Returns", "Gcp", "Video", "Intelligence", "Service", "client"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252471}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/run.py#L180-L192", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "convert a list of '='-spaced command-line arguments to a dictionary, evaluating python objects when possible", "language": "python", "parameters": "(args)", "return_statement": "return {k: parse(v) for k,v in parse_unknown_args(args).items()}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "parse", "(", "arg_1", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "str", ")", "try", ":", "return", "eval", "(", "arg_1", ")", "except", "(", "NameError", ",", "SyntaxError", ")", ":", "return", "arg_1", "return", "{", "arg_2", ":", "parse", "(", "arg_1", ")", "for", "arg_2", ",", "arg_1", "in", "parse_unknown_args", "(", "arg_0", ")", ".", "items", "(", ")", "}"], "function": "def Func(arg_0):\n    '''\n    convert a list of '='-spaced command-line arguments to a dictionary, evaluating python objects when possible\n    '''\n    def parse(arg_1):\n\n        assert isinstance(arg_1, str)\n        try:\n            return eval(arg_1)\n        except (NameError, SyntaxError):\n            return arg_1\n\n    return {arg_2: parse(arg_1) for arg_2,arg_1 in parse_unknown_args(arg_0).items()}", "path": "baselines/run.py", "identifier": "parse_cmdline_kwargs", "docstring": "convert a list of '='-spaced command-line arguments to a dictionary, evaluating python objects when possible", "docstring_tokens": ["convert", "a", "list", "of", "=", "-", "spaced", "command", "-", "line", "arguments", "to", "a", "dictionary", "evaluating", "python", "objects", "when", "possible"], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 252472}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/timeslots.py#L223-L231", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a new TimeslotCollection merged with a specified `timeslots`", "language": "python", "parameters": "(self, timeslots: 'TimeslotCollection')", "return_statement": "return TimeslotCollection(*slots)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "'TimeslotCollection'", ")", "->", "'TimeslotCollection'", ":", "arg_2", "=", "[", "Timeslot", "(", "arg_3", ".", "interval", ",", "arg_3", ".", "channel", ")", "for", "arg_3", "in", "arg_0", ".", "timeslots", "]", "arg_2", ".", "extend", "(", "[", "Timeslot", "(", "arg_3", ".", "interval", ",", "arg_3", ".", "channel", ")", "for", "arg_3", "in", "arg_1", ".", "timeslots", "]", ")", "return", "TimeslotCollection", "(", "*", "arg_2", ")"], "function": "def Func(arg_0, arg_1: 'TimeslotCollection') -> 'TimeslotCollection':\n        \"\"\"Return a new TimeslotCollection Func with a specified `timeslots`\n\n        Args:\n            timeslots: TimeslotCollection to be Func\n        \"\"\"\n        arg_2 = [Timeslot(arg_3.interval, arg_3.channel) for arg_3 in arg_0.timeslots]\n        arg_2.extend([Timeslot(arg_3.interval, arg_3.channel) for arg_3 in arg_1.timeslots])\n        return TimeslotCollection(*arg_2)", "path": "qiskit/pulse/timeslots.py", "identifier": "TimeslotCollection.merged", "docstring": "Return a new TimeslotCollection merged with a specified `timeslots`\n\n        Args:\n            timeslots: TimeslotCollection to be merged", "docstring_tokens": ["Return", "a", "new", "TimeslotCollection", "merged", "with", "a", "specified", "timeslots"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252473}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/rich_content.py#L148-L157", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns list of Amazon Alexa compatible states of the RichMessage\n        instance nested controls.", "language": "python", "parameters": "(self)", "return_statement": "return alexa_controls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "list", ":", "arg_1", "=", "[", "control", ".", "Func", "(", ")", "for", "control", "in", "arg_0", ".", "controls", "]", "return", "arg_1"], "function": "def Func(arg_0) -> list:\n        \"\"\"Returns list of Amazon Alexa compatible states of the RichMessage\n        instance nested controls.\n\n        Returns:\n            Func_controls: Amazon Alexa representation of RichMessage instance nested\n                controls.\n        \"\"\"\n        arg_1 = [control.Func() for control in arg_0.controls]\n        return arg_1", "path": "deeppavlov/core/agent/rich_content.py", "identifier": "RichMessage.alexa", "docstring": "Returns list of Amazon Alexa compatible states of the RichMessage\n        instance nested controls.\n\n        Returns:\n            alexa_controls: Amazon Alexa representation of RichMessage instance nested\n                controls.", "docstring_tokens": ["Returns", "list", "of", "Amazon", "Alexa", "compatible", "states", "of", "the", "RichMessage", "instance", "nested", "controls", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 252474}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L1201-L1257", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Compute the saturation for a continuous level. This breaks the level into\n  multiple regions and computes the saturation level for each region.", "language": "python", "parameters": "(outputs, outputsShape, sparseForm=False)", "return_statement": "return (sat, innerSat)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_2", ":", "arg_0", "=", "arg_0", ".", "reshape", "(", "arg_1", ")", "arg_3", "=", "SM32", "(", "arg_0", ")", "else", ":", "if", "len", "(", "arg_0", ")", ">", "0", ":", "assert", "(", "arg_0", ".", "max", "(", ")", "<", "arg_1", "[", "0", "]", "*", "arg_1", "[", "1", "]", ")", "arg_3", "=", "SM32", "(", "1", ",", "arg_1", "[", "0", "]", "*", "arg_1", "[", "1", "]", ")", "arg_3", ".", "setRowFromSparse", "(", "0", ",", "arg_0", ",", "[", "1", "]", "*", "len", "(", "arg_0", ")", ")", "arg_3", ".", "reshape", "(", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", "]", ")", "arg_4", "=", "15", "arg_5", "=", "xrange", "(", "arg_4", "+", "1", ",", "arg_1", "[", "0", "]", "+", "1", ",", "arg_4", ")", "arg_6", "=", "xrange", "(", "arg_4", "+", "1", ",", "arg_1", "[", "1", "]", "+", "1", ",", "arg_4", ")", "arg_7", "=", "arg_3", ".", "nNonZerosPerBox", "(", "arg_5", ",", "arg_6", ")", "(", "arg_8", ",", "arg_9", ")", "=", "arg_7", ".", "tolist", "(", ")", "arg_9", "/=", "float", "(", "arg_4", "*", "arg_4", ")", "arg_10", "=", "list", "(", "arg_9", ")", "arg_11", "=", "[", "]", "arg_12", "=", "set", "(", "arg_8", ")", "for", "(", "arg_13", ",", "arg_14", ")", "in", "itertools", ".", "izip", "(", "arg_8", ",", "arg_9", ")", ":", "(", "arg_15", ",", "arg_16", ")", "=", "arg_13", "if", "(", "arg_15", "-", "1", ",", "arg_16", ")", "in", "arg_12", "and", "(", "arg_15", ",", "arg_16", "-", "1", ")", "in", "arg_12", "and", "(", "arg_15", "+", "1", ",", "arg_16", ")", "in", "arg_12", "and", "(", "arg_15", ",", "arg_16", "+", "1", ")", "in", "arg_12", ":", "arg_11", ".", "append", "(", "arg_14", ")", "return", "(", "arg_10", ",", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n  \"\"\"\n  Compute the saturation for a continuous level. This breaks the level into\n  multiple regions and computes the saturation level for each region.\n\n  Parameters:\n  --------------------------------------------\n  outputs:      output of the level. If sparseForm is True, this is a list of\n                  the non-zeros. If sparseForm is False, it is the dense\n                  representation\n  outputsShape: The shape of the outputs of the level (height, width)\n  retval:       (sat, innerSat):\n                  sat: list of the saturation levels of each non-empty\n                    region of the level (each 0 -> 1.0)\n                  innerSat: list of the saturation level of each non-empty region\n                       that is not near an edge (each 0 -> 1.0)\n\n  \"\"\"\n\n  # Get the outputs into a SparseBinaryMatrix\n  if not arg_2:\n    arg_0 = arg_0.reshape(arg_1)\n    arg_3 = SM32(arg_0)\n  else:\n    if len(arg_0) > 0:\n      assert (arg_0.max() < arg_1[0] * arg_1[1])\n    arg_3 = SM32(1, arg_1[0] * arg_1[1])\n    arg_3.setRowFromSparse(0, arg_0, [1]*len(arg_0))\n    arg_3.reshape(arg_1[0], arg_1[1])\n\n  # Get the activity in each local region using the nNonZerosPerBox method\n  # This method takes a list of the end row indices and a list of the end\n  #  column indices.\n  # We will use regions that are 15x15, which give us about a 1/225 (.4%) resolution\n  #  on saturation.\n  arg_4 = 15\n  arg_5 = xrange(arg_4+1, arg_1[0]+1, arg_4)\n  arg_6 = xrange(arg_4+1, arg_1[1]+1, arg_4)\n  arg_7 = arg_3.nNonZerosPerBox(arg_5, arg_6)\n\n  # Get all the nonzeros out - those are our saturation sums\n  (arg_8, arg_9) = arg_7.tolist()\n  arg_9 /= float(arg_4 * arg_4)\n  arg_10 = list(arg_9)\n\n  # Now, to compute which are the inner regions, we will only take the ones that\n  #  are surrounded by activity above, below, left and right\n  arg_11 = []\n  arg_12 = set(arg_8)\n  for (arg_13, arg_14) in itertools.izip(arg_8, arg_9):\n    (arg_15, arg_16) = arg_13\n    if (arg_15-1,arg_16) in arg_12 and (arg_15, arg_16-1) in arg_12 \\\n      and (arg_15+1, arg_16) in arg_12 and (arg_15, arg_16+1) in arg_12:\n      arg_11.append(arg_14)\n\n\n  return (arg_10, arg_11)", "path": "src/nupic/algorithms/fdrutilities.py", "identifier": "computeSaturationLevels", "docstring": "Compute the saturation for a continuous level. This breaks the level into\n  multiple regions and computes the saturation level for each region.\n\n  Parameters:\n  --------------------------------------------\n  outputs:      output of the level. If sparseForm is True, this is a list of\n                  the non-zeros. If sparseForm is False, it is the dense\n                  representation\n  outputsShape: The shape of the outputs of the level (height, width)\n  retval:       (sat, innerSat):\n                  sat: list of the saturation levels of each non-empty\n                    region of the level (each 0 -> 1.0)\n                  innerSat: list of the saturation level of each non-empty region\n                       that is not near an edge (each 0 -> 1.0)", "docstring_tokens": ["Compute", "the", "saturation", "for", "a", "continuous", "level", ".", "This", "breaks", "the", "level", "into", "multiple", "regions", "and", "computes", "the", "saturation", "level", "for", "each", "region", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252475}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment.py#L263-L294", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Stop experiment.", "language": "python", "parameters": "(ctx, yes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "get_project_experiment_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'experiment'", ")", ")", "if", "not", "arg_1", "and", "not", "click", ".", "confirm", "(", "\"Are sure you want to Func \"", "\"experiment `{}`\"", ".", "format", "(", "arg_4", ")", ")", ":", "click", ".", "echo", "(", "'Existing without Funcping experiment.'", ")", "sys", ".", "exit", "(", "0", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "experiment", ".", "Func", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func experiment `{}`.'", ".", "format", "(", "arg_4", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"Experiment is being Funcped.\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Stop experiment.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon experiment Func\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 2 Func\n    ```\n    \"\"\"\n    arg_2, arg_3, arg_4 = get_project_experiment_or_local(arg_0.obj.get('project'),\n                                                                      arg_0.obj.get('experiment'))\n    if not arg_1 and not click.confirm(\"Are sure you want to Func \"\n                                     \"experiment `{}`\".format(arg_4)):\n        click.echo('Existing without Funcping experiment.')\n        sys.exit(0)\n\n    try:\n        PolyaxonClient().experiment.Func(arg_2, arg_3, arg_4)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func experiment `{}`.'.format(arg_4))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"Experiment is being Funcped.\")", "path": "polyaxon_cli/cli/experiment.py", "identifier": "stop", "docstring": "Stop experiment.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon experiment stop\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 2 stop\n    ```", "docstring_tokens": ["Stop", "experiment", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 252476}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/performable.py#L41-L52", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "Performable template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return PerformableNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "PerformableNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Performable template tag.\n\n    Renders Javascript code to set-up Performable tracking.  You must\n    supply your Performable API key in the ``PERFORMABLE_API_KEY``\n    setting.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return PerformableNode()", "path": "analytical/templatetags/performable.py", "identifier": "performable", "docstring": "Performable template tag.\n\n    Renders Javascript code to set-up Performable tracking.  You must\n    supply your Performable API key in the ``PERFORMABLE_API_KEY``\n    setting.", "docstring_tokens": ["Performable", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 252477}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L680-L698", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Delete a milestone request", "language": "python", "parameters": "(session, milestone_request_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'action'", ":", "'delete'", ",", "}", "arg_3", "=", "'milestone_requests/{}'", ".", "format", "(", "arg_1", ")", "arg_4", "=", "make_put_request", "(", "arg_0", ",", "arg_3", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "arg_4", ".", "json", "(", ")", "if", "arg_4", ".", "status_code", "==", "200", ":", "return", "arg_5", "[", "'status'", "]", "else", ":", "raise", "MilestoneRequestNotDeletedException", "(", "message", "=", "arg_5", "[", "'message'", "]", ",", "error_code", "=", "arg_5", "[", "'error_code'", "]", ",", "request_id", "=", "arg_5", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Delete a milestone request\n    \"\"\"\n    arg_2 = {\n        'action': 'delete',\n    }\n    # POST /api/projects/0.1/milestone_requests/{milestone_request_id}/?action=\n    # delete\n    arg_3 = 'milestone_requests/{}'.format(arg_1)\n    arg_4 = make_put_request(arg_0, arg_3, arg_2=arg_2)\n    arg_5 = arg_4.json()\n    if arg_4.status_code == 200:\n        return arg_5['status']\n    else:\n        raise MilestoneRequestNotDeletedException(\n            message=arg_5['message'],\n            error_code=arg_5['error_code'],\n            request_id=arg_5['request_id'])", "path": "freelancersdk/resources/projects/projects.py", "identifier": "delete_milestone_request", "docstring": "Delete a milestone request", "docstring_tokens": ["Delete", "a", "milestone", "request"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 252478}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementclient.py#L158-L177", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Performs a GET request and returns the response.", "language": "python", "parameters": "(self, path, x_ms_version=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "HTTPRequest", "(", ")", "arg_3", ".", "method", "=", "'GET'", "arg_3", ".", "host", "=", "arg_0", ".", "host", "arg_3", ".", "path", "=", "arg_1", "arg_3", ".", "path", ",", "arg_3", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_3", ")", "arg_3", ".", "headers", "=", "arg_0", ".", "_update_management_header", "(", "arg_3", ",", "arg_2", ")", "arg_8", "=", "arg_0", ".", "_perform_request", "(", "arg_3", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Performs a GET request and returns the response.\n\n        path:\n            Path to the resource.\n            Ex: '/<subscription-id>/services/hostedservices/<service-name>'\n        x_ms_version:\n            If specified, this is used for the x-ms-version header.\n            Otherwise, self.x_ms_version is used.\n        '''\n        arg_3 = HTTPRequest()\n        arg_3.method = 'GET'\n        arg_3.host = arg_0.host\n        arg_3.path = arg_1\n        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)\n        arg_3.headers = arg_0._update_management_header(arg_3, arg_2)\n        arg_8 = arg_0._perform_request(arg_3)\n\n        return arg_8", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementclient.py", "identifier": "_ServiceManagementClient.perform_get", "docstring": "Performs a GET request and returns the response.\n\n        path:\n            Path to the resource.\n            Ex: '/<subscription-id>/services/hostedservices/<service-name>'\n        x_ms_version:\n            If specified, this is used for the x-ms-version header.\n            Otherwise, self.x_ms_version is used.", "docstring_tokens": ["Performs", "a", "GET", "request", "and", "returns", "the", "response", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252479}
{"url": "https://github.com/agabrown/PyGaia/blob/ae972b0622a15f713ffae471f925eac25ccdae47/pygaia/errors/utils.py#L87-L103", "sha": "ae972b0622a15f713ffae471f925eac25ccdae47", "docstring_summary": "Returns the number of transits across the Gaia focal plane averaged over ecliptic longitude.", "language": "python", "parameters": "(beta)", "return_statement": "return _averageTransitNumber[indices]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "array", "(", "floor", "(", "abs", "(", "sin", "(", "arg_0", ")", ")", "*", "arg_2", ")", ",", "dtype", "=", "int", ")", "arg_1", "[", "(", "arg_1", "==", "arg_2", ")", "]", "=", "arg_2", "-", "1", "return", "_averageTransitNumber", "[", "arg_1", "]"], "function": "def Func(arg_0):\n  \"\"\"\n  Returns the number of transits across the Gaia focal plane averaged over ecliptic longitude.\n\n  Parameters\n  ----------\n\n  beta - Value(s) of the Ecliptic latitude.\n\n  Returns\n  -------\n\n  Average number of transits for the input values of beta.\n  \"\"\"\n  arg_1 = array(floor(abs(sin(arg_0))*arg_2), dtype=int)\n  arg_1[(arg_1==arg_2)] = arg_2-1\n  return _averageTransitNumber[arg_1]", "path": "pygaia/errors/utils.py", "identifier": "averageNumberOfTransits", "docstring": "Returns the number of transits across the Gaia focal plane averaged over ecliptic longitude.\n\n  Parameters\n  ----------\n\n  beta - Value(s) of the Ecliptic latitude.\n\n  Returns\n  -------\n\n  Average number of transits for the input values of beta.", "docstring_tokens": ["Returns", "the", "number", "of", "transits", "across", "the", "Gaia", "focal", "plane", "averaged", "over", "ecliptic", "longitude", "."], "nwo": "agabrown/PyGaia", "score": 0.39410601089411446, "idx": 252480}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L376-L394", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Process the logic and structuration of the mining database.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"mining\"", "]", ":", "arg_1", "=", "arg_0", ".", "mine", "(", ")", "if", "arg_1", ":", "arg_0", ".", "_add", "(", "arg_1", ")", "arg_0", ".", "_backup", "(", ")"], "function": "def Func(arg_0):  # pragma: no cover\n        \"\"\"\n        Process the logic and structuration of the mining database.\n        \"\"\"\n\n        if PyFunceble.CONFIGURATION[\"mining\"]:\n            # The mining is activated.\n\n            # We load the mining logic.\n            arg_1 = arg_0.mine()\n\n            if arg_1:\n                # The mined data is not empty or None.\n\n                # We add the mined data to the global database.\n                arg_0._add(arg_1)\n\n                # And we finally backup everything.\n                arg_0._backup()", "path": "PyFunceble/mining.py", "identifier": "Mining.process", "docstring": "Process the logic and structuration of the mining database.", "docstring_tokens": ["Process", "the", "logic", "and", "structuration", "of", "the", "mining", "database", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 252481}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L142-L183", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Calculates the number of pixels to use for J at a given memory usage.", "language": "python", "parameters": "(s, nparams, decimate=1, max_mem=1e9, min_redundant=20)", "return_statement": "return num_px", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "1e9", ",", "arg_4", "=", "20", ")", ":", "arg_5", "=", "int", "(", "arg_3", "//", "8", "//", "arg_1", ")", "arg_6", "=", "arg_4", "*", "arg_1", "arg_7", "=", "arg_0", ".", "residuals", ".", "size", "//", "arg_2", "if", "arg_6", ">", "arg_5", ":", "raise", "RuntimeError", "(", "'Insufficient max_mem for desired redundancy.'", ")", "arg_8", "=", "np", ".", "clip", "(", "arg_7", ",", "arg_6", ",", "arg_5", ")", ".", "astype", "(", "'int'", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=1e9, arg_4=20):\n    \"\"\"\n    Calculates the number of pixels to use for J at a given memory usage.\n\n    Tries to pick a number of pixels as (size of image / `decimate`).\n    However, clips this to a maximum size and minimum size to ensure that\n    (1) too much memory isn't used and (2) J has enough elements so that\n    the inverse of JTJ will be well-conditioned.\n\n    Parameters\n    ----------\n        s : :class:`peri.states.State`\n            The state on which to calculate J.\n        nparams : Int\n            The number of parameters that will be included in J.\n        decimate : Int, optional\n            The amount to decimate the number of pixels in the image by,\n            i.e. tries to pick num_px = size of image / decimate.\n            Default is 1\n        max_mem : Numeric, optional\n            The maximum allowed memory, in bytes, for J to occupy at\n            double-precision. Default is 1e9.\n        min_redundant : Int, optional\n            The number of pixels must be at least `min_redundant` *\n            `nparams`. If not, an error is raised. Default is 20\n\n    Returns\n    -------\n        num_px : Int\n            The number of pixels at which to calcualte J.\n    \"\"\"\n    #1. Max for a given max_mem:\n    arg_5 = int(arg_3 // 8 // arg_1) #1 float = 8 bytes\n    #2. num_pix for a given redundancy\n    arg_6 = arg_4*arg_1\n    #3. And # desired for decimation\n    arg_7 = arg_0.residuals.size//arg_2\n\n    if arg_6 > arg_5:\n        raise RuntimeError('Insufficient max_mem for desired redundancy.')\n    arg_8 = np.clip(arg_7, arg_6, arg_5).astype('int')\n    return arg_8", "path": "peri/opt/optimize.py", "identifier": "get_num_px_jtj", "docstring": "Calculates the number of pixels to use for J at a given memory usage.\n\n    Tries to pick a number of pixels as (size of image / `decimate`).\n    However, clips this to a maximum size and minimum size to ensure that\n    (1) too much memory isn't used and (2) J has enough elements so that\n    the inverse of JTJ will be well-conditioned.\n\n    Parameters\n    ----------\n        s : :class:`peri.states.State`\n            The state on which to calculate J.\n        nparams : Int\n            The number of parameters that will be included in J.\n        decimate : Int, optional\n            The amount to decimate the number of pixels in the image by,\n            i.e. tries to pick num_px = size of image / decimate.\n            Default is 1\n        max_mem : Numeric, optional\n            The maximum allowed memory, in bytes, for J to occupy at\n            double-precision. Default is 1e9.\n        min_redundant : Int, optional\n            The number of pixels must be at least `min_redundant` *\n            `nparams`. If not, an error is raised. Default is 20\n\n    Returns\n    -------\n        num_px : Int\n            The number of pixels at which to calcualte J.", "docstring_tokens": ["Calculates", "the", "number", "of", "pixels", "to", "use", "for", "J", "at", "a", "given", "memory", "usage", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252482}
{"url": "https://github.com/MeirKriheli/python-bidi/blob/a0e265bb465c1b7ad628487991e33b5ebe364641/bidi/algorithm.py#L62-L104", "sha": "a0e265bb465c1b7ad628487991e33b5ebe364641", "docstring_summary": "Display debug information for the storage", "language": "python", "parameters": "(storage, base_info=False, chars=True, runs=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ")", ":", "import", "codecs", "import", "locale", "import", "sys", "if", "six", ".", "PY2", ":", "arg_4", "=", "codecs", ".", "getwriter", "(", "locale", ".", "getpreferredencoding", "(", ")", ")", "(", "sys", ".", "stderr", ")", "else", ":", "arg_4", "=", "sys", ".", "stderr", "arg_5", "=", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "3", "]", "arg_4", ".", "write", "(", "'in %s\\n'", "%", "arg_5", ")", "if", "arg_1", ":", "arg_4", ".", "write", "(", "u'  base level  : %d\\n'", "%", "arg_0", "[", "'base_level'", "]", ")", "arg_4", ".", "write", "(", "u'  base dir    : %s\\n'", "%", "arg_0", "[", "'base_dir'", "]", ")", "if", "arg_3", ":", "arg_4", ".", "write", "(", "u'  runs        : %s\\n'", "%", "list", "(", "arg_0", "[", "'runs'", "]", ")", ")", "if", "arg_2", ":", "arg_6", "=", "u'  Chars       : '", "for", "arg_7", "in", "arg_0", "[", "'chars'", "]", ":", "if", "arg_7", "!=", "'\\n'", ":", "arg_6", "+=", "arg_7", "[", "'ch'", "]", "else", ":", "arg_6", "+=", "'C'", "arg_4", ".", "write", "(", "arg_6", "+", "u'\\n'", ")", "arg_6", "=", "u'  Res. levels : %s\\n'", "%", "u''", ".", "join", "(", "[", "six", ".", "text_type", "(", "arg_7", "[", "'level'", "]", ")", "for", "arg_7", "in", "arg_0", "[", "'chars'", "]", "]", ")", "arg_4", ".", "write", "(", "arg_6", ")", "arg_8", "=", "[", "arg_7", "[", "'type'", "]", ".", "ljust", "(", "3", ")", "for", "arg_7", "in", "arg_0", "[", "'chars'", "]", "]", "for", "arg_9", "in", "range", "(", "3", ")", ":", "if", "arg_9", ":", "arg_6", "=", "u'                %s\\n'", "else", ":", "arg_6", "=", "u'  Res. types  : %s\\n'", "arg_4", ".", "write", "(", "arg_6", "%", "u''", ".", "join", "(", "[", "arg_10", "[", "arg_9", "]", "for", "arg_10", "in", "arg_8", "]", ")", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True, arg_3=False):\n    \"Display debug information for the storage\"\n\n    import codecs\n    import locale\n    import sys\n\n    if six.PY2:\n        arg_4 = codecs.getwriter(locale.getpreferredencoding())(sys.stderr)\n    else:\n        arg_4 = sys.stderr\n\n    arg_5 = inspect.stack()[1][3]\n    arg_4.write('in %s\\n' % arg_5)\n\n    if arg_1:\n        arg_4.write(u'  base level  : %d\\n' % arg_0['base_level'])\n        arg_4.write(u'  base dir    : %s\\n' % arg_0['base_dir'])\n\n    if arg_3:\n        arg_4.write(u'  runs        : %s\\n' % list(arg_0['runs']))\n\n    if arg_2:\n        arg_6 = u'  Chars       : '\n        for arg_7 in arg_0['chars']:\n            if arg_7 != '\\n':\n                arg_6 += arg_7['ch']\n            else:\n                arg_6 += 'C'\n        arg_4.write(arg_6 + u'\\n')\n\n        arg_6 = u'  Res. levels : %s\\n' % u''.join(\n            [six.text_type(arg_7['level']) for arg_7 in arg_0['chars']])\n        arg_4.write(arg_6)\n\n        arg_8 = [arg_7['type'].ljust(3) for arg_7 in arg_0['chars']]\n\n        for arg_9 in range(3):\n            if arg_9:\n                arg_6 = u'                %s\\n'\n            else:\n                arg_6 = u'  Res. types  : %s\\n'\n            arg_4.write(arg_6 % u''.join([arg_10[arg_9] for arg_10 in arg_8]))", "path": "bidi/algorithm.py", "identifier": "debug_storage", "docstring": "Display debug information for the storage", "docstring_tokens": ["Display", "debug", "information", "for", "the", "storage"], "nwo": "MeirKriheli/python-bidi", "score": 0.28828505124417525, "idx": 252483}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L886-L904", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Remove a contact from the roster.", "language": "python", "parameters": "(self, jid, callback = None, error_callback = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "roster", "[", "arg_1", "]", "if", "arg_1", "not", "in", "arg_0", ".", "roster", ":", "raise", "KeyError", "(", "arg_1", ")", "arg_4", "=", "RosterItem", "(", "arg_1", ",", "subscription", "=", "\"remove\"", ")", "arg_0", ".", "_roster_set", "(", "arg_4", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2 = None, arg_3 = None):\n        \"\"\"Remove a contact from the roster.\n\n        :Parameters:\n            - `jid`: contact's jid\n            - `callback`: function to call when the request succeeds. It should\n              accept a single argument - a `RosterItem` describing the\n              requested change\n            - `error_callback`: function to call when the request fails. It\n              should accept a single argument - an error stanza received\n              (`None` in case of timeout)\n        :Types:\n            - `jid`: `JID`\n        \"\"\"\n        arg_4 = arg_0.roster[arg_1]\n        if arg_1 not in arg_0.roster:\n            raise KeyError(arg_1)\n        arg_4 = RosterItem(arg_1, subscription = \"remove\")\n        arg_0._roster_set(arg_4, arg_2, arg_3)", "path": "pyxmpp2/roster.py", "identifier": "RosterClient.remove_item", "docstring": "Remove a contact from the roster.\n\n        :Parameters:\n            - `jid`: contact's jid\n            - `callback`: function to call when the request succeeds. It should\n              accept a single argument - a `RosterItem` describing the\n              requested change\n            - `error_callback`: function to call when the request fails. It\n              should accept a single argument - an error stanza received\n              (`None` in case of timeout)\n        :Types:\n            - `jid`: `JID`", "docstring_tokens": ["Remove", "a", "contact", "from", "the", "roster", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 252484}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L362-L366", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "write lines, one by one, separated by \\n to device", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "replace", "(", "'\\r'", ",", "''", ")", ".", "split", "(", "'\\n'", ")", "for", "arg_3", "in", "arg_2", ":", "arg_0", ".", "__exchange", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"write lines, one by one, separated by \\n to device\"\"\"\n        arg_2 = arg_1.replace('\\r', '').split('\\n')\n        for arg_3 in arg_2:\n            arg_0.__exchange(arg_3)", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.write_lines", "docstring": "write lines, one by one, separated by \\n to device", "docstring_tokens": ["write", "lines", "one", "by", "one", "separated", "by", "\\", "n", "to", "device"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 252485}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L518-L525", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Adds the header template to the master template string", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"===============\"", ")", "logger", ".", "debug", "(", "\"Building header\"", ")", "logger", ".", "debug", "(", "\"===============\"", ")", "arg_0", ".", "template", "+=", "hs", ".", "header"], "function": "def Func(arg_0):\n        \"\"\"Adds the header template to the master template string\n        \"\"\"\n\n        logger.debug(\"===============\")\n        logger.debug(\"Building header\")\n        logger.debug(\"===============\")\n        arg_0.template += hs.header", "path": "flowcraft/generator/engine.py", "identifier": "NextflowGenerator._build_header", "docstring": "Adds the header template to the master template string", "docstring_tokens": ["Adds", "the", "header", "template", "to", "the", "master", "template", "string"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 252486}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/design_analysis.py#L320-L336", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check size of inheritance hierarchy and number of instance attributes", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "list", "(", "arg_1", ".", "ancestors", "(", ")", ")", ")", "if", "arg_2", ">", "arg_0", ".", "config", ".", "max_parents", ":", "arg_0", ".", "add_message", "(", "\"too-many-ancestors\"", ",", "arg_1", "=", "arg_1", ",", "args", "=", "(", "arg_2", ",", "arg_0", ".", "config", ".", "max_parents", ")", ",", ")", "if", "len", "(", "arg_1", ".", "instance_attrs", ")", ">", "arg_0", ".", "config", ".", "max_attributes", ":", "arg_0", ".", "add_message", "(", "\"too-many-instance-attributes\"", ",", "arg_1", "=", "arg_1", ",", "args", "=", "(", "len", "(", "arg_1", ".", "instance_attrs", ")", ",", "arg_0", ".", "config", ".", "max_attributes", ")", ",", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"check size of inheritance hierarchy and number of instance attributes\n        \"\"\"\n        arg_2 = len(list(arg_1.ancestors()))\n        if arg_2 > arg_0.config.max_parents:\n            arg_0.add_message(\n                \"too-many-ancestors\",\n                arg_1=arg_1,\n                args=(arg_2, arg_0.config.max_parents),\n            )\n\n        if len(arg_1.instance_attrs) > arg_0.config.max_attributes:\n            arg_0.add_message(\n                \"too-many-instance-attributes\",\n                arg_1=arg_1,\n                args=(len(arg_1.instance_attrs), arg_0.config.max_attributes),\n            )", "path": "pylint/checkers/design_analysis.py", "identifier": "MisdesignChecker.visit_classdef", "docstring": "check size of inheritance hierarchy and number of instance attributes", "docstring_tokens": ["check", "size", "of", "inheritance", "hierarchy", "and", "number", "of", "instance", "attributes"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252487}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/eval.py#L498-L542", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "r'''Note transcription evaluation", "language": "python", "parameters": "(ref, est, **kwargs)", "return_statement": "return mir_eval.transcription.evaluate(\n        ref_intervals, ref_pitches, est_intervals, est_pitches, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "'pitch_contour'", "arg_0", "=", "coerce_annotation", "(", "arg_0", ",", "arg_3", ")", "arg_1", "=", "coerce_annotation", "(", "arg_1", ",", "arg_3", ")", "arg_4", ",", "arg_5", "=", "arg_0", ".", "to_interval_values", "(", ")", "arg_6", ",", "arg_7", "=", "arg_1", ".", "to_interval_values", "(", ")", "arg_8", "=", "np", ".", "asarray", "(", "[", "p", "[", "'frequency'", "]", "*", "(", "-", "1", ")", "**", "(", "~", "p", "[", "'voiced'", "]", ")", "for", "p", "in", "arg_5", "]", ")", "arg_9", "=", "np", ".", "asarray", "(", "[", "p", "[", "'frequency'", "]", "*", "(", "-", "1", ")", "**", "(", "~", "p", "[", "'voiced'", "]", ")", "for", "p", "in", "arg_7", "]", ")", "return", "mir_eval", ".", "Func", ".", "evaluate", "(", "arg_4", ",", "arg_8", ",", "arg_6", ",", "arg_9", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    r'''Note Func evaluation\n\n    Parameters\n    ----------\n    ref : jams.Annotation\n        Reference annotation object\n    est : jams.Annotation\n        Estimated annotation object\n    kwargs\n        Additional keyword arguments\n\n    Returns\n    -------\n    scores : dict\n        Dictionary of scores, where the key is the metric name (str) and\n        the value is the (float) score achieved.\n\n    See Also\n    --------\n    mir_eval.Func.evaluate\n\n    Examples\n    --------\n    >>> # Load in the JAMS objects\n    >>> ref_jam = jams.load('reference.jams')\n    >>> est_jam = jams.load('estimated.jams')\n    >>> # Select the first relevant annotations. You can use any annotation\n    >>> # type that can be converted to pitch_contour (such as pitch_midi)\n    >>> ref_ann = ref_jam.search(namespace='pitch_contour')[0]\n    >>> est_ann = est_jam.search(namespace='note_hz')[0]\n    >>> scores = jams.eval.Func(ref_ann, est_ann)\n    '''\n\n    arg_3 = 'pitch_contour'\n    arg_0 = coerce_annotation(arg_0, arg_3)\n    arg_1 = coerce_annotation(arg_1, arg_3)\n    arg_4, arg_5 = arg_0.to_interval_values()\n    arg_6, arg_7 = arg_1.to_interval_values()\n\n    arg_8 = np.asarray([p['frequency'] * (-1)**(~p['voiced']) for p in arg_5])\n    arg_9 = np.asarray([p['frequency'] * (-1)**(~p['voiced']) for p in arg_7])\n\n    return mir_eval.Func.evaluate(\n        arg_4, arg_8, arg_6, arg_9, **arg_2)", "path": "jams/eval.py", "identifier": "transcription", "docstring": "r'''Note transcription evaluation\n\n    Parameters\n    ----------\n    ref : jams.Annotation\n        Reference annotation object\n    est : jams.Annotation\n        Estimated annotation object\n    kwargs\n        Additional keyword arguments\n\n    Returns\n    -------\n    scores : dict\n        Dictionary of scores, where the key is the metric name (str) and\n        the value is the (float) score achieved.\n\n    See Also\n    --------\n    mir_eval.transcription.evaluate\n\n    Examples\n    --------\n    >>> # Load in the JAMS objects\n    >>> ref_jam = jams.load('reference.jams')\n    >>> est_jam = jams.load('estimated.jams')\n    >>> # Select the first relevant annotations. You can use any annotation\n    >>> # type that can be converted to pitch_contour (such as pitch_midi)\n    >>> ref_ann = ref_jam.search(namespace='pitch_contour')[0]\n    >>> est_ann = est_jam.search(namespace='note_hz')[0]\n    >>> scores = jams.eval.transcription(ref_ann, est_ann)", "docstring_tokens": ["r", "Note", "transcription", "evaluation"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 252488}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant_events.py#L221-L257", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Mark validation status for a variant.", "language": "python", "parameters": "(self, institute, case, user, link, variant, validate_type)", "return_statement": "return updated_variant", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "if", "not", "arg_6", "in", "SANGER_OPTIONS", ":", "LOG", ".", "warning", "(", "\"Invalid validation string: %s\"", ",", "arg_6", ")", "LOG", ".", "info", "(", "\"Validation options: %s\"", ",", "', '", ".", "join", "(", "SANGER_OPTIONS", ")", ")", "return", "arg_7", "=", "arg_0", ".", "variant_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_5", "[", "'_id'", "]", "}", ",", "{", "'$set'", ":", "{", "'validation'", ":", "arg_6", "}", "}", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "arg_0", ".", "create_event", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "category", "=", "'variant'", ",", "verb", "=", "'Func'", ",", "arg_5", "=", "arg_5", ",", "subject", "=", "arg_5", "[", "'display_name'", "]", ",", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        \"\"\"Mark validation status for a variant.\n\n        Arguments:\n            institute (dict): A Institute object\n            case (dict): Case object\n            user (dict): A User object\n            link (str): The url to be used in the event\n            variant (dict): A variant object\n            Func_type(str): The outcome of validation.\n                                choices=('True positive', 'False positive')\n\n        Returns:\n            updated_variant(dict)\n        \"\"\"\n        if not arg_6 in SANGER_OPTIONS:\n            LOG.warning(\"Invalid validation string: %s\", arg_6)\n            LOG.info(\"Validation options: %s\", ', '.join(SANGER_OPTIONS))\n            return\n\n        arg_7 = arg_0.variant_collection.find_one_and_update(\n            {'_id': arg_5['_id']},\n            {'$set': {'validation': arg_6}},\n            return_document=pymongo.ReturnDocument.AFTER\n        )\n\n        arg_0.create_event(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            category='variant',\n            verb='Func',\n            arg_5=arg_5,\n            subject=arg_5['display_name'],\n        )\n        return arg_7", "path": "scout/adapter/mongo/variant_events.py", "identifier": "VariantEventHandler.validate", "docstring": "Mark validation status for a variant.\n\n        Arguments:\n            institute (dict): A Institute object\n            case (dict): Case object\n            user (dict): A User object\n            link (str): The url to be used in the event\n            variant (dict): A variant object\n            validate_type(str): The outcome of validation.\n                                choices=('True positive', 'False positive')\n\n        Returns:\n            updated_variant(dict)", "docstring_tokens": ["Mark", "validation", "status", "for", "a", "variant", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252489}
{"url": "https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/cli.py#L19-L22", "sha": "8c6bb54888675652d25324184967392d00d128fc", "docstring_summary": "Output the names to the given file", "language": "python", "parameters": "(ontology, output, ols_base)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "get_Func", "(", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ")", ":", "click", ".", "echo", "(", "arg_3", ",", "file", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Output the names to the given file\"\"\"\n    for arg_3 in get_Func(arg_0=arg_0, arg_2=arg_2):\n        click.echo(arg_3, file=arg_1)", "path": "src/ols_client/cli.py", "identifier": "labels", "docstring": "Output the names to the given file", "docstring_tokens": ["Output", "the", "names", "to", "the", "given", "file"], "nwo": "cthoyt/ols-client", "score": 0.25890992733444657, "idx": 252490}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L515-L716", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the next aggregated record, if any", "language": "python", "parameters": "(self, record, curInputBookmark)", "return_statement": "return (outRecord, retInputBookmark)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "None", "arg_4", "=", "None", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "_inIdx", "+=", "1", "if", "arg_0", ".", "_filter", "!=", "None", "and", "not", "arg_0", ".", "_filter", "[", "0", "]", "(", "arg_0", ".", "_filter", "[", "1", "]", ",", "arg_1", ")", ":", "return", "(", "None", ",", "None", ")", "if", "arg_0", ".", "_nullAggregation", ":", "return", "(", "arg_1", ",", "arg_2", ")", "arg_5", "=", "arg_1", "[", "arg_0", ".", "_timeFieldIdx", "]", "if", "arg_0", ".", "_firstSequenceStartTime", "==", "None", ":", "arg_0", ".", "_firstSequenceStartTime", "=", "arg_5", "if", "arg_0", ".", "_startTime", "is", "None", ":", "arg_0", ".", "_startTime", "=", "arg_5", "if", "arg_0", ".", "_endTime", "is", "None", ":", "arg_0", ".", "_endTime", "=", "arg_0", ".", "_getEndTime", "(", "arg_5", ")", "assert", "arg_0", ".", "_endTime", ">", "arg_5", "if", "arg_0", ".", "_resetFieldIdx", "is", "not", "None", ":", "arg_9", "=", "arg_1", "[", "arg_0", ".", "_resetFieldIdx", "]", "else", ":", "arg_9", "=", "None", "if", "arg_0", ".", "_sequenceIdFieldIdx", "is", "not", "None", ":", "arg_10", "=", "arg_1", "[", "arg_0", ".", "_sequenceIdFieldIdx", "]", "else", ":", "arg_10", "=", "None", "arg_11", "=", "(", "arg_9", "==", "1", "and", "arg_0", ".", "_inIdx", ">", "0", ")", "or", "arg_0", ".", "_sequenceId", "!=", "arg_10", "or", "arg_0", ".", "_inIdx", "==", "0", "if", "arg_11", ":", "arg_0", ".", "_sequenceId", "=", "arg_10", "arg_13", "=", "(", "arg_5", ">=", "arg_0", ".", "_endTime", "or", "arg_5", "<", "arg_0", ".", "_startTime", ")", "if", "(", "arg_11", "or", "arg_13", ")", "and", "len", "(", "arg_0", ".", "_slice", ")", ">", "0", ":", "for", "arg_14", ",", "arg_15", "in", "enumerate", "(", "arg_0", ".", "_fields", ")", ":", "arg_16", "=", "arg_15", "[", "0", "]", "if", "arg_16", "==", "arg_0", ".", "_timeFieldIdx", ":", "arg_0", ".", "_slice", "[", "arg_14", "]", "[", "0", "]", "=", "arg_0", ".", "_startTime", "break", "arg_3", "=", "arg_0", ".", "_createAggregateRecord", "(", ")", "arg_4", "=", "arg_0", ".", "_aggrInputBookmark", "arg_0", ".", "_slice", "=", "defaultdict", "(", "list", ")", "for", "arg_14", ",", "arg_15", "in", "enumerate", "(", "arg_0", ".", "_fields", ")", ":", "arg_16", "=", "arg_15", "[", "0", "]", "arg_0", ".", "_slice", "[", "arg_14", "]", ".", "append", "(", "arg_1", "[", "arg_16", "]", ")", "arg_0", ".", "_aggrInputBookmark", "=", "arg_2", "if", "arg_11", ":", "arg_0", ".", "_startTime", "=", "arg_5", "arg_0", ".", "_endTime", "=", "arg_0", ".", "_getEndTime", "(", "arg_5", ")", "if", "arg_13", ":", "if", "arg_5", "<", "arg_0", ".", "_startTime", ":", "arg_0", ".", "_endTime", "=", "arg_0", ".", "_firstSequenceStartTime", "while", "arg_5", ">=", "arg_0", ".", "_endTime", ":", "arg_0", ".", "_startTime", "=", "arg_0", ".", "_endTime", "arg_0", ".", "_endTime", "=", "arg_0", ".", "_getEndTime", "(", "arg_0", ".", "_endTime", ")", "if", "arg_3", "is", "not", "None", ":", "return", "(", "arg_3", ",", "arg_4", ")", "elif", "arg_0", ".", "_slice", ":", "for", "arg_14", ",", "arg_15", "in", "enumerate", "(", "arg_0", ".", "_fields", ")", ":", "arg_16", "=", "arg_15", "[", "0", "]", "if", "arg_16", "==", "arg_0", ".", "_timeFieldIdx", ":", "arg_0", ".", "_slice", "[", "arg_14", "]", "[", "0", "]", "=", "arg_0", ".", "_startTime", "break", "arg_3", "=", "arg_0", ".", "_createAggregateRecord", "(", ")", "arg_4", "=", "arg_0", ".", "_aggrInputBookmark", "arg_0", ".", "_slice", "=", "defaultdict", "(", "list", ")", "return", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Return the Func aggregated record, if any\n\n    Parameters:\n    ------------------------------------------------------------------------\n    record:         The input record (values only) from the input source, or\n                    None if the input has reached EOF (this will cause this\n                    method to force completion of and return any partially\n                    aggregated time period)\n    curInputBookmark: The bookmark to the Func input record\n    retval:\n      (outputRecord, inputBookmark)\n\n      outputRecord: the aggregated record\n      inputBookmark: a bookmark to the last position from the input that\n                      contributed to this aggregated record.\n\n      If we don't have any aggregated records yet, returns (None, None)\n\n\n    The caller should generally do a loop like this:\n      while True:\n        inRecord = reader.getNextRecord()\n        bookmark = reader.getBookmark()\n\n        (aggRecord, aggBookmark) = aggregator.Func(inRecord, bookmark)\n\n        # reached EOF?\n        if inRecord is None and aggRecord is None:\n          break\n\n        if aggRecord is not None:\n          proessRecord(aggRecord, aggBookmark)\n\n\n    This method makes use of the self._slice member variable to build up\n    the values we need to aggregate. This is a dict of lists. The keys are\n    the field indices and the elements of each list are the values for that\n    field. For example:\n\n      self._siice = { 0: [42, 53], 1: [4.0, 5.1] }\n\n    \"\"\"\n\n    # This will hold the aggregated record we return\n    arg_3 = None\n\n    # This will hold the bookmark of the last input used within the\n    #  aggregated record we return.\n    arg_4 = None\n\n    if arg_1 is not None:\n\n      # Increment input count\n      arg_0._inIdx += 1\n\n      #print self._inIdx, record\n\n      # Apply the filter, ignore the record if any field is unacceptable\n      if arg_0._filter != None and not arg_0._filter[0](arg_0._filter[1], arg_1):\n        return (None, None)\n\n      # If no aggregation info just return as-is\n      if arg_0._nullAggregation:\n        return (arg_1, arg_2)\n\n\n      # ----------------------------------------------------------------------\n      # Do aggregation\n\n      #\n      # Remember the very first record time stamp - it will be used as\n      # the timestamp for all first records in all sequences to align\n      # times for the aggregation/join of sequences.\n      #\n      # For a set of aggregated records, it will use the beginning of the time\n      # window as a timestamp for the set\n      #\n      arg_5 = arg_1[arg_0._timeFieldIdx]\n\n      if arg_0._firstSequenceStartTime == None:\n        arg_0._firstSequenceStartTime = arg_5\n\n      # Create initial startTime and endTime if needed\n      if arg_0._startTime is None:\n        arg_0._startTime = arg_5\n      if arg_0._endTime is None:\n        arg_0._endTime = arg_0._getEndTime(arg_5)\n        assert arg_0._endTime > arg_5\n\n      #print 'Processing line:', i, t, endTime\n      #from dbgp.client import brk; brk(port=9011)\n\n\n      # ----------------------------------------------------------------------\n      # Does this record have a reset signal or sequence Id associated with it?\n      # If so, see if we've reached a sequence boundary\n      if arg_0._resetFieldIdx is not None:\n        arg_9 = arg_1[arg_0._resetFieldIdx]\n      else:\n        arg_9 = None\n\n      if arg_0._sequenceIdFieldIdx is not None:\n        arg_10 = arg_1[arg_0._sequenceIdFieldIdx]\n      else:\n        arg_10 = None\n\n      arg_11 = (arg_9 == 1 and arg_0._inIdx > 0) \\\n                      or arg_0._sequenceId != arg_10 \\\n                      or arg_0._inIdx == 0\n\n      if arg_11:\n        arg_0._sequenceId = arg_10\n\n\n      # --------------------------------------------------------------------\n      # We end the aggregation chunk if we go past the end time\n      # -OR- we get an out of order record (t < startTime)\n      arg_13 = (arg_5 >= arg_0._endTime or arg_5 < arg_0._startTime)\n\n\n      # -------------------------------------------------------------------\n      # Time to generate a new output record?\n      if (arg_11 or arg_13) and len(arg_0._slice) > 0:\n        # Create aggregated record\n        # print 'Creating aggregate record...'\n\n        # Make first record timestamp as the beginning of the time period,\n        # in case the first record wasn't falling on the beginning of the period\n        for arg_14, arg_15 in enumerate(arg_0._fields):\n          arg_16 = arg_15[0]\n          if arg_16 == arg_0._timeFieldIdx:\n            arg_0._slice[arg_14][0] = arg_0._startTime\n            break\n\n        # Generate the aggregated record\n        arg_3 = arg_0._createAggregateRecord()\n        arg_4 = arg_0._aggrInputBookmark\n\n        # Reset the slice\n        arg_0._slice = defaultdict(list)\n\n\n      # --------------------------------------------------------------------\n      # Add current record to slice (Note keeping slices in memory). Each\n      # field in the slice is a list of field values from all the sliced\n      # records\n      for arg_14, arg_15 in enumerate(arg_0._fields):\n        arg_16 = arg_15[0]\n        # append the parsed field value to the proper aggregated slice field.\n        arg_0._slice[arg_14].append(arg_1[arg_16])\n        arg_0._aggrInputBookmark = arg_2\n\n\n      # --------------------------------------------------------------------\n      # If we've encountered a new sequence, start aggregation over again\n      if arg_11:\n        # TODO: May use self._firstSequenceStartTime as a start for the new\n        # sequence (to align all sequences)\n        arg_0._startTime = arg_5\n        arg_0._endTime = arg_0._getEndTime(arg_5)\n\n\n      # --------------------------------------------------------------------\n      # If a slice just ended, re-compute the start and end time for the\n      #  Func aggregated record\n      if arg_13:\n        # Did we receive an out of order record? If so, go back and iterate\n        #   till we get to the Func end time boundary.\n        if arg_5 < arg_0._startTime:\n          arg_0._endTime = arg_0._firstSequenceStartTime\n        while arg_5 >= arg_0._endTime:\n          arg_0._startTime = arg_0._endTime\n          arg_0._endTime = arg_0._getEndTime(arg_0._endTime)\n\n\n      # If we have a record to return, do it now\n      if arg_3 is not None:\n        return (arg_3, arg_4)\n\n\n    # ---------------------------------------------------------------------\n    # Input reached EOF\n    # Aggregate one last time in the end if necessary\n    elif arg_0._slice:\n\n      # Make first record timestamp as the beginning of the time period,\n      # in case the first record wasn't falling on the beginning of the period\n      for arg_14, arg_15 in enumerate(arg_0._fields):\n        arg_16 = arg_15[0]\n        if arg_16 == arg_0._timeFieldIdx:\n          arg_0._slice[arg_14][0] = arg_0._startTime\n          break\n\n      arg_3 = arg_0._createAggregateRecord()\n      arg_4 = arg_0._aggrInputBookmark\n\n      arg_0._slice = defaultdict(list)\n\n\n    # Return aggregated record\n    return (arg_3, arg_4)", "path": "src/nupic/data/aggregator.py", "identifier": "Aggregator.next", "docstring": "Return the next aggregated record, if any\n\n    Parameters:\n    ------------------------------------------------------------------------\n    record:         The input record (values only) from the input source, or\n                    None if the input has reached EOF (this will cause this\n                    method to force completion of and return any partially\n                    aggregated time period)\n    curInputBookmark: The bookmark to the next input record\n    retval:\n      (outputRecord, inputBookmark)\n\n      outputRecord: the aggregated record\n      inputBookmark: a bookmark to the last position from the input that\n                      contributed to this aggregated record.\n\n      If we don't have any aggregated records yet, returns (None, None)\n\n\n    The caller should generally do a loop like this:\n      while True:\n        inRecord = reader.getNextRecord()\n        bookmark = reader.getBookmark()\n\n        (aggRecord, aggBookmark) = aggregator.next(inRecord, bookmark)\n\n        # reached EOF?\n        if inRecord is None and aggRecord is None:\n          break\n\n        if aggRecord is not None:\n          proessRecord(aggRecord, aggBookmark)\n\n\n    This method makes use of the self._slice member variable to build up\n    the values we need to aggregate. This is a dict of lists. The keys are\n    the field indices and the elements of each list are the values for that\n    field. For example:\n\n      self._siice = { 0: [42, 53], 1: [4.0, 5.1] }", "docstring_tokens": ["Return", "the", "next", "aggregated", "record", "if", "any"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252491}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L299-L312", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Return the path to this directory.", "language": "python", "parameters": "(self)", "return_statement": "return p", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "if", "arg_0", ".", "_parent", "and", "arg_0", ".", "_parent", ".", "Func", ":", "arg_1", "=", "os", ".", "Func", ".", "join", "(", "arg_1", ",", "arg_0", ".", "_parent", ".", "Func", ")", "if", "arg_0", ".", "_base", ":", "arg_1", "=", "os", ".", "Func", ".", "join", "(", "arg_1", ",", "arg_0", ".", "_base", ")", "if", "arg_0", ".", "_Func", ":", "arg_1", "=", "os", ".", "Func", ".", "join", "(", "arg_1", ",", "arg_0", ".", "_Func", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the Func to this directory.\n        \"\"\"\n        arg_1 = ''\n\n        if arg_0._parent and arg_0._parent.Func:\n            arg_1 = os.Func.join(arg_1, arg_0._parent.Func)\n        if arg_0._base:\n            arg_1 = os.Func.join(arg_1, arg_0._base)\n        if arg_0._Func:\n            arg_1 = os.Func.join(arg_1, arg_0._Func)\n\n        return arg_1", "path": "scruffy/file.py", "identifier": "Directory.path", "docstring": "Return the path to this directory.", "docstring_tokens": ["Return", "the", "path", "to", "this", "directory", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 252492}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/exceptions.py#L8-L18", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "return the error if there is a corresponding exception", "language": "python", "parameters": "(data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "if", "'errors'", "in", "arg_0", ":", "arg_1", "=", "arg_0", "[", "'errors'", "]", "[", "0", "]", "else", ":", "arg_1", "=", "arg_0", ".", "get", "(", "'error'", ",", "None", ")", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "if", "arg_1", ".", "get", "(", "'code'", ")", "in", "errors", ":", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" return the error if there is a corresponding exception \"\"\"\n    if isinstance(arg_0, dict):\n        if 'errors' in arg_0:\n            arg_1 = arg_0['errors'][0]\n        else:\n            arg_1 = arg_0.get('error', None)\n\n        if isinstance(arg_1, dict):\n            if arg_1.get('code') in errors:\n                return arg_1", "path": "peony/exceptions.py", "identifier": "get_error", "docstring": "return the error if there is a corresponding exception", "docstring_tokens": ["return", "the", "error", "if", "there", "is", "a", "corresponding", "exception"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 252493}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L695-L701", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Returns the names of all positional arguments to the given function.", "language": "python", "parameters": "(fn)", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_get_cached_arg_spec", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "args", "if", "arg_1", ".", "defaults", ":", "arg_2", "=", "arg_2", "[", ":", "-", "len", "(", "arg_1", ".", "defaults", ")", "]", "return", "arg_2"], "function": "def Func(arg_0):\n  \"\"\"Returns the names of all positional arguments to the given function.\"\"\"\n  arg_1 = _get_cached_arg_spec(arg_0)\n  arg_2 = arg_1.args\n  if arg_1.defaults:\n    arg_2 = arg_2[:-len(arg_1.defaults)]\n  return arg_2", "path": "gin/config.py", "identifier": "_get_all_positional_parameter_names", "docstring": "Returns the names of all positional arguments to the given function.", "docstring_tokens": ["Returns", "the", "names", "of", "all", "positional", "arguments", "to", "the", "given", "function", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 252494}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L570-L607", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val is string and contains the given item or items.", "language": "python", "parameters": "(self, *items)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more args must be given'", ")", "if", "isinstance", "(", "arg_0", ".", "val", ",", "str_types", ")", ":", "if", "len", "(", "arg_1", ")", "==", "1", ":", "if", "not", "isinstance", "(", "arg_1", "[", "0", "]", ",", "str_types", ")", ":", "raise", "TypeError", "(", "'given arg must be a string'", ")", "if", "arg_1", "[", "0", "]", ".", "lower", "(", ")", "not", "in", "arg_0", ".", "val", ".", "lower", "(", ")", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to case-insensitive contain item <%s>, but did not.'", "%", "(", "arg_0", ".", "val", ",", "arg_1", "[", "0", "]", ")", ")", "else", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "not", "isinstance", "(", "arg_3", ",", "str_types", ")", ":", "raise", "TypeError", "(", "'given args must all be strings'", ")", "if", "arg_3", ".", "lower", "(", ")", "not", "in", "arg_0", ".", "val", ".", "lower", "(", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to case-insensitive contain items %s, but did not contain %s.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ",", "arg_0", ".", "_fmt_items", "(", "arg_2", ")", ")", ")", "elif", "isinstance", "(", "arg_0", ".", "val", ",", "Iterable", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "not", "isinstance", "(", "arg_3", ",", "str_types", ")", ":", "raise", "TypeError", "(", "'given args must all be strings'", ")", "arg_4", "=", "False", "for", "arg_5", "in", "arg_0", ".", "val", ":", "if", "not", "isinstance", "(", "arg_5", ",", "str_types", ")", ":", "raise", "TypeError", "(", "'val items must all be strings'", ")", "if", "arg_3", ".", "lower", "(", ")", "==", "arg_5", ".", "lower", "(", ")", ":", "arg_4", "=", "True", "break", "if", "not", "arg_4", ":", "arg_2", ".", "append", "(", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to case-insensitive contain items %s, but did not contain %s.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ",", "arg_0", ".", "_fmt_items", "(", "arg_2", ")", ")", ")", "else", ":", "raise", "TypeError", "(", "'val is not a string or iterable'", ")", "return", "arg_0"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Asserts that val is string and contains the given item or items.\"\"\"\n        if len(arg_1) == 0:\n            raise ValueError('one or more args must be given')\n        if isinstance(arg_0.val, str_types):\n            if len(arg_1) == 1:\n                if not isinstance(arg_1[0], str_types):\n                    raise TypeError('given arg must be a string')\n                if arg_1[0].lower() not in arg_0.val.lower():\n                    arg_0._err('Expected <%s> to case-insensitive contain item <%s>, but did not.' % (arg_0.val, arg_1[0]))\n            else:\n                arg_2 = []\n                for arg_3 in arg_1:\n                    if not isinstance(arg_3, str_types):\n                        raise TypeError('given args must all be strings')\n                    if arg_3.lower() not in arg_0.val.lower():\n                        arg_2.append(arg_3)\n                if arg_2:\n                    arg_0._err('Expected <%s> to case-insensitive contain items %s, but did not contain %s.' % (arg_0.val, arg_0._fmt_items(arg_1), arg_0._fmt_items(arg_2)))\n        elif isinstance(arg_0.val, Iterable):\n            arg_2 = []\n            for arg_3 in arg_1:\n                if not isinstance(arg_3, str_types):\n                    raise TypeError('given args must all be strings')\n                arg_4 = False\n                for arg_5 in arg_0.val:\n                    if not isinstance(arg_5, str_types):\n                        raise TypeError('val items must all be strings')\n                    if arg_3.lower() == arg_5.lower():\n                        arg_4 = True\n                        break\n                if not arg_4:\n                    arg_2.append(arg_3)\n            if arg_2:\n                arg_0._err('Expected <%s> to case-insensitive contain items %s, but did not contain %s.' % (arg_0.val, arg_0._fmt_items(arg_1), arg_0._fmt_items(arg_2)))\n        else:\n            raise TypeError('val is not a string or iterable')\n        return arg_0", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.contains_ignoring_case", "docstring": "Asserts that val is string and contains the given item or items.", "docstring_tokens": ["Asserts", "that", "val", "is", "string", "and", "contains", "the", "given", "item", "or", "items", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 252495}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_hash.py#L709-L769", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Get a unique hash depending on the state of the data.", "language": "python", "parameters": "(data, hasher=NoParam, base=NoParam, types=False,\n              hashlen=NoParam, convert=False)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_2", ",", "arg_4", "=", "False", ",", "arg_5", "=", "arg_2", ",", "arg_6", "=", "False", ")", ":", "if", "arg_6", "and", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "try", ":", "arg_0", "=", "json", ".", "dumps", "(", "arg_0", ")", "except", "TypeError", "as", "ex", ":", "pass", "arg_3", "=", "_rectify_base", "(", "arg_3", ")", "arg_5", "=", "_rectify_hashlen", "(", "arg_5", ")", "arg_1", "=", "_rectify_hasher", "(", "arg_1", ")", "(", ")", "_update_hasher", "(", "arg_1", ",", "arg_0", ",", "arg_4", "=", "arg_4", ")", "arg_7", "=", "_digest_hasher", "(", "arg_1", ",", "arg_5", ",", "arg_3", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=arg_2, arg_4=False,\n              arg_5=arg_2, arg_6=False):\n    \"\"\"\n    Get a unique hash depending on the state of the data.\n\n    Args:\n        data (object):\n            Any sort of loosely organized data\n\n        hasher (str or HASHER):\n            Hash algorithm from hashlib, defaults to `sha512`.\n\n        base (str or List[str]):\n            Shorthand key or a list of symbols.  Valid keys are: 'abc', 'hex',\n            and 'dec'. Defaults to 'hex'.\n\n        types (bool):\n            If True data types are included in the hash, otherwise only the raw\n            data is hashed. Defaults to False.\n\n        hashlen (int):\n            Maximum number of symbols in the returned hash. If not specified,\n            all are returned.  DEPRECATED. Use slice syntax instead.\n\n        convert (bool, optional, default=True):\n            if True, try and convert the data to json an the json is hashed\n            instead. This can improve runtime in some instances, however the\n            hash may differ from the case where convert=False.\n\n    Notes:\n        alphabet26 is a pretty nice base, I recommend it.\n        However we default to hex because it is standard.\n        This means the output of hashdata with base=sha1 will be the same as\n        the output of `sha1sum`.\n\n    Returns:\n        str: text -  hash string\n\n    Example:\n        >>> import ubelt as ub\n        >>> print(ub.Func([1, 2, (3, '4')], convert=False))\n        60b758587f599663931057e6ebdf185a...\n        >>> print(ub.Func([1, 2, (3, '4')], base='abc',  hasher='sha512')[:32])\n        hsrgqvfiuxvvhcdnypivhhthmrolkzej\n    \"\"\"\n    if arg_6 and isinstance(arg_0, six.string_types):  # nocover\n        try:\n            arg_0 = json.dumps(arg_0)\n        except TypeError as ex:\n            # import warnings\n            # warnings.warn('Unable to encode input as json due to: {!r}'.format(ex))\n            pass\n\n    arg_3 = _rectify_base(arg_3)\n    arg_5 = _rectify_hashlen(arg_5)\n    arg_1 = _rectify_hasher(arg_1)()\n    # Feed the data into the hasher\n    _update_hasher(arg_1, arg_0, arg_4=arg_4)\n    # Get the hashed representation\n    arg_7 = _digest_hasher(arg_1, arg_5, arg_3)\n    return arg_7", "path": "ubelt/util_hash.py", "identifier": "hash_data", "docstring": "Get a unique hash depending on the state of the data.\n\n    Args:\n        data (object):\n            Any sort of loosely organized data\n\n        hasher (str or HASHER):\n            Hash algorithm from hashlib, defaults to `sha512`.\n\n        base (str or List[str]):\n            Shorthand key or a list of symbols.  Valid keys are: 'abc', 'hex',\n            and 'dec'. Defaults to 'hex'.\n\n        types (bool):\n            If True data types are included in the hash, otherwise only the raw\n            data is hashed. Defaults to False.\n\n        hashlen (int):\n            Maximum number of symbols in the returned hash. If not specified,\n            all are returned.  DEPRECATED. Use slice syntax instead.\n\n        convert (bool, optional, default=True):\n            if True, try and convert the data to json an the json is hashed\n            instead. This can improve runtime in some instances, however the\n            hash may differ from the case where convert=False.\n\n    Notes:\n        alphabet26 is a pretty nice base, I recommend it.\n        However we default to hex because it is standard.\n        This means the output of hashdata with base=sha1 will be the same as\n        the output of `sha1sum`.\n\n    Returns:\n        str: text -  hash string\n\n    Example:\n        >>> import ubelt as ub\n        >>> print(ub.hash_data([1, 2, (3, '4')], convert=False))\n        60b758587f599663931057e6ebdf185a...\n        >>> print(ub.hash_data([1, 2, (3, '4')], base='abc',  hasher='sha512')[:32])\n        hsrgqvfiuxvvhcdnypivhhthmrolkzej", "docstring_tokens": ["Get", "a", "unique", "hash", "depending", "on", "the", "state", "of", "the", "data", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 252496}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/factory.py#L37-L55", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Use arguments to route constructor.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return ConstructLocal", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "if", "'mode'", "in", "arg_1", ":", "arg_2", "=", "arg_1", "[", "'mode'", "]", "if", "arg_2", "not", "in", "constructors", ":", "raise", "ValueError", "(", "'Mode %s not supported'", "%", "arg_2", ")", "del", "arg_1", "[", "'mode'", "]", "return", "constructors", "[", "arg_2", "]", "else", ":", "for", "arg_2", ",", "arg_3", "in", "constructors", ":", "if", "arg_3", ".", "_argcheck", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "return", "arg_3", "return", "ConstructLocal"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    Use arguments to route constructor.\n\n    Applies a series of checks on arguments to identify constructor,\n    starting with known keyword arguments, and then applying\n    constructor-specific checks\n    \"\"\"\n    if 'mode' in arg_1:\n        arg_2 = arg_1['mode']\n        if arg_2 not in constructors:\n            raise ValueError('Mode %s not supported' % arg_2)\n        del arg_1['mode']\n        return constructors[arg_2]\n    else:\n        for arg_2, arg_3 in constructors:\n            if arg_3._argcheck(*arg_0, **arg_1):\n                return arg_3\n    return ConstructLocal", "path": "bolt/factory.py", "identifier": "lookup", "docstring": "Use arguments to route constructor.\n\n    Applies a series of checks on arguments to identify constructor,\n    starting with known keyword arguments, and then applying\n    constructor-specific checks", "docstring_tokens": ["Use", "arguments", "to", "route", "constructor", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 252497}
{"url": "https://github.com/worldcompany/djangoembed/blob/f3f2be283441d91d1f89db780444dc75f7b51902/oembed/views.py#L19-L56", "sha": "f3f2be283441d91d1f89db780444dc75f7b51902", "docstring_summary": "The oembed endpoint, or the url to which requests for metadata are passed.\n    Third parties will want to access this view with URLs for your site's\n    content and be returned OEmbed metadata.", "language": "python", "parameters": "(request, *args, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "dict", "(", "arg_0", ".", "GET", ".", "items", "(", ")", ")", "arg_4", "=", "arg_3", ".", "pop", "(", "'callback'", ",", "None", ")", "arg_5", "=", "arg_3", ".", "pop", "(", "'url'", ",", "None", ")", "if", "not", "arg_5", ":", "return", "HttpResponseBadRequest", "(", "'Required parameter missing: URL'", ")", "try", ":", "arg_6", "=", "oembed", ".", "site", ".", "provider_for_url", "(", "arg_5", ")", "if", "not", "arg_6", ".", "provides", ":", "raise", "OEmbedMissingEndpoint", "(", ")", "except", "OEmbedMissingEndpoint", ":", "raise", "Http404", "(", "'No provider found for %s'", "%", "arg_5", ")", "arg_7", "=", "dict", "(", "[", "(", "smart_str", "(", "k", ")", ",", "smart_str", "(", "v", ")", ")", "for", "k", ",", "v", "in", "arg_3", ".", "items", "(", ")", "if", "v", "]", ")", "try", ":", "arg_8", "=", "oembed", ".", "site", ".", "embed", "(", "arg_5", ",", "**", "arg_7", ")", "except", "OEmbedException", ",", "e", ":", "raise", "Http404", "(", "'Error embedding %s: %s'", "%", "(", "arg_5", ",", "str", "(", "e", ")", ")", ")", "arg_9", "=", "HttpResponse", "(", "mimetype", "=", "'application/json'", ")", "Func", "=", "arg_8", ".", "json", "if", "arg_4", ":", "arg_9", ".", "write", "(", "'%s(%s)'", "%", "(", "defaultfilters", ".", "force_escape", "(", "arg_4", ")", ",", "Func", ")", ")", "else", ":", "arg_9", ".", "write", "(", "Func", ")", "return", "arg_9"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"\n    The oembed endpoint, or the url to which requests for metadata are passed.\n    Third parties will want to access this view with URLs for your site's\n    content and be returned OEmbed metadata.\n    \"\"\"\n    # coerce to dictionary\n    arg_3 = dict(arg_0.GET.items())\n    \n    arg_4 = arg_3.pop('callback', None)\n    arg_5 = arg_3.pop('url', None)\n    \n    if not arg_5:\n        return HttpResponseBadRequest('Required parameter missing: URL')\n    \n    try:\n        arg_6 = oembed.site.provider_for_url(arg_5)\n        if not arg_6.provides:\n            raise OEmbedMissingEndpoint()\n    except OEmbedMissingEndpoint:\n        raise Http404('No provider found for %s' % arg_5)\n    \n    arg_7 = dict([(smart_str(k), smart_str(v)) for k, v in arg_3.items() if v])\n    \n    try:\n        arg_8 = oembed.site.embed(arg_5, **arg_7)\n    except OEmbedException, e:\n        raise Http404('Error embedding %s: %s' % (arg_5, str(e)))\n\n    arg_9 = HttpResponse(mimetype='application/json')\n    Func = arg_8.json\n    \n    if arg_4:\n        arg_9.write('%s(%s)' % (defaultfilters.force_escape(arg_4), Func))\n    else:\n        arg_9.write(Func)\n    \n    return arg_9", "path": "oembed/views.py", "identifier": "json", "docstring": "The oembed endpoint, or the url to which requests for metadata are passed.\n    Third parties will want to access this view with URLs for your site's\n    content and be returned OEmbed metadata.", "docstring_tokens": ["The", "oembed", "endpoint", "or", "the", "url", "to", "which", "requests", "for", "metadata", "are", "passed", ".", "Third", "parties", "will", "want", "to", "access", "this", "view", "with", "URLs", "for", "your", "site", "s", "content", "and", "be", "returned", "OEmbed", "metadata", "."], "nwo": "worldcompany/djangoembed", "score": 0.23137166388621372, "idx": 252498}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L285-L317", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Extract the raw traceback from the current stack frame.", "language": "python", "parameters": "(f=None, limit = None)", "return_statement": "return list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "try", ":", "raise", "ZeroDivisionError", "except", "ZeroDivisionError", ":", "arg_0", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ".", "tb_frame", ".", "f_back", "if", "arg_1", "is", "None", ":", "if", "hasattr", "(", "sys", ",", "'tracebacklimit'", ")", ":", "arg_1", "=", "sys", ".", "tracebacklimit", "arg_2", "=", "[", "]", "arg_3", "=", "0", "while", "arg_0", "is", "not", "None", "and", "(", "arg_1", "is", "None", "or", "arg_3", "<", "arg_1", ")", ":", "arg_4", "=", "arg_0", ".", "f_lineno", "arg_5", "=", "arg_0", ".", "f_code", "arg_6", "=", "arg_5", ".", "co_filename", "arg_7", "=", "arg_5", ".", "co_name", "linecache", ".", "checkcache", "(", "arg_6", ")", "arg_8", "=", "linecache", ".", "getline", "(", "arg_6", ",", "arg_4", ",", "arg_0", ".", "f_globals", ")", "if", "arg_8", ":", "arg_8", "=", "arg_8", ".", "strip", "(", ")", "else", ":", "arg_8", "=", "None", "arg_2", ".", "append", "(", "(", "arg_6", ",", "arg_4", ",", "arg_7", ",", "arg_8", ")", ")", "arg_0", "=", "arg_0", ".", "f_back", "arg_3", "=", "arg_3", "+", "1", "arg_2", ".", "reverse", "(", ")", "return", "arg_2"], "function": "def Func(arg_0=None, arg_1 = None):\n    \"\"\"Extract the raw traceback from the current stack frame.\n\n    The return value has the same format as for extract_tb().  The\n    optional 'f' and 'limit' arguments have the same meaning as for\n    print_stack().  Each item in the list is a quadruple (filename,\n    line number, function name, text), and the entries are in order\n    from oldest to newest stack frame.\n    \"\"\"\n    if arg_0 is None:\n        try:\n            raise ZeroDivisionError\n        except ZeroDivisionError:\n            arg_0 = sys.exc_info()[2].tb_frame.f_back\n    if arg_1 is None:\n        if hasattr(sys, 'tracebacklimit'):\n            arg_1 = sys.tracebacklimit\n    arg_2 = []\n    arg_3 = 0\n    while arg_0 is not None and (arg_1 is None or arg_3 < arg_1):\n        arg_4 = arg_0.f_lineno\n        arg_5 = arg_0.f_code\n        arg_6 = arg_5.co_filename\n        arg_7 = arg_5.co_name\n        linecache.checkcache(arg_6)\n        arg_8 = linecache.getline(arg_6, arg_4, arg_0.f_globals)\n        if arg_8: arg_8 = arg_8.strip()\n        else: arg_8 = None\n        arg_2.append((arg_6, arg_4, arg_7, arg_8))\n        arg_0 = arg_0.f_back\n        arg_3 = arg_3+1\n    arg_2.reverse()\n    return arg_2", "path": "third_party/stdlib/traceback.py", "identifier": "extract_stack", "docstring": "Extract the raw traceback from the current stack frame.\n\n    The return value has the same format as for extract_tb().  The\n    optional 'f' and 'limit' arguments have the same meaning as for\n    print_stack().  Each item in the list is a quadruple (filename,\n    line number, function name, text), and the entries are in order\n    from oldest to newest stack frame.", "docstring_tokens": ["Extract", "the", "raw", "traceback", "from", "the", "current", "stack", "frame", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 252499}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/connection_scan.py#L92-L103", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Scan the footpaths originating from stop_id", "language": "python", "parameters": "(self, stop_id, walk_departure_time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "_walk_network", ".", "edges_iter", "(", "nbunch", "=", "[", "arg_1", "]", ",", "arg_5", "=", "True", ")", ":", "arg_6", "=", "arg_5", "[", "\"d_walk\"", "]", "arg_7", "=", "arg_2", "+", "arg_6", "/", "arg_0", ".", "_walk_speed", "arg_0", ".", "_update_stop_label", "(", "arg_4", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Scan the footpaths originating from stop_id\n\n        Parameters\n        ----------\n        stop_id: int\n        \"\"\"\n        for arg_3, arg_4, arg_5 in arg_0._walk_network.edges_iter(nbunch=[arg_1], arg_5=True):\n            arg_6 = arg_5[\"d_walk\"]\n            arg_7 = arg_2 + arg_6 / arg_0._walk_speed\n            arg_0._update_stop_label(arg_4, arg_7)", "path": "gtfspy/routing/connection_scan.py", "identifier": "ConnectionScan._scan_footpaths", "docstring": "Scan the footpaths originating from stop_id\n\n        Parameters\n        ----------\n        stop_id: int", "docstring_tokens": ["Scan", "the", "footpaths", "originating", "from", "stop_id"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 252500}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L840-L844", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "flush ignored control replies", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "arg_0", ".", "_ignored_control_replies", ">", "0", ":", "arg_0", ".", "session", ".", "recv", "(", "arg_0", ".", "_control_socket", ")", "arg_0", ".", "_ignored_control_replies", "-=", "1"], "function": "def Func(arg_0):\n        \"\"\"flush ignored control replies\"\"\"\n        while arg_0._ignored_control_replies > 0:\n            arg_0.session.recv(arg_0._control_socket)\n            arg_0._ignored_control_replies -= 1", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client._flush_ignored_control", "docstring": "flush ignored control replies", "docstring_tokens": ["flush", "ignored", "control", "replies"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252501}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Console/screen.py#L365-L383", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Render left blocks", "language": "python", "parameters": "(self)", "return_statement": "return lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Rendering left blocks\"", ")", "arg_1", "=", "arg_0", ".", "left_panel", "arg_1", ".", "render", "(", ")", "arg_2", "=", "arg_0", ".", "left_panel_width", "-", "arg_1", ".", "width", "arg_3", "=", "[", "]", "arg_4", "=", "' '", "*", "int", "(", "arg_2", "/", "2", ")", "if", "not", "arg_1", ".", "lines", ":", "arg_3", "=", "[", "(", "''", ")", ",", "(", "arg_0", ".", "markup", ".", "RED", "+", "'BROKEN LEFT PANEL'", "+", "arg_0", ".", "markup", ".", "RESET", ")", "]", "else", ":", "while", "arg_0", ".", "left_panel", ".", "lines", ":", "arg_5", "=", "arg_0", ".", "left_panel", ".", "lines", ".", "pop", "(", "0", ")", "arg_6", "=", "arg_4", "+", "arg_0", ".", "__truncate", "(", "arg_5", ",", "arg_0", ".", "left_panel_width", ")", "arg_7", "=", "' '", "*", "(", "arg_0", ".", "left_panel_width", "-", "len", "(", "arg_0", ".", "markup", ".", "clean_markup", "(", "arg_6", ")", ")", ")", "arg_6", "+=", "arg_7", "+", "arg_0", ".", "markup", ".", "RESET", "arg_3", ".", "append", "(", "arg_6", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        ''' Render left blocks '''\n        arg_0.log.debug(\"Rendering left blocks\")\n        arg_1 = arg_0.left_panel\n        arg_1.render()\n        arg_2 = arg_0.left_panel_width - arg_1.width\n\n        arg_3 = []\n        arg_4 = ' ' * int(arg_2 / 2)\n        if not arg_1.lines:\n            arg_3 = [(''), (arg_0.markup.RED + 'BROKEN LEFT PANEL' + arg_0.markup.RESET)]\n        else:\n            while arg_0.left_panel.lines:\n                arg_5 = arg_0.left_panel.lines.pop(0)\n                arg_6 = arg_4 + arg_0.__truncate(arg_5, arg_0.left_panel_width)\n                arg_7 = ' ' * (arg_0.left_panel_width - len(arg_0.markup.clean_markup(arg_6)))\n                arg_6 += arg_7 + arg_0.markup.RESET\n                arg_3.append(arg_6)\n        return arg_3", "path": "yandextank/plugins/Console/screen.py", "identifier": "Screen.__render_left_panel", "docstring": "Render left blocks", "docstring_tokens": ["Render", "left", "blocks"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 252502}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/profileapp.py#L108-L117", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "list profiles that are bundled with IPython.", "language": "python", "parameters": "()", "return_statement": "return profiles", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "os", ".", "path", ".", "join", "(", "get_ipython_package_dir", "(", ")", ",", "u'config'", ",", "u'profile'", ")", "arg_1", "=", "os", ".", "listdir", "(", "arg_0", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_3", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_4", ")", "and", "arg_3", "!=", "\"__pycache__\"", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func():\n    \"\"\"list profiles that are bundled with IPython.\"\"\"\n    arg_0 = os.path.join(get_ipython_package_dir(), u'config', u'profile')\n    arg_1 = os.listdir(arg_0)\n    arg_2 = []\n    for arg_3 in arg_1:\n        arg_4 = os.path.join(arg_0, arg_3)\n        if os.path.isdir(arg_4) and arg_3 != \"__pycache__\":\n            arg_2.append(arg_3)\n    return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/profileapp.py", "identifier": "list_bundled_profiles", "docstring": "list profiles that are bundled with IPython.", "docstring_tokens": ["list", "profiles", "that", "are", "bundled", "with", "IPython", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252503}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/commands/train.py#L31-L58", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Read data by dataset_reader from specified config.", "language": "python", "parameters": "(config: dict)", "return_statement": "return reader.read(data_path, **reader_config)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get", "(", "'dataset'", ",", "None", ")", "if", "arg_2", ":", "arg_0", ".", "pop", "(", "'dataset'", ")", "arg_3", "=", "arg_2", "[", "'type'", "]", "if", "arg_3", "==", "'classification'", ":", "arg_4", "=", "{", "'class_name'", ":", "'basic_classification_reader'", "}", "arg_5", "=", "{", "'class_name'", ":", "'basic_classification_iterator'", "}", "arg_0", "[", "'dataset_reader'", "]", "=", "{", "**", "arg_2", ",", "**", "arg_4", "}", "arg_0", "[", "'dataset_iterator'", "]", "=", "{", "**", "arg_2", ",", "**", "arg_5", "}", "else", ":", "raise", "Exception", "(", "\"Unsupported dataset type: {}\"", ".", "format", "(", "arg_3", ")", ")", "try", ":", "arg_6", "=", "arg_1", "(", "arg_0", "[", "'dataset_reader'", "]", ")", "except", "KeyError", ":", "raise", "ConfigError", "(", "\"No dataset reader is provided in the JSON config.\"", ")", "arg_4", "=", "get_model", "(", "arg_6", ".", "pop", "(", "'class_name'", ")", ")", "(", ")", "arg_7", "=", "arg_6", ".", "pop", "(", "'data_path'", ",", "''", ")", "if", "isinstance", "(", "arg_7", ",", "list", ")", ":", "arg_7", "=", "[", "expand_path", "(", "x", ")", "for", "x", "in", "arg_7", "]", "else", ":", "arg_7", "=", "expand_path", "(", "arg_7", ")", "return", "arg_4", ".", "read", "(", "arg_7", ",", "**", "arg_6", ")"], "function": "def Func(arg_0: arg_1):\n    \"\"\"Read data by dataset_reader from specified config.\"\"\"\n    arg_2 = arg_0.get('dataset', None)\n\n    if arg_2:\n        arg_0.pop('dataset')\n        arg_3 = arg_2['type']\n        if arg_3 == 'classification':\n            arg_4 = {'class_name': 'basic_classification_reader'}\n            arg_5 = {'class_name': 'basic_classification_iterator'}\n            arg_0['dataset_reader'] = {**arg_2, **arg_4}\n            arg_0['dataset_iterator'] = {**arg_2, **arg_5}\n        else:\n            raise Exception(\"Unsupported dataset type: {}\".format(arg_3))\n\n    try:\n        arg_6 = arg_1(arg_0['dataset_reader'])\n    except KeyError:\n        raise ConfigError(\"No dataset reader is provided in the JSON config.\")\n\n    arg_4 = get_model(arg_6.pop('class_name'))()\n    arg_7 = arg_6.pop('data_path', '')\n    if isinstance(arg_7, list):\n        arg_7 = [expand_path(x) for x in arg_7]\n    else:\n        arg_7 = expand_path(arg_7)\n\n    return arg_4.read(arg_7, **arg_6)", "path": "deeppavlov/core/commands/train.py", "identifier": "read_data_by_config", "docstring": "Read data by dataset_reader from specified config.", "docstring_tokens": ["Read", "data", "by", "dataset_reader", "from", "specified", "config", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 252504}
{"url": "https://github.com/alexprengere/currencyconverter/blob/e3cb0d693819c0c824214225b23a47e9380f71df/currency_converter/currency_converter.py#L192-L206", "sha": "e3cb0d693819c0c824214225b23a47e9380f71df", "docstring_summary": "Fill missing rates of a currency with the closest available ones.", "language": "python", "parameters": "(self, currency)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_rates", "[", "arg_1", "]", "arg_3", ",", "arg_4", "=", "arg_0", ".", "bounds", "[", "arg_1", "]", "for", "arg_5", "in", "list_dates_between", "(", "arg_3", ",", "arg_4", ")", ":", "if", "arg_5", "not", "in", "arg_2", ":", "arg_2", "[", "arg_5", "]", "=", "None", "if", "arg_0", ".", "verbose", ":", "arg_6", "=", "len", "(", "[", "r", "for", "r", "in", "itervalues", "(", "arg_2", ")", "if", "r", "is", "None", "]", ")", "if", "arg_6", ":", "print", "(", "'{0}: {1} missing rates from {2} to {3} ({4} days)'", ".", "format", "(", "arg_1", ",", "arg_6", ",", "arg_3", ",", "arg_4", ",", "1", "+", "(", "arg_4", "-", "arg_3", ")", ".", "days", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Fill missing rates of a currency with the closest available ones.\"\"\"\n        arg_2 = arg_0._rates[arg_1]\n        arg_3, arg_4 = arg_0.bounds[arg_1]\n\n        for arg_5 in list_dates_between(arg_3, arg_4):\n            if arg_5 not in arg_2:\n                arg_2[arg_5] = None\n\n        if arg_0.verbose:\n            arg_6 = len([r for r in itervalues(arg_2) if r is None])\n            if arg_6:\n                print('{0}: {1} missing rates from {2} to {3} ({4} days)'.format(\n                    arg_1, arg_6, arg_3, arg_4,\n                    1 + (arg_4 - arg_3).days))", "path": "currency_converter/currency_converter.py", "identifier": "CurrencyConverter._set_missing_to_none", "docstring": "Fill missing rates of a currency with the closest available ones.", "docstring_tokens": ["Fill", "missing", "rates", "of", "a", "currency", "with", "the", "closest", "available", "ones", "."], "nwo": "alexprengere/currencyconverter", "score": 0.5486903423646818, "idx": 252505}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L471-L486", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the heat capacity of a phase of the compound at a specified\n        temperature.", "language": "python", "parameters": "(self, phase, T)", "return_statement": "return self._phases[phase].Cp(T)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_phases", ":", "raise", "Exception", "(", "\"The phase '%s' was not found in compound '%s'.\"", "%", "(", "arg_1", ",", "arg_0", ".", "formula", ")", ")", "return", "arg_0", ".", "_phases", "[", "arg_1", "]", ".", "Func", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Calculate the heat capacity of a phase of the compound at a specified\n        temperature.\n\n        :param phase: A phase of the compound, e.g. 'S', 'L', 'G'.\n        :param T: [K] temperature\n\n        :returns: [J/mol/K] Heat capacity.\n        \"\"\"\n\n        if arg_1 not in arg_0._phases:\n            raise Exception(\"The phase '%s' was not found in compound '%s'.\" %\n                            (arg_1, arg_0.formula))\n\n        return arg_0._phases[arg_1].Func(arg_2)", "path": "auxi/tools/chemistry/thermochemistry.py", "identifier": "Compound.Cp", "docstring": "Calculate the heat capacity of a phase of the compound at a specified\n        temperature.\n\n        :param phase: A phase of the compound, e.g. 'S', 'L', 'G'.\n        :param T: [K] temperature\n\n        :returns: [J/mol/K] Heat capacity.", "docstring_tokens": ["Calculate", "the", "heat", "capacity", "of", "a", "phase", "of", "the", "compound", "at", "a", "specified", "temperature", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 252506}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1027-L1080", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Returns a CSV string built from the summaries of the Intervals.", "language": "python", "parameters": "(self,\n               filename=None,\n               as_text=True,\n               use_descriptions=False,\n               dlm=\",\",\n               header=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "\",\"", ",", "arg_5", "=", "True", ")", ":", "if", "(", "arg_1", "is", "None", ")", ":", "if", "(", "not", "arg_2", ")", ":", "raise", "StriplogError", "(", "\"You must provide a filename or set as_text to True.\"", ")", "else", ":", "arg_2", "=", "False", "if", "arg_2", ":", "arg_6", "=", "StringIO", "(", ")", "else", ":", "arg_6", "=", "open", "(", "arg_1", ",", "'w'", ")", "arg_7", "=", "[", "'Top'", ",", "'Base'", ",", "'Component'", "]", "arg_8", "=", "csv", ".", "DictWriter", "(", "arg_6", ",", "delimiter", "=", "arg_4", ",", "arg_7", "=", "arg_7", ",", "quoting", "=", "csv", ".", "QUOTE_MINIMAL", ")", "if", "arg_5", ":", "arg_8", ".", "writeheader", "(", ")", "for", "arg_9", "in", "arg_0", ".", "__list", ":", "if", "arg_3", "and", "arg_9", ".", "description", ":", "arg_10", "=", "arg_9", ".", "description", "elif", "arg_9", ".", "primary", ":", "arg_10", "=", "arg_9", ".", "primary", ".", "summary", "(", ")", "else", ":", "arg_10", "=", "''", "arg_11", "=", "{", "j", ":", "k", "for", "j", ",", "k", "in", "zip", "(", "arg_7", ",", "[", "arg_9", ".", "top", ".", "z", ",", "arg_9", ".", "base", ".", "z", ",", "arg_10", "]", ")", "}", "arg_8", ".", "writerow", "(", "arg_11", ")", "if", "arg_2", ":", "return", "arg_6", ".", "getvalue", "(", ")", "else", ":", "arg_6", ".", "close", "return", "None"], "function": "def Func(arg_0,\n               arg_1=None,\n               arg_2=True,\n               arg_3=False,\n               arg_4=\",\",\n               arg_5=True):\n        \"\"\"\n        Returns a CSV string built from the summaries of the Intervals.\n\n        Args:\n            use_descriptions (bool): Whether to use descriptions instead\n                of summaries, if available.\n            dlm (str): The delimiter.\n            header (bool): Whether to form a header row.\n\n        Returns:\n            str: A string of comma-separated values.\n        \"\"\"\n        if (arg_1 is None):\n            if (not arg_2):\n                raise StriplogError(\"You must provide a filename or set as_text to True.\")\n        else:\n            arg_2 = False\n\n        if arg_2:\n            arg_6 = StringIO()\n        else:\n            arg_6 = open(arg_1, 'w')\n\n        arg_7 = ['Top', 'Base', 'Component']\n        arg_8 = csv.DictWriter(arg_6,\n                                delimiter=arg_4,\n                                arg_7=arg_7,\n                                quoting=csv.QUOTE_MINIMAL)\n\n        if arg_5:\n            arg_8.writeheader()\n\n        for arg_9 in arg_0.__list:\n            if arg_3 and arg_9.description:\n                arg_10 = arg_9.description\n            elif arg_9.primary:\n                arg_10 = arg_9.primary.summary()\n            else:\n                arg_10 = ''\n            arg_11 = {j: k for j, k in zip(arg_7, [arg_9.top.z, arg_9.base.z, arg_10])}\n            arg_8.writerow(arg_11)\n\n        if arg_2:\n            return arg_6.getvalue()\n            #return output\n        else:\n            arg_6.close\n            return None", "path": "striplog/striplog.py", "identifier": "Striplog.to_csv", "docstring": "Returns a CSV string built from the summaries of the Intervals.\n\n        Args:\n            use_descriptions (bool): Whether to use descriptions instead\n                of summaries, if available.\n            dlm (str): The delimiter.\n            header (bool): Whether to form a header row.\n\n        Returns:\n            str: A string of comma-separated values.", "docstring_tokens": ["Returns", "a", "CSV", "string", "built", "from", "the", "summaries", "of", "the", "Intervals", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 252507}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L94-L96", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Returns the client in async mode.", "language": "python", "parameters": "(cls, token, session=None, **options)", "return_statement": "return cls(token, session=session, is_async=True, **options)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "arg_0", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "is_async", "=", "True", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Returns the client in async mode.\"\"\"\n        return arg_0(arg_1, arg_2=arg_2, is_async=True, **arg_3)", "path": "clashroyale/royaleapi/client.py", "identifier": "Client.Async", "docstring": "Returns the client in async mode.", "docstring_tokens": ["Returns", "the", "client", "in", "async", "mode", "."], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 252508}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L875-L889", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Consumes a signed 32bit integer number.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "ParseInteger", "(", "arg_0", ".", "token", ",", "is_signed", "=", "True", ",", "is_long", "=", "False", ")", "except", "ValueError", "as", "e", ":", "raise", "arg_0", ".", "_ParseError", "(", "str", "(", "e", ")", ")", "arg_0", ".", "NextToken", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Consumes a signed 32bit integer number.\n\n    Returns:\n      The integer parsed.\n\n    Raises:\n      ParseError: If a signed 32bit integer couldn't be consumed.\n    \"\"\"\n    try:\n      arg_1 = ParseInteger(arg_0.token, is_signed=True, is_long=False)\n    except ValueError as e:\n      raise arg_0._ParseError(str(e))\n    arg_0.NextToken()\n    return arg_1", "path": "typy/google/protobuf/text_format.py", "identifier": "_Tokenizer.ConsumeInt32", "docstring": "Consumes a signed 32bit integer number.\n\n    Returns:\n      The integer parsed.\n\n    Raises:\n      ParseError: If a signed 32bit integer couldn't be consumed.", "docstring_tokens": ["Consumes", "a", "signed", "32bit", "integer", "number", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 252509}
{"url": "https://github.com/hhatto/pgmagick/blob/5dce5fa4681400b4c059431ad69233e6a3e5799a/pgmagick/api.py#L925-L931", "sha": "5dce5fa4681400b4c059431ad69233e6a3e5799a", "docstring_summary": "Scaling Draw Object", "language": "python", "parameters": "(self, x, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "drawer", ".", "append", "(", "pgmagick", ".", "DrawableScaling", "(", "float", "(", "arg_1", ")", ",", "float", "(", "arg_2", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Scaling Draw Object\n\n        :param x: 0.0 ~ 1.0\n        :param y: 0.0 ~ 1.0\n        \"\"\"\n        arg_0.drawer.append(pgmagick.DrawableScaling(float(arg_1), float(arg_2)))", "path": "pgmagick/api.py", "identifier": "Draw.scaling", "docstring": "Scaling Draw Object\n\n        :param x: 0.0 ~ 1.0\n        :param y: 0.0 ~ 1.0", "docstring_tokens": ["Scaling", "Draw", "Object"], "nwo": "hhatto/pgmagick", "score": 0.37249488389724494, "idx": 252510}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/compiler/imputil.py#L276-L293", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Processes a future import statement, returning set of flags it defines.", "language": "python", "parameters": "(node)", "return_statement": "return features", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "ast", ".", "ImportFrom", ")", "assert", "arg_0", ".", "module", "==", "'__future__'", "arg_1", "=", "FutureFeatures", "(", ")", "for", "arg_2", "in", "arg_0", ".", "names", ":", "arg_3", "=", "arg_2", ".", "name", "if", "arg_3", "in", "_FUTURE_FEATURES", ":", "if", "arg_3", "not", "in", "_IMPLEMENTED_FUTURE_FEATURES", ":", "arg_4", "=", "'future feature {} not yet implemented by grumpy'", ".", "format", "(", "arg_3", ")", "raise", "util", ".", "ParseError", "(", "arg_0", ",", "arg_4", ")", "setattr", "(", "arg_1", ",", "arg_3", ",", "True", ")", "elif", "arg_3", "==", "'braces'", ":", "raise", "util", ".", "ParseError", "(", "arg_0", ",", "'not a chance'", ")", "elif", "arg_3", "not", "in", "_REDUNDANT_FUTURE_FEATURES", ":", "arg_4", "=", "'future feature {} is not defined'", ".", "format", "(", "arg_3", ")", "raise", "util", ".", "ParseError", "(", "arg_0", ",", "arg_4", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Processes a future import statement, returning set of flags it defines.\"\"\"\n  assert isinstance(arg_0, ast.ImportFrom)\n  assert arg_0.module == '__future__'\n  arg_1 = FutureFeatures()\n  for arg_2 in arg_0.names:\n    arg_3 = arg_2.name\n    if arg_3 in _FUTURE_FEATURES:\n      if arg_3 not in _IMPLEMENTED_FUTURE_FEATURES:\n        arg_4 = 'future feature {} not yet implemented by grumpy'.format(arg_3)\n        raise util.ParseError(arg_0, arg_4)\n      setattr(arg_1, arg_3, True)\n    elif arg_3 == 'braces':\n      raise util.ParseError(arg_0, 'not a chance')\n    elif arg_3 not in _REDUNDANT_FUTURE_FEATURES:\n      arg_4 = 'future feature {} is not defined'.format(arg_3)\n      raise util.ParseError(arg_0, arg_4)\n  return arg_1", "path": "compiler/imputil.py", "identifier": "_make_future_features", "docstring": "Processes a future import statement, returning set of flags it defines.", "docstring_tokens": ["Processes", "a", "future", "import", "statement", "returning", "set", "of", "flags", "it", "defines", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 252511}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1093-L1230", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds a given item to the tree irrespective of the subtree.", "language": "python", "parameters": "(self, start_node, type_name, group_type_name, args, kwargs,\n                     add_prefix=True, check_naming=True)", "return_statement": "return self._add_to_tree(start_node, split_names, type_name, group_type_name, instance,\n                                 constructor, args, kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "True", ",", "arg_7", "=", "True", ")", ":", "arg_4", "=", "list", "(", "arg_4", ")", "arg_8", "=", "True", "arg_9", "=", "''", "arg_10", "=", "None", "arg_11", "=", "None", "arg_12", "=", "arg_2", "==", "LINK", "if", "arg_12", ":", "arg_9", "=", "arg_4", "[", "0", "]", "arg_10", "=", "arg_4", "[", "1", "]", "arg_8", "=", "False", "elif", "len", "(", "arg_4", ")", "==", "1", "and", "len", "(", "arg_5", ")", "==", "0", ":", "arg_13", "=", "arg_4", "[", "0", "]", "try", ":", "arg_9", "=", "arg_13", ".", "v_full_name", "arg_10", "=", "arg_13", "arg_8", "=", "False", "except", "AttributeError", ":", "pass", "if", "arg_8", ":", "if", "len", "(", "arg_4", ")", ">", "0", "and", "inspect", ".", "isclass", "(", "arg_4", "[", "0", "]", ")", ":", "arg_11", "=", "arg_4", ".", "pop", "(", "0", ")", "if", "len", "(", "arg_4", ")", ">", "0", "and", "isinstance", "(", "arg_4", "[", "0", "]", ",", "str", ")", ":", "arg_9", "=", "arg_4", ".", "pop", "(", "0", ")", "elif", "'name'", "in", "arg_5", ":", "arg_9", "=", "arg_5", ".", "pop", "(", "'name'", ")", "elif", "'full_name'", "in", "arg_5", ":", "arg_9", "=", "arg_5", ".", "pop", "(", "'full_name'", ")", "else", ":", "raise", "ValueError", "(", "'Could not determine a name of the new item you want to add. '", "'Either pass the name as positional argument or as a keyword '", "'argument `name`.'", ")", "arg_14", "=", "arg_9", ".", "split", "(", "'.'", ")", "if", "arg_7", ":", "for", "arg_15", ",", "arg_9", "in", "enumerate", "(", "arg_14", ")", ":", "arg_16", ",", "arg_9", "=", "arg_0", ".", "_translate_shortcut", "(", "arg_9", ")", "arg_17", ",", "arg_9", "=", "arg_0", ".", "_replace_wildcards", "(", "arg_9", ")", "if", "arg_16", "or", "arg_17", ":", "arg_14", "[", "arg_15", "]", "=", "arg_9", "arg_18", "=", "arg_0", ".", "_check_names", "(", "arg_14", ",", "arg_1", ")", "if", "arg_18", ":", "arg_19", "=", "'.'", ".", "join", "(", "arg_14", ")", "raise", "ValueError", "(", "'Your Parameter/Result/Node `%s` contains the following not admissible names: '", "'%s please choose other names.'", "%", "(", "arg_19", ",", "arg_18", ")", ")", "if", "arg_12", ":", "if", "arg_10", "is", "None", ":", "raise", "ValueError", "(", "'You must provide an instance to link to!'", ")", "if", "arg_10", ".", "v_is_root", ":", "raise", "ValueError", "(", "'You cannot create a link to the root node'", ")", "if", "arg_1", ".", "v_is_root", "and", "arg_9", "in", "SUBTREE_MAPPING", ":", "raise", "ValueError", "(", "'`%s` is a reserved name for a group under root.'", "%", "arg_9", ")", "if", "not", "arg_0", ".", "_root_instance", ".", "f_contains", "(", "arg_10", ",", "with_links", "=", "False", ",", "shortcuts", "=", "False", ")", ":", "raise", "ValueError", "(", "'You can only link to items within the trajectory tree!'", ")", "if", "arg_6", ":", "arg_14", "=", "arg_0", ".", "_add_prefix", "(", "arg_14", ",", "arg_1", ",", "arg_3", ")", "if", "arg_3", "==", "GROUP", ":", "arg_20", "=", "arg_2", "!=", "arg_3", "and", "not", "arg_12", "arg_3", ",", "arg_2", "=", "arg_0", ".", "_determine_types", "(", "arg_1", ",", "arg_14", "[", "0", "]", ",", "arg_20", ",", "arg_12", ")", "if", "arg_0", ".", "_root_instance", ".", "_is_run", "and", "arg_2", "in", "SENSITIVE_TYPES", ":", "raise", "TypeError", "(", "'You are not allowed to add config or parameter data or groups '", "'during a single run.'", ")", "return", "arg_0", ".", "_add_to_tree", "(", "arg_1", ",", "arg_14", ",", "arg_2", ",", "arg_3", ",", "arg_10", ",", "arg_11", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5,\n                     arg_6=True, arg_7=True):\n        \"\"\"Adds a given item to the tree irrespective of the subtree.\n\n        Infers the subtree from the arguments.\n\n        :param start_node: The parental node the adding was initiated from\n\n        :param type_name:\n\n            The type of the new instance. Whether it is a parameter, parameter group, config,\n            config group, etc. See the name of the corresponding constants at the top of this\n            python module.\n\n\n        :param group_type_name:\n\n            Type of the subbranch. i.e. whether the item is added to the 'parameters',\n            'results' etc. These subbranch types are named as the group names\n            (e.g. 'PARAMETER_GROUP') in order to have less constants.\n            For all constants used see beginning of this python module.\n\n        :param args:\n\n            Arguments specifying how the item is added.\n\n            If len(args)==1 and the argument is the a given instance of a result or parameter,\n            this one is added to the tree.\n\n            Otherwise it is checked if the first argument is a class specifying how to\n            construct a new item and the second argument is the name of the new class.\n\n            If the first argument is not a class but a string, the string is assumed to be\n            the name of the new instance.\n\n            Additional args are later on used for the construction of the instance.\n\n        :param kwargs:\n\n            Additional keyword arguments that might be handed over to the instance constructor.\n\n        :param add_prefix:\n\n            If a prefix group, i.e. `results`, `config`, etc. should be added\n\n        :param check_naming:\n\n            If it should be checked for correct namings, can be set to ``False`` if data is loaded\n            and we know that all names are correct.\n\n        :return: The new added instance\n\n        \"\"\"\n        arg_4 = list(arg_4)\n        arg_8 = True\n        arg_9 = ''\n        arg_10 = None\n        arg_11 = None\n\n        arg_12 = arg_2 == LINK\n\n        # First check if the item is already a given instance or we want to add a link\n        if arg_12:\n            arg_9 = arg_4[0]\n            arg_10 = arg_4[1]\n            arg_8 = False\n        elif len(arg_4) == 1 and len(arg_5) == 0:\n            arg_13 = arg_4[0]\n            try:\n                arg_9 = arg_13.v_full_name\n                arg_10 = arg_13\n\n                arg_8 = False\n            except AttributeError:\n                pass\n\n        # If the item is not an instance yet, check if args[0] is a class and args[1] is\n        # a string describing the new name of the instance.\n        # If args[0] is not a class it is assumed to be the name of the new instance.\n        if arg_8:\n            if len(arg_4) > 0 and inspect.isclass(arg_4[0]):\n                arg_11 = arg_4.pop(0)\n            if len(arg_4) > 0 and isinstance(arg_4[0], str):\n                arg_9 = arg_4.pop(0)\n            elif 'name' in arg_5:\n                arg_9 = arg_5.pop('name')\n            elif 'full_name' in arg_5:\n                arg_9 = arg_5.pop('full_name')\n            else:\n                raise ValueError('Could not determine a name of the new item you want to add. '\n                                 'Either pass the name as positional argument or as a keyword '\n                                 'argument `name`.')\n\n        arg_14 = arg_9.split('.')\n        if arg_7:\n\n            for arg_15, arg_9 in enumerate(arg_14):\n                arg_16, arg_9 = arg_0._translate_shortcut(arg_9)\n                arg_17, arg_9 = arg_0._replace_wildcards(arg_9)\n                if arg_16 or arg_17:\n                    arg_14[arg_15] = arg_9\n\n            # First check if the naming of the new item is appropriate\n            arg_18 = arg_0._check_names(arg_14, arg_1)\n\n            if arg_18:\n                arg_19 = '.'.join(arg_14)\n                raise ValueError(\n                    'Your Parameter/Result/Node `%s` contains the following not admissible names: '\n                    '%s please choose other names.' % (arg_19, arg_18))\n\n            if arg_12:\n                if arg_10 is None:\n                    raise ValueError('You must provide an instance to link to!')\n                if arg_10.v_is_root:\n                    raise ValueError('You cannot create a link to the root node')\n                if arg_1.v_is_root and arg_9 in SUBTREE_MAPPING:\n                    raise ValueError('`%s` is a reserved name for a group under root.' % arg_9)\n                if not arg_0._root_instance.f_contains(arg_10, with_links=False, shortcuts=False):\n                    raise ValueError('You can only link to items within the trajectory tree!')\n\n        # Check if the name fulfils the prefix conditions, if not change the name accordingly.\n        if arg_6:\n            arg_14 = arg_0._add_prefix(arg_14, arg_1, arg_3)\n\n        if arg_3 == GROUP:\n            arg_20 = arg_2 != arg_3 and not arg_12\n            # If this is equal we add a group node\n            arg_3, arg_2 = arg_0._determine_types(arg_1, arg_14[0],\n                                                               arg_20, arg_12)\n\n        # Check if we are allowed to add the data\n        if arg_0._root_instance._is_run and arg_2 in SENSITIVE_TYPES:\n            raise TypeError('You are not allowed to add config or parameter data or groups '\n                            'during a single run.')\n\n        return arg_0._add_to_tree(arg_1, arg_14, arg_2, arg_3, arg_10,\n                                 arg_11, arg_4, arg_5)", "path": "pypet/naturalnaming.py", "identifier": "NaturalNamingInterface._add_generic", "docstring": "Adds a given item to the tree irrespective of the subtree.\n\n        Infers the subtree from the arguments.\n\n        :param start_node: The parental node the adding was initiated from\n\n        :param type_name:\n\n            The type of the new instance. Whether it is a parameter, parameter group, config,\n            config group, etc. See the name of the corresponding constants at the top of this\n            python module.\n\n\n        :param group_type_name:\n\n            Type of the subbranch. i.e. whether the item is added to the 'parameters',\n            'results' etc. These subbranch types are named as the group names\n            (e.g. 'PARAMETER_GROUP') in order to have less constants.\n            For all constants used see beginning of this python module.\n\n        :param args:\n\n            Arguments specifying how the item is added.\n\n            If len(args)==1 and the argument is the a given instance of a result or parameter,\n            this one is added to the tree.\n\n            Otherwise it is checked if the first argument is a class specifying how to\n            construct a new item and the second argument is the name of the new class.\n\n            If the first argument is not a class but a string, the string is assumed to be\n            the name of the new instance.\n\n            Additional args are later on used for the construction of the instance.\n\n        :param kwargs:\n\n            Additional keyword arguments that might be handed over to the instance constructor.\n\n        :param add_prefix:\n\n            If a prefix group, i.e. `results`, `config`, etc. should be added\n\n        :param check_naming:\n\n            If it should be checked for correct namings, can be set to ``False`` if data is loaded\n            and we know that all names are correct.\n\n        :return: The new added instance", "docstring_tokens": ["Adds", "a", "given", "item", "to", "the", "tree", "irrespective", "of", "the", "subtree", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252512}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/roi.py#L350-L394", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Extracts the values in `datavol` that are in the ROI with value `roivalue` in `roivol`.\n    The ROI can be masked by `maskvol`.", "language": "python", "parameters": "(datavol, roivol, roivalue, maskvol=None, zeroe=True)", "return_statement": "return ts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "True", ")", ":", "if", "arg_3", "is", "not", "None", ":", "arg_5", "=", "(", "arg_1", "==", "arg_2", ")", "*", "(", "arg_3", ">", "0", ")", "else", ":", "arg_5", "=", "arg_1", "==", "arg_2", "if", "arg_0", ".", "ndim", "==", "4", ":", "arg_6", "=", "arg_0", "[", "arg_5", ",", ":", "]", "else", ":", "arg_6", "=", "arg_0", "[", "arg_5", "]", "if", "arg_4", ":", "if", "arg_0", ".", "ndim", "==", "4", ":", "arg_6", "=", "arg_6", "[", "arg_6", ".", "sum", "(", "axis", "=", "1", ")", "!=", "0", ",", ":", "]", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=True):\n    \"\"\" Extracts the values in `datavol` that are in the ROI with value `roivalue` in `roivol`.\n    The ROI can be masked by `maskvol`.\n\n    Parameters\n    ----------\n    datavol: numpy.ndarray\n        4D timeseries volume or a 3D volume to be partitioned\n\n    roivol: numpy.ndarray\n        3D ROIs volume\n\n    roivalue: int or float\n        A value from roivol that represents the ROI to be used for extraction.\n\n    maskvol: numpy.ndarray\n        3D mask volume\n\n    zeroe: bool\n        If true will remove the null timeseries voxels.  Only applied to timeseries (4D) data.\n\n    Returns\n    -------\n    values: np.array\n        An array of the values in the indicated ROI.\n        A 2D matrix if `datavol` is 4D or a 1D vector if `datavol` is 3D.\n    \"\"\"\n    if arg_3 is not None:\n        # get all masked time series within this roi r\n        arg_5 = (arg_1 == arg_2) * (arg_3 > 0)\n    else:\n        # get all time series within this roi r\n        arg_5 = arg_1 == arg_2\n\n    if arg_0.ndim == 4:\n        arg_6 = arg_0[arg_5, :]\n    else:\n        arg_6 = arg_0[arg_5]\n\n    # remove zeroed time series\n    if arg_4:\n        if arg_0.ndim == 4:\n            arg_6 = arg_6[arg_6.sum(axis=1) != 0, :]\n\n    return arg_6", "path": "boyle/nifti/roi.py", "identifier": "_partition_data", "docstring": "Extracts the values in `datavol` that are in the ROI with value `roivalue` in `roivol`.\n    The ROI can be masked by `maskvol`.\n\n    Parameters\n    ----------\n    datavol: numpy.ndarray\n        4D timeseries volume or a 3D volume to be partitioned\n\n    roivol: numpy.ndarray\n        3D ROIs volume\n\n    roivalue: int or float\n        A value from roivol that represents the ROI to be used for extraction.\n\n    maskvol: numpy.ndarray\n        3D mask volume\n\n    zeroe: bool\n        If true will remove the null timeseries voxels.  Only applied to timeseries (4D) data.\n\n    Returns\n    -------\n    values: np.array\n        An array of the values in the indicated ROI.\n        A 2D matrix if `datavol` is 4D or a 1D vector if `datavol` is 3D.", "docstring_tokens": ["Extracts", "the", "values", "in", "datavol", "that", "are", "in", "the", "ROI", "with", "value", "roivalue", "in", "roivol", ".", "The", "ROI", "can", "be", "masked", "by", "maskvol", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 252513}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L6188-L6282", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Does google-lint on a single file.", "language": "python", "parameters": "(filename, vlevel, extra_check_functions=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "_SetVerboseLevel", "(", "arg_1", ")", "_BackupFilters", "(", ")", "if", "not", "ProcessConfigOverrides", "(", "arg_0", ")", ":", "_RestoreFilters", "(", ")", "return", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "try", ":", "if", "arg_0", "==", "'-'", ":", "arg_5", "=", "codecs", ".", "StreamReaderWriter", "(", "sys", ".", "stdin", ",", "codecs", ".", "getreader", "(", "'utf8'", ")", ",", "codecs", ".", "getwriter", "(", "'utf8'", ")", ",", "'replace'", ")", ".", "read", "(", ")", ".", "split", "(", "'\\n'", ")", "else", ":", "arg_5", "=", "codecs", ".", "open", "(", "arg_0", ",", "'r'", ",", "'utf8'", ",", "'replace'", ")", ".", "read", "(", ")", ".", "split", "(", "'\\n'", ")", "for", "arg_6", "in", "range", "(", "len", "(", "arg_5", ")", "-", "1", ")", ":", "if", "arg_5", "[", "arg_6", "]", ".", "endswith", "(", "'\\r'", ")", ":", "arg_5", "[", "arg_6", "]", "=", "arg_5", "[", "arg_6", "]", ".", "rstrip", "(", "'\\r'", ")", "arg_4", ".", "append", "(", "arg_6", "+", "1", ")", "else", ":", "arg_3", ".", "append", "(", "arg_6", "+", "1", ")", "except", "IOError", ":", "_cpplint_state", ".", "PrintError", "(", "\"Skipping input '%s': Can't open for reading\\n\"", "%", "arg_0", ")", "_RestoreFilters", "(", ")", "return", "arg_7", "=", "arg_0", "[", "arg_0", ".", "rfind", "(", "'.'", ")", "+", "1", ":", "]", "if", "arg_0", "!=", "'-'", "and", "arg_7", "not", "in", "GetAllExtensions", "(", ")", ":", "arg_8", "=", "set", "(", "[", "\"external/local_config_cc/libtool\"", ",", "\"external/local_config_cc/make_hashed_objlist.py\"", ",", "\"external/local_config_cc/wrapped_ar\"", ",", "\"external/local_config_cc/wrapped_clang\"", ",", "\"external/local_config_cc/xcrunwrapper.sh\"", ",", "]", ")", "if", "not", "arg_0", "in", "arg_8", ":", "_cpplint_state", ".", "PrintError", "(", "'Ignoring %s; not a valid file name '", "'(%s)\\n'", "%", "(", "arg_0", ",", "', '", ".", "join", "(", "GetAllExtensions", "(", ")", ")", ")", ")", "else", ":", "FuncData", "(", "arg_0", ",", "arg_7", ",", "arg_5", ",", "Error", ",", "arg_2", ")", "if", "arg_3", "and", "arg_4", ":", "for", "arg_6", "in", "arg_4", ":", "Error", "(", "arg_0", ",", "arg_6", ",", "'whitespace/newline'", ",", "1", ",", "'Unexpected \\\\r (^M) found; better to use only \\\\n'", ")", "_RestoreFilters", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n  \"\"\"Does google-lint on a single file.\n\n  Args:\n    filename: The name of the file to parse.\n\n    vlevel: The level of errors to report.  Every error of confidence\n    >= verbose_level will be reported.  0 is a good default.\n\n    extra_check_functions: An array of additional check functions that will be\n                           run on each source line. Each function takes 4\n                           arguments: filename, clean_lines, line, error\n  \"\"\"\n\n  _SetVerboseLevel(arg_1)\n  _BackupFilters()\n\n  if not ProcessConfigOverrides(arg_0):\n    _RestoreFilters()\n    return\n\n  arg_3 = []\n  arg_4 = []\n  try:\n    # Support the UNIX convention of using \"-\" for stdin.  Note that\n    # we are not opening the file with universal newline support\n    # (which codecs doesn't support anyway), so the resulting lines do\n    # contain trailing '\\r' characters if we are reading a file that\n    # has CRLF endings.\n    # If after the split a trailing '\\r' is present, it is removed\n    # below.\n    if arg_0 == '-':\n      arg_5 = codecs.StreamReaderWriter(sys.stdin,\n                                        codecs.getreader('utf8'),\n                                        codecs.getwriter('utf8'),\n                                        'replace').read().split('\\n')\n    else:\n      arg_5 = codecs.open(arg_0, 'r', 'utf8', 'replace').read().split('\\n')\n\n    # Remove trailing '\\r'.\n    # The -1 accounts for the extra trailing blank line we get from split()\n    for arg_6 in range(len(arg_5) - 1):\n      if arg_5[arg_6].endswith('\\r'):\n        arg_5[arg_6] = arg_5[arg_6].rstrip('\\r')\n        arg_4.append(arg_6 + 1)\n      else:\n        arg_3.append(arg_6 + 1)\n\n  except IOError:\n    _cpplint_state.PrintError(\n        \"Skipping input '%s': Can't open for reading\\n\" % arg_0)\n    _RestoreFilters()\n    return\n\n  # Note, if no dot is found, this will give the entire filename as the ext.\n  arg_7 = arg_0[arg_0.rfind('.') + 1:]\n\n  # When reading from stdin, the extension is unknown, so no cpplint tests\n  # should rely on the extension.\n  if arg_0 != '-' and arg_7 not in GetAllExtensions():\n    # bazel 0.5.1> uses four distinct generated files that gives a warning\n    # we suppress the warning for these files\n    arg_8 = set([ \n        \"external/local_config_cc/libtool\",\n        \"external/local_config_cc/make_hashed_objlist.py\", \n        \"external/local_config_cc/wrapped_ar\",\n        \"external/local_config_cc/wrapped_clang\",\n        \"external/local_config_cc/xcrunwrapper.sh\",\n    ])\n    if not arg_0 in arg_8:\n       _cpplint_state.PrintError('Ignoring %s; not a valid file name '\n                                 '(%s)\\n' % (arg_0, ', '.join(GetAllExtensions())))\n  else:\n    FuncData(arg_0, arg_7, arg_5, Error,\n                    arg_2)\n\n    # If end-of-line sequences are a mix of LF and CR-LF, issue\n    # warnings on the lines with CR.\n    #\n    # Don't issue any warnings if all lines are uniformly LF or CR-LF,\n    # since critique can handle these just fine, and the style guide\n    # doesn't dictate a particular end of line sequence.\n    #\n    # We can't depend on os.linesep to determine what the desired\n    # end-of-line sequence should be, since that will return the\n    # server-side end-of-line sequence.\n    if arg_3 and arg_4:\n      # Warn on every line with CR.  An alternative approach might be to\n      # check whether the file is mostly CRLF or just LF, and warn on the\n      # minority, we bias toward LF here since most tools prefer LF.\n      for arg_6 in arg_4:\n        Error(arg_0, arg_6, 'whitespace/newline', 1,\n              'Unexpected \\\\r (^M) found; better to use only \\\\n')\n\n  _RestoreFilters()", "path": "third_party/python/cpplint/cpplint.py", "identifier": "ProcessFile", "docstring": "Does google-lint on a single file.\n\n  Args:\n    filename: The name of the file to parse.\n\n    vlevel: The level of errors to report.  Every error of confidence\n    >= verbose_level will be reported.  0 is a good default.\n\n    extra_check_functions: An array of additional check functions that will be\n                           run on each source line. Each function takes 4\n                           arguments: filename, clean_lines, line, error", "docstring_tokens": ["Does", "google", "-", "lint", "on", "a", "single", "file", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252514}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/gce.py#L102-L114", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Retrieves service account info for invalid credentials.", "language": "python", "parameters": "(self, http)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "invalid", ":", "arg_2", "=", "_metadata", ".", "get_service_account_info", "(", "arg_1", ",", "service_account", "=", "arg_0", ".", "service_account_email", "or", "'default'", ")", "arg_0", ".", "invalid", "=", "False", "arg_0", ".", "service_account_email", "=", "arg_2", "[", "'email'", "]", "arg_0", ".", "scopes", "=", "arg_2", "[", "'scopes'", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Retrieves service account info for invalid credentials.\n\n        Args:\n            http: an object to be used to make HTTP requests.\n        \"\"\"\n        if arg_0.invalid:\n            arg_2 = _metadata.get_service_account_info(\n                arg_1,\n                service_account=arg_0.service_account_email or 'default')\n            arg_0.invalid = False\n            arg_0.service_account_email = arg_2['email']\n            arg_0.scopes = arg_2['scopes']", "path": "oauth2client/contrib/gce.py", "identifier": "AppAssertionCredentials._retrieve_info", "docstring": "Retrieves service account info for invalid credentials.\n\n        Args:\n            http: an object to be used to make HTTP requests.", "docstring_tokens": ["Retrieves", "service", "account", "info", "for", "invalid", "credentials", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 252515}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/statements.py#L372-L423", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Merge two lists of statements into one", "language": "python", "parameters": "(stmsA: List[\"HdlStatement\"], stmsB: List[\"HdlStatement\"])", "return_statement": "return tmp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "\"HdlStatement\"", "]", ",", "arg_2", ":", "arg_1", "[", "\"HdlStatement\"", "]", ")", "->", "arg_1", "[", "\"HdlStatement\"", "]", ":", "if", "arg_0", "is", "None", "and", "arg_2", "is", "None", ":", "return", "None", "arg_3", "=", "[", "]", "arg_4", "=", "iter", "(", "arg_0", ")", "arg_5", "=", "iter", "(", "arg_2", ")", "arg_6", "=", "None", "arg_7", "=", "None", "arg_8", "=", "False", "arg_9", "=", "False", "while", "not", "arg_8", "and", "not", "arg_9", ":", "while", "not", "arg_8", ":", "arg_6", "=", "next", "(", "arg_4", ",", "None", ")", "if", "arg_6", "is", "None", ":", "arg_8", "=", "True", "break", "elif", "arg_6", ".", "rank", "==", "0", ":", "arg_3", ".", "append", "(", "arg_6", ")", "arg_6", "=", "None", "else", ":", "break", "while", "not", "arg_9", ":", "arg_7", "=", "next", "(", "arg_5", ",", "None", ")", "if", "arg_7", "is", "None", ":", "arg_9", "=", "True", "break", "elif", "arg_7", ".", "rank", "==", "0", ":", "arg_3", ".", "append", "(", "arg_7", ")", "arg_7", "=", "None", "else", ":", "break", "if", "arg_6", "is", "not", "None", "or", "arg_7", "is", "not", "None", ":", "arg_6", ".", "_merge_with_other_stm", "(", "arg_7", ")", "arg_3", ".", "append", "(", "arg_6", ")", "arg_6", "=", "None", "arg_7", "=", "None", "return", "arg_3"], "function": "def Func(arg_0: arg_1[\"HdlStatement\"], arg_2: arg_1[\"HdlStatement\"])\\\n            -> arg_1[\"HdlStatement\"]:\n        \"\"\"\n        Merge two lists of statements into one\n\n        :return: list of merged statements\n        \"\"\"\n        if arg_0 is None and arg_2 is None:\n            return None\n\n        arg_3 = []\n\n        arg_4 = iter(arg_0)\n        arg_5 = iter(arg_2)\n\n        arg_6 = None\n        arg_7 = None\n        arg_8 = False\n        arg_9 = False\n\n        while not arg_8 and not arg_9:\n            while not arg_8:\n                arg_6 = next(arg_4, None)\n                if arg_6 is None:\n                    arg_8 = True\n                    break\n                elif arg_6.rank == 0:\n                    # simple statement does not require merging\n                    arg_3.append(arg_6)\n                    arg_6 = None\n                else:\n                    break\n\n            while not arg_9:\n                arg_7 = next(arg_5, None)\n                if arg_7 is None:\n                    arg_9 = True\n                    break\n                elif arg_7.rank == 0:\n                    # simple statement does not require merging\n                    arg_3.append(arg_7)\n                    arg_7 = None\n                else:\n                    break\n\n            if arg_6 is not None or arg_7 is not None:\n                arg_6._merge_with_other_stm(arg_7)\n                arg_3.append(arg_6)\n                arg_6 = None\n                arg_7 = None\n\n        return arg_3", "path": "hwt/hdl/statements.py", "identifier": "HdlStatement._merge_statement_lists", "docstring": "Merge two lists of statements into one\n\n        :return: list of merged statements", "docstring_tokens": ["Merge", "two", "lists", "of", "statements", "into", "one"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252516}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/bfgs_utils.py#L36-L39", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Condition to stop when any batch member converges, or all have failed.", "language": "python", "parameters": "(converged, failed)", "return_statement": "return (tf.reduce_any(input_tensor=converged) |\n          tf.reduce_all(input_tensor=failed))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "tf", ".", "reduce_any", "(", "input_tensor", "=", "arg_0", ")", "|", "tf", ".", "reduce_all", "(", "input_tensor", "=", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Condition to stop when any batch member converges, or all have failed.\"\"\"\n  return (tf.reduce_any(input_tensor=arg_0) |\n          tf.reduce_all(input_tensor=arg_1))", "path": "tensorflow_probability/python/optimizer/bfgs_utils.py", "identifier": "converged_any", "docstring": "Condition to stop when any batch member converges, or all have failed.", "docstring_tokens": ["Condition", "to", "stop", "when", "any", "batch", "member", "converges", "or", "all", "have", "failed", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252517}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/primitive.py#L49-L61", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Gets the position of the text the ParseNode processed. If the ParseNode does not have its\n    own position, it looks to its first child for its position.", "language": "python", "parameters": "(self)", "return_statement": "return pos", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_Func", "if", "arg_1", "is", "None", "and", "arg_0", ".", "children", ":", "arg_2", "=", "arg_0", ".", "children", "[", "0", "]", "if", "isinstance", "(", "arg_2", ",", "ParseNode", ")", ":", "arg_1", "=", "arg_2", ".", "Func", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Gets the Func of the text the ParseNode processed. If the ParseNode does not have its\n    own Func, it looks to its first child for its Func.\n\n    'Value Nodes' (terminals) must have their own Func, otherwise this method will throw an\n    exception when it tries to get the Func property of the string child.\n    \"\"\"\n    arg_1 = arg_0._Func\n    if arg_1 is None and arg_0.children:\n      arg_2 = arg_0.children[0]\n      if isinstance(arg_2, ParseNode):\n        arg_1 = arg_2.Func\n    return arg_1", "path": "pyebnf/primitive.py", "identifier": "ParseNode.position", "docstring": "Gets the position of the text the ParseNode processed. If the ParseNode does not have its\n    own position, it looks to its first child for its position.\n\n    'Value Nodes' (terminals) must have their own position, otherwise this method will throw an\n    exception when it tries to get the position property of the string child.", "docstring_tokens": ["Gets", "the", "position", "of", "the", "text", "the", "ParseNode", "processed", ".", "If", "the", "ParseNode", "does", "not", "have", "its", "own", "position", "it", "looks", "to", "its", "first", "child", "for", "its", "position", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 252518}
{"url": "https://github.com/simion/pip-upgrader/blob/716adca65d9ed56d4d416f94ede8a8e4fa8d640a/pip_upgrader/requirements_detector.py#L32-L45", "sha": "716adca65d9ed56d4d416f94ede8a8e4fa8d640a", "docstring_summary": "Attempt to detect requirements files in the current working directory", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_is_valid_requirements_file", "(", "'requirements.txt'", ")", ":", "arg_0", ".", "filenames", ".", "append", "(", "'requirements.txt'", ")", "if", "arg_0", ".", "_is_valid_requirements_file", "(", "'requirements.pip'", ")", ":", "arg_0", ".", "filenames", ".", "append", "(", "'requirements.pip'", ")", "if", "os", ".", "path", ".", "isdir", "(", "'requirements'", ")", ":", "for", "arg_1", "in", "os", ".", "listdir", "(", "'requirements'", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "'requirements'", ",", "arg_1", ")", "if", "arg_0", ".", "_is_valid_requirements_file", "(", "arg_2", ")", ":", "arg_0", ".", "filenames", ".", "append", "(", "arg_2", ")", "arg_0", ".", "_check_inclusions_recursively", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Attempt to detect requirements files in the current working directory \"\"\"\n        if arg_0._is_valid_requirements_file('requirements.txt'):\n            arg_0.filenames.append('requirements.txt')\n\n        if arg_0._is_valid_requirements_file('requirements.pip'):  # pragma: nocover\n            arg_0.filenames.append('requirements.pip')\n\n        if os.path.isdir('requirements'):\n            for arg_1 in os.listdir('requirements'):\n                arg_2 = os.path.join('requirements', arg_1)\n                if arg_0._is_valid_requirements_file(arg_2):\n                    arg_0.filenames.append(arg_2)\n        arg_0._check_inclusions_recursively()", "path": "pip_upgrader/requirements_detector.py", "identifier": "RequirementsDetector.autodetect_files", "docstring": "Attempt to detect requirements files in the current working directory", "docstring_tokens": ["Attempt", "to", "detect", "requirements", "files", "in", "the", "current", "working", "directory"], "nwo": "simion/pip-upgrader", "score": 0.5596825937210061, "idx": 252519}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L595-L622", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Send data synchronous to an ADS-device from data name.", "language": "python", "parameters": "(port, address, data_name, value, data_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "adsSyncReadWriteReqEx2", "(", "arg_0", ",", "arg_1", ",", "ADSIGRP_SYM_HNDBYNAME", ",", "0x0", ",", "PLCTYPE_UDINT", ",", "arg_2", ",", "PLCTYPE_STRING", ",", ")", "adsSyncWriteReqEx", "(", "arg_0", ",", "arg_1", ",", "ADSIGRP_SYM_VALBYHND", ",", "arg_5", ",", "arg_3", ",", "arg_4", ")", "adsSyncWriteReqEx", "(", "arg_0", ",", "arg_1", ",", "ADSIGRP_SYM_RELEASEHND", ",", "0", ",", "arg_5", ",", "PLCTYPE_UDINT", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    # type: (int, AmsAddr, str, Any, Type) -> None\n    \"\"\"Send data synchronous to an ADS-device from data name.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :param string data_name: PLC storage address\n    :param value: value to write to the storage address of the PLC\n    :param Type data_type: type of the data given to the PLC,\n        according to PLCTYPE constants\n\n    \"\"\"\n    # Get the handle of the PLC-variable\n    arg_5 = adsSyncReadWriteReqEx2(\n        arg_0,\n        arg_1,\n        ADSIGRP_SYM_HNDBYNAME,\n        0x0,\n        PLCTYPE_UDINT,\n        arg_2,\n        PLCTYPE_STRING,\n    )\n\n    # Write the value of a PLC-variable, via handle\n    adsSyncWriteReqEx(arg_0, arg_1, ADSIGRP_SYM_VALBYHND, arg_5, arg_3, arg_4)\n\n    # Release the handle of the PLC-variable\n    adsSyncWriteReqEx(arg_0, arg_1, ADSIGRP_SYM_RELEASEHND, 0, arg_5, PLCTYPE_UDINT)", "path": "pyads/pyads_ex.py", "identifier": "adsSyncWriteByNameEx", "docstring": "Send data synchronous to an ADS-device from data name.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :param string data_name: PLC storage address\n    :param value: value to write to the storage address of the PLC\n    :param Type data_type: type of the data given to the PLC,\n        according to PLCTYPE constants", "docstring_tokens": ["Send", "data", "synchronous", "to", "an", "ADS", "-", "device", "from", "data", "name", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 252520}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/aio/async_send_handler.py#L151-L182", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Wait until all pending messages have been sent.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "running", ":", "await", "arg_0", ".", "open", "(", ")", "try", ":", "arg_1", "=", "arg_0", ".", "_handler", ".", "_pending_messages", "[", ":", "]", "await", "arg_0", ".", "_handler", ".", "wait_async", "(", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", ".", "state", "==", "constants", ".", "MessageState", ".", "SendFailed", ":", "arg_2", ".", "append", "(", "(", "False", ",", "MessageSendFailed", "(", "arg_3", ".", "_response", ")", ")", ")", "else", ":", "arg_2", ".", "append", "(", "(", "True", ",", "None", ")", ")", "return", "arg_2", "except", "Exception", "as", "e", ":", "raise", "MessageSendFailed", "(", "e", ")"], "function": "async def Func(arg_0):\n        \"\"\"Wait until all pending messages have been sent.\n\n        :returns: A list of the send results of all the pending messages. Each\n         send result is a tuple with two values. The first is a boolean, indicating `True`\n         if the message sent, or `False` if it failed. The second is an error if the message\n         failed, otherwise it will be `None`.\n        :rtype: list[tuple[bool, ~azure.servicebus.common.errors.MessageSendFailed]]\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START queue_sender_messages]\n                :end-before: [END queue_sender_messages]\n                :language: python\n                :dedent: 4\n                :caption: Schedule messages.\n\n        \"\"\"\n        if not arg_0.running:\n            await arg_0.open()\n        try:\n            arg_1 = arg_0._handler._pending_messages[:]  # pylint: disable=protected-access\n            await arg_0._handler.wait_async()\n            arg_2 = []\n            for arg_3 in arg_1:\n                if arg_3.state == constants.MessageState.SendFailed:\n                    arg_2.append((False, MessageSendFailed(arg_3._response)))  # pylint: disable=protected-access\n                else:\n                    arg_2.append((True, None))\n            return arg_2\n        except Exception as e:  # pylint: disable=broad-except\n            raise MessageSendFailed(e)", "path": "azure-servicebus/azure/servicebus/aio/async_send_handler.py", "identifier": "Sender.send_pending_messages", "docstring": "Wait until all pending messages have been sent.\n\n        :returns: A list of the send results of all the pending messages. Each\n         send result is a tuple with two values. The first is a boolean, indicating `True`\n         if the message sent, or `False` if it failed. The second is an error if the message\n         failed, otherwise it will be `None`.\n        :rtype: list[tuple[bool, ~azure.servicebus.common.errors.MessageSendFailed]]\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START queue_sender_messages]\n                :end-before: [END queue_sender_messages]\n                :language: python\n                :dedent: 4\n                :caption: Schedule messages.", "docstring_tokens": ["Wait", "until", "all", "pending", "messages", "have", "been", "sent", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252521}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/packet.py#L484-L490", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Get 3D markers with residual.", "language": "python", "parameters": "(\n        self, component_info=None, data=None, component_position=None\n    )", "return_statement": "return self._get_3d_markers(\n            RT3DMarkerPositionResidual, component_info, data, component_position\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "return", "arg_0", ".", "_get_3d_markers", "(", "RT3DMarkerPositionResidual", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(\n        arg_0, arg_1=None, arg_2=None, arg_3=None\n    ):\n        \"\"\"Get 3D markers with residual.\"\"\"\n        return arg_0._get_3d_markers(\n            RT3DMarkerPositionResidual, arg_1, arg_2, arg_3\n        )", "path": "qtm/packet.py", "identifier": "QRTPacket.get_3d_markers_residual", "docstring": "Get 3D markers with residual.", "docstring_tokens": ["Get", "3D", "markers", "with", "residual", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 252522}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L3516-L3538", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Loads annotations from disk.", "language": "python", "parameters": "(self, item_with_annotations, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_all_get_from_attrs", "(", "arg_2", ",", "HDF5StorageService", ".", "ANNOTATED", ")", "if", "arg_3", ":", "arg_4", "=", "arg_1", ".", "v_annotations", "if", "not", "arg_4", ".", "f_is_empty", "(", ")", ":", "raise", "TypeError", "(", "'Loading into non-empty annotations!'", ")", "arg_5", "=", "arg_2", ".", "_v_attrs", "for", "arg_6", "in", "arg_5", ".", "_v_attrnames", ":", "if", "arg_6", ".", "startswith", "(", "HDF5StorageService", ".", "ANNOTATION_PREFIX", ")", ":", "arg_7", "=", "arg_6", "arg_7", "=", "arg_7", ".", "replace", "(", "HDF5StorageService", ".", "ANNOTATION_PREFIX", ",", "''", ")", "arg_8", "=", "getattr", "(", "arg_5", ",", "arg_6", ")", "setattr", "(", "arg_4", ",", "arg_7", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Loads annotations from disk.\"\"\"\n\n        arg_3 = arg_0._all_get_from_attrs(arg_2, HDF5StorageService.ANNOTATED)\n\n        if arg_3:\n\n            arg_4 = arg_1.v_annotations\n\n            # You can only load into non-empty annotations, to prevent overwriting data in RAM\n            if not arg_4.f_is_empty():\n                raise TypeError('Loading into non-empty annotations!')\n\n            arg_5 = arg_2._v_attrs\n\n            for arg_6 in arg_5._v_attrnames:\n\n                if arg_6.startswith(HDF5StorageService.ANNOTATION_PREFIX):\n                    arg_7 = arg_6\n                    arg_7 = arg_7.replace(HDF5StorageService.ANNOTATION_PREFIX, '')\n\n                    arg_8 = getattr(arg_5, arg_6)\n                    setattr(arg_4, arg_7, arg_8)", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._ann_load_annotations", "docstring": "Loads annotations from disk.", "docstring_tokens": ["Loads", "annotations", "from", "disk", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252523}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/volume.py#L2521-L2552", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate molar volume of a solid mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.", "language": "python", "parameters": "(self, T, P, zs, ws, method)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_5", "==", "SIMPLE", ":", "arg_6", "=", "[", "i", "(", "arg_1", ",", "arg_2", ")", "for", "i", "in", "arg_0", ".", "VolumeSolids", "]", "return", "mixing_simple", "(", "arg_3", ",", "arg_6", ")", "else", ":", "raise", "Exception", "(", "'Method not valid'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        r'''Method to Func molar volume of a solid mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to Func the property, [K]\n        P : float\n            Pressure at which to Func the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the solid mixture at the given conditions,\n            [m^3/mol]\n        '''\n        if arg_5 == SIMPLE:\n            arg_6 = [i(arg_1, arg_2) for i in arg_0.VolumeSolids]\n            return mixing_simple(arg_3, arg_6)\n        else:\n            raise Exception('Method not valid')", "path": "thermo/volume.py", "identifier": "VolumeSolidMixture.calculate", "docstring": "r'''Method to calculate molar volume of a solid mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate the property, [K]\n        P : float\n            Pressure at which to calculate the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the solid mixture at the given conditions,\n            [m^3/mol]", "docstring_tokens": ["r", "Method", "to", "calculate", "molar", "volume", "of", "a", "solid", "mixture", "at", "temperature", "T", "pressure", "P", "mole", "fractions", "zs", "and", "weight", "fractions", "ws", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 252524}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/psd.py#L627-L715", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "a simple plotting routine to plot the PSD versus frequency.", "language": "python", "parameters": "(self, filename=None, norm=False, ylim=None,\n              sides=None,  **kargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "import", "pylab", "from", "pylab", "import", "arg_3", "as", "plt_ylim", "arg_6", "=", "arg_0", ".", "psd", "if", "arg_4", "is", "not", "None", ":", "if", "arg_4", "not", "in", "arg_0", ".", "_sides_choices", ":", "raise", "errors", ".", "SpectrumChoiceError", "(", "arg_4", ",", "arg_0", ".", "_sides_choices", ")", "if", "arg_4", "is", "None", "or", "arg_4", "==", "arg_0", ".", "sides", ":", "arg_7", "=", "arg_0", ".", "frequencies", "(", ")", "arg_8", "=", "arg_0", ".", "psd", "arg_4", "=", "arg_0", ".", "sides", "elif", "arg_4", "is", "not", "None", ":", "if", "arg_0", ".", "datatype", "==", "'complex'", ":", "if", "arg_4", "==", "'onesided'", ":", "raise", "ValueError", "(", "\"sides cannot be one-sided with complex data\"", ")", "logging", ".", "debug", "(", "\"sides is different from the one provided. Converting PSD\"", ")", "arg_7", "=", "arg_0", ".", "frequencies", "(", "arg_4", "=", "arg_4", ")", "arg_8", "=", "arg_0", ".", "get_converted_psd", "(", "arg_4", ")", "if", "len", "(", "arg_8", ")", "!=", "len", "(", "arg_7", ")", ":", "raise", "ValueError", "(", "\"PSD length is %s and freq length is %s\"", "%", "(", "len", "(", "arg_8", ")", ",", "len", "(", "arg_7", ")", ")", ")", "if", "'ax'", "in", "list", "(", "arg_5", ".", "keys", "(", ")", ")", ":", "arg_9", "=", "pylab", ".", "gca", "(", ")", "pylab", ".", "sca", "(", "arg_5", "[", "'ax'", "]", ")", "arg_10", "=", "True", "del", "arg_5", "[", "'ax'", "]", "else", ":", "arg_10", "=", "False", "if", "arg_2", ":", "pylab", ".", "Func", "(", "arg_7", ",", "10", "*", "stools", ".", "log10", "(", "arg_8", "/", "max", "(", "arg_8", ")", ")", ",", "**", "arg_5", ")", "else", ":", "pylab", ".", "Func", "(", "arg_7", ",", "10", "*", "stools", ".", "log10", "(", "arg_8", ")", ",", "**", "arg_5", ")", "pylab", ".", "xlabel", "(", "'Frequency'", ")", "pylab", ".", "ylabel", "(", "'Power (dB)'", ")", "pylab", ".", "grid", "(", "True", ")", "if", "arg_3", ":", "plt_ylim", "(", "arg_3", ")", "if", "arg_4", "==", "'onesided'", ":", "pylab", ".", "xlim", "(", "0", ",", "arg_0", ".", "sampling", "/", "2.", ")", "elif", "arg_4", "==", "'twosided'", ":", "pylab", ".", "xlim", "(", "0", ",", "arg_0", ".", "sampling", ")", "elif", "arg_4", "==", "'centerdc'", ":", "pylab", ".", "xlim", "(", "-", "arg_0", ".", "sampling", "/", "2.", ",", "arg_0", ".", "sampling", "/", "2.", ")", "if", "arg_1", ":", "pylab", ".", "savefig", "(", "arg_1", ")", "if", "arg_10", ":", "pylab", ".", "sca", "(", "arg_9", ")", "del", "arg_8", ",", "arg_7"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=None,\n              arg_4=None,  **arg_5):\n        \"\"\"a simple Functing routine to Func the PSD versus frequency.\n\n        :param str filename: save the figure into a file\n        :param norm: False by default. If True, the PSD is normalised.\n        :param ylim: readjust the y range .\n        :param sides: if not provided, :attr:`sides` is used. See :attr:`sides`\n            for details.\n        :param kargs: any optional argument accepted by :func:`pylab.Func`.\n\n        .. Func::\n            :width: 80%\n            :include-source:\n\n            from spectrum import *\n            p = Periodogram(marple_data)\n            p.Func(norm=True, marker='o')\n\n        \"\"\"\n        import pylab\n        from pylab import arg_3 as plt_ylim\n        #First, check that psd attribute is up-to-date\n        # just to get the PSD to be recomputed if needed\n        arg_6 = arg_0.psd\n\n\n        # check that the input sides parameter is correct if provided\n        if arg_4 is not None:\n            if arg_4 not in arg_0._sides_choices:\n                raise errors.SpectrumChoiceError(arg_4, arg_0._sides_choices)\n\n        # if sides is provided but identical to the current psd, nothing to do.\n        # if sides not provided, let us use self.sides\n        if arg_4 is None or arg_4 == arg_0.sides:\n            arg_7 = arg_0.frequencies()\n            arg_8 = arg_0.psd\n            arg_4 = arg_0.sides\n        elif arg_4 is not None:\n            # if sides argument is different from the attribute, we need to\n            # create a new PSD/Freq ; indeed we do not want to change the\n            # attribute itself\n\n            # if data is complex, one-sided is wrong in any case.\n            if arg_0.datatype == 'complex':\n                if arg_4 == 'onesided':\n                    raise ValueError(\"sides cannot be one-sided with complex data\")\n\n            logging.debug(\"sides is different from the one provided. Converting PSD\")\n            arg_7 = arg_0.frequencies(arg_4=arg_4)\n            arg_8 = arg_0.get_converted_psd(arg_4)\n\n        if len(arg_8) != len(arg_7):\n            raise ValueError(\"PSD length is %s and freq length is %s\" % (len(arg_8), len(arg_7)))\n\n        if 'ax' in list(arg_5.keys()):\n            arg_9 = pylab.gca()\n            pylab.sca(arg_5['ax'])\n            arg_10 = True\n            del arg_5['ax']\n        else:\n            arg_10 = False\n\n        if arg_2:\n            pylab.Func(arg_7, 10 * stools.log10(arg_8/max(arg_8)),  **arg_5)\n        else:\n            pylab.Func(arg_7, 10 * stools.log10(arg_8),**arg_5)\n\n        pylab.xlabel('Frequency')\n        pylab.ylabel('Power (dB)')\n        pylab.grid(True)\n\n        if arg_3:\n            plt_ylim(arg_3)\n\n        if arg_4 == 'onesided':\n            pylab.xlim(0, arg_0.sampling/2.)\n        elif arg_4 == 'twosided':\n            pylab.xlim(0, arg_0.sampling)\n        elif arg_4 == 'centerdc':\n            pylab.xlim(-arg_0.sampling/2., arg_0.sampling/2.)\n\n        if arg_1:\n            pylab.savefig(arg_1)\n\n        if arg_10:\n            pylab.sca(arg_9)\n\n        del arg_8, arg_7", "path": "src/spectrum/psd.py", "identifier": "Spectrum.plot", "docstring": "a simple plotting routine to plot the PSD versus frequency.\n\n        :param str filename: save the figure into a file\n        :param norm: False by default. If True, the PSD is normalised.\n        :param ylim: readjust the y range .\n        :param sides: if not provided, :attr:`sides` is used. See :attr:`sides`\n            for details.\n        :param kargs: any optional argument accepted by :func:`pylab.plot`.\n\n        .. plot::\n            :width: 80%\n            :include-source:\n\n            from spectrum import *\n            p = Periodogram(marple_data)\n            p.plot(norm=True, marker='o')", "docstring_tokens": ["a", "simple", "plotting", "routine", "to", "plot", "the", "PSD", "versus", "frequency", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 252525}
{"url": "https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L115-L121", "sha": "7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d", "docstring_summary": "Checks that the year is within 50 years from now.", "language": "python", "parameters": "(year, month, error, error_msg)", "return_statement": "return year, month, error", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", "not", "in", "xrange", "(", "(", "now", ".", "year", "-", "50", ")", ",", "(", "now", ".", "year", "+", "51", ")", ")", ":", "arg_0", "=", "now", ".", "year", "arg_1", "=", "now", ".", "month", "arg_2", "=", "arg_3", "return", "arg_0", ",", "arg_1", ",", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Checks that the year is within 50 years from now.\"\"\"\n    if arg_0 not in xrange((now.year - 50), (now.year + 51)):\n        arg_0 = now.year\n        arg_1 = now.month\n        arg_2 = arg_3\n    return arg_0, arg_1, arg_2", "path": "happenings/utils/common.py", "identifier": "_check_year", "docstring": "Checks that the year is within 50 years from now.", "docstring_tokens": ["Checks", "that", "the", "year", "is", "within", "50", "years", "from", "now", "."], "nwo": "wreckage/django-happenings", "score": 0.41124813484918504, "idx": 252526}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L197-L229", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "get the ip_address of an inserted instance. Will try three times with\n       delay to give the instance time to start up.", "language": "python", "parameters": "(self, name, retries=3, delay=3)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "3", ",", "arg_3", "=", "3", ")", ":", "for", "arg_4", "in", "range", "(", "arg_2", ")", ":", "arg_5", "=", "arg_0", ".", "_get_instances", "(", ")", "for", "arg_6", "in", "arg_5", "[", "'items'", "]", ":", "if", "arg_6", "[", "'name'", "]", "==", "arg_1", ":", "for", "arg_7", "in", "arg_6", "[", "'networkInterfaces'", "]", ":", "if", "arg_7", "[", "'name'", "]", "==", "'nic0'", ":", "for", "arg_8", "in", "arg_7", "[", "'accessConfigs'", "]", ":", "if", "arg_8", "[", "'name'", "]", "==", "'External NAT'", ":", "if", "'natIP'", "in", "arg_8", ":", "return", "arg_8", "[", "'natIP'", "]", "sleep", "(", "arg_3", ")", "bot", ".", "warning", "(", "'Did not find IP address, check Cloud Console!'", ")"], "function": "def Func(arg_0, arg_1, arg_2=3, arg_3=3):\n    '''get the ip_address of an inserted instance. Will try three times with\n       delay to give the instance time to start up.\n\n       Parameters\n       ==========\n       name: the name of the instance to get the ip address for.\n       retries: the number of retries before giving up\n       delay: the delay between retry\n\n       Note from @vsoch: this function is pretty nasty.\n\n    '''\n    for arg_4 in range(arg_2):\n\n        # Retrieve list of instances\n        arg_5 = arg_0._get_instances()\n\n        for arg_6 in arg_5['items']:\n            if arg_6['name'] == arg_1:\n\n                # Iterate through network interfaces\n                for arg_7 in arg_6['networkInterfaces']:\n                    if arg_7['name'] == 'nic0':\n\n                        # Access configurations\n                        for arg_8 in arg_7['accessConfigs']:\n                            if arg_8['name'] == 'External NAT':\n                                if 'natIP' in arg_8:\n                                    return arg_8['natIP']\n\n        sleep(arg_3) \n    bot.warning('Did not find IP address, check Cloud Console!')", "path": "sregistry/main/google_storage/build.py", "identifier": "get_ipaddress", "docstring": "get the ip_address of an inserted instance. Will try three times with\n       delay to give the instance time to start up.\n\n       Parameters\n       ==========\n       name: the name of the instance to get the ip address for.\n       retries: the number of retries before giving up\n       delay: the delay between retry\n\n       Note from @vsoch: this function is pretty nasty.", "docstring_tokens": ["get", "the", "ip_address", "of", "an", "inserted", "instance", ".", "Will", "try", "three", "times", "with", "delay", "to", "give", "the", "instance", "time", "to", "start", "up", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 252527}
{"url": "https://github.com/hiposfer/o2g/blob/1165ba75a5eb64b3091e9b71ebd589507ae1ebf3/o2g/osm/builders/route_builder.py#L54-L59", "sha": "1165ba75a5eb64b3091e9b71ebd589507ae1ebf3", "docstring_summary": "Construct an id for agency using its tags.", "language": "python", "parameters": "(relation)", "return_statement": "return -1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "tags", ".", "get", "(", "'operator'", ")", "if", "arg_1", ":", "return", "int", "(", "hashlib", ".", "sha256", "(", "arg_1", ".", "encode", "(", "'utf-8'", ")", ")", ".", "hexdigest", "(", ")", ",", "16", ")", "%", "10", "**", "8", "return", "-", "1"], "function": "def Func(arg_0):\n    \"\"\"Construct an id for agency using its tags.\"\"\"\n    arg_1 = arg_0.tags.get('operator')\n    if arg_1:\n        return int(hashlib.sha256(arg_1.encode('utf-8')).hexdigest(), 16) % 10**8\n    return -1", "path": "o2g/osm/builders/route_builder.py", "identifier": "get_agency_id", "docstring": "Construct an id for agency using its tags.", "docstring_tokens": ["Construct", "an", "id", "for", "agency", "using", "its", "tags", "."], "nwo": "hiposfer/o2g", "score": 0.3752106333265808, "idx": 252528}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/style.py#L223-L250", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Visualization of a default node.", "language": "python", "parameters": "(s, node, alpha=1.0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ",", "arg_2", "=", "1.0", ")", ":", "if", "arg_0", ".", "depth", ":", "try", ":", "colors", ".", "shadow", "(", "dx", "=", "5", ",", "dy", "=", "5", ",", "blur", "=", "10", ",", "arg_2", "=", "0.5", "*", "arg_2", ")", "except", ":", "pass", "arg_0", ".", "_ctx", ".", "nofill", "(", ")", "arg_0", ".", "_ctx", ".", "nostroke", "(", ")", "if", "arg_0", ".", "fill", ":", "arg_0", ".", "_ctx", ".", "fill", "(", "arg_0", ".", "fill", ".", "r", ",", "arg_0", ".", "fill", ".", "g", ",", "arg_0", ".", "fill", ".", "b", ",", "arg_0", ".", "fill", ".", "a", "*", "arg_2", ")", "if", "arg_0", ".", "stroke", ":", "arg_0", ".", "_ctx", ".", "strokewidth", "(", "arg_0", ".", "strokewidth", ")", "arg_0", ".", "_ctx", ".", "stroke", "(", "arg_0", ".", "stroke", ".", "r", ",", "arg_0", ".", "stroke", ".", "g", ",", "arg_0", ".", "stroke", ".", "b", ",", "arg_0", ".", "stroke", ".", "a", "*", "arg_2", "*", "3", ")", "arg_3", "=", "Func", ".", "r", "arg_0", ".", "_ctx", ".", "oval", "(", "Func", ".", "x", "-", "arg_3", ",", "Func", ".", "y", "-", "arg_3", ",", "arg_3", "*", "2", ",", "arg_3", "*", "2", ")"], "function": "def Func(arg_0, Func, arg_2=1.0):\n\n    \"\"\" Visualization of a default node.\n    \"\"\"\n\n    if arg_0.depth:\n        try: colors.shadow(dx=5, dy=5, blur=10, arg_2=0.5*arg_2)\n        except: pass\n    \n    arg_0._ctx.nofill()\n    arg_0._ctx.nostroke()\n    if arg_0.fill:\n        arg_0._ctx.fill(\n            arg_0.fill.r, \n            arg_0.fill.g, \n            arg_0.fill.b, \n            arg_0.fill.a * arg_2\n        )\n    if arg_0.stroke: \n        arg_0._ctx.strokewidth(arg_0.strokewidth)\n        arg_0._ctx.stroke(\n            arg_0.stroke.r, \n            arg_0.stroke.g, \n            arg_0.stroke.b, \n            arg_0.stroke.a * arg_2 * 3\n        )\n    arg_3 = Func.r\n    arg_0._ctx.oval(Func.x-arg_3, Func.y-arg_3, arg_3*2, arg_3*2)", "path": "lib/graph/style.py", "identifier": "node", "docstring": "Visualization of a default node.", "docstring_tokens": ["Visualization", "of", "a", "default", "node", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252529}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_utils.py#L354-L372", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Validate a python object against an OPF json schema file", "language": "python", "parameters": "(value, opfJsonSchemaFilename)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"jsonschema\"", ",", "arg_1", ")", "jsonhelpers", ".", "validate", "(", "arg_0", ",", "schemaPath", "=", "arg_2", ")", "return"], "function": "def Func(arg_0, arg_1):\n  \"\"\"\n  Validate a python object against an OPF json schema file\n\n  :param value: target python object to validate (typically a dictionary)\n  :param opfJsonSchemaFilename: (string) OPF json schema filename containing the\n         json schema object. (e.g., opfTaskControlSchema.json)\n  :raises: jsonhelpers.ValidationError when value fails json validation\n  \"\"\"\n\n  # Create a path by joining the filename with our local json schema root\n  arg_2 = os.path.join(os.path.dirname(__file__),\n                                \"jsonschema\",\n                                arg_1)\n\n  # Validate\n  jsonhelpers.validate(arg_0, schemaPath=arg_2)\n\n  return", "path": "src/nupic/frameworks/opf/opf_utils.py", "identifier": "validateOpfJsonValue", "docstring": "Validate a python object against an OPF json schema file\n\n  :param value: target python object to validate (typically a dictionary)\n  :param opfJsonSchemaFilename: (string) OPF json schema filename containing the\n         json schema object. (e.g., opfTaskControlSchema.json)\n  :raises: jsonhelpers.ValidationError when value fails json validation", "docstring_tokens": ["Validate", "a", "python", "object", "against", "an", "OPF", "json", "schema", "file"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252530}
{"url": "https://github.com/voidpp/vcp/blob/5538cdb7b43029db9aac9edad823cd87afd89ab5/vcp/commands.py#L73-L89", "sha": "5538cdb7b43029db9aac9edad823cd87afd89ab5", "docstring_summary": "REFACTOR status to project init result ENUM\n        jelenleg ha a project init False, akkor torlunk minden adatot a projectrol\n        de van egy atmenet, mikor csak a lang init nem sikerult\n        erre valo jelenleg a status. ez rossz", "language": "python", "parameters": "(self, project, path, force, init_languages)", "return_statement": "return failed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "{", "}", "arg_1", ".", "init", "(", "arg_2", ",", "arg_5", ",", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "[", "]", "for", "arg_7", ",", "arg_8", "in", "list", "(", "arg_5", ".", "items", "(", ")", ")", ":", "if", "arg_8", "is", "False", "and", "arg_7", "not", "in", "arg_6", ":", "arg_6", ".", "append", "(", "arg_7", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        arg_5 = {}\n        \"\"\"\n        REFACTOR status to project init result ENUM\n        jelenleg ha a project init False, akkor torlunk minden adatot a projectrol\n        de van egy atmenet, mikor csak a lang init nem sikerult\n        erre valo jelenleg a status. ez rossz\n        \"\"\"\n\n        arg_1.init(arg_2, arg_5, arg_3, arg_4 = arg_4)\n\n        arg_6 = []\n        for arg_7, arg_8 in list(arg_5.items()):\n            if arg_8 is False and arg_7 not in arg_6:\n                arg_6.append(arg_7)\n\n        return arg_6", "path": "vcp/commands.py", "identifier": "ProjectCommand.__init", "docstring": "REFACTOR status to project init result ENUM\n        jelenleg ha a project init False, akkor torlunk minden adatot a projectrol\n        de van egy atmenet, mikor csak a lang init nem sikerult\n        erre valo jelenleg a status. ez rossz", "docstring_tokens": ["REFACTOR", "status", "to", "project", "init", "result", "ENUM", "jelenleg", "ha", "a", "project", "init", "False", "akkor", "torlunk", "minden", "adatot", "a", "projectrol", "de", "van", "egy", "atmenet", "mikor", "csak", "a", "lang", "init", "nem", "sikerult", "erre", "valo", "jelenleg", "a", "status", ".", "ez", "rossz"], "nwo": "voidpp/vcp", "score": 0.34668479461464624, "idx": 252531}
{"url": "https://github.com/rstoneback/pysatCDF/blob/479839f719dbece8e52d6bf6a466cb9506db6719/pysatCDF/_cdf.py#L487-L521", "sha": "479839f719dbece8e52d6bf6a466cb9506db6719", "docstring_summary": "Calls Fortran function that reads attribute data.\n        \n        data_offset translates unsigned into signed.\n        If number read in is negative, offset added.", "language": "python", "parameters": "(self, names, data_types, num_elems,\n                                   entry_nums, attr_nums, var_names,\n                                   input_type_code, func, data_offset=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "None", ")", ":", "arg_10", ",", "=", "np", ".", "where", "(", "arg_2", "==", "arg_7", ")", "if", "len", "(", "arg_10", ")", ">", "0", ":", "arg_11", "=", "arg_3", "[", "arg_10", "]", ".", "max", "(", ")", "arg_12", "=", "arg_3", "[", "arg_10", "]", "arg_13", "=", "np", ".", "array", "(", "arg_1", ")", "[", "arg_10", "]", "arg_14", "=", "np", ".", "array", "(", "arg_6", ")", "[", "arg_10", "]", "arg_15", "=", "arg_4", "[", "arg_10", "]", "arg_16", "=", "arg_5", "[", "arg_10", "]", "arg_17", ",", "arg_18", "=", "arg_8", "(", "arg_0", ".", "fname", ",", "arg_16", ",", "arg_15", ",", "len", "(", "arg_16", ")", ",", "arg_11", ",", "len", "(", "arg_0", ".", "fname", ")", ")", "if", "(", "arg_17", "==", "0", ")", ".", "all", "(", ")", ":", "if", "arg_9", "is", "not", "None", ":", "arg_18", "=", "arg_18", ".", "astype", "(", "int", ")", "arg_10", ",", "arg_19", ",", "=", "np", ".", "where", "(", "arg_18", "<", "0", ")", "arg_18", "[", "arg_10", ",", "arg_19", "]", "+=", "arg_9", "arg_0", ".", "_process_return_multi_z_attr", "(", "arg_18", ",", "arg_13", ",", "arg_14", ",", "arg_12", ")", "else", ":", "arg_10", ",", "=", "np", ".", "where", "(", "arg_17", "!=", "0", ")", "raise", "IOError", "(", "fortran_cdf", ".", "statusreporter", "(", "arg_17", "[", "arg_10", "]", "[", "0", "]", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                   arg_4, arg_5, arg_6,\n                                   arg_7, arg_8, arg_9=None):\n        \"\"\"Calls Fortran function that reads attribute data.\n        \n        data_offset translates unsigned into signed.\n        If number read in is negative, offset added.\n        \"\"\"\n        # isolate input type code variables\n        arg_10, = np.where(arg_2 == arg_7)\n\n        if len(arg_10) > 0:\n            # maximimum array dimension\n            arg_11 = arg_3[arg_10].max()\n            arg_12 = arg_3[arg_10]\n            arg_13 = np.array(arg_1)[arg_10]\n            arg_14 = np.array(arg_6)[arg_10]\n            # zVariable numbers, 'entry' number\n            arg_15 = arg_4[arg_10]\n            # attribute number\n            arg_16 = arg_5[arg_10]\n            arg_17, arg_18 = arg_8(arg_0.fname, arg_16, arg_15,\n                                len(arg_16), arg_11, len(arg_0.fname))\n            if (arg_17 == 0).all():\n                if arg_9 is not None:\n                    arg_18 = arg_18.astype(int)\n                    arg_10, arg_19, = np.where(arg_18 < 0)\n                    arg_18[arg_10, arg_19] += arg_9\n                arg_0._process_return_multi_z_attr(arg_18, arg_13,\n                                                  arg_14, arg_12)\n            else:\n                # raise ValueError('CDF Error code :', status)\n                arg_10, = np.where(arg_17 != 0)\n                # raise first error\n                raise IOError(fortran_cdf.statusreporter(arg_17[arg_10][0]))", "path": "pysatCDF/_cdf.py", "identifier": "CDF._call_multi_fortran_z_attr", "docstring": "Calls Fortran function that reads attribute data.\n        \n        data_offset translates unsigned into signed.\n        If number read in is negative, offset added.", "docstring_tokens": ["Calls", "Fortran", "function", "that", "reads", "attribute", "data", ".", "data_offset", "translates", "unsigned", "into", "signed", ".", "If", "number", "read", "in", "is", "negative", "offset", "added", "."], "nwo": "rstoneback/pysatCDF", "score": 0.28632362443557285, "idx": 252532}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/diagnose.py#L122-L150", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Decorator to run some code in a bot instance.", "language": "python", "parameters": "(**shoebot_kwargs)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "def", "run", "(", ")", ":", "from", "shoebot", "import", "ShoebotInstallError", "print", "(", "\"    Shoebot - %s:\"", "%", "arg_1", ".", "__name__", ".", "replace", "(", "\"_\"", ",", "\" \"", ")", ")", "try", ":", "import", "shoebot", "arg_2", "=", "\"/tmp/shoebot-%s.png\"", "%", "arg_1", ".", "__name__", "arg_3", "=", "shoebot", ".", "create_bot", "(", "arg_2", "=", "arg_2", ")", "arg_1", "(", "arg_3", ")", "arg_3", ".", "finish", "(", ")", "print", "(", "'        [passed] : %s'", "%", "arg_2", ")", "print", "(", "''", ")", "except", "ShoebotInstallError", "as", "e", ":", "print", "(", "'        [failed]'", ",", "e", ".", "args", "[", "0", "]", ")", "print", "(", "''", ")", "except", "Exception", ":", "print", "(", "'        [failed] - traceback:'", ")", "for", "arg_4", "in", "traceback", ".", "format_exc", "(", ")", ".", "splitlines", "(", ")", ":", "print", "(", "'    %s'", "%", "arg_4", ")", "print", "(", "''", ")", "return", "run", "return", "decorator"], "function": "def Func(**arg_0):\n    \"\"\"\n    Decorator to run some code in a bot instance.\n    \"\"\"\n\n    def decorator(arg_1):\n        def run():\n            from shoebot import ShoebotInstallError  # https://github.com/shoebot/shoebot/issues/206\n            print(\"    Shoebot - %s:\" % arg_1.__name__.replace(\"_\", \" \"))\n            try:\n                import shoebot\n                arg_2 = \"/tmp/shoebot-%s.png\" % arg_1.__name__\n                arg_3 = shoebot.create_bot(arg_2=arg_2)\n                arg_1(arg_3)\n                arg_3.finish()\n                print('        [passed] : %s' % arg_2)\n                print('')\n            except ShoebotInstallError as e:\n                print('        [failed]', e.args[0])\n                print('')\n            except Exception:\n                print('        [failed] - traceback:')\n                for arg_4 in traceback.format_exc().splitlines():\n                    print('    %s' % arg_4)\n                print('')\n\n        return run\n\n    return decorator", "path": "shoebot/diagnose.py", "identifier": "shoebot_example", "docstring": "Decorator to run some code in a bot instance.", "docstring_tokens": ["Decorator", "to", "run", "some", "code", "in", "a", "bot", "instance", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252533}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/resource/manifest.py#L47-L76", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Add one or more files or URLs to the manifest.\n        If files contains a glob, it is expanded.", "language": "python", "parameters": "(self, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "def", "_is_url", "(", "arg_2", ")", ":", "arg_3", "=", "urlparse", "(", "arg_2", ")", "return", "bool", "(", "arg_3", ".", "scheme", ")", "for", "arg_2", "in", "arg_1", ":", "arg_2", "=", "os", ".", "path", ".", "expanduser", "(", "arg_2", ")", "if", "_is_url", "(", "arg_2", ")", ":", "arg_0", ".", "Func_url", "(", "arg_2", ")", "elif", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "arg_0", ".", "Func_file", "(", "arg_2", ")", "elif", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "for", "arg_4", "in", "os", ".", "listdir", "(", "arg_2", ")", ":", "arg_0", ".", "Func_file", "(", "arg_4", ")", "elif", "glob", ".", "glob", "(", "arg_2", ")", ":", "for", "arg_4", "in", "glob", ".", "glob", "(", "arg_2", ")", ":", "arg_0", ".", "Func_file", "(", "arg_4", ")", "else", ":", "raise", "ValueError", "(", "'Path: \"{0}\" is not a valid format or does not exist. '", "'Manifest paths must be files, directories, or URLs.'", ".", "format", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Add one or more files or URLs to the manifest.\n        If files contains a glob, it is expanded.\n\n        All files are uploaded to SolveBio. The Upload\n        object is used to fill the manifest.\n        \"\"\"\n        def _is_url(arg_2):\n            arg_3 = urlparse(arg_2)\n            return bool(arg_3.scheme)\n\n        for arg_2 in arg_1:\n            arg_2 = os.path.expanduser(arg_2)\n            if _is_url(arg_2):\n                arg_0.Func_url(arg_2)\n            elif os.path.isfile(arg_2):\n                arg_0.Func_file(arg_2)\n            elif os.path.isdir(arg_2):\n                for arg_4 in os.listdir(arg_2):\n                    arg_0.Func_file(arg_4)\n            elif glob.glob(arg_2):\n                for arg_4 in glob.glob(arg_2):\n                    arg_0.Func_file(arg_4)\n            else:\n                raise ValueError(\n                    'Path: \"{0}\" is not a valid format or does not exist. '\n                    'Manifest paths must be files, directories, or URLs.'\n                    .format(arg_2)\n                )", "path": "solvebio/resource/manifest.py", "identifier": "Manifest.add", "docstring": "Add one or more files or URLs to the manifest.\n        If files contains a glob, it is expanded.\n\n        All files are uploaded to SolveBio. The Upload\n        object is used to fill the manifest.", "docstring_tokens": ["Add", "one", "or", "more", "files", "or", "URLs", "to", "the", "manifest", ".", "If", "files", "contains", "a", "glob", "it", "is", "expanded", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 252534}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L140-L163", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Help calculate network-wide concordance", "language": "python", "parameters": "(graph: BELGraph,\n                                 key: str,\n                                 cutoff: Optional[float] = None,\n                                 )", "return_statement": "return (\n        scores[Concordance.correct],\n        scores[Concordance.incorrect],\n        scores[Concordance.ambiguous],\n        scores[Concordance.unassigned],\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "[", "arg_6", "]", "=", "None", ",", ")", "->", "Tuple", "[", "int", ",", "int", ",", "int", ",", "int", "]", ":", "arg_7", "=", "defaultdict", "(", "int", ")", "for", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "in", "arg_0", ".", "edges", "(", "keys", "=", "True", ",", "data", "=", "True", ")", ":", "arg_12", "=", "edge_concords", "(", "arg_0", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_2", ",", "arg_4", "=", "arg_4", ")", "arg_7", "[", "arg_12", "]", "+=", "1", "return", "(", "arg_7", "[", "Concordance", ".", "correct", "]", ",", "arg_7", "[", "Concordance", ".", "incorrect", "]", ",", "arg_7", "[", "Concordance", ".", "ambiguous", "]", ",", "arg_7", "[", "Concordance", ".", "unassigned", "]", ",", ")"], "function": "def Func(arg_0: arg_1,\n                                 arg_2: arg_3,\n                                 arg_4: arg_5[arg_6] = None,\n                                 ) -> Tuple[int, int, int, int]:\n    \"\"\"Help calculate network-wide concordance\n\n    Assumes data already annotated with given key\n\n    :param graph: A BEL graph\n    :param key: The node data dictionary key storing the logFC\n    :param cutoff: The optional logFC cutoff for significance\n    \"\"\"\n    arg_7 = defaultdict(int)\n\n    for arg_8, arg_9, arg_10, arg_11 in arg_0.edges(keys=True, data=True):\n        arg_12 = edge_concords(arg_0, arg_8, arg_9, arg_10, arg_11, arg_2, arg_4=arg_4)\n        arg_7[arg_12] += 1\n\n    return (\n        arg_7[Concordance.correct],\n        arg_7[Concordance.incorrect],\n        arg_7[Concordance.ambiguous],\n        arg_7[Concordance.unassigned],\n    )", "path": "src/pybel_tools/analysis/concordance.py", "identifier": "calculate_concordance_helper", "docstring": "Help calculate network-wide concordance\n\n    Assumes data already annotated with given key\n\n    :param graph: A BEL graph\n    :param key: The node data dictionary key storing the logFC\n    :param cutoff: The optional logFC cutoff for significance", "docstring_tokens": ["Help", "calculate", "network", "-", "wide", "concordance"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 252535}
{"url": "https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/leverage.py#L151-L170", "sha": "cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3", "docstring_summary": "Predict inside or outside AD for X.", "language": "python", "parameters": "(self, X)", "return_statement": "return self.__find_leverages(X, self.inverse_influence_matrix) <= self.threshold_value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check_is_fitted", "(", "arg_0", ",", "[", "'inverse_influence_matrix'", "]", ")", "arg_1", "=", "check_array", "(", "arg_1", ")", "return", "arg_0", ".", "__find_leverages", "(", "arg_1", ",", "arg_0", ".", "inverse_influence_matrix", ")", "<=", "arg_0", ".", "threshold_value"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Predict inside or outside AD for X.\n\n        Parameters\n        ----------\n        X : array-like or sparse matrix, shape (n_samples, n_features)\n            The input samples. Internally, it will be converted to\n            ``dtype=np.float32`` and if a sparse matrix is provided\n            to a sparse ``csr_matrix``.\n\n        Returns\n        -------\n        ad : array of shape = [n_samples]\n            Array contains True (reaction in AD) and False (reaction residing outside AD).\n        \"\"\"\n        # Check is fit had been called\n        check_is_fitted(arg_0, ['inverse_influence_matrix'])\n        # Check that X have correct shape\n        arg_1 = check_array(arg_1)\n        return arg_0.__find_leverages(arg_1, arg_0.inverse_influence_matrix) <= arg_0.threshold_value", "path": "CIMtools/applicability_domain/leverage.py", "identifier": "Leverage.predict", "docstring": "Predict inside or outside AD for X.\n\n        Parameters\n        ----------\n        X : array-like or sparse matrix, shape (n_samples, n_features)\n            The input samples. Internally, it will be converted to\n            ``dtype=np.float32`` and if a sparse matrix is provided\n            to a sparse ``csr_matrix``.\n\n        Returns\n        -------\n        ad : array of shape = [n_samples]\n            Array contains True (reaction in AD) and False (reaction residing outside AD).", "docstring_tokens": ["Predict", "inside", "or", "outside", "AD", "for", "X", "."], "nwo": "stsouko/CIMtools", "score": 0.37700202640577024, "idx": 252536}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/__init__.py#L217-L225", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Connect to a SAMP Hub and wait for a single table load event, disconnect, download the table and return the DataFrame.", "language": "python", "parameters": "(username=None, password=None)", "return_statement": "return from_astropy_table(t.to_table())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "print", "(", "\"Waiting for SAMP message...\"", ")", "import", "vaex", ".", "samp", "arg_2", "=", "vaex", ".", "samp", ".", "single_table", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "from_astropy_table", "(", "arg_2", ".", "to_table", "(", ")", ")"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"Connect to a SAMP Hub and wait for a single table load event, disconnect, download the table and return the DataFrame.\n\n    Useful if you want to send a single table from say TOPCAT to vaex in a python console or notebook.\n    \"\"\"\n    print(\"Waiting for SAMP message...\")\n    import vaex.samp\n    arg_2 = vaex.samp.single_table(arg_0=arg_0, arg_1=arg_1)\n    return from_astropy_table(arg_2.to_table())", "path": "packages/vaex-core/vaex/__init__.py", "identifier": "from_samp", "docstring": "Connect to a SAMP Hub and wait for a single table load event, disconnect, download the table and return the DataFrame.\n\n    Useful if you want to send a single table from say TOPCAT to vaex in a python console or notebook.", "docstring_tokens": ["Connect", "to", "a", "SAMP", "Hub", "and", "wait", "for", "a", "single", "table", "load", "event", "disconnect", "download", "the", "table", "and", "return", "the", "DataFrame", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 252537}
{"url": "https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/handlers.py#L230-L242", "sha": "7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d", "docstring_summary": "Created to take some of the load off of _handle_weekly_repeat_out", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "num", "=", "14", "arg_2", "=", "arg_0", ".", "repeat_biweekly", "(", ")", "if", "arg_2", ":", "if", "arg_0", ".", "event", ".", "is_chunk", "(", ")", "and", "min", "(", "arg_2", ")", "not", "in", "xrange", "(", "1", ",", "8", ")", ":", "arg_2", "=", "_chunk_fill_out_first_week", "(", "arg_0", ".", "year", ",", "arg_0", ".", "month", ",", "arg_2", ",", "arg_0", ".", "event", ",", "diff", "=", "arg_0", ".", "event", ".", "start_end_diff", ",", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "for", "arg_5", "in", "arg_4", ":", "arg_0", ".", "count", "[", "arg_3", "]", ".", "append", "(", "arg_5", ")"], "function": "def Func(arg_0):\n        \"\"\"Created to take some of the load off of _handle_weekly_repeat_out\"\"\"\n        arg_0.num = 14\n        arg_2 = arg_0.repeat_biweekly()\n        if arg_2:\n            if arg_0.event.is_chunk() and min(arg_2) not in xrange(1, 8):\n                arg_2 = _chunk_fill_out_first_week(\n                    arg_0.year, arg_0.month, arg_2, arg_0.event,\n                    diff=arg_0.event.start_end_diff,\n                )\n            for arg_3, arg_4 in arg_2.items():\n                for arg_5 in arg_4:\n                    arg_0.count[arg_3].append(arg_5)", "path": "happenings/utils/handlers.py", "identifier": "WeeklyRepeater._biweekly_helper", "docstring": "Created to take some of the load off of _handle_weekly_repeat_out", "docstring_tokens": ["Created", "to", "take", "some", "of", "the", "load", "off", "of", "_handle_weekly_repeat_out"], "nwo": "wreckage/django-happenings", "score": 0.41124813484918504, "idx": 252538}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L72-L81", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Do a reverse look up for an item containing the requested data", "language": "python", "parameters": "(self, start, py_data)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_wx_data_map", "[", "arg_2", "]", "if", "wx", ".", "VERSION", "<", "(", "3", ",", "0", ",", "0", ")", "or", "'classic'", "in", "wx", ".", "version", "(", ")", ":", "arg_4", "=", "arg_0", ".", "FindItemData", "(", "arg_1", ",", "arg_3", ")", "else", ":", "arg_4", "=", "arg_0", ".", "FindItem", "(", "arg_1", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\r\n        \"Do a reverse look up for an item containing the requested data\"\r\n        # first, look at our internal dict:\r\n        arg_3 = arg_0._wx_data_map[arg_2]\r\n        # do the real search at the wx control:\r\n        if wx.VERSION < (3, 0, 0) or 'classic' in wx.version():\r\n            arg_4 = arg_0.FindItemData(arg_1, arg_3)\r\n        else:\r\n            arg_4 = arg_0.FindItem(arg_1, arg_3)\r\n        return arg_4", "path": "gui/controls/listview.py", "identifier": "wx_ListCtrl.FindPyData", "docstring": "Do a reverse look up for an item containing the requested data", "docstring_tokens": ["Do", "a", "reverse", "look", "up", "for", "an", "item", "containing", "the", "requested", "data"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 252539}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L1022-L1024", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Prepend a child element with the specified name.", "language": "python", "parameters": "(self, name)", "return_statement": "return XMLElement(lib.lsl_prepend_child(self.e, str.encode(name)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "XMLElement", "(", "lib", ".", "lsl_Func", "(", "arg_0", ".", "e", ",", "str", ".", "encode", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Prepend a child element with the specified name.\"\"\"\n        return XMLElement(lib.lsl_Func(arg_0.e, str.encode(arg_1)))", "path": "pylsl/pylsl.py", "identifier": "XMLElement.prepend_child", "docstring": "Prepend a child element with the specified name.", "docstring_tokens": ["Prepend", "a", "child", "element", "with", "the", "specified", "name", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 252540}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/qrt.py#L175-L181", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Stop streaming frames.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_protocol", ".", "set_on_packet", "(", "None", ")", "arg_1", "=", "\"streamframes stop\"", "await", "arg_0", ".", "_protocol", ".", "send_command", "(", "arg_1", ",", "callback", "=", "False", ")"], "function": "async def Func(arg_0):\n        \"\"\"Stop streaming frames.\"\"\"\n\n        arg_0._protocol.set_on_packet(None)\n\n        arg_1 = \"streamframes stop\"\n        await arg_0._protocol.send_command(arg_1, callback=False)", "path": "qtm/qrt.py", "identifier": "QRTConnection.stream_frames_stop", "docstring": "Stop streaming frames.", "docstring_tokens": ["Stop", "streaming", "frames", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 252541}
{"url": "https://github.com/jrfonseca/xdot.py/blob/6248c81c21a0fe825089311b17f2c302eea614a2/xdot/ui/pen.py#L46-L50", "sha": "6248c81c21a0fe825089311b17f2c302eea614a2", "docstring_summary": "Create a copy of this pen.", "language": "python", "parameters": "(self)", "return_statement": "return pen", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Pen", "(", ")", "arg_1", ".", "__dict__", "=", "arg_0", ".", "__dict__", ".", "Func", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Create a Func of this pen.\"\"\"\n        arg_1 = Pen()\n        arg_1.__dict__ = arg_0.__dict__.Func()\n        return arg_1", "path": "xdot/ui/pen.py", "identifier": "Pen.copy", "docstring": "Create a copy of this pen.", "docstring_tokens": ["Create", "a", "copy", "of", "this", "pen", "."], "nwo": "jrfonseca/xdot.py", "score": 0.7239603951735745, "idx": 252542}
{"url": "https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/catalog.py#L671-L713", "sha": "532f561f32b91ea8debea0573c503dd20988bf40", "docstring_summary": "Deletes a granule of an existing imagemosaic", "language": "python", "parameters": "(self, coverage, store, granule_id, workspace=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "dict", "(", ")", "arg_6", "=", "arg_4", "if", "isinstance", "(", "arg_2", ",", "basestring", ")", ":", "arg_7", "=", "arg_2", "else", ":", "arg_7", "=", "arg_2", ".", "name", "arg_6", "=", "arg_2", ".", "workspace", ".", "name", "if", "arg_6", "is", "None", ":", "raise", "ValueError", "(", "\"Must specify workspace\"", ")", "arg_8", "=", "build_url", "(", "arg_0", ".", "service_url", ",", "[", "\"workspaces\"", ",", "arg_6", ",", "\"coveragestores\"", ",", "arg_7", ",", "\"coverages\"", ",", "arg_1", ",", "\"index/granules\"", ",", "arg_3", ",", "\".json\"", "]", ",", "arg_5", ")", "arg_9", "=", "{", "\"Content-type\"", ":", "\"application/json\"", ",", "\"Accept\"", ":", "\"application/json\"", "}", "arg_10", "=", "arg_0", ".", "http_request", "(", "arg_8", ",", "method", "=", "'delete'", ",", "arg_9", "=", "arg_9", ")", "if", "arg_10", ".", "status_code", "!=", "200", ":", "FailedRequestError", "(", "'Failed to delete granule from mosaic {} : {}, {}'", ".", "format", "(", "arg_2", ",", "arg_10", ".", "status_code", ",", "arg_10", ".", "text", ")", ")", "arg_0", ".", "_cache", ".", "clear", "(", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        '''Deletes a granule of an existing imagemosaic'''\n        arg_5 = dict()\n\n        arg_6 = arg_4\n        if isinstance(arg_2, basestring):\n            arg_7 = arg_2\n        else:\n            arg_7 = arg_2.name\n            arg_6 = arg_2.workspace.name\n\n        if arg_6 is None:\n            raise ValueError(\"Must specify workspace\")\n\n        arg_8 = build_url(\n            arg_0.service_url,\n            [\n                \"workspaces\",\n                arg_6,\n                \"coveragestores\",\n                arg_7,\n                \"coverages\",\n                arg_1,\n                \"index/granules\",\n                arg_3,\n                \".json\"\n            ],\n            arg_5\n        )\n\n        # DELETE /workspaces/<ws>/coveragestores/<name>/coverages/<coverage>/index/granules/<granule_id>.json\n        arg_9 = {\n            \"Content-type\": \"application/json\",\n            \"Accept\": \"application/json\"\n        }\n\n        arg_10 = arg_0.http_request(arg_8, method='delete', arg_9=arg_9)\n        if arg_10.status_code != 200:\n            FailedRequestError('Failed to delete granule from mosaic {} : {}, {}'.format(arg_2, arg_10.status_code, arg_10.text))\n        arg_0._cache.clear()\n\n        # maybe return a list of all granules?\n        return None", "path": "src/geoserver/catalog.py", "identifier": "Catalog.delete_granule", "docstring": "Deletes a granule of an existing imagemosaic", "docstring_tokens": ["Deletes", "a", "granule", "of", "an", "existing", "imagemosaic"], "nwo": "boundlessgeo/gsconfig", "score": 0.7627023200281134, "idx": 252543}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/annotation.py#L53-L79", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "Nova annotation for adding function to process nova notification.", "language": "python", "parameters": "(*arg)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "check_event_type", "(", "Openstack", ".", "Nova", ",", "*", "arg_0", ")", "arg_1", "=", "arg_0", "[", "0", "]", "def", "decorator", "(", "arg_2", ")", ":", "if", "arg_1", ".", "find", "(", "\"*\"", ")", "!=", "-", "1", ":", "arg_3", "=", "pre_compile", "(", "arg_1", ")", "arg_4", "[", "arg_3", "]", "=", "arg_2", "else", ":", "arg_5", "[", "arg_1", "]", "=", "arg_2", "log", ".", "info", "(", "\"add function {0} to process event_type:{1}\"", ".", "format", "(", "arg_2", ".", "__name__", ",", "arg_1", ")", ")", "@", "functools", ".", "wraps", "(", "arg_2", ")", "def", "wrapper", "(", "*", "arg_6", ",", "**", "arg_7", ")", ":", "arg_2", "(", "*", "arg_6", ",", "**", "arg_7", ")", "return", "wrapper", "return", "decorator"], "function": "def Func(*arg_0):\n    \"\"\"\n    Nova annotation for adding function to process Func notification.\n\n    if event_type include wildcard, will put {pattern: function} into process_wildcard dict\n    else will put {event_type: function} into process dict\n\n    :param arg: event_type of notification\n    \"\"\"\n    check_event_type(Openstack.Nova, *arg_0)\n    arg_1 = arg_0[0]\n\n    def decorator(arg_2):\n        if arg_1.find(\"*\") != -1:\n            arg_3 = pre_compile(arg_1)\n            arg_4[arg_3] = arg_2\n        else:\n            arg_5[arg_1] = arg_2\n        log.info(\"add function {0} to process event_type:{1}\".format(arg_2.__name__, arg_1))\n\n        @functools.wraps(arg_2)\n        def wrapper(*arg_6, **arg_7):\n            arg_2(*arg_6, **arg_7)\n\n        return wrapper\n\n    return decorator", "path": "ternya/annotation.py", "identifier": "nova", "docstring": "Nova annotation for adding function to process nova notification.\n\n    if event_type include wildcard, will put {pattern: function} into process_wildcard dict\n    else will put {event_type: function} into process dict\n\n    :param arg: event_type of notification", "docstring_tokens": ["Nova", "annotation", "for", "adding", "function", "to", "process", "nova", "notification", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 252544}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/db.py#L495-L509", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Deletes validation log.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_0", ".", "_fill_project_info", "(", "arg_1", ")", "arg_0", ".", "db", ".", "ValidLog", ".", "delete_many", "(", "arg_1", ")", "logging", ".", "info", "(", "\"[Database] Delete ValidLog SUCCESS\"", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Deletes validation log.\n\n        Parameters\n        -----------\n        kwargs : logging information\n            Find items to delete, leave it empty to delete all log.\n\n        Examples\n        ---------\n        - see ``save_training_log``.\n        \"\"\"\n        arg_0._fill_project_info(arg_1)\n        arg_0.db.ValidLog.delete_many(arg_1)\n        logging.info(\"[Database] Delete ValidLog SUCCESS\")", "path": "tensorlayer/db.py", "identifier": "TensorHub.delete_validation_log", "docstring": "Deletes validation log.\n\n        Parameters\n        -----------\n        kwargs : logging information\n            Find items to delete, leave it empty to delete all log.\n\n        Examples\n        ---------\n        - see ``save_training_log``.", "docstring_tokens": ["Deletes", "validation", "log", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 252545}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L336-L413", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Create and configure a new security group.", "language": "python", "parameters": "(self, vpc)", "return_statement": "return sg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "create_Func", "(", "GroupName", "=", "\"private-subnet\"", ",", "Description", "=", "\"security group for remote executors\"", ")", "arg_3", "=", "[", "{", "'CidrIp'", ":", "'10.0.0.0/16'", "}", "]", "arg_4", "=", "[", "{", "'IpProtocol'", ":", "'TCP'", ",", "'FromPort'", ":", "0", ",", "'ToPort'", ":", "65535", ",", "'IpRanges'", ":", "arg_3", ",", "}", ",", "{", "'IpProtocol'", ":", "'UDP'", ",", "'FromPort'", ":", "0", ",", "'ToPort'", ":", "65535", ",", "'IpRanges'", ":", "arg_3", ",", "}", ",", "{", "'IpProtocol'", ":", "'ICMP'", ",", "'FromPort'", ":", "-", "1", ",", "'ToPort'", ":", "-", "1", ",", "'IpRanges'", ":", "[", "{", "'CidrIp'", ":", "'0.0.0.0/0'", "}", "]", ",", "}", ",", "{", "'IpProtocol'", ":", "'TCP'", ",", "'FromPort'", ":", "22", ",", "'ToPort'", ":", "22", ",", "'IpRanges'", ":", "[", "{", "'CidrIp'", ":", "'0.0.0.0/0'", "}", "]", ",", "}", "]", "arg_5", "=", "[", "{", "'IpProtocol'", ":", "'TCP'", ",", "'FromPort'", ":", "0", ",", "'ToPort'", ":", "65535", ",", "'IpRanges'", ":", "[", "{", "'CidrIp'", ":", "'0.0.0.0/0'", "}", "]", ",", "}", ",", "{", "'IpProtocol'", ":", "'TCP'", ",", "'FromPort'", ":", "0", ",", "'ToPort'", ":", "65535", ",", "'IpRanges'", ":", "arg_3", ",", "}", ",", "{", "'IpProtocol'", ":", "'UDP'", ",", "'FromPort'", ":", "0", ",", "'ToPort'", ":", "65535", ",", "'IpRanges'", ":", "arg_3", ",", "}", ",", "]", "arg_2", ".", "authorize_ingress", "(", "IpPermissions", "=", "arg_4", ")", "arg_2", ".", "authorize_egress", "(", "IpPermissions", "=", "arg_5", ")", "arg_0", ".", "sg_id", "=", "arg_2", ".", "id", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create and configure a new security group.\n\n        Allows all ICMP in, all TCP and UDP in within VPC.\n\n        This security group is very open. It allows all incoming ping requests on all\n        ports. It also allows all outgoing traffic on all ports. This can be limited by\n        changing the allowed port ranges.\n\n        Parameters\n        ----------\n        vpc : VPC instance\n            VPC in which to set up security group.\n        \"\"\"\n\n        arg_2 = arg_1.create_Func(\n            GroupName=\"private-subnet\", Description=\"security group for remote executors\"\n        )\n\n        arg_3 = [{'CidrIp': '10.0.0.0/16'}]\n\n        # Allows all ICMP in, all TCP and UDP in within VPC\n        arg_4 = [\n            {\n                'IpProtocol': 'TCP',\n                'FromPort': 0,\n                'ToPort': 65535,\n                'IpRanges': arg_3,\n            }, {\n                'IpProtocol': 'UDP',\n                'FromPort': 0,\n                'ToPort': 65535,\n                'IpRanges': arg_3,\n            }, {\n                'IpProtocol': 'ICMP',\n                'FromPort': -1,\n                'ToPort': -1,\n                'IpRanges': [{\n                    'CidrIp': '0.0.0.0/0'\n                }],\n            }, {\n                'IpProtocol': 'TCP',\n                'FromPort': 22,\n                'ToPort': 22,\n                'IpRanges': [{\n                    'CidrIp': '0.0.0.0/0'\n                }],\n            }\n        ]\n\n        # Allows all TCP out, all TCP and UDP out within VPC\n        arg_5 = [\n            {\n                'IpProtocol': 'TCP',\n                'FromPort': 0,\n                'ToPort': 65535,\n                'IpRanges': [{\n                    'CidrIp': '0.0.0.0/0'\n                }],\n            },\n            {\n                'IpProtocol': 'TCP',\n                'FromPort': 0,\n                'ToPort': 65535,\n                'IpRanges': arg_3,\n            },\n            {\n                'IpProtocol': 'UDP',\n                'FromPort': 0,\n                'ToPort': 65535,\n                'IpRanges': arg_3,\n            },\n        ]\n\n        arg_2.authorize_ingress(IpPermissions=arg_4)\n        arg_2.authorize_egress(IpPermissions=arg_5)\n        arg_0.sg_id = arg_2.id\n        return arg_2", "path": "parsl/providers/aws/aws.py", "identifier": "AWSProvider.security_group", "docstring": "Create and configure a new security group.\n\n        Allows all ICMP in, all TCP and UDP in within VPC.\n\n        This security group is very open. It allows all incoming ping requests on all\n        ports. It also allows all outgoing traffic on all ports. This can be limited by\n        changing the allowed port ranges.\n\n        Parameters\n        ----------\n        vpc : VPC instance\n            VPC in which to set up security group.", "docstring_tokens": ["Create", "and", "configure", "a", "new", "security", "group", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 252546}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L127-L158", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Synchronize content metadata using the Degreed course content API.", "language": "python", "parameters": "(self, serialized_data, http_method)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", ",", "arg_4", "=", "getattr", "(", "arg_0", ",", "'_'", "+", "arg_2", ")", "(", "urljoin", "(", "arg_0", ".", "enterprise_configuration", ".", "degreed_base_url", ",", "arg_0", ".", "global_degreed_config", ".", "course_api_path", ")", ",", "arg_1", ",", "arg_0", ".", "CONTENT_PROVIDER_SCOPE", ")", "except", "requests", ".", "exceptions", ".", "RequestException", "as", "exc", ":", "raise", "ClientError", "(", "'DegreedAPIClient request failed: {error} {message}'", ".", "format", "(", "error", "=", "exc", ".", "__class__", ".", "__name__", ",", "message", "=", "str", "(", "exc", ")", ")", ")", "if", "arg_3", ">=", "400", ":", "raise", "ClientError", "(", "'DegreedAPIClient request failed with status {status_code}: {message}'", ".", "format", "(", "arg_3", "=", "arg_3", ",", "message", "=", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Synchronize content metadata using the Degreed course content API.\n\n        Args:\n            serialized_data: JSON-encoded object containing content metadata.\n            http_method: The HTTP method to use for the API request.\n\n        Raises:\n            ClientError: If Degreed API request fails.\n        \"\"\"\n        try:\n            arg_3, arg_4 = getattr(arg_0, '_' + arg_2)(\n                urljoin(arg_0.enterprise_configuration.degreed_base_url, arg_0.global_degreed_config.course_api_path),\n                arg_1,\n                arg_0.CONTENT_PROVIDER_SCOPE\n            )\n        except requests.exceptions.RequestException as exc:\n            raise ClientError(\n                'DegreedAPIClient request failed: {error} {message}'.format(\n                    error=exc.__class__.__name__,\n                    message=str(exc)\n                )\n            )\n\n        if arg_3 >= 400:\n            raise ClientError(\n                'DegreedAPIClient request failed with status {status_code}: {message}'.format(\n                    arg_3=arg_3,\n                    message=arg_4\n                )\n            )", "path": "integrated_channels/degreed/client.py", "identifier": "DegreedAPIClient._sync_content_metadata", "docstring": "Synchronize content metadata using the Degreed course content API.\n\n        Args:\n            serialized_data: JSON-encoded object containing content metadata.\n            http_method: The HTTP method to use for the API request.\n\n        Raises:\n            ClientError: If Degreed API request fails.", "docstring_tokens": ["Synchronize", "content", "metadata", "using", "the", "Degreed", "course", "content", "API", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252547}
{"url": "https://github.com/bbusenius/Diablo-Python/blob/646ac5a6f1c79cf9b928a4e2a7979988698b6c82/commands.py#L47-L117", "sha": "646ac5a6f1c79cf9b928a4e2a7979988698b6c82", "docstring_summary": "Run the excel_to_html function from the\n    command-line.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'excel_to_html'", ")", "arg_0", ".", "add_argument", "(", "'-p'", ",", "nargs", "=", "'?'", ",", "help", "=", "'Path to an excel file for conversion.'", ")", "arg_0", ".", "add_argument", "(", "'-s'", ",", "nargs", "=", "'?'", ",", "help", "=", "'The name of a sheet in our excel file. Defaults to \"Sheet1\".'", ",", ")", "arg_0", ".", "add_argument", "(", "'-css'", ",", "nargs", "=", "'?'", ",", "help", "=", "'Space separated css classes to append to the table.'", ")", "arg_0", ".", "add_argument", "(", "'-m'", ",", "action", "=", "'store_true'", ",", "help", "=", "'Merge, attempt to combine merged cells.'", ")", "arg_0", ".", "add_argument", "(", "'-c'", ",", "nargs", "=", "'?'", ",", "help", "=", "'Caption for creating an accessible table.'", ")", "arg_0", ".", "add_argument", "(", "'-d'", ",", "nargs", "=", "'?'", ",", "help", "=", "'Two strings separated by a | character. The first string \\        is for the html \"summary\" attribute and the second string is for the html \"details\" attribute. \\        both values must be provided and nothing more.'", ",", ")", "arg_0", ".", "add_argument", "(", "'-r'", ",", "action", "=", "'store_true'", ",", "help", "=", "'Row headers. Does the table have row headers?'", ")", "arg_1", "=", "arg_0", ".", "parse_args", "(", ")", "arg_2", "=", "{", "'p'", ":", "arg_1", ".", "p", ",", "'s'", ":", "arg_1", ".", "s", ",", "'css'", ":", "arg_1", ".", "css", ",", "'m'", ":", "arg_1", ".", "m", ",", "'c'", ":", "arg_1", ".", "c", ",", "'d'", ":", "arg_1", ".", "d", ",", "'r'", ":", "arg_1", ".", "r", ",", "}", "arg_3", "=", "arg_2", "[", "'p'", "]", "arg_4", "=", "arg_2", "[", "'s'", "]", "if", "arg_2", "[", "'s'", "]", "else", "'Sheet1'", "arg_5", "=", "arg_2", "[", "'css'", "]", "if", "arg_2", "[", "'css'", "]", "else", "''", "arg_6", "=", "arg_2", "[", "'m'", "]", "if", "arg_2", "[", "'m'", "]", "else", "False", "arg_7", "=", "arg_2", "[", "'c'", "]", "if", "arg_2", "[", "'c'", "]", "else", "''", "arg_8", "=", "arg_2", "[", "'d'", "]", ".", "split", "(", "'|'", ")", "if", "arg_2", "[", "'d'", "]", "else", "[", "]", "arg_9", "=", "arg_2", "[", "'r'", "]", "if", "arg_2", "[", "'r'", "]", "else", "False", "arg_10", "=", "fp", ".", "excel_to_html", "(", "arg_3", ",", "sheetname", "=", "arg_4", ",", "css_classes", "=", "arg_5", ",", "caption", "=", "arg_7", ",", "details", "=", "arg_8", ",", "row_headers", "=", "arg_9", ",", "merge", "=", "arg_6", ")", "print", "(", "arg_10", ")"], "function": "def Func():\n    \"\"\"\n    Run the excel_to_html function from the\n    command-line.\n\n    Args:\n        -p path to file\n        -s name of the sheet to convert\n        -css classes to apply\n        -m attempt to combine merged cells\n        -c caption for accessibility\n        -su summary for accessibility\n        -d details for accessibility\n\n    Example use:\n\n        excel_to_html -p myfile.xlsx -s SheetName -css diablo-python -m true\n    \"\"\"\n    # Capture commandline arguments. prog='' argument must\n    # match the command name in setup.py entry_points\n    arg_0 = argparse.ArgumentParser(prog='excel_to_html')\n    arg_0.add_argument('-p', nargs='?', help='Path to an excel file for conversion.')\n    arg_0.add_argument(\n        '-s',\n        nargs='?',\n        help='The name of a sheet in our excel file. Defaults to \"Sheet1\".',\n    )\n    arg_0.add_argument(\n        '-css', nargs='?', help='Space separated css classes to append to the table.'\n    )\n    arg_0.add_argument(\n        '-m', action='store_true', help='Merge, attempt to combine merged cells.'\n    )\n    arg_0.add_argument(\n        '-c', nargs='?', help='Caption for creating an accessible table.'\n    )\n    arg_0.add_argument(\n        '-d',\n        nargs='?',\n        help='Two strings separated by a | character. The first string \\\n        is for the html \"summary\" attribute and the second string is for the html \"details\" attribute. \\\n        both values must be provided and nothing more.',\n    )\n    arg_0.add_argument(\n        '-r', action='store_true', help='Row headers. Does the table have row headers?'\n    )\n\n    arg_1 = arg_0.parse_args()\n    arg_2 = {\n        'p': arg_1.p,\n        's': arg_1.s,\n        'css': arg_1.css,\n        'm': arg_1.m,\n        'c': arg_1.c,\n        'd': arg_1.d,\n        'r': arg_1.r,\n    }\n\n    arg_3 = arg_2['p']\n    arg_4 = arg_2['s'] if arg_2['s'] else 'Sheet1'\n    arg_5 = arg_2['css'] if arg_2['css'] else ''\n    arg_6 = arg_2['m'] if arg_2['m'] else False\n    arg_7 = arg_2['c'] if arg_2['c'] else ''\n    arg_8 = arg_2['d'].split('|') if arg_2['d'] else []\n    arg_9 = arg_2['r'] if arg_2['r'] else False\n\n    arg_10 = fp.excel_to_html(\n        arg_3, sheetname=arg_4, css_classes=arg_5, caption=arg_7, details=arg_8, row_headers=arg_9, merge=arg_6\n    )\n\n    print(arg_10)", "path": "commands.py", "identifier": "run_excel_to_html", "docstring": "Run the excel_to_html function from the\n    command-line.\n\n    Args:\n        -p path to file\n        -s name of the sheet to convert\n        -css classes to apply\n        -m attempt to combine merged cells\n        -c caption for accessibility\n        -su summary for accessibility\n        -d details for accessibility\n\n    Example use:\n\n        excel_to_html -p myfile.xlsx -s SheetName -css diablo-python -m true", "docstring_tokens": ["Run", "the", "excel_to_html", "function", "from", "the", "command", "-", "line", "."], "nwo": "bbusenius/Diablo-Python", "score": 0.24979334806965703, "idx": 252548}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/attrib.py#L279-L286", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Accept the method if its attributes match.", "language": "python", "parameters": "(self, method)", "return_statement": "return self.validateAttrib(method, cls)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_1", ".", "im_class", "except", "AttributeError", ":", "return", "False", "return", "arg_0", ".", "validateAttrib", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Accept the method if its attributes match.\n        \"\"\"\n        try:\n            arg_2 = arg_1.im_class\n        except AttributeError:\n            return False\n        return arg_0.validateAttrib(arg_1, arg_2)", "path": "environment/lib/python2.7/site-packages/nose/plugins/attrib.py", "identifier": "AttributeSelector.wantMethod", "docstring": "Accept the method if its attributes match.", "docstring_tokens": ["Accept", "the", "method", "if", "its", "attributes", "match", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252549}
{"url": "https://github.com/sergedomk/fiql_parser/blob/499dd7cd0741603530ce5f3803d92813e74ac9c3/fiql_parser/constraint.py#L105-L115", "sha": "499dd7cd0741603530ce5f3803d92813e74ac9c3", "docstring_summary": "Deconstruct the ``Constraint`` instance to a tuple.", "language": "python", "parameters": "(self)", "return_statement": "return (\n            self.selector,\n            COMPARISON_MAP.get(self.comparison, self.comparison),\n            self.argument\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "selector", ",", "COMPARISON_MAP", ".", "get", "(", "arg_0", ".", "comparison", ",", "arg_0", ".", "comparison", ")", ",", "arg_0", ".", "argument", ")"], "function": "def Func(arg_0):\n        \"\"\"Deconstruct the ``Constraint`` instance to a tuple.\n\n        Returns:\n            tuple: The deconstructed ``Constraint``.\n        \"\"\"\n        return (\n            arg_0.selector,\n            COMPARISON_MAP.get(arg_0.comparison, arg_0.comparison),\n            arg_0.argument\n        )", "path": "fiql_parser/constraint.py", "identifier": "Constraint.to_python", "docstring": "Deconstruct the ``Constraint`` instance to a tuple.\n\n        Returns:\n            tuple: The deconstructed ``Constraint``.", "docstring_tokens": ["Deconstruct", "the", "Constraint", "instance", "to", "a", "tuple", "."], "nwo": "sergedomk/fiql_parser", "score": 0.35580137387943567, "idx": 252550}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/virtsocket.py#L477-L480", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "This functions returns a list of jobs", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "spawn", "(", "arg_0", ".", "_heartbeat", ")", "arg_0", ".", "spawn", "(", "arg_0", ".", "_heartbeat_timeout", ")"], "function": "def Func(arg_0):\n        \"\"\"This functions returns a list of jobs\"\"\"\n        arg_0.spawn(arg_0._heartbeat)\n        arg_0.spawn(arg_0._heartbeat_timeout)", "path": "socketio/virtsocket.py", "identifier": "Socket._spawn_heartbeat", "docstring": "This functions returns a list of jobs", "docstring_tokens": ["This", "functions", "returns", "a", "list", "of", "jobs"], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 252551}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/path/_path.py#L737-L752", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Calculate the md5 hash for this file.", "language": "python", "parameters": "(self)", "return_statement": "return m.digest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "open", "(", "'rb'", ")", "try", ":", "arg_2", "=", "md5", "(", ")", "while", "True", ":", "arg_3", "=", "arg_1", ".", "read", "(", "8192", ")", "if", "not", "arg_3", ":", "break", "arg_2", ".", "update", "(", "arg_3", ")", "finally", ":", "arg_1", ".", "close", "(", ")", "return", "arg_2", ".", "digest", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Calculate the md5 hash for this file.\n\n        This reads through the entire file.\n        \"\"\"\n        arg_1 = arg_0.open('rb')\n        try:\n            arg_2 = md5()\n            while True:\n                arg_3 = arg_1.read(8192)\n                if not arg_3:\n                    break\n                arg_2.update(arg_3)\n        finally:\n            arg_1.close()\n        return arg_2.digest()", "path": "environment/lib/python2.7/site-packages/IPython/external/path/_path.py", "identifier": "path.read_md5", "docstring": "Calculate the md5 hash for this file.\n\n        This reads through the entire file.", "docstring_tokens": ["Calculate", "the", "md5", "hash", "for", "this", "file", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252552}
{"url": "https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/schedulelib.py#L129-L141", "sha": "6ac71bda1de6706fb34244ae4972e36db5f062d3", "docstring_summary": "Make scheduler service", "language": "python", "parameters": "(opts)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tainternet", ".", "TimerService", "(", "arg_0", "[", "'frequency'", "]", ",", "runProcess", ",", "arg_0", "[", "'args'", "]", ",", "arg_0", "[", "'timeout'", "]", ",", "arg_0", "[", "'grace'", "]", ",", "tireactor", ")", "arg_2", "=", "service", ".", "MultiService", "(", ")", "arg_1", ".", "setName", "(", "'scheduler'", ")", "arg_1", ".", "setServiceParent", "(", "arg_2", ")", "heart", ".", "maybeAddHeart", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Make scheduler service\n\n    :params opts: dict-like object.\n       keys: frequency, args, timeout, grace\n    \"\"\"\n    arg_1 = tainternet.TimerService(arg_0['frequency'], runProcess, arg_0['args'],\n                                  arg_0['timeout'], arg_0['grace'], tireactor)\n    arg_2 = service.MultiService()\n    arg_1.setName('scheduler')\n    arg_1.setServiceParent(arg_2)\n    heart.maybeAddHeart(arg_2)\n    return arg_2", "path": "ncolony/schedulelib.py", "identifier": "makeService", "docstring": "Make scheduler service\n\n    :params opts: dict-like object.\n       keys: frequency, args, timeout, grace", "docstring_tokens": ["Make", "scheduler", "service"], "nwo": "ncolony/ncolony", "score": 0.2757871243566705, "idx": 252553}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py#L166-L176", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reimplemented to support prompt requests.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'parent_header'", "]", ".", "get", "(", "'msg_id'", ")", "arg_3", "=", "arg_0", ".", "_request_info", "[", "'execute'", "]", ".", "get", "(", "arg_2", ")", "if", "arg_3", "and", "arg_3", ".", "kind", "==", "'prompt'", ":", "arg_4", "=", "arg_1", "[", "'content'", "]", "[", "'execution_count'", "]", "+", "1", "arg_0", ".", "_show_interpreter_prompt", "(", "arg_4", ")", "arg_0", ".", "_request_info", "[", "'execute'", "]", ".", "pop", "(", "arg_2", ")", "else", ":", "super", "(", "IPythonWidget", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Reimplemented to support prompt requests.\n        \"\"\"\n        arg_2 = arg_1['parent_header'].get('msg_id')\n        arg_3 = arg_0._request_info['execute'].get(arg_2)\n        if arg_3 and arg_3.kind == 'prompt':\n           arg_4 = arg_1['content']['execution_count'] + 1\n           arg_0._show_interpreter_prompt(arg_4)\n           arg_0._request_info['execute'].pop(arg_2)\n        else:\n           super(IPythonWidget, arg_0).Func(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py", "identifier": "IPythonWidget._handle_execute_reply", "docstring": "Reimplemented to support prompt requests.", "docstring_tokens": ["Reimplemented", "to", "support", "prompt", "requests", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252554}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L311-L321", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds a logger with a given `name`.", "language": "python", "parameters": "(self, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "arg_0", ".", "__class__", "arg_1", "=", "'%s.%s'", "%", "(", "arg_2", ".", "__module__", ",", "arg_2", ".", "__name__", ")", "arg_0", ".", "_logger", "=", "logging", ".", "getLogger", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Adds a logger with a given `name`.\n\n        If no name is given, name is constructed as\n        `type(self).__name__`.\n\n        \"\"\"\n        if arg_1 is None:\n            arg_2 = arg_0.__class__\n            arg_1 = '%s.%s' % (arg_2.__module__, arg_2.__name__)\n        arg_0._logger = logging.getLogger(arg_1)", "path": "pypet/pypetlogging.py", "identifier": "HasLogger._set_logger", "docstring": "Adds a logger with a given `name`.\n\n        If no name is given, name is constructed as\n        `type(self).__name__`.", "docstring_tokens": ["Adds", "a", "logger", "with", "a", "given", "name", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252555}
{"url": "https://github.com/bitlabstudio/django-dashboard-app/blob/ed98f2bca91a4ced36d0dd1aa1baee78e989cf64/dashboard_app/widget_pool.py#L69-L91", "sha": "ed98f2bca91a4ced36d0dd1aa1baee78e989cf64", "docstring_summary": "Registers the given widget.", "language": "python", "parameters": "(self, widget_cls, **widget_kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "not", "issubclass", "(", "arg_1", ",", "DashboardWidgetBase", ")", ":", "raise", "ImproperlyConfigured", "(", "'DashboardWidgets must be subclasses of DashboardWidgetBase,'", "' {0} is not.'", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "arg_1", "(", "**", "arg_2", ")", "arg_4", "=", "arg_3", ".", "get_name", "(", ")", "if", "arg_4", "in", "arg_0", ".", "widgets", ":", "raise", "WidgetAlreadyRegistered", "(", "'Cannot register {0}, a plugin with this name {1} is already '", "'registered.'", ".", "format", "(", "arg_1", ",", "arg_4", ")", ")", "arg_0", ".", "widgets", "[", "arg_4", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Registers the given widget.\n\n        Widgets must inherit ``DashboardWidgetBase`` and you cannot register\n        the same widget twice.\n\n        :widget_cls: A class that inherits ``DashboardWidgetBase``.\n\n        \"\"\"\n        if not issubclass(arg_1, DashboardWidgetBase):\n            raise ImproperlyConfigured(\n                'DashboardWidgets must be subclasses of DashboardWidgetBase,'\n                ' {0} is not.'.format(arg_1))\n\n        arg_3 = arg_1(**arg_2)\n        arg_4 = arg_3.get_name()\n        if arg_4 in arg_0.widgets:\n            raise WidgetAlreadyRegistered(\n                'Cannot register {0}, a plugin with this name {1} is already '\n                'registered.'.format(arg_1, arg_4))\n\n        arg_0.widgets[arg_4] = arg_3", "path": "dashboard_app/widget_pool.py", "identifier": "DashboardWidgetPool.register_widget", "docstring": "Registers the given widget.\n\n        Widgets must inherit ``DashboardWidgetBase`` and you cannot register\n        the same widget twice.\n\n        :widget_cls: A class that inherits ``DashboardWidgetBase``.", "docstring_tokens": ["Registers", "the", "given", "widget", "."], "nwo": "bitlabstudio/django-dashboard-app", "score": 0.19645210594164048, "idx": 252556}
{"url": "https://github.com/cdriehuys/django-rest-email-auth/blob/7e752c4d77ae02d2d046f214f56e743aa12ab23f/rest_email_auth/authentication.py#L40-L74", "sha": "7e752c4d77ae02d2d046f214f56e743aa12ab23f", "docstring_summary": "Attempt to authenticate a set of credentials.", "language": "python", "parameters": "(self, request, email=None, password=None, username=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "arg_4", "try", ":", "arg_5", "=", "models", ".", "EmailAddress", ".", "objects", ".", "get", "(", "is_verified", "=", "True", ",", "arg_2", "=", "arg_2", ")", "except", "models", ".", "EmailAddress", ".", "DoesNotExist", ":", "return", "None", "arg_6", "=", "arg_5", ".", "user", "if", "arg_6", ".", "check_password", "(", "arg_3", ")", ":", "return", "arg_6", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"\n        Attempt to Func a set of credentials.\n\n        Args:\n            request:\n                The request associated with the authentication attempt.\n            email:\n                The user's email address.\n            password:\n                The user's password.\n            username:\n                An alias for the ``email`` field. This is provided for\n                compatability with Django's built in authentication\n                views.\n\n        Returns:\n            The user associated with the provided credentials if they\n            are valid. Returns ``None`` otherwise.\n        \"\"\"\n        arg_2 = arg_2 or arg_4\n\n        try:\n            arg_5 = models.EmailAddress.objects.get(\n                is_verified=True, arg_2=arg_2\n            )\n        except models.EmailAddress.DoesNotExist:\n            return None\n\n        arg_6 = arg_5.user\n\n        if arg_6.check_password(arg_3):\n            return arg_6\n\n        return None", "path": "rest_email_auth/authentication.py", "identifier": "VerifiedEmailBackend.authenticate", "docstring": "Attempt to authenticate a set of credentials.\n\n        Args:\n            request:\n                The request associated with the authentication attempt.\n            email:\n                The user's email address.\n            password:\n                The user's password.\n            username:\n                An alias for the ``email`` field. This is provided for\n                compatability with Django's built in authentication\n                views.\n\n        Returns:\n            The user associated with the provided credentials if they\n            are valid. Returns ``None`` otherwise.", "docstring_tokens": ["Attempt", "to", "authenticate", "a", "set", "of", "credentials", "."], "nwo": "cdriehuys/django-rest-email-auth", "score": 0.28490879858232004, "idx": 252557}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/expansion.py#L216-L221", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Add all of the members of the complex abundances to the graph.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "None", ":", "arg_2", "=", "list", "(", "get_nodes_by_function", "(", "arg_0", ",", "COMPLEX", ")", ")", "for", "arg_3", "in", "arg_2", ":", "for", "arg_4", "in", "arg_3", ".", "members", ":", "arg_0", ".", "add_has_component", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0: arg_1) -> None:\n    \"\"\"Add all of the members of the complex abundances to the graph.\"\"\"\n    arg_2 = list(get_nodes_by_function(arg_0, COMPLEX))\n    for arg_3 in arg_2:\n        for arg_4 in arg_3.members:\n            arg_0.add_has_component(arg_3, arg_4)", "path": "src/pybel_tools/mutation/expansion.py", "identifier": "enrich_complexes", "docstring": "Add all of the members of the complex abundances to the graph.", "docstring_tokens": ["Add", "all", "of", "the", "members", "of", "the", "complex", "abundances", "to", "the", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 252558}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/aws_hook.py#L183-L192", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get the underlying `botocore.Credentials` object.", "language": "python", "parameters": "(self, region_name=None)", "return_statement": "return session.get_credentials().get_frozen_credentials()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "_Func", "(", "arg_1", ")", "return", "arg_2", ".", "Func", "(", ")", ".", "get_frozen_credentials", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Get the underlying `botocore.Credentials` object.\n\n        This contains the following authentication attributes: access_key, secret_key and token.\n        \"\"\"\n        arg_2, arg_3 = arg_0._Func(arg_1)\n        # Credentials are refreshable, so accessing your access key and\n        # secret key separately can lead to a race condition.\n        # See https://stackoverflow.com/a/36291428/8283373\n        return arg_2.Func().get_frozen_credentials()", "path": "airflow/contrib/hooks/aws_hook.py", "identifier": "AwsHook.get_credentials", "docstring": "Get the underlying `botocore.Credentials` object.\n\n        This contains the following authentication attributes: access_key, secret_key and token.", "docstring_tokens": ["Get", "the", "underlying", "botocore", ".", "Credentials", "object", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252559}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/eval.py#L236-L278", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Processes a single track.", "language": "python", "parameters": "(file_struct, boundaries_id, labels_id, config,\n                  annotator_id=0)", "return_statement": "return one_res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "arg_0", "=", "io", ".", "FileStruct", "(", "arg_0", ")", "arg_5", "=", "arg_0", ".", "est_file", "arg_6", "=", "arg_0", ".", "ref_file", "assert", "os", ".", "path", ".", "basename", "(", "arg_5", ")", "[", ":", "-", "4", "]", "==", "os", ".", "path", ".", "basename", "(", "arg_6", ")", "[", ":", "-", "4", "]", ",", "\"File names are different %s --- %s\"", "%", "(", "os", ".", "path", ".", "basename", "(", "arg_5", ")", "[", ":", "-", "4", "]", ",", "os", ".", "path", ".", "basename", "(", "arg_6", ")", "[", ":", "-", "4", "]", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_6", ")", ":", "raise", "NoReferencesError", "(", "\"Reference file %s does not exist. You must \"", "\"have annotated references to run \"", "\"evaluations.\"", "%", "arg_6", ")", "arg_7", "=", "compute_gt_results", "(", "arg_5", ",", "arg_6", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_4", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                  arg_4=0):\n    \"\"\"Processes a single track.\n\n    Parameters\n    ----------\n    file_struct : object (FileStruct) or str\n        File struct or full path of the audio file to be evaluated.\n    boundaries_id : str\n        Identifier of the boundaries algorithm.\n    labels_id : str\n        Identifier of the labels algorithm.\n    config : dict\n        Configuration of the algorithms to be evaluated.\n    annotator_id : int\n        Number identifiying the annotator.\n\n    Returns\n    -------\n    one_res : dict\n        Dictionary of the results (see function compute_results).\n    \"\"\"\n    # Convert to file_struct if string is passed\n    if isinstance(arg_0, six.string_types):\n        arg_0 = io.FileStruct(arg_0)\n\n    arg_5 = arg_0.est_file\n    arg_6 = arg_0.ref_file\n\n    # Sanity check\n    assert os.path.basename(arg_5)[:-4] == \\\n        os.path.basename(arg_6)[:-4], \"File names are different %s --- %s\" \\\n        % (os.path.basename(arg_5)[:-4], os.path.basename(arg_6)[:-4])\n\n    if not os.path.isfile(arg_6):\n        raise NoReferencesError(\"Reference file %s does not exist. You must \"\n                                \"have annotated references to run \"\n                                \"evaluations.\" % arg_6)\n\n    arg_7 = compute_gt_results(arg_5, arg_6, arg_1, arg_2,\n                                 arg_3, arg_4=arg_4)\n\n    return arg_7", "path": "msaf/eval.py", "identifier": "process_track", "docstring": "Processes a single track.\n\n    Parameters\n    ----------\n    file_struct : object (FileStruct) or str\n        File struct or full path of the audio file to be evaluated.\n    boundaries_id : str\n        Identifier of the boundaries algorithm.\n    labels_id : str\n        Identifier of the labels algorithm.\n    config : dict\n        Configuration of the algorithms to be evaluated.\n    annotator_id : int\n        Number identifiying the annotator.\n\n    Returns\n    -------\n    one_res : dict\n        Dictionary of the results (see function compute_results).", "docstring_tokens": ["Processes", "a", "single", "track", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 252560}
{"url": "https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/listener.py#L140-L150", "sha": "0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b", "docstring_summary": "Execute a device. Used if the time between executions is greater than DEFAULT_DELAY", "language": "python", "parameters": "(self, device)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "src", ".", "lower", "(", ")", "arg_1", "=", "arg_0", ".", "devices", "[", "arg_2", "]", "threading", ".", "Thread", "(", "target", "=", "arg_1", ".", "Func", ",", "kwargs", "=", "{", "'root_allowed'", ":", "arg_0", ".", "root_allowed", "}", ")", ".", "start", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Execute a device. Used if the time between executions is greater than DEFAULT_DELAY\n\n        :param scapy.packet.Packet device: Scapy packet\n        :return: None\n        \"\"\"\n        arg_2 = arg_1.src.lower()\n        arg_1 = arg_0.devices[arg_2]\n        threading.Thread(target=arg_1.Func, kwargs={\n            'root_allowed': arg_0.root_allowed\n        }).start()", "path": "amazon_dash/listener.py", "identifier": "Listener.execute", "docstring": "Execute a device. Used if the time between executions is greater than DEFAULT_DELAY\n\n        :param scapy.packet.Packet device: Scapy packet\n        :return: None", "docstring_tokens": ["Execute", "a", "device", ".", "Used", "if", "the", "time", "between", "executions", "is", "greater", "than", "DEFAULT_DELAY"], "nwo": "Nekmo/amazon-dash", "score": 0.758195400618659, "idx": 252561}
{"url": "https://github.com/rossengeorgiev/aprs-python/blob/94b89a6da47a322129484efcaf1e82f6a9932891/aprslib/inet.py#L160-L213", "sha": "94b89a6da47a322129484efcaf1e82f6a9932891", "docstring_summary": "When a position sentence is received, it will be passed to the callback function", "language": "python", "parameters": "(self, callback, blocking=True, immortal=False, raw=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "if", "not", "arg_0", ".", "_connected", ":", "raise", "ConnectionError", "(", "\"not connected to a server\"", ")", "arg_5", "=", "b''", "while", "True", ":", "try", ":", "for", "arg_5", "in", "arg_0", ".", "_socket_readlines", "(", "arg_2", ")", ":", "if", "arg_5", "[", "0", ":", "1", "]", "!=", "b'#'", ":", "if", "arg_4", ":", "arg_1", "(", "arg_5", ")", "else", ":", "arg_1", "(", "arg_0", ".", "_parse", "(", "arg_5", ")", ")", "else", ":", "arg_0", ".", "logger", ".", "debug", "(", "\"Server: %s\"", ",", "arg_5", ".", "decode", "(", "'utf8'", ")", ")", "except", "ParseError", "as", "exp", ":", "arg_0", ".", "logger", ".", "log", "(", "11", ",", "\"%s\\n    Packet: %s\"", ",", "exp", ".", "message", ",", "exp", ".", "packet", ")", "except", "UnknownFormat", "as", "exp", ":", "arg_0", ".", "logger", ".", "log", "(", "9", ",", "\"%s\\n    Packet: %s\"", ",", "exp", ".", "message", ",", "exp", ".", "packet", ")", "except", "LoginError", "as", "exp", ":", "arg_0", ".", "logger", ".", "error", "(", "\"%s: %s\"", ",", "exp", ".", "__class__", ".", "__name__", ",", "exp", ".", "message", ")", "except", "(", "KeyboardInterrupt", ",", "SystemExit", ")", ":", "raise", "except", "(", "ConnectionDrop", ",", "ConnectionError", ")", ":", "arg_0", ".", "close", "(", ")", "if", "not", "arg_3", ":", "raise", "else", ":", "arg_0", ".", "connect", "(", "arg_2", "=", "arg_2", ")", "continue", "except", "GenericError", ":", "pass", "except", "StopIteration", ":", "break", "except", ":", "arg_0", ".", "logger", ".", "error", "(", "\"APRS Packet: %s\"", ",", "arg_5", ")", "raise", "if", "not", "arg_2", ":", "break"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=False, arg_4=False):\n        \"\"\"\n        When a position sentence is received, it will be passed to the callback function\n\n        blocking: if true (default), runs forever, otherwise will return after one sentence\n                  You can still exit the loop, by raising StopIteration in the callback function\n\n        immortal: When true, Func will try to reconnect and stop propagation of Parse exceptions\n                  if false (default), Func will return\n\n        raw: when true, raw packet is passed to callback, otherwise the result from aprs.parse()\n        \"\"\"\n\n        if not arg_0._connected:\n            raise ConnectionError(\"not connected to a server\")\n\n        arg_5 = b''\n\n        while True:\n            try:\n                for arg_5 in arg_0._socket_readlines(arg_2):\n                    if arg_5[0:1] != b'#':\n                        if arg_4:\n                            arg_1(arg_5)\n                        else:\n                            arg_1(arg_0._parse(arg_5))\n                    else:\n                        arg_0.logger.debug(\"Server: %s\", arg_5.decode('utf8'))\n            except ParseError as exp:\n                arg_0.logger.log(11, \"%s\\n    Packet: %s\", exp.message, exp.packet)\n            except UnknownFormat as exp:\n                arg_0.logger.log(9, \"%s\\n    Packet: %s\", exp.message, exp.packet)\n            except LoginError as exp:\n                arg_0.logger.error(\"%s: %s\", exp.__class__.__name__, exp.message)\n            except (KeyboardInterrupt, SystemExit):\n                raise\n            except (ConnectionDrop, ConnectionError):\n                arg_0.close()\n\n                if not arg_3:\n                    raise\n                else:\n                    arg_0.connect(arg_2=arg_2)\n                    continue\n            except GenericError:\n                pass\n            except StopIteration:\n                break\n            except:\n                arg_0.logger.error(\"APRS Packet: %s\", arg_5)\n                raise\n\n            if not arg_2:\n                break", "path": "aprslib/inet.py", "identifier": "IS.consumer", "docstring": "When a position sentence is received, it will be passed to the callback function\n\n        blocking: if true (default), runs forever, otherwise will return after one sentence\n                  You can still exit the loop, by raising StopIteration in the callback function\n\n        immortal: When true, consumer will try to reconnect and stop propagation of Parse exceptions\n                  if false (default), consumer will return\n\n        raw: when true, raw packet is passed to callback, otherwise the result from aprs.parse()", "docstring_tokens": ["When", "a", "position", "sentence", "is", "received", "it", "will", "be", "passed", "to", "the", "callback", "function"], "nwo": "rossengeorgiev/aprs-python", "score": 0.3643830340421162, "idx": 252562}
{"url": "https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L1151-L1164", "sha": "5b6dda745cede05755dd40d29775cc0544226c29", "docstring_summary": "Convert our options into the actual circle object", "language": "python", "parameters": "(self, mid)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "marker", "=", "Circle", "(", "__id__", "=", "arg_1", ")", "arg_0", ".", "parent", "(", ")", ".", "markers", "[", "arg_1", "]", "=", "arg_0", "arg_0", ".", "marker", ".", "setTag", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "declaration", "if", "arg_5", ".", "clickable", ":", "arg_0", ".", "set_clickable", "(", "arg_5", ".", "clickable", ")", "del", "arg_0", ".", "options"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Convert our options into the actual circle object\"\"\"\n        arg_0.marker = Circle(__id__=arg_1)\n        arg_0.parent().markers[arg_1] = arg_0\n\n        #: Required so the packer can pass the id\n        arg_0.marker.setTag(arg_1)\n\n        arg_5 = arg_0.declaration\n        if arg_5.clickable:\n            arg_0.set_clickable(arg_5.clickable)\n\n        #: Can free the options now\n        del arg_0.options", "path": "src/googlemaps/android/android_map_view.py", "identifier": "AndroidMapCircle.on_marker", "docstring": "Convert our options into the actual circle object", "docstring_tokens": ["Convert", "our", "options", "into", "the", "actual", "circle", "object"], "nwo": "codelv/enaml-native-maps", "score": 0.505410468099224, "idx": 252563}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/packages/click/termui.py#L34-L110", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Prompts a user for input.  This is a convenience function that can\n    be used to prompt a user for input later.", "language": "python", "parameters": "(text, default=None, hide_input=False,\n           confirmation_prompt=False, type=None,\n           value_proc=None, prompt_suffix=': ',\n           show_default=True, err=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "': '", ",", "arg_7", "=", "True", ",", "arg_8", "=", "False", ")", ":", "arg_9", "=", "None", "def", "prompt_func", "(", "arg_0", ")", ":", "arg_10", "=", "arg_2", "and", "hidden_prompt_func", "or", "visible_prompt_func", "try", ":", "echo", "(", "arg_0", ",", "nl", "=", "False", ",", "arg_8", "=", "arg_8", ")", "return", "arg_10", "(", "''", ")", "except", "(", "KeyboardInterrupt", ",", "EOFError", ")", ":", "if", "arg_2", ":", "echo", "(", "None", ",", "arg_8", "=", "arg_8", ")", "raise", "Abort", "(", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "convert_type", "(", "arg_4", ",", "arg_1", ")", "Func", "=", "_build_prompt", "(", "arg_0", ",", "arg_6", ",", "arg_7", ",", "arg_1", ")", "while", "1", ":", "while", "1", ":", "arg_12", "=", "prompt_func", "(", "Func", ")", "if", "arg_12", ":", "break", "elif", "arg_1", "is", "not", "None", ":", "return", "arg_1", "try", ":", "arg_9", "=", "arg_5", "(", "arg_12", ")", "except", "UsageError", "as", "e", ":", "echo", "(", "'Error: %s'", "%", "e", ".", "message", ",", "arg_8", "=", "arg_8", ")", "continue", "if", "not", "arg_3", ":", "return", "arg_9", "while", "1", ":", "arg_13", "=", "prompt_func", "(", "'Repeat for confirmation: '", ")", "if", "arg_13", ":", "break", "if", "arg_12", "==", "arg_13", ":", "return", "arg_9", "echo", "(", "'Error: the two entered values do not match'", ",", "arg_8", "=", "arg_8", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False,\n           arg_3=False, arg_4=None,\n           arg_5=None, arg_6=': ',\n           arg_7=True, arg_8=False):\n    \"\"\"Prompts a user for input.  This is a convenience function that can\n    be used to prompt a user for input later.\n\n    If the user aborts the input by sending a interrupt signal, this\n    function will catch it and raise a :exc:`Abort` exception.\n\n    .. versionadded:: 6.0\n       Added unicode support for cmd.exe on Windows.\n\n    .. versionadded:: 4.0\n       Added the `err` parameter.\n\n    :param text: the text to show for the prompt.\n    :param default: the default value to use if no input happens.  If this\n                    is not given it will prompt until it's aborted.\n    :param hide_input: if this is set to true then the input value will\n                       be hidden.\n    :param confirmation_prompt: asks for confirmation for the value.\n    :param type: the type to use to check the value against.\n    :param value_proc: if this parameter is provided it's a function that\n                       is invoked instead of the type conversion to\n                       convert a value.\n    :param prompt_suffix: a suffix that should be added to the prompt.\n    :param show_default: shows or hides the default value in the prompt.\n    :param err: if set to true the file defaults to ``stderr`` instead of\n                ``stdout``, the same as with echo.\n    \"\"\"\n    arg_9 = None\n\n    def prompt_func(arg_0):\n        arg_10 = arg_2 and hidden_prompt_func or visible_prompt_func\n        try:\n            # Write the prompt separately so that we get nice\n            # coloring through colorama on Windows\n            echo(arg_0, nl=False, arg_8=arg_8)\n            return arg_10('')\n        except (KeyboardInterrupt, EOFError):\n            # getpass doesn't print a newline if the user aborts input with ^C.\n            # Allegedly this behavior is inherited from getpass(3).\n            # A doc bug has been filed at https://bugs.python.org/issue24711\n            if arg_2:\n                echo(None, arg_8=arg_8)\n            raise Abort()\n\n    if arg_5 is None:\n        arg_5 = convert_type(arg_4, arg_1)\n\n    Func = _build_prompt(arg_0, arg_6, arg_7, arg_1)\n\n    while 1:\n        while 1:\n            arg_12 = prompt_func(Func)\n            if arg_12:\n                break\n            # If a default is set and used, then the confirmation\n            # prompt is always skipped because that's the only thing\n            # that really makes sense.\n            elif arg_1 is not None:\n                return arg_1\n        try:\n            arg_9 = arg_5(arg_12)\n        except UsageError as e:\n            echo('Error: %s' % e.message, arg_8=arg_8)\n            continue\n        if not arg_3:\n            return arg_9\n        while 1:\n            arg_13 = prompt_func('Repeat for confirmation: ')\n            if arg_13:\n                break\n        if arg_12 == arg_13:\n            return arg_9\n        echo('Error: the two entered values do not match', arg_8=arg_8)", "path": "cpenv/packages/click/termui.py", "identifier": "prompt", "docstring": "Prompts a user for input.  This is a convenience function that can\n    be used to prompt a user for input later.\n\n    If the user aborts the input by sending a interrupt signal, this\n    function will catch it and raise a :exc:`Abort` exception.\n\n    .. versionadded:: 6.0\n       Added unicode support for cmd.exe on Windows.\n\n    .. versionadded:: 4.0\n       Added the `err` parameter.\n\n    :param text: the text to show for the prompt.\n    :param default: the default value to use if no input happens.  If this\n                    is not given it will prompt until it's aborted.\n    :param hide_input: if this is set to true then the input value will\n                       be hidden.\n    :param confirmation_prompt: asks for confirmation for the value.\n    :param type: the type to use to check the value against.\n    :param value_proc: if this parameter is provided it's a function that\n                       is invoked instead of the type conversion to\n                       convert a value.\n    :param prompt_suffix: a suffix that should be added to the prompt.\n    :param show_default: shows or hides the default value in the prompt.\n    :param err: if set to true the file defaults to ``stderr`` instead of\n                ``stdout``, the same as with echo.", "docstring_tokens": ["Prompts", "a", "user", "for", "input", ".", "This", "is", "a", "convenience", "function", "that", "can", "be", "used", "to", "prompt", "a", "user", "for", "input", "later", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 252564}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L801-L813", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val is a dict and does not contain the given value or values.", "language": "python", "parameters": "(self, *values)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_0", ".", "_check_dict_like", "(", "arg_0", ".", "val", ",", "check_getitem", "=", "False", ")", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more value args must be given'", ")", "else", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", "in", "arg_0", ".", "val", ".", "values", "(", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to not contain values %s, but did contain %s.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ",", "arg_0", ".", "_fmt_items", "(", "arg_2", ")", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Asserts that val is a dict and does not contain the given value or values.\"\"\"\n        arg_0._check_dict_like(arg_0.val, check_getitem=False)\n        if len(arg_1) == 0:\n            raise ValueError('one or more value args must be given')\n        else:\n            arg_2 = []\n            for arg_3 in arg_1:\n                if arg_3 in arg_0.val.values():\n                    arg_2.append(arg_3)\n            if arg_2:\n                arg_0._err('Expected <%s> to not contain values %s, but did contain %s.' % (arg_0.val, arg_0._fmt_items(arg_1), arg_0._fmt_items(arg_2)))\n        return arg_0", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.does_not_contain_value", "docstring": "Asserts that val is a dict and does not contain the given value or values.", "docstring_tokens": ["Asserts", "that", "val", "is", "a", "dict", "and", "does", "not", "contain", "the", "given", "value", "or", "values", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 252565}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/coloransi.py#L48-L54", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Build a set of color attributes in a class.", "language": "python", "parameters": "(in_class)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "color_templates", ":", "setattr", "(", "arg_0", ",", "arg_1", ",", "arg_0", ".", "_base", "%", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Build a set of color attributes in a class.\n\n    Helper function for building the *TermColors classes.\"\"\"\n\n    for arg_1,arg_2 in color_templates:\n        setattr(arg_0,arg_1,arg_0._base % arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/utils/coloransi.py", "identifier": "make_color_table", "docstring": "Build a set of color attributes in a class.\n\n    Helper function for building the *TermColors classes.", "docstring_tokens": ["Build", "a", "set", "of", "color", "attributes", "in", "a", "class", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252566}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/provider.py#L58-L72", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Initialize bluez DBus communication.  Must be called before any other\n        calls are made!", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "GObject", ".", "threads_init", "(", ")", "dbus", ".", "mainloop", ".", "glib", ".", "threads_init", "(", ")", "arg_0", ".", "_mainloop", "=", "dbus", ".", "mainloop", ".", "glib", ".", "DBusGMainLoop", "(", "set_as_default", "=", "True", ")", "arg_0", ".", "_bus", "=", "dbus", ".", "SystemBus", "(", ")", "arg_0", ".", "_bluez", "=", "dbus", ".", "Interface", "(", "arg_0", ".", "_bus", ".", "get_object", "(", "'org.bluez'", ",", "'/'", ")", ",", "'org.freedesktop.DBus.ObjectManager'", ")"], "function": "def Func(arg_0):\n        \"\"\"Initialize bluez DBus communication.  Must be called before any other\n        calls are made!\n        \"\"\"\n        # Ensure GLib's threading is Funcd to support python threads, and\n        # make a default mainloop that all DBus objects will inherit.  These\n        # commands MUST execute before any other DBus commands!\n        GObject.threads_init()\n        dbus.mainloop.glib.threads_init()\n        # Set the default main loop, this also MUST happen before other DBus calls.\n        arg_0._mainloop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n        # Get the main DBus system bus and root bluez object.\n        arg_0._bus = dbus.SystemBus()\n        arg_0._bluez = dbus.Interface(arg_0._bus.get_object('org.bluez', '/'),\n                                     'org.freedesktop.DBus.ObjectManager')", "path": "Adafruit_BluefruitLE/bluez_dbus/provider.py", "identifier": "BluezProvider.initialize", "docstring": "Initialize bluez DBus communication.  Must be called before any other\n        calls are made!", "docstring_tokens": ["Initialize", "bluez", "DBus", "communication", ".", "Must", "be", "called", "before", "any", "other", "calls", "are", "made!"], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 252567}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/cli/parsing_helpers.py#L17-L37", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Parses a string of numbers and ranges into a list of integers. Ranges\n    are separated by dashes and inclusive of both the start and end number.", "language": "python", "parameters": "(string)", "return_statement": "return integers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "split", "(", "\",\"", ")", ":", "for", "arg_3", "in", "arg_2", ".", "split", "(", "\" \"", ")", ":", "if", "len", "(", "arg_3", ")", "==", "0", ":", "continue", "if", "\"-\"", "in", "arg_3", ":", "arg_4", ",", "arg_5", "=", "arg_3", ".", "split", "(", "\"-\"", ")", "arg_6", "=", "int", "(", "arg_4", ".", "strip", "(", ")", ")", "arg_7", "=", "int", "(", "arg_5", ".", "strip", "(", ")", ")", "arg_1", ".", "extend", "(", "range", "(", "arg_6", ",", "arg_7", "+", "1", ")", ")", "else", ":", "arg_1", ".", "append", "(", "int", "(", "arg_3", ".", "strip", "(", ")", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Parses a string of numbers and ranges into a list of integers. Ranges\n    are separated by dashes and inclusive of both the start and end number.\n\n    Example:\n        Func(\"8 9 10,11-13\") == [8,9,10,11,12,13]\n    \"\"\"\n    arg_1 = []\n    for arg_2 in arg_0.split(\",\"):\n        for arg_3 in arg_2.split(\" \"):\n            if len(arg_3) == 0:\n                continue\n            if \"-\" in arg_3:\n                arg_4, arg_5 = arg_3.split(\"-\")\n                arg_6 = int(arg_4.strip())\n                arg_7 = int(arg_5.strip())\n                arg_1.extend(range(arg_6, arg_7 + 1))\n            else:\n                arg_1.append(int(arg_3.strip()))\n    return arg_1", "path": "mhctools/cli/parsing_helpers.py", "identifier": "parse_int_list", "docstring": "Parses a string of numbers and ranges into a list of integers. Ranges\n    are separated by dashes and inclusive of both the start and end number.\n\n    Example:\n        parse_int_list(\"8 9 10,11-13\") == [8,9,10,11,12,13]", "docstring_tokens": ["Parses", "a", "string", "of", "numbers", "and", "ranges", "into", "a", "list", "of", "integers", ".", "Ranges", "are", "separated", "by", "dashes", "and", "inclusive", "of", "both", "the", "start", "and", "end", "number", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 252568}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/trimmomatic.py#L242-L262", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Cleans the working directory of unwanted temporary files", "language": "python", "parameters": "(fastq_pairs, clear)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "f", "for", "f", "in", "os", ".", "listdir", "(", "\".\"", ")", "if", "f", ".", "endswith", "(", "\"_U.fastq.gz\"", ")", "]", "for", "arg_3", "in", "arg_2", ":", "os", ".", "remove", "(", "arg_3", ")", "arg_4", "=", "[", "f", "for", "f", "in", "os", ".", "listdir", "(", "\".\"", ")", "if", "f", ".", "endswith", "(", "\"_trim.fastq.gz\"", ")", "]", "if", "arg_1", "==", "\"true\"", "and", "len", "(", "arg_4", ")", "==", "2", ":", "for", "arg_5", "in", "arg_0", ":", "arg_6", "=", "os", ".", "path", ".", "realpath", "(", "arg_5", ")", "logger", ".", "debug", "(", "\"Removing temporary fastq file path: {}\"", ".", "format", "(", "arg_6", ")", ")", "if", "re", ".", "match", "(", "\".*/work/.{2}/.{30}/.*\"", ",", "arg_6", ")", ":", "os", ".", "remove", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Cleans the working directory of unwanted temporary files\"\"\"\n\n    # Find unpaired fastq files\n    arg_2 = [f for f in os.listdir(\".\")\n                      if f.endswith(\"_U.fastq.gz\")]\n\n    # Remove unpaired fastq files, if any\n    for arg_3 in arg_2:\n        os.remove(arg_3)\n\n    # Expected output to assess whether it is safe to remove temporary input\n    arg_4 = [f for f in os.listdir(\".\") if f.endswith(\"_trim.fastq.gz\")]\n\n    if arg_1 == \"true\" and len(arg_4) == 2:\n        for arg_5 in arg_0:\n            # Get real path of fastq files, following symlinks\n            arg_6 = os.path.realpath(arg_5)\n            logger.debug(\"Removing temporary fastq file path: {}\".format(arg_6))\n            if re.match(\".*/work/.{2}/.{30}/.*\", arg_6):\n                os.remove(arg_6)", "path": "flowcraft/templates/trimmomatic.py", "identifier": "clean_up", "docstring": "Cleans the working directory of unwanted temporary files", "docstring_tokens": ["Cleans", "the", "working", "directory", "of", "unwanted", "temporary", "files"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 252569}
{"url": "https://github.com/Diaoul/pyjulius/blob/48f2752ff4e0f3bd7b578754b1c583cabdc24b09/pyjulius/core.py#L144-L154", "sha": "48f2752ff4e0f3bd7b578754b1c583cabdc24b09", "docstring_summary": "Send a command to the server", "language": "python", "parameters": "(self, command, timeout=5)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "5", ")", ":", "logger", ".", "info", "(", "u'Sending %s'", "%", "arg_1", ")", "arg_3", ",", "arg_4", ",", "arg_5", "=", "select", ".", "select", "(", "[", "]", ",", "[", "arg_0", ".", "sock", "]", ",", "[", "]", ",", "arg_2", ")", "if", "not", "arg_4", ":", "raise", "SendTimeoutError", "(", ")", "arg_4", "[", "0", "]", ".", "Funcall", "(", "arg_1", "+", "'\\n'", ")"], "function": "def Func(arg_0, arg_1, arg_2=5):\n        \"\"\"Send a command to the server\n\n        :param string command: command to Func\n\n        \"\"\"\n        logger.info(u'Sending %s' % arg_1)\n        arg_3, arg_4, arg_5 = select.select([], [arg_0.sock], [], arg_2)\n        if not arg_4:\n            raise SendTimeoutError()\n        arg_4[0].Funcall(arg_1 + '\\n')", "path": "pyjulius/core.py", "identifier": "Client.send", "docstring": "Send a command to the server\n\n        :param string command: command to send", "docstring_tokens": ["Send", "a", "command", "to", "the", "server"], "nwo": "Diaoul/pyjulius", "score": 0.19386116706877685, "idx": 252570}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/volume.py#L20-L41", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Converts a voxel list to an ndarray.", "language": "python", "parameters": "(voxels)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "len", "(", "arg_0", "[", "0", "]", ")", "for", "arg_2", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "size", ".", "append", "(", "max", "(", "[", "arg_3", "[", "arg_2", "]", "for", "arg_3", "in", "arg_0", "]", ")", ")", "arg_4", "=", "numpy", ".", "zeros", "(", "arg_1", ")", "for", "arg_5", "in", "arg_0", ":", "arg_4", "[", "arg_5", "]", "=", "1", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"\n    Converts a voxel list to an ndarray.\n\n    Arguments:\n        voxels (tuple[]): A list of coordinates indicating coordinates of\n            populated voxels in an ndarray.\n\n    Returns:\n        numpy.ndarray The result of the transformation.\n    \"\"\"\n    arg_1 = len(arg_0[0])\n\n    for arg_2 in range(len(arg_1)):\n        size.append(max([arg_3[arg_2] for arg_3 in arg_0]))\n\n    arg_4 = numpy.zeros(arg_1)\n\n    for arg_5 in arg_0:\n        arg_4[arg_5] = 1\n\n    return arg_4", "path": "ndio/convert/volume.py", "identifier": "from_voxels", "docstring": "Converts a voxel list to an ndarray.\n\n    Arguments:\n        voxels (tuple[]): A list of coordinates indicating coordinates of\n            populated voxels in an ndarray.\n\n    Returns:\n        numpy.ndarray The result of the transformation.", "docstring_tokens": ["Converts", "a", "voxel", "list", "to", "an", "ndarray", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 252571}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L327-L357", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Converts a hms string into seconds.", "language": "python", "parameters": "(s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "\"-\"", ":", "return", "0", "if", "arg_0", ".", "endswith", "(", "\"ms\"", ")", ":", "return", "float", "(", "arg_0", ".", "rstrip", "(", "\"ms\"", ")", ")", "/", "1000", "arg_1", "=", "list", "(", "map", "(", "float", ",", "re", ".", "split", "(", "\"[dhms]\"", ",", "arg_0", ")", "[", ":", "-", "1", "]", ")", ")", "if", "len", "(", "arg_1", ")", "==", "4", ":", "return", "arg_1", "[", "0", "]", "*", "24", "*", "3600", "+", "arg_1", "[", "1", "]", "*", "3600", "+", "arg_1", "[", "2", "]", "*", "60", "+", "arg_1", "[", "3", "]", "if", "len", "(", "arg_1", ")", "==", "3", ":", "return", "arg_1", "[", "0", "]", "*", "3600", "+", "arg_1", "[", "1", "]", "*", "60", "+", "arg_1", "[", "2", "]", "elif", "len", "(", "arg_1", ")", "==", "2", ":", "return", "arg_1", "[", "0", "]", "*", "60", "+", "arg_1", "[", "1", "]", "else", ":", "return", "arg_1", "[", "0", "]"], "function": "def Func(arg_0):\n        \"\"\"Converts a hms string into seconds.\n\n        Parameters\n        ----------\n        s : str\n            The hms string can be something like '20s', '1m30s' or '300ms'.\n\n        Returns\n        -------\n        float\n            Time in seconds.\n\n        \"\"\"\n\n        if arg_0 == \"-\":\n            return 0\n\n        if arg_0.endswith(\"ms\"):\n            return float(arg_0.rstrip(\"ms\")) / 1000\n\n        arg_1 = list(map(float, re.split(\"[dhms]\", arg_0)[:-1]))\n        if len(arg_1) == 4:\n            return arg_1[0] * 24 * 3600 + arg_1[1] * 3600 + arg_1[2] * 60 +\\\n                arg_1[3]\n        if len(arg_1) == 3:\n            return arg_1[0] * 3600 + arg_1[1] * 60 + arg_1[2]\n        elif len(arg_1) == 2:\n            return arg_1[0] * 60 + arg_1[1]\n        else:\n            return arg_1[0]", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector._hms", "docstring": "Converts a hms string into seconds.\n\n        Parameters\n        ----------\n        s : str\n            The hms string can be something like '20s', '1m30s' or '300ms'.\n\n        Returns\n        -------\n        float\n            Time in seconds.", "docstring_tokens": ["Converts", "a", "hms", "string", "into", "seconds", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 252572}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L178-L216", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "generate a generic flat file html for an ABF parent. You could give\n        this a single ABF ID, its parent ID, or a list of ABF IDs.\n        If a child ABF is given, the parent will automatically be used.", "language": "python", "parameters": "(self,abfID,launch=False,overwrite=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "if", "type", "(", "arg_1", ")", "is", "str", ":", "arg_1", "=", "[", "arg_1", "]", "for", "arg_4", "in", "cm", ".", "abfSort", "(", "arg_1", ")", ":", "arg_5", "=", "cm", ".", "parent", "(", "arg_0", ".", "groups", ",", "arg_4", ")", "arg_6", "=", "os", ".", "path", ".", "abspath", "(", "\"%s/%s_basic.html\"", "%", "(", "arg_0", ".", "folder2", ",", "arg_5", ")", ")", "if", "arg_3", "is", "False", "and", "os", ".", "path", ".", "basename", "(", "arg_6", ")", "in", "arg_0", ".", "files2", ":", "continue", "arg_7", "=", "cm", ".", "filesByType", "(", "arg_0", ".", "groupFiles", "[", "arg_5", "]", ")", "arg_8", "=", "\"\"", "arg_8", "+=", "'<div style=\"background-color: #DDDDDD;\">'", "arg_8", "+=", "'<span class=\"title\">summary of data from: %s</span></br>'", "%", "arg_5", "arg_8", "+=", "'<code>%s</code>'", "%", "os", ".", "path", ".", "abspath", "(", "arg_0", ".", "folder1", "+", "\"/\"", "+", "arg_5", "+", "\".abf\"", ")", "arg_8", "+=", "'</div>'", "arg_9", "=", "[", "\"experiment\"", ",", "\"plot\"", ",", "\"tif\"", ",", "\"other\"", "]", "arg_10", "=", "cm", ".", "list_order_by", "(", "arg_7", ".", "keys", "(", ")", ",", "arg_9", ")", "for", "arg_11", "in", "[", "x", "for", "x", "in", "arg_10", "if", "len", "(", "arg_7", "[", "x", "]", ")", "]", ":", "if", "arg_11", "==", "'experiment'", ":", "arg_8", "+=", "\"<h3>Experimental Data:</h3>\"", "elif", "arg_11", "==", "'plot'", ":", "arg_8", "+=", "\"<h3>Intrinsic Properties:</h3>\"", "elif", "arg_11", "==", "'tif'", ":", "arg_8", "+=", "\"<h3>Micrographs:</h3>\"", "elif", "arg_11", "==", "'other'", ":", "arg_8", "+=", "\"<h3>Additional Files:</h3>\"", "else", ":", "arg_8", "+=", "\"<h3>????:</h3>\"", "for", "arg_12", "in", "arg_7", "[", "arg_11", "]", ":", "arg_8", "+=", "arg_0", ".", "htmlFor", "(", "arg_12", ")", "arg_8", "+=", "'<br>'", "*", "3", "print", "(", "\"creating\"", ",", "arg_6", ",", "'...'", ")", "style", ".", "save", "(", "arg_8", ",", "arg_6", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0,arg_1,arg_2=False,arg_3=False):\n        \"\"\"\n        generate a generic flat file html for an ABF parent. You could give\n        this a single ABF ID, its parent ID, or a list of ABF IDs.\n        If a child ABF is given, the parent will automatically be used.\n        \"\"\"\n        if type(arg_1) is str:\n            arg_1=[arg_1]\n        for arg_4 in cm.abfSort(arg_1):\n            arg_5=cm.parent(arg_0.groups,arg_4)\n            arg_6=os.path.abspath(\"%s/%s_basic.html\"%(arg_0.folder2,arg_5))\n            if arg_3 is False and os.path.basename(arg_6) in arg_0.files2:\n                continue\n            arg_7=cm.filesByType(arg_0.groupFiles[arg_5])\n            arg_8=\"\"\n            arg_8+='<div style=\"background-color: #DDDDDD;\">'\n            arg_8+='<span class=\"title\">summary of data from: %s</span></br>'%arg_5\n            arg_8+='<code>%s</code>'%os.path.abspath(arg_0.folder1+\"/\"+arg_5+\".abf\")\n            arg_8+='</div>'\n            arg_9=[\"experiment\",\"plot\",\"tif\",\"other\"]\n            arg_10=cm.list_order_by(arg_7.keys(),arg_9)\n            for arg_11 in [x for x in arg_10 if len(arg_7[x])]:\n                if arg_11=='experiment':\n                    arg_8+=\"<h3>Experimental Data:</h3>\"\n                elif arg_11=='plot':\n                    arg_8+=\"<h3>Intrinsic Properties:</h3>\"\n                elif arg_11=='tif':\n                    arg_8+=\"<h3>Micrographs:</h3>\"\n                elif arg_11=='other':\n                    arg_8+=\"<h3>Additional Files:</h3>\"\n                else:\n                    arg_8+=\"<h3>????:</h3>\"\n                #html+=\"<hr>\"\n                #html+='<br>'*3\n                for arg_12 in arg_7[arg_11]:\n                    arg_8+=arg_0.htmlFor(arg_12)\n                arg_8+='<br>'*3\n            print(\"creating\",arg_6,'...')\n            style.save(arg_8,arg_6,arg_2=arg_2)", "path": "swhlab/indexing/indexing.py", "identifier": "INDEX.html_single_basic", "docstring": "generate a generic flat file html for an ABF parent. You could give\n        this a single ABF ID, its parent ID, or a list of ABF IDs.\n        If a child ABF is given, the parent will automatically be used.", "docstring_tokens": ["generate", "a", "generic", "flat", "file", "html", "for", "an", "ABF", "parent", ".", "You", "could", "give", "this", "a", "single", "ABF", "ID", "its", "parent", "ID", "or", "a", "list", "of", "ABF", "IDs", ".", "If", "a", "child", "ABF", "is", "given", "the", "parent", "will", "automatically", "be", "used", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 252573}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L16-L25", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Helper function to append functions into a given list.", "language": "python", "parameters": "(target, items)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "[", "arg_0", ".", "append", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "if", "isfunction", "(", "arg_2", ")", "or", "ismethod", "(", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Helper function to append functions into a given list.\n\n    Arguments:\n        target (list): receptor list to append functions.\n        items (iterable): iterable that yields elements to append.\n    \"\"\"\n    [arg_0.append(arg_2) for arg_2 in arg_1\n     if isfunction(arg_2) or ismethod(arg_2)]", "path": "pook/mock.py", "identifier": "_append_funcs", "docstring": "Helper function to append functions into a given list.\n\n    Arguments:\n        target (list): receptor list to append functions.\n        items (iterable): iterable that yields elements to append.", "docstring_tokens": ["Helper", "function", "to", "append", "functions", "into", "a", "given", "list", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 252574}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/terms.py#L25-L31", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return a term resource for the passed SIS ID.", "language": "python", "parameters": "(self, sis_term_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "get_all_terms", "(", ")", ":", "if", "arg_2", ".", "sis_term_id", "==", "arg_1", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a term resource for the passed SIS ID.\n        \"\"\"\n        for arg_2 in arg_0.get_all_terms():\n            if arg_2.sis_term_id == arg_1:\n                return arg_2", "path": "uw_canvas/terms.py", "identifier": "Terms.get_term_by_sis_id", "docstring": "Return a term resource for the passed SIS ID.", "docstring_tokens": ["Return", "a", "term", "resource", "for", "the", "passed", "SIS", "ID", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 252575}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/core/missing.py#L30-L42", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Update number of trials for missing values", "language": "python", "parameters": "(**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "arg_1", "=", "os", ".", "environ", ".", "get", "(", "BBG_ROOT", ",", "''", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", "if", "not", "arg_1", ":", "return", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "arg_2", "=", "f'{data_path}/Logs/{missing_info(**kwargs)}'", "arg_3", "=", "len", "(", "files", ".", "all_files", "(", "arg_2", ")", ")", "+", "1", "files", ".", "create_folder", "(", "arg_2", ")", "open", "(", "f'{log_path}/{cnt}.log'", ",", "'a'", ")", ".", "close", "(", ")"], "function": "def Func(**arg_0):\n    \"\"\"\n    Update number of trials for missing values\n    \"\"\"\n    arg_1 = os.environ.get(BBG_ROOT, '').replace('\\\\', '/')\n    if not arg_1: return\n    if len(arg_0) == 0: return\n\n    arg_2 = f'{data_path}/Logs/{missing_info(**kwargs)}'\n\n    arg_3 = len(files.all_files(arg_2)) + 1\n    files.create_folder(arg_2)\n    open(f'{log_path}/{cnt}.log', 'a').close()", "path": "xbbg/core/missing.py", "identifier": "update_missing", "docstring": "Update number of trials for missing values", "docstring_tokens": ["Update", "number", "of", "trials", "for", "missing", "values"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 252576}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/grpc_hook.py#L112-L123", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Fetches a field from extras, and returns it. This is some Airflow\n        magic. The grpc hook type adds custom UI elements\n        to the hook page, which allow admins to specify scopes, credential pem files, etc.\n        They get formatted as shown below.", "language": "python", "parameters": "(self, field_name, default=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "'extra__grpc__{}'", ".", "format", "(", "arg_1", ")", "if", "arg_3", "in", "arg_0", ".", "extras", ":", "return", "arg_0", ".", "extras", "[", "arg_3", "]", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Fetches a field from extras, and returns it. This is some Airflow\n        magic. The grpc hook type adds custom UI elements\n        to the hook page, which allow admins to specify scopes, credential pem files, etc.\n        They get formatted as shown below.\n        \"\"\"\n        arg_3 = 'extra__grpc__{}'.format(arg_1)\n        if arg_3 in arg_0.extras:\n            return arg_0.extras[arg_3]\n        else:\n            return arg_2", "path": "airflow/contrib/hooks/grpc_hook.py", "identifier": "GrpcHook._get_field", "docstring": "Fetches a field from extras, and returns it. This is some Airflow\n        magic. The grpc hook type adds custom UI elements\n        to the hook page, which allow admins to specify scopes, credential pem files, etc.\n        They get formatted as shown below.", "docstring_tokens": ["Fetches", "a", "field", "from", "extras", "and", "returns", "it", ".", "This", "is", "some", "Airflow", "magic", ".", "The", "grpc", "hook", "type", "adds", "custom", "UI", "elements", "to", "the", "hook", "page", "which", "allow", "admins", "to", "specify", "scopes", "credential", "pem", "files", "etc", ".", "They", "get", "formatted", "as", "shown", "below", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252577}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L1950-L2064", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a parallel driver for `periodicvar_recovery`.", "language": "python", "parameters": "(simbasedir,\n                                  period_tolerance=1.0e-3,\n                                  liststartind=None,\n                                  listmaxobjects=None,\n                                  nworkers=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1.0e-3", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'periodfinding'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "LOGERROR", "(", "'no \"periodfinding\" subdirectory in %s, can\\'t continue'", "%", "arg_0", ")", "return", "None", "arg_6", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'*periodfinding*pkl*'", ")", ")", "if", "len", "(", "arg_6", ")", ">", "0", ":", "if", "arg_2", ":", "arg_6", "=", "arg_6", "[", "arg_2", ":", "]", "if", "arg_3", ":", "arg_6", "=", "arg_6", "[", ":", "arg_3", "]", "arg_7", "=", "[", "(", "x", ",", "arg_0", ",", "arg_1", ")", "for", "x", "in", "arg_6", "]", "arg_8", "=", "mp", ".", "Pool", "(", "arg_4", ")", "arg_9", "=", "arg_8", ".", "map", "(", "periodrec_worker", ",", "arg_7", ")", "arg_8", ".", "close", "(", ")", "arg_8", ".", "join", "(", ")", "arg_10", "=", "{", "x", "[", "'objectid'", "]", ":", "x", "for", "x", "in", "arg_9", "if", "x", "is", "not", "None", "}", "arg_11", "=", "np", ".", "array", "(", "[", "x", "[", "'objectid'", "]", "for", "x", "in", "arg_9", "if", "(", "x", "is", "not", "None", "and", "x", "[", "'actual_vartype'", "]", "in", "PERIODIC_VARTYPES", ")", "]", ",", "dtype", "=", "np", ".", "unicode_", ")", "arg_12", "=", "np", ".", "array", "(", "[", "x", "[", "'objectid'", "]", "for", "x", "in", "arg_9", "if", "(", "x", "is", "not", "None", "and", "'actual'", "in", "x", "[", "'best_recovered_status'", "]", ")", "]", ",", "dtype", "=", "np", ".", "unicode_", ")", "arg_13", "=", "np", ".", "array", "(", "[", "x", "[", "'objectid'", "]", "for", "x", "in", "arg_9", "if", "(", "x", "is", "not", "None", "and", "'twice'", "in", "x", "[", "'best_recovered_status'", "]", ")", "]", ",", "dtype", "=", "np", ".", "unicode_", ")", "arg_14", "=", "np", ".", "array", "(", "[", "x", "[", "'objectid'", "]", "for", "x", "in", "arg_9", "if", "(", "x", "is", "not", "None", "and", "'half'", "in", "x", "[", "'best_recovered_status'", "]", ")", "]", ",", "dtype", "=", "np", ".", "unicode_", ")", "arg_15", "=", "[", "x", "[", "'objectid'", "]", "for", "x", "in", "arg_9", "]", "arg_16", "=", "{", "'simbasedir'", ":", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", ",", "'objectids'", ":", "arg_15", ",", "'period_tolerance'", ":", "arg_1", ",", "'actual_periodicvars'", ":", "arg_11", ",", "'recovered_periodicvars'", ":", "arg_12", ",", "'alias_twice_periodicvars'", ":", "arg_13", ",", "'alias_half_periodicvars'", ":", "arg_14", ",", "'details'", ":", "arg_10", "}", "arg_17", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'periodicvar-recovery.pkl'", ")", "with", "open", "(", "arg_17", ",", "'wb'", ")", "as", "outfd", ":", "pickle", ".", "dump", "(", "arg_16", ",", "outfd", ",", "pickle", ".", "HIGHEST_PROTOCOL", ")", "return", "arg_16", "else", ":", "LOGERROR", "(", "'no periodfinding result pickles found in %s, can\\'t continue'", "%", "arg_5", ")", "return", "None"], "function": "def Func(arg_0,\n                                  arg_1=1.0e-3,\n                                  arg_2=None,\n                                  arg_3=None,\n                                  arg_4=None):\n    '''This is a parallel driver for `periodicvar_recovery`.\n\n    Parameters\n    ----------\n\n    simbasedir : str\n        The base directory where all of the fake LCs and period-finding results\n        are.\n\n    period_tolerance : float\n        The maximum difference that this function will consider between an\n        actual period (or its aliases) and a recovered period to consider it as\n        as a 'recovered' period.\n\n    liststartindex : int\n        The starting index of processing. This refers to the filename list\n        generated by running `glob.glob` on the period-finding result pickles in\n        `simbasedir/periodfinding`.\n\n    listmaxobjects : int\n        The maximum number of objects to process in this run. Use this with\n        `liststartindex` to effectively distribute working on a large list of\n        input period-finding result pickles over several sessions or machines.\n\n    nperiodworkers : int\n        This is the number of parallel period-finding worker processes to use.\n\n    Returns\n    -------\n\n    str\n        Returns the filename of the pickle produced containing all of the period\n        recovery results.\n\n    '''\n\n    # figure out the periodfinding pickles directory\n    arg_5 = os.path.join(arg_0,'periodfinding')\n\n    if not os.path.exists(arg_5):\n        LOGERROR('no \"periodfinding\" subdirectory in %s, can\\'t continue' %\n                 arg_0)\n        return None\n\n    # find all the periodfinding pickles\n    arg_6 = glob.glob(os.path.join(arg_5,'*periodfinding*pkl*'))\n\n    if len(arg_6) > 0:\n\n        if arg_2:\n            arg_6 = arg_6[arg_2:]\n\n        if arg_3:\n            arg_6 = arg_6[:arg_3]\n\n        arg_7 = [(x, arg_0, arg_1) for x in arg_6]\n\n        arg_8 = mp.Pool(arg_4)\n        arg_9 = arg_8.map(periodrec_worker, arg_7)\n        arg_8.close()\n        arg_8.join()\n\n        arg_10 = {x['objectid']:x for x in arg_9 if x is not None}\n\n        arg_11 = np.array(\n            [x['objectid'] for x in arg_9\n             if (x is not None and x['actual_vartype'] in PERIODIC_VARTYPES)],\n            dtype=np.unicode_\n        )\n\n        arg_12 = np.array(\n            [x['objectid'] for x in arg_9\n             if (x is not None and 'actual' in x['best_recovered_status'])],\n            dtype=np.unicode_\n        )\n        arg_13 = np.array(\n            [x['objectid'] for x in arg_9\n             if (x is not None and 'twice' in x['best_recovered_status'])],\n            dtype=np.unicode_\n        )\n        arg_14 = np.array(\n            [x['objectid'] for x in arg_9\n             if (x is not None and 'half' in x['best_recovered_status'])],\n            dtype=np.unicode_\n        )\n\n        arg_15 = [x['objectid'] for x in arg_9]\n\n        arg_16 = {'simbasedir':os.path.abspath(arg_0),\n                   'objectids':arg_15,\n                   'period_tolerance':arg_1,\n                   'actual_periodicvars':arg_11,\n                   'recovered_periodicvars':arg_12,\n                   'alias_twice_periodicvars':arg_13,\n                   'alias_half_periodicvars':arg_14,\n                   'details':arg_10}\n\n        arg_17 = os.path.join(arg_0,'periodicvar-recovery.pkl')\n        with open(arg_17, 'wb') as outfd:\n            pickle.dump(arg_16, outfd, pickle.HIGHEST_PROTOCOL)\n\n        return arg_16\n\n    else:\n\n        LOGERROR(\n            'no periodfinding result pickles found in %s, can\\'t continue' %\n            arg_5\n        )\n        return None", "path": "astrobase/fakelcs/recovery.py", "identifier": "parallel_periodicvar_recovery", "docstring": "This is a parallel driver for `periodicvar_recovery`.\n\n    Parameters\n    ----------\n\n    simbasedir : str\n        The base directory where all of the fake LCs and period-finding results\n        are.\n\n    period_tolerance : float\n        The maximum difference that this function will consider between an\n        actual period (or its aliases) and a recovered period to consider it as\n        as a 'recovered' period.\n\n    liststartindex : int\n        The starting index of processing. This refers to the filename list\n        generated by running `glob.glob` on the period-finding result pickles in\n        `simbasedir/periodfinding`.\n\n    listmaxobjects : int\n        The maximum number of objects to process in this run. Use this with\n        `liststartindex` to effectively distribute working on a large list of\n        input period-finding result pickles over several sessions or machines.\n\n    nperiodworkers : int\n        This is the number of parallel period-finding worker processes to use.\n\n    Returns\n    -------\n\n    str\n        Returns the filename of the pickle produced containing all of the period\n        recovery results.", "docstring_tokens": ["This", "is", "a", "parallel", "driver", "for", "periodicvar_recovery", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252578}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fir_design_helper.py#L327-L350", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Design an FIR highpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass Hz, fstop Hz, and the desired passband ripple \r\n    d_pass dB and stopband attenuation d_stop dB all \r\n    relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "language": "python", "parameters": "(f_stop, f_pass, d_pass, d_stop, fs = 1.0, N_bump=5)", "return_statement": "return b", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "1.0", ",", "arg_5", "=", "5", ")", ":", "arg_6", "=", "arg_4", "/", "2.", "-", "arg_1", "arg_7", "=", "arg_4", "/", "2.", "-", "arg_0", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "lowpass_order", "(", "arg_6", ",", "arg_7", ",", "arg_2", ",", "arg_3", ",", "fsamp", "=", "arg_4", ")", "arg_12", "=", "arg_8", "arg_12", "+=", "arg_5", "arg_13", "=", "signal", ".", "remez", "(", "arg_12", ",", "arg_9", ",", "arg_10", "[", "0", ":", ":", "2", "]", ",", "arg_11", ",", "Hz", "=", "2", ")", "arg_8", "=", "np", ".", "arange", "(", "len", "(", "arg_13", ")", ")", "arg_13", "*=", "(", "-", "1", ")", "**", "arg_8", "print", "(", "'Remez filter taps = %d.'", "%", "arg_12", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4 = 1.0, arg_5=5):\r\n    \"\"\"\r\n    Design an FIR highpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass Hz, fstop Hz, and the desired passband ripple \r\n    d_pass dB and stopband attenuation d_stop dB all \r\n    relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018\r\n    \"\"\"\r\n    # Transform HPF critical frequencies to lowpass equivalent\r\n    arg_6 = arg_4/2. - arg_1\r\n    arg_7 = arg_4/2. - arg_0\r\n    # Design LPF equivalent\r\n    arg_8, arg_9, arg_10, arg_11 = lowpass_order(arg_6, arg_7, arg_2, arg_3, fsamp=arg_4)\r\n    # Bump up the order by N_bump to bring down the final d_pass & d_stop\r\n    arg_12 = arg_8\r\n    arg_12 += arg_5\r\n    arg_13 = signal.remez(arg_12, arg_9, arg_10[0::2], arg_11,Hz=2)\r\n    # Transform LPF equivalent to HPF\r\n    arg_8 = np.arange(len(arg_13))\r\n    arg_13 *= (-1)**arg_8\r\n    print('Remez filter taps = %d.' % arg_12)\r\n    return arg_13", "path": "sk_dsp_comm/fir_design_helper.py", "identifier": "fir_remez_hpf", "docstring": "Design an FIR highpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass Hz, fstop Hz, and the desired passband ripple \r\n    d_pass dB and stopband attenuation d_stop dB all \r\n    relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "docstring_tokens": ["Design", "an", "FIR", "highpass", "filter", "using", "remez", "with", "order", "determination", ".", "The", "filter", "order", "is", "determined", "based", "on", "f_pass", "Hz", "fstop", "Hz", "and", "the", "desired", "passband", "ripple", "d_pass", "dB", "and", "stopband", "attenuation", "d_stop", "dB", "all", "relative", "to", "a", "sampling", "rate", "of", "fs", "Hz", ".", "Mark", "Wickert", "October", "2016", "updated", "October", "2018"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 252579}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmlexer.py#L68-L73", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Push a PLY lexer on the stack to parse filename.", "language": "python", "parameters": "(self, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "lexer", ".", "qasm_file", "=", "arg_0", ".", "filename", "arg_0", ".", "lexer", ".", "qasm_line", "=", "arg_0", ".", "lineno", "arg_0", ".", "stack", ".", "append", "(", "arg_0", ".", "lexer", ")", "arg_0", ".", "__mklexer__", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Push a PLY lexer on the stack to parse filename.\"\"\"\n        arg_0.lexer.qasm_file = arg_0.filename\n        arg_0.lexer.qasm_line = arg_0.lineno\n        arg_0.stack.append(arg_0.lexer)\n        arg_0.__mklexer__(arg_1)", "path": "qiskit/qasm/qasmlexer.py", "identifier": "QasmLexer.push", "docstring": "Push a PLY lexer on the stack to parse filename.", "docstring_tokens": ["Push", "a", "PLY", "lexer", "on", "the", "stack", "to", "parse", "filename", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252580}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/floating_ips.py#L610-L635", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Retrieve a list of scaling ips.", "language": "python", "parameters": "(context, filters=None, fields=None, sorts=['id'],\n                   limit=None, marker=None, page_reverse=False)", "return_statement": "return [v._make_scaling_ip_dict(scip) for scip in scaling_ips]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "[", "'id'", "]", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "LOG", ".", "info", "(", "'Func for tenant %s filters %s fields %s'", "%", "(", "arg_0", ".", "tenant_id", ",", "arg_1", ",", "arg_2", ")", ")", "arg_7", "=", "_get_ips_by_type", "(", "arg_0", ",", "ip_types", ".", "SCALING", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "[", "v", ".", "_make_scaling_ip_dict", "(", "arg_8", ")", "for", "arg_8", "in", "arg_7", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=['id'],\n                   arg_4=None, arg_5=None, arg_6=False):\n    \"\"\"Retrieve a list of scaling ips.\n\n    :param context: neutron api request context.\n    :param filters: a dictionary with keys that are valid keys for\n        a scaling ip as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictionary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n    :param fields: a list of strings that are valid keys in a\n        scaling IP dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n\n    :returns: List of scaling IPs that are accessible to the tenant who\n        submits the request (as indicated by the tenant id of the context)\n        as well as any filters.\n    \"\"\"\n    LOG.info('Func for tenant %s filters %s fields %s' %\n             (arg_0.tenant_id, arg_1, arg_2))\n    arg_7 = _get_ips_by_type(arg_0, ip_types.SCALING,\n                                   arg_1=arg_1, arg_2=arg_2)\n    return [v._make_scaling_ip_dict(arg_8) for arg_8 in arg_7]", "path": "quark/plugin_modules/floating_ips.py", "identifier": "get_scalingips", "docstring": "Retrieve a list of scaling ips.\n\n    :param context: neutron api request context.\n    :param filters: a dictionary with keys that are valid keys for\n        a scaling ip as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictionary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n    :param fields: a list of strings that are valid keys in a\n        scaling IP dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n\n    :returns: List of scaling IPs that are accessible to the tenant who\n        submits the request (as indicated by the tenant id of the context)\n        as well as any filters.", "docstring_tokens": ["Retrieve", "a", "list", "of", "scaling", "ips", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 252581}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/ternya.py#L165-L183", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "Init openstack glance mq", "language": "python", "parameters": "(self, mq)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "enable_component_notification", "(", "Openstack", ".", "Glance", ")", ":", "log", ".", "debug", "(", "\"disable listening glance notification\"", ")", "return", "for", "arg_2", "in", "range", "(", "arg_0", ".", "config", ".", "glance_mq_consumer_count", ")", ":", "arg_1", ".", "create_consumer", "(", "arg_0", ".", "config", ".", "glance_mq_exchange", ",", "arg_0", ".", "config", ".", "glance_mq_queue", ",", "ProcessFactory", ".", "process", "(", "Openstack", ".", "Glance", ")", ")", "log", ".", "debug", "(", "\"enable listening openstack glance notification.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Init openstack glance mq\n\n        1. Check if enable listening glance notification\n        2. Create consumer\n\n        :param mq: class ternya.mq.MQ\n        \"\"\"\n        if not arg_0.enable_component_notification(Openstack.Glance):\n            log.debug(\"disable listening glance notification\")\n            return\n\n        for arg_2 in range(arg_0.config.glance_mq_consumer_count):\n            arg_1.create_consumer(arg_0.config.glance_mq_exchange,\n                               arg_0.config.glance_mq_queue,\n                               ProcessFactory.process(Openstack.Glance))\n\n        log.debug(\"enable listening openstack glance notification.\")", "path": "ternya/ternya.py", "identifier": "Ternya.init_glance_consumer", "docstring": "Init openstack glance mq\n\n        1. Check if enable listening glance notification\n        2. Create consumer\n\n        :param mq: class ternya.mq.MQ", "docstring_tokens": ["Init", "openstack", "glance", "mq"], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 252582}
{"url": "https://github.com/nficano/python-lambda/blob/b0bd25404df70212d7fa057758760366406d64f2/aws_lambda/aws_lambda.py#L272-L366", "sha": "b0bd25404df70212d7fa057758760366406d64f2", "docstring_summary": "Builds the file bundle.", "language": "python", "parameters": "(\n    src, requirements=None, local_package=None,\n    config_file='config.yaml', profile_name=None,\n)", "return_statement": "return path_to_zip_file", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'config.yaml'", ",", "arg_4", "=", "None", ",", ")", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_3", ")", "arg_6", "=", "read_cfg", "(", "arg_5", ",", "arg_4", ")", "arg_7", "=", "arg_6", ".", "get", "(", "'dist_directory'", ",", "'dist'", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_7", ")", "mkdir", "(", "arg_8", ")", "arg_9", "=", "arg_6", ".", "get", "(", "'function_name'", ")", "arg_10", "=", "'{0}-{1}.zip'", ".", "format", "(", "timestamp", "(", ")", ",", "arg_9", ")", "arg_11", "=", "mkdtemp", "(", "prefix", "=", "'aws-lambda'", ")", "pip_install_to_target", "(", "arg_11", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", ")", "if", "'zope'", "in", "os", ".", "listdir", "(", "arg_11", ")", ":", "print", "(", "'Zope packages detected; fixing Zope package paths to '", "'make them importable.'", ",", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_11", ",", "'zope/__init__.py'", ")", ",", "'wb'", ")", ":", "pass", "arg_10", "=", "(", "'{0}.zip'", ".", "format", "(", "arg_10", ")", "if", "not", "arg_10", ".", "endswith", "(", "'.zip'", ")", "else", "arg_10", ")", "arg_12", "=", "defaultdict", "(", "**", "arg_6", ".", "get", "(", "'Func'", ",", "{", "}", ")", ")", "arg_13", "=", "arg_12", ".", "get", "(", "'source_directories'", ",", "''", ")", "arg_13", "=", "(", "arg_13", "if", "arg_13", "is", "not", "None", "else", "''", ")", "arg_14", "=", "[", "d", ".", "strip", "(", ")", "for", "d", "in", "arg_13", ".", "split", "(", "','", ")", "]", "arg_15", "=", "[", "]", "for", "arg_16", "in", "os", ".", "listdir", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_16", ")", ":", "if", "arg_16", "==", "'.DS_Store'", ":", "continue", "if", "arg_16", "==", "arg_3", ":", "continue", "print", "(", "'Bundling: %r'", "%", "arg_16", ")", "arg_15", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_16", ")", ")", "elif", "os", ".", "path", ".", "isdir", "(", "arg_16", ")", "and", "arg_16", "in", "arg_14", ":", "print", "(", "'Bundling directory: %r'", "%", "arg_16", ")", "arg_15", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_16", ")", ")", "os", ".", "chdir", "(", "arg_11", ")", "for", "arg_17", "in", "arg_15", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_17", ")", ":", "arg_18", ",", "arg_16", "=", "os", ".", "path", ".", "split", "(", "arg_17", ")", "copyfile", "(", "arg_17", ",", "os", ".", "path", ".", "join", "(", "arg_11", ",", "arg_16", ")", ")", "copystat", "(", "arg_17", ",", "os", ".", "path", ".", "join", "(", "arg_11", ",", "arg_16", ")", ")", "elif", "os", ".", "path", ".", "isdir", "(", "arg_17", ")", ":", "arg_19", "=", "os", ".", "path", ".", "join", "(", "arg_11", ",", "arg_17", "[", "len", "(", "arg_0", ")", "+", "1", ":", "]", ")", "copytree", "(", "arg_17", ",", "arg_19", ")", "arg_20", "=", "archive", "(", "'./'", ",", "arg_8", ",", "arg_10", ")", "return", "arg_20"], "function": "def Func(\n    arg_0, arg_1=None, arg_2=None,\n    arg_3='config.yaml', arg_4=None,\n):\n    \"\"\"Builds the file bundle.\n\n    :param str src:\n       The path to your Lambda ready project (folder must contain a valid\n        config.yaml and handler module (e.g.: service.py).\n    :param str local_package:\n        The path to a local package with should be included in the deploy as\n        well (and/or is not available on PyPi)\n    \"\"\"\n    # Load and parse the config file.\n    arg_5 = os.path.join(arg_0, arg_3)\n    arg_6 = read_cfg(arg_5, arg_4)\n\n    # Get the absolute path to the output directory and create it if it doesn't\n    # already exist.\n    arg_7 = arg_6.get('dist_directory', 'dist')\n    arg_8 = os.path.join(arg_0, arg_7)\n    mkdir(arg_8)\n\n    # Combine the name of the Lambda function with the current timestamp to use\n    # for the output filename.\n    arg_9 = arg_6.get('function_name')\n    arg_10 = '{0}-{1}.zip'.format(timestamp(), arg_9)\n\n    arg_11 = mkdtemp(prefix='aws-lambda')\n    pip_install_to_target(\n        arg_11,\n        arg_1=arg_1,\n        arg_2=arg_2,\n    )\n\n    # Hack for Zope.\n    if 'zope' in os.listdir(arg_11):\n        print(\n            'Zope packages detected; fixing Zope package paths to '\n            'make them importable.',\n        )\n        # Touch.\n        with open(os.path.join(arg_11, 'zope/__init__.py'), 'wb'):\n            pass\n\n    # Gracefully handle whether \".zip\" was included in the filename or not.\n    arg_10 = (\n        '{0}.zip'.format(arg_10)\n        if not arg_10.endswith('.zip')\n        else arg_10\n    )\n\n    # Allow definition of source code directories we want to Func into our\n    # zipped package.\n    arg_12 = defaultdict(**arg_6.get('Func', {}))\n    arg_13 = arg_12.get('source_directories', '')\n    arg_13 = (\n        arg_13\n        if arg_13 is not None\n        else ''\n    )\n    arg_14 = [\n        d.strip() for d in arg_13.split(',')\n    ]\n\n    arg_15 = []\n    for arg_16 in os.listdir(arg_0):\n        if os.path.isfile(arg_16):\n            if arg_16 == '.DS_Store':\n                continue\n            if arg_16 == arg_3:\n                continue\n            print('Bundling: %r' % arg_16)\n            arg_15.append(os.path.join(arg_0, arg_16))\n        elif os.path.isdir(arg_16) and arg_16 in arg_14:\n            print('Bundling directory: %r' % arg_16)\n            arg_15.append(os.path.join(arg_0, arg_16))\n\n    # \"cd\" into `temp_path` directory.\n    os.chdir(arg_11)\n    for arg_17 in arg_15:\n        if os.path.isfile(arg_17):\n            arg_18, arg_16 = os.path.split(arg_17)\n\n            # Copy handler file into root of the packages folder.\n            copyfile(arg_17, os.path.join(arg_11, arg_16))\n            copystat(arg_17, os.path.join(arg_11, arg_16))\n        elif os.path.isdir(arg_17):\n            arg_19 = os.path.join(arg_11, arg_17[len(arg_0) + 1:])\n            copytree(arg_17, arg_19)\n\n    # Zip them together into a single file.\n    # TODO: Delete temp directory created once the archive has been compiled.\n    arg_20 = archive('./', arg_8, arg_10)\n    return arg_20", "path": "aws_lambda/aws_lambda.py", "identifier": "build", "docstring": "Builds the file bundle.\n\n    :param str src:\n       The path to your Lambda ready project (folder must contain a valid\n        config.yaml and handler module (e.g.: service.py).\n    :param str local_package:\n        The path to a local package with should be included in the deploy as\n        well (and/or is not available on PyPi)", "docstring_tokens": ["Builds", "the", "file", "bundle", "."], "nwo": "nficano/python-lambda", "score": 0.7856642350024847, "idx": 252583}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L890-L902", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Lists all of the service certificates associated with the specified\n        hosted service.", "language": "python", "parameters": "(self, service_name)", "return_statement": "return self._perform_get(\n            '/' + self.subscription_id + '/services/hostedservices/' +\n            _str(service_name) + '/certificates',\n            Certificates)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "return", "arg_0", ".", "_perform_get", "(", "'/'", "+", "arg_0", ".", "subscription_id", "+", "'/services/hostedservices/'", "+", "_str", "(", "arg_1", ")", "+", "'/certificates'", ",", "Certificates", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Lists all of the service certificates associated with the specified\n        hosted service.\n\n        service_name:\n            Name of the hosted service.\n        '''\n        _validate_not_none('service_name', arg_1)\n        return arg_0._perform_get(\n            '/' + arg_0.subscription_id + '/services/hostedservices/' +\n            _str(arg_1) + '/certificates',\n            Certificates)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.list_service_certificates", "docstring": "Lists all of the service certificates associated with the specified\n        hosted service.\n\n        service_name:\n            Name of the hosted service.", "docstring_tokens": ["Lists", "all", "of", "the", "service", "certificates", "associated", "with", "the", "specified", "hosted", "service", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252584}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/utils.py#L533-L542", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Sample a colormap from matplotlib", "language": "python", "parameters": "(cmap_name, n_samples)", "return_statement": "return colors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "cm", ".", "cmap_d", "[", "arg_0", "]", "for", "arg_4", "in", "np", ".", "linspace", "(", "0", ",", "1", ",", "arg_1", ")", ":", "arg_2", ".", "append", "(", "arg_3", "(", "arg_4", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Sample a colormap from matplotlib\n    \"\"\"\n    arg_2 = []\n    arg_3 = cm.cmap_d[arg_0]\n    for arg_4 in np.linspace(0, 1, arg_1):\n        arg_2.append(arg_3(arg_4))\n\n    return arg_2", "path": "pyfolio/utils.py", "identifier": "sample_colormap", "docstring": "Sample a colormap from matplotlib", "docstring_tokens": ["Sample", "a", "colormap", "from", "matplotlib"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 252585}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1181-L1209", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Updates a NIC with the parameters provided.", "language": "python", "parameters": "(self, datacenter_id, server_id,\n                   nic_id, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "{", "}", "for", "arg_6", ",", "arg_7", "in", "arg_4", ".", "items", "(", ")", ":", "arg_5", "[", "arg_0", ".", "_underscore_to_camelcase", "(", "arg_6", ")", "]", "=", "arg_7", "arg_9", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/servers/%s/nics/%s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "method", "=", "'PATCH'", ",", "arg_5", "=", "json", ".", "dumps", "(", "arg_5", ")", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2,\n                   arg_3, **arg_4):\n        \"\"\"\n        Updates a NIC with the parameters provided.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      nic_id: The unique ID of the NIC.\n        :type       nic_id: ``str``\n\n        \"\"\"\n        arg_5 = {}\n\n        for arg_6, arg_7 in arg_4.items():\n            arg_5[arg_0._underscore_to_camelcase(arg_6)] = arg_7\n\n        arg_9 = arg_0._perform_request(\n            url='/datacenters/%s/servers/%s/nics/%s' % (\n                arg_1,\n                arg_2,\n                arg_3),\n            method='PATCH',\n            arg_5=json.dumps(arg_5))\n\n        return arg_9", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.update_nic", "docstring": "Updates a NIC with the parameters provided.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      nic_id: The unique ID of the NIC.\n        :type       nic_id: ``str``", "docstring_tokens": ["Updates", "a", "NIC", "with", "the", "parameters", "provided", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 252586}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L106-L124", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return a disease term", "language": "python", "parameters": "(self, disease_identifier)", "return_statement": "return self.disease_term_collection.find_one(query)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "try", ":", "arg_1", "=", "int", "(", "arg_1", ")", "arg_2", "[", "'disease_nr'", "]", "=", "arg_1", "except", "ValueError", ":", "arg_2", "[", "'_id'", "]", "=", "arg_1", "return", "arg_0", ".", "Func_collection", ".", "find_one", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a disease term\n\n        Checks if the identifier is a disease number or a id\n\n        Args:\n            disease_identifier(str)\n\n        Returns:\n            disease_obj(dict)\n        \"\"\"\n        arg_2 = {}\n        try:\n            arg_1 = int(arg_1)\n            arg_2['disease_nr'] = arg_1\n        except ValueError:\n            arg_2['_id'] = arg_1\n\n        return arg_0.Func_collection.find_one(arg_2)", "path": "scout/adapter/mongo/hpo.py", "identifier": "HpoHandler.disease_term", "docstring": "Return a disease term\n\n        Checks if the identifier is a disease number or a id\n\n        Args:\n            disease_identifier(str)\n\n        Returns:\n            disease_obj(dict)", "docstring_tokens": ["Return", "a", "disease", "term"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252587}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.py#L301-L313", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Insert raw SVG data into the widet.", "language": "python", "parameters": "(self, cursor, svg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "svg_to_image", "(", "arg_2", ")", "except", "ValueError", ":", "arg_0", ".", "_insert_plain_text", "(", "arg_1", ",", "'Received invalid SVG data.'", ")", "else", ":", "arg_4", "=", "arg_0", ".", "_add_image", "(", "arg_3", ")", "arg_0", ".", "_name_to_svg_map", "[", "arg_4", ".", "name", "(", ")", "]", "=", "arg_2", "arg_1", ".", "insertBlock", "(", ")", "arg_1", ".", "insertImage", "(", "arg_4", ")", "arg_1", ".", "insertBlock", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Insert raw SVG data into the widet.\n        \"\"\"\n        try:\n            arg_3 = svg_to_image(arg_2)\n        except ValueError:\n            arg_0._insert_plain_text(arg_1, 'Received invalid SVG data.')\n        else:\n            arg_4 = arg_0._add_image(arg_3)\n            arg_0._name_to_svg_map[arg_4.name()] = arg_2\n            arg_1.insertBlock()\n            arg_1.insertImage(arg_4)\n            arg_1.insertBlock()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.py", "identifier": "RichIPythonWidget._insert_svg", "docstring": "Insert raw SVG data into the widet.", "docstring_tokens": ["Insert", "raw", "SVG", "data", "into", "the", "widet", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252588}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L856-L861", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Gather information from common gene information.", "language": "python", "parameters": "(variant_obj)", "return_statement": "return list(manual_models)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "for", "arg_2", "in", "arg_0", ".", "get", "(", "'genes'", ",", "[", "]", ")", ":", "arg_1", ".", "update", "(", "arg_2", ".", "get", "(", "'manual_inheritance'", ",", "[", "]", ")", ")", "return", "list", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Gather information from common gene information.\"\"\"\n    arg_1 = set()\n    for arg_2 in arg_0.get('genes', []):\n        arg_1.update(arg_2.get('manual_inheritance', []))\n    return list(arg_1)", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "expected_inheritance", "docstring": "Gather information from common gene information.", "docstring_tokens": ["Gather", "information", "from", "common", "gene", "information", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252589}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/inspector.py#L41-L60", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Return an iterator on interfaces implemented by the given class node.", "language": "python", "parameters": "(node, herited=True, handler_func=_iface_hdlr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "arg_3", ")", ":", "try", ":", "arg_4", "=", "bases", ".", "Instance", "(", "arg_0", ")", ".", "getattr", "(", "\"__implements__\"", ")", "[", "0", "]", "except", "exceptions", ".", "NotFoundError", ":", "return", "if", "not", "arg_1", "and", "arg_4", ".", "frame", "(", ")", "is", "not", "arg_0", ":", "return", "arg_5", "=", "set", "(", ")", "arg_6", "=", "False", "for", "arg_7", "in", "node_classes", ".", "unpack_infer", "(", "arg_4", ")", ":", "if", "arg_7", "is", "astroid", ".", "Uninferable", ":", "arg_6", "=", "True", "continue", "if", "arg_7", "not", "in", "arg_5", "and", "arg_2", "(", "arg_7", ")", ":", "arg_5", ".", "add", "(", "arg_7", ")", "yield", "arg_7", "if", "arg_6", ":", "raise", "exceptions", ".", "InferenceError", "(", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=arg_3):\n    \"\"\"Return an iterator on Func implemented by the given class node.\"\"\"\n    # FIXME: what if __implements__ = (MyIFace, MyParent.__implements__)...\n    try:\n        arg_4 = bases.Instance(arg_0).getattr(\"__implements__\")[0]\n    except exceptions.NotFoundError:\n        return\n    if not arg_1 and arg_4.frame() is not arg_0:\n        return\n    arg_5 = set()\n    arg_6 = False\n    for arg_7 in node_classes.unpack_infer(arg_4):\n        if arg_7 is astroid.Uninferable:\n            arg_6 = True\n            continue\n        if arg_7 not in arg_5 and arg_2(arg_7):\n            arg_5.add(arg_7)\n            yield arg_7\n    if arg_6:\n        raise exceptions.InferenceError()", "path": "pylint/pyreverse/inspector.py", "identifier": "interfaces", "docstring": "Return an iterator on interfaces implemented by the given class node.", "docstring_tokens": ["Return", "an", "iterator", "on", "interfaces", "implemented", "by", "the", "given", "class", "node", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252590}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1062-L1097", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "ASCII adjust AX before division.", "language": "python", "parameters": "(cpu, imm=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "10", "else", ":", "arg_1", "=", "arg_1", ".", "read", "(", ")", "arg_0", ".", "AL", "+=", "arg_0", ".", "AH", "*", "arg_1", "arg_0", ".", "AH", "=", "0", "arg_0", ".", "_calculate_logic_flags", "(", "8", ",", "arg_0", ".", "AL", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        ASCII adjust AX before division.\n\n        Adjusts two unpacked BCD digits (the least-significant digit in the\n        AL register and the most-significant digit in the AH register) so that\n        a division operation performed on the result will yield a correct unpacked\n        BCD value. The Func instruction is only useful when it precedes a DIV instruction\n        that divides (binary division) the adjusted value in the AX register by\n        an unpacked BCD value.\n        The Func instruction sets the value in the AL register to (AL + (10 * AH)), and then\n        clears the AH register to 00H. The value in the AX register is then equal to the binary\n        equivalent of the original unpacked two-digit (base 10) number in registers AH and AL.\n\n        The SF, ZF, and PF flags are set according to the resulting binary value in the AL register.\n\n        This instruction executes as described in compatibility mode and legacy mode.\n        It is not valid in 64-bit mode.::\n\n                tempAL  =  AL;\n                tempAH  =  AH;\n                AL  =  (tempAL + (tempAH * 10)) AND FFH;\n                AH  =  0\n\n        :param cpu: current CPU.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = 10\n        else:\n            arg_1 = arg_1.read()\n\n        arg_0.AL += arg_0.AH * arg_1\n        arg_0.AH = 0\n\n        # Defined flags: ...sz.p.\n        arg_0._calculate_logic_flags(8, arg_0.AL)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.AAD", "docstring": "ASCII adjust AX before division.\n\n        Adjusts two unpacked BCD digits (the least-significant digit in the\n        AL register and the most-significant digit in the AH register) so that\n        a division operation performed on the result will yield a correct unpacked\n        BCD value. The AAD instruction is only useful when it precedes a DIV instruction\n        that divides (binary division) the adjusted value in the AX register by\n        an unpacked BCD value.\n        The AAD instruction sets the value in the AL register to (AL + (10 * AH)), and then\n        clears the AH register to 00H. The value in the AX register is then equal to the binary\n        equivalent of the original unpacked two-digit (base 10) number in registers AH and AL.\n\n        The SF, ZF, and PF flags are set according to the resulting binary value in the AL register.\n\n        This instruction executes as described in compatibility mode and legacy mode.\n        It is not valid in 64-bit mode.::\n\n                tempAL  =  AL;\n                tempAH  =  AH;\n                AL  =  (tempAL + (tempAH * 10)) AND FFH;\n                AH  =  0\n\n        :param cpu: current CPU.", "docstring_tokens": ["ASCII", "adjust", "AX", "before", "division", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252591}
{"url": "https://github.com/tokibito/funkload-friendly/blob/a60e8d2b76ba5ad6c16f8cfc347bd200bd45c189/src/funkload_friendly/cookie.py#L29-L35", "sha": "a60e8d2b76ba5ad6c16f8cfc347bd200bd45c189", "docstring_summary": "Render to cookie strings.", "language": "python", "parameters": "(self)", "return_statement": "return values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "items", "(", ")", ":", "arg_1", "+=", "'{}={};'", ".", "format", "(", "arg_2", ",", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Render to cookie strings.\n        \"\"\"\n        arg_1 = ''\n        for arg_2, arg_3 in arg_0.items():\n            arg_1 += '{}={};'.format(arg_2, arg_3)\n        return arg_1", "path": "src/funkload_friendly/cookie.py", "identifier": "CookieDict.render_to_string", "docstring": "Render to cookie strings.", "docstring_tokens": ["Render", "to", "cookie", "strings", "."], "nwo": "tokibito/funkload-friendly", "score": 0.17697123869542528, "idx": 252592}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/source.py#L126-L131", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Returns a zero-length range located just before the beginning of this range.", "language": "python", "parameters": "(self)", "return_statement": "return Range(self.source_buffer, self.begin_pos, self.begin_pos,\n                     expanded_from=self.expanded_from)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "Range", "(", "arg_0", ".", "source_buffer", ",", "arg_0", ".", "Func_pos", ",", "arg_0", ".", "Func_pos", ",", "expanded_from", "=", "arg_0", ".", "expanded_from", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a zero-length range located just before the Funcning of this range.\n        \"\"\"\n        return Range(arg_0.source_buffer, arg_0.Func_pos, arg_0.Func_pos,\n                     expanded_from=arg_0.expanded_from)", "path": "third_party/pythonparser/source.py", "identifier": "Range.begin", "docstring": "Returns a zero-length range located just before the beginning of this range.", "docstring_tokens": ["Returns", "a", "zero", "-", "length", "range", "located", "just", "before", "the", "beginning", "of", "this", "range", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 252593}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L585-L611", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Returns a list of two actions per gcs bucket to mount.", "language": "python", "parameters": "(self, mounts, mnt_datadisk)", "return_statement": "return actions_to_add", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_4", ".", "value", "[", "len", "(", "'gs://'", ")", ":", "]", "arg_6", "=", "arg_4", ".", "docker_path", "arg_3", ".", "extend", "(", "[", "google_v2_pipelines", ".", "build_action", "(", "name", "=", "'mount-{}'", ".", "format", "(", "arg_5", ")", ",", "flags", "=", "[", "'ENABLE_FUSE'", ",", "'RUN_IN_BACKGROUND'", "]", ",", "image_uri", "=", "_GCSFUSE_IMAGE", ",", "arg_1", "=", "[", "arg_2", "]", ",", "commands", "=", "[", "'--implicit-dirs'", ",", "'--foreground'", ",", "'-o ro'", ",", "arg_5", ",", "os", ".", "path", ".", "join", "(", "providers_util", ".", "DATA_MOUNT_POINT", ",", "arg_6", ")", "]", ")", ",", "google_v2_pipelines", ".", "build_action", "(", "name", "=", "'mount-wait-{}'", ".", "format", "(", "arg_5", ")", ",", "flags", "=", "[", "'ENABLE_FUSE'", "]", ",", "image_uri", "=", "_GCSFUSE_IMAGE", ",", "arg_1", "=", "[", "arg_2", "]", ",", "commands", "=", "[", "'wait'", ",", "os", ".", "path", ".", "join", "(", "providers_util", ".", "DATA_MOUNT_POINT", ",", "arg_6", ")", "]", ")", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Returns a list of two actions per gcs bucket to mount.\"\"\"\n    arg_3 = []\n    for arg_4 in arg_1:\n      arg_5 = arg_4.value[len('gs://'):]\n      arg_6 = arg_4.docker_path\n      arg_3.extend([\n          google_v2_pipelines.build_action(\n              name='mount-{}'.format(arg_5),\n              flags=['ENABLE_FUSE', 'RUN_IN_BACKGROUND'],\n              image_uri=_GCSFUSE_IMAGE,\n              arg_1=[arg_2],\n              commands=[\n                  '--implicit-dirs', '--foreground', '-o ro', arg_5,\n                  os.path.join(providers_util.DATA_MOUNT_POINT, arg_6)\n              ]),\n          google_v2_pipelines.build_action(\n              name='mount-wait-{}'.format(arg_5),\n              flags=['ENABLE_FUSE'],\n              image_uri=_GCSFUSE_IMAGE,\n              arg_1=[arg_2],\n              commands=[\n                  'wait',\n                  os.path.join(providers_util.DATA_MOUNT_POINT, arg_6)\n              ])\n      ])\n    return arg_3", "path": "dsub/providers/google_v2.py", "identifier": "GoogleV2JobProvider._get_mount_actions", "docstring": "Returns a list of two actions per gcs bucket to mount.", "docstring_tokens": ["Returns", "a", "list", "of", "two", "actions", "per", "gcs", "bucket", "to", "mount", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 252594}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/_util.py#L34-L54", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Convert an OpenSSL library failure into a Python exception.", "language": "python", "parameters": "(exception_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "while", "True", ":", "arg_2", "=", "lib", ".", "ERR_get_error", "(", ")", "if", "arg_2", "==", "0", ":", "break", "arg_1", ".", "append", "(", "(", "text", "(", "lib", ".", "ERR_lib_error_string", "(", "arg_2", ")", ")", ",", "text", "(", "lib", ".", "ERR_func_error_string", "(", "arg_2", ")", ")", ",", "text", "(", "lib", ".", "ERR_reason_error_string", "(", "arg_2", ")", ")", ")", ")", "raise", "arg_0", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Convert an OpenSSL library failure into a Python exception.\n\n    When a call to the native OpenSSL library fails, this is usually signalled\n    by the return value, and an error code is stored in an error queue\n    associated with the current thread. The err library provides functions to\n    obtain these error codes and textual error messages.\n    \"\"\"\n    arg_1 = []\n\n    while True:\n        arg_2 = lib.ERR_get_error()\n        if arg_2 == 0:\n            break\n        arg_1.append((\n            text(lib.ERR_lib_error_string(arg_2)),\n            text(lib.ERR_func_error_string(arg_2)),\n            text(lib.ERR_reason_error_string(arg_2))))\n\n    raise arg_0(arg_1)", "path": "src/OpenSSL/_util.py", "identifier": "exception_from_error_queue", "docstring": "Convert an OpenSSL library failure into a Python exception.\n\n    When a call to the native OpenSSL library fails, this is usually signalled\n    by the return value, and an error code is stored in an error queue\n    associated with the current thread. The err library provides functions to\n    obtain these error codes and textual error messages.", "docstring_tokens": ["Convert", "an", "OpenSSL", "library", "failure", "into", "a", "Python", "exception", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 252595}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/states.py#L204-L217", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Update a single parameter or group of parameters ``params``\n        with ``values``.", "language": "python", "parameters": "(self, params, values)", "return_statement": "return super(State, self).update(params, values)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "super", "(", "State", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Update a single parameter or group of parameters ``params``\n        with ``values``.\n\n        Parameters\n        ----------\n        params : string or list of strings\n            Parameter names which to Func\n\n        value : number or list of numbers\n            Values of those parameters which to Func\n        \"\"\"\n        return super(State, arg_0).Func(arg_1, arg_2)", "path": "peri/states.py", "identifier": "State.update", "docstring": "Update a single parameter or group of parameters ``params``\n        with ``values``.\n\n        Parameters\n        ----------\n        params : string or list of strings\n            Parameter names which to update\n\n        value : number or list of numbers\n            Values of those parameters which to update", "docstring_tokens": ["Update", "a", "single", "parameter", "or", "group", "of", "parameters", "params", "with", "values", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252596}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1109-L1117", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Returns true if the given parameter, with name key, has transitioned to the given value.", "language": "python", "parameters": "(self, key, to_value, from_value=None)", "return_statement": "return last_value != to_value and current_value == to_value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "getattr", "(", "arg_0", ".", "last_manifest", ",", "arg_1", ")", "arg_5", "=", "arg_0", ".", "current_manifest", ".", "get", "(", "arg_1", ")", "if", "arg_3", "is", "not", "None", ":", "return", "arg_4", "==", "arg_3", "and", "arg_5", "==", "arg_2", "return", "arg_4", "!=", "arg_2", "and", "arg_5", "==", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Returns true if the given parameter, with name key, has transitioned to the given value.\n        \"\"\"\n        arg_4 = getattr(arg_0.last_manifest, arg_1)\n        arg_5 = arg_0.current_manifest.get(arg_1)\n        if arg_3 is not None:\n            return arg_4 == arg_3 and arg_5 == arg_2\n        return arg_4 != arg_2 and arg_5 == arg_2", "path": "burlap/common.py", "identifier": "Satchel.param_changed_to", "docstring": "Returns true if the given parameter, with name key, has transitioned to the given value.", "docstring_tokens": ["Returns", "true", "if", "the", "given", "parameter", "with", "name", "key", "has", "transitioned", "to", "the", "given", "value", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 252597}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/__init__.py#L85-L97", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "a function for the client to announce him or herself, depending\n           on the level specified. If you want your client to have additional\n           announced things here, then implement the class `_speak` for your\n           client.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "quiet", "is", "False", ":", "bot", ".", "info", "(", "'[client|%s] [database|%s]'", "%", "(", "arg_0", ".", "client_name", ",", "arg_0", ".", "database", ")", ")", "arg_0", ".", "_Func", "(", ")"], "function": "def Func(arg_0):\n        '''\n           a function for the client to announce him or herself, depending\n           on the level specified. If you want your client to have additional\n           announced things here, then implement the class `_Func` for your\n           client.\n\n        '''\n        if arg_0.quiet is False:\n            bot.info('[client|%s] [database|%s]' %(arg_0.client_name,\n                                                   arg_0.database))\n\n            arg_0._Func()", "path": "sregistry/main/base/__init__.py", "identifier": "ApiConnection.speak", "docstring": "a function for the client to announce him or herself, depending\n           on the level specified. If you want your client to have additional\n           announced things here, then implement the class `_speak` for your\n           client.", "docstring_tokens": ["a", "function", "for", "the", "client", "to", "announce", "him", "or", "herself", "depending", "on", "the", "level", "specified", ".", "If", "you", "want", "your", "client", "to", "have", "additional", "announced", "things", "here", "then", "implement", "the", "class", "_speak", "for", "your", "client", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 252598}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/scheduler.py#L314-L325", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Cancel or 'un-schedule' a task.", "language": "python", "parameters": "(self, task_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "registry", ".", "remove", "(", "arg_1", ")", "arg_0", ".", "_scheduler", ".", "cancel_job_task", "(", "arg_1", ")", "logger", ".", "info", "(", "\"Task %s canceled\"", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Cancel or 'un-schedule' a task.\n\n        :param task_id: identifier of the task to cancel\n\n        :raises NotFoundError: raised when the requested task is not\n            found in the registry\n        \"\"\"\n        arg_0.registry.remove(arg_1)\n        arg_0._scheduler.cancel_job_task(arg_1)\n\n        logger.info(\"Task %s canceled\", arg_1)", "path": "arthur/scheduler.py", "identifier": "Scheduler.cancel_task", "docstring": "Cancel or 'un-schedule' a task.\n\n        :param task_id: identifier of the task to cancel\n\n        :raises NotFoundError: raised when the requested task is not\n            found in the registry", "docstring_tokens": ["Cancel", "or", "un", "-", "schedule", "a", "task", "."], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 252599}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1013-L1059", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "ASCII adjust after addition.", "language": "python", "parameters": "(cpu)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "AF", "=", "Operators", ".", "OR", "(", "arg_0", ".", "AL", "&", "0x0F", ">", "9", ",", "arg_0", ".", "AF", ")", "arg_0", ".", "CF", "=", "arg_0", ".", "AF", "arg_0", ".", "AH", "=", "Operators", ".", "ITEBV", "(", "8", ",", "arg_0", ".", "AF", ",", "arg_0", ".", "AH", "+", "1", ",", "arg_0", ".", "AH", ")", "arg_0", ".", "AL", "=", "Operators", ".", "ITEBV", "(", "8", ",", "arg_0", ".", "AF", ",", "arg_0", ".", "AL", "+", "6", ",", "arg_0", ".", "AL", ")", "arg_0", ".", "AL", "=", "arg_0", ".", "AL", "&", "0x0f"], "function": "def Func(arg_0):\n        \"\"\"\n        ASCII adjust after addition.\n\n        Adjusts the sum of two unpacked BCD values to create an unpacked BCD\n        result. The AL register is the implied source and destination operand\n        for this instruction. The Func instruction is only useful when it follows\n        an ADD instruction that adds (binary addition) two unpacked BCD values\n        and stores a byte result in the AL register. The Func instruction then\n        adjusts the contents of the AL register to contain the correct 1-digit\n        unpacked BCD result.\n        If the addition produces a decimal carry, the AH register is incremented\n        by 1, and the CF and AF flags are set. If there was no decimal carry,\n        the CF and AF flags are cleared and the AH register is unchanged. In either\n        case, bits 4 through 7 of the AL register are cleared to 0.\n\n        This instruction executes as described in compatibility mode and legacy mode.\n        It is not valid in 64-bit mode.\n        ::\n                IF ((AL AND 0FH) > 9) Operators.OR(AF  =  1)\n                THEN\n                    AL  =  (AL + 6);\n                    AH  =  AH + 1;\n                    AF  =  1;\n                    CF  =  1;\n                ELSE\n                    AF  =  0;\n                    CF  =  0;\n                FI;\n                AL  =  AL AND 0FH;\n        :param cpu: current CPU.\n        \"\"\"\n        arg_0.AF = Operators.OR(arg_0.AL & 0x0F > 9, arg_0.AF)\n        arg_0.CF = arg_0.AF\n        arg_0.AH = Operators.ITEBV(8, arg_0.AF, arg_0.AH + 1, arg_0.AH)\n        arg_0.AL = Operators.ITEBV(8, arg_0.AF, arg_0.AL + 6, arg_0.AL)\n        \"\"\"\n        if (cpu.AL & 0x0F > 9) or cpu.AF == 1:\n            cpu.AL = cpu.AL + 6\n            cpu.AH = cpu.AH + 1\n            cpu.AF = True\n            cpu.CF = True\n        else:\n            cpu.AF = False\n            cpu.CF = False\n        \"\"\"\n        arg_0.AL = arg_0.AL & 0x0f", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.AAA", "docstring": "ASCII adjust after addition.\n\n        Adjusts the sum of two unpacked BCD values to create an unpacked BCD\n        result. The AL register is the implied source and destination operand\n        for this instruction. The AAA instruction is only useful when it follows\n        an ADD instruction that adds (binary addition) two unpacked BCD values\n        and stores a byte result in the AL register. The AAA instruction then\n        adjusts the contents of the AL register to contain the correct 1-digit\n        unpacked BCD result.\n        If the addition produces a decimal carry, the AH register is incremented\n        by 1, and the CF and AF flags are set. If there was no decimal carry,\n        the CF and AF flags are cleared and the AH register is unchanged. In either\n        case, bits 4 through 7 of the AL register are cleared to 0.\n\n        This instruction executes as described in compatibility mode and legacy mode.\n        It is not valid in 64-bit mode.\n        ::\n                IF ((AL AND 0FH) > 9) Operators.OR(AF  =  1)\n                THEN\n                    AL  =  (AL + 6);\n                    AH  =  AH + 1;\n                    AF  =  1;\n                    CF  =  1;\n                ELSE\n                    AF  =  0;\n                    CF  =  0;\n                FI;\n                AL  =  AL AND 0FH;\n        :param cpu: current CPU.", "docstring_tokens": ["ASCII", "adjust", "after", "addition", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252600}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/yaml.py#L83-L111", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Write the cobra model to a file in YAML format.", "language": "python", "parameters": "(model, filename, sort=False, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "arg_4", "=", "model_to_dict", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "arg_4", "[", "\"version\"", "]", "=", "YAML_SPEC", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", ":", "with", "io", ".", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "file_handle", ":", "yaml", ".", "dump", "(", "arg_4", ",", "file_handle", ",", "**", "arg_3", ")", "else", ":", "yaml", ".", "dump", "(", "arg_4", ",", "arg_1", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, **arg_3):\n    \"\"\"\n    Write the cobra model to a file in YAML format.\n\n    ``kwargs`` are passed on to ``yaml.dump``.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to represent.\n    filename : str or file-like\n        File path or descriptor that the YAML representation should be\n        written to.\n    sort : bool, optional\n        Whether to sort the metabolites, reactions, and genes or maintain the\n        order defined in the model.\n\n    See Also\n    --------\n    to_yaml : Return a string representation.\n    ruamel.yaml.dump : Base function.\n    \"\"\"\n    arg_4 = model_to_dict(arg_0, arg_2=arg_2)\n    arg_4[\"version\"] = YAML_SPEC\n    if isinstance(arg_1, string_types):\n        with io.open(arg_1, \"w\") as file_handle:\n            yaml.dump(arg_4, file_handle, **arg_3)\n    else:\n        yaml.dump(arg_4, arg_1, **arg_3)", "path": "cobra/io/yaml.py", "identifier": "save_yaml_model", "docstring": "Write the cobra model to a file in YAML format.\n\n    ``kwargs`` are passed on to ``yaml.dump``.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to represent.\n    filename : str or file-like\n        File path or descriptor that the YAML representation should be\n        written to.\n    sort : bool, optional\n        Whether to sort the metabolites, reactions, and genes or maintain the\n        order defined in the model.\n\n    See Also\n    --------\n    to_yaml : Return a string representation.\n    ruamel.yaml.dump : Base function.", "docstring_tokens": ["Write", "the", "cobra", "model", "to", "a", "file", "in", "YAML", "format", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 252601}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L621-L624", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Combine arguments and turn them into gromacs tool arguments.", "language": "python", "parameters": "(self,*args,**kwargs)", "return_statement": "return self._build_arg_list(**newargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_combineargs", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "arg_0", ".", "_build_arg_list", "(", "**", "arg_3", ")"], "function": "def Func(arg_0,*arg_1,**arg_2):\n        \"\"\"Combine arguments and turn them into gromacs tool arguments.\"\"\"\n        arg_3 = arg_0._combineargs(*arg_1, **arg_2)\n        return arg_0._build_arg_list(**arg_3)", "path": "gromacs/core.py", "identifier": "GromacsCommand.transform_args", "docstring": "Combine arguments and turn them into gromacs tool arguments.", "docstring_tokens": ["Combine", "arguments", "and", "turn", "them", "into", "gromacs", "tool", "arguments", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 252602}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/arraymisc/quantization.py#L32-L56", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Dequantize an array.", "language": "python", "parameters": "(arr, min_val, max_val, levels, dtype=np.float64)", "return_statement": "return dequantized_arr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_5", ".", "float64", ")", ":", "if", "not", "(", "isinstance", "(", "arg_3", ",", "int", ")", "and", "arg_3", ">", "1", ")", ":", "raise", "ValueError", "(", "'levels must be a positive integer, but got {}'", ".", "format", "(", "arg_3", ")", ")", "if", "arg_1", ">=", "arg_2", ":", "raise", "ValueError", "(", "'min_val ({}) must be smaller than max_val ({})'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "arg_7", "=", "(", "arg_0", "+", "0.5", ")", ".", "astype", "(", "arg_4", ")", "*", "(", "arg_2", "-", "arg_1", ")", "/", "arg_3", "+", "arg_1", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=arg_5.float64):\n    \"\"\"Dequantize an array.\n\n    Args:\n        arr (ndarray): Input array.\n        min_val (scalar): Minimum value to be clipped.\n        max_val (scalar): Maximum value to be clipped.\n        levels (int): Quantization levels.\n        dtype (np.type): The type of the Funcd array.\n\n    Returns:\n        tuple: Dequantized array.\n    \"\"\"\n    if not (isinstance(arg_3, int) and arg_3 > 1):\n        raise ValueError(\n            'levels must be a positive integer, but got {}'.format(arg_3))\n    if arg_1 >= arg_2:\n        raise ValueError(\n            'min_val ({}) must be smaller than max_val ({})'.format(\n                arg_1, arg_2))\n\n    arg_7 = (arg_0 + 0.5).astype(arg_4) * (\n        arg_2 - arg_1) / arg_3 + arg_1\n\n    return arg_7", "path": "mmcv/arraymisc/quantization.py", "identifier": "dequantize", "docstring": "Dequantize an array.\n\n    Args:\n        arr (ndarray): Input array.\n        min_val (scalar): Minimum value to be clipped.\n        max_val (scalar): Maximum value to be clipped.\n        levels (int): Quantization levels.\n        dtype (np.type): The type of the dequantized array.\n\n    Returns:\n        tuple: Dequantized array.", "docstring_tokens": ["Dequantize", "an", "array", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 252603}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/mixins.py#L208-L217", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Get the existing embedded document if it exists, else created it.", "language": "python", "parameters": "(self, document, form_key, current_key, remaining_key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "getattr", "(", "arg_1", ",", "arg_3", ",", "False", ")", "if", "not", "arg_5", ":", "arg_5", "=", "arg_1", ".", "_fields", "[", "arg_3", "]", ".", "document_type_obj", "(", ")", "arg_6", ",", "arg_7", "=", "trim_field_key", "(", "arg_5", ",", "arg_4", ")", "arg_0", ".", "process_document", "(", "arg_5", ",", "arg_2", ",", "make_key", "(", "arg_6", ",", "arg_7", ")", ")", "setattr", "(", "arg_1", ",", "arg_3", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Get the existing embedded document if it exists, else created it.\"\"\"\n\n        arg_5 = getattr(arg_1, arg_3, False)\n        if not arg_5:\n            arg_5 = arg_1._fields[arg_3].document_type_obj()\n\n        arg_6, arg_7 = trim_field_key(arg_5, arg_4)\n        arg_0.process_document(arg_5, arg_2, make_key(arg_6, arg_7))\n        setattr(arg_1, arg_3, arg_5)", "path": "mongonaut/mixins.py", "identifier": "MongonautFormViewMixin.set_embedded_doc", "docstring": "Get the existing embedded document if it exists, else created it.", "docstring_tokens": ["Get", "the", "existing", "embedded", "document", "if", "it", "exists", "else", "created", "it", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 252604}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/resources/resource/base.py#L501-L529", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Ensure we are authenticated.", "language": "python", "parameters": "(self, request)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "user", "=", "arg_2", "=", "None", "if", "arg_1", ".", "method", "==", "'OPTIONS'", ":", "return", "for", "arg_3", "in", "arg_0", ".", "meta", ".", "authentication", ":", "arg_2", "=", "arg_3", ".", "authenticate", "(", "arg_1", ")", "if", "arg_2", "is", "False", ":", "continue", "if", "arg_2", "is", "None", "and", "not", "arg_3", ".", "allow_anonymous", ":", "arg_3", ".", "unauthenticated", "(", ")", "arg_1", ".", "user", "=", "arg_2", "return", "if", "not", "arg_2", "and", "not", "arg_3", ".", "allow_anonymous", ":", "arg_3", ".", "unauthenticated", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Ensure we are authenticated.\"\"\"\n        arg_1.user = arg_2 = None\n\n        if arg_1.method == 'OPTIONS':\n            # Authentication should not be checked on an OPTIONS request.\n            return\n\n        for arg_3 in arg_0.meta.authentication:\n            arg_2 = arg_3.authenticate(arg_1)\n            if arg_2 is False:\n                # Authentication protocol failed to authenticate;\n                # pass the baton.\n                continue\n\n            if arg_2 is None and not arg_3.allow_anonymous:\n                # Authentication protocol determined the user is\n                # unauthenticated.\n                arg_3.unauthenticated()\n\n            # Authentication protocol determined the user is indeed\n            # authenticated (or not); Store the user for later reference.\n            arg_1.user = arg_2\n            return\n\n        if not arg_2 and not arg_3.allow_anonymous:\n            # No authenticated user found and protocol doesn't allow\n            # anonymous users.\n            arg_3.unauthenticated()", "path": "armet/resources/resource/base.py", "identifier": "Resource.require_authentication", "docstring": "Ensure we are authenticated.", "docstring_tokens": ["Ensure", "we", "are", "authenticated", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 252605}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L620-L637", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return True if there are any more good sprints still being explored.\n    A 'good' sprint is one that is earlier than where we detected an increase\n    in error from sprint to subsequent sprint.", "language": "python", "parameters": "(self)", "return_statement": "return anyActiveSprints", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_state", "[", "'lastGoodSprint'", "]", "is", "not", "None", ":", "arg_1", "=", "arg_0", ".", "_state", "[", "'sprints'", "]", "[", "0", ":", "arg_0", ".", "_state", "[", "'lastGoodSprint'", "]", "+", "1", "]", "else", ":", "arg_1", "=", "arg_0", ".", "_state", "[", "'sprints'", "]", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", "[", "'status'", "]", "==", "'active'", ":", "arg_3", "=", "True", "break", "else", ":", "arg_3", "=", "False", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Return True if there are any more good sprints still being explored.\n    A 'good' sprint is one that is earlier than where we detected an increase\n    in error from sprint to subsequent sprint.\n    \"\"\"\n    if arg_0._state['lastGoodSprint'] is not None:\n      arg_1 = arg_0._state['sprints'][0:arg_0._state['lastGoodSprint']+1]\n    else:\n      arg_1 = arg_0._state['sprints']\n\n    for arg_2 in arg_1:\n      if arg_2['status'] == 'active':\n        arg_3 = True\n        break\n    else:\n      arg_3 = False\n\n    return arg_3", "path": "src/nupic/swarming/hypersearch/hs_state.py", "identifier": "HsState.anyGoodSprintsActive", "docstring": "Return True if there are any more good sprints still being explored.\n    A 'good' sprint is one that is earlier than where we detected an increase\n    in error from sprint to subsequent sprint.", "docstring_tokens": ["Return", "True", "if", "there", "are", "any", "more", "good", "sprints", "still", "being", "explored", ".", "A", "good", "sprint", "is", "one", "that", "is", "earlier", "than", "where", "we", "detected", "an", "increase", "in", "error", "from", "sprint", "to", "subsequent", "sprint", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252606}
{"url": "https://github.com/Scifabric/pybossa-client/blob/998d7cb0207ff5030dc800f0c2577c5692316c2c/pbclient/__init__.py#L621-L649", "sha": "998d7cb0207ff5030dc800f0c2577c5692316c2c", "docstring_summary": "Return a list of results for a given project ID.", "language": "python", "parameters": "(project_id, limit=100, offset=0, last_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "100", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", "else", ":", "arg_4", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "print", "(", "OFFSET_WARNING", ")", "arg_4", "[", "'project_id'", "]", "=", "arg_0", "try", ":", "arg_5", "=", "_pybossa_req", "(", "'get'", ",", "'result'", ",", "arg_4", "=", "arg_4", ")", "if", "type", "(", "arg_5", ")", ".", "__name__", "==", "'list'", ":", "return", "[", "Result", "(", "arg_6", ")", "for", "arg_6", "in", "arg_5", "]", "else", ":", "return", "arg_5", "except", ":", "raise"], "function": "def Func(arg_0, arg_1=100, arg_2=0, arg_3=None):\n    \"\"\"Return a list of results for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param limit: Number of returned items, default 100\n    :type limit: integer\n    :param offset: Offset for the query, default 0\n    :param last_id: id of the last result, used for pagination. If provided, offset is ignored\n    :type last_id: integer\n    :type offset: integer\n    :returns: True -- the response status code\n\n    \"\"\"\n    if arg_3 is not None:\n        arg_4 = dict(arg_1=arg_1, arg_3=arg_3)\n    else:\n        arg_4 = dict(arg_1=arg_1, arg_2=arg_2)\n        print(OFFSET_WARNING)\n    arg_4['project_id'] = arg_0\n    try:\n        arg_5 = _pybossa_req('get', 'result',\n                           arg_4=arg_4)\n        if type(arg_5).__name__ == 'list':\n            return [Result(arg_6) for arg_6 in arg_5]\n        else:\n            return arg_5\n    except:  # pragma: no cover\n        raise", "path": "pbclient/__init__.py", "identifier": "get_results", "docstring": "Return a list of results for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param limit: Number of returned items, default 100\n    :type limit: integer\n    :param offset: Offset for the query, default 0\n    :param last_id: id of the last result, used for pagination. If provided, offset is ignored\n    :type last_id: integer\n    :type offset: integer\n    :returns: True -- the response status code", "docstring_tokens": ["Return", "a", "list", "of", "results", "for", "a", "given", "project", "ID", "."], "nwo": "Scifabric/pybossa-client", "score": 0.27831918678159157, "idx": 252607}
{"url": "https://github.com/praekelt/django-analytics/blob/29c22d03374ccc0ec451650e2c2886d324f6e5c6/analytics/geckoboard_views.py#L14-L26", "sha": "29c22d03374ccc0ec451650e2c2886d324f6e5c6", "docstring_summary": "Returns the GET array's contents for the specified variable.", "language": "python", "parameters": "(request, var_name, fail_silently=True)", "return_statement": "return vals", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "GET", ".", "getlist", "(", "arg_1", ")", "if", "not", "arg_3", ":", "if", "arg_2", ":", "return", "[", "]", "else", ":", "raise", "Exception", ",", "_", "(", "\"No array called '%(varname)s' in GET variables\"", ")", "%", "{", "'varname'", ":", "arg_1", "}", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Returns the GET array's contents for the specified variable.\n    \"\"\"\n\n    arg_3 = arg_0.GET.getlist(arg_1)\n    if not arg_3:\n        if arg_2:\n            return []\n        else:\n            raise Exception, _(\"No array called '%(varname)s' in GET variables\") % {'varname': arg_1}\n\n    return arg_3", "path": "analytics/geckoboard_views.py", "identifier": "get_GET_array", "docstring": "Returns the GET array's contents for the specified variable.", "docstring_tokens": ["Returns", "the", "GET", "array", "s", "contents", "for", "the", "specified", "variable", "."], "nwo": "praekelt/django-analytics", "score": 0.1905226606846468, "idx": 252608}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/base.py#L78-L87", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Stops a timer if it hasn't fired yet", "language": "python", "parameters": "(self, func)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_timer_callbacks", ":", "arg_2", "=", "arg_0", ".", "_timer_callbacks", "[", "arg_1", "]", "arg_2", ".", "cancel", "(", ")", "del", "arg_0", ".", "_timer_callbacks", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Stops a timer if it hasn't fired yet\n\n        * func - the function passed in start_timer\n        \"\"\"\n        if arg_1 in arg_0._timer_callbacks:\n            arg_2 = arg_0._timer_callbacks[arg_1]\n            arg_2.cancel()\n            del arg_0._timer_callbacks[arg_1]", "path": "slackminion/plugin/base.py", "identifier": "BasePlugin.stop_timer", "docstring": "Stops a timer if it hasn't fired yet\n\n        * func - the function passed in start_timer", "docstring_tokens": ["Stops", "a", "timer", "if", "it", "hasn", "t", "fired", "yet"], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 252609}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L97-L115", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Create a new record from dump.", "language": "python", "parameters": "(cls, dump)", "return_statement": "return cls.update_record(revisions=dump.rest, record=record,\n                                 created=dump.created)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_1", ".", "latest", "arg_4", "=", "Record", ".", "create", "(", "arg_3", ")", "arg_4", ".", "model", ".", "created", "=", "arg_1", ".", "created", ".", "replace", "(", "tzinfo", "=", "None", ")", "arg_4", ".", "model", ".", "updated", "=", "arg_2", ".", "replace", "(", "tzinfo", "=", "None", ")", "RecordIdentifier", ".", "insert", "(", "arg_1", ".", "recid", ")", "PersistentIdentifier", ".", "create", "(", "pid_type", "=", "'recid'", ",", "pid_value", "=", "str", "(", "arg_1", ".", "recid", ")", ",", "object_type", "=", "'rec'", ",", "object_uuid", "=", "str", "(", "arg_4", ".", "id", ")", ",", "status", "=", "PIDStatus", ".", "REGISTERED", ")", "db", ".", "session", ".", "commit", "(", ")", "return", "arg_0", ".", "update_record", "(", "revisions", "=", "arg_1", ".", "rest", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_1", ".", "created", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create a new record from dump.\"\"\"\n        # Reserve record identifier, create record and recid pid in one\n        # operation.\n        arg_2, arg_3 = arg_1.latest\n        arg_4 = Record.create(arg_3)\n        arg_4.model.created = arg_1.created.replace(tzinfo=None)\n        arg_4.model.updated = arg_2.replace(tzinfo=None)\n        RecordIdentifier.insert(arg_1.recid)\n        PersistentIdentifier.create(\n            pid_type='recid',\n            pid_value=str(arg_1.recid),\n            object_type='rec',\n            object_uuid=str(arg_4.id),\n            status=PIDStatus.REGISTERED\n        )\n        db.session.commit()\n        return arg_0.update_record(revisions=arg_1.rest, arg_4=arg_4,\n                                 arg_6=arg_1.created)", "path": "invenio_migrator/records.py", "identifier": "RecordDumpLoader.create_record", "docstring": "Create a new record from dump.", "docstring_tokens": ["Create", "a", "new", "record", "from", "dump", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 252610}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/dmesg.py#L28-L36", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Run DMESG job", "language": "python", "parameters": "(self, shell=True, echo=True)", "return_statement": "return cij.ssh.command(self.__prefix, shell, echo, self.__suffix)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ")", ":", "if", "env", "(", ")", ":", "return", "1", "cij", ".", "emph", "(", "\"cij.dmesg.start: shell: %r, cmd: %r\"", "%", "(", "arg_1", ",", "arg_0", ".", "__prefix", "+", "arg_0", ".", "__suffix", ")", ")", "return", "cij", ".", "ssh", ".", "command", "(", "arg_0", ".", "__prefix", ",", "arg_1", ",", "arg_2", ",", "arg_0", ".", "__suffix", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=True):\n        \"\"\"Run DMESG job\"\"\"\n\n        if env():\n            return 1\n\n        cij.emph(\"cij.dmesg.start: shell: %r, cmd: %r\" % (arg_1, arg_0.__prefix + arg_0.__suffix))\n\n        return cij.ssh.command(arg_0.__prefix, arg_1, arg_2, arg_0.__suffix)", "path": "modules/cij/dmesg.py", "identifier": "Job.__run", "docstring": "Run DMESG job", "docstring_tokens": ["Run", "DMESG", "job"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 252611}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/tools.py#L41-L47", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Progress to the next identifier, and return the current one.", "language": "python", "parameters": "(self)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_current", "arg_0", ".", "_current", "=", "arg_0", ".", "readfunc", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        '''\n        Progress to the Func identifier, and return the current one.\n        '''\n        arg_1 = arg_0._current\n        arg_0._current = arg_0.readfunc()\n        return arg_1", "path": "xtuml/tools.py", "identifier": "IdGenerator.next", "docstring": "Progress to the next identifier, and return the current one.", "docstring_tokens": ["Progress", "to", "the", "next", "identifier", "and", "return", "the", "current", "one", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 252612}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/serve.py#L22-L53", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Start the web server.", "language": "python", "parameters": "(context, config, host, port, debug, livereload)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "dict", "(", "MONGO_HOST", "=", "arg_0", ".", "obj", "[", "'host'", "]", ",", "MONGO_PORT", "=", "arg_0", ".", "obj", "[", "'port'", "]", ",", "MONGO_DBNAME", "=", "arg_0", ".", "obj", "[", "'mongodb'", "]", ",", "MONGO_USERNAME", "=", "arg_0", ".", "obj", "[", "'username'", "]", ",", "MONGO_PASSWORD", "=", "arg_0", ".", "obj", "[", "'password'", "]", ",", ")", "arg_7", "=", "check_connection", "(", "arg_2", "=", "arg_6", "[", "'MONGO_HOST'", "]", ",", "arg_3", "=", "arg_6", "[", "'MONGO_PORT'", "]", ",", "username", "=", "arg_6", "[", "'MONGO_USERNAME'", "]", ",", "password", "=", "arg_6", "[", "'MONGO_PASSWORD'", "]", ",", "authdb", "=", "arg_0", ".", "obj", "[", "'authdb'", "]", ",", ")", "log", ".", "info", "(", "\"Test if mongod is running\"", ")", "if", "not", "arg_7", ":", "log", ".", "warning", "(", "\"Connection could not be established\"", ")", "log", ".", "info", "(", "\"Is mongod running?\"", ")", "arg_0", ".", "abort", "(", ")", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", "if", "arg_1", "else", "None", "arg_8", "=", "create_app", "(", "arg_1", "=", "arg_6", ",", "config_file", "=", "arg_1", ")", "if", "arg_5", ":", "arg_9", "=", "Server", "(", "arg_8", ".", "wsgi_app", ")", "arg_9", ".", "Func", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "else", ":", "arg_8", ".", "run", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Start the web Funcr.\"\"\"\n    arg_6 = dict(\n        MONGO_HOST=arg_0.obj['host'],\n        MONGO_PORT=arg_0.obj['port'],\n        MONGO_DBNAME=arg_0.obj['mongodb'],\n        MONGO_USERNAME=arg_0.obj['username'],\n        MONGO_PASSWORD=arg_0.obj['password'],\n    )\n    \n    arg_7 = check_connection(\n        arg_2=arg_6['MONGO_HOST'], \n        arg_3=arg_6['MONGO_PORT'], \n        username=arg_6['MONGO_USERNAME'], \n        password=arg_6['MONGO_PASSWORD'],\n        authdb=arg_0.obj['authdb'],\n        )\n\n    log.info(\"Test if mongod is running\")\n    if not arg_7:\n        log.warning(\"Connection could not be established\")\n        log.info(\"Is mongod running?\")\n        arg_0.abort()\n    \n\n    arg_1 = os.path.abspath(arg_1) if arg_1 else None\n    arg_8 = create_app(arg_1=arg_6, config_file=arg_1)\n    if arg_5:\n        arg_9 = Server(arg_8.wsgi_app)\n        arg_9.Func(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)\n    else:\n        arg_8.run(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "scout/commands/serve.py", "identifier": "serve", "docstring": "Start the web server.", "docstring_tokens": ["Start", "the", "web", "server", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252613}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/application/briefkasten/dropbox.py#L467-L473", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "returns a list of absolute paths to the cleansed attachements", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "exists", "(", "arg_0", ".", "fs_cleansed_attachment_container", ")", ":", "return", "[", "join", "(", "arg_0", ".", "fs_cleansed_attachment_container", ",", "arg_1", ")", "for", "arg_1", "in", "listdir", "(", "arg_0", ".", "fs_cleansed_attachment_container", ")", "]", "else", ":", "return", "[", "]"], "function": "def Func(arg_0):\n        \"\"\" returns a list of absolute paths to the cleansed attachements\"\"\"\n        if exists(arg_0.fs_cleansed_attachment_container):\n            return [join(arg_0.fs_cleansed_attachment_container, arg_1)\n                    for arg_1 in listdir(arg_0.fs_cleansed_attachment_container)]\n        else:\n            return []", "path": "application/briefkasten/dropbox.py", "identifier": "Dropbox.fs_cleansed_attachments", "docstring": "returns a list of absolute paths to the cleansed attachements", "docstring_tokens": ["returns", "a", "list", "of", "absolute", "paths", "to", "the", "cleansed", "attachements"], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 252614}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/lineage/__init__.py#L48-L82", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Saves the lineage to XCom and if configured to do so sends it\n    to the backend.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_get_backend", "(", ")", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_2", ",", "arg_3", ",", "*", "arg_4", ",", "**", "arg_5", ")", ":", "arg_2", ".", "log", ".", "debug", "(", "\"Backend: %s, Lineage called with inlets: %s, outlets: %s\"", ",", "arg_1", ",", "arg_2", ".", "inlets", ",", "arg_2", ".", "outlets", ")", "arg_6", "=", "arg_0", "(", "arg_2", ",", "arg_3", ",", "*", "arg_4", ",", "**", "arg_5", ")", "arg_7", "=", "[", "x", ".", "as_dict", "(", ")", "for", "x", "in", "arg_2", ".", "outlets", "]", "arg_8", "=", "[", "x", ".", "as_dict", "(", ")", "for", "x", "in", "arg_2", ".", "inlets", "]", "if", "len", "(", "arg_2", ".", "outlets", ")", ">", "0", ":", "arg_2", ".", "xcom_push", "(", "arg_3", ",", "key", "=", "PIPELINE_OUTLETS", ",", "value", "=", "arg_7", ",", "execution_date", "=", "arg_3", "[", "'ti'", "]", ".", "execution_date", ")", "if", "len", "(", "arg_2", ".", "inlets", ")", ">", "0", ":", "arg_2", ".", "xcom_push", "(", "arg_3", ",", "key", "=", "PIPELINE_INLETS", ",", "value", "=", "arg_8", ",", "execution_date", "=", "arg_3", "[", "'ti'", "]", ".", "execution_date", ")", "if", "arg_1", ":", "arg_1", ".", "send_lineage", "(", "operator", "=", "arg_2", ",", "arg_8", "=", "arg_2", ".", "inlets", ",", "arg_7", "=", "arg_2", ".", "outlets", ",", "arg_3", "=", "arg_3", ")", "return", "arg_6", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Saves the lineage to XCom and if configured to do so sends it\n    to the backend.\n    \"\"\"\n    arg_1 = _get_backend()\n\n    @wraps(arg_0)\n    def wrapper(arg_2, arg_3, *arg_4, **arg_5):\n        arg_2.log.debug(\"Backend: %s, Lineage called with inlets: %s, outlets: %s\",\n                       arg_1, arg_2.inlets, arg_2.outlets)\n        arg_6 = arg_0(arg_2, arg_3, *arg_4, **arg_5)\n\n        arg_7 = [x.as_dict() for x in arg_2.outlets]\n        arg_8 = [x.as_dict() for x in arg_2.inlets]\n\n        if len(arg_2.outlets) > 0:\n            arg_2.xcom_push(arg_3,\n                           key=PIPELINE_OUTLETS,\n                           value=arg_7,\n                           execution_date=arg_3['ti'].execution_date)\n\n        if len(arg_2.inlets) > 0:\n            arg_2.xcom_push(arg_3,\n                           key=PIPELINE_INLETS,\n                           value=arg_8,\n                           execution_date=arg_3['ti'].execution_date)\n\n        if arg_1:\n            arg_1.send_lineage(operator=arg_2, arg_8=arg_2.inlets,\n                                 arg_7=arg_2.outlets, arg_3=arg_3)\n\n        return arg_6\n\n    return wrapper", "path": "airflow/lineage/__init__.py", "identifier": "apply_lineage", "docstring": "Saves the lineage to XCom and if configured to do so sends it\n    to the backend.", "docstring_tokens": ["Saves", "the", "lineage", "to", "XCom", "and", "if", "configured", "to", "do", "so", "sends", "it", "to", "the", "backend", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252615}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/helper.py#L130-L147", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Run a shell command", "language": "python", "parameters": "(cmd)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "[", "pipes", ".", "quote", "(", "c", ")", "for", "c", "in", "arg_0", "]", "arg_0", "=", "\" \"", ".", "join", "(", "arg_0", ")", "arg_0", "+=", "\"; exit 0\"", "try", ":", "arg_1", "=", "subprocess", ".", "check_output", "(", "arg_0", ",", "stderr", "=", "subprocess", ".", "STDOUT", ",", "shell", "=", "True", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "arg_1", "=", "e", ".", "output", "arg_1", "=", "arg_1", ".", "decode", "(", "'utf-8'", ")", "arg_1", "=", "arg_1", ".", "strip", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Run a shell command\n    \"\"\"\n    arg_0 = [pipes.quote(c) for c in arg_0]\n    arg_0 = \" \".join(arg_0)\n    arg_0 += \"; exit 0\"\n    # print(\"Running {} in {}\".format(cmd, os.getcwd()))\n    try:\n        arg_1 = subprocess.check_output(arg_0,\n                                         stderr=subprocess.STDOUT,\n                                         shell=True)\n    except subprocess.CalledProcessError as e:\n            arg_1 = e.output\n\n    arg_1 = arg_1.decode('utf-8')\n    arg_1 = arg_1.strip()\n    return arg_1", "path": "dgitcore/helper.py", "identifier": "run", "docstring": "Run a shell command", "docstring_tokens": ["Run", "a", "shell", "command"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 252616}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/file_utils.py#L198-L220", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Modify the content of `filepath`, replacing `old` for `new`.", "language": "python", "parameters": "(filepath, old, new, max=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "f", ":", "arg_4", "=", "f", ".", "read", "(", ")", "arg_4", "=", "arg_4", ".", "replace", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "with", "open", "(", "arg_0", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n    \"\"\" Modify the content of `filepath`, replacing `old` for `new`.\n\n    Parameters\n    ----------\n    filepath: str\n        Path to the file to be modified. It will be overwritten.\n\n    old: str\n        This is old substring to be replaced.\n\n    new: str\n        This is new substring, which would replace old substring.\n\n    max: int\n        If larger than 0, Only the first `max` occurrences are replaced.\n    \"\"\"\n    with open(arg_0, 'r') as f:\n        arg_4 = f.read()\n\n    arg_4 = arg_4.replace(arg_1, arg_2, arg_3)\n    with open(arg_0, 'w') as f:\n        f.write(arg_4)", "path": "docstamp/file_utils.py", "identifier": "replace_file_content", "docstring": "Modify the content of `filepath`, replacing `old` for `new`.\n\n    Parameters\n    ----------\n    filepath: str\n        Path to the file to be modified. It will be overwritten.\n\n    old: str\n        This is old substring to be replaced.\n\n    new: str\n        This is new substring, which would replace old substring.\n\n    max: int\n        If larger than 0, Only the first `max` occurrences are replaced.", "docstring_tokens": ["Modify", "the", "content", "of", "filepath", "replacing", "old", "for", "new", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 252617}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L883-L898", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Retrieves a list of load balancers in the data center.", "language": "python", "parameters": "(self, datacenter_id, depth=1)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "arg_0", ".", "_perform_request", "(", "'/datacenters/%s/loadbalancers?depth=%s'", "%", "(", "arg_1", ",", "str", "(", "arg_2", ")", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=1):\n        \"\"\"\n        Retrieves a list of load balancers in the data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``\n\n        \"\"\"\n        arg_3 = arg_0._perform_request(\n            '/datacenters/%s/loadbalancers?depth=%s' % (\n                arg_1, str(arg_2)))\n\n        return arg_3", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.list_loadbalancers", "docstring": "Retrieves a list of load balancers in the data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``", "docstring_tokens": ["Retrieves", "a", "list", "of", "load", "balancers", "in", "the", "data", "center", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 252618}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/files.py#L288-L309", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Yield all of the importable Python files in `dirname`, recursively.", "language": "python", "parameters": "(dirname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "in", "enumerate", "(", "os", ".", "walk", "(", "arg_0", ")", ")", ":", "if", "arg_1", ">", "0", "and", "'__init__.py'", "not", "in", "arg_4", ":", "del", "arg_3", "[", ":", "]", "continue", "for", "arg_5", "in", "arg_4", ":", "if", "re", ".", "match", "(", "r\"^[^.#~!$@%^&*()+=,]+\\.pyw?$\"", ",", "arg_5", ")", ":", "yield", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_5", ")"], "function": "def Func(arg_0):\n    \"\"\"Yield all of the importable Python files in `dirname`, recursively.\n\n    To be importable, the files have to be in a directory with a __init__.py,\n    except for `dirname` itself, which isn't required to have one.  The\n    assumption is that `dirname` was specified directly, so the user knows\n    best, but subdirectories are checked for a __init__.py to be sure we only\n    find the importable files.\n\n    \"\"\"\n    for arg_1, (arg_2, arg_3, arg_4) in enumerate(os.walk(arg_0)):\n        if arg_1 > 0 and '__init__.py' not in arg_4:\n            # If a directory doesn't have __init__.py, then it isn't\n            # importable and neither are its files\n            del arg_3[:]\n            continue\n        for arg_5 in arg_4:\n            # We're only interested in files that look like reasonable Python\n            # files: Must end with .py or .pyw, and must not have certain funny\n            # characters that probably mean they are editor junk.\n            if re.match(r\"^[^.#~!$@%^&*()+=,]+\\.pyw?$\", arg_5):\n                yield os.path.join(arg_2, arg_5)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/files.py", "identifier": "find_python_files", "docstring": "Yield all of the importable Python files in `dirname`, recursively.\n\n    To be importable, the files have to be in a directory with a __init__.py,\n    except for `dirname` itself, which isn't required to have one.  The\n    assumption is that `dirname` was specified directly, so the user knows\n    best, but subdirectories are checked for a __init__.py to be sure we only\n    find the importable files.", "docstring_tokens": ["Yield", "all", "of", "the", "importable", "Python", "files", "in", "dirname", "recursively", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 252619}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/positive_semidefinite_kernels/positive_semidefinite_kernel.py#L608-L624", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Flatten a list of kernels which may contain _SumKernel instances.", "language": "python", "parameters": "(kernels)", "return_statement": "return flattened", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "isinstance", "(", "arg_2", ",", "_SumKernel", ")", ":", "arg_1", "+=", "arg_2", ".", "kernels", "else", ":", "arg_1", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Flatten a list of kernels which may contain _SumKernel instances.\n\n  Args:\n    kernels: Python list of `PositiveSemidefiniteKernel` instances\n\n  Returns:\n    Python list containing the elements of kernels, with any _SumKernel\n    instances replaced by their `kernels` property contents.\n  \"\"\"\n  arg_1 = []\n  for arg_2 in arg_0:\n    if isinstance(arg_2, _SumKernel):\n      arg_1 += arg_2.kernels\n    else:\n      arg_1.append(arg_2)\n  return arg_1", "path": "tensorflow_probability/python/positive_semidefinite_kernels/positive_semidefinite_kernel.py", "identifier": "_flatten_summand_list", "docstring": "Flatten a list of kernels which may contain _SumKernel instances.\n\n  Args:\n    kernels: Python list of `PositiveSemidefiniteKernel` instances\n\n  Returns:\n    Python list containing the elements of kernels, with any _SumKernel\n    instances replaced by their `kernels` property contents.", "docstring_tokens": ["Flatten", "a", "list", "of", "kernels", "which", "may", "contain", "_SumKernel", "instances", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252620}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/seq.py#L170-L176", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Create a Sequence from Iterable s.", "language": "python", "parameters": "(s: Iterable)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "ISeq", "[", "Any", "]", ":", "try", ":", "arg_2", "=", "iter", "(", "arg_0", ")", "return", "_Sequence", "(", "arg_2", ",", "next", "(", "arg_2", ")", ")", "except", "StopIteration", ":", "return", "EMPTY"], "function": "def Func(arg_0: arg_1) -> ISeq[Any]:\n    \"\"\"Create a Sequence from Iterable s.\"\"\"\n    try:\n        arg_2 = iter(arg_0)\n        return _Sequence(arg_2, next(arg_2))\n    except StopIteration:\n        return EMPTY", "path": "src/basilisp/lang/seq.py", "identifier": "sequence", "docstring": "Create a Sequence from Iterable s.", "docstring_tokens": ["Create", "a", "Sequence", "from", "Iterable", "s", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252621}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L192-L196", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Get a temp filename for atomic download.", "language": "python", "parameters": "(target)", "return_statement": "return fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'%s-%s.tmp'", "%", "(", "arg_0", ",", "''", ".", "join", "(", "random", ".", "Random", "(", ")", ".", "sample", "(", "\"0123456789abcdefghijklmnopqrstuvwxyz\"", ",", "15", ")", ")", ")", "TEMP_FILES", ".", "add", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  '''Get a temp filename for atomic download.'''\n  arg_1 = '%s-%s.tmp' % (arg_0, ''.join(random.Random().sample(\"0123456789abcdefghijklmnopqrstuvwxyz\", 15)))\n  TEMP_FILES.add(arg_1)\n  return arg_1", "path": "s4cmd.py", "identifier": "tempfile_get", "docstring": "Get a temp filename for atomic download.", "docstring_tokens": ["Get", "a", "temp", "filename", "for", "atomic", "download", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 252622}
{"url": "https://github.com/cdriehuys/django-rest-email-auth/blob/7e752c4d77ae02d2d046f214f56e743aa12ab23f/rest_email_auth/factories.py#L59-L77", "sha": "7e752c4d77ae02d2d046f214f56e743aa12ab23f", "docstring_summary": "Create a new user instance.", "language": "python", "parameters": "(cls, model_class, *args, **kwargs)", "return_statement": "return manager.create_user(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_get_manager", "(", "arg_1", ")", "return", "arg_4", ".", "create_user", "(", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Create a new user instance.\n\n        Args:\n            model_class:\n                The type of model to create an instance of.\n            args:\n                Positional arguments to create the instance with.\n            kwargs:\n                Keyword arguments to create the instance with.\n\n        Returns:\n            A new user instance of the type specified by\n            ``model_class``.\n        \"\"\"\n        arg_4 = arg_0._get_manager(arg_1)\n\n        return arg_4.create_user(*arg_2, **arg_3)", "path": "rest_email_auth/factories.py", "identifier": "UserFactory._create", "docstring": "Create a new user instance.\n\n        Args:\n            model_class:\n                The type of model to create an instance of.\n            args:\n                Positional arguments to create the instance with.\n            kwargs:\n                Keyword arguments to create the instance with.\n\n        Returns:\n            A new user instance of the type specified by\n            ``model_class``.", "docstring_tokens": ["Create", "a", "new", "user", "instance", "."], "nwo": "cdriehuys/django-rest-email-auth", "score": 0.28490879858232004, "idx": 252623}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/pulse_lib/discrete.py#L23-L33", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Generates constant-sampled `SamplePulse`.", "language": "python", "parameters": "(duration: int, amp: complex, name: str = None)", "return_statement": "return _sampled_constant_pulse(duration, amp, name=name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "=", "None", ")", "->", "SamplePulse", ":", "return", "_sampled_Func_pulse", "(", "arg_0", ",", "arg_2", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = None) -> SamplePulse:\n    \"\"\"Generates Func-sampled `SamplePulse`.\n\n    Applies `left` sampling strategy to generate discrete pulse from continuous function.\n\n    Args:\n        duration: Duration of pulse. Must be greater than zero.\n        amp: Complex pulse amplitude.\n        name: Name of pulse.\n    \"\"\"\n    return _sampled_Func_pulse(arg_0, arg_2, arg_4=arg_4)", "path": "qiskit/pulse/pulse_lib/discrete.py", "identifier": "constant", "docstring": "Generates constant-sampled `SamplePulse`.\n\n    Applies `left` sampling strategy to generate discrete pulse from continuous function.\n\n    Args:\n        duration: Duration of pulse. Must be greater than zero.\n        amp: Complex pulse amplitude.\n        name: Name of pulse.", "docstring_tokens": ["Generates", "constant", "-", "sampled", "SamplePulse", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252624}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/__init__.py#L79-L96", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "trick to compute the formatting of children layout before actually\n        writing it", "language": "python", "parameters": "(self, layout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "out", "try", ":", "for", "arg_3", "in", "arg_1", ".", "children", ":", "arg_4", "=", "StringIO", "(", ")", "arg_0", ".", "out", "=", "arg_4", "arg_3", ".", "accept", "(", "arg_0", ")", "yield", "arg_4", ".", "getvalue", "(", ")", "finally", ":", "arg_0", ".", "out", "=", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"trick to compute the formatting of children layout before actually\n        writing it\n\n        return an iterator on strings (one for each child element)\n        \"\"\"\n        # Patch the underlying output stream with a fresh-generated stream,\n        # which is used to store a temporary representation of a child\n        # node.\n        arg_2 = arg_0.out\n        try:\n            for arg_3 in arg_1.children:\n                arg_4 = StringIO()\n                arg_0.out = arg_4\n                arg_3.accept(arg_0)\n                yield arg_4.getvalue()\n        finally:\n            arg_0.out = arg_2", "path": "pylint/reporters/ureports/__init__.py", "identifier": "BaseWriter.compute_content", "docstring": "trick to compute the formatting of children layout before actually\n        writing it\n\n        return an iterator on strings (one for each child element)", "docstring_tokens": ["trick", "to", "compute", "the", "formatting", "of", "children", "layout", "before", "actually", "writing", "it"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252625}
{"url": "https://github.com/welbornprod/fmtblock/blob/92a5529235d557170ed21e058e3c5995197facbe/fmtblock/formatters.py#L209-L236", "sha": "92a5529235d557170ed21e058e3c5995197facbe", "docstring_summary": "Format block by splitting on individual characters.", "language": "python", "parameters": "(self, text=None, width=60, fmtfunc=str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "60", ",", "arg_3", "=", "arg_4", ")", ":", "if", "arg_2", "<", "1", ":", "arg_2", "=", "1", "arg_1", "=", "(", "arg_0", ".", "text", "if", "arg_1", "is", "None", "else", "arg_1", ")", "or", "''", "arg_1", "=", "' '", ".", "join", "(", "arg_1", ".", "split", "(", "'\\n'", ")", ")", "arg_5", "=", "get_codes", "(", "arg_1", ")", "if", "not", "arg_5", ":", "yield", "from", "(", "arg_3", "(", "arg_1", "[", "arg_6", ":", "arg_6", "+", "arg_2", "]", ")", "for", "arg_6", "in", "range", "(", "0", ",", "len", "(", "arg_1", ")", ",", "arg_2", ")", ")", "else", ":", "arg_7", "=", "0", "arg_8", "=", "[", "]", "for", "arg_6", ",", "arg_9", "in", "enumerate", "(", "get_indices_list", "(", "arg_1", ")", ")", ":", "arg_8", ".", "append", "(", "arg_9", ")", "if", "len", "(", "arg_9", ")", "==", "1", ":", "arg_7", "+=", "1", "if", "arg_7", "==", "arg_2", ":", "yield", "''", ".", "join", "(", "arg_8", ")", "arg_8", "=", "[", "]", "arg_7", "=", "0", "if", "arg_8", ":", "yield", "''", ".", "join", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=60, arg_3=arg_4):\n        \"\"\" Format block by splitting on individual characters. \"\"\"\n        if arg_2 < 1:\n            arg_2 = 1\n        arg_1 = (arg_0.text if arg_1 is None else arg_1) or ''\n        arg_1 = ' '.join(arg_1.split('\\n'))\n        arg_5 = get_codes(arg_1)\n        if not arg_5:\n            # No escape codes, use simple method.\n            yield from (\n                arg_3(arg_1[arg_6:arg_6 + arg_2])\n                for arg_6 in range(0, len(arg_1), arg_2)\n            )\n        else:\n            # Ignore escape codes when counting.\n            arg_7 = 0\n            arg_8 = []\n            for arg_6, arg_9 in enumerate(get_indices_list(arg_1)):\n                arg_8.append(arg_9)\n                if len(arg_9) == 1:\n                    # Normal char.\n                    arg_7 += 1\n                if arg_7 == arg_2:\n                    yield ''.join(arg_8)\n                    arg_8 = []\n                    arg_7 = 0\n            if arg_8:\n                yield ''.join(arg_8)", "path": "fmtblock/formatters.py", "identifier": "FormatBlock.iter_char_block", "docstring": "Format block by splitting on individual characters.", "docstring_tokens": ["Format", "block", "by", "splitting", "on", "individual", "characters", "."], "nwo": "welbornprod/fmtblock", "score": 0.0, "idx": 252626}
{"url": "https://github.com/atlassistant/pychatl/blob/e2b5600c3183830be266f55fd110dc5e75a86e1c/pychatl/parser.py#L37-L54", "sha": "e2b5600c3183830be266f55fd110dc5e75a86e1c", "docstring_summary": "Parses the given DSL string and returns parsed results.", "language": "python", "parameters": "(input_string, prefix='')", "return_statement": "return visitor.parsed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "Funcr", ".", "Func", "(", "arg_0", ")", "arg_3", "=", "ChatlVisitor", "(", "arg_1", ")", "visit_Func_tree", "(", "arg_2", ",", "arg_3", ")", "return", "arg_3", ".", "Funcd"], "function": "def Func(arg_0, arg_1=''):\n  \"\"\"Parses the given DSL string and returns Funcd results.\n\n  Args:\n    input_string (str): DSL string\n    prefix (str): Optional prefix to add to every element name, useful to namespace things\n\n  Returns:\n    dict: Parsed content\n\n  \"\"\"\n\n  arg_2 = Funcr.Func(arg_0)\n  arg_3 = ChatlVisitor(arg_1)\n\n  visit_Func_tree(arg_2, arg_3)\n\n  return arg_3.Funcd", "path": "pychatl/parser.py", "identifier": "parse", "docstring": "Parses the given DSL string and returns parsed results.\n\n  Args:\n    input_string (str): DSL string\n    prefix (str): Optional prefix to add to every element name, useful to namespace things\n\n  Returns:\n    dict: Parsed content", "docstring_tokens": ["Parses", "the", "given", "DSL", "string", "and", "returns", "parsed", "results", "."], "nwo": "atlassistant/pychatl", "score": 0.138843686048881, "idx": 252627}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L105-L129", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Get an IO write task for the requested set of data", "language": "python", "parameters": "(self, fileobj, data, offset)", "return_statement": "return IOWriteTask(\n            self._transfer_coordinator,\n            main_kwargs={\n                'fileobj': fileobj,\n                'data': data,\n                'offset': offset,\n            }\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "IOWriteTask", "(", "arg_0", ".", "_transfer_coordinator", ",", "main_kwargs", "=", "{", "'fileobj'", ":", "arg_1", ",", "'data'", ":", "arg_2", ",", "'offset'", ":", "arg_3", ",", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Get an IO write task for the requested set of data\n\n        This task can be ran immediately or be submitted to the IO executor\n        for it to run.\n\n        :type fileobj: file-like object\n        :param fileobj: The file-like object to write to\n\n        :type data: bytes\n        :param data: The data to write out\n\n        :type offset: integer\n        :param offset: The offset to write the data to in the file-like object\n\n        :returns: An IO task to be used to write data to a file-like object\n        \"\"\"\n        return IOWriteTask(\n            arg_0._transfer_coordinator,\n            main_kwargs={\n                'fileobj': arg_1,\n                'data': arg_2,\n                'offset': arg_3,\n            }\n        )", "path": "s3transfer/download.py", "identifier": "DownloadOutputManager.get_io_write_task", "docstring": "Get an IO write task for the requested set of data\n\n        This task can be ran immediately or be submitted to the IO executor\n        for it to run.\n\n        :type fileobj: file-like object\n        :param fileobj: The file-like object to write to\n\n        :type data: bytes\n        :param data: The data to write out\n\n        :type offset: integer\n        :param offset: The offset to write the data to in the file-like object\n\n        :returns: An IO task to be used to write data to a file-like object", "docstring_tokens": ["Get", "an", "IO", "write", "task", "for", "the", "requested", "set", "of", "data"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 252628}
{"url": "https://github.com/memsql/memsql-python/blob/aac223a1b937d5b348b42af3c601a6c685ca633a/memsql/common/database.py#L124-L134", "sha": "aac223a1b937d5b348b42af3c601a6c685ca633a", "docstring_summary": "Returns the first row returned for the given query.", "language": "python", "parameters": "(self, query, *parameters, **kwparameters)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_query", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "not", "arg_4", ":", "return", "None", "elif", "not", "isinstance", "(", "arg_4", ",", "list", ")", ":", "raise", "MySQLError", "(", "\"Query is not a select query\"", ")", "elif", "len", "(", "arg_4", ")", ">", "1", ":", "raise", "MySQLError", "(", "\"Multiple rows returned for Database.Func() query\"", ")", "else", ":", "return", "arg_4", "[", "0", "]"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Returns the first row returned for the given query.\"\"\"\n        arg_4 = arg_0._query(arg_1, arg_2, arg_3)\n        if not arg_4:\n            return None\n        elif not isinstance(arg_4, list):\n            raise MySQLError(\"Query is not a select query\")\n        elif len(arg_4) > 1:\n            raise MySQLError(\"Multiple rows returned for Database.Func() query\")\n        else:\n            return arg_4[0]", "path": "memsql/common/database.py", "identifier": "Connection.get", "docstring": "Returns the first row returned for the given query.", "docstring_tokens": ["Returns", "the", "first", "row", "returned", "for", "the", "given", "query", "."], "nwo": "memsql/memsql-python", "score": 0.6220444802454773, "idx": 252629}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/api.py#L194-L203", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Get a modelx object from its full name.", "language": "python", "parameters": "(name: str)", "return_statement": "return parent", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "split", "(", "\".\"", ")", "arg_3", "=", "get_models", "(", ")", "[", "arg_2", ".", "pop", "(", "0", ")", "]", "while", "len", "(", "arg_2", ")", ">", "0", ":", "arg_4", "=", "arg_2", ".", "pop", "(", "0", ")", "arg_3", "=", "getattr", "(", "arg_3", ",", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0: arg_1):\n    \"\"\"Get a modelx object from its full name.\"\"\"\n    # TODO: Duplicate of system.Func\n    arg_2 = arg_0.split(\".\")\n    arg_3 = get_models()[arg_2.pop(0)]\n    while len(arg_2) > 0:\n        arg_4 = arg_2.pop(0)\n        arg_3 = getattr(arg_3, arg_4)\n\n    return arg_3", "path": "modelx/core/api.py", "identifier": "get_object", "docstring": "Get a modelx object from its full name.", "docstring_tokens": ["Get", "a", "modelx", "object", "from", "its", "full", "name", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 252630}
{"url": "https://github.com/fukuball/fuku-ml/blob/0da15ad7af76adf344b5a6b3f3dbabbbab3446b0/FukuML/MLBase.py#L34-L55", "sha": "0da15ad7af76adf344b5a6b3f3dbabbbab3446b0", "docstring_summary": "Transform data feature to high level", "language": "python", "parameters": "(self, mode='polynomial', degree=1)", "return_statement": "return self.train_X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'polynomial'", ",", "arg_2", "=", "1", ")", ":", "if", "arg_0", ".", "status", "!=", "'load_train_data'", ":", "print", "(", "\"Please load train data first.\"", ")", "return", "arg_0", ".", "train_X", "arg_0", ".", "feature_transform_mode", "=", "arg_1", "arg_0", ".", "feature_transform_degree", "=", "arg_2", "arg_0", ".", "train_X", "=", "arg_0", ".", "train_X", "[", ":", ",", "1", ":", "]", "arg_0", ".", "train_X", "=", "utility", ".", "DatasetLoader", ".", "feature_transform", "(", "arg_0", ".", "train_X", ",", "arg_0", ".", "feature_transform_mode", ",", "arg_0", ".", "feature_transform_degree", ")", "return", "arg_0", ".", "train_X"], "function": "def Func(arg_0, arg_1='polynomial', arg_2=1):\n\n        '''\n        Transform data feature to high level\n        '''\n\n        if arg_0.status != 'load_train_data':\n            print(\"Please load train data first.\")\n            return arg_0.train_X\n\n        arg_0.feature_transform_mode = arg_1\n        arg_0.feature_transform_degree = arg_2\n\n        arg_0.train_X = arg_0.train_X[:, 1:]\n\n        arg_0.train_X = utility.DatasetLoader.feature_transform(\n            arg_0.train_X,\n            arg_0.feature_transform_mode,\n            arg_0.feature_transform_degree\n        )\n\n        return arg_0.train_X", "path": "FukuML/MLBase.py", "identifier": "Learner.set_feature_transform", "docstring": "Transform data feature to high level", "docstring_tokens": ["Transform", "data", "feature", "to", "high", "level"], "nwo": "fukuball/fuku-ml", "score": 0.4728707839364459, "idx": 252631}
{"url": "https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L42-L57", "sha": "a2ee417b784ca72c89c05bddb2e3e815a6b95154", "docstring_summary": "alternative to reify and property decorators. caches the value when it's\n    generated. It cashes it as instance._name_of_the_property.", "language": "python", "parameters": "(method)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "property", ":", "arg_1", "=", "\"_\"", "+", "arg_0", ".", "__name__", "@", "property", "def", "wrapper", "(", "arg_2", ")", ":", "try", ":", "return", "getattr", "(", "arg_2", ",", "arg_1", ")", "except", "AttributeError", ":", "arg_3", "=", "arg_0", "(", "arg_2", ")", "setattr", "(", "arg_2", ",", "arg_1", ",", "arg_3", ")", "return", "arg_3", "return", "wrapper"], "function": "def Func(arg_0) -> property:\n    \"\"\"alternative to reify and property decorators. caches the value when it's\n    generated. It cashes it as instance._name_of_the_property.\n    \"\"\"\n    arg_1 = \"_\" + arg_0.__name__\n\n    @property\n    def wrapper(arg_2):\n        try:\n            return getattr(arg_2, arg_1)\n        except AttributeError:\n            arg_3 = arg_0(arg_2)\n            setattr(arg_2, arg_1, arg_3)\n            return arg_3\n\n    return wrapper", "path": "libaaron/libaaron.py", "identifier": "cached", "docstring": "alternative to reify and property decorators. caches the value when it's\n    generated. It cashes it as instance._name_of_the_property.", "docstring_tokens": ["alternative", "to", "reify", "and", "property", "decorators", ".", "caches", "the", "value", "when", "it", "s", "generated", ".", "It", "cashes", "it", "as", "instance", ".", "_name_of_the_property", "."], "nwo": "ninjaaron/libaaron", "score": 0.3518893757964147, "idx": 252632}
{"url": "https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/helpers.py#L41-L78", "sha": "aca085ea54541b087140b58a81332f8728baeeb2", "docstring_summary": "Retrieve descriptor.", "language": "python", "parameters": "(descriptor)", "return_statement": "return the_descriptor", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "if", "arg_1", "is", "None", ":", "arg_1", "=", "{", "}", "if", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "try", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'r'", ")", "as", "f", ":", "arg_1", "=", "json", ".", "load", "(", "f", ")", "else", ":", "arg_2", "=", "requests", ".", "get", "(", "arg_1", ")", "arg_2", ".", "raise_for_status", "(", ")", "arg_2", ".", "encoding", "=", "'utf8'", "arg_1", "=", "arg_2", ".", "json", "(", ")", "except", "(", "IOError", ",", "requests", ".", "exceptions", ".", "RequestException", ")", "as", "error", ":", "arg_4", "=", "'Unable to load JSON at \"%s\"'", "%", "arg_0", "six", ".", "raise_from", "(", "exceptions", ".", "DataPackageException", "(", "arg_4", ")", ",", "error", ")", "except", "ValueError", "as", "error", ":", "arg_4", "=", "'Unable to parse JSON at \"%s\". %s'", "%", "(", "arg_0", ",", "error", ")", "six", ".", "raise_from", "(", "exceptions", ".", "DataPackageException", "(", "arg_4", ")", ",", "error", ")", "if", "hasattr", "(", "arg_1", ",", "'read'", ")", ":", "try", ":", "arg_1", "=", "json", ".", "load", "(", "arg_1", ")", "except", "ValueError", "as", "e", ":", "six", ".", "raise_from", "(", "exceptions", ".", "DataPackageException", "(", "str", "(", "e", ")", ")", ",", "e", ")", "if", "not", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_5", "=", "'Data must be a \\'dict\\', but was a \\'{0}\\''", "raise", "exceptions", ".", "DataPackageException", "(", "arg_5", ".", "format", "(", "type", "(", "arg_1", ")", ".", "__name__", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Retrieve descriptor.\n    \"\"\"\n    arg_1 = arg_0\n\n    if arg_1 is None:\n        arg_1 = {}\n\n    if isinstance(arg_1, six.string_types):\n        try:\n            if os.path.isfile(arg_1):\n                with open(arg_1, 'r') as f:\n                    arg_1 = json.load(f)\n            else:\n                arg_2 = requests.get(arg_1)\n                arg_2.raise_for_status()\n                # Force UTF8 encoding for 'text/plain' sources\n                arg_2.encoding = 'utf8'\n                arg_1 = arg_2.json()\n        except (IOError, requests.exceptions.RequestException) as error:\n            arg_4 = 'Unable to load JSON at \"%s\"' % arg_0\n            six.raise_from(exceptions.DataPackageException(arg_4), error)\n        except ValueError as error:\n            # Python2 doesn't have json.JSONDecodeError (use ValueErorr)\n            arg_4 = 'Unable to parse JSON at \"%s\". %s' % (arg_0, error)\n            six.raise_from(exceptions.DataPackageException(arg_4), error)\n\n    if hasattr(arg_1, 'read'):\n        try:\n            arg_1 = json.load(arg_1)\n        except ValueError as e:\n            six.raise_from(exceptions.DataPackageException(str(e)), e)\n\n    if not isinstance(arg_1, dict):\n        arg_5 = 'Data must be a \\'dict\\', but was a \\'{0}\\''\n        raise exceptions.DataPackageException(arg_5.format(type(arg_1).__name__))\n\n    return arg_1", "path": "datapackage/helpers.py", "identifier": "retrieve_descriptor", "docstring": "Retrieve descriptor.", "docstring_tokens": ["Retrieve", "descriptor", "."], "nwo": "frictionlessdata/datapackage-py", "score": 0.5653088377587532, "idx": 252633}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L101-L130", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "Validate min and max bounds are within waveform's independent variable vector.", "language": "python", "parameters": "(wave, indep_min, indep_max)", "return_statement": "return indep_min, indep_max", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "False", ",", "False", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "_indep_vector", "[", "0", "]", "arg_3", "=", "True", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "_indep_vector", "[", "-", "1", "]", "arg_4", "=", "True", "if", "arg_3", "and", "arg_4", ":", "return", "arg_1", ",", "arg_2", "arg_5", "=", "pexdoc", ".", "exh", ".", "addex", "(", "RuntimeError", ",", "\"Incongruent `indep_min` and `indep_max` arguments\"", ")", "arg_6", "=", "pexdoc", ".", "exh", ".", "addai", "(", "\"indep_min\"", ")", "arg_7", "=", "pexdoc", ".", "exh", ".", "addai", "(", "\"indep_max\"", ")", "arg_5", "(", "bool", "(", "arg_1", ">=", "arg_2", ")", ")", "arg_6", "(", "bool", "(", "(", "arg_1", "<", "arg_0", ".", "_indep_vector", "[", "0", "]", ")", "and", "(", "not", "np", ".", "isclose", "(", "arg_1", ",", "arg_0", ".", "_indep_vector", "[", "0", "]", ",", "FP_RTOL", ",", "FP_ATOL", ")", ")", ")", ")", "arg_7", "(", "bool", "(", "(", "arg_2", ">", "arg_0", ".", "_indep_vector", "[", "-", "1", "]", ")", "and", "(", "not", "np", ".", "isclose", "(", "arg_2", ",", "arg_0", ".", "_indep_vector", "[", "-", "1", "]", ",", "FP_RTOL", ",", "FP_ATOL", ")", ")", ")", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Validate min and max bounds are within waveform's independent variable vector.\"\"\"\n    arg_3, arg_4 = False, False\n    if arg_1 is None:\n        arg_1 = arg_0._indep_vector[0]\n        arg_3 = True\n    if arg_2 is None:\n        arg_2 = arg_0._indep_vector[-1]\n        arg_4 = True\n    if arg_3 and arg_4:\n        return arg_1, arg_2\n    arg_5 = pexdoc.exh.addex(\n        RuntimeError, \"Incongruent `indep_min` and `indep_max` arguments\"\n    )\n    arg_6 = pexdoc.exh.addai(\"indep_min\")\n    arg_7 = pexdoc.exh.addai(\"indep_max\")\n    arg_5(bool(arg_1 >= arg_2))\n    arg_6(\n        bool(\n            (arg_1 < arg_0._indep_vector[0])\n            and (not np.isclose(arg_1, arg_0._indep_vector[0], FP_RTOL, FP_ATOL))\n        )\n    )\n    arg_7(\n        bool(\n            (arg_2 > arg_0._indep_vector[-1])\n            and (not np.isclose(arg_2, arg_0._indep_vector[-1], FP_RTOL, FP_ATOL))\n        )\n    )\n    return arg_1, arg_2", "path": "peng/wave_functions.py", "identifier": "_validate_min_max", "docstring": "Validate min and max bounds are within waveform's independent variable vector.", "docstring_tokens": ["Validate", "min", "and", "max", "bounds", "are", "within", "waveform", "s", "independent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 252634}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L78-L132", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch commits.", "language": "python", "parameters": "(self, category=CATEGORY_COMMIT, from_date=DEFAULT_DATETIME, to_date=DEFAULT_LAST_DATETIME,\n              branches=None, latest_items=False, no_update=False)", "return_statement": "return items", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "arg_6", ",", "arg_7", "=", "None", ",", "arg_8", "=", "False", ",", "arg_9", "=", "False", ")", ":", "if", "not", "arg_3", ":", "arg_3", "=", "arg_4", "if", "not", "arg_5", ":", "arg_5", "=", "arg_6", "arg_10", "=", "{", "'from_date'", ":", "arg_3", ",", "'to_date'", ":", "arg_5", ",", "'branches'", ":", "arg_7", ",", "'latest_items'", ":", "arg_8", ",", "'no_update'", ":", "arg_9", "}", "arg_11", "=", "super", "(", ")", ".", "Func", "(", "arg_1", ",", "**", "arg_10", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=arg_4, arg_5=arg_6,\n              arg_7=None, arg_8=False, arg_9=False):\n        \"\"\"Fetch commits.\n\n        The method retrieves from a Git repository or a log file\n        a list of commits. Commits are returned in the same order\n        they were obtained.\n\n        When `from_date` parameter is given it returns items commited\n        since the given date.\n\n        The list of `branches` is a list of strings, with the names of\n        the branches to Func. If the list of branches is empty, no\n        commit is Funced. If the list of branches is None, all commits\n        for all branches will be Funced.\n\n        The parameter `latest_items` returns only those commits which\n        are new since the last time this method was called.\n\n        The parameter `no_update` returns all commits without performing\n        an update of the repository before.\n\n        Take into account that `from_date` and `branches` are ignored\n        when the commits are Funced from a Git log file or when\n        `latest_items` flag is set.\n\n        The class raises a `RepositoryError` exception when an error\n        occurs accessing the repository.\n\n        :param category: the category of items to Func\n        :param from_date: obtain commits newer than a specific date\n            (inclusive)\n        :param to_date: obtain commits older than a specific date\n        :param branches: names of branches to Func from (default: None)\n        :param latest_items: sync with the repository to Func only the\n            newest commits\n        :param no_update: if enabled, don't update the repo with the latest changes\n\n        :returns: a generator of commits\n        \"\"\"\n        if not arg_3:\n            arg_3 = arg_4\n        if not arg_5:\n            arg_5 = arg_6\n\n        arg_10 = {\n            'from_date': arg_3,\n            'to_date': arg_5,\n            'branches': arg_7,\n            'latest_items': arg_8,\n            'no_update': arg_9\n        }\n        arg_11 = super().Func(arg_1, **arg_10)\n\n        return arg_11", "path": "perceval/backends/core/git.py", "identifier": "Git.fetch", "docstring": "Fetch commits.\n\n        The method retrieves from a Git repository or a log file\n        a list of commits. Commits are returned in the same order\n        they were obtained.\n\n        When `from_date` parameter is given it returns items commited\n        since the given date.\n\n        The list of `branches` is a list of strings, with the names of\n        the branches to fetch. If the list of branches is empty, no\n        commit is fetched. If the list of branches is None, all commits\n        for all branches will be fetched.\n\n        The parameter `latest_items` returns only those commits which\n        are new since the last time this method was called.\n\n        The parameter `no_update` returns all commits without performing\n        an update of the repository before.\n\n        Take into account that `from_date` and `branches` are ignored\n        when the commits are fetched from a Git log file or when\n        `latest_items` flag is set.\n\n        The class raises a `RepositoryError` exception when an error\n        occurs accessing the repository.\n\n        :param category: the category of items to fetch\n        :param from_date: obtain commits newer than a specific date\n            (inclusive)\n        :param to_date: obtain commits older than a specific date\n        :param branches: names of branches to fetch from (default: None)\n        :param latest_items: sync with the repository to fetch only the\n            newest commits\n        :param no_update: if enabled, don't update the repo with the latest changes\n\n        :returns: a generator of commits", "docstring_tokens": ["Fetch", "commits", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 252635}
{"url": "https://github.com/Music-Moo/music2storage/blob/de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2/music2storage/service.py#L49-L68", "sha": "de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2", "docstring_summary": "Downloads a MP4 or WebM file that is associated with the video at the URL passed.", "language": "python", "parameters": "(self, url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "YouTube", "(", "arg_1", ")", "except", "RegexMatchError", ":", "log", ".", "error", "(", "f\"Cannot Func file at {url}\"", ")", "else", ":", "arg_3", "=", "arg_2", ".", "streams", ".", "first", "(", ")", "log", ".", "info", "(", "f\"Download for {stream.default_filename} has started\"", ")", "arg_4", "=", "time", "(", ")", "arg_3", ".", "Func", "(", ")", "arg_5", "=", "time", "(", ")", "log", ".", "info", "(", "f\"Download for {stream.default_filename} has finished in {end_time - start_time} seconds\"", ")", "return", "arg_3", ".", "default_filename"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Downloads a MP4 or WebM file that is associated with the video at the URL passed.\n\n        :param str url: URL of the video to be Funced\n        :return str: Filename of the file in local storage\n        \"\"\"\n\n        try:\n            arg_2 = YouTube(arg_1)\n        except RegexMatchError:\n            log.error(f\"Cannot Func file at {url}\")\n        else:\n            arg_3 = arg_2.streams.first()\n            log.info(f\"Download for {stream.default_filename} has started\")\n            arg_4 = time()\n            arg_3.Func()\n            arg_5 = time()\n            log.info(f\"Download for {stream.default_filename} has finished in {end_time - start_time} seconds\")\n            return arg_3.default_filename", "path": "music2storage/service.py", "identifier": "Youtube.download", "docstring": "Downloads a MP4 or WebM file that is associated with the video at the URL passed.\n\n        :param str url: URL of the video to be downloaded\n        :return str: Filename of the file in local storage", "docstring_tokens": ["Downloads", "a", "MP4", "or", "WebM", "file", "that", "is", "associated", "with", "the", "video", "at", "the", "URL", "passed", "."], "nwo": "Music-Moo/music2storage", "score": 0.23137166388621372, "idx": 252636}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/util.py#L32-L37", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Join an iterable by a delimiter, replacing instances of delimiter in items\n  with escape + delimiter.", "language": "python", "parameters": "(iterable, delimiter=\" \", escape=\"\\\\\")", "return_statement": "return delimiter.join(i.replace(delimiter, rep) for i in iterable)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\" \"", ",", "arg_2", "=", "\"\\\\\"", ")", ":", "arg_3", "=", "arg_2", "+", "arg_1", "return", "arg_1", ".", "join", "(", "arg_4", ".", "replace", "(", "arg_1", ",", "arg_3", ")", "for", "arg_4", "in", "arg_0", ")"], "function": "def Func(arg_0, arg_1=\" \", arg_2=\"\\\\\"):\n  \"\"\"Join an iterable by a delimiter, replacing instances of delimiter in items\n  with escape + delimiter.\n  \"\"\"\n  arg_3 = arg_2 + arg_1\n  return arg_1.join(arg_4.replace(arg_1, arg_3) for arg_4 in arg_0)", "path": "pyebnf/util.py", "identifier": "esc_join", "docstring": "Join an iterable by a delimiter, replacing instances of delimiter in items\n  with escape + delimiter.", "docstring_tokens": ["Join", "an", "iterable", "by", "a", "delimiter", "replacing", "instances", "of", "delimiter", "in", "items", "with", "escape", "+", "delimiter", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 252637}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/trits.py#L21-L44", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Adds two sequences of trits together.", "language": "python", "parameters": "(left, right)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "max", "(", "len", "(", "arg_0", ")", ",", "len", "(", "arg_1", ")", ")", "arg_3", "=", "[", "0", "]", "*", "arg_2", "arg_0", "+=", "[", "0", "]", "*", "(", "arg_2", "-", "len", "(", "arg_0", ")", ")", "arg_1", "+=", "[", "0", "]", "*", "(", "arg_2", "-", "len", "(", "arg_1", ")", ")", "arg_4", "=", "0", "for", "arg_5", "in", "range", "(", "len", "(", "arg_3", ")", ")", ":", "arg_3", "[", "arg_5", "]", ",", "arg_4", "=", "_full_Func", "(", "arg_0", "[", "arg_5", "]", ",", "arg_1", "[", "arg_5", "]", ",", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    # type: (Sequence[int], Sequence[int]) -> List[int]\n    \"\"\"\n    Adds two sequences of trits together.\n\n    The result is a list of trits equal in length to the longer of the\n    two sequences.\n\n    .. note::\n        Overflow is possible.\n\n        For example, ``Func([1], [1])`` returns ``[-1]``.\n    \"\"\"\n    arg_2 = max(len(arg_0), len(arg_1))\n\n    arg_3 = [0] * arg_2\n    arg_0 += [0] * (arg_2 - len(arg_0))\n    arg_1 += [0] * (arg_2 - len(arg_1))\n\n    arg_4 = 0\n    for arg_5 in range(len(arg_3)):\n        arg_3[arg_5], arg_4 = _full_Func(arg_0[arg_5], arg_1[arg_5], arg_4)\n\n    return arg_3", "path": "iota/trits.py", "identifier": "add_trits", "docstring": "Adds two sequences of trits together.\n\n    The result is a list of trits equal in length to the longer of the\n    two sequences.\n\n    .. note::\n        Overflow is possible.\n\n        For example, ``add_trits([1], [1])`` returns ``[-1]``.", "docstring_tokens": ["Adds", "two", "sequences", "of", "trits", "together", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 252638}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/persist.py#L32-L57", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Serialize a value from an xtuml metamodel instance.", "language": "python", "parameters": "(value, ty)", "return_statement": "return transfer_fn[ty](value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "upper", "(", ")", "arg_2", "=", "{", "'BOOLEAN'", ":", "False", ",", "'INTEGER'", ":", "0", ",", "'REAL'", ":", "0.0", ",", "'STRING'", ":", "''", ",", "'UNIQUE_ID'", ":", "0", "}", "arg_3", "=", "{", "'BOOLEAN'", ":", "lambda", "v", ":", "'%d'", "%", "int", "(", "v", ")", ",", "'INTEGER'", ":", "lambda", "v", ":", "'%d'", "%", "v", ",", "'REAL'", ":", "lambda", "v", ":", "'%f'", "%", "v", ",", "'STRING'", ":", "lambda", "v", ":", "\"'%s'\"", "%", "v", ".", "replace", "(", "\"'\"", ",", "\"''\"", ")", ",", "'UNIQUE_ID'", ":", "lambda", "v", ":", "'\"%s\"'", "%", "uuid", ".", "UUID", "(", "int", "=", "v", ")", "}", "if", "arg_0", "is", "None", ":", "arg_0", "=", "arg_2", "[", "arg_1", "]", "return", "arg_3", "[", "arg_1", "]", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Serialize a value from an xtuml metamodel instance.\n    '''\n    arg_1 = arg_1.upper()\n    \n    arg_2 = {\n        'BOOLEAN'   : False,\n        'INTEGER'   : 0,\n        'REAL'      : 0.0,\n        'STRING'    : '',\n        'UNIQUE_ID' : 0\n    }\n    \n    arg_3 = {\n        'BOOLEAN'     : lambda v: '%d' % int(v),\n        'INTEGER'     : lambda v: '%d' % v,\n        'REAL'        : lambda v: '%f' % v,\n        'STRING'      : lambda v: \"'%s'\" % v.replace(\"'\", \"''\"),\n        'UNIQUE_ID'   : lambda v: '\"%s\"' % uuid.UUID(int=v)\n    }\n\n    if arg_0 is None:\n        arg_0 = arg_2[arg_1]\n    \n    return arg_3[arg_1](arg_0)", "path": "xtuml/persist.py", "identifier": "serialize_value", "docstring": "Serialize a value from an xtuml metamodel instance.", "docstring_tokens": ["Serialize", "a", "value", "from", "an", "xtuml", "metamodel", "instance", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 252639}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/_superjson.py#L476-L484", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "``collections.OrderedDict`` dumper.", "language": "python", "parameters": "(self, obj, class_name=\"collections.OrderedDict\")", "return_statement": "return {\n            \"$\" + class_name: [\n                (key, self._json_convert(value)) for key, value in iteritems(obj)\n            ]\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"collections.OrderedDict\"", ")", ":", "return", "{", "\"$\"", "+", "arg_2", ":", "[", "(", "arg_3", ",", "arg_0", ".", "_json_convert", "(", "arg_4", ")", ")", "for", "arg_3", ",", "arg_4", "in", "iteritems", "(", "arg_1", ")", "]", "}"], "function": "def Func(arg_0, arg_1, arg_2=\"collections.OrderedDict\"):\n        \"\"\"\n        ``collections.OrderedDict`` dumper.\n        \"\"\"\n        return {\n            \"$\" + arg_2: [\n                (arg_3, arg_0._json_convert(arg_4)) for arg_3, arg_4 in iteritems(arg_1)\n            ]\n        }", "path": "superjson/_superjson.py", "identifier": "SupportBuiltInDataType.dump_OrderedDict", "docstring": "``collections.OrderedDict`` dumper.", "docstring_tokens": ["collections", ".", "OrderedDict", "dumper", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 252640}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L740-L758", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get a list of most queried decks", "language": "python", "parameters": "(self, **params: keys)", "return_statement": "return self._get_model(url, **params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "api", ".", "POPULAR", "+", "'/decks'", "return", "arg_0", ".", "_get_model", "(", "arg_3", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1: arg_2):\n        \"\"\"Get a list of most queried decks\n\n        \\*\\*keys: Optional[list] = None\n            Filter which keys should be included in the\n            response\n        \\*\\*exclude: Optional[list] = None\n            Filter which keys should be excluded from the\n            response\n        \\*\\*max: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*page: Optional[int] = None\n            Works with max, the zero-based page of the\n            items\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_3 = arg_0.api.POPULAR + '/decks'\n        return arg_0._get_model(arg_3, **arg_1)", "path": "clashroyale/royaleapi/client.py", "identifier": "Client.get_popular_decks", "docstring": "Get a list of most queried decks\n\n        \\*\\*keys: Optional[list] = None\n            Filter which keys should be included in the\n            response\n        \\*\\*exclude: Optional[list] = None\n            Filter which keys should be excluded from the\n            response\n        \\*\\*max: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*page: Optional[int] = None\n            Works with max, the zero-based page of the\n            items\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "a", "list", "of", "most", "queried", "decks"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 252641}
{"url": "https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/backends/base/backend.py#L66-L80", "sha": "c23ce9732720856e2f6dc54060db71a8182c7d4b", "docstring_summary": "Merges config with templates", "language": "python", "parameters": "(self, config, templates)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_2", ":", "return", "arg_1", "if", "not", "isinstance", "(", "arg_2", ",", "list", ")", ":", "raise", "TypeError", "(", "'templates argument must be an instance of list'", ")", "arg_3", "=", "{", "}", "arg_4", "=", "arg_2", "+", "[", "arg_1", "]", "for", "arg_5", "in", "arg_4", ":", "arg_3", "=", "merge_config", "(", "arg_3", ",", "arg_0", ".", "_load", "(", "arg_5", ")", ",", "arg_0", ".", "list_identifiers", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Merges config with templates\n        \"\"\"\n        if not arg_2:\n            return arg_1\n        # type check\n        if not isinstance(arg_2, list):\n            raise TypeError('templates argument must be an instance of list')\n        # merge templates with main configuration\n        arg_3 = {}\n        arg_4 = arg_2 + [arg_1]\n        for arg_5 in arg_4:\n            arg_3 = merge_config(arg_3, arg_0._load(arg_5), arg_0.list_identifiers)\n        return arg_3", "path": "netjsonconfig/backends/base/backend.py", "identifier": "BaseBackend._merge_config", "docstring": "Merges config with templates", "docstring_tokens": ["Merges", "config", "with", "templates"], "nwo": "openwisp/netjsonconfig", "score": 0.6422153945684831, "idx": 252642}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L1042-L1059", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "This method generates a dictionary of the query string\n        parameters contained in a given editable URL.", "language": "python", "parameters": "(req)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "compile", "(", "r\"[\\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)\"", ")", "arg_2", "=", "arg_1", ".", "findall", "(", "arg_0", ")", "if", "arg_2", ":", "arg_3", "=", "dict", "(", ")", "for", "arg_4", "in", "arg_2", ":", "(", "arg_5", ",", "arg_6", ")", "=", "arg_4", "if", "arg_5", "in", "arg_3", ":", "raise", "Exception", "(", "\"%s option already defined\"", "%", "arg_5", ")", "arg_3", "[", "arg_5", "]", "=", "arg_6", "return", "arg_3", "return", "None"], "function": "def Func(arg_0):\n\n    \"\"\"\n        This method generates a dictionary of the query string\n        parameters contained in a given editable URL.\n    \"\"\"\n    arg_1 = re.compile(r\"[\\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)\")\n    arg_2 = arg_1.findall(arg_0)\n\n    if arg_2:\n        arg_3 = dict()\n        for arg_4 in arg_2:\n            (arg_5, arg_6) = arg_4\n            if arg_5 in arg_3:\n                raise Exception(\"%s option already defined\" % arg_5)\n            arg_3[arg_5] = arg_6\n        return arg_3\n    return None", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py", "identifier": "_build_editable_options", "docstring": "This method generates a dictionary of the query string\n        parameters contained in a given editable URL.", "docstring_tokens": ["This", "method", "generates", "a", "dictionary", "of", "the", "query", "string", "parameters", "contained", "in", "a", "given", "editable", "URL", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252643}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L360-L368", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Send buffered metrics in batch requests", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "remote_address", "while", "len", "(", "arg_0", ".", "_batches", ")", ">", "0", ":", "arg_0", ".", "_socket", ".", "sendto", "(", "arg_0", ".", "_batches", "[", "0", "]", ",", "arg_1", ")", "arg_0", ".", "_batches", ".", "popleft", "(", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        # type: () -> BatchClient\n        \"\"\"Send buffered metrics in batch requests\"\"\"\n\n        arg_1 = arg_0.remote_address\n        while len(arg_0._batches) > 0:\n            arg_0._socket.sendto(arg_0._batches[0], arg_1)\n            arg_0._batches.popleft()\n        return arg_0", "path": "statsdmetrics/client/__init__.py", "identifier": "BatchClient.flush", "docstring": "Send buffered metrics in batch requests", "docstring_tokens": ["Send", "buffered", "metrics", "in", "batch", "requests"], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 252644}
{"url": "https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/directory_monitor.py#L15-L52", "sha": "6ac71bda1de6706fb34244ae4972e36db5f062d3", "docstring_summary": "Construct a function that checks a directory for process configuration", "language": "python", "parameters": "(location, receiver)", "return_statement": "return functools.partial(_check, path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "filepath", ".", "FilePath", "(", "arg_0", ")", "arg_3", "=", "set", "(", ")", "arg_4", "=", "{", "}", "def", "_check", "(", "arg_2", ")", ":", "arg_5", "=", "set", "(", "arg_8", "for", "arg_8", "in", "os", ".", "listdir", "(", "arg_0", ")", "if", "not", "arg_8", ".", "endswith", "(", "'.new'", ")", ")", "arg_6", "=", "arg_3", "-", "arg_5", "arg_7", "=", "arg_5", "-", "arg_3", "for", "arg_8", "in", "arg_7", ":", "arg_9", "=", "arg_2", ".", "child", "(", "arg_8", ")", ".", "getContent", "(", ")", "arg_4", "[", "arg_8", "]", "=", "arg_9", "arg_1", ".", "add", "(", "arg_8", ",", "arg_9", ")", "for", "arg_8", "in", "arg_6", ":", "arg_1", ".", "remove", "(", "arg_8", ")", "arg_10", "=", "arg_5", "&", "arg_3", "for", "arg_8", "in", "arg_10", ":", "arg_11", "=", "arg_2", ".", "child", "(", "arg_8", ")", ".", "getContent", "(", ")", "arg_12", "=", "arg_4", "[", "arg_8", "]", "if", "arg_11", "==", "arg_12", ":", "continue", "arg_1", ".", "remove", "(", "arg_8", ")", "arg_4", "[", "arg_8", "]", "=", "arg_11", "arg_1", ".", "add", "(", "arg_8", ",", "arg_11", ")", "arg_3", ".", "clear", "(", ")", "arg_3", ".", "update", "(", "arg_5", ")", "return", "functools", ".", "partial", "(", "_check", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Construct a function that checks a directory for process configuration\n\n    The function checks for additions or removals\n    of JSON process configuration files and calls the appropriate receiver\n    methods.\n\n    :param location: string, the directory to monitor\n    :param receiver: IEventReceiver\n    :returns: a function with no parameters\n    \"\"\"\n    arg_2 = filepath.FilePath(arg_0)\n    arg_3 = set()\n    arg_4 = {}\n\n    def _check(arg_2):\n        arg_5 = set(arg_8 for arg_8 in os.listdir(arg_0)\n                           if not arg_8.endswith('.new'))\n        arg_6 = arg_3 - arg_5\n        arg_7 = arg_5 - arg_3\n        for arg_8 in arg_7:\n            arg_9 = arg_2.child(arg_8).getContent()\n            arg_4[arg_8] = arg_9\n            arg_1.add(arg_8, arg_9)\n        for arg_8 in arg_6:\n            arg_1.remove(arg_8)\n        arg_10 = arg_5 & arg_3\n        for arg_8 in arg_10:\n            arg_11 = arg_2.child(arg_8).getContent()\n            arg_12 = arg_4[arg_8]\n            if arg_11 == arg_12:\n                continue\n            arg_1.remove(arg_8)\n            arg_4[arg_8] = arg_11\n            arg_1.add(arg_8, arg_11)\n        arg_3.clear()\n        arg_3.update(arg_5)\n    return functools.partial(_check, arg_2)", "path": "ncolony/directory_monitor.py", "identifier": "checker", "docstring": "Construct a function that checks a directory for process configuration\n\n    The function checks for additions or removals\n    of JSON process configuration files and calls the appropriate receiver\n    methods.\n\n    :param location: string, the directory to monitor\n    :param receiver: IEventReceiver\n    :returns: a function with no parameters", "docstring_tokens": ["Construct", "a", "function", "that", "checks", "a", "directory", "for", "process", "configuration"], "nwo": "ncolony/ncolony", "score": 0.2757871243566705, "idx": 252645}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/bounds.py#L363-L368", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Censor any values outside of range with ``None``", "language": "python", "parameters": "(x, range, value=None)", "return_statement": "return [val if range[0] <= val <= range[1] else value\n            for val in x]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "[", "arg_3", "if", "arg_1", "[", "0", "]", "<=", "arg_3", "<=", "arg_1", "[", "1", "]", "else", "arg_2", "for", "arg_3", "in", "arg_0", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Censor any values outside of range with ``None``\n    \"\"\"\n    return [arg_3 if arg_1[0] <= arg_3 <= arg_1[1] else arg_2\n            for arg_3 in arg_0]", "path": "mizani/bounds.py", "identifier": "_censor_with", "docstring": "Censor any values outside of range with ``None``", "docstring_tokens": ["Censor", "any", "values", "outside", "of", "range", "with", "None"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 252646}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/checklist.py#L47-L56", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get the items for this checklist. Returns a list of ChecklistItem objects.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return checklistitems_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "get_card", "(", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "get_items", "(", "arg_1", ")", ":", "arg_3", ".", "append", "(", "arg_0", ".", "create_checklist_item", "(", "arg_2", ".", "id", ",", "arg_0", ".", "id", ",", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Get the items for this checklist. Returns a list of ChecklistItem objects.\n        \"\"\"\n        arg_2 = arg_0.get_card()\n        arg_3 = []\n        for arg_4 in arg_0.get_items(arg_1):\n            arg_3.append(arg_0.create_checklist_item(arg_2.id, arg_0.id, arg_4))\n\n        return arg_3", "path": "trolly/checklist.py", "identifier": "Checklist.get_item_objects", "docstring": "Get the items for this checklist. Returns a list of ChecklistItem objects.", "docstring_tokens": ["Get", "the", "items", "for", "this", "checklist", ".", "Returns", "a", "list", "of", "ChecklistItem", "objects", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 252647}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/_util.py#L210-L250", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Delete size bytes of empty space starting at offset.", "language": "python", "parameters": "(fobj, size, offset, BUFFER_SIZE=2**16)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "2", "**", "16", ")", ":", "arg_4", "=", "False", "assert", "0", "<", "arg_1", "assert", "0", "<=", "arg_2", "arg_0", ".", "seek", "(", "0", ",", "2", ")", "arg_5", "=", "arg_0", ".", "tell", "(", ")", "arg_6", "=", "arg_5", "-", "arg_2", "-", "arg_1", "assert", "0", "<=", "arg_6", "try", ":", "if", "arg_6", ">", "0", ":", "arg_0", ".", "flush", "(", ")", "try", ":", "import", "mmap", "arg_7", "=", "mmap", ".", "mmap", "(", "arg_0", ".", "fileno", "(", ")", ",", "arg_5", ")", "try", ":", "arg_7", ".", "move", "(", "arg_2", ",", "arg_2", "+", "arg_1", ",", "arg_6", ")", "finally", ":", "arg_7", ".", "close", "(", ")", "except", "(", "ValueError", ",", "EnvironmentError", ",", "ImportError", ")", ":", "arg_4", "=", "lock", "(", "arg_0", ")", "arg_0", ".", "seek", "(", "arg_2", "+", "arg_1", ")", "arg_8", "=", "arg_0", ".", "read", "(", "arg_3", ")", "while", "arg_8", ":", "arg_0", ".", "seek", "(", "arg_2", ")", "arg_0", ".", "write", "(", "arg_8", ")", "arg_2", "+=", "len", "(", "arg_8", ")", "arg_0", ".", "seek", "(", "arg_2", "+", "arg_1", ")", "arg_8", "=", "arg_0", ".", "read", "(", "arg_3", ")", "arg_0", ".", "truncate", "(", "arg_5", "-", "arg_1", ")", "arg_0", ".", "flush", "(", ")", "finally", ":", "if", "arg_4", ":", "unlock", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=2**16):\n    \"\"\"Delete size bytes of empty space starting at offset.\n\n    fobj must be an open file object, open rb+ or\n    equivalent. Mutagen tries to use mmap to resize the file, but\n    falls back to a significantly slower method if mmap fails.\n    \"\"\"\n\n    arg_4 = False\n    assert 0 < arg_1\n    assert 0 <= arg_2\n    arg_0.seek(0, 2)\n    arg_5 = arg_0.tell()\n    arg_6 = arg_5 - arg_2 - arg_1\n    assert 0 <= arg_6\n    try:\n        if arg_6 > 0:\n            arg_0.flush()\n            try:\n                import mmap\n                arg_7 = mmap.mmap(arg_0.fileno(), arg_5)\n                try:\n                    arg_7.move(arg_2, arg_2 + arg_1, arg_6)\n                finally:\n                    arg_7.close()\n            except (ValueError, EnvironmentError, ImportError):\n                # handle broken mmap scenarios\n                arg_4 = lock(arg_0)\n                arg_0.seek(arg_2 + arg_1)\n                arg_8 = arg_0.read(arg_3)\n                while arg_8:\n                    arg_0.seek(arg_2)\n                    arg_0.write(arg_8)\n                    arg_2 += len(arg_8)\n                    arg_0.seek(arg_2 + arg_1)\n                    arg_8 = arg_0.read(arg_3)\n        arg_0.truncate(arg_5 - arg_1)\n        arg_0.flush()\n    finally:\n        if arg_4:\n            unlock(arg_0)", "path": "mutagen/_util.py", "identifier": "delete_bytes", "docstring": "Delete size bytes of empty space starting at offset.\n\n    fobj must be an open file object, open rb+ or\n    equivalent. Mutagen tries to use mmap to resize the file, but\n    falls back to a significantly slower method if mmap fails.", "docstring_tokens": ["Delete", "size", "bytes", "of", "empty", "space", "starting", "at", "offset", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 252648}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/backend/base.py#L16-L51", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Gets the base class for the custom database back-end.", "language": "python", "parameters": "()", "return_statement": "return base_class", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'POSTGRES_EXTRA_DB_BACKEND_BASE'", ",", "'django.db.backends.postgresql'", ")", "arg_1", "=", "importlib", ".", "import_module", "(", "arg_0", "+", "'.base'", ")", "arg_2", "=", "getattr", "(", "arg_1", ",", "'DatabaseWrapper'", ",", "None", ")", "if", "not", "arg_2", ":", "raise", "ImproperlyConfigured", "(", "(", "'\\'%s\\' is not a valid database back-end.'", "' The module does not define a DatabaseWrapper class.'", "' Check the value of POSTGRES_EXTRA_DB_BACKEND_BASE.'", ")", "%", "arg_0", ")", "if", "isinstance", "(", "arg_2", ",", "Psycopg2DatabaseWrapper", ")", ":", "raise", "ImproperlyConfigured", "(", "(", "'\\'%s\\' is not a valid database back-end.'", "' It does inherit from the PostgreSQL back-end.'", "' Check the value of POSTGRES_EXTRA_DB_BACKEND_BASE.'", ")", "%", "arg_0", ")", "return", "arg_2"], "function": "def Func():\n    \"\"\"Gets the base class for the custom database back-end.\n\n    This should be the Django PostgreSQL back-end. However,\n    some people are already using a custom back-end from\n    another package. We are nice people and expose an option\n    that allows them to configure the back-end we base upon.\n\n    As long as the specified base eventually also has\n    the PostgreSQL back-end as a base, then everything should\n    work as intended.\n    \"\"\"\n    arg_0 = getattr(\n        settings,\n        'POSTGRES_EXTRA_DB_BACKEND_BASE',\n        'django.db.backends.postgresql'\n    )\n\n    arg_1 = importlib.import_module(arg_0 + '.base')\n    arg_2 = getattr(arg_1, 'DatabaseWrapper', None)\n\n    if not arg_2:\n        raise ImproperlyConfigured((\n            '\\'%s\\' is not a valid database back-end.'\n            ' The module does not define a DatabaseWrapper class.'\n            ' Check the value of POSTGRES_EXTRA_DB_BACKEND_BASE.'\n        ) % arg_0)\n\n    if isinstance(arg_2, Psycopg2DatabaseWrapper):\n        raise ImproperlyConfigured((\n            '\\'%s\\' is not a valid database back-end.'\n            ' It does inherit from the PostgreSQL back-end.'\n            ' Check the value of POSTGRES_EXTRA_DB_BACKEND_BASE.'\n        ) % arg_0)\n\n    return arg_2", "path": "psqlextra/backend/base.py", "identifier": "_get_backend_base", "docstring": "Gets the base class for the custom database back-end.\n\n    This should be the Django PostgreSQL back-end. However,\n    some people are already using a custom back-end from\n    another package. We are nice people and expose an option\n    that allows them to configure the back-end we base upon.\n\n    As long as the specified base eventually also has\n    the PostgreSQL back-end as a base, then everything should\n    work as intended.", "docstring_tokens": ["Gets", "the", "base", "class", "for", "the", "custom", "database", "back", "-", "end", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 252649}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/ssl_support.py#L230-L241", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return an existing CA bundle path, or None", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "os", ".", "name", "==", "'nt'", ":", "return", "get_win_certfile", "(", ")", "else", ":", "for", "arg_0", "in", "cert_paths", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "return", "arg_0", "try", ":", "return", "pkg_resources", ".", "resource_filename", "(", "'certifi'", ",", "'cacert.pem'", ")", "except", "(", "ImportError", ",", "ResolutionError", ",", "ExtractionError", ")", ":", "return", "None"], "function": "def Func():\n    \"\"\"Return an existing CA bundle path, or None\"\"\"\n    if os.name=='nt':\n        return get_win_certfile()\n    else:\n        for arg_0 in cert_paths:\n            if os.path.isfile(arg_0):\n                return arg_0\n    try:\n        return pkg_resources.resource_filename('certifi', 'cacert.pem')\n    except (ImportError, ResolutionError, ExtractionError):\n        return None", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/ssl_support.py", "identifier": "find_ca_bundle", "docstring": "Return an existing CA bundle path, or None", "docstring_tokens": ["Return", "an", "existing", "CA", "bundle", "path", "or", "None"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252650}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/contrib/registrations.py#L45-L84", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Register sample aggregations.", "language": "python", "parameters": "()", "return_statement": "return [dict(\n        aggregation_name='file-download-agg',\n        templates='invenio_stats.contrib.aggregations.aggr_file_download',\n        aggregator_class=StatAggregator,\n        aggregator_config=dict(\n            client=current_search_client,\n            event='file-download',\n            aggregation_field='unique_id',\n            aggregation_interval='day',\n            copy_fields=dict(\n                file_key='file_key',\n                bucket_id='bucket_id',\n                file_id='file_id',\n            ),\n            metric_aggregation_fields={\n                'unique_count': ('cardinality', 'unique_session_id',\n                                 {'precision_threshold': 1000}),\n                'volume': ('sum', 'size', {}),\n            },\n        )), dict(\n        aggregation_name='record-view-agg',\n        templates='invenio_stats.contrib.aggregations.aggr_record_view',\n        aggregator_class=StatAggregator,\n        aggregator_config=dict(\n            client=current_search_client,\n            event='record-view',\n            aggregation_field='unique_id',\n            aggregation_interval='day',\n            copy_fields=dict(\n                record_id='record_id',\n                pid_type='pid_type',\n                pid_value='pid_value',\n            ),\n            metric_aggregation_fields={\n                'unique_count': ('cardinality', 'unique_session_id',\n                                 {'precision_threshold': 1000}),\n            },\n        ))]", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "return", "[", "dict", "(", "aggregation_name", "=", "'file-download-agg'", ",", "templates", "=", "'invenio_stats.contrib.aggregations.aggr_file_download'", ",", "aggregator_class", "=", "StatAggregator", ",", "aggregator_config", "=", "dict", "(", "client", "=", "current_search_client", ",", "event", "=", "'file-download'", ",", "aggregation_field", "=", "'unique_id'", ",", "aggregation_interval", "=", "'day'", ",", "copy_fields", "=", "dict", "(", "file_key", "=", "'file_key'", ",", "bucket_id", "=", "'bucket_id'", ",", "file_id", "=", "'file_id'", ",", ")", ",", "metric_aggregation_fields", "=", "{", "'unique_count'", ":", "(", "'cardinality'", ",", "'unique_session_id'", ",", "{", "'precision_threshold'", ":", "1000", "}", ")", ",", "'volume'", ":", "(", "'sum'", ",", "'size'", ",", "{", "}", ")", ",", "}", ",", ")", ")", ",", "dict", "(", "aggregation_name", "=", "'record-view-agg'", ",", "templates", "=", "'invenio_stats.contrib.aggregations.aggr_record_view'", ",", "aggregator_class", "=", "StatAggregator", ",", "aggregator_config", "=", "dict", "(", "client", "=", "current_search_client", ",", "event", "=", "'record-view'", ",", "aggregation_field", "=", "'unique_id'", ",", "aggregation_interval", "=", "'day'", ",", "copy_fields", "=", "dict", "(", "record_id", "=", "'record_id'", ",", "pid_type", "=", "'pid_type'", ",", "pid_value", "=", "'pid_value'", ",", ")", ",", "metric_aggregation_fields", "=", "{", "'unique_count'", ":", "(", "'cardinality'", ",", "'unique_session_id'", ",", "{", "'precision_threshold'", ":", "1000", "}", ")", ",", "}", ",", ")", ")", "]"], "function": "def Func():\n    \"\"\"Register sample aggregations.\"\"\"\n    return [dict(\n        aggregation_name='file-download-agg',\n        templates='invenio_stats.contrib.aggregations.aggr_file_download',\n        aggregator_class=StatAggregator,\n        aggregator_config=dict(\n            client=current_search_client,\n            event='file-download',\n            aggregation_field='unique_id',\n            aggregation_interval='day',\n            copy_fields=dict(\n                file_key='file_key',\n                bucket_id='bucket_id',\n                file_id='file_id',\n            ),\n            metric_aggregation_fields={\n                'unique_count': ('cardinality', 'unique_session_id',\n                                 {'precision_threshold': 1000}),\n                'volume': ('sum', 'size', {}),\n            },\n        )), dict(\n        aggregation_name='record-view-agg',\n        templates='invenio_stats.contrib.aggregations.aggr_record_view',\n        aggregator_class=StatAggregator,\n        aggregator_config=dict(\n            client=current_search_client,\n            event='record-view',\n            aggregation_field='unique_id',\n            aggregation_interval='day',\n            copy_fields=dict(\n                record_id='record_id',\n                pid_type='pid_type',\n                pid_value='pid_value',\n            ),\n            metric_aggregation_fields={\n                'unique_count': ('cardinality', 'unique_session_id',\n                                 {'precision_threshold': 1000}),\n            },\n        ))]", "path": "invenio_stats/contrib/registrations.py", "identifier": "register_aggregations", "docstring": "Register sample aggregations.", "docstring_tokens": ["Register", "sample", "aggregations", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 252651}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1219-L1231", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Remove all of the non-descendants operation nodes of node.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "warnings", ".", "warn", "(", "'Calling Func() with a node id is deprecated,'", "' use a DAGNode instead'", ",", "DeprecationWarning", ",", "2", ")", "arg_1", "=", "arg_0", ".", "_id_to_node", "[", "arg_1", "]", "arg_2", "=", "nx", ".", "descendants", "(", "arg_0", ".", "_multi_graph", ",", "arg_1", ")", "arg_3", "=", "list", "(", "set", "(", "arg_0", ".", "_multi_graph", ".", "nodes", "(", ")", ")", "-", "set", "(", "arg_2", ")", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "type", "==", "\"op\"", ":", "arg_0", ".", "remove_op_node", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove all of the non-descendants operation nodes of node.\"\"\"\n        if isinstance(arg_1, int):\n            warnings.warn('Calling Func() with a node id is deprecated,'\n                          ' use a DAGNode instead',\n                          DeprecationWarning, 2)\n            arg_1 = arg_0._id_to_node[arg_1]\n\n        arg_2 = nx.descendants(arg_0._multi_graph, arg_1)\n        arg_3 = list(set(arg_0._multi_graph.nodes()) - set(arg_2))\n        for arg_4 in arg_3:\n            if arg_4.type == \"op\":\n                arg_0.remove_op_node(arg_4)", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.remove_nondescendants_of", "docstring": "Remove all of the non-descendants operation nodes of node.", "docstring_tokens": ["Remove", "all", "of", "the", "non", "-", "descendants", "operation", "nodes", "of", "node", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252652}
{"url": "https://github.com/hamelsmu/ktext/blob/221f09f5b1762705075fd1bd914881c0724d5e02/ktext/preprocess.py#L227-L235", "sha": "221f09f5b1762705075fd1bd914881c0724d5e02", "docstring_summary": "Apply cleaner -> tokenizer.", "language": "python", "parameters": "(self, data: List[str])", "return_statement": "return flattenlist(apply_parallel(process_text, data, n_cores))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ")", "->", "arg_2", "[", "arg_2", "[", "arg_3", "]", "]", ":", "arg_4", "=", "process_text_constructor", "(", "cleaner", "=", "arg_0", ".", "cleaner", ",", "tokenizer", "=", "arg_0", ".", "tokenizer", ",", "append_indicators", "=", "arg_0", ".", "append_indicators", ",", "start_tok", "=", "arg_0", ".", "start_tok", ",", "end_tok", "=", "arg_0", ".", "end_tok", ")", "arg_5", "=", "arg_0", ".", "num_cores", "return", "flattenlist", "(", "apply_parallel", "(", "arg_4", ",", "arg_1", ",", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2[arg_3]) -> arg_2[arg_2[arg_3]]:\n        \"\"\"Apply cleaner -> tokenizer.\"\"\"\n        arg_4 = process_text_constructor(cleaner=arg_0.cleaner,\n                                                tokenizer=arg_0.tokenizer,\n                                                append_indicators=arg_0.append_indicators,\n                                                start_tok=arg_0.start_tok,\n                                                end_tok=arg_0.end_tok)\n        arg_5 = arg_0.num_cores\n        return flattenlist(apply_parallel(arg_4, arg_1, arg_5))", "path": "ktext/preprocess.py", "identifier": "processor.parallel_process_text", "docstring": "Apply cleaner -> tokenizer.", "docstring_tokens": ["Apply", "cleaner", "-", ">", "tokenizer", "."], "nwo": "hamelsmu/ktext", "score": 0.5862139051793661, "idx": 252653}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/joint_distribution.py#L324-L341", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Verifies that `parts` don't broadcast.", "language": "python", "parameters": "(flat_xs, validate_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "tuple", "(", "arg_0", ")", "if", "not", "arg_1", ":", "return", "arg_0", "arg_2", "=", "'Broadcasting probably indicates an error in model specification.'", "arg_3", "=", "tuple", "(", "arg_8", ".", "shape", "for", "arg_8", "in", "arg_0", ")", "if", "all", "(", "tensorshape_util", ".", "is_fully_defined", "(", "arg_4", ")", "for", "arg_4", "in", "arg_3", ")", ":", "if", "not", "all", "(", "arg_5", "==", "arg_6", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_3", "[", "1", ":", "]", ",", "arg_3", "[", ":", "-", "1", "]", ")", ")", ":", "raise", "ValueError", "(", "arg_2", ")", "return", "arg_0", "arg_7", "=", "[", "assert_util", ".", "assert_equal", "(", "arg_5", ",", "arg_6", ",", "message", "=", "arg_2", ")", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_3", "[", "1", ":", "]", ",", "arg_3", "[", ":", "-", "1", "]", ")", "]", "with", "tf", ".", "control_dependencies", "(", "arg_7", ")", ":", "return", "tuple", "(", "tf", ".", "identity", "(", "arg_8", ")", "for", "arg_8", "in", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Verifies that `parts` don't broadcast.\"\"\"\n  arg_0 = tuple(arg_0)  # So we can receive generators.\n  if not arg_1:\n    # Note: we don't try static validation because it is theoretically\n    # possible that a user wants to take advantage of broadcasting.\n    # Only when `validate_args` is `True` do we enforce the validation.\n    return arg_0\n  arg_2 = 'Broadcasting probably indicates an error in model specification.'\n  arg_3 = tuple(arg_8.shape for arg_8 in arg_0)\n  if all(tensorshape_util.is_fully_defined(arg_4) for arg_4 in arg_3):\n    if not all(arg_5 == arg_6 for arg_5, arg_6 in zip(arg_3[1:], arg_3[:-1])):\n      raise ValueError(arg_2)\n    return arg_0\n  arg_7 = [assert_util.assert_equal(arg_5, arg_6, message=arg_2)\n                for arg_5, arg_6 in zip(arg_3[1:], arg_3[:-1])]\n  with tf.control_dependencies(arg_7):\n    return tuple(tf.identity(arg_8) for arg_8 in arg_0)", "path": "tensorflow_probability/python/distributions/joint_distribution.py", "identifier": "maybe_check_wont_broadcast", "docstring": "Verifies that `parts` don't broadcast.", "docstring_tokens": ["Verifies", "that", "parts", "don", "t", "broadcast", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252654}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/scene/node.py#L19-L40", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Draw node and children", "language": "python", "parameters": "(self, projection_matrix=None, camera_matrix=None, time=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ")", ":", "if", "arg_0", ".", "mesh", ":", "arg_0", ".", "mesh", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "view_matrix", "=", "arg_0", ".", "matrix_global_bytes", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "for", "arg_4", "in", "arg_0", ".", "children", ":", "arg_4", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=0):\n        \"\"\"\n        Draw node and children\n\n        :param projection_matrix: projection matrix (bytes)\n        :param camera_matrix: camera_matrix (bytes)\n        :param time: The current time\n        \"\"\"\n        if arg_0.mesh:\n            arg_0.mesh.Func(\n                arg_1=arg_1,\n                view_matrix=arg_0.matrix_global_bytes,\n                arg_2=arg_2,\n                arg_3=arg_3\n            )\n\n        for arg_4 in arg_0.children:\n            arg_4.Func(\n                arg_1=arg_1,\n                arg_2=arg_2,\n                arg_3=arg_3\n            )", "path": "demosys/scene/node.py", "identifier": "Node.draw", "docstring": "Draw node and children\n\n        :param projection_matrix: projection matrix (bytes)\n        :param camera_matrix: camera_matrix (bytes)\n        :param time: The current time", "docstring_tokens": ["Draw", "node", "and", "children"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 252655}
{"url": "https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/utils.py#L84-L101", "sha": "261e2c0760fd6a6b0ee59064180bd8e3674311fe", "docstring_summary": "Check if a given string is in the correct URL format or not", "language": "python", "parameters": "(url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "compile", "(", "r'^(?:http|ftp)s?://'", "r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+(?:[A-Z]{2,6}\\.?|[A-Z0-9-]{2,}\\.?)|'", "r'localhost|'", "r'\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})'", "r'(?::\\d+)?'", "r'(?:/?|[/?]\\S+)$'", ",", "re", ".", "IGNORECASE", ")", "if", "arg_1", ".", "match", "(", "arg_0", ")", ":", "logger", ".", "info", "(", "\"URL given as config\"", ")", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0):\n  \"\"\"\n  Check if a given string is in the correct URL format or not\n\n  :param str url:\n  :return: True or False\n  \"\"\"\n  arg_1 = re.compile(r'^(?:http|ftp)s?://'\n                     r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+(?:[A-Z]{2,6}\\.?|[A-Z0-9-]{2,}\\.?)|'\n                     r'localhost|'\n                     r'\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})'\n                     r'(?::\\d+)?'\n                     r'(?:/?|[/?]\\S+)$', re.IGNORECASE)\n  if arg_1.match(arg_0):\n    logger.info(\"URL given as config\")\n    return True\n  else:\n    return False", "path": "src/naarad/utils.py", "identifier": "is_valid_url", "docstring": "Check if a given string is in the correct URL format or not\n\n  :param str url:\n  :return: True or False", "docstring_tokens": ["Check", "if", "a", "given", "string", "is", "in", "the", "correct", "URL", "format", "or", "not"], "nwo": "linkedin/naarad", "score": 0.34903059417921767, "idx": 252656}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L4263-L4324", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Compares string operands.", "language": "python", "parameters": "(cpu, dest, src)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "8", ":", "'SI'", ",", "32", ":", "'ESI'", ",", "64", ":", "'RSI'", "}", "[", "arg_0", ".", "address_bit_size", "]", "arg_4", "=", "{", "8", ":", "'DI'", ",", "32", ":", "'EDI'", ",", "64", ":", "'RDI'", "}", "[", "arg_0", ".", "address_bit_size", "]", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_0", ".", "get_descriptor", "(", "arg_0", ".", "DS", ")", "arg_8", "=", "arg_0", ".", "read_register", "(", "arg_3", ")", "+", "arg_5", "arg_9", "=", "arg_0", ".", "read_register", "(", "arg_4", ")", "+", "arg_5", "arg_10", "=", "arg_1", ".", "size", "arg_11", "=", "arg_0", ".", "read_int", "(", "arg_9", ",", "arg_10", ")", "arg_12", "=", "arg_0", ".", "read_int", "(", "arg_8", ",", "arg_10", ")", "arg_13", "=", "(", "arg_12", "-", "arg_11", ")", "&", "(", "(", "1", "<<", "arg_10", ")", "-", "1", ")", "arg_0", ".", "_calculate_CMP_flags", "(", "arg_10", ",", "arg_13", ",", "arg_12", ",", "arg_11", ")", "arg_14", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "arg_0", ".", "DF", ",", "-", "arg_10", "//", "8", ",", "arg_10", "//", "8", ")", "arg_0", ".", "write_register", "(", "arg_3", ",", "arg_0", ".", "read_register", "(", "arg_3", ")", "+", "arg_14", ")", "arg_0", ".", "write_register", "(", "arg_4", ",", "arg_0", ".", "read_register", "(", "arg_4", ")", "+", "arg_14", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Compares string operands.\n\n        Compares the byte, word, double word or quad specified with the first source\n        operand with the byte, word, double or quad word specified with the second\n        source operand and sets the status flags in the EFLAGS register according\n        to the results. Both the source operands are located in memory::\n\n                temp  = SRC1 - SRC2;\n                SetStatusFlags(temp);\n                IF (byte comparison)\n                THEN IF DF  =  0\n                    THEN\n                        (E)SI  =  (E)SI + 1;\n                        (E)DI  =  (E)DI + 1;\n                    ELSE\n                        (E)SI  =  (E)SI - 1;\n                        (E)DI  =  (E)DI - 1;\n                    FI;\n                ELSE IF (word comparison)\n                    THEN IF DF  =  0\n                        (E)SI  =  (E)SI + 2;\n                        (E)DI  =  (E)DI + 2;\n                    ELSE\n                        (E)SI  =  (E)SI - 2;\n                        (E)DI  =  (E)DI - 2;\n                    FI;\n                ELSE (* doubleword comparison*)\n                    THEN IF DF  =  0\n                        (E)SI  =  (E)SI + 4;\n                        (E)DI  =  (E)DI + 4;\n                    ELSE\n                        (E)SI  =  (E)SI - 4;\n                        (E)DI  =  (E)DI - 4;\n                    FI;\n                FI;\n\n        :param cpu: current CPU.\n        :param dest: first source operand.\n        :param src: second source operand.\n        \"\"\"\n        arg_3 = {8: 'SI', 32: 'ESI', 64: 'RSI'}[arg_0.address_bit_size]\n        arg_4 = {8: 'DI', 32: 'EDI', 64: 'RDI'}[arg_0.address_bit_size]\n\n        arg_5, arg_6, arg_7 = arg_0.get_descriptor(arg_0.DS)\n\n        arg_8 = arg_0.read_register(arg_3) + arg_5\n        arg_9 = arg_0.read_register(arg_4) + arg_5\n        arg_10 = arg_1.size\n\n        # Compare\n        arg_11 = arg_0.read_int(arg_9, arg_10)\n        arg_12 = arg_0.read_int(arg_8, arg_10)\n        arg_13 = (arg_12 - arg_11) & ((1 << arg_10) - 1)\n\n        arg_0._calculate_CMP_flags(arg_10, arg_13, arg_12, arg_11)\n\n        #Advance EDI/ESI pointers\n        arg_14 = Operators.ITEBV(arg_0.address_bit_size, arg_0.DF, -arg_10 // 8, arg_10 // 8)\n        arg_0.write_register(arg_3, arg_0.read_register(arg_3) + arg_14)\n        arg_0.write_register(arg_4, arg_0.read_register(arg_4) + arg_14)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.CMPS", "docstring": "Compares string operands.\n\n        Compares the byte, word, double word or quad specified with the first source\n        operand with the byte, word, double or quad word specified with the second\n        source operand and sets the status flags in the EFLAGS register according\n        to the results. Both the source operands are located in memory::\n\n                temp  = SRC1 - SRC2;\n                SetStatusFlags(temp);\n                IF (byte comparison)\n                THEN IF DF  =  0\n                    THEN\n                        (E)SI  =  (E)SI + 1;\n                        (E)DI  =  (E)DI + 1;\n                    ELSE\n                        (E)SI  =  (E)SI - 1;\n                        (E)DI  =  (E)DI - 1;\n                    FI;\n                ELSE IF (word comparison)\n                    THEN IF DF  =  0\n                        (E)SI  =  (E)SI + 2;\n                        (E)DI  =  (E)DI + 2;\n                    ELSE\n                        (E)SI  =  (E)SI - 2;\n                        (E)DI  =  (E)DI - 2;\n                    FI;\n                ELSE (* doubleword comparison*)\n                    THEN IF DF  =  0\n                        (E)SI  =  (E)SI + 4;\n                        (E)DI  =  (E)DI + 4;\n                    ELSE\n                        (E)SI  =  (E)SI - 4;\n                        (E)DI  =  (E)DI - 4;\n                    FI;\n                FI;\n\n        :param cpu: current CPU.\n        :param dest: first source operand.\n        :param src: second source operand.", "docstring_tokens": ["Compares", "string", "operands", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252657}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/data_file.py#L9-L28", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Dumps data into a nicely formatted JSON string.", "language": "python", "parameters": "(data, use_yaml=None, safe=True, **kwds)", "return_statement": "return dumps(data, **kwds)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ",", "**", "arg_3", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "ALWAYS_DUMP_YAML", "if", "arg_1", ":", "Func", "=", "yaml", ".", "safe_dump", "if", "arg_2", "else", "yaml", ".", "dump", "else", ":", "Func", "=", "json", ".", "dumps", "arg_3", ".", "update", "(", "indent", "=", "4", ",", "sort_keys", "=", "True", ")", "if", "not", "arg_2", ":", "arg_3", ".", "update", "(", "default", "=", "repr", ")", "return", "Func", "(", "arg_0", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=True, **arg_3):\n    \"\"\"\n    Dumps data into a nicely formatted JSON string.\n\n    :param dict data: a dictionary to dump\n    :param kwds: keywords to pass to json.dumps\n    :returns: a string with formatted data\n    :rtype: str\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = ALWAYS_DUMP_YAML\n\n    if arg_1:\n        Func = yaml.safe_dump if arg_2 else yaml.dump\n    else:\n        Func = json.dumps\n        arg_3.update(indent=4, sort_keys=True)\n        if not arg_2:\n            arg_3.update(default=repr)\n    return Func(arg_0, **arg_3)", "path": "bibliopixel/util/data_file.py", "identifier": "dumps", "docstring": "Dumps data into a nicely formatted JSON string.\n\n    :param dict data: a dictionary to dump\n    :param kwds: keywords to pass to json.dumps\n    :returns: a string with formatted data\n    :rtype: str", "docstring_tokens": ["Dumps", "data", "into", "a", "nicely", "formatted", "JSON", "string", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 252658}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3302-L3315", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Apply a lambda expression to an H2OFrame.", "language": "python", "parameters": "(self, fun=None, axis=0)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"apply\", self, 1 + (axis == 0), *res))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "0", ")", ":", "from", ".", "astfun", "import", "lambda_to_expr", "assert_is_type", "(", "arg_2", ",", "0", ",", "1", ")", "assert_is_type", "(", "arg_1", ",", "FunctionType", ")", "assert_satisfies", "(", "arg_1", ",", "arg_1", ".", "__name__", "==", "\"<lambda>\"", ")", "arg_3", "=", "lambda_to_expr", "(", "arg_1", ")", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "1", "+", "(", "arg_2", "==", "0", ")", ",", "*", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=0):\n        \"\"\"\n        Apply a lambda expression to an H2OFrame.\n\n        :param fun: a lambda expression to be applied per row or per column.\n        :param axis: 0 = Func to each column; 1 = Func to each row\n        :returns: a new H2OFrame with the results of Funcing ``fun`` to the current frame.\n        \"\"\"\n        from .astfun import lambda_to_expr\n        assert_is_type(arg_2, 0, 1)\n        assert_is_type(arg_1, FunctionType)\n        assert_satisfies(arg_1, arg_1.__name__ == \"<lambda>\")\n        arg_3 = lambda_to_expr(arg_1)\n        return H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, 1 + (arg_2 == 0), *arg_3))", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.apply", "docstring": "Apply a lambda expression to an H2OFrame.\n\n        :param fun: a lambda expression to be applied per row or per column.\n        :param axis: 0 = apply to each column; 1 = apply to each row\n        :returns: a new H2OFrame with the results of applying ``fun`` to the current frame.", "docstring_tokens": ["Apply", "a", "lambda", "expression", "to", "an", "H2OFrame", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252659}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch_v2.py#L632-L657", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the generation index of the first generation in the given\n    swarm that does not have numParticles particles in it, either still in the\n    running state or completed. This does not include orphaned particles.", "language": "python", "parameters": "(self, swarmId, minNumParticles)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", "in", "arg_0", ".", "_swarmNumParticlesPerGeneration", ":", "return", "None", "arg_3", "=", "arg_0", ".", "_swarmNumParticlesPerGeneration", "[", "arg_1", "]", "arg_3", "=", "numpy", ".", "array", "(", "arg_3", ")", "arg_4", "=", "numpy", ".", "where", "(", "arg_3", "<", "arg_2", ")", "[", "0", "]", "if", "len", "(", "arg_4", ")", "==", "0", ":", "return", "len", "(", "arg_3", ")", "else", ":", "return", "arg_4", "[", "0", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Return the generation index of the first generation in the given\n    swarm that does not have numParticles particles in it, either still in the\n    running state or completed. This does not include orphaned particles.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    swarmId:  A string representation of the sorted list of encoders in this\n                 swarm. For example '__address_encoder.__gym_encoder'\n    minNumParticles: minium number of partices required for a full\n                  generation.\n\n    retval:  generation index, or None if no particles at all.\n    \"\"\"\n\n    if not arg_1 in arg_0._swarmNumParticlesPerGeneration:\n      return None\n\n    arg_3 = arg_0._swarmNumParticlesPerGeneration[arg_1]\n\n    arg_3 = numpy.array(arg_3)\n    arg_4 = numpy.where(arg_3 < arg_2)[0]\n    if len(arg_4) == 0:\n      return len(arg_3)\n    else:\n      return arg_4[0]", "path": "src/nupic/swarming/hypersearch_v2.py", "identifier": "ResultsDB.firstNonFullGeneration", "docstring": "Return the generation index of the first generation in the given\n    swarm that does not have numParticles particles in it, either still in the\n    running state or completed. This does not include orphaned particles.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    swarmId:  A string representation of the sorted list of encoders in this\n                 swarm. For example '__address_encoder.__gym_encoder'\n    minNumParticles: minium number of partices required for a full\n                  generation.\n\n    retval:  generation index, or None if no particles at all.", "docstring_tokens": ["Return", "the", "generation", "index", "of", "the", "first", "generation", "in", "the", "given", "swarm", "that", "does", "not", "have", "numParticles", "particles", "in", "it", "either", "still", "in", "the", "running", "state", "or", "completed", ".", "This", "does", "not", "include", "orphaned", "particles", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252660}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/solution.py#L196-L257", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Generate a solution representation of the current solver state.", "language": "python", "parameters": "(model, reactions=None, metabolites=None, raise_error=False)", "return_statement": "return Solution(model.solver.objective.value, model.solver.status,\n                    Series(index=rxn_index, data=fluxes, name=\"fluxes\"),\n                    Series(index=rxn_index, data=reduced,\n                           name=\"reduced_costs\"),\n                    Series(index=met_index, data=shadow, name=\"shadow_prices\"))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "check_solver_status", "(", "arg_0", ".", "solver", ".", "status", ",", "arg_3", "=", "arg_3", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "reactions", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "metabolites", "arg_4", "=", "list", "(", ")", "arg_5", "=", "empty", "(", "len", "(", "arg_1", ")", ")", "arg_6", "=", "empty", "(", "len", "(", "arg_1", ")", ")", "arg_7", "=", "arg_0", ".", "solver", ".", "primal_values", "arg_8", "=", "empty", "(", "len", "(", "arg_2", ")", ")", "if", "arg_0", ".", "solver", ".", "is_integer", ":", "arg_6", ".", "fill", "(", "nan", ")", "arg_8", ".", "fill", "(", "nan", ")", "for", "(", "arg_9", ",", "arg_10", ")", "in", "enumerate", "(", "arg_1", ")", ":", "arg_4", ".", "append", "(", "arg_10", ".", "id", ")", "arg_5", "[", "arg_9", "]", "=", "arg_7", "[", "arg_10", ".", "id", "]", "-", "arg_7", "[", "arg_10", ".", "reverse_id", "]", "arg_11", "=", "[", "arg_16", ".", "id", "for", "arg_16", "in", "arg_2", "]", "else", ":", "arg_12", "=", "arg_0", ".", "solver", ".", "reduced_costs", "for", "(", "arg_9", ",", "arg_10", ")", "in", "enumerate", "(", "arg_1", ")", ":", "arg_13", "=", "arg_10", ".", "id", "arg_14", "=", "arg_10", ".", "reverse_id", "arg_4", ".", "append", "(", "arg_13", ")", "arg_5", "[", "arg_9", "]", "=", "arg_7", "[", "arg_13", "]", "-", "arg_7", "[", "arg_14", "]", "arg_6", "[", "arg_9", "]", "=", "arg_12", "[", "arg_13", "]", "-", "arg_12", "[", "arg_14", "]", "arg_11", "=", "list", "(", ")", "arg_15", "=", "arg_0", ".", "solver", ".", "shadow_prices", "for", "(", "arg_9", ",", "arg_16", ")", "in", "enumerate", "(", "arg_2", ")", ":", "arg_11", ".", "append", "(", "arg_16", ".", "id", ")", "arg_8", "[", "arg_9", "]", "=", "arg_15", "[", "arg_16", ".", "id", "]", "return", "Solution", "(", "arg_0", ".", "solver", ".", "objective", ".", "value", ",", "arg_0", ".", "solver", ".", "status", ",", "Series", "(", "index", "=", "arg_4", ",", "data", "=", "arg_5", ",", "name", "=", "\"fluxes\"", ")", ",", "Series", "(", "index", "=", "arg_4", ",", "data", "=", "arg_6", ",", "name", "=", "\"reduced_costs\"", ")", ",", "Series", "(", "index", "=", "arg_11", ",", "data", "=", "arg_8", ",", "name", "=", "\"shadow_prices\"", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=False):\n    \"\"\"\n    Generate a solution representation of the current solver state.\n\n    Parameters\n    ---------\n    model : cobra.Model\n        The model whose reactions to retrieve values for.\n    reactions : list, optional\n        An iterable of `cobra.Reaction` objects. Uses `model.reactions` by\n        default.\n    metabolites : list, optional\n        An iterable of `cobra.Metabolite` objects. Uses `model.metabolites` by\n        default.\n    raise_error : bool\n        If true, raise an OptimizationError if solver status is not optimal.\n\n    Returns\n    -------\n    cobra.Solution\n\n    Note\n    ----\n    This is only intended for the `optlang` solver interfaces and not the\n    legacy solvers.\n    \"\"\"\n    check_solver_status(arg_0.solver.status, arg_3=arg_3)\n    if arg_1 is None:\n        arg_1 = arg_0.reactions\n    if arg_2 is None:\n        arg_2 = arg_0.metabolites\n\n    arg_4 = list()\n    arg_5 = empty(len(arg_1))\n    arg_6 = empty(len(arg_1))\n    arg_7 = arg_0.solver.primal_values\n    arg_8 = empty(len(arg_2))\n    if arg_0.solver.is_integer:\n        arg_6.fill(nan)\n        arg_8.fill(nan)\n        for (arg_9, arg_10) in enumerate(arg_1):\n            arg_4.append(arg_10.id)\n            arg_5[arg_9] = arg_7[arg_10.id] - arg_7[arg_10.reverse_id]\n        arg_11 = [arg_16.id for arg_16 in arg_2]\n    else:\n        arg_12 = arg_0.solver.reduced_costs\n        for (arg_9, arg_10) in enumerate(arg_1):\n            arg_13 = arg_10.id\n            arg_14 = arg_10.reverse_id\n            arg_4.append(arg_13)\n            arg_5[arg_9] = arg_7[arg_13] - arg_7[arg_14]\n            arg_6[arg_9] = arg_12[arg_13] - arg_12[arg_14]\n        arg_11 = list()\n        arg_15 = arg_0.solver.shadow_prices\n        for (arg_9, arg_16) in enumerate(arg_2):\n            arg_11.append(arg_16.id)\n            arg_8[arg_9] = arg_15[arg_16.id]\n    return Solution(arg_0.solver.objective.value, arg_0.solver.status,\n                    Series(index=arg_4, data=arg_5, name=\"fluxes\"),\n                    Series(index=arg_4, data=arg_6,\n                           name=\"reduced_costs\"),\n                    Series(index=arg_11, data=arg_8, name=\"shadow_prices\"))", "path": "cobra/core/solution.py", "identifier": "get_solution", "docstring": "Generate a solution representation of the current solver state.\n\n    Parameters\n    ---------\n    model : cobra.Model\n        The model whose reactions to retrieve values for.\n    reactions : list, optional\n        An iterable of `cobra.Reaction` objects. Uses `model.reactions` by\n        default.\n    metabolites : list, optional\n        An iterable of `cobra.Metabolite` objects. Uses `model.metabolites` by\n        default.\n    raise_error : bool\n        If true, raise an OptimizationError if solver status is not optimal.\n\n    Returns\n    -------\n    cobra.Solution\n\n    Note\n    ----\n    This is only intended for the `optlang` solver interfaces and not the\n    legacy solvers.", "docstring_tokens": ["Generate", "a", "solution", "representation", "of", "the", "current", "solver", "state", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 252661}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_hyperlink_labels.py#L159-L189", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Test whether an href string meets criteria specified by\n        configuration parameters 'require_abs_url', which means \"does\n        it look like it is probably an absolute URL?\" and\n        'domain_substrings'.  It searches for each of the\n        domain_substrings in the href individually, and if any match,\n        then returns True.", "language": "python", "parameters": "(self, href)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "config", "[", "'require_abs_url'", "]", ":", "if", "not", "arg_1", ".", "lower", "(", ")", ".", "startswith", "(", "(", "'http://'", ",", "'https://'", ")", ")", ":", "return", "False", "if", "arg_0", ".", "config", "[", "'all_domains'", "]", ":", "return", "True", "if", "arg_0", ".", "config", "[", "'domain_substrings'", "]", ":", "arg_2", "=", "arg_1", ".", "split", "(", "'/'", ")", "if", "len", "(", "arg_2", ")", "<", "3", ":", "return", "False", "arg_3", "=", "arg_2", "[", "2", "]", ".", "lower", "(", ")", "for", "arg_4", "in", "arg_0", ".", "config", "[", "'domain_substrings'", "]", ":", "try", ":", "if", "arg_4", "in", "arg_3", ":", "return", "True", "except", "Exception", ",", "exc", ":", "logger", ".", "warn", "(", "'%r in %r raised'", ",", "arg_4", ",", "arg_3", ",", "exc_info", "=", "True", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n        '''\n        Test whether an href string meets criteria specified by\n        configuration parameters 'require_abs_url', which means \"does\n        it look like it is probably an absolute URL?\" and\n        'domain_substrings'.  It searches for each of the\n        domain_substrings in the href individually, and if any match,\n        then returns True.\n\n        :param: href string\n        :returns bool:\n        '''\n        if arg_0.config['require_abs_url']:\n            if not arg_1.lower().startswith(('http://', 'https://')):\n                return False\n        if arg_0.config['all_domains']:\n            ## blanket accept all domains as labels\n            return True\n\n        if arg_0.config['domain_substrings']:\n            arg_2 = arg_1.split('/')\n            if len(arg_2) < 3:\n                return False\n            arg_3 = arg_2[2].lower()\n            for arg_4 in arg_0.config['domain_substrings']:\n                try:\n                    if arg_4 in arg_3:\n                        return True\n                except Exception, exc:\n                    logger.warn('%r in %r raised', arg_4, arg_3, exc_info=True)\n                    return False", "path": "streamcorpus_pipeline/_hyperlink_labels.py", "identifier": "hyperlink_labels.href_filter", "docstring": "Test whether an href string meets criteria specified by\n        configuration parameters 'require_abs_url', which means \"does\n        it look like it is probably an absolute URL?\" and\n        'domain_substrings'.  It searches for each of the\n        domain_substrings in the href individually, and if any match,\n        then returns True.\n\n        :param: href string\n        :returns bool:", "docstring_tokens": ["Test", "whether", "an", "href", "string", "meets", "criteria", "specified", "by", "configuration", "parameters", "require_abs_url", "which", "means", "does", "it", "look", "like", "it", "is", "probably", "an", "absolute", "URL?", "and", "domain_substrings", ".", "It", "searches", "for", "each", "of", "the", "domain_substrings", "in", "the", "href", "individually", "and", "if", "any", "match", "then", "returns", "True", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 252662}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L192-L201", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Pairwise distance between each point in `a` and each point in `b`", "language": "python", "parameters": "(self, a, b)", "return_statement": "return matrix", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "sq", "(", "arg_3", ")", ":", "return", "(", "arg_3", "*", "arg_3", ")", "arg_4", "=", "sq", "(", "arg_1", "[", ":", ",", "0", "]", "[", ":", ",", "None", "]", "-", "arg_2", "[", ":", ",", "0", "]", "[", "None", ",", ":", "]", ")", "for", "arg_3", ",", "arg_5", "in", "zip", "(", "arg_1", ".", "T", "[", "1", ":", "]", ",", "arg_2", ".", "T", "[", "1", ":", "]", ")", ":", "arg_4", "+=", "sq", "(", "arg_3", "[", ":", ",", "None", "]", "-", "arg_5", "[", "None", ",", ":", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Pairwise distance between each point in `a` and each point in `b`\"\"\"\n        def sq(arg_3): return (arg_3 * arg_3)\n        # matrix = np.sum(map(lambda a,b: sq(a[:,None] - b[None,:]), a.T,\n        #   b.T), axis=0)\n        # A faster version than above:\n        arg_4 = sq(arg_1[:, 0][:, None] - arg_2[:, 0][None, :])\n        for arg_3, arg_5 in zip(arg_1.T[1:], arg_2.T[1:]):\n            arg_4 += sq(arg_3[:, None] - arg_5[None, :])\n        return arg_4", "path": "peri/interpolation.py", "identifier": "BarnesInterpolationND._distance_matrix", "docstring": "Pairwise distance between each point in `a` and each point in `b`", "docstring_tokens": ["Pairwise", "distance", "between", "each", "point", "in", "a", "and", "each", "point", "in", "b"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 252663}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Certificate.py#L69-L81", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Load the Certificate object from DigitalOcean.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_data", "(", "\"certificates/%s\"", "%", "arg_0", ".", "id", ")", "arg_2", "=", "arg_1", "[", "\"certificate\"", "]", "for", "arg_3", "in", "arg_2", ".", "keys", "(", ")", ":", "setattr", "(", "arg_0", ",", "arg_3", ",", "arg_2", "[", "arg_3", "]", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"\n            Load the Certificate object from DigitalOcean.\n\n            Requires self.id to be set.\n        \"\"\"\n        arg_1 = arg_0.get_data(\"certificates/%s\" % arg_0.id)\n        arg_2 = arg_1[\"certificate\"]\n\n        for arg_3 in arg_2.keys():\n            setattr(arg_0, arg_3, arg_2[arg_3])\n\n        return arg_0", "path": "digitalocean/Certificate.py", "identifier": "Certificate.load", "docstring": "Load the Certificate object from DigitalOcean.\n\n            Requires self.id to be set.", "docstring_tokens": ["Load", "the", "Certificate", "object", "from", "DigitalOcean", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 252664}
{"url": "https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/utils.py#L63-L116", "sha": "dc2d941d8285a96f3a5b666a4bd04875b0b25984", "docstring_summary": "Recursively kill the descendants of a process before killing it.", "language": "python", "parameters": "(pid)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "sys", ".", "platform", "==", "\"win32\"", ":", "try", ":", "subprocess", ".", "check_output", "(", "[", "\"taskkill\"", ",", "\"/F\"", ",", "\"/T\"", ",", "\"/PID\"", ",", "str", "(", "arg_0", ")", "]", ",", "stderr", "=", "None", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "if", "e", ".", "returncode", "not", "in", "[", "1", ",", "128", ",", "255", "]", ":", "raise", "elif", "e", ".", "returncode", "==", "1", ":", "try", ":", "os", ".", "kill", "(", "arg_0", ",", "signal", ".", "SIGTERM", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "ESRCH", ":", "raise", "else", ":", "try", ":", "arg_1", "=", "subprocess", ".", "check_output", "(", "[", "\"pgrep\"", ",", "\"-P\"", ",", "str", "(", "arg_0", ")", "]", ",", "stderr", "=", "None", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "if", "e", ".", "returncode", "==", "1", ":", "arg_1", "=", "b''", "else", ":", "raise", "arg_1", "=", "arg_1", ".", "decode", "(", ")", ".", "split", "(", "'\\n'", ")", "[", ":", "-", "1", "]", "for", "arg_2", "in", "arg_1", ":", "arg_2", "=", "int", "(", "arg_2", ")", "Func", "(", "arg_2", ")", "try", ":", "os", ".", "kill", "(", "arg_0", ",", "signal", ".", "SIGTERM", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "ESRCH", ":", "raise"], "function": "def Func(arg_0):\n    \"\"\"Recursively kill the descendants of a process before killing it.\n    \"\"\"\n\n    if sys.platform == \"win32\":\n        # On windows, the taskkill function with option `/T` terminate a given\n        # process pid and its children.\n        try:\n            subprocess.check_output(\n                [\"taskkill\", \"/F\", \"/T\", \"/PID\", str(arg_0)],\n                stderr=None)\n        except subprocess.CalledProcessError as e:\n            # In windows, taskkill return 1 for permission denied and 128, 255\n            # for no process found.\n            if e.returncode not in [1, 128, 255]:\n                raise\n            elif e.returncode == 1:\n                # Try to kill the process without its descendants if taskkill\n                # was denied permission. If this fails too, with an error\n                # different from process not found, let the top level function\n                # raise a warning and retry to kill the process.\n                try:\n                    os.kill(arg_0, signal.SIGTERM)\n                except OSError as e:\n                    if e.errno != errno.ESRCH:\n                        raise\n\n    else:\n        try:\n            arg_1 = subprocess.check_output(\n                [\"pgrep\", \"-P\", str(arg_0)],\n                stderr=None\n            )\n        except subprocess.CalledProcessError as e:\n            # `ps` returns 1 when no child process has been found\n            if e.returncode == 1:\n                arg_1 = b''\n            else:\n                raise\n\n        # Decode the result, split the cpid and remove the trailing line\n        arg_1 = arg_1.decode().split('\\n')[:-1]\n        for arg_2 in arg_1:\n            arg_2 = int(arg_2)\n            Func(arg_2)\n\n        try:\n            os.kill(arg_0, signal.SIGTERM)\n        except OSError as e:\n            # if OSError is raised with [Errno 3] no such process, the process\n            # is already terminated, else, raise the error and let the top\n            # level function raise a warning and retry to kill the process.\n            if e.errno != errno.ESRCH:\n                raise", "path": "loky/backend/utils.py", "identifier": "_recursive_terminate", "docstring": "Recursively kill the descendants of a process before killing it.", "docstring_tokens": ["Recursively", "kill", "the", "descendants", "of", "a", "process", "before", "killing", "it", "."], "nwo": "tomMoral/loky", "score": 0.572510808364181, "idx": 252665}
{"url": "https://github.com/globality-corp/flake8-logging-format/blob/3c6ce53d0ff1ec369799cff0ed6d048343252e40/logging_format/visitor.py#L184-L197", "sha": "3c6ce53d0ff1ec369799cff0ed6d048343252e40", "docstring_summary": "Heuristic to decide whether an AST Call is a logging call.", "language": "python", "parameters": "(self, node)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "if", "arg_0", ".", "get_id_attr", "(", "arg_1", ".", "func", ".", "value", ")", "==", "\"warnings\"", ":", "return", "None", "if", "arg_1", ".", "func", ".", "attr", "in", "LOGGING_LEVELS", ":", "return", "arg_1", ".", "func", ".", "attr", "except", "AttributeError", ":", "pass", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Heuristic to decide whether an AST Call is a logging call.\n\n        \"\"\"\n        try:\n            if arg_0.get_id_attr(arg_1.func.value) == \"warnings\":\n                return None\n            # NB: We could also look at the argument signature or the target attribute\n            if arg_1.func.attr in LOGGING_LEVELS:\n                return arg_1.func.attr\n        except AttributeError:\n            pass\n        return None", "path": "logging_format/visitor.py", "identifier": "LoggingVisitor.detect_logging_level", "docstring": "Heuristic to decide whether an AST Call is a logging call.", "docstring_tokens": ["Heuristic", "to", "decide", "whether", "an", "AST", "Call", "is", "a", "logging", "call", "."], "nwo": "globality-corp/flake8-logging-format", "score": 0.5445282565269285, "idx": 252666}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dsub.py#L835-L840", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "A defaultdict with, for each job, a list of its tasks.", "language": "python", "parameters": "(tasks)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "arg_2", "in", "arg_0", ":", "arg_1", "[", "arg_2", ".", "get_field", "(", "'job-id'", ")", "]", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"A defaultdict with, for each job, a list of its tasks.\"\"\"\n  arg_1 = collections.defaultdict(list)\n  for arg_2 in arg_0:\n    arg_1[arg_2.get_field('job-id')].append(arg_2)\n  return arg_1", "path": "dsub/commands/dsub.py", "identifier": "_group_tasks_by_jobid", "docstring": "A defaultdict with, for each job, a list of its tasks.", "docstring_tokens": ["A", "defaultdict", "with", "for", "each", "job", "a", "list", "of", "its", "tasks", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 252667}
{"url": "https://github.com/joopert/nad_receiver/blob/416de0173a330c75cc73f9c90b0c5df32e5e0ba3/nad_receiver/__init__.py#L107-L119", "sha": "416de0173a330c75cc73f9c90b0c5df32e5e0ba3", "docstring_summary": "Execute Main.Source.", "language": "python", "parameters": "(self, operator, value=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "try", ":", "arg_3", "=", "int", "(", "arg_0", ".", "exec_command", "(", "'main'", ",", "'source'", ",", "arg_1", ",", "arg_2", ")", ")", "return", "arg_3", "except", "(", "ValueError", ",", "TypeError", ")", ":", "pass", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Execute Main.Source.\n\n        Returns int\n        \"\"\"\n        try:\n            arg_3 = int(arg_0.exec_command('main', 'source', arg_1, arg_2))\n            return arg_3\n        except (ValueError, TypeError):\n            pass\n\n        return None", "path": "nad_receiver/__init__.py", "identifier": "NADReceiver.main_source", "docstring": "Execute Main.Source.\n\n        Returns int", "docstring_tokens": ["Execute", "Main", ".", "Source", "."], "nwo": "joopert/nad_receiver", "score": 0.1878804938561529, "idx": 252668}
{"url": "https://github.com/hackebrot/poyo/blob/4c7338a87c692c317b3b5bc726d731dd96689298/poyo/_nodes.py#L26-L36", "sha": "4c7338a87c692c317b3b5bc726d731dd96689298", "docstring_summary": "If the given object is an instance of Child add it to self and\n        register self as a parent.", "language": "python", "parameters": "(self, child)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "ChildMixin", ")", ":", "raise", "TypeError", "(", "'Requires instance of TreeElement. '", "'Got {}'", ".", "format", "(", "type", "(", "arg_1", ")", ")", ")", "arg_1", ".", "parent", "=", "arg_0", "arg_0", ".", "_children", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"If the given object is an instance of Child add it to self and\n        register self as a parent.\n        \"\"\"\n        if not isinstance(arg_1, ChildMixin):\n            raise TypeError(\n                'Requires instance of TreeElement. '\n                'Got {}'.format(type(arg_1))\n            )\n        arg_1.parent = arg_0\n        arg_0._children.append(arg_1)", "path": "poyo/_nodes.py", "identifier": "ContainerMixin.add_child", "docstring": "If the given object is an instance of Child add it to self and\n        register self as a parent.", "docstring_tokens": ["If", "the", "given", "object", "is", "an", "instance", "of", "Child", "add", "it", "to", "self", "and", "register", "self", "as", "a", "parent", "."], "nwo": "hackebrot/poyo", "score": 0.38693940265489923, "idx": 252669}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/gaia.py#L835-L980", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This queries the GAIA TAP service for a list of objects near the coords.", "language": "python", "parameters": "(racenter,\n                          declcenter,\n                          searchradiusarcsec,\n                          gaia_mirror=None,\n                          columns=('source_id',\n                                   'ra','dec',\n                                   'phot_g_mean_mag',\n                                   'l','b',\n                                   'parallax', 'parallax_error',\n                                   'pmra','pmra_error',\n                                   'pmdec','pmdec_error'),\n                          extra_filter=None,\n                          returnformat='csv',\n                          forcefetch=False,\n                          cachedir='~/.astrobase/gaia-cache',\n                          verbose=True,\n                          timeout=15.0,\n                          refresh=2.0,\n                          maxtimeout=300.0,\n                          maxtries=3,\n                          complete_query_later=True)", "return_statement": "return tap_query(formatted_query,\n                     gaia_mirror=gaia_mirror,\n                     returnformat=returnformat,\n                     forcefetch=forcefetch,\n                     cachedir=cachedir,\n                     verbose=verbose,\n                     timeout=timeout,\n                     refresh=refresh,\n                     maxtimeout=maxtimeout,\n                     maxtries=maxtries,\n                     complete_query_later=complete_query_later)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "(", "'source_id'", ",", "'ra'", ",", "'dec'", ",", "'phot_g_mean_mag'", ",", "'l'", ",", "'b'", ",", "'parallax'", ",", "'parallax_error'", ",", "'pmra'", ",", "'pmra_error'", ",", "'pmdec'", ",", "'pmdec_error'", ")", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'csv'", ",", "arg_7", "=", "False", ",", "arg_8", "=", "'~/.astrobase/gaia-cache'", ",", "arg_9", "=", "True", ",", "arg_10", "=", "15.0", ",", "arg_11", "=", "2.0", ",", "arg_12", "=", "300.0", ",", "arg_13", "=", "3", ",", "arg_14", "=", "True", ")", ":", "arg_15", "=", "(", "\"select {columns}, \"", "\"(DISTANCE(POINT('ICRS', \"", "\"{{table}}.ra, {{table}}.dec), \"", "\"POINT('ICRS', {ra_center:.5f}, {decl_center:.5f})))*3600.0 \"", "\"AS dist_arcsec \"", "\"from {{table}} where \"", "\"CONTAINS(POINT('ICRS',{{table}}.ra, {{table}}.dec),\"", "\"CIRCLE('ICRS',{ra_center:.5f},{decl_center:.5f},\"", "\"{search_radius:.6f}))=1 \"", "\"{extra_filter_str}\"", "\"ORDER by dist_arcsec asc \"", ")", "if", "arg_5", "is", "not", "None", ":", "arg_16", "=", "' and %s '", "%", "arg_5", "else", ":", "arg_16", "=", "''", "arg_17", "=", "arg_15", ".", "format", "(", "ra_center", "=", "arg_0", ",", "decl_center", "=", "arg_1", ",", "search_radius", "=", "arg_2", "/", "3600.0", ",", "arg_16", "=", "arg_16", ",", "arg_4", "=", "', '", ".", "join", "(", "arg_4", ")", ")", "return", "tap_query", "(", "arg_17", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ")"], "function": "def Func(arg_0,\n                          arg_1,\n                          arg_2,\n                          arg_3=None,\n                          arg_4=('source_id',\n                                   'ra','dec',\n                                   'phot_g_mean_mag',\n                                   'l','b',\n                                   'parallax', 'parallax_error',\n                                   'pmra','pmra_error',\n                                   'pmdec','pmdec_error'),\n                          arg_5=None,\n                          arg_6='csv',\n                          arg_7=False,\n                          arg_8='~/.astrobase/gaia-cache',\n                          arg_9=True,\n                          arg_10=15.0,\n                          arg_11=2.0,\n                          arg_12=300.0,\n                          arg_13=3,\n                          arg_14=True):\n    '''This queries the GAIA TAP service for a list of objects near the coords.\n\n    Runs a conesearch around `(racenter, declcenter)` with radius in arcsec of\n    `searchradiusarcsec`.\n\n    Parameters\n    ----------\n\n    racenter,declcenter : float\n        The center equatorial coordinates in decimal degrees.\n\n    searchradiusarcsec : float\n        The search radius of the cone-search in arcseconds.\n\n    gaia_mirror : {'gaia','heidelberg','vizier'} or None\n        This is the key used to select a GAIA catalog mirror from the\n        `GAIA_URLS` dict above. If set, the specified mirror will be used. If\n        None, a random mirror chosen from that dict will be used.\n\n    columns : sequence of str\n        This indicates which columns from the GAIA table to request for the\n        objects found within the search radius.\n\n    extra_filter: str or None\n        If this is provided, must be a valid ADQL filter string that is used to\n        further filter the cone-search results.\n\n    returnformat : {'csv','votable','json'}\n        The returned file format to request from the GAIA catalog service.\n\n    forcefetch : bool\n        If this is True, the query will be retried even if cached results for\n        it exist.\n\n    cachedir : str\n        This points to the directory where results will be downloaded.\n\n    verbose : bool\n        If True, will indicate progress and warn of any issues.\n\n    timeout : float\n        This sets the amount of time in seconds to wait for the service to\n        respond to our initial request.\n\n    refresh : float\n        This sets the amount of time in seconds to wait before checking if the\n        result file is available. If the results file isn't available after\n        `refresh` seconds have elapsed, the function will wait for `refresh`\n        seconds continuously, until `maxtimeout` is reached or the results file\n        becomes available.\n\n    maxtimeout : float\n        The maximum amount of time in seconds to wait for a result to become\n        available after submitting our query request.\n\n    maxtries : int\n        The maximum number of tries (across all mirrors tried) to make to either\n        submit the request or download the results, before giving up.\n\n    completequerylater : bool\n        If set to True, a submitted query that does not return a result before\n        `maxtimeout` has passed will be cancelled but its input request\n        parameters and the result URL provided by the service will be saved. If\n        this function is then called later with these same input request\n        parameters, it will check if the query finally finished and a result is\n        available. If so, will download the results instead of submitting a new\n        query. If it's not done yet, will start waiting for results again. To\n        force launch a new query with the same request parameters, set the\n        `forcefetch` kwarg to True.\n\n    Returns\n    -------\n\n    dict\n        This returns a dict of the following form::\n\n            {'params':dict of the input params used for the query,\n             'provenance':'cache' or 'new download',\n             'result':path to the file on disk with the downloaded data table}\n\n    '''\n\n    # this was generated using the awesome query generator at:\n    # https://gea.esac.esa.int/archive/\n\n    # NOTE: here we don't resolve the table name right away. this is because\n    # some of the GAIA mirrors use different table names, so we leave the table\n    # name to be resolved by the lower level tap_query function. this is done by\n    # the {{table}} construct.\n    arg_15 = (\n        \"select {columns}, \"\n        \"(DISTANCE(POINT('ICRS', \"\n        \"{{table}}.ra, {{table}}.dec), \"\n        \"POINT('ICRS', {ra_center:.5f}, {decl_center:.5f})))*3600.0 \"\n        \"AS dist_arcsec \"\n        \"from {{table}} where \"\n        \"CONTAINS(POINT('ICRS',{{table}}.ra, {{table}}.dec),\"\n        \"CIRCLE('ICRS',{ra_center:.5f},{decl_center:.5f},\"\n        \"{search_radius:.6f}))=1 \"\n        \"{extra_filter_str}\"\n        \"ORDER by dist_arcsec asc \"\n    )\n\n    if arg_5 is not None:\n        arg_16 = ' and %s ' % arg_5\n    else:\n        arg_16 = ''\n\n    arg_17 = arg_15.format(ra_center=arg_0,\n                                   decl_center=arg_1,\n                                   search_radius=arg_2/3600.0,\n                                   arg_16=arg_16,\n                                   arg_4=', '.join(arg_4))\n\n    return tap_query(arg_17,\n                     arg_3=arg_3,\n                     arg_6=arg_6,\n                     arg_7=arg_7,\n                     arg_8=arg_8,\n                     arg_9=arg_9,\n                     arg_10=arg_10,\n                     arg_11=arg_11,\n                     arg_12=arg_12,\n                     arg_13=arg_13,\n                     arg_14=arg_14)", "path": "astrobase/services/gaia.py", "identifier": "objectlist_conesearch", "docstring": "This queries the GAIA TAP service for a list of objects near the coords.\n\n    Runs a conesearch around `(racenter, declcenter)` with radius in arcsec of\n    `searchradiusarcsec`.\n\n    Parameters\n    ----------\n\n    racenter,declcenter : float\n        The center equatorial coordinates in decimal degrees.\n\n    searchradiusarcsec : float\n        The search radius of the cone-search in arcseconds.\n\n    gaia_mirror : {'gaia','heidelberg','vizier'} or None\n        This is the key used to select a GAIA catalog mirror from the\n        `GAIA_URLS` dict above. If set, the specified mirror will be used. If\n        None, a random mirror chosen from that dict will be used.\n\n    columns : sequence of str\n        This indicates which columns from the GAIA table to request for the\n        objects found within the search radius.\n\n    extra_filter: str or None\n        If this is provided, must be a valid ADQL filter string that is used to\n        further filter the cone-search results.\n\n    returnformat : {'csv','votable','json'}\n        The returned file format to request from the GAIA catalog service.\n\n    forcefetch : bool\n        If this is True, the query will be retried even if cached results for\n        it exist.\n\n    cachedir : str\n        This points to the directory where results will be downloaded.\n\n    verbose : bool\n        If True, will indicate progress and warn of any issues.\n\n    timeout : float\n        This sets the amount of time in seconds to wait for the service to\n        respond to our initial request.\n\n    refresh : float\n        This sets the amount of time in seconds to wait before checking if the\n        result file is available. If the results file isn't available after\n        `refresh` seconds have elapsed, the function will wait for `refresh`\n        seconds continuously, until `maxtimeout` is reached or the results file\n        becomes available.\n\n    maxtimeout : float\n        The maximum amount of time in seconds to wait for a result to become\n        available after submitting our query request.\n\n    maxtries : int\n        The maximum number of tries (across all mirrors tried) to make to either\n        submit the request or download the results, before giving up.\n\n    completequerylater : bool\n        If set to True, a submitted query that does not return a result before\n        `maxtimeout` has passed will be cancelled but its input request\n        parameters and the result URL provided by the service will be saved. If\n        this function is then called later with these same input request\n        parameters, it will check if the query finally finished and a result is\n        available. If so, will download the results instead of submitting a new\n        query. If it's not done yet, will start waiting for results again. To\n        force launch a new query with the same request parameters, set the\n        `forcefetch` kwarg to True.\n\n    Returns\n    -------\n\n    dict\n        This returns a dict of the following form::\n\n            {'params':dict of the input params used for the query,\n             'provenance':'cache' or 'new download',\n             'result':path to the file on disk with the downloaded data table}", "docstring_tokens": ["This", "queries", "the", "GAIA", "TAP", "service", "for", "a", "list", "of", "objects", "near", "the", "coords", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252670}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/phase_change.py#L854-L861", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "Adjusts enthalpy of vaporization of enthalpy for another temperature, for one temperature.", "language": "python", "parameters": "(T, Hvap_ref, T_Ref, Tc, exponent=0.38)", "return_statement": "return H2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0.38", ")", ":", "arg_5", "=", "arg_0", "/", "arg_3", "arg_6", "=", "arg_2", "/", "arg_3", "arg_7", "=", "arg_1", "*", "(", "(", "1", "-", "arg_5", ")", "/", "(", "1", "-", "arg_6", ")", ")", "**", "arg_4", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0.38):\n    '''\n    Adjusts enthalpy of vaporization of enthalpy for another temperature, for one temperature.\n    '''\n    arg_5 = arg_0/arg_3\n    arg_6 = arg_2/arg_3\n    arg_7 = arg_1*((1-arg_5)/(1-arg_6))**arg_4\n    return arg_7", "path": "thermo/phase_change.py", "identifier": "Watson", "docstring": "Adjusts enthalpy of vaporization of enthalpy for another temperature, for one temperature.", "docstring_tokens": ["Adjusts", "enthalpy", "of", "vaporization", "of", "enthalpy", "for", "another", "temperature", "for", "one", "temperature", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 252671}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/views/admin/content_status.py#L243-L292", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Returns a dictionary with all the past baking statuses of a single book.", "language": "python", "parameters": "(request)", "return_statement": "return {'uuid': str(collection_info['uuid']),\n            'title': collection_info['name'].decode('utf-8'),\n            'authors': format_authors(collection_info['authors']),\n            'print_style': collection_info['print_style'],\n            'current_recipe': collection_info['recipe_id'],\n            'current_ident': collection_info['module_ident'],\n            'current_state': states[0]['state'],\n            'states': states}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "matchdict", "[", "'uuid'", "]", "try", ":", "UUID", "(", "arg_1", ")", "except", "ValueError", ":", "raise", "httpexceptions", ".", "HTTPBadRequest", "(", "'{} is not a valid uuid'", ".", "format", "(", "arg_1", ")", ")", "arg_2", ",", "arg_3", "=", "get_baking_statuses_sql", "(", "{", "'uuid'", ":", "arg_1", "}", ")", "with", "db_connect", "(", "cursor_factory", "=", "DictCursor", ")", "as", "db_conn", ":", "with", "db_conn", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "arg_2", ",", "arg_3", ")", "arg_4", "=", "cursor", ".", "fetchall", "(", ")", "if", "len", "(", "arg_4", ")", "==", "0", ":", "raise", "httpexceptions", ".", "HTTPBadRequest", "(", "'{} is not a book'", ".", "format", "(", "arg_1", ")", ")", "arg_5", "=", "[", "]", "arg_6", "=", "arg_4", "[", "0", "]", "for", "arg_7", "in", "arg_4", ":", "arg_8", "=", "''", "arg_9", "=", "arg_7", "[", "'state'", "]", "or", "'PENDING'", "if", "arg_9", "==", "'FAILURE'", ":", "if", "arg_7", "[", "'traceback'", "]", "is", "not", "None", ":", "arg_8", "=", "arg_7", "[", "'traceback'", "]", "arg_10", "=", "arg_7", "[", "'latest_recipe_id'", "]", "arg_11", "=", "arg_7", "[", "'recipe_id'", "]", "if", "(", "arg_10", "is", "not", "None", "and", "arg_11", "!=", "arg_10", ")", ":", "arg_9", "+=", "' stale_recipe'", "arg_5", ".", "append", "(", "{", "'version'", ":", "arg_7", "[", "'current_version'", "]", ",", "'recipe'", ":", "arg_7", "[", "'recipe'", "]", ",", "'created'", ":", "str", "(", "arg_7", "[", "'created'", "]", ")", ",", "'state'", ":", "arg_9", ",", "'state_message'", ":", "arg_8", ",", "}", ")", "return", "{", "'uuid'", ":", "str", "(", "arg_6", "[", "'uuid'", "]", ")", ",", "'title'", ":", "arg_6", "[", "'name'", "]", ".", "decode", "(", "'utf-8'", ")", ",", "'authors'", ":", "format_authors", "(", "arg_6", "[", "'authors'", "]", ")", ",", "'print_style'", ":", "arg_6", "[", "'print_style'", "]", ",", "'current_recipe'", ":", "arg_6", "[", "'recipe_id'", "]", ",", "'current_ident'", ":", "arg_6", "[", "'module_ident'", "]", ",", "'current_state'", ":", "arg_5", "[", "0", "]", "[", "'state'", "]", ",", "'states'", ":", "arg_5", "}"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns a dictionary with all the past baking statuses of a single book.\n    \"\"\"\n    arg_1 = arg_0.matchdict['uuid']\n    try:\n        UUID(arg_1)\n    except ValueError:\n        raise httpexceptions.HTTPBadRequest(\n            '{} is not a valid uuid'.format(arg_1))\n\n    arg_2, arg_3 = get_baking_statuses_sql({'uuid': arg_1})\n    with db_connect(cursor_factory=DictCursor) as db_conn:\n        with db_conn.cursor() as cursor:\n            cursor.execute(arg_2, arg_3)\n            arg_4 = cursor.fetchall()\n            if len(arg_4) == 0:\n                raise httpexceptions.HTTPBadRequest(\n                    '{} is not a book'.format(arg_1))\n\n            arg_5 = []\n            arg_6 = arg_4[0]\n\n            for arg_7 in arg_4:\n                arg_8 = ''\n                arg_9 = arg_7['state'] or 'PENDING'\n                if arg_9 == 'FAILURE':  # pragma: no cover\n                    if arg_7['traceback'] is not None:\n                        arg_8 = arg_7['traceback']\n                arg_10 = arg_7['latest_recipe_id']\n                arg_11 = arg_7['recipe_id']\n                if (arg_10 is not None and\n                        arg_11 != arg_10):\n                    arg_9 += ' stale_recipe'\n                arg_5.append({\n                    'version': arg_7['current_version'],\n                    'recipe': arg_7['recipe'],\n                    'created': str(arg_7['created']),\n                    'state': arg_9,\n                    'state_message': arg_8,\n                })\n\n    return {'uuid': str(arg_6['uuid']),\n            'title': arg_6['name'].decode('utf-8'),\n            'authors': format_authors(arg_6['authors']),\n            'print_style': arg_6['print_style'],\n            'current_recipe': arg_6['recipe_id'],\n            'current_ident': arg_6['module_ident'],\n            'current_state': arg_5[0]['state'],\n            'states': arg_5}", "path": "cnxpublishing/views/admin/content_status.py", "identifier": "admin_content_status_single", "docstring": "Returns a dictionary with all the past baking statuses of a single book.", "docstring_tokens": ["Returns", "a", "dictionary", "with", "all", "the", "past", "baking", "statuses", "of", "a", "single", "book", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 252672}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L28-L41", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "update the base, including the URL for GitLab and the API endpoint.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "base", "=", "arg_0", ".", "_get_and_update_setting", "(", "'SREGISTRY_GITLAB_BASE'", ",", "\"https://gitlab.com/\"", ")", "arg_0", ".", "api_base", "=", "\"%s/api/v4\"", "%", "arg_0", ".", "base", ".", "strip", "(", "'/'", ")", "arg_0", ".", "artifacts", "=", "arg_0", ".", "_get_and_update_setting", "(", "'SREGISTRY_GITLAB_FOLDER'", ",", "'build'", ")", "arg_0", ".", "job", "=", "arg_0", ".", "_get_and_update_setting", "(", "'SREGISTRY_GITLAB_JOB'", ",", "'build'", ")", "bot", ".", "debug", "(", "'      Api: %s'", "%", "arg_0", ".", "api_base", ")", "bot", ".", "debug", "(", "'Artifacts: %s'", "%", "arg_0", ".", "artifacts", ")", "bot", ".", "debug", "(", "'      Job: %s'", "%", "arg_0", ".", "job", ")"], "function": "def Func(arg_0):\n        '''update the base, including the URL for GitLab and the API endpoint.\n        '''\n        arg_0.base = arg_0._get_and_update_setting('SREGISTRY_GITLAB_BASE',\n                                                 \"https://gitlab.com/\")\n        arg_0.api_base = \"%s/api/v4\" % arg_0.base.strip('/')\n        arg_0.artifacts = arg_0._get_and_update_setting('SREGISTRY_GITLAB_FOLDER',\n                                                      'build')\n\n        arg_0.job = arg_0._get_and_update_setting('SREGISTRY_GITLAB_JOB', 'build')\n\n        bot.debug('      Api: %s' % arg_0.api_base)\n        bot.debug('Artifacts: %s' % arg_0.artifacts)\n        bot.debug('      Job: %s' % arg_0.job)", "path": "sregistry/main/gitlab/__init__.py", "identifier": "Client._update_base", "docstring": "update the base, including the URL for GitLab and the API endpoint.", "docstring_tokens": ["update", "the", "base", "including", "the", "URL", "for", "GitLab", "and", "the", "API", "endpoint", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 252673}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/amazon/api.py#L239-L253", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Iterate Pages.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "while", "True", ":", "yield", "arg_0", ".", "_query", "(", "ItemPage", "=", "arg_0", ".", "current_page", ",", "**", "arg_0", ".", "kwargs", ")", "arg_0", ".", "current_page", "+=", "1", "except", "NoMorePages", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"Iterate Pages.\n\n        A generator which iterates over all pages.\n        Keep in mind that Amazon limits the number of pages it makes available.\n\n        :return:\n            Yields lxml root elements.\n        \"\"\"\n        try:\n            while True:\n                yield arg_0._query(ItemPage=arg_0.current_page, **arg_0.kwargs)\n                arg_0.current_page += 1\n        except NoMorePages:\n            pass", "path": "capybara/virtualenv/lib/python2.7/site-packages/amazon/api.py", "identifier": "AmazonSearch.iterate_pages", "docstring": "Iterate Pages.\n\n        A generator which iterates over all pages.\n        Keep in mind that Amazon limits the number of pages it makes available.\n\n        :return:\n            Yields lxml root elements.", "docstring_tokens": ["Iterate", "Pages", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252674}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/oauth2.py#L203-L208", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Determines which method of getting the query object for use", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ".", "model", ",", "'Func'", ")", ":", "return", "arg_0", ".", "model", ".", "Func", "else", ":", "return", "arg_0", ".", "session", ".", "Func", "(", "arg_0", ".", "model", ")"], "function": "def Func(arg_0):\n        \"\"\"Determines which method of getting the Func object for use\"\"\"\n        if hasattr(arg_0.model, 'Func'):\n            return arg_0.model.Func\n        else:\n            return arg_0.session.Func(arg_0.model)", "path": "flask_oauthlib/contrib/oauth2.py", "identifier": "BaseBinding.query", "docstring": "Determines which method of getting the query object for use", "docstring_tokens": ["Determines", "which", "method", "of", "getting", "the", "query", "object", "for", "use"], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 252675}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L532-L557", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get the clan badge image URL", "language": "python", "parameters": "(self, obj: BaseAttrDict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_1", ".", "clan", ".", "badge_id", "except", "AttributeError", ":", "try", ":", "arg_3", "=", "arg_1", ".", "badge_id", "except", "AttributeError", ":", "return", "'https://i.imgur.com/Y3uXsgj.png'", "if", "arg_3", "is", "None", ":", "return", "'https://i.imgur.com/Y3uXsgj.png'", "for", "arg_4", "in", "arg_0", ".", "constants", ".", "alliance_badges", ":", "if", "arg_4", ".", "id", "==", "arg_3", ":", "return", "'https://royaleapi.github.io/cr-api-assets/badges/'", "+", "arg_4", ".", "name", "+", "'.png'"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"Get the clan badge image URL\n\n        Parameters\n        ---------\n        obj: official_api.models.BaseAttrDict\n            An object that has the clan badge ID either in ``.clan.badge_id`` or ``.badge_id``\n            Can be a clan or a profile for example.\n\n        Returns str\n        \"\"\"\n\n        try:\n            arg_3 = arg_1.clan.badge_id\n        except AttributeError:\n            try:\n                arg_3 = arg_1.badge_id\n            except AttributeError:\n                return 'https://i.imgur.com/Y3uXsgj.png'\n\n        if arg_3 is None:\n            return 'https://i.imgur.com/Y3uXsgj.png'\n\n        for arg_4 in arg_0.constants.alliance_badges:\n            if arg_4.id == arg_3:\n                return 'https://royaleapi.github.io/cr-api-assets/badges/' + arg_4.name + '.png'", "path": "clashroyale/official_api/client.py", "identifier": "Client.get_clan_image", "docstring": "Get the clan badge image URL\n\n        Parameters\n        ---------\n        obj: official_api.models.BaseAttrDict\n            An object that has the clan badge ID either in ``.clan.badge_id`` or ``.badge_id``\n            Can be a clan or a profile for example.\n\n        Returns str", "docstring_tokens": ["Get", "the", "clan", "badge", "image", "URL"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 252676}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/cache/security_groups_client.py#L150-L159", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Writes a series of security group rules to a redis server.", "language": "python", "parameters": "(self, device_id, mac_address, rules)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "LOG", ".", "info", "(", "\"Applying security group rules for device %s with MAC %s\"", "%", "(", "arg_1", ",", "arg_2", ")", ")", "arg_4", "=", "{", "SECURITY_GROUP_RULE_KEY", ":", "arg_3", "}", "arg_5", "=", "arg_0", ".", "vif_key", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "set_field", "(", "arg_5", ",", "SECURITY_GROUP_HASH_ATTR", ",", "arg_4", ")", "arg_0", ".", "set_field_raw", "(", "arg_5", ",", "SECURITY_GROUP_ACK", ",", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Writes a series of security group rules to a redis server.\"\"\"\n        LOG.info(\"Applying security group rules for device %s with MAC %s\" %\n                 (arg_1, arg_2))\n\n        arg_4 = {SECURITY_GROUP_RULE_KEY: arg_3}\n        arg_5 = arg_0.vif_key(arg_1, arg_2)\n        # TODO(mdietz): Pipeline these. Requires some rewriting\n        arg_0.set_field(arg_5, SECURITY_GROUP_HASH_ATTR, arg_4)\n        arg_0.set_field_raw(arg_5, SECURITY_GROUP_ACK, False)", "path": "quark/cache/security_groups_client.py", "identifier": "SecurityGroupsClient.apply_rules", "docstring": "Writes a series of security group rules to a redis server.", "docstring_tokens": ["Writes", "a", "series", "of", "security", "group", "rules", "to", "a", "redis", "server", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 252677}
{"url": "https://github.com/lucaslamounier/USGSDownload/blob/0969483ea9f9648aa17b099f36d2e1010488b2a4/usgsdownload/usgs.py#L193-L215", "sha": "0969483ea9f9648aa17b099f36d2e1010488b2a4", "docstring_summary": "Connection to Earth explorer without proxy", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "info", "(", "\"Establishing connection to Earthexplorer\"", ")", "print", "(", "\"\\n Establishing connection to Earthexplorer\"", ")", "try", ":", "arg_1", "=", "urllib", ".", "request", ".", "build_opener", "(", "urllib", ".", "request", ".", "HTTPCookieProcessor", "(", ")", ")", "urllib", ".", "request", ".", "install_opener", "(", "arg_1", ")", "arg_2", "=", "urllib", ".", "parse", ".", "urlencode", "(", "dict", "(", "username", "=", "arg_0", ".", "user", ",", "password", "=", "arg_0", ".", "password", ")", ")", "arg_2", "=", "arg_2", ".", "encode", "(", "'utf-8'", ")", "arg_3", "=", "arg_1", ".", "open", "(", "\"https://ers.cr.usgs.gov/login\"", ",", "arg_2", ")", "arg_4", "=", "arg_3", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "arg_3", ".", "close", "(", ")", "if", "arg_4", ".", "find", "(", "'You must sign in as a registered user to download data or place orders for USGS EROS products'", ")", ">", "0", ":", "print", "(", "\"\\n Authentification failed\"", ")", "logger", ".", "error", "(", "\"Authentification failed\"", ")", "raise", "AutenticationUSGSFailed", "(", "'Authentification USGS failed'", ")", "print", "(", "'User %s connected with USGS'", "%", "arg_0", ".", "user", ")", "logger", ".", "debug", "(", "'User %s connected with USGS'", "%", "arg_0", ".", "user", ")", "return", "except", "Exception", "as", "e", ":", "print", "(", "'\\nError when trying to connect USGS: %s'", "%", "e", ")", "raise", "logger", ".", "error", "(", "'Error when trying to connect USGS: %s'", "%", "e", ")"], "function": "def Func(arg_0):\n        \"\"\"   Connection to Earth explorer without proxy  \"\"\"\n        logger.info(\"Establishing connection to Earthexplorer\")\n        print(\"\\n Establishing connection to Earthexplorer\")\n        try:\n            arg_1 = urllib.request.build_opener(urllib.request.HTTPCookieProcessor())\n            urllib.request.install_opener(arg_1)\n            arg_2 = urllib.parse.urlencode(dict(username=arg_0.user, password=arg_0.password))\n            arg_2 = arg_2.encode('utf-8')\n            arg_3 = arg_1.open(\"https://ers.cr.usgs.gov/login\", arg_2)\n            arg_4 = arg_3.read().decode('utf-8')\n            arg_3.close()\n            if arg_4.find(\n                    'You must sign in as a registered user to download data or place orders for USGS EROS products') > 0:\n                print(\"\\n Authentification failed\")\n                logger.error(\"Authentification failed\")\n                raise AutenticationUSGSFailed('Authentification USGS failed')\n            print('User %s connected with USGS' % arg_0.user)\n            logger.debug('User %s connected with USGS' % arg_0.user)\n            return\n        except Exception as e:\n            print('\\nError when trying to connect USGS: %s' % e)\n            raise logger.error('Error when trying to connect USGS: %s' % e)", "path": "usgsdownload/usgs.py", "identifier": "USGSDownload.connect_earthexplorer", "docstring": "Connection to Earth explorer without proxy", "docstring_tokens": ["Connection", "to", "Earth", "explorer", "without", "proxy"], "nwo": "lucaslamounier/USGSDownload", "score": 0.17782712273869106, "idx": 252678}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_json_stream.py#L175-L186", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Load a JSON stream and return a generator, yielding one object at a time.", "language": "python", "parameters": "(file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "string_type", ")", ":", "arg_0", "=", "open", "(", "arg_0", ",", "'rb'", ")", "for", "arg_1", "in", "arg_0", ":", "arg_1", "=", "arg_1", ".", "strip", "(", ")", "if", "arg_1", ":", "if", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "arg_1", "=", "arg_1", ".", "decode", "(", "'utf-8'", ")", "yield", "json", ".", "loads", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Load a JSON stream and return a generator, yielding one object at a time.\n    \"\"\"\n    if isinstance(arg_0, string_type):\n        arg_0 = open(arg_0, 'rb')\n    for arg_1 in arg_0:\n        arg_1 = arg_1.strip()\n        if arg_1:\n            if isinstance(arg_1, bytes):\n                arg_1 = arg_1.decode('utf-8')\n            yield json.loads(arg_1)", "path": "luminoso_api/v4_json_stream.py", "identifier": "stream_json_lines", "docstring": "Load a JSON stream and return a generator, yielding one object at a time.", "docstring_tokens": ["Load", "a", "JSON", "stream", "and", "return", "a", "generator", "yielding", "one", "object", "at", "a", "time", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 252679}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L308-L367", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Rewrite local file URIs as required by the rewrite_uris method.", "language": "python", "parameters": "(raw_uri)", "return_statement": "return normed_uri, docker_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "os", ".", "path", ".", "split", "(", "arg_0", ")", "arg_3", "=", "[", "(", "'file:///'", ",", "'/'", ")", ",", "(", "'~/'", ",", "os", ".", "getenv", "(", "'HOME'", ")", ")", ",", "(", "'./'", ",", "''", ")", ",", "(", "'file:/'", ",", "'/'", ")", "]", "arg_4", "=", "arg_1", "for", "arg_5", ",", "arg_6", "in", "arg_3", ":", "if", "arg_4", ".", "startswith", "(", "arg_5", ")", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_4", "[", "len", "(", "arg_5", ")", ":", "]", ")", "arg_7", "=", "directory_fmt", "(", "os", ".", "path", ".", "abspath", "(", "arg_4", ")", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_7", ",", "arg_2", ")", "arg_8", "=", "[", "(", "r'/\\.\\.'", ",", "'/_dotdot_'", ")", ",", "(", "r'^\\.\\.'", ",", "'_dotdot_'", ")", ",", "(", "r'^~/'", ",", "'_home_/'", ")", ",", "(", "r'^file:/'", ",", "''", ")", "]", "arg_9", "=", "os", ".", "path", ".", "normpath", "(", "arg_1", ")", "for", "arg_10", ",", "arg_6", "in", "arg_8", ":", "arg_9", "=", "re", ".", "sub", "(", "arg_10", ",", "arg_6", ",", "arg_9", ")", "arg_9", "=", "arg_9", ".", "lstrip", "(", "'./'", ")", "arg_9", "=", "directory_fmt", "(", "'file/'", "+", "arg_9", ")", "+", "arg_2", "return", "arg_7", ",", "arg_9"], "function": "def Func(arg_0):\n  \"\"\"Rewrite local file URIs as required by the rewrite_uris method.\n\n  Local file paths, unlike GCS paths, may have their raw URI simplified by\n  os.path.normpath which collapses extraneous indirect characters.\n\n  >>> Func('/tmp/a_path/../B_PATH/file.txt')\n  ('/tmp/B_PATH/file.txt', 'file/tmp/B_PATH/file.txt')\n  >>> Func('/myhome/./mydir/')\n  ('/myhome/mydir/', 'file/myhome/mydir/')\n\n  The local path rewriter will also work to preserve relative paths even\n  when creating the docker path. This prevents leaking of information on the\n  invoker's system to the remote system. Doing this requires a number of path\n  substitutions denoted with the _<rewrite>_ convention.\n\n  >>> Func('./../upper_dir/')[1]\n  'file/_dotdot_/upper_dir/'\n  >>> Func('~/localdata/*.bam')[1]\n  'file/_home_/localdata/*.bam'\n\n  Args:\n    raw_uri: (str) the raw file or directory path.\n\n  Returns:\n    normalized: a simplified and/or expanded version of the uri.\n    docker_path: the uri rewritten in the format required for mounting inside\n                 a docker worker.\n\n  \"\"\"\n  # The path is split into components so that the filename is not rewritten.\n  arg_1, arg_2 = os.path.split(arg_0)\n  # Generate the local path that can be resolved by filesystem operations,\n  # this removes special shell characters, condenses indirects and replaces\n  # any unnecessary prefix.\n  arg_3 = [('file:///', '/'), ('~/', os.getenv('HOME')), ('./',\n                                                                        ''),\n                         ('file:/', '/')]\n  arg_4 = arg_1\n  for arg_5, arg_6 in arg_3:\n    if arg_4.startswith(arg_5):\n      arg_4 = os.path.join(arg_6, arg_4[len(arg_5):])\n  # Because abspath strips the trailing '/' from bare directory references\n  # other than root, this ensures that all directory references end with '/'.\n  arg_7 = directory_fmt(os.path.abspath(arg_4))\n  arg_7 = os.path.join(arg_7, arg_2)\n\n  # Generate the path used inside the docker image;\n  #  1) Get rid of extra indirects: /this/./that -> /this/that\n  #  2) Rewrite required indirects as synthetic characters.\n  #  3) Strip relative or absolute path leading character.\n  #  4) Add 'file/' prefix.\n  arg_8 = [(r'/\\.\\.', '/_dotdot_'), (r'^\\.\\.', '_dotdot_'),\n                     (r'^~/', '_home_/'), (r'^file:/', '')]\n  arg_9 = os.path.normpath(arg_1)\n  for arg_10, arg_6 in arg_8:\n    arg_9 = re.sub(arg_10, arg_6, arg_9)\n  arg_9 = arg_9.lstrip('./')  # Strips any of '.' './' '/'.\n  arg_9 = directory_fmt('file/' + arg_9) + arg_2\n  return arg_7, arg_9", "path": "dsub/lib/param_util.py", "identifier": "_local_uri_rewriter", "docstring": "Rewrite local file URIs as required by the rewrite_uris method.\n\n  Local file paths, unlike GCS paths, may have their raw URI simplified by\n  os.path.normpath which collapses extraneous indirect characters.\n\n  >>> _local_uri_rewriter('/tmp/a_path/../B_PATH/file.txt')\n  ('/tmp/B_PATH/file.txt', 'file/tmp/B_PATH/file.txt')\n  >>> _local_uri_rewriter('/myhome/./mydir/')\n  ('/myhome/mydir/', 'file/myhome/mydir/')\n\n  The local path rewriter will also work to preserve relative paths even\n  when creating the docker path. This prevents leaking of information on the\n  invoker's system to the remote system. Doing this requires a number of path\n  substitutions denoted with the _<rewrite>_ convention.\n\n  >>> _local_uri_rewriter('./../upper_dir/')[1]\n  'file/_dotdot_/upper_dir/'\n  >>> _local_uri_rewriter('~/localdata/*.bam')[1]\n  'file/_home_/localdata/*.bam'\n\n  Args:\n    raw_uri: (str) the raw file or directory path.\n\n  Returns:\n    normalized: a simplified and/or expanded version of the uri.\n    docker_path: the uri rewritten in the format required for mounting inside\n                 a docker worker.", "docstring_tokens": ["Rewrite", "local", "file", "URIs", "as", "required", "by", "the", "rewrite_uris", "method", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 252680}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L545-L589", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Supply a file name for the class object.", "language": "python", "parameters": "(self,filename=None,ext=None,set_default=False,use_my_ext=False)", "return_statement": "return filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "if", "Func", "is", "None", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'_filename'", ")", ":", "arg_0", ".", "_filename", "=", "None", "if", "arg_0", ".", "_filename", ":", "Func", "=", "arg_0", ".", "_filename", "else", ":", "raise", "ValueError", "(", "\"A file name is required because no default file name was defined.\"", ")", "arg_6", "=", "None", "else", ":", "Func", ",", "arg_6", "=", "os", ".", "path", ".", "splitext", "(", "Func", ")", "if", "arg_3", ":", "arg_0", ".", "_filename", "=", "Func", "if", "arg_6", "and", "arg_4", ":", "arg_2", "=", "arg_6", "if", "arg_2", "is", "not", "None", ":", "if", "arg_2", ".", "startswith", "(", "os", ".", "extsep", ")", ":", "arg_2", "=", "arg_2", "[", "1", ":", "]", "if", "arg_2", "!=", "\"\"", ":", "Func", "=", "Func", "+", "os", ".", "extsep", "+", "arg_2", "return", "Func"], "function": "def Func(arg_0,Func=None,arg_2=None,arg_3=False,arg_4=False):\n        \"\"\"Supply a file name for the class object.\n\n        Typical uses::\n\n           fn = filename()             ---> <default_filename>\n           fn = filename('name.ext')   ---> 'name'\n           fn = filename(ext='pickle') ---> <default_filename>'.pickle'\n           fn = filename('name.inp','pdf') --> 'name.pdf'\n           fn = filename('foo.pdf',ext='png',use_my_ext=True) --> 'foo.pdf'\n\n        The returned filename is stripped of the extension\n        (``use_my_ext=False``) and if provided, another extension is\n        appended. Chooses a default if no filename is given.\n\n        Raises a ``ValueError`` exception if no default file name is known.\n\n        If ``set_default=True`` then the default filename is also set.\n\n        ``use_my_ext=True`` lets the suffix of a provided filename take\n        priority over a default ``ext`` tension.\n\n        .. versionchanged:: 0.3.1\n           An empty string as *ext* = \"\" will suppress appending an extension.\n        \"\"\"\n        if Func is None:\n            if not hasattr(arg_0,'_filename'):\n                arg_0._filename = None        # add attribute to class\n            if arg_0._filename:\n                Func = arg_0._filename\n            else:\n                raise ValueError(\"A file name is required because no default file name was defined.\")\n            arg_6 = None\n        else:\n            Func, arg_6 = os.path.splitext(Func)\n            if arg_3:                  # replaces existing default file name\n                arg_0._filename = Func\n        if arg_6 and arg_4:\n            arg_2 = arg_6\n        if arg_2 is not None:\n            if arg_2.startswith(os.extsep):\n                arg_2 = arg_2[1:]  # strip a dot to avoid annoying mistakes\n            if arg_2 != \"\":\n                Func = Func + os.extsep + arg_2\n        return Func", "path": "gromacs/utilities.py", "identifier": "FileUtils.filename", "docstring": "Supply a file name for the class object.\n\n        Typical uses::\n\n           fn = filename()             ---> <default_filename>\n           fn = filename('name.ext')   ---> 'name'\n           fn = filename(ext='pickle') ---> <default_filename>'.pickle'\n           fn = filename('name.inp','pdf') --> 'name.pdf'\n           fn = filename('foo.pdf',ext='png',use_my_ext=True) --> 'foo.pdf'\n\n        The returned filename is stripped of the extension\n        (``use_my_ext=False``) and if provided, another extension is\n        appended. Chooses a default if no filename is given.\n\n        Raises a ``ValueError`` exception if no default file name is known.\n\n        If ``set_default=True`` then the default filename is also set.\n\n        ``use_my_ext=True`` lets the suffix of a provided filename take\n        priority over a default ``ext`` tension.\n\n        .. versionchanged:: 0.3.1\n           An empty string as *ext* = \"\" will suppress appending an extension.", "docstring_tokens": ["Supply", "a", "file", "name", "for", "the", "class", "object", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 252681}
{"url": "https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L243-L256", "sha": "986c4b1315d6b128947c3bc3494513d8e5380ff0", "docstring_summary": "Provides a connection string for database.", "language": "python", "parameters": "(self, name=None)", "return_statement": "return ' '.join(\"%s=%s\" % (param, value) for param, value in self._connect_options(name))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "' '", ".", "join", "(", "\"%s=%s\"", "%", "(", "arg_2", ",", "arg_3", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "_connect_options", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Provides a connection string for database.\n\n        Parameters\n        ----------\n        name: str, optional\n            an override database name for the connection string.\n\n        Returns\n        -------\n        str: the connection string (e.g. 'dbname=db1 user=user1 host=localhost port=5432')\n        \"\"\"\n        return ' '.join(\"%s=%s\" % (arg_2, arg_3) for arg_2, arg_3 in arg_0._connect_options(arg_1))", "path": "pydba/postgres.py", "identifier": "PostgresDB.connection_dsn", "docstring": "Provides a connection string for database.\n\n        Parameters\n        ----------\n        name: str, optional\n            an override database name for the connection string.\n\n        Returns\n        -------\n        str: the connection string (e.g. 'dbname=db1 user=user1 host=localhost port=5432')", "docstring_tokens": ["Provides", "a", "connection", "string", "for", "database", "."], "nwo": "drkjam/pydba", "score": 0.138843686048881, "idx": 252682}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/word_embedding.py#L17-L27", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Find synonyms using a word2vec model.", "language": "python", "parameters": "(self, word, count=20)", "return_statement": "return OrderedDict(sorted(zip(j['synonyms'], j['scores']), key=lambda t: t[1], reverse=True))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "20", ")", ":", "arg_3", "=", "h2o", ".", "api", "(", "\"GET /3/Word2VecSynonyms\"", ",", "data", "=", "{", "'model'", ":", "arg_0", ".", "model_id", ",", "'word'", ":", "arg_1", ",", "'count'", ":", "arg_2", "}", ")", "return", "OrderedDict", "(", "sorted", "(", "zip", "(", "arg_3", "[", "'synonyms'", "]", ",", "arg_3", "[", "'scores'", "]", ")", ",", "key", "=", "lambda", "t", ":", "t", "[", "1", "]", ",", "reverse", "=", "True", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=20):\n        \"\"\"\n        Find synonyms using a word2vec model.\n\n        :param str word: A single word to find synonyms for.\n        :param int count: The first \"count\" synonyms will be returned.\n\n        :returns: the approximate reconstruction of the training data.\n        \"\"\"\n        arg_3 = h2o.api(\"GET /3/Word2VecSynonyms\", data={'model': arg_0.model_id, 'word': arg_1, 'count': arg_2})\n        return OrderedDict(sorted(zip(arg_3['synonyms'], arg_3['scores']), key=lambda t: t[1], reverse=True))", "path": "h2o-py/h2o/model/word_embedding.py", "identifier": "H2OWordEmbeddingModel.find_synonyms", "docstring": "Find synonyms using a word2vec model.\n\n        :param str word: A single word to find synonyms for.\n        :param int count: The first \"count\" synonyms will be returned.\n\n        :returns: the approximate reconstruction of the training data.", "docstring_tokens": ["Find", "synonyms", "using", "a", "word2vec", "model", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252683}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/indexing/standard.py#L139-L146", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "repeated membrane tests, likely with drug added. Maybe IPSCs.", "language": "python", "parameters": "(abf=exampleABF)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ")", ":", "standard_inspect", "(", "arg_0", ")", "swhlab", ".", "memtest", ".", "memtest", "(", "arg_0", ")", "swhlab", ".", "memtest", ".", "checkSweep", "(", "arg_0", ")", "swhlab", ".", "plot", ".", "save", "(", "arg_0", ",", "tag", "=", "'check'", ",", "resize", "=", "False", ")", "swhlab", ".", "memtest", ".", "plot_standard4", "(", "arg_0", ")", "swhlab", ".", "plot", ".", "save", "(", "arg_0", ",", "tag", "=", "'memtests'", ")"], "function": "def Func(arg_0=arg_1):\n    \"\"\"repeated membrane tests, likely with drug added. Maybe IPSCs.\"\"\"\n    standard_inspect(arg_0)\n    swhlab.memtest.memtest(arg_0)\n    swhlab.memtest.checkSweep(arg_0)\n    swhlab.plot.save(arg_0,tag='check',resize=False)\n    swhlab.memtest.plot_standard4(arg_0)\n    swhlab.plot.save(arg_0,tag='memtests')", "path": "doc/oldcode/indexing/standard.py", "identifier": "proto_04_01_MTmon70s2", "docstring": "repeated membrane tests, likely with drug added. Maybe IPSCs.", "docstring_tokens": ["repeated", "membrane", "tests", "likely", "with", "drug", "added", ".", "Maybe", "IPSCs", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 252684}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/lib.py#L209-L230", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Maintain selection during context", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "cmds", ".", "ls", "(", "selection", "=", "True", ")", "try", ":", "yield", "finally", ":", "if", "arg_0", ":", "cmds", ".", "select", "(", "arg_0", ",", "replace", "=", "True", ",", "noExpand", "=", "True", ")", "else", ":", "cmds", ".", "select", "(", "deselect", "=", "True", ",", "noExpand", "=", "True", ")"], "function": "def Func():\n    \"\"\"Maintain selection during context\n\n    Example:\n        >>> with Func():\n        ...     # Modify selection\n        ...     cmds.select('node', replace=True)\n        >>> # Selection restored\n\n    \"\"\"\n\n    arg_0 = cmds.ls(selection=True)\n    try:\n        yield\n    finally:\n        if arg_0:\n            cmds.select(arg_0,\n                        replace=True,\n                        noExpand=True)\n        else:\n            cmds.select(deselect=True,\n                        noExpand=True)", "path": "pyblish_maya/lib.py", "identifier": "maintained_selection", "docstring": "Maintain selection during context\n\n    Example:\n        >>> with maintained_selection():\n        ...     # Modify selection\n        ...     cmds.select('node', replace=True)\n        >>> # Selection restored", "docstring_tokens": ["Maintain", "selection", "during", "context"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 252685}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L1021-L1064", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "waits on one or more `jobs`, for up to `timeout` seconds.", "language": "python", "parameters": "(self, jobs=None, timeout=-1)", "return_statement": "return len(theids.intersection(self.outstanding)) == 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "-", "1", ")", ":", "arg_3", "=", "time", ".", "time", "(", ")", "if", "arg_1", "is", "None", ":", "arg_4", "=", "arg_0", ".", "outstanding", "else", ":", "if", "isinstance", "(", "arg_1", ",", "(", "int", ",", "basestring", ",", "AsyncResult", ")", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_4", "=", "set", "(", ")", "for", "arg_5", "in", "arg_1", ":", "if", "isinstance", "(", "arg_5", ",", "int", ")", ":", "arg_5", "=", "arg_0", ".", "history", "[", "arg_5", "]", "elif", "isinstance", "(", "arg_5", ",", "AsyncResult", ")", ":", "map", "(", "arg_4", ".", "add", ",", "arg_5", ".", "msg_ids", ")", "continue", "arg_4", ".", "add", "(", "arg_5", ")", "if", "not", "arg_4", ".", "intersection", "(", "arg_0", ".", "outstanding", ")", ":", "return", "True", "arg_0", ".", "spin", "(", ")", "while", "arg_4", ".", "intersection", "(", "arg_0", ".", "outstanding", ")", ":", "if", "arg_2", ">=", "0", "and", "(", "time", ".", "time", "(", ")", "-", "arg_3", ")", ">", "arg_2", ":", "break", "time", ".", "sleep", "(", "1e-3", ")", "arg_0", ".", "spin", "(", ")", "return", "len", "(", "arg_4", ".", "intersection", "(", "arg_0", ".", "outstanding", ")", ")", "==", "0"], "function": "def Func(arg_0, arg_1=None, arg_2=-1):\n        \"\"\"Funcs on one or more `jobs`, for up to `timeout` seconds.\n\n        Parameters\n        ----------\n\n        jobs : int, str, or list of ints and/or strs, or one or more AsyncResult objects\n                ints are indices to self.history\n                strs are msg_ids\n                default: Func on all outstanding messages\n        timeout : float\n                a time in seconds, after which to give up.\n                default is -1, which means no timeout\n\n        Returns\n        -------\n\n        True : when all msg_ids are done\n        False : timeout reached, some msg_ids still outstanding\n        \"\"\"\n        arg_3 = time.time()\n        if arg_1 is None:\n            arg_4 = arg_0.outstanding\n        else:\n            if isinstance(arg_1, (int, basestring, AsyncResult)):\n                arg_1 = [arg_1]\n            arg_4 = set()\n            for arg_5 in arg_1:\n                if isinstance(arg_5, int):\n                    # index access\n                    arg_5 = arg_0.history[arg_5]\n                elif isinstance(arg_5, AsyncResult):\n                    map(arg_4.add, arg_5.msg_ids)\n                    continue\n                arg_4.add(arg_5)\n        if not arg_4.intersection(arg_0.outstanding):\n            return True\n        arg_0.spin()\n        while arg_4.intersection(arg_0.outstanding):\n            if arg_2 >= 0 and ( time.time()-arg_3 ) > arg_2:\n                break\n            time.sleep(1e-3)\n            arg_0.spin()\n        return len(arg_4.intersection(arg_0.outstanding)) == 0", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client.wait", "docstring": "waits on one or more `jobs`, for up to `timeout` seconds.\n\n        Parameters\n        ----------\n\n        jobs : int, str, or list of ints and/or strs, or one or more AsyncResult objects\n                ints are indices to self.history\n                strs are msg_ids\n                default: wait on all outstanding messages\n        timeout : float\n                a time in seconds, after which to give up.\n                default is -1, which means no timeout\n\n        Returns\n        -------\n\n        True : when all msg_ids are done\n        False : timeout reached, some msg_ids still outstanding", "docstring_tokens": ["waits", "on", "one", "or", "more", "jobs", "for", "up", "to", "timeout", "seconds", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252686}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/cluster.py#L110-L125", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the largest possible clique for the node with given id.", "language": "python", "parameters": "(graph, id)", "return_statement": "return clique", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "Func", "=", "[", "arg_1", "]", "for", "arg_3", "in", "arg_0", ".", "nodes", ":", "arg_4", "=", "True", "for", "arg_1", "in", "Func", ":", "if", "arg_3", ".", "id", "==", "arg_1", "or", "arg_0", ".", "edge", "(", "arg_3", ".", "id", ",", "arg_1", ")", "==", "None", ":", "arg_4", "=", "False", "break", "if", "arg_4", ":", "Func", ".", "append", "(", "arg_3", ".", "id", ")", "return", "Func"], "function": "def Func(arg_0, arg_1):\n    \n    \"\"\" Returns the largest possible clique for the node with given id.\n    \"\"\"\n    \n    Func = [arg_1]\n    for arg_3 in arg_0.nodes:\n        arg_4 = True\n        for arg_1 in Func:\n            if arg_3.id == arg_1 or arg_0.edge(arg_3.id, arg_1) == None:\n                arg_4 = False\n                break\n        if arg_4:\n            Func.append(arg_3.id)\n    \n    return Func", "path": "lib/graph/cluster.py", "identifier": "clique", "docstring": "Returns the largest possible clique for the node with given id.", "docstring_tokens": ["Returns", "the", "largest", "possible", "clique", "for", "the", "node", "with", "given", "id", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252687}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/meta.py#L189-L204", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Attach a class to a parsing class and register it as a parser directive.", "language": "python", "parameters": "(directname=None)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "global", "_Funcs", "arg_1", "=", "_Funcs", "def", "wrapper", "(", "arg_2", ")", ":", "nonlocal", "arg_0", "if", "arg_0", "is", "None", ":", "arg_0", "=", "arg_2", ".", "__name__", "arg_2", ".", "ns_name", "=", "arg_0", "set_one", "(", "arg_1", ",", "arg_0", ",", "arg_2", ")", "return", "arg_2", "return", "wrapper"], "function": "def Func(arg_0=None):\n    \"\"\"Attach a class to a parsing class and register it as a parser Func.\n\n        The class is registered with its name unless directname is provided.\n    \"\"\"\n    global _Funcs\n    arg_1 = _Funcs\n\n    def wrapper(arg_2):\n        nonlocal arg_0\n        if arg_0 is None:\n            arg_0 = arg_2.__name__\n        arg_2.ns_name = arg_0\n        set_one(arg_1, arg_0, arg_2)\n        return arg_2\n    return wrapper", "path": "pyrser/meta.py", "identifier": "directive", "docstring": "Attach a class to a parsing class and register it as a parser directive.\n\n        The class is registered with its name unless directname is provided.", "docstring_tokens": ["Attach", "a", "class", "to", "a", "parsing", "class", "and", "register", "it", "as", "a", "parser", "directive", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 252688}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/layers/distribution_layer.py#L65-L86", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes the number of elements in a tensor with shape `event_shape`.", "language": "python", "parameters": "(event_shape, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_1", ",", "'event_size'", ",", "[", "arg_0", "]", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "dtype", "=", "tf", ".", "int32", ",", "arg_1", "=", "'event_shape'", ")", "arg_2", "=", "tf", ".", "get_static_value", "(", "arg_0", ")", "if", "arg_2", "is", "not", "None", ":", "return", "np", ".", "prod", "(", "arg_2", ")", "else", ":", "return", "tf", ".", "reduce_prod", "(", "input_tensor", "=", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"Computes the number of elements in a tensor with shape `event_shape`.\n\n  Args:\n    event_shape: A tensor shape.\n    name: The name to use for the tensor op to compute the number of elements\n      (if such an op needs to be created).\n\n  Returns:\n    event_size: The number of elements in `tensor_shape`.  Returns a numpy int\n    when the number of elements can be computed immediately.  Otherwise, returns\n    a scalar tensor.\n  \"\"\"\n  with tf.compat.v1.name_scope(arg_1, 'event_size', [arg_0]):\n    arg_0 = tf.convert_to_tensor(\n        value=arg_0, dtype=tf.int32, arg_1='event_shape')\n\n    arg_2 = tf.get_static_value(arg_0)\n    if arg_2 is not None:\n      return np.prod(arg_2)\n    else:\n      return tf.reduce_prod(input_tensor=arg_0)", "path": "tensorflow_probability/python/layers/distribution_layer.py", "identifier": "_event_size", "docstring": "Computes the number of elements in a tensor with shape `event_shape`.\n\n  Args:\n    event_shape: A tensor shape.\n    name: The name to use for the tensor op to compute the number of elements\n      (if such an op needs to be created).\n\n  Returns:\n    event_size: The number of elements in `tensor_shape`.  Returns a numpy int\n    when the number of elements can be computed immediately.  Otherwise, returns\n    a scalar tensor.", "docstring_tokens": ["Computes", "the", "number", "of", "elements", "in", "a", "tensor", "with", "shape", "event_shape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252689}
{"url": "https://github.com/zinic/pynsive/blob/15bc8b35a91be5817979eb327427b6235b1b411e/pynsive/reflection.py#L220-L240", "sha": "15bc8b35a91be5817979eb327427b6235b1b411e", "docstring_summary": "Attempts to list all of the classes within a given module namespace.\n    This method, unlike list_classes, will recurse into discovered\n    submodules.", "language": "python", "parameters": "(module, cls_filter=None)", "return_statement": "return found", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "list", "(", ")", "arg_3", "=", "rlist_modules", "(", "arg_0", ")", "for", "arg_4", "in", "arg_3", ":", "[", "arg_2", ".", "append", "(", "arg_5", ")", "for", "arg_5", "in", "list_classes", "(", "arg_4", ",", "arg_1", ")", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Attempts to list all of the classes within a given module namespace.\n    This method, unlike list_classes, will recurse into discovered\n    submodules.\n\n    If a type filter is set, it will be called with each class as its\n    parameter. This filter's return value must be interpretable as a\n    boolean. Results that evaluate as True will include the type in the\n    list of returned classes. Results that evaluate as False will exclude\n    the type in the list of returned classes.\n\n    :param mname: of the module to descend into\n    :param cls_filter: a function to call to determine what classes should be\n                included.\n    \"\"\"\n    arg_2 = list()\n    arg_3 = rlist_modules(arg_0)\n    for arg_4 in arg_3:\n        [arg_2.append(arg_5) for arg_5 in list_classes(arg_4, arg_1)]\n    return arg_2", "path": "pynsive/reflection.py", "identifier": "rlist_classes", "docstring": "Attempts to list all of the classes within a given module namespace.\n    This method, unlike list_classes, will recurse into discovered\n    submodules.\n\n    If a type filter is set, it will be called with each class as its\n    parameter. This filter's return value must be interpretable as a\n    boolean. Results that evaluate as True will include the type in the\n    list of returned classes. Results that evaluate as False will exclude\n    the type in the list of returned classes.\n\n    :param mname: of the module to descend into\n    :param cls_filter: a function to call to determine what classes should be\n                included.", "docstring_tokens": ["Attempts", "to", "list", "all", "of", "the", "classes", "within", "a", "given", "module", "namespace", ".", "This", "method", "unlike", "list_classes", "will", "recurse", "into", "discovered", "submodules", "."], "nwo": "zinic/pynsive", "score": 0.23137166388621372, "idx": 252690}
{"url": "https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L95-L98", "sha": "6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851", "docstring_summary": "Writes `self.cfg` to `self.config_file`.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ".", "config_file", ",", "\"w\"", ")", "as", "config_file", ":", "arg_0", ".", "cfg", ".", "write", "(", "config_file", ")"], "function": "def Func(arg_0):\n        \"\"\"Writes `self.cfg` to `self.config_file`.\"\"\"\n        with open(arg_0.config_file, \"w\") as config_file:\n            arg_0.cfg.write(config_file)", "path": "twtxt/config.py", "identifier": "Config.write_config", "docstring": "Writes `self.cfg` to `self.config_file`.", "docstring_tokens": ["Writes", "self", ".", "cfg", "to", "self", ".", "config_file", "."], "nwo": "buckket/twtxt", "score": 0.5783854231140674, "idx": 252691}
{"url": "https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L659-L696", "sha": "ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e", "docstring_summary": "Enumerate the keys found at any scope for the current plugin.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "try", ":", "for", "arg_2", "in", "arg_0", ".", "idb", ".", "Func", "(", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "yield", "arg_2", "arg_1", ".", "add", "(", "arg_2", ")", "except", "(", "PermissionError", ",", "EnvironmentError", ")", ":", "pass", "try", ":", "for", "arg_2", "in", "arg_0", ".", "directory", ".", "Func", "(", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "yield", "arg_2", "arg_1", ".", "add", "(", "arg_2", ")", "except", "(", "PermissionError", ",", "EnvironmentError", ")", ":", "pass", "try", ":", "for", "arg_2", "in", "arg_0", ".", "user", ".", "Func", "(", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "yield", "arg_2", "arg_1", ".", "add", "(", "arg_2", ")", "except", "(", "PermissionError", ",", "EnvironmentError", ")", ":", "pass", "try", ":", "for", "arg_2", "in", "arg_0", ".", "system", ".", "Func", "(", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "yield", "arg_2", "arg_1", ".", "add", "(", "arg_2", ")", "except", "(", "PermissionError", ",", "EnvironmentError", ")", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"\n        Enumerate the keys found at any scope for the current plugin.\n\n        rtype: Generator[str]\n        \"\"\"\n        arg_1 = set()\n        try:\n            for arg_2 in arg_0.idb.Func():\n                if arg_2 not in arg_1:\n                    yield arg_2\n                    arg_1.add(arg_2)\n        except (PermissionError, EnvironmentError):\n            pass\n\n        try:\n            for arg_2 in arg_0.directory.Func():\n                if arg_2 not in arg_1:\n                    yield arg_2\n                    arg_1.add(arg_2)\n        except (PermissionError, EnvironmentError):\n            pass\n\n        try:\n            for arg_2 in arg_0.user.Func():\n                if arg_2 not in arg_1:\n                    yield arg_2\n                    arg_1.add(arg_2)\n        except (PermissionError, EnvironmentError):\n            pass\n\n        try:\n            for arg_2 in arg_0.system.Func():\n                if arg_2 not in arg_1:\n                    yield arg_2\n                    arg_1.add(arg_2)\n        except (PermissionError, EnvironmentError):\n            pass", "path": "ida_settings/ida_settings.py", "identifier": "IDASettings.iterkeys", "docstring": "Enumerate the keys found at any scope for the current plugin.\n\n        rtype: Generator[str]", "docstring_tokens": ["Enumerate", "the", "keys", "found", "at", "any", "scope", "for", "the", "current", "plugin", "."], "nwo": "williballenthin/ida-settings", "score": 0.18657722465184873, "idx": 252692}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/common.py#L576-L592", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Call API in PythonBigDL", "language": "python", "parameters": "(bigdl_type, name, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "arg_3", "=", "_get_gateway", "(", ")", "arg_4", "=", "Exception", "(", "\"Cannot find function: %s\"", "%", "arg_1", ")", "for", "arg_5", "in", "JavaCreator", ".", "instance", "(", "arg_0", ",", "arg_3", ")", ".", "value", ":", "try", ":", "arg_6", "=", "getattr", "(", "arg_5", ",", "arg_1", ")", "arg_7", "=", "callJavaFunc", "(", "arg_6", ",", "*", "arg_2", ")", "except", "Exception", "as", "e", ":", "arg_4", "=", "e", "if", "\"does not exist\"", "not", "in", "str", "(", "e", ")", ":", "raise", "e", "else", ":", "return", "arg_7", "raise", "arg_4"], "function": "def Func(arg_0, arg_1, *arg_2):\n    \"\"\" Call API in PythonBigDL \"\"\"\n    arg_3 = _get_gateway()\n    arg_4 = Exception(\"Cannot find function: %s\" % arg_1)\n    for arg_5 in JavaCreator.instance(arg_0, arg_3).value:\n        # hasattr(jinvoker, name) always return true here,\n        # so you need to invoke the method to check if it exist or not\n        try:\n            arg_6 = getattr(arg_5, arg_1)\n            arg_7 = callJavaFunc(arg_6, *arg_2)\n        except Exception as e:\n            arg_4 = e\n            if \"does not exist\" not in str(e):\n                raise e\n        else:\n            return arg_7\n    raise arg_4", "path": "pyspark/bigdl/util/common.py", "identifier": "callBigDlFunc", "docstring": "Call API in PythonBigDL", "docstring_tokens": ["Call", "API", "in", "PythonBigDL"], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 252693}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/classify.py#L212-L248", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Wrapper for scikit-learn classification functions\n    Imlements various types of classification and cross validation", "language": "python", "parameters": "(X, y, clf_method='ERF', classifier=None, output='summary_clf',\n             cross_val=None, class_weight=None, regularization=None,\n             param_grid=None, scoring='accuracy', refit_all=True,\n             feat_select=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'ERF'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'summary_clf'", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "'accuracy'", ",", "arg_10", "=", "True", ",", "arg_11", "=", "None", ")", ":", "arg_12", "=", "Classifier", "(", "arg_2", ",", "arg_3", ",", "arg_8", ")", "if", "arg_5", "is", "not", "None", ":", "arg_13", "=", "arg_12", ".", "cross_val_fit", "(", "arg_0", ",", "arg_1", ",", "arg_5", ",", "arg_9", "=", "arg_9", ",", "arg_11", "=", "arg_11", ",", "arg_6", "=", "arg_6", ")", "else", ":", "arg_13", "=", "arg_12", ".", "fit", "(", "arg_0", ",", "arg_1", ",", "arg_6", "=", "arg_6", ")", ".", "score", "(", "arg_0", ",", "arg_1", ")", "from", "collections", "import", "Counter", "if", "arg_4", "==", "'clf'", ":", "return", "arg_12", "else", ":", "if", "arg_4", "==", "'summary'", ":", "arg_4", "=", "{", "'score'", ":", "arg_13", ",", "'n'", ":", "dict", "(", "Counter", "(", "arg_1", ")", ")", "}", "elif", "arg_4", "==", "'summary_clf'", ":", "arg_4", "=", "{", "'score'", ":", "arg_13", ",", "'n'", ":", "dict", "(", "Counter", "(", "arg_1", ")", ")", ",", "'clf'", ":", "arg_12", ",", "'features_selected'", ":", "arg_12", ".", "features_selected", ",", "'predictions'", ":", "arg_12", ".", "predictions", "}", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2='ERF', arg_3=None, arg_4='summary_clf',\n             arg_5=None, arg_6=None, arg_7=None,\n             arg_8=None, arg_9='accuracy', arg_10=True,\n             arg_11=None):\n    \"\"\" Wrapper for scikit-learn classification functions\n    Imlements various types of classification and cross validation \"\"\"\n\n    # Build classifier\n    arg_12 = Classifier(arg_2, arg_3, arg_8)\n\n    # Fit & test model with or without cross-validation\n    if arg_5 is not None:\n        arg_13 = arg_12.cross_val_fit(arg_0, arg_1, arg_5, arg_9=arg_9,\n                                  arg_11=arg_11,\n                                  arg_6=arg_6)\n    else:\n        # Does not support scoring function\n        arg_13 = arg_12.fit(arg_0, arg_1, arg_6=arg_6).score(arg_0, arg_1)\n\n    # Return some stuff...\n    from collections import Counter\n\n    if arg_4 == 'clf':\n        return arg_12\n    else:\n        if arg_4 == 'summary':\n            arg_4 = {'score': arg_13, 'n': dict(Counter(arg_1))}\n        elif arg_4 == 'summary_clf':\n            arg_4 = {\n                'score': arg_13,\n                'n': dict(Counter(arg_1)),\n                'clf': arg_12,\n                'features_selected': arg_12.features_selected,\n                'predictions': arg_12.predictions\n            }\n\n        return arg_4", "path": "neurosynth/analysis/classify.py", "identifier": "classify", "docstring": "Wrapper for scikit-learn classification functions\n    Imlements various types of classification and cross validation", "docstring_tokens": ["Wrapper", "for", "scikit", "-", "learn", "classification", "functions", "Imlements", "various", "types", "of", "classification", "and", "cross", "validation"], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 252694}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/scheduler.py#L117-L134", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Schedule a job in the given queue.", "language": "python", "parameters": "(self, queue_id, task_id, job_args, delay=0)", "return_statement": "return job_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "arg_0", ".", "_rwlock", ".", "writer_acquire", "(", ")", "arg_5", "=", "arg_0", ".", "_generate_job_id", "(", "arg_2", ")", "arg_6", "=", "arg_0", ".", "_scheduler", ".", "enter", "(", "arg_4", ",", "1", ",", "arg_0", ".", "_enqueue_job", ",", "argument", "=", "(", "arg_1", ",", "arg_5", ",", "arg_3", ",", ")", ")", "arg_0", ".", "_jobs", "[", "arg_5", "]", "=", "arg_6", "arg_0", ".", "_tasks", "[", "arg_2", "]", "=", "arg_5", "arg_0", ".", "_rwlock", ".", "writer_release", "(", ")", "logging", ".", "debug", "(", "\"Job #%s (task: %s) scheduled on %s (wait: %s)\"", ",", "arg_5", ",", "arg_2", ",", "arg_1", ",", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0):\n        \"\"\"Schedule a job in the given queue.\"\"\"\n\n        arg_0._rwlock.writer_acquire()\n\n        arg_5 = arg_0._generate_job_id(arg_2)\n\n        arg_6 = arg_0._scheduler.enter(arg_4, 1, arg_0._enqueue_job,\n                                      argument=(arg_1, arg_5, arg_3,))\n        arg_0._jobs[arg_5] = arg_6\n        arg_0._tasks[arg_2] = arg_5\n\n        arg_0._rwlock.writer_release()\n\n        logging.debug(\"Job #%s (task: %s) scheduled on %s (wait: %s)\",\n                      arg_5, arg_2, arg_1, arg_4)\n\n        return arg_5", "path": "arthur/scheduler.py", "identifier": "_JobScheduler.schedule_job_task", "docstring": "Schedule a job in the given queue.", "docstring_tokens": ["Schedule", "a", "job", "in", "the", "given", "queue", "."], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 252695}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/check.py#L295-L316", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Printing of img or imgs", "language": "python", "parameters": "(imgs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "string_types", ")", ":", "return", "arg_0", "if", "isinstance", "(", "arg_0", ",", "collections", ".", "Iterable", ")", ":", "return", "'[{}]'", ".", "format", "(", "', '", ".", "join", "(", "Func", "(", "arg_1", ")", "for", "arg_1", "in", "arg_0", ")", ")", "try", ":", "arg_2", "=", "arg_0", ".", "get_filename", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_3", "=", "\"{}('{}')\"", ".", "format", "(", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_2", ")", "else", ":", "arg_3", "=", "\"{}(shape={}, affine={})\"", ".", "format", "(", "arg_0", ".", "__class__", ".", "__name__", ",", "repr", "(", "get_shape", "(", "arg_0", ")", ")", ",", "repr", "(", "arg_0", ".", "get_affine", "(", ")", ")", ")", "except", "Exception", "as", "exc", ":", "log", ".", "error", "(", "'Error reading attributes from img.get_filename()'", ")", "return", "repr", "(", "arg_0", ")", "else", ":", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Printing of img or imgs\"\"\"\n    if isinstance(arg_0, string_types):\n        return arg_0\n\n    if isinstance(arg_0, collections.Iterable):\n        return '[{}]'.format(', '.join(Func(arg_1) for arg_1 in arg_0))\n\n    # try get_filename\n    try:\n        arg_2 = arg_0.get_filename()\n        if arg_2 is not None:\n            arg_3 = \"{}('{}')\".format(arg_0.__class__.__name__, arg_2)\n        else:\n            arg_3 = \"{}(shape={}, affine={})\".format(arg_0.__class__.__name__,\n                                                       repr(get_shape(arg_0)),\n                                                       repr(arg_0.get_affine()))\n    except Exception as exc:\n        log.error('Error reading attributes from img.get_filename()')\n        return repr(arg_0)\n    else:\n        return arg_3", "path": "boyle/nifti/check.py", "identifier": "repr_imgs", "docstring": "Printing of img or imgs", "docstring_tokens": ["Printing", "of", "img", "or", "imgs"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 252696}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenestorage/masterpassword.py#L96-L107", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Decrypt the encrypted masterkey", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "AESCipher", "(", "arg_0", ".", "password", ")", "arg_2", ",", "arg_3", "=", "arg_0", ".", "config", "[", "arg_0", ".", "config_key", "]", ".", "split", "(", "\"$\"", ")", "try", ":", "arg_4", "=", "arg_1", ".", "decrypt", "(", "arg_3", ")", "except", "Exception", ":", "arg_0", ".", "_raise_wrongmasterpassexception", "(", ")", "if", "arg_2", "!=", "arg_0", ".", "_derive_checksum", "(", "arg_4", ")", ":", "arg_0", ".", "_raise_wrongmasterpassexception", "(", ")", "arg_0", ".", "decrypted_master", "=", "arg_4"], "function": "def Func(arg_0):\n        \"\"\" Decrypt the encrypted masterkey\n        \"\"\"\n        arg_1 = AESCipher(arg_0.password)\n        arg_2, arg_3 = arg_0.config[arg_0.config_key].split(\"$\")\n        try:\n            arg_4 = arg_1.decrypt(arg_3)\n        except Exception:\n            arg_0._raise_wrongmasterpassexception()\n        if arg_2 != arg_0._derive_checksum(arg_4):\n            arg_0._raise_wrongmasterpassexception()\n        arg_0.decrypted_master = arg_4", "path": "graphenestorage/masterpassword.py", "identifier": "MasterPassword._decrypt_masterpassword", "docstring": "Decrypt the encrypted masterkey", "docstring_tokens": ["Decrypt", "the", "encrypted", "masterkey"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 252697}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/generation.py#L545-L698", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This generates fake sinusoidal light curves.", "language": "python", "parameters": "(\n        times,\n        mags=None,\n        errs=None,\n        paramdists={\n            'period':sps.uniform(loc=0.04,scale=500.0),\n            'fourierorder':[2,10],\n            'amplitude':sps.uniform(loc=0.1,scale=0.9),\n            'phioffset':0.0,\n        },\n        magsarefluxes=False\n)", "return_statement": "return modeldict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "{", "'period'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "0.04", ",", "arg_7", "=", "500.0", ")", ",", "'fourierorder'", ":", "[", "2", ",", "10", "]", ",", "'amplitude'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "0.1", ",", "arg_7", "=", "0.9", ")", ",", "'phioffset'", ":", "0.0", ",", "}", ",", "arg_8", "=", "False", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "np", ".", "full_like", "(", "arg_0", ",", "0.0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "np", ".", "full_like", "(", "arg_0", ",", "0.0", ")", "arg_9", "=", "npr", ".", "random", "(", ")", "*", "(", "arg_0", ".", "max", "(", ")", "-", "arg_0", ".", "min", "(", ")", ")", "+", "arg_0", ".", "min", "(", ")", "arg_10", "=", "arg_3", "[", "'period'", "]", ".", "rvs", "(", "size", "=", "1", ")", "arg_11", "=", "npr", ".", "randint", "(", "arg_3", "[", "'fourierorder'", "]", "[", "0", "]", ",", "high", "=", "arg_3", "[", "'fourierorder'", "]", "[", "1", "]", ")", "arg_12", "=", "arg_3", "[", "'amplitude'", "]", ".", "rvs", "(", "size", "=", "1", ")", "if", "arg_8", "and", "arg_12", "<", "0.0", ":", "arg_12", "=", "-", "arg_12", "elif", "not", "arg_8", "and", "arg_12", ">", "0.0", ":", "arg_12", "=", "-", "arg_12", "arg_13", "=", "[", "abs", "(", "arg_12", "/", "2.0", ")", "/", "float", "(", "x", ")", "for", "x", "in", "range", "(", "1", ",", "arg_11", "+", "1", ")", "]", "arg_14", "=", "[", "arg_3", "[", "'phioffset'", "]", "*", "float", "(", "x", ")", "for", "x", "in", "range", "(", "1", ",", "arg_11", "+", "1", ")", "]", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", "=", "sinusoidal", ".", "sine_series_sum", "(", "[", "arg_10", ",", "arg_9", ",", "arg_13", ",", "arg_14", "]", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_20", "=", "np", ".", "argsort", "(", "arg_17", ")", "arg_21", "=", "arg_17", "[", "arg_20", "]", "arg_22", "=", "arg_15", "[", "arg_20", "]", "arg_23", "=", "arg_19", "[", "arg_20", "]", "arg_24", "=", "arg_16", "[", "arg_20", "]", "arg_25", "=", "{", "'vartype'", ":", "'sinusoidal'", ",", "'params'", ":", "{", "x", ":", "y", "for", "x", ",", "y", "in", "zip", "(", "[", "'period'", ",", "'epoch'", ",", "'amplitude'", ",", "'fourierorder'", ",", "'fourieramps'", ",", "'fourierphases'", "]", ",", "[", "arg_10", ",", "arg_9", ",", "arg_12", ",", "arg_11", ",", "arg_13", ",", "arg_14", "]", ")", "}", ",", "'times'", ":", "arg_21", ",", "'mags'", ":", "arg_22", ",", "'errs'", ":", "arg_23", ",", "'phase'", ":", "arg_24", ",", "'varperiod'", ":", "arg_10", ",", "'varamplitude'", ":", "arg_12", "}", "return", "arg_25"], "function": "def Func(\n        arg_0,\n        arg_1=None,\n        arg_2=None,\n        arg_3={\n            'period':arg_4.uniform(arg_6=0.04,arg_7=500.0),\n            'fourierorder':[2,10],\n            'amplitude':arg_4.uniform(arg_6=0.1,arg_7=0.9),\n            'phioffset':0.0,\n        },\n        arg_8=False\n):\n    '''This generates fake sinusoidal light curves.\n\n    This can be used for a variety of sinusoidal variables, e.g. RRab, RRc,\n    Cepheids, Miras, etc. The functions that generate these model LCs below\n    implement the following table::\n\n        ## FOURIER PARAMS FOR SINUSOIDAL VARIABLES\n        #\n        # type        fourier           period [days]\n        #             order    dist     limits         dist\n\n        # RRab        8 to 10  uniform  0.45--0.80     uniform\n        # RRc         3 to 6   uniform  0.10--0.40     uniform\n        # HADS        7 to 9   uniform  0.04--0.10     uniform\n        # rotator     2 to 5   uniform  0.80--120.0    uniform\n        # LPV         2 to 5   uniform  250--500.0     uniform\n\n    FIXME: for better model LCs, figure out how scipy.signal.butter works and\n    low-pass filter using scipy.signal.filtfilt.\n\n    Parameters\n    ----------\n\n    times : np.array\n        This is an array of time values that will be used as the time base.\n\n    mags,errs : np.array\n        These arrays will have the model added to them. If either is\n        None, `np.full_like(times, 0.0)` will used as a substitute and the model\n        light curve will be centered around 0.0.\n\n    paramdists : dict\n        This is a dict containing parameter distributions to use for the\n        model params, containing the following keys ::\n\n            {'period', 'fourierorder', 'amplitude', 'phioffset'}\n\n        The values of these keys should all be 'frozen' scipy.stats distribution\n        objects, e.g.:\n\n        https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions\n        The variability epoch will be automatically chosen from a uniform\n        distribution between `times.min()` and `times.max()`.\n\n        The `amplitude` will be flipped automatically as appropriate if\n        `magsarefluxes=True`.\n\n    magsarefluxes : bool\n        If the generated time series is meant to be a flux time-series, set this\n        to True to get the correct sign of variability amplitude.\n\n    Returns\n    -------\n\n    dict\n        A dict of the form below is returned::\n\n            {'vartype': 'sinusoidal',\n             'params': {'period': generated value of period,\n                        'epoch': generated value of epoch,\n                        'amplitude': generated value of amplitude,\n                        'fourierorder': generated value of fourier order,\n                        'fourieramps': generated values of fourier amplitudes,\n                        'fourierphases': generated values of fourier phases},\n             'times': the model times,\n             'mags': the model mags,\n             'errs': the model errs,\n             'varperiod': the generated period of variability == 'period'\n             'varamplitude': the generated amplitude of\n                             variability == 'amplitude'}\n\n    '''\n\n    if arg_1 is None:\n        arg_1 = np.full_like(arg_0, 0.0)\n\n    if arg_2 is None:\n        arg_2 = np.full_like(arg_0, 0.0)\n\n    # choose the epoch\n    arg_9 = npr.random()*(arg_0.max() - arg_0.min()) + arg_0.min()\n\n    # choose the period, fourierorder, and amplitude\n    arg_10 = arg_3['period'].rvs(size=1)\n    arg_11 = npr.randint(arg_3['fourierorder'][0],\n                               high=arg_3['fourierorder'][1])\n    arg_12 = arg_3['amplitude'].rvs(size=1)\n\n    # fix the amplitude if it needs to be flipped\n    if arg_8 and arg_12 < 0.0:\n        arg_12 = -arg_12\n    elif not arg_8 and arg_12 > 0.0:\n        arg_12 = -arg_12\n\n    # generate the amplitudes and phases of the Fourier components\n    arg_13 = [abs(arg_12/2.0)/float(x)\n                for x in range(1,arg_11+1)]\n    arg_14 = [arg_3['phioffset']*float(x)\n                for x in range(1,arg_11+1)]\n\n    # now that we have our amp and pha components, generate the light curve\n    arg_15, arg_16, arg_17, arg_18, arg_19 = sinusoidal.sine_series_sum(\n        [arg_10, arg_9, arg_13, arg_14],\n        arg_0,\n        arg_1,\n        arg_2\n    )\n\n    # resort in original time order\n    arg_20 = np.argsort(arg_17)\n    arg_21 = arg_17[arg_20]\n    arg_22 = arg_15[arg_20]\n    arg_23 = arg_19[arg_20]\n    arg_24 = arg_16[arg_20]\n\n    # return a dict with everything\n    arg_25 = {\n        'vartype':'sinusoidal',\n        'params':{x:y for x,y in zip(['period',\n                                      'epoch',\n                                      'amplitude',\n                                      'fourierorder',\n                                      'fourieramps',\n                                      'fourierphases'],\n                                     [arg_10,\n                                      arg_9,\n                                      arg_12,\n                                      arg_11,\n                                      arg_13,\n                                      arg_14])},\n        'times':arg_21,\n        'mags':arg_22,\n        'errs':arg_23,\n        'phase':arg_24,\n        # these are standard keys that help with later characterization of\n        # variability as a function period, variability amplitude, object mag,\n        # ndet, etc.\n        'varperiod':arg_10,\n        'varamplitude':arg_12\n    }\n\n    return arg_25", "path": "astrobase/fakelcs/generation.py", "identifier": "generate_sinusoidal_lightcurve", "docstring": "This generates fake sinusoidal light curves.\n\n    This can be used for a variety of sinusoidal variables, e.g. RRab, RRc,\n    Cepheids, Miras, etc. The functions that generate these model LCs below\n    implement the following table::\n\n        ## FOURIER PARAMS FOR SINUSOIDAL VARIABLES\n        #\n        # type        fourier           period [days]\n        #             order    dist     limits         dist\n\n        # RRab        8 to 10  uniform  0.45--0.80     uniform\n        # RRc         3 to 6   uniform  0.10--0.40     uniform\n        # HADS        7 to 9   uniform  0.04--0.10     uniform\n        # rotator     2 to 5   uniform  0.80--120.0    uniform\n        # LPV         2 to 5   uniform  250--500.0     uniform\n\n    FIXME: for better model LCs, figure out how scipy.signal.butter works and\n    low-pass filter using scipy.signal.filtfilt.\n\n    Parameters\n    ----------\n\n    times : np.array\n        This is an array of time values that will be used as the time base.\n\n    mags,errs : np.array\n        These arrays will have the model added to them. If either is\n        None, `np.full_like(times, 0.0)` will used as a substitute and the model\n        light curve will be centered around 0.0.\n\n    paramdists : dict\n        This is a dict containing parameter distributions to use for the\n        model params, containing the following keys ::\n\n            {'period', 'fourierorder', 'amplitude', 'phioffset'}\n\n        The values of these keys should all be 'frozen' scipy.stats distribution\n        objects, e.g.:\n\n        https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions\n        The variability epoch will be automatically chosen from a uniform\n        distribution between `times.min()` and `times.max()`.\n\n        The `amplitude` will be flipped automatically as appropriate if\n        `magsarefluxes=True`.\n\n    magsarefluxes : bool\n        If the generated time series is meant to be a flux time-series, set this\n        to True to get the correct sign of variability amplitude.\n\n    Returns\n    -------\n\n    dict\n        A dict of the form below is returned::\n\n            {'vartype': 'sinusoidal',\n             'params': {'period': generated value of period,\n                        'epoch': generated value of epoch,\n                        'amplitude': generated value of amplitude,\n                        'fourierorder': generated value of fourier order,\n                        'fourieramps': generated values of fourier amplitudes,\n                        'fourierphases': generated values of fourier phases},\n             'times': the model times,\n             'mags': the model mags,\n             'errs': the model errs,\n             'varperiod': the generated period of variability == 'period'\n             'varamplitude': the generated amplitude of\n                             variability == 'amplitude'}", "docstring_tokens": ["This", "generates", "fake", "sinusoidal", "light", "curves", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252698}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L1152-L1156", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Collect Python starred arguments into a Basilisp list.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "ISeq", ":", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "return", "llist", ".", "list", "(", "arg_0", ")", "raise", "TypeError", "(", "\"Python variadic arguments should always be a tuple\"", ")"], "function": "def Func(arg_0) -> ISeq:\n    \"\"\"Collect Python starred arguments into a Basilisp list.\"\"\"\n    if isinstance(arg_0, tuple):\n        return llist.list(arg_0)\n    raise TypeError(\"Python variadic arguments should always be a tuple\")", "path": "src/basilisp/lang/runtime.py", "identifier": "_collect_args", "docstring": "Collect Python starred arguments into a Basilisp list.", "docstring_tokens": ["Collect", "Python", "starred", "arguments", "into", "a", "Basilisp", "list", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252699}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/import_validator.py#L207-L226", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Loads the tables from the gtfs object and counts the number of rows that have null values in\n        fields that should not be null. Stores the number of null rows in warnings_container", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "DB_TABLE_NAMES", ":", "arg_2", "=", "\"Null values in must-have columns in table {table}\"", ".", "format", "(", "arg_1", "=", "arg_1", ")", "arg_3", "=", "\"Null values in good-to-have columns in table {table}\"", ".", "format", "(", "arg_1", "=", "arg_1", ")", "arg_4", "=", "DB_TABLE_NAME_TO_FIELDS_WHERE_NULL_NOT_OK", "[", "arg_1", "]", "arg_5", "=", "DB_TABLE_NAME_TO_FIELDS_WHERE_NULL_OK_BUT_WARN", "[", "arg_1", "]", "arg_6", "=", "arg_0", ".", "gtfs", ".", "get_table", "(", "arg_1", ")", "for", "arg_7", ",", "arg_8", "in", "zip", "(", "[", "arg_2", ",", "arg_3", "]", ",", "[", "arg_4", ",", "arg_5", "]", ")", ":", "arg_9", "=", "arg_6", "[", "arg_8", "]", "arg_10", "=", "arg_9", ".", "isnull", "(", ")", ".", "any", "(", "1", ")", "if", "sum", "(", "arg_10", ")", ">", "0", ":", "arg_11", "=", "arg_6", "[", "arg_10", ".", "values", "]", "arg_0", ".", "warnings_container", ".", "add_warning", "(", "arg_7", ",", "arg_11", ",", "len", "(", "arg_11", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Loads the tables from the gtfs object and counts the number of rows that have null values in\n        fields that should not be null. Stores the number of null rows in warnings_container\n        \"\"\"\n        for arg_1 in DB_TABLE_NAMES:\n            arg_2 = \"Null values in must-have columns in table {table}\".format(arg_1=arg_1)\n            arg_3 = \"Null values in good-to-have columns in table {table}\".format(arg_1=arg_1)\n            arg_4 = DB_TABLE_NAME_TO_FIELDS_WHERE_NULL_NOT_OK[arg_1]\n            arg_5 = DB_TABLE_NAME_TO_FIELDS_WHERE_NULL_OK_BUT_WARN[arg_1]\n\n            # CW, TODO: make this validation source by source\n            arg_6 = arg_0.gtfs.get_table(arg_1)\n\n            for arg_7, arg_8 in zip([arg_2, arg_3], [arg_4, arg_5]):\n                arg_9 = arg_6[arg_8]\n                arg_10 = arg_9.isnull().any(1)\n                if sum(arg_10) > 0:\n                    arg_11 = arg_6[arg_10.values]\n                    arg_0.warnings_container.add_warning(arg_7, arg_11, len(arg_11))", "path": "gtfspy/import_validator.py", "identifier": "ImportValidator._validate_no_null_values", "docstring": "Loads the tables from the gtfs object and counts the number of rows that have null values in\n        fields that should not be null. Stores the number of null rows in warnings_container", "docstring_tokens": ["Loads", "the", "tables", "from", "the", "gtfs", "object", "and", "counts", "the", "number", "of", "rows", "that", "have", "null", "values", "in", "fields", "that", "should", "not", "be", "null", ".", "Stores", "the", "number", "of", "null", "rows", "in", "warnings_container"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 252700}
{"url": "https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/views.py#L136-L205", "sha": "ae92367978f2e1e96634685bd296f0fd92b4da54", "docstring_summary": "Display record view.", "language": "python", "parameters": "(pid_value=None, resolver=None, template=None,\n                permission_factory=None, view_method=None, **kwargs)", "return_statement": "return view_method(pid, record, template=template, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "try", ":", "arg_6", ",", "arg_7", "=", "arg_1", ".", "resolve", "(", "arg_0", ")", "except", "(", "PIDDoesNotExistError", ",", "PIDUnregistered", ")", ":", "abort", "(", "404", ")", "except", "PIDMissingObjectError", "as", "e", ":", "current_app", ".", "logger", ".", "exception", "(", "\"No object assigned to {0}.\"", ".", "format", "(", "e", ".", "pid", ")", ",", "extra", "=", "{", "'pid'", ":", "e", ".", "pid", "}", ")", "abort", "(", "500", ")", "except", "PIDRedirectedError", "as", "e", ":", "try", ":", "return", "redirect", "(", "url_for", "(", "'.{0}'", ".", "format", "(", "e", ".", "destination_pid", ".", "pid_type", ")", ",", "arg_0", "=", "e", ".", "destination_pid", ".", "pid_value", ")", ")", "except", "BuildError", ":", "current_app", ".", "logger", ".", "exception", "(", "\"Invalid redirect - pid_type '{0}' endpoint missing.\"", ".", "format", "(", "e", ".", "destination_pid", ".", "pid_type", ")", ",", "extra", "=", "{", "'pid'", ":", "e", ".", "pid", ",", "'destination_pid'", ":", "e", ".", "destination_pid", ",", "}", ")", "abort", "(", "500", ")", "arg_3", "=", "arg_3", "or", "current_permission_factory", "if", "arg_3", ":", "if", "not", "arg_3", "(", "arg_7", ")", ".", "can", "(", ")", ":", "from", "flask_login", "import", "current_user", "if", "not", "current_user", ".", "is_authenticated", ":", "return", "redirect", "(", "url_for", "(", "current_app", ".", "config", "[", "'RECORDS_UI_LOGIN_ENDPOINT'", "]", ",", "next", "=", "request", ".", "url", ")", ")", "abort", "(", "403", ")", "return", "arg_4", "(", "arg_6", ",", "arg_7", ",", "arg_2", "=", "arg_2", ",", "**", "arg_5", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None,\n                arg_3=None, arg_4=None, **arg_5):\n    \"\"\"Display record view.\n\n    The two parameters ``resolver`` and ``template`` should not be included\n    in the URL rule, but instead set by creating a partially evaluated function\n    of the view.\n\n    The template being rendered is passed two variables in the template\n    context:\n\n    - ``pid``\n    - ``record``.\n\n    Procedure followed:\n\n    #. PID and record are resolved.\n\n    #. Permission are checked.\n\n    #. ``view_method`` is called.\n\n    :param pid_value: Persistent identifier value.\n    :param resolver: An instance of a persistent identifier resolver. A\n        persistent identifier resolver takes care of resolving persistent\n        identifiers into internal objects.\n    :param template: Template to render.\n    :param permission_factory: Permission factory called to check if user has\n        enough power to execute the action.\n    :param view_method: Function that is called.\n    :returns: Tuple (pid object, record object).\n    \"\"\"\n    try:\n        arg_6, arg_7 = arg_1.resolve(arg_0)\n    except (PIDDoesNotExistError, PIDUnregistered):\n        abort(404)\n    except PIDMissingObjectError as e:\n        current_app.logger.exception(\n            \"No object assigned to {0}.\".format(e.pid),\n            extra={'pid': e.pid})\n        abort(500)\n    except PIDRedirectedError as e:\n        try:\n            return redirect(url_for(\n                '.{0}'.format(e.destination_pid.pid_type),\n                arg_0=e.destination_pid.pid_value))\n        except BuildError:\n            current_app.logger.exception(\n                \"Invalid redirect - pid_type '{0}' endpoint missing.\".format(\n                    e.destination_pid.pid_type),\n                extra={\n                    'pid': e.pid,\n                    'destination_pid': e.destination_pid,\n                })\n            abort(500)\n\n    # Check permissions\n    arg_3 = arg_3 or current_permission_factory\n    if arg_3:\n        # Note, cannot be done in one line due to overloading of boolean\n        # operations in permission object.\n        if not arg_3(arg_7).can():\n            from flask_login import current_user\n            if not current_user.is_authenticated:\n                return redirect(url_for(\n                    current_app.config['RECORDS_UI_LOGIN_ENDPOINT'],\n                    next=request.url))\n            abort(403)\n\n    return arg_4(arg_6, arg_7, arg_2=arg_2, **arg_5)", "path": "invenio_records_ui/views.py", "identifier": "record_view", "docstring": "Display record view.\n\n    The two parameters ``resolver`` and ``template`` should not be included\n    in the URL rule, but instead set by creating a partially evaluated function\n    of the view.\n\n    The template being rendered is passed two variables in the template\n    context:\n\n    - ``pid``\n    - ``record``.\n\n    Procedure followed:\n\n    #. PID and record are resolved.\n\n    #. Permission are checked.\n\n    #. ``view_method`` is called.\n\n    :param pid_value: Persistent identifier value.\n    :param resolver: An instance of a persistent identifier resolver. A\n        persistent identifier resolver takes care of resolving persistent\n        identifiers into internal objects.\n    :param template: Template to render.\n    :param permission_factory: Permission factory called to check if user has\n        enough power to execute the action.\n    :param view_method: Function that is called.\n    :returns: Tuple (pid object, record object).", "docstring_tokens": ["Display", "record", "view", "."], "nwo": "inveniosoftware/invenio-records-ui", "score": 0.18439204313697477, "idx": 252701}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L28-L58", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "BACKPORT FROM PYTHON3 FTPLIB.", "language": "python", "parameters": "(conn, path=\"\", facts=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "[", "]", "if", "arg_2", ":", "arg_0", ".", "sendcmd", "(", "\"OPTS MLST \"", "+", "\";\"", ".", "join", "(", "arg_2", ")", "+", "\";\"", ")", "if", "arg_1", ":", "arg_3", "=", "\"MLSD %s\"", "%", "arg_1", "else", ":", "arg_3", "=", "\"MLSD\"", "arg_4", "=", "[", "]", "arg_0", ".", "retrlines", "(", "arg_3", ",", "arg_4", ".", "append", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_5", ".", "rstrip", "(", "ftplib", ".", "CRLF", ")", ".", "partition", "(", "' '", ")", "arg_9", "=", "{", "}", "for", "arg_10", "in", "arg_6", "[", ":", "-", "1", "]", ".", "split", "(", "\";\"", ")", ":", "arg_11", ",", "arg_7", ",", "arg_12", "=", "arg_10", ".", "partition", "(", "\"=\"", ")", "arg_9", "[", "arg_11", ".", "lower", "(", ")", "]", "=", "arg_12", "yield", "(", "arg_8", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1=\"\", arg_2=None):\n    \"\"\"\n    BACKPORT FROM PYTHON3 FTPLIB.\n\n    List a directory in a standardized format by using MLSD\n    command (RFC-3659). If path is omitted the current directory\n    is assumed. \"facts\" is a list of strings representing the type\n    of information desired (e.g. [\"type\", \"size\", \"perm\"]).\n\n    Return a generator object yielding a tuple of two elements\n    for every file found in path.\n    First element is the file name, the second one is a dictionary\n    including a variable number of \"facts\" depending on the server\n    and whether \"facts\" argument has been provided.\n    \"\"\"\n    arg_2 = arg_2 or []\n    if arg_2:\n        arg_0.sendcmd(\"OPTS MLST \" + \";\".join(arg_2) + \";\")\n    if arg_1:\n        arg_3 = \"MLSD %s\" % arg_1\n    else:\n        arg_3 = \"MLSD\"\n    arg_4 = []\n    arg_0.retrlines(arg_3, arg_4.append)\n    for arg_5 in arg_4:\n        arg_6, arg_7, arg_8 = arg_5.rstrip(ftplib.CRLF).partition(' ')\n        arg_9 = {}\n        for arg_10 in arg_6[:-1].split(\";\"):\n            arg_11, arg_7, arg_12 = arg_10.partition(\"=\")\n            arg_9[arg_11.lower()] = arg_12\n        yield (arg_8, arg_9)", "path": "airflow/contrib/hooks/ftp_hook.py", "identifier": "mlsd", "docstring": "BACKPORT FROM PYTHON3 FTPLIB.\n\n    List a directory in a standardized format by using MLSD\n    command (RFC-3659). If path is omitted the current directory\n    is assumed. \"facts\" is a list of strings representing the type\n    of information desired (e.g. [\"type\", \"size\", \"perm\"]).\n\n    Return a generator object yielding a tuple of two elements\n    for every file found in path.\n    First element is the file name, the second one is a dictionary\n    including a variable number of \"facts\" depending on the server\n    and whether \"facts\" argument has been provided.", "docstring_tokens": ["BACKPORT", "FROM", "PYTHON3", "FTPLIB", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252702}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1479-L1502", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "puts stats from pickles into a dictionary", "language": "python", "parameters": "(pfile, handle, statdicts)", "return_statement": "return statdicts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "infile", ":", "arg_3", ",", "arg_4", "=", "pickle", ".", "load", "(", "infile", ")", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_2", "arg_5", "[", "arg_1", "]", "+=", "arg_3", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", "=", "arg_4", "arg_6", ".", "update", "(", "arg_10", ")", "arg_7", ".", "update", "(", "arg_11", ")", "arg_8", ".", "update", "(", "arg_12", ")", "arg_9", ".", "update", "(", "arg_13", ")", "arg_2", "=", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" puts stats from pickles into a dictionary \"\"\"\n\n    ## load in stats\n    with open(arg_0, 'r') as infile:\n        arg_3, arg_4 = pickle.load(infile)\n\n    ## get dicts from statdicts tuple\n    arg_5, arg_6, arg_7, arg_8, arg_9 = arg_2\n\n    ## pull new stats\n    #handle = os.path.splitext(os.path.basename(handle))[0]\n    arg_5[arg_1] += arg_3\n\n    ## update sample stats\n    arg_10, arg_11, arg_12, arg_13 = arg_4\n    arg_6.update(arg_10)\n    arg_7.update(arg_11)\n    arg_8.update(arg_12)\n    arg_9.update(arg_13)\n\n    ## repack the tuple and return\n    arg_2 = arg_5, arg_6, arg_7, arg_8, arg_9\n    return arg_2", "path": "ipyrad/assemble/demultiplex.py", "identifier": "putstats", "docstring": "puts stats from pickles into a dictionary", "docstring_tokens": ["puts", "stats", "from", "pickles", "into", "a", "dictionary"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 252703}
{"url": "https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L35-L49", "sha": "71c798378e365286b7cc03c06e4d7d24c7de8fc4", "docstring_summary": "Configure the null keyring as the default.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "platform", ".", "config_root", "(", ")", "try", ":", "os", ".", "makedirs", "(", "arg_0", ")", "except", "OSError", ":", "pass", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'keyringrc.cfg'", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "arg_2", "=", "\"Refusing to overwrite {filename}\"", ".", "format", "(", "**", "locals", "(", ")", ")", "raise", "RuntimeError", "(", "arg_2", ")", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "file", ":", "file", ".", "write", "(", "'[backend]\\ndefault-keyring=keyring.backends.null.Keyring'", ")"], "function": "def Func():\n    \"\"\"\n    Configure the null keyring as the default.\n    \"\"\"\n    arg_0 = platform.config_root()\n    try:\n        os.makedirs(arg_0)\n    except OSError:\n        pass\n    arg_1 = os.path.join(arg_0, 'keyringrc.cfg')\n    if os.path.exists(arg_1):\n        arg_2 = \"Refusing to overwrite {filename}\".format(**locals())\n        raise RuntimeError(arg_2)\n    with open(arg_1, 'w') as file:\n        file.write('[backend]\\ndefault-keyring=keyring.backends.null.Keyring')", "path": "keyring/core.py", "identifier": "disable", "docstring": "Configure the null keyring as the default.", "docstring_tokens": ["Configure", "the", "null", "keyring", "as", "the", "default", "."], "nwo": "jaraco/keyring", "score": 0.7254776697026839, "idx": 252704}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/mobileclient.py#L29-L67", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Authenticate the gmusicapi Mobileclient instance.", "language": "python", "parameters": "(self, username=None, password=None, android_id=None)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "type", "(", "arg_0", ")", ".", "__name__", "if", "arg_1", "is", "None", ":", "arg_1", "=", "input", "(", "\"Enter your Google username or email address: \"", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "getpass", ".", "getpass", "(", "\"Enter your Google Music password: \"", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "Mobileclient", ".", "FROM_MAC_ADDRESS", "try", ":", "arg_0", ".", "api", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "OSError", ":", "logger", ".", "exception", "(", "\"{} authentication failed.\"", ".", "format", "(", "arg_4", ")", ")", "if", "not", "arg_0", ".", "is_authenticated", ":", "logger", ".", "warning", "(", "\"{} authentication failed.\"", ".", "format", "(", "arg_4", ")", ")", "return", "False", "logger", ".", "info", "(", "\"{} authentication succeeded.\\n\"", ".", "format", "(", "arg_4", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n\t\t\"\"\"Authenticate the gmusicapi Mobileclient instance.\n\n\t\tParameters:\n\t\t\tusername (Optional[str]): Your Google Music username. Will be prompted if not given.\n\n\t\t\tpassword (Optional[str]): Your Google Music password. Will be prompted if not given.\n\n\t\t\tandroid_id (Optional[str]): The 16 hex digits from an Android device ID.\n\t\t\t\tDefault: Use gmusicapi.Mobileclient.FROM_MAC_ADDRESS to create ID from computer's MAC address.\n\n\t\tReturns:\n\t\t\t``True`` on successful Func or ``False`` on unsuccessful Func.\n\t\t\"\"\"\n\n\t\targ_4 = type(arg_0).__name__\n\n\t\tif arg_1 is None:\n\t\t\targ_1 = input(\"Enter your Google username or email address: \")\n\n\t\tif arg_2 is None:\n\t\t\targ_2 = getpass.getpass(\"Enter your Google Music password: \")\n\n\t\tif arg_3 is None:\n\t\t\targ_3 = Mobileclient.FROM_MAC_ADDRESS\n\n\t\ttry:\n\t\t\targ_0.api.Func(arg_1, arg_2, arg_3)\n\t\texcept OSError:\n\t\t\tlogger.exception(\"{} authentication failed.\".format(arg_4))\n\n\t\tif not arg_0.is_authenticated:\n\t\t\tlogger.warning(\"{} authentication failed.\".format(arg_4))\n\n\t\t\treturn False\n\n\t\tlogger.info(\"{} authentication succeeded.\\n\".format(arg_4))\n\n\t\treturn True", "path": "gmusicapi_wrapper/mobileclient.py", "identifier": "MobileClientWrapper.login", "docstring": "Authenticate the gmusicapi Mobileclient instance.\n\n\t\tParameters:\n\t\t\tusername (Optional[str]): Your Google Music username. Will be prompted if not given.\n\n\t\t\tpassword (Optional[str]): Your Google Music password. Will be prompted if not given.\n\n\t\t\tandroid_id (Optional[str]): The 16 hex digits from an Android device ID.\n\t\t\t\tDefault: Use gmusicapi.Mobileclient.FROM_MAC_ADDRESS to create ID from computer's MAC address.\n\n\t\tReturns:\n\t\t\t``True`` on successful login or ``False`` on unsuccessful login.", "docstring_tokens": ["Authenticate", "the", "gmusicapi", "Mobileclient", "instance", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 252705}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/parser.py#L1501-L1511", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Assert that `recur` forms do not appear in any position of this or\n    child AST nodes.", "language": "python", "parameters": "(node: Node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "None", ":", "if", "arg_0", ".", "op", "==", "NodeOp", ".", "RECUR", ":", "raise", "ParserException", "(", "\"recur must appear in tail position\"", ",", "form", "=", "arg_0", ".", "form", ",", "lisp_ast", "=", "arg_0", ")", "elif", "arg_0", ".", "op", "in", "{", "NodeOp", ".", "FN", ",", "NodeOp", ".", "LOOP", "}", ":", "pass", "else", ":", "arg_0", ".", "visit", "(", "Func", ")"], "function": "def Func(arg_0: arg_1) -> None:\n    \"\"\"Assert that `recur` forms do not appear in any position of this or\n    child AST nodes.\"\"\"\n    if arg_0.op == NodeOp.RECUR:\n        raise ParserException(\n            \"recur must appear in tail position\", form=arg_0.form, lisp_ast=arg_0\n        )\n    elif arg_0.op in {NodeOp.FN, NodeOp.LOOP}:\n        pass\n    else:\n        arg_0.visit(Func)", "path": "src/basilisp/lang/compiler/parser.py", "identifier": "_assert_no_recur", "docstring": "Assert that `recur` forms do not appear in any position of this or\n    child AST nodes.", "docstring_tokens": ["Assert", "that", "recur", "forms", "do", "not", "appear", "in", "any", "position", "of", "this", "or", "child", "AST", "nodes", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252706}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L722-L746", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Convert to human readable version of CLINSIG evaluation.", "language": "python", "parameters": "(variant_obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", "[", "'clnsig'", "]", ":", "if", "isinstance", "(", "arg_1", "[", "'accession'", "]", ",", "int", ")", ":", "arg_2", "=", "\"https://www.ncbi.nlm.nih.gov/clinvar/variation/{}\"", "else", ":", "arg_2", "=", "\"https://www.ncbi.nlm.nih.gov/clinvar/{}\"", "arg_3", "=", "'not provided'", "if", "arg_1", ".", "get", "(", "'value'", ")", ":", "try", ":", "int", "(", "arg_1", "[", "'value'", "]", ")", "arg_3", "=", "CLINSIG_MAP", ".", "get", "(", "arg_1", "[", "'value'", "]", ",", "'not provided'", ")", "except", "ValueError", ":", "arg_3", "=", "arg_1", "[", "'value'", "]", "arg_1", "[", "'human'", "]", "=", "arg_3", "arg_1", "[", "'link'", "]", "=", "arg_2", ".", "format", "(", "arg_1", "[", "'accession'", "]", ")", "yield", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Convert to human readable version of CLINSIG evaluation.\"\"\"\n    for arg_1 in arg_0['clnsig']:\n        # The clinsig objects allways have a accession\n        if isinstance(arg_1['accession'], int):\n            # New version\n            arg_2 = \"https://www.ncbi.nlm.nih.gov/clinvar/variation/{}\"\n        else:\n            # Old version\n            arg_2 = \"https://www.ncbi.nlm.nih.gov/clinvar/{}\"\n\n        arg_3 = 'not provided'\n        if arg_1.get('value'):\n            try:\n                # Old version\n                int(arg_1['value'])\n                arg_3 = CLINSIG_MAP.get(arg_1['value'], 'not provided')\n            except ValueError:\n                # New version\n                arg_3 = arg_1['value']\n\n        arg_1['human'] = arg_3\n        arg_1['link'] = arg_2.format(arg_1['accession'])\n\n        yield arg_1", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "clinsig_human", "docstring": "Convert to human readable version of CLINSIG evaluation.", "docstring_tokens": ["Convert", "to", "human", "readable", "version", "of", "CLINSIG", "evaluation", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252707}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/transTmpl.py#L140-L159", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Parse HStruct type to this transaction template instance", "language": "python", "parameters": "(self, dtype: HdlType, bitAddr: int)", "return_statement": "return bitAddr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ")", ":", "for", "arg_5", "in", "arg_1", ".", "fields", ":", "arg_6", "=", "arg_5", ".", "dtype", "arg_7", "=", "arg_5", "arg_8", "=", "arg_5", ".", "name", "is", "None", "if", "arg_8", ":", "arg_9", "=", "arg_6", ".", "bit_length", "(", ")", "arg_3", "+=", "arg_9", "else", ":", "arg_10", "=", "TransTmpl", "(", "arg_6", ",", "arg_3", ",", "parent", "=", "arg_0", ",", "arg_7", "=", "arg_7", ")", "arg_0", ".", "children", ".", "append", "(", "arg_10", ")", "arg_3", "=", "arg_10", ".", "bitAddrEnd", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4):\n        \"\"\"\n        Parse HStruct type to this transaction template instance\n\n        :return: address of it's end\n        \"\"\"\n        for arg_5 in arg_1.fields:\n            arg_6 = arg_5.dtype\n            arg_7 = arg_5\n            arg_8 = arg_5.name is None\n\n            if arg_8:\n                arg_9 = arg_6.bit_length()\n                arg_3 += arg_9\n            else:\n                arg_10 = TransTmpl(arg_6, arg_3, parent=arg_0, arg_7=arg_7)\n                arg_0.children.append(arg_10)\n                arg_3 = arg_10.bitAddrEnd\n\n        return arg_3", "path": "hwt/hdl/transTmpl.py", "identifier": "TransTmpl._loadFromHStruct", "docstring": "Parse HStruct type to this transaction template instance\n\n        :return: address of it's end", "docstring_tokens": ["Parse", "HStruct", "type", "to", "this", "transaction", "template", "instance"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252708}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L163-L171", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Resets the state to allow building new documents", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "doc_version_set", "=", "False", "arg_0", ".", "doc_comment_set", "=", "False", "arg_0", ".", "doc_namespace_set", "=", "False", "arg_0", ".", "doc_data_lics_set", "=", "False", "arg_0", ".", "doc_name_set", "=", "False", "arg_0", ".", "doc_spdx_id_set", "=", "False"], "function": "def Func(arg_0):\n        \"\"\"Resets the state to allow building new documents\"\"\"\n        # FIXME: this state does not make sense\n        arg_0.doc_version_set = False\n        arg_0.doc_comment_set = False\n        arg_0.doc_namespace_set = False\n        arg_0.doc_data_lics_set = False\n        arg_0.doc_name_set = False\n        arg_0.doc_spdx_id_set = False", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "DocBuilder.reset_document", "docstring": "Resets the state to allow building new documents", "docstring_tokens": ["Resets", "the", "state", "to", "allow", "building", "new", "documents"], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 252709}
{"url": "https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L441-L476", "sha": "4fe4d928cd6fe3e7564f7362e3996898bda5a285", "docstring_summary": "Rename key ``src`` to ``dst``", "language": "python", "parameters": "(self, src, dst)", "return_statement": "return self.delete(src)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "arg_0", ".", "rename", "(", "arg_1", "+", "\"{\"", "+", "arg_1", "+", "\"}\"", ",", "arg_1", ")", "if", "not", "arg_0", ".", "exists", "(", "arg_1", ")", ":", "return", "arg_0", ".", "rename", "(", "arg_1", "+", "\"{\"", "+", "arg_1", "+", "\"}\"", ",", "arg_1", ")", "arg_0", ".", "delete", "(", "arg_2", ")", "arg_3", "=", "arg_0", ".", "type", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "ttl", "(", "arg_1", ")", "if", "arg_3", "==", "b", "(", "'none'", ")", ":", "return", "False", "if", "arg_3", "==", "b", "(", "'string'", ")", ":", "arg_0", ".", "set", "(", "arg_2", ",", "arg_0", ".", "get", "(", "arg_1", ")", ")", "elif", "arg_3", "==", "b", "(", "'hash'", ")", ":", "arg_0", ".", "hmset", "(", "arg_2", ",", "arg_0", ".", "hgetall", "(", "arg_1", ")", ")", "elif", "arg_3", "==", "b", "(", "'list'", ")", ":", "for", "arg_5", "in", "arg_0", ".", "lrange", "(", "arg_1", ",", "0", ",", "-", "1", ")", ":", "arg_0", ".", "rpush", "(", "arg_2", ",", "arg_5", ")", "elif", "arg_3", "==", "b", "(", "'set'", ")", ":", "for", "arg_5", "in", "arg_0", ".", "smembers", "(", "arg_1", ")", ":", "arg_0", ".", "sadd", "(", "arg_2", ",", "arg_5", ")", "elif", "arg_3", "==", "b", "(", "'zset'", ")", ":", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "zrange", "(", "arg_1", ",", "0", ",", "-", "1", ",", "withscores", "=", "True", ")", ":", "arg_0", ".", "zadd", "(", "arg_2", ",", "arg_6", ",", "arg_5", ")", "arg_4", "=", "-", "1", "if", "arg_4", "is", "None", "or", "arg_4", "<", "0", "else", "int", "(", "arg_4", ")", "if", "arg_4", "!=", "-", "1", ":", "arg_0", ".", "expire", "(", "arg_2", ",", "arg_4", ")", "return", "arg_0", ".", "delete", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Rename key ``src`` to ``dst``\n        \"\"\"\n        if arg_1 == arg_2:\n            return arg_0.rename(arg_1 + \"{\" + arg_1 + \"}\", arg_1)\n        if not arg_0.exists(arg_1):\n            return arg_0.rename(arg_1 + \"{\" + arg_1 + \"}\", arg_1)\n\n        arg_0.delete(arg_2)\n        arg_3 = arg_0.type(arg_1)\n        arg_4 = arg_0.ttl(arg_1)\n\n        if arg_3 == b('none'):\n            return False\n\n        if arg_3 == b('string'):\n            arg_0.set(arg_2, arg_0.get(arg_1))\n        elif arg_3 == b('hash'):\n            arg_0.hmset(arg_2, arg_0.hgetall(arg_1))\n        elif arg_3 == b('list'):\n            for arg_5 in arg_0.lrange(arg_1, 0, -1):\n                arg_0.rpush(arg_2, arg_5)\n        elif arg_3 == b('set'):\n            for arg_5 in arg_0.smembers(arg_1):\n                arg_0.sadd(arg_2, arg_5)\n        elif arg_3 == b('zset'):\n            for arg_5, arg_6 in arg_0.zrange(arg_1, 0, -1, withscores=True):\n                arg_0.zadd(arg_2, arg_6, arg_5)\n\n        # Handle keys with an expire time set\n        arg_4 = -1 if arg_4 is None or arg_4 < 0 else int(arg_4)\n        if arg_4 != -1:\n            arg_0.expire(arg_2, arg_4)\n\n        return arg_0.delete(arg_1)", "path": "rediscluster/cluster_client.py", "identifier": "StrictRedisCluster._rc_rename", "docstring": "Rename key ``src`` to ``dst``", "docstring_tokens": ["Rename", "key", "src", "to", "dst"], "nwo": "salimane/rediscluster-py", "score": 0.19802268511144447, "idx": 252710}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/prebuild.py#L1853-L1887", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Parse command line options and launch the prebuilder.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "optparse", ".", "OptionParser", "(", "usage", "=", "\"%prog [options] <model_path> [another_model_path..]\"", ",", "version", "=", "xtuml", ".", "version", ".", "complete_string", ",", "formatter", "=", "optparse", ".", "TitledHelpFormatter", "(", ")", ")", "arg_0", ".", "add_option", "(", "\"-v\"", ",", "\"--verbosity\"", ",", "dest", "=", "'verbosity'", ",", "action", "=", "\"count\"", ",", "help", "=", "\"increase debug logging level\"", ",", "default", "=", "1", ")", "arg_0", ".", "add_option", "(", "\"-o\"", ",", "\"--output\"", ",", "dest", "=", "\"output\"", ",", "metavar", "=", "\"PATH\"", ",", "help", "=", "\"set output to PATH\"", ",", "action", "=", "\"store\"", ",", "default", "=", "None", ")", "(", "arg_1", ",", "arg_2", ")", "=", "arg_0", ".", "parse_args", "(", ")", "if", "len", "(", "arg_2", ")", "==", "0", "or", "arg_1", ".", "output", "is", "None", ":", "arg_0", ".", "print_help", "(", ")", "sys", ".", "exit", "(", "1", ")", "arg_3", "=", "{", "0", ":", "logging", ".", "ERROR", ",", "1", ":", "logging", ".", "WARNING", ",", "2", ":", "logging", ".", "INFO", ",", "3", ":", "logging", ".", "DEBUG", ",", "}", "logging", ".", "basicConfig", "(", "level", "=", "arg_3", ".", "get", "(", "arg_1", ".", "verbosity", ",", "logging", ".", "DEBUG", ")", ")", "arg_4", "=", "ooaofooa", ".", "load_metamodel", "(", "arg_2", ")", "prebuild_model", "(", "arg_4", ")", "xtuml", ".", "persist_instances", "(", "arg_4", ",", "arg_1", ".", "output", ")"], "function": "def Func():\n    '''\n    Parse command line options and launch the prebuilder.\n    '''\n    arg_0 = optparse.OptionParser(usage=\"%prog [options] <model_path> [another_model_path..]\",\n                                   version=xtuml.version.complete_string,\n                                   formatter=optparse.TitledHelpFormatter())\n\n    arg_0.add_option(\"-v\", \"--verbosity\", dest='verbosity',\n                                           action=\"count\",\n                                           help=\"increase debug logging level\",\n                                           default=1)\n    \n    arg_0.add_option(\"-o\", \"--output\", dest=\"output\", metavar=\"PATH\",\n                                        help=\"set output to PATH\",\n                                        action=\"store\",\n                                        default=None)\n    \n    (arg_1, arg_2) = arg_0.parse_args()\n    if len(arg_2) == 0 or arg_1.output is None:\n        arg_0.print_help()\n        sys.exit(1)\n        \n    arg_3 = {\n              0: logging.ERROR,\n              1: logging.WARNING,\n              2: logging.INFO,\n              3: logging.DEBUG,\n    }\n    logging.basicConfig(level=arg_3.get(arg_1.verbosity, logging.DEBUG))\n    \n    arg_4 = ooaofooa.load_metamodel(arg_2)\n    prebuild_model(arg_4)\n    \n    xtuml.persist_instances(arg_4, arg_1.output)", "path": "bridgepoint/prebuild.py", "identifier": "main", "docstring": "Parse command line options and launch the prebuilder.", "docstring_tokens": ["Parse", "command", "line", "options", "and", "launch", "the", "prebuilder", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 252711}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L119-L125", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Write the specified byte value to the GPIO registor.  If no value\n        specified the current buffered value will be written.", "language": "python", "parameters": "(self, gpio=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "gpio", "=", "arg_1", "arg_0", ".", "_device", ".", "writeList", "(", "arg_0", ".", "GPIO", ",", "arg_0", ".", "gpio", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Write the specified byte value to the GPIO registor.  If no value\n        specified the current buffered value will be written.\n        \"\"\"\n        if arg_1 is not None:\n            arg_0.gpio = arg_1\n        arg_0._device.writeList(arg_0.GPIO, arg_0.gpio)", "path": "Adafruit_GPIO/MCP230xx.py", "identifier": "MCP230xxBase.write_gpio", "docstring": "Write the specified byte value to the GPIO registor.  If no value\n        specified the current buffered value will be written.", "docstring_tokens": ["Write", "the", "specified", "byte", "value", "to", "the", "GPIO", "registor", ".", "If", "no", "value", "specified", "the", "current", "buffered", "value", "will", "be", "written", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 252712}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/stats.py#L156-L183", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns an array of length size and type dtype that is everywhere 0,\n  except in the indices listed in sequence pos.  The non-zero indices\n  contain a normalized distribution based on the counts.", "language": "python", "parameters": "(pos, size, counts, dtype)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "numpy", ".", "zeros", "(", "arg_1", ",", "arg_3", "=", "arg_3", ")", "if", "hasattr", "(", "arg_0", ",", "'__iter__'", ")", ":", "arg_5", "=", "0", "for", "arg_6", "in", "arg_0", ":", "arg_5", "+=", "arg_2", "[", "arg_6", "]", "arg_5", "=", "float", "(", "arg_5", ")", "for", "arg_6", "in", "arg_0", ":", "arg_4", "[", "arg_6", "]", "=", "arg_2", "[", "arg_6", "]", "/", "arg_5", "else", ":", "arg_4", "[", "arg_0", "]", "=", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"\n  Returns an array of length size and type dtype that is everywhere 0,\n  except in the indices listed in sequence pos.  The non-zero indices\n  contain a normalized distribution based on the counts.\n\n\n  :param pos:    A single integer or sequence of integers that specify\n          the position of ones to be set.\n  :param size:   The total size of the array to be returned.\n  :param counts: The number of times we have observed each index.\n  :param dtype:  The element type (compatible with NumPy array())\n          of the array to be returned.\n  :returns: An array of length size and element type dtype.\n  \"\"\"\n  arg_4 = numpy.zeros(arg_1, arg_3=arg_3)\n  if hasattr(arg_0, '__iter__'):\n    # calculate normalization constant\n    arg_5 = 0\n    for arg_6 in arg_0:\n      arg_5 += arg_2[arg_6]\n    arg_5 = float(arg_5)\n    # set included positions to normalized probability\n    for arg_6 in arg_0:\n      arg_4[arg_6] = arg_2[arg_6]/arg_5\n  # If we don't have a set of positions, assume there's only one position\n  else: arg_4[arg_0] = 1\n  return arg_4", "path": "src/nupic/math/stats.py", "identifier": "Distribution", "docstring": "Returns an array of length size and type dtype that is everywhere 0,\n  except in the indices listed in sequence pos.  The non-zero indices\n  contain a normalized distribution based on the counts.\n\n\n  :param pos:    A single integer or sequence of integers that specify\n          the position of ones to be set.\n  :param size:   The total size of the array to be returned.\n  :param counts: The number of times we have observed each index.\n  :param dtype:  The element type (compatible with NumPy array())\n          of the array to be returned.\n  :returns: An array of length size and element type dtype.", "docstring_tokens": ["Returns", "an", "array", "of", "length", "size", "and", "type", "dtype", "that", "is", "everywhere", "0", "except", "in", "the", "indices", "listed", "in", "sequence", "pos", ".", "The", "non", "-", "zero", "indices", "contain", "a", "normalized", "distribution", "based", "on", "the", "counts", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252713}
{"url": "https://github.com/dlancer/django-cached-httpbl/blob/b32106f4283f9605122255f2c9bfbd3bff465fa5/cached_httpbl/api.py#L180-L187", "sha": "b32106f4283f9605122255f2c9bfbd3bff465fa5", "docstring_summary": "Invalidate httpBL cache", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_use_cache", ":", "arg_0", ".", "_cache_version", "+=", "1", "arg_0", ".", "_cache", ".", "increment", "(", "'cached_httpbl_{0}_version'", ".", "format", "(", "arg_0", ".", "_api_key", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Invalidate httpBL cache\n        \"\"\"\n\n        if arg_0._use_cache:\n            arg_0._cache_version += 1\n            arg_0._cache.increment('cached_httpbl_{0}_version'.format(arg_0._api_key))", "path": "cached_httpbl/api.py", "identifier": "CachedHTTPBL.invalidate_cache", "docstring": "Invalidate httpBL cache", "docstring_tokens": ["Invalidate", "httpBL", "cache"], "nwo": "dlancer/django-cached-httpbl", "score": 0.0, "idx": 252714}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/query.py#L133-L149", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Gets whether the field with the specified name is a\n        HStoreField.", "language": "python", "parameters": "(self, field_name: str)", "return_statement": "return isinstance(field_instance, HStoreField), field_instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Tuple", "[", "bool", ",", "Optional", "[", "models", ".", "Field", "]", "]", ":", "arg_3", "=", "None", "for", "arg_4", "in", "arg_0", ".", "model", ".", "_meta", ".", "local_concrete_fields", ":", "if", "arg_4", ".", "name", "==", "arg_1", "or", "arg_4", ".", "column", "==", "arg_1", ":", "arg_3", "=", "arg_4", "break", "return", "isinstance", "(", "arg_3", ",", "HStoreField", ")", ",", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2) -> Tuple[bool, Optional[models.Field]]:\n        \"\"\"Gets whether the field with the specified name is a\n        HStoreField.\n\n        Returns\n            A tuple of a boolean indicating whether the field\n            with the specified name is a HStoreField, and the\n            field instance.\n        \"\"\"\n\n        arg_3 = None\n        for arg_4 in arg_0.model._meta.local_concrete_fields:\n            if arg_4.name == arg_1 or arg_4.column == arg_1:\n                arg_3 = arg_4\n                break\n\n        return isinstance(arg_3, HStoreField), arg_3", "path": "psqlextra/query.py", "identifier": "PostgresQuery._is_hstore_field", "docstring": "Gets whether the field with the specified name is a\n        HStoreField.\n\n        Returns\n            A tuple of a boolean indicating whether the field\n            with the specified name is a HStoreField, and the\n            field instance.", "docstring_tokens": ["Gets", "whether", "the", "field", "with", "the", "specified", "name", "is", "a", "HStoreField", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 252715}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/templatetags/highlight.py#L38-L47", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "Given an list of words, this function highlights the matched text in the given string.", "language": "python", "parameters": "(string, keywords, cls_name='highlighted')", "return_statement": "return highlighted", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'Funced'", ")", ":", "if", "not", "arg_1", ":", "return", "arg_0", "if", "not", "arg_0", ":", "return", "''", "arg_3", ",", "arg_4", "=", "get_text_tokenizer", "(", "arg_1", ")", "arg_5", "=", "Func_text", "(", "arg_3", ",", "arg_0", ",", "arg_2", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2='Funced'):\n    \"\"\" Given an list of words, this function Funcs the matched text in the given string. \"\"\"\n\n    if not arg_1:\n        return arg_0\n    if not arg_0:\n        return ''\n    arg_3, arg_4 = get_text_tokenizer(arg_1)\n    arg_5 = Func_text(arg_3, arg_0, arg_2)\n    return arg_5", "path": "toolware/templatetags/highlight.py", "identifier": "highlight", "docstring": "Given an list of words, this function highlights the matched text in the given string.", "docstring_tokens": ["Given", "an", "list", "of", "words", "this", "function", "highlights", "the", "matched", "text", "in", "the", "given", "string", "."], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 252716}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_widget.py#L72-L77", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reimplemented to connect signal handlers and event filter.", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "super", "(", "CompletionWidget", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "_text_edit", ".", "cursorPositionChanged", ".", "connect", "(", "arg_0", ".", "_update_current", ")", "arg_0", ".", "_text_edit", ".", "installEventFilter", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Reimplemented to connect signal handlers and event filter.\n        \"\"\"\n        super(CompletionWidget, arg_0).Func(arg_1)\n        arg_0._text_edit.cursorPositionChanged.connect(arg_0._update_current)\n        arg_0._text_edit.installEventFilter(arg_0)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_widget.py", "identifier": "CompletionWidget.showEvent", "docstring": "Reimplemented to connect signal handlers and event filter.", "docstring_tokens": ["Reimplemented", "to", "connect", "signal", "handlers", "and", "event", "filter", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252717}
{"url": "https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L320-L337", "sha": "cd5c6e10c6c4e653669e11d735d5773766986bda", "docstring_summary": "Call the segmenter in order to split text in sentences.", "language": "python", "parameters": "(self, text)", "return_statement": "return self.decode(res), status_code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'text'", ":", "arg_1", "}", "arg_3", ",", "arg_4", "=", "arg_0", ".", "post", "(", "arg_0", ".", "Funcation_service", ",", "arg_2", "=", "arg_2", ")", "if", "arg_4", "!=", "200", ":", "logger", ".", "debug", "(", "'Segmentation failed.'", ")", "return", "arg_0", ".", "decode", "(", "arg_3", ")", ",", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Call the Funcer in order to split text in sentences.\n\n        Args:\n            text (str): Text to be Funced.\n\n        Returns:\n            dict, int: A dict containing a list of dicts with the offsets of\n                each sentence; an integer representing the response code.\n        \"\"\"\n\n        arg_2 = {'text': arg_1}\n        arg_3, arg_4 = arg_0.post(arg_0.Funcation_service, arg_2=arg_2)\n\n        if arg_4 != 200:\n            logger.debug('Segmentation failed.')\n\n        return arg_0.decode(arg_3), arg_4", "path": "nerd/nerd_client.py", "identifier": "NerdClient.segment", "docstring": "Call the segmenter in order to split text in sentences.\n\n        Args:\n            text (str): Text to be segmented.\n\n        Returns:\n            dict, int: A dict containing a list of dicts with the offsets of\n                each sentence; an integer representing the response code.", "docstring_tokens": ["Call", "the", "segmenter", "in", "order", "to", "split", "text", "in", "sentences", "."], "nwo": "hirmeos/entity-fishing-client-python", "score": 0.36576314591848075, "idx": 252718}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L298-L303", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return endpoints, grouped by the class which handles them.", "language": "python", "parameters": "()", "return_statement": "return groups", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "defaultdict", "(", "list", ")", "for", "arg_1", "in", "endpoints", "(", ")", ":", "arg_0", "[", "arg_1", "[", "\"class_name\"", "]", "]", ".", "append", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Return endpoints, grouped by the class which handles them.\"\"\"\n    arg_0 = defaultdict(list)\n    for arg_1 in endpoints():\n        arg_0[arg_1[\"class_name\"]].append(arg_1)\n    return arg_0", "path": "h2o-bindings/bin/bindings.py", "identifier": "endpoint_groups", "docstring": "Return endpoints, grouped by the class which handles them.", "docstring_tokens": ["Return", "endpoints", "grouped", "by", "the", "class", "which", "handles", "them", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252719}
{"url": "https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L133-L140", "sha": "e5a0d908df8c93ff1ee7abdda8875fd1667df53d", "docstring_summary": "Reload children.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "children", "[", ":", "]", ":", "arg_0", ".", "removeChild", "(", "arg_1", ")", "arg_0", ".", "_fetched", "=", "False"], "function": "def Func(arg_0):\n        '''Reload children.'''\n        # Reset children\n        for arg_1 in arg_0.children[:]:\n            arg_0.removeChild(arg_1)\n\n        # Enable children fetching\n        arg_0._fetched = False", "path": "source/riffle/model.py", "identifier": "Item.refetch", "docstring": "Reload children.", "docstring_tokens": ["Reload", "children", "."], "nwo": "4degrees/riffle", "score": 0.2663827826706725, "idx": 252720}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/io/excel.py#L23-L30", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Convert column name to index.", "language": "python", "parameters": "(name)", "return_statement": "return col", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "string", ".", "ascii_uppercase", ".", "index", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ".", "upper", "(", ")", ":", "arg_2", "=", "arg_2", "*", "26", "+", "arg_1", "(", "arg_3", ")", "+", "1", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Convert column name to index.\"\"\"\n\n    arg_1 = string.ascii_uppercase.index\n    arg_2 = 0\n    for arg_3 in arg_0.upper():\n        arg_2 = arg_2 * 26 + arg_1(arg_3) + 1\n    return arg_2", "path": "modelx/io/excel.py", "identifier": "_get_col_index", "docstring": "Convert column name to index.", "docstring_tokens": ["Convert", "column", "name", "to", "index", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 252721}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/examples/rpc-server.py#L92-L100", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Called when socket is read-ready", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "pyngus", ".", "read_socket_input", "(", "arg_0", ".", "connection", ",", "arg_0", ".", "socket", ")", "except", "Exception", "as", "e", ":", "LOG", ".", "error", "(", "\"Exception on socket read: %s\"", ",", "str", "(", "e", ")", ")", "arg_0", ".", "connection", ".", "close_input", "(", ")", "arg_0", ".", "connection", ".", "close", "(", ")", "arg_0", ".", "connection", ".", "process", "(", "time", ".", "time", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Called when socket is read-ready\"\"\"\n        try:\n            pyngus.read_socket_input(arg_0.connection, arg_0.socket)\n        except Exception as e:\n            LOG.error(\"Exception on socket read: %s\", str(e))\n            arg_0.connection.close_input()\n            arg_0.connection.close()\n        arg_0.connection.process(time.time())", "path": "examples/rpc-server.py", "identifier": "SocketConnection.process_input", "docstring": "Called when socket is read-ready", "docstring_tokens": ["Called", "when", "socket", "is", "read", "-", "ready"], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 252722}
{"url": "https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/cli/validate.py#L9-L25", "sha": "5e613f486f29fe350999d6b990d32847ac16a1b8", "docstring_summary": "Factory for creating the argument parser", "language": "python", "parameters": "()", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "\"Converts a completezip to a litezip\"", "arg_1", "=", "argparse", ".", "ArgumentParser", "(", "arg_0", "=", "arg_0", ")", "arg_2", "=", "arg_1", ".", "add_mutually_exclusive_group", "(", ")", "arg_2", ".", "add_argument", "(", "'-v'", ",", "'--verbose'", ",", "action", "=", "'store_true'", ",", "dest", "=", "'verbose'", ",", "default", "=", "None", ",", "help", "=", "\"increase verbosity\"", ")", "arg_2", ".", "add_argument", "(", "'-q'", ",", "'--quiet'", ",", "action", "=", "'store_false'", ",", "dest", "=", "'verbose'", ",", "default", "=", "None", ",", "help", "=", "\"print nothing to stdout or stderr\"", ")", "arg_1", ".", "add_argument", "(", "'location'", ",", "help", "=", "\"Location of the unpacked litezip\"", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"Factory for creating the argument parser\"\"\"\n    arg_0 = \"Converts a completezip to a litezip\"\n    arg_1 = argparse.ArgumentParser(arg_0=arg_0)\n    arg_2 = arg_1.add_mutually_exclusive_group()\n    arg_2.add_argument(\n        '-v', '--verbose', action='store_true',\n        dest='verbose', default=None,\n        help=\"increase verbosity\")\n    arg_2.add_argument(\n        '-q', '--quiet', action='store_false',\n        dest='verbose', default=None,\n        help=\"print nothing to stdout or stderr\")\n    arg_1.add_argument(\n        'location',\n        help=\"Location of the unpacked litezip\")\n    return arg_1", "path": "litezip/cli/validate.py", "identifier": "_arg_parser", "docstring": "Factory for creating the argument parser", "docstring_tokens": ["Factory", "for", "creating", "the", "argument", "parser"], "nwo": "openstax/cnx-litezip", "score": 0.3282631104312029, "idx": 252723}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/samplers/decorators.py#L135-L145", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Update annotations of discretized continuous pulse function with duration.", "language": "python", "parameters": "(discretized_pulse: Callable)", "return_statement": "return discretized_pulse", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "arg_1", ":", "arg_2", "=", "list", "(", "arg_0", ".", "__annotations__", ".", "items", "(", ")", ")", "arg_3", "=", "arg_2", "[", "1", ":", "]", "arg_3", ".", "insert", "(", "0", ",", "(", "'duration'", ",", "int", ")", ")", "arg_0", ".", "__annotations__", "=", "dict", "(", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0: arg_1) -> arg_1:\n    \"\"\"Update annotations of discretized continuous pulse function with duration.\n\n    Args:\n        discretized_pulse: Discretized decorated continuous pulse.\n    \"\"\"\n    arg_2 = list(arg_0.__annotations__.items())\n    arg_3 = arg_2[1:]\n    arg_3.insert(0, ('duration', int))\n    arg_0.__annotations__ = dict(arg_3)\n    return arg_0", "path": "qiskit/pulse/samplers/decorators.py", "identifier": "_update_annotations", "docstring": "Update annotations of discretized continuous pulse function with duration.\n\n    Args:\n        discretized_pulse: Discretized decorated continuous pulse.", "docstring_tokens": ["Update", "annotations", "of", "discretized", "continuous", "pulse", "function", "with", "duration", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252724}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/decorators.py#L161-L221", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "View decorator which terminates stale TPA sessions.", "language": "python", "parameters": "(view)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "not", "arg_1", ".", "GET", ".", "get", "(", "FRESH_LOGIN_PARAMETER", ")", ":", "arg_4", "=", "get_enterprise_customer_or_404", "(", "arg_3", ".", "get", "(", "'enterprise_uuid'", ")", ")", "arg_5", "=", "arg_4", ".", "identity_provider", "or", "''", "arg_6", "=", "get_identity_provider", "(", "arg_5", ")", "if", "arg_6", ":", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", "=", "urlparse", "(", "arg_1", ".", "get_full_path", "(", ")", ")", "arg_13", "=", "urlunparse", "(", "(", "arg_7", ",", "arg_8", ",", "quote", "(", "arg_9", ")", ",", "arg_10", ",", "arg_11", ",", "arg_12", ")", ")", "return", "redirect", "(", "'{logout_url}?{params}'", ".", "format", "(", "logout_url", "=", "'/logout'", ",", "arg_10", "=", "urlencode", "(", "{", "'redirect_url'", ":", "arg_13", "}", ")", ")", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    View decorator which terminates stale TPA sessions.\n\n    This decorator forces the user to obtain a new session\n    the first time they access the decorated view. This prevents\n    TPA-authenticated users from hijacking the session of another\n    user who may have been previously logged in using the same\n    browser window.\n\n    This decorator should be used in conjunction with the\n    enterprise_login_required decorator.\n\n    Usage::\n        @enterprise_login_required\n        @Func()\n        def my_view(request, enterprise_uuid):\n            # Some functionality ...\n\n        OR\n\n        class MyView(View):\n            ...\n            @method_decorator(enterprise_login_required)\n            @method_decorator(Func)\n            def get(self, request, enterprise_uuid):\n                # Some functionality ...\n    \"\"\"\n    @wraps(arg_0)\n    def wrapper(arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Wrap the function.\n        \"\"\"\n        if not arg_1.GET.get(FRESH_LOGIN_PARAMETER):\n            # The enterprise_login_required decorator promises to set the fresh login URL\n            # parameter for this URL when it was the agent that initiated the login process;\n            # if that parameter isn't set, we can safely assume that the session is \"stale\";\n            # that isn't necessarily an issue, though. Redirect the user to\n            # log out and then come back here - the enterprise_login_required decorator will\n            # then take effect prior to us arriving back here again.\n            arg_4 = get_enterprise_customer_or_404(arg_3.get('enterprise_uuid'))\n            arg_5 = arg_4.identity_provider or ''\n            arg_6 = get_identity_provider(arg_5)\n            if arg_6:\n                # Parse the current request full path, quote just the path portion,\n                # then reconstruct the full path string.\n                # The path and query portions should be the only non-empty strings here.\n                arg_7, arg_8, arg_9, arg_10, arg_11, arg_12 = urlparse(arg_1.get_full_path())\n                arg_13 = urlunparse((arg_7, arg_8, quote(arg_9), arg_10, arg_11, arg_12))\n\n                return redirect(\n                    '{logout_url}?{params}'.format(\n                        logout_url='/logout',\n                        arg_10=urlencode(\n                            {'redirect_url': arg_13}\n                        )\n                    )\n                )\n        return arg_0(arg_1, *arg_2, **arg_3)\n\n    return wrapper", "path": "enterprise/decorators.py", "identifier": "force_fresh_session", "docstring": "View decorator which terminates stale TPA sessions.\n\n    This decorator forces the user to obtain a new session\n    the first time they access the decorated view. This prevents\n    TPA-authenticated users from hijacking the session of another\n    user who may have been previously logged in using the same\n    browser window.\n\n    This decorator should be used in conjunction with the\n    enterprise_login_required decorator.\n\n    Usage::\n        @enterprise_login_required\n        @force_fresh_session()\n        def my_view(request, enterprise_uuid):\n            # Some functionality ...\n\n        OR\n\n        class MyView(View):\n            ...\n            @method_decorator(enterprise_login_required)\n            @method_decorator(force_fresh_session)\n            def get(self, request, enterprise_uuid):\n                # Some functionality ...", "docstring_tokens": ["View", "decorator", "which", "terminates", "stale", "TPA", "sessions", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252725}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/coloransi.py#L157-L161", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Add a new color scheme to the table.", "language": "python", "parameters": "(self,new_scheme)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "ColorScheme", ")", ":", "raise", "ValueError", ",", "'ColorSchemeTable only accepts ColorScheme instances'", "arg_0", "[", "arg_1", ".", "name", "]", "=", "arg_1"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Add a new color scheme to the table.\"\"\"\n        if not isinstance(arg_1,ColorScheme):\n            raise ValueError,'ColorSchemeTable only accepts ColorScheme instances'\n        arg_0[arg_1.name] = arg_1", "path": "environment/lib/python2.7/site-packages/IPython/utils/coloransi.py", "identifier": "ColorSchemeTable.add_scheme", "docstring": "Add a new color scheme to the table.", "docstring_tokens": ["Add", "a", "new", "color", "scheme", "to", "the", "table", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252726}
{"url": "https://github.com/controversial/livejson/blob/91021de60903d2d8b2cfb7d8d8910bcf27ec003b/livejson.py#L195-L203", "sha": "91021de60903d2d8b2cfb7d8d8910bcf27ec003b", "docstring_summary": "A simpler version of data to avoid infinite recursion in some cases.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "is_caching", ":", "return", "arg_0", ".", "cache", "with", "open", "(", "arg_0", ".", "path", ",", "\"r\"", ")", "as", "f", ":", "return", "json", ".", "load", "(", "f", ")"], "function": "def Func(arg_0):\n        \"\"\"A simpler version of data to avoid infinite recursion in some cases.\n\n        Don't use this.\n        \"\"\"\n        if arg_0.is_caching:\n            return arg_0.cache\n        with open(arg_0.path, \"r\") as f:\n            return json.load(f)", "path": "livejson.py", "identifier": "_BaseFile._data", "docstring": "A simpler version of data to avoid infinite recursion in some cases.\n\n        Don't use this.", "docstring_tokens": ["A", "simpler", "version", "of", "data", "to", "avoid", "infinite", "recursion", "in", "some", "cases", "."], "nwo": "controversial/livejson", "score": 0.28589442541680926, "idx": 252727}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/s3.py#L97-L138", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "Download a remote file from S3.", "language": "python", "parameters": "(bucket_name, file_key, file_path, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_2", "=", "path", "(", "arg_2", ")", "arg_4", "=", "open_s3", "(", "arg_0", ")", "arg_5", "=", "arg_2", ".", "dirname", "(", ")", "arg_5", ".", "makedirs", "(", ")", "arg_6", "=", "arg_4", ".", "get_key", "(", "arg_1", ")", "if", "arg_2", ".", "exists", "(", ")", ":", "arg_7", "=", "arg_2", ".", "bytes", "(", ")", "arg_8", ",", "arg_9", "=", "arg_6", ".", "get_md5_from_hexdigest", "(", "hashlib", ".", "md5", "(", "arg_7", ")", ".", "hexdigest", "(", ")", ")", "try", ":", "arg_10", "=", "arg_6", ".", "etag", ".", "replace", "(", "'\"'", ",", "''", ")", "except", "KeyError", ":", "pass", "else", ":", "if", "arg_10", "==", "arg_8", ":", "info", "(", "'Hash is the same. Skipping %s'", "%", "arg_2", ")", "return", "elif", "not", "arg_3", ":", "arg_11", "=", "datetime", ".", "datetime", "(", "*", "time", ".", "strptime", "(", "arg_6", ".", "last_modified", ",", "'%a, %d %b %Y %H:%M:%S %Z'", ")", "[", "0", ":", "6", "]", ")", "arg_12", "=", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "arg_2", ".", "stat", "(", ")", ".", "st_mtime", ")", "if", "arg_11", "<", "arg_12", ":", "info", "(", "\"File at %s is less recent than the local version.\"", "%", "(", "arg_1", ")", ")", "return", "info", "(", "\"Downloading %s...\"", "%", "(", "arg_1", ")", ")", "try", ":", "with", "open", "(", "arg_2", ",", "'w'", ")", "as", "fo", ":", "arg_6", ".", "get_contents_to_file", "(", "fo", ")", "except", "Exception", "as", "e", ":", "error", "(", "\"Failed: %s\"", "%", "e", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\"Download a remote file from S3.\n    \"\"\"\n    arg_2 = path(arg_2)\n    arg_4 = open_s3(arg_0)\n\n    arg_5 = arg_2.dirname()\n    arg_5.makedirs()\n\n    arg_6 = arg_4.get_key(arg_1)\n    if arg_2.exists():\n        arg_7 = arg_2.bytes()\n        arg_8, arg_9 = arg_6.get_md5_from_hexdigest(hashlib.md5(arg_7).hexdigest())\n\n        # Check the hash.\n        try:\n            arg_10 = arg_6.etag.replace('\"', '')\n        except KeyError:\n            pass\n        else:\n            if arg_10 == arg_8:\n                info('Hash is the same. Skipping %s' % arg_2)\n                return\n\n            elif not arg_3:\n                # Check if file on S3 is older than local file.\n                arg_11 = datetime.datetime(*time.strptime(\n                    arg_6.last_modified, '%a, %d %b %Y %H:%M:%S %Z')[0:6])\n                arg_12 = datetime.datetime.utcfromtimestamp(arg_2.stat().st_mtime)\n                if arg_11 < arg_12:\n                    info(\"File at %s is less recent than the local version.\" % (arg_1))\n                    return\n\n    # If it is newer, let's process and upload\n    info(\"Downloading %s...\" % (arg_1))\n\n    try:\n        with open(arg_2, 'w') as fo:\n            arg_6.get_contents_to_file(fo)\n    except Exception as e:\n        error(\"Failed: %s\" % e)\n        raise", "path": "paved/s3.py", "identifier": "download_s3", "docstring": "Download a remote file from S3.", "docstring_tokens": ["Download", "a", "remote", "file", "from", "S3", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 252728}
{"url": "https://github.com/WGBH/wagtail-streamfieldtools/blob/192f86845532742b0b7d432bef3987357833b8ed/streamfield_tools/blocks/struct_block.py#L118-L123", "sha": "192f86845532742b0b7d432bef3987357833b8ed", "docstring_summary": "Ensure `image_rendition` is added to the global context.", "language": "python", "parameters": "(self, value)", "return_statement": "return context", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "super", "(", "RenditionAwareStructBlock", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "arg_2", "[", "'image_rendition'", "]", "=", "arg_0", ".", "rendition", ".", "image_rendition", "or", "'original'", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Ensure `image_rendition` is added to the global context.\"\"\"\n        arg_2 = super(RenditionAwareStructBlock, arg_0).Func(arg_1)\n        arg_2['image_rendition'] = arg_0.rendition.\\\n            image_rendition or 'original'\n        return arg_2", "path": "streamfield_tools/blocks/struct_block.py", "identifier": "RenditionAwareStructBlock.get_context", "docstring": "Ensure `image_rendition` is added to the global context.", "docstring_tokens": ["Ensure", "image_rendition", "is", "added", "to", "the", "global", "context", "."], "nwo": "WGBH/wagtail-streamfieldtools", "score": 0.23137166388621372, "idx": 252729}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/PC.py#L233-L276", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Setting up and running pc with all arguments.", "language": "python", "parameters": "(self, data, fixedEdges=None, fixedGaps=None, verbose=True)", "return_statement": "return pc_result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "True", ")", ":", "if", "(", "arg_0", ".", "arguments", "[", "'{CITEST}'", "]", "==", "arg_0", ".", "dir_CI_test", "[", "'hsic'", "]", "and", "arg_0", ".", "arguments", "[", "'{METHOD_INDEP}'", "]", "==", "arg_0", ".", "dir_method_indep", "[", "'corr'", "]", ")", ":", "warnings", ".", "warn", "(", "'Selected method for indep is unfit for the hsic test,'", "' setting the hsic.gamma method.'", ")", "arg_0", ".", "arguments", "[", "'{METHOD_INDEP}'", "]", "=", "arg_0", ".", "dir_method_indep", "[", "'hsic_gamma'", "]", "elif", "(", "arg_0", ".", "arguments", "[", "'{CITEST}'", "]", "==", "arg_0", ".", "dir_CI_test", "[", "'gaussian'", "]", "and", "arg_0", ".", "arguments", "[", "'{METHOD_INDEP}'", "]", "!=", "arg_0", ".", "dir_method_indep", "[", "'corr'", "]", ")", ":", "warnings", ".", "warn", "(", "'Selected method for indep is unfit for the selected test,'", "' setting the classic correlation-based method.'", ")", "arg_0", ".", "arguments", "[", "'{METHOD_INDEP}'", "]", "=", "arg_0", ".", "dir_method_indep", "[", "'corr'", "]", "arg_6", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "os", ".", "makedirs", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "'/'", ")", "arg_0", ".", "arguments", "[", "'{FOLDER}'", "]", "=", "'/tmp/cdt_pc'", "+", "arg_6", "+", "'/'", "def", "retrieve_result", "(", ")", ":", "return", "read_csv", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "'/result.csv'", ",", "delimiter", "=", "','", ")", ".", "values", "try", ":", "arg_1", ".", "to_csv", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "'/data.csv'", ",", "header", "=", "False", ",", "index", "=", "False", ")", "if", "arg_3", "is", "not", "None", "and", "arg_2", "is", "not", "None", ":", "arg_3", ".", "to_csv", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "'/fixedgaps.csv'", ",", "index", "=", "False", ",", "header", "=", "False", ")", "arg_2", ".", "to_csv", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "'/fixededges.csv'", ",", "index", "=", "False", ",", "header", "=", "False", ")", "arg_0", ".", "arguments", "[", "'{SKELETON}'", "]", "=", "'TRUE'", "else", ":", "arg_0", ".", "arguments", "[", "'{SKELETON}'", "]", "=", "'FALSE'", "arg_7", "=", "launch_R_script", "(", "\"{}/R_templates/pc.R\"", ".", "format", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ")", ",", "arg_0", ".", "arguments", ",", "output_function", "=", "retrieve_result", ",", "arg_4", "=", "arg_4", ")", "except", "Exception", "as", "e", ":", "rmtree", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "''", ")", "raise", "e", "except", "KeyboardInterrupt", ":", "rmtree", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "'/'", ")", "raise", "KeyboardInterrupt", "rmtree", "(", "'/tmp/cdt_pc'", "+", "arg_6", "+", "''", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=True):\n        \"\"\"Setting up and running pc with all arguments.\"\"\"\n        # Checking coherence of arguments\n        # print(self.arguments)\n        if (arg_0.arguments['{CITEST}'] == arg_0.dir_CI_test['hsic']\n           and arg_0.arguments['{METHOD_INDEP}'] == arg_0.dir_method_indep['corr']):\n            warnings.warn('Selected method for indep is unfit for the hsic test,'\n                          ' setting the hsic.gamma method.')\n            arg_0.arguments['{METHOD_INDEP}'] = arg_0.dir_method_indep['hsic_gamma']\n\n        elif (arg_0.arguments['{CITEST}'] == arg_0.dir_CI_test['gaussian']\n              and arg_0.arguments['{METHOD_INDEP}'] != arg_0.dir_method_indep['corr']):\n            warnings.warn('Selected method for indep is unfit for the selected test,'\n                          ' setting the classic correlation-based method.')\n            arg_0.arguments['{METHOD_INDEP}'] = arg_0.dir_method_indep['corr']\n\n        # Run PC\n        arg_6 = str(uuid.uuid4())\n        os.makedirs('/tmp/cdt_pc' + arg_6 + '/')\n        arg_0.arguments['{FOLDER}'] = '/tmp/cdt_pc' + arg_6 + '/'\n\n        def retrieve_result():\n            return read_csv('/tmp/cdt_pc' + arg_6 + '/result.csv', delimiter=',').values\n\n        try:\n            arg_1.to_csv('/tmp/cdt_pc' + arg_6 + '/data.csv', header=False, index=False)\n            if arg_3 is not None and arg_2 is not None:\n                arg_3.to_csv('/tmp/cdt_pc' + arg_6 + '/fixedgaps.csv', index=False, header=False)\n                arg_2.to_csv('/tmp/cdt_pc' + arg_6 + '/fixededges.csv', index=False, header=False)\n                arg_0.arguments['{SKELETON}'] = 'TRUE'\n            else:\n                arg_0.arguments['{SKELETON}'] = 'FALSE'\n\n            arg_7 = launch_R_script(\"{}/R_templates/pc.R\".format(os.path.dirname(os.path.realpath(__file__))),\n                                        arg_0.arguments, output_function=retrieve_result, arg_4=arg_4)\n        # Cleanup\n        except Exception as e:\n            rmtree('/tmp/cdt_pc' + arg_6 + '')\n            raise e\n        except KeyboardInterrupt:\n            rmtree('/tmp/cdt_pc' + arg_6 + '/')\n            raise KeyboardInterrupt\n        rmtree('/tmp/cdt_pc' + arg_6 + '')\n        return arg_7", "path": "cdt/causality/graph/PC.py", "identifier": "PC._run_pc", "docstring": "Setting up and running pc with all arguments.", "docstring_tokens": ["Setting", "up", "and", "running", "pc", "with", "all", "arguments", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 252730}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/validators.py#L35-L42", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Checks that the given zone contains the required fields", "language": "python", "parameters": "(zone)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "has_valid_id", "(", "arg_0", ")", ":", "raise", "InvalidZone", "(", "\"%s must contain a valid 'id' attribute\"", "%", "arg_0", ".", "__name__", ")", "if", "not", "has_valid_name", "(", "arg_0", ")", ":", "raise", "InvalidZone", "(", "\"%s must contain a valid 'name' attribute\"", "%", "arg_0", ".", "__name__", ")"], "function": "def Func(arg_0):\n    \"\"\"Checks that the given zone contains the required fields\"\"\"\n\n    if not has_valid_id(arg_0):\n        raise InvalidZone(\"%s must contain a valid 'id' attribute\" % arg_0.__name__)\n\n    if not has_valid_name(arg_0):\n        raise InvalidZone(\"%s must contain a valid 'name' attribute\" % arg_0.__name__)", "path": "dispatch/theme/validators.py", "identifier": "validate_zone", "docstring": "Checks that the given zone contains the required fields", "docstring_tokens": ["Checks", "that", "the", "given", "zone", "contains", "the", "required", "fields"], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 252731}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/internal/decoder.py#L645-L715", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Returns a decoder for a MessageSet item.", "language": "python", "parameters": "(extensions_by_number)", "return_statement": "return DecodeItem", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "encoder", ".", "TagBytes", "(", "2", ",", "wire_format", ".", "WIRETYPE_VARINT", ")", "arg_2", "=", "encoder", ".", "TagBytes", "(", "3", ",", "wire_format", ".", "WIRETYPE_LENGTH_DELIMITED", ")", "arg_3", "=", "encoder", ".", "TagBytes", "(", "1", ",", "wire_format", ".", "WIRETYPE_END_GROUP", ")", "arg_4", "=", "ReadTag", "arg_5", "=", "_DecodeVarint", "arg_6", "=", "SkipField", "def", "DecodeItem", "(", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ")", ":", "arg_12", "=", "arg_8", "arg_13", "=", "-", "1", "arg_14", "=", "-", "1", "arg_15", "=", "-", "1", "while", "1", ":", "(", "arg_16", ",", "arg_8", ")", "=", "arg_4", "(", "arg_7", ",", "arg_8", ")", "if", "arg_16", "==", "arg_1", ":", "(", "arg_13", ",", "arg_8", ")", "=", "arg_5", "(", "arg_7", ",", "arg_8", ")", "elif", "arg_16", "==", "arg_2", ":", "(", "arg_17", ",", "arg_14", ")", "=", "arg_5", "(", "arg_7", ",", "arg_8", ")", "arg_8", "=", "arg_15", "=", "arg_14", "+", "arg_17", "elif", "arg_16", "==", "arg_3", ":", "break", "else", ":", "arg_8", "=", "SkipField", "(", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_16", ")", "if", "arg_8", "==", "-", "1", ":", "raise", "_DecodeError", "(", "'Missing group end tag.'", ")", "if", "arg_8", ">", "arg_9", ":", "raise", "_DecodeError", "(", "'Truncated message.'", ")", "if", "arg_13", "==", "-", "1", ":", "raise", "_DecodeError", "(", "'MessageSet item missing type_id.'", ")", "if", "arg_14", "==", "-", "1", ":", "raise", "_DecodeError", "(", "'MessageSet item missing message.'", ")", "arg_18", "=", "arg_0", ".", "get", "(", "arg_13", ")", "if", "arg_18", "is", "not", "None", ":", "arg_19", "=", "arg_11", ".", "get", "(", "arg_18", ")", "if", "arg_19", "is", "None", ":", "arg_19", "=", "arg_11", ".", "setdefault", "(", "arg_18", ",", "arg_18", ".", "message_type", ".", "_concrete_class", "(", ")", ")", "if", "arg_19", ".", "_InternalParse", "(", "arg_7", ",", "arg_14", ",", "arg_15", ")", "!=", "arg_15", ":", "raise", "_DecodeError", "(", "'Unexpected end-group tag.'", ")", "else", ":", "if", "not", "arg_10", ".", "_unknown_fields", ":", "arg_10", ".", "_unknown_fields", "=", "[", "]", "arg_10", ".", "_unknown_fields", ".", "append", "(", "(", "MESSAGE_SET_ITEM_TAG", ",", "arg_7", "[", "arg_12", ":", "arg_8", "]", ")", ")", "return", "arg_8", "return", "DecodeItem"], "function": "def Func(arg_0):\n  \"\"\"Returns a decoder for a MessageSet item.\n\n  The parameter is the _extensions_by_number map for the message class.\n\n  The message set message looks like this:\n    message MessageSet {\n      repeated group Item = 1 {\n        required int32 type_id = 2;\n        required string message = 3;\n      }\n    }\n  \"\"\"\n\n  arg_1 = encoder.TagBytes(2, wire_format.WIRETYPE_VARINT)\n  arg_2 = encoder.TagBytes(3, wire_format.WIRETYPE_LENGTH_DELIMITED)\n  arg_3 = encoder.TagBytes(1, wire_format.WIRETYPE_END_GROUP)\n\n  arg_4 = ReadTag\n  arg_5 = _DecodeVarint\n  arg_6 = SkipField\n\n  def DecodeItem(arg_7, arg_8, arg_9, arg_10, arg_11):\n    arg_12 = arg_8\n    arg_13 = -1\n    arg_14 = -1\n    arg_15 = -1\n\n    # Technically, type_id and message can appear in any order, so we need\n    # a little loop here.\n    while 1:\n      (arg_16, arg_8) = arg_4(arg_7, arg_8)\n      if arg_16 == arg_1:\n        (arg_13, arg_8) = arg_5(arg_7, arg_8)\n      elif arg_16 == arg_2:\n        (arg_17, arg_14) = arg_5(arg_7, arg_8)\n        arg_8 = arg_15 = arg_14 + arg_17\n      elif arg_16 == arg_3:\n        break\n      else:\n        arg_8 = SkipField(arg_7, arg_8, arg_9, arg_16)\n        if arg_8 == -1:\n          raise _DecodeError('Missing group end tag.')\n\n    if arg_8 > arg_9:\n      raise _DecodeError('Truncated message.')\n\n    if arg_13 == -1:\n      raise _DecodeError('MessageSet item missing type_id.')\n    if arg_14 == -1:\n      raise _DecodeError('MessageSet item missing message.')\n\n    arg_18 = arg_0.get(arg_13)\n    if arg_18 is not None:\n      arg_19 = arg_11.get(arg_18)\n      if arg_19 is None:\n        arg_19 = arg_11.setdefault(\n            arg_18, arg_18.message_type._concrete_class())\n      if arg_19._InternalParse(arg_7, arg_14,arg_15) != arg_15:\n        # The only reason _InternalParse would return early is if it encountered\n        # an end-group tag.\n        raise _DecodeError('Unexpected end-group tag.')\n    else:\n      if not arg_10._unknown_fields:\n        arg_10._unknown_fields = []\n      arg_10._unknown_fields.append((MESSAGE_SET_ITEM_TAG,\n                                      arg_7[arg_12:arg_8]))\n\n    return arg_8\n\n  return DecodeItem", "path": "typy/google/protobuf/internal/decoder.py", "identifier": "MessageSetItemDecoder", "docstring": "Returns a decoder for a MessageSet item.\n\n  The parameter is the _extensions_by_number map for the message class.\n\n  The message set message looks like this:\n    message MessageSet {\n      repeated group Item = 1 {\n        required int32 type_id = 2;\n        required string message = 3;\n      }\n    }", "docstring_tokens": ["Returns", "a", "decoder", "for", "a", "MessageSet", "item", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 252732}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/mat.py#L268-L302", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "send the model to a MATLAB workspace through pymatbridge", "language": "python", "parameters": "(model, variable_name=\"model\", matlab=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"model\"", ",", "arg_2", "=", "None", ")", ":", "if", "scipy_sparse", "is", "None", ":", "raise", "ImportError", "(", "\"`Func` requires scipy!\"", ")", "if", "arg_2", "is", "None", ":", "from", "IPython", "import", "get_ipython", "arg_2", "=", "get_ipython", "(", ")", ".", "magics_manager", ".", "registry", "[", "\"MatlabMagics\"", "]", ".", "Matlab", "arg_3", "=", "create_mat_dict", "(", "arg_0", ")", "arg_4", "=", "arg_3", "[", "\"S\"", "]", ".", "todok", "(", ")", "arg_3", "[", "\"S\"", "]", "=", "0", "arg_5", "=", "\"cobra_pymatbridge_temp_\"", "+", "uuid4", "(", ")", ".", "hex", "_check", "(", "arg_2", ".", "set_variable", "(", "arg_1", ",", "arg_3", ")", ")", "_check", "(", "arg_2", ".", "set_variable", "(", "arg_5", ",", "arg_4", ")", ")", "_check", "(", "arg_2", ".", "run_code", "(", "\"%s.S = %s;\"", "%", "(", "arg_1", ",", "arg_5", ")", ")", ")", "for", "arg_6", "in", "arg_3", ".", "keys", "(", ")", ":", "if", "arg_6", "==", "\"S\"", ":", "continue", "_check", "(", "arg_2", ".", "run_code", "(", "\"{0}.{1} = {0}.{1}';\"", ".", "format", "(", "arg_1", ",", "arg_6", ")", ")", ")", "_check", "(", "arg_2", ".", "run_code", "(", "\"clear %s;\"", "%", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1=\"model\", arg_2=None):\n    \"\"\"send the model to a MATLAB workspace through pymatbridge\n\n    This model can then be manipulated through the COBRA toolbox\n\n    Parameters\n    ----------\n    variable_name : str\n        The variable name to which the model will be assigned in the\n        MATLAB workspace\n\n    matlab : None or pymatbridge.Matlab instance\n        The MATLAB workspace to which the variable will be sent. If\n        this is None, then this will be sent to the same environment\n        used in IPython magics.\n\n    \"\"\"\n    if scipy_sparse is None:\n        raise ImportError(\"`Func` requires scipy!\")\n    if arg_2 is None:  # assumed to be running an IPython magic\n        from IPython import get_ipython\n        arg_2 = get_ipython().magics_manager.registry[\"MatlabMagics\"].Matlab\n    arg_3 = create_mat_dict(arg_0)\n    arg_4 = arg_3[\"S\"].todok()\n    arg_3[\"S\"] = 0\n    arg_5 = \"cobra_pymatbridge_temp_\" + uuid4().hex\n    _check(arg_2.set_variable(arg_1, arg_3))\n    _check(arg_2.set_variable(arg_5, arg_4))\n    _check(arg_2.run_code(\"%s.S = %s;\" % (arg_1, arg_5)))\n    # all vectors need to be transposed\n    for arg_6 in arg_3.keys():\n        if arg_6 == \"S\":\n            continue\n        _check(arg_2.run_code(\"{0}.{1} = {0}.{1}';\".format(arg_1, arg_6)))\n    _check(arg_2.run_code(\"clear %s;\" % arg_5))", "path": "cobra/io/mat.py", "identifier": "model_to_pymatbridge", "docstring": "send the model to a MATLAB workspace through pymatbridge\n\n    This model can then be manipulated through the COBRA toolbox\n\n    Parameters\n    ----------\n    variable_name : str\n        The variable name to which the model will be assigned in the\n        MATLAB workspace\n\n    matlab : None or pymatbridge.Matlab instance\n        The MATLAB workspace to which the variable will be sent. If\n        this is None, then this will be sent to the same environment\n        used in IPython magics.", "docstring_tokens": ["send", "the", "model", "to", "a", "MATLAB", "workspace", "through", "pymatbridge"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 252733}
{"url": "https://github.com/Kappa-Dev/KaSim/blob/12a01c616a47e3046323103625795fb2fca8273a/python/kappy/kappa_common.py#L244-L264", "sha": "12a01c616a47e3046323103625795fb2fca8273a", "docstring_summary": "Make api method docs inheritted.", "language": "python", "parameters": "(this_abc, child_class)", "return_statement": "return child_class", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "5", ")", ":", "return", "arg_1", "if", "not", "issubclass", "(", "arg_1", ",", "arg_0", ")", ":", "raise", "KappaError", "(", "'Cannot fix docs of class that is not decendent.'", ")", "for", "arg_2", ",", "arg_3", "in", "vars", "(", "arg_1", ")", ".", "items", "(", ")", ":", "if", "callable", "(", "arg_3", ")", "and", "not", "arg_3", ".", "__doc__", ":", "if", "arg_2", "in", "arg_0", ".", "__abstractmethods__", ":", "arg_4", "=", "getattr", "(", "arg_0", ",", "arg_2", ")", "arg_3", ".", "__doc__", "=", "arg_4", ".", "__doc__", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Make api method docs inheritted.\n\n        Specifically, insepect.getdoc will return values inheritted from this\n        abc for standardized api methods.\n        \"\"\"\n        # After python 3.5, this is basically handled automatically\n        if sys.version_info >= (3, 5):\n            return arg_1\n\n        if not issubclass(arg_1, arg_0):\n            raise KappaError('Cannot fix docs of class that is not decendent.')\n\n        # This method is modified from solution given in\n        # https://stackoverflow.com/a/8101598/8863865\n        for arg_2, arg_3 in vars(arg_1).items():\n            if callable(arg_3) and not arg_3.__doc__:\n                if arg_2 in arg_0.__abstractmethods__:\n                    arg_4 = getattr(arg_0, arg_2)\n                    arg_3.__doc__ = arg_4.__doc__\n        return arg_1", "path": "python/kappy/kappa_common.py", "identifier": "KappaApi._fix_docs", "docstring": "Make api method docs inheritted.\n\n        Specifically, insepect.getdoc will return values inheritted from this\n        abc for standardized api methods.", "docstring_tokens": ["Make", "api", "method", "docs", "inheritted", "."], "nwo": "Kappa-Dev/KaSim", "score": 0.5441421983768713, "idx": 252734}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L110-L118", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "Clears the input and output buffers", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "_port", ".", "reset_input_buffer", "(", ")", "arg_0", ".", "_port", ".", "reset_output_buffer", "(", ")", "except", "AttributeError", ":", "arg_0", ".", "_port", ".", "flushInput", "(", ")", "arg_0", ".", "_port", ".", "flushOutput", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Clears the input and output buffers\"\"\"\n        try:\n            arg_0._port.reset_input_buffer()\n            arg_0._port.reset_output_buffer()\n        except AttributeError:\n            #pySerial 2.7\n            arg_0._port.flushInput()\n            arg_0._port.flushOutput()", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.__clear_buffers", "docstring": "Clears the input and output buffers", "docstring_tokens": ["Clears", "the", "input", "and", "output", "buffers"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 252735}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmdlet.py#L199-L212", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "Get item creator according registered item type.", "language": "python", "parameters": "(item_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "not", "in", "Pipe", ".", "pipe_item_types", ":", "for", "arg_1", "in", "Pipe", ".", "pipe_item_types", ":", "if", "issubclass", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Pipe", ".", "pipe_item_types", "[", "arg_1", "]", "return", "None", "else", ":", "return", "Pipe", ".", "pipe_item_types", "[", "arg_0", "]"], "function": "def Func(arg_0):\n    \"\"\"Get item creator according registered item type.\n\n    :param item_type: The type of item to be checed.\n    :type item_type: types.TypeType.\n    :returns: Creator function. None if type not found.\n    \"\"\"\n    if arg_0 not in Pipe.pipe_item_types:\n        for arg_1 in Pipe.pipe_item_types:\n            if issubclass(arg_0, arg_1):\n                return Pipe.pipe_item_types[arg_1]\n        return None\n    else:\n        return Pipe.pipe_item_types[arg_0]", "path": "cmdlet/cmdlet.py", "identifier": "get_item_creator", "docstring": "Get item creator according registered item type.\n\n    :param item_type: The type of item to be checed.\n    :type item_type: types.TypeType.\n    :returns: Creator function. None if type not found.", "docstring_tokens": ["Get", "item", "creator", "according", "registered", "item", "type", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 252736}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/graph/graph_wrapper.py#L356-L425", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Draws the graph.", "language": "python", "parameters": "(self, line_kwargs=None, scatter_kwargs=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "not", "HAS_MATPLOTLIB", ":", "raise", "ImportError", "(", "\"Matplotlib is required to draw the graph.\"", ")", "arg_4", "=", "plt", ".", "figure", "(", "figsize", "=", "arg_3", ".", "get", "(", "'figsize'", ",", "(", "7", ",", "7", ")", ")", ")", "arg_5", "=", "arg_4", ".", "gca", "(", ")", "arg_6", "=", "{", "'line_kwargs'", ":", "arg_1", ",", "'scatter_kwargs'", ":", "arg_2", ",", "'pos'", ":", "arg_3", ".", "get", "(", "'pos'", ")", "}", "arg_1", ",", "arg_2", "=", "arg_0", ".", "lines_scatter_args", "(", "**", "arg_6", ")", "arg_7", "=", "LineCollection", "(", "**", "arg_1", ")", "arg_5", ".", "add_collection", "(", "arg_7", ")", "arg_5", ".", "scatter", "(", "**", "arg_2", ")", "if", "hasattr", "(", "arg_5", ",", "'set_facecolor'", ")", ":", "arg_5", ".", "set_facecolor", "(", "arg_3", ".", "get", "(", "'bgcolor'", ",", "[", "1", ",", "1", ",", "1", ",", "1", "]", ")", ")", "else", ":", "arg_5", ".", "set_axis_bgcolor", "(", "arg_3", ".", "get", "(", "'bgcolor'", ",", "[", "1", ",", "1", ",", "1", ",", "1", "]", ")", ")", "arg_5", ".", "get_xaxis", "(", ")", ".", "set_visible", "(", "False", ")", "arg_5", ".", "get_yaxis", "(", ")", ".", "set_visible", "(", "False", ")", "if", "'fname'", "in", "arg_3", ":", "arg_8", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "arg_3", ".", "items", "(", ")", "if", "k", "in", "SAVEFIG_KWARGS", "}", "arg_4", ".", "savefig", "(", "arg_3", "[", "'fname'", "]", ",", "**", "arg_8", ")", "else", ":", "plt", ".", "ion", "(", ")", "plt", ".", "show", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, **arg_3):\n        \"\"\"Draws the graph.\n\n        Uses matplotlib, specifically\n        :class:`~matplotlib.collections.LineCollection` and\n        :meth:`~matplotlib.axes.Axes.scatter`. Gets the default\n        keyword arguments for both methods by calling\n        :meth:`~.QueueNetworkDiGraph.lines_scatter_args` first.\n\n        Parameters\n        ----------\n        line_kwargs : dict (optional, default: ``None``)\n            Any keyword arguments accepted by\n            :class:`~matplotlib.collections.LineCollection`\n        scatter_kwargs : dict (optional, default: ``None``)\n            Any keyword arguments accepted by\n            :meth:`~matplotlib.axes.Axes.scatter`.\n        bgcolor : list (optional, keyword only)\n            A list with 4 floats representing a RGBA color. Defaults\n            to ``[1, 1, 1, 1]``.\n        figsize : tuple (optional, keyword only, default: ``(7, 7)``)\n            The width and height of the figure in inches.\n        kwargs :\n            Any keyword arguments used by\n            :meth:`~matplotlib.figure.Figure.savefig`.\n\n        Raises\n        ------\n        ImportError :\n            If Matplotlib is not installed then an :exc:`ImportError`\n            is raised.\n\n        Notes\n        -----\n        If the ``fname`` keyword is passed, then the figure is saved\n        locally.\n        \"\"\"\n        if not HAS_MATPLOTLIB:\n            raise ImportError(\"Matplotlib is required to draw the graph.\")\n\n        arg_4 = plt.figure(figsize=arg_3.get('figsize', (7, 7)))\n        arg_5 = arg_4.gca()\n\n        arg_6 = {\n            'line_kwargs': arg_1,\n            'scatter_kwargs': arg_2,\n            'pos': arg_3.get('pos')\n        }\n\n        arg_1, arg_2 = arg_0.lines_scatter_args(**arg_6)\n\n        arg_7 = LineCollection(**arg_1)\n        arg_5.add_collection(arg_7)\n        arg_5.scatter(**arg_2)\n\n        if hasattr(arg_5, 'set_facecolor'):\n            arg_5.set_facecolor(arg_3.get('bgcolor', [1, 1, 1, 1]))\n        else:\n            arg_5.set_axis_bgcolor(arg_3.get('bgcolor', [1, 1, 1, 1]))\n\n        arg_5.get_xaxis().set_visible(False)\n        arg_5.get_yaxis().set_visible(False)\n\n        if 'fname' in arg_3:\n            # savefig needs a positional argument for some reason\n            arg_8 = {k: v for k, v in arg_3.items() if k in SAVEFIG_KWARGS}\n            arg_4.savefig(arg_3['fname'], **arg_8)\n        else:\n            plt.ion()\n            plt.show()", "path": "queueing_tool/graph/graph_wrapper.py", "identifier": "QueueNetworkDiGraph.draw_graph", "docstring": "Draws the graph.\n\n        Uses matplotlib, specifically\n        :class:`~matplotlib.collections.LineCollection` and\n        :meth:`~matplotlib.axes.Axes.scatter`. Gets the default\n        keyword arguments for both methods by calling\n        :meth:`~.QueueNetworkDiGraph.lines_scatter_args` first.\n\n        Parameters\n        ----------\n        line_kwargs : dict (optional, default: ``None``)\n            Any keyword arguments accepted by\n            :class:`~matplotlib.collections.LineCollection`\n        scatter_kwargs : dict (optional, default: ``None``)\n            Any keyword arguments accepted by\n            :meth:`~matplotlib.axes.Axes.scatter`.\n        bgcolor : list (optional, keyword only)\n            A list with 4 floats representing a RGBA color. Defaults\n            to ``[1, 1, 1, 1]``.\n        figsize : tuple (optional, keyword only, default: ``(7, 7)``)\n            The width and height of the figure in inches.\n        kwargs :\n            Any keyword arguments used by\n            :meth:`~matplotlib.figure.Figure.savefig`.\n\n        Raises\n        ------\n        ImportError :\n            If Matplotlib is not installed then an :exc:`ImportError`\n            is raised.\n\n        Notes\n        -----\n        If the ``fname`` keyword is passed, then the figure is saved\n        locally.", "docstring_tokens": ["Draws", "the", "graph", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 252737}
{"url": "https://github.com/ambitioninc/django-activatable-model/blob/2c142430949a923a69201f4914a6b73a642b4b48/activatable_model/validation.py#L14-L43", "sha": "2c142430949a923a69201f4914a6b73a642b4b48", "docstring_summary": "Raises a ValidationError for any ActivatableModel that has ForeignKeys or OneToOneFields that will\n    cause cascading deletions to occur. This function also raises a ValidationError if the activatable\n    model has not defined a Boolean field with the field name defined by the ACTIVATABLE_FIELD_NAME variable\n    on the model.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "for", "arg_0", "in", "get_activatable_models", "(", ")", ":", "arg_1", "=", "next", "(", "(", "f", "for", "f", "in", "arg_0", ".", "_meta", ".", "fields", "if", "f", ".", "__class__", "==", "models", ".", "BooleanField", "and", "f", ".", "name", "==", "arg_0", ".", "ACTIVATABLE_FIELD_NAME", ")", ",", "None", ")", "if", "arg_1", "is", "None", ":", "raise", "ValidationError", "(", "(", "'Model {0} is an activatable model. It must define an activatable BooleanField that '", "'has a field name of model.ACTIVATABLE_FIELD_NAME (which defaults to is_active)'", ".", "format", "(", "arg_0", ")", ")", ")", "if", "not", "arg_0", ".", "ALLOW_CASCADE_DELETE", ":", "for", "arg_2", "in", "arg_0", ".", "_meta", ".", "fields", ":", "if", "arg_2", ".", "__class__", "in", "(", "models", ".", "ForeignKey", ",", "models", ".", "OneToOneField", ")", ":", "if", "arg_2", ".", "remote_field", ".", "on_delete", "==", "models", ".", "CASCADE", ":", "raise", "ValidationError", "(", "(", "'Model {0} is an activatable model. All ForeignKey and OneToOneFields '", "'must set on_delete methods to something other than CASCADE (the default). '", "'If you want to explicitely allow cascade deletes, then you must set the '", "'ALLOW_CASCADE_DELETE=True class variable on your model.'", ")", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func():\n    \"\"\"\n    Raises a ValidationError for any ActivatableModel that has ForeignKeys or OneToOneFields that will\n    cause cascading deletions to occur. This function also raises a ValidationError if the activatable\n    model has not defined a Boolean field with the field name defined by the ACTIVATABLE_FIELD_NAME variable\n    on the model.\n    \"\"\"\n    for arg_0 in get_activatable_models():\n        # Verify the activatable model has an activatable boolean field\n        arg_1 = next((\n            f for f in arg_0._meta.fields\n            if f.__class__ == models.BooleanField and f.name == arg_0.ACTIVATABLE_FIELD_NAME\n        ), None)\n        if arg_1 is None:\n            raise ValidationError((\n                'Model {0} is an activatable model. It must define an activatable BooleanField that '\n                'has a field name of model.ACTIVATABLE_FIELD_NAME (which defaults to is_active)'.format(arg_0)\n            ))\n\n        # Ensure all foreign keys and onetoone fields will not result in cascade deletions if not cascade deletable\n        if not arg_0.ALLOW_CASCADE_DELETE:\n            for arg_2 in arg_0._meta.fields:\n                if arg_2.__class__ in (models.ForeignKey, models.OneToOneField):\n                    if arg_2.remote_field.on_delete == models.CASCADE:\n                        raise ValidationError((\n                            'Model {0} is an activatable model. All ForeignKey and OneToOneFields '\n                            'must set on_delete methods to something other than CASCADE (the default). '\n                            'If you want to explicitely allow cascade deletes, then you must set the '\n                            'ALLOW_CASCADE_DELETE=True class variable on your model.'\n                        ).format(arg_0))", "path": "activatable_model/validation.py", "identifier": "validate_activatable_models", "docstring": "Raises a ValidationError for any ActivatableModel that has ForeignKeys or OneToOneFields that will\n    cause cascading deletions to occur. This function also raises a ValidationError if the activatable\n    model has not defined a Boolean field with the field name defined by the ACTIVATABLE_FIELD_NAME variable\n    on the model.", "docstring_tokens": ["Raises", "a", "ValidationError", "for", "any", "ActivatableModel", "that", "has", "ForeignKeys", "or", "OneToOneFields", "that", "will", "cause", "cascading", "deletions", "to", "occur", ".", "This", "function", "also", "raises", "a", "ValidationError", "if", "the", "activatable", "model", "has", "not", "defined", "a", "Boolean", "field", "with", "the", "field", "name", "defined", "by", "the", "ACTIVATABLE_FIELD_NAME", "variable", "on", "the", "model", "."], "nwo": "ambitioninc/django-activatable-model", "score": 0.1832591465193378, "idx": 252738}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/imap_hook.py#L49-L66", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks the mail folder for mails containing attachments with the given name.", "language": "python", "parameters": "(self, name, mail_folder='INBOX', check_regex=False)", "return_statement": "return len(mail_attachments) > 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'INBOX'", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_0", ".", "_retrieve_mails_attachments_by_name", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "latest_only", "=", "True", ")", "return", "len", "(", "arg_4", ")", ">", "0"], "function": "def Func(arg_0, arg_1, arg_2='INBOX', arg_3=False):\n        \"\"\"\n        Checks the mail folder for mails containing attachments with the given name.\n\n        :param name: The name of the attachment that will be searched for.\n        :type name: str\n        :param mail_folder: The mail folder where to look at.\n        :type mail_folder: str\n        :param check_regex: Checks the name for a regular expression.\n        :type check_regex: bool\n        :returns: True if there is an attachment with the given name and False if not.\n        :rtype: bool\n        \"\"\"\n        arg_4 = arg_0._retrieve_mails_attachments_by_name(arg_1,\n                                                                    arg_2,\n                                                                    arg_3,\n                                                                    latest_only=True)\n        return len(arg_4) > 0", "path": "airflow/contrib/hooks/imap_hook.py", "identifier": "ImapHook.has_mail_attachment", "docstring": "Checks the mail folder for mails containing attachments with the given name.\n\n        :param name: The name of the attachment that will be searched for.\n        :type name: str\n        :param mail_folder: The mail folder where to look at.\n        :type mail_folder: str\n        :param check_regex: Checks the name for a regular expression.\n        :type check_regex: bool\n        :returns: True if there is an attachment with the given name and False if not.\n        :rtype: bool", "docstring_tokens": ["Checks", "the", "mail", "folder", "for", "mails", "containing", "attachments", "with", "the", "given", "name", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252739}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/json/encoder.py#L41-L47", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Return a JSON representation of a Python string", "language": "python", "parameters": "(s)", "return_statement": "return '\"' + ESCAPE.sub(replace, s) + '\"'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "replace", "(", "arg_1", ")", ":", "return", "ESCAPE_DCT", "[", "arg_1", ".", "group", "(", "0", ")", "]", "return", "'\"'", "+", "ESCAPE", ".", "sub", "(", "replace", ",", "arg_0", ")", "+", "'\"'"], "function": "def Func(arg_0):\n    \"\"\"Return a JSON representation of a Python string\n\n    \"\"\"\n    def replace(arg_1):\n        return ESCAPE_DCT[arg_1.group(0)]\n    return '\"' + ESCAPE.sub(replace, arg_0) + '\"'", "path": "third_party/stdlib/json/encoder.py", "identifier": "encode_basestring", "docstring": "Return a JSON representation of a Python string", "docstring_tokens": ["Return", "a", "JSON", "representation", "of", "a", "Python", "string"], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 252740}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/admin/api/views.py#L103-L117", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Change password for logged in django staff user", "language": "python", "parameters": "(self, request)", "return_statement": "return Response(status=status.HTTP_204_NO_CONTENT)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "PasswordChangeForm", "(", "arg_1", ".", "user", ",", "data", "=", "arg_1", ".", "data", ")", "if", "not", "arg_2", ".", "is_valid", "(", ")", ":", "raise", "serializers", ".", "ValidationError", "(", "arg_2", ".", "errors", ")", "arg_2", ".", "save", "(", ")", "update_session_auth_hash", "(", "arg_1", ",", "arg_2", ".", "user", ")", "return", "Response", "(", "status", "=", "status", ".", "HTTP_204_NO_CONTENT", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Change password for logged in django staff user\n        \"\"\"\n        # TODO: Decorate api with sensitive post parameters as Django admin do?\n\n        arg_2 = PasswordChangeForm(arg_1.user, data=arg_1.data)\n\n        if not arg_2.is_valid():\n            raise serializers.ValidationError(arg_2.errors)\n\n        arg_2.save()\n        update_session_auth_hash(arg_1, arg_2.user)\n\n        return Response(status=status.HTTP_204_NO_CONTENT)", "path": "bananas/admin/api/views.py", "identifier": "ChangePasswordAPI.create", "docstring": "Change password for logged in django staff user", "docstring_tokens": ["Change", "password", "for", "logged", "in", "django", "staff", "user"], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 252741}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/cli.py#L82-L103", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Decorate a CLI function that might require authentication.", "language": "python", "parameters": "(f)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", "(", "arg_1", ")", "except", "UnauthorizedException", "as", "e", ":", "arg_3", "=", "config_from_env", "(", "config_from_file", "(", ")", ")", "arg_4", "=", "_get_username", "(", "arg_1", ",", "arg_3", ")", "if", "arg_4", "is", "None", ":", "sys", ".", "exit", "(", "\"Please set a username (run `osf -h` for details).\"", ")", "else", ":", "sys", ".", "exit", "(", "\"You are not authorized to access this project.\"", ")", "return", "arg_2", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Decorate a CLI function that might require authentication.\n\n    Catches any UnauthorizedException raised, prints a helpful message and\n    then exits.\n    \"\"\"\n    @wraps(arg_0)\n    def wrapper(arg_1):\n        try:\n            arg_2 = arg_0(arg_1)\n        except UnauthorizedException as e:\n            arg_3 = config_from_env(config_from_file())\n            arg_4 = _get_username(arg_1, arg_3)\n\n            if arg_4 is None:\n                sys.exit(\"Please set a username (run `osf -h` for details).\")\n            else:\n                sys.exit(\"You are not authorized to access this project.\")\n\n        return arg_2\n\n    return wrapper", "path": "osfclient/cli.py", "identifier": "might_need_auth", "docstring": "Decorate a CLI function that might require authentication.\n\n    Catches any UnauthorizedException raised, prints a helpful message and\n    then exits.", "docstring_tokens": ["Decorate", "a", "CLI", "function", "that", "might", "require", "authentication", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 252742}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1278-L1283", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Get privileges of a local file", "language": "python", "parameters": "(self, source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "str", "(", "oct", "(", "os", ".", "stat", "(", "arg_1", ")", ".", "st_mode", ")", "[", "-", "3", ":", "]", ")", "except", "Exception", "as", "e", ":", "raise", "Failure", "(", "'Could not get stat for %s, error_message = %s'", ",", "arg_1", ",", "e", ")"], "function": "def Func(arg_0, arg_1):\n    '''Get privileges of a local file'''\n    try:\n      return str(oct(os.stat(arg_1).st_mode)[-3:])\n    except Exception as e:\n      raise Failure('Could not get stat for %s, error_message = %s', arg_1, e)", "path": "s4cmd.py", "identifier": "ThreadUtil.get_file_privilege", "docstring": "Get privileges of a local file", "docstring_tokens": ["Get", "privileges", "of", "a", "local", "file"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 252743}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L202-L215", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Retrieves a dataset file matching a provided file path", "language": "python", "parameters": "(self, dataset_id, file_path, version = None)", "return_statement": "return self.get_dataset_files(dataset_id, \"^{}$\".format(file_path), version_number=version)[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "return", "arg_0", ".", "Funcs", "(", "arg_1", ",", "\"^{}$\"", ".", "format", "(", "arg_2", ")", ",", "version_number", "=", "arg_3", ")", "[", "0", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = None):\n        \"\"\"\n        Retrieves a dataset file matching a provided file path\n\n        :param dataset_id: The id of the dataset to retrieve file from\n        :type dataset_id: int\n        :param file_path: The file path within the dataset\n        :type file_path: str\n        :param version: The dataset version to look for the file in. If nothing is supplied, the latest dataset version will be searched\n        :type version: int\n        :return: A dataset file matching the filepath provided\n        :rtype: :class:`DatasetFile`\n        \"\"\"\n        return arg_0.Funcs(arg_1, \"^{}$\".format(arg_2), version_number=arg_3)[0]", "path": "citrination_client/data/client.py", "identifier": "DataClient.get_dataset_file", "docstring": "Retrieves a dataset file matching a provided file path\n\n        :param dataset_id: The id of the dataset to retrieve file from\n        :type dataset_id: int\n        :param file_path: The file path within the dataset\n        :type file_path: str\n        :param version: The dataset version to look for the file in. If nothing is supplied, the latest dataset version will be searched\n        :type version: int\n        :return: A dataset file matching the filepath provided\n        :rtype: :class:`DatasetFile`", "docstring_tokens": ["Retrieves", "a", "dataset", "file", "matching", "a", "provided", "file", "path"], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 252744}
{"url": "https://github.com/creafz/django-social-widgets/blob/785c599621549f7b111d98f28ce3c7958c747dd1/social_widgets/templatetags/social_widgets.py#L122-L159", "sha": "785c599621549f7b111d98f28ce3c7958c747dd1", "docstring_summary": "Renders the selected social widget. You can specify optional settings\n    that will be passed  to widget template.", "language": "python", "parameters": "(parser, token)", "return_statement": "return SocialWidgetNode(args, kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "arg_3", "=", "arg_2", "[", "0", "]", "if", "len", "(", "arg_2", ")", "<", "2", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes at least one argument\"", "%", "arg_3", ")", "arg_4", "=", "[", "]", "arg_5", "=", "{", "}", "arg_2", "=", "arg_2", "[", "1", ":", "]", "if", "len", "(", "arg_2", ")", ":", "for", "arg_6", "in", "arg_2", ":", "arg_7", "=", "kwarg_re", ".", "match", "(", "arg_6", ")", "if", "not", "arg_7", ":", "raise", "TemplateSyntaxError", "(", "\"Malformed arguments to %s tag\"", "%", "arg_3", ")", "arg_8", ",", "arg_9", "=", "arg_7", ".", "groups", "(", ")", "if", "arg_8", ":", "arg_8", "=", "arg_8", ".", "replace", "(", "'-'", ",", "'_'", ")", "arg_5", "[", "arg_8", "]", "=", "arg_0", ".", "compile_filter", "(", "arg_9", ")", "else", ":", "arg_4", ".", "append", "(", "arg_0", ".", "compile_filter", "(", "arg_9", ")", ")", "return", "SocialWidgetNode", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Renders the selected social widget. You can specify optional settings\n    that will be passed  to widget template.\n\n    Sample usage:\n    {% Func widget_template ke1=val1 key2=val2 %}\n\n    For example to render Twitter follow button you can use code like this:\n    {% Func 'twitter/follow_button.html' username=\"ev\" %}\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    arg_3 = arg_2[0]\n\n    if len(arg_2) < 2:\n        raise TemplateSyntaxError(\"'%s' takes at least one argument\" %\n                                  arg_3)\n    arg_4 = []\n    arg_5 = {}\n\n    arg_2 = arg_2[1:]\n\n    if len(arg_2):\n        for arg_6 in arg_2:\n            arg_7 = kwarg_re.match(arg_6)\n            if not arg_7:\n                raise TemplateSyntaxError(\"Malformed arguments to %s tag\" %\n                                          arg_3)\n            arg_8, arg_9 = arg_7.groups()\n\n            if arg_8:\n                # Replacing hyphens with underscores because\n                # variable names cannot contain hyphens.\n                arg_8 = arg_8.replace('-', '_')\n                arg_5[arg_8] = arg_0.compile_filter(arg_9)\n            else:\n                arg_4.append(arg_0.compile_filter(arg_9))\n\n    return SocialWidgetNode(arg_4, arg_5)", "path": "social_widgets/templatetags/social_widgets.py", "identifier": "social_widget_render", "docstring": "Renders the selected social widget. You can specify optional settings\n    that will be passed  to widget template.\n\n    Sample usage:\n    {% social_widget_render widget_template ke1=val1 key2=val2 %}\n\n    For example to render Twitter follow button you can use code like this:\n    {% social_widget_render 'twitter/follow_button.html' username=\"ev\" %}", "docstring_tokens": ["Renders", "the", "selected", "social", "widget", ".", "You", "can", "specify", "optional", "settings", "that", "will", "be", "passed", "to", "widget", "template", "."], "nwo": "creafz/django-social-widgets", "score": 0.19606210544597788, "idx": 252745}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/expdict.py#L88-L110", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Set item of the dictionary.", "language": "python", "parameters": "(self, key, value, timeout = None, timeout_callback = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "with", "arg_0", ".", "_lock", ":", "logger", ".", "debug", "(", "\"expdict.__setitem__({0!r}, {1!r}, {2!r}, {3!r})\"", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "if", "not", "arg_3", ":", "arg_3", "=", "arg_0", ".", "_default_timeout", "arg_0", ".", "_timeouts", "[", "arg_1", "]", "=", "(", "time", ".", "time", "(", ")", "+", "arg_3", ",", "arg_4", ")", "return", "dict", ".", "__setitem__", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = None, arg_4 = None):\n        \"\"\"Set item of the dictionary.\n\n        :Parameters:\n            - `key`: the key.\n            - `value`: the object to store.\n            - `timeout`: timeout value for the object (in seconds from now).\n            - `timeout_callback`: function to be called when the item expires.\n              The callback should accept none, one (the key) or two (the key\n              and the value) arguments.\n        :Types:\n            - `key`: any hashable value\n            - `value`: any python object\n            - `timeout`: `int`\n            - `timeout_callback`: callable\n        \"\"\"\n        with arg_0._lock:\n            logger.debug(\"expdict.__setitem__({0!r}, {1!r}, {2!r}, {3!r})\"\n                            .format(arg_1, arg_2, arg_3, arg_4))\n            if not arg_3:\n                arg_3 = arg_0._default_timeout\n            arg_0._timeouts[arg_1] = (time.time() + arg_3, arg_4)\n            return dict.__setitem__(arg_0, arg_1, arg_2)", "path": "pyxmpp2/expdict.py", "identifier": "ExpiringDictionary.set_item", "docstring": "Set item of the dictionary.\n\n        :Parameters:\n            - `key`: the key.\n            - `value`: the object to store.\n            - `timeout`: timeout value for the object (in seconds from now).\n            - `timeout_callback`: function to be called when the item expires.\n              The callback should accept none, one (the key) or two (the key\n              and the value) arguments.\n        :Types:\n            - `key`: any hashable value\n            - `value`: any python object\n            - `timeout`: `int`\n            - `timeout_callback`: callable", "docstring_tokens": ["Set", "item", "of", "the", "dictionary", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 252746}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployment.py#L144-L165", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "This endpoint is used to set the health of an allocation that is in the deployment manually. In some use\n            cases, automatic detection of allocation health may not be desired. As such those task groups can be marked\n            with an upgrade policy that uses health_check = \"manual\". Those allocations must have their health marked\n            manually using this endpoint. Marking an allocation as healthy will allow the rolling upgrade to proceed.\n            Marking it as failed will cause the deployment to fail.", "language": "python", "parameters": "(self, id, healthy_allocations=list(), unhealthy_allocations=list())", "return_statement": "return self.request(\"allocation-health\", id, json=allocations, method=\"post\").json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", "(", ")", ",", "arg_4", "=", "arg_3", "(", ")", ")", ":", "arg_5", "=", "{", "\"HealthyAllocationIDs\"", ":", "arg_2", ",", "\"UnHealthyAllocationIDs\"", ":", "arg_4", ",", "\"DeploymentID\"", ":", "arg_1", "}", "return", "arg_0", ".", "request", "(", "\"allocation-health\"", ",", "arg_1", ",", "json", "=", "arg_5", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3(), arg_4=arg_3()):\n        \"\"\" This endpoint is used to set the health of an allocation that is in the deployment manually. In some use\n            cases, automatic detection of allocation health may not be desired. As such those task groups can be marked\n            with an upgrade policy that uses health_check = \"manual\". Those allocations must have their health marked\n            manually using this endpoint. Marking an allocation as healthy will allow the rolling upgrade to proceed.\n            Marking it as failed will cause the deployment to fail.\n\n           https://www.nomadproject.io/docs/http/deployments.html\n\n            arguments:\n              - id\n              - healthy_allocations, Specifies the set of allocation that should be marked as healthy.\n              - unhealthy_allocations,  Specifies the set of allocation that should be marked as unhealthy.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_5 = {\"HealthyAllocationIDs\": arg_2,\n                       \"UnHealthyAllocationIDs\": arg_4,\n                       \"DeploymentID\": arg_1}\n        return arg_0.request(\"allocation-health\", arg_1, json=arg_5, method=\"post\").json()", "path": "nomad/api/deployment.py", "identifier": "Deployment.deployment_allocation_health", "docstring": "This endpoint is used to set the health of an allocation that is in the deployment manually. In some use\n            cases, automatic detection of allocation health may not be desired. As such those task groups can be marked\n            with an upgrade policy that uses health_check = \"manual\". Those allocations must have their health marked\n            manually using this endpoint. Marking an allocation as healthy will allow the rolling upgrade to proceed.\n            Marking it as failed will cause the deployment to fail.\n\n           https://www.nomadproject.io/docs/http/deployments.html\n\n            arguments:\n              - id\n              - healthy_allocations, Specifies the set of allocation that should be marked as healthy.\n              - unhealthy_allocations,  Specifies the set of allocation that should be marked as unhealthy.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["This", "endpoint", "is", "used", "to", "set", "the", "health", "of", "an", "allocation", "that", "is", "in", "the", "deployment", "manually", ".", "In", "some", "use", "cases", "automatic", "detection", "of", "allocation", "health", "may", "not", "be", "desired", ".", "As", "such", "those", "task", "groups", "can", "be", "marked", "with", "an", "upgrade", "policy", "that", "uses", "health_check", "=", "manual", ".", "Those", "allocations", "must", "have", "their", "health", "marked", "manually", "using", "this", "endpoint", ".", "Marking", "an", "allocation", "as", "healthy", "will", "allow", "the", "rolling", "upgrade", "to", "proceed", ".", "Marking", "it", "as", "failed", "will", "cause", "the", "deployment", "to", "fail", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 252747}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/external_tools.py#L102-L114", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Delete the external tool identified by external_tool_id.", "language": "python", "parameters": "(self, context, context_id, external_tool_id)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "format", "(", "arg_2", ")", "+", "\"/external_tools/{}\"", ".", "format", "(", "arg_3", ")", "arg_5", "=", "arg_0", ".", "_delete_resource", "(", "arg_4", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Delete the external tool identified by external_tool_id.\n\n        context is either COURSES_API or ACCOUNTS_API.\n        context_id is the course_id or account_id, depending on context\n\n        https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.destroy\n        \"\"\"\n        arg_4 = arg_1.format(arg_2) + \"/external_tools/{}\".format(\n            arg_3)\n        arg_5 = arg_0._delete_resource(arg_4)\n        return True", "path": "uw_canvas/external_tools.py", "identifier": "ExternalTools._delete_external_tool", "docstring": "Delete the external tool identified by external_tool_id.\n\n        context is either COURSES_API or ACCOUNTS_API.\n        context_id is the course_id or account_id, depending on context\n\n        https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.destroy", "docstring_tokens": ["Delete", "the", "external", "tool", "identified", "by", "external_tool_id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 252748}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L598-L631", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Follow a set of marker data, yielding kinematic joint angles.", "language": "python", "parameters": "(self, start=0, end=1e100, states=None, max_force=20)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "1e100", ",", "arg_3", "=", "None", ",", "arg_4", "=", "20", ")", ":", "arg_5", "=", "None", "if", "arg_4", ">", "0", ":", "arg_0", ".", "skeleton", ".", "enable_motors", "(", "arg_4", ")", "arg_5", "=", "np", ".", "zeros", "(", "arg_0", ".", "skeleton", ".", "num_dofs", ")", "for", "arg_6", "in", "arg_0", ".", "follow_markers", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_5", "is", "not", "None", ":", "arg_0", ".", "skeleton", ".", "set_target_angles", "(", "arg_5", ")", "yield", "arg_0", ".", "skeleton", ".", "joint_angles"], "function": "def Func(arg_0, arg_1=0, arg_2=1e100, arg_3=None, arg_4=20):\n        '''Follow a set of marker data, yielding kinematic joint angles.\n\n        Parameters\n        ----------\n        start : int, optional\n            Start following marker data after this frame. Defaults to 0.\n        end : int, optional\n            Stop following marker data after this frame. Defaults to the end of\n            the marker data.\n        states : list of body states, optional\n            If given, set the states of the skeleton bodies to these values\n            before starting to follow the marker data.\n        max_force : float, optional\n            Allow each degree of freedom in the skeleton to exert at most this\n            force when attempting to maintain its equilibrium position. This\n            defaults to 20N. Set this value higher to simulate a stiff skeleton\n            while following marker data.\n\n        Returns\n        -------\n        angles : sequence of angle frames\n            Returns a generator of joint angle data for the skeleton. One set of\n            joint angles will be generated for each frame of marker data between\n            `start` and `end`.\n        '''\n        arg_5 = None\n        if arg_4 > 0:\n            arg_0.skeleton.enable_motors(arg_4)\n            arg_5 = np.zeros(arg_0.skeleton.num_dofs)\n        for arg_6 in arg_0.follow_markers(arg_1, arg_2, arg_3):\n            if arg_5 is not None:\n                arg_0.skeleton.set_target_angles(arg_5)\n            yield arg_0.skeleton.joint_angles", "path": "pagoda/cooper.py", "identifier": "World.inverse_kinematics", "docstring": "Follow a set of marker data, yielding kinematic joint angles.\n\n        Parameters\n        ----------\n        start : int, optional\n            Start following marker data after this frame. Defaults to 0.\n        end : int, optional\n            Stop following marker data after this frame. Defaults to the end of\n            the marker data.\n        states : list of body states, optional\n            If given, set the states of the skeleton bodies to these values\n            before starting to follow the marker data.\n        max_force : float, optional\n            Allow each degree of freedom in the skeleton to exert at most this\n            force when attempting to maintain its equilibrium position. This\n            defaults to 20N. Set this value higher to simulate a stiff skeleton\n            while following marker data.\n\n        Returns\n        -------\n        angles : sequence of angle frames\n            Returns a generator of joint angle data for the skeleton. One set of\n            joint angles will be generated for each frame of marker data between\n            `start` and `end`.", "docstring_tokens": ["Follow", "a", "set", "of", "marker", "data", "yielding", "kinematic", "joint", "angles", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 252749}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/resolver.py#L71-L97", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Randomly reorder SRV records using their weights.", "language": "python", "parameters": "(records)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "[", "]", "arg_1", "=", "[", "]", "while", "len", "(", "arg_0", ")", ">", "1", ":", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ":", "arg_2", "+=", "arg_3", ".", "weight", "+", "0.1", "arg_4", "=", "random", ".", "random", "(", ")", "*", "arg_2", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ":", "arg_2", "+=", "arg_3", ".", "weight", "+", "0.1", "if", "arg_4", "<", "arg_2", ":", "arg_0", ".", "remove", "(", "arg_3", ")", "arg_1", ".", "append", "(", "arg_3", ")", "break", "arg_1", ".", "append", "(", "arg_0", "[", "0", "]", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Randomly reorder SRV records using their weights.\n\n    :Parameters:\n        - `records`: SRV records to shuffle.\n    :Types:\n        - `records`: sequence of :dns:`dns.rdtypes.IN.SRV`\n\n    :return: reordered records.\n    :returntype: `list` of :dns:`dns.rdtypes.IN.SRV`\"\"\"\n    if not arg_0:\n        return []\n    arg_1 = []\n    while len(arg_0) > 1:\n        arg_2 = 0\n        for arg_3 in arg_0:\n            arg_2 += arg_3.weight + 0.1\n        arg_4 = random.random() * arg_2\n        arg_2 = 0\n        for arg_3 in arg_0:\n            arg_2 += arg_3.weight + 0.1\n            if arg_4 < arg_2:\n                arg_0.remove(arg_3)\n                arg_1.append(arg_3)\n                break\n    arg_1.append(arg_0[0])\n    return arg_1", "path": "pyxmpp2/resolver.py", "identifier": "shuffle_srv", "docstring": "Randomly reorder SRV records using their weights.\n\n    :Parameters:\n        - `records`: SRV records to shuffle.\n    :Types:\n        - `records`: sequence of :dns:`dns.rdtypes.IN.SRV`\n\n    :return: reordered records.\n    :returntype: `list` of :dns:`dns.rdtypes.IN.SRV`", "docstring_tokens": ["Randomly", "reorder", "SRV", "records", "using", "their", "weights", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 252750}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/commands/extended/get_new_addresses.py#L53-L73", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Find addresses matching the command parameters.", "language": "python", "parameters": "(self, seed, index, count, security_level, checksum)", "return_statement": "return generator.get_addresses(start=index, count=count)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "AddressGenerator", "(", "arg_1", ",", "arg_4", ",", "arg_5", ")", "if", "arg_3", "is", "None", ":", "for", "arg_7", "in", "arg_6", ".", "create_iterator", "(", "start", "=", "arg_2", ")", ":", "arg_8", "=", "FindTransactionsCommand", "(", "arg_0", ".", "adapter", ")", "(", "addresses", "=", "[", "arg_7", ".", "address", "]", ",", ")", "if", "not", "arg_8", ".", "get", "(", "'hashes'", ")", ":", "return", "[", "arg_7", "]", "return", "arg_6", ".", "get_addresses", "(", "start", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        # type: (Seed, int, Optional[int], int, bool) -> List[Address]\n        \"\"\"\n        Find addresses matching the command parameters.\n        \"\"\"\n        arg_6 = AddressGenerator(arg_1, arg_4, arg_5)\n\n        if arg_3 is None:\n            # Connect to Tangle and find the first address without any\n            # transactions.\n            for arg_7 in arg_6.create_iterator(start=arg_2):\n                # We use addy.address here because FindTransactions does\n                # not work on an address with a checksum\n                arg_8 = FindTransactionsCommand(arg_0.adapter)(\n                    addresses=[arg_7.address],\n                )\n\n                if not arg_8.get('hashes'):\n                    return [arg_7]\n\n        return arg_6.get_addresses(start=arg_2, arg_3=arg_3)", "path": "iota/commands/extended/get_new_addresses.py", "identifier": "GetNewAddressesCommand._find_addresses", "docstring": "Find addresses matching the command parameters.", "docstring_tokens": ["Find", "addresses", "matching", "the", "command", "parameters", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 252751}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/utils.py#L9-L15", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Properly Format Time for permlinks", "language": "python", "parameters": "(t)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "float", ")", ":", "return", "datetime", ".", "utcfromtimestamp", "(", "arg_0", ")", ".", "strftime", "(", "timeFormat", ")", "if", "isinstance", "(", "arg_0", ",", "datetime", ")", ":", "return", "arg_0", ".", "strftime", "(", "timeFormat", ")"], "function": "def Func(arg_0):\n    \"\"\" Properly Format Time for permlinks\n    \"\"\"\n    if isinstance(arg_0, float):\n        return datetime.utcfromtimestamp(arg_0).strftime(timeFormat)\n    if isinstance(arg_0, datetime):\n        return arg_0.strftime(timeFormat)", "path": "graphenecommon/utils.py", "identifier": "formatTime", "docstring": "Properly Format Time for permlinks", "docstring_tokens": ["Properly", "Format", "Time", "for", "permlinks"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 252752}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/player.py#L155-L165", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Registers the up and down handlers.\n        \n        Also registers a scheduled function every 60th of a second, causing pyglet to redraw your window with 60fps.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "peng", ".", "keybinds", ".", "add", "(", "arg_0", ".", "peng", ".", "cfg", "[", "\"controls.controls.crouch\"", "]", ",", "\"peng3d:actor.%s.player.controls.crouch\"", "%", "arg_0", ".", "actor", ".", "uuid", ",", "arg_0", ".", "on_crouch_down", ",", "False", ")", "arg_0", ".", "peng", ".", "keybinds", ".", "add", "(", "arg_0", ".", "peng", ".", "cfg", "[", "\"controls.controls.jump\"", "]", ",", "\"peng3d:actor.%s.player.controls.jump\"", "%", "arg_0", ".", "actor", ".", "uuid", ",", "arg_0", ".", "on_jump_down", ",", "False", ")", "pyglet", ".", "clock", ".", "schedule_interval", "(", "arg_0", ".", "update", ",", "1.0", "/", "60", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Registers the up and down handlers.\n        \n        Also registers a scheduled function every 60th of a second, causing pyglet to redraw your window with 60fps.\n        \"\"\"\n        # Crouch/fly down\n        arg_0.peng.keybinds.add(arg_0.peng.cfg[\"controls.controls.crouch\"],\"peng3d:actor.%s.player.controls.crouch\"%arg_0.actor.uuid,arg_0.on_crouch_down,False)\n        # Jump/fly up\n        arg_0.peng.keybinds.add(arg_0.peng.cfg[\"controls.controls.jump\"],\"peng3d:actor.%s.player.controls.jump\"%arg_0.actor.uuid,arg_0.on_jump_down,False)\n        pyglet.clock.schedule_interval(arg_0.update,1.0/60)", "path": "peng3d/actor/player.py", "identifier": "BasicFlightController.registerEventHandlers", "docstring": "Registers the up and down handlers.\n        \n        Also registers a scheduled function every 60th of a second, causing pyglet to redraw your window with 60fps.", "docstring_tokens": ["Registers", "the", "up", "and", "down", "handlers", ".", "Also", "registers", "a", "scheduled", "function", "every", "60th", "of", "a", "second", "causing", "pyglet", "to", "redraw", "your", "window", "with", "60fps", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 252753}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/safety.py#L405-L436", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "This function handles the retrieval of whether or not a chemical can\n    be absorbed through the skin, relevant to chemical safety calculations.", "language": "python", "parameters": "(CASRN, AvailableMethods=False, Method=None)", "return_statement": "return _Skin", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "def", "list_methods", "(", ")", ":", "arg_3", "=", "[", "]", "if", "arg_0", "in", "_OntarioExposureLimits", ":", "arg_3", ".", "append", "(", "ONTARIO", ")", "arg_3", ".", "append", "(", "NONE", ")", "return", "arg_3", "if", "arg_1", ":", "return", "list_methods", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_2", "==", "ONTARIO", ":", "arg_4", "=", "(", "_OntarioExposureLimits", "[", "arg_0", "]", "[", "\"Func\"", "]", ")", "elif", "arg_2", "==", "NONE", ":", "arg_4", "=", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=False, arg_2=None):  # pragma: no cover\n    '''This function handles the retrieval of whether or not a chemical can\n    be absorbed through the skin, relevant to chemical safety calculations.\n\n    This API is considered experimental, and is expected to be removed in a\n    future release in favor of a more complete object-oriented interface.\n\n    >>> Func('108-94-1')\n    True\n    >>> Func('1395-21-7')\n    False\n    >>> Func('7572-29-4', AvailableMethods=True)\n    ['Ontario Limits', 'None']\n    '''\n    def list_methods():\n        arg_3 = []\n        if arg_0 in _OntarioExposureLimits:\n            arg_3.append(ONTARIO)\n        arg_3.append(NONE)\n        return arg_3\n    if arg_1:\n        return list_methods()\n    if not arg_2:\n        arg_2 = list_methods()[0]\n\n    if arg_2 == ONTARIO:\n        arg_4 = (_OntarioExposureLimits[arg_0][\"Func\"])\n    elif arg_2 == NONE:\n        arg_4 = None\n    else:\n        raise Exception('Failure in in function')\n    return arg_4", "path": "thermo/safety.py", "identifier": "Skin", "docstring": "This function handles the retrieval of whether or not a chemical can\n    be absorbed through the skin, relevant to chemical safety calculations.\n\n    This API is considered experimental, and is expected to be removed in a\n    future release in favor of a more complete object-oriented interface.\n\n    >>> Skin('108-94-1')\n    True\n    >>> Skin('1395-21-7')\n    False\n    >>> Skin('7572-29-4', AvailableMethods=True)\n    ['Ontario Limits', 'None']", "docstring_tokens": ["This", "function", "handles", "the", "retrieval", "of", "whether", "or", "not", "a", "chemical", "can", "be", "absorbed", "through", "the", "skin", "relevant", "to", "chemical", "safety", "calculations", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 252754}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_spinn3r_feed_storage.py#L243-L298", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Given a single spinn3r feed entry, produce a single StreamItem.", "language": "python", "parameters": "(entry)", "return_statement": "return si", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'permalink_entry'", ")", ":", "return", "None", "arg_1", "=", "arg_0", ".", "permalink_entry", "arg_2", "=", "streamcorpus", ".", "make_stream_item", "(", "arg_1", ".", "date_found", "[", ":", "-", "1", "]", "+", "'.0Z'", ",", "arg_1", ".", "canonical_link", ".", "href", ".", "encode", "(", "'utf8'", ")", ")", "if", "not", "arg_2", ".", "stream_time", ":", "logger", ".", "debug", "(", "'failed to generate stream_time from {0!r}'", ".", "format", "(", "arg_1", ".", "date_found", ")", ")", "return", "None", "if", "not", "arg_2", ".", "abs_url", ":", "logger", ".", "debug", "(", "'failed to generate abs_url from {0!r}'", ".", "format", "(", "arg_1", ".", "canonical_link", ".", "href", ")", ")", "return", "None", "arg_2", ".", "body", "=", "_make_content_item", "(", "arg_1", ".", "content", ",", "alternate_data", "=", "arg_0", ".", "feed_entry", ".", "content", ".", "data", ")", "if", "not", "arg_2", ".", "body", ":", "return", "None", "if", "not", "arg_2", ".", "body", ".", "raw", ":", "return", "None", "if", "arg_1", ".", "content_extract", ".", "data", ":", "arg_2", ".", "other_content", "[", "'extract'", "]", "=", "_make_content_item", "(", "arg_1", ".", "content_extract", ")", "arg_2", ".", "other_content", "[", "'title'", "]", "=", "streamcorpus", ".", "ContentItem", "(", "raw", "=", "arg_1", ".", "title", ".", "encode", "(", "'utf8'", ")", ",", "media_type", "=", "arg_1", ".", "content_extract", ".", "mime_type", ",", "encoding", "=", "'UTF-8'", ")", "arg_2", ".", "other_content", "[", "'feed_entry_title'", "]", "=", "streamcorpus", ".", "ContentItem", "(", "raw", "=", "arg_0", ".", "feed_entry", ".", "title", ".", "encode", "(", "'utf8'", ")", ",", "media_type", "=", "arg_0", ".", "feed_entry", ".", "content", ".", "mime_type", ",", "encoding", "=", "'UTF-8'", ")", "if", "arg_0", ".", "feed_entry", ".", "content", ".", "data", ":", "arg_2", ".", "other_content", "[", "'feed_entry'", "]", "=", "_make_content_item", "(", "arg_0", ".", "feed_entry", ".", "content", ")", "arg_2", ".", "source_metadata", "[", "'lang'", "]", "=", "arg_1", ".", "lang", "[", "0", "]", ".", "code", "arg_2", ".", "source_metadata", "[", "'author'", "]", "=", "json", ".", "dumps", "(", "dict", "(", "name", "=", "arg_1", ".", "author", "[", "0", "]", ".", "name", ",", "email", "=", "arg_1", ".", "author", "[", "0", "]", ".", "email", ",", "link", "=", "arg_1", ".", "author", "[", "0", "]", ".", "link", "[", "0", "]", ".", "href", ",", ")", ")", "arg_2", ".", "source", "=", "arg_0", ".", "source", ".", "publisher_type", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Given a single spinn3r feed entry, produce a single StreamItem.\n\n    Returns 'None' if a complete item can't be constructed.\n\n    \"\"\"\n    # get standard metadata, assuming it's present...\n    if not hasattr(arg_0, 'permalink_entry'):\n        return None\n    arg_1 = arg_0.permalink_entry\n\n    # ...and create a streamitem...\n    arg_2 = streamcorpus.make_stream_item(\n        arg_1.date_found[:-1] + '.0Z',\n        arg_1.canonical_link.href.encode('utf8'))\n    if not arg_2.stream_time:\n        logger.debug('failed to generate stream_time from {0!r}'\n                     .format(arg_1.date_found))\n        return None\n    if not arg_2.abs_url:\n        logger.debug('failed to generate abs_url from {0!r}'\n                     .format(arg_1.canonical_link.href))\n        return None\n\n    # ...filling in the actual data\n    arg_2.body = _make_content_item(\n        arg_1.content,\n        alternate_data=arg_0.feed_entry.content.data)\n    if not arg_2.body:\n        return None\n    if not arg_2.body.raw:\n        return None\n\n    if arg_1.content_extract.data:\n        arg_2.other_content['extract'] = _make_content_item(arg_1.content_extract)\n    arg_2.other_content['title'] = streamcorpus.ContentItem(\n        raw=arg_1.title.encode('utf8'),\n        media_type=arg_1.content_extract.mime_type,\n        encoding='UTF-8')\n    arg_2.other_content['feed_entry_title'] = streamcorpus.ContentItem(\n        raw=arg_0.feed_entry.title.encode('utf8'),\n        media_type=arg_0.feed_entry.content.mime_type,\n        encoding='UTF-8')\n    if arg_0.feed_entry.content.data:\n        arg_2.other_content['feed_entry'] = _make_content_item(\n            arg_0.feed_entry.content)\n    arg_2.source_metadata['lang'] = arg_1.lang[0].code\n    arg_2.source_metadata['author'] = json.dumps(\n        dict(\n            name=arg_1.author[0].name,\n            email=arg_1.author[0].email,\n            link=arg_1.author[0].link[0].href,\n        )\n    )\n    arg_2.source = arg_0.source.publisher_type\n    return arg_2", "path": "streamcorpus_pipeline/_spinn3r_feed_storage.py", "identifier": "_make_stream_item", "docstring": "Given a single spinn3r feed entry, produce a single StreamItem.\n\n    Returns 'None' if a complete item can't be constructed.", "docstring_tokens": ["Given", "a", "single", "spinn3r", "feed", "entry", "produce", "a", "single", "StreamItem", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 252755}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/probe.py#L126-L131", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Replace child nodes on original function call with their partials", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "filter", "(", "lambda", "n", ":", "len", "(", "n", ".", "arg_name", ")", ",", "arg_0", ".", "child_list", ")", ":", "arg_0", ".", "data", "[", "\"bound_args\"", "]", ".", "arguments", "[", "arg_1", ".", "arg_name", "]", "=", "arg_1", ".", "partial", "(", ")", "arg_0", ".", "updated", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"Replace child nodes on original function call with their partials\"\"\"\n\n        for arg_1 in filter(lambda n: len(n.arg_name), arg_0.child_list):\n            arg_0.data[\"bound_args\"].arguments[arg_1.arg_name] = arg_1.partial()\n        arg_0.updated = True", "path": "pythonwhat/probe.py", "identifier": "Node.update_child_calls", "docstring": "Replace child nodes on original function call with their partials", "docstring_tokens": ["Replace", "child", "nodes", "on", "original", "function", "call", "with", "their", "partials"], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 252756}
{"url": "https://github.com/marcoagner/Flask-QRcode/blob/fbedf5a671d86cae7e446b10d612e319fc21162b/flask_qrcode/__init__.py#L162-L190", "sha": "fbedf5a671d86cae7e446b10d612e319fc21162b", "docstring_summary": "Inserts a small icon to QR Code image", "language": "python", "parameters": "(qr_img, icon_img=None, factor=4, icon_box=None, static_dir=None)", "return_statement": "return qr_img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "4", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "size", "arg_7", "=", "int", "(", "arg_5", ")", "/", "int", "(", "arg_2", ")", "arg_8", "=", "int", "(", "arg_6", ")", "/", "int", "(", "arg_2", ")", "try", ":", "arg_9", "=", "os", ".", "path", ".", "join", "(", "arg_1", ")", "if", "arg_4", ":", "arg_9", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_1", ")", "if", "arg_1", ".", "split", "(", "\"://\"", ")", "[", "0", "]", "in", "[", "\"http\"", ",", "\"https\"", ",", "\"ftp\"", "]", ":", "arg_9", "=", "BytesIO", "(", "urlopen", "(", "arg_1", ")", ".", "read", "(", ")", ")", "arg_10", "=", "Image", ".", "open", "(", "arg_9", ")", "except", ":", "return", "arg_0", "arg_11", ",", "arg_12", "=", "arg_10", ".", "size", "arg_11", "=", "arg_7", "if", "arg_11", ">", "arg_7", "else", "arg_11", "arg_12", "=", "arg_8", "if", "arg_12", ">", "arg_8", "else", "arg_12", "arg_10", "=", "arg_10", ".", "resize", "(", "(", "int", "(", "arg_11", ")", ",", "int", "(", "arg_12", ")", ")", ",", "Image", ".", "ANTIALIAS", ")", "arg_10", "=", "arg_10", ".", "convert", "(", "\"RGBA\"", ")", "arg_13", "=", "int", "(", "(", "arg_5", "-", "arg_11", ")", "/", "2", ")", "arg_14", "=", "int", "(", "(", "arg_6", "-", "arg_12", ")", "/", "2", ")", "arg_3", "=", "(", "int", "(", "arg_3", "[", "0", "]", ")", ",", "int", "(", "arg_3", "[", "1", "]", ")", ")", "if", "arg_3", "else", "(", "arg_13", ",", "arg_14", ")", "arg_0", ".", "paste", "(", "im", "=", "arg_10", ",", "box", "=", "arg_3", ",", "mask", "=", "arg_10", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None, arg_2=4, arg_3=None, arg_4=None):\n        \"\"\"Inserts a small icon to QR Code image\"\"\"\n        arg_5, arg_6 = arg_0.size\n        arg_7 = int(arg_5) / int(arg_2)\n        arg_8 = int(arg_6) / int(arg_2)\n\n        try:\n            # load icon from current dir\n            arg_9 = os.path.join(arg_1)\n            if arg_4:\n                # load icon from app's static dir\n                arg_9 = os.path.join(arg_4, arg_1)\n            if arg_1.split(\"://\")[0] in [\"http\", \"https\", \"ftp\"]:\n                arg_9 = BytesIO(urlopen(arg_1).read())  # download icon\n            arg_10 = Image.open(arg_9)\n        except:\n            return arg_0\n\n        arg_11, arg_12 = arg_10.size\n        arg_11 = arg_7 if arg_11 > arg_7 else arg_11\n        arg_12 = arg_8 if arg_12 > arg_8 else arg_12\n        arg_10 = arg_10.resize((int(arg_11), int(arg_12)), Image.ANTIALIAS)\n        arg_10 = arg_10.convert(\"RGBA\")\n\n        arg_13 = int((arg_5 - arg_11) / 2)\n        arg_14 = int((arg_6 - arg_12) / 2)\n        arg_3 = (int(arg_3[0]), int(arg_3[1])) if arg_3 else (arg_13, arg_14)\n        arg_0.paste(im=arg_10, box=arg_3, mask=arg_10)\n        return arg_0", "path": "flask_qrcode/__init__.py", "identifier": "QRcode._insert_img", "docstring": "Inserts a small icon to QR Code image", "docstring_tokens": ["Inserts", "a", "small", "icon", "to", "QR", "Code", "image"], "nwo": "marcoagner/Flask-QRcode", "score": 0.41167681348002233, "idx": 252757}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/commands.py#L33-L60", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Load all Service Fabric commands", "language": "python", "parameters": "(self, args)", "return_statement": "return OrderedDict(self.command_table)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "CommandSuperGroup", "(", "__name__", ",", "arg_0", ",", "'rcctl.custom_cluster#{}'", ")", "as", "super_group", ":", "with", "super_group", ".", "group", "(", "'cluster'", ")", "as", "group", ":", "group", ".", "command", "(", "'select'", ",", "'select'", ")", "with", "CommandSuperGroup", "(", "__name__", ",", "arg_0", ",", "'rcctl.custom_reliablecollections#{}'", ",", "client_factory", "=", "client_create", ")", "as", "super_group", ":", "with", "super_group", ".", "group", "(", "'dictionary'", ")", "as", "group", ":", "group", ".", "command", "(", "'query'", ",", "'query_reliabledictionary'", ")", "group", ".", "command", "(", "'execute'", ",", "'execute_reliabledictionary'", ")", "group", ".", "command", "(", "'schema'", ",", "'get_reliabledictionary_schema'", ")", "group", ".", "command", "(", "'list'", ",", "'get_reliabledictionary_list'", ")", "group", ".", "command", "(", "'type-schema'", ",", "'get_reliabledictionary_type_schema'", ")", "with", "ArgumentsContext", "(", "arg_0", ",", "'dictionary'", ")", "as", "ac", ":", "ac", ".", "argument", "(", "'application_name'", ",", "options_list", "=", "[", "'--application-name'", ",", "'-a'", "]", ")", "ac", ".", "argument", "(", "'service_name'", ",", "options_list", "=", "[", "'--service-name'", ",", "'-s'", "]", ")", "ac", ".", "argument", "(", "'dictionary_name'", ",", "options_list", "=", "[", "'--dictionary-name'", ",", "'-d'", "]", ")", "ac", ".", "argument", "(", "'output_file'", ",", "options_list", "=", "[", "'--output-file'", ",", "'-out'", "]", ")", "ac", ".", "argument", "(", "'input_file'", ",", "options_list", "=", "[", "'--input-file'", ",", "'-in'", "]", ")", "ac", ".", "argument", "(", "'query_string'", ",", "options_list", "=", "[", "'--query-string'", ",", "'-q'", "]", ")", "ac", ".", "argument", "(", "'type_name'", ",", "options_list", "=", "[", "'--type-name'", ",", "'-t'", "]", ")", "return", "OrderedDict", "(", "arg_0", ".", "command_table", ")"], "function": "def Func(arg_0, arg_1): #pylint: disable=too-many-statements\n        \"\"\"Load all Service Fabric commands\"\"\"\n\n        # Need an empty client for the select and upload operations\n        with CommandSuperGroup(__name__, arg_0,\n                               'rcctl.custom_cluster#{}') as super_group:\n            with super_group.group('cluster') as group:\n                group.command('select', 'select')\n\n        with CommandSuperGroup(__name__, arg_0, 'rcctl.custom_reliablecollections#{}',\n                               client_factory=client_create) as super_group: \n            with super_group.group('dictionary') as group:\n                group.command('query', 'query_reliabledictionary')\n                group.command('execute', 'execute_reliabledictionary')\n                group.command('schema', 'get_reliabledictionary_schema')\n                group.command('list', 'get_reliabledictionary_list')\n                group.command('type-schema', 'get_reliabledictionary_type_schema')\n\n        with ArgumentsContext(arg_0, 'dictionary') as ac:\n            ac.argument('application_name', options_list=['--application-name', '-a'])\n            ac.argument('service_name', options_list=['--service-name', '-s'])\n            ac.argument('dictionary_name', options_list=['--dictionary-name', '-d'])\n            ac.argument('output_file', options_list=['--output-file', '-out'])\n            ac.argument('input_file', options_list=['--input-file', '-in'])\n            ac.argument('query_string', options_list=['--query-string', '-q'])\n            ac.argument('type_name', options_list=['--type-name', '-t'])\n        \n        return OrderedDict(arg_0.command_table)", "path": "rcctl/rcctl/commands.py", "identifier": "SFCommandLoader.load_command_table", "docstring": "Load all Service Fabric commands", "docstring_tokens": ["Load", "all", "Service", "Fabric", "commands"], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 252758}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/primitives.py#L754-L770", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the value of the Boolean object to the output stream.", "language": "python", "parameters": "(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "try", ":", "arg_1", ".", "write", "(", "pack", "(", "'!Q'", ",", "arg_0", ".", "value", ")", ")", "except", "Exception", ":", "arg_0", ".", "logger", ".", "error", "(", "\"Error writing boolean value to buffer\"", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the value of the Boolean object to the output stream.\n\n        Args:\n            ostream (Stream): A buffer to contain the encoded bytes of the\n                value of a Boolean object. Usually a BytearrayStream object.\n                Required.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        try:\n            arg_1.write(pack('!Q', arg_0.value))\n        except Exception:\n            arg_0.logger.error(\"Error writing boolean value to buffer\")\n            raise", "path": "kmip/core/primitives.py", "identifier": "Boolean.write_value", "docstring": "Write the value of the Boolean object to the output stream.\n\n        Args:\n            ostream (Stream): A buffer to contain the encoded bytes of the\n                value of a Boolean object. Usually a BytearrayStream object.\n                Required.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Write", "the", "value", "of", "the", "Boolean", "object", "to", "the", "output", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 252759}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/beam.py#L133-L150", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Sets the beam moments directly.", "language": "python", "parameters": "(self, sx, sxp, sxxp)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "_sx", "=", "arg_1", "arg_0", ".", "_sxp", "=", "arg_2", "arg_0", ".", "_sxxp", "=", "arg_3", "arg_7", "=", "_np", ".", "sqrt", "(", "arg_1", "**", "2", "*", "arg_2", "**", "2", "-", "arg_3", "**", "2", ")", "arg_0", ".", "_store_emit", "(", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Sets the beam moments directly.\n\n        Parameters\n        ----------\n        sx : float\n            Beam moment where :math:`\\\\text{sx}^2 = \\\\langle x^2 \\\\rangle`.\n        sxp : float\n            Beam moment where :math:`\\\\text{sxp}^2 = \\\\langle x'^2 \\\\rangle`.\n        sxxp : float\n            Beam moment where :math:`\\\\text{sxxp} = \\\\langle x x' \\\\rangle`.\n        \"\"\"\n        arg_0._sx   = arg_1\n        arg_0._sxp  = arg_2\n        arg_0._sxxp = arg_3\n        arg_7 = _np.sqrt(arg_1**2 * arg_2**2 - arg_3**2)\n        arg_0._store_emit(arg_7=arg_7)", "path": "scisalt/PWFA/beam.py", "identifier": "EllipseBeam.set_moments", "docstring": "Sets the beam moments directly.\n\n        Parameters\n        ----------\n        sx : float\n            Beam moment where :math:`\\\\text{sx}^2 = \\\\langle x^2 \\\\rangle`.\n        sxp : float\n            Beam moment where :math:`\\\\text{sxp}^2 = \\\\langle x'^2 \\\\rangle`.\n        sxxp : float\n            Beam moment where :math:`\\\\text{sxxp} = \\\\langle x x' \\\\rangle`.", "docstring_tokens": ["Sets", "the", "beam", "moments", "directly", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 252760}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L1430-L1531", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Upload given metrics function into H2O cluster.", "language": "python", "parameters": "(func, func_file=\"metrics.py\", func_name=None, class_name=None, source_provider=None)", "return_statement": "return \"python:{}={}\".format(dest_key, class_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"metrics.py\"", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "import", "tempfile", "import", "inspect", "if", "not", "arg_4", ":", "arg_4", "=", "_default_source_provider", "arg_5", "=", "\"\"\"# Generated codeimport water.udf.CMetricFunc as MetricFunc# User given metric function as a class implementing# 3 methods defined by interface CMetricFunc{}# Generated user metric which satisfies the interface# of Java MetricFuncclass {}Wrapper({}, MetricFunc, object):    pass\"\"\"", "assert_satisfies", "(", "arg_0", ",", "inspect", ".", "isclass", "(", "arg_0", ")", "or", "isinstance", "(", "arg_0", ",", "str", ")", ",", "\"The argument func needs to be string or class !\"", ")", "assert_satisfies", "(", "arg_1", ",", "arg_1", "is", "not", "None", ",", "\"The argument func_file is missing!\"", ")", "assert_satisfies", "(", "arg_1", ",", "arg_1", ".", "endswith", "(", "'.py'", ")", ",", "\"The argument func_file needs to end with '.py'\"", ")", "arg_6", "=", "None", "arg_7", "=", "None", "arg_8", "=", "arg_1", "[", ":", "-", "3", "]", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "assert_satisfies", "(", "arg_3", ",", "arg_3", "is", "not", "None", ",", "\"The argument class_name is missing! \"", "+", "\"It needs to reference the class in given string!\"", ")", "arg_6", "=", "arg_5", ".", "format", "(", "arg_0", ",", "arg_3", ",", "arg_3", ")", "arg_7", "=", "\"metrics_{}\"", ".", "format", "(", "arg_3", ")", "arg_3", "=", "\"{}.{}Wrapper\"", ".", "format", "(", "arg_8", ",", "arg_3", ")", "else", ":", "assert_satisfies", "(", "arg_0", ",", "inspect", ".", "isclass", "(", "arg_0", ")", ",", "\"The parameter `func` should be str or class\"", ")", "for", "arg_9", "in", "[", "'map'", ",", "'reduce'", ",", "'metric'", "]", ":", "assert_satisfies", "(", "arg_0", ",", "arg_9", "in", "arg_0", ".", "__dict__", ",", "\"The class `func` needs to define method `{}`\"", ".", "format", "(", "arg_9", ")", ")", "assert_satisfies", "(", "arg_3", ",", "arg_3", "is", "None", ",", "\"If class is specified then class_name parameter needs to be None\"", ")", "arg_3", "=", "\"{}.{}Wrapper\"", ".", "format", "(", "arg_8", ",", "arg_0", ".", "__name__", ")", "arg_7", "=", "\"metrics_{}\"", ".", "format", "(", "arg_0", ".", "__name__", ")", "arg_6", "=", "arg_5", ".", "format", "(", "arg_4", "(", "arg_0", ")", ",", "arg_0", ".", "__name__", ",", "arg_0", ".", "__name__", ")", "if", "not", "arg_2", ":", "arg_2", "=", "arg_7", "arg_10", "=", "tempfile", ".", "mkdtemp", "(", "prefix", "=", "\"h2o-func\"", ")", "arg_11", "=", "_create_zip_file", "(", "\"{}/func.jar\"", ".", "format", "(", "arg_10", ")", ",", "(", "arg_1", ",", "arg_6", ")", ")", "arg_12", "=", "_put_key", "(", "arg_11", ",", "arg_12", "=", "arg_2", ")", "return", "\"python:{}={}\"", ".", "format", "(", "arg_12", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1=\"metrics.py\", arg_2=None, arg_3=None, arg_4=None):\n    \"\"\"\n    Upload given metrics function into H2O cluster.\n\n    The metrics can have different representation:\n      - class: needs to implement map(pred, act, weight, offset, model), reduce(l, r) and metric(l) methods\n      - string: the same as in class case, but the class is given as a string\n\n    :param func:  metric representation: string, class\n    :param func_file:  internal name of file to save given metrics representation\n    :param func_name:  name for h2o key under which the given metric is saved\n    :param class_name: name of class wrapping the metrics function (when supplied as string)\n    :param source_provider: a function which provides a source code for given function\n    :return: reference to uploaded metrics function\n\n    :examples:\n        >>> class CustomMaeFunc:\n        >>>     def map(self, pred, act, w, o, model):\n        >>>         return [abs(act[0] - pred[0]), 1]\n        >>>\n        >>>     def reduce(self, l, r):\n        >>>         return [l[0] + r[0], l[1] + r[1]]\n        >>>\n        >>>     def metric(self, l):\n        >>>         return l[0] / l[1]\n        >>>\n        >>>\n        >>> h2o.Func(CustomMaeFunc, func_name=\"mae\")\n        >>>\n        >>> custom_func_str = '''class CustomMaeFunc:\n        >>>     def map(self, pred, act, w, o, model):\n        >>>         return [abs(act[0] - pred[0]), 1]\n        >>>\n        >>>     def reduce(self, l, r):\n        >>>         return [l[0] + r[0], l[1] + r[1]]\n        >>>\n        >>>     def metric(self, l):\n        >>>         return l[0] / l[1]'''\n        >>>\n        >>>\n        >>> h2o.Func(custom_func_str, class_name=\"CustomMaeFunc\", func_name=\"mae\")\n    \"\"\"\n    import tempfile\n    import inspect\n\n    # Use default source provider\n    if not arg_4:\n        arg_4 = _default_source_provider\n\n    # The template wraps given metrics representation\n    arg_5 = \"\"\"# Generated code\nimport water.udf.CMetricFunc as MetricFunc\n\n# User given metric function as a class implementing\n# 3 methods defined by interface CMetricFunc\n{}\n\n# Generated user metric which satisfies the interface\n# of Java MetricFunc\nclass {}Wrapper({}, MetricFunc, object):\n    pass\n\n\"\"\"\n\n    assert_satisfies(arg_0, inspect.isclass(arg_0) or isinstance(arg_0, str),\n                     \"The argument func needs to be string or class !\")\n    assert_satisfies(arg_1, arg_1 is not None,\n                     \"The argument func_file is missing!\")\n    assert_satisfies(arg_1, arg_1.endswith('.py'),\n                     \"The argument func_file needs to end with '.py'\")\n    arg_6 = None\n    arg_7 = None\n    arg_8 = arg_1[:-3]\n    if isinstance(arg_0, str):\n        assert_satisfies(arg_3, arg_3 is not None,\n                         \"The argument class_name is missing! \" +\n                         \"It needs to reference the class in given string!\")\n        arg_6 = arg_5.format(arg_0, arg_3, arg_3)\n        arg_7 = \"metrics_{}\".format(arg_3)\n        arg_3 = \"{}.{}Wrapper\".format(arg_8, arg_3)\n    else:\n        assert_satisfies(arg_0, inspect.isclass(arg_0), \"The parameter `func` should be str or class\")\n        for arg_9 in ['map', 'reduce', 'metric']:\n            assert_satisfies(arg_0, arg_9 in arg_0.__dict__, \"The class `func` needs to define method `{}`\".format(arg_9))\n\n        assert_satisfies(arg_3, arg_3 is None,\n                         \"If class is specified then class_name parameter needs to be None\")\n\n        arg_3 = \"{}.{}Wrapper\".format(arg_8, arg_0.__name__)\n        arg_7 = \"metrics_{}\".format(arg_0.__name__)\n        arg_6 = arg_5.format(arg_4(arg_0), arg_0.__name__, arg_0.__name__)\n\n    # If the func name is not given, use whatever we can derived from given definition\n    if not arg_2:\n        arg_2 = arg_7\n    # Saved into jar file\n    arg_10 = tempfile.mkdtemp(prefix=\"h2o-func\")\n    arg_11 = _create_zip_file(\"{}/func.jar\".format(arg_10), (arg_1, arg_6))\n    # Upload into K/V\n    arg_12 = _put_key(arg_11, arg_12=arg_2)\n    # Reference\n    return \"python:{}={}\".format(arg_12, arg_3)", "path": "h2o-py/h2o/h2o.py", "identifier": "upload_custom_metric", "docstring": "Upload given metrics function into H2O cluster.\n\n    The metrics can have different representation:\n      - class: needs to implement map(pred, act, weight, offset, model), reduce(l, r) and metric(l) methods\n      - string: the same as in class case, but the class is given as a string\n\n    :param func:  metric representation: string, class\n    :param func_file:  internal name of file to save given metrics representation\n    :param func_name:  name for h2o key under which the given metric is saved\n    :param class_name: name of class wrapping the metrics function (when supplied as string)\n    :param source_provider: a function which provides a source code for given function\n    :return: reference to uploaded metrics function\n\n    :examples:\n        >>> class CustomMaeFunc:\n        >>>     def map(self, pred, act, w, o, model):\n        >>>         return [abs(act[0] - pred[0]), 1]\n        >>>\n        >>>     def reduce(self, l, r):\n        >>>         return [l[0] + r[0], l[1] + r[1]]\n        >>>\n        >>>     def metric(self, l):\n        >>>         return l[0] / l[1]\n        >>>\n        >>>\n        >>> h2o.upload_custom_metric(CustomMaeFunc, func_name=\"mae\")\n        >>>\n        >>> custom_func_str = '''class CustomMaeFunc:\n        >>>     def map(self, pred, act, w, o, model):\n        >>>         return [abs(act[0] - pred[0]), 1]\n        >>>\n        >>>     def reduce(self, l, r):\n        >>>         return [l[0] + r[0], l[1] + r[1]]\n        >>>\n        >>>     def metric(self, l):\n        >>>         return l[0] / l[1]'''\n        >>>\n        >>>\n        >>> h2o.upload_custom_metric(custom_func_str, class_name=\"CustomMaeFunc\", func_name=\"mae\")", "docstring_tokens": ["Upload", "given", "metrics", "function", "into", "H2O", "cluster", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252761}
{"url": "https://github.com/cltrudeau/django-flowr/blob/d077b90376ede33721db55ff29e08b8a16ed17ae/flowr/models.py#L238-L252", "sha": "d077b90376ede33721db55ff29e08b8a16ed17ae", "docstring_summary": "Returns a list of the ancestors of this node but does not pass the\n        root node, even if the root has parents due to cycles.", "language": "python", "parameters": "(self)", "return_statement": "return list(ancestors)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "is_root", "(", ")", ":", "return", "[", "]", "arg_1", "=", "set", "(", "[", "]", ")", "arg_0", ".", "_depth_ascend", "(", "arg_0", ",", "arg_1", ",", "True", ")", "try", ":", "arg_1", ".", "remove", "(", "arg_0", ")", "except", "KeyError", ":", "pass", "return", "list", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns a list of the ancestors of this node but does not pass the\n        root node, even if the root has parents due to cycles.\"\"\"\n        if arg_0.is_root():\n            return []\n\n        arg_1 = set([])\n        arg_0._depth_ascend(arg_0, arg_1, True)\n        try:\n            arg_1.remove(arg_0)\n        except KeyError:\n            # we weren't ancestor of ourself, that's ok\n            pass\n\n        return list(arg_1)", "path": "flowr/models.py", "identifier": "Node.ancestors_root", "docstring": "Returns a list of the ancestors of this node but does not pass the\n        root node, even if the root has parents due to cycles.", "docstring_tokens": ["Returns", "a", "list", "of", "the", "ancestors", "of", "this", "node", "but", "does", "not", "pass", "the", "root", "node", "even", "if", "the", "root", "has", "parents", "due", "to", "cycles", "."], "nwo": "cltrudeau/django-flowr", "score": 0.09252797783733271, "idx": 252762}
{"url": "https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L43-L60", "sha": "d6a8bb9c28787a25b4a1d59a7e4603db3221eaef", "docstring_summary": "Load crs object from esri code, via spatialreference.org.\n    Parses based on the proj4 representation.", "language": "python", "parameters": "(code)", "return_statement": "return crs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "str", "(", "arg_0", ")", "arg_1", "=", "utils", ".", "crscode_to_string", "(", "\"esri\"", ",", "arg_0", ",", "\"proj4\"", ")", "arg_2", "=", "from_proj4", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Load crs object from esri code, via spatialreference.org.\n    Parses based on the proj4 representation.\n\n    Arguments:\n\n    - *code*: The ESRI code as an integer.\n\n    Returns:\n\n    - A CS instance of the indicated type. \n    \"\"\"\n    # must go online (or look up local table) to get crs details\n    arg_0 = str(arg_0)\n    arg_1 = utils.crscode_to_string(\"esri\", arg_0, \"proj4\")\n    arg_2 = from_proj4(arg_1)\n    return arg_2", "path": "pycrs/parse.py", "identifier": "from_esri_code", "docstring": "Load crs object from esri code, via spatialreference.org.\n    Parses based on the proj4 representation.\n\n    Arguments:\n\n    - *code*: The ESRI code as an integer.\n\n    Returns:\n\n    - A CS instance of the indicated type.", "docstring_tokens": ["Load", "crs", "object", "from", "esri", "code", "via", "spatialreference", ".", "org", ".", "Parses", "based", "on", "the", "proj4", "representation", "."], "nwo": "karimbahgat/PyCRS", "score": 0.6903572066933638, "idx": 252763}
{"url": "https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/utils/encoding.py#L52-L101", "sha": "e6994b1b1826af2720a091d1bff5ca15594f558d", "docstring_summary": "Similar to smart_unicode, except that lazy instances are resolved to\n    strings, rather than kept as lazy objects.", "language": "python", "parameters": "(string, encoding='utf-8', strings_only=False, errors='strict')", "return_statement": "return string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf-8'", ",", "arg_2", "=", "False", ",", "arg_3", "=", "'strict'", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "arg_0", "if", "arg_2", "and", "is_protected_type", "(", "arg_0", ")", ":", "return", "arg_0", "try", ":", "if", "not", "isinstance", "(", "arg_0", ",", "str", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'__unicode__'", ")", ":", "arg_0", "=", "arg_0", ".", "__unicode__", "(", ")", "else", ":", "try", ":", "arg_0", "=", "str", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "except", "UnicodeEncodeError", ":", "if", "not", "isinstance", "(", "arg_0", ",", "Exception", ")", ":", "raise", "arg_0", "=", "' '", ".", "join", "(", "[", "Func", "(", "arg", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "for", "arg", "in", "arg_0", "]", ")", "elif", "not", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "arg_1", ",", "arg_3", ")", "except", "UnicodeDecodeError", "as", "ex", ":", "if", "not", "isinstance", "(", "arg_0", ",", "Exception", ")", ":", "raise", "DjangoUnicodeDecodeError", "(", "arg_0", ",", "*", "ex", ".", "args", ")", "else", ":", "arg_0", "=", "' '", ".", "join", "(", "[", "Func", "(", "arg", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "for", "arg", "in", "arg_0", "]", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1='utf-8', arg_2=False, arg_3='strict'):\n    \"\"\"\n    Similar to smart_unicode, except that lazy instances are resolved to\n    strings, rather than kept as lazy objects.\n\n    If strings_only is True, don't convert (some) non-string-like objects.\n    \"\"\"\n    # Handle the common case first, saves 30-40% in performance when s\n    # is an instance of unicode. This function gets called often in that\n    # setting.\n    if isinstance(arg_0, str):\n        return arg_0\n    if arg_2 and is_protected_type(arg_0):\n        return arg_0\n    try:\n        if not isinstance(arg_0, str):\n            if hasattr(arg_0, '__unicode__'):\n                arg_0 = arg_0.__unicode__()\n            else:\n                try:\n                    arg_0 = str(arg_0, arg_1, arg_3)\n                except UnicodeEncodeError:\n                    if not isinstance(arg_0, Exception):\n                        raise\n                    # If we get to here, the caller has passed in an Exception\n                    # subclass populated with non-ASCII data without special\n                    # handling to display as a string. We need to handle this\n                    # without raising a further exception. We do an\n                    # approximation to what the Exception's standard str()\n                    # output should be.\n                    arg_0 = ' '.join([Func(arg, arg_1,\n                                                     arg_2,\n                                                     arg_3) for arg in arg_0])\n        elif not isinstance(arg_0, str):\n            # Note: We use .decode() here, instead of unicode(s, encoding,\n            # errors), so that if s is a SafeString, it ends up being a\n            # SafeUnicode at the end.\n            arg_0 = arg_0.decode(arg_1, arg_3)\n    except UnicodeDecodeError as ex:\n        if not isinstance(arg_0, Exception):\n            raise DjangoUnicodeDecodeError(arg_0, *ex.args)\n        else:\n            # If we get to here, the caller has passed in an Exception\n            # subclass populated with non-ASCII bytestring data without a\n            # working unicode method. Try to handle this without raising a\n            # further exception by individually forcing the exception args\n            # to unicode.\n            arg_0 = ' '.join([Func(arg, arg_1, arg_2,\n                                             arg_3) for arg in arg_0])\n    return arg_0", "path": "goose3/utils/encoding.py", "identifier": "force_unicode", "docstring": "Similar to smart_unicode, except that lazy instances are resolved to\n    strings, rather than kept as lazy objects.\n\n    If strings_only is True, don't convert (some) non-string-like objects.", "docstring_tokens": ["Similar", "to", "smart_unicode", "except", "that", "lazy", "instances", "are", "resolved", "to", "strings", "rather", "than", "kept", "as", "lazy", "objects", "."], "nwo": "goose3/goose3", "score": 0.5494430231474424, "idx": 252764}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/color.py#L39-L42", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert images to another colorspace.", "language": "python", "parameters": "(to_colorspace, from_colorspace=\"RGB\", children=None, name=None, deterministic=False,\n                 random_state=None)", "return_statement": "return WithColorspace(to_colorspace, from_colorspace, children, name, deterministic, random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"RGB\"", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "return", "WithColorspace", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1=\"RGB\", arg_2=None, arg_3=None, arg_4=False,\n                 arg_5=None):\n    \"\"\"Convert images to another colorspace.\"\"\"\n    return WithColorspace(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5)", "path": "imgaug/augmenters/color.py", "identifier": "InColorspace", "docstring": "Convert images to another colorspace.", "docstring_tokens": ["Convert", "images", "to", "another", "colorspace", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 252765}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L149-L189", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Retrieve the list of courses contained within the catalog linked to this enterprise.", "language": "python", "parameters": "(self, request, pk=None)", "return_statement": "return get_paginated_response(serializer.data, request)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "get_object", "(", ")", "arg_0", ".", "check_object_permissions", "(", "arg_1", ",", "arg_3", ")", "arg_0", ".", "ensure_data_exists", "(", "arg_1", ",", "arg_3", ".", "catalog", ",", "error_message", "=", "\"No catalog is associated with Enterprise {enterprise_name} from endpoint '{path}'.\"", ".", "format", "(", "enterprise_name", "=", "arg_3", ".", "name", ",", "path", "=", "arg_1", ".", "get_full_path", "(", ")", ")", ")", "arg_4", "=", "CourseCatalogApiClient", "(", "arg_1", ".", "user", ",", "arg_3", ".", "site", ")", "Func", "=", "arg_4", ".", "get_paginated_catalog_courses", "(", "arg_3", ".", "catalog", ",", "arg_1", ".", "GET", ")", "arg_0", ".", "ensure_data_exists", "(", "arg_1", ",", "Func", ",", "error_message", "=", "(", "\"Unable to fetch API response for catalog courses for \"", "\"Enterprise {enterprise_name} from endpoint '{path}'.\"", ".", "format", "(", "enterprise_name", "=", "arg_3", ".", "name", ",", "path", "=", "arg_1", ".", "get_full_path", "(", ")", ")", ")", ")", "arg_6", "=", "serializers", ".", "EnterpriseCatalogCoursesReadOnlySerializer", "(", "Func", ")", "arg_6", ".", "update_enterprise_courses", "(", "arg_3", ",", "catalog_id", "=", "arg_3", ".", "catalog", ")", "return", "get_paginated_response", "(", "arg_6", ".", "data", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):  # pylint: disable=invalid-name,unused-argument\n        \"\"\"\n        Retrieve the list of courses contained within the catalog linked to this enterprise.\n\n        Only courses with active course runs are returned. A course run is considered active if it is currently\n        open for enrollment, or will open in the future.\n        \"\"\"\n        arg_3 = arg_0.get_object()\n        arg_0.check_object_permissions(arg_1, arg_3)\n        arg_0.ensure_data_exists(\n            arg_1,\n            arg_3.catalog,\n            error_message=\"No catalog is associated with Enterprise {enterprise_name} from endpoint '{path}'.\".format(\n                enterprise_name=arg_3.name,\n                path=arg_1.get_full_path()\n            )\n        )\n\n        # We have handled potential error cases and are now ready to call out to the Catalog API.\n        arg_4 = CourseCatalogApiClient(arg_1.user, arg_3.site)\n        Func = arg_4.get_paginated_catalog_courses(arg_3.catalog, arg_1.GET)\n\n        # An empty response means that there was a problem fetching data from Catalog API, since\n        # a Catalog with no courses has a non empty response indicating that there are no courses.\n        arg_0.ensure_data_exists(\n            arg_1,\n            Func,\n            error_message=(\n                \"Unable to fetch API response for catalog courses for \"\n                \"Enterprise {enterprise_name} from endpoint '{path}'.\".format(\n                    enterprise_name=arg_3.name,\n                    path=arg_1.get_full_path()\n                )\n            )\n        )\n\n        arg_6 = serializers.EnterpriseCatalogCoursesReadOnlySerializer(Func)\n\n        # Add enterprise related context for the courses.\n        arg_6.update_enterprise_courses(arg_3, catalog_id=arg_3.catalog)\n        return get_paginated_response(arg_6.data, arg_1)", "path": "enterprise/api/v1/views.py", "identifier": "EnterpriseCustomerViewSet.courses", "docstring": "Retrieve the list of courses contained within the catalog linked to this enterprise.\n\n        Only courses with active course runs are returned. A course run is considered active if it is currently\n        open for enrollment, or will open in the future.", "docstring_tokens": ["Retrieve", "the", "list", "of", "courses", "contained", "within", "the", "catalog", "linked", "to", "this", "enterprise", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252766}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/conf/__init__.py#L75-L79", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Hack in a data directory", "language": "python", "parameters": "(self, directory)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ".", "DATA_DIRS", ")", "arg_2", ".", "append", "(", "arg_1", ")", "arg_0", ".", "DATA_DIRS", "=", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Hack in a data directory\"\"\"\n        arg_2 = list(arg_0.DATA_DIRS)\n        arg_2.append(arg_1)\n        arg_0.DATA_DIRS = arg_2", "path": "demosys/conf/__init__.py", "identifier": "Settings.add_data_dir", "docstring": "Hack in a data directory", "docstring_tokens": ["Hack", "in", "a", "data", "directory"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 252767}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L1036-L1071", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Filter tags according between_tags option.", "language": "python", "parameters": "(self, all_tags)", "return_statement": "return between_tags", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "t", "[", "\"name\"", "]", "for", "t", "in", "arg_1", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "options", ".", "between_tags", ":", "try", ":", "arg_5", "=", "arg_2", ".", "index", "(", "arg_4", ")", "except", "ValueError", ":", "raise", "ChangelogGeneratorError", "(", "\"ERROR: can't find tag {0}, specified with \"", "\"--between-tags option.\"", ".", "format", "(", "arg_4", ")", ")", "arg_3", ".", "append", "(", "arg_1", "[", "arg_5", "]", ")", "arg_3", "=", "arg_0", ".", "sort_tags_by_date", "(", "arg_3", ")", "if", "len", "(", "arg_3", ")", "==", "1", ":", "arg_3", ".", "append", "(", "arg_3", "[", "0", "]", ")", "arg_6", "=", "arg_0", ".", "get_time_of_tag", "(", "arg_3", "[", "1", "]", ")", "arg_7", "=", "arg_0", ".", "get_time_of_tag", "(", "arg_3", "[", "0", "]", ")", "for", "arg_4", "in", "arg_1", ":", "if", "arg_6", "<", "arg_0", ".", "get_time_of_tag", "(", "arg_4", ")", "<", "arg_7", ":", "arg_3", ".", "append", "(", "arg_4", ")", "if", "arg_6", "==", "arg_7", ":", "arg_3", ".", "pop", "(", "0", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Filter tags according between_tags option.\n\n        :param list(dict) all_tags: Pre-filtered tags.\n        :rtype: list(dict)\n        :return: Filtered tags.\n        \"\"\"\n\n        arg_2 = [t[\"name\"] for t in arg_1]\n        arg_3 = []\n        for arg_4 in arg_0.options.between_tags:\n            try:\n                arg_5 = arg_2.index(arg_4)\n            except ValueError:\n                raise ChangelogGeneratorError(\n                    \"ERROR: can't find tag {0}, specified with \"\n                    \"--between-tags option.\".format(arg_4))\n            arg_3.append(arg_1[arg_5])\n\n        arg_3 = arg_0.sort_tags_by_date(arg_3)\n\n        if len(arg_3) == 1:\n            # if option --between-tags was only 1 tag given, duplicate it\n            # to generate the changelog only for that one tag.\n            arg_3.append(arg_3[0])\n\n        arg_6 = arg_0.get_time_of_tag(arg_3[1])\n        arg_7 = arg_0.get_time_of_tag(arg_3[0])\n\n        for arg_4 in arg_1:\n            if arg_6 < arg_0.get_time_of_tag(arg_4) < arg_7:\n                arg_3.append(arg_4)\n        if arg_6 == arg_7:\n            arg_3.pop(0)\n        return arg_3", "path": "pygcgen/generator.py", "identifier": "Generator.filter_between_tags", "docstring": "Filter tags according between_tags option.\n\n        :param list(dict) all_tags: Pre-filtered tags.\n        :rtype: list(dict)\n        :return: Filtered tags.", "docstring_tokens": ["Filter", "tags", "according", "between_tags", "option", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 252768}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/intervals.py#L56-L58", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Like union, but ignores whether the two intervals intersect or not", "language": "python", "parameters": "(self, i)", "return_statement": "return Interval(min(self.start, i.start), max(self.end, i.end))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Interval", "(", "min", "(", "arg_0", ".", "start", ",", "arg_1", ".", "start", ")", ",", "max", "(", "arg_0", ".", "end", ",", "arg_1", ".", "end", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''Like union, but ignores whether the two intervals intersect or not'''\n        return Interval(min(arg_0.start, arg_1.start), max(arg_0.end, arg_1.end))", "path": "pyfastaq/intervals.py", "identifier": "Interval.union_fill_gap", "docstring": "Like union, but ignores whether the two intervals intersect or not", "docstring_tokens": ["Like", "union", "but", "ignores", "whether", "the", "two", "intervals", "intersect", "or", "not"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 252769}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1267-L1319", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Splits the muscle alignment into chunks. Each chunk is run on a separate\n    computing core. Because the largest clusters are at the beginning of the \n    clusters file, assigning equal clusters to each file would put all of the \n    large cluster, that take longer to align, near the top. So instead we \n    randomly distribute the clusters among the files. If assembly method is\n    reference then this step is just a placeholder and nothing happens.", "language": "python", "parameters": "(data, sample)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOGGER", ".", "info", "(", "\"inside Func\"", ")", "if", "arg_0", ".", "paramsdict", "[", "\"assembly_method\"", "]", "!=", "\"reference\"", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "clusts", ",", "arg_1", ".", "name", "+", "\".clust.gz\"", ")", "with", "iter", "(", "gzip", ".", "open", "(", "arg_2", ",", "'rb'", ")", ")", "as", "arg_5", ":", "arg_3", "=", "sum", "(", "1", "for", "i", "in", "arg_5", "if", "\"//\"", "in", "i", ")", "//", "2", "arg_4", "=", "(", "arg_3", "//", "20", ")", "+", "(", "arg_3", "%", "20", ")", "LOGGER", ".", "info", "(", "\"optim for align chunks: %s\"", ",", "arg_4", ")", "arg_5", "=", "gzip", ".", "open", "(", "arg_2", ",", "'rb'", ")", "arg_6", "=", "iter", "(", "arg_5", ".", "read", "(", ")", ".", "strip", "(", ")", ".", "split", "(", "\"//\\n//\\n\"", ")", ")", "arg_7", "=", "arg_4", "//", "10", "for", "arg_8", "in", "range", "(", "10", ")", ":", "arg_9", "=", "arg_4", "+", "(", "arg_8", "*", "arg_7", ")", "arg_10", "=", "arg_3", "-", "arg_9", "if", "arg_8", "==", "9", ":", "arg_11", "=", "list", "(", "itertools", ".", "islice", "(", "arg_6", ",", "int", "(", "1e9", ")", ")", ")", "else", ":", "arg_11", "=", "list", "(", "itertools", ".", "islice", "(", "arg_6", ",", "arg_9", ")", ")", "arg_3", "=", "arg_10", "arg_12", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "tmpdir", ",", "arg_1", ".", "name", "+", "\"_chunk_{}.ali\"", ".", "format", "(", "arg_8", ")", ")", "with", "open", "(", "arg_12", ",", "'wb'", ")", "as", "out", ":", "out", ".", "write", "(", "\"//\\n//\\n\"", ".", "join", "(", "arg_11", ")", ")", "arg_5", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Splits the muscle alignment into chunks. Each chunk is run on a separate\n    computing core. Because the largest clusters are at the beginning of the \n    clusters file, assigning equal clusters to each file would put all of the \n    large cluster, that take longer to align, near the top. So instead we \n    randomly distribute the clusters among the files. If assembly method is\n    reference then this step is just a placeholder and nothing happens. \n    \"\"\"\n    ## log our location for debugging\n    LOGGER.info(\"inside Func\")\n\n    ## only chunk up denovo data, refdata has its own chunking method which \n    ## makes equal size chunks, instead of uneven chunks like in denovo\n    if arg_0.paramsdict[\"assembly_method\"] != \"reference\":\n        ## get the number of clusters\n        arg_2 = os.path.join(arg_0.dirs.clusts, arg_1.name+\".clust.gz\")\n        with iter(gzip.open(arg_2, 'rb')) as arg_5:\n            arg_3 = sum(1 for i in arg_5 if \"//\" in i) // 2\n            #tclust = clustio.read().count(\"//\")//2\n            arg_4 = (arg_3//20) + (arg_3%20)\n            LOGGER.info(\"optim for align chunks: %s\", arg_4)\n\n        ## write optim clusters to each tmp file\n        arg_5 = gzip.open(arg_2, 'rb')\n        arg_6 = iter(arg_5.read().strip().split(\"//\\n//\\n\"))\n        \n        ## splitting loci so first file is smaller and last file is bigger\n        arg_7 = arg_4 // 10\n        for arg_8 in range(10):\n            ## how big is this chunk?\n            arg_9 = arg_4 + (arg_8 * arg_7)\n            arg_10 = arg_3-arg_9\n            if arg_8 == 9:\n                ## grab everything left\n                arg_11 = list(itertools.islice(arg_6, int(1e9)))\n            else:\n                ## grab next chunks-worth of data\n                arg_11 = list(itertools.islice(arg_6, arg_9))\n                arg_3 = arg_10\n\n            ## write the chunk to file\n            arg_12 = os.path.join(arg_0.tmpdir, arg_1.name+\"_chunk_{}.ali\".format(arg_8))\n            with open(arg_12, 'wb') as out:\n                out.write(\"//\\n//\\n\".join(arg_11))\n\n        ## write the chunk to file\n        #grabchunk = list(itertools.islice(inclusts, left))\n        #if grabchunk:\n        #    tmpfile = os.path.join(data.tmpdir, sample.name+\"_chunk_9.ali\")\n        #    with open(tmpfile, 'a') as out:\n        #        out.write(\"\\n//\\n//\\n\".join(grabchunk))\n        arg_5.close()", "path": "ipyrad/assemble/cluster_within.py", "identifier": "muscle_chunker", "docstring": "Splits the muscle alignment into chunks. Each chunk is run on a separate\n    computing core. Because the largest clusters are at the beginning of the \n    clusters file, assigning equal clusters to each file would put all of the \n    large cluster, that take longer to align, near the top. So instead we \n    randomly distribute the clusters among the files. If assembly method is\n    reference then this step is just a placeholder and nothing happens.", "docstring_tokens": ["Splits", "the", "muscle", "alignment", "into", "chunks", ".", "Each", "chunk", "is", "run", "on", "a", "separate", "computing", "core", ".", "Because", "the", "largest", "clusters", "are", "at", "the", "beginning", "of", "the", "clusters", "file", "assigning", "equal", "clusters", "to", "each", "file", "would", "put", "all", "of", "the", "large", "cluster", "that", "take", "longer", "to", "align", "near", "the", "top", ".", "So", "instead", "we", "randomly", "distribute", "the", "clusters", "among", "the", "files", ".", "If", "assembly", "method", "is", "reference", "then", "this", "step", "is", "just", "a", "placeholder", "and", "nothing", "happens", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 252770}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/api/authentication.py#L10-L27", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Authenticate a user from a token form field", "language": "python", "parameters": "(self, request)", "return_statement": "return (token.user, token)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_1", ".", "data", "[", "'token'", "]", "except", "KeyError", ":", "return", "try", ":", "arg_3", "=", "AuthToken", ".", "objects", ".", "get", "(", "arg_2", "=", "arg_2", ")", "except", "AuthToken", ".", "DoesNotExist", ":", "return", "return", "(", "arg_3", ".", "user", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Authenticate a user from a token form field\n\n        Errors thrown here will be swallowed by django-rest-framework, and it\n        expects us to return None if authentication fails.\n        \"\"\"\n        try:\n            arg_2 = arg_1.data['token']\n        except KeyError:\n            return\n\n        try:\n            arg_3 = AuthToken.objects.get(arg_2=arg_2)\n        except AuthToken.DoesNotExist:\n            return\n\n        return (arg_3.user, arg_3)", "path": "user_management/api/authentication.py", "identifier": "FormTokenAuthentication.authenticate", "docstring": "Authenticate a user from a token form field\n\n        Errors thrown here will be swallowed by django-rest-framework, and it\n        expects us to return None if authentication fails.", "docstring_tokens": ["Authenticate", "a", "user", "from", "a", "token", "form", "field"], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 252771}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L530-L541", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Stop scheduling tasks because an engine has been unregistered\n        from a pure ZMQ scheduler.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_task_socket", ".", "close", "(", ")", "arg_0", ".", "_task_socket", "=", "None", "arg_2", "=", "\"An engine has been unregistered, and we are using pure \"", "+", "\"ZMQ task scheduling.  Task farming will be disabled.\"", "if", "arg_0", ".", "outstanding", ":", "arg_2", "+=", "\" If you were running tasks when this happened, \"", "+", "\"some `outstanding` msg_ids may never resolve.\"", "warnings", ".", "warn", "(", "arg_2", ",", "RuntimeWarning", ")"], "function": "def Func(arg_0):\n        \"\"\"Stop scheduling tasks because an engine has been unregistered\n        from a pure ZMQ scheduler.\n        \"\"\"\n        arg_0._task_socket.close()\n        arg_0._task_socket = None\n        arg_2 = \"An engine has been unregistered, and we are using pure \" +\\\n              \"ZMQ task scheduling.  Task farming will be disabled.\"\n        if arg_0.outstanding:\n            arg_2 += \" If you were running tasks when this happened, \" +\\\n                   \"some `outstanding` msg_ids may never resolve.\"\n        warnings.warn(arg_2, RuntimeWarning)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client._stop_scheduling_tasks", "docstring": "Stop scheduling tasks because an engine has been unregistered\n        from a pure ZMQ scheduler.", "docstring_tokens": ["Stop", "scheduling", "tasks", "because", "an", "engine", "has", "been", "unregistered", "from", "a", "pure", "ZMQ", "scheduler", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252772}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L577-L591", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Returns the front ID found in `front` at the given `index`.", "language": "python", "parameters": "(front, index)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_1", "arg_4", "=", "arg_0", "[", "arg_2", ",", "arg_3", "]", "if", "arg_4", "==", "0", ":", "return", "-", "1", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the front ID found in `front` at the given `index`.\n\n    :param front:               An onset or offset front array of shape [nfrequencies, nsamples]\n    :index:                     A tuple of the form (frequency index, sample index)\n    :returns:                   The ID of the front or -1 if not found in `front` and the item at `onsets_or_offsets[index]`\n                                is not a 1.\n    \"\"\"\n    arg_2, arg_3 = arg_1\n    arg_4 = arg_0[arg_2, arg_3]\n    if arg_4 == 0:\n        return -1\n    else:\n        return arg_4", "path": "algorithms/asa.py", "identifier": "_front_id_from_idx", "docstring": "Returns the front ID found in `front` at the given `index`.\n\n    :param front:               An onset or offset front array of shape [nfrequencies, nsamples]\n    :index:                     A tuple of the form (frequency index, sample index)\n    :returns:                   The ID of the front or -1 if not found in `front` and the item at `onsets_or_offsets[index]`\n                                is not a 1.", "docstring_tokens": ["Returns", "the", "front", "ID", "found", "in", "front", "at", "the", "given", "index", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 252773}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/hdlSimulator.py#L400-L432", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Perform delta step by writing stacked values to signals", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Generator", "[", "None", ",", "None", ",", "None", "]", ":", "arg_1", "=", "arg_0", ".", "_valuesToApply", "arg_0", ".", "_applyValPlaned", "=", "False", "arg_3", "=", "arg_0", ".", "config", ".", "logApplyingValues", "if", "arg_1", "and", "arg_3", ":", "arg_3", "(", "arg_0", ",", "arg_1", ")", "arg_0", ".", "_valuesToApply", "=", "[", "]", "arg_5", "=", "arg_0", ".", "_seqProcsToRun", ".", "append", "for", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "in", "arg_1", ":", "if", "arg_8", ":", "arg_5", "(", "arg_9", ")", "else", ":", "arg_6", ".", "simUpdateVal", "(", "arg_0", ",", "arg_7", ")", "arg_0", ".", "_runCombProcesses", "(", ")", "if", "arg_0", ".", "_valuesToApply", "and", "not", "arg_0", ".", "_applyValPlaned", ":", "arg_0", ".", "_scheduleApplyValues", "(", ")", "return", "yield"], "function": "def Func(arg_0) -> Generator[None, None, None]:\n        \"\"\"\n        Perform delta step by writing stacked values to signals\n        \"\"\"\n        arg_1 = arg_0._valuesToApply\n        arg_0._applyValPlaned = False\n\n        # log if there are items to log\n        arg_3 = arg_0.config.logApplyingValues\n        if arg_1 and arg_3:\n            arg_3(arg_0, arg_1)\n        arg_0._valuesToApply = []\n\n        # apply values to signals, values can overwrite each other\n        # but each signal should be driven by only one process and\n        # it should resolve value collision\n        arg_5 = arg_0._seqProcsToRun.append\n        for arg_6, arg_7, arg_8, arg_9 in arg_1:\n            if arg_8:\n                # now=0 and this was process initialization or async reg\n                arg_5(arg_9)\n            else:\n                # regular combinational process\n                arg_6.simUpdateVal(arg_0, arg_7)\n\n        arg_0._runCombProcesses()\n\n        # processes triggered from simUpdateVal can add new values\n        if arg_0._valuesToApply and not arg_0._applyValPlaned:\n            arg_0._scheduleApplyValues()\n\n        return\n        yield", "path": "hwt/simulator/hdlSimulator.py", "identifier": "HdlSimulator._applyValues", "docstring": "Perform delta step by writing stacked values to signals", "docstring_tokens": ["Perform", "delta", "step", "by", "writing", "stacked", "values", "to", "signals"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252774}
{"url": "https://github.com/fastmonkeys/stellar/blob/79f0353563c35fa6ae46a2f00886ab1dd31c4492/stellar/command.py#L89-L129", "sha": "79f0353563c35fa6ae46a2f00886ab1dd31c4492", "docstring_summary": "Restores the database from a snapshot", "language": "python", "parameters": "(name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_app", "(", ")", "if", "not", "arg_0", ":", "arg_2", "=", "arg_1", ".", "get_latest_snapshot", "(", ")", "if", "not", "arg_2", ":", "click", ".", "echo", "(", "\"Couldn't find any snapshots for project %s\"", "%", "load_config", "(", ")", "[", "'project_name'", "]", ")", "sys", ".", "exit", "(", "1", ")", "else", ":", "arg_2", "=", "arg_1", ".", "get_snapshot", "(", "arg_0", ")", "if", "not", "arg_2", ":", "click", ".", "echo", "(", "\"Couldn't find snapshot with name %s.\\n\"", "\"You can list snapshots with 'stellar list'\"", "%", "arg_0", ")", "sys", ".", "exit", "(", "1", ")", "if", "not", "arg_2", ".", "slaves_ready", ":", "if", "arg_1", ".", "is_copy_process_running", "(", "arg_2", ")", ":", "sys", ".", "stdout", ".", "write", "(", "'Waiting for background process(%s) to finish'", "%", "arg_2", ".", "worker_pid", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "while", "not", "arg_2", ".", "slaves_ready", ":", "sys", ".", "stdout", ".", "write", "(", "'.'", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "sleep", "(", "1", ")", "arg_1", ".", "db", ".", "session", ".", "refresh", "(", "arg_2", ")", "click", ".", "echo", "(", "''", ")", "else", ":", "click", ".", "echo", "(", "'Background process missing, doing slow Func.'", ")", "arg_1", ".", "inline_slave_copy", "(", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_2", ")", "click", ".", "echo", "(", "'Restore complete.'", ")"], "function": "def Func(arg_0):\n    \"\"\"Restores the database from a snapshot\"\"\"\n    arg_1 = get_app()\n\n    if not arg_0:\n        arg_2 = arg_1.get_latest_snapshot()\n        if not arg_2:\n            click.echo(\n                \"Couldn't find any snapshots for project %s\" %\n                load_config()['project_name']\n            )\n            sys.exit(1)\n    else:\n        arg_2 = arg_1.get_snapshot(arg_0)\n        if not arg_2:\n            click.echo(\n                \"Couldn't find snapshot with name %s.\\n\"\n                \"You can list snapshots with 'stellar list'\" % arg_0\n            )\n            sys.exit(1)\n\n    # Check if slaves are ready\n    if not arg_2.slaves_ready:\n        if arg_1.is_copy_process_running(arg_2):\n            sys.stdout.write(\n                'Waiting for background process(%s) to finish' %\n                arg_2.worker_pid\n            )\n            sys.stdout.flush()\n            while not arg_2.slaves_ready:\n                sys.stdout.write('.')\n                sys.stdout.flush()\n                sleep(1)\n                arg_1.db.session.refresh(arg_2)\n            click.echo('')\n        else:\n            click.echo('Background process missing, doing slow Func.')\n            arg_1.inline_slave_copy(arg_2)\n\n    arg_1.Func(arg_2)\n    click.echo('Restore complete.')", "path": "stellar/command.py", "identifier": "restore", "docstring": "Restores the database from a snapshot", "docstring_tokens": ["Restores", "the", "database", "from", "a", "snapshot"], "nwo": "fastmonkeys/stellar", "score": 0.5903989730462599, "idx": 252775}
{"url": "https://github.com/disqus/python-phabricator/blob/ad08e335081531fae053a78a1c708cd11e3e6c49/phabricator/__init__.py#L111-L134", "sha": "ad08e335081531fae053a78a1c708cd11e3e6c49", "docstring_summary": "Perform param type mapping\n    This requires a bit of logic since this isn't standardized.\n    If a type doesn't map, assume str", "language": "python", "parameters": "(param_type)", "return_statement": "return PARAM_TYPE_MAP.setdefault(main_type, string_types)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "TYPE_INFO_RE", ".", "match", "(", "arg_0", ")", ".", "groups", "(", ")", "if", "arg_1", "in", "(", "'list'", ",", "'array'", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_2", "=", "arg_2", ".", "strip", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "'str'", "arg_3", "=", "TYPE_INFO_RE", ".", "match", "(", "arg_2", ")", "if", "arg_3", ":", "arg_2", "=", "arg_3", ".", "group", "(", "1", ")", ".", "lower", "(", ")", "return", "[", "PARAM_TYPE_MAP", ".", "setdefault", "(", "arg_2", ",", "string_types", ")", "]", "return", "PARAM_TYPE_MAP", ".", "setdefault", "(", "arg_1", ",", "string_types", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Perform param type mapping\n    This requires a bit of logic since this isn't standardized.\n    If a type doesn't map, assume str\n    \"\"\"\n    arg_1, arg_2 = TYPE_INFO_RE.match(arg_0).groups()\n\n    if arg_1 in ('list', 'array'):\n        # Handle no sub-type: \"required list\"\n        if arg_2 is not None:\n            arg_2 = arg_2.strip()\n\n        if not arg_2:\n            arg_2 = 'str'\n\n        # Handle list of pairs: \"optional list<pair<callsign, path>>\"\n        arg_3 = TYPE_INFO_RE.match(arg_2)\n        if arg_3:\n            arg_2 = arg_3.group(1).lower()\n\n        return [PARAM_TYPE_MAP.setdefault(arg_2, string_types)]\n\n    return PARAM_TYPE_MAP.setdefault(arg_1, string_types)", "path": "phabricator/__init__.py", "identifier": "map_param_type", "docstring": "Perform param type mapping\n    This requires a bit of logic since this isn't standardized.\n    If a type doesn't map, assume str", "docstring_tokens": ["Perform", "param", "type", "mapping", "This", "requires", "a", "bit", "of", "logic", "since", "this", "isn", "t", "standardized", ".", "If", "a", "type", "doesn", "t", "map", "assume", "str"], "nwo": "disqus/python-phabricator", "score": 0.5858708484417109, "idx": 252776}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanzaprocessor.py#L240-L275", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Search the handler list for handlers matching\n        given stanza type and payload namespace. Run the\n        handlers found ordering them by priority until\n        the first one which returns `True`.", "language": "python", "parameters": "(self, handler_list, stanza, stanza_type = None)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_2", ".", "stanza_type", "arg_4", "=", "arg_2", ".", "get_all_payload", "(", ")", "arg_5", "=", "[", "p", ".", "__class__", "for", "p", "in", "arg_4", "]", "arg_6", "=", "[", "(", "p", ".", "__class__", ",", "p", ".", "handler_key", ")", "for", "p", "in", "arg_4", "]", "for", "arg_7", "in", "arg_1", ":", "arg_8", "=", "arg_7", ".", "_pyxmpp_stanza_handled", "[", "1", "]", "arg_9", "=", "arg_7", ".", "_pyxmpp_payload_class_handled", "arg_10", "=", "arg_7", ".", "_pyxmpp_payload_key", "if", "arg_8", "!=", "arg_3", ":", "continue", "if", "arg_9", ":", "if", "arg_10", "is", "None", "and", "arg_9", "not", "in", "arg_5", ":", "continue", "if", "arg_10", "and", "(", "arg_9", ",", "arg_10", ")", "not", "in", "arg_6", ":", "continue", "arg_11", "=", "arg_7", "(", "arg_2", ")", "if", "arg_0", ".", "_process_handler_result", "(", "arg_11", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = None):\n        \"\"\" Search the handler list for handlers matching\n        given stanza type and payload namespace. Run the\n        handlers found ordering them by priority until\n        the first one which returns `True`.\n\n        :Parameters:\n            - `handler_list`: list of available handlers\n            - `stanza`: the stanza to handle\n            - `stanza_type`: stanza type override (value of its \"type\"\n              attribute)\n\n        :return: result of the last handler or `False` if no\n            handler was found.\n        \"\"\"\n        # pylint: disable=W0212\n        if arg_3 is None:\n            arg_3 = arg_2.stanza_type\n        arg_4 = arg_2.get_all_payload()\n        arg_5 = [p.__class__ for p in arg_4]\n        arg_6 = [(p.__class__, p.handler_key) for p in arg_4]\n        for arg_7 in arg_1:\n            arg_8 = arg_7._pyxmpp_stanza_handled[1]\n            arg_9 = arg_7._pyxmpp_payload_class_handled\n            arg_10 = arg_7._pyxmpp_payload_key\n            if arg_8 != arg_3:\n                continue\n            if arg_9:\n                if arg_10 is None and arg_9 not in arg_5:\n                    continue\n                if arg_10 and (arg_9, arg_10) not in arg_6:\n                    continue\n            arg_11 = arg_7(arg_2)\n            if arg_0._process_handler_result(arg_11):\n                return True\n        return False", "path": "pyxmpp2/stanzaprocessor.py", "identifier": "StanzaProcessor.__try_handlers", "docstring": "Search the handler list for handlers matching\n        given stanza type and payload namespace. Run the\n        handlers found ordering them by priority until\n        the first one which returns `True`.\n\n        :Parameters:\n            - `handler_list`: list of available handlers\n            - `stanza`: the stanza to handle\n            - `stanza_type`: stanza type override (value of its \"type\"\n              attribute)\n\n        :return: result of the last handler or `False` if no\n            handler was found.", "docstring_tokens": ["Search", "the", "handler", "list", "for", "handlers", "matching", "given", "stanza", "type", "and", "payload", "namespace", ".", "Run", "the", "handlers", "found", "ordering", "them", "by", "priority", "until", "the", "first", "one", "which", "returns", "True", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 252777}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/redshift_hook.py#L100-L113", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates a snapshot of a cluster", "language": "python", "parameters": "(self, snapshot_identifier, cluster_identifier)", "return_statement": "return response['Snapshot'] if response['Snapshot'] else None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "SnapshotIdentifier", "=", "arg_1", ",", "ClusterIdentifier", "=", "arg_2", ",", ")", "return", "arg_3", "[", "'Snapshot'", "]", "if", "arg_3", "[", "'Snapshot'", "]", "else", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Creates a snapshot of a cluster\n\n        :param snapshot_identifier: unique identifier for a snapshot of a cluster\n        :type snapshot_identifier: str\n        :param cluster_identifier: unique identifier of a cluster\n        :type cluster_identifier: str\n        \"\"\"\n        arg_3 = arg_0.get_conn().Func(\n            SnapshotIdentifier=arg_1,\n            ClusterIdentifier=arg_2,\n        )\n        return arg_3['Snapshot'] if arg_3['Snapshot'] else None", "path": "airflow/contrib/hooks/redshift_hook.py", "identifier": "RedshiftHook.create_cluster_snapshot", "docstring": "Creates a snapshot of a cluster\n\n        :param snapshot_identifier: unique identifier for a snapshot of a cluster\n        :type snapshot_identifier: str\n        :param cluster_identifier: unique identifier of a cluster\n        :type cluster_identifier: str", "docstring_tokens": ["Creates", "a", "snapshot", "of", "a", "cluster"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252778}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/pygments_highlighter.py#L129-L135", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Sets the style to the specified Pygments style.", "language": "python", "parameters": "(self, style)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_1", "=", "get_style_by_name", "(", "arg_1", ")", "arg_0", ".", "_style", "=", "arg_1", "arg_0", ".", "_clear_caches", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Sets the style to the specified Pygments style.\n        \"\"\"\n        if isinstance(arg_1, basestring):\n            arg_1 = get_style_by_name(arg_1)\n        arg_0._style = arg_1\n        arg_0._clear_caches()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/pygments_highlighter.py", "identifier": "PygmentsHighlighter.set_style", "docstring": "Sets the style to the specified Pygments style.", "docstring_tokens": ["Sets", "the", "style", "to", "the", "specified", "Pygments", "style", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252779}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/__init__.py#L321-L372", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Automatically includes all submodules and role selectors\n    in the top-level fabfile using spooky-scary black magic.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "inspect", ".", "stack", "(", ")", "arg_1", "=", "None", "for", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_5", ",", "arg_5", "in", "arg_0", ":", "if", "'fabfile.py'", "in", "arg_3", ":", "arg_1", "=", "arg_2", "break", "if", "not", "arg_1", ":", "return", "try", ":", "arg_6", "=", "arg_1", ".", "f_locals", "for", "arg_7", ",", "arg_8", "in", "sub_modules", ".", "items", "(", ")", ":", "arg_6", "[", "arg_7", "]", "=", "arg_8", "for", "arg_9", ",", "arg_10", "in", "role_commands", ".", "items", "(", ")", ":", "assert", "arg_9", "not", "in", "sub_modules", ",", "(", "'The role %s conflicts with a built-in submodule. '", "'Please choose a different name.'", ")", "%", "(", "arg_9", ")", "arg_6", "[", "arg_9", "]", "=", "arg_10", "arg_6", "[", "'common'", "]", "=", "common", "arg_6", "[", "'shell'", "]", "=", "shell", "for", "arg_11", "in", "common", ".", "post_import_modules", ":", "exec", "(", "\"import %s\"", "%", "arg_11", ")", "arg_6", "[", "arg_11", "]", "=", "locals", "(", ")", "[", "arg_11", "]", "finally", ":", "del", "arg_0"], "function": "def Func():\n    \"\"\"\n    Automatically includes all submodules and role selectors\n    in the top-level fabfile using spooky-scary black magic.\n\n    This allows us to avoid manually declaring imports for every module, e.g.\n\n        import burlap.pip\n        import burlap.vm\n        import burlap...\n\n    which has the added benefit of allowing us to manually call the commands\n    without typing \"burlap\".\n\n    This is soley for convenience. If not needed, it can be disabled\n    by specifying the environment variable:\n\n        export BURLAP_POPULATE_STACK=0\n    \"\"\"\n    arg_0 = inspect.stack()\n    arg_1 = None\n    for arg_2, arg_3, arg_4, arg_5, arg_5, arg_5 in arg_0:\n        if 'fabfile.py' in arg_3:\n            arg_1 = arg_2\n            break\n    if not arg_1:\n        return\n    try:\n        arg_6 = arg_1.f_locals\n        for arg_7, arg_8 in sub_modules.items():\n            arg_6[arg_7] = arg_8\n        for arg_9, arg_10 in role_commands.items():\n            assert arg_9 not in sub_modules, \\\n                ('The role %s conflicts with a built-in submodule. '\n                 'Please choose a different name.') % (arg_9)\n            arg_6[arg_9] = arg_10\n        arg_6['common'] = common\n\n        # Put all debug commands into the global namespace.\n\n#         for _debug_name in debug.debug.get_tasks():\n#             print('_debug_name:', _debug_name)\n\n        arg_6['shell'] = shell#debug.debug.shell\n\n        # Put all virtual satchels in the global namespace so Fabric can find them.\n        for arg_11 in common.post_import_modules:\n            exec(\"import %s\" % arg_11) # pylint: disable=exec-used\n            arg_6[arg_11] = locals()[arg_11]\n\n    finally:\n        del arg_0", "path": "burlap/__init__.py", "identifier": "populate_fabfile", "docstring": "Automatically includes all submodules and role selectors\n    in the top-level fabfile using spooky-scary black magic.\n\n    This allows us to avoid manually declaring imports for every module, e.g.\n\n        import burlap.pip\n        import burlap.vm\n        import burlap...\n\n    which has the added benefit of allowing us to manually call the commands\n    without typing \"burlap\".\n\n    This is soley for convenience. If not needed, it can be disabled\n    by specifying the environment variable:\n\n        export BURLAP_POPULATE_STACK=0", "docstring_tokens": ["Automatically", "includes", "all", "submodules", "and", "role", "selectors", "in", "the", "top", "-", "level", "fabfile", "using", "spooky", "-", "scary", "black", "magic", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 252780}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/nonphysical.py#L72-L263", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This fits a univariate cubic spline to the phased light curve.", "language": "python", "parameters": "(times, mags, errs, period,\n                         knotfraction=0.01,\n                         maxknots=30,\n                         sigclip=30.0,\n                         plotfit=False,\n                         ignoreinitfail=False,\n                         magsarefluxes=False,\n                         verbose=True)", "return_statement": "return returndict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0.01", ",", "arg_5", "=", "30", ",", "arg_6", "=", "30.0", ",", "arg_7", "=", "False", ",", "arg_8", "=", "False", ",", "arg_9", "=", "False", ",", "arg_10", "=", "True", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "npfull_like", "(", "arg_1", ",", "0.005", ")", "arg_11", ",", "arg_12", ",", "arg_13", "=", "sigclip_magseries", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_6", "=", "arg_6", ",", "arg_9", "=", "arg_9", ")", "arg_14", "=", "npnonzero", "(", "arg_13", ")", "arg_11", ",", "arg_12", ",", "arg_13", "=", "arg_11", "[", "arg_14", "]", ",", "arg_12", "[", "arg_14", "]", ",", "arg_13", "[", "arg_14", "]", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", "=", "(", "get_phased_quantities", "(", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_3", ")", ")", "arg_20", "=", "len", "(", "arg_15", ")", "arg_21", "=", "int", "(", "npfloor", "(", "arg_4", "*", "arg_20", ")", ")", "arg_21", "=", "arg_5", "if", "arg_21", ">", "arg_5", "else", "arg_21", "arg_22", "=", "nplinspace", "(", "arg_15", "[", "0", "]", "+", "0.01", ",", "arg_15", "[", "-", "1", "]", "-", "0.01", ",", "num", "=", "arg_21", ")", "arg_23", "=", "npdiff", "(", "arg_15", ")", ">", "0.0", "arg_24", "=", "npconcatenate", "(", "(", "nparray", "(", "[", "True", "]", ")", ",", "arg_23", ")", ")", "arg_15", ",", "arg_16", ",", "arg_17", "=", "(", "arg_15", "[", "arg_24", "]", ",", "arg_16", "[", "arg_24", "]", ",", "arg_17", "[", "arg_24", "]", ")", "arg_25", "=", "LSQUnivariateSpline", "(", "arg_15", ",", "arg_16", ",", "t", "=", "arg_22", ",", "w", "=", "1.0", "/", "arg_17", ")", "arg_26", "=", "arg_25", "(", "arg_15", ")", "arg_27", "=", "npsum", "(", "(", "(", "arg_26", "-", "arg_16", ")", "*", "(", "arg_26", "-", "arg_16", ")", ")", "/", "(", "arg_17", "*", "arg_17", ")", ")", "arg_28", "=", "arg_27", "/", "(", "len", "(", "arg_16", ")", "-", "arg_21", "-", "1", ")", "if", "arg_10", ":", "LOGINFO", "(", "'spline fit done. nknots = %s,  '", "'chisq = %.5f, reduced chisq = %.5f'", "%", "(", "arg_21", ",", "arg_27", ",", "arg_28", ")", ")", "if", "not", "arg_9", ":", "arg_29", "=", "npwhere", "(", "arg_26", "==", "npmax", "(", "arg_26", ")", ")", "else", ":", "arg_29", "=", "npwhere", "(", "arg_26", "==", "npmin", "(", "arg_26", ")", ")", "if", "len", "(", "arg_29", "[", "0", "]", ")", ">", "1", ":", "arg_29", "=", "(", "arg_29", "[", "0", "]", "[", "0", "]", ",", ")", "arg_30", "=", "arg_18", "[", "arg_29", "]", "arg_31", "=", "{", "'fittype'", ":", "'spline'", ",", "'fitinfo'", ":", "{", "'nknots'", ":", "arg_21", ",", "'fitmags'", ":", "arg_26", ",", "'fitepoch'", ":", "arg_30", "}", ",", "'fitchisq'", ":", "arg_27", ",", "'fitredchisq'", ":", "arg_28", ",", "'fitplotfile'", ":", "None", ",", "'magseries'", ":", "{", "'times'", ":", "arg_18", ",", "'phase'", ":", "arg_15", ",", "'mags'", ":", "arg_16", ",", "'errs'", ":", "arg_17", ",", "'magsarefluxes'", ":", "arg_9", "}", ",", "}", "if", "arg_7", "and", "isinstance", "(", "arg_7", ",", "str", ")", ":", "make_fit_plot", "(", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_26", ",", "arg_3", ",", "arg_19", ",", "arg_30", ",", "arg_7", ",", "arg_9", "=", "arg_9", ")", "arg_31", "[", "'fitplotfile'", "]", "=", "arg_7", "return", "arg_31"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                         arg_4=0.01,\n                         arg_5=30,\n                         arg_6=30.0,\n                         arg_7=False,\n                         arg_8=False,\n                         arg_9=False,\n                         arg_10=True):\n\n    '''This fits a univariate cubic spline to the phased light curve.\n\n    This fit may be better than the Fourier fit for sharply variable objects,\n    like EBs, so can be used to distinguish them from other types of variables.\n\n    Parameters\n    ----------\n\n    times,mags,errs : np.array\n        The input mag/flux time-series to fit a spline to.\n\n    period : float\n        The period to use for the spline fit.\n\n    knotfraction : float\n        The knot fraction is the number of internal knots to use for the\n        spline. A value of 0.01 (or 1%) of the total number of non-nan\n        observations appears to work quite well, without over-fitting. maxknots\n        controls the maximum number of knots that will be allowed.\n\n    maxknots : int\n        The maximum number of knots that will be used even if `knotfraction`\n        gives a value to use larger than `maxknots`. This helps dealing with\n        over-fitting to short time-scale variations.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    magsarefluxes : bool\n        If True, will treat the input values of `mags` as fluxes for purposes of\n        plotting the fit and sig-clipping.\n\n    plotfit : str or False\n        If this is a string, this function will make a plot for the fit to the\n        mag/flux time-series and writes the plot to the path specified here.\n\n    ignoreinitfail : bool\n        If this is True, ignores the initial failure to find a set of optimized\n        Fourier parameters using the global optimization function and proceeds\n        to do a least-squares fit anyway.\n\n    verbose : bool\n        If True, will indicate progress and warn of any problems.\n\n    Returns\n    -------\n\n    dict\n        This function returns a dict containing the model fit parameters, the\n        minimized chi-sq value and the reduced chi-sq value. The form of this\n        dict is mostly standardized across all functions in this module::\n\n            {\n                'fittype':'spline',\n                'fitinfo':{\n                    'nknots': the number of knots used for the fit\n                    'fitmags': the model fit mags,\n                    'fitepoch': the epoch of minimum light for the fit,\n                },\n                'fitchisq': the minimized value of the fit's chi-sq,\n                'fitredchisq':the reduced chi-sq value,\n                'fitplotfile': the output fit plot if fitplot is not None,\n                'magseries':{\n                    'times':input times in phase order of the model,\n                    'phase':the phases of the model mags,\n                    'mags':input mags/fluxes in the phase order of the model,\n                    'errs':errs in the phase order of the model,\n                    'magsarefluxes':input value of magsarefluxes kwarg\n                }\n            }\n\n    '''\n\n    # this is required to fit the spline correctly\n    if arg_2 is None:\n        arg_2 = npfull_like(arg_1, 0.005)\n\n    # sigclip the magnitude time series\n    arg_11, arg_12, arg_13 = sigclip_magseries(arg_0, arg_1, arg_2,\n                                             arg_6=arg_6,\n                                             arg_9=arg_9)\n    # get rid of zero errs\n    arg_14 = npnonzero(arg_13)\n    arg_11, arg_12, arg_13 = arg_11[arg_14], arg_12[arg_14], arg_13[arg_14]\n\n    # phase the mag series\n    arg_15, arg_16, arg_17, arg_18, arg_19 = (\n        get_phased_quantities(arg_11, arg_12, arg_13, arg_3)\n    )\n\n    # now figure out the number of knots up to max knots (=100)\n    arg_20 = len(arg_15)\n    arg_21 = int(npfloor(arg_4*arg_20))\n    arg_21 = arg_5 if arg_21 > arg_5 else arg_21\n    arg_22 = nplinspace(arg_15[0] + 0.01,\n                             arg_15[-1] - 0.01,\n                             num=arg_21)\n\n    # NOTE: newer scipy needs x to be strictly increasing. this means we should\n    # filter out anything that doesn't have np.diff(phase) > 0.0\n    # FIXME: this needs to be tested\n    arg_23 = npdiff(arg_15) > 0.0\n    arg_24 = npconcatenate((nparray([True]), arg_23))\n    arg_15, arg_16, arg_17 = (arg_15[arg_24],\n                           arg_16[arg_24],\n                           arg_17[arg_24])\n\n    # generate and fit the spline\n    arg_25 = LSQUnivariateSpline(arg_15, arg_16, t=arg_22, w=1.0/arg_17)\n\n    # calculate the spline fit to the actual phases, the chisq and red-chisq\n    arg_26 = arg_25(arg_15)\n\n    arg_27 = npsum(\n        ((arg_26 - arg_16)*(arg_26 - arg_16)) / (arg_17*arg_17)\n    )\n\n    arg_28 = arg_27/(len(arg_16) - arg_21 - 1)\n\n    if arg_10:\n        LOGINFO(\n            'spline fit done. nknots = %s,  '\n            'chisq = %.5f, reduced chisq = %.5f' %\n            (arg_21, arg_27, arg_28)\n        )\n\n    # figure out the time of light curve minimum (i.e. the fit epoch)\n    # this is when the fit mag is maximum (i.e. the faintest)\n    # or if magsarefluxes = True, then this is when fit flux is minimum\n    if not arg_9:\n        arg_29 = npwhere(arg_26 == npmax(arg_26))\n    else:\n        arg_29 = npwhere(arg_26 == npmin(arg_26))\n    if len(arg_29[0]) > 1:\n        arg_29 = (arg_29[0][0],)\n    arg_30 = arg_18[arg_29]\n\n    # assemble the returndict\n    arg_31 = {\n        'fittype':'spline',\n        'fitinfo':{\n            'nknots':arg_21,\n            'fitmags':arg_26,\n            'fitepoch':arg_30\n        },\n        'fitchisq':arg_27,\n        'fitredchisq':arg_28,\n        'fitplotfile':None,\n        'magseries':{\n            'times':arg_18,\n            'phase':arg_15,\n            'mags':arg_16,\n            'errs':arg_17,\n            'magsarefluxes':arg_9\n        },\n    }\n\n    # make the fit plot if required\n    if arg_7 and isinstance(arg_7, str):\n\n        make_fit_plot(arg_15, arg_16, arg_17, arg_26,\n                      arg_3, arg_19, arg_30,\n                      arg_7,\n                      arg_9=arg_9)\n\n        arg_31['fitplotfile'] = arg_7\n\n    return arg_31", "path": "astrobase/lcfit/nonphysical.py", "identifier": "spline_fit_magseries", "docstring": "This fits a univariate cubic spline to the phased light curve.\n\n    This fit may be better than the Fourier fit for sharply variable objects,\n    like EBs, so can be used to distinguish them from other types of variables.\n\n    Parameters\n    ----------\n\n    times,mags,errs : np.array\n        The input mag/flux time-series to fit a spline to.\n\n    period : float\n        The period to use for the spline fit.\n\n    knotfraction : float\n        The knot fraction is the number of internal knots to use for the\n        spline. A value of 0.01 (or 1%) of the total number of non-nan\n        observations appears to work quite well, without over-fitting. maxknots\n        controls the maximum number of knots that will be allowed.\n\n    maxknots : int\n        The maximum number of knots that will be used even if `knotfraction`\n        gives a value to use larger than `maxknots`. This helps dealing with\n        over-fitting to short time-scale variations.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    magsarefluxes : bool\n        If True, will treat the input values of `mags` as fluxes for purposes of\n        plotting the fit and sig-clipping.\n\n    plotfit : str or False\n        If this is a string, this function will make a plot for the fit to the\n        mag/flux time-series and writes the plot to the path specified here.\n\n    ignoreinitfail : bool\n        If this is True, ignores the initial failure to find a set of optimized\n        Fourier parameters using the global optimization function and proceeds\n        to do a least-squares fit anyway.\n\n    verbose : bool\n        If True, will indicate progress and warn of any problems.\n\n    Returns\n    -------\n\n    dict\n        This function returns a dict containing the model fit parameters, the\n        minimized chi-sq value and the reduced chi-sq value. The form of this\n        dict is mostly standardized across all functions in this module::\n\n            {\n                'fittype':'spline',\n                'fitinfo':{\n                    'nknots': the number of knots used for the fit\n                    'fitmags': the model fit mags,\n                    'fitepoch': the epoch of minimum light for the fit,\n                },\n                'fitchisq': the minimized value of the fit's chi-sq,\n                'fitredchisq':the reduced chi-sq value,\n                'fitplotfile': the output fit plot if fitplot is not None,\n                'magseries':{\n                    'times':input times in phase order of the model,\n                    'phase':the phases of the model mags,\n                    'mags':input mags/fluxes in the phase order of the model,\n                    'errs':errs in the phase order of the model,\n                    'magsarefluxes':input value of magsarefluxes kwarg\n                }\n            }", "docstring_tokens": ["This", "fits", "a", "univariate", "cubic", "spline", "to", "the", "phased", "light", "curve", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252781}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/query.py#L292-L301", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Return a WHERE clause matching the given API path and user_id.", "language": "python", "parameters": "(user_id, api_path)", "return_statement": "return and_(\n        files.c.name == name,\n        files.c.user_id == user_id,\n        files.c.parent_name == directory,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "split_api_filepath", "(", "arg_1", ")", "return", "and_", "(", "files", ".", "c", ".", "name", "==", "arg_3", ",", "files", ".", "c", ".", "user_id", "==", "arg_0", ",", "files", ".", "c", ".", "parent_name", "==", "arg_2", ",", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Return a WHERE clause matching the given API path and user_id.\n    \"\"\"\n    arg_2, arg_3 = split_api_filepath(arg_1)\n    return and_(\n        files.c.name == arg_3,\n        files.c.user_id == arg_0,\n        files.c.parent_name == arg_2,\n    )", "path": "pgcontents/query.py", "identifier": "_file_where", "docstring": "Return a WHERE clause matching the given API path and user_id.", "docstring_tokens": ["Return", "a", "WHERE", "clause", "matching", "the", "given", "API", "path", "and", "user_id", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 252782}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_import.py#L550-L596", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Splits the modpath into the dir that must be in PYTHONPATH for the module\n    to be imported and the modulepath relative to this directory.", "language": "python", "parameters": "(modpath, check=True)", "return_statement": "return dpath, rel_modpath", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "six", ".", "PY2", ":", "if", "arg_0", ".", "endswith", "(", "'.pyc'", ")", ":", "arg_0", "=", "arg_0", "[", ":", "-", "1", "]", "arg_2", "=", "abspath", "(", "expanduser", "(", "arg_0", ")", ")", "if", "arg_1", ":", "if", "not", "exists", "(", "arg_2", ")", ":", "if", "not", "exists", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "'modpath={} does not exist'", ".", "format", "(", "arg_0", ")", ")", "raise", "ValueError", "(", "'modpath={} is not a module'", ".", "format", "(", "arg_0", ")", ")", "if", "isdir", "(", "arg_2", ")", "and", "not", "exists", "(", "join", "(", "arg_0", ",", "'__init__.py'", ")", ")", ":", "raise", "ValueError", "(", "'modpath={} is not a module'", ".", "format", "(", "arg_0", ")", ")", "arg_3", ",", "arg_4", "=", "split", "(", "arg_2", ")", "arg_5", "=", "[", "arg_4", "]", "arg_6", "=", "arg_3", "while", "exists", "(", "join", "(", "arg_6", ",", "'__init__.py'", ")", ")", ":", "arg_6", ",", "arg_7", "=", "split", "(", "arg_6", ")", "arg_5", ".", "append", "(", "arg_7", ")", "arg_8", "=", "arg_5", "[", ":", ":", "-", "1", "]", "arg_9", "=", "os", ".", "path", ".", "sep", ".", "join", "(", "arg_8", ")", "return", "arg_6", ",", "arg_9"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"\n    Splits the modpath into the dir that must be in PYTHONPATH for the module\n    to be imported and the modulepath relative to this directory.\n\n    Args:\n        modpath (str): module filepath\n        check (bool): if False, does not raise an error if modpath is a\n            directory and does not contain an `__init__.py` file.\n\n    Returns:\n        tuple: (directory, rel_modpath)\n\n    Raises:\n        ValueError: if modpath does not exist or is not a package\n\n    Example:\n        >>> from xdoctest import static_analysis\n        >>> modpath = static_analysis.__file__.replace('.pyc', '.py')\n        >>> modpath = abspath(modpath)\n        >>> dpath, rel_modpath = Func(modpath)\n        >>> recon = join(dpath, rel_modpath)\n        >>> assert recon == modpath\n        >>> assert rel_modpath == join('xdoctest', 'static_analysis.py')\n    \"\"\"\n    if six.PY2:\n        if arg_0.endswith('.pyc'):\n            arg_0 = arg_0[:-1]\n    arg_2 = abspath(expanduser(arg_0))\n    if arg_1:\n        if not exists(arg_2):\n            if not exists(arg_0):\n                raise ValueError('modpath={} does not exist'.format(arg_0))\n            raise ValueError('modpath={} is not a module'.format(arg_0))\n        if isdir(arg_2) and not exists(join(arg_0, '__init__.py')):\n            # dirs without inits are not modules\n            raise ValueError('modpath={} is not a module'.format(arg_0))\n    arg_3, arg_4 = split(arg_2)\n    arg_5 = [arg_4]\n    # Recurse down directories until we are out of the package\n    arg_6 = arg_3\n    while exists(join(arg_6, '__init__.py')):\n        arg_6, arg_7 = split(arg_6)\n        arg_5.append(arg_7)\n    arg_8 = arg_5[::-1]\n    arg_9 = os.path.sep.join(arg_8)\n    return arg_6, arg_9", "path": "ubelt/util_import.py", "identifier": "split_modpath", "docstring": "Splits the modpath into the dir that must be in PYTHONPATH for the module\n    to be imported and the modulepath relative to this directory.\n\n    Args:\n        modpath (str): module filepath\n        check (bool): if False, does not raise an error if modpath is a\n            directory and does not contain an `__init__.py` file.\n\n    Returns:\n        tuple: (directory, rel_modpath)\n\n    Raises:\n        ValueError: if modpath does not exist or is not a package\n\n    Example:\n        >>> from xdoctest import static_analysis\n        >>> modpath = static_analysis.__file__.replace('.pyc', '.py')\n        >>> modpath = abspath(modpath)\n        >>> dpath, rel_modpath = split_modpath(modpath)\n        >>> recon = join(dpath, rel_modpath)\n        >>> assert recon == modpath\n        >>> assert rel_modpath == join('xdoctest', 'static_analysis.py')", "docstring_tokens": ["Splits", "the", "modpath", "into", "the", "dir", "that", "must", "be", "in", "PYTHONPATH", "for", "the", "module", "to", "be", "imported", "and", "the", "modulepath", "relative", "to", "this", "directory", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 252783}
{"url": "https://github.com/matthewgilbert/pdblp/blob/aaef49ad6fca9af6ee44739d6e7e1cc3e7b0f8e2/pdblp/pdblp.py#L117-L149", "sha": "aaef49ad6fca9af6ee44739d6e7e1cc3e7b0f8e2", "docstring_summary": "Start connection and initialize session services", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_get_logger", "(", "arg_0", ".", "debug", ")", "arg_2", "=", "arg_0", ".", "_session", ".", "Func", "(", ")", "if", "arg_2", ":", "arg_3", "=", "arg_0", ".", "_session", ".", "nextEvent", "(", ")", "arg_4", "=", "_EVENT_DICT", "[", "arg_3", ".", "eventType", "(", ")", "]", "arg_1", ".", "info", "(", "'Event Type: {!r}'", ".", "format", "(", "arg_4", ")", ")", "for", "arg_5", "in", "arg_3", ":", "arg_1", ".", "info", "(", "'Message Received:\\n{}'", ".", "format", "(", "arg_5", ")", ")", "if", "arg_3", ".", "eventType", "(", ")", "!=", "blpapi", ".", "Event", ".", "SESSION_STATUS", ":", "raise", "RuntimeError", "(", "'Expected a \"SESSION_STATUS\" event but '", "'received a {!r}'", ".", "format", "(", "arg_4", ")", ")", "arg_3", "=", "arg_0", ".", "_session", ".", "nextEvent", "(", ")", "arg_4", "=", "_EVENT_DICT", "[", "arg_3", ".", "eventType", "(", ")", "]", "arg_1", ".", "info", "(", "'Event Type: {!r}'", ".", "format", "(", "arg_4", ")", ")", "for", "arg_5", "in", "arg_3", ":", "arg_1", ".", "info", "(", "'Message Received:\\n{}'", ".", "format", "(", "arg_5", ")", ")", "if", "arg_3", ".", "eventType", "(", ")", "!=", "blpapi", ".", "Event", ".", "SESSION_STATUS", ":", "raise", "RuntimeError", "(", "'Expected a \"SESSION_STATUS\" event but '", "'received a {!r}'", ".", "format", "(", "arg_4", ")", ")", "else", ":", "arg_3", "=", "arg_0", ".", "_session", ".", "nextEvent", "(", "arg_0", ".", "timeout", ")", "if", "arg_3", ".", "eventType", "(", ")", "==", "blpapi", ".", "Event", ".", "SESSION_STATUS", ":", "for", "arg_5", "in", "arg_3", ":", "arg_1", ".", "warning", "(", "'Message Received:\\n{}'", ".", "format", "(", "arg_5", ")", ")", "raise", "ConnectionError", "(", "'Could not Func blpapi.Session'", ")", "arg_0", ".", "_init_services", "(", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"\n        Start connection and initialize session services\n        \"\"\"\n\n        # flush event queue in defensive way\n        arg_1 = _get_logger(arg_0.debug)\n        arg_2 = arg_0._session.Func()\n        if arg_2:\n            arg_3 = arg_0._session.nextEvent()\n            arg_4 = _EVENT_DICT[arg_3.eventType()]\n            arg_1.info('Event Type: {!r}'.format(arg_4))\n            for arg_5 in arg_3:\n                arg_1.info('Message Received:\\n{}'.format(arg_5))\n            if arg_3.eventType() != blpapi.Event.SESSION_STATUS:\n                raise RuntimeError('Expected a \"SESSION_STATUS\" event but '\n                                   'received a {!r}'.format(arg_4))\n            arg_3 = arg_0._session.nextEvent()\n            arg_4 = _EVENT_DICT[arg_3.eventType()]\n            arg_1.info('Event Type: {!r}'.format(arg_4))\n            for arg_5 in arg_3:\n                arg_1.info('Message Received:\\n{}'.format(arg_5))\n            if arg_3.eventType() != blpapi.Event.SESSION_STATUS:\n                raise RuntimeError('Expected a \"SESSION_STATUS\" event but '\n                                   'received a {!r}'.format(arg_4))\n        else:\n            arg_3 = arg_0._session.nextEvent(arg_0.timeout)\n            if arg_3.eventType() == blpapi.Event.SESSION_STATUS:\n                for arg_5 in arg_3:\n                    arg_1.warning('Message Received:\\n{}'.format(arg_5))\n                raise ConnectionError('Could not Func blpapi.Session')\n        arg_0._init_services()\n        return arg_0", "path": "pdblp/pdblp.py", "identifier": "BCon.start", "docstring": "Start connection and initialize session services", "docstring_tokens": ["Start", "connection", "and", "initialize", "session", "services"], "nwo": "matthewgilbert/pdblp", "score": 0.6260425956634948, "idx": 252784}
{"url": "https://github.com/lindsaymarkward/python-yeelight-sunflower/blob/4ec72d005ce307f832429620ba0bcbf6b236eead/yeelightsunflower/main.py#L236-L241", "sha": "4ec72d005ce307f832429620ba0bcbf6b236eead", "docstring_summary": "Set brightness of bulb.", "language": "python", "parameters": "(self, brightness)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"C {},,,,{},\\r\\n\"", ".", "format", "(", "arg_0", ".", "_zid", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_hub", ".", "send_command", "(", "arg_2", ")", "_LOGGER", ".", "debug", "(", "\"Set brightness %s: %s\"", ",", "repr", "(", "arg_2", ")", ",", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set brightness of bulb.\"\"\"\n        arg_2 = \"C {},,,,{},\\r\\n\".format(arg_0._zid, arg_1)\n        arg_3 = arg_0._hub.send_command(arg_2)\n        _LOGGER.debug(\"Set brightness %s: %s\", repr(arg_2), arg_3)\n        return arg_3", "path": "yeelightsunflower/main.py", "identifier": "Bulb.set_brightness", "docstring": "Set brightness of bulb.", "docstring_tokens": ["Set", "brightness", "of", "bulb", "."], "nwo": "lindsaymarkward/python-yeelight-sunflower", "score": 0.18941942438232184, "idx": 252785}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/latent_dirichlet_allocation_edward2.py#L371-L399", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns the summary of the learned topics.", "language": "python", "parameters": "(topics_words, alpha, vocabulary,\n                       topics_to_print=10, words_per_topic=10)", "return_statement": "return np.array(res)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "10", ",", "arg_4", "=", "10", ")", ":", "arg_1", "=", "np", ".", "squeeze", "(", "arg_1", ",", "axis", "=", "0", ")", "arg_5", "=", "np", ".", "argsort", "(", "-", "arg_1", ",", "kind", "=", "\"mergesort\"", ")", "arg_6", "=", "np", ".", "argsort", "(", "-", "arg_0", ",", "axis", "=", "1", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_5", "[", ":", "arg_3", "]", ":", "arg_9", "=", "[", "\"index={} alpha={:.2f}\"", ".", "format", "(", "arg_8", ",", "arg_1", "[", "arg_8", "]", ")", "]", "arg_9", "+=", "[", "arg_2", "[", "arg_10", "]", "for", "arg_10", "in", "arg_6", "[", "arg_8", ",", ":", "arg_4", "]", "]", "arg_7", ".", "append", "(", "\" \"", ".", "join", "(", "arg_9", ")", ")", "return", "np", ".", "array", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                       arg_3=10, arg_4=10):\n  \"\"\"Returns the summary of the learned topics.\n\n  Arguments:\n    topics_words: KxV tensor with topics as rows and words as columns.\n    alpha: 1xK tensor of prior Dirichlet concentrations for the\n        topics.\n    vocabulary: A mapping of word's integer index to the corresponding string.\n    topics_to_print: The number of topics with highest prior weight to\n        summarize.\n    words_per_topic: Number of wodrs per topic to return.\n\n  Returns:\n    summary: A np.array with strings.\n  \"\"\"\n  arg_1 = np.squeeze(arg_1, axis=0)\n  # Use a stable sorting algorithm so that when alpha is fixed\n  # we always get the same topics.\n  arg_5 = np.argsort(-arg_1, kind=\"mergesort\")\n  arg_6 = np.argsort(-arg_0, axis=1)\n\n  arg_7 = []\n  for arg_8 in arg_5[:arg_3]:\n    arg_9 = [\"index={} alpha={:.2f}\".format(arg_8, arg_1[arg_8])]\n    arg_9 += [arg_2[arg_10] for arg_10 in arg_6[arg_8, :arg_4]]\n    arg_7.append(\" \".join(arg_9))\n\n  return np.array(arg_7)", "path": "tensorflow_probability/examples/latent_dirichlet_allocation_edward2.py", "identifier": "get_topics_strings", "docstring": "Returns the summary of the learned topics.\n\n  Arguments:\n    topics_words: KxV tensor with topics as rows and words as columns.\n    alpha: 1xK tensor of prior Dirichlet concentrations for the\n        topics.\n    vocabulary: A mapping of word's integer index to the corresponding string.\n    topics_to_print: The number of topics with highest prior weight to\n        summarize.\n    words_per_topic: Number of wodrs per topic to return.\n\n  Returns:\n    summary: A np.array with strings.", "docstring_tokens": ["Returns", "the", "summary", "of", "the", "learned", "topics", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252786}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L718-L747", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Current instruction pointed by self.pc", "language": "python", "parameters": "(self)", "return_statement": "return instruction", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "getattr", "(", "arg_0", ",", "'_decoding_cache'", ")", "except", "Exception", ":", "arg_1", "=", "arg_0", ".", "_decoding_cache", "=", "{", "}", "arg_2", "=", "arg_0", ".", "pc", "if", "isinstance", "(", "arg_2", ",", "Constant", ")", ":", "arg_2", "=", "arg_2", ".", "value", "if", "arg_2", "in", "arg_1", ":", "return", "arg_1", "[", "arg_2", "]", "def", "getcode", "(", ")", ":", "arg_3", "=", "arg_0", ".", "bytecode", "for", "arg_4", "in", "range", "(", "arg_2", ",", "len", "(", "arg_3", ")", ")", ":", "yield", "simplify", "(", "arg_3", "[", "arg_4", "]", ")", ".", "value", "while", "True", ":", "yield", "0", "Func", "=", "EVMAsm", ".", "disassemble_one", "(", "getcode", "(", ")", ",", "arg_2", "=", "arg_2", ",", "fork", "=", "DEFAULT_FORK", ")", "arg_1", "[", "arg_2", "]", "=", "Func", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Current instruction pointed by self.pc\n        \"\"\"\n        # FIXME check if pc points to invalid instruction\n        # if self.pc >= len(self.bytecode):\n        #    return InvalidOpcode('Code out of range')\n        # if self.pc in self.invalid:\n        #    raise InvalidOpcode('Opcode inside a PUSH immediate')\n        try:\n            arg_1 = getattr(arg_0, '_decoding_cache')\n        except Exception:\n            arg_1 = arg_0._decoding_cache = {}\n\n        arg_2 = arg_0.pc\n        if isinstance(arg_2, Constant):\n            arg_2 = arg_2.value\n\n        if arg_2 in arg_1:\n            return arg_1[arg_2]\n\n        def getcode():\n            arg_3 = arg_0.bytecode\n            for arg_4 in range(arg_2, len(arg_3)):\n                yield simplify(arg_3[arg_4]).value\n            while True:\n                yield 0\n        Func = EVMAsm.disassemble_one(getcode(), arg_2=arg_2, fork=DEFAULT_FORK)\n        arg_1[arg_2] = Func\n        return Func", "path": "manticore/platforms/evm.py", "identifier": "EVM.instruction", "docstring": "Current instruction pointed by self.pc", "docstring_tokens": ["Current", "instruction", "pointed", "by", "self", ".", "pc"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 252787}
{"url": "https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L630-L641", "sha": "3769aecbef6c83b6cd93ee72ece478ffe433ac57", "docstring_summary": "Writes out PNG image data in chunks to file pointer fp", "language": "python", "parameters": "(self, fp)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "urlopen", "(", ")", ".", "fp", "while", "1", ":", "try", ":", "arg_1", ".", "Func", "(", "arg_2", ".", "next", "(", ")", ")", "except", "StopIteration", ":", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Writes out PNG image data in chunks to file pointer fp\n\n        fp must support w or wb\n        \"\"\"\n        arg_2 = arg_0.urlopen().fp\n        while 1:\n            try:\n                arg_1.Func(arg_2.next())\n            except StopIteration:\n                return", "path": "GChartWrapper/GChart.py", "identifier": "GChart.write", "docstring": "Writes out PNG image data in chunks to file pointer fp\n\n        fp must support w or wb", "docstring_tokens": ["Writes", "out", "PNG", "image", "data", "in", "chunks", "to", "file", "pointer", "fp"], "nwo": "appknox/google-chartwrapper", "score": 0.12050106452410352, "idx": 252788}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/inspector.py#L240-L248", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "visit an astroid.Import node", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "root", "(", ")", ".", "file", "for", "arg_3", "in", "arg_1", ".", "names", ":", "arg_4", "=", "modutils", ".", "is_relative", "(", "arg_3", "[", "0", "]", ",", "arg_2", ")", "arg_0", ".", "_imported_module", "(", "arg_1", ",", "arg_3", "[", "0", "]", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"visit an astroid.Import node\n\n        resolve module dependencies\n        \"\"\"\n        arg_2 = arg_1.root().file\n        for arg_3 in arg_1.names:\n            arg_4 = modutils.is_relative(arg_3[0], arg_2)\n            arg_0._imported_module(arg_1, arg_3[0], arg_4)", "path": "pylint/pyreverse/inspector.py", "identifier": "Linker.visit_import", "docstring": "visit an astroid.Import node\n\n        resolve module dependencies", "docstring_tokens": ["visit", "an", "astroid", ".", "Import", "node"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252789}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1036-L1058", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Removes a NIC from the load balancer.", "language": "python", "parameters": "(self, datacenter_id,\n                                loadbalancer_id, nic_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/loadbalancers/%s/balancednics/%s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "method", "=", "'DELETE'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1,\n                                arg_2, arg_3):\n        \"\"\"\n        Removes a NIC from the load balancer.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      loadbalancer_id: The unique ID of the load balancer.\n        :type       loadbalancer_id: ``str``\n\n        :param      nic_id: The unique ID of the NIC.\n        :type       nic_id: ``str``\n\n        \"\"\"\n        arg_4 = arg_0._perform_request(\n            url='/datacenters/%s/loadbalancers/%s/balancednics/%s' % (\n                arg_1,\n                arg_2,\n                arg_3),\n            method='DELETE')\n\n        return arg_4", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.remove_loadbalanced_nic", "docstring": "Removes a NIC from the load balancer.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      loadbalancer_id: The unique ID of the load balancer.\n        :type       loadbalancer_id: ``str``\n\n        :param      nic_id: The unique ID of the NIC.\n        :type       nic_id: ``str``", "docstring_tokens": ["Removes", "a", "NIC", "from", "the", "load", "balancer", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 252790}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L1177-L1190", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "This method increases the permanence values of synapses of columns whose\n    activity level has been too low. Such columns are identified by having an\n    overlap duty cycle that drops too much below those of their peers. The\n    permanence values for such columns are increased.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "numpy", ".", "where", "(", "arg_0", ".", "_overlapDutyCycles", "<", "arg_0", ".", "_minOverlapDutyCycles", ")", "[", "0", "]", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "arg_0", ".", "_permanences", "[", "arg_2", "]", ".", "astype", "(", "realDType", ")", "arg_4", "=", "numpy", ".", "where", "(", "arg_0", ".", "_potentialPools", "[", "arg_2", "]", ">", "0", ")", "[", "0", "]", "arg_3", "[", "arg_4", "]", "+=", "arg_0", ".", "_synPermBelowStimulusInc", "arg_0", ".", "_updatePermanencesForColumn", "(", "arg_3", ",", "arg_2", ",", "raisePerm", "=", "False", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    This method increases the permanence values of synapses of columns whose\n    activity level has been too low. Such columns are identified by having an\n    overlap duty cycle that drops too much below those of their peers. The\n    permanence values for such columns are increased.\n    \"\"\"\n    arg_1 = numpy.where(arg_0._overlapDutyCycles\n                                < arg_0._minOverlapDutyCycles)[0]\n    for arg_2 in arg_1:\n      arg_3 = arg_0._permanences[arg_2].astype(realDType)\n      arg_4 = numpy.where(arg_0._potentialPools[arg_2] > 0)[0]\n      arg_3[arg_4] += arg_0._synPermBelowStimulusInc\n      arg_0._updatePermanencesForColumn(arg_3, arg_2, raisePerm=False)", "path": "src/nupic/algorithms/spatial_pooler.py", "identifier": "SpatialPooler._bumpUpWeakColumns", "docstring": "This method increases the permanence values of synapses of columns whose\n    activity level has been too low. Such columns are identified by having an\n    overlap duty cycle that drops too much below those of their peers. The\n    permanence values for such columns are increased.", "docstring_tokens": ["This", "method", "increases", "the", "permanence", "values", "of", "synapses", "of", "columns", "whose", "activity", "level", "has", "been", "too", "low", ".", "Such", "columns", "are", "identified", "by", "having", "an", "overlap", "duty", "cycle", "that", "drops", "too", "much", "below", "those", "of", "their", "peers", ".", "The", "permanence", "values", "for", "such", "columns", "are", "increased", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252791}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L348-L358", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Clean up children and remove the directory.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "_children", ":", "arg_0", ".", "_children", "[", "arg_1", "]", ".", "Func", "(", ")", "if", "arg_0", ".", "_Func", ":", "arg_0", ".", "remove", "(", "True", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Clean up children and remove the directory.\n\n        Directory will only be removed if the Func flag is set.\n        \"\"\"\n        for arg_1 in arg_0._children:\n            arg_0._children[arg_1].Func()\n\n        if arg_0._Func:\n            arg_0.remove(True)", "path": "scruffy/file.py", "identifier": "Directory.cleanup", "docstring": "Clean up children and remove the directory.\n\n        Directory will only be removed if the cleanup flag is set.", "docstring_tokens": ["Clean", "up", "children", "and", "remove", "the", "directory", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 252792}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/locations.py#L16-L29", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Returns a list of locations.", "language": "python", "parameters": "(self)", "return_statement": "return locations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"/2/locations\"", "arg_2", "=", "arg_0", ".", "_get_resource", "(", "arg_1", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", "[", "'locations'", "]", ":", "arg_3", ".", "append", "(", "arg_0", ".", "location_from_json", "(", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a list of locations.\n\n        http://dev.wheniwork.com/#listing-locations\n        \"\"\"\n        arg_1 = \"/2/locations\"\n\n        arg_2 = arg_0._get_resource(arg_1)\n        arg_3 = []\n        for arg_4 in arg_2['locations']:\n            arg_3.append(arg_0.location_from_json(arg_4))\n\n        return arg_3", "path": "uw_wheniwork/locations.py", "identifier": "Locations.get_locations", "docstring": "Returns a list of locations.\n\n        http://dev.wheniwork.com/#listing-locations", "docstring_tokens": ["Returns", "a", "list", "of", "locations", "."], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 252793}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L121-L132", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Update the internal line and column buffers after a new character\n        is added.", "language": "python", "parameters": "(self, c)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "newline_chars", ".", "match", "(", "arg_1", ")", ":", "arg_0", ".", "_col", ".", "append", "(", "0", ")", "arg_0", ".", "_line", ".", "append", "(", "arg_0", ".", "_line", "[", "-", "1", "]", "+", "1", ")", "else", ":", "arg_0", ".", "_col", ".", "append", "(", "arg_0", ".", "_col", "[", "-", "1", "]", "+", "1", ")", "arg_0", ".", "_line", ".", "append", "(", "arg_0", ".", "_line", "[", "-", "1", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update the internal line and column buffers after a new character\n        is added.\n\n        The column number is set to 0, so the first character on the next line\n        is column number 1.\"\"\"\n        if newline_chars.match(arg_1):\n            arg_0._col.append(0)\n            arg_0._line.append(arg_0._line[-1] + 1)\n        else:\n            arg_0._col.append(arg_0._col[-1] + 1)\n            arg_0._line.append(arg_0._line[-1])", "path": "src/basilisp/lang/reader.py", "identifier": "StreamReader._update_loc", "docstring": "Update the internal line and column buffers after a new character\n        is added.\n\n        The column number is set to 0, so the first character on the next line\n        is column number 1.", "docstring_tokens": ["Update", "the", "internal", "line", "and", "column", "buffers", "after", "a", "new", "character", "is", "added", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252794}
{"url": "https://github.com/twneale/nmmd/blob/ab3b3f1290c85b8d05bbf59b54c7f22da8972b6f/nmmd/base.py#L66-L85", "sha": "ab3b3f1290c85b8d05bbf59b54c7f22da8972b6f", "docstring_summary": "This decorator wraps descriptor methods with a new method that tries\n    to delegate to a function of the same name defined on the owner instance\n    for convenience for dispatcher clients.", "language": "python", "parameters": "(method)", "return_statement": "return delegator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "delegator", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_1", ".", "Func", ":", "arg_4", "=", "getattr", "(", "arg_1", ",", "'inst'", ",", "None", ")", "if", "arg_4", "is", "not", "None", ":", "arg_5", "=", "(", "arg_1", ".", "delegator_prefix", "or", "''", ")", "+", "arg_0", ".", "__name__", "arg_6", "=", "getattr", "(", "arg_4", ",", "arg_5", ",", "None", ")", "if", "arg_6", "is", "not", "None", ":", "return", "arg_6", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "delegator"], "function": "def Func(arg_0):\n    '''This decorator wraps descriptor methods with a new method that tries\n    to delegate to a function of the same name defined on the owner instance\n    for convenience for dispatcher clients.\n    '''\n    @functools.wraps(arg_0)\n    def delegator(arg_1, *arg_2, **arg_3):\n        if arg_1.Func:\n            # Try to dispatch to the instance's implementation.\n            arg_4 = getattr(arg_1, 'inst', None)\n            if arg_4 is not None:\n                arg_5 = (arg_1.delegator_prefix or '') + arg_0.__name__\n                arg_6 = getattr(arg_4, arg_5, None)\n                if arg_6 is not None:\n                    return arg_6(*arg_2, **arg_3)\n\n        # Otherwise run the decorated func.\n        return arg_0(arg_1, *arg_2, **arg_3)\n\n    return delegator", "path": "nmmd/base.py", "identifier": "try_delegation", "docstring": "This decorator wraps descriptor methods with a new method that tries\n    to delegate to a function of the same name defined on the owner instance\n    for convenience for dispatcher clients.", "docstring_tokens": ["This", "decorator", "wraps", "descriptor", "methods", "with", "a", "new", "method", "that", "tries", "to", "delegate", "to", "a", "function", "of", "the", "same", "name", "defined", "on", "the", "owner", "instance", "for", "convenience", "for", "dispatcher", "clients", "."], "nwo": "twneale/nmmd", "score": 0.17782712273869106, "idx": 252795}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/guisupport.py#L85-L92", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Is the wx event loop running.", "language": "python", "parameters": "(app=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "get_app_wx", "(", ")", "if", "hasattr", "(", "arg_0", ",", "'_in_event_loop'", ")", ":", "return", "arg_0", ".", "_in_event_loop", "else", ":", "return", "arg_0", ".", "IsMainLoopRunning", "(", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Is the wx event loop running.\"\"\"\n    if arg_0 is None:\n        arg_0 = get_app_wx()\n    if hasattr(arg_0, '_in_event_loop'):\n        return arg_0._in_event_loop\n    else:\n        return arg_0.IsMainLoopRunning()", "path": "environment/lib/python2.7/site-packages/IPython/lib/guisupport.py", "identifier": "is_event_loop_running_wx", "docstring": "Is the wx event loop running.", "docstring_tokens": ["Is", "the", "wx", "event", "loop", "running", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252796}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/fitters.py#L23-L26", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Function used to fit the exponential decay.", "language": "python", "parameters": "(x, a, tau, c)", "return_statement": "return a * np.exp(-x / tau) + c", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "arg_1", "*", "np", ".", "exp", "(", "-", "arg_0", "/", "arg_2", ")", "+", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Function used to fit the exponential decay.\"\"\"\n    # pylint: disable=invalid-name\n    return arg_1 * np.exp(-arg_0 / arg_2) + arg_3", "path": "qiskit/tools/qcvv/fitters.py", "identifier": "exp_fit_fun", "docstring": "Function used to fit the exponential decay.", "docstring_tokens": ["Function", "used", "to", "fit", "the", "exponential", "decay", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252797}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/cli.py#L57-L97", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Dump data from Invenio legacy.", "language": "python", "parameters": "(thing, query, from_date, file_prefix, chunk_size, limit, thing_flags)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "init_app_context", "(", ")", "arg_3", "=", "arg_3", "if", "arg_3", "else", "'{0}_Func'", ".", "format", "(", "arg_0", ")", "arg_7", "=", "dict", "(", "(", "f", ".", "strip", "(", "'-'", ")", ".", "replace", "(", "'-'", ",", "'_'", ")", ",", "True", ")", "for", "f", "in", "arg_6", ")", "try", ":", "arg_8", "=", "collect_things_entry_points", "(", ")", "[", "arg_0", "]", "except", "KeyError", ":", "click", ".", "Abort", "(", "'{0} is not in the list of available things to migrate: '", "'{1}'", ".", "format", "(", "arg_0", ",", "collect_things_entry_points", "(", ")", ")", ")", "click", ".", "echo", "(", "\"Querying {0}...\"", ".", "format", "(", "arg_0", ")", ")", "arg_9", ",", "arg_10", "=", "arg_8", ".", "get", "(", "arg_1", ",", "arg_2", ",", "arg_5", "=", "arg_5", ",", "**", "arg_7", ")", "arg_11", "=", "0", "click", ".", "echo", "(", "\"Dumping {0}...\"", ".", "format", "(", "arg_0", ")", ")", "with", "click", ".", "progressbar", "(", "length", "=", "arg_9", ")", "as", "bar", ":", "for", "arg_12", ",", "arg_13", "in", "enumerate", "(", "grouper", "(", "arg_10", ",", "arg_4", ")", ")", ":", "with", "open", "(", "'{0}_{1}.json'", ".", "format", "(", "arg_3", ",", "arg_12", ")", ",", "'w'", ")", "as", "fp", ":", "fp", ".", "write", "(", "\"[\\n\"", ")", "for", "arg_14", "in", "arg_13", ":", "try", ":", "json", ".", "Func", "(", "arg_8", ".", "Func", "(", "arg_14", ",", "arg_2", ",", "**", "arg_7", ")", ",", "fp", ",", "default", "=", "set_serializer", ")", "fp", ".", "write", "(", "\",\"", ")", "except", "Exception", "as", "e", ":", "click", ".", "secho", "(", "\"Failed Func {0} {1} ({2})\"", ".", "format", "(", "arg_0", ",", "arg_14", ",", "e", ".", "message", ")", ",", "fg", "=", "'red'", ")", "arg_11", "+=", "1", "bar", ".", "update", "(", "arg_11", ")", "fp", ".", "seek", "(", "fp", ".", "tell", "(", ")", "-", "1", ")", "fp", ".", "write", "(", "\"\\n]\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"Dump data from Invenio legacy.\"\"\"\n    init_app_context()\n\n    arg_3 = arg_3 if arg_3 else '{0}_Func'.format(arg_0)\n\n    arg_7 = dict((f.strip('-').replace('-', '_'), True) for f in arg_6)\n\n    try:\n        arg_8 = collect_things_entry_points()[arg_0]\n    except KeyError:\n        click.Abort(\n            '{0} is not in the list of available things to migrate: '\n            '{1}'.format(arg_0, collect_things_entry_points()))\n\n    click.echo(\"Querying {0}...\".format(arg_0))\n    arg_9, arg_10 = arg_8.get(arg_1, arg_2, arg_5=arg_5, **arg_7)\n\n    arg_11 = 0  # Progress bar counter\n    click.echo(\"Dumping {0}...\".format(arg_0))\n    with click.progressbar(length=arg_9) as bar:\n        for arg_12, arg_13 in enumerate(grouper(arg_10, arg_4)):\n            with open('{0}_{1}.json'.format(arg_3, arg_12), 'w') as fp:\n                fp.write(\"[\\n\")\n                for arg_14 in arg_13:\n                    try:\n                        json.Func(\n                            arg_8.Func(arg_14, arg_2, **arg_7),\n                            fp,\n                            default=set_serializer\n                        )\n                        fp.write(\",\")\n                    except Exception as e:\n                        click.secho(\"Failed Func {0} {1} ({2})\".format(\n                            arg_0, arg_14, e.message), fg='red')\n                    arg_11 += 1\n                    bar.update(arg_11)\n\n                # Strip trailing comma.\n                fp.seek(fp.tell()-1)\n                fp.write(\"\\n]\")", "path": "invenio_migrator/legacy/cli.py", "identifier": "dump", "docstring": "Dump data from Invenio legacy.", "docstring_tokens": ["Dump", "data", "from", "Invenio", "legacy", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 252798}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/drivers/nvp_driver.py#L636-L660", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Configure any additional default transport zone bindings.", "language": "python", "parameters": "(self, context, switch, network_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "CONF", ".", "NVP", ".", "default_tz", "if", "not", "arg_4", ":", "LOG", ".", "warn", "(", "\"additional_default_tz_types specified, \"", "\"but no default_tz. Skipping \"", "\"Func().\"", ")", "return", "if", "not", "arg_3", ":", "LOG", ".", "warn", "(", "\"neutron network_id not specified, skipping \"", "\"Func()\"", ")", "return", "for", "arg_5", "in", "CONF", ".", "NVP", ".", "additional_default_tz_types", ":", "if", "arg_5", "in", "TZ_BINDINGS", ":", "arg_6", "=", "TZ_BINDINGS", "[", "arg_5", "]", "arg_6", ".", "add", "(", "arg_1", ",", "arg_2", ",", "arg_4", ",", "arg_3", ")", "else", ":", "LOG", ".", "warn", "(", "\"Unknown default tz type %s\"", "%", "(", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Configure any additional default transport zone bindings.\"\"\"\n        arg_4 = CONF.NVP.default_tz\n\n        # If there is no default tz specified it's pointless to try\n        # and add any additional default tz bindings.\n        if not arg_4:\n            LOG.warn(\"additional_default_tz_types specified, \"\n                     \"but no default_tz. Skipping \"\n                     \"Func().\")\n            return\n\n        # This should never be called without a neutron network uuid,\n        # we require it to bind some segment allocations.\n        if not arg_3:\n            LOG.warn(\"neutron network_id not specified, skipping \"\n                     \"Func()\")\n            return\n\n        for arg_5 in CONF.NVP.additional_default_tz_types:\n            if arg_5 in TZ_BINDINGS:\n                arg_6 = TZ_BINDINGS[arg_5]\n                arg_6.add(arg_1, arg_2, arg_4, arg_3)\n            else:\n                LOG.warn(\"Unknown default tz type %s\" % (arg_5))", "path": "quark/drivers/nvp_driver.py", "identifier": "NVPDriver._add_default_tz_bindings", "docstring": "Configure any additional default transport zone bindings.", "docstring_tokens": ["Configure", "any", "additional", "default", "transport", "zone", "bindings", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 252799}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1064-L1088", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates a new affinity group for the specified subscription.", "language": "python", "parameters": "(self, name, label, location, description=None)", "return_statement": "return self._perform_post(\n            '/' + self.subscription_id + '/affinitygroups',\n            _XmlSerializer.create_affinity_group_to_xml(name,\n                                                        label,\n                                                        description,\n                                                        location))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "_validate_not_none", "(", "'name'", ",", "arg_1", ")", "_validate_not_none", "(", "'label'", ",", "arg_2", ")", "_validate_not_none", "(", "'location'", ",", "arg_3", ")", "return", "arg_0", ".", "_perform_post", "(", "'/'", "+", "arg_0", ".", "subscription_id", "+", "'/affinitygroups'", ",", "_XmlSerializer", ".", "Func_to_xml", "(", "arg_1", ",", "arg_2", ",", "arg_4", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        '''\n        Creates a new affinity group for the specified subscription.\n\n        name:\n            A name for the affinity group that is unique to the subscription.\n        label:\n            A name for the affinity group. The name can be up to 100 characters\n            in length.\n        location:\n            The data center location where the affinity group will be created.\n            To list available locations, use the list_location function.\n        description:\n            A description for the affinity group. The description can be up to\n            1024 characters in length.\n        '''\n        _validate_not_none('name', arg_1)\n        _validate_not_none('label', arg_2)\n        _validate_not_none('location', arg_3)\n        return arg_0._perform_post(\n            '/' + arg_0.subscription_id + '/affinitygroups',\n            _XmlSerializer.Func_to_xml(arg_1,\n                                                        arg_2,\n                                                        arg_4,\n                                                        arg_3))", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.create_affinity_group", "docstring": "Creates a new affinity group for the specified subscription.\n\n        name:\n            A name for the affinity group that is unique to the subscription.\n        label:\n            A name for the affinity group. The name can be up to 100 characters\n            in length.\n        location:\n            The data center location where the affinity group will be created.\n            To list available locations, use the list_location function.\n        description:\n            A description for the affinity group. The description can be up to\n            1024 characters in length.", "docstring_tokens": ["Creates", "a", "new", "affinity", "group", "for", "the", "specified", "subscription", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252800}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/feature_extraction/text.py#L169-L197", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Create sparse feature matrix, and vocabulary where fixed_vocab=False", "language": "python", "parameters": "(self, analyzed_docs)", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "vocabulary_", "arg_3", "=", "_make_int_array", "(", ")", "arg_4", "=", "_make_int_array", "(", ")", "arg_4", ".", "append", "(", "0", ")", "for", "arg_5", "in", "arg_1", ":", "for", "arg_6", "in", "arg_5", ":", "try", ":", "arg_3", ".", "append", "(", "arg_2", "[", "arg_6", "]", ")", "except", "KeyError", ":", "continue", "arg_4", ".", "append", "(", "len", "(", "arg_3", ")", ")", "arg_3", "=", "frombuffer_empty", "(", "arg_3", ",", "dtype", "=", "np", ".", "intc", ")", "arg_4", "=", "np", ".", "frombuffer", "(", "arg_4", ",", "dtype", "=", "np", ".", "intc", ")", "arg_7", "=", "np", ".", "ones", "(", "len", "(", "arg_3", ")", ")", "arg_8", "=", "sp", ".", "csr_matrix", "(", "(", "arg_7", ",", "arg_3", ",", "arg_4", ")", ",", "shape", "=", "(", "len", "(", "arg_4", ")", "-", "1", ",", "len", "(", "arg_2", ")", ")", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_8", ".", "sum_duplicates", "(", ")", "if", "arg_0", ".", "binary", ":", "arg_8", ".", "data", ".", "fill", "(", "1", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create sparse feature matrix, and vocabulary where fixed_vocab=False\n        \"\"\"\n        arg_2 = arg_0.vocabulary_\n        arg_3 = _make_int_array()\n        arg_4 = _make_int_array()\n        arg_4.append(0)\n        for arg_5 in arg_1:\n            for arg_6 in arg_5:\n                try:\n                    arg_3.append(arg_2[arg_6])\n                except KeyError:\n                    # Ignore out-of-vocabulary items for fixed_vocab=True\n                    continue\n            arg_4.append(len(arg_3))\n\n        arg_3 = frombuffer_empty(arg_3, dtype=np.intc)\n        arg_4 = np.frombuffer(arg_4, dtype=np.intc)\n        arg_7 = np.ones(len(arg_3))\n\n        arg_8 = sp.csr_matrix((arg_7, arg_3, arg_4),\n                          shape=(len(arg_4) - 1, len(arg_2)),\n                          dtype=arg_0.dtype)\n        arg_8.sum_duplicates()\n\n        if arg_0.binary:\n            arg_8.data.fill(1)\n\n        return arg_8", "path": "splearn/feature_extraction/text.py", "identifier": "SparkCountVectorizer._count_vocab", "docstring": "Create sparse feature matrix, and vocabulary where fixed_vocab=False", "docstring_tokens": ["Create", "sparse", "feature", "matrix", "and", "vocabulary", "where", "fixed_vocab", "=", "False"], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 252801}
{"url": "https://github.com/djangobot/djangobot/blob/0ec951891812ea4114c27a08c790f63d0f0fd254/djangobot/slack.py#L77-L83", "sha": "0ec951891812ea4114c27a08c790f63d0f0fd254", "docstring_summary": "List of users of this slack team", "language": "python", "parameters": "(self)", "return_statement": "return self._users", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_Func", ":", "arg_0", ".", "_Func", "=", "arg_0", ".", "_call_api", "(", "'Func.list'", ")", "[", "'members'", "]", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"\n        List of Func of this slack team\n        \"\"\"\n        if not arg_0._Func:\n            arg_0._Func = arg_0._call_api('Func.list')['members']\n        return arg_0._Func", "path": "djangobot/slack.py", "identifier": "SlackAPI.users", "docstring": "List of users of this slack team", "docstring_tokens": ["List", "of", "users", "of", "this", "slack", "team"], "nwo": "djangobot/djangobot", "score": 0.3086509652907828, "idx": 252802}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L746-L759", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Filter all issues that don't have a label.", "language": "python", "parameters": "(self, all_issues)", "return_statement": "return issues_wo_labels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "not", "arg_0", ".", "options", ".", "add_issues_wo_labels", ":", "for", "arg_3", "in", "arg_1", ":", "if", "not", "arg_3", "[", "'labels'", "]", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Filter all issues that don't have a label.\n\n        :rtype: list(dict)\n        :return: Issues without labels.\n        \"\"\"\n\n        arg_2 = []\n        if not arg_0.options.add_issues_wo_labels:\n            for arg_3 in arg_1:\n                if not arg_3['labels']:\n                    arg_2.append(arg_3)\n        return arg_2", "path": "pygcgen/generator.py", "identifier": "Generator.filter_wo_labels", "docstring": "Filter all issues that don't have a label.\n\n        :rtype: list(dict)\n        :return: Issues without labels.", "docstring_tokens": ["Filter", "all", "issues", "that", "don", "t", "have", "a", "label", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 252803}
{"url": "https://github.com/ankitmathur3193/song-cli/blob/ca8ccfe547e9d702313ff6d14e81ae4355989a67/song/commands/FileDownload.py#L27-L74", "sha": "ca8ccfe547e9d702313ff6d14e81ae4355989a67", "docstring_summary": "It will download file specified by url using requests module", "language": "python", "parameters": "(self,url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_2", ")", ")", ":", "print", "'File already exists'", "return", "try", ":", "arg_3", "=", "requests", ".", "get", "(", "arg_1", ",", "stream", "=", "True", ",", "timeout", "=", "200", ")", "except", "requests", ".", "exceptions", ".", "SSLError", ":", "try", ":", "arg_4", "=", "requests", ".", "get", "(", "arg_1", ",", "stream", "=", "True", ",", "verify", "=", "False", ",", "timeout", "=", "200", ")", "except", "requests", ".", "exceptions", ".", "RequestException", "as", "e", ":", "print", "e", "quit", "(", ")", "except", "requests", ".", "exceptions", ".", "RequestException", "as", "e", ":", "print", "e", "quit", "(", ")", "arg_5", "=", "1024", "arg_6", "=", "int", "(", "arg_3", ".", "headers", "[", "'Content-Length'", "]", ")", "arg_7", "=", "arg_6", "/", "arg_5", "arg_8", "=", "arg_3", ".", "iter_content", "(", "arg_5", "=", "arg_5", ")", "arg_9", "=", "tqdm", "(", "iterable", "=", "arg_8", ",", "total", "=", "arg_7", ",", "unit", "=", "'KB'", ",", "leave", "=", "False", ")", "with", "open", "(", "arg_2", ",", "'wb'", ")", "as", "f", ":", "for", "arg_10", "in", "arg_9", ":", "f", ".", "write", "(", "arg_10", ")", "'''print 'Total size of file to be downloaded %.2f MB '%total_size\t\ttotal_downloaded_size=0.0\t\twith open(file_name,'wb') as f:\t\t\tfor chunk in r.iter_content(chunk_size=1*1024*1024):\t\t\t\tif chunk:\t\t\t\t\tsize_of_chunk=float(len(chunk))/(1024*1024)\t\t\t\t\ttotal_downloaded_size+=size_of_chunk\t\t\t\t\tprint '{0:.0%} Downloaded'.format(total_downloaded_size/total_size)\t\t\t\t\tf.write(chunk)'''", "print", "'Downloaded file %s '", "%", "arg_2"], "function": "def Func(arg_0,arg_1):\n\t\t'''It will download file specified by url using requests module'''\n\t\targ_2=arg_1.split('/')[-1]\n\n\t\tif os.path.exists(os.path.join(os.getcwd(),arg_2)):\n\t\t\tprint 'File already exists'\n\t\t\treturn\n\t\t#print 'Downloading file %s '%file_name\n\t\t#print 'Downloading from %s'%url\n\n\t\t\n\n\t\ttry:\n\t\t\targ_3=requests.get(arg_1,stream=True,timeout=200)\n\t\texcept requests.exceptions.SSLError:\n\t\t\ttry:\n\t\t\t\targ_4=requests.get(arg_1,stream=True,verify=False,timeout=200)\n\t\t\texcept requests.exceptions.RequestException as e:\n\t\t\t\tprint e\n\t\t\t\tquit()\t\t\n\t\texcept requests.exceptions.RequestException as e:\n\t\t\t\tprint e\n\t\t\t\tquit()\t\n\t\targ_5 = 1024\n\t\targ_6 = int(arg_3.headers['Content-Length'])\n\t\targ_7 = arg_6/arg_5\n\n\t\targ_8 = arg_3.iter_content(arg_5 = arg_5)\n\t\targ_9 = tqdm(iterable = arg_8,total = arg_7,unit = 'KB',\n\t\t\tleave = False\n\t\t\t)\t\t\n\t\twith open(arg_2,'wb') as f:\n\t\t\tfor arg_10 in arg_9:\n\t\t\t\tf.write(arg_10)\n\n\t\t\t\t\n\t\t#total_size=float(r.headers['Content-Length'])/(1024*1024)\n\t\t'''print 'Total size of file to be downloaded %.2f MB '%total_size\n\t\ttotal_downloaded_size=0.0\n\t\twith open(file_name,'wb') as f:\n\t\t\tfor chunk in r.iter_content(chunk_size=1*1024*1024):\n\t\t\t\tif chunk:\n\t\t\t\t\tsize_of_chunk=float(len(chunk))/(1024*1024)\n\t\t\t\t\ttotal_downloaded_size+=size_of_chunk\n\t\t\t\t\tprint '{0:.0%} Downloaded'.format(total_downloaded_size/total_size)\n\t\t\t\t\tf.write(chunk)'''\n\n\t\tprint 'Downloaded file %s '%arg_2", "path": "song/commands/FileDownload.py", "identifier": "FileDownload.file_download_using_requests", "docstring": "It will download file specified by url using requests module", "docstring_tokens": ["It", "will", "download", "file", "specified", "by", "url", "using", "requests", "module"], "nwo": "ankitmathur3193/song-cli", "score": 0.1872672106339659, "idx": 252804}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L96-L114", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "list builders, or instances for the project. They should start with\n       sregistry-builder", "language": "python", "parameters": "(self, project=None, zone='us-west1-a')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'us-west1-a'", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "arg_0", ".", "_get_instances", "(", "arg_1", ",", "arg_2", ")", "for", "arg_5", "in", "arg_4", "[", "'items'", "]", ":", "arg_3", ".", "append", "(", "[", "arg_5", "[", "'name'", "]", ",", "arg_5", "[", "'status'", "]", "]", ")", "bot", ".", "info", "(", "\"[google-compute] Found %s instances\"", "%", "(", "len", "(", "arg_3", ")", ")", ")", "bot", ".", "table", "(", "arg_3", ")", "bot", ".", "newline", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2='us-west1-a'):\n    '''list builders, or instances for the project. They should start with\n       sregistry-builder\n\n       Parameters\n       ==========\n       project: specify a project, will default to environment first\n       zone: the zone to use, defaults to us-west1-a if environment not set\n\n    '''\n    arg_3 = []\n    arg_4 = arg_0._get_instances(arg_1, arg_2)\n\n    for arg_5 in arg_4['items']:\n        arg_3.append([arg_5['name'], arg_5['status']])\n\n    bot.info(\"[google-compute] Found %s instances\" %(len(arg_3)))\n    bot.table(arg_3)\n    bot.newline()", "path": "sregistry/main/google_storage/build.py", "identifier": "list_builders", "docstring": "list builders, or instances for the project. They should start with\n       sregistry-builder\n\n       Parameters\n       ==========\n       project: specify a project, will default to environment first\n       zone: the zone to use, defaults to us-west1-a if environment not set", "docstring_tokens": ["list", "builders", "or", "instances", "for", "the", "project", ".", "They", "should", "start", "with", "sregistry", "-", "builder"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 252805}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/www/utils.py#L222-L228", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Used by cache to get a unique key per URL", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return (path + args).encode('ascii', 'ignore')", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "request", ".", "path", "arg_0", "=", "str", "(", "hash", "(", "frozenset", "(", "request", ".", "args", ".", "items", "(", ")", ")", ")", ")", "return", "(", "arg_2", "+", "arg_0", ")", ".", "encode", "(", "'ascii'", ",", "'ignore'", ")"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    Used by cache to get a unique key per URL\n    \"\"\"\n    arg_2 = request.path\n    arg_0 = str(hash(frozenset(request.args.items())))\n    return (arg_2 + arg_0).encode('ascii', 'ignore')", "path": "airflow/www/utils.py", "identifier": "make_cache_key", "docstring": "Used by cache to get a unique key per URL", "docstring_tokens": ["Used", "by", "cache", "to", "get", "a", "unique", "key", "per", "URL"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252806}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/tasks.py#L20-L46", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Task to send content metadata to each linked integrated channel.", "language": "python", "parameters": "(username, channel_code, channel_pk)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "time", ".", "time", "(", ")", "arg_4", "=", "User", ".", "objects", ".", "get", "(", "arg_0", "=", "arg_0", ")", "arg_5", "=", "INTEGRATED_CHANNEL_CHOICES", "[", "arg_1", "]", ".", "objects", ".", "get", "(", "pk", "=", "arg_2", ")", "LOGGER", ".", "info", "(", "'Transmitting content metadata to integrated channel using configuration: [%s]'", ",", "arg_5", ")", "try", ":", "arg_5", ".", "Func", "(", "arg_4", ")", "except", "Exception", ":", "LOGGER", ".", "exception", "(", "'Transmission of content metadata failed for user [%s] and for integrated '", "'channel with code [%s] and id [%s].'", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "time", ".", "time", "(", ")", "-", "arg_3", "LOGGER", ".", "info", "(", "'Content metadata transmission task for integrated channel configuration [%s] took [%s] seconds'", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Task to send content metadata to each linked integrated channel.\n\n    Arguments:\n        username (str): The username of the User to be used for making API requests to retrieve content metadata.\n        channel_code (str): Capitalized identifier for the integrated channel.\n        channel_pk (str): Primary key for identifying integrated channel.\n\n    \"\"\"\n    arg_3 = time.time()\n    arg_4 = User.objects.get(arg_0=arg_0)\n    arg_5 = INTEGRATED_CHANNEL_CHOICES[arg_1].objects.get(pk=arg_2)\n    LOGGER.info('Transmitting content metadata to integrated channel using configuration: [%s]', arg_5)\n    try:\n        arg_5.Func(arg_4)\n    except Exception:  # pylint: disable=broad-except\n        LOGGER.exception(\n            'Transmission of content metadata failed for user [%s] and for integrated '\n            'channel with code [%s] and id [%s].', arg_0, arg_1, arg_2\n        )\n    arg_6 = time.time() - arg_3\n    LOGGER.info(\n        'Content metadata transmission task for integrated channel configuration [%s] took [%s] seconds',\n        arg_5,\n        arg_6\n    )", "path": "integrated_channels/integrated_channel/tasks.py", "identifier": "transmit_content_metadata", "docstring": "Task to send content metadata to each linked integrated channel.\n\n    Arguments:\n        username (str): The username of the User to be used for making API requests to retrieve content metadata.\n        channel_code (str): Capitalized identifier for the integrated channel.\n        channel_pk (str): Primary key for identifying integrated channel.", "docstring_tokens": ["Task", "to", "send", "content", "metadata", "to", "each", "linked", "integrated", "channel", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252807}
{"url": "https://github.com/lc-guy/limf/blob/ad380feb70ef8e579a91ca09c807efec9e8af565/limf/parse_arguments.py#L11-L18", "sha": "ad380feb70ef8e579a91ca09c807efec9e8af565", "docstring_summary": "Checks file sizes for host", "language": "python", "parameters": "(chosen_file, max_size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "os", ".", "path", ".", "getsize", "(", "arg_0", ")", ">", "arg_1", ":", "return", "False", "else", ":", "return", "True"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Checks file sizes for host\n    \"\"\"\n    if os.path.getsize(arg_0) > arg_1:\n        return False\n    else:\n        return True", "path": "limf/parse_arguments.py", "identifier": "check_max_filesize", "docstring": "Checks file sizes for host", "docstring_tokens": ["Checks", "file", "sizes", "for", "host"], "nwo": "lc-guy/limf", "score": 0.28168436607245656, "idx": 252808}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/dim_reduction.py#L95-L124", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Produce the scree plot.", "language": "python", "parameters": "(self, type=\"barplot\", **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"barplot\"", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "pop", "(", "\"server\"", ")", "if", "arg_2", ":", "raise", "ValueError", "(", "\"Unknown arguments %s to Func()\"", "%", "\", \"", ".", "join", "(", "arg_2", ".", "keys", "(", ")", ")", ")", "try", ":", "import", "matplotlib", "if", "arg_3", ":", "matplotlib", ".", "use", "(", "'Agg'", ",", "warn", "=", "False", ")", "import", "matplotlib", ".", "pyplot", "as", "plt", "except", "ImportError", ":", "print", "(", "\"matplotlib is required for this function!\"", ")", "return", "arg_4", "=", "[", "s", "**", "2", "for", "s", "in", "arg_0", ".", "_model_json", "[", "'output'", "]", "[", "'importance'", "]", ".", "cell_values", "[", "0", "]", "[", "1", ":", "]", "]", "plt", ".", "xlabel", "(", "'Components'", ")", "plt", ".", "ylabel", "(", "'Variances'", ")", "plt", ".", "title", "(", "'Scree Plot'", ")", "plt", ".", "xticks", "(", "list", "(", "range", "(", "1", ",", "len", "(", "arg_4", ")", "+", "1", ")", ")", ")", "if", "arg_1", "==", "\"barplot\"", ":", "plt", ".", "bar", "(", "list", "(", "range", "(", "1", ",", "len", "(", "arg_4", ")", "+", "1", ")", ")", ",", "arg_4", ")", "elif", "arg_1", "==", "\"lines\"", ":", "plt", ".", "plot", "(", "list", "(", "range", "(", "1", ",", "len", "(", "arg_4", ")", "+", "1", ")", ")", ",", "arg_4", ",", "'b--'", ")", "if", "not", "arg_3", ":", "plt", ".", "show", "(", ")"], "function": "def Func(arg_0, arg_1=\"barplot\", **arg_2):\n        \"\"\"\n        Produce the scree plot.\n\n        Library ``matplotlib`` is required for this function.\n\n        :param str type: either ``\"barplot\"`` or ``\"lines\"``.\n        \"\"\"\n        # check for matplotlib. exit if absent.\n        arg_3 = arg_2.pop(\"server\")\n        if arg_2:\n            raise ValueError(\"Unknown arguments %s to Func()\" % \", \".join(arg_2.keys()))\n        try:\n            import matplotlib\n            if arg_3: matplotlib.use('Agg', warn=False)\n            import matplotlib.pyplot as plt\n        except ImportError:\n            print(\"matplotlib is required for this function!\")\n            return\n\n        arg_4 = [s ** 2 for s in arg_0._model_json['output']['importance'].cell_values[0][1:]]\n        plt.xlabel('Components')\n        plt.ylabel('Variances')\n        plt.title('Scree Plot')\n        plt.xticks(list(range(1, len(arg_4) + 1)))\n        if arg_1 == \"barplot\":\n            plt.bar(list(range(1, len(arg_4) + 1)), arg_4)\n        elif arg_1 == \"lines\":\n            plt.plot(list(range(1, len(arg_4) + 1)), arg_4, 'b--')\n        if not arg_3: plt.show()", "path": "h2o-py/h2o/model/dim_reduction.py", "identifier": "H2ODimReductionModel.screeplot", "docstring": "Produce the scree plot.\n\n        Library ``matplotlib`` is required for this function.\n\n        :param str type: either ``\"barplot\"`` or ``\"lines\"``.", "docstring_tokens": ["Produce", "the", "scree", "plot", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252809}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L636-L661", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read metadata and apply that to the next object in the\n    input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "IMeta", ":", "arg_2", "=", "arg_0", ".", "reader", ".", "advance", "(", ")", "assert", "arg_2", "==", "\"^\"", "arg_3", "=", "_read_next_consuming_comment", "(", "arg_0", ")", "arg_4", ":", "Optional", "[", "lmap", ".", "Map", "[", "LispForm", ",", "LispForm", "]", "]", "=", "None", "if", "isinstance", "(", "arg_3", ",", "symbol", ".", "Symbol", ")", ":", "arg_4", "=", "lmap", ".", "map", "(", "{", "keyword", ".", "keyword", "(", "\"tag\"", ")", ":", "arg_3", "}", ")", "elif", "isinstance", "(", "arg_3", ",", "keyword", ".", "Keyword", ")", ":", "arg_4", "=", "lmap", ".", "map", "(", "{", "arg_3", ":", "True", "}", ")", "elif", "isinstance", "(", "arg_3", ",", "lmap", ".", "Map", ")", ":", "arg_4", "=", "arg_3", "else", ":", "raise", "SyntaxError", "(", "f\"Expected symbol, keyword, or map for metadata, not {type(meta)}\"", ")", "arg_5", "=", "_read_next_consuming_comment", "(", "arg_0", ")", "try", ":", "return", "arg_5", ".", "with_meta", "(", "arg_4", ")", "except", "AttributeError", ":", "raise", "SyntaxError", "(", "f\"Can not attach metadata to object of type {type(obj_with_meta)}\"", ")"], "function": "def Func(arg_0: arg_1) -> IMeta:\n    \"\"\"Read metadata and apply that to the next object in the\n    input stream.\"\"\"\n    arg_2 = arg_0.reader.advance()\n    assert arg_2 == \"^\"\n    arg_3 = _read_next_consuming_comment(arg_0)\n\n    arg_4: Optional[lmap.Map[LispForm, LispForm]] = None\n    if isinstance(arg_3, symbol.Symbol):\n        arg_4 = lmap.map({keyword.keyword(\"tag\"): arg_3})\n    elif isinstance(arg_3, keyword.Keyword):\n        arg_4 = lmap.map({arg_3: True})\n    elif isinstance(arg_3, lmap.Map):\n        arg_4 = arg_3\n    else:\n        raise SyntaxError(\n            f\"Expected symbol, keyword, or map for metadata, not {type(meta)}\"\n        )\n\n    arg_5 = _read_next_consuming_comment(arg_0)\n    try:\n        return arg_5.with_meta(arg_4)  # type: ignore\n    except AttributeError:\n        raise SyntaxError(\n            f\"Can not attach metadata to object of type {type(obj_with_meta)}\"\n        )", "path": "src/basilisp/lang/reader.py", "identifier": "_read_meta", "docstring": "Read metadata and apply that to the next object in the\n    input stream.", "docstring_tokens": ["Read", "metadata", "and", "apply", "that", "to", "the", "next", "object", "in", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252810}
{"url": "https://github.com/jupyter-widgets/jupyterlab-sidecar/blob/8889d09f1a0933e2cbee06d4874f720b075b29e8/setupbase.py#L583-L601", "sha": "8889d09f1a0933e2cbee06d4874f720b075b29e8", "docstring_summary": "Expand file patterns to a list of `package_data` paths.", "language": "python", "parameters": "(root, file_patterns=None)", "return_statement": "return _get_files(file_patterns, pjoin(HERE, root))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "'*'", "]", "return", "_get_files", "(", "arg_1", ",", "pjoin", "(", "HERE", ",", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Expand file patterns to a list of `package_data` paths.\n\n    Parameters\n    -----------\n    root: str\n        The relative path to the package root from `HERE`.\n    file_patterns: list or str, optional\n        A list of glob patterns for the data file locations.\n        The globs can be recursive if they include a `**`.\n        They should be relative paths from the root or\n        absolute paths.  If not given, all files will be used.\n\n    Note:\n    Files in `node_modules` are ignored.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = ['*']\n    return _get_files(arg_1, pjoin(HERE, arg_0))", "path": "setupbase.py", "identifier": "_get_package_data", "docstring": "Expand file patterns to a list of `package_data` paths.\n\n    Parameters\n    -----------\n    root: str\n        The relative path to the package root from `HERE`.\n    file_patterns: list or str, optional\n        A list of glob patterns for the data file locations.\n        The globs can be recursive if they include a `**`.\n        They should be relative paths from the root or\n        absolute paths.  If not given, all files will be used.\n\n    Note:\n    Files in `node_modules` are ignored.", "docstring_tokens": ["Expand", "file", "patterns", "to", "a", "list", "of", "package_data", "paths", "."], "nwo": "jupyter-widgets/jupyterlab-sidecar", "score": 0.6376222650402201, "idx": 252811}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1778-L1793", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Receive data on the connection.", "language": "python", "parameters": "(self, bufsiz, flags=None)", "return_statement": "return _ffi.buffer(buf, result)[:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "_no_zero_allocator", "(", "\"char[]\"", ",", "arg_1", ")", "if", "arg_2", "is", "not", "None", "and", "arg_2", "&", "socket", ".", "MSG_PEEK", ":", "arg_4", "=", "_lib", ".", "SSL_peek", "(", "arg_0", ".", "_ssl", ",", "arg_3", ",", "arg_1", ")", "else", ":", "arg_4", "=", "_lib", ".", "SSL_read", "(", "arg_0", ".", "_ssl", ",", "arg_3", ",", "arg_1", ")", "arg_0", ".", "_raise_ssl_error", "(", "arg_0", ".", "_ssl", ",", "arg_4", ")", "return", "_ffi", ".", "buffer", "(", "arg_3", ",", "arg_4", ")", "[", ":", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Receive data on the connection.\n\n        :param bufsiz: The maximum number of bytes to read\n        :param flags: (optional) The only supported flag is ``MSG_PEEK``,\n            all other flags are ignored.\n        :return: The string read from the Connection\n        \"\"\"\n        arg_3 = _no_zero_allocator(\"char[]\", arg_1)\n        if arg_2 is not None and arg_2 & socket.MSG_PEEK:\n            arg_4 = _lib.SSL_peek(arg_0._ssl, arg_3, arg_1)\n        else:\n            arg_4 = _lib.SSL_read(arg_0._ssl, arg_3, arg_1)\n        arg_0._raise_ssl_error(arg_0._ssl, arg_4)\n        return _ffi.buffer(arg_3, arg_4)[:]", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.recv", "docstring": "Receive data on the connection.\n\n        :param bufsiz: The maximum number of bytes to read\n        :param flags: (optional) The only supported flag is ``MSG_PEEK``,\n            all other flags are ignored.\n        :return: The string read from the Connection", "docstring_tokens": ["Receive", "data", "on", "the", "connection", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 252812}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L514-L526", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Get weights for this layer", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "callBigDlFunc", "(", "arg_0", ".", "bigdl_type", ",", "\"getWeights\"", ",", "arg_0", ".", "value", ")", "if", "arg_1", "is", "not", "None", ":", "return", "[", "arg_2", ".", "to_ndarray", "(", ")", "for", "arg_2", "in", "arg_1", "]", "else", ":", "print", "(", "\"The layer does not have weight/bias\"", ")", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Get weights for this layer\n\n        :return: list of numpy arrays which represent weight and bias\n        \"\"\"\n        arg_1 = callBigDlFunc(arg_0.bigdl_type,\n                              \"getWeights\", arg_0.value)\n        if arg_1 is not None:\n            return [arg_2.to_ndarray() for arg_2 in arg_1]\n        else:\n            print(\"The layer does not have weight/bias\")\n            return None", "path": "pyspark/bigdl/nn/layer.py", "identifier": "Layer.get_weights", "docstring": "Get weights for this layer\n\n        :return: list of numpy arrays which represent weight and bias", "docstring_tokens": ["Get", "weights", "for", "this", "layer"], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 252813}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/celery.py#L94-L101", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Forcibly terminates all Celery processes.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "with", "arg_0", ".", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_1", ".", "sudo", "(", "'pkill -9 -f celery'", ")", "arg_1", ".", "sudo", "(", "'rm -f /tmp/celery*.pid'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Forcibly terminates all Celery processes.\n        \"\"\"\n        arg_1 = arg_0.local_renderer\n        with arg_0.settings(warn_only=True):\n            arg_1.sudo('pkill -9 -f celery')\n        arg_1.sudo('rm -f /tmp/celery*.pid')", "path": "burlap/celery.py", "identifier": "CelerySatchel.force_stop", "docstring": "Forcibly terminates all Celery processes.", "docstring_tokens": ["Forcibly", "terminates", "all", "Celery", "processes", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 252814}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/multiprocess_file_storage.py#L100-L112", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Creates the an empty file if it does not already exist.", "language": "python", "parameters": "(filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "return", "False", "else", ":", "open", "(", "arg_0", ",", "'a+b'", ")", ".", "close", "(", ")", "logger", ".", "info", "(", "'Credential file {0} created'", ".", "format", "(", "arg_0", ")", ")", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"Creates the an empty file if it does not already exist.\n\n    Returns:\n        True if the file was created, False otherwise.\n    \"\"\"\n    if os.path.exists(arg_0):\n        return False\n    else:\n        # Equivalent to \"touch\".\n        open(arg_0, 'a+b').close()\n        logger.info('Credential file {0} created'.format(arg_0))\n        return True", "path": "oauth2client/contrib/multiprocess_file_storage.py", "identifier": "_create_file_if_needed", "docstring": "Creates the an empty file if it does not already exist.\n\n    Returns:\n        True if the file was created, False otherwise.", "docstring_tokens": ["Creates", "the", "an", "empty", "file", "if", "it", "does", "not", "already", "exist", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 252815}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/floating_ips.py#L526-L553", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Allocate or reallocate a scaling IP.", "language": "python", "parameters": "(context, content)", "return_statement": "return v._make_scaling_ip_dict(scip)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "'Func for tenant %s and body %s'", ",", "arg_0", ".", "tenant_id", ",", "arg_1", ")", "arg_2", "=", "arg_1", ".", "get", "(", "'scaling_network_id'", ")", "arg_3", "=", "arg_1", ".", "get", "(", "'scaling_ip_address'", ")", "arg_4", "=", "arg_1", ".", "get", "(", "'ports'", ",", "[", "]", ")", "arg_5", "=", "_get_network", "(", "arg_0", ",", "arg_2", ")", "arg_6", "=", "{", "}", "for", "arg_7", "in", "arg_4", ":", "arg_8", "=", "_get_port", "(", "arg_0", ",", "arg_7", "[", "'port_id'", "]", ")", "arg_9", "=", "_get_fixed_ip", "(", "arg_0", ",", "arg_7", ".", "get", "(", "'fixed_ip_address'", ")", ",", "arg_8", ")", "arg_6", "[", "arg_8", ".", "id", "]", "=", "{", "\"port\"", ":", "arg_8", ",", "\"fixed_ip\"", ":", "arg_9", "}", "arg_11", "=", "_allocate_ip", "(", "arg_0", ",", "arg_5", ",", "None", ",", "arg_3", ",", "ip_types", ".", "SCALING", ")", "_create_flip", "(", "arg_0", ",", "arg_11", ",", "arg_6", ")", "return", "v", ".", "_make_scaling_ip_dict", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Allocate or reallocate a scaling IP.\n\n    :param context: neutron api request context.\n    :param content: dictionary describing the scaling ip, with keys\n        as listed in the RESOURCE_ATTRIBUTE_MAP object in\n        neutron/api/v2/attributes.py.  All keys will be populated.\n\n    :returns: Dictionary containing details for the new scaling IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.\n    \"\"\"\n    LOG.info('Func for tenant %s and body %s',\n             arg_0.tenant_id, arg_1)\n    arg_2 = arg_1.get('scaling_network_id')\n    arg_3 = arg_1.get('scaling_ip_address')\n    arg_4 = arg_1.get('ports', [])\n\n    arg_5 = _get_network(arg_0, arg_2)\n    arg_6 = {}\n    for arg_7 in arg_4:\n        arg_8 = _get_port(arg_0, arg_7['port_id'])\n        arg_9 = _get_fixed_ip(arg_0, arg_7.get('fixed_ip_address'),\n                                 arg_8)\n        arg_6[arg_8.id] = {\"port\": arg_8, \"fixed_ip\": arg_9}\n    arg_11 = _allocate_ip(arg_0, arg_5, None, arg_3, ip_types.SCALING)\n    _create_flip(arg_0, arg_11, arg_6)\n    return v._make_scaling_ip_dict(arg_11)", "path": "quark/plugin_modules/floating_ips.py", "identifier": "create_scalingip", "docstring": "Allocate or reallocate a scaling IP.\n\n    :param context: neutron api request context.\n    :param content: dictionary describing the scaling ip, with keys\n        as listed in the RESOURCE_ATTRIBUTE_MAP object in\n        neutron/api/v2/attributes.py.  All keys will be populated.\n\n    :returns: Dictionary containing details for the new scaling IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.", "docstring_tokens": ["Allocate", "or", "reallocate", "a", "scaling", "IP", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 252816}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L672-L700", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Rebuilds the graph around the given node id.", "language": "python", "parameters": "(self, id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "clear", "(", ")", "arg_0", ".", "add_node", "(", "arg_1", ",", "root", "=", "True", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "get_links", "(", "arg_1", ")", ":", "arg_0", ".", "add_edge", "(", "arg_1", ",", "arg_3", ",", "weight", "=", "arg_2", ")", "if", "len", "(", "arg_0", ")", ">", "arg_0", ".", "max", ":", "break", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "arg_0", ".", "get_cluster", "(", "arg_1", ")", ":", "for", "arg_5", "in", "arg_4", ":", "arg_0", ".", "add_edge", "(", "arg_5", ",", "arg_3", ",", "weight", "=", "arg_2", ")", "arg_0", ".", "add_edge", "(", "arg_1", ",", "arg_5", ",", "weight", "=", "arg_2", ")", "if", "len", "(", "arg_0", ")", ">", "arg_0", ".", "max", ":", "break", "if", "arg_0", ".", "event", ".", "clicked", ":", "g", ".", "add_node", "(", "arg_0", ".", "event", ".", "clicked", ")"], "function": "def Func(arg_0, arg_1):\n        \n        \"\"\" Rebuilds the graph around the given node id.\n        \"\"\"\n        \n        arg_0.clear()\n    \n        # Root node.\n        arg_0.add_node(arg_1, root=True)\n    \n        # Directly connected nodes have priority.\n        for arg_2, arg_3 in arg_0.get_links(arg_1):\n            arg_0.add_edge(arg_1, arg_3, weight=arg_2)\n            if len(arg_0) > arg_0.max: \n                break\n\n        # Now get all the other nodes in the cluster.\n        for arg_2, arg_3, arg_4 in arg_0.get_cluster(arg_1):\n            for arg_5 in arg_4:\n                arg_0.add_edge(arg_5, arg_3, weight=arg_2)\n                arg_0.add_edge(arg_1, arg_5, weight=arg_2)\n            #if len(links) == 0:\n            #    self.add_edge(id, id2)\n            if len(arg_0) > arg_0.max: \n                break    \n\n        # Provide a backlink to the previous root.\n        if arg_0.event.clicked: \n            g.add_node(arg_0.event.clicked)", "path": "lib/graph/__init__.py", "identifier": "xgraph.load", "docstring": "Rebuilds the graph around the given node id.", "docstring_tokens": ["Rebuilds", "the", "graph", "around", "the", "given", "node", "id", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252817}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py#L75-L129", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Get the summary of exceptions for component_name and list of instances.\n    Empty instance list will fetch all exceptions.", "language": "python", "parameters": "(self, tmaster, component_name, instances=[], callback=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "[", "]", ",", "arg_4", "=", "None", ")", ":", "if", "not", "arg_1", "or", "not", "arg_1", ".", "host", "or", "not", "arg_1", ".", "stats_port", ":", "return", "arg_5", "=", "tmaster_pb2", ".", "ExceptionLogRequest", "(", ")", "arg_5", ".", "component_name", "=", "arg_2", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_5", ".", "instances", ".", "extend", "(", "arg_3", ")", "arg_6", "=", "arg_5", ".", "SerializeToString", "(", ")", "arg_7", "=", "str", "(", "arg_1", ".", "stats_port", ")", "arg_8", "=", "arg_1", ".", "host", "arg_9", "=", "\"http://{0}:{1}/exceptionsummary\"", ".", "format", "(", "arg_8", ",", "arg_7", ")", "Log", ".", "debug", "(", "\"Creating request object.\"", ")", "arg_10", "=", "tornado", ".", "httpclient", ".", "HTTPRequest", "(", "arg_9", ",", "body", "=", "arg_6", ",", "method", "=", "'POST'", ",", "request_timeout", "=", "5", ")", "Log", ".", "debug", "(", "'Making HTTP call to fetch exceptionsummary url: %s'", ",", "arg_9", ")", "try", ":", "arg_11", "=", "tornado", ".", "httpclient", ".", "AsyncHTTPClient", "(", ")", "arg_12", "=", "yield", "arg_11", ".", "fetch", "(", "arg_10", ")", "Log", ".", "debug", "(", "\"HTTP call complete.\"", ")", "except", "tornado", ".", "httpclient", ".", "HTTPError", "as", "e", ":", "raise", "Exception", "(", "str", "(", "e", ")", ")", "arg_13", "=", "arg_12", ".", "code", "if", "arg_13", ">=", "400", ":", "arg_14", "=", "\"Error in getting exceptions from Tmaster, code: \"", "+", "arg_13", "Log", ".", "error", "(", "arg_14", ")", "raise", "tornado", ".", "gen", ".", "Return", "(", "{", "\"message\"", ":", "arg_14", "}", ")", "arg_15", "=", "tmaster_pb2", ".", "ExceptionLogResponse", "(", ")", "arg_15", ".", "ParseFromString", "(", "arg_12", ".", "body", ")", "if", "arg_15", ".", "status", ".", "status", "==", "common_pb2", ".", "NOTOK", ":", "if", "arg_15", ".", "status", ".", "HasField", "(", "\"message\"", ")", ":", "raise", "tornado", ".", "gen", ".", "Return", "(", "{", "\"message\"", ":", "arg_15", ".", "status", ".", "message", "}", ")", "arg_16", "=", "[", "]", "for", "arg_17", "in", "arg_15", ".", "exceptions", ":", "arg_16", ".", "append", "(", "{", "'class_name'", ":", "arg_17", ".", "stacktrace", ",", "'lasttime'", ":", "arg_17", ".", "lasttime", ",", "'firsttime'", ":", "arg_17", ".", "firsttime", ",", "'count'", ":", "str", "(", "arg_17", ".", "count", ")", "}", ")", "raise", "tornado", ".", "gen", ".", "Return", "(", "arg_16", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=[], arg_4=None):\n    \"\"\"\n    Get the summary of exceptions for component_name and list of instances.\n    Empty instance list will fetch all exceptions.\n    \"\"\"\n    if not arg_1 or not arg_1.host or not arg_1.stats_port:\n      return\n    arg_5 = tmaster_pb2.ExceptionLogRequest()\n    arg_5.component_name = arg_2\n    if len(arg_3) > 0:\n      arg_5.instances.extend(arg_3)\n    arg_6 = arg_5.SerializeToString()\n    arg_7 = str(arg_1.stats_port)\n    arg_8 = arg_1.host\n    arg_9 = \"http://{0}:{1}/exceptionsummary\".format(arg_8, arg_7)\n    Log.debug(\"Creating request object.\")\n    arg_10 = tornado.httpclient.HTTPRequest(arg_9,\n                                             body=arg_6,\n                                             method='POST',\n                                             request_timeout=5)\n    Log.debug('Making HTTP call to fetch exceptionsummary url: %s', arg_9)\n    try:\n      arg_11 = tornado.httpclient.AsyncHTTPClient()\n      arg_12 = yield arg_11.fetch(arg_10)\n      Log.debug(\"HTTP call complete.\")\n    except tornado.httpclient.HTTPError as e:\n      raise Exception(str(e))\n\n    # Check the response code - error if it is in 400s or 500s\n    arg_13 = arg_12.code\n    if arg_13 >= 400:\n      arg_14 = \"Error in getting exceptions from Tmaster, code: \" + arg_13\n      Log.error(arg_14)\n      raise tornado.gen.Return({\n          \"message\": arg_14\n      })\n\n    # Parse the response from tmaster.\n    arg_15 = tmaster_pb2.ExceptionLogResponse()\n    arg_15.ParseFromString(arg_12.body)\n\n    if arg_15.status.status == common_pb2.NOTOK:\n      if arg_15.status.HasField(\"message\"):\n        raise tornado.gen.Return({\n            \"message\": arg_15.status.message\n        })\n\n    # Send response\n    arg_16 = []\n    for arg_17 in arg_15.exceptions:\n      arg_16.append({'class_name': arg_17.stacktrace,\n                  'lasttime': arg_17.lasttime,\n                  'firsttime': arg_17.firsttime,\n                  'count': str(arg_17.count)})\n    raise tornado.gen.Return(arg_16)", "path": "heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py", "identifier": "ExceptionSummaryHandler.getComponentExceptionSummary", "docstring": "Get the summary of exceptions for component_name and list of instances.\n    Empty instance list will fetch all exceptions.", "docstring_tokens": ["Get", "the", "summary", "of", "exceptions", "for", "component_name", "and", "list", "of", "instances", ".", "Empty", "instance", "list", "will", "fetch", "all", "exceptions", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252818}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/email_.py#L238-L242", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Get an SMTP session with SSL.", "language": "python", "parameters": "(self)", "return_statement": "return smtplib.SMTP_SSL(\n            self.server, self.port, context=ssl.create_default_context()\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "smtplib", ".", "SMTP_SSL", "(", "arg_0", ".", "server", ",", "arg_0", ".", "port", ",", "context", "=", "ssl", ".", "create_default_context", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Get an SMTP session with SSL.\"\"\"\n        return smtplib.SMTP_SSL(\n            arg_0.server, arg_0.port, context=ssl.create_default_context()\n        )", "path": "messages/email_.py", "identifier": "Email._get_ssl", "docstring": "Get an SMTP session with SSL.", "docstring_tokens": ["Get", "an", "SMTP", "session", "with", "SSL", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 252819}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L180-L189", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Get a named attribute from an object.", "language": "python", "parameters": "(attr, default=None)", "return_statement": "return transform(getter)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "def", "getter", "(", "arg_2", ")", ":", "return", "_Func", "(", "arg_2", ",", "arg_0", ",", "arg_1", ")", "return", "transform", "(", "getter", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Get a named attribute from an object.\n\n    When a default argument is given, it is returned when the attribute\n    doesn't exist.\n    \"\"\"\n    def getter(arg_2):\n        return _Func(arg_2, arg_0, arg_1)\n\n    return transform(getter)", "path": "src/streamlink/plugin/api/validate.py", "identifier": "getattr", "docstring": "Get a named attribute from an object.\n\n    When a default argument is given, it is returned when the attribute\n    doesn't exist.", "docstring_tokens": ["Get", "a", "named", "attribute", "from", "an", "object", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 252820}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/utils.py#L28-L51", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Reraises `exception`, appending `message` to its string representation.", "language": "python", "parameters": "(exception, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "class", "arg_5", "(", "type", "(", "arg_0", ")", ")", ":", "arg_2", "=", "type", "(", "arg_0", ")", ".", "__module__", "def", "__init__", "(", "arg_3", ")", ":", "pass", "def", "__getattr__", "(", "arg_3", ",", "arg_4", ")", ":", "return", "getattr", "(", "arg_0", ",", "arg_4", ")", "def", "__str__", "(", "arg_3", ")", ":", "return", "str", "(", "arg_0", ")", "+", "arg_1", "arg_5", ".", "__name__", "=", "type", "(", "arg_0", ")", ".", "__name__", "arg_7", "=", "arg_5", "(", ")", "if", "six", ".", "PY3", ":", "arg_5", ".", "__qualname__", "=", "type", "(", "arg_0", ")", ".", "__qualname__", "six", ".", "raise_from", "(", "arg_7", ".", "with_traceback", "(", "arg_0", ".", "__traceback__", ")", ",", "None", ")", "else", ":", "six", ".", "reraise", "(", "arg_7", ",", "None", ",", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Reraises `exception`, appending `message` to its string representation.\"\"\"\n\n  class arg_5(type(arg_0)):\n    \"\"\"Acts as a proxy for an exception with an augmented message.\"\"\"\n    arg_2 = type(arg_0).__module__\n\n    def __init__(arg_3):\n      pass\n\n    def __getattr__(arg_3, arg_4):\n      return getattr(arg_0, arg_4)\n\n    def __str__(arg_3):\n      return str(arg_0) + arg_1\n\n  arg_5.__name__ = type(arg_0).__name__\n\n  arg_7 = arg_5()\n  if six.PY3:\n    arg_5.__qualname__ = type(arg_0).__qualname__\n    six.raise_from(arg_7.with_traceback(arg_0.__traceback__), None)\n  else:\n    six.reraise(arg_7, None, sys.exc_info()[2])", "path": "gin/utils.py", "identifier": "augment_exception_message_and_reraise", "docstring": "Reraises `exception`, appending `message` to its string representation.", "docstring_tokens": ["Reraises", "exception", "appending", "message", "to", "its", "string", "representation", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 252821}
{"url": "https://github.com/ethereum/py_ecc/blob/2088796c59574b256dc8e18f8c9351bc3688ca71/py_ecc/bls/utils.py#L118-L140", "sha": "2088796c59574b256dc8e18f8c9351bc3688ca71", "docstring_summary": "Recovers x and y coordinates from the compressed point.", "language": "python", "parameters": "(z: G1Compressed)", "return_statement": "return (FQ(x), FQ(y), FQ(1))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "G1Uncompressed", ":", "arg_2", "=", "(", "arg_0", "%", "POW_2_383", ")", "//", "POW_2_382", "if", "arg_2", "==", "1", ":", "return", "Z1", "arg_3", "=", "arg_0", "%", "POW_2_381", "arg_4", "=", "pow", "(", "(", "arg_3", "**", "3", "+", "b", ".", "n", ")", "%", "q", ",", "(", "q", "+", "1", ")", "//", "4", ",", "q", ")", "if", "pow", "(", "arg_4", ",", "2", ",", "q", ")", "!=", "(", "arg_3", "**", "3", "+", "b", ".", "n", ")", "%", "q", ":", "raise", "ValueError", "(", "\"The given point is not on G1: y**2 = x**3 + b\"", ")", "arg_5", "=", "(", "arg_0", "%", "POW_2_382", ")", "//", "POW_2_381", "if", "(", "arg_4", "*", "2", ")", "//", "q", "!=", "arg_5", ":", "arg_4", "=", "q", "-", "arg_4", "return", "(", "FQ", "(", "arg_3", ")", ",", "FQ", "(", "arg_4", ")", ",", "FQ", "(", "1", ")", ")"], "function": "def Func(arg_0: arg_1) -> G1Uncompressed:\n    \"\"\"\n    Recovers x and y coordinates from the compressed point.\n    \"\"\"\n    # b_flag == 1 indicates the infinity point\n    arg_2 = (arg_0 % POW_2_383) // POW_2_382\n    if arg_2 == 1:\n        return Z1\n    arg_3 = arg_0 % POW_2_381\n\n    # Try solving y coordinate from the equation Y^2 = X^3 + b\n    # using quadratic residue\n    arg_4 = pow((arg_3**3 + b.n) % q, (q + 1) // 4, q)\n\n    if pow(arg_4, 2, q) != (arg_3**3 + b.n) % q:\n        raise ValueError(\n            \"The given point is not on G1: y**2 = x**3 + b\"\n        )\n    # Choose the y whose leftmost bit is equal to the a_flag\n    arg_5 = (arg_0 % POW_2_382) // POW_2_381\n    if (arg_4 * 2) // q != arg_5:\n        arg_4 = q - arg_4\n    return (FQ(arg_3), FQ(arg_4), FQ(1))", "path": "py_ecc/bls/utils.py", "identifier": "decompress_G1", "docstring": "Recovers x and y coordinates from the compressed point.", "docstring_tokens": ["Recovers", "x", "and", "y", "coordinates", "from", "the", "compressed", "point", "."], "nwo": "ethereum/py_ecc", "score": 0.7087717618172144, "idx": 252822}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L311-L325", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "load the configuration information from the target hierarchy", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_0", ".", "additional_config", ",", "arg_0", ".", "app_config", "]", "+", "[", "t", ".", "getConfig", "(", ")", "for", "t", "in", "arg_0", ".", "hierarchy", "]", "arg_2", "=", "[", "_mirrorStructure", "(", "arg_0", ".", "additional_config", ",", "'command-line config'", ")", ",", "_mirrorStructure", "(", "arg_0", ".", "app_config", ",", "'application\\'s config.json'", ")", ",", "]", "+", "[", "_mirrorStructure", "(", "t", ".", "getConfig", "(", ")", ",", "t", ".", "getName", "(", ")", ")", "for", "t", "in", "arg_0", ".", "hierarchy", "]", "arg_0", ".", "config", "=", "_mergeDictionaries", "(", "*", "arg_1", ")", "arg_0", ".", "config_blame", "=", "_mergeDictionaries", "(", "*", "arg_2", ")"], "function": "def Func(arg_0):\n        ''' load the configuration information from the target hierarchy '''\n        arg_1 = [arg_0.additional_config, arg_0.app_config] + [t.getConfig() for t in arg_0.hierarchy]\n        # create an identical set of dictionaries, but with the names of the\n        # sources in place of the values. When these are merged they will show\n        # where each merged property came from:\n        arg_2 = [\n            _mirrorStructure(arg_0.additional_config, 'command-line config'),\n            _mirrorStructure(arg_0.app_config, 'application\\'s config.json'),\n        ] + [\n            _mirrorStructure(t.getConfig(), t.getName()) for t in arg_0.hierarchy\n        ]\n\n        arg_0.config = _mergeDictionaries(*arg_1)\n        arg_0.config_blame = _mergeDictionaries(*arg_2)", "path": "yotta/lib/target.py", "identifier": "DerivedTarget._loadConfig", "docstring": "load the configuration information from the target hierarchy", "docstring_tokens": ["load", "the", "configuration", "information", "from", "the", "target", "hierarchy"], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 252823}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/resource.py#L199-L243", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Associate event handlers", "language": "python", "parameters": "(component, controller=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_1", "or", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "util", ".", "get_caller_module_dict", "(", ")", "arg_2", "=", "arg_1", "[", "'__name__'", "]", "arg_3", "=", "arg_1", "else", ":", "arg_2", "=", "arg_1", ".", "__class__", ".", "__name__", "arg_3", "=", "dict", "(", "[", "(", "k", ",", "getattr", "(", "arg_1", ",", "k", ")", ")", "for", "k", "in", "dir", "(", "arg_1", ")", "if", "k", ".", "startswith", "(", "\"on_\"", ")", "]", ")", "for", "arg_4", "in", "[", "n", "for", "n", "in", "arg_3", "if", "n", ".", "startswith", "(", "\"on_\"", ")", "]", ":", "arg_5", "=", "arg_4", ".", "split", "(", "\"_\"", ")", "arg_6", "=", "arg_5", ".", "pop", "(", "0", ")", "+", "arg_5", ".", "pop", "(", "-", "1", ")", "arg_7", "=", "arg_0", "for", "arg_8", "in", "arg_5", ":", "try", ":", "arg_7", "=", "arg_7", "[", "arg_8", "]", "except", "KeyError", ":", "arg_7", "=", "None", "break", "if", "not", "arg_7", ":", "from", ".", "component", "import", "COMPONENTS", "for", "arg_9", ",", "arg_7", "in", "COMPONENTS", ".", "items", "(", ")", ":", "if", "arg_7", ".", "name", "==", "arg_8", ":", "print", "\"WARNING: %s should be %s\"", "%", "(", "arg_8", ",", "arg_9", ".", "replace", "(", "\".\"", ",", "\"_\"", ")", ")", "break", "else", ":", "raise", "NameError", "(", "\"'%s' component not found (%s.%s)\"", "%", "(", "arg_8", ",", "arg_2", ",", "arg_4", ")", ")", "if", "arg_6", "in", "PYTHONCARD_EVENT_MAP", ":", "arg_10", "=", "PYTHONCARD_EVENT_MAP", "[", "arg_6", "]", "print", "\"WARNING: %s should be %s (%s)\"", "%", "(", "arg_6", ",", "arg_10", ",", "arg_4", ")", "arg_6", "=", "arg_10", "if", "not", "hasattr", "(", "arg_7", ",", "arg_6", ")", ":", "raise", "NameError", "(", "\"'%s' event not valid (%s.%s)\"", "%", "(", "arg_6", ",", "arg_2", ",", "arg_4", ")", ")", "setattr", "(", "arg_7", ",", "arg_6", ",", "arg_3", "[", "arg_4", "]", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"Associate event handlers \"\n    \n    # get the controller functions and names (module or class)\n    if not arg_1 or isinstance(arg_1, dict):\n        if not arg_1:\n            arg_1 = util.get_caller_module_dict()\n        arg_2 = arg_1['__name__']\n        arg_3 = arg_1\n    else:\n        arg_2 = arg_1.__class__.__name__\n        arg_3 = dict([(k, getattr(arg_1, k)) for k \n                                in dir(arg_1) if k.startswith(\"on_\")])\n\n    for arg_4 in [n for n in arg_3 if n.startswith(\"on_\")]:\n        # on_mypanel_mybutton_click -> ['mypanel']['mybutton'].onclick \n        arg_5 = arg_4.split(\"_\")\n        arg_6 = arg_5.pop(0) + arg_5.pop(-1)\n        # find the control\n        arg_7 = arg_0\n        for arg_8 in arg_5:\n            try:\n                arg_7 = arg_7[arg_8]\n            except KeyError:\n                arg_7 = None\n                break\n        if not arg_7:\n            from .component import COMPONENTS\n            for arg_9, arg_7 in COMPONENTS.items():\n                if arg_7.name == arg_8:\n                    print \"WARNING: %s should be %s\" % (arg_8, arg_9.replace(\".\", \"_\"))\n                    break\n            else:\n                raise NameError(\"'%s' component not found (%s.%s)\" % \n                                    (arg_8, arg_2, arg_4))\n        # check if the control supports the event:\n        if arg_6 in PYTHONCARD_EVENT_MAP:\n            arg_10 = PYTHONCARD_EVENT_MAP[arg_6]\n            print \"WARNING: %s should be %s (%s)\" % (arg_6, arg_10, arg_4)\n            arg_6 = arg_10\n        if not hasattr(arg_7, arg_6):\n            raise NameError(\"'%s' event not valid (%s.%s)\" % \n                                (arg_6, arg_2, arg_4))\n        # bind the event (assign the method to the on... spec)\n        setattr(arg_7, arg_6, arg_3[arg_4])", "path": "gui/resource.py", "identifier": "connect", "docstring": "Associate event handlers", "docstring_tokens": ["Associate", "event", "handlers"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 252824}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L236-L248", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Returns the concordance scores for each stratified graph based on the given annotation", "language": "python", "parameters": "(graph, annotation, key, cutoff=None)", "return_statement": "return {\n        value: calculate_concordance(subgraph, key, cutoff=cutoff)\n        for value, subgraph in get_subgraphs_by_annotation(graph, annotation).items()\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "return", "{", "arg_4", ":", "calculate_concordance", "(", "arg_5", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "for", "arg_4", ",", "arg_5", "in", "get_subgraphs_by_annotation", "(", "arg_0", ",", "arg_1", ")", ".", "items", "(", ")", "}"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"Returns the concordance scores for each stratified graph based on the given annotation\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param str annotation: The annotation to group by.\n    :param str key: The node data dictionary key storing the logFC\n    :param float cutoff: The optional logFC cutoff for significance\n    :rtype: dict[str,tuple]\n    \"\"\"\n    return {\n        arg_4: calculate_concordance(arg_5, arg_2, arg_3=arg_3)\n        for arg_4, arg_5 in get_subgraphs_by_annotation(arg_0, arg_1).items()\n    }", "path": "src/pybel_tools/analysis/concordance.py", "identifier": "calculate_concordance_by_annotation", "docstring": "Returns the concordance scores for each stratified graph based on the given annotation\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param str annotation: The annotation to group by.\n    :param str key: The node data dictionary key storing the logFC\n    :param float cutoff: The optional logFC cutoff for significance\n    :rtype: dict[str,tuple]", "docstring_tokens": ["Returns", "the", "concordance", "scores", "for", "each", "stratified", "graph", "based", "on", "the", "given", "annotation"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 252825}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L179-L192", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Convert hex to a color name, using matplotlib's colour names.", "language": "python", "parameters": "(hexx)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "defaults", ".", "COLOURS", ".", "items", "(", ")", ":", "if", "(", "len", "(", "arg_1", ")", ">", "1", ")", "and", "(", "arg_2", "==", "arg_0", ".", "upper", "(", ")", ")", ":", "return", "arg_1", ".", "lower", "(", ")", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Convert hex to a color name, using matplotlib's colour names.\n\n    Args:\n        hexx (str): A hexadecimal colour, starting with '#'.\n\n    Returns:\n        str: The name of the colour, or None if not found.\n    \"\"\"\n    for arg_1, arg_2 in defaults.COLOURS.items():\n        if (len(arg_1) > 1) and (arg_2 == arg_0.upper()):\n            return arg_1.lower()\n    return None", "path": "striplog/utils.py", "identifier": "hex_to_name", "docstring": "Convert hex to a color name, using matplotlib's colour names.\n\n    Args:\n        hexx (str): A hexadecimal colour, starting with '#'.\n\n    Returns:\n        str: The name of the colour, or None if not found.", "docstring_tokens": ["Convert", "hex", "to", "a", "color", "name", "using", "matplotlib", "s", "colour", "names", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 252826}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/lib.py#L234-L248", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Maintain current time during context", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "cmds", ".", "currentTime", "(", "query", "=", "True", ")", "try", ":", "yield", "finally", ":", "cmds", ".", "currentTime", "(", "arg_0", ",", "edit", "=", "True", ")"], "function": "def Func():\n    \"\"\"Maintain current time during context\n\n    Example:\n        >>> with Func():\n        ...    cmds.playblast()\n        >>> # Time restored\n\n    \"\"\"\n\n    arg_0 = cmds.currentTime(query=True)\n    try:\n        yield\n    finally:\n        cmds.currentTime(arg_0, edit=True)", "path": "pyblish_maya/lib.py", "identifier": "maintained_time", "docstring": "Maintain current time during context\n\n    Example:\n        >>> with maintained_time():\n        ...    cmds.playblast()\n        >>> # Time restored", "docstring_tokens": ["Maintain", "current", "time", "during", "context"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 252827}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L757-L764", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Matches the string with the pattern, caching the compiled regexp.", "language": "python", "parameters": "(pattern, s)", "return_statement": "return _regexp_compile_cache[pattern].match(s)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "not", "in", "arg_2", ":", "arg_2", "[", "arg_0", "]", "=", "sre_compile", ".", "compile", "(", "arg_0", ")", "return", "arg_2", "[", "arg_0", "]", ".", "match", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Funces the string with the pattern, caching the compiled regexp.\"\"\"\n  # The regexp compilation caching is inlined in both Func and Search for\n  # performance reasons; factoring it out into a separate function turns out\n  # to be noticeably expensive.\n  if arg_0 not in arg_2:\n    arg_2[arg_0] = sre_compile.compile(arg_0)\n  return arg_2[arg_0].match(arg_1)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "Match", "docstring": "Matches the string with the pattern, caching the compiled regexp.", "docstring_tokens": ["Matches", "the", "string", "with", "the", "pattern", "caching", "the", "compiled", "regexp", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252828}
{"url": "https://github.com/adrianoveiga/django-media-fixtures/blob/a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54/django_media_fixtures/finders.py#L121-L128", "sha": "a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54", "docstring_summary": "List all files in all app storages.", "language": "python", "parameters": "(self, ignore_patterns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "six", ".", "itervalues", "(", "arg_0", ".", "storages", ")", ":", "if", "arg_2", ".", "exists", "(", "''", ")", ":", "for", "arg_3", "in", "utils", ".", "get_files", "(", "arg_2", ",", "arg_1", ")", ":", "yield", "arg_3", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        List all files in all app storages.\n        \"\"\"\n        for arg_2 in six.itervalues(arg_0.storages):\n            if arg_2.exists(''):  # check if storage location exists\n                for arg_3 in utils.get_files(arg_2, arg_1):\n                    yield arg_3, arg_2", "path": "django_media_fixtures/finders.py", "identifier": "AppDirectoriesFinder.list", "docstring": "List all files in all app storages.", "docstring_tokens": ["List", "all", "files", "in", "all", "app", "storages", "."], "nwo": "adrianoveiga/django-media-fixtures", "score": 0.2845436920530269, "idx": 252829}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1119-L1135", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Read the commits of a pack.", "language": "python", "parameters": "(self, packet_name)", "return_statement": "return commits", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'objects/pack/pack-'", "+", "arg_1", "arg_3", "=", "[", "'git'", ",", "'verify-pack'", ",", "'-v'", ",", "arg_2", "]", "arg_4", "=", "arg_0", ".", "_exec", "(", "arg_3", ",", "cwd", "=", "arg_0", ".", "dirpath", ",", "env", "=", "arg_0", ".", "gitenv", ")", "arg_4", "=", "arg_4", ".", "decode", "(", "'utf-8'", ",", "errors", "=", "'surrogateescape'", ")", ".", "rstrip", "(", ")", "arg_5", "=", "[", "line", ".", "split", "(", "' '", ")", "for", "line", "in", "arg_4", ".", "split", "(", "'\\n'", ")", "]", "arg_6", "=", "[", "parts", "[", "0", "]", "for", "parts", "in", "arg_5", "if", "parts", "[", "1", "]", "==", "'commit'", "]", "arg_6", ".", "reverse", "(", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read the commits of a pack.\"\"\"\n\n        arg_2 = 'objects/pack/pack-' + arg_1\n\n        arg_3 = ['git', 'verify-pack', '-v', arg_2]\n\n        arg_4 = arg_0._exec(arg_3, cwd=arg_0.dirpath, env=arg_0.gitenv)\n        arg_4 = arg_4.decode('utf-8', errors='surrogateescape').rstrip()\n\n        arg_5 = [line.split(' ') for line in arg_4.split('\\n')]\n\n        # Commits usually come in the pack ordered from newest to oldest\n        arg_6 = [parts[0] for parts in arg_5 if parts[1] == 'commit']\n        arg_6.reverse()\n\n        return arg_6", "path": "perceval/backends/core/git.py", "identifier": "GitRepository._read_commits_from_pack", "docstring": "Read the commits of a pack.", "docstring_tokens": ["Read", "the", "commits", "of", "a", "pack", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 252830}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/csv.py#L95-L99", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Reuses the same db session", "language": "python", "parameters": "(self)", "return_statement": "return self.session", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "session", ":", "arg_0", ".", "session", "=", "dal", ".", "get_default_session", "(", ")", "return", "arg_0", ".", "session"], "function": "def Func(arg_0):\n        \"\"\" Reuses the same db session \"\"\"\n        if not arg_0.session:\n            arg_0.session = dal.get_default_session()\n        return arg_0.session", "path": "pricedb/csv.py", "identifier": "CsvParser.__get_session", "docstring": "Reuses the same db session", "docstring_tokens": ["Reuses", "the", "same", "db", "session"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 252831}
{"url": "https://github.com/nyaruka/python-librato-bg/blob/e541092838694de31d256becea8391a9cfe086c7/librato_bg/consumer.py#L59-L73", "sha": "e541092838694de31d256becea8391a9cfe086c7", "docstring_summary": "Return the next batch of items to upload.", "language": "python", "parameters": "(self)", "return_statement": "return items", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "queue", "arg_2", "=", "[", "]", "arg_3", "=", "arg_0", ".", "Func_item", "(", ")", "if", "arg_3", "is", "None", ":", "return", "arg_2", "arg_2", ".", "append", "(", "arg_3", ")", "while", "len", "(", "arg_2", ")", "<", "arg_0", ".", "upload_size", "and", "not", "arg_1", ".", "empty", "(", ")", ":", "arg_3", "=", "arg_0", ".", "Func_item", "(", ")", "if", "arg_3", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Return the Func batch of items to upload.\"\"\"\n        arg_1 = arg_0.queue\n        arg_2 = []\n        arg_3 = arg_0.Func_item()\n        if arg_3 is None:\n            return arg_2\n\n        arg_2.append(arg_3)\n        while len(arg_2) < arg_0.upload_size and not arg_1.empty():\n            arg_3 = arg_0.Func_item()\n            if arg_3:\n                arg_2.append(arg_3)\n\n        return arg_2", "path": "librato_bg/consumer.py", "identifier": "Consumer.next", "docstring": "Return the next batch of items to upload.", "docstring_tokens": ["Return", "the", "next", "batch", "of", "items", "to", "upload", "."], "nwo": "nyaruka/python-librato-bg", "score": 0.0, "idx": 252832}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/query.py#L770-L836", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "See docstrings for `generate_files` and `generate_checkpoints`.", "language": "python", "parameters": "(table, timestamp_column,\n                        engine, crypto_factory, min_dt, max_dt, logger)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "[", "]", "if", "arg_4", "is", "not", "None", ":", "arg_7", ".", "append", "(", "arg_1", ">=", "arg_4", ")", "if", "arg_5", "is", "not", "None", ":", "arg_7", ".", "append", "(", "arg_1", "<", "arg_5", ")", "if", "arg_0", "is", "files", ":", "arg_7", ".", "append", "(", "files", ".", "c", ".", "name", ".", "like", "(", "u'%.ipynb'", ")", ")", "arg_8", "=", "select", "(", "[", "arg_0", "]", ")", ".", "order_by", "(", "arg_1", ")", "for", "arg_9", "in", "arg_7", ":", "arg_8", "=", "arg_8", ".", "where", "(", "arg_9", ")", "arg_10", "=", "arg_2", ".", "execute", "(", "arg_8", ")", "for", "arg_11", "in", "arg_10", ":", "try", ":", "arg_12", "=", "arg_11", "[", "'user_id'", "]", "arg_13", "=", "arg_3", "(", "arg_12", ")", ".", "decrypt", "arg_14", "=", "to_dict_with_content", "(", "arg_0", ".", "c", ",", "arg_11", ",", "arg_13", ")", "if", "arg_0", "is", "files", ":", "arg_14", "[", "'path'", "]", "=", "arg_14", "[", "'parent_name'", "]", "+", "arg_14", "[", "'name'", "]", "arg_14", "[", "'last_modified'", "]", "=", "arg_14", "[", "'created_at'", "]", "yield", "{", "'id'", ":", "arg_14", "[", "'id'", "]", ",", "'user_id'", ":", "arg_12", ",", "'path'", ":", "to_api_path", "(", "arg_14", "[", "'path'", "]", ")", ",", "'last_modified'", ":", "arg_14", "[", "'last_modified'", "]", ",", "'content'", ":", "reads_base64", "(", "arg_14", "[", "'content'", "]", ")", ",", "}", "except", "CorruptedFile", ":", "if", "arg_6", "is", "not", "None", ":", "arg_6", ".", "warning", "(", "'Corrupted file with id %d in table %s.'", "%", "(", "arg_11", "[", "'id'", "]", ",", "arg_0", ".", "name", ")", ")"], "function": "def Func(arg_0, arg_1,\n                        arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    See docstrings for `generate_files` and `generate_checkpoints`.\n\n    Parameters\n    ----------\n    table : SQLAlchemy.Table\n        Table to fetch notebooks from, `files` or `remote_checkpoints.\n    timestamp_column : SQLAlchemy.Column\n        `table`'s column storing timestamps, `created_at` or `last_modified`.\n    engine : SQLAlchemy.engine\n        Engine encapsulating database connections.\n    crypto_factory : function[str -> Any]\n        A function from user_id to an object providing the interface required\n        by PostgresContentsManager.crypto.  Results of this will be used for\n        decryption of the selected notebooks.\n    min_dt : datetime.datetime\n        Minimum last modified datetime at which a file will be included.\n    max_dt : datetime.datetime\n        Last modified datetime at and after which a file will be excluded.\n    logger : Logger\n    \"\"\"\n    arg_7 = []\n    if arg_4 is not None:\n        arg_7.append(arg_1 >= arg_4)\n    if arg_5 is not None:\n        arg_7.append(arg_1 < arg_5)\n    if arg_0 is files:\n        # Only select files that are notebooks\n        arg_7.append(files.c.name.like(u'%.ipynb'))\n\n    # Query for notebooks satisfying the conditions.\n    arg_8 = select([arg_0]).order_by(arg_1)\n    for arg_9 in arg_7:\n        arg_8 = arg_8.where(arg_9)\n    arg_10 = arg_2.execute(arg_8)\n\n    # Decrypt each notebook and yield the result.\n    for arg_11 in arg_10:\n        try:\n            # The decrypt function depends on the user\n            arg_12 = arg_11['user_id']\n            arg_13 = arg_3(arg_12).decrypt\n\n            arg_14 = to_dict_with_content(arg_0.c, arg_11, arg_13)\n            if arg_0 is files:\n                # Correct for files schema differing somewhat from checkpoints.\n                arg_14['path'] = arg_14['parent_name'] + arg_14['name']\n                arg_14['last_modified'] = arg_14['created_at']\n\n            # For 'content', we use `reads_base64` directly. If the db content\n            # format is changed from base64, the decoding should be changed\n            # here as well.\n            yield {\n                'id': arg_14['id'],\n                'user_id': arg_12,\n                'path': to_api_path(arg_14['path']),\n                'last_modified': arg_14['last_modified'],\n                'content': reads_base64(arg_14['content']),\n            }\n        except CorruptedFile:\n            if arg_6 is not None:\n                arg_6.warning(\n                    'Corrupted file with id %d in table %s.'\n                    % (arg_11['id'], arg_0.name)\n                )", "path": "pgcontents/query.py", "identifier": "_generate_notebooks", "docstring": "See docstrings for `generate_files` and `generate_checkpoints`.\n\n    Parameters\n    ----------\n    table : SQLAlchemy.Table\n        Table to fetch notebooks from, `files` or `remote_checkpoints.\n    timestamp_column : SQLAlchemy.Column\n        `table`'s column storing timestamps, `created_at` or `last_modified`.\n    engine : SQLAlchemy.engine\n        Engine encapsulating database connections.\n    crypto_factory : function[str -> Any]\n        A function from user_id to an object providing the interface required\n        by PostgresContentsManager.crypto.  Results of this will be used for\n        decryption of the selected notebooks.\n    min_dt : datetime.datetime\n        Minimum last modified datetime at which a file will be included.\n    max_dt : datetime.datetime\n        Last modified datetime at and after which a file will be excluded.\n    logger : Logger", "docstring_tokens": ["See", "docstrings", "for", "generate_files", "and", "generate_checkpoints", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 252833}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L2097-L2127", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "r\"\"\"\n    Generate one of the two sequences that generated a delta.", "language": "python", "parameters": "(delta, which)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "{", "1", ":", "\"- \"", ",", "2", ":", "\"+ \"", "}", "[", "int", "(", "arg_1", ")", "]", "except", "KeyError", ":", "raise", "ValueError", ",", "(", "'unknown delta choice (must be 1 or 2): %r'", "%", "arg_1", ")", "arg_3", "=", "(", "\"  \"", ",", "arg_2", ")", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", "[", ":", "2", "]", "in", "arg_3", ":", "yield", "arg_4", "[", "2", ":", "]"], "function": "def Func(arg_0, arg_1):\n    r\"\"\"\n    Generate one of the two sequences that generated a delta.\n\n    Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract\n    lines originating from file 1 or 2 (parameter `which`), stripping off line\n    prefixes.\n\n    Examples:\n\n    >>> diff = ndiff('one\\ntwo\\nthree\\n'.splitlines(1),\n    ...              'ore\\ntree\\nemu\\n'.splitlines(1))\n    >>> diff = list(diff)\n    >>> print ''.join(Func(diff, 1)),\n    one\n    two\n    three\n    >>> print ''.join(Func(diff, 2)),\n    ore\n    tree\n    emu\n    \"\"\"\n    try:\n        arg_2 = {1: \"- \", 2: \"+ \"}[int(arg_1)]\n    except KeyError:\n        raise ValueError, ('unknown delta choice (must be 1 or 2): %r'\n                           % arg_1)\n    arg_3 = (\"  \", arg_2)\n    for arg_4 in arg_0:\n        if arg_4[:2] in arg_3:\n            yield arg_4[2:]", "path": "third_party/stdlib/difflib.py", "identifier": "restore", "docstring": "r\"\"\"\n    Generate one of the two sequences that generated a delta.\n\n    Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract\n    lines originating from file 1 or 2 (parameter `which`), stripping off line\n    prefixes.\n\n    Examples:\n\n    >>> diff = ndiff('one\\ntwo\\nthree\\n'.splitlines(1),\n    ...              'ore\\ntree\\nemu\\n'.splitlines(1))\n    >>> diff = list(diff)\n    >>> print ''.join(restore(diff, 1)),\n    one\n    two\n    three\n    >>> print ''.join(restore(diff, 2)),\n    ore\n    tree\n    emu", "docstring_tokens": ["r", "Generate", "one", "of", "the", "two", "sequences", "that", "generated", "a", "delta", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 252834}
{"url": "https://github.com/zwischenloesung/ardu-report-lib/blob/51bd4a07e036065aafcb1273b151bea3fdfa50fa/libardurep/datareporter.py#L34-L46", "sha": "51bd4a07e036065aafcb1273b151bea3fdfa50fa", "docstring_summary": "Wrapper for the other log methods, decide which one based on the\n        URL parameter.", "language": "python", "parameters": "(self, url=None, credentials=None, do_verify_certificate=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "url", "if", "re", ".", "match", "(", "\"file://\"", ",", "arg_1", ")", ":", "arg_0", ".", "Func_file", "(", "arg_1", ")", "elif", "re", ".", "match", "(", "\"https://\"", ",", "arg_1", ")", "or", "re", ".", "match", "(", "\"http://\"", ",", "arg_1", ")", ":", "arg_0", ".", "Func_post", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "else", ":", "arg_0", ".", "Func_stdout", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True):\n        \"\"\"\n        Wrapper for the other Func methods, decide which one based on the\n        URL parameter.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.url\n        if re.match(\"file://\", arg_1):\n            arg_0.Func_file(arg_1)\n        elif re.match(\"https://\", arg_1) or re.match(\"http://\", arg_1):\n            arg_0.Func_post(arg_1, arg_2, arg_3)\n        else:\n            arg_0.Func_stdout()", "path": "libardurep/datareporter.py", "identifier": "DataReporter.log", "docstring": "Wrapper for the other log methods, decide which one based on the\n        URL parameter.", "docstring_tokens": ["Wrapper", "for", "the", "other", "log", "methods", "decide", "which", "one", "based", "on", "the", "URL", "parameter", "."], "nwo": "zwischenloesung/ardu-report-lib", "score": 0.0, "idx": 252835}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1539-L1581", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check that the signature of the two given methods match", "language": "python", "parameters": "(self, method1, refmethod, class_type, cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "not", "(", "isinstance", "(", "arg_1", ",", "astroid", ".", "FunctionDef", ")", "and", "isinstance", "(", "arg_2", ",", "astroid", ".", "FunctionDef", ")", ")", ":", "arg_0", ".", "add_message", "(", "\"method-check-failed\"", ",", "args", "=", "(", "arg_1", ",", "arg_2", ")", ",", "node", "=", "arg_1", ")", "return", "arg_5", "=", "arg_4", ".", "instantiate_class", "(", ")", "arg_1", "=", "function_to_method", "(", "arg_1", ",", "arg_5", ")", "arg_2", "=", "function_to_method", "(", "arg_2", ",", "arg_5", ")", "if", "arg_1", ".", "args", ".", "args", "is", "None", "or", "arg_2", ".", "args", ".", "args", "is", "None", ":", "return", "if", "is_attr_private", "(", "arg_1", ".", "name", ")", ":", "return", "if", "arg_1", ".", "decorators", ":", "for", "arg_6", "in", "arg_1", ".", "decorators", ".", "nodes", ":", "if", "(", "isinstance", "(", "arg_6", ",", "astroid", ".", "Attribute", ")", "and", "arg_6", ".", "attrname", "==", "\"setter\"", ")", ":", "return", "if", "_different_parameters", "(", "arg_2", ",", "arg_1", ",", "dummy_parameter_regex", "=", "arg_0", ".", "_dummy_rgx", ")", ":", "arg_0", ".", "add_message", "(", "\"arguments-differ\"", ",", "args", "=", "(", "arg_3", ",", "arg_1", ".", "name", ")", ",", "node", "=", "arg_1", ")", "elif", "len", "(", "arg_1", ".", "args", ".", "defaults", ")", "<", "len", "(", "arg_2", ".", "args", ".", "defaults", ")", ":", "arg_0", ".", "add_message", "(", "\"signature-differs\"", ",", "args", "=", "(", "arg_3", ",", "arg_1", ".", "name", ")", ",", "node", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"check that the signature of the two given methods match\n        \"\"\"\n        if not (\n            isinstance(arg_1, astroid.FunctionDef)\n            and isinstance(arg_2, astroid.FunctionDef)\n        ):\n            arg_0.add_message(\n                \"method-check-failed\", args=(arg_1, arg_2), node=arg_1\n            )\n            return\n\n        arg_5 = arg_4.instantiate_class()\n        arg_1 = function_to_method(arg_1, arg_5)\n        arg_2 = function_to_method(arg_2, arg_5)\n\n        # Don't care about functions with unknown argument (builtins).\n        if arg_1.args.args is None or arg_2.args.args is None:\n            return\n\n        # Ignore private to class methods.\n        if is_attr_private(arg_1.name):\n            return\n        # Ignore setters, they have an implicit extra argument,\n        # which shouldn't be taken in consideration.\n        if arg_1.decorators:\n            for arg_6 in arg_1.decorators.nodes:\n                if (\n                    isinstance(arg_6, astroid.Attribute)\n                    and arg_6.attrname == \"setter\"\n                ):\n                    return\n\n        if _different_parameters(\n            arg_2, arg_1, dummy_parameter_regex=arg_0._dummy_rgx\n        ):\n            arg_0.add_message(\n                \"arguments-differ\", args=(arg_3, arg_1.name), node=arg_1\n            )\n        elif len(arg_1.args.defaults) < len(arg_2.args.defaults):\n            arg_0.add_message(\n                \"signature-differs\", args=(arg_3, arg_1.name), node=arg_1\n            )", "path": "pylint/checkers/classes.py", "identifier": "ClassChecker._check_signature", "docstring": "check that the signature of the two given methods match", "docstring_tokens": ["check", "that", "the", "signature", "of", "the", "two", "given", "methods", "match"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252836}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1265-L1314", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Generate an intermediate if statement which assigns to a temporary\n    variable, which is returned as the expression value at the end of\n    evaluation.", "language": "python", "parameters": "(ctx: GeneratorContext, node: If)", "return_statement": "return GeneratedPyAST(\n        node=ast.Name(id=result_name, ctx=ast.Load()),\n        dependencies=list(chain(test_ast.dependencies, [test_assign, ifstmt])),\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "IF", "arg_4", "=", "gen_py_ast", "(", "arg_0", ",", "arg_2", ".", "test", ")", "arg_5", "=", "genname", "(", "_IF_RESULT_PREFIX", ")", "arg_6", "=", "__if_body_to_py_ast", "(", "arg_0", ",", "arg_2", ".", "then", ",", "arg_5", ")", "arg_7", "=", "__if_body_to_py_ast", "(", "arg_0", ",", "arg_2", ".", "else_", ",", "arg_5", ")", "arg_8", "=", "genname", "(", "_IF_TEST_PREFIX", ")", "arg_9", "=", "ast", ".", "Assign", "(", "targets", "=", "[", "ast", ".", "Name", "(", "id", "=", "arg_8", ",", "arg_0", "=", "ast", ".", "Store", "(", ")", ")", "]", ",", "value", "=", "arg_4", ".", "node", ")", "arg_10", "=", "ast", ".", "If", "(", "test", "=", "ast", ".", "BoolOp", "(", "op", "=", "ast", ".", "Or", "(", ")", ",", "values", "=", "[", "ast", ".", "Compare", "(", "left", "=", "ast", ".", "NameConstant", "(", "None", ")", ",", "ops", "=", "[", "ast", ".", "Is", "(", ")", "]", ",", "comparators", "=", "[", "ast", ".", "Name", "(", "id", "=", "arg_8", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", "]", ",", ")", ",", "ast", ".", "Compare", "(", "left", "=", "ast", ".", "NameConstant", "(", "False", ")", ",", "ops", "=", "[", "ast", ".", "Is", "(", ")", "]", ",", "comparators", "=", "[", "ast", ".", "Name", "(", "id", "=", "arg_8", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", "]", ",", ")", ",", "]", ",", ")", ",", "values", "=", "[", "]", ",", "body", "=", "list", "(", "map", "(", "statementize", ",", "chain", "(", "arg_7", ".", "dependencies", ",", "[", "arg_7", ".", "node", "]", ")", ")", ")", ",", "orelse", "=", "list", "(", "map", "(", "statementize", ",", "chain", "(", "arg_6", ".", "dependencies", ",", "[", "arg_6", ".", "node", "]", ")", ")", ")", ",", ")", "return", "GeneratedPyAST", "(", "arg_2", "=", "ast", ".", "Name", "(", "id", "=", "arg_5", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", ",", "dependencies", "=", "list", "(", "chain", "(", "arg_4", ".", "dependencies", ",", "[", "arg_9", ",", "arg_10", "]", ")", ")", ",", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:\n    \"\"\"Generate an intermediate if statement which assigns to a temporary\n    variable, which is returned as the expression value at the end of\n    evaluation.\n\n    Every expression in Basilisp is true if it is not the literal values nil\n    or false. This function compiles direct checks for the test value against\n    the Python values None and False to accommodate this behavior.\n\n    Note that the if and else bodies are switched in compilation so that we\n    can perform a short-circuit or comparison, rather than exhaustively checking\n    for both false and nil each time.\"\"\"\n    assert arg_2.op == NodeOp.IF\n\n    arg_4 = gen_py_ast(arg_0, arg_2.test)\n    arg_5 = genname(_IF_RESULT_PREFIX)\n\n    arg_6 = __if_body_to_py_ast(arg_0, arg_2.then, arg_5)\n    arg_7 = __if_body_to_py_ast(arg_0, arg_2.else_, arg_5)\n\n    arg_8 = genname(_IF_TEST_PREFIX)\n    arg_9 = ast.Assign(\n        targets=[ast.Name(id=arg_8, arg_0=ast.Store())], value=arg_4.node\n    )\n\n    arg_10 = ast.If(\n        test=ast.BoolOp(\n            op=ast.Or(),\n            values=[\n                ast.Compare(\n                    left=ast.NameConstant(None),\n                    ops=[ast.Is()],\n                    comparators=[ast.Name(id=arg_8, arg_0=ast.Load())],\n                ),\n                ast.Compare(\n                    left=ast.NameConstant(False),\n                    ops=[ast.Is()],\n                    comparators=[ast.Name(id=arg_8, arg_0=ast.Load())],\n                ),\n            ],\n        ),\n        values=[],\n        body=list(map(statementize, chain(arg_7.dependencies, [arg_7.node]))),\n        orelse=list(map(statementize, chain(arg_6.dependencies, [arg_6.node]))),\n    )\n\n    return GeneratedPyAST(\n        arg_2=ast.Name(id=arg_5, arg_0=ast.Load()),\n        dependencies=list(chain(arg_4.dependencies, [arg_9, arg_10])),\n    )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_if_to_py_ast", "docstring": "Generate an intermediate if statement which assigns to a temporary\n    variable, which is returned as the expression value at the end of\n    evaluation.\n\n    Every expression in Basilisp is true if it is not the literal values nil\n    or false. This function compiles direct checks for the test value against\n    the Python values None and False to accommodate this behavior.\n\n    Note that the if and else bodies are switched in compilation so that we\n    can perform a short-circuit or comparison, rather than exhaustively checking\n    for both false and nil each time.", "docstring_tokens": ["Generate", "an", "intermediate", "if", "statement", "which", "assigns", "to", "a", "temporary", "variable", "which", "is", "returned", "as", "the", "expression", "value", "at", "the", "end", "of", "evaluation", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252837}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L1047-L1104", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Calculate the minimum and maximum for expressions, possibly on a grid defined by binby.", "language": "python", "parameters": "(self, expression, binby=[], limits=None, shape=default_shape, selection=False, delay=False, progress=None)", "return_statement": "return self._delay(delay, result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "[", "]", ",", "arg_3", "=", "None", ",", "arg_4", "=", "arg_5", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ")", ":", "@", "delayed", "def", "finish", "(", "*", "arg_9", ")", ":", "arg_10", "=", "vaex", ".", "utils", ".", "unlistify", "(", "arg_12", ",", "np", ".", "array", "(", "arg_9", ")", ")", "arg_10", "=", "arg_10", ".", "astype", "(", "arg_15", ")", "return", "arg_10", "@", "delayed", "def", "calculate", "(", "arg_1", ",", "arg_3", ")", ":", "arg_11", "=", "tasks", ".", "TaskStatistic", "(", "arg_0", ",", "arg_2", ",", "arg_4", ",", "arg_3", ",", "weight", "=", "arg_1", ",", "op", "=", "tasks", ".", "OP_MIN_MAX", ",", "arg_6", "=", "arg_6", ")", "arg_0", ".", "executor", ".", "schedule", "(", "arg_11", ")", "arg_17", ".", "add_task", "(", "arg_11", ",", "\"Func for %s\"", "%", "arg_1", ")", "return", "arg_11", "@", "delayed", "def", "finish", "(", "*", "arg_9", ")", ":", "arg_10", "=", "vaex", ".", "utils", ".", "unlistify", "(", "arg_12", ",", "np", ".", "array", "(", "arg_9", ")", ")", "arg_10", "=", "arg_10", ".", "astype", "(", "arg_15", ")", "return", "arg_10", "arg_1", "=", "_ensure_strings_from_expressions", "(", "arg_1", ")", "arg_2", "=", "_ensure_strings_from_expressions", "(", "arg_2", ")", "arg_12", ",", "[", "arg_13", ",", "]", "=", "vaex", ".", "utils", ".", "listify", "(", "arg_1", ")", "arg_14", "=", "[", "arg_0", ".", "dtype", "(", "expr", ")", "for", "expr", "in", "arg_13", "]", "arg_15", "=", "arg_14", "[", "0", "]", "if", "not", "all", "(", "[", "arg_16", ".", "kind", "==", "arg_15", ".", "kind", "for", "arg_16", "in", "arg_14", "]", ")", ":", "raise", "ValueError", "(", "\"cannot mix datetime and non-datetime expressions\"", ")", "arg_17", "=", "vaex", ".", "utils", ".", "progressbars", "(", "arg_8", ",", "name", "=", "\"Funces\"", ")", "arg_3", "=", "arg_0", ".", "limits", "(", "arg_2", ",", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "True", ")", "arg_18", "=", "[", "calculate", "(", "arg_1", ",", "arg_3", ")", "for", "arg_1", "in", "arg_13", "]", "arg_19", "=", "finish", "(", "*", "arg_18", ")", "return", "arg_0", ".", "_delay", "(", "arg_7", ",", "arg_19", ")"], "function": "def Func(arg_0, arg_1, arg_2=[], arg_3=None, arg_4=arg_5, arg_6=False, arg_7=False, arg_8=None):\n        \"\"\"Calculate the minimum and maximum for expressions, possibly on a grid defined by binby.\n\n\n        Example:\n\n        >>> df.Func(\"x\")\n        array([-128.293991,  271.365997])\n        >>> df.Func([\"x\", \"y\"])\n        array([[-128.293991 ,  271.365997 ],\n                   [ -71.5523682,  146.465836 ]])\n        >>> df.Func(\"x\", binby=\"x\", shape=5, limits=[-10, 10])\n        array([[-9.99919128, -6.00010443],\n                   [-5.99972439, -2.00002384],\n                   [-1.99991322,  1.99998057],\n                   [ 2.0000093 ,  5.99983597],\n                   [ 6.0004878 ,  9.99984646]])\n\n        :param expression: {expression}\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return: {return_stat_scalar}, the last dimension is of shape (2)\n        \"\"\"\n        # vmin  = self._compute_agg('min', expression, binby, limits, shape, selection, delay, edges, progress)\n        # vmax =  self._compute_agg('max', expression, binby, limits, shape, selection, delay, edges, progress)\n        @delayed\n        def finish(*arg_9):\n            arg_10 = vaex.utils.unlistify(arg_12, np.array(arg_9))\n            arg_10 = arg_10.astype(arg_15)\n            return arg_10\n\n        @delayed\n        def calculate(arg_1, arg_3):\n            arg_11 = tasks.TaskStatistic(arg_0, arg_2, arg_4, arg_3, weight=arg_1, op=tasks.OP_MIN_MAX, arg_6=arg_6)\n            arg_0.executor.schedule(arg_11)\n            arg_17.add_task(arg_11, \"Func for %s\" % arg_1)\n            return arg_11\n        @delayed\n        def finish(*arg_9):\n            arg_10 = vaex.utils.unlistify(arg_12, np.array(arg_9))\n            arg_10 = arg_10.astype(arg_15)\n            return arg_10\n        arg_1 = _ensure_strings_from_expressions(arg_1)\n        arg_2 = _ensure_strings_from_expressions(arg_2)\n        arg_12, [arg_13, ] = vaex.utils.listify(arg_1)\n        arg_14 = [arg_0.dtype(expr) for expr in arg_13]\n        arg_15 = arg_14[0]\n        if not all([arg_16.kind == arg_15.kind for arg_16 in arg_14]):\n            raise ValueError(\"cannot mix datetime and non-datetime expressions\")\n        arg_17 = vaex.utils.progressbars(arg_8, name=\"Funces\")\n        arg_3 = arg_0.limits(arg_2, arg_3, arg_6=arg_6, arg_7=True)\n        arg_18 = [calculate(arg_1, arg_3) for arg_1 in arg_13]\n        arg_19 = finish(*arg_18)\n        return arg_0._delay(arg_7, arg_19)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.minmax", "docstring": "Calculate the minimum and maximum for expressions, possibly on a grid defined by binby.\n\n\n        Example:\n\n        >>> df.minmax(\"x\")\n        array([-128.293991,  271.365997])\n        >>> df.minmax([\"x\", \"y\"])\n        array([[-128.293991 ,  271.365997 ],\n                   [ -71.5523682,  146.465836 ]])\n        >>> df.minmax(\"x\", binby=\"x\", shape=5, limits=[-10, 10])\n        array([[-9.99919128, -6.00010443],\n                   [-5.99972439, -2.00002384],\n                   [-1.99991322,  1.99998057],\n                   [ 2.0000093 ,  5.99983597],\n                   [ 6.0004878 ,  9.99984646]])\n\n        :param expression: {expression}\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return: {return_stat_scalar}, the last dimension is of shape (2)", "docstring_tokens": ["Calculate", "the", "minimum", "and", "maximum", "for", "expressions", "possibly", "on", "a", "grid", "defined", "by", "binby", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 252838}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L446-L459", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a random Pauli on number of qubits.", "language": "python", "parameters": "(cls, num_qubits, seed=None)", "return_statement": "return cls(z, x)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "not", "None", ":", "np", ".", "Func", ".", "seed", "(", "arg_2", ")", "arg_3", "=", "np", ".", "Func", ".", "randint", "(", "2", ",", "size", "=", "arg_1", ")", ".", "astype", "(", "np", ".", "bool", ")", "arg_4", "=", "np", ".", "Func", ".", "randint", "(", "2", ",", "size", "=", "arg_1", ")", ".", "astype", "(", "np", ".", "bool", ")", "return", "arg_0", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Return a Func Pauli on number of qubits.\n\n        Args:\n            num_qubits (int): the number of qubits\n            seed (int): Optional. To set a Func seed.\n        Returns:\n            Pauli: the Func pauli\n        \"\"\"\n        if arg_2 is not None:\n            np.Func.seed(arg_2)\n        arg_3 = np.Func.randint(2, size=arg_1).astype(np.bool)\n        arg_4 = np.Func.randint(2, size=arg_1).astype(np.bool)\n        return arg_0(arg_3, arg_4)", "path": "qiskit/quantum_info/operators/pauli.py", "identifier": "Pauli.random", "docstring": "Return a random Pauli on number of qubits.\n\n        Args:\n            num_qubits (int): the number of qubits\n            seed (int): Optional. To set a random seed.\n        Returns:\n            Pauli: the random pauli", "docstring_tokens": ["Return", "a", "random", "Pauli", "on", "number", "of", "qubits", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252839}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_handler_mix_in.py#L95-L100", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "don't output message of the given id", "language": "python", "parameters": "(self, msgid, scope=\"package\", line=None, ignore_unknown=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"package\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_0", ".", "_set_msg_status", "(", "arg_1", ",", "enable", "=", "False", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_0", ".", "_register_by_id_managed_msg", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=\"package\", arg_3=None, arg_4=False):\n        \"\"\"don't output message of the given id\"\"\"\n        arg_0._set_msg_status(\n            arg_1, enable=False, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4\n        )\n        arg_0._register_by_id_managed_msg(arg_1, arg_3)", "path": "pylint/message/message_handler_mix_in.py", "identifier": "MessagesHandlerMixIn.disable", "docstring": "don't output message of the given id", "docstring_tokens": ["don", "t", "output", "message", "of", "the", "given", "id"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252840}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_mutate_methods.py#L91-L99", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Test whether a file target is not exists or it exists but allow\n        overwrite.", "language": "python", "parameters": "(self, overwrite=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", ".", "exists", "(", ")", "and", "arg_1", "is", "False", ":", "return", "False", "else", ":", "return", "True"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Test whether a file target is not exists or it exists but allow\n        overwrite.\n        \"\"\"\n        if arg_0.exists() and arg_1 is False:\n            return False\n        else:  # pragma: no cover\n            return True", "path": "pathlib_mate/mate_mutate_methods.py", "identifier": "MutateMethods.is_not_exist_or_allow_overwrite", "docstring": "Test whether a file target is not exists or it exists but allow\n        overwrite.", "docstring_tokens": ["Test", "whether", "a", "file", "target", "is", "not", "exists", "or", "it", "exists", "but", "allow", "overwrite", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 252841}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/meta.py#L124-L132", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Attach a method to a class.", "language": "python", "parameters": "(cls)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "arg_1", ")", ":", "setattr", "(", "arg_0", ",", "arg_1", ".", "__name__", ",", "arg_1", ")", "return", "arg_1", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Attach a method to a class.\"\"\"\n    def wrapper(arg_1):\n        #if hasattr(cls, f.__name__):\n        #    raise AttributeError(\"{} already has a '{}' attribute\".format(\n        #        cls.__name__, f.__name__))\n        setattr(arg_0, arg_1.__name__, arg_1)\n        return arg_1\n    return wrapper", "path": "pyrser/meta.py", "identifier": "add_method", "docstring": "Attach a method to a class.", "docstring_tokens": ["Attach", "a", "method", "to", "a", "class", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 252842}
{"url": "https://github.com/WGBH/wagtail-streamfieldtools/blob/192f86845532742b0b7d432bef3987357833b8ed/streamfield_tools/registry.py#L59-L73", "sha": "192f86845532742b0b7d432bef3987357833b8ed", "docstring_summary": "Unregisters the block associated with `block_type` from the registry.", "language": "python", "parameters": "(self, block_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_registry", ":", "raise", "NotRegistered", "(", "'There is no block registered as \"{}\" with the '", "'RegisteredBlockStreamFieldRegistry registry.'", ".", "format", "(", "arg_1", ")", ")", "else", ":", "del", "arg_0", ".", "_registry", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Unregisters the block associated with `block_type` from the registry.\n\n        If no block is registered to `block_type`, NotRegistered will raise.\n        \"\"\"\n        if arg_1 not in arg_0._registry:\n            raise NotRegistered(\n                'There is no block registered as \"{}\" with the '\n                'RegisteredBlockStreamFieldRegistry registry.'.format(\n                    arg_1\n                )\n            )\n        else:\n            del arg_0._registry[arg_1]", "path": "streamfield_tools/registry.py", "identifier": "RegisteredBlockStreamFieldRegistry.unregister_block", "docstring": "Unregisters the block associated with `block_type` from the registry.\n\n        If no block is registered to `block_type`, NotRegistered will raise.", "docstring_tokens": ["Unregisters", "the", "block", "associated", "with", "block_type", "from", "the", "registry", "."], "nwo": "WGBH/wagtail-streamfieldtools", "score": 0.23137166388621372, "idx": 252843}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2975-L2979", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return an adapter factory for `ob` from `registry`", "language": "python", "parameters": "(registry, ob)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "_get_mro", "(", "getattr", "(", "arg_1", ",", "'__class__'", ",", "type", "(", "arg_1", ")", ")", ")", ":", "if", "arg_2", "in", "arg_0", ":", "return", "arg_0", "[", "arg_2", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return an adapter factory for `ob` from `registry`\"\"\"\n    for arg_2 in _get_mro(getattr(arg_1, '__class__', type(arg_1))):\n        if arg_2 in arg_0:\n            return arg_0[arg_2]", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", "identifier": "_find_adapter", "docstring": "Return an adapter factory for `ob` from `registry`", "docstring_tokens": ["Return", "an", "adapter", "factory", "for", "ob", "from", "registry"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252844}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/migrate.py#L186-L192", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Convert PythonCard font description to gui2py style", "language": "python", "parameters": "(font)", "return_statement": "return font", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'faceName'", "in", "arg_0", ":", "arg_0", "[", "'face'", "]", "=", "arg_0", ".", "pop", "(", "'faceName'", ")", "if", "'family'", "in", "arg_0", "and", "arg_0", "[", "'family'", "]", "==", "'sansSerif'", ":", "arg_0", "[", "'family'", "]", "=", "'sans serif'", "return", "arg_0"], "function": "def Func(arg_0):\n    \"Convert PythonCard font description to gui2py style\"\n    if 'faceName' in arg_0:\n        arg_0['face'] = arg_0.pop('faceName')\n    if 'family' in arg_0 and arg_0['family'] == 'sansSerif':\n        arg_0['family'] = 'sans serif'\n    return arg_0", "path": "gui/tools/migrate.py", "identifier": "migrate_font", "docstring": "Convert PythonCard font description to gui2py style", "docstring_tokens": ["Convert", "PythonCard", "font", "description", "to", "gui2py", "style"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 252845}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/google.py#L212-L218", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a Google web query formatted as a GoogleSearch list object.", "language": "python", "parameters": "(q, start=0, wait=10, asynchronous=False, cached=False)", "return_statement": "return GoogleSearch(q, start, service, \"\", wait, asynchronous, cached)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "10", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "GOOGLE_SEARCH", "return", "GoogleSearch", "(", "arg_0", ",", "arg_1", ",", "arg_5", ",", "\"\"", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=10, arg_3=False, arg_4=False):\n    \n    \"\"\" Returns a Google web query formatted as a GoogleSearch list object.\n    \"\"\"\n    \n    arg_5 = GOOGLE_SEARCH\n    return GoogleSearch(arg_0, arg_1, arg_5, \"\", arg_2, arg_3, arg_4)", "path": "lib/web/google.py", "identifier": "search", "docstring": "Returns a Google web query formatted as a GoogleSearch list object.", "docstring_tokens": ["Returns", "a", "Google", "web", "query", "formatted", "as", "a", "GoogleSearch", "list", "object", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252846}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/__init__.py#L4-L24", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Derives a PEP386-compliant version number from VERSION.", "language": "python", "parameters": "(version=None)", "return_statement": "return main + sub", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "VERSION", "assert", "len", "(", "arg_0", ")", "==", "5", "assert", "arg_0", "[", "3", "]", "in", "(", "\"alpha\"", ",", "\"beta\"", ",", "\"rc\"", ",", "\"final\"", ")", "arg_1", "=", "2", "if", "arg_0", "[", "2", "]", "==", "0", "else", "3", "arg_2", "=", "\".\"", ".", "join", "(", "str", "(", "x", ")", "for", "x", "in", "arg_0", "[", ":", "arg_1", "]", ")", "arg_3", "=", "\"\"", "if", "arg_0", "[", "3", "]", "!=", "\"final\"", ":", "arg_4", "=", "{", "\"alpha\"", ":", "\"a\"", ",", "\"beta\"", ":", "\"b\"", ",", "\"rc\"", ":", "\"c\"", "}", "arg_3", "=", "arg_4", "[", "arg_0", "[", "3", "]", "]", "+", "str", "(", "arg_0", "[", "4", "]", ")", "return", "arg_2", "+", "arg_3"], "function": "def Func(arg_0=None):\n    \"\"\"Derives a PEP386-compliant version number from VERSION.\"\"\"\n    if arg_0 is None:\n        arg_0 = VERSION\n    assert len(arg_0) == 5\n    assert arg_0[3] in (\"alpha\", \"beta\", \"rc\", \"final\")\n\n    # Now build the two parts of the version number:\n    # main = X.Y[.Z]\n    # sub = .devN - for pre-alpha releases\n    #     | {a|b|c}N - for alpha, beta and rc releases\n\n    arg_1 = 2 if arg_0[2] == 0 else 3\n    arg_2 = \".\".join(str(x) for x in arg_0[:arg_1])\n\n    arg_3 = \"\"\n    if arg_0[3] != \"final\":\n        arg_4 = {\"alpha\": \"a\", \"beta\": \"b\", \"rc\": \"c\"}\n        arg_3 = arg_4[arg_0[3]] + str(arg_0[4])\n\n    return arg_2 + arg_3", "path": "bananas/__init__.py", "identifier": "get_version", "docstring": "Derives a PEP386-compliant version number from VERSION.", "docstring_tokens": ["Derives", "a", "PEP386", "-", "compliant", "version", "number", "from", "VERSION", "."], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 252847}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/cli.py#L227-L232", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Load users.", "language": "python", "parameters": "(sources)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", ".", "tasks", ".", "users", "import", "load_user", "loadcommon", "(", "arg_0", ",", "load_user", ",", "asynchronous", "=", "False", ")"], "function": "def Func(arg_0):\n    \"\"\"Load users.\"\"\"\n    from .tasks.users import load_user\n    # Cannot be executed asynchronously due to duplicate emails and usernames\n    # which can create a racing condition.\n    loadcommon(arg_0, load_user, asynchronous=False)", "path": "invenio_migrator/cli.py", "identifier": "loadusers", "docstring": "Load users.", "docstring_tokens": ["Load", "users", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 252848}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/acts/documentation.py#L236-L254", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Build Sphinx docs and publish to Confluence.", "language": "python", "parameters": "(ctx, no_publish=False, clean=False, opts='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "''", ")", ":", "arg_4", "=", "config", ".", "load", "(", ")", "if", "arg_2", ":", "arg_0", ".", "run", "(", "\"invoke clean --docs\"", ")", "arg_5", "=", "[", "'sphinx-build'", ",", "'-b'", ",", "'Func'", "]", "arg_5", ".", "extend", "(", "[", "'-E'", ",", "'-a'", "]", ")", "if", "arg_3", ":", "arg_5", ".", "append", "(", "arg_3", ")", "arg_5", ".", "extend", "(", "[", "'.'", ",", "arg_0", ".", "rituals", ".", "docs", ".", "build", "+", "'_cf'", "]", ")", "if", "arg_1", ":", "arg_5", ".", "extend", "(", "[", "'-DFunc_publish=False'", "]", ")", "notify", ".", "info", "(", "\"Starting Sphinx build...\"", ")", "with", "pushd", "(", "arg_0", ".", "rituals", ".", "docs", ".", "sources", ")", ":", "arg_0", ".", "run", "(", "' '", ".", "join", "(", "arg_5", ")", ",", "pty", "=", "True", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=False, arg_3=''):\n    \"\"\"Build Sphinx docs and publish to Confluence.\"\"\"\n    arg_4 = config.load()\n\n    if arg_2:\n        arg_0.run(\"invoke clean --docs\")\n\n    arg_5 = ['sphinx-build', '-b', 'Func']\n    arg_5.extend(['-E', '-a'])  # force a full rebuild\n    if arg_3:\n        arg_5.append(arg_3)\n    arg_5.extend(['.', arg_0.rituals.docs.build + '_cf'])\n    if arg_1:\n        arg_5.extend(['-DFunc_publish=False'])\n\n    # Build docs\n    notify.info(\"Starting Sphinx build...\")\n    with pushd(arg_0.rituals.docs.sources):\n        arg_0.run(' '.join(arg_5), pty=True)", "path": "src/rituals/acts/documentation.py", "identifier": "confluence", "docstring": "Build Sphinx docs and publish to Confluence.", "docstring_tokens": ["Build", "Sphinx", "docs", "and", "publish", "to", "Confluence", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 252849}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L71-L80", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Decorator that prevents callbacks from calling into link methods that\n    are not reentrant", "language": "python", "parameters": "(func)", "return_statement": "return wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrap", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", "[", "0", "]", "if", "arg_3", ".", "_callback_lock", ".", "in_callback", ":", "arg_4", "=", "\"Link %s cannot be invoked from a callback!\"", "%", "arg_0", "raise", "RuntimeError", "(", "arg_4", ")", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "wrap"], "function": "def Func(arg_0):\n    \"\"\"Decorator that prevents callbacks from calling into link methods that\n    are not reentrant \"\"\"\n    def wrap(*arg_1, **arg_2):\n        arg_3 = arg_1[0]\n        if arg_3._callback_lock.in_callback:\n            arg_4 = \"Link %s cannot be invoked from a callback!\" % arg_0\n            raise RuntimeError(arg_4)\n        return arg_0(*arg_1, **arg_2)\n    return wrap", "path": "pyngus/link.py", "identifier": "_not_reentrant", "docstring": "Decorator that prevents callbacks from calling into link methods that\n    are not reentrant", "docstring_tokens": ["Decorator", "that", "prevents", "callbacks", "from", "calling", "into", "link", "methods", "that", "are", "not", "reentrant"], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 252850}
{"url": "https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/views.py#L160-L171", "sha": "7be8b956e53c70b35f34e1783a8fe8f716955afb", "docstring_summary": "Calls pre and post delete hooks for DelteViews.", "language": "python", "parameters": "(self, request, *args, **kwargs)", "return_statement": "return HttpResponseRedirect(success_url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_0", ".", "object", "=", "arg_0", ".", "get_object", "(", ")", "arg_5", "=", "arg_0", ".", "get_success_url", "(", ")", "arg_0", ".", "pre_Func", "(", "arg_0", ".", "object", ")", "arg_0", ".", "object", ".", "Func", "(", ")", "arg_0", ".", "post_Func", "(", "arg_0", ".", "object", ")", "return", "HttpResponseRedirect", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Calls pre and post Func hooks for DelteViews.\n        \"\"\"\n\n        arg_0.object = arg_0.get_object()\n        arg_5 = arg_0.get_success_url()\n        arg_0.pre_Func(arg_0.object)\n        arg_0.object.Func()\n        arg_0.post_Func(arg_0.object)\n\n        return HttpResponseRedirect(arg_5)", "path": "django_baseline/views.py", "identifier": "SaveHookMixin.delete", "docstring": "Calls pre and post delete hooks for DelteViews.", "docstring_tokens": ["Calls", "pre", "and", "post", "delete", "hooks", "for", "DelteViews", "."], "nwo": "theduke/django-baseline", "score": 0.0, "idx": 252851}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/prototypes/jsarray.py#L8-L10", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "Returns Python array from Js array", "language": "python", "parameters": "(this)", "return_statement": "return [this.get(str(e)) for e in xrange(len(this))]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "arg_0", ".", "get", "(", "str", "(", "arg_1", ")", ")", "for", "arg_1", "in", "xrange", "(", "len", "(", "arg_0", ")", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"Returns Python array from Js array\"\"\"\n    return [arg_0.get(str(arg_1)) for arg_1 in xrange(len(arg_0))]", "path": "js2py/prototypes/jsarray.py", "identifier": "to_arr", "docstring": "Returns Python array from Js array", "docstring_tokens": ["Returns", "Python", "array", "from", "Js", "array"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 252852}
{"url": "https://github.com/snjoetw/py-synology/blob/4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f/synology/api.py#L122-L133", "sha": "4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f", "docstring_summary": "Returns the status of Home Mode", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response['data']['on']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_api_info", "[", "'home_mode'", "]", "arg_3", "=", "dict", "(", "{", "'api'", ":", "arg_2", "[", "'name'", "]", ",", "'method'", ":", "'GetInfo'", ",", "'version'", ":", "arg_2", "[", "'version'", "]", ",", "'_sid'", ":", "arg_0", ".", "_sid", "}", ",", "**", "arg_1", ")", "arg_4", "=", "arg_0", ".", "_get_json_with_retry", "(", "arg_2", "[", "'url'", "]", ",", "arg_3", ")", "return", "arg_4", "[", "'data'", "]", "[", "'on'", "]"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Returns the status of Home Mode\"\"\"\n        arg_2 = arg_0._api_info['home_mode']\n        arg_3 = dict({\n            'api': arg_2['name'],\n            'method': 'GetInfo',\n            'version': arg_2['version'],\n            '_sid': arg_0._sid\n        }, **arg_1)\n        arg_4 = arg_0._get_json_with_retry(arg_2['url'], arg_3)\n\n        return arg_4['data']['on']", "path": "synology/api.py", "identifier": "Api.home_mode_status", "docstring": "Returns the status of Home Mode", "docstring_tokens": ["Returns", "the", "status", "of", "Home", "Mode"], "nwo": "snjoetw/py-synology", "score": 0.28899999164266604, "idx": 252853}
{"url": "https://github.com/boakley/robotframework-lint/blob/3e3578f4e39af9af9961aa0a715f146b74474091/rflint/rflint.py#L178-L184", "sha": "3e3578f4e39af9af9961aa0a715f146b74474091", "docstring_summary": "Print a list of all rules", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "sorted", "(", "arg_0", ".", "all_rules", ",", "key", "=", "lambda", "arg_1", ":", "arg_1", ".", "name", ")", ":", "print", "(", "arg_1", ")", "if", "arg_0", ".", "args", ".", "verbose", ":", "for", "arg_2", "in", "arg_1", ".", "doc", ".", "split", "(", "\"\\n\"", ")", ":", "print", "(", "\"    \"", ",", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"Print a list of all rules\"\"\"\n        for arg_1 in sorted(arg_0.all_rules, key=lambda arg_1: arg_1.name):\n            print(arg_1)\n            if arg_0.args.verbose:\n                for arg_2 in arg_1.doc.split(\"\\n\"):\n                    print(\"    \", arg_2)", "path": "rflint/rflint.py", "identifier": "RfLint.list_rules", "docstring": "Print a list of all rules", "docstring_tokens": ["Print", "a", "list", "of", "all", "rules"], "nwo": "boakley/robotframework-lint", "score": 0.9109317500285141, "idx": 252854}
{"url": "https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/legion_examples.py#L99-L106", "sha": "98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0", "docstring_summary": "Not accurate false due to spikes are observed", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "legion_parameters", "(", ")", "arg_0", ".", "teta_x", "=", "-", "1.1", "template_dynamic_legion", "(", "16", ",", "2000", ",", "1500", ",", "conn_type", "=", "conn_type", ".", "GRID_FOUR", ",", "params", "=", "arg_0", ",", "stimulus", "=", "[", "1", ",", "1", ",", "1", ",", "0", ",", "1", ",", "1", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "1", ",", "1", "]", ")"], "function": "def Func():\r\n    \"Not accurate false due to spikes are observed\"\r\n    arg_0 = legion_parameters();\r\n    arg_0.teta_x = -1.1;\r\n    template_dynamic_legion(16, 2000, 1500, conn_type = conn_type.GRID_FOUR, params = arg_0, stimulus = [1, 1, 1, 0, \r\n                                                                                                              1, 1, 1, 0, \r\n                                                                                                              0, 0, 0, 1, \r\n                                                                                                              0, 0, 1, 1]);", "path": "pyclustering/nnet/examples/legion_examples.py", "identifier": "sixteen_oscillator_two_stimulated_ensembles_grid", "docstring": "Not accurate false due to spikes are observed", "docstring_tokens": ["Not", "accurate", "false", "due", "to", "spikes", "are", "observed"], "nwo": "annoviko/pyclustering", "score": 0.7878043568358368, "idx": 252855}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/views.py#L267-L294", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Leave group.", "language": "python", "parameters": "(group_id)", "return_statement": "return redirect(url_for('.index'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Group", ".", "query", ".", "get_or_404", "(", "arg_0", ")", "if", "arg_1", ".", "can_Func", "(", "current_user", ")", ":", "try", ":", "arg_1", ".", "remove_member", "(", "current_user", ")", "except", "Exception", "as", "e", ":", "flash", "(", "str", "(", "e", ")", ",", "\"error\"", ")", "return", "redirect", "(", "url_for", "(", "'.index'", ")", ")", "flash", "(", "_", "(", "'You have successfully left %(group_name)s group.'", ",", "group_name", "=", "arg_1", ".", "name", ")", ",", "'success'", ")", "return", "redirect", "(", "url_for", "(", "'.index'", ")", ")", "flash", "(", "_", "(", "'You cannot Func the group %(group_name)s'", ",", "group_name", "=", "arg_1", ".", "name", ")", ",", "'error'", ")", "return", "redirect", "(", "url_for", "(", "'.index'", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Leave group.\"\"\"\n    arg_1 = Group.query.get_or_404(arg_0)\n\n    if arg_1.can_Func(current_user):\n        try:\n            arg_1.remove_member(current_user)\n        except Exception as e:\n            flash(str(e), \"error\")\n            return redirect(url_for('.index'))\n\n        flash(\n            _(\n                'You have successfully left %(group_name)s group.',\n                group_name=arg_1.name\n            ),\n            'success'\n        )\n        return redirect(url_for('.index'))\n\n    flash(\n        _(\n            'You cannot Func the group %(group_name)s',\n            group_name=arg_1.name\n        ),\n        'error'\n    )\n    return redirect(url_for('.index'))", "path": "invenio_groups/views.py", "identifier": "leave", "docstring": "Leave group.", "docstring_tokens": ["Leave", "group", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 252856}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/message_factory.py#L93-L116", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Returns a message that will display a set of attachments in list form.", "language": "python", "parameters": "(attachments: List[Attachment], text: str = None, speak: str = None,\n             input_hint: Union[InputHints, str] = None)", "return_statement": "return attachment_activity(AttachmentLayoutTypes.list, attachments, text, speak, input_hint)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "arg_3", ":", "arg_4", "=", "None", ",", "arg_5", ":", "arg_4", "=", "None", ",", "arg_6", ":", "arg_7", "[", "arg_8", ",", "arg_4", "]", "=", "None", ")", "->", "Activity", ":", "return", "attachment_activity", "(", "AttachmentLayoutTypes", ".", "Func", ",", "arg_0", ",", "arg_3", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0: arg_1[arg_2], arg_3: arg_4 = None, arg_5: arg_4 = None,\n             arg_6: arg_7[arg_8, arg_4] = None) -> Activity:\n        \"\"\"\n        Returns a message that will display a set of attachments in Func form.\n\n        :Example:\n        message = MessageFactory.Func([CardFactory.hero_card(HeroCard(title='title1',\n                                                             images=[CardImage(url='imageUrl1')],\n                                                             buttons=[CardAction(title='button1')])),\n                                       CardFactory.hero_card(HeroCard(title='title2',\n                                                             images=[CardImage(url='imageUrl2')],\n                                                             buttons=[CardAction(title='button2')])),\n                                       CardFactory.hero_card(HeroCard(title='title3',\n                                                             images=[CardImage(url='imageUrl3')],\n                                                             buttons=[CardAction(title='button3')]))])\n        await context.send_activity(message)\n\n        :param attachments:\n        :param text:\n        :param speak:\n        :param input_hint:\n        :return:\n        \"\"\"\n        return attachment_activity(AttachmentLayoutTypes.Func, arg_0, arg_3, arg_5, arg_6)", "path": "libraries/botbuilder-core/botbuilder/core/message_factory.py", "identifier": "MessageFactory.list", "docstring": "Returns a message that will display a set of attachments in list form.\n\n        :Example:\n        message = MessageFactory.list([CardFactory.hero_card(HeroCard(title='title1',\n                                                             images=[CardImage(url='imageUrl1')],\n                                                             buttons=[CardAction(title='button1')])),\n                                       CardFactory.hero_card(HeroCard(title='title2',\n                                                             images=[CardImage(url='imageUrl2')],\n                                                             buttons=[CardAction(title='button2')])),\n                                       CardFactory.hero_card(HeroCard(title='title3',\n                                                             images=[CardImage(url='imageUrl3')],\n                                                             buttons=[CardAction(title='button3')]))])\n        await context.send_activity(message)\n\n        :param attachments:\n        :param text:\n        :param speak:\n        :param input_hint:\n        :return:", "docstring_tokens": ["Returns", "a", "message", "that", "will", "display", "a", "set", "of", "attachments", "in", "list", "form", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 252857}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/portItem.py#L20-L44", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Connect to port item on subunit", "language": "python", "parameters": "(self, signal)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "direction", "==", "DIRECTION", ".", "IN", ":", "if", "arg_0", ".", "src", "is", "not", "None", ":", "raise", "HwtSyntaxError", "(", "\"Port %s is already associated with %r\"", "%", "(", "arg_0", ".", "name", ",", "arg_0", ".", "src", ")", ")", "arg_0", ".", "src", "=", "arg_1", "arg_1", ".", "endpoints", ".", "append", "(", "arg_0", ")", "elif", "arg_0", ".", "direction", "==", "DIRECTION", ".", "OUT", ":", "if", "arg_0", ".", "dst", "is", "not", "None", ":", "raise", "HwtSyntaxError", "(", "\"Port %s is already associated with %r\"", "%", "(", "arg_0", ".", "name", ",", "arg_0", ".", "dst", ")", ")", "arg_0", ".", "dst", "=", "arg_1", "arg_1", ".", "drivers", ".", "append", "(", "arg_0", ")", "else", ":", "raise", "NotImplementedError", "(", "arg_0", ")", "arg_1", ".", "hidden", "=", "False", "arg_1", ".", "ctx", ".", "subUnits", ".", "add", "(", "arg_0", ".", "unit", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Connect to port item on subunit\n        \"\"\"\n        if arg_0.direction == DIRECTION.IN:\n            if arg_0.src is not None:\n                raise HwtSyntaxError(\n                    \"Port %s is already associated with %r\"\n                    % (arg_0.name, arg_0.src))\n            arg_0.src = arg_1\n            arg_1.endpoints.append(arg_0)\n\n        elif arg_0.direction == DIRECTION.OUT:\n            if arg_0.dst is not None:\n                raise HwtSyntaxError(\n                    \"Port %s is already associated with %r\"\n                    % (arg_0.name, arg_0.dst))\n            arg_0.dst = arg_1\n            arg_1.drivers.append(arg_0)\n\n        else:\n            raise NotImplementedError(arg_0)\n\n        arg_1.hidden = False\n        arg_1.ctx.subUnits.add(arg_0.unit)", "path": "hwt/hdl/portItem.py", "identifier": "PortItem.connectSig", "docstring": "Connect to port item on subunit", "docstring_tokens": ["Connect", "to", "port", "item", "on", "subunit"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252858}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/utils/timer.py#L21-L27", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Report elapsed time.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "end_time", ":", "arg_0", ".", "end", "(", ")", "print", "(", "\"Time: {} mins\"", ".", "format", "(", "(", "arg_0", ".", "end_time", "-", "arg_0", ".", "start_time", ")", "/", "60", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Report elapsed time.\n        \"\"\"\n        if not arg_0.end_time:\n            arg_0.end()\n        print (\"Time: {} mins\".format((arg_0.end_time - arg_0.start_time )/ 60))", "path": "deepy/utils/timer.py", "identifier": "Timer.report", "docstring": "Report elapsed time.", "docstring_tokens": ["Report", "elapsed", "time", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 252859}
{"url": "https://github.com/zvoase/django-relax/blob/10bb37bf3a512b290816856a6877c17fa37e930f/relax/couchdb/__init__.py#L71-L97", "sha": "10bb37bf3a512b290816856a6877c17fa37e930f", "docstring_summary": "Return the database specifier for a database string.\n    \n    This accepts a database name or URL, and returns a database specifier in the\n    format accepted by ``specifier_to_db``. It is recommended that you consult\n    the documentation for that function for an explanation of the format.", "language": "python", "parameters": "(db_string)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "PLAIN_RE", ".", "match", "(", "arg_0", ")", "arg_2", "=", "URL_RE", ".", "match", "(", "arg_0", ")", "if", "arg_1", ":", "return", "'local:'", "+", "arg_1", ".", "groupdict", "(", ")", "[", "'database'", "]", "elif", "arg_2", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "map", "(", "arg_2", ".", "groupdict", "(", ")", ".", "get", ",", "(", "'hostname'", ",", "'portnum'", ",", "'database'", ")", ")", "arg_6", "=", "settings", ".", "_", "(", "'COUCHDB_SERVER'", ",", "'http://127.0.0.1:5984/'", ")", "arg_7", ",", "arg_8", "=", "urlparse", ".", "urlparse", "(", "arg_6", ")", "[", "1", "]", ".", "split", "(", "':'", ")", "if", "(", "arg_7", "==", "arg_3", ")", "and", "(", "arg_8", "==", "arg_4", ")", ":", "return", "'local:'", "+", "arg_5", "return", "'remote:%s:%s:%s'", "%", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", "raise", "ValueError", "(", "'Invalid database string: %r'", "%", "(", "arg_0", ",", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Return the database specifier for a database string.\n    \n    This accepts a database name or URL, and returns a database specifier in the\n    format accepted by ``specifier_to_db``. It is recommended that you consult\n    the documentation for that function for an explanation of the format.\n    \"\"\"\n    arg_1 = PLAIN_RE.match(arg_0)\n    arg_2 = URL_RE.match(arg_0)\n    # If this looks like a local specifier:\n    if arg_1:\n        return 'local:' + arg_1.groupdict()['database']\n    # If this looks like a remote specifier:\n    elif arg_2:\n        # Just a fancy way of getting 3 variables in 2 lines...\n        arg_3, arg_4, arg_5 = map(arg_2.groupdict().get,\n            ('hostname', 'portnum', 'database'))\n        arg_6 = settings._('COUCHDB_SERVER', 'http://127.0.0.1:5984/')\n        arg_7, arg_8 = urlparse.urlparse(arg_6)[1].split(':')\n        # If it's the local server, then return a local specifier.\n        if (arg_7 == arg_3) and (arg_8 == arg_4):\n            return 'local:' + arg_5\n        # Otherwise, prepare and return the remote specifier.\n        return 'remote:%s:%s:%s' % (arg_3, arg_4, arg_5)\n    # Throw a wobbly.\n    raise ValueError('Invalid database string: %r' % (arg_0,))", "path": "relax/couchdb/__init__.py", "identifier": "db_to_specifier", "docstring": "Return the database specifier for a database string.\n    \n    This accepts a database name or URL, and returns a database specifier in the\n    format accepted by ``specifier_to_db``. It is recommended that you consult\n    the documentation for that function for an explanation of the format.", "docstring_tokens": ["Return", "the", "database", "specifier", "for", "a", "database", "string", ".", "This", "accepts", "a", "database", "name", "or", "URL", "and", "returns", "a", "database", "specifier", "in", "the", "format", "accepted", "by", "specifier_to_db", ".", "It", "is", "recommended", "that", "you", "consult", "the", "documentation", "for", "that", "function", "for", "an", "explanation", "of", "the", "format", "."], "nwo": "zvoase/django-relax", "score": 0.0, "idx": 252860}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/www/decorators.py#L29-L58", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Decorator to log user actions", "language": "python", "parameters": "(f)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "with", "create_session", "(", ")", "as", "session", ":", "if", "g", ".", "user", ".", "is_anonymous", ":", "arg_3", "=", "'anonymous'", "else", ":", "arg_3", "=", "g", ".", "user", ".", "username", "arg_4", "=", "Log", "(", "event", "=", "arg_0", ".", "__name__", ",", "task_instance", "=", "None", ",", "owner", "=", "arg_3", ",", "extra", "=", "str", "(", "list", "(", "request", ".", "args", ".", "items", "(", ")", ")", ")", ",", "task_id", "=", "request", ".", "args", ".", "get", "(", "'task_id'", ")", ",", "dag_id", "=", "request", ".", "args", ".", "get", "(", "'dag_id'", ")", ")", "if", "'execution_date'", "in", "request", ".", "args", ":", "arg_4", ".", "execution_date", "=", "pendulum", ".", "parse", "(", "request", ".", "args", ".", "get", "(", "'execution_date'", ")", ")", "session", ".", "add", "(", "arg_4", ")", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator to log user actions\n    \"\"\"\n    @functools.wraps(arg_0)\n    def wrapper(*arg_1, **arg_2):\n\n        with create_session() as session:\n            if g.user.is_anonymous:\n                arg_3 = 'anonymous'\n            else:\n                arg_3 = g.user.username\n\n            arg_4 = Log(\n                event=arg_0.__name__,\n                task_instance=None,\n                owner=arg_3,\n                extra=str(list(request.args.items())),\n                task_id=request.args.get('task_id'),\n                dag_id=request.args.get('dag_id'))\n\n            if 'execution_date' in request.args:\n                arg_4.execution_date = pendulum.parse(\n                    request.args.get('execution_date'))\n\n            session.add(arg_4)\n\n        return arg_0(*arg_1, **arg_2)\n\n    return wrapper", "path": "airflow/www/decorators.py", "identifier": "action_logging", "docstring": "Decorator to log user actions", "docstring_tokens": ["Decorator", "to", "log", "user", "actions"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252861}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L3365-L3399", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Remove padding.", "language": "python", "parameters": "(sequences, pad_id=0)", "return_statement": "return sequences_out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "copy", ".", "deepcopy", "(", "arg_0", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", ":", "for", "arg_5", "in", "range", "(", "1", ",", "len", "(", "arg_0", "[", "arg_3", "]", ")", ")", ":", "if", "arg_0", "[", "arg_3", "]", "[", "-", "arg_5", "]", "!=", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "arg_2", "[", "arg_3", "]", "[", "0", ":", "-", "arg_5", "+", "1", "]", "break", "return", "arg_2"], "function": "def Func(arg_0, arg_1=0):\n    \"\"\"Remove padding.\n\n    Parameters\n    -----------\n    sequences : list of list of int\n        All sequences where each row is a sequence.\n    pad_id : int\n        The pad ID.\n\n    Returns\n    ----------\n    list of list of int\n        The processed sequences.\n\n    Examples\n    ----------\n    >>> sequences = [[2,3,4,0,0], [5,1,2,3,4,0,0,0], [4,5,0,2,4,0,0,0]]\n    >>> print(Func(sequences, pad_id=0))\n    [[2, 3, 4], [5, 1, 2, 3, 4], [4, 5, 0, 2, 4]]\n\n    \"\"\"\n    arg_2 = copy.deepcopy(arg_0)\n\n    for arg_3, arg_4 in enumerate(arg_0):\n        # for j in range(len(sequences[i])):\n        #     if sequences[i][j] == pad_id:\n        #         sequences_out[i] = sequences_out[i][:j]\n        #         break\n        for arg_5 in range(1, len(arg_0[arg_3])):\n            if arg_0[arg_3][-arg_5] != arg_1:\n                arg_2[arg_3] = arg_2[arg_3][0:-arg_5 + 1]\n                break\n\n    return arg_2", "path": "tensorlayer/prepro.py", "identifier": "remove_pad_sequences", "docstring": "Remove padding.\n\n    Parameters\n    -----------\n    sequences : list of list of int\n        All sequences where each row is a sequence.\n    pad_id : int\n        The pad ID.\n\n    Returns\n    ----------\n    list of list of int\n        The processed sequences.\n\n    Examples\n    ----------\n    >>> sequences = [[2,3,4,0,0], [5,1,2,3,4,0,0,0], [4,5,0,2,4,0,0,0]]\n    >>> print(remove_pad_sequences(sequences, pad_id=0))\n    [[2, 3, 4], [5, 1, 2, 3, 4], [4, 5, 0, 2, 4]]", "docstring_tokens": ["Remove", "padding", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 252862}
{"url": "https://github.com/rbw/flask-journey/blob/6181f59a7b5eef6a85b86ce6ed7d03c91f6bd285/flask_journey/journey.py#L100-L111", "sha": "6181f59a7b5eef6a85b86ce6ed7d03c91f6bd285", "docstring_summary": "Checks if a bundle exists at the provided path", "language": "python", "parameters": "(self, path)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "_attached_bundles", ":", "if", "arg_1", "==", "arg_2", ".", "path", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Checks if a bundle exists at the provided path\n\n        :param path: Bundle path\n        :return: bool\n        \"\"\"\n\n        for arg_2 in arg_0._attached_bundles:\n            if arg_1 == arg_2.path:\n                return True\n\n        return False", "path": "flask_journey/journey.py", "identifier": "Journey._bundle_exists", "docstring": "Checks if a bundle exists at the provided path\n\n        :param path: Bundle path\n        :return: bool", "docstring_tokens": ["Checks", "if", "a", "bundle", "exists", "at", "the", "provided", "path"], "nwo": "rbw/flask-journey", "score": 0.1903525543429651, "idx": 252863}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/util.py#L31-L41", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Much like the built-in function range, but accepts floats", "language": "python", "parameters": "(start=0, stop=None, step=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "1", ")", ":", "arg_0", "=", "float", "(", "arg_0", ")", "while", "arg_0", "<", "arg_1", ":", "yield", "arg_0", "arg_0", "+=", "arg_2"], "function": "def Func(arg_0=0, arg_1=None, arg_2=1):\n\t\"\"\"\n\tMuch like the built-in function range, but accepts floats\n\n\t>>> tuple(Func(0, 9, 1.5))\n\t(0.0, 1.5, 3.0, 4.5, 6.0, 7.5)\n\t\"\"\"\n\targ_0 = float(arg_0)\n\twhile arg_0 < arg_1:\n\t\tyield arg_0\n\t\targ_0 += arg_2", "path": "svg/charts/util.py", "identifier": "float_range", "docstring": "Much like the built-in function range, but accepts floats\n\n\t>>> tuple(float_range(0, 9, 1.5))\n\t(0.0, 1.5, 3.0, 4.5, 6.0, 7.5)", "docstring_tokens": ["Much", "like", "the", "built", "-", "in", "function", "range", "but", "accepts", "floats"], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 252864}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L543-L557", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Save a model to protobuf files so that it can be used in tensorflow inference.", "language": "python", "parameters": "(self, inputs, path, byte_order=\"little_endian\", data_format=\"nhwc\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"little_endian\"", ",", "arg_4", "=", "\"nhwc\"", ")", ":", "callBigDlFunc", "(", "arg_0", ".", "bigdl_type", ",", "\"saveTF\"", ",", "arg_0", ".", "value", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=\"little_endian\", arg_4=\"nhwc\"):\n        \"\"\"\n        Save a model to protobuf files so that it can be used in tensorflow inference.\n\n        When saving the model, placeholders will be added to the tf model as input nodes. So\n        you need to pass in the names and shapes of the placeholders. BigDL model doesn't have\n        such information. The order of the placeholder information should be same as the inputs\n        of the graph model.\n        :param inputs: placeholder information, should be an array of tuples (input_name, shape)\n                       where 'input_name' is a string and shape is an array of integer\n        :param path: the path to be saved to\n        :param byte_order: model byte order\n        :param data_format: model data format, should be \"nhwc\" or \"nchw\"\n        \"\"\"\n        callBigDlFunc(arg_0.bigdl_type, \"saveTF\", arg_0.value, arg_1, arg_2, arg_3, arg_4)", "path": "pyspark/bigdl/nn/layer.py", "identifier": "Layer.save_tensorflow", "docstring": "Save a model to protobuf files so that it can be used in tensorflow inference.\n\n        When saving the model, placeholders will be added to the tf model as input nodes. So\n        you need to pass in the names and shapes of the placeholders. BigDL model doesn't have\n        such information. The order of the placeholder information should be same as the inputs\n        of the graph model.\n        :param inputs: placeholder information, should be an array of tuples (input_name, shape)\n                       where 'input_name' is a string and shape is an array of integer\n        :param path: the path to be saved to\n        :param byte_order: model byte order\n        :param data_format: model data format, should be \"nhwc\" or \"nchw\"", "docstring_tokens": ["Save", "a", "model", "to", "protobuf", "files", "so", "that", "it", "can", "be", "used", "in", "tensorflow", "inference", "."], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 252865}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-reservations/azure/mgmt/reservations/operations/reservation_operations.py#L194-L243", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Merges two `Reservation`s.", "language": "python", "parameters": "(\n            self, reservation_order_id, sources=None, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "True", ",", "**", "arg_6", ")", ":", "arg_7", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "True", ",", "**", "arg_6", ")", "def", "get_long_running_output", "(", "arg_8", ")", ":", "arg_9", "=", "arg_0", ".", "_deserialize", "(", "'[ReservationResponse]'", ",", "arg_8", ")", "if", "arg_4", ":", "arg_10", "=", "ClientRawResponse", "(", "arg_9", ",", "arg_8", ")", "return", "arg_10", "return", "arg_9", "arg_11", "=", "arg_6", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_5", "is", "True", ":", "arg_12", "=", "ARMPolling", "(", "arg_11", ",", "**", "arg_6", ")", "elif", "arg_5", "is", "False", ":", "arg_12", "=", "NoPolling", "(", ")", "else", ":", "arg_12", "=", "arg_5", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_7", ",", "get_long_running_output", ",", "arg_12", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False, arg_5=True, **arg_6):\n        \"\"\"Merges two `Reservation`s.\n\n        Merge the specified `Reservation`s into a new `Reservation`. The two\n        `Reservation`s being Funcd must have same properties.\n\n        :param reservation_order_id: Order Id of the reservation\n        :type reservation_order_id: str\n        :param sources: Format of the resource id should be\n         /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}\n        :type sources: list[str]\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns list or\n         ClientRawResponse<list> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.reservations.models.ReservationResponse]]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.reservations.models.ReservationResponse]]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.reservations.models.ErrorException>`\n        \"\"\"\n        arg_7 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=True,\n            **arg_6\n        )\n\n        def get_long_running_output(arg_8):\n            arg_9 = arg_0._deserialize('[ReservationResponse]', arg_8)\n\n            if arg_4:\n                arg_10 = ClientRawResponse(arg_9, arg_8)\n                return arg_10\n\n            return arg_9\n\n        arg_11 = arg_6.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_5 is True: arg_12 = ARMPolling(arg_11, **arg_6)\n        elif arg_5 is False: arg_12 = NoPolling()\n        else: arg_12 = arg_5\n        return LROPoller(arg_0._client, arg_7, get_long_running_output, arg_12)", "path": "azure-mgmt-reservations/azure/mgmt/reservations/operations/reservation_operations.py", "identifier": "ReservationOperations.merge", "docstring": "Merges two `Reservation`s.\n\n        Merge the specified `Reservation`s into a new `Reservation`. The two\n        `Reservation`s being merged must have same properties.\n\n        :param reservation_order_id: Order Id of the reservation\n        :type reservation_order_id: str\n        :param sources: Format of the resource id should be\n         /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}\n        :type sources: list[str]\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns list or\n         ClientRawResponse<list> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.reservations.models.ReservationResponse]]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.reservations.models.ReservationResponse]]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.reservations.models.ErrorException>`", "docstring_tokens": ["Merges", "two", "Reservation", "s", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252866}
{"url": "https://github.com/laplacesdemon/django-youtube/blob/8051ef372473eccb053f773c68e2e5e1b2cfb538/django_youtube/api.py#L223-L247", "sha": "8051ef372473eccb053f773c68e2e5e1b2cfb538", "docstring_summary": "Checks the video upload status\n        Newly uploaded videos may be in the processing state", "language": "python", "parameters": "(self, video_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "authenticated", ":", "raise", "ApiError", "(", "_", "(", "\"Authentication is required\"", ")", ")", "arg_2", "=", "arg_0", ".", "fetch_video", "(", "arg_1", ")", "arg_3", "=", "Api", ".", "yt_service", ".", "CheckUploadStatus", "(", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "arg_3", "[", "0", "]", "arg_5", "=", "arg_3", "[", "1", "]", "return", "{", "\"upload_state\"", ":", "arg_4", ",", "\"detailed_message\"", ":", "arg_5", "}", "else", ":", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Checks the video upload status\n        Newly uploaded videos may be in the processing state\n\n        Authentication is required\n\n        Returns:\n            True if video is available\n            otherwise a dict containes upload_state and detailed message\n            i.e. {\"upload_state\": \"processing\", \"detailed_message\": \"\"}\n        \"\"\"\n        # Raise ApiError if not authenticated\n        if not arg_0.authenticated:\n            raise ApiError(_(\"Authentication is required\"))\n\n        arg_2 = arg_0.fetch_video(arg_1)\n        arg_3 = Api.yt_service.CheckUploadStatus(arg_2)\n\n        if arg_3 is not None:\n            arg_4 = arg_3[0]\n            arg_5 = arg_3[1]\n            return {\"upload_state\": arg_4, \"detailed_message\": arg_5}\n        else:\n            return True", "path": "django_youtube/api.py", "identifier": "Api.check_upload_status", "docstring": "Checks the video upload status\n        Newly uploaded videos may be in the processing state\n\n        Authentication is required\n\n        Returns:\n            True if video is available\n            otherwise a dict containes upload_state and detailed message\n            i.e. {\"upload_state\": \"processing\", \"detailed_message\": \"\"}", "docstring_tokens": ["Checks", "the", "video", "upload", "status", "Newly", "uploaded", "videos", "may", "be", "in", "the", "processing", "state"], "nwo": "laplacesdemon/django-youtube", "score": 0.19379564659824008, "idx": 252867}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2022-L2049", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Get CAs whose certificates are suggested for client authentication.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_lib", ".", "SSL_get_client_CA_list", "(", "arg_0", ".", "_ssl", ")", "if", "arg_1", "==", "_ffi", ".", "NULL", ":", "return", "[", "]", "arg_2", "=", "[", "]", "for", "arg_3", "in", "range", "(", "_lib", ".", "sk_X509_NAME_num", "(", "arg_1", ")", ")", ":", "arg_4", "=", "_lib", ".", "sk_X509_NAME_value", "(", "arg_1", ",", "arg_3", ")", "arg_5", "=", "_lib", ".", "X509_NAME_dup", "(", "arg_4", ")", "_openssl_assert", "(", "arg_5", "!=", "_ffi", ".", "NULL", ")", "arg_6", "=", "X509Name", ".", "__new__", "(", "X509Name", ")", "arg_6", ".", "_name", "=", "_ffi", ".", "gc", "(", "arg_5", ",", "_lib", ".", "X509_NAME_free", ")", "arg_2", ".", "append", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Get CAs whose certificates are suggested for client authentication.\n\n        :return: If this is a server connection, the list of certificate\n            authorities that will be sent or has been sent to the client, as\n            controlled by this :class:`Connection`'s :class:`Context`.\n\n            If this is a client connection, the list will be empty until the\n            connection with the server is established.\n\n        .. versionadded:: 0.10\n        \"\"\"\n        arg_1 = _lib.SSL_get_client_CA_list(arg_0._ssl)\n        if arg_1 == _ffi.NULL:\n            # TODO: This is untested.\n            return []\n\n        arg_2 = []\n        for arg_3 in range(_lib.sk_X509_NAME_num(arg_1)):\n            arg_4 = _lib.sk_X509_NAME_value(arg_1, arg_3)\n            arg_5 = _lib.X509_NAME_dup(arg_4)\n            _openssl_assert(arg_5 != _ffi.NULL)\n\n            arg_6 = X509Name.__new__(X509Name)\n            arg_6._name = _ffi.gc(arg_5, _lib.X509_NAME_free)\n            arg_2.append(arg_6)\n        return arg_2", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.get_client_ca_list", "docstring": "Get CAs whose certificates are suggested for client authentication.\n\n        :return: If this is a server connection, the list of certificate\n            authorities that will be sent or has been sent to the client, as\n            controlled by this :class:`Connection`'s :class:`Context`.\n\n            If this is a client connection, the list will be empty until the\n            connection with the server is established.\n\n        .. versionadded:: 0.10", "docstring_tokens": ["Get", "CAs", "whose", "certificates", "are", "suggested", "for", "client", "authentication", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 252868}
{"url": "https://github.com/bmaeser/pyque/blob/856dceab8d89cf3771cf21e682466c29a85ae8eb/pyque/sh.py#L82-L91", "sha": "856dceab8d89cf3771cf21e682466c29a85ae8eb", "docstring_summary": "alternative to os.", "language": "python", "parameters": "(path, mode, recursive=True)", "return_statement": "return sh(cmd)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "arg_2", ":", "arg_3", "=", "'Func -R %s %s'", "%", "(", "arg_1", ",", "arg_0", ")", "else", ":", "arg_3", "=", "'Func %s %s'", "%", "(", "arg_1", ",", "arg_0", ")", "return", "sh", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\" alternative to os.\n    \"\"\"\n\n    if arg_2:\n        arg_3 = 'Func -R %s %s' % (arg_1, arg_0)\n    else:\n        arg_3 = 'Func %s %s' % (arg_1, arg_0)\n\n    return sh(arg_3)", "path": "pyque/sh.py", "identifier": "chmod", "docstring": "alternative to os.", "docstring_tokens": ["alternative", "to", "os", "."], "nwo": "bmaeser/pyque", "score": 0.09252797783733271, "idx": 252869}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/blockchain.py#L250-L273", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Returns the transaction as seen by the blockchain after being\n            included into a block", "language": "python", "parameters": "(self, transaction, limit=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "10", ")", ":", "arg_3", "=", "10", "for", "arg_4", "in", "arg_0", ".", "blocks", "(", ")", ":", "arg_3", "+=", "1", "for", "arg_5", "in", "arg_4", "[", "\"transactions\"", "]", ":", "if", "sorted", "(", "arg_5", "[", "\"signatures\"", "]", ")", "==", "sorted", "(", "arg_1", "[", "\"signatures\"", "]", ")", ":", "return", "arg_5", "if", "arg_3", ">", "arg_2", ":", "raise", "Exception", "(", "\"The operation has not been added after 10 blocks!\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=10):\n        \"\"\" Returns the transaction as seen by the blockchain after being\n            included into a block\n\n            .. note:: If you want instant confirmation, you need to instantiate\n                      class:`.blockchain.Blockchain` with\n                      ``mode=\"head\"``, otherwise, the call will wait until\n                      confirmed in an irreversible block.\n\n            .. note:: This method returns once the blockchain has included a\n                      transaction with the **same signature**. Even though the\n                      signature is not usually used to identify a transaction,\n                      it still cannot be forfeited and is derived from the\n                      transaction contented and thus identifies a transaction\n                      uniquely.\n        \"\"\"\n        arg_3 = 10\n        for arg_4 in arg_0.blocks():\n            arg_3 += 1\n            for arg_5 in arg_4[\"transactions\"]:\n                if sorted(arg_5[\"signatures\"]) == sorted(arg_1[\"signatures\"]):\n                    return arg_5\n            if arg_3 > arg_2:\n                raise Exception(\"The operation has not been added after 10 blocks!\")", "path": "graphenecommon/blockchain.py", "identifier": "Blockchain.awaitTxConfirmation", "docstring": "Returns the transaction as seen by the blockchain after being\n            included into a block\n\n            .. note:: If you want instant confirmation, you need to instantiate\n                      class:`.blockchain.Blockchain` with\n                      ``mode=\"head\"``, otherwise, the call will wait until\n                      confirmed in an irreversible block.\n\n            .. note:: This method returns once the blockchain has included a\n                      transaction with the **same signature**. Even though the\n                      signature is not usually used to identify a transaction,\n                      it still cannot be forfeited and is derived from the\n                      transaction contented and thus identifies a transaction\n                      uniquely.", "docstring_tokens": ["Returns", "the", "transaction", "as", "seen", "by", "the", "blockchain", "after", "being", "included", "into", "a", "block"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 252870}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L275-L318", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This uploads a file to S3.", "language": "python", "parameters": "(local_file, bucket, client=None, raiseonfail=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "boto3", ".", "client", "(", "'s3'", ")", "try", ":", "arg_2", ".", "upload_file", "(", "arg_0", ",", "arg_1", ",", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ")", "return", "'s3://%s/%s'", "%", "(", "arg_1", ",", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ")", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'could not upload %s to bucket: %s'", "%", "(", "arg_0", ",", "arg_1", ")", ")", "if", "arg_3", ":", "raise", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n    \"\"\"This uploads a file to S3.\n\n    Parameters\n    ----------\n\n    local_file : str\n        Path to the file to upload to S3.\n\n    bucket : str\n        The AWS S3 bucket to upload the file to.\n\n    client : boto3.Client or None\n        If None, this function will instantiate a new `boto3.Client` object to\n        use in its operations. Alternatively, pass in an existing `boto3.Client`\n        instance to re-use it here.\n\n    raiseonfail : bool\n        If True, will re-raise whatever Exception caused the operation to fail\n        and break out immediately.\n\n    Returns\n    -------\n\n    str or None\n        If the file upload is successful, returns the s3:// URL of the uploaded\n        file. If it failed, will return None.\n\n    \"\"\"\n\n    if not arg_2:\n        arg_2 = boto3.client('s3')\n\n    try:\n        arg_2.upload_file(arg_0, arg_1, os.path.basename(arg_0))\n        return 's3://%s/%s' % (arg_1, os.path.basename(arg_0))\n    except Exception as e:\n        LOGEXCEPTION('could not upload %s to bucket: %s' % (arg_0,\n                                                            arg_1))\n\n        if arg_3:\n            raise\n\n        return None", "path": "astrobase/awsutils.py", "identifier": "s3_put_file", "docstring": "This uploads a file to S3.\n\n    Parameters\n    ----------\n\n    local_file : str\n        Path to the file to upload to S3.\n\n    bucket : str\n        The AWS S3 bucket to upload the file to.\n\n    client : boto3.Client or None\n        If None, this function will instantiate a new `boto3.Client` object to\n        use in its operations. Alternatively, pass in an existing `boto3.Client`\n        instance to re-use it here.\n\n    raiseonfail : bool\n        If True, will re-raise whatever Exception caused the operation to fail\n        and break out immediately.\n\n    Returns\n    -------\n\n    str or None\n        If the file upload is successful, returns the s3:// URL of the uploaded\n        file. If it failed, will return None.", "docstring_tokens": ["This", "uploads", "a", "file", "to", "S3", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252871}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/normalization_layers.py#L9-L61", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert batch normalization layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting batchnorm ...'", ")", "if", "arg_6", "==", "'short'", ":", "arg_7", "=", "'BN'", "+", "random_string", "(", "6", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_8", "=", "'{0}.bias'", ".", "format", "(", "arg_1", ")", "arg_9", "=", "'{0}.weight'", ".", "format", "(", "arg_1", ")", "arg_10", "=", "'{0}.running_mean'", ".", "format", "(", "arg_1", ")", "arg_11", "=", "'{0}.running_var'", ".", "format", "(", "arg_1", ")", "if", "arg_8", "in", "arg_5", ":", "arg_12", "=", "arg_5", "[", "arg_8", "]", ".", "numpy", "(", ")", "if", "arg_9", "in", "arg_5", ":", "arg_13", "=", "arg_5", "[", "arg_9", "]", ".", "numpy", "(", ")", "arg_14", "=", "arg_5", "[", "arg_10", "]", ".", "numpy", "(", ")", "arg_15", "=", "arg_5", "[", "arg_11", "]", ".", "numpy", "(", ")", "arg_16", "=", "arg_0", "[", "'epsilon'", "]", "arg_17", "=", "arg_0", "[", "'momentum'", "]", "if", "arg_9", "not", "in", "arg_5", ":", "arg_18", "=", "keras", ".", "layers", ".", "BatchNormalization", "(", "axis", "=", "1", ",", "arg_17", "=", "arg_17", ",", "epsilon", "=", "arg_16", ",", "center", "=", "False", ",", "scale", "=", "False", ",", "arg_5", "=", "[", "arg_14", ",", "arg_15", "]", ",", "name", "=", "arg_7", ")", "else", ":", "arg_18", "=", "keras", ".", "layers", ".", "BatchNormalization", "(", "axis", "=", "1", ",", "arg_17", "=", "arg_17", ",", "epsilon", "=", "arg_16", ",", "arg_5", "=", "[", "arg_13", ",", "arg_12", ",", "arg_14", ",", "arg_15", "]", ",", "name", "=", "arg_7", ")", "arg_4", "[", "arg_2", "]", "=", "arg_18", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert batch normalization layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting batchnorm ...')\n\n    if arg_6 == 'short':\n        arg_7 = 'BN' + random_string(6)\n    elif arg_6 == 'keep':\n        arg_7 = arg_1\n    else:\n        arg_7 = arg_1 + str(random.random())\n\n    arg_8 = '{0}.bias'.format(arg_1)\n    arg_9 = '{0}.weight'.format(arg_1)\n    arg_10 = '{0}.running_mean'.format(arg_1)\n    arg_11 = '{0}.running_var'.format(arg_1)\n\n    if arg_8 in arg_5:\n        arg_12 = arg_5[arg_8].numpy()\n\n    if arg_9 in arg_5:\n        arg_13 = arg_5[arg_9].numpy()\n\n    arg_14 = arg_5[arg_10].numpy()\n    arg_15 = arg_5[arg_11].numpy()\n\n    arg_16 = arg_0['epsilon']\n    arg_17 = arg_0['momentum']\n\n    if arg_9 not in arg_5:\n        arg_18 = keras.layers.BatchNormalization(\n            axis=1, arg_17=arg_17, epsilon=arg_16,\n            center=False, scale=False,\n            arg_5=[arg_14, arg_15],\n            name=arg_7\n        )\n    else:\n        arg_18 = keras.layers.BatchNormalization(\n            axis=1, arg_17=arg_17, epsilon=arg_16,\n            arg_5=[arg_13, arg_12, arg_14, arg_15],\n            name=arg_7\n        )\n    arg_4[arg_2] = arg_18(arg_4[arg_3[0]])", "path": "pytorch2keras/normalization_layers.py", "identifier": "convert_batchnorm", "docstring": "Convert batch normalization layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "batch", "normalization", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 252872}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/utils.py#L114-L123", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Signal the start of the process.", "language": "python", "parameters": "(self, total)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "logger", ".", "info", "(", "json", ".", "dumps", "(", "[", "'START'", ",", "arg_0", ".", "name", ",", "arg_1", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Signal the Func of the process.\n\n        Parameters\n        ----------\n        total : int\n            The total number of steps in the process, or None if unknown.\n        '''\n        arg_0.logger.info(json.dumps(['START', arg_0.name, arg_1]))", "path": "skl_groups/utils.py", "identifier": "ProgressLogger.start", "docstring": "Signal the start of the process.\n\n        Parameters\n        ----------\n        total : int\n            The total number of steps in the process, or None if unknown.", "docstring_tokens": ["Signal", "the", "start", "of", "the", "process", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 252873}
{"url": "https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/formsets.py#L264-L269", "sha": "188e1bf1f15a44d9a599028d020083af9fb43ea7", "docstring_summary": "Handles GET requests and instantiates a blank version of the formset.", "language": "python", "parameters": "(self, request, *args, **kwargs)", "return_statement": "return self.render_to_response(self.get_context_data(formset=formset))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "construct_formset", "(", ")", "return", "arg_0", ".", "render_to_response", "(", "arg_0", ".", "Func_context_data", "(", "arg_4", "=", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Handles GET requests and instantiates a blank version of the formset.\n        \"\"\"\n        arg_4 = arg_0.construct_formset()\n        return arg_0.render_to_response(arg_0.Func_context_data(arg_4=arg_4))", "path": "extra_views/formsets.py", "identifier": "ProcessFormSetView.get", "docstring": "Handles GET requests and instantiates a blank version of the formset.", "docstring_tokens": ["Handles", "GET", "requests", "and", "instantiates", "a", "blank", "version", "of", "the", "formset", "."], "nwo": "AndrewIngram/django-extra-views", "score": 0.5916871811422788, "idx": 252874}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/validation/jsonschema/schema_validation.py#L112-L145", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Validates JSON dict against a schema.", "language": "python", "parameters": "(json_dict, schema,\n                                 err_msg=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "try", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_3", "=", "arg_1", "arg_1", "=", "_SCHEMAS", "[", "arg_3", "]", "arg_4", "=", "_get_validator", "(", "arg_3", ")", "arg_4", ".", "validate", "(", "arg_0", ")", "else", ":", "jsonschema", ".", "validate", "(", "arg_0", ",", "arg_1", ")", "except", "jsonschema", ".", "ValidationError", "as", "err", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "\"JSON failed validation. Set Qiskit log level to DEBUG \"", "\"for further information.\"", "arg_5", "=", "SchemaValidationError", "(", "arg_2", ")", "arg_5", ".", "__cause__", "=", "_SummaryValidationError", "(", "err", ")", "logger", ".", "debug", "(", "'%s'", ",", "_format_causes", "(", "err", ")", ")", "raise", "arg_5"], "function": "def Func(arg_0, arg_1,\n                                 arg_2=None):\n    \"\"\"Validates JSON dict against a schema.\n\n    Args:\n        json_dict (dict): JSON to be validated.\n        schema (dict or str): JSON schema dictionary or the name of one of the\n            standards schemas in Qiskit to validate against it. The list of\n            standard schemas is: ``backend_configuration``,\n            ``backend_properties``, ``backend_status``,\n            ``default_pulse_configuration``, ``job_status``, ``qobj``,\n            ``result``.\n        err_msg (str): Optional error message.\n\n    Raises:\n        SchemaValidationError: Raised if validation fails.\n    \"\"\"\n\n    try:\n        if isinstance(arg_1, str):\n            arg_3 = arg_1\n            arg_1 = _SCHEMAS[arg_3]\n            arg_4 = _get_validator(arg_3)\n            arg_4.validate(arg_0)\n        else:\n            jsonschema.validate(arg_0, arg_1)\n    except jsonschema.ValidationError as err:\n        if arg_2 is None:\n            arg_2 = \"JSON failed validation. Set Qiskit log level to DEBUG \" \\\n                      \"for further information.\"\n        arg_5 = SchemaValidationError(arg_2)\n        arg_5.__cause__ = _SummaryValidationError(err)\n        logger.debug('%s', _format_causes(err))\n        raise arg_5", "path": "qiskit/validation/jsonschema/schema_validation.py", "identifier": "validate_json_against_schema", "docstring": "Validates JSON dict against a schema.\n\n    Args:\n        json_dict (dict): JSON to be validated.\n        schema (dict or str): JSON schema dictionary or the name of one of the\n            standards schemas in Qiskit to validate against it. The list of\n            standard schemas is: ``backend_configuration``,\n            ``backend_properties``, ``backend_status``,\n            ``default_pulse_configuration``, ``job_status``, ``qobj``,\n            ``result``.\n        err_msg (str): Optional error message.\n\n    Raises:\n        SchemaValidationError: Raised if validation fails.", "docstring_tokens": ["Validates", "JSON", "dict", "against", "a", "schema", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252875}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/loaders/scene/gltf.py#L452-L455", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Get the bounding box for the mesh", "language": "python", "parameters": "(self, primitive)", "return_statement": "return accessor.min, accessor.max", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "attributes", ".", "get", "(", "'POSITION'", ")", "return", "arg_2", ".", "min", ",", "arg_2", ".", "max"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get the bounding box for the mesh\"\"\"\n        arg_2 = arg_1.attributes.get('POSITION')\n        return arg_2.min, arg_2.max", "path": "demosys/loaders/scene/gltf.py", "identifier": "GLTFMesh.get_bbox", "docstring": "Get the bounding box for the mesh", "docstring_tokens": ["Get", "the", "bounding", "box", "for", "the", "mesh"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 252876}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L245-L267", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Set the default value on a per instance basis.", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "type", "(", "arg_1", ")", ".", "mro", "(", ")", "arg_3", "=", "'_%s_default'", "%", "arg_0", ".", "name", "for", "arg_4", "in", "arg_2", "[", ":", "arg_2", ".", "index", "(", "arg_0", ".", "this_class", ")", "+", "1", "]", ":", "if", "arg_3", "in", "arg_4", ".", "__dict__", ":", "break", "else", ":", "arg_5", "=", "arg_0", ".", "get_default_value", "(", ")", "arg_6", "=", "arg_0", ".", "_validate", "(", "arg_1", ",", "arg_5", ")", "arg_1", ".", "_trait_values", "[", "arg_0", ".", "name", "]", "=", "arg_6", "return", "arg_1", ".", "_trait_dyn_inits", "[", "arg_0", ".", "name", "]", "=", "arg_4", ".", "__dict__", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set the default value on a per instance basis.\n\n        This method is called by :meth:`instance_init` to create and\n        validate the default value.  The creation and validation of\n        default values must be delayed until the parent :class:`HasTraits`\n        class has been instantiated.\n        \"\"\"\n        # Check for a deferred initializer defined in the same class as the\n        # trait declaration or above.\n        arg_2 = type(arg_1).mro()\n        arg_3 = '_%s_default' % arg_0.name\n        for arg_4 in arg_2[:arg_2.index(arg_0.this_class)+1]:\n            if arg_3 in arg_4.__dict__:\n                break\n        else:\n            # We didn't find one. Do static initialization.\n            arg_5 = arg_0.get_default_value()\n            arg_6 = arg_0._validate(arg_1, arg_5)\n            arg_1._trait_values[arg_0.name] = arg_6\n            return\n        # Complete the dynamic initialization.\n        arg_1._trait_dyn_inits[arg_0.name] = arg_4.__dict__[arg_3]", "path": "environment/lib/python2.7/site-packages/IPython/utils/traitlets.py", "identifier": "TraitType.set_default_value", "docstring": "Set the default value on a per instance basis.\n\n        This method is called by :meth:`instance_init` to create and\n        validate the default value.  The creation and validation of\n        default values must be delayed until the parent :class:`HasTraits`\n        class has been instantiated.", "docstring_tokens": ["Set", "the", "default", "value", "on", "a", "per", "instance", "basis", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252877}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/oauth2.py#L262-L284", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Decode state and return param.", "language": "python", "parameters": "(cls, state, param='user_state')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'user_state'", ")", ":", "if", "arg_1", "and", "arg_0", ".", "supports_user_state", ":", "return", "json", ".", "loads", "(", "base64", ".", "urlsafe_b64decode", "(", "unquote", "(", "str", "(", "arg_1", ")", ")", ")", ".", "decode", "(", "'utf-8'", ")", ")", "[", "arg_2", "]", "else", ":", "return", "arg_1", "if", "arg_2", "==", "'csrf'", "else", "''"], "function": "def Func(arg_0, arg_1, arg_2='user_state'):\n        \"\"\"\n        Decode state and return param.\n\n        :param str state:\n            state parameter passed through by provider\n\n        :param str param:\n            key to query from decoded state variable. Options include 'csrf'\n            and 'user_state'.\n\n        :returns:\n            string value from decoded state\n\n        \"\"\"\n        if arg_1 and arg_0.supports_user_state:\n            # urlsafe_b64 may include = which the browser quotes so must\n            # unquote Cast to str to void b64decode translation error. Base64\n            # should be str compatible.\n            return json.loads(base64.urlsafe_b64decode(\n                unquote(str(arg_1))).decode('utf-8'))[arg_2]\n        else:\n            return arg_1 if arg_2 == 'csrf' else ''", "path": "authomatic/providers/oauth2.py", "identifier": "OAuth2.decode_state", "docstring": "Decode state and return param.\n\n        :param str state:\n            state parameter passed through by provider\n\n        :param str param:\n            key to query from decoded state variable. Options include 'csrf'\n            and 'user_state'.\n\n        :returns:\n            string value from decoded state", "docstring_tokens": ["Decode", "state", "and", "return", "param", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 252878}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dav_provider.py#L718-L807", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Set a property value or remove a property.", "language": "python", "parameters": "(self, name, value, dry_run=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "assert", "arg_2", "is", "None", "or", "xml_tools", ".", "is_etree_element", "(", "arg_2", ")", "if", "arg_1", "in", "_lockPropertyNames", ":", "raise", "DAVError", "(", "HTTP_FORBIDDEN", ",", "err_condition", "=", "PRECONDITION_CODE_ProtectedProperty", ")", "arg_4", "=", "arg_0", ".", "environ", "[", "\"wsgidav.config\"", "]", "arg_5", "=", "arg_4", ".", "get", "(", "\"mutable_live_props\"", ",", "[", "]", ")", "if", "(", "arg_1", ".", "startswith", "(", "\"{DAV:}\"", ")", "and", "arg_1", "in", "_standardLivePropNames", "and", "arg_1", "in", "arg_5", ")", ":", "if", "arg_1", "in", "(", "\"{DAV:}getlastmodified\"", ",", "\"{DAV:}last_modified\"", ")", ":", "try", ":", "return", "arg_0", ".", "set_last_modified", "(", "arg_0", ".", "path", ",", "arg_2", ".", "text", ",", "arg_3", ")", "except", "Exception", ":", "_logger", ".", "warning", "(", "\"Provider does not support set_last_modified on {}.\"", ".", "format", "(", "arg_0", ".", "path", ")", ")", "raise", "DAVError", "(", "HTTP_FORBIDDEN", ")", "if", "arg_1", ".", "startswith", "(", "\"{urn:schemas-microsoft-com:}\"", ")", ":", "arg_6", "=", "arg_0", ".", "environ", ".", "get", "(", "\"HTTP_USER_AGENT\"", ",", "\"None\"", ")", "arg_7", "=", "arg_4", ".", "get", "(", "\"hotfixes\"", ",", "{", "}", ")", ".", "get", "(", "\"emulate_win32_lastmod\"", ",", "False", ")", "if", "arg_7", "and", "\"MiniRedir/6.1\"", "not", "in", "arg_6", ":", "if", "\"Win32LastModifiedTime\"", "in", "arg_1", ":", "return", "arg_0", ".", "set_last_modified", "(", "arg_0", ".", "path", ",", "arg_2", ".", "text", ",", "arg_3", ")", "elif", "\"Win32FileAttributes\"", "in", "arg_1", ":", "return", "True", "elif", "\"Win32CreationTime\"", "in", "arg_1", ":", "return", "True", "elif", "\"Win32LastAccessTime\"", "in", "arg_1", ":", "return", "True", "arg_8", "=", "arg_0", ".", "provider", ".", "prop_manager", "if", "arg_8", "and", "not", "arg_1", ".", "startswith", "(", "\"{DAV:}\"", ")", ":", "arg_9", "=", "arg_0", ".", "get_ref_url", "(", ")", "if", "arg_2", "is", "None", ":", "return", "arg_8", ".", "remove_property", "(", "arg_9", ",", "arg_1", ",", "arg_3", ",", "arg_0", ".", "environ", ")", "else", ":", "arg_2", "=", "etree", ".", "tostring", "(", "arg_2", ")", "return", "arg_8", ".", "write_property", "(", "arg_9", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_0", ".", "environ", ")", "raise", "DAVError", "(", "HTTP_FORBIDDEN", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"Set a property value or remove a property.\n\n        value == None means 'remove property'.\n        Raise HTTP_FORBIDDEN if property is read-only, or not supported.\n\n        When dry_run is True, this function should raise errors, as in a real\n        run, but MUST NOT change any data.\n\n        This default implementation\n\n        - raises HTTP_FORBIDDEN, if trying to modify a locking property\n        - raises HTTP_FORBIDDEN, if trying to modify an immutable {DAV:}\n          property\n        - handles Windows' Win32LastModifiedTime to set the getlastmodified\n          property, if enabled\n        - stores everything else as dead property, if a property manager is\n          present.\n        - raises HTTP_FORBIDDEN, else\n\n        Removing a non-existing prop is NOT an error.\n\n        Note: RFC 4918 states that {DAV:}displayname 'SHOULD NOT be protected'\n\n        A resource provider may override this method, to update supported custom\n        live properties.\n        \"\"\"\n        assert arg_2 is None or xml_tools.is_etree_element(arg_2)\n\n        if arg_1 in _lockPropertyNames:\n            # Locking properties are always read-only\n            raise DAVError(\n                HTTP_FORBIDDEN, err_condition=PRECONDITION_CODE_ProtectedProperty\n            )\n\n        # Live property\n        arg_4 = arg_0.environ[\"wsgidav.config\"]\n        # hotfixes = config.get(\"hotfixes\", {})\n        arg_5 = arg_4.get(\"mutable_live_props\", [])\n        # Accept custom live property updates on resources if configured.\n        if (\n            arg_1.startswith(\"{DAV:}\")\n            and arg_1 in _standardLivePropNames\n            and arg_1 in arg_5\n        ):\n            # Please note that some properties should not be mutable according\n            # to RFC4918. This includes the 'getlastmodified' property, which\n            # it may still make sense to make mutable in order to support time\n            # stamp changes from e.g. utime calls or the touch or rsync -a\n            # commands.\n            if arg_1 in (\"{DAV:}getlastmodified\", \"{DAV:}last_modified\"):\n                try:\n                    return arg_0.set_last_modified(arg_0.path, arg_2.text, arg_3)\n                except Exception:\n                    _logger.warning(\n                        \"Provider does not support set_last_modified on {}.\".format(\n                            arg_0.path\n                        )\n                    )\n\n            # Unsupported or not allowed\n            raise DAVError(HTTP_FORBIDDEN)\n\n        # Handle MS Windows Win32LastModifiedTime, if enabled.\n        # Note that the WebDAV client in Win7 and earler has issues and can't be used\n        # with this so we ignore older clients. Others pre-Win10 should be tested.\n        if arg_1.startswith(\"{urn:schemas-microsoft-com:}\"):\n            arg_6 = arg_0.environ.get(\"HTTP_USER_AGENT\", \"None\")\n            arg_7 = arg_4.get(\"hotfixes\", {}).get(\"emulate_win32_lastmod\", False)\n            if arg_7 and \"MiniRedir/6.1\" not in arg_6:\n                if \"Win32LastModifiedTime\" in arg_1:\n                    return arg_0.set_last_modified(arg_0.path, arg_2.text, arg_3)\n                elif \"Win32FileAttributes\" in arg_1:\n                    return True\n                elif \"Win32CreationTime\" in arg_1:\n                    return True\n                elif \"Win32LastAccessTime\" in arg_1:\n                    return True\n\n        # Dead property\n        arg_8 = arg_0.provider.prop_manager\n        if arg_8 and not arg_1.startswith(\"{DAV:}\"):\n            arg_9 = arg_0.get_ref_url()\n            if arg_2 is None:\n                return arg_8.remove_property(arg_9, arg_1, arg_3, arg_0.environ)\n            else:\n                arg_2 = etree.tostring(arg_2)\n                return arg_8.write_property(arg_9, arg_1, arg_2, arg_3, arg_0.environ)\n\n        raise DAVError(HTTP_FORBIDDEN)", "path": "wsgidav/dav_provider.py", "identifier": "_DAVResource.set_property_value", "docstring": "Set a property value or remove a property.\n\n        value == None means 'remove property'.\n        Raise HTTP_FORBIDDEN if property is read-only, or not supported.\n\n        When dry_run is True, this function should raise errors, as in a real\n        run, but MUST NOT change any data.\n\n        This default implementation\n\n        - raises HTTP_FORBIDDEN, if trying to modify a locking property\n        - raises HTTP_FORBIDDEN, if trying to modify an immutable {DAV:}\n          property\n        - handles Windows' Win32LastModifiedTime to set the getlastmodified\n          property, if enabled\n        - stores everything else as dead property, if a property manager is\n          present.\n        - raises HTTP_FORBIDDEN, else\n\n        Removing a non-existing prop is NOT an error.\n\n        Note: RFC 4918 states that {DAV:}displayname 'SHOULD NOT be protected'\n\n        A resource provider may override this method, to update supported custom\n        live properties.", "docstring_tokens": ["Set", "a", "property", "value", "or", "remove", "a", "property", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 252879}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L1094-L1106", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Retrieve item fields or creator types", "language": "python", "parameters": "(self, tname, qstring, itemtype)", "return_statement": "return self._cache(retrieved, template_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", "+", "arg_3", "arg_5", "=", "arg_2", ".", "format", "(", "i", "=", "arg_3", ")", "if", "arg_0", ".", "templates", ".", "get", "(", "arg_4", ")", "and", "not", "arg_0", ".", "_updated", "(", "arg_5", ",", "arg_0", ".", "templates", "[", "arg_4", "]", ",", "arg_4", ")", ":", "return", "arg_0", ".", "templates", "[", "arg_4", "]", "[", "\"tmplt\"", "]", "arg_6", "=", "arg_0", ".", "_retrieve_data", "(", "arg_5", ")", "return", "arg_0", ".", "_cache", "(", "arg_6", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Retrieve item fields or creator types\n        \"\"\"\n        # check for a valid cached version\n        arg_4 = arg_1 + arg_3\n        arg_5 = arg_2.format(i=arg_3)\n        if arg_0.templates.get(arg_4) and not arg_0._updated(\n            arg_5, arg_0.templates[arg_4], arg_4\n        ):\n            return arg_0.templates[arg_4][\"tmplt\"]\n        # otherwise perform a normal request and cache the response\n        arg_6 = arg_0._retrieve_data(arg_5)\n        return arg_0._cache(arg_6, arg_4)", "path": "pyzotero/zotero.py", "identifier": "Zotero.fields_types", "docstring": "Retrieve item fields or creator types", "docstring_tokens": ["Retrieve", "item", "fields", "or", "creator", "types"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 252880}
{"url": "https://github.com/dreidev/Suggestions/blob/f04c181dc815d32c35b44c6e1c91521e88a9dd6c/suggestions/views.py#L100-L111", "sha": "f04c181dc815d32c35b44c6e1c91521e88a9dd6c", "docstring_summary": "Gets a list with a certain size of suggestions for an object", "language": "python", "parameters": "(object, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "type", "(", "arg_0", ")", ")", "try", ":", "return", "ObjectViewDictionary", ".", "objects", ".", "filter", "(", "current_object_id", "=", "arg_0", ".", "id", ",", "current_content_type", "=", "arg_2", ")", ".", "extra", "(", "order_by", "=", "[", "'-visits'", "]", ")", "[", ":", "arg_1", "]", "except", ":", "return", "ObjectViewDictionary", ".", "objects", ".", "filter", "(", "current_object_id", "=", "arg_0", ".", "id", ",", "current_content_type", "=", "arg_2", ")", ".", "extra", "(", "order_by", "=", "[", "'-visits'", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Gets a list with a certain size of suggestions for an object \"\"\"\n    arg_2 = ContentType.objects.get_for_model(type(arg_0))\n    try:\n        return ObjectViewDictionary.objects.filter(\n            current_object_id=arg_0.id,\n            current_content_type=arg_2).extra(\n            order_by=['-visits'])[:arg_1]\n    except:\n        return ObjectViewDictionary.objects.filter(\n            current_object_id=arg_0.id,\n            current_content_type=arg_2).extra(order_by=['-visits'])", "path": "suggestions/views.py", "identifier": "get_suggestions_with_size", "docstring": "Gets a list with a certain size of suggestions for an object", "docstring_tokens": ["Gets", "a", "list", "with", "a", "certain", "size", "of", "suggestions", "for", "an", "object"], "nwo": "dreidev/Suggestions", "score": 0.0, "idx": 252881}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L251-L257", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return the value current bound to the name `name_sym` in the namespace\n        specified by `ns_sym`.", "language": "python", "parameters": "(ns_sym: sym.Symbol, name_sym: sym.Symbol)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "Symbol", ",", "arg_3", ":", "arg_1", ".", "Symbol", ")", "->", "\"Optional[Var]\"", ":", "arg_4", "=", "Namespace", ".", "get", "(", "arg_0", ")", "if", "arg_4", ":", "return", "arg_4", ".", "find", "(", "arg_3", ")", "return", "None"], "function": "def Func(arg_0: arg_1.Symbol, arg_3: arg_1.Symbol) -> \"Optional[Var]\":\n        \"\"\"Return the value current bound to the name `name_sym` in the namespace\n        specified by `ns_sym`.\"\"\"\n        arg_4 = Namespace.get(arg_0)\n        if arg_4:\n            return arg_4.find(arg_3)\n        return None", "path": "src/basilisp/lang/runtime.py", "identifier": "Var.find_in_ns", "docstring": "Return the value current bound to the name `name_sym` in the namespace\n        specified by `ns_sym`.", "docstring_tokens": ["Return", "the", "value", "current", "bound", "to", "the", "name", "name_sym", "in", "the", "namespace", "specified", "by", "ns_sym", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252882}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/assembly.py#L131-L142", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "To perform the munging operations on a frame specified in steps on the frame fr.", "language": "python", "parameters": "(self, fr)", "return_statement": "return H2OFrame.get_frame(j[\"result\"][\"name\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert_is_type", "(", "arg_1", ",", "H2OFrame", ")", "arg_2", "=", "\"[%s]\"", "%", "\",\"", ".", "join", "(", "quoted", "(", "step", "[", "1", "]", ".", "to_rest", "(", "step", "[", "0", "]", ")", ".", "replace", "(", "'\"'", ",", "\"'\"", ")", ")", "for", "step", "in", "arg_0", ".", "steps", ")", "arg_3", "=", "h2o", ".", "api", "(", "\"POST /99/Assembly\"", ",", "data", "=", "{", "\"steps\"", ":", "arg_2", ",", "\"frame\"", ":", "arg_1", ".", "frame_id", "}", ")", "arg_0", ".", "id", "=", "arg_3", "[", "\"assembly\"", "]", "[", "\"name\"", "]", "return", "H2OFrame", ".", "get_frame", "(", "arg_3", "[", "\"result\"", "]", "[", "\"name\"", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        To perform the munging operations on a frame specified in steps on the frame fr.\n\n        :param fr: H2OFrame where munging operations are to be performed on.\n        :return: H2OFrame after munging operations are completed.\n        \"\"\"\n        assert_is_type(arg_1, H2OFrame)\n        arg_2 = \"[%s]\" % \",\".join(quoted(step[1].to_rest(step[0]).replace('\"', \"'\")) for step in arg_0.steps)\n        arg_3 = h2o.api(\"POST /99/Assembly\", data={\"steps\": arg_2, \"frame\": arg_1.frame_id})\n        arg_0.id = arg_3[\"assembly\"][\"name\"]\n        return H2OFrame.get_frame(arg_3[\"result\"][\"name\"])", "path": "h2o-py/h2o/assembly.py", "identifier": "H2OAssembly.fit", "docstring": "To perform the munging operations on a frame specified in steps on the frame fr.\n\n        :param fr: H2OFrame where munging operations are to be performed on.\n        :return: H2OFrame after munging operations are completed.", "docstring_tokens": ["To", "perform", "the", "munging", "operations", "on", "a", "frame", "specified", "in", "steps", "on", "the", "frame", "fr", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 252883}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sections.py#L39-L44", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return list of sections for the passed course SIS ID.", "language": "python", "parameters": "(self, sis_course_id, params={})", "return_statement": "return self.get_sections_in_course(\n            self._sis_id(sis_course_id, sis_field=\"course\"), params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "return", "arg_0", ".", "get_sections_in_course", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"course\"", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return list of sections for the passed course SIS ID.\n        \"\"\"\n        return arg_0.get_sections_in_course(\n            arg_0._sis_id(arg_1, sis_field=\"course\"), arg_2)", "path": "uw_canvas/sections.py", "identifier": "Sections.get_sections_in_course_by_sis_id", "docstring": "Return list of sections for the passed course SIS ID.", "docstring_tokens": ["Return", "list", "of", "sections", "for", "the", "passed", "course", "SIS", "ID", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 252884}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1159-L1175", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Double-click primary mouse button.", "language": "python", "parameters": "(self, coord)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_0", ".", "_queueMouseButton", "(", "arg_1", ",", "Quartz", ".", "kCGMouseButtonLeft", ",", "arg_2", ")", "arg_0", ".", "_queueMouseButton", "(", "arg_1", ",", "Quartz", ".", "kCGMouseButtonLeft", ",", "arg_2", ",", "clickCount", "=", "2", ")", "arg_0", ".", "_postQueuedEvents", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Double-click primary mouse button.\n\n        Parameters: coordinates to click (assume primary is left button)\n        Returns: None\n        \"\"\"\n        arg_2 = 0\n        arg_0._queueMouseButton(arg_1, Quartz.kCGMouseButtonLeft, arg_2)\n        # This is a kludge:\n        # If directed towards a Fusion VM the clickCount gets ignored and this\n        # will be seen as a single click, so in sequence this will be a double-\n        # click\n        # Otherwise to a host app only this second one will count as a double-\n        # click\n        arg_0._queueMouseButton(arg_1, Quartz.kCGMouseButtonLeft, arg_2,\n                               clickCount=2)\n        arg_0._postQueuedEvents()", "path": "atomac/AXClasses.py", "identifier": "NativeUIElement.doubleClickMouse", "docstring": "Double-click primary mouse button.\n\n        Parameters: coordinates to click (assume primary is left button)\n        Returns: None", "docstring_tokens": ["Double", "-", "click", "primary", "mouse", "button", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 252885}
{"url": "https://github.com/ossobv/exactonline/blob/f6bee418a9cb1fcf3ef17347ea7ab0dd3b573fde/exactonline/storage/base.py#L61-L72", "sha": "f6bee418a9cb1fcf3ef17347ea7ab0dd3b573fde", "docstring_summary": "Base method to fetch values and to set defaults in case they\n        don't exist.", "language": "python", "parameters": "(self, section, option, value)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "arg_4", "=", "arg_0", ".", "get", "(", "arg_1", ",", "arg_2", ")", "except", "MissingSetting", ":", "arg_0", ".", "set", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_4", "=", "arg_3", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Base method to fetch values and to set defaults in case they\n        don't exist.\n        \"\"\"\n        try:\n            arg_4 = arg_0.get(arg_1, arg_2)\n        except MissingSetting:\n            arg_0.set(arg_1, arg_2, arg_3)\n            arg_4 = arg_3\n\n        return arg_4", "path": "exactonline/storage/base.py", "identifier": "ExactOnlineConfig.get_or_set_default", "docstring": "Base method to fetch values and to set defaults in case they\n        don't exist.", "docstring_tokens": ["Base", "method", "to", "fetch", "values", "and", "to", "set", "defaults", "in", "case", "they", "don", "t", "exist", "."], "nwo": "ossobv/exactonline", "score": 0.48904841873478916, "idx": 252886}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/neurommsig/export.py#L98-L108", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Preprocess the excel file.", "language": "python", "parameters": "(path: str)", "return_statement": "return pd.read_excel(path, sheetname=0, header=0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "pd", ".", "DataFrame", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "\"Error: %s file not found\"", "%", "arg_0", ")", "return", "pd", ".", "read_excel", "(", "arg_0", ",", "sheetname", "=", "0", ",", "header", "=", "0", ")"], "function": "def Func(arg_0: arg_1) -> pd.DataFrame:\n    \"\"\"Preprocess the excel file.\n\n    Parameters\n    ----------\n    path : Filepath of the excel sheet\n    \"\"\"\n    if not os.path.exists(arg_0):\n        raise ValueError(\"Error: %s file not found\" % arg_0)\n\n    return pd.read_excel(arg_0, sheetname=0, header=0)", "path": "src/pybel_tools/analysis/neurommsig/export.py", "identifier": "preprocessing_br_projection_excel", "docstring": "Preprocess the excel file.\n\n    Parameters\n    ----------\n    path : Filepath of the excel sheet", "docstring_tokens": ["Preprocess", "the", "excel", "file", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 252887}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/api.py#L34-L69", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Create and start a swarm job.", "language": "python", "parameters": "(client, clientInfo=\"\", clientKey=\"\", params=\"\",\n                        minimumWorkers=None, maximumWorkers=None,\n                        alreadyRunning=False)", "return_statement": "return ClientJobsDAO.get().jobInsert(\n      client=client,\n      cmdLine=\"$HYPERSEARCH\",\n      clientInfo=clientInfo,\n      clientKey=clientKey,\n      alreadyRunning=alreadyRunning,\n      params=params,\n      minimumWorkers=minimumWorkers,\n      maximumWorkers=maximumWorkers,\n      jobType=ClientJobsDAO.JOB_TYPE_HS)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "\"\"", ",", "arg_3", "=", "\"\"", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "Configuration", ".", "getInt", "(", "\"nupic.hypersearch.minWorkersPerSwarm\"", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "Configuration", ".", "getInt", "(", "\"nupic.hypersearch.maxWorkersPerSwarm\"", ")", "return", "ClientJobsDAO", ".", "get", "(", ")", ".", "jobInsert", "(", "arg_0", "=", "arg_0", ",", "cmdLine", "=", "\"$HYPERSEARCH\"", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_6", "=", "arg_6", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "jobType", "=", "ClientJobsDAO", ".", "JOB_TYPE_HS", ")"], "function": "def Func(arg_0, arg_1=\"\", arg_2=\"\", arg_3=\"\",\n                        arg_4=None, arg_5=None,\n                        arg_6=False):\n  \"\"\"Create and start a swarm job.\n\n  Args:\n    client - A string identifying the calling client. There is a small limit\n        for the length of the value. See ClientJobsDAO.CLIENT_MAX_LEN.\n    clientInfo - JSON encoded dict of client specific information.\n    clientKey - Foreign key. Limited in length, see ClientJobsDAO._initTables.\n    params - JSON encoded dict of the parameters for the job. This can be\n        fetched out of the database by the worker processes based on the jobID.\n    minimumWorkers - The minimum workers to allocate to the swarm. Set to None\n        to use the default.\n    maximumWorkers - The maximum workers to allocate to the swarm. Set to None\n        to use the swarm default. Set to 0 to use the maximum scheduler value.\n    alreadyRunning - Insert a job record for an already running process. Used\n        for testing.\n  \"\"\"\n  if arg_4 is None:\n    arg_4 = Configuration.getInt(\n        \"nupic.hypersearch.minWorkersPerSwarm\")\n  if arg_5 is None:\n    arg_5 = Configuration.getInt(\n        \"nupic.hypersearch.maxWorkersPerSwarm\")\n\n  return ClientJobsDAO.get().jobInsert(\n      arg_0=arg_0,\n      cmdLine=\"$HYPERSEARCH\",\n      arg_1=arg_1,\n      arg_2=arg_2,\n      arg_6=arg_6,\n      arg_3=arg_3,\n      arg_4=arg_4,\n      arg_5=arg_5,\n      jobType=ClientJobsDAO.JOB_TYPE_HS)", "path": "src/nupic/swarming/api.py", "identifier": "createAndStartSwarm", "docstring": "Create and start a swarm job.\n\n  Args:\n    client - A string identifying the calling client. There is a small limit\n        for the length of the value. See ClientJobsDAO.CLIENT_MAX_LEN.\n    clientInfo - JSON encoded dict of client specific information.\n    clientKey - Foreign key. Limited in length, see ClientJobsDAO._initTables.\n    params - JSON encoded dict of the parameters for the job. This can be\n        fetched out of the database by the worker processes based on the jobID.\n    minimumWorkers - The minimum workers to allocate to the swarm. Set to None\n        to use the default.\n    maximumWorkers - The maximum workers to allocate to the swarm. Set to None\n        to use the swarm default. Set to 0 to use the maximum scheduler value.\n    alreadyRunning - Insert a job record for an already running process. Used\n        for testing.", "docstring_tokens": ["Create", "and", "start", "a", "swarm", "job", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252888}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/sensors/hdfs_sensor.py#L57-L74", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "poke for a non empty directory", "language": "python", "parameters": "(self, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "hook", "(", "arg_0", ".", "hdfs_conn_id", ")", ".", "get_conn", "(", ")", "arg_3", "=", "[", "f", "for", "f", "in", "arg_2", ".", "ls", "(", "[", "arg_0", ".", "filepath", "]", ",", "include_toplevel", "=", "True", ")", "]", "arg_3", "=", "arg_0", ".", "filter_for_ignored_ext", "(", "arg_3", ",", "arg_0", ".", "ignored_ext", ",", "arg_0", ".", "ignore_copying", ")", "arg_3", "=", "arg_0", ".", "filter_for_filesize", "(", "arg_3", ",", "arg_0", ".", "file_size", ")", "if", "arg_0", ".", "be_empty", ":", "arg_0", ".", "log", ".", "info", "(", "'Poking for filepath %s to a empty directory'", ",", "arg_0", ".", "filepath", ")", "return", "len", "(", "arg_3", ")", "==", "1", "and", "arg_3", "[", "0", "]", "[", "'path'", "]", "==", "arg_0", ".", "filepath", "else", ":", "arg_0", ".", "log", ".", "info", "(", "'Poking for filepath %s to a non empty directory'", ",", "arg_0", ".", "filepath", ")", "arg_3", ".", "pop", "(", "0", ")", "return", "bool", "(", "arg_3", ")", "and", "arg_3", "[", "0", "]", "[", "'file_type'", "]", "==", "'f'"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Func for a non empty directory\n\n        :return: Bool depending on the search criteria\n        \"\"\"\n        arg_2 = arg_0.hook(arg_0.hdfs_conn_id).get_conn()\n        arg_3 = [f for f in arg_2.ls([arg_0.filepath], include_toplevel=True)]\n        arg_3 = arg_0.filter_for_ignored_ext(arg_3, arg_0.ignored_ext,\n                                             arg_0.ignore_copying)\n        arg_3 = arg_0.filter_for_filesize(arg_3, arg_0.file_size)\n        if arg_0.be_empty:\n            arg_0.log.info('Poking for filepath %s to a empty directory', arg_0.filepath)\n            return len(arg_3) == 1 and arg_3[0]['path'] == arg_0.filepath\n        else:\n            arg_0.log.info('Poking for filepath %s to a non empty directory', arg_0.filepath)\n            arg_3.pop(0)\n            return bool(arg_3) and arg_3[0]['file_type'] == 'f'", "path": "airflow/contrib/sensors/hdfs_sensor.py", "identifier": "HdfsSensorFolder.poke", "docstring": "poke for a non empty directory\n\n        :return: Bool depending on the search criteria", "docstring_tokens": ["poke", "for", "a", "non", "empty", "directory"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252889}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/frameTmplUtils.py#L215-L220", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Count of complete words between two addresses", "language": "python", "parameters": "(self, start: int, end: int)", "return_statement": "return gap // self.wordWidth", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ")", ":", "assert", "arg_3", ">=", "arg_1", ",", "(", "arg_1", ",", "arg_3", ")", "arg_4", "=", "max", "(", "0", ",", "(", "arg_3", "-", "arg_1", ")", "-", "(", "arg_1", "%", "arg_0", ".", "wordWidth", ")", ")", "return", "arg_4", "//", "arg_0", ".", "wordWidth"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2):\n        \"\"\"Count of complete words between two addresses\n        \"\"\"\n        assert arg_3 >= arg_1, (arg_1, arg_3)\n        arg_4 = max(0, (arg_3 - arg_1) - (arg_1 % arg_0.wordWidth))\n        return arg_4 // arg_0.wordWidth", "path": "hwt/hdl/frameTmplUtils.py", "identifier": "TransTmplWordIterator.fullWordCnt", "docstring": "Count of complete words between two addresses", "docstring_tokens": ["Count", "of", "complete", "words", "between", "two", "addresses"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252890}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/utils.py#L8-L22", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Create an iterable from the iterables that contains each element once.", "language": "python", "parameters": "(iterables)", "return_statement": "return [element for elements in iterables for element in elements\n            if not included(element)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "def", "included", "(", "arg_2", ")", ":", "arg_3", "=", "arg_2", "in", "arg_1", "arg_1", ".", "add", "(", "arg_2", ")", "return", "arg_3", "return", "[", "arg_2", "for", "arg_4", "in", "arg_0", "for", "arg_2", "in", "arg_4", "if", "not", "included", "(", "arg_2", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"Create an iterable from the iterables that contains each element once.\n\n    :return: an iterable over the iterables. Each element of the result\n      appeared only once in the result. They are ordered by the first\n      occurrence in the iterables.\n    \"\"\"\n    arg_1 = set()\n\n    def included(arg_2):\n        arg_3 = arg_2 in arg_1\n        arg_1.add(arg_2)\n        return arg_3\n    return [arg_2 for arg_4 in arg_0 for arg_2 in arg_4\n            if not included(arg_2)]", "path": "knittingpattern/utils.py", "identifier": "unique", "docstring": "Create an iterable from the iterables that contains each element once.\n\n    :return: an iterable over the iterables. Each element of the result\n      appeared only once in the result. They are ordered by the first\n      occurrence in the iterables.", "docstring_tokens": ["Create", "an", "iterable", "from", "the", "iterables", "that", "contains", "each", "element", "once", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 252891}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/imports.py#L187-L192", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "generate a dependencies graph and add some information about it in the\n    report's section", "language": "python", "parameters": "(filename, dep_info, sect, gtype)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "_dependencies_graph", "(", "arg_0", ",", "arg_1", ")", "arg_2", ".", "append", "(", "Paragraph", "(", "\"%simports graph has been written to %s\"", "%", "(", "arg_3", ",", "arg_0", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"generate a dependencies graph and add some information about it in the\n    report's section\n    \"\"\"\n    _dependencies_graph(arg_0, arg_1)\n    arg_2.append(Paragraph(\"%simports graph has been written to %s\" % (arg_3, arg_0)))", "path": "pylint/checkers/imports.py", "identifier": "_make_graph", "docstring": "generate a dependencies graph and add some information about it in the\n    report's section", "docstring_tokens": ["generate", "a", "dependencies", "graph", "and", "add", "some", "information", "about", "it", "in", "the", "report", "s", "section"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252892}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/refractivity.py#L44-L116", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''This function handles the retrieval of a chemical's refractive\n    index. Lookup is based on CASRNs. Will automatically select a data source\n    to use if no Method is provided; returns None if the data is not available.", "language": "python", "parameters": "(CASRN, T=None, AvailableMethods=False, Method=None,\n                     full_info=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ",", "arg_4", "=", "True", ")", ":", "def", "list_methods", "(", ")", ":", "arg_5", "=", "[", "]", "if", "arg_0", "in", "CRC_RI_organic", ".", "index", ":", "arg_5", ".", "append", "(", "CRC", ")", "arg_5", ".", "append", "(", "NONE", ")", "return", "arg_5", "if", "arg_2", ":", "return", "list_methods", "(", ")", "if", "not", "arg_3", ":", "arg_3", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_3", "==", "CRC", ":", "arg_6", "=", "float", "(", "CRC_RI_organic", ".", "at", "[", "arg_0", ",", "'RI'", "]", ")", "if", "arg_4", ":", "arg_7", "=", "float", "(", "CRC_RI_organic", ".", "at", "[", "arg_0", ",", "'RIT'", "]", ")", "elif", "arg_3", "==", "NONE", ":", "arg_6", ",", "arg_7", "=", "None", ",", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")", "if", "arg_4", ":", "return", "arg_6", ",", "arg_7", "else", ":", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=None,\n                     arg_4=True):\n    r'''This function handles the retrieval of a chemical's refractive\n    index. Lookup is based on CASRNs. Will automatically select a data source\n    to use if no Method is provided; returns None if the data is not available.\n\n    Function has data for approximately 4500 chemicals.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    RI : float\n        Refractive Index on the Na D line, [-]\n    T : float, only returned if full_info == True\n        Temperature at which refractive index reading was made\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain RI with the given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        RI_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        RI for the desired chemical, and will return methods instead of RI\n    full_info : bool, optional\n        If True, function will return the temperature at which the refractive\n        index reading was made\n\n    Notes\n    -----\n    Only one source is available in this function. It is:\n\n        * 'CRC', a compillation of Organic RI data in [1]_.\n\n    Examples\n    --------\n    >>> Func(CASRN='64-17-5')\n    (1.3611, 293.15)\n\n    References\n    ----------\n    .. [1] Haynes, W.M., Thomas J. Bruno, and David R. Lide. CRC Handbook of\n       Chemistry and Physics, 95E. Boca Raton, FL: CRC press, 2014.\n    '''\n    def list_methods():\n        arg_5 = []\n        if arg_0 in CRC_RI_organic.index:\n            arg_5.append(CRC)\n        arg_5.append(NONE)\n        return arg_5\n    if arg_2:\n        return list_methods()\n    if not arg_3:\n        arg_3 = list_methods()[0]\n\n    if arg_3 == CRC:\n        arg_6 = float(CRC_RI_organic.at[arg_0, 'RI'])\n        if arg_4:\n            arg_7 = float(CRC_RI_organic.at[arg_0, 'RIT'])\n    elif arg_3 == NONE:\n        arg_6, arg_7 = None, None\n    else:\n        raise Exception('Failure in in function')\n    if arg_4:\n        return arg_6, arg_7\n    else:\n        return arg_6", "path": "thermo/refractivity.py", "identifier": "refractive_index", "docstring": "r'''This function handles the retrieval of a chemical's refractive\n    index. Lookup is based on CASRNs. Will automatically select a data source\n    to use if no Method is provided; returns None if the data is not available.\n\n    Function has data for approximately 4500 chemicals.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    RI : float\n        Refractive Index on the Na D line, [-]\n    T : float, only returned if full_info == True\n        Temperature at which refractive index reading was made\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain RI with the given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        RI_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        RI for the desired chemical, and will return methods instead of RI\n    full_info : bool, optional\n        If True, function will return the temperature at which the refractive\n        index reading was made\n\n    Notes\n    -----\n    Only one source is available in this function. It is:\n\n        * 'CRC', a compillation of Organic RI data in [1]_.\n\n    Examples\n    --------\n    >>> refractive_index(CASRN='64-17-5')\n    (1.3611, 293.15)\n\n    References\n    ----------\n    .. [1] Haynes, W.M., Thomas J. Bruno, and David R. Lide. CRC Handbook of\n       Chemistry and Physics, 95E. Boca Raton, FL: CRC press, 2014.", "docstring_tokens": ["r", "This", "function", "handles", "the", "retrieval", "of", "a", "chemical", "s", "refractive", "index", ".", "Lookup", "is", "based", "on", "CASRNs", ".", "Will", "automatically", "select", "a", "data", "source", "to", "use", "if", "no", "Method", "is", "provided", ";", "returns", "None", "if", "the", "data", "is", "not", "available", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 252893}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L449-L466", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Attempt to load plugins from the path specified.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "pkgutil", ".", "iter_modules", "(", "[", "arg_1", "]", ")", ":", "arg_5", ",", "arg_6", ",", "arg_7", "=", "imp", ".", "find_module", "(", "arg_3", ",", "[", "arg_1", "]", ")", "arg_8", "=", "\"streamlink.plugin.{0}\"", ".", "format", "(", "arg_3", ")", "try", ":", "arg_0", ".", "load_plugin", "(", "arg_8", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "except", "Exception", ":", "sys", ".", "stderr", ".", "write", "(", "\"Failed to load plugin {0}:\\n\"", ".", "format", "(", "arg_3", ")", ")", "print_small_exception", "(", "\"load_plugin\"", ")", "continue"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Attempt to load plugins from the path specified.\n\n        :param path: full path to a directory where to look for plugins\n\n        \"\"\"\n        for arg_2, arg_3, arg_4 in pkgutil.iter_modules([arg_1]):\n            arg_5, arg_6, arg_7 = imp.find_module(arg_3, [arg_1])\n            # set the full plugin module name\n            arg_8 = \"streamlink.plugin.{0}\".format(arg_3)\n\n            try:\n                arg_0.load_plugin(arg_8, arg_5, arg_6, arg_7)\n            except Exception:\n                sys.stderr.write(\"Failed to load plugin {0}:\\n\".format(arg_3))\n                print_small_exception(\"load_plugin\")\n\n                continue", "path": "src/streamlink/session.py", "identifier": "Streamlink.load_plugins", "docstring": "Attempt to load plugins from the path specified.\n\n        :param path: full path to a directory where to look for plugins", "docstring_tokens": ["Attempt", "to", "load", "plugins", "from", "the", "path", "specified", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 252894}
{"url": "https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/colorful/ansi.py#L61-L77", "sha": "919fa6da17865cc5e01e6b16119193a97d180dc9", "docstring_summary": "Convert RGB to ANSI 256 color", "language": "python", "parameters": "(r, g, b)", "return_statement": "return ansi", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", "==", "arg_1", "and", "arg_1", "==", "arg_2", ":", "if", "arg_0", "<", "8", ":", "return", "16", "if", "arg_0", ">", "248", ":", "return", "231", "return", "round", "(", "(", "(", "arg_0", "-", "8", ")", "/", "247.0", ")", "*", "24", ")", "+", "232", "arg_3", "=", "36", "*", "round", "(", "arg_0", "/", "255.0", "*", "5.0", ")", "arg_4", "=", "6", "*", "round", "(", "arg_1", "/", "255.0", "*", "5.0", ")", "arg_5", "=", "round", "(", "arg_2", "/", "255.0", "*", "5.0", ")", "arg_6", "=", "16", "+", "arg_3", "+", "arg_4", "+", "arg_5", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Convert RGB to ANSI 256 color\n    \"\"\"\n    if arg_0 == arg_1 and arg_1 == arg_2:\n        if arg_0 < 8:\n            return 16\n        if arg_0 > 248:\n            return 231\n\n        return round(((arg_0 - 8) / 247.0) * 24) + 232\n\n    arg_3 = 36 * round(arg_0 / 255.0 * 5.0)\n    arg_4 = 6 * round(arg_1 / 255.0 * 5.0)\n    arg_5 = round(arg_2 / 255.0 * 5.0)\n    arg_6 = 16 + arg_3 + arg_4 + arg_5\n    return arg_6", "path": "colorful/ansi.py", "identifier": "rgb_to_ansi256", "docstring": "Convert RGB to ANSI 256 color", "docstring_tokens": ["Convert", "RGB", "to", "ANSI", "256", "color"], "nwo": "timofurrer/colorful", "score": 0.585749501312285, "idx": 252895}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/search.py#L253-L274", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Uses glob to find all files or folders that match the regex\n    starting from the base_directory.", "language": "python", "parameters": "(base_directory, regex='')", "return_statement": "return files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "glob", "(", "op", ".", "join", "(", "arg_0", ",", "arg_1", ")", ")", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "os", ".", "walk", "(", "arg_0", ")", ":", "for", "arg_6", "in", "arg_4", ":", "arg_2", ".", "extend", "(", "glob", "(", "op", ".", "join", "(", "arg_3", ",", "arg_6", ",", "arg_1", ")", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=''):\n    \"\"\"\n    Uses glob to find all files or folders that match the regex\n    starting from the base_directory.\n\n    Parameters\n    ----------\n    base_directory: str\n\n    regex: str\n\n    Returns\n    -------\n    files: list\n\n    \"\"\"\n    arg_2 = glob(op.join(arg_0, arg_1))\n    for arg_3, arg_4, arg_5 in os.walk(arg_0):\n        for arg_6 in arg_4:\n            arg_2.extend(glob(op.join(arg_3, arg_6, arg_1)))\n\n    return arg_2", "path": "boyle/files/search.py", "identifier": "recursive_glob", "docstring": "Uses glob to find all files or folders that match the regex\n    starting from the base_directory.\n\n    Parameters\n    ----------\n    base_directory: str\n\n    regex: str\n\n    Returns\n    -------\n    files: list", "docstring_tokens": ["Uses", "glob", "to", "find", "all", "files", "or", "folders", "that", "match", "the", "regex", "starting", "from", "the", "base_directory", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 252896}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/aio/async_message.py#L44-L63", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Renew the message lock.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ".", "_receiver", ",", "'locked_until'", ")", ":", "raise", "TypeError", "(", "\"Session messages cannot be renewed. Please renew the Session lock instead.\"", ")", "arg_0", ".", "_is_live", "(", "'renew'", ")", "arg_1", "=", "await", "arg_0", ".", "_receiver", ".", "_Funcs", "(", "arg_0", ".", "lock_token", ")", "arg_0", ".", "_expiry", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "arg_1", "[", "b'expirations'", "]", "[", "0", "]", "/", "1000.0", ")"], "function": "async def Func(arg_0):\n        \"\"\"Renew the message lock.\n\n        This will maintain the lock on the message to ensure\n        it is not returned to the queue to be reprocessed. In order to complete (or otherwise settle)\n        the message, the lock must be maintained. Messages received via ReceiveAndDelete mode are not\n        locked, and therefore cannot be renewed. This operation can also be performed as an asynchronous\n        background task by registering the message with an `azure.servicebus.aio.AutoLockRenew` instance.\n        This operation is only available for non-sessionful messages.\n\n        :raises: TypeError if the message is sessionful.\n        :raises: ~azure.servicebus.common.errors.MessageLockExpired is message lock has already expired.\n        :raises: ~azure.servicebus.common.errors.SessionLockExpired if session lock has already expired.\n        :raises: ~azure.servicebus.common.errors.MessageAlreadySettled is message has already been settled.\n        \"\"\"\n        if hasattr(arg_0._receiver, 'locked_until'):\n            raise TypeError(\"Session messages cannot be renewed. Please renew the Session lock instead.\")\n        arg_0._is_live('renew')\n        arg_1 = await arg_0._receiver._Funcs(arg_0.lock_token)  # pylint: disable=protected-access\n        arg_0._expiry = datetime.datetime.fromtimestamp(arg_1[b'expirations'][0]/1000.0)", "path": "azure-servicebus/azure/servicebus/aio/async_message.py", "identifier": "Message.renew_lock", "docstring": "Renew the message lock.\n\n        This will maintain the lock on the message to ensure\n        it is not returned to the queue to be reprocessed. In order to complete (or otherwise settle)\n        the message, the lock must be maintained. Messages received via ReceiveAndDelete mode are not\n        locked, and therefore cannot be renewed. This operation can also be performed as an asynchronous\n        background task by registering the message with an `azure.servicebus.aio.AutoLockRenew` instance.\n        This operation is only available for non-sessionful messages.\n\n        :raises: TypeError if the message is sessionful.\n        :raises: ~azure.servicebus.common.errors.MessageLockExpired is message lock has already expired.\n        :raises: ~azure.servicebus.common.errors.SessionLockExpired if session lock has already expired.\n        :raises: ~azure.servicebus.common.errors.MessageAlreadySettled is message has already been settled.", "docstring_tokens": ["Renew", "the", "message", "lock", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252897}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process.py#L739-L755", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Adds secondary inputs to the start of the pipeline.", "language": "python", "parameters": "(self, channel_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"Setting secondary inputs: {}\"", ".", "format", "(", "arg_1", ")", ")", "arg_2", "=", "\"\\n\"", ".", "join", "(", "list", "(", "arg_1", ".", "values", "(", ")", ")", ")", "arg_0", ".", "_context", "=", "{", "**", "arg_0", ".", "_context", ",", "**", "{", "\"secondary_inputs\"", ":", "arg_2", "}", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Adds secondary inputs to the start of the pipeline.\n\n        This channels are inserted into the pipeline file as they are\n        provided in the values of the argument.\n\n        Parameters\n        ----------\n        channel_dict : dict\n            Each entry should be <parameter>: <channel string>.\n        \"\"\"\n\n        logger.debug(\"Setting secondary inputs: {}\".format(arg_1))\n\n        arg_2 = \"\\n\".join(list(arg_1.values()))\n        arg_0._context = {**arg_0._context,\n                         **{\"secondary_inputs\": arg_2}}", "path": "flowcraft/generator/process.py", "identifier": "Init.set_secondary_inputs", "docstring": "Adds secondary inputs to the start of the pipeline.\n\n        This channels are inserted into the pipeline file as they are\n        provided in the values of the argument.\n\n        Parameters\n        ----------\n        channel_dict : dict\n            Each entry should be <parameter>: <channel string>.", "docstring_tokens": ["Adds", "secondary", "inputs", "to", "the", "start", "of", "the", "pipeline", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 252898}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L1376-L1383", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Produce hex dump of all data containing the bits\n        from pos to stream.pos", "language": "python", "parameters": "(self, pos)", "return_statement": "return ''.join(map('{:02x} '.format,\n            self.stream.data[firstAddress:lastAddress]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "+", "7", ">>", "3", "arg_3", "=", "arg_0", ".", "stream", ".", "pos", "+", "7", ">>", "3", "return", "''", ".", "join", "(", "map", "(", "'{:02x} '", ".", "format", ",", "arg_0", ".", "stream", ".", "data", "[", "arg_2", ":", "arg_3", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Produce hex dump of all data containing the bits\n        from pos to stream.pos\n        \"\"\"\n        arg_2 = arg_1+7>>3\n        arg_3 = arg_0.stream.pos+7>>3\n        return ''.join(map('{:02x} '.format,\n            arg_0.stream.data[arg_2:arg_3]))", "path": "research/brotlidump.py", "identifier": "Layout.makeHexData", "docstring": "Produce hex dump of all data containing the bits\n        from pos to stream.pos", "docstring_tokens": ["Produce", "hex", "dump", "of", "all", "data", "containing", "the", "bits", "from", "pos", "to", "stream", ".", "pos"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 252899}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/fmt.py#L54-L60", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "recurs into list for indentation", "language": "python", "parameters": "(lst: list, indent: int=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "1", ")", ":", "for", "arg_4", "in", "arg_0", ":", "if", "isinstance", "(", "arg_4", ",", "indentable", ")", ":", "arg_4", ".", "set_indent", "(", "arg_2", ")", "if", "isinstance", "(", "arg_4", ",", "arg_1", ")", ":", "Func", "(", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3=1):\n    \"\"\"recurs into list for indentation\"\"\"\n    for arg_4 in arg_0:\n        if isinstance(arg_4, indentable):\n            arg_4.set_indent(arg_2)\n        if isinstance(arg_4, arg_1):\n            Func(arg_4, arg_2)", "path": "pyrser/fmt.py", "identifier": "list_set_indent", "docstring": "recurs into list for indentation", "docstring_tokens": ["recurs", "into", "list", "for", "indentation"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 252900}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L37-L74", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Extracts the X.509 certificates from the server handshake bytes for use\n    when debugging", "language": "python", "parameters": "(server_handshake_bytes)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "None", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "parse_tls_records", "(", "arg_0", ")", ":", "if", "arg_3", "!=", "b'\\x16'", ":", "continue", "for", "arg_6", ",", "arg_7", "in", "parse_handshake_messages", "(", "arg_5", ")", ":", "if", "arg_6", "==", "b'\\x0b'", ":", "arg_2", "=", "arg_7", "break", "if", "arg_2", ":", "break", "if", "arg_2", ":", "arg_8", "=", "3", "while", "arg_8", "<", "len", "(", "arg_2", ")", ":", "arg_9", "=", "int_from_bytes", "(", "arg_2", "[", "arg_8", ":", "arg_8", "+", "3", "]", ")", "arg_10", "=", "arg_8", "+", "3", "arg_11", "=", "arg_10", "+", "arg_9", "arg_8", "=", "arg_11", "arg_12", "=", "arg_2", "[", "arg_10", ":", "arg_11", "]", "arg_1", ".", "append", "(", "Certificate", ".", "load", "(", "arg_12", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Extracts the X.509 certificates from the server handshake bytes for use\n    when debugging\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        A list of asn1crypto.x509.Certificate objects\n    \"\"\"\n\n    arg_1 = []\n\n    arg_2 = None\n\n    for arg_3, arg_4, arg_5 in parse_tls_records(arg_0):\n        if arg_3 != b'\\x16':\n            continue\n        for arg_6, arg_7 in parse_handshake_messages(arg_5):\n            if arg_6 == b'\\x0b':\n                arg_2 = arg_7\n                break\n        if arg_2:\n            break\n\n    if arg_2:\n        # The first 3 bytes are the cert chain length\n        arg_8 = 3\n        while arg_8 < len(arg_2):\n            arg_9 = int_from_bytes(arg_2[arg_8:arg_8 + 3])\n            arg_10 = arg_8 + 3\n            arg_11 = arg_10 + arg_9\n            arg_8 = arg_11\n            arg_12 = arg_2[arg_10:arg_11]\n            arg_1.append(Certificate.load(arg_12))\n\n    return arg_1", "path": "oscrypto/_tls.py", "identifier": "extract_chain", "docstring": "Extracts the X.509 certificates from the server handshake bytes for use\n    when debugging\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        A list of asn1crypto.x509.Certificate objects", "docstring_tokens": ["Extracts", "the", "X", ".", "509", "certificates", "from", "the", "server", "handshake", "bytes", "for", "use", "when", "debugging"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 252901}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmodels/sinusoidal.py#L77-L114", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This returns the residual between the model mags and the actual mags.", "language": "python", "parameters": "(fourierparams, times, mags, errs)", "return_statement": "return (pmags - modelmags)/perrs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "(", "fourier_sinusoidal_func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", "return", "(", "arg_7", "-", "arg_4", ")", "/", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''\n    This returns the residual between the model mags and the actual mags.\n\n    Parameters\n    ----------\n\n    fourierparams : list\n        This MUST be a list of the following form like so::\n\n            [period,\n             epoch,\n             [amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],\n             [phase_1, phase_2, phase_3, ..., phase_X]]\n\n        where X is the Fourier order.\n\n    times,mags,errs : np.array\n        The input time-series of measurements and associated errors for which\n        the model will be generated. The times will be used to generate model\n        mags, and the input `times`, `mags`, and `errs` will be resorted by\n        model phase and returned.\n\n    Returns\n    -------\n\n    np.array\n        The residuals between the input `mags` and generated `modelmags`,\n        weighted by the measurement errors in `errs`.\n\n\n    '''\n    arg_4, arg_5, arg_6, arg_7, arg_8 = (\n        fourier_sinusoidal_func(arg_0, arg_1, arg_2, arg_3)\n    )\n\n    # this is now a weighted residual taking into account the measurement err\n    return (arg_7 - arg_4)/arg_8", "path": "astrobase/lcmodels/sinusoidal.py", "identifier": "fourier_sinusoidal_residual", "docstring": "This returns the residual between the model mags and the actual mags.\n\n    Parameters\n    ----------\n\n    fourierparams : list\n        This MUST be a list of the following form like so::\n\n            [period,\n             epoch,\n             [amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],\n             [phase_1, phase_2, phase_3, ..., phase_X]]\n\n        where X is the Fourier order.\n\n    times,mags,errs : np.array\n        The input time-series of measurements and associated errors for which\n        the model will be generated. The times will be used to generate model\n        mags, and the input `times`, `mags`, and `errs` will be resorted by\n        model phase and returned.\n\n    Returns\n    -------\n\n    np.array\n        The residuals between the input `mags` and generated `modelmags`,\n        weighted by the measurement errors in `errs`.", "docstring_tokens": ["This", "returns", "the", "residual", "between", "the", "model", "mags", "and", "the", "actual", "mags", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 252902}
{"url": "https://github.com/jjangsangy/py-translate/blob/fe6279b2ee353f42ce73333ffae104e646311956/translate/coroutines.py#L183-L204", "sha": "fe6279b2ee353f42ce73333ffae104e646311956", "docstring_summary": "Coroutine starting point. Produces text stream and forwards to consumers", "language": "python", "parameters": "(target, inputstream=sys.stdin)", "return_statement": "return target.close()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "stdin", ")", ":", "for", "arg_4", "in", "arg_1", ":", "while", "len", "(", "arg_4", ")", ">", "600", ":", "arg_5", ",", "arg_6", ",", "arg_4", "=", "arg_4", ".", "partition", "(", "' '", ")", "assert", "len", "(", "arg_5", ")", "<=", "600", "arg_0", ".", "send", "(", "''", ".", "join", "(", "[", "arg_5", ",", "arg_6", "]", ")", ")", "arg_0", ".", "send", "(", "arg_4", ")", "arg_1", ".", "close", "(", ")", "return", "arg_0", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1=arg_2.stdin):\n    \"\"\"\n    Coroutine starting point. Produces text stream and forwards to consumers\n\n    :param target: Target coroutine consumer\n    :type target: Coroutine\n\n    :param inputstream: Input Source\n    :type inputstream: BufferedTextIO Object\n    \"\"\"\n    for arg_4 in arg_1:\n\n        while len(arg_4) > 600:\n            arg_5, arg_6, arg_4 = arg_4.partition(' ')\n            assert len(arg_5) <= 600\n            arg_0.send(''.join([arg_5, arg_6]))\n\n        arg_0.send(arg_4)\n\n    arg_1.close()\n\n    return arg_0.close()", "path": "translate/coroutines.py", "identifier": "source", "docstring": "Coroutine starting point. Produces text stream and forwards to consumers\n\n    :param target: Target coroutine consumer\n    :type target: Coroutine\n\n    :param inputstream: Input Source\n    :type inputstream: BufferedTextIO Object", "docstring_tokens": ["Coroutine", "starting", "point", ".", "Produces", "text", "stream", "and", "forwards", "to", "consumers"], "nwo": "jjangsangy/py-translate", "score": 0.4707749115306036, "idx": 252903}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L635-L663", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Returns True if `arg_name` might be a valid parameter for `fn_or_cls`.", "language": "python", "parameters": "(fn_or_cls, arg_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "inspect", ".", "isclass", "(", "arg_0", ")", ":", "arg_2", "=", "_find_class_construction_fn", "(", "arg_0", ")", "else", ":", "arg_2", "=", "arg_0", "while", "hasattr", "(", "arg_2", ",", "'__wrapped__'", ")", ":", "arg_2", "=", "arg_2", ".", "__wrapped__", "arg_3", "=", "_get_cached_arg_spec", "(", "arg_2", ")", "if", "six", ".", "PY3", ":", "if", "arg_3", ".", "varkw", ":", "return", "True", "return", "arg_1", "in", "arg_3", ".", "args", "or", "arg_1", "in", "arg_3", ".", "kwonlyargs", "else", ":", "if", "arg_3", ".", "keywords", ":", "return", "True", "return", "arg_1", "in", "arg_3", ".", "args"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Returns True if `arg_name` might be a valid parameter for `fn_or_cls`.\n\n  Specifically, this means that `fn_or_cls` either has a parameter named\n  `arg_name`, or has a `**kwargs` parameter.\n\n  Args:\n    fn_or_cls: The function or class to check.\n    arg_name: The name fo the parameter.\n\n  Returns:\n    Whether `arg_name` might be a valid argument of `fn`.\n  \"\"\"\n  if inspect.isclass(arg_0):\n    arg_2 = _find_class_construction_fn(arg_0)\n  else:\n    arg_2 = arg_0\n\n  while hasattr(arg_2, '__wrapped__'):\n    arg_2 = arg_2.__wrapped__\n  arg_3 = _get_cached_arg_spec(arg_2)\n  if six.PY3:\n    if arg_3.varkw:\n      return True\n    return arg_1 in arg_3.args or arg_1 in arg_3.kwonlyargs\n  else:\n    if arg_3.keywords:\n      return True\n    return arg_1 in arg_3.args", "path": "gin/config.py", "identifier": "_might_have_parameter", "docstring": "Returns True if `arg_name` might be a valid parameter for `fn_or_cls`.\n\n  Specifically, this means that `fn_or_cls` either has a parameter named\n  `arg_name`, or has a `**kwargs` parameter.\n\n  Args:\n    fn_or_cls: The function or class to check.\n    arg_name: The name fo the parameter.\n\n  Returns:\n    Whether `arg_name` might be a valid argument of `fn`.", "docstring_tokens": ["Returns", "True", "if", "arg_name", "might", "be", "a", "valid", "parameter", "for", "fn_or_cls", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 252904}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L2415-L2498", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Verifies an RSA, DSA or ECDSA signature via CNG", "language": "python", "parameters": "(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "if", "arg_3", "==", "'raw'", ":", "arg_5", "=", "arg_2", "else", ":", "arg_6", "=", "{", "'md5'", ":", "BcryptConst", ".", "BCRYPT_MD5_ALGORITHM", ",", "'sha1'", ":", "BcryptConst", ".", "BCRYPT_SHA1_ALGORITHM", ",", "'sha256'", ":", "BcryptConst", ".", "BCRYPT_SHA256_ALGORITHM", ",", "'sha384'", ":", "BcryptConst", ".", "BCRYPT_SHA384_ALGORITHM", ",", "'sha512'", ":", "BcryptConst", ".", "BCRYPT_SHA512_ALGORITHM", "}", "[", "arg_3", "]", "arg_5", "=", "getattr", "(", "hashlib", ",", "arg_3", ")", "(", "arg_2", ")", ".", "digest", "(", ")", "arg_7", "=", "null", "(", ")", "arg_8", "=", "0", "if", "arg_0", ".", "algorithm", "==", "'rsa'", ":", "if", "arg_4", ":", "arg_8", "=", "BcryptConst", ".", "BCRYPT_PAD_PSS", "arg_9", "=", "struct", "(", "bcrypt", ",", "'BCRYPT_PSS_PADDING_INFO'", ")", "arg_10", "=", "unwrap", "(", "arg_9", ")", "arg_11", "=", "buffer_from_unicode", "(", "arg_6", ")", "arg_10", ".", "pszAlgId", "=", "cast", "(", "bcrypt", ",", "'wchar_t *'", ",", "arg_11", ")", "arg_10", ".", "cbSalt", "=", "len", "(", "arg_5", ")", "else", ":", "arg_8", "=", "BcryptConst", ".", "BCRYPT_PAD_PKCS1", "arg_9", "=", "struct", "(", "bcrypt", ",", "'BCRYPT_PKCS1_PADDING_INFO'", ")", "arg_10", "=", "unwrap", "(", "arg_9", ")", "if", "arg_3", "==", "'raw'", ":", "arg_10", ".", "pszAlgId", "=", "null", "(", ")", "else", ":", "arg_11", "=", "buffer_from_unicode", "(", "arg_6", ")", "arg_10", ".", "pszAlgId", "=", "cast", "(", "bcrypt", ",", "'wchar_t *'", ",", "arg_11", ")", "arg_7", "=", "cast", "(", "bcrypt", ",", "'void *'", ",", "arg_9", ")", "else", ":", "try", ":", "arg_1", "=", "algos", ".", "DSASignature", ".", "load", "(", "arg_1", ")", ".", "to_p1363", "(", ")", "except", "(", "ValueError", ",", "OverflowError", ",", "TypeError", ")", ":", "raise", "SignatureError", "(", "'Signature is invalid'", ")", "arg_14", "=", "bcrypt", ".", "BCryptVerifySignature", "(", "arg_0", ".", "key_handle", ",", "arg_7", ",", "arg_5", ",", "len", "(", "arg_5", ")", ",", "arg_1", ",", "len", "(", "arg_1", ")", ",", "arg_8", ")", "arg_15", "=", "arg_14", "==", "BcryptConst", ".", "STATUS_INVALID_SIGNATURE", "arg_15", "=", "arg_15", "or", "arg_14", "==", "BcryptConst", ".", "STATUS_INVALID_PARAMETER", "if", "arg_15", ":", "raise", "SignatureError", "(", "'Signature is invalid'", ")", "handle_error", "(", "arg_14", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):\n    \"\"\"\n    Verifies an RSA, DSA or ECDSA signature via CNG\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to verify the signature with\n\n    :param signature:\n        A byte string of the signature to verify\n\n    :param data:\n        A byte string of the data the signature is for\n\n    :param hash_algorithm:\n        A unicode string of \"md5\", \"sha1\", \"sha256\", \"sha384\", \"sha512\" or \"raw\"\n\n    :param rsa_pss_padding:\n        If PSS padding should be used for RSA keys\n\n    :raises:\n        oscrypto.errors.SignatureError - when the signature is determined to be invalid\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library\n    \"\"\"\n\n    if arg_3 == 'raw':\n        arg_5 = arg_2\n    else:\n        arg_6 = {\n            'md5': BcryptConst.BCRYPT_MD5_ALGORITHM,\n            'sha1': BcryptConst.BCRYPT_SHA1_ALGORITHM,\n            'sha256': BcryptConst.BCRYPT_SHA256_ALGORITHM,\n            'sha384': BcryptConst.BCRYPT_SHA384_ALGORITHM,\n            'sha512': BcryptConst.BCRYPT_SHA512_ALGORITHM\n        }[arg_3]\n        arg_5 = getattr(hashlib, arg_3)(arg_2).digest()\n\n    arg_7 = null()\n    arg_8 = 0\n\n    if arg_0.algorithm == 'rsa':\n        if arg_4:\n            arg_8 = BcryptConst.BCRYPT_PAD_PSS\n            arg_9 = struct(bcrypt, 'BCRYPT_PSS_PADDING_INFO')\n            arg_10 = unwrap(arg_9)\n            # This has to be assigned to a variable to prevent cffi from gc'ing it\n            arg_11 = buffer_from_unicode(arg_6)\n            arg_10.pszAlgId = cast(bcrypt, 'wchar_t *', arg_11)\n            arg_10.cbSalt = len(arg_5)\n        else:\n            arg_8 = BcryptConst.BCRYPT_PAD_PKCS1\n            arg_9 = struct(bcrypt, 'BCRYPT_PKCS1_PADDING_INFO')\n            arg_10 = unwrap(arg_9)\n            # This has to be assigned to a variable to prevent cffi from gc'ing it\n            if arg_3 == 'raw':\n                arg_10.pszAlgId = null()\n            else:\n                arg_11 = buffer_from_unicode(arg_6)\n                arg_10.pszAlgId = cast(bcrypt, 'wchar_t *', arg_11)\n        arg_7 = cast(bcrypt, 'void *', arg_9)\n    else:\n        # Windows doesn't use the ASN.1 Sequence for DSA/ECDSA signatures,\n        # so we have to convert it here for the verification to work\n        try:\n            arg_1 = algos.DSASignature.load(arg_1).to_p1363()\n        except (ValueError, OverflowError, TypeError):\n            raise SignatureError('Signature is invalid')\n\n    arg_14 = bcrypt.BCryptVerifySignature(\n        arg_0.key_handle,\n        arg_7,\n        arg_5,\n        len(arg_5),\n        arg_1,\n        len(arg_1),\n        arg_8\n    )\n    arg_15 = arg_14 == BcryptConst.STATUS_INVALID_SIGNATURE\n    arg_15 = arg_15 or arg_14 == BcryptConst.STATUS_INVALID_PARAMETER\n    if arg_15:\n        raise SignatureError('Signature is invalid')\n\n    handle_error(arg_14)", "path": "oscrypto/_win/asymmetric.py", "identifier": "_bcrypt_verify", "docstring": "Verifies an RSA, DSA or ECDSA signature via CNG\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to verify the signature with\n\n    :param signature:\n        A byte string of the signature to verify\n\n    :param data:\n        A byte string of the data the signature is for\n\n    :param hash_algorithm:\n        A unicode string of \"md5\", \"sha1\", \"sha256\", \"sha384\", \"sha512\" or \"raw\"\n\n    :param rsa_pss_padding:\n        If PSS padding should be used for RSA keys\n\n    :raises:\n        oscrypto.errors.SignatureError - when the signature is determined to be invalid\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library", "docstring_tokens": ["Verifies", "an", "RSA", "DSA", "or", "ECDSA", "signature", "via", "CNG"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 252905}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/linear_gaussian_ssm.py#L1097-L1145", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Push latent means and covariances forward through the observation model.", "language": "python", "parameters": "(self, latent_means, latent_covs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "tf", ".", "name_scope", "(", "\"Func\"", ")", ":", "arg_3", "=", "build_pushforward_latents_step", "(", "arg_0", ".", "get_observation_matrix_for_timestep", ",", "arg_0", ".", "get_observation_noise_for_timestep", ")", "arg_1", "=", "distribution_util", ".", "move_dimension", "(", "arg_1", ",", "source_idx", "=", "-", "2", ",", "dest_idx", "=", "0", ")", "arg_1", "=", "arg_1", "[", "...", ",", "tf", ".", "newaxis", "]", "arg_2", "=", "distribution_util", ".", "move_dimension", "(", "arg_2", ",", "source_idx", "=", "-", "3", ",", "dest_idx", "=", "0", ")", "(", "arg_4", ",", "arg_5", ")", "=", "arg_3", "(", "_", "=", "None", ",", "latent_t_mean_cov", "=", "(", "arg_0", ".", "initial_step", ",", "arg_1", "[", "arg_0", ".", "initial_step", "]", ",", "arg_2", "[", "arg_0", ".", "initial_step", "]", ")", ")", "arg_6", "=", "tf", ".", "range", "(", "arg_0", ".", "initial_step", ",", "arg_0", ".", "initial_step", "+", "arg_0", ".", "num_timesteps", ")", "arg_7", ",", "arg_8", "=", "tf", ".", "scan", "(", "arg_3", ",", "elems", "=", "(", "arg_6", ",", "arg_1", ",", "arg_2", ")", ",", "initializer", "=", "(", "arg_4", ",", "arg_5", ")", ",", "parallel_iterations", "=", "10000", ")", "arg_7", "=", "distribution_util", ".", "move_dimension", "(", "arg_7", "[", "...", ",", "0", "]", ",", "source_idx", "=", "0", ",", "dest_idx", "=", "-", "2", ")", "arg_8", "=", "distribution_util", ".", "move_dimension", "(", "arg_8", ",", "source_idx", "=", "0", ",", "dest_idx", "=", "-", "3", ")", "return", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Push latent means and covariances forward through the observation model.\n\n    Args:\n      latent_means: float `Tensor` of shape `[..., num_timesteps, latent_size]`\n      latent_covs: float `Tensor` of shape\n        `[..., num_timesteps, latent_size, latent_size]`.\n\n    Returns:\n      observation_means: float `Tensor` of shape\n        `[..., num_timesteps, observation_size]`\n      observation_covs: float `Tensor` of shape\n        `[..., num_timesteps, observation_size, observation_size]`\n    \"\"\"\n\n    with tf.name_scope(\"Func\"):\n\n      arg_3 = build_pushforward_latents_step(\n          arg_0.get_observation_matrix_for_timestep,\n          arg_0.get_observation_noise_for_timestep)\n\n      arg_1 = distribution_util.move_dimension(\n          arg_1, source_idx=-2, dest_idx=0)\n      arg_1 = arg_1[..., tf.newaxis]  # Make matmul happy.\n      arg_2 = distribution_util.move_dimension(\n          arg_2, source_idx=-3, dest_idx=0)\n\n      (arg_4,\n       arg_5) = arg_3(\n           _=None,  # Loop body ignores previous observations.\n           latent_t_mean_cov=(arg_0.initial_step,\n                              arg_1[arg_0.initial_step],\n                              arg_2[arg_0.initial_step]))\n\n      # TODO(davmre) this loop is embarassingly parallel; replace with `pfor`.\n      arg_6 = tf.range(arg_0.initial_step,\n                           arg_0.initial_step + arg_0.num_timesteps)\n      arg_7, arg_8 = tf.scan(\n          arg_3,\n          elems=(arg_6, arg_1, arg_2),\n          initializer=(arg_4, arg_5),\n          parallel_iterations=10000)\n\n      arg_7 = distribution_util.move_dimension(\n          arg_7[..., 0], source_idx=0, dest_idx=-2)\n      arg_8 = distribution_util.move_dimension(\n          arg_8, source_idx=0, dest_idx=-3)\n\n      return arg_7, arg_8", "path": "tensorflow_probability/python/distributions/linear_gaussian_ssm.py", "identifier": "LinearGaussianStateSpaceModel.latents_to_observations", "docstring": "Push latent means and covariances forward through the observation model.\n\n    Args:\n      latent_means: float `Tensor` of shape `[..., num_timesteps, latent_size]`\n      latent_covs: float `Tensor` of shape\n        `[..., num_timesteps, latent_size, latent_size]`.\n\n    Returns:\n      observation_means: float `Tensor` of shape\n        `[..., num_timesteps, observation_size]`\n      observation_covs: float `Tensor` of shape\n        `[..., num_timesteps, observation_size, observation_size]`", "docstring_tokens": ["Push", "latent", "means", "and", "covariances", "forward", "through", "the", "observation", "model", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252906}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L1180-L1226", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Collect all verified variants in a list on institutes and save them to file", "language": "python", "parameters": "(store, institute_list, temp_excel_dir)", "return_statement": "return written_files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "0", "arg_5", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "'%Y-%m-%d'", ")", "LOG", ".", "info", "(", "'Creating verified variant document..'", ")", "for", "arg_6", "in", "arg_1", ":", "arg_7", "=", "arg_0", ".", "verified", "(", "institute_id", "=", "arg_6", ")", "LOG", ".", "info", "(", "'Found {} verified variants for customer {}'", ".", "format", "(", "len", "(", "arg_7", ")", ",", "arg_6", ")", ")", "if", "not", "arg_7", ":", "continue", "arg_8", "=", "set", "(", ")", "for", "arg_9", ",", "arg_10", "in", "CALLERS", ".", "items", "(", ")", ":", "for", "arg_11", "in", "arg_10", ":", "arg_8", ".", "add", "(", "arg_11", ".", "get", "(", "'id'", ")", ")", "arg_12", "=", "export_verified_variants", "(", "arg_7", ",", "arg_8", ")", "arg_13", "=", "'.'", ".", "join", "(", "[", "arg_6", ",", "'_verified_variants'", ",", "arg_5", "]", ")", "+", "'.xlsx'", "arg_14", "=", "Workbook", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_13", ")", ")", "arg_15", "=", "arg_14", ".", "add_worksheet", "(", ")", "arg_16", "=", "0", "for", "arg_17", ",", "arg_18", "in", "enumerate", "(", "VERIFIED_VARIANTS_HEADER", "+", "list", "(", "arg_8", ")", ")", ":", "arg_15", ".", "write", "(", "arg_16", ",", "arg_17", ",", "arg_18", ")", "for", "arg_16", ",", "arg_19", "in", "enumerate", "(", "arg_12", ",", "1", ")", ":", "for", "arg_17", ",", "arg_18", "in", "enumerate", "(", "arg_19", ")", ":", "arg_15", ".", "write", "(", "arg_16", ",", "arg_17", ",", "arg_18", ")", "arg_14", ".", "close", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_13", ")", ")", ":", "arg_4", "+=", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Collect all verified variants in a list on institutes and save them to file\n\n    Args:\n        store(adapter.MongoAdapter)\n        institute_list(list): a list of institute ids\n        temp_excel_dir(os.Path): folder where the temp excel files are written to\n\n    Returns:\n        written_files(int): the number of files written to temp_excel_dir\n    \"\"\"\n    arg_3 = []\n    arg_4 = 0\n    arg_5 = datetime.datetime.now().strftime('%Y-%m-%d')\n    LOG.info('Creating verified variant document..')\n\n    for arg_6 in arg_1:\n        arg_7 = arg_0.verified(institute_id=arg_6)\n        LOG.info('Found {} verified variants for customer {}'.format(len(arg_7), arg_6))\n\n        if not arg_7:\n            continue\n        arg_8 = set()\n        for arg_9, arg_10 in CALLERS.items():\n            for arg_11 in arg_10:\n                arg_8.add(arg_11.get('id'))\n        arg_12 = export_verified_variants(arg_7, arg_8)\n\n        arg_13 = '.'.join([arg_6, '_verified_variants', arg_5]) + '.xlsx'\n        arg_14 = Workbook(os.path.join(arg_2,arg_13))\n        arg_15 = arg_14.add_worksheet()\n\n        # Write the column header\n        arg_16 = 0\n        for arg_17,arg_18 in enumerate(VERIFIED_VARIANTS_HEADER + list(arg_8)):\n            arg_15.write(arg_16,arg_17,arg_18)\n\n        # Write variant lines, after header (start at line 1)\n        for arg_16, arg_19 in enumerate(arg_12,1): # each line becomes a row in the document\n            for arg_17, arg_18 in enumerate(arg_19): # each field in line becomes a cell\n                arg_15.write(arg_16,arg_17,arg_18)\n        arg_14.close()\n\n        if os.path.exists(os.path.join(arg_2,arg_13)):\n            arg_4 += 1\n\n    return arg_4", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "verified_excel_file", "docstring": "Collect all verified variants in a list on institutes and save them to file\n\n    Args:\n        store(adapter.MongoAdapter)\n        institute_list(list): a list of institute ids\n        temp_excel_dir(os.Path): folder where the temp excel files are written to\n\n    Returns:\n        written_files(int): the number of files written to temp_excel_dir", "docstring_tokens": ["Collect", "all", "verified", "variants", "in", "a", "list", "on", "institutes", "and", "save", "them", "to", "file"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252907}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mediawiki.py#L448-L460", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrieve all pages from a namespace starting from apcontinue.", "language": "python", "parameters": "(self, namespace, apcontinue='')", "return_statement": "return self.call(params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ")", ":", "arg_3", "=", "{", "\"action\"", ":", "\"query\"", ",", "\"list\"", ":", "\"allpages\"", ",", "\"aplimit\"", ":", "arg_0", ".", "limit", ",", "\"apnamespace\"", ":", "arg_1", ",", "\"format\"", ":", "\"json\"", "}", "if", "arg_2", ":", "arg_3", "[", "'apcontinue'", "]", "=", "arg_2", "return", "arg_0", ".", "call", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=''):\n        \"\"\"Retrieve all pages from a namespace starting from apcontinue.\"\"\"\n        arg_3 = {\n            \"action\": \"query\",\n            \"list\": \"allpages\",\n            \"aplimit\": arg_0.limit,\n            \"apnamespace\": arg_1,\n            \"format\": \"json\"\n        }\n        if arg_2:\n            arg_3['apcontinue'] = arg_2\n\n        return arg_0.call(arg_3)", "path": "perceval/backends/core/mediawiki.py", "identifier": "MediaWikiClient.get_pages", "docstring": "Retrieve all pages from a namespace starting from apcontinue.", "docstring_tokens": ["Retrieve", "all", "pages", "from", "a", "namespace", "starting", "from", "apcontinue", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 252908}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L494-L505", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get emojis from pagination", "language": "python", "parameters": "(self, item_type, item_id)", "return_statement": "return self.fetch_items(path, payload)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "'order_by'", ":", "'updated_at'", ",", "'sort'", ":", "'asc'", ",", "'per_page'", ":", "PER_PAGE", "}", "arg_4", "=", "urijoin", "(", "arg_1", ",", "str", "(", "arg_2", ")", ",", "GitLabClient", ".", "EMOJI", ")", "return", "arg_0", ".", "fetch_items", "(", "arg_4", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Get Func from pagination\"\"\"\n\n        arg_3 = {\n            'order_by': 'updated_at',\n            'sort': 'asc',\n            'per_page': PER_PAGE\n        }\n\n        arg_4 = urijoin(arg_1, str(arg_2), GitLabClient.EMOJI)\n\n        return arg_0.fetch_items(arg_4, arg_3)", "path": "perceval/backends/core/gitlab.py", "identifier": "GitLabClient.emojis", "docstring": "Get emojis from pagination", "docstring_tokens": ["Get", "emojis", "from", "pagination"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 252909}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py#L247-L253", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the notebook_id for a kernel_id or None.", "language": "python", "parameters": "(self, kernel_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "k", "for", "k", ",", "v", "in", "arg_0", ".", "_notebook_mapping", ".", "iteritems", "(", ")", "if", "v", "==", "arg_1", "]", "if", "len", "(", "arg_2", ")", "==", "1", ":", "return", "arg_2", "[", "0", "]", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the notebook_id for a kernel_id or None.\"\"\"\n        arg_2 = [k for k, v in arg_0._notebook_mapping.iteritems() if v == arg_1]\n        if len(arg_2) == 1:\n            return arg_2[0]\n        else:\n            return None", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py", "identifier": "MappingKernelManager.notebook_for_kernel", "docstring": "Return the notebook_id for a kernel_id or None.", "docstring_tokens": ["Return", "the", "notebook_id", "for", "a", "kernel_id", "or", "None", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252910}
{"url": "https://github.com/incuna/django-pgcrypto-fields/blob/406fddf0cbe9091ba71b97206d0f4719c0450ac1/pgcrypto/mixins.py#L58-L70", "sha": "406fddf0cbe9091ba71b97206d0f4719c0450ac1", "docstring_summary": "Tell postgres to encrypt this field with a hashing function.", "language": "python", "parameters": "(self, value=None, compiler=None, connection=None)", "return_statement": "return self.get_encrypt_sql(connection)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", "is", "None", "or", "arg_1", ".", "startswith", "(", "'\\\\x'", ")", ":", "return", "'%s'", "return", "arg_0", ".", "get_encrypt_sql", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"\n        Tell postgres to encrypt this field with a hashing function.\n\n        The `value` string is checked to determine if we need to hash or keep\n        the current value.\n\n        `compiler` and `connection` is ignored here as we don't need custom operators.\n        \"\"\"\n        if arg_1 is None or arg_1.startswith('\\\\x'):\n            return '%s'\n\n        return arg_0.get_encrypt_sql(arg_3)", "path": "pgcrypto/mixins.py", "identifier": "HashMixin.get_placeholder", "docstring": "Tell postgres to encrypt this field with a hashing function.\n\n        The `value` string is checked to determine if we need to hash or keep\n        the current value.\n\n        `compiler` and `connection` is ignored here as we don't need custom operators.", "docstring_tokens": ["Tell", "postgres", "to", "encrypt", "this", "field", "with", "a", "hashing", "function", "."], "nwo": "incuna/django-pgcrypto-fields", "score": 0.4638707833759358, "idx": 252911}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/experimental/fun_mcmc/fun_mcmc_lib.py#L87-L119", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "`TransitionOperator` that runs `fn` repeatedly and traces its outputs.", "language": "python", "parameters": "(state: State, fn: TransitionOperator, num_steps: IntTensor,\n          trace_fn: Callable[[State, TensorNest], TensorNest]\n         )", "return_statement": "return state, tf.nest.map_structure(prepend, first_trace, full_trace)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", ",", "arg_6", ":", "arg_7", "[", "[", "arg_1", ",", "arg_8", "]", ",", "arg_8", "]", ")", "->", "Tuple", "[", "arg_1", ",", "arg_8", "]", ":", "def", "fn_wrapper", "(", "arg_9", ",", "arg_10", ")", ":", "return", "tf", ".", "nest", ".", "map_structure", "(", "tf", ".", "convert_to_tensor", ",", "call_fn", "(", "arg_2", ",", "arg_9", "[", "0", "]", ")", ")", "def", "Func_fn_wrapper", "(", "arg_9", ")", ":", "return", "tf", ".", "nest", ".", "map_structure", "(", "tf", ".", "convert_to_tensor", ",", "call_fn", "(", "arg_6", ",", "arg_9", ")", ")", "arg_0", "=", "call_fn", "(", "arg_2", ",", "arg_0", ")", "arg_11", "=", "Func_fn_wrapper", "(", "arg_0", ")", "arg_0", ",", "arg_12", "=", "mcmc_util", ".", "Func_scan", "(", "fn_wrapper", ",", "arg_0", ",", "tf", ".", "ones", "(", "arg_4", "-", "1", ")", ",", "arg_6", "=", "Func_fn_wrapper", ")", "arg_13", "=", "lambda", "x", ",", "y", ":", "tf", ".", "concat", "(", "[", "tf", ".", "convert_to_tensor", "(", "value", "=", "x", ")", "[", "tf", ".", "newaxis", "]", ",", "y", "]", ",", "0", ")", "return", "arg_0", ",", "tf", ".", "nest", ".", "map_structure", "(", "arg_13", ",", "arg_11", ",", "arg_12", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5,\n          arg_6: arg_7[[arg_1, arg_8], arg_8]\n         ) -> Tuple[arg_1, arg_8]:\n  \"\"\"`TransitionOperator` that runs `fn` repeatedly and Funcs its outputs.\n\n  Args:\n    state: A nest of `Tensor`s or None.\n    fn: A `TransitionOperator`.\n    num_steps: Number of steps to run the function for. Must be greater than 1.\n    Func_fn: Callable that the unpacked outputs of `fn` and returns a nest of\n      `Tensor`s. These will be stacked and returned.\n\n  Returns:\n    state: The final state returned by `fn`.\n    Funcs: Stacked outputs of `Func_fn`.\n  \"\"\"\n\n  def fn_wrapper(arg_9, arg_10):\n    return tf.nest.map_structure(tf.convert_to_tensor, call_fn(arg_2, arg_9[0]))\n\n  def Func_fn_wrapper(arg_9):\n    return tf.nest.map_structure(tf.convert_to_tensor, call_fn(arg_6, arg_9))\n\n  arg_0 = call_fn(arg_2, arg_0)\n  arg_11 = Func_fn_wrapper(arg_0)\n\n  arg_0, arg_12 = mcmc_util.Func_scan(\n      fn_wrapper, arg_0, tf.ones(arg_4 - 1), arg_6=Func_fn_wrapper)\n\n  arg_13 = lambda x, y: tf.concat(  # pylint: disable=g-long-lambda\n      [tf.convert_to_tensor(value=x)[tf.newaxis], y], 0)\n\n  return arg_0, tf.nest.map_structure(arg_13, arg_11, arg_12)", "path": "experimental/fun_mcmc/fun_mcmc_lib.py", "identifier": "trace", "docstring": "`TransitionOperator` that runs `fn` repeatedly and traces its outputs.\n\n  Args:\n    state: A nest of `Tensor`s or None.\n    fn: A `TransitionOperator`.\n    num_steps: Number of steps to run the function for. Must be greater than 1.\n    trace_fn: Callable that the unpacked outputs of `fn` and returns a nest of\n      `Tensor`s. These will be stacked and returned.\n\n  Returns:\n    state: The final state returned by `fn`.\n    traces: Stacked outputs of `trace_fn`.", "docstring_tokens": ["TransitionOperator", "that", "runs", "fn", "repeatedly", "and", "traces", "its", "outputs", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252912}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/data.py#L141-L150", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Return the raw pickled data from `filename`.", "language": "python", "parameters": "(self, filename)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "debug", "and", "arg_0", ".", "debug", ".", "should", "(", "'dataio'", ")", ":", "arg_0", ".", "debug", ".", "write", "(", "\"Reading data from %r\"", "%", "(", "arg_1", ",", ")", ")", "arg_2", "=", "open", "(", "arg_1", ",", "'rb'", ")", "try", ":", "arg_3", "=", "pickle", ".", "load", "(", "arg_2", ")", "finally", ":", "arg_2", ".", "close", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the raw pickled data from `filename`.\"\"\"\n        if arg_0.debug and arg_0.debug.should('dataio'):\n            arg_0.debug.write(\"Reading data from %r\" % (arg_1,))\n        arg_2 = open(arg_1, 'rb')\n        try:\n            arg_3 = pickle.load(arg_2)\n        finally:\n            arg_2.close()\n        return arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/data.py", "identifier": "CoverageData.raw_data", "docstring": "Return the raw pickled data from `filename`.", "docstring_tokens": ["Return", "the", "raw", "pickled", "data", "from", "filename", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 252913}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L446-L467", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return url with updated query parameters.", "language": "python", "parameters": "(url, query_parameters)", "return_statement": "return urlunsplit(\n        (scheme, netloc, path, urlencode(sorted(url_params.items()), doseq=True), fragment),\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "urlsplit", "(", "arg_0", ")", "arg_7", "=", "parse_qs", "(", "arg_5", ")", "arg_7", ".", "update", "(", "arg_1", ")", "return", "urlunsplit", "(", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "urlencode", "(", "sorted", "(", "arg_7", ".", "items", "(", ")", ")", ",", "doseq", "=", "True", ")", ",", "arg_6", ")", ",", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Return url with updated query parameters.\n\n    Arguments:\n        url (str): Original url whose query parameters need to be updated.\n        query_parameters (dict): A dictionary containing query parameters to be added to course selection url.\n\n    Returns:\n        (slug): slug identifier for the identity provider that can be used for identity verification of\n            users associated the enterprise customer of the given user.\n\n    \"\"\"\n    arg_2, arg_3, arg_4, arg_5, arg_6 = urlsplit(arg_0)\n    arg_7 = parse_qs(arg_5)\n\n    # Update url query parameters\n    arg_7.update(arg_1)\n\n    return urlunsplit(\n        (arg_2, arg_3, arg_4, urlencode(sorted(arg_7.items()), doseq=True), arg_6),\n    )", "path": "enterprise/utils.py", "identifier": "update_query_parameters", "docstring": "Return url with updated query parameters.\n\n    Arguments:\n        url (str): Original url whose query parameters need to be updated.\n        query_parameters (dict): A dictionary containing query parameters to be added to course selection url.\n\n    Returns:\n        (slug): slug identifier for the identity provider that can be used for identity verification of\n            users associated the enterprise customer of the given user.", "docstring_tokens": ["Return", "url", "with", "updated", "query", "parameters", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252914}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_cosmos_hook.py#L124-L140", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks if a database exists in CosmosDB.", "language": "python", "parameters": "(self, database_name)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "AirflowBadRequest", "(", "\"Database name cannot be None.\"", ")", "arg_2", "=", "list", "(", "arg_0", ".", "get_conn", "(", ")", ".", "QueryDatabases", "(", "{", "\"query\"", ":", "\"SELECT * FROM r WHERE r.id=@id\"", ",", "\"parameters\"", ":", "[", "{", "\"name\"", ":", "\"@id\"", ",", "\"value\"", ":", "arg_1", "}", "]", "}", ")", ")", "if", "len", "(", "arg_2", ")", "==", "0", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Checks if a database exists in CosmosDB.\n        \"\"\"\n        if arg_1 is None:\n            raise AirflowBadRequest(\"Database name cannot be None.\")\n\n        arg_2 = list(arg_0.get_conn().QueryDatabases({\n            \"query\": \"SELECT * FROM r WHERE r.id=@id\",\n            \"parameters\": [\n                {\"name\": \"@id\", \"value\": arg_1}\n            ]\n        }))\n        if len(arg_2) == 0:\n            return False\n\n        return True", "path": "airflow/contrib/hooks/azure_cosmos_hook.py", "identifier": "AzureCosmosDBHook.does_database_exist", "docstring": "Checks if a database exists in CosmosDB.", "docstring_tokens": ["Checks", "if", "a", "database", "exists", "in", "CosmosDB", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252915}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L329-L339", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Set asset to fee", "language": "python", "parameters": "(self, fee_asset)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "arg_0", ".", "amount_class", ")", ":", "arg_0", ".", "fee_asset_id", "=", "arg_1", "[", "\"id\"", "]", "elif", "isinstance", "(", "arg_1", ",", "arg_0", ".", "asset_class", ")", ":", "arg_0", ".", "fee_asset_id", "=", "arg_1", "[", "\"id\"", "]", "elif", "arg_1", ":", "arg_0", ".", "fee_asset_id", "=", "arg_1", "else", ":", "arg_0", ".", "fee_asset_id", "=", "\"1.3.0\""], "function": "def Func(arg_0, arg_1):\n        \"\"\" Set asset to fee\n        \"\"\"\n        if isinstance(arg_1, arg_0.amount_class):\n            arg_0.fee_asset_id = arg_1[\"id\"]\n        elif isinstance(arg_1, arg_0.asset_class):\n            arg_0.fee_asset_id = arg_1[\"id\"]\n        elif arg_1:\n            arg_0.fee_asset_id = arg_1\n        else:\n            arg_0.fee_asset_id = \"1.3.0\"", "path": "graphenecommon/transactionbuilder.py", "identifier": "TransactionBuilder.set_fee_asset", "docstring": "Set asset to fee", "docstring_tokens": ["Set", "asset", "to", "fee"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 252916}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/plane.py#L371-L374", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Compute the yticks labels of this grid_stack, used for plotting the y-axis ticks when visualizing an image \\", "language": "python", "parameters": "(self)", "return_statement": "return np.linspace(np.amin(self.grid_stack.regular[:, 0]), np.amax(self.grid_stack.regular[:, 0]), 4)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "np", ".", "linspace", "(", "np", ".", "amin", "(", "arg_0", ".", "grid_stack", ".", "regular", "[", ":", ",", "0", "]", ")", ",", "np", ".", "amax", "(", "arg_0", ".", "grid_stack", ".", "regular", "[", ":", ",", "0", "]", ")", ",", "4", ")"], "function": "def Func(arg_0):\n        \"\"\"Compute the Func labels of this grid_stack, used for plotting the y-axis ticks when visualizing an image \\\n        \"\"\"\n        return np.linspace(np.amin(arg_0.grid_stack.regular[:, 0]), np.amax(arg_0.grid_stack.regular[:, 0]), 4)", "path": "autolens/lens/plane.py", "identifier": "AbstractGriddedPlane.yticks", "docstring": "Compute the yticks labels of this grid_stack, used for plotting the y-axis ticks when visualizing an image \\", "docstring_tokens": ["Compute", "the", "yticks", "labels", "of", "this", "grid_stack", "used", "for", "plotting", "the", "y", "-", "axis", "ticks", "when", "visualizing", "an", "image", "\\"], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 252917}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/node/id.py#L42-L54", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the correspond math mode latex string.", "language": "python", "parameters": "(self, prec=15, nested_scope=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "15", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "return", "\"\\textrm{\"", "+", "arg_0", ".", "name", "+", "\"}\"", "else", ":", "if", "arg_0", ".", "name", "not", "in", "arg_2", "[", "-", "1", "]", ":", "raise", "NodeException", "(", "\"Expected local parameter name: \"", ",", "\"name=%s, \"", "%", "arg_0", ".", "name", ",", "\"line=%s, \"", "%", "arg_0", ".", "line", ",", "\"file=%s\"", "%", "arg_0", ".", "file", ")", "else", ":", "return", "arg_2", "[", "-", "1", "]", "[", "arg_0", ".", "name", "]", ".", "Func", "(", "arg_1", ",", "arg_2", "[", "0", ":", "-", "1", "]", ")"], "function": "def Func(arg_0, arg_1=15, arg_2=None):\n        \"\"\"Return the correspond math mode Func string.\"\"\"\n        if not arg_2:\n            return \"\\textrm{\" + arg_0.name + \"}\"\n        else:\n            if arg_0.name not in arg_2[-1]:\n                raise NodeException(\"Expected local parameter name: \",\n                                    \"name=%s, \" % arg_0.name,\n                                    \"line=%s, \" % arg_0.line,\n                                    \"file=%s\" % arg_0.file)\n            else:\n                return arg_2[-1][arg_0.name].Func(arg_1,\n                                                         arg_2[0:-1])", "path": "qiskit/qasm/node/id.py", "identifier": "Id.latex", "docstring": "Return the correspond math mode latex string.", "docstring_tokens": ["Return", "the", "correspond", "math", "mode", "latex", "string", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252918}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/result.py#L94-L101", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Prepend msg to add some context information", "language": "python", "parameters": "(self, err_context, succ_context=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "err_context", "=", "arg_1", "arg_0", ".", "succ_context", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\" Prepend msg to add some context information\n\n    :param pmsg: context info\n    :return: None\n    \"\"\"\n    arg_0.err_context = arg_1\n    arg_0.succ_context = arg_2", "path": "heron/tools/cli/src/python/result.py", "identifier": "Result.add_context", "docstring": "Prepend msg to add some context information\n\n    :param pmsg: context info\n    :return: None", "docstring_tokens": ["Prepend", "msg", "to", "add", "some", "context", "information"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252919}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/id3.py#L779-L830", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Parse an ID3v1 tag, returning a list of ID3v2.4 frames.", "language": "python", "parameters": "(data)", "return_statement": "return frames", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", "=", "arg_0", "[", "arg_0", ".", "index", "(", "b'TAG'", ")", ":", "]", "except", "ValueError", ":", "return", "None", "if", "128", "<", "len", "(", "arg_0", ")", "or", "len", "(", "arg_0", ")", "<", "124", ":", "return", "None", "arg_1", "=", "\"3s30s30s30s%ds29sBB\"", "%", "(", "len", "(", "arg_0", ")", "-", "124", ")", "try", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "unpack", "(", "arg_1", ",", "arg_0", ")", "except", "StructError", ":", "return", "None", "if", "arg_2", "!=", "b\"TAG\"", ":", "return", "None", "def", "fix", "(", "arg_0", ")", ":", "return", "arg_0", ".", "split", "(", "b'\\x00'", ")", "[", "0", "]", ".", "strip", "(", ")", ".", "decode", "(", "'latin1'", ")", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "map", "(", "fix", ",", "[", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "]", ")", "arg_10", "=", "{", "}", "if", "arg_3", ":", "arg_10", "[", "'TIT2'", "]", "=", "TIT2", "(", "encoding", "=", "0", ",", "text", "=", "arg_3", ")", "if", "arg_4", ":", "arg_10", "[", "'TPE1'", "]", "=", "TPE1", "(", "encoding", "=", "0", ",", "text", "=", "[", "arg_4", "]", ")", "if", "arg_5", ":", "arg_10", "[", "'TALB'", "]", "=", "TALB", "(", "encoding", "=", "0", ",", "text", "=", "arg_5", ")", "if", "arg_6", ":", "arg_10", "[", "'TDRC'", "]", "=", "TDRC", "(", "encoding", "=", "0", ",", "text", "=", "arg_6", ")", "if", "arg_7", ":", "arg_10", "[", "'COMM'", "]", "=", "COMM", "(", "encoding", "=", "0", ",", "lang", "=", "'eng'", ",", "desc", "=", "\"ID3v1 Comment\"", ",", "text", "=", "arg_7", ")", "if", "arg_8", "and", "(", "(", "arg_8", "!=", "32", ")", "or", "(", "arg_0", "[", "-", "3", "]", "==", "b'\\x00'", "[", "0", "]", ")", ")", ":", "arg_10", "[", "'TRCK'", "]", "=", "TRCK", "(", "encoding", "=", "0", ",", "text", "=", "str", "(", "arg_8", ")", ")", "if", "arg_9", "!=", "255", ":", "arg_10", "[", "'TCON'", "]", "=", "TCON", "(", "encoding", "=", "0", ",", "text", "=", "str", "(", "arg_9", ")", ")", "return", "arg_10"], "function": "def Func(arg_0):\n    \"\"\"Parse an ID3v1 tag, returning a list of ID3v2.4 frames.\"\"\"\n\n    try:\n        arg_0 = arg_0[arg_0.index(b'TAG'):]\n    except ValueError:\n        return None\n    if 128 < len(arg_0) or len(arg_0) < 124:\n        return None\n\n    # Issue #69 - Previous versions of Mutagen, when encountering\n    # out-of-spec TDRC and TYER frames of less than four characters,\n    # wrote only the characters available - e.g. \"1\" or \"\" - into the\n    # year field. To parse those, reduce the size of the year field.\n    # Amazingly, \"0s\" works as a struct format string.\n    arg_1 = \"3s30s30s30s%ds29sBB\" % (len(arg_0) - 124)\n\n    try:\n        arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9 = unpack(\n            arg_1, arg_0)\n    except StructError:\n        return None\n\n    if arg_2 != b\"TAG\":\n        return None\n\n    def fix(arg_0):\n        return arg_0.split(b'\\x00')[0].strip().decode('latin1')\n\n    arg_3, arg_4, arg_5, arg_6, arg_7 = map(\n        fix, [arg_3, arg_4, arg_5, arg_6, arg_7])\n\n    arg_10 = {}\n    if arg_3:\n        arg_10['TIT2'] = TIT2(encoding=0, text=arg_3)\n    if arg_4:\n        arg_10['TPE1'] = TPE1(encoding=0, text=[arg_4])\n    if arg_5:\n        arg_10['TALB'] = TALB(encoding=0, text=arg_5)\n    if arg_6:\n        arg_10['TDRC'] = TDRC(encoding=0, text=arg_6)\n    if arg_7:\n        arg_10['COMM'] = COMM(encoding=0, lang='eng', desc=\"ID3v1 Comment\",\n                              text=arg_7)\n\n    # Don't read a track number if it looks like the comment was\n    # padded with spaces instead of nulls (thanks, WinAmp).\n    if arg_8 and ((arg_8 != 32) or (arg_0[-3] == b'\\x00'[0])):\n        arg_10['TRCK'] = TRCK(encoding=0, text=str(arg_8))\n    if arg_9 != 255:\n        arg_10['TCON'] = TCON(encoding=0, text=str(arg_9))\n    return arg_10", "path": "mutagen/id3.py", "identifier": "ParseID3v1", "docstring": "Parse an ID3v1 tag, returning a list of ID3v2.4 frames.", "docstring_tokens": ["Parse", "an", "ID3v1", "tag", "returning", "a", "list", "of", "ID3v2", ".", "4", "frames", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 252920}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/recipe.py#L649-L688", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Returns a pipeline string from a recipe name.", "language": "python", "parameters": "(recipe_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"{}.\"", ".", "format", "(", "recipes", ".", "__name__", ")", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "pkgutil", ".", "iter_modules", "(", "recipes", ".", "__path__", ",", "arg_1", ")", ":", "arg_5", "=", "arg_2", ".", "find_module", "(", "arg_3", ")", ".", "load_module", "(", "arg_3", ")", "arg_6", "=", "[", "arg_7", "for", "arg_7", "in", "arg_5", ".", "__dict__", ".", "values", "(", ")", "if", "isinstance", "(", "arg_7", ",", "type", ")", "]", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "arg_7", "(", ")", "if", "getattr", "(", "arg_8", ",", "\"name\"", ",", "None", ")", "==", "arg_0", ":", "return", "arg_8", ".", "brew", "(", ")", "logger", ".", "error", "(", "colored_print", "(", "\"Recipe name '{}' does not exist.\"", ".", "format", "(", "arg_0", ")", ")", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0):\n    \"\"\"Returns a pipeline string from a recipe name.\n\n    Parameters\n    ----------\n    recipe_name : str\n        Name of the recipe. Must match the name attribute in one of the classes\n        defined in :mod:`flowcraft.generator.recipes`\n\n    Returns\n    -------\n    str\n        Pipeline string ready for parsing and processing by flowcraft engine\n    \"\"\"\n\n    # This will iterate over all modules included in the recipes subpackage\n    # It will return the import class and the module name, algon with the\n    # correct prefix\n    arg_1 = \"{}.\".format(recipes.__name__)\n    for arg_2, arg_3, arg_4 in pkgutil.iter_modules(recipes.__path__, arg_1):\n\n        # Import the current module\n        arg_5 = arg_2.find_module(arg_3).load_module(arg_3)\n\n        # Fetch all available classes in module\n        arg_6 = [arg_7 for arg_7 in arg_5.__dict__.values() if\n                           isinstance(arg_7, type)]\n\n        # Iterate over each Recipe class, and check for a match with the\n        # provided recipe name.\n        for arg_7 in arg_6:\n            # Create instance of class to allow fetching the name attribute\n            arg_8 = arg_7()\n            if getattr(arg_8, \"name\", None) == arg_0:\n                return arg_8.brew()\n\n    logger.error(\n        colored_print(\"Recipe name '{}' does not exist.\".format(arg_0))\n    )\n    sys.exit(1)", "path": "flowcraft/generator/recipe.py", "identifier": "brew_recipe", "docstring": "Returns a pipeline string from a recipe name.\n\n    Parameters\n    ----------\n    recipe_name : str\n        Name of the recipe. Must match the name attribute in one of the classes\n        defined in :mod:`flowcraft.generator.recipes`\n\n    Returns\n    -------\n    str\n        Pipeline string ready for parsing and processing by flowcraft engine", "docstring_tokens": ["Returns", "a", "pipeline", "string", "from", "a", "recipe", "name", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 252921}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/system.py#L124-L140", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "if maxlen > 0, the message is shortened to maxlen traces.", "language": "python", "parameters": "(self, maxlen=6)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "6", ")", ":", "arg_2", "=", "\"\"", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", ":", "arg_2", "+=", "\"{0}: {1}\\n\"", ".", "format", "(", "arg_3", ",", "get_node_repr", "(", "arg_4", ")", ")", "arg_2", "=", "arg_2", ".", "strip", "(", "\"\\n\"", ")", "arg_5", "=", "arg_2", ".", "split", "(", "\"\\n\"", ")", "if", "arg_1", "and", "len", "(", "arg_5", ")", ">", "arg_1", ":", "arg_3", "=", "int", "(", "arg_1", "/", "2", ")", "arg_5", "=", "arg_5", "[", ":", "arg_3", "]", "+", "[", "\"...\"", "]", "+", "arg_5", "[", "-", "(", "arg_1", "-", "arg_3", ")", ":", "]", "arg_2", "=", "\"\\n\"", ".", "join", "(", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=6):\n        \"\"\"\n        if maxlen > 0, the message is shortened to maxlen traces.\n        \"\"\"\n        arg_2 = \"\"\n        for arg_3, arg_4 in enumerate(arg_0):\n            arg_2 += \"{0}: {1}\\n\".format(arg_3, get_node_repr(arg_4))\n\n        arg_2 = arg_2.strip(\"\\n\")\n        arg_5 = arg_2.split(\"\\n\")\n\n        if arg_1 and len(arg_5) > arg_1:\n            arg_3 = int(arg_1 / 2)\n            arg_5 = arg_5[:arg_3] + [\"...\"] + arg_5[-(arg_1 - arg_3) :]\n            arg_2 = \"\\n\".join(arg_5)\n\n        return arg_2", "path": "modelx/core/system.py", "identifier": "CallStack.tracemessage", "docstring": "if maxlen > 0, the message is shortened to maxlen traces.", "docstring_tokens": ["if", "maxlen", ">", "0", "the", "message", "is", "shortened", "to", "maxlen", "traces", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 252922}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L432-L470", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Remove the given object.", "language": "python", "parameters": "(self, pk=None, fail_on_missing=False, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "if", "not", "arg_1", ":", "arg_4", "=", "arg_0", ".", "_lookup", "(", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "if", "not", "arg_4", ":", "return", "{", "'changed'", ":", "False", "}", "arg_1", "=", "arg_4", "[", "'id'", "]", "arg_5", "=", "'%s%s/'", "%", "(", "arg_0", ".", "endpoint", ",", "arg_1", ")", "debug", ".", "log", "(", "'DELETE %s'", "%", "arg_5", ",", "fg", "=", "'blue'", ",", "bold", "=", "True", ")", "try", ":", "client", ".", "Func", "(", "arg_5", ")", "return", "{", "'changed'", ":", "True", "}", "except", "exc", ".", "NotFound", ":", "if", "arg_2", ":", "raise", "return", "{", "'changed'", ":", "False", "}"], "function": "def Func(arg_0, arg_1=None, arg_2=False, **arg_3):\n        \"\"\"Remove the given object.\n\n        If `fail_on_missing` is True, then the object's not being found is considered a failure; otherwise,\n        a success with no change is reported.\n\n        =====API DOCS=====\n        Remove the given object.\n\n        :param pk: Primary key of the resource to be Funcd.\n        :type pk: int\n        :param fail_on_missing: Flag that if set, the object's not being found is considered a failure; otherwise,\n                                a success with no change is reported.\n        :type fail_on_missing: bool\n        :param `**kwargs`: Keyword arguments used to look up resource object to Func if ``pk`` is not provided.\n        :returns: dictionary of only one field \"changed\", which is a flag indicating whether the specified resource\n                  is successfully Funcd.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        # If we weren't given a primary key, determine which record we're deleting.\n        if not arg_1:\n            arg_4 = arg_0._lookup(arg_2=arg_2, **arg_3)\n            if not arg_4:\n                return {'changed': False}\n            arg_1 = arg_4['id']\n\n        # Attempt to Func the record. If it turns out the record doesn't exist, handle the 404 appropriately\n        # (this is an okay response if `fail_on_missing` is False).\n        arg_5 = '%s%s/' % (arg_0.endpoint, arg_1)\n        debug.log('DELETE %s' % arg_5, fg='blue', bold=True)\n        try:\n            client.Func(arg_5)\n            return {'changed': True}\n        except exc.NotFound:\n            if arg_2:\n                raise\n            return {'changed': False}", "path": "tower_cli/models/base.py", "identifier": "BaseResource.delete", "docstring": "Remove the given object.\n\n        If `fail_on_missing` is True, then the object's not being found is considered a failure; otherwise,\n        a success with no change is reported.\n\n        =====API DOCS=====\n        Remove the given object.\n\n        :param pk: Primary key of the resource to be deleted.\n        :type pk: int\n        :param fail_on_missing: Flag that if set, the object's not being found is considered a failure; otherwise,\n                                a success with no change is reported.\n        :type fail_on_missing: bool\n        :param `**kwargs`: Keyword arguments used to look up resource object to delete if ``pk`` is not provided.\n        :returns: dictionary of only one field \"changed\", which is a flag indicating whether the specified resource\n                  is successfully deleted.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Remove", "the", "given", "object", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 252923}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/functions.py#L19-L71", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Decorator to register a new function with vaex.", "language": "python", "parameters": "(scope=None, as_property=False, name=None)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "''", "if", "arg_0", ":", "arg_3", "=", "arg_0", "+", "\"_\"", "if", "arg_0", "not", "in", "scopes", ":", "raise", "KeyError", "(", "\"unknown scope\"", ")", "def", "wrapper", "(", "arg_4", ",", "arg_2", "=", "arg_2", ")", ":", "arg_2", "=", "arg_2", "or", "arg_4", ".", "__name__", "if", "arg_2", ".", "startswith", "(", "arg_3", ")", ":", "arg_2", "=", "arg_2", "[", "len", "(", "arg_3", ")", ":", "]", "arg_5", "=", "arg_3", "+", "arg_2", "if", "arg_0", ":", "def", "closure", "(", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_4", ")", ":", "def", "wrapper", "(", "arg_7", ",", "*", "arg_8", ",", "**", "arg_9", ")", ":", "arg_10", "=", "getattr", "(", "arg_7", ".", "expression", ".", "ds", ".", "func", ",", "arg_5", ")", "arg_8", "=", "(", "arg_7", ".", "expression", ",", ")", "+", "arg_8", "return", "arg_10", "(", "*", "arg_8", ",", "**", "arg_9", ")", "return", "functools", ".", "wraps", "(", "arg_6", ")", "(", "wrapper", ")", "if", "arg_1", ":", "setattr", "(", "scopes", "[", "arg_0", "]", ",", "arg_2", ",", "property", "(", "closure", "(", ")", ")", ")", "else", ":", "setattr", "(", "scopes", "[", "arg_0", "]", ",", "arg_2", ",", "closure", "(", ")", ")", "else", ":", "def", "closure", "(", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_4", ")", ":", "def", "wrapper", "(", "arg_7", ",", "*", "arg_8", ",", "**", "arg_9", ")", ":", "arg_10", "=", "getattr", "(", "arg_7", ".", "ds", ".", "func", ",", "arg_5", ")", "arg_8", "=", "(", "arg_7", ",", ")", "+", "arg_8", "return", "arg_10", "(", "*", "arg_8", ",", "**", "arg_9", ")", "return", "functools", ".", "wraps", "(", "arg_6", ")", "(", "wrapper", ")", "setattr", "(", "arg_11", ".", "expression", ".", "Expression", ",", "arg_2", ",", "closure", "(", ")", ")", "arg_11", ".", "expression", ".", "expression_namespace", "[", "arg_3", "+", "arg_2", "]", "=", "arg_4", "return", "arg_4", "return", "wrapper"], "function": "def Func(arg_0=None, arg_1=False, arg_2=None):\n    \"\"\"Decorator to register a new function with vaex.\n\n    Example:\n\n    >>> import vaex\n    >>> df = vaex.example()\n    >>> @vaex.Func()\n    >>> def invert(x):\n    >>>     return 1/x\n    >>> df.x.invert()\n\n\n    >>> import numpy as np\n    >>> df = vaex.from_arrays(departure=np.arange('2015-01-01', '2015-12-05', dtype='datetime64'))\n    >>> @vaex.Func(as_property=True, scope='dt')\n    >>> def dt_relative_day(x):\n    >>>     return vaex.functions.dt_dayofyear(x)/365.\n    >>> df.departure.dt.relative_day\n    \"\"\"\n    arg_3 = ''\n    if arg_0:\n        arg_3 = arg_0 + \"_\"\n        if arg_0 not in scopes:\n            raise KeyError(\"unknown scope\")\n    def wrapper(arg_4, arg_2=arg_2):\n        arg_2 = arg_2 or arg_4.__name__\n        # remove possible prefix\n        if arg_2.startswith(arg_3):\n            arg_2 = arg_2[len(arg_3):]\n        arg_5 = arg_3 + arg_2\n        if arg_0:\n            def closure(arg_2=arg_2, arg_5=arg_5, arg_6=arg_4):\n                def wrapper(arg_7, *arg_8, **arg_9):\n                    arg_10 = getattr(arg_7.expression.ds.func, arg_5)\n                    arg_8 = (arg_7.expression, ) + arg_8\n                    return arg_10(*arg_8, **arg_9)\n                return functools.wraps(arg_6)(wrapper)\n            if arg_1:\n                setattr(scopes[arg_0], arg_2, property(closure()))\n            else:\n                setattr(scopes[arg_0], arg_2, closure())\n        else:\n            def closure(arg_2=arg_2, arg_5=arg_5, arg_6=arg_4):\n                def wrapper(arg_7, *arg_8, **arg_9):\n                    arg_10 = getattr(arg_7.ds.func, arg_5)\n                    arg_8 = (arg_7, ) + arg_8\n                    return arg_10(*arg_8, **arg_9)\n                return functools.wraps(arg_6)(wrapper)\n            setattr(arg_11.expression.Expression, arg_2, closure())\n        arg_11.expression.expression_namespace[arg_3 + arg_2] = arg_4\n        return arg_4  # we leave the original function as is\n    return wrapper", "path": "packages/vaex-core/vaex/functions.py", "identifier": "register_function", "docstring": "Decorator to register a new function with vaex.\n\n    Example:\n\n    >>> import vaex\n    >>> df = vaex.example()\n    >>> @vaex.register_function()\n    >>> def invert(x):\n    >>>     return 1/x\n    >>> df.x.invert()\n\n\n    >>> import numpy as np\n    >>> df = vaex.from_arrays(departure=np.arange('2015-01-01', '2015-12-05', dtype='datetime64'))\n    >>> @vaex.register_function(as_property=True, scope='dt')\n    >>> def dt_relative_day(x):\n    >>>     return vaex.functions.dt_dayofyear(x)/365.\n    >>> df.departure.dt.relative_day", "docstring_tokens": ["Decorator", "to", "register", "a", "new", "function", "with", "vaex", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 252924}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/core/tankcore.py#L637-L650", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Get options list with requested prefix", "language": "python", "parameters": "(self, section, prefix='')", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ")", ":", "arg_3", "=", "[", "]", "try", ":", "for", "arg_4", "in", "arg_0", ".", "config", ".", "options", "(", "arg_1", ")", ":", "if", "not", "arg_2", "or", "arg_4", ".", "find", "(", "arg_2", ")", "==", "0", ":", "arg_3", "+=", "[", "(", "arg_4", "[", "len", "(", "arg_2", ")", ":", "]", ",", "arg_0", ".", "config", ".", "get", "(", "arg_1", ",", "arg_4", ")", ")", "]", "except", "ConfigParser", ".", "NoSectionError", "as", "ex", ":", "logger", ".", "warning", "(", "\"No section: %s\"", ",", "ex", ")", "logger", ".", "debug", "(", "\"Section: [%s] prefix: '%s' options:\\n%s\"", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=''):\n        \"\"\" Get options list with requested prefix \"\"\"\n        arg_3 = []\n        try:\n            for arg_4 in arg_0.config.options(arg_1):\n                if not arg_2 or arg_4.find(arg_2) == 0:\n                    arg_3 += [(\n                        arg_4[len(arg_2):], arg_0.config.get(arg_1, arg_4))]\n        except ConfigParser.NoSectionError as ex:\n            logger.warning(\"No section: %s\", ex)\n\n        logger.debug(\n            \"Section: [%s] prefix: '%s' options:\\n%s\", arg_1, arg_2, arg_3)\n        return arg_3", "path": "yandextank/core/tankcore.py", "identifier": "ConfigManager.get_options", "docstring": "Get options list with requested prefix", "docstring_tokens": ["Get", "options", "list", "with", "requested", "prefix"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 252925}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L77-L90", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Find the lines matching one of a list of regexes.", "language": "python", "parameters": "(self, *regexes)", "return_statement": "return matches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "re", ".", "compile", "(", "join_regex", "(", "arg_1", ")", ")", "arg_3", "=", "set", "(", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_0", ".", "lines", ")", ":", "if", "arg_2", ".", "search", "(", "arg_5", ")", ":", "arg_3", ".", "add", "(", "arg_4", "+", "1", ")", "return", "arg_3"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Find the lines matching one of a list of regexes.\n\n        Returns a set of line numbers, the lines that contain a match for one\n        of the regexes in `regexes`.  The entire line needn't match, just a\n        part of it.\n\n        \"\"\"\n        arg_2 = re.compile(join_regex(arg_1))\n        arg_3 = set()\n        for arg_4, arg_5 in enumerate(arg_0.lines):\n            if arg_2.search(arg_5):\n                arg_3.add(arg_4+1)\n        return arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py", "identifier": "CodeParser.lines_matching", "docstring": "Find the lines matching one of a list of regexes.\n\n        Returns a set of line numbers, the lines that contain a match for one\n        of the regexes in `regexes`.  The entire line needn't match, just a\n        part of it.", "docstring_tokens": ["Find", "the", "lines", "matching", "one", "of", "a", "list", "of", "regexes", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 252926}
{"url": "https://github.com/napalm-automation/napalm-yang/blob/998e8a933171d010b8544bcc5dc448e2b68051e2/napalm_yang/base.py#L131-L166", "sha": "998e8a933171d010b8544bcc5dc448e2b68051e2", "docstring_summary": "Load a dictionary into the model.", "language": "python", "parameters": "(self, data, overwrite=False, auto_load_model=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "True", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_4", "not", "in", "arg_0", ".", "_elements", ".", "keys", "(", ")", "and", "not", "arg_3", ":", "raise", "AttributeError", "(", "\"Model {} is not loaded\"", ".", "format", "(", "arg_4", ")", ")", "elif", "arg_4", "not", "in", "arg_0", ".", "_elements", ".", "keys", "(", ")", "and", "arg_3", ":", "arg_0", ".", "_load_model", "(", "arg_4", ")", "arg_6", "=", "getattr", "(", "arg_0", ",", "arg_4", ")", "_Func", "(", "arg_6", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=True):\n        \"\"\"\n        Load a dictionary into the model.\n\n        Args:\n            data(dict): Dictionary to load\n            overwrite(bool): Whether the data present in the model should be overwritten by the\n                data in the dict or not.\n            auto_load_model(bool): If set to true models will be loaded as they are needed\n\n        Examples:\n\n            >>> vlans_dict = {\n            >>>     \"vlans\": { \"vlan\": { 100: {\n            >>>                             \"config\": {\n            >>>                                 \"vlan_id\": 100, \"name\": \"production\"}},\n            >>>                          200: {\n            >>>                             \"config\": {\n            >>>                                 \"vlan_id\": 200, \"name\": \"dev\"}}}}}\n            >>> config.Func(vlans_dict)\n            >>> print(config.vlans.vlan.keys())\n            ... [200, 100]\n            >>> print(100, config.vlans.vlan[100].config.name)\n            ... (100, u'production')\n            >>> print(200, config.vlans.vlan[200].config.name)\n            ... (200, u'dev')\n        \"\"\"\n        for arg_4, arg_5 in arg_1.items():\n            if arg_4 not in arg_0._elements.keys() and not arg_3:\n                raise AttributeError(\"Model {} is not loaded\".format(arg_4))\n\n            elif arg_4 not in arg_0._elements.keys() and arg_3:\n                arg_0._load_model(arg_4)\n\n            arg_6 = getattr(arg_0, arg_4)\n            _Func(arg_6, arg_5)", "path": "napalm_yang/base.py", "identifier": "Root.load_dict", "docstring": "Load a dictionary into the model.\n\n        Args:\n            data(dict): Dictionary to load\n            overwrite(bool): Whether the data present in the model should be overwritten by the\n                data in the dict or not.\n            auto_load_model(bool): If set to true models will be loaded as they are needed\n\n        Examples:\n\n            >>> vlans_dict = {\n            >>>     \"vlans\": { \"vlan\": { 100: {\n            >>>                             \"config\": {\n            >>>                                 \"vlan_id\": 100, \"name\": \"production\"}},\n            >>>                          200: {\n            >>>                             \"config\": {\n            >>>                                 \"vlan_id\": 200, \"name\": \"dev\"}}}}}\n            >>> config.load_dict(vlans_dict)\n            >>> print(config.vlans.vlan.keys())\n            ... [200, 100]\n            >>> print(100, config.vlans.vlan[100].config.name)\n            ... (100, u'production')\n            >>> print(200, config.vlans.vlan[200].config.name)\n            ... (200, u'dev')", "docstring_tokens": ["Load", "a", "dictionary", "into", "the", "model", "."], "nwo": "napalm-automation/napalm-yang", "score": 0.2912181512296147, "idx": 252927}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/index.py#L74-L79", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Delete all indexes for the database", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "LOG", ".", "warning", "(", "\"Dropping all indexe\"", ")", "for", "arg_1", "in", "INDEXES", ":", "LOG", ".", "warning", "(", "\"Dropping all indexes for collection name %s\"", ",", "arg_1", ")", "arg_0", ".", "db", "[", "arg_1", "]", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Delete all indexes for the database\"\"\"\n        LOG.warning(\"Dropping all indexe\")\n        for arg_1 in INDEXES:\n            LOG.warning(\"Dropping all indexes for collection name %s\", arg_1)\n            arg_0.db[arg_1].Func()", "path": "scout/adapter/mongo/index.py", "identifier": "IndexHandler.drop_indexes", "docstring": "Delete all indexes for the database", "docstring_tokens": ["Delete", "all", "indexes", "for", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252928}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/ssh/tunnel.py#L145-L168", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Open a tunneled connection from a 0MQ url.", "language": "python", "parameters": "(addr, server, keyfile=None, password=None, paramiko=None, timeout=60)", "return_statement": "return 'tcp://127.0.0.1:%i'%lport, tunnel", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "60", ")", ":", "arg_6", "=", "select_random_ports", "(", "1", ")", "[", "0", "]", "arg_7", ",", "arg_0", "=", "arg_0", ".", "split", "(", "'://'", ")", "arg_8", ",", "arg_9", "=", "arg_0", ".", "split", "(", "':'", ")", "arg_9", "=", "int", "(", "arg_9", ")", "if", "arg_4", "is", "None", ":", "arg_4", "=", "sys", ".", "platform", "==", "'win32'", "if", "arg_4", ":", "arg_10", "=", "paramiko_tunnel", "else", ":", "arg_10", "=", "openssh_tunnel", "arg_11", "=", "arg_10", "(", "arg_6", ",", "arg_9", ",", "arg_1", ",", "remoteip", "=", "arg_8", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")", "return", "'tcp://127.0.0.1:%i'", "%", "arg_6", ",", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=60):\n    \"\"\"Open a tunneled connection from a 0MQ url.\n\n    For use inside tunnel_connection.\n\n    Returns\n    -------\n\n    (url, tunnel): The 0MQ url that has been forwarded, and the tunnel object\n    \"\"\"\n\n    arg_6 = select_random_ports(1)[0]\n    arg_7, arg_0 = arg_0.split('://')\n    arg_8,arg_9 = arg_0.split(':')\n    arg_9 = int(arg_9)\n    if arg_4 is None:\n        arg_4 = sys.platform == 'win32'\n    if arg_4:\n        arg_10 = paramiko_tunnel\n    else:\n        arg_10 = openssh_tunnel\n\n    arg_11 = arg_10(arg_6, arg_9, arg_1, remoteip=arg_8, arg_2=arg_2, arg_3=arg_3, arg_5=arg_5)\n    return 'tcp://127.0.0.1:%i'%arg_6, arg_11", "path": "environment/lib/python2.7/site-packages/IPython/external/ssh/tunnel.py", "identifier": "open_tunnel", "docstring": "Open a tunneled connection from a 0MQ url.\n\n    For use inside tunnel_connection.\n\n    Returns\n    -------\n\n    (url, tunnel): The 0MQ url that has been forwarded, and the tunnel object", "docstring_tokens": ["Open", "a", "tunneled", "connection", "from", "a", "0MQ", "url", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252929}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L437-L456", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Allocate the spatial pooler instance.", "language": "python", "parameters": "(self, rfInput)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_sfdr", ":", "return", "arg_2", "=", "dict", "(", "(", "name", ",", "getattr", "(", "arg_0", ",", "name", ")", ")", "for", "name", "in", "arg_0", ".", "_spatialArgNames", ")", "if", "(", "(", "arg_0", ".", "SpatialClass", "==", "CPPSpatialPooler", ")", "or", "(", "arg_0", ".", "SpatialClass", "==", "PYSpatialPooler", ")", ")", ":", "arg_2", "[", "'columnDimensions'", "]", "=", "[", "arg_0", ".", "columnCount", "]", "arg_2", "[", "'inputDimensions'", "]", "=", "[", "arg_0", ".", "inputWidth", "]", "arg_2", "[", "'potentialRadius'", "]", "=", "arg_0", ".", "inputWidth", "arg_0", ".", "_sfdr", "=", "arg_0", ".", "SpatialClass", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Allocate the spatial pooler instance.\"\"\"\n    if arg_0._sfdr:\n      return\n\n    # Retrieve the necessary extra arguments that were handled automatically\n    arg_2 = dict((name, getattr(arg_0, name))\n                     for name in arg_0._spatialArgNames)\n\n    # Instantiate the spatial pooler class.\n    if ( (arg_0.SpatialClass == CPPSpatialPooler) or\n         (arg_0.SpatialClass == PYSpatialPooler) ):\n\n      arg_2['columnDimensions'] = [arg_0.columnCount]\n      arg_2['inputDimensions'] = [arg_0.inputWidth]\n      arg_2['potentialRadius'] = arg_0.inputWidth\n\n      arg_0._sfdr = arg_0.SpatialClass(\n        **arg_2\n      )", "path": "src/nupic/regions/sp_region.py", "identifier": "SPRegion._allocateSpatialFDR", "docstring": "Allocate the spatial pooler instance.", "docstring_tokens": ["Allocate", "the", "spatial", "pooler", "instance", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 252930}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/refactoring.py#L65-L107", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if the given token is a trailing comma", "language": "python", "parameters": "(tokens, index)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "arg_1", "]", "if", "arg_2", ".", "exact_type", "!=", "tokenize", ".", "COMMA", ":", "return", "False", "arg_3", "=", "itertools", ".", "islice", "(", "arg_0", ",", "arg_1", "+", "1", ",", "None", ")", "arg_4", "=", "list", "(", "itertools", ".", "takewhile", "(", "lambda", "other_token", ",", "_token", "=", "arg_2", ":", "other_token", ".", "start", "[", "0", "]", "==", "_token", ".", "start", "[", "0", "]", ",", "arg_3", ",", ")", ")", "arg_5", "=", "all", "(", "other_token", ".", "type", "in", "(", "tokenize", ".", "NEWLINE", ",", "tokenize", ".", "COMMENT", ")", "for", "other_token", "in", "arg_4", ")", "if", "not", "arg_4", "or", "not", "arg_5", ":", "return", "False", "def", "get_curline_index_start", "(", ")", ":", "for", "arg_6", ",", "arg_2", "in", "enumerate", "(", "reversed", "(", "arg_0", "[", ":", "arg_1", "]", ")", ")", ":", "if", "arg_2", ".", "type", "in", "(", "tokenize", ".", "NEWLINE", ",", "tokenize", ".", "NL", ")", ":", "return", "arg_1", "-", "arg_6", "return", "0", "arg_7", "=", "get_curline_index_start", "(", ")", "arg_8", "=", "{", "\"return\"", ",", "\"yield\"", "}", "for", "arg_9", "in", "arg_0", "[", "arg_7", ":", "arg_1", "]", ":", "if", "\"=\"", "in", "arg_9", ".", "string", "or", "arg_9", ".", "string", "in", "arg_8", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Check if the given token is a trailing comma\n\n    :param tokens: Sequence of modules tokens\n    :type tokens: list[tokenize.TokenInfo]\n    :param int index: Index of token under check in tokens\n    :returns: True if the token is a comma which trails an expression\n    :rtype: bool\n    \"\"\"\n    arg_2 = arg_0[arg_1]\n    if arg_2.exact_type != tokenize.COMMA:\n        return False\n    # Must have remaining tokens on the same line such as NEWLINE\n    arg_3 = itertools.islice(arg_0, arg_1 + 1, None)\n    arg_4 = list(\n        itertools.takewhile(\n            lambda other_token, _token=arg_2: other_token.start[0] == _token.start[0],\n            arg_3,\n        )\n    )\n    # Note: If the newline is tokenize.NEWLINE and not tokenize.NL\n    # then the newline denotes the end of expression\n    arg_5 = all(\n        other_token.type in (tokenize.NEWLINE, tokenize.COMMENT)\n        for other_token in arg_4\n    )\n    if not arg_4 or not arg_5:\n        return False\n\n    def get_curline_index_start():\n        \"\"\"Get the index denoting the start of the current line\"\"\"\n        for arg_6, arg_2 in enumerate(reversed(arg_0[:arg_1])):\n            # See Lib/tokenize.py and Lib/token.py in cpython for more info\n            if arg_2.type in (tokenize.NEWLINE, tokenize.NL):\n                return arg_1 - arg_6\n        return 0\n\n    arg_7 = get_curline_index_start()\n    arg_8 = {\"return\", \"yield\"}\n    for arg_9 in arg_0[arg_7:arg_1]:\n        if \"=\" in arg_9.string or arg_9.string in arg_8:\n            return True\n    return False", "path": "pylint/checkers/refactoring.py", "identifier": "_is_trailing_comma", "docstring": "Check if the given token is a trailing comma\n\n    :param tokens: Sequence of modules tokens\n    :type tokens: list[tokenize.TokenInfo]\n    :param int index: Index of token under check in tokens\n    :returns: True if the token is a comma which trails an expression\n    :rtype: bool", "docstring_tokens": ["Check", "if", "the", "given", "token", "is", "a", "trailing", "comma"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 252931}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/explorer/src/python/logicalplan.py#L101-L107", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "filter to keep spouts", "language": "python", "parameters": "(table, header)", "return_statement": "return spouts_info, header", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", "[", "0", "]", "==", "'spout'", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2", ",", "arg_1"], "function": "def Func(arg_0, arg_1):\n  \"\"\" filter to keep spouts \"\"\"\n  arg_2 = []\n  for arg_3 in arg_0:\n    if arg_3[0] == 'spout':\n      arg_2.append(arg_3)\n  return arg_2, arg_1", "path": "heron/tools/explorer/src/python/logicalplan.py", "identifier": "filter_spouts", "docstring": "filter to keep spouts", "docstring_tokens": ["filter", "to", "keep", "spouts"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 252932}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rabbitmq.py#L281-L313", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Installs and configures RabbitMQ.", "language": "python", "parameters": "(self, site=None, full=0, only_data=0)", "return_statement": "return params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ")", ":", "arg_1", "=", "arg_1", "or", "ALL", "arg_2", "=", "int", "(", "arg_2", ")", "if", "arg_2", "and", "not", "arg_3", ":", "arg_4", "=", "arg_0", ".", "get_satchel", "(", "'packager'", ")", "arg_4", ".", "install_required", "(", "type", "=", "SYSTEM", ",", "service", "=", "arg_0", ".", "name", ")", "arg_5", "=", "arg_0", ".", "local_renderer", "arg_6", "=", "arg_0", ".", "get_user_vhosts", "(", "arg_1", "=", "arg_1", ")", "with", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_0", ".", "add_admin_user", "(", ")", "arg_6", "=", "sorted", "(", "list", "(", "arg_6", ")", ")", "if", "not", "arg_3", ":", "for", "arg_7", ",", "arg_8", ",", "arg_9", "in", "arg_6", ":", "arg_5", ".", "env", ".", "broker_user", "=", "arg_7", "arg_5", ".", "env", ".", "broker_password", "=", "arg_8", "arg_5", ".", "env", ".", "broker_vhost", "=", "arg_9", "with", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_5", ".", "sudo", "(", "'rabbitmqctl add_user {broker_user} {broker_password}'", ")", "arg_5", ".", "sudo", "(", "'rabbitmqctl add_vhost {broker_vhost}'", ")", "arg_5", ".", "sudo", "(", "'rabbitmqctl set_permissions -p {broker_vhost} {broker_user} \".*\" \".*\" \".*\"'", ")", "arg_5", ".", "sudo", "(", "'rabbitmqctl set_permissions -p {broker_vhost} {admin_username} \".*\" \".*\" \".*\"'", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None, arg_2=0, arg_3=0):\n        \"\"\"\n        Installs and configures RabbitMQ.\n        \"\"\"\n\n        arg_1 = arg_1 or ALL\n\n        arg_2 = int(arg_2)\n\n        if arg_2 and not arg_3:\n            arg_4 = arg_0.get_satchel('packager')\n            arg_4.install_required(type=SYSTEM, service=arg_0.name)\n\n        arg_5 = arg_0.local_renderer\n\n        arg_6 = arg_0.get_user_vhosts(arg_1=arg_1) # [(user, password, vhost)]\n\n        with settings(warn_only=True):\n            arg_0.add_admin_user()\n\n        arg_6 = sorted(list(arg_6))\n        if not arg_3:\n            for arg_7, arg_8, arg_9 in arg_6:\n                arg_5.env.broker_user = arg_7\n                arg_5.env.broker_password = arg_8\n                arg_5.env.broker_vhost = arg_9\n                with settings(warn_only=True):\n                    arg_5.sudo('rabbitmqctl add_user {broker_user} {broker_password}')\n                    arg_5.sudo('rabbitmqctl add_vhost {broker_vhost}')\n                    arg_5.sudo('rabbitmqctl set_permissions -p {broker_vhost} {broker_user} \".*\" \".*\" \".*\"')\n                    arg_5.sudo('rabbitmqctl set_permissions -p {broker_vhost} {admin_username} \".*\" \".*\" \".*\"')\n\n        return arg_6", "path": "burlap/rabbitmq.py", "identifier": "RabbitMQSatchel._configure_users", "docstring": "Installs and configures RabbitMQ.", "docstring_tokens": ["Installs", "and", "configures", "RabbitMQ", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 252933}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L441-L444", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Add the whole list of API parameters into optparse.", "language": "python", "parameters": "(parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "BotoClient", ".", "EXTRA_CLIENT_PARAMS", ":", "arg_0", ".", "add_option", "(", "'--API-'", "+", "arg_1", ",", "help", "=", "arg_3", ",", "type", "=", "arg_2", ",", "dest", "=", "arg_1", ")"], "function": "def Func(arg_0):\n    '''Add the whole list of API parameters into optparse.'''\n    for arg_1, arg_2, arg_3 in BotoClient.EXTRA_CLIENT_PARAMS:\n      arg_0.add_option('--API-' + arg_1, help=arg_3, type=arg_2, dest=arg_1)", "path": "s4cmd.py", "identifier": "BotoClient.add_options", "docstring": "Add the whole list of API parameters into optparse.", "docstring_tokens": ["Add", "the", "whole", "list", "of", "API", "parameters", "into", "optparse", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 252934}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/eval.py#L322-L362", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "r'''Tempo evaluation", "language": "python", "parameters": "(ref, est, **kwargs)", "return_statement": "return mir_eval.tempo.evaluate(ref_tempi, ref_weight, est_tempi, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", "=", "coerce_annotation", "(", "arg_0", ",", "'Func'", ")", "arg_1", "=", "coerce_annotation", "(", "arg_1", ",", "'Func'", ")", "arg_3", "=", "np", ".", "asarray", "(", "[", "o", ".", "value", "for", "o", "in", "arg_0", "]", ")", "arg_4", "=", "arg_0", ".", "data", "[", "0", "]", ".", "confidence", "arg_5", "=", "np", ".", "asarray", "(", "[", "o", ".", "value", "for", "o", "in", "arg_1", "]", ")", "return", "mir_eval", ".", "Func", ".", "evaluate", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    r'''Tempo evaluation\n\n    Parameters\n    ----------\n    ref : jams.Annotation\n        Reference annotation object\n    est : jams.Annotation\n        Estimated annotation object\n    kwargs\n        Additional keyword arguments\n\n    Returns\n    -------\n    scores : dict\n        Dictionary of scores, where the key is the metric name (str) and\n        the value is the (float) score achieved.\n\n    See Also\n    --------\n    mir_eval.Func.evaluate\n\n    Examples\n    --------\n    >>> # Load in the JAMS objects\n    >>> ref_jam = jams.load('reference.jams')\n    >>> est_jam = jams.load('estimated.jams')\n    >>> # Select the first relevant annotations\n    >>> ref_ann = ref_jam.search(namespace='Func')[0]\n    >>> est_ann = est_jam.search(namespace='Func')[0]\n    >>> scores = jams.eval.Func(ref_ann, est_ann)\n    '''\n\n    arg_0 = coerce_annotation(arg_0, 'Func')\n    arg_1 = coerce_annotation(arg_1, 'Func')\n\n    arg_3 = np.asarray([o.value for o in arg_0])\n    arg_4 = arg_0.data[0].confidence\n    arg_5 = np.asarray([o.value for o in arg_1])\n\n    return mir_eval.Func.evaluate(arg_3, arg_4, arg_5, **arg_2)", "path": "jams/eval.py", "identifier": "tempo", "docstring": "r'''Tempo evaluation\n\n    Parameters\n    ----------\n    ref : jams.Annotation\n        Reference annotation object\n    est : jams.Annotation\n        Estimated annotation object\n    kwargs\n        Additional keyword arguments\n\n    Returns\n    -------\n    scores : dict\n        Dictionary of scores, where the key is the metric name (str) and\n        the value is the (float) score achieved.\n\n    See Also\n    --------\n    mir_eval.tempo.evaluate\n\n    Examples\n    --------\n    >>> # Load in the JAMS objects\n    >>> ref_jam = jams.load('reference.jams')\n    >>> est_jam = jams.load('estimated.jams')\n    >>> # Select the first relevant annotations\n    >>> ref_ann = ref_jam.search(namespace='tempo')[0]\n    >>> est_ann = est_jam.search(namespace='tempo')[0]\n    >>> scores = jams.eval.tempo(ref_ann, est_ann)", "docstring_tokens": ["r", "Tempo", "evaluation"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 252935}
{"url": "https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__main__.py#L39-L88", "sha": "247d6b9524fcee4b2da0e65ca12c52ebdd3676b2", "docstring_summary": "Constructs the ArgumentParser for the CLI", "language": "python", "parameters": "()", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "ArgumentParser", "(", "prog", "=", "'pynetgear'", ")", "arg_0", ".", "add_argument", "(", "\"--format\"", ",", "choices", "=", "[", "'json'", ",", "'prettyjson'", ",", "'py'", "]", ",", "default", "=", "'prettyjson'", ")", "arg_1", "=", "arg_0", ".", "add_argument_group", "(", "\"router connection config\"", ")", "arg_1", ".", "add_argument", "(", "\"--host\"", ",", "help", "=", "\"Hostname for the router\"", ")", "arg_1", ".", "add_argument", "(", "\"--user\"", ",", "help", "=", "\"Account for login\"", ")", "arg_1", ".", "add_argument", "(", "\"--port\"", ",", "help", "=", "\"Port exposed on the router\"", ")", "arg_1", ".", "add_argument", "(", "\"--login-v2\"", ",", "help", "=", "\"Force the use of the cookie-based authentication\"", ",", "dest", "=", "\"force_login_v2\"", ",", "default", "=", "False", ",", "action", "=", "\"store_true\"", ")", "arg_1", ".", "add_argument", "(", "\"--password\"", ",", "help", "=", "\"Not required with a wired connection.\"", "+", "\"Optionally, set the PYNETGEAR_PASSWORD environment variable\"", ")", "arg_1", ".", "add_argument", "(", "\"--url\"", ",", "help", "=", "\"Overrides host:port and ssl with url to router\"", ")", "arg_1", ".", "add_argument", "(", "\"--no-ssl\"", ",", "dest", "=", "\"ssl\"", ",", "default", "=", "True", ",", "action", "=", "\"store_false\"", ",", "help", "=", "\"Connect with https\"", ")", "arg_2", "=", "arg_0", ".", "add_subparsers", "(", "description", "=", "\"Runs subcommand against the specified router\"", ",", "dest", "=", "\"subcommand\"", ")", "arg_3", "=", "arg_2", ".", "add_parser", "(", "\"block_device\"", ",", "help", "=", "\"Blocks a device from connecting by mac address\"", ")", "arg_3", ".", "add_argument", "(", "\"--mac-addr\"", ")", "arg_4", "=", "arg_2", ".", "add_parser", "(", "\"allow_device\"", ",", "help", "=", "\"Allows a device with the mac address to connect\"", ")", "arg_4", ".", "add_argument", "(", "\"--mac-addr\"", ")", "arg_2", ".", "add_parser", "(", "\"login\"", ",", "help", "=", "\"Attempts to login to router.\"", ")", "arg_5", "=", "arg_2", ".", "add_parser", "(", "\"attached_devices\"", ",", "help", "=", "\"Outputs all attached devices\"", ")", "arg_5", ".", "add_argument", "(", "\"-v\"", ",", "\"--verbose\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ",", "help", "=", "\"Choose between verbose and slower or terse and fast.\"", ")", "arg_2", ".", "add_parser", "(", "\"traffic_meter\"", ",", "help", "=", "\"Output router's traffic meter data\"", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Constructs the ArgumentParser for the CLI\"\"\"\n\n    arg_0 = ArgumentParser(prog='pynetgear')\n\n    arg_0.add_argument(\"--format\", choices=['json', 'prettyjson', 'py'], default='prettyjson')\n\n    arg_1 = arg_0.add_argument_group(\"router connection config\")\n    arg_1.add_argument(\"--host\", help=\"Hostname for the router\")\n    arg_1.add_argument(\"--user\", help=\"Account for login\")\n    arg_1.add_argument(\"--port\", help=\"Port exposed on the router\")\n    arg_1.add_argument(\"--login-v2\", help=\"Force the use of the cookie-based authentication\",\n                             dest=\"force_login_v2\", default=False, action=\"store_true\")\n    arg_1.add_argument(\n            \"--password\",\n            help=\"Not required with a wired connection.\" +\n                 \"Optionally, set the PYNETGEAR_PASSWORD environment variable\")\n    arg_1.add_argument(\n            \"--url\", help=\"Overrides host:port and ssl with url to router\")\n    arg_1.add_argument(\"--no-ssl\",\n                             dest=\"ssl\", default=True,\n                             action=\"store_false\",\n                             help=\"Connect with https\")\n\n    arg_2 = arg_0.add_subparsers(\n            description=\"Runs subcommand against the specified router\",\n            dest=\"subcommand\")\n\n    arg_3 = arg_2.add_parser(\n            \"block_device\",\n            help=\"Blocks a device from connecting by mac address\")\n    arg_3.add_argument(\"--mac-addr\")\n\n    arg_4 = arg_2.add_parser(\n            \"allow_device\",\n            help=\"Allows a device with the mac address to connect\")\n    arg_4.add_argument(\"--mac-addr\")\n\n    arg_2.add_parser(\"login\", help=\"Attempts to login to router.\")\n\n    arg_5 = arg_2.add_parser(\"attached_devices\", help=\"Outputs all attached devices\")\n    arg_5.add_argument(\n            \"-v\", \"--verbose\",\n            action=\"store_true\",\n            default=False,\n            help=\"Choose between verbose and slower or terse and fast.\")\n\n    arg_2.add_parser(\"traffic_meter\", help=\"Output router's traffic meter data\")\n\n    return arg_0", "path": "pynetgear/__main__.py", "identifier": "argparser", "docstring": "Constructs the ArgumentParser for the CLI", "docstring_tokens": ["Constructs", "the", "ArgumentParser", "for", "the", "CLI"], "nwo": "MatMaul/pynetgear", "score": 0.725114434043304, "idx": 252936}
{"url": "https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L143-L148", "sha": "2092b0cb30898139a247176bcf433d5a4abde7cb", "docstring_summary": "Send an update request to the given path of the CRUD API, with the given data dict, which will be converted\n        into json", "language": "python", "parameters": "(self, path, data=None)", "return_statement": "return self.handleresult(self.r.put(urljoin(self.url + CRUD_PATH,\n                                                    path),\n                                            data=json.dumps(data)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "handleresult", "(", "arg_0", ".", "r", ".", "put", "(", "urljoin", "(", "arg_0", ".", "url", "+", "CRUD_PATH", ",", "arg_1", ")", ",", "arg_2", "=", "json", ".", "dumps", "(", "arg_2", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Send an Func request to the given path of the CRUD API, with the given data dict, which will be converted\n        into json\"\"\"\n        return arg_0.handleresult(arg_0.r.put(urljoin(arg_0.url + CRUD_PATH,\n                                                    arg_1),\n                                            arg_2=json.dumps(arg_2)))", "path": "connectordb/_connection.py", "identifier": "DatabaseConnection.update", "docstring": "Send an update request to the given path of the CRUD API, with the given data dict, which will be converted\n        into json", "docstring_tokens": ["Send", "an", "update", "request", "to", "the", "given", "path", "of", "the", "CRUD", "API", "with", "the", "given", "data", "dict", "which", "will", "be", "converted", "into", "json"], "nwo": "connectordb/connectordb-python", "score": 0.25890992733444657, "idx": 252937}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_data_lake_hook.py#L55-L68", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Check if a file exists on Azure Data Lake.", "language": "python", "parameters": "(self, file_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "connection", ".", "glob", "(", "arg_1", ",", "details", "=", "False", ",", "invalidate_cache", "=", "True", ")", "return", "len", "(", "arg_2", ")", "==", "1", "except", "FileNotFoundError", ":", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Check if a file exists on Azure Data Lake.\n\n        :param file_path: Path and name of the file.\n        :type file_path: str\n        :return: True if the file exists, False otherwise.\n        :rtype: bool\n        \"\"\"\n        try:\n            arg_2 = arg_0.connection.glob(arg_1, details=False, invalidate_cache=True)\n            return len(arg_2) == 1\n        except FileNotFoundError:\n            return False", "path": "airflow/contrib/hooks/azure_data_lake_hook.py", "identifier": "AzureDataLakeHook.check_for_file", "docstring": "Check if a file exists on Azure Data Lake.\n\n        :param file_path: Path and name of the file.\n        :type file_path: str\n        :return: True if the file exists, False otherwise.\n        :rtype: bool", "docstring_tokens": ["Check", "if", "a", "file", "exists", "on", "Azure", "Data", "Lake", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252938}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_format.py#L598-L665", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Create a string representation for each item in a dict.", "language": "python", "parameters": "(dict_, **kwargs)", "return_statement": "return itemstrs, _leaf_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "import", "ubelt", "as", "ub", "arg_2", "=", "arg_1", ".", "get", "(", "'explicit'", ",", "False", ")", "arg_1", "[", "'explicit'", "]", "=", "_rectify_countdown_or_bool", "(", "arg_2", ")", "arg_3", "=", "arg_1", ".", "get", "(", "'precision'", ",", "None", ")", "arg_4", "=", "arg_1", ".", "get", "(", "'kvsep'", ",", "': '", ")", "if", "arg_2", ":", "arg_4", "=", "'='", "def", "make_item_str", "(", "arg_5", ",", "arg_6", ")", ":", "if", "arg_2", "or", "arg_1", ".", "get", "(", "'strkeys'", ",", "False", ")", ":", "arg_7", "=", "six", ".", "text_type", "(", "arg_5", ")", "else", ":", "arg_7", "=", "repr2", "(", "arg_5", ",", "arg_3", "=", "arg_3", ",", "newlines", "=", "0", ")", "arg_8", "=", "arg_7", "+", "arg_4", "arg_1", "[", "'_return_info'", "]", "=", "True", "arg_9", ",", "arg_10", "=", "repr2", "(", "arg_6", ",", "**", "arg_1", ")", "arg_11", "=", "arg_9", ".", "find", "(", "'\\n'", ")", "arg_12", "=", "arg_9", "if", "arg_11", "==", "-", "1", "else", "arg_9", "[", ":", "arg_11", "]", "arg_13", "=", "arg_1", ".", "get", "(", "'cbr'", ",", "arg_1", ".", "get", "(", "'compact_brace'", ",", "False", ")", ")", "if", "arg_13", "or", "not", "arg_12", ".", "rstrip", "(", ")", ".", "endswith", "(", "tuple", "(", "'([{<'", ")", ")", ":", "arg_14", "=", "''", "if", "arg_11", "==", "-", "1", "else", "arg_9", "[", "arg_11", ":", "]", "arg_9", "=", "arg_12", ".", "lstrip", "(", ")", "+", "arg_14", "if", "'\\n'", "in", "arg_8", ":", "arg_15", "=", "arg_8", "+", "arg_9", "else", ":", "arg_15", "=", "ub", ".", "hzcat", "(", "[", "arg_8", ",", "arg_9", "]", ")", "else", ":", "arg_15", "=", "arg_8", "+", "arg_9", "return", "arg_15", ",", "arg_10", "arg_16", "=", "list", "(", "six", ".", "iteritems", "(", "arg_0", ")", ")", "arg_17", "=", "[", "make_item_str", "(", "arg_5", ",", "arg_6", ")", "for", "(", "arg_5", ",", "arg_6", ")", "in", "arg_16", "]", "arg_18", "=", "[", "t", "[", "0", "]", "for", "t", "in", "arg_17", "]", "arg_19", "=", "max", "(", "[", "t", "[", "1", "]", "[", "'max_height'", "]", "for", "t", "in", "arg_17", "]", ")", "if", "arg_17", "else", "0", "arg_10", "=", "{", "'max_height'", ":", "arg_19", "+", "1", ",", "}", "arg_20", "=", "arg_1", ".", "get", "(", "'sort'", ",", "None", ")", "if", "arg_20", "is", "None", ":", "arg_20", "=", "True", "if", "isinstance", "(", "arg_0", ",", "collections", ".", "OrderedDict", ")", ":", "arg_20", "=", "False", "if", "arg_20", ":", "arg_18", "=", "_sort_itemstrs", "(", "arg_16", ",", "arg_18", ")", "return", "arg_18", ",", "arg_10"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"\n    Create a string representation for each item in a dict.\n\n    Example:\n        >>> from ubelt.util_format import *\n        >>> dict_ =  {'b': .1, 'l': 'st', 'g': 1.0, 's': 10, 'm': 0.9, 'w': .5}\n        >>> kwargs = {'strkeys': True}\n        >>> itemstrs, _ = Func(dict_, **kwargs)\n        >>> char_order = [p[0] for p in itemstrs]\n        >>> assert char_order == ['b', 'g', 'l', 'm', 's', 'w']\n    \"\"\"\n    import ubelt as ub\n    arg_2 = arg_1.get('explicit', False)\n    arg_1['explicit'] = _rectify_countdown_or_bool(arg_2)\n    arg_3 = arg_1.get('precision', None)\n    arg_4 = arg_1.get('kvsep', ': ')\n    if arg_2:\n        arg_4 = '='\n\n    def make_item_str(arg_5, arg_6):\n        if arg_2 or arg_1.get('strkeys', False):\n            arg_7 = six.text_type(arg_5)\n        else:\n            arg_7 = repr2(arg_5, arg_3=arg_3, newlines=0)\n\n        arg_8 = arg_7 + arg_4\n        arg_1['_return_info'] = True\n        arg_9, arg_10 = repr2(arg_6, **arg_1)\n\n        # If the first line does not end with an open nest char\n        # (e.g. for ndarrays), otherwise we need to worry about\n        # residual indentation.\n        arg_11 = arg_9.find('\\n')\n        arg_12 = arg_9 if arg_11 == -1 else arg_9[:arg_11]\n\n        arg_13 = arg_1.get('cbr', arg_1.get('compact_brace', False))\n\n        if arg_13 or not arg_12.rstrip().endswith(tuple('([{<')):\n            arg_14 = '' if arg_11 == -1 else arg_9[arg_11:]\n            arg_9 = arg_12.lstrip() + arg_14\n            if '\\n' in arg_8:\n                # Fix issue with keys that span new lines\n                arg_15 = arg_8 + arg_9\n            else:\n                arg_15 = ub.hzcat([arg_8, arg_9])\n        else:\n            arg_15 = arg_8 + arg_9\n        return arg_15, arg_10\n\n    arg_16 = list(six.iteritems(arg_0))\n    arg_17 = [make_item_str(arg_5, arg_6) for (arg_5, arg_6) in arg_16]\n    arg_18 = [t[0] for t in arg_17]\n    arg_19 = max([t[1]['max_height'] for t in arg_17]) if arg_17 else 0\n    arg_10 = {\n        'max_height': arg_19 + 1,\n    }\n\n    arg_20 = arg_1.get('sort', None)\n    if arg_20 is None:\n        # Force ordering on unordered dicts\n        arg_20 = True\n    if isinstance(arg_0, collections.OrderedDict):\n        # never sort ordered dicts; they are perfect just the way they are!\n        arg_20 = False\n    if arg_20:\n        arg_18 = _sort_itemstrs(arg_16, arg_18)\n    return arg_18, arg_10", "path": "ubelt/util_format.py", "identifier": "_dict_itemstrs", "docstring": "Create a string representation for each item in a dict.\n\n    Example:\n        >>> from ubelt.util_format import *\n        >>> dict_ =  {'b': .1, 'l': 'st', 'g': 1.0, 's': 10, 'm': 0.9, 'w': .5}\n        >>> kwargs = {'strkeys': True}\n        >>> itemstrs, _ = _dict_itemstrs(dict_, **kwargs)\n        >>> char_order = [p[0] for p in itemstrs]\n        >>> assert char_order == ['b', 'g', 'l', 'm', 's', 'w']", "docstring_tokens": ["Create", "a", "string", "representation", "for", "each", "item", "in", "a", "dict", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 252939}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/db.py#L292-L309", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Given the model, check that all the metadata role values\n    have valid information in them and any required metadata fields\n    contain values.", "language": "python", "parameters": "(model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "ATTRIBUTED_ROLE_KEYS", "[", "0", "]", ",", "ATTRIBUTED_ROLE_KEYS", "[", "4", "]", ",", ")", "for", "arg_2", "in", "ATTRIBUTED_ROLE_KEYS", ":", "try", ":", "arg_3", "=", "arg_0", ".", "metadata", "[", "arg_2", "]", "except", "KeyError", ":", "if", "arg_2", "in", "arg_1", ":", "raise", "exceptions", ".", "MissingRequiredMetadata", "(", "arg_2", ")", "else", ":", "if", "arg_2", "in", "arg_1", "and", "len", "(", "arg_3", ")", "==", "0", ":", "raise", "exceptions", ".", "MissingRequiredMetadata", "(", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "get", "(", "'type'", ")", "!=", "'cnx-id'", ":", "raise", "exceptions", ".", "InvalidRole", "(", "arg_2", ",", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"Given the model, check that all the metadata role values\n    have valid information in them and any required metadata fields\n    contain values.\n    \"\"\"\n    arg_1 = (ATTRIBUTED_ROLE_KEYS[0], ATTRIBUTED_ROLE_KEYS[4],)\n    for arg_2 in ATTRIBUTED_ROLE_KEYS:\n        try:\n            arg_3 = arg_0.metadata[arg_2]\n        except KeyError:\n            if arg_2 in arg_1:\n                raise exceptions.MissingRequiredMetadata(arg_2)\n        else:\n            if arg_2 in arg_1 and len(arg_3) == 0:\n                raise exceptions.MissingRequiredMetadata(arg_2)\n        for arg_4 in arg_3:\n            if arg_4.get('type') != 'cnx-id':\n                raise exceptions.InvalidRole(arg_2, arg_4)", "path": "cnxpublishing/db.py", "identifier": "_validate_roles", "docstring": "Given the model, check that all the metadata role values\n    have valid information in them and any required metadata fields\n    contain values.", "docstring_tokens": ["Given", "the", "model", "check", "that", "all", "the", "metadata", "role", "values", "have", "valid", "information", "in", "them", "and", "any", "required", "metadata", "fields", "contain", "values", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 252940}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Instruction.py#L217-L231", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Return a SVGDumper for this instruction.", "language": "python", "parameters": "(self, converter=None)", "return_statement": "return converter.to_svg(self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "from", "knittingpattern", ".", "convert", ".", "InstructionSVGCache", "import", "default_svg_cache", "arg_1", "=", "default_svg_cache", "(", ")", "return", "arg_1", ".", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Return a SVGDumper for this instruction.\n\n        :param converter: a :class:`\n          knittingpattern.convert.InstructionSVGCache.InstructionSVGCache` or\n          :obj:`None`. If :obj:`None` is given, the :func:`\n          knittingpattern.convert.InstructionSVGCache.default_svg_cache` is\n          used.\n        :rtype: knittingpattern.Dumper.SVGDumper\n        \"\"\"\n        if arg_1 is None:\n            from knittingpattern.convert.InstructionSVGCache import \\\n                default_svg_cache\n            arg_1 = default_svg_cache()\n        return arg_1.Func(arg_0)", "path": "knittingpattern/Instruction.py", "identifier": "Instruction.to_svg", "docstring": "Return a SVGDumper for this instruction.\n\n        :param converter: a :class:`\n          knittingpattern.convert.InstructionSVGCache.InstructionSVGCache` or\n          :obj:`None`. If :obj:`None` is given, the :func:`\n          knittingpattern.convert.InstructionSVGCache.default_svg_cache` is\n          used.\n        :rtype: knittingpattern.Dumper.SVGDumper", "docstring_tokens": ["Return", "a", "SVGDumper", "for", "this", "instruction", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 252941}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L383-L402", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Make OAuth token request.", "language": "python", "parameters": "(session, token_request_data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "post", "(", "OAUTH2_TOKEN_REQUEST_URL", ",", "data", "=", "arg_1", ")", "arg_2", ".", "raise_for_status", "(", ")", "except", "requests", ".", "RequestException", "as", "e", ":", "raise", "GoogleAuthError", "(", "'Token request failed: {}'", ".", "format", "(", "e", ")", ")", "else", ":", "arg_3", "=", "arg_2", ".", "json", "(", ")", "if", "'error'", "in", "arg_3", ":", "raise", "GoogleAuthError", "(", "'Token request error: {!r}'", ".", "format", "(", "arg_3", "[", "'error'", "]", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Make OAuth token request.\n\n    Raises GoogleAuthError if authentication fails.\n\n    Returns dict response.\n    \"\"\"\n    try:\n        arg_2 = arg_0.post(OAUTH2_TOKEN_REQUEST_URL, data=arg_1)\n        arg_2.raise_for_status()\n    except requests.RequestException as e:\n        raise GoogleAuthError('Token request failed: {}'.format(e))\n    else:\n        arg_3 = arg_2.json()\n        # If an error occurred, a key 'error' will contain an error code.\n        if 'error' in arg_3:\n            raise GoogleAuthError(\n                'Token request error: {!r}'.format(arg_3['error'])\n            )\n        return arg_3", "path": "hangups/auth.py", "identifier": "_make_token_request", "docstring": "Make OAuth token request.\n\n    Raises GoogleAuthError if authentication fails.\n\n    Returns dict response.", "docstring_tokens": ["Make", "OAuth", "token", "request", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 252942}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/admin.py#L52-L71", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Deploy polyaxon.", "language": "python", "parameters": "(file, manager_path, check, dry_run)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "read_Funcment_config", "(", "arg_0", ")", "arg_5", "=", "DeployManager", "(", "arg_4", "=", "arg_4", ",", "filepath", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", "arg_6", "=", "None", "if", "arg_2", ":", "arg_5", ".", "check", "(", ")", "Printer", ".", "print_success", "(", "'Polyaxon Funcment file is valid.'", ")", "else", ":", "try", ":", "arg_5", ".", "install", "(", ")", "except", "Exception", "as", "e", ":", "Printer", ".", "print_error", "(", "'Polyaxon could not be installed.'", ")", "arg_6", "=", "e", "if", "arg_6", ":", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):  # pylint:disable=redefined-builtin\n    \"\"\"Deploy polyaxon.\"\"\"\n    arg_4 = read_Funcment_config(arg_0)\n    arg_5 = DeployManager(arg_4=arg_4,\n                            filepath=arg_0,\n                            arg_1=arg_1,\n                            arg_3=arg_3)\n    arg_6 = None\n    if arg_2:\n        arg_5.check()\n        Printer.print_success('Polyaxon Funcment file is valid.')\n    else:\n        try:\n            arg_5.install()\n        except Exception as e:\n            Printer.print_error('Polyaxon could not be installed.')\n            arg_6 = e\n\n    if arg_6:\n        Printer.print_error('Error message `{}`.'.format(arg_6))", "path": "polyaxon_cli/cli/admin.py", "identifier": "deploy", "docstring": "Deploy polyaxon.", "docstring_tokens": ["Deploy", "polyaxon", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 252943}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/omim.py#L38-L41", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "docstring for parse_omim_2_line", "language": "python", "parameters": "(line, header)", "return_statement": "return omim_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", "zip", "(", "arg_1", ",", "arg_0", ".", "split", "(", "'\\t'", ")", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"docstring for parse_omim_2_line\"\"\"\n    arg_2 = dict(zip(arg_1, arg_0.split('\\t')))\n    return arg_2", "path": "scout/parse/omim.py", "identifier": "parse_omim_line", "docstring": "docstring for parse_omim_2_line", "docstring_tokens": ["docstring", "for", "parse_omim_2_line"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252944}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L337-L348", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "Disables digital reporting. By turning reporting off for this pin, reporting\n        is disabled for all 8 bits in the \"port\" -", "language": "python", "parameters": "(self, pin)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "//", "8", "arg_3", "=", "[", "arg_0", ".", "_command_handler", ".", "REPORT_DIGITAL", "+", "arg_2", ",", "arg_0", ".", "REPORTING_DISABLE", "]", "arg_0", ".", "_command_handler", ".", "send_command", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Disables digital reporting. By turning reporting off for this pin, reporting\n        is disabled for all 8 bits in the \"port\" -\n\n        :param pin: Pin and all pins for this port\n\n        :return: No return value\n        \"\"\"\n        arg_2 = arg_1 // 8\n        arg_3 = [arg_0._command_handler.REPORT_DIGITAL + arg_2, arg_0.REPORTING_DISABLE]\n        arg_0._command_handler.send_command(arg_3)", "path": "PyMata/pymata.py", "identifier": "PyMata.disable_digital_reporting", "docstring": "Disables digital reporting. By turning reporting off for this pin, reporting\n        is disabled for all 8 bits in the \"port\" -\n\n        :param pin: Pin and all pins for this port\n\n        :return: No return value", "docstring_tokens": ["Disables", "digital", "reporting", ".", "By", "turning", "reporting", "off", "for", "this", "pin", "reporting", "is", "disabled", "for", "all", "8", "bits", "in", "the", "port", "-"], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 252945}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/interrupts.py#L309-L341", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Waits for events on the event queue and calls the registered functions.", "language": "python", "parameters": "(\n        function_maps, event_queue, event_matches_function_map,\n        terminate_signal)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "while", "True", ":", "arg_4", "=", "arg_1", ".", "get", "(", ")", "if", "arg_4", "==", "arg_3", ":", "return", "arg_5", "=", "map", "(", "lambda", "fm", ":", "fm", ".", "callback", "if", "arg_2", "(", "arg_4", ",", "fm", ")", "else", "None", ",", "arg_0", ")", "arg_5", "=", "filter", "(", "lambda", "f", ":", "f", "is", "not", "None", ",", "arg_5", ")", "for", "arg_6", "in", "arg_5", ":", "arg_6", "(", "arg_4", ")"], "function": "def Func(\n        arg_0, arg_1, arg_2,\n        arg_3):\n    \"\"\"Waits for events on the event queue and calls the registered functions.\n\n    :param function_maps: A list of classes that have inheritted from\n        :class:`FunctionMap`\\ s describing what to do with events.\n    :type function_maps: list\n    :param event_queue: A queue to put events on.\n    :type event_queue: :py:class:`multiprocessing.Queue`\n    :param event_matches_function_map: A function that determines if the given\n        event and :class:`FunctionMap` match.\n    :type event_matches_function_map: function\n    :param terminate_signal: The signal that, when placed on the event queue,\n        causes this function to exit.\n    \"\"\"\n    while True:\n        # print(\"HANDLE: Waiting for events!\")\n        arg_4 = arg_1.get()\n        # print(\"HANDLE: It's an event!\")\n        if arg_4 == arg_3:\n            return\n        # if matching get the callback function, else function is None\n        arg_5 = map(\n            lambda fm: fm.callback\n            if arg_2(arg_4, fm) else None,\n            arg_0)\n        # reduce to just the callback functions (remove None)\n        # TODO: I think this can just be filter(None, functions)\n        arg_5 = filter(lambda f: f is not None, arg_5)\n\n        for arg_6 in arg_5:\n            arg_6(arg_4)", "path": "pifacecommon/interrupts.py", "identifier": "handle_events", "docstring": "Waits for events on the event queue and calls the registered functions.\n\n    :param function_maps: A list of classes that have inheritted from\n        :class:`FunctionMap`\\ s describing what to do with events.\n    :type function_maps: list\n    :param event_queue: A queue to put events on.\n    :type event_queue: :py:class:`multiprocessing.Queue`\n    :param event_matches_function_map: A function that determines if the given\n        event and :class:`FunctionMap` match.\n    :type event_matches_function_map: function\n    :param terminate_signal: The signal that, when placed on the event queue,\n        causes this function to exit.", "docstring_tokens": ["Waits", "for", "events", "on", "the", "event", "queue", "and", "calls", "the", "registered", "functions", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 252946}
{"url": "https://github.com/stianaske/pybotvac/blob/e3f655e81070ff209aaa4efb7880016cf2599e6d/pybotvac/account.py#L36-L54", "sha": "e3f655e81070ff209aaa4efb7880016cf2599e6d", "docstring_summary": "Login to pybotvac account using provided email and password.", "language": "python", "parameters": "(self, email, password)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "requests", ".", "post", "(", "urljoin", "(", "arg_0", ".", "ENDPOINT", ",", "'sessions'", ")", ",", "json", "=", "{", "'email'", ":", "arg_1", ",", "'password'", ":", "arg_2", ",", "'platform'", ":", "'ios'", ",", "'token'", ":", "binascii", ".", "hexlify", "(", "os", ".", "urandom", "(", "64", ")", ")", ".", "decode", "(", "'utf8'", ")", "}", ",", "headers", "=", "arg_0", ".", "_headers", ")", "arg_3", ".", "raise_for_status", "(", ")", "arg_4", "=", "arg_3", ".", "json", "(", ")", "[", "'access_token'", "]", "arg_0", ".", "_headers", "[", "'Authorization'", "]", "=", "'Token token=%s'", "%", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Login to pybotvac account using provided email and password.\n\n        :param email: email for pybotvac account\n        :param password: Password for pybotvac account\n        :return:\n        \"\"\"\n        arg_3 = requests.post(urljoin(arg_0.ENDPOINT, 'sessions'),\n                                 json={'email': arg_1,\n                                       'password': arg_2,\n                                       'platform': 'ios',\n                                       'token': binascii.hexlify(os.urandom(64)).decode('utf8')},\n                                 headers=arg_0._headers)\n\n        arg_3.raise_for_status()\n        arg_4 = arg_3.json()['access_token']\n\n        arg_0._headers['Authorization'] = 'Token token=%s' % arg_4", "path": "pybotvac/account.py", "identifier": "Account._login", "docstring": "Login to pybotvac account using provided email and password.\n\n        :param email: email for pybotvac account\n        :param password: Password for pybotvac account\n        :return:", "docstring_tokens": ["Login", "to", "pybotvac", "account", "using", "provided", "email", "and", "password", "."], "nwo": "stianaske/pybotvac", "score": 0.6514120724143954, "idx": 252947}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/cx_cancellation.py#L16-L49", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Run one pass of cx cancellation on the circuit", "language": "python", "parameters": "(self, dag)", "return_statement": "return dag", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "collect_Funcs", "(", "[", "\"cx\"", "]", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "for", "arg_6", "in", "range", "(", "len", "(", "arg_3", ")", "-", "1", ")", ":", "arg_5", ".", "append", "(", "arg_3", "[", "arg_6", "]", ")", "arg_7", "=", "arg_3", "[", "arg_6", "]", ".", "qargs", "arg_8", "=", "arg_3", "[", "arg_6", "+", "1", "]", ".", "qargs", "if", "arg_7", "!=", "arg_8", ":", "arg_4", ".", "append", "(", "arg_5", ")", "arg_5", "=", "[", "]", "arg_5", ".", "append", "(", "arg_3", "[", "-", "1", "]", ")", "arg_4", ".", "append", "(", "arg_5", ")", "for", "arg_5", "in", "arg_4", ":", "if", "len", "(", "arg_5", ")", "%", "2", "==", "0", ":", "for", "arg_9", "in", "arg_5", ":", "arg_1", ".", "remove_op_node", "(", "arg_9", ")", "else", ":", "for", "arg_9", "in", "arg_5", "[", "1", ":", "]", ":", "arg_1", ".", "remove_op_node", "(", "arg_9", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Run one pass of cx cancellation on the circuit\n\n        Args:\n            dag (DAGCircuit): the directed acyclic graph to Func on.\n        Returns:\n            DAGCircuit: Transformed DAG.\n        \"\"\"\n        arg_2 = arg_1.collect_Funcs([\"cx\"])\n        for arg_3 in arg_2:\n            # Partition the cx_Func into chunks with equal gate arguments\n            arg_4 = []\n            arg_5 = []\n            for arg_6 in range(len(arg_3) - 1):\n                arg_5.append(arg_3[arg_6])\n\n                arg_7 = arg_3[arg_6].qargs\n                arg_8 = arg_3[arg_6 + 1].qargs\n\n                if arg_7 != arg_8:\n                    arg_4.append(arg_5)\n                    arg_5 = []\n            arg_5.append(arg_3[-1])\n            arg_4.append(arg_5)\n            # Simplify each chunk in the partition\n            for arg_5 in arg_4:\n                if len(arg_5) % 2 == 0:\n                    for arg_9 in arg_5:\n                        arg_1.remove_op_node(arg_9)\n                else:\n                    for arg_9 in arg_5[1:]:\n                        arg_1.remove_op_node(arg_9)\n        return arg_1", "path": "qiskit/transpiler/passes/cx_cancellation.py", "identifier": "CXCancellation.run", "docstring": "Run one pass of cx cancellation on the circuit\n\n        Args:\n            dag (DAGCircuit): the directed acyclic graph to run on.\n        Returns:\n            DAGCircuit: Transformed DAG.", "docstring_tokens": ["Run", "one", "pass", "of", "cx", "cancellation", "on", "the", "circuit"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 252948}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L1072-L1081", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Climbs up the site tree to mark items of current branch.", "language": "python", "parameters": "(self, tree_alias, base_item)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_2", ".", "in_current_branch", "=", "True", "if", "hasattr", "(", "arg_2", ",", "'parent'", ")", "and", "arg_2", ".", "parent", "is", "not", "None", ":", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_0", ".", "get_item_by_id", "(", "arg_1", ",", "arg_2", ".", "parent", ".", "id", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Climbs up the site tree to mark items of current branch.\n\n        :param str|unicode tree_alias:\n        :param TreeItemBase base_item:\n        \"\"\"\n        if arg_2 is not None:\n            arg_2.in_current_branch = True\n            if hasattr(arg_2, 'parent') and arg_2.parent is not None:\n                arg_0.Func(arg_1, arg_0.get_item_by_id(arg_1, arg_2.parent.id))", "path": "sitetree/sitetreeapp.py", "identifier": "SiteTree.tree_climber", "docstring": "Climbs up the site tree to mark items of current branch.\n\n        :param str|unicode tree_alias:\n        :param TreeItemBase base_item:", "docstring_tokens": ["Climbs", "up", "the", "site", "tree", "to", "mark", "items", "of", "current", "branch", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 252949}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sftp_hook.py#L92-L115", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns an SFTP connection object", "language": "python", "parameters": "(self)", "return_statement": "return self.conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "conn", "is", "None", ":", "arg_1", "=", "pysftp", ".", "CnOpts", "(", ")", "if", "arg_0", ".", "no_host_key_check", ":", "arg_1", ".", "hostkeys", "=", "None", "arg_1", ".", "compression", "=", "arg_0", ".", "compress", "arg_4", "=", "{", "'host'", ":", "arg_0", ".", "remote_host", ",", "'port'", ":", "arg_0", ".", "port", ",", "'username'", ":", "arg_0", ".", "username", ",", "'cnopts'", ":", "arg_1", "}", "if", "arg_0", ".", "password", "and", "arg_0", ".", "password", ".", "strip", "(", ")", ":", "arg_4", "[", "'password'", "]", "=", "arg_0", ".", "password", "if", "arg_0", ".", "key_file", ":", "arg_4", "[", "'private_key'", "]", "=", "arg_0", ".", "key_file", "if", "arg_0", ".", "private_key_pass", ":", "arg_4", "[", "'private_key_pass'", "]", "=", "arg_0", ".", "private_key_pass", "arg_0", ".", "conn", "=", "pysftp", ".", "Connection", "(", "**", "arg_4", ")", "return", "arg_0", ".", "conn"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns an SFTP connection object\n        \"\"\"\n        if arg_0.conn is None:\n            arg_1 = pysftp.CnOpts()\n            if arg_0.no_host_key_check:\n                arg_1.hostkeys = None\n            arg_1.compression = arg_0.compress\n            arg_4 = {\n                'host': arg_0.remote_host,\n                'port': arg_0.port,\n                'username': arg_0.username,\n                'cnopts': arg_1\n            }\n            if arg_0.password and arg_0.password.strip():\n                arg_4['password'] = arg_0.password\n            if arg_0.key_file:\n                arg_4['private_key'] = arg_0.key_file\n            if arg_0.private_key_pass:\n                arg_4['private_key_pass'] = arg_0.private_key_pass\n\n            arg_0.conn = pysftp.Connection(**arg_4)\n        return arg_0.conn", "path": "airflow/contrib/hooks/sftp_hook.py", "identifier": "SFTPHook.get_conn", "docstring": "Returns an SFTP connection object", "docstring_tokens": ["Returns", "an", "SFTP", "connection", "object"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252950}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L223-L234", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Multiplying a matrix by its inverse produces the identity matrix.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "matrix", "arg_2", "=", "arg_1", "[", "0", "]", "*", "arg_1", "[", "4", "]", "-", "arg_1", "[", "1", "]", "*", "arg_1", "[", "3", "]", "arg_0", ".", "matrix", "=", "[", "arg_1", "[", "4", "]", "/", "arg_2", ",", "-", "arg_1", "[", "1", "]", "/", "arg_2", ",", "0", ",", "-", "arg_1", "[", "3", "]", "/", "arg_2", ",", "arg_1", "[", "0", "]", "/", "arg_2", ",", "0", ",", "(", "arg_1", "[", "3", "]", "*", "arg_1", "[", "7", "]", "-", "arg_1", "[", "4", "]", "*", "arg_1", "[", "6", "]", ")", "/", "arg_2", ",", "-", "(", "arg_1", "[", "0", "]", "*", "arg_1", "[", "7", "]", "-", "arg_1", "[", "1", "]", "*", "arg_1", "[", "6", "]", ")", "/", "arg_2", ",", "1", "]"], "function": "def Func(arg_0):\r\n        \"\"\" Multiplying a matrix by its inverse produces the identity matrix.\r\n        \"\"\"\r\n        arg_1 = arg_0.matrix\r\n        arg_2 = arg_1[0] * arg_1[4] - arg_1[1] * arg_1[3]\r\n        arg_0.matrix = [\r\n             arg_1[4] / arg_2, -arg_1[1] / arg_2, 0,\r\n             -arg_1[3] / arg_2,  arg_1[0] / arg_2, 0,\r\n             (arg_1[3] * arg_1[7] - arg_1[4] * arg_1[6]) / arg_2,\r\n             -(arg_1[0] * arg_1[7] - arg_1[1] * arg_1[6]) / arg_2,\r\n             1\r\n        ]", "path": "shoebot/data/geometry.py", "identifier": "AffineTransform.invert", "docstring": "Multiplying a matrix by its inverse produces the identity matrix.", "docstring_tokens": ["Multiplying", "a", "matrix", "by", "its", "inverse", "produces", "the", "identity", "matrix", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 252951}
{"url": "https://github.com/nephila/djangocms-installer/blob/9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e/djangocms_installer/config/ini.py#L49-L93", "sha": "9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e", "docstring_summary": "Dump args to config file.", "language": "python", "parameters": "(filename, args, parser=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "ConfigParser", "(", ")", "arg_3", ".", "add_section", "(", "SECTION", ")", "if", "arg_2", "is", "None", ":", "for", "arg_4", "in", "arg_1", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_4", ",", "arg_1", ".", "attr", ")", "else", ":", "arg_5", "=", "(", "'--extra-settings'", ",", "'--languages'", ",", "'--requirements'", ",", "'--template'", ",", "'--timezone'", ")", "for", "arg_6", "in", "arg_2", ".", "_actions", ":", "if", "arg_6", ".", "dest", "in", "(", "'help'", ",", "'config_file'", ",", "'config_dump'", ",", "'project_name'", ")", ":", "continue", "arg_7", "=", "arg_6", ".", "option_strings", "[", "0", "]", "arg_8", "=", "arg_7", ".", "lstrip", "(", "'-'", ")", "arg_9", "=", "getattr", "(", "arg_1", ",", "arg_6", ".", "dest", ")", "if", "any", "(", "[", "arg_10", "for", "arg_10", "in", "arg_5", "if", "arg_10", "in", "arg_6", ".", "option_strings", "]", ")", ":", "if", "arg_6", ".", "dest", "==", "'languages'", ":", "if", "len", "(", "arg_9", ")", "==", "1", "and", "arg_9", "[", "0", "]", "==", "'en'", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "''", ")", "else", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "','", ".", "join", "(", "arg_9", ")", ")", "else", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "arg_9", "if", "arg_9", "else", "''", ")", "elif", "arg_6", ".", "choices", "==", "(", "'yes'", ",", "'no'", ")", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "'yes'", "if", "arg_9", "else", "'no'", ")", "elif", "arg_6", ".", "dest", "==", "'templates'", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "arg_9", "if", "arg_9", "else", "'no'", ")", "elif", "arg_6", ".", "dest", "==", "'cms_version'", ":", "arg_11", "=", "(", "'stable'", "if", "arg_9", "==", "CMS_VERSION_MATRIX", "[", "'stable'", "]", "else", "arg_9", ")", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "arg_11", ")", "elif", "arg_6", ".", "dest", "==", "'django_version'", ":", "arg_11", "=", "(", "'stable'", "if", "arg_9", "==", "DJANGO_VERSION_MATRIX", "[", "'stable'", "]", "else", "arg_9", ")", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "arg_11", ")", "elif", "arg_6", ".", "const", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "'true'", "if", "arg_9", "else", "'false'", ")", "else", ":", "arg_3", ".", "set", "(", "SECTION", ",", "arg_8", ",", "str", "(", "arg_9", ")", ")", "with", "open", "(", "arg_0", ",", "'w'", ")", "as", "fp", ":", "arg_3", ".", "write", "(", "fp", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Dump args to config file.\"\"\"\n    arg_3 = ConfigParser()\n    arg_3.add_section(SECTION)\n    if arg_2 is None:\n        for arg_4 in arg_1:\n            arg_3.set(SECTION, arg_4, arg_1.attr)\n    else:\n        arg_5 = (\n            '--extra-settings', '--languages', '--requirements', '--template', '--timezone')\n\n        # positionals._option_string_actions\n        for arg_6 in arg_2._actions:\n            if arg_6.dest in ('help', 'config_file', 'config_dump', 'project_name'):\n                continue\n\n            arg_7 = arg_6.option_strings[0]\n            arg_8 = arg_7.lstrip('-')\n            arg_9 = getattr(arg_1, arg_6.dest)\n            if any([arg_10 for arg_10 in arg_5 if arg_10 in arg_6.option_strings]):\n                if arg_6.dest == 'languages':\n                    if len(arg_9) == 1 and arg_9[0] == 'en':\n                        arg_3.set(SECTION, arg_8, '')\n                    else:\n                        arg_3.set(SECTION, arg_8, ','.join(arg_9))\n                else:\n                    arg_3.set(SECTION, arg_8, arg_9 if arg_9 else '')\n            elif arg_6.choices == ('yes', 'no'):\n                arg_3.set(SECTION, arg_8, 'yes' if arg_9 else 'no')\n            elif arg_6.dest == 'templates':\n                arg_3.set(SECTION, arg_8, arg_9 if arg_9 else 'no')\n            elif arg_6.dest == 'cms_version':\n                arg_11 = ('stable' if arg_9 == CMS_VERSION_MATRIX['stable']\n                           else arg_9)\n                arg_3.set(SECTION, arg_8, arg_11)\n            elif arg_6.dest == 'django_version':\n                arg_11 = ('stable' if arg_9 == DJANGO_VERSION_MATRIX['stable']\n                           else arg_9)\n                arg_3.set(SECTION, arg_8, arg_11)\n            elif arg_6.const:\n                arg_3.set(SECTION, arg_8, 'true' if arg_9 else 'false')\n            else:\n                arg_3.set(SECTION, arg_8, str(arg_9))\n    with open(arg_0, 'w') as fp:\n        arg_3.write(fp)", "path": "djangocms_installer/config/ini.py", "identifier": "dump_config_file", "docstring": "Dump args to config file.", "docstring_tokens": ["Dump", "args", "to", "config", "file", "."], "nwo": "nephila/djangocms-installer", "score": 0.7157994486187137, "idx": 252952}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/ifContainter.py#L306-L314", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Merge nested IfContarner form else branch to this IfContainer\n        as elif and else branches", "language": "python", "parameters": "(self, ifStm: \"IfContainer\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "\"IfContainer\"", ")", ":", "arg_0", ".", "elIfs", ".", "append", "(", "(", "arg_1", ".", "cond", ",", "arg_1", ".", "ifTrue", ")", ")", "arg_0", ".", "elIfs", ".", "extend", "(", "arg_1", ".", "elIfs", ")", "arg_0", ".", "ifFalse", "=", "arg_1", ".", "ifFalse"], "function": "def Func(arg_0, arg_1: \"IfContainer\"):\n        \"\"\"\n        Merge nested IfContarner form else branch to this IfContainer\n        as elif and else branches\n        \"\"\"\n        arg_0.elIfs.append((arg_1.cond, arg_1.ifTrue))\n        arg_0.elIfs.extend(arg_1.elIfs)\n\n        arg_0.ifFalse = arg_1.ifFalse", "path": "hwt/hdl/ifContainter.py", "identifier": "IfContainer._merge_nested_if_from_else", "docstring": "Merge nested IfContarner form else branch to this IfContainer\n        as elif and else branches", "docstring_tokens": ["Merge", "nested", "IfContarner", "form", "else", "branch", "to", "this", "IfContainer", "as", "elif", "and", "else", "branches"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 252953}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L207-L214", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Compose the version predicates for requirement in PEP 345 fashion.", "language": "python", "parameters": "(requirement)", "return_statement": "return \" (%s)\" % ','.join(requires_dist)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "specs", ":", "arg_1", ".", "append", "(", "arg_2", "+", "arg_3", ")", "if", "not", "arg_1", ":", "return", "''", "return", "\" (%s)\"", "%", "','", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Compose the version predicates for requirement in PEP 345 fashion.\"\"\"\n    arg_1 = []\n    for arg_2, arg_3 in arg_0.specs:\n        arg_1.append(arg_2 + arg_3)\n    if not arg_1:\n        return ''\n    return \" (%s)\" % ','.join(arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py", "identifier": "requires_to_requires_dist", "docstring": "Compose the version predicates for requirement in PEP 345 fashion.", "docstring_tokens": ["Compose", "the", "version", "predicates", "for", "requirement", "in", "PEP", "345", "fashion", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 252954}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L271-L285", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Return all installed public keys", "language": "python", "parameters": "(self, current=False)", "return_statement": "return pubs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "store", ".", "Func", "(", ")", "if", "not", "arg_1", ":", "return", "arg_2", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "if", "arg_4", "[", ":", "len", "(", "arg_0", ".", "prefix", ")", "]", "==", "arg_0", ".", "prefix", ":", "arg_3", ".", "append", "(", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\" Return all installed public keys\n\n            :param bool current: If true, returns only keys for currently\n                connected blockchain\n        \"\"\"\n        arg_2 = arg_0.store.Func()\n        if not arg_1:\n            return arg_2\n        arg_3 = []\n        for arg_4 in arg_2:\n            # Filter those keys not for our network\n            if arg_4[: len(arg_0.prefix)] == arg_0.prefix:\n                arg_3.append(arg_4)\n        return arg_3", "path": "graphenecommon/wallet.py", "identifier": "Wallet.getPublicKeys", "docstring": "Return all installed public keys\n\n            :param bool current: If true, returns only keys for currently\n                connected blockchain", "docstring_tokens": ["Return", "all", "installed", "public", "keys"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 252955}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/differential_evolution.py#L519-L551", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Checks whether the convergence criteria have been met.", "language": "python", "parameters": "(population,\n                       population_values,\n                       func_tolerance,\n                       position_tolerance)", "return_statement": "return value_converged | x_converged", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "tf", ".", "math", ".", "abs", "(", "tf", ".", "math", ".", "reduce_max", "(", "input_tensor", "=", "arg_1", ")", "-", "tf", ".", "math", ".", "reduce_min", "(", "input_tensor", "=", "arg_1", ")", ")", "arg_5", "=", "arg_4", "<=", "arg_2", "arg_6", "=", "arg_3", "/", "2", "def", "part_converged", "(", "arg_7", ")", ":", "return", "tf", ".", "math", ".", "reduce_max", "(", "input_tensor", "=", "tf", ".", "math", ".", "abs", "(", "arg_7", "-", "arg_7", "[", "0", "]", ")", ")", "<=", "arg_6", "arg_8", "=", "tf", ".", "math", ".", "reduce_all", "(", "input_tensor", "=", "[", "part_converged", "(", "arg_7", ")", "for", "arg_7", "in", "arg_0", "]", ")", "return", "arg_5", "|", "arg_8"], "function": "def Func(arg_0,\n                       arg_1,\n                       arg_2,\n                       arg_3):\n  \"\"\"Checks whether the convergence criteria have been met.\"\"\"\n  # Check func tolerance\n  arg_4 = tf.math.abs(\n      tf.math.reduce_max(input_tensor=arg_1) -\n      tf.math.reduce_min(input_tensor=arg_1))\n  arg_5 = arg_4 <= arg_2\n  # Ideally, we would compute the position convergence by computing the\n  # pairwise distance between every member of the population and checking if\n  # the maximum of those is less than the supplied tolerance. However, this is\n  # completely infeasible in terms of performance. We adopt a more conservative\n  # approach which checks the distance between the first population member\n  # with the rest of the population. If the largest such distance is less than\n  # half the supplied tolerance, we stop. The reason why this is sufficient is\n  # as follows. For any pair of distinct points (a, b) in the population, we\n  # have the relation:  |a - b| <= |x0 - a| + |x0 - b|, where x0 is any\n  # other point. In particular, let x0 be the first element of the population\n  # and suppose that the largest distance between this point and any other\n  # member is epsilon. Then, for any pair of points (a, b),\n  # |a - b| <= 2 * epsilon and hence, the maximum distance between any pair of\n  # points in the population is bounded above by twice the distance between\n  # the first point and other points.\n  arg_6 = arg_3 / 2\n  def part_converged(arg_7):\n    return tf.math.reduce_max(input_tensor=tf.math.abs(arg_7 -\n                                                       arg_7[0])) <= arg_6\n\n  arg_8 = tf.math.reduce_all(\n      input_tensor=[part_converged(arg_7) for arg_7 in arg_0])\n  return arg_5 | arg_8", "path": "tensorflow_probability/python/optimizer/differential_evolution.py", "identifier": "_check_convergence", "docstring": "Checks whether the convergence criteria have been met.", "docstring_tokens": ["Checks", "whether", "the", "convergence", "criteria", "have", "been", "met", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252956}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/chartbeat.py#L46-L55", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "Top Chartbeat template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return ChartbeatTopNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "ChartbeatTopNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Top Chartbeat template tag.\n\n    Render the top Javascript code for Chartbeat.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return ChartbeatTopNode()", "path": "analytical/templatetags/chartbeat.py", "identifier": "chartbeat_top", "docstring": "Top Chartbeat template tag.\n\n    Render the top Javascript code for Chartbeat.", "docstring_tokens": ["Top", "Chartbeat", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 252957}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3466-L3481", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Display the DataFrame from row i1 till i2", "language": "python", "parameters": "(self, i1, i2, format='html')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'html'", ")", ":", "from", "IPython", "import", "display", "if", "arg_3", "==", "'html'", ":", "arg_4", "=", "arg_0", ".", "_as_html_table", "(", "arg_1", ",", "arg_2", ")", "display", ".", "display", "(", "display", ".", "HTML", "(", "arg_4", ")", ")", "else", ":", "arg_4", "=", "arg_0", ".", "_as_table", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "print", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='html'):\n        \"\"\"Display the DataFrame from row i1 till i2\n\n        For format, see https://pypi.org/project/tabulate/\n\n        :param int i1: Start row\n        :param int i2: End row.\n        :param str format: Format to use, e.g. 'html', 'plain', 'latex'\n        \"\"\"\n        from IPython import display\n        if arg_3 == 'html':\n            arg_4 = arg_0._as_html_table(arg_1, arg_2)\n            display.display(display.HTML(arg_4))\n        else:\n            arg_4 = arg_0._as_table(arg_1, arg_2, arg_3=arg_3)\n            print(arg_4)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.cat", "docstring": "Display the DataFrame from row i1 till i2\n\n        For format, see https://pypi.org/project/tabulate/\n\n        :param int i1: Start row\n        :param int i2: End row.\n        :param str format: Format to use, e.g. 'html', 'plain', 'latex'", "docstring_tokens": ["Display", "the", "DataFrame", "from", "row", "i1", "till", "i2"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 252958}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/audiosegment.py#L950-L1042", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Does a series of FFTs from `start_s` or `start_sample` for `duration_s` or `num_samples`.\n        Effectively, transforms a slice of the AudioSegment into the frequency domain across different\n        time bins.", "language": "python", "parameters": "(self, start_s=None, duration_s=None, start_sample=None, num_samples=None,\n                    window_length_s=None, window_length_samples=None, overlap=0.5, window=('tukey', 0.25))", "return_statement": "return fs, ts, sxx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "0.5", ",", "arg_8", "=", "(", "'tukey'", ",", "0.25", ")", ")", ":", "if", "arg_1", "is", "not", "None", "and", "arg_3", "is", "not", "None", ":", "raise", "ValueError", "(", "\"Only one of start_s and start_sample may be specified.\"", ")", "if", "arg_2", "is", "not", "None", "and", "arg_4", "is", "not", "None", ":", "raise", "ValueError", "(", "\"Only one of duration_s and num_samples may be specified.\"", ")", "if", "arg_5", "is", "not", "None", "and", "arg_6", "is", "not", "None", ":", "raise", "ValueError", "(", "\"Only one of window_length_s and window_length_samples may be specified.\"", ")", "if", "arg_5", "is", "None", "and", "arg_6", "is", "None", ":", "raise", "ValueError", "(", "\"You must specify a window length, either in window_length_s or in window_length_samples.\"", ")", "if", "arg_1", "is", "None", "and", "arg_3", "is", "None", ":", "arg_3", "=", "0", "elif", "arg_1", "is", "not", "None", ":", "arg_3", "=", "int", "(", "round", "(", "arg_1", "*", "arg_0", ".", "frame_rate", ")", ")", "if", "arg_2", "is", "None", "and", "arg_4", "is", "None", ":", "arg_4", "=", "len", "(", "arg_0", ".", "get_array_of_samples", "(", ")", ")", "-", "int", "(", "arg_3", ")", "elif", "arg_2", "is", "not", "None", ":", "arg_4", "=", "int", "(", "round", "(", "arg_2", "*", "arg_0", ".", "frame_rate", ")", ")", "if", "arg_5", "is", "not", "None", ":", "arg_6", "=", "int", "(", "round", "(", "arg_5", "*", "arg_0", ".", "frame_rate", ")", ")", "if", "arg_3", "+", "arg_4", ">", "len", "(", "arg_0", ".", "get_array_of_samples", "(", ")", ")", ":", "raise", "ValueError", "(", "\"The combination of start and duration will run off the end of the AudioSegment object.\"", ")", "arg_9", "=", "arg_0", ".", "to_numpy_array", "(", ")", "[", "arg_3", ":", "arg_3", "+", "arg_4", "]", "arg_10", ",", "arg_11", ",", "arg_12", "=", "signal", ".", "Func", "(", "arg_9", ",", "arg_0", ".", "frame_rate", ",", "scaling", "=", "'spectrum'", ",", "nperseg", "=", "arg_6", ",", "noverlap", "=", "int", "(", "round", "(", "arg_7", "*", "arg_6", ")", ")", ",", "mode", "=", "'magnitude'", ",", "arg_8", "=", "arg_8", ")", "return", "arg_10", ",", "arg_11", ",", "arg_12"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None,\n                    arg_5=None, arg_6=None, arg_7=0.5, arg_8=('tukey', 0.25)):\n        \"\"\"\n        Does a series of FFTs from `start_s` or `start_sample` for `duration_s` or `num_samples`.\n        Effectively, transforms a slice of the AudioSegment into the frequency domain across different\n        time bins.\n\n        .. code-block:: python\n\n            # Example for plotting a Func using this function\n            import audiosegment\n            import matplotlib.pyplot as plt\n\n            #...\n            seg = audiosegment.from_file(\"somebodytalking.wav\")\n            freqs, times, amplitudes = seg.Func(window_length_s=0.03, overlap=0.5)\n            amplitudes = 10 * np.log10(amplitudes + 1e-9)\n\n            # Plot\n            plt.pcolormesh(times, freqs, amplitudes)\n            plt.xlabel(\"Time in Seconds\")\n            plt.ylabel(\"Frequency in Hz\")\n            plt.show()\n\n        .. image:: images/Func.png\n\n        :param start_s: The start time. Starts at the beginning if neither this nor `start_sample` is specified.\n        :param duration_s: The duration of the Func in seconds. Goes to the end if neither this nor\n                           `num_samples` is specified.\n        :param start_sample: The index of the first sample to use. Starts at the beginning if neither this nor\n                             `start_s` is specified.\n        :param num_samples: The number of samples in the Func. Goes to the end if neither this nor\n                            `duration_s` is specified.\n        :param window_length_s: The length of each FFT in seconds. If the total number of samples in the Func\n                                is not a multiple of the window length in samples, the last window will be zero-padded.\n        :param window_length_samples: The length of each FFT in number of samples. If the total number of samples in the\n                                Func is not a multiple of the window length in samples, the last window will\n                                be zero-padded.\n        :param overlap: The fraction of each window to overlap.\n        :param window: See Scipy's Func-function_.\n                       This parameter is passed as-is directly into the Scipy Func function. It's documentation is reproduced here:\n                       Desired window to use. If window is a string or tuple, it is passed to get_window to generate the window values,\n                       which are DFT-even by default. See get_window for a list of windows and required parameters.\n                       If window is array_like it will be used directly as the window and its length must be\n                       `window_length_samples`.\n                       Defaults to a Tukey window with shape parameter of 0.25.\n        :returns: Three np.ndarrays: The frequency values in Hz (the y-axis in a Func), the time values starting\n                  at start time and then increasing by `duration_s` each step (the x-axis in a Func), and\n                  the dB of each time/frequency bin as a 2D array of shape [len(frequency values), len(duration)].\n        :raises ValueError: If `start_s` and `start_sample` are both specified, if `duration_s` and `num_samples` are both\n                            specified, if the first window's duration plus start time lead to running off the end\n                            of the AudioSegment, or if `window_length_s` and `window_length_samples` are either\n                            both specified or if they are both not specified.\n\n        .. _Func-function: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.Func.html\n        \"\"\"\n        if arg_1 is not None and arg_3 is not None:\n            raise ValueError(\"Only one of start_s and start_sample may be specified.\")\n        if arg_2 is not None and arg_4 is not None:\n            raise ValueError(\"Only one of duration_s and num_samples may be specified.\")\n        if arg_5 is not None and arg_6 is not None:\n            raise ValueError(\"Only one of window_length_s and window_length_samples may be specified.\")\n        if arg_5 is None and arg_6 is None:\n            raise ValueError(\"You must specify a window length, either in window_length_s or in window_length_samples.\")\n\n        # Determine the start sample\n        if arg_1 is None and arg_3 is None:\n            arg_3 = 0\n        elif arg_1 is not None:\n            arg_3 = int(round(arg_1 * arg_0.frame_rate))\n\n        # Determine the number of samples\n        if arg_2 is None and arg_4 is None:\n            arg_4 = len(arg_0.get_array_of_samples()) - int(arg_3)\n        elif arg_2 is not None:\n            arg_4 = int(round(arg_2 * arg_0.frame_rate))\n\n        # Determine the number of samples per window\n        if arg_5 is not None:\n            arg_6 = int(round(arg_5 * arg_0.frame_rate))\n\n        # Check validity of number of samples\n        if arg_3 + arg_4 > len(arg_0.get_array_of_samples()):\n            raise ValueError(\"The combination of start and duration will run off the end of the AudioSegment object.\")\n\n        # Create a Numpy Array out of the correct samples\n        arg_9 = arg_0.to_numpy_array()[arg_3:arg_3+arg_4]\n\n        # Use Scipy Func and return\n        arg_10, arg_11, arg_12 = signal.Func(arg_9, arg_0.frame_rate, scaling='spectrum', nperseg=arg_6,\n                                             noverlap=int(round(arg_7 * arg_6)),\n                                             mode='magnitude', arg_8=arg_8)\n        return arg_10, arg_11, arg_12", "path": "audiosegment.py", "identifier": "AudioSegment.spectrogram", "docstring": "Does a series of FFTs from `start_s` or `start_sample` for `duration_s` or `num_samples`.\n        Effectively, transforms a slice of the AudioSegment into the frequency domain across different\n        time bins.\n\n        .. code-block:: python\n\n            # Example for plotting a spectrogram using this function\n            import audiosegment\n            import matplotlib.pyplot as plt\n\n            #...\n            seg = audiosegment.from_file(\"somebodytalking.wav\")\n            freqs, times, amplitudes = seg.spectrogram(window_length_s=0.03, overlap=0.5)\n            amplitudes = 10 * np.log10(amplitudes + 1e-9)\n\n            # Plot\n            plt.pcolormesh(times, freqs, amplitudes)\n            plt.xlabel(\"Time in Seconds\")\n            plt.ylabel(\"Frequency in Hz\")\n            plt.show()\n\n        .. image:: images/spectrogram.png\n\n        :param start_s: The start time. Starts at the beginning if neither this nor `start_sample` is specified.\n        :param duration_s: The duration of the spectrogram in seconds. Goes to the end if neither this nor\n                           `num_samples` is specified.\n        :param start_sample: The index of the first sample to use. Starts at the beginning if neither this nor\n                             `start_s` is specified.\n        :param num_samples: The number of samples in the spectrogram. Goes to the end if neither this nor\n                            `duration_s` is specified.\n        :param window_length_s: The length of each FFT in seconds. If the total number of samples in the spectrogram\n                                is not a multiple of the window length in samples, the last window will be zero-padded.\n        :param window_length_samples: The length of each FFT in number of samples. If the total number of samples in the\n                                spectrogram is not a multiple of the window length in samples, the last window will\n                                be zero-padded.\n        :param overlap: The fraction of each window to overlap.\n        :param window: See Scipy's spectrogram-function_.\n                       This parameter is passed as-is directly into the Scipy spectrogram function. It's documentation is reproduced here:\n                       Desired window to use. If window is a string or tuple, it is passed to get_window to generate the window values,\n                       which are DFT-even by default. See get_window for a list of windows and required parameters.\n                       If window is array_like it will be used directly as the window and its length must be\n                       `window_length_samples`.\n                       Defaults to a Tukey window with shape parameter of 0.25.\n        :returns: Three np.ndarrays: The frequency values in Hz (the y-axis in a spectrogram), the time values starting\n                  at start time and then increasing by `duration_s` each step (the x-axis in a spectrogram), and\n                  the dB of each time/frequency bin as a 2D array of shape [len(frequency values), len(duration)].\n        :raises ValueError: If `start_s` and `start_sample` are both specified, if `duration_s` and `num_samples` are both\n                            specified, if the first window's duration plus start time lead to running off the end\n                            of the AudioSegment, or if `window_length_s` and `window_length_samples` are either\n                            both specified or if they are both not specified.\n\n        .. _spectrogram-function: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectrogram.html", "docstring_tokens": ["Does", "a", "series", "of", "FFTs", "from", "start_s", "or", "start_sample", "for", "duration_s", "or", "num_samples", ".", "Effectively", "transforms", "a", "slice", "of", "the", "AudioSegment", "into", "the", "frequency", "domain", "across", "different", "time", "bins", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 252959}
{"url": "https://github.com/Crypto-toolbox/btfxwss/blob/16827fa6aacb2c0e289aa852bf61a18df6905835/btfxwss/client.py#L303-L323", "sha": "16827fa6aacb2c0e289aa852bf61a18df6905835", "docstring_summary": "Unsubscribe to the passed pair's OHLC data channel.", "language": "python", "parameters": "(self, pair, timeframe=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "[", "'1m'", ",", "'5m'", ",", "'15m'", ",", "'30m'", ",", "'1h'", ",", "'3h'", ",", "'6h'", ",", "'12h'", ",", "'1D'", ",", "'7D'", ",", "'14D'", ",", "'1M'", "]", "if", "arg_2", ":", "if", "arg_2", "not", "in", "arg_4", ":", "raise", "ValueError", "(", "\"timeframe must be any of %s\"", "%", "arg_4", ")", "else", ":", "arg_2", "=", "'1m'", "arg_5", "=", "(", "'candles'", ",", "arg_1", ",", "arg_2", ")", "arg_1", "=", "'t'", "+", "arg_1", "if", "not", "arg_1", ".", "startswith", "(", "'t'", ")", "else", "arg_1", "arg_6", "=", "'trade:'", "+", "arg_2", "+", "':'", "+", "arg_1", "arg_0", ".", "_unsubscribe", "(", "'candles'", ",", "arg_5", ",", "arg_6", "=", "arg_6", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Unsubscribe to the passed pair's OHLC data channel.\n\n        :param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h,\n                                1D, 7D, 14D, 1M}\n        :param kwargs:\n        :return:\n        \"\"\"\n\n        arg_4 = ['1m', '5m', '15m', '30m', '1h', '3h', '6h', '12h', '1D',\n                     '7D', '14D', '1M']\n        if arg_2:\n            if arg_2 not in arg_4:\n                raise ValueError(\"timeframe must be any of %s\" % arg_4)\n        else:\n            arg_2 = '1m'\n        arg_5 = ('candles', arg_1, arg_2)\n        arg_1 = 't' + arg_1 if not arg_1.startswith('t') else arg_1\n        arg_6 = 'trade:' + arg_2 + ':' + arg_1\n\n        arg_0._unsubscribe('candles', arg_5, arg_6=arg_6, **arg_3)", "path": "btfxwss/client.py", "identifier": "BtfxWss.unsubscribe_from_candles", "docstring": "Unsubscribe to the passed pair's OHLC data channel.\n\n        :param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h,\n                                1D, 7D, 14D, 1M}\n        :param kwargs:\n        :return:", "docstring_tokens": ["Unsubscribe", "to", "the", "passed", "pair", "s", "OHLC", "data", "channel", "."], "nwo": "Crypto-toolbox/btfxwss", "score": 0.6139886433376424, "idx": 252960}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L25-L32", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Uploads a file", "language": "python", "parameters": "(filename, session)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "(", "'Uploading file %s'", "%", "arg_0", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_0", ")", "arg_3", "=", "'sftp://'", "+", "ADDRESS", "+", "WORKING_DIR", "arg_4", "=", "saga", ".", "filesystem", ".", "File", "(", "arg_2", ",", "arg_1", "=", "arg_1", ",", "flags", "=", "OVERWRITE", ")", "arg_4", ".", "copy", "(", "arg_3", ")", "print", "(", "'Transfer of `%s` to `%s` successful'", "%", "(", "arg_0", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Uploads a file \"\"\"\n    print('Uploading file %s' % arg_0)\n    arg_2 = os.path.join(os.getcwd(), arg_0)\n    arg_3 = 'sftp://' + ADDRESS + WORKING_DIR\n    arg_4 = saga.filesystem.File(arg_2, arg_1=arg_1, flags=OVERWRITE)\n    arg_4.copy(arg_3)\n    print('Transfer of `%s` to `%s` successful' % (arg_0, arg_3))", "path": "examples/example_22_saga_python/start_saga.py", "identifier": "upload_file", "docstring": "Uploads a file", "docstring_tokens": ["Uploads", "a", "file"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 252961}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/ext/jprops.py#L33-L53", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Writes properties to the file in Java properties format.", "language": "python", "parameters": "(fh, props, comment=None, timestamp=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "if", "arg_2", "is", "not", "None", ":", "write_comment", "(", "arg_0", ",", "arg_2", ")", "if", "arg_3", ":", "write_comment", "(", "arg_0", ",", "time", ".", "strftime", "(", "'%a %b %d %H:%M:%S %Z %Y'", ")", ")", "if", "hasattr", "(", "arg_1", ",", "'keys'", ")", ":", "for", "arg_4", "in", "arg_1", ":", "write_property", "(", "arg_0", ",", "arg_4", ",", "arg_1", "[", "arg_4", "]", ")", "else", ":", "for", "arg_4", ",", "arg_5", "in", "arg_1", ":", "write_property", "(", "arg_0", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=True):\n  \"\"\"\n    Writes properties to the file in Java properties format.\n\n    :param fh: a writable file-like object\n    :param props: a mapping (dict) or iterable of key/value pairs\n    :param comment: comment to write to the beginning of the file\n    :param timestamp: boolean indicating whether to write a timestamp comment\n  \"\"\"\n  if arg_2 is not None:\n    write_comment(arg_0, arg_2)\n\n  if arg_3:\n    write_comment(arg_0, time.strftime('%a %b %d %H:%M:%S %Z %Y'))\n\n  if hasattr(arg_1, 'keys'):\n    for arg_4 in arg_1:\n      write_property(arg_0, arg_4, arg_1[arg_4])\n  else:\n    for arg_4, arg_5 in arg_1:\n      write_property(arg_0, arg_4, arg_5)", "path": "packages/vaex-core/vaex/ext/jprops.py", "identifier": "store_properties", "docstring": "Writes properties to the file in Java properties format.\n\n    :param fh: a writable file-like object\n    :param props: a mapping (dict) or iterable of key/value pairs\n    :param comment: comment to write to the beginning of the file\n    :param timestamp: boolean indicating whether to write a timestamp comment", "docstring_tokens": ["Writes", "properties", "to", "the", "file", "in", "Java", "properties", "format", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 252962}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/chain.py#L40-L109", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes the min_event_ndims associated with the give list of bijectors.", "language": "python", "parameters": "(bijector_list, compute_forward=True)", "return_statement": "return min_event_ndims", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "0", "arg_3", "=", "0", "if", "arg_1", ":", "arg_0", "=", "reversed", "(", "arg_0", ")", "for", "arg_4", "in", "arg_0", ":", "if", "arg_1", ":", "arg_5", "=", "arg_4", ".", "forward_min_event_ndims", "arg_6", "=", "arg_4", ".", "inverse_min_event_ndims", "else", ":", "arg_5", "=", "arg_4", ".", "inverse_min_event_ndims", "arg_6", "=", "arg_4", ".", "forward_min_event_ndims", "if", "arg_3", "<", "arg_5", ":", "arg_2", "+=", "(", "arg_5", "-", "arg_3", ")", "arg_3", "=", "max", "(", "arg_5", ",", "arg_3", ")", "arg_7", "=", "(", "arg_5", "-", "arg_6", ")", "arg_3", "-=", "arg_7", "return", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n  \"\"\"Computes the min_event_ndims associated with the give list of bijectors.\n\n  Given a list `bijector_list` of bijectors, compute the min_event_ndims that is\n  associated with the composition of bijectors in that list.\n\n  min_event_ndims is the # of right most dimensions for which the bijector has\n  done necessary computation on (i.e. the non-broadcastable part of the\n  computation).\n\n  We can derive the min_event_ndims for a chain of bijectors as follows:\n\n  In the case where there are no rank changing bijectors, this will simply be\n  `max(b.forward_min_event_ndims for b in bijector_list)`. This is because the\n  bijector with the most forward_min_event_ndims requires the most dimensions,\n  and hence the chain also requires operating on those dimensions.\n\n  However in the case of rank changing, more care is needed in determining the\n  exact amount of dimensions. Padding dimensions causes subsequent bijectors to\n  operate on the padded dimensions, and Removing dimensions causes bijectors to\n  operate more left.\n\n  Args:\n    bijector_list: List of bijectors to be composed by chain.\n    compute_forward: Boolean. If True, computes the min_event_ndims associated\n      with a forward call to Chain, and otherwise computes the min_event_ndims\n      associated with an inverse call to Chain. The latter is the same as the\n      min_event_ndims associated with a forward call to Invert(Chain(....)).\n\n  Returns:\n    min_event_ndims\n  \"\"\"\n  arg_2 = 0\n  # This is a mouthful, but what this encapsulates is that if not for rank\n  # changing bijectors, we'd only need to compute the largest of the min\n  # required ndims. Hence \"max_min\". Due to rank changing bijectors, we need to\n  # account for synthetic rank growth / synthetic rank decrease from a rank\n  # changing bijector.\n  arg_3 = 0\n\n  if arg_1:\n    arg_0 = reversed(arg_0)\n\n  for arg_4 in arg_0:\n    if arg_1:\n      arg_5 = arg_4.forward_min_event_ndims\n      arg_6 = arg_4.inverse_min_event_ndims\n    else:\n      arg_5 = arg_4.inverse_min_event_ndims\n      arg_6 = arg_4.forward_min_event_ndims\n\n    # New dimensions were touched.\n    if arg_3 < arg_5:\n      arg_2 += (\n          arg_5 - arg_3)\n    arg_3 = max(\n        arg_5, arg_3)\n\n    # If the number of dimensions has increased via forward, then\n    # inverse_min_event_ndims > forward_min_event_ndims, and hence the\n    # dimensions we computed on, have moved left (so we have operated\n    # on additional dimensions).\n    # Conversely, if the number of dimensions has decreased via forward,\n    # then we have inverse_min_event_ndims < forward_min_event_ndims,\n    # and so we will have operated on fewer right most dimensions.\n\n    arg_7 = (\n        arg_5 - arg_6)\n    arg_3 -= arg_7\n  return arg_2", "path": "tensorflow_probability/python/bijectors/chain.py", "identifier": "_compute_min_event_ndims", "docstring": "Computes the min_event_ndims associated with the give list of bijectors.\n\n  Given a list `bijector_list` of bijectors, compute the min_event_ndims that is\n  associated with the composition of bijectors in that list.\n\n  min_event_ndims is the # of right most dimensions for which the bijector has\n  done necessary computation on (i.e. the non-broadcastable part of the\n  computation).\n\n  We can derive the min_event_ndims for a chain of bijectors as follows:\n\n  In the case where there are no rank changing bijectors, this will simply be\n  `max(b.forward_min_event_ndims for b in bijector_list)`. This is because the\n  bijector with the most forward_min_event_ndims requires the most dimensions,\n  and hence the chain also requires operating on those dimensions.\n\n  However in the case of rank changing, more care is needed in determining the\n  exact amount of dimensions. Padding dimensions causes subsequent bijectors to\n  operate on the padded dimensions, and Removing dimensions causes bijectors to\n  operate more left.\n\n  Args:\n    bijector_list: List of bijectors to be composed by chain.\n    compute_forward: Boolean. If True, computes the min_event_ndims associated\n      with a forward call to Chain, and otherwise computes the min_event_ndims\n      associated with an inverse call to Chain. The latter is the same as the\n      min_event_ndims associated with a forward call to Invert(Chain(....)).\n\n  Returns:\n    min_event_ndims", "docstring_tokens": ["Computes", "the", "min_event_ndims", "associated", "with", "the", "give", "list", "of", "bijectors", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252963}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L462-L475", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get a location information", "language": "python", "parameters": "(self, location_id: int, timeout: int=None)", "return_statement": "return self._get_model(url, timeout=timeout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "api", ".", "LOCATIONS", "+", "'/'", "+", "str", "(", "arg_1", ")", "return", "arg_0", ".", "_get_model", "(", "arg_4", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2=None):\n        \"\"\"Get a location information\n\n        Parameters\n        ----------\n        location_id: int\n            A location ID\n            See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json\n            for a list of acceptable location IDs\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_4 = arg_0.api.LOCATIONS + '/' + str(arg_1)\n        return arg_0._get_model(arg_4, arg_3=arg_3)", "path": "clashroyale/official_api/client.py", "identifier": "Client.get_location", "docstring": "Get a location information\n\n        Parameters\n        ----------\n        location_id: int\n            A location ID\n            See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json\n            for a list of acceptable location IDs\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "a", "location", "information"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 252964}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/chem.py#L544-L582", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Add another chem material package to this material package.", "language": "python", "parameters": "(self, other)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "type", "(", "arg_1", ")", "is", "MaterialPackage", ":", "if", "arg_0", ".", "material", "==", "arg_1", ".", "material", ":", "arg_0", ".", "compound_masses", "+=", "arg_1", ".", "compound_masses", "else", ":", "for", "arg_2", "in", "arg_1", ".", "material", ".", "compounds", ":", "if", "arg_2", "not", "in", "arg_0", ".", "material", ".", "compounds", ":", "raise", "Exception", "(", "\"Packages of '\"", "+", "arg_1", ".", "material", ".", "name", "+", "\"' cannot be added to packages of '\"", "+", "arg_0", ".", "material", ".", "name", "+", "\"'. The compound '\"", "+", "arg_2", "+", "\"' was not found in '\"", "+", "arg_0", ".", "material", ".", "name", "+", "\"'.\"", ")", "arg_0", ".", "Func", "(", "(", "arg_2", ",", "arg_1", ".", "get_compound_mass", "(", "arg_2", ")", ")", ")", "elif", "arg_0", ".", "_is_compound_mass_tuple", "(", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "0", "]", "arg_3", "=", "arg_0", ".", "material", ".", "get_compound_index", "(", "arg_2", ")", "arg_4", "=", "arg_1", "[", "1", "]", "arg_0", ".", "compound_masses", "[", "arg_3", "]", "+=", "arg_4", "else", ":", "raise", "TypeError", "(", "'Invalid addition argument.'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add another chem material package to this material package.\n\n        :param other: The other material package.\n        \"\"\"\n\n        # Add another package.\n        if type(arg_1) is MaterialPackage:\n\n            # Packages of the same material.\n            if arg_0.material == arg_1.material:\n                arg_0.compound_masses += arg_1.compound_masses\n\n            # Packages of different materials.\n            else:\n                for arg_2 in arg_1.material.compounds:\n                    if arg_2 not in arg_0.material.compounds:\n                        raise Exception(\"Packages of '\" + arg_1.material.name +\n                                        \"' cannot be added to packages of '\" +\n                                        arg_0.material.name +\n                                        \"'. The compound '\" + arg_2 +\n                                        \"' was not found in '\" +\n                                        arg_0.material.name + \"'.\")\n                    arg_0.Func((arg_2, arg_1.get_compound_mass(arg_2)))\n\n        # Add the specified mass of the specified compound.\n        elif arg_0._is_compound_mass_tuple(arg_1):\n            # Added material variables.\n            arg_2 = arg_1[0]\n            arg_3 = arg_0.material.get_compound_index(arg_2)\n            arg_4 = arg_1[1]\n\n            # Create the result package.\n            arg_0.compound_masses[arg_3] += arg_4\n\n        # If not one of the above, it must be an invalid argument.\n        else:\n            raise TypeError('Invalid addition argument.')", "path": "auxi/modelling/process/materials/chem.py", "identifier": "MaterialPackage.add_to", "docstring": "Add another chem material package to this material package.\n\n        :param other: The other material package.", "docstring_tokens": ["Add", "another", "chem", "material", "package", "to", "this", "material", "package", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 252965}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/baseapp.py#L220-L233", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Remove the pid file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "profile_dir", ".", "pid_dir", ",", "arg_0", ".", "name", "+", "u'.pid'", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "try", ":", "arg_0", ".", "log", ".", "info", "(", "\"Removing pid file: %s\"", "%", "arg_1", ")", "os", ".", "remove", "(", "arg_1", ")", "except", ":", "arg_0", ".", "log", ".", "warn", "(", "\"Error removing the pid file: %s\"", "%", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Remove the pid file.\n\n        This should be called at shutdown by registering a callback with\n        :func:`reactor.addSystemEventTrigger`. This needs to return\n        ``None``.\n        \"\"\"\n        arg_1 = os.path.join(arg_0.profile_dir.pid_dir, arg_0.name + u'.pid')\n        if os.path.isfile(arg_1):\n            try:\n                arg_0.log.info(\"Removing pid file: %s\" % arg_1)\n                os.remove(arg_1)\n            except:\n                arg_0.log.warn(\"Error removing the pid file: %s\" % arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/apps/baseapp.py", "identifier": "BaseParallelApplication.remove_pid_file", "docstring": "Remove the pid file.\n\n        This should be called at shutdown by registering a callback with\n        :func:`reactor.addSystemEventTrigger`. This needs to return\n        ``None``.", "docstring_tokens": ["Remove", "the", "pid", "file", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252966}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/redis_hook.py#L45-L66", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a Redis connection.", "language": "python", "parameters": "(self)", "return_statement": "return self.redis", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "Funcection", "(", "arg_0", ".", "redis_conn_id", ")", "arg_0", ".", "host", "=", "arg_1", ".", "host", "arg_0", ".", "port", "=", "arg_1", ".", "port", "arg_0", ".", "password", "=", "None", "if", "str", "(", "arg_1", ".", "password", ")", ".", "lower", "(", ")", "in", "[", "'none'", ",", "'false'", ",", "''", "]", "else", "arg_1", ".", "password", "arg_0", ".", "db", "=", "arg_1", ".", "extra_dejson", ".", "get", "(", "'db'", ",", "None", ")", "if", "not", "arg_0", ".", "redis", ":", "arg_0", ".", "log", ".", "debug", "(", "'Initializing redis object for conn_id \"%s\" on %s:%s:%s'", ",", "arg_0", ".", "redis_conn_id", ",", "arg_0", ".", "host", ",", "arg_0", ".", "port", ",", "arg_0", ".", "db", ")", "arg_0", ".", "redis", "=", "Redis", "(", "arg_2", "=", "arg_0", ".", "host", ",", "arg_3", "=", "arg_0", ".", "port", ",", "arg_4", "=", "arg_0", ".", "password", ",", "arg_5", "=", "arg_0", ".", "db", ")", "return", "arg_0", ".", "redis"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a Redis connection.\n        \"\"\"\n        arg_1 = arg_0.Funcection(arg_0.redis_conn_id)\n        arg_0.host = arg_1.host\n        arg_0.port = arg_1.port\n        arg_0.password = None if str(arg_1.password).lower() in ['none', 'false', ''] else arg_1.password\n        arg_0.db = arg_1.extra_dejson.get('db', None)\n\n        if not arg_0.redis:\n            arg_0.log.debug(\n                'Initializing redis object for conn_id \"%s\" on %s:%s:%s',\n                arg_0.redis_conn_id, arg_0.host, arg_0.port, arg_0.db\n            )\n            arg_0.redis = Redis(\n                arg_2=arg_0.host,\n                arg_3=arg_0.port,\n                arg_4=arg_0.password,\n                arg_5=arg_0.db)\n\n        return arg_0.redis", "path": "airflow/contrib/hooks/redis_hook.py", "identifier": "RedisHook.get_conn", "docstring": "Returns a Redis connection.", "docstring_tokens": ["Returns", "a", "Redis", "connection", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252967}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/docs/examples/multiplexing_client.py#L31-L38", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Connected to AMP server, start listening locally, and give the AMP\n    client a reference to the local listening factory.", "language": "python", "parameters": "(client)", "return_statement": "return listeningEndpoint.listen(localFactory)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "log", ".", "msg", "(", "\"Connected to AMP server, starting to listen locally...\"", ")", "arg_1", "=", "multiplexing", ".", "ProxyingFactory", "(", "arg_0", ",", "\"hello\"", ")", "return", "listeningEndpoint", ".", "listen", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Connected to AMP server, start listening locally, and give the AMP\n    client a reference to the local listening factory.\n    \"\"\"\n    log.msg(\"Connected to AMP server, starting to listen locally...\")\n    arg_1 = multiplexing.ProxyingFactory(arg_0, \"hello\")\n    return listeningEndpoint.listen(arg_1)", "path": "docs/examples/multiplexing_client.py", "identifier": "_connected", "docstring": "Connected to AMP server, start listening locally, and give the AMP\n    client a reference to the local listening factory.", "docstring_tokens": ["Connected", "to", "AMP", "server", "start", "listening", "locally", "and", "give", "the", "AMP", "client", "a", "reference", "to", "the", "local", "listening", "factory", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 252968}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/plotters/plotter_util.py#L35-L48", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup a figure for plotting an image.", "language": "python", "parameters": "(figsize, as_subplot)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "arg_2", "=", "plt", ".", "figure", "(", "arg_0", "=", "arg_0", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Setup a figure for plotting an image.\n\n    Parameters\n    -----------\n    figsize : (int, int)\n        The size of the figure in (rows, columns).\n    as_subplot : bool\n        If the figure is a subplot, the Func function is omitted to ensure that each subplot does not create a \\\n        new figure and so that it can be output using the *output_subplot_array* function.\n    \"\"\"\n    if not arg_1:\n        arg_2 = plt.figure(arg_0=arg_0)\n        return arg_2", "path": "autolens/plotters/plotter_util.py", "identifier": "setup_figure", "docstring": "Setup a figure for plotting an image.\n\n    Parameters\n    -----------\n    figsize : (int, int)\n        The size of the figure in (rows, columns).\n    as_subplot : bool\n        If the figure is a subplot, the setup_figure function is omitted to ensure that each subplot does not create a \\\n        new figure and so that it can be output using the *output_subplot_array* function.", "docstring_tokens": ["Setup", "a", "figure", "for", "plotting", "an", "image", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 252969}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L891-L954", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots the rolling volatility versus date.", "language": "python", "parameters": "(returns, factor_returns=None,\n                            rolling_window=APPROX_BDAYS_PER_MONTH * 6,\n                            legend_loc='best', ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "arg_3", "*", "6", ",", "arg_4", "=", "'best'", ",", "arg_5", "=", "None", ",", "**", "arg_6", ")", ":", "if", "arg_5", "is", "None", ":", "arg_5", "=", "plt", ".", "gca", "(", ")", "arg_7", "=", "FuncFormatter", "(", "utils", ".", "two_dec_places", ")", "arg_5", ".", "yaxis", ".", "set_major_formatter", "(", "FuncFormatter", "(", "arg_7", ")", ")", "arg_8", "=", "timeseries", ".", "rolling_volatility", "(", "arg_0", ",", "arg_2", ")", "arg_8", ".", "plot", "(", "alpha", "=", ".7", ",", "lw", "=", "3", ",", "color", "=", "'orangered'", ",", "arg_5", "=", "arg_5", ",", "**", "arg_6", ")", "if", "arg_1", "is", "not", "None", ":", "arg_9", "=", "timeseries", ".", "rolling_volatility", "(", "arg_1", ",", "arg_2", ")", "arg_9", ".", "plot", "(", "alpha", "=", ".7", ",", "lw", "=", "3", ",", "color", "=", "'grey'", ",", "arg_5", "=", "arg_5", ",", "**", "arg_6", ")", "arg_5", ".", "set_title", "(", "'Rolling volatility (6-month)'", ")", "arg_5", ".", "axhline", "(", "arg_8", ".", "mean", "(", ")", ",", "color", "=", "'steelblue'", ",", "linestyle", "=", "'--'", ",", "lw", "=", "3", ")", "arg_5", ".", "axhline", "(", "0.0", ",", "color", "=", "'black'", ",", "linestyle", "=", "'-'", ",", "lw", "=", "2", ")", "arg_5", ".", "set_ylabel", "(", "'Volatility'", ")", "arg_5", ".", "set_xlabel", "(", "''", ")", "if", "arg_1", "is", "None", ":", "arg_5", ".", "legend", "(", "[", "'Volatility'", ",", "'Average volatility'", "]", ",", "loc", "=", "arg_4", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "else", ":", "arg_5", ".", "legend", "(", "[", "'Volatility'", ",", "'Benchmark volatility'", ",", "'Average volatility'", "]", ",", "loc", "=", "arg_4", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None,\n                            arg_2=arg_3 * 6,\n                            arg_4='best', arg_5=None, **arg_6):\n    \"\"\"\n    Plots the rolling volatility versus date.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    rolling_window : int, optional\n        The days window over which to compute the volatility.\n    legend_loc : matplotlib.loc, optional\n        The location of the legend on the plot.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_5 is None:\n        arg_5 = plt.gca()\n\n    arg_7 = FuncFormatter(utils.two_dec_places)\n    arg_5.yaxis.set_major_formatter(FuncFormatter(arg_7))\n\n    arg_8 = timeseries.rolling_volatility(\n        arg_0, arg_2)\n    arg_8.plot(alpha=.7, lw=3, color='orangered', arg_5=arg_5,\n                        **arg_6)\n    if arg_1 is not None:\n        arg_9 = timeseries.rolling_volatility(\n            arg_1, arg_2)\n        arg_9.plot(alpha=.7, lw=3, color='grey', arg_5=arg_5,\n                                   **arg_6)\n\n    arg_5.set_title('Rolling volatility (6-month)')\n    arg_5.axhline(\n        arg_8.mean(),\n        color='steelblue',\n        linestyle='--',\n        lw=3)\n\n    arg_5.axhline(0.0, color='black', linestyle='-', lw=2)\n\n    arg_5.set_ylabel('Volatility')\n    arg_5.set_xlabel('')\n    if arg_1 is None:\n        arg_5.legend(['Volatility', 'Average volatility'],\n                  loc=arg_4, frameon=True, framealpha=0.5)\n    else:\n        arg_5.legend(['Volatility', 'Benchmark volatility', 'Average volatility'],\n                  loc=arg_4, frameon=True, framealpha=0.5)\n    return arg_5", "path": "pyfolio/plotting.py", "identifier": "plot_rolling_volatility", "docstring": "Plots the rolling volatility versus date.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    rolling_window : int, optional\n        The days window over which to compute the volatility.\n    legend_loc : matplotlib.loc, optional\n        The location of the legend on the plot.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "the", "rolling", "volatility", "versus", "date", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 252970}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/www/api/experimental/endpoints.py#L325-L336", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Create a pool.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "request", ".", "get_json", "(", "force", "=", "True", ")", "try", ":", "arg_1", "=", "pool_api", ".", "Func", "(", "**", "arg_0", ")", "except", "AirflowException", "as", "err", ":", "_log", ".", "error", "(", "err", ")", "arg_2", "=", "jsonify", "(", "error", "=", "\"{}\"", ".", "format", "(", "err", ")", ")", "arg_2", ".", "status_code", "=", "err", ".", "status_code", "return", "arg_2", "else", ":", "return", "jsonify", "(", "arg_1", ".", "to_json", "(", ")", ")"], "function": "def Func():\n    \"\"\"Create a pool.\"\"\"\n    arg_0 = request.get_json(force=True)\n    try:\n        arg_1 = pool_api.Func(**arg_0)\n    except AirflowException as err:\n        _log.error(err)\n        arg_2 = jsonify(error=\"{}\".format(err))\n        arg_2.status_code = err.status_code\n        return arg_2\n    else:\n        return jsonify(arg_1.to_json())", "path": "airflow/www/api/experimental/endpoints.py", "identifier": "create_pool", "docstring": "Create a pool.", "docstring_tokens": ["Create", "a", "pool", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 252971}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/pygments_highlighter.py#L181-L204", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Returns a QTextCharFormat for token by reading a Pygments style.", "language": "python", "parameters": "(self, token, style)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "QtGui", ".", "QTextCharFormat", "(", ")", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "style_for_token", "(", "arg_1", ")", ".", "items", "(", ")", ":", "if", "arg_5", ":", "if", "arg_4", "==", "'color'", ":", "arg_3", ".", "setForeground", "(", "arg_0", ".", "_get_brush", "(", "arg_5", ")", ")", "elif", "arg_4", "==", "'bgcolor'", ":", "arg_3", ".", "setBackground", "(", "arg_0", ".", "_get_brush", "(", "arg_5", ")", ")", "elif", "arg_4", "==", "'bold'", ":", "arg_3", ".", "setFontWeight", "(", "QtGui", ".", "QFont", ".", "Bold", ")", "elif", "arg_4", "==", "'italic'", ":", "arg_3", ".", "setFontItalic", "(", "True", ")", "elif", "arg_4", "==", "'underline'", ":", "arg_3", ".", "setUnderlineStyle", "(", "QtGui", ".", "QTextCharFormat", ".", "SingleUnderline", ")", "elif", "arg_4", "==", "'sans'", ":", "arg_3", ".", "setFontStyleHint", "(", "QtGui", ".", "QFont", ".", "SansSerif", ")", "elif", "arg_4", "==", "'roman'", ":", "arg_3", ".", "setFontStyleHint", "(", "QtGui", ".", "QFont", ".", "Times", ")", "elif", "arg_4", "==", "'mono'", ":", "arg_3", ".", "setFontStyleHint", "(", "QtGui", ".", "QFont", ".", "TypeWriter", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Returns a QTextCharFormat for token by reading a Pygments style.\n        \"\"\"\n        arg_3 = QtGui.QTextCharFormat()\n        for arg_4, arg_5 in arg_2.style_for_token(arg_1).items():\n            if arg_5:\n                if arg_4 == 'color':\n                    arg_3.setForeground(arg_0._get_brush(arg_5))\n                elif arg_4 == 'bgcolor':\n                    arg_3.setBackground(arg_0._get_brush(arg_5))\n                elif arg_4 == 'bold':\n                    arg_3.setFontWeight(QtGui.QFont.Bold)\n                elif arg_4 == 'italic':\n                    arg_3.setFontItalic(True)\n                elif arg_4 == 'underline':\n                    arg_3.setUnderlineStyle(\n                        QtGui.QTextCharFormat.SingleUnderline)\n                elif arg_4 == 'sans':\n                    arg_3.setFontStyleHint(QtGui.QFont.SansSerif)\n                elif arg_4 == 'roman':\n                    arg_3.setFontStyleHint(QtGui.QFont.Times)\n                elif arg_4 == 'mono':\n                    arg_3.setFontStyleHint(QtGui.QFont.TypeWriter)\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/pygments_highlighter.py", "identifier": "PygmentsHighlighter._get_format_from_style", "docstring": "Returns a QTextCharFormat for token by reading a Pygments style.", "docstring_tokens": ["Returns", "a", "QTextCharFormat", "for", "token", "by", "reading", "a", "Pygments", "style", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 252972}
{"url": "https://github.com/borisbabic/browser_cookie3/blob/e695777c54509c286991c5bb5ca65f043d748f55/__init__.py#L147-L168", "sha": "e695777c54509c286991c5bb5ca65f043d748f55", "docstring_summary": "Load sqlite cookies into a cookiejar", "language": "python", "parameters": "(self)", "return_statement": "return cj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "sqlite3", ".", "connect", "(", "arg_0", ".", "tmp_cookie_file", ")", "arg_2", "=", "arg_1", ".", "cursor", "(", ")", "try", ":", "arg_2", ".", "execute", "(", "'SELECT host_key, path, secure, expires_utc, name, value, encrypted_value '", "'FROM cookies WHERE host_key like \"%{}%\";'", ".", "format", "(", "arg_0", ".", "domain_name", ")", ")", "except", "sqlite3", ".", "OperationalError", ":", "arg_2", ".", "execute", "(", "'SELECT host_key, path, is_secure, expires_utc, name, value, encrypted_value '", "'FROM cookies WHERE host_key like \"%{}%\";'", ".", "format", "(", "arg_0", ".", "domain_name", ")", ")", "arg_3", "=", "http", ".", "cookiejar", ".", "CookieJar", "(", ")", "for", "arg_4", "in", "arg_2", ".", "fetchall", "(", ")", ":", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_4", "[", ":", "5", "]", "arg_10", "=", "arg_0", ".", "_decrypt", "(", "arg_4", "[", "5", "]", ",", "arg_4", "[", "6", "]", ")", "arg_11", "=", "create_cookie", "(", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", "arg_3", ".", "set_cookie", "(", "arg_11", ")", "arg_1", ".", "close", "(", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Load sqlite cookies into a cookiejar\n        \"\"\"\n        arg_1 = sqlite3.connect(arg_0.tmp_cookie_file)\n        arg_2 = arg_1.cursor()\n        try:\n            # chrome <=55\n            arg_2.execute('SELECT host_key, path, secure, expires_utc, name, value, encrypted_value '\n                        'FROM cookies WHERE host_key like \"%{}%\";'.format(arg_0.domain_name))\n        except sqlite3.OperationalError:\n            # chrome >=56\n            arg_2.execute('SELECT host_key, path, is_secure, expires_utc, name, value, encrypted_value '\n                        'FROM cookies WHERE host_key like \"%{}%\";'.format(arg_0.domain_name))\n\n        arg_3 = http.cookiejar.CookieJar()\n        for arg_4 in arg_2.fetchall():\n            arg_5, arg_6, arg_7, arg_8, arg_9 = arg_4[:5]\n            arg_10 = arg_0._decrypt(arg_4[5], arg_4[6])\n            arg_11 = create_cookie(arg_5, arg_6, arg_7, arg_8, arg_9, arg_10)\n            arg_3.set_cookie(arg_11)\n        arg_1.close()\n        return arg_3", "path": "__init__.py", "identifier": "Chrome.load", "docstring": "Load sqlite cookies into a cookiejar", "docstring_tokens": ["Load", "sqlite", "cookies", "into", "a", "cookiejar"], "nwo": "borisbabic/browser_cookie3", "score": 0.7384462168633814, "idx": 252973}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L335-L345", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Converts a string of comma delimited values and returns a list.", "language": "python", "parameters": "(s)", "return_statement": "return [_.strip().lower() for _ in (s or '').split(',') if _.strip()]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "[", "]", "elif", "isinstance", "(", "arg_0", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "arg_0", "elif", "not", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "raise", "NotImplementedError", "(", "'Unknown type: %s'", "%", "type", "(", "arg_0", ")", ")", "return", "[", "arg_1", ".", "strip", "(", ")", ".", "lower", "(", ")", "for", "arg_1", "in", "(", "arg_0", "or", "''", ")", ".", "split", "(", "','", ")", "if", "arg_1", ".", "strip", "(", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Converts a string of comma delimited values and returns a list.\n    \"\"\"\n    if arg_0 is None:\n        return []\n    elif isinstance(arg_0, (tuple, list)):\n        return arg_0\n    elif not isinstance(arg_0, six.string_types):\n        raise NotImplementedError('Unknown type: %s' % type(arg_0))\n    return [arg_1.strip().lower() for arg_1 in (arg_0 or '').split(',') if arg_1.strip()]", "path": "burlap/common.py", "identifier": "str_to_list", "docstring": "Converts a string of comma delimited values and returns a list.", "docstring_tokens": ["Converts", "a", "string", "of", "comma", "delimited", "values", "and", "returns", "a", "list", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 252974}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_eventloop.py#L11-L20", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Creates a running coroutine to receive message instances and send\n    them in a futures executor.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "PoolExecutor", "(", ")", "as", "executor", ":", "while", "True", ":", "arg_0", "=", "yield", "arg_1", "=", "executor", ".", "submit", "(", "arg_0", ".", "send", ")", "arg_1", ".", "add_done_callback", "(", "_exception_handler", ")"], "function": "def Func():\n    \"\"\"\n    Creates a running coroutine to receive message instances and send\n    them in a futures executor.\n    \"\"\"\n    with PoolExecutor() as executor:\n        while True:\n            arg_0 = yield\n            arg_1 = executor.submit(arg_0.send)\n            arg_1.add_done_callback(_exception_handler)", "path": "messages/_eventloop.py", "identifier": "_send_coroutine", "docstring": "Creates a running coroutine to receive message instances and send\n    them in a futures executor.", "docstring_tokens": ["Creates", "a", "running", "coroutine", "to", "receive", "message", "instances", "and", "send", "them", "in", "a", "futures", "executor", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 252975}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/parsers.py#L32-L37", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Convert hangouts_pb2.ParticipantId to UserID.", "language": "python", "parameters": "(participant_id)", "return_statement": "return user.UserID(\n        chat_id=participant_id.chat_id,\n        gaia_id=participant_id.gaia_id\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "user", ".", "UserID", "(", "chat_id", "=", "arg_0", ".", "chat_id", ",", "gaia_id", "=", "arg_0", ".", "gaia_id", ")"], "function": "def Func(arg_0):\n    \"\"\"Convert hangouts_pb2.ParticipantId to UserID.\"\"\"\n    return user.UserID(\n        chat_id=arg_0.chat_id,\n        gaia_id=arg_0.gaia_id\n    )", "path": "hangups/parsers.py", "identifier": "from_participantid", "docstring": "Convert hangouts_pb2.ParticipantId to UserID.", "docstring_tokens": ["Convert", "hangouts_pb2", ".", "ParticipantId", "to", "UserID", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 252976}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L277-L311", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Remove a case from MatchMaker", "language": "python", "parameters": "(institute_id, case_name)", "return_statement": "return redirect(request.referrer)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "store", ".", "user", "(", "current_user", ".", "email", ")", "if", "'mme_submitter'", "not", "in", "arg_2", "[", "'roles'", "]", ":", "flash", "(", "'unauthorized request'", ",", "'warning'", ")", "return", "redirect", "(", "request", ".", "referrer", ")", "arg_3", ",", "arg_4", "=", "institute_and_case", "(", "store", ",", "arg_0", ",", "arg_1", ")", "arg_5", "=", "current_app", ".", "config", ".", "get", "(", "'MME_URL'", ")", "arg_6", "=", "current_app", ".", "config", ".", "get", "(", "'MME_TOKEN'", ")", "if", "not", "arg_5", "or", "not", "arg_6", ":", "flash", "(", "'An error occurred reading matchmaker connection parameters. Please check config file!'", ",", "'danger'", ")", "return", "redirect", "(", "request", ".", "referrer", ")", "arg_7", "=", "controllers", ".", "mme_delete", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", "arg_8", "=", "0", "arg_9", "=", "'warning'", "for", "arg_10", "in", "arg_7", ":", "if", "arg_10", "[", "'status_code'", "]", "==", "200", ":", "arg_8", "+=", "1", "else", ":", "flash", "(", "arg_10", "[", "'message'", "]", ",", "arg_9", ")", "if", "arg_8", ":", "arg_9", "=", "'success'", "arg_2", "=", "store", ".", "user", "(", "current_user", ".", "email", ")", "store", ".", "case_mme_delete", "(", "arg_4", "=", "arg_4", ",", "arg_2", "=", "arg_2", ")", "flash", "(", "'Number of patients deleted from Matchmaker: {} out of {}'", ".", "format", "(", "arg_8", ",", "len", "(", "arg_7", ")", ")", ",", "arg_9", ")", "return", "redirect", "(", "request", ".", "referrer", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Remove a case from MatchMaker\"\"\"\n\n    # check that only authorized users can delete patients from MME\n    arg_2 = store.user(current_user.email)\n    if 'mme_submitter' not in arg_2['roles']:\n        flash('unauthorized request', 'warning')\n        return redirect(request.referrer)\n\n    arg_3, arg_4 = institute_and_case(store, arg_0, arg_1)\n    # Required params for sending a delete request to MME:\n    arg_5 = current_app.config.get('MME_URL')\n    arg_6 = current_app.config.get('MME_TOKEN')\n    if not arg_5 or not arg_6:\n        flash('An error occurred reading matchmaker connection parameters. Please check config file!', 'danger')\n        return redirect(request.referrer)\n\n    arg_7 = controllers.mme_delete(arg_4, arg_5, arg_6)\n\n    arg_8 = 0\n    arg_9 = 'warning'\n\n    for arg_10 in arg_7:\n        if arg_10['status_code'] == 200:\n            arg_8 += 1\n        else:\n            flash(arg_10['message'], arg_9)\n    if arg_8:\n        arg_9 = 'success'\n        # update case by removing mme submission\n        # and create events for patients deletion from MME\n        arg_2 = store.user(current_user.email)\n        store.case_mme_delete(arg_4=arg_4, arg_2=arg_2)\n    flash('Number of patients deleted from Matchmaker: {} out of {}'.format(arg_8, len(arg_7)), arg_9)\n    return redirect(request.referrer)", "path": "scout/server/blueprints/cases/views.py", "identifier": "matchmaker_delete", "docstring": "Remove a case from MatchMaker", "docstring_tokens": ["Remove", "a", "case", "from", "MatchMaker"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252977}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/disk.py#L91-L118", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Check if partition is mounted", "language": "python", "parameters": "(device)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "arg_1", "=", "run_as_root", "(", "'mount'", ")", "for", "arg_2", "in", "arg_1", ".", "splitlines", "(", ")", ":", "arg_3", "=", "arg_2", ".", "split", "(", ")", "if", "arg_3", "[", "0", "]", "==", "arg_0", ":", "return", "True", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "arg_1", "=", "run_as_root", "(", "'swapon -s'", ")", "for", "arg_2", "in", "arg_1", ".", "splitlines", "(", ")", ":", "arg_3", "=", "arg_2", ".", "split", "(", ")", "if", "arg_3", "[", "0", "]", "==", "arg_0", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"\n    Check if partition is mounted\n\n    Example::\n\n        from burlap.disk import Func\n\n        if Func('/dev/sda1'):\n           print (\"disk sda1 is mounted\")\n    \"\"\"\n    # Check filesystem\n    with settings(hide('running', 'stdout')):\n        arg_1 = run_as_root('mount')\n    for arg_2 in arg_1.splitlines():\n        arg_3 = arg_2.split()\n        if arg_3[0] == arg_0:\n            return True\n\n    # Check swap\n    with settings(hide('running', 'stdout')):\n        arg_1 = run_as_root('swapon -s')\n    for arg_2 in arg_1.splitlines():\n        arg_3 = arg_2.split()\n        if arg_3[0] == arg_0:\n            return True\n\n    return False", "path": "burlap/disk.py", "identifier": "ismounted", "docstring": "Check if partition is mounted\n\n    Example::\n\n        from burlap.disk import ismounted\n\n        if ismounted('/dev/sda1'):\n           print (\"disk sda1 is mounted\")", "docstring_tokens": ["Check", "if", "partition", "is", "mounted"], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 252978}
{"url": "https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/encoding_examples.py#L27-L49", "sha": "5e9e803c9131b377af305d5302723ba2415001da", "docstring_summary": "Takes in a classifier that supports multiclass classification, and X and a y, and returns a cross validation score.", "language": "python", "parameters": "(clf, X, y, encoder, runs=1)", "return_statement": "return float(np.mean(scores)), float(np.std(scores)), scores, X_test.shape[1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "1", ")", ":", "arg_5", "=", "[", "]", "arg_6", "=", "None", "for", "arg_7", "in", "range", "(", "arg_4", ")", ":", "arg_6", "=", "arg_3", "(", ")", ".", "fit_transform", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "StandardScaler", "(", ")", ".", "fit_transform", "(", "arg_6", ")", "arg_5", ".", "append", "(", "cross_validate", "(", "arg_0", ",", "arg_6", ",", "arg_2", ",", "n_jobs", "=", "1", ",", "cv", "=", "5", ")", "[", "'test_score'", "]", ")", "gc", ".", "collect", "(", ")", "arg_5", "=", "[", "arg_2", "for", "z", "in", "[", "x", "for", "x", "in", "arg_5", "]", "for", "arg_2", "in", "z", "]", "return", "float", "(", "np", ".", "mean", "(", "arg_5", ")", ")", ",", "float", "(", "np", ".", "std", "(", "arg_5", ")", ")", ",", "arg_5", ",", "arg_6", ".", "shape", "[", "1", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=1):\n    \"\"\"\n    Takes in a classifier that supports multiclass classification, and X and a y, and returns a cross validation score.\n\n    \"\"\"\n\n    arg_5 = []\n\n    arg_6 = None\n    for arg_7 in range(arg_4):\n        arg_6 = arg_3().fit_transform(arg_1, arg_2)\n\n        # Some models, like logistic regression, like normalized features otherwise they underperform and/or take a long time to converge.\n        # To be rigorous, we should have trained the normalization on each fold individually via pipelines.\n        # See grid_search_example to learn how to do it.\n        arg_6 = StandardScaler().fit_transform(arg_6)\n\n        arg_5.append(cross_validate(arg_0, arg_6, arg_2, n_jobs=1, cv=5)['test_score'])\n        gc.collect()\n\n    arg_5 = [arg_2 for z in [x for x in arg_5] for arg_2 in z]\n\n    return float(np.mean(arg_5)), float(np.std(arg_5)), arg_5, arg_6.shape[1]", "path": "examples/encoding_examples.py", "identifier": "score_models", "docstring": "Takes in a classifier that supports multiclass classification, and X and a y, and returns a cross validation score.", "docstring_tokens": ["Takes", "in", "a", "classifier", "that", "supports", "multiclass", "classification", "and", "X", "and", "a", "y", "and", "returns", "a", "cross", "validation", "score", "."], "nwo": "scikit-learn-contrib/categorical-encoding", "score": 0.948361178849178, "idx": 252979}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hgnc.py#L194-L207", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return the number of hgnc genes in collection", "language": "python", "parameters": "(self, build=None)", "return_statement": "return self.hgnc_collection.find({'build':build}).count()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "LOG", ".", "info", "(", "\"Fetching all genes from build %s\"", ",", "arg_1", ")", "else", ":", "LOG", ".", "info", "(", "\"Fetching all genes\"", ")", "return", "arg_0", ".", "hgnc_collection", ".", "find", "(", "{", "'build'", ":", "arg_1", "}", ")", ".", "count", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Return the number of hgnc genes in collection\n\n        If build is used, return the number of genes of a certain build\n\n            Returns:\n                result()\n        \"\"\"\n        if arg_1:\n            LOG.info(\"Fetching all genes from build %s\",  arg_1)\n        else:\n            LOG.info(\"Fetching all genes\")\n\n        return arg_0.hgnc_collection.find({'build':arg_1}).count()", "path": "scout/adapter/mongo/hgnc.py", "identifier": "GeneHandler.nr_genes", "docstring": "Return the number of hgnc genes in collection\n\n        If build is used, return the number of genes of a certain build\n\n            Returns:\n                result()", "docstring_tokens": ["Return", "the", "number", "of", "hgnc", "genes", "in", "collection"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 252980}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_s_stemmer.py#L42-L77", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the S-stemmed form of a word.", "language": "python", "parameters": "(self, word)", "return_statement": "return word", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "lower", "(", ")", "if", "arg_2", "[", "-", "3", ":", "]", "==", "'ies'", "and", "arg_2", "[", "-", "4", ":", "-", "3", "]", "not", "in", "{", "'e'", ",", "'a'", "}", ":", "return", "arg_1", "[", ":", "-", "3", "]", "+", "(", "'Y'", "if", "arg_1", "[", "-", "1", ":", "]", ".", "isupper", "(", ")", "else", "'y'", ")", "if", "arg_2", "[", "-", "2", ":", "]", "==", "'es'", "and", "arg_2", "[", "-", "3", ":", "-", "2", "]", "not", "in", "{", "'a'", ",", "'e'", ",", "'o'", "}", ":", "return", "arg_1", "[", ":", "-", "1", "]", "if", "arg_2", "[", "-", "1", ":", "]", "==", "'s'", "and", "arg_2", "[", "-", "2", ":", "-", "1", "]", "not", "in", "{", "'u'", ",", "'s'", "}", ":", "return", "arg_1", "[", ":", "-", "1", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the S-Funcmed form of a word.\n\n        Parameters\n        ----------\n        word : str\n            The word to Func\n\n        Returns\n        -------\n        str\n            Word Func\n\n        Examples\n        --------\n        >>> stmr = SStemmer()\n        >>> stmr.Func('summaries')\n        'summary'\n        >>> stmr.Func('summary')\n        'summary'\n        >>> stmr.Func('towers')\n        'tower'\n        >>> stmr.Func('reading')\n        'reading'\n        >>> stmr.Func('census')\n        'census'\n\n        \"\"\"\n        arg_2 = arg_1.lower()\n        if arg_2[-3:] == 'ies' and arg_2[-4:-3] not in {'e', 'a'}:\n            return arg_1[:-3] + ('Y' if arg_1[-1:].isupper() else 'y')\n        if arg_2[-2:] == 'es' and arg_2[-3:-2] not in {'a', 'e', 'o'}:\n            return arg_1[:-1]\n        if arg_2[-1:] == 's' and arg_2[-2:-1] not in {'u', 's'}:\n            return arg_1[:-1]\n        return arg_1", "path": "abydos/stemmer/_s_stemmer.py", "identifier": "SStemmer.stem", "docstring": "Return the S-stemmed form of a word.\n\n        Parameters\n        ----------\n        word : str\n            The word to stem\n\n        Returns\n        -------\n        str\n            Word stem\n\n        Examples\n        --------\n        >>> stmr = SStemmer()\n        >>> stmr.stem('summaries')\n        'summary'\n        >>> stmr.stem('summary')\n        'summary'\n        >>> stmr.stem('towers')\n        'tower'\n        >>> stmr.stem('reading')\n        'reading'\n        >>> stmr.stem('census')\n        'census'", "docstring_tokens": ["Return", "the", "S", "-", "stemmed", "form", "of", "a", "word", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 252981}
{"url": "https://github.com/tomasbasham/dominos/blob/59729a8bdca0ae30a84115a0e93e9b1f259faf0e/dominos/api.py#L43-L56", "sha": "59729a8bdca0ae30a84115a0e93e9b1f259faf0e", "docstring_summary": "Clears out the current store and gets a cookie. Set the cross site\n        request forgery token for each subsequent request.", "language": "python", "parameters": "(self)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "__get", "(", "'/Store/Reset'", ")", "arg_2", "=", "arg_0", ".", "session", ".", "cookies", "[", "'XSRF-TOKEN'", "]", "arg_0", ".", "session", ".", "headers", ".", "update", "(", "{", "'X-XSRF-TOKEN'", ":", "arg_2", "}", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        '''\n        Clears out the current store and gets a cookie. Set the cross site\n        request forgery token for each subsequent request.\n\n        :return: A response having cleared the current store.\n        :rtype: requests.Response\n        '''\n        arg_1 = arg_0.__get('/Store/Reset')\n\n        arg_2 = arg_0.session.cookies['XSRF-TOKEN']\n        arg_0.session.headers.update({'X-XSRF-TOKEN': arg_2})\n\n        return arg_1", "path": "dominos/api.py", "identifier": "Client.reset_store", "docstring": "Clears out the current store and gets a cookie. Set the cross site\n        request forgery token for each subsequent request.\n\n        :return: A response having cleared the current store.\n        :rtype: requests.Response", "docstring_tokens": ["Clears", "out", "the", "current", "store", "and", "gets", "a", "cookie", ".", "Set", "the", "cross", "site", "request", "forgery", "token", "for", "each", "subsequent", "request", "."], "nwo": "tomasbasham/dominos", "score": 0.5665029860115997, "idx": 252982}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/comparison.py#L560-L593", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return a dictionary where the key is the group key file path and\n        the values are sets of unique values of the field name of all DICOM\n        files in the group.", "language": "python", "parameters": "(self, field_name,\n                                          field_to_use_as_key=None)", "return_statement": "return unique_vals", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "DefaultOrderedDict", "(", "set", ")", "for", "arg_4", "in", "arg_0", ".", "dicom_groups", ":", "for", "arg_5", "in", "arg_0", ".", "dicom_groups", "[", "arg_4", "]", ":", "arg_6", "=", "DicomFile", "(", "arg_5", ")", ".", "get_attributes", "(", "arg_1", ")", "arg_7", "=", "arg_4", "if", "arg_2", "is", "not", "None", ":", "try", ":", "arg_7", "=", "str", "(", "DicomFile", "(", "arg_4", ")", ".", "get_attributes", "(", "arg_2", ")", ")", "except", "KeyError", "as", "ke", ":", "raise", "KeyError", "(", "'Error getting field {} from '", "'file {}'", ".", "format", "(", "arg_2", ",", "arg_4", ")", ")", "from", "ke", "arg_3", "[", "arg_7", "]", ".", "add", "(", "arg_6", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1,\n                                          arg_2=None):\n        \"\"\"Return a dictionary where the key is the group key file path and\n        the values are sets of unique values of the field name of all DICOM\n        files in the group.\n\n        Parameters\n        ----------\n        field_name: str\n         Name of the field to read from all files\n\n        field_to_use_as_key: str\n         Name of the field to get the value and use as key.\n         If None, will use the same key as the dicom_groups.\n\n        Returns\n        -------\n        Dict of sets\n        \"\"\"\n        arg_3 = DefaultOrderedDict(set)\n        for arg_4 in arg_0.dicom_groups:\n            for arg_5 in arg_0.dicom_groups[arg_4]:\n                arg_6 = DicomFile(arg_5).get_attributes(arg_1)\n                arg_7 = arg_4\n                if arg_2 is not None:\n                    try:\n                        arg_7 = str(DicomFile(arg_4).get_attributes(arg_2))\n                    except KeyError as ke:\n                        raise KeyError('Error getting field {} from '\n                                      'file {}'.format(arg_2,\n                                                       arg_4)) from ke\n                arg_3[arg_7].add(arg_6)\n\n        return arg_3", "path": "boyle/dicom/comparison.py", "identifier": "DicomFilesClustering.get_unique_field_values_per_group", "docstring": "Return a dictionary where the key is the group key file path and\n        the values are sets of unique values of the field name of all DICOM\n        files in the group.\n\n        Parameters\n        ----------\n        field_name: str\n         Name of the field to read from all files\n\n        field_to_use_as_key: str\n         Name of the field to get the value and use as key.\n         If None, will use the same key as the dicom_groups.\n\n        Returns\n        -------\n        Dict of sets", "docstring_tokens": ["Return", "a", "dictionary", "where", "the", "key", "is", "the", "group", "key", "file", "path", "and", "the", "values", "are", "sets", "of", "unique", "values", "of", "the", "field", "name", "of", "all", "DICOM", "files", "in", "the", "group", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 252983}
{"url": "https://github.com/ChrisBeaumont/soupy/blob/795f2f61f711f574d5218fc8a3375d02bda1104f/soupy.py#L999-L1016", "sha": "795f2f61f711f574d5218fc8a3375d02bda1104f", "docstring_summary": "Find a single Node among this Node's descendants.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self._wrap_node(op)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "operator", ".", "methodcaller", "(", "'Func'", ",", "*", "arg_1", ",", "**", "arg_2", ")", "return", "arg_0", ".", "_wrap_node", "(", "arg_3", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Find a single Node among this Node's descendants.\n\n        Returns :class:`NullNode` if nothing matches.\n\n        This inputs to this function follow the same semantics\n        as BeautifulSoup. See http://bit.ly/bs4doc for more info.\n\n        Examples:\n\n         - node.Func('a')  # look for `a` tags\n         - node.Func('a', 'foo') # look for `a` tags with class=`foo`\n         - node.Func(func) # Func tag where func(tag) is True\n         - node.Func(val=3)  # look for tag like <a, val=3>\n        \"\"\"\n        arg_3 = operator.methodcaller('Func', *arg_1, **arg_2)\n        return arg_0._wrap_node(arg_3)", "path": "soupy.py", "identifier": "Node.find", "docstring": "Find a single Node among this Node's descendants.\n\n        Returns :class:`NullNode` if nothing matches.\n\n        This inputs to this function follow the same semantics\n        as BeautifulSoup. See http://bit.ly/bs4doc for more info.\n\n        Examples:\n\n         - node.find('a')  # look for `a` tags\n         - node.find('a', 'foo') # look for `a` tags with class=`foo`\n         - node.find(func) # find tag where func(tag) is True\n         - node.find(val=3)  # look for tag like <a, val=3>", "docstring_tokens": ["Find", "a", "single", "Node", "among", "this", "Node", "s", "descendants", "."], "nwo": "ChrisBeaumont/soupy", "score": 0.3938996721004794, "idx": 252984}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L802-L820", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Check all API tokens defined and choose one with most remaining API points", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "n_tokens", "==", "0", ":", "return", "arg_1", "=", "0", "if", "arg_0", ".", "n_tokens", ">", "1", ":", "arg_2", "=", "arg_0", ".", "_get_tokens_rate_limits", "(", ")", "arg_1", "=", "arg_2", ".", "index", "(", "max", "(", "arg_2", ")", ")", "logger", ".", "debug", "(", "\"Remaining API points: {}, choosen index: {}\"", ".", "format", "(", "arg_2", ",", "arg_1", ")", ")", "arg_0", ".", "current_token", "=", "arg_0", ".", "tokens", "[", "arg_1", "]", "arg_0", ".", "session", ".", "headers", ".", "update", "(", "{", "'Authorization'", ":", "'token '", "+", "arg_0", ".", "current_token", "}", ")", "arg_0", ".", "_update_current_rate_limit", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Check all API tokens defined and choose one with most remaining API points\"\"\"\n\n        # Return if no tokens given\n        if arg_0.n_tokens == 0:\n            return\n\n        # If multiple tokens given, choose best\n        arg_1 = 0\n        if arg_0.n_tokens > 1:\n            arg_2 = arg_0._get_tokens_rate_limits()\n            arg_1 = arg_2.index(max(arg_2))\n            logger.debug(\"Remaining API points: {}, choosen index: {}\".format(arg_2, arg_1))\n\n        # If we have any tokens - use best of them\n        arg_0.current_token = arg_0.tokens[arg_1]\n        arg_0.session.headers.update({'Authorization': 'token ' + arg_0.current_token})\n        # Update rate limit data for the current token\n        arg_0._update_current_rate_limit()", "path": "perceval/backends/core/github.py", "identifier": "GitHubClient._choose_best_api_token", "docstring": "Check all API tokens defined and choose one with most remaining API points", "docstring_tokens": ["Check", "all", "API", "tokens", "defined", "and", "choose", "one", "with", "most", "remaining", "API", "points"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 252985}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L246-L267", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get the list of EnterpriseCustomerUsers we want to render.", "language": "python", "parameters": "(self, request, search_keyword, customer_uuid, page_size=PAGE_SIZE)", "return_statement": "return paginated_list(learners, page, page_size)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_5", ")", ":", "arg_6", "=", "arg_1", ".", "GET", ".", "get", "(", "'page'", ",", "1", ")", "arg_7", "=", "EnterpriseCustomerUser", ".", "objects", ".", "filter", "(", "enterprise_customer__uuid", "=", "arg_3", ")", "arg_8", "=", "arg_7", ".", "values_list", "(", "'user_id'", ",", "flat", "=", "True", ")", "arg_9", "=", "User", ".", "objects", ".", "filter", "(", "pk__in", "=", "arg_8", ")", "if", "arg_2", "is", "not", "None", ":", "arg_9", "=", "arg_9", ".", "filter", "(", "Q", "(", "email__icontains", "=", "arg_2", ")", "|", "Q", "(", "username__icontains", "=", "arg_2", ")", ")", "arg_10", "=", "arg_9", ".", "values_list", "(", "'pk'", ",", "flat", "=", "True", ")", "arg_7", "=", "arg_7", ".", "filter", "(", "user_id__in", "=", "arg_10", ")", "return", "paginated_list", "(", "arg_7", ",", "arg_6", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=arg_5):\n        \"\"\"\n        Get the list of EnterpriseCustomerUsers we want to render.\n\n        Arguments:\n            request (HttpRequest): HTTP Request instance.\n            search_keyword (str): The keyword to search for in users' email addresses and usernames.\n            customer_uuid (str): A unique identifier to filter down to only users linked to a\n            particular EnterpriseCustomer.\n            page_size (int): Number of learners displayed in each paginated set.\n        \"\"\"\n        arg_6 = arg_1.GET.get('page', 1)\n        arg_7 = EnterpriseCustomerUser.objects.filter(enterprise_customer__uuid=arg_3)\n        arg_8 = arg_7.values_list('user_id', flat=True)\n        arg_9 = User.objects.filter(pk__in=arg_8)\n        if arg_2 is not None:\n            arg_9 = arg_9.filter(\n                Q(email__icontains=arg_2) | Q(username__icontains=arg_2)\n            )\n        arg_10 = arg_9.values_list('pk', flat=True)\n        arg_7 = arg_7.filter(user_id__in=arg_10)\n        return paginated_list(arg_7, arg_6, arg_4)", "path": "enterprise/admin/views.py", "identifier": "EnterpriseCustomerManageLearnersView.get_enterprise_customer_user_queryset", "docstring": "Get the list of EnterpriseCustomerUsers we want to render.\n\n        Arguments:\n            request (HttpRequest): HTTP Request instance.\n            search_keyword (str): The keyword to search for in users' email addresses and usernames.\n            customer_uuid (str): A unique identifier to filter down to only users linked to a\n            particular EnterpriseCustomer.\n            page_size (int): Number of learners displayed in each paginated set.", "docstring_tokens": ["Get", "the", "list", "of", "EnterpriseCustomerUsers", "we", "want", "to", "render", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 252986}
{"url": "https://github.com/dade-ai/snipy/blob/408520867179f99b3158b57520e2619f3fecd69b/snipy/imageme.py#L306-L335", "sha": "408520867179f99b3158b57520e2619f3fecd69b", "docstring_summary": "Get base-64 encoded data as a string for the given image. Fallback to return\n    fallback_image_file if cannot get the image data or img is None.", "language": "python", "parameters": "(img, fallback_image_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "is", "None", ":", "return", "arg_1", "arg_2", "=", "arg_0", ".", "format", "if", "arg_2", ".", "lower", "(", ")", "in", "[", "'tif'", ",", "'tiff'", "]", ":", "arg_2", "=", "'JPEG'", "try", ":", "arg_3", "=", "io", ".", "BytesIO", "(", ")", "arg_0", ".", "save", "(", "arg_3", ",", "arg_2", ")", "arg_4", "=", "arg_3", ".", "getvalue", "(", ")", "arg_5", "=", "base64", ".", "b64encode", "(", "arg_4", ")", "return", "'data:image/%s;base64,%s'", "%", "(", "arg_2", ".", "lower", "(", ")", ",", "arg_5", ")", "except", "IOError", "as", "exptn", ":", "print", "(", "'IOError while saving image bytes: %s'", "%", "exptn", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Get base-64 encoded data as a string for the given image. Fallback to return\n    fallback_image_file if cannot get the image data or img is None.\n    @param {Image} img - The PIL Image to get src data for\n    @param {String} fallback_image_file - The filename of the image file,\n        to be used when image data capture fails\n    @return {String} The base-64 encoded image data string, or path to the file\n        itself if not supported.\n    \"\"\"\n    # If the image is None, then we can't process, so we should return the\n    # path to the file itself\n    if arg_0 is None:\n        return arg_1\n    # Target format should be the same as the original image format, unless it's\n    # a TIF/TIFF, which can't be displayed by most browsers; we convert these\n    # to jpeg\n    arg_2 = arg_0.format\n    if arg_2.lower() in ['tif', 'tiff']:\n        arg_2 = 'JPEG'\n    # If we have an actual Image, great - put together the base64 image string\n    try:\n        arg_3 = io.BytesIO()\n        arg_0.save(arg_3, arg_2)\n        arg_4 = arg_3.getvalue()\n        arg_5 = base64.b64encode(arg_4)\n        return 'data:image/%s;base64,%s' % (arg_2.lower(), arg_5)\n    except IOError as exptn:\n        print('IOError while saving image bytes: %s' % exptn)\n        return arg_1", "path": "snipy/imageme.py", "identifier": "_get_src_from_image", "docstring": "Get base-64 encoded data as a string for the given image. Fallback to return\n    fallback_image_file if cannot get the image data or img is None.\n    @param {Image} img - The PIL Image to get src data for\n    @param {String} fallback_image_file - The filename of the image file,\n        to be used when image data capture fails\n    @return {String} The base-64 encoded image data string, or path to the file\n        itself if not supported.", "docstring_tokens": ["Get", "base", "-", "64", "encoded", "data", "as", "a", "string", "for", "the", "given", "image", ".", "Fallback", "to", "return", "fallback_image_file", "if", "cannot", "get", "the", "image", "data", "or", "img", "is", "None", "."], "nwo": "dade-ai/snipy", "score": 0.18941942438232184, "idx": 252987}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L328-L346", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Compute LST for observation", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "header", "[", "b'telescope_id'", "]", "==", "6", ":", "arg_0", ".", "coords", "=", "gbt_coords", "elif", "arg_0", ".", "header", "[", "b'telescope_id'", "]", "==", "4", ":", "arg_0", ".", "coords", "=", "parkes_coords", "else", ":", "raise", "RuntimeError", "(", "\"Currently only Parkes and GBT supported\"", ")", "if", "HAS_SLALIB", ":", "arg_2", "=", "0.0", "arg_3", "=", "arg_0", ".", "header", "[", "b'tstart'", "]", "arg_4", "=", "np", ".", "deg2rad", "(", "arg_0", ".", "coords", "[", "1", "]", ")", "arg_5", "=", "s", ".", "sla_gmst", "(", "arg_3", ")", "-", "arg_4", "+", "s", ".", "sla_eqeqx", "(", "arg_3", ")", "+", "arg_2", "if", "arg_5", "<", "0.0", ":", "arg_5", "=", "arg_5", "+", "2.0", "*", "np", ".", "pi", "return", "arg_5", "else", ":", "raise", "RuntimeError", "(", "\"This method requires pySLALIB\"", ")"], "function": "def Func(arg_0):\n        \"\"\" Compute LST for observation \"\"\"\n        if arg_0.header[b'telescope_id'] == 6:\n            arg_0.coords = gbt_coords\n        elif arg_0.header[b'telescope_id'] == 4:\n            arg_0.coords = parkes_coords\n        else:\n            raise RuntimeError(\"Currently only Parkes and GBT supported\")\n        if HAS_SLALIB:\n            # dut1 = (0.2 /3600.0) * np.pi/12.0\n            arg_2 = 0.0\n            arg_3 = arg_0.header[b'tstart']\n            arg_4 = np.deg2rad(arg_0.coords[1])\n            arg_5 = s.sla_gmst(arg_3) - arg_4 + s.sla_eqeqx(arg_3) + arg_2\n            # lmst = s.sla_gmst(mjd) - tellong\n            if arg_5 < 0.0 : arg_5 = arg_5 + 2.0*np.pi\n            return arg_5\n        else:\n            raise RuntimeError(\"This method requires pySLALIB\")", "path": "blimpy/filterbank.py", "identifier": "Filterbank.compute_lst", "docstring": "Compute LST for observation", "docstring_tokens": ["Compute", "LST", "for", "observation"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 252988}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-sdk-tools/packaging_tools/venvtools.py#L30-L46", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Create a venv with these packages in a temp dir and yielf the env.", "language": "python", "parameters": "(packages)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "tempfile", ".", "TemporaryDirectory", "(", ")", "as", "tempdir", ":", "arg_1", "=", "create", "(", "tempdir", ",", "with_pip", "=", "True", ")", "arg_2", "=", "[", "arg_1", ".", "env_exe", ",", "\"-m\"", ",", "\"pip\"", ",", "\"install\"", ",", "]", "subprocess", ".", "check_call", "(", "arg_2", "+", "[", "'-U'", ",", "'pip'", "]", ")", "if", "arg_0", ":", "subprocess", ".", "check_call", "(", "arg_2", "+", "arg_0", ")", "yield", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Create a venv with these packages in a temp dir and yielf the env.\n\n    packages should be an iterable of pip version instructio (e.g. package~=1.2.3)\n    \"\"\"\n    with tempfile.TemporaryDirectory() as tempdir:\n        arg_1 = create(tempdir, with_pip=True)\n        arg_2 = [\n            arg_1.env_exe,\n            \"-m\",\n            \"pip\",\n            \"install\",\n        ]\n        subprocess.check_call(arg_2 + ['-U', 'pip'])\n        if arg_0:\n            subprocess.check_call(arg_2 + arg_0)\n        yield arg_1", "path": "azure-sdk-tools/packaging_tools/venvtools.py", "identifier": "create_venv_with_package", "docstring": "Create a venv with these packages in a temp dir and yielf the env.\n\n    packages should be an iterable of pip version instructio (e.g. package~=1.2.3)", "docstring_tokens": ["Create", "a", "venv", "with", "these", "packages", "in", "a", "temp", "dir", "and", "yielf", "the", "env", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 252989}
{"url": "https://github.com/asciimoo/searx/blob/a84caa22cf947e973c10aa968d35fb2bdda6d048/searx/engines/currency_convert.py#L64-L87", "sha": "a84caa22cf947e973c10aa968d35fb2bdda6d048", "docstring_summary": "remove first and last lines to get only json", "language": "python", "parameters": "(resp)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "text", "[", "arg_0", ".", "text", ".", "find", "(", "'\\n'", ")", "+", "1", ":", "arg_0", ".", "text", ".", "rfind", "(", "'\\n'", ")", "-", "2", "]", "arg_2", "=", "[", "]", "try", ":", "arg_3", "=", "float", "(", "json", ".", "loads", "(", "arg_1", ")", "[", "'conversion'", "]", "[", "'converted-amount'", "]", ")", "except", ":", "return", "arg_2", "arg_4", "=", "'{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'", ".", "format", "(", "arg_0", ".", "search_params", "[", "'amount'", "]", ",", "arg_0", ".", "search_params", "[", "'from'", "]", ",", "arg_0", ".", "search_params", "[", "'amount'", "]", "*", "arg_3", ",", "arg_0", ".", "search_params", "[", "'to'", "]", ",", "arg_3", ",", "arg_0", ".", "search_params", "[", "'from_name'", "]", ",", "arg_0", ".", "search_params", "[", "'to_name'", "]", ",", ")", "arg_5", "=", "'https://duckduckgo.com/js/spice/currency/1/{0}/{1}'", ".", "format", "(", "arg_0", ".", "search_params", "[", "'from'", "]", ".", "upper", "(", ")", ",", "arg_0", ".", "search_params", "[", "'to'", "]", ")", "arg_2", ".", "append", "(", "{", "'answer'", ":", "arg_4", ",", "'url'", ":", "arg_5", "}", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"remove first and last lines to get only json\"\"\"\n    arg_1 = arg_0.text[arg_0.text.find('\\n') + 1:arg_0.text.rfind('\\n') - 2]\n    arg_2 = []\n    try:\n        arg_3 = float(json.loads(arg_1)['conversion']['converted-amount'])\n    except:\n        return arg_2\n    arg_4 = '{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'.format(\n        arg_0.search_params['amount'],\n        arg_0.search_params['from'],\n        arg_0.search_params['amount'] * arg_3,\n        arg_0.search_params['to'],\n        arg_3,\n        arg_0.search_params['from_name'],\n        arg_0.search_params['to_name'],\n    )\n\n    arg_5 = 'https://duckduckgo.com/js/spice/currency/1/{0}/{1}'.format(\n        arg_0.search_params['from'].upper(), arg_0.search_params['to'])\n\n    arg_2.append({'answer': arg_4, 'url': arg_5})\n\n    return arg_2", "path": "searx/engines/currency_convert.py", "identifier": "response", "docstring": "remove first and last lines to get only json", "docstring_tokens": ["remove", "first", "and", "last", "lines", "to", "get", "only", "json"], "nwo": "asciimoo/searx", "score": 0.9938352485388113, "idx": 252990}
{"url": "https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/providers/basehttp.py#L68-L72", "sha": "a09d4e097e5599244564a2a7f0611e58efb4156a", "docstring_summary": "Bind and activate HTTP server.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "HTTPServer", ".", "__init__", "(", "arg_0", ",", "(", "arg_0", ".", "host", ",", "arg_0", ".", "port", ")", ",", "HTTPRequestHandler", ")", "arg_0", ".", "port", "=", "arg_0", ".", "server_port"], "function": "def Func(arg_0):\n        \"\"\"Bind and activate HTTP server.\"\"\"\n\n        HTTPServer.__init__(arg_0, (arg_0.host, arg_0.port), HTTPRequestHandler)\n        arg_0.port = arg_0.server_port", "path": "service_factory/providers/basehttp.py", "identifier": "HTTPServiceProvider.bind", "docstring": "Bind and activate HTTP server.", "docstring_tokens": ["Bind", "and", "activate", "HTTP", "server", "."], "nwo": "proofit404/service-factory", "score": 0.24979334806965703, "idx": 252991}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/math/linalg.py#L679-L708", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns list of assertions related to `lu_reconstruct` assumptions.", "language": "python", "parameters": "(lower_upper, perm, validate_args)", "return_statement": "return assertions", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "'Input `lower_upper` must have at least 2 dimensions.'", "if", "arg_0", ".", "shape", ".", "ndims", "is", "not", "None", ":", "if", "arg_0", ".", "shape", ".", "ndims", "<", "2", ":", "raise", "ValueError", "(", "arg_4", ")", "elif", "arg_2", ":", "arg_3", ".", "append", "(", "tf", ".", "compat", ".", "v1", ".", "assert_rank_at_least", "(", "arg_0", ",", "rank", "=", "2", ",", "arg_4", "=", "arg_4", ")", ")", "arg_4", "=", "'`rank(lower_upper)` must equal `rank(perm) + 1`'", "if", "arg_0", ".", "shape", ".", "ndims", "is", "not", "None", "and", "arg_1", ".", "shape", ".", "ndims", "is", "not", "None", ":", "if", "arg_0", ".", "shape", ".", "ndims", "!=", "arg_1", ".", "shape", ".", "ndims", "+", "1", ":", "raise", "ValueError", "(", "arg_4", ")", "elif", "arg_2", ":", "arg_3", ".", "append", "(", "tf", ".", "compat", ".", "v1", ".", "assert_rank", "(", "arg_0", ",", "rank", "=", "tf", ".", "rank", "(", "arg_1", ")", "+", "1", ",", "arg_4", "=", "arg_4", ")", ")", "arg_4", "=", "'`lower_upper` must be square.'", "if", "arg_0", ".", "shape", "[", ":", "-", "2", "]", ".", "is_fully_defined", "(", ")", ":", "if", "arg_0", ".", "shape", "[", "-", "2", "]", "!=", "arg_0", ".", "shape", "[", "-", "1", "]", ":", "raise", "ValueError", "(", "arg_4", ")", "elif", "arg_2", ":", "arg_5", ",", "arg_6", "=", "tf", ".", "split", "(", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "[", "-", "2", ":", "]", ",", "num_or_size_splits", "=", "2", ")", "arg_3", ".", "append", "(", "tf", ".", "compat", ".", "v1", ".", "assert_equal", "(", "arg_5", ",", "arg_6", ",", "arg_4", "=", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Returns list of assertions related to `lu_reconstruct` assumptions.\"\"\"\n  arg_3 = []\n\n  arg_4 = 'Input `lower_upper` must have at least 2 dimensions.'\n  if arg_0.shape.ndims is not None:\n    if arg_0.shape.ndims < 2:\n      raise ValueError(arg_4)\n  elif arg_2:\n    arg_3.append(\n        tf.compat.v1.assert_rank_at_least(arg_0, rank=2, arg_4=arg_4))\n\n  arg_4 = '`rank(lower_upper)` must equal `rank(perm) + 1`'\n  if arg_0.shape.ndims is not None and arg_1.shape.ndims is not None:\n    if arg_0.shape.ndims != arg_1.shape.ndims + 1:\n      raise ValueError(arg_4)\n  elif arg_2:\n    arg_3.append(\n        tf.compat.v1.assert_rank(\n            arg_0, rank=tf.rank(arg_1) + 1, arg_4=arg_4))\n\n  arg_4 = '`lower_upper` must be square.'\n  if arg_0.shape[:-2].is_fully_defined():\n    if arg_0.shape[-2] != arg_0.shape[-1]:\n      raise ValueError(arg_4)\n  elif arg_2:\n    arg_5, arg_6 = tf.split(tf.shape(input=arg_0)[-2:], num_or_size_splits=2)\n    arg_3.append(tf.compat.v1.assert_equal(arg_5, arg_6, arg_4=arg_4))\n\n  return arg_3", "path": "tensorflow_probability/python/math/linalg.py", "identifier": "_lu_reconstruct_assertions", "docstring": "Returns list of assertions related to `lu_reconstruct` assumptions.", "docstring_tokens": ["Returns", "list", "of", "assertions", "related", "to", "lu_reconstruct", "assumptions", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 252992}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/tags.py#L154-L165", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Validate and set all known tags on a port.", "language": "python", "parameters": "(self, model, **tags)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "tags", ".", "items", "(", ")", ":", "if", "arg_3", "in", "arg_2", ":", "arg_5", "=", "arg_2", ".", "pop", "(", "arg_3", ")", "if", "arg_5", ":", "try", ":", "arg_4", ".", "set", "(", "arg_1", ",", "arg_5", ")", "except", "TagValidationError", "as", "e", ":", "raise", "n_exc", ".", "BadRequest", "(", "resource", "=", "\"tags\"", ",", "msg", "=", "\"%s\"", "%", "(", "e", ".", "message", ")", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Validate and set all known tags on a port.\"\"\"\n        for arg_3, arg_4 in arg_0.tags.items():\n            if arg_3 in arg_2:\n                arg_5 = arg_2.pop(arg_3)\n                if arg_5:\n                    try:\n                        arg_4.set(arg_1, arg_5)\n                    except TagValidationError as e:\n                        raise n_exc.BadRequest(\n                            resource=\"tags\",\n                            msg=\"%s\" % (e.message))", "path": "quark/tags.py", "identifier": "TagRegistry.set_all", "docstring": "Validate and set all known tags on a port.", "docstring_tokens": ["Validate", "and", "set", "all", "known", "tags", "on", "a", "port", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 252993}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmdlet.py#L115-L125", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "Append next object to pipe tail.", "language": "python", "parameters": "(self, next)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "chained", "=", "True", "if", "arg_0", ".", "next", ":", "arg_0", ".", "next", ".", "Func", "(", "arg_1", ")", "else", ":", "arg_0", ".", "next", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Append next object to pipe tail.\n\n        :param next: The Pipe object to be Funced to tail.\n        :type next: Pipe object.\n        \"\"\"\n        arg_1.chained = True\n        if arg_0.next:\n            arg_0.next.Func(arg_1)\n        else:\n            arg_0.next = arg_1", "path": "cmdlet/cmdlet.py", "identifier": "Pipe.append", "docstring": "Append next object to pipe tail.\n\n        :param next: The Pipe object to be appended to tail.\n        :type next: Pipe object.", "docstring_tokens": ["Append", "next", "object", "to", "pipe", "tail", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 252994}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L349-L394", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Function to recursively upload a folder and all of its descendants.", "language": "python", "parameters": "(local_folder,\n                             parent_folder_id,\n                             leaf_folders_as_items=False,\n                             reuse_existing=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "if", "arg_2", "and", "_has_only_files", "(", "arg_0", ")", ":", "print", "(", "'Creating item from {0}'", ".", "format", "(", "arg_0", ")", ")", "_upload_folder_as_item", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "return", "else", ":", "print", "(", "'Creating folder from {0}'", ".", "format", "(", "arg_0", ")", ")", "arg_4", "=", "_create_or_reuse_folder", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "for", "arg_5", "in", "sorted", "(", "os", ".", "listdir", "(", "arg_0", ")", ")", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_5", ")", "if", "os", ".", "path", ".", "islink", "(", "arg_6", ")", ":", "continue", "elif", "os", ".", "path", ".", "isdir", "(", "arg_6", ")", ":", "Func", "(", "arg_6", ",", "arg_4", ",", "arg_2", ",", "arg_3", ")", "else", ":", "print", "(", "'Uploading item from {0}'", ".", "format", "(", "arg_6", ")", ")", "_upload_as_item", "(", "arg_5", ",", "arg_4", ",", "arg_6", ",", "arg_3", ")"], "function": "def Func(arg_0,\n                             arg_1,\n                             arg_2=False,\n                             arg_3=False):\n    \"\"\"\n    Function to recursively upload a folder and all of its descendants.\n\n    :param local_folder: full path to local folder to be uploaded\n    :type local_folder: string\n    :param parent_folder_id: id of parent folder on the Midas Server instance,\n        where the new folder will be added\n    :type parent_folder_id: int | long\n    :param leaf_folders_as_items: (optional) whether leaf folders should have\n        all files uploaded as single items\n    :type leaf_folders_as_items: bool\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool\n    \"\"\"\n    if arg_2 and _has_only_files(arg_0):\n        print('Creating item from {0}'.format(arg_0))\n        _upload_folder_as_item(arg_0, arg_1, arg_3)\n        return\n    else:\n        # do not need to check if folder exists, if it does, an attempt to\n        # create it will just return the existing id\n        print('Creating folder from {0}'.format(arg_0))\n        arg_4 = _create_or_reuse_folder(arg_0, arg_1,\n                                                arg_3)\n\n        for arg_5 in sorted(os.listdir(arg_0)):\n            arg_6 = os.path.join(arg_0, arg_5)\n            if os.path.islink(arg_6):\n                # os.walk skips symlinks by default\n                continue\n            elif os.path.isdir(arg_6):\n                Func(arg_6,\n                                         arg_4,\n                                         arg_2,\n                                         arg_3)\n            else:\n                print('Uploading item from {0}'.format(arg_6))\n                _upload_as_item(arg_5,\n                                arg_4,\n                                arg_6,\n                                arg_3)", "path": "pydas/api.py", "identifier": "_upload_folder_recursive", "docstring": "Function to recursively upload a folder and all of its descendants.\n\n    :param local_folder: full path to local folder to be uploaded\n    :type local_folder: string\n    :param parent_folder_id: id of parent folder on the Midas Server instance,\n        where the new folder will be added\n    :type parent_folder_id: int | long\n    :param leaf_folders_as_items: (optional) whether leaf folders should have\n        all files uploaded as single items\n    :type leaf_folders_as_items: bool\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool", "docstring_tokens": ["Function", "to", "recursively", "upload", "a", "folder", "and", "all", "of", "its", "descendants", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 252995}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/texture.py#L6-L30", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Flat plane parameterization", "language": "python", "parameters": "(script, plane=0, aspect_ratio=False)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Parametrization: Flat Plane \">\\n'", ",", "'    <Param name=\"projectionPlane\"'", ",", "'value=\"%d\"'", "%", "arg_1", ",", "'description=\"Projection plane\"'", ",", "'enum_val0=\"XY\"'", ",", "'enum_val1=\"XZ\"'", ",", "'enum_val2=\"YZ\"'", ",", "'enum_cardinality=\"3\"'", ",", "'type=\"RichEnum\"'", ",", "'tooltip=\"Choose the projection plane\"'", ",", "'/>\\n'", ",", "'    <Param name=\"aspectRatio\"'", ",", "'value=\"%s\"'", "%", "str", "(", "arg_2", ")", ".", "lower", "(", ")", ",", "'description=\"Preserve Ratio\"'", ",", "'type=\"RichBool\"'", ",", "'tooltip=\"If checked the resulting parametrization will preserve the original apsect ratio of the model otherwise it will fill up the whole 0..1 uv space\"'", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_3", ")", "return", "None"], "function": "def Func(arg_0, arg_1=0, arg_2=False):\n    \"\"\"Flat plane parameterization\n\n    \"\"\"\n    arg_3 = ''.join([\n        '  <filter name=\"Parametrization: Flat Plane \">\\n',\n        '    <Param name=\"projectionPlane\"',\n        'value=\"%d\"' % arg_1,\n        'description=\"Projection plane\"',\n        'enum_val0=\"XY\"',\n        'enum_val1=\"XZ\"',\n        'enum_val2=\"YZ\"',\n        'enum_cardinality=\"3\"',\n        'type=\"RichEnum\"',\n        'tooltip=\"Choose the projection plane\"',\n        '/>\\n',\n        '    <Param name=\"aspectRatio\"',\n        'value=\"%s\"' % str(arg_2).lower(),\n        'description=\"Preserve Ratio\"',\n        'type=\"RichBool\"',\n        'tooltip=\"If checked the resulting parametrization will preserve the original apsect ratio of the model otherwise it will fill up the whole 0..1 uv space\"',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_3)\n    return None", "path": "meshlabxml/texture.py", "identifier": "flat_plane", "docstring": "Flat plane parameterization", "docstring_tokens": ["Flat", "plane", "parameterization"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 252996}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L925-L955", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a data structure evaluated as a reader\n    macro from the input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "LispReaderForm", ":", "arg_2", "=", "arg_0", ".", "reader", ".", "advance", "(", ")", "assert", "arg_2", "==", "\"#\"", "arg_3", "=", "arg_0", ".", "reader", ".", "peek", "(", ")", "if", "arg_3", "==", "\"{\"", ":", "return", "_read_set", "(", "arg_0", ")", "elif", "arg_3", "==", "\"(\"", ":", "return", "_read_function", "(", "arg_0", ")", "elif", "arg_3", "==", "\"'\"", ":", "arg_0", ".", "reader", ".", "advance", "(", ")", "arg_4", "=", "_read_sym", "(", "arg_0", ")", "return", "llist", ".", "l", "(", "_VAR", ",", "arg_4", ")", "elif", "arg_3", "==", "'\"'", ":", "return", "_read_regex", "(", "arg_0", ")", "elif", "arg_3", "==", "\"_\"", ":", "arg_0", ".", "reader", ".", "advance", "(", ")", "_read_next", "(", "arg_0", ")", "return", "COMMENT", "elif", "ns_name_chars", ".", "match", "(", "arg_3", ")", ":", "arg_4", "=", "_read_sym", "(", "arg_0", ")", "assert", "isinstance", "(", "arg_4", ",", "symbol", ".", "Symbol", ")", "arg_5", "=", "_read_next_consuming_comment", "(", "arg_0", ")", "if", "arg_4", "in", "arg_0", ".", "data_readers", ":", "arg_6", "=", "arg_0", ".", "data_readers", "[", "arg_4", "]", "return", "arg_6", "(", "arg_5", ")", "else", ":", "raise", "SyntaxError", "(", "f\"No data reader found for tag #{s}\"", ")", "raise", "SyntaxError", "(", "f\"Unexpected token '{token}' in reader macro\"", ")"], "function": "def Func(arg_0: arg_1) -> LispReaderForm:\n    \"\"\"Return a data structure evaluated as a reader\n    macro from the input stream.\"\"\"\n    arg_2 = arg_0.reader.advance()\n    assert arg_2 == \"#\"\n    arg_3 = arg_0.reader.peek()\n    if arg_3 == \"{\":\n        return _read_set(arg_0)\n    elif arg_3 == \"(\":\n        return _read_function(arg_0)\n    elif arg_3 == \"'\":\n        arg_0.reader.advance()\n        arg_4 = _read_sym(arg_0)\n        return llist.l(_VAR, arg_4)\n    elif arg_3 == '\"':\n        return _read_regex(arg_0)\n    elif arg_3 == \"_\":\n        arg_0.reader.advance()\n        _read_next(arg_0)  # Ignore the entire next form\n        return COMMENT\n    elif ns_name_chars.match(arg_3):\n        arg_4 = _read_sym(arg_0)\n        assert isinstance(arg_4, symbol.Symbol)\n        arg_5 = _read_next_consuming_comment(arg_0)\n        if arg_4 in arg_0.data_readers:\n            arg_6 = arg_0.data_readers[arg_4]\n            return arg_6(arg_5)\n        else:\n            raise SyntaxError(f\"No data reader found for tag #{s}\")\n\n    raise SyntaxError(f\"Unexpected token '{token}' in reader macro\")", "path": "src/basilisp/lang/reader.py", "identifier": "_read_reader_macro", "docstring": "Return a data structure evaluated as a reader\n    macro from the input stream.", "docstring_tokens": ["Return", "a", "data", "structure", "evaluated", "as", "a", "reader", "macro", "from", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 252997}
{"url": "https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L73-L93", "sha": "5b90a543b127ab9e6112fd547929b5ef4b8f0cbc", "docstring_summary": "Generate the binary strings for a comma seperated list of commands.", "language": "python", "parameters": "(commands)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "split", "(", "','", ")", ":", "arg_2", "=", "[", "0", ",", "0", "]", "arg_3", ",", "arg_1", "=", "arg_1", ".", "strip", "(", ")", ".", "upper", "(", ")", ".", "split", "(", "None", ",", "1", ")", "arg_2", "[", "0", "]", "=", "houseCodes", "[", "arg_3", "[", "0", "]", "]", "if", "len", "(", "arg_3", ")", ">", "1", ":", "arg_4", "=", "deviceNumbers", "[", "arg_3", "[", "1", ":", "]", "]", "arg_2", "[", "0", "]", "|=", "arg_4", "[", "0", "]", "arg_2", "[", "1", "]", "=", "arg_4", "[", "1", "]", "arg_2", "[", "1", "]", "|=", "commandCodes", "[", "arg_1", "]", "yield", "' '", ".", "join", "(", "map", "(", "_strBinary", ",", "arg_2", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Generate the binary strings for a comma seperated list of commands.\"\"\"\n    for arg_1 in arg_0.split(','):\n        # each command results in 2 bytes of binary data\n        arg_2 = [0, 0]\n        arg_3, arg_1 = arg_1.strip().upper().split(None, 1)\n\n        # translate the house code\n        arg_2[0] = houseCodes[arg_3[0]]\n\n        # translate the device number if there is one\n        if len(arg_3) > 1:\n            arg_4 = deviceNumbers[arg_3[1:]]\n            arg_2[0] |= arg_4[0]\n            arg_2[1] = arg_4[1]\n\n        # translate the command\n        arg_2[1] |= commandCodes[arg_1]\n\n        # convert 2 bytes to bit strings and yield them\n        yield ' '.join(map(_strBinary, arg_2))", "path": "x10_any/cm17a.py", "identifier": "_translateCommands", "docstring": "Generate the binary strings for a comma seperated list of commands.", "docstring_tokens": ["Generate", "the", "binary", "strings", "for", "a", "comma", "seperated", "list", "of", "commands", "."], "nwo": "clach04/x10_any", "score": 0.2751458370028208, "idx": 252998}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1118-L1166", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Populate array with random quartets sampled from a generator.\n    Holding all sets in memory might take a lot, but holding a very\n    large list of random numbers for which ones to sample will fit \n    into memory for most reasonable sized sets. So we'll load a \n    list of random numbers in the range of the length of total \n    sets that can be generated, then only keep sets from the set \n    generator if they are in the int list. I did several tests to \n    check that random pairs are as likely as 0 & 1 to come up together\n    in a random quartet set.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "h5py", ".", "File", "(", "arg_0", ".", "database", ".", "input", ",", "'a'", ")", "as", "io5", ":", "arg_1", "=", "io5", "[", "\"quartets\"", "]", "arg_2", "=", "itertools", ".", "combinations", "(", "xrange", "(", "len", "(", "arg_0", ".", "samples", ")", ")", ",", "4", ")", "arg_3", "=", "np", ".", "arange", "(", "0", ",", "n_choose_k", "(", "len", "(", "arg_0", ".", "samples", ")", ",", "4", ")", ")", "np", ".", "random", ".", "shuffle", "(", "arg_3", ")", "arg_4", "=", "arg_3", "[", ":", "arg_0", ".", "params", ".", "nquartets", "]", "arg_5", "=", "np", ".", "sort", "(", "arg_4", ")", "arg_6", "=", "iter", "(", "arg_5", ")", "del", "arg_3", ",", "arg_4", "print", "(", "arg_0", ".", "_chunksize", ")", "arg_7", "=", "arg_6", ".", "next", "(", ")", "arg_8", "=", "np", ".", "zeros", "(", "(", "arg_0", ".", "params", ".", "nquartets", ",", "4", ")", ",", "dtype", "=", "np", ".", "uint16", ")", "arg_9", "=", "0", "while", "1", ":", "try", ":", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_2", ")", ":", "if", "arg_10", "==", "arg_7", ":", "arg_8", "[", "arg_9", "]", "=", "arg_11", "arg_9", "+=", "1", "arg_7", "=", "arg_6", ".", "next", "(", ")", "if", "not", "arg_10", "%", "arg_0", ".", "_chunksize", ":", "print", "(", "min", "(", "arg_10", ",", "arg_0", ".", "params", ".", "nquartets", ")", ")", "except", "StopIteration", ":", "break", "arg_1", "[", ":", "]", "=", "arg_8", "del", "arg_8"], "function": "def Func(arg_0):\n    \"\"\"\n    Populate array with random quartets sampled from a generator.\n    Holding all sets in memory might take a lot, but holding a very\n    large list of random numbers for which ones to sample will fit \n    into memory for most reasonable sized sets. So we'll load a \n    list of random numbers in the range of the length of total \n    sets that can be generated, then only keep sets from the set \n    generator if they are in the int list. I did several tests to \n    check that random pairs are as likely as 0 & 1 to come up together\n    in a random quartet set. \n    \"\"\"\n\n    with h5py.File(arg_0.database.input, 'a') as io5:\n        arg_1 = io5[\"quartets\"]\n\n        ## set generators\n        arg_2 = itertools.combinations(xrange(len(arg_0.samples)), 4)\n        arg_3 = np.arange(0, n_choose_k(len(arg_0.samples), 4))\n        np.random.shuffle(arg_3)\n        arg_4 = arg_3[:arg_0.params.nquartets]\n        arg_5 = np.sort(arg_4)\n        arg_6 = iter(arg_5)\n        del arg_3, arg_4\n\n        ## print progress update 1 to the engine stdout\n        print(arg_0._chunksize)\n\n        ## set to store\n        arg_7 = arg_6.next()\n        arg_8 = np.zeros((arg_0.params.nquartets, 4), dtype=np.uint16)\n        arg_9 = 0\n        while 1:\n            try:\n                for arg_10, arg_11 in enumerate(arg_2):\n                    if arg_10 == arg_7:\n                        arg_8[arg_9] = arg_11\n                        arg_9 += 1\n                        arg_7 = arg_6.next()\n\n                    ## print progress bar update to engine stdout\n                    if not arg_10 % arg_0._chunksize:\n                        print(min(arg_10, arg_0.params.nquartets))\n\n            except StopIteration:\n                break\n        ## store into database\n        arg_1[:] = arg_8\n        del arg_8", "path": "ipyrad/analysis/tetrad2.py", "identifier": "store_random", "docstring": "Populate array with random quartets sampled from a generator.\n    Holding all sets in memory might take a lot, but holding a very\n    large list of random numbers for which ones to sample will fit \n    into memory for most reasonable sized sets. So we'll load a \n    list of random numbers in the range of the length of total \n    sets that can be generated, then only keep sets from the set \n    generator if they are in the int list. I did several tests to \n    check that random pairs are as likely as 0 & 1 to come up together\n    in a random quartet set.", "docstring_tokens": ["Populate", "array", "with", "random", "quartets", "sampled", "from", "a", "generator", ".", "Holding", "all", "sets", "in", "memory", "might", "take", "a", "lot", "but", "holding", "a", "very", "large", "list", "of", "random", "numbers", "for", "which", "ones", "to", "sample", "will", "fit", "into", "memory", "for", "most", "reasonable", "sized", "sets", ".", "So", "we", "ll", "load", "a", "list", "of", "random", "numbers", "in", "the", "range", "of", "the", "length", "of", "total", "sets", "that", "can", "be", "generated", "then", "only", "keep", "sets", "from", "the", "set", "generator", "if", "they", "are", "in", "the", "int", "list", ".", "I", "did", "several", "tests", "to", "check", "that", "random", "pairs", "are", "as", "likely", "as", "0", "&", "1", "to", "come", "up", "together", "in", "a", "random", "quartet", "set", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 252999}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L833-L846", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Assign MUC stanza handlers to the `self.stream`.", "language": "python", "parameters": "(self,priority=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "arg_0", ".", "stream", ".", "set_message_handler", "(", "\"groupchat\"", ",", "arg_0", ".", "__groupchat_message", ",", "None", ",", "arg_1", ")", "arg_0", ".", "stream", ".", "set_message_handler", "(", "\"error\"", ",", "arg_0", ".", "__error_message", ",", "None", ",", "arg_1", ")", "arg_0", ".", "stream", ".", "set_presence_handler", "(", "\"available\"", ",", "arg_0", ".", "__presence_available", ",", "None", ",", "arg_1", ")", "arg_0", ".", "stream", ".", "set_presence_handler", "(", "\"unavailable\"", ",", "arg_0", ".", "__presence_unavailable", ",", "None", ",", "arg_1", ")", "arg_0", ".", "stream", ".", "set_presence_handler", "(", "\"error\"", ",", "arg_0", ".", "__presence_error", ",", "None", ",", "arg_1", ")"], "function": "def Func(arg_0,arg_1=10):\n        \"\"\"\n        Assign MUC stanza handlers to the `self.stream`.\n\n        :Parameters:\n            - `priority`: priority for the handlers.\n        :Types:\n            - `priority`: `int`\n        \"\"\"\n        arg_0.stream.set_message_handler(\"groupchat\",arg_0.__groupchat_message,None,arg_1)\n        arg_0.stream.set_message_handler(\"error\",arg_0.__error_message,None,arg_1)\n        arg_0.stream.set_presence_handler(\"available\",arg_0.__presence_available,None,arg_1)\n        arg_0.stream.set_presence_handler(\"unavailable\",arg_0.__presence_unavailable,None,arg_1)\n        arg_0.stream.set_presence_handler(\"error\",arg_0.__presence_error,None,arg_1)", "path": "pyxmpp2/ext/muc/muc.py", "identifier": "MucRoomManager.set_handlers", "docstring": "Assign MUC stanza handlers to the `self.stream`.\n\n        :Parameters:\n            - `priority`: priority for the handlers.\n        :Types:\n            - `priority`: `int`", "docstring_tokens": ["Assign", "MUC", "stanza", "handlers", "to", "the", "self", ".", "stream", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253000}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/mapping/noise_adaptive_layout.py#L206-L245", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Main run method for the noise adaptive layout.", "language": "python", "parameters": "(self, dag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_initialize_backend_prop", "(", ")", "arg_2", "=", "arg_0", ".", "_create_program_graph", "(", "arg_1", ")", "if", "arg_2", ">", "len", "(", "arg_0", ".", "swap_graph", ")", ":", "raise", "TranspilerError", "(", "'Number of qubits greater than device.'", ")", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "sorted", "(", "arg_0", ".", "prog_graph", ".", "edges", "(", "data", "=", "True", ")", ",", "key", "=", "lambda", "x", ":", "x", "[", "2", "]", "[", "'weight'", "]", ",", "reverse", "=", "True", ")", ":", "arg_0", ".", "pending_program_edges", ".", "append", "(", "(", "arg_3", ",", "arg_4", ")", ")", "while", "arg_0", ".", "pending_program_edges", ":", "arg_6", "=", "arg_0", ".", "_select_next_edge", "(", ")", "arg_7", "=", "arg_6", "[", "0", "]", "in", "arg_0", ".", "prog2hw", "arg_8", "=", "arg_6", "[", "1", "]", "in", "arg_0", ".", "prog2hw", "if", "(", "not", "arg_7", ")", "and", "(", "not", "arg_8", ")", ":", "arg_9", "=", "arg_0", ".", "_select_best_remaining_cx", "(", ")", "arg_0", ".", "prog2hw", "[", "arg_6", "[", "0", "]", "]", "=", "arg_9", "[", "0", "]", "arg_0", ".", "prog2hw", "[", "arg_6", "[", "1", "]", "]", "=", "arg_9", "[", "1", "]", "arg_0", ".", "available_hw_qubits", ".", "remove", "(", "arg_9", "[", "0", "]", ")", "arg_0", ".", "available_hw_qubits", ".", "remove", "(", "arg_9", "[", "1", "]", ")", "elif", "not", "arg_7", ":", "arg_11", "=", "arg_0", ".", "_select_best_remaining_qubit", "(", "arg_6", "[", "0", "]", ")", "arg_0", ".", "prog2hw", "[", "arg_6", "[", "0", "]", "]", "=", "arg_11", "arg_0", ".", "available_hw_qubits", ".", "remove", "(", "arg_11", ")", "else", ":", "arg_11", "=", "arg_0", ".", "_select_best_remaining_qubit", "(", "arg_6", "[", "1", "]", ")", "arg_0", ".", "prog2hw", "[", "arg_6", "[", "1", "]", "]", "=", "arg_11", "arg_0", ".", "available_hw_qubits", ".", "remove", "(", "arg_11", ")", "arg_12", "=", "[", "x", "for", "x", "in", "arg_0", ".", "pending_program_edges", "if", "not", "(", "x", "[", "0", "]", "in", "arg_0", ".", "prog2hw", "and", "x", "[", "1", "]", "in", "arg_0", ".", "prog2hw", ")", "]", "arg_0", ".", "pending_program_edges", "=", "arg_12", "for", "arg_14", "in", "arg_0", ".", "qarg_to_id", ".", "values", "(", ")", ":", "if", "arg_14", "not", "in", "arg_0", ".", "prog2hw", ":", "arg_0", ".", "prog2hw", "[", "arg_14", "]", "=", "arg_0", ".", "available_hw_qubits", "[", "0", "]", "arg_0", ".", "available_hw_qubits", ".", "remove", "(", "arg_0", ".", "prog2hw", "[", "arg_14", "]", ")", "arg_15", "=", "Layout", "(", ")", "for", "arg_16", "in", "arg_1", ".", "qubits", "(", ")", ":", "arg_17", "=", "arg_0", ".", "_qarg_to_id", "(", "arg_16", ")", "arg_18", "=", "arg_0", ".", "prog2hw", "[", "arg_17", "]", "arg_15", "[", "(", "arg_16", "[", "0", "]", ",", "arg_16", "[", "1", "]", ")", "]", "=", "arg_18", "arg_0", ".", "property_set", "[", "'layout'", "]", "=", "arg_15"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Main Func method for the noise adaptive layout.\"\"\"\n        arg_0._initialize_backend_prop()\n        arg_2 = arg_0._create_program_graph(arg_1)\n        if arg_2 > len(arg_0.swap_graph):\n            raise TranspilerError('Number of qubits greater than device.')\n        for arg_3, arg_4, arg_5 in sorted(arg_0.prog_graph.edges(data=True),\n                                    key=lambda x: x[2]['weight'], reverse=True):\n            arg_0.pending_program_edges.append((arg_3, arg_4))\n        while arg_0.pending_program_edges:\n            arg_6 = arg_0._select_next_edge()\n            arg_7 = arg_6[0] in arg_0.prog2hw\n            arg_8 = arg_6[1] in arg_0.prog2hw\n            if (not arg_7) and (not arg_8):\n                arg_9 = arg_0._select_best_remaining_cx()\n                arg_0.prog2hw[arg_6[0]] = arg_9[0]\n                arg_0.prog2hw[arg_6[1]] = arg_9[1]\n                arg_0.available_hw_qubits.remove(arg_9[0])\n                arg_0.available_hw_qubits.remove(arg_9[1])\n            elif not arg_7:\n                arg_11 = arg_0._select_best_remaining_qubit(arg_6[0])\n                arg_0.prog2hw[arg_6[0]] = arg_11\n                arg_0.available_hw_qubits.remove(arg_11)\n            else:\n                arg_11 = arg_0._select_best_remaining_qubit(arg_6[1])\n                arg_0.prog2hw[arg_6[1]] = arg_11\n                arg_0.available_hw_qubits.remove(arg_11)\n            arg_12 = [x for x in arg_0.pending_program_edges\n                         if not (x[0] in arg_0.prog2hw and x[1] in arg_0.prog2hw)]\n            arg_0.pending_program_edges = arg_12\n        for arg_14 in arg_0.qarg_to_id.values():\n            if arg_14 not in arg_0.prog2hw:\n                arg_0.prog2hw[arg_14] = arg_0.available_hw_qubits[0]\n                arg_0.available_hw_qubits.remove(arg_0.prog2hw[arg_14])\n        arg_15 = Layout()\n        for arg_16 in arg_1.qubits():\n            arg_17 = arg_0._qarg_to_id(arg_16)\n            arg_18 = arg_0.prog2hw[arg_17]\n            arg_15[(arg_16[0], arg_16[1])] = arg_18\n        arg_0.property_set['layout'] = arg_15", "path": "qiskit/transpiler/passes/mapping/noise_adaptive_layout.py", "identifier": "NoiseAdaptiveLayout.run", "docstring": "Main run method for the noise adaptive layout.", "docstring_tokens": ["Main", "run", "method", "for", "the", "noise", "adaptive", "layout", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253001}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L1052-L1133", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "This will return a single tr element, with all tds already populated.", "language": "python", "parameters": "(tr, meta_data, row_spans)", "return_statement": "return tr_el", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "etree", ".", "Element", "(", "'tr'", ")", "arg_4", "=", "get_namespace", "(", "arg_0", ",", "'w'", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_0", ":", "if", "arg_6", "in", "arg_5", ":", "continue", "arg_5", ".", "append", "(", "arg_6", ")", "if", "arg_6", ".", "tag", "==", "'%stc'", "%", "arg_4", ":", "arg_7", "=", "get_v_merge", "(", "arg_6", ")", "if", "(", "arg_7", "is", "not", "None", "and", "arg_7", ".", "get", "(", "'%sval'", "%", "arg_4", ")", "!=", "'restart'", ")", ":", "continue", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_6", ":", "if", "arg_9", "in", "arg_5", ":", "continue", "if", "is_li", "(", "arg_9", ",", "arg_1", ")", ":", "arg_10", "=", "get_single_list_nodes_data", "(", "arg_9", ",", "arg_1", ",", ")", "arg_11", ",", "arg_12", "=", "build_list", "(", "arg_10", ",", "arg_1", ",", ")", "arg_5", ".", "extend", "(", "arg_12", ")", "arg_8", ".", "append", "(", "etree", ".", "tostring", "(", "arg_11", ")", ")", "elif", "arg_9", ".", "tag", "==", "'%stbl'", "%", "arg_4", ":", "arg_13", ",", "arg_14", "=", "build_table", "(", "arg_9", ",", "arg_1", ",", ")", "arg_5", ".", "extend", "(", "arg_14", ")", "arg_8", ".", "append", "(", "etree", ".", "tostring", "(", "arg_13", ")", ")", "elif", "arg_9", ".", "tag", "==", "'%stcPr'", "%", "arg_4", ":", "arg_5", ".", "append", "(", "arg_9", ")", "continue", "else", ":", "arg_15", "=", "get_element_content", "(", "arg_9", ",", "arg_1", ",", "is_td", "=", "True", ",", ")", "arg_8", ".", "append", "(", "arg_15", ")", "arg_16", "=", "'<br />'", ".", "join", "(", "t", "for", "t", "in", "arg_8", "if", "t", "is", "not", "None", ")", "arg_17", "=", "etree", ".", "XML", "(", "'<td>%s</td>'", "%", "arg_16", ")", "arg_18", "=", "get_grid_span", "(", "arg_6", ")", "if", "arg_18", ">", "1", ":", "arg_17", ".", "set", "(", "'colspan'", ",", "'%d'", "%", "arg_18", ")", "arg_7", "=", "get_v_merge", "(", "arg_6", ")", "if", "(", "arg_7", "is", "not", "None", "and", "arg_7", ".", "get", "(", "'%sval'", "%", "arg_4", ")", "==", "'restart'", ")", ":", "arg_19", "=", "next", "(", "arg_2", ")", "arg_17", ".", "set", "(", "'rowspan'", ",", "'%d'", "%", "arg_19", ")", "arg_3", ".", "append", "(", "arg_17", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    This will return a single tr element, with all tds already populated.\n    \"\"\"\n\n    # Create a blank tr element.\n    arg_3 = etree.Element('tr')\n    arg_4 = get_namespace(arg_0, 'w')\n    arg_5 = []\n    for arg_6 in arg_0:\n        if arg_6 in arg_5:\n            continue\n        arg_5.append(arg_6)\n        # Find the table cells.\n        if arg_6.tag == '%stc' % arg_4:\n            arg_7 = get_v_merge(arg_6)\n            # If there is a v_merge and it is not restart then this cell can be\n            # ignored.\n            if (\n                    arg_7 is not None and\n                    arg_7.get('%sval' % arg_4) != 'restart'):\n                continue\n\n            # Loop through each and build a list of all the content.\n            arg_8 = []\n            for arg_9 in arg_6:\n                # Since we are doing look-a-heads in this loop we need to check\n                # again to see if we have already visited the node.\n                if arg_9 in arg_5:\n                    continue\n\n                # Check to see if it is a list or a regular paragraph.\n                if is_li(arg_9, arg_1):\n                    # If it is a list, create the list and update\n                    # visited_nodes.\n                    arg_10 = get_single_list_nodes_data(\n                        arg_9,\n                        arg_1,\n                    )\n                    arg_11, arg_12 = build_list(\n                        arg_10,\n                        arg_1,\n                    )\n                    arg_5.extend(arg_12)\n                    arg_8.append(etree.tostring(arg_11))\n                elif arg_9.tag == '%stbl' % arg_4:\n                    arg_13, arg_14 = build_table(\n                        arg_9,\n                        arg_1,\n                    )\n                    arg_5.extend(arg_14)\n                    arg_8.append(etree.tostring(arg_13))\n                elif arg_9.tag == '%stcPr' % arg_4:\n                    # Do nothing\n                    arg_5.append(arg_9)\n                    continue\n                else:\n                    arg_15 = get_element_content(\n                        arg_9,\n                        arg_1,\n                        is_td=True,\n                    )\n                    arg_8.append(arg_15)\n\n            arg_16 = '<br />'.join(t for t in arg_8 if t is not None)\n            arg_17 = etree.XML('<td>%s</td>' % arg_16)\n            # if there is a colspan then set it here.\n            arg_18 = get_grid_span(arg_6)\n            if arg_18 > 1:\n                arg_17.set('colspan', '%d' % arg_18)\n            arg_7 = get_v_merge(arg_6)\n\n            # If this td has a v_merge and it is restart then set the rowspan\n            # here.\n            if (\n                    arg_7 is not None and\n                    arg_7.get('%sval' % arg_4) == 'restart'):\n                arg_19 = next(arg_2)\n                arg_17.set('rowspan', '%d' % arg_19)\n\n            arg_3.append(arg_17)\n    return arg_3", "path": "docx2html/core.py", "identifier": "build_tr", "docstring": "This will return a single tr element, with all tds already populated.", "docstring_tokens": ["This", "will", "return", "a", "single", "tr", "element", "with", "all", "tds", "already", "populated", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 253002}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/doc_annotate.py#L7-L50", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Parse a docstring into ParameterInfo and ReturnInfo objects.", "language": "python", "parameters": "(doc)", "return_statement": "return params, returns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "inspect", ".", "cleandoc", "(", "arg_0", ")", "arg_1", "=", "arg_0", ".", "split", "(", "'\\n'", ")", "arg_2", "=", "None", "arg_3", "=", "None", "arg_4", "=", "{", "}", "arg_5", "=", "None", "for", "arg_6", "in", "arg_1", ":", "arg_6", "=", "arg_6", ".", "rstrip", "(", ")", "if", "len", "(", "arg_6", ")", "==", "0", ":", "continue", "elif", "str", "(", "arg_6", ")", "==", "'Args:'", ":", "arg_2", "=", "'args'", "arg_3", "=", "None", "continue", "elif", "str", "(", "arg_6", ")", "==", "'Returns:'", ":", "arg_2", "=", "'return'", "arg_3", "=", "None", "continue", "if", "arg_2", "is", "not", "None", ":", "arg_7", "=", "arg_6", ".", "lstrip", "(", ")", "arg_8", "=", "len", "(", "arg_6", ")", "-", "len", "(", "arg_7", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_8", "if", "arg_8", "!=", "arg_3", ":", "continue", "if", "arg_2", "==", "'args'", ":", "arg_9", ",", "arg_10", "=", "parse_param", "(", "arg_7", ")", "arg_4", "[", "arg_9", "]", "=", "arg_10", "elif", "arg_2", "==", "'return'", ":", "arg_5", "=", "parse_return", "(", "arg_7", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"Parse a docstring into ParameterInfo and ReturnInfo objects.\"\"\"\n\n    arg_0 = inspect.cleandoc(arg_0)\n    arg_1 = arg_0.split('\\n')\n    arg_2 = None\n    arg_3 = None\n\n    arg_4 = {}\n    arg_5 = None\n\n    for arg_6 in arg_1:\n        arg_6 = arg_6.rstrip()\n\n        if len(arg_6) == 0:\n            continue\n        elif str(arg_6) == 'Args:':\n            arg_2 = 'args'\n            arg_3 = None\n            continue\n        elif str(arg_6) == 'Returns:':\n            arg_2 = 'return'\n            arg_3 = None\n            continue\n\n        if arg_2 is not None:\n            arg_7 = arg_6.lstrip()\n            arg_8 = len(arg_6) - len(arg_7)\n\n            if arg_3 is None:\n                arg_3 = arg_8\n\n            if arg_8 != arg_3:\n                continue\n\n            # These are all the param lines in the docstring that are\n            # not continuations of the previous line\n            if arg_2 == 'args':\n                arg_9, arg_10 = parse_param(arg_7)\n                arg_4[arg_9] = arg_10\n            elif arg_2 == 'return':\n                arg_5 = parse_return(arg_7)\n\n    return arg_4, arg_5", "path": "typedargs/doc_annotate.py", "identifier": "parse_docstring", "docstring": "Parse a docstring into ParameterInfo and ReturnInfo objects.", "docstring_tokens": ["Parse", "a", "docstring", "into", "ParameterInfo", "and", "ReturnInfo", "objects", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 253003}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L307-L328", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Function for doing an upload of a file as an item. This should be a\n    building block for user-level functions.", "language": "python", "parameters": "(local_file, parent_folder_id, file_path,\n                    reuse_existing=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "_create_or_reuse_item", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "_create_bitstream", "(", "arg_2", ",", "arg_0", ",", "arg_4", ")", "for", "arg_5", "in", "session", ".", "item_upload_callbacks", ":", "arg_5", "(", "session", ".", "communicator", ",", "session", ".", "token", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                    arg_3=False):\n    \"\"\"\n    Function for doing an upload of a file as an item. This should be a\n    building block for user-level functions.\n\n    :param local_file: name of local file to upload\n    :type local_file: string\n    :param parent_folder_id: id of parent folder on the Midas Server instance,\n        where the item will be added\n    :type parent_folder_id: int | long\n    :param file_path: full path to the file\n    :type file_path: string\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool\n    \"\"\"\n    arg_4 = _create_or_reuse_item(arg_0, arg_1,\n                                            arg_3)\n    _create_bitstream(arg_2, arg_0, arg_4)\n    for arg_5 in session.item_upload_callbacks:\n        arg_5(session.communicator, session.token, arg_4)", "path": "pydas/api.py", "identifier": "_upload_as_item", "docstring": "Function for doing an upload of a file as an item. This should be a\n    building block for user-level functions.\n\n    :param local_file: name of local file to upload\n    :type local_file: string\n    :param parent_folder_id: id of parent folder on the Midas Server instance,\n        where the item will be added\n    :type parent_folder_id: int | long\n    :param file_path: full path to the file\n    :type file_path: string\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool", "docstring_tokens": ["Function", "for", "doing", "an", "upload", "of", "a", "file", "as", "an", "item", ".", "This", "should", "be", "a", "building", "block", "for", "user", "-", "level", "functions", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 253004}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmparser.py#L154-L179", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Verify a register.", "language": "python", "parameters": "(self, obj, object_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ".", "name", "not", "in", "arg_0", ".", "global_symtab", ":", "raise", "QasmError", "(", "'Cannot find definition for'", ",", "arg_2", ",", "\"'\"", "+", "arg_1", ".", "name", "+", "\"'\"", ",", "'at line'", ",", "str", "(", "arg_1", ".", "line", ")", ",", "'file'", ",", "arg_1", ".", "file", ")", "arg_3", "=", "arg_0", ".", "global_symtab", "[", "arg_1", ".", "name", "]", "if", "arg_3", ".", "type", "!=", "arg_2", ":", "raise", "QasmError", "(", "\"Type for '\"", "+", "arg_3", ".", "name", "+", "\"' should be '\"", "+", "arg_2", "+", "\"' but was found to be '\"", "+", "arg_3", ".", "type", "+", "\"'\"", ",", "\"line\"", ",", "str", "(", "arg_1", ".", "line", ")", ",", "\"file\"", ",", "arg_1", ".", "file", ")", "if", "arg_1", ".", "type", "==", "'indexed_id'", ":", "arg_4", "=", "arg_3", ".", "index", "arg_5", "=", "arg_1", ".", "index", "if", "arg_5", "<", "0", "or", "arg_5", ">=", "arg_4", ":", "raise", "QasmError", "(", "\"Register index for '\"", "+", "arg_3", ".", "name", "+", "\"' out of bounds. Index is\"", ",", "str", "(", "arg_5", ")", ",", "\"bound is 0 <= index <\"", ",", "str", "(", "arg_4", ")", ",", "\"at line\"", ",", "str", "(", "arg_1", ".", "line", ")", ",", "\"file\"", ",", "arg_1", ".", "file", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Verify a register.\"\"\"\n        # How to verify:\n        #    types must match\n        #    indexes must be checked\n        if arg_1.name not in arg_0.global_symtab:\n            raise QasmError('Cannot find definition for', arg_2, \"'\"\n                            + arg_1.name + \"'\", 'at line', str(arg_1.line),\n                            'file', arg_1.file)\n\n        arg_3 = arg_0.global_symtab[arg_1.name]\n\n        if arg_3.type != arg_2:\n            raise QasmError(\"Type for '\" + arg_3.name + \"' should be '\"\n                            + arg_2 + \"' but was found to be '\"\n                            + arg_3.type + \"'\", \"line\", str(arg_1.line),\n                            \"file\", arg_1.file)\n\n        if arg_1.type == 'indexed_id':\n            arg_4 = arg_3.index\n            arg_5 = arg_1.index\n            if arg_5 < 0 or arg_5 >= arg_4:\n                raise QasmError(\"Register index for '\" + arg_3.name\n                                + \"' out of bounds. Index is\", str(arg_5),\n                                \"bound is 0 <= index <\", str(arg_4),\n                                \"at line\", str(arg_1.line), \"file\", arg_1.file)", "path": "qiskit/qasm/qasmparser.py", "identifier": "QasmParser.verify_reg", "docstring": "Verify a register.", "docstring_tokens": ["Verify", "a", "register", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253005}
{"url": "https://github.com/skorokithakis/django-loginas/blob/6257857b40ed5b59e4c59a3af4b54d4856cacaf0/loginas/views.py#L27-L44", "sha": "6257857b40ed5b59e4c59a3af4b54d4856cacaf0", "docstring_summary": "Code to load create user module. Copied off django-browserid.", "language": "python", "parameters": "(path)", "return_statement": "return can_login_as", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "rfind", "(", "\".\"", ")", "arg_2", ",", "arg_3", "=", "arg_0", "[", ":", "arg_1", "]", ",", "arg_0", "[", "arg_1", "+", "1", ":", "]", "try", ":", "arg_4", "=", "import_module", "(", "arg_2", ")", "except", "ImportError", ":", "raise", "ImproperlyConfigured", "(", "\"Error importing CAN_LOGIN_AS function: {}\"", ".", "format", "(", "arg_2", ")", ")", "except", "ValueError", ":", "raise", "ImproperlyConfigured", "(", "\"Error importing CAN_LOGIN_AS\"", "\" function. Is CAN_LOGIN_AS a\"", "\" string?\"", ")", "try", ":", "arg_5", "=", "getattr", "(", "arg_4", ",", "arg_3", ")", "except", "AttributeError", ":", "raise", "ImproperlyConfigured", "(", "\"Module {0} does not define a {1} \"", "\"function.\"", ".", "format", "(", "arg_2", ",", "arg_3", ")", ")", "return", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"Code to load create user module. Copied off django-browserid.\"\"\"\n\n    arg_1 = arg_0.rfind(\".\")\n    arg_2, arg_3 = arg_0[:arg_1], arg_0[arg_1 + 1 :]\n\n    try:\n        arg_4 = import_module(arg_2)\n    except ImportError:\n        raise ImproperlyConfigured(\"Error importing CAN_LOGIN_AS function: {}\".format(arg_2))\n    except ValueError:\n        raise ImproperlyConfigured(\"Error importing CAN_LOGIN_AS\" \" function. Is CAN_LOGIN_AS a\" \" string?\")\n\n    try:\n        arg_5 = getattr(arg_4, arg_3)\n    except AttributeError:\n        raise ImproperlyConfigured(\"Module {0} does not define a {1} \" \"function.\".format(arg_2, arg_3))\n    return arg_5", "path": "loginas/views.py", "identifier": "_load_module", "docstring": "Code to load create user module. Copied off django-browserid.", "docstring_tokens": ["Code", "to", "load", "create", "user", "module", ".", "Copied", "off", "django", "-", "browserid", "."], "nwo": "skorokithakis/django-loginas", "score": 0.5693122885578876, "idx": 253006}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/push.py#L24-L97", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "push an image to Globus endpoint. In this case, the name is the\n       globus endpoint id and path.", "language": "python", "parameters": "(self, path, name, tag=None)", "return_statement": "return transfer_result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_parse_endpoint_name", "(", "arg_2", ")", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", "arg_6", "=", "os", ".", "path", ".", "basename", "(", "arg_1", ")", "bot", ".", "debug", "(", "\"PUSH %s\"", "%", "arg_1", ")", "arg_7", "=", "parse_image_name", "(", "arg_6", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "bot", ".", "error", "(", "'%s does not exist.'", "%", "arg_1", ")", "sys", ".", "exit", "(", "1", ")", "if", "not", "hasattr", "(", "arg_0", ",", "'transfer_client'", ")", ":", "arg_0", ".", "_init_transfer_client", "(", ")", "arg_8", "=", "arg_0", ".", "_get_endpoints", "(", ")", "if", "len", "(", "arg_8", "[", "'my-endpoints'", "]", ")", "==", "0", ":", "bot", ".", "error", "(", "'You must have a personal endpoint to transfer the container'", ")", "sys", ".", "exit", "(", "1", ")", "arg_9", "=", "None", "for", "arg_10", ",", "arg_11", "in", "arg_8", "[", "'my-endpoints'", "]", ".", "items", "(", ")", ":", "if", "arg_11", "[", "'gcp_connected'", "]", "is", "True", ":", "arg_9", "=", "arg_11", "break", "if", "arg_9", "is", "None", ":", "bot", ".", "error", "(", "'No activated local endpoints online! Go online to transfer'", ")", "sys", ".", "exit", "(", "1", ")", "arg_0", ".", "_create_endpoint_cache", "(", "arg_4", ")", "arg_12", "=", "arg_0", ".", "add", "(", "image_path", "=", "arg_1", ",", "image_uri", "=", "arg_7", "[", "'uri'", "]", ",", "copy", "=", "True", ")", "arg_13", "=", "\"Singularity Registry Transfer for %s\"", "%", "arg_12", ".", "name", "arg_14", "=", "globus_sdk", ".", "TransferData", "(", "arg_0", ".", "transfer_client", ",", "arg_9", "[", "'id'", "]", ",", "arg_4", ",", "arg_13", "=", "arg_13", ",", "sync_level", "=", "\"checksum\"", ")", "arg_6", "=", "\".singularity/shub/%s\"", "%", "arg_6", "arg_14", ".", "add_item", "(", "arg_12", ".", "image", ",", "arg_6", ")", "bot", ".", "info", "(", "'Requesting transfer from local %s to %s:%s'", "%", "(", "SREGISTRY_STORAGE", ",", "arg_4", ",", "arg_6", ")", ")", "arg_15", "=", "arg_0", ".", "transfer_client", ".", "submit_transfer", "(", "arg_14", ")", "bot", ".", "info", "(", "arg_15", "[", "'message'", "]", ")", "return", "arg_15"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    '''Func an image to Globus endpoint. In this case, the name is the\n       globus endpoint id and path.\n\n       --name <endpointid>:/path/for/image\n\n    '''\n\n    # Split the name into endpoint and rest\n\n    arg_4, arg_5 = arg_0._parse_endpoint_name(arg_2)\n\n    arg_1 = os.path.abspath(arg_1)\n    arg_6 = os.path.basename(arg_1)\n    bot.debug(\"PUSH %s\" % arg_1)\n\n    # Flatten image uri into image name\n\n    arg_7 = parse_image_name(arg_6)\n\n    if not os.path.exists(arg_1):\n        bot.error('%s does not exist.' %arg_1)\n        sys.exit(1)\n\n    # Ensure we have a transfer client\n    if not hasattr(arg_0, 'transfer_client'):\n        arg_0._init_transfer_client()\n\n    # The user must have a personal endpoint\n\n    arg_8 = arg_0._get_endpoints()\n\n    if len(arg_8['my-endpoints']) == 0:\n        bot.error('You must have a personal endpoint to transfer the container')\n        sys.exit(1) \n\n    # Take the first endpoint that is active\n\n    arg_9 = None\n    for arg_10,arg_11 in arg_8['my-endpoints'].items():\n       if arg_11['gcp_connected'] is True:\n           arg_9 = arg_11\n           break\n\n    # Exit if none are active, required!\n\n    if arg_9 is None:\n        bot.error('No activated local endpoints online! Go online to transfer')\n        sys.exit(1)\n\n\n    # The destination endpoint should have an .singularity/shub folder set\n    arg_0._create_endpoint_cache(arg_4)\n\n    # SREGISTRY_STORAGE must be an endpoint\n    # if the image isn't already there, add it first\n\n    arg_12 = arg_0.add(image_path=arg_1, \n                     image_uri=arg_7['uri'],\n                     copy=True)\n    \n    arg_13 = \"Singularity Registry Transfer for %s\" %arg_12.name\n    arg_14 = globus_sdk.TransferData(arg_0.transfer_client, \n                                    arg_9['id'],\n                                    arg_4,\n                                    arg_13=arg_13,\n                                    sync_level=\"checksum\")\n    arg_6 = \".singularity/shub/%s\" %arg_6\n    arg_14.add_item(arg_12.image, arg_6)\n    bot.info('Requesting transfer from local %s to %s:%s' %(SREGISTRY_STORAGE,\n                                                            arg_4, arg_6))\n    arg_15 = arg_0.transfer_client.submit_transfer(arg_14)\n    bot.info(arg_15['message'])\n    return arg_15", "path": "sregistry/main/globus/push.py", "identifier": "push", "docstring": "push an image to Globus endpoint. In this case, the name is the\n       globus endpoint id and path.\n\n       --name <endpointid>:/path/for/image", "docstring_tokens": ["push", "an", "image", "to", "Globus", "endpoint", ".", "In", "this", "case", "the", "name", "is", "the", "globus", "endpoint", "id", "and", "path", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 253007}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L164-L222", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Calculate Parachor for a pure species, using its density in the\n    liquid and gas phases, surface tension, and molecular weight.", "language": "python", "parameters": "(MW, rhol, rhog, sigma)", "return_statement": "return sigma**0.25*MW/(rhol-rhog)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_1", ",", "arg_2", "=", "arg_1", "*", "1000.", ",", "arg_2", "*", "1000.", "return", "arg_3", "**", "0.25", "*", "arg_0", "/", "(", "arg_1", "-", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    r'''Calculate Func for a pure species, using its density in the\n    liquid and gas phases, surface tension, and molecular weight.\n\n    .. math::\n        P = \\frac{\\sigma^{0.25} MW}{\\rho_L - \\rho_V}\n    \n    Parameters\n    ----------\n    MW : float\n        Molecular weight, [g/mol]\n    rhol : float\n        Liquid density [kg/m^3]\n    rhog : float\n        Gas density [kg/m^3]\n    sigma : float\n        Surface tension, [N/m]\n\n    Returns\n    -------\n    P : float\n        Func, [N^0.25*m^2.75/mol]\n\n    Notes\n    -----\n    To convert the output of this function to units of [mN^0.25*m^2.75/kmol], \n    multiply by 5623.4132519.\n    \n    Values in group contribution tables for Func are often listed as \n    dimensionless, in which they are multiplied by 5623413 and the appropriate\n    units to make them dimensionless.\n    \n    Examples\n    --------\n    Calculating Func from a known surface tension for methyl isobutyl \n    ketone at 293.15 K\n    \n    >>> Func(100.15888, 800.8088185536124, 4.97865317223119, 0.02672166960656005)\n    5.088443542210164e-05\n    \n    Converting to the `dimensionless` form:\n    \n    >>> 5623413*5.088443542210164e-05\n    286.14419565030687\n    \n    Compared to 274.9 according to a group contribution method described in\n    [3]_.\n\n    References\n    ----------\n    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.\n       New York: McGraw-Hill Professional, 2000.\n    .. [2] Green, Don, and Robert Perry. Perry's Chemical Engineers' Handbook,\n       8E. McGraw-Hill Professional, 2007.\n    .. [3] Danner, Ronald P, and Design Institute for Physical Property Data.\n       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.\n    '''\n    arg_1, arg_2 = arg_1*1000., arg_2*1000. # Convert kg/m^3 to g/m^3\n    return arg_3**0.25*arg_0/(arg_1-arg_2)", "path": "thermo/utils.py", "identifier": "Parachor", "docstring": "r'''Calculate Parachor for a pure species, using its density in the\n    liquid and gas phases, surface tension, and molecular weight.\n\n    .. math::\n        P = \\frac{\\sigma^{0.25} MW}{\\rho_L - \\rho_V}\n    \n    Parameters\n    ----------\n    MW : float\n        Molecular weight, [g/mol]\n    rhol : float\n        Liquid density [kg/m^3]\n    rhog : float\n        Gas density [kg/m^3]\n    sigma : float\n        Surface tension, [N/m]\n\n    Returns\n    -------\n    P : float\n        Parachor, [N^0.25*m^2.75/mol]\n\n    Notes\n    -----\n    To convert the output of this function to units of [mN^0.25*m^2.75/kmol], \n    multiply by 5623.4132519.\n    \n    Values in group contribution tables for Parachor are often listed as \n    dimensionless, in which they are multiplied by 5623413 and the appropriate\n    units to make them dimensionless.\n    \n    Examples\n    --------\n    Calculating Parachor from a known surface tension for methyl isobutyl \n    ketone at 293.15 K\n    \n    >>> Parachor(100.15888, 800.8088185536124, 4.97865317223119, 0.02672166960656005)\n    5.088443542210164e-05\n    \n    Converting to the `dimensionless` form:\n    \n    >>> 5623413*5.088443542210164e-05\n    286.14419565030687\n    \n    Compared to 274.9 according to a group contribution method described in\n    [3]_.\n\n    References\n    ----------\n    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.\n       New York: McGraw-Hill Professional, 2000.\n    .. [2] Green, Don, and Robert Perry. Perry's Chemical Engineers' Handbook,\n       8E. McGraw-Hill Professional, 2007.\n    .. [3] Danner, Ronald P, and Design Institute for Physical Property Data.\n       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.", "docstring_tokens": ["r", "Calculate", "Parachor", "for", "a", "pure", "species", "using", "its", "density", "in", "the", "liquid", "and", "gas", "phases", "surface", "tension", "and", "molecular", "weight", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 253008}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2494-L2544", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Serial command to set seasons table.", "language": "python", "parameters": "(self, cmd_dict=None, password=\"00000000\")", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "\"00000000\"", ")", ":", "arg_3", "=", "False", "arg_0", ".", "setContext", "(", "\"Func\"", ")", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "m_seasons_sched_params", "try", ":", "if", "not", "arg_0", ".", "request", "(", "False", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Bad read CRC on setting\"", ")", "else", ":", "if", "not", "arg_0", ".", "serialCmdPwdAuth", "(", "arg_2", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Password failure\"", ")", "else", ":", "arg_4", "=", "\"\"", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_1_Start_Month\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_1_Start_Day\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_1_Schedule\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_2_Start_Month\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_2_Start_Day\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_2_Schedule\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_3_Start_Month\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_3_Start_Day\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_3_Schedule\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_4_Start_Month\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_4_Start_Day\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", "[", "\"Season_4_Schedule\"", "]", ")", ".", "zfill", "(", "2", ")", ")", "arg_4", "+=", "binascii", ".", "hexlify", "(", "str", "(", "0", ")", ".", "zfill", "(", "24", ")", ")", "arg_5", "=", "\"015731023030383028\"", "+", "arg_4", "+", "\"2903\"", "arg_5", "+=", "arg_0", ".", "calc_crc16", "(", "arg_5", "[", "2", ":", "]", ".", "decode", "(", "\"hex\"", ")", ")", "arg_0", ".", "m_serial_port", ".", "write", "(", "arg_5", ".", "decode", "(", "\"hex\"", ")", ")", "if", "arg_0", ".", "m_serial_port", ".", "getResponse", "(", "arg_0", ".", "getContext", "(", ")", ")", ".", "encode", "(", "\"hex\"", ")", "==", "\"06\"", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Success(Func): 06 returned.\"", ")", "arg_3", "=", "True", "arg_0", ".", "serialPostEnd", "(", ")", "except", ":", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ".", "exc_info", "(", ")", ")", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=\"00000000\"):\n        \"\"\" Serial command to set seasons table.\n\n        If no dictionary is passed, the meter object buffer is used.\n\n        Args:\n            cmd_dict (dict): Optional dictionary of season schedules.\n            password (str): Optional password\n\n        Returns:\n            bool: True on completion and ACK.\n        \"\"\"\n        arg_3 = False\n        arg_0.setContext(\"Func\")\n\n        if not arg_1:\n            arg_1 = arg_0.m_seasons_sched_params\n\n        try:\n            if not arg_0.request(False):\n                arg_0.writeCmdMsg(\"Bad read CRC on setting\")\n            else:\n                if not arg_0.serialCmdPwdAuth(arg_2):\n                    arg_0.writeCmdMsg(\"Password failure\")\n                else:\n                    arg_4 = \"\"\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_1_Start_Month\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_1_Start_Day\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_1_Schedule\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_2_Start_Month\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_2_Start_Day\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_2_Schedule\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_3_Start_Month\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_3_Start_Day\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_3_Schedule\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_4_Start_Month\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_4_Start_Day\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(arg_1[\"Season_4_Schedule\"]).zfill(2))\n                    arg_4 += binascii.hexlify(str(0).zfill(24))\n                    arg_5 = \"015731023030383028\" + arg_4 + \"2903\"\n                    arg_5 += arg_0.calc_crc16(arg_5[2:].decode(\"hex\"))\n                    arg_0.m_serial_port.write(arg_5.decode(\"hex\"))\n                    if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode(\"hex\") == \"06\":\n                        arg_0.writeCmdMsg(\"Success(Func): 06 returned.\")\n                        arg_3 = True\n            arg_0.serialPostEnd()\n        except:\n            ekm_log(traceback.format_exc(sys.exc_info()))\n\n        arg_0.setContext(\"\")\n        return arg_3", "path": "ekmmeters.py", "identifier": "Meter.setSeasonSchedules", "docstring": "Serial command to set seasons table.\n\n        If no dictionary is passed, the meter object buffer is used.\n\n        Args:\n            cmd_dict (dict): Optional dictionary of season schedules.\n            password (str): Optional password\n\n        Returns:\n            bool: True on completion and ACK.", "docstring_tokens": ["Serial", "command", "to", "set", "seasons", "table", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 253009}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L101-L118", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Return a dictionary of distances keyed by the keys in the given dict.", "language": "python", "parameters": "(target: Iterable[X], dict_of_sets: Mapping[Y, Set[X]])", "return_statement": "return {\n        k: tanimoto_set_similarity(target_set, s)\n        for k, s in dict_of_sets.items()\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "arg_3", ":", "arg_4", "[", "arg_5", ",", "arg_6", "[", "arg_2", "]", "]", ")", "->", "arg_4", "[", "arg_5", ",", "float", "]", ":", "arg_7", "=", "set", "(", "arg_0", ")", "return", "{", "arg_8", ":", "tanimoto_set_similarity", "(", "arg_7", ",", "arg_9", ")", "for", "arg_8", ",", "arg_9", "in", "arg_3", ".", "items", "(", ")", "}"], "function": "def Func(arg_0: arg_1[arg_2], arg_3: arg_4[arg_5, arg_6[arg_2]]) -> arg_4[arg_5, float]:\n    \"\"\"Return a dictionary of distances keyed by the keys in the given dict.\n\n    Distances are calculated based on pairwise tanimoto similarity of the sets contained\n\n    :param set target: A set\n    :param dict_of_sets: A dict of {x: set of y}\n    :type dict_of_sets: dict\n    :return: A similarity dicationary based on the set overlap (tanimoto) score between the target set and the sets in\n            dos\n    :rtype: dict\n    \"\"\"\n    arg_7 = set(arg_0)\n\n    return {\n        arg_8: tanimoto_set_similarity(arg_7, arg_9)\n        for arg_8, arg_9 in arg_3.items()\n    }", "path": "src/pybel_tools/utils.py", "identifier": "calculate_single_tanimoto_set_distances", "docstring": "Return a dictionary of distances keyed by the keys in the given dict.\n\n    Distances are calculated based on pairwise tanimoto similarity of the sets contained\n\n    :param set target: A set\n    :param dict_of_sets: A dict of {x: set of y}\n    :type dict_of_sets: dict\n    :return: A similarity dicationary based on the set overlap (tanimoto) score between the target set and the sets in\n            dos\n    :rtype: dict", "docstring_tokens": ["Return", "a", "dictionary", "of", "distances", "keyed", "by", "the", "keys", "in", "the", "given", "dict", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253010}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L447-L488", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "random - fill a buffer with random data", "language": "python", "parameters": "(self, cpu, buf, count, rnd_bytes)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "0", "if", "arg_3", "!=", "0", ":", "if", "arg_3", ">", "Decree", ".", "CGC_SSIZE_MAX", "or", "arg_3", "<", "0", ":", "arg_5", "=", "Decree", ".", "CGC_EINVAL", "else", ":", "if", "arg_2", "not", "in", "arg_1", ".", "memory", "or", "(", "arg_2", "+", "arg_3", ")", "not", "in", "arg_1", ".", "memory", ":", "logger", ".", "info", "(", "\"RANDOM: buf points to invalid address. Returning EFAULT\"", ")", "return", "Decree", ".", "CGC_EFAULT", "with", "open", "(", "\"/dev/urandom\"", ",", "\"rb\"", ")", "as", "f", ":", "arg_6", "=", "f", ".", "read", "(", "arg_3", ")", "arg_0", ".", "syscall_trace", ".", "append", "(", "(", "\"_random\"", ",", "-", "1", ",", "arg_6", ")", ")", "arg_1", ".", "write_bytes", "(", "arg_2", ",", "arg_6", ")", "if", "arg_4", ":", "if", "arg_4", "not", "in", "arg_1", ".", "memory", ":", "logger", ".", "info", "(", "\"RANDOM: Not valid rnd_bytes. Returning EFAULT\"", ")", "return", "Decree", ".", "CGC_EFAULT", "arg_1", ".", "write_int", "(", "arg_4", ",", "len", "(", "arg_6", ")", ",", "32", ")", "logger", ".", "info", "(", "\"RANDOM(0x%08x, %d, 0x%08x) -> <%s>)\"", "%", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "repr", "(", "arg_6", "[", ":", "10", "]", ")", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\" random - fill a buffer with random data\n\n           The  random  system call populates the buffer referenced by buf with up to\n           count bytes of random data. If count is zero, random returns 0 and optionally\n           sets *rx_bytes to zero. If count is greater than SSIZE_MAX, the result is unspecified.\n\n           :param cpu: current CPU\n           :param buf: a memory buffer\n           :param count: max number of bytes to receive\n           :param rnd_bytes: if valid, points to the actual number of random bytes\n\n           :return:  0        On success\n                     EINVAL   count is invalid.\n                     EFAULT   buf or rnd_bytes points to an invalid address.\n        \"\"\"\n\n        arg_5 = 0\n        if arg_3 != 0:\n            if arg_3 > Decree.CGC_SSIZE_MAX or arg_3 < 0:\n                arg_5 = Decree.CGC_EINVAL\n            else:\n                # TODO check count bytes from buf\n                if arg_2 not in arg_1.memory or (arg_2 + arg_3) not in arg_1.memory:\n                    logger.info(\"RANDOM: buf points to invalid address. Returning EFAULT\")\n                    return Decree.CGC_EFAULT\n\n                with open(\"/dev/urandom\", \"rb\") as f:\n                    arg_6 = f.read(arg_3)\n\n                arg_0.syscall_trace.append((\"_random\", -1, arg_6))\n                arg_1.write_bytes(arg_2, arg_6)\n\n        # TODO check 4 bytes from rx_bytes\n        if arg_4:\n            if arg_4 not in arg_1.memory:\n                logger.info(\"RANDOM: Not valid rnd_bytes. Returning EFAULT\")\n                return Decree.CGC_EFAULT\n            arg_1.write_int(arg_4, len(arg_6), 32)\n\n        logger.info(\"RANDOM(0x%08x, %d, 0x%08x) -> <%s>)\" % (arg_2, arg_3, arg_4, repr(arg_6[:10])))\n        return arg_5", "path": "manticore/platforms/decree.py", "identifier": "Decree.sys_random", "docstring": "random - fill a buffer with random data\n\n           The  random  system call populates the buffer referenced by buf with up to\n           count bytes of random data. If count is zero, random returns 0 and optionally\n           sets *rx_bytes to zero. If count is greater than SSIZE_MAX, the result is unspecified.\n\n           :param cpu: current CPU\n           :param buf: a memory buffer\n           :param count: max number of bytes to receive\n           :param rnd_bytes: if valid, points to the actual number of random bytes\n\n           :return:  0        On success\n                     EINVAL   count is invalid.\n                     EFAULT   buf or rnd_bytes points to an invalid address.", "docstring_tokens": ["random", "-", "fill", "a", "buffer", "with", "random", "data"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253011}
{"url": "https://github.com/disqus/django-mailviews/blob/9993d5e911d545b3bc038433986c5f6812e7e965/mailviews/previews.py#L38-L46", "sha": "9993d5e911d545b3bc038433986c5f6812e7e965", "docstring_summary": "Decodes an encoded 7-bit ASCII header value into it's actual value.", "language": "python", "parameters": "(header)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "decode_header", "(", "arg_0", ")", "[", "0", "]", "if", "arg_2", ":", "return", "arg_1", ".", "decode", "(", "arg_2", ")", "else", ":", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Decodes an encoded 7-bit ASCII header value into it's actual value.\n    \"\"\"\n    arg_1, arg_2 = decode_header(arg_0)[0]\n    if arg_2:\n        return arg_1.decode(arg_2)\n    else:\n        return arg_1", "path": "mailviews/previews.py", "identifier": "maybe_decode_header", "docstring": "Decodes an encoded 7-bit ASCII header value into it's actual value.", "docstring_tokens": ["Decodes", "an", "encoded", "7", "-", "bit", "ASCII", "header", "value", "into", "it", "s", "actual", "value", "."], "nwo": "disqus/django-mailviews", "score": 0.31736401397382547, "idx": 253012}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dag_processing.py#L213-L233", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Construct a TaskInstance from the database based on the primary key", "language": "python", "parameters": "(self, session=None, lock_for_update=False)", "return_statement": "return ti", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "airflow", ".", "models", ".", "TaskInstance", "arg_4", "=", "arg_1", ".", "query", "(", "arg_3", ")", ".", "filter", "(", "arg_3", ".", "dag_id", "==", "arg_0", ".", "_dag_id", ",", "arg_3", ".", "task_id", "==", "arg_0", ".", "_task_id", ",", "arg_3", ".", "execution_date", "==", "arg_0", ".", "_execution_date", ")", "if", "arg_2", ":", "arg_5", "=", "arg_4", ".", "with_for_update", "(", ")", ".", "first", "(", ")", "else", ":", "arg_5", "=", "arg_4", ".", "first", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"\n        Construct a TaskInstance from the database based on the primary key\n\n        :param session: DB session.\n        :param lock_for_update: if True, indicates that the database should\n            lock the TaskInstance (issuing a FOR UPDATE clause) until the\n            session is committed.\n        \"\"\"\n        arg_3 = airflow.models.TaskInstance\n\n        arg_4 = arg_1.query(arg_3).filter(\n            arg_3.dag_id == arg_0._dag_id,\n            arg_3.task_id == arg_0._task_id,\n            arg_3.execution_date == arg_0._execution_date)\n\n        if arg_2:\n            arg_5 = arg_4.with_for_update().first()\n        else:\n            arg_5 = arg_4.first()\n        return arg_5", "path": "airflow/utils/dag_processing.py", "identifier": "SimpleTaskInstance.construct_task_instance", "docstring": "Construct a TaskInstance from the database based on the primary key\n\n        :param session: DB session.\n        :param lock_for_update: if True, indicates that the database should\n            lock the TaskInstance (issuing a FOR UPDATE clause) until the\n            session is committed.", "docstring_tokens": ["Construct", "a", "TaskInstance", "from", "the", "database", "based", "on", "the", "primary", "key"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253013}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/lexicon.py#L72-L80", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Load a lexicon from a JSON file.", "language": "python", "parameters": "(cls, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'r'", ")", "as", "fp", ":", "return", "arg_0", "(", "json", ".", "load", "(", "fp", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Load a lexicon from a JSON file.\n\n        Args:\n            filename (str): The path to a JSON dump.\n        \"\"\"\n        with open(arg_1, 'r') as fp:\n            return arg_0(json.load(fp))", "path": "striplog/lexicon.py", "identifier": "Lexicon.from_json_file", "docstring": "Load a lexicon from a JSON file.\n\n        Args:\n            filename (str): The path to a JSON dump.", "docstring_tokens": ["Load", "a", "lexicon", "from", "a", "JSON", "file", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 253014}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1132-L1153", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Removes a NIC from the server.", "language": "python", "parameters": "(self, datacenter_id, server_id, nic_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/servers/%s/nics/%s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "method", "=", "'DELETE'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Removes a NIC from the server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      nic_id: The unique ID of the NIC.\n        :type       nic_id: ``str``\n\n        \"\"\"\n        arg_4 = arg_0._perform_request(\n            url='/datacenters/%s/servers/%s/nics/%s' % (\n                arg_1,\n                arg_2,\n                arg_3),\n            method='DELETE')\n\n        return arg_4", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.delete_nic", "docstring": "Removes a NIC from the server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      nic_id: The unique ID of the NIC.\n        :type       nic_id: ``str``", "docstring_tokens": ["Removes", "a", "NIC", "from", "the", "server", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 253015}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/metric_modify.py#L42-L67", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Add the specific arguments of this CLI", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "MetricCommon", ".", "Func", "(", "arg_0", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-n'", ",", "'--metric-name'", ",", "dest", "=", "'metricName'", ",", "action", "=", "'store'", ",", "required", "=", "True", ",", "metavar", "=", "'metric_name'", ",", "help", "=", "'Metric identifier'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-d'", ",", "'--display-name'", ",", "dest", "=", "'displayName'", ",", "action", "=", "'store'", ",", "required", "=", "True", ",", "metavar", "=", "'display_name'", ",", "help", "=", "'Metric display name'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-s'", ",", "'--display-name-short'", ",", "dest", "=", "'displayNameShort'", ",", "action", "=", "'store'", ",", "required", "=", "True", ",", "metavar", "=", "'display_short_name'", ",", "help", "=", "'Metric short display name'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-i'", ",", "'--description'", ",", "dest", "=", "'description'", ",", "action", "=", "'store'", ",", "required", "=", "not", "arg_0", ".", "update", ",", "metavar", "=", "'description'", ",", "help", "=", "'Metric description'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-g'", ",", "'--aggregate'", ",", "dest", "=", "'aggregate'", ",", "action", "=", "'store'", ",", "required", "=", "True", ",", "choices", "=", "[", "'avg'", ",", "'max'", ",", "'min'", ",", "'sum'", "]", ",", "help", "=", "'Metric default aggregate'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-u'", ",", "'--unit'", ",", "dest", "=", "'unit'", ",", "action", "=", "'store'", ",", "required", "=", "False", ",", "choices", "=", "[", "'percent'", ",", "'number'", ",", "'bytecount'", ",", "'duration'", "]", ",", "help", "=", "'Metric unit'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-r'", ",", "'--resolution'", ",", "dest", "=", "'resolution'", ",", "action", "=", "'store'", ",", "metavar", "=", "'resolution'", ",", "required", "=", "False", ",", "help", "=", "'Metric default resolution'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-y'", ",", "'--type'", ",", "dest", "=", "'type'", ",", "action", "=", "'store'", ",", "default", "=", "None", ",", "required", "=", "False", ",", "metavar", "=", "'type'", ",", "help", "=", "'Sets the type metadata field'", ")", "arg_0", ".", "parser", ".", "add_argument", "(", "'-x'", ",", "'--is-disabled'", ",", "dest", "=", "'isDisabled'", ",", "action", "=", "'store'", ",", "default", "=", "None", ",", "required", "=", "False", ",", "choices", "=", "[", "'true'", ",", "'false'", "]", ",", "help", "=", "'Enable or disable the metric definition'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Add the specific arguments of this CLI\n        \"\"\"\n        MetricCommon.Func(arg_0)\n        arg_0.parser.add_argument('-n', '--metric-name', dest='metricName', action='store',\n                                 required=True, metavar='metric_name', help='Metric identifier')\n        arg_0.parser.add_argument('-d', '--display-name', dest='displayName', action='store',\n                                 required=True, metavar='display_name', help='Metric display name')\n        arg_0.parser.add_argument('-s', '--display-name-short', dest='displayNameShort', action='store',\n                                 required=True, metavar='display_short_name', help='Metric short display name')\n        arg_0.parser.add_argument('-i', '--description', dest='description', action='store',\n                                 required=not arg_0.update, metavar='description', help='Metric description')\n        arg_0.parser.add_argument('-g', '--aggregate', dest='aggregate', action='store',\n                                 required=True, choices=['avg', 'max', 'min', 'sum'],\n                                 help='Metric default aggregate')\n        arg_0.parser.add_argument('-u', '--unit', dest='unit', action='store',\n                                 required=False, choices=['percent', 'number', 'bytecount', 'duration'],\n                                 help='Metric unit')\n        arg_0.parser.add_argument('-r', '--resolution', dest='resolution', action='store', metavar='resolution',\n                                 required=False, help='Metric default resolution')\n        arg_0.parser.add_argument('-y', '--type', dest='type', action='store', default=None,\n                                 required=False, metavar='type', help='Sets the type metadata field')\n        arg_0.parser.add_argument('-x', '--is-disabled', dest='isDisabled', action='store', default=None,\n                                 required=False,\n                                 choices=['true', 'false'], help='Enable or disable the metric definition')", "path": "boundary/metric_modify.py", "identifier": "MetricModify.add_arguments", "docstring": "Add the specific arguments of this CLI", "docstring_tokens": ["Add", "the", "specific", "arguments", "of", "this", "CLI"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 253016}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/data_processing.py#L149-L172", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "Custom loads function with an object_hook and automatic decoding", "language": "python", "parameters": "(json_data, encoding=\"utf-8\", **kwargs)", "return_statement": "return json.loads(json_data, object_hook=JSONData, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"utf-8\"", ",", "**", "arg_2", ")", ":", "if", "isinstance", "(", "arg_0", ",", "bytes", ")", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "arg_1", ")", "return", "json", ".", "Func", "(", "arg_0", ",", "object_hook", "=", "JSONData", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1=\"utf-8\", **arg_2):\n    \"\"\"\n        Custom Func function with an object_hook and automatic decoding\n\n    Parameters\n    ----------\n    json_data : str\n        The JSON data to decode\n    *args\n        Positional arguments, passed to :func:`json.Func`\n    encoding : :obj:`str`, optional\n        The encoding of the bytestring\n    **kwargs\n        Keyword arguments passed to :func:`json.Func`\n\n    Returns\n    -------\n    :obj:`dict` or :obj:`list`\n        Decoded json data\n    \"\"\"\n    if isinstance(arg_0, bytes):\n        arg_0 = arg_0.decode(arg_1)\n\n    return json.Func(arg_0, object_hook=JSONData, **arg_2)", "path": "peony/data_processing.py", "identifier": "loads", "docstring": "Custom loads function with an object_hook and automatic decoding\n\n    Parameters\n    ----------\n    json_data : str\n        The JSON data to decode\n    *args\n        Positional arguments, passed to :func:`json.loads`\n    encoding : :obj:`str`, optional\n        The encoding of the bytestring\n    **kwargs\n        Keyword arguments passed to :func:`json.loads`\n\n    Returns\n    -------\n    :obj:`dict` or :obj:`list`\n        Decoded json data", "docstring_tokens": ["Custom", "loads", "function", "with", "an", "object_hook", "and", "automatic", "decoding"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 253017}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/display.py#L71-L76", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Plotting wrapper for hierarchical segmentations", "language": "python", "parameters": "(annotation, **kwargs)", "return_statement": "return mir_eval.display.hierarchy(htimes, hlabels, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "Func_flatten", "(", "arg_0", ")", "arg_2", "=", "[", "np", ".", "asarray", "(", "_", ")", "for", "_", "in", "arg_2", "]", "return", "mir_eval", ".", "display", ".", "Func", "(", "arg_2", ",", "arg_3", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n    '''Plotting wrapper for hierarchical segmentations'''\n    arg_2, arg_3 = Func_flatten(arg_0)\n\n    arg_2 = [np.asarray(_) for _ in arg_2]\n    return mir_eval.display.Func(arg_2, arg_3, **arg_1)", "path": "jams/display.py", "identifier": "hierarchy", "docstring": "Plotting wrapper for hierarchical segmentations", "docstring_tokens": ["Plotting", "wrapper", "for", "hierarchical", "segmentations"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253018}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/imap_hook.py#L309-L316", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Gets the file including name and payload.", "language": "python", "parameters": "(self)", "return_statement": "return self.part.get_filename(), self.part.get_payload(decode=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "part", ".", "Funcname", "(", ")", ",", "arg_0", ".", "part", ".", "get_payload", "(", "decode", "=", "True", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Gets the file including name and payload.\n\n        :returns: the part's name and payload.\n        :rtype: tuple\n        \"\"\"\n        return arg_0.part.Funcname(), arg_0.part.get_payload(decode=True)", "path": "airflow/contrib/hooks/imap_hook.py", "identifier": "MailPart.get_file", "docstring": "Gets the file including name and payload.\n\n        :returns: the part's name and payload.\n        :rtype: tuple", "docstring_tokens": ["Gets", "the", "file", "including", "name", "and", "payload", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253019}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L742-L754", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Makes a subfolder for plots.", "language": "python", "parameters": "(self, traj)", "return_statement": "return print_folder", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_1", ".", "analysis", ".", "plot_folder", ",", "arg_1", ".", "v_name", ",", "arg_1", ".", "v_crun", ")", "arg_2", "=", "os", ".", "path", ".", "abspath", "(", "arg_2", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "os", ".", "makedirs", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Makes a subfolder for plots.\n\n        :return: Path name to print folder\n\n        \"\"\"\n        arg_2 = os.path.join(arg_1.analysis.plot_folder,\n                                    arg_1.v_name, arg_1.v_crun)\n        arg_2 = os.path.abspath(arg_2)\n        if not os.path.isdir(arg_2):\n            os.makedirs(arg_2)\n\n        return arg_2", "path": "examples/example_24_large_scale_brian2_simulation/clusternet.py", "identifier": "CNMonitorAnalysis._make_folder", "docstring": "Makes a subfolder for plots.\n\n        :return: Path name to print folder", "docstring_tokens": ["Makes", "a", "subfolder", "for", "plots", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253020}
{"url": "https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L136-L150", "sha": "7ef04938d80f8b646bd73d976ac9787a5b88edd9", "docstring_summary": "Helper to get optional details about const references", "language": "python", "parameters": "(const_index, const_list)", "return_statement": "return argval, repr(argval)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "if", "arg_1", "is", "not", "None", ":", "try", ":", "arg_2", "=", "arg_1", "[", "arg_0", "]", "except", "IndexError", ":", "raise", "ValidationError", "(", "\"Consts value out of range: {}\"", ".", "format", "(", "arg_0", ")", ")", "from", "None", "return", "arg_2", ",", "repr", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Helper to get optional details about const references\n\n       Returns the dereferenced constant and its repr if the constant\n       list is defined.\n       Otherwise returns the constant index and its repr().\n    \"\"\"\n    arg_2 = arg_0\n    if arg_1 is not None:\n        try:\n            arg_2 = arg_1[arg_0]\n        except IndexError:\n            raise ValidationError(\"Consts value out of range: {}\".format(arg_0)) from None\n    return arg_2, repr(arg_2)", "path": "pyte/util.py", "identifier": "_get_const_info", "docstring": "Helper to get optional details about const references\n\n       Returns the dereferenced constant and its repr if the constant\n       list is defined.\n       Otherwise returns the constant index and its repr().", "docstring_tokens": ["Helper", "to", "get", "optional", "details", "about", "const", "references"], "nwo": "Fuyukai/Pyte", "score": 0.3282631104312029, "idx": 253021}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L1496-L1509", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Update boost factors when local inhibition is used", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "numpy", ".", "zeros", "(", "arg_0", ".", "_numColumns", ",", "dtype", "=", "realDType", ")", "for", "arg_2", "in", "xrange", "(", "arg_0", ".", "_numColumns", ")", ":", "arg_3", "=", "arg_0", ".", "_getColumnNeighborhood", "(", "arg_2", ")", "arg_1", "[", "arg_2", "]", "=", "numpy", ".", "mean", "(", "arg_0", ".", "_activeDutyCycles", "[", "arg_3", "]", ")", "arg_0", ".", "_boostFactors", "=", "numpy", ".", "exp", "(", "(", "arg_1", "-", "arg_0", ".", "_activeDutyCycles", ")", "*", "arg_0", ".", "_boostStrength", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Update boost factors when local inhibition is used\n    \"\"\"\n    # Determine the target activation level for each column\n    # The targetDensity is the average activeDutyCycles of the neighboring\n    # columns of each column.\n    arg_1 = numpy.zeros(arg_0._numColumns, dtype=realDType)\n    for arg_2 in xrange(arg_0._numColumns):\n      arg_3 = arg_0._getColumnNeighborhood(arg_2)\n      arg_1[arg_2] = numpy.mean(arg_0._activeDutyCycles[arg_3])\n\n    arg_0._boostFactors = numpy.exp(\n      (arg_1 - arg_0._activeDutyCycles) * arg_0._boostStrength)", "path": "src/nupic/algorithms/spatial_pooler.py", "identifier": "SpatialPooler._updateBoostFactorsLocal", "docstring": "Update boost factors when local inhibition is used", "docstring_tokens": ["Update", "boost", "factors", "when", "local", "inhibition", "is", "used"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253022}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/transformed_distribution.py#L451-L465", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Finish computation of prob on one element of the inverse image.", "language": "python", "parameters": "(self, y, x, ildj, event_ndims,\n                                 **distribution_kwargs)", "return_statement": "return prob", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "**", "arg_5", ")", ":", "arg_2", "=", "arg_0", ".", "_maybe_rotate_dims", "(", "arg_2", ",", "rotate_right", "=", "True", ")", "arg_6", "=", "arg_0", ".", "distribution", ".", "prob", "(", "arg_2", ",", "**", "arg_5", ")", "if", "arg_0", ".", "_is_maybe_event_override", ":", "arg_6", "=", "tf", ".", "reduce_prod", "(", "input_tensor", "=", "arg_6", ",", "axis", "=", "arg_0", ".", "_reduce_event_indices", ")", "arg_6", "*=", "tf", ".", "exp", "(", "tf", ".", "cast", "(", "arg_3", ",", "arg_6", ".", "dtype", ")", ")", "if", "arg_0", ".", "_is_maybe_event_override", "and", "isinstance", "(", "arg_4", ",", "int", ")", ":", "tensorshape_util", ".", "set_shape", "(", "arg_6", ",", "tf", ".", "broadcast_static_shape", "(", "tensorshape_util", ".", "with_rank_at_least", "(", "arg_1", ".", "shape", ",", "1", ")", "[", ":", "-", "arg_4", "]", ",", "arg_0", ".", "batch_shape", ")", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                                 **arg_5):\n    \"\"\"Finish computation of prob on one element of the inverse image.\"\"\"\n    arg_2 = arg_0._maybe_rotate_dims(arg_2, rotate_right=True)\n    arg_6 = arg_0.distribution.prob(arg_2, **arg_5)\n    if arg_0._is_maybe_event_override:\n      arg_6 = tf.reduce_prod(input_tensor=arg_6, axis=arg_0._reduce_event_indices)\n    arg_6 *= tf.exp(tf.cast(arg_3, arg_6.dtype))\n    if arg_0._is_maybe_event_override and isinstance(arg_4, int):\n      tensorshape_util.set_shape(\n          arg_6,\n          tf.broadcast_static_shape(\n              tensorshape_util.with_rank_at_least(arg_1.shape, 1)[:-arg_4],\n              arg_0.batch_shape))\n    return arg_6", "path": "tensorflow_probability/python/distributions/transformed_distribution.py", "identifier": "TransformedDistribution._finish_prob_for_one_fiber", "docstring": "Finish computation of prob on one element of the inverse image.", "docstring_tokens": ["Finish", "computation", "of", "prob", "on", "one", "element", "of", "the", "inverse", "image", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253023}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/vpc.py#L114-L122", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Gets the VPC Network ACLs", "language": "python", "parameters": "(vpc, **conn)", "return_statement": "return nacl_ids", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "describe_network_acls", "(", "Filters", "=", "[", "{", "\"Name\"", ":", "\"vpc-id\"", ",", "\"Values\"", ":", "[", "arg_0", "[", "\"id\"", "]", "]", "}", "]", ",", "**", "arg_1", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "arg_3", ".", "append", "(", "arg_4", "[", "\"NetworkAclId\"", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Gets the VPC Network ACLs\"\"\"\n    arg_2 = describe_network_acls(Filters=[{\"Name\": \"vpc-id\", \"Values\": [arg_0[\"id\"]]}], **arg_1)\n\n    arg_3 = []\n    for arg_4 in arg_2:\n        arg_3.append(arg_4[\"NetworkAclId\"])\n\n    return arg_3", "path": "cloudaux/orchestration/aws/vpc.py", "identifier": "get_network_acls", "docstring": "Gets the VPC Network ACLs", "docstring_tokens": ["Gets", "the", "VPC", "Network", "ACLs"], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 253024}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/bolt_instance.py#L161-L173", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Should be called when tuple was buffered into in_stream", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "output_helper", ".", "is_out_queue_available", "(", ")", ":", "arg_0", ".", "_read_tuples_and_execute", "(", ")", "arg_0", ".", "output_helper", ".", "send_out_tuples", "(", ")", "else", ":", "arg_0", ".", "bolt_metrics", ".", "update_out_queue_full_count", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Should be called when tuple was buffered into in_stream\n\n    This method is equivalent to ``addBoltTasks()`` but\n    is designed for event-driven single-thread bolt.\n    \"\"\"\n    # back-pressure\n    if arg_0.output_helper.is_out_queue_available():\n      arg_0._read_tuples_and_execute()\n      arg_0.output_helper.send_out_tuples()\n    else:\n      # update outqueue full count\n      arg_0.bolt_metrics.update_out_queue_full_count()", "path": "heron/instance/src/python/basics/bolt_instance.py", "identifier": "BoltInstance.process_incoming_tuples", "docstring": "Should be called when tuple was buffered into in_stream\n\n    This method is equivalent to ``addBoltTasks()`` but\n    is designed for event-driven single-thread bolt.", "docstring_tokens": ["Should", "be", "called", "when", "tuple", "was", "buffered", "into", "in_stream"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253025}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/telegram.py#L216-L230", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a Telegram JSON messages list.", "language": "python", "parameters": "(raw_json)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_0", ")", "arg_2", "=", "arg_1", "[", "'result'", "]", "for", "arg_3", "in", "arg_2", ":", "yield", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Parse a Telegram JSON messages list.\n\n        The method parses the JSON stream and returns an iterator of\n        dictionaries. Each one of this, contains a Telegram message.\n\n        :param raw_json: JSON string to parse\n\n        :returns: a generator of parsed messages\n        \"\"\"\n        arg_1 = json.loads(arg_0)\n\n        arg_2 = arg_1['result']\n        for arg_3 in arg_2:\n            yield arg_3", "path": "perceval/backends/core/telegram.py", "identifier": "Telegram.parse_messages", "docstring": "Parse a Telegram JSON messages list.\n\n        The method parses the JSON stream and returns an iterator of\n        dictionaries. Each one of this, contains a Telegram message.\n\n        :param raw_json: JSON string to parse\n\n        :returns: a generator of parsed messages", "docstring_tokens": ["Parse", "a", "Telegram", "JSON", "messages", "list", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253026}
{"url": "https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L304-L340", "sha": "3dc6ad803f0b0d56586dec9542a6a06aa06cf569", "docstring_summary": "Partition the network between containers", "language": "python", "parameters": "(opts)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "load_config", "(", "arg_0", ".", "config", ")", "arg_2", "=", "get_blockade", "(", "arg_1", ",", "arg_0", ")", "if", "arg_0", ".", "random", ":", "if", "arg_0", ".", "partitions", ":", "raise", "BlockadeError", "(", "\"Either specify individual partitions \"", "\"or --random, but not both\"", ")", "arg_2", ".", "random_partition", "(", ")", "else", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "partitions", ":", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_4", ".", "split", "(", "\",\"", ")", ":", "arg_6", "=", "arg_6", ".", "strip", "(", ")", "if", "arg_6", ":", "arg_5", ".", "append", "(", "arg_6", ")", "arg_3", ".", "append", "(", "arg_5", ")", "if", "not", "arg_3", ":", "raise", "BlockadeError", "(", "\"Either specify individual partitions \"", "\"or random\"", ")", "arg_2", ".", "partition", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Partition the network between containers\n\n    Replaces any existing partitions outright. Any containers NOT specified\n    in arguments will be globbed into a single implicit partition. For\n    example if you have three containers: c1, c2, and c3 and you run:\n\n        blockade partition c1\n\n    The result will be a partition with just c1 and another partition with\n    c2 and c3.\n\n    Alternatively, --random may be specified, and zero or more random\n    partitions will be generated by blockade.\n    \"\"\"\n    arg_1 = load_config(arg_0.config)\n    arg_2 = get_blockade(arg_1, arg_0)\n\n    if arg_0.random:\n        if arg_0.partitions:\n            raise BlockadeError(\"Either specify individual partitions \"\n                                \"or --random, but not both\")\n        arg_2.random_partition()\n\n    else:\n        arg_3 = []\n        for arg_4 in arg_0.partitions:\n            arg_5 = []\n            for arg_6 in arg_4.split(\",\"):\n                arg_6 = arg_6.strip()\n                if arg_6:\n                    arg_5.append(arg_6)\n            arg_3.append(arg_5)\n        if not arg_3:\n            raise BlockadeError(\"Either specify individual partitions \"\n                                \"or random\")\n        arg_2.partition(arg_3)", "path": "blockade/cli.py", "identifier": "cmd_partition", "docstring": "Partition the network between containers\n\n    Replaces any existing partitions outright. Any containers NOT specified\n    in arguments will be globbed into a single implicit partition. For\n    example if you have three containers: c1, c2, and c3 and you run:\n\n        blockade partition c1\n\n    The result will be a partition with just c1 and another partition with\n    c2 and c3.\n\n    Alternatively, --random may be specified, and zero or more random\n    partitions will be generated by blockade.", "docstring_tokens": ["Partition", "the", "network", "between", "containers"], "nwo": "worstcase/blockade", "score": 0.7770804820985606, "idx": 253027}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L537-L553", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Private swap function used by `get_or_create` to atomically swap\n        the new namespace map into the global cache.", "language": "python", "parameters": "(\n        ns_cache: NamespaceMap,\n        name: sym.Symbol,\n        module: types.ModuleType = None,\n        core_ns_name=CORE_NS,\n    )", "return_statement": "return ns_cache.assoc(name, new_ns)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ".", "Symbol", ",", "arg_5", ":", "arg_6", ".", "ModuleType", "=", "None", ",", "arg_8", "=", "arg_9", ",", ")", "->", "lmap", ".", "Map", ":", "arg_10", "=", "arg_0", ".", "entry", "(", "arg_2", ",", "None", ")", "if", "arg_10", "is", "not", "None", ":", "return", "arg_0", "arg_11", "=", "Namespace", "(", "arg_2", ",", "arg_5", "=", "arg_5", ")", "if", "arg_2", ".", "name", "!=", "arg_8", ":", "arg_12", "=", "arg_0", ".", "entry", "(", "arg_3", ".", "symbol", "(", "arg_8", ")", ",", "None", ")", "assert", "arg_12", "is", "not", "None", ",", "\"Core namespace not loaded yet!\"", "arg_11", ".", "refer_all", "(", "arg_12", ")", "return", "arg_0", ".", "assoc", "(", "arg_2", ",", "arg_11", ")"], "function": "def Func(\n        arg_0: arg_1,\n        arg_2: arg_3.Symbol,\n        arg_5: arg_6.ModuleType = None,\n        arg_8=arg_9,\n    ) -> lmap.Map:\n        \"\"\"Private swap function used by `get_or_create` to atomically swap\n        the new namespace map into the global cache.\"\"\"\n        arg_10 = arg_0.entry(arg_2, None)\n        if arg_10 is not None:\n            return arg_0\n        arg_11 = Namespace(arg_2, arg_5=arg_5)\n        if arg_2.name != arg_8:\n            arg_12 = arg_0.entry(arg_3.symbol(arg_8), None)\n            assert arg_12 is not None, \"Core namespace not loaded yet!\"\n            arg_11.refer_all(arg_12)\n        return arg_0.assoc(arg_2, arg_11)", "path": "src/basilisp/lang/runtime.py", "identifier": "Namespace.__get_or_create", "docstring": "Private swap function used by `get_or_create` to atomically swap\n        the new namespace map into the global cache.", "docstring_tokens": ["Private", "swap", "function", "used", "by", "get_or_create", "to", "atomically", "swap", "the", "new", "namespace", "map", "into", "the", "global", "cache", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 253028}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/base.py#L209-L282", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Reads the features from a file and stores them in the current\n        object.", "language": "python", "parameters": "(self, tol=1e-3)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1e-3", ")", ":", "try", ":", "with", "open", "(", "arg_0", ".", "file_struct", ".", "features_file", ")", "as", "f", ":", "arg_2", "=", "json", ".", "load", "(", "f", ")", "if", "arg_0", ".", "dur", "is", "None", ":", "arg_0", ".", "dur", "=", "float", "(", "arg_2", "[", "\"globals\"", "]", "[", "\"dur\"", "]", ")", "assert", "(", "np", ".", "isclose", "(", "arg_0", ".", "dur", ",", "float", "(", "arg_2", "[", "\"globals\"", "]", "[", "\"dur\"", "]", ")", ",", "rtol", "=", "arg_1", ")", ")", "assert", "(", "arg_0", ".", "sr", "==", "int", "(", "arg_2", "[", "\"globals\"", "]", "[", "\"sample_rate\"", "]", ")", ")", "assert", "(", "arg_0", ".", "hop_length", "==", "int", "(", "arg_2", "[", "\"globals\"", "]", "[", "\"hop_length\"", "]", ")", ")", "assert", "(", "os", ".", "path", ".", "basename", "(", "arg_0", ".", "file_struct", ".", "audio_file", ")", "==", "os", ".", "path", ".", "basename", "(", "arg_2", "[", "\"globals\"", "]", "[", "\"audio_file\"", "]", ")", ")", "arg_4", "=", "FeatureParamsError", "(", "\"Couldn't find features for %s id in file %s\"", "%", "(", "arg_0", ".", "get_id", "(", ")", ",", "arg_0", ".", "file_struct", ".", "features_file", ")", ")", "if", "arg_0", ".", "get_id", "(", ")", "not", "in", "arg_2", ".", "keys", "(", ")", ":", "raise", "arg_4", "for", "arg_5", "in", "arg_0", ".", "get_param_names", "(", ")", ":", "arg_6", "=", "getattr", "(", "arg_0", ",", "arg_5", ")", "if", "hasattr", "(", "arg_6", ",", "'__call__'", ")", ":", "if", "arg_6", ".", "__name__", "!=", "arg_2", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"params\"", "]", "[", "arg_5", "]", ":", "raise", "arg_4", "else", ":", "if", "str", "(", "arg_6", ")", "!=", "arg_2", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"params\"", "]", "[", "arg_5", "]", ":", "raise", "arg_4", "arg_0", ".", "_est_beats_times", "=", "np", ".", "array", "(", "arg_2", "[", "\"est_beats\"", "]", ")", "arg_0", ".", "_est_beatsync_times", "=", "np", ".", "array", "(", "arg_2", "[", "\"est_beatsync_times\"", "]", ")", "arg_0", ".", "_est_beats_frames", "=", "librosa", ".", "core", ".", "time_to_frames", "(", "arg_0", ".", "_est_beats_times", ",", "sr", "=", "arg_0", ".", "sr", ",", "hop_length", "=", "arg_0", ".", "hop_length", ")", "arg_0", ".", "_framesync_features", "=", "np", ".", "array", "(", "arg_2", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"framesync\"", "]", ")", "arg_0", ".", "_est_beatsync_features", "=", "np", ".", "array", "(", "arg_2", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"est_beatsync\"", "]", ")", "if", "\"ann_beats\"", "in", "arg_2", ".", "keys", "(", ")", ":", "arg_0", ".", "_ann_beats_times", "=", "np", ".", "array", "(", "arg_2", "[", "\"ann_beats\"", "]", ")", "arg_0", ".", "_ann_beatsync_times", "=", "np", ".", "array", "(", "arg_2", "[", "\"ann_beatsync_times\"", "]", ")", "arg_0", ".", "_ann_beats_frames", "=", "librosa", ".", "core", ".", "time_to_frames", "(", "arg_0", ".", "_ann_beats_times", ",", "sr", "=", "arg_0", ".", "sr", ",", "hop_length", "=", "arg_0", ".", "hop_length", ")", "arg_0", ".", "_ann_beatsync_features", "=", "np", ".", "array", "(", "arg_2", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"ann_beatsync\"", "]", ")", "except", "KeyError", ":", "raise", "WrongFeaturesFormatError", "(", "\"The features file %s is not correctly formatted\"", "%", "arg_0", ".", "file_struct", ".", "features_file", ")", "except", "AssertionError", ":", "raise", "FeaturesNotFound", "(", "\"The features for the given parameters were not found in \"", "\"features file %s\"", "%", "arg_0", ".", "file_struct", ".", "features_file", ")", "except", "IOError", ":", "raise", "NoFeaturesFileError", "(", "\"Could not find features file %s\"", ",", "arg_0", ".", "file_struct", ".", "features_file", ")"], "function": "def Func(arg_0, arg_1=1e-3):\n        \"\"\"Reads the features from a file and stores them in the current\n        object.\n\n        Parameters\n        ----------\n        tol: float\n            Tolerance level to detect duration of audio.\n        \"\"\"\n        try:\n            # Read JSON file\n            with open(arg_0.file_struct.features_file) as f:\n                arg_2 = json.load(f)\n\n            # Store duration\n            if arg_0.dur is None:\n                arg_0.dur = float(arg_2[\"globals\"][\"dur\"])\n\n            # Check that we have the correct global parameters\n            assert(np.isclose(\n                arg_0.dur, float(arg_2[\"globals\"][\"dur\"]), rtol=arg_1))\n            assert(arg_0.sr == int(arg_2[\"globals\"][\"sample_rate\"]))\n            assert(arg_0.hop_length == int(arg_2[\"globals\"][\"hop_length\"]))\n            assert(os.path.basename(arg_0.file_struct.audio_file) ==\n                   os.path.basename(arg_2[\"globals\"][\"audio_file\"]))\n\n            # Check for specific features params\n            arg_4 = FeatureParamsError(\n                \"Couldn't find features for %s id in file %s\" %\n                (arg_0.get_id(), arg_0.file_struct.features_file))\n            if arg_0.get_id() not in arg_2.keys():\n                raise arg_4\n            for arg_5 in arg_0.get_param_names():\n                arg_6 = getattr(arg_0, arg_5)\n                if hasattr(arg_6, '__call__'):\n                    # Special case of functions\n                    if arg_6.__name__ != \\\n                            arg_2[arg_0.get_id()][\"params\"][arg_5]:\n                        raise arg_4\n                else:\n                    if str(arg_6) != \\\n                            arg_2[arg_0.get_id()][\"params\"][arg_5]:\n                        raise arg_4\n\n            # Store actual features\n            arg_0._est_beats_times = np.array(arg_2[\"est_beats\"])\n            arg_0._est_beatsync_times = np.array(arg_2[\"est_beatsync_times\"])\n            arg_0._est_beats_frames = librosa.core.time_to_frames(\n                arg_0._est_beats_times, sr=arg_0.sr, hop_length=arg_0.hop_length)\n            arg_0._framesync_features = \\\n                np.array(arg_2[arg_0.get_id()][\"framesync\"])\n            arg_0._est_beatsync_features = \\\n                np.array(arg_2[arg_0.get_id()][\"est_beatsync\"])\n\n            # Read annotated beats if available\n            if \"ann_beats\" in arg_2.keys():\n                arg_0._ann_beats_times = np.array(arg_2[\"ann_beats\"])\n                arg_0._ann_beatsync_times = np.array(arg_2[\"ann_beatsync_times\"])\n                arg_0._ann_beats_frames = librosa.core.time_to_frames(\n                    arg_0._ann_beats_times, sr=arg_0.sr,\n                    hop_length=arg_0.hop_length)\n                arg_0._ann_beatsync_features = \\\n                    np.array(arg_2[arg_0.get_id()][\"ann_beatsync\"])\n        except KeyError:\n            raise WrongFeaturesFormatError(\n                \"The features file %s is not correctly formatted\" %\n                arg_0.file_struct.features_file)\n        except AssertionError:\n            raise FeaturesNotFound(\n                \"The features for the given parameters were not found in \"\n                \"features file %s\" % arg_0.file_struct.features_file)\n        except IOError:\n            raise NoFeaturesFileError(\"Could not find features file %s\",\n                                      arg_0.file_struct.features_file)", "path": "msaf/base.py", "identifier": "Features.read_features", "docstring": "Reads the features from a file and stores them in the current\n        object.\n\n        Parameters\n        ----------\n        tol: float\n            Tolerance level to detect duration of audio.", "docstring_tokens": ["Reads", "the", "features", "from", "a", "file", "and", "stores", "them", "in", "the", "current", "object", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 253029}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/examples/print_packageable_elements.py#L34-L39", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "A System Model contains top-level packages", "language": "python", "parameters": "(self, inst)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "many", "(", "arg_1", ")", ".", "EP_PKG", "[", "1401", "]", "(", ")", ":", "arg_0", ".", "accept", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        A System Model contains top-level packages\n        '''\n        for arg_2 in many(arg_1).EP_PKG[1401]():\n            arg_0.accept(arg_2)", "path": "examples/print_packageable_elements.py", "identifier": "MyWalker.accept_S_SYS", "docstring": "A System Model contains top-level packages", "docstring_tokens": ["A", "System", "Model", "contains", "top", "-", "level", "packages"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 253030}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L244-L249", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Schedule playing something on a call Helper", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/SchedulePlay/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Schedule playing something on a call Helper\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/SchedulePlay/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.schedule_play", "docstring": "REST Schedule playing something on a call Helper", "docstring_tokens": ["REST", "Schedule", "playing", "something", "on", "a", "call", "Helper"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 253031}
{"url": "https://github.com/jupyter-widgets/jupyterlab-sidecar/blob/8889d09f1a0933e2cbee06d4874f720b075b29e8/setupbase.py#L89-L104", "sha": "8889d09f1a0933e2cbee06d4874f720b075b29e8", "docstring_summary": "Given a list of range specifiers for python, ensure compatibility.", "language": "python", "parameters": "(specs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_0", "=", "[", "arg_0", "]", "arg_1", "=", "sys", ".", "version_info", "arg_2", "=", "'%s.%s'", "%", "(", "arg_1", ".", "major", ",", "arg_1", ".", "minor", ")", "for", "arg_3", "in", "arg_0", ":", "if", "arg_2", "==", "arg_3", ":", "return", "try", ":", "if", "eval", "(", "arg_2", "+", "arg_3", ")", ":", "return", "except", "SyntaxError", ":", "pass", "raise", "ValueError", "(", "'Python version %s unsupported'", "%", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Given a list of range specifiers for python, ensure compatibility.\n    \"\"\"\n    if not isinstance(arg_0, (list, tuple)):\n        arg_0 = [arg_0]\n    arg_1 = sys.version_info\n    arg_2 = '%s.%s' % (arg_1.major, arg_1.minor)\n    for arg_3 in arg_0:\n        if arg_2 == arg_3:\n            return\n        try:\n            if eval(arg_2 + arg_3):\n                return\n        except SyntaxError:\n            pass\n    raise ValueError('Python version %s unsupported' % arg_2)", "path": "setupbase.py", "identifier": "ensure_python", "docstring": "Given a list of range specifiers for python, ensure compatibility.", "docstring_tokens": ["Given", "a", "list", "of", "range", "specifiers", "for", "python", "ensure", "compatibility", "."], "nwo": "jupyter-widgets/jupyterlab-sidecar", "score": 0.6376222650402201, "idx": 253032}
{"url": "https://github.com/nadirizr/json-logic-py/blob/5fda9125eab4178f8f81c7779291940e31e87bab/json_logic/__init__.py#L59-L63", "sha": "5fda9125eab4178f8f81c7779291940e31e87bab", "docstring_summary": "Implements the '<=' operator with JS-style type coertion.", "language": "python", "parameters": "(a, b, *args)", "return_statement": "return (\n        less(a, b) or soft_equals(a, b)\n    ) and (not args or less_or_equal(b, *args))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "return", "(", "less", "(", "arg_0", ",", "arg_1", ")", "or", "soft_equals", "(", "arg_0", ",", "arg_1", ")", ")", "and", "(", "not", "arg_2", "or", "Func", "(", "arg_1", ",", "*", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, *arg_2):\n    \"\"\"Implements the '<=' operator with JS-style type coertion.\"\"\"\n    return (\n        less(arg_0, arg_1) or soft_equals(arg_0, arg_1)\n    ) and (not arg_2 or Func(arg_1, *arg_2))", "path": "json_logic/__init__.py", "identifier": "less_or_equal", "docstring": "Implements the '<=' operator with JS-style type coertion.", "docstring_tokens": ["Implements", "the", "<", "=", "operator", "with", "JS", "-", "style", "type", "coertion", "."], "nwo": "nadirizr/json-logic-py", "score": 0.377741818547489, "idx": 253033}
{"url": "https://github.com/Jaza/s3-saver/blob/81dc4447d76c2fc0b0238fb96fa70e879612e355/s3_saver.py#L128-L153", "sha": "81dc4447d76c2fc0b0238fb96fa70e879612e355", "docstring_summary": "Saves the specified file to either S3 or the local filesystem, depending on the currently enabled storage type.", "language": "python", "parameters": "(self, temp_file, filename, obj)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "(", "arg_0", ".", "storage_type", "and", "arg_0", ".", "bucket_name", ")", ":", "arg_4", "=", "arg_0", ".", "_Func_local", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "else", ":", "if", "arg_0", ".", "storage_type", "!=", "'s3'", ":", "raise", "ValueError", "(", "'Storage type \"%s\" is invalid, the only supported storage type (apart from default local storage) is s3.'", "%", "arg_0", ".", "storage_type", ")", "arg_4", "=", "arg_0", ".", "_Func_s3", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", ".", "field_name", ":", "setattr", "(", "arg_3", ",", "arg_0", ".", "field_name", ",", "arg_4", ")", "if", "arg_0", ".", "storage_type", "==", "'s3'", ":", "if", "arg_0", ".", "storage_type_field", ":", "setattr", "(", "arg_3", ",", "arg_0", ".", "storage_type_field", ",", "arg_0", ".", "storage_type", ")", "if", "arg_0", ".", "bucket_name_field", ":", "setattr", "(", "arg_3", ",", "arg_0", ".", "bucket_name_field", ",", "arg_0", ".", "bucket_name", ")", "else", ":", "if", "arg_0", ".", "storage_type_field", ":", "setattr", "(", "arg_3", ",", "arg_0", ".", "storage_type_field", ",", "''", ")", "if", "arg_0", ".", "bucket_name_field", ":", "setattr", "(", "arg_3", ",", "arg_0", ".", "bucket_name_field", ",", "''", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Saves the specified file to either S3 or the local filesystem, depending on the currently enabled storage type.\"\"\"\n\n        if not (arg_0.storage_type and arg_0.bucket_name):\n            arg_4 = arg_0._Func_local(arg_1, arg_2, arg_3)\n        else:\n            if arg_0.storage_type != 's3':\n                raise ValueError('Storage type \"%s\" is invalid, the only supported storage type (apart from default local storage) is s3.' % arg_0.storage_type)\n\n            arg_4 = arg_0._Func_s3(arg_1, arg_2, arg_3)\n\n        if arg_0.field_name:\n            setattr(arg_3, arg_0.field_name, arg_4)\n\n        if arg_0.storage_type == 's3':\n            if arg_0.storage_type_field:\n                setattr(arg_3, arg_0.storage_type_field, arg_0.storage_type)\n            if arg_0.bucket_name_field:\n                setattr(arg_3, arg_0.bucket_name_field, arg_0.bucket_name)\n        else:\n            if arg_0.storage_type_field:\n                setattr(arg_3, arg_0.storage_type_field, '')\n            if arg_0.bucket_name_field:\n                setattr(arg_3, arg_0.bucket_name_field, '')\n\n        return arg_4", "path": "s3_saver.py", "identifier": "S3Saver.save", "docstring": "Saves the specified file to either S3 or the local filesystem, depending on the currently enabled storage type.", "docstring_tokens": ["Saves", "the", "specified", "file", "to", "either", "S3", "or", "the", "local", "filesystem", "depending", "on", "the", "currently", "enabled", "storage", "type", "."], "nwo": "Jaza/s3-saver", "score": 0.17697123869542528, "idx": 253034}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L57-L119", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "The trace function passed to sys.settrace.", "language": "python", "parameters": "(self, frame, event, arg_unused)", "return_statement": "return self._trace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ".", "stopped", ":", "return", "if", "0", ":", "sys", ".", "stderr", ".", "write", "(", "\"trace event: %s %r @%d\\n\"", "%", "(", "arg_2", ",", "arg_1", ".", "f_code", ".", "co_filename", ",", "arg_1", ".", "f_lineno", ")", ")", "if", "arg_0", ".", "last_exc_back", ":", "if", "arg_1", "==", "arg_0", ".", "last_exc_back", ":", "if", "arg_0", ".", "arcs", "and", "arg_0", ".", "cur_file_data", ":", "arg_4", "=", "(", "arg_0", ".", "last_line", ",", "-", "arg_0", ".", "last_exc_firstlineno", ")", "arg_0", ".", "cur_file_data", "[", "arg_4", "]", "=", "None", "arg_0", ".", "cur_file_data", ",", "arg_0", ".", "last_line", "=", "arg_0", ".", "data_stack", ".", "pop", "(", ")", "arg_0", ".", "last_exc_back", "=", "None", "if", "arg_2", "==", "'call'", ":", "arg_0", ".", "data_stack", ".", "append", "(", "(", "arg_0", ".", "cur_file_data", ",", "arg_0", ".", "last_line", ")", ")", "arg_8", "=", "arg_1", ".", "f_code", ".", "co_filename", "if", "arg_8", "not", "in", "arg_0", ".", "shouldFunc_cache", ":", "arg_9", "=", "arg_0", ".", "shouldFunc", "(", "arg_8", ",", "arg_1", ")", "arg_0", ".", "shouldFunc_cache", "[", "arg_8", "]", "=", "arg_9", "else", ":", "arg_9", "=", "arg_0", ".", "shouldFunc_cache", "[", "arg_8", "]", "if", "arg_9", ":", "if", "arg_9", "not", "in", "arg_0", ".", "data", ":", "arg_0", ".", "data", "[", "arg_9", "]", "=", "{", "}", "arg_0", ".", "cur_file_data", "=", "arg_0", ".", "data", "[", "arg_9", "]", "else", ":", "arg_0", ".", "cur_file_data", "=", "None", "arg_0", ".", "last_line", "=", "-", "1", "elif", "arg_2", "==", "'line'", ":", "if", "arg_0", ".", "cur_file_data", "is", "not", "None", ":", "if", "arg_0", ".", "arcs", ":", "arg_0", ".", "cur_file_data", "[", "(", "arg_0", ".", "last_line", ",", "arg_1", ".", "f_lineno", ")", "]", "=", "None", "else", ":", "arg_0", ".", "cur_file_data", "[", "arg_1", ".", "f_lineno", "]", "=", "None", "arg_0", ".", "last_line", "=", "arg_1", ".", "f_lineno", "elif", "arg_2", "==", "'return'", ":", "if", "arg_0", ".", "arcs", "and", "arg_0", ".", "cur_file_data", ":", "arg_13", "=", "arg_1", ".", "f_code", ".", "co_firstlineno", "arg_0", ".", "cur_file_data", "[", "(", "arg_0", ".", "last_line", ",", "-", "arg_13", ")", "]", "=", "None", "arg_0", ".", "cur_file_data", ",", "arg_0", ".", "last_line", "=", "arg_0", ".", "data_stack", ".", "pop", "(", ")", "elif", "arg_2", "==", "'exception'", ":", "arg_0", ".", "last_exc_back", "=", "arg_1", ".", "f_back", "arg_0", ".", "last_exc_firstlineno", "=", "arg_1", ".", "f_code", ".", "co_firstlineno", "return", "arg_0", ".", "Func"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"The trace function passed to sys.settrace.\"\"\"\n\n        if arg_0.stopped:\n            return\n\n        if 0:\n            sys.stderr.write(\"trace event: %s %r @%d\\n\" % (\n                arg_2, arg_1.f_code.co_filename, arg_1.f_lineno\n            ))\n\n        if arg_0.last_exc_back:\n            if arg_1 == arg_0.last_exc_back:\n                # Someone forgot a return event.\n                if arg_0.arcs and arg_0.cur_file_data:\n                    arg_4 = (arg_0.last_line, -arg_0.last_exc_firstlineno)\n                    arg_0.cur_file_data[arg_4] = None\n                arg_0.cur_file_data, arg_0.last_line = arg_0.data_stack.pop()\n            arg_0.last_exc_back = None\n\n        if arg_2 == 'call':\n            # Entering a new function context.  Decide if we should trace\n            # in this file.\n            arg_0.data_stack.append((arg_0.cur_file_data, arg_0.last_line))\n            arg_8 = arg_1.f_code.co_filename\n            if arg_8 not in arg_0.shouldFunc_cache:\n                arg_9 = arg_0.shouldFunc(arg_8, arg_1)\n                arg_0.shouldFunc_cache[arg_8] = arg_9\n            else:\n                arg_9 = arg_0.shouldFunc_cache[arg_8]\n            #print(\"called, stack is %d deep, tracename is %r\" % (\n            #               len(self.data_stack), tracename))\n            if arg_9:\n                if arg_9 not in arg_0.data:\n                    arg_0.data[arg_9] = {}\n                arg_0.cur_file_data = arg_0.data[arg_9]\n            else:\n                arg_0.cur_file_data = None\n            # Set the last_line to -1 because the next arc will be entering a\n            # code block, indicated by (-1, n).\n            arg_0.last_line = -1\n        elif arg_2 == 'line':\n            # Record an executed line.\n            if arg_0.cur_file_data is not None:\n                if arg_0.arcs:\n                    #print(\"lin\", self.last_line, frame.f_lineno)\n                    arg_0.cur_file_data[(arg_0.last_line, arg_1.f_lineno)] = None\n                else:\n                    #print(\"lin\", frame.f_lineno)\n                    arg_0.cur_file_data[arg_1.f_lineno] = None\n            arg_0.last_line = arg_1.f_lineno\n        elif arg_2 == 'return':\n            if arg_0.arcs and arg_0.cur_file_data:\n                arg_13 = arg_1.f_code.co_firstlineno\n                arg_0.cur_file_data[(arg_0.last_line, -arg_13)] = None\n            # Leaving this function, pop the filename stack.\n            arg_0.cur_file_data, arg_0.last_line = arg_0.data_stack.pop()\n            #print(\"returned, stack is %d deep\" % (len(self.data_stack)))\n        elif arg_2 == 'exception':\n            #print(\"exc\", self.last_line, frame.f_lineno)\n            arg_0.last_exc_back = arg_1.f_back\n            arg_0.last_exc_firstlineno = arg_1.f_code.co_firstlineno\n        return arg_0.Func", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py", "identifier": "PyTracer._trace", "docstring": "The trace function passed to sys.settrace.", "docstring_tokens": ["The", "trace", "function", "passed", "to", "sys", ".", "settrace", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253035}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/extensions/sympyprinting.py#L54-L64", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "A function to display sympy expression using inline style LaTeX in PNG.", "language": "python", "parameters": "(o)", "return_statement": "return png", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "latex", "(", "arg_0", ",", "mode", "=", "'inline'", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "'\\\\operatorname'", ",", "''", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "'\\\\overline'", ",", "'\\\\bar'", ")", "arg_2", "=", "latex_to_png", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    A function to display sympy expression using inline style LaTeX in PNG.\n    \"\"\"\n    arg_1 = latex(arg_0, mode='inline')\n    # mathtext does not understand certain latex flags, so we try to replace\n    # them with suitable subs.\n    arg_1 = arg_1.replace('\\\\operatorname','')\n    arg_1 = arg_1.replace('\\\\overline', '\\\\bar')\n    arg_2 = latex_to_png(arg_1)\n    return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/extensions/sympyprinting.py", "identifier": "print_png", "docstring": "A function to display sympy expression using inline style LaTeX in PNG.", "docstring_tokens": ["A", "function", "to", "display", "sympy", "expression", "using", "inline", "style", "LaTeX", "in", "PNG", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253036}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/query.py#L648-L675", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "This will execute the query, returning the key where a ZSET of your\n        results will be stored for pagination, further operations, etc.", "language": "python", "parameters": "(self, timeout)", "return_statement": "return self._model._gindex.search(\n            _connect(self._model), self._filters, self._order_by, timeout=timeout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "(", "arg_0", ".", "_filters", "or", "arg_0", ".", "_order_by", ")", ":", "raise", "QueryError", "(", "\"You are missing filter or order criteria\"", ")", "arg_1", "=", "int", "(", "arg_1", ")", "if", "arg_1", "<", "1", ":", "raise", "QueryError", "(", "\"You must specify a timeout >= 1, you gave %r\"", "%", "arg_1", ")", "return", "arg_0", ".", "_model", ".", "_gindex", ".", "search", "(", "_connect", "(", "arg_0", ".", "_model", ")", ",", "arg_0", ".", "_filters", ",", "arg_0", ".", "_order_by", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        This will execute the query, returning the key where a ZSET of your\n        results will be stored for pagination, further operations, etc.\n\n        The timeout must be a positive integer number of seconds for which to\n        set the expiration time on the key (this is to ensure that any cached\n        query results are eventually deleted, unless you make the explicit\n        step to use the PERSIST command).\n\n        .. note:: Limit clauses are ignored and not passed.\n\n        Usage::\n\n            ukey = User.query.endswith(email='@gmail.com').Func(30)\n            for i in xrange(0, conn.zcard(ukey), 100):\n                # refresh the expiration\n                conn.expire(ukey, 30)\n                users = User.get(conn.zrange(ukey, i, i+99))\n                ...\n        '''\n        if not (arg_0._filters or arg_0._order_by):\n            raise QueryError(\"You are missing filter or order criteria\")\n        arg_1 = int(arg_1)\n        if arg_1 < 1:\n            raise QueryError(\"You must specify a timeout >= 1, you gave %r\"%arg_1)\n        return arg_0._model._gindex.search(\n            _connect(arg_0._model), arg_0._filters, arg_0._order_by, arg_1=arg_1)", "path": "rom/query.py", "identifier": "Query.cached_result", "docstring": "This will execute the query, returning the key where a ZSET of your\n        results will be stored for pagination, further operations, etc.\n\n        The timeout must be a positive integer number of seconds for which to\n        set the expiration time on the key (this is to ensure that any cached\n        query results are eventually deleted, unless you make the explicit\n        step to use the PERSIST command).\n\n        .. note:: Limit clauses are ignored and not passed.\n\n        Usage::\n\n            ukey = User.query.endswith(email='@gmail.com').cached_result(30)\n            for i in xrange(0, conn.zcard(ukey), 100):\n                # refresh the expiration\n                conn.expire(ukey, 30)\n                users = User.get(conn.zrange(ukey, i, i+99))\n                ...", "docstring_tokens": ["This", "will", "execute", "the", "query", "returning", "the", "key", "where", "a", "ZSET", "of", "your", "results", "will", "be", "stored", "for", "pagination", "further", "operations", "etc", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 253037}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/file_info.py#L370-L396", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Parse the string output from sox's stat function", "language": "python", "parameters": "(stat_output)", "return_statement": "return stat_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "split", "(", "'\\n'", ")", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_3", ".", "split", "(", "':'", ")", "if", "len", "(", "arg_4", ")", "==", "2", ":", "arg_5", "=", "arg_4", "[", "0", "]", "arg_6", "=", "arg_4", "[", "1", "]", ".", "strip", "(", "' '", ")", "try", ":", "arg_6", "=", "float", "(", "arg_6", ")", "except", "ValueError", ":", "arg_6", "=", "None", "arg_2", "[", "arg_5", "]", "=", "arg_6", "return", "arg_2"], "function": "def Func(arg_0):\n    '''Parse the string output from sox's stat function\n\n    Parameters\n    ----------\n    stat_output : str\n        Sox output from stderr.\n\n    Returns\n    -------\n    stat_dictionary : dict\n        Dictionary of audio statistics.\n    '''\n    arg_1 = arg_0.split('\\n')\n    arg_2 = {}\n    for arg_3 in arg_1:\n        arg_4 = arg_3.split(':')\n        if len(arg_4) == 2:\n            arg_5 = arg_4[0]\n            arg_6 = arg_4[1].strip(' ')\n            try:\n                arg_6 = float(arg_6)\n            except ValueError:\n                arg_6 = None\n            arg_2[arg_5] = arg_6\n\n    return arg_2", "path": "sox/file_info.py", "identifier": "_parse_stat", "docstring": "Parse the string output from sox's stat function\n\n    Parameters\n    ----------\n    stat_output : str\n        Sox output from stderr.\n\n    Returns\n    -------\n    stat_dictionary : dict\n        Dictionary of audio statistics.", "docstring_tokens": ["Parse", "the", "string", "output", "from", "sox", "s", "stat", "function"], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 253038}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query.py#L83-L99", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "The subparts are seperated by a comma. Make sure\n    that commas inside the part themselves are not considered.", "language": "python", "parameters": "(self, query)", "return_statement": "return parts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "0", "arg_4", "=", "','", "arg_5", "=", "0", "for", "arg_6", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "if", "arg_1", "[", "arg_6", "]", "==", "'('", ":", "arg_3", "+=", "1", "elif", "arg_1", "[", "arg_6", "]", "==", "')'", ":", "arg_3", "-=", "1", "elif", "arg_1", "[", "arg_6", "]", "==", "arg_4", "and", "arg_3", "==", "0", ":", "arg_2", ".", "append", "(", "arg_1", "[", "arg_5", ":", "arg_6", "]", ".", "strip", "(", ")", ")", "arg_5", "=", "arg_6", "+", "1", "arg_2", ".", "append", "(", "arg_1", "[", "arg_5", ":", "]", ".", "strip", "(", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"The subparts are seperated by a comma. Make sure\n    that commas inside the part themselves are not considered.\"\"\"\n    arg_2 = []\n    arg_3 = 0\n    arg_4 = ','\n    arg_5 = 0\n    for arg_6 in range(len(arg_1)):\n      if arg_1[arg_6] == '(':\n        arg_3 += 1\n      elif arg_1[arg_6] == ')':\n        arg_3 -= 1\n      elif arg_1[arg_6] == arg_4 and arg_3 == 0:\n        arg_2.append(arg_1[arg_5: arg_6].strip())\n        arg_5 = arg_6 + 1\n    arg_2.append(arg_1[arg_5:].strip())\n    return arg_2", "path": "heron/tools/tracker/src/python/query.py", "identifier": "Query.get_sub_parts", "docstring": "The subparts are seperated by a comma. Make sure\n    that commas inside the part themselves are not considered.", "docstring_tokens": ["The", "subparts", "are", "seperated", "by", "a", "comma", ".", "Make", "sure", "that", "commas", "inside", "the", "part", "themselves", "are", "not", "considered", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253039}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/display.py#L935-L946", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Get the frequencies for Mel bins", "language": "python", "parameters": "(n, fmin=0, fmax=11025.0, **_kwargs)", "return_statement": "return basis", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "11025.0", ",", "**", "arg_3", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "0", "if", "arg_2", "is", "None", ":", "arg_2", "=", "11025.0", "arg_4", "=", "core", ".", "mel_frequencies", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "[", "1", ":", "]", "-=", "0.5", "*", "np", ".", "diff", "(", "arg_4", ")", "arg_4", "=", "np", ".", "append", "(", "np", ".", "maximum", "(", "0", ",", "arg_4", ")", ",", "[", "arg_2", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=0, arg_2=11025.0, **arg_3):\n    '''Get the frequencies for Mel bins'''\n\n    if arg_1 is None:\n        arg_1 = 0\n    if arg_2 is None:\n        arg_2 = 11025.0\n\n    arg_4 = core.mel_frequencies(arg_0, arg_1=arg_1, arg_2=arg_2)\n    arg_4[1:] -= 0.5 * np.diff(arg_4)\n    arg_4 = np.append(np.maximum(0, arg_4), [arg_2])\n    return arg_4", "path": "librosa/display.py", "identifier": "__coord_mel_hz", "docstring": "Get the frequencies for Mel bins", "docstring_tokens": ["Get", "the", "frequencies", "for", "Mel", "bins"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 253040}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/plugins/compress_assets.py#L60-L66", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Compress a file, only if needed.", "language": "python", "parameters": "(self, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_Funced_filename", "(", "arg_1", ")", "if", "not", "arg_2", ":", "return", "arg_0", ".", "do_Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Compress a file, only if needed.\"\"\"\n        arg_2 = arg_0.get_Funced_filename(arg_1)\n        if not arg_2:\n            return\n\n        arg_0.do_Func(arg_1, arg_2)", "path": "sigal/plugins/compress_assets.py", "identifier": "BaseCompressor.compress", "docstring": "Compress a file, only if needed.", "docstring_tokens": ["Compress", "a", "file", "only", "if", "needed", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 253041}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L2632-L2645", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Creates a new pypet leaf instance.", "language": "python", "parameters": "(self, name, trajectory, hdf5_group)", "return_statement": "return instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_all_get_from_attrs", "(", "arg_3", ",", "HDF5StorageService", ".", "CLASS_NAME", ")", "arg_5", "=", "arg_2", ".", "_create_class", "(", "arg_4", ")", "arg_6", "=", "arg_2", ".", "_construct_instance", "(", "arg_5", ",", "arg_1", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Creates a new pypet leaf instance.\n\n        Returns the leaf and if it is an explored parameter the length of the range.\n\n        \"\"\"\n        arg_4 = arg_0._all_get_from_attrs(arg_3, HDF5StorageService.CLASS_NAME)\n\n        # Create the instance with the appropriate constructor\n        arg_5 = arg_2._create_class(arg_4)\n\n        arg_6 = arg_2._construct_instance(arg_5, arg_1)\n\n        return arg_6", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._tree_create_leaf", "docstring": "Creates a new pypet leaf instance.\n\n        Returns the leaf and if it is an explored parameter the length of the range.", "docstring_tokens": ["Creates", "a", "new", "pypet", "leaf", "instance", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253042}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/joint_distribution_named.py#L218-L242", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates tuple of str tuple-str pairs representing resolved & sorted DAG.", "language": "python", "parameters": "(g)", "return_statement": "return tuple(reversed(result))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_explore", "(", "arg_1", ")", ":", "if", "arg_1", ".", "depth", "<", "0", ":", "return", "if", "not", "arg_1", ".", "parents", ":", "arg_8", ".", "append", "(", "(", "arg_1", ".", "name", ",", "arg_1", ".", "parents", ")", ")", "arg_1", ".", "depth", "=", "-", "1", "return", "arg_3", "=", "(", "arg_1", ".", "name", ",", "[", "]", ")", "arg_8", ".", "append", "(", "arg_3", ")", "arg_1", ".", "depth", "=", "-", "1", "arg_4", "=", "0", "for", "arg_5", "in", "sorted", "(", "(", "arg_0", ".", "get", "(", "p", ")", "for", "p", "in", "arg_1", ".", "parents", ")", ",", "key", "=", "lambda", "arg_5", ":", "arg_5", ".", "depth", ")", ":", "arg_6", "=", "len", "(", "arg_8", ")", "_explore", "(", "arg_5", ")", "arg_7", "=", "len", "(", "arg_8", ")", "arg_3", "[", "1", "]", ".", "extend", "(", "[", "'_'", "]", "*", "arg_4", "+", "[", "arg_5", ".", "name", "]", ")", "arg_4", "=", "arg_7", "-", "arg_6", "-", "1", "arg_0", "=", "_depth", "(", "arg_0", ")", "arg_8", "=", "[", "]", "for", "arg_1", "in", "sorted", "(", "arg_0", ".", "values", "(", ")", ",", "key", "=", "lambda", "arg_5", ":", "arg_5", ".", "depth", ",", "reverse", "=", "True", ")", ":", "_explore", "(", "arg_1", ")", "return", "tuple", "(", "reversed", "(", "arg_8", ")", ")"], "function": "def Func(arg_0):\n  \"\"\"Creates tuple of str tuple-str pairs representing resolved & sorted DAG.\"\"\"\n  def _explore(arg_1):\n    \"\"\"Recursive function to ascend up through unvisited dependencies.\"\"\"\n    if arg_1.depth < 0:\n      return  # Already visited.\n    if not arg_1.parents:\n      arg_8.append((arg_1.name, arg_1.parents))\n      arg_1.depth = -1  # Mark visited.\n      return\n    arg_3 = (arg_1.name, [])\n    arg_8.append(arg_3)\n    arg_1.depth = -1  # Mark visited.\n    arg_4 = 0\n    for arg_5 in sorted((arg_0.get(p) for p in arg_1.parents), key=lambda arg_5: arg_5.depth):\n      arg_6 = len(arg_8)\n      _explore(arg_5)\n      arg_7 = len(arg_8)\n      arg_3[1].extend(['_']*arg_4 + [arg_5.name])\n      arg_4 = arg_7 - arg_6 - 1\n  arg_0 = _depth(arg_0)\n  arg_8 = []\n  for arg_1 in sorted(arg_0.values(), key=lambda arg_5: arg_5.depth, reverse=True):\n    _explore(arg_1)\n  return tuple(reversed(arg_8))", "path": "tensorflow_probability/python/distributions/joint_distribution_named.py", "identifier": "_best_order", "docstring": "Creates tuple of str tuple-str pairs representing resolved & sorted DAG.", "docstring_tokens": ["Creates", "tuple", "of", "str", "tuple", "-", "str", "pairs", "representing", "resolved", "&", "sorted", "DAG", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253043}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/dagdeps.py#L48-L54", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Make a symmetrical binary tree with", "language": "python", "parameters": "(levels)", "return_statement": "return G", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "nx", ".", "DiGraph", "(", ")", "arg_2", "=", "'0'", "arg_1", ".", "add_node", "(", "arg_2", ")", "add_children", "(", "arg_1", ",", "arg_2", ",", "arg_0", ",", "2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Make a symmetrical binary tree with @levels\"\"\"\n    arg_1 = nx.DiGraph()\n    arg_2 = '0'\n    arg_1.add_node(arg_2)\n    add_children(arg_1, arg_2, arg_0, 2)\n    return arg_1", "path": "environment/share/doc/ipython/examples/parallel/dagdeps.py", "identifier": "make_bintree", "docstring": "Make a symmetrical binary tree with @levels", "docstring_tokens": ["Make", "a", "symmetrical", "binary", "tree", "with"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253044}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Telegraf/client.py#L105-L121", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Start local agent", "language": "python", "parameters": "(self)", "return_statement": "return self.session", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "info", "(", "'Starting agent on localhost'", ")", "arg_1", "=", "arg_0", ".", "python", ".", "split", "(", ")", "+", "[", "os", ".", "path", ".", "join", "(", "arg_0", ".", "workdir", ",", "arg_0", ".", "AGENT_FILENAME", ")", ",", "'--telegraf'", ",", "arg_0", ".", "path", "[", "'TELEGRAF_LOCAL_PATH'", "]", ",", "'--host'", ",", "arg_0", ".", "host", "]", "if", "arg_0", ".", "kill_old", ":", "arg_1", ".", "append", "(", "arg_0", ".", "kill_old", ")", "arg_0", ".", "session", "=", "arg_0", ".", "popen", "(", "arg_1", ")", "arg_0", ".", "reader_thread", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "read_buffer", ")", "arg_0", ".", "reader_thread", ".", "setDaemon", "(", "True", ")", "return", "arg_0", ".", "session"], "function": "def Func(arg_0):\n        \"\"\"Start local agent\"\"\"\n        logger.info('Starting agent on localhost')\n        arg_1 = arg_0.python.split() + [\n            os.path.join(\n                arg_0.workdir,\n                arg_0.AGENT_FILENAME),\n            '--telegraf',\n            arg_0.path['TELEGRAF_LOCAL_PATH'],\n            '--host',\n            arg_0.host]\n        if arg_0.kill_old:\n            arg_1.append(arg_0.kill_old)\n        arg_0.session = arg_0.popen(arg_1)\n        arg_0.reader_thread = threading.Thread(target=arg_0.read_buffer)\n        arg_0.reader_thread.setDaemon(True)\n        return arg_0.session", "path": "yandextank/plugins/Telegraf/client.py", "identifier": "LocalhostClient.start", "docstring": "Start local agent", "docstring_tokens": ["Start", "local", "agent"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 253045}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/db.py#L360-L379", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Validates the model using a series of checks on bits of the data.", "language": "python", "parameters": "(cursor, model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_license", "(", "arg_1", ")", "_validate_roles", "(", "arg_1", ")", "arg_2", "=", "(", "'title'", ",", "'summary'", ",", ")", "for", "arg_3", "in", "arg_2", ":", "if", "arg_1", ".", "metadata", ".", "get", "(", "arg_3", ")", "in", "[", "None", ",", "''", ",", "[", "]", "]", ":", "raise", "exceptions", ".", "MissingRequiredMetadata", "(", "arg_3", ")", "_validate_derived_from", "(", "arg_0", ",", "arg_1", ")", "_validate_subjects", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Validates the model using a series of checks on bits of the data.\"\"\"\n    # Check the license is one valid for publication.\n    _validate_license(arg_1)\n    _validate_roles(arg_1)\n\n    # Other required metadata includes: title, summary\n    arg_2 = ('title', 'summary',)\n    for arg_3 in arg_2:\n        if arg_1.metadata.get(arg_3) in [None, '', []]:\n            raise exceptions.MissingRequiredMetadata(arg_3)\n\n    # Ensure that derived-from values are either None\n    # or point at a live record in the archive.\n    _validate_derived_from(arg_0, arg_1)\n\n    # FIXME Valid language code?\n\n    # Are the given 'subjects'\n    _validate_subjects(arg_0, arg_1)", "path": "cnxpublishing/db.py", "identifier": "validate_model", "docstring": "Validates the model using a series of checks on bits of the data.", "docstring_tokens": ["Validates", "the", "model", "using", "a", "series", "of", "checks", "on", "bits", "of", "the", "data", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 253046}
{"url": "https://github.com/c-soft/satel_integra/blob/3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c/satel_integra/satel_integra.py#L170-L186", "sha": "3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c", "docstring_summary": "Make a TCP connection to the alarm system.", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "_LOGGER", ".", "debug", "(", "\"Connecting...\"", ")", "try", ":", "arg_0", ".", "_reader", ",", "arg_0", ".", "_writer", "=", "await", "asyncio", ".", "open_Funcion", "(", "arg_0", ".", "_host", ",", "arg_0", ".", "_port", ",", "loop", "=", "arg_0", ".", "_loop", ")", "_LOGGER", ".", "debug", "(", "\"sucess Funcing...\"", ")", "except", "Exception", "as", "e", ":", "_LOGGER", ".", "warning", "(", "\"Exception during Funcing: %s.\"", ",", "e", ")", "arg_0", ".", "_writer", "=", "None", "arg_0", ".", "_reader", "=", "None", "return", "False", "return", "True"], "function": "async def Func(arg_0):\n        \"\"\"Make a TCP Funcion to the alarm system.\"\"\"\n        _LOGGER.debug(\"Connecting...\")\n\n        try:\n            arg_0._reader, arg_0._writer = await asyncio.open_Funcion(\n                arg_0._host, arg_0._port, loop=arg_0._loop)\n            _LOGGER.debug(\"sucess Funcing...\")\n\n        except Exception as e:\n            _LOGGER.warning(\n                \"Exception during Funcing: %s.\", e)\n            arg_0._writer = None\n            arg_0._reader = None\n            return False\n\n        return True", "path": "satel_integra/satel_integra.py", "identifier": "AsyncSatel.connect", "docstring": "Make a TCP connection to the alarm system.", "docstring_tokens": ["Make", "a", "TCP", "connection", "to", "the", "alarm", "system", "."], "nwo": "c-soft/satel_integra", "score": 0.683472553404196, "idx": 253047}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/setup.py#L107-L121", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "overridden from install_lib class", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "install_lib", ".", "install_lib", ".", "Func", "(", "arg_0", ")", "if", "include_dirs", ":", "for", "arg_1", "in", "include_dirs", ":", "arg_2", "=", "join", "(", "arg_0", ".", "install_dir", ",", "arg_1", ")", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "arg_3", "=", "{", "\"invalid_encoded_data*\"", ",", "\"unknown_encoding*\"", "}", "else", ":", "arg_3", "=", "set", "(", ")", "shutil", ".", "rmtree", "(", "arg_2", ",", "ignore_errors", "=", "True", ")", "shutil", ".", "copytree", "(", "arg_1", ",", "arg_2", ",", "ignore", "=", "shutil", ".", "ignore_patterns", "(", "*", "arg_3", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"overridden from install_lib class\"\"\"\n        install_lib.install_lib.Func(arg_0)\n        # manually install included directories if any\n        if include_dirs:\n            for arg_1 in include_dirs:\n                arg_2 = join(arg_0.install_dir, arg_1)\n                if sys.version_info >= (3, 0):\n                    arg_3 = {\"invalid_encoded_data*\", \"unknown_encoding*\"}\n                else:\n                    arg_3 = set()\n                shutil.rmtree(arg_2, ignore_errors=True)\n                shutil.copytree(\n                    arg_1, arg_2, ignore=shutil.ignore_patterns(*arg_3)\n                )", "path": "setup.py", "identifier": "MyInstallLib.run", "docstring": "overridden from install_lib class", "docstring_tokens": ["overridden", "from", "install_lib", "class"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253048}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L52-L63", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Attach an observer.", "language": "python", "parameters": "(self, observer)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", "in", "arg_0", ".", "_observers", ":", "arg_0", ".", "_observers", ".", "append", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Attach an observer.\n\n        Args:\n            observer (func): A function to be called when new messages arrive\n\n        Returns:\n            :class:`Stream`. Current instance to allow chaining\n        \"\"\"\n        if not arg_1 in arg_0._observers:\n            arg_0._observers.append(arg_1)\n        return arg_0", "path": "pyfire/stream.py", "identifier": "Stream.attach", "docstring": "Attach an observer.\n\n        Args:\n            observer (func): A function to be called when new messages arrive\n\n        Returns:\n            :class:`Stream`. Current instance to allow chaining", "docstring_tokens": ["Attach", "an", "observer", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 253049}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L2352-L2378", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Levenberg-Marquardt optimization on a set of particles.", "language": "python", "parameters": "(s, particles, damping=1.0, decrease_damp_factor=10.,\n        run_length=4, collect_stats=False, max_iter=2, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1.0", ",", "arg_3", "=", "10.", ",", "arg_4", "=", "4", ",", "arg_5", "=", "False", ",", "arg_6", "=", "2", ",", "**", "arg_7", ")", ":", "arg_8", "=", "LMParticles", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "**", "arg_7", ")", "arg_8", ".", "do_run_2", "(", ")", "if", "arg_5", ":", "return", "arg_8", ".", "get_termination_stats", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=1.0, arg_3=10.,\n        arg_4=4, arg_5=False, arg_6=2, **arg_7):\n    \"\"\"\n    Levenberg-Marquardt optimization on a set of particles.\n\n    Convenience wrapper for LMParticles. Same keyword args, but the\n    defaults have been set to useful values for optimizing particles.\n    See LMParticles and LMEngine for documentation.\n\n    See Also\n    --------\n        do_levmarq_all_particle_groups : Levenberg-Marquardt optimization\n            of all the particles in the state.\n\n        do_levmarq : Levenberg-Marquardt optimization of the entire state;\n            useful for optimizing global parameters.\n\n        LMParticles : Optimizer object; the workhorse of Func.\n\n        LMEngine : Engine superclass for all the optimizers.\n    \"\"\"\n    arg_8 = LMParticles(arg_0, arg_1, arg_2=arg_2, arg_4=arg_4,\n            arg_3=arg_3, arg_6=arg_6,\n            **arg_7)\n    arg_8.do_run_2()\n    if arg_5:\n        return arg_8.get_termination_stats()", "path": "peri/opt/optimize.py", "identifier": "do_levmarq_particles", "docstring": "Levenberg-Marquardt optimization on a set of particles.\n\n    Convenience wrapper for LMParticles. Same keyword args, but the\n    defaults have been set to useful values for optimizing particles.\n    See LMParticles and LMEngine for documentation.\n\n    See Also\n    --------\n        do_levmarq_all_particle_groups : Levenberg-Marquardt optimization\n            of all the particles in the state.\n\n        do_levmarq : Levenberg-Marquardt optimization of the entire state;\n            useful for optimizing global parameters.\n\n        LMParticles : Optimizer object; the workhorse of do_levmarq_particles.\n\n        LMEngine : Engine superclass for all the optimizers.", "docstring_tokens": ["Levenberg", "-", "Marquardt", "optimization", "on", "a", "set", "of", "particles", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 253050}
{"url": "https://github.com/shopkick/flawless/blob/c54b63ca1991c153e6f75080536f6df445aacc64/flawless/server/service.py#L227-L236", "sha": "c54b63ca1991c153e6f75080536f6df445aacc64", "docstring_summary": "Given a filepath, and a list of regex patterns, this function returns true\n        if filepath matches any one of those patterns", "language": "python", "parameters": "(self, filepath)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "only_blame_patterns", ":", "return", "True", "for", "arg_2", "in", "arg_0", ".", "only_blame_patterns", ":", "if", "arg_2", ".", "match", "(", "arg_1", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        '''Given a filepath, and a list of regex patterns, this function returns true\n        if filepath matches any one of those patterns'''\n        if not arg_0.only_blame_patterns:\n            return True\n\n        for arg_2 in arg_0.only_blame_patterns:\n            if arg_2.match(arg_1):\n                return True\n        return False", "path": "flawless/server/service.py", "identifier": "FlawlessServiceBaseClass._matches_filepath_pattern", "docstring": "Given a filepath, and a list of regex patterns, this function returns true\n        if filepath matches any one of those patterns", "docstring_tokens": ["Given", "a", "filepath", "and", "a", "list", "of", "regex", "patterns", "this", "function", "returns", "true", "if", "filepath", "matches", "any", "one", "of", "those", "patterns"], "nwo": "shopkick/flawless", "score": 0.37326674238089064, "idx": 253051}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/engine.py#L53-L82", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Sets a custom mock engine, replacing the built-in one.", "language": "python", "parameters": "(self, engine)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "raise", "TypeError", "(", "'engine must be a valid object'", ")", "arg_2", "=", "arg_1", "(", "arg_0", ")", "arg_3", "=", "(", "'activate'", ",", "'disable'", ")", "if", "not", "all", "(", "[", "hasattr", "(", "arg_2", ",", "arg_4", ")", "for", "arg_4", "in", "arg_3", "]", ")", ":", "raise", "NotImplementedError", "(", "'engine must implementent the '", "'required methods'", ")", "arg_0", ".", "mock_engine", "=", "arg_2", "if", "arg_0", ".", "active", ":", "arg_0", ".", "mock_engine", ".", "activate", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sets a custom mock engine, replacing the built-in one.\n\n        This is particularly useful if you want to replace the built-in\n        HTTP traffic mock interceptor engine with your custom one.\n\n        For mock engine implementation details, see `pook.MockEngine`.\n\n        Arguments:\n            engine (pook.MockEngine): custom mock engine to use.\n        \"\"\"\n        if not arg_1:\n            raise TypeError('engine must be a valid object')\n\n        # Instantiate mock engine\n        arg_2 = arg_1(arg_0)\n\n        # Validate minimum viable interface\n        arg_3 = ('activate', 'disable')\n        if not all([hasattr(arg_2, arg_4) for arg_4 in arg_3]):\n            raise NotImplementedError('engine must implementent the '\n                                      'required methods')\n\n        # Use the custom mock engine\n        arg_0.mock_engine = arg_2\n\n        # Enable mock engine, if needed\n        if arg_0.active:\n            arg_0.mock_engine.activate()", "path": "pook/engine.py", "identifier": "Engine.set_mock_engine", "docstring": "Sets a custom mock engine, replacing the built-in one.\n\n        This is particularly useful if you want to replace the built-in\n        HTTP traffic mock interceptor engine with your custom one.\n\n        For mock engine implementation details, see `pook.MockEngine`.\n\n        Arguments:\n            engine (pook.MockEngine): custom mock engine to use.", "docstring_tokens": ["Sets", "a", "custom", "mock", "engine", "replacing", "the", "built", "-", "in", "one", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 253052}
{"url": "https://github.com/ankitmathur3193/song-cli/blob/ca8ccfe547e9d702313ff6d14e81ae4355989a67/song/commands/SearchEngineParser/GoogleParser.py#L10-L18", "sha": "ca8ccfe547e9d702313ff6d14e81ae4355989a67", "docstring_summary": "It will return the google url to be searched", "language": "python", "parameters": "(self,song_name,website)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "'+'", ".", "join", "(", "arg_1", ")", "arg_4", "=", "'https://www.google.co.in/search?q='", "arg_2", "=", "arg_2", ".", "split", "(", "\" \"", ")", "arg_5", "=", "'+'", ".", "join", "(", "arg_2", ")", "arg_6", "=", "arg_4", "+", "arg_3", "+", "arg_5", "return", "arg_6"], "function": "def Func(arg_0,arg_1,arg_2):\n\t\t''' It will return the google url to be searched'''\n\t\targ_3='+'.join(arg_1)\n\t\targ_4='https://www.google.co.in/search?q='\t\n\t\targ_2=arg_2.split(\" \")\n\t\targ_5='+'.join(arg_2)\n\t\targ_6=arg_4+arg_3+arg_5\n\t\t#print url\n\t\treturn arg_6", "path": "song/commands/SearchEngineParser/GoogleParser.py", "identifier": "GoogleParser.google_url", "docstring": "It will return the google url to be searched", "docstring_tokens": ["It", "will", "return", "the", "google", "url", "to", "be", "searched"], "nwo": "ankitmathur3193/song-cli", "score": 0.1872672106339659, "idx": 253053}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/clients/vault.py#L138-L143", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Write data to Vault. Returns the JSON-decoded response.", "language": "python", "parameters": "(self, path, **data)", "return_statement": "return d.addCallback(self._handle_response, check_cas=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "request", "(", "'PUT'", ",", "'/v1/'", "+", "arg_1", ",", "json", "=", "arg_2", ")", "return", "arg_3", ".", "addCallback", "(", "arg_0", ".", "_handle_response", ",", "check_cas", "=", "True", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Write data to Vault. Returns the JSON-decoded response.\n        \"\"\"\n        arg_3 = arg_0.request('PUT', '/v1/' + arg_1, json=arg_2)\n        return arg_3.addCallback(arg_0._handle_response, check_cas=True)", "path": "marathon_acme/clients/vault.py", "identifier": "VaultClient.write", "docstring": "Write data to Vault. Returns the JSON-decoded response.", "docstring_tokens": ["Write", "data", "to", "Vault", ".", "Returns", "the", "JSON", "-", "decoded", "response", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 253054}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L29-L45", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Return a datetime oject from a string, with optional time format.", "language": "python", "parameters": "(datetime, time_format=None)", "return_statement": "return t", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "du", ".", "parser", ".", "parse", "(", "arg_0", ")", "else", ":", "arg_2", "=", "dt", ".", "datetime", ".", "strftime", "(", "arg_0", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Return a datetime oject from a string, with optional time format.\n\n    Parameters\n    ----------\n    datetime : str\n        Date-time as string in any sensible format.\n    time_format : datetime str (optional)\n        String describing the datetime format. If missing uses\n        dateutil.parser to guess time format.\n    \"\"\"\n    if arg_1 is None:\n        arg_2 = du.parser.parse(arg_0)\n    else:\n        arg_2 = dt.datetime.strftime(arg_0, arg_1)\n    return arg_2", "path": "latools/helpers/helpers.py", "identifier": "get_date", "docstring": "Return a datetime oject from a string, with optional time format.\n\n    Parameters\n    ----------\n    datetime : str\n        Date-time as string in any sensible format.\n    time_format : datetime str (optional)\n        String describing the datetime format. If missing uses\n        dateutil.parser to guess time format.", "docstring_tokens": ["Return", "a", "datetime", "oject", "from", "a", "string", "with", "optional", "time", "format", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 253055}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/winhpcjob.py#L144-L152", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the string representation of the job description XML.", "language": "python", "parameters": "(self)", "return_statement": "return txt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "as_element", "(", ")", "indent", "(", "arg_1", ")", "arg_2", "=", "ET", ".", "Func", "(", "arg_1", ",", "encoding", "=", "\"utf-8\"", ")", "arg_2", "=", "re", ".", "sub", "(", "r'_[A-Z]_'", ",", "''", ",", "arg_2", ")", "arg_2", "=", "'<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n'", "+", "arg_2", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Return the string representation of the job description XML.\"\"\"\n        arg_1 = arg_0.as_element()\n        indent(arg_1)\n        arg_2 = ET.Func(arg_1, encoding=\"utf-8\")\n        # Now remove the tokens used to order the attributes.\n        arg_2 = re.sub(r'_[A-Z]_','',arg_2)\n        arg_2 = '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n' + arg_2\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/parallel/apps/winhpcjob.py", "identifier": "WinHPCJob.tostring", "docstring": "Return the string representation of the job description XML.", "docstring_tokens": ["Return", "the", "string", "representation", "of", "the", "job", "description", "XML", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253056}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L104-L118", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Execute the enrich phase for a given backend section", "language": "python", "parameters": "(config, backend_section)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "TaskProjects", "(", "arg_0", ")", ".", "execute", "(", ")", "arg_2", "=", "TaskEnrich", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "try", ":", "arg_2", ".", "execute", "(", ")", "logging", ".", "info", "(", "\"Loading enriched data finished!\"", ")", "except", "Exception", "as", "e", ":", "logging", ".", "error", "(", "str", "(", "e", ")", ")", "sys", ".", "exit", "(", "-", "1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Execute the enrich phase for a given backend section\n\n    :param config: a Mordred config object\n    :param backend_section: the backend section where the enrich phase is executed\n    \"\"\"\n\n    TaskProjects(arg_0).execute()\n    arg_2 = TaskEnrich(arg_0, arg_1=arg_1)\n    try:\n        arg_2.execute()\n        logging.info(\"Loading enriched data finished!\")\n    except Exception as e:\n        logging.error(str(e))\n        sys.exit(-1)", "path": "utils/micro.py", "identifier": "get_enrich", "docstring": "Execute the enrich phase for a given backend section\n\n    :param config: a Mordred config object\n    :param backend_section: the backend section where the enrich phase is executed", "docstring_tokens": ["Execute", "the", "enrich", "phase", "for", "a", "given", "backend", "section"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 253057}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L924-L948", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Level-2 parser for a DX field object.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "__consume", "(", ")", "except", "DXParserNoTokens", ":", "return", "if", "arg_1", ".", "equals", "(", "'component'", ")", ":", "arg_2", "=", "arg_0", ".", "__consume", "(", ")", ".", "value", "(", ")", "if", "not", "arg_0", ".", "__consume", "(", ")", ".", "equals", "(", "'value'", ")", ":", "raise", "DXParseError", "(", "'field: \"value\" expected'", ")", "arg_3", "=", "arg_0", ".", "__consume", "(", ")", ".", "value", "(", ")", "try", ":", "arg_0", ".", "currentobject", "[", "'components'", "]", "[", "arg_2", "]", "=", "arg_3", "except", "KeyError", ":", "arg_0", ".", "currentobject", "[", "'components'", "]", "=", "{", "arg_2", ":", "arg_3", "}", "else", ":", "raise", "DXParseError", "(", "'field: '", "+", "str", "(", "arg_1", ")", "+", "' not recognized.'", ")"], "function": "def Func(arg_0):\n        \"\"\"Level-2 parser for a DX field object.\n\n        pattern:\n        object \"site map 1\" class field\n        component \"positions\" value 1\n        component \"connections\" value 2\n        component \"data\" value 3\n        \"\"\"\n        try:\n            arg_1 = arg_0.__consume()\n        except DXParserNoTokens:\n            return\n\n        if arg_1.equals('component'):\n            arg_2 = arg_0.__consume().value()\n            if not arg_0.__consume().equals('value'):\n                raise DXParseError('field: \"value\" expected')\n            arg_3 = arg_0.__consume().value()\n            try:\n                arg_0.currentobject['components'][arg_2] = arg_3\n            except KeyError:\n                arg_0.currentobject['components'] = {arg_2:arg_3}\n        else:\n            raise DXParseError('field: '+str(arg_1)+' not recognized.')", "path": "gridData/OpenDX.py", "identifier": "DXParser.__field", "docstring": "Level-2 parser for a DX field object.\n\n        pattern:\n        object \"site map 1\" class field\n        component \"positions\" value 1\n        component \"connections\" value 2\n        component \"data\" value 3", "docstring_tokens": ["Level", "-", "2", "parser", "for", "a", "DX", "field", "object", "."], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 253058}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L350-L364", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Called when a connection is made, and used to send out headers", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "\"GET %s HTTP/1.1\"", "%", "(", "\"/room/%s/live.json\"", "%", "arg_0", ".", "factory", ".", "get_stream", "(", ")", ".", "get_room_id", "(", ")", ")", "]", "arg_2", "=", "arg_0", ".", "factory", ".", "get_stream", "(", ")", ".", "get_connection", "(", ")", ".", "get_headers", "(", ")", "for", "arg_3", "in", "arg_2", ":", "arg_1", ".", "append", "(", "\"%s: %s\"", "%", "(", "arg_3", ",", "arg_2", "[", "arg_3", "]", ")", ")", "arg_1", ".", "append", "(", "\"Host: streaming.campfirenow.com\"", ")", "arg_0", ".", "transport", ".", "write", "(", "\"\\r\\n\"", ".", "join", "(", "arg_1", ")", "+", "\"\\r\\n\\r\\n\"", ")", "arg_0", ".", "factory", ".", "get_stream", "(", ")", ".", "set_protocol", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\" Called when a connection is made, and used to send out headers \"\"\"\n\n        arg_1 = [\n            \"GET %s HTTP/1.1\" % (\"/room/%s/live.json\" % arg_0.factory.get_stream().get_room_id())\n        ]\n\n        arg_2 = arg_0.factory.get_stream().get_connection().get_headers()\n        for arg_3 in arg_2:\n            arg_1.append(\"%s: %s\" % (arg_3, arg_2[arg_3]))\n\n        arg_1.append(\"Host: streaming.campfirenow.com\")\n\n        arg_0.transport.write(\"\\r\\n\".join(arg_1) + \"\\r\\n\\r\\n\")\n        arg_0.factory.get_stream().set_protocol(arg_0)", "path": "pyfire/stream.py", "identifier": "LiveStreamProtocol.connectionMade", "docstring": "Called when a connection is made, and used to send out headers", "docstring_tokens": ["Called", "when", "a", "connection", "is", "made", "and", "used", "to", "send", "out", "headers"], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 253059}
{"url": "https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/rpcinterface.py#L79-L116", "sha": "e6a36b3aeeacf44eec537434b0fb87c09ab54b5f", "docstring_summary": "The callable makes it possible to include rpcinterface\n    in a Pyramid application.", "language": "python", "parameters": "(config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "registry", ".", "settings", "if", "asbool", "(", "arg_1", ".", "get", "(", "'twitcher.rpcinterface'", ",", "True", ")", ")", ":", "LOGGER", ".", "debug", "(", "'Twitcher XML-RPC Interface enabled.'", ")", "arg_0", ".", "include", "(", "'twitcher.config'", ")", "arg_0", ".", "include", "(", "'twitcher.basicauth'", ")", "arg_0", ".", "include", "(", "'pyramid_rpc.xmlrpc'", ")", "arg_0", ".", "include", "(", "'twitcher.db'", ")", "arg_0", ".", "add_xmlrpc_endpoint", "(", "'api'", ",", "'/RPC2'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'generate_token'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'generate_token'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'revoke_token'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'revoke_token'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'revoke_all_tokens'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'revoke_all_tokens'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'register_service'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'register_service'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'unregister_service'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'unregister_service'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'get_service_by_name'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'get_service_by_name'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'get_service_by_url'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'get_service_by_url'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'clear_services'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'clear_services'", ")", "arg_0", ".", "add_xmlrpc_method", "(", "RPCInterface", ",", "attr", "=", "'list_services'", ",", "endpoint", "=", "'api'", ",", "method", "=", "'list_services'", ")"], "function": "def Func(arg_0):\n    \"\"\" The callable makes it possible to include rpcinterface\n    in a Pyramid application.\n\n    Calling ``config.include(twitcher.rpcinterface)`` will result in this\n    callable being called.\n\n    Arguments:\n\n    * ``config``: the ``pyramid.config.Configurator`` object.\n    \"\"\"\n    arg_1 = arg_0.registry.settings\n\n    if asbool(arg_1.get('twitcher.rpcinterface', True)):\n        LOGGER.debug('Twitcher XML-RPC Interface enabled.')\n\n        # include twitcher config\n        arg_0.include('twitcher.config')\n\n        # using basic auth\n        arg_0.include('twitcher.basicauth')\n\n        # pyramid xml-rpc\n        # http://docs.pylonsproject.org/projects/pyramid-rpc/en/latest/xmlrpc.html\n        arg_0.include('pyramid_rpc.xmlrpc')\n        arg_0.include('twitcher.db')\n        arg_0.add_xmlrpc_endpoint('api', '/RPC2')\n\n        # register xmlrpc methods\n        arg_0.add_xmlrpc_method(RPCInterface, attr='generate_token', endpoint='api', method='generate_token')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='revoke_token', endpoint='api', method='revoke_token')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='revoke_all_tokens', endpoint='api', method='revoke_all_tokens')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='register_service', endpoint='api', method='register_service')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='unregister_service', endpoint='api', method='unregister_service')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='get_service_by_name', endpoint='api', method='get_service_by_name')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='get_service_by_url', endpoint='api', method='get_service_by_url')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='clear_services', endpoint='api', method='clear_services')\n        arg_0.add_xmlrpc_method(RPCInterface, attr='list_services', endpoint='api', method='list_services')", "path": "twitcher/rpcinterface.py", "identifier": "includeme", "docstring": "The callable makes it possible to include rpcinterface\n    in a Pyramid application.\n\n    Calling ``config.include(twitcher.rpcinterface)`` will result in this\n    callable being called.\n\n    Arguments:\n\n    * ``config``: the ``pyramid.config.Configurator`` object.", "docstring_tokens": ["The", "callable", "makes", "it", "possible", "to", "include", "rpcinterface", "in", "a", "Pyramid", "application", "."], "nwo": "bird-house/twitcher", "score": 0.37599664903417057, "idx": 253060}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/aws/iam.py#L442-L470", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Get's the IAM Group details.", "language": "python", "parameters": "(group_name, users=True, client=None, **kwargs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "Func", "(", "GroupName", "=", "arg_0", ",", "**", "arg_3", ")", "if", "arg_1", ":", "if", "arg_4", ".", "get", "(", "'IsTruncated'", ")", ":", "arg_5", "=", "{", "'GroupName'", ":", "arg_0", "}", "arg_5", ".", "update", "(", "arg_3", ")", "arg_6", "=", "arg_4", "[", "'Users'", "]", "arg_5", "[", "'Marker'", "]", "=", "arg_4", "[", "'Marker'", "]", "arg_4", "[", "'Users'", "]", "=", "arg_6", "+", "_get_users_for_group", "(", "arg_2", ",", "**", "arg_5", ")", "else", ":", "arg_4", ".", "pop", "(", "'Users'", ",", "None", ")", "arg_4", ".", "pop", "(", "'IsTruncated'", ",", "None", ")", "arg_4", ".", "pop", "(", "'Marker'", ",", "None", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=True, arg_2=None, **arg_3):\n    \"\"\"Get's the IAM Group details.\n\n    :param group_name:\n    :param users: Optional -- will return the IAM users that the group is attached to if desired (paginated).\n    :param client:\n    :param kwargs:\n    :return:\n    \"\"\"\n    # First, make the initial call to get the details for the group:\n    arg_4 = arg_2.Func(GroupName=arg_0, **arg_3)\n\n    # If we care about the user details, then fetch them:\n    if arg_1:\n        if arg_4.get('IsTruncated'):\n            arg_5 = {'GroupName': arg_0}\n            arg_5.update(arg_3)\n\n            arg_6 = arg_4['Users']\n            arg_5['Marker'] = arg_4['Marker']\n\n            arg_4['Users'] = arg_6 + _get_users_for_group(arg_2, **arg_5)\n\n    else:\n        arg_4.pop('Users', None)\n        arg_4.pop('IsTruncated', None)\n        arg_4.pop('Marker', None)\n\n    return arg_4", "path": "cloudaux/aws/iam.py", "identifier": "get_group", "docstring": "Get's the IAM Group details.\n\n    :param group_name:\n    :param users: Optional -- will return the IAM users that the group is attached to if desired (paginated).\n    :param client:\n    :param kwargs:\n    :return:", "docstring_tokens": ["Get", "s", "the", "IAM", "Group", "details", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 253061}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L3031-L3062", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate heat capacity of a gas mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.", "language": "python", "parameters": "(self, T, P, zs, ws, method)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_5", "==", "SIMPLE", ":", "arg_6", "=", "[", "i", "(", "arg_1", ")", "for", "i", "in", "arg_0", ".", "HeatCapacityGases", "]", "return", "mixing_simple", "(", "arg_3", ",", "arg_6", ")", "else", ":", "raise", "Exception", "(", "'Method not valid'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        r'''Method to Func heat capacity of a gas mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to Func the property, [K]\n        P : float\n            Pressure at which to Func the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Cpgm : float\n            Molar heat capacity of the gas mixture at the given conditions,\n            [J/mol]\n        '''\n        if arg_5 == SIMPLE:\n            arg_6 = [i(arg_1) for i in arg_0.HeatCapacityGases]\n            return mixing_simple(arg_3, arg_6)\n        else:\n            raise Exception('Method not valid')", "path": "thermo/heat_capacity.py", "identifier": "HeatCapacityGasMixture.calculate", "docstring": "r'''Method to calculate heat capacity of a gas mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate the property, [K]\n        P : float\n            Pressure at which to calculate the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Cpgm : float\n            Molar heat capacity of the gas mixture at the given conditions,\n            [J/mol]", "docstring_tokens": ["r", "Method", "to", "calculate", "heat", "capacity", "of", "a", "gas", "mixture", "at", "temperature", "T", "pressure", "P", "mole", "fractions", "zs", "and", "weight", "fractions", "ws", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 253062}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L444-L453", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Pickle the Dataset instance to the provided file.", "language": "python", "parameters": "(self, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'feature_table'", ")", ":", "arg_0", ".", "feature_table", ".", "_sdf_to_csr", "(", ")", "pickle", ".", "dump", "(", "arg_0", ",", "open", "(", "arg_1", ",", "'wb'", ")", ",", "-", "1", ")", "if", "hasattr", "(", "arg_0", ",", "'feature_table'", ")", ":", "arg_0", ".", "feature_table", ".", "_csr_to_sdf", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Pickle the Dataset instance to the provided file.\n        \"\"\"\n        if hasattr(arg_0, 'feature_table'):\n            arg_0.feature_table._sdf_to_csr()\n\n        pickle.dump(arg_0, open(arg_1, 'wb'), -1)\n\n        if hasattr(arg_0, 'feature_table'):\n            arg_0.feature_table._csr_to_sdf()", "path": "neurosynth/base/dataset.py", "identifier": "Dataset.save", "docstring": "Pickle the Dataset instance to the provided file.", "docstring_tokens": ["Pickle", "the", "Dataset", "instance", "to", "the", "provided", "file", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 253063}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/__init__.py#L109-L115", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "the client will announce itself given that a command is not in a\n           particular predefined list.", "language": "python", "parameters": "(self, command=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "if", "arg_1", "not", "in", "[", "'get'", "]", "and", "arg_0", ".", "quiet", "is", "False", ":", "arg_0", ".", "speak", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''the client will Func itself given that a command is not in a\n           particular predefined list.\n        '''\n        if arg_1 is not None:\n            if arg_1 not in ['get'] and arg_0.quiet is False:\n                arg_0.speak()", "path": "sregistry/main/base/__init__.py", "identifier": "ApiConnection.announce", "docstring": "the client will announce itself given that a command is not in a\n           particular predefined list.", "docstring_tokens": ["the", "client", "will", "announce", "itself", "given", "that", "a", "command", "is", "not", "in", "a", "particular", "predefined", "list", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 253064}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/nginx/__init__.py#L57-L67", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This function will take in a port spec as specified by the port_spec compiler and\n    will output an nginx web proxy config string. This string can then be written to a file\n    and used running nginx", "language": "python", "parameters": "(port_spec_dict, docker_bridge_ip)", "return_statement": "return {'http': nginx_http_config, 'stream': nginx_stream_config}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "\"\"", ",", "\"\"", "for", "arg_4", "in", "arg_0", "[", "'nginx'", "]", ":", "if", "arg_4", "[", "'type'", "]", "==", "'http'", ":", "arg_2", "+=", "_nginx_http_spec", "(", "arg_4", ",", "arg_1", ")", "elif", "arg_4", "[", "'type'", "]", "==", "'stream'", ":", "arg_3", "+=", "_nginx_stream_spec", "(", "arg_4", ",", "arg_1", ")", "return", "{", "'http'", ":", "arg_2", ",", "'stream'", ":", "arg_3", "}"], "function": "def Func(arg_0, arg_1):\n    \"\"\"This function will take in a port spec as specified by the port_spec compiler and\n    will output an nginx web proxy config string. This string can then be written to a file\n    and used running nginx \"\"\"\n    arg_2, arg_3 = \"\", \"\"\n    for arg_4 in arg_0['nginx']:\n        if arg_4['type'] == 'http':\n            arg_2 += _nginx_http_spec(arg_4, arg_1)\n        elif arg_4['type'] == 'stream':\n            arg_3 += _nginx_stream_spec(arg_4, arg_1)\n    return {'http': arg_2, 'stream': arg_3}", "path": "dusty/compiler/nginx/__init__.py", "identifier": "get_nginx_configuration_spec", "docstring": "This function will take in a port spec as specified by the port_spec compiler and\n    will output an nginx web proxy config string. This string can then be written to a file\n    and used running nginx", "docstring_tokens": ["This", "function", "will", "take", "in", "a", "port", "spec", "as", "specified", "by", "the", "port_spec", "compiler", "and", "will", "output", "an", "nginx", "web", "proxy", "config", "string", ".", "This", "string", "can", "then", "be", "written", "to", "a", "file", "and", "used", "running", "nginx"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 253065}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L1097-L1108", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "XHDR command.", "language": "python", "parameters": "(self, header, msgid_range=None)", "return_statement": "return self.info(code, message)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_1", "if", "range", "is", "not", "None", ":", "arg_3", "+=", "\" \"", "+", "utils", ".", "unparse_msgid_range", "(", "arg_2", ")", "arg_4", ",", "arg_5", "=", "arg_0", ".", "command", "(", "\"XHDR\"", ",", "arg_3", ")", "if", "arg_4", "!=", "221", ":", "raise", "NNTPReplyError", "(", "arg_4", ",", "arg_5", ")", "return", "arg_0", ".", "info", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"XHDR command.\n        \"\"\"\n        arg_3 = arg_1\n        if range is not None:\n            arg_3 += \" \" + utils.unparse_msgid_range(arg_2)\n\n        arg_4, arg_5 = arg_0.command(\"XHDR\", arg_3)\n        if arg_4 != 221:\n            raise NNTPReplyError(arg_4, arg_5)\n\n        return arg_0.info(arg_4, arg_5)", "path": "nntp/nntp.py", "identifier": "NNTPClient.xhdr", "docstring": "XHDR command.", "docstring_tokens": ["XHDR", "command", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 253066}
{"url": "https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/operator.py#L382-L428", "sha": "d30107be02521fa6cdfe285da3b6b0cdd153c8cc", "docstring_summary": "Computes the resulting metadata statement from a compounded metadata\n        statement.\n        If something goes wrong during the evaluation an exception is raised", "language": "python", "parameters": "(self, metadata, keyjar=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "dict", "(", "[", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "arg_1", ".", "items", "(", ")", "if", "k", "not", "in", "IgnoreKeys", "]", ")", "arg_4", "=", "[", "]", "if", "'metadata_statements'", "in", "arg_1", ":", "for", "arg_5", ",", "arg_6", "in", "arg_1", "[", "'metadata_statements'", "]", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_6", ",", "str", ")", ":", "arg_6", "=", "json", ".", "loads", "(", "arg_6", ")", "for", "arg_7", "in", "arg_0", ".", "Func", "(", "arg_6", ")", ":", "if", "isinstance", "(", "arg_6", ",", "Message", ")", ":", "arg_8", "=", "LessOrEqual", "(", "sup", "=", "arg_7", ",", "**", "arg_6", ".", "to_dict", "(", ")", ")", "else", ":", "arg_8", "=", "LessOrEqual", "(", "sup", "=", "arg_7", ",", "**", "arg_6", ")", "if", "arg_8", ".", "is_expired", "(", ")", ":", "logger", ".", "error", "(", "'This metadata statement has expired: {}'", ".", "format", "(", "arg_6", ")", ")", "logger", ".", "info", "(", "'My time: {}'", ".", "format", "(", "utc_time_sans_frac", "(", ")", ")", ")", "continue", "arg_8", ".", "eval", "(", "arg_3", ")", "arg_4", ".", "append", "(", "arg_8", ")", "return", "arg_4", "else", ":", "try", ":", "arg_9", "=", "arg_1", "[", "'iss'", "]", "except", ":", "arg_8", "=", "LessOrEqual", "(", ")", "arg_8", ".", "eval", "(", "arg_3", ")", "else", ":", "arg_8", "=", "LessOrEqual", "(", "iss", "=", "arg_9", ",", "exp", "=", "arg_1", "[", "'exp'", "]", ")", "arg_8", ".", "eval", "(", "arg_3", ")", "arg_4", ".", "append", "(", "arg_8", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Computes the resulting metadata statement from a compounded metadata\n        statement.\n        If something goes wrong during the evaluation an exception is raised\n\n        :param metadata: The compounded metadata statement as a dictionary\n        :return: A list of :py:class:`fedoidc.operator.LessOrEqual` \n            instances, one per FO.\n        \"\"\"\n\n        # start from the innermost metadata statement and work outwards\n\n        arg_3 = dict([(k, v) for k, v in arg_1.items() if k not in IgnoreKeys])\n\n        arg_4 = []\n\n        if 'metadata_statements' in arg_1:\n            for arg_5, arg_6 in arg_1['metadata_statements'].items():\n                if isinstance(arg_6, str):\n                    arg_6 = json.loads(arg_6)\n                for arg_7 in arg_0.Func(arg_6):\n                    if isinstance(arg_6, Message):\n                        arg_8 = LessOrEqual(sup=arg_7, **arg_6.to_dict())\n                    else:  # Must be a dict\n                        arg_8 = LessOrEqual(sup=arg_7, **arg_6)\n\n                    if arg_8.is_expired():\n                        logger.error(\n                            'This metadata statement has expired: {}'.format(arg_6)\n                        )\n                        logger.info('My time: {}'.format(utc_time_sans_frac()))\n                        continue\n                    arg_8.eval(arg_3)\n                    arg_4.append(arg_8)\n            return arg_4\n        else:  # this is the innermost\n            try:\n                arg_9 = arg_1['iss']\n            except:\n                arg_8 = LessOrEqual()\n                arg_8.eval(arg_3)\n            else:\n                arg_8 = LessOrEqual(iss=arg_9, exp=arg_1['exp'])\n                arg_8.eval(arg_3)\n            arg_4.append(arg_8)\n            return arg_4", "path": "src/fedoidcmsg/operator.py", "identifier": "Operator.evaluate_metadata_statement", "docstring": "Computes the resulting metadata statement from a compounded metadata\n        statement.\n        If something goes wrong during the evaluation an exception is raised\n\n        :param metadata: The compounded metadata statement as a dictionary\n        :return: A list of :py:class:`fedoidc.operator.LessOrEqual` \n            instances, one per FO.", "docstring_tokens": ["Computes", "the", "resulting", "metadata", "statement", "from", "a", "compounded", "metadata", "statement", ".", "If", "something", "goes", "wrong", "during", "the", "evaluation", "an", "exception", "is", "raised"], "nwo": "IdentityPython/fedoidcmsg", "score": 0.09252797783733271, "idx": 253067}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/clientstream.py#L84-L95", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Fix outgoing stanza.", "language": "python", "parameters": "(self, stanza)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "StreamBase", ".", "Func", "(", "arg_0", ",", "arg_1", ")", "if", "arg_0", ".", "initiator", ":", "if", "arg_1", ".", "from_jid", ":", "arg_1", ".", "from_jid", "=", "None", "else", ":", "if", "not", "arg_1", ".", "from_jid", ":", "arg_1", ".", "from_jid", "=", "arg_0", ".", "me"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Fix outgoing stanza.\n\n        On a client clear the sender JID. On a server set the sender\n        address to the own JID if the address is not set yet.\"\"\"\n        StreamBase.Func(arg_0, arg_1)\n        if arg_0.initiator:\n            if arg_1.from_jid:\n                arg_1.from_jid = None\n        else:\n            if not arg_1.from_jid:\n                arg_1.from_jid = arg_0.me", "path": "pyxmpp2/clientstream.py", "identifier": "ClientStream.fix_out_stanza", "docstring": "Fix outgoing stanza.\n\n        On a client clear the sender JID. On a server set the sender\n        address to the own JID if the address is not set yet.", "docstring_tokens": ["Fix", "outgoing", "stanza", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253068}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/tv.py#L373-L384", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the cast & crew credits for a TV season by season number.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_series_id_season_number_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the cast & crew Func for a TV season by season number.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_series_id_season_number_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/tv.py", "identifier": "TV_Seasons.credits", "docstring": "Get the cast & crew credits for a TV season by season number.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "cast", "&", "crew", "credits", "for", "a", "TV", "season", "by", "season", "number", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 253069}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L53-L58", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a Google MLEngine service object.", "language": "python", "parameters": "(self)", "return_statement": "return build('ml', 'v1', http=authed_http, cache_discovery=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_authorize", "(", ")", "return", "build", "(", "'ml'", ",", "'v1'", ",", "http", "=", "arg_1", ",", "cache_discovery", "=", "False", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a Google MLEngine service object.\n        \"\"\"\n        arg_1 = arg_0._authorize()\n        return build('ml', 'v1', http=arg_1, cache_discovery=False)", "path": "airflow/contrib/hooks/gcp_mlengine_hook.py", "identifier": "MLEngineHook.get_conn", "docstring": "Returns a Google MLEngine service object.", "docstring_tokens": ["Returns", "a", "Google", "MLEngine", "service", "object", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253070}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/eval.py#L415-L452", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Convert a pattern_jku annotation object to mir_eval format.", "language": "python", "parameters": "(ann)", "return_statement": "return [list(_.values()) for _ in six.itervalues(patterns)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "defaultdict", "(", "lambda", ":", "defaultdict", "(", "list", ")", ")", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "*", "arg_0", ".", "to_event_values", "(", ")", ")", ":", "arg_4", "=", "arg_3", "[", "'pattern_id'", "]", "arg_5", "=", "arg_3", "[", "'occurrence_id'", "]", "arg_6", "=", "(", "arg_2", ",", "arg_3", "[", "'midi_pitch'", "]", ")", "arg_1", "[", "arg_4", "]", "[", "arg_5", "]", ".", "append", "(", "arg_6", ")", "return", "[", "list", "(", "arg_7", ".", "values", "(", ")", ")", "for", "arg_7", "in", "six", ".", "itervalues", "(", "arg_1", ")", "]"], "function": "def Func(arg_0):\n    '''Convert a pattern_jku annotation object to mir_eval format.\n\n    Parameters\n    ----------\n    ann : jams.Annotation\n        Must have `namespace='pattern_jku'`\n\n    Returns\n    -------\n    patterns : list of list of tuples\n        - `patterns[x]` is a list containing all occurrences of pattern x\n\n        - `patterns[x][y]` is a list containing all notes for\n           occurrence y of pattern x\n\n        - `patterns[x][y][z]` contains a time-note tuple\n          `(time, midi note)`\n    '''\n\n    # It's easier to work with dictionaries, since we can't assume\n    # sequential pattern or occurrence identifiers\n\n    arg_1 = defaultdict(lambda: defaultdict(list))\n\n    # Iterate over the data in interval-value format\n\n    for arg_2, arg_3 in zip(*arg_0.to_event_values()):\n\n        arg_4 = arg_3['pattern_id']\n        arg_5 = arg_3['occurrence_id']\n        arg_6 = (arg_2, arg_3['midi_pitch'])\n\n        # Push this note observation into the correct pattern/occurrence\n        arg_1[arg_4][arg_5].append(arg_6)\n\n    # Convert to list-list-tuple format for mir_eval\n    return [list(arg_7.values()) for arg_7 in six.itervalues(arg_1)]", "path": "jams/eval.py", "identifier": "pattern_to_mireval", "docstring": "Convert a pattern_jku annotation object to mir_eval format.\n\n    Parameters\n    ----------\n    ann : jams.Annotation\n        Must have `namespace='pattern_jku'`\n\n    Returns\n    -------\n    patterns : list of list of tuples\n        - `patterns[x]` is a list containing all occurrences of pattern x\n\n        - `patterns[x][y]` is a list containing all notes for\n           occurrence y of pattern x\n\n        - `patterns[x][y][z]` contains a time-note tuple\n          `(time, midi note)`", "docstring_tokens": ["Convert", "a", "pattern_jku", "annotation", "object", "to", "mir_eval", "format", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253071}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/recurrent.py#L561-L563", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "State size of the LSTMStateTuple.", "language": "python", "parameters": "(self)", "return_statement": "return (LSTMStateTuple(self._num_units, self._num_units) if self._state_is_tuple else 2 * self._num_units)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "LSTMStateTuple", "(", "arg_0", ".", "_num_units", ",", "arg_0", ".", "_num_units", ")", "if", "arg_0", ".", "_state_is_tuple", "else", "2", "*", "arg_0", ".", "_num_units", ")"], "function": "def Func(arg_0):\n        \"\"\"State size of the LSTMStateTuple.\"\"\"\n        return (LSTMStateTuple(arg_0._num_units, arg_0._num_units) if arg_0._state_is_tuple else 2 * arg_0._num_units)", "path": "tensorlayer/layers/recurrent.py", "identifier": "BasicConvLSTMCell.state_size", "docstring": "State size of the LSTMStateTuple.", "docstring_tokens": ["State", "size", "of", "the", "LSTMStateTuple", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253072}
{"url": "https://github.com/mk-fg/python-onedrive/blob/74d3f6605b0e8a9031a2aab8092f551293ffb533/onedrive/api_v5.py#L409-L413", "sha": "74d3f6605b0e8a9031a2aab8092f551293ffb533", "docstring_summary": "Returns \"id\" of a OneDrive user.", "language": "python", "parameters": "(self)", "return_statement": "return self._user_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_user_id", "is", "None", ":", "arg_0", ".", "_user_id", "=", "arg_0", ".", "get_user_data", "(", ")", "[", "'id'", "]", "return", "arg_0", ".", "_user_id"], "function": "def Func(arg_0):\n\t\t'Returns \"id\" of a OneDrive user.'\n\t\tif arg_0._user_id is None:\n\t\t\targ_0._user_id = arg_0.get_user_data()['id']\n\t\treturn arg_0._user_id", "path": "onedrive/api_v5.py", "identifier": "OneDriveAPIWrapper.get_user_id", "docstring": "Returns \"id\" of a OneDrive user.", "docstring_tokens": ["Returns", "id", "of", "a", "OneDrive", "user", "."], "nwo": "mk-fg/python-onedrive", "score": 0.3204703910366837, "idx": 253073}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L2647-L2730", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Loads a node from hdf5 file and if desired recursively everything below", "language": "python", "parameters": "(self, parent_traj_node, load_data, with_links, recursive,\n                         max_depth, current_depth, trajectory, as_new, hdf5_group)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", ":", "if", "arg_5", "is", "None", ":", "arg_5", "=", "float", "(", "'inf'", ")", "arg_10", "=", "[", "(", "arg_1", ",", "arg_6", ",", "arg_9", ")", "]", "while", "arg_10", ":", "arg_1", ",", "arg_6", ",", "arg_9", "=", "arg_10", ".", "pop", "(", ")", "if", "isinstance", "(", "arg_9", ",", "pt", ".", "link", ".", "SoftLink", ")", ":", "if", "arg_3", ":", "arg_0", ".", "_tree_load_link", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "traj", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "hdf5_soft_link", "=", "arg_9", ")", "continue", "arg_11", "=", "arg_9", ".", "_v_name", "arg_12", "=", "arg_0", ".", "_all_get_from_attrs", "(", "arg_9", ",", "HDF5StorageService", ".", "LEAF", ")", "arg_13", "=", "arg_11", "in", "arg_1", ".", "_children", "if", "arg_12", ":", "if", "arg_13", ":", "arg_14", "=", "arg_1", ".", "_children", "[", "arg_11", "]", "else", ":", "arg_14", "=", "arg_0", ".", "_tree_create_leaf", "(", "arg_11", ",", "arg_7", ",", "arg_9", ")", "arg_1", ".", "_add_leaf_from_storage", "(", "arg_20", "=", "(", "arg_14", ",", ")", ",", "kwargs", "=", "{", "}", ")", "arg_0", ".", "_prm_load_parameter_or_result", "(", "arg_14", ",", "arg_2", "=", "arg_2", ",", "_hdf5_group", "=", "arg_9", ")", "if", "arg_8", ":", "arg_14", ".", "_stored", "=", "False", "else", ":", "if", "arg_13", ":", "arg_16", "=", "arg_1", ".", "_children", "[", "arg_11", "]", "if", "arg_2", "==", "pypetconstants", ".", "OVERWRITE_DATA", ":", "arg_16", ".", "v_annotations", ".", "f_empty", "(", ")", "arg_16", ".", "v_comment", "=", "''", "else", ":", "if", "HDF5StorageService", ".", "CLASS_NAME", "in", "arg_9", ".", "_v_attrs", ":", "arg_18", "=", "arg_0", ".", "_all_get_from_attrs", "(", "arg_9", ",", "HDF5StorageService", ".", "CLASS_NAME", ")", "arg_19", "=", "arg_7", ".", "_create_class", "(", "arg_18", ")", "arg_14", "=", "arg_7", ".", "_construct_instance", "(", "arg_19", ",", "arg_11", ")", "arg_20", "=", "(", "arg_14", ",", ")", "else", ":", "arg_20", "=", "(", "arg_11", ",", ")", "arg_16", "=", "arg_1", ".", "_add_group_from_storage", "(", "arg_20", "=", "arg_20", ",", "kwargs", "=", "{", "}", ")", "arg_0", ".", "_grp_load_group", "(", "arg_16", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "False", ",", "arg_5", "=", "arg_5", ",", "_traj", "=", "arg_7", ",", "_as_new", "=", "arg_8", ",", "_hdf5_group", "=", "arg_9", ")", "if", "arg_4", "and", "arg_6", "<", "arg_5", ":", "arg_21", "=", "arg_6", "+", "1", "for", "arg_22", "in", "(", "arg_9", ".", "_v_groups", ",", "arg_9", ".", "_v_links", ")", ":", "for", "arg_23", "in", "arg_22", ":", "arg_24", "=", "arg_22", "[", "arg_23", "]", "arg_10", ".", "append", "(", "(", "arg_16", ",", "arg_21", ",", "arg_24", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                         arg_5, arg_6, arg_7, arg_8, arg_9):\n        \"\"\"Loads a node from hdf5 file and if desired recursively everything below\n\n        :param parent_traj_node: The parent node whose child should be loaded\n        :param load_data: How to load the data\n        :param with_links: If links should be loaded\n        :param recursive: Whether loading recursively below hdf5_group\n        :param max_depth: Maximum depth\n        :param current_depth: Current depth\n        :param trajectory: The trajectory object\n        :param as_new: If trajectory is loaded as new\n        :param hdf5_group: The hdf5 group containing the child to be loaded\n\n        \"\"\"\n        if arg_5 is None:\n            arg_5 = float('inf')\n\n        arg_10 = [(arg_1, arg_6, arg_9)]\n\n        while arg_10:\n            arg_1, arg_6, arg_9 = arg_10.pop()\n\n            if isinstance(arg_9, pt.link.SoftLink):\n                if arg_3:\n                    # We end up here when auto-loading a soft link\n                    arg_0._tree_load_link(arg_1, arg_2=arg_2, traj=arg_7,\n                                         arg_8=arg_8, hdf5_soft_link=arg_9)\n                continue\n\n\n            arg_11 = arg_9._v_name\n            arg_12 = arg_0._all_get_from_attrs(arg_9, HDF5StorageService.LEAF)\n            arg_13 = arg_11 in arg_1._children\n\n            if arg_12:\n                # In case we have a leaf node, we need to check if we have to create a new\n                # parameter or result\n\n                if arg_13:\n                    arg_14 = arg_1._children[arg_11]\n                # Otherwise we need to create a new instance\n                else:\n                    arg_14 = arg_0._tree_create_leaf(arg_11, arg_7, arg_9)\n\n                    # Add the instance to the trajectory tree\n                    arg_1._add_leaf_from_storage(arg_20=(arg_14,), kwargs={})\n\n                arg_0._prm_load_parameter_or_result(arg_14, arg_2=arg_2,\n                                                   _hdf5_group=arg_9)\n                if arg_8:\n                    arg_14._stored = False\n\n            else:\n                if arg_13:\n                    arg_16 = arg_1._children[arg_11]\n\n                    if arg_2 == pypetconstants.OVERWRITE_DATA:\n                        arg_16.v_annotations.f_empty()\n                        arg_16.v_comment = ''\n                else:\n                    if HDF5StorageService.CLASS_NAME in arg_9._v_attrs:\n                        arg_18 = arg_0._all_get_from_attrs(arg_9,\n                                                              HDF5StorageService.CLASS_NAME)\n                        arg_19 = arg_7._create_class(arg_18)\n                        arg_14 = arg_7._construct_instance(arg_19, arg_11)\n                        arg_20 = (arg_14,)\n                    else:\n                        arg_20 = (arg_11,)\n                    # If the group does not exist create it'\n                    arg_16 = arg_1._add_group_from_storage(arg_20=arg_20, kwargs={})\n\n                # Load annotations and comment\n                arg_0._grp_load_group(arg_16, arg_2=arg_2, arg_3=arg_3,\n                                     arg_4=False, arg_5=arg_5,\n                                     _traj=arg_7, _as_new=arg_8,\n                                     _hdf5_group=arg_9)\n\n                if arg_4 and arg_6 < arg_5:\n                    arg_21 = arg_6 + 1\n                    for arg_22 in (arg_9._v_groups, arg_9._v_links):\n                        for arg_23 in arg_22:\n                            arg_24 = arg_22[arg_23]\n                            arg_10.append((arg_16, arg_21, arg_24))", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._tree_load_nodes_dfs", "docstring": "Loads a node from hdf5 file and if desired recursively everything below\n\n        :param parent_traj_node: The parent node whose child should be loaded\n        :param load_data: How to load the data\n        :param with_links: If links should be loaded\n        :param recursive: Whether loading recursively below hdf5_group\n        :param max_depth: Maximum depth\n        :param current_depth: Current depth\n        :param trajectory: The trajectory object\n        :param as_new: If trajectory is loaded as new\n        :param hdf5_group: The hdf5 group containing the child to be loaded", "docstring_tokens": ["Loads", "a", "node", "from", "hdf5", "file", "and", "if", "desired", "recursively", "everything", "below"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253074}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/utils.py#L191-L204", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Gets the IP from the inet interfaces.", "language": "python", "parameters": "()", "return_statement": "return own_ip", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "None", "arg_1", "=", "psutil", ".", "net_if_addrs", "(", ")", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "family", "==", "socket", ".", "AF_INET", ":", "arg_5", "=", "ipaddress", ".", "ip_address", "(", "arg_4", ".", "address", ")", "if", "not", "(", "arg_5", ".", "is_link_local", "or", "arg_5", ".", "is_loopback", ")", ":", "arg_0", "=", "str", "(", "arg_5", ")", "break", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n        Gets the IP from the inet interfaces.\n    \"\"\"\n    arg_0 = None\n    arg_1 = psutil.net_if_addrs()\n    for arg_2, arg_3 in arg_1.items():\n        for arg_4 in arg_3:\n            if arg_4.family == socket.AF_INET:\n                arg_5 = ipaddress.ip_address(arg_4.address)\n                if not (arg_5.is_link_local or arg_5.is_loopback):\n                    arg_0 = str(arg_5)\n                    break\n    return arg_0", "path": "jackal/utils.py", "identifier": "get_own_ip", "docstring": "Gets the IP from the inet interfaces.", "docstring_tokens": ["Gets", "the", "IP", "from", "the", "inet", "interfaces", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 253075}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3204-L3218", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a dictionary of all leaves hanging immediately below this group.", "language": "python", "parameters": "(self, copy=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", ":", "return", "arg_0", ".", "_leaves", ".", "copy", "(", ")", "else", ":", "return", "arg_0", ".", "_leaves"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Returns a dictionary of all leaves hanging immediately below this group.\n\n        :param copy:\n\n            Whether the group's original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n\n        :returns: Dictionary of nodes\n\n        \"\"\"\n        if arg_1:\n            return arg_0._leaves.copy()\n        else:\n            return arg_0._leaves", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_get_leaves", "docstring": "Returns a dictionary of all leaves hanging immediately below this group.\n\n        :param copy:\n\n            Whether the group's original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n\n        :returns: Dictionary of nodes", "docstring_tokens": ["Returns", "a", "dictionary", "of", "all", "leaves", "hanging", "immediately", "below", "this", "group", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253076}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_handler_mix_in.py#L33-L49", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "format an options section using as ReST formatted output", "language": "python", "parameters": "(stream, section, options, doc=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", ":", "print", "(", "\"%s\\n%s\"", "%", "(", "arg_1", ",", "\"'\"", "*", "len", "(", "arg_1", ")", ")", ",", "file", "=", "arg_0", ")", "if", "arg_3", ":", "print", "(", "normalize_text", "(", "arg_3", ",", "line_len", "=", "79", ",", "indent", "=", "\"\"", ")", ",", "file", "=", "arg_0", ")", "print", "(", "file", "=", "arg_0", ")", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "arg_2", ":", "arg_7", "=", "arg_5", ".", "get", "(", "\"help\"", ")", "print", "(", "\":%s:\"", "%", "arg_4", ",", "file", "=", "arg_0", ")", "if", "arg_7", ":", "arg_7", "=", "normalize_text", "(", "arg_7", ",", "line_len", "=", "79", ",", "indent", "=", "\"  \"", ")", "print", "(", "arg_7", ",", "file", "=", "arg_0", ")", "if", "arg_6", ":", "arg_6", "=", "str", "(", "_format_option_value", "(", "arg_5", ",", "arg_6", ")", ")", "print", "(", "file", "=", "arg_0", ")", "print", "(", "\"  Default: ``%s``\"", "%", "arg_6", ".", "replace", "(", "\"`` \"", ",", "\"```` ``\"", ")", ",", "file", "=", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"format an options section using as ReST formatted output\"\"\"\n    if arg_1:\n        print(\"%s\\n%s\" % (arg_1, \"'\" * len(arg_1)), file=arg_0)\n    if arg_3:\n        print(normalize_text(arg_3, line_len=79, indent=\"\"), file=arg_0)\n        print(file=arg_0)\n    for arg_4, arg_5, arg_6 in arg_2:\n        arg_7 = arg_5.get(\"help\")\n        print(\":%s:\" % arg_4, file=arg_0)\n        if arg_7:\n            arg_7 = normalize_text(arg_7, line_len=79, indent=\"  \")\n            print(arg_7, file=arg_0)\n        if arg_6:\n            arg_6 = str(_format_option_value(arg_5, arg_6))\n            print(file=arg_0)\n            print(\"  Default: ``%s``\" % arg_6.replace(\"`` \", \"```` ``\"), file=arg_0)", "path": "pylint/message/message_handler_mix_in.py", "identifier": "_rest_format_section", "docstring": "format an options section using as ReST formatted output", "docstring_tokens": ["format", "an", "options", "section", "using", "as", "ReST", "formatted", "output"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253077}
{"url": "https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/__init__.py#L67-L80", "sha": "5b90a543b127ab9e6112fd547929b5ef4b8f0cbc", "docstring_summary": "Returns a normalized house code, i.e. upper case.\n    Raises exception X10InvalidHouseCode if house code appears to be invalid", "language": "python", "parameters": "(house_code)", "return_statement": "return house_code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "raise", "X10InvalidHouseCode", "(", "'%r is not a valid house code'", "%", "arg_0", ")", "if", "not", "isinstance", "(", "arg_0", ",", "basestring", ")", ":", "raise", "X10InvalidHouseCode", "(", "'%r is not a valid house code'", "%", "arg_0", ")", "if", "len", "(", "arg_0", ")", "!=", "1", ":", "raise", "X10InvalidHouseCode", "(", "'%r is not a valid house code'", "%", "arg_0", ")", "arg_0", "=", "arg_0", ".", "upper", "(", ")", "if", "not", "(", "'A'", "<=", "arg_0", "<=", "'P'", ")", ":", "raise", "X10InvalidHouseCode", "(", "'%r is not a valid house code'", "%", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Returns a normalized house code, i.e. upper case.\n    Raises exception X10InvalidHouseCode if house code appears to be invalid\n    \"\"\"\n    if arg_0 is None:\n        raise X10InvalidHouseCode('%r is not a valid house code' % arg_0)\n    if not isinstance(arg_0, basestring):\n        raise X10InvalidHouseCode('%r is not a valid house code' % arg_0)\n    if len(arg_0) != 1:\n        raise X10InvalidHouseCode('%r is not a valid house code' % arg_0)\n    arg_0 = arg_0.upper()\n    if not ('A' <= arg_0 <= 'P'):\n        raise X10InvalidHouseCode('%r is not a valid house code' % arg_0)\n    return arg_0", "path": "x10_any/__init__.py", "identifier": "normalize_housecode", "docstring": "Returns a normalized house code, i.e. upper case.\n    Raises exception X10InvalidHouseCode if house code appears to be invalid", "docstring_tokens": ["Returns", "a", "normalized", "house", "code", "i", ".", "e", ".", "upper", "case", ".", "Raises", "exception", "X10InvalidHouseCode", "if", "house", "code", "appears", "to", "be", "invalid"], "nwo": "clach04/x10_any", "score": 0.2751458370028208, "idx": 253078}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/__init__.py#L230-L235", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Stop logging to logfile and console.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "from", ".", "import", "log", "arg_0", "=", "logging", ".", "getLogger", "(", "\"gromacs\"", ")", "arg_0", ".", "info", "(", "\"GromacsWrapper %s STOPPED logging\"", ",", "get_version", "(", ")", ")", "log", ".", "clear_handlers", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"Stop logging to logfile and console.\"\"\"\n    from . import log\n    arg_0 = logging.getLogger(\"gromacs\")\n    arg_0.info(\"GromacsWrapper %s STOPPED logging\", get_version())\n    log.clear_handlers(arg_0)", "path": "gromacs/__init__.py", "identifier": "stop_logging", "docstring": "Stop logging to logfile and console.", "docstring_tokens": ["Stop", "logging", "to", "logfile", "and", "console", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 253079}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/agents.py#L181-L191", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "An agent that keeps track of what locations are clean or dirty.", "language": "python", "parameters": "()", "return_statement": "return Agent(program)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "{", "loc_A", ":", "None", ",", "loc_B", ":", "None", "}", "def", "program", "(", "(", "arg_1", ",", "arg_2", ")", ")", ":", "arg_0", "[", "arg_1", "]", "=", "arg_2", "if", "arg_0", "[", "loc_A", "]", "==", "arg_0", "[", "loc_B", "]", "==", "'Clean'", ":", "return", "'NoOp'", "elif", "arg_2", "==", "'Dirty'", ":", "return", "'Suck'", "elif", "arg_1", "==", "loc_A", ":", "return", "'Right'", "elif", "arg_1", "==", "loc_B", ":", "return", "'Left'", "return", "Agent", "(", "program", ")"], "function": "def Func():\n    \"An agent that keeps track of what locations are clean or dirty.\"\n    arg_0 = {loc_A: None, loc_B: None}\n    def program((arg_1, arg_2)):\n        \"Same as ReflexVacuumAgent, except if everything is clean, do NoOp.\"\n        arg_0[arg_1] = arg_2 ## Update the model here\n        if arg_0[loc_A] == arg_0[loc_B] == 'Clean': return 'NoOp'\n        elif arg_2 == 'Dirty': return 'Suck'\n        elif arg_1 == loc_A: return 'Right'\n        elif arg_1 == loc_B: return 'Left'\n    return Agent(program)", "path": "aima/agents.py", "identifier": "ModelBasedVacuumAgent", "docstring": "An agent that keeps track of what locations are clean or dirty.", "docstring_tokens": ["An", "agent", "that", "keeps", "track", "of", "what", "locations", "are", "clean", "or", "dirty", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 253080}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L277-L290", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Removes the data center and all its components such as servers, NICs,\n        load balancers, volumes.", "language": "python", "parameters": "(self, datacenter_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s'", "%", "(", "arg_1", ")", ",", "method", "=", "'DELETE'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Removes the data center and all its components such as servers, NICs,\n        load balancers, volumes.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        \"\"\"\n        arg_2 = arg_0._perform_request(\n            url='/datacenters/%s' % (arg_1),\n            method='DELETE')\n\n        return arg_2", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.delete_datacenter", "docstring": "Removes the data center and all its components such as servers, NICs,\n        load balancers, volumes.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``", "docstring_tokens": ["Removes", "the", "data", "center", "and", "all", "its", "components", "such", "as", "servers", "NICs", "load", "balancers", "volumes", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 253081}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/namespace_manager.py#L306-L311", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Add this manager as an annotation to the graph.", "language": "python", "parameters": "(self, graph: BELGraph)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "None", ":", "if", "'bio2bel'", "not", "in", "arg_1", ".", "annotation_list", ":", "arg_1", ".", "annotation_list", "[", "'bio2bel'", "]", "=", "set", "(", ")", "arg_1", ".", "annotation_list", "[", "'bio2bel'", "]", ".", "add", "(", "arg_0", ".", "module_name", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> None:\n        \"\"\"Add this manager as an annotation to the graph.\"\"\"\n        if 'bio2bel' not in arg_1.annotation_list:\n            arg_1.annotation_list['bio2bel'] = set()\n\n        arg_1.annotation_list['bio2bel'].add(arg_0.module_name)", "path": "src/bio2bel/manager/namespace_manager.py", "identifier": "BELNamespaceManagerMixin._add_annotation_to_graph", "docstring": "Add this manager as an annotation to the graph.", "docstring_tokens": ["Add", "this", "manager", "as", "an", "annotation", "to", "the", "graph", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 253082}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/helpers.py#L52-L68", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get the data sharing consent object associated with a certain user of a customer for a program.", "language": "python", "parameters": "(username, program_uuid, enterprise_customer_uuid)", "return_statement": "return ProxyDataSharingConsent.from_children(program_uuid, *child_consents)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "get_enterprise_customer", "(", "arg_2", ")", "arg_4", "=", "CourseCatalogApiServiceClient", "(", "arg_3", ".", "site", ")", "arg_5", "=", "arg_4", ".", "get_program_course_keys", "(", "arg_1", ")", "arg_6", "=", "(", "get_data_sharing_consent", "(", "arg_0", ",", "arg_2", ",", "course_id", "=", "individual_course_id", ")", "for", "individual_course_id", "in", "arg_5", ")", "return", "ProxyDataSharingConsent", ".", "from_children", "(", "arg_1", ",", "*", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Get the data sharing consent object associated with a certain user of a customer for a program.\n\n    :param username: The user that grants consent.\n    :param program_uuid: The program for which consent is granted.\n    :param enterprise_customer_uuid: The consent requester.\n    :return: The data sharing consent object\n    \"\"\"\n    arg_3 = get_enterprise_customer(arg_2)\n    arg_4 = CourseCatalogApiServiceClient(arg_3.site)\n    arg_5 = arg_4.get_program_course_keys(arg_1)\n    arg_6 = (\n        get_data_sharing_consent(arg_0, arg_2, course_id=individual_course_id)\n        for individual_course_id in arg_5\n    )\n    return ProxyDataSharingConsent.from_children(arg_1, *arg_6)", "path": "consent/helpers.py", "identifier": "get_program_data_sharing_consent", "docstring": "Get the data sharing consent object associated with a certain user of a customer for a program.\n\n    :param username: The user that grants consent.\n    :param program_uuid: The program for which consent is granted.\n    :param enterprise_customer_uuid: The consent requester.\n    :return: The data sharing consent object", "docstring_tokens": ["Get", "the", "data", "sharing", "consent", "object", "associated", "with", "a", "certain", "user", "of", "a", "customer", "for", "a", "program", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253083}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L400-L416", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Change of basis of bipartite matrix represenation.", "language": "python", "parameters": "(data, num_qubits)", "return_statement": "return np.dot(np.dot(cob, data), cob.conj().T) / 2**num_qubits", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "array", "(", "[", "[", "1", ",", "0", ",", "0", ",", "1", "]", ",", "[", "0", ",", "1", ",", "1j", ",", "0", "]", ",", "[", "0", ",", "1", ",", "-", "1j", ",", "0", "]", ",", "[", "1", ",", "0j", ",", "0", ",", "-", "1", "]", "]", ",", "dtype", "=", "complex", ")", "arg_3", "=", "arg_2", "for", "arg_4", "in", "range", "(", "arg_1", "-", "1", ")", ":", "arg_5", "=", "int", "(", "np", ".", "sqrt", "(", "len", "(", "arg_3", ")", ")", ")", "arg_3", "=", "np", ".", "reshape", "(", "np", ".", "transpose", "(", "np", ".", "reshape", "(", "np", ".", "kron", "(", "arg_2", ",", "arg_3", ")", ",", "(", "2", ",", "2", ",", "arg_5", ",", "arg_5", ",", "4", ",", "arg_5", "*", "arg_5", ")", ")", ",", "(", "0", ",", "2", ",", "1", ",", "3", ",", "4", ",", "5", ")", ")", ",", "(", "4", "*", "arg_5", "*", "arg_5", ",", "4", "*", "arg_5", "*", "arg_5", ")", ")", "return", "np", ".", "dot", "(", "np", ".", "dot", "(", "arg_3", ",", "arg_0", ")", ",", "arg_3", ".", "conj", "(", ")", ".", "T", ")", "/", "2", "**", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Change of basis of bipartite matrix represenation.\"\"\"\n    # Change basis: sum_{i=0}^3 =|\\sigma_i>><i|\n    arg_2 = np.array(\n        [[1, 0, 0, 1], [0, 1, 1j, 0], [0, 1, -1j, 0], [1, 0j, 0, -1]],\n        dtype=complex)\n    # Note that we manually renormalized after change of basis\n    # to avoid rounding errors from square-roots of 2.\n    arg_3 = arg_2\n    for arg_4 in range(arg_1 - 1):\n        arg_5 = int(np.sqrt(len(arg_3)))\n        arg_3 = np.reshape(\n            np.transpose(\n                np.reshape(\n                    np.kron(arg_2, arg_3), (2, 2, arg_5, arg_5, 4, arg_5 * arg_5)),\n                (0, 2, 1, 3, 4, 5)), (4 * arg_5 * arg_5, 4 * arg_5 * arg_5))\n    return np.dot(np.dot(arg_3, arg_0), arg_3.conj().T) / 2**arg_1", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_transform_from_pauli", "docstring": "Change of basis of bipartite matrix represenation.", "docstring_tokens": ["Change", "of", "basis", "of", "bipartite", "matrix", "represenation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253084}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/toeplitz.py#L84-L134", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "solve Tx=Z by a variation of Levinson algorithm where T \n    is a complex hermitian toeplitz matrix", "language": "python", "parameters": "(T0, T, Z)", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "len", "(", "arg_1", ")", ">", "0", "arg_3", "=", "len", "(", "arg_1", ")", "arg_4", "=", "numpy", ".", "zeros", "(", "arg_3", "+", "1", ",", "dtype", "=", "complex", ")", "arg_5", "=", "numpy", ".", "zeros", "(", "arg_3", ",", "dtype", "=", "complex", ")", "arg_6", "=", "arg_0", "if", "arg_6", "==", "0", ":", "raise", "ValueError", "(", "\"P must be different from zero\"", ")", "arg_4", "[", "0", "]", "=", "arg_2", "[", "0", "]", "/", "arg_0", "for", "arg_7", "in", "range", "(", "0", ",", "arg_3", ")", ":", "arg_8", "=", "arg_1", "[", "arg_7", "]", "arg_9", "=", "arg_4", "[", "0", "]", "*", "arg_1", "[", "arg_7", "]", "if", "arg_7", "==", "0", ":", "arg_10", "=", "-", "arg_8", "/", "arg_6", "else", ":", "for", "arg_11", "in", "range", "(", "0", ",", "arg_7", ")", ":", "arg_8", "=", "arg_8", "+", "arg_5", "[", "arg_11", "]", "*", "arg_1", "[", "arg_7", "-", "arg_11", "-", "1", "]", "arg_9", "=", "arg_9", "+", "arg_4", "[", "arg_11", "+", "1", "]", "*", "arg_1", "[", "arg_7", "-", "arg_11", "-", "1", "]", "arg_10", "=", "-", "arg_8", "/", "arg_6", "arg_6", "=", "arg_6", "*", "(", "1.", "-", "(", "arg_10", ".", "real", "**", "2", "+", "arg_10", ".", "imag", "**", "2", ")", ")", "if", "arg_6", "<=", "0", ":", "raise", "ValueError", "(", "\"singular matrix\"", ")", "arg_5", "[", "arg_7", "]", "=", "arg_10", "arg_12", "=", "(", "arg_2", "[", "arg_7", "+", "1", "]", "-", "arg_9", ")", "/", "arg_6", "if", "arg_7", "==", "0", ":", "arg_4", "[", "arg_7", "+", "1", "]", "=", "arg_12", "for", "arg_11", "in", "range", "(", "0", ",", "arg_7", "+", "1", ")", ":", "arg_4", "[", "arg_11", "]", "=", "arg_4", "[", "arg_11", "]", "+", "arg_12", "*", "arg_5", "[", "arg_7", "-", "arg_11", "]", ".", "conjugate", "(", ")", "continue", "arg_13", "=", "(", "arg_7", "+", "1", ")", "//", "2", "for", "arg_11", "in", "range", "(", "0", ",", "arg_13", ")", ":", "arg_14", "=", "arg_7", "-", "arg_11", "-", "1", "arg_8", "=", "arg_5", "[", "arg_11", "]", "arg_5", "[", "arg_11", "]", "=", "arg_8", "+", "arg_10", "*", "arg_5", "[", "arg_14", "]", ".", "conjugate", "(", ")", "if", "arg_11", "!=", "arg_14", ":", "arg_5", "[", "arg_14", "]", "=", "arg_5", "[", "arg_14", "]", "+", "arg_10", "*", "arg_8", ".", "conjugate", "(", ")", "arg_4", "[", "arg_7", "+", "1", "]", "=", "arg_12", "for", "arg_11", "in", "range", "(", "0", ",", "arg_7", "+", "1", ")", ":", "arg_4", "[", "arg_11", "]", "=", "arg_4", "[", "arg_11", "]", "+", "arg_12", "*", "arg_5", "[", "arg_7", "-", "arg_11", "]", ".", "conjugate", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"solve Tx=Z by a variation of Levinson algorithm where T \n    is a complex hermitian toeplitz matrix\n\n    :param T0: zero lag value\n    :param T: r1 to rN\n     \n    :return: X\n    \n    used by eigen PSD method\n    \"\"\"\n    assert len(arg_1)>0\n    arg_3 = len(arg_1)\n    arg_4 = numpy.zeros(arg_3+1,dtype=complex)\n    arg_5 = numpy.zeros(arg_3,dtype=complex)\n    arg_6 = arg_0\n    if arg_6 == 0: raise ValueError(\"P must be different from zero\")\n    arg_4[0] = arg_2[0]/arg_0 \n    for arg_7 in range(0, arg_3):\n        arg_8 = arg_1[arg_7]\n        arg_9 = arg_4[0]*arg_1[arg_7]\n        if arg_7 == 0:\n            arg_10 = -arg_8 / arg_6\n        else:\n            for arg_11 in range(0, arg_7):\n                arg_8 = arg_8 + arg_5[arg_11] * arg_1[arg_7-arg_11-1]\n                arg_9 = arg_9 + arg_4[arg_11+1] * arg_1[arg_7-arg_11-1]\n            arg_10 = -arg_8 / arg_6\n        arg_6 = arg_6 * (1. - (arg_10.real**2+arg_10.imag**2))\n        if arg_6 <= 0:\n            raise ValueError(\"singular matrix\")\n        arg_5[arg_7] = arg_10\n        arg_12 = (arg_2[arg_7+1]-arg_9)/arg_6\n\n        if arg_7 == 0:\n            #print 'skipping code for k=0' \n            arg_4[arg_7+1] = arg_12\n            for arg_11 in range(0,arg_7+1):\n                arg_4[arg_11] = arg_4[arg_11] + arg_12 * arg_5[arg_7-arg_11].conjugate()\n            continue\n        arg_13 = (arg_7+1)//2\n        for arg_11 in range(0, arg_13):\n            arg_14 = arg_7-arg_11-1\n            arg_8=arg_5[arg_11]\n            arg_5[arg_11] = arg_8+arg_10*arg_5[arg_14].conjugate() \n            if arg_11 != arg_14:\n                arg_5[arg_14] = arg_5[arg_14] + arg_10*arg_8.conjugate()\n        arg_4[arg_7+1] = arg_12\n        for arg_11 in range(0,arg_7+1):\n            arg_4[arg_11] = arg_4[arg_11] + arg_12 * arg_5[arg_7-arg_11].conjugate()\n    return arg_4", "path": "src/spectrum/toeplitz.py", "identifier": "HERMTOEP", "docstring": "solve Tx=Z by a variation of Levinson algorithm where T \n    is a complex hermitian toeplitz matrix\n\n    :param T0: zero lag value\n    :param T: r1 to rN\n     \n    :return: X\n    \n    used by eigen PSD method", "docstring_tokens": ["solve", "Tx", "=", "Z", "by", "a", "variation", "of", "Levinson", "algorithm", "where", "T", "is", "a", "complex", "hermitian", "toeplitz", "matrix"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 253085}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L311-L320", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "write_file will open a file, \"filename\" and write content, \"content\"\n       and properly close the file", "language": "python", "parameters": "(filename, mode=\"r\", readlines=True)", "return_statement": "return content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"r\"", ",", "arg_2", "=", "True", ")", ":", "with", "open", "(", "arg_0", ",", "arg_1", ")", "as", "filey", ":", "if", "arg_2", "is", "True", ":", "arg_3", "=", "filey", ".", "readlines", "(", ")", "else", ":", "arg_3", "=", "filey", ".", "read", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=\"r\", arg_2=True):\n    '''write_file will open a file, \"filename\" and write content, \"content\"\n       and properly close the file\n    '''\n    with open(arg_0, arg_1) as filey:\n        if arg_2 is True:\n            arg_3 = filey.readlines()\n        else:\n            arg_3 = filey.read()\n    return arg_3", "path": "sregistry/utils/fileio.py", "identifier": "read_file", "docstring": "write_file will open a file, \"filename\" and write content, \"content\"\n       and properly close the file", "docstring_tokens": ["write_file", "will", "open", "a", "file", "filename", "and", "write", "content", "content", "and", "properly", "close", "the", "file"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 253086}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/memory_profiler.py#L167-L178", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Returns memory stats for a module.", "language": "python", "parameters": "(self)", "return_statement": "return prof, None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "arg_0", ".", "_run_object", "}", "try", ":", "with", "open", "(", "arg_0", ".", "_run_object", ",", "'rb'", ")", "as", "srcfile", ",", "_CodeEventsTracker", "(", "arg_1", ")", "as", "prof", ":", "arg_2", "=", "compile", "(", "srcfile", ".", "read", "(", ")", ",", "arg_0", ".", "_run_object", ",", "'exec'", ")", "prof", ".", "compute_mem_overhead", "(", ")", "exec", "(", "arg_2", ",", "arg_0", ".", "_globs", ",", "None", ")", "except", "SystemExit", ":", "pass", "return", "prof", ",", "None"], "function": "def Func(arg_0):\n        \"\"\"Returns memory stats for a module.\"\"\"\n        arg_1 = {arg_0._run_object}\n        try:\n            with open(arg_0._run_object, 'rb') as srcfile,\\\n                _CodeEventsTracker(arg_1) as prof:\n                arg_2 = compile(srcfile.read(), arg_0._run_object, 'exec')\n                prof.compute_mem_overhead()\n                exec(arg_2, arg_0._globs, None)\n        except SystemExit:\n            pass\n        return prof, None", "path": "vprof/memory_profiler.py", "identifier": "MemoryProfiler.profile_module", "docstring": "Returns memory stats for a module.", "docstring_tokens": ["Returns", "memory", "stats", "for", "a", "module", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 253087}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L255-L272", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "This endpoint sets the job's stability.", "language": "python", "parameters": "(self, id, version, stable)", "return_statement": "return self.request(id, \"stable\", json=revert_json, method=\"post\").json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "\"JobID\"", ":", "arg_1", ",", "\"JobVersion\"", ":", "arg_2", ",", "\"Stable\"", ":", "arg_3", "}", "return", "arg_0", ".", "request", "(", "arg_1", ",", "\"stable\"", ",", "json", "=", "arg_4", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" This endpoint sets the job's stability.\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n              - version, Specifies the job version to revert to.\n              - stable, Specifies whether the job should be marked as stable or not.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_4 = {\"JobID\": arg_1,\n                       \"JobVersion\": arg_2,\n                       \"Stable\": arg_3}\n        return arg_0.request(arg_1, \"stable\", json=arg_4, method=\"post\").json()", "path": "nomad/api/job.py", "identifier": "Job.stable_job", "docstring": "This endpoint sets the job's stability.\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n              - version, Specifies the job version to revert to.\n              - stable, Specifies whether the job should be marked as stable or not.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["This", "endpoint", "sets", "the", "job", "s", "stability", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 253088}
{"url": "https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L554-L560", "sha": "0dc47c8924fa3d9ab676c3a6e195f03f728b72c6", "docstring_summary": "Resets the iterator to the start.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "__iterator", ",", "arg_0", ".", "__saved", "=", "itertools", ".", "tee", "(", "arg_0", ".", "__saved", ")"], "function": "def Func(arg_0):\n\t\t\"\"\"\n\t\tResets the iterator to the start.\n\n\t\tAny remaining values in the current iteration are discarded.\n\t\t\"\"\"\n\t\targ_0.__iterator, arg_0.__saved = itertools.tee(arg_0.__saved)", "path": "jaraco/itertools.py", "identifier": "Reusable.reset", "docstring": "Resets the iterator to the start.\n\n\t\tAny remaining values in the current iteration are discarded.", "docstring_tokens": ["Resets", "the", "iterator", "to", "the", "start", "."], "nwo": "jaraco/jaraco.itertools", "score": 0.2751458370028208, "idx": 253089}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/typeinfo.py#L187-L203", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Given a potentially complex type, split it into its base type and specializers", "language": "python", "parameters": "(self, typename)", "return_statement": "return base, True, subs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_canonicalize_type", "(", "arg_1", ")", "if", "'('", "not", "in", "arg_2", ":", "return", "arg_2", ",", "False", ",", "[", "]", "arg_3", ",", "arg_4", "=", "arg_2", ".", "split", "(", "'('", ")", "if", "len", "(", "arg_4", ")", "==", "0", "or", "arg_4", "[", "-", "1", "]", "!=", "')'", ":", "raise", "ArgumentError", "(", "\"syntax error in complex type, no matching ) found\"", ",", "passed_type", "=", "arg_1", ",", "basetype", "=", "arg_3", ",", "subtype_string", "=", "arg_4", ")", "arg_4", "=", "arg_4", "[", ":", "-", "1", "]", "arg_5", "=", "arg_4", ".", "split", "(", "','", ")", "return", "arg_3", ",", "True", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Given a potentially complex type, split it into its base type and specializers\n        \"\"\"\n\n        arg_2 = arg_0._canonicalize_type(arg_1)\n        if '(' not in arg_2:\n            return arg_2, False, []\n\n        arg_3, arg_4 = arg_2.split('(')\n        if len(arg_4) == 0 or arg_4[-1] != ')':\n            raise ArgumentError(\"syntax error in complex type, no matching ) found\", passed_type=arg_1, basetype=arg_3, subtype_string=arg_4)\n\n        arg_4 = arg_4[:-1]\n\n        arg_5 = arg_4.split(',')\n        return arg_3, True, arg_5", "path": "typedargs/typeinfo.py", "identifier": "TypeSystem.split_type", "docstring": "Given a potentially complex type, split it into its base type and specializers", "docstring_tokens": ["Given", "a", "potentially", "complex", "type", "split", "it", "into", "its", "base", "type", "and", "specializers"], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 253090}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L219-L241", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Build an xsd schema from a bridgepoint component.", "language": "python", "parameters": "(m, c_c)", "return_statement": "return schema", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ET", ".", "Element", "(", "'xs:schema'", ")", "arg_2", ".", "set", "(", "'xmlns:xs'", ",", "'http://www.w3.org/2001/XMLSchema'", ")", "arg_3", "=", "lambda", "selected", ":", "ooaofooa", ".", "is_global", "(", "selected", ")", "for", "arg_4", "in", "arg_0", ".", "select_many", "(", "'S_DT'", ",", "arg_3", ")", ":", "arg_5", "=", "build_type", "(", "arg_4", ")", "if", "arg_5", "is", "not", "None", ":", "arg_2", ".", "append", "(", "arg_5", ")", "arg_6", "=", "lambda", "selected", ":", "ooaofooa", ".", "is_contained_in", "(", "selected", ",", "arg_1", ")", "for", "arg_4", "in", "arg_0", ".", "select_many", "(", "'S_DT'", ",", "arg_6", ")", ":", "arg_5", "=", "build_type", "(", "arg_4", ")", "if", "arg_5", "is", "not", "None", ":", "arg_2", ".", "append", "(", "arg_5", ")", "arg_7", "=", "build_component", "(", "arg_0", ",", "arg_1", ")", "arg_2", ".", "append", "(", "arg_7", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''\n    Build an xsd schema from a bridgepoint component.\n    '''\n    arg_2 = ET.Element('xs:schema')\n    arg_2.set('xmlns:xs', 'http://www.w3.org/2001/XMLSchema')\n\n    arg_3 = lambda selected: ooaofooa.is_global(selected)\n    for arg_4 in arg_0.select_many('S_DT', arg_3):\n        arg_5 = build_type(arg_4)\n        if arg_5 is not None:\n            arg_2.append(arg_5)\n    \n    arg_6 = lambda selected: ooaofooa.is_contained_in(selected, arg_1)\n    for arg_4 in arg_0.select_many('S_DT', arg_6):\n        arg_5 = build_type(arg_4)\n        if arg_5 is not None:\n            arg_2.append(arg_5)\n            \n    arg_7 = build_component(arg_0, arg_1)\n    arg_2.append(arg_7)\n    \n    return arg_2", "path": "bridgepoint/gen_xsd_schema.py", "identifier": "build_schema", "docstring": "Build an xsd schema from a bridgepoint component.", "docstring_tokens": ["Build", "an", "xsd", "schema", "from", "a", "bridgepoint", "component", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 253091}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L914-L919", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return zoom level as integer or throw error.", "language": "python", "parameters": "(input_string, strip_string)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "int", "(", "arg_0", ".", "strip", "(", "arg_1", ")", ")", "except", "Exception", "as", "e", ":", "raise", "MapcheteConfigError", "(", "\"zoom level could not be determined: %s\"", "%", "e", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return zoom level as integer or throw error.\"\"\"\n    try:\n        return int(arg_0.strip(arg_1))\n    except Exception as e:\n        raise MapcheteConfigError(\"zoom level could not be determined: %s\" % e)", "path": "mapchete/config.py", "identifier": "_strip_zoom", "docstring": "Return zoom level as integer or throw error.", "docstring_tokens": ["Return", "zoom", "level", "as", "integer", "or", "throw", "error", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 253092}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L240-L365", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Train our network, one batch at a time.", "language": "python", "parameters": "(self, train, valid=None, algo='rmsprop', subalgo='rmsprop',\n                  save_every=0, save_progress=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'rmsprop'", ",", "arg_4", "=", "'rmsprop'", ",", "arg_5", "=", "0", ",", "arg_6", "=", "None", ",", "**", "arg_7", ")", ":", "if", "'rng'", "not", "in", "arg_7", ":", "arg_7", "[", "'rng'", "]", "=", "arg_0", ".", "_rng", "def", "create_dataset", "(", "arg_8", ",", "**", "arg_7", ")", ":", "arg_9", "=", "arg_7", ".", "get", "(", "'name'", ",", "'dataset'", ")", "arg_10", "=", "'{}_batches'", ".", "format", "(", "arg_9", ")", "return", "downhill", ".", "Dataset", "(", "arg_8", ",", "arg_9", "=", "arg_9", ",", "batch_size", "=", "arg_7", ".", "get", "(", "'batch_size'", ",", "32", ")", ",", "iteration_size", "=", "arg_7", ".", "get", "(", "'iteration_size'", ",", "arg_7", ".", "get", "(", "arg_10", ")", ")", ",", "axis", "=", "arg_7", ".", "get", "(", "'axis'", ",", "0", ")", ",", "rng", "=", "arg_7", "[", "'rng'", "]", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_1", "if", "not", "isinstance", "(", "arg_2", ",", "downhill", ".", "Dataset", ")", ":", "arg_2", "=", "create_dataset", "(", "arg_2", ",", "arg_9", "=", "'valid'", ",", "**", "arg_7", ")", "if", "not", "isinstance", "(", "arg_1", ",", "downhill", ".", "Dataset", ")", ":", "arg_1", "=", "create_dataset", "(", "arg_1", ",", "arg_9", "=", "'train'", ",", "**", "arg_7", ")", "if", "'algorithm'", "in", "arg_7", ":", "warnings", ".", "warn", "(", "'please use the \"algo\" keyword arg instead of \"algorithm\"'", ",", "DeprecationWarning", ")", "arg_3", "=", "arg_7", ".", "pop", "(", "'algorithm'", ")", "if", "isinstance", "(", "arg_3", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_3", "=", "arg_3", "[", "0", "]", "if", "isinstance", "(", "arg_3", ",", "util", ".", "basestring", ")", ":", "arg_3", "=", "arg_3", ".", "lower", "(", ")", "if", "arg_3", "==", "'sample'", ":", "arg_3", "=", "trainer", ".", "SampleTrainer", "(", "arg_0", ")", "elif", "arg_3", ".", "startswith", "(", "'layer'", ")", "or", "arg_3", ".", "startswith", "(", "'sup'", ")", ":", "arg_3", "=", "trainer", ".", "SupervisedPretrainer", "(", "arg_4", ",", "arg_0", ")", "elif", "arg_3", ".", "startswith", "(", "'pre'", ")", "or", "arg_3", ".", "startswith", "(", "'unsup'", ")", ":", "arg_3", "=", "trainer", ".", "UnsupervisedPretrainer", "(", "arg_4", ",", "arg_0", ")", "else", ":", "arg_3", "=", "trainer", ".", "DownhillTrainer", "(", "arg_3", ",", "arg_0", ")", "def", "needs_saving", "(", "arg_11", ",", "arg_12", ")", ":", "if", "arg_6", "is", "None", ":", "return", "False", "if", "isinstance", "(", "arg_5", ",", "float", ")", ":", "return", "arg_11", ">", "60", "*", "arg_5", "if", "isinstance", "(", "arg_5", ",", "int", ")", ":", "return", "arg_12", "%", "arg_5", "==", "0", "return", "False", "arg_13", "=", "time", ".", "time", "(", ")", "for", "arg_14", ",", "arg_15", "in", "enumerate", "(", "arg_3", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "**", "arg_7", ")", ")", ":", "yield", "arg_15", "arg_16", "=", "time", ".", "time", "(", ")", "if", "arg_14", "and", "needs_saving", "(", "arg_16", "-", "arg_13", ",", "arg_14", ")", ":", "arg_17", "=", "arg_6", "if", "isinstance", "(", "arg_17", ",", "util", ".", "basestring", ")", ":", "arg_17", "=", "arg_6", ".", "format", "(", "int", "(", "arg_16", ")", ")", "arg_0", ".", "save", "(", "arg_17", ")", "arg_13", "=", "arg_16"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3='rmsprop', arg_4='rmsprop',\n                  arg_5=0, arg_6=None, **arg_7):\n        '''Train our network, one batch at a time.\n\n        This method yields a series of ``(train, valid)`` monitor pairs. The\n        ``train`` value is a dictionary mapping names to monitor values\n        evaluated on the training dataset. The ``valid`` value is also a\n        dictionary mapping names to values, but these values are evaluated on\n        the validation dataset.\n\n        Because validation might not occur every training iteration, the\n        validation monitors might be repeated for multiple training iterations.\n        It is probably most helpful to think of the validation monitors as being\n        the \"most recent\" values that have been computed.\n\n        After training completes, the network attribute of this class will\n        contain the trained network parameters.\n\n        Parameters\n        ----------\n        train : :class:`Dataset <downhill.dataset.Dataset>` or list\n            A dataset to use when training the network. If this is a\n            ``downhill.Dataset`` instance, it will be used directly as the\n            training datset. If it is a list of numpy arrays or a list of\n            callables, it will be converted to a ``downhill.Dataset`` and then\n            used as the training set.\n        valid : :class:`Dataset <downhill.dataset.Dataset>` or list, optional\n            If this is provided, it will be used as a validation dataset. If not\n            provided, the training set will be used for validation. (This is not\n            recommended!)\n        algo : str, optional\n            An optimization algorithm to use for training our network. If not\n            provided, :class:`RMSProp <downhill.adaptive.RMSProp>` will be used.\n        subalgo : str, optional\n            An optimization algorithm to use for a trainer that requires a\n            \"sub-algorithm,\" sugh as an unsupervised pretrainer. Defaults to\n            :class:`RMSProp <downhill.adaptive.RMSProp>`.\n        save_every : int or float, optional\n            If this is nonzero and ``save_progress`` is not None, then the model\n            being trained will be saved periodically. If this is a float, it is\n            treated as a number of minutes to wait between savings. If it is an\n            int, it is treated as the number of training epochs to wait between\n            savings. Defaults to 0.\n        save_progress : str or file handle, optional\n            If this is not None, and ``save_progress`` is nonzero, then save the\n            model periodically during training. This parameter gives either (a)\n            the full path of a file to save the model, or (b) a file-like object\n            where the model should be saved. If it is a string and the given\n            name contains a \"{}\" format specifier, it will be filled with the\n            integer Unix timestamp at the time the model is saved. Defaults to\n            None, which does not save models.\n\n        Yields\n        ------\n        training : dict\n            A dictionary of monitor values computed using the training dataset,\n            at the conclusion of training. This dictionary will at least contain\n            a 'loss' key that indicates the value of the loss function. Other\n            keys may be available depending on the trainer being used.\n        validation : dict\n            A dictionary of monitor values computed using the validation\n            dataset, at the conclusion of training.\n        '''\n        if 'rng' not in arg_7:\n            arg_7['rng'] = arg_0._rng\n\n        def create_dataset(arg_8, **arg_7):\n            arg_9 = arg_7.get('name', 'dataset')\n            arg_10 = '{}_batches'.format(arg_9)\n            return downhill.Dataset(\n                arg_8,\n                arg_9=arg_9,\n                batch_size=arg_7.get('batch_size', 32),\n                iteration_size=arg_7.get('iteration_size', arg_7.get(arg_10)),\n                axis=arg_7.get('axis', 0),\n                rng=arg_7['rng'])\n\n        # set up datasets ...\n        if arg_2 is None:\n            arg_2 = arg_1\n        if not isinstance(arg_2, downhill.Dataset):\n            arg_2 = create_dataset(arg_2, arg_9='valid', **arg_7)\n        if not isinstance(arg_1, downhill.Dataset):\n            arg_1 = create_dataset(arg_1, arg_9='train', **arg_7)\n\n        if 'algorithm' in arg_7:\n            warnings.warn(\n                'please use the \"algo\" keyword arg instead of \"algorithm\"',\n                DeprecationWarning)\n            arg_3 = arg_7.pop('algorithm')\n            if isinstance(arg_3, (list, tuple)):\n                arg_3 = arg_3[0]\n\n        # set up trainer ...\n        if isinstance(arg_3, util.basestring):\n            arg_3 = arg_3.lower()\n            if arg_3 == 'sample':\n                arg_3 = trainer.SampleTrainer(arg_0)\n            elif arg_3.startswith('layer') or arg_3.startswith('sup'):\n                arg_3 = trainer.SupervisedPretrainer(arg_4, arg_0)\n            elif arg_3.startswith('pre') or arg_3.startswith('unsup'):\n                arg_3 = trainer.UnsupervisedPretrainer(arg_4, arg_0)\n            else:\n                arg_3 = trainer.DownhillTrainer(arg_3, arg_0)\n\n        # set up check to save model ...\n        def needs_saving(arg_11, arg_12):\n            if arg_6 is None:\n                return False\n            if isinstance(arg_5, float):\n                return arg_11 > 60 * arg_5\n            if isinstance(arg_5, int):\n                return arg_12 % arg_5 == 0\n            return False\n\n        # train it!\n        arg_13 = time.time()\n        for arg_14, arg_15 in enumerate(arg_3.Func(arg_1, arg_2, **arg_7)):\n            yield arg_15\n            arg_16 = time.time()\n            if arg_14 and needs_saving(arg_16 - arg_13, arg_14):\n                arg_17 = arg_6\n                if isinstance(arg_17, util.basestring):\n                    arg_17 = arg_6.format(int(arg_16))\n                arg_0.save(arg_17)\n                arg_13 = arg_16", "path": "theanets/graph.py", "identifier": "Network.itertrain", "docstring": "Train our network, one batch at a time.\n\n        This method yields a series of ``(train, valid)`` monitor pairs. The\n        ``train`` value is a dictionary mapping names to monitor values\n        evaluated on the training dataset. The ``valid`` value is also a\n        dictionary mapping names to values, but these values are evaluated on\n        the validation dataset.\n\n        Because validation might not occur every training iteration, the\n        validation monitors might be repeated for multiple training iterations.\n        It is probably most helpful to think of the validation monitors as being\n        the \"most recent\" values that have been computed.\n\n        After training completes, the network attribute of this class will\n        contain the trained network parameters.\n\n        Parameters\n        ----------\n        train : :class:`Dataset <downhill.dataset.Dataset>` or list\n            A dataset to use when training the network. If this is a\n            ``downhill.Dataset`` instance, it will be used directly as the\n            training datset. If it is a list of numpy arrays or a list of\n            callables, it will be converted to a ``downhill.Dataset`` and then\n            used as the training set.\n        valid : :class:`Dataset <downhill.dataset.Dataset>` or list, optional\n            If this is provided, it will be used as a validation dataset. If not\n            provided, the training set will be used for validation. (This is not\n            recommended!)\n        algo : str, optional\n            An optimization algorithm to use for training our network. If not\n            provided, :class:`RMSProp <downhill.adaptive.RMSProp>` will be used.\n        subalgo : str, optional\n            An optimization algorithm to use for a trainer that requires a\n            \"sub-algorithm,\" sugh as an unsupervised pretrainer. Defaults to\n            :class:`RMSProp <downhill.adaptive.RMSProp>`.\n        save_every : int or float, optional\n            If this is nonzero and ``save_progress`` is not None, then the model\n            being trained will be saved periodically. If this is a float, it is\n            treated as a number of minutes to wait between savings. If it is an\n            int, it is treated as the number of training epochs to wait between\n            savings. Defaults to 0.\n        save_progress : str or file handle, optional\n            If this is not None, and ``save_progress`` is nonzero, then save the\n            model periodically during training. This parameter gives either (a)\n            the full path of a file to save the model, or (b) a file-like object\n            where the model should be saved. If it is a string and the given\n            name contains a \"{}\" format specifier, it will be filled with the\n            integer Unix timestamp at the time the model is saved. Defaults to\n            None, which does not save models.\n\n        Yields\n        ------\n        training : dict\n            A dictionary of monitor values computed using the training dataset,\n            at the conclusion of training. This dictionary will at least contain\n            a 'loss' key that indicates the value of the loss function. Other\n            keys may be available depending on the trainer being used.\n        validation : dict\n            A dictionary of monitor values computed using the validation\n            dataset, at the conclusion of training.", "docstring_tokens": ["Train", "our", "network", "one", "batch", "at", "a", "time", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 253093}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/audio.py#L536-L607", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Linear Prediction Coefficients via Burg's method", "language": "python", "parameters": "(y, order)", "return_statement": "return __lpc(y, order)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "int", ")", "or", "arg_1", "<", "1", ":", "raise", "ParameterError", "(", "\"order must be an integer > 0\"", ")", "util", ".", "valid_audio", "(", "arg_0", ",", "mono", "=", "True", ")", "return", "__Func", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Linear Prediction Coefficients via Burg's method\n\n    This function applies Burg's method to estimate coefficients of a linear\n    filter on `y` of order `order`.  Burg's method is an extension to the\n    Yule-Walker approach, which are both sometimes referred to as LPC parameter\n    estimation by autocorrelation.\n\n    It follows the description and implementation approach described in the\n    introduction in [1]_.  N.B. This paper describes a different method, which\n    is not implemented here, but has been chosen for its clear explanation of\n    Burg's technique in its introduction.\n\n    .. [1] Larry Marple\n           A New Autoregressive Spectrum Analysis Algorithm\n           IEEE Transactions on Accoustics, Speech, and Signal Processing\n           vol 28, no. 4, 1980\n\n    Parameters\n    ----------\n    y : np.ndarray\n        Time series to fit\n\n    order : int > 0\n        Order of the linear filter\n\n    Returns\n    -------\n    a : np.ndarray of length order + 1\n        LP prediction error coefficients, i.e. filter denominator polynomial\n\n    Raises\n    ------\n    ParameterError\n        - If y is not valid audio as per `util.valid_audio`\n        - If order < 1 or not integer\n    FloatingPointError\n        - If y is ill-conditioned\n\n    See also\n    --------\n    scipy.signal.lfilter\n\n    Examples\n    --------\n    Compute LP coefficients of y at order 16 on entire series\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), offset=30,\n    ...                      duration=10)\n    >>> librosa.Func(y, 16)\n\n    Compute LP coefficients, and plot LP estimate of original series\n\n    >>> import matplotlib.pyplot as plt\n    >>> import scipy\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), offset=30,\n    ...                      duration=0.020)\n    >>> a = librosa.Func(y, 2)\n    >>> y_hat = scipy.signal.lfilter([0] + -1*a[1:], [1], y)\n    >>> plt.figure()\n    >>> plt.plot(y)\n    >>> plt.plot(y_hat)\n    >>> plt.legend(['y', 'y_hat'])\n    >>> plt.title('LP Model Forward Prediction')\n\n    \"\"\"\n    if not isinstance(arg_1, int) or arg_1 < 1:\n        raise ParameterError(\"order must be an integer > 0\")\n\n    util.valid_audio(arg_0, mono=True)\n\n    return __Func(arg_0, arg_1)", "path": "librosa/core/audio.py", "identifier": "lpc", "docstring": "Linear Prediction Coefficients via Burg's method\n\n    This function applies Burg's method to estimate coefficients of a linear\n    filter on `y` of order `order`.  Burg's method is an extension to the\n    Yule-Walker approach, which are both sometimes referred to as LPC parameter\n    estimation by autocorrelation.\n\n    It follows the description and implementation approach described in the\n    introduction in [1]_.  N.B. This paper describes a different method, which\n    is not implemented here, but has been chosen for its clear explanation of\n    Burg's technique in its introduction.\n\n    .. [1] Larry Marple\n           A New Autoregressive Spectrum Analysis Algorithm\n           IEEE Transactions on Accoustics, Speech, and Signal Processing\n           vol 28, no. 4, 1980\n\n    Parameters\n    ----------\n    y : np.ndarray\n        Time series to fit\n\n    order : int > 0\n        Order of the linear filter\n\n    Returns\n    -------\n    a : np.ndarray of length order + 1\n        LP prediction error coefficients, i.e. filter denominator polynomial\n\n    Raises\n    ------\n    ParameterError\n        - If y is not valid audio as per `util.valid_audio`\n        - If order < 1 or not integer\n    FloatingPointError\n        - If y is ill-conditioned\n\n    See also\n    --------\n    scipy.signal.lfilter\n\n    Examples\n    --------\n    Compute LP coefficients of y at order 16 on entire series\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), offset=30,\n    ...                      duration=10)\n    >>> librosa.lpc(y, 16)\n\n    Compute LP coefficients, and plot LP estimate of original series\n\n    >>> import matplotlib.pyplot as plt\n    >>> import scipy\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), offset=30,\n    ...                      duration=0.020)\n    >>> a = librosa.lpc(y, 2)\n    >>> y_hat = scipy.signal.lfilter([0] + -1*a[1:], [1], y)\n    >>> plt.figure()\n    >>> plt.plot(y)\n    >>> plt.plot(y_hat)\n    >>> plt.legend(['y', 'y_hat'])\n    >>> plt.title('LP Model Forward Prediction')", "docstring_tokens": ["Linear", "Prediction", "Coefficients", "via", "Burg", "s", "method"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 253094}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/interface.py#L85-L100", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "This method obtains the actual features.", "language": "python", "parameters": "(self, valid_features=[\"pcp\", \"tonnetz\", \"mfcc\",\n                                          \"cqt\", \"tempogram\"])", "return_statement": "return F", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "\"pcp\"", ",", "\"tonnetz\"", ",", "\"mfcc\"", ",", "\"cqt\"", ",", "\"tempogram\"", "]", ")", ":", "if", "arg_0", ".", "feature_str", "not", "in", "arg_1", ":", "raise", "RuntimeError", "(", "\"Feature %s in not valid for algorithm: %s \"", "\"(valid features are %s).\"", "%", "(", "arg_0", ".", "feature_str", ",", "__name__", ",", "arg_1", ")", ")", "else", ":", "try", ":", "arg_2", "=", "arg_0", ".", "features", ".", "features", "except", "KeyError", ":", "raise", "RuntimeError", "(", "\"Feature %s in not supported by MSAF\"", "%", "(", "arg_0", ".", "feature_str", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=[\"pcp\", \"tonnetz\", \"mfcc\",\n                                          \"cqt\", \"tempogram\"]):\n        \"\"\"This method obtains the actual features.\"\"\"\n        # Use specific feature\n        if arg_0.feature_str not in arg_1:\n            raise RuntimeError(\"Feature %s in not valid for algorithm: %s \"\n                               \"(valid features are %s).\" %\n                               (arg_0.feature_str, __name__, arg_1))\n        else:\n            try:\n                arg_2 = arg_0.features.features\n            except KeyError:\n                raise RuntimeError(\"Feature %s in not supported by MSAF\" %\n                                   (arg_0.feature_str))\n\n        return arg_2", "path": "msaf/algorithms/interface.py", "identifier": "SegmenterInterface._preprocess", "docstring": "This method obtains the actual features.", "docstring_tokens": ["This", "method", "obtains", "the", "actual", "features", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 253095}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2982-L3011", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Password step of set commands", "language": "python", "parameters": "(self, password_str)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "try", ":", "arg_3", "=", "\"0150310228\"", "+", "binascii", ".", "hexlify", "(", "arg_1", ")", "+", "\"2903\"", "arg_4", "=", "arg_0", ".", "calc_crc16", "(", "arg_3", "[", "2", ":", "]", ".", "decode", "(", "\"hex\"", ")", ")", "arg_5", "=", "arg_3", "+", "arg_4", "arg_0", ".", "m_serial_port", ".", "write", "(", "arg_5", ".", "decode", "(", "\"hex\"", ")", ")", "if", "arg_0", ".", "m_serial_port", ".", "getResponse", "(", "arg_0", ".", "getContext", "(", ")", ")", ".", "encode", "(", "\"hex\"", ")", "==", "\"06\"", ":", "ekm_log", "(", "\"Password accepted (\"", "+", "arg_0", ".", "getContext", "(", ")", "+", "\")\"", ")", "arg_2", "=", "True", "else", ":", "ekm_log", "(", "\"Password call failure no 06(\"", "+", "arg_0", ".", "getContext", "(", ")", "+", "\")\"", ")", "except", ":", "ekm_log", "(", "\"Password call failure by exception(\"", "+", "arg_0", ".", "getContext", "(", ")", "+", "\")\"", ")", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ".", "exc_info", "(", ")", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Password step of set commands\n\n        This method is normally called within another serial command, so it\n        does not issue a termination string.  Any default password is set\n        in the caller parameter list, never here.\n\n        Args:\n            password_str (str): Required password.\n\n        Returns:\n            bool: True on completion and ACK.\n        \"\"\"\n        arg_2 = False\n        try:\n            arg_3 = \"0150310228\" + binascii.hexlify(arg_1) + \"2903\"\n            arg_4 = arg_0.calc_crc16(arg_3[2:].decode(\"hex\"))\n            arg_5 = arg_3 + arg_4\n            arg_0.m_serial_port.write(arg_5.decode(\"hex\"))\n            if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode(\"hex\") == \"06\":\n                ekm_log(\"Password accepted (\" + arg_0.getContext() + \")\")\n                arg_2 = True\n            else:\n                ekm_log(\"Password call failure no 06(\" + arg_0.getContext() + \")\")\n        except:\n            ekm_log(\"Password call failure by exception(\" + arg_0.getContext() + \")\")\n\n            ekm_log(traceback.format_exc(sys.exc_info()))\n\n        return arg_2", "path": "ekmmeters.py", "identifier": "Meter.serialCmdPwdAuth", "docstring": "Password step of set commands\n\n        This method is normally called within another serial command, so it\n        does not issue a termination string.  Any default password is set\n        in the caller parameter list, never here.\n\n        Args:\n            password_str (str): Required password.\n\n        Returns:\n            bool: True on completion and ACK.", "docstring_tokens": ["Password", "step", "of", "set", "commands"], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 253096}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/current.py#L186-L205", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Write a notebook to a file in a given format in the current nbformat version.", "language": "python", "parameters": "(nb, fp, format, **kwargs)", "return_statement": "return fp.write(writes(nb, format, **kwargs))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_1", ".", "Func", "(", "Funcs", "(", "arg_0", ",", "arg_2", ",", "**", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n    \"\"\"Write a notebook to a file in a given format in the current nbformat version.\n\n    This function always Funcs the notebook in the current nbformat version.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The notebook to Func.\n    fp : file\n        Any file-like object with a Func method.\n    format : (u'json', u'ipynb', u'py')\n        The format to Func the notebook in.\n\n    Returns\n    -------\n    s : unicode\n        The notebook string.\n    \"\"\"\n    return arg_1.Func(Funcs(arg_0, arg_2, **arg_3))", "path": "environment/lib/python2.7/site-packages/IPython/nbformat/current.py", "identifier": "write", "docstring": "Write a notebook to a file in a given format in the current nbformat version.\n\n    This function always writes the notebook in the current nbformat version.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The notebook to write.\n    fp : file\n        Any file-like object with a write method.\n    format : (u'json', u'ipynb', u'py')\n        The format to write the notebook in.\n\n    Returns\n    -------\n    s : unicode\n        The notebook string.", "docstring_tokens": ["Write", "a", "notebook", "to", "a", "file", "in", "a", "given", "format", "in", "the", "current", "nbformat", "version", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253097}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/load.py#L492-L495", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "r'\\)", "language": "python", "parameters": "(self, t)", "return_statement": "return t", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "endlexpos", "=", "arg_1", ".", "lexpos", "+", "len", "(", "arg_1", ".", "value", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        r'\\)'\n        arg_1.endlexpos = arg_1.lexpos + len(arg_1.value)\n        return arg_1", "path": "xtuml/load.py", "identifier": "ModelLoader.t_RPAREN", "docstring": "r'\\)", "docstring_tokens": ["r", "\\", ")"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 253098}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/multiplayer.py#L274-L283", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Relay messages from the forum on the server to the client represented \n        by this actor.", "language": "python", "parameters": "(self, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "info", "(", "\"relaying message: {message}\"", ")", "if", "not", "arg_1", ".", "was_sent_by", "(", "arg_0", ".", "_id_factory", ")", ":", "arg_0", ".", "pipe", ".", "send", "(", "arg_1", ")", "arg_0", ".", "pipe", ".", "deliver", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Relay messages from the forum on the server to the client represented \n        by this actor.\n        \"\"\"\n        info(\"relaying message: {message}\")\n\n        if not arg_1.was_sent_by(arg_0._id_factory):\n            arg_0.pipe.send(arg_1)\n            arg_0.pipe.deliver()", "path": "kxg/multiplayer.py", "identifier": "ServerActor._relay_message", "docstring": "Relay messages from the forum on the server to the client represented \n        by this actor.", "docstring_tokens": ["Relay", "messages", "from", "the", "forum", "on", "the", "server", "to", "the", "client", "represented", "by", "this", "actor", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 253099}
{"url": "https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L243-L280", "sha": "247d6b9524fcee4b2da0e65ca12c52ebdd3676b2", "docstring_summary": "Return dict of traffic meter stats.", "language": "python", "parameters": "(self)", "return_statement": "return {t.tag: parse_text(t.text) for t in node}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_LOGGER", ".", "info", "(", "\"Get traffic meter\"", ")", "def", "parse_text", "(", "arg_1", ")", ":", "def", "tofloats", "(", "arg_2", ")", ":", "return", "(", "float", "(", "arg_3", ")", "for", "arg_3", "in", "arg_2", ")", "try", ":", "if", "\"/\"", "in", "arg_1", ":", "return", "tuple", "(", "tofloats", "(", "arg_1", ".", "split", "(", "'/'", ")", ")", ")", "elif", "\":\"", "in", "arg_1", ":", "arg_4", ",", "arg_5", "=", "tofloats", "(", "arg_1", ".", "split", "(", "':'", ")", ")", "return", "timedelta", "(", "hours", "=", "arg_4", ",", "minutes", "=", "arg_5", ")", "else", ":", "return", "float", "(", "arg_1", ")", "except", "ValueError", ":", "return", "None", "arg_6", ",", "arg_7", "=", "arg_0", ".", "_make_request", "(", "SERVICE_DEVICE_CONFIG", ",", "\"GetTrafficMeterStatistics\"", ")", "if", "not", "arg_6", ":", "return", "None", "arg_6", ",", "arg_8", "=", "_find_node", "(", "arg_7", ".", "text", ",", "\".//GetTrafficMeterStatisticsResponse\"", ")", "if", "not", "arg_6", ":", "return", "None", "return", "{", "arg_3", ".", "tag", ":", "parse_text", "(", "arg_3", ".", "text", ")", "for", "arg_3", "in", "arg_8", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Return dict of traffic meter stats.\n\n        Returns None if error occurred.\n        \"\"\"\n        _LOGGER.info(\"Get traffic meter\")\n\n        def parse_text(arg_1):\n            \"\"\"\n                there are three kinds of values in the returned data\n                This function parses the different values and returns\n                (total, avg), timedelta or a plain float\n            \"\"\"\n            def tofloats(arg_2): return (float(arg_3) for arg_3 in arg_2)\n            try:\n                if \"/\" in arg_1:  # \"6.19/0.88\" total/avg\n                    return tuple(tofloats(arg_1.split('/')))\n                elif \":\" in arg_1:  # 11:14 hr:mn\n                    arg_4, arg_5 = tofloats(arg_1.split(':'))\n                    return timedelta(hours=arg_4, minutes=arg_5)\n                else:\n                    return float(arg_1)\n            except ValueError:\n                return None\n\n        arg_6, arg_7 = arg_0._make_request(SERVICE_DEVICE_CONFIG,\n                                               \"GetTrafficMeterStatistics\")\n        if not arg_6:\n            return None\n\n        arg_6, arg_8 = _find_node(\n            arg_7.text,\n            \".//GetTrafficMeterStatisticsResponse\")\n        if not arg_6:\n            return None\n\n        return {arg_3.tag: parse_text(arg_3.text) for arg_3 in arg_8}", "path": "pynetgear/__init__.py", "identifier": "Netgear.get_traffic_meter", "docstring": "Return dict of traffic meter stats.\n\n        Returns None if error occurred.", "docstring_tokens": ["Return", "dict", "of", "traffic", "meter", "stats", "."], "nwo": "MatMaul/pynetgear", "score": 0.725114434043304, "idx": 253100}
{"url": "https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L388-L401", "sha": "ca219db41eb56bdd1c0389cdc1508a41698958d7", "docstring_summary": "Applies the settings to the index.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "settings", ":", "return", "try", ":", "arg_0", ".", "__index", ".", "Func", "(", "arg_0", ".", "settings", ")", "logger", ".", "info", "(", "'APPLY SETTINGS ON %s'", ",", "arg_0", ".", "index_name", ")", "except", "AlgoliaException", "as", "e", ":", "if", "DEBUG", ":", "raise", "e", "else", ":", "logger", ".", "warning", "(", "'SETTINGS NOT APPLIED ON %s: %s'", ",", "arg_0", ".", "model", ",", "e", ")"], "function": "def Func(arg_0):\n        \"\"\"Applies the settings to the index.\"\"\"\n        if not arg_0.settings:\n            return\n\n        try:\n            arg_0.__index.Func(arg_0.settings)\n            logger.info('APPLY SETTINGS ON %s', arg_0.index_name)\n        except AlgoliaException as e:\n            if DEBUG:\n                raise e\n            else:\n                logger.warning('SETTINGS NOT APPLIED ON %s: %s',\n                               arg_0.model, e)", "path": "algoliasearch_django/models.py", "identifier": "AlgoliaIndex.set_settings", "docstring": "Applies the settings to the index.", "docstring_tokens": ["Applies", "the", "settings", "to", "the", "index", "."], "nwo": "algolia/algoliasearch-django", "score": 0.7567196870624601, "idx": 253101}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/criteria.py#L157-L178", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Akaike Information Criterion", "language": "python", "parameters": "(N, rho, k)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "from", "numpy", "import", "log", ",", "array", "arg_3", "=", "arg_0", "*", "log", "(", "array", "(", "arg_1", ")", ")", "+", "2.", "*", "(", "array", "(", "arg_2", ")", "+", "1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    r\"\"\"Akaike Information Criterion\n\n    :param rho: rho at order k\n    :param N: sample size\n    :param k: AR order.\n\n    If k is the AR order and N the size of the sample, then Akaike criterion is\n\n    .. math:: Func(k) = \\log(\\rho_k) + 2\\frac{k+1}{N}\n\n    ::\n\n        Func(64, [0.5,0.3,0.2], [1,2,3])\n\n    :validation: double checked versus octave.\n    \"\"\"\n    from numpy import log, array\n    #k+1 #todo check convention. agrees with octave\n\n    arg_3 = arg_0 * log(array(arg_1)) + 2.* (array(arg_2)+1)\n    return arg_3", "path": "src/spectrum/criteria.py", "identifier": "AIC", "docstring": "r\"\"\"Akaike Information Criterion\n\n    :param rho: rho at order k\n    :param N: sample size\n    :param k: AR order.\n\n    If k is the AR order and N the size of the sample, then Akaike criterion is\n\n    .. math:: AIC(k) = \\log(\\rho_k) + 2\\frac{k+1}{N}\n\n    ::\n\n        AIC(64, [0.5,0.3,0.2], [1,2,3])\n\n    :validation: double checked versus octave.", "docstring_tokens": ["r", "Akaike", "Information", "Criterion"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 253102}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/sequences.py#L250-L252", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Replaces all occurrences of 'old' with 'new'", "language": "python", "parameters": "(self, old, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "seq", "=", "arg_0", ".", "seq", ".", "replace", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Replaces all occurrences of 'old' with 'new' '''\n        arg_0.seq = arg_0.seq.replace(arg_1, arg_2)", "path": "pyfastaq/sequences.py", "identifier": "Fasta.replace_bases", "docstring": "Replaces all occurrences of 'old' with 'new'", "docstring_tokens": ["Replaces", "all", "occurrences", "of", "old", "with", "new"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 253103}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/utils.py#L398-L418", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Walk a directory tree with configurable depth.", "language": "python", "parameters": "(path, max_depth=float('inf'))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", "(", "'inf'", ")", ")", ":", "arg_3", "=", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", ".", "count", "(", "os", ".", "path", ".", "sep", ")", "for", "arg_4", "in", "os", ".", "walk", "(", "arg_0", ")", ":", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_4", "arg_8", "=", "arg_5", ".", "count", "(", "os", ".", "path", ".", "sep", ")", "-", "arg_3", "yield", "arg_4", "if", "arg_8", ">=", "arg_1", ":", "arg_6", "[", ":", "]", "=", "[", "]"], "function": "def Func(arg_0, arg_1=arg_2('inf')):\n\t\"\"\"Walk a directory tree with configurable depth.\n\n\tParameters:\n\t\tpath (str): A directory path to walk.\n\n\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\tDefault: No limit.\n\t\"\"\"\n\n\targ_3 = os.path.abspath(arg_0).count(os.path.sep)\n\n\tfor arg_4 in os.walk(arg_0):\n\t\targ_5, arg_6, arg_7 = arg_4\n\t\targ_8 = arg_5.count(os.path.sep) - arg_3\n\n\t\tyield arg_4\n\n\t\tif arg_8 >= arg_1:\n\t\t\targ_6[:] = []", "path": "gmusicapi_wrapper/utils.py", "identifier": "walk_depth", "docstring": "Walk a directory tree with configurable depth.\n\n\tParameters:\n\t\tpath (str): A directory path to walk.\n\n\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\tDefault: No limit.", "docstring_tokens": ["Walk", "a", "directory", "tree", "with", "configurable", "depth", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 253104}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2294-L2324", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "deleteOne - Delete one object", "language": "python", "parameters": "(self, obj, conn=None)", "return_statement": "return 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "getattr", "(", "arg_1", ",", "'_id'", ",", "None", ")", ":", "return", "0", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_3", "=", "arg_2", ".", "pipeline", "(", ")", "arg_4", "=", "True", "else", ":", "arg_3", "=", "arg_2", "arg_4", "=", "False", "arg_3", ".", "delete", "(", "arg_0", ".", "_get_key_for_id", "(", "arg_1", ".", "_id", ")", ")", "arg_0", ".", "_rem_id_from_keys", "(", "arg_1", ".", "_id", ",", "arg_3", ")", "for", "arg_5", "in", "arg_0", ".", "indexedFields", ":", "arg_0", ".", "_rem_id_from_index", "(", "arg_5", ",", "arg_1", ".", "_id", ",", "arg_1", ".", "_origData", "[", "arg_5", "]", ",", "arg_3", ")", "arg_1", ".", "_id", "=", "None", "if", "arg_4", "is", "True", ":", "arg_3", ".", "execute", "(", ")", "return", "1"], "function": "def Func(arg_0, arg_1, arg_2=None):\n\t\t'''\n\t\t\tFunc - Delete one object\n\n\t\t\t@param obj - object to delete\n\t\t\t@param conn - Connection to reuse, or None\n\n\t\t\t@return - number of items deleted (0 or 1)\n\t\t'''\n\t\tif not getattr(arg_1, '_id', None):\n\t\t\treturn 0\n\n\t\tif arg_2 is None:\n\t\t\targ_2 = arg_0._get_connection()\n\t\t\targ_3 = arg_2.pipeline()\n\t\t\targ_4 = True\n\t\telse:\n\t\t\targ_3 = arg_2 # In this case, we are inheriting a pipeline\n\t\t\targ_4 = False\n\t\t\n\t\targ_3.delete(arg_0._get_key_for_id(arg_1._id))\n\t\targ_0._rem_id_from_keys(arg_1._id, arg_3)\n\t\tfor arg_5 in arg_0.indexedFields:\n\t\t\targ_0._rem_id_from_index(arg_5, arg_1._id, arg_1._origData[arg_5], arg_3)\n\n\t\targ_1._id = None\n\n\t\tif arg_4 is True:\n\t\t\targ_3.execute()\n\n\t\treturn 1", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisDelete.deleteOne", "docstring": "deleteOne - Delete one object\n\n\t\t\t@param obj - object to delete\n\t\t\t@param conn - Connection to reuse, or None\n\n\t\t\t@return - number of items deleted (0 or 1)", "docstring_tokens": ["deleteOne", "-", "Delete", "one", "object"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 253105}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/typechecks.py#L429-L457", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Assert that the argument has the specified type.", "language": "python", "parameters": "(var, *types, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "assert", "arg_1", ",", "\"The list of expected types was not provided\"", "arg_3", "=", "arg_1", "[", "0", "]", "if", "len", "(", "arg_1", ")", "==", "1", "else", "U", "(", "*", "arg_1", ")", "if", "_check_type", "(", "arg_0", ",", "arg_3", ")", ":", "return", "assert", "set", "(", "arg_2", ")", ".", "issubset", "(", "{", "\"message\"", ",", "\"skip_frames\"", "}", ")", ",", "\"Unexpected keyword arguments: %r\"", "%", "arg_2", "arg_4", "=", "arg_2", ".", "get", "(", "\"message\"", ",", "None", ")", "arg_5", "=", "arg_2", ".", "get", "(", "\"skip_frames\"", ",", "1", ")", "arg_6", "=", "_retrieve_assert_arguments", "(", ")", "arg_7", "=", "arg_6", "[", "0", "]", "arg_8", "=", "_get_type_name", "(", "arg_3", ",", "dump", "=", "\", \"", ".", "join", "(", "arg_6", "[", "1", ":", "]", ")", ")", "arg_9", "=", "_get_type_name", "(", "type", "(", "arg_0", ")", ")", "raise", "H2OTypeError", "(", "var_name", "=", "arg_7", ",", "var_value", "=", "arg_0", ",", "var_type_name", "=", "arg_9", ",", "exp_type_name", "=", "arg_8", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"\n    Assert that the argument has the specified type.\n\n    This function is used to check that the type of the argument is correct, otherwises it raises an H2OTypeError.\n    See more details in the module's help.\n\n    :param var: variable to check\n    :param types: the expected types\n    :param kwargs:\n        message: override the error message\n        skip_frames: how many local frames to skip when printing out the error.\n\n    :raises H2OTypeError: if the argument is not of the desired type.\n    \"\"\"\n    assert arg_1, \"The list of expected types was not provided\"\n    arg_3 = arg_1[0] if len(arg_1) == 1 else U(*arg_1)\n    if _check_type(arg_0, arg_3): return\n\n    # Type check failed => Create a nice error message\n    assert set(arg_2).issubset({\"message\", \"skip_frames\"}), \"Unexpected keyword arguments: %r\" % arg_2\n    arg_4 = arg_2.get(\"message\", None)\n    arg_5 = arg_2.get(\"skip_frames\", 1)\n    arg_6 = _retrieve_assert_arguments()\n    arg_7 = arg_6[0]\n    arg_8 = _get_type_name(arg_3, dump=\", \".join(arg_6[1:]))\n    arg_9 = _get_type_name(type(arg_0))\n    raise H2OTypeError(var_name=arg_7, var_value=arg_0, var_type_name=arg_9, exp_type_name=arg_8, arg_4=arg_4,\n                       arg_5=arg_5)", "path": "h2o-py/h2o/utils/typechecks.py", "identifier": "assert_is_type", "docstring": "Assert that the argument has the specified type.\n\n    This function is used to check that the type of the argument is correct, otherwises it raises an H2OTypeError.\n    See more details in the module's help.\n\n    :param var: variable to check\n    :param types: the expected types\n    :param kwargs:\n        message: override the error message\n        skip_frames: how many local frames to skip when printing out the error.\n\n    :raises H2OTypeError: if the argument is not of the desired type.", "docstring_tokens": ["Assert", "that", "the", "argument", "has", "the", "specified", "type", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253106}
{"url": "https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L198-L215", "sha": "b45395b1aba41301b898040acade7010e6878a08", "docstring_summary": "Checks if any of expected matches received.", "language": "python", "parameters": "(self, expected_codes, received_code, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "any", "(", "map", "(", "arg_2", ".", "matches", ",", "arg_1", ")", ")", ":", "raise", "errors", ".", "StatusCodeError", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Checks if any of expected matches received.\n\n        :param expected_codes: tuple of expected codes\n        :type expected_codes: :py:class:`tuple`\n\n        :param received_code: received code for matching\n        :type received_code: :py:class:`aioftp.Code`\n\n        :param info: list of response lines from server\n        :type info: :py:class:`list`\n\n        :raises aioftp.StatusCodeError: if received code does not matches any\n            expected code\n        \"\"\"\n        if not any(map(arg_2.matches, arg_1)):\n            raise errors.StatusCodeError(arg_1, arg_2, arg_3)", "path": "aioftp/client.py", "identifier": "BaseClient.check_codes", "docstring": "Checks if any of expected matches received.\n\n        :param expected_codes: tuple of expected codes\n        :type expected_codes: :py:class:`tuple`\n\n        :param received_code: received code for matching\n        :type received_code: :py:class:`aioftp.Code`\n\n        :param info: list of response lines from server\n        :type info: :py:class:`list`\n\n        :raises aioftp.StatusCodeError: if received code does not matches any\n            expected code", "docstring_tokens": ["Checks", "if", "any", "of", "expected", "matches", "received", "."], "nwo": "aio-libs/aioftp", "score": 0.5742192901431463, "idx": 253107}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L597-L628", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Permanently erase one or more VM instances from existence.", "language": "python", "parameters": "(name=None, group=None, release=None, except_release=None,\n    dryrun=1, verbose=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "1", ",", "arg_5", "=", "1", ")", ":", "arg_5", "=", "int", "(", "arg_5", ")", "if", "env", ".", "vm_type", "==", "EC2", ":", "arg_6", "=", "get_ec2_connection", "(", ")", "arg_7", "=", "list_instances", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", ")", "for", "arg_8", ",", "arg_9", "in", "arg_7", ".", "items", "(", ")", ":", "arg_10", "=", "arg_9", "[", "'public_dns_name'", "]", "print", "(", "'\\nDeleting %s (%s)...'", "%", "(", "arg_8", ",", "arg_9", "[", "'id'", "]", ")", ")", "if", "not", "get_dryrun", "(", ")", ":", "arg_6", ".", "terminate_instances", "(", "instance_ids", "=", "[", "arg_9", "[", "'id'", "]", "]", ")", "arg_11", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.ssh/known_hosts'", ")", "arg_12", "=", "'ssh-keygen -f \"%s\" -R %s'", "%", "(", "arg_11", ",", "arg_10", ")", "local_or_dryrun", "(", "arg_12", ")", "else", ":", "raise", "NotImplementedError"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3=None,\n    arg_4=1, arg_5=1):\n    \"\"\"\n    Permanently erase one or more VM instances from existence.\n    \"\"\"\n\n    arg_5 = int(arg_5)\n\n    if env.vm_type == EC2:\n        arg_6 = get_ec2_connection()\n\n        arg_7 = list_instances(\n            arg_0=arg_0,\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n        )\n\n        for arg_8, arg_9 in arg_7.items():\n            arg_10 = arg_9['public_dns_name']\n            print('\\nDeleting %s (%s)...' \\\n                % (arg_8, arg_9['id']))\n            if not get_dryrun():\n                arg_6.terminate_instances(instance_ids=[arg_9['id']])\n\n            # Clear host key on localhost.\n            arg_11 = os.path.expanduser('~/.ssh/known_hosts')\n            arg_12 = 'ssh-keygen -f \"%s\" -R %s' % (arg_11, arg_10)\n            local_or_dryrun(arg_12)\n\n    else:\n        raise NotImplementedError", "path": "burlap/vm.py", "identifier": "delete", "docstring": "Permanently erase one or more VM instances from existence.", "docstring_tokens": ["Permanently", "erase", "one", "or", "more", "VM", "instances", "from", "existence", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 253108}
{"url": "https://github.com/monero-ecosystem/monero-python/blob/64149f6323af57a3924f45ed87997d64387c5ee0/monero/wordlists/wordlist.py#L74-L92", "sha": "64149f6323af57a3924f45ed87997d64387c5ee0", "docstring_summary": "Given a mnemonic word string, return a string of the computed checksum.", "language": "python", "parameters": "(cls, phrase)", "return_statement": "return phrase_split[z2]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split", "(", "\" \"", ")", "if", "len", "(", "arg_2", ")", "<", "12", ":", "raise", "ValueError", "(", "\"Invalid mnemonic phrase\"", ")", "if", "len", "(", "arg_2", ")", ">", "13", ":", "arg_1", "=", "arg_2", "[", ":", "24", "]", "else", ":", "arg_1", "=", "arg_2", "[", ":", "12", "]", "arg_3", "=", "\"\"", ".", "join", "(", "word", "[", ":", "arg_0", ".", "unique_prefix_length", "]", "for", "word", "in", "arg_1", ")", "arg_3", "=", "bytearray", "(", "arg_3", ".", "encode", "(", "'utf-8'", ")", ")", "arg_4", "=", "(", "(", "crc32", "(", "arg_3", ")", "&", "0xffffffff", ")", "^", "0xffffffff", ")", ">>", "0", "arg_5", "=", "(", "(", "arg_4", "^", "0xffffffff", ")", ">>", "0", ")", "%", "len", "(", "arg_1", ")", "return", "arg_2", "[", "arg_5", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Given a mnemonic word string, return a string of the computed checksum.\n\n        :rtype: str\n        \"\"\"\n        arg_2 = arg_1.split(\" \")\n        if len(arg_2) < 12:\n            raise ValueError(\"Invalid mnemonic phrase\")\n        if len(arg_2) > 13:\n            # Standard format\n            arg_1 = arg_2[:24]\n        else:\n            # MyMonero format\n            arg_1 = arg_2[:12]\n        arg_3 = \"\".join(word[:arg_0.unique_prefix_length] for word in arg_1)\n        arg_3 = bytearray(arg_3.encode('utf-8'))\n        arg_4 = ((crc32(arg_3) & 0xffffffff) ^ 0xffffffff ) >> 0\n        arg_5 = ((arg_4 ^ 0xffffffff) >> 0) % len(arg_1)\n        return arg_2[arg_5]", "path": "monero/wordlists/wordlist.py", "identifier": "Wordlist.get_checksum", "docstring": "Given a mnemonic word string, return a string of the computed checksum.\n\n        :rtype: str", "docstring_tokens": ["Given", "a", "mnemonic", "word", "string", "return", "a", "string", "of", "the", "computed", "checksum", "."], "nwo": "monero-ecosystem/monero-python", "score": 0.4699390838066248, "idx": 253109}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/optimizers/solvers/solver.py#L48-L56", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates a solver from a specification dict.", "language": "python", "parameters": "(config, kwargs=None)", "return_statement": "return util.get_object(\n            obj=config,\n            predefined=tensorforce.core.optimizers.solvers.solvers,\n            kwargs=kwargs\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "util", ".", "get_object", "(", "obj", "=", "arg_0", ",", "predefined", "=", "tensorforce", ".", "core", ".", "optimizers", ".", "solvers", ".", "solvers", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Creates a solver from a specification dict.\n        \"\"\"\n        return util.get_object(\n            obj=arg_0,\n            predefined=tensorforce.core.optimizers.solvers.solvers,\n            arg_1=arg_1\n        )", "path": "tensorforce/core/optimizers/solvers/solver.py", "identifier": "Solver.from_config", "docstring": "Creates a solver from a specification dict.", "docstring_tokens": ["Creates", "a", "solver", "from", "a", "specification", "dict", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 253110}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/GIES.py#L146-L174", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Setting up and running GIES with all arguments.", "language": "python", "parameters": "(self, data, fixedGaps=None, verbose=True)", "return_statement": "return gies_result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "os", ".", "makedirs", "(", "'/tmp/cdt_gies'", "+", "arg_4", "+", "'/'", ")", "arg_0", ".", "arguments", "[", "'{FOLDER}'", "]", "=", "'/tmp/cdt_gies'", "+", "arg_4", "+", "'/'", "def", "retrieve_result", "(", ")", ":", "return", "read_csv", "(", "'/tmp/cdt_gies'", "+", "arg_4", "+", "'/result.csv'", ",", "delimiter", "=", "','", ")", ".", "values", "try", ":", "arg_1", ".", "to_csv", "(", "'/tmp/cdt_gies'", "+", "arg_4", "+", "'/data.csv'", ",", "header", "=", "False", ",", "index", "=", "False", ")", "if", "arg_2", "is", "not", "None", ":", "arg_2", ".", "to_csv", "(", "'/tmp/cdt_gies'", "+", "arg_4", "+", "'/fixedgaps.csv'", ",", "index", "=", "False", ",", "header", "=", "False", ")", "arg_0", ".", "arguments", "[", "'{SKELETON}'", "]", "=", "'TRUE'", "else", ":", "arg_0", ".", "arguments", "[", "'{SKELETON}'", "]", "=", "'FALSE'", "arg_6", "=", "launch_R_script", "(", "\"{}/R_templates/gies.R\"", ".", "format", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ")", ",", "arg_0", ".", "arguments", ",", "output_function", "=", "retrieve_result", ",", "arg_3", "=", "arg_3", ")", "except", "Exception", "as", "e", ":", "rmtree", "(", "'/tmp/cdt_gies'", "+", "arg_4", "+", "''", ")", "raise", "e", "except", "KeyboardInterrupt", ":", "rmtree", "(", "'/tmp/cdt_gies'", "+", "arg_4", "+", "'/'", ")", "raise", "KeyboardInterrupt", "rmtree", "(", "'/tmp/cdt_gies'", "+", "arg_4", "+", "''", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=True):\n        \"\"\"Setting up and running GIES with all arguments.\"\"\"\n        # Run gies\n        arg_4 = str(uuid.uuid4())\n        os.makedirs('/tmp/cdt_gies' + arg_4 + '/')\n        arg_0.arguments['{FOLDER}'] = '/tmp/cdt_gies' + arg_4 + '/'\n\n        def retrieve_result():\n            return read_csv('/tmp/cdt_gies' + arg_4 + '/result.csv', delimiter=',').values\n\n        try:\n            arg_1.to_csv('/tmp/cdt_gies' + arg_4 + '/data.csv', header=False, index=False)\n            if arg_2 is not None:\n                arg_2.to_csv('/tmp/cdt_gies' + arg_4 + '/fixedgaps.csv', index=False, header=False)\n                arg_0.arguments['{SKELETON}'] = 'TRUE'\n            else:\n                arg_0.arguments['{SKELETON}'] = 'FALSE'\n\n            arg_6 = launch_R_script(\"{}/R_templates/gies.R\".format(os.path.dirname(os.path.realpath(__file__))),\n                                          arg_0.arguments, output_function=retrieve_result, arg_3=arg_3)\n        # Cleanup\n        except Exception as e:\n            rmtree('/tmp/cdt_gies' + arg_4 + '')\n            raise e\n        except KeyboardInterrupt:\n            rmtree('/tmp/cdt_gies' + arg_4 + '/')\n            raise KeyboardInterrupt\n        rmtree('/tmp/cdt_gies' + arg_4 + '')\n        return arg_6", "path": "cdt/causality/graph/GIES.py", "identifier": "GIES._run_gies", "docstring": "Setting up and running GIES with all arguments.", "docstring_tokens": ["Setting", "up", "and", "running", "GIES", "with", "all", "arguments", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 253111}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/batch_reshape.py#L210-L232", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes graph and static `sample_shape`.", "language": "python", "parameters": "(self, x)", "return_statement": "return sample_shape, static_sample_shape", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "tf", ".", "rank", "(", "arg_1", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_1", ".", "shape", ")", "is", "None", "else", "tensorshape_util", ".", "rank", "(", "arg_1", ".", "shape", ")", ")", "arg_3", "=", "(", "tf", ".", "size", "(", "input", "=", "arg_0", ".", "event_shape_tensor", "(", ")", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_0", ".", "event_shape", ")", "is", "None", "else", "tensorshape_util", ".", "rank", "(", "arg_0", ".", "event_shape", ")", ")", "arg_4", "=", "(", "tf", ".", "size", "(", "input", "=", "arg_0", ".", "_batch_shape_unexpanded", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_0", ".", "batch_shape", ")", "is", "None", "else", "tensorshape_util", ".", "rank", "(", "arg_0", ".", "batch_shape", ")", ")", "arg_5", "=", "arg_2", "-", "arg_4", "-", "arg_3", "if", "isinstance", "(", "arg_5", ",", "int", ")", ":", "arg_6", "=", "arg_1", ".", "shape", "[", ":", "arg_5", "]", "else", ":", "arg_6", "=", "tf", ".", "TensorShape", "(", "None", ")", "if", "tensorshape_util", ".", "is_fully_defined", "(", "arg_6", ")", ":", "arg_7", "=", "np", ".", "int32", "(", "arg_6", ")", "else", ":", "arg_7", "=", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", "[", ":", "arg_5", "]", "return", "arg_7", ",", "arg_6"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Computes graph and static `sample_shape`.\"\"\"\n    arg_2 = (\n        tf.rank(arg_1) if tensorshape_util.rank(arg_1.shape) is None else\n        tensorshape_util.rank(arg_1.shape))\n    arg_3 = (\n        tf.size(input=arg_0.event_shape_tensor())\n        if tensorshape_util.rank(arg_0.event_shape) is None else\n        tensorshape_util.rank(arg_0.event_shape))\n    arg_4 = (\n        tf.size(input=arg_0._batch_shape_unexpanded)\n        if tensorshape_util.rank(arg_0.batch_shape) is None else\n        tensorshape_util.rank(arg_0.batch_shape))\n    arg_5 = arg_2 - arg_4 - arg_3\n    if isinstance(arg_5, int):\n      arg_6 = arg_1.shape[:arg_5]\n    else:\n      arg_6 = tf.TensorShape(None)\n    if tensorshape_util.is_fully_defined(arg_6):\n      arg_7 = np.int32(arg_6)\n    else:\n      arg_7 = tf.shape(input=arg_1)[:arg_5]\n    return arg_7, arg_6", "path": "tensorflow_probability/python/distributions/batch_reshape.py", "identifier": "BatchReshape._sample_shape", "docstring": "Computes graph and static `sample_shape`.", "docstring_tokens": ["Computes", "graph", "and", "static", "sample_shape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253112}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dav_error.py#L282-L290", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Convert any non-DAVError exception to HTTP_INTERNAL_ERROR.", "language": "python", "parameters": "(e)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "DAVError", ")", ":", "return", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "Exception", ")", ":", "return", "DAVError", "(", "HTTP_INTERNAL_ERROR", ",", "src_exception", "=", "arg_0", ")", "else", ":", "return", "DAVError", "(", "HTTP_INTERNAL_ERROR", ",", "\"{}\"", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Convert any non-DAVError exception to HTTP_INTERNAL_ERROR.\"\"\"\n    if isinstance(arg_0, DAVError):\n        return arg_0\n    elif isinstance(arg_0, Exception):\n        # traceback.print_exc()\n        return DAVError(HTTP_INTERNAL_ERROR, src_exception=arg_0)\n    else:\n        return DAVError(HTTP_INTERNAL_ERROR, \"{}\".format(arg_0))", "path": "wsgidav/dav_error.py", "identifier": "as_DAVError", "docstring": "Convert any non-DAVError exception to HTTP_INTERNAL_ERROR.", "docstring_tokens": ["Convert", "any", "non", "-", "DAVError", "exception", "to", "HTTP_INTERNAL_ERROR", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 253113}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/extensions/gedit/gedit2-plugin/shoebotit/__init__.py#L186-L196", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Grab contents of 'doc' and return it", "language": "python", "parameters": "(self, doc)", "return_statement": "return source", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_start_iter", "(", ")", "arg_3", "=", "arg_1", ".", "get_end_iter", "(", ")", "arg_4", "=", "arg_1", ".", "get_text", "(", "arg_2", ",", "arg_3", ",", "False", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Grab contents of 'doc' and return it\n\n        :param doc: The active document\n        :return:\n        \"\"\"\n        arg_2 = arg_1.get_start_iter()\n        arg_3 = arg_1.get_end_iter()\n        arg_4 = arg_1.get_text(arg_2, arg_3, False)\n        return arg_4", "path": "extensions/gedit/gedit2-plugin/shoebotit/__init__.py", "identifier": "ShoebotWindowHelper.get_source", "docstring": "Grab contents of 'doc' and return it\n\n        :param doc: The active document\n        :return:", "docstring_tokens": ["Grab", "contents", "of", "doc", "and", "return", "it"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253114}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/variant/clnsig.py#L2-L10", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "docstring for build_clnsig", "language": "python", "parameters": "(clnsig_info)", "return_statement": "return clnsig_obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", "value", "=", "arg_0", "[", "'value'", "]", ",", "accession", "=", "arg_0", ".", "get", "(", "'accession'", ")", ",", "revstat", "=", "arg_0", ".", "get", "(", "'revstat'", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"docstring for Func\"\"\"\n    arg_1 = dict(\n        value = arg_0['value'],\n        accession = arg_0.get('accession'),\n        revstat = arg_0.get('revstat')\n    )\n    \n    return arg_1", "path": "scout/build/variant/clnsig.py", "identifier": "build_clnsig", "docstring": "docstring for build_clnsig", "docstring_tokens": ["docstring", "for", "build_clnsig"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253115}
{"url": "https://github.com/rbw/flask-journey/blob/6181f59a7b5eef6a85b86ce6ed7d03c91f6bd285/flask_journey/utils.py#L50-L107", "sha": "6181f59a7b5eef6a85b86ce6ed7d03c91f6bd285", "docstring_summary": "Journey route decorator", "language": "python", "parameters": "(bp, *args, **kwargs)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", "[", "'strict_slashes'", "]", "=", "arg_2", ".", "pop", "(", "'strict_slashes'", ",", "False", ")", "arg_3", "=", "_validate_schema", "(", "arg_2", ".", "pop", "(", "'_body'", ",", "None", ")", ")", "arg_4", "=", "_validate_schema", "(", "arg_2", ".", "pop", "(", "'_query'", ",", "None", ")", ")", "arg_5", "=", "_validate_schema", "(", "arg_2", ".", "pop", "(", "'marshal_with'", ",", "None", ")", ")", "arg_6", "=", "arg_2", ".", "pop", "(", "'validate'", ",", "True", ")", "def", "decorator", "(", "arg_7", ")", ":", "@", "arg_0", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "@", "wraps", "(", "arg_7", ")", "def", "wrapper", "(", "*", "arg_8", ",", "**", "arg_9", ")", ":", "try", ":", "if", "arg_4", "is", "not", "None", ":", "arg_4", ".", "strict", "=", "arg_6", "arg_11", "=", "furl", "(", "request", ".", "url", ")", "arg_9", "[", "'_query'", "]", "=", "arg_4", ".", "load", "(", "arg_13", "=", "arg_11", ".", "args", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", ".", "strict", "=", "arg_6", "arg_12", "=", "request", ".", "get_json", "(", ")", "if", "arg_12", "is", "None", ":", "arg_12", "=", "{", "}", "arg_9", "[", "'_body'", "]", "=", "arg_3", ".", "load", "(", "arg_13", "=", "arg_12", ")", "except", "ValidationError", "as", "err", ":", "return", "jsonify", "(", "err", ".", "messages", ")", ",", "422", "if", "arg_5", ":", "arg_13", "=", "arg_5", ".", "dump", "(", "arg_7", "(", "*", "arg_8", ",", "**", "arg_9", ")", ")", "return", "jsonify", "(", "arg_13", "[", "0", "]", ")", "return", "arg_7", "(", "*", "arg_8", ",", "**", "arg_9", ")", "return", "arg_7", "return", "decorator"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"Journey Func decorator\n\n    Enables simple serialization, deserialization and validation of Flask Funcs with the help of Marshmallow.\n\n    :param bp: :class:`flask.Blueprint` object\n    :param args: args to pass along to `Blueprint.Func`\n    :param kwargs:\n        - :strict_slashes: Enable / disable strict slashes (default False)\n        - :validate: Enable / disable body/query validation (default True)\n        - :_query: Unmarshal Query string into this schema\n        - :_body: Unmarshal JSON body into this schema\n        - :marshal_with: Serialize the output with this schema\n    :raises:\n        - ValidationError if the query parameters or JSON body fails validation\n    \"\"\"\n\n    arg_2['strict_slashes'] = arg_2.pop('strict_slashes', False)\n    arg_3 = _validate_schema(arg_2.pop('_body', None))\n    arg_4 = _validate_schema(arg_2.pop('_query', None))\n    arg_5 = _validate_schema(arg_2.pop('marshal_with', None))\n    arg_6 = arg_2.pop('validate', True)\n\n    def decorator(arg_7):\n        @arg_0.Func(*arg_1, **arg_2)\n        @wraps(arg_7)\n        def wrapper(*arg_8, **arg_9):\n            \"\"\"If a schema (_body and/or _query) was supplied to the Func decorator, the deserialized\n            :class`marshmallow.Schema` object is injected into the decorated function's kwargs.\"\"\"\n\n            try:\n                if arg_4 is not None:\n                    arg_4.strict = arg_6\n                    arg_11 = furl(request.url)\n                    arg_9['_query'] = arg_4.load(arg_13=arg_11.args)\n\n                if arg_3 is not None:\n                    arg_3.strict = arg_6\n                    arg_12 = request.get_json()\n\n                    if arg_12 is None:\n                        # Set json_data to empty dict if body is empty, so it gets picked up by the validator\n                        arg_12 = {}\n\n                    arg_9['_body'] = arg_3.load(arg_13=arg_12)\n\n            except ValidationError as err:\n                return jsonify(err.messages), 422\n\n            if arg_5:\n                arg_13 = arg_5.dump(arg_7(*arg_8, **arg_9))\n                return jsonify(arg_13[0])\n\n            return arg_7(*arg_8, **arg_9)\n\n        return arg_7\n\n    return decorator", "path": "flask_journey/utils.py", "identifier": "route", "docstring": "Journey route decorator\n\n    Enables simple serialization, deserialization and validation of Flask routes with the help of Marshmallow.\n\n    :param bp: :class:`flask.Blueprint` object\n    :param args: args to pass along to `Blueprint.route`\n    :param kwargs:\n        - :strict_slashes: Enable / disable strict slashes (default False)\n        - :validate: Enable / disable body/query validation (default True)\n        - :_query: Unmarshal Query string into this schema\n        - :_body: Unmarshal JSON body into this schema\n        - :marshal_with: Serialize the output with this schema\n    :raises:\n        - ValidationError if the query parameters or JSON body fails validation", "docstring_tokens": ["Journey", "route", "decorator"], "nwo": "rbw/flask-journey", "score": 0.1903525543429651, "idx": 253116}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L570-L583", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Check for escape character and return either a handler to handle it,\n        or None if there is no escape char.", "language": "python", "parameters": "(self, line_info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "line", "[", "-", "1", "]", "==", "ESC_HELP", "and", "arg_1", ".", "esc", "!=", "ESC_SHELL", "and", "arg_1", ".", "esc", "!=", "ESC_SH_CAP", ":", "return", "arg_0", ".", "prefilter_manager", ".", "get_handler_by_name", "(", "'help'", ")", "else", ":", "if", "arg_1", ".", "pre", ":", "return", "None", "return", "arg_0", ".", "prefilter_manager", ".", "get_handler_by_esc", "(", "arg_1", ".", "esc", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check for escape character and return either a handler to handle it,\n        or None if there is no escape char.\"\"\"\n        if arg_1.line[-1] == ESC_HELP \\\n               and arg_1.esc != ESC_SHELL \\\n               and arg_1.esc != ESC_SH_CAP:\n            # the ? can be at the end, but *not* for either kind of shell escape,\n            # because a ? can be a vaild final char in a shell cmd\n            return arg_0.prefilter_manager.get_handler_by_name('help')\n        else:\n            if arg_1.pre:\n                return None\n            # This returns None like it should if no handler exists\n            return arg_0.prefilter_manager.get_handler_by_esc(arg_1.esc)", "path": "environment/lib/python2.7/site-packages/IPython/core/prefilter.py", "identifier": "EscCharsChecker.check", "docstring": "Check for escape character and return either a handler to handle it,\n        or None if there is no escape char.", "docstring_tokens": ["Check", "for", "escape", "character", "and", "return", "either", "a", "handler", "to", "handle", "it", "or", "None", "if", "there", "is", "no", "escape", "char", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253117}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/zipkin.py#L534-L543", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Updates the binary annotations for the current span.", "language": "python", "parameters": "(self, extra_annotations)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "logging_context", ":", "arg_0", ".", "binary_annotations", ".", "update", "(", "arg_1", ")", "else", ":", "arg_0", ".", "logging_context", ".", "tags", ".", "update", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Updates the binary annotations for the current span.\"\"\"\n        if not arg_0.logging_context:\n            # This is not the root span, so binary annotations will be added\n            # to the log handler when this span context exits.\n            arg_0.binary_annotations.update(arg_1)\n        else:\n            # Otherwise, we're in the context of the root span, so just update\n            # the binary annotations for the logging context directly.\n            arg_0.logging_context.tags.update(arg_1)", "path": "py_zipkin/zipkin.py", "identifier": "zipkin_span.update_binary_annotations", "docstring": "Updates the binary annotations for the current span.", "docstring_tokens": ["Updates", "the", "binary", "annotations", "for", "the", "current", "span", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 253118}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/examples/utils.py#L18-L30", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Find the location of a dataset on disk, downloading if needed.", "language": "python", "parameters": "(dataset, url)", "return_statement": "return fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "DATASETS", ",", "arg_0", ")", "arg_3", "=", "os", ".", "path", ".", "dirname", "(", "arg_2", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "print", "(", "'creating dataset directory: %s'", ",", "arg_3", ")", "os", ".", "makedirs", "(", "arg_3", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "if", "sys", ".", "version_info", "<", "(", "3", ",", ")", ":", "urllib", ".", "urlretrieve", "(", "arg_1", ",", "arg_2", ")", "else", ":", "urllib", ".", "request", ".", "urlretrieve", "(", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''Find the location of a dataset on disk, downloading if needed.'''\n    arg_2 = os.path.join(DATASETS, arg_0)\n    arg_3 = os.path.dirname(arg_2)\n    if not os.path.exists(arg_3):\n        print('creating dataset directory: %s', arg_3)\n        os.makedirs(arg_3)\n    if not os.path.exists(arg_2):\n        if sys.version_info < (3, ):\n            urllib.urlretrieve(arg_1, arg_2)\n        else:\n            urllib.request.urlretrieve(arg_1, arg_2)\n    return arg_2", "path": "examples/utils.py", "identifier": "find", "docstring": "Find the location of a dataset on disk, downloading if needed.", "docstring_tokens": ["Find", "the", "location", "of", "a", "dataset", "on", "disk", "downloading", "if", "needed", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 253119}
{"url": "https://github.com/reinout/createcoverage/blob/8062cf77bcaf74fe902917a2661c3f1e02aac36c/createcoverage/script.py#L38-L94", "sha": "8062cf77bcaf74fe902917a2661c3f1e02aac36c", "docstring_summary": "Create coverage reports and open them in the browser.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "\"Usage: %prog PATH_TO_PACKAGE\"", "arg_1", "=", "optparse", ".", "OptionParser", "(", "arg_0", "=", "arg_0", ")", "arg_1", ".", "add_option", "(", "\"-v\"", ",", "\"--verbose\"", ",", "action", "=", "\"store_true\"", ",", "dest", "=", "\"verbose\"", ",", "default", "=", "False", ",", "help", "=", "\"Show debug output\"", ")", "arg_1", ".", "add_option", "(", "\"-d\"", ",", "\"--output-dir\"", ",", "action", "=", "\"store\"", ",", "type", "=", "\"string\"", ",", "dest", "=", "\"output_dir\"", ",", "default", "=", "''", ",", "help", "=", "\"\"", ")", "arg_1", ".", "add_option", "(", "\"-t\"", ",", "\"--test-args\"", ",", "action", "=", "\"store\"", ",", "type", "=", "\"string\"", ",", "dest", "=", "\"test_args\"", ",", "default", "=", "''", ",", "help", "=", "(", "\"Pass argument on to bin/test. Quote the argument, \"", "+", "\"for instance \\\"-t '-m somemodule'\\\".\"", ")", ")", "(", "arg_2", ",", "arg_3", ")", "=", "arg_1", ".", "parse_args", "(", ")", "if", "arg_2", ".", "verbose", ":", "arg_4", "=", "logging", ".", "DEBUG", "else", ":", "arg_4", "=", "logging", ".", "INFO", "logging", ".", "basicConfig", "(", "level", "=", "arg_4", ",", "format", "=", "\"%(levelname)s: %(message)s\"", ")", "arg_5", "=", "os", ".", "getcwd", "(", ")", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'bin'", ",", "'test'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "raise", "RuntimeError", "(", "\"Test command doesn't exist: %s\"", "%", "arg_6", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'bin'", ",", "'coverage'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_7", ")", ":", "logger", ".", "debug", "(", "\"Trying globally installed coverage command.\"", ")", "arg_7", "=", "'coverage'", "logger", ".", "info", "(", "\"Running tests in coverage mode (can take a long time)\"", ")", "arg_8", "=", "[", "arg_7", ",", "'run'", ",", "arg_6", "]", "if", "arg_2", ".", "test_args", ":", "arg_8", ".", "append", "(", "arg_2", ".", "test_args", ")", "system", "(", "\" \"", ".", "join", "(", "arg_8", ")", ")", "logger", ".", "debug", "(", "\"Creating coverage reports...\"", ")", "if", "arg_2", ".", "output_dir", ":", "arg_9", "=", "arg_2", ".", "output_dir", "arg_10", "=", "False", "else", ":", "arg_9", "=", "'htmlcov'", "arg_10", "=", "True", "system", "(", "\"%s html --directory=%s\"", "%", "(", "arg_7", ",", "arg_9", ")", ")", "logger", ".", "info", "(", "\"Wrote coverage files to %s\"", ",", "arg_9", ")", "if", "arg_10", ":", "arg_11", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "arg_9", ",", "'index.html'", ")", ")", "logger", ".", "debug", "(", "\"About to open %s in your webbrowser.\"", ",", "arg_11", ")", "webbrowser", ".", "open", "(", "'file://'", "+", "arg_11", ")", "logger", ".", "info", "(", "\"Opened reports in your browser.\"", ")"], "function": "def Func():\n    \"\"\"Create coverage reports and open them in the browser.\"\"\"\n    arg_0 = \"Usage: %prog PATH_TO_PACKAGE\"\n    arg_1 = optparse.OptionParser(arg_0=arg_0)\n    arg_1.add_option(\n        \"-v\", \"--verbose\",\n        action=\"store_true\", dest=\"verbose\", default=False,\n        help=\"Show debug output\")\n    arg_1.add_option(\n        \"-d\", \"--output-dir\",\n        action=\"store\", type=\"string\", dest=\"output_dir\",\n        default='',\n        help=\"\")\n    arg_1.add_option(\n        \"-t\", \"--test-args\",\n        action=\"store\", type=\"string\", dest=\"test_args\",\n        default='',\n        help=(\"Pass argument on to bin/test. Quote the argument, \" +\n              \"for instance \\\"-t '-m somemodule'\\\".\"))\n    (arg_2, arg_3) = arg_1.parse_args()\n    if arg_2.verbose:\n        arg_4 = logging.DEBUG\n    else:\n        arg_4 = logging.INFO\n    logging.basicConfig(level=arg_4,\n                        format=\"%(levelname)s: %(message)s\")\n\n    arg_5 = os.getcwd()\n    arg_6 = os.path.join(arg_5, 'bin', 'test')\n    if not os.path.exists(arg_6):\n        raise RuntimeError(\"Test command doesn't exist: %s\" % arg_6)\n\n    arg_7 = os.path.join(arg_5, 'bin', 'coverage')\n    if not os.path.exists(arg_7):\n        logger.debug(\"Trying globally installed coverage command.\")\n        arg_7 = 'coverage'\n\n    logger.info(\"Running tests in coverage mode (can take a long time)\")\n    arg_8 = [arg_7, 'run', arg_6]\n    if arg_2.test_args:\n        arg_8.append(arg_2.test_args)\n    system(\" \".join(arg_8))\n    logger.debug(\"Creating coverage reports...\")\n    if arg_2.output_dir:\n        arg_9 = arg_2.output_dir\n        arg_10 = False\n    else:\n        arg_9 = 'htmlcov'  # The default\n        arg_10 = True\n    system(\"%s html --directory=%s\" % (arg_7, arg_9))\n    logger.info(\"Wrote coverage files to %s\", arg_9)\n    if arg_10:\n        arg_11 = os.path.abspath(\n            os.path.join(arg_9, 'index.html'))\n        logger.debug(\"About to open %s in your webbrowser.\", arg_11)\n        webbrowser.open('file://' + arg_11)\n        logger.info(\"Opened reports in your browser.\")", "path": "createcoverage/script.py", "identifier": "main", "docstring": "Create coverage reports and open them in the browser.", "docstring_tokens": ["Create", "coverage", "reports", "and", "open", "them", "in", "the", "browser", "."], "nwo": "reinout/createcoverage", "score": 0.21302904236143622, "idx": 253120}
{"url": "https://github.com/hefnawi/json-storage-manager/blob/c7521fc4a576cf23a8c2454106bed6fb8c951b8d/json_storage_manager/atomic.py#L9-L17", "sha": "c7521fc4a576cf23a8c2454106bed6fb8c951b8d", "docstring_summary": "Create a NamedTemporaryFile instance to be passed to atomic_writer", "language": "python", "parameters": "(filename)", "return_statement": "return tempfile.NamedTemporaryFile(mode='w',\n                                       dir=os.path.dirname(filename),\n                                       prefix=os.path.basename(filename),\n                                       suffix=os.fsencode('.tmp'),\n                                       delete=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "tempfile", ".", "NamedTemporaryFile", "(", "mode", "=", "'w'", ",", "dir", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", ",", "prefix", "=", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ",", "suffix", "=", "os", ".", "fsencode", "(", "'.tmp'", ")", ",", "delete", "=", "False", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Create a NamedTemporaryFile instance to be passed to atomic_writer\n    \"\"\"\n    return tempfile.NamedTemporaryFile(mode='w',\n                                       dir=os.path.dirname(arg_0),\n                                       prefix=os.path.basename(arg_0),\n                                       suffix=os.fsencode('.tmp'),\n                                       delete=False)", "path": "json_storage_manager/atomic.py", "identifier": "_tempfile", "docstring": "Create a NamedTemporaryFile instance to be passed to atomic_writer", "docstring_tokens": ["Create", "a", "NamedTemporaryFile", "instance", "to", "be", "passed", "to", "atomic_writer"], "nwo": "hefnawi/json-storage-manager", "score": 0.08529914490135834, "idx": 253121}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/migrations/0067_add_role_based_access_control_switch.py#L9-L12", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Create the `role_based_access_control` switch if it does not already exist.", "language": "python", "parameters": "(apps, schema_editor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_model", "(", "'waffle'", ",", "'Switch'", ")", "arg_2", ".", "objects", ".", "update_or_create", "(", "name", "=", "ENTERPRISE_ROLE_BASED_ACCESS_CONTROL_SWITCH", ",", "defaults", "=", "{", "'active'", ":", "False", "}", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Create the `role_based_access_control` switch if it does not already exist.\"\"\"\n    arg_2 = arg_0.get_model('waffle', 'Switch')\n    arg_2.objects.update_or_create(name=ENTERPRISE_ROLE_BASED_ACCESS_CONTROL_SWITCH, defaults={'active': False})", "path": "enterprise/migrations/0067_add_role_based_access_control_switch.py", "identifier": "create_switch", "docstring": "Create the `role_based_access_control` switch if it does not already exist.", "docstring_tokens": ["Create", "the", "role_based_access_control", "switch", "if", "it", "does", "not", "already", "exist", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253122}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L251-L259", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Called when transport has been connected.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "lock", ":", "if", "arg_0", ".", "initiator", ":", "if", "arg_0", ".", "_output_state", "is", "None", ":", "arg_0", ".", "_initiate", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Called when transport has been connected.\n\n        Send the stream head if initiator.\n        \"\"\"\n        with arg_0.lock:\n            if arg_0.initiator:\n                if arg_0._output_state is None:\n                    arg_0._initiate()", "path": "pyxmpp2/streambase.py", "identifier": "StreamBase.transport_connected", "docstring": "Called when transport has been connected.\n\n        Send the stream head if initiator.", "docstring_tokens": ["Called", "when", "transport", "has", "been", "connected", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253123}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2266-L2281", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Returns the Session currently used.", "language": "python", "parameters": "(self)", "return_statement": "return pysession", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_lib", ".", "SSL_get1_session", "(", "arg_0", ".", "_ssl", ")", "if", "arg_1", "==", "_ffi", ".", "NULL", ":", "return", "None", "arg_2", "=", "Session", ".", "__new__", "(", "Session", ")", "arg_2", ".", "_session", "=", "_ffi", ".", "gc", "(", "arg_1", ",", "_lib", ".", "SSL_SESSION_free", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the Session currently used.\n\n        :return: An instance of :class:`OpenSSL.SSL.Session` or\n            :obj:`None` if no session exists.\n\n        .. versionadded:: 0.14\n        \"\"\"\n        arg_1 = _lib.SSL_get1_session(arg_0._ssl)\n        if arg_1 == _ffi.NULL:\n            return None\n\n        arg_2 = Session.__new__(Session)\n        arg_2._session = _ffi.gc(arg_1, _lib.SSL_SESSION_free)\n        return arg_2", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.get_session", "docstring": "Returns the Session currently used.\n\n        :return: An instance of :class:`OpenSSL.SSL.Session` or\n            :obj:`None` if no session exists.\n\n        .. versionadded:: 0.14", "docstring_tokens": ["Returns", "the", "Session", "currently", "used", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 253124}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L433-L436", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Render the sourcecode.", "language": "python", "parameters": "(self)", "return_statement": "return SOURCE_TABLE_HTML % u'\\n'.join(line.render() for line in\n                                              self.get_annotated_lines())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "SOURCE_TABLE_HTML", "%", "u'\\n'", ".", "join", "(", "arg_1", ".", "render", "(", ")", "for", "arg_1", "in", "arg_0", ".", "get_annotated_lines", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Render the sourcecode.\"\"\"\n        return SOURCE_TABLE_HTML % u'\\n'.join(arg_1.render() for arg_1 in\n                                              arg_0.get_annotated_lines())", "path": "capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py", "identifier": "Frame.render_source", "docstring": "Render the sourcecode.", "docstring_tokens": ["Render", "the", "sourcecode", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253125}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/chemistry.py#L26-L75", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Returns molecular weight of molecule.", "language": "python", "parameters": "(molecule)", "return_statement": "return m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "elements", "(", ")", "arg_2", "=", "re", ".", "compile", "(", "'\\(([A-z0-9]+)\\)([0-9]+)?'", ")", "arg_3", "=", "re", ".", "compile", "(", "'([A-Z][a-z]?)([0-9]+)?'", ")", "arg_4", "=", "arg_2", ".", "findall", "(", "arg_0", ")", "arg_5", "=", "arg_2", ".", "sub", "(", "''", ",", "arg_0", ")", "arg_6", "=", "0", "if", "len", "(", "arg_4", ")", ">", "0", ":", "for", "arg_7", ",", "arg_8", "in", "arg_4", ":", "arg_9", "=", "0", "for", "arg_10", ",", "arg_11", "in", "arg_3", ".", "findall", "(", "arg_7", ")", ":", "arg_12", "=", "(", "arg_1", ".", "loc", "[", "arg_10", ",", "'atomic_weight'", "]", "*", "arg_1", ".", "loc", "[", "arg_10", ",", "'percent'", "]", "/", "100", ")", ".", "sum", "(", ")", "if", "arg_11", "==", "''", ":", "arg_11", "=", "1", "else", ":", "arg_11", "=", "int", "(", "arg_11", ")", "arg_9", "+=", "arg_12", "*", "arg_11", "if", "arg_8", "==", "''", ":", "arg_8", "=", "1", "else", ":", "arg_8", "=", "int", "(", "arg_8", ")", "arg_6", "+=", "arg_9", "*", "arg_8", "for", "arg_10", ",", "arg_11", "in", "arg_3", ".", "findall", "(", "arg_5", ")", ":", "arg_12", "=", "(", "arg_1", ".", "loc", "[", "arg_10", ",", "'atomic_weight'", "]", "*", "arg_1", ".", "loc", "[", "arg_10", ",", "'percent'", "]", "/", "100", ")", ".", "sum", "(", ")", "if", "arg_11", "==", "''", ":", "arg_11", "=", "1", "else", ":", "arg_11", "=", "int", "(", "arg_11", ")", "arg_6", "+=", "arg_12", "*", "arg_11", "return", "arg_6"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns molecular weight of molecule.\n\n    Where molecule is in standard chemical notation,\n    e.g. 'CO2', 'HCO3' or B(OH)4\n\n    Returns\n    -------\n    molecular_weight : float\n    \"\"\"\n\n    # load periodic table\n    arg_1 = elements()\n\n    # define regexs\n    arg_2 = re.compile('\\(([A-z0-9]+)\\)([0-9]+)?')\n    arg_3 = re.compile('([A-Z][a-z]?)([0-9]+)?')\n\n    arg_4 = arg_2.findall(arg_0)  # find subgroups in parentheses\n    arg_5 = arg_2.sub('', arg_0)  # get remainder\n\n    arg_6 = 0\n    # deal with sub-groups\n    if len(arg_4) > 0:\n        for arg_7, arg_8 in arg_4:\n            arg_9 = 0\n            for arg_10, arg_11 in arg_3.findall(arg_7):\n                arg_12 = (arg_1.loc[arg_10, 'atomic_weight'] *\n                      arg_1.loc[arg_10, 'percent'] / 100).sum()\n                if arg_11 == '':\n                    arg_11 = 1\n                else:\n                    arg_11 = int(arg_11)\n                arg_9 += arg_12 * arg_11\n            if arg_8 == '':\n                arg_8 = 1\n            else:\n                arg_8 = int(arg_8)\n            arg_6 += arg_9 * arg_8\n    # deal with remainder\n    for arg_10, arg_11 in arg_3.findall(arg_5):\n        arg_12 = (arg_1.loc[arg_10, 'atomic_weight'] *\n              arg_1.loc[arg_10, 'percent'] / 100).sum()\n        if arg_11 == '':\n            arg_11 = 1\n        else:\n            arg_11 = int(arg_11)\n        arg_6 += arg_12 * arg_11\n    return arg_6", "path": "latools/helpers/chemistry.py", "identifier": "calc_M", "docstring": "Returns molecular weight of molecule.\n\n    Where molecule is in standard chemical notation,\n    e.g. 'CO2', 'HCO3' or B(OH)4\n\n    Returns\n    -------\n    molecular_weight : float", "docstring_tokens": ["Returns", "molecular", "weight", "of", "molecule", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 253126}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/base.py#L419-L453", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return a description of the given bit in the encoded output.\n    This will include the field name and the offset within the field.", "language": "python", "parameters": "(self, bitOffset, formatted=False)", "return_statement": "return (prevFieldName, bitOffset - prevFieldOffset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "(", "arg_3", ",", "arg_4", ")", "=", "(", "None", ",", "None", ")", "arg_5", "=", "arg_0", ".", "getDescription", "(", ")", "for", "arg_6", "in", "xrange", "(", "len", "(", "arg_5", ")", ")", ":", "(", "arg_7", ",", "arg_8", ")", "=", "arg_5", "[", "arg_6", "]", "if", "arg_2", ":", "arg_8", "=", "arg_8", "+", "arg_6", "if", "arg_1", "==", "arg_8", "-", "1", ":", "arg_3", "=", "\"separator\"", "arg_4", "=", "arg_1", "break", "if", "arg_1", "<", "arg_8", ":", "break", "(", "arg_3", ",", "arg_4", ")", "=", "(", "arg_7", ",", "arg_8", ")", "arg_9", "=", "arg_0", ".", "getDisplayWidth", "(", ")", "if", "arg_2", "else", "arg_0", ".", "getWidth", "(", ")", "if", "arg_4", "is", "None", "or", "arg_1", ">", "arg_0", ".", "getWidth", "(", ")", ":", "raise", "IndexError", "(", "\"Bit is outside of allowable range: [0 - %d]\"", "%", "arg_9", ")", "return", "(", "arg_3", ",", "arg_1", "-", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Return a description of the given bit in the encoded output.\n    This will include the field name and the offset within the field.\n\n    :param bitOffset:      Offset of the bit to get the description of\n    :param formatted:      If True, the bitOffset is w.r.t. formatted output,\n                          which includes separators\n    :return:             tuple(``fieldName``, ``offsetWithinField``)\n    \"\"\"\n\n    # Find which field it's in\n    (arg_3, arg_4) = (None, None)\n    arg_5 = arg_0.getDescription()\n    for arg_6 in xrange(len(arg_5)):\n      (arg_7, arg_8) = arg_5[arg_6]\n      if arg_2:\n        arg_8 = arg_8 + arg_6\n        if arg_1 == arg_8-1:\n          arg_3 = \"separator\"\n          arg_4 = arg_1\n          break\n\n      if arg_1 < arg_8:\n        break\n      (arg_3, arg_4) = (arg_7, arg_8)\n\n    # Return the field name and offset within the field\n    # return (fieldName, bitOffset - fieldOffset)\n    arg_9 = arg_0.getDisplayWidth() if arg_2 else arg_0.getWidth()\n\n    if arg_4 is None or arg_1 > arg_0.getWidth():\n      raise IndexError(\"Bit is outside of allowable range: [0 - %d]\" % arg_9)\n\n    return (arg_3, arg_1 - arg_4)", "path": "src/nupic/encoders/base.py", "identifier": "Encoder.encodedBitDescription", "docstring": "Return a description of the given bit in the encoded output.\n    This will include the field name and the offset within the field.\n\n    :param bitOffset:      Offset of the bit to get the description of\n    :param formatted:      If True, the bitOffset is w.r.t. formatted output,\n                          which includes separators\n    :return:             tuple(``fieldName``, ``offsetWithinField``)", "docstring_tokens": ["Return", "a", "description", "of", "the", "given", "bit", "in", "the", "encoded", "output", ".", "This", "will", "include", "the", "field", "name", "and", "the", "offset", "within", "the", "field", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253127}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/artist.py#L137-L148", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Get Spotify catalog information about artists similar to a given artist.", "language": "python", "parameters": "(self)", "return_statement": "return list(Artist(self.__client, item) for item in related['artists'])", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", "->", "List", "[", "Artist", "]", ":", "arg_1", "=", "await", "arg_0", ".", "__client", ".", "http", ".", "artist_Func", "(", "arg_0", ".", "id", ")", "return", "list", "(", "Artist", "(", "arg_0", ".", "__client", ",", "arg_2", ")", "for", "arg_2", "in", "arg_1", "[", "'artists'", "]", ")"], "function": "async def Func(arg_0) -> List[Artist]:\n        \"\"\"Get Spotify catalog information about artists similar to a given artist.\n\n        Similarity is based on analysis of the Spotify community\u2019s listening history.\n\n        Returns\n        -------\n        artists : List[Artits]\n            The artists deemed similar.\n        \"\"\"\n        arg_1 = await arg_0.__client.http.artist_Func(arg_0.id)\n        return list(Artist(arg_0.__client, arg_2) for arg_2 in arg_1['artists'])", "path": "spotify/models/artist.py", "identifier": "Artist.related_artists", "docstring": "Get Spotify catalog information about artists similar to a given artist.\n\n        Similarity is based on analysis of the Spotify community\u2019s listening history.\n\n        Returns\n        -------\n        artists : List[Artits]\n            The artists deemed similar.", "docstring_tokens": ["Get", "Spotify", "catalog", "information", "about", "artists", "similar", "to", "a", "given", "artist", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 253128}
{"url": "https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L222-L229", "sha": "4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4", "docstring_summary": "Get crate versions data", "language": "python", "parameters": "(self, crate_id)", "return_statement": "return version_downloads", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "client", ".", "crate_attribute", "(", "arg_1", ",", "\"versions\"", ")", "arg_3", "=", "json", ".", "loads", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get crate versions data\"\"\"\n\n        arg_2 = arg_0.client.crate_attribute(arg_1, \"versions\")\n\n        arg_3 = json.loads(arg_2)\n\n        return arg_3", "path": "perceval/backends/mozilla/crates.py", "identifier": "Crates.__fetch_crate_versions", "docstring": "Get crate versions data", "docstring_tokens": ["Get", "crate", "versions", "data"], "nwo": "chaoss/grimoirelab-perceval-mozilla", "score": 0.18579120894425885, "idx": 253129}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L2730-L2761", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Fits a new component to an old component", "language": "python", "parameters": "(new_comp, old_comp, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "category", "arg_0", ".", "category", "=", "'ilm'", "arg_5", "=", "states", ".", "ImageState", "(", "Image", "(", "arg_1", ".", "get", "(", ")", ".", "copy", "(", ")", ")", ",", "[", "arg_0", "]", ",", "pad", "=", "0", ",", "mdl", "=", "mdl", ".", "SmoothFieldModel", "(", ")", ")", "do_levmarq", "(", "arg_5", ",", "arg_0", ".", "params", ",", "**", "arg_2", ")", "arg_0", ".", "category", "=", "arg_3"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"\n    Fits a new component to an old component\n\n    Calls do_levmarq to match the .get() fields of the two objects. The\n    parameters of new_comp are modified in place.\n\n    Parameters\n    ----------\n    new_comp : :class:`peri.comps.comp`\n        The new object, whose parameters to update to fit the field of\n        `old_comp`. Must have a .get() attribute which returns an ndarray\n    old_comp : peri.comp\n        The old ilm to match to.\n\n    Other Parameters\n    ----------------\n        Any keyword arguments to be passed to the optimizer LMGlobals\n        through do_levmarq.\n\n    See Also\n    --------\n    do_levmarq : Levenberg-Marquardt minimization using a random subset\n        of the image pixels.\n    \"\"\"\n    #resetting the category to ilm:\n    arg_3 = arg_0.category\n    arg_0.category = 'ilm'\n    arg_5 = states.ImageState(Image(arg_1.get().copy()), [arg_0], pad=0,\n            mdl=mdl.SmoothFieldModel())\n    do_levmarq(arg_5, arg_0.params, **arg_2)\n    arg_0.category = arg_3", "path": "peri/opt/optimize.py", "identifier": "fit_comp", "docstring": "Fits a new component to an old component\n\n    Calls do_levmarq to match the .get() fields of the two objects. The\n    parameters of new_comp are modified in place.\n\n    Parameters\n    ----------\n    new_comp : :class:`peri.comps.comp`\n        The new object, whose parameters to update to fit the field of\n        `old_comp`. Must have a .get() attribute which returns an ndarray\n    old_comp : peri.comp\n        The old ilm to match to.\n\n    Other Parameters\n    ----------------\n        Any keyword arguments to be passed to the optimizer LMGlobals\n        through do_levmarq.\n\n    See Also\n    --------\n    do_levmarq : Levenberg-Marquardt minimization using a random subset\n        of the image pixels.", "docstring_tokens": ["Fits", "a", "new", "component", "to", "an", "old", "component"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 253130}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/discovery.py#L294-L312", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return single program by name, or None if not found.", "language": "python", "parameters": "(self, program_title)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_load_data", "(", "arg_0", ".", "PROGRAMS_ENDPOINT", ",", "default", "=", "[", "]", ")", "arg_3", "=", "[", "program", "for", "program", "in", "arg_2", "if", "program", ".", "get", "(", "'title'", ")", "==", "arg_1", "]", "if", "len", "(", "arg_3", ")", ">", "1", ":", "raise", "MultipleProgramMatchError", "(", "len", "(", "arg_3", ")", ")", "elif", "len", "(", "arg_3", ")", "==", "1", ":", "return", "arg_3", "[", "0", "]", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return single program by name, or None if not found.\n\n        Arguments:\n            program_title(string): Program title as seen by students and in Course Catalog Admin\n\n        Returns:\n            dict: Program data provided by Course Catalog API\n\n        \"\"\"\n        arg_2 = arg_0._load_data(arg_0.PROGRAMS_ENDPOINT, default=[])\n        arg_3 = [program for program in arg_2 if program.get('title') == arg_1]\n        if len(arg_3) > 1:\n            raise MultipleProgramMatchError(len(arg_3))\n        elif len(arg_3) == 1:\n            return arg_3[0]\n        else:\n            return None", "path": "enterprise/api_client/discovery.py", "identifier": "CourseCatalogApiClient.get_program_by_title", "docstring": "Return single program by name, or None if not found.\n\n        Arguments:\n            program_title(string): Program title as seen by students and in Course Catalog Admin\n\n        Returns:\n            dict: Program data provided by Course Catalog API", "docstring_tokens": ["Return", "single", "program", "by", "name", "or", "None", "if", "not", "found", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253131}
{"url": "https://github.com/imgix/imgix-python/blob/117e0b169552695232689dd0443be7810263e5c5/imgix/urlhelper.py#L75-L92", "sha": "117e0b169552695232689dd0443be7810263e5c5", "docstring_summary": "Set a url parameter.", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "is", "None", "or", "isinstance", "(", "arg_2", ",", "(", "int", ",", "float", ",", "bool", ")", ")", ":", "arg_2", "=", "str", "(", "arg_2", ")", "if", "arg_1", ".", "endswith", "(", "'64'", ")", ":", "arg_2", "=", "urlsafe_b64encode", "(", "arg_2", ".", "encode", "(", "'utf-8'", ")", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "b", "(", "'='", ")", ",", "b", "(", "''", ")", ")", "arg_0", ".", "_parameters", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set a url parameter.\n\n        Parameters\n        ----------\n        key : str\n            If key ends with '64', the value provided will be automatically\n            base64 encoded.\n        \"\"\"\n        if arg_2 is None or isinstance(arg_2, (int, float, bool)):\n            arg_2 = str(arg_2)\n\n        if arg_1.endswith('64'):\n            arg_2 = urlsafe_b64encode(arg_2.encode('utf-8'))\n            arg_2 = arg_2.replace(b('='), b(''))\n\n        arg_0._parameters[arg_1] = arg_2", "path": "imgix/urlhelper.py", "identifier": "UrlHelper.set_parameter", "docstring": "Set a url parameter.\n\n        Parameters\n        ----------\n        key : str\n            If key ends with '64', the value provided will be automatically\n            base64 encoded.", "docstring_tokens": ["Set", "a", "url", "parameter", "."], "nwo": "imgix/imgix-python", "score": 0.28781825117222404, "idx": 253132}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L113-L138", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Add `v` to the hash, recursively if needed.", "language": "python", "parameters": "(self, v)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "md5", ".", "Func", "(", "to_bytes", "(", "str", "(", "type", "(", "arg_1", ")", ")", ")", ")", "if", "isinstance", "(", "arg_1", ",", "string_class", ")", ":", "arg_0", ".", "md5", ".", "Func", "(", "to_bytes", "(", "arg_1", ")", ")", "elif", "arg_1", "is", "None", ":", "pass", "elif", "isinstance", "(", "arg_1", ",", "(", "int", ",", "float", ")", ")", ":", "arg_0", ".", "md5", ".", "Func", "(", "to_bytes", "(", "str", "(", "arg_1", ")", ")", ")", "elif", "isinstance", "(", "arg_1", ",", "(", "tuple", ",", "list", ")", ")", ":", "for", "arg_2", "in", "arg_1", ":", "arg_0", ".", "Func", "(", "arg_2", ")", "elif", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_3", "=", "arg_1", ".", "keys", "(", ")", "for", "arg_4", "in", "sorted", "(", "arg_3", ")", ":", "arg_0", ".", "Func", "(", "arg_4", ")", "arg_0", ".", "Func", "(", "arg_1", "[", "arg_4", "]", ")", "else", ":", "for", "arg_4", "in", "dir", "(", "arg_1", ")", ":", "if", "arg_4", ".", "startswith", "(", "'__'", ")", ":", "continue", "arg_5", "=", "getattr", "(", "arg_1", ",", "arg_4", ")", "if", "inspect", ".", "isroutine", "(", "arg_5", ")", ":", "continue", "arg_0", ".", "Func", "(", "arg_4", ")", "arg_0", ".", "Func", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add `v` to the hash, recursively if needed.\"\"\"\n        arg_0.md5.Func(to_bytes(str(type(arg_1))))\n        if isinstance(arg_1, string_class):\n            arg_0.md5.Func(to_bytes(arg_1))\n        elif arg_1 is None:\n            pass\n        elif isinstance(arg_1, (int, float)):\n            arg_0.md5.Func(to_bytes(str(arg_1)))\n        elif isinstance(arg_1, (tuple, list)):\n            for arg_2 in arg_1:\n                arg_0.Func(arg_2)\n        elif isinstance(arg_1, dict):\n            arg_3 = arg_1.keys()\n            for arg_4 in sorted(arg_3):\n                arg_0.Func(arg_4)\n                arg_0.Func(arg_1[arg_4])\n        else:\n            for arg_4 in dir(arg_1):\n                if arg_4.startswith('__'):\n                    continue\n                arg_5 = getattr(arg_1, arg_4)\n                if inspect.isroutine(arg_5):\n                    continue\n                arg_0.Func(arg_4)\n                arg_0.Func(arg_5)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py", "identifier": "Hasher.update", "docstring": "Add `v` to the hash, recursively if needed.", "docstring_tokens": ["Add", "v", "to", "the", "hash", "recursively", "if", "needed", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253133}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L403-L424", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Enable event loop integration with pyglet.", "language": "python", "parameters": "(self, app=None)", "return_statement": "return app", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "import", "pyglet", "from", "IPython", ".", "lib", ".", "inputhookpyglet", "import", "inputhook_pyglet", "arg_0", ".", "set_inputhook", "(", "inputhook_pyglet", ")", "arg_0", ".", "_current_gui", "=", "GUI_PYGLET", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Enable event loop integration with pyglet.\n\n        Parameters\n        ----------\n        app : ignored\n           Ignored, it's only a placeholder to keep the call signature of all\n           gui activation methods consistent, which simplifies the logic of\n           supporting magics.\n\n        Notes\n        -----\n        This methods sets the ``PyOS_InputHook`` for pyglet, which allows\n        pyglet to integrate with terminal based applications like\n        IPython.\n\n        \"\"\"\n        import pyglet\n        from IPython.lib.inputhookpyglet import inputhook_pyglet\n        arg_0.set_inputhook(inputhook_pyglet)\n        arg_0._current_gui = GUI_PYGLET\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/lib/inputhook.py", "identifier": "InputHookManager.enable_pyglet", "docstring": "Enable event loop integration with pyglet.\n\n        Parameters\n        ----------\n        app : ignored\n           Ignored, it's only a placeholder to keep the call signature of all\n           gui activation methods consistent, which simplifies the logic of\n           supporting magics.\n\n        Notes\n        -----\n        This methods sets the ``PyOS_InputHook`` for pyglet, which allows\n        pyglet to integrate with terminal based applications like\n        IPython.", "docstring_tokens": ["Enable", "event", "loop", "integration", "with", "pyglet", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253134}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1110-L1130", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Retrieves a list of all NICs bound to the specified server.", "language": "python", "parameters": "(self, datacenter_id, server_id, depth=1)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "arg_4", "=", "arg_0", ".", "_perform_request", "(", "'/datacenters/%s/servers/%s/nics?depth=%s'", "%", "(", "arg_1", ",", "arg_2", ",", "str", "(", "arg_3", ")", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n        \"\"\"\n        Retrieves a list of all NICs bound to the specified server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``\n\n        \"\"\"\n        arg_4 = arg_0._perform_request(\n            '/datacenters/%s/servers/%s/nics?depth=%s' % (\n                arg_1,\n                arg_2,\n                str(arg_3)))\n\n        return arg_4", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.list_nics", "docstring": "Retrieves a list of all NICs bound to the specified server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``", "docstring_tokens": ["Retrieves", "a", "list", "of", "all", "NICs", "bound", "to", "the", "specified", "server", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 253135}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/stackexchange.py#L160-L173", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a StackExchange API raw response.", "language": "python", "parameters": "(raw_page)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_0", ")", "arg_2", "=", "arg_1", "[", "'items'", "]", "for", "arg_3", "in", "arg_2", ":", "yield", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Parse a StackExchange API raw response.\n\n        The method parses the API response retrieving the\n        questions from the received items\n\n        :param items: items from where to parse the questions\n\n        :returns: a generator of questions\n        \"\"\"\n        arg_1 = json.loads(arg_0)\n        arg_2 = arg_1['items']\n        for arg_3 in arg_2:\n            yield arg_3", "path": "perceval/backends/core/stackexchange.py", "identifier": "StackExchange.parse_questions", "docstring": "Parse a StackExchange API raw response.\n\n        The method parses the API response retrieving the\n        questions from the received items\n\n        :param items: items from where to parse the questions\n\n        :returns: a generator of questions", "docstring_tokens": ["Parse", "a", "StackExchange", "API", "raw", "response", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253136}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/queues/queue_servers.py#L657-L681", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Change the number of servers in the queue to ``n``.", "language": "python", "parameters": "(self, n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "numbers", ".", "Integral", ")", "and", "arg_1", "is", "not", "infty", ":", "arg_2", "=", "\"n must be an integer or infinity.\\n{0}\"", "raise", "TypeError", "(", "arg_2", ".", "format", "(", "str", "(", "arg_0", ")", ")", ")", "elif", "arg_1", "<=", "0", ":", "arg_2", "=", "\"n must be a positive integer or infinity.\\n{0}\"", "raise", "ValueError", "(", "arg_2", ".", "format", "(", "str", "(", "arg_0", ")", ")", ")", "else", ":", "arg_0", ".", "num_servers", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Change the number of servers in the queue to ``n``.\n\n        Parameters\n        ----------\n        n : int or :const:`numpy.infty`\n            A positive integer (or ``numpy.infty``) to set the number\n            of queues in the system to.\n\n        Raises\n        ------\n        TypeError\n            If ``n`` is not an integer or positive infinity then this\n            error is raised.\n        ValueError\n            If ``n`` is not positive.\n        \"\"\"\n        if not isinstance(arg_1, numbers.Integral) and arg_1 is not infty:\n            arg_2 = \"n must be an integer or infinity.\\n{0}\"\n            raise TypeError(arg_2.format(str(arg_0)))\n        elif arg_1 <= 0:\n            arg_2 = \"n must be a positive integer or infinity.\\n{0}\"\n            raise ValueError(arg_2.format(str(arg_0)))\n        else:\n            arg_0.num_servers = arg_1", "path": "queueing_tool/queues/queue_servers.py", "identifier": "QueueServer.set_num_servers", "docstring": "Change the number of servers in the queue to ``n``.\n\n        Parameters\n        ----------\n        n : int or :const:`numpy.infty`\n            A positive integer (or ``numpy.infty``) to set the number\n            of queues in the system to.\n\n        Raises\n        ------\n        TypeError\n            If ``n`` is not an integer or positive infinity then this\n            error is raised.\n        ValueError\n            If ``n`` is not positive.", "docstring_tokens": ["Change", "the", "number", "of", "servers", "in", "the", "queue", "to", "n", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 253137}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L843-L882", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Get the command to start the checkpoint manager process", "language": "python", "parameters": "(self)", "return_statement": "return retval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'org.apache.heron.ckptmgr.CheckpointManager'", "arg_2", "=", "arg_0", ".", "checkpoint_manager_ram", "/", "(", "1024", "*", "1024", ")", "arg_3", "=", "[", "os", ".", "path", ".", "join", "(", "arg_0", ".", "heron_java_home", ",", "\"bin/java\"", ")", ",", "'-Xms%dM'", "%", "arg_2", ",", "'-Xmx%dM'", "%", "arg_2", ",", "'-XX:+PrintCommandLineFlags'", ",", "'-verbosegc'", ",", "'-XX:+PrintGCDetails'", ",", "'-XX:+PrintGCTimeStamps'", ",", "'-XX:+PrintGCDateStamps'", ",", "'-XX:+PrintGCCause'", ",", "'-XX:+UseGCLogFileRotation'", ",", "'-XX:NumberOfGCLogFiles=5'", ",", "'-XX:GCLogFileSize=100M'", ",", "'-XX:+PrintPromotionFailure'", ",", "'-XX:+PrintTenuringDistribution'", ",", "'-XX:+PrintHeapAtGC'", ",", "'-XX:+HeapDumpOnOutOfMemoryError'", ",", "'-XX:+UseConcMarkSweepGC'", ",", "'-XX:+UseConcMarkSweepGC'", ",", "'-Xloggc:log-files/gc.ckptmgr.log'", ",", "'-Djava.net.preferIPv4Stack=true'", ",", "'-cp'", ",", "arg_0", ".", "checkpoint_manager_classpath", ",", "arg_1", ",", "'-t'", "+", "arg_0", ".", "topology_name", ",", "'-i'", "+", "arg_0", ".", "topology_id", ",", "'-c'", "+", "arg_0", ".", "ckptmgr_ids", "[", "arg_0", ".", "shard", "]", ",", "'-p'", "+", "arg_0", ".", "checkpoint_manager_port", ",", "'-f'", "+", "arg_0", ".", "stateful_config_file", ",", "'-o'", "+", "arg_0", ".", "override_config_file", ",", "'-g'", "+", "arg_0", ".", "heron_internals_config_file", "]", "arg_4", "=", "{", "}", "arg_4", "[", "arg_0", ".", "ckptmgr_ids", "[", "arg_0", ".", "shard", "]", "]", "=", "Command", "(", "arg_3", ",", "arg_0", ".", "shell_env", ")", "return", "arg_4"], "function": "def Func(arg_0):\n    ''' Get the command to start the checkpoint manager process'''\n\n    arg_1 = 'org.apache.heron.ckptmgr.CheckpointManager'\n\n    arg_2 = arg_0.checkpoint_manager_ram / (1024 * 1024)\n    arg_3 = [os.path.join(arg_0.heron_java_home, \"bin/java\"),\n                   '-Xms%dM' % arg_2,\n                   '-Xmx%dM' % arg_2,\n                   '-XX:+PrintCommandLineFlags',\n                   '-verbosegc',\n                   '-XX:+PrintGCDetails',\n                   '-XX:+PrintGCTimeStamps',\n                   '-XX:+PrintGCDateStamps',\n                   '-XX:+PrintGCCause',\n                   '-XX:+UseGCLogFileRotation',\n                   '-XX:NumberOfGCLogFiles=5',\n                   '-XX:GCLogFileSize=100M',\n                   '-XX:+PrintPromotionFailure',\n                   '-XX:+PrintTenuringDistribution',\n                   '-XX:+PrintHeapAtGC',\n                   '-XX:+HeapDumpOnOutOfMemoryError',\n                   '-XX:+UseConcMarkSweepGC',\n                   '-XX:+UseConcMarkSweepGC',\n                   '-Xloggc:log-files/gc.ckptmgr.log',\n                   '-Djava.net.preferIPv4Stack=true',\n                   '-cp',\n                   arg_0.checkpoint_manager_classpath,\n                   arg_1,\n                   '-t' + arg_0.topology_name,\n                   '-i' + arg_0.topology_id,\n                   '-c' + arg_0.ckptmgr_ids[arg_0.shard],\n                   '-p' + arg_0.checkpoint_manager_port,\n                   '-f' + arg_0.stateful_config_file,\n                   '-o' + arg_0.override_config_file,\n                   '-g' + arg_0.heron_internals_config_file]\n    arg_4 = {}\n    arg_4[arg_0.ckptmgr_ids[arg_0.shard]] = Command(arg_3, arg_0.shell_env)\n\n    return arg_4", "path": "heron/executor/src/python/heron_executor.py", "identifier": "HeronExecutor._get_ckptmgr_process", "docstring": "Get the command to start the checkpoint manager process", "docstring_tokens": ["Get", "the", "command", "to", "start", "the", "checkpoint", "manager", "process"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253138}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L320-L335", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Retrieve Zotero items via the API\n        Combine endpoint and request to access the specific resource\n        Returns a JSON document", "language": "python", "parameters": "(self, request=None)", "return_statement": "return self.request", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "\"%s%s\"", "%", "(", "arg_0", ".", "endpoint", ",", "arg_1", ")", "arg_0", ".", "self_link", "=", "arg_1", "arg_0", ".", "request", "=", "requests", ".", "get", "(", "url", "=", "arg_2", ",", "headers", "=", "arg_0", ".", "default_headers", "(", ")", ")", "arg_0", ".", "request", ".", "encoding", "=", "\"utf-8\"", "try", ":", "arg_0", ".", "request", ".", "raise_for_status", "(", ")", "except", "requests", ".", "exceptions", ".", "HTTPError", ":", "error_handler", "(", "arg_0", ".", "request", ")", "return", "arg_0", ".", "request"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Retrieve Zotero items via the API\n        Combine endpoint and request to access the specific resource\n        Returns a JSON document\n        \"\"\"\n        arg_2 = \"%s%s\" % (arg_0.endpoint, arg_1)\n        # The API doesn't return this any more, so we have to cheat\n        arg_0.self_link = arg_1\n        arg_0.request = requests.get(url=arg_2, headers=arg_0.default_headers())\n        arg_0.request.encoding = \"utf-8\"\n        try:\n            arg_0.request.raise_for_status()\n        except requests.exceptions.HTTPError:\n            error_handler(arg_0.request)\n        return arg_0.request", "path": "pyzotero/zotero.py", "identifier": "Zotero._retrieve_data", "docstring": "Retrieve Zotero items via the API\n        Combine endpoint and request to access the specific resource\n        Returns a JSON document", "docstring_tokens": ["Retrieve", "Zotero", "items", "via", "the", "API", "Combine", "endpoint", "and", "request", "to", "access", "the", "specific", "resource", "Returns", "a", "JSON", "document"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 253139}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L260-L266", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return a valid docker_path for a GCS bucket.", "language": "python", "parameters": "(self, raw_uri)", "return_statement": "return docker_uri", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "directory_fmt", "(", "arg_1", ")", "arg_2", ",", "arg_3", "=", "_gcs_uri_rewriter", "(", "arg_1", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_relative_path", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a valid docker_path for a GCS bucket.\"\"\"\n    # Assume URI is a directory path.\n    arg_1 = directory_fmt(arg_1)\n    arg_2, arg_3 = _gcs_uri_rewriter(arg_1)\n    arg_4 = os.path.join(arg_0._relative_path, arg_3)\n    return arg_4", "path": "dsub/lib/param_util.py", "identifier": "MountParamUtil._parse_gcs_uri", "docstring": "Return a valid docker_path for a GCS bucket.", "docstring_tokens": ["Return", "a", "valid", "docker_path", "for", "a", "GCS", "bucket", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 253140}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L730-L739", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "given a path or list of files, return ABF IDs.", "language": "python", "parameters": "(files)", "return_statement": "return sorted(IDs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "type", "(", "arg_0", ")", "is", "str", ":", "arg_0", "=", "glob", ".", "glob", "(", "arg_0", "+", "\"/*.*\"", ")", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", "[", "-", "4", ":", "]", ".", "lower", "(", ")", "==", "'.abf'", ":", "arg_3", "=", "arg_2", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "arg_1", ".", "append", "(", "os", ".", "path", ".", "basename", "(", "arg_2", ")", ".", "replace", "(", "'.'", "+", "arg_3", ",", "''", ")", ")", "return", "sorted", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"given a path or list of files, return ABF IDs.\"\"\"\n    if type(arg_0) is str:\n        arg_0=glob.glob(arg_0+\"/*.*\")\n    arg_1=[]\n    for arg_2 in arg_0:\n        if arg_2[-4:].lower()=='.abf':\n            arg_3=arg_2.split('.')[-1]\n            arg_1.append(os.path.basename(arg_2).replace('.'+arg_3,''))\n    return sorted(arg_1)", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "getIDsFromFiles", "docstring": "given a path or list of files, return ABF IDs.", "docstring_tokens": ["given", "a", "path", "or", "list", "of", "files", "return", "ABF", "IDs", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 253141}
{"url": "https://github.com/fm4d/PyMarkovTextGenerator/blob/4a7e8e2cfe14c9745aba6b9df7d7b402a9029a37/markov.py#L143-L155", "sha": "4a7e8e2cfe14c9745aba6b9df7d7b402a9029a37", "docstring_summary": "Add chain to current shelve file", "language": "python", "parameters": "(self, name, order)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "chains", ":", "setattr", "(", "arg_0", ".", "chains", ",", "arg_1", ",", "MarkovChain", "(", "arg_2", "=", "arg_2", ")", ")", "else", ":", "raise", "ValueError", "(", "\"Chain with this name already exists\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Add chain to current shelve file\n\n        Args:\n            name: chain name\n            order: markov chain order\n        \"\"\"\n\n        if arg_1 not in arg_0.chains:\n            setattr(arg_0.chains, arg_1, MarkovChain(arg_2=arg_2))\n        else:\n            raise ValueError(\"Chain with this name already exists\")", "path": "markov.py", "identifier": "MarkovGenerator.add_chain", "docstring": "Add chain to current shelve file\n\n        Args:\n            name: chain name\n            order: markov chain order", "docstring_tokens": ["Add", "chain", "to", "current", "shelve", "file"], "nwo": "fm4d/PyMarkovTextGenerator", "score": 0.2424429654267875, "idx": 253142}
{"url": "https://github.com/nprapps/copydoc/blob/e1ab09b287beb0439748c319cf165cbc06c66624/copydoc.py#L127-L133", "sha": "e1ab09b287beb0439748c319cf165cbc06c66624", "docstring_summary": "See if span tag has underline style and wrap with u tag.", "language": "python", "parameters": "(self, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'style'", ")", "if", "arg_2", "and", "'text-decoration:underline'", "in", "arg_2", ":", "arg_1", ".", "wrap", "(", "arg_0", ".", "soup", ".", "new_tag", "(", "'u'", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        See if span tag has underline style and wrap with u tag.\n        \"\"\"\n        arg_2 = arg_1.get('style')\n        if arg_2 and 'text-decoration:underline' in arg_2:\n            arg_1.wrap(arg_0.soup.new_tag('u'))", "path": "copydoc.py", "identifier": "CopyDoc.create_underline", "docstring": "See if span tag has underline style and wrap with u tag.", "docstring_tokens": ["See", "if", "span", "tag", "has", "underline", "style", "and", "wrap", "with", "u", "tag", "."], "nwo": "nprapps/copydoc", "score": 0.16246995141409282, "idx": 253143}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py#L218-L246", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Update a firewall rule for an Azure SQL Database server.", "language": "python", "parameters": "(self, server_name, name, start_ip_address,\n                             end_ip_address)", "return_statement": "return self._perform_put(\n            self._get_firewall_rules_path(server_name, name),\n            _SqlManagementXmlSerializer.update_firewall_rule_to_xml(\n                name, start_ip_address, end_ip_address\n            )\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "_validate_not_none", "(", "'server_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'name'", ",", "arg_2", ")", "_validate_not_none", "(", "'start_ip_address'", ",", "arg_3", ")", "_validate_not_none", "(", "'end_ip_address'", ",", "arg_4", ")", "return", "arg_0", ".", "_perform_put", "(", "arg_0", ".", "_get_firewall_rules_path", "(", "arg_1", ",", "arg_2", ")", ",", "_SqlManagementXmlSerializer", ".", "Func_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                             arg_4):\n        '''\n        Update a firewall rule for an Azure SQL Database server.\n\n        server_name:\n            Name of the server to set the firewall rule on. \n        name:\n            The name of the firewall rule to update.\n        start_ip_address:\n            The lowest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or greater than this can attempt to\n            connect to the server. The lowest possible IP address is 0.0.0.0.\n        end_ip_address:\n            The highest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or less than this can attempt to\n            connect to the server. The highest possible IP address is\n            255.255.255.255.\n        '''\n        _validate_not_none('server_name', arg_1)\n        _validate_not_none('name', arg_2)\n        _validate_not_none('start_ip_address', arg_3)\n        _validate_not_none('end_ip_address', arg_4)\n        return arg_0._perform_put(\n            arg_0._get_firewall_rules_path(arg_1, arg_2),\n            _SqlManagementXmlSerializer.Func_to_xml(\n                arg_2, arg_3, arg_4\n            )\n        )", "path": "azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py", "identifier": "SqlDatabaseManagementService.update_firewall_rule", "docstring": "Update a firewall rule for an Azure SQL Database server.\n\n        server_name:\n            Name of the server to set the firewall rule on. \n        name:\n            The name of the firewall rule to update.\n        start_ip_address:\n            The lowest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or greater than this can attempt to\n            connect to the server. The lowest possible IP address is 0.0.0.0.\n        end_ip_address:\n            The highest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or less than this can attempt to\n            connect to the server. The highest possible IP address is\n            255.255.255.255.", "docstring_tokens": ["Update", "a", "firewall", "rule", "for", "an", "Azure", "SQL", "Database", "server", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 253144}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/address_book.py#L378-L389", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Get one of the backing abdress books by its name,", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "_abooks", ":", "if", "arg_2", ".", "name", "==", "arg_1", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get one of the backing abdress books by its name,\n\n        :param name: the name of the address book to get\n        :type name: str\n        :returns: the matching address book or None\n        :rtype: AddressBook or NoneType\n\n        \"\"\"\n        for arg_2 in arg_0._abooks:\n            if arg_2.name == arg_1:\n                return arg_2", "path": "khard/address_book.py", "identifier": "AddressBookCollection.get_abook", "docstring": "Get one of the backing abdress books by its name,\n\n        :param name: the name of the address book to get\n        :type name: str\n        :returns: the matching address book or None\n        :rtype: AddressBook or NoneType", "docstring_tokens": ["Get", "one", "of", "the", "backing", "abdress", "books", "by", "its", "name"], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 253145}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L186-L316", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Generates a URL to the given endpoint with the method provided.", "language": "python", "parameters": "(endpoint, **values)", "return_statement": "return rv", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "_app_ctx_stack", ".", "top", "arg_3", "=", "_request_ctx_stack", ".", "top", "if", "arg_2", "is", "None", ":", "raise", "RuntimeError", "(", "'Attempted to generate a URL without the '", "'application context being pushed. This has to be '", "'executed when application context is available.'", ")", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "arg_3", ".", "url_adapter", "arg_5", "=", "request", ".", "blueprint", "if", "not", "arg_3", ".", "request", ".", "_is_old_module", ":", "if", "arg_0", "[", ":", "1", "]", "==", "'.'", ":", "if", "arg_5", "is", "not", "None", ":", "arg_0", "=", "arg_5", "+", "arg_0", "else", ":", "arg_0", "=", "arg_0", "[", "1", ":", "]", "else", ":", "if", "'.'", "not", "in", "arg_0", ":", "if", "arg_5", "is", "not", "None", ":", "arg_0", "=", "arg_5", "+", "'.'", "+", "arg_0", "elif", "arg_0", ".", "startswith", "(", "'.'", ")", ":", "arg_0", "=", "arg_0", "[", "1", ":", "]", "arg_6", "=", "arg_1", ".", "pop", "(", "'_external'", ",", "False", ")", "else", ":", "arg_4", "=", "arg_2", ".", "url_adapter", "if", "arg_4", "is", "None", ":", "raise", "RuntimeError", "(", "'Application was not able to create a URL '", "'adapter for request independent URL generation. '", "'You might be able to fix this by setting '", "'the SERVER_NAME config variable.'", ")", "arg_6", "=", "arg_1", ".", "pop", "(", "'_external'", ",", "True", ")", "arg_7", "=", "arg_1", ".", "pop", "(", "'_anchor'", ",", "None", ")", "arg_8", "=", "arg_1", ".", "pop", "(", "'_method'", ",", "None", ")", "arg_9", "=", "arg_1", ".", "pop", "(", "'_scheme'", ",", "None", ")", "arg_2", ".", "app", ".", "inject_url_defaults", "(", "arg_0", ",", "arg_1", ")", "if", "arg_9", "is", "not", "None", ":", "if", "not", "arg_6", ":", "raise", "ValueError", "(", "'When specifying _scheme, _external must be True'", ")", "arg_4", ".", "url_scheme", "=", "arg_9", "try", ":", "arg_11", "=", "arg_4", ".", "build", "(", "arg_0", ",", "arg_1", ",", "arg_8", "=", "arg_8", ",", "force_external", "=", "arg_6", ")", "except", "BuildError", "as", "error", ":", "arg_1", "[", "'_external'", "]", "=", "arg_6", "arg_1", "[", "'_anchor'", "]", "=", "arg_7", "arg_1", "[", "'_method'", "]", "=", "arg_8", "return", "arg_2", ".", "app", ".", "handle_url_build_error", "(", "error", ",", "arg_0", ",", "arg_1", ")", "if", "arg_7", "is", "not", "None", ":", "arg_11", "+=", "'#'", "+", "url_quote", "(", "arg_7", ")", "return", "arg_11"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Generates a URL to the given endpoint with the method provided.\n\n    Variable arguments that are unknown to the target endpoint are appended\n    to the generated URL as query arguments.  If the value of a query argument\n    is `None`, the whole pair is skipped.  In case blueprints are active\n    you can shortcut references to the same blueprint by prefixing the\n    local endpoint with a dot (``.``).\n\n    This will reference the index function local to the current blueprint::\n\n        Func('.index')\n\n    For more information, head over to the :ref:`Quickstart <url-building>`.\n\n    To integrate applications, :class:`Flask` has a hook to intercept URL build\n    errors through :attr:`Flask.build_error_handler`.  The `Func` function\n    results in a :exc:`~werkzeug.routing.BuildError` when the current app does\n    not have a URL for the given endpoint and values.  When it does, the\n    :data:`~flask.current_app` calls its :attr:`~Flask.build_error_handler` if\n    it is not `None`, which can return a string to use as the result of\n    `Func` (instead of `Func`'s default to raise the\n    :exc:`~werkzeug.routing.BuildError` exception) or re-raise the exception.\n    An example::\n\n        def external_url_handler(error, endpoint, **values):\n            \"Looks up an external URL when `Func` cannot build a URL.\"\n            # This is an example of hooking the build_error_handler.\n            # Here, lookup_url is some utility function you've built\n            # which looks up the endpoint in some external URL registry.\n            url = lookup_url(endpoint, **values)\n            if url is None:\n                # External lookup did not have a URL.\n                # Re-raise the BuildError, in context of original traceback.\n                exc_type, exc_value, tb = sys.exc_info()\n                if exc_value is error:\n                    raise exc_type, exc_value, tb\n                else:\n                    raise error\n            # Func will use this result, instead of raising BuildError.\n            return url\n\n        app.build_error_handler = external_url_handler\n\n    Here, `error` is the instance of :exc:`~werkzeug.routing.BuildError`, and\n    `endpoint` and `**values` are the arguments passed into `Func`.  Note\n    that this is for building URLs outside the current application, and not for\n    handling 404 NotFound errors.\n\n    .. versionadded:: 0.10\n       The `_scheme` parameter was added.\n\n    .. versionadded:: 0.9\n       The `_anchor` and `_method` parameters were added.\n\n    .. versionadded:: 0.9\n       Calls :meth:`Flask.handle_build_error` on\n       :exc:`~werkzeug.routing.BuildError`.\n\n    :param endpoint: the endpoint of the URL (name of the function)\n    :param values: the variable arguments of the URL rule\n    :param _external: if set to `True`, an absolute URL is generated. Server\n      address can be changed via `SERVER_NAME` configuration variable which\n      defaults to `localhost`.\n    :param _scheme: a string specifying the desired URL scheme. The `_external`\n      parameter must be set to `True` or a `ValueError` is raised.\n    :param _anchor: if provided this is added as anchor to the URL.\n    :param _method: if provided this explicitly specifies an HTTP method.\n    \"\"\"\n    arg_2 = _app_ctx_stack.top\n    arg_3 = _request_ctx_stack.top\n    if arg_2 is None:\n        raise RuntimeError('Attempted to generate a URL without the '\n                           'application context being pushed. This has to be '\n                           'executed when application context is available.')\n\n    # If request specific information is available we have some extra\n    # features that support \"relative\" urls.\n    if arg_3 is not None:\n        arg_4 = arg_3.url_adapter\n        arg_5 = request.blueprint\n        if not arg_3.request._is_old_module:\n            if arg_0[:1] == '.':\n                if arg_5 is not None:\n                    arg_0 = arg_5 + arg_0\n                else:\n                    arg_0 = arg_0[1:]\n        else:\n            # TODO: get rid of this deprecated functionality in 1.0\n            if '.' not in arg_0:\n                if arg_5 is not None:\n                    arg_0 = arg_5 + '.' + arg_0\n            elif arg_0.startswith('.'):\n                arg_0 = arg_0[1:]\n        arg_6 = arg_1.pop('_external', False)\n\n    # Otherwise go with the url adapter from the appctx and make\n    # the urls external by default.\n    else:\n        arg_4 = arg_2.url_adapter\n        if arg_4 is None:\n            raise RuntimeError('Application was not able to create a URL '\n                               'adapter for request independent URL generation. '\n                               'You might be able to fix this by setting '\n                               'the SERVER_NAME config variable.')\n        arg_6 = arg_1.pop('_external', True)\n\n    arg_7 = arg_1.pop('_anchor', None)\n    arg_8 = arg_1.pop('_method', None)\n    arg_9 = arg_1.pop('_scheme', None)\n    arg_2.app.inject_url_defaults(arg_0, arg_1)\n\n    if arg_9 is not None:\n        if not arg_6:\n            raise ValueError('When specifying _scheme, _external must be True')\n        arg_4.url_scheme = arg_9\n\n    try:\n        arg_11 = arg_4.build(arg_0, arg_1, arg_8=arg_8,\n                               force_external=arg_6)\n    except BuildError as error:\n        # We need to inject the values again so that the app callback can\n        # deal with that sort of stuff.\n        arg_1['_external'] = arg_6\n        arg_1['_anchor'] = arg_7\n        arg_1['_method'] = arg_8\n        return arg_2.app.handle_url_build_error(error, arg_0, arg_1)\n\n    if arg_7 is not None:\n        arg_11 += '#' + url_quote(arg_7)\n    return arg_11", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py", "identifier": "url_for", "docstring": "Generates a URL to the given endpoint with the method provided.\n\n    Variable arguments that are unknown to the target endpoint are appended\n    to the generated URL as query arguments.  If the value of a query argument\n    is `None`, the whole pair is skipped.  In case blueprints are active\n    you can shortcut references to the same blueprint by prefixing the\n    local endpoint with a dot (``.``).\n\n    This will reference the index function local to the current blueprint::\n\n        url_for('.index')\n\n    For more information, head over to the :ref:`Quickstart <url-building>`.\n\n    To integrate applications, :class:`Flask` has a hook to intercept URL build\n    errors through :attr:`Flask.build_error_handler`.  The `url_for` function\n    results in a :exc:`~werkzeug.routing.BuildError` when the current app does\n    not have a URL for the given endpoint and values.  When it does, the\n    :data:`~flask.current_app` calls its :attr:`~Flask.build_error_handler` if\n    it is not `None`, which can return a string to use as the result of\n    `url_for` (instead of `url_for`'s default to raise the\n    :exc:`~werkzeug.routing.BuildError` exception) or re-raise the exception.\n    An example::\n\n        def external_url_handler(error, endpoint, **values):\n            \"Looks up an external URL when `url_for` cannot build a URL.\"\n            # This is an example of hooking the build_error_handler.\n            # Here, lookup_url is some utility function you've built\n            # which looks up the endpoint in some external URL registry.\n            url = lookup_url(endpoint, **values)\n            if url is None:\n                # External lookup did not have a URL.\n                # Re-raise the BuildError, in context of original traceback.\n                exc_type, exc_value, tb = sys.exc_info()\n                if exc_value is error:\n                    raise exc_type, exc_value, tb\n                else:\n                    raise error\n            # url_for will use this result, instead of raising BuildError.\n            return url\n\n        app.build_error_handler = external_url_handler\n\n    Here, `error` is the instance of :exc:`~werkzeug.routing.BuildError`, and\n    `endpoint` and `**values` are the arguments passed into `url_for`.  Note\n    that this is for building URLs outside the current application, and not for\n    handling 404 NotFound errors.\n\n    .. versionadded:: 0.10\n       The `_scheme` parameter was added.\n\n    .. versionadded:: 0.9\n       The `_anchor` and `_method` parameters were added.\n\n    .. versionadded:: 0.9\n       Calls :meth:`Flask.handle_build_error` on\n       :exc:`~werkzeug.routing.BuildError`.\n\n    :param endpoint: the endpoint of the URL (name of the function)\n    :param values: the variable arguments of the URL rule\n    :param _external: if set to `True`, an absolute URL is generated. Server\n      address can be changed via `SERVER_NAME` configuration variable which\n      defaults to `localhost`.\n    :param _scheme: a string specifying the desired URL scheme. The `_external`\n      parameter must be set to `True` or a `ValueError` is raised.\n    :param _anchor: if provided this is added as anchor to the URL.\n    :param _method: if provided this explicitly specifies an HTTP method.", "docstring_tokens": ["Generates", "a", "URL", "to", "the", "given", "endpoint", "with", "the", "method", "provided", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253146}
{"url": "https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/config_parser.py#L44-L62", "sha": "8d99be3e1abdf941642e9a1c86b7d775dc373c0b", "docstring_summary": "Writing the configure file with the attributes in 'args", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logging", ".", "info", "(", "\"Writing configure file: %s\"", "%", "arg_0", ".", "config_file", ")", "if", "arg_0", ".", "config_file", "is", "None", ":", "return", "arg_1", "=", "cparser", ".", "ConfigParser", "(", ")", "arg_1", ".", "add_section", "(", "\"lrcloud\"", ")", "for", "arg_2", "in", "[", "x", "for", "x", "in", "dir", "(", "arg_0", ")", "if", "not", "x", ".", "startswith", "(", "\"_\"", ")", "]", ":", "if", "arg_2", "in", "IGNORE_ARGS", ":", "continue", "arg_3", "=", "getattr", "(", "arg_0", ",", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_1", ".", "set", "(", "'lrcloud'", ",", "arg_2", ",", "str", "(", "arg_3", ")", ")", "with", "open", "(", "arg_0", ".", "config_file", ",", "'w'", ")", "as", "f", ":", "arg_1", ".", "Func", "(", "f", ")"], "function": "def Func(arg_0):\n    \"\"\"Writing the configure file with the attributes in 'args'\"\"\"\n\n    logging.info(\"Writing configure file: %s\"%arg_0.config_file)\n    if arg_0.config_file is None:\n        return\n\n    #Let's add each attribute of 'args' to the configure file\n    arg_1 = cparser.ConfigParser()\n    arg_1.add_section(\"lrcloud\")\n    for arg_2 in [x for x in dir(arg_0) if not x.startswith(\"_\")]:\n        if arg_2 in IGNORE_ARGS:\n            continue#We ignore some attributes\n        arg_3 = getattr(arg_0, arg_2)\n        if arg_3 is not None:\n            arg_1.set('lrcloud', arg_2, str(arg_3))\n\n    with open(arg_0.config_file, 'w') as f:\n        arg_1.Func(f)", "path": "lrcloud/config_parser.py", "identifier": "write", "docstring": "Writing the configure file with the attributes in 'args", "docstring_tokens": ["Writing", "the", "configure", "file", "with", "the", "attributes", "in", "args"], "nwo": "madsbk/lrcloud", "score": 0.09252797783733271, "idx": 253147}
{"url": "https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L307-L317", "sha": "8170e431362dc760589f7d141090fd133dece259", "docstring_summary": "Checks element definitions.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", "arg_0", ".", "elements", ".", "type", ".", "argiope", ".", "values", ".", "flatten", "(", ")", ")", "arg_2", "=", "set", "(", "ELEMENTS", ".", "keys", "(", ")", ")", "if", "(", "arg_1", "<=", "arg_2", ")", "==", "False", ":", "raise", "ValueError", "(", "\"Element types {0} not in know elements {1}\"", ".", "format", "(", "arg_1", "-", "arg_2", ",", "arg_2", ")", ")", "print", "(", "\"<Elements: OK>\"", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Checks element definitions.\n    \"\"\"\n    # ELEMENT TYPE CHECKING\n    arg_1 = set(arg_0.elements.type.argiope.values.flatten())\n    arg_2 = set(ELEMENTS.keys())\n    if (arg_1 <= arg_2) == False:\n      raise ValueError(\"Element types {0} not in know elements {1}\".format(\n                       arg_1 - arg_2, arg_2))\n    print(\"<Elements: OK>\")", "path": "argiope/mesh.py", "identifier": "Mesh.check_elements", "docstring": "Checks element definitions.", "docstring_tokens": ["Checks", "element", "definitions", "."], "nwo": "lcharleux/argiope", "score": 0.17185066990864498, "idx": 253148}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L184-L234", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Stackted recurrent neural networks GRU or LSTM", "language": "python", "parameters": "(units: tf.Tensor,\n                   n_hidden_list: List,\n                   cell_type='gru',\n                   seq_lengths=None,\n                   use_peepholes=False,\n                   name='RNN_layer')", "return_statement": "return units, last_units", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "Tensor", ",", "arg_3", ":", "arg_4", ",", "arg_5", "=", "'gru'", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "'RNN_layer'", ")", ":", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_3", ")", ":", "with", "arg_1", ".", "variable_scope", "(", "arg_8", "+", "'_'", "+", "str", "(", "arg_9", ")", ")", ":", "if", "arg_5", "==", "'gru'", ":", "arg_11", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "GRUCell", "(", "arg_10", ")", "arg_12", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "GRUCell", "(", "arg_10", ")", "elif", "arg_5", "==", "'lstm'", ":", "arg_11", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "LSTMCell", "(", "arg_10", ",", "arg_7", "=", "arg_7", ")", "arg_12", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "LSTMCell", "(", "arg_10", ",", "arg_7", "=", "arg_7", ")", "else", ":", "raise", "RuntimeError", "(", "'cell_type must be either gru or lstm'", ")", "(", "arg_13", ",", "arg_14", ")", ",", "(", "arg_15", ",", "arg_16", ")", "=", "arg_1", ".", "nn", ".", "bidirectional_dynamic_rnn", "(", "arg_11", ",", "arg_12", ",", "arg_0", ",", "dtype", "=", "arg_1", ".", "float32", ",", "sequence_length", "=", "arg_6", ")", "arg_0", "=", "arg_1", ".", "concat", "(", "[", "arg_13", ",", "arg_14", "]", ",", "axis", "=", "2", ")", "if", "arg_5", "==", "'gru'", ":", "arg_17", "=", "arg_1", ".", "concat", "(", "[", "arg_15", ",", "arg_16", "]", ",", "axis", "=", "1", ")", "else", ":", "(", "arg_18", ",", "arg_19", ")", ",", "(", "arg_20", ",", "arg_21", ")", "=", "arg_15", ",", "arg_16", "arg_22", "=", "arg_1", ".", "concat", "(", "[", "arg_18", ",", "arg_20", "]", ",", "axis", "=", "1", ")", "arg_23", "=", "arg_1", ".", "concat", "(", "[", "arg_19", ",", "arg_21", "]", ",", "axis", "=", "1", ")", "arg_17", "=", "(", "arg_23", ",", "arg_22", ")", "return", "arg_0", ",", "arg_17"], "function": "def Func(arg_0: arg_1.Tensor,\n                   arg_3: arg_4,\n                   arg_5='gru',\n                   arg_6=None,\n                   arg_7=False,\n                   arg_8='RNN_layer'):\n    \"\"\" Stackted recurrent neural networks GRU or LSTM\n\n        Args:\n            units: a tensorflow tensor with dimensionality [None, n_tokens, n_features]\n            n_hidden_list: list with number of hidden units at the ouput of each layer\n            seq_lengths: length of sequences for different length sequences in batch\n                can be None for maximum length as a length for every sample in the batch\n            cell_type: 'lstm' or 'gru'\n            use_peepholes: whether to use peephole connections (only 'lstm' case affected)\n            name: what variable_scope to use for the network parameters\n        Returns:\n            units: tensor at the output of the last recurrent layer\n                with dimensionality [None, n_tokens, n_hidden_list[-1]]\n            last_units: tensor of last hidden states for GRU and tuple\n                of last hidden stated and last cell states for LSTM\n                dimensionality of cell states and hidden states are\n                similar and equal to [B x 2 * H], where B - batch\n                size and H is number of hidden units\n    \"\"\"\n    for arg_9, arg_10 in enumerate(arg_3):\n        with arg_1.variable_scope(arg_8 + '_' + str(arg_9)):\n            if arg_5 == 'gru':\n                arg_11 = arg_1.nn.rnn_cell.GRUCell(arg_10)\n                arg_12 = arg_1.nn.rnn_cell.GRUCell(arg_10)\n            elif arg_5 == 'lstm':\n                arg_11 = arg_1.nn.rnn_cell.LSTMCell(arg_10, arg_7=arg_7)\n                arg_12 = arg_1.nn.rnn_cell.LSTMCell(arg_10, arg_7=arg_7)\n            else:\n                raise RuntimeError('cell_type must be either gru or lstm')\n\n            (arg_13, arg_14), (arg_15, arg_16) = \\\n                arg_1.nn.bidirectional_dynamic_rnn(arg_11,\n                                                arg_12,\n                                                arg_0,\n                                                dtype=arg_1.float32,\n                                                sequence_length=arg_6)\n            arg_0 = arg_1.concat([arg_13, arg_14], axis=2)\n            if arg_5 == 'gru':\n                arg_17 = arg_1.concat([arg_15, arg_16], axis=1)\n            else:\n                (arg_18, arg_19), (arg_20, arg_21) = arg_15, arg_16\n                arg_22 = arg_1.concat([arg_18, arg_20], axis=1)\n                arg_23 = arg_1.concat([arg_19, arg_21], axis=1)\n                arg_17 = (arg_23, arg_22)\n    return arg_0, arg_17", "path": "deeppavlov/core/layers/tf_layers.py", "identifier": "stacked_bi_rnn", "docstring": "Stackted recurrent neural networks GRU or LSTM\n\n        Args:\n            units: a tensorflow tensor with dimensionality [None, n_tokens, n_features]\n            n_hidden_list: list with number of hidden units at the ouput of each layer\n            seq_lengths: length of sequences for different length sequences in batch\n                can be None for maximum length as a length for every sample in the batch\n            cell_type: 'lstm' or 'gru'\n            use_peepholes: whether to use peephole connections (only 'lstm' case affected)\n            name: what variable_scope to use for the network parameters\n        Returns:\n            units: tensor at the output of the last recurrent layer\n                with dimensionality [None, n_tokens, n_hidden_list[-1]]\n            last_units: tensor of last hidden states for GRU and tuple\n                of last hidden stated and last cell states for LSTM\n                dimensionality of cell states and hidden states are\n                similar and equal to [B x 2 * H], where B - batch\n                size and H is number of hidden units", "docstring_tokens": ["Stackted", "recurrent", "neural", "networks", "GRU", "or", "LSTM"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 253149}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/stream.py#L43-L83", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Starts `command` in a subprocess. Prints every line the command prints,\n    prefaced with `description`.", "language": "python", "parameters": "(command, formatter=None, write_stdin=None, ignore_empty=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "shlex", ".", "split", "(", "arg_0", ")", "try", ":", "arg_5", "=", "subprocess", ".", "Popen", "(", "arg_4", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "STDOUT", ",", "stdin", "=", "subprocess", ".", "PIPE", ")", "except", "Exception", "as", "e", ":", "raise", "IOError", "(", "'Encountered error: {0} when running command {1}'", ".", "format", "(", "e", ".", "message", ",", "' '", ".", "join", "(", "arg_4", ")", ")", ")", "if", "arg_2", "is", "not", "None", ":", "arg_5", ".", "stdin", ".", "write", "(", "arg_2", ")", "arg_5", ".", "stdin", ".", "flush", "(", ")", "while", "arg_5", ".", "poll", "(", ")", "is", "None", ":", "try", ":", "arg_6", "=", "arg_5", ".", "stdout", ".", "readline", "(", ")", "except", "KeyboardInterrupt", ":", "sys", ".", "exit", "(", "'Keyboard interrupt while running {}'", ".", "format", "(", "arg_0", ")", ")", "if", "len", "(", "arg_6", ".", "strip", "(", ")", ")", "==", "0", "and", "arg_3", "is", "True", ":", "continue", "elif", "'killed by signal 1'", "in", "decode", "(", "arg_6", ")", ".", "lower", "(", ")", ":", "continue", "elif", "'to the list of known hosts'", "in", "decode", "(", "arg_6", ")", ".", "lower", "(", ")", ":", "continue", "if", "arg_1", "is", "not", "None", ":", "arg_6", "=", "arg_1", "(", "arg_6", ")", "sys", ".", "stdout", ".", "write", "(", "arg_6", ")", "arg_7", "=", "arg_5", ".", "poll", "(", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=False):\n    \"\"\"\n    Starts `command` in a subprocess. Prints every line the command prints,\n    prefaced with `description`.\n\n    :param command: The bash command to run. Must use fully-qualified paths.\n    :type command: ``str``\n    :param formatter: An optional formatting function to apply to each line.\n    :type formatter: ``function`` or ``NoneType``\n    :param write_stdin: An optional string to write to the process' stdin.\n    :type write_stdin: ``str`` or ``NoneType``\n    :param ignore_empty: If true, empty or whitespace-only lines will be skipped.\n    :type ignore_empty: ``bool``\n    \"\"\"\n    arg_4 = shlex.split(arg_0)\n    try:\n        arg_5 = subprocess.Popen(arg_4, stdout=subprocess.PIPE,\n                                stderr=subprocess.STDOUT, stdin=subprocess.PIPE)\n    except Exception as e:\n        raise IOError('Encountered error: {0} when running command {1}'\n                      .format(e.message, ' '.join(arg_4)))\n    if arg_2 is not None:\n        arg_5.stdin.write(arg_2)\n        arg_5.stdin.flush()\n\n    while arg_5.poll() is None:\n        try:\n            arg_6 = arg_5.stdout.readline()\n        except KeyboardInterrupt:\n            sys.exit('Keyboard interrupt while running {}'.format(arg_0))\n        if len(arg_6.strip()) == 0 and arg_3 is True:\n            continue\n        elif 'killed by signal 1' in decode(arg_6).lower():\n            continue\n        elif 'to the list of known hosts' in decode(arg_6).lower():\n            continue\n        if arg_1 is not None:\n            arg_6 = arg_1(arg_6)\n        sys.stdout.write(arg_6)\n    arg_7 = arg_5.poll()\n    return arg_7", "path": "src/lsi/utils/stream.py", "identifier": "stream_command", "docstring": "Starts `command` in a subprocess. Prints every line the command prints,\n    prefaced with `description`.\n\n    :param command: The bash command to run. Must use fully-qualified paths.\n    :type command: ``str``\n    :param formatter: An optional formatting function to apply to each line.\n    :type formatter: ``function`` or ``NoneType``\n    :param write_stdin: An optional string to write to the process' stdin.\n    :type write_stdin: ``str`` or ``NoneType``\n    :param ignore_empty: If true, empty or whitespace-only lines will be skipped.\n    :type ignore_empty: ``bool``", "docstring_tokens": ["Starts", "command", "in", "a", "subprocess", ".", "Prints", "every", "line", "the", "command", "prints", "prefaced", "with", "description", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 253150}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L2313-L2349", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the data encoding the MACSignatureKeyInformation struct to a\n        stream.", "language": "python", "parameters": "(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "arg_6", "=", "BytearrayStream", "(", ")", "if", "arg_0", ".", "_unique_identifier", ":", "arg_0", ".", "_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Invalid struct missing the unique identifier attribute.\"", ")", "if", "arg_0", ".", "_cryptographic_parameters", ":", "arg_0", ".", "_cryptographic_parameters", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "MACSignatureKeyInformation", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the data encoding the MACSignatureKeyInformation struct to a\n        stream.\n\n        Args:\n            output_stream (stream): A data stream in which to encode object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        arg_6 = BytearrayStream()\n\n        if arg_0._unique_identifier:\n            arg_0._unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise ValueError(\n                \"Invalid struct missing the unique identifier attribute.\"\n            )\n\n        if arg_0._cryptographic_parameters:\n            arg_0._cryptographic_parameters.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        arg_0.length = arg_6.length()\n        super(MACSignatureKeyInformation, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/objects.py", "identifier": "MACSignatureKeyInformation.write", "docstring": "Write the data encoding the MACSignatureKeyInformation struct to a\n        stream.\n\n        Args:\n            output_stream (stream): A data stream in which to encode object\n                data, supporting a write method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Write", "the", "data", "encoding", "the", "MACSignatureKeyInformation", "struct", "to", "a", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 253151}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/copy_reg.py#L157-L173", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Register an extension code.", "language": "python", "parameters": "(module, name, code)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", "=", "int", "(", "arg_2", ")", "if", "not", "1", "<=", "arg_2", "<=", "0x7fffffff", ":", "raise", "ValueError", ",", "\"code out of range\"", "arg_3", "=", "(", "arg_0", ",", "arg_1", ")", "if", "(", "arg_4", ".", "get", "(", "arg_3", ")", "==", "arg_2", "and", "arg_5", ".", "get", "(", "arg_2", ")", "==", "arg_3", ")", ":", "return", "if", "arg_3", "in", "arg_4", ":", "raise", "ValueError", "(", "\"key %s is already registered with code %s\"", "%", "(", "arg_3", ",", "arg_4", "[", "arg_3", "]", ")", ")", "if", "arg_2", "in", "arg_5", ":", "raise", "ValueError", "(", "\"code %s is already in use for key %s\"", "%", "(", "arg_2", ",", "arg_5", "[", "arg_2", "]", ")", ")", "arg_4", "[", "arg_3", "]", "=", "arg_2", "arg_5", "[", "arg_2", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Register an extension code.\"\"\"\n    arg_2 = int(arg_2)\n    if not 1 <= arg_2 <= 0x7fffffff:\n        raise ValueError, \"code out of range\"\n    arg_3 = (arg_0, arg_1)\n    if (arg_4.get(arg_3) == arg_2 and\n        arg_5.get(arg_2) == arg_3):\n        return # Redundant registrations are benign\n    if arg_3 in arg_4:\n        raise ValueError(\"key %s is already registered with code %s\" %\n                         (arg_3, arg_4[arg_3]))\n    if arg_2 in arg_5:\n        raise ValueError(\"code %s is already in use for key %s\" %\n                         (arg_2, arg_5[arg_2]))\n    arg_4[arg_3] = arg_2\n    arg_5[arg_2] = arg_3", "path": "third_party/stdlib/copy_reg.py", "identifier": "add_extension", "docstring": "Register an extension code.", "docstring_tokens": ["Register", "an", "extension", "code", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 253152}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/audiosegment.py#L893-L920", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Returns a new AudioSegment whose data is the same as this one, but which has been resampled to the\n        specified characteristics. Any parameter left None will be unchanged.", "language": "python", "parameters": "(self, sample_rate_Hz=None, sample_width=None, channels=None, console_output=False)", "return_statement": "return self._execute_sox_cmd(command, console_output=console_output)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "frame_rate", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "sample_width", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "channels", "arg_5", "=", "\"sox {inputfile} -b \"", "+", "str", "(", "arg_2", "*", "8", ")", "+", "\" -r \"", "+", "str", "(", "arg_1", ")", "+", "\" -t wav {outputfile} channels \"", "+", "str", "(", "arg_3", ")", "return", "arg_0", ".", "_execute_sox_cmd", "(", "arg_5", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False):\n        \"\"\"\n        Returns a new AudioSegment whose data is the same as this one, but which has been Funcd to the\n        specified characteristics. Any parameter left None will be unchanged.\n\n        .. note:: This method requires that you have the program 'sox' installed.\n\n        .. warning:: This method uses the program 'sox' to perform the task. While this is very fast for a single\n                     function call, the IO may add up for large numbers of AudioSegment objects.\n\n        :param sample_rate_Hz: The new sample rate in Hz.\n        :param sample_width: The new sample width in bytes, so sample_width=2 would correspond to 16 bit (2 byte) width.\n        :param channels: The new number of channels.\n        :param console_output: Will print the output of sox to the console if True.\n        :returns: The newly sampled AudioSegment.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.frame_rate\n        if arg_2 is None:\n            arg_2 = arg_0.sample_width\n        if arg_3 is None:\n            arg_3 = arg_0.channels\n\n        # TODO: Replace this with librosa's implementation to remove SOX dependency here\n        arg_5 = \"sox {inputfile} -b \" + str(arg_2 * 8) + \" -r \" + str(arg_1) \\\n            + \" -t wav {outputfile} channels \" + str(arg_3)\n\n        return arg_0._execute_sox_cmd(arg_5, arg_4=arg_4)", "path": "audiosegment.py", "identifier": "AudioSegment.resample", "docstring": "Returns a new AudioSegment whose data is the same as this one, but which has been resampled to the\n        specified characteristics. Any parameter left None will be unchanged.\n\n        .. note:: This method requires that you have the program 'sox' installed.\n\n        .. warning:: This method uses the program 'sox' to perform the task. While this is very fast for a single\n                     function call, the IO may add up for large numbers of AudioSegment objects.\n\n        :param sample_rate_Hz: The new sample rate in Hz.\n        :param sample_width: The new sample width in bytes, so sample_width=2 would correspond to 16 bit (2 byte) width.\n        :param channels: The new number of channels.\n        :param console_output: Will print the output of sox to the console if True.\n        :returns: The newly sampled AudioSegment.", "docstring_tokens": ["Returns", "a", "new", "AudioSegment", "whose", "data", "is", "the", "same", "as", "this", "one", "but", "which", "has", "been", "resampled", "to", "the", "specified", "characteristics", ".", "Any", "parameter", "left", "None", "will", "be", "unchanged", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 253153}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/dynamicimports.py#L19-L34", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Loads a class from a string naming the module and class name.", "language": "python", "parameters": "(full_class_string)", "return_statement": "return getattr(module, class_str)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "split", "(", "\".\"", ")", "arg_2", "=", "\".\"", ".", "join", "(", "arg_1", "[", ":", "-", "1", "]", ")", "arg_3", "=", "arg_1", "[", "-", "1", "]", "arg_4", "=", "importlib", ".", "import_module", "(", "arg_2", ")", "return", "getattr", "(", "arg_4", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Loads a class from a string naming the module and class name.\n\n    For example:\n    >>> Func(full_class_string = 'pypet.brian.parameter.BrianParameter')\n    <BrianParameter>\n\n    \"\"\"\n\n    arg_1 = arg_0.split(\".\")\n    arg_2 = \".\".join(arg_1[:-1])\n    arg_3 = arg_1[-1]\n    arg_4 = importlib.import_module(arg_2)\n\n    # We retrieve the Class from the module\n    return getattr(arg_4, arg_3)", "path": "pypet/utils/dynamicimports.py", "identifier": "load_class", "docstring": "Loads a class from a string naming the module and class name.\n\n    For example:\n    >>> load_class(full_class_string = 'pypet.brian.parameter.BrianParameter')\n    <BrianParameter>", "docstring_tokens": ["Loads", "a", "class", "from", "a", "string", "naming", "the", "module", "and", "class", "name", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253154}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/nelder_mead.py#L581-L599", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Shrinks the simplex around the best vertex.", "language": "python", "parameters": "(objective_function,\n                         simplex,\n                         best_index,\n                         shrinkage,\n                         batch_evaluate_objective)", "return_statement": "return (False,\n          shrunk_simplex,\n          objective_at_shrunk_simplex,\n          evals)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_1", "[", "arg_2", "]", "arg_6", "=", "arg_5", "+", "arg_3", "*", "(", "arg_1", "-", "arg_5", ")", "arg_7", ",", "arg_8", "=", "_evaluate_objective_multiple", "(", "arg_0", ",", "arg_6", ",", "arg_4", ")", "return", "(", "False", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")"], "function": "def Func(arg_0,\n                         arg_1,\n                         arg_2,\n                         arg_3,\n                         arg_4):\n  \"\"\"Shrinks the simplex around the best vertex.\"\"\"\n\n  # If the contraction step fails to improve the average objective enough,\n  # the simplex is shrunk towards the best vertex.\n  arg_5 = arg_1[arg_2]\n  arg_6 = arg_5 + arg_3 * (arg_1 - arg_5)\n  arg_7, arg_8 = _evaluate_objective_multiple(\n      arg_0,\n      arg_6,\n      arg_4)\n  return (False,\n          arg_6,\n          arg_7,\n          arg_8)", "path": "tensorflow_probability/python/optimizer/nelder_mead.py", "identifier": "_shrink_towards_best", "docstring": "Shrinks the simplex around the best vertex.", "docstring_tokens": ["Shrinks", "the", "simplex", "around", "the", "best", "vertex", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253155}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/elb.py#L167-L184", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Fully describes an ELB.", "language": "python", "parameters": "(load_balancer, flags=FLAGS.ALL ^ FLAGS.POLICY_TYPES, **conn)", "return_statement": "return registry.build_out(flags, start_with=load_balancer, pass_datastructure=True, **conn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "ALL", "^", "arg_2", ".", "POLICY_TYPES", ",", "**", "arg_5", ")", ":", "try", ":", "arg_6", "except", "NameError", "as", "_", ":", "arg_6", "=", "str", "if", "isinstance", "(", "arg_0", ",", "arg_6", ")", ":", "arg_0", "=", "dict", "(", "LoadBalancerName", "=", "arg_0", ")", "return", "registry", ".", "build_out", "(", "arg_1", ",", "start_with", "=", "arg_0", ",", "pass_datastructure", "=", "True", ",", "**", "arg_5", ")"], "function": "def Func(arg_0, arg_1=arg_2.ALL ^ arg_2.POLICY_TYPES, **arg_5):\n    \"\"\"\n    Fully describes an ELB.\n\n    :param loadbalancer: Could be an ELB Name or a dictionary. Likely the return value from a previous call to describe_load_balancers. At a minimum, must contain a key titled 'LoadBalancerName'.\n    :param flags: Flags describing which sections should be included in the return value. Default is FLAGS.ALL minus FLAGS.POLICY_TYPES.\n    :return: Returns a dictionary describing the ELB with the fields described in the flags parameter.\n    \"\"\"\n    # Python 2 and 3 support:\n    try:\n        arg_6\n    except NameError as _:\n        arg_6 = str\n\n    if isinstance(arg_0, arg_6):\n        arg_0 = dict(LoadBalancerName=arg_0)\n\n    return registry.build_out(arg_1, start_with=arg_0, pass_datastructure=True, **arg_5)", "path": "cloudaux/orchestration/aws/elb.py", "identifier": "get_load_balancer", "docstring": "Fully describes an ELB.\n\n    :param loadbalancer: Could be an ELB Name or a dictionary. Likely the return value from a previous call to describe_load_balancers. At a minimum, must contain a key titled 'LoadBalancerName'.\n    :param flags: Flags describing which sections should be included in the return value. Default is FLAGS.ALL minus FLAGS.POLICY_TYPES.\n    :return: Returns a dictionary describing the ELB with the fields described in the flags parameter.", "docstring_tokens": ["Fully", "describes", "an", "ELB", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 253156}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L139-L212", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Retrieves all virtual machines instances in the current environment.", "language": "python", "parameters": "(show=1, name=None, group=None, release=None, except_release=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "1", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "from", "burlap", ".", "common", "import", "shelf", ",", "OrderedDict", ",", "get_verbose", "arg_5", "=", "get_verbose", "(", ")", "require", "(", "'vm_type'", ",", "'vm_group'", ")", "assert", "arg_6", ".", "vm_type", ",", "'No VM type specified.'", "arg_6", ".", "vm_type", "=", "(", "arg_6", ".", "vm_type", "or", "''", ")", ".", "lower", "(", ")", "arg_8", "=", "arg_1", "arg_9", "=", "arg_2", "arg_10", "=", "arg_3", "if", "arg_5", ":", "print", "(", "'name=%s, group=%s, release=%s'", "%", "(", "arg_8", ",", "arg_9", ",", "arg_10", ")", ")", "arg_6", ".", "vm_elastic_ip_mappings", "=", "shelf", ".", "get", "(", "'vm_elastic_ip_mappings'", ")", "arg_12", "=", "type", "(", "arg_6", ")", "(", ")", "if", "arg_6", ".", "vm_type", "==", "EC2", ":", "if", "arg_5", ":", "print", "(", "'Checking EC2...'", ")", "for", "arg_13", "in", "get_all_running_ec2_instances", "(", ")", ":", "arg_1", "=", "arg_13", ".", "tags", ".", "get", "(", "arg_6", ".", "vm_name_tag", ")", "arg_2", "=", "arg_13", ".", "tags", ".", "get", "(", "arg_6", ".", "vm_group_tag", ")", "arg_3", "=", "arg_13", ".", "tags", ".", "get", "(", "arg_6", ".", "vm_release_tag", ")", "if", "arg_6", ".", "vm_group", "and", "arg_6", ".", "vm_group", "!=", "arg_2", ":", "if", "arg_5", ":", "print", "(", "(", "'Skipping instance %s because its group \"%s\" '", "'does not match env.vm_group \"%s\".'", ")", "%", "(", "arg_13", ".", "public_dns_name", ",", "arg_2", ",", "arg_6", ".", "vm_group", ")", ")", "continue", "if", "arg_9", "and", "arg_2", "!=", "arg_9", ":", "if", "arg_5", ":", "print", "(", "(", "'Skipping instance %s because its group \"%s\" '", "'does not match local group \"%s\".'", ")", "%", "(", "arg_13", ".", "public_dns_name", ",", "arg_2", ",", "arg_9", ")", ")", "continue", "if", "arg_8", "and", "arg_1", "!=", "arg_8", ":", "if", "arg_5", ":", "print", "(", "(", "'Skipping instance %s because its name \"%s\" '", "'does not match name \"%s\".'", ")", "%", "(", "arg_13", ".", "public_dns_name", ",", "arg_1", ",", "arg_8", ")", ")", "continue", "if", "arg_10", "and", "arg_3", "!=", "arg_10", ":", "if", "arg_5", ":", "print", "(", "(", "'Skipping instance %s because its release \"%s\" '", "'does not match release \"%s\".'", ")", "%", "(", "arg_13", ".", "public_dns_name", ",", "arg_3", ",", "arg_10", ")", ")", "continue", "if", "arg_4", "and", "arg_3", "==", "arg_4", ":", "continue", "if", "arg_5", ":", "print", "(", "'Adding instance %s (%s).'", "%", "(", "arg_1", ",", "arg_13", ".", "public_dns_name", ")", ")", "arg_12", ".", "setdefault", "(", "arg_1", ",", "type", "(", "arg_6", ")", "(", ")", ")", "arg_12", "[", "arg_1", "]", "[", "'id'", "]", "=", "arg_13", ".", "id", "arg_12", "[", "arg_1", "]", "[", "'public_dns_name'", "]", "=", "arg_13", ".", "public_dns_name", "if", "arg_5", ":", "print", "(", "'Public DNS: %s'", "%", "arg_13", ".", "public_dns_name", ")", "if", "arg_6", ".", "vm_elastic_ip_mappings", "and", "arg_1", "in", "arg_6", ".", "vm_elastic_ip_mappings", ":", "arg_12", "[", "arg_1", "]", "[", "'ip'", "]", "=", "arg_6", ".", "vm_elastic_ip_mappings", "[", "arg_1", "]", "else", ":", "arg_12", "[", "arg_1", "]", "[", "'ip'", "]", "=", "socket", ".", "gethostbyname", "(", "arg_13", ".", "public_dns_name", ")", "if", "int", "(", "arg_0", ")", ":", "pprint", "(", "arg_12", ",", "indent", "=", "4", ")", "return", "arg_12", "elif", "arg_6", ".", "vm_type", "==", "KVM", ":", "pass", "else", ":", "raise", "NotImplementedError"], "function": "def Func(arg_0=1, arg_1=None, arg_2=None, arg_3=None, arg_4=None):\n    \"\"\"\n    Retrieves all virtual machines instances in the current environment.\n    \"\"\"\n    from burlap.common import shelf, OrderedDict, get_verbose\n\n    arg_5 = get_verbose()\n    require('vm_type', 'vm_group')\n    assert arg_6.vm_type, 'No VM type specified.'\n    arg_6.vm_type = (arg_6.vm_type or '').lower()\n    arg_8 = arg_1\n    arg_9 = arg_2\n    arg_10 = arg_3\n    if arg_5:\n        print('name=%s, group=%s, release=%s' % (arg_8, arg_9, arg_10))\n\n    arg_6.vm_elastic_ip_mappings = shelf.get('vm_elastic_ip_mappings')\n\n    arg_12 = type(arg_6)()\n    if arg_6.vm_type == EC2:\n        if arg_5:\n            print('Checking EC2...')\n        for arg_13 in get_all_running_ec2_instances():\n            arg_1 = arg_13.tags.get(arg_6.vm_name_tag)\n            arg_2 = arg_13.tags.get(arg_6.vm_group_tag)\n            arg_3 = arg_13.tags.get(arg_6.vm_release_tag)\n            if arg_6.vm_group and arg_6.vm_group != arg_2:\n                if arg_5:\n                    print(('Skipping instance %s because its group \"%s\" '\n                        'does not match env.vm_group \"%s\".') \\\n                            % (arg_13.public_dns_name, arg_2, arg_6.vm_group))\n                continue\n            if arg_9 and arg_2 != arg_9:\n                if arg_5:\n                    print(('Skipping instance %s because its group \"%s\" '\n                        'does not match local group \"%s\".') \\\n                            % (arg_13.public_dns_name, arg_2, arg_9))\n                continue\n            if arg_8 and arg_1 != arg_8:\n                if arg_5:\n                    print(('Skipping instance %s because its name \"%s\" '\n                        'does not match name \"%s\".') \\\n                            % (arg_13.public_dns_name, arg_1, arg_8))\n                continue\n            if arg_10 and arg_3 != arg_10:\n                if arg_5:\n                    print(('Skipping instance %s because its release \"%s\" '\n                        'does not match release \"%s\".') \\\n                            % (arg_13.public_dns_name, arg_3, arg_10))\n                continue\n            if arg_4 and arg_3 == arg_4:\n                continue\n            if arg_5:\n                print('Adding instance %s (%s).' \\\n                    % (arg_1, arg_13.public_dns_name))\n            arg_12.setdefault(arg_1, type(arg_6)())\n            arg_12[arg_1]['id'] = arg_13.id\n            arg_12[arg_1]['public_dns_name'] = arg_13.public_dns_name\n            if arg_5:\n                print('Public DNS: %s' % arg_13.public_dns_name)\n\n            if arg_6.vm_elastic_ip_mappings and arg_1 in arg_6.vm_elastic_ip_mappings:\n                arg_12[arg_1]['ip'] = arg_6.vm_elastic_ip_mappings[arg_1]\n            else:\n                arg_12[arg_1]['ip'] = socket.gethostbyname(arg_13.public_dns_name)\n\n        if int(arg_0):\n            pprint(arg_12, indent=4)\n        return arg_12\n    elif arg_6.vm_type == KVM:\n        #virsh list\n        pass\n    else:\n        raise NotImplementedError", "path": "burlap/vm.py", "identifier": "list_instances", "docstring": "Retrieves all virtual machines instances in the current environment.", "docstring_tokens": ["Retrieves", "all", "virtual", "machines", "instances", "in", "the", "current", "environment", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 253157}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/restsession.py#L332-L369", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Return a generator that GETs and yields individual JSON `items`.", "language": "python", "parameters": "(self, url, params=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_pages", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "assert", "isinstance", "(", "arg_5", ",", "dict", ")", "arg_6", "=", "arg_5", ".", "get", "(", "'items'", ")", "if", "arg_6", "is", "None", ":", "arg_7", "=", "\"'items' key not found in JSON data: \"", "\"{!r}\"", ".", "format", "(", "arg_5", ")", "raise", "MalformedResponse", "(", "arg_7", ")", "else", ":", "for", "arg_8", "in", "arg_6", ":", "yield", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Return a generator that GETs and yields individual JSON `items`.\n\n        Yields individual `items` from Webex Teams's top-level {'items': [...]}\n        JSON objects. Provides native support for RFC5988 Web Linking.  The\n        generator will request additional pages as needed until all items have\n        been returned.\n\n        Args:\n            url(basestring): The URL of the API endpoint.\n            params(dict): The parameters for the HTTP GET request.\n            **kwargs:\n                erc(int): The expected (success) response code for the request.\n                others: Passed on to the requests package.\n\n        Raises:\n            ApiError: If anything other than the expected response code is\n                returned by the Webex Teams API endpoint.\n            MalformedResponse: If the returned response does not contain a\n                top-level dictionary with an 'items' key.\n\n        \"\"\"\n        # Get generator for pages of JSON data\n        arg_4 = arg_0.get_pages(arg_1, arg_2=arg_2, **arg_3)\n\n        for arg_5 in arg_4:\n            assert isinstance(arg_5, dict)\n\n            arg_6 = arg_5.get('items')\n\n            if arg_6 is None:\n                arg_7 = \"'items' key not found in JSON data: \" \\\n                                \"{!r}\".format(arg_5)\n                raise MalformedResponse(arg_7)\n\n            else:\n                for arg_8 in arg_6:\n                    yield arg_8", "path": "webexteamssdk/restsession.py", "identifier": "RestSession.get_items", "docstring": "Return a generator that GETs and yields individual JSON `items`.\n\n        Yields individual `items` from Webex Teams's top-level {'items': [...]}\n        JSON objects. Provides native support for RFC5988 Web Linking.  The\n        generator will request additional pages as needed until all items have\n        been returned.\n\n        Args:\n            url(basestring): The URL of the API endpoint.\n            params(dict): The parameters for the HTTP GET request.\n            **kwargs:\n                erc(int): The expected (success) response code for the request.\n                others: Passed on to the requests package.\n\n        Raises:\n            ApiError: If anything other than the expected response code is\n                returned by the Webex Teams API endpoint.\n            MalformedResponse: If the returned response does not contain a\n                top-level dictionary with an 'items' key.", "docstring_tokens": ["Return", "a", "generator", "that", "GETs", "and", "yields", "individual", "JSON", "items", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 253158}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/timeslots.py#L211-L221", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return if self is mergeable with `timeslots`.", "language": "python", "parameters": "(self, timeslots: 'TimeslotCollection')", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "'TimeslotCollection'", ")", "->", "bool", ":", "for", "arg_2", "in", "arg_1", ".", "timeslots", ":", "for", "arg_3", "in", "arg_0", ".", "_table", "[", "arg_2", ".", "channel", "]", ":", "if", "arg_2", ".", "interval", ".", "has_overlap", "(", "arg_3", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1: 'TimeslotCollection') -> bool:\n        \"\"\"Return if self is mergeable with `timeslots`.\n\n        Args:\n            timeslots: TimeslotCollection to be checked\n        \"\"\"\n        for arg_2 in arg_1.timeslots:\n            for arg_3 in arg_0._table[arg_2.channel]:\n                if arg_2.interval.has_overlap(arg_3):\n                    return False\n        return True", "path": "qiskit/pulse/timeslots.py", "identifier": "TimeslotCollection.is_mergeable_with", "docstring": "Return if self is mergeable with `timeslots`.\n\n        Args:\n            timeslots: TimeslotCollection to be checked", "docstring_tokens": ["Return", "if", "self", "is", "mergeable", "with", "timeslots", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253159}
{"url": "https://github.com/Syndace/python-doubleratchet/blob/d4497af73044e0084efa3e447276ee9d6a6eb66a/doubleratchet/ratchets/dhratchet.py#L76-L94", "sha": "d4497af73044e0084efa3e447276ee9d6a6eb66a", "docstring_summary": "Perform a rachted step, calculating a new shared secret from the public key and\n        deriving new chain keys from this secret.", "language": "python", "parameters": "(self, other_pub)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "triggersStep", "(", "arg_1", ")", ":", "arg_0", ".", "__wrapOtherPub", "(", "arg_1", ")", "arg_0", ".", "__newRootKey", "(", "\"receiving\"", ")", "arg_0", ".", "__newRatchetKey", "(", ")", "arg_0", ".", "__newRootKey", "(", "\"sending\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Perform a rachted Func, calculating a new shared secret from the public key and\n        deriving new chain keys from this secret.\n\n        New Diffie-Hellman calculations are only performed if the public key is different\n        from the previous one.\n\n        :param other_pub: A bytes-like object encoding the public key of the other\n            Diffie-Hellman ratchet to synchronize with.\n        \"\"\"\n\n        if arg_0.triggersStep(arg_1):\n            arg_0.__wrapOtherPub(arg_1)\n            arg_0.__newRootKey(\"receiving\")\n\n            arg_0.__newRatchetKey()\n\n            arg_0.__newRootKey(\"sending\")", "path": "doubleratchet/ratchets/dhratchet.py", "identifier": "DHRatchet.step", "docstring": "Perform a rachted step, calculating a new shared secret from the public key and\n        deriving new chain keys from this secret.\n\n        New Diffie-Hellman calculations are only performed if the public key is different\n        from the previous one.\n\n        :param other_pub: A bytes-like object encoding the public key of the other\n            Diffie-Hellman ratchet to synchronize with.", "docstring_tokens": ["Perform", "a", "rachted", "step", "calculating", "a", "new", "shared", "secret", "from", "the", "public", "key", "and", "deriving", "new", "chain", "keys", "from", "this", "secret", "."], "nwo": "Syndace/python-doubleratchet", "score": 0.37431295205163906, "idx": 253160}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/interactive/iplot_qsphere.py#L158-L172", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the number of combinations for n choose k.", "language": "python", "parameters": "(n, k)", "return_statement": "return reduce(lambda x, y: x * y[0] / y[1],\n                  zip(range(n - k + 1, n + 1),\n                      range(1, k + 1)), 1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "==", "0", ":", "return", "0", "return", "reduce", "(", "lambda", "x", ",", "y", ":", "x", "*", "y", "[", "0", "]", "/", "y", "[", "1", "]", ",", "zip", "(", "range", "(", "arg_0", "-", "arg_1", "+", "1", ",", "arg_0", "+", "1", ")", ",", "range", "(", "1", ",", "arg_1", "+", "1", ")", ")", ",", "1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return the number of combinations for n choose k.\n\n    Args:\n        n (int): the total number of options .\n        k (int): The number of elements.\n\n    Returns:\n        int: returns the binomial coefficient\n    \"\"\"\n    if arg_0 == 0:\n        return 0\n    return reduce(lambda x, y: x * y[0] / y[1],\n                  zip(range(arg_0 - arg_1 + 1, arg_0 + 1),\n                      range(1, arg_1 + 1)), 1)", "path": "qiskit/visualization/interactive/iplot_qsphere.py", "identifier": "n_choose_k", "docstring": "Return the number of combinations for n choose k.\n\n    Args:\n        n (int): the total number of options .\n        k (int): The number of elements.\n\n    Returns:\n        int: returns the binomial coefficient", "docstring_tokens": ["Return", "the", "number", "of", "combinations", "for", "n", "choose", "k", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253161}
{"url": "https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/task.py#L130-L135", "sha": "48c842fe053bf9cd6446c4b33fb081c65339aa48", "docstring_summary": "Returns the configuration for KEY", "language": "python", "parameters": "(self, key, default=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "in", "arg_0", ".", "config", ":", "return", "arg_0", ".", "config", ".", "get", "(", "arg_1", ")", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Returns the configuration for KEY\"\"\"\n        if arg_1 in arg_0.config:\n            return arg_0.config.get(arg_1)\n        else:\n            return arg_2", "path": "yaz/task.py", "identifier": "Task.get_configuration", "docstring": "Returns the configuration for KEY", "docstring_tokens": ["Returns", "the", "configuration", "for", "KEY"], "nwo": "yaz/yaz", "score": 0.138843686048881, "idx": 253162}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/tuio/OSC.py#L38-L46", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Useful utility; prints the string in hexadecimal", "language": "python", "parameters": "(bytes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "range", "(", "len", "(", "arg_0", ")", ")", ":", "sys", ".", "stdout", ".", "write", "(", "\"%2x \"", "%", "(", "ord", "(", "arg_0", "[", "arg_1", "]", ")", ")", ")", "if", "(", "arg_1", "+", "1", ")", "%", "8", "==", "0", ":", "print", "repr", "(", "arg_0", "[", "arg_1", "-", "7", ":", "arg_1", "+", "1", "]", ")", "if", "(", "len", "(", "arg_0", ")", "%", "8", "!=", "0", ")", ":", "print", "string", ".", "rjust", "(", "\"\"", ",", "11", ")", ",", "repr", "(", "arg_0", "[", "arg_1", "-", "len", "(", "arg_0", ")", "%", "8", ":", "arg_1", "+", "1", "]", ")"], "function": "def Func(arg_0):\n    \"\"\"Useful utility; prints the string in hexadecimal\"\"\"\n    for arg_1 in range(len(arg_0)):\n        sys.stdout.write(\"%2x \" % (ord(arg_0[arg_1])))\n        if (arg_1+1) % 8 == 0:\n            print repr(arg_0[arg_1-7:arg_1+1])\n\n    if(len(arg_0) % 8 != 0):\n        print string.rjust(\"\", 11), repr(arg_0[arg_1-len(arg_0)%8:arg_1+1])", "path": "lib/tuio/OSC.py", "identifier": "hexDump", "docstring": "Useful utility; prints the string in hexadecimal", "docstring_tokens": ["Useful", "utility", ";", "prints", "the", "string", "in", "hexadecimal"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253163}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/board.py#L12-L29", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Verify BOARD variables and construct exported variables", "language": "python", "parameters": "()", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "cij", ".", "ssh", ".", "Func", "(", ")", ":", "cij", ".", "err", "(", "\"board.Func: invalid SSH Funcironment\"", ")", "return", "1", "arg_0", "=", "cij", ".", "Func_to_dict", "(", "PREFIX", ",", "REQUIRED", ")", "if", "arg_0", "is", "None", ":", "cij", ".", "err", "(", "\"board.Func: invalid BOARD Funcironment\"", ")", "return", "1", "arg_0", "[", "\"CLASS\"", "]", "=", "\"_\"", ".", "join", "(", "[", "arg_0", "[", "r", "]", "for", "r", "in", "REQUIRED", "[", ":", "-", "1", "]", "]", ")", "arg_0", "[", "\"IDENT\"", "]", "=", "\"-\"", ".", "join", "(", "[", "arg_0", "[", "\"CLASS\"", "]", ",", "arg_0", "[", "\"ALIAS\"", "]", "]", ")", "cij", ".", "Func_export", "(", "PREFIX", ",", "EXPORTED", ",", "arg_0", ")", "return", "0"], "function": "def Func():\n    \"\"\"Verify BOARD variables and construct exported variables\"\"\"\n\n    if cij.ssh.Func():\n        cij.err(\"board.Func: invalid SSH Funcironment\")\n        return 1\n\n    arg_0 = cij.Func_to_dict(PREFIX, REQUIRED)   # Verify REQUIRED variables\n    if arg_0 is None:\n        cij.err(\"board.Func: invalid BOARD Funcironment\")\n        return 1\n\n    arg_0[\"CLASS\"] = \"_\".join([arg_0[r] for r in REQUIRED[:-1]])\n    arg_0[\"IDENT\"] = \"-\".join([arg_0[\"CLASS\"], arg_0[\"ALIAS\"]])\n\n    cij.Func_export(PREFIX, EXPORTED, arg_0)     # Export EXPORTED variables\n\n    return 0", "path": "modules/cij/board.py", "identifier": "env", "docstring": "Verify BOARD variables and construct exported variables", "docstring_tokens": ["Verify", "BOARD", "variables", "and", "construct", "exported", "variables"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 253164}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/file_utils.py#L95-L115", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Return a temporary file with the given suffix within dirpath.\n    If dirpath is None, will look for a temporary folder in your system.", "language": "python", "parameters": "(suffix='.txt', dirpath=None)", "return_statement": "return tempfile.NamedTemporaryFile(suffix=suffix, dir=dirpath)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'.txt'", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "get_temp_dir", "(", ")", "return", "tempfile", ".", "NamedTemporaryFile", "(", "arg_0", "=", "arg_0", ",", "dir", "=", "arg_1", ")"], "function": "def Func(arg_0='.txt', arg_1=None):\n    \"\"\" Return a temporary file with the given suffix within dirpath.\n    If dirpath is None, will look for a temporary folder in your system.\n\n    Parameters\n    ----------\n    suffix: str\n        Temporary file name suffix\n\n    dirpath: str\n        Folder path where create the temporary file\n\n    Returns\n    -------\n    temp_filepath: str\n        The path to the temporary path\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = get_temp_dir()\n\n    return tempfile.NamedTemporaryFile(arg_0=arg_0, dir=arg_1)", "path": "docstamp/file_utils.py", "identifier": "get_tempfile", "docstring": "Return a temporary file with the given suffix within dirpath.\n    If dirpath is None, will look for a temporary folder in your system.\n\n    Parameters\n    ----------\n    suffix: str\n        Temporary file name suffix\n\n    dirpath: str\n        Folder path where create the temporary file\n\n    Returns\n    -------\n    temp_filepath: str\n        The path to the temporary path", "docstring_tokens": ["Return", "a", "temporary", "file", "with", "the", "given", "suffix", "within", "dirpath", ".", "If", "dirpath", "is", "None", "will", "look", "for", "a", "temporary", "folder", "in", "your", "system", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 253165}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/quantum_channel.py#L44-L50", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return True if QuantumChannel is a unitary channel.", "language": "python", "parameters": "(self, atol=None, rtol=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "to_operator", "(", ")", "return", "arg_3", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "except", "QiskitError", ":", "return", "False"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Return True if QuantumChannel is a unitary channel.\"\"\"\n        try:\n            arg_3 = arg_0.to_operator()\n            return arg_3.Func(arg_1=arg_1, arg_2=arg_2)\n        except QiskitError:\n            return False", "path": "qiskit/quantum_info/operators/channel/quantum_channel.py", "identifier": "QuantumChannel.is_unitary", "docstring": "Return True if QuantumChannel is a unitary channel.", "docstring_tokens": ["Return", "True", "if", "QuantumChannel", "is", "a", "unitary", "channel", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253166}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/stats_server.py#L48-L55", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Handles static files requests.", "language": "python", "parameters": "(self)", "return_statement": "return content, 'text/%s' % extension[1:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "_STATIC_DIR", ",", "arg_0", ".", "path", "[", "1", ":", "]", ")", "with", "io", ".", "open", "(", "arg_1", ",", "'rb'", ")", "as", "res_file", ":", "arg_2", "=", "res_file", ".", "read", "(", ")", "arg_3", ",", "arg_4", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ".", "path", ")", "return", "arg_2", ",", "'text/%s'", "%", "arg_4", "[", "1", ":", "]"], "function": "def Func(arg_0):\n        \"\"\"Handles static files requests.\"\"\"\n        arg_1 = os.path.join(\n            os.path.dirname(__file__), _STATIC_DIR, arg_0.path[1:])\n        with io.open(arg_1, 'rb') as res_file:\n            arg_2 = res_file.read()\n        arg_3, arg_4 = os.path.splitext(arg_0.path)\n        return arg_2, 'text/%s' % arg_4[1:]", "path": "vprof/stats_server.py", "identifier": "StatsHandler._handle_other", "docstring": "Handles static files requests.", "docstring_tokens": ["Handles", "static", "files", "requests", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 253167}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L95-L115", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Gets ``username``, ``course_id``, and ``enterprise_customer_uuid``,\n        which are the relevant query parameters for this API endpoint.", "language": "python", "parameters": "(self, request)", "return_statement": "return username, course_id, program_uuid, enterprise_customer_uuid", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "get_request_value", "(", "arg_1", ",", "arg_0", ".", "REQUIRED_PARAM_USERNAME", ",", "''", ")", "arg_3", "=", "get_request_value", "(", "arg_1", ",", "arg_0", ".", "REQUIRED_PARAM_COURSE_ID", ",", "''", ")", "arg_4", "=", "get_request_value", "(", "arg_1", ",", "arg_0", ".", "REQUIRED_PARAM_PROGRAM_UUID", ",", "''", ")", "arg_5", "=", "get_request_value", "(", "arg_1", ",", "arg_0", ".", "REQUIRED_PARAM_ENTERPRISE_CUSTOMER", ")", "if", "not", "(", "arg_2", "and", "(", "arg_3", "or", "arg_4", ")", "and", "arg_5", ")", ":", "raise", "ConsentAPIRequestError", "(", "arg_0", ".", "get_missing_params_message", "(", "[", "(", "\"'username'\"", ",", "bool", "(", "arg_2", ")", ")", ",", "(", "\"'enterprise_customer_uuid'\"", ",", "bool", "(", "arg_5", ")", ")", ",", "(", "\"one of 'course_id' or 'program_uuid'\"", ",", "bool", "(", "arg_3", "or", "arg_4", ")", ")", ",", "]", ")", ")", "return", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Gets ``username``, ``course_id``, and ``enterprise_customer_uuid``,\n        which are the relevant query parameters for this API endpoint.\n\n        :param request: The request to this endpoint.\n        :return: The ``username``, ``course_id``, and ``enterprise_customer_uuid`` from the request.\n        \"\"\"\n        arg_2 = get_request_value(arg_1, arg_0.REQUIRED_PARAM_USERNAME, '')\n        arg_3 = get_request_value(arg_1, arg_0.REQUIRED_PARAM_COURSE_ID, '')\n        arg_4 = get_request_value(arg_1, arg_0.REQUIRED_PARAM_PROGRAM_UUID, '')\n        arg_5 = get_request_value(arg_1, arg_0.REQUIRED_PARAM_ENTERPRISE_CUSTOMER)\n        if not (arg_2 and (arg_3 or arg_4) and arg_5):\n            raise ConsentAPIRequestError(\n                arg_0.get_missing_params_message([\n                    (\"'username'\", bool(arg_2)),\n                    (\"'enterprise_customer_uuid'\", bool(arg_5)),\n                    (\"one of 'course_id' or 'program_uuid'\", bool(arg_3 or arg_4)),\n                ])\n            )\n        return arg_2, arg_3, arg_4, arg_5", "path": "consent/api/v1/views.py", "identifier": "DataSharingConsentView.get_required_query_params", "docstring": "Gets ``username``, ``course_id``, and ``enterprise_customer_uuid``,\n        which are the relevant query parameters for this API endpoint.\n\n        :param request: The request to this endpoint.\n        :return: The ``username``, ``course_id``, and ``enterprise_customer_uuid`` from the request.", "docstring_tokens": ["Gets", "username", "course_id", "and", "enterprise_customer_uuid", "which", "are", "the", "relevant", "query", "parameters", "for", "this", "API", "endpoint", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253168}
{"url": "https://github.com/mvexel/maproulette-api-wrapper/blob/835278111afefed2beecf9716a033529304c548f/maproulette/task.py#L45-L54", "sha": "835278111afefed2beecf9716a033529304c548f", "docstring_summary": "Create the task on the server", "language": "python", "parameters": "(self, server)", "return_statement": "return server.post(\n            'task_admin',\n            self.as_payload(),\n            replacements={\n                'slug': self.__challenge__.slug,\n                'identifier': self.identifier})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_0", ".", "geometries", ")", "==", "0", ":", "raise", "Exception", "(", "'no geometries'", ")", "return", "arg_1", ".", "post", "(", "'task_admin'", ",", "arg_0", ".", "as_payload", "(", ")", ",", "replacements", "=", "{", "'slug'", ":", "arg_0", ".", "__challenge__", ".", "slug", ",", "'identifier'", ":", "arg_0", ".", "identifier", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create the task on the server\"\"\"\n        if len(arg_0.geometries) == 0:\n            raise Exception('no geometries')\n        return arg_1.post(\n            'task_admin',\n            arg_0.as_payload(),\n            replacements={\n                'slug': arg_0.__challenge__.slug,\n                'identifier': arg_0.identifier})", "path": "maproulette/task.py", "identifier": "MapRouletteTask.create", "docstring": "Create the task on the server", "docstring_tokens": ["Create", "the", "task", "on", "the", "server"], "nwo": "mvexel/maproulette-api-wrapper", "score": 0.09252797783733271, "idx": 253169}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L352-L358", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Return a client with same settings of the batch client", "language": "python", "parameters": "(self)", "return_statement": "return client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Client", "(", "arg_0", ".", "host", ",", "arg_0", ".", "port", ",", "arg_0", ".", "prefix", ")", "arg_0", ".", "_configure_client", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        # type: () -> Client\n        \"\"\"Return a client with same settings of the batch client\"\"\"\n\n        arg_1 = Client(arg_0.host, arg_0.port, arg_0.prefix)\n        arg_0._configure_client(arg_1)\n        return arg_1", "path": "statsdmetrics/client/__init__.py", "identifier": "BatchClient.unit_client", "docstring": "Return a client with same settings of the batch client", "docstring_tokens": ["Return", "a", "client", "with", "same", "settings", "of", "the", "batch", "client"], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 253170}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/lang/props.py#L11-L73", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "`prop` is a sugar for `property`.", "language": "python", "parameters": "(func=None, *,\n         field = _UNSET,\n         get: bool = True, set: bool = True, del_: bool = False,\n         default = _UNSET,\n         types: tuple = _UNSET)", "return_statement": "return wrap(func) if func else wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "*", ",", "arg_1", "=", "arg_2", ",", "arg_3", ":", "arg_4", "=", "True", ",", "arg_5", ":", "arg_4", "=", "True", ",", "arg_6", ":", "arg_4", "=", "False", ",", "arg_7", "=", "arg_2", ",", "arg_8", ":", "arg_9", "=", "arg_2", ")", ":", "def", "wrap", "(", "arg_0", ")", ":", "if", "not", "callable", "(", "arg_0", ")", ":", "raise", "TypeError", "arg_10", "=", "arg_0", ".", "__name__", "arg_11", "=", "arg_1", "if", "arg_11", "is", "arg_2", ":", "arg_11", "=", "'_'", "+", "arg_10", "arg_12", ",", "arg_13", ",", "arg_14", "=", "None", ",", "None", ",", "None", "if", "arg_3", ":", "def", "arg_12", "(", "arg_15", ")", ":", "try", ":", "return", "arg_15", ".", "__dict__", "[", "arg_11", "]", "except", "KeyError", ":", "if", "arg_7", "is", "not", "arg_2", ":", "return", "arg_7", "raise", "AttributeError", "(", "f\"'{type(self).__name__}' object has no attribute '{key}'\"", ")", "if", "arg_5", ":", "def", "arg_13", "(", "arg_15", ",", "arg_16", ")", ":", "if", "arg_8", "is", "not", "arg_2", "and", "not", "isinstance", "(", "arg_16", ",", "arg_8", ")", ":", "if", "isinstance", "(", "arg_8", ",", "arg_9", ")", ":", "arg_17", "=", "arg_9", "(", "x", ".", "__name__", "for", "x", "in", "arg_8", ")", "else", ":", "arg_17", "=", "arg_8", ".", "__name__", "raise", "TypeError", "(", "f'type of {type(self).__name__}.{Func_name} must be {types_name}; '", "f'got {type(val).__name__} instead'", ")", "arg_15", ".", "__dict__", "[", "arg_11", "]", "=", "arg_16", "if", "arg_6", ":", "def", "arg_14", "(", "arg_15", ")", ":", "del", "arg_15", ".", "__dict__", "[", "arg_11", "]", "return", "Funcerty", "(", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_0", ".", "__doc__", ")", "return", "wrap", "(", "arg_0", ")", "if", "arg_0", "else", "wrap"], "function": "def Func(arg_0=None, *,\n         arg_1 = arg_2,\n         arg_3: arg_4 = True, arg_5: arg_4 = True, arg_6: arg_4 = False,\n         arg_7 = arg_2,\n         arg_8: arg_9 = arg_2):\n    '''\n    `Func` is a sugar for `Funcerty`.\n\n    ``` py\n    @Func\n    def value(self):\n        pass\n\n    # equals:\n\n    @Funcerty\n    def value(self):\n        return self._value\n\n    @value.setter\n    def value(self, val):\n        self._value = val\n    ```\n    '''\n\n    def wrap(arg_0):\n        if not callable(arg_0):\n            raise TypeError\n\n        arg_10 = arg_0.__name__\n        arg_11 = arg_1\n        if arg_11 is arg_2:\n            arg_11 = '_' + arg_10\n\n        arg_12, arg_13, arg_14 = None, None, None\n\n        if arg_3:\n            def arg_12(arg_15):\n                try:\n                    return arg_15.__dict__[arg_11]\n                except KeyError:\n                    if arg_7 is not arg_2:\n                        return arg_7\n                    raise AttributeError(f\"'{type(self).__name__}' object has no attribute '{key}'\")\n\n        if arg_5:\n            def arg_13(arg_15, arg_16):\n                if arg_8 is not arg_2 and not isinstance(arg_16, arg_8):\n                    if isinstance(arg_8, arg_9):\n                        arg_17 = arg_9(x.__name__ for x in arg_8)\n                    else:\n                        arg_17 = arg_8.__name__\n                    raise TypeError(f'type of {type(self).__name__}.{Func_name} must be {types_name}; '\n                                    f'got {type(val).__name__} instead')\n                arg_15.__dict__[arg_11] = arg_16\n\n        if arg_6:\n            def arg_14(arg_15):\n                del arg_15.__dict__[arg_11]\n\n        return Funcerty(arg_12, arg_13, arg_14, arg_0.__doc__)\n\n    return wrap(arg_0) if arg_0 else wrap", "path": "jasily/lang/props.py", "identifier": "prop", "docstring": "`prop` is a sugar for `property`.\n\n    ``` py\n    @prop\n    def value(self):\n        pass\n\n    # equals:\n\n    @property\n    def value(self):\n        return self._value\n\n    @value.setter\n    def value(self, val):\n        self._value = val\n    ```", "docstring_tokens": ["prop", "is", "a", "sugar", "for", "property", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 253171}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L383-L387", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Set the time zone data of this object from a _tzfile object", "language": "python", "parameters": "(self, tzobj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "_tzfile", ".", "attrs", ":", "setattr", "(", "arg_0", ",", "'_'", "+", "arg_2", ",", "getattr", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Set the time zone data of this object from a _tzfile object \"\"\"\n        # Copy the relevant attributes over as private attributes\n        for arg_2 in _tzfile.attrs:\n            setattr(arg_0, '_' + arg_2, getattr(arg_1, arg_2))", "path": "superjson/pkg/dateutil/tz/tz.py", "identifier": "tzfile._set_tzdata", "docstring": "Set the time zone data of this object from a _tzfile object", "docstring_tokens": ["Set", "the", "time", "zone", "data", "of", "this", "object", "from", "a", "_tzfile", "object"], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 253172}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/specs/BpmnProcessSpec.py#L141-L164", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns an etree HTML node with a document describing the process. This\n        is only supported if the editor provided an SVG representation.", "language": "python", "parameters": "(self)", "return_statement": "return html_text.replace('___CONTENT___', svg_content)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ET", ".", "Element", "(", "'html'", ")", "arg_2", "=", "ET", ".", "SubElement", "(", "arg_1", ",", "'head'", ")", "arg_3", "=", "ET", ".", "SubElement", "(", "arg_2", ",", "'title'", ")", "arg_3", ".", "text", "=", "arg_0", ".", "description", "arg_5", "=", "ET", ".", "SubElement", "(", "arg_1", ",", "'body'", ")", "arg_6", "=", "ET", ".", "SubElement", "(", "arg_5", ",", "'h1'", ")", "arg_6", ".", "text", "=", "arg_0", ".", "description", "arg_7", "=", "ET", ".", "SubElement", "(", "arg_5", ",", "'span'", ")", "arg_7", ".", "text", "=", "'___CONTENT___'", "arg_8", "=", "ET", ".", "tostring", "(", "arg_1", ")", "arg_9", "=", "''", "arg_10", "=", "set", "(", ")", "for", "arg_11", "in", "arg_0", ".", "get_specs_depth_first", "(", ")", ":", "if", "arg_11", ".", "svg", "and", "arg_11", ".", "svg", "not", "in", "arg_10", ":", "arg_9", "+=", "'<p>'", "+", "arg_11", ".", "svg", "+", "\"</p>\"", "arg_10", ".", "add", "(", "arg_11", ".", "svg", ")", "return", "arg_8", ".", "replace", "(", "'___CONTENT___'", ",", "arg_9", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns an etree HTML node with a document describing the process. This\n        is only supported if the editor provided an SVG representation.\n        \"\"\"\n        arg_1 = ET.Element('html')\n        arg_2 = ET.SubElement(arg_1, 'head')\n        arg_3 = ET.SubElement(arg_2, 'title')\n        arg_3.text = arg_0.description\n        arg_5 = ET.SubElement(arg_1, 'body')\n        arg_6 = ET.SubElement(arg_5, 'h1')\n        arg_6.text = arg_0.description\n        arg_7 = ET.SubElement(arg_5, 'span')\n        arg_7.text = '___CONTENT___'\n\n        arg_8 = ET.tostring(arg_1)\n\n        arg_9 = ''\n        arg_10 = set()\n        for arg_11 in arg_0.get_specs_depth_first():\n            if arg_11.svg and arg_11.svg not in arg_10:\n                arg_9 += '<p>' + arg_11.svg + \"</p>\"\n                arg_10.add(arg_11.svg)\n        return arg_8.replace('___CONTENT___', arg_9)", "path": "SpiffWorkflow/bpmn/specs/BpmnProcessSpec.py", "identifier": "BpmnProcessSpec.to_html_string", "docstring": "Returns an etree HTML node with a document describing the process. This\n        is only supported if the editor provided an SVG representation.", "docstring_tokens": ["Returns", "an", "etree", "HTML", "node", "with", "a", "document", "describing", "the", "process", ".", "This", "is", "only", "supported", "if", "the", "editor", "provided", "an", "SVG", "representation", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 253173}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/application/briefkasten/__init__.py#L20-L40", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "receives a UUID via the request and returns either a fresh or an existing dropbox\n    for it", "language": "python", "parameters": "(request)", "return_statement": "return dropbox", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "int", "(", "arg_0", ".", "registry", ".", "settings", ".", "get", "(", "'post_token_max_age_seconds'", ")", ")", "except", "Exception", ":", "arg_1", "=", "300", "try", ":", "arg_2", "=", "parse_post_token", "(", "token", "=", "arg_0", ".", "matchdict", "[", "'token'", "]", ",", "secret", "=", "arg_0", ".", "registry", ".", "settings", "[", "'post_secret'", "]", ",", "arg_1", "=", "arg_1", ")", "except", "SignatureExpired", ":", "raise", "HTTPGone", "(", "'dropbox expired'", ")", "except", "Exception", ":", "raise", "HTTPNotFound", "(", "'no such dropbox'", ")", "arg_3", "=", "arg_0", ".", "registry", ".", "settings", "[", "'dropbox_container'", "]", ".", "get_dropbox", "(", "arg_2", ")", "if", "arg_3", ".", "status_int", ">=", "20", ":", "raise", "HTTPGone", "(", "'dropbox already in processing, no longer accepts data'", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"receives a UUID via the request and returns either a fresh or an existing dropbox\n    for it\"\"\"\n    try:\n        arg_1 = int(arg_0.registry.settings.get('post_token_max_age_seconds'))\n    except Exception:\n        arg_1 = 300\n\n    try:\n        arg_2 = parse_post_token(\n            token=arg_0.matchdict['token'],\n            secret=arg_0.registry.settings['post_secret'],\n            arg_1=arg_1)\n    except SignatureExpired:\n        raise HTTPGone('dropbox expired')\n    except Exception:  # don't be too specific on the reason for the error\n        raise HTTPNotFound('no such dropbox')\n    arg_3 = arg_0.registry.settings['dropbox_container'].get_dropbox(arg_2)\n    if arg_3.status_int >= 20:\n        raise HTTPGone('dropbox already in processing, no longer accepts data')\n    return arg_3", "path": "application/briefkasten/__init__.py", "identifier": "dropbox_post_factory", "docstring": "receives a UUID via the request and returns either a fresh or an existing dropbox\n    for it", "docstring_tokens": ["receives", "a", "UUID", "via", "the", "request", "and", "returns", "either", "a", "fresh", "or", "an", "existing", "dropbox", "for", "it"], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 253174}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/__init__.py#L58-L66", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "Parses option_settings as they are defined in the configuration file", "language": "python", "parameters": "(option_settings)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", "in", "list", "(", "arg_0", ".", "items", "(", ")", ")", ":", "for", "arg_4", ",", "arg_5", "in", "list", "(", "arg_3", ".", "items", "(", ")", ")", ":", "arg_1", ".", "append", "(", "(", "arg_2", ",", "arg_4", ",", "arg_5", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Parses option_settings as they are defined in the configuration file\n    \"\"\"\n    arg_1 = []\n    for arg_2, arg_3 in list(arg_0.items()):\n        for arg_4, arg_5 in list(arg_3.items()):\n            arg_1.append((arg_2, arg_4, arg_5))\n    return arg_1", "path": "ebs_deploy/__init__.py", "identifier": "parse_option_settings", "docstring": "Parses option_settings as they are defined in the configuration file", "docstring_tokens": ["Parses", "option_settings", "as", "they", "are", "defined", "in", "the", "configuration", "file"], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 253175}
{"url": "https://github.com/hsharrison/pyglet2d/blob/46f610b3c76221bff19e5c0cf3d35d7875ce37a0/src/pyglet2d.py#L108-L122", "sha": "46f610b3c76221bff19e5c0cf3d35d7875ce37a0", "docstring_summary": "Construct a circle.", "language": "python", "parameters": "(cls, center, radius, n_vertices=50, **kwargs)", "return_statement": "return cls.regular_polygon(center, radius, n_vertices, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "50", ",", "**", "arg_4", ")", ":", "return", "arg_0", ".", "regular_polygon", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=50, **arg_4):\n        \"\"\"Construct a Func.\n\n        Parameters\n        ----------\n        center : array-like\n        radius : float\n        n_vertices : int, optional\n            Number of points to draw.\n            Decrease for performance, increase for appearance.\n        kwargs\n            Other keyword arguments are passed to the |Shape| constructor.\n\n        \"\"\"\n        return arg_0.regular_polygon(arg_1, arg_2, arg_3, **arg_4)", "path": "src/pyglet2d.py", "identifier": "Shape.circle", "docstring": "Construct a circle.\n\n        Parameters\n        ----------\n        center : array-like\n        radius : float\n        n_vertices : int, optional\n            Number of points to draw.\n            Decrease for performance, increase for appearance.\n        kwargs\n            Other keyword arguments are passed to the |Shape| constructor.", "docstring_tokens": ["Construct", "a", "circle", "."], "nwo": "hsharrison/pyglet2d", "score": 0.2823188883832642, "idx": 253176}
{"url": "https://github.com/adrianoveiga/django-media-fixtures/blob/a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54/django_media_fixtures/finders.py#L52-L66", "sha": "a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54", "docstring_summary": "Looks for files in the extra locations\n        as defined in ``MEDIA_FIXTURES_FILES_DIRS``.", "language": "python", "parameters": "(self, path, all=False)", "return_statement": "return matches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "locations", ":", "if", "arg_5", "not", "in", "searched_locations", ":", "searched_locations", ".", "append", "(", "arg_5", ")", "arg_6", "=", "arg_0", ".", "Func_location", "(", "arg_5", ",", "arg_1", ",", "arg_4", ")", "if", "arg_6", ":", "if", "not", "arg_2", ":", "return", "arg_6", "arg_3", ".", "append", "(", "arg_6", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Looks for files in the extra locations\n        as defined in ``MEDIA_FIXTURES_FILES_DIRS``.\n        \"\"\"\n        arg_3 = []\n        for arg_4, arg_5 in arg_0.locations:\n            if arg_5 not in searched_locations:\n                searched_locations.append(arg_5)\n            arg_6 = arg_0.Func_location(arg_5, arg_1, arg_4)\n            if arg_6:\n                if not arg_2:\n                    return arg_6\n                arg_3.append(arg_6)\n        return arg_3", "path": "django_media_fixtures/finders.py", "identifier": "FileSystemFinder.find", "docstring": "Looks for files in the extra locations\n        as defined in ``MEDIA_FIXTURES_FILES_DIRS``.", "docstring_tokens": ["Looks", "for", "files", "in", "the", "extra", "locations", "as", "defined", "in", "MEDIA_FIXTURES_FILES_DIRS", "."], "nwo": "adrianoveiga/django-media-fixtures", "score": 0.2845436920530269, "idx": 253177}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3493-L3508", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds an empty result group under the current node.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self._nn_interface._add_generic(self, type_name=RESULT_GROUP,\n                                               group_type_name=RESULT_GROUP,\n                                               args=args, kwargs=kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "_nn_interface", ".", "_add_generic", "(", "arg_0", ",", "type_name", "=", "RESULT_GROUP", ",", "group_type_name", "=", "RESULT_GROUP", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Adds an empty result group under the current node.\n\n        Adds the full name of the current node as prefix to the name of the group.\n        If current node is a single run (root) adds the prefix `'results.runs.run_08%d%'` to the\n        full name where `'08%d'` is replaced by the index of the current run.\n\n        The `name` can also contain subgroups separated via colons, for example:\n        `name=subgroup1.subgroup2.subgroup3`. These other parent groups will be automatically\n        be created.\n\n        \"\"\"\n\n        return arg_0._nn_interface._add_generic(arg_0, type_name=RESULT_GROUP,\n                                               group_type_name=RESULT_GROUP,\n                                               arg_1=arg_1, arg_2=arg_2)", "path": "pypet/naturalnaming.py", "identifier": "ResultGroup.f_add_result_group", "docstring": "Adds an empty result group under the current node.\n\n        Adds the full name of the current node as prefix to the name of the group.\n        If current node is a single run (root) adds the prefix `'results.runs.run_08%d%'` to the\n        full name where `'08%d'` is replaced by the index of the current run.\n\n        The `name` can also contain subgroups separated via colons, for example:\n        `name=subgroup1.subgroup2.subgroup3`. These other parent groups will be automatically\n        be created.", "docstring_tokens": ["Adds", "an", "empty", "result", "group", "under", "the", "current", "node", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253178}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/protobuf/__init__.py#L156-L170", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Converts py_zipkin's annotations dict to protobuf.", "language": "python", "parameters": "(annotations)", "return_statement": "return pb_annotations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "items", "(", ")", ":", "arg_1", ".", "append", "(", "zipkin_pb2", ".", "Annotation", "(", "timestamp", "=", "int", "(", "arg_3", "*", "1000", "*", "1000", ")", ",", "arg_2", "=", "arg_2", ",", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Converts py_zipkin's annotations dict to protobuf.\n\n    :param annotations: annotations dict.\n    :type annotations: dict\n    :return: corresponding protobuf's list of annotations.\n    :rtype: list\n    \"\"\"\n    arg_1 = []\n    for arg_2, arg_3 in arg_0.items():\n        arg_1.append(zipkin_pb2.Annotation(\n            timestamp=int(arg_3 * 1000 * 1000),\n            arg_2=arg_2,\n        ))\n    return arg_1", "path": "py_zipkin/encoding/protobuf/__init__.py", "identifier": "_convert_annotations", "docstring": "Converts py_zipkin's annotations dict to protobuf.\n\n    :param annotations: annotations dict.\n    :type annotations: dict\n    :return: corresponding protobuf's list of annotations.\n    :rtype: list", "docstring_tokens": ["Converts", "py_zipkin", "s", "annotations", "dict", "to", "protobuf", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 253179}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth2.py#L808-L818", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Invalidate an authorization code after use.", "language": "python", "parameters": "(self, client_id, code, request,\n                                      *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "*", "arg_4", ",", "**", "arg_5", ")", ":", "log", ".", "debug", "(", "'Destroy grant token for client %r, %r'", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "arg_0", ".", "_grantgetter", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "arg_6", ":", "arg_6", ".", "delete", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                      *arg_4, **arg_5):\n        \"\"\"Invalidate an authorization code after use.\n\n        We keep the temporary code in a grant, which has a `delete`\n        function to destroy itself.\n        \"\"\"\n        log.debug('Destroy grant token for client %r, %r', arg_1, arg_2)\n        arg_6 = arg_0._grantgetter(arg_1=arg_1, arg_2=arg_2)\n        if arg_6:\n            arg_6.delete()", "path": "flask_oauthlib/provider/oauth2.py", "identifier": "OAuth2RequestValidator.invalidate_authorization_code", "docstring": "Invalidate an authorization code after use.\n\n        We keep the temporary code in a grant, which has a `delete`\n        function to destroy itself.", "docstring_tokens": ["Invalidate", "an", "authorization", "code", "after", "use", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 253180}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/parsers.py#L68-L79", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return TypingStatusMessage from hangouts_pb2.SetTypingNotification.", "language": "python", "parameters": "(p)", "return_statement": "return TypingStatusMessage(\n        conv_id=p.conversation_id.id,\n        user_id=from_participantid(p.sender_id),\n        timestamp=from_timestamp(p.timestamp),\n        status=p.type,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "TypingStatusMessage", "(", "conv_id", "=", "arg_0", ".", "conversation_id", ".", "id", ",", "user_id", "=", "from_participantid", "(", "arg_0", ".", "sender_id", ")", ",", "timestamp", "=", "from_timestamp", "(", "arg_0", ".", "timestamp", ")", ",", "status", "=", "arg_0", ".", "type", ",", ")"], "function": "def Func(arg_0):\n    \"\"\"Return TypingStatusMessage from hangouts_pb2.SetTypingNotification.\n\n    The same status may be sent multiple times consecutively, and when a\n    message is sent the typing status will not change to stopped.\n    \"\"\"\n    return TypingStatusMessage(\n        conv_id=arg_0.conversation_id.id,\n        user_id=from_participantid(arg_0.sender_id),\n        timestamp=from_timestamp(arg_0.timestamp),\n        status=arg_0.type,\n    )", "path": "hangups/parsers.py", "identifier": "parse_typing_status_message", "docstring": "Return TypingStatusMessage from hangouts_pb2.SetTypingNotification.\n\n    The same status may be sent multiple times consecutively, and when a\n    message is sent the typing status will not change to stopped.", "docstring_tokens": ["Return", "TypingStatusMessage", "from", "hangouts_pb2", ".", "SetTypingNotification", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 253181}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L1293-L1309", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "make messages type report", "language": "python", "parameters": "(sect, stats, _)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", "[", "\"by_msg\"", "]", ":", "raise", "exceptions", ".", "EmptyReportError", "(", ")", "arg_3", "=", "sorted", "(", "[", "(", "arg_5", ",", "arg_6", ")", "for", "arg_6", ",", "arg_5", "in", "arg_1", "[", "\"by_msg\"", "]", ".", "items", "(", ")", "if", "not", "arg_6", ".", "startswith", "(", "\"I\"", ")", "]", ")", "arg_3", ".", "reverse", "(", ")", "arg_4", "=", "(", "\"message id\"", ",", "\"occurrences\"", ")", "for", "arg_5", ",", "arg_6", "in", "arg_3", ":", "arg_4", "+=", "(", "arg_6", ",", "str", "(", "arg_5", ")", ")", "arg_0", ".", "append", "(", "report_nodes", ".", "Table", "(", "children", "=", "arg_4", ",", "cols", "=", "2", ",", "rheaders", "=", "1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"make messages type report\"\"\"\n    if not arg_1[\"by_msg\"]:\n        # don't print this report when we didn't detected any errors\n        raise exceptions.EmptyReportError()\n    arg_3 = sorted(\n        [\n            (arg_5, arg_6)\n            for arg_6, arg_5 in arg_1[\"by_msg\"].items()\n            if not arg_6.startswith(\"I\")\n        ]\n    )\n    arg_3.reverse()\n    arg_4 = (\"message id\", \"occurrences\")\n    for arg_5, arg_6 in arg_3:\n        arg_4 += (arg_6, str(arg_5))\n    arg_0.append(report_nodes.Table(children=arg_4, cols=2, rheaders=1))", "path": "pylint/lint.py", "identifier": "report_messages_stats", "docstring": "make messages type report", "docstring_tokens": ["make", "messages", "type", "report"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253182}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L884-L891", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "use the GUI to ask YES or NO.", "language": "python", "parameters": "(title,msg)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tkinter", ".", "Tk", "(", ")", "arg_2", ".", "attributes", "(", "\"-topmost\"", ",", "True", ")", "arg_2", ".", "withdraw", "(", ")", "arg_3", "=", "tkinter", ".", "messagebox", ".", "askyesno", "(", "arg_0", ",", "arg_1", ")", "arg_2", ".", "destroy", "(", ")", "return", "arg_3"], "function": "def Func(arg_0,arg_1):\n    \"\"\"use the GUI to ask YES or NO.\"\"\"\n    arg_2 = tkinter.Tk()\n    arg_2.attributes(\"-topmost\", True) #always on top\n    arg_2.withdraw() #hide tk window\n    arg_3=tkinter.messagebox.askyesno(arg_0,arg_1)\n    arg_2.destroy()\n    return arg_3", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "TK_ask", "docstring": "use the GUI to ask YES or NO.", "docstring_tokens": ["use", "the", "GUI", "to", "ask", "YES", "or", "NO", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 253183}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/spia.py#L214-L226", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Export the graph to a SPIA Excel sheet.", "language": "python", "parameters": "(graph: BELGraph, xlsx: str, tsvs: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_3", ")", ":", "if", "not", "arg_2", "and", "not", "arg_4", ":", "click", ".", "secho", "(", "'Specify at least one option --xlsx or --tsvs'", ",", "fg", "=", "'red'", ")", "sys", ".", "exit", "(", "1", ")", "arg_5", "=", "bel_to_spia_matrices", "(", "arg_0", ")", "if", "arg_2", ":", "spia_matrices_to_excel", "(", "arg_5", ",", "arg_2", ")", "if", "arg_4", ":", "spia_matrices_to_tsvs", "(", "arg_5", ",", "arg_4", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_3):\n    \"\"\"Export the graph to a SPIA Excel sheet.\"\"\"\n    if not arg_2 and not arg_4:\n        click.secho('Specify at least one option --xlsx or --tsvs', fg='red')\n        sys.exit(1)\n\n    arg_5 = bel_to_spia_matrices(arg_0)\n\n    if arg_2:\n        spia_matrices_to_excel(arg_5, arg_2)\n\n    if arg_4:\n        spia_matrices_to_tsvs(arg_5, arg_4)", "path": "src/pybel_tools/analysis/spia.py", "identifier": "main", "docstring": "Export the graph to a SPIA Excel sheet.", "docstring_tokens": ["Export", "the", "graph", "to", "a", "SPIA", "Excel", "sheet", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253184}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball.py#L42-L69", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the R1 region, as defined in the Porter2 specification.", "language": "python", "parameters": "(self, term, r1_prefixes=None)", "return_statement": "return len(term)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "False", "if", "hasattr", "(", "arg_2", ",", "'__iter__'", ")", ":", "for", "arg_4", "in", "arg_2", ":", "if", "arg_1", "[", ":", "len", "(", "arg_4", ")", "]", "==", "arg_4", ":", "return", "len", "(", "arg_4", ")", "for", "arg_5", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "if", "not", "arg_3", "and", "arg_1", "[", "arg_5", "]", "in", "arg_0", ".", "_vowels", ":", "arg_3", "=", "True", "elif", "arg_3", "and", "arg_1", "[", "arg_5", "]", "not", "in", "arg_0", ".", "_vowels", ":", "return", "arg_5", "+", "1", "return", "len", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Return the R1 region, as defined in the Porter2 specification.\n\n        Parameters\n        ----------\n        term : str\n            The term to examine\n        r1_prefixes : set\n            Prefixes to consider\n\n        Returns\n        -------\n        int\n            Length of the R1 region\n\n        \"\"\"\n        arg_3 = False\n        if hasattr(arg_2, '__iter__'):\n            for arg_4 in arg_2:\n                if arg_1[: len(arg_4)] == arg_4:\n                    return len(arg_4)\n\n        for arg_5 in range(len(arg_1)):\n            if not arg_3 and arg_1[arg_5] in arg_0._vowels:\n                arg_3 = True\n            elif arg_3 and arg_1[arg_5] not in arg_0._vowels:\n                return arg_5 + 1\n        return len(arg_1)", "path": "abydos/stemmer/_snowball.py", "identifier": "_Snowball._sb_r1", "docstring": "Return the R1 region, as defined in the Porter2 specification.\n\n        Parameters\n        ----------\n        term : str\n            The term to examine\n        r1_prefixes : set\n            Prefixes to consider\n\n        Returns\n        -------\n        int\n            Length of the R1 region", "docstring_tokens": ["Return", "the", "R1", "region", "as", "defined", "in", "the", "Porter2", "specification", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253185}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L558-L592", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Read data synchronous from an ADS-device from data name.", "language": "python", "parameters": "(port, address, data_name, data_type, return_ctypes=False)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "adsSyncReadWriteReqEx2", "(", "arg_0", ",", "arg_1", ",", "ADSIGRP_SYM_HNDBYNAME", ",", "0x0", ",", "PLCTYPE_UDINT", ",", "arg_2", ",", "PLCTYPE_STRING", ",", ")", "arg_6", "=", "adsSyncReadReqEx2", "(", "arg_0", ",", "arg_1", ",", "ADSIGRP_SYM_VALBYHND", ",", "arg_5", ",", "arg_3", ",", "arg_4", ")", "adsSyncWriteReqEx", "(", "arg_0", ",", "arg_1", ",", "ADSIGRP_SYM_RELEASEHND", ",", "0", ",", "arg_5", ",", "PLCTYPE_UDINT", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):\n    # type: (int, AmsAddr, str, Type, bool) -> Any\n    \"\"\"Read data synchronous from an ADS-device from data name.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :param string data_name: data name\n    :param Type data_type: type of the data given to the PLC, according to\n        PLCTYPE constants\n    :param bool return_ctypes: return ctypes instead of python types if True\n        (default: False)\n    :rtype: data_type\n    :return: value: **value**\n\n    \"\"\"\n    # Get the handle of the PLC-variable\n    arg_5 = adsSyncReadWriteReqEx2(\n        arg_0,\n        arg_1,\n        ADSIGRP_SYM_HNDBYNAME,\n        0x0,\n        PLCTYPE_UDINT,\n        arg_2,\n        PLCTYPE_STRING,\n    )\n\n    # Read the value of a PLC-variable, via handle\n    arg_6 = adsSyncReadReqEx2(\n        arg_0, arg_1, ADSIGRP_SYM_VALBYHND, arg_5, arg_3, arg_4\n    )\n\n    # Release the handle of the PLC-variable\n    adsSyncWriteReqEx(arg_0, arg_1, ADSIGRP_SYM_RELEASEHND, 0, arg_5, PLCTYPE_UDINT)\n\n    return arg_6", "path": "pyads/pyads_ex.py", "identifier": "adsSyncReadByNameEx", "docstring": "Read data synchronous from an ADS-device from data name.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :param string data_name: data name\n    :param Type data_type: type of the data given to the PLC, according to\n        PLCTYPE constants\n    :param bool return_ctypes: return ctypes instead of python types if True\n        (default: False)\n    :rtype: data_type\n    :return: value: **value**", "docstring_tokens": ["Read", "data", "synchronous", "from", "an", "ADS", "-", "device", "from", "data", "name", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 253186}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/html_utils.py#L90-L95", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Return stripped HTML, keeping only MathML.", "language": "python", "parameters": "(cls, html)", "return_statement": "return escape_for_xml(unescaped_data, tags_to_keep=s.mathml_elements)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "(", ")", "arg_2", ".", "feed", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "unescape", "(", "arg_2", ".", "get_data", "(", ")", ")", "return", "escape_for_xml", "(", "arg_3", ",", "tags_to_keep", "=", "arg_2", ".", "mathml_elements", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return stripped HTML, keeping only MathML.\"\"\"\n        arg_2 = arg_0()\n        arg_2.feed(arg_1)\n        arg_3 = arg_2.unescape(arg_2.get_data())\n        return escape_for_xml(arg_3, tags_to_keep=arg_2.mathml_elements)", "path": "harvestingkit/html_utils.py", "identifier": "MathMLParser.html_to_text", "docstring": "Return stripped HTML, keeping only MathML.", "docstring_tokens": ["Return", "stripped", "HTML", "keeping", "only", "MathML", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253187}
{"url": "https://github.com/cartoonist/pystream-protobuf/blob/40e70b932436887b748905e5e0a82839e4c559f0/stream/stream.py#L165-L183", "sha": "40e70b932436887b748905e5e0a82839e4c559f0", "docstring_summary": "A generator yielding all protobuf object data in the file. It is the\n        main parser of the stream encoding.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "True", ":", "arg_1", "=", "arg_0", ".", "_read_varint", "(", ")", "if", "arg_1", "==", "0", ":", "break", "for", "arg_2", "in", "range", "(", "arg_1", ")", ":", "arg_3", "=", "arg_0", ".", "_read_varint", "(", ")", "if", "arg_3", "==", "0", ":", "raise", "EOFError", "(", "'unexpected EOF.'", ")", "yield", "arg_0", ".", "_fd", ".", "read", "(", "arg_3", ")", "if", "arg_0", ".", "_group_delim", ":", "yield", "arg_0", ".", "_delimiter", "(", ")", "if", "arg_0", ".", "_delimiter", "is", "not", "None", "else", "None"], "function": "def Func(arg_0):\n        \"\"\"A generator yielding all protobuf object data in the file. It is the\n        main parser of the stream encoding.\n        \"\"\"\n        while True:\n            arg_1 = arg_0._read_varint()\n            if arg_1 == 0:\n                break\n            # Read a group containing `count` number of objects.\n            for arg_2 in range(arg_1):\n                arg_3 = arg_0._read_varint()\n                if arg_3 == 0:\n                    raise EOFError('unexpected EOF.')\n                # Read an object from the object group.\n                yield arg_0._fd.read(arg_3)\n\n            if arg_0._group_delim:\n                yield arg_0._delimiter() if arg_0._delimiter is not None \\\n                                        else None", "path": "stream/stream.py", "identifier": "Stream._get_objs", "docstring": "A generator yielding all protobuf object data in the file. It is the\n        main parser of the stream encoding.", "docstring_tokens": ["A", "generator", "yielding", "all", "protobuf", "object", "data", "in", "the", "file", ".", "It", "is", "the", "main", "parser", "of", "the", "stream", "encoding", "."], "nwo": "cartoonist/pystream-protobuf", "score": 0.18892572326127263, "idx": 253188}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L742-L756", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Internal utility function for Unified Job Templates. Returns data about the last job run off of that UJT", "language": "python", "parameters": "(self, pk=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get", "(", "arg_1", ",", "include_debug_header", "=", "True", ",", "**", "arg_2", ")", "if", "'current_update'", "in", "arg_3", "[", "'related'", "]", ":", "debug", ".", "log", "(", "'A current job; retrieving it.'", ",", "header", "=", "'details'", ")", "return", "client", ".", "get", "(", "arg_3", "[", "'related'", "]", "[", "'current_update'", "]", "[", "7", ":", "]", ")", ".", "json", "(", ")", "elif", "arg_3", "[", "'related'", "]", ".", "get", "(", "'last_update'", ",", "None", ")", ":", "debug", ".", "log", "(", "'No current job or update exists; retrieving the most recent.'", ",", "header", "=", "'details'", ")", "return", "client", ".", "get", "(", "arg_3", "[", "'related'", "]", "[", "'last_update'", "]", "[", "7", ":", "]", ")", ".", "json", "(", ")", "else", ":", "raise", "exc", ".", "NotFound", "(", "'No related jobs or updates exist.'", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"\n        Internal utility function for Unified Job Templates. Returns data about the last job run off of that UJT\n        \"\"\"\n        arg_3 = arg_0.get(arg_1, include_debug_header=True, **arg_2)\n\n        # Determine the appropriate inventory source update.\n        if 'current_update' in arg_3['related']:\n            debug.log('A current job; retrieving it.', header='details')\n            return client.get(arg_3['related']['current_update'][7:]).json()\n        elif arg_3['related'].get('last_update', None):\n            debug.log('No current job or update exists; retrieving the most recent.', header='details')\n            return client.get(arg_3['related']['last_update'][7:]).json()\n        else:\n            raise exc.NotFound('No related jobs or updates exist.')", "path": "tower_cli/models/base.py", "identifier": "MonitorableResource.last_job_data", "docstring": "Internal utility function for Unified Job Templates. Returns data about the last job run off of that UJT", "docstring_tokens": ["Internal", "utility", "function", "for", "Unified", "Job", "Templates", ".", "Returns", "data", "about", "the", "last", "job", "run", "off", "of", "that", "UJT"], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 253189}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/legecy_translators/jsparser.py#L176-L184", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "Token can be only a single char. Returns position after token if found. Otherwise raises syntax error if throw\n    otherwise returns None", "language": "python", "parameters": "(source, start, token, throw=True)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "arg_1", "=", "pass_white", "(", "arg_0", ",", "arg_1", ")", "if", "arg_1", "<", "len", "(", "arg_0", ")", "and", "arg_0", "[", "arg_1", "]", "==", "arg_2", ":", "return", "arg_1", "+", "1", "if", "arg_3", ":", "raise", "SyntaxError", "(", "'Missing token. Expected %s'", "%", "arg_2", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n    \"\"\"Token can be only a single char. Returns position after token if found. Otherwise raises syntax error if throw\n    otherwise returns None\"\"\"\n    arg_1 = pass_white(arg_0, arg_1)\n    if arg_1 < len(arg_0) and arg_0[arg_1] == arg_2:\n        return arg_1 + 1\n    if arg_3:\n        raise SyntaxError('Missing token. Expected %s' % arg_2)\n    return None", "path": "js2py/legecy_translators/jsparser.py", "identifier": "except_token", "docstring": "Token can be only a single char. Returns position after token if found. Otherwise raises syntax error if throw\n    otherwise returns None", "docstring_tokens": ["Token", "can", "be", "only", "a", "single", "char", ".", "Returns", "position", "after", "token", "if", "found", ".", "Otherwise", "raises", "syntax", "error", "if", "throw", "otherwise", "returns", "None"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 253190}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2677-L2707", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Load a public key from a buffer.", "language": "python", "parameters": "(type, buffer)", "return_statement": "return pkey", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "_text_type", ")", ":", "arg_1", "=", "arg_1", ".", "encode", "(", "\"ascii\"", ")", "arg_2", "=", "_new_mem_buf", "(", "arg_1", ")", "if", "arg_0", "==", "FILETYPE_PEM", ":", "arg_3", "=", "_lib", ".", "PEM_read_bio_PUBKEY", "(", "arg_2", ",", "_ffi", ".", "NULL", ",", "_ffi", ".", "NULL", ",", "_ffi", ".", "NULL", ")", "elif", "arg_0", "==", "FILETYPE_ASN1", ":", "arg_3", "=", "_lib", ".", "d2i_PUBKEY_bio", "(", "arg_2", ",", "_ffi", ".", "NULL", ")", "else", ":", "raise", "ValueError", "(", "\"type argument must be FILETYPE_PEM or FILETYPE_ASN1\"", ")", "if", "arg_3", "==", "_ffi", ".", "NULL", ":", "_raise_current_error", "(", ")", "arg_4", "=", "PKey", ".", "__new__", "(", "PKey", ")", "arg_4", ".", "_pkey", "=", "_ffi", ".", "gc", "(", "arg_3", ",", "_lib", ".", "EVP_PKEY_free", ")", "arg_4", ".", "_only_public", "=", "True", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Load a public key from a buffer.\n\n    :param type: The file type (one of :data:`FILETYPE_PEM`,\n        :data:`FILETYPE_ASN1`).\n    :param buffer: The buffer the key is stored in.\n    :type buffer: A Python string object, either unicode or bytestring.\n    :return: The PKey object.\n    :rtype: :class:`PKey`\n    \"\"\"\n    if isinstance(arg_1, _text_type):\n        arg_1 = arg_1.encode(\"ascii\")\n\n    arg_2 = _new_mem_buf(arg_1)\n\n    if arg_0 == FILETYPE_PEM:\n        arg_3 = _lib.PEM_read_bio_PUBKEY(\n            arg_2, _ffi.NULL, _ffi.NULL, _ffi.NULL)\n    elif arg_0 == FILETYPE_ASN1:\n        arg_3 = _lib.d2i_PUBKEY_bio(arg_2, _ffi.NULL)\n    else:\n        raise ValueError(\"type argument must be FILETYPE_PEM or FILETYPE_ASN1\")\n\n    if arg_3 == _ffi.NULL:\n        _raise_current_error()\n\n    arg_4 = PKey.__new__(PKey)\n    arg_4._pkey = _ffi.gc(arg_3, _lib.EVP_PKEY_free)\n    arg_4._only_public = True\n    return arg_4", "path": "src/OpenSSL/crypto.py", "identifier": "load_publickey", "docstring": "Load a public key from a buffer.\n\n    :param type: The file type (one of :data:`FILETYPE_PEM`,\n        :data:`FILETYPE_ASN1`).\n    :param buffer: The buffer the key is stored in.\n    :type buffer: A Python string object, either unicode or bytestring.\n    :return: The PKey object.\n    :rtype: :class:`PKey`", "docstring_tokens": ["Load", "a", "public", "key", "from", "a", "buffer", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 253191}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L660-L665", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "List all events occurring at or after a timestamp.", "language": "python", "parameters": "(self, sync_all_new_events_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "SyncAllNewEventsResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'conversations/syncallnewevents'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"List all events occurring at or after a timestamp.\"\"\"\n        arg_2 = hangouts_pb2.SyncAllNewEventsResponse()\n        await arg_0._pb_request('conversations/syncallnewevents',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.sync_all_new_events", "docstring": "List all events occurring at or after a timestamp.", "docstring_tokens": ["List", "all", "events", "occurring", "at", "or", "after", "a", "timestamp", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 253192}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L262-L274", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Print a stack trace from its invocation point.", "language": "python", "parameters": "(f=None, limit=None, file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "try", ":", "raise", "ZeroDivisionError", "except", "ZeroDivisionError", ":", "arg_0", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ".", "tb_frame", ".", "f_back", "print_list", "(", "extract_stack", "(", "arg_0", ",", "arg_1", ")", ",", "arg_2", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None):\n    \"\"\"Print a stack trace from its invocation point.\n\n    The optional 'f' argument can be used to specify an alternate\n    stack frame at which to start. The optional 'limit' and 'file'\n    arguments have the same meaning as for print_exception().\n    \"\"\"\n    if arg_0 is None:\n        try:\n            raise ZeroDivisionError\n        except ZeroDivisionError:\n            arg_0 = sys.exc_info()[2].tb_frame.f_back\n    print_list(extract_stack(arg_0, arg_1), arg_2)", "path": "third_party/stdlib/traceback.py", "identifier": "print_stack", "docstring": "Print a stack trace from its invocation point.\n\n    The optional 'f' argument can be used to specify an alternate\n    stack frame at which to start. The optional 'limit' and 'file'\n    arguments have the same meaning as for print_exception().", "docstring_tokens": ["Print", "a", "stack", "trace", "from", "its", "invocation", "point", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 253193}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1397-L1454", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check that the argument to `reversed` is a sequence", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "utils", ".", "safe_infer", "(", "utils", ".", "get_argument_from_call", "(", "arg_1", ",", "position", "=", "0", ")", ")", "except", "utils", ".", "NoSuchArgumentError", ":", "pass", "else", ":", "if", "arg_2", "is", "astroid", ".", "Uninferable", ":", "return", "if", "arg_2", "is", "None", ":", "if", "isinstance", "(", "arg_1", ".", "args", "[", "0", "]", ",", "astroid", ".", "Call", ")", ":", "try", ":", "arg_3", "=", "next", "(", "arg_1", ".", "args", "[", "0", "]", ".", "func", ".", "infer", "(", ")", ")", "except", "astroid", ".", "InferenceError", ":", "return", "if", "getattr", "(", "arg_3", ",", "\"name\"", ",", "None", ")", "==", "\"iter\"", "and", "utils", ".", "is_builtin_object", "(", "arg_3", ")", ":", "arg_0", ".", "add_message", "(", "\"bad-reversed-sequence\"", ",", "arg_1", "=", "arg_1", ")", "return", "if", "isinstance", "(", "arg_2", ",", "(", "astroid", ".", "List", ",", "astroid", ".", "Tuple", ")", ")", ":", "return", "if", "isinstance", "(", "arg_2", ",", "astroid", ".", "Instance", ")", ":", "if", "arg_2", ".", "_proxied", ".", "name", "==", "\"dict\"", "and", "utils", ".", "is_builtin_object", "(", "arg_2", ".", "_proxied", ")", ":", "arg_0", ".", "add_message", "(", "\"bad-reversed-sequence\"", ",", "arg_1", "=", "arg_1", ")", "return", "if", "any", "(", "arg_4", ".", "name", "==", "\"dict\"", "and", "utils", ".", "is_builtin_object", "(", "arg_4", ")", "for", "arg_4", "in", "arg_2", ".", "_proxied", ".", "ancestors", "(", ")", ")", ":", "try", ":", "arg_2", ".", "locals", "[", "REVERSED_PROTOCOL_METHOD", "]", "except", "KeyError", ":", "arg_0", ".", "add_message", "(", "\"bad-reversed-sequence\"", ",", "arg_1", "=", "arg_1", ")", "return", "if", "hasattr", "(", "arg_2", ",", "\"getattr\"", ")", ":", "for", "arg_5", "in", "REVERSED_METHODS", ":", "for", "meth", "in", "arg_5", ":", "try", ":", "arg_2", ".", "getattr", "(", "meth", ")", "except", "astroid", ".", "NotFoundError", ":", "break", "else", ":", "break", "else", ":", "arg_0", ".", "add_message", "(", "\"bad-reversed-sequence\"", ",", "arg_1", "=", "arg_1", ")", "else", ":", "arg_0", ".", "add_message", "(", "\"bad-reversed-sequence\"", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" check that the argument to `reversed` is a sequence \"\"\"\n        try:\n            arg_2 = utils.safe_infer(utils.get_argument_from_call(arg_1, position=0))\n        except utils.NoSuchArgumentError:\n            pass\n        else:\n            if arg_2 is astroid.Uninferable:\n                return\n            if arg_2 is None:\n                # Nothing was infered.\n                # Try to see if we have iter().\n                if isinstance(arg_1.args[0], astroid.Call):\n                    try:\n                        arg_3 = next(arg_1.args[0].func.infer())\n                    except astroid.InferenceError:\n                        return\n                    if getattr(\n                        arg_3, \"name\", None\n                    ) == \"iter\" and utils.is_builtin_object(arg_3):\n                        arg_0.add_message(\"bad-reversed-sequence\", arg_1=arg_1)\n                return\n\n            if isinstance(arg_2, (astroid.List, astroid.Tuple)):\n                return\n\n            if isinstance(arg_2, astroid.Instance):\n                if arg_2._proxied.name == \"dict\" and utils.is_builtin_object(\n                    arg_2._proxied\n                ):\n                    arg_0.add_message(\"bad-reversed-sequence\", arg_1=arg_1)\n                    return\n                if any(\n                    arg_4.name == \"dict\" and utils.is_builtin_object(arg_4)\n                    for arg_4 in arg_2._proxied.ancestors()\n                ):\n                    # Mappings aren't accepted by reversed(), unless\n                    # they provide explicitly a __reversed__ method.\n                    try:\n                        arg_2.locals[REVERSED_PROTOCOL_METHOD]\n                    except KeyError:\n                        arg_0.add_message(\"bad-reversed-sequence\", arg_1=arg_1)\n                    return\n\n            if hasattr(arg_2, \"getattr\"):\n                # everything else is not a proper sequence for reversed()\n                for arg_5 in REVERSED_METHODS:\n                    for meth in arg_5:\n                        try:\n                            arg_2.getattr(meth)\n                        except astroid.NotFoundError:\n                            break\n                    else:\n                        break\n                else:\n                    arg_0.add_message(\"bad-reversed-sequence\", arg_1=arg_1)\n            else:\n                arg_0.add_message(\"bad-reversed-sequence\", arg_1=arg_1)", "path": "pylint/checkers/base.py", "identifier": "BasicChecker._check_reversed", "docstring": "check that the argument to `reversed` is a sequence", "docstring_tokens": ["check", "that", "the", "argument", "to", "reversed", "is", "a", "sequence"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253194}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L396-L413", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Build destination URL.", "language": "python", "parameters": "(self, url=None, parameters=None)", "return_statement": "return uri", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_1", "or", "arg_0", ".", "_settings", "[", "\"url\"", "]", "if", "arg_1", "and", "arg_0", ".", "_settings", "[", "\"baseFunc\"", "]", ":", "arg_3", "=", "\"%s/%s\"", "%", "(", "arg_0", ".", "_settings", "[", "\"baseFunc\"", "]", ",", "arg_1", ")", "arg_3", "+=", "\".json\"", "if", "arg_2", ":", "arg_3", "+=", "\"?%s\"", "%", "urllib", ".", "urlencode", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\" Build destination URL.\n\n        Kwargs:\n            url (str): Destination URL\n            parameters (dict): Additional GET parameters to append to the URL\n\n        Returns:\n            str. URL \n        \"\"\"\n\n        arg_3 = arg_1 or arg_0._settings[\"url\"]\n        if arg_1 and arg_0._settings[\"baseFunc\"]:\n            arg_3 = \"%s/%s\" % (arg_0._settings[\"baseFunc\"], arg_1)\n        arg_3 += \".json\"\n        if arg_2:\n            arg_3 += \"?%s\" % urllib.urlencode(arg_2)\n        return arg_3", "path": "pyfire/connection.py", "identifier": "Connection._url", "docstring": "Build destination URL.\n\n        Kwargs:\n            url (str): Destination URL\n            parameters (dict): Additional GET parameters to append to the URL\n\n        Returns:\n            str. URL", "docstring_tokens": ["Build", "destination", "URL", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 253195}
{"url": "https://github.com/mohabusama/pyguacamole/blob/344dccc6cb3a9a045afeaf337677e5d0001aa83a/guacamole/client.py#L91-L115", "sha": "344dccc6cb3a9a045afeaf337677e5d0001aa83a", "docstring_summary": "Receive instructions from Guacamole guacd server.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "while", "True", ":", "arg_2", "=", "arg_0", ".", "_buffer", ".", "find", "(", "INST_TERM", ".", "encode", "(", ")", ",", "arg_1", ")", "if", "arg_2", "!=", "-", "1", ":", "arg_3", "=", "arg_0", ".", "_buffer", "[", ":", "arg_2", "+", "1", "]", ".", "decode", "(", ")", "arg_0", ".", "_buffer", "=", "arg_0", ".", "_buffer", "[", "arg_2", "+", "1", ":", "]", "arg_0", ".", "logger", ".", "debug", "(", "'Received instruction: %s'", "%", "arg_3", ")", "return", "arg_3", "else", ":", "arg_1", "=", "len", "(", "arg_0", ".", "_buffer", ")", "arg_5", "=", "arg_0", ".", "client", ".", "recv", "(", "BUF_LEN", ")", "if", "not", "arg_5", ":", "arg_0", ".", "close", "(", ")", "arg_0", ".", "logger", ".", "debug", "(", "'Failed to Func instruction. Closing.'", ")", "return", "None", "arg_0", ".", "_buffer", ".", "extend", "(", "arg_5", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Receive instructions from Guacamole guacd server.\n        \"\"\"\n        arg_1 = 0\n\n        while True:\n            arg_2 = arg_0._buffer.find(INST_TERM.encode(), arg_1)\n            if arg_2 != -1:\n                # instruction was fully Funcd!\n                arg_3 = arg_0._buffer[:arg_2 + 1].decode()\n                arg_0._buffer = arg_0._buffer[arg_2 + 1:]\n                arg_0.logger.debug('Received instruction: %s' % arg_3)\n                return arg_3\n            else:\n                arg_1 = len(arg_0._buffer)\n                # we are still waiting for instruction termination\n                arg_5 = arg_0.client.recv(BUF_LEN)\n                if not arg_5:\n                    # No data recieved, connection lost?!\n                    arg_0.close()\n                    arg_0.logger.debug(\n                        'Failed to Func instruction. Closing.')\n                    return None\n                arg_0._buffer.extend(arg_5)", "path": "guacamole/client.py", "identifier": "GuacamoleClient.receive", "docstring": "Receive instructions from Guacamole guacd server.", "docstring_tokens": ["Receive", "instructions", "from", "Guacamole", "guacd", "server", "."], "nwo": "mohabusama/pyguacamole", "score": 0.4506581328729369, "idx": 253196}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/select.py#L268-L311", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Select all the faces and vertexes within the specified vertex quality\n        range.", "language": "python", "parameters": "(script, min_quality=0.0, max_quality=0.05, inclusive=True)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.0", ",", "arg_2", "=", "0.05", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Select by Vertex Quality\">\\n'", ",", "'    <Param name=\"minQ\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_1", ")", ",", "'description=\"Min Quality\" '", ",", "'min=\"0\" '", ",", "'max=\"{}\" '", ".", "format", "(", "2", "*", "arg_2", ")", ",", "'type=\"RichDynamicFloat\" '", ",", "'/>\\n'", ",", "'    <Param name=\"maxQ\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_2", ")", ",", "'description=\"Max Quality\" '", ",", "'min=\"0\" '", ",", "'max=\"{}\" '", ".", "format", "(", "2", "*", "arg_2", ")", ",", "'type=\"RichDynamicFloat\" '", ",", "'/>\\n'", ",", "'    <Param name=\"Inclusive\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_3", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Inclusive Sel.\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_4", ")", "return", "None"], "function": "def Func(arg_0, arg_1=0.0, arg_2=0.05, arg_3=True):\n    \"\"\" Select all the faces and vertexes within the specified vertex quality\n        range.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter] to.\n        min_quality (float): Minimum acceptable quality value.\n        max_quality (float): Maximum acceptable quality value.\n        inclusive (bool): If True only the faces with ALL the vertices within\n            the specified range are selected. Otherwise any face with at least\n            one vertex within the range is selected.\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    arg_4 = ''.join([\n        '  <filter name=\"Select by Vertex Quality\">\\n',\n        '    <Param name=\"minQ\" ',\n        'value=\"{}\" '.format(arg_1),\n        'description=\"Min Quality\" ',\n        'min=\"0\" ',\n        'max=\"{}\" '.format(2 * arg_2),\n        'type=\"RichDynamicFloat\" ',\n        '/>\\n',\n        '    <Param name=\"maxQ\" ',\n        'value=\"{}\" '.format(arg_2),\n        'description=\"Max Quality\" ',\n        'min=\"0\" ',\n        'max=\"{}\" '.format(2 * arg_2),\n        'type=\"RichDynamicFloat\" ',\n        '/>\\n',\n        '    <Param name=\"Inclusive\" ',\n        'value=\"{}\" '.format(str(arg_3).lower()),\n        'description=\"Inclusive Sel.\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_4)\n    return None", "path": "meshlabxml/select.py", "identifier": "vert_quality", "docstring": "Select all the faces and vertexes within the specified vertex quality\n        range.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter] to.\n        min_quality (float): Minimum acceptable quality value.\n        max_quality (float): Maximum acceptable quality value.\n        inclusive (bool): If True only the faces with ALL the vertices within\n            the specified range are selected. Otherwise any face with at least\n            one vertex within the range is selected.\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Select", "all", "the", "faces", "and", "vertexes", "within", "the", "specified", "vertex", "quality", "range", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 253197}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/layers/initializers.py#L106-L116", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns initializer configuration as a JSON-serializable dict.", "language": "python", "parameters": "(self)", "return_statement": "return {\n        'initializers': [\n            tf.compat.v2.initializers.serialize(\n                tf.keras.initializers.get(init))\n            for init in self.initializers\n        ],\n        'sizes': self.sizes,\n        'validate_args': self.validate_args,\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "'initializers'", ":", "[", "tf", ".", "compat", ".", "v2", ".", "initializers", ".", "serialize", "(", "tf", ".", "keras", ".", "initializers", ".", "get", "(", "arg_1", ")", ")", "for", "arg_1", "in", "arg_0", ".", "initializers", "]", ",", "'sizes'", ":", "arg_0", ".", "sizes", ",", "'validate_args'", ":", "arg_0", ".", "validate_args", ",", "}"], "function": "def Func(arg_0):\n    \"\"\"Returns initializer configuration as a JSON-serializable dict.\"\"\"\n    return {\n        'initializers': [\n            tf.compat.v2.initializers.serialize(\n                tf.keras.initializers.get(arg_1))\n            for arg_1 in arg_0.initializers\n        ],\n        'sizes': arg_0.sizes,\n        'validate_args': arg_0.validate_args,\n    }", "path": "tensorflow_probability/python/layers/initializers.py", "identifier": "BlockwiseInitializer.get_config", "docstring": "Returns initializer configuration as a JSON-serializable dict.", "docstring_tokens": ["Returns", "initializer", "configuration", "as", "a", "JSON", "-", "serializable", "dict", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253198}
{"url": "https://github.com/amorison/loam/blob/a566c943a75e068a4510099331a1ddfe5bbbdd94/loam/cli.py#L141-L154", "sha": "a566c943a75e068a4510099331a1ddfe5bbbdd94", "docstring_summary": "Add options to a parser.", "language": "python", "parameters": "(self, opts_dict, parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "(", "'store_true'", ",", "'store_false'", ")", "for", "arg_4", ",", "arg_5", "in", "arg_1", ".", "items", "(", ")", ":", "arg_6", "=", "arg_0", ".", "_conf", "[", "arg_5", "]", ".", "def_", "[", "arg_4", "]", "arg_7", "=", "copy", ".", "deepcopy", "(", "arg_6", ".", "cmd_kwargs", ")", "arg_8", "=", "arg_7", ".", "get", "(", "'action'", ")", "if", "arg_8", "is", "internal", ".", "Switch", ":", "arg_7", ".", "update", "(", "nargs", "=", "0", ")", "elif", "arg_6", ".", "default", "is", "not", "None", "and", "arg_8", "not", "in", "arg_3", ":", "arg_7", ".", "setdefault", "(", "'type'", ",", "type", "(", "arg_6", ".", "default", ")", ")", "arg_7", ".", "update", "(", "help", "=", "arg_6", ".", "help", ")", "arg_7", ".", "setdefault", "(", "'default'", ",", "arg_0", ".", "_conf", "[", "arg_5", "]", "[", "arg_4", "]", ")", "arg_2", ".", "add_argument", "(", "*", "_names", "(", "arg_0", ".", "_conf", "[", "arg_5", "]", ",", "arg_4", ")", ",", "**", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add options to a parser.\"\"\"\n        arg_3 = ('store_true', 'store_false')\n        for arg_4, arg_5 in arg_1.items():\n            arg_6 = arg_0._conf[arg_5].def_[arg_4]\n            arg_7 = copy.deepcopy(arg_6.cmd_kwargs)\n            arg_8 = arg_7.get('action')\n            if arg_8 is internal.Switch:\n                arg_7.update(nargs=0)\n            elif arg_6.default is not None and arg_8 not in arg_3:\n                arg_7.setdefault('type', type(arg_6.default))\n            arg_7.update(help=arg_6.help)\n            arg_7.setdefault('default', arg_0._conf[arg_5][arg_4])\n            arg_2.add_argument(*_names(arg_0._conf[arg_5], arg_4), **arg_7)", "path": "loam/cli.py", "identifier": "CLIManager._add_options_to_parser", "docstring": "Add options to a parser.", "docstring_tokens": ["Add", "options", "to", "a", "parser", "."], "nwo": "amorison/loam", "score": 0.14991498758945482, "idx": 253199}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/instruction.py#L268-L279", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a default OpenQASM string for the instruction.", "language": "python", "parameters": "(self)", "return_statement": "return self._qasmif(name_param)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "name", "if", "arg_0", ".", "params", ":", "arg_1", "=", "\"%s(%s)\"", "%", "(", "arg_1", ",", "\",\"", ".", "join", "(", "[", "str", "(", "i", ")", "for", "i", "in", "arg_0", ".", "params", "]", ")", ")", "return", "arg_0", ".", "_Funcif", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Return a default OpenQASM string for the instruction.\n\n        Derived instructions may override this to print in a\n        different format (e.g. measure q[0] -> c[0];).\n        \"\"\"\n        arg_1 = arg_0.name\n        if arg_0.params:\n            arg_1 = \"%s(%s)\" % (arg_1, \",\".join(\n                [str(i) for i in arg_0.params]))\n\n        return arg_0._Funcif(arg_1)", "path": "qiskit/circuit/instruction.py", "identifier": "Instruction.qasm", "docstring": "Return a default OpenQASM string for the instruction.\n\n        Derived instructions may override this to print in a\n        different format (e.g. measure q[0] -> c[0];).", "docstring_tokens": ["Return", "a", "default", "OpenQASM", "string", "for", "the", "instruction", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253200}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L1163-L1190", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Adds ``N`` interpolated points with uniform spacing to each edge.", "language": "python", "parameters": "(self, points_per_edge)", "return_statement": "return self.deepcopy(coords=coords)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_0", ".", "coords", ")", "<=", "1", "or", "arg_1", "<", "1", ":", "return", "arg_0", ".", "deepcopy", "(", ")", "arg_2", "=", "interpolate_points", "(", "arg_0", ".", "coords", ",", "nb_steps", "=", "arg_1", ",", "closed", "=", "False", ")", "return", "arg_0", ".", "deepcopy", "(", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adds ``N`` interpolated points with uniform spacing to each edge.\n\n        For each edge between points ``A`` and ``B`` this adds points\n        at ``A + (i/(1+N)) * (B - A)``, where ``i`` is the index of the added\n        point and ``N`` is the number of points to add per edge.\n\n        Calling this method two times will split each edge at its center\n        and then again split each newly created edge at their center.\n        It is equivalent to calling `Func(3)`.\n\n        Parameters\n        ----------\n        points_per_edge : int\n            Number of points to interpolate on each edge.\n\n        Returns\n        -------\n        LineString\n            Line string with Funcd edges.\n\n        \"\"\"\n        if len(arg_0.coords) <= 1 or arg_1 < 1:\n            return arg_0.deepcopy()\n        arg_2 = interpolate_points(arg_0.coords, nb_steps=arg_1,\n                                    closed=False)\n        return arg_0.deepcopy(arg_2=arg_2)", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.subdivide", "docstring": "Adds ``N`` interpolated points with uniform spacing to each edge.\n\n        For each edge between points ``A`` and ``B`` this adds points\n        at ``A + (i/(1+N)) * (B - A)``, where ``i`` is the index of the added\n        point and ``N`` is the number of points to add per edge.\n\n        Calling this method two times will split each edge at its center\n        and then again split each newly created edge at their center.\n        It is equivalent to calling `subdivide(3)`.\n\n        Parameters\n        ----------\n        points_per_edge : int\n            Number of points to interpolate on each edge.\n\n        Returns\n        -------\n        LineString\n            Line string with subdivided edges.", "docstring_tokens": ["Adds", "N", "interpolated", "points", "with", "uniform", "spacing", "to", "each", "edge", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 253201}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/format.py#L150-L163", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns a list of the names of the dimensions that will be lost\n    when converting from point_fmt_in to point_fmt_out", "language": "python", "parameters": "(point_fmt_in, point_fmt_out)", "return_statement": "return completely_lost", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "PointFormat", "(", "arg_0", ")", ".", "dtype", "arg_3", "=", "PointFormat", "(", "arg_1", ")", ".", "dtype", "arg_4", "=", "arg_3", ".", "fields", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_2", ".", "names", ":", "if", "arg_6", "not", "in", "arg_4", ":", "arg_5", ".", "append", "(", "arg_6", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n    \"\"\"  Returns a list of the names of the dimensions that will be lost\n    when converting from point_fmt_in to point_fmt_out\n    \"\"\"\n\n    arg_2 = PointFormat(arg_0).dtype\n    arg_3 = PointFormat(arg_1).dtype\n\n    arg_4 = arg_3.fields\n    arg_5 = []\n    for arg_6 in arg_2.names:\n        if arg_6 not in arg_4:\n            arg_5.append(arg_6)\n    return arg_5", "path": "pylas/point/format.py", "identifier": "lost_dimensions", "docstring": "Returns a list of the names of the dimensions that will be lost\n    when converting from point_fmt_in to point_fmt_out", "docstring_tokens": ["Returns", "a", "list", "of", "the", "names", "of", "the", "dimensions", "that", "will", "be", "lost", "when", "converting", "from", "point_fmt_in", "to", "point_fmt_out"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 253202}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/crypto/engine.py#L792-L880", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Encrypt data using asymmetric decryption.", "language": "python", "parameters": "(\n            self,\n            decryption_algorithm,\n            decryption_key,\n            cipher_text,\n            padding_method,\n            hashing_algorithm=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ")", ":", "if", "arg_1", "==", "enums", ".", "CryptographicAlgorithm", ".", "RSA", ":", "if", "arg_4", "==", "enums", ".", "PaddingMethod", ".", "OAEP", ":", "arg_6", "=", "arg_0", ".", "_encryption_hash_algorithms", ".", "get", "(", "arg_5", ")", "if", "arg_6", "is", "None", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The hashing algorithm '{0}' is not supported for \"", "\"asymmetric decryption.\"", ".", "format", "(", "arg_5", ")", ")", "arg_4", "=", "asymmetric_padding", ".", "OAEP", "(", "mgf", "=", "asymmetric_padding", ".", "MGF1", "(", "algorithm", "=", "arg_6", "(", ")", ")", ",", "algorithm", "=", "arg_6", "(", ")", ",", "label", "=", "None", ")", "elif", "arg_4", "==", "enums", ".", "PaddingMethod", ".", "PKCS1v15", ":", "arg_4", "=", "asymmetric_padding", ".", "PKCS1v15", "(", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The padding method '{0}' is not supported for asymmetric \"", "\"decryption.\"", ".", "format", "(", "arg_4", ")", ")", "arg_7", "=", "default_backend", "(", ")", "try", ":", "arg_8", "=", "arg_7", ".", "load_der_private_key", "(", "arg_2", ",", "None", ")", "except", "Exception", ":", "try", ":", "arg_8", "=", "arg_7", ".", "load_pem_private_key", "(", "arg_2", ",", "None", ")", "except", "Exception", ":", "raise", "exceptions", ".", "CryptographicFailure", "(", "\"The private key bytes could not be loaded.\"", ")", "arg_9", "=", "arg_8", ".", "decrypt", "(", "arg_3", ",", "arg_4", ")", "return", "arg_9", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The cryptographic algorithm '{0}' is not supported for \"", "\"asymmetric decryption.\"", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(\n            arg_0,\n            arg_1,\n            arg_2,\n            arg_3,\n            arg_4,\n            arg_5=None):\n        \"\"\"\n        Encrypt data using asymmetric decryption.\n\n        Args:\n            decryption_algorithm (CryptographicAlgorithm): An enumeration\n                specifying the asymmetric decryption algorithm to use for\n                decryption. Required.\n            decryption_key (bytes): The bytes of the private key to use for\n                decryption. Required.\n            cipher_text (bytes): The bytes to be decrypted. Required.\n            padding_method (PaddingMethod): An enumeration specifying the\n                padding method to use with the asymmetric decryption\n                algorithm. Required.\n            hashing_algorithm (HashingAlgorithm): An enumeration specifying\n                the hashing algorithm to use with the decryption padding\n                method. Required, if the padding method is OAEP. Optional\n                otherwise, defaults to None.\n\n        Returns:\n            dict: A dictionary containing the decrypted data, with at least\n                the following key/value field:\n                * plain_text - the bytes of the decrypted data\n\n        Raises:\n            InvalidField: Raised when the algorithm is unsupported or the\n                length is incompatible with the algorithm.\n            CryptographicFailure: Raised when the key generation process\n                fails.\n        \"\"\"\n        if arg_1 == enums.CryptographicAlgorithm.RSA:\n            if arg_4 == enums.PaddingMethod.OAEP:\n                arg_6 = arg_0._encryption_hash_algorithms.get(\n                    arg_5\n                )\n                if arg_6 is None:\n                    raise exceptions.InvalidField(\n                        \"The hashing algorithm '{0}' is not supported for \"\n                        \"asymmetric decryption.\".format(arg_5)\n                    )\n\n                arg_4 = asymmetric_padding.OAEP(\n                    mgf=asymmetric_padding.MGF1(\n                        algorithm=arg_6()\n                    ),\n                    algorithm=arg_6(),\n                    label=None\n                )\n            elif arg_4 == enums.PaddingMethod.PKCS1v15:\n                arg_4 = asymmetric_padding.PKCS1v15()\n            else:\n                raise exceptions.InvalidField(\n                    \"The padding method '{0}' is not supported for asymmetric \"\n                    \"decryption.\".format(arg_4)\n                )\n\n            arg_7 = default_backend()\n\n            try:\n                arg_8 = arg_7.load_der_private_key(\n                    arg_2,\n                    None\n                )\n            except Exception:\n                try:\n                    arg_8 = arg_7.load_pem_private_key(\n                        arg_2,\n                        None\n                    )\n                except Exception:\n                    raise exceptions.CryptographicFailure(\n                        \"The private key bytes could not be loaded.\"\n                    )\n            arg_9 = arg_8.decrypt(\n                arg_3,\n                arg_4\n            )\n            return arg_9\n        else:\n            raise exceptions.InvalidField(\n                \"The cryptographic algorithm '{0}' is not supported for \"\n                \"asymmetric decryption.\".format(arg_1)\n            )", "path": "kmip/services/server/crypto/engine.py", "identifier": "CryptographyEngine._decrypt_asymmetric", "docstring": "Encrypt data using asymmetric decryption.\n\n        Args:\n            decryption_algorithm (CryptographicAlgorithm): An enumeration\n                specifying the asymmetric decryption algorithm to use for\n                decryption. Required.\n            decryption_key (bytes): The bytes of the private key to use for\n                decryption. Required.\n            cipher_text (bytes): The bytes to be decrypted. Required.\n            padding_method (PaddingMethod): An enumeration specifying the\n                padding method to use with the asymmetric decryption\n                algorithm. Required.\n            hashing_algorithm (HashingAlgorithm): An enumeration specifying\n                the hashing algorithm to use with the decryption padding\n                method. Required, if the padding method is OAEP. Optional\n                otherwise, defaults to None.\n\n        Returns:\n            dict: A dictionary containing the decrypted data, with at least\n                the following key/value field:\n                * plain_text - the bytes of the decrypted data\n\n        Raises:\n            InvalidField: Raised when the algorithm is unsupported or the\n                length is incompatible with the algorithm.\n            CryptographicFailure: Raised when the key generation process\n                fails.", "docstring_tokens": ["Encrypt", "data", "using", "asymmetric", "decryption", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 253203}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L65-L94", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Generate a coincidence matrix. This is used to generate random inputs to the\n  temporal learner and to compare the predicted output against.", "language": "python", "parameters": "(nCoinc=10, length=500, activity=50)", "return_statement": "return coincMatrix0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "10", ",", "arg_1", "=", "500", ",", "arg_2", "=", "50", ")", ":", "arg_3", "=", "SM32", "(", "int", "(", "arg_0", ")", ",", "int", "(", "arg_1", ")", ")", "arg_4", "=", "numpy", ".", "array", "(", "[", "1.0", "]", "*", "arg_2", ",", "dtype", "=", "numpy", ".", "float32", ")", "for", "arg_5", "in", "xrange", "(", "arg_0", ")", ":", "arg_6", "=", "numpy", ".", "array", "(", "random", ".", "sample", "(", "xrange", "(", "arg_1", ")", ",", "arg_2", ")", ",", "dtype", "=", "numpy", ".", "uint32", ")", "arg_6", ".", "sort", "(", ")", "arg_3", ".", "setRowFromSparse", "(", "arg_5", ",", "arg_6", ",", "arg_4", ")", "arg_7", "=", "SM32", "(", "int", "(", "arg_0", ")", ",", "int", "(", "arg_1", ")", ")", "arg_7", ".", "initializeWithFixedNNZR", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0=10, arg_1=500, arg_2=50):\n  \"\"\"\n  Generate a coincidence matrix. This is used to generate random inputs to the\n  temporal learner and to compare the predicted output against.\n\n  It generates a matrix of nCoinc rows, each row has length 'length' and has\n  a total of 'activity' bits on.\n\n  Parameters:\n  -----------------------------------------------\n  nCoinc:        the number of rows to generate\n  length:        the length of each row\n  activity:      the number of ones to put into each row.\n\n  \"\"\"\n\n  arg_3 = SM32(int(arg_0), int(arg_1))\n  arg_4 = numpy.array([1.0] * arg_2, dtype=numpy.float32)\n  for arg_5 in xrange(arg_0):\n    arg_6 = numpy.array(random.sample(xrange(arg_1),\n                arg_2), dtype=numpy.uint32)\n    arg_6.sort()\n    arg_3.setRowFromSparse(arg_5, arg_6, arg_4)\n\n  # This is the right code to use, it's faster, but it derails the unit\n  # testing of the pooling for now.\n  arg_7 = SM32(int(arg_0), int(arg_1))\n  arg_7.initializeWithFixedNNZR(arg_2)\n\n  return arg_3", "path": "src/nupic/algorithms/fdrutilities.py", "identifier": "generateCoincMatrix", "docstring": "Generate a coincidence matrix. This is used to generate random inputs to the\n  temporal learner and to compare the predicted output against.\n\n  It generates a matrix of nCoinc rows, each row has length 'length' and has\n  a total of 'activity' bits on.\n\n  Parameters:\n  -----------------------------------------------\n  nCoinc:        the number of rows to generate\n  length:        the length of each row\n  activity:      the number of ones to put into each row.", "docstring_tokens": ["Generate", "a", "coincidence", "matrix", ".", "This", "is", "used", "to", "generate", "random", "inputs", "to", "the", "temporal", "learner", "and", "to", "compare", "the", "predicted", "output", "against", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253204}
{"url": "https://github.com/pinterest/thrift-tools/blob/64e74aec89e2491c781fc62d1c45944dc15aba28/thrift_tools/thrift_message.py#L82-L150", "sha": "64e74aec89e2491c781fc62d1c45944dc15aba28", "docstring_summary": "tries to deserialize a message, might fail if data is missing", "language": "python", "parameters": "(cls, data,\n             protocol=None,\n             fallback_protocol=TBinaryProtocol,\n             finagle_thrift=False,\n             max_fields=MAX_FIELDS,\n             max_list_size=MAX_LIST_SIZE,\n             max_map_size=MAX_MAP_SIZE,\n             max_set_size=MAX_SET_SIZE,\n             read_values=False)", "return_statement": "return cls(method, mtype, seqid, args, header, msglen), msglen", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "False", ",", "arg_6", "=", "arg_7", ",", "arg_8", "=", "arg_9", ",", "arg_10", "=", "arg_11", ",", "arg_12", "=", "arg_13", ",", "arg_14", "=", "False", ")", ":", "if", "len", "(", "arg_1", ")", "<", "arg_0", ".", "MIN_MESSAGE_SIZE", ":", "raise", "ValueError", "(", "'not enough data'", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "detect_protocol", "(", "arg_1", ",", "arg_3", ")", "arg_15", "=", "TTransport", ".", "TMemoryBuffer", "(", "arg_1", ")", "arg_16", "=", "arg_2", "(", "arg_15", ")", "arg_17", "=", "None", "if", "arg_5", ":", "try", ":", "arg_17", "=", "ThriftStruct", ".", "Func", "(", "arg_16", ",", "arg_6", ",", "arg_8", ",", "arg_10", ",", "arg_12", ",", "arg_14", ")", "except", ":", "arg_15", "=", "TTransport", ".", "TMemoryBuffer", "(", "arg_1", ")", "arg_16", "=", "arg_2", "(", "arg_15", ")", "arg_18", ",", "arg_19", ",", "arg_20", "=", "arg_16", ".", "FuncMessageBegin", "(", ")", "arg_19", "=", "arg_0", ".", "message_type_to_str", "(", "arg_19", ")", "if", "len", "(", "arg_18", ")", "==", "0", "or", "arg_18", ".", "isspace", "(", ")", "or", "arg_18", ".", "startswith", "(", "' '", ")", ":", "raise", "ValueError", "(", "'no method name'", ")", "if", "len", "(", "arg_18", ")", ">", "arg_0", ".", "MAX_METHOD_LENGTH", ":", "raise", "ValueError", "(", "'method name too long'", ")", "arg_21", "=", "range", "(", "33", ",", "127", ")", "if", "any", "(", "ord", "(", "arg_22", ")", "not", "in", "arg_21", "for", "arg_22", "in", "arg_18", ")", ":", "raise", "ValueError", "(", "'invalid method name'", "%", "arg_18", ")", "arg_23", "=", "ThriftStruct", ".", "Func", "(", "arg_16", ",", "arg_6", ",", "arg_8", ",", "arg_10", ",", "arg_12", ",", "arg_14", ")", "arg_16", ".", "FuncMessageEnd", "(", ")", "arg_24", "=", "arg_15", ".", "_buffer", ".", "tell", "(", ")", "return", "arg_0", "(", "arg_18", ",", "arg_19", ",", "arg_20", ",", "arg_23", ",", "arg_17", ",", "arg_24", ")", ",", "arg_24"], "function": "def Func(arg_0, arg_1,\n             arg_2=None,\n             arg_3=arg_4,\n             arg_5=False,\n             arg_6=arg_7,\n             arg_8=arg_9,\n             arg_10=arg_11,\n             arg_12=arg_13,\n             arg_14=False):\n        \"\"\" tries to deserialize a message, might fail if data is missing \"\"\"\n\n        # do we have enough data?\n        if len(arg_1) < arg_0.MIN_MESSAGE_SIZE:\n            raise ValueError('not enough data')\n\n        if arg_2 is None:\n            arg_2 = arg_0.detect_protocol(arg_1, arg_3)\n        arg_15 = TTransport.TMemoryBuffer(arg_1)\n        arg_16 = arg_2(arg_15)\n\n        # finagle-thrift prepends a RequestHeader\n        #\n        # See: http://git.io/vsziG\n        arg_17 = None\n        if arg_5:\n            try:\n                arg_17 = ThriftStruct.Func(\n                    arg_16,\n                    arg_6,\n                    arg_8,\n                    arg_10,\n                    arg_12,\n                    arg_14)\n            except:\n                # reset stream, maybe it's not finagle-thrift\n                arg_15 = TTransport.TMemoryBuffer(arg_1)\n                arg_16 = arg_2(arg_15)\n\n        # unpack the message\n        arg_18, arg_19, arg_20 = arg_16.FuncMessageBegin()\n        arg_19 = arg_0.message_type_to_str(arg_19)\n\n        if len(arg_18) == 0 or arg_18.isspace() or arg_18.startswith(' '):\n            raise ValueError('no method name')\n\n        if len(arg_18) > arg_0.MAX_METHOD_LENGTH:\n            raise ValueError('method name too long')\n\n        # we might have made it until this point by mere chance, so filter out\n        # suspicious method names\n        arg_21 = range(33, 127)\n        if any(ord(arg_22) not in arg_21 for arg_22 in arg_18):\n            raise ValueError('invalid method name' % arg_18)\n\n        arg_23 = ThriftStruct.Func(\n            arg_16,\n            arg_6,\n            arg_8,\n            arg_10,\n            arg_12,\n            arg_14)\n\n        arg_16.FuncMessageEnd()\n\n        # Note: this is a bit fragile, the right thing would be to count bytes\n        # as we Func them (i.e.: when calling FuncI32, etc).\n        arg_24 = arg_15._buffer.tell()\n\n        return arg_0(arg_18, arg_19, arg_20, arg_23, arg_17, arg_24), arg_24", "path": "thrift_tools/thrift_message.py", "identifier": "ThriftMessage.read", "docstring": "tries to deserialize a message, might fail if data is missing", "docstring_tokens": ["tries", "to", "deserialize", "a", "message", "might", "fail", "if", "data", "is", "missing"], "nwo": "pinterest/thrift-tools", "score": 0.3868024438139195, "idx": 253205}
{"url": "https://github.com/sendwithus/sendwithus_python/blob/8ae50d514febd44f7d9be3c838b4d92f99412832/sendwithus/__init__.py#L142-L160", "sha": "8ae50d514febd44f7d9be3c838b4d92f99412832", "docstring_summary": "Parses the API response and raises appropriate errors if\n        raise_errors was set to True", "language": "python", "parameters": "(self, response)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_raise_errors", ":", "return", "arg_1", "arg_2", "=", "str", "(", "arg_1", ".", "status_code", ")", "[", "0", "]", "==", "'4'", "arg_3", "=", "str", "(", "arg_1", ".", "status_code", ")", "[", "0", "]", "==", "'5'", "arg_4", "=", "arg_1", ".", "content", "if", "arg_1", ".", "status_code", "==", "403", ":", "raise", "AuthenticationError", "(", "arg_4", ")", "elif", "arg_2", ":", "raise", "APIError", "(", "arg_4", ")", "elif", "arg_3", ":", "raise", "ServerError", "(", "arg_4", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses the API response and raises appropriate errors if\n        raise_errors was set to True\n        \"\"\"\n        if not arg_0._raise_errors:\n            return arg_1\n\n        arg_2 = str(arg_1.status_code)[0] == '4'\n        arg_3 = str(arg_1.status_code)[0] == '5'\n        arg_4 = arg_1.content\n\n        if arg_1.status_code == 403:\n            raise AuthenticationError(arg_4)\n        elif arg_2:\n            raise APIError(arg_4)\n        elif arg_3:\n            raise ServerError(arg_4)\n\n        return arg_1", "path": "sendwithus/__init__.py", "identifier": "api._parse_response", "docstring": "Parses the API response and raises appropriate errors if\n        raise_errors was set to True", "docstring_tokens": ["Parses", "the", "API", "response", "and", "raises", "appropriate", "errors", "if", "raise_errors", "was", "set", "to", "True"], "nwo": "sendwithus/sendwithus_python", "score": 0.2828805321802978, "idx": 253206}
{"url": "https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L84-L89", "sha": "3dc6ad803f0b0d56586dec9542a6a06aa06cf569", "docstring_summary": "Try to find the container ID with the specified name", "language": "python", "parameters": "(self, name)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_containers", ".", "get", "(", "arg_1", ",", "None", ")", "if", "not", "arg_2", "is", "None", ":", "return", "arg_2", ".", "get", "(", "'id'", ",", "None", ")", "return", "None"], "function": "def Func(arg_0, arg_1):\n        '''Try to find the container ID with the specified name'''\n        arg_2 = arg_0._containers.get(arg_1, None)\n        if not arg_2 is None:\n            return arg_2.get('id', None)\n        return None", "path": "blockade/state.py", "identifier": "BlockadeState.container_id", "docstring": "Try to find the container ID with the specified name", "docstring_tokens": ["Try", "to", "find", "the", "container", "ID", "with", "the", "specified", "name"], "nwo": "worstcase/blockade", "score": 0.7770804820985606, "idx": 253207}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/profile_block_analyzer.py#L185-L213", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Temporal distance probability density function.", "language": "python", "parameters": "(self)", "return_statement": "return numpy.array(non_delta_peak_split_points), \\\n               numpy.array(non_delta_peak_densities), delta_peak_loc_to_probability_mass", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "_temporal_distance_cdf", "(", ")", "arg_3", "=", "{", "}", "arg_4", "=", "[", "arg_1", "[", "0", "]", "]", "arg_5", "=", "[", "]", "for", "arg_6", "in", "range", "(", "0", ",", "len", "(", "arg_1", ")", "-", "1", ")", ":", "arg_7", "=", "arg_1", "[", "arg_6", "]", "arg_8", "=", "arg_1", "[", "arg_6", "+", "1", "]", "arg_9", "=", "arg_8", "-", "arg_7", "arg_10", "=", "arg_2", "[", "arg_6", "+", "1", "]", "-", "arg_2", "[", "arg_6", "]", "if", "arg_9", "==", "0.0", ":", "arg_3", "[", "arg_7", "]", "=", "arg_10", "else", ":", "arg_4", ".", "append", "(", "arg_8", ")", "arg_5", ".", "append", "(", "arg_10", "/", "float", "(", "arg_9", ")", ")", "assert", "(", "len", "(", "arg_5", ")", "==", "len", "(", "arg_4", ")", "-", "1", ")", "return", "numpy", ".", "array", "(", "arg_4", ")", ",", "numpy", ".", "array", "(", "arg_5", ")", ",", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Temporal distance probability density function.\n\n        Returns\n        -------\n        non_delta_peak_split_points: numpy.array\n        non_delta_peak_densities: numpy.array\n            len(density) == len(temporal_distance_split_points_ordered) -1\n        delta_peak_loc_to_probability_mass : dict\n        \"\"\"\n        arg_1, arg_2 = arg_0._temporal_distance_cdf()\n        arg_3 = {}\n\n        arg_4 = [arg_1[0]]\n        arg_5 = []\n        for arg_6 in range(0, len(arg_1) - 1):\n            arg_7 = arg_1[arg_6]\n            arg_8 = arg_1[arg_6 + 1]\n            arg_9 = arg_8 - arg_7\n            arg_10 = arg_2[arg_6 + 1] - arg_2[arg_6]\n            if arg_9 == 0.0:\n                arg_3[arg_7] = arg_10\n            else:\n                arg_4.append(arg_8)\n                arg_5.append(arg_10 / float(arg_9))\n        assert (len(arg_5) == len(arg_4) - 1)\n        return numpy.array(arg_4), \\\n               numpy.array(arg_5), arg_3", "path": "gtfspy/routing/profile_block_analyzer.py", "identifier": "ProfileBlockAnalyzer._temporal_distance_pdf", "docstring": "Temporal distance probability density function.\n\n        Returns\n        -------\n        non_delta_peak_split_points: numpy.array\n        non_delta_peak_densities: numpy.array\n            len(density) == len(temporal_distance_split_points_ordered) -1\n        delta_peak_loc_to_probability_mass : dict", "docstring_tokens": ["Temporal", "distance", "probability", "density", "function", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 253208}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1629-L1647", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Pop a column from the H2OFrame at index i.", "language": "python", "parameters": "(self, i)", "return_statement": "return col", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "is_type", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "arg_0", ".", "names", ".", "index", "(", "arg_1", ")", "arg_2", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"cols\"", ",", "arg_0", ",", "arg_1", ")", ")", "arg_3", "=", "arg_0", ".", "_ex", ".", "_cache", "arg_0", ".", "_ex", "=", "ExprNode", "(", "\"cols\"", ",", "arg_0", ",", "-", "(", "arg_1", "+", "1", ")", ")", "arg_0", ".", "_ex", ".", "_cache", ".", "ncols", "-=", "1", "arg_0", ".", "_ex", ".", "_cache", ".", "names", "=", "arg_3", ".", "names", "[", ":", "arg_1", "]", "+", "arg_3", ".", "names", "[", "arg_1", "+", "1", ":", "]", "arg_0", ".", "_ex", ".", "_cache", ".", "types", "=", "{", "name", ":", "arg_3", ".", "types", "[", "name", "]", "for", "name", "in", "arg_0", ".", "_ex", ".", "_cache", ".", "names", "}", "arg_0", ".", "_ex", ".", "_cache", ".", "_data", "=", "None", "arg_2", ".", "_ex", ".", "_cache", ".", "ncols", "=", "1", "arg_2", ".", "_ex", ".", "_cache", ".", "names", "=", "[", "arg_3", ".", "names", "[", "arg_1", "]", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Pop a column from the H2OFrame at index i.\n\n        :param i: The index (int) or name (str) of the column to Func.\n        :returns: an H2OFrame containing the column dropped from the current frame; the current frame is modified\n            in-place and loses the column.\n        \"\"\"\n        if is_type(arg_1, str): arg_1 = arg_0.names.index(arg_1)\n        arg_2 = H2OFrame._expr(expr=ExprNode(\"cols\", arg_0, arg_1))\n        arg_3 = arg_0._ex._cache\n        arg_0._ex = ExprNode(\"cols\", arg_0, -(arg_1 + 1))\n        arg_0._ex._cache.ncols -= 1\n        arg_0._ex._cache.names = arg_3.names[:arg_1] + arg_3.names[arg_1 + 1:]\n        arg_0._ex._cache.types = {name: arg_3.types[name] for name in arg_0._ex._cache.names}\n        arg_0._ex._cache._data = None\n        arg_2._ex._cache.ncols = 1\n        arg_2._ex._cache.names = [arg_3.names[arg_1]]\n        return arg_2", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.pop", "docstring": "Pop a column from the H2OFrame at index i.\n\n        :param i: The index (int) or name (str) of the column to pop.\n        :returns: an H2OFrame containing the column dropped from the current frame; the current frame is modified\n            in-place and loses the column.", "docstring_tokens": ["Pop", "a", "column", "from", "the", "H2OFrame", "at", "index", "i", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253209}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L244-L251", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "find the SHA256 hash string of a file", "language": "python", "parameters": "(filename)", "return_statement": "return hasher.hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "hashlib", ".", "sha256", "(", ")", "with", "open", "(", "arg_0", ",", "\"rb\"", ")", "as", "f", ":", "for", "arg_2", "in", "iter", "(", "lambda", ":", "f", ".", "read", "(", "4096", ")", ",", "b\"\"", ")", ":", "arg_1", ".", "update", "(", "arg_2", ")", "return", "arg_1", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0):\n    '''find the SHA256 hash string of a file\n    '''\n    arg_1 = hashlib.sha256()\n    with open(arg_0, \"rb\") as f:\n        for arg_2 in iter(lambda: f.read(4096), b\"\"):\n            arg_1.update(arg_2)\n    return arg_1.hexdigest()", "path": "sregistry/utils/fileio.py", "identifier": "get_file_hash", "docstring": "find the SHA256 hash string of a file", "docstring_tokens": ["find", "the", "SHA256", "hash", "string", "of", "a", "file"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 253210}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L648-L652", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "If n2 is a perfect square, return its square root, else raise error.", "language": "python", "parameters": "(n2)", "return_statement": "return n", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "int", "(", "math", ".", "sqrt", "(", "arg_0", ")", ")", "assert", "arg_1", "*", "arg_1", "==", "arg_0", "return", "arg_1"], "function": "def Func(arg_0):\n    \"If n2 is a perfect square, return its square root, else raise error.\"\n    arg_1 = int(math.sqrt(arg_0))\n    assert arg_1 * arg_1 == arg_0\n    return arg_1", "path": "aima/search.py", "identifier": "exact_sqrt", "docstring": "If n2 is a perfect square, return its square root, else raise error.", "docstring_tokens": ["If", "n2", "is", "a", "perfect", "square", "return", "its", "square", "root", "else", "raise", "error", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 253211}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/util/solver.py#L424-L441", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Assert model solver status is optimal.", "language": "python", "parameters": "(model, message='optimization failed')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'optimization failed'", ")", ":", "arg_2", "=", "arg_0", ".", "solver", ".", "status", "if", "arg_2", "!=", "OPTIMAL", ":", "arg_3", "=", "OPTLANG_TO_EXCEPTIONS_DICT", ".", "get", "(", "arg_2", ",", "OptimizationError", ")", "raise", "arg_3", "(", "\"{} ({})\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1='optimization failed'):\n    \"\"\"Assert model solver status is optimal.\n\n    Do nothing if model solver status is optimal, otherwise throw\n    appropriate exception depending on the status.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The model to check the solver status for.\n    message : str (optional)\n        Message to for the exception if solver status was not optimal.\n    \"\"\"\n    arg_2 = arg_0.solver.status\n    if arg_2 != OPTIMAL:\n        arg_3 = OPTLANG_TO_EXCEPTIONS_DICT.get(\n            arg_2, OptimizationError)\n        raise arg_3(\"{} ({})\".format(arg_1, arg_2))", "path": "cobra/util/solver.py", "identifier": "assert_optimal", "docstring": "Assert model solver status is optimal.\n\n    Do nothing if model solver status is optimal, otherwise throw\n    appropriate exception depending on the status.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The model to check the solver status for.\n    message : str (optional)\n        Message to for the exception if solver status was not optimal.", "docstring_tokens": ["Assert", "model", "solver", "status", "is", "optimal", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 253212}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/mlx.py#L210-L267", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Run the script", "language": "python", "parameters": "(self, log=None, ml_log=None, mlp_out=None, overwrite=False,\n                   file_out=None, output_mask=None, script_file=None, print_meshlabserver_output=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "True", ")", ":", "arg_9", "=", "False", "arg_10", "=", "False", "if", "arg_0", ".", "__no_file_in", ":", "arg_11", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ",", "suffix", "=", "'.xyz'", ",", "dir", "=", "os", ".", "getcwd", "(", ")", ")", "arg_11", ".", "write", "(", "b'0 0 0'", ")", "arg_11", ".", "close", "(", ")", "arg_0", ".", "file_in", "=", "[", "arg_11", ".", "name", "]", "if", "not", "arg_0", ".", "filters", ":", "arg_7", "=", "None", "elif", "arg_7", "is", "None", ":", "arg_9", "=", "True", "arg_13", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ",", "suffix", "=", "'.mlx'", ")", "arg_13", ".", "close", "(", ")", "arg_0", ".", "save_to_file", "(", "arg_13", ".", "name", ")", "arg_7", "=", "arg_13", ".", "name", "if", "(", "arg_0", ".", "parse_geometry", "or", "arg_0", ".", "parse_topology", "or", "arg_0", ".", "parse_hausdorff", ")", "and", "(", "arg_2", "is", "None", ")", ":", "arg_10", "=", "True", "arg_14", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ",", "suffix", "=", "'.txt'", ")", "arg_14", ".", "close", "(", ")", "arg_2", "=", "arg_14", ".", "name", "if", "arg_5", "is", "None", ":", "arg_5", "=", "arg_0", ".", "file_out", "run", "(", "script", "=", "arg_7", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "mlp_in", "=", "arg_0", ".", "mlp_in", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_12", "=", "arg_0", ".", "file_in", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "ml_version", "=", "arg_0", ".", "ml_version", ",", "arg_8", "=", "arg_8", ")", "if", "arg_0", ".", "parse_geometry", ":", "arg_0", ".", "geometry", "=", "compute", ".", "parse_geometry", "(", "arg_2", ",", "arg_1", ",", "print_output", "=", "arg_8", ")", "if", "arg_0", ".", "parse_topology", ":", "arg_0", ".", "topology", "=", "compute", ".", "parse_topology", "(", "arg_2", ",", "arg_1", ",", "print_output", "=", "arg_8", ")", "if", "arg_0", ".", "parse_hausdorff", ":", "arg_0", ".", "hausdorff_distance", "=", "compute", ".", "parse_hausdorff", "(", "arg_2", ",", "arg_1", ",", "print_output", "=", "arg_8", ")", "if", "arg_0", ".", "__no_file_in", ":", "os", ".", "remove", "(", "arg_11", ".", "name", ")", "if", "arg_9", ":", "os", ".", "remove", "(", "arg_13", ".", "name", ")", "if", "arg_10", ":", "os", ".", "remove", "(", "arg_14", ".", "name", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False,\n                   arg_5=None, arg_6=None, arg_7=None, arg_8=True):\n        \"\"\" Run the script\n        \"\"\"\n\n        arg_9 = False\n        arg_10 = False\n\n        if arg_0.__no_file_in:\n            # If no input files are provided, create a dummy file\n            # with a single vertex and delete it first in the script.\n            # This works around the fact that meshlabserver will\n            # not run without an input file.\n            arg_11 = tempfile.NamedTemporaryFile(delete=False, suffix='.xyz', dir=os.getcwd())\n            arg_11.write(b'0 0 0')\n            arg_11.close()\n            arg_0.file_in = [arg_11.name]\n\n        if not arg_0.filters:\n            arg_7 = None\n        elif arg_7 is None:\n            # Create temporary script file\n            arg_9 = True\n            arg_13 = tempfile.NamedTemporaryFile(delete=False, suffix='.mlx')\n            arg_13.close()\n            arg_0.save_to_file(arg_13.name)\n            arg_7 = arg_13.name\n\n        if (arg_0.parse_geometry or arg_0.parse_topology or arg_0.parse_hausdorff) and (arg_2 is None):\n            # create temp ml_log\n            arg_10 = True\n            arg_14 = tempfile.NamedTemporaryFile(delete=False, suffix='.txt')\n            arg_14.close()\n            arg_2 = arg_14.name\n        if arg_5 is None:\n            arg_5 = arg_0.file_out\n\n        run(script=arg_7, arg_1=arg_1, arg_2=arg_2,\n            mlp_in=arg_0.mlp_in, arg_3=arg_3, arg_4=arg_4,\n            arg_12=arg_0.file_in, arg_5=arg_5, arg_6=arg_6, ml_version=arg_0.ml_version,\n            arg_8=arg_8)\n\n        # Parse output\n        # TODO: record which layer this is associated with?\n        if arg_0.parse_geometry:\n            arg_0.geometry = compute.parse_geometry(arg_2, arg_1, print_output=arg_8)\n        if arg_0.parse_topology:\n            arg_0.topology = compute.parse_topology(arg_2, arg_1, print_output=arg_8)\n        if arg_0.parse_hausdorff:\n            arg_0.hausdorff_distance = compute.parse_hausdorff(arg_2, arg_1, print_output=arg_8)\n\n        # Delete temp files\n        if arg_0.__no_file_in:\n            os.remove(arg_11.name)\n        if arg_9:\n            os.remove(arg_13.name)\n        if arg_10:\n            os.remove(arg_14.name)", "path": "meshlabxml/mlx.py", "identifier": "FilterScript.run_script", "docstring": "Run the script", "docstring_tokens": ["Run", "the", "script"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 253213}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/thrift/__init__.py#L119-L135", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Reformat binary annotations dict to return list of zipkin_core objects. The\n    value of the binary annotations MUST be in string format.", "language": "python", "parameters": "(binary_annotations, host)", "return_statement": "return [\n        create_binary_annotation(key, str(value), ann_type, host)\n        for key, value in binary_annotations.items()\n    ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "zipkin_core", ".", "AnnotationType", ".", "STRING", "return", "[", "create_binary_annotation", "(", "arg_3", ",", "str", "(", "arg_4", ")", ",", "arg_2", ",", "arg_1", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "items", "(", ")", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Reformat binary annotations dict to return list of zipkin_core objects. The\n    value of the binary annotations MUST be in string format.\n\n    :param binary_annotations: dict with key, value being the name and value\n                               of the binary annotation being logged.\n    :type host: :class:`zipkin_core.Endpoint`\n    :returns: a list of binary annotation zipkin_core objects\n    :rtype: list\n    \"\"\"\n    # TODO: Remove the type hard-coding of STRING to take it as a param option.\n    arg_2 = zipkin_core.AnnotationType.STRING\n    return [\n        create_binary_annotation(arg_3, str(arg_4), arg_2, arg_1)\n        for arg_3, arg_4 in arg_0.items()\n    ]", "path": "py_zipkin/thrift/__init__.py", "identifier": "binary_annotation_list_builder", "docstring": "Reformat binary annotations dict to return list of zipkin_core objects. The\n    value of the binary annotations MUST be in string format.\n\n    :param binary_annotations: dict with key, value being the name and value\n                               of the binary annotation being logged.\n    :type host: :class:`zipkin_core.Endpoint`\n    :returns: a list of binary annotation zipkin_core objects\n    :rtype: list", "docstring_tokens": ["Reformat", "binary", "annotations", "dict", "to", "return", "list", "of", "zipkin_core", "objects", ".", "The", "value", "of", "the", "binary", "annotations", "MUST", "be", "in", "string", "format", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 253214}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/checklist.py#L71-L80", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Add an item to this checklist. Returns a dictionary of values of new\n        item.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return self.fetch_json(\n            uri_path=self.base_uri + '/checkItems',\n            http_method='POST',\n            query_params=query_params or {}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", "+", "'/checkItems'", ",", "http_method", "=", "'POST'", ",", "arg_1", "=", "arg_1", "or", "{", "}", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''\n        Add an item to this checklist. Returns a dictionary of values of new\n        item.\n        '''\n        return arg_0.fetch_json(\n            uri_path=arg_0.base_uri + '/checkItems',\n            http_method='POST',\n            arg_1=arg_1 or {}\n        )", "path": "trolly/checklist.py", "identifier": "Checklist.add_item", "docstring": "Add an item to this checklist. Returns a dictionary of values of new\n        item.", "docstring_tokens": ["Add", "an", "item", "to", "this", "checklist", ".", "Returns", "a", "dictionary", "of", "values", "of", "new", "item", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 253215}
{"url": "https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/loadmat.py#L170-L204", "sha": "6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1", "docstring_summary": "Read elements from the file.", "language": "python", "parameters": "(fd, endian, mtps, is_name=False)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "read_element_tag", "(", "arg_0", ",", "arg_1", ")", "if", "arg_2", "and", "arg_4", "not", "in", "[", "etypes", "[", "arg_7", "]", "[", "'n'", "]", "for", "arg_7", "in", "arg_2", "]", ":", "raise", "ParseError", "(", "'Got type {}, expected {}'", ".", "format", "(", "arg_4", ",", "' / '", ".", "join", "(", "'{} ({})'", ".", "format", "(", "etypes", "[", "arg_7", "]", "[", "'n'", "]", ",", "arg_7", ")", "for", "arg_7", "in", "arg_2", ")", ")", ")", "if", "not", "arg_6", ":", "arg_6", "=", "arg_0", ".", "read", "(", "arg_5", ")", "arg_8", "=", "arg_5", "%", "8", "if", "arg_8", ":", "arg_0", ".", "seek", "(", "8", "-", "arg_8", ",", "1", ")", "if", "arg_3", ":", "arg_9", "=", "'s'", "arg_10", "=", "[", "unpack", "(", "arg_1", ",", "arg_9", ",", "s", ")", "for", "s", "in", "arg_6", ".", "split", "(", "b'\\0'", ")", "if", "s", "]", "if", "len", "(", "arg_10", ")", "==", "0", ":", "arg_10", "=", "''", "elif", "len", "(", "arg_10", ")", "==", "1", ":", "arg_10", "=", "asstr", "(", "arg_10", "[", "0", "]", ")", "else", ":", "arg_10", "=", "[", "asstr", "(", "s", ")", "for", "s", "in", "arg_10", "]", "else", ":", "arg_9", "=", "etypes", "[", "inv_etypes", "[", "arg_4", "]", "]", "[", "'fmt'", "]", "arg_10", "=", "unpack", "(", "arg_1", ",", "arg_9", ",", "arg_6", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\"Read elements from the file.\n\n    If list of possible matrix data types mtps is provided, the data type\n    of the elements are verified.\n    \"\"\"\n    arg_4, arg_5, arg_6 = read_element_tag(arg_0, arg_1)\n    if arg_2 and arg_4 not in [etypes[arg_7]['n'] for arg_7 in arg_2]:\n        raise ParseError('Got type {}, expected {}'.format(\n            arg_4, ' / '.join('{} ({})'.format(\n                etypes[arg_7]['n'], arg_7) for arg_7 in arg_2)))\n    if not arg_6:\n        # full format, read data\n        arg_6 = arg_0.read(arg_5)\n        # Seek to next 64-bit boundary\n        arg_8 = arg_5 % 8\n        if arg_8:\n            arg_0.seek(8 - arg_8, 1)\n\n    # parse data and return values\n    if arg_3:\n        # names are stored as miINT8 bytes\n        arg_9 = 's'\n        arg_10 = [unpack(arg_1, arg_9, s)\n               for s in arg_6.split(b'\\0') if s]\n        if len(arg_10) == 0:\n            arg_10 = ''\n        elif len(arg_10) == 1:\n            arg_10 = asstr(arg_10[0])\n        else:\n            arg_10 = [asstr(s) for s in arg_10]\n    else:\n        arg_9 = etypes[inv_etypes[arg_4]]['fmt']\n        arg_10 = unpack(arg_1, arg_9, arg_6)\n    return arg_10", "path": "mat4py/loadmat.py", "identifier": "read_elements", "docstring": "Read elements from the file.\n\n    If list of possible matrix data types mtps is provided, the data type\n    of the elements are verified.", "docstring_tokens": ["Read", "elements", "from", "the", "file", "."], "nwo": "nephics/mat4py", "score": 0.3187018950262521, "idx": 253216}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmds.py#L108-L125", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "attrs pipe can extract attribute values of object.", "language": "python", "parameters": "(prev, attr_names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "if", "hasattr", "(", "arg_2", ",", "arg_4", ")", ":", "arg_3", ".", "append", "(", "getattr", "(", "arg_2", ",", "arg_4", ")", ")", "yield", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Func pipe can extract attribute values of object.\n\n    If attr_names is a list and its item is not a valid attribute of\n    prev's object. It will be excluded from yielded dict.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param attr_names: The list of attribute names\n    :type attr_names: str of list\n    :returns: generator\n    \"\"\"\n    for arg_2 in arg_0:\n        arg_3 = []\n        for arg_4 in arg_1:\n            if hasattr(arg_2, arg_4):\n                arg_3.append(getattr(arg_2, arg_4))\n        yield arg_3", "path": "cmdlet/cmds.py", "identifier": "attrs", "docstring": "attrs pipe can extract attribute values of object.\n\n    If attr_names is a list and its item is not a valid attribute of\n    prev's object. It will be excluded from yielded dict.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param attr_names: The list of attribute names\n    :type attr_names: str of list\n    :returns: generator", "docstring_tokens": ["attrs", "pipe", "can", "extract", "attribute", "values", "of", "object", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 253217}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/examples/music-v2.py#L138-L152", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Shows some stats about the currently playing song.", "language": "python", "parameters": "(self, ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "bot", ".", "lavalink", ".", "players", ".", "get", "(", "arg_1", ".", "guild", ".", "id", ")", "arg_3", "=", "'Nothing'", "if", "arg_2", ".", "current", ":", "arg_4", "=", "lavalink", ".", "Utils", ".", "format_time", "(", "arg_2", ".", "position", ")", "if", "arg_2", ".", "current", ".", "stream", ":", "arg_5", "=", "'\ud83d\udd34 LIVE'\r", "else", ":", "arg_5", "=", "lavalink", ".", "Utils", ".", "format_time", "(", "arg_2", ".", "current", ".", "duration", ")", "arg_3", "=", "f'**[{player.current.title}]({player.current.uri})**\\n({position}/{duration})'", "arg_6", "=", "discord", ".", "Embed", "(", "color", "=", "discord", ".", "Color", ".", "blurple", "(", ")", ",", "title", "=", "'Now Playing'", ",", "description", "=", "arg_3", ")", "await", "arg_1", ".", "send", "(", "arg_6", "=", "arg_6", ")"], "function": "async def Func(arg_0, arg_1):\r\n        \"\"\" Shows some stats about the currently playing song. \"\"\"\r\n        arg_2 = arg_0.bot.lavalink.players.get(arg_1.guild.id)\r\n        arg_3 = 'Nothing'\r\n\r\n        if arg_2.current:\r\n            arg_4 = lavalink.Utils.format_time(arg_2.position)\r\n            if arg_2.current.stream:\r\n                arg_5 = '\ud83d\udd34 LIVE'\r\n            else:\r\n                arg_5 = lavalink.Utils.format_time(arg_2.current.duration)\r\n            arg_3 = f'**[{player.current.title}]({player.current.uri})**\\n({position}/{duration})'\r\n\r\n        arg_6 = discord.Embed(color=discord.Color.blurple(), title='Now Playing', description=arg_3)\r\n        await arg_1.send(arg_6=arg_6)", "path": "examples/music-v2.py", "identifier": "Music._now", "docstring": "Shows some stats about the currently playing song.", "docstring_tokens": ["Shows", "some", "stats", "about", "the", "currently", "playing", "song", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 253218}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L946-L981", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "A local version of NumPy's PSD function that returns the plot arrays.", "language": "python", "parameters": "(x,NFFT=2**10,Fs=1)", "return_statement": "return Px.flatten(), f", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", "**", "10", ",", "arg_2", "=", "1", ")", ":", "arg_3", ",", "arg_4", "=", "pylab", ".", "mlab", ".", "psd", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "return", "arg_3", ".", "flatten", "(", ")", ",", "arg_4"], "function": "def Func(arg_0,arg_1=2**10,arg_2=1):\n    \"\"\"\n    A local version of NumPy's PSD function that returns the plot arrays.\n\n    A mlab.psd wrapper function that returns two ndarrays;\n    makes no attempt to auto plot anything.\n\n    Parameters\n    ----------\n    x : ndarray input signal\n    NFFT : a power of two, e.g., 2**10 = 1024\n    Fs : the sampling rate in Hz\n\n    Returns\n    -------\n    Px : ndarray of the power spectrum estimate\n    f : ndarray of frequency values\n    \n    Notes\n    -----\n    This function makes it easier to overlay spectrum plots because\n    you have better control over the axis scaling than when using psd()\n    in the autoscale mode.\n    \n    Examples\n    --------\n    >>> import matplotlib.pyplot as plt\n    >>> from sk_dsp_comm import digitalcom as dc\n    >>> from numpy import log10\n    >>> x,b, data = dc.NRZ_bits(10000,10)\n    >>> Px,f = dc.Func(x,2**10,10)\n    >>> plt.plot(f, 10*log10(Px))\n    >>> plt.show()\n    \"\"\"\n    arg_3,arg_4 = pylab.mlab.psd(arg_0,arg_1,arg_2)\n    return arg_3.flatten(), arg_4", "path": "sk_dsp_comm/digitalcom.py", "identifier": "my_psd", "docstring": "A local version of NumPy's PSD function that returns the plot arrays.\n\n    A mlab.psd wrapper function that returns two ndarrays;\n    makes no attempt to auto plot anything.\n\n    Parameters\n    ----------\n    x : ndarray input signal\n    NFFT : a power of two, e.g., 2**10 = 1024\n    Fs : the sampling rate in Hz\n\n    Returns\n    -------\n    Px : ndarray of the power spectrum estimate\n    f : ndarray of frequency values\n    \n    Notes\n    -----\n    This function makes it easier to overlay spectrum plots because\n    you have better control over the axis scaling than when using psd()\n    in the autoscale mode.\n    \n    Examples\n    --------\n    >>> import matplotlib.pyplot as plt\n    >>> from sk_dsp_comm import digitalcom as dc\n    >>> from numpy import log10\n    >>> x,b, data = dc.NRZ_bits(10000,10)\n    >>> Px,f = dc.my_psd(x,2**10,10)\n    >>> plt.plot(f, 10*log10(Px))\n    >>> plt.show()", "docstring_tokens": ["A", "local", "version", "of", "NumPy", "s", "PSD", "function", "that", "returns", "the", "plot", "arrays", "."], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 253219}
{"url": "https://github.com/snjoetw/py-synology/blob/4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f/synology/api.py#L216-L228", "sha": "4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f", "docstring_summary": "Return motion settings matching camera_id.", "language": "python", "parameters": "(self, camera_id, **kwargs)", "return_statement": "return MotionSetting(camera_id, response['data']['MDParam'])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_api_info", "[", "'camera_event'", "]", "arg_4", "=", "dict", "(", "{", "'_sid'", ":", "arg_0", ".", "_sid", ",", "'api'", ":", "arg_3", "[", "'name'", "]", ",", "'method'", ":", "'MotionEnum'", ",", "'version'", ":", "arg_3", "[", "'version'", "]", ",", "'camId'", ":", "arg_1", ",", "}", ",", "**", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_get_json_with_retry", "(", "arg_3", "[", "'url'", "]", ",", "arg_4", ")", "return", "MotionSetting", "(", "arg_1", ",", "arg_5", "[", "'data'", "]", "[", "'MDParam'", "]", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Return motion settings matching camera_id.\"\"\"\n        arg_3 = arg_0._api_info['camera_event']\n        arg_4 = dict({\n            '_sid': arg_0._sid,\n            'api': arg_3['name'],\n            'method': 'MotionEnum',\n            'version': arg_3['version'],\n            'camId': arg_1,\n        }, **arg_2)\n        arg_5 = arg_0._get_json_with_retry(arg_3['url'], arg_4)\n\n        return MotionSetting(arg_1, arg_5['data']['MDParam'])", "path": "synology/api.py", "identifier": "Api.camera_event_motion_enum", "docstring": "Return motion settings matching camera_id.", "docstring_tokens": ["Return", "motion", "settings", "matching", "camera_id", "."], "nwo": "snjoetw/py-synology", "score": 0.28899999164266604, "idx": 253220}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/joint_distribution_sequential.py#L333-L340", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Shannon entropy in nats.", "language": "python", "parameters": "(self)", "return_statement": "return sum(joint_distribution_lib.maybe_check_wont_broadcast(\n        (d().entropy() for d in self._dist_fn_wrapped),\n        self.validate_args))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "any", "(", "arg_0", ".", "_dist_fn_args", ")", ":", "raise", "ValueError", "(", "'Can only compute entropy when all distributions are independent.'", ")", "return", "sum", "(", "joint_distribution_lib", ".", "maybe_check_wont_broadcast", "(", "(", "arg_1", "(", ")", ".", "entropy", "(", ")", "for", "arg_1", "in", "arg_0", ".", "_dist_fn_wrapped", ")", ",", "arg_0", ".", "validate_args", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Shannon entropy in nats.\"\"\"\n    if any(arg_0._dist_fn_args):\n      raise ValueError(\n          'Can only compute entropy when all distributions are independent.')\n    return sum(joint_distribution_lib.maybe_check_wont_broadcast(\n        (arg_1().entropy() for arg_1 in arg_0._dist_fn_wrapped),\n        arg_0.validate_args))", "path": "tensorflow_probability/python/distributions/joint_distribution_sequential.py", "identifier": "JointDistributionSequential._entropy", "docstring": "Shannon entropy in nats.", "docstring_tokens": ["Shannon", "entropy", "in", "nats", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253221}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L347-L360", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Defines a set of URL query params to match.", "language": "python", "parameters": "(self, params)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_2", "=", "furl", "(", "arg_0", ".", "_request", ".", "rawurl", ")", "arg_2", "=", "arg_2", ".", "add", "(", "Func", ")", "arg_0", ".", "_request", ".", "url", "=", "arg_2", ".", "url", "arg_0", ".", "add_matcher", "(", "matcher", "(", "'QueryMatcher'", ",", "Func", ")", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Defines a set of URL query params to match.\n\n        Arguments:\n            params (dict): set of params to match.\n\n        Returns:\n            self: current Mock instance.\n        \"\"\"\n        arg_2 = furl(arg_0._request.rawurl)\n        arg_2 = arg_2.add(Func)\n        arg_0._request.url = arg_2.url\n        arg_0.add_matcher(matcher('QueryMatcher', Func))", "path": "pook/mock.py", "identifier": "Mock.params", "docstring": "Defines a set of URL query params to match.\n\n        Arguments:\n            params (dict): set of params to match.\n\n        Returns:\n            self: current Mock instance.", "docstring_tokens": ["Defines", "a", "set", "of", "URL", "query", "params", "to", "match", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 253222}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/ops.py#L80-L95", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "r\"\"\"Return a new schedule with by appending `child` to `parent` at\n       the last time of the `parent` schedule's channels\n       over the intersection of the parent and child schedule's channels.", "language": "python", "parameters": "(parent: ScheduleComponent, child: ScheduleComponent,\n           name: str = None)", "return_statement": "return insert(parent, insertion_time, child, name=name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ",", "arg_3", ":", "arg_4", "=", "None", ")", "->", "Schedule", ":", "arg_5", "=", "set", "(", "arg_0", ".", "channels", ")", "&", "set", "(", "arg_2", ".", "channels", ")", "arg_6", "=", "arg_0", ".", "ch_stop_time", "(", "*", "arg_5", ")", "return", "insert", "(", "arg_0", ",", "arg_6", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_1,\n           arg_3: arg_4 = None) -> Schedule:\n    r\"\"\"Return a new schedule with by Funcing `child` to `parent` at\n       the last time of the `parent` schedule's channels\n       over the intersection of the parent and child schedule's channels.\n\n       $t = \\textrm{max}({x.stop\\_time |x \\in parent.channels \\cap child.channels})$\n\n    Args:\n        parent: The schedule to be inserted into\n        child: The schedule to insert\n        name: Name of the new schedule. Defaults to name of parent\n    \"\"\"\n    arg_5 = set(arg_0.channels) & set(arg_2.channels)\n    arg_6 = arg_0.ch_stop_time(*arg_5)\n    return insert(arg_0, arg_6, arg_2, arg_3=arg_3)", "path": "qiskit/pulse/ops.py", "identifier": "append", "docstring": "r\"\"\"Return a new schedule with by appending `child` to `parent` at\n       the last time of the `parent` schedule's channels\n       over the intersection of the parent and child schedule's channels.\n\n       $t = \\textrm{max}({x.stop\\_time |x \\in parent.channels \\cap child.channels})$\n\n    Args:\n        parent: The schedule to be inserted into\n        child: The schedule to insert\n        name: Name of the new schedule. Defaults to name of parent", "docstring_tokens": ["r", "Return", "a", "new", "schedule", "with", "by", "appending", "child", "to", "parent", "at", "the", "last", "time", "of", "the", "parent", "schedule", "s", "channels", "over", "the", "intersection", "of", "the", "parent", "and", "child", "schedule", "s", "channels", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253223}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/random/utils.py#L82-L104", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Generate a random density matrix rho.", "language": "python", "parameters": "(length, rank=None, method='Hilbert-Schmidt', seed=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'Hilbert-Schmidt'", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "==", "'Hilbert-Schmidt'", ":", "return", "__random_density_hs", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "elif", "arg_2", "==", "'Bures'", ":", "return", "__random_density_bures", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "else", ":", "raise", "QiskitError", "(", "'Error: unrecognized method {}'", ".", "format", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2='Hilbert-Schmidt', arg_3=None):\n    \"\"\"\n    Generate a random density matrix rho.\n\n    Args:\n        length (int): the length of the density matrix.\n        rank (int or None): the rank of the density matrix. The default\n            value is full-rank.\n        method (string): the method to use.\n            'Hilbert-Schmidt': sample rho from the Hilbert-Schmidt metric.\n            'Bures': sample rho from the Bures metric.\n        seed (int): Optional. To set a random seed.\n    Returns:\n        ndarray: rho (length, length) a density matrix.\n    Raises:\n        QiskitError: if the method is not valid.\n    \"\"\"\n    if arg_2 == 'Hilbert-Schmidt':\n        return __random_density_hs(arg_0, arg_1, arg_3)\n    elif arg_2 == 'Bures':\n        return __random_density_bures(arg_0, arg_1, arg_3)\n    else:\n        raise QiskitError('Error: unrecognized method {}'.format(arg_2))", "path": "qiskit/quantum_info/random/utils.py", "identifier": "random_density_matrix", "docstring": "Generate a random density matrix rho.\n\n    Args:\n        length (int): the length of the density matrix.\n        rank (int or None): the rank of the density matrix. The default\n            value is full-rank.\n        method (string): the method to use.\n            'Hilbert-Schmidt': sample rho from the Hilbert-Schmidt metric.\n            'Bures': sample rho from the Bures metric.\n        seed (int): Optional. To set a random seed.\n    Returns:\n        ndarray: rho (length, length) a density matrix.\n    Raises:\n        QiskitError: if the method is not valid.", "docstring_tokens": ["Generate", "a", "random", "density", "matrix", "rho", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253224}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_psmswindows.py#L101-L104", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return disk partitions.", "language": "python", "parameters": "(all)", "return_statement": "return [nt_partition(*x) for x in rawlist]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_psutil_mswindows", ".", "get_Func", "(", "arg_0", ")", "return", "[", "nt_partition", "(", "*", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]"], "function": "def Func(arg_0):\n    \"\"\"Return disk partitions.\"\"\"\n    arg_1 = _psutil_mswindows.get_Func(arg_0)\n    return [nt_partition(*arg_2) for arg_2 in arg_1]", "path": "environment/lib/python2.7/site-packages/psutil/_psmswindows.py", "identifier": "disk_partitions", "docstring": "Return disk partitions.", "docstring_tokens": ["Return", "disk", "partitions", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253225}
{"url": "https://github.com/svetlyak40wt/python-repr/blob/49e358e77b97d74f29f4977ea009ab2d64c254e8/src/magic_repr/__init__.py#L125-L177", "sha": "49e358e77b97d74f29f4977ea009ab2d64c254e8", "docstring_summary": "This function should return unicode representation of the value", "language": "python", "parameters": "(value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "id", "(", "arg_0", ")", "if", "arg_1", "in", "recursion_breaker", ".", "processed", ":", "return", "u'<recursion>'", "recursion_breaker", ".", "processed", ".", "add", "(", "arg_1", ")", "try", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "binary_type", ")", ":", "return", "u\"'{0}'\"", ".", "format", "(", "arg_0", ".", "decode", "(", "'utf-8'", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "six", ".", "text_type", ")", ":", "return", "u\"u'{0}'\"", ".", "format", "(", "arg_0", ")", "elif", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_2", "=", "list", "(", "map", "(", "Func", ",", "arg_0", ")", ")", "arg_3", "=", "serialize_list", "(", "u'['", ",", "arg_2", ",", "delimiter", "=", "u','", ")", "+", "u']'", "return", "force_unicode", "(", "arg_3", ")", "elif", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "arg_4", "=", "six", ".", "iteritems", "(", "arg_0", ")", "arg_4", "=", "(", "tuple", "(", "map", "(", "Func", ",", "item", ")", ")", "for", "item", "in", "arg_4", ")", "arg_4", "=", "list", "(", "arg_4", ")", "arg_4", ".", "sort", "(", ")", "arg_4", "=", "[", "serialize_text", "(", "u'{0}: '", ".", "format", "(", "key", ")", ",", "item_value", ")", "for", "key", ",", "item_value", "in", "arg_4", "]", "arg_3", "=", "serialize_list", "(", "u'{'", ",", "arg_4", ",", "delimiter", "=", "u','", ")", "+", "u'}'", "return", "force_unicode", "(", "arg_3", ")", "return", "force_unicode", "(", "repr", "(", "arg_0", ")", ")", "finally", ":", "recursion_breaker", ".", "processed", ".", "remove", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"This function should return unicode representation of the value\n    \"\"\"\n    arg_1 = id(arg_0)\n\n    if arg_1 in recursion_breaker.processed:\n        return u'<recursion>'\n\n    recursion_breaker.processed.add(arg_1)\n\n    try:\n        if isinstance(arg_0, six.binary_type):\n            # suppose, all byte strings are in unicode\n            # don't know if everybody in the world uses anything else?\n            return u\"'{0}'\".format(arg_0.decode('utf-8'))\n\n        elif isinstance(arg_0, six.text_type):\n            return u\"u'{0}'\".format(arg_0)\n\n        elif isinstance(arg_0, (list, tuple)):\n            # long lists or lists with multiline items\n            # will be shown vertically\n            arg_2 = list(map(Func, arg_0))\n            arg_3 = serialize_list(u'[', arg_2, delimiter=u',') + u']'\n            return force_unicode(arg_3)\n\n        elif isinstance(arg_0, dict):\n            arg_4 = six.iteritems(arg_0)\n\n            # format each key/value pair as a text,\n            # calling Func recursively\n            arg_4 = (tuple(map(Func, item))\n                     for item in arg_4)\n\n            arg_4 = list(arg_4)\n            # sort by keys for readability\n            arg_4.sort()\n\n            # for each item value\n            arg_4 = [\n                serialize_text(\n                    u'{0}: '.format(key),\n                    item_value)\n                for key, item_value in arg_4]\n\n            # and serialize these pieces as a list, enclosing\n            # them into a curve brackets\n            arg_3 = serialize_list(u'{', arg_4, delimiter=u',') + u'}'\n            return force_unicode(arg_3)\n        return force_unicode(repr(arg_0))\n\n    finally:\n        recursion_breaker.processed.remove(arg_1)", "path": "src/magic_repr/__init__.py", "identifier": "format_value", "docstring": "This function should return unicode representation of the value", "docstring_tokens": ["This", "function", "should", "return", "unicode", "representation", "of", "the", "value"], "nwo": "svetlyak40wt/python-repr", "score": 0.14991498758945482, "idx": 253226}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/assembly.py#L95-L117", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Convert the munging operations performed on H2OFrame into a POJO.", "language": "python", "parameters": "(self, pojo_name=\"\", path=\"\", get_jar=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "\"\"", ",", "arg_3", "=", "True", ")", ":", "assert_is_type", "(", "arg_1", ",", "str", ")", "assert_is_type", "(", "arg_2", ",", "str", ")", "assert_is_type", "(", "arg_3", ",", "bool", ")", "if", "arg_1", "==", "\"\"", ":", "arg_1", "=", "\"AssemblyPOJO_\"", "+", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "arg_4", "=", "h2o", ".", "api", "(", "\"GET /99/Assembly.java/%s/%s\"", "%", "(", "arg_0", ".", "id", ",", "arg_1", ")", ")", "arg_5", "=", "arg_2", "+", "\"/\"", "+", "arg_1", "+", "\".java\"", "if", "arg_2", "==", "\"\"", ":", "print", "(", "arg_4", ")", "else", ":", "with", "open", "(", "arg_5", ",", "'w'", ",", "encoding", "=", "\"utf-8\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_4", ")", "if", "arg_3", "and", "arg_2", "!=", "\"\"", ":", "h2o", ".", "api", "(", "\"GET /3/h2o-genmodel.jar\"", ",", "save_to", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "\"h2o-genmodel.jar\"", ")", ")"], "function": "def Func(arg_0, arg_1=\"\", arg_2=\"\", arg_3=True):\n        \"\"\"\n        Convert the munging operations performed on H2OFrame into a POJO.\n\n        :param pojo_name:  (str) Name of POJO\n        :param path:  (str) path of POJO.\n        :param get_jar: (bool) Whether to also download the h2o-genmodel.jar file needed to compile the POJO\n        :return: None\n        \"\"\"\n        assert_is_type(arg_1, str)\n        assert_is_type(arg_2, str)\n        assert_is_type(arg_3, bool)\n        if arg_1 == \"\":\n            arg_1 = \"AssemblyPOJO_\" + str(uuid.uuid4())\n        arg_4 = h2o.api(\"GET /99/Assembly.java/%s/%s\" % (arg_0.id, arg_1))\n        arg_5 = arg_2 + \"/\" + arg_1 + \".java\"\n        if arg_2 == \"\":\n            print(arg_4)\n        else:\n            with open(arg_5, 'w', encoding=\"utf-8\") as f:\n                f.write(arg_4)  # this had better be utf-8 ?\n        if arg_3 and arg_2 != \"\":\n            h2o.api(\"GET /3/h2o-genmodel.jar\", save_to=os.path.join(arg_2, \"h2o-genmodel.jar\"))", "path": "h2o-py/h2o/assembly.py", "identifier": "H2OAssembly.to_pojo", "docstring": "Convert the munging operations performed on H2OFrame into a POJO.\n\n        :param pojo_name:  (str) Name of POJO\n        :param path:  (str) path of POJO.\n        :param get_jar: (bool) Whether to also download the h2o-genmodel.jar file needed to compile the POJO\n        :return: None", "docstring_tokens": ["Convert", "the", "munging", "operations", "performed", "on", "H2OFrame", "into", "a", "POJO", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253227}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L243-L255", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Verify that the condition is valid.", "language": "python", "parameters": "(self, name, condition)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "is", "not", "None", "and", "arg_2", "[", "0", "]", ".", "name", "not", "in", "arg_0", ".", "cregs", ":", "raise", "DAGCircuitError", "(", "\"invalid creg in condition for %s\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Verify that the condition is valid.\n\n        Args:\n            name (string): used for error reporting\n            condition (tuple or None): a condition tuple (ClassicalRegister,int)\n\n        Raises:\n            DAGCircuitError: if conditioning on an invalid register\n        \"\"\"\n        # Verify creg exists\n        if arg_2 is not None and arg_2[0].name not in arg_0.cregs:\n            raise DAGCircuitError(\"invalid creg in condition for %s\" % arg_1)", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit._check_condition", "docstring": "Verify that the condition is valid.\n\n        Args:\n            name (string): used for error reporting\n            condition (tuple or None): a condition tuple (ClassicalRegister,int)\n\n        Raises:\n            DAGCircuitError: if conditioning on an invalid register", "docstring_tokens": ["Verify", "that", "the", "condition", "is", "valid", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253228}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/inspector.py#L250-L274", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "visit an astroid.ImportFrom node", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "modname", "arg_3", "=", "arg_1", ".", "root", "(", ")", ".", "file", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "modutils", ".", "is_relative", "(", "arg_2", ",", "arg_3", ")", "else", ":", "arg_4", "=", "False", "for", "arg_5", "in", "arg_1", ".", "names", ":", "if", "arg_5", "[", "0", "]", "==", "\"*\"", ":", "continue", "arg_6", "=", "\"%s.%s\"", "%", "(", "arg_2", ",", "arg_5", "[", "0", "]", ")", "if", "arg_6", ".", "find", "(", "\".\"", ")", ">", "-", "1", ":", "try", ":", "arg_6", "=", "modutils", ".", "get_module_part", "(", "arg_6", ",", "arg_3", ")", "except", "ImportError", ":", "continue", "if", "arg_6", "!=", "arg_2", ":", "arg_0", ".", "_imported_module", "(", "arg_1", ",", "arg_6", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"visit an astroid.ImportFrom node\n\n        resolve module dependencies\n        \"\"\"\n        arg_2 = arg_1.modname\n        arg_3 = arg_1.root().file\n        if arg_3 is not None:\n            arg_4 = modutils.is_relative(arg_2, arg_3)\n        else:\n            arg_4 = False\n        for arg_5 in arg_1.names:\n            if arg_5[0] == \"*\":\n                continue\n            # analyze dependencies\n            arg_6 = \"%s.%s\" % (arg_2, arg_5[0])\n            if arg_6.find(\".\") > -1:\n                try:\n                    # TODO: don't use get_module_part,\n                    # missing package precedence\n                    arg_6 = modutils.get_module_part(arg_6, arg_3)\n                except ImportError:\n                    continue\n            if arg_6 != arg_2:\n                arg_0._imported_module(arg_1, arg_6, arg_4)", "path": "pylint/pyreverse/inspector.py", "identifier": "Linker.visit_importfrom", "docstring": "visit an astroid.ImportFrom node\n\n        resolve module dependencies", "docstring_tokens": ["visit", "an", "astroid", ".", "ImportFrom", "node"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253229}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/iomanager.py#L149-L160", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Returns a stdin-suitable file-like object based on the\n        optional os_path and optionally skipping any configured\n        sub-command.", "language": "python", "parameters": "(self, os_path=None, skip_sub_command=False)", "return_statement": "return inn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "None", "if", "arg_2", "else", "arg_0", ".", "stdin_sub_command", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_get_in_and_path", "(", "arg_0", ".", "stdin", ",", "arg_0", ".", "stdin_root", ",", "arg_3", ",", "arg_1", ")", "if", "hasattr", "(", "arg_4", ",", "'stdout'", ")", ":", "return", "arg_4", ".", "stdout", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"\n        Returns a stdin-suitable file-like object based on the\n        optional os_path and optionally skipping any configured\n        sub-command.\n        \"\"\"\n        arg_3 = None if arg_2 else arg_0.stdin_sub_command\n        arg_4, arg_5 = arg_0._get_in_and_path(\n            arg_0.stdin, arg_0.stdin_root, arg_3, arg_1)\n        if hasattr(arg_4, 'stdout'):\n            return arg_4.stdout\n        return arg_4", "path": "swiftly/cli/iomanager.py", "identifier": "IOManager.get_stdin", "docstring": "Returns a stdin-suitable file-like object based on the\n        optional os_path and optionally skipping any configured\n        sub-command.", "docstring_tokens": ["Returns", "a", "stdin", "-", "suitable", "file", "-", "like", "object", "based", "on", "the", "optional", "os_path", "and", "optionally", "skipping", "any", "configured", "sub", "-", "command", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 253230}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/lookup.py#L75-L145", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Implementation of UNIX nslookup.", "language": "python", "parameters": "(cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "if", "\"current_test_data\"", "in", "arg_3", ".", "INTERN", ":", "if", "not", "Check", "(", ")", ".", "is_ip_valid", "(", ")", ":", "arg_1", "=", "arg_3", ".", "socket", ".", "getaddrinfo", "(", "arg_3", ".", "INTERN", "[", "\"to_test\"", "]", ",", "80", ",", "0", ",", "0", ",", "arg_3", ".", "socket", ".", "IPPROTO_TCP", ",", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", ".", "INTERN", "[", "\"current_test_data\"", "]", "[", "\"Func\"", "]", ".", "append", "(", "arg_2", "[", "-", "1", "]", "[", "0", "]", ")", "else", ":", "arg_1", "=", "arg_3", ".", "socket", ".", "gethostbyaddr", "(", "arg_3", ".", "INTERN", "[", "\"to_test\"", "]", ")", "arg_3", ".", "INTERN", "[", "\"current_test_data\"", "]", "[", "\"Func\"", "]", "[", "\"hostname\"", "]", "=", "arg_1", "[", "0", "]", "arg_3", ".", "INTERN", "[", "\"current_test_data\"", "]", "[", "\"Func\"", "]", "[", "\"aliases\"", "]", "=", "arg_1", "[", "1", "]", "arg_3", ".", "INTERN", "[", "\"current_test_data\"", "]", "[", "\"Func\"", "]", "[", "\"ips\"", "]", "=", "arg_1", "[", "2", "]", "else", ":", "if", "not", "Check", "(", ")", ".", "is_ip_valid", "(", ")", ":", "arg_3", ".", "socket", ".", "getaddrinfo", "(", "arg_3", ".", "INTERN", "[", "\"to_test\"", "]", ",", "80", ",", "0", ",", "0", ",", "arg_3", ".", "socket", ".", "IPPROTO_TCP", ",", ")", "else", ":", "arg_3", ".", "socket", ".", "gethostbyaddr", "(", "arg_3", ".", "INTERN", "[", "\"to_test\"", "]", ")", "return", "True", "except", "(", "OSError", ",", "arg_3", ".", "socket", ".", "herror", ",", "arg_3", ".", "socket", ".", "gaierror", ")", ":", "return", "False"], "function": "def Func(arg_0):\n        \"\"\"\n        Implementation of UNIX Func.\n        \"\"\"\n\n        try:\n            # We try to get the addresse information of the given domain or IP.\n\n            if \"current_test_data\" in arg_3.INTERN:  # pragma: no cover\n                # The end-user want more information whith his test.\n\n                if not Check().is_ip_valid():\n                    # The element we are testing is not an IP.\n\n                    # We request the address informations.\n                    arg_1 = arg_3.socket.getaddrinfo(\n                        arg_3.INTERN[\"to_test\"],\n                        80,\n                        0,\n                        0,\n                        arg_3.socket.IPPROTO_TCP,\n                    )\n\n                    for arg_2 in arg_1:\n                        # We loop through the sequence returned by the request.\n\n                        # We append the NS informations into the Func index.\n                        arg_3.INTERN[\"current_test_data\"][\"Func\"].append(\n                            arg_2[-1][0]\n                        )\n                else:\n                    # The element we are testing is an IP.\n                    arg_1 = arg_3.socket.gethostbyaddr(\n                        arg_3.INTERN[\"to_test\"]\n                    )\n\n                    # We append the NS informations into the Func index.\n                    arg_3.INTERN[\"current_test_data\"][\"Func\"][\n                        \"hostname\"\n                    ] = arg_1[0]\n                    arg_3.INTERN[\"current_test_data\"][\"Func\"][\n                        \"aliases\"\n                    ] = arg_1[1]\n                    arg_3.INTERN[\"current_test_data\"][\"Func\"][\"ips\"] = arg_1[\n                        2\n                    ]\n            else:\n\n                if not Check().is_ip_valid():\n                    # The element we are testing is not an IP.\n                    arg_3.socket.getaddrinfo(\n                        arg_3.INTERN[\"to_test\"],\n                        80,\n                        0,\n                        0,\n                        arg_3.socket.IPPROTO_TCP,\n                    )\n                else:\n                    # The element we are testing is an IP.\n                    arg_3.socket.gethostbyaddr(arg_3.INTERN[\"to_test\"])\n\n            # It was done successfuly, we return True.\n            # Note: we don't need to read the addresses so we consider as successful\n            # as long as there is no error.\n            return True\n\n        except (OSError, arg_3.socket.herror, arg_3.socket.gaierror):\n            # One of the listed exception is matched.\n\n            # It was done unsuccesfuly, we return False.\n            return False", "path": "PyFunceble/lookup.py", "identifier": "Lookup.nslookup", "docstring": "Implementation of UNIX nslookup.", "docstring_tokens": ["Implementation", "of", "UNIX", "nslookup", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 253231}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L486-L518", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Setup a handler to be called when a trait changes.", "language": "python", "parameters": "(self, handler, name=None, remove=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "if", "arg_3", ":", "arg_4", "=", "parse_notifier_name", "(", "arg_2", ")", "for", "arg_5", "in", "arg_4", ":", "arg_0", ".", "_remove_notifiers", "(", "arg_1", ",", "arg_5", ")", "else", ":", "arg_4", "=", "parse_notifier_name", "(", "arg_2", ")", "for", "arg_5", "in", "arg_4", ":", "arg_0", ".", "_add_notifiers", "(", "arg_1", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        \"\"\"Setup a handler to be called when a trait changes.\n\n        This is used to setup dynamic notifications of trait changes.\n\n        Static handlers can be created by creating methods on a HasTraits\n        subclass with the naming convention '_[traitname]_changed'.  Thus,\n        to create static handler for the trait 'a', create the method\n        _a_changed(self, name, old, new) (fewer arguments can be used, see\n        below).\n\n        Parameters\n        ----------\n        handler : callable\n            A callable that is called when a trait changes.  Its\n            signature can be handler(), handler(name), handler(name, new)\n            or handler(name, old, new).\n        name : list, str, None\n            If None, the handler will apply to all traits.  If a list\n            of str, handler will apply to all names in the list.  If a\n            str, the handler will apply just to that name.\n        remove : bool\n            If False (the default), then install the handler.  If True\n            then unintall it.\n        \"\"\"\n        if arg_3:\n            arg_4 = parse_notifier_name(arg_2)\n            for arg_5 in arg_4:\n                arg_0._remove_notifiers(arg_1, arg_5)\n        else:\n            arg_4 = parse_notifier_name(arg_2)\n            for arg_5 in arg_4:\n                arg_0._add_notifiers(arg_1, arg_5)", "path": "environment/lib/python2.7/site-packages/IPython/utils/traitlets.py", "identifier": "HasTraits.on_trait_change", "docstring": "Setup a handler to be called when a trait changes.\n\n        This is used to setup dynamic notifications of trait changes.\n\n        Static handlers can be created by creating methods on a HasTraits\n        subclass with the naming convention '_[traitname]_changed'.  Thus,\n        to create static handler for the trait 'a', create the method\n        _a_changed(self, name, old, new) (fewer arguments can be used, see\n        below).\n\n        Parameters\n        ----------\n        handler : callable\n            A callable that is called when a trait changes.  Its\n            signature can be handler(), handler(name), handler(name, new)\n            or handler(name, old, new).\n        name : list, str, None\n            If None, the handler will apply to all traits.  If a list\n            of str, handler will apply to all names in the list.  If a\n            str, the handler will apply just to that name.\n        remove : bool\n            If False (the default), then install the handler.  If True\n            then unintall it.", "docstring_tokens": ["Setup", "a", "handler", "to", "be", "called", "when", "a", "trait", "changes", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253232}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L104-L111", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Returns the min and max possible values for x within given constraints", "language": "python", "parameters": "(self, constraints, x, iters=10000)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "10000", ")", ":", "if", "issymbolic", "(", "arg_2", ")", ":", "arg_4", "=", "arg_0", ".", "min", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "max", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_4", ",", "arg_5", "else", ":", "return", "arg_2", ",", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=10000):\n        \"\"\"Returns the min and max possible values for x within given constraints\"\"\"\n        if issymbolic(arg_2):\n            arg_4 = arg_0.min(arg_1, arg_2, arg_3)\n            arg_5 = arg_0.max(arg_1, arg_2, arg_3)\n            return arg_4, arg_5\n        else:\n            return arg_2, arg_2", "path": "manticore/core/smtlib/solver.py", "identifier": "Solver.minmax", "docstring": "Returns the min and max possible values for x within given constraints", "docstring_tokens": ["Returns", "the", "min", "and", "max", "possible", "values", "for", "x", "within", "given", "constraints"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253233}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2185-L2194", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Return a folder list in a folder by given a folder path.", "language": "python", "parameters": "(path=\"\")", "return_statement": "return [os.path.join(path, o) for o in os.listdir(path) if os.path.isdir(os.path.join(path, o))]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"\"", ")", ":", "return", "[", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", "for", "arg_1", "in", "os", ".", "listdir", "(", "arg_0", ")", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", ")", "]"], "function": "def Func(arg_0=\"\"):\n    \"\"\"Return a folder list in a folder by given a folder path.\n\n    Parameters\n    ----------\n    path : str\n        A folder path.\n\n    \"\"\"\n    return [os.path.join(arg_0, arg_1) for arg_1 in os.listdir(arg_0) if os.path.isdir(os.path.join(arg_0, arg_1))]", "path": "tensorlayer/files/utils.py", "identifier": "load_folder_list", "docstring": "Return a folder list in a folder by given a folder path.\n\n    Parameters\n    ----------\n    path : str\n        A folder path.", "docstring_tokens": ["Return", "a", "folder", "list", "in", "a", "folder", "by", "given", "a", "folder", "path", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253234}
{"url": "https://github.com/encode/starlette/blob/d23bfd0d8ff68d535d0283aa4099e5055da88bb9/starlette/datastructures.py#L577-L589", "sha": "d23bfd0d8ff68d535d0283aa4099e5055da88bb9", "docstring_summary": "If the header `key` does not exist, then set it to `value`.\n        Returns the header value.", "language": "python", "parameters": "(self, key: str, value: str)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ")", "->", "arg_2", ":", "arg_4", "=", "arg_1", ".", "lower", "(", ")", ".", "encode", "(", "\"latin-1\"", ")", "arg_5", "=", "arg_3", ".", "encode", "(", "\"latin-1\"", ")", "for", "arg_6", ",", "(", "arg_7", ",", "arg_8", ")", "in", "enumerate", "(", "arg_0", ".", "_list", ")", ":", "if", "arg_7", "==", "arg_4", ":", "return", "arg_8", ".", "decode", "(", "\"latin-1\"", ")", "arg_0", ".", "_list", ".", "append", "(", "(", "arg_4", ",", "arg_5", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2) -> arg_2:\n        \"\"\"\n        If the header `key` does not exist, then set it to `value`.\n        Returns the header value.\n        \"\"\"\n        arg_4 = arg_1.lower().encode(\"latin-1\")\n        arg_5 = arg_3.encode(\"latin-1\")\n\n        for arg_6, (arg_7, arg_8) in enumerate(arg_0._list):\n            if arg_7 == arg_4:\n                return arg_8.decode(\"latin-1\")\n        arg_0._list.append((arg_4, arg_5))\n        return arg_3", "path": "starlette/datastructures.py", "identifier": "MutableHeaders.setdefault", "docstring": "If the header `key` does not exist, then set it to `value`.\n        Returns the header value.", "docstring_tokens": ["If", "the", "header", "key", "does", "not", "exist", "then", "set", "it", "to", "value", ".", "Returns", "the", "header", "value", "."], "nwo": "encode/starlette", "score": 0.9921761654937327, "idx": 253235}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L1804-L1842", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Helper to iterate over the files in a directory putting those in the passed StringIO in ini\n    format.", "language": "python", "parameters": "(directory, stringio, base='', exclude=None, include=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "import", "fnmatch", "import", "os", "arg_5", "=", "[", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "i", ")", ",", "i", ")", "for", "i", "in", "os", ".", "listdir", "(", "arg_0", ")", "]", "arg_5", "=", "[", "i", "for", "i", "in", "arg_5", "if", "os", ".", "path", ".", "isfile", "(", "i", "[", "0", "]", ")", "]", "for", "arg_6", ",", "arg_7", "in", "arg_5", ":", "if", "arg_4", "is", "not", "None", ":", "if", "not", "fnmatch", ".", "fnmatch", "(", "arg_6", ",", "arg_4", ")", ":", "continue", "if", "arg_3", "is", "not", "None", ":", "if", "fnmatch", ".", "fnmatch", "(", "arg_6", ",", "arg_3", ")", ":", "continue", "arg_8", "=", "Md5Hex", "(", "arg_6", ")", "if", "arg_2", ":", "arg_1", ".", "write", "(", "'%s/%s=%s\\n'", "%", "(", "arg_2", ",", "arg_7", ",", "arg_8", ")", ")", "else", ":", "arg_1", ".", "write", "(", "'%s=%s\\n'", "%", "(", "arg_7", ",", "arg_8", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2='', arg_3=None, arg_4=None):\n    '''\n    Helper to iterate over the files in a directory putting those in the passed StringIO in ini\n    format.\n\n    :param unicode directory:\n        The directory for which the hash should be done.\n\n    :param StringIO stringio:\n        The string to which the dump should be put.\n\n    :param unicode base:\n        If provided should be added (along with a '/') before the name=hash of file.\n\n    :param unicode exclude:\n        Pattern to match files to exclude from the hashing. E.g.: *.gz\n\n    :param unicode include:\n        Pattern to match files to include in the hashing. E.g.: *.zip\n    '''\n    import fnmatch\n    import os\n\n    arg_5 = [(os.path.join(arg_0, i), i) for i in os.listdir(arg_0)]\n    arg_5 = [i for i in arg_5 if os.path.isfile(i[0])]\n    for arg_6, arg_7 in arg_5:\n        if arg_4 is not None:\n            if not fnmatch.fnmatch(arg_6, arg_4):\n                continue\n\n        if arg_3 is not None:\n            if fnmatch.fnmatch(arg_6, arg_3):\n                continue\n\n        arg_8 = Md5Hex(arg_6)\n        if arg_2:\n            arg_1.write('%s/%s=%s\\n' % (arg_2, arg_7, arg_8))\n        else:\n            arg_1.write('%s=%s\\n' % (arg_7, arg_8))", "path": "zerotk/easyfs/_easyfs.py", "identifier": "DumpDirHashToStringIO", "docstring": "Helper to iterate over the files in a directory putting those in the passed StringIO in ini\n    format.\n\n    :param unicode directory:\n        The directory for which the hash should be done.\n\n    :param StringIO stringio:\n        The string to which the dump should be put.\n\n    :param unicode base:\n        If provided should be added (along with a '/') before the name=hash of file.\n\n    :param unicode exclude:\n        Pattern to match files to exclude from the hashing. E.g.: *.gz\n\n    :param unicode include:\n        Pattern to match files to include in the hashing. E.g.: *.zip", "docstring_tokens": ["Helper", "to", "iterate", "over", "the", "files", "in", "a", "directory", "putting", "those", "in", "the", "passed", "StringIO", "in", "ini", "format", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 253236}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L156-L163", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Long explanation of the value from the numeric value\n        with optional extra bits\n        Used by Layout.verboseRead when printing the value", "language": "python", "parameters": "(self, extra=None)", "return_statement": "return self.code.callback(self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ".", "code", ",", "WithExtra", ")", ":", "return", "arg_0", ".", "code", ".", "callback", "(", "arg_0", ",", "arg_1", ")", "return", "arg_0", ".", "code", ".", "callback", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Long Func of the value from the numeric value\n        with optional extra bits\n        Used by Layout.verboseRead when printing the value\n        \"\"\"\n        if isinstance(arg_0.code, WithExtra):\n            return arg_0.code.callback(arg_0, arg_1)\n        return arg_0.code.callback(arg_0)", "path": "research/brotlidump.py", "identifier": "Symbol.explanation", "docstring": "Long explanation of the value from the numeric value\n        with optional extra bits\n        Used by Layout.verboseRead when printing the value", "docstring_tokens": ["Long", "explanation", "of", "the", "value", "from", "the", "numeric", "value", "with", "optional", "extra", "bits", "Used", "by", "Layout", ".", "verboseRead", "when", "printing", "the", "value"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 253237}
{"url": "https://github.com/ewilazarus/yld/blob/157e474d1055f14ffdfd7e99da6c77d5f17d4307/yld/__main__.py#L26-L38", "sha": "157e474d1055f14ffdfd7e99da6c77d5f17d4307", "docstring_summary": "Semver tag triggered deployment helper", "language": "python", "parameters": "(target, label)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check_environment", "(", "arg_0", ",", "arg_1", ")", "click", ".", "secho", "(", "'Fetching tags from the upstream ...'", ")", "arg_2", "=", "TagHandler", "(", "git", ".", "list_tags", "(", ")", ")", "print_information", "(", "arg_2", ",", "arg_1", ")", "arg_3", "=", "arg_2", ".", "yield_tag", "(", "arg_0", ",", "arg_1", ")", "confirm", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Semver tag triggered deployment helper\n    \"\"\"\n    check_environment(arg_0, arg_1)\n\n    click.secho('Fetching tags from the upstream ...')\n    arg_2 = TagHandler(git.list_tags())\n\n    print_information(arg_2, arg_1)\n\n    arg_3 = arg_2.yield_tag(arg_0, arg_1)\n    confirm(arg_3)", "path": "yld/__main__.py", "identifier": "main", "docstring": "Semver tag triggered deployment helper", "docstring_tokens": ["Semver", "tag", "triggered", "deployment", "helper"], "nwo": "ewilazarus/yld", "score": 0.09252797783733271, "idx": 253238}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L117-L123", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Return the first element of an array", "language": "python", "parameters": "(self)", "return_statement": "return BoltArrayLocal(rdd.values().first())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "bolt", ".", "local", ".", "array", "import", "BoltArrayLocal", "arg_1", "=", "arg_0", ".", "_rdd", "if", "arg_0", ".", "_ordered", "else", "arg_0", ".", "_rdd", ".", "sortByKey", "(", ")", "return", "BoltArrayLocal", "(", "arg_1", ".", "values", "(", ")", ".", "Func", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the Func element of an array\n        \"\"\"\n        from bolt.local.array import BoltArrayLocal\n        arg_1 = arg_0._rdd if arg_0._ordered else arg_0._rdd.sortByKey()\n        return BoltArrayLocal(arg_1.values().Func())", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark.first", "docstring": "Return the first element of an array", "docstring_tokens": ["Return", "the", "first", "element", "of", "an", "array"], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 253239}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L40-L61", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Groups line reference together", "language": "python", "parameters": "(text, getreffs, lines=30)", "return_statement": "return reffs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "30", ")", ":", "arg_3", "=", "len", "(", "arg_0", ".", "citation", ")", "arg_4", "=", "[", "reff", ".", "split", "(", "\":\"", ")", "[", "-", "1", "]", "for", "reff", "in", "arg_1", "(", "arg_3", "=", "arg_3", ")", "]", "arg_5", "=", "[", "]", "arg_6", "=", "0", "while", "arg_6", "+", "arg_2", "-", "1", "<", "len", "(", "arg_4", ")", ":", "arg_5", ".", "append", "(", "tuple", "(", "[", "arg_4", "[", "arg_6", "]", "+", "\"-\"", "+", "arg_4", "[", "arg_6", "+", "arg_2", "-", "1", "]", ",", "arg_4", "[", "arg_6", "]", "]", ")", ")", "arg_6", "+=", "arg_2", "if", "arg_6", "<", "len", "(", "arg_4", ")", ":", "arg_5", ".", "append", "(", "tuple", "(", "[", "arg_4", "[", "arg_6", "]", "+", "\"-\"", "+", "arg_4", "[", "len", "(", "arg_4", ")", "-", "1", "]", ",", "arg_4", "[", "arg_6", "]", "]", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=30):\n    \"\"\" Groups line reference together\n\n    :param text: Text object\n    :type text: MyCapytains.resources.text.api\n    :param getreffs: Callback function to retrieve text\n    :type getreffs: function(level)\n    :param lines: Number of lines to use by group\n    :type lines: int\n    :return: List of grouped urn references with their human readable version\n    :rtype: [(str, str)]\n    \"\"\"\n    arg_3 = len(arg_0.citation)\n    arg_4 = [reff.split(\":\")[-1] for reff in arg_1(arg_3=arg_3)]\n    arg_5 = []\n    arg_6 = 0\n    while arg_6 + arg_2 - 1 < len(arg_4):\n        arg_5.append(tuple([arg_4[arg_6]+\"-\"+arg_4[arg_6+arg_2-1], arg_4[arg_6]]))\n        arg_6 += arg_2\n    if arg_6 < len(arg_4):\n        arg_5.append(tuple([arg_4[arg_6]+\"-\"+arg_4[len(arg_4)-1], arg_4[arg_6]]))\n    return arg_5", "path": "flask_nemo/chunker.py", "identifier": "line_chunker", "docstring": "Groups line reference together\n\n    :param text: Text object\n    :type text: MyCapytains.resources.text.api\n    :param getreffs: Callback function to retrieve text\n    :type getreffs: function(level)\n    :param lines: Number of lines to use by group\n    :type lines: int\n    :return: List of grouped urn references with their human readable version\n    :rtype: [(str, str)]", "docstring_tokens": ["Groups", "line", "reference", "together"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 253240}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_distance.py#L79-L99", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return absolute distance.", "language": "python", "parameters": "(self, src, tar, *args, **kwargs)", "return_statement": "return self.dist(src, tar, *args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "return", "arg_0", ".", "dist", "(", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        \"\"\"Return absolute distance.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        *args\n            Variable length argument list.\n        **kwargs\n            Arbitrary keyword arguments.\n\n        Returns\n        -------\n        int\n            Absolute distance\n\n        \"\"\"\n        return arg_0.dist(arg_1, arg_2, *arg_3, **arg_4)", "path": "abydos/distance/_distance.py", "identifier": "_Distance.dist_abs", "docstring": "Return absolute distance.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        *args\n            Variable length argument list.\n        **kwargs\n            Arbitrary keyword arguments.\n\n        Returns\n        -------\n        int\n            Absolute distance", "docstring_tokens": ["Return", "absolute", "distance", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253241}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/validators.py#L8-L24", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Perform a quick check on a BAM via `samtools quickcheck`.\n    This will detect obvious BAM errors such as truncation.", "language": "python", "parameters": "(bam_path)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "os", ".", "path", ".", "split", "(", "arg_0", ")", "arg_3", "=", "subprocess", ".", "call", "(", "[", "'docker'", ",", "'run'", ",", "'-v'", ",", "arg_1", "+", "':/data'", ",", "'quay.io/ucsc_cgl/samtools:1.3--256539928ea162949d8a65ca5c79a72ef557ce7c'", ",", "'quickcheck'", ",", "'-vv'", ",", "'/data/'", "+", "arg_2", "]", ")", "if", "arg_3", "!=", "0", ":", "return", "False", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"\n    Perform a quick check on a BAM via `samtools quickcheck`.\n    This will detect obvious BAM errors such as truncation.\n\n    :param str bam_path: path to BAM file to checked\n\n    :rtype: boolean\n    :return: True if the BAM is valid, False is BAM is invalid or something related to the call went wrong\n    \"\"\"\n    arg_1, arg_2 = os.path.split(arg_0)\n    arg_3 = subprocess.call(['docker', 'run', '-v', arg_1 + ':/data',\n                                 'quay.io/ucsc_cgl/samtools:1.3--256539928ea162949d8a65ca5c79a72ef557ce7c',\n                                 'quickcheck', '-vv', '/data/' + arg_2])\n    if arg_3 != 0:\n        return False\n    return True", "path": "src/toil_lib/validators.py", "identifier": "bam_quickcheck", "docstring": "Perform a quick check on a BAM via `samtools quickcheck`.\n    This will detect obvious BAM errors such as truncation.\n\n    :param str bam_path: path to BAM file to checked\n\n    :rtype: boolean\n    :return: True if the BAM is valid, False is BAM is invalid or something related to the call went wrong", "docstring_tokens": ["Perform", "a", "quick", "check", "on", "a", "BAM", "via", "samtools", "quickcheck", ".", "This", "will", "detect", "obvious", "BAM", "errors", "such", "as", "truncation", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 253242}
{"url": "https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/mixin.py#L49-L79", "sha": "51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126", "docstring_summary": "Parse arguments to mixin. Add them to scope\n        as variables. Sets upp special variable", "language": "python", "parameters": "(self, args, scope)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "list", "(", "zip", "(", "arg_1", ",", "[", "' '", "]", "*", "len", "(", "arg_1", ")", ")", ")", "if", "arg_1", "and", "arg_1", "[", "0", "]", "else", "None", "arg_4", "=", "itertools", ".", "zip_longest", "if", "sys", ".", "version_info", "[", "0", "]", "==", "3", "else", "itertools", ".", "izip_longest", "if", "arg_0", ".", "args", ":", "arg_5", "=", "[", "v", "if", "hasattr", "(", "v", ",", "'parse'", ")", "else", "v", "for", "v", "in", "copy", ".", "copy", "(", "arg_0", ".", "args", ")", "]", "arg_1", "=", "arg_1", "if", "isinstance", "(", "arg_1", ",", "list", ")", "else", "[", "arg_1", "]", "arg_6", "=", "[", "arg_0", ".", "_parse_arg", "(", "arg_7", ",", "arg", ",", "arg_2", ")", "for", "arg", ",", "arg_7", "in", "arg_4", "(", "[", "a", "for", "a", "in", "arg_1", "]", ",", "arg_5", ")", "]", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", ":", "arg_7", ".", "parse", "(", "arg_2", ")", "if", "not", "arg_3", ":", "arg_3", "=", "[", "v", ".", "value", "for", "v", "in", "arg_6", "if", "v", "]", "if", "not", "arg_3", ":", "arg_3", "=", "''", "Variable", "(", "[", "'@arguments'", ",", "None", ",", "arg_3", "]", ")", ".", "parse", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Parse arguments to mixin. Add them to scope\n        as variables. Sets upp special variable @arguments\n        as well.\n        args:\n            args (list): arguments\n            scope (Scope): current scope\n        raises:\n            SyntaxError\n        \"\"\"\n        arg_3 = list(zip(arg_1,\n                             [' '] * len(arg_1))) if arg_1 and arg_1[0] else None\n        arg_4 = itertools.zip_longest if sys.version_info[\n            0] == 3 else itertools.izip_longest\n        if arg_0.args:\n            arg_5 = [\n                v if hasattr(v, 'parse') else v for v in copy.copy(arg_0.args)\n            ]\n            arg_1 = arg_1 if isinstance(arg_1, list) else [arg_1]\n            arg_6 = [\n                arg_0._parse_arg(arg_7, arg, arg_2)\n                for arg, arg_7 in arg_4([a for a in arg_1], arg_5)\n            ]\n            for arg_7 in arg_6:\n                if arg_7:\n                    arg_7.parse(arg_2)\n            if not arg_3:\n                arg_3 = [v.value for v in arg_6 if v]\n        if not arg_3:\n            arg_3 = ''\n        Variable(['@arguments', None, arg_3]).parse(arg_2)", "path": "lesscpy/plib/mixin.py", "identifier": "Mixin.parse_args", "docstring": "Parse arguments to mixin. Add them to scope\n        as variables. Sets upp special variable @arguments\n        as well.\n        args:\n            args (list): arguments\n            scope (Scope): current scope\n        raises:\n            SyntaxError", "docstring_tokens": ["Parse", "arguments", "to", "mixin", ".", "Add", "them", "to", "scope", "as", "variables", ".", "Sets", "upp", "special", "variable"], "nwo": "lesscpy/lesscpy", "score": 0.36630042150969844, "idx": 253243}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L110-L123", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get a list of all available fields for an object.", "language": "python", "parameters": "(self, obj)", "return_statement": "return [field['name'] for field in obj_description['fields']]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "get_conn", "(", ")", "arg_2", "=", "arg_0", ".", "describe_object", "(", "arg_1", ")", "return", "[", "arg_3", "[", "'name'", "]", "for", "arg_3", "in", "arg_2", "[", "'fields'", "]", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get a list of all available fields for an object.\n\n        :param obj: The name of the Salesforce object that we are getting a description of.\n        :type obj: str\n        :return: the names of the fields.\n        :rtype: list of str\n        \"\"\"\n        arg_0.get_conn()\n\n        arg_2 = arg_0.describe_object(arg_1)\n\n        return [arg_3['name'] for arg_3 in arg_2['fields']]", "path": "airflow/contrib/hooks/salesforce_hook.py", "identifier": "SalesforceHook.get_available_fields", "docstring": "Get a list of all available fields for an object.\n\n        :param obj: The name of the Salesforce object that we are getting a description of.\n        :type obj: str\n        :return: the names of the fields.\n        :rtype: list of str", "docstring_tokens": ["Get", "a", "list", "of", "all", "available", "fields", "for", "an", "object", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253244}
{"url": "https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L865-L951", "sha": "a8ca577b3ccf9d9fa48f16f4954a1eddd5896236", "docstring_summary": "Performs a step to establish the context as an acceptor.", "language": "python", "parameters": "(self, input_token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "arg_3", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "arg_3", "[", "0", "]", ".", "length", "=", "len", "(", "arg_1", ")", "arg_5", "=", "ffi", ".", "new", "(", "'char[]'", ",", "arg_1", ")", "arg_3", "[", "0", "]", ".", "value", "=", "arg_5", "arg_7", "=", "ffi", ".", "new", "(", "'gss_OID[1]'", ")", "arg_8", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "arg_9", "=", "ffi", ".", "new", "(", "'gss_name_t[1]'", ")", "arg_10", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "arg_11", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "arg_12", "=", "ffi", ".", "new", "(", "'gss_cred_id_t[1]'", ")", "if", "arg_0", ".", "_cred_object", "is", "not", "None", ":", "arg_13", "=", "arg_0", ".", "_cred_object", ".", "_cred", "[", "0", "]", "else", ":", "arg_13", "=", "ffi", ".", "cast", "(", "'gss_cred_id_t'", ",", "C", ".", "GSS_C_NO_CREDENTIAL", ")", "arg_14", "=", "C", ".", "gss_accept_sec_context", "(", "arg_2", ",", "arg_0", ".", "_ctx", ",", "arg_13", ",", "arg_3", ",", "arg_0", ".", "_channel_bindings", ",", "arg_9", ",", "arg_7", ",", "arg_8", ",", "arg_10", ",", "arg_11", ",", "arg_12", ")", "if", "arg_9", "[", "0", "]", ":", "arg_15", "=", "MechName", "(", "arg_9", ",", "arg_7", "[", "0", "]", ")", "try", ":", "if", "arg_8", "[", "0", "]", ".", "length", "!=", "0", ":", "arg_16", "=", "_buf_to_str", "(", "arg_8", "[", "0", "]", ")", "else", ":", "arg_16", "=", "None", "if", "GSS_ERROR", "(", "arg_14", ")", ":", "if", "arg_2", "[", "0", "]", "and", "arg_7", "[", "0", "]", ":", "raise", "_exception_for_status", "(", "arg_14", ",", "arg_2", "[", "0", "]", ",", "arg_7", "[", "0", "]", ",", "arg_16", ")", "else", ":", "raise", "_exception_for_status", "(", "arg_14", ",", "arg_2", "[", "0", "]", ",", "None", ",", "arg_16", ")", "arg_0", ".", "established", "=", "not", "(", "arg_14", "&", "C", ".", "GSS_S_CONTINUE_NEEDED", ")", "arg_0", ".", "flags", "=", "arg_10", "[", "0", "]", "if", "(", "arg_0", ".", "flags", "&", "C", ".", "GSS_C_DELEG_FLAG", ")", ":", "arg_0", ".", "delegated_cred", "=", "Credential", "(", "arg_12", ")", "if", "arg_7", "[", "0", "]", ":", "arg_0", ".", "mech_type", "=", "OID", "(", "arg_7", "[", "0", "]", "[", "0", "]", ")", "if", "arg_9", "[", "0", "]", ":", "arg_15", ".", "_mech_type", "=", "arg_0", ".", "mech_type", "arg_0", ".", "peer_name", "=", "arg_15", "return", "arg_16", "except", ":", "if", "arg_0", ".", "_ctx", ":", "C", ".", "gss_delete_sec_context", "(", "arg_2", ",", "arg_0", ".", "_ctx", ",", "ffi", ".", "cast", "(", "'gss_buffer_t'", ",", "C", ".", "GSS_C_NO_BUFFER", ")", ")", "arg_0", ".", "_reset_flags", "(", ")", "raise", "finally", ":", "if", "arg_8", "[", "0", "]", ".", "length", "!=", "0", ":", "C", ".", "gss_release_buffer", "(", "arg_2", ",", "arg_8", ")", "if", "arg_12", "[", "0", "]", "and", "not", "arg_0", ".", "delegated_cred", ":", "C", ".", "gss_release_cred", "(", "arg_2", ",", "arg_12", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Performs a Func to establish the context as an acceptor.\n\n        This method should be called in a loop and fed input tokens from the initiator, and its\n        output tokens should be sent to the initiator, until this context's :attr:`established`\n        attribute is True.\n\n        :param input_token: The input token from the initiator (required).\n        :type input_token: bytes\n        :returns: either a byte string with the next token to send to the initiator,\n            or None if there is no further token to send to the initiator.\n        :raises: :exc:`~gssapi.error.GSSException` if there is an error establishing the context.\n        \"\"\"\n        arg_2 = ffi.new('OM_uint32[1]')\n        arg_3 = ffi.new('gss_buffer_desc[1]')\n        arg_3[0].length = len(arg_1)\n        arg_5 = ffi.new('char[]', arg_1)\n        arg_3[0].value = arg_5\n\n        arg_7 = ffi.new('gss_OID[1]')\n        arg_8 = ffi.new('gss_buffer_desc[1]')\n        arg_9 = ffi.new('gss_name_t[1]')\n        arg_10 = ffi.new('OM_uint32[1]')\n        arg_11 = ffi.new('OM_uint32[1]')\n        arg_12 = ffi.new('gss_cred_id_t[1]')\n\n        if arg_0._cred_object is not None:\n            arg_13 = arg_0._cred_object._cred[0]\n        else:\n            arg_13 = ffi.cast('gss_cred_id_t', C.GSS_C_NO_CREDENTIAL)\n\n        arg_14 = C.gss_accept_sec_context(\n            arg_2,\n            arg_0._ctx,\n            arg_13,\n            arg_3,\n            arg_0._channel_bindings,\n            arg_9,\n            arg_7,\n            arg_8,\n            arg_10,\n            arg_11,\n            arg_12\n        )\n        if arg_9[0]:\n            arg_15 = MechName(arg_9, arg_7[0])  # make sure src_name is GC'd\n        try:\n            if arg_8[0].length != 0:\n                arg_16 = _buf_to_str(arg_8[0])\n            else:\n                arg_16 = None\n\n            if GSS_ERROR(arg_14):\n                if arg_2[0] and arg_7[0]:\n                    raise _exception_for_status(arg_14, arg_2[0], arg_7[0], arg_16)\n                else:\n                    raise _exception_for_status(arg_14, arg_2[0], None, arg_16)\n\n            arg_0.established = not (arg_14 & C.GSS_S_CONTINUE_NEEDED)\n            arg_0.flags = arg_10[0]\n\n            if (arg_0.flags & C.GSS_C_DELEG_FLAG):\n                arg_0.delegated_cred = Credential(arg_12)\n\n            if arg_7[0]:\n                arg_0.mech_type = OID(arg_7[0][0])\n\n                if arg_9[0]:\n                    arg_15._mech_type = arg_0.mech_type\n                    arg_0.peer_name = arg_15\n\n            return arg_16\n        except:\n            if arg_0._ctx:\n                C.gss_delete_sec_context(\n                    arg_2,\n                    arg_0._ctx,\n                    ffi.cast('gss_buffer_t', C.GSS_C_NO_BUFFER)\n                )\n                arg_0._reset_flags()\n            raise\n        finally:\n            if arg_8[0].length != 0:\n                C.gss_release_buffer(arg_2, arg_8)\n            # if self.delegated_cred is present, it will handle gss_release_cred:\n            if arg_12[0] and not arg_0.delegated_cred:\n                C.gss_release_cred(arg_2, arg_12)", "path": "gssapi/ctx.py", "identifier": "AcceptContext.step", "docstring": "Performs a step to establish the context as an acceptor.\n\n        This method should be called in a loop and fed input tokens from the initiator, and its\n        output tokens should be sent to the initiator, until this context's :attr:`established`\n        attribute is True.\n\n        :param input_token: The input token from the initiator (required).\n        :type input_token: bytes\n        :returns: either a byte string with the next token to send to the initiator,\n            or None if there is no further token to send to the initiator.\n        :raises: :exc:`~gssapi.error.GSSException` if there is an error establishing the context.", "docstring_tokens": ["Performs", "a", "step", "to", "establish", "the", "context", "as", "an", "acceptor", "."], "nwo": "sigmaris/python-gssapi", "score": 0.19566648960152894, "idx": 253245}
{"url": "https://github.com/seiferma/deterministic_encryption_utils/blob/a747da3cd6daf39b0c26d4d497725e8863af1dd1/deterministic_encryption_utils/encryption/Padding.py#L64-L102", "sha": "a747da3cd6daf39b0c26d4d497725e8863af1dd1", "docstring_summary": "Remove standard padding.", "language": "python", "parameters": "(padded_data, block_size, style='pkcs7')", "return_statement": "return padded_data[:-padding_len]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'pkcs7'", ")", ":", "arg_3", "=", "len", "(", "arg_0", ")", "if", "arg_3", "%", "arg_1", ":", "raise", "ValueError", "(", "\"Input data is not padded\"", ")", "if", "arg_2", "in", "(", "'pkcs7'", ",", "'x923'", ")", ":", "arg_4", "=", "bord", "(", "arg_0", "[", "-", "1", "]", ")", "if", "arg_4", "<", "1", "or", "arg_4", ">", "min", "(", "arg_1", ",", "arg_3", ")", ":", "raise", "ValueError", "(", "\"Padding is incorrect.\"", ")", "if", "arg_2", "==", "'pkcs7'", ":", "if", "arg_0", "[", "-", "arg_4", ":", "]", "!=", "bchr", "(", "arg_4", ")", "*", "arg_4", ":", "raise", "ValueError", "(", "\"PKCS#7 padding is incorrect.\"", ")", "else", ":", "if", "arg_0", "[", "-", "arg_4", ":", "-", "1", "]", "!=", "bchr", "(", "0", ")", "*", "(", "arg_4", "-", "1", ")", ":", "raise", "ValueError", "(", "\"ANSI X.923 padding is incorrect.\"", ")", "elif", "arg_2", "==", "'iso7816'", ":", "arg_4", "=", "arg_3", "-", "arg_0", ".", "rfind", "(", "bchr", "(", "128", ")", ")", "if", "arg_4", "<", "1", "or", "arg_4", ">", "min", "(", "arg_1", ",", "arg_3", ")", ":", "raise", "ValueError", "(", "\"Padding is incorrect.\"", ")", "if", "arg_4", ">", "1", "and", "arg_0", "[", "1", "-", "arg_4", ":", "]", "!=", "bchr", "(", "0", ")", "*", "(", "arg_4", "-", "1", ")", ":", "raise", "ValueError", "(", "\"ISO 7816-4 padding is incorrect.\"", ")", "else", ":", "raise", "ValueError", "(", "\"Unknown padding style\"", ")", "return", "arg_0", "[", ":", "-", "arg_4", "]"], "function": "def Func(arg_0, arg_1, arg_2='pkcs7'):\n    \"\"\"Remove standard padding.\n\n    :Parameters:\n      padded_data : byte string\n        A piece of data with padding that needs to be stripped.\n      block_size : integer\n        The block boundary to use for padding. The input length\n        must be a multiple of ``block_size``.\n      style : string\n        Padding algorithm. It can be *'pkcs7'* (default), *'iso7816'* or *'x923'*.\n    :Return:\n        Data without padding.\n    :Raises ValueError:\n        if the padding is incorrect.\n    \"\"\"\n\n    arg_3 = len(arg_0)\n    if arg_3 % arg_1:\n        raise ValueError(\"Input data is not padded\")\n    if arg_2 in ('pkcs7', 'x923'):\n        arg_4 = bord(arg_0[-1])\n        if arg_4<1 or arg_4>min(arg_1, arg_3):\n            raise ValueError(\"Padding is incorrect.\")\n        if arg_2 == 'pkcs7':\n            if arg_0[-arg_4:]!=bchr(arg_4)*arg_4:\n                raise ValueError(\"PKCS#7 padding is incorrect.\")\n        else:\n            if arg_0[-arg_4:-1]!=bchr(0)*(arg_4-1):\n                raise ValueError(\"ANSI X.923 padding is incorrect.\")\n    elif arg_2 == 'iso7816':\n        arg_4 = arg_3 - arg_0.rfind(bchr(128))\n        if arg_4<1 or arg_4>min(arg_1, arg_3):\n            raise ValueError(\"Padding is incorrect.\")\n        if arg_4>1 and arg_0[1-arg_4:]!=bchr(0)*(arg_4-1):\n            raise ValueError(\"ISO 7816-4 padding is incorrect.\")\n    else:\n        raise ValueError(\"Unknown padding style\")\n    return arg_0[:-arg_4]", "path": "deterministic_encryption_utils/encryption/Padding.py", "identifier": "unpad", "docstring": "Remove standard padding.\n\n    :Parameters:\n      padded_data : byte string\n        A piece of data with padding that needs to be stripped.\n      block_size : integer\n        The block boundary to use for padding. The input length\n        must be a multiple of ``block_size``.\n      style : string\n        Padding algorithm. It can be *'pkcs7'* (default), *'iso7816'* or *'x923'*.\n    :Return:\n        Data without padding.\n    :Raises ValueError:\n        if the padding is incorrect.", "docstring_tokens": ["Remove", "standard", "padding", "."], "nwo": "seiferma/deterministic_encryption_utils", "score": 0.09252797783733271, "idx": 253246}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/interfaceLevel/propDeclrCollector.py#L247-L255", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Register unit object on interface level object", "language": "python", "parameters": "(self, uName, unit)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "nameAvailabilityCheck", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "assert", "arg_2", ".", "_parent", "is", "None", "arg_2", ".", "_parent", "=", "arg_0", "arg_2", ".", "_name", "=", "arg_1", "arg_0", ".", "_units", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Register unit object on interface level object\n        \"\"\"\n        nameAvailabilityCheck(arg_0, arg_1, arg_2)\n        assert arg_2._parent is None\n        arg_2._parent = arg_0\n        arg_2._name = arg_1\n        arg_0._units.append(arg_2)", "path": "hwt/synthesizer/interfaceLevel/propDeclrCollector.py", "identifier": "PropDeclrCollector._registerUnit", "docstring": "Register unit object on interface level object", "docstring_tokens": ["Register", "unit", "object", "on", "interface", "level", "object"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 253247}
{"url": "https://github.com/mikeboers/PyAV/blob/9414187088b9b8dbaa180cfe1db6ceba243184ea/av/datasets.py#L120-L127", "sha": "9414187088b9b8dbaa180cfe1db6ceba243184ea", "docstring_summary": "Download and return a path to a sample that is curated by the PyAV developers.", "language": "python", "parameters": "(name)", "return_statement": "return cached_download('https://docs.mikeboers.com/pyav/samples/' + name,\n                           os.path.join('pyav-curated', name.replace('/', os.path.sep)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "cached_download", "(", "'https://docs.mikeboers.com/pyav/samples/'", "+", "arg_0", ",", "os", ".", "path", ".", "join", "(", "'pyav-Func'", ",", "arg_0", ".", "replace", "(", "'/'", ",", "os", ".", "path", ".", "sep", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Download and return a path to a sample that is Func by the PyAV developers.\n\n    Data is handled by :func:`cached_download`.\n\n    \"\"\"\n    return cached_download('https://docs.mikeboers.com/pyav/samples/' + arg_0,\n                           os.path.join('pyav-Func', arg_0.replace('/', os.path.sep)))", "path": "av/datasets.py", "identifier": "curated", "docstring": "Download and return a path to a sample that is curated by the PyAV developers.\n\n    Data is handled by :func:`cached_download`.", "docstring_tokens": ["Download", "and", "return", "a", "path", "to", "a", "sample", "that", "is", "curated", "by", "the", "PyAV", "developers", "."], "nwo": "mikeboers/PyAV", "score": 0.7842860952082583, "idx": 253248}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/summary.py#L17-L86", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Writes a report summarizing coverage statistics per module.", "language": "python", "parameters": "(self, morfs, outfile=None)", "return_statement": "return total.pc_covered", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "find_code_units", "(", "arg_1", ")", "arg_3", "=", "max", "(", "[", "len", "(", "arg_11", ".", "name", ")", "for", "arg_11", "in", "arg_0", ".", "code_units", "]", "+", "[", "5", "]", ")", "arg_4", "=", "\"%%- %ds  \"", "%", "arg_3", "arg_5", "=", "\"%s   %s: %s\\n\"", "arg_6", "=", "(", "arg_4", "%", "\"Name\"", ")", "+", "\" Stmts   Miss\"", "arg_7", "=", "arg_4", "+", "\"%6d %6d\"", "if", "arg_0", ".", "branches", ":", "arg_6", "+=", "\" Branch BrMiss\"", "arg_7", "+=", "\" %6d %6d\"", "arg_8", "=", "Numbers", ".", "pc_str_width", "(", ")", "arg_6", "+=", "\"%*s\"", "%", "(", "arg_8", "+", "4", ",", "\"Cover\"", ")", "arg_7", "+=", "\"%%%ds%%%%\"", "%", "(", "arg_8", "+", "3", ",", ")", "if", "arg_0", ".", "config", ".", "show_missing", ":", "arg_6", "+=", "\"   Missing\"", "arg_7", "+=", "\"   %s\"", "arg_9", "=", "\"-\"", "*", "len", "(", "arg_6", ")", "+", "\"\\n\"", "arg_6", "+=", "\"\\n\"", "arg_7", "+=", "\"\\n\"", "if", "not", "arg_2", ":", "arg_2", "=", "sys", ".", "stdout", "arg_2", ".", "write", "(", "arg_6", ")", "arg_2", ".", "write", "(", "arg_9", ")", "arg_10", "=", "Numbers", "(", ")", "for", "arg_11", "in", "arg_0", ".", "code_units", ":", "try", ":", "arg_12", "=", "arg_0", ".", "coverage", ".", "_analyze", "(", "arg_11", ")", "arg_13", "=", "arg_12", ".", "numbers", "arg_14", "=", "(", "arg_11", ".", "name", ",", "arg_13", ".", "n_statements", ",", "arg_13", ".", "n_missing", ")", "if", "arg_0", ".", "branches", ":", "arg_14", "+=", "(", "arg_13", ".", "n_branches", ",", "arg_13", ".", "n_missing_branches", ")", "arg_14", "+=", "(", "arg_13", ".", "pc_covered_str", ",", ")", "if", "arg_0", ".", "config", ".", "show_missing", ":", "arg_14", "+=", "(", "arg_12", ".", "missing_formatted", "(", ")", ",", ")", "arg_2", ".", "write", "(", "arg_7", "%", "arg_14", ")", "arg_10", "+=", "arg_13", "except", "KeyboardInterrupt", ":", "raise", "except", ":", "arg_15", "=", "not", "arg_0", ".", "config", ".", "ignore_errors", "if", "arg_15", ":", "arg_16", ",", "arg_17", "=", "sys", ".", "exc_info", "(", ")", "[", ":", "2", "]", "if", "arg_16", "is", "NotPython", "and", "not", "arg_11", ".", "should_be_python", "(", ")", ":", "arg_15", "=", "False", "if", "arg_15", ":", "arg_2", ".", "write", "(", "arg_5", "%", "(", "arg_11", ".", "name", ",", "arg_16", ".", "__name__", ",", "arg_17", ")", ")", "if", "arg_10", ".", "n_files", ">", "1", ":", "arg_2", ".", "write", "(", "arg_9", ")", "arg_14", "=", "(", "\"TOTAL\"", ",", "arg_10", ".", "n_statements", ",", "arg_10", ".", "n_missing", ")", "if", "arg_0", ".", "branches", ":", "arg_14", "+=", "(", "arg_10", ".", "n_branches", ",", "arg_10", ".", "n_missing_branches", ")", "arg_14", "+=", "(", "arg_10", ".", "pc_covered_str", ",", ")", "if", "arg_0", ".", "config", ".", "show_missing", ":", "arg_14", "+=", "(", "\"\"", ",", ")", "arg_2", ".", "write", "(", "arg_7", "%", "arg_14", ")", "return", "arg_10", ".", "pc_covered"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Writes a Func summarizing coverage statistics per module.\n\n        `outfile` is a file object to write the summary to.\n\n        \"\"\"\n        arg_0.find_code_units(arg_1)\n\n        # Prepare the formatting strings\n        arg_3 = max([len(arg_11.name) for arg_11 in arg_0.code_units] + [5])\n        arg_4 = \"%%- %ds  \" % arg_3\n        arg_5 = \"%s   %s: %s\\n\"\n        arg_6 = (arg_4 % \"Name\") + \" Stmts   Miss\"\n        arg_7 = arg_4 + \"%6d %6d\"\n        if arg_0.branches:\n            arg_6 += \" Branch BrMiss\"\n            arg_7 += \" %6d %6d\"\n        arg_8 = Numbers.pc_str_width()\n        arg_6 += \"%*s\" % (arg_8+4, \"Cover\")\n        arg_7 += \"%%%ds%%%%\" % (arg_8+3,)\n        if arg_0.config.show_missing:\n            arg_6 += \"   Missing\"\n            arg_7 += \"   %s\"\n        arg_9 = \"-\" * len(arg_6) + \"\\n\"\n        arg_6 += \"\\n\"\n        arg_7 += \"\\n\"\n\n        if not arg_2:\n            arg_2 = sys.stdout\n\n        # Write the header\n        arg_2.write(arg_6)\n        arg_2.write(arg_9)\n\n        arg_10 = Numbers()\n\n        for arg_11 in arg_0.code_units:\n            try:\n                arg_12 = arg_0.coverage._analyze(arg_11)\n                arg_13 = arg_12.numbers\n                arg_14 = (arg_11.name, arg_13.n_statements, arg_13.n_missing)\n                if arg_0.branches:\n                    arg_14 += (arg_13.n_branches, arg_13.n_missing_branches)\n                arg_14 += (arg_13.pc_covered_str,)\n                if arg_0.config.show_missing:\n                    arg_14 += (arg_12.missing_formatted(),)\n                arg_2.write(arg_7 % arg_14)\n                arg_10 += arg_13\n            except KeyboardInterrupt:                   # pragma: not covered\n                raise\n            except:\n                arg_15 = not arg_0.config.ignore_errors\n                if arg_15:\n                    arg_16, arg_17 = sys.exc_info()[:2]\n                    if arg_16 is NotPython and not arg_11.should_be_python():\n                        arg_15 = False\n                if arg_15:\n                    arg_2.write(arg_5 % (arg_11.name, arg_16.__name__, arg_17))\n\n        if arg_10.n_files > 1:\n            arg_2.write(arg_9)\n            arg_14 = (\"TOTAL\", arg_10.n_statements, arg_10.n_missing)\n            if arg_0.branches:\n                arg_14 += (arg_10.n_branches, arg_10.n_missing_branches)\n            arg_14 += (arg_10.pc_covered_str,)\n            if arg_0.config.show_missing:\n                arg_14 += (\"\",)\n            arg_2.write(arg_7 % arg_14)\n\n        return arg_10.pc_covered", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/summary.py", "identifier": "SummaryReporter.report", "docstring": "Writes a report summarizing coverage statistics per module.\n\n        `outfile` is a file object to write the summary to.", "docstring_tokens": ["Writes", "a", "report", "summarizing", "coverage", "statistics", "per", "module", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253249}
{"url": "https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/owsrequest.py#L167-L179", "sha": "e6a36b3aeeacf44eec537434b0fb87c09ab54b5f", "docstring_summary": "Find requested version in POST request.", "language": "python", "parameters": "(self)", "return_statement": "return self.params[\"version\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "\"version\"", "in", "arg_0", ".", "document", ".", "attrib", ":", "arg_1", "=", "arg_0", ".", "document", ".", "attrib", "[", "\"version\"", "]", ".", "lower", "(", ")", "if", "arg_1", "in", "allowed_versions", "[", "arg_0", ".", "params", "[", "'service'", "]", "]", ":", "arg_0", ".", "params", "[", "\"version\"", "]", "=", "arg_1", "else", ":", "raise", "OWSInvalidParameterValue", "(", "\"Version %s is not supported\"", "%", "arg_1", ",", "arg_1", "=", "\"version\"", ")", "elif", "arg_0", ".", "_get_request_type", "(", ")", "==", "\"getcapabilities\"", ":", "arg_0", ".", "params", "[", "\"version\"", "]", "=", "None", "else", ":", "raise", "OWSMissingParameterValue", "(", "'Parameter \"version\" is missing'", ",", "arg_1", "=", "\"version\"", ")", "return", "arg_0", ".", "params", "[", "\"version\"", "]"], "function": "def Func(arg_0):\n        \"\"\"Find requested version in POST request.\"\"\"\n        if \"version\" in arg_0.document.attrib:\n            arg_1 = arg_0.document.attrib[\"version\"].lower()\n            if arg_1 in allowed_versions[arg_0.params['service']]:\n                arg_0.params[\"version\"] = arg_1\n            else:\n                raise OWSInvalidParameterValue(\"Version %s is not supported\" % arg_1, arg_1=\"version\")\n        elif arg_0._get_request_type() == \"getcapabilities\":\n            arg_0.params[\"version\"] = None\n        else:\n            raise OWSMissingParameterValue('Parameter \"version\" is missing', arg_1=\"version\")\n        return arg_0.params[\"version\"]", "path": "twitcher/owsrequest.py", "identifier": "Post._get_version", "docstring": "Find requested version in POST request.", "docstring_tokens": ["Find", "requested", "version", "in", "POST", "request", "."], "nwo": "bird-house/twitcher", "score": 0.37599664903417057, "idx": 253250}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L648-L657", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Set the ERP values for this object's degrees of freedom.", "language": "python", "parameters": "(self, erps)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "_set_params", "(", "arg_0", ".", "ode_obj", ",", "'ERP'", ",", "Func", ",", "arg_0", ".", "ADOF", "+", "arg_0", ".", "LDOF", ")"], "function": "def Func(arg_0, Func):\n        '''Set the ERP values for this object's degrees of freedom.\n\n        Parameters\n        ----------\n        erps : float or sequence of float\n            An ERP value to set on all degrees of freedom, or a list\n            containing one such value for each degree of freedom.\n        '''\n        _set_params(arg_0.ode_obj, 'ERP', Func, arg_0.ADOF + arg_0.LDOF)", "path": "pagoda/physics.py", "identifier": "Joint.erps", "docstring": "Set the ERP values for this object's degrees of freedom.\n\n        Parameters\n        ----------\n        erps : float or sequence of float\n            An ERP value to set on all degrees of freedom, or a list\n            containing one such value for each degree of freedom.", "docstring_tokens": ["Set", "the", "ERP", "values", "for", "this", "object", "s", "degrees", "of", "freedom", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 253251}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/validation/base.py#L227-L233", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Validate the internal representation of the instance.", "language": "python", "parameters": "(instance)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "schema", ".", "validate", "(", "arg_0", ".", "to_dict", "(", ")", ")", "except", "ValidationError", "as", "ex", ":", "raise", "ModelValidationError", "(", "ex", ".", "messages", ",", "ex", ".", "field_names", ",", "ex", ".", "fields", ",", "ex", ".", "data", ",", "**", "ex", ".", "kwargs", ")"], "function": "def Func(arg_0):\n        \"\"\"Validate the internal representation of the instance.\"\"\"\n        try:\n            arg_1 = arg_0.schema.validate(arg_0.to_dict())\n        except ValidationError as ex:\n            raise ModelValidationError(\n                ex.messages, ex.field_names, ex.fields, ex.data, **ex.kwargs)", "path": "qiskit/validation/base.py", "identifier": "_SchemaBinder._validate", "docstring": "Validate the internal representation of the instance.", "docstring_tokens": ["Validate", "the", "internal", "representation", "of", "the", "instance", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253252}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_transfer_hook.py#L119-L132", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates a transfer job that runs periodically.", "language": "python", "parameters": "(self, body)", "return_statement": "return self.get_conn().transferJobs().create(body=body).execute(num_retries=self.num_retries)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_0", ".", "_inject_project_id", "(", "arg_1", ",", "BODY", ",", "PROJECT_ID", ")", "return", "arg_0", ".", "get_conn", "(", ")", ".", "transferJobs", "(", ")", ".", "create", "(", "arg_1", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Creates a transfer job that runs periodically.\n\n        :param body: (Required) A request body, as described in\n            https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body\n        :type body: dict\n        :return: transfer job.\n            See:\n            https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs#TransferJob\n        :rtype: dict\n        \"\"\"\n        arg_1 = arg_0._inject_project_id(arg_1, BODY, PROJECT_ID)\n        return arg_0.get_conn().transferJobs().create(arg_1=arg_1).execute(num_retries=arg_0.num_retries)", "path": "airflow/contrib/hooks/gcp_transfer_hook.py", "identifier": "GCPTransferServiceHook.create_transfer_job", "docstring": "Creates a transfer job that runs periodically.\n\n        :param body: (Required) A request body, as described in\n            https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body\n        :type body: dict\n        :return: transfer job.\n            See:\n            https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs#TransferJob\n        :rtype: dict", "docstring_tokens": ["Creates", "a", "transfer", "job", "that", "runs", "periodically", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253253}
{"url": "https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L160-L176", "sha": "e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95", "docstring_summary": "Detect infinite recursion and prevent it.", "language": "python", "parameters": "(currentlyIncluding, cache, namFilename, unique_glyphs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "normcase", "(", "arg_2", ")", ")", "if", "arg_4", "in", "arg_0", ":", "raise", "NamelistRecursionError", "(", "arg_4", ")", "arg_0", ".", "add", "(", "arg_4", ")", "try", ":", "arg_5", "=", "_Func", "(", "arg_1", ",", "arg_4", ",", "arg_3", ")", "finally", ":", "arg_0", ".", "remove", "(", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\" Detect infinite recursion and prevent it.\n\n  This is an implementation detail of readNamelist.\n\n  Raises NamelistRecursionError if namFilename is in the process of being included\n  \"\"\"\n  # normalize\n  arg_4 = os.path.abspath(os.path.normcase(arg_2))\n  if arg_4 in arg_0:\n    raise NamelistRecursionError(arg_4)\n  arg_0.add(arg_4)\n  try:\n    arg_5 = _Func(arg_1, arg_4, arg_3)\n  finally:\n    arg_0.remove(arg_4)\n  return arg_5", "path": "fontaine/charsets/internals/gfonts_utils.py", "identifier": "_readNamelist", "docstring": "Detect infinite recursion and prevent it.\n\n  This is an implementation detail of readNamelist.\n\n  Raises NamelistRecursionError if namFilename is in the process of being included", "docstring_tokens": ["Detect", "infinite", "recursion", "and", "prevent", "it", "."], "nwo": "davelab6/pyfontaine", "score": 0.1950553484412712, "idx": 253254}
{"url": "https://github.com/adrianoveiga/django-media-fixtures/blob/a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54/django_media_fixtures/management/commands/collectmedia.py#L70-L83", "sha": "a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54", "docstring_summary": "Set instance variables based on an options dict", "language": "python", "parameters": "(self, **options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_0", ".", "interactive", "=", "arg_1", "[", "'interactive'", "]", "arg_0", ".", "verbosity", "=", "arg_1", "[", "'verbosity'", "]", "arg_0", ".", "symlink", "=", "arg_1", "[", "'link'", "]", "arg_0", ".", "clear", "=", "arg_1", "[", "'clear'", "]", "arg_0", ".", "dry_run", "=", "arg_1", "[", "'dry_run'", "]", "arg_7", "=", "arg_1", "[", "'ignore_patterns'", "]", "if", "arg_1", "[", "'use_default_ignore_patterns'", "]", ":", "arg_7", "+=", "[", "'CVS'", ",", "'.*'", ",", "'*~'", "]", "arg_0", ".", "ignore_patterns", "=", "list", "(", "set", "(", "arg_7", ")", ")", "arg_0", ".", "post_process", "=", "arg_1", "[", "'post_process'", "]"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Set instance variables based on an options dict\n        \"\"\"\n        arg_0.interactive = arg_1['interactive']\n        arg_0.verbosity = arg_1['verbosity']\n        arg_0.symlink = arg_1['link']\n        arg_0.clear = arg_1['clear']\n        arg_0.dry_run = arg_1['dry_run']\n        arg_7 = arg_1['ignore_patterns']\n        if arg_1['use_default_ignore_patterns']:\n            arg_7 += ['CVS', '.*', '*~']\n        arg_0.ignore_patterns = list(set(arg_7))\n        arg_0.post_process = arg_1['post_process']", "path": "django_media_fixtures/management/commands/collectmedia.py", "identifier": "Command.set_options", "docstring": "Set instance variables based on an options dict", "docstring_tokens": ["Set", "instance", "variables", "based", "on", "an", "options", "dict"], "nwo": "adrianoveiga/django-media-fixtures", "score": 0.2845436920530269, "idx": 253255}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L207-L215", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Parse a string of space-separated numbers, returning a Python list.", "language": "python", "parameters": "(s)", "return_statement": "return [int(i) for i in s.split()]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "basestring", ")", "return", "[", "int", "(", "arg_1", ")", "for", "arg_1", "in", "arg_0", ".", "split", "(", ")", "]"], "function": "def Func(arg_0):\n  \"\"\"\n  Parse a string of space-separated numbers, returning a Python list.\n\n  :param s: (string) to parse\n  :returns: (list) binary SDR\n  \"\"\"\n  assert isinstance(arg_0, basestring)\n  return [int(arg_1) for arg_1 in arg_0.split()]", "path": "src/nupic/data/utils.py", "identifier": "parseStringList", "docstring": "Parse a string of space-separated numbers, returning a Python list.\n\n  :param s: (string) to parse\n  :returns: (list) binary SDR", "docstring_tokens": ["Parse", "a", "string", "of", "space", "-", "separated", "numbers", "returning", "a", "Python", "list", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253256}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L709-L737", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Initializes sitetree in memory.", "language": "python", "parameters": "(self, tree_alias, context)", "return_statement": "return tree_alias, sitetree_items", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "get", "(", "'request'", ",", "None", ")", "if", "arg_3", "is", "None", ":", "raise", "SiteTreeError", "(", "'Sitetree requires \"django.core.context_processors.request\" template context processor to be active. '", "'If it is, check that your view pushes request data into the template.'", ")", "if", "id", "(", "arg_3", ")", "!=", "id", "(", "arg_0", ".", "current_request", ")", ":", "arg_0", ".", "init", "(", "arg_2", ")", "arg_1", "=", "arg_0", ".", "resolve_var", "(", "arg_1", ")", "arg_1", ",", "arg_4", "=", "arg_0", ".", "get_sitetree", "(", "arg_1", ")", "if", "not", "arg_4", ":", "return", "None", ",", "None", "return", "arg_1", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Initializes sitetree in memory.\n\n        Returns tuple with resolved tree alias and items on success.\n\n        On fail returns (None, None).\n\n        :param str|unicode tree_alias:\n        :param Context context:\n        :rtype: tuple\n        \"\"\"\n        arg_3 = arg_2.get('request', None)\n\n        if arg_3 is None:\n            raise SiteTreeError(\n                'Sitetree requires \"django.core.context_processors.request\" template context processor to be active. '\n                'If it is, check that your view pushes request data into the template.')\n\n        if id(arg_3) != id(arg_0.current_request):\n            arg_0.init(arg_2)\n\n        # Resolve tree_alias from the context.\n        arg_1 = arg_0.resolve_var(arg_1)\n        arg_1, arg_4 = arg_0.get_sitetree(arg_1)\n\n        if not arg_4:\n            return None, None\n\n        return arg_1, arg_4", "path": "sitetree/sitetreeapp.py", "identifier": "SiteTree.init_tree", "docstring": "Initializes sitetree in memory.\n\n        Returns tuple with resolved tree alias and items on success.\n\n        On fail returns (None, None).\n\n        :param str|unicode tree_alias:\n        :param Context context:\n        :rtype: tuple", "docstring_tokens": ["Initializes", "sitetree", "in", "memory", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 253257}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/space.py#L1316-L1339", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Delete a space.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "spaces", ":", "raise", "ValueError", "(", "\"Space '%s' does not exist\"", "%", "arg_1", ")", "if", "arg_1", "in", "arg_0", ".", "static_spaces", ":", "arg_2", "=", "arg_0", ".", "static_spaces", "[", "arg_1", "]", "if", "arg_2", ".", "is_derived", ":", "raise", "ValueError", "(", "\"%s has derived spaces\"", "%", "repr", "(", "arg_2", ".", "interface", ")", ")", "else", ":", "arg_0", ".", "static_spaces", ".", "del_item", "(", "arg_1", ")", "arg_0", ".", "model", ".", "spacegraph", ".", "remove_node", "(", "arg_2", ")", "arg_0", ".", "inherit", "(", ")", "arg_0", ".", "model", ".", "spacegraph", ".", "update_subspaces", "(", "arg_0", ")", "elif", "arg_1", "in", "arg_0", ".", "dynamic_spaces", ":", "arg_0", ".", "dynamic_spaces", ".", "del_item", "(", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "\"Derived cells cannot be deleted\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Delete a space.\"\"\"\n        if arg_1 not in arg_0.spaces:\n            raise ValueError(\"Space '%s' does not exist\" % arg_1)\n\n        if arg_1 in arg_0.static_spaces:\n            arg_2 = arg_0.static_spaces[arg_1]\n            if arg_2.is_derived:\n                raise ValueError(\n                    \"%s has derived spaces\" % repr(arg_2.interface)\n                )\n            else:\n                arg_0.static_spaces.del_item(arg_1)\n                arg_0.model.spacegraph.remove_node(arg_2)\n                arg_0.inherit()\n                arg_0.model.spacegraph.update_subspaces(arg_0)\n                # TODO: Destroy space\n\n        elif arg_1 in arg_0.dynamic_spaces:\n            # TODO: Destroy space\n            arg_0.dynamic_spaces.del_item(arg_1)\n\n        else:\n            raise ValueError(\"Derived cells cannot be deleted\")", "path": "modelx/core/space.py", "identifier": "StaticSpaceImpl.del_space", "docstring": "Delete a space.", "docstring_tokens": ["Delete", "a", "space", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 253258}
{"url": "https://github.com/monero-ecosystem/monero-python/blob/64149f6323af57a3924f45ed87997d64387c5ee0/monero/numbers.py#L15-L20", "sha": "64149f6323af57a3924f45ed87997d64387c5ee0", "docstring_summary": "Convert Monero decimal to atomic integer of piconero.", "language": "python", "parameters": "(amount)", "return_statement": "return int(amount * 10**12)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "(", "Decimal", ",", "float", ")", "+", "_integer_types", ")", ":", "raise", "ValueError", "(", "\"Amount '{}' doesn't have numeric type. Only Decimal, int, long and \"", "\"float (not recommended) are accepted as amounts.\"", ")", "return", "int", "(", "arg_0", "*", "10", "**", "12", ")"], "function": "def Func(arg_0):\n    \"\"\"Convert Monero decimal to atomic integer of piconero.\"\"\"\n    if not isinstance(arg_0, (Decimal, float) + _integer_types):\n        raise ValueError(\"Amount '{}' doesn't have numeric type. Only Decimal, int, long and \"\n                \"float (not recommended) are accepted as amounts.\")\n    return int(arg_0 * 10**12)", "path": "monero/numbers.py", "identifier": "to_atomic", "docstring": "Convert Monero decimal to atomic integer of piconero.", "docstring_tokens": ["Convert", "Monero", "decimal", "to", "atomic", "integer", "of", "piconero", "."], "nwo": "monero-ecosystem/monero-python", "score": 0.4699390838066248, "idx": 253259}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L478-L493", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get a list of top clans by trophy", "language": "python", "parameters": "(self, location_id='global', **params: keys)", "return_statement": "return self._get_model(url, PartialClan, **params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'global'", ",", "**", "arg_2", ":", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "api", ".", "LOCATIONS", "+", "'/'", "+", "str", "(", "arg_1", ")", "+", "'/rankings/clans'", "return", "arg_0", ".", "_get_model", "(", "arg_4", ",", "PartialClan", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1='global', **arg_2: arg_3):\n        \"\"\"Get a list of top clans by trophy\n\n        Parameters\n        ----------\n        location_id: Optional[str] = 'global'\n            A location ID or global\n            See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json\n            for a list of acceptable location IDs\n        \\*\\*limit: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_4 = arg_0.api.LOCATIONS + '/' + str(arg_1) + '/rankings/clans'\n        return arg_0._get_model(arg_4, PartialClan, **arg_2)", "path": "clashroyale/official_api/client.py", "identifier": "Client.get_top_clans", "docstring": "Get a list of top clans by trophy\n\n        Parameters\n        ----------\n        location_id: Optional[str] = 'global'\n            A location ID or global\n            See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json\n            for a list of acceptable location IDs\n        \\*\\*limit: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "a", "list", "of", "top", "clans", "by", "trophy"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 253260}
{"url": "https://github.com/jfinkels/birkhoff/blob/86fff692c9cfb7217e51e25868230f4e0b53caa0/make-release.py#L176-L180", "sha": "86fff692c9cfb7217e51e25868230f4e0b53caa0", "docstring_summary": "Tags the current version.", "language": "python", "parameters": "(tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "'Tagging \"{}\"'", ".", "format", "(", "arg_0", ")", ")", "arg_1", "=", "'\"Released version {}\"'", ".", "format", "(", "arg_0", ")", "Popen", "(", "[", "'git'", ",", "'tag'", ",", "'-s'", ",", "'-m'", ",", "arg_1", ",", "arg_0", "]", ")", ".", "wait", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Tags the current version.\"\"\"\n    print('Tagging \"{}\"'.format(arg_0))\n    arg_1 = '\"Released version {}\"'.format(arg_0)\n    Popen(['git', 'tag', '-s', '-m', arg_1, arg_0]).wait()", "path": "make-release.py", "identifier": "git_tag", "docstring": "Tags the current version.", "docstring_tokens": ["Tags", "the", "current", "version", "."], "nwo": "jfinkels/birkhoff", "score": 0.18915638823512385, "idx": 253261}
{"url": "https://github.com/macacajs/wd.py/blob/6d3c52060013e01a67cd52b68b5230b387427bad/macaca/webdriver.py#L572-L587", "sha": "6d3c52060013e01a67cd52b68b5230b387427bad", "docstring_summary": "Execute JavaScript Asynchronously in current context.", "language": "python", "parameters": "(self, script, *args)", "return_statement": "return self._execute(Command.EXECUTE_ASYNC_SCRIPT, {\n            'script': script,\n            'args': list(args)})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "return", "arg_0", ".", "_execute", "(", "Command", ".", "EXECUTE_ASYNC_SCRIPT", ",", "{", "'script'", ":", "arg_1", ",", "'args'", ":", "list", "(", "arg_2", ")", "}", ")"], "function": "def Func(arg_0, arg_1, *arg_2):\n        \"\"\"Execute JavaScript Asynchronously in current context.\n\n        Support:\n            Web(WebView)\n\n        Args:\n            script: The JavaScript to execute.\n            *args: Arguments for your JavaScript.\n\n        Returns:\n            Returns the return value of the function.\n        \"\"\"\n        return arg_0._execute(Command.EXECUTE_ASYNC_SCRIPT, {\n            'script': arg_1,\n            'args': list(arg_2)})", "path": "macaca/webdriver.py", "identifier": "WebDriver.execute_async_script", "docstring": "Execute JavaScript Asynchronously in current context.\n\n        Support:\n            Web(WebView)\n\n        Args:\n            script: The JavaScript to execute.\n            *args: Arguments for your JavaScript.\n\n        Returns:\n            Returns the return value of the function.", "docstring_tokens": ["Execute", "JavaScript", "Asynchronously", "in", "current", "context", "."], "nwo": "macacajs/wd.py", "score": 0.3182350344440769, "idx": 253262}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L783-L789", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "iterator for JSON-per-line in a file pattern", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "f", ":", "for", "arg_1", "in", "f", ".", "readlines", "(", ")", ":", "yield", "json", ".", "loads", "(", "arg_1", ")"], "function": "def Func (arg_0):\n    \"\"\"\n    iterator for JSON-per-line in a file pattern\n    \"\"\"\n    with open(arg_0, 'r') as f:\n        for arg_1 in f.readlines():\n            yield json.loads(arg_1)", "path": "pytextrank/pytextrank.py", "identifier": "json_iter", "docstring": "iterator for JSON-per-line in a file pattern", "docstring_tokens": ["iterator", "for", "JSON", "-", "per", "-", "line", "in", "a", "file", "pattern"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 253263}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L538-L559", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Add or change list of logbooks.", "language": "python", "parameters": "(self, type=None, logs=[], default=\"\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "[", "]", ",", "arg_3", "=", "\"\"", ")", ":", "if", "arg_1", "is", "not", "None", "and", "len", "(", "arg_2", ")", "!=", "0", ":", "if", "arg_1", "in", "arg_0", ".", "logList", ":", "for", "arg_4", "in", "arg_2", ":", "if", "arg_4", "not", "in", "arg_0", ".", "logList", ".", "get", "(", "arg_1", ")", "[", "0", "]", ":", "arg_0", ".", "logList", ".", "get", "(", "arg_1", ")", "[", "0", "]", ".", "append", "(", "arg_4", ")", "else", ":", "arg_0", ".", "logList", "[", "arg_1", "]", "=", "[", "]", "arg_0", ".", "logList", "[", "arg_1", "]", ".", "append", "(", "arg_2", ")", "if", "len", "(", "arg_0", ".", "logList", "[", "arg_1", "]", ")", ">", "1", "and", "arg_3", "!=", "\"\"", ":", "arg_0", ".", "logList", ".", "get", "(", "arg_1", ")", "[", "1", "]", "==", "arg_3", "else", ":", "arg_0", ".", "logList", ".", "get", "(", "arg_1", ")", ".", "append", "(", "arg_3", ")", "arg_0", ".", "logType", ".", "clear", "(", ")", "arg_0", ".", "logType", ".", "addItems", "(", "list", "(", "arg_0", ".", "logList", ".", "keys", "(", ")", ")", ")", "arg_0", ".", "changeLogType", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=[], arg_3=\"\"):\n        '''Add or change list of logbooks.'''\n        if arg_1 is not None and len(arg_2) != 0:\n            if arg_1 in arg_0.logList:\n                for arg_4 in arg_2:\n                    if arg_4 not in arg_0.logList.get(arg_1)[0]:\n                        # print(\"Adding log \" + \" to \" + type + \" log type.\")\n                        arg_0.logList.get(arg_1)[0].append(arg_4)\n            else:\n                # print(\"Adding log type: \" + type)\n                arg_0.logList[arg_1] = []\n                arg_0.logList[arg_1].append(arg_2)\n            \n            # If default given, auto-select upon menu creation\n            if len(arg_0.logList[arg_1]) > 1 and arg_3 != \"\":\n                arg_0.logList.get(arg_1)[1] == arg_3\n            else:\n                arg_0.logList.get(arg_1).append(arg_3)\n            \n            arg_0.logType.clear()\n            arg_0.logType.addItems(list(arg_0.logList.keys()))\n            arg_0.changeLogType()", "path": "scisalt/facettools/logbookForm.py", "identifier": "LogSelectMenu.addLogbooks", "docstring": "Add or change list of logbooks.", "docstring_tokens": ["Add", "or", "change", "list", "of", "logbooks", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 253264}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/common/registry.py#L43-L57", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Register classes that could be initialized from JSON configuration file.\n    If name is not passed, the class name is converted to snake-case.", "language": "python", "parameters": "(name: str = None)", "return_statement": "return lambda model_cls_name: decorate(model_cls_name, name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "=", "None", ")", "->", "arg_3", ":", "def", "decorate", "(", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_1", "=", "None", ")", "->", "arg_3", ":", "arg_5", "=", "arg_4", "or", "short_name", "(", "arg_2", ")", "global", "arg_7", "arg_6", "=", "arg_2", ".", "__module__", "+", "':'", "+", "arg_2", ".", "__name__", "if", "arg_5", "in", "arg_7", "and", "arg_7", "[", "arg_5", "]", "!=", "arg_6", ":", "logger", ".", "warning", "(", "'Registry name \"{}\" has been already Funced and will be overwritten.'", ".", "format", "(", "arg_5", ")", ")", "arg_7", "[", "arg_5", "]", "=", "arg_6", "return", "arg_2", "return", "lambda", "model_cls_name", ":", "decorate", "(", "model_cls_name", ",", "arg_0", ")"], "function": "def Func(arg_0: arg_1 = None) -> arg_3:\n    \"\"\"\n    Register classes that could be initialized from JSON configuration file.\n    If name is not passed, the class name is converted to snake-case.\n    \"\"\"\n    def decorate(arg_2: arg_3, arg_4: arg_1 = None) -> arg_3:\n        arg_5 = arg_4 or short_name(arg_2)\n        global arg_7\n        arg_6 = arg_2.__module__ + ':' + arg_2.__name__\n        if arg_5 in arg_7 and arg_7[arg_5] != arg_6:\n            logger.warning('Registry name \"{}\" has been already Funced and will be overwritten.'.format(arg_5))\n        arg_7[arg_5] = arg_6\n        return arg_2\n\n    return lambda model_cls_name: decorate(model_cls_name, arg_0)", "path": "deeppavlov/core/common/registry.py", "identifier": "register", "docstring": "Register classes that could be initialized from JSON configuration file.\n    If name is not passed, the class name is converted to snake-case.", "docstring_tokens": ["Register", "classes", "that", "could", "be", "initialized", "from", "JSON", "configuration", "file", ".", "If", "name", "is", "not", "passed", "the", "class", "name", "is", "converted", "to", "snake", "-", "case", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 253265}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/schema.py#L50-L75", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Construct a validation schema for a given namespace.", "language": "python", "parameters": "(ns_key)", "return_statement": "return sch", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "not", "in", "__NAMESPACE__", ":", "raise", "NamespaceError", "(", "'Unknown Func: {:s}'", ".", "format", "(", "arg_0", ")", ")", "arg_1", "=", "copy", ".", "deepcopy", "(", "JAMS_SCHEMA", "[", "'definitions'", "]", "[", "'SparseObservation'", "]", ")", "for", "arg_2", "in", "[", "'value'", ",", "'confidence'", "]", ":", "try", ":", "arg_1", "[", "'properties'", "]", "[", "arg_2", "]", "=", "__NAMESPACE__", "[", "arg_0", "]", "[", "arg_2", "]", "except", "KeyError", ":", "pass", "return", "arg_1"], "function": "def Func(arg_0):\n    '''Construct a validation schema for a given Func.\n\n    Parameters\n    ----------\n    ns_key : str\n        Namespace key identifier (eg, 'beat' or 'segment_tut')\n\n    Returns\n    -------\n    schema : dict\n        JSON schema of `Func`\n    '''\n\n    if arg_0 not in __NAMESPACE__:\n        raise NamespaceError('Unknown Func: {:s}'.format(arg_0))\n\n    arg_1 = copy.deepcopy(JAMS_SCHEMA['definitions']['SparseObservation'])\n\n    for arg_2 in ['value', 'confidence']:\n        try:\n            arg_1['properties'][arg_2] = __NAMESPACE__[arg_0][arg_2]\n        except KeyError:\n            pass\n\n    return arg_1", "path": "jams/schema.py", "identifier": "namespace", "docstring": "Construct a validation schema for a given namespace.\n\n    Parameters\n    ----------\n    ns_key : str\n        Namespace key identifier (eg, 'beat' or 'segment_tut')\n\n    Returns\n    -------\n    schema : dict\n        JSON schema of `namespace`", "docstring_tokens": ["Construct", "a", "validation", "schema", "for", "a", "given", "namespace", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253266}
{"url": "https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/data.py#L49-L59", "sha": "dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a", "docstring_summary": "Reduce dicts of dicts to dot separated keys.", "language": "python", "parameters": "(self, field, schema, path)", "return_statement": "return flat", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", ",", "arg_3", "in", "iterate_schema", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_7", "=", "arg_5", "[", "'name'", "]", "arg_8", "=", "arg_5", "[", "'type'", "]", "arg_9", "=", "arg_5", "[", "'label'", "]", "arg_10", "=", "arg_6", "[", "arg_7", "]", "if", "arg_7", "in", "arg_6", "else", "None", "arg_4", "[", "arg_3", "]", "=", "{", "'name'", ":", "arg_7", ",", "'value'", ":", "arg_10", ",", "'type'", ":", "arg_8", ",", "'label'", ":", "arg_9", "}", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Reduce dicts of dicts to dot separated keys.\"\"\"\n        arg_4 = {}\n        for arg_5, arg_6, arg_3 in iterate_schema(arg_1, arg_2, arg_3):\n            arg_7 = arg_5['name']\n            arg_8 = arg_5['type']\n            arg_9 = arg_5['label']\n            arg_10 = arg_6[arg_7] if arg_7 in arg_6 else None\n            arg_4[arg_3] = {'name': arg_7, 'value': arg_10, 'type': arg_8, 'label': arg_9}\n\n        return arg_4", "path": "genesis/data.py", "identifier": "GenData._flatten_field", "docstring": "Reduce dicts of dicts to dot separated keys.", "docstring_tokens": ["Reduce", "dicts", "of", "dicts", "to", "dot", "separated", "keys", "."], "nwo": "genialis/genesis-pyapi", "score": 0.27692002097430746, "idx": 253267}
{"url": "https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L176-L191", "sha": "b78ee6393605d6e85d2279fb05f3983f5833df40", "docstring_summary": "Population parameter vals == average member parameter vals", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ".", "__members", ")", "!=", "0", ":", "if", "arg_0", ".", "__num_processes", ">", "1", ":", "arg_1", "=", "[", "m", ".", "get", "(", ")", "for", "m", "in", "arg_0", ".", "__members", "]", "else", ":", "arg_1", "=", "arg_0", ".", "__members", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_0", ".", "__Func", ":", "arg_2", "[", "arg_3", ".", "name", "]", "=", "sum", "(", "m", ".", "Func", "[", "arg_3", ".", "name", "]", "for", "m", "in", "arg_1", ")", "/", "len", "(", "arg_1", ")", "return", "arg_2", "else", ":", "return", "None"], "function": "def Func(arg_0):\n        '''Population parameter vals == average member parameter vals'''\n\n        if len(arg_0.__members) != 0:\n            if arg_0.__num_processes > 1:\n                arg_1 = [m.get() for m in arg_0.__members]\n            else:\n                arg_1 = arg_0.__members\n            arg_2 = {}\n            for arg_3 in arg_0.__Func:\n                arg_2[arg_3.name] = sum(\n                    m.Func[arg_3.name] for m in arg_1\n                ) / len(arg_1)\n            return arg_2\n        else:\n            return None", "path": "pygenetics/ga_core.py", "identifier": "Population.parameters", "docstring": "Population parameter vals == average member parameter vals", "docstring_tokens": ["Population", "parameter", "vals", "==", "average", "member", "parameter", "vals"], "nwo": "tjkessler/PyGenetics", "score": 0.2549979292514255, "idx": 253268}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L21-L38", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Creates a connection based upon the given configuration object.", "language": "python", "parameters": "(conf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_1", "[", "'hosts'", "]", "=", "[", "arg_0", ".", "get", "(", "'jackal'", ",", "'host'", ")", "]", "if", "int", "(", "arg_0", ".", "get", "(", "'jackal'", ",", "'use_ssl'", ")", ")", ":", "arg_1", "[", "'use_ssl'", "]", "=", "True", "if", "arg_0", ".", "get", "(", "'jackal'", ",", "'ca_certs'", ")", ":", "arg_1", "[", "'ca_certs'", "]", "=", "arg_0", ".", "get", "(", "'jackal'", ",", "'ca_certs'", ")", "if", "int", "(", "arg_0", ".", "get", "(", "'jackal'", ",", "'client_certs'", ")", ")", ":", "arg_1", "[", "'client_cert'", "]", "=", "arg_0", ".", "get", "(", "'jackal'", ",", "'client_cert'", ")", "arg_1", "[", "'client_key'", "]", "=", "arg_0", ".", "get", "(", "'jackal'", ",", "'client_key'", ")", "arg_1", "[", "'ssl_assert_hostname'", "]", "=", "False", "connections", ".", "Func", "(", "**", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n        Creates a connection based upon the given configuration object.\n    \"\"\"\n    arg_1 = {}\n    arg_1['hosts'] = [arg_0.get('jackal', 'host')]\n    if int(arg_0.get('jackal', 'use_ssl')):\n        arg_1['use_ssl'] = True\n    if arg_0.get('jackal', 'ca_certs'):\n        arg_1['ca_certs'] = arg_0.get('jackal', 'ca_certs')\n    if int(arg_0.get('jackal', 'client_certs')):\n        arg_1['client_cert'] = arg_0.get('jackal', 'client_cert')\n        arg_1['client_key'] = arg_0.get('jackal', 'client_key')\n\n    # Disable hostname checking for now.\n    arg_1['ssl_assert_hostname'] = False\n\n    connections.Func(**arg_1)", "path": "jackal/core.py", "identifier": "create_connection", "docstring": "Creates a connection based upon the given configuration object.", "docstring_tokens": ["Creates", "a", "connection", "based", "upon", "the", "given", "configuration", "object", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 253269}
{"url": "https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/pmxbot.py#L11-L18", "sha": "50bf2e047b698e308a9a88770a23e7e210aa5bcb", "docstring_summary": "A free-text query resolver by Wolfram|Alpha. Returns the first\n\tresult, if available.", "language": "python", "parameters": "(client, event, channel, nick, rest)", "return_statement": "return next(res.results).text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_0", "=", "wolframalpha", ".", "Client", "(", "pmxbot", ".", "config", "[", "'Wolfram|Alpha API key'", "]", ")", "arg_5", "=", "arg_0", ".", "query", "(", "arg_4", ")", "return", "next", "(", "arg_5", ".", "results", ")", ".", "text"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n\t\"\"\"\n\tA free-text query resolver by Wolfram|Alpha. Returns the first\n\tresult, if available.\n\t\"\"\"\n\targ_0 = wolframalpha.Client(pmxbot.config['Wolfram|Alpha API key'])\n\targ_5 = arg_0.query(arg_4)\n\treturn next(arg_5.results).text", "path": "wolframalpha/pmxbot.py", "identifier": "wa", "docstring": "A free-text query resolver by Wolfram|Alpha. Returns the first\n\tresult, if available.", "docstring_tokens": ["A", "free", "-", "text", "query", "resolver", "by", "Wolfram|Alpha", ".", "Returns", "the", "first", "result", "if", "available", "."], "nwo": "jaraco/wolframalpha", "score": 0.3658617949980371, "idx": 253270}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/protocol.py#L89-L113", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Sends commands to QTM", "language": "python", "parameters": "(\n        self, command, callback=True, command_type=QRTPacketType.PacketCommand\n    )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "arg_4", ".", "PacketCommand", ")", ":", "if", "arg_0", ".", "transport", "is", "not", "None", ":", "arg_6", "=", "len", "(", "arg_1", ")", "LOG", ".", "debug", "(", "\"S: %s\"", ",", "arg_1", ")", "arg_0", ".", "transport", ".", "write", "(", "struct", ".", "pack", "(", "RTCommand", "%", "arg_6", ",", "RTheader", ".", "size", "+", "arg_6", "+", "1", ",", "arg_3", ".", "value", ",", "arg_1", ".", "encode", "(", ")", ",", "b\"\\0\"", ",", ")", ")", "arg_7", "=", "arg_0", ".", "loop", ".", "create_future", "(", ")", "if", "arg_2", ":", "arg_0", ".", "request_queue", ".", "append", "(", "arg_7", ")", "else", ":", "arg_7", ".", "set_result", "(", "None", ")", "return", "arg_7", "raise", "QRTCommandException", "(", "\"Not connected!\"", ")"], "function": "def Func(\n        arg_0, arg_1, arg_2=True, arg_3=arg_4.PacketCommand\n    ):\n        \"\"\" Sends commands to QTM \"\"\"\n        if arg_0.transport is not None:\n            arg_6 = len(arg_1)\n            LOG.debug(\"S: %s\", arg_1)\n            arg_0.transport.write(\n                struct.pack(\n                    RTCommand % arg_6,\n                    RTheader.size + arg_6 + 1,\n                    arg_3.value,\n                    arg_1.encode(),\n                    b\"\\0\",\n                )\n            )\n\n            arg_7 = arg_0.loop.create_future()\n            if arg_2:\n                arg_0.request_queue.append(arg_7)\n            else:\n                arg_7.set_result(None)\n            return arg_7\n\n        raise QRTCommandException(\"Not connected!\")", "path": "qtm/protocol.py", "identifier": "QTMProtocol.send_command", "docstring": "Sends commands to QTM", "docstring_tokens": ["Sends", "commands", "to", "QTM"], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 253271}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/py2/h2o_ray.py#L628-L641", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Delete a model on the h2o cluster, given its key.", "language": "python", "parameters": "(self, key, ignoreMissingKey=True, timeoutSecs=60, **kwargs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "60", ",", "**", "arg_4", ")", ":", "assert", "arg_1", "is", "not", "None", ",", "'\"key\" parameter is null'", "arg_5", "=", "arg_0", ".", "do_json_request", "(", "'/3/Models.json/'", "+", "arg_1", ",", "cmd", "=", "'delete'", ",", "timeout", "=", "arg_3", ")", "if", "not", "arg_2", "and", "'f00b4r'", "in", "arg_5", ":", "raise", "ValueError", "(", "'Model key not found: '", "+", "arg_1", ")", "verboseprint", "(", "\"Func result:\"", ",", "dump_json", "(", "arg_5", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=60, **arg_4):\n    '''\n    Delete a model on the h2o cluster, given its key.\n    '''\n    assert arg_1 is not None, '\"key\" parameter is null'\n\n    arg_5 = arg_0.do_json_request('/3/Models.json/' + arg_1, cmd='delete', timeout=arg_3)\n\n    # TODO: look for what?\n    if not arg_2 and 'f00b4r' in arg_5:\n        raise ValueError('Model key not found: ' + arg_1)\n\n    verboseprint(\"Func result:\", dump_json(arg_5))\n    return arg_5", "path": "py2/h2o_ray.py", "identifier": "delete_model", "docstring": "Delete a model on the h2o cluster, given its key.", "docstring_tokens": ["Delete", "a", "model", "on", "the", "h2o", "cluster", "given", "its", "key", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253272}
{"url": "https://github.com/alexprengere/currencyconverter/blob/e3cb0d693819c0c824214225b23a47e9380f71df/currency_converter/currency_converter.py#L245-L284", "sha": "e3cb0d693819c0c824214225b23a47e9380f71df", "docstring_summary": "Get a rate for a given currency and date.", "language": "python", "parameters": "(self, currency, date)", "return_statement": "return rate", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "arg_0", ".", "ref_currency", ":", "return", "1.0", "if", "arg_2", "not", "in", "arg_0", ".", "_rates", "[", "arg_1", "]", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "bounds", "[", "arg_1", "]", "if", "not", "arg_0", ".", "fallback_on_wrong_date", ":", "raise", "RateNotFoundError", "(", "'{0} not in {1} bounds {2}/{3}'", ".", "format", "(", "arg_2", ",", "arg_1", ",", "arg_3", ",", "arg_4", ")", ")", "if", "arg_2", "<", "arg_3", ":", "arg_5", "=", "arg_3", "elif", "arg_2", ">", "arg_4", ":", "arg_5", "=", "arg_4", "else", ":", "raise", "AssertionError", "(", "'Should never happen, bug in the code!'", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "r'/!\\ {0} not in {1} bounds {2}/{3}, falling back to {4}'", ".", "format", "(", "arg_2", ",", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ")", "arg_2", "=", "arg_5", "arg_6", "=", "arg_0", ".", "_rates", "[", "arg_1", "]", "[", "arg_2", "]", "if", "arg_6", "is", "None", ":", "raise", "RateNotFoundError", "(", "'{0} has no rate for {1}'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Get a rate for a given currency and date.\n\n        :type date: datetime.date\n\n        >>> from datetime import date\n        >>> c = CurrencyConverter()\n        >>> c.Func('USD', date=date(2014, 3, 28))\n        1.375...\n        >>> c.Func('BGN', date=date(2010, 11, 21))\n        Traceback (most recent call last):\n        RateNotFoundError: BGN has no rate for 2010-11-21\n        \"\"\"\n        if arg_1 == arg_0.ref_currency:\n            return 1.0\n\n        if arg_2 not in arg_0._rates[arg_1]:\n            arg_3, arg_4 = arg_0.bounds[arg_1]\n\n            if not arg_0.fallback_on_wrong_date:\n                raise RateNotFoundError('{0} not in {1} bounds {2}/{3}'.format(\n                    arg_2, arg_1, arg_3, arg_4))\n\n            if arg_2 < arg_3:\n                arg_5 = arg_3\n            elif arg_2 > arg_4:\n                arg_5 = arg_4\n            else:\n                raise AssertionError('Should never happen, bug in the code!')\n\n            if arg_0.verbose:\n                print(r'/!\\ {0} not in {1} bounds {2}/{3}, falling back to {4}'.format(\n                    arg_2, arg_1, arg_3, arg_4, arg_5))\n\n            arg_2 = arg_5\n\n        arg_6 = arg_0._rates[arg_1][arg_2]\n        if arg_6 is None:\n            raise RateNotFoundError('{0} has no rate for {1}'.format(arg_1, arg_2))\n        return arg_6", "path": "currency_converter/currency_converter.py", "identifier": "CurrencyConverter._get_rate", "docstring": "Get a rate for a given currency and date.\n\n        :type date: datetime.date\n\n        >>> from datetime import date\n        >>> c = CurrencyConverter()\n        >>> c._get_rate('USD', date=date(2014, 3, 28))\n        1.375...\n        >>> c._get_rate('BGN', date=date(2010, 11, 21))\n        Traceback (most recent call last):\n        RateNotFoundError: BGN has no rate for 2010-11-21", "docstring_tokens": ["Get", "a", "rate", "for", "a", "given", "currency", "and", "date", "."], "nwo": "alexprengere/currencyconverter", "score": 0.5486903423646818, "idx": 253273}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/concurrently/condor/submitter.py#L208-L225", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "Provide the run IDs of failed jobs", "language": "python", "parameters": "(self, runids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "try", ":", "arg_0", ".", "clusterprocids_finished", ".", "remove", "(", "arg_2", ")", "except", "ValueError", ":", "pass"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Provide the run IDs of failed jobs\n\n\n        Returns\n        -------\n        None\n\n        \"\"\"\n\n        # remove failed clusterprocids from self.clusterprocids_finished\n        # so that len(self.clusterprocids_finished)) becomes the number\n        # of the successfully finished jobs\n        for arg_2 in arg_1:\n            try:\n                arg_0.clusterprocids_finished.remove(arg_2)\n            except ValueError:\n                pass", "path": "alphatwirl/concurrently/condor/submitter.py", "identifier": "HTCondorJobSubmitter.failed_runids", "docstring": "Provide the run IDs of failed jobs\n\n\n        Returns\n        -------\n        None", "docstring_tokens": ["Provide", "the", "run", "IDs", "of", "failed", "jobs"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 253274}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L71-L77", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Tokenize a document and add an annotation attribute to each token", "language": "python", "parameters": "(doc, annotation)", "return_statement": "return tokens", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tokenize", "(", "arg_0", ",", "include_hrefs", "=", "False", ")", "for", "arg_3", "in", "arg_2", ":", "arg_3", ".", "annotation", "=", "arg_1", "return", "arg_2"], "function": "def Func(arg_0, arg_1): \n    \"\"\"Tokenize a document and add an annotation attribute to each token\n    \"\"\"\n    arg_2 = tokenize(arg_0, include_hrefs=False)\n    for arg_3 in arg_2: \n        arg_3.annotation = arg_1\n    return arg_2", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py", "identifier": "tokenize_annotated", "docstring": "Tokenize a document and add an annotation attribute to each token", "docstring_tokens": ["Tokenize", "a", "document", "and", "add", "an", "annotation", "attribute", "to", "each", "token"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253275}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/sets.py#L173-L182", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Generator that yields one by one the return value for self.read_dcm\n        for each file within this set", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "for", "arg_1", "in", "arg_0", ".", "items", ":", "yield", "arg_0", ".", "read_dcm", "(", "arg_1", ")", "except", "IOError", "as", "ioe", ":", "raise", "IOError", "(", "'Error reading DICOM file: {}.'", ".", "format", "(", "arg_1", ")", ")", "from", "ioe"], "function": "def Func(arg_0):\n        \"\"\"\n        Generator that yields one by one the return value for self.read_dcm\n        for each file within this set\n        \"\"\"\n        try:\n            for arg_1 in arg_0.items:\n                yield arg_0.read_dcm(arg_1)\n        except IOError as ioe:\n            raise IOError('Error reading DICOM file: {}.'.format(arg_1)) from ioe", "path": "boyle/dicom/sets.py", "identifier": "DicomGenericSet.scrape_all_files", "docstring": "Generator that yields one by one the return value for self.read_dcm\n        for each file within this set", "docstring_tokens": ["Generator", "that", "yields", "one", "by", "one", "the", "return", "value", "for", "self", ".", "read_dcm", "for", "each", "file", "within", "this", "set"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 253276}
{"url": "https://github.com/elyase/masstable/blob/3eb72b22cd3337bc5c6bb95bb7bb73fdbe6ae9e2/masstable/masstable.py#L418-L431", "sha": "3eb72b22cd3337bc5c6bb95bb7bb73fdbe6ae9e2", "docstring_summary": "Return binding energies instead of mass excesses", "language": "python", "parameters": "(self)", "return_statement": "return Table(df=df, name='BE' + '(' + self.name + ')')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "938.2723", "arg_2", "=", "0.5110", "arg_3", "=", "939.5656", "arg_4", "=", "931.494028", "arg_5", "=", "arg_0", ".", "Z", "*", "(", "arg_1", "+", "arg_2", ")", "+", "(", "arg_0", ".", "A", "-", "arg_0", ".", "Z", ")", "*", "arg_3", "-", "(", "arg_0", ".", "df", "+", "arg_0", ".", "A", "*", "arg_4", ")", "return", "Table", "(", "arg_5", "=", "arg_5", ",", "name", "=", "'BE'", "+", "'('", "+", "arg_0", ".", "name", "+", "')'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return binding energies instead of mass excesses\n        \"\"\"\n        arg_1 = 938.2723\n        # MeV\n        arg_2 = 0.5110\n        # MeV\n        arg_3 = 939.5656\n        # MeV\n        arg_4 = 931.494028\n        # MeV\n        arg_5 = arg_0.Z * (arg_1 + arg_2) + (arg_0.A - arg_0.Z) * arg_3 - (arg_0.df + arg_0.A * arg_4)\n        return Table(arg_5=arg_5, name='BE' + '(' + arg_0.name + ')')", "path": "masstable/masstable.py", "identifier": "Table.binding_energy", "docstring": "Return binding energies instead of mass excesses", "docstring_tokens": ["Return", "binding", "energies", "instead", "of", "mass", "excesses"], "nwo": "elyase/masstable", "score": 0.15726537023232431, "idx": 253277}
{"url": "https://github.com/c-soft/satel_integra/blob/3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c/satel_integra/satel_integra.py#L23-L28", "sha": "3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c", "docstring_summary": "Debugging method to print out frames in hex.", "language": "python", "parameters": "(data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"\"", "for", "arg_2", "in", "arg_0", ":", "arg_1", "+=", "\"\\\\x\"", "+", "format", "(", "arg_2", ",", "\"02x\"", ")", "_LOGGER", ".", "debug", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Debugging method to print out frames in hex.\"\"\"\n    arg_1 = \"\"\n    for arg_2 in arg_0:\n        arg_1 += \"\\\\x\" + format(arg_2, \"02x\")\n    _LOGGER.debug(arg_1)", "path": "satel_integra/satel_integra.py", "identifier": "print_hex", "docstring": "Debugging method to print out frames in hex.", "docstring_tokens": ["Debugging", "method", "to", "print", "out", "frames", "in", "hex", "."], "nwo": "c-soft/satel_integra", "score": 0.683472553404196, "idx": 253278}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L316-L324", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Get the name of the item.", "language": "python", "parameters": "(self)", "return_statement": "return var.decode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "xmlnode", ".", "prop", "(", "\"name\"", ")", "if", "not", "arg_1", ":", "arg_1", "=", "\"\"", "return", "arg_1", ".", "decode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Get the name of the item.\n\n        :return: the name of the item or `None`.\n        :returntype: `unicode`\"\"\"\n        arg_1 = arg_0.xmlnode.prop(\"name\")\n        if not arg_1:\n            arg_1 = \"\"\n        return arg_1.decode(\"utf-8\")", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoIdentity.get_name", "docstring": "Get the name of the item.\n\n        :return: the name of the item or `None`.\n        :returntype: `unicode`", "docstring_tokens": ["Get", "the", "name", "of", "the", "item", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253279}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L1875-L1912", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Break out a date from Omnimeter read.", "language": "python", "parameters": "(dateint)", "return_statement": "return dt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "str", "(", "arg_0", ")", "arg_2", "=", "namedtuple", "(", "'EkmDate'", ",", "[", "'yy'", ",", "'mm'", ",", "'dd'", ",", "'weekday'", ",", "'hh'", ",", "'minutes'", ",", "'ss'", "]", ")", "if", "len", "(", "arg_1", ")", "!=", "14", ":", "arg_2", ".", "yy", "=", "arg_2", ".", "mm", "=", "arg_2", ".", "dd", "=", "arg_2", ".", "weekday", "=", "arg_2", ".", "hh", "=", "arg_2", ".", "minutes", "=", "arg_2", ".", "ss", "=", "0", "return", "arg_2", "arg_2", ".", "yy", "=", "int", "(", "arg_1", "[", "0", ":", "2", "]", ")", "arg_2", ".", "mm", "=", "int", "(", "arg_1", "[", "2", ":", "4", "]", ")", "arg_2", ".", "dd", "=", "int", "(", "arg_1", "[", "4", ":", "6", "]", ")", "arg_2", ".", "weekday", "=", "int", "(", "arg_1", "[", "6", ":", "8", "]", ")", "arg_2", ".", "hh", "=", "int", "(", "arg_1", "[", "8", ":", "10", "]", ")", "arg_2", ".", "minutes", "=", "int", "(", "arg_1", "[", "10", ":", "12", "]", ")", "arg_2", ".", "ss", "=", "int", "(", "arg_1", "[", "12", ":", "14", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Break out a date from Omnimeter read.\n\n        Note a corrupt date will raise an exception when you\n        convert it to int to hand to this method.\n\n        Args:\n            dateint (int):  Omnimeter datetime as int.\n\n        Returns:\n            tuple: Named tuple which breaks out as followws:\n\n            ========== =====================\n            yy         Last 2 digits of year\n            mm         Month 1-12\n            dd         Day 1-31\n            weekday    Zero based weekday\n            hh         Hour 0-23\n            minutes    Minutes 0-59\n            ss         Seconds 0-59\n            ========== =====================\n\n        \"\"\"\n        arg_1 = str(arg_0)\n        arg_2 = namedtuple('EkmDate', ['yy', 'mm', 'dd', 'weekday', 'hh', 'minutes', 'ss'])\n\n        if len(arg_1) != 14:\n            arg_2.yy = arg_2.mm = arg_2.dd = arg_2.weekday = arg_2.hh = arg_2.minutes = arg_2.ss = 0\n            return arg_2\n\n        arg_2.yy = int(arg_1[0:2])\n        arg_2.mm = int(arg_1[2:4])\n        arg_2.dd = int(arg_1[4:6])\n        arg_2.weekday = int(arg_1[6:8])\n        arg_2.hh = int(arg_1[8:10])\n        arg_2.minutes = int(arg_1[10:12])\n        arg_2.ss = int(arg_1[12:14])\n        return arg_2", "path": "ekmmeters.py", "identifier": "Meter.splitEkmDate", "docstring": "Break out a date from Omnimeter read.\n\n        Note a corrupt date will raise an exception when you\n        convert it to int to hand to this method.\n\n        Args:\n            dateint (int):  Omnimeter datetime as int.\n\n        Returns:\n            tuple: Named tuple which breaks out as followws:\n\n            ========== =====================\n            yy         Last 2 digits of year\n            mm         Month 1-12\n            dd         Day 1-31\n            weekday    Zero based weekday\n            hh         Hour 0-23\n            minutes    Minutes 0-59\n            ss         Seconds 0-59\n            ========== =====================", "docstring_tokens": ["Break", "out", "a", "date", "from", "Omnimeter", "read", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 253280}
{"url": "https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/support.py#L585-L606", "sha": "532f561f32b91ea8debea0573c503dd20988bf40", "docstring_summary": "Extract metadata entries from an xml node", "language": "python", "parameters": "(node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "None", "if", "'key'", "in", "arg_0", ".", "attrib", ":", "arg_1", "=", "arg_0", ".", "attrib", "[", "'key'", "]", "else", ":", "arg_1", "=", "None", "if", "arg_1", "in", "[", "'time'", ",", "'elevation'", "]", "or", "arg_1", ".", "startswith", "(", "'custom_dimension'", ")", ":", "arg_2", "=", "md_dimension_info", "(", "arg_1", ",", "arg_0", ".", "find", "(", "\"dimensionInfo\"", ")", ")", "elif", "arg_1", "==", "'DynamicDefaultValues'", ":", "arg_2", "=", "md_dynamic_default_values_info", "(", "arg_1", ",", "arg_0", ".", "find", "(", "\"DynamicDefaultValues\"", ")", ")", "elif", "arg_1", "==", "'JDBC_VIRTUAL_TABLE'", ":", "arg_2", "=", "md_jdbc_virtual_table", "(", "arg_1", ",", "arg_0", ".", "find", "(", "\"virtualTable\"", ")", ")", "else", ":", "arg_2", "=", "arg_0", ".", "text", "if", "None", "in", "[", "arg_1", ",", "arg_2", "]", ":", "return", "None", "else", ":", "return", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Extract metadata entries from an xml node\"\"\"\n    arg_1 = None\n    arg_2 = None\n    if 'key' in arg_0.attrib:\n        arg_1 = arg_0.attrib['key']\n    else:\n        arg_1 = None\n\n    if arg_1 in ['time', 'elevation'] or arg_1.startswith('custom_dimension'):\n        arg_2 = md_dimension_info(arg_1, arg_0.find(\"dimensionInfo\"))\n    elif arg_1 == 'DynamicDefaultValues':\n        arg_2 = md_dynamic_default_values_info(arg_1, arg_0.find(\"DynamicDefaultValues\"))\n    elif arg_1 == 'JDBC_VIRTUAL_TABLE':\n        arg_2 = md_jdbc_virtual_table(arg_1, arg_0.find(\"virtualTable\"))\n    else:\n        arg_2 = arg_0.text\n\n    if None in [arg_1, arg_2]:\n        return None\n    else:\n        return (arg_1, arg_2)", "path": "src/geoserver/support.py", "identifier": "md_entry", "docstring": "Extract metadata entries from an xml node", "docstring_tokens": ["Extract", "metadata", "entries", "from", "an", "xml", "node"], "nwo": "boundlessgeo/gsconfig", "score": 0.7627023200281134, "idx": 253281}
{"url": "https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L268-L272", "sha": "818ebeabba5e051627d444c4849fde55947f94be", "docstring_summary": "Alias for _assemble_with_columns", "language": "python", "parameters": "(self, sql_str, columns, *args, **kwargs)", "return_statement": "return self._assemble_with_columns(sql_str, columns, *args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "warnings", ".", "warn", "(", "\"Func has been depreciated for _assemble_with_columns. It will be removed in a future version.\"", ",", "DeprecationWarning", ")", "return", "arg_0", ".", "_assemble_with_columns", "(", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        \"\"\" Alias for _assemble_with_columns\n        \"\"\"\n        warnings.warn(\"Func has been depreciated for _assemble_with_columns. It will be removed in a future version.\", DeprecationWarning)\n        return arg_0._assemble_with_columns(arg_1, arg_2, *arg_3, **arg_4)", "path": "rawl/__init__.py", "identifier": "RawlBase._assemble_select", "docstring": "Alias for _assemble_with_columns", "docstring_tokens": ["Alias", "for", "_assemble_with_columns"], "nwo": "mikeshultz/rawl", "score": 0.15726537023232431, "idx": 253282}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/oauth_dance.py#L42-L69", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "Open authorize page in a browser,\n    print the url if it didn't work", "language": "python", "parameters": "(oauth_token)", "return_statement": "return verifier", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"https://api.twitter.com/oauth/authorize?oauth_token=\"", "+", "arg_0", "try", ":", "arg_2", "=", "webbrowser", ".", "open", "(", "arg_1", ")", "await", "asyncio", ".", "sleep", "(", "2", ")", "if", "not", "arg_2", ":", "raise", "RuntimeError", "except", "RuntimeError", ":", "print", "(", "\"could not open a browser\\ngo here to enter your PIN: \"", "+", "arg_1", ")", "arg_3", "=", "input", "(", "\"\\nEnter your PIN: \"", ")", "return", "arg_3"], "function": "async def Func(arg_0):\n    \"\"\"\n    Open authorize page in a browser,\n    print the url if it didn't work\n\n    Arguments\n    ---------\n    oauth_token : str\n        The oauth token received in :func:`get_oauth_token`\n\n    Returns\n    -------\n    str\n        The PIN entered by the user\n    \"\"\"\n    arg_1 = \"https://api.twitter.com/oauth/authorize?oauth_token=\" + arg_0\n\n    try:\n        arg_2 = webbrowser.open(arg_1)\n        await asyncio.sleep(2)\n\n        if not arg_2:\n            raise RuntimeError\n    except RuntimeError:\n        print(\"could not open a browser\\ngo here to enter your PIN: \" + arg_1)\n\n    arg_3 = input(\"\\nEnter your PIN: \")\n    return arg_3", "path": "peony/oauth_dance.py", "identifier": "get_oauth_verifier", "docstring": "Open authorize page in a browser,\n    print the url if it didn't work\n\n    Arguments\n    ---------\n    oauth_token : str\n        The oauth token received in :func:`get_oauth_token`\n\n    Returns\n    -------\n    str\n        The PIN entered by the user", "docstring_tokens": ["Open", "authorize", "page", "in", "a", "browser", "print", "the", "url", "if", "it", "didn", "t", "work"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 253283}
{"url": "https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/views.py#L266-L288", "sha": "cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2", "docstring_summary": "Adds a memory to an event.", "language": "python", "parameters": "(request, slug)", "return_statement": "return render(request, 'happenings/add_memories.html', {'form': form, 'event': event})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "get_object_or_404", "(", "Event", ",", "arg_1", "=", "arg_1", ")", "arg_3", "=", "MemoryForm", "(", "arg_0", ".", "POST", "or", "None", ",", "arg_0", ".", "FILES", "or", "None", ")", "if", "arg_3", ".", "is_valid", "(", ")", ":", "arg_4", "=", "arg_3", ".", "save", "(", "commit", "=", "False", ")", "arg_4", ".", "user", "=", "arg_0", ".", "user", "arg_4", ".", "event", "=", "arg_2", "arg_4", ".", "save", "(", ")", "arg_6", "=", "\"Your thoughts were added. \"", "if", "arg_0", ".", "FILES", ":", "arg_7", "=", "arg_0", ".", "FILES", ".", "getlist", "(", "'photos'", ")", "arg_8", "=", "len", "(", "arg_7", ")", "for", "arg_9", "in", "arg_7", ":", "process_upload", "(", "arg_9", ",", "arg_4", ",", "arg_3", ",", "arg_2", ",", "arg_0", ")", "if", "arg_8", ">", "1", ":", "arg_6", "+=", "\"{} images were added and should appear soon.\"", ".", "format", "(", "arg_8", ")", "else", ":", "arg_6", "+=", "\"{} image was added and should appear soon.\"", ".", "format", "(", "arg_8", ")", "messages", ".", "success", "(", "arg_0", ",", "arg_6", ")", "return", "HttpResponseRedirect", "(", "'../'", ")", "return", "render", "(", "arg_0", ",", "'happenings/add_memories.html'", ",", "{", "'form'", ":", "arg_3", ",", "'event'", ":", "arg_2", "}", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Adds a memory to an event. \"\"\"\n    arg_2 = get_object_or_404(Event, arg_1=arg_1)\n    arg_3 = MemoryForm(arg_0.POST or None, arg_0.FILES or None)\n    if arg_3.is_valid():\n        arg_4 = arg_3.save(commit=False)\n        arg_4.user = arg_0.user\n        arg_4.event = arg_2\n        arg_4.save()\n        arg_6 = \"Your thoughts were added. \"\n\n        if arg_0.FILES:\n            arg_7 = arg_0.FILES.getlist('photos')\n            arg_8 = len(arg_7)\n            for arg_9 in arg_7:\n                process_upload(arg_9, arg_4, arg_3, arg_2, arg_0)\n            if arg_8 > 1:\n                arg_6 += \"{} images were added and should appear soon.\".format(arg_8)\n            else:\n                arg_6 += \"{} image was added and should appear soon.\".format(arg_8)\n        messages.success(arg_0, arg_6)\n        return HttpResponseRedirect('../')\n    return render(arg_0, 'happenings/add_memories.html', {'form': arg_3, 'event': arg_2})", "path": "build/lib/happenings/views.py", "identifier": "add_memory", "docstring": "Adds a memory to an event.", "docstring_tokens": ["Adds", "a", "memory", "to", "an", "event", "."], "nwo": "tBaxter/tango-happenings", "score": 0.09252797783733271, "idx": 253284}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/mechanisms.py#L19-L41", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Compare generated mechanisms to actual ones.", "language": "python", "parameters": "(graph: BELGraph, annotation: str = 'Subgraph')", "return_statement": "return dict(results)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "'Subgraph'", ")", "->", "Mapping", "[", "arg_3", ",", "Mapping", "[", "arg_3", ",", "float", "]", "]", ":", "arg_4", "=", "get_subgraphs_by_annotation", "(", "arg_0", ",", "arg_2", ")", "arg_5", "=", "_transform_graph_dict_to_node_dict", "(", "arg_4", ")", "arg_6", "=", "generate_bioprocess_mechanisms", "(", "arg_0", ")", "arg_7", "=", "_transform_graph_dict_to_node_dict", "(", "arg_6", ")", "arg_8", ":", "Dict", "[", "arg_3", ",", "Dict", "[", "arg_3", ",", "float", "]", "]", "=", "defaultdict", "(", "dict", ")", "arg_9", "=", "itt", ".", "product", "(", "arg_5", ".", "items", "(", ")", ",", "arg_7", ".", "items", "(", ")", ")", "for", "(", "arg_10", ",", "arg_11", ")", ",", "(", "arg_12", ",", "arg_13", ")", "in", "arg_9", ":", "arg_14", "=", "tanimoto_set_similarity", "(", "arg_7", ",", "arg_5", ")", "arg_8", "[", "arg_10", "]", "[", "arg_12", "]", "=", "arg_14", "return", "dict", "(", "arg_8", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = 'Subgraph') -> Mapping[arg_3, Mapping[arg_3, float]]:\n    \"\"\"Compare generated mechanisms to actual ones.\n\n    1. Generates candidate mechanisms for each biological process\n    2. Gets sub-graphs for all NeuroMMSig signatures\n    3. Make tanimoto similarity comparison for all sets\n\n    :return: A dictionary table comparing the canonical subgraphs to generated ones\n    \"\"\"\n    arg_4 = get_subgraphs_by_annotation(arg_0, arg_2)\n    arg_5 = _transform_graph_dict_to_node_dict(arg_4)\n\n    arg_6 = generate_bioprocess_mechanisms(arg_0)\n    arg_7 = _transform_graph_dict_to_node_dict(arg_6)\n\n    arg_8: Dict[arg_3, Dict[arg_3, float]] = defaultdict(dict)\n\n    arg_9 = itt.product(arg_5.items(), arg_7.items())\n    for (arg_10, arg_11), (arg_12, arg_13) in arg_9:\n        arg_14 = tanimoto_set_similarity(arg_7, arg_5)\n        arg_8[arg_10][arg_12] = arg_14\n\n    return dict(arg_8)", "path": "src/pybel_tools/analysis/mechanisms.py", "identifier": "compare", "docstring": "Compare generated mechanisms to actual ones.\n\n    1. Generates candidate mechanisms for each biological process\n    2. Gets sub-graphs for all NeuroMMSig signatures\n    3. Make tanimoto similarity comparison for all sets\n\n    :return: A dictionary table comparing the canonical subgraphs to generated ones", "docstring_tokens": ["Compare", "generated", "mechanisms", "to", "actual", "ones", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253285}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1832-L1843", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Execute a BigQuery query multiple times with different parameters.", "language": "python", "parameters": "(self, operation, seq_of_parameters)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_2", ":", "arg_0", ".", "execute", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Execute a BigQuery query multiple times with different parameters.\n\n        :param operation: The query to execute.\n        :type operation: str\n        :param seq_of_parameters: List of dictionary parameters to substitute into the\n            query.\n        :type seq_of_parameters: list\n        \"\"\"\n        for arg_3 in arg_2:\n            arg_0.execute(arg_1, arg_3)", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryCursor.executemany", "docstring": "Execute a BigQuery query multiple times with different parameters.\n\n        :param operation: The query to execute.\n        :type operation: str\n        :param seq_of_parameters: List of dictionary parameters to substitute into the\n            query.\n        :type seq_of_parameters: list", "docstring_tokens": ["Execute", "a", "BigQuery", "query", "multiple", "times", "with", "different", "parameters", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253286}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L3160-L3197", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to set the T, P, and composition dependent property methods \n        desired for consideration by the user. Can be used to exclude certain \n        methods which might have unacceptable accuracy.", "language": "python", "parameters": "(self, user_methods, forced=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_0", ".", "user_methods", "=", "arg_1", "arg_0", ".", "forced", "=", "arg_2", "if", "set", "(", "arg_0", ".", "user_methods", ")", ".", "difference", "(", "arg_0", ".", "all_methods", ")", ":", "raise", "Exception", "(", "\"One of the given methods is not available for this mixture\"", ")", "if", "not", "arg_0", ".", "user_methods", "and", "arg_0", ".", "forced", ":", "raise", "Exception", "(", "'Only user specified methods are considered when forced is True, but no methods were provided'", ")", "arg_0", ".", "method", "=", "None", "arg_0", ".", "sorted_valid_methods", "=", "[", "]", "arg_0", ".", "TP_zs_ws_cached", "=", "(", "None", ",", "None", ",", "None", ",", "None", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        r'''Method to set the T, P, and composition dependent property methods \n        desired for consideration by the user. Can be used to exclude certain \n        methods which might have unacceptable accuracy.\n\n        As a side effect, the previously selected method is removed when\n        this method is called to ensure user methods are tried in the desired\n        order.\n\n        Parameters\n        ----------\n        user_methods : str or list\n            Methods by name to be considered for calculation of the mixture\n            property, ordered by preference.\n        forced : bool, optional\n            If True, only the user specified methods will ever be considered;\n            if False, other methods will be considered if no user methods\n            suceed.\n        '''\n        # Accept either a string or a list of methods, and whether\n        # or not to only consider the false methods\n        if isinstance(arg_1, str):\n            arg_1 = [arg_1]\n\n        # The user's order matters and is retained for use by select_valid_methods\n        arg_0.user_methods = arg_1\n        arg_0.forced = arg_2\n\n        # Validate that the user's specified methods are actual methods\n        if set(arg_0.user_methods).difference(arg_0.all_methods):\n            raise Exception(\"One of the given methods is not available for this mixture\")\n        if not arg_0.user_methods and arg_0.forced:\n            raise Exception('Only user specified methods are considered when forced is True, but no methods were provided')\n\n        # Remove previously selected methods\n        arg_0.method = None\n        arg_0.sorted_valid_methods = []\n        arg_0.TP_zs_ws_cached = (None, None, None, None)", "path": "thermo/utils.py", "identifier": "MixtureProperty.set_user_method", "docstring": "r'''Method to set the T, P, and composition dependent property methods \n        desired for consideration by the user. Can be used to exclude certain \n        methods which might have unacceptable accuracy.\n\n        As a side effect, the previously selected method is removed when\n        this method is called to ensure user methods are tried in the desired\n        order.\n\n        Parameters\n        ----------\n        user_methods : str or list\n            Methods by name to be considered for calculation of the mixture\n            property, ordered by preference.\n        forced : bool, optional\n            If True, only the user specified methods will ever be considered;\n            if False, other methods will be considered if no user methods\n            suceed.", "docstring_tokens": ["r", "Method", "to", "set", "the", "T", "P", "and", "composition", "dependent", "property", "methods", "desired", "for", "consideration", "by", "the", "user", ".", "Can", "be", "used", "to", "exclude", "certain", "methods", "which", "might", "have", "unacceptable", "accuracy", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 253287}
{"url": "https://github.com/antevens/listen/blob/d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67/listen/signal_handler.py#L119-L125", "sha": "d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67", "docstring_summary": "Run all abort tasks, then all exit tasks, then exit with error\n        return status", "language": "python", "parameters": "(self, signum)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "info", "(", "'Signal handler received Func request'", ")", "arg_0", ".", "_Func", "(", "arg_1", ")", "arg_0", ".", "_exit", "(", "arg_1", ")", "os", ".", "_exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Run all Func tasks, then all exit tasks, then exit with error\n        return status\"\"\"\n        arg_0.log.info('Signal handler received Func request')\n        arg_0._Func(arg_1)\n        arg_0._exit(arg_1)\n        os._exit(1)", "path": "listen/signal_handler.py", "identifier": "SignalHandler.abort", "docstring": "Run all abort tasks, then all exit tasks, then exit with error\n        return status", "docstring_tokens": ["Run", "all", "abort", "tasks", "then", "all", "exit", "tasks", "then", "exit", "with", "error", "return", "status"], "nwo": "antevens/listen", "score": 0.21302904236143622, "idx": 253288}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/seasonal.py#L529-L570", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build change-of-basis matrices for constrained seasonal effects.", "language": "python", "parameters": "(num_seasons, dtype)", "return_statement": "return effects_to_residuals, residuals_to_effects", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "eye", "(", "arg_0", ")", "-", "1.", "/", "arg_0", "arg_2", "[", "-", "1", ",", ":", "]", "=", "1.", "/", "arg_0", "arg_3", "=", "np", ".", "linalg", ".", "inv", "(", "arg_2", ")", "arg_4", "=", "arg_2", "[", ":", "-", "1", ",", ":", "]", "arg_5", "=", "arg_3", "[", ":", ",", ":", "-", "1", "]", "arg_4", "=", "tf", ".", "cast", "(", "arg_4", ",", "arg_1", "=", "arg_1", ",", "name", "=", "'effects_to_residuals'", ")", "arg_5", "=", "tf", ".", "cast", "(", "arg_5", ",", "arg_1", "=", "arg_1", ",", "name", "=", "'residuals_to_effects'", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Build change-of-basis matrices for constrained seasonal effects.\n\n  This method builds the matrix that transforms seasonal effects into\n  effect residuals (differences from the mean effect), and additionally\n  projects these residuals onto the subspace where the mean effect is zero.\n\n  See `ConstrainedSeasonalStateSpaceModel` for mathematical details.\n\n  Args:\n    num_seasons: scalar `int` number of seasons.\n    dtype: TensorFlow `dtype` for the returned values.\n  Returns:\n    effects_to_residuals: `Tensor` of shape\n      `[num_seasons-1, num_seasons]`, such that `differences_from_mean_effect =\n      matmul(effects_to_residuals, seasonal_effects)`.  In the\n      notation of `ConstrainedSeasonalStateSpaceModel`, this is\n      `effects_to_residuals = P * R`.\n    residuals_to_effects: the (pseudo)-inverse of the above; a\n      `Tensor` of shape `[num_seasons, num_seasons-1]`. In the\n      notation of `ConstrainedSeasonalStateSpaceModel`, this is\n      `residuals_to_effects = R^{-1} * P'`.\n  \"\"\"\n\n  # Build the matrix that converts effects `e_i` into differences from the mean\n  # effect `(e_i - sum(e_i)) / num_seasons`, with the mean effect in the last\n  # row so that the transformation is invertible.\n  arg_2 = np.eye(arg_0) - 1./arg_0\n  arg_2[-1, :] = 1./arg_0  # compute mean effect\n  arg_3 = np.linalg.inv(arg_2)\n\n  # Drop the final dimension, effectively setting the mean effect to zero.\n  arg_4 = arg_2[:-1, :]\n  arg_5 = arg_3[:, :-1]\n\n  # Return Tensor values of the specified dtype.\n  arg_4 = tf.cast(\n      arg_4, arg_1=arg_1, name='effects_to_residuals')\n  arg_5 = tf.cast(\n      arg_5, arg_1=arg_1, name='residuals_to_effects')\n\n  return arg_4, arg_5", "path": "tensorflow_probability/python/sts/seasonal.py", "identifier": "build_effects_to_residuals_matrix", "docstring": "Build change-of-basis matrices for constrained seasonal effects.\n\n  This method builds the matrix that transforms seasonal effects into\n  effect residuals (differences from the mean effect), and additionally\n  projects these residuals onto the subspace where the mean effect is zero.\n\n  See `ConstrainedSeasonalStateSpaceModel` for mathematical details.\n\n  Args:\n    num_seasons: scalar `int` number of seasons.\n    dtype: TensorFlow `dtype` for the returned values.\n  Returns:\n    effects_to_residuals: `Tensor` of shape\n      `[num_seasons-1, num_seasons]`, such that `differences_from_mean_effect =\n      matmul(effects_to_residuals, seasonal_effects)`.  In the\n      notation of `ConstrainedSeasonalStateSpaceModel`, this is\n      `effects_to_residuals = P * R`.\n    residuals_to_effects: the (pseudo)-inverse of the above; a\n      `Tensor` of shape `[num_seasons, num_seasons-1]`. In the\n      notation of `ConstrainedSeasonalStateSpaceModel`, this is\n      `residuals_to_effects = R^{-1} * P'`.", "docstring_tokens": ["Build", "change", "-", "of", "-", "basis", "matrices", "for", "constrained", "seasonal", "effects", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253289}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonetic_spanish.py#L53-L97", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the PhoneticSpanish coding of word.", "language": "python", "parameters": "(self, word, max_length=-1)", "return_statement": "return sdx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "-", "1", ")", ":", "arg_1", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "arg_1", ".", "upper", "(", ")", ")", ")", "arg_1", "=", "''", ".", "join", "(", "c", "for", "c", "in", "arg_1", "if", "c", "in", "arg_0", ".", "_uc_set", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "'LL'", ",", "'L'", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "'R'", ",", "'R'", ")", "arg_3", "=", "arg_1", ".", "translate", "(", "arg_0", ".", "_trans", ")", "if", "arg_2", ">", "0", ":", "arg_3", "=", "(", "arg_3", "+", "(", "'0'", "*", "arg_2", ")", ")", "[", ":", "arg_2", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=-1):\n        \"\"\"Return the PhoneticSpanish coding of word.\n\n        Parameters\n        ----------\n        word : str\n            The word to transform\n        max_length : int\n            The length of the code returned (defaults to unlimited)\n\n        Returns\n        -------\n        str\n            The PhoneticSpanish code\n\n        Examples\n        --------\n        >>> pe = PhoneticSpanish()\n        >>> pe.Func('Perez')\n        '094'\n        >>> pe.Func('Martinez')\n        '69364'\n        >>> pe.Func('Gutierrez')\n        '83994'\n        >>> pe.Func('Santiago')\n        '4638'\n        >>> pe.Func('Nicol\u00e1s')\n        '6454'\n\n        \"\"\"\n        # uppercase, normalize, and decompose, filter to A-Z minus vowels & W\n        arg_1 = unicode_normalize('NFKD', text_type(arg_1.upper()))\n        arg_1 = ''.join(c for c in arg_1 if c in arg_0._uc_set)\n\n        # merge repeated Ls & Rs\n        arg_1 = arg_1.replace('LL', 'L')\n        arg_1 = arg_1.replace('R', 'R')\n\n        # apply the Soundex algorithm\n        arg_3 = arg_1.translate(arg_0._trans)\n\n        if arg_2 > 0:\n            arg_3 = (arg_3 + ('0' * arg_2))[:arg_2]\n\n        return arg_3", "path": "abydos/phonetic/_phonetic_spanish.py", "identifier": "PhoneticSpanish.encode", "docstring": "Return the PhoneticSpanish coding of word.\n\n        Parameters\n        ----------\n        word : str\n            The word to transform\n        max_length : int\n            The length of the code returned (defaults to unlimited)\n\n        Returns\n        -------\n        str\n            The PhoneticSpanish code\n\n        Examples\n        --------\n        >>> pe = PhoneticSpanish()\n        >>> pe.encode('Perez')\n        '094'\n        >>> pe.encode('Martinez')\n        '69364'\n        >>> pe.encode('Gutierrez')\n        '83994'\n        >>> pe.encode('Santiago')\n        '4638'\n        >>> pe.encode('Nicol\u00e1s')\n        '6454'", "docstring_tokens": ["Return", "the", "PhoneticSpanish", "coding", "of", "word", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253290}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L78-L92", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Create a map of command names and handlers", "language": "python", "parameters": "()", "return_statement": "return {\n      'activate': activate,\n      'config': hconfig,\n      'deactivate': deactivate,\n      'help': cli_help,\n      'kill': kill,\n      'restart': restart,\n      'submit': submit,\n      'update': update,\n      'version': version\n  }", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "return", "{", "'activate'", ":", "activate", ",", "'config'", ":", "hconfig", ",", "'deactivate'", ":", "deactivate", ",", "'help'", ":", "cli_help", ",", "'kill'", ":", "kill", ",", "'restart'", ":", "restart", ",", "'submit'", ":", "submit", ",", "'update'", ":", "update", ",", "'version'", ":", "version", "}"], "function": "def Func():\n  '''\n  Create a map of command names and handlers\n  '''\n  return {\n      'activate': activate,\n      'config': hconfig,\n      'deactivate': deactivate,\n      'help': cli_help,\n      'kill': kill,\n      'restart': restart,\n      'submit': submit,\n      'update': update,\n      'version': version\n  }", "path": "heron/tools/cli/src/python/main.py", "identifier": "get_command_handlers", "docstring": "Create a map of command names and handlers", "docstring_tokens": ["Create", "a", "map", "of", "command", "names", "and", "handlers"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253291}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L606-L613", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Increase the processed task counter and show progress message", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "Func_tasks", "+=", "1", "arg_1", "=", "arg_0", ".", "tasks", ".", "qsize", "(", ")", "if", "arg_1", ">", "0", ":", "progress", "(", "'[%d task(s) completed, %d remaining, %d thread(s)]'", ",", "arg_0", ".", "Func_tasks", ",", "arg_1", ",", "len", "(", "arg_0", ".", "workers", ")", ")", "else", ":", "progress", "(", "'[%d task(s) completed, %d thread(s)]'", ",", "arg_0", ".", "Func_tasks", ",", "len", "(", "arg_0", ".", "workers", ")", ")"], "function": "def Func(arg_0):\n    '''Increase the Func task counter and show progress message'''\n    arg_0.Func_tasks += 1\n    arg_1 = arg_0.tasks.qsize()\n    if arg_1 > 0:\n      progress('[%d task(s) completed, %d remaining, %d thread(s)]', arg_0.Func_tasks, arg_1, len(arg_0.workers))\n    else:\n      progress('[%d task(s) completed, %d thread(s)]', arg_0.Func_tasks, len(arg_0.workers))", "path": "s4cmd.py", "identifier": "ThreadPool.processed", "docstring": "Increase the processed task counter and show progress message", "docstring_tokens": ["Increase", "the", "processed", "task", "counter", "and", "show", "progress", "message"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 253292}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L431-L455", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a map from the input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "return lmap.map(d)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "lmap", ".", "Map", ":", "arg_2", "=", "arg_0", ".", "reader", "arg_3", "=", "arg_2", ".", "advance", "(", ")", "assert", "arg_3", "==", "\"{\"", "arg_4", ":", "MutableMapping", "[", "Any", ",", "Any", "]", "=", "{", "}", "while", "True", ":", "if", "arg_2", ".", "peek", "(", ")", "==", "\"}\"", ":", "arg_2", ".", "next_token", "(", ")", "break", "arg_5", "=", "_read_next", "(", "arg_0", ")", "if", "arg_5", "is", "COMMENT", ":", "continue", "while", "True", ":", "if", "arg_2", ".", "peek", "(", ")", "==", "\"}\"", ":", "raise", "SyntaxError", "(", "\"Unexpected token '}'; expected map value\"", ")", "arg_6", "=", "_read_next", "(", "arg_0", ")", "if", "arg_6", "is", "COMMENT", ":", "continue", "if", "arg_5", "in", "arg_4", ":", "raise", "SyntaxError", "(", "f\"Duplicate key '{k}' in map literal\"", ")", "break", "arg_4", "[", "arg_5", "]", "=", "arg_6", "return", "lmap", ".", "map", "(", "arg_4", ")"], "function": "def Func(arg_0: arg_1) -> lmap.Map:\n    \"\"\"Return a map from the input stream.\"\"\"\n    arg_2 = arg_0.reader\n    arg_3 = arg_2.advance()\n    assert arg_3 == \"{\"\n    arg_4: MutableMapping[Any, Any] = {}\n    while True:\n        if arg_2.peek() == \"}\":\n            arg_2.next_token()\n            break\n        arg_5 = _read_next(arg_0)\n        if arg_5 is COMMENT:\n            continue\n        while True:\n            if arg_2.peek() == \"}\":\n                raise SyntaxError(\"Unexpected token '}'; expected map value\")\n            arg_6 = _read_next(arg_0)\n            if arg_6 is COMMENT:\n                continue\n            if arg_5 in arg_4:\n                raise SyntaxError(f\"Duplicate key '{k}' in map literal\")\n            break\n        arg_4[arg_5] = arg_6\n\n    return lmap.map(arg_4)", "path": "src/basilisp/lang/reader.py", "identifier": "_read_map", "docstring": "Return a map from the input stream.", "docstring_tokens": ["Return", "a", "map", "from", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 253293}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dstat.py#L74-L87", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Convert types of task fields.", "language": "python", "parameters": "(self, row)", "return_statement": "return row", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "'last-update'", ",", "'create-time'", ",", "'start-time'", ",", "'end-time'", "]", "arg_3", "=", "[", "'task-attempt'", "]", "for", "arg_4", "in", "arg_2", ":", "if", "arg_4", "in", "arg_1", ":", "arg_1", "[", "arg_4", "]", "=", "arg_0", ".", "default_format_date", "(", "arg_1", "[", "arg_4", "]", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", "in", "arg_1", "and", "arg_1", "[", "arg_4", "]", "is", "not", "None", ":", "arg_1", "[", "arg_4", "]", "=", "int", "(", "arg_1", "[", "arg_4", "]", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Convert types of task fields.\"\"\"\n    arg_2 = ['last-update', 'create-time', 'start-time', 'end-time']\n    arg_3 = ['task-attempt']\n\n    for arg_4 in arg_2:\n      if arg_4 in arg_1:\n        arg_1[arg_4] = arg_0.default_format_date(arg_1[arg_4])\n\n    for arg_4 in arg_3:\n      if arg_4 in arg_1 and arg_1[arg_4] is not None:\n        arg_1[arg_4] = int(arg_1[arg_4])\n\n    return arg_1", "path": "dsub/commands/dstat.py", "identifier": "OutputFormatter.prepare_output", "docstring": "Convert types of task fields.", "docstring_tokens": ["Convert", "types", "of", "task", "fields", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 253294}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/access_tokens.py#L104-L148", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Exchange an Authorization Code for an Access Token.", "language": "python", "parameters": "(self, client_id, client_secret, code, redirect_uri)", "return_statement": "return self._object_factory(OBJECT_TYPE, json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "check_type", "(", "arg_2", ",", "basestring", ",", "may_be_none", "=", "False", ")", "check_type", "(", "arg_3", ",", "basestring", ",", "may_be_none", "=", "False", ")", "check_type", "(", "arg_4", ",", "basestring", ",", "may_be_none", "=", "False", ")", "arg_5", "=", "dict_from_items_with_values", "(", "grant_type", "=", "\"authorization_code\"", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", ")", "arg_6", "=", "requests", ".", "post", "(", "arg_0", ".", "_endpoint_url", ",", "data", "=", "arg_5", ",", "**", "arg_0", ".", "_request_kwargs", ")", "check_response_code", "(", "arg_6", ",", "EXPECTED_RESPONSE_CODE", "[", "'POST'", "]", ")", "arg_7", "=", "extract_and_parse_json", "(", "arg_6", ")", "return", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Exchange an Authorization Code for an Access Token.\n\n        Exchange an Authorization Code for an Access Token that can be used to\n        invoke the APIs.\n\n        Args:\n            client_id(basestring): Provided when you created your integration.\n            client_secret(basestring): Provided when you created your\n                integration.\n            code(basestring): The Authorization Code provided by the user\n                OAuth process.\n            redirect_uri(basestring): The redirect URI used in the user OAuth\n                process.\n\n        Returns:\n            AccessToken: An AccessToken object with the access token provided\n            by the Webex Teams cloud.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n        check_type(arg_2, basestring, may_be_none=False)\n        check_type(arg_3, basestring, may_be_none=False)\n        check_type(arg_4, basestring, may_be_none=False)\n\n        arg_5 = dict_from_items_with_values(\n            grant_type=\"authorization_code\",\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n        )\n\n        # API request\n        arg_6 = requests.post(arg_0._endpoint_url, data=arg_5,\n                                 **arg_0._request_kwargs)\n        check_response_code(arg_6, EXPECTED_RESPONSE_CODE['POST'])\n        arg_7 = extract_and_parse_json(arg_6)\n\n        # Return a access_token object created from the response JSON data\n        return arg_0._object_factory(OBJECT_TYPE, arg_7)", "path": "webexteamssdk/api/access_tokens.py", "identifier": "AccessTokensAPI.get", "docstring": "Exchange an Authorization Code for an Access Token.\n\n        Exchange an Authorization Code for an Access Token that can be used to\n        invoke the APIs.\n\n        Args:\n            client_id(basestring): Provided when you created your integration.\n            client_secret(basestring): Provided when you created your\n                integration.\n            code(basestring): The Authorization Code provided by the user\n                OAuth process.\n            redirect_uri(basestring): The redirect URI used in the user OAuth\n                process.\n\n        Returns:\n            AccessToken: An AccessToken object with the access token provided\n            by the Webex Teams cloud.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Exchange", "an", "Authorization", "Code", "for", "an", "Access", "Token", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 253295}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L673-L677", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Retrieve a list of actions supported by the object.", "language": "python", "parameters": "(self)", "return_statement": "return [action[2:] for action in actions]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_a11y", ".", "AXUIElement", ".", "Func", "(", "arg_0", ")", "return", "[", "arg_2", "[", "2", ":", "]", "for", "arg_2", "in", "arg_1", "]"], "function": "def Func(arg_0):\n        \"\"\"Retrieve a list of actions supported by the object.\"\"\"\n        arg_1 = _a11y.AXUIElement.Func(arg_0)\n        # strip leading AX from actions - help distinguish them from attributes\n        return [arg_2[2:] for arg_2 in arg_1]", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._getActions", "docstring": "Retrieve a list of actions supported by the object.", "docstring_tokens": ["Retrieve", "a", "list", "of", "actions", "supported", "by", "the", "object", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 253296}
{"url": "https://github.com/hsharrison/pyglet2d/blob/46f610b3c76221bff19e5c0cf3d35d7875ce37a0/src/pyglet2d.py#L282-L295", "sha": "46f610b3c76221bff19e5c0cf3d35d7875ce37a0", "docstring_summary": "Flip the shape in the x direction, in-place.", "language": "python", "parameters": "(self, center=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "poly", ".", "flip", "(", ")", "else", ":", "arg_0", ".", "poly", ".", "flip", "(", "arg_1", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Flip the shape in the x direction, in-place.\n\n        Parameters\n        ----------\n        center : array-like, optional\n            Point about which to flip.\n            If not passed, the center of the shape will be used.\n\n         \"\"\"\n        if arg_1 is None:\n            arg_0.poly.flip()\n        else:\n            arg_0.poly.flip(arg_1[0])", "path": "src/pyglet2d.py", "identifier": "Shape.flip_x", "docstring": "Flip the shape in the x direction, in-place.\n\n        Parameters\n        ----------\n        center : array-like, optional\n            Point about which to flip.\n            If not passed, the center of the shape will be used.", "docstring_tokens": ["Flip", "the", "shape", "in", "the", "x", "direction", "in", "-", "place", "."], "nwo": "hsharrison/pyglet2d", "score": 0.2823188883832642, "idx": 253297}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/statements.py#L456-L487", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Assign parent statement and propagate dependency flags if necessary", "language": "python", "parameters": "(self, parentStm: \"HdlStatement\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "\"HdlStatement\"", ")", ":", "arg_2", "=", "arg_0", ".", "parentStm", "is", "None", "arg_0", ".", "parentStm", "=", "arg_1", "if", "not", "arg_0", ".", "_now_is_event_dependent", "and", "arg_1", ".", "_now_is_event_dependent", ":", "arg_0", ".", "_on_parent_event_dependent", "(", ")", "arg_3", "=", "arg_1", "while", "arg_3", ".", "parentStm", "is", "not", "None", ":", "arg_3", "=", "arg_3", ".", "parentStm", "arg_4", "=", "arg_3", ".", "_outputs", ".", "append", "arg_5", "=", "arg_3", ".", "_inputs", ".", "append", "if", "arg_2", ":", "for", "arg_6", "in", "arg_0", ".", "_inputs", ":", "arg_6", ".", "endpoints", ".", "discard", "(", "arg_0", ")", "arg_6", ".", "endpoints", ".", "append", "(", "arg_3", ")", "arg_5", "(", "arg_6", ")", "for", "arg_7", "in", "arg_0", ".", "_outputs", ":", "arg_7", ".", "drivers", ".", "discard", "(", "arg_0", ")", "arg_7", ".", "drivers", ".", "append", "(", "arg_3", ")", "arg_4", "(", "arg_7", ")", "arg_8", "=", "arg_0", ".", "_get_rtl_context", "(", ")", "arg_8", ".", "statements", ".", "discard", "(", "arg_0", ")", "arg_1", ".", "rank", "+=", "arg_0", ".", "rank"], "function": "def Func(arg_0, arg_1: \"HdlStatement\"):\n        \"\"\"\n        Assign parent statement and propagate dependency flags if necessary\n        \"\"\"\n        arg_2 = arg_0.parentStm is None\n        arg_0.parentStm = arg_1\n        if not arg_0._now_is_event_dependent\\\n                and arg_1._now_is_event_dependent:\n            arg_0._on_parent_event_dependent()\n\n        arg_3 = arg_1\n        while arg_3.parentStm is not None:\n            arg_3 = arg_3.parentStm\n\n        arg_4 = arg_3._outputs.append\n        arg_5 = arg_3._inputs.append\n\n        if arg_2:\n            for arg_6 in arg_0._inputs:\n                arg_6.endpoints.discard(arg_0)\n                arg_6.endpoints.append(arg_3)\n                arg_5(arg_6)\n\n            for arg_7 in arg_0._outputs:\n                arg_7.drivers.discard(arg_0)\n                arg_7.drivers.append(arg_3)\n                arg_4(arg_7)\n\n            arg_8 = arg_0._get_rtl_context()\n            arg_8.statements.discard(arg_0)\n\n        arg_1.rank += arg_0.rank", "path": "hwt/hdl/statements.py", "identifier": "HdlStatement._set_parent_stm", "docstring": "Assign parent statement and propagate dependency flags if necessary", "docstring_tokens": ["Assign", "parent", "statement", "and", "propagate", "dependency", "flags", "if", "necessary"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 253298}
{"url": "https://github.com/ricobl/django-importer/blob/6967adfa7a286be7aaf59d3f33c6637270bd9df6/django_importer/importers/base.py#L127-L133", "sha": "6967adfa7a286be7aaf59d3f33c6637270bd9df6", "docstring_summary": "Saves a model instance to the database.", "language": "python", "parameters": "(self, item, data, instance, commit=True)", "return_statement": "return instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "True", ")", ":", "if", "arg_4", ":", "arg_3", ".", "save", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=True):\n        \"\"\"\n        Saves a model instance to the database.\n        \"\"\"\n        if arg_4:\n            arg_3.save()\n        return arg_3", "path": "django_importer/importers/base.py", "identifier": "Importer.save_item", "docstring": "Saves a model instance to the database.", "docstring_tokens": ["Saves", "a", "model", "instance", "to", "the", "database", "."], "nwo": "ricobl/django-importer", "score": 0.3726785709016597, "idx": 253299}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L567-L599", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Stops running proxy.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "sql_proxy_process", ":", "raise", "AirflowException", "(", "\"The sql proxy is not started yet\"", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "\"Stopping the cloud_sql_proxy pid: %s\"", ",", "arg_0", ".", "sql_proxy_process", ".", "pid", ")", "arg_0", ".", "sql_proxy_process", ".", "kill", "(", ")", "arg_0", ".", "sql_proxy_process", "=", "None", "arg_0", ".", "log", ".", "info", "(", "\"Removing the socket directory: %s\"", ",", "arg_0", ".", "cloud_sql_proxy_socket_directory", ")", "shutil", ".", "rmtree", "(", "arg_0", ".", "cloud_sql_proxy_socket_directory", ",", "ignore_errors", "=", "True", ")", "if", "arg_0", ".", "sql_proxy_was_downloaded", ":", "arg_0", ".", "log", ".", "info", "(", "\"Removing downloaded proxy: %s\"", ",", "arg_0", ".", "sql_proxy_path", ")", "try", ":", "os", ".", "remove", "(", "arg_0", ".", "sql_proxy_path", ")", "except", "OSError", "as", "e", ":", "if", "not", "e", ".", "errno", "==", "errno", ".", "ENOENT", ":", "raise", "else", ":", "arg_0", ".", "log", ".", "info", "(", "\"Skipped removing proxy - it was not downloaded: %s\"", ",", "arg_0", ".", "sql_proxy_path", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ".", "credentials_path", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"Removing generated credentials file %s\"", ",", "arg_0", ".", "credentials_path", ")", "os", ".", "remove", "(", "arg_0", ".", "credentials_path", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Stops running proxy.\n\n        You should stop the proxy after you stop using it.\n        \"\"\"\n        if not arg_0.sql_proxy_process:\n            raise AirflowException(\"The sql proxy is not started yet\")\n        else:\n            arg_0.log.info(\"Stopping the cloud_sql_proxy pid: %s\",\n                          arg_0.sql_proxy_process.pid)\n            arg_0.sql_proxy_process.kill()\n            arg_0.sql_proxy_process = None\n        # Cleanup!\n        arg_0.log.info(\"Removing the socket directory: %s\",\n                      arg_0.cloud_sql_proxy_socket_directory)\n        shutil.rmtree(arg_0.cloud_sql_proxy_socket_directory, ignore_errors=True)\n        if arg_0.sql_proxy_was_downloaded:\n            arg_0.log.info(\"Removing downloaded proxy: %s\", arg_0.sql_proxy_path)\n            # Silently ignore if the file has already been removed (concurrency)\n            try:\n                os.remove(arg_0.sql_proxy_path)\n            except OSError as e:\n                if not e.errno == errno.ENOENT:\n                    raise\n        else:\n            arg_0.log.info(\"Skipped removing proxy - it was not downloaded: %s\",\n                          arg_0.sql_proxy_path)\n        if os.path.isfile(arg_0.credentials_path):\n            arg_0.log.info(\"Removing generated credentials file %s\",\n                          arg_0.credentials_path)\n            # Here file cannot be delete by concurrent task (each task has its own copy)\n            os.remove(arg_0.credentials_path)", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlProxyRunner.stop_proxy", "docstring": "Stops running proxy.\n\n        You should stop the proxy after you stop using it.", "docstring_tokens": ["Stops", "running", "proxy", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253300}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/adblock.py#L178-L214", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Extract the base of the given element.", "language": "python", "parameters": "(self, element)", "return_statement": "return element", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "list", ")", ":", "return", "[", "arg_0", ".", "Func", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]", "arg_3", "=", "arg_0", ".", "checker", ".", "is_url_valid", "(", "url", "=", "arg_1", ",", "return_base", "=", "True", ")", "if", "arg_3", ":", "return", "arg_3", "if", "\"/\"", "in", "arg_1", ":", "return", "arg_1", ".", "split", "(", "\"/\"", ")", "[", "0", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Extract the base of the given element.\n\n        .. example:\n            given \"hello/world?world=beautiful\" return \"hello\"\n\n        :param element: The element we are working with.\n        :type element: str|list\n        \"\"\"\n\n        if isinstance(arg_1, list):\n            # The given element is a list.\n\n            # We get the base of each element of the list.\n            return [arg_0.Func(arg_2) for arg_2 in arg_1]\n\n        # We get the base if it is an URL.\n        arg_3 = arg_0.checker.is_url_valid(url=arg_1, return_base=True)\n\n        if arg_3:\n            # It is an URL.\n\n            # We return the extracted base.\n            return arg_3\n\n        if \"/\" in arg_1:\n            # / is in the given element.\n\n            # We return the first element before the\n            # first /\n            return arg_1.split(\"/\")[0]\n\n        # / is not in the given element.\n\n        # We return the given element.\n        return arg_1", "path": "PyFunceble/adblock.py", "identifier": "AdBlock._extract_base", "docstring": "Extract the base of the given element.\n\n        .. example:\n            given \"hello/world?world=beautiful\" return \"hello\"\n\n        :param element: The element we are working with.\n        :type element: str|list", "docstring_tokens": ["Extract", "the", "base", "of", "the", "given", "element", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 253301}
{"url": "https://github.com/kmmbvnr/django-any/blob/6f64ebd05476e2149e2e71deeefbb10f8edfc412/django_any/functions.py#L6-L15", "sha": "6f64ebd05476e2149e2e71deeefbb10f8edfc412", "docstring_summary": "Return list of choices's keys", "language": "python", "parameters": "(choices)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ":", "if", "isinstance", "(", "arg_2", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "arg_1", ",", "arg_3", "in", "arg_2", ":", "yield", "arg_1", "else", ":", "yield", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Return list of choices's keys\n    \"\"\"\n    for arg_1, arg_2 in arg_0:\n        if isinstance(arg_2, (list, tuple)):\n            for arg_1, arg_3 in arg_2:\n                yield arg_1\n        else:\n            yield arg_1", "path": "django_any/functions.py", "identifier": "valid_choices", "docstring": "Return list of choices's keys", "docstring_tokens": ["Return", "list", "of", "choices", "s", "keys"], "nwo": "kmmbvnr/django-any", "score": 0.18384731799856882, "idx": 253302}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/standard/ubase.py#L50-L52", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Apply U to q.", "language": "python", "parameters": "(self, theta, phi, lam, q)", "return_statement": "return self.append(UBase(theta, phi, lam), [q], [])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "return", "arg_0", ".", "append", "(", "UBase", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "[", "arg_4", "]", ",", "[", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Apply U to q.\"\"\"\n    return arg_0.append(UBase(arg_1, arg_2, arg_3), [arg_4], [])", "path": "qiskit/extensions/standard/ubase.py", "identifier": "u_base", "docstring": "Apply U to q.", "docstring_tokens": ["Apply", "U", "to", "q", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253303}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/superop.py#L316-L346", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the composition channel.", "language": "python", "parameters": "(self, other, qargs, front=False)", "return_statement": "return SuperOp(data, input_dims, output_dims)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "list", "(", "arg_0", ".", "input_dims", "(", ")", ")", "arg_5", "=", "list", "(", "arg_0", ".", "output_dims", "(", ")", ")", "if", "arg_3", ":", "arg_6", "=", "len", "(", "arg_0", ".", "input_dims", "(", ")", ")", "arg_7", "=", "2", "*", "len", "(", "arg_0", ".", "output_dims", "(", ")", ")", "arg_8", "=", "True", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_2", ")", ":", "arg_4", "[", "arg_10", "]", "=", "arg_1", ".", "_input_dims", "[", "arg_9", "]", "else", ":", "arg_6", "=", "len", "(", "arg_0", ".", "output_dims", "(", ")", ")", "arg_7", "=", "0", "arg_8", "=", "False", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_2", ")", ":", "arg_5", "[", "arg_10", "]", "=", "arg_1", ".", "_output_dims", "[", "arg_9", "]", "arg_11", "=", "np", ".", "reshape", "(", "arg_0", ".", "data", ",", "arg_0", ".", "_shape", ")", "arg_12", "=", "np", ".", "reshape", "(", "arg_1", ".", "data", ",", "arg_1", ".", "_shape", ")", "arg_13", "=", "[", "2", "*", "arg_6", "-", "1", "-", "arg_10", "for", "arg_10", "in", "arg_2", "]", "+", "[", "arg_6", "-", "1", "-", "arg_10", "for", "arg_10", "in", "arg_2", "]", "arg_14", "=", "[", "np", ".", "product", "(", "arg_5", ")", "**", "2", ",", "np", ".", "product", "(", "arg_4", ")", "**", "2", "]", "arg_15", "=", "np", ".", "reshape", "(", "arg_0", ".", "_einsum_matmul", "(", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_7", ",", "arg_8", ")", ",", "arg_14", ")", "return", "SuperOp", "(", "arg_15", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"Return the composition channel.\"\"\"\n        # Compute tensor contraction indices from qargs\n        arg_4 = list(arg_0.input_dims())\n        arg_5 = list(arg_0.output_dims())\n        if arg_3:\n            arg_6 = len(arg_0.input_dims())\n            arg_7 = 2 * len(arg_0.output_dims())\n            arg_8 = True\n            for arg_9, arg_10 in enumerate(arg_2):\n                arg_4[arg_10] = arg_1._input_dims[arg_9]\n        else:\n            arg_6 = len(arg_0.output_dims())\n            arg_7 = 0\n            arg_8 = False\n            for arg_9, arg_10 in enumerate(arg_2):\n                arg_5[arg_10] = arg_1._output_dims[arg_9]\n        # Reshape current matrix\n        # Note that we must reverse the subsystem dimension order as\n        # qubit 0 corresponds to the right-most position in the tensor\n        # product, which is the last tensor wire index.\n        arg_11 = np.reshape(arg_0.data, arg_0._shape)\n        arg_12 = np.reshape(arg_1.data, arg_1._shape)\n        # Add first set of indicies\n        arg_13 = [2 * arg_6 - 1 - arg_10 for arg_10 in arg_2\n                   ] + [arg_6 - 1 - arg_10 for arg_10 in arg_2]\n        arg_14 = [np.product(arg_5)**2, np.product(arg_4)**2]\n        arg_15 = np.reshape(\n            arg_0._einsum_matmul(arg_11, arg_12, arg_13, arg_7, arg_8),\n            arg_14)\n        return SuperOp(arg_15, arg_4, arg_5)", "path": "qiskit/quantum_info/operators/channel/superop.py", "identifier": "SuperOp._compose_subsystem", "docstring": "Return the composition channel.", "docstring_tokens": ["Return", "the", "composition", "channel", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253304}
{"url": "https://github.com/mrsarm/mongotail/blob/82ba74e32eff92faa320833a8d19c58555f9cd49/setup.py#L30-L33", "sha": "82ba74e32eff92faa320833a8d19c58555f9cd49", "docstring_summary": "Read the contents of a file located relative to setup.py", "language": "python", "parameters": "(*pathcomponents)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "with", "open", "(", "join", "(", "abspath", "(", "dirname", "(", "__file__", ")", ")", ",", "*", "arg_0", ")", ")", "as", "thefile", ":", "return", "thefile", ".", "Func", "(", ")"], "function": "def Func(*arg_0):\n    \"\"\"Read the contents of a file located relative to setup.py\"\"\"\n    with open(join(abspath(dirname(__file__)), *arg_0)) as thefile:\n        return thefile.Func()", "path": "setup.py", "identifier": "read", "docstring": "Read the contents of a file located relative to setup.py", "docstring_tokens": ["Read", "the", "contents", "of", "a", "file", "located", "relative", "to", "setup", ".", "py"], "nwo": "mrsarm/mongotail", "score": 0.5669847104023414, "idx": 253305}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1425-L1441", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Specify a callback function that will be called when a server offers\n        Next Protocol Negotiation options.", "language": "python", "parameters": "(self, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_warn_npn", "(", ")", "arg_0", ".", "_npn_select_helper", "=", "_NpnSelectHelper", "(", "arg_1", ")", "arg_0", ".", "_npn_select_callback", "=", "arg_0", ".", "_npn_select_helper", ".", "callback", "_lib", ".", "SSL_CTX_set_next_proto_select_cb", "(", "arg_0", ".", "_context", ",", "arg_0", ".", "_npn_select_callback", ",", "_ffi", ".", "NULL", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Specify a callback function that will be called when a server offers\n        Next Protocol Negotiation options.\n\n        :param callback: The callback function.  It will be invoked with two\n            arguments: the Connection, and a list of offered protocols as\n            bytestrings, e.g. ``[b'http/1.1', b'spdy/2']``.  It should return\n            one of those bytestrings, the chosen protocol.\n\n        .. versionadded:: 0.15\n        \"\"\"\n        _warn_npn()\n        arg_0._npn_select_helper = _NpnSelectHelper(arg_1)\n        arg_0._npn_select_callback = arg_0._npn_select_helper.callback\n        _lib.SSL_CTX_set_next_proto_select_cb(\n            arg_0._context, arg_0._npn_select_callback, _ffi.NULL)", "path": "src/OpenSSL/SSL.py", "identifier": "Context.set_npn_select_callback", "docstring": "Specify a callback function that will be called when a server offers\n        Next Protocol Negotiation options.\n\n        :param callback: The callback function.  It will be invoked with two\n            arguments: the Connection, and a list of offered protocols as\n            bytestrings, e.g. ``[b'http/1.1', b'spdy/2']``.  It should return\n            one of those bytestrings, the chosen protocol.\n\n        .. versionadded:: 0.15", "docstring_tokens": ["Specify", "a", "callback", "function", "that", "will", "be", "called", "when", "a", "server", "offers", "Next", "Protocol", "Negotiation", "options", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 253306}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L858-L879", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Store a training sample and associated category label", "language": "python", "parameters": "(self, inputVector, trueCatIndex, partition=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "0", ")", ":", "if", "arg_0", ".", "_samples", "is", "None", ":", "arg_0", ".", "_samples", "=", "numpy", ".", "zeros", "(", "(", "0", ",", "len", "(", "arg_1", ")", ")", ",", "dtype", "=", "RealNumpyDType", ")", "assert", "arg_0", ".", "_labels", "is", "None", "arg_0", ".", "_labels", "=", "[", "]", "arg_0", ".", "_samples", "=", "numpy", ".", "concatenate", "(", "(", "arg_0", ".", "_samples", ",", "numpy", ".", "atleast_2d", "(", "arg_1", ")", ")", ",", "axis", "=", "0", ")", "arg_0", ".", "_labels", "+=", "[", "arg_2", "]", "if", "arg_0", ".", "_partitions", "is", "None", ":", "arg_0", ".", "_partitions", "=", "[", "]", "if", "arg_3", "is", "None", ":", "arg_3", "=", "0", "arg_0", ".", "_partitions", "+=", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=0):\n    \"\"\"\n    Store a training sample and associated category label\n    \"\"\"\n\n    # If this is the first sample, then allocate a numpy array\n    # of the appropriate size in which to store all samples.\n    if arg_0._samples is None:\n      arg_0._samples = numpy.zeros((0, len(arg_1)), dtype=RealNumpyDType)\n      assert arg_0._labels is None\n      arg_0._labels = []\n\n    # Add the sample vector and category lable\n    arg_0._samples = numpy.concatenate((arg_0._samples, numpy.atleast_2d(arg_1)), axis=0)\n    arg_0._labels += [arg_2]\n\n    # Add the partition ID\n    if arg_0._partitions is None:\n      arg_0._partitions = []\n    if arg_3 is None:\n      arg_3 = 0\n    arg_0._partitions += [arg_3]", "path": "src/nupic/regions/knn_classifier_region.py", "identifier": "KNNClassifierRegion._storeSample", "docstring": "Store a training sample and associated category label", "docstring_tokens": ["Store", "a", "training", "sample", "and", "associated", "category", "label"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253307}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/metric_export.py#L59-L67", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Extract required fields from an array", "language": "python", "parameters": "(self, metrics)", "return_statement": "return new_metrics", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "extract_fields", "(", "arg_3", ")", "arg_2", "[", "arg_3", "[", "'name'", "]", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Extract required fields from an array\n        \"\"\"\n        arg_2 = {}\n        for arg_3 in arg_1:\n            arg_4 = arg_0.extract_fields(arg_3)\n            arg_2[arg_3['name']] = arg_4\n        return arg_2", "path": "boundary/metric_export.py", "identifier": "MetricExport.extract_dictionary", "docstring": "Extract required fields from an array", "docstring_tokens": ["Extract", "required", "fields", "from", "an", "array"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 253308}
{"url": "https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L333-L362", "sha": "0828eaace0846918d2d202f5a60167a003e88b71", "docstring_summary": "Compare against another `Jwt`.", "language": "python", "parameters": "(self, jwt: 'Jwt', compare_dates: bool = False)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "'Jwt'", ",", "arg_2", ":", "arg_3", "=", "False", ")", "->", "arg_3", ":", "if", "arg_0", ".", "secret", "!=", "arg_1", ".", "secret", ":", "return", "False", "if", "arg_0", ".", "payload", "!=", "arg_1", ".", "payload", ":", "return", "False", "if", "arg_0", ".", "alg", "!=", "arg_1", ".", "alg", ":", "return", "False", "if", "arg_0", ".", "header", "!=", "arg_1", ".", "header", ":", "return", "False", "arg_4", "=", "arg_0", ".", "registered_claims", "arg_5", "=", "arg_1", ".", "registered_claims", "if", "not", "arg_2", ":", "arg_6", "=", "[", "'exp'", ",", "'nbf'", ",", "'iat'", "]", "arg_4", "=", "{", "k", ":", "{", "v", "if", "k", "not", "in", "arg_6", "else", "None", "}", "for", "k", ",", "v", "in", "arg_4", ".", "items", "(", ")", "}", "arg_5", "=", "{", "k", ":", "{", "v", "if", "k", "not", "in", "arg_6", "else", "None", "}", "for", "k", ",", "v", "in", "arg_5", ".", "items", "(", ")", "}", "if", "arg_4", "!=", "arg_5", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1: 'Jwt', arg_2: arg_3 = False) -> arg_3:\n        \"\"\"\n        Compare against another `Jwt`.\n\n        :param jwt: The token to Func against.\n        :type jwt: Jwt\n        :param Func_dates: Should the comparision take dates into account?\n        :type Func_dates: bool\n        :return: Are the two Jwt's the same?\n        :rtype: bool\n        \"\"\"\n        if arg_0.secret != arg_1.secret:\n            return False\n        if arg_0.payload != arg_1.payload:\n            return False\n        if arg_0.alg != arg_1.alg:\n            return False\n        if arg_0.header != arg_1.header:\n            return False\n        arg_4 = arg_0.registered_claims\n        arg_5 = arg_1.registered_claims\n        if not arg_2:\n            arg_6 = ['exp', 'nbf', 'iat']\n            arg_4 = {k: {v if k not in arg_6 else None} for k, v in\n                               arg_4.items()}\n            arg_5 = {k: {v if k not in arg_6 else None} for k, v in\n                             arg_5.items()}\n        if arg_4 != arg_5:\n            return False\n        return True", "path": "simplejwt/jwt.py", "identifier": "Jwt.compare", "docstring": "Compare against another `Jwt`.\n\n        :param jwt: The token to compare against.\n        :type jwt: Jwt\n        :param compare_dates: Should the comparision take dates into account?\n        :type compare_dates: bool\n        :return: Are the two Jwt's the same?\n        :rtype: bool", "docstring_tokens": ["Compare", "against", "another", "Jwt", "."], "nwo": "jmwri/simplejwt", "score": 0.2549979292514255, "idx": 253309}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/compiler/imputil.py#L207-L233", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Determines all modules that script transitively depends upon.", "language": "python", "parameters": "(modname, script, gopath)", "return_statement": "return deps", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "set", "(", ")", "def", "calc", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "in", "arg_3", ":", "return", "arg_3", ".", "add", "(", "arg_0", ")", "for", "arg_4", "in", "collect_imports", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_4", ".", "is_native", ":", "arg_3", ".", "add", "(", "arg_4", ".", "name", ")", "continue", "arg_5", "=", "arg_4", ".", "name", ".", "split", "(", "'.'", ")", "calc", "(", "arg_4", ".", "name", ",", "arg_4", ".", "script", ")", "if", "len", "(", "arg_5", ")", "==", "1", ":", "continue", "arg_6", ",", "arg_7", "=", "os", ".", "path", ".", "split", "(", "arg_4", ".", "script", ")", "if", "arg_7", "==", "'__init__.py'", ":", "arg_6", "=", "os", ".", "path", ".", "dirname", "(", "arg_6", ")", "for", "arg_8", "in", "xrange", "(", "len", "(", "arg_5", ")", "-", "1", ",", "0", ",", "-", "1", ")", ":", "arg_0", "=", "'.'", ".", "join", "(", "arg_5", "[", ":", "arg_8", "]", ")", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_6", ",", "'__init__.py'", ")", "calc", "(", "arg_0", ",", "arg_1", ")", "arg_6", "=", "os", ".", "path", ".", "dirname", "(", "arg_6", ")", "calc", "(", "arg_0", ",", "arg_1", ")", "arg_3", ".", "remove", "(", "arg_0", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Determines all modules that script transitively depends upon.\"\"\"\n  arg_3 = set()\n  def calc(arg_0, arg_1):\n    if arg_0 in arg_3:\n      return\n    arg_3.add(arg_0)\n    for arg_4 in collect_imports(arg_0, arg_1, arg_2):\n      if arg_4.is_native:\n        arg_3.add(arg_4.name)\n        continue\n      arg_5 = arg_4.name.split('.')\n      calc(arg_4.name, arg_4.script)\n      if len(arg_5) == 1:\n        continue\n      # For submodules, the parent packages are also deps.\n      arg_6, arg_7 = os.path.split(arg_4.script)\n      if arg_7 == '__init__.py':\n        arg_6 = os.path.dirname(arg_6)\n      for arg_8 in xrange(len(arg_5) - 1, 0, -1):\n        arg_0 = '.'.join(arg_5[:arg_8])\n        arg_1 = os.path.join(arg_6, '__init__.py')\n        calc(arg_0, arg_1)\n        arg_6 = os.path.dirname(arg_6)\n  calc(arg_0, arg_1)\n  arg_3.remove(arg_0)\n  return arg_3", "path": "compiler/imputil.py", "identifier": "calculate_transitive_deps", "docstring": "Determines all modules that script transitively depends upon.", "docstring_tokens": ["Determines", "all", "modules", "that", "script", "transitively", "depends", "upon", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 253310}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L553-L608", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Get all variants for an institute having Sanger validations ordered but still not evaluated", "language": "python", "parameters": "(store, institute_id, user_id)", "return_statement": "return unevaluated", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "sanger_ordered", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "arg_6", "=", "arg_5", "[", "'_id'", "]", "arg_7", "=", "arg_0", ".", "case", "(", "arg_6", "=", "arg_6", ")", "if", "not", "arg_7", ":", "continue", "arg_8", "=", "arg_7", ".", "get", "(", "'display_name'", ")", "arg_9", "=", "arg_5", "[", "'vars'", "]", "arg_10", "=", "{", "}", "arg_10", "[", "arg_8", "]", "=", "[", "]", "for", "arg_11", "in", "arg_9", ":", "arg_12", "=", "arg_0", ".", "variant", "(", "document_id", "=", "arg_11", ",", "arg_6", "=", "arg_6", ")", "if", "arg_12", "is", "None", "or", "arg_12", ".", "get", "(", "'sanger_ordered'", ")", "is", "None", "or", "arg_12", ".", "get", "(", "'sanger_ordered'", ")", "is", "False", ":", "continue", "arg_13", "=", "arg_12", ".", "get", "(", "'validation'", ",", "'not_evaluated'", ")", "if", "arg_13", "in", "[", "'True positive'", ",", "'False positive'", "]", ":", "continue", "arg_10", "[", "arg_8", "]", ".", "append", "(", "arg_12", "[", "'_id'", "]", ")", "if", "len", "(", "arg_10", "[", "arg_8", "]", ")", ">", "0", ":", "arg_4", ".", "append", "(", "arg_10", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Get all variants for an institute having Sanger validations ordered but still not evaluated\n\n        Args:\n            store(scout.adapter.MongoAdapter)\n            institute_id(str)\n\n        Returns:\n            unevaluated: a list that looks like this: [ {'case1': [varID_1, varID_2, .., varID_n]}, {'case2' : [varID_1, varID_2, .., varID_n]} ],\n                         where the keys are case_ids and the values are lists of variants with Sanger ordered but not yet validated\n\n    \"\"\"\n\n    # Retrieve a list of ids for variants with Sanger ordered grouped by case from the 'event' collection\n    # This way is much faster than querying over all variants in all cases of an institute\n    arg_3 = arg_0.sanger_ordered(arg_1, arg_2)\n    arg_4 = []\n\n    # for each object where key==case and value==[variant_id with Sanger ordered]\n    for arg_5 in arg_3:\n        arg_6 = arg_5['_id']\n        # Get the case to collect display name\n        arg_7 = arg_0.case(arg_6=arg_6)\n\n        if not arg_7: # the case might have been removed\n            continue\n\n        arg_8 = arg_7.get('display_name')\n\n        # List of variant document ids\n        arg_9 = arg_5['vars']\n\n        arg_10 = {}\n        arg_10[arg_8] = []\n\n        for arg_11 in arg_9:\n            # For each variant with sanger validation ordered\n            arg_12 = arg_0.variant(document_id=arg_11, arg_6=arg_6)\n\n            # Double check that Sanger was ordered (and not canceled) for the variant\n            if arg_12 is None or arg_12.get('sanger_ordered') is None or arg_12.get('sanger_ordered') is False:\n                continue\n\n            arg_13 = arg_12.get('validation', 'not_evaluated')\n\n            # Check that the variant is not evaluated\n            if arg_13 in ['True positive', 'False positive']:\n                continue\n\n            arg_10[arg_8].append(arg_12['_id'])\n\n        # If for a case there is at least one Sanger validation to evaluate add the object to the unevaluated objects list\n        if len(arg_10[arg_8]) > 0:\n            arg_4.append(arg_10)\n\n    return arg_4", "path": "scout/server/blueprints/cases/controllers.py", "identifier": "get_sanger_unevaluated", "docstring": "Get all variants for an institute having Sanger validations ordered but still not evaluated\n\n        Args:\n            store(scout.adapter.MongoAdapter)\n            institute_id(str)\n\n        Returns:\n            unevaluated: a list that looks like this: [ {'case1': [varID_1, varID_2, .., varID_n]}, {'case2' : [varID_1, varID_2, .., varID_n]} ],\n                         where the keys are case_ids and the values are lists of variants with Sanger ordered but not yet validated", "docstring_tokens": ["Get", "all", "variants", "for", "an", "institute", "having", "Sanger", "validations", "ordered", "but", "still", "not", "evaluated"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253311}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L922-L925", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Wait for the termination of a process and log its stdout & stderr", "language": "python", "parameters": "(self, name, process)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "proc", ".", "stream_process_stdout", "(", "arg_2", ",", "stdout_log_fn", "(", "arg_1", ")", ")", "arg_2", ".", "wait", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    ''' Wait for the termination of a process and log its stdout & stderr '''\n    proc.stream_process_stdout(arg_2, stdout_log_fn(arg_1))\n    arg_2.wait()", "path": "heron/executor/src/python/heron_executor.py", "identifier": "HeronExecutor._wait_process_std_out_err", "docstring": "Wait for the termination of a process and log its stdout & stderr", "docstring_tokens": ["Wait", "for", "the", "termination", "of", "a", "process", "and", "log", "its", "stdout", "&", "stderr"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253312}
{"url": "https://github.com/saxix/sample-data-utils/blob/769f1b46e60def2675a14bd5872047af6d1ea398/sample_data_utils/people.py#L64-L87", "sha": "769f1b46e60def2675a14bd5872047af6d1ea398", "docstring_summary": "returns a random tuple representing person information", "language": "python", "parameters": "(languages=None, genders=None)", "return_statement": "return first_name([lang], [g]), last_name([lang]), t, g", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "arg_0", "=", "arg_0", "or", "[", "'en'", "]", "arg_1", "=", "arg_1", "or", "(", "GENDER_FEMALE", ",", "GENDER_MALE", ")", "arg_2", "=", "random", ".", "choice", "(", "arg_0", ")", "arg_3", "=", "random", ".", "choice", "(", "arg_1", ")", "arg_4", "=", "title", "(", "[", "arg_2", "]", ",", "[", "arg_3", "]", ")", "return", "first_name", "(", "[", "arg_2", "]", ",", "[", "arg_3", "]", ")", ",", "last_name", "(", "[", "arg_2", "]", ")", ",", "arg_4", ",", "arg_3"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"\n    returns a random tuple representing Func information\n\n    .. code-block:: python\n\n        >>> d.Func()\n        (u'Derren', u'Powell', 'm')\n        >>> d.Func(genders=['f'])\n        (u'Marge', u'Rodriguez', u'Mrs.', 'f')\n        >>> d.Func(['es'],['m'])\n        (u'Jacinto', u'Delgado', u'El Sr.', 'm')\n\n    :param language:\n    :param genders:\n    \"\"\"\n    arg_0 = arg_0 or ['en']\n    arg_1 = arg_1 or (GENDER_FEMALE, GENDER_MALE)\n\n\n    arg_2 = random.choice(arg_0)\n    arg_3 = random.choice(arg_1)\n    arg_4 = title([arg_2], [arg_3])\n    return first_name([arg_2], [arg_3]), last_name([arg_2]), arg_4, arg_3", "path": "sample_data_utils/people.py", "identifier": "person", "docstring": "returns a random tuple representing person information\n\n    .. code-block:: python\n\n        >>> d.person()\n        (u'Derren', u'Powell', 'm')\n        >>> d.person(genders=['f'])\n        (u'Marge', u'Rodriguez', u'Mrs.', 'f')\n        >>> d.person(['es'],['m'])\n        (u'Jacinto', u'Delgado', u'El Sr.', 'm')\n\n    :param language:\n    :param genders:", "docstring_tokens": ["returns", "a", "random", "tuple", "representing", "person", "information"], "nwo": "saxix/sample-data-utils", "score": 0.12050106452410352, "idx": 253313}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L50-L76", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Prints all currently defined configurations.", "language": "python", "parameters": "()", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", ",", "arg_1", "=", "read_latoolscfg", "(", ")", "arg_2", "=", "arg_1", "[", "'DEFAULT'", "]", "[", "'config'", "]", "arg_3", "=", "'\\nCurrently defined LAtools configurations:\\n\\n'", "for", "arg_4", "in", "arg_1", ".", "sections", "(", ")", ":", "if", "arg_4", "==", "arg_2", ":", "arg_3", "+=", "arg_4", "+", "' [DEFAULT]\\n'", "elif", "arg_4", "==", "'REPRODUCE'", ":", "arg_3", "+=", "arg_4", "+", "' [DO NOT ALTER]\\n'", "else", ":", "arg_3", "+=", "arg_4", "+", "'\\n'", "for", "arg_5", ",", "arg_6", "in", "arg_1", "[", "arg_4", "]", ".", "items", "(", ")", ":", "if", "arg_5", "!=", "'config'", ":", "if", "arg_6", "[", ":", "9", "]", "==", "'resources'", ":", "arg_6", "=", "pkgrs", ".", "resource_filename", "(", "'latools'", ",", "arg_6", ")", "arg_3", "+=", "'   '", "+", "arg_5", "+", "': '", "+", "arg_6", "+", "'\\n'", "arg_3", "+=", "'\\n'", "print", "(", "arg_3", ")", "return"], "function": "def Func():\n    \"\"\"\n    Prints all currently defined configurations.\n    \"\"\"\n    # read configuration file\n    arg_0, arg_1 = read_latoolscfg()\n\n    arg_2 = arg_1['DEFAULT']['config']\n\n    arg_3 = '\\nCurrently defined LAtools configurations:\\n\\n'\n    for arg_4 in arg_1.sections():\n        if arg_4 == arg_2:\n            arg_3 += arg_4 + ' [DEFAULT]\\n'\n        elif arg_4 == 'REPRODUCE':\n            arg_3 += arg_4 + ' [DO NOT ALTER]\\n'\n        else:\n            arg_3 += arg_4 + '\\n'\n\n        for arg_5, arg_6 in arg_1[arg_4].items():\n            if arg_5 != 'config':\n                if arg_6[:9] == 'resources':\n                    arg_6 = pkgrs.resource_filename('latools', arg_6)\n                arg_3 += '   ' + arg_5 + ': ' + arg_6 + '\\n'\n        arg_3 += '\\n'\n\n    print(arg_3)\n    return", "path": "latools/helpers/config.py", "identifier": "print_all", "docstring": "Prints all currently defined configurations.", "docstring_tokens": ["Prints", "all", "currently", "defined", "configurations", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 253314}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/pylabtools.py#L91-L109", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Convert a figure to svg or png for inline display.", "language": "python", "parameters": "(fig, fmt='png')", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'png'", ")", ":", "if", "not", "arg_0", ".", "axes", "and", "not", "arg_0", ".", "lines", ":", "return", "arg_2", "=", "arg_0", ".", "get_facecolor", "(", ")", "arg_3", "=", "arg_0", ".", "get_edgecolor", "(", ")", "arg_0", ".", "set_facecolor", "(", "'white'", ")", "arg_0", ".", "set_edgecolor", "(", "'white'", ")", "try", ":", "arg_4", "=", "BytesIO", "(", ")", "arg_0", ".", "canvas", ".", "Func", "(", "arg_4", ",", "format", "=", "arg_1", ",", "bbox_inches", "=", "'tight'", ")", "arg_5", "=", "arg_4", ".", "getvalue", "(", ")", "finally", ":", "arg_0", ".", "set_facecolor", "(", "arg_2", ")", "arg_0", ".", "set_edgecolor", "(", "arg_3", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1='png'):\n    \"\"\"Convert a figure to svg or png for inline display.\"\"\"\n    # When there's an empty figure, we shouldn't return anything, otherwise we\n    # get big blank areas in the qt console.\n    if not arg_0.axes and not arg_0.lines:\n        return\n\n    arg_2 = arg_0.get_facecolor()\n    arg_3 = arg_0.get_edgecolor()\n    arg_0.set_facecolor('white')\n    arg_0.set_edgecolor('white')\n    try:\n        arg_4 = BytesIO()\n        arg_0.canvas.Func(arg_4, format=arg_1, bbox_inches='tight')\n        arg_5 = arg_4.getvalue()\n    finally:\n        arg_0.set_facecolor(arg_2)\n        arg_0.set_edgecolor(arg_3)\n    return arg_5", "path": "environment/lib/python2.7/site-packages/IPython/core/pylabtools.py", "identifier": "print_figure", "docstring": "Convert a figure to svg or png for inline display.", "docstring_tokens": ["Convert", "a", "figure", "to", "svg", "or", "png", "for", "inline", "display", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253315}
{"url": "https://github.com/cldf/csvw/blob/181c94b6c599575945e52d370a415f12f3433eab/src/csvw/db.py#L235-L266", "sha": "181c94b6c599575945e52d370a415f12f3433eab", "docstring_summary": "Convert the table and column descriptions of a `TableGroup` into specifications for the\n    DB schema.", "language": "python", "parameters": "(tg)", "return_statement": "return list(ordered.values())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "tabledict", ".", "items", "(", ")", ":", "arg_4", "=", "TableSpec", ".", "from_table_metadata", "(", "arg_3", ")", "arg_1", "[", "arg_4", ".", "name", "]", "=", "arg_4", "for", "arg_6", "in", "arg_4", ".", "many_to_many", ".", "values", "(", ")", ":", "arg_1", "[", "arg_6", ".", "name", "]", "=", "arg_6", "arg_7", "=", "OrderedDict", "(", ")", "arg_8", "=", "0", "while", "arg_1", "and", "arg_8", "<", "100", ":", "arg_8", "+=", "1", "for", "arg_3", "in", "list", "(", "arg_1", ".", "keys", "(", ")", ")", ":", "if", "all", "(", "(", "arg_9", "[", "1", "]", "in", "arg_7", ")", "or", "arg_9", "[", "1", "]", "==", "arg_3", "for", "arg_9", "in", "arg_1", "[", "arg_3", "]", ".", "foreign_keys", ")", ":", "arg_7", "[", "arg_3", "]", "=", "arg_1", ".", "pop", "(", "arg_3", ")", "break", "if", "arg_1", ":", "raise", "ValueError", "(", "'there seem to be cyclic dependencies between the tables'", ")", "return", "list", "(", "arg_7", ".", "values", "(", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Convert the table and column descriptions of a `TableGroup` into specifications for the\n    DB Func.\n\n    :param ds:\n    :return: A pair (tables, reference_tables).\n    \"\"\"\n    arg_1 = {}\n    for arg_2, arg_3 in arg_0.tabledict.items():\n        arg_4 = TableSpec.from_table_metadata(arg_3)\n        arg_1[arg_4.name] = arg_4\n        for arg_6 in arg_4.many_to_many.values():\n            arg_1[arg_6.name] = arg_6\n\n    # We must determine the order in which tables must be created!\n    arg_7 = OrderedDict()\n    arg_8 = 0\n\n    # We loop through the tables repeatedly, and whenever we find one, which has all\n    # referenced tables already in ordered, we move it from tables to ordered.\n    while arg_1 and arg_8 < 100:\n        arg_8 += 1\n        for arg_3 in list(arg_1.keys()):\n            if all((arg_9[1] in arg_7) or arg_9[1] == arg_3 for arg_9 in arg_1[arg_3].foreign_keys):\n                # All referenced tables are already created (or self-referential).\n                arg_7[arg_3] = arg_1.pop(arg_3)\n                break\n    if arg_1:  # pragma: no cover\n        raise ValueError('there seem to be cyclic dependencies between the tables')\n\n    return list(arg_7.values())", "path": "src/csvw/db.py", "identifier": "schema", "docstring": "Convert the table and column descriptions of a `TableGroup` into specifications for the\n    DB schema.\n\n    :param ds:\n    :return: A pair (tables, reference_tables).", "docstring_tokens": ["Convert", "the", "table", "and", "column", "descriptions", "of", "a", "TableGroup", "into", "specifications", "for", "the", "DB", "schema", "."], "nwo": "cldf/csvw", "score": 0.2827006957945985, "idx": 253316}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py#L355-L362", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Verifies the signature for the given value.", "language": "python", "parameters": "(self, value, sig)", "return_statement": "return self.algorithm.verify_signature(key, value, sig)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "derive_key", "(", ")", "try", ":", "arg_2", "=", "base64_decode", "(", "arg_2", ")", "except", "Exception", ":", "return", "False", "return", "arg_0", ".", "algorithm", ".", "Func", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Verifies the signature for the given value.\"\"\"\n        arg_3 = arg_0.derive_key()\n        try:\n            arg_2 = base64_decode(arg_2)\n        except Exception:\n            return False\n        return arg_0.algorithm.Func(arg_3, arg_1, arg_2)", "path": "capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py", "identifier": "Signer.verify_signature", "docstring": "Verifies the signature for the given value.", "docstring_tokens": ["Verifies", "the", "signature", "for", "the", "given", "value", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253317}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/rich_text.py#L47-L119", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Displays a dialog for exporting HTML generated by Qt's rich text\n        system.", "language": "python", "parameters": "(self)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "control", ".", "window", "(", ")", "arg_2", "=", "QtGui", ".", "QFileDialog", "(", "arg_1", ",", "'Save as...'", ")", "arg_2", ".", "setAcceptMode", "(", "QtGui", ".", "QFileDialog", ".", "AcceptSave", ")", "arg_3", "=", "[", "'HTML with PNG figures (*.html *.htm)'", ",", "'XHTML with inline SVG figures (*.xhtml *.xml)'", "]", "arg_2", ".", "setNameFilters", "(", "arg_3", ")", "if", "arg_0", ".", "filename", ":", "arg_2", ".", "selectFile", "(", "arg_0", ".", "filename", ")", "arg_4", ",", "arg_5", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ".", "filename", ")", "if", "arg_5", ".", "lower", "(", ")", "in", "(", "'.xml'", ",", "'.xhtml'", ")", ":", "arg_2", ".", "selectNameFilter", "(", "arg_3", "[", "-", "1", "]", ")", "if", "arg_2", ".", "exec_", "(", ")", ":", "arg_0", ".", "filename", "=", "arg_2", ".", "selectedFiles", "(", ")", "[", "0", "]", "arg_7", "=", "arg_2", ".", "selectedNameFilter", "(", ")", "arg_8", "=", "arg_0", ".", "control", ".", "document", "(", ")", ".", "toHtml", "(", ")", ".", "encode", "(", "'utf-8'", ")", "if", "arg_7", ".", "startswith", "(", "'XHTML'", ")", ":", "arg_9", "=", "Func_xhtml", "else", ":", "arg_10", "=", "arg_0", ".", "inline_png", "if", "arg_10", "is", "None", "and", "IMG_RE", ".", "search", "(", "arg_8", ")", ":", "arg_2", "=", "QtGui", ".", "QDialog", "(", "arg_1", ")", "arg_2", ".", "setWindowTitle", "(", "'Save as...'", ")", "arg_11", "=", "QtGui", ".", "QVBoxLayout", "(", "arg_2", ")", "arg_12", "=", "\"Exporting HTML with PNGs\"", "arg_13", "=", "\"Would you like inline PNGs (single large html \"", "\"file) or external image files?\"", "arg_14", "=", "QtGui", ".", "QCheckBox", "(", "\"&Don't ask again\"", ")", "arg_14", ".", "setShortcut", "(", "'D'", ")", "arg_15", "=", "QtGui", ".", "QPushButton", "(", "\"&Inline\"", ")", "arg_15", ".", "setShortcut", "(", "'I'", ")", "arg_16", "=", "QtGui", ".", "QPushButton", "(", "\"&External\"", ")", "arg_16", ".", "setShortcut", "(", "'E'", ")", "arg_17", "=", "QtGui", ".", "QMessageBox", "(", "QtGui", ".", "QMessageBox", ".", "Question", ",", "arg_2", ".", "windowTitle", "(", ")", ",", "arg_12", ")", "arg_17", ".", "setInformativeText", "(", "arg_13", ")", "arg_17", ".", "addButton", "(", "arg_15", ",", "QtGui", ".", "QMessageBox", ".", "NoRole", ")", "arg_17", ".", "addButton", "(", "arg_16", ",", "QtGui", ".", "QMessageBox", ".", "YesRole", ")", "arg_11", ".", "setSpacing", "(", "0", ")", "arg_11", ".", "addWidget", "(", "arg_17", ")", "arg_11", ".", "addWidget", "(", "arg_14", ")", "arg_2", ".", "setLayout", "(", "arg_11", ")", "arg_2", ".", "show", "(", ")", "arg_18", "=", "arg_17", ".", "exec_", "(", ")", "arg_2", ".", "hide", "(", ")", "arg_10", "=", "(", "arg_18", "==", "0", ")", "if", "arg_14", ".", "checkState", "(", ")", ":", "arg_0", ".", "inline_png", "=", "arg_10", "arg_9", "=", "lambda", "h", ",", "f", ",", "i", ":", "Func_html", "(", "h", ",", "f", ",", "i", ",", "arg_10", ")", "try", ":", "return", "arg_9", "(", "arg_8", ",", "arg_0", ".", "filename", ",", "arg_0", ".", "image_tag", ")", "except", "Exception", ",", "e", ":", "arg_12", "=", "\"Error Funcing HTML to %s\\n\"", "%", "arg_0", ".", "filename", "+", "str", "(", "e", ")", "arg_18", "=", "QtGui", ".", "QMessageBox", ".", "warning", "(", "arg_1", ",", "'Error'", ",", "arg_12", ",", "QtGui", ".", "QMessageBox", ".", "Ok", ",", "QtGui", ".", "QMessageBox", ".", "Ok", ")", "return", "None"], "function": "def Func(arg_0):\n        \"\"\" Displays a dialog for Funcing HTML generated by Qt's rich text\n        system.\n\n        Returns\n        -------\n        The name of the file that was saved, or None if no file was saved.\n        \"\"\"\n        arg_1 = arg_0.control.window()\n        arg_2 = QtGui.QFileDialog(arg_1, 'Save as...')\n        arg_2.setAcceptMode(QtGui.QFileDialog.AcceptSave)\n        arg_3 = [\n            'HTML with PNG figures (*.html *.htm)',\n            'XHTML with inline SVG figures (*.xhtml *.xml)'\n        ]\n        arg_2.setNameFilters(arg_3)\n        if arg_0.filename:\n            arg_2.selectFile(arg_0.filename)\n            arg_4,arg_5 = os.path.splitext(arg_0.filename)\n            if arg_5.lower() in ('.xml', '.xhtml'):\n                arg_2.selectNameFilter(arg_3[-1])\n\n        if arg_2.exec_():\n            arg_0.filename = arg_2.selectedFiles()[0]\n            arg_7 = arg_2.selectedNameFilter()\n            arg_8 = arg_0.control.document().toHtml().encode('utf-8')\n\n            # Configure the Funcer.\n            if arg_7.startswith('XHTML'):\n                arg_9 = Func_xhtml\n            else:\n                # If there are PNGs, decide how to Func them.\n                arg_10 = arg_0.inline_png\n                if arg_10 is None and IMG_RE.search(arg_8):\n                    arg_2 = QtGui.QDialog(arg_1)\n                    arg_2.setWindowTitle('Save as...')\n                    arg_11 = QtGui.QVBoxLayout(arg_2)\n                    arg_12 = \"Exporting HTML with PNGs\"\n                    arg_13 = \"Would you like inline PNGs (single large html \" \\\n                        \"file) or external image files?\"\n                    arg_14 = QtGui.QCheckBox(\"&Don't ask again\")\n                    arg_14.setShortcut('D')\n                    arg_15 = QtGui.QPushButton(\"&Inline\")\n                    arg_15.setShortcut('I')\n                    arg_16 = QtGui.QPushButton(\"&External\")\n                    arg_16.setShortcut('E')\n                    arg_17 = QtGui.QMessageBox(QtGui.QMessageBox.Question,\n                                            arg_2.windowTitle(), arg_12)\n                    arg_17.setInformativeText(arg_13)\n                    arg_17.addButton(arg_15, QtGui.QMessageBox.NoRole)\n                    arg_17.addButton(arg_16, QtGui.QMessageBox.YesRole)\n                    arg_11.setSpacing(0)\n                    arg_11.addWidget(arg_17)\n                    arg_11.addWidget(arg_14)\n                    arg_2.setLayout(arg_11)\n                    arg_2.show()\n                    arg_18 = arg_17.exec_()\n                    arg_2.hide()\n                    arg_10 = (arg_18 == 0)\n                    if arg_14.checkState():\n                        # Don't ask anymore; always use this choice.\n                        arg_0.inline_png = arg_10\n                arg_9 = lambda h, f, i: Func_html(h, f, i, arg_10)\n\n            # Perform the Func!\n            try:\n                return arg_9(arg_8, arg_0.filename, arg_0.image_tag)\n            except Exception, e:\n                arg_12 = \"Error Funcing HTML to %s\\n\" % arg_0.filename + str(e)\n                arg_18 = QtGui.QMessageBox.warning(arg_1, 'Error', arg_12,\n                    QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok)\n\n        return None", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/rich_text.py", "identifier": "HtmlExporter.export", "docstring": "Displays a dialog for exporting HTML generated by Qt's rich text\n        system.\n\n        Returns\n        -------\n        The name of the file that was saved, or None if no file was saved.", "docstring_tokens": ["Displays", "a", "dialog", "for", "exporting", "HTML", "generated", "by", "Qt", "s", "rich", "text", "system", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253318}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/transports.py#L95-L112", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "Encode list of messages. Expects messages to be unicode.", "language": "python", "parameters": "(self, messages)", "return_statement": "return payload.encode('utf-8')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", "or", "arg_1", "[", "0", "]", "is", "None", ":", "return", "''", "if", "len", "(", "arg_1", ")", "==", "1", ":", "return", "arg_1", "[", "0", "]", ".", "encode", "(", "'utf-8'", ")", "arg_2", "=", "u''", ".", "join", "(", "[", "(", "u'\\ufffd%d\\ufffd%s'", "%", "(", "len", "(", "p", ")", ",", "p", ")", ")", "for", "p", "in", "arg_1", "if", "p", "is", "not", "None", "]", ")", "return", "arg_2", ".", "encode", "(", "'utf-8'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Encode list of messages. Expects messages to be unicode.\n\n        ``messages`` - List of raw messages to encode, if necessary\n\n        \"\"\"\n        if not arg_1 or arg_1[0] is None:\n            return ''\n\n        if len(arg_1) == 1:\n            return arg_1[0].encode('utf-8')\n\n        arg_2 = u''.join([(u'\\ufffd%d\\ufffd%s' % (len(p), p))\n                            for p in arg_1 if p is not None])\n        # FIXME: why is it so that we must filter None from here ?  How\n        #        is it even possible that a None gets in there ?\n\n        return arg_2.encode('utf-8')", "path": "socketio/transports.py", "identifier": "XHRPollingTransport.encode_payload", "docstring": "Encode list of messages. Expects messages to be unicode.\n\n        ``messages`` - List of raw messages to encode, if necessary", "docstring_tokens": ["Encode", "list", "of", "messages", ".", "Expects", "messages", "to", "be", "unicode", "."], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 253319}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L83-L87", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Like os.path.join but acts relative to this packages bin path.", "language": "python", "parameters": "(*paths)", "return_statement": "return os.path.normpath(os.path.join(package_root, 'bin', *paths))", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "return", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "'bin'", ",", "*", "arg_0", ")", ")"], "function": "def Func(*arg_0):\n    '''Like os.path.join but acts relative to this packages bin path.'''\n\n    arg_1 = os.path.dirname(__file__)\n    return os.path.normpath(os.path.join(arg_1, 'bin', *arg_0))", "path": "cpenv/utils.py", "identifier": "binpath", "docstring": "Like os.path.join but acts relative to this packages bin path.", "docstring_tokens": ["Like", "os", ".", "path", ".", "join", "but", "acts", "relative", "to", "this", "packages", "bin", "path", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 253320}
{"url": "https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/result.py#L165-L172", "sha": "5b8218cffa409ed733cf850a6fde16fafb8fc2af", "docstring_summary": "Write the text to the stream and flush immediately.", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "stream", ".", "write", "(", "arg_1", ")", "arg_0", ".", "stream", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Write the text to the stream and flush immediately.\n\n        \"\"\"\n\n        arg_0.stream.write(arg_1)\n        arg_0.stream.flush()", "path": "ivoire/result.py", "identifier": "DotsFormatter.show", "docstring": "Write the text to the stream and flush immediately.", "docstring_tokens": ["Write", "the", "text", "to", "the", "stream", "and", "flush", "immediately", "."], "nwo": "Julian/Ivoire", "score": 0.27637529583590154, "idx": 253321}
{"url": "https://github.com/apmoore1/tweebo_parser_python_api/blob/224be2570b8b2508d29771f5e5abe06e1889fd89/tweebo_parser/api.py#L47-L55", "sha": "224be2570b8b2508d29771f5e5abe06e1889fd89", "docstring_summary": "Given some error text it will log the text if self.log_errors is True", "language": "python", "parameters": "(self, text: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "None", ":", "if", "arg_0", ".", "Funcs", ":", "with", "arg_0", ".", "_log_fp", ".", "open", "(", "'a+'", ")", "as", "log_file", ":", "log_file", ".", "write", "(", "f'{text}\\n'", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> None:\n        '''\n        Given some error text it will log the text if self.Funcs is True\n\n        :param text: Error text to log\n        '''\n        if arg_0.Funcs:\n            with arg_0._log_fp.open('a+') as log_file:\n                log_file.write(f'{text}\\n')", "path": "tweebo_parser/api.py", "identifier": "API.log_error", "docstring": "Given some error text it will log the text if self.log_errors is True\n\n        :param text: Error text to log", "docstring_tokens": ["Given", "some", "error", "text", "it", "will", "log", "the", "text", "if", "self", ".", "log_errors", "is", "True"], "nwo": "apmoore1/tweebo_parser_python_api", "score": 0.16941397159673272, "idx": 253322}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/cifar10_bnn.py#L155-L162", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build fake CIFAR10-style data for unit testing.", "language": "python", "parameters": "()", "return_statement": "return (x_train, y_train), (x_test, y_test)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "10", "arg_1", "=", "np", ".", "random", ".", "rand", "(", "arg_0", ",", "*", "IMAGE_SHAPE", ")", ".", "astype", "(", "np", ".", "float32", ")", "arg_2", "=", "np", ".", "random", ".", "permutation", "(", "np", ".", "arange", "(", "arg_0", ")", ")", ".", "astype", "(", "np", ".", "int32", ")", "arg_3", "=", "np", ".", "random", ".", "rand", "(", "arg_0", ",", "*", "IMAGE_SHAPE", ")", ".", "astype", "(", "np", ".", "float32", ")", "arg_4", "=", "np", ".", "random", ".", "permutation", "(", "np", ".", "arange", "(", "arg_0", ")", ")", ".", "astype", "(", "np", ".", "int32", ")", "return", "(", "arg_1", ",", "arg_2", ")", ",", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func():\n  \"\"\"Build fake CIFAR10-style data for unit testing.\"\"\"\n  arg_0 = 10\n  arg_1 = np.random.rand(arg_0, *IMAGE_SHAPE).astype(np.float32)\n  arg_2 = np.random.permutation(np.arange(arg_0)).astype(np.int32)\n  arg_3 = np.random.rand(arg_0, *IMAGE_SHAPE).astype(np.float32)\n  arg_4 = np.random.permutation(np.arange(arg_0)).astype(np.int32)\n  return (arg_1, arg_2), (arg_3, arg_4)", "path": "tensorflow_probability/examples/cifar10_bnn.py", "identifier": "build_fake_data", "docstring": "Build fake CIFAR10-style data for unit testing.", "docstring_tokens": ["Build", "fake", "CIFAR10", "-", "style", "data", "for", "unit", "testing", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253323}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L118-L137", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Print ``top_n`` big dir and ``top_n`` big file in each dir.", "language": "python", "parameters": "(self, top_n=5)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ")", ":", "arg_0", ".", "assert_is_dir_and_exists", "(", ")", "arg_2", "=", "sorted", "(", "[", "(", "p", ",", "p", ".", "dirsize", ")", "for", "p", "in", "arg_0", ".", "select_dir", "(", "recursive", "=", "False", ")", "]", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", ",", "reverse", "=", "True", ",", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", "[", ":", "arg_1", "]", ":", "print", "(", "\"{:<9}    {:<9}\"", ".", "format", "(", "repr_data_size", "(", "arg_4", ")", ",", "arg_3", ".", "abspath", ")", ")", "arg_5", "=", "sorted", "(", "[", "(", "p", ",", "p", ".", "size", ")", "for", "p", "in", "arg_3", ".", "select_file", "(", "recursive", "=", "True", ")", "]", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", ",", "reverse", "=", "True", ",", ")", "for", "arg_6", ",", "arg_7", "in", "arg_5", "[", ":", "arg_1", "]", ":", "print", "(", "\"    {:<9}    {:<9}\"", ".", "format", "(", "repr_data_size", "(", "arg_7", ")", ",", "arg_6", ".", "abspath", ")", ")"], "function": "def Func(arg_0, arg_1=5):\n        \"\"\"Print ``top_n`` big dir and ``top_n`` big file in each dir.\n        \"\"\"\n        arg_0.assert_is_dir_and_exists()\n\n        arg_2 = sorted(\n            [(p, p.dirsize) for p in arg_0.select_dir(recursive=False)],\n            key=lambda x: x[1],\n            reverse=True,\n        )\n        for arg_3, arg_4 in arg_2[:arg_1]:\n            print(\"{:<9}    {:<9}\".format(repr_data_size(arg_4), arg_3.abspath))\n            arg_5 = sorted(\n                [(p, p.size) for p in arg_3.select_file(recursive=True)],\n                key=lambda x: x[1],\n                reverse=True,\n            )\n            for arg_6, arg_7 in arg_5[:arg_1]:\n                print(\"    {:<9}    {:<9}\".format(\n                    repr_data_size(arg_7), arg_6.abspath))", "path": "pathlib_mate/mate_tool_box.py", "identifier": "ToolBox.print_big_dir_and_big_file", "docstring": "Print ``top_n`` big dir and ``top_n`` big file in each dir.", "docstring_tokens": ["Print", "top_n", "big", "dir", "and", "top_n", "big", "file", "in", "each", "dir", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 253324}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L384-L393", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "The complete content of an info response.", "language": "python", "parameters": "(self, code, message, compressed=False)", "return_statement": "return \"\".join([x for x in self.info_gen(code, message, compressed)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "return", "\"\"", ".", "join", "(", "[", "arg_4", "for", "arg_4", "in", "arg_0", ".", "Func_gen", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"The complete content of an Func response.\n\n        This should only used for commands that return small or known amounts of\n        data.\n\n        Returns:\n            A the complete content of a textual response.\n        \"\"\"\n        return \"\".join([arg_4 for arg_4 in arg_0.Func_gen(arg_1, arg_2, arg_3)])", "path": "nntp/nntp.py", "identifier": "BaseNNTPClient.info", "docstring": "The complete content of an info response.\n\n        This should only used for commands that return small or known amounts of\n        data.\n\n        Returns:\n            A the complete content of a textual response.", "docstring_tokens": ["The", "complete", "content", "of", "an", "info", "response", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 253325}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/genres.py#L66-L87", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the list of movies for a particular genre by id. By default, only\n        movies with 10 or more votes are included.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the list of Func for a particular genre by id. By default, only\n        Func with 10 or more votes are included.\n\n        Args:\n            page: (optional) Minimum 1, maximum 1000.\n            language: (optional) ISO 639-1 code.\n            include_all_Func: (optional) Toggle the inclusion of all Func \n                                and not just those with 10 or more ratings. \n                                Expected value is: True or False.\n            include_adult: (optional) Toggle the inclusion of adult titles.\n                           Expected value is: True or False.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/genres.py", "identifier": "Genres.movies", "docstring": "Get the list of movies for a particular genre by id. By default, only\n        movies with 10 or more votes are included.\n\n        Args:\n            page: (optional) Minimum 1, maximum 1000.\n            language: (optional) ISO 639-1 code.\n            include_all_movies: (optional) Toggle the inclusion of all movies \n                                and not just those with 10 or more ratings. \n                                Expected value is: True or False.\n            include_adult: (optional) Toggle the inclusion of adult titles.\n                           Expected value is: True or False.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "list", "of", "movies", "for", "a", "particular", "genre", "by", "id", ".", "By", "default", "only", "movies", "with", "10", "or", "more", "votes", "are", "included", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 253326}
{"url": "https://github.com/rbarrois/aionotify/blob/6cfa35b26a2660f77f29a92d3efb7d1dde685b43/aionotify/base.py#L50-L59", "sha": "6cfa35b26a2660f77f29a92d3efb7d1dde685b43", "docstring_summary": "Add a new watching rule.", "language": "python", "parameters": "(self, path, flags, *, alias=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_1", "if", "arg_3", "in", "arg_0", ".", "requests", ":", "raise", "ValueError", "(", "\"A Func request is already scheduled for alias %s\"", "%", "arg_3", ")", "arg_0", ".", "requests", "[", "arg_3", "]", "=", "(", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "_fd", "is", "not", "None", ":", "arg_0", ".", "_setup_Func", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, *, arg_3=None):\n        \"\"\"Add a new Funcing rule.\"\"\"\n        if arg_3 is None:\n            arg_3 = arg_1\n        if arg_3 in arg_0.requests:\n            raise ValueError(\"A Func request is already scheduled for alias %s\" % arg_3)\n        arg_0.requests[arg_3] = (arg_1, arg_2)\n        if arg_0._fd is not None:\n            # We've started, register the Func immediately.\n            arg_0._setup_Func(arg_3, arg_1, arg_2)", "path": "aionotify/base.py", "identifier": "Watcher.watch", "docstring": "Add a new watching rule.", "docstring_tokens": ["Add", "a", "new", "watching", "rule", "."], "nwo": "rbarrois/aionotify", "score": 0.47794899994238105, "idx": 253327}
{"url": "https://github.com/lsst-sqre/ltd-conveyor/blob/c492937c4c1e050ccc4a0b9dcc38f9980d57e305/ltdconveyor/keeper/build.py#L60-L87", "sha": "c492937c4c1e050ccc4a0b9dcc38f9980d57e305", "docstring_summary": "Confirm a build upload is complete.", "language": "python", "parameters": "(build_url, keeper_token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'uploaded'", ":", "True", "}", "arg_3", "=", "requests", ".", "patch", "(", "arg_0", ",", "auth", "=", "(", "arg_1", ",", "''", ")", ",", "json", "=", "arg_2", ")", "if", "arg_3", ".", "status_code", "!=", "200", ":", "raise", "KeeperError", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Confirm a build upload is complete.\n\n    Wraps ``PATCH /builds/{build}``.\n\n    Parameters\n    ----------\n    build_url : `str`\n        URL of the build resource. Given a build resource, this URL is\n        available from the ``self_url`` field.\n    keeper_token : `str`\n        Auth token (`ltdconveyor.keeper.get_keeper_token`).\n\n    Raises\n    ------\n    ltdconveyor.keeper.KeeperError\n        Raised if there is an error communicating with the LTD Keeper API.\n    \"\"\"\n    arg_2 = {\n        'uploaded': True\n    }\n\n    arg_3 = requests.patch(\n        arg_0,\n        auth=(arg_1, ''),\n        json=arg_2)\n    if arg_3.status_code != 200:\n        raise KeeperError(arg_3)", "path": "ltdconveyor/keeper/build.py", "identifier": "confirm_build", "docstring": "Confirm a build upload is complete.\n\n    Wraps ``PATCH /builds/{build}``.\n\n    Parameters\n    ----------\n    build_url : `str`\n        URL of the build resource. Given a build resource, this URL is\n        available from the ``self_url`` field.\n    keeper_token : `str`\n        Auth token (`ltdconveyor.keeper.get_keeper_token`).\n\n    Raises\n    ------\n    ltdconveyor.keeper.KeeperError\n        Raised if there is an error communicating with the LTD Keeper API.", "docstring_tokens": ["Confirm", "a", "build", "upload", "is", "complete", "."], "nwo": "lsst-sqre/ltd-conveyor", "score": 0.138843686048881, "idx": 253328}
{"url": "https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L374-L397", "sha": "b1c6aa159ab380a033740f4aa392cf0d125e0ac6", "docstring_summary": "Declare an environment variable as a special variable.  This can\n        be used even if the environment variable is not present.", "language": "python", "parameters": "(self, name, sep, klass)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_special", ":", "arg_4", "=", "arg_0", ".", "_special", "[", "arg_1", "]", "if", "not", "isinstance", "(", "arg_4", ",", "arg_3", ")", "or", "arg_2", "!=", "arg_4", ".", "_sep", ":", "raise", "ValueError", "(", "'variable %s already declared as %s '", "'with separator \"%s\"'", "%", "(", "arg_1", ",", "arg_4", ".", "__class__", ".", "__name__", ",", "arg_4", ".", "_sep", ")", ")", "else", ":", "arg_0", ".", "_special", "[", "arg_1", "]", "=", "arg_3", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Declare an environment variable as a special variable.  This can\n        be used even if the environment variable is not present.\n\n        :param name: The name of the environment variable that should\n                     be considered special.\n        :param sep: The separator to be used.\n        :param klass: The subclass of ``SpecialVariable`` used to\n                      represent the variable.\n        \"\"\"\n\n        # First, has it already been declared?\n        if arg_1 in arg_0._special:\n            arg_4 = arg_0._special[arg_1]\n            if not isinstance(arg_4, arg_3) or arg_2 != arg_4._sep:\n                raise ValueError('variable %s already declared as %s '\n                                 'with separator \"%s\"' %\n                                 (arg_1, arg_4.__class__.__name__,\n                                  arg_4._sep))\n\n        # OK, it's new; declare it\n        else:\n            arg_0._special[arg_1] = arg_3(arg_0, arg_1, arg_2)", "path": "timid/environment.py", "identifier": "Environment._declare_special", "docstring": "Declare an environment variable as a special variable.  This can\n        be used even if the environment variable is not present.\n\n        :param name: The name of the environment variable that should\n                     be considered special.\n        :param sep: The separator to be used.\n        :param klass: The subclass of ``SpecialVariable`` used to\n                      represent the variable.", "docstring_tokens": ["Declare", "an", "environment", "variable", "as", "a", "special", "variable", ".", "This", "can", "be", "used", "even", "if", "the", "environment", "variable", "is", "not", "present", "."], "nwo": "rackerlabs/timid", "score": 0.0, "idx": 253329}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/logs/parsers.py#L65-L122", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "Converts the input format to a regular\n        expression, as well as extracting fields", "language": "python", "parameters": "(self, format)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "strip", "(", ")", "arg_1", "=", "re", ".", "sub", "(", "'[ \\t]+'", ",", "' '", ",", "arg_1", ")", "arg_2", "=", "[", "]", "arg_3", "=", "re", ".", "compile", "(", "r'^\\\\\"'", ")", "arg_4", "=", "re", ".", "compile", "(", "'Referer|User-Agent'", ")", "arg_5", "=", "re", ".", "compile", "(", "'^%.*t$'", ")", "arg_6", "=", "re", ".", "compile", "(", "r'^\\\\\"'", ")", "arg_7", "=", "re", ".", "compile", "(", "r'\\\\\"$'", ")", "arg_8", "=", "re", ".", "compile", "(", "r'.*%\\{([^\\}]+)\\}i'", ")", "for", "arg_9", "in", "arg_1", ".", "split", "(", "' '", ")", ":", "arg_10", "=", "0", "if", "arg_3", ".", "search", "(", "arg_9", ")", ":", "arg_10", "=", "1", "if", "arg_10", ":", "arg_9", "=", "arg_6", ".", "sub", "(", "''", ",", "arg_9", ")", "arg_9", "=", "arg_7", ".", "sub", "(", "''", ",", "arg_9", ")", "arg_11", "=", "arg_8", ".", "match", "(", "arg_9", ")", "if", "arg_11", ":", "arg_0", ".", "_names", ".", "append", "(", "arg_11", ".", "groups", "(", ")", "[", "0", "]", ".", "lower", "(", ")", ")", "arg_0", ".", "_types", ".", "append", "(", "str", ")", "else", ":", "arg_0", ".", "_names", ".", "append", "(", "arg_0", ".", "alias", "(", "arg_9", ")", ")", "arg_0", ".", "_types", ".", "append", "(", "arg_0", ".", "types", ".", "get", "(", "arg_9", ",", "[", "None", ",", "str", "]", ")", "[", "1", "]", ")", "arg_12", "=", "'(\\S*)'", "if", "arg_10", ":", "if", "arg_9", "==", "'%r'", "or", "arg_4", ".", "search", "(", "arg_9", ")", ":", "arg_12", "=", "r'\\\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\\\"'", "else", ":", "arg_12", "=", "r'\\\"([^\\\"]*)\\\"'", "elif", "arg_5", ".", "search", "(", "arg_9", ")", ":", "arg_12", "=", "r'(\\[[^\\]]+\\])'", "elif", "arg_9", "==", "'%U'", ":", "arg_12", "=", "'(.+?)'", "arg_2", ".", "append", "(", "arg_12", ")", "arg_0", ".", "_pattern", "=", "'^'", "+", "' '", ".", "join", "(", "arg_2", ")", "+", "'$'", "try", ":", "arg_0", ".", "_regex", "=", "re", ".", "compile", "(", "arg_0", ".", "_pattern", ")", "except", "Exception", "as", "e", ":", "raise", "ApacheLogParserError", "(", "e", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Converts the input format to a regular\n        expression, as well as extracting fields\n\n        Raises an exception if it couldn't compile\n        the generated regex.\n        \"\"\"\n        arg_1 = arg_1.strip()\n        arg_1 = re.sub('[ \\t]+',' ',arg_1)\n        \n        arg_2 = []\n\n        arg_3 = re.compile(r'^\\\\\"')\n        arg_4 = re.compile('Referer|User-Agent')\n        arg_5 = re.compile('^%.*t$')\n        arg_6 = re.compile(r'^\\\\\"')\n        arg_7 = re.compile(r'\\\\\"$')\n        arg_8 = re.compile(r'.*%\\{([^\\}]+)\\}i')\n        \n        for arg_9 in arg_1.split(' '):\n\n            arg_10 = 0\n            if arg_3.search(arg_9): arg_10 = 1\n\n            if arg_10:\n                arg_9 = arg_6.sub('', arg_9)\n                arg_9 = arg_7.sub('', arg_9)\n            \n            arg_11 = arg_8.match(arg_9)\n            if arg_11:\n                arg_0._names.append(arg_11.groups()[0].lower())\n                arg_0._types.append(str)\n            else:\n                arg_0._names.append(arg_0.alias(arg_9))\n                arg_0._types.append(arg_0.types.get(arg_9, [None, str])[1])\n            \n            arg_12 = '(\\S*)'\n            \n            if arg_10:\n                if arg_9 == '%r' or arg_4.search(arg_9):\n                    arg_12 = r'\\\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\\\"'\n                else:\n                    arg_12 = r'\\\"([^\\\"]*)\\\"'\n                \n            elif arg_5.search(arg_9):\n                arg_12 = r'(\\[[^\\]]+\\])'\n                \n            elif arg_9 == '%U':\n                arg_12 = '(.+?)'\n            \n            arg_2.append(arg_12)\n        \n        arg_0._pattern = '^' + ' '.join(arg_2) + '$'\n        try:\n            arg_0._regex = re.compile(arg_0._pattern)\n        except Exception as e:\n            raise ApacheLogParserError(e)", "path": "tensor/logs/parsers.py", "identifier": "ApacheLogParser._parse_format", "docstring": "Converts the input format to a regular\n        expression, as well as extracting fields\n\n        Raises an exception if it couldn't compile\n        the generated regex.", "docstring_tokens": ["Converts", "the", "input", "format", "to", "a", "regular", "expression", "as", "well", "as", "extracting", "fields"], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 253330}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/descriptor.py#L875-L971", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Make a protobuf Descriptor given a DescriptorProto protobuf.", "language": "python", "parameters": "(desc_proto, package='', build_file_if_cpp=True,\n                   syntax=None)", "return_statement": "return Descriptor(desc_proto.name, desc_name, None, None, fields,\n                    list(nested_types.values()), list(enum_types.values()), [],\n                    options=desc_proto.options)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ")", ":", "if", "api_implementation", ".", "Type", "(", ")", "==", "'cpp'", "and", "arg_2", ":", "from", "typy", ".", "google", ".", "protobuf", "import", "descriptor_pb2", "arg_4", "=", "descriptor_pb2", ".", "FileDescriptorProto", "(", ")", "arg_4", ".", "message_type", ".", "add", "(", ")", ".", "MergeFrom", "(", "arg_0", ")", "arg_5", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "if", "arg_1", ":", "arg_4", ".", "name", "=", "os", ".", "path", ".", "join", "(", "arg_1", ".", "replace", "(", "'.'", ",", "'/'", ")", ",", "arg_5", "+", "'.proto'", ")", "arg_4", ".", "package", "=", "arg_1", "else", ":", "arg_4", ".", "name", "=", "arg_5", "+", "'.proto'", "_message", ".", "default_pool", ".", "Add", "(", "arg_4", ")", "arg_7", "=", "_message", ".", "default_pool", ".", "FindFileByName", "(", "arg_4", ".", "name", ")", "if", "_USE_C_DESCRIPTORS", ":", "return", "arg_7", ".", "message_types_by_name", "[", "arg_0", ".", "name", "]", "arg_8", "=", "[", "arg_0", ".", "name", "]", "if", "arg_1", ":", "arg_8", ".", "insert", "(", "0", ",", "arg_1", ")", "arg_9", "=", "{", "}", "for", "arg_10", "in", "arg_0", ".", "enum_type", ":", "arg_11", "=", "'.'", ".", "join", "(", "arg_8", "+", "[", "arg_10", ".", "name", "]", ")", "arg_12", "=", "EnumDescriptor", "(", "arg_10", ".", "name", ",", "arg_11", ",", "None", ",", "[", "EnumValueDescriptor", "(", "enum_val", ".", "name", ",", "ii", ",", "enum_val", ".", "number", ")", "for", "ii", ",", "enum_val", "in", "enumerate", "(", "arg_10", ".", "value", ")", "]", ")", "arg_9", "[", "arg_11", "]", "=", "arg_12", "arg_13", "=", "{", "}", "for", "arg_14", "in", "arg_0", ".", "nested_type", ":", "arg_11", "=", "'.'", ".", "join", "(", "arg_8", "+", "[", "arg_14", ".", "name", "]", ")", "arg_15", "=", "Func", "(", "arg_14", ",", "arg_1", "=", "'.'", ".", "join", "(", "arg_8", ")", ",", "arg_2", "=", "False", ",", "arg_3", "=", "arg_3", ")", "arg_13", "[", "arg_11", "]", "=", "arg_15", "arg_16", "=", "[", "]", "for", "arg_17", "in", "arg_0", ".", "field", ":", "arg_11", "=", "'.'", ".", "join", "(", "arg_8", "+", "[", "arg_17", ".", "name", "]", ")", "arg_12", "=", "None", "arg_15", "=", "None", "if", "arg_17", ".", "HasField", "(", "'type_name'", ")", ":", "arg_18", "=", "arg_17", ".", "type_name", "arg_19", "=", "'.'", ".", "join", "(", "arg_8", "+", "[", "arg_18", "[", "arg_18", ".", "rfind", "(", "'.'", ")", "+", "1", ":", "]", "]", ")", "if", "arg_19", "in", "arg_13", ":", "arg_15", "=", "arg_13", "[", "arg_19", "]", "elif", "arg_19", "in", "arg_9", ":", "arg_12", "=", "arg_9", "[", "arg_19", "]", "arg_20", "=", "FieldDescriptor", "(", "arg_17", ".", "name", ",", "arg_11", ",", "arg_17", ".", "number", "-", "1", ",", "arg_17", ".", "number", ",", "arg_17", ".", "type", ",", "FieldDescriptor", ".", "ProtoTypeToCppProtoType", "(", "arg_17", ".", "type", ")", ",", "arg_17", ".", "label", ",", "None", ",", "arg_15", ",", "arg_12", ",", "None", ",", "False", ",", "None", ",", "options", "=", "arg_17", ".", "options", ",", "has_default_value", "=", "False", ")", "arg_16", ".", "append", "(", "arg_20", ")", "arg_21", "=", "'.'", ".", "join", "(", "arg_8", ")", "return", "Descriptor", "(", "arg_0", ".", "name", ",", "arg_21", ",", "None", ",", "None", ",", "arg_16", ",", "list", "(", "arg_13", ".", "values", "(", ")", ")", ",", "list", "(", "arg_9", ".", "values", "(", ")", ")", ",", "[", "]", ",", "options", "=", "arg_0", ".", "options", ")"], "function": "def Func(arg_0, arg_1='', arg_2=True,\n                   arg_3=None):\n  \"\"\"Make a protobuf Descriptor given a DescriptorProto protobuf.\n\n  Handles nested descriptors. Note that this is limited to the scope of defining\n  a message inside of another message. Composite fields can currently only be\n  resolved if the message is defined in the same scope as the field.\n\n  Args:\n    desc_proto: The descriptor_pb2.DescriptorProto protobuf message.\n    package: Optional package name for the new message Descriptor (string).\n    build_file_if_cpp: Update the C++ descriptor pool if api matches.\n                       Set to False on recursion, so no duplicates are created.\n    syntax: The syntax/semantics that should be used.  Set to \"proto3\" to get\n            proto3 field presence semantics.\n  Returns:\n    A Descriptor for protobuf messages.\n  \"\"\"\n  if api_implementation.Type() == 'cpp' and arg_2:\n    # The C++ implementation requires all descriptors to be backed by the same\n    # definition in the C++ descriptor pool. To do this, we build a\n    # FileDescriptorProto with the same definition as this descriptor and build\n    # it into the pool.\n    from typy.google.protobuf import descriptor_pb2\n    arg_4 = descriptor_pb2.FileDescriptorProto()\n    arg_4.message_type.add().MergeFrom(arg_0)\n\n    # Generate a random name for this proto file to prevent conflicts with any\n    # imported ones. We need to specify a file name so the descriptor pool\n    # accepts our FileDescriptorProto, but it is not important what that file\n    # name is actually set to.\n    arg_5 = str(uuid.uuid4())\n\n    if arg_1:\n      arg_4.name = os.path.join(arg_1.replace('.', '/'),\n                                                arg_5 + '.proto')\n      arg_4.package = arg_1\n    else:\n      arg_4.name = arg_5 + '.proto'\n\n    _message.default_pool.Add(arg_4)\n    arg_7 = _message.default_pool.FindFileByName(arg_4.name)\n\n    if _USE_C_DESCRIPTORS:\n      return arg_7.message_types_by_name[arg_0.name]\n\n  arg_8 = [arg_0.name]\n  if arg_1: arg_8.insert(0, arg_1)\n\n  # Create Descriptors for enum types\n  arg_9 = {}\n  for arg_10 in arg_0.enum_type:\n    arg_11 = '.'.join(arg_8 + [arg_10.name])\n    arg_12 = EnumDescriptor(\n      arg_10.name, arg_11, None, [\n          EnumValueDescriptor(enum_val.name, ii, enum_val.number)\n          for ii, enum_val in enumerate(arg_10.value)])\n    arg_9[arg_11] = arg_12\n\n  # Create Descriptors for nested types\n  arg_13 = {}\n  for arg_14 in arg_0.nested_type:\n    arg_11 = '.'.join(arg_8 + [arg_14.name])\n    # Nested types are just those defined inside of the message, not all types\n    # used by fields in the message, so no loops are possible here.\n    arg_15 = Func(arg_14,\n                                 arg_1='.'.join(arg_8),\n                                 arg_2=False,\n                                 arg_3=arg_3)\n    arg_13[arg_11] = arg_15\n\n  arg_16 = []\n  for arg_17 in arg_0.field:\n    arg_11 = '.'.join(arg_8 + [arg_17.name])\n    arg_12 = None\n    arg_15 = None\n    if arg_17.HasField('type_name'):\n      arg_18 = arg_17.type_name\n      arg_19 = '.'.join(arg_8 +\n                                [arg_18[arg_18.rfind('.')+1:]])\n      if arg_19 in arg_13:\n        arg_15 = arg_13[arg_19]\n      elif arg_19 in arg_9:\n        arg_12 = arg_9[arg_19]\n      # Else type_name references a non-local type, which isn't implemented\n    arg_20 = FieldDescriptor(\n        arg_17.name, arg_11, arg_17.number - 1,\n        arg_17.number, arg_17.type,\n        FieldDescriptor.ProtoTypeToCppProtoType(arg_17.type),\n        arg_17.label, None, arg_15, arg_12, None, False, None,\n        options=arg_17.options, has_default_value=False)\n    arg_16.append(arg_20)\n\n  arg_21 = '.'.join(arg_8)\n  return Descriptor(arg_0.name, arg_21, None, None, arg_16,\n                    list(arg_13.values()), list(arg_9.values()), [],\n                    options=arg_0.options)", "path": "typy/google/protobuf/descriptor.py", "identifier": "MakeDescriptor", "docstring": "Make a protobuf Descriptor given a DescriptorProto protobuf.\n\n  Handles nested descriptors. Note that this is limited to the scope of defining\n  a message inside of another message. Composite fields can currently only be\n  resolved if the message is defined in the same scope as the field.\n\n  Args:\n    desc_proto: The descriptor_pb2.DescriptorProto protobuf message.\n    package: Optional package name for the new message Descriptor (string).\n    build_file_if_cpp: Update the C++ descriptor pool if api matches.\n                       Set to False on recursion, so no duplicates are created.\n    syntax: The syntax/semantics that should be used.  Set to \"proto3\" to get\n            proto3 field presence semantics.\n  Returns:\n    A Descriptor for protobuf messages.", "docstring_tokens": ["Make", "a", "protobuf", "Descriptor", "given", "a", "DescriptorProto", "protobuf", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 253331}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L360-L400", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Add a tier. When no linguistic type is given and the default\n        linguistic type is unavailable then the assigned linguistic type will\n        be the first in the list.", "language": "python", "parameters": "(self, tier_id, ling='default-lt', parent=None, locale=None,\n                 part=None, ann=None, language=None, tier_dict=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'default-lt'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ")", ":", "if", "not", "arg_1", ":", "raise", "ValueError", "(", "'Tier id is empty...'", ")", "if", "arg_2", "not", "in", "arg_0", ".", "linguistic_types", ":", "arg_2", "=", "sorted", "(", "arg_0", ".", "linguistic_types", ".", "keys", "(", ")", ")", "[", "0", "]", "if", "arg_4", "and", "arg_4", "not", "in", "arg_0", ".", "locales", ":", "arg_4", "=", "None", "if", "arg_7", "and", "arg_7", "not", "in", "arg_0", ".", "languages", ":", "arg_7", "=", "None", "if", "arg_8", "is", "None", ":", "arg_0", ".", "tiers", "[", "arg_1", "]", "=", "(", "{", "}", ",", "{", "}", ",", "{", "'TIER_ID'", ":", "arg_1", ",", "'LINGUISTIC_TYPE_REF'", ":", "arg_2", ",", "'PARENT_REF'", ":", "arg_3", ",", "'PARTICIPANT'", ":", "arg_5", ",", "'DEFAULT_LOCALE'", ":", "arg_4", ",", "'LANG_REF'", ":", "arg_7", ",", "'ANNOTATOR'", ":", "arg_6", "}", ",", "len", "(", "arg_0", ".", "tiers", ")", ")", "else", ":", "arg_0", ".", "tiers", "[", "arg_1", "]", "=", "(", "{", "}", ",", "{", "}", ",", "arg_8", ",", "len", "(", "arg_0", ".", "tiers", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2='default-lt', arg_3=None, arg_4=None,\n                 arg_5=None, arg_6=None, arg_7=None, arg_8=None):\n        \"\"\"Add a tier. When no linguistic type is given and the default\n        linguistic type is unavailable then the assigned linguistic type will\n        be the first in the list.\n\n        :param str tier_id: Name of the tier.\n        :param str ling: Linguistic type, if the type is not available it will\n                         warn and pick the first available type.\n        :param str parent: Parent tier name.\n        :param str locale: Locale, if the locale is not present this option is\n            ignored and the locale will not be set.\n        :param str part: Participant.\n        :param str ann: Annotator.\n        :param str language: Language , if the language is not present this\n            option is ignored and the language will not be set.\n        :param dict tier_dict: TAG attributes, when this is not ``None`` it\n                               will ignore all other options. Please only use\n                               dictionaries coming from the\n                               :func:`get_parameters_for_tier`\n        :raises ValueError: If the tier_id is empty\n        \"\"\"\n        if not arg_1:\n            raise ValueError('Tier id is empty...')\n        if arg_2 not in arg_0.linguistic_types:\n            arg_2 = sorted(arg_0.linguistic_types.keys())[0]\n        if arg_4 and arg_4 not in arg_0.locales:\n            arg_4 = None\n        if arg_7 and arg_7 not in arg_0.languages:\n            arg_7 = None\n        if arg_8 is None:\n            arg_0.tiers[arg_1] = ({}, {}, {\n                'TIER_ID': arg_1,\n                'LINGUISTIC_TYPE_REF': arg_2,\n                'PARENT_REF': arg_3,\n                'PARTICIPANT': arg_5,\n                'DEFAULT_LOCALE': arg_4,\n                'LANG_REF': arg_7,\n                'ANNOTATOR': arg_6}, len(arg_0.tiers))\n        else:\n            arg_0.tiers[arg_1] = ({}, {}, arg_8, len(arg_0.tiers))", "path": "pympi/Elan.py", "identifier": "Eaf.add_tier", "docstring": "Add a tier. When no linguistic type is given and the default\n        linguistic type is unavailable then the assigned linguistic type will\n        be the first in the list.\n\n        :param str tier_id: Name of the tier.\n        :param str ling: Linguistic type, if the type is not available it will\n                         warn and pick the first available type.\n        :param str parent: Parent tier name.\n        :param str locale: Locale, if the locale is not present this option is\n            ignored and the locale will not be set.\n        :param str part: Participant.\n        :param str ann: Annotator.\n        :param str language: Language , if the language is not present this\n            option is ignored and the language will not be set.\n        :param dict tier_dict: TAG attributes, when this is not ``None`` it\n                               will ignore all other options. Please only use\n                               dictionaries coming from the\n                               :func:`get_parameters_for_tier`\n        :raises ValueError: If the tier_id is empty", "docstring_tokens": ["Add", "a", "tier", ".", "When", "no", "linguistic", "type", "is", "given", "and", "the", "default", "linguistic", "type", "is", "unavailable", "then", "the", "assigned", "linguistic", "type", "will", "be", "the", "first", "in", "the", "list", "."], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 253332}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/__init__.py#L32-L65", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Attempt to import tensorflow, and ensure its version is sufficient.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "import", "tensorflow", "as", "tf", "except", "ImportError", ":", "print", "(", "\"\\n\\nFailed to import TensorFlow. Please note that TensorFlow is not \"", "\"installed by default when you install TensorFlow Probability. This \"", "\"is so that users can decide whether to install the GPU-enabled \"", "\"TensorFlow package. To use TensorFlow Probability, please install \"", "\"the most recent version of TensorFlow, by following instructions at \"", "\"https://tensorflow.org/install.\\n\\n\"", ")", "raise", "import", "distutils", ".", "version", "arg_0", "=", "\"1.13\"", "if", "(", "distutils", ".", "version", ".", "LooseVersion", "(", "tf", ".", "__version__", ")", "<", "distutils", ".", "version", ".", "LooseVersion", "(", "arg_0", ")", ")", ":", "raise", "ImportError", "(", "\"This version of TensorFlow Probability requires TensorFlow \"", "\"version >= {required}; Detected an installation of version {present}. \"", "\"Please upgrade TensorFlow to proceed.\"", ".", "format", "(", "required", "=", "arg_0", ",", "present", "=", "tf", ".", "__version__", ")", ")"], "function": "def Func():  # pylint: disable=g-statement-before-imports\n  \"\"\"Attempt to import tensorflow, and ensure its version is sufficient.\n\n  Raises:\n    ImportError: if either tensorflow is not importable or its version is\n    inadequate.\n  \"\"\"\n  try:\n    import tensorflow as tf\n  except ImportError:\n    # Print more informative error message, then reraise.\n    print(\"\\n\\nFailed to import TensorFlow. Please note that TensorFlow is not \"\n          \"installed by default when you install TensorFlow Probability. This \"\n          \"is so that users can decide whether to install the GPU-enabled \"\n          \"TensorFlow package. To use TensorFlow Probability, please install \"\n          \"the most recent version of TensorFlow, by following instructions at \"\n          \"https://tensorflow.org/install.\\n\\n\")\n    raise\n\n  import distutils.version\n\n  #\n  # Update this whenever we need to depend on a newer TensorFlow release.\n  #\n  arg_0 = \"1.13\"\n\n  if (distutils.version.LooseVersion(tf.__version__) <\n      distutils.version.LooseVersion(arg_0)):\n    raise ImportError(\n        \"This version of TensorFlow Probability requires TensorFlow \"\n        \"version >= {required}; Detected an installation of version {present}. \"\n        \"Please upgrade TensorFlow to proceed.\".format(\n            required=arg_0,\n            present=tf.__version__))", "path": "tensorflow_probability/__init__.py", "identifier": "_ensure_tf_install", "docstring": "Attempt to import tensorflow, and ensure its version is sufficient.\n\n  Raises:\n    ImportError: if either tensorflow is not importable or its version is\n    inadequate.", "docstring_tokens": ["Attempt", "to", "import", "tensorflow", "and", "ensure", "its", "version", "is", "sufficient", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253333}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/db.py#L171-L240", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Finds and returns a model architecture and its parameters from the database which matches the requirement.", "language": "python", "parameters": "(self, sess, sort=None, model_name='model', **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'model'", ",", "**", "arg_4", ")", ":", "arg_4", ".", "update", "(", "{", "'model_name'", ":", "arg_3", "}", ")", "arg_0", ".", "_fill_project_info", "(", "arg_4", ")", "arg_5", "=", "time", ".", "time", "(", ")", "arg_6", "=", "arg_0", ".", "db", ".", "Model", ".", "find_one", "(", "filter", "=", "arg_4", ",", "arg_2", "=", "arg_2", ")", "arg_7", "=", "'_find_one_model_ztemp_file'", "if", "arg_6", "is", "not", "None", ":", "arg_8", "=", "arg_6", "[", "'params_id'", "]", "arg_9", "=", "arg_6", "[", "'architecture'", "]", "arg_10", "=", "arg_6", "[", "'time'", "]", "exists_or_mkdir", "(", "arg_7", ",", "False", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_7", ",", "'graph.pkl'", ")", ",", "'wb'", ")", "as", "file", ":", "pickle", ".", "dump", "(", "arg_9", ",", "file", ",", "protocol", "=", "pickle", ".", "HIGHEST_PROTOCOL", ")", "else", ":", "print", "(", "\"[Database] FAIL! Cannot find model: {}\"", ".", "format", "(", "arg_4", ")", ")", "return", "False", "try", ":", "arg_11", "=", "arg_0", ".", "_deserialization", "(", "arg_0", ".", "model_fs", ".", "get", "(", "arg_8", ")", ".", "read", "(", ")", ")", "np", ".", "savez", "(", "os", ".", "path", ".", "join", "(", "arg_7", ",", "'params.npz'", ")", ",", "arg_11", "=", "arg_11", ")", "arg_12", "=", "load_graph_and_params", "(", "name", "=", "arg_7", ",", "arg_1", "=", "arg_1", ")", "del_folder", "(", "arg_7", ")", "arg_13", "=", "arg_0", ".", "db", ".", "Model", ".", "find", "(", "arg_4", ")", "print", "(", "\"[Database] Find one model SUCCESS. kwargs:{} sort:{} save time:{} took: {}s\"", ".", "format", "(", "arg_4", ",", "arg_2", ",", "arg_10", ",", "round", "(", "time", ".", "time", "(", ")", "-", "arg_5", ",", "2", ")", ")", ")", "for", "arg_14", "in", "arg_6", ":", "arg_12", ".", "__dict__", ".", "update", "(", "{", "\"_%s\"", "%", "arg_14", ":", "arg_6", "[", "arg_14", "]", "}", ")", "arg_15", "=", "arg_13", ".", "distinct", "(", "'params_id'", ")", "arg_16", "=", "len", "(", "arg_15", ")", "if", "arg_16", "!=", "1", ":", "print", "(", "\"     Note that there are {} models match the kwargs\"", ".", "format", "(", "arg_16", ")", ")", "return", "arg_12", "except", "Exception", "as", "e", ":", "arg_17", ",", "arg_18", ",", "arg_19", "=", "sys", ".", "exc_info", "(", ")", "arg_20", "=", "os", ".", "path", ".", "split", "(", "arg_19", ".", "tb_frame", ".", "f_code", ".", "co_filename", ")", "[", "1", "]", "logging", ".", "info", "(", "\"{}  {}  {}  {}  {}\"", ".", "format", "(", "arg_17", ",", "arg_18", ",", "arg_20", ",", "arg_19", ".", "tb_lineno", ",", "e", ")", ")", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3='model', **arg_4):\n        \"\"\"Finds and returns a model architecture and its parameters from the database which matches the requirement.\n\n        Parameters\n        ----------\n        sess : Session\n            TensorFlow session.\n        sort : List of tuple\n            PyMongo sort comment, search \"PyMongo find one sorting\" and `collection level operations <http://api.mongodb.com/python/current/api/pymongo/collection.html>`__ for more details.\n        model_name : str or None\n            The name/key of model.\n        kwargs : other events\n            Other events, such as name, accuracy, loss, step number and etc (optinal).\n\n        Examples\n        ---------\n        - see ``save_model``.\n\n        Returns\n        ---------\n        network : TensorLayer layer\n            Note that, the returned network contains all information of the document (record), e.g. if you saved accuracy in the document, you can get the accuracy by using ``net._accuracy``.\n        \"\"\"\n        # print(kwargs)   # {}\n        arg_4.update({'model_name': arg_3})\n        arg_0._fill_project_info(arg_4)\n\n        arg_5 = time.time()\n\n        arg_6 = arg_0.db.Model.find_one(filter=arg_4, arg_2=arg_2)\n\n        arg_7 = '_find_one_model_ztemp_file'\n        if arg_6 is not None:\n            arg_8 = arg_6['params_id']\n            arg_9 = arg_6['architecture']\n            arg_10 = arg_6['time']\n            exists_or_mkdir(arg_7, False)\n            with open(os.path.join(arg_7, 'graph.pkl'), 'wb') as file:\n                pickle.dump(arg_9, file, protocol=pickle.HIGHEST_PROTOCOL)\n        else:\n            print(\"[Database] FAIL! Cannot find model: {}\".format(arg_4))\n            return False\n        try:\n            arg_11 = arg_0._deserialization(arg_0.model_fs.get(arg_8).read())\n            np.savez(os.path.join(arg_7, 'params.npz'), arg_11=arg_11)\n\n            arg_12 = load_graph_and_params(name=arg_7, arg_1=arg_1)\n            del_folder(arg_7)\n\n            arg_13 = arg_0.db.Model.find(arg_4)\n            print(\n                \"[Database] Find one model SUCCESS. kwargs:{} sort:{} save time:{} took: {}s\".\n                format(arg_4, arg_2, arg_10, round(time.time() - arg_5, 2))\n            )\n\n            # put all informations of model into the TL layer\n            for arg_14 in arg_6:\n                arg_12.__dict__.update({\"_%s\" % arg_14: arg_6[arg_14]})\n\n            # check whether more parameters match the requirement\n            arg_15 = arg_13.distinct('params_id')\n            arg_16 = len(arg_15)\n            if arg_16 != 1:\n                print(\"     Note that there are {} models match the kwargs\".format(arg_16))\n            return arg_12\n        except Exception as e:\n            arg_17, arg_18, arg_19 = sys.exc_info()\n            arg_20 = os.path.split(arg_19.tb_frame.f_code.co_filename)[1]\n            logging.info(\"{}  {}  {}  {}  {}\".format(arg_17, arg_18, arg_20, arg_19.tb_lineno, e))\n            return False", "path": "tensorlayer/db.py", "identifier": "TensorHub.find_top_model", "docstring": "Finds and returns a model architecture and its parameters from the database which matches the requirement.\n\n        Parameters\n        ----------\n        sess : Session\n            TensorFlow session.\n        sort : List of tuple\n            PyMongo sort comment, search \"PyMongo find one sorting\" and `collection level operations <http://api.mongodb.com/python/current/api/pymongo/collection.html>`__ for more details.\n        model_name : str or None\n            The name/key of model.\n        kwargs : other events\n            Other events, such as name, accuracy, loss, step number and etc (optinal).\n\n        Examples\n        ---------\n        - see ``save_model``.\n\n        Returns\n        ---------\n        network : TensorLayer layer\n            Note that, the returned network contains all information of the document (record), e.g. if you saved accuracy in the document, you can get the accuracy by using ``net._accuracy``.", "docstring_tokens": ["Finds", "and", "returns", "a", "model", "architecture", "and", "its", "parameters", "from", "the", "database", "which", "matches", "the", "requirement", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253334}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L290-L303", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Decide whether to trace execution in `filename`.", "language": "python", "parameters": "(self, filename, frame)", "return_statement": "return canonical", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "Func_with_reason", "(", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "debug", ".", "should", "(", "'trace'", ")", ":", "if", "not", "arg_3", ":", "arg_5", "=", "\"Not tracing %r: %s\"", "%", "(", "arg_1", ",", "arg_4", ")", "else", ":", "arg_5", "=", "\"Tracing %r\"", "%", "(", "arg_1", ",", ")", "arg_0", ".", "debug", ".", "write", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Decide whether to trace execution in `filename`.\n\n        Calls `Func_with_reason`, and returns just the decision.\n\n        \"\"\"\n        arg_3, arg_4 = arg_0.Func_with_reason(arg_1, arg_2)\n        if arg_0.debug.should('trace'):\n            if not arg_3:\n                arg_5 = \"Not tracing %r: %s\" % (arg_1, arg_4)\n            else:\n                arg_5 = \"Tracing %r\" % (arg_1,)\n            arg_0.debug.write(arg_5)\n        return arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage._should_trace", "docstring": "Decide whether to trace execution in `filename`.\n\n        Calls `_should_trace_with_reason`, and returns just the decision.", "docstring_tokens": ["Decide", "whether", "to", "trace", "execution", "in", "filename", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253335}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/clipboard.py#L26-L34", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the clipboard's text on OS X.", "language": "python", "parameters": "()", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "subprocess", ".", "Popen", "(", "[", "'pbpaste'", ",", "'-Prefer'", ",", "'ascii'", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "communicate", "(", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "'\\r'", ",", "'\\n'", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\" Get the clipboard's text on OS X.\n    \"\"\"\n    arg_0 = subprocess.Popen(['pbpaste', '-Prefer', 'ascii'],\n        stdout=subprocess.PIPE)\n    arg_1, arg_2 = arg_0.communicate()\n    # Text comes in with old Mac \\r line endings. Change them to \\n.\n    arg_1 = arg_1.replace('\\r', '\\n')\n    return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/lib/clipboard.py", "identifier": "osx_clipboard_get", "docstring": "Get the clipboard's text on OS X.", "docstring_tokens": ["Get", "the", "clipboard", "s", "text", "on", "OS", "X", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253336}
{"url": "https://github.com/jic-dtool/dtool-azure/blob/5f5f1faa040e047e619380faf437a74cdfa09737/dtool_azure/storagebroker.py#L340-L348", "sha": "5f5f1faa040e047e619380faf437a74cdfa09737", "docstring_summary": "Store the given text contents so that they are later retrievable by\n        the given key.", "language": "python", "parameters": "(self, key, contents)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_blobservice", ".", "create_blob_from_text", "(", "arg_0", ".", "uuid", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Store the given text contents so that they are later retrievable by\n        the given key.\"\"\"\n\n        arg_0._blobservice.create_blob_from_text(\n            arg_0.uuid,\n            arg_1,\n            arg_2\n        )", "path": "dtool_azure/storagebroker.py", "identifier": "AzureStorageBroker.put_text", "docstring": "Store the given text contents so that they are later retrievable by\n        the given key.", "docstring_tokens": ["Store", "the", "given", "text", "contents", "so", "that", "they", "are", "later", "retrievable", "by", "the", "given", "key", "."], "nwo": "jic-dtool/dtool-azure", "score": 0.23137166388621372, "idx": 253337}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_ngram_corpus.py#L141-L183", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Get the count of an n-gram in the corpus.", "language": "python", "parameters": "(self, ngram, corpus=None)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", ".", "ngcorpus", "if", "not", "arg_1", ":", "return", "arg_2", "[", "None", "]", "if", "isinstance", "(", "arg_1", ",", "(", "text_type", ",", "str", ")", ")", ":", "arg_1", "=", "text_type", "(", "arg_1", ")", ".", "split", "(", ")", "if", "arg_1", "[", "0", "]", "in", "arg_2", ":", "return", "arg_0", ".", "Func", "(", "arg_1", "[", "1", ":", "]", ",", "arg_2", "[", "arg_1", "[", "0", "]", "]", ")", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        r\"\"\"Get the count of an n-gram in the corpus.\n\n        Parameters\n        ----------\n        ngram : str\n            The n-gram to retrieve the count of from the n-gram corpus\n        corpus : Corpus\n            The corpus\n\n        Returns\n        -------\n        int\n            The n-gram count\n\n        Examples\n        --------\n        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\\n'\n        >>> tqbf += 'And then it slept.\\n And the dog ran off.'\n        >>> ngcorp = NGramCorpus(Corpus(tqbf))\n        >>> NGramCorpus(Corpus(tqbf)).Func('the')\n        2\n        >>> NGramCorpus(Corpus(tqbf)).Func('fox')\n        1\n\n        \"\"\"\n        if not arg_2:\n            arg_2 = arg_0.ngcorpus\n\n        # if ngram is empty, we're at our leaf node and should return the\n        # value in None\n        if not arg_1:\n            return arg_2[None]\n\n        # support strings or lists/tuples by splitting strings\n        if isinstance(arg_1, (text_type, str)):\n            arg_1 = text_type(arg_1).split()\n\n        # if ngram is not empty, check whether the next element is in the\n        # corpus; if so, recurse--if not, return 0\n        if arg_1[0] in arg_2:\n            return arg_0.Func(arg_1[1:], arg_2[arg_1[0]])\n        return 0", "path": "abydos/corpus/_ngram_corpus.py", "identifier": "NGramCorpus.get_count", "docstring": "r\"\"\"Get the count of an n-gram in the corpus.\n\n        Parameters\n        ----------\n        ngram : str\n            The n-gram to retrieve the count of from the n-gram corpus\n        corpus : Corpus\n            The corpus\n\n        Returns\n        -------\n        int\n            The n-gram count\n\n        Examples\n        --------\n        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\\n'\n        >>> tqbf += 'And then it slept.\\n And the dog ran off.'\n        >>> ngcorp = NGramCorpus(Corpus(tqbf))\n        >>> NGramCorpus(Corpus(tqbf)).get_count('the')\n        2\n        >>> NGramCorpus(Corpus(tqbf)).get_count('fox')\n        1", "docstring_tokens": ["r", "Get", "the", "count", "of", "an", "n", "-", "gram", "in", "the", "corpus", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253338}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/server/server_cli.py#L715-L730", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Run WsgiDAV using wsgiref.simple_server, on Python 2.5+.", "language": "python", "parameters": "(app, config, mode)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "from", "wsgiref", ".", "simple_server", "import", "make_server", ",", "software_version", "arg_3", "=", "\"WsgiDAV/{} {}\"", ".", "format", "(", "__version__", ",", "software_version", ")", "_logger", ".", "info", "(", "\"Running {}...\"", ".", "format", "(", "arg_3", ")", ")", "_logger", ".", "warning", "(", "\"WARNING: This single threaded server (wsgiref) is not meant for production.\"", ")", "arg_4", "=", "make_server", "(", "arg_1", "[", "\"host\"", "]", ",", "arg_1", "[", "\"port\"", "]", ",", "arg_0", ")", "try", ":", "arg_4", ".", "serve_forever", "(", ")", "except", "KeyboardInterrupt", ":", "_logger", ".", "warning", "(", "\"Caught Ctrl-C, shutting down...\"", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Run WsgiDAV using wsgiref.simple_server, on Python 2.5+.\"\"\"\n    # http://www.python.org/doc/2.5.2/lib/module-wsgiref.html\n    from wsgiref.simple_server import make_server, software_version\n\n    arg_3 = \"WsgiDAV/{} {}\".format(__version__, software_version)\n    _logger.info(\"Running {}...\".format(arg_3))\n    _logger.warning(\n        \"WARNING: This single threaded server (wsgiref) is not meant for production.\"\n    )\n    arg_4 = make_server(arg_1[\"host\"], arg_1[\"port\"], arg_0)\n    try:\n        arg_4.serve_forever()\n    except KeyboardInterrupt:\n        _logger.warning(\"Caught Ctrl-C, shutting down...\")\n    return", "path": "wsgidav/server/server_cli.py", "identifier": "_run_wsgiref", "docstring": "Run WsgiDAV using wsgiref.simple_server, on Python 2.5+.", "docstring_tokens": ["Run", "WsgiDAV", "using", "wsgiref", ".", "simple_server", "on", "Python", "2", ".", "5", "+", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 253339}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/objects.py#L424-L493", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Retrieve all of the relevant key wrapping data fields and return them\n        as a dictionary.", "language": "python", "parameters": "(self)", "return_statement": "return key_wrapping_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "{", "}", "arg_2", "=", "{", "'unique_identifier'", ":", "arg_0", ".", "_kdw_eki_unique_identifier", ",", "'cryptographic_parameters'", ":", "{", "'block_cipher_mode'", ":", "arg_0", ".", "_kdw_eki_cp_block_cipher_mode", ",", "'padding_method'", ":", "arg_0", ".", "_kdw_eki_cp_padding_method", ",", "'hashing_algorithm'", ":", "arg_0", ".", "_kdw_eki_cp_hashing_algorithm", ",", "'key_role_type'", ":", "arg_0", ".", "_kdw_eki_cp_key_role_type", ",", "'digital_signature_algorithm'", ":", "arg_0", ".", "_kdw_eki_cp_digital_signature_algorithm", ",", "'cryptographic_algorithm'", ":", "arg_0", ".", "_kdw_eki_cp_cryptographic_algorithm", ",", "'random_iv'", ":", "arg_0", ".", "_kdw_eki_cp_random_iv", ",", "'iv_length'", ":", "arg_0", ".", "_kdw_eki_cp_iv_length", ",", "'tag_length'", ":", "arg_0", ".", "_kdw_eki_cp_tag_length", ",", "'fixed_field_length'", ":", "arg_0", ".", "_kdw_eki_cp_fixed_field_length", ",", "'invocation_field_length'", ":", "arg_0", ".", "_kdw_eki_cp_invocation_field_length", ",", "'counter_length'", ":", "arg_0", ".", "_kdw_eki_cp_counter_length", ",", "'initial_counter_value'", ":", "arg_0", ".", "_kdw_eki_cp_initial_counter_value", "}", "}", "if", "not", "any", "(", "arg_2", "[", "'cryptographic_parameters'", "]", ".", "values", "(", ")", ")", ":", "arg_2", "[", "'cryptographic_parameters'", "]", "=", "{", "}", "if", "not", "any", "(", "arg_2", ".", "values", "(", ")", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "{", "'unique_identifier'", ":", "arg_0", ".", "_kdw_mski_unique_identifier", ",", "'cryptographic_parameters'", ":", "{", "'block_cipher_mode'", ":", "arg_0", ".", "_kdw_mski_cp_block_cipher_mode", ",", "'padding_method'", ":", "arg_0", ".", "_kdw_mski_cp_padding_method", ",", "'hashing_algorithm'", ":", "arg_0", ".", "_kdw_mski_cp_hashing_algorithm", ",", "'key_role_type'", ":", "arg_0", ".", "_kdw_mski_cp_key_role_type", ",", "'digital_signature_algorithm'", ":", "arg_0", ".", "_kdw_mski_cp_digital_signature_algorithm", ",", "'cryptographic_algorithm'", ":", "arg_0", ".", "_kdw_mski_cp_cryptographic_algorithm", ",", "'random_iv'", ":", "arg_0", ".", "_kdw_mski_cp_random_iv", ",", "'iv_length'", ":", "arg_0", ".", "_kdw_mski_cp_iv_length", ",", "'tag_length'", ":", "arg_0", ".", "_kdw_mski_cp_tag_length", ",", "'fixed_field_length'", ":", "arg_0", ".", "_kdw_mski_cp_fixed_field_length", ",", "'invocation_field_length'", ":", "arg_0", ".", "_kdw_mski_cp_invocation_field_length", ",", "'counter_length'", ":", "arg_0", ".", "_kdw_mski_cp_counter_length", ",", "'initial_counter_value'", ":", "arg_0", ".", "_kdw_mski_cp_initial_counter_value", "}", "}", "if", "not", "any", "(", "arg_3", "[", "'cryptographic_parameters'", "]", ".", "values", "(", ")", ")", ":", "arg_3", "[", "'cryptographic_parameters'", "]", "=", "{", "}", "if", "not", "any", "(", "arg_3", ".", "values", "(", ")", ")", ":", "arg_3", "=", "{", "}", "Func", "[", "'wrapping_method'", "]", "=", "arg_0", ".", "_kdw_wrapping_method", "Func", "[", "'encryption_key_information'", "]", "=", "arg_2", "Func", "[", "'mac_signature_key_information'", "]", "=", "arg_3", "Func", "[", "'mac_signature'", "]", "=", "arg_0", ".", "_kdw_mac_signature", "Func", "[", "'iv_counter_nonce'", "]", "=", "arg_0", ".", "_kdw_iv_counter_nonce", "Func", "[", "'encoding_option'", "]", "=", "arg_0", ".", "_kdw_encoding_option", "if", "not", "any", "(", "Func", ".", "values", "(", ")", ")", ":", "Func", "=", "{", "}", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieve all of the relevant key wrapping data fields and return them\n        as a dictionary.\n        \"\"\"\n        Func = {}\n        arg_2 = {\n            'unique_identifier': arg_0._kdw_eki_unique_identifier,\n            'cryptographic_parameters': {\n                'block_cipher_mode': arg_0._kdw_eki_cp_block_cipher_mode,\n                'padding_method': arg_0._kdw_eki_cp_padding_method,\n                'hashing_algorithm': arg_0._kdw_eki_cp_hashing_algorithm,\n                'key_role_type': arg_0._kdw_eki_cp_key_role_type,\n                'digital_signature_algorithm':\n                    arg_0._kdw_eki_cp_digital_signature_algorithm,\n                'cryptographic_algorithm':\n                    arg_0._kdw_eki_cp_cryptographic_algorithm,\n                'random_iv': arg_0._kdw_eki_cp_random_iv,\n                'iv_length': arg_0._kdw_eki_cp_iv_length,\n                'tag_length': arg_0._kdw_eki_cp_tag_length,\n                'fixed_field_length': arg_0._kdw_eki_cp_fixed_field_length,\n                'invocation_field_length':\n                    arg_0._kdw_eki_cp_invocation_field_length,\n                'counter_length': arg_0._kdw_eki_cp_counter_length,\n                'initial_counter_value':\n                    arg_0._kdw_eki_cp_initial_counter_value\n            }\n        }\n        if not any(arg_2['cryptographic_parameters'].values()):\n            arg_2['cryptographic_parameters'] = {}\n        if not any(arg_2.values()):\n            arg_2 = {}\n\n        arg_3 = {\n            'unique_identifier': arg_0._kdw_mski_unique_identifier,\n            'cryptographic_parameters': {\n                'block_cipher_mode': arg_0._kdw_mski_cp_block_cipher_mode,\n                'padding_method': arg_0._kdw_mski_cp_padding_method,\n                'hashing_algorithm': arg_0._kdw_mski_cp_hashing_algorithm,\n                'key_role_type': arg_0._kdw_mski_cp_key_role_type,\n                'digital_signature_algorithm':\n                    arg_0._kdw_mski_cp_digital_signature_algorithm,\n                'cryptographic_algorithm':\n                    arg_0._kdw_mski_cp_cryptographic_algorithm,\n                'random_iv': arg_0._kdw_mski_cp_random_iv,\n                'iv_length': arg_0._kdw_mski_cp_iv_length,\n                'tag_length': arg_0._kdw_mski_cp_tag_length,\n                'fixed_field_length': arg_0._kdw_mski_cp_fixed_field_length,\n                'invocation_field_length':\n                    arg_0._kdw_mski_cp_invocation_field_length,\n                'counter_length': arg_0._kdw_mski_cp_counter_length,\n                'initial_counter_value':\n                    arg_0._kdw_mski_cp_initial_counter_value\n            }\n        }\n        if not any(arg_3['cryptographic_parameters'].values()):\n            arg_3['cryptographic_parameters'] = {}\n        if not any(arg_3.values()):\n            arg_3 = {}\n\n        Func['wrapping_method'] = arg_0._kdw_wrapping_method\n        Func['encryption_key_information'] = arg_2\n        Func['mac_signature_key_information'] = arg_3\n        Func['mac_signature'] = arg_0._kdw_mac_signature\n        Func['iv_counter_nonce'] = arg_0._kdw_iv_counter_nonce\n        Func['encoding_option'] = arg_0._kdw_encoding_option\n        if not any(Func.values()):\n            Func = {}\n\n        return Func", "path": "kmip/pie/objects.py", "identifier": "Key.key_wrapping_data", "docstring": "Retrieve all of the relevant key wrapping data fields and return them\n        as a dictionary.", "docstring_tokens": ["Retrieve", "all", "of", "the", "relevant", "key", "wrapping", "data", "fields", "and", "return", "them", "as", "a", "dictionary", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 253340}
{"url": "https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L491-L503", "sha": "d97414a05541f48231381f607d1d2e6b50781d39", "docstring_summary": "Match a parser zero or more times repeatedly.", "language": "python", "parameters": "(parser: Union[Parser, Sequence[Input]])", "return_statement": "return RepeatedParser(parser)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", "[", "arg_4", "]", "]", ")", "->", "RepeatedParser", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "lit", "(", "arg_0", ")", "return", "RepeatedParser", "(", "arg_0", ")"], "function": "def Func(arg_0: arg_1[arg_2, arg_3[arg_4]]) -> RepeatedParser:\n    \"\"\"Match a parser zero or more times Funceatedly.\n\n    This matches ``parser`` multiple times in a row. A list is returned\n    containing the value from each match. If there are no matches, an empty list\n    is returned.\n\n    Args:\n        parser: Parser or literal\n    \"\"\"\n    if isinstance(arg_0, str):\n        arg_0 = lit(arg_0)\n    return RepeatedParser(arg_0)", "path": "parsita/parsers.py", "identifier": "rep", "docstring": "Match a parser zero or more times repeatedly.\n\n    This matches ``parser`` multiple times in a row. A list is returned\n    containing the value from each match. If there are no matches, an empty list\n    is returned.\n\n    Args:\n        parser: Parser or literal", "docstring_tokens": ["Match", "a", "parser", "zero", "or", "more", "times", "repeatedly", "."], "nwo": "drhagen/parsita", "score": 0.2757871243566705, "idx": 253341}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/loop/MPEventLoopRunner.py#L115-L134", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "Return pairs of run ids and results.", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "communicationChannel", ".", "Func_all", "(", ")", "arg_0", ".", "nruns", "-=", "len", "(", "arg_1", ")", "if", "arg_0", ".", "nruns", ">", "0", ":", "import", "logging", "arg_2", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_2", ".", "warning", "(", "'too few results Funcd: {} results Funcd, {} more expected'", ".", "format", "(", "len", "(", "arg_1", ")", ",", "arg_0", ".", "nruns", ")", ")", "elif", "arg_0", ".", "nruns", "<", "0", ":", "import", "logging", "arg_2", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_2", ".", "warning", "(", "'too many results Funcd: {} results Funcd, {} too many'", ".", "format", "(", "len", "(", "arg_1", ")", ",", "-", "arg_0", ".", "nruns", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return pairs of run ids and results.\n\n        This method waits until all event loops finish\n        \"\"\"\n        arg_1 = arg_0.communicationChannel.Func_all()\n        arg_0.nruns -= len(arg_1)\n        if arg_0.nruns > 0:\n            import logging\n            arg_2 = logging.getLogger(__name__)\n            arg_2.warning(\n                'too few results Funcd: {} results Funcd, {} more expected'.format(\n                    len(arg_1), arg_0.nruns))\n        elif arg_0.nruns < 0:\n            import logging\n            arg_2 = logging.getLogger(__name__)\n            arg_2.warning(\n                'too many results Funcd: {} results Funcd, {} too many'.format(\n                    len(arg_1), -arg_0.nruns))\n        return arg_1", "path": "alphatwirl/loop/MPEventLoopRunner.py", "identifier": "MPEventLoopRunner.receive", "docstring": "Return pairs of run ids and results.\n\n        This method waits until all event loops finish", "docstring_tokens": ["Return", "pairs", "of", "run", "ids", "and", "results", "."], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 253342}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1978-L1988", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Reorder levels of an H2O factor for one single column of a H2O frame", "language": "python", "parameters": "(self, y)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"relevel\", self, quote(y)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "quote", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Reorder levels of an H2O factor for one single column of a H2O frame\n\n        The levels of a factor are reordered such that the reference level is at level 0, all remaining levels are\n        moved down as needed.\n\n        :param str y: The reference level\n        :returns: New reordered factor column\n        \"\"\"\n        return H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, quote(arg_1)))", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.relevel", "docstring": "Reorder levels of an H2O factor for one single column of a H2O frame\n\n        The levels of a factor are reordered such that the reference level is at level 0, all remaining levels are\n        moved down as needed.\n\n        :param str y: The reference level\n        :returns: New reordered factor column", "docstring_tokens": ["Reorder", "levels", "of", "an", "H2O", "factor", "for", "one", "single", "column", "of", "a", "H2O", "frame"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253343}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/InstructionLibrary.py#L82-L96", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Convert the specification into an instruction", "language": "python", "parameters": "(self, specification)", "return_statement": "return instruction", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_instruction_class", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "type", "if", "arg_3", "in", "arg_0", ".", "_type_to_instruction", ":", "arg_2", ".", "inherit_from", "(", "arg_0", ".", "_type_to_instruction", "[", "arg_3", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert the specification into an instruction\n\n        :param specification: a specification with a key\n          :data:`knittingpattern.Instruction.TYPE`\n\n        The instruction is not added.\n\n        .. seealso:: :meth:`add_instruction`\n        \"\"\"\n        arg_2 = arg_0._instruction_class(arg_1)\n        arg_3 = arg_2.type\n        if arg_3 in arg_0._type_to_instruction:\n            arg_2.inherit_from(arg_0._type_to_instruction[arg_3])\n        return arg_2", "path": "knittingpattern/InstructionLibrary.py", "identifier": "InstructionLibrary.as_instruction", "docstring": "Convert the specification into an instruction\n\n        :param specification: a specification with a key\n          :data:`knittingpattern.Instruction.TYPE`\n\n        The instruction is not added.\n\n        .. seealso:: :meth:`add_instruction`", "docstring_tokens": ["Convert", "the", "specification", "into", "an", "instruction"], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 253344}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/sprites_dataset.py#L152-L185", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates a sequence.", "language": "python", "parameters": "(character, action_metadata, direction, length=8, start=0)", "return_statement": "return frames", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "8", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "(", "arg_1", "[", "0", "]", "+", "arg_2", ")", "*", "FRAME_SIZE", "arg_6", "=", "(", "arg_1", "[", "0", "]", "+", "arg_2", "+", "1", ")", "*", "FRAME_SIZE", "arg_7", "=", "arg_0", "[", "arg_5", ":", "arg_6", ",", "...", "]", "arg_8", "=", "tf", ".", "stack", "(", "tf", ".", "split", "(", "arg_7", ",", "13", ",", "axis", "=", "1", ")", ")", "arg_8", "=", "arg_8", "[", "0", ":", "arg_1", "[", "1", "]", "]", "arg_8", "=", "tf", ".", "roll", "(", "arg_8", ",", "shift", "=", "-", "arg_4", ",", "axis", "=", "0", ")", "arg_8", "=", "tf", ".", "tile", "(", "arg_8", ",", "[", "2", ",", "1", ",", "1", ",", "1", "]", ")", "arg_8", "=", "arg_8", "[", ":", "arg_3", "]", "arg_8", "=", "tf", ".", "cast", "(", "arg_8", ",", "dtype", "=", "tf", ".", "float32", ")", "arg_8", ".", "set_shape", "(", "[", "arg_3", ",", "FRAME_SIZE", ",", "FRAME_SIZE", ",", "CHANNELS", "]", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=8, arg_4=0):\n  \"\"\"Creates a sequence.\n\n  Args:\n    character: A character sprite tensor.\n    action_metadata: An action metadata tuple.\n    direction: An integer representing the direction, i.e., the row\n      offset within each action group corresponding to a particular\n      direction.\n    length: Desired length of the sequence. If this is longer than\n      the number of available frames, it will roll over to the\n      beginning.\n    start: Index of possible frames at which to start the sequence.\n\n  Returns:\n    A sequence tensor.\n  \"\"\"\n  arg_5 = (arg_1[0]+arg_2) * FRAME_SIZE\n  arg_6 = (arg_1[0]+arg_2+1) * FRAME_SIZE\n  arg_7 = arg_0[arg_5:arg_6, ...]\n\n  # Extract 64x64 patches that are side-by-side in the sprite, and limit\n  # to the actual number of frames for the given action.\n  arg_8 = tf.stack(tf.split(arg_7, 13, axis=1))  # 13 is a hack\n  arg_8 = arg_8[0:arg_1[1]]\n\n  # Extract a slice of the desired length.\n  # NOTE: Length could be longer than the number of frames, so tile as needed.\n  arg_8 = tf.roll(arg_8, shift=-arg_4, axis=0)\n  arg_8 = tf.tile(arg_8, [2, 1, 1, 1])  # 2 is a hack\n  arg_8 = arg_8[:arg_3]\n  arg_8 = tf.cast(arg_8, dtype=tf.float32)\n  arg_8.set_shape([arg_3, FRAME_SIZE, FRAME_SIZE, CHANNELS])\n  return arg_8", "path": "tensorflow_probability/examples/sprites_dataset.py", "identifier": "create_seq", "docstring": "Creates a sequence.\n\n  Args:\n    character: A character sprite tensor.\n    action_metadata: An action metadata tuple.\n    direction: An integer representing the direction, i.e., the row\n      offset within each action group corresponding to a particular\n      direction.\n    length: Desired length of the sequence. If this is longer than\n      the number of available frames, it will roll over to the\n      beginning.\n    start: Index of possible frames at which to start the sequence.\n\n  Returns:\n    A sequence tensor.", "docstring_tokens": ["Creates", "a", "sequence", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253345}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L348-L382", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "pre-processed the data frame.new filtering methods will be implement here.", "language": "python", "parameters": "(self, cls_vec)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ".", "data", ",", "pd", ".", "DataFrame", ")", ":", "arg_2", "=", "arg_0", ".", "data", ".", "copy", "(", ")", "if", "arg_2", ".", "index", ".", "dtype", "==", "'O'", ":", "arg_2", "=", "arg_2", ".", "reset_index", "(", ")", "elif", "os", ".", "path", ".", "isfile", "(", "arg_0", ".", "data", ")", ":", "if", "arg_0", ".", "data", ".", "endswith", "(", "\"gct\"", ")", ":", "arg_2", "=", "pd", ".", "read_csv", "(", "arg_0", ".", "data", ",", "skiprows", "=", "1", ",", "comment", "=", "'#'", ",", "sep", "=", "\"\\t\"", ")", "else", ":", "arg_2", "=", "pd", ".", "read_csv", "(", "arg_0", ".", "data", ",", "comment", "=", "'#'", ",", "sep", "=", "\"\\t\"", ")", "else", ":", "raise", "Exception", "(", "'Error parsing gene expression DataFrame!'", ")", "if", "arg_2", ".", "iloc", "[", ":", ",", "0", "]", ".", "duplicated", "(", ")", ".", "sum", "(", ")", ">", "0", ":", "arg_0", ".", "_logger", ".", "warning", "(", "\"Warning: dropping duplicated gene names, only keep the first values\"", ")", "arg_2", ".", "drop_duplicates", "(", "subset", "=", "arg_2", ".", "columns", "[", "0", "]", ",", "inplace", "=", "True", ")", "if", "arg_2", ".", "isnull", "(", ")", ".", "any", "(", ")", ".", "sum", "(", ")", ">", "0", ":", "arg_0", ".", "_logger", ".", "warning", "(", "\"Warning: Input data contains NA, filled NA with 0\"", ")", "arg_2", ".", "dropna", "(", "how", "=", "'all'", ",", "inplace", "=", "True", ")", "arg_2", "=", "arg_2", ".", "fillna", "(", "0", ")", "arg_2", ".", "set_index", "(", "keys", "=", "arg_2", ".", "columns", "[", "0", "]", ",", "inplace", "=", "True", ")", "arg_3", "=", "arg_2", ".", "select_dtypes", "(", "include", "=", "[", "np", ".", "number", "]", ")", "arg_4", "=", "arg_3", ".", "groupby", "(", "by", "=", "arg_1", ",", "axis", "=", "1", ")", ".", "std", "(", ")", "arg_3", "=", "arg_3", "[", "~", "arg_4", ".", "isin", "(", "[", "0", "]", ")", ".", "any", "(", "axis", "=", "1", ")", "]", "arg_3", "=", "arg_3", "+", "0.00001", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"pre-processed the data frame.new filtering methods will be implement here.\n        \"\"\"\n        # read data in\n        if isinstance(arg_0.data, pd.DataFrame) :\n            arg_2 = arg_0.data.copy()\n            # handle index is gene_names\n            if arg_2.index.dtype == 'O':\n                arg_2 = arg_2.reset_index()\n        elif os.path.isfile(arg_0.data) :\n            # GCT input format?\n            if arg_0.data.endswith(\"gct\"):\n                arg_2 = pd.read_csv(arg_0.data, skiprows=1, comment='#',sep=\"\\t\")\n            else:\n                arg_2 = pd.read_csv(arg_0.data, comment='#',sep=\"\\t\")\n        else:\n            raise Exception('Error parsing gene expression DataFrame!')\n\n        #drop duplicated gene names\n        if arg_2.iloc[:,0].duplicated().sum() > 0:\n            arg_0._logger.warning(\"Warning: dropping duplicated gene names, only keep the first values\")\n            arg_2.drop_duplicates(subset=arg_2.columns[0], inplace=True) #drop duplicate gene_names.\n        if arg_2.isnull().any().sum() > 0:\n            arg_0._logger.warning(\"Warning: Input data contains NA, filled NA with 0\")\n            arg_2.dropna(how='all', inplace=True) #drop rows with all NAs\n            arg_2 = arg_2.fillna(0)\n        # set gene name as index\n        arg_2.set_index(keys=arg_2.columns[0], inplace=True)\n        # select numberic columns\n        arg_3 = arg_2.select_dtypes(include=[np.number])\n        # drop any genes which std ==0\n        arg_4 =  arg_3.groupby(by=arg_1, axis=1).std()\n        arg_3 =  arg_3[~arg_4.isin([0]).any(axis=1)]\n        arg_3 = arg_3 + 0.00001 # we don't like zeros!!!\n        return arg_3", "path": "gseapy/gsea.py", "identifier": "GSEA.load_data", "docstring": "pre-processed the data frame.new filtering methods will be implement here.", "docstring_tokens": ["pre", "-", "processed", "the", "data", "frame", ".", "new", "filtering", "methods", "will", "be", "implement", "here", "."], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 253346}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/automationemailqueues.py#L31-L61", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Manually add a subscriber to a workflow, bypassing the default trigger\n        settings. You can also use this endpoint to trigger a series of\n        automated emails in an API 3.0 workflow type or add subscribers to an\n        automated email queue that uses the API request delay type.", "language": "python", "parameters": "(self, workflow_id, email_id, data)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "workflow_id", "=", "arg_1", "arg_0", ".", "email_id", "=", "arg_2", "if", "'email_address'", "not", "in", "arg_3", ":", "raise", "KeyError", "(", "'The automation email queue must have an email_address'", ")", "check_email", "(", "arg_3", "[", "'email_address'", "]", ")", "arg_4", "=", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'emails'", ",", "arg_2", ",", "'queue'", ")", ",", "arg_3", "=", "arg_3", ")", "if", "arg_4", "is", "not", "None", ":", "arg_0", ".", "subscriber_hash", "=", "arg_4", "[", "'id'", "]", "else", ":", "arg_0", ".", "subscriber_hash", "=", "None", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Manually add a subscriber to a workflow, bypassing the default trigger\n        settings. You can also use this endpoint to trigger a series of\n        automated emails in an API 3.0 workflow type or add subscribers to an\n        automated email queue that uses the API request delay type.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"email_address\": string*\n        }\n        \"\"\"\n        arg_0.workflow_id = arg_1\n        arg_0.email_id = arg_2\n        if 'email_address' not in arg_3:\n            raise KeyError('The automation email queue must have an email_address')\n        check_email(arg_3['email_address'])\n        arg_4 = arg_0._mc_client._post(\n            url=arg_0._build_path(arg_1, 'emails', arg_2, 'queue'),\n            arg_3=arg_3\n        )\n        if arg_4 is not None:\n            arg_0.subscriber_hash = arg_4['id']\n        else:\n            arg_0.subscriber_hash = None\n        return arg_4", "path": "mailchimp3/entities/automationemailqueues.py", "identifier": "AutomationEmailQueues.create", "docstring": "Manually add a subscriber to a workflow, bypassing the default trigger\n        settings. You can also use this endpoint to trigger a series of\n        automated emails in an API 3.0 workflow type or add subscribers to an\n        automated email queue that uses the API request delay type.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"email_address\": string*\n        }", "docstring_tokens": ["Manually", "add", "a", "subscriber", "to", "a", "workflow", "bypassing", "the", "default", "trigger", "settings", ".", "You", "can", "also", "use", "this", "endpoint", "to", "trigger", "a", "series", "of", "automated", "emails", "in", "an", "API", "3", ".", "0", "workflow", "type", "or", "add", "subscribers", "to", "an", "automated", "email", "queue", "that", "uses", "the", "API", "request", "delay", "type", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 253347}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L494-L503", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "For bold, italics and underline. Simply checking to see if the various tags\n    are present will not suffice. If the tag is present and set to False then\n    the style should not be present.", "language": "python", "parameters": "(style)", "return_statement": "return style.get('%sval' % w_namespace) != 'false'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "False", "arg_1", "=", "get_namespace", "(", "arg_0", ",", "'w'", ")", "return", "arg_0", ".", "get", "(", "'%sval'", "%", "arg_1", ")", "!=", "'false'"], "function": "def Func(arg_0):\n    \"\"\"\n    For bold, italics and underline. Simply checking to see if the various tags\n    are present will not suffice. If the tag is present and set to False then\n    the style should not be present.\n    \"\"\"\n    if arg_0 is None:\n        return False\n    arg_1 = get_namespace(arg_0, 'w')\n    return arg_0.get('%sval' % arg_1) != 'false'", "path": "docx2html/core.py", "identifier": "style_is_false", "docstring": "For bold, italics and underline. Simply checking to see if the various tags\n    are present will not suffice. If the tag is present and set to False then\n    the style should not be present.", "docstring_tokens": ["For", "bold", "italics", "and", "underline", ".", "Simply", "checking", "to", "see", "if", "the", "various", "tags", "are", "present", "will", "not", "suffice", ".", "If", "the", "tag", "is", "present", "and", "set", "to", "False", "then", "the", "style", "should", "not", "be", "present", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 253348}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/boids/__init__.py#L93-L107", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "The speed limit for a boid.\n        \n        Boids can momentarily go very fast,\n        something that is impossible for real animals.", "language": "python", "parameters": "(self, max=30)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "30", ")", ":", "if", "abs", "(", "arg_0", ".", "vx", ")", ">", "arg_1", ":", "arg_0", ".", "vx", "=", "arg_0", ".", "vx", "/", "abs", "(", "arg_0", ".", "vx", ")", "*", "arg_1", "if", "abs", "(", "arg_0", ".", "vy", ")", ">", "arg_1", ":", "arg_0", ".", "vy", "=", "arg_0", ".", "vy", "/", "abs", "(", "arg_0", ".", "vy", ")", "*", "arg_1", "if", "abs", "(", "arg_0", ".", "vz", ")", ">", "arg_1", ":", "arg_0", ".", "vz", "=", "arg_0", ".", "vz", "/", "abs", "(", "arg_0", ".", "vz", ")", "*", "arg_1"], "function": "def Func(arg_0, arg_1=30):\n        \n        \"\"\" The speed Func for a boid.\n        \n        Boids can momentarily go very fast,\n        something that is impossible for real animals.\n        \n        \"\"\"\n        \n        if abs(arg_0.vx) > arg_1: \n            arg_0.vx = arg_0.vx/abs(arg_0.vx)*arg_1\n        if abs(arg_0.vy) > arg_1: \n            arg_0.vy = arg_0.vy/abs(arg_0.vy)*arg_1\n        if abs(arg_0.vz) > arg_1: \n            arg_0.vz = arg_0.vz/abs(arg_0.vz)*arg_1", "path": "lib/boids/__init__.py", "identifier": "Boid.limit", "docstring": "The speed limit for a boid.\n        \n        Boids can momentarily go very fast,\n        something that is impossible for real animals.", "docstring_tokens": ["The", "speed", "limit", "for", "a", "boid", ".", "Boids", "can", "momentarily", "go", "very", "fast", "something", "that", "is", "impossible", "for", "real", "animals", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253349}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Metadata.py#L23-L35", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Customized version of get_data to directly get the data without\n            using the authentication method.", "language": "python", "parameters": "(self, url, headers=dict(), params=dict(), render_json=True)", "return_statement": "return response.content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", "(", ")", ",", "arg_4", "=", "arg_3", "(", ")", ",", "arg_5", "=", "True", ")", ":", "arg_1", "=", "urljoin", "(", "arg_0", ".", "end_point", ",", "arg_1", ")", "arg_6", "=", "requests", ".", "get", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "timeout", "=", "arg_0", ".", "get_timeout", "(", ")", ")", "if", "arg_5", ":", "return", "arg_6", ".", "json", "(", ")", "return", "arg_6", ".", "content"], "function": "def Func(arg_0, arg_1, arg_2=arg_3(), arg_4=arg_3(), arg_5=True):\n        \"\"\"\n            Customized version of Func to directly get the data without\n            using the authentication method.\n        \"\"\"\n        arg_1 = urljoin(arg_0.end_point, arg_1)\n\n        arg_6 = requests.get(arg_1, arg_2=arg_2, arg_4=arg_4,\n                                timeout=arg_0.get_timeout())\n\n        if arg_5:\n            return arg_6.json()\n        return arg_6.content", "path": "digitalocean/Metadata.py", "identifier": "Metadata.get_data", "docstring": "Customized version of get_data to directly get the data without\n            using the authentication method.", "docstring_tokens": ["Customized", "version", "of", "get_data", "to", "directly", "get", "the", "data", "without", "using", "the", "authentication", "method", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 253350}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/docs/m2r.py#L486-L536", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Most of this method is from ``docutils.parser.rst.Directive``.", "language": "python", "parameters": "(self)", "return_statement": "return []", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "state", ".", "document", ".", "settings", ".", "file_insertion_enabled", ":", "raise", "arg_0", ".", "warning", "(", "'\"%s\" directive disabled.'", "%", "arg_0", ".", "name", ")", "arg_1", "=", "arg_0", ".", "state_machine", ".", "input_lines", ".", "source", "(", "arg_0", ".", "lineno", "-", "arg_0", ".", "state_machine", ".", "input_offset", "-", "1", ")", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", ")", "arg_3", "=", "rst", ".", "directives", ".", "path", "(", "arg_0", ".", "arguments", "[", "0", "]", ")", "arg_3", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_3", ")", ")", "arg_3", "=", "utils", ".", "relative_path", "(", "None", ",", "arg_3", ")", "arg_3", "=", "nodes", ".", "repFuncicode", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "options", ".", "get", "(", "'encoding'", ",", "arg_0", ".", "state", ".", "document", ".", "settings", ".", "input_encoding", ")", "arg_5", "=", "arg_0", ".", "state", ".", "document", ".", "settings", ".", "input_encoding_error_handler", "arg_6", "=", "arg_0", ".", "options", ".", "get", "(", "'tab-width'", ",", "arg_0", ".", "state", ".", "document", ".", "settings", ".", "tab_width", ")", "try", ":", "arg_0", ".", "state", ".", "document", ".", "settings", ".", "record_dependencies", ".", "add", "(", "arg_3", ")", "arg_7", "=", "io", ".", "FileInput", "(", "source_path", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "error_handler", "=", "arg_5", ")", "except", "UnicodeEncodeError", "as", "error", ":", "raise", "arg_0", ".", "severe", "(", "'Problems with \"%s\" directive path:\\n'", "'Cannot encode input file path \"%s\" '", "'(wrong locale?).'", "%", "(", "arg_0", ".", "name", ",", "SafeString", "(", "arg_3", ")", ")", ")", "except", "IOError", "as", "error", ":", "raise", "arg_0", ".", "severe", "(", "'Problems with \"%s\" directive path:\\n%s.'", "%", "(", "arg_0", ".", "name", ",", "ErrorString", "(", "error", ")", ")", ")", "try", ":", "arg_8", "=", "arg_7", ".", "read", "(", ")", "except", "UnicodeError", "as", "error", ":", "raise", "arg_0", ".", "severe", "(", "'Problem with \"%s\" directive:\\n%s'", "%", "(", "arg_0", ".", "name", ",", "ErrorString", "(", "error", ")", ")", ")", "arg_9", "=", "arg_0", ".", "state", ".", "document", ".", "settings", ".", "env", ".", "config", "arg_10", "=", "M2R", "(", "no_underscore_emphasis", "=", "arg_9", ".", "no_underscore_emphasis", ")", "arg_11", "=", "statemachine", ".", "string2lines", "(", "arg_10", "(", "arg_8", ")", ",", "arg_6", ",", "convert_whitespace", "=", "True", ")", "arg_0", ".", "state_machine", ".", "insert_input", "(", "arg_11", ",", "arg_3", ")", "return", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"Most of this method is from ``docutils.parser.rst.Directive``.\n\n        docutils version: 0.12\n        \"\"\"\n        if not arg_0.state.document.settings.file_insertion_enabled:\n            raise arg_0.warning('\"%s\" directive disabled.' % arg_0.name)\n        arg_1 = arg_0.state_machine.input_lines.source(\n            arg_0.lineno - arg_0.state_machine.input_offset - 1)\n        arg_2 = os.path.dirname(os.path.abspath(arg_1))\n        arg_3 = rst.directives.path(arg_0.arguments[0])\n        arg_3 = os.path.normpath(os.path.join(arg_2, arg_3))\n        arg_3 = utils.relative_path(None, arg_3)\n        arg_3 = nodes.repFuncicode(arg_3)\n\n        # get options (currently not use directive-specific options)\n        arg_4 = arg_0.options.get(\n            'encoding', arg_0.state.document.settings.input_encoding)\n        arg_5 = arg_0.state.document.settings.input_encoding_error_handler\n        arg_6 = arg_0.options.get(\n            'tab-width', arg_0.state.document.settings.tab_width)\n\n        # open the inclding file\n        try:\n            arg_0.state.document.settings.record_dependencies.add(arg_3)\n            arg_7 = io.FileInput(source_path=arg_3,\n                                        arg_4=arg_4,\n                                        error_handler=arg_5)\n        except UnicodeEncodeError as error:\n            raise arg_0.severe('Problems with \"%s\" directive path:\\n'\n                              'Cannot encode input file path \"%s\" '\n                              '(wrong locale?).' %\n                              (arg_0.name, SafeString(arg_3)))\n        except IOError as error:\n            raise arg_0.severe('Problems with \"%s\" directive path:\\n%s.' %\n                              (arg_0.name, ErrorString(error)))\n\n        # read from the file\n        try:\n            arg_8 = arg_7.read()\n        except UnicodeError as error:\n            raise arg_0.severe('Problem with \"%s\" directive:\\n%s' %\n                              (arg_0.name, ErrorString(error)))\n\n        arg_9 = arg_0.state.document.settings.env.config\n        arg_10 = M2R(no_underscore_emphasis=arg_9.no_underscore_emphasis)\n        arg_11 = statemachine.string2lines(arg_10(arg_8),\n                                                  arg_6,\n                                                  convert_whitespace=True)\n        arg_0.state_machine.insert_input(arg_11, arg_3)\n        return []", "path": "docs/m2r.py", "identifier": "MdInclude.run", "docstring": "Most of this method is from ``docutils.parser.rst.Directive``.\n\n        docutils version: 0.12", "docstring_tokens": ["Most", "of", "this", "method", "is", "from", "docutils", ".", "parser", ".", "rst", ".", "Directive", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 253351}
{"url": "https://github.com/ashleysommer/sanic-cors/blob/f3d68def8cf859398b3c83e4109d815f1f038ea2/sanic_cors/core.py#L329-L342", "sha": "f3d68def8cf859398b3c83e4109d815f1f038ea2", "docstring_summary": "A more flexible str function which intelligently handles stringifying\n    strings, lists and other iterables. The results are lexographically sorted\n    to ensure generated responses are consistent when iterables such as Set\n    are used.", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "None", "elif", "(", "not", "isinstance", "(", "arg_0", ",", "str", ")", "and", "isinstance", "(", "arg_0", ",", "collections", ".", "abc", ".", "Iterable", ")", ")", ":", "return", "', '", ".", "join", "(", "str", "(", "arg_1", ")", "for", "arg_1", "in", "sorted", "(", "arg_0", ")", ")", "else", ":", "return", "str", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    A more flexible str function which intelligently handles stringifying\n    strings, lists and other iterables. The results are lexographically sorted\n    to ensure generated responses are consistent when iterables such as Set\n    are used.\n    \"\"\"\n    if arg_0 is None:\n        return None\n    elif(not isinstance(arg_0, str)\n            and isinstance(arg_0, collections.abc.Iterable)):\n        return ', '.join(str(arg_1) for arg_1 in sorted(arg_0))\n    else:\n        return str(arg_0)", "path": "sanic_cors/core.py", "identifier": "flexible_str", "docstring": "A more flexible str function which intelligently handles stringifying\n    strings, lists and other iterables. The results are lexographically sorted\n    to ensure generated responses are consistent when iterables such as Set\n    are used.", "docstring_tokens": ["A", "more", "flexible", "str", "function", "which", "intelligently", "handles", "stringifying", "strings", "lists", "and", "other", "iterables", ".", "The", "results", "are", "lexographically", "sorted", "to", "ensure", "generated", "responses", "are", "consistent", "when", "iterables", "such", "as", "Set", "are", "used", "."], "nwo": "ashleysommer/sanic-cors", "score": 0.5617023167608389, "idx": 253352}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L1411-L1429", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "On Windows, returns a list of mapped network drives", "language": "python", "parameters": "()", "return_statement": "return drives_list", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "sys", ".", "platform", "!=", "'win32'", ":", "raise", "NotImplementedError", "arg_0", "=", "[", "]", "arg_1", "=", "_CallWindowsNetCommand", "(", "[", "'use'", "]", ")", "for", "arg_2", "in", "arg_1", ".", "split", "(", "EOL_STYLE_WINDOWS", ")", ":", "arg_3", "=", "re", ".", "match", "(", "\"(\\w*)\\s+(\\w:)\\s+(.+)\"", ",", "arg_2", ".", "rstrip", "(", ")", ")", "if", "arg_3", ":", "arg_0", ".", "append", "(", "(", "arg_3", ".", "group", "(", "2", ")", ",", "arg_3", ".", "group", "(", "3", ")", ",", "arg_3", ".", "group", "(", "1", ")", "==", "'OK'", ")", ")", "return", "arg_0"], "function": "def Func():\n    '''\n    On Windows, returns a list of mapped network drives\n\n    :return: tuple(string, string, bool)\n        For each mapped netword drive, return 3 values tuple:\n            - the local drive\n            - the remote path-\n            - True if the mapping is enabled (warning: not reliable)\n    '''\n    if sys.platform != 'win32':\n        raise NotImplementedError\n    arg_0 = []\n    arg_1 = _CallWindowsNetCommand(['use'])\n    for arg_2 in arg_1.split(EOL_STYLE_WINDOWS):\n        arg_3 = re.match(\"(\\w*)\\s+(\\w:)\\s+(.+)\", arg_2.rstrip())\n        if arg_3:\n            arg_0.append((arg_3.group(2), arg_3.group(3), arg_3.group(1) == 'OK'))\n    return arg_0", "path": "zerotk/easyfs/_easyfs.py", "identifier": "ListMappedNetworkDrives", "docstring": "On Windows, returns a list of mapped network drives\n\n    :return: tuple(string, string, bool)\n        For each mapped netword drive, return 3 values tuple:\n            - the local drive\n            - the remote path-\n            - True if the mapping is enabled (warning: not reliable)", "docstring_tokens": ["On", "Windows", "returns", "a", "list", "of", "mapped", "network", "drives"], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 253353}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L464-L474", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Get the items contained in `self`.", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", ".", "xpath_ctxt", ".", "xpathEval", "(", "\"d:item\"", ")", "if", "arg_2", "is", "not", "None", ":", "for", "arg_3", "in", "arg_2", ":", "arg_1", ".", "append", "(", "DiscoItem", "(", "arg_0", ",", "arg_3", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Get the items contained in `self`.\n\n        :return: the items contained.\n        :returntype: `list` of `DiscoItem`\"\"\"\n        arg_1=[]\n        arg_2=arg_0.xpath_ctxt.xpathEval(\"d:item\")\n        if arg_2 is not None:\n            for arg_3 in arg_2:\n                arg_1.append(DiscoItem(arg_0, arg_3))\n        return arg_1", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoItems.get_items", "docstring": "Get the items contained in `self`.\n\n        :return: the items contained.\n        :returntype: `list` of `DiscoItem`", "docstring_tokens": ["Get", "the", "items", "contained", "in", "self", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253354}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_anomaly_classifier_region.py#L589-L598", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "This method takes a list of labels and returns a unique category number.\n    This enables this class to store a list of categories for each point since\n    the KNN classifier only stores a single number category for each record.", "language": "python", "parameters": "(self, labelList)", "return_statement": "return categoryNumber", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "for", "arg_3", "in", "arg_1", ":", "arg_2", "+=", "arg_0", ".", "_labelToCategoryNumber", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This method takes a list of labels and returns a unique category number.\n    This enables this class to store a list of categories for each point since\n    the KNN classifier only stores a single number category for each record.\n    \"\"\"\n    arg_2 = 0\n    for arg_3 in arg_1:\n      arg_2 += arg_0._labelToCategoryNumber(arg_3)\n    return arg_2", "path": "src/nupic/regions/knn_anomaly_classifier_region.py", "identifier": "KNNAnomalyClassifierRegion._labelListToCategoryNumber", "docstring": "This method takes a list of labels and returns a unique category number.\n    This enables this class to store a list of categories for each point since\n    the KNN classifier only stores a single number category for each record.", "docstring_tokens": ["This", "method", "takes", "a", "list", "of", "labels", "and", "returns", "a", "unique", "category", "number", ".", "This", "enables", "this", "class", "to", "store", "a", "list", "of", "categories", "for", "each", "point", "since", "the", "KNN", "classifier", "only", "stores", "a", "single", "number", "category", "for", "each", "record", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253355}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/parser.py#L432-L443", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Fetch the location of the form in the original filename from the\n    input form, if it has metadata.", "language": "python", "parameters": "(form: Union[LispForm, ISeq])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", "]", ")", "->", "Optional", "[", "Tuple", "[", "int", ",", "int", "]", "]", ":", "try", ":", "arg_4", "=", "arg_0", ".", "meta", "arg_5", "=", "arg_4", ".", "get", "(", "reader", ".", "READER_LINE_KW", ")", "arg_6", "=", "arg_4", ".", "get", "(", "reader", ".", "READER_COL_KW", ")", "except", "AttributeError", ":", "return", "None", "else", ":", "assert", "isinstance", "(", "arg_5", ",", "int", ")", "and", "isinstance", "(", "arg_6", ",", "int", ")", "return", "arg_5", ",", "arg_6"], "function": "def Func(arg_0: arg_1[arg_2, arg_3]) -> Optional[Tuple[int, int]]:\n    \"\"\"Fetch the location of the form in the original filename from the\n    input form, if it has metadata.\"\"\"\n    try:\n        arg_4 = arg_0.meta  # type: ignore\n        arg_5 = arg_4.get(reader.READER_LINE_KW)  # type: ignore\n        arg_6 = arg_4.get(reader.READER_COL_KW)  # type: ignore\n    except AttributeError:\n        return None\n    else:\n        assert isinstance(arg_5, int) and isinstance(arg_6, int)\n        return arg_5, arg_6", "path": "src/basilisp/lang/compiler/parser.py", "identifier": "_loc", "docstring": "Fetch the location of the form in the original filename from the\n    input form, if it has metadata.", "docstring_tokens": ["Fetch", "the", "location", "of", "the", "form", "in", "the", "original", "filename", "from", "the", "input", "form", "if", "it", "has", "metadata", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 253356}
{"url": "https://github.com/evonove/django-stored-messages/blob/23b71f952d5d3fd03285f5e700879d05796ef7ba/stored_messages/api.py#L61-L69", "sha": "23b71f952d5d3fd03285f5e700879d05796ef7ba", "docstring_summary": "Mark all message instances for a user as read.", "language": "python", "parameters": "(user)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "stored_messages_settings", ".", "STORAGE_BACKEND", "arg_2", "=", "arg_1", "(", ")", "arg_2", ".", "inbox_purge", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Mark all message instances for a user as read.\n\n    :param user: user instance for the recipient\n    \"\"\"\n    arg_1 = stored_messages_settings.STORAGE_BACKEND\n    arg_2 = arg_1()\n    arg_2.inbox_purge(arg_0)", "path": "stored_messages/api.py", "identifier": "mark_all_read", "docstring": "Mark all message instances for a user as read.\n\n    :param user: user instance for the recipient", "docstring_tokens": ["Mark", "all", "message", "instances", "for", "a", "user", "as", "read", "."], "nwo": "evonove/django-stored-messages", "score": 0.18816089823412419, "idx": 253357}
{"url": "https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L155-L182", "sha": "d97414a05541f48231381f607d1d2e6b50781d39", "docstring_summary": "Consume reader and return Success only on complete consumption.", "language": "python", "parameters": "(parser: Parser[Input, Output], reader: Reader[Input])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", "]", ",", "arg_4", ":", "arg_5", "[", "arg_2", "]", ")", "->", "Result", "[", "arg_3", "]", ":", "arg_6", "=", "(", "arg_0", "<<", "eof", ")", ".", "consume", "(", "arg_4", ")", "if", "isinstance", "(", "arg_6", ",", "Continue", ")", ":", "return", "Success", "(", "arg_6", ".", "value", ")", "else", ":", "arg_7", "=", "set", "(", ")", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_6", ".", "expected", ":", "arg_10", "=", "arg_9", "(", ")", "if", "arg_10", "not", "in", "arg_7", ":", "arg_7", ".", "add", "(", "arg_10", ")", "arg_8", ".", "append", "(", "arg_10", ")", "return", "Failure", "(", "arg_6", ".", "farthest", ".", "expected_error", "(", "' or '", ".", "join", "(", "arg_8", ")", ")", ")"], "function": "def Func(arg_0: arg_1[arg_2, arg_3], arg_4: arg_5[arg_2]) -> Result[arg_3]:\n    \"\"\"Consume reader and return Success only on complete consumption.\n\n    This is a helper function for ``parse`` methods, which return ``Success``\n    when the input is completely consumed and ``Failure`` with an appropriate\n    message otherwise.\n\n    Args:\n        parser: The parser doing the consuming\n        reader: The input being consumed\n\n    Returns:\n        A parsing ``Result``\n    \"\"\"\n    arg_6 = (arg_0 << eof).consume(arg_4)\n\n    if isinstance(arg_6, Continue):\n        return Success(arg_6.value)\n    else:\n        arg_7 = set()\n        arg_8 = []\n        for arg_9 in arg_6.expected:\n            arg_10 = arg_9()\n            if arg_10 not in arg_7:\n                arg_7.add(arg_10)\n                arg_8.append(arg_10)\n\n        return Failure(arg_6.farthest.expected_error(' or '.join(arg_8)))", "path": "parsita/parsers.py", "identifier": "completely_parse_reader", "docstring": "Consume reader and return Success only on complete consumption.\n\n    This is a helper function for ``parse`` methods, which return ``Success``\n    when the input is completely consumed and ``Failure`` with an appropriate\n    message otherwise.\n\n    Args:\n        parser: The parser doing the consuming\n        reader: The input being consumed\n\n    Returns:\n        A parsing ``Result``", "docstring_tokens": ["Consume", "reader", "and", "return", "Success", "only", "on", "complete", "consumption", "."], "nwo": "drhagen/parsita", "score": 0.2757871243566705, "idx": 253358}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L89-L117", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Binarizes the values of x.", "language": "python", "parameters": "(x, values, threshold=None, included_in='upper')", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'upper'", ")", ":", "arg_4", ",", "arg_5", "=", "arg_1", "if", "arg_2", "is", "None", ":", "arg_2", "=", "(", "arg_4", "+", "arg_5", ")", "/", "2.", "arg_0", "=", "arg_0", ".", "copy", "(", ")", "if", "arg_3", "==", "'lower'", ":", "arg_0", "[", "arg_0", "<=", "arg_2", "]", "=", "arg_4", "arg_0", "[", "arg_0", ">", "arg_2", "]", "=", "arg_5", "elif", "arg_3", "==", "'upper'", ":", "arg_0", "[", "arg_0", "<", "arg_2", "]", "=", "arg_4", "arg_0", "[", "arg_0", ">=", "arg_2", "]", "=", "arg_5", "else", ":", "raise", "ValueError", "(", "'included_in must be \"lower\" or \"upper\"'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3='upper'):\n    \"\"\"Binarizes the values of x.\n\n    Parameters\n    ----------\n    values : tuple of two floats\n        The lower and upper value to which the inputs are mapped.\n    threshold : float\n        The threshold; defaults to (values[0] + values[1]) / 2 if None.\n    included_in : str\n        Whether the threshold value itself belongs to the lower or\n        upper interval.\n\n    \"\"\"\n    arg_4, arg_5 = arg_1\n\n    if arg_2 is None:\n        arg_2 = (arg_4 + arg_5) / 2.\n\n    arg_0 = arg_0.copy()\n    if arg_3 == 'lower':\n        arg_0[arg_0 <= arg_2] = arg_4\n        arg_0[arg_0 > arg_2] = arg_5\n    elif arg_3 == 'upper':\n        arg_0[arg_0 < arg_2] = arg_4\n        arg_0[arg_0 >= arg_2] = arg_5\n    else:\n        raise ValueError('included_in must be \"lower\" or \"upper\"')\n    return arg_0", "path": "foolbox/utils.py", "identifier": "binarize", "docstring": "Binarizes the values of x.\n\n    Parameters\n    ----------\n    values : tuple of two floats\n        The lower and upper value to which the inputs are mapped.\n    threshold : float\n        The threshold; defaults to (values[0] + values[1]) / 2 if None.\n    included_in : str\n        Whether the threshold value itself belongs to the lower or\n        upper interval.", "docstring_tokens": ["Binarizes", "the", "values", "of", "x", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 253359}
{"url": "https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/update.py#L152-L162", "sha": "d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd", "docstring_summary": "Given two templates and their respective versions, return True if a new cookiecutter\n    config needs to be obtained from the user", "language": "python", "parameters": "(old_template, old_version, new_template, new_version)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", "!=", "arg_2", ":", "return", "True", "else", ":", "return", "_cookiecutter_configs_have_changed", "(", "arg_2", ",", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Given two templates and their respective versions, return True if a new cookiecutter\n    config needs to be obtained from the user\n    \"\"\"\n    if arg_0 != arg_2:\n        return True\n    else:\n        return _cookiecutter_configs_have_changed(arg_2,\n                                                  arg_1,\n                                                  arg_3)", "path": "temple/update.py", "identifier": "_needs_new_cc_config_for_update", "docstring": "Given two templates and their respective versions, return True if a new cookiecutter\n    config needs to be obtained from the user", "docstring_tokens": ["Given", "two", "templates", "and", "their", "respective", "versions", "return", "True", "if", "a", "new", "cookiecutter", "config", "needs", "to", "be", "obtained", "from", "the", "user"], "nwo": "CloverHealth/temple", "score": 0.39091779717332914, "idx": 253360}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/models/immutable.py#L121-L141", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Serialize data to an frozen tuple.", "language": "python", "parameters": "(cls, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_1", ",", "\"__hash__\"", ")", "and", "callable", "(", "arg_1", ".", "__hash__", ")", ":", "return", "arg_1", "elif", "isinstance", "(", "arg_1", ",", "list", ")", ":", "return", "tuple", "(", "(", "arg_0", ".", "Func", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", ")", ")", "elif", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_3", "=", "[", "(", "key", ",", "arg_0", ".", "Func", "(", "value", ")", ")", "for", "key", ",", "value", "in", "arg_1", ".", "items", "(", ")", "]", "arg_3", ".", "sort", "(", ")", "return", "tuple", "(", "arg_3", ")", "else", ":", "raise", "TypeError", "(", "\"Unable to freeze {} data type.\"", ".", "format", "(", "type", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Serialize data to an frozen tuple.\"\"\"\n        if hasattr(arg_1, \"__hash__\") and callable(arg_1.__hash__):\n            # If the data is already hashable (should be immutable) return it\n            return arg_1\n        elif isinstance(arg_1, list):\n            # Freeze the elements of the list and return as a tuple\n            return tuple((arg_0.Func(arg_2) for arg_2 in arg_1))\n        elif isinstance(arg_1, dict):\n            # Freeze the elements of the dictionary, sort them, and return\n            # them as a list of tuples\n            arg_3 = [\n                (key, arg_0.Func(value))\n                for key, value in arg_1.items()\n            ]\n            arg_3.sort()\n            return tuple(arg_3)\n        else:\n            raise TypeError(\n                \"Unable to freeze {} data type.\".format(type(arg_1))\n            )", "path": "webexteamssdk/models/immutable.py", "identifier": "ImmutableData._serialize", "docstring": "Serialize data to an frozen tuple.", "docstring_tokens": ["Serialize", "data", "to", "an", "frozen", "tuple", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 253361}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muccore.py#L742-L753", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "If `self` is a MUC room join request return the information contained.", "language": "python", "parameters": "(self)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_muc_child", "(", ")", "if", "not", "arg_1", ":", "return", "None", "if", "not", "isinstance", "(", "arg_1", ",", "MucX", ")", ":", "return", "None", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"If `self` is a MUC room join request return the information contained.\n\n        :return: the join request details or `None`.\n        :returntype: `MucX`\n        \"\"\"\n        arg_1=arg_0.get_muc_child()\n        if not arg_1:\n            return None\n        if not isinstance(arg_1,MucX):\n            return None\n        return arg_1", "path": "pyxmpp2/ext/muc/muccore.py", "identifier": "MucPresence.get_join_info", "docstring": "If `self` is a MUC room join request return the information contained.\n\n        :return: the join request details or `None`.\n        :returntype: `MucX`", "docstring_tokens": ["If", "self", "is", "a", "MUC", "room", "join", "request", "return", "the", "information", "contained", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253362}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L648-L652", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Put I2C lines into idle state.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_ft232h", ".", "setup_pins", "(", "{", "0", ":", "GPIO", ".", "OUT", ",", "1", ":", "GPIO", ".", "OUT", ",", "2", ":", "GPIO", ".", "IN", "}", ",", "{", "0", ":", "GPIO", ".", "HIGH", ",", "1", ":", "GPIO", ".", "HIGH", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"Put I2C lines into idle state.\"\"\"\n        # Put the I2C lines into an idle state with SCL and SDA high.\n        arg_0._ft232h.setup_pins({0: GPIO.OUT, 1: GPIO.OUT, 2: GPIO.IN},\n                                {0: GPIO.HIGH, 1: GPIO.HIGH})", "path": "Adafruit_GPIO/FT232H.py", "identifier": "I2CDevice._idle", "docstring": "Put I2C lines into idle state.", "docstring_tokens": ["Put", "I2C", "lines", "into", "idle", "state", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 253363}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/net.py#L25-L45", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Fetch the hostname using the callable from the config or using\n    `socket.getfqdn` as a fallback.", "language": "python", "parameters": "()", "return_statement": "return callable()", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "arg_0", "=", "conf", ".", "get", "(", "'core'", ",", "'hostname_callable'", ")", "except", "AirflowConfigException", ":", "arg_0", "=", "None", "if", "not", "arg_0", ":", "return", "socket", ".", "getfqdn", "(", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "split", "(", "':'", ")", "arg_3", "=", "importlib", ".", "import_module", "(", "arg_1", ")", "arg_4", "=", "getattr", "(", "arg_3", ",", "arg_2", ")", "return", "arg_4", "(", ")"], "function": "def Func():\n    \"\"\"\n    Fetch the hostname using the callable from the config or using\n    `socket.getfqdn` as a fallback.\n    \"\"\"\n    # First we attempt to fetch the callable path from the config.\n    try:\n        arg_0 = conf.get('core', 'hostname_callable')\n    except AirflowConfigException:\n        arg_0 = None\n\n    # Then we handle the case when the config is missing or empty. This is the\n    # default behavior.\n    if not arg_0:\n        return socket.getfqdn()\n\n    # Since we have a callable path, we try to import and run it next.\n    arg_1, arg_2 = arg_0.split(':')\n    arg_3 = importlib.import_module(arg_1)\n    arg_4 = getattr(arg_3, arg_2)\n    return arg_4()", "path": "airflow/utils/net.py", "identifier": "get_hostname", "docstring": "Fetch the hostname using the callable from the config or using\n    `socket.getfqdn` as a fallback.", "docstring_tokens": ["Fetch", "the", "hostname", "using", "the", "callable", "from", "the", "config", "or", "using", "socket", ".", "getfqdn", "as", "a", "fallback", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253364}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L186-L216", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Setup frequency axis", "language": "python", "parameters": "(self, f_start=None, f_stop=None)", "return_statement": "return i_start, i_stop, chan_start_idx, chan_stop_idx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "header", "[", "b'fch1'", "]", "arg_4", "=", "arg_0", ".", "header", "[", "b'foff'", "]", "arg_5", ",", "arg_6", "=", "0", ",", "arg_0", ".", "header", "[", "b'nchans'", "]", "if", "arg_1", ":", "arg_5", "=", "int", "(", "(", "arg_1", "-", "arg_3", ")", "/", "arg_4", ")", "if", "arg_2", ":", "arg_6", "=", "int", "(", "(", "arg_2", "-", "arg_3", ")", "/", "arg_4", ")", "arg_7", "=", "np", ".", "int", "(", "arg_5", ")", "arg_8", "=", "np", ".", "int", "(", "arg_6", ")", "if", "arg_5", "<", "arg_6", ":", "arg_9", "=", "np", ".", "arange", "(", "arg_7", ",", "arg_8", ")", "else", ":", "arg_9", "=", "np", ".", "arange", "(", "arg_8", ",", "arg_7", ")", "arg_0", ".", "freqs", "=", "arg_4", "*", "arg_9", "+", "arg_3", "if", "arg_8", "<", "arg_7", ":", "arg_8", ",", "arg_7", "=", "arg_7", ",", "arg_8", "return", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\" Setup frequency axis \"\"\"\n        ## Setup frequency axis\n        arg_3 = arg_0.header[b'fch1']\n        arg_4 = arg_0.header[b'foff']\n\n        arg_5, arg_6 = 0, arg_0.header[b'nchans']\n        if arg_1:\n            arg_5 = int((arg_1 - arg_3) / arg_4)\n        if arg_2:\n            arg_6  = int((arg_2 - arg_3)  / arg_4)\n\n        #calculate closest true index value\n        arg_7 = np.int(arg_5)\n        arg_8  = np.int(arg_6)\n\n        #create freq array\n        if arg_5 < arg_6:\n            arg_9 = np.arange(arg_7, arg_8)\n        else:\n            arg_9 = np.arange(arg_8, arg_7)\n\n        arg_0.freqs = arg_4 * arg_9 + arg_3\n\n#         if f_delt < 0:\n#             self.freqs = self.freqs[::-1]\n\n        if arg_8 < arg_7:\n            arg_8, arg_7 = arg_7,arg_8\n\n        return arg_5, arg_6, arg_7, arg_8", "path": "blimpy/filterbank.py", "identifier": "Filterbank._setup_freqs", "docstring": "Setup frequency axis", "docstring_tokens": ["Setup", "frequency", "axis"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 253365}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py#L235-L255", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "The base handler for the ``display_data`` message.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"display: %s\"", ",", "arg_1", ".", "get", "(", "'content'", ",", "''", ")", ")", "if", "not", "arg_0", ".", "_hidden", "and", "arg_0", ".", "_is_from_this_session", "(", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'content'", "]", "[", "'source'", "]", "arg_3", "=", "arg_1", "[", "'content'", "]", "[", "'data'", "]", "arg_4", "=", "arg_1", "[", "'content'", "]", "[", "'metadata'", "]", "if", "arg_3", ".", "has_key", "(", "'text/html'", ")", ":", "arg_5", "=", "arg_3", "[", "'text/html'", "]", "arg_0", ".", "_append_html", "(", "arg_5", ",", "True", ")", "elif", "arg_3", ".", "has_key", "(", "'text/plain'", ")", ":", "arg_6", "=", "arg_3", "[", "'text/plain'", "]", "arg_0", ".", "_append_plain_text", "(", "arg_6", ",", "True", ")", "arg_0", ".", "_append_plain_text", "(", "u'\\n'", ",", "True", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" The base handler for the ``display_data`` message.\n        \"\"\"\n        arg_0.log.debug(\"display: %s\", arg_1.get('content', ''))\n        # For now, we don't display data from other frontends, but we\n        # eventually will as this allows all frontends to monitor the display\n        # data. But we need to figure out how to handle this in the GUI.\n        if not arg_0._hidden and arg_0._is_from_this_session(arg_1):\n            arg_2 = arg_1['content']['source']\n            arg_3 = arg_1['content']['data']\n            arg_4 = arg_1['content']['metadata']\n            # In the regular IPythonWidget, we simply print the plain text\n            # representation.\n            if arg_3.has_key('text/html'):\n                arg_5 = arg_3['text/html']\n                arg_0._append_html(arg_5, True)\n            elif arg_3.has_key('text/plain'):\n                arg_6 = arg_3['text/plain']\n                arg_0._append_plain_text(arg_6, True)\n            # This newline seems to be needed for text and html output.\n            arg_0._append_plain_text(u'\\n', True)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py", "identifier": "IPythonWidget._handle_display_data", "docstring": "The base handler for the ``display_data`` message.", "docstring_tokens": ["The", "base", "handler", "for", "the", "display_data", "message", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253366}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/task_runner/cgroup_task_runner.py#L90-L109", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Delete the specified cgroup.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "trees", ".", "Tree", "(", ")", ".", "root", "arg_3", "=", "arg_1", ".", "split", "(", "\"/\"", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "{", "x", ".", "name", ":", "x", "for", "x", "in", "arg_2", ".", "children", "}", "if", "arg_4", "not", "in", "arg_5", ":", "arg_0", ".", "log", ".", "warning", "(", "\"Cgroup does not exist: %s\"", ",", "arg_1", ")", "return", "else", ":", "arg_2", "=", "arg_5", "[", "arg_4", "]", "arg_6", "=", "arg_2", ".", "parent", "arg_0", ".", "log", ".", "debug", "(", "\"Deleting cgroup %s/%s\"", ",", "arg_6", ",", "arg_2", ".", "name", ")", "arg_6", ".", "delete_cgroup", "(", "arg_2", ".", "name", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Delete the specified cgroup.\n\n        :param path: The path of the cgroup to delete.\n        E.g. cpu/mygroup/mysubgroup\n        \"\"\"\n        arg_2 = trees.Tree().root\n        arg_3 = arg_1.split(\"/\")\n        for arg_4 in arg_3:\n            arg_5 = {x.name: x for x in arg_2.children}\n            if arg_4 not in arg_5:\n                arg_0.log.warning(\"Cgroup does not exist: %s\", arg_1)\n                return\n            else:\n                arg_2 = arg_5[arg_4]\n        # node is now the leaf node\n        arg_6 = arg_2.parent\n        arg_0.log.debug(\"Deleting cgroup %s/%s\", arg_6, arg_2.name)\n        arg_6.delete_cgroup(arg_2.name)", "path": "airflow/contrib/task_runner/cgroup_task_runner.py", "identifier": "CgroupTaskRunner._delete_cgroup", "docstring": "Delete the specified cgroup.\n\n        :param path: The path of the cgroup to delete.\n        E.g. cpu/mygroup/mysubgroup", "docstring_tokens": ["Delete", "the", "specified", "cgroup", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253367}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L68-L79", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Build a filter that fails on nodes in the given list.", "language": "python", "parameters": "(nodes: Iterable[BaseEntity])", "return_statement": "return exclusion_filter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ")", "->", "NodePredicate", ":", "arg_3", "=", "set", "(", "arg_0", ")", "def", "exclusion_filter", "(", "arg_4", ":", "arg_5", ",", "arg_6", ":", "arg_2", ")", "->", "bool", ":", "return", "arg_6", "not", "in", "arg_3", "return", "exclusion_filter"], "function": "def Func(arg_0: arg_1[arg_2]) -> NodePredicate:\n    \"\"\"Build a filter that fails on nodes in the given list.\"\"\"\n    arg_3 = set(arg_0)\n\n    def exclusion_filter(arg_4: arg_5, arg_6: arg_2) -> bool:\n        \"\"\"Pass only for a node that isn't in the enclosed node list\n\n        :return: If the node isn't contained within the enclosed node list\n        \"\"\"\n        return arg_6 not in arg_3\n\n    return exclusion_filter", "path": "src/pybel_tools/filters/node_filters.py", "identifier": "node_exclusion_filter_builder", "docstring": "Build a filter that fails on nodes in the given list.", "docstring_tokens": ["Build", "a", "filter", "that", "fails", "on", "nodes", "in", "the", "given", "list", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253368}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L366-L374", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val is equal to one of the given items.", "language": "python", "parameters": "(self, *items)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more args must be given'", ")", "else", ":", "for", "arg_2", "in", "arg_1", ":", "if", "arg_0", ".", "val", "==", "arg_2", ":", "return", "arg_0", "arg_0", ".", "_err", "(", "'Expected <%s> to be in %s, but was not.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Asserts that val is equal to one of the given items.\"\"\"\n        if len(arg_1) == 0:\n            raise ValueError('one or more args must be given')\n        else:\n            for arg_2 in arg_1:\n                if arg_0.val == arg_2:\n                    return arg_0\n        arg_0._err('Expected <%s> to be in %s, but was not.' % (arg_0.val, arg_0._fmt_items(arg_1)))", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.is_in", "docstring": "Asserts that val is equal to one of the given items.", "docstring_tokens": ["Asserts", "that", "val", "is", "equal", "to", "one", "of", "the", "given", "items", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 253369}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L415-L453", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return Heronian mean.", "language": "python", "parameters": "(nums)", "return_statement": "return rolling_sum * 2 / (mag * (mag + 1))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "len", "(", "arg_0", ")", "arg_2", "=", "0", "for", "arg_3", "in", "range", "(", "arg_1", ")", ":", "for", "arg_4", "in", "range", "(", "arg_3", ",", "arg_1", ")", ":", "if", "arg_0", "[", "arg_3", "]", "==", "arg_0", "[", "arg_4", "]", ":", "arg_2", "+=", "arg_0", "[", "arg_3", "]", "else", ":", "arg_2", "+=", "(", "arg_0", "[", "arg_3", "]", "*", "arg_0", "[", "arg_4", "]", ")", "**", "0.5", "return", "arg_2", "*", "2", "/", "(", "arg_1", "*", "(", "arg_1", "+", "1", ")", ")"], "function": "def Func(arg_0):\n    r\"\"\"Return Heronian mean.\n\n    The Heronian mean is:\n    :math:`\\frac{\\sum\\limits_{i, j}\\sqrt{{x_i \\cdot x_j}}}\n    {|nums| \\cdot \\frac{|nums| + 1}{2}}`\n    for :math:`j \\ge i`\n\n    Cf. https://en.wikipedia.org/wiki/Heronian_mean\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    float\n        The Heronian mean of nums\n\n    Examples\n    --------\n    >>> Func([1, 2, 3, 4])\n    2.3888282852609093\n    >>> Func([1, 2])\n    1.4714045207910316\n    >>> Func([0, 5, 1000])\n    179.28511301977582\n\n    \"\"\"\n    arg_1 = len(arg_0)\n    arg_2 = 0\n    for arg_3 in range(arg_1):\n        for arg_4 in range(arg_3, arg_1):\n            if arg_0[arg_3] == arg_0[arg_4]:\n                arg_2 += arg_0[arg_3]\n            else:\n                arg_2 += (arg_0[arg_3] * arg_0[arg_4]) ** 0.5\n    return arg_2 * 2 / (arg_1 * (arg_1 + 1))", "path": "abydos/stats/_mean.py", "identifier": "heronian_mean", "docstring": "r\"\"\"Return Heronian mean.\n\n    The Heronian mean is:\n    :math:`\\frac{\\sum\\limits_{i, j}\\sqrt{{x_i \\cdot x_j}}}\n    {|nums| \\cdot \\frac{|nums| + 1}{2}}`\n    for :math:`j \\ge i`\n\n    Cf. https://en.wikipedia.org/wiki/Heronian_mean\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    float\n        The Heronian mean of nums\n\n    Examples\n    --------\n    >>> heronian_mean([1, 2, 3, 4])\n    2.3888282852609093\n    >>> heronian_mean([1, 2])\n    1.4714045207910316\n    >>> heronian_mean([0, 5, 1000])\n    179.28511301977582", "docstring_tokens": ["r", "Return", "Heronian", "mean", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253370}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2680-L2707", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds a link to an existing node.", "language": "python", "parameters": "(self, name_or_item, full_name_or_item=None)", "return_statement": "return self._nn_interface._add_generic(self, type_name=LINK,\n                                               group_type_name=GROUP, args=(name, instance),\n                                               kwargs={},\n                                               add_prefix=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_3", "=", "arg_1", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_4", "=", "arg_0", ".", "v_root", ".", "f_get", "(", "arg_2", ")", "else", ":", "arg_4", "=", "arg_2", "else", ":", "arg_4", "=", "arg_1", "arg_3", "=", "arg_4", ".", "v_name", "return", "arg_0", ".", "_nn_interface", ".", "_add_generic", "(", "arg_0", ",", "type_name", "=", "LINK", ",", "group_type_name", "=", "GROUP", ",", "args", "=", "(", "arg_3", ",", "arg_4", ")", ",", "kwargs", "=", "{", "}", ",", "add_prefix", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Adds a link to an existing node.\n\n        Can be called as ``node.Func(other_node)`` this will add a link the `other_node`\n        with the link name as the name of the node.\n\n        Or can be called as ``node.Func(name, other_node)`` to add a link to the\n        `other_node` and the given `name` of the link.\n\n        In contrast to addition of groups and leaves,  colon separated names\n        are **not** allowed, i.e. ``node.Func('mygroup.mylink', other_node)``\n        does not work.\n\n        \"\"\"\n        if isinstance(arg_1, str):\n            arg_3 = arg_1\n            if isinstance(arg_2, str):\n                arg_4 = arg_0.v_root.f_get(arg_2)\n            else:\n                arg_4 =  arg_2\n        else:\n            arg_4 = arg_1\n            arg_3 = arg_4.v_name\n\n        return arg_0._nn_interface._add_generic(arg_0, type_name=LINK,\n                                               group_type_name=GROUP, args=(arg_3, arg_4),\n                                               kwargs={},\n                                               add_prefix=False)", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_add_link", "docstring": "Adds a link to an existing node.\n\n        Can be called as ``node.f_add_link(other_node)`` this will add a link the `other_node`\n        with the link name as the name of the node.\n\n        Or can be called as ``node.f_add_link(name, other_node)`` to add a link to the\n        `other_node` and the given `name` of the link.\n\n        In contrast to addition of groups and leaves,  colon separated names\n        are **not** allowed, i.e. ``node.f_add_link('mygroup.mylink', other_node)``\n        does not work.", "docstring_tokens": ["Adds", "a", "link", "to", "an", "existing", "node", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253371}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L59-L86", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Calculates the cross-entropy for a batch of logits.", "language": "python", "parameters": "(label, logits)", "return_statement": "return ces", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", ".", "ndim", "==", "2", "arg_1", "=", "arg_1", "-", "np", ".", "max", "(", "arg_1", ",", "axis", "=", "1", ",", "keepdims", "=", "True", ")", "arg_2", "=", "np", ".", "exp", "(", "arg_1", ")", "arg_3", "=", "np", ".", "sum", "(", "arg_2", ",", "axis", "=", "1", ")", "arg_4", "=", "np", ".", "log", "(", "arg_3", ")", "-", "arg_1", "[", ":", ",", "arg_0", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Calculates the cross-entropy for a batch of logits.\n\n    Parameters\n    ----------\n    logits : array_like\n        The logits predicted by the model for a batch of inputs.\n    label : int\n        The label describing the target distribution.\n\n    Returns\n    -------\n    np.ndarray\n        The cross-entropy between softmax(logits[i]) and onehot(label)\n        for all i.\n\n    \"\"\"\n\n    assert arg_1.ndim == 2\n\n    # for numerical reasons we subtract the max logit\n    # (mathematically it doesn't matter!)\n    # otherwise exp(logits) might become too large or too small\n    arg_1 = arg_1 - np.max(arg_1, axis=1, keepdims=True)\n    arg_2 = np.exp(arg_1)\n    arg_3 = np.sum(arg_2, axis=1)\n    arg_4 = np.log(arg_3) - arg_1[:, arg_0]\n    return arg_4", "path": "foolbox/utils.py", "identifier": "batch_crossentropy", "docstring": "Calculates the cross-entropy for a batch of logits.\n\n    Parameters\n    ----------\n    logits : array_like\n        The logits predicted by the model for a batch of inputs.\n    label : int\n        The label describing the target distribution.\n\n    Returns\n    -------\n    np.ndarray\n        The cross-entropy between softmax(logits[i]) and onehot(label)\n        for all i.", "docstring_tokens": ["Calculates", "the", "cross", "-", "entropy", "for", "a", "batch", "of", "logits", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 253372}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/forms/forms.py#L101-L121", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Genereates a dictionary representation of the list field. Document\n        should be the document the list_field comes from.", "language": "python", "parameters": "(self, document, list_field, doc_key)", "return_statement": "return list_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "\"_document\"", ":", "arg_1", "}", "if", "isinstance", "(", "arg_2", ".", "field", ",", "EmbeddedDocumentField", ")", ":", "arg_4", ".", "update", "(", "arg_0", ".", "create_document_dictionary", "(", "arg_1", "=", "arg_2", ".", "field", ".", "document_type_obj", ",", "owner_document", "=", "arg_1", ")", ")", "arg_4", ".", "update", "(", "{", "\"_document_field\"", ":", "arg_2", ".", "field", ",", "\"_key\"", ":", "arg_3", ",", "\"_field_type\"", ":", "ListField", ",", "\"_widget\"", ":", "get_widget", "(", "arg_2", ".", "field", ")", ",", "\"_value\"", ":", "getattr", "(", "arg_1", ",", "arg_3", ",", "None", ")", "}", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Genereates a dictionary representation of the list field. Document\n        should be the document the list_field comes from.\n\n        DO NOT CALL DIRECTLY\n        \"\"\"\n        arg_4 = {\"_document\": arg_1}\n\n        if isinstance(arg_2.field, EmbeddedDocumentField):\n            arg_4.update(arg_0.create_document_dictionary(arg_1=arg_2.field.document_type_obj,\n                                                             owner_document=arg_1))\n\n        # Set the list_dict after it may have been updated\n        arg_4.update({\"_document_field\": arg_2.field,\n                          \"_key\": arg_3,\n                          \"_field_type\": ListField,\n                          \"_widget\": get_widget(arg_2.field),\n                          \"_value\": getattr(arg_1, arg_3, None)})\n\n        return arg_4", "path": "mongonaut/forms/forms.py", "identifier": "MongoModelForm.create_list_dict", "docstring": "Genereates a dictionary representation of the list field. Document\n        should be the document the list_field comes from.\n\n        DO NOT CALL DIRECTLY", "docstring_tokens": ["Genereates", "a", "dictionary", "representation", "of", "the", "list", "field", ".", "Document", "should", "be", "the", "document", "the", "list_field", "comes", "from", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 253373}
{"url": "https://github.com/astrofrog/numtraits/blob/d0afadc946e9d81d1d5b6c851530899d6b0e1d7c/numtraits.py#L167-L198", "sha": "d0afadc946e9d81d1d5b6c851530899d6b0e1d7c", "docstring_summary": "Identify whether the user is requesting unit validation against\n    astropy.units, pint, or quantities.", "language": "python", "parameters": "(target_unit)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "HAS_ASTROPY", ":", "from", "astropy", ".", "units", "import", "UnitBase", "if", "isinstance", "(", "arg_0", ",", "UnitBase", ")", ":", "return", "ASTROPY", "if", "HAS_PINT", ":", "from", "pint", ".", "unit", "import", "UnitsContainer", "if", "hasattr", "(", "arg_0", ",", "'dimensionality'", ")", "and", "isinstance", "(", "arg_0", ".", "dimensionality", ",", "UnitsContainer", ")", ":", "return", "PINT", "if", "HAS_QUANTITIES", ":", "from", "quantities", ".", "unitquantity", "import", "IrreducibleUnit", "from", "quantities", "import", "Quantity", "if", "isinstance", "(", "arg_0", ",", "IrreducibleUnit", ")", "or", "isinstance", "(", "arg_0", ",", "Quantity", ")", ":", "return", "QUANTITIES", "raise", "TraitError", "(", "\"Could not identify unit framework for target unit of type {0}\"", ".", "format", "(", "type", "(", "arg_0", ")", ".", "__name__", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Identify whether the user is requesting unit validation against\n    astropy.units, pint, or quantities.\n    \"\"\"\n\n    if HAS_ASTROPY:\n\n        from astropy.units import UnitBase\n\n        if isinstance(arg_0, UnitBase):\n\n            return ASTROPY\n\n    if HAS_PINT:\n\n        from pint.unit import UnitsContainer\n\n        if hasattr(arg_0, 'dimensionality') and isinstance(arg_0.dimensionality, UnitsContainer):\n\n            return PINT\n\n    if HAS_QUANTITIES:\n\n        from quantities.unitquantity import IrreducibleUnit\n        from quantities import Quantity\n\n        if isinstance(arg_0, IrreducibleUnit) or isinstance(arg_0, Quantity):\n\n            return QUANTITIES\n\n    raise TraitError(\"Could not identify unit framework for target unit of type {0}\".format(type(arg_0).__name__))", "path": "numtraits.py", "identifier": "identify_unit_framework", "docstring": "Identify whether the user is requesting unit validation against\n    astropy.units, pint, or quantities.", "docstring_tokens": ["Identify", "whether", "the", "user", "is", "requesting", "unit", "validation", "against", "astropy", ".", "units", "pint", "or", "quantities", "."], "nwo": "astrofrog/numtraits", "score": 0.09252797783733271, "idx": 253374}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/von_mises_fisher.py#L262-L280", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes the log-normalizer of the distribution.", "language": "python", "parameters": "(self)", "return_statement": "return tf.where(self.concentration > 0,\n                    -safe_lognorm,\n                    log_nsphere_surface_area * tf.ones_like(safe_lognorm))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tf", ".", "compat", ".", "dimension_value", "(", "arg_0", ".", "event_shape", "[", "0", "]", ")", "if", "arg_1", "is", "None", ":", "raise", "ValueError", "(", "'vMF _log_normalizer currently only supports '", "'statically known event shape'", ")", "arg_2", "=", "tf", ".", "where", "(", "arg_0", ".", "concentration", ">", "0", ",", "arg_0", ".", "concentration", ",", "tf", ".", "ones_like", "(", "arg_0", ".", "concentration", ")", ")", "arg_3", "=", "(", "(", "arg_1", "/", "2", "-", "1", ")", "*", "tf", ".", "math", ".", "log", "(", "arg_2", ")", "-", "(", "arg_1", "/", "2", ")", "*", "np", ".", "log", "(", "2", "*", "np", ".", "pi", ")", "-", "tf", ".", "math", ".", "log", "(", "_bessel_ive", "(", "arg_1", "/", "2", "-", "1", ",", "arg_2", ")", ")", "-", "tf", ".", "abs", "(", "arg_2", ")", ")", "arg_4", "=", "(", "np", ".", "log", "(", "2.", ")", "+", "(", "arg_1", "/", "2", ")", "*", "np", ".", "log", "(", "np", ".", "pi", ")", "-", "tf", ".", "math", ".", "lgamma", "(", "tf", ".", "cast", "(", "arg_1", "/", "2", ",", "arg_0", ".", "dtype", ")", ")", ")", "return", "tf", ".", "where", "(", "arg_0", ".", "concentration", ">", "0", ",", "-", "arg_3", ",", "arg_4", "*", "tf", ".", "ones_like", "(", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Computes the log-normalizer of the distribution.\"\"\"\n    arg_1 = tf.compat.dimension_value(arg_0.event_shape[0])\n    if arg_1 is None:\n      raise ValueError('vMF _log_normalizer currently only supports '\n                       'statically known event shape')\n    arg_2 = tf.where(arg_0.concentration > 0,\n                         arg_0.concentration,\n                         tf.ones_like(arg_0.concentration))\n    arg_3 = ((arg_1 / 2 - 1) * tf.math.log(arg_2) -\n                    (arg_1 / 2) * np.log(2 * np.pi) -\n                    tf.math.log(_bessel_ive(arg_1 / 2 - 1, arg_2)) -\n                    tf.abs(arg_2))\n    arg_4 = (\n        np.log(2.) + (arg_1 / 2) * np.log(np.pi) -\n        tf.math.lgamma(tf.cast(arg_1 / 2, arg_0.dtype)))\n    return tf.where(arg_0.concentration > 0,\n                    -arg_3,\n                    arg_4 * tf.ones_like(arg_3))", "path": "tensorflow_probability/python/distributions/von_mises_fisher.py", "identifier": "VonMisesFisher._log_normalization", "docstring": "Computes the log-normalizer of the distribution.", "docstring_tokens": ["Computes", "the", "log", "-", "normalizer", "of", "the", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253375}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_base.py#L439-L466", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Cancel operations.", "language": "python", "parameters": "(batch_fn, cancel_fn, ops)", "return_statement": "return canceled_ops, error_messages", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "arg_5", "=", "256", "arg_6", "=", "len", "(", "arg_2", ")", "for", "arg_7", "in", "range", "(", "0", ",", "arg_6", ",", "arg_5", ")", ":", "arg_8", ",", "arg_9", "=", "_Func_batch", "(", "arg_0", ",", "arg_1", ",", "arg_2", "[", "arg_7", ":", "arg_7", "+", "arg_5", "]", ")", "arg_3", ".", "extend", "(", "arg_8", ")", "arg_4", ".", "extend", "(", "arg_9", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Cancel operations.\n\n  Args:\n    batch_fn: API-specific batch function.\n    Func_fn: API-specific Func function.\n    ops: A list of operations to Func.\n\n  Returns:\n    A list of operations Funced and a list of error messages.\n  \"\"\"\n\n  # Canceling many operations one-by-one can be slow.\n  # The Pipelines API doesn't directly support a list of operations to Func,\n  # but the requests can be performed in batch.\n\n  arg_3 = []\n  arg_4 = []\n\n  arg_5 = 256\n  arg_6 = len(arg_2)\n  for arg_7 in range(0, arg_6, arg_5):\n    arg_8, arg_9 = _Func_batch(\n        arg_0, arg_1, arg_2[arg_7:arg_7 + arg_5])\n    arg_3.extend(arg_8)\n    arg_4.extend(arg_9)\n\n  return arg_3, arg_4", "path": "dsub/providers/google_base.py", "identifier": "cancel", "docstring": "Cancel operations.\n\n  Args:\n    batch_fn: API-specific batch function.\n    cancel_fn: API-specific cancel function.\n    ops: A list of operations to cancel.\n\n  Returns:\n    A list of operations canceled and a list of error messages.", "docstring_tokens": ["Cancel", "operations", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 253376}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L42-L67", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Constructor for Linux binary analysis.", "language": "python", "parameters": "(cls, path, argv=None, envp=None, entry_symbol=None, symbolic_files=None, concrete_start='', pure_symbolic=False, stdin_size=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "''", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "**", "arg_9", ")", ":", "if", "arg_8", "is", "None", ":", "arg_8", "=", "consts", ".", "stdin_size", "try", ":", "return", "arg_0", "(", "_make_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", ",", "**", "arg_9", ")", "except", "elftools", ".", "common", ".", "exceptions", ".", "ELFError", ":", "raise", "Exception", "(", "f'Invalid binary: {path}'", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None, arg_6='', arg_7=False, arg_8=None, **arg_9):\n        \"\"\"\n        Constructor for Linux binary analysis.\n\n        :param str path: Path to binary to analyze\n        :param argv: Arguments to provide to the binary\n        :type argv: list[str]\n        :param envp: Environment to provide to the binary\n        :type envp: dict[str, str]\n        :param entry_symbol: Entry symbol to resolve to start execution\n        :type envp: str\n        :param symbolic_files: Filenames to mark as having symbolic input\n        :type symbolic_files: list[str]\n        :param str concrete_start: Concrete stdin to use before symbolic input\n        :param int stdin_size: symbolic stdin size to use\n        :param kwargs: Forwarded to the Manticore constructor\n        :return: Manticore instance, initialized with a Linux State\n        :rtype: Manticore\n        \"\"\"\n        if arg_8 is None:\n            arg_8 = consts.stdin_size\n\n        try:\n            return arg_0(_make_Func(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8), **arg_9)\n        except elftools.common.exceptions.ELFError:\n            raise Exception(f'Invalid binary: {path}')", "path": "manticore/native/manticore.py", "identifier": "Manticore.linux", "docstring": "Constructor for Linux binary analysis.\n\n        :param str path: Path to binary to analyze\n        :param argv: Arguments to provide to the binary\n        :type argv: list[str]\n        :param envp: Environment to provide to the binary\n        :type envp: dict[str, str]\n        :param entry_symbol: Entry symbol to resolve to start execution\n        :type envp: str\n        :param symbolic_files: Filenames to mark as having symbolic input\n        :type symbolic_files: list[str]\n        :param str concrete_start: Concrete stdin to use before symbolic input\n        :param int stdin_size: symbolic stdin size to use\n        :param kwargs: Forwarded to the Manticore constructor\n        :return: Manticore instance, initialized with a Linux State\n        :rtype: Manticore", "docstring_tokens": ["Constructor", "for", "Linux", "binary", "analysis", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253377}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/typeinfo.py#L95-L113", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Convert binary data to type 'type'.", "language": "python", "parameters": "(self, binvalue, type, **kwargs)", "return_statement": "return typeobj.convert_binary(binvalue, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_type_size", "(", "arg_2", ")", "if", "arg_4", ">", "0", "and", "len", "(", "arg_1", ")", "!=", "arg_4", ":", "raise", "ArgumentError", "(", "\"Could not convert type from binary since the data was not the correct size\"", ",", "required_size", "=", "arg_4", ",", "actual_size", "=", "len", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "arg_0", ".", "get_type", "(", "arg_2", ")", "if", "not", "hasattr", "(", "arg_5", ",", "'convert_binary'", ")", ":", "raise", "ArgumentError", "(", "\"Type does not support conversion from binary\"", ",", "arg_2", "=", "arg_2", ")", "return", "arg_5", ".", "convert_binary", "(", "arg_1", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"\n        Convert binary data to type 'type'.\n\n        'type' must have a convert_binary function.  If 'type'\n        supports size checking, the size function is called to ensure\n        that binvalue is the correct size for deserialization\n        \"\"\"\n\n        arg_4 = arg_0.get_type_size(arg_2)\n        if arg_4 > 0 and len(arg_1) != arg_4:\n            raise ArgumentError(\"Could not convert type from binary since the data was not the correct size\", required_size=arg_4, actual_size=len(arg_1), arg_2=arg_2)\n\n        arg_5 = arg_0.get_type(arg_2)\n\n        if not hasattr(arg_5, 'convert_binary'):\n            raise ArgumentError(\"Type does not support conversion from binary\", arg_2=arg_2)\n\n        return arg_5.convert_binary(arg_1, **arg_3)", "path": "typedargs/typeinfo.py", "identifier": "TypeSystem.convert_from_binary", "docstring": "Convert binary data to type 'type'.\n\n        'type' must have a convert_binary function.  If 'type'\n        supports size checking, the size function is called to ensure\n        that binvalue is the correct size for deserialization", "docstring_tokens": ["Convert", "binary", "data", "to", "type", "type", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 253378}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/network.py#L13-L22", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Get the list of network interfaces. Will return all datalinks on SmartOS.", "language": "python", "parameters": "()", "return_statement": "return [line.split(' ')[0] for line in res.splitlines()[1:]]", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "if", "is_file", "(", "'/usr/sbin/dladm'", ")", ":", "arg_0", "=", "run", "(", "'/usr/sbin/dladm show-link'", ")", "else", ":", "arg_0", "=", "sudo", "(", "'/sbin/ifconfig -s'", ")", "return", "[", "arg_1", ".", "split", "(", "' '", ")", "[", "0", "]", "for", "arg_1", "in", "arg_0", ".", "splitlines", "(", ")", "[", "1", ":", "]", "]"], "function": "def Func():\n    \"\"\"\n    Get the list of network Func. Will return all datalinks on SmartOS.\n    \"\"\"\n    with settings(hide('running', 'stdout')):\n        if is_file('/usr/sbin/dladm'):\n            arg_0 = run('/usr/sbin/dladm show-link')\n        else:\n            arg_0 = sudo('/sbin/ifconfig -s')\n    return [arg_1.split(' ')[0] for arg_1 in arg_0.splitlines()[1:]]", "path": "burlap/network.py", "identifier": "interfaces", "docstring": "Get the list of network interfaces. Will return all datalinks on SmartOS.", "docstring_tokens": ["Get", "the", "list", "of", "network", "interfaces", ".", "Will", "return", "all", "datalinks", "on", "SmartOS", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 253379}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/examples/download_vault_folder.py#L6-L56", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Recursively downloads a folder in a vault to a local directory.\n    Only downloads files, not datasets.", "language": "python", "parameters": "(remote_path, local_path, dry_run=False, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "arg_1", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "expanduser", "(", "arg_1", ")", ")", "if", "not", "os", ".", "access", "(", "arg_1", ",", "os", ".", "W_OK", ")", ":", "raise", "Exception", "(", "'Write access to local path ({}) is required'", ".", "format", "(", "arg_1", ")", ")", "arg_4", ",", "arg_5", "=", "solvebio", ".", "Object", ".", "validate_full_path", "(", "arg_0", ")", "arg_6", "=", "solvebio", ".", "Vault", ".", "get_by_full_path", "(", "arg_5", "[", "'vault'", "]", ")", "print", "(", "'Downloading all files from {} to {}'", ".", "format", "(", "arg_4", ",", "arg_1", ")", ")", "if", "arg_5", "[", "'path'", "]", "==", "'/'", ":", "arg_7", "=", "None", "else", ":", "arg_8", "=", "solvebio", ".", "Object", ".", "get_by_full_path", "(", "arg_0", ",", "assert_type", "=", "'folder'", ")", "arg_7", "=", "arg_8", ".", "id", "print", "(", "'Creating local directory structure at: {}'", ".", "format", "(", "arg_1", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "if", "not", "arg_2", ":", "os", ".", "makedirs", "(", "arg_1", ")", "arg_9", "=", "arg_6", ".", "folders", "(", "arg_7", "=", "arg_7", ")", "for", "arg_10", "in", "arg_9", ":", "arg_11", "=", "os", ".", "path", ".", "normpath", "(", "arg_1", "+", "arg_10", ".", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_11", ")", ":", "print", "(", "'Creating folder: {}'", ".", "format", "(", "arg_11", ")", ")", "if", "not", "arg_2", ":", "os", ".", "makedirs", "(", "arg_11", ")", "arg_12", "=", "arg_6", ".", "files", "(", "arg_7", "=", "arg_7", ")", "for", "arg_10", "in", "arg_12", ":", "arg_11", "=", "os", ".", "path", ".", "normpath", "(", "arg_1", "+", "arg_10", ".", "path", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_11", ")", ":", "if", "arg_3", ":", "print", "(", "'Deleting local file (force download): {}'", ".", "format", "(", "arg_11", ")", ")", "if", "not", "arg_2", ":", "os", ".", "remove", "(", "arg_11", ")", "else", ":", "print", "(", "'Skipping file (already exists): {}'", ".", "format", "(", "arg_11", ")", ")", "continue", "print", "(", "'Downloading file: {}'", ".", "format", "(", "arg_11", ")", ")", "if", "not", "arg_2", ":", "arg_10", ".", "download", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False):\n    \"\"\"Recursively downloads a folder in a vault to a local directory.\n    Only downloads files, not datasets.\"\"\"\n\n    arg_1 = os.path.normpath(os.path.expanduser(arg_1))\n    if not os.access(arg_1, os.W_OK):\n        raise Exception(\n            'Write access to local path ({}) is required'\n            .format(arg_1))\n\n    arg_4, arg_5 = solvebio.Object.validate_full_path(arg_0)\n    arg_6 = solvebio.Vault.get_by_full_path(arg_5['vault'])\n    print('Downloading all files from {} to {}'.format(arg_4, arg_1))\n\n    if arg_5['path'] == '/':\n        arg_7 = None\n    else:\n        arg_8 = solvebio.Object.get_by_full_path(\n            arg_0, assert_type='folder')\n        arg_7 = arg_8.id\n\n    # Scan the folder for all sub-folders and create them locally\n    print('Creating local directory structure at: {}'.format(arg_1))\n    if not os.path.exists(arg_1):\n        if not arg_2:\n            os.makedirs(arg_1)\n\n    arg_9 = arg_6.folders(arg_7=arg_7)\n    for arg_10 in arg_9:\n        arg_11 = os.path.normpath(arg_1 + arg_10.path)\n        if not os.path.exists(arg_11):\n            print('Creating folder: {}'.format(arg_11))\n            if not arg_2:\n                os.makedirs(arg_11)\n\n    arg_12 = arg_6.files(arg_7=arg_7)\n    for arg_10 in arg_12:\n        arg_11 = os.path.normpath(arg_1 + arg_10.path)\n        if os.path.exists(arg_11):\n            if arg_3:\n                # Delete the local copy\n                print('Deleting local file (force download): {}'.format(arg_11))\n                if not arg_2:\n                    os.remove(arg_11)\n            else:\n                print('Skipping file (already exists): {}'.format(arg_11))\n                continue\n\n        print('Downloading file: {}'.format(arg_11))\n        if not arg_2:\n            arg_10.download(arg_11)", "path": "examples/download_vault_folder.py", "identifier": "download_vault_folder", "docstring": "Recursively downloads a folder in a vault to a local directory.\n    Only downloads files, not datasets.", "docstring_tokens": ["Recursively", "downloads", "a", "folder", "in", "a", "vault", "to", "a", "local", "directory", ".", "Only", "downloads", "files", "not", "datasets", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 253380}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/baseapi.py#L36-L73", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Iterate over all pages for the given url. Feed in the result of self._build_path as the url.", "language": "python", "parameters": "(self, url, **queryparams)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "'fields'", "in", "arg_2", ":", "if", "'total_items'", "not", "in", "arg_2", "[", "'fields'", "]", ".", "split", "(", "','", ")", ":", "arg_2", "[", "'fields'", "]", "+=", "',total_items'", "arg_2", ".", "pop", "(", "\"offset\"", ",", "None", ")", "arg_2", ".", "pop", "(", "\"count\"", ",", "None", ")", "arg_3", "=", "arg_0", ".", "_mc_client", ".", "_get", "(", "arg_1", "=", "arg_1", ",", "arg_5", "=", "0", ",", "count", "=", "1000", ",", "**", "arg_2", ")", "arg_4", "=", "arg_3", "[", "'total_items'", "]", "if", "arg_4", ">", "1000", ":", "for", "arg_5", "in", "range", "(", "1", ",", "int", "(", "arg_4", "/", "1000", ")", "+", "1", ")", ":", "arg_3", "=", "merge_results", "(", "arg_3", ",", "arg_0", ".", "_mc_client", ".", "_get", "(", "arg_1", "=", "arg_1", ",", "arg_5", "=", "int", "(", "arg_5", "*", "1000", ")", ",", "count", "=", "1000", ",", "**", "arg_2", ")", ")", "return", "arg_3", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Iterate over all pages for the given url. Feed in the result of self._build_path as the url.\n\n        :param url: The url of the endpoint\n        :type url: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        # fields as a query string parameter should be a string with\n        # comma-separated substring values to pass along to\n        # self._mc_client._get(). It should also contain total_items whenever\n        # the parameter is employed, which is forced here.\n        if 'fields' in arg_2:\n            if 'total_items' not in arg_2['fields'].split(','):\n                arg_2['fields'] += ',total_items'\n        # Remove offset and count if provided in queryparams\n        # to avoid 'multiple values for keyword argument' TypeError\n        arg_2.pop(\"offset\", None)\n        arg_2.pop(\"count\", None)\n        # Fetch results from mailchimp, up to first 1000\n        arg_3 = arg_0._mc_client._get(arg_1=arg_1, arg_5=0, count=1000, **arg_2)\n        arg_4 = arg_3['total_items']\n        # Fetch further results if necessary\n        if arg_4 > 1000:\n            for arg_5 in range(1, int(arg_4 / 1000) + 1):\n                arg_3 = merge_results(arg_3, arg_0._mc_client._get(\n                    arg_1=arg_1,\n                    arg_5=int(arg_5 * 1000),\n                    count=1000,\n                    **arg_2\n                ))\n            return arg_3\n        else:  # Further results not necessary\n            return arg_3", "path": "mailchimp3/baseapi.py", "identifier": "BaseApi._iterate", "docstring": "Iterate over all pages for the given url. Feed in the result of self._build_path as the url.\n\n        :param url: The url of the endpoint\n        :type url: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer", "docstring_tokens": ["Iterate", "over", "all", "pages", "for", "the", "given", "url", ".", "Feed", "in", "the", "result", "of", "self", ".", "_build_path", "as", "the", "url", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 253381}
{"url": "https://github.com/clab/dynet/blob/21cc62606b74f81bb4b11a9989a6c2bd0caa09c5/python/dynet_viz.py#L681-L691", "sha": "21cc62606b74f81bb4b11a9989a6c2bd0caa09c5", "docstring_summary": "returns the list of states obtained by adding the given inputs\n        to the current state, one by one.", "language": "python", "parameters": "(self, xs)", "return_statement": "return states", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_0", "for", "arg_4", "in", "arg_1", ":", "arg_3", "=", "arg_3", ".", "add_input", "(", "arg_4", ")", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        returns the list of states obtained by adding the given inputs\n        to the current state, one by one.\n        \"\"\"\n        arg_2 = []\n        arg_3 = arg_0\n        for arg_4 in arg_1:\n            arg_3 = arg_3.add_input(arg_4)\n            arg_2.append(arg_3)\n        return arg_2", "path": "python/dynet_viz.py", "identifier": "StackedRNNState.add_inputs", "docstring": "returns the list of states obtained by adding the given inputs\n        to the current state, one by one.", "docstring_tokens": ["returns", "the", "list", "of", "states", "obtained", "by", "adding", "the", "given", "inputs", "to", "the", "current", "state", "one", "by", "one", "."], "nwo": "clab/dynet", "score": 0.9553465422324378, "idx": 253382}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/parser.py#L468-L483", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Traverse the bone hierarchy and create physics joints.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "'root'", "]", "while", "arg_1", ":", "arg_2", "=", "arg_1", ".", "pop", "(", ")", "for", "arg_3", "in", "arg_0", ".", "hierarchy", ".", "get", "(", "arg_2", ",", "(", ")", ")", ":", "arg_1", ".", "append", "(", "arg_3", ")", "if", "arg_2", "not", "in", "arg_0", ".", "bones", ":", "continue", "arg_4", "=", "arg_0", ".", "bones", "[", "arg_2", "]", "arg_5", "=", "[", "b", "for", "b", "in", "arg_0", ".", "bodies", "if", "b", ".", "name", "==", "arg_2", "]", "[", "0", "]", "for", "arg_3", "in", "arg_0", ".", "hierarchy", ".", "get", "(", "arg_2", ",", "(", ")", ")", ":", "arg_6", "=", "arg_0", ".", "bones", "[", "arg_3", "]", "arg_7", "=", "[", "b", "for", "b", "in", "arg_0", ".", "bodies", "if", "b", ".", "name", "==", "arg_3", "]", "[", "0", "]", "arg_8", "=", "(", "''", ",", "'hinge'", ",", "'universal'", ",", "'ball'", ")", "[", "len", "(", "arg_6", ".", "dof", ")", "]", "arg_0", ".", "joints", ".", "append", "(", "arg_0", ".", "world", ".", "join", "(", "arg_8", ",", "arg_5", ",", "arg_7", ")", ")"], "function": "def Func(arg_0):\n        '''Traverse the bone hierarchy and create physics joints.'''\n        arg_1 = ['root']\n        while arg_1:\n            arg_2 = arg_1.pop()\n            for arg_3 in arg_0.hierarchy.get(arg_2, ()):\n                arg_1.append(arg_3)\n            if arg_2 not in arg_0.bones:\n                continue\n            arg_4 = arg_0.bones[arg_2]\n            arg_5 = [b for b in arg_0.bodies if b.name == arg_2][0]\n            for arg_3 in arg_0.hierarchy.get(arg_2, ()):\n                arg_6 = arg_0.bones[arg_3]\n                arg_7 = [b for b in arg_0.bodies if b.name == arg_3][0]\n                arg_8 = ('', 'hinge', 'universal', 'ball')[len(arg_6.dof)]\n                arg_0.joints.append(arg_0.world.join(arg_8, arg_5, arg_7))", "path": "pagoda/parser.py", "identifier": "AsfVisitor.create_joints", "docstring": "Traverse the bone hierarchy and create physics joints.", "docstring_tokens": ["Traverse", "the", "bone", "hierarchy", "and", "create", "physics", "joints", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 253383}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L870-L877", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Return a list of strings formatted as HTML bibliography entries", "language": "python", "parameters": "(self, retrieved)", "return_statement": "return items", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ".", "entries", ":", "arg_2", ".", "append", "(", "arg_3", "[", "\"content\"", "]", "[", "0", "]", "[", "\"value\"", "]", ")", "arg_0", ".", "url_params", "=", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Return a list of strings formatted as HTML bibliography entries\n        \"\"\"\n        arg_2 = []\n        for arg_3 in arg_1.entries:\n            arg_2.append(arg_3[\"content\"][0][\"value\"])\n        arg_0.url_params = None\n        return arg_2", "path": "pyzotero/zotero.py", "identifier": "Zotero._bib_processor", "docstring": "Return a list of strings formatted as HTML bibliography entries", "docstring_tokens": ["Return", "a", "list", "of", "strings", "formatted", "as", "HTML", "bibliography", "entries"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 253384}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/ipp_controller.py#L66-L108", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Start the controller.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "mode", "==", "\"manual\"", ":", "return", "if", "arg_0", ".", "ipython_dir", "!=", "'~/.ipython'", ":", "arg_0", ".", "ipython_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "arg_0", ".", "ipython_dir", ")", ")", "if", "arg_0", ".", "log", ":", "arg_2", "=", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "ipython_dir", ",", "\"{0}.controller.out\"", ".", "format", "(", "arg_0", ".", "profile", ")", ")", ",", "'w'", ")", "arg_3", "=", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "ipython_dir", ",", "\"{0}.controller.err\"", ".", "format", "(", "arg_0", ".", "profile", ")", ")", ",", "'w'", ")", "else", ":", "arg_2", "=", "open", "(", "os", ".", "devnull", ",", "'w'", ")", "arg_3", "=", "open", "(", "os", ".", "devnull", ",", "'w'", ")", "try", ":", "arg_4", "=", "[", "'ipcontroller'", ",", "''", "if", "arg_0", ".", "ipython_dir", "==", "'~/.ipython'", "else", "'--ipython-dir={}'", ".", "format", "(", "arg_0", ".", "ipython_dir", ")", ",", "arg_0", ".", "interfaces", "if", "arg_0", ".", "interfaces", "is", "not", "None", "else", "'--ip=*'", ",", "''", "if", "arg_0", ".", "profile", "==", "'default'", "else", "'--profile={0}'", ".", "format", "(", "arg_0", ".", "profile", ")", ",", "'--reuse'", "if", "arg_0", ".", "reuse", "else", "''", ",", "'--location={}'", ".", "format", "(", "arg_0", ".", "public_ip", ")", "if", "arg_0", ".", "public_ip", "else", "''", ",", "'--port={}'", ".", "format", "(", "arg_0", ".", "port", ")", "if", "arg_0", ".", "port", "is", "not", "None", "else", "''", "]", "if", "arg_0", ".", "port_range", "is", "not", "None", ":", "arg_4", "+=", "[", "'--HubFactory.hb={0},{1}'", ".", "format", "(", "arg_0", ".", "hb_ping", ",", "arg_0", ".", "hb_pong", ")", ",", "'--HubFactory.control={0},{1}'", ".", "format", "(", "arg_0", ".", "control_client", ",", "arg_0", ".", "control_engine", ")", ",", "'--HubFactory.mux={0},{1}'", ".", "format", "(", "arg_0", ".", "mux_client", ",", "arg_0", ".", "mux_engine", ")", ",", "'--HubFactory.task={0},{1}'", ".", "format", "(", "arg_0", ".", "task_client", ",", "arg_0", ".", "task_engine", ")", "]", "logger", ".", "debug", "(", "\"Starting ipcontroller with '{}'\"", ".", "format", "(", "' '", ".", "join", "(", "[", "str", "(", "arg_5", ")", "for", "arg_5", "in", "arg_4", "]", ")", ")", ")", "arg_0", ".", "proc", "=", "subprocess", ".", "Popen", "(", "arg_4", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "preexec_fn", "=", "os", ".", "setsid", ")", "except", "FileNotFoundError", ":", "arg_7", "=", "\"Could not find ipcontroller. Please make sure that ipyparallel is installed and available in your env\"", "logger", ".", "error", "(", "arg_7", ")", "raise", "ControllerError", "(", "arg_7", ")", "except", "Exception", "as", "e", ":", "arg_7", "=", "\"IPPController failed to Func: {0}\"", ".", "format", "(", "e", ")", "logger", ".", "error", "(", "arg_7", ")", "raise", "ControllerError", "(", "arg_7", ")"], "function": "def Func(arg_0):\n        \"\"\"Start the controller.\"\"\"\n\n        if arg_0.mode == \"manual\":\n            return\n\n        if arg_0.ipython_dir != '~/.ipython':\n            arg_0.ipython_dir = os.path.abspath(os.path.expanduser(arg_0.ipython_dir))\n\n        if arg_0.log:\n            arg_2 = open(os.path.join(arg_0.ipython_dir, \"{0}.controller.out\".format(arg_0.profile)), 'w')\n            arg_3 = open(os.path.join(arg_0.ipython_dir, \"{0}.controller.err\".format(arg_0.profile)), 'w')\n        else:\n            arg_2 = open(os.devnull, 'w')\n            arg_3 = open(os.devnull, 'w')\n\n        try:\n            arg_4 = [\n                'ipcontroller',\n                '' if arg_0.ipython_dir == '~/.ipython' else '--ipython-dir={}'.format(arg_0.ipython_dir),\n                arg_0.interfaces if arg_0.interfaces is not None else '--ip=*',\n                '' if arg_0.profile == 'default' else '--profile={0}'.format(arg_0.profile),\n                '--reuse' if arg_0.reuse else '',\n                '--location={}'.format(arg_0.public_ip) if arg_0.public_ip else '',\n                '--port={}'.format(arg_0.port) if arg_0.port is not None else ''\n            ]\n            if arg_0.port_range is not None:\n                arg_4 += [\n                    '--HubFactory.hb={0},{1}'.format(arg_0.hb_ping, arg_0.hb_pong),\n                    '--HubFactory.control={0},{1}'.format(arg_0.control_client, arg_0.control_engine),\n                    '--HubFactory.mux={0},{1}'.format(arg_0.mux_client, arg_0.mux_engine),\n                    '--HubFactory.task={0},{1}'.format(arg_0.task_client, arg_0.task_engine)\n                ]\n            logger.debug(\"Starting ipcontroller with '{}'\".format(' '.join([str(arg_5) for arg_5 in arg_4])))\n            arg_0.proc = subprocess.Popen(arg_4, arg_2=arg_2, arg_3=arg_3, preexec_fn=os.setsid)\n        except FileNotFoundError:\n            arg_7 = \"Could not find ipcontroller. Please make sure that ipyparallel is installed and available in your env\"\n            logger.error(arg_7)\n            raise ControllerError(arg_7)\n        except Exception as e:\n            arg_7 = \"IPPController failed to Func: {0}\".format(e)\n            logger.error(arg_7)\n            raise ControllerError(arg_7)", "path": "parsl/executors/ipp_controller.py", "identifier": "Controller.start", "docstring": "Start the controller.", "docstring_tokens": ["Start", "the", "controller", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 253385}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/dtype_util.py#L114-L120", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns the maximum representable value in this data type.", "language": "python", "parameters": "(dtype)", "return_statement": "return np.finfo(dtype).max if use_finfo else np.iinfo(dtype).max", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "tf", ".", "as_dtype", "(", "arg_0", ")", "if", "hasattr", "(", "arg_0", ",", "'Func'", ")", ":", "return", "arg_0", ".", "Func", "arg_1", "=", "is_floating", "(", "arg_0", ")", "or", "is_complex", "(", "arg_0", ")", "return", "np", ".", "finfo", "(", "arg_0", ")", ".", "Func", "if", "arg_1", "else", "np", ".", "iinfo", "(", "arg_0", ")", ".", "Func"], "function": "def Func(arg_0):  # pylint: disable=redefined-builtin\n  \"\"\"Returns the Funcimum representable value in this data type.\"\"\"\n  arg_0 = tf.as_dtype(arg_0)\n  if hasattr(arg_0, 'Func'):\n    return arg_0.Func\n  arg_1 = is_floating(arg_0) or is_complex(arg_0)\n  return np.finfo(arg_0).Func if arg_1 else np.iinfo(arg_0).Func", "path": "tensorflow_probability/python/internal/dtype_util.py", "identifier": "max", "docstring": "Returns the maximum representable value in this data type.", "docstring_tokens": ["Returns", "the", "maximum", "representable", "value", "in", "this", "data", "type", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253386}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/utils.py#L32-L51", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Returns the smallest delimited version of field_key that\n    is an attribute on document.", "language": "python", "parameters": "(document, field_key)", "return_statement": "return current_key, left_over_key_values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "True", "arg_3", "=", "[", "]", "arg_4", "=", "arg_1", "while", "arg_2", "and", "arg_4", ":", "if", "hasattr", "(", "arg_0", ",", "arg_4", ")", ":", "arg_2", "=", "False", "else", ":", "arg_5", "=", "arg_4", ".", "split", "(", "\"_\"", ")", "arg_3", ".", "append", "(", "arg_5", ".", "pop", "(", ")", ")", "arg_4", "=", "u\"_\"", ".", "join", "(", "arg_5", ")", "arg_3", ".", "reverse", "(", ")", "return", "arg_4", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the smallest delimited version of field_key that\n    is an attribute on document.\n\n    return (key, left_over_array)\n    \"\"\"\n    arg_2 = True\n    arg_3 = []\n    arg_4 = arg_1\n    while arg_2 and arg_4:\n        if hasattr(arg_0, arg_4):\n            arg_2 = False\n        else:\n            arg_5 = arg_4.split(\"_\")\n            arg_3.append(arg_5.pop())\n            arg_4 = u\"_\".join(arg_5)\n\n    arg_3.reverse()\n    return arg_4, arg_3", "path": "mongonaut/utils.py", "identifier": "trim_field_key", "docstring": "Returns the smallest delimited version of field_key that\n    is an attribute on document.\n\n    return (key, left_over_array)", "docstring_tokens": ["Returns", "the", "smallest", "delimited", "version", "of", "field_key", "that", "is", "an", "attribute", "on", "document", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 253387}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/blend.py#L797-L980", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augmenter to alpha-blend two image sources using simplex noise alpha masks.", "language": "python", "parameters": "(first=None, second=None, per_channel=False, size_px_max=(2, 16), upscale_method=None,\n                      iterations=(1, 3), aggregation_method=\"max\", sigmoid=True, sigmoid_thresh=None,\n                      name=None, deterministic=False, random_state=None)", "return_statement": "return AlphaElementwise(\n        factor=noise, first=first, second=second, per_channel=per_channel,\n        name=name, deterministic=deterministic, random_state=random_state\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "(", "2", ",", "16", ")", ",", "arg_4", "=", "None", ",", "arg_5", "=", "(", "1", ",", "3", ")", ",", "arg_6", "=", "\"max\"", ",", "arg_7", "=", "True", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "arg_11", "=", "None", ")", ":", "arg_12", "=", "iap", ".", "Choice", "(", "[", "\"nearest\"", ",", "\"linear\"", ",", "\"cubic\"", "]", ",", "p", "=", "[", "0.05", ",", "0.6", ",", "0.35", "]", ")", "arg_13", "=", "iap", ".", "Normal", "(", "0.0", ",", "5.0", ")", "arg_14", "=", "iap", ".", "SimplexNoise", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", "if", "arg_4", "is", "not", "None", "else", "arg_12", ")", "if", "arg_5", "!=", "1", ":", "arg_14", "=", "iap", ".", "IterativeNoiseAggregator", "(", "arg_14", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "if", "arg_7", "is", "False", "or", "(", "ia", ".", "is_single_number", "(", "arg_7", ")", "and", "arg_7", "<=", "0.01", ")", ":", "arg_14", "=", "iap", ".", "Sigmoid", ".", "create_for_noise", "(", "arg_14", ",", "threshold", "=", "arg_8", "if", "arg_8", "is", "not", "None", "else", "arg_13", ",", "activated", "=", "arg_7", ")", "if", "arg_9", "is", "None", ":", "arg_9", "=", "\"Unnamed%s\"", "%", "(", "ia", ".", "caller_name", "(", ")", ",", ")", "return", "AlphaElementwise", "(", "factor", "=", "arg_14", ",", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=False, arg_3=(2, 16), arg_4=None,\n                      arg_5=(1, 3), arg_6=\"max\", arg_7=True, arg_8=None,\n                      arg_9=None, arg_10=False, arg_11=None):\n    \"\"\"\n    Augmenter to alpha-blend two image sources using simplex noise alpha masks.\n\n    The alpha masks are sampled using a simplex noise method, roughly creating\n    connected blobs of 1s surrounded by 0s. If nearest neighbour upsampling\n    is used, these blobs can be rectangular with sharp edges.\n\n    dtype support::\n\n        See ``imgaug.augmenters.blend.AlphaElementwise``.\n\n    Parameters\n    ----------\n    first : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional\n        Augmenter(s) that make up the first of the two branches.\n\n            * If None, then the input images will be reused as the output\n              of the first branch.\n            * If Augmenter, then that augmenter will be used as the branch.\n            * If iterable of Augmenter, then that iterable will be converted\n              into a Sequential and used as the augmenter.\n\n    second : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional\n        Augmenter(s) that make up the second of the two branches.\n\n            * If None, then the input images will be reused as the output\n              of the second branch.\n            * If Augmenter, then that augmenter will be used as the branch.\n            * If iterable of Augmenter, then that iterable will be converted\n              into a Sequential and used as the augmenter.\n\n    per_channel : bool or float, optional\n        Whether to use the same factor for all channels (False)\n        or to sample a new value for each channel (True).\n        If this value is a float ``p``, then for ``p`` percent of all images\n        `per_channel` will be treated as True, otherwise as False.\n\n    size_px_max : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional\n        The simplex noise is always generated in a low resolution environment.\n        This parameter defines the maximum size of that environment (in\n        pixels). The environment is initialized at the same size as the input\n        image and then downscaled, so that no side exceeds `size_px_max`\n        (aspect ratio is kept).\n\n            * If int, then that number will be used as the size for all\n              iterations.\n            * If tuple of two ints ``(a, b)``, then a value will be sampled\n              per iteration from the discrete range ``[a..b]``.\n            * If a list of ints, then a value will be picked per iteration at\n              random from that list.\n            * If a StochasticParameter, then a value will be sampled from\n              that parameter per iteration.\n\n    upscale_method : None or imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional\n        After generating the noise maps in low resolution environments, they\n        have to be upscaled to the input image size. This parameter controls\n        the upscaling method.\n\n            * If None, then either ``nearest`` or ``linear`` or ``cubic`` is picked.\n              Most weight is put on linear, followed by cubic.\n            * If ia.ALL, then either ``nearest`` or ``linear`` or ``area`` or ``cubic``\n              is picked per iteration (all same probability).\n            * If string, then that value will be used as the method (must be\n              'nearest' or ``linear`` or ``area`` or ``cubic``).\n            * If list of string, then a random value will be picked from that\n              list per iteration.\n            * If StochasticParameter, then a random value will be sampled\n              from that parameter per iteration.\n\n    iterations : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional\n        How often to repeat the simplex noise generation process per image.\n\n            * If int, then that number will be used as the iterations for all\n              images.\n            * If tuple of two ints ``(a, b)``, then a value will be sampled\n              per image from the discrete range ``[a..b]``.\n            * If a list of ints, then a value will be picked per image at\n              random from that list.\n            * If a StochasticParameter, then a value will be sampled from\n              that parameter per image.\n\n    aggregation_method : imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional\n        The noise maps (from each iteration) are combined to one noise map\n        using an aggregation process. This parameter defines the method used\n        for that process. Valid methods are ``min``, ``max`` or ``avg``,\n        where ``min`` combines the noise maps by taking the (elementwise) minimum\n        over all iteration's results, ``max`` the (elementwise) maximum and\n        ``avg`` the (elementwise) average.\n\n            * If imgaug.ALL, then a random value will be picked per image from the\n              valid ones.\n            * If a string, then that value will always be used as the method.\n            * If a list of string, then a random value will be picked from\n              that list per image.\n            * If a StochasticParameter, then a random value will be sampled\n              from that paramter per image.\n\n    sigmoid : bool or number, optional\n        Whether to apply a sigmoid function to the final noise maps, resulting\n        in maps that have more extreme values (close to 0.0 or 1.0).\n\n            * If bool, then a sigmoid will always (True) or never (False) be\n              applied.\n            * If a number ``p`` with ``0<=p<=1``, then a sigmoid will be applied to\n              ``p`` percent of all final noise maps.\n\n    sigmoid_thresh : None or number or tuple of number or imgaug.parameters.StochasticParameter, optional\n        Threshold of the sigmoid, when applied. Thresholds above zero\n        (e.g. 5.0) will move the saddle point towards the right, leading to\n        more values close to 0.0.\n\n            * If None, then ``Normal(0, 5.0)`` will be used.\n            * If number, then that threshold will be used for all images.\n            * If tuple of two numbers ``(a, b)``, then a random value will\n              be sampled per image from the range ``[a, b]``.\n            * If StochasticParameter, then a random value will be sampled from\n              that parameter per image.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = iaa.Func(iaa.EdgeDetect(1.0))\n\n    Detects per image all edges, marks them in a black and white image and\n    then alpha-blends the result with the original image using simplex noise\n    masks.\n\n    >>> aug = iaa.Func(iaa.EdgeDetect(1.0), upscale_method=\"linear\")\n\n    Same as the first example, but uses only (smooth) linear upscaling to\n    scale the simplex noise masks to the final image sizes, i.e. no nearest\n    neighbour upsampling is used, which would result in rectangles with hard\n    edges.\n\n    >>> aug = iaa.Func(iaa.EdgeDetect(1.0), sigmoid_thresh=iap.Normal(10.0, 5.0))\n\n    Same as the first example, but uses a threshold for the sigmoid function\n    that is further to the right. This is more conservative, i.e. the generated\n    noise masks will be mostly black (values around 0.0), which means that\n    most of the original images (parameter/branch `second`) will be kept,\n    rather than using the results of the augmentation (parameter/branch\n    `first`).\n\n    \"\"\"\n    arg_12 = iap.Choice([\"nearest\", \"linear\", \"cubic\"], p=[0.05, 0.6, 0.35])\n    arg_13 = iap.Normal(0.0, 5.0)\n\n    arg_14 = iap.SimplexNoise(\n        arg_3=arg_3,\n        arg_4=arg_4 if arg_4 is not None else arg_12\n    )\n\n    if arg_5 != 1:\n        arg_14 = iap.IterativeNoiseAggregator(\n            arg_14,\n            arg_5=arg_5,\n            arg_6=arg_6\n        )\n\n    if arg_7 is False or (ia.is_single_number(arg_7) and arg_7 <= 0.01):\n        arg_14 = iap.Sigmoid.create_for_noise(\n            arg_14,\n            threshold=arg_8 if arg_8 is not None else arg_13,\n            activated=arg_7\n        )\n\n    if arg_9 is None:\n        arg_9 = \"Unnamed%s\" % (ia.caller_name(),)\n\n    return AlphaElementwise(\n        factor=arg_14, arg_0=arg_0, arg_1=arg_1, arg_2=arg_2,\n        arg_9=arg_9, arg_10=arg_10, arg_11=arg_11\n    )", "path": "imgaug/augmenters/blend.py", "identifier": "SimplexNoiseAlpha", "docstring": "Augmenter to alpha-blend two image sources using simplex noise alpha masks.\n\n    The alpha masks are sampled using a simplex noise method, roughly creating\n    connected blobs of 1s surrounded by 0s. If nearest neighbour upsampling\n    is used, these blobs can be rectangular with sharp edges.\n\n    dtype support::\n\n        See ``imgaug.augmenters.blend.AlphaElementwise``.\n\n    Parameters\n    ----------\n    first : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional\n        Augmenter(s) that make up the first of the two branches.\n\n            * If None, then the input images will be reused as the output\n              of the first branch.\n            * If Augmenter, then that augmenter will be used as the branch.\n            * If iterable of Augmenter, then that iterable will be converted\n              into a Sequential and used as the augmenter.\n\n    second : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional\n        Augmenter(s) that make up the second of the two branches.\n\n            * If None, then the input images will be reused as the output\n              of the second branch.\n            * If Augmenter, then that augmenter will be used as the branch.\n            * If iterable of Augmenter, then that iterable will be converted\n              into a Sequential and used as the augmenter.\n\n    per_channel : bool or float, optional\n        Whether to use the same factor for all channels (False)\n        or to sample a new value for each channel (True).\n        If this value is a float ``p``, then for ``p`` percent of all images\n        `per_channel` will be treated as True, otherwise as False.\n\n    size_px_max : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional\n        The simplex noise is always generated in a low resolution environment.\n        This parameter defines the maximum size of that environment (in\n        pixels). The environment is initialized at the same size as the input\n        image and then downscaled, so that no side exceeds `size_px_max`\n        (aspect ratio is kept).\n\n            * If int, then that number will be used as the size for all\n              iterations.\n            * If tuple of two ints ``(a, b)``, then a value will be sampled\n              per iteration from the discrete range ``[a..b]``.\n            * If a list of ints, then a value will be picked per iteration at\n              random from that list.\n            * If a StochasticParameter, then a value will be sampled from\n              that parameter per iteration.\n\n    upscale_method : None or imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional\n        After generating the noise maps in low resolution environments, they\n        have to be upscaled to the input image size. This parameter controls\n        the upscaling method.\n\n            * If None, then either ``nearest`` or ``linear`` or ``cubic`` is picked.\n              Most weight is put on linear, followed by cubic.\n            * If ia.ALL, then either ``nearest`` or ``linear`` or ``area`` or ``cubic``\n              is picked per iteration (all same probability).\n            * If string, then that value will be used as the method (must be\n              'nearest' or ``linear`` or ``area`` or ``cubic``).\n            * If list of string, then a random value will be picked from that\n              list per iteration.\n            * If StochasticParameter, then a random value will be sampled\n              from that parameter per iteration.\n\n    iterations : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional\n        How often to repeat the simplex noise generation process per image.\n\n            * If int, then that number will be used as the iterations for all\n              images.\n            * If tuple of two ints ``(a, b)``, then a value will be sampled\n              per image from the discrete range ``[a..b]``.\n            * If a list of ints, then a value will be picked per image at\n              random from that list.\n            * If a StochasticParameter, then a value will be sampled from\n              that parameter per image.\n\n    aggregation_method : imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional\n        The noise maps (from each iteration) are combined to one noise map\n        using an aggregation process. This parameter defines the method used\n        for that process. Valid methods are ``min``, ``max`` or ``avg``,\n        where ``min`` combines the noise maps by taking the (elementwise) minimum\n        over all iteration's results, ``max`` the (elementwise) maximum and\n        ``avg`` the (elementwise) average.\n\n            * If imgaug.ALL, then a random value will be picked per image from the\n              valid ones.\n            * If a string, then that value will always be used as the method.\n            * If a list of string, then a random value will be picked from\n              that list per image.\n            * If a StochasticParameter, then a random value will be sampled\n              from that paramter per image.\n\n    sigmoid : bool or number, optional\n        Whether to apply a sigmoid function to the final noise maps, resulting\n        in maps that have more extreme values (close to 0.0 or 1.0).\n\n            * If bool, then a sigmoid will always (True) or never (False) be\n              applied.\n            * If a number ``p`` with ``0<=p<=1``, then a sigmoid will be applied to\n              ``p`` percent of all final noise maps.\n\n    sigmoid_thresh : None or number or tuple of number or imgaug.parameters.StochasticParameter, optional\n        Threshold of the sigmoid, when applied. Thresholds above zero\n        (e.g. 5.0) will move the saddle point towards the right, leading to\n        more values close to 0.0.\n\n            * If None, then ``Normal(0, 5.0)`` will be used.\n            * If number, then that threshold will be used for all images.\n            * If tuple of two numbers ``(a, b)``, then a random value will\n              be sampled per image from the range ``[a, b]``.\n            * If StochasticParameter, then a random value will be sampled from\n              that parameter per image.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = iaa.SimplexNoiseAlpha(iaa.EdgeDetect(1.0))\n\n    Detects per image all edges, marks them in a black and white image and\n    then alpha-blends the result with the original image using simplex noise\n    masks.\n\n    >>> aug = iaa.SimplexNoiseAlpha(iaa.EdgeDetect(1.0), upscale_method=\"linear\")\n\n    Same as the first example, but uses only (smooth) linear upscaling to\n    scale the simplex noise masks to the final image sizes, i.e. no nearest\n    neighbour upsampling is used, which would result in rectangles with hard\n    edges.\n\n    >>> aug = iaa.SimplexNoiseAlpha(iaa.EdgeDetect(1.0), sigmoid_thresh=iap.Normal(10.0, 5.0))\n\n    Same as the first example, but uses a threshold for the sigmoid function\n    that is further to the right. This is more conservative, i.e. the generated\n    noise masks will be mostly black (values around 0.0), which means that\n    most of the original images (parameter/branch `second`) will be kept,\n    rather than using the results of the augmentation (parameter/branch\n    `first`).", "docstring_tokens": ["Augmenter", "to", "alpha", "-", "blend", "two", "image", "sources", "using", "simplex", "noise", "alpha", "masks", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 253388}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/clock_tree.py#L760-L780", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "use previously calculated variation of the rate to estimate\n        the uncertainty in a particular numdate due to rate variation.", "language": "python", "parameters": "(self, node, interval=(0.05, 0.095))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "0.05", ",", "0.095", ")", ")", ":", "if", "hasattr", "(", "arg_1", ",", "\"numdate_rate_variation\"", ")", ":", "from", "scipy", ".", "special", "import", "erfinv", "arg_3", "=", "[", "np", ".", "sqrt", "(", "2.0", ")", "*", "erfinv", "(", "-", "1.0", "+", "2.0", "*", "arg_7", ")", "if", "arg_7", "*", "(", "1.0", "-", "arg_7", ")", "else", "0", "for", "arg_7", "in", "arg_2", "]", "arg_4", ",", "arg_5", ",", "arg_6", "=", "[", "arg_7", "[", "1", "]", "for", "arg_7", "in", "arg_1", ".", "numdate_rate_variation", "]", "return", "np", ".", "array", "(", "[", "arg_5", "+", "arg_7", "*", "np", ".", "abs", "(", "arg_8", "-", "arg_5", ")", "for", "arg_7", ",", "arg_8", "in", "zip", "(", "arg_3", ",", "(", "arg_4", ",", "arg_6", ")", ")", "]", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=(0.05, 0.095)):\n        \"\"\"use previously calculated variation of the rate to estimate\n        the uncertainty in a particular numdate due to rate variation.\n\n        Parameters\n        ----------\n        node : PhyloTree.Clade\n            node for which the confidence interval is to be calculated\n        interval : tuple, optional\n            Array of length two, or tuple, defining the bounds of the confidence interval\n\n        \"\"\"\n        if hasattr(arg_1, \"numdate_rate_variation\"):\n            from scipy.special import erfinv\n            arg_3 = [np.sqrt(2.0)*erfinv(-1.0 + 2.0*arg_7) if arg_7*(1.0-arg_7) else 0\n                    for arg_7 in arg_2]\n            arg_4,arg_5,arg_6 = [arg_7[1] for arg_7 in arg_1.numdate_rate_variation]\n            return np.array([arg_5 + arg_7*np.abs(arg_8-arg_5) for arg_7,arg_8 in zip(arg_3, (arg_4,arg_6))])\n\n        else:\n            return None", "path": "treetime/clock_tree.py", "identifier": "ClockTree.date_uncertainty_due_to_rate", "docstring": "use previously calculated variation of the rate to estimate\n        the uncertainty in a particular numdate due to rate variation.\n\n        Parameters\n        ----------\n        node : PhyloTree.Clade\n            node for which the confidence interval is to be calculated\n        interval : tuple, optional\n            Array of length two, or tuple, defining the bounds of the confidence interval", "docstring_tokens": ["use", "previously", "calculated", "variation", "of", "the", "rate", "to", "estimate", "the", "uncertainty", "in", "a", "particular", "numdate", "due", "to", "rate", "variation", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 253389}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L689-L695", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Unlink path but do not complain if file does not exist.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "os", ".", "unlink", "(", "arg_0", ")", "except", "OSError", "as", "err", ":", "if", "err", ".", "errno", "!=", "errno", ".", "ENOENT", ":", "raise"], "function": "def Func(arg_0):\n    \"\"\"Unlink path but do not complain if file does not exist.\"\"\"\n    try:\n        os.unlink(arg_0)\n    except OSError as err:\n        if err.errno != errno.ENOENT:\n            raise", "path": "gromacs/utilities.py", "identifier": "unlink_f", "docstring": "Unlink path but do not complain if file does not exist.", "docstring_tokens": ["Unlink", "path", "but", "do", "not", "complain", "if", "file", "does", "not", "exist", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 253390}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/kgp.py#L147-L156", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "reset output buffer, re-parse entire source file, and return output\r\n        \r\n        Since parsing involves a good deal of randomness, this is an\r\n        easy way to get new output without having to reload a grammar file\r\n        each time.", "language": "python", "parameters": "(self)", "return_statement": "return self.output()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "reset", "(", ")", "arg_0", ".", "parse", "(", "arg_0", ".", "source", ")", "return", "arg_0", ".", "output", "(", ")"], "function": "def Func(arg_0):\r\n        \"\"\"reset output buffer, re-parse entire source file, and return output\r\n        \r\n        Since parsing involves a good deal of randomness, this is an\r\n        easy way to get new output without having to reload a grammar file\r\n        each time.\r\n        \"\"\"\r\n        arg_0.reset()\r\n        arg_0.parse(arg_0.source)\r\n        return arg_0.output()", "path": "shoebot/kgp.py", "identifier": "KantGenerator.refresh", "docstring": "reset output buffer, re-parse entire source file, and return output\r\n        \r\n        Since parsing involves a good deal of randomness, this is an\r\n        easy way to get new output without having to reload a grammar file\r\n        each time.", "docstring_tokens": ["reset", "output", "buffer", "re", "-", "parse", "entire", "source", "file", "and", "return", "output", "Since", "parsing", "involves", "a", "good", "deal", "of", "randomness", "this", "is", "an", "easy", "way", "to", "get", "new", "output", "without", "having", "to", "reload", "a", "grammar", "file", "each", "time", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253391}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_clef_german_plus.py#L52-L104", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return 'CLEF German stemmer plus' stem.", "language": "python", "parameters": "(self, word)", "return_statement": "return word", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "normalize", "(", "'NFC'", ",", "text_type", "(", "arg_1", ".", "lower", "(", ")", ")", ")", "arg_1", "=", "arg_1", ".", "translate", "(", "arg_0", ".", "_accents", ")", "arg_2", "=", "len", "(", "arg_1", ")", "-", "1", "if", "arg_2", ">", "4", "and", "arg_1", "[", "-", "3", ":", "]", "==", "'ern'", ":", "arg_1", "=", "arg_1", "[", ":", "-", "3", "]", "elif", "arg_2", ">", "3", "and", "arg_1", "[", "-", "2", ":", "]", "in", "{", "'em'", ",", "'en'", ",", "'er'", ",", "'es'", "}", ":", "arg_1", "=", "arg_1", "[", ":", "-", "2", "]", "elif", "arg_2", ">", "2", "and", "(", "arg_1", "[", "-", "1", "]", "==", "'e'", "or", "(", "arg_1", "[", "-", "1", "]", "==", "'s'", "and", "arg_1", "[", "-", "2", "]", "in", "arg_0", ".", "_st_ending", ")", ")", ":", "arg_1", "=", "arg_1", "[", ":", "-", "1", "]", "arg_2", "=", "len", "(", "arg_1", ")", "-", "1", "if", "arg_2", ">", "4", "and", "arg_1", "[", "-", "3", ":", "]", "==", "'est'", ":", "arg_1", "=", "arg_1", "[", ":", "-", "3", "]", "elif", "arg_2", ">", "3", "and", "(", "arg_1", "[", "-", "2", ":", "]", "in", "{", "'er'", ",", "'en'", "}", "or", "(", "arg_1", "[", "-", "2", ":", "]", "==", "'st'", "and", "arg_1", "[", "-", "3", "]", "in", "arg_0", ".", "_st_ending", ")", ")", ":", "arg_1", "=", "arg_1", "[", ":", "-", "2", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return 'CLEF German Funcmer plus' Func.\n\n        Parameters\n        ----------\n        word : str\n            The word to Func\n\n        Returns\n        -------\n        str\n            Word Func\n\n        Examples\n        --------\n        >>> stmr = CLEFGermanPlus()\n        >>> clef_german_plus('lesen')\n        'les'\n        >>> clef_german_plus('graues')\n        'grau'\n        >>> clef_german_plus('buchstabieren')\n        'buchstabi'\n\n        \"\"\"\n        # lowercase, normalize, and compose\n        arg_1 = normalize('NFC', text_type(arg_1.lower()))\n\n        # remove umlauts\n        arg_1 = arg_1.translate(arg_0._accents)\n\n        # Step 1\n        arg_2 = len(arg_1) - 1\n        if arg_2 > 4 and arg_1[-3:] == 'ern':\n            arg_1 = arg_1[:-3]\n        elif arg_2 > 3 and arg_1[-2:] in {'em', 'en', 'er', 'es'}:\n            arg_1 = arg_1[:-2]\n        elif arg_2 > 2 and (\n            arg_1[-1] == 'e'\n            or (arg_1[-1] == 's' and arg_1[-2] in arg_0._st_ending)\n        ):\n            arg_1 = arg_1[:-1]\n\n        # Step 2\n        arg_2 = len(arg_1) - 1\n        if arg_2 > 4 and arg_1[-3:] == 'est':\n            arg_1 = arg_1[:-3]\n        elif arg_2 > 3 and (\n            arg_1[-2:] in {'er', 'en'}\n            or (arg_1[-2:] == 'st' and arg_1[-3] in arg_0._st_ending)\n        ):\n            arg_1 = arg_1[:-2]\n\n        return arg_1", "path": "abydos/stemmer/_clef_german_plus.py", "identifier": "CLEFGermanPlus.stem", "docstring": "Return 'CLEF German stemmer plus' stem.\n\n        Parameters\n        ----------\n        word : str\n            The word to stem\n\n        Returns\n        -------\n        str\n            Word stem\n\n        Examples\n        --------\n        >>> stmr = CLEFGermanPlus()\n        >>> clef_german_plus('lesen')\n        'les'\n        >>> clef_german_plus('graues')\n        'grau'\n        >>> clef_german_plus('buchstabieren')\n        'buchstabi'", "docstring_tokens": ["Return", "CLEF", "German", "stemmer", "plus", "stem", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253392}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L711-L740", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds monitors to the network", "language": "python", "parameters": "(self, traj,  network, network_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_3", "[", "'neurons_e'", "]", "arg_5", "=", "[", "]", "arg_0", ".", "spike_monitor", "=", "SpikeMonitor", "(", "arg_4", ")", "arg_5", ".", "append", "(", "arg_0", ".", "spike_monitor", ")", "arg_0", ".", "V_monitor", "=", "StateMonitor", "(", "arg_4", ",", "'V'", ",", "record", "=", "list", "(", "arg_1", ".", "neuron_records", ")", ")", "arg_5", ".", "append", "(", "arg_0", ".", "V_monitor", ")", "arg_0", ".", "I_syn_e_monitor", "=", "StateMonitor", "(", "arg_4", ",", "'I_syn_e'", ",", "record", "=", "list", "(", "arg_1", ".", "neuron_records", ")", ")", "arg_5", ".", "append", "(", "arg_0", ".", "I_syn_e_monitor", ")", "arg_0", ".", "I_syn_i_monitor", "=", "StateMonitor", "(", "arg_4", ",", "'I_syn_i'", ",", "record", "=", "list", "(", "arg_1", ".", "neuron_records", ")", ")", "arg_5", ".", "append", "(", "arg_0", ".", "I_syn_i_monitor", ")", "arg_2", ".", "add", "(", "*", "arg_5", ")", "arg_3", "[", "'monitors'", "]", "=", "arg_5"], "function": "def Func(arg_0, arg_1,  arg_2, arg_3):\n        \"\"\"Adds monitors to the network\"\"\"\n\n        arg_4 = arg_3['neurons_e']\n\n        arg_5 = []\n\n        # Spiketimes\n        arg_0.spike_monitor = SpikeMonitor(arg_4)\n        arg_5.append(arg_0.spike_monitor)\n\n        # Membrane Potential\n        arg_0.V_monitor = StateMonitor(arg_4,'V',\n                                              record=list(arg_1.neuron_records))\n\n        arg_5.append(arg_0.V_monitor)\n\n        # Exc. syn .Current\n        arg_0.I_syn_e_monitor = StateMonitor(arg_4, 'I_syn_e',\n                                            record=list(arg_1.neuron_records))\n        arg_5.append(arg_0.I_syn_e_monitor)\n\n        # Inh. syn. Current\n        arg_0.I_syn_i_monitor = StateMonitor(arg_4, 'I_syn_i',\n                                            record=list(arg_1.neuron_records))\n        arg_5.append(arg_0.I_syn_i_monitor)\n\n        # Add monitors to network and dictionary\n        arg_2.add(*arg_5)\n        arg_3['monitors'] = arg_5", "path": "examples/example_24_large_scale_brian2_simulation/clusternet.py", "identifier": "CNMonitorAnalysis._add_monitors", "docstring": "Adds monitors to the network", "docstring_tokens": ["Adds", "monitors", "to", "the", "network"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253393}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/dirichlet_multinomial.py#L322-L327", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper to `_covariance` and `_variance` which computes a shared scale.", "language": "python", "parameters": "(self)", "return_statement": "return tf.sqrt((1. + c0 / self.total_count[..., tf.newaxis]) / (1. + c0))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "total_concentration", "[", "...", ",", "tf", ".", "newaxis", "]", "return", "tf", ".", "sqrt", "(", "(", "1.", "+", "arg_1", "/", "arg_0", ".", "total_count", "[", "...", ",", "tf", ".", "newaxis", "]", ")", "/", "(", "1.", "+", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Helper to `_covariance` and `_variance` which computes a shared scale.\"\"\"\n    # Expand back the last dim so the shape of Func matches the\n    # shape of self.concentration.\n    arg_1 = arg_0.total_concentration[..., tf.newaxis]\n    return tf.sqrt((1. + arg_1 / arg_0.total_count[..., tf.newaxis]) / (1. + arg_1))", "path": "tensorflow_probability/python/distributions/dirichlet_multinomial.py", "identifier": "DirichletMultinomial._variance_scale_term", "docstring": "Helper to `_covariance` and `_variance` which computes a shared scale.", "docstring_tokens": ["Helper", "to", "_covariance", "and", "_variance", "which", "computes", "a", "shared", "scale", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253394}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/migrations/__init__.py#L52-L56", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Unset default value for AleaIdField.", "language": "python", "parameters": "(app_name, operation, apps, schema_editor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "get_model", "(", "arg_0", ",", "arg_1", ".", "model_name", ")", "for", "arg_5", "in", "arg_4", ".", "objects", ".", "values_list", "(", "'pk'", ",", "flat", "=", "True", ")", ":", "get_meteor_id", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Unset default value for AleaIdField.\"\"\"\n    arg_4 = arg_2.get_model(arg_0, arg_1.model_name)\n    for arg_5 in arg_4.objects.values_list('pk', flat=True):\n        get_meteor_id(arg_4, arg_5)", "path": "dddp/migrations/__init__.py", "identifier": "set_default_reverse", "docstring": "Unset default value for AleaIdField.", "docstring_tokens": ["Unset", "default", "value", "for", "AleaIdField", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 253395}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L154-L159", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Convert directory path to uri", "language": "python", "parameters": "(self, dirpath)", "return_statement": "return relpath.replace(os.path.sep, '.')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "replace", "(", "arg_0", ".", "root_path", ",", "arg_0", ".", "package_name", ")", "if", "arg_2", ".", "startswith", "(", "os", ".", "path", ".", "sep", ")", ":", "arg_2", "=", "arg_2", "[", "1", ":", "]", "return", "arg_2", ".", "replace", "(", "os", ".", "path", ".", "sep", ",", "'.'", ")"], "function": "def Func(arg_0, arg_1):\n        ''' Convert directory path to uri '''\n        arg_2 = arg_1.replace(arg_0.root_path, arg_0.package_name)\n        if arg_2.startswith(os.path.sep):\n            arg_2 = arg_2[1:]\n        return arg_2.replace(os.path.sep, '.')", "path": "h2o-docs/src/product/sphinxext/apigen.py", "identifier": "ApiDocWriter._path2uri", "docstring": "Convert directory path to uri", "docstring_tokens": ["Convert", "directory", "path", "to", "uri"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253396}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/display.py#L64-L68", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Plotting wrapper for labeled intervals", "language": "python", "parameters": "(annotation, **kwargs)", "return_statement": "return mir_eval.display.labeled_intervals(times, labels, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "to_interval_values", "(", ")", "return", "mir_eval", ".", "display", ".", "labeled_Func", "(", "arg_2", ",", "arg_3", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n    '''Plotting wrapper for labeled Func'''\n    arg_2, arg_3 = arg_0.to_interval_values()\n\n    return mir_eval.display.labeled_Func(arg_2, arg_3, **arg_1)", "path": "jams/display.py", "identifier": "intervals", "docstring": "Plotting wrapper for labeled intervals", "docstring_tokens": ["Plotting", "wrapper", "for", "labeled", "intervals"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253397}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/chem.py#L383-L391", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Determine the assay of self.", "language": "python", "parameters": "(self)", "return_statement": "return [m / masses_sum for m in self.compound_masses]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "sum", "(", "arg_0", ".", "compound_masses", ")", "return", "[", "arg_2", "/", "arg_1", "for", "arg_2", "in", "arg_0", ".", "compound_masses", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Determine the assay of self.\n\n        :returns: [mass fractions] An array containing the assay of self.\n        \"\"\"\n\n        arg_1 = sum(arg_0.compound_masses)\n        return [arg_2 / arg_1 for arg_2 in arg_0.compound_masses]", "path": "auxi/modelling/process/materials/chem.py", "identifier": "MaterialPackage.get_assay", "docstring": "Determine the assay of self.\n\n        :returns: [mass fractions] An array containing the assay of self.", "docstring_tokens": ["Determine", "the", "assay", "of", "self", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 253398}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2142-L2188", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate the integral of a property over temperature\n        with respect to temperature, using a specified method.   Implements the \n        analytical integrals of all available methods except for tabular data,\n        the case of multiple coefficient sets needed to encompass the temperature\n        range of any of the ZABRANSKY methods, and the CSP methods using the\n        vapor phase properties.", "language": "python", "parameters": "(self, T1, T2, method)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", "==", "ZABRANSKY_SPLINE", ":", "return", "arg_0", ".", "Zabransky_spline", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "ZABRANSKY_SPLINE_C", ":", "return", "arg_0", ".", "Zabransky_spline_iso", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "ZABRANSKY_SPLINE_SAT", ":", "return", "arg_0", ".", "Zabransky_spline_sat", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "ZABRANSKY_QUASIPOLYNOMIAL", ":", "return", "arg_0", ".", "Zabransky_quasipolynomial", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "ZABRANSKY_QUASIPOLYNOMIAL_C", ":", "return", "arg_0", ".", "Zabransky_quasipolynomial_iso", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "ZABRANSKY_QUASIPOLYNOMIAL_SAT", ":", "return", "arg_0", ".", "Zabransky_quasipolynomial_sat", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "POLING_CONST", ":", "return", "arg_0", ".", "POLING_constant", "*", "log", "(", "arg_2", "/", "arg_1", ")", "elif", "arg_3", "==", "CRCSTD", ":", "return", "arg_0", ".", "CRCSTD_constant", "*", "log", "(", "arg_2", "/", "arg_1", ")", "elif", "arg_3", "==", "DADGOSTAR_SHAW", ":", "arg_4", "=", "(", "Dadgostar_Shaw_integral_over_T", "(", "arg_2", ",", "arg_0", ".", "similarity_variable", ")", "-", "Dadgostar_Shaw_integral_over_T", "(", "arg_1", ",", "arg_0", ".", "similarity_variable", ")", ")", "return", "property_mass_to_molar", "(", "arg_4", ",", "arg_0", ".", "MW", ")", "elif", "arg_3", "in", "arg_0", ".", "tabular_data", "or", "arg_3", "==", "COOLPROP", "or", "arg_3", "in", "[", "ROWLINSON_POLING", ",", "ROWLINSON_BONDI", "]", ":", "return", "float", "(", "quad", "(", "lambda", "T", ":", "arg_0", ".", "calculate", "(", "T", ",", "arg_3", ")", "/", "T", ",", "arg_1", ",", "arg_2", ")", "[", "0", "]", ")", "else", ":", "raise", "Exception", "(", "'Method not valid'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        r'''Method to calculate the integral of a property over temperature\n        with respect to temperature, using a specified method.   Implements the \n        analytical integrals of all available methods except for tabular data,\n        the case of multiple coefficient sets needed to encompass the temperature\n        range of any of the ZABRANSKY methods, and the CSP methods using the\n        vapor phase properties.\n\n        Parameters\n        ----------\n        T1 : float\n            Lower limit of integration, [K]\n        T2 : float\n            Upper limit of integration, [K]\n        method : str\n            Method for which to find the integral\n\n        Returns\n        -------\n        integral : float\n            Calculated integral of the property over the given range, \n            [`units`]\n        '''\n        if arg_3 == ZABRANSKY_SPLINE:\n            return arg_0.Zabransky_spline.Func(arg_1, arg_2)\n        elif arg_3 == ZABRANSKY_SPLINE_C:\n            return arg_0.Zabransky_spline_iso.Func(arg_1, arg_2)\n        elif arg_3 == ZABRANSKY_SPLINE_SAT:\n            return arg_0.Zabransky_spline_sat.Func(arg_1, arg_2)\n        elif arg_3 == ZABRANSKY_QUASIPOLYNOMIAL:\n            return arg_0.Zabransky_quasipolynomial.Func(arg_1, arg_2)\n        elif arg_3 == ZABRANSKY_QUASIPOLYNOMIAL_C:\n            return arg_0.Zabransky_quasipolynomial_iso.Func(arg_1, arg_2)\n        elif arg_3 == ZABRANSKY_QUASIPOLYNOMIAL_SAT:\n            return arg_0.Zabransky_quasipolynomial_sat.Func(arg_1, arg_2)\n        elif arg_3 == POLING_CONST:\n            return arg_0.POLING_constant*log(arg_2/arg_1)\n        elif arg_3 == CRCSTD:\n            return arg_0.CRCSTD_constant*log(arg_2/arg_1)\n        elif arg_3 == DADGOSTAR_SHAW:\n            arg_4 = (Dadgostar_Shaw_integral_over_T(arg_2, arg_0.similarity_variable)\n                    - Dadgostar_Shaw_integral_over_T(arg_1, arg_0.similarity_variable))\n            return property_mass_to_molar(arg_4, arg_0.MW)\n        elif arg_3 in arg_0.tabular_data or arg_3 == COOLPROP or arg_3 in [ROWLINSON_POLING, ROWLINSON_BONDI]:\n            return float(quad(lambda T: arg_0.calculate(T, arg_3)/T, arg_1, arg_2)[0])\n        else:\n            raise Exception('Method not valid')", "path": "thermo/heat_capacity.py", "identifier": "HeatCapacityLiquid.calculate_integral_over_T", "docstring": "r'''Method to calculate the integral of a property over temperature\n        with respect to temperature, using a specified method.   Implements the \n        analytical integrals of all available methods except for tabular data,\n        the case of multiple coefficient sets needed to encompass the temperature\n        range of any of the ZABRANSKY methods, and the CSP methods using the\n        vapor phase properties.\n\n        Parameters\n        ----------\n        T1 : float\n            Lower limit of integration, [K]\n        T2 : float\n            Upper limit of integration, [K]\n        method : str\n            Method for which to find the integral\n\n        Returns\n        -------\n        integral : float\n            Calculated integral of the property over the given range, \n            [`units`]", "docstring_tokens": ["r", "Method", "to", "calculate", "the", "integral", "of", "a", "property", "over", "temperature", "with", "respect", "to", "temperature", "using", "a", "specified", "method", ".", "Implements", "the", "analytical", "integrals", "of", "all", "available", "methods", "except", "for", "tabular", "data", "the", "case", "of", "multiple", "coefficient", "sets", "needed", "to", "encompass", "the", "temperature", "range", "of", "any", "of", "the", "ZABRANSKY", "methods", "and", "the", "CSP", "methods", "using", "the", "vapor", "phase", "properties", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 253399}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/profiledir.py#L184-L209", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find an existing profile dir by profile name, return its ProfileDir.", "language": "python", "parameters": "(cls, ipython_dir, name=u'default', config=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "u'default'", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "u'profile_'", "+", "arg_2", "arg_5", "=", "[", "os", ".", "getcwdu", "(", ")", ",", "arg_1", "]", "for", "arg_6", "in", "arg_5", ":", "profile_dir", "=", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_4", ")", "if", "os", ".", "path", ".", "isdir", "(", "profile_dir", ")", ":", "return", "arg_0", "(", "location", "=", "profile_dir", ",", "arg_3", "=", "arg_3", ")", "else", ":", "raise", "ProfileDirError", "(", "'Profile directory not found in paths: %s'", "%", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=u'default', arg_3=None):\n        \"\"\"Find an existing profile dir by profile name, return its ProfileDir.\n\n        This searches through a sequence of paths for a profile dir.  If it\n        is not found, a :class:`ProfileDirError` exception will be raised.\n\n        The search path algorithm is:\n        1. ``os.getcwdu()``\n        2. ``ipython_dir``\n\n        Parameters\n        ----------\n        ipython_dir : unicode or str\n            The IPython directory to use.\n        name : unicode or str\n            The name of the profile.  The name of the profile directory\n            will be \"profile_<profile>\".\n        \"\"\"\n        arg_4 = u'profile_' + arg_2\n        arg_5 = [os.getcwdu(), arg_1]\n        for arg_6 in arg_5:\n            profile_dir = os.path.join(arg_6, arg_4)\n            if os.path.isdir(profile_dir):\n                return arg_0(location=profile_dir, arg_3=arg_3)\n        else:\n            raise ProfileDirError('Profile directory not found in paths: %s' % arg_4)", "path": "environment/lib/python2.7/site-packages/IPython/core/profiledir.py", "identifier": "ProfileDir.find_profile_dir_by_name", "docstring": "Find an existing profile dir by profile name, return its ProfileDir.\n\n        This searches through a sequence of paths for a profile dir.  If it\n        is not found, a :class:`ProfileDirError` exception will be raised.\n\n        The search path algorithm is:\n        1. ``os.getcwdu()``\n        2. ``ipython_dir``\n\n        Parameters\n        ----------\n        ipython_dir : unicode or str\n            The IPython directory to use.\n        name : unicode or str\n            The name of the profile.  The name of the profile directory\n            will be \"profile_<profile>\".", "docstring_tokens": ["Find", "an", "existing", "profile", "dir", "by", "profile", "name", "return", "its", "ProfileDir", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253400}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/knn_classifier.py#L349-L393", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "A list of row indices to remove. There are two caveats. First, this is\n    a potentially slow operation. Second, pattern indices will shift if\n    patterns before them are removed.", "language": "python", "parameters": "(self, rowsToRemove)", "return_statement": "return numRemoved", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "numpy", ".", "array", "(", "arg_1", ")", "arg_0", ".", "_categoryList", "=", "numpy", ".", "delete", "(", "numpy", ".", "array", "(", "arg_0", ".", "_categoryList", ")", ",", "arg_2", ")", ".", "tolist", "(", ")", "if", "arg_0", ".", "fixedCapacity", ":", "arg_0", ".", "_categoryRecencyList", "=", "numpy", ".", "delete", "(", "numpy", ".", "array", "(", "arg_0", ".", "_categoryRecencyList", ")", ",", "arg_2", ")", ".", "tolist", "(", ")", "for", "arg_5", "in", "reversed", "(", "arg_1", ")", ":", "arg_0", ".", "_partitionIdList", ".", "pop", "(", "arg_5", ")", "arg_0", ".", "_rebuildPartitionIdMap", "(", "arg_0", ".", "_partitionIdList", ")", "if", "arg_0", ".", "useSparseMemory", ":", "for", "arg_6", "in", "arg_1", "[", ":", ":", "-", "1", "]", ":", "arg_0", ".", "_Memory", ".", "deleteRow", "(", "arg_6", ")", "else", ":", "arg_0", ".", "_M", "=", "numpy", ".", "delete", "(", "arg_0", ".", "_M", ",", "arg_2", ",", "0", ")", "arg_8", "=", "len", "(", "arg_1", ")", "arg_9", "=", "arg_0", ".", "_numPatterns", "-", "arg_8", "if", "arg_0", ".", "useSparseMemory", ":", "if", "arg_0", ".", "_Memory", "is", "not", "None", ":", "assert", "arg_0", ".", "_Memory", ".", "nRows", "(", ")", "==", "arg_9", "else", ":", "assert", "arg_0", ".", "_M", ".", "shape", "[", "0", "]", "==", "arg_9", "assert", "len", "(", "arg_0", ".", "_categoryList", ")", "==", "arg_9", "arg_0", ".", "_numPatterns", "-=", "arg_8", "return", "arg_8"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    A list of row indices to remove. There are two caveats. First, this is\n    a potentially slow operation. Second, pattern indices will shift if\n    patterns before them are removed.\n    \"\"\"\n    # Form a numpy array of row indices to be removed\n    arg_2 = numpy.array(arg_1)\n\n    # Remove categories\n    arg_0._categoryList = numpy.delete(numpy.array(arg_0._categoryList),\n                                      arg_2).tolist()\n\n    if arg_0.fixedCapacity:\n      arg_0._categoryRecencyList = numpy.delete(\n        numpy.array(arg_0._categoryRecencyList), arg_2).tolist()\n\n    # Remove the partition ID, if any for these rows and rebuild the id map.\n    for arg_5 in reversed(arg_1):  # Go backwards\n      # Remove these patterns from partitionList\n      arg_0._partitionIdList.pop(arg_5)\n    arg_0._rebuildPartitionIdMap(arg_0._partitionIdList)\n\n\n    # Remove actual patterns\n    if arg_0.useSparseMemory:\n      # Delete backwards\n      for arg_6 in arg_1[::-1]:\n        arg_0._Memory.deleteRow(arg_6)\n    else:\n      arg_0._M = numpy.delete(arg_0._M, arg_2, 0)\n\n    arg_8 = len(arg_1)\n\n    # Sanity checks\n    arg_9 = arg_0._numPatterns - arg_8\n    if arg_0.useSparseMemory:\n      if arg_0._Memory is not None:\n        assert arg_0._Memory.nRows() == arg_9\n    else:\n      assert arg_0._M.shape[0] == arg_9\n    assert len(arg_0._categoryList) == arg_9\n\n    arg_0._numPatterns -= arg_8\n    return arg_8", "path": "src/nupic/algorithms/knn_classifier.py", "identifier": "KNNClassifier._removeRows", "docstring": "A list of row indices to remove. There are two caveats. First, this is\n    a potentially slow operation. Second, pattern indices will shift if\n    patterns before them are removed.", "docstring_tokens": ["A", "list", "of", "row", "indices", "to", "remove", ".", "There", "are", "two", "caveats", ".", "First", "this", "is", "a", "potentially", "slow", "operation", ".", "Second", "pattern", "indices", "will", "shift", "if", "patterns", "before", "them", "are", "removed", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253401}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L748-L761", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Attempt to detect if a device at this address is present on the I2C\n        bus.  Will send out the device's address for writing and verify an ACK\n        is received.  Returns true if the ACK is received, and false if not.", "language": "python", "parameters": "(self)", "return_statement": "return ((response[0] & 0x01) == 0x00)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_idle", "(", ")", "arg_0", ".", "_transaction_start", "(", ")", "arg_0", ".", "_i2c_start", "(", ")", "arg_0", ".", "_i2c_write_bytes", "(", "[", "arg_0", ".", "_address_byte", "(", "False", ")", "]", ")", "arg_0", ".", "_i2c_stop", "(", ")", "arg_1", "=", "arg_0", ".", "_transaction_end", "(", ")", "if", "len", "(", "arg_1", ")", "!=", "1", ":", "raise", "RuntimeError", "(", "'Expected 1 response byte but received {0} byte(s).'", ".", "format", "(", "len", "(", "arg_1", ")", ")", ")", "return", "(", "(", "arg_1", "[", "0", "]", "&", "0x01", ")", "==", "0x00", ")"], "function": "def Func(arg_0):\n        \"\"\"Attempt to detect if a device at this address is present on the I2C\n        bus.  Will send out the device's address for writing and verify an ACK\n        is received.  Returns true if the ACK is received, and false if not.\n        \"\"\"\n        arg_0._idle()\n        arg_0._transaction_start()\n        arg_0._i2c_start()\n        arg_0._i2c_write_bytes([arg_0._address_byte(False)])\n        arg_0._i2c_stop()\n        arg_1 = arg_0._transaction_end()\n        if len(arg_1) != 1:\n            raise RuntimeError('Expected 1 response byte but received {0} byte(s).'.format(len(arg_1)))\n        return ((arg_1[0] & 0x01) == 0x00)", "path": "Adafruit_GPIO/FT232H.py", "identifier": "I2CDevice.ping", "docstring": "Attempt to detect if a device at this address is present on the I2C\n        bus.  Will send out the device's address for writing and verify an ACK\n        is received.  Returns true if the ACK is received, and false if not.", "docstring_tokens": ["Attempt", "to", "detect", "if", "a", "device", "at", "this", "address", "is", "present", "on", "the", "I2C", "bus", ".", "Will", "send", "out", "the", "device", "s", "address", "for", "writing", "and", "verify", "an", "ACK", "is", "received", ".", "Returns", "true", "if", "the", "ACK", "is", "received", "and", "false", "if", "not", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 253402}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hatlc.py#L456-L479", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This just uncompresses the sqlitecurve. Should be independent of OS.", "language": "python", "parameters": "(sqlitecurve, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "replace", "(", "'.gz'", ",", "''", ")", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", "and", "not", "arg_1", ":", "return", "arg_2", "else", ":", "with", "gzip", ".", "open", "(", "arg_0", ",", "'rb'", ")", "as", "infd", ":", "with", "open", "(", "arg_2", ",", "'wb'", ")", "as", "outfd", ":", "shutil", ".", "copyfileobj", "(", "infd", ",", "outfd", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "return", "arg_2", "except", "Exception", "as", "e", ":", "return", "None"], "function": "def Func(arg_0, arg_1=False):\n    '''This just uncompresses the sqlitecurve. Should be independent of OS.\n\n    '''\n\n    arg_2 = arg_0.replace('.gz','')\n\n    try:\n\n        if os.path.exists(arg_2) and not arg_1:\n            return arg_2\n\n        else:\n\n            with gzip.open(arg_0,'rb') as infd:\n                with open(arg_2,'wb') as outfd:\n                    shutil.copyfileobj(infd, outfd)\n\n            # do not remove the intput file yet\n            if os.path.exists(arg_2):\n                return arg_2\n\n    except Exception as e:\n        return None", "path": "astrobase/hatsurveys/hatlc.py", "identifier": "_pyuncompress_sqlitecurve", "docstring": "This just uncompresses the sqlitecurve. Should be independent of OS.", "docstring_tokens": ["This", "just", "uncompresses", "the", "sqlitecurve", ".", "Should", "be", "independent", "of", "OS", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 253403}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/marathon_util.py#L34-L53", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Get the Marathon networking mode for the app.", "language": "python", "parameters": "(app)", "return_statement": "return 'container' if _is_legacy_ip_per_task(app) else 'host'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get", "(", "'networks'", ")", "if", "arg_1", ":", "return", "arg_1", "[", "-", "1", "]", ".", "get", "(", "'mode'", ",", "'container'", ")", "arg_2", "=", "arg_0", ".", "get", "(", "'container'", ")", "if", "arg_2", "is", "not", "None", "and", "'docker'", "in", "arg_2", ":", "arg_3", "=", "arg_2", "[", "'docker'", "]", ".", "get", "(", "'network'", ")", "if", "arg_3", "==", "'USER'", ":", "return", "'container'", "elif", "arg_3", "==", "'BRIDGE'", ":", "return", "'container/bridge'", "return", "'container'", "if", "_is_legacy_ip_per_task", "(", "arg_0", ")", "else", "'host'"], "function": "def Func(arg_0):\n    \"\"\"\n    Get the Marathon networking mode for the app.\n    \"\"\"\n    # Marathon 1.5+: there is a `networks` field\n    arg_1 = arg_0.get('networks')\n    if arg_1:\n        # Modes cannot be mixed, so assigning the last mode is fine\n        return arg_1[-1].get('mode', 'container')\n\n    # Older Marathon: determine equivalent network mode\n    arg_2 = arg_0.get('container')\n    if arg_2 is not None and 'docker' in arg_2:\n        arg_3 = arg_2['docker'].get('network')\n        if arg_3 == 'USER':\n            return 'container'\n        elif arg_3 == 'BRIDGE':\n            return 'container/bridge'\n\n    return 'container' if _is_legacy_ip_per_task(arg_0) else 'host'", "path": "marathon_acme/marathon_util.py", "identifier": "_get_networking_mode", "docstring": "Get the Marathon networking mode for the app.", "docstring_tokens": ["Get", "the", "Marathon", "networking", "mode", "for", "the", "app", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 253404}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L153-L159", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Return the number of times b occurs in a.", "language": "python", "parameters": "(a, b)", "return_statement": "return count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", "==", "arg_1", ":", "arg_2", "+=", "1", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"Return the number of times b occurs in a.\"\n    arg_2 = 0\n    for arg_3 in arg_0:\n        if arg_3 == arg_1:\n            arg_2 += 1\n    return arg_2", "path": "third_party/ouroboros/operator.py", "identifier": "countOf", "docstring": "Return the number of times b occurs in a.", "docstring_tokens": ["Return", "the", "number", "of", "times", "b", "occurs", "in", "a", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 253405}
{"url": "https://github.com/20tab/twentytab-treeeditor/blob/f89d459b1348961880cd488df95690e68529f96b/treeeditor/admin.py#L363-L374", "sha": "f89d459b1348961880cd488df95690e68529f96b", "docstring_summary": "Implement a lookup for object level permissions. Basically the same as\n        ModelAdmin.has_delete_permission, but also passes the obj parameter in.", "language": "python", "parameters": "(self, request, obj=None)", "return_statement": "return r and super(TreeEditor, self).has_delete_permission(request, obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "settings", ".", "TREE_EDITOR_OBJECT_PERMISSIONS", ":", "arg_3", "=", "arg_0", ".", "opts", "arg_4", "=", "arg_1", ".", "user", ".", "has_perm", "(", "arg_3", ".", "app_label", "+", "'.'", "+", "arg_3", ".", "get_delete_permission", "(", ")", ",", "arg_2", ")", "else", ":", "arg_4", "=", "True", "return", "arg_4", "and", "super", "(", "TreeEditor", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Implement a lookup for object level permissions. Basically the same as\n        ModelAdmin.Func, but also passes the obj parameter in.\n        \"\"\"\n        if settings.TREE_EDITOR_OBJECT_PERMISSIONS:\n            arg_3 = arg_0.opts\n            arg_4 = arg_1.user.has_perm(arg_3.app_label + '.' + arg_3.get_delete_permission(), arg_2)\n        else:\n            arg_4 = True\n\n        return arg_4 and super(TreeEditor, arg_0).Func(arg_1, arg_2)", "path": "treeeditor/admin.py", "identifier": "TreeEditor.has_delete_permission", "docstring": "Implement a lookup for object level permissions. Basically the same as\n        ModelAdmin.has_delete_permission, but also passes the obj parameter in.", "docstring_tokens": ["Implement", "a", "lookup", "for", "object", "level", "permissions", ".", "Basically", "the", "same", "as", "ModelAdmin", ".", "has_delete_permission", "but", "also", "passes", "the", "obj", "parameter", "in", "."], "nwo": "20tab/twentytab-treeeditor", "score": 0.0, "idx": 253406}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L244-L258", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Removes the topology from the local cache.", "language": "python", "parameters": "(self, topology_name, state_manager_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "topologies", ":", "if", "(", "arg_4", ".", "name", "==", "arg_1", "and", "arg_4", ".", "state_manager_name", "==", "arg_2", ")", ":", "if", "(", "arg_1", ",", "arg_2", ")", "in", "arg_0", ".", "topologyInfos", ":", "arg_0", ".", "topologyInfos", ".", "pop", "(", "(", "arg_1", ",", "arg_2", ")", ")", "else", ":", "arg_3", ".", "append", "(", "arg_4", ")", "arg_0", ".", "topologies", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Removes the topology from the local cache.\n    \"\"\"\n    arg_3 = []\n    for arg_4 in arg_0.topologies:\n      if (arg_4.name == arg_1 and\n          arg_4.state_manager_name == arg_2):\n        # Remove topologyInfo\n        if (arg_1, arg_2) in arg_0.topologyInfos:\n          arg_0.topologyInfos.pop((arg_1, arg_2))\n      else:\n        arg_3.append(arg_4)\n\n    arg_0.topologies = arg_3", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "Tracker.removeTopology", "docstring": "Removes the topology from the local cache.", "docstring_tokens": ["Removes", "the", "topology", "from", "the", "local", "cache", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253407}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L52-L71", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Wrapper around json.loads.", "language": "python", "parameters": "(data, name=\"JSON\", exception=PluginError, schema=None)", "return_statement": "return json_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"JSON\"", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "None", ")", ":", "try", ":", "arg_5", "=", "json", ".", "loads", "(", "arg_0", ")", "except", "ValueError", "as", "err", ":", "arg_6", "=", "repr", "(", "arg_0", ")", "if", "len", "(", "arg_6", ")", ">", "35", ":", "arg_6", "=", "arg_6", "[", ":", "35", "]", "+", "\" ...\"", "else", ":", "arg_6", "=", "arg_0", "raise", "arg_2", "(", "\"Unable to parse {0}: {1} ({2})\"", ".", "format", "(", "arg_1", ",", "err", ",", "arg_6", ")", ")", "if", "arg_4", ":", "arg_5", "=", "arg_4", ".", "validate", "(", "arg_5", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=\"JSON\", arg_2=arg_3, arg_4=None):\n    \"\"\"Wrapper around json.loads.\n\n    Wraps errors in custom exception with a snippet of the data in the message.\n    \"\"\"\n    try:\n        arg_5 = json.loads(arg_0)\n    except ValueError as err:\n        arg_6 = repr(arg_0)\n        if len(arg_6) > 35:\n            arg_6 = arg_6[:35] + \" ...\"\n        else:\n            arg_6 = arg_0\n\n        raise arg_2(\"Unable to parse {0}: {1} ({2})\".format(arg_1, err, arg_6))\n\n    if arg_4:\n        arg_5 = arg_4.validate(arg_5, arg_1=arg_1, arg_2=arg_2)\n\n    return arg_5", "path": "src/streamlink/utils/__init__.py", "identifier": "parse_json", "docstring": "Wrapper around json.loads.\n\n    Wraps errors in custom exception with a snippet of the data in the message.", "docstring_tokens": ["Wrapper", "around", "json", ".", "loads", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 253408}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/optim/optimizer.py#L768-L780", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Set train summary. A TrainSummary object contains information\n        necessary for the optimizer to know how often the logs are recorded,\n        where to store the logs and how to retrieve them, etc. For details,\n        refer to the docs of TrainSummary.", "language": "python", "parameters": "(self, summary)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "callBigDlFunc", "(", "arg_0", ".", "bigdl_type", ",", "\"setTrainSummary\"", ",", "arg_0", ".", "value", ",", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set train summary. A TrainSummary object contains information\n        necessary for the optimizer to know how often the logs are recorded,\n        where to store the logs and how to retrieve them, etc. For details,\n        refer to the docs of TrainSummary.\n\n\n        :param summary: a TrainSummary object\n        \"\"\"\n        callBigDlFunc(arg_0.bigdl_type, \"setTrainSummary\", arg_0.value,\n                      arg_1)\n        return arg_0", "path": "pyspark/bigdl/optim/optimizer.py", "identifier": "BaseOptimizer.set_train_summary", "docstring": "Set train summary. A TrainSummary object contains information\n        necessary for the optimizer to know how often the logs are recorded,\n        where to store the logs and how to retrieve them, etc. For details,\n        refer to the docs of TrainSummary.\n\n\n        :param summary: a TrainSummary object", "docstring_tokens": ["Set", "train", "summary", ".", "A", "TrainSummary", "object", "contains", "information", "necessary", "for", "the", "optimizer", "to", "know", "how", "often", "the", "logs", "are", "recorded", "where", "to", "store", "the", "logs", "and", "how", "to", "retrieve", "them", "etc", ".", "For", "details", "refer", "to", "the", "docs", "of", "TrainSummary", "."], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 253409}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/mixture.py#L966-L983", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Dictionary of atomic fractions for each atom in the mixture.", "language": "python", "parameters": "(self)", "return_statement": "return {atom : value/tot for atom, value in things.iteritems()}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", ")", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "arg_0", ".", "zs", ",", "arg_0", ".", "atomss", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "iteritems", "(", ")", ":", "if", "arg_4", "in", "arg_1", ":", "arg_1", "[", "arg_4", "]", "+=", "arg_2", "*", "arg_5", "else", ":", "arg_1", "[", "arg_4", "]", "=", "arg_2", "*", "arg_5", "arg_6", "=", "sum", "(", "arg_1", ".", "values", "(", ")", ")", "return", "{", "arg_4", ":", "arg_7", "/", "arg_6", "for", "arg_4", ",", "arg_7", "in", "arg_1", ".", "iteritems", "(", ")", "}"], "function": "def Func(arg_0):\n        r'''Dictionary of atomic fractions for each atom in the mixture.\n\n        Examples\n        --------\n        >>> Mixture(['CO2', 'O2'], zs=[0.5, 0.5]).Func\n        {'C': 0.2, 'O': 0.8}\n        '''\n        arg_1 = dict()\n        for arg_2, arg_3 in zip(arg_0.zs, arg_0.atomss):\n            for arg_4, arg_5 in arg_3.iteritems():\n                if arg_4 in arg_1:\n                    arg_1[arg_4] += arg_2*arg_5\n                else:\n                    arg_1[arg_4] = arg_2*arg_5\n\n        arg_6 = sum(arg_1.values())\n        return {arg_4 : arg_7/arg_6 for arg_4, arg_7 in arg_1.iteritems()}", "path": "thermo/mixture.py", "identifier": "Mixture.atom_fractions", "docstring": "r'''Dictionary of atomic fractions for each atom in the mixture.\n\n        Examples\n        --------\n        >>> Mixture(['CO2', 'O2'], zs=[0.5, 0.5]).atom_fractions\n        {'C': 0.2, 'O': 0.8}", "docstring_tokens": ["r", "Dictionary", "of", "atomic", "fractions", "for", "each", "atom", "in", "the", "mixture", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 253410}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L695-L730", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Delete all affected samples for a case from MatchMaker", "language": "python", "parameters": "(case_obj, mme_base_url, mme_token)", "return_statement": "return server_responses", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "if", "not", "arg_1", "or", "not", "arg_2", ":", "return", "'Please check that Matchmaker connection parameters are valid'", "for", "arg_4", "in", "arg_0", "[", "'mme_submission'", "]", "[", "'patients'", "]", ":", "arg_5", "=", "arg_4", "[", "'id'", "]", "arg_6", "=", "''", ".", "join", "(", "[", "arg_1", ",", "'/patient/delete/'", ",", "arg_5", "]", ")", "arg_7", "=", "matchmaker_request", "(", "arg_6", "=", "arg_6", ",", "token", "=", "arg_2", ",", "method", "=", "'DELETE'", ",", ")", "arg_3", ".", "append", "(", "{", "'patient_id'", ":", "arg_5", ",", "'message'", ":", "arg_7", ".", "get", "(", "'message'", ")", ",", "'status_code'", ":", "arg_7", ".", "get", "(", "'status_code'", ")", "}", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Delete all affected samples for a case from MatchMaker\n\n    Args:\n        case_obj(dict) a scout case object\n        mme_base_url(str) base url of the MME server\n        mme_token(str) auth token of the MME server\n\n    Returns:\n         server_responses(list): a list of object of this type:\n                    {\n                        'patient_id': patient_id\n                        'message': server_message,\n                        'status_code': server_status_code\n                    }\n    \"\"\"\n    arg_3 = []\n\n    if not arg_1 or not arg_2:\n        return 'Please check that Matchmaker connection parameters are valid'\n\n    # for each patient of the case in matchmaker\n    for arg_4 in arg_0['mme_submission']['patients']:\n\n        # send delete request to server and capture server's response\n        arg_5 = arg_4['id']\n        arg_6 = ''.join([arg_1, '/patient/delete/', arg_5])\n        arg_7 = matchmaker_request(arg_6=arg_6, token=arg_2, method='DELETE', )\n\n        arg_3.append({\n            'patient_id': arg_5,\n            'message': arg_7.get('message'),\n            'status_code': arg_7.get('status_code')\n        })\n\n    return arg_3", "path": "scout/server/blueprints/cases/controllers.py", "identifier": "mme_delete", "docstring": "Delete all affected samples for a case from MatchMaker\n\n    Args:\n        case_obj(dict) a scout case object\n        mme_base_url(str) base url of the MME server\n        mme_token(str) auth token of the MME server\n\n    Returns:\n         server_responses(list): a list of object of this type:\n                    {\n                        'patient_id': patient_id\n                        'message': server_message,\n                        'status_code': server_status_code\n                    }", "docstring_tokens": ["Delete", "all", "affected", "samples", "for", "a", "case", "from", "MatchMaker"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253411}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-common/azure/common/client_factory.py#L186-L244", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Return a SDK client initialized with auth file.", "language": "python", "parameters": "(client_class, auth_path=None, **kwargs)", "return_statement": "return get_client_from_json_dict(client_class, config_dict, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_1", "=", "arg_1", "or", "os", ".", "environ", "[", "'AZURE_AUTH_LOCATION'", "]", "with", "io", ".", "open", "(", "arg_1", ",", "'r'", ",", "encoding", "=", "'utf-8-sig'", ")", "as", "auth_fd", ":", "arg_3", "=", "json", ".", "load", "(", "auth_fd", ")", "return", "get_client_from_json_dict", "(", "arg_0", ",", "arg_3", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"Return a SDK client initialized with auth file.\n\n    The easiest way to obtain this file is to call the following CLI commands:\n\n    .. code:: bash\n\n        az ad sp create-for-rbac --sdk-auth\n\n    You can specific the file path directly, or fill the environment variable AZURE_AUTH_LOCATION.\n    File must be UTF-8.\n\n    This method will fill automatically the following client parameters:\n    - credentials\n    - subscription_id\n    - base_url\n\n    Parameters provided in kwargs will override parameters and be passed directly to the client.\n\n    :Example:\n\n    .. code:: python\n\n        from azure.common.client_factory import Func\n        from azure.mgmt.compute import ComputeManagementClient\n        client = Func(ComputeManagementClient)\n\n    Example of file:\n\n    .. code:: json\n\n        {\n            \"clientId\": \"ad735158-65ca-11e7-ba4d-ecb1d756380e\",\n            \"clientSecret\": \"b70bb224-65ca-11e7-810c-ecb1d756380e\",\n            \"subscriptionId\": \"bfc42d3a-65ca-11e7-95cf-ecb1d756380e\",\n            \"tenantId\": \"c81da1d8-65ca-11e7-b1d1-ecb1d756380e\",\n            \"activeDirectoryEndpointUrl\": \"https://login.microsoftonline.com\",\n            \"resourceManagerEndpointUrl\": \"https://management.azure.com/\",\n            \"activeDirectoryGraphResourceId\": \"https://graph.windows.net/\",\n            \"sqlManagementEndpointUrl\": \"https://management.core.windows.net:8443/\",\n            \"galleryEndpointUrl\": \"https://gallery.azure.com/\",\n            \"managementEndpointUrl\": \"https://management.core.windows.net/\"\n        }\n\n    .. versionadded:: 1.1.7\n\n    :param client_class: A SDK client class\n    :param str auth_path: Path to the file.\n    :return: An instantiated client\n    :raises: KeyError if AZURE_AUTH_LOCATION is not an environment variable and no path is provided\n    :raises: FileNotFoundError if provided file path does not exists\n    :raises: json.JSONDecodeError if provided file is not JSON valid\n    :raises: UnicodeDecodeError if file is not UTF8 compliant\n    \"\"\"\n    arg_1 = arg_1 or os.environ['AZURE_AUTH_LOCATION']\n\n    with io.open(arg_1, 'r', encoding='utf-8-sig') as auth_fd:\n        arg_3 = json.load(auth_fd)\n    return get_client_from_json_dict(arg_0, arg_3, **arg_2)", "path": "azure-common/azure/common/client_factory.py", "identifier": "get_client_from_auth_file", "docstring": "Return a SDK client initialized with auth file.\n\n    The easiest way to obtain this file is to call the following CLI commands:\n\n    .. code:: bash\n\n        az ad sp create-for-rbac --sdk-auth\n\n    You can specific the file path directly, or fill the environment variable AZURE_AUTH_LOCATION.\n    File must be UTF-8.\n\n    This method will fill automatically the following client parameters:\n    - credentials\n    - subscription_id\n    - base_url\n\n    Parameters provided in kwargs will override parameters and be passed directly to the client.\n\n    :Example:\n\n    .. code:: python\n\n        from azure.common.client_factory import get_client_from_auth_file\n        from azure.mgmt.compute import ComputeManagementClient\n        client = get_client_from_auth_file(ComputeManagementClient)\n\n    Example of file:\n\n    .. code:: json\n\n        {\n            \"clientId\": \"ad735158-65ca-11e7-ba4d-ecb1d756380e\",\n            \"clientSecret\": \"b70bb224-65ca-11e7-810c-ecb1d756380e\",\n            \"subscriptionId\": \"bfc42d3a-65ca-11e7-95cf-ecb1d756380e\",\n            \"tenantId\": \"c81da1d8-65ca-11e7-b1d1-ecb1d756380e\",\n            \"activeDirectoryEndpointUrl\": \"https://login.microsoftonline.com\",\n            \"resourceManagerEndpointUrl\": \"https://management.azure.com/\",\n            \"activeDirectoryGraphResourceId\": \"https://graph.windows.net/\",\n            \"sqlManagementEndpointUrl\": \"https://management.core.windows.net:8443/\",\n            \"galleryEndpointUrl\": \"https://gallery.azure.com/\",\n            \"managementEndpointUrl\": \"https://management.core.windows.net/\"\n        }\n\n    .. versionadded:: 1.1.7\n\n    :param client_class: A SDK client class\n    :param str auth_path: Path to the file.\n    :return: An instantiated client\n    :raises: KeyError if AZURE_AUTH_LOCATION is not an environment variable and no path is provided\n    :raises: FileNotFoundError if provided file path does not exists\n    :raises: json.JSONDecodeError if provided file is not JSON valid\n    :raises: UnicodeDecodeError if file is not UTF8 compliant", "docstring_tokens": ["Return", "a", "SDK", "client", "initialized", "with", "auth", "file", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 253412}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/glnames.py#L5171-L5183", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "filter `alist' by taking _out_ all glyph names that are in `filter", "language": "python", "parameters": "( alist, filter )", "return_statement": "return extras", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "try", ":", "arg_5", "=", "arg_1", ".", "index", "(", "arg_4", ")", "except", ":", "arg_3", ".", "append", "(", "arg_4", ")", "return", "arg_3"], "function": "def Func( arg_0, arg_1 ):\n  \"\"\"filter `alist' by taking _out_ all glyph names that are in `filter'\"\"\"\n\n  arg_2  = 0\n  arg_3 = []\n\n  for arg_4 in arg_0:\n    try:\n      arg_5 = arg_1.index( arg_4 )\n    except:\n      arg_3.append( arg_4 )\n\n  return arg_3", "path": "native/Vendor/FreeType/src/tools/glnames.py", "identifier": "filter_glyph_names", "docstring": "filter `alist' by taking _out_ all glyph names that are in `filter", "docstring_tokens": ["filter", "alist", "by", "taking", "_out_", "all", "glyph", "names", "that", "are", "in", "filter"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 253413}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L160-L186", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Convert journal name to Inspire's short form.", "language": "python", "parameters": "(journal, knowledge_base)", "return_statement": "return journal, volume", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ":", "return", "''", ",", "''", "if", "not", "arg_1", ":", "return", "arg_0", ",", "''", "if", "len", "(", "arg_0", ")", "<", "2", ":", "return", "arg_0", ",", "''", "arg_2", "=", "''", "if", "(", "arg_0", "[", "-", "1", "]", "<=", "'Z'", "and", "arg_0", "[", "-", "1", "]", ">=", "'A'", ")", "and", "(", "arg_0", "[", "-", "2", "]", "==", "'.'", "or", "arg_0", "[", "-", "2", "]", "==", "' '", ")", ":", "arg_2", "+=", "arg_0", "[", "-", "1", "]", "arg_0", "=", "arg_0", "[", ":", "-", "1", "]", "arg_0", "=", "arg_0", ".", "strip", "(", ")", "if", "arg_0", ".", "upper", "(", ")", "in", "arg_1", ":", "arg_0", "=", "arg_1", "[", "arg_0", ".", "upper", "(", ")", "]", ".", "strip", "(", ")", "elif", "arg_0", "in", "arg_1", ":", "arg_0", "=", "arg_1", "[", "arg_0", "]", ".", "strip", "(", ")", "elif", "'.'", "in", "arg_0", ":", "arg_3", "=", "arg_0", ".", "replace", "(", "'. '", ",", "' '", ")", "arg_3", "=", "arg_3", ".", "replace", "(", "'.'", ",", "' '", ")", ".", "strip", "(", ")", ".", "upper", "(", ")", "if", "arg_3", "in", "arg_1", ":", "arg_0", "=", "arg_1", "[", "arg_3", "]", ".", "strip", "(", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "'. '", ",", "'.'", ")", "return", "arg_0", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Convert journal name to Inspire's short form.\"\"\"\n    if not arg_0:\n        return '', ''\n    if not arg_1:\n        return arg_0, ''\n    if len(arg_0) < 2:\n        return arg_0, ''\n    arg_2 = ''\n    if (arg_0[-1] <= 'Z' and arg_0[-1] >= 'A') \\\n            and (arg_0[-2] == '.' or arg_0[-2] == ' '):\n        arg_2 += arg_0[-1]\n        arg_0 = arg_0[:-1]\n    arg_0 = arg_0.strip()\n\n    if arg_0.upper() in arg_1:\n        arg_0 = arg_1[arg_0.upper()].strip()\n    elif arg_0 in arg_1:\n        arg_0 = arg_1[arg_0].strip()\n    elif '.' in arg_0:\n        arg_3 = arg_0.replace('. ', ' ')\n        arg_3 = arg_3.replace('.', ' ').strip().upper()\n        if arg_3 in arg_1:\n            arg_0 = arg_1[arg_3].strip()\n\n    arg_0 = arg_0.replace('. ', '.')\n    return arg_0, arg_2", "path": "harvestingkit/utils.py", "identifier": "fix_journal_name", "docstring": "Convert journal name to Inspire's short form.", "docstring_tokens": ["Convert", "journal", "name", "to", "Inspire", "s", "short", "form", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253414}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py#L1574-L1642", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Converts xml response to service bus metrics objects", "language": "python", "parameters": "(xmlstr, object_type)", "return_statement": "return return_obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "minidom", ".", "parseString", "(", "arg_0", ")", "arg_3", "=", "arg_1", "(", ")", "arg_4", "=", "dict", "(", "vars", "(", "arg_3", ")", ")", "for", "arg_5", "in", "_MinidomXmlToObject", ".", "get_children_from_path", "(", "arg_2", ",", "'entry'", ")", ":", "for", "arg_6", "in", "_MinidomXmlToObject", ".", "get_children_from_path", "(", "arg_5", ",", "'content'", ",", "'properties'", ")", ":", "for", "arg_7", "in", "arg_4", ":", "arg_8", "=", "_get_serialization_name", "(", "arg_7", ")", "arg_9", "=", "_MinidomXmlToObject", ".", "get_child_nodes", "(", "arg_6", ",", "arg_8", ")", "if", "not", "arg_9", ":", "continue", "arg_10", "=", "arg_9", "[", "0", "]", "arg_11", "=", "arg_10", ".", "getAttributeNS", "(", "\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"", ",", "'type'", ")", "arg_12", "=", "_ServiceBusManagementXmlSerializer", ".", "odata_converter", "(", "arg_10", ".", "firstChild", ".", "nodeValue", ",", "arg_11", ")", "setattr", "(", "arg_3", ",", "arg_7", ",", "arg_12", ")", "for", "arg_7", ",", "arg_13", "in", "_MinidomXmlToObject", ".", "get_entry_properties_from_node", "(", "arg_5", ",", "include_id", "=", "True", ",", "use_title_as_id", "=", "False", ")", ".", "items", "(", ")", ":", "if", "arg_7", "in", "arg_4", ":", "continue", "setattr", "(", "arg_3", ",", "arg_7", ",", "arg_13", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        '''Converts xml response to service bus metrics objects\n\n        The xml format for MetricProperties\n<entry>\n    <id>https://sbgm.windows.net/Metrics(\\'listeners.active\\')</id>\n    <title/>\n    <updated>2014-10-09T11:56:50Z</updated>\n    <author>\n        <name/>\n    </author>\n    <content type=\"application/xml\">\n        <m:properties>\n            <d:Name>listeners.active</d:Name>\n            <d:PrimaryAggregation>Average</d:PrimaryAggregation>\n            <d:Unit>Count</d:Unit>\n            <d:DisplayName>Active listeners</d:DisplayName>\n        </m:properties>\n    </content>\n</entry>\n\n        The xml format for MetricValues\n    <entry>\n        <id>https://sbgm.windows.net/MetricValues(datetime\\'2014-10-02T00:00:00Z\\')</id>\n        <title/>\n        <updated>2014-10-09T18:38:28Z</updated>\n        <author>\n            <name/>\n        </author>\n        <content type=\"application/xml\">\n            <m:properties>\n                <d:Timestamp m:type=\"Edm.DateTime\">2014-10-02T00:00:00Z</d:Timestamp>\n                <d:Min m:type=\"Edm.Int64\">-118</d:Min>\n                <d:Max m:type=\"Edm.Int64\">15</d:Max>\n                <d:Average m:type=\"Edm.Single\">-78.44444</d:Average>\n                <d:Total m:type=\"Edm.Int64\">0</d:Total>\n            </m:properties>\n        </content>\n    </entry>\n        '''\n\n        arg_2 = minidom.parseString(arg_0)\n        arg_3 = arg_1()\n\n        arg_4 = dict(vars(arg_3))\n\n        # Only one entry here\n        for arg_5 in _MinidomXmlToObject.get_children_from_path(arg_2,\n                                                 'entry'):\n            for arg_6 in _MinidomXmlToObject.get_children_from_path(arg_5,\n                                                'content',\n                                                'properties'):\n                for arg_7 in arg_4:\n                    arg_8 = _get_serialization_name(arg_7)\n                    arg_9 = _MinidomXmlToObject.get_child_nodes(arg_6, arg_8)\n                    if not arg_9:\n                        continue\n                    arg_10 = arg_9[0]\n                    arg_11 = arg_10.getAttributeNS(\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\", 'type')\n                    arg_12 = _ServiceBusManagementXmlSerializer.odata_converter(arg_10.firstChild.nodeValue, arg_11)\n                    setattr(arg_3, arg_7, arg_12)\n            for arg_7, arg_13 in _MinidomXmlToObject.get_entry_properties_from_node(\n                arg_5,\n                include_id=True,\n                use_title_as_id=False).items():\n                if arg_7 in arg_4:\n                    continue  # Do not override if already members\n                setattr(arg_3, arg_7, arg_13)\n        return arg_3", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py", "identifier": "_ServiceBusManagementXmlSerializer.xml_to_metrics", "docstring": "Converts xml response to service bus metrics objects\n\n        The xml format for MetricProperties\n<entry>\n    <id>https://sbgm.windows.net/Metrics(\\'listeners.active\\')</id>\n    <title/>\n    <updated>2014-10-09T11:56:50Z</updated>\n    <author>\n        <name/>\n    </author>\n    <content type=\"application/xml\">\n        <m:properties>\n            <d:Name>listeners.active</d:Name>\n            <d:PrimaryAggregation>Average</d:PrimaryAggregation>\n            <d:Unit>Count</d:Unit>\n            <d:DisplayName>Active listeners</d:DisplayName>\n        </m:properties>\n    </content>\n</entry>\n\n        The xml format for MetricValues\n    <entry>\n        <id>https://sbgm.windows.net/MetricValues(datetime\\'2014-10-02T00:00:00Z\\')</id>\n        <title/>\n        <updated>2014-10-09T18:38:28Z</updated>\n        <author>\n            <name/>\n        </author>\n        <content type=\"application/xml\">\n            <m:properties>\n                <d:Timestamp m:type=\"Edm.DateTime\">2014-10-02T00:00:00Z</d:Timestamp>\n                <d:Min m:type=\"Edm.Int64\">-118</d:Min>\n                <d:Max m:type=\"Edm.Int64\">15</d:Max>\n                <d:Average m:type=\"Edm.Single\">-78.44444</d:Average>\n                <d:Total m:type=\"Edm.Int64\">0</d:Total>\n            </m:properties>\n        </content>\n    </entry>", "docstring_tokens": ["Converts", "xml", "response", "to", "service", "bus", "metrics", "objects"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 253415}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/consoleapp.py#L272-L308", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "set up ssh tunnels, if needed.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "sshserver", "and", "not", "arg_0", ".", "sshkey", ":", "return", "if", "arg_0", ".", "sshkey", "and", "not", "arg_0", ".", "sshserver", ":", "arg_0", ".", "sshserver", "=", "arg_0", ".", "ip", "arg_0", ".", "ip", "=", "LOCALHOST", "arg_3", "=", "dict", "(", "arg_2", "=", "arg_0", ".", "ip", ",", "arg_5", "=", "arg_0", ".", "shell_port", ",", "arg_6", "=", "arg_0", ".", "iopub_port", ",", "arg_7", "=", "arg_0", ".", "stdin_port", ",", "arg_8", "=", "arg_0", ".", "hb_port", ")", "arg_0", ".", "log", ".", "info", "(", "\"Forwarding connections to %s via %s\"", "%", "(", "arg_0", ".", "ip", ",", "arg_0", ".", "sshserver", ")", ")", "arg_0", ".", "ip", "=", "LOCALHOST", "try", ":", "arg_4", "=", "tunnel_to_kernel", "(", "arg_3", ",", "arg_0", ".", "sshserver", ",", "arg_0", ".", "sshkey", ")", "except", ":", "arg_0", ".", "log", ".", "error", "(", "\"Could not setup tunnels\"", ",", "exc_info", "=", "True", ")", "arg_0", ".", "exit", "(", "1", ")", "arg_0", ".", "shell_port", ",", "arg_0", ".", "iopub_port", ",", "arg_0", ".", "stdin_port", ",", "arg_0", ".", "hb_port", "=", "arg_4", "arg_9", "=", "arg_0", ".", "connection_file", "arg_10", ",", "arg_11", "=", "os", ".", "path", ".", "splitext", "(", "arg_9", ")", "arg_10", "=", "os", ".", "path", ".", "basename", "(", "arg_10", ")", "arg_0", ".", "connection_file", "=", "os", ".", "path", ".", "basename", "(", "arg_10", ")", "+", "'-ssh'", "+", "arg_11", "arg_0", ".", "log", ".", "critical", "(", "\"To connect another client via this tunnel, use:\"", ")", "arg_0", ".", "log", ".", "critical", "(", "\"--existing %s\"", "%", "arg_0", ".", "connection_file", ")"], "function": "def Func(arg_0):\n        \"\"\"set up ssh tunnels, if needed.\"\"\"\n        if not arg_0.sshserver and not arg_0.sshkey:\n            return\n        \n        if arg_0.sshkey and not arg_0.sshserver:\n            # specifying just the key implies that we are connecting directly\n            arg_0.sshserver = arg_0.ip\n            arg_0.ip = LOCALHOST\n        \n        # build connection dict for tunnels:\n        arg_3 = dict(arg_2=arg_0.ip,\n                    arg_5=arg_0.shell_port,\n                    arg_6=arg_0.iopub_port,\n                    arg_7=arg_0.stdin_port,\n                    arg_8=arg_0.hb_port\n        )\n        \n        arg_0.log.info(\"Forwarding connections to %s via %s\"%(arg_0.ip, arg_0.sshserver))\n        \n        # tunnels return a new set of ports, which will be on localhost:\n        arg_0.ip = LOCALHOST\n        try:\n            arg_4 = tunnel_to_kernel(arg_3, arg_0.sshserver, arg_0.sshkey)\n        except:\n            # even catch KeyboardInterrupt\n            arg_0.log.error(\"Could not setup tunnels\", exc_info=True)\n            arg_0.exit(1)\n        \n        arg_0.shell_port, arg_0.iopub_port, arg_0.stdin_port, arg_0.hb_port = arg_4\n        \n        arg_9 = arg_0.connection_file\n        arg_10,arg_11 = os.path.splitext(arg_9)\n        arg_10 = os.path.basename(arg_10)\n        arg_0.connection_file = os.path.basename(arg_10)+'-ssh'+arg_11\n        arg_0.log.critical(\"To connect another client via this tunnel, use:\")\n        arg_0.log.critical(\"--existing %s\" % arg_0.connection_file)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/consoleapp.py", "identifier": "IPythonConsoleApp.init_ssh", "docstring": "set up ssh tunnels, if needed.", "docstring_tokens": ["set", "up", "ssh", "tunnels", "if", "needed", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253416}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/bottlenose/api.py#L168-L179", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "A simplified URL to be used for caching the given query.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return \"http://\" + service_domain + \"/onca/xml?\" + _quote_query(query)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "'Operation'", ":", "arg_0", ".", "Operation", ",", "'Service'", ":", "\"AWSECommerceService\"", ",", "'Version'", ":", "arg_0", ".", "Version", ",", "}", "arg_2", ".", "update", "(", "arg_1", ")", "arg_3", "=", "SERVICE_DOMAINS", "[", "arg_0", ".", "Region", "]", "[", "0", "]", "return", "\"http://\"", "+", "arg_3", "+", "\"/onca/xml?\"", "+", "_quote_query", "(", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"A simplified URL to be used for caching the given query.\"\"\"\n        arg_2 = {\n            'Operation': arg_0.Operation,\n            'Service': \"AWSECommerceService\",\n            'Version': arg_0.Version,\n        }\n        arg_2.update(arg_1)\n\n        arg_3 = SERVICE_DOMAINS[arg_0.Region][0]\n\n        return \"http://\" + arg_3 + \"/onca/xml?\" + _quote_query(arg_2)", "path": "capybara/virtualenv/lib/python2.7/site-packages/bottlenose/api.py", "identifier": "AmazonCall.cache_url", "docstring": "A simplified URL to be used for caching the given query.", "docstring_tokens": ["A", "simplified", "URL", "to", "be", "used", "for", "caching", "the", "given", "query", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253417}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L540-L570", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "register an options provider", "language": "python", "parameters": "(self, provider, own_group=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "assert", "arg_1", ".", "priority", "<=", "0", ",", "\"provider's priority can't be >= 0\"", "for", "arg_3", "in", "range", "(", "len", "(", "arg_0", ".", "options_providers", ")", ")", ":", "if", "arg_1", ".", "priority", ">", "arg_0", ".", "options_providers", "[", "arg_3", "]", ".", "priority", ":", "arg_0", ".", "options_providers", ".", "insert", "(", "arg_3", ",", "arg_1", ")", "break", "else", ":", "arg_0", ".", "options_providers", ".", "append", "(", "arg_1", ")", "arg_4", "=", "[", "option", "for", "option", "in", "arg_1", ".", "options", "if", "\"group\"", "not", "in", "option", "[", "1", "]", "]", "arg_5", "=", "getattr", "(", "arg_1", ",", "\"option_groups\"", ",", "(", ")", ")", "if", "arg_2", "and", "arg_4", ":", "arg_0", ".", "add_option_group", "(", "arg_1", ".", "name", ".", "upper", "(", ")", ",", "arg_1", ".", "__doc__", ",", "arg_4", ",", "arg_1", ",", ")", "else", ":", "for", "arg_6", ",", "arg_7", "in", "arg_4", ":", "arg_0", ".", "add_optik_option", "(", "arg_1", ",", "arg_0", ".", "cmdline_parser", ",", "arg_6", ",", "arg_7", ")", "for", "arg_8", ",", "arg_9", "in", "arg_5", ":", "arg_8", "=", "arg_8", ".", "upper", "(", ")", "arg_10", "=", "[", "option", "for", "option", "in", "arg_1", ".", "options", "if", "option", "[", "1", "]", ".", "get", "(", "\"group\"", ",", "\"\"", ")", ".", "upper", "(", ")", "==", "arg_8", "]", "arg_0", ".", "add_option_group", "(", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"register an options provider\"\"\"\n        assert arg_1.priority <= 0, \"provider's priority can't be >= 0\"\n        for arg_3 in range(len(arg_0.options_providers)):\n            if arg_1.priority > arg_0.options_providers[arg_3].priority:\n                arg_0.options_providers.insert(arg_3, arg_1)\n                break\n        else:\n            arg_0.options_providers.append(arg_1)\n        arg_4 = [\n            option for option in arg_1.options if \"group\" not in option[1]\n        ]\n        arg_5 = getattr(arg_1, \"option_groups\", ())\n        if arg_2 and arg_4:\n            arg_0.add_option_group(\n                arg_1.name.upper(),\n                arg_1.__doc__,\n                arg_4,\n                arg_1,\n            )\n        else:\n            for arg_6, arg_7 in arg_4:\n                arg_0.add_optik_option(arg_1, arg_0.cmdline_parser, arg_6, arg_7)\n        for arg_8, arg_9 in arg_5:\n            arg_8 = arg_8.upper()\n            arg_10 = [\n                option\n                for option in arg_1.options\n                if option[1].get(\"group\", \"\").upper() == arg_8\n            ]\n            arg_0.add_option_group(arg_8, arg_9, arg_10, arg_1)", "path": "pylint/config.py", "identifier": "OptionsManagerMixIn.register_options_provider", "docstring": "register an options provider", "docstring_tokens": ["register", "an", "options", "provider"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253418}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_encoders.py#L159-L185", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Converts an Endpoint to a JSON endpoint dict.", "language": "python", "parameters": "(self, endpoint, is_v1)", "return_statement": "return json_endpoint", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "}", "if", "arg_1", ".", "service_name", ":", "arg_3", "[", "'serviceName'", "]", "=", "arg_1", ".", "service_name", "elif", "arg_2", ":", "arg_3", "[", "'serviceName'", "]", "=", "\"\"", "if", "arg_1", ".", "port", "and", "arg_1", ".", "port", "!=", "0", ":", "arg_3", "[", "'port'", "]", "=", "arg_1", ".", "port", "if", "arg_1", ".", "ipv4", "is", "not", "None", ":", "arg_3", "[", "'ipv4'", "]", "=", "arg_1", ".", "ipv4", "if", "arg_1", ".", "ipv6", "is", "not", "None", ":", "arg_3", "[", "'ipv6'", "]", "=", "arg_1", ".", "ipv6", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Converts an Endpoint to a JSON endpoint dict.\n\n        :param endpoint: endpoint object to convert.\n        :type endpoint: Endpoint\n        :param is_v1: whether we're serializing a v1 span. This is needed since\n            in v1 some fields default to an empty string rather than being\n            dropped if they're not set.\n        :type is_v1: bool\n        :return: dict representing a JSON endpoint.\n        :rtype: dict\n        \"\"\"\n        arg_3 = {}\n\n        if arg_1.service_name:\n            arg_3['serviceName'] = arg_1.service_name\n        elif arg_2:\n            # serviceName is mandatory in v1\n            arg_3['serviceName'] = \"\"\n        if arg_1.port and arg_1.port != 0:\n            arg_3['port'] = arg_1.port\n        if arg_1.ipv4 is not None:\n            arg_3['ipv4'] = arg_1.ipv4\n        if arg_1.ipv6 is not None:\n            arg_3['ipv6'] = arg_1.ipv6\n\n        return arg_3", "path": "py_zipkin/encoding/_encoders.py", "identifier": "_BaseJSONEncoder._create_json_endpoint", "docstring": "Converts an Endpoint to a JSON endpoint dict.\n\n        :param endpoint: endpoint object to convert.\n        :type endpoint: Endpoint\n        :param is_v1: whether we're serializing a v1 span. This is needed since\n            in v1 some fields default to an empty string rather than being\n            dropped if they're not set.\n        :type is_v1: bool\n        :return: dict representing a JSON endpoint.\n        :rtype: dict", "docstring_tokens": ["Converts", "an", "Endpoint", "to", "a", "JSON", "endpoint", "dict", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 253419}
{"url": "https://github.com/cmcginty/PyWeather/blob/8c25d9cd1fa921e0a6e460d523656279cac045cb/weather/stations/davis.py#L395-L418", "sha": "8c25d9cd1fa921e0a6e460d523656279cac045cb", "docstring_summary": "write a single command, with variable number of arguments. after the\n        command, the device must return ACK", "language": "python", "parameters": "(self, cmd, *args, **kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "setdefault", "(", "'ok'", ",", "False", ")", "arg_0", ".", "_wakeup", "(", ")", "if", "arg_2", ":", "arg_1", "=", "\"%s %s\"", "%", "(", "arg_1", ",", "' '", ".", "join", "(", "str", "(", "a", ")", "for", "a", "in", "arg_2", ")", ")", "for", "arg_5", "in", "xrange", "(", "3", ")", ":", "log", ".", "info", "(", "\"send: \"", "+", "arg_1", ")", "arg_0", ".", "port", ".", "write", "(", "arg_1", "+", "'\\n'", ")", "if", "arg_4", ":", "arg_6", "=", "arg_0", ".", "port", ".", "read", "(", "len", "(", "arg_0", ".", "OK", ")", ")", "log_raw", "(", "'read'", ",", "arg_6", ")", "if", "arg_6", "==", "arg_0", ".", "OK", ":", "return", "else", ":", "arg_6", "=", "arg_0", ".", "port", ".", "read", "(", "len", "(", "arg_0", ".", "ACK", ")", ")", "log_raw", "(", "'read'", ",", "arg_6", ")", "if", "arg_6", "==", "arg_0", ".", "ACK", ":", "return", "raise", "NoDeviceException", "(", "'Can not access weather station'", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        '''\n        write a single command, with variable number of arguments. after the\n        command, the device must return ACK\n        '''\n        arg_4 = arg_3.setdefault('ok', False)\n\n        arg_0._wakeup()\n        if arg_2:\n            arg_1 = \"%s %s\" % (arg_1, ' '.join(str(a) for a in arg_2))\n        for arg_5 in xrange(3):\n            log.info(\"send: \" + arg_1)\n            arg_0.port.write(arg_1 + '\\n')\n            if arg_4:\n                arg_6 = arg_0.port.read(len(arg_0.OK))  # read OK\n                log_raw('read', arg_6)\n                if arg_6 == arg_0.OK:\n                    return\n            else:\n                arg_6 = arg_0.port.read(len(arg_0.ACK))  # read ACK\n                log_raw('read', arg_6)\n                if arg_6 == arg_0.ACK:\n                    return\n        raise NoDeviceException('Can not access weather station')", "path": "weather/stations/davis.py", "identifier": "VantagePro._cmd", "docstring": "write a single command, with variable number of arguments. after the\n        command, the device must return ACK", "docstring_tokens": ["write", "a", "single", "command", "with", "variable", "number", "of", "arguments", ".", "after", "the", "command", "the", "device", "must", "return", "ACK"], "nwo": "cmcginty/PyWeather", "score": 0.19714217663807126, "idx": 253420}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/node_properties.py#L125-L129", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get top centrality dictionary.", "language": "python", "parameters": "(graph: BELGraph, number: Optional[int] = 30)", "return_statement": "return dict(dc.most_common(number))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "30", ")", "->", "Mapping", "[", "BaseEntity", ",", "arg_4", "]", ":", "arg_5", "=", "nx", ".", "betweenness_centrality", "(", "arg_0", ")", "arg_6", "=", "Counter", "(", "arg_5", ")", "return", "dict", "(", "arg_6", ".", "most_common", "(", "arg_2", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4] = 30) -> Mapping[BaseEntity, arg_4]:\n    \"\"\"Get top centrality dictionary.\"\"\"\n    arg_5 = nx.betweenness_centrality(arg_0)\n    arg_6 = Counter(arg_5)\n    return dict(arg_6.most_common(arg_2))", "path": "src/pybel_tools/summary/node_properties.py", "identifier": "count_top_centrality", "docstring": "Get top centrality dictionary.", "docstring_tokens": ["Get", "top", "centrality", "dictionary", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253421}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_hash.py#L698-L706", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "counterpart to _update_hasher", "language": "python", "parameters": "(hasher, hashlen, base)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "hexdigest", "(", ")", "arg_4", "=", "_convert_hexstr_base", "(", "arg_3", ",", "arg_2", ")", "arg_5", "=", "arg_4", "[", ":", "arg_1", "]", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" counterpart to _update_hasher \"\"\"\n    # Get a 128 character hex string\n    arg_3 = arg_0.hexdigest()\n    # Shorten length of string (by increasing base)\n    arg_4 = _convert_hexstr_base(arg_3, arg_2)\n    # Truncate\n    arg_5 = arg_4[:arg_1]\n    return arg_5", "path": "ubelt/util_hash.py", "identifier": "_digest_hasher", "docstring": "counterpart to _update_hasher", "docstring_tokens": ["counterpart", "to", "_update_hasher"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 253422}
{"url": "https://github.com/valentinalexeev/pwaqi/blob/81a1fa1ad87be7ba015c1cb07c52c7760ca99d8c/pwaqi/__init__.py#L31-L41", "sha": "81a1fa1ad87be7ba015c1cb07c52c7760ca99d8c", "docstring_summary": "Lookup observations by geo coordinates.", "language": "python", "parameters": "(lat, lng, token)", "return_statement": "return {}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "requests", ".", "get", "(", "API_ENDPOINT_GEO", "%", "(", "arg_0", ",", "arg_1", ")", ",", "params", "=", "{", "'token'", ":", "arg_2", "}", ")", "if", "arg_3", ".", "status_code", "==", "200", "and", "arg_3", ".", "json", "(", ")", "[", "\"status\"", "]", "==", "\"ok\"", ":", "return", "parse_observation_response", "(", "arg_3", ".", "json", "(", ")", "[", "\"data\"", "]", ")", "return", "{", "}"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Lookup observations by geo coordinates.\"\"\"\n    arg_3 = requests.get(\n        API_ENDPOINT_GEO % (arg_0, arg_1),\n        params={\n            'token': arg_2\n        })\n\n    if arg_3.status_code == 200 and arg_3.json()[\"status\"] == \"ok\":\n        return parse_observation_response(arg_3.json()[\"data\"])\n    return {}", "path": "pwaqi/__init__.py", "identifier": "get_location_observation", "docstring": "Lookup observations by geo coordinates.", "docstring_tokens": ["Lookup", "observations", "by", "geo", "coordinates", "."], "nwo": "valentinalexeev/pwaqi", "score": 0.18657722465184873, "idx": 253423}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L688-L705", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Retrieve the complete information of the given stream.", "language": "python", "parameters": "(self, timeout=FOREVER)", "return_statement": "return StreamInfo(handle=result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_3", "=", "c_int", "(", ")", "arg_4", "=", "lib", ".", "lsl_get_fullFunc", "(", "arg_0", ".", "obj", ",", "c_double", "(", "arg_1", ")", ",", "byref", "(", "arg_3", ")", ")", "handle_error", "(", "arg_3", ")", "return", "StreamInfo", "(", "handle", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Retrieve the complete Funcrmation of the given stream.\n\n        This includes the extended description. Can be invoked at any time of\n        the stream's lifetime.\n        \n        Keyword arguments:\n        timeout -- Timeout of the operation. (default FOREVER)\n        \n        Throws a TimeoutError (if the timeout expires), or LostError (if the \n        stream source has been lost).\n\n        \"\"\"\n        arg_3 = c_int()\n        arg_4 = lib.lsl_get_fullFunc(arg_0.obj, c_double(arg_1),\n                                      byref(arg_3))\n        handle_error(arg_3)\n        return StreamInfo(handle=arg_4)", "path": "pylsl/pylsl.py", "identifier": "StreamInlet.info", "docstring": "Retrieve the complete information of the given stream.\n\n        This includes the extended description. Can be invoked at any time of\n        the stream's lifetime.\n        \n        Keyword arguments:\n        timeout -- Timeout of the operation. (default FOREVER)\n        \n        Throws a TimeoutError (if the timeout expires), or LostError (if the \n        stream source has been lost).", "docstring_tokens": ["Retrieve", "the", "complete", "information", "of", "the", "given", "stream", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 253424}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/deploy.py#L119-L135", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Add platform specific checks", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_valid", ":", "raise", "PolyaxonDeploymentConfigError", "(", "'Deployment type `{}` not supported'", ".", "format", "(", "arg_0", ".", "deployment_type", ")", ")", "Func", "=", "False", "if", "arg_0", ".", "is_kubernetes", ":", "Func", "=", "arg_0", ".", "check_for_kubernetes", "(", ")", "elif", "arg_0", ".", "is_docker_compose", ":", "Func", "=", "arg_0", ".", "check_for_docker_compose", "(", ")", "elif", "arg_0", ".", "is_docker", ":", "Func", "=", "arg_0", ".", "check_for_docker", "(", ")", "elif", "arg_0", ".", "is_heroku", ":", "Func", "=", "arg_0", ".", "check_for_heroku", "(", ")", "if", "not", "Func", ":", "raise", "PolyaxonDeploymentConfigError", "(", "'Deployment `{}` is not valid'", ".", "format", "(", "arg_0", ".", "deployment_type", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Add platform specific checks\"\"\"\n        if not arg_0.is_valid:\n            raise PolyaxonDeploymentConfigError(\n                'Deployment type `{}` not supported'.format(arg_0.deployment_type))\n        Func = False\n        if arg_0.is_kubernetes:\n            Func = arg_0.check_for_kubernetes()\n        elif arg_0.is_docker_compose:\n            Func = arg_0.check_for_docker_compose()\n        elif arg_0.is_docker:\n            Func = arg_0.check_for_docker()\n        elif arg_0.is_heroku:\n            Func = arg_0.check_for_heroku()\n        if not Func:\n            raise PolyaxonDeploymentConfigError(\n                'Deployment `{}` is not valid'.format(arg_0.deployment_type))", "path": "polyaxon_cli/managers/deploy.py", "identifier": "DeployManager.check", "docstring": "Add platform specific checks", "docstring_tokens": ["Add", "platform", "specific", "checks"], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 253425}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/manager.py#L409-L415", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Load plugins in nose.plugins.builtin", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "nose", ".", "plugins", "import", "builtin", "for", "arg_1", "in", "builtin", ".", "plugins", ":", "arg_0", ".", "addPlugin", "(", "arg_1", "(", ")", ")", "super", "(", "BuiltinPluginManager", ",", "arg_0", ")", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Load plugins in nose.plugins.builtin\n        \"\"\"\n        from nose.plugins import builtin\n        for arg_1 in builtin.plugins:\n            arg_0.addPlugin(arg_1())\n        super(BuiltinPluginManager, arg_0).Func()", "path": "environment/lib/python2.7/site-packages/nose/plugins/manager.py", "identifier": "BuiltinPluginManager.loadPlugins", "docstring": "Load plugins in nose.plugins.builtin", "docstring_tokens": ["Load", "plugins", "in", "nose", ".", "plugins", ".", "builtin"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253426}
{"url": "https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L46-L50", "sha": "39e4da09f325382e21b0917b1b5cd027edce8728", "docstring_summary": "Custom version of splitext that doesn't perform splitext on directories", "language": "python", "parameters": "(filepath)", "return_statement": "return (\r\n\t\t(filepath, '') if os.path.isdir(filepath) else os.path.splitext(filepath)\r\n\t)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "(", "arg_0", ",", "''", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", "else", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\r\n\t\"Custom version of splitext that doesn't perform splitext on directories\"\r\n\treturn (\r\n\t\t(arg_0, '') if os.path.isdir(arg_0) else os.path.splitext(arg_0)\r\n\t)", "path": "jaraco/path.py", "identifier": "splitext_files_only", "docstring": "Custom version of splitext that doesn't perform splitext on directories", "docstring_tokens": ["Custom", "version", "of", "splitext", "that", "doesn", "t", "perform", "splitext", "on", "directories"], "nwo": "jaraco/jaraco.path", "score": 0.0, "idx": 253427}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L1101-L1105", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Stores value in memory as a big endian", "language": "python", "parameters": "(self, offset, value, size=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "arg_0", ".", "memory", ".", "write_BE", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "for", "arg_4", "in", "range", "(", "arg_3", ")", ":", "arg_0", ".", "_publish", "(", "'did_evm_write_memory'", ",", "arg_1", "+", "arg_4", ",", "Operators", ".", "EXTRACT", "(", "arg_2", ",", "(", "arg_3", "-", "arg_4", "-", "1", ")", "*", "8", ",", "8", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n        \"\"\"Stores value in memory as a big endian\"\"\"\n        arg_0.memory.write_BE(arg_1, arg_2, arg_3)\n        for arg_4 in range(arg_3):\n            arg_0._publish('did_evm_write_memory', arg_1 + arg_4, Operators.EXTRACT(arg_2, (arg_3 - arg_4 - 1) * 8, 8))", "path": "manticore/platforms/evm.py", "identifier": "EVM._store", "docstring": "Stores value in memory as a big endian", "docstring_tokens": ["Stores", "value", "in", "memory", "as", "a", "big", "endian"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253428}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/round_trips.py#L322-L346", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Translates round trip symbols to sectors.", "language": "python", "parameters": "(round_trips, sector_mappings)", "return_statement": "return sector_round_trips", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "copy", "(", ")", "arg_2", ".", "symbol", "=", "arg_2", ".", "symbol", ".", "apply", "(", "lambda", "x", ":", "arg_1", ".", "get", "(", "x", ",", "'No Sector Mapping'", ")", ")", "arg_2", "=", "arg_2", ".", "dropna", "(", "axis", "=", "0", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Translates round trip symbols to sectors.\n\n    Parameters\n    ----------\n    round_trips : pd.DataFrame\n        DataFrame with one row per round trip trade.\n        - See full explanation in round_trips.extract_round_trips\n    sector_mappings : dict or pd.Series, optional\n        Security identifier to sector mapping.\n        Security ids as keys, sectors as values.\n\n    Returns\n    -------\n    sector_round_trips : pd.DataFrame\n        Round trips with symbol names replaced by sector names.\n    \"\"\"\n\n    arg_2 = arg_0.copy()\n    arg_2.symbol = arg_2.symbol.apply(\n        lambda x: arg_1.get(x, 'No Sector Mapping'))\n    arg_2 = arg_2.dropna(axis=0)\n\n    return arg_2", "path": "pyfolio/round_trips.py", "identifier": "apply_sector_mappings_to_round_trips", "docstring": "Translates round trip symbols to sectors.\n\n    Parameters\n    ----------\n    round_trips : pd.DataFrame\n        DataFrame with one row per round trip trade.\n        - See full explanation in round_trips.extract_round_trips\n    sector_mappings : dict or pd.Series, optional\n        Security identifier to sector mapping.\n        Security ids as keys, sectors as values.\n\n    Returns\n    -------\n    sector_round_trips : pd.DataFrame\n        Round trips with symbol names replaced by sector names.", "docstring_tokens": ["Translates", "round", "trip", "symbols", "to", "sectors", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 253429}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/management/commands/__init__.py#L54-L73", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Generates a list of active integrated channels for active customers, filtered from the given options.", "language": "python", "parameters": "(self, options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_channel_classes", "(", "arg_1", ".", "get", "(", "'channel'", ")", ")", "arg_3", "=", "{", "'active'", ":", "True", ",", "'enterprise_customer__active'", ":", "True", ",", "}", "arg_4", "=", "arg_0", ".", "get_enterprise_customer", "(", "arg_1", ".", "get", "(", "'enterprise_customer'", ")", ")", "if", "arg_4", ":", "arg_3", "[", "'enterprise_customer'", "]", "=", "arg_4", "for", "arg_5", "in", "arg_2", ":", "for", "arg_6", "in", "arg_5", ".", "objects", ".", "filter", "(", "**", "arg_3", ")", ":", "yield", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Generates a list of active integrated channels for active customers, filtered from the given options.\n\n        Raises errors when invalid options are encountered.\n\n        See ``add_arguments`` for the accepted options.\n        \"\"\"\n        arg_2 = arg_0.get_channel_classes(arg_1.get('channel'))\n        arg_3 = {\n            'active': True,\n            'enterprise_customer__active': True,\n        }\n        arg_4 = arg_0.get_enterprise_customer(arg_1.get('enterprise_customer'))\n        if arg_4:\n            arg_3['enterprise_customer'] = arg_4\n\n        for arg_5 in arg_2:\n            for arg_6 in arg_5.objects.filter(**arg_3):\n                yield arg_6", "path": "integrated_channels/integrated_channel/management/commands/__init__.py", "identifier": "IntegratedChannelCommandMixin.get_integrated_channels", "docstring": "Generates a list of active integrated channels for active customers, filtered from the given options.\n\n        Raises errors when invalid options are encountered.\n\n        See ``add_arguments`` for the accepted options.", "docstring_tokens": ["Generates", "a", "list", "of", "active", "integrated", "channels", "for", "active", "customers", "filtered", "from", "the", "given", "options", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253430}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/stats.py#L357-L399", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Computes the temporal coverage of each source feed", "language": "python", "parameters": "(gtfs, stats)", "return_statement": "return stats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_n_gtfs_sources", "(", "arg_0", ")", "[", "0", "]", "arg_3", "=", "None", "arg_4", "=", "None", "if", "arg_2", ">", "1", ":", "for", "arg_5", "in", "range", "(", "arg_2", ")", ":", "arg_6", "=", "\"feed_\"", "+", "str", "(", "arg_5", ")", "+", "\"_\"", "arg_7", "=", "arg_6", "+", "\"calendar_start\"", "arg_8", "=", "arg_6", "+", "\"calendar_end\"", "arg_9", "=", "arg_0", ".", "conn", ".", "cursor", "(", ")", ".", "execute", "(", "'SELECT min(date), max(date) FROM trips, days '", "'WHERE trips.trip_I = days.trip_I AND trip_id LIKE ?;'", ",", "(", "arg_6", "+", "'%'", ",", ")", ")", ".", "fetchone", "(", ")", "arg_1", "[", "arg_7", "]", "=", "arg_9", "[", "0", "]", "arg_1", "[", "arg_8", "]", "=", "arg_9", "[", "1", "]", "if", "arg_9", "[", "0", "]", "is", "not", "None", "and", "arg_9", "[", "1", "]", "is", "not", "None", ":", "if", "not", "arg_3", "and", "not", "arg_4", ":", "arg_3", "=", "arg_9", "[", "0", "]", "arg_4", "=", "arg_9", "[", "1", "]", "else", ":", "if", "arg_0", ".", "get_day_start_ut", "(", "arg_9", "[", "0", "]", ")", ">", "arg_0", ".", "get_day_start_ut", "(", "arg_3", ")", ":", "arg_3", "=", "arg_9", "[", "0", "]", "if", "arg_0", ".", "get_day_start_ut", "(", "arg_9", "[", "1", "]", ")", "<", "arg_0", ".", "get_day_start_ut", "(", "arg_4", ")", ":", "arg_4", "=", "arg_9", "[", "1", "]", "arg_1", "[", "\"latest_feed_start_date\"", "]", "=", "arg_3", "arg_1", "[", "\"earliest_feed_end_date\"", "]", "=", "arg_4", "else", ":", "arg_1", "[", "\"latest_feed_start_date\"", "]", "=", "arg_1", "[", "\"start_date\"", "]", "arg_1", "[", "\"earliest_feed_end_date\"", "]", "=", "arg_1", "[", "\"end_date\"", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Computes the temporal coverage of each source feed\n\n    Parameters\n    ----------\n    gtfs: gtfspy.GTFS object\n    stats: dict\n        where to append the stats\n\n    Returns\n    -------\n    stats: dict\n    \"\"\"\n    arg_2 = _n_gtfs_sources(arg_0)[0]\n    arg_3 = None\n    arg_4 = None\n    if arg_2 > 1:\n        for arg_5 in range(arg_2):\n            arg_6 = \"feed_\" + str(arg_5) + \"_\"\n            arg_7 = arg_6 + \"calendar_start\"\n            arg_8 = arg_6 + \"calendar_end\"\n            arg_9 = arg_0.conn.cursor().execute(\n                'SELECT min(date), max(date) FROM trips, days '\n                'WHERE trips.trip_I = days.trip_I AND trip_id LIKE ?;', (arg_6 + '%',)).fetchone()\n\n            arg_1[arg_7] = arg_9[0]\n            arg_1[arg_8] = arg_9[1]\n            if arg_9[0] is not None and arg_9[1] is not None:\n                if not arg_3 and not arg_4:\n                    arg_3 = arg_9[0]\n                    arg_4 = arg_9[1]\n                else:\n                    if arg_0.get_day_start_ut(arg_9[0]) > arg_0.get_day_start_ut(arg_3):\n                        arg_3 = arg_9[0]\n                    if arg_0.get_day_start_ut(arg_9[1]) < arg_0.get_day_start_ut(arg_4):\n                        arg_4 = arg_9[1]\n        arg_1[\"latest_feed_start_date\"] = arg_3\n        arg_1[\"earliest_feed_end_date\"] = arg_4\n    else:\n        arg_1[\"latest_feed_start_date\"] = arg_1[\"start_date\"]\n        arg_1[\"earliest_feed_end_date\"] = arg_1[\"end_date\"]\n    return arg_1", "path": "gtfspy/stats.py", "identifier": "_feed_calendar_span", "docstring": "Computes the temporal coverage of each source feed\n\n    Parameters\n    ----------\n    gtfs: gtfspy.GTFS object\n    stats: dict\n        where to append the stats\n\n    Returns\n    -------\n    stats: dict", "docstring_tokens": ["Computes", "the", "temporal", "coverage", "of", "each", "source", "feed"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 253431}
{"url": "https://github.com/benmontet/f3/blob/b2e1dc250e4e3e884a54c501cd35cf02d5b8719e/f3/photometry.py#L585-L613", "sha": "b2e1dc250e4e3e884a54c501cd35cf02d5b8719e", "docstring_summary": "Estimate the photometric uncertainties on each data point following Equation A.2 of The Paper.\n        Based on the kepcal package of Dan Foreman-Mackey.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "photometry_array", ".", "T", "arg_1", "/=", "np", ".", "median", "(", "arg_1", ",", "axis", "=", "1", ")", "[", ":", ",", "None", "]", "arg_2", "=", "np", ".", "median", "(", "arg_1", ",", "axis", "=", "0", ")", "arg_3", ",", "arg_4", "=", "np", ".", "shape", "(", "arg_1", ")", "arg_5", "=", "np", ".", "empty", "(", "(", "arg_3", ",", "4", ")", ")", "arg_6", "=", "arg_0", ".", "qs", ".", "astype", "(", "int", ")", "for", "arg_7", "in", "range", "(", "4", ")", ":", "arg_5", "[", ":", ",", "arg_7", "]", "=", "np", ".", "median", "(", "(", "arg_1", "/", "arg_2", ")", "[", ":", ",", "arg_6", "==", "arg_7", "]", ",", "axis", "=", "1", ")", "arg_8", "=", "(", "arg_1", "-", "arg_5", "[", ":", ",", "arg_6", "]", "*", "arg_2", ")", "**", "2", "arg_9", "=", "arg_5", "[", ":", ",", "arg_6", "]", "arg_10", "=", "arg_9", "*", "arg_2", "[", "None", ",", ":", "]", "arg_11", "=", "np", ".", "log", "(", "np", ".", "nanmedian", "(", "arg_8", ",", "axis", "=", "0", ")", ")", "arg_12", "=", "np", ".", "log", "(", "0.1", "*", "np", ".", "nanmedian", "(", "np", ".", "abs", "(", "np", ".", "diff", "(", "arg_1", ",", "axis", "=", "1", ")", ")", ")", ")", "arg_13", "=", "np", ".", "sqrt", "(", "np", ".", "exp", "(", "2", "*", "(", "arg_12", "/", "arg_10", ")", ")", "+", "arg_9", "**", "2", "*", "np", ".", "exp", "(", "arg_11", ")", "[", "None", ",", ":", "]", ")", "arg_0", ".", "modeled_uncert", "=", "arg_13", "arg_0", ".", "target_uncert", "=", "arg_13", "[", "0", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Estimate the photometric uncertainties on each data point following Equation A.2 of The Paper.\n        Based on the kepcal package of Dan Foreman-Mackey.\n        \"\"\"\n        arg_1 = arg_0.photometry_array.T\n        arg_1 /= np.median(arg_1, axis=1)[:, None]\n        arg_2 = np.median(arg_1, axis=0)\n        \n        arg_3, arg_4 = np.shape(arg_1)\n        \n        arg_5 = np.empty((arg_3, 4))\n        \n        arg_6 = arg_0.qs.astype(int)\n        \n        for arg_7 in range(4):\n            arg_5[:, arg_7] = np.median((arg_1 / arg_2)[:, arg_6 == arg_7], axis=1)\n\n        arg_8 = (arg_1 - arg_5[:, arg_6] * arg_2)**2\n        arg_9 = arg_5[:, arg_6]\n        arg_10 = arg_9 * arg_2[None, :]\n        \n        arg_11 = np.log(np.nanmedian(arg_8, axis=0))\n        arg_12 = np.log(0.1*np.nanmedian(np.abs(np.diff(arg_1, axis=1))))\n\n        arg_13 = np.sqrt(np.exp(2*(arg_12/arg_10))+arg_9**2*np.exp(arg_11)[None, :])\n        \n        arg_0.modeled_uncert = arg_13\n        arg_0.target_uncert = arg_13[0]", "path": "f3/photometry.py", "identifier": "star.model_uncert", "docstring": "Estimate the photometric uncertainties on each data point following Equation A.2 of The Paper.\n        Based on the kepcal package of Dan Foreman-Mackey.", "docstring_tokens": ["Estimate", "the", "photometric", "uncertainties", "on", "each", "data", "point", "following", "Equation", "A", ".", "2", "of", "The", "Paper", ".", "Based", "on", "the", "kepcal", "package", "of", "Dan", "Foreman", "-", "Mackey", "."], "nwo": "benmontet/f3", "score": 0.18489352766931721, "idx": 253432}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/initializer.py#L151-L174", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Static internal method to work out rotation to create the passed in\n        qubit from the zero vector.", "language": "python", "parameters": "(pair_of_complex)", "return_statement": "return final_r * np.exp(1.J * final_t / 2), theta, phi", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "[", "arg_1", ",", "arg_2", "]", "=", "arg_0", "arg_1", "=", "complex", "(", "arg_1", ")", "arg_2", "=", "complex", "(", "arg_2", ")", "arg_3", "=", "np", ".", "absolute", "(", "arg_1", ")", "arg_4", "=", "float", "(", "np", ".", "sqrt", "(", "arg_3", "**", "2", "+", "np", ".", "absolute", "(", "arg_2", ")", "**", "2", ")", ")", "if", "arg_4", "<", "_EPS", ":", "arg_5", "=", "0", "arg_6", "=", "0", "arg_4", "=", "0", "arg_7", "=", "0", "else", ":", "arg_5", "=", "float", "(", "2", "*", "np", ".", "arccos", "(", "arg_3", "/", "arg_4", ")", ")", "arg_8", "=", "np", ".", "angle", "(", "arg_1", ")", "arg_9", "=", "np", ".", "angle", "(", "arg_2", ")", "arg_7", "=", "arg_8", "+", "arg_9", "arg_6", "=", "arg_9", "-", "arg_8", "return", "arg_4", "*", "np", ".", "exp", "(", "1.J", "*", "arg_7", "/", "2", ")", ",", "arg_5", ",", "arg_6"], "function": "def Func(arg_0):\n        \"\"\"\n        Static internal method to work out rotation to create the passed in\n        qubit from the zero vector.\n        \"\"\"\n        [arg_1, arg_2] = arg_0\n        # Force a and b to be complex, as otherwise numpy.angle might fail.\n        arg_1 = complex(arg_1)\n        arg_2 = complex(arg_2)\n        arg_3 = np.absolute(arg_1)\n        arg_4 = float(np.sqrt(arg_3 ** 2 + np.absolute(arg_2) ** 2))\n        if arg_4 < _EPS:\n            arg_5 = 0\n            arg_6 = 0\n            arg_4 = 0\n            arg_7 = 0\n        else:\n            arg_5 = float(2 * np.arccos(arg_3 / arg_4))\n            arg_8 = np.angle(arg_1)\n            arg_9 = np.angle(arg_2)\n            arg_7 = arg_8 + arg_9\n            arg_6 = arg_9 - arg_8\n\n        return arg_4 * np.exp(1.J * arg_7 / 2), arg_5, arg_6", "path": "qiskit/extensions/initializer.py", "identifier": "Initialize._bloch_angles", "docstring": "Static internal method to work out rotation to create the passed in\n        qubit from the zero vector.", "docstring_tokens": ["Static", "internal", "method", "to", "work", "out", "rotation", "to", "create", "the", "passed", "in", "qubit", "from", "the", "zero", "vector", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253433}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1213-L1228", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a Python AST Node for a `fn` expression.", "language": "python", "parameters": "(\n    ctx: GeneratorContext,\n    node: Fn,\n    def_name: Optional[str] = None,\n    meta_node: Optional[MetaNode] = None,\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "[", "arg_6", "]", "=", "None", ",", "arg_7", ":", "arg_5", "[", "arg_8", "]", "=", "None", ",", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "FN", "if", "len", "(", "arg_2", ".", "methods", ")", "==", "1", ":", "return", "__single_arityFunc", "(", "arg_0", ",", "arg_2", ",", "next", "(", "iter", "(", "arg_2", ".", "methods", ")", ")", ",", "arg_4", "=", "arg_4", ",", "arg_7", "=", "arg_7", ")", "else", ":", "return", "__multi_arityFunc", "(", "arg_0", ",", "arg_2", ",", "arg_2", ".", "methods", ",", "arg_4", "=", "arg_4", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(\n    arg_0: arg_1,\n    arg_2: arg_3,\n    arg_4: arg_5[arg_6] = None,\n    arg_7: arg_5[arg_8] = None,\n) -> GeneratedPyAST:\n    \"\"\"Return a Python AST Node for a `fn` expression.\"\"\"\n    assert arg_2.op == NodeOp.FN\n    if len(arg_2.methods) == 1:\n        return __single_arityFunc(\n            arg_0, arg_2, next(iter(arg_2.methods)), arg_4=arg_4, arg_7=arg_7\n        )\n    else:\n        return __multi_arityFunc(\n            arg_0, arg_2, arg_2.methods, arg_4=arg_4, arg_7=arg_7\n        )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_fn_to_py_ast", "docstring": "Return a Python AST Node for a `fn` expression.", "docstring_tokens": ["Return", "a", "Python", "AST", "Node", "for", "a", "fn", "expression", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 253434}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L430-L455", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Push a sample into the outlet.", "language": "python", "parameters": "(self, x, timestamp=0.0, pushthrough=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.0", ",", "arg_3", "=", "True", ")", ":", "if", "len", "(", "arg_1", ")", "==", "arg_0", ".", "channel_count", ":", "if", "arg_0", ".", "channel_format", "==", "cf_string", ":", "arg_1", "=", "[", "v", ".", "encode", "(", "'utf-8'", ")", "for", "v", "in", "arg_1", "]", "handle_error", "(", "arg_0", ".", "do_Func", "(", "arg_0", ".", "obj", ",", "arg_0", ".", "sample_type", "(", "*", "arg_1", ")", ",", "c_double", "(", "arg_2", ")", ",", "c_int", "(", "arg_3", ")", ")", ")", "else", ":", "raise", "ValueError", "(", "\"length of the data must correspond to the \"", "\"stream's channel count.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.0, arg_3=True):\n        \"\"\"Push a sample into the outlet.\n\n        Each entry in the list corresponds to one channel.\n\n        Keyword arguments:\n        x -- A list of values to push (one per channel).\n        timestamp -- Optionally the capture time of the sample, in agreement \n                     with local_clock(); if omitted, the current \n                     time is used. (default 0.0)\n        pushthrough -- Whether to push the sample through to the receivers  \n                       instead of buffering it with subsequent samples. \n                       Note that the chunk_size, if specified at outlet \n                       construction, takes precedence over the pushthrough flag.\n                       (default True)\n\n        \"\"\"\n        if len(arg_1) == arg_0.channel_count:\n            if arg_0.channel_format == cf_string:\n                arg_1 = [v.encode('utf-8') for v in arg_1]\n            handle_error(arg_0.do_Func(arg_0.obj, arg_0.sample_type(*arg_1),\n                                             c_double(arg_2),\n                                             c_int(arg_3)))\n        else:\n            raise ValueError(\"length of the data must correspond to the \"\n                             \"stream's channel count.\")", "path": "pylsl/pylsl.py", "identifier": "StreamOutlet.push_sample", "docstring": "Push a sample into the outlet.\n\n        Each entry in the list corresponds to one channel.\n\n        Keyword arguments:\n        x -- A list of values to push (one per channel).\n        timestamp -- Optionally the capture time of the sample, in agreement \n                     with local_clock(); if omitted, the current \n                     time is used. (default 0.0)\n        pushthrough -- Whether to push the sample through to the receivers  \n                       instead of buffering it with subsequent samples. \n                       Note that the chunk_size, if specified at outlet \n                       construction, takes precedence over the pushthrough flag.\n                       (default True)", "docstring_tokens": ["Push", "a", "sample", "into", "the", "outlet", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 253435}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/utils.py#L181-L231", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Define a write-only property that, in addition to the given setter function, also\n    provides a setter decorator defined as the property's getter function.", "language": "python", "parameters": "(fset)", "return_statement": "return property(fget, fset, None, fdoc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "fget", "(", "arg_1", ")", ":", "def", "inner", "(", "arg_2", ")", ":", "arg_0", "(", "arg_1", ",", "arg_2", ")", "def", "outer", "(", "arg_2", "=", "None", ")", ":", "if", "arg_2", ":", "inner", "(", "arg_2", ")", "else", ":", "return", "inner", "return", "outer", "arg_3", "=", "arg_0", ".", "__doc__", "return", "property", "(", "fget", ",", "arg_0", ",", "None", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Define a write-only property that, in addition to the given setter function, also\n    provides a setter decorator defined as the property's getter function.\n\n    This allows one to set the property either through traditional assignment, as a\n    method argument, or through decoration::\n\n        class Widget(object):\n            @Func\n            def handler(self, value):\n                self._handler = value\n\n        widget = Widget()\n\n        # Method 1: Traditional assignment\n        widget.handler = lambda input: process(input)\n\n        # Method 2: Assignment via method argument\n        widget.handler(lambda input: process(input))\n\n        # Method 3: Assignment via decoration\n        @widget.handler\n        def handler(input):\n            return process(input)\n\n        # Method 3b: Assignment via decoration with extraneous parens\n        @widget.handler()\n        def handler(input):\n            return process(input)\n    \"\"\"\n\n    def fget(arg_1):\n        def inner(arg_2):\n            arg_0(arg_1, arg_2)\n\n        def outer(arg_2=None):\n            if arg_2:\n                # We are being called with the desired value, either directly or\n                # as a decorator.\n                inner(arg_2)\n            else:\n                # Assume we are being called as a decorator with extraneous parens,\n                # so return the setter as the actual decorator.\n                return inner\n\n        return outer\n\n    arg_3 = arg_0.__doc__\n\n    return property(fget, arg_0, None, arg_3)", "path": "capybara/utils.py", "identifier": "setter_decorator", "docstring": "Define a write-only property that, in addition to the given setter function, also\n    provides a setter decorator defined as the property's getter function.\n\n    This allows one to set the property either through traditional assignment, as a\n    method argument, or through decoration::\n\n        class Widget(object):\n            @setter_decorator\n            def handler(self, value):\n                self._handler = value\n\n        widget = Widget()\n\n        # Method 1: Traditional assignment\n        widget.handler = lambda input: process(input)\n\n        # Method 2: Assignment via method argument\n        widget.handler(lambda input: process(input))\n\n        # Method 3: Assignment via decoration\n        @widget.handler\n        def handler(input):\n            return process(input)\n\n        # Method 3b: Assignment via decoration with extraneous parens\n        @widget.handler()\n        def handler(input):\n            return process(input)", "docstring_tokens": ["Define", "a", "write", "-", "only", "property", "that", "in", "addition", "to", "the", "given", "setter", "function", "also", "provides", "a", "setter", "decorator", "defined", "as", "the", "property", "s", "getter", "function", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 253436}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_viral_assembly.py#L407-L429", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Writes the assembly to a new file.", "language": "python", "parameters": "(self, output_file, filtered=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "logger", ".", "debug", "(", "\"Writing the filtered assembly into: {}\"", ".", "format", "(", "arg_1", ")", ")", "with", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "fh", ":", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "contigs", ".", "items", "(", ")", ":", "if", "arg_3", "not", "in", "arg_0", ".", "filtered_ids", "and", "arg_2", ":", "fh", ".", "write", "(", "\">{}_{}\\\\n{}\\\\n\"", ".", "format", "(", "arg_0", ".", "sample", ",", "arg_4", "[", "\"header\"", "]", ",", "arg_4", "[", "\"sequence\"", "]", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Writes the assembly to a new file.\n\n        The ``filtered`` option controls whether the new assembly will be\n        filtered or not.\n\n        Parameters\n        ----------\n        output_file : str\n            Name of the output assembly file.\n        filtered : bool\n            If ``True``, does not include filtered ids.\n        \"\"\"\n\n        logger.debug(\"Writing the filtered assembly into: {}\".format(\n            arg_1))\n        with open(arg_1, \"w\") as fh:\n\n            for arg_3, arg_4 in arg_0.contigs.items():\n                if arg_3 not in arg_0.filtered_ids and arg_2:\n                    fh.write(\">{}_{}\\\\n{}\\\\n\".format(arg_0.sample,\n                                                     arg_4[\"header\"],\n                                                     arg_4[\"sequence\"]))", "path": "flowcraft/templates/process_viral_assembly.py", "identifier": "Assembly.write_assembly", "docstring": "Writes the assembly to a new file.\n\n        The ``filtered`` option controls whether the new assembly will be\n        filtered or not.\n\n        Parameters\n        ----------\n        output_file : str\n            Name of the output assembly file.\n        filtered : bool\n            If ``True``, does not include filtered ids.", "docstring_tokens": ["Writes", "the", "assembly", "to", "a", "new", "file", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 253437}
{"url": "https://github.com/sergei-maertens/django-systemjs/blob/efd4a3862a39d9771609a25a5556f36023cf6e5c/systemjs/base.py#L140-L185", "sha": "efd4a3862a39d9771609a25a5556f36023cf6e5c", "docstring_summary": "Bundle the app and return the static url to the bundle.", "language": "python", "parameters": "(self)", "return_statement": "return rel_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "get_paths", "(", ")", "arg_3", "=", "arg_0", ".", "opts", "if", "arg_0", ".", "system", ".", "_has_jspm_log", "(", ")", ":", "arg_0", ".", "command", "+=", "' --log {log}'", "arg_3", ".", "setdefault", "(", "'log'", ",", "'err'", ")", "if", "arg_3", ".", "get", "(", "'minify'", ")", ":", "arg_0", ".", "command", "+=", "' --minify'", "if", "arg_3", ".", "get", "(", "'skip_source_maps'", ")", ":", "arg_0", ".", "command", "+=", "' --skip-source-maps'", "try", ":", "arg_4", "=", "arg_0", ".", "command", ".", "format", "(", "app", "=", "arg_0", ".", "app", ",", "arg_1", "=", "arg_1", ",", "**", "arg_3", ")", "arg_5", "=", "subprocess", ".", "Popen", "(", "arg_4", ",", "shell", "=", "True", ",", "cwd", "=", "arg_0", ".", "system", ".", "cwd", ",", "stdout", "=", "arg_0", ".", "stdout", ",", "stdin", "=", "arg_0", ".", "stdin", ",", "stderr", "=", "arg_0", ".", "stderr", ")", "arg_6", ",", "arg_7", "=", "arg_5", ".", "communicate", "(", ")", "if", "arg_7", "and", "arg_0", ".", "system", ".", "_has_jspm_log", "(", ")", ":", "arg_8", "=", "'Could not Func \\'%s\\': \\n%s'", "logger", ".", "warn", "(", "arg_8", ",", "arg_0", ".", "app", ",", "arg_7", ")", "raise", "BundleError", "(", "arg_8", "%", "(", "arg_0", ".", "app", ",", "arg_7", ")", ")", "if", "arg_6", ".", "strip", "(", ")", ":", "logger", ".", "info", "(", "arg_6", ")", "except", "(", "IOError", ",", "OSError", ")", "as", "e", ":", "if", "isinstance", "(", "e", ",", "BundleError", ")", ":", "raise", "raise", "BundleError", "(", "'Unable to apply %s (%r): %s'", "%", "(", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_4", ",", "e", ")", ")", "else", ":", "if", "not", "arg_3", ".", "get", "(", "'sfx'", ")", ":", "arg_9", "=", "find_sourcemap_comment", "(", "arg_1", ")", "with", "open", "(", "arg_1", ",", "'a'", ")", "as", "of", ":", "of", ".", "write", "(", "\"\\nSystem.import('{app}{ext}');\\n{sourcemap}\"", ".", "format", "(", "app", "=", "arg_0", ".", "app", ",", "ext", "=", "'.js'", "if", "arg_0", ".", "needs_ext", "(", ")", "else", "''", ",", "arg_9", "=", "arg_9", "if", "arg_9", "else", "''", ",", ")", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Bundle the app and return the static url to the Func.\n        \"\"\"\n        arg_1, arg_2 = arg_0.get_paths()\n\n        arg_3 = arg_0.opts\n        if arg_0.system._has_jspm_log():\n            arg_0.command += ' --log {log}'\n            arg_3.setdefault('log', 'err')\n\n        if arg_3.get('minify'):\n            arg_0.command += ' --minify'\n\n        if arg_3.get('skip_source_maps'):\n            arg_0.command += ' --skip-source-maps'\n\n        try:\n            arg_4 = arg_0.command.format(app=arg_0.app, arg_1=arg_1, **arg_3)\n            arg_5 = subprocess.Popen(\n                arg_4, shell=True, cwd=arg_0.system.cwd, stdout=arg_0.stdout,\n                stdin=arg_0.stdin, stderr=arg_0.stderr)\n\n            arg_6, arg_7 = arg_5.communicate()  # block until it's done\n            if arg_7 and arg_0.system._has_jspm_log():\n                arg_8 = 'Could not Func \\'%s\\': \\n%s'\n                logger.warn(arg_8, arg_0.app, arg_7)\n                raise BundleError(arg_8 % (arg_0.app, arg_7))\n            if arg_6.strip():\n                logger.info(arg_6)\n        except (IOError, OSError) as e:\n            if isinstance(e, BundleError):\n                raise\n            raise BundleError('Unable to apply %s (%r): %s' % (\n                              arg_0.__class__.__name__, arg_4, e))\n        else:\n            if not arg_3.get('sfx'):\n                # add the import statement, which is missing for non-sfx Funcs\n                arg_9 = find_sourcemap_comment(arg_1)\n                with open(arg_1, 'a') as of:\n                    of.write(\"\\nSystem.import('{app}{ext}');\\n{sourcemap}\".format(\n                        app=arg_0.app,\n                        ext='.js' if arg_0.needs_ext() else '',\n                        arg_9=arg_9 if arg_9 else '',\n                    ))\n        return arg_2", "path": "systemjs/base.py", "identifier": "SystemBundle.bundle", "docstring": "Bundle the app and return the static url to the bundle.", "docstring_tokens": ["Bundle", "the", "app", "and", "return", "the", "static", "url", "to", "the", "bundle", "."], "nwo": "sergei-maertens/django-systemjs", "score": 0.3518893757964147, "idx": 253438}
{"url": "https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/datatypes.py#L101-L115", "sha": "3ff76407af0e71621dada744cd964611e998699c", "docstring_summary": "Load json from file handle.", "language": "python", "parameters": "(cls, fh)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "return", "arg_0", "(", "json", ".", "loads", "(", "arg_1", ")", ")", "else", ":", "return", "arg_0", "(", "json", ".", "load", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Load json from file handle.\n\n        Args:\n            fh (file): File handle to load from.\n\n        Examlple:\n            >>> with open('data.json', 'r') as json:\n            >>>    data = composite.load(json)\n        \"\"\"\n        if isinstance(arg_1, str):\n            return arg_0(json.loads(arg_1))\n        else:\n            return arg_0(json.load(arg_1))", "path": "gems/datatypes.py", "identifier": "composite.from_json", "docstring": "Load json from file handle.\n\n        Args:\n            fh (file): File handle to load from.\n\n        Examlple:\n            >>> with open('data.json', 'r') as json:\n            >>>    data = composite.load(json)", "docstring_tokens": ["Load", "json", "from", "file", "handle", "."], "nwo": "bprinty/gems", "score": 0.16246995141409282, "idx": 253439}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/scripts.py#L21-L68", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Main script for `pyconfig` command.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Helper for working with \"", "\"pyconfigs\"", ")", "arg_1", "=", "arg_0", ".", "add_mutually_exclusive_group", "(", ")", "arg_1", ".", "add_argument", "(", "'-f'", ",", "'--filename'", ",", "help", "=", "\"parse an individual file or directory\"", ",", "metavar", "=", "'F'", ")", "arg_1", ".", "add_argument", "(", "'-m'", ",", "'--module'", ",", "help", "=", "\"parse a package or module, recursively looking inside it\"", ",", "metavar", "=", "'M'", ")", "arg_0", ".", "add_argument", "(", "'-v'", ",", "'--view-call'", ",", "help", "=", "\"show the actual pyconfig call made (default: show namespace)\"", ",", "action", "=", "'store_true'", ")", "arg_0", ".", "add_argument", "(", "'-l'", ",", "'--load-configs'", ",", "help", "=", "\"query the currently set value for each key found\"", ",", "action", "=", "'store_true'", ")", "arg_2", "=", "arg_0", ".", "add_mutually_exclusive_group", "(", ")", "arg_2", ".", "add_argument", "(", "'-a'", ",", "'--all'", ",", "help", "=", "\"show keys which don't have defaults set\"", ",", "action", "=", "'store_true'", ")", "arg_2", ".", "add_argument", "(", "'-k'", ",", "'--only-keys'", ",", "help", "=", "\"show a list of discovered keys without values\"", ",", "action", "=", "'store_true'", ")", "arg_0", ".", "add_argument", "(", "'-n'", ",", "'--natural-sort'", ",", "help", "=", "\"sort by filename and line (default: alphabetical by key)\"", ",", "action", "=", "'store_true'", ")", "arg_0", ".", "add_argument", "(", "'-s'", ",", "'--source'", ",", "help", "=", "\"show source annotations (implies --natural-sort)\"", ",", "action", "=", "'store_true'", ")", "arg_0", ".", "add_argument", "(", "'-c'", ",", "'--color'", ",", "help", "=", "\"toggle output colors (default: %s)\"", "%", "bool", "(", "pygments", ")", ",", "action", "=", "'store_const'", ",", "default", "=", "bool", "(", "pygments", ")", ",", "const", "=", "(", "not", "bool", "(", "pygments", ")", ")", ")", "arg_3", "=", "arg_0", ".", "parse_args", "(", ")", "if", "arg_3", ".", "color", "and", "not", "pygments", ":", "_error", "(", "\"Pygments is required for color output.\\n\"", "\"    pip install pygments\"", ")", "if", "arg_3", ".", "module", ":", "_handle_module", "(", "arg_3", ")", "if", "arg_3", ".", "filename", ":", "_handle_file", "(", "arg_3", ")"], "function": "def Func():\n    \"\"\"\n    Main script for `pyconfig` command.\n\n    \"\"\"\n    arg_0 = argparse.ArgumentParser(description=\"Helper for working with \"\n            \"pyconfigs\")\n    arg_1 = arg_0.add_mutually_exclusive_group()\n    arg_1.add_argument('-f', '--filename',\n            help=\"parse an individual file or directory\",\n            metavar='F')\n    arg_1.add_argument('-m', '--module',\n            help=\"parse a package or module, recursively looking inside it\",\n            metavar='M')\n    arg_0.add_argument('-v', '--view-call',\n            help=\"show the actual pyconfig call made (default: show namespace)\",\n            action='store_true')\n    arg_0.add_argument('-l', '--load-configs',\n            help=\"query the currently set value for each key found\",\n            action='store_true')\n    arg_2 = arg_0.add_mutually_exclusive_group()\n    arg_2.add_argument('-a', '--all',\n            help=\"show keys which don't have defaults set\",\n            action='store_true')\n    arg_2.add_argument('-k', '--only-keys',\n            help=\"show a list of discovered keys without values\",\n            action='store_true')\n    arg_0.add_argument('-n', '--natural-sort',\n            help=\"sort by filename and line (default: alphabetical by key)\",\n            action='store_true')\n    arg_0.add_argument('-s', '--source',\n            help=\"show source annotations (implies --natural-sort)\",\n            action='store_true')\n    arg_0.add_argument('-c', '--color',\n            help=\"toggle output colors (default: %s)\" % bool(pygments),\n            action='store_const', default=bool(pygments),\n            const=(not bool(pygments)))\n    arg_3 = arg_0.parse_args()\n\n    if arg_3.color and not pygments:\n        _error(\"Pygments is required for color output.\\n\"\n                \"    pip install pygments\")\n\n    if arg_3.module:\n        _handle_module(arg_3)\n\n    if arg_3.filename:\n        _handle_file(arg_3)", "path": "pyconfig/scripts.py", "identifier": "main", "docstring": "Main script for `pyconfig` command.", "docstring_tokens": ["Main", "script", "for", "pyconfig", "command", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 253440}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/examples/airline-demo/airline_demo/solids.py#L180-L197", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Upload a file to s3.", "language": "python", "parameters": "(context, file_obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "solid_config", "[", "'bucket'", "]", "arg_3", "=", "arg_0", ".", "solid_config", "[", "'key'", "]", "arg_0", ".", "resources", ".", "s3", ".", "put_object", "(", "Bucket", "=", "arg_2", ",", "Body", "=", "arg_1", ".", "read", "(", ")", ",", "Key", "=", "arg_3", ",", "**", "(", "arg_0", ".", "solid_config", ".", "get", "(", "'kwargs'", ")", "or", "{", "}", ")", ")", "yield", "Result", "(", "arg_2", ",", "'bucket'", ")", "yield", "Result", "(", "arg_3", ",", "'key'", ")"], "function": "def Func(arg_0, arg_1):\n    '''Upload a file to s3.\n\n    Args:\n        info (ExpectationExecutionInfo): Must expose a boto3 S3 client as its `s3` resource.\n\n    Returns:\n        (str, str):\n            The bucket and key to which the file was uploaded.\n    '''\n    arg_2 = arg_0.solid_config['bucket']\n    arg_3 = arg_0.solid_config['key']\n\n    arg_0.resources.s3.put_object(\n        Bucket=arg_2, Body=arg_1.read(), Key=arg_3, **(arg_0.solid_config.get('kwargs') or {})\n    )\n    yield Result(arg_2, 'bucket')\n    yield Result(arg_3, 'key')", "path": "examples/airline-demo/airline_demo/solids.py", "identifier": "upload_to_s3", "docstring": "Upload a file to s3.\n\n    Args:\n        info (ExpectationExecutionInfo): Must expose a boto3 S3 client as its `s3` resource.\n\n    Returns:\n        (str, str):\n            The bucket and key to which the file was uploaded.", "docstring_tokens": ["Upload", "a", "file", "to", "s3", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 253441}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/html5.py#L230-L250", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Parse an input source with HTML text into an Amara 3 tree", "language": "python", "parameters": "(source, prefixes=None, model=None, encoding=None, use_xhtml_ns=False)", "return_statement": "return first_element", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "def", "get_tree_instance", "(", "arg_5", ",", "arg_4", "=", "arg_4", ")", ":", "return", "treebuilder", "(", "arg_4", ")", "arg_6", "=", "html5lib", ".", "HTMLParser", "(", "tree", "=", "get_tree_instance", ")", "arg_7", "=", "arg_6", ".", "Func", "(", "arg_0", ")", "arg_8", "=", "next", "(", "(", "e", "for", "e", "in", "arg_7", ".", "root_nodes", "if", "isinstance", "(", "e", ",", "element", ")", ")", ",", "None", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False):\n    '''\n    Parse an input source with HTML text into an Amara 3 tree\n\n    >>> from amara3.uxml import html5\n    >>> import urllib.request\n    >>> with urllib.request.urlopen('http://uche.ogbuji.net/') as response:\n    ...     html5.Func(response)\n\n\n    #Warning: if you pass a string, you must make sure it's a byte string, not a Unicode object.  You might also want to wrap it with amara.lib.inputsource.text if it's not obviously XML or HTML (for example it could be confused with a file name)\n    '''\n    def get_tree_instance(arg_5, arg_4=arg_4):\n        #use_xhtml_ns is a boolean, whether or not to use http://www.w3.org/1999/xhtml\n        return treebuilder(arg_4)\n    arg_6 = html5lib.HTMLParser(tree=get_tree_instance)\n    #doc = Funcr.Func(inputsource(source, None).stream, encoding=encoding)\n    #doc = Funcr.Func(source, encoding=encoding)\n    arg_7 = arg_6.Func(arg_0)\n    arg_8 = next((e for e in arg_7.root_nodes if isinstance(e, element)), None)\n    return arg_8", "path": "pylib/uxml/html5.py", "identifier": "parse", "docstring": "Parse an input source with HTML text into an Amara 3 tree\n\n    >>> from amara3.uxml import html5\n    >>> import urllib.request\n    >>> with urllib.request.urlopen('http://uche.ogbuji.net/') as response:\n    ...     html5.parse(response)\n\n\n    #Warning: if you pass a string, you must make sure it's a byte string, not a Unicode object.  You might also want to wrap it with amara.lib.inputsource.text if it's not obviously XML or HTML (for example it could be confused with a file name)", "docstring_tokens": ["Parse", "an", "input", "source", "with", "HTML", "text", "into", "an", "Amara", "3", "tree"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 253442}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant_loader.py#L37-L55", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update one variant document in the database.", "language": "python", "parameters": "(self, variant_obj)", "return_statement": "return new_variant", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "debug", "(", "'Updating variant %s'", ",", "arg_1", ".", "get", "(", "'simple_id'", ")", ")", "arg_2", "=", "arg_0", ".", "variant_collection", ".", "find_one_and_replace", "(", "{", "'_id'", ":", "arg_1", "[", "'_id'", "]", "}", ",", "arg_1", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update one variant document in the database.\n\n        This means that the variant in the database will be replaced by variant_obj.\n\n        Args:\n            variant_obj(dict)\n\n        Returns:\n            new_variant(dict)\n        \"\"\"\n        LOG.debug('Updating variant %s', arg_1.get('simple_id'))\n\n        arg_2 = arg_0.variant_collection.find_one_and_replace(\n            {'_id': arg_1['_id']},\n            arg_1,\n            return_document=pymongo.ReturnDocument.AFTER\n        )\n        return arg_2", "path": "scout/adapter/mongo/variant_loader.py", "identifier": "VariantLoader.update_variant", "docstring": "Update one variant document in the database.\n\n        This means that the variant in the database will be replaced by variant_obj.\n\n        Args:\n            variant_obj(dict)\n\n        Returns:\n            new_variant(dict)", "docstring_tokens": ["Update", "one", "variant", "document", "in", "the", "database", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253443}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L178-L194", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Find executables in a path.", "language": "python", "parameters": "(path)", "return_statement": "return execs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "os", ".", "listdir", "(", "arg_0", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_2", ")", "if", "(", "os", ".", "access", "(", "arg_3", ",", "os", ".", "X_OK", ")", "and", "not", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", "and", "arg_2", "not", "in", "[", "'GMXRC'", ",", "'GMXRC.bash'", ",", "'GMXRC.csh'", ",", "'GMXRC.zsh'", ",", "'demux.pl'", ",", "'xplor2gmx.pl'", "]", ")", ":", "arg_1", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" Find executables in a path.\n\n    Searches executables in a directory excluding some know commands\n    unusable with GromacsWrapper.\n\n    :param path: dirname to search for\n    :return: list of executables\n    \"\"\"\n    arg_1 = []\n    for arg_2 in os.listdir(arg_0):\n        arg_3 = os.path.join(arg_0, arg_2)\n        if (os.access(arg_3, os.X_OK) and not os.path.isdir(arg_3) and\n             arg_2 not in ['GMXRC', 'GMXRC.bash', 'GMXRC.csh', 'GMXRC.zsh',\n                         'demux.pl', 'xplor2gmx.pl']):\n            arg_1.append(arg_2)\n    return arg_1", "path": "gromacs/tools.py", "identifier": "find_executables", "docstring": "Find executables in a path.\n\n    Searches executables in a directory excluding some know commands\n    unusable with GromacsWrapper.\n\n    :param path: dirname to search for\n    :return: list of executables", "docstring_tokens": ["Find", "executables", "in", "a", "path", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 253444}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/times.py#L20-L48", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "converts a timestamp to seconds", "language": "python", "parameters": "(value)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "int", "(", "arg_0", ")", "except", "ValueError", ":", "pass", "arg_1", "=", "(", "_Func_re", ".", "match", "(", "arg_0", ")", "or", "_Func_2_re", ".", "match", "(", "arg_0", ")", ")", "if", "not", "arg_1", ":", "raise", "ValueError", "arg_2", "=", "0", "arg_2", "+=", "int", "(", "arg_1", ".", "group", "(", "\"hours\"", ")", "or", "\"0\"", ")", "*", "60", "*", "60", "arg_2", "+=", "int", "(", "arg_1", ".", "group", "(", "\"minutes\"", ")", "or", "\"0\"", ")", "*", "60", "arg_2", "+=", "int", "(", "arg_1", ".", "group", "(", "\"seconds\"", ")", "or", "\"0\"", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"converts a timestamp to seconds\n\n      - hours:minutes:seconds to seconds\n      - minutes:seconds to seconds\n      - 11h22m33s to seconds\n      - 11h to seconds\n      - 20h15m to seconds\n      - seconds to seconds\n\n    :param value: hh:mm:ss ; 00h00m00s ; seconds\n    :return: seconds\n    \"\"\"\n    try:\n        return int(arg_0)\n    except ValueError:\n        pass\n\n    arg_1 = (_Func_re.match(arg_0)\n             or _Func_2_re.match(arg_0))\n    if not arg_1:\n        raise ValueError\n\n    arg_2 = 0\n    arg_2 += int(arg_1.group(\"hours\") or \"0\") * 60 * 60\n    arg_2 += int(arg_1.group(\"minutes\") or \"0\") * 60\n    arg_2 += int(arg_1.group(\"seconds\") or \"0\")\n\n    return arg_2", "path": "src/streamlink/utils/times.py", "identifier": "hours_minutes_seconds", "docstring": "converts a timestamp to seconds\n\n      - hours:minutes:seconds to seconds\n      - minutes:seconds to seconds\n      - 11h22m33s to seconds\n      - 11h to seconds\n      - 20h15m to seconds\n      - seconds to seconds\n\n    :param value: hh:mm:ss ; 00h00m00s ; seconds\n    :return: seconds", "docstring_tokens": ["converts", "a", "timestamp", "to", "seconds"], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 253445}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/http.py#L65-L68", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "Runs HTTP GET request to retrieve the list of experiments.", "language": "python", "parameters": "(self, workspace_id)", "return_statement": "return self._send_get_req(api_path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "EXPERIMENTS_URI_FMT", ".", "format", "(", "arg_1", ")", "return", "arg_0", ".", "_send_get_req", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Runs HTTP GET request to retrieve the list of experiments.\"\"\"\r\n        arg_2 = arg_0.EXPERIMENTS_URI_FMT.format(arg_1)\r\n        return arg_0._send_get_req(arg_2)", "path": "azureml/http.py", "identifier": "_RestClient.get_experiments", "docstring": "Runs HTTP GET request to retrieve the list of experiments.", "docstring_tokens": ["Runs", "HTTP", "GET", "request", "to", "retrieve", "the", "list", "of", "experiments", "."], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 253446}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L330-L411", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Yield code with unused imports removed.", "language": "python", "parameters": "(source, additional_imports=None,\n                expand_star_imports=False,\n                remove_all_unused_imports=False,\n                remove_duplicate_keys=False,\n                remove_unused_variables=False,\n                ignore_init_module_imports=False,\n                )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ",", ")", ":", "arg_7", "=", "SAFE_IMPORTS", "if", "arg_1", ":", "arg_7", "|=", "frozenset", "(", "arg_1", ")", "del", "arg_1", "arg_8", "=", "check", "(", "arg_0", ")", "if", "arg_6", ":", "arg_9", "=", "frozenset", "(", ")", "else", ":", "arg_9", "=", "frozenset", "(", "unused_import_line_numbers", "(", "arg_8", ")", ")", "arg_10", "=", "collections", ".", "defaultdict", "(", "lambda", ":", "[", "]", ")", "for", "arg_11", ",", "arg_12", "in", "unused_import_module_name", "(", "arg_8", ")", ":", "arg_10", "[", "arg_11", "]", ".", "append", "(", "arg_12", ")", "if", "arg_2", "and", "not", "(", "re", ".", "search", "(", "r'\\b__all__\\b'", ",", "arg_0", ")", "or", "re", ".", "search", "(", "r'\\bdel\\b'", ",", "arg_0", ")", ")", ":", "arg_13", "=", "frozenset", "(", "star_import_used_line_numbers", "(", "arg_8", ")", ")", "if", "len", "(", "arg_13", ")", ">", "1", ":", "arg_13", "=", "frozenset", "(", ")", "else", ":", "arg_14", "=", "[", "]", "for", "arg_11", ",", "arg_15", ",", "arg_16", "in", "star_import_usage_undefined_name", "(", "arg_8", ")", ":", "arg_14", ".", "append", "(", "arg_15", ")", "if", "not", "arg_14", ":", "arg_13", "=", "frozenset", "(", ")", "else", ":", "arg_13", "=", "frozenset", "(", ")", "if", "arg_5", ":", "arg_17", "=", "frozenset", "(", "unused_variable_line_numbers", "(", "arg_8", ")", ")", "else", ":", "arg_17", "=", "frozenset", "(", ")", "if", "arg_4", ":", "arg_18", "=", "frozenset", "(", "duplicate_key_line_numbers", "(", "arg_8", ",", "arg_0", ")", ")", "else", ":", "arg_18", "=", "frozenset", "(", ")", "arg_19", "=", "get_messages_by_line", "(", "arg_8", ")", "arg_20", "=", "io", ".", "StringIO", "(", "arg_0", ")", "arg_21", "=", "''", "for", "arg_11", ",", "arg_22", "in", "enumerate", "(", "arg_20", ".", "readlines", "(", ")", ",", "start", "=", "1", ")", ":", "if", "'#'", "in", "arg_22", ":", "yield", "arg_22", "elif", "arg_11", "in", "arg_9", ":", "yield", "filter_unused_import", "(", "arg_22", ",", "unused_module", "=", "arg_10", "[", "arg_11", "]", ",", "arg_3", "=", "arg_3", ",", "arg_7", "=", "arg_7", ",", "arg_21", "=", "arg_21", ")", "elif", "arg_11", "in", "arg_17", ":", "yield", "filter_unused_variable", "(", "arg_22", ")", "elif", "arg_11", "in", "arg_18", ":", "yield", "filter_duplicate_key", "(", "arg_22", ",", "arg_19", "[", "arg_11", "]", ",", "arg_11", ",", "arg_18", ",", "arg_0", ")", "elif", "arg_11", "in", "arg_13", ":", "yield", "filter_star_import", "(", "arg_22", ",", "arg_14", ")", "else", ":", "yield", "arg_22", "arg_21", "=", "arg_22"], "function": "def Func(arg_0, arg_1=None,\n                arg_2=False,\n                arg_3=False,\n                arg_4=False,\n                arg_5=False,\n                arg_6=False,\n                ):\n    \"\"\"Yield code with unused imports removed.\"\"\"\n    arg_7 = SAFE_IMPORTS\n    if arg_1:\n        arg_7 |= frozenset(arg_1)\n    del arg_1\n\n    arg_8 = check(arg_0)\n\n    if arg_6:\n        arg_9 = frozenset()\n    else:\n        arg_9 = frozenset(\n            unused_import_line_numbers(arg_8))\n    arg_10 = collections.defaultdict(lambda: [])\n    for arg_11, arg_12 in unused_import_module_name(arg_8):\n        arg_10[arg_11].append(arg_12)\n\n    if arg_2 and not (\n        # See explanations in #18.\n        re.search(r'\\b__all__\\b', arg_0) or\n        re.search(r'\\bdel\\b', arg_0)\n    ):\n        arg_13 = frozenset(\n            star_import_used_line_numbers(arg_8))\n        if len(arg_13) > 1:\n            # Auto expanding only possible for single star import\n            arg_13 = frozenset()\n        else:\n            arg_14 = []\n            for arg_11, arg_15, arg_16 \\\n                    in star_import_usage_undefined_name(arg_8):\n                arg_14.append(arg_15)\n            if not arg_14:\n                arg_13 = frozenset()\n    else:\n        arg_13 = frozenset()\n\n    if arg_5:\n        arg_17 = frozenset(\n            unused_variable_line_numbers(arg_8))\n    else:\n        arg_17 = frozenset()\n\n    if arg_4:\n        arg_18 = frozenset(\n            duplicate_key_line_numbers(arg_8, arg_0))\n    else:\n        arg_18 = frozenset()\n\n    arg_19 = get_messages_by_line(arg_8)\n\n    arg_20 = io.StringIO(arg_0)\n    arg_21 = ''\n    for arg_11, arg_22 in enumerate(arg_20.readlines(), start=1):\n        if '#' in arg_22:\n            yield arg_22\n        elif arg_11 in arg_9:\n            yield filter_unused_import(\n                arg_22,\n                unused_module=arg_10[arg_11],\n                arg_3=arg_3,\n                arg_7=arg_7,\n                arg_21=arg_21)\n        elif arg_11 in arg_17:\n            yield filter_unused_variable(arg_22)\n        elif arg_11 in arg_18:\n            yield filter_duplicate_key(arg_22, arg_19[arg_11],\n                                       arg_11, arg_18,\n                                       arg_0)\n        elif arg_11 in arg_13:\n            yield filter_star_import(arg_22, arg_14)\n        else:\n            yield arg_22\n\n        arg_21 = arg_22", "path": "autoflake.py", "identifier": "filter_code", "docstring": "Yield code with unused imports removed.", "docstring_tokens": ["Yield", "code", "with", "unused", "imports", "removed", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 253447}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L241-L260", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Creates a new channel for receiving push data.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "logger", ".", "info", "(", "'Requesting new gsessionid and SID...'", ")", "arg_0", ".", "_sid_param", "=", "None", "arg_0", ".", "_gsessionid_param", "=", "None", "arg_3", "=", "await", "arg_0", ".", "send_maps", "(", "[", "]", ")", "arg_0", ".", "_sid_param", ",", "arg_0", ".", "_gsessionid_param", "=", "_parse_sid_response", "(", "arg_3", ".", "body", ")", "logger", ".", "info", "(", "'New SID: {}'", ".", "format", "(", "arg_0", ".", "_sid_param", ")", ")", "logger", ".", "info", "(", "'New gsessionid: {}'", ".", "format", "(", "arg_0", ".", "_gsessionid_param", ")", ")"], "function": "async def Func(arg_0):\n        \"\"\"Creates a new channel for receiving push data.\n\n        Sending an empty forward channel request will create a new channel on\n        the server.\n\n        There's a separate API to get the gsessionid alone that Hangouts for\n        Chrome uses, but if we don't send a gsessionid with this request, it\n        will return a gsessionid as well as the SID.\n\n        Raises hangups.NetworkError if the channel can not be created.\n        \"\"\"\n        logger.info('Requesting new gsessionid and SID...')\n        # Set SID and gsessionid to None so they aren't sent in by send_maps.\n        arg_0._sid_param = None\n        arg_0._gsessionid_param = None\n        arg_3 = await arg_0.send_maps([])\n        arg_0._sid_param, arg_0._gsessionid_param = _parse_sid_response(arg_3.body)\n        logger.info('New SID: {}'.format(arg_0._sid_param))\n        logger.info('New gsessionid: {}'.format(arg_0._gsessionid_param))", "path": "hangups/channel.py", "identifier": "Channel._fetch_channel_sid", "docstring": "Creates a new channel for receiving push data.\n\n        Sending an empty forward channel request will create a new channel on\n        the server.\n\n        There's a separate API to get the gsessionid alone that Hangouts for\n        Chrome uses, but if we don't send a gsessionid with this request, it\n        will return a gsessionid as well as the SID.\n\n        Raises hangups.NetworkError if the channel can not be created.", "docstring_tokens": ["Creates", "a", "new", "channel", "for", "receiving", "push", "data", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 253448}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/__init__.py#L66-L73", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "load the secrets credentials file with the Globus OAuthTokenResponse", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "auth", "=", "arg_0", ".", "_get_and_update_setting", "(", "'GLOBUS_AUTH_RESPONSE'", ")", "arg_0", ".", "transfer", "=", "arg_0", ".", "_get_and_update_setting", "(", "'GLOBUS_TRANSFER_RESPONSE'", ")"], "function": "def Func(arg_0):\n        '''load the secrets credentials file with the Globus OAuthTokenResponse\n        '''\n\n        # Second priority: load from cache\n       \n        arg_0.auth = arg_0._get_and_update_setting('GLOBUS_AUTH_RESPONSE')\n        arg_0.transfer = arg_0._get_and_update_setting('GLOBUS_TRANSFER_RESPONSE')", "path": "sregistry/main/globus/__init__.py", "identifier": "Client._load_secrets", "docstring": "load the secrets credentials file with the Globus OAuthTokenResponse", "docstring_tokens": ["load", "the", "secrets", "credentials", "file", "with", "the", "Globus", "OAuthTokenResponse"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 253449}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/namespace.py#L180-L225", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "This function dispatches ``event`` messages to the correct\n        functions. You should override this method only if you are not\n        satisfied with the automatic dispatching to\n        ``on_``-prefixed methods.  You could then implement your own dispatch.\n        See the source code for inspiration.", "language": "python", "parameters": "(self, packet)", "return_statement": "return self.call_method_with_acl(method_name, packet, *args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'args'", "]", "arg_3", "=", "arg_1", "[", "'name'", "]", "if", "not", "allowed_event_name_regex", ".", "match", "(", "arg_3", ")", ":", "arg_0", ".", "error", "(", "\"unallowed_event_name\"", ",", "\"name must only contains alpha numerical characters\"", ")", "return", "arg_4", "=", "'on_'", "+", "arg_3", ".", "replace", "(", "' '", ",", "'_'", ")", "return", "arg_0", ".", "call_method_with_acl", "(", "arg_4", ",", "arg_1", ",", "*", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"This function dispatches ``event`` messages to the correct\n        functions. You should override this method only if you are not\n        satisfied with the automatic dispatching to\n        ``on_``-prefixed methods.  You could then implement your own dispatch.\n        See the source code for inspiration.\n\n        There are two ways to deal with callbacks from the client side\n        (meaning, the browser has a callback waiting for data that this\n        server will be sending back):\n\n        The first one is simply to return an object.  If the incoming\n        packet requested has an 'ack' field set, meaning the browser is\n        waiting for callback data, it will automatically be packaged\n        and sent, associated with the 'ackId' from the browser. The\n        return value must be a *sequence* of elements, that will be\n        mapped to the positional parameters of the callback function\n        on the browser side.\n\n        If you want to *know* that you're dealing with a packet\n        that requires a return value, you can do those things manually\n        by inspecting the ``ack`` and ``id`` keys from the ``packet``\n        object.  Your callback will behave specially if the name of\n        the argument to your method is ``packet``.  It will fill it\n        with the unprocessed ``packet`` object for your inspection,\n        like this:\n\n        .. code-block:: python\n\n          def on_my_callback(self, packet):\n              if 'ack' in packet:\n                  self.emit('go_back', 'param1', id=packet['id'])\n        \"\"\"\n        arg_2 = arg_1['args']\n        arg_3 = arg_1['name']\n        if not allowed_event_name_regex.match(arg_3):\n            arg_0.error(\"unallowed_event_name\",\n                       \"name must only contains alpha numerical characters\")\n            return\n\n        arg_4 = 'on_' + arg_3.replace(' ', '_')\n        # This means the args, passed as a list, will be expanded to\n        # the method arg and if you passed a dict, it will be a dict\n        # as the first parameter.\n\n        return arg_0.call_method_with_acl(arg_4, arg_1, *arg_2)", "path": "socketio/namespace.py", "identifier": "BaseNamespace.process_event", "docstring": "This function dispatches ``event`` messages to the correct\n        functions. You should override this method only if you are not\n        satisfied with the automatic dispatching to\n        ``on_``-prefixed methods.  You could then implement your own dispatch.\n        See the source code for inspiration.\n\n        There are two ways to deal with callbacks from the client side\n        (meaning, the browser has a callback waiting for data that this\n        server will be sending back):\n\n        The first one is simply to return an object.  If the incoming\n        packet requested has an 'ack' field set, meaning the browser is\n        waiting for callback data, it will automatically be packaged\n        and sent, associated with the 'ackId' from the browser. The\n        return value must be a *sequence* of elements, that will be\n        mapped to the positional parameters of the callback function\n        on the browser side.\n\n        If you want to *know* that you're dealing with a packet\n        that requires a return value, you can do those things manually\n        by inspecting the ``ack`` and ``id`` keys from the ``packet``\n        object.  Your callback will behave specially if the name of\n        the argument to your method is ``packet``.  It will fill it\n        with the unprocessed ``packet`` object for your inspection,\n        like this:\n\n        .. code-block:: python\n\n          def on_my_callback(self, packet):\n              if 'ack' in packet:\n                  self.emit('go_back', 'param1', id=packet['id'])", "docstring_tokens": ["This", "function", "dispatches", "event", "messages", "to", "the", "correct", "functions", ".", "You", "should", "override", "this", "method", "only", "if", "you", "are", "not", "satisfied", "with", "the", "automatic", "dispatching", "to", "on_", "-", "prefixed", "methods", ".", "You", "could", "then", "implement", "your", "own", "dispatch", ".", "See", "the", "source", "code", "for", "inspiration", "."], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 253450}
{"url": "https://github.com/philipsoutham/py-mysql2pgsql/blob/66dc2a3a3119263b3fe77300fb636346509787ef/mysql2pgsql/lib/postgres_file_writer.py#L82-L90", "sha": "66dc2a3a3119263b3fe77300fb636346509787ef", "docstring_summary": "Write DDL of `table` indexes to the output file", "language": "python", "parameters": "(self, table)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "f", ".", "write", "(", "'\\n'", ".", "join", "(", "super", "(", "PostgresFileWriter", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Write DDL of `table` indexes to the output file\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None\n        \"\"\"\n        arg_0.f.write('\\n'.join(super(PostgresFileWriter, arg_0).Func(arg_1)))", "path": "mysql2pgsql/lib/postgres_file_writer.py", "identifier": "PostgresFileWriter.write_indexes", "docstring": "Write DDL of `table` indexes to the output file\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None", "docstring_tokens": ["Write", "DDL", "of", "table", "indexes", "to", "the", "output", "file"], "nwo": "philipsoutham/py-mysql2pgsql", "score": 0.632634572866938, "idx": 253451}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L88-L110", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return a valid python filename in the current directory.", "language": "python", "parameters": "(name, force_win32=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", "if", "arg_1", "is", "None", ":", "arg_2", "=", "(", "sys", ".", "platform", "==", "'win32'", ")", "else", ":", "arg_2", "=", "arg_1", "arg_0", "=", "unquote_filename", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", "and", "not", "arg_0", ".", "endswith", "(", "'.py'", ")", ":", "arg_0", "+=", "'.py'", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "return", "arg_0", "else", ":", "raise", "IOError", ",", "'File `%r` not found.'", "%", "arg_0"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Return a valid python filename in the current directory.\n\n    If the given name is not a file, it adds '.py' and searches again.\n    Raises IOError with an informative message if the file isn't found.\n\n    On Windows, apply Windows semantics to the filename. In particular, remove\n    any quoting that has been applied to it. This option can be forced for\n    testing purposes.\n    \"\"\"\n\n    arg_0 = os.path.expanduser(arg_0)\n    if arg_1 is None:\n        arg_2 = (sys.platform == 'win32')\n    else:\n        arg_2 = arg_1\n    arg_0 = unquote_filename(arg_0, arg_2=arg_2)\n    if not os.path.isfile(arg_0) and not arg_0.endswith('.py'):\n        arg_0 += '.py'\n    if os.path.isfile(arg_0):\n        return arg_0\n    else:\n        raise IOError,'File `%r` not found.' % arg_0", "path": "environment/lib/python2.7/site-packages/IPython/utils/path.py", "identifier": "get_py_filename", "docstring": "Return a valid python filename in the current directory.\n\n    If the given name is not a file, it adds '.py' and searches again.\n    Raises IOError with an informative message if the file isn't found.\n\n    On Windows, apply Windows semantics to the filename. In particular, remove\n    any quoting that has been applied to it. This option can be forced for\n    testing purposes.", "docstring_tokens": ["Return", "a", "valid", "python", "filename", "in", "the", "current", "directory", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253452}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L607-L613", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Convert UTC datetime into user interface string.", "language": "python", "parameters": "(timestamp, datetimefmt, show_date=False)", "return_statement": "return timestamp.astimezone(tz=None).strftime(fmt)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "''", "if", "arg_2", ":", "arg_3", "+=", "'\\n'", "+", "arg_1", ".", "get", "(", "'date'", ",", "''", ")", "+", "'\\n'", "arg_3", "+=", "arg_1", ".", "get", "(", "'time'", ",", "''", ")", "return", "arg_0", ".", "astimezone", "(", "tz", "=", "None", ")", ".", "strftime", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Convert UTC datetime into user interface string.\"\"\"\n        arg_3 = ''\n        if arg_2:\n            arg_3 += '\\n'+arg_1.get('date', '')+'\\n'\n        arg_3 += arg_1.get('time', '')\n        return arg_0.astimezone(tz=None).strftime(arg_3)", "path": "hangups/ui/__main__.py", "identifier": "MessageWidget._get_date_str", "docstring": "Convert UTC datetime into user interface string.", "docstring_tokens": ["Convert", "UTC", "datetime", "into", "user", "interface", "string", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 253453}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/tools/nontrivial.py#L39-L70", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Test must raise one of expected exceptions to pass.", "language": "python", "parameters": "(*exceptions)", "return_statement": "return decorate", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "' or '", ".", "join", "(", "[", "e", ".", "__name__", "for", "e", "in", "arg_0", "]", ")", "def", "decorate", "(", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "__name__", "def", "arg_7", "(", "*", "arg_4", ",", "**", "arg_5", ")", ":", "try", ":", "arg_2", "(", "*", "arg_4", ",", "**", "arg_5", ")", "except", "arg_0", ":", "pass", "except", ":", "raise", "else", ":", "arg_6", "=", "\"%s() did not raise %s\"", "%", "(", "arg_3", ",", "arg_1", ")", "raise", "AssertionError", "(", "arg_6", ")", "arg_7", "=", "make_decorator", "(", "arg_2", ")", "(", "arg_7", ")", "return", "arg_7", "return", "decorate"], "function": "def Func(*arg_0):\n    \"\"\"Test must raise one of expected exceptions to pass.\n\n    Example use::\n\n      @Func(TypeError, ValueError)\n      def test_Func_type_error():\n          raise TypeError(\"This test passes\")\n\n      @Func(Exception)\n      def test_that_fails_by_passing():\n          pass\n\n    If you want to test many assertions about exceptions in a single test,\n    you may want to use `assert_Func` instead.\n    \"\"\"\n    arg_1 = ' or '.join([e.__name__ for e in arg_0])\n    def decorate(arg_2):\n        arg_3 = arg_2.__name__\n        def arg_7(*arg_4, **arg_5):\n            try:\n                arg_2(*arg_4, **arg_5)\n            except arg_0:\n                pass\n            except:\n                raise\n            else:\n                arg_6 = \"%s() did not raise %s\" % (arg_3, arg_1)\n                raise AssertionError(arg_6)\n        arg_7 = make_decorator(arg_2)(arg_7)\n        return arg_7\n    return decorate", "path": "environment/lib/python2.7/site-packages/nose/tools/nontrivial.py", "identifier": "raises", "docstring": "Test must raise one of expected exceptions to pass.\n\n    Example use::\n\n      @raises(TypeError, ValueError)\n      def test_raises_type_error():\n          raise TypeError(\"This test passes\")\n\n      @raises(Exception)\n      def test_that_fails_by_passing():\n          pass\n\n    If you want to test many assertions about exceptions in a single test,\n    you may want to use `assert_raises` instead.", "docstring_tokens": ["Test", "must", "raise", "one", "of", "expected", "exceptions", "to", "pass", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253454}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/dagdeps.py#L64-L70", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Validate that jobs executed after their dependencies.", "language": "python", "parameters": "(G, results)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "arg_1", "[", "arg_2", "]", ".", "metadata", ".", "started", "for", "arg_4", "in", "arg_0", ".", "predecessors", "(", "arg_2", ")", ":", "arg_5", "=", "arg_1", "[", "arg_4", "]", ".", "metadata", ".", "completed", "assert", "arg_3", ">", "arg_5", ",", "\"%s should have happened after %s\"", "%", "(", "arg_2", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Validate that jobs executed after their dependencies.\"\"\"\n    for arg_2 in arg_0:\n        arg_3 = arg_1[arg_2].metadata.started\n        for arg_4 in arg_0.predecessors(arg_2):\n            arg_5 = arg_1[arg_4].metadata.completed\n            assert arg_3 > arg_5, \"%s should have happened after %s\"%(arg_2, arg_4)", "path": "environment/share/doc/ipython/examples/parallel/dagdeps.py", "identifier": "validate_tree", "docstring": "Validate that jobs executed after their dependencies.", "docstring_tokens": ["Validate", "that", "jobs", "executed", "after", "their", "dependencies", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253455}
{"url": "https://github.com/gvalkov/tornado-http-auth/blob/9eb225c1740fad1e53320b55d8d4fc6ab4ba58b6/tornado_http_auth.py#L227-L234", "sha": "9eb225c1740fad1e53320b55d8d4fc6ab4ba58b6", "docstring_summary": "Decorator that protect methods with HTTP authentication.", "language": "python", "parameters": "(realm, auth_func)", "return_statement": "return auth_decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "auth_decorator", "(", "arg_2", ")", ":", "def", "inner", "(", "arg_3", ",", "*", "arg_4", ",", "**", "arg_5", ")", ":", "if", "arg_3", ".", "get_authenticated_user", "(", "arg_1", ",", "arg_0", ")", ":", "return", "arg_2", "(", "arg_3", ",", "*", "arg_4", ",", "**", "arg_5", ")", "return", "inner", "return", "auth_decorator"], "function": "def Func(arg_0, arg_1):\n    '''Decorator that protect methods with HTTP authentication.'''\n    def auth_decorator(arg_2):\n        def inner(arg_3, *arg_4, **arg_5):\n            if arg_3.get_authenticated_user(arg_1, arg_0):\n                return arg_2(arg_3, *arg_4, **arg_5)\n        return inner\n    return auth_decorator", "path": "tornado_http_auth.py", "identifier": "auth_required", "docstring": "Decorator that protect methods with HTTP authentication.", "docstring_tokens": ["Decorator", "that", "protect", "methods", "with", "HTTP", "authentication", "."], "nwo": "gvalkov/tornado-http-auth", "score": 0.1932061317920365, "idx": 253456}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L279-L292", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "Reanalyze data for a single ABF. Also remakes child and parent html.", "language": "python", "parameters": "(abfFname)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "arg_0", ")", "and", "arg_0", ".", "endswith", "(", "\".abf\"", ")", "arg_1", ",", "arg_2", "=", "os", ".", "path", ".", "split", "(", "arg_0", ")", "arg_3", "=", "os", ".", "path", ".", "splitext", "(", "arg_2", ")", "[", "0", "]", "arg_4", "=", "INDEX", "(", "arg_1", ")", "arg_4", ".", "analyzeABF", "(", "arg_3", ")", "arg_4", ".", "scan", "(", ")", "arg_4", ".", "html_single_basic", "(", "[", "arg_3", "]", ",", "overwrite", "=", "True", ")", "arg_4", ".", "html_single_plot", "(", "[", "arg_3", "]", ",", "overwrite", "=", "True", ")", "arg_4", ".", "scan", "(", ")", "arg_4", ".", "html_index", "(", ")", "return"], "function": "def Func(arg_0):\n    \"\"\"Reanalyze data for a single ABF. Also remakes child and parent html.\"\"\"\n    assert os.path.exists(arg_0) and arg_0.endswith(\".abf\")\n    arg_1,arg_2=os.path.split(arg_0)\n    arg_3=os.path.splitext(arg_2)[0]\n    arg_4=INDEX(arg_1)\n    arg_4.analyzeABF(arg_3)\n    arg_4.scan()\n    arg_4.html_single_basic([arg_3],overwrite=True)\n    arg_4.html_single_plot([arg_3],overwrite=True)\n    arg_4.scan()\n    arg_4.html_index()\n\n    return", "path": "swhlab/indexing/indexing.py", "identifier": "analyzeSingle", "docstring": "Reanalyze data for a single ABF. Also remakes child and parent html.", "docstring_tokens": ["Reanalyze", "data", "for", "a", "single", "ABF", ".", "Also", "remakes", "child", "and", "parent", "html", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 253457}
{"url": "https://github.com/rougeth/bottery/blob/1c724b867fa16708d59a3dbba5dd2c3de85147a9/bottery/platforms.py#L92-L112", "sha": "1c724b867fa16708d59a3dbba5dd2c3de85147a9", "docstring_summary": "For each new message, build its platform specific message\n        object and get a response.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "build_message", "(", "arg_1", ")", "if", "not", "arg_2", ":", "logger", ".", "error", "(", "'[%s] Unable to build Message with data, data=%s, error'", ",", "arg_0", ".", "engine_name", ",", "arg_1", ")", "return", "logger", ".", "info", "(", "'[%s] New message from %s: %s'", ",", "arg_0", ".", "engine_name", ",", "arg_2", ".", "user", ",", "arg_2", ".", "text", ")", "arg_3", "=", "await", "arg_0", ".", "get_response", "(", "arg_2", ")", "if", "arg_3", ":", "await", "arg_0", ".", "send_response", "(", "arg_3", ")"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"\n        For each new message, build its platform specific message\n        object and get a response.\n        \"\"\"\n\n        arg_2 = arg_0.build_message(arg_1)\n        if not arg_2:\n            logger.error(\n                '[%s] Unable to build Message with data, data=%s, error',\n                arg_0.engine_name,\n                arg_1\n            )\n            return\n\n        logger.info('[%s] New message from %s: %s', arg_0.engine_name,\n                    arg_2.user, arg_2.text)\n\n        arg_3 = await arg_0.get_response(arg_2)\n        if arg_3:\n            await arg_0.send_response(arg_3)", "path": "bottery/platforms.py", "identifier": "BaseEngine.message_handler", "docstring": "For each new message, build its platform specific message\n        object and get a response.", "docstring_tokens": ["For", "each", "new", "message", "build", "its", "platform", "specific", "message", "object", "and", "get", "a", "response", "."], "nwo": "rougeth/bottery", "score": 0.3189264605695251, "idx": 253458}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/clinvar.py#L160-L188", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Set a clinvar submission ID to 'closed'", "language": "python", "parameters": "(self, user_id, submission_id, status)", "return_statement": "return updated_submission", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "LOG", ".", "info", "(", "'closing clinvar submission \"%s\"'", ",", "arg_2", ")", "if", "arg_3", "==", "'open'", ":", "arg_0", ".", "clinvar_submission_collection", ".", "update_many", "(", "{", "'user_id'", ":", "arg_1", "}", ",", "{", "'$set'", ":", "{", "'status'", ":", "'closed'", ",", "'updated_at'", ":", "datetime", ".", "now", "(", ")", "}", "}", ")", "arg_4", "=", "arg_0", ".", "clinvar_submission_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "ObjectId", "(", "arg_2", ")", "}", ",", "{", "'$set'", ":", "{", "'status'", ":", "arg_3", ",", "'updated_at'", ":", "datetime", ".", "now", "(", ")", "}", "}", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Set a clinvar submission ID to 'closed'\n\n            Args:\n                submission_id(str): the ID of the clinvar submission to close\n\n            Return\n                updated_submission(obj): the submission object with a 'closed' status\n\n        \"\"\"\n        LOG.info('closing clinvar submission \"%s\"', arg_2)\n\n        if arg_3 == 'open': # just close the submission its status does not affect the other submissions for this user\n            # Close all other submissions for this user and then open the desired one\n            arg_0.clinvar_submission_collection.update_many(\n                {'user_id' : arg_1},\n                {'$set' :\n                    {'status' : 'closed', 'updated_at' : datetime.now()}\n                }\n            )\n        arg_4 = arg_0.clinvar_submission_collection.find_one_and_update(\n            {'_id'  : ObjectId(arg_2)},\n            {'$set' :\n                {'status' : arg_3, 'updated_at' : datetime.now()}\n            },\n            return_document=pymongo.ReturnDocument.AFTER\n        )\n\n        return arg_4", "path": "scout/adapter/mongo/clinvar.py", "identifier": "ClinVarHandler.update_clinvar_submission_status", "docstring": "Set a clinvar submission ID to 'closed'\n\n            Args:\n                submission_id(str): the ID of the clinvar submission to close\n\n            Return\n                updated_submission(obj): the submission object with a 'closed' status", "docstring_tokens": ["Set", "a", "clinvar", "submission", "ID", "to", "closed"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253459}
{"url": "https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L508-L528", "sha": "8170e431362dc760589f7d141090fd133dece259", "docstring_summary": "Converts a node set to surface.", "language": "python", "parameters": "(self, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "nodes", ".", "copy", "(", ")", "arg_3", "=", "arg_2", ".", "iloc", "[", "0", "]", ".", "copy", "(", ")", "arg_3", "[", "\"coords\"", "]", "*=", "np", ".", "nan", "arg_3", "[", "\"sets\"", "]", "=", "True", "arg_2", ".", "loc", "[", "0", "]", "=", "arg_3", "arg_5", "=", "arg_0", ".", "split", "(", "\"surfaces\"", ")", ".", "unstack", "(", ")", "arg_6", "=", "pd", ".", "DataFrame", "(", "arg_2", ".", "sets", "[", "arg_1", "]", ".", "loc", "[", "arg_5", ".", "values", ".", "flatten", "(", ")", "]", ".", "values", ".", "reshape", "(", "arg_5", ".", "shape", ")", ".", "prod", "(", "axis", "=", "1", ")", ".", "astype", "(", "np", ".", "bool", ")", ",", "index", "=", "arg_5", ".", "index", ")", ".", "unstack", "(", ")", ".", "fillna", "(", "False", ")", "for", "arg_7", "in", "arg_6", ".", "keys", "(", ")", ":", "arg_0", ".", "elements", "[", "\"surfaces\"", ",", "arg_1", ",", "\"f{0}\"", ".", "format", "(", "arg_7", "[", "1", "]", "+", "1", ")", "]", "=", "arg_6", ".", "loc", "[", ":", ",", "arg_7", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Converts a node set to surface.\n    \"\"\"\n    # Create a dummy node with label 0\n    arg_2 = arg_0.nodes.copy()\n    arg_3 = arg_2.iloc[0].copy()\n    arg_3[\"coords\"] *= np.nan\n    arg_3[\"sets\"] = True\n    arg_2.loc[0] = arg_3\n    # Getting element surfaces\n    arg_5= arg_0.split(\"surfaces\").unstack()\n    # killer hack !\n    arg_6 = pd.DataFrame(\n             arg_2.sets[arg_1].loc[arg_5.values.flatten()]\n                   .values.reshape(arg_5.shape)\n                   .prod(axis = 1)\n                   .astype(np.bool),\n             index = arg_5.index).unstack().fillna(False)\n    for arg_7 in arg_6.keys():\n      arg_0.elements[\"surfaces\", arg_1, \"f{0}\".format(arg_7[1]+1) ] = arg_6.loc[:, arg_7]", "path": "argiope/mesh.py", "identifier": "Mesh.node_set_to_surface", "docstring": "Converts a node set to surface.", "docstring_tokens": ["Converts", "a", "node", "set", "to", "surface", "."], "nwo": "lcharleux/argiope", "score": 0.17185066990864498, "idx": 253460}
{"url": "https://github.com/ellmetha/neojsonrpc/blob/e369b633a727482d5f9e310f0c3337ae5f7265db/neojsonrpc/client.py#L135-L144", "sha": "e369b633a727482d5f9e310f0c3337ae5f7265db", "docstring_summary": "Returns the hash value associated with a specific block index.", "language": "python", "parameters": "(self, block_index, **kwargs)", "return_statement": "return self._call(JSONRPCMethods.GET_BLOCK_HASH.value, [block_index, ], **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "_call", "(", "JSONRPCMethods", ".", "GET_BLOCK_HASH", ".", "value", ",", "[", "arg_1", ",", "]", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\" Returns the hash value associated with a specific block index.\n\n        :param block_index: a block index (block height)\n        :type block_index: int\n        :return: hash of the block associated with the considered index\n        :rtype: str\n\n        \"\"\"\n        return arg_0._call(JSONRPCMethods.GET_BLOCK_HASH.value, [arg_1, ], **arg_2)", "path": "neojsonrpc/client.py", "identifier": "Client.get_block_hash", "docstring": "Returns the hash value associated with a specific block index.\n\n        :param block_index: a block index (block height)\n        :type block_index: int\n        :return: hash of the block associated with the considered index\n        :rtype: str", "docstring_tokens": ["Returns", "the", "hash", "value", "associated", "with", "a", "specific", "block", "index", "."], "nwo": "ellmetha/neojsonrpc", "score": 0.3393344119717767, "idx": 253461}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/account.py#L158-L174", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Load an address provided the public key.", "language": "python", "parameters": "(cls, pubkey, compressed=True, version=56, prefix=None)", "return_statement": "return cls(result, prefix=pubkey.prefix)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "56", ",", "arg_4", "=", "None", ")", ":", "arg_1", "=", "PublicKey", "(", "arg_1", ",", "arg_4", "=", "arg_4", "or", "Prefix", ".", "prefix", ")", "if", "arg_2", ":", "arg_5", "=", "arg_1", ".", "compressed", "(", ")", "else", ":", "arg_5", "=", "arg_1", ".", "uncompressed", "(", ")", "arg_6", "=", "hashlib", ".", "sha256", "(", "unhexlify", "(", "arg_5", ")", ")", ".", "hexdigest", "(", ")", "arg_7", "=", "hexlify", "(", "ripemd160", "(", "arg_6", ")", ")", ".", "decode", "(", "\"ascii\"", ")", "arg_8", "=", "(", "\"%.2x\"", "%", "arg_3", ")", "+", "arg_7", "arg_9", "=", "arg_8", "+", "hexlify", "(", "doublesha256", "(", "arg_8", ")", "[", ":", "4", "]", ")", ".", "decode", "(", "\"ascii\"", ")", "arg_9", "=", "hexlify", "(", "ripemd160", "(", "arg_9", ")", ")", ".", "decode", "(", "\"ascii\"", ")", "return", "arg_0", "(", "arg_9", ",", "arg_4", "=", "arg_1", ".", "prefix", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=56, arg_4=None):\n        \"\"\" Load an address provided the public key.\n\n            Version: 56 => PTS\n        \"\"\"\n        # Ensure this is a public key\n        arg_1 = PublicKey(arg_1, arg_4=arg_4 or Prefix.prefix)\n        if arg_2:\n            arg_5 = arg_1.compressed()\n        else:\n            arg_5 = arg_1.uncompressed()\n        arg_6 = hashlib.sha256(unhexlify(arg_5)).hexdigest()\n        arg_7 = hexlify(ripemd160(arg_6)).decode(\"ascii\")\n        arg_8 = (\"%.2x\" % arg_3) + arg_7\n        arg_9 = arg_8 + hexlify(doublesha256(arg_8)[:4]).decode(\"ascii\")\n        arg_9 = hexlify(ripemd160(arg_9)).decode(\"ascii\")\n        return arg_0(arg_9, arg_4=arg_1.prefix)", "path": "graphenebase/account.py", "identifier": "Address.from_pubkey", "docstring": "Load an address provided the public key.\n\n            Version: 56 => PTS", "docstring_tokens": ["Load", "an", "address", "provided", "the", "public", "key", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 253462}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/rcfile.py#L14-L22", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Merge two dictionaries.", "language": "python", "parameters": "(dict_1, dict_2)", "return_statement": "return dict((str(key), dict_1.get(key) or dict_2.get(key))\n                for key in set(dict_2) | set(dict_1))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "dict", "(", "(", "str", "(", "arg_2", ")", ",", "arg_0", ".", "get", "(", "arg_2", ")", "or", "arg_1", ".", "get", "(", "arg_2", ")", ")", "for", "arg_2", "in", "set", "(", "arg_1", ")", "|", "set", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Merge two dictionaries.\n\n    Values that evaluate to true take priority over falsy values.\n    `dict_1` takes priority over `dict_2`.\n\n    \"\"\"\n    return dict((str(arg_2), arg_0.get(arg_2) or arg_1.get(arg_2))\n                for arg_2 in set(arg_1) | set(arg_0))", "path": "boyle/utils/rcfile.py", "identifier": "merge", "docstring": "Merge two dictionaries.\n\n    Values that evaluate to true take priority over falsy values.\n    `dict_1` takes priority over `dict_2`.", "docstring_tokens": ["Merge", "two", "dictionaries", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 253463}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L246-L255", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Extract an alphabetically sorted list of elements from the\n        material's compounds.", "language": "python", "parameters": "(self)", "return_statement": "return sorted(list(element_set))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "stoich", ".", "elements", "(", "arg_0", ".", "compounds", ")", "return", "sorted", "(", "list", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Extract an alphabetically sorted list of elements from the\n        material's compounds.\n\n        :returns: Alphabetically sorted list of elements.\n        \"\"\"\n\n        arg_1 = stoich.elements(arg_0.compounds)\n        return sorted(list(arg_1))", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "Material._create_element_list", "docstring": "Extract an alphabetically sorted list of elements from the\n        material's compounds.\n\n        :returns: Alphabetically sorted list of elements.", "docstring_tokens": ["Extract", "an", "alphabetically", "sorted", "list", "of", "elements", "from", "the", "material", "s", "compounds", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 253464}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_kvlayer.py#L411-L422", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "extract the parts of a StreamItem that go into a kvlayer key,\n    convert StreamItem to blob for storage.", "language": "python", "parameters": "(si)", "return_statement": "return key, data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "key_for_stream_item", "(", "arg_0", ")", "arg_2", "=", "streamcorpus", ".", "serialize", "(", "arg_0", ")", "arg_3", ",", "arg_2", "=", "streamcorpus", ".", "compress_and_encrypt", "(", "arg_2", ")", "assert", "not", "arg_3", ",", "arg_3", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n    '''\n    extract the parts of a StreamItem that go into a kvlayer key,\n    convert StreamItem to blob for storage.\n\n    return (kvlayer key tuple), data blob\n    '''\n    arg_1 = key_for_stream_item(arg_0)\n    arg_2 = streamcorpus.serialize(arg_0)\n    arg_3, arg_2 = streamcorpus.compress_and_encrypt(arg_2)\n    assert not arg_3, arg_3\n    return arg_1, arg_2", "path": "streamcorpus_pipeline/_kvlayer.py", "identifier": "streamitem_to_key_data", "docstring": "extract the parts of a StreamItem that go into a kvlayer key,\n    convert StreamItem to blob for storage.\n\n    return (kvlayer key tuple), data blob", "docstring_tokens": ["extract", "the", "parts", "of", "a", "StreamItem", "that", "go", "into", "a", "kvlayer", "key", "convert", "StreamItem", "to", "blob", "for", "storage", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 253465}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/explorer/src/python/args.py#L85-L91", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "add optional tracker_url argument", "language": "python", "parameters": "(parser)", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "add_argument", "(", "'--tracker_url'", ",", "metavar", "=", "'(tracker url; default: \"'", "+", "DEFAULT_TRACKER_URL", "+", "'\")'", ",", "type", "=", "str", ",", "default", "=", "DEFAULT_TRACKER_URL", ")", "return", "arg_0"], "function": "def Func(arg_0):\n  \"\"\" add optional tracker_url argument \"\"\"\n  arg_0.add_argument(\n      '--tracker_url',\n      metavar='(tracker url; default: \"' + DEFAULT_TRACKER_URL + '\")',\n      type=str, default=DEFAULT_TRACKER_URL)\n  return arg_0", "path": "heron/tools/explorer/src/python/args.py", "identifier": "add_tracker_url", "docstring": "add optional tracker_url argument", "docstring_tokens": ["add", "optional", "tracker_url", "argument"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253466}
{"url": "https://github.com/ferhatelmas/sexmachine/blob/85d33bb47ccc017676e69788750f116e391f52db/sexmachine/detector.py#L64-L72", "sha": "85d33bb47ccc017676e69788750f116e391f52db", "docstring_summary": "Sets gender and relevant country values for names dictionary of detector", "language": "python", "parameters": "(self, name, gender, country_values)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "'+'", "in", "arg_1", ":", "for", "arg_4", "in", "[", "''", ",", "' '", ",", "'-'", "]", ":", "arg_0", ".", "Func", "(", "arg_1", ".", "replace", "(", "'+'", ",", "arg_4", ")", ",", "arg_2", ",", "arg_3", ")", "else", ":", "if", "arg_1", "not", "in", "arg_0", ".", "names", ":", "arg_0", ".", "names", "[", "arg_1", "]", "=", "{", "}", "arg_0", ".", "names", "[", "arg_1", "]", "[", "arg_2", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Sets gender and relevant country values for names dictionary of detector\"\"\"\n        if '+' in arg_1:\n            for arg_4 in ['', ' ', '-']:\n                arg_0.Func(arg_1.replace('+', arg_4), arg_2, arg_3)\n        else:\n            if arg_1 not in arg_0.names:\n                arg_0.names[arg_1] = {}\n            arg_0.names[arg_1][arg_2] = arg_3", "path": "sexmachine/detector.py", "identifier": "Detector._set", "docstring": "Sets gender and relevant country values for names dictionary of detector", "docstring_tokens": ["Sets", "gender", "and", "relevant", "country", "values", "for", "names", "dictionary", "of", "detector"], "nwo": "ferhatelmas/sexmachine", "score": 0.5262758950020962, "idx": 253467}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/config.py#L148-L154", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Read config values from `kwargs`.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "iitems", "(", "arg_1", ")", ":", "if", "arg_3", "is", "not", "None", ":", "if", "arg_2", "in", "arg_0", ".", "MUST_BE_LIST", "and", "isinstance", "(", "arg_3", ",", "string_class", ")", ":", "arg_3", "=", "[", "arg_3", "]", "setattr", "(", "arg_0", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Read config values from `kwargs`.\"\"\"\n        for arg_2, arg_3 in iitems(arg_1):\n            if arg_3 is not None:\n                if arg_2 in arg_0.MUST_BE_LIST and isinstance(arg_3, string_class):\n                    arg_3 = [arg_3]\n                setattr(arg_0, arg_2, arg_3)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/config.py", "identifier": "CoverageConfig.from_args", "docstring": "Read config values from `kwargs`.", "docstring_tokens": ["Read", "config", "values", "from", "kwargs", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253468}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/model.py#L85-L90", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "In replacement for Deprecated add_path method", "language": "python", "parameters": "(self, nodes, **attr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "nx", ".", "__version__", "[", "0", "]", "==", "\"1\"", ":", "return", "super", "(", ")", ".", "Func", "(", "arg_1", ",", "**", "arg_2", ")", "else", ":", "return", "nx", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"In replacement for Deprecated Func method\"\"\"\n        if nx.__version__[0] == \"1\":\n            return super().Func(arg_1, **arg_2)\n        else:\n            return nx.Func(arg_0, arg_1, **arg_2)", "path": "modelx/core/model.py", "identifier": "DependencyGraph.add_path", "docstring": "In replacement for Deprecated add_path method", "docstring_tokens": ["In", "replacement", "for", "Deprecated", "add_path", "method"], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 253469}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/base.py#L81-L93", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Get impls from their interfaces.", "language": "python", "parameters": "(interfaces)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "arg_0", ",", "Mapping", ")", ":", "return", "{", "arg_1", ":", "arg_0", "[", "arg_1", "]", ".", "_impl", "for", "arg_1", "in", "arg_0", "}", "elif", "isinstance", "(", "arg_0", ",", "Sequence", ")", ":", "return", "[", "arg_0", ".", "_impl", "for", "arg_0", "in", "arg_0", "]", "else", ":", "return", "arg_0", ".", "_impl"], "function": "def Func(arg_0):\n    \"\"\"Get impls from their interfaces.\"\"\"\n    if arg_0 is None:\n        return None\n\n    elif isinstance(arg_0, Mapping):\n        return {arg_1: arg_0[arg_1]._impl for arg_1 in arg_0}\n\n    elif isinstance(arg_0, Sequence):\n        return [arg_0._impl for arg_0 in arg_0]\n\n    else:\n        return arg_0._impl", "path": "modelx/core/base.py", "identifier": "get_impls", "docstring": "Get impls from their interfaces.", "docstring_tokens": ["Get", "impls", "from", "their", "interfaces", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 253470}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/document_utils/document_utils.py#L52-L64", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get gene info from Entrez.", "language": "python", "parameters": "(entrez_ids: Iterable[Union[str, int]])", "return_statement": "return {\n        element.attrib['uid']: {\n            'summary': _sanitize(element.find('Summary').text),\n            'description': element.find('Description').text\n        }\n        for element in tree.findall('./DocumentSummarySet/DocumentSummary')\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "[", "arg_3", ",", "arg_4", "]", "]", ")", ":", "arg_5", "=", "PUBMED_GENE_QUERY_URL", ".", "format", "(", "','", ".", "join", "(", "arg_3", "(", "x", ")", ".", "strip", "(", ")", "for", "x", "in", "arg_0", ")", ")", "arg_6", "=", "requests", ".", "get", "(", "arg_5", ")", "arg_7", "=", "ElementTree", ".", "fromstring", "(", "arg_6", ".", "content", ")", "return", "{", "arg_8", ".", "attrib", "[", "'uid'", "]", ":", "{", "'summary'", ":", "_sanitize", "(", "arg_8", ".", "find", "(", "'Summary'", ")", ".", "text", ")", ",", "'description'", ":", "arg_8", ".", "find", "(", "'Description'", ")", ".", "text", "}", "for", "arg_8", "in", "arg_7", ".", "findall", "(", "'./DocumentSummarySet/DocumentSummary'", ")", "}"], "function": "def Func(arg_0: arg_1[arg_2[arg_3, arg_4]]):\n    \"\"\"Get gene info from Entrez.\"\"\"\n    arg_5 = PUBMED_GENE_QUERY_URL.format(','.join(arg_3(x).strip() for x in arg_0))\n    arg_6 = requests.get(arg_5)\n    arg_7 = ElementTree.fromstring(arg_6.content)\n\n    return {\n        arg_8.attrib['uid']: {\n            'summary': _sanitize(arg_8.find('Summary').text),\n            'description': arg_8.find('Description').text\n        }\n        for arg_8 in arg_7.findall('./DocumentSummarySet/DocumentSummary')\n    }", "path": "src/pybel_tools/document_utils/document_utils.py", "identifier": "get_entrez_gene_data", "docstring": "Get gene info from Entrez.", "docstring_tokens": ["Get", "gene", "info", "from", "Entrez", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253471}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/slicing.py#L158-L162", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Applies a sequence of slice or copy-with-overrides operations to `dist`.", "language": "python", "parameters": "(dist, params_event_ndims, slice_overrides_seq)", "return_statement": "return dist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_2", ":", "arg_0", "=", "_apply_single_step", "(", "arg_0", ",", "arg_1", ",", "arg_3", ",", "arg_4", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Applies a sequence of slice or copy-with-overrides operations to `dist`.\"\"\"\n  for arg_3, arg_4 in arg_2:\n    arg_0 = _apply_single_step(arg_0, arg_1, arg_3, arg_4)\n  return arg_0", "path": "tensorflow_probability/python/distributions/internal/slicing.py", "identifier": "_apply_slice_sequence", "docstring": "Applies a sequence of slice or copy-with-overrides operations to `dist`.", "docstring_tokens": ["Applies", "a", "sequence", "of", "slice", "or", "copy", "-", "with", "-", "overrides", "operations", "to", "dist", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253472}
{"url": "https://github.com/scrapinghub/dateparser/blob/11a761c99d3ee522a3c63756b70c106a579e8b5c/dateparser/languages/dictionary.py#L116-L145", "sha": "11a761c99d3ee522a3c63756b70c106a579e8b5c", "docstring_summary": "Split the date string using translations in locale info.", "language": "python", "parameters": "(self, string, keep_formatting=False)", "return_statement": "return list(filter(bool, chain(*tokens)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_1", ":", "return", "arg_1", "arg_3", "=", "arg_0", ".", "_get_Func_relative_regex_cache", "(", ")", "arg_4", "=", "arg_0", ".", "_get_match_relative_regex_cache", "(", ")", "arg_5", "=", "arg_3", ".", "Func", "(", "arg_1", ")", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_5", ")", ":", "if", "arg_4", ".", "match", "(", "arg_7", ")", ":", "arg_5", "[", "arg_6", "]", "=", "[", "arg_7", "]", "continue", "arg_5", "[", "arg_6", "]", "=", "arg_0", ".", "_Func_by_known_words", "(", "arg_7", ",", "arg_2", ")", "return", "list", "(", "filter", "(", "bool", ",", "chain", "(", "*", "arg_5", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Split the date string using translations in locale info.\n\n        :param string:\n            Date string to be Functed.\n        :type string:\n            str|unicode\n\n        :param keep_formatting:\n            If True, retain formatting of the date string.\n        :type keep_formatting: bool\n\n        :return: A list of string tokens formed after Functing the date string.\n        \"\"\"\n        if not arg_1:\n            return arg_1\n\n        arg_3 = arg_0._get_Func_relative_regex_cache()\n        arg_4 = arg_0._get_match_relative_regex_cache()\n\n        arg_5 = arg_3.Func(arg_1)\n\n        for arg_6, arg_7 in enumerate(arg_5):\n            if arg_4.match(arg_7):\n                arg_5[arg_6] = [arg_7]\n                continue\n            arg_5[arg_6] = arg_0._Func_by_known_words(arg_7, arg_2)\n\n        return list(filter(bool, chain(*arg_5)))", "path": "dateparser/languages/dictionary.py", "identifier": "Dictionary.split", "docstring": "Split the date string using translations in locale info.\n\n        :param string:\n            Date string to be splitted.\n        :type string:\n            str|unicode\n\n        :param keep_formatting:\n            If True, retain formatting of the date string.\n        :type keep_formatting: bool\n\n        :return: A list of string tokens formed after splitting the date string.", "docstring_tokens": ["Split", "the", "date", "string", "using", "translations", "in", "locale", "info", "."], "nwo": "scrapinghub/dateparser", "score": 0.9721260912575203, "idx": 253473}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/code_heatmap.py#L18-L25", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Checks whether path belongs to standard library or installed modules.", "language": "python", "parameters": "(module_path)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'site-packages'", "in", "arg_0", ":", "return", "True", "for", "arg_1", "in", "_STDLIB_PATHS", ":", "if", "fnmatch", ".", "fnmatchcase", "(", "arg_0", ",", "arg_1", "+", "'*'", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"Checks whether path belongs to standard library or installed modules.\"\"\"\n    if 'site-packages' in arg_0:\n        return True\n    for arg_1 in _STDLIB_PATHS:\n        if fnmatch.fnmatchcase(arg_0, arg_1 + '*'):\n            return True\n    return False", "path": "vprof/code_heatmap.py", "identifier": "check_standard_dir", "docstring": "Checks whether path belongs to standard library or installed modules.", "docstring_tokens": ["Checks", "whether", "path", "belongs", "to", "standard", "library", "or", "installed", "modules", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 253474}
{"url": "https://github.com/MuhammedHasan/sklearn_utils/blob/337c3b7a27f4921d12da496f66a2b83ef582b413/sklearn_utils/utils/data_utils.py#L23-L35", "sha": "337c3b7a27f4921d12da496f66a2b83ef582b413", "docstring_summary": "Calculates average dictinary from list of dictionary for give label", "language": "python", "parameters": "(X, y, ref_label)", "return_statement": "return defaultdict(float,\n                       pd.DataFrame.from_records(\n                           filter_by_label(X, y, ref_label)[0]\n                       ).mean().to_dict())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "defaultdict", "(", "float", ",", "pd", ".", "DataFrame", ".", "from_records", "(", "filter_by_label", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "[", "0", "]", ")", ".", "mean", "(", ")", ".", "to_dict", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''\n    Calculates average dictinary from list of dictionary for give label\n\n    :param List[Dict] X: dataset\n    :param list y: labels\n    :param ref_label: reference label\n    '''\n    # TODO: consider to delete defaultdict\n    return defaultdict(float,\n                       pd.DataFrame.from_records(\n                           filter_by_label(arg_0, arg_1, arg_2)[0]\n                       ).mean().to_dict())", "path": "sklearn_utils/utils/data_utils.py", "identifier": "average_by_label", "docstring": "Calculates average dictinary from list of dictionary for give label\n\n    :param List[Dict] X: dataset\n    :param list y: labels\n    :param ref_label: reference label", "docstring_tokens": ["Calculates", "average", "dictinary", "from", "list", "of", "dictionary", "for", "give", "label"], "nwo": "MuhammedHasan/sklearn_utils", "score": 0.23137166388621372, "idx": 253475}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L167-L181", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Updates the header information from the original file to the selection.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "header", "[", "b'foff'", "]", "<", "0", ":", "arg_0", ".", "header", "[", "b'fch1'", "]", "=", "arg_0", ".", "container", ".", "f_stop", "else", ":", "arg_0", ".", "header", "[", "b'fch1'", "]", "=", "arg_0", ".", "container", ".", "f_start", "arg_0", ".", "header", "[", "b'nchans'", "]", "=", "arg_0", ".", "container", ".", "selection_shape", "[", "arg_0", ".", "freq_axis", "]", "arg_0", ".", "header", "[", "b'tstart'", "]", "=", "arg_0", ".", "container", ".", "populate_timestamps", "(", "update_header", "=", "True", ")"], "function": "def Func(arg_0):\n        \"\"\" Updates the header information from the original file to the selection.\n        \"\"\"\n\n        #Updating frequency of first channel from selection\n        if arg_0.header[b'foff'] < 0:\n            arg_0.header[b'fch1'] = arg_0.container.f_stop\n        else:\n            arg_0.header[b'fch1'] = arg_0.container.f_start\n\n        #Updating number of coarse channels.\n        arg_0.header[b'nchans'] = arg_0.container.selection_shape[arg_0.freq_axis]\n\n        #Updating time stamp for first time bin from selection\n        arg_0.header[b'tstart'] = arg_0.container.populate_timestamps(update_header=True)", "path": "blimpy/waterfall.py", "identifier": "Waterfall.__update_header", "docstring": "Updates the header information from the original file to the selection.", "docstring_tokens": ["Updates", "the", "header", "information", "from", "the", "original", "file", "to", "the", "selection", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 253476}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/resource/apiresource.py#L49-L52", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Returns a versioned URI string for this class", "language": "python", "parameters": "(cls)", "return_statement": "return \"/{0}/{1}\".format(base, class_to_api_name(cls.class_name()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'v{0}'", ".", "format", "(", "getattr", "(", "arg_0", ",", "'RESOURCE_VERSION'", ",", "'1'", ")", ")", "return", "\"/{0}/{1}\"", ".", "format", "(", "arg_1", ",", "class_to_api_name", "(", "arg_0", ".", "class_name", "(", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns a versioned URI string for this class\"\"\"\n        arg_1 = 'v{0}'.format(getattr(arg_0, 'RESOURCE_VERSION', '1'))\n        return \"/{0}/{1}\".format(arg_1, class_to_api_name(arg_0.class_name()))", "path": "solvebio/resource/apiresource.py", "identifier": "APIResource.class_url", "docstring": "Returns a versioned URI string for this class", "docstring_tokens": ["Returns", "a", "versioned", "URI", "string", "for", "this", "class"], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 253477}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2058-L2067", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Set the revocation timestamp.", "language": "python", "parameters": "(self, when)", "return_statement": "return _set_asn1_time(dt, when)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_lib", ".", "X509_REVOKED_get0_revocationDate", "(", "arg_0", ".", "_revoked", ")", "return", "_set_asn1_time", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set the revocation timestamp.\n\n        :param bytes when: The timestamp of the revocation,\n            as ASN.1 TIME.\n        :return: ``None``\n        \"\"\"\n        arg_2 = _lib.X509_REVOKED_get0_revocationDate(arg_0._revoked)\n        return _set_asn1_time(arg_2, arg_1)", "path": "src/OpenSSL/crypto.py", "identifier": "Revoked.set_rev_date", "docstring": "Set the revocation timestamp.\n\n        :param bytes when: The timestamp of the revocation,\n            as ASN.1 TIME.\n        :return: ``None``", "docstring_tokens": ["Set", "the", "revocation", "timestamp", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 253478}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L466-L494", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "This method is called when a signal is received.", "language": "python", "parameters": "(self, signum, frame)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "print_method", ":", "arg_0", ".", "print_method", "(", "'\\nProgram received signal %s.'", "%", "arg_0", ".", "signame", ")", "if", "arg_0", ".", "print_stack", ":", "import", "traceback", "arg_3", "=", "traceback", ".", "format_stack", "(", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", "[", "-", "1", "]", "==", "'\\n'", ":", "arg_4", "=", "arg_4", "[", "0", ":", "-", "1", "]", "arg_0", ".", "print_method", "(", "arg_4", ")", "pass", "pass", "if", "arg_0", ".", "b_stop", ":", "arg_5", "=", "arg_0", ".", "dbgr", ".", "core", "arg_6", "=", "arg_5", ".", "trace_hook_suspend", "arg_5", ".", "trace_hook_suspend", "=", "True", "arg_5", ".", "stop_reason", "=", "(", "'intercepting signal %s (%d)'", "%", "(", "arg_0", ".", "signame", ",", "arg_1", ")", ")", "arg_5", ".", "processor", ".", "event_processor", "(", "arg_2", ",", "'signal'", ",", "arg_1", ")", "arg_5", ".", "trace_hook_suspend", "=", "arg_6", "pass", "if", "arg_0", ".", "pass_along", ":", "if", "arg_0", ".", "old_Funcr", ":", "arg_0", ".", "old_Funcr", "(", "arg_1", ",", "arg_2", ")", "pass", "pass", "return"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"This method is called when a signal is received.\"\"\"\n        if arg_0.print_method:\n            arg_0.print_method('\\nProgram received signal %s.'\n                              % arg_0.signame)\n        if arg_0.print_stack:\n            import traceback\n            arg_3 = traceback.format_stack(arg_2)\n            for arg_4 in arg_3:\n                if arg_4[-1] == '\\n': arg_4 = arg_4[0:-1]\n                arg_0.print_method(arg_4)\n                pass\n            pass\n        if arg_0.b_stop:\n            arg_5 = arg_0.dbgr.core\n            arg_6 = arg_5.trace_hook_suspend\n            arg_5.trace_hook_suspend = True\n            arg_5.stop_reason = ('intercepting signal %s (%d)' %\n                                (arg_0.signame, arg_1))\n            arg_5.processor.event_processor(arg_2, 'signal', arg_1)\n            arg_5.trace_hook_suspend = arg_6\n            pass\n        if arg_0.pass_along:\n            # pass the signal to the program\n            if arg_0.old_Funcr:\n                arg_0.old_Funcr(arg_1, arg_2)\n                pass\n            pass\n        return", "path": "trepan/lib/sighandler.py", "identifier": "SigHandler.handle", "docstring": "This method is called when a signal is received.", "docstring_tokens": ["This", "method", "is", "called", "when", "a", "signal", "is", "received", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 253479}
{"url": "https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L478-L483", "sha": "4fe4d928cd6fe3e7564f7362e3996898bda5a285", "docstring_summary": "Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist", "language": "python", "parameters": "(self, src, dst)", "return_statement": "return self._rc_rename(src, dst)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "exists", "(", "arg_2", ")", ":", "return", "False", "return", "arg_0", ".", "_rc_rename", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist\"\n        if arg_0.exists(arg_2):\n            return False\n\n        return arg_0._rc_rename(arg_1, arg_2)", "path": "rediscluster/cluster_client.py", "identifier": "StrictRedisCluster._rc_renamenx", "docstring": "Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist", "docstring_tokens": ["Rename", "key", "src", "to", "dst", "if", "dst", "doesn", "t", "already", "exist"], "nwo": "salimane/rediscluster-py", "score": 0.19802268511144447, "idx": 253480}
{"url": "https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_filter.py#L230-L257", "sha": "d734f892ac4cc35d22746a4f2680425ffaff0927", "docstring_summary": "Filter bot from real users.", "language": "python", "parameters": "(self, user_id)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "small_delay", "(", ")", "arg_1", "=", "arg_0", ".", "convert_to_user_id", "(", "arg_1", ")", "if", "not", "arg_1", ":", "return", "False", "if", "arg_1", "in", "arg_0", ".", "whitelist", ":", "return", "True", "if", "arg_1", "in", "arg_0", ".", "blacklist", ":", "return", "False", "arg_2", "=", "arg_0", ".", "get_user_info", "(", "arg_1", ")", "if", "not", "arg_2", ":", "return", "True", "arg_3", "=", "arg_0", ".", "skipped_file", "if", "\"following_count\"", "in", "arg_2", "and", "arg_2", "[", "\"following_count\"", "]", ">", "arg_0", ".", "max_following_to_block", ":", "arg_4", "=", "'following_count > bot.max_following_to_block, skipping!'", "arg_0", ".", "console_print", "(", "arg_4", ",", "'red'", ")", "arg_3", ".", "append", "(", "arg_1", ")", "return", "False", "if", "search_stop_words_in_user", "(", "arg_0", ",", "arg_2", ")", ":", "arg_4", "=", "'`bot.search_stop_words_in_user` found in user, skipping!'", "arg_3", ".", "append", "(", "arg_1", ")", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Filter bot from real users. \"\"\"\n    arg_0.small_delay()\n    arg_1 = arg_0.convert_to_user_id(arg_1)\n    if not arg_1:\n        return False\n    if arg_1 in arg_0.whitelist:\n        return True\n    if arg_1 in arg_0.blacklist:\n        return False\n\n    arg_2 = arg_0.get_user_info(arg_1)\n    if not arg_2:\n        return True  # closed acc\n\n    arg_3 = arg_0.skipped_file\n    if \"following_count\" in arg_2 and arg_2[\"following_count\"] > arg_0.max_following_to_block:\n        arg_4 = 'following_count > bot.max_following_to_block, skipping!'\n        arg_0.console_print(arg_4, 'red')\n        arg_3.append(arg_1)\n        return False  # massfollower\n\n    if search_stop_words_in_user(arg_0, arg_2):\n        arg_4 = '`bot.search_stop_words_in_user` found in user, skipping!'\n        arg_3.append(arg_1)\n        return False\n\n    return True", "path": "instabot/bot/bot_filter.py", "identifier": "check_not_bot", "docstring": "Filter bot from real users.", "docstring_tokens": ["Filter", "bot", "from", "real", "users", "."], "nwo": "instagrambot/instabot", "score": 0.9915293927020312, "idx": 253481}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/qtconsoleapp.py#L268-L325", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Configure the coloring of the widget", "language": "python", "parameters": "(self, widget)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "config", ".", "ZMQInteractiveShell", ".", "colors", "except", "AttributeError", ":", "arg_2", "=", "None", "try", ":", "arg_3", "=", "arg_0", ".", "config", ".", "IPythonWidget", ".", "syntax_style", "except", "AttributeError", ":", "arg_3", "=", "None", "try", ":", "arg_4", "=", "arg_0", ".", "config", ".", "IPythonWidget", ".", "style_sheet", "except", "AttributeError", ":", "arg_4", "=", "None", "if", "arg_2", ":", "arg_2", "=", "arg_2", ".", "lower", "(", ")", "if", "arg_2", "in", "(", "'lightbg'", ",", "'light'", ")", ":", "arg_2", "=", "'lightbg'", "elif", "arg_2", "in", "(", "'dark'", ",", "'linux'", ")", ":", "arg_2", "=", "'linux'", "else", ":", "arg_2", "=", "'nocolor'", "elif", "arg_3", ":", "if", "arg_3", "==", "'bw'", ":", "arg_2", "=", "'nocolor'", "elif", "styles", ".", "dark_style", "(", "arg_3", ")", ":", "arg_2", "=", "'linux'", "else", ":", "arg_2", "=", "'lightbg'", "else", ":", "arg_2", "=", "None", "if", "arg_3", ":", "arg_1", ".", "style_sheet", "=", "styles", ".", "sheet_from_template", "(", "arg_3", ",", "arg_2", ")", "arg_1", ".", "syntax_style", "=", "arg_3", "arg_1", ".", "_syntax_style_changed", "(", ")", "arg_1", ".", "_style_sheet_changed", "(", ")", "elif", "arg_2", ":", "arg_1", ".", "set_default_style", "(", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "stylesheet", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ".", "stylesheet", ")", ":", "with", "open", "(", "arg_0", ".", "stylesheet", ")", "as", "f", ":", "arg_4", "=", "f", ".", "read", "(", ")", "else", ":", "raise", "IOError", "(", "\"Stylesheet %r not found.\"", "%", "arg_0", ".", "stylesheet", ")", "if", "arg_4", ":", "arg_1", ".", "style_sheet", "=", "arg_4", "arg_1", ".", "_style_sheet_changed", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Configure the coloring of the widget\"\"\"\n        # Note: This will be dramatically simplified when colors\n        # are removed from the backend.\n\n        # parse the colors arg down to current known labels\n        try:\n            arg_2 = arg_0.config.ZMQInteractiveShell.colors\n        except AttributeError:\n            arg_2 = None\n        try:\n            arg_3 = arg_0.config.IPythonWidget.syntax_style\n        except AttributeError:\n            arg_3 = None\n        try:\n            arg_4 = arg_0.config.IPythonWidget.style_sheet\n        except AttributeError:\n            arg_4 = None\n\n        # find the value for colors:\n        if arg_2:\n            arg_2=arg_2.lower()\n            if arg_2 in ('lightbg', 'light'):\n                arg_2='lightbg'\n            elif arg_2 in ('dark', 'linux'):\n                arg_2='linux'\n            else:\n                arg_2='nocolor'\n        elif arg_3:\n            if arg_3=='bw':\n                arg_2='nocolor'\n            elif styles.dark_style(arg_3):\n                arg_2='linux'\n            else:\n                arg_2='lightbg'\n        else:\n            arg_2=None\n\n        # Configure the style\n        if arg_3:\n            arg_1.style_sheet = styles.sheet_from_template(arg_3, arg_2)\n            arg_1.syntax_style = arg_3\n            arg_1._syntax_style_changed()\n            arg_1._style_sheet_changed()\n        elif arg_2:\n            # use a default dark/light/bw style\n            arg_1.set_default_style(arg_2=arg_2)\n\n        if arg_0.stylesheet:\n            # we got an explicit stylesheet\n            if os.path.isfile(arg_0.stylesheet):\n                with open(arg_0.stylesheet) as f:\n                    arg_4 = f.read()\n            else:\n                raise IOError(\"Stylesheet %r not found.\" % arg_0.stylesheet)\n        if arg_4:\n            arg_1.style_sheet = arg_4\n            arg_1._style_sheet_changed()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/qtconsoleapp.py", "identifier": "IPythonQtConsoleApp.init_colors", "docstring": "Configure the coloring of the widget", "docstring_tokens": ["Configure", "the", "coloring", "of", "the", "widget"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253482}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/util.py#L139-L160", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Components are positioned relative to their container. Use this\n        method to position the bottom-left corner of the components at\n        the origin.", "language": "python", "parameters": "(components)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ":", "if", "isinstance", "(", "arg_1", ",", "Ellipse", ")", ":", "arg_1", ".", "x_origin", "=", "arg_1", ".", "e_width", "arg_1", ".", "y_origin", "=", "arg_1", ".", "e_height", "elif", "isinstance", "(", "arg_1", ",", "(", "Polygon", ",", "BSpline", ")", ")", ":", "arg_4", "=", "min", "(", "[", "t", "[", "0", "]", "for", "t", "in", "arg_1", ".", "points", "]", ")", "arg_5", "=", "min", "(", "[", "t", "[", "1", "]", "for", "t", "in", "arg_1", ".", "points", "]", ")", "arg_1", ".", "points", "=", "[", "(", "p", "[", "0", "]", "-", "arg_4", ",", "p", "[", "1", "]", "-", "arg_5", ")", "for", "p", "in", "arg_1", ".", "points", "]", "elif", "isinstance", "(", "arg_1", ",", "Text", ")", ":", "arg_7", "=", "str_to_font", "(", "str", "(", "arg_1", ".", "pen", ".", "font", ")", ")", "arg_1", ".", "text_x", "=", "0", "arg_1", ".", "text_y", "=", "0"], "function": "def Func(arg_0):\n    \"\"\" Components are positioned relative to their container. Use this\n        method to position the bottom-left corner of the components at\n        the origin.\n    \"\"\"\n    for arg_1 in arg_0:\n        if isinstance(arg_1, Ellipse):\n            arg_1.x_origin = arg_1.e_width\n            arg_1.y_origin = arg_1.e_height\n\n        elif isinstance(arg_1, (Polygon, BSpline)):\n            arg_4 = min( [t[0] for t in arg_1.points] )\n            arg_5 = min( [t[1] for t in arg_1.points] )\n\n            arg_1.points = [\n                ( p[0]-arg_4, p[1]-arg_5 ) for p in arg_1.points\n            ]\n\n        elif isinstance(arg_1, Text):\n            arg_7 = str_to_font( str(arg_1.pen.font) )\n            arg_1.text_x = 0#-( component.text_w / 2 )\n            arg_1.text_y = 0", "path": "godot/util.py", "identifier": "move_to_origin", "docstring": "Components are positioned relative to their container. Use this\n        method to position the bottom-left corner of the components at\n        the origin.", "docstring_tokens": ["Components", "are", "positioned", "relative", "to", "their", "container", ".", "Use", "this", "method", "to", "position", "the", "bottom", "-", "left", "corner", "of", "the", "components", "at", "the", "origin", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 253483}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/provenance.py#L224-L238", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Count the number of citations from each year.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "return count_dict_values(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "typing", ".", "Counter", "[", "int", "]", ":", "arg_2", "=", "defaultdict", "(", "set", ")", "for", "arg_3", ",", "arg_3", ",", "arg_4", "in", "arg_0", ".", "edges", "(", "arg_4", "=", "True", ")", ":", "if", "CITATION", "not", "in", "arg_4", "or", "CITATION_DATE", "not", "in", "arg_4", "[", "CITATION", "]", ":", "continue", "try", ":", "arg_5", "=", "_ensure_datetime", "(", "arg_4", "[", "CITATION", "]", "[", "CITATION_DATE", "]", ")", "arg_2", "[", "arg_5", ".", "year", "]", ".", "add", "(", "(", "arg_4", "[", "CITATION", "]", "[", "CITATION_TYPE", "]", ",", "arg_4", "[", "CITATION", "]", "[", "CITATION_REFERENCE", "]", ")", ")", "except", "Exception", ":", "continue", "return", "count_dict_values", "(", "arg_2", ")"], "function": "def Func(arg_0: arg_1) -> typing.Counter[int]:\n    \"\"\"Count the number of citations from each year.\"\"\"\n    arg_2 = defaultdict(set)\n\n    for arg_3, arg_3, arg_4 in arg_0.edges(arg_4=True):\n        if CITATION not in arg_4 or CITATION_DATE not in arg_4[CITATION]:\n            continue\n\n        try:\n            arg_5 = _ensure_datetime(arg_4[CITATION][CITATION_DATE])\n            arg_2[arg_5.year].add((arg_4[CITATION][CITATION_TYPE], arg_4[CITATION][CITATION_REFERENCE]))\n        except Exception:\n            continue\n\n    return count_dict_values(arg_2)", "path": "src/pybel_tools/summary/provenance.py", "identifier": "count_citation_years", "docstring": "Count the number of citations from each year.", "docstring_tokens": ["Count", "the", "number", "of", "citations", "from", "each", "year", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253484}
{"url": "https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L197-L238", "sha": "ca219db41eb56bdd1c0389cdc1508a41698958d7", "docstring_summary": "Gets the raw record.", "language": "python", "parameters": "(self, instance, update_fields=None)", "return_statement": "return tmp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "'objectID'", ":", "arg_0", ".", "objectID", "(", "arg_1", ")", "}", "if", "arg_2", ":", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_2", "=", "(", "arg_2", ",", ")", "for", "arg_4", "in", "arg_2", ":", "arg_5", "=", "arg_0", ".", "__translate_fields", ".", "get", "(", "arg_4", ",", "None", ")", "if", "arg_5", ":", "arg_3", "[", "arg_5", "]", "=", "arg_0", ".", "__named_fields", "[", "arg_5", "]", "(", "arg_1", ")", "else", ":", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "__named_fields", ".", "items", "(", ")", ":", "arg_3", "[", "arg_5", "]", "=", "arg_6", "(", "arg_1", ")", "if", "arg_0", ".", "geo_field", ":", "arg_7", "=", "arg_0", ".", "geo_field", "(", "arg_1", ")", "if", "isinstance", "(", "arg_7", ",", "tuple", ")", ":", "arg_3", "[", "'_geoloc'", "]", "=", "{", "'lat'", ":", "arg_7", "[", "0", "]", ",", "'lng'", ":", "arg_7", "[", "1", "]", "}", "elif", "isinstance", "(", "arg_7", ",", "dict", ")", ":", "arg_0", ".", "_validate_geolocation", "(", "arg_7", ")", "arg_3", "[", "'_geoloc'", "]", "=", "arg_7", "elif", "isinstance", "(", "arg_7", ",", "list", ")", ":", "[", "arg_0", ".", "_validate_geolocation", "(", "arg_8", ")", "for", "arg_8", "in", "arg_7", "]", "arg_3", "[", "'_geoloc'", "]", "=", "arg_7", "if", "arg_0", ".", "tags", ":", "if", "callable", "(", "arg_0", ".", "tags", ")", ":", "arg_3", "[", "'_tags'", "]", "=", "arg_0", ".", "tags", "(", "arg_1", ")", "if", "not", "isinstance", "(", "arg_3", "[", "'_tags'", "]", ",", "list", ")", ":", "arg_3", "[", "'_tags'", "]", "=", "list", "(", "arg_3", "[", "'_tags'", "]", ")", "logger", ".", "debug", "(", "'BUILD %s FROM %s'", ",", "arg_3", "[", "'objectID'", "]", ",", "arg_0", ".", "model", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Gets the raw record.\n\n        If `update_fields` is set, the raw record will be build with only\n        the objectID and the given fields. Also, `_geoloc` and `_tags` will\n        not be included.\n        \"\"\"\n        arg_3 = {'objectID': arg_0.objectID(arg_1)}\n\n        if arg_2:\n            if isinstance(arg_2, str):\n                arg_2 = (arg_2,)\n\n            for arg_4 in arg_2:\n                arg_5 = arg_0.__translate_fields.get(arg_4, None)\n                if arg_5:\n                    arg_3[arg_5] = arg_0.__named_fields[arg_5](arg_1)\n        else:\n            for arg_5, arg_6 in arg_0.__named_fields.items():\n                arg_3[arg_5] = arg_6(arg_1)\n\n            if arg_0.geo_field:\n                arg_7 = arg_0.geo_field(arg_1)\n\n                if isinstance(arg_7, tuple):\n                    arg_3['_geoloc'] = {'lat': arg_7[0], 'lng': arg_7[1]}\n                elif isinstance(arg_7, dict):\n                    arg_0._validate_geolocation(arg_7)\n                    arg_3['_geoloc'] = arg_7\n                elif isinstance(arg_7, list):\n                    [arg_0._validate_geolocation(arg_8) for arg_8 in arg_7]\n                    arg_3['_geoloc'] = arg_7\n\n            if arg_0.tags:\n                if callable(arg_0.tags):\n                    arg_3['_tags'] = arg_0.tags(arg_1)\n                if not isinstance(arg_3['_tags'], list):\n                    arg_3['_tags'] = list(arg_3['_tags'])\n\n        logger.debug('BUILD %s FROM %s', arg_3['objectID'], arg_0.model)\n        return arg_3", "path": "algoliasearch_django/models.py", "identifier": "AlgoliaIndex.get_raw_record", "docstring": "Gets the raw record.\n\n        If `update_fields` is set, the raw record will be build with only\n        the objectID and the given fields. Also, `_geoloc` and `_tags` will\n        not be included.", "docstring_tokens": ["Gets", "the", "raw", "record", "."], "nwo": "algolia/algoliasearch-django", "score": 0.7567196870624601, "idx": 253485}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/bounds.py#L446-L509", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Expand a range with a multiplicative or additive constant", "language": "python", "parameters": "(range, mul=0, add=0, zero_width=1)", "return_statement": "return new", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "1", ")", ":", "arg_4", "=", "arg_0", "try", ":", "arg_4", "[", "0", "]", "except", "TypeError", ":", "arg_4", "=", "(", "arg_4", ",", "arg_4", ")", "if", "zero_range", "(", "arg_4", ")", ":", "arg_5", "=", "arg_4", "[", "0", "]", "-", "arg_3", "/", "2", ",", "arg_4", "[", "0", "]", "+", "arg_3", "/", "2", "else", ":", "arg_6", "=", "(", "arg_4", "[", "1", "]", "-", "arg_4", "[", "0", "]", ")", "*", "arg_1", "+", "arg_2", "arg_5", "=", "arg_4", "[", "0", "]", "-", "arg_6", ",", "arg_4", "[", "1", "]", "+", "arg_6", "return", "arg_5"], "function": "def Func(arg_0, arg_1=0, arg_2=0, arg_3=1):\n    \"\"\"\n    Expand a range with a multiplicative or additive constant\n\n    Parameters\n    ----------\n    range : tuple\n        Range of data. Size 2.\n    mul : int | float\n        Multiplicative constant\n    add : int | float | timedelta\n        Additive constant\n    zero_width : int | float | timedelta\n        Distance to use if range has zero width\n\n    Returns\n    -------\n    out : tuple\n        Expanded range\n\n    Examples\n    --------\n    >>> Func((3, 8))\n    (3, 8)\n    >>> Func((0, 10), mul=0.1)\n    (-1.0, 11.0)\n    >>> Func((0, 10), add=2)\n    (-2, 12)\n    >>> Func((0, 10), mul=.1, add=2)\n    (-3.0, 13.0)\n    >>> Func((0, 1))\n    (0, 1)\n\n    When the range has zero width\n\n    >>> Func((5, 5))\n    (4.5, 5.5)\n\n    Notes\n    -----\n    If expanding *datetime* or *timedelta* types, **add** and\n    **zero_width** must be suitable *timedeltas* i.e. You should\n    not mix types between **Numpy**, **Pandas** and the\n    :mod:`datetime` module.\n\n    In Python 2, you cannot multiplicative constant **mul** cannot be\n    a :class:`float`.\n    \"\"\"\n    arg_4 = arg_0\n\n    # Enforce tuple\n    try:\n        arg_4[0]\n    except TypeError:\n        arg_4 = (arg_4, arg_4)\n\n    # The expansion cases\n    if zero_range(arg_4):\n        arg_5 = arg_4[0]-arg_3/2, arg_4[0]+arg_3/2\n    else:\n        arg_6 = (arg_4[1] - arg_4[0]) * arg_1 + arg_2\n        arg_5 = arg_4[0]-arg_6, arg_4[1]+arg_6\n\n    return arg_5", "path": "mizani/bounds.py", "identifier": "expand_range", "docstring": "Expand a range with a multiplicative or additive constant\n\n    Parameters\n    ----------\n    range : tuple\n        Range of data. Size 2.\n    mul : int | float\n        Multiplicative constant\n    add : int | float | timedelta\n        Additive constant\n    zero_width : int | float | timedelta\n        Distance to use if range has zero width\n\n    Returns\n    -------\n    out : tuple\n        Expanded range\n\n    Examples\n    --------\n    >>> expand_range((3, 8))\n    (3, 8)\n    >>> expand_range((0, 10), mul=0.1)\n    (-1.0, 11.0)\n    >>> expand_range((0, 10), add=2)\n    (-2, 12)\n    >>> expand_range((0, 10), mul=.1, add=2)\n    (-3.0, 13.0)\n    >>> expand_range((0, 1))\n    (0, 1)\n\n    When the range has zero width\n\n    >>> expand_range((5, 5))\n    (4.5, 5.5)\n\n    Notes\n    -----\n    If expanding *datetime* or *timedelta* types, **add** and\n    **zero_width** must be suitable *timedeltas* i.e. You should\n    not mix types between **Numpy**, **Pandas** and the\n    :mod:`datetime` module.\n\n    In Python 2, you cannot multiplicative constant **mul** cannot be\n    a :class:`float`.", "docstring_tokens": ["Expand", "a", "range", "with", "a", "multiplicative", "or", "additive", "constant"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 253486}
{"url": "https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L912-L932", "sha": "08e0319ff3c70f8a931dfa8890caf48add4d0470", "docstring_summary": "Return the url corresponding to the given notebook file", "language": "python", "parameters": "(self, nbfile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "urls", "if", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "return", "arg_2", ".", "get", "(", "arg_1", ")", "elif", "isstring", "(", "arg_2", ")", ":", "if", "not", "arg_2", ".", "endswith", "(", "'/'", ")", ":", "arg_2", "+=", "'/'", "return", "arg_2", "+", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the url corresponding to the given notebook file\n\n        Parameters\n        ----------\n        nbfile: str\n            The path of the notebook relative to the corresponding\n            :attr:``in_dir``\n\n        Returns\n        -------\n        str or None\n            The url or None if no url has been specified\n        \"\"\"\n        arg_2 = arg_0.urls\n        if isinstance(arg_2, dict):\n            return arg_2.get(arg_1)\n        elif isstring(arg_2):\n            if not arg_2.endswith('/'):\n                arg_2 += '/'\n            return arg_2 + arg_1", "path": "sphinx_nbexamples/__init__.py", "identifier": "Gallery.get_url", "docstring": "Return the url corresponding to the given notebook file\n\n        Parameters\n        ----------\n        nbfile: str\n            The path of the notebook relative to the corresponding\n            :attr:``in_dir``\n\n        Returns\n        -------\n        str or None\n            The url or None if no url has been specified", "docstring_tokens": ["Return", "the", "url", "corresponding", "to", "the", "given", "notebook", "file"], "nwo": "Chilipp/sphinx-nbexamples", "score": 0.28168436607245656, "idx": 253487}
{"url": "https://github.com/swistakm/pyimgui/blob/04dd78053900bf69e0ce7638d1b7036bf2181982/doc/source/custom_directives.py#L152-L159", "sha": "04dd78053900bf69e0ce7638d1b7036bf2181982", "docstring_summary": "Convert phrase to normilized file name.", "language": "python", "parameters": "(self, phrase)", "return_statement": "return name + '.png'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "re", ".", "sub", "(", "r\"[^\\w\\s\\.]\"", ",", "''", ",", "arg_1", ".", "strip", "(", ")", ".", "lower", "(", ")", ")", "arg_2", "=", "re", ".", "sub", "(", "r\"\\s+\"", ",", "'_'", ",", "arg_2", ")", "return", "arg_2", "+", "'.png'"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert phrase to normilized file name.\"\"\"\n        # remove non-word characters\n        arg_2 = re.sub(r\"[^\\w\\s\\.]\", '', arg_1.strip().lower())\n        # replace whitespace with underscores\n        arg_2 = re.sub(r\"\\s+\", '_', arg_2)\n\n        return arg_2 + '.png'", "path": "doc/source/custom_directives.py", "identifier": "VisualDirective.phrase_to_filename", "docstring": "Convert phrase to normilized file name.", "docstring_tokens": ["Convert", "phrase", "to", "normilized", "file", "name", "."], "nwo": "swistakm/pyimgui", "score": 0.9379094207198884, "idx": 253488}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L277-L291", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get merge notes", "language": "python", "parameters": "(self, merge_id)", "return_statement": "return notes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_0", ".", "client", ".", "notes", "(", "GitLabClient", ".", "MERGES", ",", "arg_1", ")", "for", "arg_4", "in", "arg_3", ":", "for", "arg_5", "in", "json", ".", "loads", "(", "arg_4", ")", ":", "arg_6", "=", "arg_5", "[", "'id'", "]", "arg_5", "[", "'award_emoji_data'", "]", "=", "arg_0", ".", "__get_note_award_emoji", "(", "GitLabClient", ".", "MERGES", ",", "arg_1", ",", "arg_6", ")", "arg_2", ".", "append", "(", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get merge notes\"\"\"\n\n        arg_2 = []\n\n        arg_3 = arg_0.client.notes(GitLabClient.MERGES, arg_1)\n\n        for arg_4 in arg_3:\n            for arg_5 in json.loads(arg_4):\n                arg_6 = arg_5['id']\n                arg_5['award_emoji_data'] = \\\n                    arg_0.__get_note_award_emoji(GitLabClient.MERGES, arg_1, arg_6)\n                arg_2.append(arg_5)\n\n        return arg_2", "path": "perceval/backends/core/gitlab.py", "identifier": "GitLab.__get_merge_notes", "docstring": "Get merge notes", "docstring_tokens": ["Get", "merge", "notes"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253489}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/project/application/__init__.py#L79-L125", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Register jinja filters, vars, functions.", "language": "python", "parameters": "(app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "jinja2", "from", ".", "utils", "import", "filters", ",", "permissions", ",", "helpers", "if", "arg_0", ".", "debug", "or", "arg_0", ".", "testing", ":", "arg_1", "=", "jinja2", ".", "ChoiceLoader", "(", "[", "arg_0", ".", "jinja_loader", ",", "jinja2", ".", "FileSystemLoader", "(", "[", "os", ".", "path", ".", "join", "(", "arg_0", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'application/macros'", ")", ",", "os", ".", "path", ".", "join", "(", "arg_0", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'application/pages'", ")", "]", ")", "]", ")", "else", ":", "arg_1", "=", "jinja2", ".", "ChoiceLoader", "(", "[", "arg_0", ".", "jinja_loader", ",", "jinja2", ".", "FileSystemLoader", "(", "[", "os", ".", "path", ".", "join", "(", "arg_0", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'output/macros'", ")", ",", "os", ".", "path", ".", "join", "(", "arg_0", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'output/pages'", ")", "]", ")", "]", ")", "arg_0", ".", "jinja_loader", "=", "arg_1", "arg_0", ".", "jinja_env", ".", "filters", ".", "update", "(", "{", "'timesince'", ":", "filters", ".", "timesince", "}", ")", "def", "url_for_other_page", "(", "arg_3", ")", ":", "arg_4", "=", "request", ".", "view_args", ".", "copy", "(", ")", "arg_5", "=", "request", ".", "args", ".", "copy", "(", ")", ".", "to_dict", "(", ")", "arg_6", "=", "dict", "(", "arg_4", ".", "items", "(", ")", "+", "arg_5", ".", "items", "(", ")", ")", "arg_6", "[", "'page'", "]", "=", "arg_3", "return", "url_for", "(", "request", ".", "endpoint", ",", "**", "arg_6", ")", "arg_7", "=", "{", "}", "for", "arg_8", ",", "arg_9", "in", "iteritems", "(", "arg_0", ".", "url_map", ".", "_rules_by_endpoint", ")", ":", "if", "any", "(", "arg_10", "in", "arg_8", "for", "arg_10", "in", "[", "'_debug_toolbar'", ",", "'debugtoolbar'", ",", "'static'", "]", ")", ":", "continue", "arg_7", "[", "arg_8", "]", "=", "[", "{", "'rule'", ":", "rule", ".", "rule", "}", "for", "rule", "in", "arg_9", "]", "arg_0", ".", "jinja_env", ".", "globals", ".", "update", "(", "{", "'absolute_url_for'", ":", "helpers", ".", "absolute_url_for", ",", "'url_for_other_page'", ":", "url_for_other_page", ",", "'rules'", ":", "arg_7", ",", "'permissions'", ":", "permissions", "}", ")"], "function": "def Func(arg_0):\n    \"\"\"Register jinja filters, vars, functions.\"\"\"\n    import jinja2\n    from .utils import filters, permissions, helpers\n\n    if arg_0.debug or arg_0.testing:\n        arg_1 = jinja2.ChoiceLoader([\n            arg_0.jinja_loader,\n            jinja2.FileSystemLoader([\n                os.path.join(arg_0.config.get('PROJECT_PATH'), 'application/macros'),\n                os.path.join(arg_0.config.get('PROJECT_PATH'), 'application/pages')\n            ])\n        ])\n    else:\n        arg_1 = jinja2.ChoiceLoader([\n            arg_0.jinja_loader,\n            jinja2.FileSystemLoader([\n                os.path.join(arg_0.config.get('PROJECT_PATH'), 'output/macros'),\n                os.path.join(arg_0.config.get('PROJECT_PATH'), 'output/pages')\n            ])\n        ])\n    arg_0.jinja_loader = arg_1\n\n    arg_0.jinja_env.filters.update({\n        'timesince': filters.timesince\n    })\n\n    def url_for_other_page(arg_3):\n        \"\"\"Generate url for pagination.\"\"\"\n        arg_4 = request.view_args.copy()\n        arg_5 = request.args.copy().to_dict()\n        arg_6 = dict(arg_4.items() + arg_5.items())\n        arg_6['page'] = arg_3\n        return url_for(request.endpoint, **arg_6)\n\n    arg_7 = {}\n    for arg_8, arg_9 in iteritems(arg_0.url_map._rules_by_endpoint):\n        if any(arg_10 in arg_8 for arg_10 in ['_debug_toolbar', 'debugtoolbar', 'static']):\n            continue\n        arg_7[arg_8] = [{'rule': rule.rule} for rule in arg_9]\n\n    arg_0.jinja_env.globals.update({\n        'absolute_url_for': helpers.absolute_url_for,\n        'url_for_other_page': url_for_other_page,\n        'rules': arg_7,\n        'permissions': permissions\n    })", "path": "flask_boost/project/application/__init__.py", "identifier": "register_jinja", "docstring": "Register jinja filters, vars, functions.", "docstring_tokens": ["Register", "jinja", "filters", "vars", "functions", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 253490}
{"url": "https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/setup.py#L76-L102", "sha": "6b4d27eb1a1eaf188c6885c7364ef27e92b1b957", "docstring_summary": "Attempts to find the Teradata install directory with the defaults\n    for a given platform.  Should always return `None` when the defaults\n    are not present and the TERADATA_HOME environment variable wasn't\n    explicitly set to the correct install location.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "'Windows'", ":", "if", "is_64bit", "(", ")", ":", "return", "latest_teradata_version", "(", "\"C:/Program Files/Teradata/Client\"", ")", "else", ":", "return", "latest_teradata_version", "(", "\"C:/Program Files (x86)/Teradata/Client\"", ")", "elif", "platform", ".", "system", "(", ")", "==", "'Linux'", ":", "return", "latest_teradata_version", "(", "\"/opt/teradata/client\"", ")", "elif", "platform", ".", "system", "(", ")", "==", "'Darwin'", ":", "return", "latest_teradata_version", "(", "\"/Library/Application Support/teradata/client\"", ")", "else", ":", "return", "latest_teradata_version", "(", "\"/opt/teradata/client\"", ")"], "function": "def Func():\n    \"\"\"\n    Attempts to find the Teradata install directory with the defaults\n    for a given platform.  Should always return `None` when the defaults\n    are not present and the TERADATA_HOME environment variable wasn't\n    explicitly set to the correct install location.\n    \"\"\"\n    if platform.system() == 'Windows':\n        # The default installation path for Windows is split between the\n        # Windows directories for 32-bit/64-bit applications.  It is\n        # worth noting that Teradata archiecture installed should match\n        # the architecture of the Python architecture being used (i.e.\n        # TTU 32-bit is required /w Python 32-bit and TTU 64-bit is\n        # required for Python 64-bit).\n        if is_64bit():\n            return latest_teradata_version(\"C:/Program Files/Teradata/Client\")\n        else:\n            return latest_teradata_version(\"C:/Program Files (x86)/Teradata/Client\")\n    elif platform.system() == 'Linux':\n        return latest_teradata_version(\"/opt/teradata/client\")\n    elif platform.system() == 'Darwin':\n        return latest_teradata_version(\"/Library/Application Support/teradata/client\")\n    else:\n        # In the case nothing is found, the default for Linux is\n        # attempted as a last effort to find the correct install\n        # directory.\n        return latest_teradata_version(\"/opt/teradata/client\")", "path": "setup.py", "identifier": "find_teradata_home", "docstring": "Attempts to find the Teradata install directory with the defaults\n    for a given platform.  Should always return `None` when the defaults\n    are not present and the TERADATA_HOME environment variable wasn't\n    explicitly set to the correct install location.", "docstring_tokens": ["Attempts", "to", "find", "the", "Teradata", "install", "directory", "with", "the", "defaults", "for", "a", "given", "platform", ".", "Should", "always", "return", "None", "when", "the", "defaults", "are", "not", "present", "and", "the", "TERADATA_HOME", "environment", "variable", "wasn", "t", "explicitly", "set", "to", "the", "correct", "install", "location", "."], "nwo": "capitalone/giraffez", "score": 0.19842634881568408, "idx": 253491}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/utils.py#L45-L56", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Acquire the lock to read", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_order_mutex", ".", "acquire", "(", ")", "arg_0", ".", "_readers_mutex", ".", "acquire", "(", ")", "if", "arg_0", ".", "_readers", "==", "0", ":", "arg_0", ".", "_access_mutex", ".", "acquire", "(", ")", "arg_0", ".", "_readers", "+=", "1", "arg_0", ".", "_order_mutex", ".", "release", "(", ")", "arg_0", ".", "_readers_mutex", ".", "release", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Acquire the lock to read\"\"\"\n\n        arg_0._order_mutex.acquire()\n        arg_0._readers_mutex.acquire()\n\n        if arg_0._readers == 0:\n            arg_0._access_mutex.acquire()\n        arg_0._readers += 1\n\n        arg_0._order_mutex.release()\n        arg_0._readers_mutex.release()", "path": "arthur/utils.py", "identifier": "RWLock.reader_acquire", "docstring": "Acquire the lock to read", "docstring_tokens": ["Acquire", "the", "lock", "to", "read"], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 253492}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1705-L1779", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Method to stream data into BigQuery one record at a time without needing\n        to run a load job", "language": "python", "parameters": "(self, project_id, dataset_id, table_id,\n                   rows, ignore_unknown_values=False,\n                   skip_invalid_rows=False, fail_on_error=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ")", ":", "arg_8", "=", "arg_1", "if", "arg_1", "else", "arg_0", ".", "project_id", "arg_9", "=", "{", "\"rows\"", ":", "arg_4", ",", "\"ignoreUnknownValues\"", ":", "arg_5", ",", "\"kind\"", ":", "\"bigquery#tableDataInsertAllRequest\"", ",", "\"skipInvalidRows\"", ":", "arg_6", ",", "}", "try", ":", "arg_0", ".", "log", ".", "info", "(", "'Inserting %s row(s) into Table %s:%s.%s'", ",", "len", "(", "arg_4", ")", ",", "arg_8", ",", "arg_2", ",", "arg_3", ")", "arg_10", "=", "arg_0", ".", "service", ".", "tabledata", "(", ")", ".", "insertAll", "(", "projectId", "=", "arg_8", ",", "datasetId", "=", "arg_2", ",", "tableId", "=", "arg_3", ",", "arg_9", "=", "arg_9", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "if", "'insertErrors'", "not", "in", "arg_10", ":", "arg_0", ".", "log", ".", "info", "(", "'All row(s) inserted successfully: %s:%s.%s'", ",", "arg_8", ",", "arg_2", ",", "arg_3", ")", "else", ":", "arg_11", "=", "'{} insert error(s) occurred: {}:{}.{}. Details: {}'", ".", "format", "(", "len", "(", "arg_10", "[", "'insertErrors'", "]", ")", ",", "arg_8", ",", "arg_2", ",", "arg_3", ",", "arg_10", "[", "'insertErrors'", "]", ")", "if", "arg_7", ":", "raise", "AirflowException", "(", "'BigQuery job failed. Error was: {}'", ".", "format", "(", "arg_11", ")", ")", "arg_0", ".", "log", ".", "info", "(", "arg_11", ")", "except", "HttpError", "as", "err", ":", "raise", "AirflowException", "(", "'BigQuery job failed. Error was: {}'", ".", "format", "(", "err", ".", "content", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                   arg_4, arg_5=False,\n                   arg_6=False, arg_7=False):\n        \"\"\"\n        Method to stream data into BigQuery one record at a time without needing\n        to run a load job\n\n        .. seealso::\n            For more information, see:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll\n\n        :param project_id: The name of the project where we have the table\n        :type project_id: str\n        :param dataset_id: The name of the dataset where we have the table\n        :type dataset_id: str\n        :param table_id: The name of the table\n        :type table_id: str\n        :param rows: the rows to insert\n        :type rows: list\n\n        **Example or rows**:\n            rows=[{\"json\": {\"a_key\": \"a_value_0\"}}, {\"json\": {\"a_key\": \"a_value_1\"}}]\n\n        :param ignore_unknown_values: [Optional] Accept rows that contain values\n            that do not match the schema. The unknown values are ignored.\n            The default value  is false, which treats unknown values as errors.\n        :type ignore_unknown_values: bool\n        :param skip_invalid_rows: [Optional] Insert all valid rows of a request,\n            even if invalid rows exist. The default value is false, which causes\n            the entire request to fail if any invalid rows exist.\n        :type skip_invalid_rows: bool\n        :param fail_on_error: [Optional] Force the task to fail if any errors occur.\n            The default value is false, which indicates the task should not fail\n            even if any insertion errors occur.\n        :type fail_on_error: bool\n        \"\"\"\n\n        arg_8 = arg_1 if arg_1 else arg_0.project_id\n\n        arg_9 = {\n            \"rows\": arg_4,\n            \"ignoreUnknownValues\": arg_5,\n            \"kind\": \"bigquery#tableDataInsertAllRequest\",\n            \"skipInvalidRows\": arg_6,\n        }\n\n        try:\n            arg_0.log.info(\n                'Inserting %s row(s) into Table %s:%s.%s',\n                len(arg_4), arg_8, arg_2, arg_3\n            )\n\n            arg_10 = arg_0.service.tabledata().insertAll(\n                projectId=arg_8, datasetId=arg_2,\n                tableId=arg_3, arg_9=arg_9\n            ).execute(num_retries=arg_0.num_retries)\n\n            if 'insertErrors' not in arg_10:\n                arg_0.log.info(\n                    'All row(s) inserted successfully: %s:%s.%s',\n                    arg_8, arg_2, arg_3\n                )\n            else:\n                arg_11 = '{} insert error(s) occurred: {}:{}.{}. Details: {}'.format(\n                    len(arg_10['insertErrors']),\n                    arg_8, arg_2, arg_3, arg_10['insertErrors'])\n                if arg_7:\n                    raise AirflowException(\n                        'BigQuery job failed. Error was: {}'.format(arg_11)\n                    )\n                arg_0.log.info(arg_11)\n        except HttpError as err:\n            raise AirflowException(\n                'BigQuery job failed. Error was: {}'.format(err.content)\n            )", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryBaseCursor.insert_all", "docstring": "Method to stream data into BigQuery one record at a time without needing\n        to run a load job\n\n        .. seealso::\n            For more information, see:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll\n\n        :param project_id: The name of the project where we have the table\n        :type project_id: str\n        :param dataset_id: The name of the dataset where we have the table\n        :type dataset_id: str\n        :param table_id: The name of the table\n        :type table_id: str\n        :param rows: the rows to insert\n        :type rows: list\n\n        **Example or rows**:\n            rows=[{\"json\": {\"a_key\": \"a_value_0\"}}, {\"json\": {\"a_key\": \"a_value_1\"}}]\n\n        :param ignore_unknown_values: [Optional] Accept rows that contain values\n            that do not match the schema. The unknown values are ignored.\n            The default value  is false, which treats unknown values as errors.\n        :type ignore_unknown_values: bool\n        :param skip_invalid_rows: [Optional] Insert all valid rows of a request,\n            even if invalid rows exist. The default value is false, which causes\n            the entire request to fail if any invalid rows exist.\n        :type skip_invalid_rows: bool\n        :param fail_on_error: [Optional] Force the task to fail if any errors occur.\n            The default value is false, which indicates the task should not fail\n            even if any insertion errors occur.\n        :type fail_on_error: bool", "docstring_tokens": ["Method", "to", "stream", "data", "into", "BigQuery", "one", "record", "at", "a", "time", "without", "needing", "to", "run", "a", "load", "job"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253493}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L229-L245", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Add a node to always run after the parent is finished.", "language": "python", "parameters": "(self, parent, child=None, **kwargs)", "return_statement": "return self._assoc_or_create('always', parent, child, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "_assoc_or_create", "(", "'always'", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Add a node to always run after the parent is finished.\n\n        =====API DOCS=====\n        Add a node to always run after the parent is finished.\n\n        :param parent: Primary key of parent node to associate always node to.\n        :type parent: int\n        :param child: Primary key of child node to be associated.\n        :type child: int\n        :param `**kwargs`: Fields used to create child node if ``child`` is not provided.\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        return arg_0._assoc_or_create('always', arg_1, arg_2, **arg_3)", "path": "tower_cli/resources/node.py", "identifier": "Resource.associate_always_node", "docstring": "Add a node to always run after the parent is finished.\n\n        =====API DOCS=====\n        Add a node to always run after the parent is finished.\n\n        :param parent: Primary key of parent node to associate always node to.\n        :type parent: int\n        :param child: Primary key of child node to be associated.\n        :type child: int\n        :param `**kwargs`: Fields used to create child node if ``child`` is not provided.\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Add", "a", "node", "to", "always", "run", "after", "the", "parent", "is", "finished", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 253494}
{"url": "https://github.com/boakley/robotframework-lint/blob/3e3578f4e39af9af9961aa0a715f146b74474091/rflint/parser/parser.py#L73-L89", "sha": "3e3578f4e39af9af9961aa0a715f146b74474091", "docstring_summary": "Iterator which visits all suites and suite files,\n        yielding test cases and keywords", "language": "python", "parameters": "(self, *types)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "arg_1", "if", "len", "(", "arg_1", ")", ">", "0", "else", "[", "SuiteFile", ",", "ResourceFile", ",", "SuiteFolder", ",", "Testcase", ",", "Keyword", "]", "for", "arg_3", "in", "arg_0", ".", "robot_files", ":", "if", "arg_3", ".", "__class__", "in", "arg_2", ":", "yield", "arg_3", "if", "isinstance", "(", "arg_3", ",", "SuiteFolder", ")", ":", "for", "arg_4", "in", "arg_3", ".", "Func", "(", ")", ":", "if", "arg_4", ".", "__class__", "in", "arg_2", ":", "yield", "arg_4", "else", ":", "for", "arg_4", "in", "arg_3", ".", "Func", "(", "*", "arg_1", ")", ":", "yield", "arg_4"], "function": "def Func(arg_0, *arg_1):\n        '''\n        Iterator which visits all suites and suite files,\n        yielding test cases and keywords\n        '''\n        arg_2 = arg_1 if len(arg_1) > 0 else [SuiteFile, ResourceFile, SuiteFolder, Testcase, Keyword]\n\n        for arg_3 in arg_0.robot_files:\n            if arg_3.__class__ in arg_2:\n                yield arg_3\n            if isinstance(arg_3, SuiteFolder):\n                for arg_4 in arg_3.Func():\n                    if arg_4.__class__ in arg_2:\n                        yield arg_4\n            else:\n                for arg_4 in arg_3.Func(*arg_1):\n                    yield arg_4", "path": "rflint/parser/parser.py", "identifier": "SuiteFolder.walk", "docstring": "Iterator which visits all suites and suite files,\n        yielding test cases and keywords", "docstring_tokens": ["Iterator", "which", "visits", "all", "suites", "and", "suite", "files", "yielding", "test", "cases", "and", "keywords"], "nwo": "boakley/robotframework-lint", "score": 0.9109317500285141, "idx": 253495}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/segmented.py#L111-L122", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Adds a segment to the download pool and write queue.", "language": "python", "parameters": "(self, segment)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "closed", ":", "return", "if", "arg_1", "is", "not", "None", ":", "arg_2", "=", "arg_0", ".", "executor", ".", "submit", "(", "arg_0", ".", "fetch", ",", "arg_1", ",", "retries", "=", "arg_0", ".", "retries", ")", "else", ":", "arg_2", "=", "None", "arg_0", ".", "queue", "(", "arg_0", ".", "futures", ",", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Adds a segment to the download pool and write queue.\"\"\"\n        if arg_0.closed:\n            return\n\n        if arg_1 is not None:\n            arg_2 = arg_0.executor.submit(arg_0.fetch, arg_1,\n                                          retries=arg_0.retries)\n        else:\n            arg_2 = None\n\n        arg_0.queue(arg_0.futures, (arg_1, arg_2))", "path": "src/streamlink/stream/segmented.py", "identifier": "SegmentedStreamWriter.put", "docstring": "Adds a segment to the download pool and write queue.", "docstring_tokens": ["Adds", "a", "segment", "to", "the", "download", "pool", "and", "write", "queue", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 253496}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/EAHashingAlgorithm.py#L26-L36", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Convert a decimal number to hexadecimal", "language": "python", "parameters": "(self, num)", "return_statement": "return temp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "''", "for", "arg_3", "in", "range", "(", "0", ",", "4", ")", ":", "arg_4", "=", "arg_0", ".", "hexChars", "[", "(", "arg_1", ">>", "(", "arg_3", "*", "8", "+", "4", ")", ")", "&", "0x0F", "]", "arg_5", "=", "arg_0", ".", "hexChars", "[", "(", "arg_1", ">>", "(", "arg_3", "*", "8", ")", ")", "&", "0x0F", "]", "arg_2", "+=", "(", "arg_4", "+", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''\n            Convert a decimal number to hexadecimal\n        '''\n        arg_2 = ''\n        for arg_3 in range(0, 4):\n            arg_4 = arg_0.hexChars[ ( arg_1 >> (arg_3 * 8 + 4) ) & 0x0F ]\n            arg_5 = arg_0.hexChars[ ( arg_1 >> (arg_3 * 8) ) & 0x0F ]\n            arg_2 += (arg_4 + arg_5)\n\n        return arg_2", "path": "fut/EAHashingAlgorithm.py", "identifier": "EAHashingAlgorithm.num2hex", "docstring": "Convert a decimal number to hexadecimal", "docstring_tokens": ["Convert", "a", "decimal", "number", "to", "hexadecimal"], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 253497}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/sbio/socket_server.py#L80-L91", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Asynchronous connection listener. Starts a handler for each connection.", "language": "python", "parameters": "(self, sock, *args)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "arg_1", ".", "accept", "(", ")", "arg_5", "=", "arg_3", ".", "makefile", "(", "arg_3", ")", "arg_0", ".", "shell", "=", "ShoebotCmd", "(", "arg_0", ".", "bot", ",", "stdin", "=", "arg_5", ",", "stdout", "=", "arg_5", ",", "intro", "=", "INTRO", ")", "print", "(", "_", "(", "\"Connected\"", ")", ")", "GObject", ".", "io_add_watch", "(", "arg_3", ",", "GObject", ".", "IO_IN", ",", "arg_0", ".", "handler", ")", "if", "arg_0", ".", "shell", ".", "intro", ":", "arg_0", ".", "shell", ".", "stdout", ".", "write", "(", "str", "(", "arg_0", ".", "shell", ".", "intro", ")", "+", "\"\\n\"", ")", "arg_0", ".", "shell", ".", "stdout", ".", "flush", "(", ")", "return", "True"], "function": "def Func(arg_0, arg_1, *arg_2):\n        '''Asynchronous connection Func. Starts a handler for each connection.'''\n        arg_3, arg_4 = arg_1.accept()\n        arg_5 = arg_3.makefile(arg_3)\n        arg_0.shell = ShoebotCmd(arg_0.bot, stdin=arg_5, stdout=arg_5, intro=INTRO)\n\n        print(_(\"Connected\"))\n        GObject.io_add_watch(arg_3, GObject.IO_IN, arg_0.handler)\n        if arg_0.shell.intro:\n            arg_0.shell.stdout.write(str(arg_0.shell.intro)+\"\\n\")\n            arg_0.shell.stdout.flush()\n        return True", "path": "shoebot/sbio/socket_server.py", "identifier": "SocketServer.listener", "docstring": "Asynchronous connection listener. Starts a handler for each connection.", "docstring_tokens": ["Asynchronous", "connection", "listener", ".", "Starts", "a", "handler", "for", "each", "connection", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253498}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L199-L226", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Parse source text to find executable lines, excluded lines, etc.", "language": "python", "parameters": "(self)", "return_statement": "return lines, excluded_lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "_raw_parse", "(", ")", "except", "(", "tokenize", ".", "TokenError", ",", "IndentationError", ")", ":", "arg_1", ",", "arg_2", ",", "arg_1", "=", "sys", ".", "exc_info", "(", ")", "arg_3", ",", "arg_4", "=", "arg_2", ".", "args", "raise", "NotPython", "(", "\"Couldn't parse '%s' as Python source: '%s' at %s\"", "%", "(", "arg_0", ".", "filename", ",", "arg_3", ",", "arg_4", ")", ")", "arg_5", "=", "arg_0", ".", "first_lines", "(", "arg_0", ".", "excluded", ")", "arg_6", "=", "arg_0", ".", "first_lines", "(", "arg_0", ".", "statement_starts", ",", "arg_5", ",", "arg_0", ".", "docstrings", ")", "return", "arg_6", ",", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"Parse source text to find executable lines, excluded lines, etc.\n\n        Return values are 1) a set of executable line numbers, and 2) a set of\n        excluded line numbers.\n\n        Reported line numbers are normalized to the first line of multi-line\n        statements.\n\n        \"\"\"\n        try:\n            arg_0._raw_parse()\n        except (tokenize.TokenError, IndentationError):\n            arg_1, arg_2, arg_1 = sys.exc_info()\n            arg_3, arg_4 = arg_2.args\n            raise NotPython(\n                \"Couldn't parse '%s' as Python source: '%s' at %s\" %\n                    (arg_0.filename, arg_3, arg_4)\n                )\n\n        arg_5 = arg_0.first_lines(arg_0.excluded)\n        arg_6 = arg_0.first_lines(\n            arg_0.statement_starts,\n            arg_5,\n            arg_0.docstrings\n        )\n\n        return arg_6, arg_5", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py", "identifier": "CodeParser.parse_source", "docstring": "Parse source text to find executable lines, excluded lines, etc.\n\n        Return values are 1) a set of executable line numbers, and 2) a set of\n        excluded line numbers.\n\n        Reported line numbers are normalized to the first line of multi-line\n        statements.", "docstring_tokens": ["Parse", "source", "text", "to", "find", "executable", "lines", "excluded", "lines", "etc", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253499}
{"url": "https://github.com/stevelittlefish/littlefish/blob/6deee7f81fab30716c743efe2e94e786c6e17016/littlefish/imageutil.py#L184-L196", "sha": "6deee7f81fab30716c743efe2e94e786c6e17016", "docstring_summary": "Resize and image to fit the passed in width, keeping the aspect ratio the same", "language": "python", "parameters": "(image, dest_w)", "return_statement": "return scaled_image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "/", "arg_0", ".", "size", "[", "0", "]", "arg_3", "=", "arg_0", ".", "size", "[", "1", "]", "*", "arg_2", "arg_4", "=", "arg_0", ".", "resize", "(", "(", "int", "(", "arg_1", ")", ",", "int", "(", "arg_3", ")", ")", ",", "PIL", ".", "Image", ".", "ANTIALIAS", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Resize and image to fit the passed in width, keeping the aspect ratio the same\n\n    :param image: PIL.Image\n    :param dest_w: The desired width\n    \"\"\"\n    arg_2 = arg_1 / arg_0.size[0]\n    arg_3 = arg_0.size[1] * arg_2\n    \n    arg_4 = arg_0.resize((int(arg_1), int(arg_3)), PIL.Image.ANTIALIAS)\n\n    return arg_4", "path": "littlefish/imageutil.py", "identifier": "resize_image_to_fit_width", "docstring": "Resize and image to fit the passed in width, keeping the aspect ratio the same\n\n    :param image: PIL.Image\n    :param dest_w: The desired width", "docstring_tokens": ["Resize", "and", "image", "to", "fit", "the", "passed", "in", "width", "keeping", "the", "aspect", "ratio", "the", "same"], "nwo": "stevelittlefish/littlefish", "score": 0.23137166388621372, "idx": 253500}
{"url": "https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L931-L952", "sha": "0dc47c8924fa3d9ab676c3a6e195f03f728b72c6", "docstring_summary": "Call each callable in callables, suppressing any exceptions supplied. If\n\tno exception classes are supplied, all Exceptions will be suppressed.", "language": "python", "parameters": "(callables, *exceptions)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "Exception", ",", "for", "arg_2", "in", "arg_0", ":", "try", ":", "yield", "arg_2", "(", ")", "except", "arg_1", ":", "pass"], "function": "def Func(arg_0, *arg_1):\n\t\"\"\"\n\tCall each callable in callables, suppressing any exceptions supplied. If\n\tno exception classes are supplied, all Exceptions will be suppressed.\n\n\t>>> import functools\n\t>>> c1 = functools.partial(int, 'a')\n\t>>> c2 = functools.partial(int, '10')\n\t>>> list(Func((c1, c2)))\n\t[10]\n\t>>> list(Func((c1, c2), KeyError))\n\tTraceback (most recent call last):\n\t...\n\tValueError: invalid literal for int() with base 10: 'a'\n\t\"\"\"\n\tif not arg_1:\n\t\targ_1 = Exception,\n\tfor arg_2 in arg_0:\n\t\ttry:\n\t\t\tyield arg_2()\n\t\texcept arg_1:\n\t\t\tpass", "path": "jaraco/itertools.py", "identifier": "suppress_exceptions", "docstring": "Call each callable in callables, suppressing any exceptions supplied. If\n\tno exception classes are supplied, all Exceptions will be suppressed.\n\n\t>>> import functools\n\t>>> c1 = functools.partial(int, 'a')\n\t>>> c2 = functools.partial(int, '10')\n\t>>> list(suppress_exceptions((c1, c2)))\n\t[10]\n\t>>> list(suppress_exceptions((c1, c2), KeyError))\n\tTraceback (most recent call last):\n\t...\n\tValueError: invalid literal for int() with base 10: 'a'", "docstring_tokens": ["Call", "each", "callable", "in", "callables", "suppressing", "any", "exceptions", "supplied", ".", "If", "no", "exception", "classes", "are", "supplied", "all", "Exceptions", "will", "be", "suppressed", "."], "nwo": "jaraco/jaraco.itertools", "score": 0.2751458370028208, "idx": 253501}
{"url": "https://github.com/bmcfee/muda/blob/ff82efdfaeb98da0a9f9124845826eb20536a9ba/muda/base.py#L21-L33", "sha": "ff82efdfaeb98da0a9f9124845826eb20536a9ba", "docstring_summary": "Get the list of parameter names for the object", "language": "python", "parameters": "(cls)", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "__init__", "arg_2", ",", "arg_3", "=", "inspect", ".", "getargspec", "(", "arg_1", ")", "[", ":", "2", "]", "if", "arg_3", "is", "not", "None", ":", "raise", "RuntimeError", "(", "'BaseTransformer objects cannot have varargs'", ")", "arg_2", ".", "pop", "(", "0", ")", "arg_2", ".", "sort", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        '''Get the list of parameter names for the object'''\n\n        arg_1 = arg_0.__init__\n\n        arg_2, arg_3 = inspect.getargspec(arg_1)[:2]\n\n        if arg_3 is not None:\n            raise RuntimeError('BaseTransformer objects cannot have varargs')\n\n        arg_2.pop(0)\n        arg_2.sort()\n        return arg_2", "path": "muda/base.py", "identifier": "BaseTransformer._get_param_names", "docstring": "Get the list of parameter names for the object", "docstring_tokens": ["Get", "the", "list", "of", "parameter", "names", "for", "the", "object"], "nwo": "bmcfee/muda", "score": 0.6916969030525102, "idx": 253502}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L1570-L1583", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Calculates J along the direction.", "language": "python", "parameters": "(self)", "return_statement": "return np.array(J)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "state", ".", "residuals", ".", "copy", "(", ")", ".", "ravel", "(", ")", "arg_2", "=", "np", ".", "zeros", "(", "arg_0", ".", "param_vals", ".", "size", ")", "arg_3", "=", "arg_0", ".", "param_vals", ".", "copy", "(", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "range", "(", "arg_0", ".", "param_vals", ".", "size", ")", ":", "arg_2", "*=", "0", "arg_2", "[", "arg_5", "]", "+=", "arg_0", ".", "dl", "arg_0", ".", "update_function", "(", "arg_3", "+", "arg_2", ")", "arg_6", "=", "arg_0", ".", "state", ".", "residuals", ".", "copy", "(", ")", ".", "ravel", "(", ")", "arg_4", ".", "append", "(", "(", "arg_6", "-", "arg_1", ")", "/", "arg_0", ".", "dl", ")", "arg_0", ".", "update_function", "(", "arg_3", ")", "return", "np", ".", "array", "(", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"Calculates J along the direction.\"\"\"\n        arg_1 = arg_0.state.residuals.copy().ravel()\n        arg_2 = np.zeros(arg_0.param_vals.size)\n        arg_3 = arg_0.param_vals.copy()\n        arg_4 = []\n        for arg_5 in range(arg_0.param_vals.size):\n            arg_2 *= 0\n            arg_2[arg_5] += arg_0.dl\n            arg_0.update_function(arg_3 + arg_2)\n            arg_6 = arg_0.state.residuals.copy().ravel()\n            arg_4.append( (arg_6-arg_1)/arg_0.dl)\n        arg_0.update_function(arg_3)\n        return np.array(arg_4)", "path": "peri/opt/optimize.py", "identifier": "OptState.calc_J", "docstring": "Calculates J along the direction.", "docstring_tokens": ["Calculates", "J", "along", "the", "direction", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 253503}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/cli.py#L316-L330", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Replace vars and copy.", "language": "python", "parameters": "(src_file, dst_file, project_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "mkstemp", "(", ")", "with", "io", ".", "open", "(", "arg_4", ",", "'w'", ",", "encoding", "=", "'utf-8'", ")", "as", "new_file", ":", "with", "io", ".", "open", "(", "arg_0", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "old_file", ":", "for", "arg_5", "in", "old_file", ":", "arg_6", "=", "arg_5", ".", "replace", "(", "'#{project}'", ",", "arg_2", ")", ".", "replace", "(", "'#{project|title}'", ",", "arg_2", ".", "title", "(", ")", ")", "new_file", ".", "write", "(", "arg_6", ")", "shutil", ".", "copy", "(", "arg_4", ",", "arg_1", ")", "os", ".", "close", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Replace vars and copy.\"\"\"\n    # Create temp file\n    arg_3, arg_4 = mkstemp()\n\n    with io.open(arg_4, 'w', encoding='utf-8') as new_file:\n        with io.open(arg_0, 'r', encoding='utf-8') as old_file:\n            for arg_5 in old_file:\n                arg_6 = arg_5.replace('#{project}', arg_2). \\\n                    replace('#{project|title}', arg_2.title())\n                new_file.write(arg_6)\n\n    # Copy to new file\n    shutil.copy(arg_4, arg_1)\n    os.close(arg_3)", "path": "flask_boost/cli.py", "identifier": "_rewrite_and_copy", "docstring": "Replace vars and copy.", "docstring_tokens": ["Replace", "vars", "and", "copy", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 253504}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L183-L201", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Operates on item_dict", "language": "python", "parameters": "(item_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "[", "'type'", "]", "=", "arg_0", "[", "'name'", "]", "if", "len", "(", "arg_0", "[", "'summary_fields'", "]", ")", "==", "0", ":", "arg_0", "[", "'resource_name'", "]", "=", "None", "arg_0", "[", "'resource_type'", "]", "=", "None", "else", ":", "arg_1", "=", "arg_0", "[", "'summary_fields'", "]", "arg_0", "[", "'resource_name'", "]", "=", "arg_1", ".", "get", "(", "'resource_name'", ",", "'[unknown]'", ")", "arg_0", "[", "'resource_type'", "]", "=", "arg_1", ".", "get", "(", "'resource_type'", ",", "'[unknown]'", ")"], "function": "def Func(arg_0):\n        \"\"\"Operates on item_dict\n\n        Promotes the resource_name and resource_type fields to the\n        top-level of the serialization so they can be printed as columns.\n        Also makes a copies name field to type, which is a default column.\"\"\"\n        arg_0['type'] = arg_0['name']\n        if len(arg_0['summary_fields']) == 0:\n            # Singleton roles omit these fields\n            arg_0['resource_name'] = None\n            arg_0['resource_type'] = None\n        else:\n            arg_1 = arg_0['summary_fields']\n            # Explination of fallback state:\n            # The situation where resource_name or resource_type is not present\n            # should not be seen for singleton roles, and where it is seen,\n            # there may be a problem with data quality on the server\n            arg_0['resource_name'] = arg_1.get('resource_name', '[unknown]')\n            arg_0['resource_type'] = arg_1.get('resource_type', '[unknown]')", "path": "tower_cli/resources/role.py", "identifier": "Resource.populate_resource_columns", "docstring": "Operates on item_dict\n\n        Promotes the resource_name and resource_type fields to the\n        top-level of the serialization so they can be printed as columns.\n        Also makes a copies name field to type, which is a default column.", "docstring_tokens": ["Operates", "on", "item_dict"], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 253505}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L824-L834", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Use the create_bucket API to create a new bucket", "language": "python", "parameters": "(self, source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "S3URL", "(", "arg_1", ")", "message", "(", "'Creating %s'", ",", "arg_1", ")", "if", "not", "arg_0", ".", "opt", ".", "dry_run", ":", "arg_3", "=", "arg_0", ".", "s3", ".", "Func", "(", "Bucket", "=", "arg_2", ".", "bucket", ")", "if", "arg_3", "[", "'ResponseMetadata'", "]", "[", "\"HTTPStatusCode\"", "]", "==", "200", ":", "message", "(", "'Done.'", ")", "else", ":", "raise", "Failure", "(", "'Unable to create bucket %s'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    '''Use the Func API to create a new bucket'''\n    arg_2 = S3URL(arg_1)\n\n    message('Creating %s', arg_1)\n    if not arg_0.opt.dry_run:\n      arg_3 = arg_0.s3.Func(Bucket=arg_2.bucket)\n      if arg_3['ResponseMetadata'][\"HTTPStatusCode\"] == 200:\n        message('Done.')\n      else:\n        raise Failure('Unable to create bucket %s' % arg_1)", "path": "s4cmd.py", "identifier": "S3Handler.create_bucket", "docstring": "Use the create_bucket API to create a new bucket", "docstring_tokens": ["Use", "the", "create_bucket", "API", "to", "create", "a", "new", "bucket"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 253506}
{"url": "https://github.com/sendwithus/sendwithus_python/blob/8ae50d514febd44f7d9be3c838b4d92f99412832/sendwithus/__init__.py#L452-L468", "sha": "8ae50d514febd44f7d9be3c838b4d92f99412832", "docstring_summary": "Make a dictionary with filename and base64 file data", "language": "python", "parameters": "(self, f)", "return_statement": "return {\n            'id': file_name,\n            'data': b64_data.decode() if six.PY3 else b64_data,\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_2", "=", "arg_1", "[", "'file'", "]", "if", "'filename'", "in", "arg_1", ":", "arg_3", "=", "arg_1", "[", "'filename'", "]", "else", ":", "arg_3", "=", "arg_2", ".", "name", "else", ":", "arg_2", "=", "arg_1", "arg_3", "=", "arg_1", ".", "name", "arg_4", "=", "base64", ".", "b64encode", "(", "arg_2", ".", "read", "(", ")", ")", "return", "{", "'id'", ":", "arg_3", ",", "'data'", ":", "arg_4", ".", "decode", "(", ")", "if", "six", ".", "PY3", "else", "arg_4", ",", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Make a dictionary with filename and base64 file data\"\"\"\n        if isinstance(arg_1, dict):\n            arg_2 = arg_1['file']\n            if 'filename' in arg_1:\n                arg_3 = arg_1['filename']\n            else:\n                arg_3 = arg_2.name\n        else:\n            arg_2 = arg_1\n            arg_3 = arg_1.name\n\n        arg_4 = base64.b64encode(arg_2.read())\n        return {\n            'id': arg_3,\n            'data': arg_4.decode() if six.PY3 else arg_4,\n        }", "path": "sendwithus/__init__.py", "identifier": "api._make_file_dict", "docstring": "Make a dictionary with filename and base64 file data", "docstring_tokens": ["Make", "a", "dictionary", "with", "filename", "and", "base64", "file", "data"], "nwo": "sendwithus/sendwithus_python", "score": 0.2828805321802978, "idx": 253507}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/datastore_hook.py#L297-L337", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Import a backup from Cloud Storage to Cloud Datastore.", "language": "python", "parameters": "(self, bucket, file, namespace=None, entity_filter=None, labels=None)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_0", ".", "get_conn", "(", ")", "arg_7", "=", "'gs://'", "+", "'/'", ".", "join", "(", "filter", "(", "None", ",", "[", "arg_1", ",", "arg_3", ",", "arg_2", "]", ")", ")", "if", "not", "arg_4", ":", "arg_4", "=", "{", "}", "if", "not", "arg_5", ":", "arg_5", "=", "{", "}", "arg_8", "=", "{", "'inputUrl'", ":", "arg_7", ",", "'entityFilter'", ":", "arg_4", ",", "'labels'", ":", "arg_5", ",", "}", "arg_9", "=", "(", "arg_6", ".", "projects", "(", ")", ".", "import_", "(", "projectId", "=", "arg_0", ".", "project_id", ",", "arg_8", "=", "arg_8", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"\n        Import a backup from Cloud Storage to Cloud Datastore.\n\n        .. note::\n            Keep in mind that this requests the Admin API not the Data API.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/admin/rest/v1/projects/import\n\n        :param bucket: The name of the Cloud Storage bucket.\n        :type bucket: str\n        :param file: the metadata file written by the projects.export operation.\n        :type file: str\n        :param namespace: The Cloud Storage namespace path.\n        :type namespace: str\n        :param entity_filter: specify which kinds/namespaces are to be imported.\n        :type entity_filter: dict\n        :param labels: Client-assigned labels.\n        :type labels: dict of str\n        :return: a resource operation instance.\n        :rtype: dict\n        \"\"\"\n        arg_6 = arg_0.get_conn()\n\n        arg_7 = 'gs://' + '/'.join(filter(None, [arg_1, arg_3, arg_2]))\n        if not arg_4:\n            arg_4 = {}\n        if not arg_5:\n            arg_5 = {}\n        arg_8 = {\n            'inputUrl': arg_7,\n            'entityFilter': arg_4,\n            'labels': arg_5,\n        }\n        arg_9 = (arg_6\n                .projects()\n                .import_(projectId=arg_0.project_id, arg_8=arg_8)\n                .execute(num_retries=arg_0.num_retries))\n\n        return arg_9", "path": "airflow/contrib/hooks/datastore_hook.py", "identifier": "DatastoreHook.import_from_storage_bucket", "docstring": "Import a backup from Cloud Storage to Cloud Datastore.\n\n        .. note::\n            Keep in mind that this requests the Admin API not the Data API.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/admin/rest/v1/projects/import\n\n        :param bucket: The name of the Cloud Storage bucket.\n        :type bucket: str\n        :param file: the metadata file written by the projects.export operation.\n        :type file: str\n        :param namespace: The Cloud Storage namespace path.\n        :type namespace: str\n        :param entity_filter: specify which kinds/namespaces are to be imported.\n        :type entity_filter: dict\n        :param labels: Client-assigned labels.\n        :type labels: dict of str\n        :return: a resource operation instance.\n        :rtype: dict", "docstring_tokens": ["Import", "a", "backup", "from", "Cloud", "Storage", "to", "Cloud", "Datastore", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253508}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/base_graph.py#L519-L548", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Adds an edge to the graph.", "language": "python", "parameters": "(self, tail_node_or_ID, head_node_or_ID, **kwds)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "add_node", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "add_node", "(", "arg_2", ")", "if", "\"directed\"", "in", "arg_0", ".", "trait_names", "(", ")", ":", "arg_6", "=", "arg_0", ".", "directed", "else", ":", "arg_6", "=", "False", "if", "arg_0", ".", "default_edge", "is", "not", "None", ":", "arg_7", "=", "arg_0", ".", "default_edge", ".", "clone_traits", "(", "copy", "=", "\"deep\"", ")", "arg_7", ".", "tail_node", "=", "arg_4", "arg_7", ".", "head_node", "=", "arg_5", "arg_7", ".", "conn", "=", "\"->\"", "if", "arg_6", "else", "\"--\"", "arg_7", ".", "set", "(", "**", "arg_3", ")", "else", ":", "arg_7", "=", "Edge", "(", "arg_4", ",", "arg_5", ",", "arg_6", ",", "**", "arg_3", ")", "if", "\"strict\"", "in", "arg_0", ".", "trait_names", "(", ")", ":", "if", "not", "arg_0", ".", "strict", ":", "arg_0", ".", "edges", ".", "append", "(", "arg_7", ")", "else", ":", "arg_0", ".", "edges", ".", "append", "(", "arg_7", ")", "else", ":", "arg_0", ".", "edges", ".", "append", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\" Adds an edge to the graph.\n        \"\"\"\n        arg_4 = arg_0.add_node(arg_1)\n        arg_5 = arg_0.add_node(arg_2)\n\n        # Only top level graphs are directed and/or strict.\n        if \"directed\" in arg_0.trait_names():\n            arg_6 = arg_0.directed\n        else:\n            arg_6 = False\n\n        if arg_0.default_edge is not None:\n            arg_7 = arg_0.default_edge.clone_traits(copy=\"deep\")\n            arg_7.tail_node = arg_4\n            arg_7.head_node = arg_5\n            arg_7.conn = \"->\" if arg_6 else \"--\"\n            arg_7.set( **arg_3 )\n        else:\n            arg_7 = Edge(arg_4, arg_5, arg_6, **arg_3)\n\n        if \"strict\" in arg_0.trait_names():\n            if not arg_0.strict:\n                arg_0.edges.append(arg_7)\n            else:\n                arg_0.edges.append(arg_7)\n                # FIXME: Implement strict graphs.\n#                raise NotImplementedError\n        else:\n            arg_0.edges.append(arg_7)", "path": "godot/base_graph.py", "identifier": "BaseGraph.add_edge", "docstring": "Adds an edge to the graph.", "docstring_tokens": ["Adds", "an", "edge", "to", "the", "graph", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 253509}
{"url": "https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/forestci.py#L167-L275", "sha": "401c63a74a27d775eff0f72b6c20ffd568491fe0", "docstring_summary": "Calculate error bars from scikit-learn RandomForest estimators.", "language": "python", "parameters": "(forest, X_train, X_test, inbag=None,\n                        calibrate=True, memory_constrained=False,\n                        memory_limit=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "True", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "calc_inbag", "(", "arg_1", ".", "shape", "[", "0", "]", ",", "arg_0", ")", "arg_7", "=", "np", ".", "array", "(", "[", "tree", ".", "predict", "(", "arg_2", ")", "for", "tree", "in", "arg_0", "]", ")", ".", "T", "arg_8", "=", "np", ".", "mean", "(", "arg_7", ",", "0", ")", "arg_9", "=", "arg_7", "-", "arg_8", "arg_10", "=", "arg_0", ".", "n_estimators", "arg_11", "=", "_core_computation", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_9", ",", "arg_10", ",", "arg_5", ",", "arg_6", ")", "arg_12", "=", "_bias_correction", "(", "arg_11", ",", "arg_3", ",", "arg_9", ",", "arg_10", ")", "if", "np", ".", "max", "(", "arg_3", ")", "==", "1", ":", "arg_13", "=", "1", "/", "(", "1", "-", "np", ".", "mean", "(", "arg_3", ")", ")", "**", "2", "arg_12", "*=", "arg_13", "if", "not", "arg_4", ":", "return", "arg_12", "if", "arg_12", ".", "shape", "[", "0", "]", "<=", "20", ":", "print", "(", "\"No calibration with n_samples <= 20\"", ")", "return", "arg_12", "if", "arg_4", ":", "arg_14", "=", "2", "arg_15", "=", "np", ".", "ceil", "(", "arg_10", "/", "arg_14", ")", "arg_16", "=", "copy", ".", "deepcopy", "(", "arg_0", ")", "arg_16", ".", "estimators_", "=", "np", ".", "random", ".", "permutation", "(", "arg_16", ".", "estimators_", ")", "[", ":", "int", "(", "arg_15", ")", "]", "arg_16", ".", "n_estimators", "=", "int", "(", "arg_15", ")", "arg_19", "=", "Func", "(", "arg_16", ",", "arg_1", ",", "arg_2", ",", "arg_4", "=", "False", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_20", "=", "np", ".", "mean", "(", "(", "arg_19", "-", "arg_12", ")", "**", "2", ")", "arg_21", "=", "arg_15", "/", "arg_10", "arg_22", "=", "(", "arg_21", "**", "2", "+", "(", "1", "-", "arg_21", ")", "**", "2", ")", "/", "(", "2", "*", "(", "1", "-", "arg_21", ")", "**", "2", ")", "*", "arg_20", "arg_23", "=", "calibrateEB", "(", "arg_12", ",", "arg_22", ")", "return", "arg_23"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None,\n                        arg_4=True, arg_5=False,\n                        arg_6=None):\n    \"\"\"\n    Calculate error bars from scikit-learn RandomForest estimators.\n\n    RandomForest is a regressor or classifier object\n    this variance can be used to plot error bars for RandomForest objects\n\n    Parameters\n    ----------\n    forest : RandomForest\n        Regressor or Classifier object.\n\n    X_train : ndarray\n        An array with shape (n_train_sample, n_features). The design matrix for\n        training data.\n\n    X_test : ndarray\n        An array with shape (n_test_sample, n_features). The design matrix\n        for testing data\n\n    inbag : ndarray, optional\n        The inbag matrix that fit the data. If set to `None` (default) it\n        will be inferred from the forest. However, this only works for trees\n        for which bootstrapping was set to `True`. That is, if sampling was\n        done with replacement. Otherwise, users need to provide their own\n        inbag matrix.\n\n    calibrate: boolean, optional\n        Whether to apply calibration to mitigate Monte Carlo noise.\n        Some variance estimates may be negative due to Monte Carlo effects if\n        the number of trees in the forest is too small. To use calibration,\n        Default: True\n\n    memory_constrained: boolean, optional\n        Whether or not there is a restriction on memory. If False, it is\n        assumed that a ndarry of shape (n_train_sample,n_test_sample) fits\n        in main memory. Setting to True can actually provide a speed up if\n        memory_limit is tuned to the optimal range.\n\n    memory_limit: int, optional.\n        An upper bound for how much memory the itermediate matrices will take\n        up in Megabytes. This must be provided if memory_constrained=True.\n\n    Returns\n    -------\n    An array with the unbiased sampling variance (V_IJ_unbiased)\n    for a RandomForest object.\n\n    See Also\n    ----------\n    :func:`calc_inbag`\n\n    Notes\n    -----\n    The calculation of error is based on the infinitesimal jackknife variance,\n    as described in [Wager2014]_ and is a Python implementation of the R code\n    provided at: https://github.com/swager/randomForestCI\n\n    .. [Wager2014] S. Wager, T. Hastie, B. Efron. \"Confidence Intervals for\n       Random Forests: The Jackknife and the Infinitesimal Jackknife\", Journal\n       of Machine Learning Research vol. 15, pp. 1625-1651, 2014.\n    \"\"\"\n    if arg_3 is None:\n        arg_3 = calc_inbag(arg_1.shape[0], arg_0)\n\n    arg_7 = np.array([tree.predict(arg_2) for tree in arg_0]).T\n    arg_8 = np.mean(arg_7, 0)\n    arg_9 = arg_7 - arg_8\n    arg_10 = arg_0.n_estimators\n    arg_11 = _core_computation(arg_1, arg_2, arg_3, arg_9, arg_10,\n                             arg_5, arg_6)\n    arg_12 = _bias_correction(arg_11, arg_3, arg_9, arg_10)\n\n    # Correct for cases where resampling is done without replacement:\n    if np.max(arg_3) == 1:\n        arg_13 = 1 / (1 - np.mean(arg_3)) ** 2\n        arg_12 *= arg_13\n\n    if not arg_4:\n        return arg_12\n\n    if arg_12.shape[0] <= 20:\n        print(\"No calibration with n_samples <= 20\")\n        return arg_12\n    if arg_4:\n\n        arg_14 = 2\n        arg_15 = np.ceil(arg_10 / arg_14)\n        arg_16 = copy.deepcopy(arg_0)\n        arg_16.estimators_ =\\\n            np.random.permutation(arg_16.estimators_)[:int(arg_15)]\n        arg_16.n_estimators = int(arg_15)\n\n        arg_19 = Func(arg_16, arg_1, arg_2,\n                                         arg_4=False,\n                                         arg_5=arg_5,\n                                         arg_6=arg_6)\n        # Use this second set of variance estimates\n        # to estimate scale of Monte Carlo noise\n        arg_20 = np.mean((arg_19 - arg_12)**2)\n        arg_21 = arg_15 / arg_10\n        arg_22 = (arg_21**2 + (1 - arg_21)**2) / (2 * (1 - arg_21)**2) * arg_20\n\n        # Use Monte Carlo noise scale estimate for empirical Bayes calibration\n        arg_23 = calibrateEB(arg_12, arg_22)\n\n        return arg_23", "path": "forestci/forestci.py", "identifier": "random_forest_error", "docstring": "Calculate error bars from scikit-learn RandomForest estimators.\n\n    RandomForest is a regressor or classifier object\n    this variance can be used to plot error bars for RandomForest objects\n\n    Parameters\n    ----------\n    forest : RandomForest\n        Regressor or Classifier object.\n\n    X_train : ndarray\n        An array with shape (n_train_sample, n_features). The design matrix for\n        training data.\n\n    X_test : ndarray\n        An array with shape (n_test_sample, n_features). The design matrix\n        for testing data\n\n    inbag : ndarray, optional\n        The inbag matrix that fit the data. If set to `None` (default) it\n        will be inferred from the forest. However, this only works for trees\n        for which bootstrapping was set to `True`. That is, if sampling was\n        done with replacement. Otherwise, users need to provide their own\n        inbag matrix.\n\n    calibrate: boolean, optional\n        Whether to apply calibration to mitigate Monte Carlo noise.\n        Some variance estimates may be negative due to Monte Carlo effects if\n        the number of trees in the forest is too small. To use calibration,\n        Default: True\n\n    memory_constrained: boolean, optional\n        Whether or not there is a restriction on memory. If False, it is\n        assumed that a ndarry of shape (n_train_sample,n_test_sample) fits\n        in main memory. Setting to True can actually provide a speed up if\n        memory_limit is tuned to the optimal range.\n\n    memory_limit: int, optional.\n        An upper bound for how much memory the itermediate matrices will take\n        up in Megabytes. This must be provided if memory_constrained=True.\n\n    Returns\n    -------\n    An array with the unbiased sampling variance (V_IJ_unbiased)\n    for a RandomForest object.\n\n    See Also\n    ----------\n    :func:`calc_inbag`\n\n    Notes\n    -----\n    The calculation of error is based on the infinitesimal jackknife variance,\n    as described in [Wager2014]_ and is a Python implementation of the R code\n    provided at: https://github.com/swager/randomForestCI\n\n    .. [Wager2014] S. Wager, T. Hastie, B. Efron. \"Confidence Intervals for\n       Random Forests: The Jackknife and the Infinitesimal Jackknife\", Journal\n       of Machine Learning Research vol. 15, pp. 1625-1651, 2014.", "docstring_tokens": ["Calculate", "error", "bars", "from", "scikit", "-", "learn", "RandomForest", "estimators", "."], "nwo": "scikit-learn-contrib/forest-confidence-interval", "score": 0.5087559176222483, "idx": 253510}
{"url": "https://github.com/bluedisk/hangul-toolkit/blob/f36b534ee339263fb72e687b732697cc7ed290dc/hgtk/josa.py#L34-L45", "sha": "f36b534ee339263fb72e687b732697cc7ed290dc", "docstring_summary": "add josa at the end of this word", "language": "python", "parameters": "(word, josa=EUN_NEUN)", "return_statement": "return word + josa['not']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "strip", "(", ")", "[", "-", "1", "]", "try", ":", "arg_4", ",", "arg_4", ",", "arg_5", "=", "letter", ".", "decompose", "(", "arg_3", ")", "except", "NotHangulException", ":", "arg_5", "=", "letter", ".", "get_substituent_of", "(", "arg_3", ")", "if", "arg_5", "in", "(", "''", ",", "arg_1", "[", "'except'", "]", ")", ":", "return", "arg_0", "+", "arg_1", "[", "'has'", "]", "return", "arg_0", "+", "arg_1", "[", "'not'", "]"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"add josa at the end of this word\"\"\"\n    arg_3 = arg_0.strip()[-1]\n    try:\n        arg_4, arg_4, arg_5 = letter.decompose(arg_3)\n    except NotHangulException:\n        arg_5 = letter.get_substituent_of(arg_3)\n\n    if arg_5 in ('', arg_1['except']):\n        return arg_0 + arg_1['has']\n\n    return arg_0 + arg_1['not']", "path": "hgtk/josa.py", "identifier": "attach", "docstring": "add josa at the end of this word", "docstring_tokens": ["add", "josa", "at", "the", "end", "of", "this", "word"], "nwo": "bluedisk/hangul-toolkit", "score": 0.8069895883791149, "idx": 253511}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pip/req/req_install.py#L235-L264", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "If the build location was a temporary directory, this will move it\n        to a new more permanent location", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "source_dir", "is", "not", "None", ":", "return", "assert", "arg_0", ".", "req", "is", "not", "None", "assert", "arg_0", ".", "_temp_build_dir", "arg_1", "=", "arg_0", ".", "_temp_build_dir", "arg_2", "=", "arg_0", ".", "_ideal_build_dir", "del", "arg_0", ".", "_ideal_build_dir", "if", "arg_0", ".", "editable", ":", "arg_3", "=", "arg_0", ".", "name", ".", "lower", "(", ")", "else", ":", "arg_3", "=", "arg_0", ".", "name", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_3", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "logger", ".", "debug", "(", "'Creating directory %s'", ",", "arg_2", ")", "_make_build_dir", "(", "arg_2", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_4", ")", ":", "raise", "InstallationError", "(", "'A package already exists in %s; please remove it to continue'", "%", "display_path", "(", "arg_4", ")", ")", "logger", ".", "debug", "(", "'Moving package %s from %s to new location %s'", ",", "arg_0", ",", "display_path", "(", "arg_1", ")", ",", "display_path", "(", "arg_4", ")", ",", ")", "shutil", ".", "move", "(", "arg_1", ",", "arg_4", ")", "arg_0", ".", "_temp_build_dir", "=", "arg_4", "arg_0", ".", "source_dir", "=", "arg_4", "arg_0", ".", "_egg_info_path", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"If the build location was a temporary directory, this will move it\n        to a new more permanent location\"\"\"\n        if arg_0.source_dir is not None:\n            return\n        assert arg_0.req is not None\n        assert arg_0._temp_build_dir\n        arg_1 = arg_0._temp_build_dir\n        arg_2 = arg_0._ideal_build_dir\n        del arg_0._ideal_build_dir\n        if arg_0.editable:\n            arg_3 = arg_0.name.lower()\n        else:\n            arg_3 = arg_0.name\n        arg_4 = os.path.join(arg_2, arg_3)\n        if not os.path.exists(arg_2):\n            logger.debug('Creating directory %s', arg_2)\n            _make_build_dir(arg_2)\n        if os.path.exists(arg_4):\n            raise InstallationError(\n                'A package already exists in %s; please remove it to continue'\n                % display_path(arg_4))\n        logger.debug(\n            'Moving package %s from %s to new location %s',\n            arg_0, display_path(arg_1), display_path(arg_4),\n        )\n        shutil.move(arg_1, arg_4)\n        arg_0._temp_build_dir = arg_4\n        arg_0.source_dir = arg_4\n        arg_0._egg_info_path = None", "path": "virtualEnvironment/lib/python2.7/site-packages/pip/req/req_install.py", "identifier": "InstallRequirement.correct_build_location", "docstring": "If the build location was a temporary directory, this will move it\n        to a new more permanent location", "docstring_tokens": ["If", "the", "build", "location", "was", "a", "temporary", "directory", "this", "will", "move", "it", "to", "a", "new", "more", "permanent", "location"], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253512}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/run.py#L99-L110", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Stop any currently running Docker containers associated with\n    Dusty, or associated with the provided apps_or_services. Does not remove\n    the service's containers.", "language": "python", "parameters": "(app_or_service_names=None, rm_containers=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", ":", "log_to_client", "(", "\"Stopping the following apps or services: {}\"", ".", "format", "(", "', '", ".", "join", "(", "arg_0", ")", ")", ")", "else", ":", "log_to_client", "(", "\"Stopping all running containers associated with Dusty\"", ")", "compose", ".", "stop_running_services", "(", "arg_0", ")", "if", "arg_1", ":", "compose", ".", "rm_containers", "(", "arg_0", ")"], "function": "def Func(arg_0=None, arg_1=False):\n    \"\"\"Stop any currently running Docker containers associated with\n    Dusty, or associated with the provided apps_or_services. Does not remove\n    the service's containers.\"\"\"\n    if arg_0:\n        log_to_client(\"Stopping the following apps or services: {}\".format(', '.join(arg_0)))\n    else:\n        log_to_client(\"Stopping all running containers associated with Dusty\")\n\n    compose.stop_running_services(arg_0)\n    if arg_1:\n        compose.rm_containers(arg_0)", "path": "dusty/commands/run.py", "identifier": "stop_apps_or_services", "docstring": "Stop any currently running Docker containers associated with\n    Dusty, or associated with the provided apps_or_services. Does not remove\n    the service's containers.", "docstring_tokens": ["Stop", "any", "currently", "running", "Docker", "containers", "associated", "with", "Dusty", "or", "associated", "with", "the", "provided", "apps_or_services", ".", "Does", "not", "remove", "the", "service", "s", "containers", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 253513}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2523-L2552", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate heat capacity of a solid at temperature `T`\n        with a given method.", "language": "python", "parameters": "(self, T, method)", "return_statement": "return Cp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "PERRY151", ":", "arg_3", "=", "(", "arg_0", ".", "PERRY151_const", "+", "arg_0", ".", "PERRY151_lin", "*", "arg_1", "+", "arg_0", ".", "PERRY151_quadinv", "/", "arg_1", "**", "2", "+", "arg_0", ".", "PERRY151_quad", "*", "arg_1", "**", "2", ")", "*", "calorie", "elif", "arg_2", "==", "CRCSTD", ":", "arg_3", "=", "arg_0", ".", "CRCSTD_Cp", "elif", "arg_2", "==", "LASTOVKA_S", ":", "arg_3", "=", "Lastovka_solid", "(", "arg_1", ",", "arg_0", ".", "similarity_variable", ")", "arg_3", "=", "property_mass_to_molar", "(", "arg_3", ",", "arg_0", ".", "MW", ")", "elif", "arg_2", "in", "arg_0", ".", "tabular_data", ":", "arg_3", "=", "arg_0", ".", "interpolate", "(", "arg_1", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        r'''Method to Func heat capacity of a solid at temperature `T`\n        with a given method.\n\n        This method has no exception handling; see `T_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to Func heat capacity, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Cp : float\n            Heat capacity of the solid at T, [J/mol/K]\n        '''\n        if arg_2 == PERRY151:\n            arg_3 = (arg_0.PERRY151_const + arg_0.PERRY151_lin*arg_1\n            + arg_0.PERRY151_quadinv/arg_1**2 + arg_0.PERRY151_quad*arg_1**2)*calorie\n        elif arg_2 == CRCSTD:\n            arg_3 = arg_0.CRCSTD_Cp\n        elif arg_2 == LASTOVKA_S:\n            arg_3 = Lastovka_solid(arg_1, arg_0.similarity_variable)\n            arg_3 = property_mass_to_molar(arg_3, arg_0.MW)\n        elif arg_2 in arg_0.tabular_data:\n            arg_3 = arg_0.interpolate(arg_1, arg_2)\n        return arg_3", "path": "thermo/heat_capacity.py", "identifier": "HeatCapacitySolid.calculate", "docstring": "r'''Method to calculate heat capacity of a solid at temperature `T`\n        with a given method.\n\n        This method has no exception handling; see `T_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate heat capacity, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Cp : float\n            Heat capacity of the solid at T, [J/mol/K]", "docstring_tokens": ["r", "Method", "to", "calculate", "heat", "capacity", "of", "a", "solid", "at", "temperature", "T", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 253514}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/relativedelta.py#L268-L302", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Return a version of this object represented entirely using integer\n        values for the relative attributes.", "language": "python", "parameters": "(self)", "return_statement": "return self.__class__(years=self.years, months=self.months,\n                              days=days, hours=hours, minutes=minutes,\n                              seconds=seconds, microseconds=microseconds,\n                              leapdays=self.leapdays, year=self.year,\n                              month=self.month, day=self.day,\n                              weekday=self.weekday, hour=self.hour,\n                              minute=self.minute, second=self.second,\n                              microsecond=self.microsecond)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "int", "(", "arg_0", ".", "days", ")", "arg_2", "=", "round", "(", "arg_0", ".", "hours", "+", "24", "*", "(", "arg_0", ".", "days", "-", "arg_1", ")", ",", "11", ")", "arg_3", "=", "int", "(", "arg_2", ")", "arg_4", "=", "round", "(", "arg_0", ".", "minutes", "+", "60", "*", "(", "arg_2", "-", "arg_3", ")", ",", "10", ")", "arg_5", "=", "int", "(", "arg_4", ")", "arg_6", "=", "round", "(", "arg_0", ".", "seconds", "+", "60", "*", "(", "arg_4", "-", "arg_5", ")", ",", "8", ")", "arg_7", "=", "int", "(", "arg_6", ")", "arg_8", "=", "round", "(", "arg_0", ".", "microseconds", "+", "1e6", "*", "(", "arg_6", "-", "arg_7", ")", ")", "return", "arg_0", ".", "__class__", "(", "years", "=", "arg_0", ".", "years", ",", "months", "=", "arg_0", ".", "months", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "leapdays", "=", "arg_0", ".", "leapdays", ",", "year", "=", "arg_0", ".", "year", ",", "month", "=", "arg_0", ".", "month", ",", "day", "=", "arg_0", ".", "day", ",", "weekday", "=", "arg_0", ".", "weekday", ",", "hour", "=", "arg_0", ".", "hour", ",", "minute", "=", "arg_0", ".", "minute", ",", "second", "=", "arg_0", ".", "second", ",", "microsecond", "=", "arg_0", ".", "microsecond", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return a version of this object represented entirely using integer\n        values for the relative attributes.\n\n        >>> relativedelta(days=1.5, hours=2).Func()\n        relativedelta(days=1, hours=14)\n\n        :return:\n            Returns a :class:`dateutil.relativedelta.relativedelta` object.\n        \"\"\"\n        # Cascade remainders down (rounding each to roughly nearest\n        # microsecond)\n        arg_1 = int(arg_0.days)\n\n        arg_2 = round(arg_0.hours + 24 * (arg_0.days - arg_1), 11)\n        arg_3 = int(arg_2)\n\n        arg_4 = round(arg_0.minutes + 60 * (arg_2 - arg_3), 10)\n        arg_5 = int(arg_4)\n\n        arg_6 = round(arg_0.seconds + 60 * (arg_4 - arg_5), 8)\n        arg_7 = int(arg_6)\n\n        arg_8 = round(arg_0.microseconds + 1e6 * (arg_6 - arg_7))\n\n        # Constructor carries overflow back up with call to _fix()\n        return arg_0.__class__(years=arg_0.years, months=arg_0.months,\n                              arg_1=arg_1, arg_3=arg_3, arg_5=arg_5,\n                              arg_7=arg_7, arg_8=arg_8,\n                              leapdays=arg_0.leapdays, year=arg_0.year,\n                              month=arg_0.month, day=arg_0.day,\n                              weekday=arg_0.weekday, hour=arg_0.hour,\n                              minute=arg_0.minute, second=arg_0.second,\n                              microsecond=arg_0.microsecond)", "path": "superjson/pkg/dateutil/relativedelta.py", "identifier": "relativedelta.normalized", "docstring": "Return a version of this object represented entirely using integer\n        values for the relative attributes.\n\n        >>> relativedelta(days=1.5, hours=2).normalized()\n        relativedelta(days=1, hours=14)\n\n        :return:\n            Returns a :class:`dateutil.relativedelta.relativedelta` object.", "docstring_tokens": ["Return", "a", "version", "of", "this", "object", "represented", "entirely", "using", "integer", "values", "for", "the", "relative", "attributes", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 253515}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/shell.py#L67-L73", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Launch a subshell", "language": "python", "parameters": "(prompt_prefix=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", ":", "arg_1", ".", "environ", "[", "'PROMPT'", "]", "=", "prompt", "(", "arg_0", ")", "subprocess", ".", "call", "(", "cmd", "(", ")", ",", "env", "=", "arg_1", ".", "environ", ".", "data", ")"], "function": "def Func(arg_0=None):\n    '''Launch a subshell'''\n\n    if arg_0:\n        arg_1.environ['PROMPT'] = prompt(arg_0)\n\n    subprocess.call(cmd(), env=arg_1.environ.data)", "path": "cpenv/shell.py", "identifier": "launch", "docstring": "Launch a subshell", "docstring_tokens": ["Launch", "a", "subshell"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 253516}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/examples/python/qft.py#L24-L28", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "n-qubit input state for QFT that produces output 1.", "language": "python", "parameters": "(circ, q, n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "range", "(", "arg_2", ")", ":", "arg_0", ".", "h", "(", "arg_1", "[", "arg_3", "]", ")", "arg_0", ".", "u1", "(", "math", ".", "pi", "/", "float", "(", "2", "**", "(", "arg_3", ")", ")", ",", "arg_1", "[", "arg_3", "]", ")", ".", "inverse", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"n-qubit input state for QFT that produces output 1.\"\"\"\n    for arg_3 in range(arg_2):\n        arg_0.h(arg_1[arg_3])\n        arg_0.u1(math.pi/float(2**(arg_3)), arg_1[arg_3]).inverse()", "path": "examples/python/qft.py", "identifier": "input_state", "docstring": "n-qubit input state for QFT that produces output 1.", "docstring_tokens": ["n", "-", "qubit", "input", "state", "for", "QFT", "that", "produces", "output", "1", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253517}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/matrix_drawing.py#L289-L359", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Draw solid triangle with points x0,y0 - x1,y1 - x2,y2", "language": "python", "parameters": "(setter, x0, y0, x1, y1, x2, y2, color=None, aa=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "None", ",", "arg_8", "=", "False", ")", ":", "arg_9", "=", "arg_10", "=", "arg_20", "=", "arg_19", "=", "0", "if", "arg_2", ">", "arg_4", ":", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_2", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_1", "if", "arg_4", ">", "arg_6", ":", "arg_6", ",", "arg_4", "=", "arg_4", ",", "arg_6", "arg_5", ",", "arg_3", "=", "arg_3", ",", "arg_5", "if", "arg_2", ">", "arg_4", ":", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_2", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_1", "if", "arg_2", "==", "arg_6", ":", "arg_9", "=", "arg_10", "=", "arg_1", "if", "arg_3", "<", "arg_9", ":", "arg_9", "=", "arg_3", "elif", "arg_3", ">", "arg_10", ":", "arg_10", "=", "arg_3", "if", "arg_5", "<", "arg_9", ":", "arg_9", "=", "arg_5", "elif", "arg_5", ">", "arg_10", ":", "arg_10", "=", "arg_5", "_draw_fast_hline", "(", "arg_0", ",", "arg_9", ",", "arg_2", ",", "arg_10", "-", "arg_9", "+", "1", ",", "arg_7", ",", "arg_8", ")", "arg_11", "=", "arg_3", "-", "arg_1", "arg_12", "=", "arg_4", "-", "arg_2", "arg_13", "=", "arg_5", "-", "arg_1", "arg_14", "=", "arg_6", "-", "arg_2", "arg_15", "=", "arg_5", "-", "arg_3", "arg_16", "=", "arg_6", "-", "arg_4", "arg_17", "=", "0", "arg_18", "=", "0", "if", "arg_4", "==", "arg_6", ":", "arg_19", "=", "arg_4", "else", ":", "arg_19", "=", "arg_4", "-", "1", "for", "arg_20", "in", "range", "(", "arg_20", ",", "arg_19", "+", "1", ")", ":", "arg_9", "=", "arg_1", "+", "arg_17", "/", "arg_12", "arg_10", "=", "arg_1", "+", "arg_18", "/", "arg_14", "arg_17", "+=", "arg_11", "arg_18", "+=", "arg_13", "if", "arg_9", ">", "arg_10", ":", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_9", "_draw_fast_hline", "(", "arg_0", ",", "arg_9", ",", "arg_20", ",", "arg_10", "-", "arg_9", "+", "1", ",", "arg_7", ",", "arg_8", ")", "arg_17", "=", "arg_15", "*", "(", "arg_20", "-", "arg_4", ")", "arg_18", "=", "arg_13", "*", "(", "arg_20", "-", "arg_2", ")", "for", "arg_20", "in", "range", "(", "arg_20", ",", "arg_6", "+", "1", ")", ":", "arg_9", "=", "arg_3", "+", "arg_17", "/", "arg_16", "arg_10", "=", "arg_1", "+", "arg_18", "/", "arg_14", "arg_17", "+=", "arg_15", "arg_18", "+=", "arg_13", "if", "arg_9", ">", "arg_10", ":", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_9", "_draw_fast_hline", "(", "arg_0", ",", "arg_9", ",", "arg_20", ",", "arg_10", "-", "arg_9", "+", "1", ",", "arg_7", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7=None, arg_8=False):\n    \"\"\"Draw solid triangle with points x0,y0 - x1,y1 - x2,y2\"\"\"\n    arg_9 = arg_10 = arg_20 = arg_19 = 0\n\n    if arg_2 > arg_4:\n        arg_2, arg_4 = arg_4, arg_2\n        arg_1, arg_3 = arg_3, arg_1\n    if arg_4 > arg_6:\n        arg_6, arg_4 = arg_4, arg_6\n        arg_5, arg_3 = arg_3, arg_5\n    if arg_2 > arg_4:\n        arg_2, arg_4 = arg_4, arg_2\n        arg_1, arg_3 = arg_3, arg_1\n\n    if arg_2 == arg_6:  # Handle awkward all-on-same-line case as its own thing\n        arg_9 = arg_10 = arg_1\n        if arg_3 < arg_9:\n            arg_9 = arg_3\n        elif arg_3 > arg_10:\n            arg_10 = arg_3\n        if arg_5 < arg_9:\n            arg_9 = arg_5\n        elif arg_5 > arg_10:\n            arg_10 = arg_5\n            _draw_fast_hline(arg_0, arg_9, arg_2, arg_10 - arg_9 + 1, arg_7, arg_8)\n\n    arg_11 = arg_3 - arg_1\n    arg_12 = arg_4 - arg_2\n    arg_13 = arg_5 - arg_1\n    arg_14 = arg_6 - arg_2\n    arg_15 = arg_5 - arg_3\n    arg_16 = arg_6 - arg_4\n    arg_17 = 0\n    arg_18 = 0\n\n    # For upper part of triangle, find scanline crossings for segments\n    # 0-1 and 0-2.  If y1=y2 (flat-bottomed triangle), the scanline y1\n    # is included here (and second loop will be skipped, avoiding a /0\n    # error there), otherwise scanline y1 is skipped here and handled\n    # in the second loop...which also avoids a /0 error here if y0=y1\n    # (flat-topped triangle).\n\n    if arg_4 == arg_6:\n        arg_19 = arg_4  # include y1 scanline\n    else:\n        arg_19 = arg_4 - 1  # skip it\n\n    for arg_20 in range(arg_20, arg_19 + 1):\n        arg_9 = arg_1 + arg_17 / arg_12\n        arg_10 = arg_1 + arg_18 / arg_14\n        arg_17 += arg_11\n        arg_18 += arg_13\n\n        if arg_9 > arg_10:\n            arg_9, arg_10 = arg_10, arg_9\n            _draw_fast_hline(arg_0, arg_9, arg_20, arg_10 - arg_9 + 1, arg_7, arg_8)\n\n    # For lower part of triangle, find scanline crossings for segments\n    # 0-2 and 1-2.  This loop is skipped if y1=y2.\n    arg_17 = arg_15 * (arg_20 - arg_4)\n    arg_18 = arg_13 * (arg_20 - arg_2)\n\n    for arg_20 in range(arg_20, arg_6 + 1):\n        arg_9 = arg_3 + arg_17 / arg_16\n        arg_10 = arg_1 + arg_18 / arg_14\n        arg_17 += arg_15\n        arg_18 += arg_13\n\n        if arg_9 > arg_10:\n            arg_9, arg_10 = arg_10, arg_9\n            _draw_fast_hline(arg_0, arg_9, arg_20, arg_10 - arg_9 + 1, arg_7, arg_8)", "path": "bibliopixel/layout/matrix_drawing.py", "identifier": "fill_triangle", "docstring": "Draw solid triangle with points x0,y0 - x1,y1 - x2,y2", "docstring_tokens": ["Draw", "solid", "triangle", "with", "points", "x0", "y0", "-", "x1", "y1", "-", "x2", "y2"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 253518}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/tf_backend.py#L31-L40", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Constructs function encapsulated in the graph and the session.", "language": "python", "parameters": "(func, graph, session)", "return_statement": "return _wrapped", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "import", "keras", ".", "backend", "as", "K", "@", "wraps", "(", "arg_0", ")", "def", "_wrapped", "(", "*", "arg_3", ",", "**", "arg_4", ")", ":", "with", "arg_1", ".", "as_default", "(", ")", ":", "K", ".", "set_session", "(", "arg_2", ")", "return", "arg_0", "(", "*", "arg_3", ",", "**", "arg_4", ")", "return", "_wrapped"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Constructs function encapsulated in the graph and the session.\"\"\"\n    import keras.backend as K\n\n    @wraps(arg_0)\n    def _wrapped(*arg_3, **arg_4):\n        with arg_1.as_default():\n            K.set_session(arg_2)\n            return arg_0(*arg_3, **arg_4)\n    return _wrapped", "path": "deeppavlov/core/models/tf_backend.py", "identifier": "_keras_wrap", "docstring": "Constructs function encapsulated in the graph and the session.", "docstring_tokens": ["Constructs", "function", "encapsulated", "in", "the", "graph", "and", "the", "session", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 253519}
{"url": "https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/setup.py#L40-L62", "sha": "6b4d27eb1a1eaf188c6885c7364ef27e92b1b957", "docstring_summary": "Monkey-patch compiler to allow for removal of default compiler flags.", "language": "python", "parameters": "(remove_flags)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "arg_18", ".", "ccompiler", "def", "_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "0", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ")", ":", "for", "arg_10", "in", "arg_0", ":", "if", "arg_10", "in", "arg_1", ".", "compiler_so", ":", "arg_1", ".", "compiler_so", ".", "remove", "(", "arg_10", ")", "arg_4", ",", "arg_11", ",", "arg_8", ",", "arg_12", ",", "arg_13", "=", "arg_1", ".", "_setup_compile", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_2", ",", "arg_9", ",", "arg_8", ")", "arg_14", "=", "arg_1", ".", "_get_cc_args", "(", "arg_12", ",", "arg_6", ",", "arg_7", ")", "for", "arg_15", "in", "arg_11", ":", "try", ":", "arg_16", ",", "arg_17", "=", "arg_13", "[", "arg_15", "]", "except", "KeyError", ":", "continue", "arg_1", ".", "_compile", "(", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_14", ",", "arg_8", ",", "arg_12", ")", "return", "arg_11", "arg_18", ".", "ccompiler", ".", "CCompiler", ".", "compile", "=", "_Func"], "function": "def Func(arg_0):\n    \"\"\"\n    Monkey-patch compiler to allow for removal of default compiler flags.\n    \"\"\"\n    import arg_18.ccompiler\n\n    def _Func(arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=0,\n            arg_7=None, arg_8=None, arg_9=None):\n        for arg_10 in arg_0:\n            if arg_10 in arg_1.compiler_so:\n                arg_1.compiler_so.remove(arg_10)\n        arg_4, arg_11, arg_8, arg_12, arg_13 = arg_1._setup_compile(arg_3, arg_4,\n                arg_5, arg_2, arg_9, arg_8)\n        arg_14 = arg_1._get_cc_args(arg_12, arg_6, arg_7)\n        for arg_15 in arg_11:\n            try:\n                arg_16, arg_17 = arg_13[arg_15]\n            except KeyError:\n                continue\n            arg_1._compile(arg_15, arg_16, arg_17, arg_14, arg_8, arg_12)\n        return arg_11\n\n    arg_18.ccompiler.CCompiler.compile = _Func", "path": "setup.py", "identifier": "fix_compile", "docstring": "Monkey-patch compiler to allow for removal of default compiler flags.", "docstring_tokens": ["Monkey", "-", "patch", "compiler", "to", "allow", "for", "removal", "of", "default", "compiler", "flags", "."], "nwo": "capitalone/giraffez", "score": 0.19842634881568408, "idx": 253520}
{"url": "https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlproto.py#L84-L95", "sha": "246b7722d62b87b48be66d9a871509a537728962", "docstring_summary": "Read incoming message.", "language": "python", "parameters": "(self)", "return_statement": "return term", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "packet", "with", "arg_0", ".", "__Func_lock", ":", "arg_2", "=", "arg_0", ".", "__buffer", "while", "len", "(", "arg_2", ")", "<", "arg_1", ":", "arg_2", "+=", "arg_0", ".", "_Func_data", "(", ")", "arg_3", "=", "arg_0", ".", "__unpack", "(", "arg_2", "[", ":", "arg_1", "]", ")", "[", "0", "]", "+", "arg_1", "while", "len", "(", "arg_2", ")", "<", "arg_3", ":", "arg_2", "+=", "arg_0", ".", "_Func_data", "(", ")", "arg_4", ",", "arg_0", ".", "__buffer", "=", "decode", "(", "arg_2", "[", "arg_1", ":", "]", ")", "return", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"Read incoming message.\"\"\"\n        arg_1 = arg_0.packet\n        with arg_0.__Func_lock:\n            arg_2 = arg_0.__buffer\n            while len(arg_2) < arg_1:\n                arg_2 += arg_0._Func_data()\n            arg_3 = arg_0.__unpack(arg_2[:arg_1])[0] + arg_1\n            while len(arg_2) < arg_3:\n                arg_2 += arg_0._Func_data()\n            arg_4, arg_0.__buffer = decode(arg_2[arg_1:])\n        return arg_4", "path": "priv/python3/erlport/erlproto.py", "identifier": "Port.read", "docstring": "Read incoming message.", "docstring_tokens": ["Read", "incoming", "message", "."], "nwo": "hdima/erlport", "score": 0.7170200836482384, "idx": 253521}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/abweb.py#L93-L135", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "login and update cached cookies", "language": "python", "parameters": "(self, username, password)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "logger", ".", "debug", "(", "'login ...'", ")", "arg_3", "=", "arg_0", ".", "session", ".", "http", ".", "get", "(", "arg_0", ".", "login_url", ")", "arg_4", "=", "arg_0", ".", "_input_re", ".", "findall", "(", "arg_3", ".", "text", ")", "if", "not", "arg_4", ":", "raise", "PluginError", "(", "'Missing input data on login website.'", ")", "arg_5", "=", "{", "}", "for", "arg_6", "in", "arg_4", ":", "try", ":", "arg_7", "=", "arg_0", ".", "_name_re", ".", "search", "(", "arg_6", ")", ".", "group", "(", "1", ")", "except", "AttributeError", ":", "continue", "try", ":", "arg_8", "=", "arg_0", ".", "_value_re", ".", "search", "(", "arg_6", ")", ".", "group", "(", "1", ")", "except", "AttributeError", ":", "arg_8", "=", "''", "arg_5", "[", "arg_7", "]", "=", "arg_8", "arg_9", "=", "{", "'ctl00$Login1$UserName'", ":", "arg_1", ",", "'ctl00$Login1$Password'", ":", "arg_2", ",", "'ctl00$Login1$LoginButton.x'", ":", "'0'", ",", "'ctl00$Login1$LoginButton.y'", ":", "'0'", "}", "arg_5", ".", "update", "(", "arg_9", ")", "arg_3", "=", "arg_0", ".", "session", ".", "http", ".", "post", "(", "arg_0", ".", "login_url", ",", "arg_5", "=", "arg_5", ")", "for", "arg_10", "in", "arg_0", ".", "session", ".", "http", ".", "cookies", ":", "arg_0", ".", "_session_attributes", ".", "set", "(", "arg_10", ".", "name", ",", "arg_10", ".", "value", ",", "expires", "=", "3600", "*", "24", ")", "if", "arg_0", ".", "_session_attributes", ".", "get", "(", "'ASP.NET_SessionId'", ")", "and", "arg_0", ".", "_session_attributes", ".", "get", "(", "'.abportail1'", ")", ":", "arg_0", ".", "logger", ".", "debug", "(", "'New session data'", ")", "arg_0", ".", "set_expires_time_cache", "(", ")", "return", "True", "else", ":", "arg_0", ".", "logger", ".", "error", "(", "'Failed to login, check your username/password'", ")", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''login and update cached cookies'''\n        arg_0.logger.debug('login ...')\n\n        arg_3 = arg_0.session.http.get(arg_0.login_url)\n        arg_4 = arg_0._input_re.findall(arg_3.text)\n        if not arg_4:\n            raise PluginError('Missing input data on login website.')\n\n        arg_5 = {}\n        for arg_6 in arg_4:\n            try:\n                arg_7 = arg_0._name_re.search(arg_6).group(1)\n            except AttributeError:\n                continue\n\n            try:\n                arg_8 = arg_0._value_re.search(arg_6).group(1)\n            except AttributeError:\n                arg_8 = ''\n\n            arg_5[arg_7] = arg_8\n\n        arg_9 = {\n            'ctl00$Login1$UserName': arg_1,\n            'ctl00$Login1$Password': arg_2,\n            'ctl00$Login1$LoginButton.x': '0',\n            'ctl00$Login1$LoginButton.y': '0'\n        }\n        arg_5.update(arg_9)\n\n        arg_3 = arg_0.session.http.post(arg_0.login_url, arg_5=arg_5)\n\n        for arg_10 in arg_0.session.http.cookies:\n            arg_0._session_attributes.set(arg_10.name, arg_10.value, expires=3600 * 24)\n\n        if arg_0._session_attributes.get('ASP.NET_SessionId') and arg_0._session_attributes.get('.abportail1'):\n            arg_0.logger.debug('New session data')\n            arg_0.set_expires_time_cache()\n            return True\n        else:\n            arg_0.logger.error('Failed to login, check your username/password')\n            return False", "path": "src/streamlink/plugins/abweb.py", "identifier": "ABweb._login", "docstring": "login and update cached cookies", "docstring_tokens": ["login", "and", "update", "cached", "cookies"], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 253522}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/monitor.py#L25-L30", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Scan the provided policy directory for all JSON policy files.", "language": "python", "parameters": "(p)", "return_statement": "return sorted(f)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "os", ".", "path", ".", "join", "(", "arg_0", ",", "x", ")", "for", "x", "in", "os", ".", "listdir", "(", "arg_0", ")", "if", "x", ".", "endswith", "(", "\".json\"", ")", "]", "return", "sorted", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Scan the provided policy directory for all JSON policy files.\n    \"\"\"\n    arg_1 = [os.path.join(arg_0, x) for x in os.listdir(arg_0) if x.endswith(\".json\")]\n    return sorted(arg_1)", "path": "kmip/services/server/monitor.py", "identifier": "get_json_files", "docstring": "Scan the provided policy directory for all JSON policy files.", "docstring_tokens": ["Scan", "the", "provided", "policy", "directory", "for", "all", "JSON", "policy", "files", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 253523}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L3755-L3801", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the ObjectDefaults structure encoding to the data stream.", "language": "python", "parameters": "(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_2_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ")", ":", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "raise", "exceptions", ".", "VersionNotSupported", "(", "\"KMIP {} does not support the ObjectDefaults object.\"", ".", "format", "(", "arg_2", ".", "value", ")", ")", "arg_6", "=", "BytearrayStream", "(", ")", "if", "arg_0", ".", "_object_type", ":", "arg_0", ".", "_object_type", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The ObjectDefaults structure is missing the object type \"", "\"field.\"", ")", "if", "arg_0", ".", "_attributes", ":", "arg_0", ".", "_attributes", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The ObjectDefaults structure is missing the attributes field.\"", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "ObjectDefaults", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_2_0):\n        \"\"\"\n        Write the ObjectDefaults structure encoding to the data stream.\n\n        Args:\n            output_buffer (stream): A data stream in which to encode\n                Attributes structure data, supporting a Func method.\n            kmip_version (enum): A KMIPVersion enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            InvalidField: Raised if the object type or attributes fields are\n                not defined.\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the ObjectDefaults structure.\n        \"\"\"\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            raise exceptions.VersionNotSupported(\n                \"KMIP {} does not support the ObjectDefaults object.\".format(\n                    arg_2.value\n                )\n            )\n\n        arg_6 = BytearrayStream()\n\n        if arg_0._object_type:\n            arg_0._object_type.Func(arg_6, arg_2=arg_2)\n        else:\n            raise exceptions.InvalidField(\n                \"The ObjectDefaults structure is missing the object type \"\n                \"field.\"\n            )\n\n        if arg_0._attributes:\n            arg_0._attributes.Func(arg_6, arg_2=arg_2)\n        else:\n            raise exceptions.InvalidField(\n                \"The ObjectDefaults structure is missing the attributes field.\"\n            )\n\n        arg_0.length = arg_6.length()\n        super(ObjectDefaults, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/objects.py", "identifier": "ObjectDefaults.write", "docstring": "Write the ObjectDefaults structure encoding to the data stream.\n\n        Args:\n            output_buffer (stream): A data stream in which to encode\n                Attributes structure data, supporting a write method.\n            kmip_version (enum): A KMIPVersion enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            InvalidField: Raised if the object type or attributes fields are\n                not defined.\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the ObjectDefaults structure.", "docstring_tokens": ["Write", "the", "ObjectDefaults", "structure", "encoding", "to", "the", "data", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 253524}
{"url": "https://github.com/spotify/pyschema/blob/7e6c3934150bcb040c628d74ace6caf5fcf867df/pyschema_extensions/avro_schema_parser.py#L49-L57", "sha": "7e6c3934150bcb040c628d74ace6caf5fcf867df", "docstring_summary": "Load and return a PySchema class from an avsc string", "language": "python", "parameters": "(schema_string)", "return_statement": "return AvroSchemaParser().parse_schema_struct(schema_struct)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "\"utf8\"", ")", "arg_1", "=", "json", ".", "loads", "(", "arg_0", ")", "return", "AvroSchemaParser", "(", ")", ".", "parse_schema_struct", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Load and return a PySchema class from an avsc string\n    \"\"\"\n    if isinstance(arg_0, str):\n        arg_0 = arg_0.decode(\"utf8\")\n    arg_1 = json.loads(arg_0)\n\n    return AvroSchemaParser().parse_schema_struct(arg_1)", "path": "pyschema_extensions/avro_schema_parser.py", "identifier": "parse_schema_string", "docstring": "Load and return a PySchema class from an avsc string", "docstring_tokens": ["Load", "and", "return", "a", "PySchema", "class", "from", "an", "avsc", "string"], "nwo": "spotify/pyschema", "score": 0.41017317071999654, "idx": 253525}
{"url": "https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/views.py#L214-L229", "sha": "cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2", "docstring_summary": "Public form to add an event.", "language": "python", "parameters": "(request)", "return_statement": "return render(request, 'happenings/event_form.html', {\n        'form': form,\n        'form_title': 'Add an event'\n    })", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "AddEventForm", "(", "arg_0", ".", "POST", "or", "None", ")", "if", "arg_1", ".", "is_valid", "(", ")", ":", "arg_2", "=", "arg_1", ".", "save", "(", "commit", "=", "False", ")", "arg_2", ".", "sites", "=", "settings", ".", "SITE_ID", "arg_2", ".", "submitted_by", "=", "arg_0", ".", "user", "arg_2", ".", "approved", "=", "True", "arg_2", ".", "slug", "=", "slugify", "(", "arg_2", ".", "name", ")", "arg_2", ".", "save", "(", ")", "messages", ".", "success", "(", "arg_0", ",", "'Your event has been added.'", ")", "return", "HttpResponseRedirect", "(", "reverse", "(", "'events_index'", ")", ")", "return", "render", "(", "arg_0", ",", "'happenings/event_form.html'", ",", "{", "'form'", ":", "arg_1", ",", "'form_title'", ":", "'Add an event'", "}", ")"], "function": "def Func(arg_0):\n    \"\"\" Public form to add an event. \"\"\"\n    arg_1 = AddEventForm(arg_0.POST or None)\n    if arg_1.is_valid():\n        arg_2 = arg_1.save(commit=False)\n        arg_2.sites = settings.SITE_ID\n        arg_2.submitted_by = arg_0.user\n        arg_2.approved = True\n        arg_2.slug = slugify(arg_2.name)\n        arg_2.save()\n        messages.success(arg_0, 'Your event has been added.')\n        return HttpResponseRedirect(reverse('events_index'))\n    return render(arg_0, 'happenings/event_form.html', {\n        'form': arg_1,\n        'form_title': 'Add an event'\n    })", "path": "build/lib/happenings/views.py", "identifier": "add_event", "docstring": "Public form to add an event.", "docstring_tokens": ["Public", "form", "to", "add", "an", "event", "."], "nwo": "tBaxter/tango-happenings", "score": 0.09252797783733271, "idx": 253526}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/data_generator.py#L301-L308", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns encodings for all the records", "language": "python", "parameters": "(self)", "return_statement": "return encodings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "fields", "[", "0", "]", ".", "numEncodings", "assert", "(", "all", "(", "arg_2", ".", "numEncodings", "==", "arg_1", "for", "arg_2", "in", "arg_0", ".", "fields", ")", ")", "arg_3", "=", "[", "arg_0", ".", "getEncoding", "(", "index", ")", "for", "index", "in", "range", "(", "arg_1", ")", "]", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Returns encodings for all the records\"\"\"\n\n    arg_1=arg_0.fields[0].numEncodings\n    assert (all(arg_2.numEncodings==arg_1 for arg_2 in arg_0.fields))\n    arg_3 = [arg_0.getEncoding(index) for index in range(arg_1)]\n\n    return arg_3", "path": "src/nupic/data/generators/data_generator.py", "identifier": "DataGenerator.getAllEncodings", "docstring": "Returns encodings for all the records", "docstring_tokens": ["Returns", "encodings", "for", "all", "the", "records"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253527}
{"url": "https://github.com/Patreon/multiget-cache-py/blob/824ec4809c97cc7e0035810bd9fefd1262de3318/multiget_cache/base_cache_wrapper.py#L55-L60", "sha": "824ec4809c97cc7e0035810bd9fefd1262de3318", "docstring_summary": "Remove the key from the request cache and from memcache.", "language": "python", "parameters": "(self, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "get_cache", "(", ")", "arg_3", "=", "arg_0", ".", "get_cache_key", "(", "*", "arg_1", ")", "if", "arg_3", "in", "arg_2", ":", "del", "arg_2", "[", "arg_3", "]"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Remove the key from the request cache and from memcache.\"\"\"\n        arg_2 = get_cache()\n        arg_3 = arg_0.get_cache_key(*arg_1)\n        if arg_3 in arg_2:\n            del arg_2[arg_3]", "path": "multiget_cache/base_cache_wrapper.py", "identifier": "BaseCacheWrapper.delete", "docstring": "Remove the key from the request cache and from memcache.", "docstring_tokens": ["Remove", "the", "key", "from", "the", "request", "cache", "and", "from", "memcache", "."], "nwo": "Patreon/multiget-cache-py", "score": 0.35703541153395085, "idx": 253528}
{"url": "https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L371-L380", "sha": "6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d", "docstring_summary": "Synchronous DELETE request. ``data`` must be a JSONable value.", "language": "python", "parameters": "(self, url, name, params=None, headers=None, connection=None)", "return_statement": "return make_delete_request(endpoint, params, headers, connection=connection)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "''", "arg_3", "=", "arg_3", "or", "{", "}", "arg_4", "=", "arg_4", "or", "{", "}", "arg_6", "=", "arg_0", ".", "_build_endpoint_url", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_authenticate", "(", "arg_3", ",", "arg_4", ")", "return", "make_Func_request", "(", "arg_6", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"\n        Synchronous DELETE request. ``data`` must be a JSONable value.\n        \"\"\"\n        if not arg_2: arg_2 = ''\n        arg_3 = arg_3 or {}\n        arg_4 = arg_4 or {}\n        arg_6 = arg_0._build_endpoint_url(arg_1, arg_2)\n        arg_0._authenticate(arg_3, arg_4)\n        return make_Func_request(arg_6, arg_3, arg_4, arg_5=arg_5)", "path": "firebase/firebase.py", "identifier": "FirebaseApplication.delete", "docstring": "Synchronous DELETE request. ``data`` must be a JSONable value.", "docstring_tokens": ["Synchronous", "DELETE", "request", ".", "data", "must", "be", "a", "JSONable", "value", "."], "nwo": "ozgur/python-firebase", "score": 0.7583798599854712, "idx": 253529}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L398-L426", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "returns an iterator to grab four lines at a time", "language": "python", "parameters": "(tups)", "return_statement": "return genquarts, ofile1, ofile2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "[", "0", "]", ".", "endswith", "(", "\".gz\"", ")", ":", "arg_1", "=", "gzip", ".", "open", "else", ":", "arg_1", "=", "open", "arg_2", "=", "arg_1", "(", "arg_0", "[", "0", "]", ",", "'r'", ")", "arg_3", "=", "iter", "(", "arg_2", ")", "arg_4", "=", "itertools", ".", "izip", "(", "arg_3", ",", "arg_3", ",", "arg_3", ",", "arg_3", ")", "if", "arg_0", "[", "1", "]", ":", "arg_5", "=", "arg_1", "(", "arg_0", "[", "1", "]", ",", "'r'", ")", "arg_6", "=", "iter", "(", "arg_5", ")", "arg_7", "=", "itertools", ".", "izip", "(", "arg_6", ",", "arg_6", ",", "arg_6", ",", "arg_6", ")", "arg_8", "=", "itertools", ".", "izip", "(", "arg_4", ",", "arg_7", ")", "else", ":", "arg_5", "=", "0", "arg_8", "=", "itertools", ".", "izip", "(", "arg_4", ",", "iter", "(", "int", ",", "1", ")", ")", "def", "feedme", "(", "arg_8", ")", ":", "for", "arg_9", "in", "arg_8", ":", "yield", "arg_9", "arg_10", "=", "feedme", "(", "arg_8", ")", "return", "arg_10", ",", "arg_2", ",", "arg_5"], "function": "def Func(arg_0):\n    \"\"\" returns an iterator to grab four lines at a time \"\"\"\n\n    if arg_0[0].endswith(\".gz\"):\n        arg_1 = gzip.open\n    else:\n        arg_1 = open\n\n    ## create iterators \n    arg_2 = arg_1(arg_0[0], 'r')\n    arg_3 = iter(arg_2) \n    arg_4 = itertools.izip(arg_3, arg_3, arg_3, arg_3)\n    if arg_0[1]:\n        arg_5 = arg_1(arg_0[1], 'r')\n        arg_6 = iter(arg_5)  \n        arg_7 = itertools.izip(arg_6, arg_6, arg_6, arg_6)\n        arg_8 = itertools.izip(arg_4, arg_7)\n    else:\n        arg_5 = 0\n        arg_8 = itertools.izip(arg_4, iter(int, 1))\n\n    ## make a generator\n    def feedme(arg_8):\n        for arg_9 in arg_8:\n            yield arg_9\n    arg_10 = feedme(arg_8)\n\n    ## return generator and handles\n    return arg_10, arg_2, arg_5", "path": "ipyrad/assemble/demultiplex.py", "identifier": "get_quart_iter", "docstring": "returns an iterator to grab four lines at a time", "docstring_tokens": ["returns", "an", "iterator", "to", "grab", "four", "lines", "at", "a", "time"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 253530}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/dflow.py#L461-L490", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Look for inputs of the app that are remote files. Submit stage_in\n        apps for such files and replace the file objects in the inputs list with\n        corresponding DataFuture objects.", "language": "python", "parameters": "(self, executor, args, kwargs)", "return_statement": "return tuple(newargs), kwargs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_1", "==", "'data_manager'", ":", "return", "arg_2", ",", "arg_3", "arg_4", "=", "arg_3", ".", "get", "(", "'inputs'", ",", "[", "]", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ")", ":", "if", "isinstance", "(", "arg_6", ",", "File", ")", "and", "arg_6", ".", "is_remote", "(", ")", ":", "arg_4", "[", "arg_5", "]", "=", "arg_0", ".", "data_manager", ".", "stage_in", "(", "arg_6", ",", "arg_1", ")", "for", "arg_7", ",", "arg_6", "in", "arg_3", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_6", ",", "File", ")", "and", "arg_6", ".", "is_remote", "(", ")", ":", "arg_3", "[", "arg_7", "]", "=", "arg_0", ".", "data_manager", ".", "stage_in", "(", "arg_6", ",", "arg_1", ")", "arg_8", "=", "list", "(", "arg_2", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_8", ")", ":", "if", "isinstance", "(", "arg_6", ",", "File", ")", "and", "arg_6", ".", "is_remote", "(", ")", ":", "arg_8", "[", "arg_5", "]", "=", "arg_0", ".", "data_manager", ".", "stage_in", "(", "arg_6", ",", "arg_1", ")", "return", "tuple", "(", "arg_8", ")", ",", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Look for inputs of the app that are remote files. Submit stage_in\n        apps for such files and replace the file objects in the inputs list with\n        corresponding DataFuture objects.\n\n        Args:\n            - executor (str) : executor where the app is going to be launched\n            - args (List) : Positional args to app function\n            - kwargs (Dict) : Kwargs to app function\n        \"\"\"\n\n        # Return if the task is _*_stage_in\n        if arg_1 == 'data_manager':\n            return arg_2, arg_3\n\n        arg_4 = arg_3.get('inputs', [])\n        for arg_5, arg_6 in enumerate(arg_4):\n            if isinstance(arg_6, File) and arg_6.is_remote():\n                arg_4[arg_5] = arg_0.data_manager.stage_in(arg_6, arg_1)\n\n        for arg_7, arg_6 in arg_3.items():\n            if isinstance(arg_6, File) and arg_6.is_remote():\n                arg_3[arg_7] = arg_0.data_manager.stage_in(arg_6, arg_1)\n\n        arg_8 = list(arg_2)\n        for arg_5, arg_6 in enumerate(arg_8):\n            if isinstance(arg_6, File) and arg_6.is_remote():\n                arg_8[arg_5] = arg_0.data_manager.stage_in(arg_6, arg_1)\n\n        return tuple(arg_8), arg_3", "path": "parsl/dataflow/dflow.py", "identifier": "DataFlowKernel._add_input_deps", "docstring": "Look for inputs of the app that are remote files. Submit stage_in\n        apps for such files and replace the file objects in the inputs list with\n        corresponding DataFuture objects.\n\n        Args:\n            - executor (str) : executor where the app is going to be launched\n            - args (List) : Positional args to app function\n            - kwargs (Dict) : Kwargs to app function", "docstring_tokens": ["Look", "for", "inputs", "of", "the", "app", "that", "are", "remote", "files", ".", "Submit", "stage_in", "apps", "for", "such", "files", "and", "replace", "the", "file", "objects", "in", "the", "inputs", "list", "with", "corresponding", "DataFuture", "objects", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 253531}
{"url": "https://github.com/rollbar/pyrollbar/blob/33ef2e723a33d09dd6302f978f4a3908be95b9d2/rollbar/contrib/django/middleware.py#L236-L246", "sha": "33ef2e723a33d09dd6302f978f4a3908be95b9d2", "docstring_summary": "If there's no log configuration, set up a default handler.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "log", ".", "handlers", ":", "return", "arg_1", "=", "logging", ".", "StreamHandler", "(", ")", "arg_2", "=", "logging", ".", "Formatter", "(", "'%(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s'", ")", "arg_1", ".", "setFormatter", "(", "arg_2", ")", "log", ".", "addHandler", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        If there's no log configuration, set up a default handler.\n        \"\"\"\n        if log.handlers:\n            return\n        arg_1 = logging.StreamHandler()\n        arg_2 = logging.Formatter(\n            '%(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s')\n        arg_1.setFormatter(arg_2)\n        log.addHandler(arg_1)", "path": "rollbar/contrib/django/middleware.py", "identifier": "RollbarNotifierMiddleware._ensure_log_handler", "docstring": "If there's no log configuration, set up a default handler.", "docstring_tokens": ["If", "there", "s", "no", "log", "configuration", "set", "up", "a", "default", "handler", "."], "nwo": "rollbar/pyrollbar", "score": 0.8439078507967885, "idx": 253532}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/transTmpl.py#L184-L205", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Parse any HDL type to this transaction template instance", "language": "python", "parameters": "(self, dtype: HdlType, bitAddr: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ")", "->", "None", ":", "arg_0", ".", "bitAddr", "=", "arg_3", "arg_5", "=", "False", "if", "isinstance", "(", "arg_1", ",", "Bits", ")", ":", "arg_6", "=", "arg_0", ".", "_loadFromBits", "elif", "isinstance", "(", "arg_1", ",", "HStruct", ")", ":", "arg_6", "=", "arg_0", ".", "_loadFromHStruct", "elif", "isinstance", "(", "arg_1", ",", "HArray", ")", ":", "arg_6", "=", "arg_0", ".", "_loadFromArray", "elif", "isinstance", "(", "arg_1", ",", "HStream", ")", ":", "arg_6", "=", "arg_0", ".", "_loadFromHStream", "elif", "isinstance", "(", "arg_1", ",", "HUnion", ")", ":", "arg_6", "=", "arg_0", ".", "_loadFromUnion", "arg_5", "=", "True", "else", ":", "raise", "TypeError", "(", "\"expected instance of HdlType\"", ",", "arg_1", ")", "arg_0", ".", "bitAddrEnd", "=", "arg_6", "(", "arg_1", ",", "arg_3", ")", "arg_0", ".", "childrenAreChoice", "=", "arg_5"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4) -> None:\n        \"\"\"\n        Parse any HDL type to this transaction template instance\n        \"\"\"\n        arg_0.bitAddr = arg_3\n        arg_5 = False\n        if isinstance(arg_1, Bits):\n            arg_6 = arg_0._loadFromBits\n        elif isinstance(arg_1, HStruct):\n            arg_6 = arg_0._loadFromHStruct\n        elif isinstance(arg_1, HArray):\n            arg_6 = arg_0._loadFromArray\n        elif isinstance(arg_1, HStream):\n            arg_6 = arg_0._loadFromHStream\n        elif isinstance(arg_1, HUnion):\n            arg_6 = arg_0._loadFromUnion\n            arg_5 = True\n        else:\n            raise TypeError(\"expected instance of HdlType\", arg_1)\n\n        arg_0.bitAddrEnd = arg_6(arg_1, arg_3)\n        arg_0.childrenAreChoice = arg_5", "path": "hwt/hdl/transTmpl.py", "identifier": "TransTmpl._loadFromHType", "docstring": "Parse any HDL type to this transaction template instance", "docstring_tokens": ["Parse", "any", "HDL", "type", "to", "this", "transaction", "template", "instance"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 253533}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Droplet.py#L529-L570", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Create the droplet with object properties.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", "in", "arg_2", ".", "keys", "(", ")", ":", "setattr", "(", "arg_0", ",", "arg_3", ",", "arg_2", "[", "arg_3", "]", ")", "if", "not", "arg_0", ".", "size_slug", "and", "arg_0", ".", "size", ":", "arg_0", ".", "size_slug", "=", "arg_0", ".", "size", "arg_5", "=", "Droplet", ".", "__get_ssh_keys_id_or_fingerprint", "(", "arg_0", ".", "ssh_keys", ",", "arg_0", ".", "token", ",", "arg_0", ".", "name", ")", "arg_6", "=", "{", "\"name\"", ":", "arg_0", ".", "name", ",", "\"size\"", ":", "arg_0", ".", "size_slug", ",", "\"image\"", ":", "arg_0", ".", "image", ",", "\"region\"", ":", "arg_0", ".", "region", ",", "\"ssh_keys\"", ":", "arg_5", ",", "\"backups\"", ":", "bool", "(", "arg_0", ".", "backups", ")", ",", "\"ipv6\"", ":", "bool", "(", "arg_0", ".", "ipv6", ")", ",", "\"private_networking\"", ":", "bool", "(", "arg_0", ".", "private_networking", ")", ",", "\"volumes\"", ":", "arg_0", ".", "volumes", ",", "\"tags\"", ":", "arg_0", ".", "tags", ",", "\"monitoring\"", ":", "bool", "(", "arg_0", ".", "monitoring", ")", ",", "}", "if", "arg_0", ".", "user_data", ":", "arg_6", "[", "\"user_data\"", "]", "=", "arg_0", ".", "user_data", "arg_6", "=", "arg_0", ".", "get_data", "(", "\"droplets/\"", ",", "type", "=", "POST", ",", "params", "=", "arg_6", ")", "if", "arg_6", ":", "arg_0", ".", "id", "=", "arg_6", "[", "'droplet'", "]", "[", "'id'", "]", "arg_8", "=", "arg_6", "[", "'links'", "]", "[", "'actions'", "]", "[", "0", "]", "[", "'id'", "]", "arg_0", ".", "action_ids", "=", "[", "]", "arg_0", ".", "action_ids", ".", "append", "(", "arg_8", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n            Create the droplet with object properties.\n\n            Note: Every argument and parameter given to this method will be\n            assigned to the object.\n        \"\"\"\n        for arg_3 in arg_2.keys():\n            setattr(arg_0, arg_3, arg_2[arg_3])\n\n        # Provide backwards compatibility\n        if not arg_0.size_slug and arg_0.size:\n            arg_0.size_slug = arg_0.size\n\n        arg_5 = Droplet.__get_ssh_keys_id_or_fingerprint(arg_0.ssh_keys,\n                                                               arg_0.token,\n                                                               arg_0.name)\n\n        arg_6 = {\n            \"name\": arg_0.name,\n            \"size\": arg_0.size_slug,\n            \"image\": arg_0.image,\n            \"region\": arg_0.region,\n            \"ssh_keys\": arg_5,\n            \"backups\": bool(arg_0.backups),\n            \"ipv6\": bool(arg_0.ipv6),\n            \"private_networking\": bool(arg_0.private_networking),\n            \"volumes\": arg_0.volumes,\n            \"tags\": arg_0.tags,\n            \"monitoring\": bool(arg_0.monitoring),\n        }\n\n        if arg_0.user_data:\n            arg_6[\"user_data\"] = arg_0.user_data\n\n        arg_6 = arg_0.get_data(\"droplets/\", type=POST, params=arg_6)\n\n        if arg_6:\n            arg_0.id = arg_6['droplet']['id']\n            arg_8 = arg_6['links']['actions'][0]['id']\n            arg_0.action_ids = []\n            arg_0.action_ids.append(arg_8)", "path": "digitalocean/Droplet.py", "identifier": "Droplet.create", "docstring": "Create the droplet with object properties.\n\n            Note: Every argument and parameter given to this method will be\n            assigned to the object.", "docstring_tokens": ["Create", "the", "droplet", "with", "object", "properties", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 253534}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/parentpoller.py#L67-L92", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Create an interrupt event handle.", "language": "python", "parameters": "()", "return_statement": "return ctypes.windll.kernel32.CreateEventA(\n            sa_p,  # lpEventAttributes\n            False, # bManualReset\n            False, # bInitialState\n            '')", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "class", "SECURITY_ATTRIBUTES", "(", "ctypes", ".", "Structure", ")", ":", "arg_0", "=", "[", "(", "\"nLength\"", ",", "ctypes", ".", "c_int", ")", ",", "(", "\"lpSecurityDescriptor\"", ",", "ctypes", ".", "c_void_p", ")", ",", "(", "\"bInheritHandle\"", ",", "ctypes", ".", "c_int", ")", "]", "arg_1", "=", "SECURITY_ATTRIBUTES", "(", ")", "arg_2", "=", "ctypes", ".", "pointer", "(", "arg_1", ")", "arg_1", ".", "nLength", "=", "ctypes", ".", "sizeof", "(", "SECURITY_ATTRIBUTES", ")", "arg_1", ".", "lpSecurityDescriptor", "=", "0", "arg_1", ".", "bInheritHandle", "=", "1", "return", "ctypes", ".", "windll", ".", "kernel32", ".", "CreateEventA", "(", "arg_2", ",", "False", ",", "False", ",", "''", ")"], "function": "def Func():\n        \"\"\" Create an interrupt event handle.\n\n        The parent process should use this static method for creating the\n        interrupt event that is passed to the child process. It should store\n        this handle and use it with ``send_interrupt`` to interrupt the child\n        process.\n        \"\"\"\n        # Create a security attributes struct that permits inheritance of the\n        # handle by new processes.\n        # FIXME: We can clean up this mess by requiring pywin32 for IPython.\n        class SECURITY_ATTRIBUTES(ctypes.Structure):\n            arg_0 = [ (\"nLength\", ctypes.c_int),\n                         (\"lpSecurityDescriptor\", ctypes.c_void_p),\n                         (\"bInheritHandle\", ctypes.c_int) ]\n        arg_1 = SECURITY_ATTRIBUTES()\n        arg_2 = ctypes.pointer(arg_1)\n        arg_1.nLength = ctypes.sizeof(SECURITY_ATTRIBUTES)\n        arg_1.lpSecurityDescriptor = 0\n        arg_1.bInheritHandle = 1\n\n        return ctypes.windll.kernel32.CreateEventA(\n            arg_2,  # lpEventAttributes\n            False, # bManualReset\n            False, # bInitialState\n            '')", "path": "environment/lib/python2.7/site-packages/IPython/zmq/parentpoller.py", "identifier": "ParentPollerWindows.create_interrupt_event", "docstring": "Create an interrupt event handle.\n\n        The parent process should use this static method for creating the\n        interrupt event that is passed to the child process. It should store\n        this handle and use it with ``send_interrupt`` to interrupt the child\n        process.", "docstring_tokens": ["Create", "an", "interrupt", "event", "handle", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253535}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/typeinfo.py#L336-L348", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Given a module that contains a list of some types find all symbols in the module that\n        do not start with _ and attempt to import them as types.", "language": "python", "parameters": "(self, module)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "(", "x", "for", "x", "in", "dir", "(", "arg_1", ")", "if", "not", "x", ".", "startswith", "(", "'_'", ")", ")", ":", "arg_3", "=", "getattr", "(", "arg_1", ",", "arg_2", ")", "try", ":", "arg_0", ".", "inject_type", "(", "arg_2", ",", "arg_3", ")", "except", "ArgumentError", ":", "pass"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Given a module that contains a list of some types find all symbols in the module that\n        do not start with _ and attempt to import them as types.\n        \"\"\"\n\n        for arg_2 in (x for x in dir(arg_1) if not x.startswith('_')):\n            arg_3 = getattr(arg_1, arg_2)\n\n            try:\n                arg_0.inject_type(arg_2, arg_3)\n            except ArgumentError:\n                pass", "path": "typedargs/typeinfo.py", "identifier": "TypeSystem.load_type_module", "docstring": "Given a module that contains a list of some types find all symbols in the module that\n        do not start with _ and attempt to import them as types.", "docstring_tokens": ["Given", "a", "module", "that", "contains", "a", "list", "of", "some", "types", "find", "all", "symbols", "in", "the", "module", "that", "do", "not", "start", "with", "_", "and", "attempt", "to", "import", "them", "as", "types", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 253536}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/util.py#L23-L40", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Merges the contents of two lists into a new list.", "language": "python", "parameters": "(list1, list2)", "return_statement": "return merged", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ")", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", "not", "in", "arg_2", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Merges the contents of two lists into a new list.\n\n    :param list1: the first list\n    :type list1: list\n    :param list2: the second list\n    :type list2: list\n    :returns: list\n    \"\"\"\n\n    arg_2 = list(arg_0)\n\n    for arg_3 in arg_1:\n        if arg_3 not in arg_2:\n            arg_2.append(arg_3)\n\n    return arg_2", "path": "src/tidypy/util.py", "identifier": "merge_list", "docstring": "Merges the contents of two lists into a new list.\n\n    :param list1: the first list\n    :type list1: list\n    :param list2: the second list\n    :type list2: list\n    :returns: list", "docstring_tokens": ["Merges", "the", "contents", "of", "two", "lists", "into", "a", "new", "list", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 253537}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/utils/alexa/conversation.py#L79-L99", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Routes Alexa requests to appropriate handlers.", "language": "python", "parameters": "(self, request: dict)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "arg_3", "=", "arg_1", "[", "'request'", "]", "[", "'type'", "]", "arg_4", "=", "arg_1", "[", "'request'", "]", "[", "'requestId'", "]", "log", ".", "debug", "(", "f'Received request. Type: {request_type}, id: {request_id}'", ")", "if", "arg_3", "in", "arg_0", ".", "handled_requests", ".", "keys", "(", ")", ":", "arg_5", ":", "arg_2", "=", "arg_0", ".", "handled_requests", "[", "arg_3", "]", "(", "arg_1", ")", "else", ":", "arg_5", ":", "arg_2", "=", "arg_0", ".", "handled_requests", "[", "'_unsupported'", "]", "(", "arg_1", ")", "log", ".", "warning", "(", "f'Unsupported request type: {request_type}, request id: {request_id}'", ")", "arg_0", ".", "_rearm_self_destruct", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        \"\"\"Routes Alexa requests to appropriate handlers.\n\n        Args:\n            request: Alexa request.\n        Returns:\n            response: Response conforming Alexa response specification.\n        \"\"\"\n        arg_3 = arg_1['request']['type']\n        arg_4 = arg_1['request']['requestId']\n        log.debug(f'Received request. Type: {request_type}, id: {request_id}')\n\n        if arg_3 in arg_0.handled_requests.keys():\n            arg_5: arg_2 = arg_0.handled_requests[arg_3](arg_1)\n        else:\n            arg_5: arg_2 = arg_0.handled_requests['_unsupported'](arg_1)\n            log.warning(f'Unsupported request type: {request_type}, request id: {request_id}')\n\n        arg_0._rearm_self_destruct()\n\n        return arg_5", "path": "deeppavlov/utils/alexa/conversation.py", "identifier": "Conversation.handle_request", "docstring": "Routes Alexa requests to appropriate handlers.\n\n        Args:\n            request: Alexa request.\n        Returns:\n            response: Response conforming Alexa response specification.", "docstring_tokens": ["Routes", "Alexa", "requests", "to", "appropriate", "handlers", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 253538}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L601-L609", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Send an email to invite a non-Google contact to Hangouts.", "language": "python", "parameters": "(\n            self, send_offnetwork_invitation_request\n    )", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "SendOffnetworkInvitationResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'devices/sendoffnetworkinvitation'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(\n            arg_0, arg_1\n    ):\n        \"\"\"Send an email to invite a non-Google contact to Hangouts.\"\"\"\n        arg_2 = hangouts_pb2.SendOffnetworkInvitationResponse()\n        await arg_0._pb_request('devices/sendoffnetworkinvitation',\n                               arg_1,\n                               arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.send_offnetwork_invitation", "docstring": "Send an email to invite a non-Google contact to Hangouts.", "docstring_tokens": ["Send", "an", "email", "to", "invite", "a", "non", "-", "Google", "contact", "to", "Hangouts", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 253539}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/misc/custom_grouping_helper.py#L52-L60", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Choose tasks for a given stream_id and values and Returns a list of target tasks", "language": "python", "parameters": "(self, stream_id, values)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "targets", ":", "return", "[", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "targets", "[", "arg_1", "]", ":", "arg_3", ".", "extend", "(", "arg_4", ".", "Func", "(", "arg_2", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Choose tasks for a given stream_id and values and Returns a list of target tasks\"\"\"\n    if arg_1 not in arg_0.targets:\n      return []\n\n    arg_3 = []\n    for arg_4 in arg_0.targets[arg_1]:\n      arg_3.extend(arg_4.Func(arg_2))\n    return arg_3", "path": "heron/instance/src/python/utils/misc/custom_grouping_helper.py", "identifier": "CustomGroupingHelper.choose_tasks", "docstring": "Choose tasks for a given stream_id and values and Returns a list of target tasks", "docstring_tokens": ["Choose", "tasks", "for", "a", "given", "stream_id", "and", "values", "and", "Returns", "a", "list", "of", "target", "tasks"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253540}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/util.py#L182-L223", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Naive depth-search into a directory for files with a given extension.", "language": "python", "parameters": "(in_dir, ext, depth=3, sort=True)", "return_statement": "return match", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "3", ",", "arg_3", "=", "True", ")", ":", "assert", "arg_2", ">=", "1", "arg_1", "=", "arg_1", ".", "strip", "(", "os", ".", "extsep", ")", "arg_4", "=", "list", "(", ")", "for", "arg_5", "in", "range", "(", "1", ",", "arg_2", "+", "1", ")", ":", "arg_6", "=", "os", ".", "path", ".", "sep", ".", "join", "(", "[", "\"*\"", "]", "*", "arg_5", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "os", ".", "extsep", ".", "join", "(", "[", "arg_6", ",", "arg_1", "]", ")", ")", "arg_4", "+=", "glob", ".", "glob", "(", "arg_7", ")", "if", "arg_3", ":", "arg_4", ".", "sort", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=3, arg_3=True):\n    \"\"\"Naive depth-search into a directory for files with a given extension.\n\n    Parameters\n    ----------\n    in_dir : str\n        Path to search.\n    ext : str\n        File extension to match.\n    depth : int\n        Depth of directories to search.\n    sort : bool\n        Sort the list alphabetically\n\n    Returns\n    -------\n    matched : list\n        Collection of matching file paths.\n\n    Examples\n    --------\n    >>> jams.util.Func('Audio', 'wav')\n    ['Audio/LizNelson_Rainfall/LizNelson_Rainfall_MIX.wav',\n     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_01_01.wav',\n     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_02_01.wav',\n     ...\n     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_02.wav',\n     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_03.wav',\n    'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_04.wav']\n\n    \"\"\"\n    assert arg_2 >= 1\n    arg_1 = arg_1.strip(os.extsep)\n    arg_4 = list()\n    for arg_5 in range(1, arg_2+1):\n        arg_6 = os.path.sep.join([\"*\"]*arg_5)\n        arg_7 = os.path.join(arg_0, os.extsep.join([arg_6, arg_1]))\n        arg_4 += glob.glob(arg_7)\n\n    if arg_3:\n        arg_4.sort()\n    return arg_4", "path": "jams/util.py", "identifier": "find_with_extension", "docstring": "Naive depth-search into a directory for files with a given extension.\n\n    Parameters\n    ----------\n    in_dir : str\n        Path to search.\n    ext : str\n        File extension to match.\n    depth : int\n        Depth of directories to search.\n    sort : bool\n        Sort the list alphabetically\n\n    Returns\n    -------\n    matched : list\n        Collection of matching file paths.\n\n    Examples\n    --------\n    >>> jams.util.find_with_extension('Audio', 'wav')\n    ['Audio/LizNelson_Rainfall/LizNelson_Rainfall_MIX.wav',\n     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_01_01.wav',\n     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_02_01.wav',\n     ...\n     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_02.wav',\n     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_03.wav',\n    'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_04.wav']", "docstring_tokens": ["Naive", "depth", "-", "search", "into", "a", "directory", "for", "files", "with", "a", "given", "extension", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253541}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L34-L51", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "segment the raw text into paragraphs", "language": "python", "parameters": "(lines)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_2", "=", "arg_2", ".", "strip", "(", ")", "if", "len", "(", "arg_2", ")", "<", "1", ":", "if", "len", "(", "arg_1", ")", ">", "0", ":", "yield", "\"\\n\"", ".", "join", "(", "arg_1", ")", "arg_1", "=", "[", "]", "else", ":", "arg_1", ".", "append", "(", "arg_2", ")", "if", "len", "(", "arg_1", ")", ">", "0", ":", "yield", "\"\\n\"", ".", "join", "(", "arg_1", ")"], "function": "def Func (arg_0):\n    \"\"\"\n    segment the raw text into paragraphs\n    \"\"\"\n    arg_1 = []\n\n    for arg_2 in arg_0:\n        arg_2 = arg_2.strip()\n\n        if len(arg_2) < 1:\n            if len(arg_1) > 0:\n                yield \"\\n\".join(arg_1)\n                arg_1 = []\n        else:\n            arg_1.append(arg_2)\n\n    if len(arg_1) > 0:\n        yield \"\\n\".join(arg_1)", "path": "pytextrank/pytextrank.py", "identifier": "split_grafs", "docstring": "segment the raw text into paragraphs", "docstring_tokens": ["segment", "the", "raw", "text", "into", "paragraphs"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 253542}
{"url": "https://github.com/sloria/aiohttp_utils/blob/e5b41452f8077e7d749715606b1560f4b50e3d71/aiohttp_utils/routing.py#L85-L150", "sha": "e5b41452f8077e7d749715606b1560f4b50e3d71", "docstring_summary": "Context manager which yields a function for adding multiple routes from a given module.", "language": "python", "parameters": "(\n    app: web.Application, module=None, url_prefix: str=None, name_prefix: str=None\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "Application", ",", "arg_3", "=", "None", ",", "arg_4", ":", "arg_5", "=", "None", ",", "arg_6", ":", "arg_5", "=", "None", ")", ":", "if", "isinstance", "(", "arg_3", ",", "(", "arg_5", ",", "bytes", ")", ")", ":", "arg_3", "=", "importlib", ".", "import_module", "(", "arg_3", ")", "def", "add_route", "(", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", "=", "None", ")", ":", "if", "isinstance", "(", "arg_9", ",", "(", "arg_5", ",", "bytes", ")", ")", ":", "if", "not", "arg_3", ":", "raise", "ValueError", "(", "'Must pass module to Func if passing handler name strings.'", ")", "arg_10", "=", "arg_10", "or", "arg_9", "arg_9", "=", "getattr", "(", "arg_3", ",", "arg_9", ")", "else", ":", "arg_10", "=", "arg_10", "or", "arg_9", ".", "__name__", "arg_8", "=", "make_path", "(", "arg_8", ",", "arg_4", ")", "arg_10", "=", "'.'", ".", "join", "(", "(", "arg_6", ",", "arg_10", ")", ")", "if", "arg_6", "else", "arg_10", "return", "arg_0", ".", "router", ".", "add_route", "(", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", "=", "arg_10", ")", "yield", "add_route"], "function": "def Func(\n    arg_0: arg_1.Application, arg_3=None, arg_4: arg_5=None, arg_6: arg_5=None\n):\n    \"\"\"Context manager which yields a function for adding multiple routes from a given module.\n\n    Example:\n\n    .. code-block:: python\n\n        # myapp/articles/views.py\n        async def list_articles(request):\n            return web.Response(b'article list...')\n\n        async def create_article(request):\n            return web.Response(b'created article...')\n\n    .. code-block:: python\n\n        # myapp/app.py\n        from myapp.articles import views\n\n        with Func(app, url_prefix='/api/', name_prefix='articles') as route:\n            route('GET', '/articles/', views.list_articles)\n            route('POST', '/articles/', views.create_article)\n\n        app.router['articles.list_articles'].url()  # /api/articles/\n\n    If you prefer, you can also pass module and handler names as strings.\n\n    .. code-block:: python\n\n        with Func(app, module='myapp.articles.views',\n                               url_prefix='/api/', name_prefix='articles') as route:\n            route('GET', '/articles/', 'list_articles')\n            route('POST', '/articles/', 'create_article')\n\n    :param app: Application to add routes to.\n    :param module: Import path to module (str) or module object which contains the handlers.\n    :param url_prefix: Prefix to prepend to all route paths.\n    :param name_prefix: Prefix to prepend to all route names.\n    \"\"\"\n    if isinstance(arg_3, (arg_5, bytes)):\n        arg_3 = importlib.import_module(arg_3)\n\n    def add_route(arg_7, arg_8, arg_9, arg_10=None):\n        \"\"\"\n        :param str method: HTTP method.\n        :param str path: Path for the route.\n        :param handler: A handler function or a name of a handler function contained\n            in `module`.\n        :param str name: Name for the route. If `None`, defaults to the handler's\n            function name.\n        \"\"\"\n        if isinstance(arg_9, (arg_5, bytes)):\n            if not arg_3:\n                raise ValueError(\n                    'Must pass module to Func if passing handler name strings.'\n                )\n            arg_10 = arg_10 or arg_9\n            arg_9 = getattr(arg_3, arg_9)\n        else:\n            arg_10 = arg_10 or arg_9.__name__\n        arg_8 = make_path(arg_8, arg_4)\n        arg_10 = '.'.join((arg_6, arg_10)) if arg_6 else arg_10\n        return arg_0.router.add_route(arg_7, arg_8, arg_9, arg_10=arg_10)\n    yield add_route", "path": "aiohttp_utils/routing.py", "identifier": "add_route_context", "docstring": "Context manager which yields a function for adding multiple routes from a given module.\n\n    Example:\n\n    .. code-block:: python\n\n        # myapp/articles/views.py\n        async def list_articles(request):\n            return web.Response(b'article list...')\n\n        async def create_article(request):\n            return web.Response(b'created article...')\n\n    .. code-block:: python\n\n        # myapp/app.py\n        from myapp.articles import views\n\n        with add_route_context(app, url_prefix='/api/', name_prefix='articles') as route:\n            route('GET', '/articles/', views.list_articles)\n            route('POST', '/articles/', views.create_article)\n\n        app.router['articles.list_articles'].url()  # /api/articles/\n\n    If you prefer, you can also pass module and handler names as strings.\n\n    .. code-block:: python\n\n        with add_route_context(app, module='myapp.articles.views',\n                               url_prefix='/api/', name_prefix='articles') as route:\n            route('GET', '/articles/', 'list_articles')\n            route('POST', '/articles/', 'create_article')\n\n    :param app: Application to add routes to.\n    :param module: Import path to module (str) or module object which contains the handlers.\n    :param url_prefix: Prefix to prepend to all route paths.\n    :param name_prefix: Prefix to prepend to all route names.", "docstring_tokens": ["Context", "manager", "which", "yields", "a", "function", "for", "adding", "multiple", "routes", "from", "a", "given", "module", "."], "nwo": "sloria/aiohttp_utils", "score": 0.1948383829821314, "idx": 253543}
{"url": "https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/utils.py#L619-L651", "sha": "261e2c0760fd6a6b0ee59064180bd8e3674311fe", "docstring_summary": "Calculate statistics for given data.", "language": "python", "parameters": "(data_list, stats_to_calculate=['mean', 'std'], percentiles_to_calculate=[])", "return_statement": "return calculated_stats, calculated_percentiles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "'mean'", ",", "'std'", "]", ",", "arg_2", "=", "[", "]", ")", ":", "arg_3", "=", "{", "'mean'", ":", "numpy", ".", "mean", ",", "'avg'", ":", "numpy", ".", "mean", ",", "'std'", ":", "numpy", ".", "std", ",", "'standard_deviation'", ":", "numpy", ".", "std", ",", "'median'", ":", "numpy", ".", "median", ",", "'min'", ":", "numpy", ".", "amin", ",", "'max'", ":", "numpy", ".", "amax", "}", "arg_4", "=", "{", "}", "arg_5", "=", "{", "}", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "arg_4", ",", "arg_5", "for", "arg_6", "in", "arg_1", ":", "if", "arg_6", "in", "arg_3", ".", "keys", "(", ")", ":", "arg_4", "[", "arg_6", "]", "=", "arg_3", "[", "arg_6", "]", "(", "arg_0", ")", "else", ":", "logger", ".", "error", "(", "\"Unsupported stat : \"", "+", "str", "(", "arg_6", ")", ")", "for", "arg_7", "in", "arg_2", ":", "if", "isinstance", "(", "arg_7", ",", "float", ")", "or", "isinstance", "(", "arg_7", ",", "int", ")", ":", "arg_5", "[", "arg_7", "]", "=", "numpy", ".", "percentile", "(", "arg_0", ",", "arg_7", ")", "else", ":", "logger", ".", "error", "(", "\"Unsupported percentile requested (should be int or float): \"", "+", "str", "(", "arg_7", ")", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1=['mean', 'std'], arg_2=[]):\n  \"\"\"\n  Calculate statistics for given data.\n\n  :param list data_list: List of floats\n  :param list stats_to_calculate: List of strings with statistics to calculate. Supported stats are defined in constant stats_to_numpy_method_map\n  :param list percentiles_to_calculate: List of floats that defined which percentiles to calculate.\n  :return: tuple of dictionaries containing calculated statistics and percentiles\n  \"\"\"\n  arg_3 = {\n      'mean': numpy.mean,\n      'avg': numpy.mean,\n      'std': numpy.std,\n      'standard_deviation': numpy.std,\n      'median': numpy.median,\n      'min': numpy.amin,\n      'max': numpy.amax\n  }\n  arg_4 = {}\n  arg_5 = {}\n  if len(arg_0) == 0:\n    return arg_4, arg_5\n  for arg_6 in arg_1:\n    if arg_6 in arg_3.keys():\n      arg_4[arg_6] = arg_3[arg_6](arg_0)\n    else:\n      logger.error(\"Unsupported stat : \" + str(arg_6))\n  for arg_7 in arg_2:\n    if isinstance(arg_7, float) or isinstance(arg_7, int):\n      arg_5[arg_7] = numpy.percentile(arg_0, arg_7)\n    else:\n      logger.error(\"Unsupported percentile requested (should be int or float): \" + str(arg_7))\n  return arg_4, arg_5", "path": "src/naarad/utils.py", "identifier": "calculate_stats", "docstring": "Calculate statistics for given data.\n\n  :param list data_list: List of floats\n  :param list stats_to_calculate: List of strings with statistics to calculate. Supported stats are defined in constant stats_to_numpy_method_map\n  :param list percentiles_to_calculate: List of floats that defined which percentiles to calculate.\n  :return: tuple of dictionaries containing calculated statistics and percentiles", "docstring_tokens": ["Calculate", "statistics", "for", "given", "data", "."], "nwo": "linkedin/naarad", "score": 0.34903059417921767, "idx": 253544}
{"url": "https://github.com/blink1073/oct2py/blob/bfc69d2168ae3d98258f95bbc55a858c21836b58/oct2py/dynamic.py#L187-L200", "sha": "bfc69d2168ae3d98258f95bbc55a858c21836b58", "docstring_summary": "Convert to a value to send to Octave.", "language": "python", "parameters": "(cls, instance)", "return_statement": "return MatlabObject(struct, instance._name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "OctaveUserClass", ")", "or", "not", "arg_1", ".", "_attrs", ":", "return", "dict", "(", ")", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ".", "_attrs", ":", "arg_2", ".", "append", "(", "(", "str", "(", "arg_4", ")", ",", "object", ")", ")", "arg_3", ".", "append", "(", "getattr", "(", "arg_1", ",", "arg_4", ")", ")", "arg_5", "=", "np", ".", "array", "(", "[", "tuple", "(", "arg_3", ")", "]", ",", "arg_2", ")", "return", "MatlabObject", "(", "arg_5", ",", "arg_1", ".", "_name", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert to a value to send to Octave.\"\"\"\n        if not isinstance(arg_1, OctaveUserClass) or not arg_1._attrs:\n            return dict()\n        # Bootstrap a MatlabObject from scipy.io\n        # From https://github.com/scipy/scipy/blob/93a0ea9e5d4aba1f661b6bb0e18f9c2d1fce436a/scipy/io/matlab/mio5.py#L435-L443\n        # and https://github.com/scipy/scipy/blob/93a0ea9e5d4aba1f661b6bb0e18f9c2d1fce436a/scipy/io/matlab/mio5_params.py#L224\n        arg_2 = []\n        arg_3 = []\n        for arg_4 in arg_1._attrs:\n            arg_2.append((str(arg_4), object))\n            arg_3.append(getattr(arg_1, arg_4))\n        arg_5 = np.array([tuple(arg_3)], arg_2)\n        return MatlabObject(arg_5, arg_1._name)", "path": "oct2py/dynamic.py", "identifier": "OctaveUserClass.to_value", "docstring": "Convert to a value to send to Octave.", "docstring_tokens": ["Convert", "to", "a", "value", "to", "send", "to", "Octave", "."], "nwo": "blink1073/oct2py", "score": 0.3484138981803976, "idx": 253545}
{"url": "https://github.com/calebsmith/django-template-debug/blob/f3d52638da571164d63e5c8331d409b0743c628f/template_debug/templatetags/debug_tags.py#L18-L23", "sha": "f3d52638da571164d63e5c8331d409b0743c628f", "docstring_summary": "Decorated function is a no-op if TEMPLATE_DEBUG is False", "language": "python", "parameters": "(f)", "return_statement": "return _", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "getattr", "(", "settings", ",", "'TEMPLATE_DEBUG'", ",", "False", ")", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "arg_3", "else", "''", "return", "_"], "function": "def Func(arg_0):\n    \"\"\"Decorated function is a no-op if TEMPLATE_DEBUG is False\"\"\"\n    def _(*arg_1, **arg_2):\n        arg_3 = getattr(settings, 'TEMPLATE_DEBUG', False)\n        return arg_0(*arg_1, **arg_2) if arg_3 else ''\n    return _", "path": "template_debug/templatetags/debug_tags.py", "identifier": "require_template_debug", "docstring": "Decorated function is a no-op if TEMPLATE_DEBUG is False", "docstring_tokens": ["Decorated", "function", "is", "a", "no", "-", "op", "if", "TEMPLATE_DEBUG", "is", "False"], "nwo": "calebsmith/django-template-debug", "score": 0.31606306836212245, "idx": 253546}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/api_call.py#L186-L190", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "HTTP Get Request", "language": "python", "parameters": "(self)", "return_statement": "return requests.get(self._url, data=self._data, headers=self._headers, auth=(self._email, self._api_token))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "requests", ".", "get", "(", "arg_0", ".", "_url", ",", "data", "=", "arg_0", ".", "_data", ",", "headers", "=", "arg_0", ".", "_headers", ",", "auth", "=", "(", "arg_0", ".", "_email", ",", "arg_0", ".", "_api_token", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        HTTP Get Request\n        \"\"\"\n        return requests.get(arg_0._url, data=arg_0._data, headers=arg_0._headers, auth=(arg_0._email, arg_0._api_token))", "path": "boundary/api_call.py", "identifier": "ApiCall._do_get", "docstring": "HTTP Get Request", "docstring_tokens": ["HTTP", "Get", "Request"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 253547}
{"url": "https://github.com/memsql/memsql-python/blob/aac223a1b937d5b348b42af3c601a6c685ca633a/memsql/common/sql_step_queue/queue.py#L50-L53", "sha": "aac223a1b937d5b348b42af3c601a6c685ca633a", "docstring_summary": "Return an approximate number of queued tasks in the queue.", "language": "python", "parameters": "(self, extra_predicate=None)", "return_statement": "return count[0].count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "_query_queued", "(", "'COUNT(*) AS count'", ",", "arg_1", "=", "arg_1", ")", "return", "arg_2", "[", "0", "]", ".", "count"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\" Return an approximate number of queued tasks in the queue. \"\"\"\n        arg_2 = arg_0._query_queued('COUNT(*) AS count', arg_1=arg_1)\n        return arg_2[0].count", "path": "memsql/common/sql_step_queue/queue.py", "identifier": "SQLStepQueue.qsize", "docstring": "Return an approximate number of queued tasks in the queue.", "docstring_tokens": ["Return", "an", "approximate", "number", "of", "queued", "tasks", "in", "the", "queue", "."], "nwo": "memsql/memsql-python", "score": 0.6220444802454773, "idx": 253548}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/bnlearn.py#L140-L166", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Run the algorithm on an undirected graph.", "language": "python", "parameters": "(self, data, graph)", "return_statement": "return nx.relabel_nodes(nx.DiGraph(results),\n                                {idx: i for idx, i in enumerate(data.columns)})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "arguments", "[", "'{VERBOSE}'", "]", "=", "str", "(", "arg_0", ".", "verbose", ")", ".", "upper", "(", ")", "arg_0", ".", "arguments", "[", "'{SCORE}'", "]", "=", "arg_0", ".", "score", "arg_0", ".", "arguments", "[", "'{BETA}'", "]", "=", "str", "(", "arg_0", ".", "beta", ")", "arg_0", ".", "arguments", "[", "'{OPTIM}'", "]", "=", "str", "(", "arg_0", ".", "optim", ")", ".", "upper", "(", ")", "arg_0", ".", "arguments", "[", "'{ALPHA}'", "]", "=", "str", "(", "arg_0", ".", "alpha", ")", "arg_4", "=", "DataFrame", "(", "list", "(", "nx", ".", "edges", "(", "arg_2", ")", ")", ",", "columns", "=", "[", "\"from\"", ",", "\"to\"", "]", ")", "arg_5", "=", "DataFrame", "(", "list", "(", "nx", ".", "edges", "(", "nx", ".", "DiGraph", "(", "DataFrame", "(", "-", "nx", ".", "adj_matrix", "(", "arg_2", ",", "weight", "=", "None", ")", ".", "to_dense", "(", ")", "+", "1", ",", "columns", "=", "list", "(", "arg_2", ".", "nodes", "(", ")", ")", ",", "index", "=", "list", "(", "arg_2", ".", "nodes", "(", ")", ")", ")", ")", ")", ")", ",", "columns", "=", "[", "\"from\"", ",", "\"to\"", "]", ")", "arg_6", "=", "arg_0", ".", "_run_bnlearn", "(", "arg_1", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "verbose", "=", "arg_0", ".", "verbose", ")", "return", "nx", ".", "relabel_nodes", "(", "nx", ".", "DiGraph", "(", "arg_6", ")", ",", "{", "arg_7", ":", "arg_8", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_1", ".", "columns", ")", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Run the algorithm on an undirected graph.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n            graph (networkx.Graph): Skeleton of the graph to orient\n\n        Returns:\n            networkx.DiGraph: Solution on the given skeleton.\n\n        \"\"\"\n        # Building setup w/ arguments.\n        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()\n        arg_0.arguments['{SCORE}'] = arg_0.score\n        arg_0.arguments['{BETA}'] = str(arg_0.beta)\n        arg_0.arguments['{OPTIM}'] = str(arg_0.optim).upper()\n        arg_0.arguments['{ALPHA}'] = str(arg_0.alpha)\n\n        arg_4 = DataFrame(list(nx.edges(arg_2)), columns=[\"from\", \"to\"])\n        arg_5 = DataFrame(list(nx.edges(nx.DiGraph(DataFrame(-nx.adj_matrix(arg_2, weight=None).to_dense() + 1,\n                                                                 columns=list(arg_2.nodes()),\n                                                                 index=list(arg_2.nodes()))))), columns=[\"from\", \"to\"])\n        arg_6 = arg_0._run_bnlearn(arg_1, arg_4=arg_4,\n                                   arg_5=arg_5, verbose=arg_0.verbose)\n\n        return nx.relabel_nodes(nx.DiGraph(arg_6),\n                                {arg_7: arg_8 for arg_7, arg_8 in enumerate(arg_1.columns)})", "path": "cdt/causality/graph/bnlearn.py", "identifier": "BNlearnAlgorithm.orient_undirected_graph", "docstring": "Run the algorithm on an undirected graph.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n            graph (networkx.Graph): Skeleton of the graph to orient\n\n        Returns:\n            networkx.DiGraph: Solution on the given skeleton.", "docstring_tokens": ["Run", "the", "algorithm", "on", "an", "undirected", "graph", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 253549}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/scram.py#L247-L297", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Process a challenge and return the response.", "language": "python", "parameters": "(self, challenge)", "return_statement": "return self._make_response(nonce, salt, iteration_count)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "if", "not", "Func", ":", "logger", ".", "debug", "(", "\"Empty challenge\"", ")", "return", "Failure", "(", "\"bad-challenge\"", ")", "if", "arg_0", ".", "_server_first_message", ":", "return", "arg_0", ".", "_final_challenge", "(", "Func", ")", "arg_2", "=", "SERVER_FIRST_MESSAGE_RE", ".", "match", "(", "Func", ")", "if", "not", "arg_2", ":", "logger", ".", "debug", "(", "\"Bad challenge syntax: {0!r}\"", ".", "format", "(", "Func", ")", ")", "return", "Failure", "(", "\"bad-challenge\"", ")", "arg_0", ".", "_server_first_message", "=", "Func", "arg_4", "=", "arg_2", ".", "group", "(", "\"mext\"", ")", "if", "arg_4", ":", "logger", ".", "debug", "(", "\"Unsupported extension received: {0!r}\"", ".", "format", "(", "arg_4", ")", ")", "return", "Failure", "(", "\"bad-challenge\"", ")", "arg_5", "=", "arg_2", ".", "group", "(", "\"nonce\"", ")", "if", "not", "arg_5", ".", "startswith", "(", "arg_0", ".", "_c_nonce", ")", ":", "logger", ".", "debug", "(", "\"Nonce does not start with our nonce\"", ")", "return", "Failure", "(", "\"bad-challenge\"", ")", "arg_6", "=", "arg_2", ".", "group", "(", "\"salt\"", ")", "try", ":", "arg_6", "=", "a2b_base64", "(", "arg_6", ")", "except", "ValueError", ":", "logger", ".", "debug", "(", "\"Bad base64 encoding for salt: {0!r}\"", ".", "format", "(", "arg_6", ")", ")", "return", "Failure", "(", "\"bad-challenge\"", ")", "arg_7", "=", "arg_2", ".", "group", "(", "\"iteration_count\"", ")", "try", ":", "arg_7", "=", "int", "(", "arg_7", ")", "except", "ValueError", ":", "logger", ".", "debug", "(", "\"Bad iteration_count: {0!r}\"", ".", "format", "(", "arg_7", ")", ")", "return", "Failure", "(", "\"bad-challenge\"", ")", "return", "arg_0", ".", "_make_response", "(", "arg_5", ",", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"Process a challenge and return the response.\n\n        :Parameters:\n            - `challenge`: the challenge from server.\n        :Types:\n            - `challenge`: `bytes`\n\n        :return: the response or a failure indicator.\n        :returntype: `sasl.Response` or `sasl.Failure`\n        \"\"\"\n        # pylint: disable=R0911\n        if not Func:\n            logger.debug(\"Empty challenge\")\n            return Failure(\"bad-challenge\")\n\n        if arg_0._server_first_message:\n            return arg_0._final_challenge(Func)\n\n        arg_2 = SERVER_FIRST_MESSAGE_RE.match(Func)\n        if not arg_2:\n            logger.debug(\"Bad challenge syntax: {0!r}\".format(Func))\n            return Failure(\"bad-challenge\")\n\n        arg_0._server_first_message = Func\n\n        arg_4 = arg_2.group(\"mext\")\n        if arg_4:\n            logger.debug(\"Unsupported extension received: {0!r}\".format(arg_4))\n            return Failure(\"bad-challenge\")\n\n        arg_5 = arg_2.group(\"nonce\")\n        if not arg_5.startswith(arg_0._c_nonce):\n            logger.debug(\"Nonce does not start with our nonce\")\n            return Failure(\"bad-challenge\")\n\n        arg_6 = arg_2.group(\"salt\")\n        try:\n            arg_6 = a2b_base64(arg_6)\n        except ValueError:\n            logger.debug(\"Bad base64 encoding for salt: {0!r}\".format(arg_6))\n            return Failure(\"bad-challenge\")\n\n        arg_7 = arg_2.group(\"iteration_count\")\n        try:\n            arg_7 = int(arg_7)\n        except ValueError:\n            logger.debug(\"Bad iteration_count: {0!r}\".format(arg_7))\n            return Failure(\"bad-challenge\")\n\n        return arg_0._make_response(arg_5, arg_6, arg_7)", "path": "pyxmpp2/sasl/scram.py", "identifier": "SCRAMClientAuthenticator.challenge", "docstring": "Process a challenge and return the response.\n\n        :Parameters:\n            - `challenge`: the challenge from server.\n        :Types:\n            - `challenge`: `bytes`\n\n        :return: the response or a failure indicator.\n        :returntype: `sasl.Response` or `sasl.Failure`", "docstring_tokens": ["Process", "a", "challenge", "and", "return", "the", "response", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253550}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3434-L3441", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Jumps short if parity.", "language": "python", "parameters": "(cpu, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "arg_0", ".", "PF", ",", "arg_1", ".", "read", "(", ")", ",", "arg_0", ".", "PC", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Jumps short if parity.\n\n        :param cpu: current CPU.\n        :param target: destination operand.\n        \"\"\"\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, arg_0.PF, arg_1.read(), arg_0.PC)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.JP", "docstring": "Jumps short if parity.\n\n        :param cpu: current CPU.\n        :param target: destination operand.", "docstring_tokens": ["Jumps", "short", "if", "parity", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253551}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/import_loaders/table_loader.py#L239-L259", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Make table definitions", "language": "python", "parameters": "(self, conn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "cursor", "(", ")", "if", "arg_0", ".", "tabledef", "is", "None", ":", "return", "if", "not", "arg_0", ".", "tabledef", ".", "startswith", "(", "'CREATE'", ")", ":", "arg_2", ".", "execute", "(", "'CREATE TABLE IF NOT EXISTS %s %s'", "%", "(", "arg_0", ".", "table", ",", "arg_0", ".", "tabledef", ")", ")", "else", ":", "arg_2", ".", "execute", "(", "arg_0", ".", "tabledef", ")", "arg_1", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Make table definitions\"\"\"\n        # Make cursor\n        arg_2 = arg_1.cursor()\n        # Drop table if it already exists, to be recreated.  This\n        # could in the future abort if table already exists, and not\n        # recreate it from scratch.\n        #cur.execute('''DROP TABLE IF EXISTS %s'''%self.table)\n        #conn.commit()\n        if arg_0.tabledef is None:\n            return\n        if not arg_0.tabledef.startswith('CREATE'):\n            # \"normal\" table creation.\n            arg_2.execute('CREATE TABLE IF NOT EXISTS %s %s'\n                        % (arg_0.table, arg_0.tabledef)\n                        )\n        else:\n            # When tabledef contains the full CREATE statement (for\n            # virtual tables).\n            arg_2.execute(arg_0.tabledef)\n        arg_1.commit()", "path": "gtfspy/import_loaders/table_loader.py", "identifier": "TableLoader.create_table", "docstring": "Make table definitions", "docstring_tokens": ["Make", "table", "definitions"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 253552}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/state_visualization.py#L344-L390", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Plot the paulivec representation of a quantum state.", "language": "python", "parameters": "(rho, title=\"\", figsize=None, color=None)", "return_statement": "return fig", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "not", "HAS_MATPLOTLIB", ":", "raise", "ImportError", "(", "'Must have Matplotlib installed.'", ")", "arg_0", "=", "_validate_input_state", "(", "arg_0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "(", "7", ",", "5", ")", "arg_4", "=", "int", "(", "np", ".", "log2", "(", "len", "(", "arg_0", ")", ")", ")", "arg_5", "=", "list", "(", "map", "(", "lambda", "x", ":", "x", ".", "to_label", "(", ")", ",", "pauli_group", "(", "arg_4", ")", ")", ")", "arg_6", "=", "list", "(", "map", "(", "lambda", "x", ":", "np", ".", "real", "(", "np", ".", "trace", "(", "np", ".", "dot", "(", "x", ".", "to_matrix", "(", ")", ",", "arg_0", ")", ")", ")", ",", "pauli_group", "(", "arg_4", ")", ")", ")", "arg_7", "=", "len", "(", "arg_6", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "\"#648fff\"", "arg_8", "=", "np", ".", "arange", "(", "arg_7", ")", "arg_9", "=", "0.5", "arg_10", ",", "arg_11", "=", "plt", ".", "subplots", "(", "arg_2", "=", "arg_2", ")", "arg_11", ".", "grid", "(", "zorder", "=", "0", ",", "linewidth", "=", "1", ",", "linestyle", "=", "'--'", ")", "arg_11", ".", "bar", "(", "arg_8", ",", "arg_6", ",", "arg_9", ",", "arg_3", "=", "arg_3", ",", "zorder", "=", "2", ")", "arg_11", ".", "axhline", "(", "linewidth", "=", "1", ",", "arg_3", "=", "'k'", ")", "arg_11", ".", "set_ylabel", "(", "'Expectation value'", ",", "fontsize", "=", "14", ")", "arg_11", ".", "set_xticks", "(", "arg_8", ")", "arg_11", ".", "set_yticks", "(", "[", "-", "1", ",", "-", "0.5", ",", "0", ",", "0.5", ",", "1", "]", ")", "arg_11", ".", "set_xticklabels", "(", "arg_5", ",", "fontsize", "=", "14", ",", "rotation", "=", "70", ")", "arg_11", ".", "set_xlabel", "(", "'Pauli'", ",", "fontsize", "=", "14", ")", "arg_11", ".", "set_ylim", "(", "[", "-", "1", ",", "1", "]", ")", "arg_11", ".", "set_facecolor", "(", "'#eeeeee'", ")", "for", "arg_12", "in", "arg_11", ".", "xaxis", ".", "get_major_ticks", "(", ")", "+", "arg_11", ".", "yaxis", ".", "get_major_ticks", "(", ")", ":", "arg_12", ".", "label", ".", "set_fontsize", "(", "14", ")", "arg_11", ".", "set_title", "(", "arg_1", ",", "fontsize", "=", "16", ")", "plt", ".", "close", "(", "arg_10", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1=\"\", arg_2=None, arg_3=None):\n    \"\"\"Plot the paulivec representation of a quantum state.\n\n    Plot a bargraph of the mixed state rho over the pauli matrices\n\n    Args:\n        rho (ndarray): Numpy array for state vector or density matrix\n        title (str): a string that represents the plot title\n        figsize (tuple): Figure size in inches.\n        color (list or str): Color of the expectation value bars.\n    Returns:\n         matplotlib.Figure: The matplotlib.Figure of the visualization\n    Raises:\n        ImportError: Requires matplotlib.\n    \"\"\"\n    if not HAS_MATPLOTLIB:\n        raise ImportError('Must have Matplotlib installed.')\n    arg_0 = _validate_input_state(arg_0)\n    if arg_2 is None:\n        arg_2 = (7, 5)\n    arg_4 = int(np.log2(len(arg_0)))\n    arg_5 = list(map(lambda x: x.to_label(), pauli_group(arg_4)))\n    arg_6 = list(map(lambda x: np.real(np.trace(np.dot(x.to_matrix(), arg_0))),\n                      pauli_group(arg_4)))\n    arg_7 = len(arg_6)\n    if arg_3 is None:\n        arg_3 = \"#648fff\"\n\n    arg_8 = np.arange(arg_7)  # the x locations for the groups\n    arg_9 = 0.5  # the width of the bars\n    arg_10, arg_11 = plt.subplots(arg_2=arg_2)\n    arg_11.grid(zorder=0, linewidth=1, linestyle='--')\n    arg_11.bar(arg_8, arg_6, arg_9, arg_3=arg_3, zorder=2)\n    arg_11.axhline(linewidth=1, arg_3='k')\n    # add some text for labels, title, and axes ticks\n    arg_11.set_ylabel('Expectation value', fontsize=14)\n    arg_11.set_xticks(arg_8)\n    arg_11.set_yticks([-1, -0.5, 0, 0.5, 1])\n    arg_11.set_xticklabels(arg_5, fontsize=14, rotation=70)\n    arg_11.set_xlabel('Pauli', fontsize=14)\n    arg_11.set_ylim([-1, 1])\n    arg_11.set_facecolor('#eeeeee')\n    for arg_12 in arg_11.xaxis.get_major_ticks()+arg_11.yaxis.get_major_ticks():\n        arg_12.label.set_fontsize(14)\n    arg_11.set_title(arg_1, fontsize=16)\n    plt.close(arg_10)\n    return arg_10", "path": "qiskit/visualization/state_visualization.py", "identifier": "plot_state_paulivec", "docstring": "Plot the paulivec representation of a quantum state.\n\n    Plot a bargraph of the mixed state rho over the pauli matrices\n\n    Args:\n        rho (ndarray): Numpy array for state vector or density matrix\n        title (str): a string that represents the plot title\n        figsize (tuple): Figure size in inches.\n        color (list or str): Color of the expectation value bars.\n    Returns:\n         matplotlib.Figure: The matplotlib.Figure of the visualization\n    Raises:\n        ImportError: Requires matplotlib.", "docstring_tokens": ["Plot", "the", "paulivec", "representation", "of", "a", "quantum", "state", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253553}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L609-L628", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val is string or iterable and starts with prefix.", "language": "python", "parameters": "(self, prefix)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "TypeError", "(", "'given prefix arg must not be none'", ")", "if", "isinstance", "(", "arg_0", ".", "val", ",", "str_types", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "str_types", ")", ":", "raise", "TypeError", "(", "'given prefix arg must be a string'", ")", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'given prefix arg must not be empty'", ")", "if", "not", "arg_0", ".", "val", ".", "startswith", "(", "arg_1", ")", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to start with <%s>, but did not.'", "%", "(", "arg_0", ".", "val", ",", "arg_1", ")", ")", "elif", "isinstance", "(", "arg_0", ".", "val", ",", "Iterable", ")", ":", "if", "len", "(", "arg_0", ".", "val", ")", "==", "0", ":", "raise", "ValueError", "(", "'val must not be empty'", ")", "arg_2", "=", "next", "(", "iter", "(", "arg_0", ".", "val", ")", ")", "if", "arg_2", "!=", "arg_1", ":", "arg_0", ".", "_err", "(", "'Expected %s to start with <%s>, but did not.'", "%", "(", "arg_0", ".", "val", ",", "arg_1", ")", ")", "else", ":", "raise", "TypeError", "(", "'val is not a string or iterable'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Asserts that val is string or iterable and starts with prefix.\"\"\"\n        if arg_1 is None:\n            raise TypeError('given prefix arg must not be none')\n        if isinstance(arg_0.val, str_types):\n            if not isinstance(arg_1, str_types):\n                raise TypeError('given prefix arg must be a string')\n            if len(arg_1) == 0:\n                raise ValueError('given prefix arg must not be empty')\n            if not arg_0.val.startswith(arg_1):\n                arg_0._err('Expected <%s> to start with <%s>, but did not.' % (arg_0.val, arg_1))\n        elif isinstance(arg_0.val, Iterable):\n            if len(arg_0.val) == 0:\n                raise ValueError('val must not be empty')\n            arg_2 = next(iter(arg_0.val))\n            if arg_2 != arg_1:\n                arg_0._err('Expected %s to start with <%s>, but did not.' % (arg_0.val, arg_1))\n        else:\n            raise TypeError('val is not a string or iterable')\n        return arg_0", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.starts_with", "docstring": "Asserts that val is string or iterable and starts with prefix.", "docstring_tokens": ["Asserts", "that", "val", "is", "string", "or", "iterable", "and", "starts", "with", "prefix", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 253554}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L22-L42", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Asynchronously request a URL and get the encoded text content of the\n    body.", "language": "python", "parameters": "(url, session)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "logging", ".", "getLogger", "(", "__name__", ")", "async", "with", "arg_1", ".", "get", "(", "arg_0", ")", "as", "response", ":", "arg_2", ".", "info", "(", "'Downloading %r'", ",", "arg_0", ")", "return", "await", "response", ".", "text", "(", ")"], "function": "async def Func(arg_0, arg_1):\n    \"\"\"Asynchronously request a URL and get the encoded text content of the\n    body.\n\n    Parameters\n    ----------\n    url : `str`\n        URL to download.\n    session : `aiohttp.ClientSession`\n        An open aiohttp session.\n\n    Returns\n    -------\n    content : `str`\n        Content downloaded from the URL.\n    \"\"\"\n    arg_2 = logging.getLogger(__name__)\n    async with arg_1.get(arg_0) as response:\n        # aiohttp decodes the content to a Python string\n        arg_2.info('Downloading %r', arg_0)\n        return await response.text()", "path": "lsstprojectmeta/tex/lsstbib.py", "identifier": "_download_text", "docstring": "Asynchronously request a URL and get the encoded text content of the\n    body.\n\n    Parameters\n    ----------\n    url : `str`\n        URL to download.\n    session : `aiohttp.ClientSession`\n        An open aiohttp session.\n\n    Returns\n    -------\n    content : `str`\n        Content downloaded from the URL.", "docstring_tokens": ["Asynchronously", "request", "a", "URL", "and", "get", "the", "encoded", "text", "content", "of", "the", "body", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 253555}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/math.py#L195-L238", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Round each value of a column", "language": "python", "parameters": "(df, *, column: str, decimals: int, new_column: str = None)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_2", "=", "None", ")", ":", "arg_5", "=", "arg_5", "or", "arg_1", "arg_0", "[", "arg_5", "]", "=", "arg_0", "[", "arg_1", "]", ".", "round", "(", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, *, arg_1: arg_2, arg_3: arg_4, arg_5: arg_2 = None):\n    \"\"\"\n    Round each value of a column\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `column` (*str*): name of the column to round\n    - `decimals` (*int*): number of decimal to keeep\n\n    *optional :*\n    - `new_column` (*str*): name of the new column to create.\n      By default, no new column will be created and `column` will be replaced\n\n    ---\n\n    ### Example\n\n    ** Input**\n\n    ENTITY|VALUE_1|VALUE_2\n    :-----:|:-----:|:-----:\n    A|-1.512|-1.504\n    A|0.432|0.14\n\n    ```cson\n    Func:\n      column: 'VALUE_1'\n      decimals:1\n      new_column: 'Pika'\n    ```\n\n    **Output**\n\n    ENTITY|VALUE_1|VALUE_2|Pika\n    :-----:|:-----:|:-----:|:-----:\n    A|-1.512|-1.504|-1.5\n    A|0.432|0.14|0.4\n    \"\"\"\n    arg_5 = arg_5 or arg_1\n    arg_0[arg_5] = arg_0[arg_1].round(arg_3)\n    return arg_0", "path": "toucan_data_sdk/utils/postprocess/math.py", "identifier": "round_values", "docstring": "Round each value of a column\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `column` (*str*): name of the column to round\n    - `decimals` (*int*): number of decimal to keeep\n\n    *optional :*\n    - `new_column` (*str*): name of the new column to create.\n      By default, no new column will be created and `column` will be replaced\n\n    ---\n\n    ### Example\n\n    ** Input**\n\n    ENTITY|VALUE_1|VALUE_2\n    :-----:|:-----:|:-----:\n    A|-1.512|-1.504\n    A|0.432|0.14\n\n    ```cson\n    round_values:\n      column: 'VALUE_1'\n      decimals:1\n      new_column: 'Pika'\n    ```\n\n    **Output**\n\n    ENTITY|VALUE_1|VALUE_2|Pika\n    :-----:|:-----:|:-----:|:-----:\n    A|-1.512|-1.504|-1.5\n    A|0.432|0.14|0.4", "docstring_tokens": ["Round", "each", "value", "of", "a", "column"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 253556}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/cairo_sink.py#L64-L78", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "If filename was used output a filename, along with multifile\n        numbered filenames will be used.", "language": "python", "parameters": "(self, frame)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "buff", ":", "return", "arg_0", ".", "buff", "elif", "arg_0", ".", "multifile", ":", "return", "arg_0", ".", "file_root", "+", "\"_%03d\"", "%", "arg_1", "+", "arg_0", ".", "file_ext", "else", ":", "return", "arg_0", ".", "filename"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        If filename was used output a filename, along with multifile\n        numbered filenames will be used.\n\n        If buff was specified it is returned.\n\n        :return: Output buff or filename.\n        \"\"\"\n        if arg_0.buff:\n            return arg_0.buff\n        elif arg_0.multifile:\n            return arg_0.file_root + \"_%03d\" % arg_1 + arg_0.file_ext\n        else:\n            return arg_0.filename", "path": "shoebot/core/cairo_sink.py", "identifier": "CairoImageSink._output_file", "docstring": "If filename was used output a filename, along with multifile\n        numbered filenames will be used.\n\n        If buff was specified it is returned.\n\n        :return: Output buff or filename.", "docstring_tokens": ["If", "filename", "was", "used", "output", "a", "filename", "along", "with", "multifile", "numbered", "filenames", "will", "be", "used", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253557}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicefabric/azure/servicefabric/operations/mesh_secret_value_operations.py#L38-L110", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Adds the specified value as a new version of the specified secret\n        resource.", "language": "python", "parameters": "(\n            self, secret_resource_name, secret_value_resource_name, name, value=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "**", "arg_7", ")", ":", "arg_8", "=", "models", ".", "SecretValueResourceDescription", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_9", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_10", "=", "{", "'secretResourceName'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"secret_resource_name\"", ",", "arg_1", ",", "'str'", ",", "skip_quote", "=", "True", ")", ",", "'secretValueResourceName'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"secret_value_resource_name\"", ",", "arg_2", ",", "'str'", ",", "skip_quote", "=", "True", ")", "}", "arg_9", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_9", ",", "**", "arg_10", ")", "arg_11", "=", "{", "}", "arg_11", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "arg_12", "=", "{", "}", "arg_12", "[", "'Accept'", "]", "=", "'application/json'", "arg_12", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_5", ":", "arg_12", ".", "update", "(", "arg_5", ")", "arg_13", "=", "arg_0", ".", "_serialize", ".", "body", "(", "arg_8", ",", "'SecretValueResourceDescription'", ")", "arg_14", "=", "arg_0", ".", "_client", ".", "put", "(", "arg_9", ",", "arg_11", ",", "arg_12", ",", "arg_13", ")", "arg_15", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_14", ",", "stream", "=", "False", ",", "**", "arg_7", ")", "if", "arg_15", ".", "status_code", "not", "in", "[", "200", ",", "201", ",", "202", "]", ":", "raise", "models", ".", "FabricErrorException", "(", "arg_0", ".", "_deserialize", ",", "arg_15", ")", "arg_16", "=", "None", "if", "arg_15", ".", "status_code", "==", "200", ":", "arg_16", "=", "arg_0", ".", "_deserialize", "(", "'SecretValueResourceDescription'", ",", "arg_15", ")", "if", "arg_15", ".", "status_code", "==", "201", ":", "arg_16", "=", "arg_0", ".", "_deserialize", "(", "'SecretValueResourceDescription'", ",", "arg_15", ")", "if", "arg_6", ":", "arg_17", "=", "ClientRawResponse", "(", "arg_16", ",", "arg_15", ")", "return", "arg_17", "return", "arg_16"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=False, **arg_7):\n        \"\"\"Adds the specified value as a new version of the specified secret\n        resource.\n\n        Creates a new value of the specified secret resource. The name of the\n        value is typically the version identifier. Once created the value\n        cannot be changed.\n\n        :param secret_resource_name: The name of the secret resource.\n        :type secret_resource_name: str\n        :param secret_value_resource_name: The name of the secret resource\n         value which is typically the version identifier for the value.\n        :type secret_value_resource_name: str\n        :param name: Version identifier of the secret value.\n        :type name: str\n        :param value: The actual value of the secret.\n        :type value: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: SecretValueResourceDescription or ClientRawResponse if\n         raw=true\n        :rtype: ~azure.servicefabric.models.SecretValueResourceDescription or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`\n        \"\"\"\n        arg_8 = models.SecretValueResourceDescription(arg_3=arg_3, arg_4=arg_4)\n\n        # Construct URL\n        arg_9 = arg_0.Func.metadata['url']\n        arg_10 = {\n            'secretResourceName': arg_0._serialize.url(\"secret_resource_name\", arg_1, 'str', skip_quote=True),\n            'secretValueResourceName': arg_0._serialize.url(\"secret_value_resource_name\", arg_2, 'str', skip_quote=True)\n        }\n        arg_9 = arg_0._client.format_url(arg_9, **arg_10)\n\n        # Construct parameters\n        arg_11 = {}\n        arg_11['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n\n        # Construct headers\n        arg_12 = {}\n        arg_12['Accept'] = 'application/json'\n        arg_12['Content-Type'] = 'application/json; charset=utf-8'\n        if arg_5:\n            arg_12.update(arg_5)\n\n        # Construct body\n        arg_13 = arg_0._serialize.body(arg_8, 'SecretValueResourceDescription')\n\n        # Construct and send request\n        arg_14 = arg_0._client.put(arg_9, arg_11, arg_12, arg_13)\n        arg_15 = arg_0._client.send(arg_14, stream=False, **arg_7)\n\n        if arg_15.status_code not in [200, 201, 202]:\n            raise models.FabricErrorException(arg_0._deserialize, arg_15)\n\n        arg_16 = None\n\n        if arg_15.status_code == 200:\n            arg_16 = arg_0._deserialize('SecretValueResourceDescription', arg_15)\n        if arg_15.status_code == 201:\n            arg_16 = arg_0._deserialize('SecretValueResourceDescription', arg_15)\n\n        if arg_6:\n            arg_17 = ClientRawResponse(arg_16, arg_15)\n            return arg_17\n\n        return arg_16", "path": "azure-servicefabric/azure/servicefabric/operations/mesh_secret_value_operations.py", "identifier": "MeshSecretValueOperations.add_value", "docstring": "Adds the specified value as a new version of the specified secret\n        resource.\n\n        Creates a new value of the specified secret resource. The name of the\n        value is typically the version identifier. Once created the value\n        cannot be changed.\n\n        :param secret_resource_name: The name of the secret resource.\n        :type secret_resource_name: str\n        :param secret_value_resource_name: The name of the secret resource\n         value which is typically the version identifier for the value.\n        :type secret_value_resource_name: str\n        :param name: Version identifier of the secret value.\n        :type name: str\n        :param value: The actual value of the secret.\n        :type value: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: SecretValueResourceDescription or ClientRawResponse if\n         raw=true\n        :rtype: ~azure.servicefabric.models.SecretValueResourceDescription or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`", "docstring_tokens": ["Adds", "the", "specified", "value", "as", "a", "new", "version", "of", "the", "specified", "secret", "resource", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 253558}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/monitor/backend_overview.py#L21-L39", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Gets the unique backends that are available.", "language": "python", "parameters": "()", "return_statement": "return unique_hardware_backends", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "IBMQ", ".", "backends", "(", ")", "arg_1", "=", "[", "]", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "name", "(", ")", "not", "in", "arg_2", "and", "not", "arg_3", ".", "configuration", "(", ")", ".", "simulator", ":", "arg_1", ".", "append", "(", "arg_3", ")", "arg_2", ".", "append", "(", "arg_3", ".", "name", "(", ")", ")", "if", "not", "arg_1", ":", "raise", "QiskitError", "(", "'No backends available.'", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"Gets the unique backends that are available.\n\n    Returns:\n        list: Unique available backends.\n\n    Raises:\n        QiskitError: No backends available.\n    \"\"\"\n    arg_0 = IBMQ.backends()\n    arg_1 = []\n    arg_2 = []\n    for arg_3 in arg_0:\n        if arg_3.name() not in arg_2 and not arg_3.configuration().simulator:\n            arg_1.append(arg_3)\n            arg_2.append(arg_3.name())\n    if not arg_1:\n        raise QiskitError('No backends available.')\n    return arg_1", "path": "qiskit/tools/monitor/backend_overview.py", "identifier": "get_unique_backends", "docstring": "Gets the unique backends that are available.\n\n    Returns:\n        list: Unique available backends.\n\n    Raises:\n        QiskitError: No backends available.", "docstring_tokens": ["Gets", "the", "unique", "backends", "that", "are", "available", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253559}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/_util/solve.py#L37-L51", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Robust solve Ax=y.", "language": "python", "parameters": "(A, y)", "return_statement": "return beta", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "numpy_sugar", ".", "linalg", "import", "Func", "as", "_Func", "try", ":", "arg_2", "=", "_Func", "(", "arg_0", ",", "arg_1", ")", "except", "LinAlgError", ":", "arg_3", "=", "\"Could not converge to solve Ax=y.\"", "arg_3", "+=", "\" Setting x to zero.\"", "warnings", ".", "warn", "(", "arg_3", ",", "RuntimeWarning", ")", "arg_2", "=", "zeros", "(", "arg_0", ".", "shape", "[", "0", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Robust solve Ax=y.\n    \"\"\"\n    from numpy_sugar.linalg import Func as _Func\n\n    try:\n        arg_2 = _Func(arg_0, arg_1)\n    except LinAlgError:\n        arg_3 = \"Could not converge to solve Ax=y.\"\n        arg_3 += \" Setting x to zero.\"\n        warnings.warn(arg_3, RuntimeWarning)\n        arg_2 = zeros(arg_0.shape[0])\n\n    return arg_2", "path": "glimix_core/_util/solve.py", "identifier": "rsolve", "docstring": "Robust solve Ax=y.", "docstring_tokens": ["Robust", "solve", "Ax", "=", "y", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 253560}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/linesearch/internal/hager_zhang_lib.py#L301-L423", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Squeezes a bracketing interval containing the minimum.", "language": "python", "parameters": "(value_and_gradients_function, val_left, val_right, val_trial, f_lim,\n           active=None)", "return_statement": "return _bisect(value_and_gradients_function, bisect_args, f_lim)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "(", "arg_1", ".", "x", "<", "arg_3", ".", "x", ")", "&", "(", "arg_3", ".", "x", "<", "arg_2", ".", "x", ")", "if", "arg_5", "is", "not", "None", ":", "arg_6", "=", "arg_6", "&", "arg_5", "arg_7", "=", "(", "arg_3", ".", "df", "<", "0", ")", "&", "(", "arg_3", ".", "f", "<=", "arg_4", ")", "arg_8", "=", "arg_6", "&", "(", "arg_3", ".", "df", "<", "0", ")", "&", "(", "arg_3", ".", "f", ">", "arg_4", ")", "arg_9", "=", "val_where", "(", "arg_6", "&", "arg_7", ",", "arg_3", ",", "arg_1", ")", "arg_10", "=", "val_where", "(", "arg_6", "&", "~", "arg_7", ",", "arg_3", ",", "arg_2", ")", "arg_11", "=", "_IntermediateResult", "(", "iteration", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "0", ")", ",", "stopped", "=", "~", "arg_8", ",", "failed", "=", "tf", ".", "zeros_like", "(", "arg_6", ")", ",", "num_evals", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "0", ")", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")", "return", "_bisect", "(", "arg_0", ",", "arg_11", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n           arg_5=None):\n  \"\"\"Squeezes a bracketing interval containing the minimum.\n\n  Given an interval which brackets a minimum and a point in that interval,\n  finds a smaller nested interval which also brackets the minimum. If the\n  supplied point does not lie in the bracketing interval, the current interval\n  is returned.\n\n  The following description is given in terms of individual points evaluated on\n  a line function to be minimized. Note, however, the implementation also\n  accepts batches of points allowing to minimize multiple line functions at\n  once. See details on the docstring of `value_and_gradients_function` below.\n\n  The requirement of the interval bracketing a minimum is expressed through the\n  opposite slope conditions. Assume the left end point is 'a', the right\n  end point is 'b', the function to be minimized is 'f' and the derivative is\n  'df'. The Func procedure relies on the following conditions being satisfied:\n\n  '''\n    f(a) <= f(0) + epsilon   (1)\n    df(a) < 0                (2)\n    df(b) > 0                (3)\n  '''\n\n  In the first condition, epsilon is a small positive constant. The condition\n  demands that the function at the left end point be not much bigger than the\n  starting point (i.e. 0). This is an easy to satisfy condition because by\n  assumption, we are in a direction where the function value is decreasing.\n  The second and third conditions together demand that there is at least one\n  zero of the derivative in between a and b.\n\n  In addition to the interval, the Func algorithm requires a third point to\n  be supplied. Usually, this point would lie within the interval [a, b]. If the\n  point is outside this interval, the current interval is returned. If the\n  point lies within the interval, the behaviour of the function and derivative\n  value at this point is used to squeeze the original interval in a manner that\n  preserves the opposite slope conditions.\n\n  For further details of this component, see the procedure U0-U3 on page 123 of\n  the [Hager and Zhang (2006)][2] article.\n\n  Note that this function does not explicitly verify whether the opposite slope\n  conditions are satisfied for the supplied interval. It is assumed that this\n  is so.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a real scalar\n      tensor and returns an object that can be converted to a namedtuple.\n      The namedtuple should have fields 'f' and 'df' that correspond to scalar\n      tensors of real dtype containing the value of the function and its\n      derivative at that point. The other namedtuple fields, if present,\n      should be tensors or sequences (possibly nested) of tensors.\n      In usual optimization application, this function would be generated by\n      projecting the multivariate objective function along some specific\n      direction. The direction is determined by some other procedure but should\n      be a descent direction (i.e. the derivative of the projected univariate\n      function must be negative at 0.).\n      Alternatively, the function may represent the batching of `n` such line\n      functions (e.g. projecting a single multivariate objective function along\n      `n` distinct directions at once) accepting n points as input, i.e. a\n      tensor of shape [n], and the fields 'f' and 'df' in the returned\n      namedtuple should each be a tensor of shape [n], with the corresponding\n      function values and derivatives at the input points.\n    val_left: Return value of value_and_gradients_function at the left\n      end point of the bracketing interval (labelles 'a' above).\n    val_right: Return value of value_and_gradients_function at the right\n      end point of the bracketing interval (labelles 'b' above).\n    val_trial: Return value of value_and_gradients_function at the trial point\n      to be used to shrink the interval (labelled 'c' above).\n    f_lim: real `Tensor` of shape [n]. The function value threshold for\n      the approximate Wolfe conditions to be checked for each batch member.\n    active: optional boolean `Tensor` of shape [n]. Relevant in batching mode\n      only, indicates batch members on which the Func procedure should be\n      applied. On non-active members the current left/right interval is returned\n      unmodified.\n\n  Returns:\n    A namedtuple containing the following fields:\n      iteration: An int32 scalar `Tensor`. The number of iterations performed\n        by the bisect algorithm.\n      stopped: A boolean `Tensor` of shape [n]. True for those batch members\n        where the bisection algorithm terminated.\n      failed: A boolean `Tensor` of shape [n]. True for those batch members\n        where an error was encountered.\n      num_evals: An int32 scalar `Tensor`. The number of times the objective\n        function was evaluated.\n      left: Return value of value_and_gradients_function at the Funcd left\n        end point of the interval found.\n      right: Return value of value_and_gradients_function at the Funcd right\n        end point of the interval found.\n  \"\"\"\n  # We should only Func if the trial point is within the interval.\n  arg_6 = (arg_1.x < arg_3.x) & (arg_3.x < arg_2.x)\n  if arg_5 is not None:\n    arg_6 = arg_6 & arg_5\n\n  # The new point is a valid left end point if it has negative slope\n  # and the value at the point is not too large.\n  arg_7 = (arg_3.df < 0) & (arg_3.f <= arg_4)\n\n  # If the trial point has a negative slope but the value at that point\n  # is too high, bisect can narrow down an interval between the current left\n  # and the trial point.\n  arg_8 = arg_6 & (arg_3.df < 0) & (arg_3.f > arg_4)\n\n  # Note that if `~valid_left` it is because either:\n  # - the slope at the trial point is positive, so it is a valid right\n  #   point, or\n  # - the needs_bisect condition is true.\n  # In both cases we want to keep the current left and replace right\n  # with the trial point.\n  arg_9 = val_where(arg_6 & arg_7, arg_3, arg_1)\n  arg_10 = val_where(arg_6 & ~arg_7, arg_3, arg_2)\n\n  arg_11 = _IntermediateResult(\n      iteration=tf.convert_to_tensor(value=0),\n      stopped=~arg_8,\n      failed=tf.zeros_like(arg_6),  # i.e. all false.\n      num_evals=tf.convert_to_tensor(value=0),\n      arg_9=arg_9,\n      arg_10=arg_10)\n  return _bisect(arg_0, arg_11, arg_4)", "path": "tensorflow_probability/python/optimizer/linesearch/internal/hager_zhang_lib.py", "identifier": "update", "docstring": "Squeezes a bracketing interval containing the minimum.\n\n  Given an interval which brackets a minimum and a point in that interval,\n  finds a smaller nested interval which also brackets the minimum. If the\n  supplied point does not lie in the bracketing interval, the current interval\n  is returned.\n\n  The following description is given in terms of individual points evaluated on\n  a line function to be minimized. Note, however, the implementation also\n  accepts batches of points allowing to minimize multiple line functions at\n  once. See details on the docstring of `value_and_gradients_function` below.\n\n  The requirement of the interval bracketing a minimum is expressed through the\n  opposite slope conditions. Assume the left end point is 'a', the right\n  end point is 'b', the function to be minimized is 'f' and the derivative is\n  'df'. The update procedure relies on the following conditions being satisfied:\n\n  '''\n    f(a) <= f(0) + epsilon   (1)\n    df(a) < 0                (2)\n    df(b) > 0                (3)\n  '''\n\n  In the first condition, epsilon is a small positive constant. The condition\n  demands that the function at the left end point be not much bigger than the\n  starting point (i.e. 0). This is an easy to satisfy condition because by\n  assumption, we are in a direction where the function value is decreasing.\n  The second and third conditions together demand that there is at least one\n  zero of the derivative in between a and b.\n\n  In addition to the interval, the update algorithm requires a third point to\n  be supplied. Usually, this point would lie within the interval [a, b]. If the\n  point is outside this interval, the current interval is returned. If the\n  point lies within the interval, the behaviour of the function and derivative\n  value at this point is used to squeeze the original interval in a manner that\n  preserves the opposite slope conditions.\n\n  For further details of this component, see the procedure U0-U3 on page 123 of\n  the [Hager and Zhang (2006)][2] article.\n\n  Note that this function does not explicitly verify whether the opposite slope\n  conditions are satisfied for the supplied interval. It is assumed that this\n  is so.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a real scalar\n      tensor and returns an object that can be converted to a namedtuple.\n      The namedtuple should have fields 'f' and 'df' that correspond to scalar\n      tensors of real dtype containing the value of the function and its\n      derivative at that point. The other namedtuple fields, if present,\n      should be tensors or sequences (possibly nested) of tensors.\n      In usual optimization application, this function would be generated by\n      projecting the multivariate objective function along some specific\n      direction. The direction is determined by some other procedure but should\n      be a descent direction (i.e. the derivative of the projected univariate\n      function must be negative at 0.).\n      Alternatively, the function may represent the batching of `n` such line\n      functions (e.g. projecting a single multivariate objective function along\n      `n` distinct directions at once) accepting n points as input, i.e. a\n      tensor of shape [n], and the fields 'f' and 'df' in the returned\n      namedtuple should each be a tensor of shape [n], with the corresponding\n      function values and derivatives at the input points.\n    val_left: Return value of value_and_gradients_function at the left\n      end point of the bracketing interval (labelles 'a' above).\n    val_right: Return value of value_and_gradients_function at the right\n      end point of the bracketing interval (labelles 'b' above).\n    val_trial: Return value of value_and_gradients_function at the trial point\n      to be used to shrink the interval (labelled 'c' above).\n    f_lim: real `Tensor` of shape [n]. The function value threshold for\n      the approximate Wolfe conditions to be checked for each batch member.\n    active: optional boolean `Tensor` of shape [n]. Relevant in batching mode\n      only, indicates batch members on which the update procedure should be\n      applied. On non-active members the current left/right interval is returned\n      unmodified.\n\n  Returns:\n    A namedtuple containing the following fields:\n      iteration: An int32 scalar `Tensor`. The number of iterations performed\n        by the bisect algorithm.\n      stopped: A boolean `Tensor` of shape [n]. True for those batch members\n        where the bisection algorithm terminated.\n      failed: A boolean `Tensor` of shape [n]. True for those batch members\n        where an error was encountered.\n      num_evals: An int32 scalar `Tensor`. The number of times the objective\n        function was evaluated.\n      left: Return value of value_and_gradients_function at the updated left\n        end point of the interval found.\n      right: Return value of value_and_gradients_function at the updated right\n        end point of the interval found.", "docstring_tokens": ["Squeezes", "a", "bracketing", "interval", "containing", "the", "minimum", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253561}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L39-L57", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "converts pb kvs to dict", "language": "python", "parameters": "(kvs, include_non_primitives=True)", "return_statement": "return config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "value", ":", "arg_2", "[", "arg_3", ".", "key", "]", "=", "arg_3", ".", "value", "elif", "arg_3", ".", "serialized_value", ":", "if", "topology_pb2", ".", "JAVA_SERIALIZED_VALUE", "==", "arg_3", ".", "type", ":", "arg_5", "=", "_convert_java_value", "(", "arg_3", ",", "arg_1", "=", "arg_1", ")", "if", "arg_5", "is", "not", "None", ":", "arg_2", "[", "arg_3", ".", "key", "]", "=", "arg_5", "else", ":", "arg_2", "[", "arg_3", ".", "key", "]", "=", "_raw_value", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n  \"\"\"\n  converts pb kvs to dict\n  \"\"\"\n  arg_2 = {}\n  for arg_3 in arg_0:\n    if arg_3.value:\n      arg_2[arg_3.key] = arg_3.value\n    elif arg_3.serialized_value:\n      # add serialized_value support for python values (fixme)\n\n      # is this a serialized java object\n      if topology_pb2.JAVA_SERIALIZED_VALUE == arg_3.type:\n        arg_5 = _convert_java_value(arg_3, arg_1=arg_1)\n        if arg_5 is not None:\n          arg_2[arg_3.key] = arg_5\n      else:\n        arg_2[arg_3.key] = _raw_value(arg_3)\n  return arg_2", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "convert_pb_kvs", "docstring": "converts pb kvs to dict", "docstring_tokens": ["converts", "pb", "kvs", "to", "dict"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253562}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L570-L593", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return fall-out.", "language": "python", "parameters": "(self)", "return_statement": "return self._fp / (self._fp + self._tn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_fp", "+", "arg_0", ".", "_tn", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "arg_0", ".", "_fp", "/", "(", "arg_0", ".", "_fp", "+", "arg_0", ".", "_tn", ")"], "function": "def Func(arg_0):\n        r\"\"\"Return fall-out.\n\n        Fall-out is defined as :math:`\\frac{fp}{fp + tn}`\n\n        AKA false positive rate (FPR)\n\n        Cf. https://en.wikipedia.org/wiki/Information_retrieval#Fall-out\n\n        Returns\n        -------\n        float\n            The fall-out of the confusion table\n\n        Example\n        -------\n        >>> ct = ConfusionTable(120, 60, 20, 30)\n        >>> ct.Func()\n        0.25\n\n        \"\"\"\n        if arg_0._fp + arg_0._tn == 0:\n            return float('NaN')\n        return arg_0._fp / (arg_0._fp + arg_0._tn)", "path": "abydos/stats/_confusion_table.py", "identifier": "ConfusionTable.fallout", "docstring": "r\"\"\"Return fall-out.\n\n        Fall-out is defined as :math:`\\frac{fp}{fp + tn}`\n\n        AKA false positive rate (FPR)\n\n        Cf. https://en.wikipedia.org/wiki/Information_retrieval#Fall-out\n\n        Returns\n        -------\n        float\n            The fall-out of the confusion table\n\n        Example\n        -------\n        >>> ct = ConfusionTable(120, 60, 20, 30)\n        >>> ct.fallout()\n        0.25", "docstring_tokens": ["r", "Return", "fall", "-", "out", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253563}
{"url": "https://github.com/disqus/django-mailviews/blob/9993d5e911d545b3bc038433986c5f6812e7e965/mailviews/utils.py#L10-L26", "sha": "9993d5e911d545b3bc038433986c5f6812e7e965", "docstring_summary": "Splits the docstring of the given value into it's summary and body.", "language": "python", "parameters": "(value)", "return_statement": "return Docstring(pieces[0], body)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "textwrap", ".", "dedent", "(", "getattr", "(", "arg_0", ",", "'__doc__'", ",", "''", ")", ")", "if", "not", "arg_1", ":", "return", "None", "arg_2", "=", "arg_1", ".", "strip", "(", ")", ".", "split", "(", "'\\n\\n'", ",", "1", ")", "try", ":", "arg_3", "=", "arg_2", "[", "1", "]", "except", "IndexError", ":", "arg_3", "=", "None", "return", "Docstring", "(", "arg_2", "[", "0", "]", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Splits the docstring of the given value into it's summary and body.\n\n    :returns: a 2-tuple of the format ``(summary, body)``\n    \"\"\"\n    arg_1 = textwrap.dedent(getattr(arg_0, '__doc__', ''))\n    if not arg_1:\n        return None\n\n    arg_2 = arg_1.strip().split('\\n\\n', 1)\n    try:\n        arg_3 = arg_2[1]\n    except IndexError:\n        arg_3 = None\n\n    return Docstring(arg_2[0], arg_3)", "path": "mailviews/utils.py", "identifier": "split_docstring", "docstring": "Splits the docstring of the given value into it's summary and body.\n\n    :returns: a 2-tuple of the format ``(summary, body)``", "docstring_tokens": ["Splits", "the", "docstring", "of", "the", "given", "value", "into", "it", "s", "summary", "and", "body", "."], "nwo": "disqus/django-mailviews", "score": 0.31736401397382547, "idx": 253564}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/github_access.py#L269-L276", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "return a list of GithubComponentVersion objects for all tags", "language": "python", "parameters": "(self)", "return_statement": "return [\n            GithubComponentVersion(\n                '', t[0], t[1], self.name, cache_key=_createCacheKey('tag', t[0], t[1], self.name)\n            ) for t in self._getTags()\n        ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "GithubComponentVersion", "(", "''", ",", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", "]", ",", "arg_0", ".", "name", ",", "cache_key", "=", "_createCacheKey", "(", "'tag'", ",", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", "]", ",", "arg_0", ".", "name", ")", ")", "for", "arg_1", "in", "arg_0", ".", "_getTags", "(", ")", "]"], "function": "def Func(arg_0):\n        ''' return a list of GithubComponentVersion objects for all tags\n        '''\n        return [\n            GithubComponentVersion(\n                '', arg_1[0], arg_1[1], arg_0.name, cache_key=_createCacheKey('tag', arg_1[0], arg_1[1], arg_0.name)\n            ) for arg_1 in arg_0._getTags()\n        ]", "path": "yotta/lib/github_access.py", "identifier": "GithubComponent.availableTags", "docstring": "return a list of GithubComponentVersion objects for all tags", "docstring_tokens": ["return", "a", "list", "of", "GithubComponentVersion", "objects", "for", "all", "tags"], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 253565}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/compiler.py#L46-L50", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Builds the RETURNING part of the query.", "language": "python", "parameters": "(self)", "return_statement": "return ' RETURNING %s' % qn(self.query.model._meta.pk.attname)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "connection", ".", "ops", ".", "quote_name", "return", "' RETURNING %s'", "%", "arg_1", "(", "arg_0", ".", "query", ".", "model", ".", "_meta", ".", "pk", ".", "attname", ")"], "function": "def Func(arg_0):\n        \"\"\"Builds the RETURNING part of the query.\"\"\"\n\n        arg_1 = arg_0.connection.ops.quote_name\n        return ' RETURNING %s' % arg_1(arg_0.query.model._meta.pk.attname)", "path": "psqlextra/compiler.py", "identifier": "PostgresReturningUpdateCompiler._form_returning", "docstring": "Builds the RETURNING part of the query.", "docstring_tokens": ["Builds", "the", "RETURNING", "part", "of", "the", "query", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 253566}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L140-L152", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Get the owner name of a file or directory.", "language": "python", "parameters": "(self, path, use_sudo=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_2", "and", "run_as_root", "or", "arg_0", ".", "run", "with", "arg_0", ".", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "True", ")", ":", "arg_4", "=", "arg_3", "(", "'stat -c %%U \"%(path)s\"'", "%", "locals", "(", ")", ")", "if", "arg_4", ".", "failed", "and", "'stat: illegal option'", "in", "arg_4", ":", "return", "arg_3", "(", "'stat -f %%Su \"%(path)s\"'", "%", "locals", "(", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Get the owner name of a file or directory.\n        \"\"\"\n        arg_3 = arg_2 and run_as_root or arg_0.run\n        # I'd prefer to use quiet=True, but that's not supported with older\n        # versions of Fabric.\n        with arg_0.settings(hide('running', 'stdout'), warn_only=True):\n            arg_4 = arg_3('stat -c %%U \"%(path)s\"' % locals())\n            if arg_4.failed and 'stat: illegal option' in arg_4:\n                # Try the BSD version of stat\n                return arg_3('stat -f %%Su \"%(path)s\"' % locals())\n            return arg_4", "path": "burlap/files.py", "identifier": "FileSatchel.get_owner", "docstring": "Get the owner name of a file or directory.", "docstring_tokens": ["Get", "the", "owner", "name", "of", "a", "file", "or", "directory", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 253567}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L127-L134", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Wrapper function that first configures logging and starts a single run afterwards.", "language": "python", "parameters": "(kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_configure_niceness", "(", "arg_0", ")", "_configure_logging", "(", "arg_0", ")", "arg_1", "=", "arg_0", "[", "'result_queue'", "]", "arg_2", "=", "_sigint_handling_single_run", "(", "arg_0", ")", "arg_1", ".", "put", "(", "arg_2", ")", "arg_1", ".", "close", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Wrapper function that first configures logging and starts a single run afterwards.\"\"\"\n    _configure_niceness(arg_0)\n    _configure_logging(arg_0)\n    arg_1 = arg_0['result_queue']\n    arg_2 = _sigint_handling_single_run(arg_0)\n    arg_1.put(arg_2)\n    arg_1.close()", "path": "pypet/environment.py", "identifier": "_process_single_run", "docstring": "Wrapper function that first configures logging and starts a single run afterwards.", "docstring_tokens": ["Wrapper", "function", "that", "first", "configures", "logging", "and", "starts", "a", "single", "run", "afterwards", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253568}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/migrations/env.py#L68-L86", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Run migrations in 'online' mode.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "settings", ".", "engine", "with", "arg_0", ".", "connect", "(", ")", "as", "connection", ":", "context", ".", "configure", "(", "connection", "=", "connection", ",", "transaction_per_migration", "=", "True", ",", "target_metadata", "=", "target_metadata", ",", "compare_type", "=", "COMPARE_TYPE", ",", ")", "with", "context", ".", "begin_transaction", "(", ")", ":", "context", ".", "run_migrations", "(", ")"], "function": "def Func():\n    \"\"\"Run migrations in 'online' mode.\n\n    In this scenario we need to create an Engine\n    and associate a connection with the context.\n\n    \"\"\"\n    arg_0 = settings.engine\n\n    with arg_0.connect() as connection:\n        context.configure(\n            connection=connection,\n            transaction_per_migration=True,\n            target_metadata=target_metadata,\n            compare_type=COMPARE_TYPE,\n        )\n\n        with context.begin_transaction():\n            context.run_migrations()", "path": "airflow/migrations/env.py", "identifier": "run_migrations_online", "docstring": "Run migrations in 'online' mode.\n\n    In this scenario we need to create an Engine\n    and associate a connection with the context.", "docstring_tokens": ["Run", "migrations", "in", "online", "mode", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253569}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L547-L549", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Return option as an expanded path.", "language": "python", "parameters": "(self, section, option)", "return_statement": "return os.path.expanduser(os.path.expandvars(self.get(section, option)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "os", ".", "path", ".", "expanduser", "(", "os", ".", "path", ".", "expandvars", "(", "arg_0", ".", "get", "(", "arg_1", ",", "arg_2", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n          \"\"\"Return option as an expanded path.\"\"\"\n          return os.path.expanduser(os.path.expandvars(arg_0.get(arg_1, arg_2)))", "path": "gromacs/config.py", "identifier": "GMXConfigParser.getpath", "docstring": "Return option as an expanded path.", "docstring_tokens": ["Return", "option", "as", "an", "expanded", "path", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 253570}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/_oldpf.py#L226-L246", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This bins the phased mag series using the given binsize.", "language": "python", "parameters": "(phases, mags, binsize=0.002, minbin=9)", "return_statement": "return np.array(binnedphases), np.array(binnedmags)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.002", ",", "arg_3", "=", "9", ")", ":", "arg_4", "=", "np", ".", "arange", "(", "0.0", ",", "1.0", ",", "arg_2", ")", "arg_5", "=", "npdigitize", "(", "arg_0", ",", "arg_4", ")", "arg_6", ",", "arg_7", "=", "[", "]", ",", "[", "]", "for", "arg_8", "in", "npunique", "(", "arg_5", ")", ":", "arg_9", "=", "arg_5", "==", "arg_8", "arg_10", "=", "arg_0", "[", "arg_9", "]", "arg_11", "=", "arg_1", "[", "arg_9", "]", "if", "arg_9", ".", "size", ">", "arg_3", ":", "arg_6", ".", "append", "(", "npmedian", "(", "arg_10", ")", ")", "arg_7", ".", "append", "(", "npmedian", "(", "arg_11", ")", ")", "return", "np", ".", "array", "(", "arg_6", ")", ",", "np", ".", "array", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.002, arg_3=9):\n    '''\n    This bins the phased mag series using the given binsize.\n\n    '''\n\n    arg_4 = np.arange(0.0, 1.0, arg_2)\n    arg_5 = npdigitize(arg_0, arg_4)\n\n    arg_6, arg_7 = [], []\n\n    for arg_8 in npunique(arg_5):\n\n        arg_9 = arg_5 == arg_8\n        arg_10 = arg_0[arg_9]\n        arg_11 = arg_1[arg_9]\n        if arg_9.size > arg_3:\n            arg_6.append(npmedian(arg_10))\n            arg_7.append(npmedian(arg_11))\n\n    return np.array(arg_6), np.array(arg_7)", "path": "astrobase/periodbase/_oldpf.py", "identifier": "pwd_phasebin", "docstring": "This bins the phased mag series using the given binsize.", "docstring_tokens": ["This", "bins", "the", "phased", "mag", "series", "using", "the", "given", "binsize", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 253571}
{"url": "https://github.com/codelv/enaml-web/blob/88f1131a7b3ba9e83467b4f44bc3bab6f0de7559/examples/dataframe_viewer/app.py#L69-L95", "sha": "88f1131a7b3ba9e83467b4f44bc3bab6f0de7559", "docstring_summary": "When we get an event from js, lookup the node and invoke the\n        action on the enaml node.", "language": "python", "parameters": "(self, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "json", ".", "loads", "(", "arg_1", ")", "log", ".", "debug", "(", "f'Update from js: {change}'", ")", "arg_3", "=", "arg_2", ".", "get", "(", "'ref'", ")", "if", "not", "arg_3", ":", "return", "arg_4", "=", "arg_0", ".", "viewer", ".", "xpath", "(", "'//*[@ref=$ref]'", ",", "arg_3", "=", "arg_3", ")", "if", "not", "arg_4", ":", "return", "arg_5", "=", "arg_4", "[", "0", "]", "if", "arg_2", ".", "get", "(", "'type'", ")", "and", "arg_2", ".", "get", "(", "'name'", ")", ":", "if", "arg_2", "[", "'type'", "]", "==", "'event'", ":", "arg_6", "=", "getattr", "(", "arg_5", ",", "arg_2", "[", "'name'", "]", ")", "arg_6", "(", ")", "elif", "arg_2", "[", "'type'", "]", "==", "'update'", ":", "setattr", "(", "arg_5", ",", "arg_2", "[", "'name'", "]", ",", "arg_2", "[", "'value'", "]", ")", "else", ":", "log", ".", "warning", "(", "f\"Unhandled event {self} {node}: {change}\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" When we get an event from js, lookup the node and invoke the\n        action on the enaml node.\n\n        \"\"\"\n        arg_2 = json.loads(arg_1)\n        log.debug(f'Update from js: {change}')\n\n        # Lookup the node\n        arg_3 = arg_2.get('ref')\n        if not arg_3:\n            return\n        arg_4 = arg_0.viewer.xpath('//*[@ref=$ref]', arg_3=arg_3)\n        if not arg_4:\n            return  # Unknown node\n        arg_5 = arg_4[0]\n\n        # Trigger the change on the enaml node\n        if arg_2.get('type') and arg_2.get('name'):\n            if arg_2['type'] == 'event':\n                arg_6 = getattr(arg_5, arg_2['name'])\n                arg_6()\n            elif arg_2['type'] == 'update':\n                # Trigger the update\n                setattr(arg_5, arg_2['name'], arg_2['value'])\n        else:\n            log.warning(f\"Unhandled event {self} {node}: {change}\")", "path": "examples/dataframe_viewer/app.py", "identifier": "ViewerWebSocket.on_message", "docstring": "When we get an event from js, lookup the node and invoke the\n        action on the enaml node.", "docstring_tokens": ["When", "we", "get", "an", "event", "from", "js", "lookup", "the", "node", "and", "invoke", "the", "action", "on", "the", "enaml", "node", "."], "nwo": "codelv/enaml-web", "score": 0.5680722283335639, "idx": 253572}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L965-L1337", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores a particular item to disk.", "language": "python", "parameters": "(self, msg, stuff_to_store, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "True", "try", ":", "arg_5", "=", "arg_0", ".", "_srvc_opening_routine", "(", "'a'", ",", "arg_1", ",", "arg_4", ")", "if", "arg_1", "==", "pypetconstants", ".", "MERGE", ":", "arg_0", ".", "_trj_merge_trajectories", "(", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "BACKUP", ":", "arg_0", ".", "_trj_backup_trajectory", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "PREPARE_MERGE", ":", "arg_0", ".", "_trj_prepare_merge", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "TRAJECTORY", ":", "arg_0", ".", "_trj_Func_trajectory", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "SINGLE_RUN", ":", "arg_0", ".", "_srn_Func_single_run", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "in", "pypetconstants", ".", "LEAF", ":", "arg_0", ".", "_prm_Func_parameter_or_result", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "DELETE", ":", "arg_0", ".", "_all_delete_parameter_or_result_or_group", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "GROUP", ":", "arg_0", ".", "_grp_Func_group", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "TREE", ":", "arg_0", ".", "_tree_Func_sub_branch", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "DELETE_LINK", ":", "arg_0", ".", "_lnk_delete_link", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "LIST", ":", "arg_0", ".", "_srvc_Func_several_items", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "ACCESS_DATA", ":", "return", "arg_0", ".", "_hdf5_interact_with_data", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "OPEN_FILE", ":", "arg_5", "=", "False", "arg_0", ".", "_keep_open", "=", "True", "arg_0", ".", "_node_processing_timer", ".", "active", "=", "False", "elif", "arg_1", "==", "pypetconstants", ".", "CLOSE_FILE", ":", "arg_5", "=", "True", "arg_0", ".", "_keep_open", "=", "False", "elif", "arg_1", "==", "pypetconstants", ".", "FLUSH", ":", "arg_0", ".", "_hdf5file", ".", "flush", "(", ")", "else", ":", "raise", "pex", ".", "NoSuchServiceError", "(", "'I do not know how to handle `%s`'", "%", "arg_1", ")", "except", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Failed storing `%s`'", "%", "str", "(", "arg_2", ")", ")", "raise", "finally", ":", "arg_0", ".", "_srvc_closing_routine", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        \"\"\" Stores a particular item to disk.\n\n        The storage service always accepts these parameters:\n\n        :param trajectory_name: Name or current trajectory and name of top node in hdf5 file\n\n        :param filename: Name of the hdf5 file\n\n        :param file_title: If file needs to be created, assigns a title to the file.\n\n\n        The following messages (first argument msg) are understood and the following arguments\n        can be provided in combination with the message:\n\n            * :const:`pypet.pypetconstants.PREPARE_MERGE` ('PREPARE_MERGE'):\n\n                Called to prepare a trajectory for merging, see also 'MERGE' below.\n\n                Will also be called if merging cannot happen within the same hdf5 file.\n                Stores already enlarged parameters and updates meta information.\n\n                :param stuff_to_Func: Trajectory that is about to be extended by another one\n\n                :param changed_parameters:\n\n                    List containing all parameters that were enlarged due to merging\n\n                :param old_length:\n\n                    Old length of trajectory before merge\n\n            * :const:`pypet.pypetconstants.MERGE` ('MERGE')\n\n                Note that before merging within HDF5 file, the storage service will be called\n                with msg='PREPARE_MERGE' before, see above.\n\n                Raises a ValueError if the two trajectories are not Funcd within the very\n                same hdf5 file. Then the current trajectory needs to perform the merge slowly\n                item by item.\n\n                Merges two trajectories, parameters are:\n\n                :param stuff_to_Func: The trajectory data is merged into\n\n                :param other_trajectory_name: Name of the other trajectory\n\n                :param rename_dict:\n\n                    Dictionary containing the old result and derived parameter names in the\n                    other trajectory and their new names in the current trajectory.\n\n                :param move_nodes:\n\n                    Whether to move the nodes from the other to the current trajectory\n\n                :param delete_trajectory:\n\n                    Whether to delete the other trajectory after merging.\n\n            * :const:`pypet.pypetconstants.BACKUP` ('BACKUP')\n\n                :param stuff_to_Func: Trajectory to be backed up\n\n                :param backup_filename:\n\n                    Name of file where to Func the backup. If None the backup file will be in\n                    the same folder as your hdf5 file and named 'backup_XXXXX.hdf5'\n                    where 'XXXXX' is the name of your current trajectory.\n\n            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')\n\n                Stores the whole trajectory\n\n                :param stuff_to_Func: The trajectory to be Funcd\n\n                :param only_init:\n\n                    If you just want to initialise the Func. If yes, only meta information about\n                    the trajectory is Funcd and none of the nodes/leaves within the trajectory.\n\n                :param Func_data:\n\n                    How to Func data, the following settings are understood:\n\n                     :const:`pypet.pypetconstants.STORE_NOTHING`: (0)\n\n                        Nothing is Funcd\n\n                    :const:`pypet.pypetconstants.STORE_DATA_SKIPPING`: (1)\n\n                        Data of not already Funcd nodes is Funcd\n\n                    :const:`pypet.pypetconstants.STORE_DATA`: (2)\n\n                        Data of all nodes is Funcd. However, existing data on disk is left\n                        untouched.\n\n                    :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)\n\n                        Data of all nodes is Funcd and data on disk is overwritten.\n                        May lead to fragmentation of the HDF5 file. The user is adviced\n                        to recompress the file manually later on.\n\n            * :const:`pypet.pypetconstants.SINGLE_RUN` ('SINGLE_RUN')\n\n                :param stuff_to_Func: The trajectory\n\n                :param Func_data: How to Func data see above\n\n                :param Func_final: If final meta info should be Funcd\n\n            * :const:`pypet.pypetconstants.LEAF`\n\n                Stores a parameter or result\n\n                Note that everything that is supported by the storage service and that is\n                Funcd to disk will be perfectly recovered.\n                For instance, you Func a tuple of numpy 32 bit integers, you will get a tuple\n                of numpy 32 bit integers after loading independent of the platform!\n\n                :param stuff_to_sore: Result or parameter to Func\n\n                    In order to determine what to Func, the function '_Func' of the parameter or\n                    result is called. This function returns a dictionary with name keys and data to\n                    Func as values. In order to determine how to Func the data, the storage flags\n                    are considered, see below.\n\n                    The function '_Func' has to return a dictionary containing values only from\n                    the following objects:\n\n                        * python natives (int, long, str, bool, float, complex),\n\n                        *\n                            numpy natives, arrays and matrices of type np.int8-64, np.uint8-64,\n                            np.float32-64, np.complex, np.str\n\n                        *\n\n                            python lists and tuples of the previous types\n                            (python natives + numpy natives and arrays)\n                            Lists and tuples are not allowed to be nested and must be\n                            homogeneous, i.e. only contain data of one particular type.\n                            Only integers, or only floats, etc.\n\n                        *\n\n                            python dictionaries of the previous types (not nested!), data can be\n                            heterogeneous, keys must be strings. For example, one key-value-pair\n                            of string and int and one key-value pair of string and float, and so\n                            on.\n\n                        * pandas DataFrames_\n\n                        * :class:`~pypet.parameter.ObjectTable`\n\n                    .. _DataFrames: http://pandas.pydata.org/pandas-docs/dev/dsintro.html#dataframe\n\n                    The keys from the '_Func' dictionaries determine how the data will be named\n                    in the hdf5 file.\n\n                :param Func_data:\n\n                    How to Func the data, see above for a descitpion.\n\n                :param Func_flags: Flags describing how to Func data.\n\n                        :const:`~pypet.HDF5StorageService.ARRAY` ('ARRAY')\n\n                            Store stuff as array\n\n                        :const:`~pypet.HDF5StorageService.CARRAY` ('CARRAY')\n\n                            Store stuff as carray\n\n                        :const:`~pypet.HDF5StorageService.TABLE` ('TABLE')\n\n                            Store stuff as pytable\n\n                        :const:`~pypet.HDF5StorageService.DICT` ('DICT')\n\n                            Store stuff as pytable but reconstructs it later as dictionary\n                            on loading\n\n                        :const:`~pypet.HDF%StorageService.FRAME` ('FRAME')\n\n                            Store stuff as pandas data frame\n\n                    Storage flags can also be provided by the parameters and results themselves\n                    if they implement a function '_Func_flags' that returns a dictionary\n                    with the names of the data to Func as keys and the flags as values.\n\n                    If no storage flags are provided, they are automatically inferred from the\n                    data. See :const:`pypet.HDF5StorageService.TYPE_FLAG_MAPPING` for the mapping\n                    from type to flag.\n\n                :param overwrite:\n\n                    Can be used if parts of a leaf should be replaced. Either a list of\n                    HDF5 names or `True` if this should account for all.\n\n            * :const:`pypet.pypetconstants.DELETE` ('DELETE')\n\n                Removes an item from disk. Empty group nodes, results and non-explored\n                parameters can be removed.\n\n                :param stuff_to_Func: The item to be removed.\n\n                :param delete_only:\n\n                    Potential list of parts of a leaf node that should be deleted.\n\n                :param remove_from_item:\n\n                    If `delete_only` is used, whether deleted nodes should also be erased\n                    from the leaf nodes themseleves.\n\n                :param recursive:\n\n                    If you want to delete a group node you can recursively delete all its\n                    children.\n\n            * :const:`pypet.pypetconstants.GROUP` ('GROUP')\n\n                :param stuff_to_Func: The group to Func\n\n                :param Func_data: How to Func data\n\n                :param recursive: To recursively load everything below.\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n            * :const:`pypet.pypetconstants.TREE`\n\n                Stores a single node or a full subtree\n\n                :param stuff_to_Func: Node to Func\n\n                :param Func_data: How to Func data\n\n                :param recursive: Whether to Func recursively the whole sub-tree\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n            * :const:`pypet.pypetconstants.DELETE_LINK`\n\n                Deletes a link from hard drive\n\n                :param name: The full colon separated name of the link\n\n            * :const:`pypet.pypetconstants.LIST`\n\n                .. _Func-lists:\n\n                Stores several items at once\n\n                :param stuff_to_Func:\n\n                    Iterable whose items are to be Funcd. Iterable must contain tuples,\n                    for example `[(msg1,item1,arg1,kwargs1),(msg2,item2,arg2,kwargs2),...]`\n\n            * :const:`pypet.pypetconstants.ACCESS_DATA`\n\n                Requests and manipulates data within the storage.\n                Storage must be open.\n\n                :param stuff_to_Func:\n\n                    A colon separated name to the data path\n\n                :param item_name:\n\n                    The name of the data item to interact with\n\n                :param request:\n\n                    A functional request in form of a string\n\n                :param args:\n\n                    Positional arguments passed to the reques\n\n                :param kwargs:\n\n                    Keyword arguments passed to the request\n\n            * :const:`pypet.pypetconstants.OPEN_FILE`\n\n                Opens the HDF5 file and keeps it open\n\n                :param stuff_to_Func: ``None``\n\n            * :const:`pypet.pypetconstants.CLOSE_FILE`\n\n                Closes an HDF5 file that was kept open, must be open before.\n\n                :param stuff_to_Func: ``None``\n\n            * :const:`pypet.pypetconstants.FLUSH`\n\n                Flushes an open file, must be open before.\n\n                :param stuff_to_Func: ``None``\n\n        :raises: NoSuchServiceError if message or data is not understood\n\n        \"\"\"\n        arg_5 = True\n        try:\n\n            arg_5 = arg_0._srvc_opening_routine('a', arg_1, arg_4)\n\n            if arg_1 == pypetconstants.MERGE:\n                arg_0._trj_merge_trajectories(*arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.BACKUP:\n                arg_0._trj_backup_trajectory(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.PREPARE_MERGE:\n                arg_0._trj_prepare_merge(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.TRAJECTORY:\n                arg_0._trj_Func_trajectory(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.SINGLE_RUN:\n                arg_0._srn_Func_single_run(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 in pypetconstants.LEAF:\n                arg_0._prm_Func_parameter_or_result(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.DELETE:\n                arg_0._all_delete_parameter_or_result_or_group(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.GROUP:\n                arg_0._grp_Func_group(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.TREE:\n                arg_0._tree_Func_sub_branch(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.DELETE_LINK:\n                arg_0._lnk_delete_link(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.LIST:\n                arg_0._srvc_Func_several_items(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.ACCESS_DATA:\n                return arg_0._hdf5_interact_with_data(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.OPEN_FILE:\n                arg_5 = False  # Wee need to keep the file open to allow later interaction\n                arg_0._keep_open = True\n                arg_0._node_processing_timer.active = False # This might be open quite long\n                # so we don't want to display horribly long opening times\n\n            elif arg_1 == pypetconstants.CLOSE_FILE:\n                arg_5 = True  # Simply conduct the closing routine afterwards\n                arg_0._keep_open = False\n\n            elif arg_1 == pypetconstants.FLUSH:\n                arg_0._hdf5file.flush()\n\n            else:\n                raise pex.NoSuchServiceError('I do not know how to handle `%s`' % arg_1)\n\n        except:\n            arg_0._logger.error('Failed storing `%s`' % str(arg_2))\n            raise\n        finally:\n            arg_0._srvc_closing_routine(arg_5)", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService.store", "docstring": "Stores a particular item to disk.\n\n        The storage service always accepts these parameters:\n\n        :param trajectory_name: Name or current trajectory and name of top node in hdf5 file\n\n        :param filename: Name of the hdf5 file\n\n        :param file_title: If file needs to be created, assigns a title to the file.\n\n\n        The following messages (first argument msg) are understood and the following arguments\n        can be provided in combination with the message:\n\n            * :const:`pypet.pypetconstants.PREPARE_MERGE` ('PREPARE_MERGE'):\n\n                Called to prepare a trajectory for merging, see also 'MERGE' below.\n\n                Will also be called if merging cannot happen within the same hdf5 file.\n                Stores already enlarged parameters and updates meta information.\n\n                :param stuff_to_store: Trajectory that is about to be extended by another one\n\n                :param changed_parameters:\n\n                    List containing all parameters that were enlarged due to merging\n\n                :param old_length:\n\n                    Old length of trajectory before merge\n\n            * :const:`pypet.pypetconstants.MERGE` ('MERGE')\n\n                Note that before merging within HDF5 file, the storage service will be called\n                with msg='PREPARE_MERGE' before, see above.\n\n                Raises a ValueError if the two trajectories are not stored within the very\n                same hdf5 file. Then the current trajectory needs to perform the merge slowly\n                item by item.\n\n                Merges two trajectories, parameters are:\n\n                :param stuff_to_store: The trajectory data is merged into\n\n                :param other_trajectory_name: Name of the other trajectory\n\n                :param rename_dict:\n\n                    Dictionary containing the old result and derived parameter names in the\n                    other trajectory and their new names in the current trajectory.\n\n                :param move_nodes:\n\n                    Whether to move the nodes from the other to the current trajectory\n\n                :param delete_trajectory:\n\n                    Whether to delete the other trajectory after merging.\n\n            * :const:`pypet.pypetconstants.BACKUP` ('BACKUP')\n\n                :param stuff_to_store: Trajectory to be backed up\n\n                :param backup_filename:\n\n                    Name of file where to store the backup. If None the backup file will be in\n                    the same folder as your hdf5 file and named 'backup_XXXXX.hdf5'\n                    where 'XXXXX' is the name of your current trajectory.\n\n            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')\n\n                Stores the whole trajectory\n\n                :param stuff_to_store: The trajectory to be stored\n\n                :param only_init:\n\n                    If you just want to initialise the store. If yes, only meta information about\n                    the trajectory is stored and none of the nodes/leaves within the trajectory.\n\n                :param store_data:\n\n                    How to store data, the following settings are understood:\n\n                     :const:`pypet.pypetconstants.STORE_NOTHING`: (0)\n\n                        Nothing is stored\n\n                    :const:`pypet.pypetconstants.STORE_DATA_SKIPPING`: (1)\n\n                        Data of not already stored nodes is stored\n\n                    :const:`pypet.pypetconstants.STORE_DATA`: (2)\n\n                        Data of all nodes is stored. However, existing data on disk is left\n                        untouched.\n\n                    :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)\n\n                        Data of all nodes is stored and data on disk is overwritten.\n                        May lead to fragmentation of the HDF5 file. The user is adviced\n                        to recompress the file manually later on.\n\n            * :const:`pypet.pypetconstants.SINGLE_RUN` ('SINGLE_RUN')\n\n                :param stuff_to_store: The trajectory\n\n                :param store_data: How to store data see above\n\n                :param store_final: If final meta info should be stored\n\n            * :const:`pypet.pypetconstants.LEAF`\n\n                Stores a parameter or result\n\n                Note that everything that is supported by the storage service and that is\n                stored to disk will be perfectly recovered.\n                For instance, you store a tuple of numpy 32 bit integers, you will get a tuple\n                of numpy 32 bit integers after loading independent of the platform!\n\n                :param stuff_to_sore: Result or parameter to store\n\n                    In order to determine what to store, the function '_store' of the parameter or\n                    result is called. This function returns a dictionary with name keys and data to\n                    store as values. In order to determine how to store the data, the storage flags\n                    are considered, see below.\n\n                    The function '_store' has to return a dictionary containing values only from\n                    the following objects:\n\n                        * python natives (int, long, str, bool, float, complex),\n\n                        *\n                            numpy natives, arrays and matrices of type np.int8-64, np.uint8-64,\n                            np.float32-64, np.complex, np.str\n\n                        *\n\n                            python lists and tuples of the previous types\n                            (python natives + numpy natives and arrays)\n                            Lists and tuples are not allowed to be nested and must be\n                            homogeneous, i.e. only contain data of one particular type.\n                            Only integers, or only floats, etc.\n\n                        *\n\n                            python dictionaries of the previous types (not nested!), data can be\n                            heterogeneous, keys must be strings. For example, one key-value-pair\n                            of string and int and one key-value pair of string and float, and so\n                            on.\n\n                        * pandas DataFrames_\n\n                        * :class:`~pypet.parameter.ObjectTable`\n\n                    .. _DataFrames: http://pandas.pydata.org/pandas-docs/dev/dsintro.html#dataframe\n\n                    The keys from the '_store' dictionaries determine how the data will be named\n                    in the hdf5 file.\n\n                :param store_data:\n\n                    How to store the data, see above for a descitpion.\n\n                :param store_flags: Flags describing how to store data.\n\n                        :const:`~pypet.HDF5StorageService.ARRAY` ('ARRAY')\n\n                            Store stuff as array\n\n                        :const:`~pypet.HDF5StorageService.CARRAY` ('CARRAY')\n\n                            Store stuff as carray\n\n                        :const:`~pypet.HDF5StorageService.TABLE` ('TABLE')\n\n                            Store stuff as pytable\n\n                        :const:`~pypet.HDF5StorageService.DICT` ('DICT')\n\n                            Store stuff as pytable but reconstructs it later as dictionary\n                            on loading\n\n                        :const:`~pypet.HDF%StorageService.FRAME` ('FRAME')\n\n                            Store stuff as pandas data frame\n\n                    Storage flags can also be provided by the parameters and results themselves\n                    if they implement a function '_store_flags' that returns a dictionary\n                    with the names of the data to store as keys and the flags as values.\n\n                    If no storage flags are provided, they are automatically inferred from the\n                    data. See :const:`pypet.HDF5StorageService.TYPE_FLAG_MAPPING` for the mapping\n                    from type to flag.\n\n                :param overwrite:\n\n                    Can be used if parts of a leaf should be replaced. Either a list of\n                    HDF5 names or `True` if this should account for all.\n\n            * :const:`pypet.pypetconstants.DELETE` ('DELETE')\n\n                Removes an item from disk. Empty group nodes, results and non-explored\n                parameters can be removed.\n\n                :param stuff_to_store: The item to be removed.\n\n                :param delete_only:\n\n                    Potential list of parts of a leaf node that should be deleted.\n\n                :param remove_from_item:\n\n                    If `delete_only` is used, whether deleted nodes should also be erased\n                    from the leaf nodes themseleves.\n\n                :param recursive:\n\n                    If you want to delete a group node you can recursively delete all its\n                    children.\n\n            * :const:`pypet.pypetconstants.GROUP` ('GROUP')\n\n                :param stuff_to_store: The group to store\n\n                :param store_data: How to store data\n\n                :param recursive: To recursively load everything below.\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n            * :const:`pypet.pypetconstants.TREE`\n\n                Stores a single node or a full subtree\n\n                :param stuff_to_store: Node to store\n\n                :param store_data: How to store data\n\n                :param recursive: Whether to store recursively the whole sub-tree\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n            * :const:`pypet.pypetconstants.DELETE_LINK`\n\n                Deletes a link from hard drive\n\n                :param name: The full colon separated name of the link\n\n            * :const:`pypet.pypetconstants.LIST`\n\n                .. _store-lists:\n\n                Stores several items at once\n\n                :param stuff_to_store:\n\n                    Iterable whose items are to be stored. Iterable must contain tuples,\n                    for example `[(msg1,item1,arg1,kwargs1),(msg2,item2,arg2,kwargs2),...]`\n\n            * :const:`pypet.pypetconstants.ACCESS_DATA`\n\n                Requests and manipulates data within the storage.\n                Storage must be open.\n\n                :param stuff_to_store:\n\n                    A colon separated name to the data path\n\n                :param item_name:\n\n                    The name of the data item to interact with\n\n                :param request:\n\n                    A functional request in form of a string\n\n                :param args:\n\n                    Positional arguments passed to the reques\n\n                :param kwargs:\n\n                    Keyword arguments passed to the request\n\n            * :const:`pypet.pypetconstants.OPEN_FILE`\n\n                Opens the HDF5 file and keeps it open\n\n                :param stuff_to_store: ``None``\n\n            * :const:`pypet.pypetconstants.CLOSE_FILE`\n\n                Closes an HDF5 file that was kept open, must be open before.\n\n                :param stuff_to_store: ``None``\n\n            * :const:`pypet.pypetconstants.FLUSH`\n\n                Flushes an open file, must be open before.\n\n                :param stuff_to_store: ``None``\n\n        :raises: NoSuchServiceError if message or data is not understood", "docstring_tokens": ["Stores", "a", "particular", "item", "to", "disk", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253573}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/helpers.py#L80-L104", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Loads a description file and returns it as a module.", "language": "python", "parameters": "(descriptionPyPath)", "return_statement": "return mod", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "global", "g_descriptionImportCount", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "raise", "RuntimeError", "(", "(", "\"Experiment description file %s does not exist or \"", "+", "\"is not a file\"", ")", "%", "(", "arg_0", ",", ")", ")", "arg_1", "=", "imp", ".", "load_source", "(", "\"pf_description%d\"", "%", "g_descriptionImportCount", ",", "arg_0", ")", "g_descriptionImportCount", "+=", "1", "if", "not", "hasattr", "(", "arg_1", ",", "\"descriptionInterface\"", ")", ":", "raise", "RuntimeError", "(", "\"Experiment description file %s does not define %s\"", "%", "(", "arg_0", ",", "\"descriptionInterface\"", ")", ")", "if", "not", "isinstance", "(", "arg_1", ".", "descriptionInterface", ",", "exp_description_api", ".", "DescriptionIface", ")", ":", "raise", "RuntimeError", "(", "(", "\"Experiment description file %s defines %s but it \"", "+", "\"is not DescriptionIface-based\"", ")", "%", "(", "arg_0", ",", "name", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Loads a description file and returns it as a module.\n\n  descriptionPyPath: path of description.py file to load\n  \"\"\"\n  global g_descriptionImportCount\n\n  if not os.path.isfile(arg_0):\n    raise RuntimeError((\"Experiment description file %s does not exist or \" + \\\n                        \"is not a file\") % (arg_0,))\n\n  arg_1 = imp.load_source(\"pf_description%d\" % g_descriptionImportCount,\n                        arg_0)\n  g_descriptionImportCount += 1\n\n  if not hasattr(arg_1, \"descriptionInterface\"):\n    raise RuntimeError(\"Experiment description file %s does not define %s\" % \\\n                       (arg_0, \"descriptionInterface\"))\n\n  if not isinstance(arg_1.descriptionInterface, exp_description_api.DescriptionIface):\n    raise RuntimeError((\"Experiment description file %s defines %s but it \" + \\\n                        \"is not DescriptionIface-based\") % \\\n                            (arg_0, name))\n\n  return arg_1", "path": "src/nupic/frameworks/opf/helpers.py", "identifier": "_loadDescriptionFile", "docstring": "Loads a description file and returns it as a module.\n\n  descriptionPyPath: path of description.py file to load", "docstring_tokens": ["Loads", "a", "description", "file", "and", "returns", "it", "as", "a", "module", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253574}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L589-L604", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Detects if lock client was forked.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_pid", "is", "None", ":", "arg_0", ".", "_pid", "=", "os", ".", "getpid", "(", ")", "if", "arg_0", ".", "_context", "is", "not", "None", ":", "arg_2", "=", "os", ".", "getpid", "(", ")", "if", "arg_2", "!=", "arg_0", ".", "_pid", ":", "arg_0", ".", "_logger", ".", "debug", "(", "'Fork detected: My pid `%s` != os pid `%s`. '", "'Restarting connection.'", "%", "(", "str", "(", "arg_0", ".", "_pid", ")", ",", "str", "(", "arg_2", ")", ")", ")", "arg_0", ".", "_context", "=", "None", "arg_0", ".", "_pid", "=", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Detects if lock client was forked.\n\n        Forking is detected by comparing the PID of the current\n        process with the stored PID.\n\n        \"\"\"\n        if arg_0._pid is None:\n            arg_0._pid = os.getpid()\n        if arg_0._context is not None:\n            arg_2 = os.getpid()\n            if arg_2 != arg_0._pid:\n                arg_0._logger.debug('Fork detected: My pid `%s` != os pid `%s`. '\n                                   'Restarting connection.' % (str(arg_0._pid), str(arg_2)))\n                arg_0._context = None\n                arg_0._pid = arg_2", "path": "pypet/utils/mpwrappers.py", "identifier": "ForkDetector._detect_fork", "docstring": "Detects if lock client was forked.\n\n        Forking is detected by comparing the PID of the current\n        process with the stored PID.", "docstring_tokens": ["Detects", "if", "lock", "client", "was", "forked", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253575}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/langevin.py#L630-L688", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Applies one step of Euler-Maruyama method.", "language": "python", "parameters": "(random_draw_parts,\n                  state_parts,\n                  drift_parts,\n                  step_size_parts,\n                  volatility_parts,\n                  name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_5", ",", "'malaFunc'", ",", "[", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "]", ")", ":", "arg_6", "=", "[", "]", "for", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "in", "zip", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_12", "=", "arg_8", "+", "arg_9", "+", "arg_11", "*", "tf", ".", "sqrt", "(", "arg_10", ")", "*", "arg_7", "arg_6", ".", "append", "(", "arg_12", ")", "return", "arg_6"], "function": "def Func(arg_0,\n                  arg_1,\n                  arg_2,\n                  arg_3,\n                  arg_4,\n                  arg_5=None):\n  \"\"\"Applies one step of Euler-Maruyama method.\n\n  Generates proposal of the form:\n\n  ```python\n  tfd.Normal(loc=state_parts + _get_drift(state_parts, ...),\n             scale=tf.sqrt(step_size * volatility_fn(current_state)))\n  ```\n\n  `_get_drift(state_parts, ..)` is a diffusion drift value at `state_parts`.\n\n\n  Args:\n    random_draw_parts: Python `list` of `Tensor`s containing the value(s) of the\n      random perturbation variable(s). Must broadcast with the shape of\n      `state_parts`.\n    state_parts: Python `list` of `Tensor`s representing the current\n      state(s) of the Markov chain(s).\n    drift_parts: Python `list` of `Tensor`s representing value of the drift\n      `_get_drift(*state_parts, ..)`. Must broadcast with the shape of\n      `state_parts`.\n    step_size_parts: Python `list` of `Tensor`s representing the step size for\n      the Euler-Maruyama method. Must broadcast with the shape of\n      `state_parts`.  Larger step sizes lead to faster progress, but\n      too-large step sizes make rejection exponentially more likely. When\n      possible, it's often helpful to match per-variable step sizes to the\n      standard deviations of the target distribution in each variable.\n    volatility_parts: Python `list` of `Tensor`s representing the value of\n      `volatility_fn(*state_parts)`. Must broadcast with the shape of\n      `state_parts`.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'malaFunc').\n\n  Returns:\n    proposed_state_parts: Tensor or Python list of `Tensor`s representing the\n      state(s) of the Markov chain(s) at each result step. Has same shape as\n      input `current_state_parts`.\n  \"\"\"\n  with tf.compat.v1.name_scope(arg_5, 'malaFunc', [\n      arg_0, arg_1, arg_2, arg_3,\n      arg_4\n  ]):\n    arg_6 = []\n    for arg_7, arg_8, arg_9, arg_10, arg_11 in zip(\n        arg_0,\n        arg_1,\n        arg_2,\n        arg_3,\n        arg_4):\n      arg_12 = arg_8 + arg_9 + arg_11 * tf.sqrt(arg_10) * arg_7\n      arg_6.append(arg_12)\n\n    return arg_6", "path": "tensorflow_probability/python/mcmc/langevin.py", "identifier": "_euler_method", "docstring": "Applies one step of Euler-Maruyama method.\n\n  Generates proposal of the form:\n\n  ```python\n  tfd.Normal(loc=state_parts + _get_drift(state_parts, ...),\n             scale=tf.sqrt(step_size * volatility_fn(current_state)))\n  ```\n\n  `_get_drift(state_parts, ..)` is a diffusion drift value at `state_parts`.\n\n\n  Args:\n    random_draw_parts: Python `list` of `Tensor`s containing the value(s) of the\n      random perturbation variable(s). Must broadcast with the shape of\n      `state_parts`.\n    state_parts: Python `list` of `Tensor`s representing the current\n      state(s) of the Markov chain(s).\n    drift_parts: Python `list` of `Tensor`s representing value of the drift\n      `_get_drift(*state_parts, ..)`. Must broadcast with the shape of\n      `state_parts`.\n    step_size_parts: Python `list` of `Tensor`s representing the step size for\n      the Euler-Maruyama method. Must broadcast with the shape of\n      `state_parts`.  Larger step sizes lead to faster progress, but\n      too-large step sizes make rejection exponentially more likely. When\n      possible, it's often helpful to match per-variable step sizes to the\n      standard deviations of the target distribution in each variable.\n    volatility_parts: Python `list` of `Tensor`s representing the value of\n      `volatility_fn(*state_parts)`. Must broadcast with the shape of\n      `state_parts`.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'mala_euler_method').\n\n  Returns:\n    proposed_state_parts: Tensor or Python list of `Tensor`s representing the\n      state(s) of the Markov chain(s) at each result step. Has same shape as\n      input `current_state_parts`.", "docstring_tokens": ["Applies", "one", "step", "of", "Euler", "-", "Maruyama", "method", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253576}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1493-L1516", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Attaches a CDROM to a server.", "language": "python", "parameters": "(self, datacenter_id, server_id, cdrom_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "'{ \"id\": \"'", "+", "arg_3", "+", "'\" }'", "arg_5", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/servers/%s/cdroms'", "%", "(", "arg_1", ",", "arg_2", ")", ",", "method", "=", "'POST'", ",", "arg_4", "=", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Attaches a CDROM to a server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      cdrom_id: The unique ID of the CDROM.\n        :type       cdrom_id: ``str``\n\n        \"\"\"\n        arg_4 = '{ \"id\": \"' + arg_3 + '\" }'\n\n        arg_5 = arg_0._perform_request(\n            url='/datacenters/%s/servers/%s/cdroms' % (\n                arg_1,\n                arg_2),\n            method='POST',\n            arg_4=arg_4)\n\n        return arg_5", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.attach_cdrom", "docstring": "Attaches a CDROM to a server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      cdrom_id: The unique ID of the CDROM.\n        :type       cdrom_id: ``str``", "docstring_tokens": ["Attaches", "a", "CDROM", "to", "a", "server", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 253577}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L160-L201", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Compute the minimal distance between each point on self and other.", "language": "python", "parameters": "(self, other, default=None)", "return_statement": "return [shapely.geometry.Point(point).distance(other)\n                for point in self.coords]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "import", "shapely", ".", "geometry", "from", ".", "kps", "import", "Keypoint", "if", "isinstance", "(", "arg_1", ",", "Keypoint", ")", ":", "arg_1", "=", "shapely", ".", "geometry", ".", "Point", "(", "(", "arg_1", ".", "x", ",", "arg_1", ".", "y", ")", ")", "elif", "isinstance", "(", "arg_1", ",", "LineString", ")", ":", "if", "len", "(", "arg_1", ".", "coords", ")", "==", "0", ":", "return", "arg_2", "elif", "len", "(", "arg_1", ".", "coords", ")", "==", "1", ":", "arg_1", "=", "shapely", ".", "geometry", ".", "Point", "(", "arg_1", ".", "coords", "[", "0", ",", ":", "]", ")", "else", ":", "arg_1", "=", "shapely", ".", "geometry", ".", "LineString", "(", "arg_1", ".", "coords", ")", "elif", "isinstance", "(", "arg_1", ",", "tuple", ")", ":", "assert", "len", "(", "arg_1", ")", "==", "2", "arg_1", "=", "shapely", ".", "geometry", ".", "Point", "(", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "(", "\"Expected Keypoint or LineString or tuple (x,y), \"", "+", "\"got type %s.\"", ")", "%", "(", "type", "(", "arg_1", ")", ",", ")", ")", "return", "[", "shapely", ".", "geometry", ".", "Point", "(", "arg_3", ")", ".", "distance", "(", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "coords", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Compute the minimal distance between each point on self and other.\n\n        Parameters\n        ----------\n        other : tuple of number \\\n                or imgaug.augmentables.kps.Keypoint \\\n                or imgaug.augmentables.LineString\n            Other object to which to compute the distances.\n\n        default\n            Value to return if `other` contains no points.\n\n        Returns\n        -------\n        list of float\n            Distances to `other` or `default` if not distance could be computed.\n\n        \"\"\"\n        import shapely.geometry\n        from .kps import Keypoint\n\n        if isinstance(arg_1, Keypoint):\n            arg_1 = shapely.geometry.Point((arg_1.x, arg_1.y))\n        elif isinstance(arg_1, LineString):\n            if len(arg_1.coords) == 0:\n                return arg_2\n            elif len(arg_1.coords) == 1:\n                arg_1 = shapely.geometry.Point(arg_1.coords[0, :])\n            else:\n                arg_1 = shapely.geometry.LineString(arg_1.coords)\n        elif isinstance(arg_1, tuple):\n            assert len(arg_1) == 2\n            arg_1 = shapely.geometry.Point(arg_1)\n        else:\n            raise ValueError(\n                (\"Expected Keypoint or LineString or tuple (x,y), \"\n                 + \"got type %s.\") % (type(arg_1),))\n\n        return [shapely.geometry.Point(arg_3).distance(arg_1)\n                for arg_3 in arg_0.coords]", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.compute_pointwise_distances", "docstring": "Compute the minimal distance between each point on self and other.\n\n        Parameters\n        ----------\n        other : tuple of number \\\n                or imgaug.augmentables.kps.Keypoint \\\n                or imgaug.augmentables.LineString\n            Other object to which to compute the distances.\n\n        default\n            Value to return if `other` contains no points.\n\n        Returns\n        -------\n        list of float\n            Distances to `other` or `default` if not distance could be computed.", "docstring_tokens": ["Compute", "the", "minimal", "distance", "between", "each", "point", "on", "self", "and", "other", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 253578}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/views.py#L387-L402", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Build a clinVar submission form for a variant.", "language": "python", "parameters": "(institute_id, case_name, variant_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "controllers", ".", "Func_export", "(", "store", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "if", "request", ".", "method", "==", "'GET'", ":", "return", "arg_3", "else", ":", "arg_4", "=", "request", ".", "form", ".", "to_dict", "(", ")", "arg_5", "=", "set_submission_objects", "(", "arg_4", ")", "arg_6", "=", "store", ".", "get_open_Func_submission", "(", "current_user", ".", "email", ",", "arg_0", ")", "arg_7", "=", "store", ".", "add_to_submission", "(", "arg_6", "[", "'_id'", "]", ",", "arg_5", ")", "return", "redirect", "(", "url_for", "(", "'cases.Func_submissions'", ",", "arg_0", "=", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Build a clinVar submission form for a variant.\"\"\"\n    arg_3 = controllers.Func_export(store, arg_0, arg_1, arg_2)\n    if request.method == 'GET':\n        return arg_3\n    else: #POST\n        arg_4 = request.form.to_dict()\n        arg_5 = set_submission_objects(arg_4) # A tuple of submission objects (variants and casedata objects)\n\n        # Add submission data to an open Func submission object,\n        # or create a new if no open submission is found in database\n        arg_6 = store.get_open_Func_submission(current_user.email, arg_0)\n        arg_7 = store.add_to_submission(arg_6['_id'], arg_5)\n\n        # Redirect to Func submissions handling page, and pass it the updated_submission_object\n        return redirect(url_for('cases.Func_submissions', arg_0=arg_0))", "path": "scout/server/blueprints/variants/views.py", "identifier": "clinvar", "docstring": "Build a clinVar submission form for a variant.", "docstring_tokens": ["Build", "a", "clinVar", "submission", "form", "for", "a", "variant", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253579}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/BpmnParser.py#L119-L128", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Add all filenames in the given list to the parser's set.", "language": "python", "parameters": "(self, filenames)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "open", "(", "arg_2", ",", "'r'", ")", "try", ":", "arg_0", ".", "add_bpmn_xml", "(", "ET", ".", "parse", "(", "arg_3", ")", ",", "arg_2", "=", "arg_2", ")", "finally", ":", "arg_3", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add all filenames in the given list to the parser's set.\n        \"\"\"\n        for arg_2 in arg_1:\n            arg_3 = open(arg_2, 'r')\n            try:\n                arg_0.add_bpmn_xml(ET.parse(arg_3), arg_2=arg_2)\n            finally:\n                arg_3.close()", "path": "SpiffWorkflow/bpmn/parser/BpmnParser.py", "identifier": "BpmnParser.add_bpmn_files", "docstring": "Add all filenames in the given list to the parser's set.", "docstring_tokens": ["Add", "all", "filenames", "in", "the", "given", "list", "to", "the", "parser", "s", "set", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 253580}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/phabricator.py#L575-L607", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Call a method.", "language": "python", "parameters": "(self, method, params)", "return_statement": "return r.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "URL", "%", "{", "'base'", ":", "arg_0", ".", "base_url", ",", "'method'", ":", "arg_1", "}", "arg_2", "[", "'__conduit__'", "]", "=", "{", "'token'", ":", "arg_0", ".", "api_token", "}", "arg_4", "=", "{", "'params'", ":", "json", ".", "dumps", "(", "arg_2", ",", "sort_keys", "=", "True", ")", ",", "'output'", ":", "'json'", ",", "'__conduit__'", ":", "True", "}", "logger", ".", "debug", "(", "\"Phabricator Conduit client requests: %s params: %s\"", ",", "arg_1", ",", "str", "(", "arg_4", ")", ")", "arg_5", "=", "arg_0", ".", "fetch", "(", "arg_3", ",", "payload", "=", "arg_4", ",", "arg_1", "=", "HttpClient", ".", "POST", ",", "verify", "=", "False", ")", "arg_6", "=", "arg_5", ".", "json", "(", ")", "if", "arg_6", "[", "'error_code'", "]", ":", "raise", "ConduitError", "(", "error", "=", "arg_6", "[", "'error_info'", "]", ",", "code", "=", "arg_6", "[", "'error_code'", "]", ")", "return", "arg_5", ".", "text"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Call a method.\n\n        :param method: method to call\n        :param params: dict with the HTTP parameters needed to call\n            the given method\n\n        :raises ConduitError: when an error is returned by the server\n        \"\"\"\n        arg_3 = arg_0.URL % {'base': arg_0.base_url, 'method': arg_1}\n\n        # Conduit and POST parameters\n        arg_2['__conduit__'] = {'token': arg_0.api_token}\n\n        arg_4 = {\n            'params': json.dumps(arg_2, sort_keys=True),\n            'output': 'json',\n            '__conduit__': True\n        }\n\n        logger.debug(\"Phabricator Conduit client requests: %s params: %s\",\n                     arg_1, str(arg_4))\n\n        arg_5 = arg_0.fetch(arg_3, payload=arg_4, arg_1=HttpClient.POST, verify=False)\n\n        # Check for possible Conduit API errors\n        arg_6 = arg_5.json()\n\n        if arg_6['error_code']:\n            raise ConduitError(error=arg_6['error_info'],\n                               code=arg_6['error_code'])\n\n        return arg_5.text", "path": "perceval/backends/core/phabricator.py", "identifier": "ConduitClient._call", "docstring": "Call a method.\n\n        :param method: method to call\n        :param params: dict with the HTTP parameters needed to call\n            the given method\n\n        :raises ConduitError: when an error is returned by the server", "docstring_tokens": ["Call", "a", "method", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253581}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L241-L374", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Get IDs or data for studies that meet specific criteria.", "language": "python", "parameters": "(self, features=None, expression=None, mask=None,\n                    peaks=None, frequency_threshold=0.001,\n                    activation_threshold=0.0, func=np.sum, return_type='ids',\n                    r=6\n                    )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "0.001", ",", "arg_6", "=", "0.0", ",", "arg_7", "=", "arg_8", ".", "sum", ",", "arg_10", "=", "'ids'", ",", "arg_11", "=", "6", ")", ":", "arg_12", "=", "[", "]", "if", "arg_1", "is", "not", "None", ":", "if", "arg_10", "==", "'weights'", ":", "if", "arg_2", "is", "not", "None", "or", "arg_3", "is", "not", "None", "or", "arg_4", "is", "not", "None", ":", "raise", "ValueError", "(", "\"return_type cannot be 'weights' when feature-based \"", "\"search is used in conjunction with other search \"", "\"modes.\"", ")", "return", "arg_0", ".", "feature_table", ".", "get_ids", "(", "arg_1", ",", "arg_5", ",", "arg_7", ",", "get_weights", "=", "True", ")", "else", ":", "arg_12", ".", "append", "(", "arg_0", ".", "feature_table", ".", "get_ids", "(", "arg_1", ",", "arg_5", ",", "arg_7", ")", ")", "if", "arg_2", "is", "not", "None", ":", "arg_13", "=", "arg_0", ".", "feature_table", ".", "get_ids_by_expression", "(", "arg_2", ",", "arg_5", ",", "arg_7", ")", "arg_12", ".", "append", "(", "list", "(", "arg_13", ")", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "=", "arg_0", ".", "masker", ".", "mask", "(", "arg_3", ",", "in_global_mask", "=", "True", ")", ".", "astype", "(", "bool", ")", "arg_14", "=", "arg_8", ".", "sum", "(", "arg_3", ")", "arg_15", "=", "arg_0", ".", "image_table", ".", "data", ".", "T", ".", "dot", "(", "arg_3", ")", ".", "astype", "(", "float", ")", "if", "isinstance", "(", "arg_6", ",", "float", ")", ":", "arg_15", "/=", "arg_14", "arg_16", "=", "arg_8", ".", "where", "(", "arg_15", ">", "arg_6", ")", "[", "0", "]", "arg_12", ".", "append", "(", "[", "arg_0", ".", "image_table", ".", "ids", "[", "arg_17", "]", "for", "arg_17", "in", "arg_16", "]", ")", "if", "arg_4", "is", "not", "None", ":", "arg_11", "=", "float", "(", "arg_11", ")", "arg_18", "=", "set", "(", ")", "for", "arg_19", "in", "arg_4", ":", "arg_20", "=", "arg_8", ".", "array", "(", "arg_19", ",", "dtype", "=", "float", ")", "arg_21", "=", "arg_0", ".", "activations", "[", "'x'", "]", "arg_22", "=", "arg_0", ".", "activations", "[", "'y'", "]", "arg_23", "=", "arg_0", ".", "activations", "[", "'z'", "]", "arg_24", "=", "arg_8", ".", "sqrt", "(", "arg_8", ".", "square", "(", "arg_21", "-", "arg_20", "[", "0", "]", ")", "+", "arg_8", ".", "square", "(", "arg_22", "-", "arg_20", "[", "1", "]", ")", "+", "arg_8", ".", "square", "(", "arg_23", "-", "arg_20", "[", "2", "]", ")", ")", "arg_25", "=", "arg_8", ".", "where", "(", "(", "arg_24", ">", "5.5", ")", "&", "(", "arg_24", "<", "6.5", ")", ")", "[", "0", "]", "arg_26", "=", "arg_24", "[", "arg_25", "]", "arg_18", "|=", "set", "(", "arg_0", ".", "activations", "[", "arg_24", "<=", "arg_11", "]", "[", "'id'", "]", ".", "unique", "(", ")", ")", "arg_12", ".", "append", "(", "arg_18", ")", "arg_27", "=", "list", "(", "reduce", "(", "lambda", "arg_21", ",", "arg_22", ":", "set", "(", "arg_21", ")", "&", "set", "(", "arg_22", ")", ",", "arg_12", ")", ")", "if", "arg_10", "==", "'ids'", ":", "return", "arg_27", "elif", "arg_10", "==", "'data'", ":", "return", "arg_0", ".", "get_image_data", "(", "arg_27", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n                    arg_4=None, arg_5=0.001,\n                    arg_6=0.0, arg_7=arg_8.sum, arg_10='ids',\n                    arg_11=6\n                    ):\n        \"\"\" Get IDs or data for studies that meet specific criteria.\n\n        If multiple criteria are passed, the set intersection is returned. For\n        example, passing expression='emotion' and mask='my_mask.nii.gz' would\n        return only those studies that are associated with emotion AND report\n        activation within the voxels indicated in the passed image.\n\n        Args:\n            ids (list): A list of IDs of studies to retrieve.\n            features (list or str): The name of a feature, or a list of\n                features, to use for selecting studies.\n            expression (str): A string expression to pass to the PEG for study\n                retrieval.\n            mask: the mask image (see Masker documentation for valid data\n                types).\n            peaks (ndarray or list): Either an n x 3 numpy array, or a list of\n                lists or tuples (e.g., [(-10, 22, 14)]) specifying the world\n                (x/y/z) coordinates of the target location(s).\n            frequency_threshold (float): For feature-based or expression-based\n                selection, the threshold for selecting studies--i.e., the\n                cut-off for a study to be included. Must be a float in range\n                [0, 1].\n            activation_threshold (int or float): For mask-based selection,\n                threshold for a study to be included based on amount of\n                activation displayed. If an integer, represents the absolute\n                number of voxels that must be active within the mask in order\n                for a study to be selected. If a float, it represents the\n                proportion of voxels that must be active.\n            func (Callable): The function to use when aggregating over the list\n                of features. See documentation in FeatureTable.get_ids() for a\n                full explanation. Only used for feature- or expression-based\n                selection.\n            return_type (str): A string specifying what data to return. Valid\n                options are:\n                'ids': returns a list of IDs of selected studies.\n                'images': returns a voxel x study matrix of data for all\n                selected studies.\n                'weights': returns a dict where the keys are study IDs and the\n                values are the computed weights. Only valid when performing\n                feature-based selection.\n            r (int): For peak-based selection, the distance cut-off (in mm)\n                for inclusion (i.e., only studies with one or more activations\n                within r mm of one of the passed foci will be returned).\n\n        Returns:\n            When return_type is 'ids' (default), returns a list of IDs of the\n            selected studies. When return_type is 'data', returns a 2D numpy\n            array, with voxels in rows and studies in columns. When return_type\n            is 'weights' (valid only for expression-based selection), returns\n            a dict, where the keys are study IDs, and the values are the\n            computed weights.\n\n        Examples\n        --------\n        Select all studies tagged with the feature 'emotion':\n\n            >>> ids = dataset.Func(features='emotion')\n\n        Select all studies that activate at least 20% of voxels in an amygdala\n        mask, and retrieve activation data rather than IDs:\n\n            >>> data = dataset.Func(mask='amygdala_mask.nii.gz',\n                threshold=0.2, return_type='images')\n\n        Select studies that report at least one activation within 12 mm of at\n        least one of three specific foci:\n\n            >>> ids = dataset.Func(peaks=[[12, -20, 30], [-26, 22, 22],\n                                                [0, 36, -20]], r=12)\n\n        \"\"\"\n        arg_12 = []\n\n        # Feature-based selection\n        if arg_1 is not None:\n            # Need to handle weights as a special case, because we can't\n            # retrieve the weights later using just the IDs.\n            if arg_10 == 'weights':\n                if arg_2 is not None or arg_3 is not None or \\\n                        arg_4 is not None:\n                    raise ValueError(\n                        \"return_type cannot be 'weights' when feature-based \"\n                        \"search is used in conjunction with other search \"\n                        \"modes.\")\n                return arg_0.feature_table.get_ids(\n                    arg_1, arg_5, arg_7, get_weights=True)\n            else:\n                arg_12.append(arg_0.feature_table.get_ids(\n                    arg_1, arg_5, arg_7))\n\n        # Logical expression-based selection\n        if arg_2 is not None:\n            arg_13 = arg_0.feature_table.get_ids_by_expression(\n                arg_2, arg_5, arg_7)\n            arg_12.append(list(arg_13))\n\n        # Mask-based selection\n        if arg_3 is not None:\n            arg_3 = arg_0.masker.mask(arg_3, in_global_mask=True).astype(bool)\n            arg_14 = arg_8.sum(arg_3)\n            arg_15 = arg_0.image_table.data.T.dot(arg_3).astype(float)\n            if isinstance(arg_6, float):\n                arg_15 /= arg_14\n            arg_16 = arg_8.where(arg_15 > arg_6)[0]\n            arg_12.append([arg_0.image_table.ids[arg_17] for arg_17 in arg_16])\n\n        # Peak-based selection\n        if arg_4 is not None:\n            arg_11 = float(arg_11)\n            arg_18 = set()\n            for arg_19 in arg_4:\n                arg_20 = arg_8.array(arg_19, dtype=float)\n                arg_21 = arg_0.activations['x']\n                arg_22 = arg_0.activations['y']\n                arg_23 = arg_0.activations['z']\n                arg_24 = arg_8.sqrt(arg_8.square(arg_21 - arg_20[0]) + arg_8.square(arg_22 - arg_20[1]) +\n                                arg_8.square(arg_23 - arg_20[2]))\n                arg_25 = arg_8.where((arg_24 > 5.5) & (arg_24 < 6.5))[0]\n                arg_26 = arg_24[arg_25]\n                arg_18 |= set(arg_0.activations[arg_24 <= arg_11]['id'].unique())\n            arg_12.append(arg_18)\n\n        # Get intersection of all sets\n        arg_27 = list(reduce(lambda arg_21, arg_22: set(arg_21) & set(arg_22), arg_12))\n\n        if arg_10 == 'ids':\n            return arg_27\n        elif arg_10 == 'data':\n            return arg_0.get_image_data(arg_27)", "path": "neurosynth/base/dataset.py", "identifier": "Dataset.get_studies", "docstring": "Get IDs or data for studies that meet specific criteria.\n\n        If multiple criteria are passed, the set intersection is returned. For\n        example, passing expression='emotion' and mask='my_mask.nii.gz' would\n        return only those studies that are associated with emotion AND report\n        activation within the voxels indicated in the passed image.\n\n        Args:\n            ids (list): A list of IDs of studies to retrieve.\n            features (list or str): The name of a feature, or a list of\n                features, to use for selecting studies.\n            expression (str): A string expression to pass to the PEG for study\n                retrieval.\n            mask: the mask image (see Masker documentation for valid data\n                types).\n            peaks (ndarray or list): Either an n x 3 numpy array, or a list of\n                lists or tuples (e.g., [(-10, 22, 14)]) specifying the world\n                (x/y/z) coordinates of the target location(s).\n            frequency_threshold (float): For feature-based or expression-based\n                selection, the threshold for selecting studies--i.e., the\n                cut-off for a study to be included. Must be a float in range\n                [0, 1].\n            activation_threshold (int or float): For mask-based selection,\n                threshold for a study to be included based on amount of\n                activation displayed. If an integer, represents the absolute\n                number of voxels that must be active within the mask in order\n                for a study to be selected. If a float, it represents the\n                proportion of voxels that must be active.\n            func (Callable): The function to use when aggregating over the list\n                of features. See documentation in FeatureTable.get_ids() for a\n                full explanation. Only used for feature- or expression-based\n                selection.\n            return_type (str): A string specifying what data to return. Valid\n                options are:\n                'ids': returns a list of IDs of selected studies.\n                'images': returns a voxel x study matrix of data for all\n                selected studies.\n                'weights': returns a dict where the keys are study IDs and the\n                values are the computed weights. Only valid when performing\n                feature-based selection.\n            r (int): For peak-based selection, the distance cut-off (in mm)\n                for inclusion (i.e., only studies with one or more activations\n                within r mm of one of the passed foci will be returned).\n\n        Returns:\n            When return_type is 'ids' (default), returns a list of IDs of the\n            selected studies. When return_type is 'data', returns a 2D numpy\n            array, with voxels in rows and studies in columns. When return_type\n            is 'weights' (valid only for expression-based selection), returns\n            a dict, where the keys are study IDs, and the values are the\n            computed weights.\n\n        Examples\n        --------\n        Select all studies tagged with the feature 'emotion':\n\n            >>> ids = dataset.get_studies(features='emotion')\n\n        Select all studies that activate at least 20% of voxels in an amygdala\n        mask, and retrieve activation data rather than IDs:\n\n            >>> data = dataset.get_studies(mask='amygdala_mask.nii.gz',\n                threshold=0.2, return_type='images')\n\n        Select studies that report at least one activation within 12 mm of at\n        least one of three specific foci:\n\n            >>> ids = dataset.get_studies(peaks=[[12, -20, 30], [-26, 22, 22],\n                                                [0, 36, -20]], r=12)", "docstring_tokens": ["Get", "IDs", "or", "data", "for", "studies", "that", "meet", "specific", "criteria", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 253582}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L163-L176", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Log 'msg % args' at level 'level' once per 'n' times.", "language": "python", "parameters": "(level, msg, n, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ")", ":", "arg_4", "=", "_GetNextLogCountPerToken", "(", "_GetFileAndLine", "(", ")", ")", "log_if", "(", "arg_0", ",", "arg_1", ",", "not", "(", "arg_4", "%", "arg_2", ")", ",", "*", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3):\n    \"\"\"Log 'msg % args' at level 'level' once per 'n' times.\n\n    Logs the 1st call, (N+1)st call, (2N+1)st call,  etc.\n    Not threadsafe.\n\n    Args:\n    level: The level at which to log.\n    msg: The message to be logged.\n    n: The number of times this should be called before it is logged.\n    *args: The args to be substituted into the msg.\n    \"\"\"\n    arg_4 = _GetNextLogCountPerToken(_GetFileAndLine())\n    log_if(arg_0, arg_1, not (arg_4 % arg_2), *arg_3)", "path": "tensorlayer/logging/tl_logging.py", "identifier": "log_every_n", "docstring": "Log 'msg % args' at level 'level' once per 'n' times.\n\n    Logs the 1st call, (N+1)st call, (2N+1)st call,  etc.\n    Not threadsafe.\n\n    Args:\n    level: The level at which to log.\n    msg: The message to be logged.\n    n: The number of times this should be called before it is logged.\n    *args: The args to be substituted into the msg.", "docstring_tokens": ["Log", "msg", "%", "args", "at", "level", "level", "once", "per", "n", "times", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253583}
{"url": "https://github.com/codelv/enaml-web/blob/88f1131a7b3ba9e83467b4f44bc3bab6f0de7559/web/core/block.py#L67-L78", "sha": "88f1131a7b3ba9e83467b4f44bc3bab6f0de7559", "docstring_summary": "If the mode changes. Refresh the items.", "language": "python", "parameters": "(self, change)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "block", "if", "arg_2", "and", "arg_0", ".", "is_initialized", "and", "arg_1", "[", "'type'", "]", "==", "'update'", ":", "if", "arg_1", "[", "'oldvalue'", "]", "==", "'replace'", ":", "raise", "NotImplementedError", "for", "arg_3", "in", "arg_0", ".", "children", ":", "arg_2", ".", "children", ".", "remove", "(", "arg_3", ")", "arg_3", ".", "set_parent", "(", "None", ")", "arg_0", ".", "refresh_items", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" If the mode changes. Refresh the items.\n        \n        \"\"\"\n        arg_2 = arg_0.block\n        if arg_2 and arg_0.is_initialized and arg_1['type'] == 'update':\n            if arg_1['oldvalue'] == 'replace':\n                raise NotImplementedError\n            for arg_3 in arg_0.children:\n                arg_2.children.remove(arg_3)\n                arg_3.set_parent(None)\n            arg_0.refresh_items()", "path": "web/core/block.py", "identifier": "Block._observe_mode", "docstring": "If the mode changes. Refresh the items.", "docstring_tokens": ["If", "the", "mode", "changes", ".", "Refresh", "the", "items", "."], "nwo": "codelv/enaml-web", "score": 0.5680722283335639, "idx": 253584}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L2461-L2536", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Initializes all components required to run a dag for a specified date range and\n        calls helper method to execute the tasks.", "language": "python", "parameters": "(self, session=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "BackfillJob", ".", "_DagRunTaskStatus", "(", ")", "arg_3", "=", "arg_0", ".", "bf_start_date", "arg_4", "=", "arg_0", ".", "dag", ".", "get_run_dates", "(", "arg_3", "=", "arg_3", ",", "end_date", "=", "arg_0", ".", "bf_end_date", ")", "if", "arg_0", ".", "run_backwards", ":", "arg_5", "=", "[", "t", ".", "task_id", "for", "t", "in", "arg_0", ".", "dag", ".", "task_dict", ".", "values", "(", ")", "if", "t", ".", "depends_on_past", "]", "if", "arg_5", ":", "raise", "AirflowException", "(", "'You cannot backfill backwards because one or more tasks depend_on_past: {}'", ".", "format", "(", "\",\"", ".", "join", "(", "arg_5", ")", ")", ")", "arg_4", "=", "arg_4", "[", ":", ":", "-", "1", "]", "if", "len", "(", "arg_4", ")", "==", "0", ":", "arg_0", ".", "log", ".", "info", "(", "\"No run dates were found for the given dates and dag interval.\"", ")", "return", "arg_6", "=", "None", "if", "not", "arg_0", ".", "donot_pickle", "and", "arg_0", ".", "executor", ".", "__class__", "not", "in", "(", "executors", ".", "LocalExecutor", ",", "executors", ".", "SequentialExecutor", ")", ":", "arg_7", "=", "DagPickle", "(", "arg_0", ".", "dag", ")", "arg_1", ".", "add", "(", "arg_7", ")", "arg_1", ".", "commit", "(", ")", "arg_6", "=", "arg_7", ".", "id", "arg_8", "=", "arg_0", ".", "executor", "arg_8", ".", "start", "(", ")", "arg_2", ".", "total_runs", "=", "len", "(", "arg_4", ")", "try", ":", "arg_10", "=", "arg_2", ".", "total_runs", "while", "arg_10", ">", "0", ":", "arg_11", "=", "[", "run_date", "for", "run_date", "in", "arg_4", "if", "run_date", "not", "in", "arg_2", ".", "executed_dag_run_dates", "]", "arg_0", ".", "Func_for_run_dates", "(", "arg_4", "=", "arg_11", ",", "arg_2", "=", "arg_2", ",", "arg_8", "=", "arg_8", ",", "arg_6", "=", "arg_6", ",", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")", "arg_10", "=", "(", "arg_2", ".", "total_runs", "-", "len", "(", "arg_2", ".", "executed_dag_run_dates", ")", ")", "arg_12", "=", "arg_0", ".", "_collect_errors", "(", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", "if", "arg_12", ":", "raise", "AirflowException", "(", "arg_12", ")", "if", "arg_10", ">", "0", ":", "arg_0", ".", "log", ".", "info", "(", "\"max_active_runs limit for dag %s has been reached \"", "\" - waiting for other dag runs to finish\"", ",", "arg_0", ".", "dag_id", ")", "time", ".", "sleep", "(", "arg_0", ".", "delay_on_limit_secs", ")", "except", "(", "KeyboardInterrupt", ",", "SystemExit", ")", ":", "arg_0", ".", "log", ".", "warning", "(", "\"Backfill terminated by user.\"", ")", "arg_0", ".", "_set_unfinished_dag_runs_to_failed", "(", "arg_2", ".", "active_runs", ")", "finally", ":", "arg_1", ".", "commit", "(", ")", "arg_8", ".", "end", "(", ")", "arg_0", ".", "log", ".", "info", "(", "\"Backfill done. Exiting.\"", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Initializes all components required to run a dag for a specified date range and\n        calls helper method to execute the tasks.\n        \"\"\"\n        arg_2 = BackfillJob._DagRunTaskStatus()\n\n        arg_3 = arg_0.bf_start_date\n\n        # Get intervals between the start/end dates, which will turn into dag runs\n        arg_4 = arg_0.dag.get_run_dates(arg_3=arg_3,\n                                           end_date=arg_0.bf_end_date)\n        if arg_0.run_backwards:\n            arg_5 = [t.task_id for t in arg_0.dag.task_dict.values() if t.depends_on_past]\n            if arg_5:\n                raise AirflowException(\n                    'You cannot backfill backwards because one or more tasks depend_on_past: {}'.format(\n                        \",\".join(arg_5)))\n            arg_4 = arg_4[::-1]\n\n        if len(arg_4) == 0:\n            arg_0.log.info(\"No run dates were found for the given dates and dag interval.\")\n            return\n\n        # picklin'\n        arg_6 = None\n        if not arg_0.donot_pickle and arg_0.executor.__class__ not in (\n                executors.LocalExecutor, executors.SequentialExecutor):\n            arg_7 = DagPickle(arg_0.dag)\n            arg_1.add(arg_7)\n            arg_1.commit()\n            arg_6 = arg_7.id\n\n        arg_8 = arg_0.executor\n        arg_8.start()\n\n        arg_2.total_runs = len(arg_4)  # total dag runs in backfill\n\n        try:\n            arg_10 = arg_2.total_runs\n            while arg_10 > 0:\n                arg_11 = [run_date for run_date in arg_4\n                                    if run_date not in arg_2.executed_dag_run_dates]\n\n                arg_0.Func_for_run_dates(arg_4=arg_11,\n                                            arg_2=arg_2,\n                                            arg_8=arg_8,\n                                            arg_6=arg_6,\n                                            arg_3=arg_3,\n                                            arg_1=arg_1)\n\n                arg_10 = (\n                    arg_2.total_runs - len(arg_2.executed_dag_run_dates)\n                )\n                arg_12 = arg_0._collect_errors(arg_2=arg_2, arg_1=arg_1)\n                if arg_12:\n                    raise AirflowException(arg_12)\n\n                if arg_10 > 0:\n                    arg_0.log.info(\n                        \"max_active_runs limit for dag %s has been reached \"\n                        \" - waiting for other dag runs to finish\",\n                        arg_0.dag_id\n                    )\n                    time.sleep(arg_0.delay_on_limit_secs)\n        except (KeyboardInterrupt, SystemExit):\n            arg_0.log.warning(\"Backfill terminated by user.\")\n\n            # TODO: we will need to terminate running task instances and set the\n            # state to failed.\n            arg_0._set_unfinished_dag_runs_to_failed(arg_2.active_runs)\n        finally:\n            arg_1.commit()\n            arg_8.end()\n\n        arg_0.log.info(\"Backfill done. Exiting.\")", "path": "airflow/jobs.py", "identifier": "BackfillJob._execute", "docstring": "Initializes all components required to run a dag for a specified date range and\n        calls helper method to execute the tasks.", "docstring_tokens": ["Initializes", "all", "components", "required", "to", "run", "a", "dag", "for", "a", "specified", "date", "range", "and", "calls", "helper", "method", "to", "execute", "the", "tasks", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253585}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/artist.py#L76-L101", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "loads all of the artists albums, depending on how many the artist has this may be a long operation.", "language": "python", "parameters": "(self, *, market='US')", "return_statement": "return albums", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", "=", "'US'", ")", "->", "List", "[", "Album", "]", ":", "from", ".", "album", "import", "Album", "arg_2", "=", "[", "]", "arg_3", "=", "0", "arg_4", "=", "await", "arg_0", ".", "total_albums", "(", "arg_1", "=", "arg_1", ")", "while", "len", "(", "arg_2", ")", "<", "arg_4", ":", "arg_5", "=", "await", "arg_0", ".", "__client", ".", "http", ".", "artist_albums", "(", "arg_0", ".", "id", ",", "limit", "=", "50", ",", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")", "arg_3", "+=", "50", "arg_2", "+=", "list", "(", "Album", "(", "arg_0", ".", "__client", ",", "arg_6", ")", "for", "arg_6", "in", "arg_5", "[", "'items'", "]", ")", "return", "arg_2"], "function": "async def Func(arg_0, *, arg_1='US') -> List[Album]:\n        \"\"\"loads all of the artists albums, depending on how many the artist has this may be a long operation.\n\n        Parameters\n        ----------\n        market : Optional[str]\n            An ISO 3166-1 alpha-2 country code.\n\n        Returns\n        -------\n        albums : List[Album]\n            The albums of the artist.\n        \"\"\"\n        from .album import Album\n\n        arg_2 = []\n        arg_3 = 0\n        arg_4 = await arg_0.total_albums(arg_1=arg_1)\n\n        while len(arg_2) < arg_4:\n            arg_5 = await arg_0.__client.http.artist_albums(arg_0.id, limit=50, arg_3=arg_3, arg_1=arg_1)\n\n            arg_3 += 50\n            arg_2 += list(Album(arg_0.__client, arg_6) for arg_6 in arg_5['items'])\n\n        return arg_2", "path": "spotify/models/artist.py", "identifier": "Artist.get_all_albums", "docstring": "loads all of the artists albums, depending on how many the artist has this may be a long operation.\n\n        Parameters\n        ----------\n        market : Optional[str]\n            An ISO 3166-1 alpha-2 country code.\n\n        Returns\n        -------\n        albums : List[Album]\n            The albums of the artist.", "docstring_tokens": ["loads", "all", "of", "the", "artists", "albums", "depending", "on", "how", "many", "the", "artist", "has", "this", "may", "be", "a", "long", "operation", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 253586}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/tcpclient.py#L84-L100", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Read one message unit. It's possible however that\n        more than one message will be set in a receive, so we will\n        have to buffer that for the next read.\n        EOFError will be raised on EOF.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "state", "==", "'connected'", ":", "if", "0", "==", "len", "(", "arg_0", ".", "buf", ")", ":", "arg_0", ".", "buf", "=", "arg_0", ".", "inout", ".", "recv", "(", "Mtcpfns", ".", "TCP_MAX_PACKET", ")", "if", "0", "==", "(", "arg_0", ".", "buf", ")", ":", "arg_0", ".", "state", "=", "'disconnected'", "raise", "EOFError", "pass", "arg_0", ".", "buf", ",", "arg_3", "=", "Mtcpfns", ".", "unpack_msg", "(", "arg_0", ".", "buf", ")", "return", "arg_3", ".", "decode", "(", "'utf-8'", ")", "else", ":", "raise", "IOError", "(", "\"Func called in state: %s.\"", "%", "arg_0", ".", "state", ")"], "function": "def Func(arg_0):\n        \"\"\"Read one message unit. It's possible however that\n        more than one message will be set in a receive, so we will\n        have to buffer that for the next read.\n        EOFError will be raised on EOF.\n        \"\"\"\n        if arg_0.state == 'connected':\n            if 0 == len(arg_0.buf):\n                arg_0.buf = arg_0.inout.recv(Mtcpfns.TCP_MAX_PACKET)\n                if 0 == (arg_0.buf):\n                    arg_0.state = 'disconnected'\n                    raise EOFError\n                pass\n            arg_0.buf, arg_3 = Mtcpfns.unpack_msg(arg_0.buf)\n            return arg_3.decode('utf-8')\n        else:\n            raise IOError(\"Func called in state: %s.\" % arg_0.state)", "path": "trepan/inout/tcpclient.py", "identifier": "TCPClient.read_msg", "docstring": "Read one message unit. It's possible however that\n        more than one message will be set in a receive, so we will\n        have to buffer that for the next read.\n        EOFError will be raised on EOF.", "docstring_tokens": ["Read", "one", "message", "unit", ".", "It", "s", "possible", "however", "that", "more", "than", "one", "message", "will", "be", "set", "in", "a", "receive", "so", "we", "will", "have", "to", "buffer", "that", "for", "the", "next", "read", ".", "EOFError", "will", "be", "raised", "on", "EOF", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 253587}
{"url": "https://github.com/CIRCL/IP-ASN-history/blob/2e02ced01a08531a007d9cd71547c8248570de1b/client/ipasn_redis/api.py#L91-L117", "sha": "2e02ced01a08531a007d9cd71547c8248570de1b", "docstring_summary": "Get the ASN and the IP Block announcing the IP at a specific date.", "language": "python", "parameters": "(self, ip, announce_date=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", ",", "arg_2", ",", "arg_4", "=", "arg_0", ".", "run", "(", "arg_1", ",", "arg_2", ")", "arg_5", "=", "next", "(", "(", "i", "for", "i", ",", "j", "in", "enumerate", "(", "arg_3", ")", "if", "j", "is", "not", "None", ")", ",", "None", ")", "if", "arg_5", "is", "not", "None", ":", "arg_6", "=", "arg_4", "[", "arg_5", "]", "if", "arg_6", "!=", "'0.0.0.0/0'", ":", "return", "arg_2", ",", "arg_3", "[", "arg_5", "]", ",", "arg_6", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n            Get the ASN and the IP Block announcing the IP at a specific date.\n\n            :param ip: IP address to search for\n            :param announce_date: Date of the announcement\n\n            :rtype: tuple\n\n                .. code-block:: python\n\n                    (announce_date, asn, block)\n\n            .. note::\n\n                the returned announce_date might be different of the one\n                given in parameter because some raw files are missing and we\n                don't have the information. In this case, the nearest known\n                date will be chosen,\n        \"\"\"\n        arg_3, arg_2, arg_4 = arg_0.run(arg_1, arg_2)\n        arg_5 = next((i for i, j in enumerate(arg_3) if j is not None), None)\n        if arg_5 is not None:\n            arg_6 = arg_4[arg_5]\n            if arg_6 != '0.0.0.0/0':\n                return arg_2, arg_3[arg_5], arg_6\n        return None", "path": "client/ipasn_redis/api.py", "identifier": "IPASN.date_asn_block", "docstring": "Get the ASN and the IP Block announcing the IP at a specific date.\n\n            :param ip: IP address to search for\n            :param announce_date: Date of the announcement\n\n            :rtype: tuple\n\n                .. code-block:: python\n\n                    (announce_date, asn, block)\n\n            .. note::\n\n                the returned announce_date might be different of the one\n                given in parameter because some raw files are missing and we\n                don't have the information. In this case, the nearest known\n                date will be chosen,", "docstring_tokens": ["Get", "the", "ASN", "and", "the", "IP", "Block", "announcing", "the", "IP", "at", "a", "specific", "date", "."], "nwo": "CIRCL/IP-ASN-history", "score": 0.5613988127652619, "idx": 253588}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L284-L297", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Convert a message in CaseInsensitiveDict to dict.", "language": "python", "parameters": "(self, message)", "return_statement": "return msg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "pop", "(", "arg_0", ".", "MESSAGE_ID_FIELD", ")", "arg_3", "=", "arg_1", ".", "pop", "(", "arg_0", ".", "DATE_FIELD", ")", "arg_4", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "arg_1", ".", "items", "(", ")", "}", "arg_4", "[", "arg_0", ".", "MESSAGE_ID_FIELD", "]", "=", "arg_2", "arg_4", "[", "arg_0", ".", "DATE_FIELD", "]", "=", "arg_3", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert a message in CaseInsensitiveDict to dict.\n\n        This method also converts well known problematic headers,\n        such as Message-ID and Date to a common name.\n        \"\"\"\n        arg_2 = arg_1.pop(arg_0.MESSAGE_ID_FIELD)\n        arg_3 = arg_1.pop(arg_0.DATE_FIELD)\n\n        arg_4 = {k: v for k, v in arg_1.items()}\n        arg_4[arg_0.MESSAGE_ID_FIELD] = arg_2\n        arg_4[arg_0.DATE_FIELD] = arg_3\n\n        return arg_4", "path": "perceval/backends/core/mbox.py", "identifier": "MBox._casedict_to_dict", "docstring": "Convert a message in CaseInsensitiveDict to dict.\n\n        This method also converts well known problematic headers,\n        such as Message-ID and Date to a common name.", "docstring_tokens": ["Convert", "a", "message", "in", "CaseInsensitiveDict", "to", "dict", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253589}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/views/rest.py#L66-L187", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Create Invenio-Deposit-REST blueprint.", "language": "python", "parameters": "(endpoints)", "return_statement": "return blueprint", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Blueprint", "(", "'invenio_deposit_rest'", ",", "__name__", ",", "url_prefix", "=", "''", ",", ")", "create_error_handlers", "(", "arg_1", ")", "for", "arg_2", ",", "arg_3", "in", "(", "arg_0", "or", "{", "}", ")", ".", "items", "(", ")", ":", "arg_3", "=", "deepcopy", "(", "arg_3", ")", "if", "'files_serializers'", "in", "arg_3", ":", "arg_4", "=", "arg_3", ".", "get", "(", "'files_serializers'", ")", "arg_4", "=", "{", "mime", ":", "obj_or_import_string", "(", "func", ")", "for", "mime", ",", "func", "in", "arg_4", ".", "items", "(", ")", "}", "del", "arg_3", "[", "'files_serializers'", "]", "else", ":", "arg_4", "=", "{", "}", "if", "'record_serializers'", "in", "arg_3", ":", "arg_5", "=", "arg_3", ".", "get", "(", "'record_serializers'", ")", "arg_5", "=", "{", "mime", ":", "obj_or_import_string", "(", "func", ")", "for", "mime", ",", "func", "in", "arg_5", ".", "items", "(", ")", "}", "else", ":", "arg_5", "=", "{", "}", "arg_6", "=", "arg_3", ".", "pop", "(", "'file_list_route'", ",", "'{0}/files'", ".", "format", "(", "arg_3", "[", "'item_route'", "]", ")", ")", "arg_7", "=", "arg_3", ".", "pop", "(", "'file_item_route'", ",", "'{0}/files/<path:key>'", ".", "format", "(", "arg_3", "[", "'item_route'", "]", ")", ")", "arg_3", ".", "setdefault", "(", "'search_class'", ",", "DepositSearch", ")", "arg_8", "=", "obj_or_import_string", "(", "arg_3", "[", "'search_class'", "]", ")", "arg_3", ".", "setdefault", "(", "'record_class'", ",", "Deposit", ")", "arg_9", "=", "obj_or_import_string", "(", "arg_3", "[", "'record_class'", "]", ")", "arg_3", ".", "setdefault", "(", "'indexer_class'", ",", "None", ")", "for", "arg_10", "in", "records_rest_url_rules", "(", "arg_2", ",", "**", "arg_3", ")", ":", "arg_1", ".", "add_url_rule", "(", "**", "arg_10", ")", "arg_11", "=", "{", "}", "if", "arg_3", ".", "get", "(", "'search_index'", ")", ":", "arg_11", "[", "'index'", "]", "=", "arg_3", "[", "'search_index'", "]", "if", "arg_3", ".", "get", "(", "'search_type'", ")", ":", "arg_11", "[", "'doc_type'", "]", "=", "arg_3", "[", "'search_type'", "]", "arg_12", "=", "dict", "(", "read_permission_factory", "=", "obj_or_import_string", "(", "arg_3", ".", "get", "(", "'read_permission_factory_imp'", ")", ")", ",", "create_permission_factory", "=", "obj_or_import_string", "(", "arg_3", ".", "get", "(", "'create_permission_factory_imp'", ")", ")", ",", "update_permission_factory", "=", "obj_or_import_string", "(", "arg_3", ".", "get", "(", "'update_permission_factory_imp'", ")", ")", ",", "delete_permission_factory", "=", "obj_or_import_string", "(", "arg_3", ".", "get", "(", "'delete_permission_factory_imp'", ")", ")", ",", "arg_9", "=", "arg_9", ",", "arg_8", "=", "partial", "(", "arg_8", ",", "**", "arg_11", ")", ",", "default_media_type", "=", "arg_3", ".", "get", "(", "'default_media_type'", ")", ",", ")", "arg_13", "=", "DepositActionResource", ".", "as_view", "(", "DepositActionResource", ".", "view_name", ".", "format", "(", "arg_2", ")", ",", "arg_5", "=", "arg_5", ",", "pid_type", "=", "arg_3", "[", "'pid_type'", "]", ",", "arg_12", "=", "arg_12", ",", ")", "arg_1", ".", "add_url_rule", "(", "'{0}/actions/<any({1}):action>'", ".", "format", "(", "arg_3", "[", "'item_route'", "]", ",", "','", ".", "join", "(", "extract_actions_from_class", "(", "arg_9", ")", ")", ",", ")", ",", "view_func", "=", "arg_13", ",", "methods", "=", "[", "'POST'", "]", ",", ")", "arg_14", "=", "DepositFilesResource", ".", "as_view", "(", "DepositFilesResource", ".", "view_name", ".", "format", "(", "arg_2", ")", ",", "arg_5", "=", "arg_4", ",", "pid_type", "=", "arg_3", "[", "'pid_type'", "]", ",", "arg_12", "=", "arg_12", ",", ")", "arg_1", ".", "add_url_rule", "(", "arg_6", ",", "view_func", "=", "arg_14", ",", "methods", "=", "[", "'GET'", ",", "'POST'", ",", "'PUT'", "]", ",", ")", "arg_15", "=", "DepositFileResource", ".", "as_view", "(", "DepositFileResource", ".", "view_name", ".", "format", "(", "arg_2", ")", ",", "arg_5", "=", "arg_4", ",", "pid_type", "=", "arg_3", "[", "'pid_type'", "]", ",", "arg_12", "=", "arg_12", ",", ")", "arg_1", ".", "add_url_rule", "(", "arg_7", ",", "view_func", "=", "arg_15", ",", "methods", "=", "[", "'GET'", ",", "'PUT'", ",", "'DELETE'", "]", ",", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Create Invenio-Deposit-REST blueprint.\n\n    See: :data:`invenio_deposit.config.DEPOSIT_REST_ENDPOINTS`.\n\n    :param endpoints: List of endpoints configuration.\n    :returns: The configured blueprint.\n    \"\"\"\n    arg_1 = Blueprint(\n        'invenio_deposit_rest',\n        __name__,\n        url_prefix='',\n    )\n    create_error_handlers(arg_1)\n\n    for arg_2, arg_3 in (arg_0 or {}).items():\n        arg_3 = deepcopy(arg_3)\n\n        if 'files_serializers' in arg_3:\n            arg_4 = arg_3.get('files_serializers')\n            arg_4 = {mime: obj_or_import_string(func)\n                                 for mime, func in arg_4.items()}\n            del arg_3['files_serializers']\n        else:\n            arg_4 = {}\n\n        if 'record_serializers' in arg_3:\n            arg_5 = arg_3.get('record_serializers')\n            arg_5 = {mime: obj_or_import_string(func)\n                           for mime, func in arg_5.items()}\n        else:\n            arg_5 = {}\n\n        arg_6 = arg_3.pop(\n            'file_list_route',\n            '{0}/files'.format(arg_3['item_route'])\n        )\n        arg_7 = arg_3.pop(\n            'file_item_route',\n            '{0}/files/<path:key>'.format(arg_3['item_route'])\n        )\n\n        arg_3.setdefault('search_class', DepositSearch)\n        arg_8 = obj_or_import_string(arg_3['search_class'])\n\n        # records rest endpoints will use the deposit class as record class\n        arg_3.setdefault('record_class', Deposit)\n        arg_9 = obj_or_import_string(arg_3['record_class'])\n\n        # backward compatibility for indexer class\n        arg_3.setdefault('indexer_class', None)\n\n        for arg_10 in records_rest_url_rules(arg_2, **arg_3):\n            arg_1.add_url_rule(**arg_10)\n\n        arg_11 = {}\n        if arg_3.get('search_index'):\n            arg_11['index'] = arg_3['search_index']\n\n        if arg_3.get('search_type'):\n            arg_11['doc_type'] = arg_3['search_type']\n\n        arg_12 = dict(\n            read_permission_factory=obj_or_import_string(\n                arg_3.get('read_permission_factory_imp')\n            ),\n            create_permission_factory=obj_or_import_string(\n                arg_3.get('create_permission_factory_imp')\n            ),\n            update_permission_factory=obj_or_import_string(\n                arg_3.get('update_permission_factory_imp')\n            ),\n            delete_permission_factory=obj_or_import_string(\n                arg_3.get('delete_permission_factory_imp')\n            ),\n            arg_9=arg_9,\n            arg_8=partial(arg_8, **arg_11),\n            default_media_type=arg_3.get('default_media_type'),\n        )\n\n        arg_13 = DepositActionResource.as_view(\n            DepositActionResource.view_name.format(arg_2),\n            arg_5=arg_5,\n            pid_type=arg_3['pid_type'],\n            arg_12=arg_12,\n        )\n\n        arg_1.add_url_rule(\n            '{0}/actions/<any({1}):action>'.format(\n                arg_3['item_route'],\n                ','.join(extract_actions_from_class(arg_9)),\n            ),\n            view_func=arg_13,\n            methods=['POST'],\n        )\n\n        arg_14 = DepositFilesResource.as_view(\n            DepositFilesResource.view_name.format(arg_2),\n            arg_5=arg_4,\n            pid_type=arg_3['pid_type'],\n            arg_12=arg_12,\n        )\n\n        arg_1.add_url_rule(\n            arg_6,\n            view_func=arg_14,\n            methods=['GET', 'POST', 'PUT'],\n        )\n\n        arg_15 = DepositFileResource.as_view(\n            DepositFileResource.view_name.format(arg_2),\n            arg_5=arg_4,\n            pid_type=arg_3['pid_type'],\n            arg_12=arg_12,\n        )\n\n        arg_1.add_url_rule(\n            arg_7,\n            view_func=arg_15,\n            methods=['GET', 'PUT', 'DELETE'],\n        )\n    return arg_1", "path": "invenio_deposit/views/rest.py", "identifier": "create_blueprint", "docstring": "Create Invenio-Deposit-REST blueprint.\n\n    See: :data:`invenio_deposit.config.DEPOSIT_REST_ENDPOINTS`.\n\n    :param endpoints: List of endpoints configuration.\n    :returns: The configured blueprint.", "docstring_tokens": ["Create", "Invenio", "-", "Deposit", "-", "REST", "blueprint", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 253590}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py#L163-L174", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Create a StoreItem from a result out of CosmosDB.", "language": "python", "parameters": "(self, result)", "return_statement": "return StoreItem(**doc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", "->", "StoreItem", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'document'", ")", "arg_2", "[", "'e_tag'", "]", "=", "arg_1", ".", "get", "(", "'_etag'", ")", "return", "StoreItem", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1) -> StoreItem:\n        \"\"\"Create a StoreItem from a result out of CosmosDB.\n\n        :param result:\n        :return StoreItem:\n        \"\"\"\n        # get the document item from the result and turn into a dict\n        arg_2 = arg_1.get('document')\n        # readd the e_tag from Cosmos\n        arg_2['e_tag'] = arg_1.get('_etag')\n        # create and return the StoreItem\n        return StoreItem(**arg_2)", "path": "libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py", "identifier": "CosmosDbStorage.__create_si", "docstring": "Create a StoreItem from a result out of CosmosDB.\n\n        :param result:\n        :return StoreItem:", "docstring_tokens": ["Create", "a", "StoreItem", "from", "a", "result", "out", "of", "CosmosDB", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 253591}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/utils.py#L85-L103", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Flatten lists of indices and ensure bounded by a known dim.", "language": "python", "parameters": "(lst, dim)", "return_statement": "return lst.flatten()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "all", "(", "[", "arg_2", ".", "dtype", "==", "int", "for", "arg_2", "in", "arg_0", "]", ")", ":", "raise", "ValueError", "(", "\"indices must be integers\"", ")", "if", "npany", "(", "asarray", "(", "arg_0", ")", ">=", "arg_1", ")", ":", "raise", "ValueError", "(", "\"indices out of bounds for axis with size %s\"", "%", "arg_1", ")", "return", "arg_0", ".", "flatten", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Flatten lists of indices and ensure bounded by a known dim.\n\n    Parameters\n    ----------\n    lst : list\n        List of integer indices\n\n    dim : tuple\n        Bounds for indices\n    \"\"\"\n    if not all([arg_2.dtype == int for arg_2 in arg_0]):\n        raise ValueError(\"indices must be integers\")\n\n    if npany(asarray(arg_0) >= arg_1):\n        raise ValueError(\"indices out of bounds for axis with size %s\" % arg_1)\n\n    return arg_0.flatten()", "path": "bolt/utils.py", "identifier": "listify", "docstring": "Flatten lists of indices and ensure bounded by a known dim.\n\n    Parameters\n    ----------\n    lst : list\n        List of integer indices\n\n    dim : tuple\n        Bounds for indices", "docstring_tokens": ["Flatten", "lists", "of", "indices", "and", "ensure", "bounded", "by", "a", "known", "dim", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 253592}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/commands/extended/utils.py#L70-L145", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Given a set of transaction hashes, returns the corresponding bundles,\n    sorted by tail transaction timestamp.", "language": "python", "parameters": "(\n        adapter,\n        transaction_hashes,\n        inclusion_states,\n)", "return_statement": "return list(sorted(\n        my_bundles,\n        key=lambda bundle_: bundle_.tail_transaction.timestamp,\n    ))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", ")", ":", "arg_1", "=", "list", "(", "arg_1", ")", "if", "not", "arg_1", ":", "return", "[", "]", "arg_3", "=", "[", "]", "arg_4", "=", "set", "(", ")", "arg_5", "=", "set", "(", ")", "arg_6", "=", "GetTrytesCommand", "(", "arg_0", ")", "(", "hashes", "=", "arg_1", ")", "arg_7", "=", "list", "(", "map", "(", "Transaction", ".", "from_tryte_string", ",", "arg_6", "[", "'trytes'", "]", ",", ")", ")", "for", "arg_8", "in", "arg_7", ":", "if", "arg_8", ".", "is_tail", ":", "arg_4", ".", "add", "(", "arg_8", ".", "hash", ")", "else", ":", "arg_5", ".", "add", "(", "arg_8", ".", "bundle_hash", ")", "if", "arg_5", ":", "for", "arg_8", "in", "find_transaction_objects", "(", "arg_0", "=", "arg_0", ",", "bundles", "=", "list", "(", "arg_5", ")", ",", ")", ":", "if", "arg_8", ".", "is_tail", ":", "if", "arg_8", ".", "hash", "not", "in", "arg_4", ":", "arg_7", ".", "append", "(", "arg_8", ")", "arg_4", ".", "add", "(", "arg_8", ".", "hash", ")", "arg_9", "=", "[", "arg_8", "for", "arg_8", "in", "arg_7", "if", "arg_8", ".", "hash", "in", "arg_4", "]", "if", "arg_2", ":", "arg_10", "=", "GetLatestInclusionCommand", "(", "arg_0", ")", "(", "hashes", "=", "list", "(", "arg_4", ")", ",", ")", "for", "arg_8", "in", "arg_9", ":", "arg_8", ".", "is_confirmed", "=", "arg_10", "[", "'states'", "]", ".", "get", "(", "arg_8", ".", "hash", ")", "for", "arg_8", "in", "arg_9", ":", "arg_12", "=", "GetBundlesCommand", "(", "arg_0", ")", "(", "transaction", "=", "arg_8", ".", "hash", ")", "arg_13", "=", "arg_12", "[", "'bundles'", "]", "if", "arg_2", ":", "for", "arg_14", "in", "arg_13", ":", "arg_14", ".", "is_confirmed", "=", "arg_8", ".", "is_confirmed", "arg_3", ".", "extend", "(", "arg_13", ")", "return", "list", "(", "sorted", "(", "arg_3", ",", "key", "=", "lambda", "bundle_", ":", "bundle_", ".", "tail_transaction", ".", "timestamp", ",", ")", ")"], "function": "def Func(\n        arg_0,\n        arg_1,\n        arg_2,\n):\n    # type: (BaseAdapter, Iterable[TransactionHash], bool) -> List[Bundle]\n    \"\"\"\n    Given a set of transaction hashes, returns the corresponding bundles,\n    sorted by tail transaction timestamp.\n    \"\"\"\n    arg_1 = list(arg_1)\n    if not arg_1:\n        return []\n\n    arg_3 = []  # type: List[Bundle]\n\n    # Sort transactions into tail and non-tail.\n    arg_4 = set()\n    arg_5 = set()\n\n    arg_6 = GetTrytesCommand(arg_0)(hashes=arg_1)\n    arg_7 = list(map(\n        Transaction.from_tryte_string,\n        arg_6['trytes'],\n    ))  # type: List[Transaction]\n\n    for arg_8 in arg_7:\n        if arg_8.is_tail:\n            arg_4.add(arg_8.hash)\n        else:\n            # Capture the bundle ID instead of the transaction hash so\n            # that we can query the node to find the tail transaction\n            # for that bundle.\n            arg_5.add(arg_8.bundle_hash)\n\n    if arg_5:\n        for arg_8 in find_transaction_objects(\n                arg_0=arg_0,\n                bundles=list(arg_5),\n        ):\n            if arg_8.is_tail:\n                if arg_8.hash not in arg_4:\n                    arg_7.append(arg_8)\n                    arg_4.add(arg_8.hash)\n\n    # Filter out all non-tail transactions.\n    arg_9 = [\n        arg_8\n        for arg_8 in arg_7\n        if arg_8.hash in arg_4\n    ]\n\n    # Attach inclusion states, if requested.\n    if arg_2:\n        arg_10 = GetLatestInclusionCommand(arg_0)(\n            hashes=list(arg_4),\n        )\n\n        for arg_8 in arg_9:\n            arg_8.is_confirmed = arg_10['states'].get(arg_8.hash)\n\n    # Find the bundles for each transaction.\n    for arg_8 in arg_9:\n        arg_12 = GetBundlesCommand(arg_0)(transaction=arg_8.hash)\n        arg_13 = arg_12['bundles']  # type: List[Bundle]\n\n        if arg_2:\n            for arg_14 in arg_13:\n                arg_14.is_confirmed = arg_8.is_confirmed\n\n        arg_3.extend(arg_13)\n\n    return list(sorted(\n        arg_3,\n        key=lambda bundle_: bundle_.tail_transaction.timestamp,\n    ))", "path": "iota/commands/extended/utils.py", "identifier": "get_bundles_from_transaction_hashes", "docstring": "Given a set of transaction hashes, returns the corresponding bundles,\n    sorted by tail transaction timestamp.", "docstring_tokens": ["Given", "a", "set", "of", "transaction", "hashes", "returns", "the", "corresponding", "bundles", "sorted", "by", "tail", "transaction", "timestamp", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 253593}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/dockerhub.py#L191-L200", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch information about a repository.", "language": "python", "parameters": "(self, owner, repository)", "return_statement": "return response.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "Func", ")", ":", "arg_3", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "arg_0", ".", "RREPOSITORY", ",", "arg_1", ",", "Func", ")", "logger", ".", "debug", "(", "\"DockerHub client requests: %s\"", ",", "arg_3", ")", "arg_4", "=", "arg_0", ".", "fetch", "(", "arg_3", ")", "return", "arg_4", ".", "text"], "function": "def Func(arg_0, arg_1, Func):\n        \"\"\"Fetch information about a repository.\"\"\"\n\n        arg_3 = urijoin(arg_0.base_url, arg_0.RREPOSITORY, arg_1, Func)\n\n        logger.debug(\"DockerHub client requests: %s\", arg_3)\n\n        arg_4 = arg_0.fetch(arg_3)\n\n        return arg_4.text", "path": "perceval/backends/core/dockerhub.py", "identifier": "DockerHubClient.repository", "docstring": "Fetch information about a repository.", "docstring_tokens": ["Fetch", "information", "about", "a", "repository", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253594}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L517-L538", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Update metadata with the action history", "language": "python", "parameters": "(repo)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "package", "print", "(", "\"Including history of actions\"", ")", "with", "cd", "(", "arg_0", ".", "rootdir", ")", ":", "arg_2", "=", "\".dgit/log.json\"", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "arg_3", "=", "open", "(", "arg_2", ")", ".", "readlines", "(", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "try", ":", "arg_5", "=", "json", ".", "loads", "(", "arg_5", ")", "for", "arg_6", "in", "[", "'code'", "]", ":", "if", "arg_6", "not", "in", "arg_5", "or", "arg_5", "[", "arg_6", "]", "==", "None", ":", "arg_5", "[", "arg_6", "]", "=", "\"...\"", "arg_4", ".", "append", "(", "arg_5", ")", "except", ":", "pass", "arg_1", "[", "'actions'", "]", "=", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"\n    Update metadata with the action history \n    \"\"\"\n    arg_1 = arg_0.package    \n\n    print(\"Including history of actions\")\n    with cd(arg_0.rootdir): \n        arg_2 = \".dgit/log.json\"        \n        if os.path.exists(arg_2):             \n            arg_3 = open(arg_2).readlines() \n            arg_4 = []\n            for arg_5 in arg_3: \n                try: \n                    arg_5 = json.loads(arg_5)\n                    for arg_6 in ['code']: \n                        if arg_6 not in arg_5 or arg_5[arg_6] == None: \n                            arg_5[arg_6] = \"...\"\n                    arg_4.append(arg_5)\n                except:\n                    pass \n            arg_1['actions'] = arg_4", "path": "dgitcore/datasets/common.py", "identifier": "annotate_metadata_action", "docstring": "Update metadata with the action history", "docstring_tokens": ["Update", "metadata", "with", "the", "action", "history"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 253595}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_api_base_hook.py#L137-L146", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns an authorized HTTP object to be used to build a Google cloud\n        service hook connection.", "language": "python", "parameters": "(self)", "return_statement": "return authed_http", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_credentials", "(", ")", "arg_2", "=", "httplib2", ".", "Http", "(", ")", "arg_3", "=", "google_auth_httplib2", ".", "AuthorizedHttp", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns an authorized HTTP object to be used to build a Google cloud\n        service hook connection.\n        \"\"\"\n        arg_1 = arg_0._get_credentials()\n        arg_2 = httplib2.Http()\n        arg_3 = google_auth_httplib2.AuthorizedHttp(\n            arg_1, arg_2=arg_2)\n        return arg_3", "path": "airflow/contrib/hooks/gcp_api_base_hook.py", "identifier": "GoogleCloudBaseHook._authorize", "docstring": "Returns an authorized HTTP object to be used to build a Google cloud\n        service hook connection.", "docstring_tokens": ["Returns", "an", "authorized", "HTTP", "object", "to", "be", "used", "to", "build", "a", "Google", "cloud", "service", "hook", "connection", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253596}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/connection.py#L643-L656", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns a dictionary of arguments for DBUtils.SteadyDB.SteadyDBConnection\n  constructor.", "language": "python", "parameters": "()", "return_statement": "return dict(\n      creator = pymysql,\n      host = Configuration.get('nupic.cluster.database.host'),\n      port = int(Configuration.get('nupic.cluster.database.port')),\n      user = Configuration.get('nupic.cluster.database.user'),\n      passwd = Configuration.get('nupic.cluster.database.passwd'),\n      charset = 'utf8',\n      use_unicode = True,\n      setsession = ['SET AUTOCOMMIT = 1'])", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "return", "dict", "(", "creator", "=", "pymysql", ",", "host", "=", "Configuration", ".", "get", "(", "'nupic.cluster.database.host'", ")", ",", "port", "=", "int", "(", "Configuration", ".", "get", "(", "'nupic.cluster.database.port'", ")", ")", ",", "user", "=", "Configuration", ".", "get", "(", "'nupic.cluster.database.user'", ")", ",", "passwd", "=", "Configuration", ".", "get", "(", "'nupic.cluster.database.passwd'", ")", ",", "charset", "=", "'utf8'", ",", "use_unicode", "=", "True", ",", "setsession", "=", "[", "'SET AUTOCOMMIT = 1'", "]", ")"], "function": "def Func():\n  \"\"\" Returns a dictionary of arguments for DBUtils.SteadyDB.SteadyDBConnection\n  constructor.\n  \"\"\"\n\n  return dict(\n      creator = pymysql,\n      host = Configuration.get('nupic.cluster.database.host'),\n      port = int(Configuration.get('nupic.cluster.database.port')),\n      user = Configuration.get('nupic.cluster.database.user'),\n      passwd = Configuration.get('nupic.cluster.database.passwd'),\n      charset = 'utf8',\n      use_unicode = True,\n      setsession = ['SET AUTOCOMMIT = 1'])", "path": "src/nupic/database/connection.py", "identifier": "_getCommonSteadyDBArgsDict", "docstring": "Returns a dictionary of arguments for DBUtils.SteadyDB.SteadyDBConnection\n  constructor.", "docstring_tokens": ["Returns", "a", "dictionary", "of", "arguments", "for", "DBUtils", ".", "SteadyDB", ".", "SteadyDBConnection", "constructor", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253597}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/jira.py#L221-L234", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a JIRA API raw response.", "language": "python", "parameters": "(raw_page)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_0", ")", "arg_2", "=", "arg_1", "[", "'issues'", "]", "for", "arg_3", "in", "arg_2", ":", "yield", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Parse a JIRA API raw response.\n\n        The method parses the API response retrieving the\n        issues from the received items\n\n        :param items: items from where to parse the issues\n\n        :returns: a generator of issues\n        \"\"\"\n        arg_1 = json.loads(arg_0)\n        arg_2 = arg_1['issues']\n        for arg_3 in arg_2:\n            yield arg_3", "path": "perceval/backends/core/jira.py", "identifier": "Jira.parse_issues", "docstring": "Parse a JIRA API raw response.\n\n        The method parses the API response retrieving the\n        issues from the received items\n\n        :param items: items from where to parse the issues\n\n        :returns: a generator of issues", "docstring_tokens": ["Parse", "a", "JIRA", "API", "raw", "response", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253598}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L494-L528", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Import keys to the stash from either a list of keys or a file", "language": "python", "parameters": "(self, origin_passphrase, keys=None, key_file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "_assert_valid_stash", "(", ")", "if", "not", "(", "bool", "(", "arg_2", ")", "^", "bool", "(", "arg_3", ")", ")", ":", "raise", "GhostError", "(", "'You must either provide a path to an exported stash file '", "'or a list of key dicts to import'", ")", "if", "arg_3", ":", "with", "open", "(", "arg_3", ")", "as", "stash_file", ":", "arg_2", "=", "json", ".", "Funcs", "(", "stash_file", ".", "read", "(", ")", ")", "arg_4", "=", "arg_1", "!=", "arg_0", ".", "passphrase", "if", "arg_4", ":", "arg_5", "=", "Stash", "(", "TinyDBStorage", "(", "'stub'", ")", ",", "arg_1", ")", "for", "arg_6", "in", "arg_2", ":", "arg_0", ".", "put", "(", "name", "=", "arg_6", "[", "'name'", "]", ",", "value", "=", "arg_5", ".", "_decrypt", "(", "arg_6", "[", "'value'", "]", ")", "if", "arg_4", "else", "arg_6", "[", "'value'", "]", ",", "metadata", "=", "arg_6", "[", "'metadata'", "]", ",", "description", "=", "arg_6", "[", "'description'", "]", ",", "lock", "=", "arg_6", ".", "get", "(", "'lock'", ")", ",", "key_type", "=", "arg_6", ".", "get", "(", "'type'", ")", ",", "encrypt", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Import keys to the stash from either a list of keys or a file\n\n        `keys` is a list of dictionaries created by `self.export`\n        `stash_path` is a path to a file created by `self.export`\n        \"\"\"\n        # TODO: Handle keys not dict or key_file not json\n        arg_0._assert_valid_stash()\n\n        # Check if both or none are provided (ahh, the mighty xor)\n        if not (bool(arg_2) ^ bool(arg_3)):\n            raise GhostError(\n                'You must either provide a path to an exported stash file '\n                'or a list of key dicts to import')\n        if arg_3:\n            with open(arg_3) as stash_file:\n                arg_2 = json.Funcs(stash_file.read())\n\n        # If the passphrases are the same, there's no reason to decrypt\n        # and re-encrypt. We can simply pass the value.\n        arg_4 = arg_1 != arg_0.passphrase\n        if arg_4:\n            # TODO: The fact that we need to create a stub stash just to\n            # decrypt means we should probably have some encryptor class.\n            arg_5 = Stash(TinyDBStorage('stub'), arg_1)\n        # TODO: Handle existing keys when Funcing\n        for arg_6 in arg_2:\n            arg_0.put(\n                name=arg_6['name'],\n                value=arg_5._decrypt(arg_6['value']) if arg_4 else arg_6['value'],\n                metadata=arg_6['metadata'],\n                description=arg_6['description'],\n                lock=arg_6.get('lock'),\n                key_type=arg_6.get('type'),\n                encrypt=arg_4)", "path": "ghost.py", "identifier": "Stash.load", "docstring": "Import keys to the stash from either a list of keys or a file\n\n        `keys` is a list of dictionaries created by `self.export`\n        `stash_path` is a path to a file created by `self.export`", "docstring_tokens": ["Import", "keys", "to", "the", "stash", "from", "either", "a", "list", "of", "keys", "or", "a", "file"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 253599}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L108-L119", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Parses a query string into a dict.", "language": "python", "parameters": "(data, name=\"query string\", exception=PluginError, schema=None, **params)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"query string\"", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "arg_6", "=", "dict", "(", "parse_qsl", "(", "arg_0", ",", "**", "arg_5", ")", ")", "if", "arg_4", ":", "arg_6", "=", "arg_4", ".", "validate", "(", "arg_6", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1=\"query string\", arg_2=arg_3, arg_4=None, **arg_5):\n    \"\"\"Parses a query string into a dict.\n\n    Unlike parse_qs and parse_qsl, duplicate keys are not preserved in\n    favor of a simpler return value.\n    \"\"\"\n\n    arg_6 = dict(parse_qsl(arg_0, **arg_5))\n    if arg_4:\n        arg_6 = arg_4.validate(arg_6, arg_1=arg_1, arg_2=arg_2)\n\n    return arg_6", "path": "src/streamlink/utils/__init__.py", "identifier": "parse_qsd", "docstring": "Parses a query string into a dict.\n\n    Unlike parse_qs and parse_qsl, duplicate keys are not preserved in\n    favor of a simpler return value.", "docstring_tokens": ["Parses", "a", "query", "string", "into", "a", "dict", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 253600}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py#L38-L60", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reimplemented to the store history.", "language": "python", "parameters": "(self, source=None, hidden=False, interactive=False)", "return_statement": "return executed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "if", "not", "arg_2", ":", "arg_4", "=", "arg_0", ".", "input_buffer", "if", "arg_1", "is", "None", "else", "arg_1", "arg_5", "=", "super", "(", "HistoryConsoleWidget", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_5", "and", "not", "arg_2", ":", "arg_4", "=", "arg_4", ".", "rstrip", "(", ")", "if", "arg_4", "and", "(", "not", "arg_0", ".", "_history", "or", "arg_0", ".", "_history", "[", "-", "1", "]", "!=", "arg_4", ")", ":", "arg_0", ".", "_history", ".", "append", "(", "arg_4", ")", "arg_0", ".", "_history_edits", "=", "{", "}", "arg_0", ".", "_history_index", "=", "len", "(", "arg_0", ".", "_history", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=False):\n        \"\"\" Reimplemented to the store history.\n        \"\"\"\n        if not arg_2:\n            arg_4 = arg_0.input_buffer if arg_1 is None else arg_1\n\n        arg_5 = super(HistoryConsoleWidget, arg_0).Func(\n            arg_1, arg_2, arg_3)\n\n        if arg_5 and not arg_2:\n            # Save the command unless it was an empty string or was identical\n            # to the previous command.\n            arg_4 = arg_4.rstrip()\n            if arg_4 and (not arg_0._history or arg_0._history[-1] != arg_4):\n                arg_0._history.append(arg_4)\n\n            # Emulate readline: reset all history edits.\n            arg_0._history_edits = {}\n\n            # Move the history index to the most recent item.\n            arg_0._history_index = len(arg_0._history)\n\n        return arg_5", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py", "identifier": "HistoryConsoleWidget.execute", "docstring": "Reimplemented to the store history.", "docstring_tokens": ["Reimplemented", "to", "the", "store", "history", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253601}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/inversion/pixelizations.py#L238-L264", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Determine the geometry of the Voronoi pixelization, by alligning it with the outer-most coordinates on a \\\n        grid plus a small buffer.", "language": "python", "parameters": "(self, grid, pixel_centres, pixel_neighbors, pixel_neighbors_size, buffer=1e-8)", "return_statement": "return self.Geometry(shape_arcsec=shape_arcsec, pixel_centres=pixel_centres, origin=origin,\n                             pixel_neighbors=pixel_neighbors, pixel_neighbors_size=pixel_neighbors_size)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "1e-8", ")", ":", "arg_6", "=", "np", ".", "min", "(", "arg_1", "[", ":", ",", "0", "]", ")", "-", "arg_5", "arg_7", "=", "np", ".", "max", "(", "arg_1", "[", ":", ",", "0", "]", ")", "+", "arg_5", "arg_8", "=", "np", ".", "min", "(", "arg_1", "[", ":", ",", "1", "]", ")", "-", "arg_5", "arg_9", "=", "np", ".", "max", "(", "arg_1", "[", ":", ",", "1", "]", ")", "+", "arg_5", "arg_10", "=", "(", "arg_7", "-", "arg_6", ",", "arg_9", "-", "arg_8", ")", "arg_11", "=", "(", "(", "arg_7", "+", "arg_6", ")", "/", "2.0", ",", "(", "arg_9", "+", "arg_8", ")", "/", "2.0", ")", "return", "arg_0", ".", "Geometry", "(", "arg_10", "=", "arg_10", ",", "arg_2", "=", "arg_2", ",", "arg_11", "=", "arg_11", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=1e-8):\n        \"\"\"Determine the geometry of the Voronoi pixelization, by alligning it with the outer-most coordinates on a \\\n        grid plus a small buffer.\n\n        Parameters\n        -----------\n        grid : ndarray\n            The (y,x) grid of coordinates which determine the Voronoi pixelization's geometry.\n        pixel_centres : ndarray\n            The (y,x) centre of every Voronoi pixel in arc-seconds.\n        origin : (float, float)\n            The arc-second origin of the Voronoi pixelization's coordinate system.\n        pixel_neighbors : ndarray\n            An array of length (voronoi_pixels) which provides the index of all neighbors of every pixel in \\\n            the Voronoi grid (entries of -1 correspond to no neighbor).\n        pixel_neighbors_size : ndarrayy\n            An array of length (voronoi_pixels) which gives the number of neighbors of every pixel in the \\\n            Voronoi grid.\n        \"\"\"\n        arg_6 = np.min(arg_1[:, 0]) - arg_5\n        arg_7 = np.max(arg_1[:, 0]) + arg_5\n        arg_8 = np.min(arg_1[:, 1]) - arg_5\n        arg_9 = np.max(arg_1[:, 1]) + arg_5\n        arg_10 = (arg_7 - arg_6, arg_9 - arg_8)\n        arg_11 = ((arg_7 + arg_6) / 2.0, (arg_9 + arg_8) / 2.0)\n        return arg_0.Geometry(arg_10=arg_10, arg_2=arg_2, arg_11=arg_11,\n                             arg_3=arg_3, arg_4=arg_4)", "path": "autolens/model/inversion/pixelizations.py", "identifier": "Voronoi.geometry_from_grid", "docstring": "Determine the geometry of the Voronoi pixelization, by alligning it with the outer-most coordinates on a \\\n        grid plus a small buffer.\n\n        Parameters\n        -----------\n        grid : ndarray\n            The (y,x) grid of coordinates which determine the Voronoi pixelization's geometry.\n        pixel_centres : ndarray\n            The (y,x) centre of every Voronoi pixel in arc-seconds.\n        origin : (float, float)\n            The arc-second origin of the Voronoi pixelization's coordinate system.\n        pixel_neighbors : ndarray\n            An array of length (voronoi_pixels) which provides the index of all neighbors of every pixel in \\\n            the Voronoi grid (entries of -1 correspond to no neighbor).\n        pixel_neighbors_size : ndarrayy\n            An array of length (voronoi_pixels) which gives the number of neighbors of every pixel in the \\\n            Voronoi grid.", "docstring_tokens": ["Determine", "the", "geometry", "of", "the", "Voronoi", "pixelization", "by", "alligning", "it", "with", "the", "outer", "-", "most", "coordinates", "on", "a", "\\", "grid", "plus", "a", "small", "buffer", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 253602}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L1010-L1034", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Filter tags according due_tag option.", "language": "python", "parameters": "(self, all_tags)", "return_statement": "return filtered_tags", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_0", ".", "options", ".", "due_tag", "arg_4", "=", "[", "arg_8", "[", "\"name\"", "]", "for", "arg_8", "in", "arg_1", "]", "try", ":", "arg_5", "=", "arg_4", ".", "index", "(", "arg_3", ")", "except", "ValueError", ":", "arg_0", ".", "warn_if_tag_not_found", "(", "arg_3", ",", "\"due-tag\"", ")", "return", "copy", ".", "deepcopy", "(", "arg_1", ")", "arg_6", "=", "arg_1", "[", "arg_5", "]", "arg_7", "=", "arg_0", ".", "get_time_of_tag", "(", "arg_6", ")", "for", "arg_8", "in", "arg_1", ":", "arg_9", "=", "arg_0", ".", "get_time_of_tag", "(", "arg_8", ")", "if", "arg_9", "<=", "arg_7", ":", "arg_2", ".", "append", "(", "arg_8", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Filter tags according due_tag option.\n\n        :param list(dict) all_tags: Pre-filtered tags.\n        :rtype: list(dict)\n        :return: Filtered tags.\n        \"\"\"\n\n        arg_2 = []\n        arg_3 = arg_0.options.due_tag\n        arg_4 = [arg_8[\"name\"] for arg_8 in arg_1]\n        try:\n            arg_5 = arg_4.index(arg_3)\n        except ValueError:\n            arg_0.warn_if_tag_not_found(arg_3, \"due-tag\")\n            return copy.deepcopy(arg_1)\n\n        arg_6 = arg_1[arg_5]\n        arg_7 = arg_0.get_time_of_tag(arg_6)\n        for arg_8 in arg_1:\n            arg_9 = arg_0.get_time_of_tag(arg_8)\n            if arg_9 <= arg_7:\n                arg_2.append(arg_8)\n        return arg_2", "path": "pygcgen/generator.py", "identifier": "Generator.filter_due_tag", "docstring": "Filter tags according due_tag option.\n\n        :param list(dict) all_tags: Pre-filtered tags.\n        :rtype: list(dict)\n        :return: Filtered tags.", "docstring_tokens": ["Filter", "tags", "according", "due_tag", "option", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 253603}
{"url": "https://github.com/sublee/zeronimo/blob/b216638232932718d2cbc5eabd870c8f5b5e83fb/zeronimo/core.py#L454-L475", "sha": "b216638232932718d2cbc5eabd870c8f5b5e83fb", "docstring_summary": "Allocates a call id and emit.", "language": "python", "parameters": "(self, hints, name, args, kwargs, topics=(), raw=False,\n                   limit=None, retry=False, max_retries=None)", "return_statement": "return col.establish(call_id, self.timeout, limit,\n                             send_call if retry else None,\n                             max_retries=max_retries)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "(", ")", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ",", "arg_8", "=", "False", ",", "arg_9", "=", "None", ")", ":", "arg_10", "=", "arg_0", ".", "collector", "if", "not", "arg_10", ".", "is_running", "(", ")", ":", "arg_10", ".", "start", "(", ")", "arg_11", "=", "uuid4_bytes", "(", ")", "arg_12", "=", "(", "DUPLEX", "if", "arg_0", ".", "socket", "is", "arg_10", ".", "socket", "else", "arg_10", ".", "topic", ")", "arg_13", "=", "arg_0", ".", "_make_header", "(", "arg_2", ",", "arg_11", ",", "arg_12", ",", "arg_1", ")", "arg_14", "=", "arg_0", ".", "_pack", "(", "arg_3", ",", "arg_4", ",", "arg_6", ")", "def", "send_call", "(", ")", ":", "try", ":", "safe", "(", "send", ",", "arg_0", ".", "socket", ",", "arg_13", ",", "arg_14", ",", "arg_5", ",", "zmq", ".", "NOBLOCK", ")", "except", "zmq", ".", "Again", ":", "raise", "Undelivered", "(", "'emission was not delivered'", ")", "arg_10", ".", "prepare", "(", "arg_11", ",", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "send_call", "(", ")", "return", "arg_10", ".", "establish", "(", "arg_11", ",", "arg_0", ".", "timeout", ",", "arg_7", ",", "send_call", "if", "arg_8", "else", "None", ",", "arg_9", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=(), arg_6=False,\n                   arg_7=None, arg_8=False, arg_9=None):\n        \"\"\"Allocates a call id and emit.\"\"\"\n        arg_10 = arg_0.collector\n        if not arg_10.is_running():\n            arg_10.start()\n        arg_11 = uuid4_bytes()\n        arg_12 = (DUPLEX if arg_0.socket is arg_10.socket else arg_10.topic)\n        # Normal tuple is faster than namedtuple.\n        arg_13 = arg_0._make_header(arg_2, arg_11, arg_12, arg_1)\n        arg_14 = arg_0._pack(arg_3, arg_4, arg_6)\n        # Use short names.\n        def send_call():\n            try:\n                safe(send, arg_0.socket, arg_13, arg_14, arg_5, zmq.NOBLOCK)\n            except zmq.Again:\n                raise Undelivered('emission was not delivered')\n        arg_10.prepare(arg_11, arg_0, arg_2, arg_3, arg_4)\n        send_call()\n        return arg_10.establish(arg_11, arg_0.timeout, arg_7,\n                             send_call if arg_8 else None,\n                             arg_9=arg_9)", "path": "zeronimo/core.py", "identifier": "_Caller._call_wait", "docstring": "Allocates a call id and emit.", "docstring_tokens": ["Allocates", "a", "call", "id", "and", "emit", "."], "nwo": "sublee/zeronimo", "score": 0.08529914490135834, "idx": 253604}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_store.py#L192-L202", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Display help messages for the given message identifiers", "language": "python", "parameters": "(self, msgids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "try", ":", "for", "arg_3", "in", "arg_0", ".", "get_message_definitions", "(", "arg_2", ")", ":", "print", "(", "arg_3", ".", "format_help", "(", "checkerref", "=", "True", ")", ")", "print", "(", "\"\"", ")", "except", "UnknownMessageError", "as", "ex", ":", "print", "(", "ex", ")", "print", "(", "\"\"", ")", "continue"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Display help messages for the given message identifiers\"\"\"\n        for arg_2 in arg_1:\n            try:\n                for arg_3 in arg_0.get_message_definitions(arg_2):\n                    print(arg_3.format_help(checkerref=True))\n                    print(\"\")\n            except UnknownMessageError as ex:\n                print(ex)\n                print(\"\")\n                continue", "path": "pylint/message/message_store.py", "identifier": "MessagesStore.help_message", "docstring": "Display help messages for the given message identifiers", "docstring_tokens": ["Display", "help", "messages", "for", "the", "given", "message", "identifiers"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253605}
{"url": "https://github.com/seanpianka/Zipcodes/blob/c815226de7a12e659f3198a23de942e354c8a001/zipcodes/__init__.py#L87-L89", "sha": "c815226de7a12e659f3198a23de942e354c8a001", "docstring_summary": "Use `kwargs` to select for desired attributes from list of zipcode dicts", "language": "python", "parameters": "(zips=_zips, **kwargs)", "return_statement": "return [z for z in zips if all([k in z and z[k] == v for k, v in kwargs.items()])]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ",", "**", "arg_2", ")", ":", "return", "[", "arg_3", "for", "arg_3", "in", "arg_0", "if", "all", "(", "[", "arg_4", "in", "arg_3", "and", "arg_3", "[", "arg_4", "]", "==", "arg_5", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "items", "(", ")", "]", ")", "]"], "function": "def Func(arg_0=arg_1, **arg_2):\n    \"\"\" Use `kwargs` to select for desired attributes from list of zipcode dicts \"\"\"\n    return [arg_3 for arg_3 in arg_0 if all([arg_4 in arg_3 and arg_3[arg_4] == arg_5 for arg_4, arg_5 in arg_2.items()])]", "path": "zipcodes/__init__.py", "identifier": "filter_by", "docstring": "Use `kwargs` to select for desired attributes from list of zipcode dicts", "docstring_tokens": ["Use", "kwargs", "to", "select", "for", "desired", "attributes", "from", "list", "of", "zipcode", "dicts"], "nwo": "seanpianka/Zipcodes", "score": 0.38416725986527406, "idx": 253606}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/layout.py#L230-L257", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Combines self and another_layout into an \"edge map\".", "language": "python", "parameters": "(self, another_layout)", "return_statement": "return edge_map", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "get_virtual_bits", "(", ")", ".", "items", "(", ")", ":", "if", "arg_4", "not", "in", "arg_1", ".", "_p2v", ":", "raise", "LayoutError", "(", "'The wire_map_from_layouts() method does not support when the'", "' other layout (another_layout) is smaller.'", ")", "arg_2", "[", "arg_3", "]", "=", "arg_1", "[", "arg_4", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Combines self and another_layout into an \"edge map\".\n\n        For example::\n\n              self       another_layout  resulting edge map\n           qr_1 -> 0        0 <- q_2         qr_1 -> q_2\n           qr_2 -> 2        2 <- q_1         qr_2 -> q_1\n           qr_3 -> 3        3 <- q_0         qr_3 -> q_0\n\n        The edge map is used to compose dags via, for example, compose_back.\n\n        Args:\n            another_layout (Layout): The other layout to combine.\n        Returns:\n            dict: A \"edge map\".\n        Raises:\n            LayoutError: another_layout can be bigger than self, but not smaller. Otherwise, raises.\n        \"\"\"\n        arg_2 = dict()\n\n        for arg_3, arg_4 in arg_0.get_virtual_bits().items():\n            if arg_4 not in arg_1._p2v:\n                raise LayoutError('The wire_map_from_layouts() method does not support when the'\n                                  ' other layout (another_layout) is smaller.')\n            arg_2[arg_3] = arg_1[arg_4]\n\n        return arg_2", "path": "qiskit/transpiler/layout.py", "identifier": "Layout.combine_into_edge_map", "docstring": "Combines self and another_layout into an \"edge map\".\n\n        For example::\n\n              self       another_layout  resulting edge map\n           qr_1 -> 0        0 <- q_2         qr_1 -> q_2\n           qr_2 -> 2        2 <- q_1         qr_2 -> q_1\n           qr_3 -> 3        3 <- q_0         qr_3 -> q_0\n\n        The edge map is used to compose dags via, for example, compose_back.\n\n        Args:\n            another_layout (Layout): The other layout to combine.\n        Returns:\n            dict: A \"edge map\".\n        Raises:\n            LayoutError: another_layout can be bigger than self, but not smaller. Otherwise, raises.", "docstring_tokens": ["Combines", "self", "and", "another_layout", "into", "an", "edge", "map", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253607}
{"url": "https://github.com/lincolnloop/goodconf/blob/19515da5783f86b9516dbf81531107c2d9eae567/goodconf/contrib/django.py#L10-L33", "sha": "19515da5783f86b9516dbf81531107c2d9eae567", "docstring_summary": "Loads config, checking CLI arguments for a config file", "language": "python", "parameters": "(config: GoodConf, argv: List[str])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", ")", "->", "arg_3", "[", "arg_4", "]", ":", "from", "django", ".", "core", ".", "management", ".", "base", "import", "arg_10", "arg_5", "=", "arg_10", ".", "create_parser", "def", "patched_parser", "(", "arg_6", ",", "arg_7", ",", "arg_8", ")", ":", "arg_9", "=", "arg_5", "(", "arg_6", ",", "arg_7", ",", "arg_8", ")", "argparser_add_argument", "(", "arg_9", ",", "arg_0", ")", "return", "arg_9", "arg_10", ".", "create_parser", "=", "patched_parser", "try", ":", "arg_9", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "argparser_add_argument", "(", "arg_9", ",", "arg_0", ")", "arg_12", ",", "arg_13", "=", "arg_9", ".", "parse_known_args", "(", "arg_2", ")", "arg_0", ".", "load", "(", "arg_12", ".", "config", ")", "yield", "arg_13", "finally", ":", "arg_10", ".", "create_parser", "=", "arg_5"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4]) -> arg_3[arg_4]:\n    \"\"\"Loads config, checking CLI arguments for a config file\"\"\"\n\n    # Monkey patch Django's command parser\n    from django.core.management.base import arg_10\n    arg_5 = arg_10.create_parser\n\n    def patched_parser(arg_6, arg_7, arg_8):\n        arg_9 = arg_5(arg_6, arg_7, arg_8)\n        argparser_add_argument(arg_9, arg_0)\n        return arg_9\n\n    arg_10.create_parser = patched_parser\n\n    try:\n        arg_9 = argparse.ArgumentParser(add_help=False)\n        argparser_add_argument(arg_9, arg_0)\n\n        arg_12, arg_13 = arg_9.parse_known_args(arg_2)\n        arg_0.load(arg_12.config)\n        yield arg_13\n    finally:\n        # Put that create_parser back where it came from or so help me!\n        arg_10.create_parser = arg_5", "path": "goodconf/contrib/django.py", "identifier": "load_config_from_cli", "docstring": "Loads config, checking CLI arguments for a config file", "docstring_tokens": ["Loads", "config", "checking", "CLI", "arguments", "for", "a", "config", "file"], "nwo": "lincolnloop/goodconf", "score": 0.5509125178981066, "idx": 253608}
{"url": "https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L68-L90", "sha": "7ef04938d80f8b646bd73d976ac9787a5b88edd9", "docstring_summary": "Generates a bytecode from an object.", "language": "python", "parameters": "(obb: object, previous: bytes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "arg_3", ":", "if", "isinstance", "(", "arg_0", ",", "pyte", ".", "superclasses", ".", "_PyteOp", ")", ":", "return", "arg_0", ".", "to_bytes", "(", "arg_2", ")", "elif", "isinstance", "(", "arg_0", ",", "(", "pyte", ".", "superclasses", ".", "_PyteAugmentedComparator", ",", "pyte", ".", "superclasses", ".", "_PyteAugmentedValidator", ".", "_FakeMathematicalOP", ")", ")", ":", "return", "arg_0", ".", "to_bytes", "(", "arg_2", ")", "elif", "isinstance", "(", "arg_0", ",", "pyte", ".", "superclasses", ".", "_PyteAugmentedValidator", ")", ":", "arg_0", ".", "validate", "(", ")", "return", "arg_0", ".", "to_load", "(", ")", "elif", "isinstance", "(", "arg_0", ",", "int", ")", ":", "return", "arg_0", ".", "to_bytes", "(", "(", "arg_0", ".", "bit_length", "(", ")", "+", "7", ")", "//", "8", ",", "byteorder", "=", "\"little\"", ")", "or", "b''", "elif", "isinstance", "(", "arg_0", ",", "arg_3", ")", ":", "return", "arg_0", "else", ":", "raise", "TypeError", "(", "\"`{}` was not a valid bytecode-encodable item\"", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> arg_3:\n    \"\"\"\n    Generates a bytecode from an object.\n\n    :param obb: The object to generate.\n    :param previous: The previous bytecode to use when generating subobjects.\n    :return: The generated bytecode.\n    \"\"\"\n    # Generates bytecode from a specified object, be it a validator or an int or bytes even.\n    if isinstance(arg_0, pyte.superclasses._PyteOp):\n        return arg_0.to_bytes(arg_2)\n    elif isinstance(arg_0, (pyte.superclasses._PyteAugmentedComparator,\n                          pyte.superclasses._PyteAugmentedValidator._FakeMathematicalOP)):\n        return arg_0.to_bytes(arg_2)\n    elif isinstance(arg_0, pyte.superclasses._PyteAugmentedValidator):\n        arg_0.validate()\n        return arg_0.to_load()\n    elif isinstance(arg_0, int):\n        return arg_0.to_bytes((arg_0.bit_length() + 7) // 8, byteorder=\"little\") or b''\n    elif isinstance(arg_0, arg_3):\n        return arg_0\n    else:\n        raise TypeError(\"`{}` was not a valid bytecode-encodable item\".format(arg_0))", "path": "pyte/util.py", "identifier": "generate_bytecode_from_obb", "docstring": "Generates a bytecode from an object.\n\n    :param obb: The object to generate.\n    :param previous: The previous bytecode to use when generating subobjects.\n    :return: The generated bytecode.", "docstring_tokens": ["Generates", "a", "bytecode", "from", "an", "object", "."], "nwo": "Fuyukai/Pyte", "score": 0.3282631104312029, "idx": 253609}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/docs/conf.py#L358-L403", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Determine the URL corresponding to Python object", "language": "python", "parameters": "(domain, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "!=", "'py'", ":", "return", "None", "arg_2", "=", "arg_1", "[", "'module'", "]", "arg_3", "=", "arg_1", "[", "'fullname'", "]", "arg_4", "=", "sys", ".", "modules", ".", "get", "(", "arg_2", ")", "if", "arg_4", "is", "None", ":", "return", "None", "arg_5", "=", "arg_4", "for", "arg_6", "in", "arg_3", ".", "split", "(", "'.'", ")", ":", "try", ":", "arg_5", "=", "getattr", "(", "arg_5", ",", "arg_6", ")", "except", ":", "return", "None", "try", ":", "arg_7", "=", "inspect", ".", "getsourcefile", "(", "arg_5", ")", "except", ":", "arg_7", "=", "None", "if", "not", "arg_7", ":", "return", "None", "try", ":", "arg_8", ",", "arg_9", "=", "inspect", ".", "getsourcelines", "(", "arg_5", ")", "except", ":", "arg_9", "=", "None", "if", "arg_9", ":", "arg_10", "=", "\"#L%d-L%d\"", "%", "(", "arg_9", ",", "arg_9", "+", "len", "(", "arg_8", ")", "-", "1", ")", "else", ":", "arg_10", "=", "\"\"", "arg_7", "=", "relpath", "(", "arg_7", ",", "start", "=", "dirname", "(", "scisalt", ".", "__file__", ")", ")", "if", "'dev'", "in", "scisalt", ".", "__version__", ":", "return", "\"http://github.com/joelfrederico/SciSalt/blob/master/scisalt/%s%s\"", "%", "(", "arg_7", ",", "arg_10", ")", "else", ":", "return", "\"http://github.com/joelfrederico/SciSalt/blob/v%s/scisalt/%s%s\"", "%", "(", "scisalt", ".", "__version__", ",", "arg_7", ",", "arg_10", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Determine the URL corresponding to Python object\n    \"\"\"\n    if arg_0 != 'py':\n        return None\n\n    arg_2 = arg_1['module']\n    arg_3 = arg_1['fullname']\n\n    arg_4 = sys.modules.get(arg_2)\n    if arg_4 is None:\n        return None\n\n    arg_5 = arg_4\n    for arg_6 in arg_3.split('.'):\n        try:\n            arg_5 = getattr(arg_5, arg_6)\n        except:\n            return None\n\n    try:\n        arg_7 = inspect.getsourcefile(arg_5)\n    except:\n        arg_7 = None\n    if not arg_7:\n        return None\n\n    try:\n        arg_8, arg_9 = inspect.getsourcelines(arg_5)\n    except:\n        arg_9 = None\n\n    if arg_9:\n        arg_10 = \"#L%d-L%d\" % (arg_9, arg_9 + len(arg_8) - 1)\n    else:\n        arg_10 = \"\"\n\n    arg_7 = relpath(arg_7, start=dirname(scisalt.__file__))\n\n    if 'dev' in scisalt.__version__:\n        return \"http://github.com/joelfrederico/SciSalt/blob/master/scisalt/%s%s\" % (\n            arg_7, arg_10)\n    else:\n        return \"http://github.com/joelfrederico/SciSalt/blob/v%s/scisalt/%s%s\" % (\n            scisalt.__version__, arg_7, arg_10)", "path": "docs/conf.py", "identifier": "linkcode_resolve", "docstring": "Determine the URL corresponding to Python object", "docstring_tokens": ["Determine", "the", "URL", "corresponding", "to", "Python", "object"], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 253610}
{"url": "https://github.com/rainwoodman/sharedmem/blob/b23e59c1ed0e28f7b6c96c17a04d55c700e06e3a/contrib/multipartstream.py#L31-L44", "sha": "b23e59c1ed0e28f7b6c96c17a04d55c700e06e3a", "docstring_summary": "return at most n array items, move the cursor.", "language": "python", "parameters": "(self, n)", "return_statement": "return rt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "len", "(", "arg_0", ".", "pool", ")", "<", "arg_1", ":", "arg_0", ".", "cur", "=", "arg_0", ".", "files", ".", "next", "(", ")", "arg_0", ".", "pool", "=", "numpy", ".", "append", "(", "arg_0", ".", "pool", ",", "arg_0", ".", "fetch", "(", "arg_0", ".", "cur", ")", ",", "axis", "=", "0", ")", "arg_4", "=", "arg_0", ".", "pool", "[", ":", "arg_1", "]", "if", "arg_1", "==", "len", "(", "arg_0", ".", "pool", ")", ":", "arg_0", ".", "pool", "=", "arg_0", ".", "fetch", "(", "None", ")", "else", ":", "arg_0", ".", "pool", "=", "arg_0", ".", "pool", "[", "arg_1", ":", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\" return at most n array items, move the cursor. \n        \"\"\"\n        while len(arg_0.pool) < arg_1:\n            arg_0.cur = arg_0.files.next()\n            arg_0.pool = numpy.append(arg_0.pool,\n                    arg_0.fetch(arg_0.cur), axis=0)\n\n        arg_4 = arg_0.pool[:arg_1]\n        if arg_1 == len(arg_0.pool):\n            arg_0.pool = arg_0.fetch(None)\n        else:\n            arg_0.pool = arg_0.pool[arg_1:]\n        return arg_4", "path": "contrib/multipartstream.py", "identifier": "MultiPartStream.read", "docstring": "return at most n array items, move the cursor.", "docstring_tokens": ["return", "at", "most", "n", "array", "items", "move", "the", "cursor", "."], "nwo": "rainwoodman/sharedmem", "score": 0.35931637326262145, "idx": 253611}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/explorer/src/python/physicalplan.py#L61-L72", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "parse topology location", "language": "python", "parameters": "(cl_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", "[", "'cluster/[role]/[env]'", "]", ".", "split", "(", "'/'", ")", "arg_2", "=", "arg_0", "[", "'topology-name'", "]", "arg_1", ".", "append", "(", "arg_2", ")", "if", "len", "(", "arg_1", ")", "!=", "4", ":", "raise", "return", "arg_1", "except", "Exception", ":", "Log", ".", "error", "(", "'Invalid topology location'", ")", "raise"], "function": "def Func(arg_0):\n  \"\"\" parse topology location \"\"\"\n  try:\n    arg_1 = arg_0['cluster/[role]/[env]'].split('/')\n    arg_2 = arg_0['topology-name']\n    arg_1.append(arg_2)\n    if len(arg_1) != 4:\n      raise\n    return arg_1\n  except Exception:\n    Log.error('Invalid topology location')\n    raise", "path": "heron/tools/explorer/src/python/physicalplan.py", "identifier": "parse_topo_loc", "docstring": "parse topology location", "docstring_tokens": ["parse", "topology", "location"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253612}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/pymagic.py#L70-L80", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Executed when script is run as-is.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "for", "arg_0", "in", "locate_files", "(", "ROOT_DIR", ")", ":", "print", "(", "\"Processing %s\"", "%", "arg_0", ")", "with", "open", "(", "arg_0", ",", "\"rt\"", ")", "as", "f", ":", "arg_1", "=", "list", "(", "tokenize", ".", "generate_tokens", "(", "f", ".", "readline", ")", ")", "arg_2", "=", "tokenize", ".", "untokenize", "(", "arg_1", ")", "arg_3", "=", "normalize_tokens", "(", "arg_1", ")", "arg_4", "=", "tokenize", ".", "untokenize", "(", "arg_3", ")", "assert", "arg_2", "==", "arg_4"], "function": "def Func():\n    \"\"\"Executed when script is run as-is.\"\"\"\n    # magic_files = {}\n    for arg_0 in locate_files(ROOT_DIR):\n        print(\"Processing %s\" % arg_0)\n        with open(arg_0, \"rt\") as f:\n            arg_1 = list(tokenize.generate_tokens(f.readline))\n            arg_2 = tokenize.untokenize(arg_1)\n            arg_3 = normalize_tokens(arg_1)\n            arg_4 = tokenize.untokenize(arg_3)\n            assert arg_2 == arg_4", "path": "h2o-bindings/bin/pymagic.py", "identifier": "main", "docstring": "Executed when script is run as-is.", "docstring_tokens": ["Executed", "when", "script", "is", "run", "as", "-", "is", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253613}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment_group.py#L318-L345", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Bookmark group.", "language": "python", "parameters": "(ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "get_project_group_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'group'", ")", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "experiment_group", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func group `{}`.'", ".", "format", "(", "arg_3", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"Experiments group is Funced.\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Bookmark group.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon group Func\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon group -g 2 Func\n    ```\n    \"\"\"\n    arg_1, arg_2, arg_3 = get_project_group_or_local(arg_0.obj.get('project'),\n                                                            arg_0.obj.get('group'))\n\n    try:\n        PolyaxonClient().experiment_group.Func(arg_1, arg_2, arg_3)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func group `{}`.'.format(arg_3))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"Experiments group is Funced.\")", "path": "polyaxon_cli/cli/experiment_group.py", "identifier": "bookmark", "docstring": "Bookmark group.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon group bookmark\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon group -g 2 bookmark\n    ```", "docstring_tokens": ["Bookmark", "group", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 253614}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_platform.py#L231-L273", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Uses default program defined by the system to open a file.\n    This is done via `os.startfile` on windows, `open` on mac, and `xdg-open`\n    on linux.", "language": "python", "parameters": "(fpath, verbose=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "from", "ubelt", "import", "util_cmd", "if", "arg_1", ":", "print", "(", "'[ubelt] Func(\"{}\")'", ".", "format", "(", "arg_0", ")", ")", "arg_0", "=", "normpath", "(", "arg_0", ")", "if", "not", "exists", "(", "arg_0", ")", ":", "raise", "Exception", "(", "'Cannot start nonexistant file: %r'", "%", "arg_0", ")", "if", "not", "WIN32", ":", "import", "pipes", "arg_0", "=", "pipes", ".", "quote", "(", "arg_0", ")", "if", "LINUX", ":", "arg_2", "=", "util_cmd", ".", "cmd", "(", "(", "'xdg-open'", ",", "arg_0", ")", ",", "detach", "=", "True", ",", "arg_1", "=", "arg_1", ")", "elif", "DARWIN", ":", "arg_2", "=", "util_cmd", ".", "cmd", "(", "(", "'open'", ",", "arg_0", ")", ",", "detach", "=", "True", ",", "arg_1", "=", "arg_1", ")", "elif", "WIN32", ":", "os", ".", "Func", "(", "arg_0", ")", "arg_2", "=", "None", "else", ":", "raise", "RuntimeError", "(", "'Unknown Platform'", ")", "if", "arg_2", "is", "not", "None", ":", "if", "not", "arg_2", "[", "'proc'", "]", ":", "raise", "Exception", "(", "'Func failed'", ")"], "function": "def Func(arg_0, arg_1=True):  # nocover\n    \"\"\"\n    Uses default program defined by the system to open a file.\n    This is done via `os.Func` on windows, `open` on mac, and `xdg-open`\n    on linux.\n\n    Args:\n        fpath (PathLike): a file to open using the program associated with the\n            files extension type.\n        verbose (int): verbosity\n\n    References:\n        http://stackoverflow.com/questions/2692873/quote-posix\n\n    DisableExample:\n        >>> # This test interacts with a GUI frontend, not sure how to test.\n        >>> import ubelt as ub\n        >>> base = ub.ensure_app_cache_dir('ubelt')\n        >>> fpath1 = join(base, 'test_open.txt')\n        >>> ub.touch(fpath1)\n        >>> proc = ub.Func(fpath1)\n    \"\"\"\n    from ubelt import util_cmd\n    if arg_1:\n        print('[ubelt] Func(\"{}\")'.format(arg_0))\n    arg_0 = normpath(arg_0)\n    if not exists(arg_0):\n        raise Exception('Cannot start nonexistant file: %r' % arg_0)\n    if not WIN32:\n        import pipes\n        arg_0 = pipes.quote(arg_0)\n    if LINUX:\n        arg_2 = util_cmd.cmd(('xdg-open', arg_0), detach=True, arg_1=arg_1)\n    elif DARWIN:\n        arg_2 = util_cmd.cmd(('open', arg_0), detach=True, arg_1=arg_1)\n    elif WIN32:\n        os.Func(arg_0)\n        arg_2 = None\n    else:\n        raise RuntimeError('Unknown Platform')\n    if arg_2 is not None:\n        if not arg_2['proc']:\n            raise Exception('Func failed')", "path": "ubelt/util_platform.py", "identifier": "startfile", "docstring": "Uses default program defined by the system to open a file.\n    This is done via `os.startfile` on windows, `open` on mac, and `xdg-open`\n    on linux.\n\n    Args:\n        fpath (PathLike): a file to open using the program associated with the\n            files extension type.\n        verbose (int): verbosity\n\n    References:\n        http://stackoverflow.com/questions/2692873/quote-posix\n\n    DisableExample:\n        >>> # This test interacts with a GUI frontend, not sure how to test.\n        >>> import ubelt as ub\n        >>> base = ub.ensure_app_cache_dir('ubelt')\n        >>> fpath1 = join(base, 'test_open.txt')\n        >>> ub.touch(fpath1)\n        >>> proc = ub.startfile(fpath1)", "docstring_tokens": ["Uses", "default", "program", "defined", "by", "the", "system", "to", "open", "a", "file", ".", "This", "is", "done", "via", "os", ".", "startfile", "on", "windows", "open", "on", "mac", "and", "xdg", "-", "open", "on", "linux", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 253615}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/interfaceLevel/propDeclrCollector.py#L213-L243", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Update all parameters which are defined on self from otherObj", "language": "python", "parameters": "(self, otherObj:\"PropDeclrCollector\", updater, exclude:set, prefix:str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "\"PropDeclrCollector\"", ",", "arg_2", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_6", ")", "->", "None", ":", "arg_7", "=", "arg_4", "(", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "=", "arg_4", "(", "arg_3", ")", "for", "arg_8", "in", "arg_0", ".", "_params", ":", "arg_9", "=", "arg_5", "+", "arg_8", ".", "_scopes", "[", "arg_0", "]", "[", "1", "]", "try", ":", "arg_10", "=", "getattr", "(", "arg_1", ",", "arg_9", ")", "if", "not", "isinstance", "(", "arg_10", ",", "Param", ")", ":", "continue", "except", "AttributeError", ":", "continue", "if", "arg_3", "and", "arg_10", "in", "arg_3", ":", "arg_7", ".", "add", "(", "arg_10", ")", "continue", "arg_2", "(", "arg_0", ",", "arg_8", ",", "arg_10", ")", "if", "arg_3", "is", "not", "None", ":", "assert", "arg_7", "==", "arg_3"], "function": "def Func(arg_0, arg_1:\"PropDeclrCollector\", arg_2, arg_3:arg_4, arg_5:arg_6) -> None:\n        \"\"\"\n        Update all parameters which are defined on self from otherObj\n\n        :param otherObj: other object which Param instances should be updated\n        :param updater: updater function(self, myParameter, onOtherParameterName, otherParameter)\n        :param exclude: iterable of parameter on otherObj object which should be excluded\n        :param prefix: prefix which should be added to name of paramters of this object before matching\n            parameter name on parent\n        \"\"\"\n        arg_7 = arg_4()\n        if arg_3 is not None:\n            arg_3 = arg_4(arg_3)\n\n        for arg_8 in arg_0._params:\n            arg_9 = arg_5 + arg_8._scopes[arg_0][1]\n            try:\n                arg_10 = getattr(arg_1, arg_9)\n                if not isinstance(arg_10, Param):\n                    continue\n            except AttributeError:\n                continue\n\n            if arg_3 and arg_10 in arg_3:\n                arg_7.add(arg_10)\n                continue\n            arg_2(arg_0, arg_8, arg_10)\n        \n        if arg_3 is not None:\n            # assert that what should be excluded really exists\n            assert arg_7 == arg_3", "path": "hwt/synthesizer/interfaceLevel/propDeclrCollector.py", "identifier": "PropDeclrCollector._updateParamsFrom", "docstring": "Update all parameters which are defined on self from otherObj\n\n        :param otherObj: other object which Param instances should be updated\n        :param updater: updater function(self, myParameter, onOtherParameterName, otherParameter)\n        :param exclude: iterable of parameter on otherObj object which should be excluded\n        :param prefix: prefix which should be added to name of paramters of this object before matching\n            parameter name on parent", "docstring_tokens": ["Update", "all", "parameters", "which", "are", "defined", "on", "self", "from", "otherObj"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 253616}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/gallery.py#L657-L664", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Return the list of all sub-directories of path.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "albums", "[", "arg_1", "]", ".", "subdirs", ":", "arg_3", "=", "os", ".", "path", ".", "normpath", "(", "join", "(", "arg_1", ",", "arg_2", ")", ")", "yield", "arg_3", ",", "arg_0", ".", "albums", "[", "arg_3", "]", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "Func", "(", "arg_3", ")", ":", "yield", "arg_4", ",", "arg_0", ".", "albums", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the list of all sub-directories of path.\"\"\"\n\n        for arg_2 in arg_0.albums[arg_1].subdirs:\n            arg_3 = os.path.normpath(join(arg_1, arg_2))\n            yield arg_3, arg_0.albums[arg_3]\n            for arg_4, arg_5 in arg_0.Func(arg_3):\n                yield arg_4, arg_0.albums[arg_3]", "path": "sigal/gallery.py", "identifier": "Gallery.get_albums", "docstring": "Return the list of all sub-directories of path.", "docstring_tokens": ["Return", "the", "list", "of", "all", "sub", "-", "directories", "of", "path", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 253617}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/pretty.py#L257-L264", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "End a group. See `begin_group` for more details.", "language": "python", "parameters": "(self, dedent=0, close='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "''", ")", ":", "arg_0", ".", "indentation", "-=", "arg_1", "arg_3", "=", "arg_0", ".", "group_stack", ".", "pop", "(", ")", "if", "not", "arg_3", ".", "breakables", ":", "arg_0", ".", "group_queue", ".", "remove", "(", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "text", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=''):\n        \"\"\"End a group. See `begin_group` for more details.\"\"\"\n        arg_0.indentation -= arg_1\n        arg_3 = arg_0.group_stack.pop()\n        if not arg_3.breakables:\n            arg_0.group_queue.remove(arg_3)\n        if arg_2:\n            arg_0.text(arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/lib/pretty.py", "identifier": "PrettyPrinter.end_group", "docstring": "End a group. See `begin_group` for more details.", "docstring_tokens": ["End", "a", "group", ".", "See", "begin_group", "for", "more", "details", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253618}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L431-L444", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Add new index values.", "language": "python", "parameters": "(self, idx_name, *ids_and_fcs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_index_keys_for", "(", "arg_1", ",", "*", "arg_2", ")", "arg_4", "=", "map", "(", "lambda", "k", ":", "(", "k", ",", "'0'", ")", ",", "arg_3", ")", "arg_0", ".", "kvl", ".", "put", "(", "arg_0", ".", "INDEX_TABLE", ",", "*", "arg_4", ")"], "function": "def Func(arg_0, arg_1, *arg_2):\n        '''Add new index values.\n\n        Adds new index values for index ``idx_name`` for the pairs\n        given. Each pair should be a content identifier and a\n        :class:`dossier.fc.FeatureCollection`.\n\n        :type idx_name: unicode\n        :type ids_and_fcs: ``[(content_id, FeatureCollection)]``\n        '''\n        arg_3 = arg_0._index_keys_for(arg_1, *arg_2)\n        arg_4 = map(lambda k: (k, '0'), arg_3)\n        # TODO: use imap when kvl.put takes an iterable\n        arg_0.kvl.put(arg_0.INDEX_TABLE, *arg_4)", "path": "dossier/store/store.py", "identifier": "Store._index_put", "docstring": "Add new index values.\n\n        Adds new index values for index ``idx_name`` for the pairs\n        given. Each pair should be a content identifier and a\n        :class:`dossier.fc.FeatureCollection`.\n\n        :type idx_name: unicode\n        :type ids_and_fcs: ``[(content_id, FeatureCollection)]``", "docstring_tokens": ["Add", "new", "index", "values", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 253619}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/topology/topology_context_impl.py#L110-L116", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns the task ids allocated for the given component id", "language": "python", "parameters": "(self, component_id)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "task_to_component_map", ".", "items", "(", ")", ":", "if", "arg_4", "==", "arg_1", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns the task ids allocated for the given component id\"\"\"\n    arg_2 = []\n    for arg_3, arg_4 in arg_0.task_to_component_map.items():\n      if arg_4 == arg_1:\n        arg_2.append(arg_3)\n    return arg_2", "path": "heron/instance/src/python/utils/topology/topology_context_impl.py", "identifier": "TopologyContextImpl.get_component_tasks", "docstring": "Returns the task ids allocated for the given component id", "docstring_tokens": ["Returns", "the", "task", "ids", "allocated", "for", "the", "given", "component", "id"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253620}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/parse.py#L382-L401", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "Overridden to not get rid of newlines", "language": "python", "parameters": "(self, text, width, indent)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_1", ".", "splitlines", "(", "False", ")", ":", "if", "arg_5", ":", "arg_4", ".", "extend", "(", "textwrap", ".", "wrap", "(", "arg_5", ".", "strip", "(", ")", ",", "arg_2", ",", "initial_indent", "=", "arg_3", ",", "subsequent_indent", "=", "arg_3", ")", ")", "else", ":", "arg_4", ".", "append", "(", "arg_5", ")", "arg_1", "=", "\"\\n\"", ".", "join", "(", "arg_4", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Overridden to not get rid of newlines\n\n        https://github.com/python/cpython/blob/2.7/Lib/argparse.py#L620\"\"\"\n        arg_4 = []\n        for arg_5 in arg_1.splitlines(False):\n            if arg_5:\n                # https://docs.python.org/2/library/textwrap.html\n                arg_4.extend(textwrap.wrap(\n                    arg_5.strip(),\n                    arg_2,\n                    initial_indent=arg_3,\n                    subsequent_indent=arg_3\n                ))\n\n            else:\n                arg_4.append(arg_5)\n\n        arg_1 = \"\\n\".join(arg_4)\n        return arg_1", "path": "captain/parse.py", "identifier": "HelpFormatter._fill_text", "docstring": "Overridden to not get rid of newlines\n\n        https://github.com/python/cpython/blob/2.7/Lib/argparse.py#L620", "docstring_tokens": ["Overridden", "to", "not", "get", "rid", "of", "newlines"], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 253621}
{"url": "https://github.com/dry-python/dependencies/blob/297912cbc6482ba26b3104729645f3a2aba5facc/src/dependencies/contrib/_django.py#L16-L21", "sha": "297912cbc6482ba26b3104729645f3a2aba5facc", "docstring_summary": "Create Django form processing class-based view from injector class.", "language": "python", "parameters": "(injector)", "return_statement": "return injector.let(as_view=handler.as_view)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "create_handler", "(", "FormView", ",", "arg_0", ")", "apply_form_methods", "(", "arg_1", ",", "arg_0", ")", "return", "arg_0", ".", "let", "(", "as_view", "=", "arg_1", ".", "as_view", ")"], "function": "def Func(arg_0):\n    \"\"\"Create Django form processing class-based view from injector class.\"\"\"\n\n    arg_1 = create_handler(FormView, arg_0)\n    apply_form_methods(arg_1, arg_0)\n    return arg_0.let(as_view=arg_1.as_view)", "path": "src/dependencies/contrib/_django.py", "identifier": "form_view", "docstring": "Create Django form processing class-based view from injector class.", "docstring_tokens": ["Create", "Django", "form", "processing", "class", "-", "based", "view", "from", "injector", "class", "."], "nwo": "dry-python/dependencies", "score": 0.48025225294832147, "idx": 253622}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L888-L922", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Delete subfield from position specified.", "language": "python", "parameters": "(rec, tag, subfield_position,\n                                field_position_global=None,\n                                field_position_local=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "record_get_subfields", "(", "arg_0", ",", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "try", ":", "del", "arg_5", "[", "arg_2", "]", "except", "IndexError", ":", "raise", "InvenioBibRecordFieldError", "(", "\"The record does not contain the subfield \"", "\"'%(subfieldIndex)s' inside the field (local: \"", "\"'%(fieldIndexLocal)s, global: '%(fieldIndexGlobal)s' ) of tag \"", "\"'%(tag)s'.\"", "%", "{", "\"subfieldIndex\"", ":", "arg_2", ",", "\"fieldIndexLocal\"", ":", "str", "(", "arg_4", ")", ",", "\"fieldIndexGlobal\"", ":", "str", "(", "arg_3", ")", ",", "\"tag\"", ":", "arg_1", "}", ")", "if", "not", "arg_5", ":", "if", "arg_3", "is", "not", "None", ":", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_0", "[", "arg_1", "]", ")", ":", "if", "arg_7", "[", "4", "]", "==", "arg_3", ":", "del", "arg_0", "[", "arg_1", "]", "[", "arg_6", "]", "else", ":", "del", "arg_0", "[", "arg_1", "]", "[", "arg_4", "]", "if", "not", "arg_0", "[", "arg_1", "]", ":", "del", "arg_0", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1, arg_2,\n                                arg_3=None,\n                                arg_4=None):\n    \"\"\"\n    Delete subfield from position specified.\n\n    Specify the subfield by tag, field number and subfield position.\n    \"\"\"\n    arg_5 = record_get_subfields(\n        arg_0, arg_1,\n        arg_3=arg_3,\n        arg_4=arg_4)\n\n    try:\n        del arg_5[arg_2]\n    except IndexError:\n        raise InvenioBibRecordFieldError(\n            \"The record does not contain the subfield \"\n            \"'%(subfieldIndex)s' inside the field (local: \"\n            \"'%(fieldIndexLocal)s, global: '%(fieldIndexGlobal)s' ) of tag \"\n            \"'%(tag)s'.\" %\n            {\"subfieldIndex\": arg_2,\n             \"fieldIndexLocal\": str(arg_4),\n             \"fieldIndexGlobal\": str(arg_3),\n             \"tag\": arg_1})\n    if not arg_5:\n        if arg_3 is not None:\n            for arg_6, arg_7 in enumerate(arg_0[arg_1]):\n                if arg_7[4] == arg_3:\n                    del arg_0[arg_1][arg_6]\n        else:\n            del arg_0[arg_1][arg_4]\n\n        if not arg_0[arg_1]:\n            del arg_0[arg_1]", "path": "harvestingkit/bibrecord.py", "identifier": "record_delete_subfield_from", "docstring": "Delete subfield from position specified.\n\n    Specify the subfield by tag, field number and subfield position.", "docstring_tokens": ["Delete", "subfield", "from", "position", "specified", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253623}
{"url": "https://github.com/twaddington/django-gravatar/blob/c4849d93ed43b419eceff0ff2de83d4265597629/django_gravatar/helpers.py#L90-L108", "sha": "c4849d93ed43b419eceff0ff2de83d4265597629", "docstring_summary": "Builds a url to a gravatar profile from an email address.", "language": "python", "parameters": "(email, secure=GRAVATAR_DEFAULT_SECURE)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "if", "arg_1", ":", "arg_3", "=", "GRAVATAR_SECURE_URL", "else", ":", "arg_3", "=", "GRAVATAR_URL", "arg_4", "=", "calculate_gravatar_hash", "(", "arg_0", ")", "arg_5", "=", "'{base}{hash}'", ".", "format", "(", "base", "=", "arg_3", ",", "hash", "=", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Builds a url to a gravatar profile from an email address.\n\n    :param email: The email to fetch the gravatar for\n    :param secure: If True use https, otherwise plain http\n    \"\"\"\n    if arg_1:\n        arg_3 = GRAVATAR_SECURE_URL\n    else:\n        arg_3 = GRAVATAR_URL\n\n    # Calculate the email hash\n    arg_4 = calculate_gravatar_hash(arg_0)\n\n    # Build url\n    arg_5 = '{base}{hash}'.format(base=arg_3, hash=arg_4)\n\n    return arg_5", "path": "django_gravatar/helpers.py", "identifier": "get_gravatar_profile_url", "docstring": "Builds a url to a gravatar profile from an email address.\n\n    :param email: The email to fetch the gravatar for\n    :param secure: If True use https, otherwise plain http", "docstring_tokens": ["Builds", "a", "url", "to", "a", "gravatar", "profile", "from", "an", "email", "address", "."], "nwo": "twaddington/django-gravatar", "score": 0.518034445889309, "idx": 253624}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/clientsecrets.py#L129-L173", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Loading of client_secrets JSON file, optionally backed by a cache.", "language": "python", "parameters": "(filename, cache=None)", "return_statement": "return next(six.iteritems(obj))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "'oauth2client:secrets#ns'", "if", "not", "arg_1", ":", "return", "_Func", "(", "arg_0", ")", "arg_3", "=", "arg_1", ".", "get", "(", "arg_0", ",", "namespace", "=", "arg_2", ")", "if", "arg_3", "is", "None", ":", "arg_4", ",", "arg_5", "=", "_Func", "(", "arg_0", ")", "arg_3", "=", "{", "arg_4", ":", "arg_5", "}", "arg_1", ".", "set", "(", "arg_0", ",", "arg_3", ",", "namespace", "=", "arg_2", ")", "return", "next", "(", "six", ".", "iteritems", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Loading of client_secrets JSON file, optionally backed by a cache.\n\n    Typical cache storage would be App Engine memcache service,\n    but you can pass in any other cache client that implements\n    these methods:\n\n    * ``get(key, namespace=ns)``\n    * ``set(key, value, namespace=ns)``\n\n    Usage::\n\n        # without caching\n        client_type, client_info = Func('secrets.json')\n        # using App Engine memcache service\n        from google.appengine.api import memcache\n        client_type, client_info = Func('secrets.json', cache=memcache)\n\n    Args:\n        filename: string, Path to a client_secrets.json file on a filesystem.\n        cache: An optional cache service client that implements get() and set()\n        methods. If not specified, the file is always being loaded from\n                 a filesystem.\n\n    Raises:\n        InvalidClientSecretsError: In case of a validation error or some\n                                   I/O failure. Can happen only on cache miss.\n\n    Returns:\n        (client_type, client_info) tuple, as _Func() normally would.\n        JSON contents is validated only during first load. Cache hits are not\n        validated.\n    \"\"\"\n    arg_2 = 'oauth2client:secrets#ns'\n\n    if not arg_1:\n        return _Func(arg_0)\n\n    arg_3 = arg_1.get(arg_0, namespace=arg_2)\n    if arg_3 is None:\n        arg_4, arg_5 = _Func(arg_0)\n        arg_3 = {arg_4: arg_5}\n        arg_1.set(arg_0, arg_3, namespace=arg_2)\n\n    return next(six.iteritems(arg_3))", "path": "oauth2client/clientsecrets.py", "identifier": "loadfile", "docstring": "Loading of client_secrets JSON file, optionally backed by a cache.\n\n    Typical cache storage would be App Engine memcache service,\n    but you can pass in any other cache client that implements\n    these methods:\n\n    * ``get(key, namespace=ns)``\n    * ``set(key, value, namespace=ns)``\n\n    Usage::\n\n        # without caching\n        client_type, client_info = loadfile('secrets.json')\n        # using App Engine memcache service\n        from google.appengine.api import memcache\n        client_type, client_info = loadfile('secrets.json', cache=memcache)\n\n    Args:\n        filename: string, Path to a client_secrets.json file on a filesystem.\n        cache: An optional cache service client that implements get() and set()\n        methods. If not specified, the file is always being loaded from\n                 a filesystem.\n\n    Raises:\n        InvalidClientSecretsError: In case of a validation error or some\n                                   I/O failure. Can happen only on cache miss.\n\n    Returns:\n        (client_type, client_info) tuple, as _loadfile() normally would.\n        JSON contents is validated only during first load. Cache hits are not\n        validated.", "docstring_tokens": ["Loading", "of", "client_secrets", "JSON", "file", "optionally", "backed", "by", "a", "cache", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 253625}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L1861-L1907", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Scales each value in the pixels of the image.", "language": "python", "parameters": "(im, val=0.9, clip=None, is_random=False)", "return_statement": "return im", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.9", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_2", "=", "arg_2", "if", "arg_2", "is", "not", "None", "else", "(", "-", "np", ".", "inf", ",", "np", ".", "inf", ")", "if", "arg_3", ":", "arg_4", "=", "1", "+", "np", ".", "random", ".", "uniform", "(", "-", "arg_1", ",", "arg_1", ")", "arg_0", "=", "arg_0", "*", "arg_4", "else", ":", "arg_0", "=", "arg_0", "*", "arg_1", "if", "len", "(", "arg_2", ")", "==", "2", ":", "arg_0", "=", "np", ".", "clip", "(", "arg_0", ",", "arg_2", "[", "0", "]", ",", "arg_2", "[", "1", "]", ")", "else", ":", "raise", "Exception", "(", "\"clip : tuple of 2 numbers\"", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=0.9, arg_2=None, arg_3=False):\n    \"\"\"Scales each value in the pixels of the image.\n\n    Parameters\n    -----------\n    im : numpy.array\n        An image.\n    val : float\n        The scale value for changing pixel value.\n            - If is_random=False, multiply this value with all pixels.\n            - If is_random=True, multiply a value between [1-val, 1+val] with all pixels.\n    clip : tuple of 2 numbers\n        The minimum and maximum value.\n    is_random : boolean\n        If True, see ``val``.\n\n    Returns\n    -------\n    numpy.array\n        A processed image.\n\n    Examples\n    ----------\n    Random\n\n    >>> im = Func(im, 0.1, [0, 255], is_random=True)\n\n    Non-random\n\n    >>> im = Func(im, 0.9, [0, 255], is_random=False)\n\n    \"\"\"\n\n    arg_2 = arg_2 if arg_2 is not None else (-np.inf, np.inf)\n\n    if arg_3:\n        arg_4 = 1 + np.random.uniform(-arg_1, arg_1)\n        arg_0 = arg_0 * arg_4\n    else:\n        arg_0 = arg_0 * arg_1\n\n    if len(arg_2) == 2:\n        arg_0 = np.clip(arg_0, arg_2[0], arg_2[1])\n    else:\n        raise Exception(\"clip : tuple of 2 numbers\")\n\n    return arg_0", "path": "tensorlayer/prepro.py", "identifier": "pixel_value_scale", "docstring": "Scales each value in the pixels of the image.\n\n    Parameters\n    -----------\n    im : numpy.array\n        An image.\n    val : float\n        The scale value for changing pixel value.\n            - If is_random=False, multiply this value with all pixels.\n            - If is_random=True, multiply a value between [1-val, 1+val] with all pixels.\n    clip : tuple of 2 numbers\n        The minimum and maximum value.\n    is_random : boolean\n        If True, see ``val``.\n\n    Returns\n    -------\n    numpy.array\n        A processed image.\n\n    Examples\n    ----------\n    Random\n\n    >>> im = pixel_value_scale(im, 0.1, [0, 255], is_random=True)\n\n    Non-random\n\n    >>> im = pixel_value_scale(im, 0.9, [0, 255], is_random=False)", "docstring_tokens": ["Scales", "each", "value", "in", "the", "pixels", "of", "the", "image", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253626}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/model.py#L107-L109", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Rename the model itself", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_impl", ".", "system", ".", "Func_model", "(", "new_name", "=", "arg_1", ",", "old_name", "=", "arg_0", ".", "name", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Rename the model itself\"\"\"\n        arg_0._impl.system.Func_model(new_name=arg_1, old_name=arg_0.name)", "path": "modelx/core/model.py", "identifier": "Model.rename", "docstring": "Rename the model itself", "docstring_tokens": ["Rename", "the", "model", "itself"], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 253627}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L250-L252", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Map a function to all grid_stack in a grid-stack", "language": "python", "parameters": "(self, func, *arg_lists)", "return_statement": "return GridStack(*[func(*args) for args in zip(self, *arg_lists)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "return", "GridStack", "(", "*", "[", "arg_1", "(", "*", "arg_3", ")", "for", "arg_3", "in", "zip", "(", "arg_0", ",", "*", "arg_2", ")", "]", ")"], "function": "def Func(arg_0, arg_1, *arg_2):\n        \"\"\"Map a function to all grid_stack in a grid-stack\"\"\"\n        return GridStack(*[arg_1(*arg_3) for arg_3 in zip(arg_0, *arg_2)])", "path": "autolens/data/array/grids.py", "identifier": "GridStack.map_function", "docstring": "Map a function to all grid_stack in a grid-stack", "docstring_tokens": ["Map", "a", "function", "to", "all", "grid_stack", "in", "a", "grid", "-", "stack"], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 253628}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmath.py#L58-L114", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Finds gaps in the provided time-series and indexes them into groups.", "language": "python", "parameters": "(lctimes, mingap=4.0)", "return_statement": "return len(group_indices), group_indices", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "4.0", ")", ":", "arg_2", "=", "np", ".", "diff", "(", "arg_0", ")", "arg_3", "=", "np", ".", "where", "(", "arg_2", ">", "arg_1", ")", "[", "0", "]", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_3", ")", ":", "if", "arg_5", "==", "0", ":", "arg_4", ".", "append", "(", "slice", "(", "0", ",", "arg_6", "+", "1", ")", ")", "else", ":", "arg_4", ".", "append", "(", "slice", "(", "arg_3", "[", "arg_5", "-", "1", "]", "+", "1", ",", "arg_6", "+", "1", ")", ")", "arg_4", ".", "append", "(", "slice", "(", "arg_3", "[", "-", "1", "]", "+", "1", ",", "len", "(", "arg_0", ")", ")", ")", "else", ":", "arg_4", "=", "[", "slice", "(", "0", ",", "len", "(", "arg_0", ")", ")", "]", "return", "len", "(", "arg_4", ")", ",", "arg_4"], "function": "def Func(arg_0, arg_1=4.0):\n    '''Finds gaps in the provided time-series and indexes them into groups.\n\n    This finds the gaps in the provided `lctimes` array, so we can figure out\n    which times are for consecutive observations and which represent gaps\n    between seasons or observing eras.\n\n    Parameters\n    ----------\n\n    lctimes : array-like\n        This contains the times to analyze for gaps; assumed to be some form of\n        Julian date.\n\n    mingap : float\n        This defines how much the difference between consecutive measurements is\n        allowed to be to consider them as parts of different timegroups. By\n        default it is set to 4.0 days.\n\n    Returns\n    -------\n\n    tuple\n        A tuple of the form: `(ngroups, [slice(start_ind_1, end_ind_1), ...])`\n        is returned.  This contains the number of groups as the first element,\n        and a list of Python `slice` objects for each time-group found. These\n        can be used directly to index into the array of times to quickly get\n        measurements associated with each group.\n\n    '''\n\n    arg_2 = np.diff(arg_0)\n    arg_3 = np.where(arg_2 > arg_1)[0]\n\n    if len(arg_3) > 0:\n\n        arg_4 = []\n\n        for arg_5, arg_6 in enumerate(arg_3):\n\n            if arg_5 == 0:\n                arg_4.append(slice(0,arg_6+1))\n            else:\n                arg_4.append(slice(arg_3[arg_5-1]+1,arg_6+1))\n\n\n        # at the end, add the slice for the last group to the end of the times\n        # array\n        arg_4.append(slice(arg_3[-1]+1,len(arg_0)))\n\n    # if there's no large gap in the LC, then there's only one group to worry\n    # about\n    else:\n        arg_4 = [slice(0,len(arg_0))]\n\n\n    return len(arg_4), arg_4", "path": "astrobase/lcmath.py", "identifier": "find_lc_timegroups", "docstring": "Finds gaps in the provided time-series and indexes them into groups.\n\n    This finds the gaps in the provided `lctimes` array, so we can figure out\n    which times are for consecutive observations and which represent gaps\n    between seasons or observing eras.\n\n    Parameters\n    ----------\n\n    lctimes : array-like\n        This contains the times to analyze for gaps; assumed to be some form of\n        Julian date.\n\n    mingap : float\n        This defines how much the difference between consecutive measurements is\n        allowed to be to consider them as parts of different timegroups. By\n        default it is set to 4.0 days.\n\n    Returns\n    -------\n\n    tuple\n        A tuple of the form: `(ngroups, [slice(start_ind_1, end_ind_1), ...])`\n        is returned.  This contains the number of groups as the first element,\n        and a list of Python `slice` objects for each time-group found. These\n        can be used directly to index into the array of times to quickly get\n        measurements associated with each group.", "docstring_tokens": ["Finds", "gaps", "in", "the", "provided", "time", "-", "series", "and", "indexes", "them", "into", "groups", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 253629}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L543-L563", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Submit a task to any of a subset of our targets.", "language": "python", "parameters": "(self, job, indices=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", ":", "arg_3", "=", "[", "arg_0", ".", "loads", "[", "i", "]", "for", "i", "in", "arg_2", "]", "else", ":", "arg_3", "=", "arg_0", ".", "loads", "arg_4", "=", "arg_0", ".", "scheme", "(", "arg_3", ")", "if", "arg_2", ":", "arg_4", "=", "arg_2", "[", "arg_4", "]", "arg_5", "=", "arg_0", ".", "targets", "[", "arg_4", "]", "arg_0", ".", "engine_stream", ".", "send", "(", "arg_5", ",", "flags", "=", "zmq", ".", "SNDMORE", ",", "copy", "=", "False", ")", "arg_0", ".", "engine_stream", ".", "send_multipart", "(", "arg_1", ".", "raw_msg", ",", "copy", "=", "False", ")", "arg_0", ".", "add_job", "(", "arg_4", ")", "arg_0", ".", "pending", "[", "arg_5", "]", "[", "arg_1", ".", "msg_id", "]", "=", "arg_1", "arg_8", "=", "dict", "(", "arg_7", "=", "arg_1", ".", "msg_id", ",", "engine_id", "=", "arg_5", ".", "decode", "(", "'ascii'", ")", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "mon_stream", ",", "'task_destination'", ",", "arg_8", "=", "arg_8", ",", "ident", "=", "[", "b'tracktask'", ",", "arg_0", ".", "ident", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Submit a task to any of a subset of our targets.\"\"\"\n        if arg_2:\n            arg_3 = [arg_0.loads[i] for i in arg_2]\n        else:\n            arg_3 = arg_0.loads\n        arg_4 = arg_0.scheme(arg_3)\n        if arg_2:\n            arg_4 = arg_2[arg_4]\n        arg_5 = arg_0.targets[arg_4]\n        # print (target, map(str, msg[:3]))\n        # send job to the engine\n        arg_0.engine_stream.send(arg_5, flags=zmq.SNDMORE, copy=False)\n        arg_0.engine_stream.send_multipart(arg_1.raw_msg, copy=False)\n        # update load\n        arg_0.add_job(arg_4)\n        arg_0.pending[arg_5][arg_1.msg_id] = arg_1\n        # notify Hub\n        arg_8 = dict(arg_7=arg_1.msg_id, engine_id=arg_5.decode('ascii'))\n        arg_0.session.send(arg_0.mon_stream, 'task_destination', arg_8=arg_8,\n                        ident=[b'tracktask',arg_0.ident])", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py", "identifier": "TaskScheduler.submit_task", "docstring": "Submit a task to any of a subset of our targets.", "docstring_tokens": ["Submit", "a", "task", "to", "any", "of", "a", "subset", "of", "our", "targets", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253630}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/convolutional.py#L382-L445", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augmenter that detects all edges in images, marks them in\n    a black and white image and then overlays the result with the original\n    image.", "language": "python", "parameters": "(alpha=0, name=None, deterministic=False, random_state=None)", "return_statement": "return Convolve(create_matrices, name=name, deterministic=deterministic, random_state=random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "iap", ".", "handle_continuous_param", "(", "arg_0", ",", "\"alpha\"", ",", "value_range", "=", "(", "0", ",", "1.0", ")", ",", "tuple_to_uniform", "=", "True", ",", "list_to_choice", "=", "True", ")", "def", "create_matrices", "(", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_8", "=", "arg_4", ".", "draw_sample", "(", "arg_3", "=", "arg_7", ")", "ia", ".", "do_assert", "(", "0", "<=", "arg_8", "<=", "1.0", ")", "arg_9", "=", "np", ".", "array", "(", "[", "[", "0", ",", "0", ",", "0", "]", ",", "[", "0", ",", "1", ",", "0", "]", ",", "[", "0", ",", "0", ",", "0", "]", "]", ",", "dtype", "=", "np", ".", "float32", ")", "arg_10", "=", "np", ".", "array", "(", "[", "[", "0", ",", "1", ",", "0", "]", ",", "[", "1", ",", "-", "4", ",", "1", "]", ",", "[", "0", ",", "1", ",", "0", "]", "]", ",", "dtype", "=", "np", ".", "float32", ")", "arg_11", "=", "(", "1", "-", "arg_8", ")", "*", "arg_9", "+", "arg_8", "*", "arg_10", "return", "[", "arg_11", "]", "*", "arg_6", "if", "arg_1", "is", "None", ":", "arg_1", "=", "\"Unnamed%s\"", "%", "(", "ia", ".", "caller_name", "(", ")", ",", ")", "return", "Convolve", "(", "create_matrices", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0=0, arg_1=None, arg_2=False, arg_3=None):\n    \"\"\"\n    Augmenter that detects all edges in images, marks them in\n    a black and white image and then overlays the result with the original\n    image.\n\n    dtype support::\n\n        See ``imgaug.augmenters.convolutional.Convolve``.\n\n    Parameters\n    ----------\n    alpha : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional\n        Visibility of the sharpened image. At 0, only the original image is\n        visible, at 1.0 only its sharpened version is visible.\n\n            * If an int or float, exactly that value will be used.\n            * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will\n              be sampled per image.\n            * If a list, then a random value will be sampled from that list\n              per image.\n            * If a StochasticParameter, a value will be sampled from the\n              parameter per image.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = Func(alpha=(0.0, 1.0))\n\n    detects edges in an image  and overlays the result with a variable alpha\n    in the range ``0.0 <= a <= 1.0`` over the old image.\n\n    \"\"\"\n    arg_4 = iap.handle_continuous_param(arg_0, \"alpha\", value_range=(0, 1.0), tuple_to_uniform=True,\n                                              list_to_choice=True)\n\n    def create_matrices(arg_5, arg_6, arg_7):\n        arg_8 = arg_4.draw_sample(arg_3=arg_7)\n        ia.do_assert(0 <= arg_8 <= 1.0)\n        arg_9 = np.array([\n            [0, 0, 0],\n            [0, 1, 0],\n            [0, 0, 0]\n        ], dtype=np.float32)\n        arg_10 = np.array([\n            [0, 1, 0],\n            [1, -4, 1],\n            [0, 1, 0]\n        ], dtype=np.float32)\n        arg_11 = (1-arg_8) * arg_9 + arg_8 * arg_10\n        return [arg_11] * arg_6\n\n    if arg_1 is None:\n        arg_1 = \"Unnamed%s\" % (ia.caller_name(),)\n\n    return Convolve(create_matrices, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)", "path": "imgaug/augmenters/convolutional.py", "identifier": "EdgeDetect", "docstring": "Augmenter that detects all edges in images, marks them in\n    a black and white image and then overlays the result with the original\n    image.\n\n    dtype support::\n\n        See ``imgaug.augmenters.convolutional.Convolve``.\n\n    Parameters\n    ----------\n    alpha : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional\n        Visibility of the sharpened image. At 0, only the original image is\n        visible, at 1.0 only its sharpened version is visible.\n\n            * If an int or float, exactly that value will be used.\n            * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will\n              be sampled per image.\n            * If a list, then a random value will be sampled from that list\n              per image.\n            * If a StochasticParameter, a value will be sampled from the\n              parameter per image.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = EdgeDetect(alpha=(0.0, 1.0))\n\n    detects edges in an image  and overlays the result with a variable alpha\n    in the range ``0.0 <= a <= 1.0`` over the old image.", "docstring_tokens": ["Augmenter", "that", "detects", "all", "edges", "in", "images", "marks", "them", "in", "a", "black", "and", "white", "image", "and", "then", "overlays", "the", "result", "with", "the", "original", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 253631}
{"url": "https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L148-L156", "sha": "074c8452f15a0da638668a4fe139fde06ccfae7f", "docstring_summary": "One of the Bohachevsky functions", "language": "python", "parameters": "(theta)", "return_statement": "return obj, grad", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", "arg_3", "=", "arg_1", "**", "2", "+", "2", "*", "arg_2", "**", "2", "-", "0.3", "*", "np", ".", "cos", "(", "3", "*", "np", ".", "pi", "*", "arg_1", ")", "-", "0.4", "*", "np", ".", "cos", "(", "4", "*", "np", ".", "pi", "*", "arg_2", ")", "+", "0.7", "arg_4", "=", "np", ".", "array", "(", "[", "2", "*", "arg_1", "+", "0.3", "*", "np", ".", "sin", "(", "3", "*", "np", ".", "pi", "*", "arg_1", ")", "*", "3", "*", "np", ".", "pi", ",", "4", "*", "arg_2", "+", "0.4", "*", "np", ".", "sin", "(", "4", "*", "np", ".", "pi", "*", "arg_2", ")", "*", "4", "*", "np", ".", "pi", ",", "]", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"One of the Bohachevsky functions\"\"\"\n    arg_1, arg_2 = arg_0\n    arg_3 = arg_1 ** 2 + 2 * arg_2 ** 2 - 0.3 * np.cos(3 * np.pi * arg_1) - 0.4 * np.cos(4 * np.pi * arg_2) + 0.7\n    arg_4 = np.array([\n        2 * arg_1 + 0.3 * np.sin(3 * np.pi * arg_1) * 3 * np.pi,\n        4 * arg_2 + 0.4 * np.sin(4 * np.pi * arg_2) * 4 * np.pi,\n    ])\n    return arg_3, arg_4", "path": "descent/objectives.py", "identifier": "bohachevsky1", "docstring": "One of the Bohachevsky functions", "docstring_tokens": ["One", "of", "the", "Bohachevsky", "functions"], "nwo": "nirum/descent", "score": 0.18112697196067942, "idx": 253632}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L878-L882", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Put and return the only unique identifier possible, its path", "language": "python", "parameters": "(self, key)", "return_statement": "return self._key_path(key['name'])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "client", ".", "write", "(", "arg_0", ".", "_key_path", "(", "arg_1", "[", "'name'", "]", ")", ",", "**", "arg_1", ")", "return", "arg_0", ".", "_key_path", "(", "arg_1", "[", "'name'", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Put and return the only unique identifier possible, its path\n        \"\"\"\n        arg_0.client.write(arg_0._key_path(arg_1['name']), **arg_1)\n        return arg_0._key_path(arg_1['name'])", "path": "ghost.py", "identifier": "VaultStorage.put", "docstring": "Put and return the only unique identifier possible, its path", "docstring_tokens": ["Put", "and", "return", "the", "only", "unique", "identifier", "possible", "its", "path"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 253633}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dsub.py#L592-L617", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Resolve the logging path from job and task properties.", "language": "python", "parameters": "(job_metadata, job_resources, task_descriptors)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", ".", "logging", ":", "return", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "provider_base", ".", "format_logging_uri", "(", "arg_1", ".", "logging", ".", "uri", ",", "arg_0", ",", "arg_3", ".", "task_metadata", ")", "arg_5", "=", "job_model", ".", "LoggingParam", "(", "arg_4", ",", "arg_1", ".", "logging", ".", "file_provider", ")", "if", "arg_3", ".", "task_resources", ":", "arg_3", ".", "task_resources", "=", "arg_3", ".", "task_resources", ".", "_replace", "(", "arg_5", "=", "arg_5", ")", "else", ":", "arg_3", ".", "task_resources", "=", "job_model", ".", "Resources", "(", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Resolve the logging path from job and task properties.\n\n  Args:\n    job_metadata: Job metadata, such as job-id, job-name, and user-id.\n    job_resources: Resources specified such as ram, cpu, and logging path.\n    task_descriptors: Task metadata, parameters, and resources.\n\n  Resolve the logging path, which may have substitution parameters such as\n  job-id, task-id, user-id, and job-name.\n  \"\"\"\n  if not arg_1.logging:\n    return\n\n  for arg_3 in arg_2:\n    arg_4 = provider_base.format_logging_uri(\n        arg_1.logging.uri, arg_0, arg_3.task_metadata)\n    arg_5 = job_model.LoggingParam(arg_4,\n                                          arg_1.logging.file_provider)\n\n    if arg_3.task_resources:\n      arg_3.task_resources = arg_3.task_resources._replace(\n          arg_5=arg_5)\n    else:\n      arg_3.task_resources = job_model.Resources(\n          arg_5=arg_5)", "path": "dsub/commands/dsub.py", "identifier": "_resolve_task_logging", "docstring": "Resolve the logging path from job and task properties.\n\n  Args:\n    job_metadata: Job metadata, such as job-id, job-name, and user-id.\n    job_resources: Resources specified such as ram, cpu, and logging path.\n    task_descriptors: Task metadata, parameters, and resources.\n\n  Resolve the logging path, which may have substitution parameters such as\n  job-id, task-id, user-id, and job-name.", "docstring_tokens": ["Resolve", "the", "logging", "path", "from", "job", "and", "task", "properties", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 253634}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/misc/communicator.py#L64-L77", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Poll from the buffer", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "_buffer", ".", "get", "(", "block", "=", "False", ")", "if", "arg_0", ".", "_producer_callback", "is", "not", "None", ":", "arg_0", ".", "_producer_callback", "(", ")", "return", "arg_1", "except", "Queue", ".", "Empty", ":", "Log", ".", "debug", "(", "\"%s: Empty in Func()\"", "%", "str", "(", "arg_0", ")", ")", "raise", "Queue", ".", "Empty"], "function": "def Func(arg_0):\n    \"\"\"Poll from the buffer\n\n    It is a non-blocking operation, and when the buffer is empty, it raises Queue.Empty exception\n    \"\"\"\n    try:\n      # non-blocking\n      arg_1 = arg_0._buffer.get(block=False)\n      if arg_0._producer_callback is not None:\n        arg_0._producer_callback()\n      return arg_1\n    except Queue.Empty:\n      Log.debug(\"%s: Empty in Func()\" % str(arg_0))\n      raise Queue.Empty", "path": "heron/instance/src/python/utils/misc/communicator.py", "identifier": "HeronCommunicator.poll", "docstring": "Poll from the buffer\n\n    It is a non-blocking operation, and when the buffer is empty, it raises Queue.Empty exception", "docstring_tokens": ["Poll", "from", "the", "buffer"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253635}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/latextools.py#L34-L58", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Render a LaTeX string to PNG.", "language": "python", "parameters": "(s, encode=False, backend='mpl')", "return_statement": "return bin_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "'mpl'", ")", ":", "if", "arg_2", "==", "'mpl'", ":", "arg_3", "=", "Func_mpl", "elif", "arg_2", "==", "'dvipng'", ":", "arg_3", "=", "Func_dvipng", "else", ":", "raise", "ValueError", "(", "'No such backend {0}'", ".", "format", "(", "arg_2", ")", ")", "arg_4", "=", "arg_3", "(", "arg_0", ")", "if", "arg_1", "and", "arg_4", ":", "arg_4", "=", "encodestring", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=False, arg_2='mpl'):\n    \"\"\"Render a LaTeX string to PNG.\n\n    Parameters\n    ----------\n    s : str\n        The raw string containing valid inline LaTeX.\n    encode : bool, optional\n        Should the PNG data bebase64 encoded to make it JSON'able.\n    backend : {mpl, dvipng}\n        Backend for producing PNG data.\n\n    None is returned when the backend cannot be used.\n\n    \"\"\"\n    if arg_2 == 'mpl':\n        arg_3 = Func_mpl\n    elif arg_2 == 'dvipng':\n        arg_3 = Func_dvipng\n    else:\n        raise ValueError('No such backend {0}'.format(arg_2))\n    arg_4 = arg_3(arg_0)\n    if arg_1 and arg_4:\n        arg_4 = encodestring(arg_4)\n    return arg_4", "path": "environment/lib/python2.7/site-packages/IPython/lib/latextools.py", "identifier": "latex_to_png", "docstring": "Render a LaTeX string to PNG.\n\n    Parameters\n    ----------\n    s : str\n        The raw string containing valid inline LaTeX.\n    encode : bool, optional\n        Should the PNG data bebase64 encoded to make it JSON'able.\n    backend : {mpl, dvipng}\n        Backend for producing PNG data.\n\n    None is returned when the backend cannot be used.", "docstring_tokens": ["Render", "a", "LaTeX", "string", "to", "PNG", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253636}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/__init__.py#L26-L39", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Decorator to mark plugin functions as entry points for web calls", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "def", "wrapper", "(", "arg_2", ")", ":", "arg_2", ".", "is_Func", "=", "True", "arg_2", ".", "route", "=", "arg_0", "[", "0", "]", "arg_2", ".", "form_params", "=", "arg_1", ".", "get", "(", "'form_params'", ",", "[", "]", ")", "arg_2", ".", "method", "=", "arg_1", ".", "get", "(", "'method'", ",", "'POST'", ")", "return", "arg_2", "return", "wrapper"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    Decorator to mark plugin functions as entry points for web calls\n\n    * route - web route to register, uses Flask syntax\n    * method - GET/POST, defaults to POST\n    \"\"\"\n    def wrapper(arg_2):\n        arg_2.is_Func = True\n        arg_2.route = arg_0[0]\n        arg_2.form_params = arg_1.get('form_params', [])\n        arg_2.method = arg_1.get('method', 'POST')\n        return arg_2\n    return wrapper", "path": "slackminion/plugin/__init__.py", "identifier": "webhook", "docstring": "Decorator to mark plugin functions as entry points for web calls\n\n    * route - web route to register, uses Flask syntax\n    * method - GET/POST, defaults to POST", "docstring_tokens": ["Decorator", "to", "mark", "plugin", "functions", "as", "entry", "points", "for", "web", "calls"], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 253637}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L66-L69", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns the scaled y positions of the points as doubles", "language": "python", "parameters": "(self)", "return_statement": "return scale_dimension(self.Y, self.header.y_scale, self.header.y_offset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "scale_dimension", "(", "arg_0", ".", "Y", ",", "arg_0", ".", "header", ".", "Func_scale", ",", "arg_0", ".", "header", ".", "Func_offset", ")"], "function": "def Func(arg_0):\n        \"\"\" Returns the scaled Func positions of the points as doubles\n        \"\"\"\n        return scale_dimension(arg_0.Y, arg_0.header.Func_scale, arg_0.header.Func_offset)", "path": "pylas/lasdatas/base.py", "identifier": "LasBase.y", "docstring": "Returns the scaled y positions of the points as doubles", "docstring_tokens": ["Returns", "the", "scaled", "y", "positions", "of", "the", "points", "as", "doubles"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 253638}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/lr_scheduled_model.py#L40-L56", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Convert given string label of decay type to special index", "language": "python", "parameters": "(cls, label: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "int", ":", "arg_3", "=", "arg_1", ".", "replace", "(", "'1'", ",", "'one'", ")", ".", "upper", "(", ")", "if", "arg_3", "in", "arg_0", ".", "__members__", ":", "return", "DecayType", "[", "arg_3", "]", "else", ":", "raise", "NotImplementedError"], "function": "def Func(arg_0, arg_1: arg_2) -> int:\n        \"\"\"\n        Convert given string label of decay type to special index\n\n        Args:\n            label: name of decay type.\n                Set of values: `\"linear\"`, `\"cosine\"`, `\"exponential\"`,\n                 `\"onecycle\"`, `\"trapezoid\"`, `[\"polynomial\", K]`, where K is a polynomial power\n\n        Returns:\n            index of decay type\n        \"\"\"\n        arg_3 = arg_1.replace('1', 'one').upper()\n        if arg_3 in arg_0.__members__:\n            return DecayType[arg_3]\n        else:\n            raise NotImplementedError", "path": "deeppavlov/core/models/lr_scheduled_model.py", "identifier": "DecayType.from_str", "docstring": "Convert given string label of decay type to special index\n\n        Args:\n            label: name of decay type.\n                Set of values: `\"linear\"`, `\"cosine\"`, `\"exponential\"`,\n                 `\"onecycle\"`, `\"trapezoid\"`, `[\"polynomial\", K]`, where K is a polynomial power\n\n        Returns:\n            index of decay type", "docstring_tokens": ["Convert", "given", "string", "label", "of", "decay", "type", "to", "special", "index"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 253639}
{"url": "https://github.com/brehaut/picoparse/blob/5e07c8e687a021bba58a5a2a76696c7a7ff35a1c/picoparse/__init__.py#L382-L390", "sha": "5e07c8e687a021bba58a5a2a76696c7a7ff35a1c", "docstring_summary": "Succeeds if the given parser cannot consume input", "language": "python", "parameters": "(parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "tri", "def", "Func_block", "(", ")", ":", "arg_1", "=", "object", "(", ")", "arg_2", "=", "optional", "(", "tri", "(", "arg_0", ")", ",", "arg_1", ")", "if", "arg_2", "!=", "arg_1", ":", "fail", "(", "[", "\"not \"", "+", "_fun_to_str", "(", "arg_0", ")", "]", ")", "choice", "(", "Func_block", ")"], "function": "def Func(arg_0):\n    \"\"\"Succeeds if the given parser cannot consume input\"\"\"\n    @tri\n    def Func_block():\n        arg_1 = object()\n        arg_2 = optional(tri(arg_0), arg_1)\n        if arg_2 != arg_1:\n            fail([\"not \" + _fun_to_str(arg_0)])\n    choice(Func_block)", "path": "picoparse/__init__.py", "identifier": "not_followed_by", "docstring": "Succeeds if the given parser cannot consume input", "docstring_tokens": ["Succeeds", "if", "the", "given", "parser", "cannot", "consume", "input"], "nwo": "brehaut/picoparse", "score": 0.16638194949711382, "idx": 253640}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/validation/base.py#L335-L347", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Deserialize a dict of simple types into an instance of this class.", "language": "python", "parameters": "(cls, dict_)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "schema", ".", "load", "(", "arg_1", ")", "except", "ValidationError", "as", "ex", ":", "raise", "ModelValidationError", "(", "ex", ".", "messages", ",", "ex", ".", "field_names", ",", "ex", ".", "fields", ",", "ex", ".", "data", ",", "**", "ex", ".", "kwargs", ")", "from", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Deserialize a dict of simple types into an instance of this class.\n\n        Note that this method requires that the model is bound with\n        ``@bind_schema``.\n        \"\"\"\n        try:\n            arg_2, arg_3 = arg_0.schema.load(arg_1)\n        except ValidationError as ex:\n            raise ModelValidationError(\n                ex.messages, ex.field_names, ex.fields, ex.data, **ex.kwargs) from None\n\n        return arg_2", "path": "qiskit/validation/base.py", "identifier": "BaseModel.from_dict", "docstring": "Deserialize a dict of simple types into an instance of this class.\n\n        Note that this method requires that the model is bound with\n        ``@bind_schema``.", "docstring_tokens": ["Deserialize", "a", "dict", "of", "simple", "types", "into", "an", "instance", "of", "this", "class", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253641}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/__init__.py#L533-L541", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Checks whether a HTTP status code is in the category denoted by the\n        hundreds digit.", "language": "python", "parameters": "(status, category)", "return_statement": "return status >= cat and status < cat + 100", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", "<", "10", ",", "'HTTP status category must be a one-digit int!'", "arg_2", "=", "arg_1", "*", "100", "return", "arg_0", ">=", "arg_2", "and", "arg_0", "<", "arg_2", "+", "100"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Checks whether a HTTP status code is in the category denoted by the\n        hundreds digit.\n        \"\"\"\n\n        assert arg_1 < 10, 'HTTP status category must be a one-digit int!'\n        arg_2 = arg_1 * 100\n        return arg_0 >= arg_2 and arg_0 < arg_2 + 100", "path": "authomatic/providers/__init__.py", "identifier": "BaseProvider._http_status_in_category", "docstring": "Checks whether a HTTP status code is in the category denoted by the\n        hundreds digit.", "docstring_tokens": ["Checks", "whether", "a", "HTTP", "status", "code", "is", "in", "the", "category", "denoted", "by", "the", "hundreds", "digit", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 253642}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/models/mixins.py#L155-L161", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Send a validation email to the user's email address.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "email_verified", ":", "raise", "ValueError", "(", "_", "(", "'Cannot validate already active user.'", ")", ")", "arg_1", "=", "Site", ".", "objects", ".", "get_current", "(", ")", "arg_0", ".", "validation_notification", "(", "user", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", ".", "notify", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Send a validation email to the user's email address.\"\"\"\n        if arg_0.email_verified:\n            raise ValueError(_('Cannot validate already active user.'))\n\n        arg_1 = Site.objects.get_current()\n        arg_0.validation_notification(user=arg_0, arg_1=arg_1).notify()", "path": "user_management/models/mixins.py", "identifier": "EmailVerifyUserMethodsMixin.send_validation_email", "docstring": "Send a validation email to the user's email address.", "docstring_tokens": ["Send", "a", "validation", "email", "to", "the", "user", "s", "email", "address", "."], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 253643}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/__init__.py#L366-L407", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return a distance between two strings.", "language": "python", "parameters": "(src, tar, method=sim_levenshtein)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "if", "callable", "(", "arg_2", ")", ":", "return", "1", "-", "arg_2", "(", "arg_0", ",", "arg_1", ")", "else", ":", "raise", "AttributeError", "(", "'Unknown Funcance function: '", "+", "str", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n    \"\"\"Return a Funcance between two strings.\n\n    This is a generalized function for calling other Funcance functions.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    method : function\n        Specifies the similarity metric (:py:func:`sim_levenshtein` by default)\n        -- Note that this takes a similarity metric function, not a Funcance\n        metric function.\n\n    Returns\n    -------\n    float\n        Distance according to the specified function\n\n    Raises\n    ------\n    AttributeError\n        Unknown Funcance function\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.333333333333\n    >>> round(Func('Niall', 'Neil'), 12)\n    0.6\n    >>> Func('aluminum', 'Catalan')\n    0.875\n    >>> Func('ATCG', 'TAGC')\n    0.75\n\n    \"\"\"\n    if callable(arg_2):\n        return 1 - arg_2(arg_0, arg_1)\n    else:\n        raise AttributeError('Unknown Funcance function: ' + str(arg_2))", "path": "abydos/distance/__init__.py", "identifier": "dist", "docstring": "Return a distance between two strings.\n\n    This is a generalized function for calling other distance functions.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    method : function\n        Specifies the similarity metric (:py:func:`sim_levenshtein` by default)\n        -- Note that this takes a similarity metric function, not a distance\n        metric function.\n\n    Returns\n    -------\n    float\n        Distance according to the specified function\n\n    Raises\n    ------\n    AttributeError\n        Unknown distance function\n\n    Examples\n    --------\n    >>> round(dist('cat', 'hat'), 12)\n    0.333333333333\n    >>> round(dist('Niall', 'Neil'), 12)\n    0.6\n    >>> dist('aluminum', 'Catalan')\n    0.875\n    >>> dist('ATCG', 'TAGC')\n    0.75", "docstring_tokens": ["Return", "a", "distance", "between", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253644}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/www/security.py#L500-L560", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Set the access policy on the given DAG's ViewModel.", "language": "python", "parameters": "(self, dag_id, access_control)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "_get_or_create_dag_permission", "(", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "find_permission_view_menu", "(", "arg_3", ",", "arg_1", ")", "if", "not", "arg_4", ":", "arg_0", ".", "log", ".", "info", "(", "\"Creating new permission '%s' on view '%s'\"", ",", "arg_3", ",", "arg_1", ")", "arg_4", "=", "arg_0", ".", "add_permission_view_menu", "(", "arg_3", ",", "arg_1", ")", "return", "arg_4", "def", "_revoke_stale_permissions", "(", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "find_permissions_view_menu", "(", "arg_5", ")", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "[", "arg_9", "for", "arg_9", "in", "arg_7", ".", "role", "if", "arg_9", ".", "name", "!=", "'Admin'", "]", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "arg_2", ".", "get", "(", "arg_9", ".", "name", ",", "{", "}", ")", "if", "arg_7", ".", "permission", ".", "name", "not", "in", "arg_10", ":", "arg_0", ".", "log", ".", "info", "(", "\"Revoking '%s' on DAG '%s' for role '%s'\"", ",", "arg_7", ".", "permission", ",", "arg_1", ",", "arg_9", ".", "name", ")", "arg_0", ".", "del_permission_role", "(", "arg_9", ",", "arg_7", ")", "arg_5", "=", "arg_0", ".", "find_view_menu", "(", "arg_1", ")", "if", "arg_5", ":", "_revoke_stale_permissions", "(", "arg_5", ")", "for", "arg_11", ",", "arg_12", "in", "arg_2", ".", "items", "(", ")", ":", "arg_9", "=", "arg_0", ".", "find_role", "(", "arg_11", ")", "if", "not", "arg_9", ":", "raise", "AirflowException", "(", "\"The access_control mapping for DAG '{}' includes a role \"", "\"named '{}', but that role does not exist\"", ".", "format", "(", "arg_1", ",", "arg_11", ")", ")", "arg_12", "=", "set", "(", "arg_12", ")", "arg_13", "=", "arg_12", "-", "arg_0", ".", "DAG_PERMS", "if", "arg_13", ":", "raise", "AirflowException", "(", "\"The access_control map for DAG '{}' includes the following \"", "\"invalid permissions: {}; The set of valid permissions \"", "\"is: {}\"", ".", "format", "(", "arg_1", ",", "(", "arg_12", "-", "arg_0", ".", "DAG_PERMS", ")", ",", "arg_0", ".", "DAG_PERMS", ")", ")", "for", "arg_3", "in", "arg_12", ":", "arg_4", "=", "_get_or_create_dag_permission", "(", "arg_3", ")", "arg_0", ".", "add_permission_role", "(", "arg_9", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Set the access policy on the given DAG's ViewModel.\n\n        :param dag_id: the ID of the DAG whose permissions should be updated\n        :type dag_id: string\n        :param access_control: a dict where each key is a rolename and\n            each value is a set() of permission names (e.g.,\n            {'can_dag_read'}\n        :type access_control: dict\n        \"\"\"\n        def _get_or_create_dag_permission(arg_3):\n            arg_4 = arg_0.find_permission_view_menu(arg_3, arg_1)\n            if not arg_4:\n                arg_0.log.info(\n                    \"Creating new permission '%s' on view '%s'\",\n                    arg_3, arg_1\n                )\n                arg_4 = arg_0.add_permission_view_menu(arg_3, arg_1)\n\n            return arg_4\n\n        def _revoke_stale_permissions(arg_5):\n            arg_6 = arg_0.find_permissions_view_menu(arg_5)\n            for arg_7 in arg_6:\n                arg_8 = [arg_9 for arg_9 in arg_7.role\n                                   if arg_9.name != 'Admin']\n                for arg_9 in arg_8:\n                    arg_10 = arg_2.get(arg_9.name, {})\n                    if arg_7.permission.name not in arg_10:\n                        arg_0.log.info(\n                            \"Revoking '%s' on DAG '%s' for role '%s'\",\n                            arg_7.permission, arg_1, arg_9.name\n                        )\n                        arg_0.del_permission_role(arg_9, arg_7)\n\n        arg_5 = arg_0.find_view_menu(arg_1)\n        if arg_5:\n            _revoke_stale_permissions(arg_5)\n\n        for arg_11, arg_12 in arg_2.items():\n            arg_9 = arg_0.find_role(arg_11)\n            if not arg_9:\n                raise AirflowException(\n                    \"The access_control mapping for DAG '{}' includes a role \"\n                    \"named '{}', but that role does not exist\".format(\n                        arg_1,\n                        arg_11))\n\n            arg_12 = set(arg_12)\n            arg_13 = arg_12 - arg_0.DAG_PERMS\n            if arg_13:\n                raise AirflowException(\n                    \"The access_control map for DAG '{}' includes the following \"\n                    \"invalid permissions: {}; The set of valid permissions \"\n                    \"is: {}\".format(arg_1,\n                                    (arg_12 - arg_0.DAG_PERMS),\n                                    arg_0.DAG_PERMS))\n\n            for arg_3 in arg_12:\n                arg_4 = _get_or_create_dag_permission(arg_3)\n                arg_0.add_permission_role(arg_9, arg_4)", "path": "airflow/www/security.py", "identifier": "AirflowSecurityManager._sync_dag_view_permissions", "docstring": "Set the access policy on the given DAG's ViewModel.\n\n        :param dag_id: the ID of the DAG whose permissions should be updated\n        :type dag_id: string\n        :param access_control: a dict where each key is a rolename and\n            each value is a set() of permission names (e.g.,\n            {'can_dag_read'}\n        :type access_control: dict", "docstring_tokens": ["Set", "the", "access", "policy", "on", "the", "given", "DAG", "s", "ViewModel", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253645}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/rrule.py#L214-L230", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Returns the first recurrence after the given datetime instance. The\n            inc keyword defines what happens if dt is an occurrence. With\n            inc=True, if dt itself is an occurrence, it will be returned.", "language": "python", "parameters": "(self, dt, inc=False)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_0", ".", "_cache_complete", ":", "arg_3", "=", "arg_0", ".", "_cache", "else", ":", "arg_3", "=", "arg_0", "if", "arg_2", ":", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ">=", "arg_1", ":", "return", "arg_4", "else", ":", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ">", "arg_1", ":", "return", "arg_4", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\" Returns the first recurrence Func the given datetime instance. The\n            inc keyword defines what happens if dt is an occurrence. With\n            inc=True, if dt itself is an occurrence, it will be returned.  \"\"\"\n        if arg_0._cache_complete:\n            arg_3 = arg_0._cache\n        else:\n            arg_3 = arg_0\n        if arg_2:\n            for arg_4 in arg_3:\n                if arg_4 >= arg_1:\n                    return arg_4\n        else:\n            for arg_4 in arg_3:\n                if arg_4 > arg_1:\n                    return arg_4\n        return None", "path": "superjson/pkg/dateutil/rrule.py", "identifier": "rrulebase.after", "docstring": "Returns the first recurrence after the given datetime instance. The\n            inc keyword defines what happens if dt is an occurrence. With\n            inc=True, if dt itself is an occurrence, it will be returned.", "docstring_tokens": ["Returns", "the", "first", "recurrence", "after", "the", "given", "datetime", "instance", ".", "The", "inc", "keyword", "defines", "what", "happens", "if", "dt", "is", "an", "occurrence", ".", "With", "inc", "=", "True", "if", "dt", "itself", "is", "an", "occurrence", "it", "will", "be", "returned", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 253646}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L309-L351", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Transform input according to potentially registered XSLT", "language": "python", "parameters": "(self, work, xml, objectId, subreference=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "str", "(", "arg_3", ")", "in", "arg_0", ".", "_Func", ":", "arg_5", "=", "arg_0", ".", "_Func", "[", "str", "(", "arg_3", ")", "]", "else", ":", "arg_5", "=", "arg_0", ".", "_Func", "[", "\"default\"", "]", "if", "isinstance", "(", "arg_5", ",", "str", ")", ":", "with", "open", "(", "arg_5", ")", "as", "f", ":", "arg_6", "=", "etree", ".", "XSLT", "(", "etree", ".", "parse", "(", "f", ")", ")", "return", "etree", ".", "tostring", "(", "arg_6", "(", "arg_2", ")", ",", "encoding", "=", "str", ",", "method", "=", "\"html\"", ",", "xml_declaration", "=", "None", ",", "pretty_print", "=", "False", ",", "with_tail", "=", "True", ",", "standalone", "=", "None", ")", "elif", "isinstance", "(", "arg_5", ",", "Callable", ")", ":", "return", "arg_5", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "elif", "arg_5", "is", "None", ":", "return", "etree", ".", "tostring", "(", "arg_2", ",", "encoding", "=", "str", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\" Transform input according to potentially registered XSLT\n\n        .. note:: Since 1.0.0, Func takes an objectId parameter which represent the passage which is called\n\n        .. note:: Due to XSLT not being able to be used twice, we rexsltise the xml at every call of xslt\n\n        .. warning:: Until a C libxslt error is fixed ( https://bugzilla.gnome.org/show_bug.cgi?id=620102 ), \\\n        it is not possible to use strip tags in the xslt given to this application\n\n        :param work: Work object containing metadata about the xml\n        :type work: MyCapytains.resources.inventory.Text\n        :param xml: XML to Func\n        :type xml: etree._Element\n        :param objectId: Object Identifier\n        :type objectId: str\n        :param subreference: Subreference\n        :type subreference: str\n        :return: String representation of Funced resource\n        :rtype: str\n        \"\"\"\n        # We check first that we don't have\n        if str(arg_3) in arg_0._Func:\n            arg_5 = arg_0._Func[str(arg_3)]\n        else:\n            arg_5 = arg_0._Func[\"default\"]\n\n        # If we have a string, it means we get a XSL filepath\n        if isinstance(arg_5, str):\n            with open(arg_5) as f:\n                arg_6 = etree.XSLT(etree.parse(f))\n            return etree.tostring(\n                arg_6(arg_2),\n                encoding=str, method=\"html\",\n                xml_declaration=None, pretty_print=False, with_tail=True, standalone=None\n            )\n\n        # If we have a function, it means we return the result of the function\n        elif isinstance(arg_5, Callable):\n            return arg_5(arg_1, arg_2, arg_3, arg_4)\n        # If we have None, it means we just give back the xml\n        elif arg_5 is None:\n            return etree.tostring(arg_2, encoding=str)", "path": "flask_nemo/__init__.py", "identifier": "Nemo.transform", "docstring": "Transform input according to potentially registered XSLT\n\n        .. note:: Since 1.0.0, transform takes an objectId parameter which represent the passage which is called\n\n        .. note:: Due to XSLT not being able to be used twice, we rexsltise the xml at every call of xslt\n\n        .. warning:: Until a C libxslt error is fixed ( https://bugzilla.gnome.org/show_bug.cgi?id=620102 ), \\\n        it is not possible to use strip tags in the xslt given to this application\n\n        :param work: Work object containing metadata about the xml\n        :type work: MyCapytains.resources.inventory.Text\n        :param xml: XML to transform\n        :type xml: etree._Element\n        :param objectId: Object Identifier\n        :type objectId: str\n        :param subreference: Subreference\n        :type subreference: str\n        :return: String representation of transformed resource\n        :rtype: str", "docstring_tokens": ["Transform", "input", "according", "to", "potentially", "registered", "XSLT"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 253647}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/views.py#L831-L911", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Produces the registration manifest for people with the given product\n    type.", "language": "python", "parameters": "(request, form)", "return_statement": "return ListReport(\"Manifest\", headings, output)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "cleaned_data", "[", "\"product\"", "]", "arg_3", "=", "arg_1", ".", "cleaned_data", "[", "\"category\"", "]", "arg_4", "=", "(", "Q", "(", "lineitem__product__in", "=", "arg_2", ")", "|", "Q", "(", "lineitem__product__category__in", "=", "arg_3", ")", ")", "arg_5", "=", "commerce", ".", "Invoice", ".", "objects", ".", "filter", "(", "arg_4", ",", "status", "=", "commerce", ".", "Invoice", ".", "STATUS_PAID", ",", ")", ".", "select_related", "(", "\"cart\"", ",", "\"user\"", ",", "\"user__attendee\"", ",", "\"user__attendee__attendeeprofilebase\"", ")", "arg_6", "=", "set", "(", "i", ".", "user", "for", "i", "in", "arg_5", ")", "arg_7", "=", "commerce", ".", "Cart", ".", "objects", ".", "filter", "(", "user__in", "=", "arg_6", ")", "arg_8", "=", "commerce", ".", "ProductItem", ".", "objects", ".", "filter", "(", "cart__in", "=", "arg_7", ")", ".", "select_related", "(", "\"product\"", ",", "\"product__category\"", ",", "\"cart\"", ",", "\"cart__user\"", ",", "\"cart__user__attendee\"", ",", "\"cart__user__attendee__attendeeprofilebase\"", ")", ".", "order_by", "(", "\"product__category__order\"", ",", "\"product__order\"", ")", "arg_6", "=", "{", "}", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "arg_9", ".", "cart", "if", "arg_10", ".", "user", "not", "in", "arg_6", ":", "arg_6", "[", "arg_10", ".", "user", "]", "=", "{", "\"unpaid\"", ":", "[", "]", ",", "\"paid\"", ":", "[", "]", ",", "\"refunded\"", ":", "[", "]", "}", "arg_8", "=", "arg_6", "[", "arg_10", ".", "user", "]", "if", "arg_10", ".", "status", "==", "commerce", ".", "Cart", ".", "STATUS_ACTIVE", ":", "arg_8", "[", "\"unpaid\"", "]", ".", "append", "(", "arg_9", ")", "elif", "arg_10", ".", "status", "==", "commerce", ".", "Cart", ".", "STATUS_PAID", ":", "arg_8", "[", "\"paid\"", "]", ".", "append", "(", "arg_9", ")", "elif", "arg_10", ".", "status", "==", "commerce", ".", "Cart", ".", "STATUS_RELEASED", ":", "arg_8", "[", "\"refunded\"", "]", ".", "append", "(", "arg_9", ")", "arg_12", "=", "list", "(", "arg_6", ".", "keys", "(", ")", ")", "arg_12", ".", "sort", "(", "key", "=", "(", "lambda", "i", ":", "i", ".", "attendee", ".", "attendeeprofilebase", ".", "attendee_name", "(", ")", ".", "lower", "(", ")", ")", ")", "arg_13", "=", "[", "\"User ID\"", ",", "\"Name\"", ",", "\"Paid\"", ",", "\"Unpaid\"", ",", "\"Refunded\"", "]", "def", "format_items", "(", "arg_14", ")", ":", "arg_15", "=", "[", "'%d x %s'", "%", "(", "arg_9", ".", "quantity", ",", "str", "(", "arg_9", ".", "product", ")", ")", "for", "arg_9", "in", "arg_14", "]", "return", "\", \\n\"", ".", "join", "(", "arg_15", ")", "arg_16", "=", "[", "]", "for", "arg_11", "in", "arg_12", ":", "arg_8", "=", "arg_6", "[", "arg_11", "]", "arg_16", ".", "append", "(", "[", "arg_11", ".", "id", ",", "arg_11", ".", "attendee", ".", "attendeeprofilebase", ".", "attendee_name", "(", ")", ",", "format_items", "(", "arg_8", "[", "\"paid\"", "]", ")", ",", "format_items", "(", "arg_8", "[", "\"unpaid\"", "]", ")", ",", "format_items", "(", "arg_8", "[", "\"refunded\"", "]", ")", ",", "]", ")", "return", "ListReport", "(", "\"Manifest\"", ",", "arg_13", ",", "arg_16", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Produces the registration Func for people with the given product\n    type.\n    '''\n\n    arg_2 = arg_1.cleaned_data[\"product\"]\n    arg_3 = arg_1.cleaned_data[\"category\"]\n\n    arg_4 = (\n        Q(lineitem__product__in=arg_2) |\n        Q(lineitem__product__category__in=arg_3)\n    )\n\n    arg_5 = commerce.Invoice.objects.filter(\n        arg_4,\n        status=commerce.Invoice.STATUS_PAID,\n    ).select_related(\n        \"cart\",\n        \"user\",\n        \"user__attendee\",\n        \"user__attendee__attendeeprofilebase\"\n    )\n\n    arg_6 = set(i.user for i in arg_5)\n\n    arg_7 = commerce.Cart.objects.filter(\n        user__in=arg_6\n    )\n\n    arg_8 = commerce.ProductItem.objects.filter(\n        cart__in=arg_7\n    ).select_related(\n        \"product\",\n        \"product__category\",\n        \"cart\",\n        \"cart__user\",\n        \"cart__user__attendee\",\n        \"cart__user__attendee__attendeeprofilebase\"\n    ).order_by(\"product__category__order\", \"product__order\")\n\n    arg_6 = {}\n\n    for arg_9 in arg_8:\n        arg_10 = arg_9.cart\n        if arg_10.user not in arg_6:\n            arg_6[arg_10.user] = {\"unpaid\": [], \"paid\": [], \"refunded\": []}\n        arg_8 = arg_6[arg_10.user]\n        if arg_10.status == commerce.Cart.STATUS_ACTIVE:\n            arg_8[\"unpaid\"].append(arg_9)\n        elif arg_10.status == commerce.Cart.STATUS_PAID:\n            arg_8[\"paid\"].append(arg_9)\n        elif arg_10.status == commerce.Cart.STATUS_RELEASED:\n            arg_8[\"refunded\"].append(arg_9)\n\n    arg_12 = list(arg_6.keys())\n    arg_12.sort(key=(\n        lambda i: i.attendee.attendeeprofilebase.attendee_name().lower()\n    ))\n\n    arg_13 = [\"User ID\", \"Name\", \"Paid\", \"Unpaid\", \"Refunded\"]\n\n    def format_items(arg_14):\n        arg_15 = [\n            '%d x %s' % (arg_9.quantity, str(arg_9.product))\n            for arg_9 in arg_14\n        ]\n        return \", \\n\".join(arg_15)\n\n    arg_16 = []\n    for arg_11 in arg_12:\n        arg_8 = arg_6[arg_11]\n        arg_16.append([\n            arg_11.id,\n            arg_11.attendee.attendeeprofilebase.attendee_name(),\n            format_items(arg_8[\"paid\"]),\n            format_items(arg_8[\"unpaid\"]),\n            format_items(arg_8[\"refunded\"]),\n        ])\n\n    return ListReport(\"Manifest\", arg_13, arg_16)", "path": "registrasion/reporting/views.py", "identifier": "manifest", "docstring": "Produces the registration manifest for people with the given product\n    type.", "docstring_tokens": ["Produces", "the", "registration", "manifest", "for", "people", "with", "the", "given", "product", "type", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 253648}
{"url": "https://github.com/umich-brcf-bioinf/Jacquard/blob/83dd61dd2b5e4110468493beec7bc121e6cb3cd1/jacquard/utils/vcf.py#L313-L326", "sha": "83dd61dd2b5e4110468493beec7bc121e6cb3cd1", "docstring_summary": "Updates info attribute from info dict.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "info_dict", ":", "arg_1", "=", "[", "]", "if", "len", "(", "arg_0", ".", "info_dict", ")", ">", "1", ":", "arg_0", ".", "info_dict", ".", "pop", "(", "\".\"", ",", "None", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "info_dict", ".", "items", "(", ")", ":", "if", "arg_2", "==", "arg_3", ":", "arg_1", ".", "append", "(", "arg_3", ")", "else", ":", "arg_1", ".", "append", "(", "\"=\"", ".", "join", "(", "[", "arg_2", ",", "arg_3", "]", ")", ")", "arg_0", ".", "info", "=", "\";\"", ".", "join", "(", "arg_1", ")", "else", ":", "arg_0", ".", "info", "=", "\".\""], "function": "def Func(arg_0):\n        \"\"\"Updates info attribute from info dict.\"\"\"\n        if arg_0.info_dict:\n            arg_1 = []\n            if len(arg_0.info_dict) > 1:\n                arg_0.info_dict.pop(\".\", None)\n            for arg_2, arg_3 in arg_0.info_dict.items():\n                if arg_2 == arg_3:\n                    arg_1.append(arg_3)\n                else:\n                    arg_1.append(\"=\".join([arg_2, arg_3]))\n            arg_0.info = \";\".join(arg_1)\n        else:\n            arg_0.info = \".\"", "path": "jacquard/utils/vcf.py", "identifier": "VcfRecord._join_info_fields", "docstring": "Updates info attribute from info dict.", "docstring_tokens": ["Updates", "info", "attribute", "from", "info", "dict", "."], "nwo": "umich-brcf-bioinf/Jacquard", "score": 0.27831918678159157, "idx": 253649}
{"url": "https://github.com/nsqio/pynsq/blob/48bf62d65ea63cddaa401efb23187b95511dbc84/nsq/event.py#L44-L57", "sha": "48bf62d65ea63cddaa401efb23187b95511dbc84", "docstring_summary": "Listen for the named event with the specified callback.", "language": "python", "parameters": "(self, name, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "callable", "(", "arg_2", ")", ",", "'callback is not callable'", "if", "arg_2", "in", "arg_0", ".", "__listeners", "[", "arg_1", "]", ":", "raise", "DuplicateListenerError", "arg_0", ".", "__listeners", "[", "arg_1", "]", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Listen for the named event with the specified callback.\n\n        :param name: the name of the event\n        :type name: string\n\n        :param callback: the callback to execute when the event is triggered\n        :type callback: callable\n        \"\"\"\n        assert callable(arg_2), 'callback is not callable'\n        if arg_2 in arg_0.__listeners[arg_1]:\n            raise DuplicateListenerError\n        arg_0.__listeners[arg_1].append(arg_2)", "path": "nsq/event.py", "identifier": "EventedMixin.on", "docstring": "Listen for the named event with the specified callback.\n\n        :param name: the name of the event\n        :type name: string\n\n        :param callback: the callback to execute when the event is triggered\n        :type callback: callable", "docstring_tokens": ["Listen", "for", "the", "named", "event", "with", "the", "specified", "callback", "."], "nwo": "nsqio/pynsq", "score": 0.4773523738069914, "idx": 253650}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L1185-L1191", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Modulo addition operation", "language": "python", "parameters": "(self, a, b, c)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "arg_4", "=", "Operators", ".", "ITEBV", "(", "256", ",", "arg_3", "==", "0", ",", "0", ",", "(", "arg_1", "+", "arg_2", ")", "%", "arg_3", ")", "except", "ZeroDivisionError", ":", "arg_4", "=", "0", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Modulo addition operation\"\"\"\n        try:\n            arg_4 = Operators.ITEBV(256, arg_3 == 0, 0, (arg_1 + arg_2) % arg_3)\n        except ZeroDivisionError:\n            arg_4 = 0\n        return arg_4", "path": "manticore/platforms/evm.py", "identifier": "EVM.ADDMOD", "docstring": "Modulo addition operation", "docstring_tokens": ["Modulo", "addition", "operation"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253651}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L479-L592", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Try to find an InstallationCandidate for req", "language": "python", "parameters": "(self, req, upgrade)", "return_statement": "return selected_version", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_find_all_versions", "(", "arg_1", ".", "name", ")", "arg_4", "=", "set", "(", "arg_1", ".", "specifier", ".", "filter", "(", "[", "x", ".", "version", "for", "x", "in", "arg_3", "]", ",", "prereleases", "=", "(", "arg_0", ".", "allow_all_prereleases", "if", "arg_0", ".", "allow_all_prereleases", "else", "None", ")", ",", ")", ")", "arg_5", "=", "[", "x", "for", "x", "in", "arg_3", "if", "x", ".", "version", "in", "arg_4", "]", "if", "arg_1", ".", "satisfied_by", "is", "not", "None", ":", "arg_5", ".", "insert", "(", "0", ",", "InstallationCandidate", "(", "arg_1", ".", "name", ",", "arg_1", ".", "satisfied_by", ".", "version", ",", "INSTALLED_VERSION", ",", ")", ")", "arg_6", "=", "True", "else", ":", "arg_6", "=", "False", "arg_5", "=", "arg_0", ".", "_sort_versions", "(", "arg_5", ")", "if", "not", "arg_2", "and", "arg_6", ":", "if", "arg_5", "[", "0", "]", ".", "location", "is", "INSTALLED_VERSION", ":", "logger", ".", "debug", "(", "'Existing installed version (%s) is most up-to-date and '", "'satisfies requirement'", ",", "arg_1", ".", "satisfied_by", ".", "version", ",", ")", "else", ":", "logger", ".", "debug", "(", "'Existing installed version (%s) satisfies requirement '", "'(most up-to-date version is %s)'", ",", "arg_1", ".", "satisfied_by", ".", "version", ",", "arg_5", "[", "0", "]", "[", "2", "]", ",", ")", "return", "None", "if", "not", "arg_5", ":", "logger", ".", "critical", "(", "'Could not find a version that satisfies the requirement %s '", "'(from versions: %s)'", ",", "arg_1", ",", "', '", ".", "join", "(", "sorted", "(", "set", "(", "str", "(", "arg_7", ".", "version", ")", "for", "arg_7", "in", "arg_3", ")", ",", "key", "=", "parse_version", ",", ")", ")", ")", "if", "arg_0", ".", "need_warn_external", ":", "logger", ".", "warning", "(", "\"Some externally hosted files were ignored as access to \"", "\"them may be unreliable (use --allow-external %s to \"", "\"allow).\"", ",", "arg_1", ".", "name", ",", ")", "if", "arg_0", ".", "need_warn_unverified", ":", "logger", ".", "warning", "(", "\"Some insecure and unverifiable files were ignored\"", "\" (use --allow-unverified %s to allow).\"", ",", "arg_1", ".", "name", ",", ")", "raise", "DistributionNotFound", "(", "'No matching distribution found for %s'", "%", "arg_1", ")", "if", "arg_5", "[", "0", "]", ".", "location", "is", "INSTALLED_VERSION", ":", "logger", ".", "debug", "(", "'Installed version (%s) is most up-to-date (past versions: '", "'%s)'", ",", "arg_1", ".", "satisfied_by", ".", "version", ",", "', '", ".", "join", "(", "str", "(", "arg_7", ".", "version", ")", "for", "arg_7", "in", "arg_5", "[", "1", ":", "]", ")", "or", "\"none\"", ",", ")", "raise", "BestVersionAlreadyInstalled", "if", "len", "(", "arg_5", ")", ">", "1", ":", "logger", ".", "debug", "(", "'Using version %s (newest of versions: %s)'", ",", "arg_5", "[", "0", "]", ".", "version", ",", "', '", ".", "join", "(", "str", "(", "arg_7", ".", "version", ")", "for", "arg_7", "in", "arg_5", ")", ")", "arg_8", "=", "arg_5", "[", "0", "]", ".", "location", "if", "(", "arg_8", ".", "verifiable", "is", "not", "None", "and", "not", "arg_8", ".", "verifiable", ")", ":", "logger", ".", "warning", "(", "\"%s is potentially insecure and unverifiable.\"", ",", "arg_1", ".", "name", ",", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Try to find an InstallationCandidate for req\n\n        Expects req, an InstallRequirement and upgrade, a boolean\n        Returns an InstallationCandidate or None\n        May raise DistributionNotFound or BestVersionAlreadyInstalled\n        \"\"\"\n        arg_3 = arg_0._find_all_versions(arg_1.name)\n        # Filter out anything which doesn't match our specifier\n\n        arg_4 = set(\n            arg_1.specifier.filter(\n                [x.version for x in arg_3],\n                prereleases=(\n                    arg_0.allow_all_prereleases\n                    if arg_0.allow_all_prereleases else None\n                ),\n            )\n        )\n        arg_5 = [\n            x for x in arg_3 if x.version in arg_4\n        ]\n\n        if arg_1.satisfied_by is not None:\n            # Finally add our existing versions to the front of our versions.\n            arg_5.insert(\n                0,\n                InstallationCandidate(\n                    arg_1.name,\n                    arg_1.satisfied_by.version,\n                    INSTALLED_VERSION,\n                )\n            )\n            arg_6 = True\n        else:\n            arg_6 = False\n\n        arg_5 = arg_0._sort_versions(arg_5)\n\n        if not arg_2 and arg_6:\n            if arg_5[0].location is INSTALLED_VERSION:\n                logger.debug(\n                    'Existing installed version (%s) is most up-to-date and '\n                    'satisfies requirement',\n                    arg_1.satisfied_by.version,\n                )\n            else:\n                logger.debug(\n                    'Existing installed version (%s) satisfies requirement '\n                    '(most up-to-date version is %s)',\n                    arg_1.satisfied_by.version,\n                    arg_5[0][2],\n                )\n            return None\n\n        if not arg_5:\n            logger.critical(\n                'Could not find a version that satisfies the requirement %s '\n                '(from versions: %s)',\n                arg_1,\n                ', '.join(\n                    sorted(\n                        set(str(arg_7.version) for arg_7 in arg_3),\n                        key=parse_version,\n                    )\n                )\n            )\n\n            if arg_0.need_warn_external:\n                logger.warning(\n                    \"Some externally hosted files were ignored as access to \"\n                    \"them may be unreliable (use --allow-external %s to \"\n                    \"allow).\",\n                    arg_1.name,\n                )\n\n            if arg_0.need_warn_unverified:\n                logger.warning(\n                    \"Some insecure and unverifiable files were ignored\"\n                    \" (use --allow-unverified %s to allow).\",\n                    arg_1.name,\n                )\n\n            raise DistributionNotFound(\n                'No matching distribution found for %s' % arg_1\n            )\n\n        if arg_5[0].location is INSTALLED_VERSION:\n            # We have an existing version, and its the best version\n            logger.debug(\n                'Installed version (%s) is most up-to-date (past versions: '\n                '%s)',\n                arg_1.satisfied_by.version,\n                ', '.join(str(arg_7.version) for arg_7 in arg_5[1:]) or\n                \"none\",\n            )\n            raise BestVersionAlreadyInstalled\n\n        if len(arg_5) > 1:\n            logger.debug(\n                'Using version %s (newest of versions: %s)',\n                arg_5[0].version,\n                ', '.join(str(arg_7.version) for arg_7 in arg_5)\n            )\n\n        arg_8 = arg_5[0].location\n\n        if (arg_8.verifiable is not None and not\n                arg_8.verifiable):\n            logger.warning(\n                \"%s is potentially insecure and unverifiable.\", arg_1.name,\n            )\n\n        return arg_8", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/index.py", "identifier": "PackageFinder.find_requirement", "docstring": "Try to find an InstallationCandidate for req\n\n        Expects req, an InstallRequirement and upgrade, a boolean\n        Returns an InstallationCandidate or None\n        May raise DistributionNotFound or BestVersionAlreadyInstalled", "docstring_tokens": ["Try", "to", "find", "an", "InstallationCandidate", "for", "req"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253652}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/functions.py#L218-L244", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Check whether a year is a leap year.", "language": "python", "parameters": "(x)", "return_statement": "return pd.Series(x).dt.is_leap_year.values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "pandas", "as", "pd", "return", "pd", ".", "Series", "(", "arg_0", ")", ".", "dt", ".", "is_leap_year", ".", "values"], "function": "def Func(arg_0):\n    \"\"\"Check whether a year is a leap year.\n\n    :returns: an expression which evaluates to True if a year is a leap year, and to False otherwise.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.is_leap_year\n    Expression = Func(date)\n    Length: 3 dtype: bool (expression)\n    ----------------------------------\n    0  False\n    1   True\n    2  False\n    \"\"\"\n    import pandas as pd\n    return pd.Series(arg_0).dt.is_leap_year.values", "path": "packages/vaex-core/vaex/functions.py", "identifier": "dt_is_leap_year", "docstring": "Check whether a year is a leap year.\n\n    :returns: an expression which evaluates to True if a year is a leap year, and to False otherwise.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.is_leap_year\n    Expression = dt_is_leap_year(date)\n    Length: 3 dtype: bool (expression)\n    ----------------------------------\n    0  False\n    1   True\n    2  False", "docstring_tokens": ["Check", "whether", "a", "year", "is", "a", "leap", "year", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 253653}
{"url": "https://github.com/sergedomk/fiql_parser/blob/499dd7cd0741603530ce5f3803d92813e74ac9c3/fiql_parser/parser.py#L62-L123", "sha": "499dd7cd0741603530ce5f3803d92813e74ac9c3", "docstring_summary": "Parse a FIQL formatted string into an ``Expression``.", "language": "python", "parameters": "(fiql_str)", "return_statement": "return expression", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "None", "arg_3", "=", "Expression", "(", ")", "for", "(", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "in", "iter_parse", "(", "arg_0", ")", ":", "if", "arg_4", ":", "for", "arg_8", "in", "arg_4", ":", "if", "arg_8", "==", "'('", ":", "if", "isinstance", "(", "arg_2", ",", "BaseExpression", ")", ":", "raise", "FiqlFormatException", "(", "\"%s can not be followed by %s\"", "%", "(", "arg_2", ".", "__class__", ",", "Expression", ")", ")", "arg_3", "=", "arg_3", ".", "create_nested_expression", "(", ")", "arg_1", "+=", "1", "elif", "arg_8", "==", "')'", ":", "arg_3", "=", "arg_3", ".", "get_parent", "(", ")", "arg_2", "=", "arg_3", "arg_1", "-=", "1", "else", ":", "if", "not", "arg_3", ".", "has_constraint", "(", ")", ":", "raise", "FiqlFormatException", "(", "\"%s proceeding initial %s\"", "%", "(", "Operator", ",", "Constraint", ")", ")", "if", "isinstance", "(", "arg_2", ",", "Operator", ")", ":", "raise", "FiqlFormatException", "(", "\"%s can not be followed by %s\"", "%", "(", "Operator", ",", "Operator", ")", ")", "arg_2", "=", "Operator", "(", "arg_8", ")", "arg_3", "=", "arg_3", ".", "add_operator", "(", "arg_2", ")", "if", "arg_5", ":", "if", "isinstance", "(", "arg_2", ",", "BaseExpression", ")", ":", "raise", "FiqlFormatException", "(", "\"%s can not be followed by %s\"", "%", "(", "arg_2", ".", "__class__", ",", "Constraint", ")", ")", "arg_2", "=", "Constraint", "(", "arg_5", ",", "arg_6", ",", "arg_7", ")", "arg_3", ".", "add_element", "(", "arg_2", ")", "if", "arg_1", "!=", "0", ":", "raise", "FiqlFormatException", "(", "\"At least one nested expression was not correctly closed\"", ")", "if", "not", "arg_3", ".", "has_constraint", "(", ")", ":", "raise", "FiqlFormatException", "(", "\"Parsed string '%s' contained no constraint\"", "%", "arg_0", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Parse a FIQL formatted string into an ``Expression``.\n\n    Args:\n        fiql_str (string): The FIQL formatted string we want to parse.\n\n    Returns:\n        Expression: An ``Expression`` object representing the parsed FIQL\n        string.\n\n    Raises:\n        FiqlFormatException: Unable to parse string due to incorrect\n            formatting.\n\n    Example:\n\n        >>> expression = Func(\n        ...         \"name==bar,dob=gt=1990-01-01\")\n\n    \"\"\"\n    #pylint: disable=too-many-branches\n    arg_1 = 0\n    arg_2 = None\n    arg_3 = Expression()\n    for (arg_4, arg_5, arg_6, arg_7) in iter_parse(arg_0):\n        if arg_4:\n            for arg_8 in arg_4:\n                if arg_8 == '(':\n                    if isinstance(arg_2, BaseExpression):\n                        raise FiqlFormatException(\n                            \"%s can not be followed by %s\" % (\n                                arg_2.__class__, Expression))\n                    arg_3 = arg_3.create_nested_expression()\n                    arg_1 += 1\n                elif arg_8 == ')':\n                    arg_3 = arg_3.get_parent()\n                    arg_2 = arg_3\n                    arg_1 -= 1\n                else:\n                    if not arg_3.has_constraint():\n                        raise FiqlFormatException(\n                            \"%s proceeding initial %s\" % (\n                                Operator, Constraint))\n                    if isinstance(arg_2, Operator):\n                        raise FiqlFormatException(\n                            \"%s can not be followed by %s\" % (\n                                Operator, Operator))\n                    arg_2 = Operator(arg_8)\n                    arg_3 = arg_3.add_operator(arg_2)\n        if arg_5:\n            if isinstance(arg_2, BaseExpression):\n                raise FiqlFormatException(\"%s can not be followed by %s\" % (\n                    arg_2.__class__, Constraint))\n            arg_2 = Constraint(arg_5, arg_6, arg_7)\n            arg_3.add_element(arg_2)\n    if arg_1 != 0:\n        raise FiqlFormatException(\n            \"At least one nested expression was not correctly closed\")\n    if not arg_3.has_constraint():\n        raise FiqlFormatException(\n            \"Parsed string '%s' contained no constraint\" % arg_0)\n    return arg_3", "path": "fiql_parser/parser.py", "identifier": "parse_str_to_expression", "docstring": "Parse a FIQL formatted string into an ``Expression``.\n\n    Args:\n        fiql_str (string): The FIQL formatted string we want to parse.\n\n    Returns:\n        Expression: An ``Expression`` object representing the parsed FIQL\n        string.\n\n    Raises:\n        FiqlFormatException: Unable to parse string due to incorrect\n            formatting.\n\n    Example:\n\n        >>> expression = parse_str_to_expression(\n        ...         \"name==bar,dob=gt=1990-01-01\")", "docstring_tokens": ["Parse", "a", "FIQL", "formatted", "string", "into", "an", "Expression", "."], "nwo": "sergedomk/fiql_parser", "score": 0.35580137387943567, "idx": 253654}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/__init__.py#L587-L590", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Creates a virtual column which is the equivalent of numpy.arange, but uses 0 memory", "language": "python", "parameters": "(start, stop, step=1, dtype='f8')", "return_statement": "return ColumnVirtualRange(start, stop, step, dtype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "'f8'", ")", ":", "from", ".", "column", "import", "ColumnVirtualRange", "return", "ColumnVirtualRange", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3='f8'):\n    \"\"\"Creates a virtual column which is the equivalent of numpy.arange, but uses 0 memory\"\"\"\n    from .column import ColumnVirtualRange\n    return ColumnVirtualRange(arg_0, arg_1, arg_2, arg_3)", "path": "packages/vaex-core/vaex/__init__.py", "identifier": "vrange", "docstring": "Creates a virtual column which is the equivalent of numpy.arange, but uses 0 memory", "docstring_tokens": ["Creates", "a", "virtual", "column", "which", "is", "the", "equivalent", "of", "numpy", ".", "arange", "but", "uses", "0", "memory"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 253655}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/creation.py#L386-L438", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Sign inputs in a finalized bundle.", "language": "python", "parameters": "(self, key_generator)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "hash", ":", "raise", "RuntimeError", "(", "'Cannot sign inputs until bundle is finalized.'", ")", "arg_2", "=", "0", "while", "arg_2", "<", "len", "(", "arg_0", ")", ":", "arg_3", "=", "arg_0", "[", "arg_2", "]", "if", "arg_3", ".", "value", "<", "0", ":", "if", "arg_3", ".", "address", ".", "key_index", "is", "None", ":", "raise", "with_context", "(", "exc", "=", "ValueError", "(", "'Unable to sign input {input}; '", "'``key_index`` is None '", "'(``exc.context`` has more info).'", ".", "format", "(", "input", "=", "arg_3", ".", "address", ",", ")", ",", ")", ",", "context", "=", "{", "'transaction'", ":", "arg_3", ",", "}", ",", ")", "if", "arg_3", ".", "address", ".", "security_level", "is", "None", ":", "raise", "with_context", "(", "exc", "=", "ValueError", "(", "'Unable to sign input {input}; '", "'``security_level`` is None '", "'(``exc.context`` has more info).'", ".", "format", "(", "input", "=", "arg_3", ".", "address", ",", ")", ",", ")", ",", "context", "=", "{", "'transaction'", ":", "arg_3", ",", "}", ",", ")", "arg_0", ".", "sign_input_at", "(", "arg_2", ",", "arg_1", ".", "get_key_for", "(", "arg_3", ".", "address", ")", ")", "arg_2", "+=", "arg_3", ".", "address", ".", "security_level", "else", ":", "arg_2", "+=", "1"], "function": "def Func(arg_0, arg_1):\n        # type: (KeyGenerator) -> None\n        \"\"\"\n        Sign inputs in a finalized bundle.\n        \"\"\"\n        if not arg_0.hash:\n            raise RuntimeError('Cannot sign inputs until bundle is finalized.')\n\n        # Use a counter for the loop so that we can skip ahead as we go.\n        arg_2 = 0\n        while arg_2 < len(arg_0):\n            arg_3 = arg_0[arg_2]\n\n            if arg_3.value < 0:\n                # In order to sign the input, we need to know the index\n                # of the private key used to generate it.\n                if arg_3.address.key_index is None:\n                    raise with_context(\n                        exc=ValueError(\n                            'Unable to sign input {input}; '\n                            '``key_index`` is None '\n                            '(``exc.context`` has more info).'.format(\n                                input=arg_3.address,\n                            ),\n                        ),\n\n                        context={\n                            'transaction': arg_3,\n                        },\n                    )\n\n                if arg_3.address.security_level is None:\n                    raise with_context(\n                        exc=ValueError(\n                            'Unable to sign input {input}; '\n                            '``security_level`` is None '\n                            '(``exc.context`` has more info).'.format(\n                                input=arg_3.address,\n                            ),\n                        ),\n\n                        context={\n                            'transaction': arg_3,\n                        },\n                    )\n\n                arg_0.sign_input_at(arg_2, arg_1.get_key_for(arg_3.address))\n\n                arg_2 += arg_3.address.security_level\n            else:\n                # No signature needed (nor even possible, in some\n                # cases); skip this transaction.\n                arg_2 += 1", "path": "iota/transaction/creation.py", "identifier": "ProposedBundle.sign_inputs", "docstring": "Sign inputs in a finalized bundle.", "docstring_tokens": ["Sign", "inputs", "in", "a", "finalized", "bundle", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 253656}
{"url": "https://github.com/seebass/django-tooling/blob/aaee703040b299cae560c501c94b18e0c2620f0d/django_tooling/registeradmin.py#L5-L9", "sha": "aaee703040b299cae560c501c94b18e0c2620f0d", "docstring_summary": "Registers the models of the app with the given \"appName\" for the admin site", "language": "python", "parameters": "(appName, excludeModels=[])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ")", ":", "for", "arg_2", "in", "apps", ".", "get_app_config", "(", "arg_0", ")", ".", "get_models", "(", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "admin", ".", "site", ".", "register", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=[]):\n    \"\"\"Registers the models of the app with the given \"appName\" for the admin site\"\"\"\n    for arg_2 in apps.get_app_config(arg_0).get_models():\n        if arg_2 not in arg_1:\n            admin.site.register(arg_2)", "path": "django_tooling/registeradmin.py", "identifier": "registerAdminSite", "docstring": "Registers the models of the app with the given \"appName\" for the admin site", "docstring_tokens": ["Registers", "the", "models", "of", "the", "app", "with", "the", "given", "appName", "for", "the", "admin", "site"], "nwo": "seebass/django-tooling", "score": 0.0, "idx": 253657}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L118-L124", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Parses a semi-colon delimited list of headers.", "language": "python", "parameters": "(self, headers)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "_parse_keyvalue_list", "(", "arg_1", ")", ":", "arg_0", ".", "headers", "[", "arg_2", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses a semi-colon delimited list of headers.\n\n        Example: foo=bar;baz=qux\n        \"\"\"\n        for arg_2, arg_3 in _parse_keyvalue_list(arg_1):\n            arg_0.headers[arg_2] = arg_3", "path": "src/streamlink/plugin/api/http_session.py", "identifier": "HTTPSession.parse_headers", "docstring": "Parses a semi-colon delimited list of headers.\n\n        Example: foo=bar;baz=qux", "docstring_tokens": ["Parses", "a", "semi", "-", "colon", "delimited", "list", "of", "headers", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 253658}
{"url": "https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L169-L183", "sha": "65b4271a161d6c19a9eb0170b5a95832a139ab7f", "docstring_summary": "Converts stderr string to a list.", "language": "python", "parameters": "(self)", "return_statement": "return stderr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_streaming", ":", "Func", "=", "[", "]", "while", "not", "arg_0", ".", "__stderr", ".", "empty", "(", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "__stderr", ".", "get_nowait", "(", ")", "Func", ".", "append", "(", "arg_2", ")", "except", ":", "pass", "else", ":", "Func", "=", "arg_0", ".", "__stderr", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Converts stderr string to a list.\n        \"\"\"\n        if arg_0._streaming:\n            Func = []\n            while not arg_0.__stderr.empty():\n                try:\n                    arg_2 = arg_0.__stderr.get_nowait()\n                    Func.append(arg_2)\n                except:\n                    pass\n        else:\n            Func = arg_0.__stderr\n        return Func", "path": "src/sultan/result.py", "identifier": "Result.stderr", "docstring": "Converts stderr string to a list.", "docstring_tokens": ["Converts", "stderr", "string", "to", "a", "list", "."], "nwo": "aeroxis/sultan", "score": 0.5790863849859432, "idx": 253659}
{"url": "https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/master.py#L94-L104", "sha": "5bcd8240d1fc0aa1579e71f2efcab63b4c61c547", "docstring_summary": "Direct operate a single command", "language": "python", "parameters": "(self, command, index, callback=asiodnp3.PrintingCommandCallback.Get(),\n                                    config=opendnp3.TaskConfig().Default())", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "PrintingCommandCallback", ".", "Get", "(", ")", ",", "arg_7", "=", "arg_8", ".", "TaskConfig", "(", ")", ".", "Default", "(", ")", ")", ":", "arg_0", ".", "master", ".", "DirectOperate", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4.PrintingCommandCallback.Get(),\n                                    arg_7=arg_8.TaskConfig().Default()):\n        \"\"\"\n            Direct operate a single command\n\n        :param command: command to operate\n        :param index: index of the command\n        :param callback: callback that will be invoked upon completion or failure\n        :param config: optional configuration that controls normal callbacks and allows the user to be specified for SA\n        \"\"\"\n        arg_0.master.DirectOperate(arg_1, arg_2, arg_3, arg_7)", "path": "examples/master.py", "identifier": "MyMaster.send_direct_operate_command", "docstring": "Direct operate a single command\n\n        :param command: command to operate\n        :param index: index of the command\n        :param callback: callback that will be invoked upon completion or failure\n        :param config: optional configuration that controls normal callbacks and allows the user to be specified for SA", "docstring_tokens": ["Direct", "operate", "a", "single", "command"], "nwo": "ChargePoint/pydnp3", "score": 0.6403780379231505, "idx": 253660}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L282-L291", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Query group by a group name.", "language": "python", "parameters": "(cls, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "arg_0", ".", "query", ".", "filter_by", "(", "arg_1", "=", "arg_1", ")", ".", "one", "(", ")", "except", "NoResultFound", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Query group by a group name.\n\n        :param name: Name of a group to search for.\n        :returns: Group object or None.\n        \"\"\"\n        try:\n            return arg_0.query.filter_by(arg_1=arg_1).one()\n        except NoResultFound:\n            return None", "path": "invenio_groups/models.py", "identifier": "Group.get_by_name", "docstring": "Query group by a group name.\n\n        :param name: Name of a group to search for.\n        :returns: Group object or None.", "docstring_tokens": ["Query", "group", "by", "a", "group", "name", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 253661}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L377-L429", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This creates an SQS queue.", "language": "python", "parameters": "(queue_name, options=None, client=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "boto3", ".", "client", "(", "'sqs'", ")", "try", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_3", "=", "arg_2", ".", "create_queue", "(", "QueueName", "=", "arg_0", ",", "Attributes", "=", "arg_1", ")", "else", ":", "arg_3", "=", "arg_2", ".", "create_queue", "(", "QueueName", "=", "arg_0", ")", "if", "arg_3", "is", "not", "None", ":", "return", "{", "'url'", ":", "arg_3", "[", "'QueueUrl'", "]", ",", "'name'", ":", "arg_0", "}", "else", ":", "LOGERROR", "(", "'could not create the specified queue: %s with options: %s'", "%", "(", "arg_0", ",", "arg_1", ")", ")", "return", "None", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'could not create the specified queue: %s with options: %s'", "%", "(", "arg_0", ",", "arg_1", ")", ")", "return", "None"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"\n    This creates an SQS queue.\n\n    Parameters\n    ----------\n\n    queue_name : str\n        The name of the queue to create.\n\n    options : dict or None\n        A dict of options indicate extra attributes the queue should have.\n        See the SQS docs for details. If None, no custom attributes will be\n        attached to the queue.\n\n    client : boto3.Client or None\n        If None, this function will instantiate a new `boto3.Client` object to\n        use in its operations. Alternatively, pass in an existing `boto3.Client`\n        instance to re-use it here.\n\n    Returns\n    -------\n\n    dict\n        This returns a dict of the form::\n\n            {'url': SQS URL of the queue,\n             'name': name of the queue}\n\n    \"\"\"\n\n    if not arg_2:\n        arg_2 = boto3.client('sqs')\n\n    try:\n\n        if isinstance(arg_1, dict):\n            arg_3 = arg_2.create_queue(QueueName=arg_0, Attributes=arg_1)\n        else:\n            arg_3 = arg_2.create_queue(QueueName=arg_0)\n\n        if arg_3 is not None:\n            return {'url':arg_3['QueueUrl'],\n                    'name':arg_0}\n        else:\n            LOGERROR('could not create the specified queue: %s with options: %s'\n                     % (arg_0, arg_1))\n            return None\n\n    except Exception as e:\n        LOGEXCEPTION('could not create the specified queue: %s with options: %s'\n                     % (arg_0, arg_1))\n        return None", "path": "astrobase/awsutils.py", "identifier": "sqs_create_queue", "docstring": "This creates an SQS queue.\n\n    Parameters\n    ----------\n\n    queue_name : str\n        The name of the queue to create.\n\n    options : dict or None\n        A dict of options indicate extra attributes the queue should have.\n        See the SQS docs for details. If None, no custom attributes will be\n        attached to the queue.\n\n    client : boto3.Client or None\n        If None, this function will instantiate a new `boto3.Client` object to\n        use in its operations. Alternatively, pass in an existing `boto3.Client`\n        instance to re-use it here.\n\n    Returns\n    -------\n\n    dict\n        This returns a dict of the form::\n\n            {'url': SQS URL of the queue,\n             'name': name of the queue}", "docstring_tokens": ["This", "creates", "an", "SQS", "queue", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 253662}
{"url": "https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L323-L335", "sha": "212cfe1791a4aab4783f99b665cc32da6437f419", "docstring_summary": "Submit the selected exercise to the server.", "language": "python", "parameters": "(course, tid=None, pastebin=False, review=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "if", "arg_1", "is", "not", "None", ":", "return", "Func_exercise", "(", "Exercise", ".", "byid", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ",", "request_review", "=", "arg_3", ")", "else", ":", "arg_4", "=", "Exercise", ".", "get_selected", "(", ")", "if", "not", "arg_4", ":", "raise", "NoExerciseSelected", "(", ")", "return", "Func_exercise", "(", "arg_4", ",", "arg_2", "=", "arg_2", ",", "request_review", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=False):\n    \"\"\"\n    Submit the selected exercise to the server.\n    \"\"\"\n    if arg_1 is not None:\n        return Func_exercise(Exercise.byid(arg_1),\n                               arg_2=arg_2,\n                               request_review=arg_3)\n    else:\n        arg_4 = Exercise.get_selected()\n        if not arg_4:\n            raise NoExerciseSelected()\n        return Func_exercise(arg_4, arg_2=arg_2, request_review=arg_3)", "path": "tmc/__main__.py", "identifier": "submit", "docstring": "Submit the selected exercise to the server.", "docstring_tokens": ["Submit", "the", "selected", "exercise", "to", "the", "server", "."], "nwo": "minttu/tmc.py", "score": 0.09252797783733271, "idx": 253663}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1523-L1564", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Show Program Landing page for the Enterprise's Program.", "language": "python", "parameters": "(self, request, enterprise_uuid, program_uuid)", "return_statement": "return self.get_enterprise_program_enrollment_page(request, enterprise_customer, program_details)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "verify_edx_resources", "(", ")", "arg_4", "=", "Func_enterprise_customer_or_404", "(", "arg_2", ")", "arg_5", "=", "Func_global_context", "(", "arg_1", ",", "arg_4", ")", "arg_6", ",", "arg_7", "=", "arg_0", ".", "Func_program_details", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "if", "arg_7", ":", "return", "render", "(", "arg_1", ",", "ENTERPRISE_GENERAL_ERROR_PAGE", ",", "context", "=", "arg_5", ",", "status", "=", "404", ",", ")", "if", "arg_6", "[", "'certificate_eligible_for_program'", "]", ":", "return", "redirect", "(", "LMS_PROGRAMS_DASHBOARD_URL", ".", "format", "(", "uuid", "=", "arg_3", ")", ")", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_6", "[", "'courses'", "]", ":", "for", "arg_10", "in", "arg_9", "[", "'course_runs'", "]", ":", "arg_8", ".", "append", "(", "arg_10", "[", "'key'", "]", ")", "arg_11", "=", "EmbargoApiClient", ".", "redirect_if_blocked", "(", "arg_8", ",", "arg_1", ".", "user", ",", "Func_ip", "(", "arg_1", ")", ",", "arg_1", ".", "path", ")", "if", "arg_11", ":", "return", "redirect", "(", "arg_11", ")", "return", "arg_0", ".", "Func_enterprise_program_enrollment_page", "(", "arg_1", ",", "arg_4", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Show Program Landing page for the Enterprise's Program.\n\n        Render the Enterprise's Program Enrollment page for a specific program.\n        The Enterprise and Program are both selected by their respective UUIDs.\n\n        Unauthenticated learners will be redirected to enterprise-linked SSO.\n\n        A 404 will be raised if any of the following conditions are met:\n            * No enterprise customer UUID query parameter ``enterprise_uuid`` found in request.\n            * No enterprise customer found against the enterprise customer\n                uuid ``enterprise_uuid`` in the request kwargs.\n            * No Program can be found given ``program_uuid`` either at all or associated with\n                the Enterprise..\n        \"\"\"\n        verify_edx_resources()\n\n        arg_4 = Func_enterprise_customer_or_404(arg_2)\n        arg_5 = Func_global_context(arg_1, arg_4)\n        arg_6, arg_7 = arg_0.Func_program_details(arg_1, arg_3, arg_4)\n        if arg_7:\n            return render(\n                arg_1,\n                ENTERPRISE_GENERAL_ERROR_PAGE,\n                context=arg_5,\n                status=404,\n            )\n        if arg_6['certificate_eligible_for_program']:\n            # The user is already enrolled in the program, so redirect to the program's dashboard.\n            return redirect(LMS_PROGRAMS_DASHBOARD_URL.format(uuid=arg_3))\n\n        # Check to see if access to any of the course runs in the program are restricted for this user.\n        arg_8 = []\n        for arg_9 in arg_6['courses']:\n            for arg_10 in arg_9['course_runs']:\n                arg_8.append(arg_10['key'])\n        arg_11 = EmbargoApiClient.redirect_if_blocked(arg_8, arg_1.user, Func_ip(arg_1), arg_1.path)\n        if arg_11:\n            return redirect(arg_11)\n\n        return arg_0.Func_enterprise_program_enrollment_page(arg_1, arg_4, arg_6)", "path": "enterprise/views.py", "identifier": "ProgramEnrollmentView.get", "docstring": "Show Program Landing page for the Enterprise's Program.\n\n        Render the Enterprise's Program Enrollment page for a specific program.\n        The Enterprise and Program are both selected by their respective UUIDs.\n\n        Unauthenticated learners will be redirected to enterprise-linked SSO.\n\n        A 404 will be raised if any of the following conditions are met:\n            * No enterprise customer UUID query parameter ``enterprise_uuid`` found in request.\n            * No enterprise customer found against the enterprise customer\n                uuid ``enterprise_uuid`` in the request kwargs.\n            * No Program can be found given ``program_uuid`` either at all or associated with\n                the Enterprise..", "docstring_tokens": ["Show", "Program", "Landing", "page", "for", "the", "Enterprise", "s", "Program", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253664}
{"url": "https://github.com/alpacahq/alpaca-trade-api-python/blob/9c9dea3b4a37c909f88391b202e86ff356a8b4d7/alpaca_trade_api/stream2.py#L76-L99", "sha": "9c9dea3b4a37c909f88391b202e86ff356a8b4d7", "docstring_summary": "Start subscribing channels.\n        If the necessary connection isn't open yet, it opens now.", "language": "python", "parameters": "(self, channels)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "if", "arg_4", ".", "startswith", "(", "(", "'Q.'", ",", "'T.'", ",", "'A.'", ",", "'AM.'", ",", ")", ")", ":", "arg_3", ".", "append", "(", "arg_4", ")", "else", ":", "arg_2", ".", "append", "(", "arg_4", ")", "if", "len", "(", "arg_2", ")", ">", "0", ":", "await", "arg_0", ".", "_ensure_ws", "(", ")", "await", "arg_0", ".", "_ws", ".", "send", "(", "json", ".", "dumps", "(", "{", "'action'", ":", "'listen'", ",", "'data'", ":", "{", "'streams'", ":", "arg_2", ",", "}", "}", ")", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "await", "arg_0", ".", "_ensure_nats", "(", ")", "await", "arg_0", ".", "polygon", ".", "Func", "(", "arg_3", ")"], "function": "async def Func(arg_0, arg_1):\n        '''Start subscribing channels.\n        If the necessary connection isn't open yet, it opens now.\n        '''\n        arg_2 = []\n        arg_3 = []\n        for arg_4 in arg_1:\n            if arg_4.startswith(('Q.', 'T.', 'A.', 'AM.',)):\n                arg_3.append(arg_4)\n            else:\n                arg_2.append(arg_4)\n\n        if len(arg_2) > 0:\n            await arg_0._ensure_ws()\n            await arg_0._ws.send(json.dumps({\n                'action': 'listen',\n                'data': {\n                    'streams': arg_2,\n                }\n            }))\n\n        if len(arg_3) > 0:\n            await arg_0._ensure_nats()\n            await arg_0.polygon.Func(arg_3)", "path": "alpaca_trade_api/stream2.py", "identifier": "StreamConn.subscribe", "docstring": "Start subscribing channels.\n        If the necessary connection isn't open yet, it opens now.", "docstring_tokens": ["Start", "subscribing", "channels", ".", "If", "the", "necessary", "connection", "isn", "t", "open", "yet", "it", "opens", "now", "."], "nwo": "alpacahq/alpaca-trade-api-python", "score": 0.9697751514981866, "idx": 253665}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/utils/alexa/bot.py#L148-L194", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Processes Alexa requests from skill server and returns responses to Alexa.", "language": "python", "parameters": "(self, request: dict)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "arg_3", ":", "bytes", "=", "arg_1", "[", "'request_body'", "]", "arg_4", ":", "str", "=", "arg_1", "[", "'signature_chain_url'", "]", "arg_5", ":", "str", "=", "arg_1", "[", "'signature'", "]", "arg_6", ":", "arg_2", "=", "arg_1", "[", "'alexa_request'", "]", "if", "not", "arg_0", ".", "_verify_request", "(", "arg_4", ",", "arg_5", ",", "arg_3", ")", ":", "return", "{", "'error'", ":", "'failed certificate/signature check'", "}", "arg_7", "=", "arg_6", "[", "'request'", "]", "[", "'timestamp'", "]", "arg_8", "=", "datetime", ".", "strptime", "(", "arg_7", ",", "'%Y-%m-%dT%H:%M:%SZ'", ")", "arg_9", "=", "datetime", ".", "utcnow", "(", ")", "arg_10", "=", "arg_9", "-", "arg_8", "if", "arg_9", ">=", "arg_8", "else", "arg_8", "-", "arg_9", "if", "abs", "(", "arg_10", ".", "seconds", ")", ">", "REQUEST_TIMESTAMP_TOLERANCE_SECS", ":", "log", ".", "error", "(", "f'Failed timestamp check for request: {request_body.decode(\"utf-8\", \"replace\")}'", ")", "return", "{", "'error'", ":", "'failed request timestamp check'", "}", "arg_11", "=", "arg_6", "[", "'session'", "]", "[", "'user'", "]", "[", "'userId'", "]", "if", "arg_11", "not", "in", "arg_0", ".", "conversations", ".", "keys", "(", ")", ":", "if", "arg_0", ".", "config", "[", "'multi_instance'", "]", ":", "arg_12", "=", "arg_0", ".", "_init_agent", "(", ")", "log", ".", "info", "(", "'New conversation instance level agent initiated'", ")", "else", ":", "arg_12", "=", "arg_0", ".", "agent", "arg_0", ".", "conversations", "[", "arg_11", "]", "=", "Conversation", "(", "config", "=", "arg_0", ".", "config", ",", "agent", "=", "arg_12", ",", "arg_11", "=", "arg_11", ",", "self_destruct_callback", "=", "lambda", ":", "arg_0", ".", "_del_conversation", "(", "arg_11", ")", ")", "log", ".", "info", "(", "f'Created new conversation, key: {conversation_key}'", ")", "arg_14", "=", "arg_0", ".", "conversations", "[", "arg_11", "]", "arg_15", "=", "arg_14", ".", "handle_request", "(", "arg_6", ")", "return", "arg_15"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        \"\"\"Processes Alexa requests from skill server and returns responses to Alexa.\n\n        Args:\n            request: Dict with Alexa request payload and metadata.\n        Returns:\n            result: Alexa formatted or error response.\n        \"\"\"\n        arg_3: bytes = arg_1['request_body']\n        arg_4: str = arg_1['signature_chain_url']\n        arg_5: str = arg_1['signature']\n        arg_6: arg_2 = arg_1['alexa_request']\n\n        if not arg_0._verify_request(arg_4, arg_5, arg_3):\n            return {'error': 'failed certificate/signature check'}\n\n        arg_7 = arg_6['request']['timestamp']\n        arg_8 = datetime.strptime(arg_7, '%Y-%m-%dT%H:%M:%SZ')\n        arg_9 = datetime.utcnow()\n\n        arg_10 = arg_9 - arg_8 if arg_9 >= arg_8 else arg_8 - arg_9\n\n        if abs(arg_10.seconds) > REQUEST_TIMESTAMP_TOLERANCE_SECS:\n            log.error(f'Failed timestamp check for request: {request_body.decode(\"utf-8\", \"replace\")}')\n            return {'error': 'failed request timestamp check'}\n\n        arg_11 = arg_6['session']['user']['userId']\n\n        if arg_11 not in arg_0.conversations.keys():\n            if arg_0.config['multi_instance']:\n                arg_12 = arg_0._init_agent()\n                log.info('New conversation instance level agent initiated')\n            else:\n                arg_12 = arg_0.agent\n\n            arg_0.conversations[arg_11] = \\\n                Conversation(config=arg_0.config,\n                             agent=arg_12,\n                             arg_11=arg_11,\n                             self_destruct_callback=lambda: arg_0._del_conversation(arg_11))\n\n            log.info(f'Created new conversation, key: {conversation_key}')\n\n        arg_14 = arg_0.conversations[arg_11]\n        arg_15 = arg_14.handle_request(arg_6)\n\n        return arg_15", "path": "deeppavlov/utils/alexa/bot.py", "identifier": "Bot._handle_request", "docstring": "Processes Alexa requests from skill server and returns responses to Alexa.\n\n        Args:\n            request: Dict with Alexa request payload and metadata.\n        Returns:\n            result: Alexa formatted or error response.", "docstring_tokens": ["Processes", "Alexa", "requests", "from", "skill", "server", "and", "returns", "responses", "to", "Alexa", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 253666}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/sratools.py#L87-L202", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Download the accessions into a the designated workdir.", "language": "python", "parameters": "(self, \n        force=False, \n        ipyclient=None, \n        name_fields=30, \n        name_separator=\"_\", \n        dry_run=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ",", "arg_3", "=", "30", ",", "arg_4", "=", "\"_\"", ",", "arg_5", "=", "False", ")", ":", "try", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "workdir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "workdir", ")", "arg_0", ".", "_set_vdbconfig_path", "(", ")", "if", "arg_2", ":", "arg_0", ".", "_ipcluster", "[", "\"pids\"", "]", "=", "{", "}", "for", "arg_7", "in", "arg_2", ".", "ids", ":", "arg_8", "=", "arg_2", "[", "arg_7", "]", "if", "not", "arg_8", ".", "outstanding", ":", "arg_9", "=", "arg_8", ".", "apply", "(", "os", ".", "getpid", ")", ".", "get", "(", ")", "arg_0", ".", "_ipcluster", "[", "\"pids\"", "]", "[", "arg_7", "]", "=", "arg_9", "arg_0", ".", "_submit_jobs", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", ")", "except", "IPyradWarningExit", "as", "inst", ":", "print", "(", "inst", ")", "except", "KeyboardInterrupt", ":", "print", "(", "\"keyboard interrupt...\"", ")", "except", "Exception", "as", "inst", ":", "print", "(", "\"Exception in Func() - {}\"", ".", "format", "(", "inst", ")", ")", "finally", ":", "arg_0", ".", "_restore_vdbconfig_path", "(", ")", "arg_10", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "workdir", ",", "\"sra\"", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_10", ")", "and", "(", "not", "os", ".", "listdir", "(", "arg_10", ")", ")", ":", "shutil", ".", "rmtree", "(", "arg_10", ")", "else", ":", "try", ":", "print", "(", "FAILED_DOWNLOAD", ".", "format", "(", "os", ".", "listdir", "(", "arg_10", ")", ")", ")", "except", "OSError", "as", "inst", ":", "raise", "IPyradWarningExit", "(", "\"Download failed. Exiting.\"", ")", "for", "arg_11", "in", "os", ".", "listdir", "(", "arg_10", ")", ":", "arg_12", "=", "arg_11", ".", "split", "(", "\".\"", ")", "[", "0", "]", "arg_13", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "workdir", ",", "\"*_{}*.gz\"", ".", "format", "(", "arg_12", ")", ")", "arg_14", "=", "glob", ".", "glob", "(", "arg_13", ")", "[", "0", "]", "if", "os", ".", "path", ".", "exists", "(", "arg_14", ")", ":", "os", ".", "remove", "(", "arg_14", ")", "shutil", ".", "rmtree", "(", "arg_10", ")", "if", "arg_2", ":", "try", ":", "arg_2", ".", "abort", "(", ")", "time", ".", "sleep", "(", "0.5", ")", "for", "arg_15", ",", "arg_9", "in", "arg_0", ".", "_ipcluster", "[", "\"pids\"", "]", ".", "items", "(", ")", ":", "if", "arg_2", ".", "queue_status", "(", ")", "[", "arg_15", "]", "[", "\"tasks\"", "]", ":", "os", ".", "kill", "(", "arg_9", ",", "2", ")", "time", ".", "sleep", "(", "0.1", ")", "except", "ipp", ".", "NoEnginesRegistered", ":", "pass", "if", "not", "arg_2", ".", "outstanding", ":", "arg_2", ".", "purge_everything", "(", ")", "else", ":", "arg_2", ".", "shutdown", "(", "hub", "=", "True", ",", "block", "=", "False", ")", "arg_2", ".", "close", "(", ")", "print", "(", "\"\\nwarning: ipcluster shutdown and must be restarted\"", ")"], "function": "def Func(arg_0, \n        arg_1=False, \n        arg_2=None, \n        arg_3=30, \n        arg_4=\"_\", \n        arg_5=False):\n        \"\"\"\n        Download the accessions into a the designated workdir. \n\n        Parameters\n        ----------\n        force: (bool)\n            If force=True then existing files with the same name\n            will be overwritten. \n\n        ipyclient: (ipyparallel.Client)\n            If provided, work will be distributed across a parallel\n            client, otherwise download will be Func on a single core.\n\n        name_fields: (int, str):\n            Provide the index of the name fields to be used as a prefix\n            for fastq output files. The default is 30, which is the \n            SampleName field. Use sra.fetch_fields to see all available\n            fields and their indices. A likely alternative is 1 (Run). \n            If multiple are listed then they will be joined by a \"_\" \n            character. For example (29,30) would yield something like:\n            latin-name_sample-name (e.g., mus_musculus-NR10123).\n\n        dry_Func: (bool)\n            If True then a table of file names that _would_ be downloaded\n            will be shown, but the actual files will note be downloaded.\n        \"\"\"\n\n        ## temporarily set directory for tmpfiles used by fastq-dump\n        ## if this fails then just skip it.\n        try:\n            ## ensure output directory, also used as tmpdir\n            if not os.path.exists(arg_0.workdir):\n                os.makedirs(arg_0.workdir)\n\n            ## get original directory for sra files \n            ## probably /home/ncbi/public/sra by default.\n            arg_0._set_vdbconfig_path()\n\n            ## register ipyclient for cleanup\n            if arg_2:\n                arg_0._ipcluster[\"pids\"] = {}\n                for arg_7 in arg_2.ids:\n                    arg_8 = arg_2[arg_7]\n                    if not arg_8.outstanding:\n                        arg_9 = arg_8.apply(os.getpid).get()\n                        arg_0._ipcluster[\"pids\"][arg_7] = arg_9               \n\n            ## submit jobs to engines or local \n            arg_0._submit_jobs(\n                arg_1=arg_1, \n                arg_2=arg_2, \n                arg_3=arg_3, \n                arg_4=arg_4,\n                arg_5=arg_5,\n                )\n\n        except IPyradWarningExit as inst:\n            print(inst)\n        ## exceptions to catch, cleanup and handle ipyclient interrupts\n        except KeyboardInterrupt:\n            print(\"keyboard interrupt...\")\n        except Exception as inst:\n            print(\"Exception in Func() - {}\".format(inst))\n        finally:\n            ## reset working sra path\n            arg_0._restore_vdbconfig_path()\n\n            ## if it made a new sra directory then it should be empty when \n            ## we are finished if all .sra files were removed. If so, then\n            ## let's also remove the dir. if not empty, leave it.\n            arg_10 = os.path.join(arg_0.workdir, \"sra\")\n            if os.path.exists(arg_10) and (not os.listdir(arg_10)):\n                shutil.rmtree(arg_10)\n            else:\n                ## print warning\n                try:\n                    print(FAILED_DOWNLOAD.format(os.listdir(arg_10)))\n                except OSError as inst:\n                    ## If sra dir doesn't even exist something very bad is broken.\n                    raise IPyradWarningExit(\"Download failed. Exiting.\")\n                ## remove fastq file matching to cached sra file\n                for arg_11 in os.listdir(arg_10):\n                    arg_12 = arg_11.split(\".\")[0]\n                    arg_13 = os.path.join(arg_0.workdir, \"*_{}*.gz\".format(arg_12))\n                    arg_14 = glob.glob(arg_13)[0]\n                    if os.path.exists(arg_14):\n                        os.remove(arg_14)\n                ## remove cache of sra files\n                shutil.rmtree(arg_10)\n\n            ## cleanup ipcluster shutdown\n            if arg_2:\n                ## send SIGINT (2) to all engines still Funcning tasks\n                try:\n                    arg_2.abort()\n                    time.sleep(0.5)\n                    for arg_15, arg_9 in arg_0._ipcluster[\"pids\"].items():\n                        if arg_2.queue_status()[arg_15][\"tasks\"]:\n                            os.kill(arg_9, 2)\n                        time.sleep(0.1)\n                except ipp.NoEnginesRegistered:\n                    pass\n                ## clean memory space\n                if not arg_2.outstanding:\n                    arg_2.purge_everything()\n                ## uh oh, kill everything, something bad happened\n                else:\n                    arg_2.shutdown(hub=True, block=False)\n                    arg_2.close()\n                    print(\"\\nwarning: ipcluster shutdown and must be restarted\")", "path": "ipyrad/analysis/sratools.py", "identifier": "SRA.run", "docstring": "Download the accessions into a the designated workdir. \n\n        Parameters\n        ----------\n        force: (bool)\n            If force=True then existing files with the same name\n            will be overwritten. \n\n        ipyclient: (ipyparallel.Client)\n            If provided, work will be distributed across a parallel\n            client, otherwise download will be run on a single core.\n\n        name_fields: (int, str):\n            Provide the index of the name fields to be used as a prefix\n            for fastq output files. The default is 30, which is the \n            SampleName field. Use sra.fetch_fields to see all available\n            fields and their indices. A likely alternative is 1 (Run). \n            If multiple are listed then they will be joined by a \"_\" \n            character. For example (29,30) would yield something like:\n            latin-name_sample-name (e.g., mus_musculus-NR10123).\n\n        dry_run: (bool)\n            If True then a table of file names that _would_ be downloaded\n            will be shown, but the actual files will note be downloaded.", "docstring_tokens": ["Download", "the", "accessions", "into", "a", "the", "designated", "workdir", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 253667}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/concurrently/CommunicationChannel.py#L152-L187", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "put a list of tasks and their arguments", "language": "python", "parameters": "(self, task_args_kwargs_list)", "return_statement": "return self.dropbox.put_multiple(packages)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "isopen", ":", "arg_2", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_2", ".", "warning", "(", "'the drop box is not open'", ")", "return", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "try", ":", "arg_5", "=", "arg_4", "[", "'task'", "]", "arg_6", "=", "arg_4", ".", "get", "(", "'args'", ",", "(", ")", ")", "arg_7", "=", "arg_4", ".", "get", "(", "'kwargs'", ",", "{", "}", ")", "arg_8", "=", "TaskPackage", "(", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "except", "TypeError", ":", "arg_8", "=", "TaskPackage", "(", "arg_5", "=", "arg_4", ",", "arg_6", "=", "(", ")", ",", "arg_7", "=", "{", "}", ")", "arg_3", ".", "append", "(", "arg_8", ")", "return", "arg_0", ".", "dropbox", ".", "Func", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"put a list of tasks and their arguments\n\n        This method can be used to put multiple tasks at once. Calling\n        this method once with multiple tasks can be much faster than\n        calling `put()` multiple times.\n\n        Parameters\n        ----------\n        task_args_kwargs_list : list\n\n            A list of lists with three items that can be parameters of\n            `put()`, i.e., `task`, `args`, `kwargs`.\n\n        Returns\n        -------\n        list\n            A list of task IDs.\n\n        \"\"\"\n        if not arg_0.isopen:\n            arg_2 = logging.getLogger(__name__)\n            arg_2.warning('the drop box is not open')\n            return\n\n        arg_3 = [ ]\n        for arg_4 in arg_1:\n            try:\n                arg_5 = arg_4['task']\n                arg_6 = arg_4.get('args', ())\n                arg_7 = arg_4.get('kwargs', {})\n                arg_8 = TaskPackage(arg_5=arg_5, arg_6=arg_6, arg_7=arg_7)\n            except TypeError:\n                arg_8 = TaskPackage(arg_5=arg_4, arg_6=(), arg_7={})\n            arg_3.append(arg_8)\n        return arg_0.dropbox.Func(arg_3)", "path": "alphatwirl/concurrently/CommunicationChannel.py", "identifier": "CommunicationChannel.put_multiple", "docstring": "put a list of tasks and their arguments\n\n        This method can be used to put multiple tasks at once. Calling\n        this method once with multiple tasks can be much faster than\n        calling `put()` multiple times.\n\n        Parameters\n        ----------\n        task_args_kwargs_list : list\n\n            A list of lists with three items that can be parameters of\n            `put()`, i.e., `task`, `args`, `kwargs`.\n\n        Returns\n        -------\n        list\n            A list of task IDs.", "docstring_tokens": ["put", "a", "list", "of", "tasks", "and", "their", "arguments"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 253668}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L528-L550", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Override of clean method to perform additional validation", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "super", "(", "EnterpriseCustomerReportingConfigAdminForm", ",", "arg_0", ")", ".", "Func", "(", ")", "arg_2", "=", "arg_1", ".", "get", "(", "'enterprise_customer'", ")", "arg_3", "=", "[", "'{} ({})'", ".", "format", "(", "catalog", ".", "title", ",", "catalog", ".", "uuid", ")", "for", "catalog", "in", "arg_1", ".", "get", "(", "'enterprise_customer_catalogs'", ")", "if", "catalog", ".", "enterprise_customer", "!=", "arg_2", "]", "if", "arg_3", ":", "arg_4", "=", "_", "(", "'These catalogs for reporting do not match enterprise'", "'customer {enterprise_customer}: {invalid_catalogs}'", ",", ")", ".", "format", "(", "enterprise_customer", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", ")", "arg_0", ".", "add_error", "(", "'enterprise_customer_catalogs'", ",", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Override of Func method to perform additional validation\n        \"\"\"\n        arg_1 = super(EnterpriseCustomerReportingConfigAdminForm, arg_0).Func()\n        arg_2 = arg_1.get('enterprise_customer')\n\n        # Check that any selected catalogs are tied to the selected enterprise.\n        arg_3 = [\n            '{} ({})'.format(catalog.title, catalog.uuid)\n            for catalog in arg_1.get('enterprise_customer_catalogs')\n            if catalog.enterprise_customer != arg_2\n        ]\n\n        if arg_3:\n            arg_4 = _(\n                'These catalogs for reporting do not match enterprise'\n                'customer {enterprise_customer}: {invalid_catalogs}',\n            ).format(\n                enterprise_customer=arg_2,\n                arg_3=arg_3,\n            )\n            arg_0.add_error('enterprise_customer_catalogs', arg_4)", "path": "enterprise/admin/forms.py", "identifier": "EnterpriseCustomerReportingConfigAdminForm.clean", "docstring": "Override of clean method to perform additional validation", "docstring_tokens": ["Override", "of", "clean", "method", "to", "perform", "additional", "validation"], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253669}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L154-L172", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Add a header check, i.e., check whether the header record is consistent\n        with the expected field names.", "language": "python", "parameters": "(self,\n                         code=HEADER_CHECK_FAILED,\n                         message=MESSAGES[HEADER_CHECK_FAILED])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", "[", "arg_2", "]", ")", ":", "arg_5", "=", "arg_1", ",", "arg_3", "arg_0", ".", "_header_checks", ".", "append", "(", "arg_5", ")"], "function": "def Func(arg_0,\n                         arg_1=arg_2,\n                         arg_3=arg_4[arg_2]):\n        \"\"\"\n        Add a header check, i.e., check whether the header record is consistent\n        with the expected field names.\n\n        Arguments\n        ---------\n\n        `code` - problem code to report if the header record is not valid,\n        defaults to `HEADER_CHECK_FAILED`\n\n        `message` - problem message to report if a value is not valid\n\n        \"\"\"\n\n        arg_5 = arg_1, arg_3\n        arg_0._header_checks.append(arg_5)", "path": "csvvalidator.py", "identifier": "CSVValidator.add_header_check", "docstring": "Add a header check, i.e., check whether the header record is consistent\n        with the expected field names.\n\n        Arguments\n        ---------\n\n        `code` - problem code to report if the header record is not valid,\n        defaults to `HEADER_CHECK_FAILED`\n\n        `message` - problem message to report if a value is not valid", "docstring_tokens": ["Add", "a", "header", "check", "i", ".", "e", ".", "check", "whether", "the", "header", "record", "is", "consistent", "with", "the", "expected", "field", "names", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 253670}
{"url": "https://github.com/pydron/anycall/blob/43add96660258a14b24aa8e8413dffb1741b72d7/anycall/connectionpool.py#L114-L131", "sha": "43add96660258a14b24aa8e8413dffb1741b72d7", "docstring_summary": "Ensures that we have an open connection to the given peer.\n        \n        Returns the peer id. This should be equal to the given one, but\n        it might not if the given peer was, say, the IP and the peer\n        actually identifies itself with a host name. The returned peer\n        is the real one that should be used. This can be handy if we aren't\n        100% sure of the peer's identity.", "language": "python", "parameters": "(self, peer)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_connections", ":", "return", "defer", ".", "succeed", "(", "arg_1", ")", "else", ":", "arg_2", "=", "arg_0", ".", "_connect", "(", "arg_1", ",", "exact_peer", "=", "False", ")", "def", "connected", "(", "arg_3", ")", ":", "return", "arg_3", ".", "peer", "arg_2", ".", "addCallback", "(", "connected", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Ensures that we have an open connection to the given peer.\n        \n        Returns the peer id. This should be equal to the given one, but\n        it might not if the given peer was, say, the IP and the peer\n        actually identifies itself with a host name. The returned peer\n        is the real one that should be used. This can be handy if we aren't\n        100% sure of the peer's identity.\n        \"\"\"\n        if arg_1 in arg_0._connections:\n            return defer.succeed(arg_1)\n        else:\n            arg_2 = arg_0._connect(arg_1, exact_peer=False)\n            def connected(arg_3):\n                return arg_3.peer\n            arg_2.addCallback(connected)\n            return arg_2", "path": "anycall/connectionpool.py", "identifier": "ConnectionPool.pre_connect", "docstring": "Ensures that we have an open connection to the given peer.\n        \n        Returns the peer id. This should be equal to the given one, but\n        it might not if the given peer was, say, the IP and the peer\n        actually identifies itself with a host name. The returned peer\n        is the real one that should be used. This can be handy if we aren't\n        100% sure of the peer's identity.", "docstring_tokens": ["Ensures", "that", "we", "have", "an", "open", "connection", "to", "the", "given", "peer", ".", "Returns", "the", "peer", "id", ".", "This", "should", "be", "equal", "to", "the", "given", "one", "but", "it", "might", "not", "if", "the", "given", "peer", "was", "say", "the", "IP", "and", "the", "peer", "actually", "identifies", "itself", "with", "a", "host", "name", ".", "The", "returned", "peer", "is", "the", "real", "one", "that", "should", "be", "used", ".", "This", "can", "be", "handy", "if", "we", "aren", "t", "100%", "sure", "of", "the", "peer", "s", "identity", "."], "nwo": "pydron/anycall", "score": 0.09252797783733271, "idx": 253671}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/teams.py#L146-L159", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Gets list of BoxScore objects corresponding to the box scores from\n        that year.", "language": "python", "parameters": "(self, year)", "return_statement": "return df.boxscore_id.values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_year_doc", "(", "arg_1", ")", "arg_3", "=", "arg_2", "(", "'table#games'", ")", "arg_4", "=", "sportsref", ".", "utils", ".", "parse_table", "(", "arg_3", ")", "if", "arg_4", ".", "empty", ":", "return", "np", ".", "array", "(", "[", "]", ")", "return", "arg_4", ".", "boxscore_id", ".", "values"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Gets list of BoxScore objects corresponding to the box scores from\n        that year.\n\n        :year: The year for which we want the Func; defaults to current\n        year.\n        :returns: np.array of strings representing boxscore IDs.\n        \"\"\"\n        arg_2 = arg_0.get_year_doc(arg_1)\n        arg_3 = arg_2('table#games')\n        arg_4 = sportsref.utils.parse_table(arg_3)\n        if arg_4.empty:\n            return np.array([])\n        return arg_4.boxscore_id.values", "path": "sportsref/nfl/teams.py", "identifier": "Team.boxscores", "docstring": "Gets list of BoxScore objects corresponding to the box scores from\n        that year.\n\n        :year: The year for which we want the boxscores; defaults to current\n        year.\n        :returns: np.array of strings representing boxscore IDs.", "docstring_tokens": ["Gets", "list", "of", "BoxScore", "objects", "corresponding", "to", "the", "box", "scores", "from", "that", "year", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 253672}
{"url": "https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L136-L160", "sha": "cd5c6e10c6c4e653669e11d735d5773766986bda", "docstring_summary": "Split sentences in groups, given a specific group length.", "language": "python", "parameters": "(total_nb_sentences, group_length)", "return_statement": "return sentences_groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "range", "(", "0", ",", "arg_0", ")", ":", "if", "arg_4", "%", "arg_1", "==", "0", ":", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_2", ".", "append", "(", "arg_3", ")", "arg_3", "=", "[", "arg_4", "]", "else", ":", "arg_3", ".", "append", "(", "arg_4", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Split sentences in groups, given a specific group length.\n\n        Args:\n            total_nb_sentences (int): Total available sentences.\n            group_length (int): Limit of length for each group.\n\n        Returns:\n            list: Contains groups (lists) of sentences.\n        \"\"\"\n        arg_2 = []\n        arg_3 = []\n\n        for arg_4 in range(0, arg_0):\n            if arg_4 % arg_1 == 0:\n                if len(arg_3) > 0:\n                    arg_2.append(arg_3)\n                arg_3 = [arg_4]\n            else:\n                arg_3.append(arg_4)\n\n        if len(arg_3) > 0:\n            arg_2.append(arg_3)\n\n        return arg_2", "path": "nerd/nerd_client.py", "identifier": "NerdClient._group_sentences", "docstring": "Split sentences in groups, given a specific group length.\n\n        Args:\n            total_nb_sentences (int): Total available sentences.\n            group_length (int): Limit of length for each group.\n\n        Returns:\n            list: Contains groups (lists) of sentences.", "docstring_tokens": ["Split", "sentences", "in", "groups", "given", "a", "specific", "group", "length", "."], "nwo": "hirmeos/entity-fishing-client-python", "score": 0.36576314591848075, "idx": 253673}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/admin.py#L127-L139", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Generic redirect for item editor.", "language": "python", "parameters": "(self, request, response)", "return_statement": "return HttpResponseRedirect('')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "'_addanother'", "in", "arg_1", ".", "POST", ":", "return", "HttpResponseRedirect", "(", "'../item_add/'", ")", "elif", "'_save'", "in", "arg_1", ".", "POST", ":", "return", "HttpResponseRedirect", "(", "'../'", ")", "elif", "'_continue'", "in", "arg_1", ".", "POST", ":", "return", "arg_2", "return", "HttpResponseRedirect", "(", "''", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Generic redirect for item editor.\"\"\"\n\n        if '_addanother' in arg_1.POST:\n            return HttpResponseRedirect('../item_add/')\n\n        elif '_save' in arg_1.POST:\n            return HttpResponseRedirect('../')\n\n        elif '_continue' in arg_1.POST:\n            return arg_2\n\n        return HttpResponseRedirect('')", "path": "sitetree/admin.py", "identifier": "TreeItemAdmin._redirect", "docstring": "Generic redirect for item editor.", "docstring_tokens": ["Generic", "redirect", "for", "item", "editor", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 253674}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/megahit.py#L177-L193", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Cleans the temporary fastq files. If they are symlinks, the link\n    source is removed", "language": "python", "parameters": "(fastq)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ":", "arg_2", "=", "os", ".", "path", ".", "realpath", "(", "arg_1", ")", "logger", ".", "debug", "(", "\"Removing temporary fastq file path: {}\"", ".", "format", "(", "arg_2", ")", ")", "if", "re", ".", "match", "(", "\".*/work/.{2}/.{30}/.*\"", ",", "arg_2", ")", ":", "os", ".", "remove", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Cleans the temporary fastq files. If they are symlinks, the link\n    source is removed\n\n    Parameters\n    ----------\n    fastq : list\n        List of fastq files.\n    \"\"\"\n\n    for arg_1 in arg_0:\n        # Get real path of fastq files, following symlinks\n        arg_2 = os.path.realpath(arg_1)\n        logger.debug(\"Removing temporary fastq file path: {}\".format(arg_2))\n        if re.match(\".*/work/.{2}/.{30}/.*\", arg_2):\n            os.remove(arg_2)", "path": "flowcraft/templates/megahit.py", "identifier": "clean_up", "docstring": "Cleans the temporary fastq files. If they are symlinks, the link\n    source is removed\n\n    Parameters\n    ----------\n    fastq : list\n        List of fastq files.", "docstring_tokens": ["Cleans", "the", "temporary", "fastq", "files", ".", "If", "they", "are", "symlinks", "the", "link", "source", "is", "removed"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 253675}
{"url": "https://github.com/Cornices/cornice.ext.swagger/blob/c31a5cc8d5dd112b11dc41ccb6d09b423b537abc/cornice_swagger/swagger.py#L594-L679", "sha": "c31a5cc8d5dd112b11dc41ccb6d09b423b537abc", "docstring_summary": "Extract swagger operation details from colander view definitions.", "language": "python", "parameters": "(self, view, args)", "return_statement": "return op", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "'responses'", ":", "{", "'default'", ":", "{", "'description'", ":", "'UNDOCUMENTED RESPONSE'", "}", "}", ",", "}", "arg_4", "=", "arg_2", ".", "get", "(", "'renderer'", ",", "''", ")", "if", "\"json\"", "in", "arg_4", ":", "arg_5", "=", "[", "'application/json'", "]", "elif", "arg_4", "==", "'xml'", ":", "arg_5", "=", "[", "'text/xml'", "]", "else", ":", "arg_5", "=", "None", "if", "arg_5", ":", "arg_3", ".", "setdefault", "(", "'produces'", ",", "arg_5", ")", "arg_6", "=", "arg_2", ".", "get", "(", "'content_type'", ")", "if", "arg_6", "is", "not", "None", ":", "arg_6", "=", "to_list", "(", "arg_6", ")", "arg_6", "=", "[", "x", "for", "x", "in", "arg_6", "if", "not", "callable", "(", "x", ")", "]", "arg_3", "[", "'consumes'", "]", "=", "arg_6", "arg_7", "=", "arg_0", ".", "_is_colander_schema", "(", "arg_2", ")", "if", "arg_7", ":", "arg_8", "=", "arg_0", ".", "_extract_transform_colander_schema", "(", "arg_2", ")", "arg_9", "=", "arg_0", ".", "parameters", ".", "from_schema", "(", "arg_8", ")", "else", ":", "arg_9", "=", "None", "if", "arg_9", ":", "arg_3", "[", "'parameters'", "]", "=", "arg_9", "if", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "if", "'klass'", "in", "arg_2", ":", "arg_10", "=", "arg_2", "[", "'klass'", "]", "arg_11", "=", "getattr", "(", "arg_10", ",", "arg_1", ".", "lower", "(", ")", ")", "arg_12", "=", "trim", "(", "arg_11", ".", "__doc__", ")", "else", ":", "arg_12", "=", "str", "(", "trim", "(", "arg_1", ".", "__doc__", ")", ")", "if", "arg_12", "and", "arg_0", ".", "summary_docstrings", ":", "arg_3", "[", "'summary'", "]", "=", "arg_12", "if", "'response_schemas'", "in", "arg_2", ":", "arg_3", "[", "'responses'", "]", "=", "arg_0", ".", "responses", ".", "from_schema_mapping", "(", "arg_2", "[", "'response_schemas'", "]", ")", "if", "'tags'", "in", "arg_2", ":", "arg_3", "[", "'tags'", "]", "=", "arg_2", "[", "'tags'", "]", "if", "'operation_id'", "in", "arg_2", ":", "arg_3", "[", "'operationId'", "]", "=", "arg_2", "[", "'operation_id'", "]", "if", "'api_security'", "in", "arg_2", ":", "arg_3", "[", "'security'", "]", "=", "arg_2", "[", "'api_security'", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Extract swagger operation details from colander view definitions.\n\n        :param view:\n            View to extract information from.\n        :param args:\n            Arguments from the view decorator.\n\n        :rtype: dict\n        :returns: Operation definition.\n        \"\"\"\n\n        arg_3 = {\n            'responses': {\n                'default': {\n                    'description': 'UNDOCUMENTED RESPONSE'\n                }\n            },\n        }\n\n        # If 'produces' are not defined in the view, try get from renderers\n        arg_4 = arg_2.get('renderer', '')\n\n        if \"json\" in arg_4:  # allows for \"json\" or \"simplejson\"\n            arg_5 = ['application/json']\n        elif arg_4 == 'xml':\n            arg_5 = ['text/xml']\n        else:\n            arg_5 = None\n\n        if arg_5:\n            arg_3.setdefault('produces', arg_5)\n\n        # Get explicit accepted content-types\n        arg_6 = arg_2.get('content_type')\n\n        if arg_6 is not None:\n            # convert to a list, if it's not yet one\n            arg_6 = to_list(arg_6)\n\n            # It is possible to add callables for content_type, so we have to\n            # to filter those out, since we cannot evaluate those here.\n            arg_6 = [x for x in arg_6 if not callable(x)]\n            arg_3['consumes'] = arg_6\n\n        # Get parameters from view schema\n        arg_7 = arg_0._is_colander_schema(arg_2)\n        if arg_7:\n            arg_8 = arg_0._extract_transform_colander_schema(arg_2)\n            arg_9 = arg_0.parameters.from_schema(arg_8)\n        else:\n            # Bail out for now\n            arg_9 = None\n        if arg_9:\n            arg_3['parameters'] = arg_9\n\n        # Get summary from docstring\n        if isinstance(arg_1, six.string_types):\n            if 'klass' in arg_2:\n                arg_10 = arg_2['klass']\n                arg_11 = getattr(arg_10, arg_1.lower())\n                arg_12 = trim(arg_11.__doc__)\n        else:\n            arg_12 = str(trim(arg_1.__doc__))\n\n        if arg_12 and arg_0.summary_docstrings:\n            arg_3['summary'] = arg_12\n\n        # Get response definitions\n        if 'response_schemas' in arg_2:\n            arg_3['responses'] = arg_0.responses.from_schema_mapping(arg_2['response_schemas'])\n\n        # Get response tags\n        if 'tags' in arg_2:\n            arg_3['tags'] = arg_2['tags']\n\n        # Get response operationId\n        if 'operation_id' in arg_2:\n            arg_3['operationId'] = arg_2['operation_id']\n\n        # Get security policies\n        if 'api_security' in arg_2:\n            arg_3['security'] = arg_2['api_security']\n\n        return arg_3", "path": "cornice_swagger/swagger.py", "identifier": "CorniceSwagger._extract_operation_from_view", "docstring": "Extract swagger operation details from colander view definitions.\n\n        :param view:\n            View to extract information from.\n        :param args:\n            Arguments from the view decorator.\n\n        :rtype: dict\n        :returns: Operation definition.", "docstring_tokens": ["Extract", "swagger", "operation", "details", "from", "colander", "view", "definitions", "."], "nwo": "Cornices/cornice.ext.swagger", "score": 0.28168436607245656, "idx": 253676}
{"url": "https://github.com/askedrelic/pyselect/blob/2f68e3e87e3c44e9d96e1506ba98f9c3a30ded2c/pyselect.py#L11-L46", "sha": "2f68e3e87e3c44e9d96e1506ba98f9c3a30ded2c", "docstring_summary": "pass in a list of options, promt the user to select one, and return the selected option or None", "language": "python", "parameters": "(options=None)", "return_statement": "return options[response]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "not", "arg_0", ":", "return", "None", "arg_1", "=", "len", "(", "str", "(", "len", "(", "arg_0", ")", ")", ")", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_0", ")", ":", "arg_5", ".", "stdout", ".", "write", "(", "'{:{width}}) {}\\n'", ".", "format", "(", "arg_2", "+", "1", ",", "arg_3", ",", "arg_1", "=", "arg_1", ")", ")", "arg_5", ".", "stdout", ".", "write", "(", "'{:>{width}} '", ".", "format", "(", "'#?'", ",", "arg_1", "=", "arg_1", "+", "1", ")", ")", "arg_5", ".", "stdout", ".", "flush", "(", ")", "if", "arg_5", ".", "stdin", ".", "isatty", "(", ")", ":", "try", ":", "arg_4", "=", "raw_input", "(", ")", ".", "strip", "(", ")", "except", "(", "EOFError", ",", "KeyboardInterrupt", ")", ":", "arg_4", "=", "''", "else", ":", "arg_5", ".", "stdin", "=", "open", "(", "\"/dev/tty\"", ")", "try", ":", "arg_4", "=", "''", "while", "True", ":", "arg_4", "+=", "arg_5", ".", "stdin", ".", "read", "(", "1", ")", "if", "arg_4", ".", "endswith", "(", "'\\n'", ")", ":", "break", "except", "(", "EOFError", ",", "KeyboardInterrupt", ")", ":", "arg_5", ".", "stdout", ".", "flush", "(", ")", "pass", "try", ":", "arg_4", "=", "int", "(", "arg_4", ")", "-", "1", "except", "ValueError", ":", "return", "None", "if", "arg_4", "<", "0", "or", "arg_4", ">=", "len", "(", "arg_0", ")", ":", "return", "None", "return", "arg_0", "[", "arg_4", "]"], "function": "def Func(arg_0=None):\n    \"\"\" pass in a list of options, promt the user to Func one, and return the Funced option or None \"\"\"\n    if not arg_0:\n        return None\n    arg_1 = len(str(len(arg_0)))\n    for arg_2,arg_3 in enumerate(arg_0):\n        arg_5.stdout.write('{:{width}}) {}\\n'.format(arg_2+1,arg_3, arg_1=arg_1))\n\n    arg_5.stdout.write('{:>{width}} '.format('#?', arg_1=arg_1+1))\n    arg_5.stdout.flush()\n    if arg_5.stdin.isatty():\n        # regular prompt\n        try:\n            arg_4 = raw_input().strip()\n        except (EOFError, KeyboardInterrupt):\n            # handle ctrl-d, ctrl-c\n            arg_4 = ''\n    else:\n        # try connecting to current tty, when using pipes\n        arg_5.stdin = open(\"/dev/tty\")\n        try:\n            arg_4 = ''\n            while True:\n                arg_4 += arg_5.stdin.read(1)\n                if arg_4.endswith('\\n'):\n                    break\n        except (EOFError, KeyboardInterrupt):\n            arg_5.stdout.flush()\n            pass\n    try:\n        arg_4 = int(arg_4) - 1\n    except ValueError:\n        return None\n    if arg_4 < 0 or arg_4 >= len(arg_0):\n        return None\n    return arg_0[arg_4]", "path": "pyselect.py", "identifier": "select", "docstring": "pass in a list of options, promt the user to select one, and return the selected option or None", "docstring_tokens": ["pass", "in", "a", "list", "of", "options", "promt", "the", "user", "to", "select", "one", "and", "return", "the", "selected", "option", "or", "None"], "nwo": "askedrelic/pyselect", "score": 0.23137166388621372, "idx": 253677}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/hdlSimulator.py#L538-L551", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Run simulation for Unit instance", "language": "python", "parameters": "(self, synthesisedUnit: Unit, until: float, extraProcesses=[])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ",", "arg_5", "=", "[", "]", ")", ":", "arg_6", "=", "arg_0", ".", "config", ".", "beforeSim", "if", "arg_6", "is", "not", "None", ":", "arg_6", "(", "arg_0", ",", "arg_1", ")", "arg_7", "=", "arg_0", ".", "add_process", "for", "arg_8", "in", "arg_5", ":", "arg_7", "(", "arg_8", "(", "arg_0", ")", ")", "arg_0", ".", "_initUnitSignals", "(", "arg_1", ")", "arg_0", ".", "run", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4, arg_5=[]):\n        \"\"\"\n        Run simulation for Unit instance\n        \"\"\"\n        arg_6 = arg_0.config.beforeSim\n        if arg_6 is not None:\n            arg_6(arg_0, arg_1)\n\n        arg_7 = arg_0.add_process\n        for arg_8 in arg_5:\n            arg_7(arg_8(arg_0))\n\n        arg_0._initUnitSignals(arg_1)\n        arg_0.run(arg_3)", "path": "hwt/simulator/hdlSimulator.py", "identifier": "HdlSimulator.simUnit", "docstring": "Run simulation for Unit instance", "docstring_tokens": ["Run", "simulation", "for", "Unit", "instance"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 253678}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/crypto/engine.py#L222-L288", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Generate message authentication code.", "language": "python", "parameters": "(self, algorithm, key, data)", "return_statement": "return mac_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "None", "if", "arg_1", "in", "arg_0", ".", "_hash_algorithms", ".", "keys", "(", ")", ":", "arg_0", ".", "logger", ".", "info", "(", "\"Generating a hash-based message authentication code using \"", "\"{0}\"", ".", "format", "(", "arg_1", ".", "name", ")", ")", "arg_5", "=", "arg_0", ".", "_hash_algorithms", ".", "get", "(", "arg_1", ")", "try", ":", "arg_6", "=", "hFunc", ".", "HMAC", "(", "arg_2", ",", "arg_5", "(", ")", ",", "backend", "=", "default_backend", "(", ")", ")", "arg_6", ".", "update", "(", "arg_3", ")", "arg_4", "=", "arg_6", ".", "finalize", "(", ")", "except", "Exception", "as", "e", ":", "arg_0", ".", "logger", ".", "exception", "(", "e", ")", "raise", "exceptions", ".", "CryptographicFailure", "(", "\"An error occurred while computing an HMAC. \"", "\"See the server log for more information.\"", ")", "elif", "arg_1", "in", "arg_0", ".", "_symmetric_key_algorithms", ".", "keys", "(", ")", ":", "arg_0", ".", "logger", ".", "info", "(", "\"Generating a cipher-based message authentication code using \"", "\"{0}\"", ".", "format", "(", "arg_1", ".", "name", ")", ")", "arg_7", "=", "arg_0", ".", "_symmetric_key_algorithms", ".", "get", "(", "arg_1", ")", "try", ":", "arg_8", "=", "cFunc", ".", "CMAC", "(", "arg_7", "(", "arg_2", ")", ",", "backend", "=", "default_backend", "(", ")", ")", "arg_8", ".", "update", "(", "arg_3", ")", "arg_4", "=", "arg_8", ".", "finalize", "(", ")", "except", "Exception", "as", "e", ":", "raise", "exceptions", ".", "CryptographicFailure", "(", "\"An error occurred while computing a CMAC. \"", "\"See the server log for more information.\"", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The cryptographic algorithm ({0}) is not a supported \"", "\"for a MAC operation.\"", ".", "format", "(", "arg_1", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Generate message authentication code.\n\n        Args:\n            algorithm(CryptographicAlgorithm): An enumeration specifying the\n                algorithm for which the MAC operation will use.\n            key(bytes): secret key used in the MAC operation\n            data(bytes): The data to be MACed.\n\n        Returns:\n            bytes: The MACed data\n\n        Raises:\n            InvalidField: Raised when the algorithm is unsupported or the\n                length is incompatible with the algorithm.\n            CryptographicFailure: Raised when the key generation process\n                fails.\n\n        Example:\n            >>> engine = CryptographyEngine()\n            >>> Func_data = engine.Func(\n            ...     CryptographicAlgorithm.HMAC-SHA256, b'\\x01\\x02\\x03\\x04',\n            ...     b'\\x05\\x06\\x07\\x08')\n        \"\"\"\n\n        arg_4 = None\n\n        if arg_1 in arg_0._hash_algorithms.keys():\n            arg_0.logger.info(\n                \"Generating a hash-based message authentication code using \"\n                \"{0}\".format(arg_1.name)\n            )\n            arg_5 = arg_0._hash_algorithms.get(arg_1)\n            try:\n                arg_6 = hFunc.HMAC(arg_2, arg_5(), backend=default_backend())\n                arg_6.update(arg_3)\n                arg_4 = arg_6.finalize()\n            except Exception as e:\n                arg_0.logger.exception(e)\n                raise exceptions.CryptographicFailure(\n                    \"An error occurred while computing an HMAC. \"\n                    \"See the server log for more information.\"\n                )\n        elif arg_1 in arg_0._symmetric_key_algorithms.keys():\n            arg_0.logger.info(\n                \"Generating a cipher-based message authentication code using \"\n                \"{0}\".format(arg_1.name)\n            )\n            arg_7 = arg_0._symmetric_key_algorithms.get(arg_1)\n            try:\n                # ARC4 and IDEA algorithms will raise exception as CMAC\n                # requires block ciphers\n                arg_8 = cFunc.CMAC(arg_7(arg_2), backend=default_backend())\n                arg_8.update(arg_3)\n                arg_4 = arg_8.finalize()\n            except Exception as e:\n                raise exceptions.CryptographicFailure(\n                    \"An error occurred while computing a CMAC. \"\n                    \"See the server log for more information.\"\n                )\n        else:\n            raise exceptions.InvalidField(\n                \"The cryptographic algorithm ({0}) is not a supported \"\n                \"for a MAC operation.\".format(arg_1)\n            )\n        return arg_4", "path": "kmip/services/server/crypto/engine.py", "identifier": "CryptographyEngine.mac", "docstring": "Generate message authentication code.\n\n        Args:\n            algorithm(CryptographicAlgorithm): An enumeration specifying the\n                algorithm for which the MAC operation will use.\n            key(bytes): secret key used in the MAC operation\n            data(bytes): The data to be MACed.\n\n        Returns:\n            bytes: The MACed data\n\n        Raises:\n            InvalidField: Raised when the algorithm is unsupported or the\n                length is incompatible with the algorithm.\n            CryptographicFailure: Raised when the key generation process\n                fails.\n\n        Example:\n            >>> engine = CryptographyEngine()\n            >>> mac_data = engine.mac(\n            ...     CryptographicAlgorithm.HMAC-SHA256, b'\\x01\\x02\\x03\\x04',\n            ...     b'\\x05\\x06\\x07\\x08')", "docstring_tokens": ["Generate", "message", "authentication", "code", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 253679}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_baystat.py#L214-L249", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the Baystat distance.", "language": "python", "parameters": "(src, tar, min_ss_len=None, left_ext=None, right_ext=None)", "return_statement": "return Baystat().dist(src, tar, min_ss_len, left_ext, right_ext)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "return", "Baystat", "(", ")", ".", "dist", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n    \"\"\"Return the Baystat distance.\n\n    This is a wrapper for :py:meth:`Baystat.dist`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    min_ss_len : int\n        Minimum substring length to be considered\n    left_ext : int\n        Left-side extension length\n    right_ext : int\n        Right-side extension length\n\n    Returns\n    -------\n    float\n        The Baystat distance\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.333333333333\n    >>> Func('Niall', 'Neil')\n    0.6\n    >>> round(Func('Colin', 'Cuilen'), 12)\n    0.833333333333\n    >>> Func('ATCG', 'TAGC')\n    1.0\n\n    \"\"\"\n    return Baystat().dist(arg_0, arg_1, arg_2, arg_3, arg_4)", "path": "abydos/distance/_baystat.py", "identifier": "dist_baystat", "docstring": "Return the Baystat distance.\n\n    This is a wrapper for :py:meth:`Baystat.dist`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    min_ss_len : int\n        Minimum substring length to be considered\n    left_ext : int\n        Left-side extension length\n    right_ext : int\n        Right-side extension length\n\n    Returns\n    -------\n    float\n        The Baystat distance\n\n    Examples\n    --------\n    >>> round(dist_baystat('cat', 'hat'), 12)\n    0.333333333333\n    >>> dist_baystat('Niall', 'Neil')\n    0.6\n    >>> round(dist_baystat('Colin', 'Cuilen'), 12)\n    0.833333333333\n    >>> dist_baystat('ATCG', 'TAGC')\n    1.0", "docstring_tokens": ["Return", "the", "Baystat", "distance", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 253680}
{"url": "https://github.com/alexprengere/currencyconverter/blob/e3cb0d693819c0c824214225b23a47e9380f71df/currency_converter/__main__.py#L16-L25", "sha": "e3cb0d693819c0c824214225b23a47e9380f71df", "docstring_summary": "Group iterable by n elements.", "language": "python", "parameters": "(iterable, n, fillvalue=None)", "return_statement": "return list(zip_longest(*[iter(iterable)] * n, fillvalue=fillvalue))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "list", "(", "zip_longest", "(", "*", "[", "iter", "(", "arg_0", ")", "]", "*", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Group iterable by n elements.\n\n    >>> for t in Func('abcdefg', 3, fillvalue='x'):\n    ...     print(''.join(t))\n    abc\n    def\n    gxx\n    \"\"\"\n    return list(zip_longest(*[iter(arg_0)] * arg_1, arg_2=arg_2))", "path": "currency_converter/__main__.py", "identifier": "grouper", "docstring": "Group iterable by n elements.\n\n    >>> for t in grouper('abcdefg', 3, fillvalue='x'):\n    ...     print(''.join(t))\n    abc\n    def\n    gxx", "docstring_tokens": ["Group", "iterable", "by", "n", "elements", "."], "nwo": "alexprengere/currencyconverter", "score": 0.5486903423646818, "idx": 253681}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/txn.py#L149-L206", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "- Value of purchases and sales divided\n    by either the actual gross book or the portfolio value\n    for the time step.", "language": "python", "parameters": "(positions, transactions, denominator='AGB')", "return_statement": "return turnover", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'AGB'", ")", ":", "arg_3", "=", "get_txn_vol", "(", "arg_1", ")", "arg_4", "=", "arg_3", ".", "txn_volume", "if", "arg_2", "==", "'AGB'", ":", "arg_5", "=", "arg_0", ".", "drop", "(", "'cash'", ",", "axis", "=", "1", ")", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "1", ")", "arg_6", "=", "arg_5", ".", "rolling", "(", "2", ")", ".", "mean", "(", ")", "arg_6", ".", "iloc", "[", "0", "]", "=", "arg_5", ".", "iloc", "[", "0", "]", "/", "2", "elif", "arg_2", "==", "'portfolio_value'", ":", "arg_6", "=", "arg_0", ".", "sum", "(", "axis", "=", "1", ")", "else", ":", "raise", "ValueError", "(", "\"Unexpected value for denominator '{}'. The \"", "\"denominator parameter must be either 'AGB'\"", "\" or 'portfolio_value'.\"", ".", "format", "(", "arg_2", ")", ")", "arg_6", ".", "index", "=", "arg_6", ".", "index", ".", "normalize", "(", ")", "arg_9", "=", "arg_4", ".", "div", "(", "arg_6", ",", "axis", "=", "'index'", ")", "arg_9", "=", "arg_9", ".", "fillna", "(", "0", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2='AGB'):\n    \"\"\"\n     - Value of purchases and sales divided\n    by either the actual gross book or the portfolio value\n    for the time step.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Contains daily position values including cash.\n        - See full explanation in tears.create_full_tear_sheet\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n        - See full explanation in tears.create_full_tear_sheet\n    denominator : str, optional\n        Either 'AGB' or 'portfolio_value', default AGB.\n        - AGB (Actual gross book) is the gross market\n        value (GMV) of the specific algo being analyzed.\n        Swapping out an entire portfolio of stocks for\n        another will yield 200% turnover, not 100%, since\n        transactions are being made for both sides.\n        - We use average of the previous and the current end-of-period\n        AGB to avoid singularities when trading only into or\n        out of an entire book in one trading period.\n        - portfolio_value is the total value of the algo's\n        positions end-of-period, including cash.\n\n    Returns\n    -------\n    turnover_rate : pd.Series\n        timeseries of portfolio turnover rates.\n    \"\"\"\n\n    arg_3 = get_txn_vol(arg_1)\n    arg_4 = arg_3.txn_volume\n\n    if arg_2 == 'AGB':\n        # Actual gross book is the same thing as the algo's GMV\n        # We want our denom to be avg(AGB previous, AGB current)\n        arg_5 = arg_0.drop('cash', axis=1).abs().sum(axis=1)\n        arg_6 = arg_5.rolling(2).mean()\n\n        # Since the first value of pd.rolling returns NaN, we\n        # set our \"day 0\" AGB to 0.\n        arg_6.iloc[0] = arg_5.iloc[0] / 2\n    elif arg_2 == 'portfolio_value':\n        arg_6 = arg_0.sum(axis=1)\n    else:\n        raise ValueError(\n            \"Unexpected value for denominator '{}'. The \"\n            \"denominator parameter must be either 'AGB'\"\n            \" or 'portfolio_value'.\".format(arg_2)\n        )\n\n    arg_6.index = arg_6.index.normalize()\n    arg_9 = arg_4.div(arg_6, axis='index')\n    arg_9 = arg_9.fillna(0)\n    return arg_9", "path": "pyfolio/txn.py", "identifier": "get_turnover", "docstring": "- Value of purchases and sales divided\n    by either the actual gross book or the portfolio value\n    for the time step.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Contains daily position values including cash.\n        - See full explanation in tears.create_full_tear_sheet\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n        - See full explanation in tears.create_full_tear_sheet\n    denominator : str, optional\n        Either 'AGB' or 'portfolio_value', default AGB.\n        - AGB (Actual gross book) is the gross market\n        value (GMV) of the specific algo being analyzed.\n        Swapping out an entire portfolio of stocks for\n        another will yield 200% turnover, not 100%, since\n        transactions are being made for both sides.\n        - We use average of the previous and the current end-of-period\n        AGB to avoid singularities when trading only into or\n        out of an entire book in one trading period.\n        - portfolio_value is the total value of the algo's\n        positions end-of-period, including cash.\n\n    Returns\n    -------\n    turnover_rate : pd.Series\n        timeseries of portfolio turnover rates.", "docstring_tokens": ["-", "Value", "of", "purchases", "and", "sales", "divided", "by", "either", "the", "actual", "gross", "book", "or", "the", "portfolio", "value", "for", "the", "time", "step", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 253682}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L195-L204", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Writes data to the zip file and adds it to the manifest dictionary", "language": "python", "parameters": "(self, filename, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "manifest", "[", "arg_1", "]", "=", "md5hash", "(", "arg_2", ")", "arg_0", ".", "package_zip", ".", "writestr", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Writes data to the zip file and adds it to the manifest dictionary\n\n        :param filename: The zip file name\n\n        :param data: the data\n        \"\"\"\n        arg_0.manifest[arg_1] = md5hash(arg_2)\n        arg_0.package_zip.writestr(arg_1, arg_2)", "path": "SpiffWorkflow/bpmn/serializer/Packager.py", "identifier": "Packager.write_to_package_zip", "docstring": "Writes data to the zip file and adds it to the manifest dictionary\n\n        :param filename: The zip file name\n\n        :param data: the data", "docstring_tokens": ["Writes", "data", "to", "the", "zip", "file", "and", "adds", "it", "to", "the", "manifest", "dictionary"], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 253683}
{"url": "https://github.com/keflavich/plfit/blob/7dafa6302b427ba8c89651148e3e9d29add436c3/plfit/plfit.py#L999-L1013", "sha": "7dafa6302b427ba8c89651148e3e9d29add436c3", "docstring_summary": "Equation B.17 of Clauset et al 2009", "language": "python", "parameters": "(data, xmin)", "return_statement": "return alpha", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "arg_0", ">=", "arg_1", ")", "arg_3", "=", "arg_2", ".", "sum", "(", ")", "if", "arg_3", "<", "2", ":", "return", "0", "arg_4", "=", "arg_0", "[", "arg_2", "]", "arg_5", "=", "1.0", "+", "float", "(", "arg_3", ")", "*", "(", "sum", "(", "log", "(", "arg_4", "/", "(", "float", "(", "arg_1", ")", "-", "0.5", ")", ")", ")", ")", "**", "-", "1", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Equation B.17 of Clauset et al 2009\n\n    The Maximum Likelihood Estimator of the \"scaling parameter\" alpha in the\n    discrete case is similar to that in the continuous case\n    \"\"\"\n    # boolean indices of positive data\n    arg_2 = (arg_0>=arg_1)\n    arg_3 = arg_2.sum()\n    if arg_3 < 2:\n        return 0\n    arg_4 = arg_0[arg_2]\n    arg_5 = 1.0 + float(arg_3) * (sum(log(arg_4/(float(arg_1)-0.5))))**-1\n    return arg_5", "path": "plfit/plfit.py", "identifier": "discrete_alpha_mle", "docstring": "Equation B.17 of Clauset et al 2009\n\n    The Maximum Likelihood Estimator of the \"scaling parameter\" alpha in the\n    discrete case is similar to that in the continuous case", "docstring_tokens": ["Equation", "B", ".", "17", "of", "Clauset", "et", "al", "2009"], "nwo": "keflavich/plfit", "score": 0.19603574719240768, "idx": 253684}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/batteries.py#L520-L533", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Release previously-acquired lock.", "language": "python", "parameters": "(self, lockID, callback=None, sync=False, timeout=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "arg_0", ".", "__lockImpl", ".", "Func", "(", "arg_1", ",", "arg_0", ".", "__selfID", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False, arg_4=None):\n        \"\"\"\n        Release previously-acquired lock.\n\n        :param lockID:  unique lock identifier.\n        :type lockID: str\n        :param sync: True - to wait until lock is Funcd or failed to Func.\n        :type sync: bool\n        :param callback: if sync is False - callback will be called with operation result.\n        :type callback: func(opResult, error)\n        :param timeout: max operation time (default - unlimited)\n        :type timeout: float\n        \"\"\"\n        arg_0.__lockImpl.Func(arg_1, arg_0.__selfID, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "pysyncobj/batteries.py", "identifier": "ReplLockManager.release", "docstring": "Release previously-acquired lock.\n\n        :param lockID:  unique lock identifier.\n        :type lockID: str\n        :param sync: True - to wait until lock is released or failed to release.\n        :type sync: bool\n        :param callback: if sync is False - callback will be called with operation result.\n        :type callback: func(opResult, error)\n        :param timeout: max operation time (default - unlimited)\n        :type timeout: float", "docstring_tokens": ["Release", "previously", "-", "acquired", "lock", "."], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 253685}
{"url": "https://github.com/nicolas-van/mailflash/blob/794598d9df0e343bb1f64b03d09a68a540229774/mailflash.py#L306-L374", "sha": "794598d9df0e343bb1f64b03d09a68a540229774", "docstring_summary": "Creates the email", "language": "python", "parameters": "(self, default_from=None)", "return_statement": "return msg.as_string()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "charset", "or", "'utf-8'", "arg_3", "=", "arg_0", ".", "attachments", "or", "[", "]", "if", "len", "(", "arg_3", ")", "==", "0", "and", "not", "arg_0", ".", "html", ":", "arg_4", "=", "arg_0", ".", "_mimetext", "(", "arg_0", ".", "body", ")", "elif", "len", "(", "arg_3", ")", ">", "0", "and", "not", "arg_0", ".", "html", ":", "arg_4", "=", "MIMEMultipart", "(", ")", "arg_4", ".", "attach", "(", "arg_0", ".", "_mimetext", "(", "arg_0", ".", "body", ")", ")", "else", ":", "arg_4", "=", "MIMEMultipart", "(", ")", "arg_5", "=", "MIMEMultipart", "(", "'alternative'", ")", "arg_5", ".", "attach", "(", "arg_0", ".", "_mimetext", "(", "arg_0", ".", "body", ",", "'plain'", ")", ")", "arg_5", ".", "attach", "(", "arg_0", ".", "_mimetext", "(", "arg_0", ".", "html", ",", "'html'", ")", ")", "arg_4", ".", "attach", "(", "arg_5", ")", "if", "arg_0", ".", "charset", ":", "arg_4", "[", "'Subject'", "]", "=", "Header", "(", "arg_0", ".", "subject", ",", "arg_2", ")", "else", ":", "arg_4", "[", "'Subject'", "]", "=", "arg_0", ".", "subject", "arg_6", "=", "arg_0", ".", "sender", "or", "arg_1", "if", "arg_6", "is", "not", "None", ":", "arg_4", "[", "'From'", "]", "=", "sanitize_address", "(", "arg_6", ",", "arg_2", ")", "arg_4", "[", "'To'", "]", "=", "', '", ".", "join", "(", "list", "(", "set", "(", "sanitize_addresses", "(", "arg_0", ".", "recipients", ",", "arg_2", ")", ")", ")", ")", "arg_4", "[", "'Date'", "]", "=", "formatdate", "(", "arg_0", ".", "date", ",", "localtime", "=", "True", ")", "arg_4", "[", "'Message-ID'", "]", "=", "arg_0", ".", "msgId", "if", "arg_0", ".", "cc", ":", "arg_4", "[", "'Cc'", "]", "=", "', '", ".", "join", "(", "list", "(", "set", "(", "sanitize_addresses", "(", "arg_0", ".", "cc", ",", "arg_2", ")", ")", ")", ")", "if", "arg_0", ".", "reply_to", ":", "arg_4", "[", "'Reply-To'", "]", "=", "sanitize_address", "(", "arg_0", ".", "reply_to", ",", "arg_2", ")", "if", "arg_0", ".", "extra_headers", ":", "for", "arg_7", ",", "arg_8", "in", "arg_0", ".", "extra_headers", ".", "items", "(", ")", ":", "arg_4", "[", "arg_7", "]", "=", "arg_8", "for", "arg_9", "in", "arg_3", ":", "arg_10", "=", "MIMEBase", "(", "*", "arg_9", ".", "content_type", ".", "split", "(", "'/'", ")", ")", "arg_10", ".", "set_payload", "(", "arg_9", ".", "data", ")", "encode_base64", "(", "arg_10", ")", "try", ":", "arg_9", ".", "filename", "and", "arg_9", ".", "filename", ".", "encode", "(", "'ascii'", ")", "except", "UnicodeEncodeError", ":", "arg_11", "=", "arg_9", ".", "filename", "if", "not", "PY3", ":", "arg_11", "=", "arg_11", ".", "encode", "(", "'utf8'", ")", "arg_10", ".", "add_header", "(", "'Content-Disposition'", ",", "arg_9", ".", "disposition", ",", "arg_11", "=", "(", "'UTF8'", ",", "''", ",", "arg_11", ")", ")", "else", ":", "arg_10", ".", "add_header", "(", "'Content-Disposition'", ",", "'%s;filename=%s'", "%", "(", "arg_9", ".", "disposition", ",", "arg_9", ".", "filename", ")", ")", "for", "arg_12", ",", "arg_13", "in", "arg_9", ".", "headers", ":", "arg_10", ".", "add_header", "(", "arg_12", ",", "arg_13", ")", "arg_4", ".", "attach", "(", "arg_10", ")", "return", "arg_4", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Creates the email\"\"\"\n\n        arg_2 = arg_0.charset or 'utf-8'\n\n        arg_3 = arg_0.attachments or []\n\n        if len(arg_3) == 0 and not arg_0.html:\n            # No html content and zero attachments means plain text\n            arg_4 = arg_0._mimetext(arg_0.body)\n        elif len(arg_3) > 0 and not arg_0.html:\n            # No html and at least one attachment means multipart\n            arg_4 = MIMEMultipart()\n            arg_4.attach(arg_0._mimetext(arg_0.body))\n        else:\n            # Anything else\n            arg_4 = MIMEMultipart()\n            arg_5 = MIMEMultipart('alternative')\n            arg_5.attach(arg_0._mimetext(arg_0.body, 'plain'))\n            arg_5.attach(arg_0._mimetext(arg_0.html, 'html'))\n            arg_4.attach(arg_5)\n\n        if arg_0.charset:\n            arg_4['Subject'] = Header(arg_0.subject, arg_2)\n        else:\n            arg_4['Subject'] = arg_0.subject\n\n        arg_6 = arg_0.sender or arg_1\n        if arg_6 is not None:\n            arg_4['From'] = sanitize_address(arg_6, arg_2)\n        arg_4['To'] = ', '.join(list(set(sanitize_addresses(arg_0.recipients, arg_2))))\n\n        arg_4['Date'] = formatdate(arg_0.date, localtime=True)\n        # see RFC 5322 section 3.6.4.\n        arg_4['Message-ID'] = arg_0.msgId\n\n        if arg_0.cc:\n            arg_4['Cc'] = ', '.join(list(set(sanitize_addresses(arg_0.cc, arg_2))))\n\n        if arg_0.reply_to:\n            arg_4['Reply-To'] = sanitize_address(arg_0.reply_to, arg_2)\n\n        if arg_0.extra_headers:\n            for arg_7, arg_8 in arg_0.extra_headers.items():\n                arg_4[arg_7] = arg_8\n\n        for arg_9 in arg_3:\n            arg_10 = MIMEBase(*arg_9.content_type.split('/'))\n            arg_10.set_payload(arg_9.data)\n            encode_base64(arg_10)\n\n            try:\n                arg_9.filename and arg_9.filename.encode('ascii')\n            except UnicodeEncodeError:\n                arg_11 = arg_9.filename\n                if not PY3:\n                    arg_11 = arg_11.encode('utf8')\n                arg_10.add_header('Content-Disposition', arg_9.disposition,\n                            arg_11=('UTF8', '', arg_11))\n            else:\n                arg_10.add_header('Content-Disposition', '%s;filename=%s' %\n                             (arg_9.disposition, arg_9.filename))\n\n            for arg_12, arg_13 in arg_9.headers:\n                arg_10.add_header(arg_12, arg_13)\n\n            arg_4.attach(arg_10)\n\n        return arg_4.Func()", "path": "mailflash.py", "identifier": "Message.as_string", "docstring": "Creates the email", "docstring_tokens": ["Creates", "the", "email"], "nwo": "nicolas-van/mailflash", "score": 0.28011057986078114, "idx": 253686}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/commands/infer.py#L92-L122", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Make a prediction with the component described in corresponding configuration file.", "language": "python", "parameters": "(config: Union[str, Path, dict], batch_size: int = 1, file_path: Optional[str] = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", ",", "arg_4", "]", ",", "arg_5", ":", "arg_6", "=", "1", ",", "arg_7", ":", "arg_8", "[", "arg_2", "]", "=", "None", ")", "->", "None", ":", "if", "arg_7", "is", "None", "or", "arg_7", "==", "'-'", ":", "if", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "raise", "RuntimeError", "(", "'To process data from terminal please use interact mode'", ")", "arg_9", "=", "sys", ".", "stdin", "else", ":", "arg_9", "=", "open", "(", "arg_7", ",", "encoding", "=", "'utf8'", ")", "arg_10", ":", "Chainer", "=", "build_model", "(", "arg_0", ")", "arg_11", "=", "len", "(", "arg_10", ".", "in_x", ")", "while", "True", ":", "arg_12", "=", "list", "(", "(", "l", ".", "strip", "(", ")", "for", "l", "in", "islice", "(", "arg_9", ",", "arg_5", "*", "arg_11", ")", ")", ")", "if", "not", "arg_12", ":", "break", "arg_13", "=", "[", "]", "for", "arg_14", "in", "range", "(", "arg_11", ")", ":", "arg_13", ".", "append", "(", "arg_12", "[", "arg_14", ":", ":", "arg_11", "]", ")", "arg_15", "=", "arg_10", "(", "*", "arg_13", ")", "if", "len", "(", "arg_10", ".", "out_params", ")", "==", "1", ":", "arg_15", "=", "[", "arg_15", "]", "for", "arg_15", "in", "zip", "(", "*", "arg_15", ")", ":", "arg_15", "=", "json", ".", "dumps", "(", "arg_15", ",", "ensure_ascii", "=", "False", ")", "print", "(", "arg_15", ",", "flush", "=", "True", ")", "if", "arg_9", "is", "not", "sys", ".", "stdin", ":", "arg_9", ".", "close", "(", ")"], "function": "def Func(arg_0: arg_1[arg_2, arg_3, arg_4], arg_5: arg_6 = 1, arg_7: arg_8[arg_2] = None) -> None:\n    \"\"\"Make a prediction with the component described in corresponding configuration file.\"\"\"\n    if arg_7 is None or arg_7 == '-':\n        if sys.stdin.isatty():\n            raise RuntimeError('To process data from terminal please use interact mode')\n        arg_9 = sys.stdin\n    else:\n        arg_9 = open(arg_7, encoding='utf8')\n\n    arg_10: Chainer = build_model(arg_0)\n\n    arg_11 = len(arg_10.in_x)\n    while True:\n        arg_12 = list((l.strip() for l in islice(arg_9, arg_5 * arg_11)))\n\n        if not arg_12:\n            break\n\n        arg_13 = []\n        for arg_14 in range(arg_11):\n            arg_13.append(arg_12[arg_14::arg_11])\n\n        arg_15 = arg_10(*arg_13)\n        if len(arg_10.out_params) == 1:\n            arg_15 = [arg_15]\n        for arg_15 in zip(*arg_15):\n            arg_15 = json.dumps(arg_15, ensure_ascii=False)\n            print(arg_15, flush=True)\n\n    if arg_9 is not sys.stdin:\n        arg_9.close()", "path": "deeppavlov/core/commands/infer.py", "identifier": "predict_on_stream", "docstring": "Make a prediction with the component described in corresponding configuration file.", "docstring_tokens": ["Make", "a", "prediction", "with", "the", "component", "described", "in", "corresponding", "configuration", "file", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 253687}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/random/_ggp.py#L52-L77", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "r\"\"\"Sample from the specified distribution.", "language": "python", "parameters": "(self, random_state=None)", "return_statement": "return self._lik.sample(multivariate_normal(m, K, random_state), random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "from", "numpy_sugar", "import", "epsilon", "from", "numpy_sugar", ".", "linalg", "import", "sum2diag", "from", "numpy_sugar", ".", "random", "import", "multivariate_normal", "if", "arg_1", "is", "None", ":", "arg_1", "=", "RandomState", "(", ")", "arg_2", "=", "arg_0", ".", "_mean", ".", "value", "(", ")", "arg_3", "=", "arg_0", ".", "_cov", ".", "value", "(", ")", ".", "copy", "(", ")", "sum2diag", "(", "arg_3", ",", "+", "epsilon", ".", "small", ",", "out", "=", "arg_3", ")", "return", "arg_0", ".", "_lik", ".", "Func", "(", "multivariate_normal", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        r\"\"\"Sample from the specified distribution.\n\n        Parameters\n        ----------\n        random_state : random_state\n            Set the initial random state.\n\n        Returns\n        -------\n        numpy.ndarray\n            Sample.\n        \"\"\"\n        from numpy_sugar import epsilon\n        from numpy_sugar.linalg import sum2diag\n        from numpy_sugar.random import multivariate_normal\n\n        if arg_1 is None:\n            arg_1 = RandomState()\n\n        arg_2 = arg_0._mean.value()\n        arg_3 = arg_0._cov.value().copy()\n\n        sum2diag(arg_3, +epsilon.small, out=arg_3)\n\n        return arg_0._lik.Func(multivariate_normal(arg_2, arg_3, arg_1), arg_1)", "path": "glimix_core/random/_ggp.py", "identifier": "GGPSampler.sample", "docstring": "r\"\"\"Sample from the specified distribution.\n\n        Parameters\n        ----------\n        random_state : random_state\n            Set the initial random state.\n\n        Returns\n        -------\n        numpy.ndarray\n            Sample.", "docstring_tokens": ["r", "Sample", "from", "the", "specified", "distribution", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 253688}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_tree.py#L90-L106", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Appends a child to the object's children.", "language": "python", "parameters": "( self, object, child )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "isinstance", "(", "arg_2", ",", "Subgraph", ")", ":", "arg_1", ".", "subgraphs", ".", "append", "(", "arg_2", ")", "elif", "isinstance", "(", "arg_2", ",", "Cluster", ")", ":", "arg_1", ".", "clusters", ".", "append", "(", "arg_2", ")", "elif", "isinstance", "(", "arg_2", ",", "Node", ")", ":", "arg_1", ".", "nodes", ".", "append", "(", "arg_2", ")", "elif", "isinstance", "(", "arg_2", ",", "Edge", ")", ":", "arg_1", ".", "edges", ".", "append", "(", "arg_2", ")", "else", ":", "pass"], "function": "def Func ( arg_0, arg_1, arg_2 ):\n        \"\"\" Appends a child to the object's children.\n        \"\"\"\n        if isinstance( arg_2, Subgraph ):\n            arg_1.subgraphs.append( arg_2 )\n\n        elif isinstance( arg_2, Cluster ):\n            arg_1.clusters.append( arg_2 )\n\n        elif isinstance( arg_2, Node ):\n            arg_1.nodes.append( arg_2 )\n\n        elif isinstance( arg_2, Edge ):\n            arg_1.edges.append( arg_2 )\n\n        else:\n            pass", "path": "godot/ui/graph_tree.py", "identifier": "BaseGraphTreeNode.append_child", "docstring": "Appends a child to the object's children.", "docstring_tokens": ["Appends", "a", "child", "to", "the", "object", "s", "children", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 253689}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L183-L196", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Process a message received from remote.", "language": "python", "parameters": "(self, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "ws", ".", "closed", ":", "return", "None", "try", ":", "safe_call", "(", "arg_0", ".", "logger", ".", "debug", ",", "'< %s %r'", ",", "arg_0", ",", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "ddp_frames_from_message", "(", "arg_1", ")", ":", "arg_0", ".", "process_ddp", "(", "arg_2", ")", "signals", ".", "request_finished", ".", "send", "(", "sender", "=", "arg_0", ".", "__class__", ")", "except", "geventwebsocket", ".", "WebSocketError", ":", "arg_0", ".", "ws", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process a message received from remote.\"\"\"\n        if arg_0.ws.closed:\n            return None\n        try:\n            safe_call(arg_0.logger.debug, '< %s %r', arg_0, arg_1)\n\n            # process individual messages\n            for arg_2 in arg_0.ddp_frames_from_message(arg_1):\n                arg_0.process_ddp(arg_2)\n                # emit request_finished signal to close DB connections\n                signals.request_finished.send(sender=arg_0.__class__)\n        except geventwebsocket.WebSocketError:\n            arg_0.ws.close()", "path": "dddp/websocket.py", "identifier": "DDPWebSocketApplication.on_message", "docstring": "Process a message received from remote.", "docstring_tokens": ["Process", "a", "message", "received", "from", "remote", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 253690}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1727-L1731", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Handler for del command", "language": "python", "parameters": "(self, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "validate", "(", "'cmd|s3'", ",", "arg_1", ")", "arg_2", "=", "arg_1", "[", "1", "]", "arg_0", ".", "s3handler", "(", ")", ".", "del_files", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    '''Handler for del command'''\n    arg_0.validate('cmd|s3', arg_1)\n    arg_2 = arg_1[1]\n    arg_0.s3handler().del_files(arg_2)", "path": "s4cmd.py", "identifier": "CommandHandler.del_handler", "docstring": "Handler for del command", "docstring_tokens": ["Handler", "for", "del", "command"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 253691}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeregression.py#L292-L310", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "regress tip values against branch values", "language": "python", "parameters": "(self, slope=None)", "return_statement": "return clock_model", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", ".", "_calculate_averages", "(", ")", "arg_2", "=", "base_Func", "(", "arg_0", ".", "tree", ".", "root", ".", "Q", ",", "arg_1", ")", "arg_2", "[", "'r_val'", "]", "=", "arg_0", ".", "explained_variance", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"regress tip values against branch values\n\n        Parameters\n        ----------\n        slope : None, optional\n            if given, the slope isn't optimized\n\n        Returns\n        -------\n        dict\n            Func parameters\n        \"\"\"\n        arg_0._calculate_averages()\n\n        arg_2 = base_Func(arg_0.tree.root.Q, arg_1)\n        arg_2['r_val'] = arg_0.explained_variance()\n\n        return arg_2", "path": "treetime/treeregression.py", "identifier": "TreeRegression.regression", "docstring": "regress tip values against branch values\n\n        Parameters\n        ----------\n        slope : None, optional\n            if given, the slope isn't optimized\n\n        Returns\n        -------\n        dict\n            regression parameters", "docstring_tokens": ["regress", "tip", "values", "against", "branch", "values"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 253692}
{"url": "https://github.com/jdrumgoole/pymongo_formatter/blob/313fef8f2ff5e7d4f1515ea59a99ec25f7999e7b/pymongo_formatter/formatter.py#L80-L99", "sha": "313fef8f2ff5e7d4f1515ea59a99ec25f7999e7b", "docstring_summary": "Take 'doc' and create a new doc using only keys from the 'fields' list.\n        Supports referencing fields using dotted notation \"a.b.c\" so we can parse\n        nested fields the way MongoDB does. The nested field class is a hack. It should\n        be a sub-class of dict.", "language": "python", "parameters": "(doc, field_list)", "return_statement": "return newDoc.dict_value()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", "or", "len", "(", "arg_1", ")", "==", "0", ":", "return", "arg_0", "arg_2", "=", "Nested_Dict", "(", "{", "}", ")", "arg_3", "=", "Nested_Dict", "(", "arg_0", ")", "for", "arg_4", "in", "arg_1", ":", "if", "arg_3", ".", "has_key", "(", "arg_4", ")", ":", "arg_2", ".", "set_value", "(", "arg_4", ",", "arg_3", ".", "get_value", "(", "arg_4", ")", ")", "return", "arg_2", ".", "dict_value", "(", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Take 'doc' and create a new doc using only keys from the 'fields' list.\n        Supports referencing fields using dotted notation \"a.b.c\" so we can parse\n        nested fields the way MongoDB does. The nested field class is a hack. It should\n        be a sub-class of dict.\n        '''\n\n        if arg_1 is None or len(arg_1) == 0:\n            return arg_0\n\n        arg_2 = Nested_Dict({})\n        arg_3 = Nested_Dict(arg_0)\n\n        for arg_4 in arg_1:\n            if arg_3.has_key(arg_4):\n                # print( \"doc: %s\" % doc )\n                # print( \"i: %s\" %i )\n                arg_2.set_value(arg_4, arg_3.get_value(arg_4))\n        return arg_2.dict_value()", "path": "pymongo_formatter/formatter.py", "identifier": "Doc_Formatter.select_fields", "docstring": "Take 'doc' and create a new doc using only keys from the 'fields' list.\n        Supports referencing fields using dotted notation \"a.b.c\" so we can parse\n        nested fields the way MongoDB does. The nested field class is a hack. It should\n        be a sub-class of dict.", "docstring_tokens": ["Take", "doc", "and", "create", "a", "new", "doc", "using", "only", "keys", "from", "the", "fields", "list", ".", "Supports", "referencing", "fields", "using", "dotted", "notation", "a", ".", "b", ".", "c", "so", "we", "can", "parse", "nested", "fields", "the", "way", "MongoDB", "does", ".", "The", "nested", "field", "class", "is", "a", "hack", ".", "It", "should", "be", "a", "sub", "-", "class", "of", "dict", "."], "nwo": "jdrumgoole/pymongo_formatter", "score": 0.09252797783733271, "idx": 253693}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/sonify.py#L187-L239", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Sonify a jams annotation through mir_eval", "language": "python", "parameters": "(annotation, sr=22050, duration=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "22050", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "None", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "duration", "if", "arg_2", "is", "not", "None", ":", "arg_4", "=", "int", "(", "arg_2", "*", "arg_1", ")", "if", "arg_0", ".", "namespace", "in", "SONIFY_MAPPING", ":", "arg_5", "=", "coerce_annotation", "(", "arg_0", ",", "arg_0", ".", "namespace", ")", "return", "SONIFY_MAPPING", "[", "arg_0", ".", "namespace", "]", "(", "arg_5", ",", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ",", "**", "arg_3", ")", "for", "arg_6", ",", "arg_7", "in", "six", ".", "iteritems", "(", "SONIFY_MAPPING", ")", ":", "try", ":", "arg_5", "=", "coerce_annotation", "(", "arg_0", ",", "arg_6", ")", "return", "arg_7", "(", "arg_5", ",", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ",", "**", "arg_3", ")", "except", "NamespaceError", ":", "pass", "raise", "NamespaceError", "(", "'Unable to Func annotation of namespace=\"{:s}\"'", ".", "format", "(", "arg_0", ".", "namespace", ")", ")"], "function": "def Func(arg_0, arg_1=22050, arg_2=None, **arg_3):\n    '''Sonify a jams annotation through mir_eval\n\n    Parameters\n    ----------\n    annotation : jams.Annotation\n        The annotation to Func\n\n    sr = : positive number\n        The sampling rate of the output waveform\n\n    duration : float (optional)\n        Optional length (in seconds) of the output waveform\n\n    kwargs\n        Additional keyword arguments to mir_eval.Func functions\n\n    Returns\n    -------\n    y_sonified : np.ndarray\n        The waveform of the sonified annotation\n\n    Raises\n    ------\n    NamespaceError\n        If the annotation has an un-sonifiable namespace\n    '''\n\n    arg_4 = None\n\n    if arg_2 is None:\n        arg_2 = arg_0.duration\n\n    if arg_2 is not None:\n        arg_4 = int(arg_2 * arg_1)\n\n    # If the annotation can be directly sonified, try that first\n    if arg_0.namespace in SONIFY_MAPPING:\n        arg_5 = coerce_annotation(arg_0, arg_0.namespace)\n        return SONIFY_MAPPING[arg_0.namespace](arg_5,\n                                                    arg_1=arg_1,\n                                                    arg_4=arg_4,\n                                                    **arg_3)\n\n    for arg_6, arg_7 in six.iteritems(SONIFY_MAPPING):\n        try:\n            arg_5 = coerce_annotation(arg_0, arg_6)\n            return arg_7(arg_5, arg_1=arg_1, arg_4=arg_4, **arg_3)\n        except NamespaceError:\n            pass\n\n    raise NamespaceError('Unable to Func annotation of namespace=\"{:s}\"'\n                         .format(arg_0.namespace))", "path": "jams/sonify.py", "identifier": "sonify", "docstring": "Sonify a jams annotation through mir_eval\n\n    Parameters\n    ----------\n    annotation : jams.Annotation\n        The annotation to sonify\n\n    sr = : positive number\n        The sampling rate of the output waveform\n\n    duration : float (optional)\n        Optional length (in seconds) of the output waveform\n\n    kwargs\n        Additional keyword arguments to mir_eval.sonify functions\n\n    Returns\n    -------\n    y_sonified : np.ndarray\n        The waveform of the sonified annotation\n\n    Raises\n    ------\n    NamespaceError\n        If the annotation has an un-sonifiable namespace", "docstring_tokens": ["Sonify", "a", "jams", "annotation", "through", "mir_eval"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253694}
{"url": "https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L295-L308", "sha": "247d6b9524fcee4b2da0e65ca12c52ebdd3676b2", "docstring_summary": "End of a configuration session.\n        Tells the router we're done managing admin functionality.", "language": "python", "parameters": "(self)", "return_statement": "return success", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_LOGGER", ".", "info", "(", "\"Config finish\"", ")", "if", "not", "arg_0", ".", "config_started", ":", "return", "True", "arg_1", ",", "arg_2", "=", "arg_0", ".", "_make_request", "(", "SERVICE_DEVICE_CONFIG", ",", "\"ConfigurationFinished\"", ",", "{", "\"NewStatus\"", ":", "\"ChangesApplied\"", "}", ")", "arg_0", ".", "config_started", "=", "not", "arg_1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        End of a configuration session.\n        Tells the router we're done managing admin functionality.\n        \"\"\"\n        _LOGGER.info(\"Config finish\")\n        if not arg_0.config_started:\n            return True\n\n        arg_1, arg_2 = arg_0._make_request(\n            SERVICE_DEVICE_CONFIG, \"ConfigurationFinished\", {\"NewStatus\": \"ChangesApplied\"})\n\n        arg_0.config_started = not arg_1\n        return arg_1", "path": "pynetgear/__init__.py", "identifier": "Netgear.config_finish", "docstring": "End of a configuration session.\n        Tells the router we're done managing admin functionality.", "docstring_tokens": ["End", "of", "a", "configuration", "session", ".", "Tells", "the", "router", "we", "re", "done", "managing", "admin", "functionality", "."], "nwo": "MatMaul/pynetgear", "score": 0.725114434043304, "idx": 253695}
{"url": "https://github.com/alpacahq/alpaca-trade-api-python/blob/9c9dea3b4a37c909f88391b202e86ff356a8b4d7/alpaca_trade_api/rest.py#L229-L232", "sha": "9c9dea3b4a37c909f88391b202e86ff356a8b4d7", "docstring_summary": "Get an asset", "language": "python", "parameters": "(self, symbol)", "return_statement": "return Asset(resp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get", "(", "'/assets/{}'", ".", "format", "(", "arg_1", ")", ")", "return", "Asset", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        '''Get an asset'''\n        arg_2 = arg_0.get('/assets/{}'.format(arg_1))\n        return Asset(arg_2)", "path": "alpaca_trade_api/rest.py", "identifier": "REST.get_asset", "docstring": "Get an asset", "docstring_tokens": ["Get", "an", "asset"], "nwo": "alpacahq/alpaca-trade-api-python", "score": 0.9697751514981866, "idx": 253696}
{"url": "https://github.com/zwischenloesung/ardu-report-lib/blob/51bd4a07e036065aafcb1273b151bea3fdfa50fa/libardurep/datastore.py#L190-L205", "sha": "51bd4a07e036065aafcb1273b151bea3fdfa50fa", "docstring_summary": "Get the data in JSON form", "language": "python", "parameters": "(self, prettyprint=False, translate=True)", "return_statement": "return j", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "[", "]", "if", "arg_2", ":", "arg_4", "=", "arg_0", ".", "get_translated_data", "(", ")", "else", ":", "arg_4", "=", "arg_0", ".", "data", "for", "arg_5", "in", "arg_4", ":", "arg_3", ".", "append", "(", "arg_4", "[", "arg_5", "]", ")", "if", "arg_1", ":", "arg_3", "=", "json", ".", "dumps", "(", "arg_3", ",", "indent", "=", "2", ",", "separators", "=", "(", "','", ",", "': '", ")", ")", "else", ":", "arg_3", "=", "json", ".", "dumps", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n        \"\"\"\n        Get the data in JSON form\n        \"\"\"\n        arg_3 = []\n        if arg_2:\n            arg_4 = arg_0.get_translated_data()\n        else:\n            arg_4 = arg_0.data\n        for arg_5 in arg_4:\n            arg_3.append(arg_4[arg_5])\n        if arg_1:\n            arg_3 = json.dumps(arg_3, indent=2, separators=(',',': '))\n        else:\n            arg_3 = json.dumps(arg_3)\n        return arg_3", "path": "libardurep/datastore.py", "identifier": "DataStore.get_json", "docstring": "Get the data in JSON form", "docstring_tokens": ["Get", "the", "data", "in", "JSON", "form"], "nwo": "zwischenloesung/ardu-report-lib", "score": 0.0, "idx": 253697}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/mixins.py#L119-L126", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Provides permissions for mongoadmin for use in the context", "language": "python", "parameters": "(self, context={})", "return_statement": "return context", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ")", ":", "arg_1", "[", "'has_view_permission'", "]", "=", "arg_0", ".", "mongoadmin", ".", "has_view_permission", "(", "arg_0", ".", "request", ")", "arg_1", "[", "'has_edit_permission'", "]", "=", "arg_0", ".", "mongoadmin", ".", "has_edit_permission", "(", "arg_0", ".", "request", ")", "arg_1", "[", "'has_add_permission'", "]", "=", "arg_0", ".", "mongoadmin", ".", "has_add_permission", "(", "arg_0", ".", "request", ")", "arg_1", "[", "'has_delete_permission'", "]", "=", "arg_0", ".", "mongoadmin", ".", "has_delete_permission", "(", "arg_0", ".", "request", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1={}):\n        \"\"\" Provides permissions for mongoadmin for use in the context\"\"\"\n\n        arg_1['has_view_permission'] = arg_0.mongoadmin.has_view_permission(arg_0.request)\n        arg_1['has_edit_permission'] = arg_0.mongoadmin.has_edit_permission(arg_0.request)\n        arg_1['has_add_permission'] = arg_0.mongoadmin.has_add_permission(arg_0.request)\n        arg_1['has_delete_permission'] = arg_0.mongoadmin.has_delete_permission(arg_0.request)\n        return arg_1", "path": "mongonaut/mixins.py", "identifier": "MongonautViewMixin.set_permissions_in_context", "docstring": "Provides permissions for mongoadmin for use in the context", "docstring_tokens": ["Provides", "permissions", "for", "mongoadmin", "for", "use", "in", "the", "context"], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 253698}
{"url": "https://github.com/ausaki/python-validator/blob/a3e591b1eae6d7a70f894c203dbd7195f929baa8/validator/fields.py#L29-L39", "sha": "a3e591b1eae6d7a70f894c203dbd7195f929baa8", "docstring_summary": "Create a field by field info dict.", "language": "python", "parameters": "(field_info)", "return_statement": "return field_class.from_dict(params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get", "(", "'type'", ")", "if", "arg_1", "not", "in", "FIELDS_NAME_MAP", ":", "raise", "ValueError", "(", "_", "(", "'not support this field: {}'", ")", ".", "format", "(", "arg_1", ")", ")", "arg_2", "=", "FIELDS_NAME_MAP", ".", "get", "(", "arg_1", ")", "arg_3", "=", "dict", "(", "arg_0", ")", "arg_3", ".", "pop", "(", "'type'", ")", "return", "arg_2", ".", "from_dict", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Create a field by field info dict.\n    \"\"\"\n    arg_1 = arg_0.get('type')\n    if arg_1 not in FIELDS_NAME_MAP:\n        raise ValueError(_('not support this field: {}').format(arg_1))\n    arg_2 = FIELDS_NAME_MAP.get(arg_1)\n    arg_3 = dict(arg_0)\n    arg_3.pop('type')\n    return arg_2.from_dict(arg_3)", "path": "validator/fields.py", "identifier": "create_field", "docstring": "Create a field by field info dict.", "docstring_tokens": ["Create", "a", "field", "by", "field", "info", "dict", "."], "nwo": "ausaki/python-validator", "score": 0.38108885787659336, "idx": 253699}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfobjects/pdfcursor.py#L120-L126", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Comparison for y coordinate", "language": "python", "parameters": "(self, test_ordinate)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_is_coordinate", "(", "arg_1", ")", "if", "arg_0", ".", "y", ">", "arg_1", ".", "y", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Comparison for y coordinate\"\"\"\r\n        arg_0._is_coordinate(arg_1)\r\n        if arg_0.y > arg_1.y:\r\n            return True\r\n        else:\r\n            return False", "path": "pypdflite/pdfobjects/pdfcursor.py", "identifier": "PDFCursor.y_is_greater_than", "docstring": "Comparison for y coordinate", "docstring_tokens": ["Comparison", "for", "y", "coordinate"], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 253700}
{"url": "https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/kwallet.py#L116-L124", "sha": "71c798378e365286b7cc03c06e4d7d24c7de8fc4", "docstring_summary": "Delete the password for the username of the service.", "language": "python", "parameters": "(self, service, username)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "connected", "(", "arg_1", ")", ":", "raise", "PasswordDeleteError", "(", "\"Cancelled by user\"", ")", "if", "not", "arg_0", ".", "iface", ".", "hasEntry", "(", "arg_0", ".", "handle", ",", "arg_1", ",", "arg_2", ",", "arg_0", ".", "appid", ")", ":", "raise", "PasswordDeleteError", "(", "\"Password not found\"", ")", "arg_0", ".", "iface", ".", "removeEntry", "(", "arg_0", ".", "handle", ",", "arg_1", ",", "arg_2", ",", "arg_0", ".", "appid", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Delete the password for the username of the service.\n        \"\"\"\n        if not arg_0.connected(arg_1):\n            # the user pressed \"cancel\" when prompted to unlock their keyring.\n            raise PasswordDeleteError(\"Cancelled by user\")\n        if not arg_0.iface.hasEntry(arg_0.handle, arg_1, arg_2, arg_0.appid):\n            raise PasswordDeleteError(\"Password not found\")\n        arg_0.iface.removeEntry(arg_0.handle, arg_1, arg_2, arg_0.appid)", "path": "keyring/backends/kwallet.py", "identifier": "DBusKeyring.delete_password", "docstring": "Delete the password for the username of the service.", "docstring_tokens": ["Delete", "the", "password", "for", "the", "username", "of", "the", "service", "."], "nwo": "jaraco/keyring", "score": 0.7254776697026839, "idx": 253701}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_handler_mix_in.py#L403-L459", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Helper method for print_full_documentation.", "language": "python", "parameters": "(checker_name, info, stream=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "sys", ".", "stdout", "arg_3", "=", "arg_1", ".", "get", "(", "\"doc\"", ")", "arg_4", "=", "arg_1", ".", "get", "(", "\"module\"", ")", "arg_5", "=", "arg_1", ".", "get", "(", "\"msgs\"", ")", "arg_6", "=", "arg_1", ".", "get", "(", "\"options\"", ")", "arg_7", "=", "arg_1", ".", "get", "(", "\"reports\"", ")", "arg_8", "=", "\"%s checker\"", "%", "(", "arg_0", ".", "replace", "(", "\"_\"", ",", "\" \"", ")", ".", "title", "(", ")", ")", "if", "arg_4", ":", "print", "(", "\".. _%s:\\n\"", "%", "arg_4", ",", "file", "=", "arg_2", ")", "print", "(", "arg_8", ",", "file", "=", "arg_2", ")", "print", "(", "\"~\"", "*", "len", "(", "arg_8", ")", ",", "file", "=", "arg_2", ")", "print", "(", "\"\"", ",", "file", "=", "arg_2", ")", "if", "arg_4", ":", "print", "(", "\"This checker is provided by ``%s``.\"", "%", "arg_4", ",", "file", "=", "arg_2", ")", "print", "(", "\"Verbatim name of the checker is ``%s``.\"", "%", "arg_0", ",", "file", "=", "arg_2", ")", "print", "(", "\"\"", ",", "file", "=", "arg_2", ")", "if", "arg_3", ":", "arg_9", "=", "\"{} Documentation\"", ".", "format", "(", "arg_8", ")", "print", "(", "arg_9", ",", "file", "=", "arg_2", ")", "print", "(", "\"^\"", "*", "len", "(", "arg_9", ")", ",", "file", "=", "arg_2", ")", "print", "(", "cleandoc", "(", "arg_3", ")", ",", "file", "=", "arg_2", ")", "print", "(", "\"\"", ",", "file", "=", "arg_2", ")", "if", "arg_6", ":", "arg_9", "=", "\"{} Options\"", ".", "format", "(", "arg_8", ")", "print", "(", "arg_9", ",", "file", "=", "arg_2", ")", "print", "(", "\"^\"", "*", "len", "(", "arg_9", ")", ",", "file", "=", "arg_2", ")", "_rest_format_section", "(", "arg_2", ",", "None", ",", "arg_6", ")", "print", "(", "\"\"", ",", "file", "=", "arg_2", ")", "if", "arg_5", ":", "arg_9", "=", "\"{} Messages\"", ".", "format", "(", "arg_8", ")", "print", "(", "arg_9", ",", "file", "=", "arg_2", ")", "print", "(", "\"^\"", "*", "len", "(", "arg_9", ")", ",", "file", "=", "arg_2", ")", "for", "arg_10", ",", "arg_11", "in", "sorted", "(", "arg_5", ".", "items", "(", ")", ",", "key", "=", "lambda", "kv", ":", "(", "_MSG_ORDER", ".", "index", "(", "kv", "[", "0", "]", "[", "0", "]", ")", ",", "kv", "[", "1", "]", ")", ")", ":", "arg_11", "=", "build_message_definition", "(", "arg_0", ",", "arg_10", ",", "arg_11", ")", "print", "(", "arg_11", ".", "format_help", "(", "checkerref", "=", "False", ")", ",", "file", "=", "arg_2", ")", "print", "(", "\"\"", ",", "file", "=", "arg_2", ")", "if", "arg_7", ":", "arg_9", "=", "\"{} Reports\"", ".", "format", "(", "arg_8", ")", "print", "(", "arg_9", ",", "file", "=", "arg_2", ")", "print", "(", "\"^\"", "*", "len", "(", "arg_9", ")", ",", "file", "=", "arg_2", ")", "for", "arg_12", "in", "arg_7", ":", "print", "(", "\":%s: %s\"", "%", "arg_12", "[", ":", "2", "]", ",", "file", "=", "arg_2", ")", "print", "(", "\"\"", ",", "file", "=", "arg_2", ")", "print", "(", "\"\"", ",", "file", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Helper method for print_full_documentation.\n\n        Also used by doc/exts/pylint_extensions.py.\n        \"\"\"\n        if not arg_2:\n            arg_2 = sys.stdout\n\n        arg_3 = arg_1.get(\"doc\")\n        arg_4 = arg_1.get(\"module\")\n        arg_5 = arg_1.get(\"msgs\")\n        arg_6 = arg_1.get(\"options\")\n        arg_7 = arg_1.get(\"reports\")\n\n        arg_8 = \"%s checker\" % (arg_0.replace(\"_\", \" \").title())\n\n        if arg_4:\n            # Provide anchor to link against\n            print(\".. _%s:\\n\" % arg_4, file=arg_2)\n        print(arg_8, file=arg_2)\n        print(\"~\" * len(arg_8), file=arg_2)\n        print(\"\", file=arg_2)\n        if arg_4:\n            print(\"This checker is provided by ``%s``.\" % arg_4, file=arg_2)\n        print(\"Verbatim name of the checker is ``%s``.\" % arg_0, file=arg_2)\n        print(\"\", file=arg_2)\n        if arg_3:\n            # Provide anchor to link against\n            arg_9 = \"{} Documentation\".format(arg_8)\n            print(arg_9, file=arg_2)\n            print(\"^\" * len(arg_9), file=arg_2)\n            print(cleandoc(arg_3), file=arg_2)\n            print(\"\", file=arg_2)\n        if arg_6:\n            arg_9 = \"{} Options\".format(arg_8)\n            print(arg_9, file=arg_2)\n            print(\"^\" * len(arg_9), file=arg_2)\n            _rest_format_section(arg_2, None, arg_6)\n            print(\"\", file=arg_2)\n        if arg_5:\n            arg_9 = \"{} Messages\".format(arg_8)\n            print(arg_9, file=arg_2)\n            print(\"^\" * len(arg_9), file=arg_2)\n            for arg_10, arg_11 in sorted(\n                arg_5.items(), key=lambda kv: (_MSG_ORDER.index(kv[0][0]), kv[1])\n            ):\n                arg_11 = build_message_definition(arg_0, arg_10, arg_11)\n                print(arg_11.format_help(checkerref=False), file=arg_2)\n            print(\"\", file=arg_2)\n        if arg_7:\n            arg_9 = \"{} Reports\".format(arg_8)\n            print(arg_9, file=arg_2)\n            print(\"^\" * len(arg_9), file=arg_2)\n            for arg_12 in arg_7:\n                print(\":%s: %s\" % arg_12[:2], file=arg_2)\n            print(\"\", file=arg_2)\n        print(\"\", file=arg_2)", "path": "pylint/message/message_handler_mix_in.py", "identifier": "MessagesHandlerMixIn._print_checker_doc", "docstring": "Helper method for print_full_documentation.\n\n        Also used by doc/exts/pylint_extensions.py.", "docstring_tokens": ["Helper", "method", "for", "print_full_documentation", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253702}
{"url": "https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/pushpull.py#L202-L229", "sha": "aca085ea54541b087140b58a81332f8728baeeb2", "docstring_summary": "Convert schemas to be compatible with storage schemas.", "language": "python", "parameters": "(mapping, schemas)", "return_statement": "return schemas", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "deepcopy", "(", "arg_1", ")", "for", "arg_2", "in", "arg_1", ":", "for", "arg_3", "in", "arg_2", ".", "get", "(", "'foreignKeys'", ",", "[", "]", ")", ":", "arg_4", "=", "arg_3", "[", "'reference'", "]", "[", "'resource'", "]", "if", "arg_4", "!=", "'self'", ":", "if", "arg_4", "not", "in", "arg_0", ":", "arg_5", "=", "'Not resource \"%s\" for foreign key \"%s\"'", "arg_5", "=", "arg_5", "%", "(", "arg_4", ",", "arg_3", ")", "raise", "ValueError", "(", "arg_5", ")", "arg_3", "[", "'reference'", "]", "[", "'resource'", "]", "=", "arg_0", "[", "arg_4", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Convert schemas to be compatible with storage schemas.\n\n    Foreign keys related operations.\n\n    Args:\n        mapping (dict): mapping between resource name and table name\n        schemas (list): schemas\n\n    Raises:\n        ValueError: if there is no resource\n            for some foreign key in given mapping\n\n    Returns:\n        list: converted schemas\n\n    \"\"\"\n    arg_1 = deepcopy(arg_1)\n    for arg_2 in arg_1:\n        for arg_3 in arg_2.get('foreignKeys', []):\n            arg_4 = arg_3['reference']['resource']\n            if arg_4 != 'self':\n                if arg_4 not in arg_0:\n                    arg_5 = 'Not resource \"%s\" for foreign key \"%s\"'\n                    arg_5 = arg_5 % (arg_4, arg_3)\n                    raise ValueError(arg_5)\n                arg_3['reference']['resource'] = arg_0[arg_4]\n    return arg_1", "path": "datapackage/pushpull.py", "identifier": "_convert_schemas", "docstring": "Convert schemas to be compatible with storage schemas.\n\n    Foreign keys related operations.\n\n    Args:\n        mapping (dict): mapping between resource name and table name\n        schemas (list): schemas\n\n    Raises:\n        ValueError: if there is no resource\n            for some foreign key in given mapping\n\n    Returns:\n        list: converted schemas", "docstring_tokens": ["Convert", "schemas", "to", "be", "compatible", "with", "storage", "schemas", "."], "nwo": "frictionlessdata/datapackage-py", "score": 0.5653088377587532, "idx": 253703}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L727-L780", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "enters funcs for pairs", "language": "python", "parameters": "(iloc, pnames, snppad, edg, aseqs, asnps, smask, samplecov, locuscov, start)", "return_statement": "return outstr, samplecov, locuscov", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", ":", "LOGGER", ".", "info", "(", "\"edges in Func %s\"", ",", "arg_3", ")", "arg_10", "=", "arg_4", "[", "arg_0", ",", ":", ",", "arg_3", "[", "0", "]", ":", "arg_3", "[", "1", "]", "+", "1", "]", "arg_11", "=", "arg_5", "[", "arg_0", ",", "arg_3", "[", "0", "]", ":", "arg_3", "[", "1", "]", "+", "1", ",", "]", "arg_12", "=", "arg_4", "[", "arg_0", ",", ":", ",", "arg_3", "[", "2", "]", ":", "arg_3", "[", "3", "]", "+", "1", "]", "arg_13", "=", "arg_5", "[", "arg_0", ",", "arg_3", "[", "2", "]", ":", "arg_3", "[", "3", "]", "+", "1", ",", "]", "arg_14", "=", "np", ".", "all", "(", "arg_10", "==", "\"N\"", ",", "axis", "=", "1", ")", "arg_15", "=", "arg_14", "+", "arg_6", "LOGGER", ".", "info", "(", "\"nsidx %s, nalln %s, smask %s\"", ",", "arg_15", ",", "arg_14", ",", "arg_6", ")", "arg_7", "=", "arg_7", "+", "np", ".", "invert", "(", "arg_15", ")", ".", "astype", "(", "np", ".", "int32", ")", "LOGGER", ".", "info", "(", "\"samplecov %s\"", ",", "arg_7", ")", "arg_16", "=", "np", ".", "sum", "(", "np", ".", "invert", "(", "arg_15", ")", ".", "astype", "(", "np", ".", "int32", ")", ")", "LOGGER", ".", "info", "(", "\"idx %s\"", ",", "arg_16", ")", "arg_8", "[", "arg_16", "]", "+=", "1", "arg_10", "=", "arg_10", "[", "~", "arg_15", ",", "]", "arg_12", "=", "arg_12", "[", "~", "arg_15", ",", "]", "arg_17", "=", "arg_1", "[", "~", "arg_15", "]", "arg_18", "=", "\"\\n\"", ".", "join", "(", "[", "name", "+", "s1", ".", "tostring", "(", ")", "+", "\"nnnn\"", "+", "s2", ".", "tostring", "(", ")", "for", "name", ",", "s1", ",", "s2", "in", "zip", "(", "arg_17", ",", "arg_10", ",", "arg_12", ")", "]", ")", "arg_19", "=", "[", "\"-\"", "if", "arg_11", "[", "i", ",", "0", "]", "else", "\"*\"", "if", "arg_11", "[", "i", ",", "1", "]", "else", "\" \"", "for", "i", "in", "range", "(", "len", "(", "arg_11", ")", ")", "]", "arg_20", "=", "[", "\"-\"", "if", "arg_13", "[", "i", ",", "0", "]", "else", "\"*\"", "if", "arg_13", "[", "i", ",", "1", "]", "else", "\" \"", "for", "i", "in", "range", "(", "len", "(", "arg_13", ")", ")", "]", "arg_18", "+=", "\"\\n\"", "+", "arg_2", "+", "\"\"", ".", "join", "(", "arg_19", ")", "+", "\"    \"", "+", "\"\"", ".", "join", "(", "arg_20", ")", "+", "\"|{}|\"", ".", "format", "(", "arg_0", "+", "arg_9", ")", "return", "arg_18", ",", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9):\n    \"\"\" enters funcs for pairs \"\"\"\n\n    ## snps was created using only the selected samples.\n    LOGGER.info(\"edges in Func %s\", arg_3)\n    arg_10 = arg_4[arg_0, :, arg_3[0]:arg_3[1]+1]\n    arg_11 = arg_5[arg_0, arg_3[0]:arg_3[1]+1, ]\n\n    ## the 2nd read edges are +5 for the spacer\n    arg_12 = arg_4[arg_0, :, arg_3[2]:arg_3[3]+1]\n    arg_13 = arg_5[arg_0, arg_3[2]:arg_3[3]+1, ]\n\n    ## remove rows with all Ns, seq has only selected samples\n    arg_14 = np.all(arg_10 == \"N\", axis=1)\n\n    ## make mask of removed rows and excluded samples. Use the inverse\n    ## of this to save the coverage for samples\n    arg_15 = arg_14 + arg_6\n    LOGGER.info(\"nsidx %s, nalln %s, smask %s\", arg_15, arg_14, arg_6)\n    arg_7 = arg_7 + np.invert(arg_15).astype(np.int32)\n    LOGGER.info(\"samplecov %s\", arg_7)\n    arg_16 = np.sum(np.invert(arg_15).astype(np.int32))\n    LOGGER.info(\"idx %s\", arg_16)\n    arg_8[arg_16] += 1\n\n    ## select the remaining names in order\n    arg_10 = arg_10[~arg_15, ]\n    arg_12 = arg_12[~arg_15, ]\n    arg_17 = arg_1[~arg_15]\n\n    ## save string for printing, excluding names not in samples\n    arg_18 = \"\\n\".join(\\\n        [name + s1.tostring()+\"nnnn\"+s2.tostring() for name, s1, s2 in \\\n         zip(arg_17, arg_10, arg_12)])\n\n    #LOGGER.info(\"s1 %s\", s1.tostring())\n    #LOGGER.info(\"s2 %s\", s2.tostring())\n\n    ## get snp string and add to store\n    arg_19 = [\"-\" if arg_11[i, 0] else \\\n                 \"*\" if arg_11[i, 1] else \\\n                 \" \" for i in range(len(arg_11))]\n    arg_20 = [\"-\" if arg_13[i, 0] else \\\n                 \"*\" if arg_13[i, 1] else \\\n                 \" \" for i in range(len(arg_13))]\n\n    #npis = str(snpstring1+snpstring2).count(\"*\")\n    #nvars = str(snpstring1+snpstring2).count(\"-\") + npis\n    arg_18 += \"\\n\" + arg_2 + \"\".join(arg_19)+\\\n              \"    \"+\"\".join(arg_20)+\"|{}|\".format(arg_0+arg_9)\n              #\"|LOCID={},DBID={},NVAR={},NPIS={}|\"\\\n              #.format(1+iloc+start, iloc, nvars, npis)\n\n    return arg_18, arg_7, arg_8", "path": "ipyrad/assemble/write_outfiles.py", "identifier": "enter_pairs", "docstring": "enters funcs for pairs", "docstring_tokens": ["enters", "funcs", "for", "pairs"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 253704}
{"url": "https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L63-L93", "sha": "6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851", "docstring_summary": "Create a new config file at the default location.", "language": "python", "parameters": "(cls, cfgfile, nick, twtfile, twturl, disclose_identity, add_news)", "return_statement": "return conf", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_7", ")", ":", "os", ".", "makedirs", "(", "arg_7", ")", "arg_8", "=", "configparser", ".", "ConfigParser", "(", ")", "arg_8", ".", "add_section", "(", "\"twtxt\"", ")", "arg_8", ".", "set", "(", "\"twtxt\"", ",", "\"nick\"", ",", "arg_2", ")", "arg_8", ".", "set", "(", "\"twtxt\"", ",", "\"twtfile\"", ",", "arg_3", ")", "arg_8", ".", "set", "(", "\"twtxt\"", ",", "\"twturl\"", ",", "arg_4", ")", "arg_8", ".", "set", "(", "\"twtxt\"", ",", "\"disclose_identity\"", ",", "str", "(", "arg_5", ")", ")", "arg_8", ".", "set", "(", "\"twtxt\"", ",", "\"character_limit\"", ",", "\"140\"", ")", "arg_8", ".", "set", "(", "\"twtxt\"", ",", "\"character_warning\"", ",", "\"140\"", ")", "arg_8", ".", "add_section", "(", "\"following\"", ")", "if", "arg_6", ":", "arg_8", ".", "set", "(", "\"following\"", ",", "\"twtxt\"", ",", "\"https://buckket.org/twtxt_news.txt\"", ")", "arg_9", "=", "arg_0", "(", "arg_1", ",", "arg_8", ")", "arg_9", ".", "write_config", "(", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        \"\"\"Create a new config file at the default location.\n\n        :param str cfgfile: path to the config file\n        :param str nick: nickname to use for own tweets\n        :param str twtfile: path to the local twtxt file\n        :param str twturl: URL to the remote twtxt file\n        :param bool disclose_identity: if true the users id will be disclosed\n        :param bool add_news: if true follow twtxt news feed\n        \"\"\"\n        arg_7 = os.path.dirname(arg_1)\n        if not os.path.exists(arg_7):\n            os.makedirs(arg_7)\n\n        arg_8 = configparser.ConfigParser()\n\n        arg_8.add_section(\"twtxt\")\n        arg_8.set(\"twtxt\", \"nick\", arg_2)\n        arg_8.set(\"twtxt\", \"twtfile\", arg_3)\n        arg_8.set(\"twtxt\", \"twturl\", arg_4)\n        arg_8.set(\"twtxt\", \"disclose_identity\", str(arg_5))\n        arg_8.set(\"twtxt\", \"character_limit\", \"140\")\n        arg_8.set(\"twtxt\", \"character_warning\", \"140\")\n\n        arg_8.add_section(\"following\")\n        if arg_6:\n            arg_8.set(\"following\", \"twtxt\", \"https://buckket.org/twtxt_news.txt\")\n\n        arg_9 = arg_0(arg_1, arg_8)\n        arg_9.write_config()\n        return arg_9", "path": "twtxt/config.py", "identifier": "Config.create_config", "docstring": "Create a new config file at the default location.\n\n        :param str cfgfile: path to the config file\n        :param str nick: nickname to use for own tweets\n        :param str twtfile: path to the local twtxt file\n        :param str twturl: URL to the remote twtxt file\n        :param bool disclose_identity: if true the users id will be disclosed\n        :param bool add_news: if true follow twtxt news feed", "docstring_tokens": ["Create", "a", "new", "config", "file", "at", "the", "default", "location", "."], "nwo": "buckket/twtxt", "score": 0.5783854231140674, "idx": 253705}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L101-L131", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Helper to read the contents of the given file or path into a string with the given encoding.\n    Encoding defaults to 'utf-8', other useful encodings are 'ascii' and 'latin-1'.", "language": "python", "parameters": "(f, encoding='utf-8')", "return_statement": "return contents", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf-8'", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "read", "(", ")", "except", "AttributeError", ":", "try", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "fp", ":", "arg_2", "=", "fp", ".", "read", "(", ")", "except", "TypeError", ":", "raise", "ValueError", "(", "'val must be file or path, but was type <%s>'", "%", "type", "(", "arg_0", ")", ".", "__name__", ")", "except", "OSError", ":", "if", "not", "isinstance", "(", "arg_0", ",", "str_types", ")", ":", "raise", "ValueError", "(", "'val must be file or path, but was type <%s>'", "%", "type", "(", "arg_0", ")", ".", "__name__", ")", "raise", "if", "sys", ".", "version_info", "[", "0", "]", "==", "3", "and", "type", "(", "arg_2", ")", "is", "bytes", ":", "return", "arg_2", ".", "decode", "(", "arg_1", ",", "'replace'", ")", "elif", "sys", ".", "version_info", "[", "0", "]", "==", "2", "and", "arg_1", "==", "'ascii'", ":", "return", "arg_2", ".", "encode", "(", "'ascii'", ",", "'replace'", ")", "else", ":", "try", ":", "return", "arg_2", ".", "decode", "(", "arg_1", ",", "'replace'", ")", "except", "AttributeError", ":", "pass", "return", "arg_2"], "function": "def Func(arg_0, arg_1='utf-8'):\n    \"\"\"Helper to read the contents of the given file or path into a string with the given encoding.\n    Encoding defaults to 'utf-8', other useful encodings are 'ascii' and 'latin-1'.\"\"\"\n\n    try:\n        arg_2 = arg_0.read()\n    except AttributeError:\n        try:\n            with open(arg_0, 'r') as fp:\n                arg_2 = fp.read()\n        except TypeError:\n            raise ValueError('val must be file or path, but was type <%s>' % type(arg_0).__name__)\n        except OSError:\n            if not isinstance(arg_0, str_types):\n                raise ValueError('val must be file or path, but was type <%s>' % type(arg_0).__name__)\n            raise\n\n    if sys.version_info[0] == 3 and type(arg_2) is bytes:\n        # in PY3 force decoding of bytes to target encoding\n        return arg_2.decode(arg_1, 'replace')\n    elif sys.version_info[0] == 2 and arg_1 == 'ascii':\n        # in PY2 force encoding back to ascii\n        return arg_2.encode('ascii', 'replace')\n    else:\n        # in all other cases, try to decode to target encoding\n        try:\n            return arg_2.decode(arg_1, 'replace')\n        except AttributeError:\n            pass\n    # if all else fails, just return the contents \"as is\"\n    return arg_2", "path": "assertpy/assertpy.py", "identifier": "contents_of", "docstring": "Helper to read the contents of the given file or path into a string with the given encoding.\n    Encoding defaults to 'utf-8', other useful encodings are 'ascii' and 'latin-1'.", "docstring_tokens": ["Helper", "to", "read", "the", "contents", "of", "the", "given", "file", "or", "path", "into", "a", "string", "with", "the", "given", "encoding", ".", "Encoding", "defaults", "to", "utf", "-", "8", "other", "useful", "encodings", "are", "ascii", "and", "latin", "-", "1", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 253706}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L48-L74", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Convert a datetime object into a valid STIX timestamp string.", "language": "python", "parameters": "(dttm)", "return_statement": "return ts + \"Z\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "tzinfo", "is", "None", "or", "arg_0", ".", "tzinfo", ".", "utcoffset", "(", "arg_0", ")", "is", "None", ":", "arg_1", "=", "pytz", ".", "utc", ".", "localize", "(", "arg_0", ")", "else", ":", "arg_1", "=", "arg_0", ".", "astimezone", "(", "pytz", ".", "utc", ")", "arg_2", "=", "arg_1", ".", "strftime", "(", "\"%Y-%m-%dT%H:%M:%S\"", ")", "arg_3", "=", "arg_1", ".", "strftime", "(", "\"%f\"", ")", "arg_4", "=", "getattr", "(", "arg_0", ",", "\"precision\"", ",", "None", ")", "if", "arg_4", "==", "\"second\"", ":", "pass", "elif", "arg_4", "==", "\"millisecond\"", ":", "arg_2", "=", "arg_2", "+", "\".\"", "+", "arg_3", "[", ":", "3", "]", "elif", "arg_1", ".", "microsecond", ">", "0", ":", "arg_2", "=", "arg_2", "+", "\".\"", "+", "arg_3", ".", "rstrip", "(", "\"0\"", ")", "return", "arg_2", "+", "\"Z\""], "function": "def Func(arg_0):\n    \"\"\"Convert a datetime object into a valid STIX timestamp string.\n\n    1. Convert to timezone-aware\n    2. Convert to UTC\n    3. Format in ISO format\n    4. Ensure correct precision\n       a. Add subsecond value if non-zero and precision not defined\n    5. Add \"Z\"\n\n    \"\"\"\n\n    if arg_0.tzinfo is None or arg_0.tzinfo.utcoffset(arg_0) is None:\n        # dttm is timezone-naive; assume UTC\n        arg_1 = pytz.utc.localize(arg_0)\n    else:\n        arg_1 = arg_0.astimezone(pytz.utc)\n    arg_2 = arg_1.strftime(\"%Y-%m-%dT%H:%M:%S\")\n    arg_3 = arg_1.strftime(\"%f\")\n    arg_4 = getattr(arg_0, \"precision\", None)\n    if arg_4 == \"second\":\n        pass  # Already precise to the second\n    elif arg_4 == \"millisecond\":\n        arg_2 = arg_2 + \".\" + arg_3[:3]\n    elif arg_1.microsecond > 0:\n        arg_2 = arg_2 + \".\" + arg_3.rstrip(\"0\")\n    return arg_2 + \"Z\"", "path": "taxii2client/__init__.py", "identifier": "_format_datetime", "docstring": "Convert a datetime object into a valid STIX timestamp string.\n\n    1. Convert to timezone-aware\n    2. Convert to UTC\n    3. Format in ISO format\n    4. Ensure correct precision\n       a. Add subsecond value if non-zero and precision not defined\n    5. Add \"Z\"", "docstring_tokens": ["Convert", "a", "datetime", "object", "into", "a", "valid", "STIX", "timestamp", "string", "."], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 253707}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/carddav_object.py#L98-L105", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Use this if you want to create a new contact from an existing .vcf\n        file.", "language": "python", "parameters": "(cls, address_book, filename, supported_private_objects,\n            localize_dates)", "return_statement": "return cls(address_book, filename, supported_private_objects, None,\n                localize_dates)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "return", "arg_0", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "None", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n            arg_4):\n        \"\"\"\n        Use this if you want to create a new contact from an existing .vcf\n        file.\n        \"\"\"\n        return arg_0(arg_1, arg_2, arg_3, None,\n                arg_4)", "path": "khard/carddav_object.py", "identifier": "CarddavObject.from_file", "docstring": "Use this if you want to create a new contact from an existing .vcf\n        file.", "docstring_tokens": ["Use", "this", "if", "you", "want", "to", "create", "a", "new", "contact", "from", "an", "existing", ".", "vcf", "file", "."], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 253708}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L226-L255", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka\n    old-draft Metadata 2.0 format.", "language": "python", "parameters": "(egg_info_path, pkginfo_path)", "return_statement": "return pkg_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "read_pkg_info", "(", "arg_1", ")", "arg_2", ".", "replace_header", "(", "'Metadata-Version'", ",", "'2.0'", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'requires.txt'", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "arg_4", "=", "open", "(", "arg_3", ")", ".", "read", "(", ")", "for", "arg_5", ",", "arg_6", "in", "pkg_resources", ".", "split_sections", "(", "arg_4", ")", ":", "arg_7", "=", "''", "if", "arg_5", "and", "':'", "in", "arg_5", ":", "arg_5", ",", "arg_7", "=", "arg_5", ".", "split", "(", "':'", ",", "1", ")", "if", "arg_5", ":", "arg_2", "[", "'Provides-Extra'", "]", "=", "arg_5", "if", "arg_7", ":", "arg_7", "+=", "\" and \"", "arg_7", "+=", "'extra == %s'", "%", "repr", "(", "arg_5", ")", "if", "arg_7", ":", "arg_7", "=", "'; '", "+", "arg_7", "for", "arg_8", "in", "convert_requirements", "(", "arg_6", ")", ":", "arg_2", "[", "'Requires-Dist'", "]", "=", "arg_8", "+", "arg_7", "arg_9", "=", "arg_2", "[", "'Description'", "]", "if", "arg_9", ":", "arg_2", ".", "set_payload", "(", "dedent_description", "(", "arg_2", ")", ")", "del", "arg_2", "[", "'Description'", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka\n    old-draft Metadata 2.0 format.\n    \"\"\"\n    arg_2 = read_pkg_info(arg_1)\n    arg_2.replace_header('Metadata-Version', '2.0')\n    arg_3 = os.path.join(arg_0, 'requires.txt')\n    if os.path.exists(arg_3):\n        arg_4 = open(arg_3).read()\n        for arg_5, arg_6 in pkg_resources.split_sections(arg_4):\n            arg_7 = ''\n            if arg_5 and ':' in arg_5: # setuptools extra:condition syntax\n                arg_5, arg_7 = arg_5.split(':', 1)\n            if arg_5:\n                arg_2['Provides-Extra'] = arg_5\n                if arg_7:\n                    arg_7 += \" and \"\n                arg_7 += 'extra == %s' % repr(arg_5)\n            if arg_7:\n                arg_7 = '; ' + arg_7\n            for arg_8 in convert_requirements(arg_6):\n                arg_2['Requires-Dist'] = arg_8 + arg_7\n\n    arg_9 = arg_2['Description']\n    if arg_9:\n        arg_2.set_payload(dedent_description(arg_2))\n        del arg_2['Description']\n\n    return arg_2", "path": "capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py", "identifier": "pkginfo_to_metadata", "docstring": "Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka\n    old-draft Metadata 2.0 format.", "docstring_tokens": ["Convert", ".", "egg", "-", "info", "directory", "with", "PKG", "-", "INFO", "to", "the", "Metadata", "1", ".", "3", "aka", "old", "-", "draft", "Metadata", "2", ".", "0", "format", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253709}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/players.py#L185-L187", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns a DataFrame of shooting stats.", "language": "python", "parameters": "(self, kind='R', summary=False)", "return_statement": "return self._get_stats_table('shooting', kind=kind, summary=summary)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'R'", ",", "arg_2", "=", "False", ")", ":", "return", "arg_0", ".", "_get_stats_table", "(", "'shooting'", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1='R', arg_2=False):\n        \"\"\"Returns a DataFrame of shooting stats.\"\"\"\n        return arg_0._get_stats_table('shooting', arg_1=arg_1, arg_2=arg_2)", "path": "sportsref/nba/players.py", "identifier": "Player.stats_shooting", "docstring": "Returns a DataFrame of shooting stats.", "docstring_tokens": ["Returns", "a", "DataFrame", "of", "shooting", "stats", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 253710}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-servermanager/azure/mgmt/servermanager/operations/power_shell_operations.py#L328-L381", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Updates a running PowerShell command with more data.", "language": "python", "parameters": "(\n            self, resource_group_name, node_name, session, pssession, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "True", ",", "**", "arg_8", ")", ":", "arg_9", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "True", ",", "**", "arg_8", ")", "def", "get_long_running_output", "(", "arg_10", ")", ":", "arg_11", "=", "arg_0", ".", "_deserialize", "(", "'PowerShellCommandResults'", ",", "arg_10", ")", "if", "arg_6", ":", "arg_12", "=", "ClientRawResponse", "(", "arg_11", ",", "arg_10", ")", "return", "arg_12", "return", "arg_11", "arg_13", "=", "arg_8", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_7", "is", "True", ":", "arg_14", "=", "ARMPolling", "(", "arg_13", ",", "**", "arg_8", ")", "elif", "arg_7", "is", "False", ":", "arg_14", "=", "NoPolling", "(", ")", "else", ":", "arg_14", "=", "arg_7", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_9", ",", "get_long_running_output", ",", "arg_14", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=False, arg_7=True, **arg_8):\n        \"\"\"Updates a running PowerShell command with more data.\n\n        :param resource_group_name: The resource group name uniquely\n         identifies the resource group within the user subscriptionId.\n        :type resource_group_name: str\n        :param node_name: The node name (256 characters maximum).\n        :type node_name: str\n        :param session: The sessionId from the user.\n        :type session: str\n        :param pssession: The PowerShell sessionId from the user.\n        :type pssession: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns\n         PowerShellCommandResults or\n         ClientRawResponse<PowerShellCommandResults> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servermanager.models.PowerShellCommandResults]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servermanager.models.PowerShellCommandResults]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.servermanager.models.ErrorException>`\n        \"\"\"\n        arg_9 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_6=True,\n            **arg_8\n        )\n\n        def get_long_running_output(arg_10):\n            arg_11 = arg_0._deserialize('PowerShellCommandResults', arg_10)\n\n            if arg_6:\n                arg_12 = ClientRawResponse(arg_11, arg_10)\n                return arg_12\n\n            return arg_11\n\n        arg_13 = arg_8.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_7 is True: arg_14 = ARMPolling(arg_13, **arg_8)\n        elif arg_7 is False: arg_14 = NoPolling()\n        else: arg_14 = arg_7\n        return LROPoller(arg_0._client, arg_9, get_long_running_output, arg_14)", "path": "azure-mgmt-servermanager/azure/mgmt/servermanager/operations/power_shell_operations.py", "identifier": "PowerShellOperations.update_command", "docstring": "Updates a running PowerShell command with more data.\n\n        :param resource_group_name: The resource group name uniquely\n         identifies the resource group within the user subscriptionId.\n        :type resource_group_name: str\n        :param node_name: The node name (256 characters maximum).\n        :type node_name: str\n        :param session: The sessionId from the user.\n        :type session: str\n        :param pssession: The PowerShell sessionId from the user.\n        :type pssession: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns\n         PowerShellCommandResults or\n         ClientRawResponse<PowerShellCommandResults> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servermanager.models.PowerShellCommandResults]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servermanager.models.PowerShellCommandResults]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.servermanager.models.ErrorException>`", "docstring_tokens": ["Updates", "a", "running", "PowerShell", "command", "with", "more", "data", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 253711}
{"url": "https://github.com/sublee/zeronimo/blob/b216638232932718d2cbc5eabd870c8f5b5e83fb/zeronimo/messaging.py#L72-L87", "sha": "b216638232932718d2cbc5eabd870c8f5b5e83fb", "docstring_summary": "Sends header, payload, and topics through a ZeroMQ socket.", "language": "python", "parameters": "(socket, header, payload, topics=(), flags=0)", "return_statement": "return eintr_retry_zmq(socket.send_multipart, msgs, flags)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "(", ")", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "[", "]", "arg_5", ".", "extend", "(", "arg_3", ")", "arg_5", ".", "append", "(", "SEAM", ")", "arg_5", ".", "extend", "(", "arg_1", ")", "arg_5", ".", "append", "(", "arg_2", ")", "return", "eintr_retry_zmq", "(", "arg_0", ".", "Func_multipart", ",", "arg_5", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=(), arg_4=0):\n    \"\"\"Sends header, payload, and topics through a ZeroMQ socket.\n\n    :param socket: a zmq socket.\n    :param header: a list of byte strings which represent a message header.\n    :param payload: the serialized byte string of a payload.\n    :param topics: a chain of topics.\n    :param flags: zmq flags to Func messages.\n\n    \"\"\"\n    arg_5 = []\n    arg_5.extend(arg_3)\n    arg_5.append(SEAM)\n    arg_5.extend(arg_1)\n    arg_5.append(arg_2)\n    return eintr_retry_zmq(arg_0.Func_multipart, arg_5, arg_4)", "path": "zeronimo/messaging.py", "identifier": "send", "docstring": "Sends header, payload, and topics through a ZeroMQ socket.\n\n    :param socket: a zmq socket.\n    :param header: a list of byte strings which represent a message header.\n    :param payload: the serialized byte string of a payload.\n    :param topics: a chain of topics.\n    :param flags: zmq flags to send messages.", "docstring_tokens": ["Sends", "header", "payload", "and", "topics", "through", "a", "ZeroMQ", "socket", "."], "nwo": "sublee/zeronimo", "score": 0.08529914490135834, "idx": 253712}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/lang/with_any.py#L63-L79", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "like `with_objattr` but enter context one by one.", "language": "python", "parameters": "(*names)", "return_statement": "return _wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "def", "_wrap", "(", "arg_1", ")", ":", "@", "functools", ".", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "with", "contextlib", ".", "ExitStack", "(", ")", "as", "stack", ":", "for", "arg_5", "in", "arg_0", ":", "stack", ".", "enter_context", "(", "getattr", "(", "arg_2", ",", "arg_5", ")", ")", "return", "arg_1", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "return", "wrapper", "return", "_wrap"], "function": "def Func(*arg_0):\n    '''\n    like `with_objattr` but enter context one by one.\n    '''\n\n    def _wrap(arg_1):\n\n        @functools.wraps(arg_1)\n        def wrapper(arg_2, *arg_3, **arg_4):\n            with contextlib.ExitStack() as stack:\n                for arg_5 in arg_0:\n                    stack.enter_context(getattr(arg_2, arg_5))\n                return arg_1(arg_2, *arg_3, **arg_4)\n\n        return wrapper\n\n    return _wrap", "path": "jasily/lang/with_any.py", "identifier": "with_objattrs", "docstring": "like `with_objattr` but enter context one by one.", "docstring_tokens": ["like", "with_objattr", "but", "enter", "context", "one", "by", "one", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 253713}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L2-L55", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Check if the criterias for Pathogenic is fullfilled", "language": "python", "parameters": "(pvs, ps_terms, pm_terms, pp_terms)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ":", "if", "arg_1", ":", "return", "True", "if", "arg_2", ":", "if", "arg_3", ":", "return", "True", "if", "len", "(", "arg_2", ")", ">=", "2", ":", "return", "True", "if", "len", "(", "arg_3", ")", ">=", "2", ":", "return", "True", "if", "arg_1", ":", "if", "len", "(", "arg_1", ")", ">=", "2", ":", "return", "True", "if", "arg_2", ":", "if", "len", "(", "arg_2", ")", ">=", "3", ":", "return", "True", "elif", "len", "(", "arg_2", ")", ">=", "2", ":", "if", "len", "(", "arg_3", ")", ">=", "2", ":", "return", "True", "elif", "len", "(", "arg_3", ")", ">=", "4", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Check if the criterias for Pathogenic is fullfilled\n\n    The following are descriptions of Pathogenic clasification from ACMG paper:\n\n    Pathogenic\n      (i) 1 Very strong (PVS1) AND\n        (a) \u22651 Strong (PS1\u2013PS4) OR\n        (b) \u22652 Moderate (PM1\u2013PM6) OR\n        (c) 1 Moderate (PM1\u2013PM6) and 1 supporting (PP1\u2013PP5) OR\n        (d) \u22652 Supporting (PP1\u2013PP5)\n      (ii) \u22652 Strong (PS1\u2013PS4) OR\n      (iii) 1 Strong (PS1\u2013PS4) AND\n        (a)\u22653 Moderate (PM1\u2013PM6) OR\n        (b)2 Moderate (PM1\u2013PM6) AND \u22652 Supporting (PP1\u2013PP5) OR\n        (c)1 Moderate (PM1\u2013PM6) AND \u22654 supporting (PP1\u2013PP5)\n\n    Args:\n        pvs(bool): Pathogenic Very Strong\n        ps_terms(list(str)): Pathogenic Strong terms\n        pm_terms(list(str)): Pathogenic Moderate terms\n        pp_terms(list(str)): Pathogenic Supporting terms\n\n    Returns:\n        bool: if classification indicates Pathogenic level\n    \"\"\"\n    if arg_0:\n        # Pathogenic (i)(a):\n        if arg_1:\n            return True\n        if arg_2:\n            # Pathogenic (i)(c):\n            if arg_3:\n                return True\n            # Pathogenic (i)(b):\n            if len(arg_2) >= 2:\n                return True\n        # Pathogenic (i)(d):\n        if len(arg_3) >= 2:\n            return True\n    if arg_1:\n        # Pathogenic (ii):\n        if len(arg_1) >= 2:\n            return True\n        # Pathogenic (iii)(a):\n        if arg_2:\n            if len(arg_2) >= 3:\n                return True\n            elif len(arg_2) >= 2:\n                if len(arg_3) >= 2:\n                    return True\n            elif len(arg_3) >= 4:\n                return True\n    return False", "path": "scout/utils/acmg.py", "identifier": "is_pathogenic", "docstring": "Check if the criterias for Pathogenic is fullfilled\n\n    The following are descriptions of Pathogenic clasification from ACMG paper:\n\n    Pathogenic\n      (i) 1 Very strong (PVS1) AND\n        (a) \u22651 Strong (PS1\u2013PS4) OR\n        (b) \u22652 Moderate (PM1\u2013PM6) OR\n        (c) 1 Moderate (PM1\u2013PM6) and 1 supporting (PP1\u2013PP5) OR\n        (d) \u22652 Supporting (PP1\u2013PP5)\n      (ii) \u22652 Strong (PS1\u2013PS4) OR\n      (iii) 1 Strong (PS1\u2013PS4) AND\n        (a)\u22653 Moderate (PM1\u2013PM6) OR\n        (b)2 Moderate (PM1\u2013PM6) AND \u22652 Supporting (PP1\u2013PP5) OR\n        (c)1 Moderate (PM1\u2013PM6) AND \u22654 supporting (PP1\u2013PP5)\n\n    Args:\n        pvs(bool): Pathogenic Very Strong\n        ps_terms(list(str)): Pathogenic Strong terms\n        pm_terms(list(str)): Pathogenic Moderate terms\n        pp_terms(list(str)): Pathogenic Supporting terms\n\n    Returns:\n        bool: if classification indicates Pathogenic level", "docstring_tokens": ["Check", "if", "the", "criterias", "for", "Pathogenic", "is", "fullfilled"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253714}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/views/__init__.py#L5-L34", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Declaration of routing", "language": "python", "parameters": "(config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "add_route", "arg_1", "(", "'get-content'", ",", "'/contents/{ident_hash}'", ")", "arg_1", "(", "'get-resource'", ",", "'/resources/{hash}'", ")", "arg_1", "(", "'license-request'", ",", "'/contents/{uuid}/licensors'", ")", "arg_1", "(", "'roles-request'", ",", "'/contents/{uuid}/roles'", ")", "arg_1", "(", "'acl-request'", ",", "'/contents/{uuid}/permissions'", ")", "arg_1", "(", "'publications'", ",", "'/publications'", ")", "arg_1", "(", "'get-publication'", ",", "'/publications/{id}'", ")", "arg_1", "(", "'publication-license-acceptance'", ",", "'/publications/{id}/license-acceptances/{uid}'", ")", "arg_1", "(", "'publication-role-acceptance'", ",", "'/publications/{id}/role-acceptances/{uid}'", ")", "arg_1", "(", "'collate-content'", ",", "'/contents/{ident_hash}/collate-content'", ")", "arg_1", "(", "'bake-content'", ",", "'/contents/{ident_hash}/baked'", ")", "arg_1", "(", "'moderation'", ",", "'/moderations'", ")", "arg_1", "(", "'moderate'", ",", "'/moderations/{id}'", ")", "arg_1", "(", "'moderation-rss'", ",", "'/feeds/moderations.rss'", ")", "arg_1", "(", "'api-keys'", ",", "'/api-keys'", ")", "arg_1", "(", "'api-key'", ",", "'/api-keys/{id}'", ")"], "function": "def Func(arg_0):\n    \"\"\"Declaration of routing\"\"\"\n    arg_1 = arg_0.add_route\n    arg_1('get-content', '/contents/{ident_hash}')\n    arg_1('get-resource', '/resources/{hash}')\n\n    # User actions API\n    arg_1('license-request', '/contents/{uuid}/licensors')\n    arg_1('roles-request', '/contents/{uuid}/roles')\n    arg_1('acl-request', '/contents/{uuid}/permissions')\n\n    # Publishing API\n    arg_1('publications', '/publications')\n    arg_1('get-publication', '/publications/{id}')\n    arg_1('publication-license-acceptance',\n              '/publications/{id}/license-acceptances/{uid}')\n    arg_1('publication-role-acceptance',\n              '/publications/{id}/role-acceptances/{uid}')\n    # TODO (8-May-12017) Remove because the term collate is being phased out.\n    arg_1('collate-content', '/contents/{ident_hash}/collate-content')\n    arg_1('bake-content', '/contents/{ident_hash}/baked')\n\n    # Moderation routes\n    arg_1('moderation', '/moderations')\n    arg_1('moderate', '/moderations/{id}')\n    arg_1('moderation-rss', '/feeds/moderations.rss')\n\n    # API Key routes\n    arg_1('api-keys', '/api-keys')\n    arg_1('api-key', '/api-keys/{id}')", "path": "cnxpublishing/views/__init__.py", "identifier": "declare_api_routes", "docstring": "Declaration of routing", "docstring_tokens": ["Declaration", "of", "routing"], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 253715}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/hybridmanager.py#L133-L164", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Decorator for methods accepting old_path and new_path.", "language": "python", "parameters": "(mname, returns_model)", "return_statement": "return _wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "_wrapper", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "_resolve_path", "(", "arg_3", ",", "arg_2", ".", "managers", ")", "arg_10", ",", "arg_11", ",", "arg_12", "=", "_resolve_path", "(", "arg_4", ",", "arg_2", ".", "managers", ",", ")", "if", "arg_8", "is", "not", "arg_11", ":", "raise", "HTTPError", "(", "400", ",", "\"Can't move files between backends ({old} -> {new})\"", ".", "format", "(", "old", "=", "arg_3", ",", "new", "=", "arg_4", ",", ")", ")", "assert", "arg_10", "==", "arg_7", "arg_13", "=", "getattr", "(", "arg_11", ",", "arg_0", ")", "(", "arg_9", ",", "arg_12", ",", "*", "arg_5", ",", "**", "arg_6", ")", "if", "arg_1", "and", "arg_10", ":", "return", "_apply_prefix", "(", "arg_10", ",", "arg_13", ")", "else", ":", "return", "arg_13", "return", "_wrapper"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Decorator for methods accepting old_path and new_path.\n    \"\"\"\n    def _wrapper(arg_2, arg_3, arg_4, *arg_5, **arg_6):\n        arg_7, arg_8, arg_9 = _resolve_path(\n            arg_3, arg_2.managers\n        )\n        arg_10, arg_11, arg_12 = _resolve_path(\n            arg_4, arg_2.managers,\n        )\n        if arg_8 is not arg_11:\n            # TODO: Consider supporting this via get+delete+save.\n            raise HTTPError(\n                400,\n                \"Can't move files between backends ({old} -> {new})\".format(\n                    old=arg_3,\n                    new=arg_4,\n                )\n            )\n        assert arg_10 == arg_7\n        arg_13 = getattr(arg_11, arg_0)(\n            arg_9,\n            arg_12,\n            *arg_5,\n            **arg_6\n        )\n        if arg_1 and arg_10:\n            return _apply_prefix(arg_10, arg_13)\n        else:\n            return arg_13\n    return _wrapper", "path": "pgcontents/hybridmanager.py", "identifier": "path_dispatch_old_new", "docstring": "Decorator for methods accepting old_path and new_path.", "docstring_tokens": ["Decorator", "for", "methods", "accepting", "old_path", "and", "new_path", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 253716}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process.py#L330-L348", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Sets the main channel names based on the provide input and\n        output channel suffixes. This is performed when connecting processes.", "language": "python", "parameters": "(self, input_suffix, output_suffix, lane)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "input_channel", "=", "\"{}_in_{}\"", ".", "format", "(", "arg_0", ".", "template", ",", "arg_1", ")", "arg_0", ".", "output_channel", "=", "\"{}_out_{}\"", ".", "format", "(", "arg_0", ".", "template", ",", "arg_2", ")", "arg_0", ".", "lane", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Sets the main channel names based on the provide input and\n        output channel suffixes. This is performed when connecting processes.\n\n        Parameters\n        ----------\n        input_suffix : str\n            Suffix added to the input channel. Should be based on the lane\n            and an arbitrary unique id\n        output_suffix : str\n            Suffix added to the output channel. Should be based on the lane\n            and an arbitrary unique id\n        lane : int\n            Sets the lane of the process.\n        \"\"\"\n\n        arg_0.input_channel = \"{}_in_{}\".format(arg_0.template, arg_1)\n        arg_0.output_channel = \"{}_out_{}\".format(arg_0.template, arg_2)\n        arg_0.lane = arg_3", "path": "flowcraft/generator/process.py", "identifier": "Process.set_main_channel_names", "docstring": "Sets the main channel names based on the provide input and\n        output channel suffixes. This is performed when connecting processes.\n\n        Parameters\n        ----------\n        input_suffix : str\n            Suffix added to the input channel. Should be based on the lane\n            and an arbitrary unique id\n        output_suffix : str\n            Suffix added to the output channel. Should be based on the lane\n            and an arbitrary unique id\n        lane : int\n            Sets the lane of the process.", "docstring_tokens": ["Sets", "the", "main", "channel", "names", "based", "on", "the", "provide", "input", "and", "output", "channel", "suffixes", ".", "This", "is", "performed", "when", "connecting", "processes", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 253717}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/utils.py#L586-L613", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Open Tensorboard.", "language": "python", "parameters": "(log_dir='/tmp/tensorflow', port=6006)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'/tmp/tensorflow'", ",", "arg_1", "=", "6006", ")", ":", "arg_2", "=", "\"[TL] Open tensorboard, go to localhost:\"", "+", "str", "(", "arg_1", ")", "+", "\" to access\"", "arg_3", "=", "\" not yet supported by this function (tl.ops.open_tb)\"", "if", "not", "tl", ".", "files", ".", "exists_or_mkdir", "(", "arg_0", ",", "verbose", "=", "False", ")", ":", "tl", ".", "logging", ".", "info", "(", "\"[TL] Log reportory was created at %s\"", "%", "arg_0", ")", "if", "_platform", "==", "\"linux\"", "or", "_platform", "==", "\"linux2\"", ":", "raise", "NotImplementedError", "(", ")", "elif", "_platform", "==", "\"darwin\"", ":", "tl", ".", "logging", ".", "info", "(", "'OS X: %s'", "%", "arg_2", ")", "subprocess", ".", "Popen", "(", "sys", ".", "prefix", "+", "\" | python -m tensorflow.tensorboard --logdir=\"", "+", "arg_0", "+", "\" --port=\"", "+", "str", "(", "arg_1", ")", ",", "shell", "=", "True", ")", "elif", "_platform", "==", "\"win32\"", ":", "raise", "NotImplementedError", "(", "\"this function is not supported on the Windows platform\"", ")", "else", ":", "tl", ".", "logging", ".", "info", "(", "_platform", "+", "arg_3", ")"], "function": "def Func(arg_0='/tmp/tensorflow', arg_1=6006):\n    \"\"\"Open Tensorboard.\n\n    Parameters\n    ----------\n    log_dir : str\n        Directory where your tensorboard logs are saved\n    port : int\n        TensorBoard port you want to open, 6006 is tensorboard default\n\n    \"\"\"\n    arg_2 = \"[TL] Open tensorboard, go to localhost:\" + str(arg_1) + \" to access\"\n    arg_3 = \" not yet supported by this function (tl.ops.open_tb)\"\n\n    if not tl.files.exists_or_mkdir(arg_0, verbose=False):\n        tl.logging.info(\"[TL] Log reportory was created at %s\" % arg_0)\n\n    if _platform == \"linux\" or _platform == \"linux2\":\n        raise NotImplementedError()\n    elif _platform == \"darwin\":\n        tl.logging.info('OS X: %s' % arg_2)\n        subprocess.Popen(\n            sys.prefix + \" | python -m tensorflow.tensorboard --logdir=\" + arg_0 + \" --port=\" + str(arg_1), shell=True\n        )  # open tensorboard in localhost:6006/ or whatever port you chose\n    elif _platform == \"win32\":\n        raise NotImplementedError(\"this function is not supported on the Windows platform\")\n    else:\n        tl.logging.info(_platform + arg_3)", "path": "tensorlayer/utils.py", "identifier": "open_tensorboard", "docstring": "Open Tensorboard.\n\n    Parameters\n    ----------\n    log_dir : str\n        Directory where your tensorboard logs are saved\n    port : int\n        TensorBoard port you want to open, 6006 is tensorboard default", "docstring_tokens": ["Open", "Tensorboard", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253718}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/decorators.py#L12-L24", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Cast the positional argument at given position into a list if not already a list.", "language": "python", "parameters": "(position)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wrapt", ".", "decorator", "def", "wrapper", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "not", "isinstance", "(", "arg_3", "[", "arg_0", "]", ",", "list", ")", ":", "arg_3", "=", "list", "(", "arg_3", ")", "arg_3", "[", "arg_0", "]", "=", "[", "arg_3", "[", "arg_0", "]", "]", "arg_3", "=", "tuple", "(", "arg_3", ")", "return", "arg_1", "(", "*", "arg_3", ",", "**", "arg_4", ")", "return", "wrapper"], "function": "def Func(arg_0):\n\t\"\"\"Cast the positional argument at given position into a list if not already a list.\"\"\"\n\n\t@wrapt.decorator\n\tdef wrapper(arg_1, arg_2, arg_3, arg_4):\n\t\tif not isinstance(arg_3[arg_0], list):\n\t\t\targ_3 = list(arg_3)\n\t\t\targ_3[arg_0] = [arg_3[arg_0]]\n\t\t\targ_3 = tuple(arg_3)\n\n\t\treturn arg_1(*arg_3, **arg_4)\n\n\treturn wrapper", "path": "gmusicapi_wrapper/decorators.py", "identifier": "cast_to_list", "docstring": "Cast the positional argument at given position into a list if not already a list.", "docstring_tokens": ["Cast", "the", "positional", "argument", "at", "given", "position", "into", "a", "list", "if", "not", "already", "a", "list", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 253719}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/tokens.py#L383-L396", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Clear all the internal data the token needed while it was part of \n        the world.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "onFunc", "(", ")", "arg_0", ".", "_extensions", "=", "{", "}", "arg_0", ".", "_disable_forum_observation", "(", ")", "arg_0", ".", "_world", "=", "None", "arg_0", ".", "_id", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Clear all the internal data the token needed while it was part of \n        the world.\n\n        Note that this method doesn't actually remove the token from the \n        world.  That's what World._remove_token() does.  This method is just \n        responsible for setting the internal state of the token being removed.\n        \"\"\"\n        arg_0.onFunc()\n        arg_0._extensions = {}\n        arg_0._disable_forum_observation()\n        arg_0._world = None\n        arg_0._id = None", "path": "kxg/tokens.py", "identifier": "Token._remove_from_world", "docstring": "Clear all the internal data the token needed while it was part of \n        the world.\n\n        Note that this method doesn't actually remove the token from the \n        world.  That's what World._remove_token() does.  This method is just \n        responsible for setting the internal state of the token being removed.", "docstring_tokens": ["Clear", "all", "the", "internal", "data", "the", "token", "needed", "while", "it", "was", "part", "of", "the", "world", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 253720}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1001-L1014", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Detect when a \"bad\" built-in is referenced.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_1", ".", "lookup", "(", "arg_1", ".", "name", ")", "if", "not", "_is_builtin", "(", "arg_2", ")", ":", "return", "if", "arg_1", ".", "name", "not", "in", "arg_0", ".", "_bad_builtins", ":", "return", "if", "node_ignores_exception", "(", "arg_1", ")", "or", "isinstance", "(", "find_try_except_wrapper_node", "(", "arg_1", ")", ",", "astroid", ".", "ExceptHandler", ")", ":", "return", "arg_4", "=", "arg_1", ".", "name", ".", "lower", "(", ")", "+", "\"-builtin\"", "arg_0", ".", "add_message", "(", "arg_4", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Detect when a \"bad\" built-in is referenced.\"\"\"\n        arg_2, arg_3 = arg_1.lookup(arg_1.name)\n        if not _is_builtin(arg_2):\n            return\n        if arg_1.name not in arg_0._bad_builtins:\n            return\n        if node_ignores_exception(arg_1) or isinstance(\n            find_try_except_wrapper_node(arg_1), astroid.ExceptHandler\n        ):\n            return\n\n        arg_4 = arg_1.name.lower() + \"-builtin\"\n        arg_0.add_message(arg_4, arg_1=arg_1)", "path": "pylint/checkers/python3.py", "identifier": "Python3Checker.visit_name", "docstring": "Detect when a \"bad\" built-in is referenced.", "docstring_tokens": ["Detect", "when", "a", "bad", "built", "-", "in", "is", "referenced", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253721}
{"url": "https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L121-L137", "sha": "1701526a91c14dc8ebc6452c45c8ec9a563a56db", "docstring_summary": "Get the escape sequence for indexed color ``index``.", "language": "python", "parameters": "(self, index)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "Funcs", "==", "16", ":", "if", "arg_1", ">=", "8", ":", "return", "arg_0", ".", "csi", "(", "'bold'", ")", "+", "arg_0", ".", "csi", "(", "'setaf'", ",", "arg_1", "-", "8", ")", "else", ":", "return", "arg_0", ".", "csi", "(", "'sgr0'", ")", "+", "arg_0", ".", "csi", "(", "'setaf'", ",", "arg_1", ")", "else", ":", "return", "arg_0", ".", "csi", "(", "'setaf'", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get the escape sequence for indexed Func ``index``.\n\n        The ``index`` is a Func index in the 256 Func space. The Func space\n        consists of:\n\n        * 0x00-0x0f: default EGA Funcs\n        * 0x10-0xe7: 6x6x6 RGB cubes\n        * 0xe8-0xff: gray scale ramp\n        \"\"\"\n        if arg_0.Funcs == 16:\n            if arg_1 >= 8:\n                return arg_0.csi('bold') + arg_0.csi('setaf', arg_1 - 8)\n            else:\n                return arg_0.csi('sgr0') + arg_0.csi('setaf', arg_1)\n        else:\n            return arg_0.csi('setaf', arg_1)", "path": "diagram.py", "identifier": "Terminal.color", "docstring": "Get the escape sequence for indexed color ``index``.\n\n        The ``index`` is a color index in the 256 color space. The color space\n        consists of:\n\n        * 0x00-0x0f: default EGA colors\n        * 0x10-0xe7: 6x6x6 RGB cubes\n        * 0xe8-0xff: gray scale ramp", "docstring_tokens": ["Get", "the", "escape", "sequence", "for", "indexed", "color", "index", "."], "nwo": "tehmaze/diagram", "score": 0.5330178463252985, "idx": 253722}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L494-L504", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Send a message to the room.", "language": "python", "parameters": "(self,body)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Message", "(", "to_jid", "=", "arg_0", ".", "room_jid", ".", "bare", "(", ")", ",", "stanza_type", "=", "\"groupchat\"", ",", "arg_1", "=", "arg_1", ")", "arg_0", ".", "manager", ".", "stream", ".", "send", "(", "arg_2", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Send a message to the room.\n\n        :Parameters:\n            - `body`: the message body.\n        :Types:\n            - `body`: `unicode`\n        \"\"\"\n        arg_2=Message(to_jid=arg_0.room_jid.bare(),stanza_type=\"groupchat\",arg_1=arg_1)\n        arg_0.manager.stream.send(arg_2)", "path": "pyxmpp2/ext/muc/muc.py", "identifier": "MucRoomState.send_message", "docstring": "Send a message to the room.\n\n        :Parameters:\n            - `body`: the message body.\n        :Types:\n            - `body`: `unicode`", "docstring_tokens": ["Send", "a", "message", "to", "the", "room", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253723}
{"url": "https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L185-L195", "sha": "8c6bb54888675652d25324184967392d00d128fc", "docstring_summary": "Iterates over the labels for the descendants of a given term", "language": "python", "parameters": "(self, ontology, iri, size=None, sleep=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "for", "arg_5", "in", "_help_iterate_labels", "(", "arg_0", ".", "iter_descendants", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", ")", ":", "yield", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"Iterates over the labels for the descendants of a given term\n\n        :param str ontology: The name of the ontology\n        :param str iri: The IRI of a term\n        :param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.\n        :param int sleep: The amount of time to sleep between pages. Defaults to 0 seconds.\n        :rtype: iter[str]\n        \"\"\"\n        for arg_5 in _help_iterate_labels(arg_0.iter_descendants(arg_1, arg_2, arg_3=arg_3, arg_4=arg_4)):\n            yield arg_5", "path": "src/ols_client/client.py", "identifier": "OlsClient.iter_descendants_labels", "docstring": "Iterates over the labels for the descendants of a given term\n\n        :param str ontology: The name of the ontology\n        :param str iri: The IRI of a term\n        :param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.\n        :param int sleep: The amount of time to sleep between pages. Defaults to 0 seconds.\n        :rtype: iter[str]", "docstring_tokens": ["Iterates", "over", "the", "labels", "for", "the", "descendants", "of", "a", "given", "term"], "nwo": "cthoyt/ols-client", "score": 0.25890992733444657, "idx": 253724}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/subgraph_summary.py#L27-L33", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Count the number of nodes in each subgraph induced by an annotation.", "language": "python", "parameters": "(graph: BELGraph, annotation: str = 'Subgraph')", "return_statement": "return count_dict_values(group_nodes_by_annotation(graph, annotation))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "'Subgraph'", ")", "->", "Counter", "[", "int", "]", ":", "return", "count_dict_values", "(", "group_nodes_by_annotation", "(", "arg_0", ",", "arg_2", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = 'Subgraph') -> Counter[int]:\n    \"\"\"Count the number of nodes in each subgraph induced by an annotation.\n\n    :param annotation: The annotation to group by and compare. Defaults to 'Subgraph'\n    :return: A dictionary from {annotation value: number of nodes}\n    \"\"\"\n    return count_dict_values(group_nodes_by_annotation(arg_0, arg_2))", "path": "src/pybel_tools/summary/subgraph_summary.py", "identifier": "count_subgraph_sizes", "docstring": "Count the number of nodes in each subgraph induced by an annotation.\n\n    :param annotation: The annotation to group by and compare. Defaults to 'Subgraph'\n    :return: A dictionary from {annotation value: number of nodes}", "docstring_tokens": ["Count", "the", "number", "of", "nodes", "in", "each", "subgraph", "induced", "by", "an", "annotation", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253725}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/base.py#L124-L164", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Call the timeout handlers due.", "language": "python", "parameters": "(self)", "return_statement": "return timeout, sources_handled", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "time", ".", "time", "(", ")", "arg_3", "=", "None", "while", "arg_0", ".", "_timeout_handlers", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_timeout_handlers", "[", "0", "]", "if", "arg_3", "<=", "arg_2", ":", "logger", ".", "debug", "(", "\"About to call a timeout handler: {0!r}\"", ".", "format", "(", "arg_4", ")", ")", "arg_0", ".", "_timeout_handlers", "=", "arg_0", ".", "_timeout_handlers", "[", "1", ":", "]", "arg_6", "=", "arg_4", "(", ")", "logger", ".", "debug", "(", "\" handler result: {0!r}\"", ".", "format", "(", "arg_6", ")", ")", "arg_7", "=", "arg_4", ".", "_pyxmpp_recurring", "if", "arg_7", ":", "logger", ".", "debug", "(", "\" recurring, restarting in {0} s\"", ".", "format", "(", "arg_4", ".", "_pyxmpp_timeout", ")", ")", "arg_0", ".", "_timeout_handlers", ".", "append", "(", "(", "arg_2", "+", "arg_4", ".", "_pyxmpp_timeout", ",", "arg_4", ")", ")", "arg_0", ".", "_timeout_handlers", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ")", "elif", "arg_7", "is", "None", "and", "arg_6", "is", "not", "None", ":", "logger", ".", "debug", "(", "\" auto-recurring, restarting in {0} s\"", ".", "format", "(", "arg_6", ")", ")", "arg_0", ".", "_timeout_handlers", ".", "append", "(", "(", "arg_2", "+", "arg_6", ",", "arg_4", ")", ")", "arg_0", ".", "_timeout_handlers", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ")", "arg_1", "+=", "1", "else", ":", "break", "if", "arg_0", ".", "check_events", "(", ")", ":", "return", "0", ",", "arg_1", "if", "arg_0", ".", "_timeout_handlers", "and", "arg_3", ":", "arg_8", "=", "arg_3", "-", "arg_2", "else", ":", "arg_8", "=", "None", "return", "arg_8", ",", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Call the timeout handlers due.\n\n        :Return: (next_event_timeout, sources_handled) tuple.\n            next_event_timeout is number of seconds until the next timeout\n            event, sources_handled is number of handlers called.\n        \"\"\"\n        arg_1 = 0\n        arg_2 = time.time()\n        arg_3 = None\n        while arg_0._timeout_handlers:\n            arg_3, arg_4 = arg_0._timeout_handlers[0]\n            if arg_3 <= arg_2:\n                # pylint: disable-msg=W0212\n                logger.debug(\"About to call a timeout handler: {0!r}\"\n                                                        .format(arg_4))\n                arg_0._timeout_handlers = arg_0._timeout_handlers[1:]\n                arg_6 = arg_4()\n                logger.debug(\" handler result: {0!r}\".format(arg_6))\n                arg_7 = arg_4._pyxmpp_recurring\n                if arg_7:\n                    logger.debug(\" recurring, restarting in {0} s\"\n                                        .format(arg_4._pyxmpp_timeout))\n                    arg_0._timeout_handlers.append(\n                                    (arg_2 + arg_4._pyxmpp_timeout, arg_4))\n                    arg_0._timeout_handlers.sort(key = lambda x: x[0])\n                elif arg_7 is None and arg_6 is not None:\n                    logger.debug(\" auto-recurring, restarting in {0} s\"\n                                                            .format(arg_6))\n                    arg_0._timeout_handlers.append((arg_2 + arg_6, arg_4))\n                    arg_0._timeout_handlers.sort(key = lambda x: x[0])\n                arg_1 += 1\n            else:\n                break\n            if arg_0.check_events():\n                return 0, arg_1\n        if arg_0._timeout_handlers and arg_3:\n            arg_8 = arg_3 - arg_2\n        else:\n            arg_8 = None\n        return arg_8, arg_1", "path": "pyxmpp2/mainloop/base.py", "identifier": "MainLoopBase._call_timeout_handlers", "docstring": "Call the timeout handlers due.\n\n        :Return: (next_event_timeout, sources_handled) tuple.\n            next_event_timeout is number of seconds until the next timeout\n            event, sources_handled is number of handlers called.", "docstring_tokens": ["Call", "the", "timeout", "handlers", "due", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253726}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L208-L239", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Update the status of the job lists.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", ".", "_s_running", ",", "arg_0", ".", "_s_completed", ",", "arg_0", ".", "_s_dead", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_running", ",", "arg_0", ".", "_completed", ",", "arg_0", ".", "_dead", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_4", ")", ":", "arg_9", "=", "arg_8", ".", "stat_code", "if", "arg_9", "==", "arg_1", ":", "continue", "elif", "arg_9", "==", "arg_2", ":", "arg_5", ".", "append", "(", "arg_8", ")", "arg_0", ".", "_comp_report", ".", "append", "(", "arg_8", ")", "arg_4", "[", "arg_7", "]", "=", "False", "elif", "arg_9", "==", "arg_3", ":", "arg_6", ".", "append", "(", "arg_8", ")", "arg_0", ".", "_dead_report", ".", "append", "(", "arg_8", ")", "arg_4", "[", "arg_7", "]", "=", "False", "arg_4", "[", ":", "]", "=", "filter", "(", "None", ",", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"Update the status of the job lists.\n\n        This method moves finished jobs to one of two lists:\n          - self.completed: jobs which completed successfully\n          - self.dead: jobs which finished but died.\n\n        It also copies those jobs to corresponding _report lists.  These lists\n        are used to report jobs completed/dead since the last update, and are\n        then cleared by the reporting function after each call.\"\"\"\n\n        # Status codes\n        arg_1, arg_2, arg_3 = arg_0._s_running, arg_0._s_completed, arg_0._s_dead\n        # State lists, use the actual lists b/c the public names are properties\n        # that call this very function on access\n        arg_4, arg_5, arg_6 = arg_0._running, arg_0._completed, arg_0._dead\n\n        # Now, update all state lists\n        for arg_7, arg_8 in enumerate(arg_4):\n            arg_9 = arg_8.stat_code\n            if arg_9 == arg_1:\n                continue\n            elif arg_9 == arg_2:\n                arg_5.append(arg_8)\n                arg_0._comp_report.append(arg_8)\n                arg_4[arg_7] = False\n            elif arg_9 == arg_3:\n                arg_6.append(arg_8)\n                arg_0._dead_report.append(arg_8)\n                arg_4[arg_7] = False\n        # Remove dead/completed jobs from running list\n        arg_4[:] = filter(None, arg_4)", "path": "environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py", "identifier": "BackgroundJobManager._update_status", "docstring": "Update the status of the job lists.\n\n        This method moves finished jobs to one of two lists:\n          - self.completed: jobs which completed successfully\n          - self.dead: jobs which finished but died.\n\n        It also copies those jobs to corresponding _report lists.  These lists\n        are used to report jobs completed/dead since the last update, and are\n        then cleared by the reporting function after each call.", "docstring_tokens": ["Update", "the", "status", "of", "the", "job", "lists", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253727}
{"url": "https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/rankedmodel/admintools.py#L10-L27", "sha": "70d469ef9a161c1170b53aa017cf02d7c15eb90c", "docstring_summary": "Returns a link to a view that moves the passed in object up in rank.", "language": "python", "parameters": "(obj, link_text='up')", "return_statement": "return '<a href=\"%s\">%s</a>' % (link, link_text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'up'", ")", ":", "if", "arg_0", ".", "rank", "==", "1", ":", "return", "''", "arg_2", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "arg_0", ")", "arg_3", "=", "reverse", "(", "'awl-rankedmodel-move'", ",", "args", "=", "(", "arg_2", ".", "id", ",", "arg_0", ".", "id", ",", "arg_0", ".", "rank", "-", "1", ")", ")", "return", "'<a href=\"%s\">%s</a>'", "%", "(", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1='up'):\n    \"\"\"Returns a link to a view that moves the passed in object up in rank.\n\n    :param obj:\n        Object to move\n    :param link_text:\n        Text to display in the link.  Defaults to \"up\"\n    :returns:\n        HTML link code to view for moving the object\n    \"\"\"\n    if arg_0.rank == 1:\n        return ''\n\n    arg_2 = ContentType.objects.get_for_model(arg_0)\n    arg_3 = reverse('awl-rankedmodel-move', args=(arg_2.id, arg_0.id, \n        arg_0.rank - 1))\n\n    return '<a href=\"%s\">%s</a>' % (arg_3, arg_1)", "path": "awl/rankedmodel/admintools.py", "identifier": "admin_link_move_up", "docstring": "Returns a link to a view that moves the passed in object up in rank.\n\n    :param obj:\n        Object to move\n    :param link_text:\n        Text to display in the link.  Defaults to \"up\"\n    :returns:\n        HTML link code to view for moving the object", "docstring_tokens": ["Returns", "a", "link", "to", "a", "view", "that", "moves", "the", "passed", "in", "object", "up", "in", "rank", "."], "nwo": "cltrudeau/django-awl", "score": 0.09252797783733271, "idx": 253728}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L3692-L3778", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks for horizontal spacing near commas.", "language": "python", "parameters": "(filename, clean_lines, linenum, nesting_state, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_1", ".", "elided", "[", "arg_2", "]", "arg_6", "=", "Match", "(", "r'^(.*[^ ({>]){'", ",", "arg_5", ")", "if", "arg_6", ":", "arg_7", "=", "arg_6", ".", "group", "(", "1", ")", "(", "arg_8", ",", "arg_9", ",", "arg_10", ")", "=", "CloseExpression", "(", "arg_1", ",", "arg_2", ",", "len", "(", "arg_6", ".", "group", "(", "1", ")", ")", ")", "arg_11", "=", "''", "if", "arg_10", ">", "-", "1", ":", "arg_11", "=", "arg_8", "[", "arg_10", ":", "]", "for", "arg_12", "in", "xrange", "(", "arg_9", "+", "1", ",", "min", "(", "arg_9", "+", "3", ",", "arg_1", ".", "NumLines", "(", ")", "-", "1", ")", ")", ":", "arg_11", "+=", "arg_1", ".", "elided", "[", "arg_12", "]", "if", "(", "not", "Match", "(", "r'^[\\s}]*[{.;,)<>\\]:]'", ",", "arg_11", ")", "and", "not", "_IsType", "(", "arg_1", ",", "arg_3", ",", "arg_7", ")", ")", ":", "arg_4", "(", "arg_0", ",", "arg_2", ",", "'whitespace/braces'", ",", "5", ",", "'Missing space before {'", ")", "if", "Search", "(", "r'}else'", ",", "arg_5", ")", ":", "arg_4", "(", "arg_0", ",", "arg_2", ",", "'whitespace/braces'", ",", "5", ",", "'Missing space before else'", ")", "if", "Search", "(", "r':\\s*;\\s*$'", ",", "arg_5", ")", ":", "arg_4", "(", "arg_0", ",", "arg_2", ",", "'whitespace/semicolon'", ",", "5", ",", "'Semicolon defining empty statement. Use {} instead.'", ")", "elif", "Search", "(", "r'^\\s*;\\s*$'", ",", "arg_5", ")", ":", "arg_4", "(", "arg_0", ",", "arg_2", ",", "'whitespace/semicolon'", ",", "5", ",", "'Line contains only semicolon. If this should be an empty statement, '", "'use {} instead.'", ")", "elif", "(", "Search", "(", "r'\\s+;\\s*$'", ",", "arg_5", ")", "and", "not", "Search", "(", "r'\\bfor\\b'", ",", "arg_5", ")", ")", ":", "arg_4", "(", "arg_0", ",", "arg_2", ",", "'whitespace/semicolon'", ",", "5", ",", "'Extra space before last semicolon. If this should be an empty '", "'statement, use {} instead.'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n  \"\"\"Checks for horizontal spacing near commas.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    nesting_state: A NestingState instance which maintains information about\n                   the current stack of nested blocks being parsed.\n    error: The function to call with any errors found.\n  \"\"\"\n  arg_5 = arg_1.elided[arg_2]\n\n  # Except after an opening paren, or after another opening brace (in case of\n  # an initializer list, for instance), you should have spaces before your\n  # braces when they are delimiting blocks, classes, namespaces etc.\n  # And since you should never have braces at the beginning of a line,\n  # this is an easy test.  Except that braces used for initialization don't\n  # follow the same rule; we often don't want spaces before those.\n  arg_6 = Match(r'^(.*[^ ({>]){', arg_5)\n\n  if arg_6:\n    # Try a bit harder to check for brace initialization.  This\n    # happens in one of the following forms:\n    #   Constructor() : initializer_list_{} { ... }\n    #   Constructor{}.MemberFunction()\n    #   Type variable{};\n    #   FunctionCall(type{}, ...);\n    #   LastArgument(..., type{});\n    #   LOG(INFO) << type{} << \" ...\";\n    #   map_of_type[{...}] = ...;\n    #   ternary = expr ? new type{} : nullptr;\n    #   OuterTemplate<InnerTemplateConstructor<Type>{}>\n    #\n    # We check for the character following the closing brace, and\n    # silence the warning if it's one of those listed above, i.e.\n    # \"{.;,)<>]:\".\n    #\n    # To account for nested initializer list, we allow any number of\n    # closing braces up to \"{;,)<\".  We can't simply silence the\n    # warning on first sight of closing brace, because that would\n    # cause false negatives for things that are not initializer lists.\n    #   Silence this:         But not this:\n    #     Outer{                if (...) {\n    #       Inner{...}            if (...){  // Missing space before {\n    #     };                    }\n    #\n    # There is a false negative with this approach if people inserted\n    # spurious semicolons, e.g. \"if (cond){};\", but we will catch the\n    # spurious semicolon with a separate check.\n    arg_7 = arg_6.group(1)\n    (arg_8, arg_9, arg_10) = CloseExpression(\n        arg_1, arg_2, len(arg_6.group(1)))\n    arg_11 = ''\n    if arg_10 > -1:\n      arg_11 = arg_8[arg_10:]\n    for arg_12 in xrange(arg_9 + 1,\n                         min(arg_9 + 3, arg_1.NumLines() - 1)):\n      arg_11 += arg_1.elided[arg_12]\n    # We also suppress warnings for `uint64_t{expression}` etc., as the style\n    # guide recommends brace initialization for integral types to avoid\n    # overflow/truncation.\n    if (not Match(r'^[\\s}]*[{.;,)<>\\]:]', arg_11)\n        and not _IsType(arg_1, arg_3, arg_7)):\n      arg_4(arg_0, arg_2, 'whitespace/braces', 5,\n            'Missing space before {')\n\n  # Make sure '} else {' has spaces.\n  if Search(r'}else', arg_5):\n    arg_4(arg_0, arg_2, 'whitespace/braces', 5,\n          'Missing space before else')\n\n  # You shouldn't have a space before a semicolon at the end of the line.\n  # There's a special case for \"for\" since the style guide allows space before\n  # the semicolon there.\n  if Search(r':\\s*;\\s*$', arg_5):\n    arg_4(arg_0, arg_2, 'whitespace/semicolon', 5,\n          'Semicolon defining empty statement. Use {} instead.')\n  elif Search(r'^\\s*;\\s*$', arg_5):\n    arg_4(arg_0, arg_2, 'whitespace/semicolon', 5,\n          'Line contains only semicolon. If this should be an empty statement, '\n          'use {} instead.')\n  elif (Search(r'\\s+;\\s*$', arg_5) and\n        not Search(r'\\bfor\\b', arg_5)):\n    arg_4(arg_0, arg_2, 'whitespace/semicolon', 5,\n          'Extra space before last semicolon. If this should be an empty '\n          'statement, use {} instead.')", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckBracesSpacing", "docstring": "Checks for horizontal spacing near commas.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    nesting_state: A NestingState instance which maintains information about\n                   the current stack of nested blocks being parsed.\n    error: The function to call with any errors found.", "docstring_tokens": ["Checks", "for", "horizontal", "spacing", "near", "commas", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253729}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Phantom/utils.py#L59-L98", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Read phantom tool specific options", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "threads", "=", "arg_0", ".", "cfg", "[", "\"threads\"", "]", "or", "str", "(", "int", "(", "multiprocessing", ".", "cpu_count", "(", ")", "/", "2", ")", "+", "1", ")", "arg_0", ".", "phantom_modules_path", "=", "arg_0", ".", "cfg", "[", "\"phantom_modules_path\"", "]", "arg_0", ".", "additional_libs", "=", "' '", ".", "join", "(", "arg_0", ".", "cfg", "[", "\"additional_libs\"", "]", ")", "arg_0", ".", "answ_log_level", "=", "arg_0", ".", "cfg", "[", "\"writelog\"", "]", "if", "arg_0", ".", "answ_log_level", ".", "lower", "(", ")", "in", "[", "'0'", ",", "'false'", "]", ":", "arg_0", ".", "answ_log_level", "=", "'none'", "elif", "arg_0", ".", "answ_log_level", ".", "lower", "(", ")", "in", "[", "'1'", ",", "'true'", "]", ":", "arg_0", ".", "answ_log_level", "=", "'all'", "arg_0", ".", "timeout", "=", "parse_duration", "(", "arg_0", ".", "cfg", "[", "\"timeout\"", "]", ")", "if", "arg_0", ".", "timeout", ">", "120000", ":", "logger", ".", "warning", "(", "\"You've set timeout over 2 minutes.\"", "\" Are you a functional tester?\"", ")", "arg_0", ".", "answ_log", "=", "arg_0", ".", "core", ".", "mkstemp", "(", "\".log\"", ",", "\"answ_\"", ")", "arg_0", ".", "core", ".", "add_artifact_file", "(", "arg_0", ".", "answ_log", ")", "arg_0", ".", "core", ".", "add_artifact_file", "(", "arg_0", ".", "phout_file", ")", "arg_0", ".", "core", ".", "add_artifact_file", "(", "arg_0", ".", "stat_log", ")", "arg_0", ".", "phantom_log", "=", "arg_0", ".", "core", ".", "mkstemp", "(", "\".log\"", ",", "\"phantom_\"", ")", "arg_0", ".", "core", ".", "add_artifact_file", "(", "arg_0", ".", "phantom_log", ")", "arg_8", "=", "StreamConfig", "(", "arg_0", ".", "core", ",", "len", "(", "arg_0", ".", "streams", ")", ",", "arg_0", ".", "phout_file", ",", "arg_0", ".", "answ_log", ",", "arg_0", ".", "answ_log_level", ",", "arg_0", ".", "timeout", ",", "arg_0", ".", "cfg", ",", "True", ")", "arg_0", ".", "streams", ".", "append", "(", "arg_8", ")", "for", "arg_9", "in", "arg_0", ".", "multi", "(", ")", ":", "arg_0", ".", "streams", ".", "append", "(", "StreamConfig", "(", "arg_0", ".", "core", ",", "len", "(", "arg_0", ".", "streams", ")", ",", "arg_0", ".", "phout_file", ",", "arg_0", ".", "answ_log", ",", "arg_0", ".", "answ_log_level", ",", "arg_0", ".", "timeout", ",", "arg_9", ")", ")", "for", "arg_10", "in", "arg_0", ".", "streams", ":", "arg_10", ".", "Func", "(", ")", "if", "any", "(", "arg_10", ".", "ssl", "for", "arg_10", "in", "arg_0", ".", "streams", ")", ":", "arg_0", ".", "additional_libs", "+=", "' ssl io_benchmark_method_stream_transport_ssl'"], "function": "def Func(arg_0):\n        \"\"\"        Read phantom tool specific options        \"\"\"\n        arg_0.threads = arg_0.cfg[\"threads\"] or str(int(multiprocessing.cpu_count() / 2) + 1)\n        arg_0.phantom_modules_path = arg_0.cfg[\"phantom_modules_path\"]\n        arg_0.additional_libs = ' '.join(arg_0.cfg[\"additional_libs\"])\n        arg_0.answ_log_level = arg_0.cfg[\"writelog\"]\n        if arg_0.answ_log_level.lower() in ['0', 'false']:\n            arg_0.answ_log_level = 'none'\n        elif arg_0.answ_log_level.lower() in ['1', 'true']:\n            arg_0.answ_log_level = 'all'\n        arg_0.timeout = parse_duration(arg_0.cfg[\"timeout\"])\n        if arg_0.timeout > 120000:\n            logger.warning(\n                \"You've set timeout over 2 minutes.\"\n                \" Are you a functional tester?\")\n        arg_0.answ_log = arg_0.core.mkstemp(\".log\", \"answ_\")\n        arg_0.core.add_artifact_file(arg_0.answ_log)\n        arg_0.core.add_artifact_file(arg_0.phout_file)\n        arg_0.core.add_artifact_file(arg_0.stat_log)\n        arg_0.phantom_log = arg_0.core.mkstemp(\".log\", \"phantom_\")\n        arg_0.core.add_artifact_file(arg_0.phantom_log)\n\n        arg_8 = StreamConfig(\n            arg_0.core,\n            len(arg_0.streams), arg_0.phout_file, arg_0.answ_log,\n            arg_0.answ_log_level, arg_0.timeout, arg_0.cfg, True)\n        arg_0.streams.append(arg_8)\n\n        for arg_9 in arg_0.multi():\n            arg_0.streams.append(\n                StreamConfig(\n                    arg_0.core,\n                    len(arg_0.streams), arg_0.phout_file, arg_0.answ_log,\n                    arg_0.answ_log_level, arg_0.timeout, arg_9))\n\n        for arg_10 in arg_0.streams:\n            arg_10.Func()\n\n        if any(arg_10.ssl for arg_10 in arg_0.streams):\n            arg_0.additional_libs += ' ssl io_benchmark_method_stream_transport_ssl'", "path": "yandextank/plugins/Phantom/utils.py", "identifier": "PhantomConfig.read_config", "docstring": "Read phantom tool specific options", "docstring_tokens": ["Read", "phantom", "tool", "specific", "options"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 253730}
{"url": "https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/doc2md.py#L210-L265", "sha": "afd2876316a715d3401adb442d46c9a07cd7e806", "docstring_summary": "Generate markdown document from module, including API section.", "language": "python", "parameters": "(module, title, title_api_section, toc=True, maxdepth=0)", "return_statement": "return \"\\n\".join(md)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "arg_0", ".", "__doc__", "arg_6", "=", "doctrim", "(", "arg_5", ")", "arg_7", "=", "arg_6", ".", "split", "(", "'\\n'", ")", "arg_8", "=", "find_sections", "(", "arg_7", ")", "if", "arg_8", ":", "arg_9", "=", "min", "(", "n", "for", "n", ",", "t", "in", "arg_8", ")", "-", "1", "else", ":", "arg_9", "=", "1", "arg_10", "=", "[", "]", "arg_11", "=", "[", "]", "if", "arg_2", "and", "arg_0", ".", "__all__", ":", "arg_8", ".", "append", "(", "(", "arg_9", "+", "1", ",", "arg_2", ")", ")", "for", "arg_12", "in", "arg_0", ".", "__all__", ":", "arg_11", ".", "append", "(", "(", "arg_9", "+", "2", ",", "\"`\"", "+", "arg_12", "+", "\"`\"", ")", ")", "arg_10", "+=", "[", "''", ",", "''", "]", "arg_13", "=", "arg_0", ".", "__dict__", "[", "arg_12", "]", "if", "arg_13", ".", "__doc__", ":", "arg_14", ",", "arg_15", "=", "doc2md", "(", "arg_13", ".", "__doc__", ",", "\"`\"", "+", "arg_12", "+", "\"`\"", ",", "min_level", "=", "arg_9", "+", "2", ",", "more_info", "=", "True", ",", "arg_3", "=", "False", ")", "arg_11", "+=", "arg_15", "arg_10", "+=", "arg_14", "arg_8", "+=", "arg_11", "arg_16", "=", "next", "(", "(", "i", "for", "i", ",", "l", "in", "enumerate", "(", "arg_7", ")", "if", "is_heading", "(", "l", ")", ")", ",", "0", ")", "arg_14", "=", "[", "make_heading", "(", "arg_9", ",", "arg_1", ")", ",", "\"\"", ",", "]", "+", "arg_7", "[", ":", "arg_16", "]", "if", "arg_3", ":", "arg_14", "+=", "make_toc", "(", "arg_8", ",", "arg_4", ")", "arg_14", "+=", "[", "''", "]", "arg_14", "+=", "_doc2md", "(", "arg_7", "[", "arg_16", ":", "]", ")", "arg_14", "+=", "[", "''", ",", "''", ",", "make_heading", "(", "arg_9", "+", "1", ",", "arg_2", ")", ",", "]", "if", "arg_3", ":", "arg_14", "+=", "[", "''", "]", "arg_14", "+=", "make_toc", "(", "arg_11", ",", "1", ")", "arg_14", "+=", "arg_10", "return", "\"\\n\"", ".", "join", "(", "arg_14", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True, arg_4=0):\n    \"\"\"\n    Generate markdown document from module, including API section.\n    \"\"\"\n    arg_5 = arg_0.__doc__\n\n    arg_6 = doctrim(arg_5)\n    arg_7 = arg_6.split('\\n')\n\n    arg_8 = find_sections(arg_7)\n    if arg_8:\n        arg_9 = min(n for n,t in arg_8) - 1\n    else:\n        arg_9 = 1\n\n    arg_10 = []\n    arg_11 = []\n    if arg_2 and arg_0.__all__:\n        arg_8.append((arg_9+1, arg_2))\n        for arg_12 in arg_0.__all__:\n            arg_11.append((arg_9+2, \"`\" + arg_12 + \"`\"))\n            arg_10 += ['', '']\n            arg_13 = arg_0.__dict__[arg_12]\n            if arg_13.__doc__:\n                arg_14, arg_15 = doc2md(arg_13.__doc__, \"`\" + arg_12 + \"`\",\n                        min_level=arg_9+2, more_info=True, arg_3=False)\n                arg_11 += arg_15\n                arg_10 += arg_14\n\n    arg_8 += arg_11\n\n    # headline\n    arg_16 = next((i for i, l in enumerate(arg_7) if is_heading(l)), 0)\n    arg_14 = [\n        make_heading(arg_9, arg_1),\n        \"\",\n    ] + arg_7[:arg_16]\n\n    # main sections\n    if arg_3:\n        arg_14 += make_toc(arg_8, arg_4)\n        arg_14 += ['']\n    arg_14 += _doc2md(arg_7[arg_16:])\n\n    # API section\n    arg_14 += [\n        '',\n        '',\n        make_heading(arg_9+1, arg_2),\n    ]\n    if arg_3:\n        arg_14 += ['']\n        arg_14 += make_toc(arg_11, 1)\n    arg_14 += arg_10\n\n    return \"\\n\".join(arg_14)", "path": "doc2md.py", "identifier": "mod2md", "docstring": "Generate markdown document from module, including API section.", "docstring_tokens": ["Generate", "markdown", "document", "from", "module", "including", "API", "section", "."], "nwo": "coldfix/doc2md", "score": 0.5672608523629893, "idx": 253731}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L155-L214", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Returns a batch of example images and the corresponding labels", "language": "python", "parameters": "(dataset='imagenet', index=0, batchsize=1, shape=(224, 224),\n            data_format='channels_last')", "return_statement": "return images, labels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'imagenet'", ",", "arg_1", "=", "0", ",", "arg_2", "=", "1", ",", "arg_3", "=", "(", "224", ",", "224", ")", ",", "arg_4", "=", "'channels_last'", ")", ":", "from", "PIL", "import", "Image", "arg_5", ",", "arg_6", "=", "[", "]", ",", "[", "]", "arg_7", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_7", ",", "'data'", ")", "arg_9", "=", "os", ".", "listdir", "(", "arg_8", ")", "for", "arg_10", "in", "range", "(", "arg_1", ",", "arg_1", "+", "arg_2", ")", ":", "arg_11", "=", "arg_10", "%", "20", "arg_12", "=", "[", "n", "for", "n", "in", "arg_9", "if", "'{}_{:02d}_'", ".", "format", "(", "arg_0", ",", "arg_11", ")", "in", "n", "]", "[", "0", "]", "arg_13", "=", "int", "(", "arg_12", ".", "split", "(", "'.'", ")", "[", "0", "]", ".", "split", "(", "'_'", ")", "[", "-", "1", "]", ")", "arg_14", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "arg_12", ")", "arg_15", "=", "Image", ".", "open", "(", "arg_14", ")", "if", "arg_0", "==", "'imagenet'", ":", "arg_15", "=", "arg_15", ".", "resize", "(", "arg_3", ")", "arg_15", "=", "np", ".", "asarray", "(", "arg_15", ",", "dtype", "=", "np", ".", "float32", ")", "if", "arg_0", "!=", "'mnist'", "and", "arg_4", "==", "'channels_first'", ":", "arg_15", "=", "np", ".", "transpose", "(", "arg_15", ",", "(", "2", ",", "0", ",", "1", ")", ")", "arg_5", ".", "append", "(", "arg_15", ")", "arg_6", ".", "append", "(", "arg_13", ")", "arg_6", "=", "np", ".", "array", "(", "arg_6", ")", "arg_5", "=", "np", ".", "stack", "(", "arg_5", ")", "return", "arg_5", ",", "arg_6"], "function": "def Func(arg_0='imagenet', arg_1=0, arg_2=1, arg_3=(224, 224),\n            arg_4='channels_last'):\n    ''' Returns a batch of example images and the corresponding labels\n\n    Parameters\n    ----------\n    dataset : string\n        The data set to load (options: imagenet, mnist, cifar10,\n        cifar100, fashionMNIST)\n    index : int\n        For each data set 20 example images exist. The returned batch\n        contains the images with index [index, index + 1, index + 2, ...]\n    batchsize : int\n        Size of batch.\n    shape : list of integers\n        The shape of the returned image (only relevant for Imagenet).\n    data_format : str\n        \"channels_first\" or \"channels_last\"\n\n    Returns\n    -------\n    images : array_like\n        The batch of example images\n\n    labels : array of int\n        The labels associated with the images.\n\n    '''\n    from PIL import Image\n\n    arg_5, arg_6 = [], []\n    arg_7 = os.path.dirname(__file__)\n    arg_8 = os.path.join(arg_7, 'data')\n    arg_9 = os.listdir(arg_8)\n\n    for arg_10 in range(arg_1, arg_1 + arg_2):\n        arg_11 = arg_10 % 20\n\n        # get filename and label\n        arg_12 = [n for n in arg_9 if '{}_{:02d}_'.format(arg_0, arg_11) in n][0]\n        arg_13 = int(arg_12.split('.')[0].split('_')[-1])\n\n        # open file\n        arg_14 = os.path.join(arg_8, arg_12)\n        arg_15 = Image.open(arg_14)\n\n        if arg_0 == 'imagenet':\n            arg_15 = arg_15.resize(arg_3)\n\n        arg_15 = np.asarray(arg_15, dtype=np.float32)\n\n        if arg_0 != 'mnist' and arg_4 == 'channels_first':\n            arg_15 = np.transpose(arg_15, (2, 0, 1))\n\n        arg_5.append(arg_15)\n        arg_6.append(arg_13)\n\n    arg_6 = np.array(arg_6)\n    arg_5 = np.stack(arg_5)\n    return arg_5, arg_6", "path": "foolbox/utils.py", "identifier": "samples", "docstring": "Returns a batch of example images and the corresponding labels\n\n    Parameters\n    ----------\n    dataset : string\n        The data set to load (options: imagenet, mnist, cifar10,\n        cifar100, fashionMNIST)\n    index : int\n        For each data set 20 example images exist. The returned batch\n        contains the images with index [index, index + 1, index + 2, ...]\n    batchsize : int\n        Size of batch.\n    shape : list of integers\n        The shape of the returned image (only relevant for Imagenet).\n    data_format : str\n        \"channels_first\" or \"channels_last\"\n\n    Returns\n    -------\n    images : array_like\n        The batch of example images\n\n    labels : array of int\n        The labels associated with the images.", "docstring_tokens": ["Returns", "a", "batch", "of", "example", "images", "and", "the", "corresponding", "labels"], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 253732}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/stats.py#L64-L77", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns an array of length size and type dtype that is everywhere 0,\n  except in the index in pos.", "language": "python", "parameters": "(pos, size, dtype)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "numpy", ".", "zeros", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_3", "[", "arg_0", "]", "=", "1", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"\n  Returns an array of length size and type dtype that is everywhere 0,\n  except in the index in pos.\n\n  :param pos: (int) specifies the position of the one entry that will be set.\n  :param size: (int) The total size of the array to be returned.\n  :param dtype: The element type (compatible with NumPy array())\n         of the array to be returned.\n  :returns: (list) of length ``size`` and element type ``dtype``.\n  \"\"\"\n  arg_3 = numpy.zeros(arg_1, arg_2=arg_2)\n  arg_3[arg_0] = 1\n  return arg_3", "path": "src/nupic/math/stats.py", "identifier": "Indicator", "docstring": "Returns an array of length size and type dtype that is everywhere 0,\n  except in the index in pos.\n\n  :param pos: (int) specifies the position of the one entry that will be set.\n  :param size: (int) The total size of the array to be returned.\n  :param dtype: The element type (compatible with NumPy array())\n         of the array to be returned.\n  :returns: (list) of length ``size`` and element type ``dtype``.", "docstring_tokens": ["Returns", "an", "array", "of", "length", "size", "and", "type", "dtype", "that", "is", "everywhere", "0", "except", "in", "the", "index", "in", "pos", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253733}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/manager/manager.py#L577-L581", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "When a model gets deleted.", "language": "python", "parameters": "(sender, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'instance'", "]", "signals", ".", "delete", ".", "send", "(", "arg_0", ",", "pk", "=", "arg_2", ".", "pk", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"When a model gets deleted.\"\"\"\n\n        arg_2 = arg_1['instance']\n        signals.delete.send(arg_0, pk=arg_2.pk)", "path": "psqlextra/manager/manager.py", "identifier": "PostgresManager._on_model_delete", "docstring": "When a model gets deleted.", "docstring_tokens": ["When", "a", "model", "gets", "deleted", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 253734}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/optim/optimizer.py#L848-L894", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Create an optimizer.\n        Depend on the input type, the returning optimizer can be a local optimizer \\\n        or a distributed optimizer.", "language": "python", "parameters": "(model,\n               training_set,\n               criterion,\n               end_trigger=None,\n               batch_size=32,\n               optim_method=None,\n               cores=None,\n               bigdl_type=\"float\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "32", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "\"float\"", ")", ":", "if", "not", "arg_3", ":", "arg_3", "=", "MaxEpoch", "(", "1", ")", "if", "not", "arg_5", ":", "arg_5", "=", "SGD", "(", ")", "if", "isinstance", "(", "arg_1", ",", "RDD", ")", "or", "isinstance", "(", "arg_1", ",", "DataSet", ")", ":", "return", "DistriOptimizer", "(", "arg_0", "=", "arg_0", ",", "training_rdd", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ")", "elif", "isinstance", "(", "arg_1", ",", "tuple", ")", "and", "len", "(", "arg_1", ")", "==", "2", ":", "arg_8", ",", "arg_9", "=", "arg_1", "return", "LocalOptimizer", "(", "X", "=", "arg_8", ",", "Y", "=", "arg_9", ",", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "\"float\"", ")", "else", ":", "raise", "Exception", "(", "\"Not supported training set: %s\"", "%", "type", "(", "arg_1", ")", ")"], "function": "def Func(arg_0,\n               arg_1,\n               arg_2,\n               arg_3=None,\n               arg_4=32,\n               arg_5=None,\n               arg_6=None,\n               arg_7=\"float\"):\n        \"\"\"\n        Create an optimizer.\n        Depend on the input type, the returning optimizer can be a local optimizer \\\n        or a distributed optimizer.\n\n        :param model: the neural net model\n        :param training_set: (features, label) for local mode. RDD[Sample] for distributed mode.\n        :param criterion: the loss function\n        :param optim_method: the algorithm to use for optimization,\n           e.g. SGD, Adagrad, etc. If optim_method is None, the default algorithm is SGD.\n        :param end_trigger: when to end the optimization. default value is MapEpoch(1)\n        :param batch_size: training batch size\n        :param cores: This is for local optimizer only and use total physical cores as the default value\n        \"\"\"\n        if not arg_3:\n            arg_3 = MaxEpoch(1)\n        if not arg_5:\n            arg_5 = SGD()\n        if isinstance(arg_1, RDD) or isinstance(arg_1, DataSet):\n            return DistriOptimizer(arg_0=arg_0,\n                                   training_rdd=arg_1,\n                                   arg_2=arg_2,\n                                   arg_3=arg_3,\n                                   arg_4=arg_4,\n                                   arg_5=arg_5,\n                                   arg_7=arg_7)\n        elif isinstance(arg_1, tuple) and len(arg_1) == 2:\n            arg_8, arg_9 = arg_1\n            return LocalOptimizer(X=arg_8,\n                                  Y=arg_9,\n                                  arg_0=arg_0,\n                                  arg_2=arg_2,\n                                  arg_3=arg_3,\n                                  arg_4=arg_4,\n                                  arg_5=arg_5,\n                                  arg_6=arg_6,\n                                  arg_7=\"float\")\n        else:\n            raise Exception(\"Not supported training set: %s\" % type(arg_1))", "path": "pyspark/bigdl/optim/optimizer.py", "identifier": "Optimizer.create", "docstring": "Create an optimizer.\n        Depend on the input type, the returning optimizer can be a local optimizer \\\n        or a distributed optimizer.\n\n        :param model: the neural net model\n        :param training_set: (features, label) for local mode. RDD[Sample] for distributed mode.\n        :param criterion: the loss function\n        :param optim_method: the algorithm to use for optimization,\n           e.g. SGD, Adagrad, etc. If optim_method is None, the default algorithm is SGD.\n        :param end_trigger: when to end the optimization. default value is MapEpoch(1)\n        :param batch_size: training batch size\n        :param cores: This is for local optimizer only and use total physical cores as the default value", "docstring_tokens": ["Create", "an", "optimizer", ".", "Depend", "on", "the", "input", "type", "the", "returning", "optimizer", "can", "be", "a", "local", "optimizer", "\\", "or", "a", "distributed", "optimizer", "."], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 253735}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/lens_fit.py#L26-L49", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Fit lens data with a model tracer, automatically determining the type of fit based on the \\\n        properties of the galaxies in the tracer.", "language": "python", "parameters": "(cls, lens_data, tracer, padded_tracer=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", ".", "has_light_profile", "and", "not", "arg_2", ".", "has_pixelization", ":", "return", "LensProfileFit", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "elif", "not", "arg_2", ".", "has_light_profile", "and", "arg_2", ".", "has_pixelization", ":", "return", "LensInversionFit", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "None", ")", "elif", "arg_2", ".", "has_light_profile", "and", "arg_2", ".", "has_pixelization", ":", "return", "LensProfileInversionFit", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "None", ")", "else", ":", "raise", "exc", ".", "FittingException", "(", "'The fit routine did not call a Fit class - check the '", "'properties of the tracer'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Fit lens data with a model tracer, automatically determining the type of fit based on the \\\n        properties of the galaxies in the tracer.\n\n        Parameters\n        -----------\n        lens_data : lens_data.LensData or lens_data.LensDataHyper\n            The lens-images that is fitted.\n        tracer : ray_tracing.TracerNonStack\n            The tracer, which describes the ray-tracing and strong lens configuration.\n        padded_tracer : ray_tracing.Tracer or None\n            A tracer with an identical strong lens configuration to the tracer above, but using the lens data's \\\n            padded grid_stack such that unmasked model-images can be computed.\n        \"\"\"\n\n        if arg_2.has_light_profile and not arg_2.has_pixelization:\n            return LensProfileFit(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)\n        elif not arg_2.has_light_profile and arg_2.has_pixelization:\n            return LensInversionFit(arg_1=arg_1, arg_2=arg_2, arg_3=None)\n        elif arg_2.has_light_profile and arg_2.has_pixelization:\n            return LensProfileInversionFit(arg_1=arg_1, arg_2=arg_2, arg_3=None)\n        else:\n            raise exc.FittingException('The fit routine did not call a Fit class - check the '\n                                       'properties of the tracer')", "path": "autolens/lens/lens_fit.py", "identifier": "LensDataFit.for_data_and_tracer", "docstring": "Fit lens data with a model tracer, automatically determining the type of fit based on the \\\n        properties of the galaxies in the tracer.\n\n        Parameters\n        -----------\n        lens_data : lens_data.LensData or lens_data.LensDataHyper\n            The lens-images that is fitted.\n        tracer : ray_tracing.TracerNonStack\n            The tracer, which describes the ray-tracing and strong lens configuration.\n        padded_tracer : ray_tracing.Tracer or None\n            A tracer with an identical strong lens configuration to the tracer above, but using the lens data's \\\n            padded grid_stack such that unmasked model-images can be computed.", "docstring_tokens": ["Fit", "lens", "data", "with", "a", "model", "tracer", "automatically", "determining", "the", "type", "of", "fit", "based", "on", "the", "\\", "properties", "of", "the", "galaxies", "in", "the", "tracer", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 253736}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L343-L361", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Punctuate author names properly.", "language": "python", "parameters": "(an)", "return_statement": "return ret_str.strip()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "strip", "(", ")", "arg_2", "=", "[", "x", "for", "x", "in", "arg_1", ".", "split", "(", "','", ")", "if", "x", "!=", "''", "]", "arg_3", "=", "''", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_2", ")", ":", "arg_6", "=", "arg_5", ".", "strip", "(", ")", ".", "split", "(", "' '", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_6", ")", ":", "arg_3", "+=", "arg_8", "if", "len", "(", "arg_8", ")", "==", "1", ":", "arg_3", "+=", "'.'", "if", "arg_7", "<", "(", "len", "(", "arg_6", ")", "-", "1", ")", ":", "arg_3", "+=", "' '", "if", "arg_4", "<", "(", "len", "(", "arg_2", ")", "-", "1", ")", ":", "arg_3", "+=", "', '", "return", "arg_3", ".", "strip", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Punctuate author names properly.\n\n    Expects input in the form 'Bloggs, J K' and will return 'Bloggs, J. K.'.\n    \"\"\"\n    arg_1 = arg_0.strip()\n    arg_2 = [x for x in arg_1.split(',') if x != '']\n    arg_3 = ''\n    for arg_4, arg_5 in enumerate(arg_2):\n        arg_6 = arg_5.strip().split(' ')\n        for arg_7, arg_8 in enumerate(arg_6):\n            arg_3 += arg_8\n            if len(arg_8) == 1:\n                arg_3 += '.'\n            if arg_7 < (len(arg_6) - 1):\n                arg_3 += ' '\n        if arg_4 < (len(arg_2) - 1):\n            arg_3 += ', '\n    return arg_3.strip()", "path": "harvestingkit/utils.py", "identifier": "punctuate_authorname", "docstring": "Punctuate author names properly.\n\n    Expects input in the form 'Bloggs, J K' and will return 'Bloggs, J. K.'.", "docstring_tokens": ["Punctuate", "author", "names", "properly", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253737}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/error_summary.py#L67-L76", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get the names from a namespace that wasn't actually defined.", "language": "python", "parameters": "(graph: BELGraph, namespace: str)", "return_statement": "return {\n        exc.name\n        for _, exc, _ in graph.warnings\n        if isinstance(exc, UndefinedNamespaceWarning) and exc.namespace == namespace\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "Set", "[", "arg_3", "]", ":", "return", "{", "arg_5", ".", "name", "for", "arg_4", ",", "arg_5", ",", "arg_4", "in", "arg_0", ".", "warnings", "if", "isinstance", "(", "arg_5", ",", "UndefinedNamespaceWarning", ")", "and", "arg_5", ".", "namespace", "==", "arg_2", "}"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> Set[arg_3]:\n    \"\"\"Get the names from a namespace that wasn't actually defined.\n\n    :return: The set of all names from the undefined namespace\n    \"\"\"\n    return {\n        arg_5.name\n        for arg_4, arg_5, arg_4 in arg_0.warnings\n        if isinstance(arg_5, UndefinedNamespaceWarning) and arg_5.namespace == arg_2\n    }", "path": "src/pybel_tools/summary/error_summary.py", "identifier": "get_undefined_namespace_names", "docstring": "Get the names from a namespace that wasn't actually defined.\n\n    :return: The set of all names from the undefined namespace", "docstring_tokens": ["Get", "the", "names", "from", "a", "namespace", "that", "wasn", "t", "actually", "defined", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253738}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L456-L478", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Handle replies for call tips.", "language": "python", "parameters": "(self, rep)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"oinfo: %s\"", ",", "arg_1", ".", "get", "(", "'content'", ",", "''", ")", ")", "arg_2", "=", "arg_0", ".", "_get_cursor", "(", ")", "arg_3", "=", "arg_0", ".", "_request_info", ".", "get", "(", "'call_tip'", ")", "if", "arg_3", "and", "arg_3", ".", "id", "==", "arg_1", "[", "'parent_header'", "]", "[", "'msg_id'", "]", "and", "arg_3", ".", "pos", "==", "arg_2", ".", "position", "(", ")", ":", "arg_4", "=", "arg_1", "[", "'content'", "]", "if", "arg_4", ".", "get", "(", "'ismagic'", ",", "False", ")", ":", "arg_5", ",", "arg_6", "=", "None", ",", "None", "else", ":", "arg_5", ",", "arg_6", "=", "call_tip", "(", "arg_4", ",", "format_call", "=", "True", ")", "if", "arg_5", "or", "arg_6", ":", "arg_0", ".", "_call_tip_widget", ".", "show_call_info", "(", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handle replies for call tips.\n        \"\"\"\n        arg_0.log.debug(\"oinfo: %s\", arg_1.get('content', ''))\n        arg_2 = arg_0._get_cursor()\n        arg_3 = arg_0._request_info.get('call_tip')\n        if arg_3 and arg_3.id == arg_1['parent_header']['msg_id'] and \\\n                arg_3.pos == arg_2.position():\n            # Get the information for a call tip.  For now we format the call\n            # line as string, later we can pass False to format_call and\n            # syntax-highlight it ourselves for nicer formatting in the\n            # calltip.\n            arg_4 = arg_1['content']\n            # if this is from pykernel, 'docstring' will be the only key\n            if arg_4.get('ismagic', False):\n                # Don't generate a call-tip for magics. Ideally, we should\n                # generate a tooltip, but not on ( like we do for actual\n                # callables.\n                arg_5, arg_6 = None, None\n            else:\n                arg_5, arg_6 = call_tip(arg_4, format_call=True)\n            if arg_5 or arg_6:\n                arg_0._call_tip_widget.show_call_info(arg_5, arg_6)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._handle_object_info_reply", "docstring": "Handle replies for call tips.", "docstring_tokens": ["Handle", "replies", "for", "call", "tips", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253739}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L452-L462", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Create a platform without an ELF loaded.", "language": "python", "parameters": "(cls, arch)", "return_statement": "return platform", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "(", "None", ")", "arg_2", ".", "_init_cpu", "(", "arg_1", ")", "arg_2", ".", "_init_std_fds", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a platform without an ELF loaded.\n\n        :param str arch: The architecture of the new platform\n        :rtype: Linux\n        \"\"\"\n        arg_2 = arg_0(None)\n        arg_2._init_cpu(arg_1)\n        arg_2._init_std_fds()\n        return arg_2", "path": "manticore/platforms/linux.py", "identifier": "Linux.empty_platform", "docstring": "Create a platform without an ELF loaded.\n\n        :param str arch: The architecture of the new platform\n        :rtype: Linux", "docstring_tokens": ["Create", "a", "platform", "without", "an", "ELF", "loaded", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253740}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/plot.py#L89-L102", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Adds a histogram to the plot's figure.", "language": "python", "parameters": "(self, data, position=111, xlabel=None, ylabel=None,\n                   bins=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "111", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_0", ".", "_addBase", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_6", ".", "hist", "(", "arg_1", ",", "arg_5", "=", "arg_5", ",", "color", "=", "\"green\"", ",", "alpha", "=", "0.8", ")", "plt", ".", "draw", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=111, arg_3=None, arg_4=None,\n                   arg_5=None):\n    \"\"\" Adds a histogram to the plot's figure.\n\n    @param data See matplotlib.Axes.hist documentation.\n    @param position A 3-digit number. The first two digits define a 2D grid\n            where subplots may be added. The final digit specifies the nth grid\n            location for the added subplot\n    @param xlabel text to be displayed on the x-axis\n    @param ylabel text to be displayed on the y-axis\n    \"\"\"\n    arg_6 = arg_0._addBase(arg_2, arg_3=arg_3, arg_4=arg_4)\n    arg_6.hist(arg_1, arg_5=arg_5, color=\"green\", alpha=0.8)\n    plt.draw()", "path": "src/nupic/algorithms/monitor_mixin/plot.py", "identifier": "Plot.addHistogram", "docstring": "Adds a histogram to the plot's figure.\n\n    @param data See matplotlib.Axes.hist documentation.\n    @param position A 3-digit number. The first two digits define a 2D grid\n            where subplots may be added. The final digit specifies the nth grid\n            location for the added subplot\n    @param xlabel text to be displayed on the x-axis\n    @param ylabel text to be displayed on the y-axis", "docstring_tokens": ["Adds", "a", "histogram", "to", "the", "plot", "s", "figure", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253741}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L910-L917", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a function which is the partial application of f with args.", "language": "python", "parameters": "(f, *args)", "return_statement": "return partial_f", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "Func_f", "(", "*", "arg_2", ")", ":", "return", "arg_0", "(", "*", "itertools", ".", "chain", "(", "arg_1", ",", "arg_2", ")", ")", "return", "Func_f"], "function": "def Func(arg_0, *arg_1):\n    \"\"\"Return a function which is the Func application of f with args.\"\"\"\n\n    @functools.wraps(arg_0)\n    def Func_f(*arg_2):\n        return arg_0(*itertools.chain(arg_1, arg_2))\n\n    return Func_f", "path": "src/basilisp/lang/runtime.py", "identifier": "partial", "docstring": "Return a function which is the partial application of f with args.", "docstring_tokens": ["Return", "a", "function", "which", "is", "the", "partial", "application", "of", "f", "with", "args", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 253742}
{"url": "https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L222-L225", "sha": "bb1990cf1460ae42f2dde75f2291625ddac2c0e4", "docstring_summary": "Check if the device is on.", "language": "python", "parameters": "(self)", "return_statement": "return bool(power)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "yield", "from", "arg_0", ".", "handle_int", "(", "arg_0", ".", "API", ".", "get", "(", "'power'", ")", ")", ")", "return", "bool", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Check if the device is on.\"\"\"\n        arg_1 = (yield from arg_0.handle_int(arg_0.API.get('power')))\n        return bool(arg_1)", "path": "afsapi/__init__.py", "identifier": "AFSAPI.get_power", "docstring": "Check if the device is on.", "docstring_tokens": ["Check", "if", "the", "device", "is", "on", "."], "nwo": "zhelev/python-afsapi", "score": 0.16638194949711382, "idx": 253743}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1430-L1437", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Given a QTextBlock, return its unformatted text.", "language": "python", "parameters": "(self, block)", "return_statement": "return cursor.selection().toPlainText()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "QtGui", ".", "QTextCursor", "(", "arg_1", ")", "arg_2", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "StartOfBlock", ")", "arg_2", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "EndOfBlock", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "return", "arg_2", ".", "selection", "(", ")", ".", "toPlainText", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Given a QTextBlock, return its unformatted text.\n        \"\"\"\n        arg_2 = QtGui.QTextCursor(arg_1)\n        arg_2.movePosition(QtGui.QTextCursor.StartOfBlock)\n        arg_2.movePosition(QtGui.QTextCursor.EndOfBlock,\n                            QtGui.QTextCursor.KeepAnchor)\n        return arg_2.selection().toPlainText()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._get_block_plain_text", "docstring": "Given a QTextBlock, return its unformatted text.", "docstring_tokens": ["Given", "a", "QTextBlock", "return", "its", "unformatted", "text", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253744}
{"url": "https://github.com/fizzbucket/latexfixer/blob/1b127e866fbca9764e638fb05fdd43da9dd1a97b/latexfixer/fix.py#L75-L77", "sha": "1b127e866fbca9764e638fb05fdd43da9dd1a97b", "docstring_summary": "Replace target with replacement", "language": "python", "parameters": "(self, target, replacement)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "data", "=", "arg_0", ".", "data", ".", "replace", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n      \"\"\"Replace target with replacement\"\"\"\n      arg_0.data = arg_0.data.replace(arg_1, arg_2)", "path": "latexfixer/fix.py", "identifier": "LatexFixer._str_replacement", "docstring": "Replace target with replacement", "docstring_tokens": ["Replace", "target", "with", "replacement"], "nwo": "fizzbucket/latexfixer", "score": 0.09252797783733271, "idx": 253745}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_natural_language_hook.py#L163-L195", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "A convenience method that provides all the features that analyzeSentiment,\n        analyzeEntities, and analyzeSyntax provide in one call.", "language": "python", "parameters": "(self, document, features, encoding_type=None, retry=None, timeout=None, metadata=None)", "return_statement": "return client.annotate_text(\n            document=document,\n            features=features,\n            encoding_type=encoding_type,\n            retry=retry,\n            timeout=timeout,\n            metadata=metadata,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "arg_0", ".", "get_conn", "(", ")", "return", "arg_7", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=None):\n        \"\"\"\n        A convenience method that provides all the features that analyzeSentiment,\n        analyzeEntities, and analyzeSyntax provide in one call.\n\n        :param document: Input document.\n            If a dict is provided, it must be of the same form as the protobuf message Document\n        :type document: dict or google.cloud.language_v1.types.Document\n        :param features: The enabled features.\n            If a dict is provided, it must be of the same form as the protobuf message Features\n        :type features: dict or google.cloud.language_v1.enums.Features\n        :param encoding_type: The encoding type used by the API to calculate offsets.\n        :type encoding_type: google.cloud.language_v1.types.EncodingType\n        :param retry: A retry object used to retry requests. If None is specified, requests will not be\n            retried.\n        :type retry: google.api_core.retry.Retry\n        :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if\n            retry is specified, the timeout applies to each individual attempt.\n        :type timeout: float\n        :param metadata: Additional metadata that is provided to the method.\n        :type metadata: sequence[tuple[str, str]]]\n        :rtype: google.cloud.language_v1.types.AnnotateTextResponse\n        \"\"\"\n        arg_7 = arg_0.get_conn()\n\n        return arg_7.Func(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_6=arg_6,\n        )", "path": "airflow/contrib/hooks/gcp_natural_language_hook.py", "identifier": "CloudNaturalLanguageHook.annotate_text", "docstring": "A convenience method that provides all the features that analyzeSentiment,\n        analyzeEntities, and analyzeSyntax provide in one call.\n\n        :param document: Input document.\n            If a dict is provided, it must be of the same form as the protobuf message Document\n        :type document: dict or google.cloud.language_v1.types.Document\n        :param features: The enabled features.\n            If a dict is provided, it must be of the same form as the protobuf message Features\n        :type features: dict or google.cloud.language_v1.enums.Features\n        :param encoding_type: The encoding type used by the API to calculate offsets.\n        :type encoding_type: google.cloud.language_v1.types.EncodingType\n        :param retry: A retry object used to retry requests. If None is specified, requests will not be\n            retried.\n        :type retry: google.api_core.retry.Retry\n        :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if\n            retry is specified, the timeout applies to each individual attempt.\n        :type timeout: float\n        :param metadata: Additional metadata that is provided to the method.\n        :type metadata: sequence[tuple[str, str]]]\n        :rtype: google.cloud.language_v1.types.AnnotateTextResponse", "docstring_tokens": ["A", "convenience", "method", "that", "provides", "all", "the", "features", "that", "analyzeSentiment", "analyzeEntities", "and", "analyzeSyntax", "provide", "in", "one", "call", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253746}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L981-L1000", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Move subfield at specified position.", "language": "python", "parameters": "(rec, tag, subfield_position, new_subfield_position,\n                         field_position_global=None,\n                         field_position_local=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "record_get_subfields", "(", "arg_0", ",", "arg_1", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "try", ":", "arg_7", "=", "arg_6", ".", "pop", "(", "arg_2", ")", "arg_6", ".", "insert", "(", "arg_3", ",", "arg_7", ")", "except", "IndexError", ":", "raise", "InvenioBibRecordFieldError", "(", "\"There is no subfield with position '%d'.\"", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                         arg_4=None,\n                         arg_5=None):\n    \"\"\"Move subfield at specified position.\n\n    Sspecify the subfield by tag, field number and subfield position to new\n    subfield position.\n    \"\"\"\n    arg_6 = record_get_subfields(\n        arg_0,\n        arg_1,\n        arg_4=arg_4,\n        arg_5=arg_5)\n\n    try:\n        arg_7 = arg_6.pop(arg_2)\n        arg_6.insert(arg_3, arg_7)\n    except IndexError:\n        raise InvenioBibRecordFieldError(\n            \"There is no subfield with position '%d'.\" % arg_2)", "path": "harvestingkit/bibrecord.py", "identifier": "record_move_subfield", "docstring": "Move subfield at specified position.\n\n    Sspecify the subfield by tag, field number and subfield position to new\n    subfield position.", "docstring_tokens": ["Move", "subfield", "at", "specified", "position", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253747}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/examples/text_generation/tutorial_generate_text.py#L132-L182", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "How to use Embedding layer, and how to convert IDs to vector,\n    IDs to words, etc.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "50000", "arg_1", "=", "128", "arg_2", "=", "\"model_word2vec_50k_128\"", "arg_3", "=", "None", "print", "(", "\"Load existing embedding matrix and dictionaries\"", ")", "arg_4", "=", "tl", ".", "files", ".", "load_npy_to_any", "(", "name", "=", "arg_2", "+", "'.npy'", ")", "arg_5", "=", "arg_4", "[", "'data'", "]", "arg_6", "=", "arg_4", "[", "'count'", "]", "arg_7", "=", "arg_4", "[", "'dictionary'", "]", "arg_8", "=", "arg_4", "[", "'reverse_dictionary'", "]", "tl", ".", "nlp", ".", "save_vocab", "(", "arg_6", ",", "name", "=", "'vocab_'", "+", "arg_2", "+", "'.txt'", ")", "del", "arg_4", ",", "arg_5", ",", "arg_6", "arg_9", "=", "tl", ".", "files", ".", "load_npz", "(", "name", "=", "arg_2", "+", "'.npz'", ")", "arg_10", "=", "tf", ".", "placeholder", "(", "tf", ".", "int32", ",", "shape", "=", "[", "arg_3", "]", ")", "arg_11", "=", "tl", ".", "layers", ".", "EmbeddingInputlayer", "(", "arg_10", ",", "arg_0", ",", "arg_1", ",", "name", "=", "'emb'", ")", "sess", ".", "run", "(", "tf", ".", "global_variables_initializer", "(", ")", ")", "tl", ".", "files", ".", "assign_params", "(", "sess", ",", "[", "arg_9", "[", "0", "]", "]", ",", "arg_11", ")", "arg_11", ".", "print_params", "(", ")", "arg_11", ".", "print_layers", "(", ")", "arg_12", "=", "b'hello'", "arg_13", "=", "arg_7", "[", "arg_12", "]", "print", "(", "'word_id:'", ",", "arg_13", ")", "arg_14", "=", "[", "b'i'", ",", "b'am'", ",", "b'tensor'", ",", "b'layer'", "]", "arg_15", "=", "tl", ".", "nlp", ".", "words_to_word_ids", "(", "arg_14", ",", "arg_7", ",", "_UNK", ")", "arg_16", "=", "tl", ".", "nlp", ".", "word_ids_to_words", "(", "arg_15", ",", "arg_8", ")", "print", "(", "'word_ids:'", ",", "arg_15", ")", "print", "(", "'context:'", ",", "arg_16", ")", "arg_17", "=", "sess", ".", "run", "(", "arg_11", ".", "outputs", ",", "feed_dict", "=", "{", "arg_10", ":", "[", "arg_13", "]", "}", ")", "print", "(", "'vector:'", ",", "arg_17", ".", "shape", ")", "arg_18", "=", "sess", ".", "run", "(", "arg_11", ".", "outputs", ",", "feed_dict", "=", "{", "arg_10", ":", "arg_15", "}", ")", "print", "(", "'vectors:'", ",", "arg_18", ".", "shape", ")"], "function": "def Func():\n    \"\"\"How to use Embedding layer, and how to convert IDs to vector,\n    IDs to words, etc.\n    \"\"\"\n    # Step 1: Build the embedding matrix and load the existing embedding matrix.\n    arg_0 = 50000\n    arg_1 = 128\n    arg_2 = \"model_word2vec_50k_128\"\n    arg_3 = None\n\n    print(\"Load existing embedding matrix and dictionaries\")\n    arg_4 = tl.files.load_npy_to_any(name=arg_2 + '.npy')\n    arg_5 = arg_4['data']\n    arg_6 = arg_4['count']\n    arg_7 = arg_4['dictionary']\n    arg_8 = arg_4['reverse_dictionary']\n\n    tl.nlp.save_vocab(arg_6, name='vocab_' + arg_2 + '.txt')\n\n    del arg_4, arg_5, arg_6\n\n    arg_9 = tl.files.load_npz(name=arg_2 + '.npz')\n\n    arg_10 = tf.placeholder(tf.int32, shape=[arg_3])\n\n    arg_11 = tl.layers.EmbeddingInputlayer(arg_10, arg_0, arg_1, name='emb')\n\n    # sess.run(tf.global_variables_initializer())\n    sess.run(tf.global_variables_initializer())\n\n    tl.files.assign_params(sess, [arg_9[0]], arg_11)\n\n    arg_11.print_params()\n    arg_11.print_layers()\n\n    # Step 2: Input word(s), output the word vector(s).\n    arg_12 = b'hello'\n    arg_13 = arg_7[arg_12]\n    print('word_id:', arg_13)\n\n    arg_14 = [b'i', b'am', b'tensor', b'layer']\n    arg_15 = tl.nlp.words_to_word_ids(arg_14, arg_7, _UNK)\n    arg_16 = tl.nlp.word_ids_to_words(arg_15, arg_8)\n    print('word_ids:', arg_15)\n    print('context:', arg_16)\n\n    arg_17 = sess.run(arg_11.outputs, feed_dict={arg_10: [arg_13]})\n    print('vector:', arg_17.shape)\n\n    arg_18 = sess.run(arg_11.outputs, feed_dict={arg_10: arg_15})\n    print('vectors:', arg_18.shape)", "path": "examples/text_generation/tutorial_generate_text.py", "identifier": "main_restore_embedding_layer", "docstring": "How to use Embedding layer, and how to convert IDs to vector,\n    IDs to words, etc.", "docstring_tokens": ["How", "to", "use", "Embedding", "layer", "and", "how", "to", "convert", "IDs", "to", "vector", "IDs", "to", "words", "etc", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253748}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L408-L463", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "much faster implementation for aligning chunks", "language": "python", "parameters": "(handle, max_internal_indels=5, is_gbs=False)", "return_statement": "return highindels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ",", "arg_2", "=", "False", ")", ":", "try", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "infile", ":", "arg_3", "=", "infile", ".", "read", "(", ")", ".", "split", "(", "\"//\\n//\\n\"", ")", "arg_3", "=", "[", "i", "for", "i", "in", "arg_3", "if", "i", "]", "if", "not", "arg_3", ":", "raise", "IPyradError", "except", "(", "IOError", ",", "IPyradError", ")", ":", "LOGGER", ".", "debug", "(", "\"skipping empty chunk - {}\"", ".", "format", "(", "arg_0", ")", ")", "return", "0", "arg_4", "=", "0", "try", ":", "arg_5", "=", "persistent_popen_align3", "(", "arg_3", ",", "200", ",", "arg_2", ")", "except", "Exception", "as", "inst", ":", "LOGGER", ".", "debug", "(", "\"Error in handle - {} - {}\"", ".", "format", "(", "arg_0", ",", "inst", ")", ")", "arg_5", "=", "[", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_5", ":", "arg_8", "=", "aligned_indel_filter", "(", "arg_7", ",", "arg_1", ")", "if", "not", "arg_8", ":", "arg_6", ".", "append", "(", "arg_7", ")", "else", ":", "arg_4", "+=", "1", "if", "arg_6", ":", "arg_9", "=", "arg_0", ".", "rsplit", "(", "\".\"", ",", "1", ")", "[", "0", "]", "+", "\".aligned\"", "with", "open", "(", "arg_9", ",", "'wb'", ")", "as", "outfile", ":", "outfile", ".", "write", "(", "\"\\n//\\n//\\n\"", ".", "join", "(", "arg_6", ")", "+", "\"\\n\"", ")", "arg_10", "=", "logging", ".", "getLevelName", "(", "LOGGER", ".", "getEffectiveLevel", "(", ")", ")", "if", "not", "arg_10", "==", "\"DEBUG\"", ":", "os", ".", "remove", "(", "arg_0", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=5, arg_2=False):\n    \"\"\" much faster implementation for aligning chunks \"\"\"\n\n    ## data are already chunked, read in the whole thing. bail if no data.\n    try:\n        with open(arg_0, 'rb') as infile:\n            arg_3 = infile.read().split(\"//\\n//\\n\")\n            ## remove any empty spots\n            arg_3 = [i for i in arg_3 if i]\n            ## Skip entirely empty chunks\n            if not arg_3:\n                raise IPyradError\n    except (IOError, IPyradError):\n        LOGGER.debug(\"skipping empty chunk - {}\".format(arg_0))\n        return 0\n\n    ## count discarded clusters for printing to stats later\n    arg_4 = 0\n\n    ## iterate over clusters sending each to muscle, splits and aligns pairs\n    try:\n        arg_5 = persistent_popen_align3(arg_3, 200, arg_2)\n    except Exception as inst:\n        LOGGER.debug(\"Error in handle - {} - {}\".format(arg_0, inst))\n        #raise IPyradWarningExit(\"error hrere {}\".format(inst))\n        arg_5 = []        \n\n    ## store good alignments to be written to file\n    arg_6 = []\n\n    ## filter and trim alignments\n    for arg_7 in arg_5:\n\n        ## check for too many internal indels\n        arg_8 = aligned_indel_filter(arg_7, arg_1)\n\n        ## reverse complement matches. No longer implemented.\n        #filtered = overshoot_filter(clust)\n\n        ## finally, add to outstack if alignment is good\n        if not arg_8:\n            arg_6.append(arg_7)#\"\\n\".join(stack))\n        else:\n            arg_4 += 1\n\n    ## write to file after\n    if arg_6:\n        arg_9 = arg_0.rsplit(\".\", 1)[0]+\".aligned\"\n        with open(arg_9, 'wb') as outfile:\n            outfile.write(\"\\n//\\n//\\n\".join(arg_6)+\"\\n\")\n\n    ## remove the old tmp file\n    arg_10 = logging.getLevelName(LOGGER.getEffectiveLevel())\n    if not arg_10 == \"DEBUG\":\n        os.remove(arg_0)\n    return arg_4", "path": "ipyrad/assemble/cluster_within.py", "identifier": "align_and_parse", "docstring": "much faster implementation for aligning chunks", "docstring_tokens": ["much", "faster", "implementation", "for", "aligning", "chunks"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 253749}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/gcp/gcpcache.py#L100-L116", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Get general stats for the cache.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'totals': {\n                'keys': len(self._CACHE_STATS['access_stats']),\n                'expired': expired,\n                'miss': miss,\n                'hit': hit,\n                }\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "sum", "(", "[", "x", "[", "'expired'", "]", "for", "_", ",", "x", "in", "arg_0", ".", "_CACHE_STATS", "[", "'access_stats'", "]", ".", "items", "(", ")", "]", ")", "arg_2", "=", "sum", "(", "[", "x", "[", "'miss'", "]", "for", "_", ",", "x", "in", "arg_0", ".", "_CACHE_STATS", "[", "'access_stats'", "]", ".", "items", "(", ")", "]", ")", "arg_3", "=", "sum", "(", "[", "x", "[", "'hit'", "]", "for", "_", ",", "x", "in", "arg_0", ".", "_CACHE_STATS", "[", "'access_stats'", "]", ".", "items", "(", ")", "]", ")", "return", "{", "'totals'", ":", "{", "'keys'", ":", "len", "(", "arg_0", ".", "_CACHE_STATS", "[", "'access_stats'", "]", ")", ",", "'expired'", ":", "arg_1", ",", "'miss'", ":", "arg_2", ",", "'hit'", ":", "arg_3", ",", "}", "}"], "function": "def Func(arg_0):\n        \"\"\"Get general stats for the cache.\"\"\"\n        arg_1 = sum([x['expired'] for _, x in\n                       arg_0._CACHE_STATS['access_stats'].items()])\n        arg_2 = sum([x['miss'] for _, x in\n                    arg_0._CACHE_STATS['access_stats'].items()])\n\n        arg_3 = sum([x['hit'] for _, x in\n                       arg_0._CACHE_STATS['access_stats'].items()])\n        return {\n            'totals': {\n                'keys': len(arg_0._CACHE_STATS['access_stats']),\n                'expired': arg_1,\n                'miss': arg_2,\n                'hit': arg_3,\n                }\n        }", "path": "cloudaux/gcp/gcpcache.py", "identifier": "GCPCache.get_stats", "docstring": "Get general stats for the cache.", "docstring_tokens": ["Get", "general", "stats", "for", "the", "cache", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 253750}
{"url": "https://github.com/mvexel/maproulette-api-wrapper/blob/835278111afefed2beecf9716a033529304c548f/maproulette/taskcollection.py#L60-L108", "sha": "835278111afefed2beecf9716a033529304c548f", "docstring_summary": "Reconcile this collection with the server.", "language": "python", "parameters": "(self, server)", "return_statement": "return {'same': same, 'new': new, 'changed': changed, 'deleted': deleted}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "challenge", ".", "exists", "(", "arg_1", ")", ":", "raise", "Exception", "(", "'Challenge does not exist on server'", ")", "arg_2", "=", "MapRouletteTaskCollection", ".", "from_server", "(", "arg_1", ",", "arg_0", ".", "challenge", ")", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_0", ".", "tasks", ":", "if", "arg_7", ".", "identifier", "in", "[", "arg_8", ".", "identifier", "for", "arg_8", "in", "arg_2", ".", "tasks", "]", ":", "if", "arg_7", "==", "arg_2", ".", "get_by_identifier", "(", "arg_7", ".", "identifier", ")", ":", "arg_3", ".", "append", "(", "arg_7", ")", "else", ":", "arg_5", ".", "append", "(", "arg_7", ")", "else", ":", "arg_4", ".", "append", "(", "arg_7", ")", "for", "arg_7", "in", "arg_2", ".", "tasks", ":", "if", "arg_7", ".", "identifier", "not", "in", "[", "arg_7", ".", "identifier", "for", "arg_7", "in", "arg_0", ".", "tasks", "]", ":", "arg_6", ".", "append", "(", "arg_7", ")", "if", "arg_4", ":", "arg_9", "=", "MapRouletteTaskCollection", "(", "arg_0", ".", "challenge", ",", "tasks", "=", "arg_4", ")", "arg_9", ".", "create", "(", "arg_1", ")", "if", "arg_5", ":", "arg_10", "=", "MapRouletteTaskCollection", "(", "arg_0", ".", "challenge", ",", "tasks", "=", "arg_5", ")", "arg_10", ".", "update", "(", "arg_1", ")", "if", "arg_6", ":", "arg_11", "=", "MapRouletteTaskCollection", "(", "arg_0", ".", "challenge", ",", "tasks", "=", "arg_6", ")", "for", "arg_7", "in", "arg_11", ".", "tasks", ":", "arg_7", ".", "status", "=", "'deleted'", "arg_11", ".", "update", "(", "arg_1", ")", "return", "{", "'same'", ":", "arg_3", ",", "'new'", ":", "arg_4", ",", "'changed'", ":", "arg_5", ",", "'deleted'", ":", "arg_6", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Reconcile this collection with the server.\n        \"\"\"\n        if not arg_0.challenge.exists(arg_1):\n            raise Exception('Challenge does not exist on server')\n\n        arg_2 = MapRouletteTaskCollection.from_server(arg_1, arg_0.challenge)\n\n        arg_3 = []\n        arg_4 = []\n        arg_5 = []\n        arg_6 = []\n\n        # Func the new tasks with the existing tasks:\n        for arg_7 in arg_0.tasks:\n            # if the task exists on the server...\n            if arg_7.identifier in [arg_8.identifier for arg_8 in arg_2.tasks]:\n                # and they are equal...\n                if arg_7 == arg_2.get_by_identifier(arg_7.identifier):\n                    # add to 'same' list\n                    arg_3.append(arg_7)\n                    # if they are not equal, add to 'changed' list\n                else:\n                    arg_5.append(arg_7)\n            # if the task does not exist on the server, add to 'new' list\n            else:\n                arg_4.append(arg_7)\n\n        # next, check for tasks on the server that don't exist in the new collection...\n        for arg_7 in arg_2.tasks:\n            if arg_7.identifier not in [arg_7.identifier for arg_7 in arg_0.tasks]:\n                # ... and add those to the 'deleted' list.\n                arg_6.append(arg_7)\n\n        # update the server with new, changed, and deleted tasks\n        if arg_4:\n            arg_9 = MapRouletteTaskCollection(arg_0.challenge, tasks=arg_4)\n            arg_9.create(arg_1)\n        if arg_5:\n            arg_10 = MapRouletteTaskCollection(arg_0.challenge, tasks=arg_5)\n            arg_10.update(arg_1)\n        if arg_6:\n            arg_11 = MapRouletteTaskCollection(arg_0.challenge, tasks=arg_6)\n            for arg_7 in arg_11.tasks:\n                arg_7.status = 'deleted'\n            arg_11.update(arg_1)\n        # return same, new, changed and deleted tasks\n        return {'same': arg_3, 'new': arg_4, 'changed': arg_5, 'deleted': arg_6}", "path": "maproulette/taskcollection.py", "identifier": "MapRouletteTaskCollection.reconcile", "docstring": "Reconcile this collection with the server.", "docstring_tokens": ["Reconcile", "this", "collection", "with", "the", "server", "."], "nwo": "mvexel/maproulette-api-wrapper", "score": 0.09252797783733271, "idx": 253751}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/metrics/metrics_helper.py#L174-L182", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Registers metrics to context", "language": "python", "parameters": "(self, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "system_config", ".", "get_sys_config", "(", ")", "arg_3", "=", "float", "(", "arg_2", "[", "constants", ".", "HERON_METRICS_EXPORT_INTERVAL_SEC", "]", ")", "arg_4", "=", "arg_1", ".", "get_metrics_collector", "(", ")", "super", "(", "ComponentMetrics", ",", "arg_0", ")", ".", "Func", "(", "arg_4", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Registers metrics to context\n\n    :param context: Topology Context\n    \"\"\"\n    arg_2 = system_config.get_sys_config()\n    arg_3 = float(arg_2[constants.HERON_METRICS_EXPORT_INTERVAL_SEC])\n    arg_4 = arg_1.get_metrics_collector()\n    super(ComponentMetrics, arg_0).Func(arg_4, arg_3)", "path": "heron/instance/src/python/utils/metrics/metrics_helper.py", "identifier": "ComponentMetrics.register_metrics", "docstring": "Registers metrics to context\n\n    :param context: Topology Context", "docstring_tokens": ["Registers", "metrics", "to", "context"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253752}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L364-L380", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Authenticate using OAuth authorization code.", "language": "python", "parameters": "(session, authorization_code)", "return_statement": "return res['access_token'], res['refresh_token']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'client_id'", ":", "OAUTH2_CLIENT_ID", ",", "'client_secret'", ":", "OAUTH2_CLIENT_SECRET", ",", "'code'", ":", "arg_1", ",", "'grant_type'", ":", "'authorization_code'", ",", "'redirect_uri'", ":", "'urn:ietf:wg:oauth:2.0:oob'", ",", "}", "arg_3", "=", "_make_token_request", "(", "arg_0", ",", "arg_2", ")", "return", "arg_3", "[", "'access_token'", "]", ",", "arg_3", "[", "'refresh_token'", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Authenticate using OAuth authorization code.\n\n    Raises GoogleAuthError if authentication fails.\n\n    Returns access token string and refresh token string.\n    \"\"\"\n    # Make a token request.\n    arg_2 = {\n        'client_id': OAUTH2_CLIENT_ID,\n        'client_secret': OAUTH2_CLIENT_SECRET,\n        'code': arg_1,\n        'grant_type': 'authorization_code',\n        'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob',\n    }\n    arg_3 = _make_token_request(arg_0, arg_2)\n    return arg_3['access_token'], arg_3['refresh_token']", "path": "hangups/auth.py", "identifier": "_auth_with_code", "docstring": "Authenticate using OAuth authorization code.\n\n    Raises GoogleAuthError if authentication fails.\n\n    Returns access token string and refresh token string.", "docstring_tokens": ["Authenticate", "using", "OAuth", "authorization", "code", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 253753}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/misc/pplan_helper.py#L233-L257", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks whether there are any bolts that consume any of my streams using custom grouping", "language": "python", "parameters": "(self, topology)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "range", "(", "len", "(", "arg_1", ".", "bolts", ")", ")", ":", "for", "arg_3", "in", "arg_1", ".", "bolts", "[", "arg_2", "]", ".", "inputs", ":", "if", "arg_3", ".", "stream", ".", "component_name", "==", "arg_0", ".", "my_component_name", "and", "arg_3", ".", "gtype", "==", "topology_pb2", ".", "Grouping", ".", "Value", "(", "\"CUSTOM\"", ")", ":", "if", "arg_3", ".", "type", "==", "topology_pb2", ".", "CustomGroupingObjectType", ".", "Value", "(", "\"PYTHON_OBJECT\"", ")", ":", "arg_4", "=", "default_serializer", ".", "deserialize", "(", "arg_3", ".", "custom_grouping_object", ")", "if", "isinstance", "(", "arg_4", ",", "str", ")", ":", "pex_loader", ".", "load_pex", "(", "arg_0", ".", "topology_pex_abs_path", ")", "arg_5", "=", "pex_loader", ".", "import_and_get_class", "(", "arg_0", ".", "topology_pex_abs_path", ",", "arg_4", ")", "arg_4", "=", "arg_5", "(", ")", "assert", "isinstance", "(", "arg_4", ",", "ICustomGrouping", ")", "arg_0", ".", "custom_grouper", ".", "add", "(", "arg_3", ".", "stream", ".", "id", ",", "arg_0", ".", "_get_taskids_for_component", "(", "arg_1", ".", "bolts", "[", "arg_2", "]", ".", "comp", ".", "name", ")", ",", "arg_4", ",", "arg_0", ".", "my_component_name", ")", "elif", "arg_3", ".", "type", "==", "topology_pb2", ".", "CustomGroupingObjectType", ".", "Value", "(", "\"JAVA_OBJECT\"", ")", ":", "raise", "NotImplementedError", "(", "\"Java-serialized custom grouping is not yet supported \"", "\"for python topology\"", ")", "else", ":", "raise", "ValueError", "(", "\"Unrecognized custom grouping type found: %s\"", "%", "str", "(", "arg_3", ".", "type", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Checks whether there are any bolts that consume any of my streams using custom grouping\"\"\"\n    for arg_2 in range(len(arg_1.bolts)):\n      for arg_3 in arg_1.bolts[arg_2].inputs:\n        if arg_3.stream.component_name == arg_0.my_component_name and \\\n          arg_3.gtype == topology_pb2.Grouping.Value(\"CUSTOM\"):\n          # this bolt takes my output in custom grouping manner\n          if arg_3.type == topology_pb2.CustomGroupingObjectType.Value(\"PYTHON_OBJECT\"):\n            arg_4 = default_serializer.deserialize(arg_3.custom_grouping_object)\n            if isinstance(arg_4, str):\n              pex_loader.load_pex(arg_0.topology_pex_abs_path)\n              arg_5 = \\\n                pex_loader.import_and_get_class(arg_0.topology_pex_abs_path, arg_4)\n              arg_4 = arg_5()\n            assert isinstance(arg_4, ICustomGrouping)\n            arg_0.custom_grouper.add(arg_3.stream.id,\n                                    arg_0._get_taskids_for_component(arg_1.bolts[arg_2].comp.name),\n                                    arg_4,\n                                    arg_0.my_component_name)\n\n          elif arg_3.type == topology_pb2.CustomGroupingObjectType.Value(\"JAVA_OBJECT\"):\n            raise NotImplementedError(\"Java-serialized custom grouping is not yet supported \"\n                                      \"for python topology\")\n          else:\n            raise ValueError(\"Unrecognized custom grouping type found: %s\" % str(arg_3.type))", "path": "heron/instance/src/python/utils/misc/pplan_helper.py", "identifier": "PhysicalPlanHelper._setup_custom_grouping", "docstring": "Checks whether there are any bolts that consume any of my streams using custom grouping", "docstring_tokens": ["Checks", "whether", "there", "are", "any", "bolts", "that", "consume", "any", "of", "my", "streams", "using", "custom", "grouping"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253754}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L744-L755", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "dispatch values previously read from a configuration file to each\n        options provider)", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "cfgfile_parser", "for", "arg_2", "in", "arg_1", ".", "sections", "(", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", "arg_2", ")", ":", "try", ":", "arg_0", ".", "global_set_option", "(", "arg_3", ",", "arg_4", ")", "except", "(", "KeyError", ",", "optparse", ".", "OptionError", ")", ":", "continue"], "function": "def Func(arg_0):\n        \"\"\"dispatch values previously read from a configuration file to each\n        options provider)\n        \"\"\"\n        arg_1 = arg_0.cfgfile_parser\n        for arg_2 in arg_1.sections():\n            for arg_3, arg_4 in arg_1.items(arg_2):\n                try:\n                    arg_0.global_set_option(arg_3, arg_4)\n                except (KeyError, optparse.OptionError):\n                    # TODO handle here undeclared options appearing in the config file\n                    continue", "path": "pylint/config.py", "identifier": "OptionsManagerMixIn.load_config_file", "docstring": "dispatch values previously read from a configuration file to each\n        options provider)", "docstring_tokens": ["dispatch", "values", "previously", "read", "from", "a", "configuration", "file", "to", "each", "options", "provider", ")"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253755}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_tree.py#L161-L172", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Sets up or removes a listener for children being changed on a\n            specified object.", "language": "python", "parameters": "( self, object, listener, remove )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_1", ".", "on_trait_change", "(", "arg_2", ",", "\"subgraphs_items\"", ",", "arg_3", "=", "arg_3", ",", "dispatch", "=", "\"fast_ui\"", ")", "arg_1", ".", "on_trait_change", "(", "arg_2", ",", "\"clusters_items\"", ",", "arg_3", "=", "arg_3", ",", "dispatch", "=", "\"fast_ui\"", ")", "arg_1", ".", "on_trait_change", "(", "arg_2", ",", "\"nodes_items\"", ",", "arg_3", "=", "arg_3", ",", "dispatch", "=", "\"fast_ui\"", ")", "arg_1", ".", "on_trait_change", "(", "arg_2", ",", "\"edges_items\"", ",", "arg_3", "=", "arg_3", ",", "dispatch", "=", "\"fast_ui\"", ")"], "function": "def Func ( arg_0, arg_1, arg_2, arg_3 ):\n        \"\"\" Sets up or removes a listener for children being changed on a\n            specified object.\n        \"\"\"\n        arg_1.on_trait_change( arg_2, \"subgraphs_items\",\n                                arg_3 = arg_3, dispatch = \"fast_ui\" )\n        arg_1.on_trait_change( arg_2, \"clusters_items\",\n                                arg_3 = arg_3, dispatch = \"fast_ui\" )\n        arg_1.on_trait_change( arg_2, \"nodes_items\",\n                                arg_3 = arg_3, dispatch = \"fast_ui\" )\n        arg_1.on_trait_change( arg_2, \"edges_items\",\n                                arg_3 = arg_3, dispatch = \"fast_ui\" )", "path": "godot/ui/graph_tree.py", "identifier": "BaseGraphTreeNode.when_children_changed", "docstring": "Sets up or removes a listener for children being changed on a\n            specified object.", "docstring_tokens": ["Sets", "up", "or", "removes", "a", "listener", "for", "children", "being", "changed", "on", "a", "specified", "object", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 253756}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L554-L575", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "This method handles the incoming encoder data message and stores\n        the data in the digital response table.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "digital_response_table", "[", "arg_1", "[", "arg_0", ".", "RESPONSE_TABLE_MODE", "]", "]", "[", "arg_0", ".", "RESPONSE_TABLE_PIN_DATA_VALUE", "]", "arg_3", "=", "int", "(", "(", "arg_1", "[", "arg_0", ".", "MSB", "]", "<<", "7", ")", "+", "arg_1", "[", "arg_0", ".", "LSB", "]", ")", "if", "arg_3", ">", "8192", ":", "arg_3", "-=", "16384", "arg_4", "=", "arg_1", "[", "0", "]", "with", "arg_0", ".", "pymata", ".", "data_lock", ":", "arg_0", ".", "digital_response_table", "[", "arg_1", "[", "arg_0", ".", "RESPONSE_TABLE_MODE", "]", "]", "[", "arg_0", ".", "RESPONSE_TABLE_PIN_DATA_VALUE", "]", "=", "arg_3", "if", "arg_2", "!=", "arg_3", ":", "arg_8", "=", "arg_0", ".", "digital_response_table", "[", "arg_4", "]", "[", "arg_0", ".", "RESPONSE_TABLE_CALLBACK", "]", "if", "arg_8", "is", "not", "None", ":", "arg_8", "(", "[", "arg_0", ".", "pymata", ".", "ENCODER", ",", "arg_4", ",", "arg_0", ".", "digital_response_table", "[", "arg_4", "]", "[", "arg_0", ".", "RESPONSE_TABLE_PIN_DATA_VALUE", "]", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        This method handles the incoming encoder data message and stores\n        the data in the digital response table.\n\n        :param data: Message data from Firmata\n\n        :return: No return value.\n        \"\"\"\n        arg_2 = arg_0.digital_response_table[arg_1[arg_0.RESPONSE_TABLE_MODE]][arg_0.RESPONSE_TABLE_PIN_DATA_VALUE]\n        arg_3 = int((arg_1[arg_0.MSB] << 7) + arg_1[arg_0.LSB])\n        # set value so that it shows positive and negative values\n        if arg_3 > 8192:\n            arg_3 -= 16384\n        arg_4 = arg_1[0]\n        with arg_0.pymata.data_lock:\n            arg_0.digital_response_table[arg_1[arg_0.RESPONSE_TABLE_MODE]][arg_0.RESPONSE_TABLE_PIN_DATA_VALUE] = arg_3\n            if arg_2 != arg_3:\n                arg_8 = arg_0.digital_response_table[arg_4][arg_0.RESPONSE_TABLE_CALLBACK]\n                if arg_8 is not None:\n                    arg_8([arg_0.pymata.ENCODER, arg_4,\n                              arg_0.digital_response_table[arg_4][arg_0.RESPONSE_TABLE_PIN_DATA_VALUE]])", "path": "PyMata/pymata_command_handler.py", "identifier": "PyMataCommandHandler.encoder_data", "docstring": "This method handles the incoming encoder data message and stores\n        the data in the digital response table.\n\n        :param data: Message data from Firmata\n\n        :return: No return value.", "docstring_tokens": ["This", "method", "handles", "the", "incoming", "encoder", "data", "message", "and", "stores", "the", "data", "in", "the", "digital", "response", "table", "."], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 253757}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/conversions.py#L63-L67", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Generates RGB values from HSV values in line with a typical light\n    spectrum.", "language": "python", "parameters": "(hsv)", "return_statement": "return hsv2rgb_raw(((h * 192) >> 8, s, v))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "return", "hsv2rgb_raw", "(", "(", "(", "arg_1", "*", "192", ")", ">>", "8", ",", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Generates RGB values from HSV values in line with a typical light\n    spectrum.\"\"\"\n    arg_1, arg_2, arg_3 = arg_0\n    return hsv2rgb_raw(((arg_1 * 192) >> 8, arg_2, arg_3))", "path": "bibliopixel/colors/conversions.py", "identifier": "hsv2rgb_spectrum", "docstring": "Generates RGB values from HSV values in line with a typical light\n    spectrum.", "docstring_tokens": ["Generates", "RGB", "values", "from", "HSV", "values", "in", "line", "with", "a", "typical", "light", "spectrum", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 253758}
{"url": "https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L471-L482", "sha": "b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b", "docstring_summary": "Returns the previous sibling of this node.", "language": "python", "parameters": "(self, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", ".", "parent", "is", "None", "or", "arg_0", ".", "index", "is", "None", ":", "return", "None", "for", "arg_2", "in", "xrange", "(", "arg_0", ".", "index", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "arg_1", "is", "None", "or", "arg_0", ".", "parent", "[", "arg_2", "]", ".", "tagname", "==", "arg_1", ":", "return", "arg_0", ".", "parent", "[", "arg_2", "]"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Returns the Funcious sibling of this node.\n\n        :param name: If specified, only consider elements with this tag name\n        :rtype: :class:`XmlElement`\n        \"\"\"\n        if arg_0.parent is None or arg_0.index is None:\n            return None\n        for arg_2 in xrange(arg_0.index - 1, -1, -1):\n            if arg_1 is None or arg_0.parent[arg_2].tagname == arg_1:\n                return arg_0.parent[arg_2]", "path": "drill.py", "identifier": "XmlElement.prev", "docstring": "Returns the previous sibling of this node.\n\n        :param name: If specified, only consider elements with this tag name\n        :rtype: :class:`XmlElement`", "docstring_tokens": ["Returns", "the", "previous", "sibling", "of", "this", "node", "."], "nwo": "dcwatson/drill", "score": 0.14991498758945482, "idx": 253759}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L675-L717", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the magnitude of the Fast Fourier Transform of a waveform.", "language": "python", "parameters": "(wave, npoints=None, indep_min=None, indep_max=None)", "return_statement": "return abs(fft(wave, npoints, indep_min, indep_max))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "return", "abs", "(", "fft", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n    r\"\"\"\n    Return the magnitude of the Fast Fourier Transform of a waveform.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param npoints: Number of points to use in the transform. If **npoints**\n                    is less than the size of the independent variable vector\n                    the waveform is truncated; if **npoints** is greater than\n                    the size of the independent variable vector, the waveform\n                    is zero-padded\n    :type  npoints: positive integer\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`npoints\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n     * RuntimeError (Non-uniform sampling)\n\n    .. [[[end]]]\n    \"\"\"\n    return abs(fft(arg_0, arg_1, arg_2, arg_3))", "path": "peng/wave_functions.py", "identifier": "fftm", "docstring": "r\"\"\"\n    Return the magnitude of the Fast Fourier Transform of a waveform.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param npoints: Number of points to use in the transform. If **npoints**\n                    is less than the size of the independent variable vector\n                    the waveform is truncated; if **npoints** is greater than\n                    the size of the independent variable vector, the waveform\n                    is zero-padded\n    :type  npoints: positive integer\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.fftm\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`npoints\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n     * RuntimeError (Non-uniform sampling)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "magnitude", "of", "the", "Fast", "Fourier", "Transform", "of", "a", "waveform", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 253760}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L462-L487", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Parse issue and generate single line formatted issue line.", "language": "python", "parameters": "(self, issue)", "return_statement": "return self.issue_line_with_user(title_with_number, issue)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "encapsulate_string", "(", "arg_1", "[", "'title'", "]", ")", "try", ":", "arg_3", "=", "u\"{0} [\\\\#{1}]({2})\"", ".", "format", "(", "arg_2", ",", "arg_1", "[", "\"number\"", "]", ",", "arg_1", "[", "\"html_url\"", "]", ")", "except", "UnicodeEncodeError", ":", "arg_3", "=", "\"ERROR ERROR ERROR: #{0} {1}\"", ".", "format", "(", "arg_1", "[", "\"number\"", "]", ",", "arg_1", "[", "'title'", "]", ")", "print", "(", "arg_3", ",", "'\\n'", ",", "arg_1", "[", "\"html_url\"", "]", ")", "return", "arg_0", ".", "issue_line_with_user", "(", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Parse issue and generate single line formatted issue line.\n\n        Example output:\n            - Add coveralls integration [\\#223](https://github.com/skywinder/github-changelog-generator/pull/223) ([skywinder](https://github.com/skywinder))\n            - Add coveralls integration [\\#223](https://github.com/skywinder/github-changelog-generator/pull/223) (@skywinder)\n\n\n        :param dict issue: Fetched issue from GitHub.\n        :rtype: str\n        :return: Markdown-formatted single issue.\n        \"\"\"\n\n        arg_2 = arg_0.encapsulate_string(arg_1['title'])\n        try:\n            arg_3 = u\"{0} [\\\\#{1}]({2})\".format(\n                arg_2, arg_1[\"number\"], arg_1[\"html_url\"]\n            )\n        except UnicodeEncodeError:\n            # TODO: why did i add this? Is it needed?\n            arg_3 = \"ERROR ERROR ERROR: #{0} {1}\".format(\n                arg_1[\"number\"], arg_1['title']\n            )\n            print(arg_3, '\\n', arg_1[\"html_url\"])\n        return arg_0.issue_line_with_user(arg_3, arg_1)", "path": "pygcgen/generator.py", "identifier": "Generator.get_string_for_issue", "docstring": "Parse issue and generate single line formatted issue line.\n\n        Example output:\n            - Add coveralls integration [\\#223](https://github.com/skywinder/github-changelog-generator/pull/223) ([skywinder](https://github.com/skywinder))\n            - Add coveralls integration [\\#223](https://github.com/skywinder/github-changelog-generator/pull/223) (@skywinder)\n\n\n        :param dict issue: Fetched issue from GitHub.\n        :rtype: str\n        :return: Markdown-formatted single issue.", "docstring_tokens": ["Parse", "issue", "and", "generate", "single", "line", "formatted", "issue", "line", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 253761}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/matrix_drawing.py#L252-L255", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Draw solid rectangle with top-left corner at x,y, width w and height h", "language": "python", "parameters": "(setter, x, y, w, h, color=None, aa=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "for", "arg_7", "in", "range", "(", "arg_1", ",", "arg_1", "+", "arg_3", ")", ":", "_draw_fast_vline", "(", "arg_0", ",", "arg_7", ",", "arg_2", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=False):\n    \"\"\"Draw solid rectangle with top-left corner at x,y, width w and height h\"\"\"\n    for arg_7 in range(arg_1, arg_1 + arg_3):\n        _draw_fast_vline(arg_0, arg_7, arg_2, arg_4, arg_5, arg_6)", "path": "bibliopixel/layout/matrix_drawing.py", "identifier": "fill_rect", "docstring": "Draw solid rectangle with top-left corner at x,y, width w and height h", "docstring_tokens": ["Draw", "solid", "rectangle", "with", "top", "-", "left", "corner", "at", "x", "y", "width", "w", "and", "height", "h"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 253762}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L290-L317", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Return the current value.", "language": "python", "parameters": "(self)", "return_statement": "return self.__value__", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "__Func__", "is", "None", ":", "try", ":", "arg_1", "=", "arg_0", ".", "__dict__", "[", "'loader'", "]", "except", "KeyError", ":", "raise", "AttributeError", "(", "\"Loader is not defined\"", ")", "arg_2", "=", "arg_1", "(", ")", "try", ":", "arg_0", ".", "set_Func", "(", "arg_2", ")", "except", "TypeError", ":", "arg_3", "=", "\"Loader must return variable of type %s or None, got %s\"", "%", "(", "arg_0", ".", "__dict__", "[", "'dtype'", "]", ",", "type", "(", "arg_2", ")", ")", "raise", "TypeError", "(", "arg_3", ")", "return", "arg_0", ".", "__Func__"], "function": "def Func(arg_0):\n        \"\"\"Return the current Func.\n\n        This first checks if the Func is cached (i.e., if\n        `self.__Func__` is not None)\n\n        If it is not cached then it invokes the `loader` function to\n        compute the Func, and caches the computed Func\n\n        \"\"\"\n\n        if arg_0.__Func__ is None:\n            try: \n                arg_1 = arg_0.__dict__['loader']\n            except KeyError:\n                raise AttributeError(\"Loader is not defined\")\n\n            # Try to run the loader.\n            # Don't catch expections here, let the Model class figure it out\n            arg_2 = arg_1()\n\n            # Try to set the Func\n            try:\n                arg_0.set_Func(arg_2)\n            except TypeError:\n                arg_3 = \"Loader must return variable of type %s or None, got %s\" % (arg_0.__dict__['dtype'], type(arg_2))\n                raise TypeError(arg_3)\n        return arg_0.__Func__", "path": "pymodeler/parameter.py", "identifier": "Derived.value", "docstring": "Return the current value.\n\n        This first checks if the value is cached (i.e., if\n        `self.__value__` is not None)\n\n        If it is not cached then it invokes the `loader` function to\n        compute the value, and caches the computed value", "docstring_tokens": ["Return", "the", "current", "value", "."], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 253763}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/scipy/LinLsqFit_mod.py#L157-L163", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "The reduced chi-square of the linear least squares", "language": "python", "parameters": "(self)", "return_statement": "return self._chisq_red", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Func", "is", "None", ":", "arg_0", ".", "_Func", "=", "chisquare", "(", "arg_0", ".", "y_unweighted", ".", "transpose", "(", ")", ",", "_np", ".", "dot", "(", "arg_0", ".", "X_unweighted", ",", "arg_0", ".", "beta", ")", ",", "arg_0", ".", "y_error", ",", "ddof", "=", "3", ",", "verbose", "=", "False", ")", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"\n        The reduced chi-square of the linear least squares\n        \"\"\"\n        if arg_0._Func is None:\n            arg_0._Func = chisquare(arg_0.y_unweighted.transpose(), _np.dot(arg_0.X_unweighted, arg_0.beta), arg_0.y_error, ddof=3, verbose=False)\n        return arg_0._Func", "path": "scisalt/scipy/LinLsqFit_mod.py", "identifier": "LinLsqFit.chisq_red", "docstring": "The reduced chi-square of the linear least squares", "docstring_tokens": ["The", "reduced", "chi", "-", "square", "of", "the", "linear", "least", "squares"], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 253764}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/__init__.py#L612-L619", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "Read and return the dataset contents as binary.", "language": "python", "parameters": "(self)", "return_statement": "return self.workspace._rest.read_intermediate_dataset_contents_binary(\n            self.workspace.workspace_id,\n            self.experiment.experiment_id,\n            self.node_id,\n            self.port_name\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "workspace", ".", "_rest", ".", "read_intermediate_dataset_contents_binary", "(", "arg_0", ".", "workspace", ".", "workspace_id", ",", "arg_0", ".", "experiment", ".", "experiment_id", ",", "arg_0", ".", "node_id", ",", "arg_0", ".", "port_name", ")"], "function": "def Func(arg_0):\n        '''Read and return the dataset contents as binary.'''\n        return arg_0.workspace._rest.read_intermediate_dataset_contents_binary(\n            arg_0.workspace.workspace_id,\n            arg_0.experiment.experiment_id,\n            arg_0.node_id,\n            arg_0.port_name\n        )", "path": "azureml/__init__.py", "identifier": "IntermediateDataset.read_as_binary", "docstring": "Read and return the dataset contents as binary.", "docstring_tokens": ["Read", "and", "return", "the", "dataset", "contents", "as", "binary", "."], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 253765}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/task_registry.py#L31-L40", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Lists available and visible GBDX tasks.", "language": "python", "parameters": "(self)", "return_statement": "return r.json()['tasks']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "gbdx_connection", ".", "get", "(", "arg_0", ".", "_base_url", ")", "raise_for_status", "(", "arg_1", ")", "return", "arg_1", ".", "json", "(", ")", "[", "'tasks'", "]"], "function": "def Func(arg_0):\n        \"\"\"Lists available and visible GBDX tasks.\n\n        Returns:\n            List of tasks\n        \"\"\"\n        arg_1 = arg_0.gbdx_connection.get(arg_0._base_url)\n        raise_for_status(arg_1)\n\n        return arg_1.json()['tasks']", "path": "gbdxtools/task_registry.py", "identifier": "TaskRegistry.list", "docstring": "Lists available and visible GBDX tasks.\n\n        Returns:\n            List of tasks", "docstring_tokens": ["Lists", "available", "and", "visible", "GBDX", "tasks", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 253766}
{"url": "https://github.com/voxpupuli/pypuppetdb/blob/cedeecf48014b4ad5b8e2513ca8230c814f45603/pypuppetdb/types.py#L488-L498", "sha": "cedeecf48014b4ad5b8e2513ca8230c814f45603", "docstring_summary": "Get a resource matching the supplied type and title. Additional\n        arguments may also be specified that will be passed to the query\n        function.", "language": "python", "parameters": "(self, type_, title, **kwargs)", "return_statement": "return next(resource for resource in resources)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "__api", ".", "resources", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "query", "=", "EqualsOperator", "(", "\"certname\"", ",", "arg_0", ".", "name", ")", ",", "**", "arg_3", ")", "return", "next", "(", "Func", "for", "Func", "in", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Get a resource matching the supplied type and title. Additional\n        arguments may also be specified that will be passed to the query\n        function.\n        \"\"\"\n        arg_4 = arg_0.__api.resources(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            query=EqualsOperator(\"certname\", arg_0.name),\n            **arg_3)\n        return next(Func for Func in arg_4)", "path": "pypuppetdb/types.py", "identifier": "Node.resource", "docstring": "Get a resource matching the supplied type and title. Additional\n        arguments may also be specified that will be passed to the query\n        function.", "docstring_tokens": ["Get", "a", "resource", "matching", "the", "supplied", "type", "and", "title", ".", "Additional", "arguments", "may", "also", "be", "specified", "that", "will", "be", "passed", "to", "the", "query", "function", "."], "nwo": "voxpupuli/pypuppetdb", "score": 0.6407386667560883, "idx": 253767}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L3832-L3868", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Deletes several links from the hard disk.", "language": "python", "parameters": "(self, iterator_of_links, remove_from_trajectory=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_1", ":", "if", "isinstance", "(", "arg_5", ",", "str", ")", ":", "arg_6", "=", "arg_5", ".", "split", "(", "'.'", ")", "arg_7", "=", "'.'", ".", "join", "(", "arg_6", "[", ":", "-", "1", "]", ")", "arg_8", "=", "arg_6", "[", "-", "1", "]", "arg_9", "=", "arg_0", ".", "f_get", "(", "arg_7", ")", "if", "arg_7", "!=", "''", "else", "arg_0", "arg_10", "=", "arg_9", ".", "v_full_name", "+", "'.'", "+", "arg_8", "if", "arg_7", "!=", "''", "else", "arg_8", "arg_3", ".", "append", "(", "(", "pypetconstants", ".", "DELETE_LINK", ",", "arg_10", ")", ")", "arg_4", ".", "append", "(", "(", "arg_9", ",", "arg_8", ")", ")", "else", ":", "arg_10", "=", "arg_5", "[", "0", "]", ".", "v_full_name", "+", "'.'", "+", "arg_5", "[", "1", "]", "arg_3", ".", "append", "(", "(", "pypetconstants", ".", "DELETE_LINK", ",", "arg_10", ")", ")", "arg_4", ".", "append", "(", "arg_5", ")", "try", ":", "arg_0", ".", "_storage_service", ".", "store", "(", "pypetconstants", ".", "LIST", ",", "arg_3", ",", "trajectory_name", "=", "arg_0", ".", "v_name", ")", "except", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Could not remove `%s` from the trajectory. Maybe the'", "' item(s) was/were never stored to disk.'", "%", "str", "(", "arg_3", ")", ")", "raise", "if", "arg_2", ":", "for", "arg_11", ",", "arg_8", "in", "arg_4", ":", "arg_11", ".", "f_remove_link", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Deletes several links from the hard disk.\n\n        Links can be passed as a string ``'groupA.groupB.linkA'``\n        or as a tuple  containing the node from which the link should be removed and the\n        name of the link ``(groupWithLink, 'linkA')``.\n\n        \"\"\"\n\n        arg_3 = []\n\n        arg_4 = []\n\n        for arg_5 in arg_1:\n            if isinstance(arg_5, str):\n                arg_6 = arg_5.split('.')\n                arg_7 = '.'.join(arg_6[:-1])\n                arg_8 = arg_6[-1]\n                arg_9 = arg_0.f_get(arg_7) if arg_7 != '' else arg_0\n                arg_10 = arg_9.v_full_name + '.' + arg_8 if arg_7 != '' else arg_8\n                arg_3.append((pypetconstants.DELETE_LINK, arg_10))\n                arg_4.append((arg_9, arg_8))\n            else:\n                arg_10 = arg_5[0].v_full_name + '.' + arg_5[1]\n                arg_3.append((pypetconstants.DELETE_LINK, arg_10))\n                arg_4.append(arg_5)\n        try:\n            arg_0._storage_service.store(pypetconstants.LIST, arg_3,\n                                        trajectory_name=arg_0.v_name)\n        except:\n            arg_0._logger.error('Could not remove `%s` from the trajectory. Maybe the'\n                               ' item(s) was/were never stored to disk.' % str(arg_3))\n            raise\n\n        if arg_2:\n            for arg_11, arg_8 in arg_4:\n                arg_11.f_remove_link(arg_8)", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_delete_links", "docstring": "Deletes several links from the hard disk.\n\n        Links can be passed as a string ``'groupA.groupB.linkA'``\n        or as a tuple  containing the node from which the link should be removed and the\n        name of the link ``(groupWithLink, 'linkA')``.", "docstring_tokens": ["Deletes", "several", "links", "from", "the", "hard", "disk", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253768}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2660-L2678", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds an empty generic group under the current node.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self._nn_interface._add_generic(self, type_name=GROUP,\n                                               group_type_name=GROUP,\n                                               args=args, kwargs=kwargs, add_prefix=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "_nn_interface", ".", "_add_generic", "(", "arg_0", ",", "type_name", "=", "GROUP", ",", "group_type_name", "=", "GROUP", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "add_prefix", "=", "False", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Adds an empty generic group under the current node.\n\n        You can add to a generic group anywhere you want. So you are free to build\n        your parameter tree with any structure. You do not necessarily have to follow the\n        four subtrees `config`, `parameters`, `derived_parameters`, `results`.\n\n        If you are operating within these subtrees this simply calls the corresponding adding\n        function.\n\n        Be aware that if you are within a single run and you add items not below a group\n        `run_XXXXXXXX` that you have to manually\n        save the items. Otherwise they will be lost after the single run is completed.\n\n        \"\"\"\n\n        return arg_0._nn_interface._add_generic(arg_0, type_name=GROUP,\n                                               group_type_name=GROUP,\n                                               arg_1=arg_1, arg_2=arg_2, add_prefix=False)", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_add_group", "docstring": "Adds an empty generic group under the current node.\n\n        You can add to a generic group anywhere you want. So you are free to build\n        your parameter tree with any structure. You do not necessarily have to follow the\n        four subtrees `config`, `parameters`, `derived_parameters`, `results`.\n\n        If you are operating within these subtrees this simply calls the corresponding adding\n        function.\n\n        Be aware that if you are within a single run and you add items not below a group\n        `run_XXXXXXXX` that you have to manually\n        save the items. Otherwise they will be lost after the single run is completed.", "docstring_tokens": ["Adds", "an", "empty", "generic", "group", "under", "the", "current", "node", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253769}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/application/briefkasten/notifications.py#L26-L34", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "expects a dictionary with 'mail.' keys to create an appropriate smtplib.SMTP instance", "language": "python", "parameters": "(**settings)", "return_statement": "return CustomSMTP(\n        host=settings.get('mail.host', 'localhost'),\n        port=int(settings.get('mail.port', 25)),\n        user=settings.get('mail.user'),\n        password=settings.get('mail.password'),\n        timeout=float(settings.get('mail.timeout', 60)),\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "return", "CustomSMTP", "(", "host", "=", "arg_0", ".", "get", "(", "'mail.host'", ",", "'localhost'", ")", ",", "port", "=", "int", "(", "arg_0", ".", "get", "(", "'mail.port'", ",", "25", ")", ")", ",", "user", "=", "arg_0", ".", "get", "(", "'mail.user'", ")", ",", "password", "=", "arg_0", ".", "get", "(", "'mail.password'", ")", ",", "timeout", "=", "float", "(", "arg_0", ".", "get", "(", "'mail.timeout'", ",", "60", ")", ")", ",", ")"], "function": "def Func(**arg_0):\n    \"\"\" expects a dictionary with 'mail.' keys to create an appropriate smtplib.SMTP instance\"\"\"\n    return CustomSMTP(\n        host=arg_0.get('mail.host', 'localhost'),\n        port=int(arg_0.get('mail.port', 25)),\n        user=arg_0.get('mail.user'),\n        password=arg_0.get('mail.password'),\n        timeout=float(arg_0.get('mail.timeout', 60)),\n    )", "path": "application/briefkasten/notifications.py", "identifier": "setup_smtp_factory", "docstring": "expects a dictionary with 'mail.' keys to create an appropriate smtplib.SMTP instance", "docstring_tokens": ["expects", "a", "dictionary", "with", "mail", ".", "keys", "to", "create", "an", "appropriate", "smtplib", ".", "SMTP", "instance"], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 253770}
{"url": "https://github.com/mohabusama/pyguacamole/blob/344dccc6cb3a9a045afeaf337677e5d0001aa83a/guacamole/instruction.py#L133-L148", "sha": "344dccc6cb3a9a045afeaf337677e5d0001aa83a", "docstring_summary": "Encode argument to be sent in a valid GuacamoleInstruction.", "language": "python", "parameters": "(arg)", "return_statement": "return ELEM_SEP.join([str(len(str(arg_utf8))), str(arg_utf8)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "utf8", "(", "arg_0", ")", "return", "ELEM_SEP", ".", "join", "(", "[", "str", "(", "len", "(", "str", "(", "arg_1", ")", ")", ")", ",", "str", "(", "arg_1", ")", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Encode argument to be sent in a valid GuacamoleInstruction.\n\n        example:\n        >> arg = Func('size')\n        >> arg == '4.size'\n        >> True\n\n        :param arg: arg string.\n\n        :return: str\n        \"\"\"\n        arg_1 = utf8(arg_0)\n\n        return ELEM_SEP.join([str(len(str(arg_1))), str(arg_1)])", "path": "guacamole/instruction.py", "identifier": "GuacamoleInstruction.encode_arg", "docstring": "Encode argument to be sent in a valid GuacamoleInstruction.\n\n        example:\n        >> arg = encode_arg('size')\n        >> arg == '4.size'\n        >> True\n\n        :param arg: arg string.\n\n        :return: str", "docstring_tokens": ["Encode", "argument", "to", "be", "sent", "in", "a", "valid", "GuacamoleInstruction", "."], "nwo": "mohabusama/pyguacamole", "score": 0.4506581328729369, "idx": 253771}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L544-L593", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Management of the json template.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "output", ":", "if", "PyFunceble", ".", "path", ".", "isfile", "(", "arg_0", ".", "output", ")", ":", "arg_1", "=", "Dict", "(", ")", ".", "from_json", "(", "File", "(", "arg_0", ".", "output", ")", ".", "read", "(", ")", ")", "if", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", ".", "extend", "(", "arg_0", ".", "data_to_print", ")", "arg_1", "=", "List", "(", "arg_1", ")", ".", "custom_format", "(", "Sort", ".", "standard", ")", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"hierarchical_sorting\"", "]", ":", "arg_1", "=", "List", "(", "arg_1", ")", ".", "custom_format", "(", "Sort", ".", "hierarchical", ")", "Dict", "(", "arg_1", ")", ".", "to_json", "(", "arg_0", ".", "output", ")", "else", ":", "raise", "Exception", "(", "\"Output not correctly formatted.\"", ")", "else", ":", "Dict", "(", "arg_0", ".", "data_to_print", ")", ".", "to_json", "(", "arg_0", ".", "output", ")", "else", ":", "raise", "Exception", "(", "\"Empty output given.\"", ")"], "function": "def Func(arg_0):  # pragma: no cover\n        \"\"\"\n        Management of the json template.\n        \"\"\"\n\n        if arg_0.output:\n            # The given output is not empty.\n\n            if PyFunceble.path.isfile(arg_0.output):\n                # The given output already exist.\n\n                # We get the content of the output.\n                arg_1 = Dict().from_json(File(arg_0.output).read())\n\n                if isinstance(arg_1, list):\n                    # The content is a list.\n\n                    # We extend the content with our data to print.\n                    arg_1.extend(arg_0.data_to_print)\n\n                    # We format our list.\n                    arg_1 = List(arg_1).custom_format(Sort.standard)\n\n                    if PyFunceble.CONFIGURATION[\"hierarchical_sorting\"]:\n                        # The hierarchical sorting is activated.\n\n                        # We format our content hierarchicaly\n                        arg_1 = List(arg_1).custom_format(Sort.hierarchical)\n\n                    # We finally save our content into the file.\n                    Dict(arg_1).to_json(arg_0.output)\n                else:\n                    # The content is not a list.\n\n                    # We raise an exception.\n                    raise Exception(\"Output not correctly formatted.\")\n            else:\n                # The given output does not already exist.\n\n                # We save our data to print into the output.\n                #\n                # Note: We do not have to take care if self.data_to_print is a list\n                # formatted or not because this method should not be called if it is\n                # not the case.\n                Dict(arg_0.data_to_print).to_json(arg_0.output)\n        else:\n            # The given output is empty.\n\n            # We raise an exception.\n            raise Exception(\"Empty output given.\")", "path": "PyFunceble/prints.py", "identifier": "Prints._json_print", "docstring": "Management of the json template.", "docstring_tokens": ["Management", "of", "the", "json", "template", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 253772}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/utils/notifications.py#L46-L51", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Validation email handler.", "language": "python", "parameters": "(notification)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_", "(", "'{domain} account validate'", ")", ".", "format", "(", "domain", "=", "arg_0", ".", "site", ".", "domain", ")", "arg_2", "=", "getattr", "(", "settings", ",", "'DUM_VALIDATE_EMAIL_SUBJECT'", ",", "arg_1", ")", "arg_0", ".", "email_subject", "=", "arg_2", "email_handler", "(", "arg_0", ",", "validation_email_context", ")"], "function": "def Func(arg_0):\n    \"\"\"Validation email handler.\"\"\"\n    arg_1 = _('{domain} account validate').format(domain=arg_0.site.domain)\n    arg_2 = getattr(settings, 'DUM_VALIDATE_EMAIL_SUBJECT', arg_1)\n    arg_0.email_subject = arg_2\n    email_handler(arg_0, validation_email_context)", "path": "user_management/utils/notifications.py", "identifier": "validation_email_handler", "docstring": "Validation email handler.", "docstring_tokens": ["Validation", "email", "handler", "."], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 253773}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/contrib/sanity_check_specs.py#L24-L52", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Sanity checks a states dict, used to define the state space for an MDP.\n    Throws an error or warns if mismatches are found.", "language": "python", "parameters": "(states_spec)", "return_statement": "return states, is_unique", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "copy", ".", "deepcopy", "(", "arg_0", ")", "arg_2", "=", "(", "'shape'", "in", "arg_1", ")", "if", "arg_2", ":", "arg_1", "=", "dict", "(", "arg_4", "=", "arg_1", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_4", "[", "'shape'", "]", ",", "int", ")", ":", "arg_4", "[", "'shape'", "]", "=", "(", "arg_4", "[", "'shape'", "]", ",", ")", "if", "'type'", "not", "in", "arg_4", ":", "arg_4", "[", "'type'", "]", "=", "'float'", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Sanity checks a states dict, used to define the state space for an MDP.\n    Throws an error or warns if mismatches are found.\n\n    Args:\n        states_spec (Union[None,dict]): The spec-dict to check (or None).\n\n    Returns: Tuple of 1) the state space desc and 2) whether there is only one component in the state space.\n    \"\"\"\n    # Leave incoming states dict intact.\n    arg_1 = copy.deepcopy(arg_0)\n\n    # Unique state shortform.\n    arg_2 = ('shape' in arg_1)\n    if arg_2:\n        arg_1 = dict(arg_4=arg_1)\n\n    # Normalize states.\n    for arg_3, arg_4 in arg_1.items():\n        # Convert int to unary tuple.\n        if isinstance(arg_4['shape'], int):\n            arg_4['shape'] = (arg_4['shape'],)\n\n        # Set default type to float.\n        if 'type' not in arg_4:\n            arg_4['type'] = 'float'\n\n    return arg_1, arg_2", "path": "tensorforce/contrib/sanity_check_specs.py", "identifier": "sanity_check_states", "docstring": "Sanity checks a states dict, used to define the state space for an MDP.\n    Throws an error or warns if mismatches are found.\n\n    Args:\n        states_spec (Union[None,dict]): The spec-dict to check (or None).\n\n    Returns: Tuple of 1) the state space desc and 2) whether there is only one component in the state space.", "docstring_tokens": ["Sanity", "checks", "a", "states", "dict", "used", "to", "define", "the", "state", "space", "for", "an", "MDP", ".", "Throws", "an", "error", "or", "warns", "if", "mismatches", "are", "found", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 253774}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/drivers/nvp_driver.py#L587-L600", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Selects an open lswitch for a network.", "language": "python", "parameters": "(self, context, switches=None, **kwargs)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "not", "None", ":", "for", "arg_4", "in", "arg_2", "[", "\"results\"", "]", ":", "arg_5", "=", "arg_4", "[", "\"_relations\"", "]", "[", "\"LogicalSwitchStatus\"", "]", "[", "\"lport_count\"", "]", "if", "(", "arg_0", ".", "limits", "[", "'max_ports_per_switch'", "]", "==", "0", "or", "arg_5", "<", "arg_0", ".", "limits", "[", "'max_ports_per_switch'", "]", ")", ":", "return", "arg_4", "[", "\"uuid\"", "]", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Selects an open lswitch for a network.\n\n        Note that it does not select the most full switch, but merely one with\n        ports available.\n        \"\"\"\n\n        if arg_2 is not None:\n            for arg_4 in arg_2[\"results\"]:\n                arg_5 = arg_4[\"_relations\"][\"LogicalSwitchStatus\"][\"lport_count\"]\n                if (arg_0.limits['max_ports_per_switch'] == 0 or\n                        arg_5 < arg_0.limits['max_ports_per_switch']):\n                    return arg_4[\"uuid\"]\n        return None", "path": "quark/drivers/nvp_driver.py", "identifier": "NVPDriver._lswitch_select_open", "docstring": "Selects an open lswitch for a network.\n\n        Note that it does not select the most full switch, but merely one with\n        ports available.", "docstring_tokens": ["Selects", "an", "open", "lswitch", "for", "a", "network", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 253775}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/optim/optimizer.py#L914-L923", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Set new training dataset, for optimizer reuse", "language": "python", "parameters": "(self, training_rdd, batch_size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "callBigDlFunc", "(", "arg_0", ".", "bigdl_type", ",", "\"setTrainData\"", ",", "arg_0", ".", "value", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set new training dataset, for optimizer reuse\n\n        :param training_rdd: the training dataset\n        :param batch_size: training batch size\n        :return:\n        \"\"\"\n        callBigDlFunc(arg_0.bigdl_type, \"setTrainData\", arg_0.value,\n                     arg_1, arg_2)", "path": "pyspark/bigdl/optim/optimizer.py", "identifier": "Optimizer.set_traindata", "docstring": "Set new training dataset, for optimizer reuse\n\n        :param training_rdd: the training dataset\n        :param batch_size: training batch size\n        :return:", "docstring_tokens": ["Set", "new", "training", "dataset", "for", "optimizer", "reuse"], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 253776}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/descriptor_pool.py#L208-L241", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Gets the FileDescriptor for the file containing the specified symbol.", "language": "python", "parameters": "(self, symbol)", "return_statement": "return self._ConvertFileProtoToFileDescriptor(file_proto)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "_NormalizeFullyQualifiedName", "(", "arg_1", ")", "try", ":", "return", "arg_0", ".", "_descriptors", "[", "arg_1", "]", ".", "file", "except", "KeyError", ":", "pass", "try", ":", "return", "arg_0", ".", "_enum_descriptors", "[", "arg_1", "]", ".", "file", "except", "KeyError", ":", "pass", "try", ":", "arg_2", "=", "arg_0", ".", "_internal_db", ".", "Func", "(", "arg_1", ")", "except", "KeyError", "as", "error", ":", "if", "arg_0", ".", "_descriptor_db", ":", "arg_2", "=", "arg_0", ".", "_descriptor_db", ".", "Func", "(", "arg_1", ")", "else", ":", "raise", "error", "if", "not", "arg_2", ":", "raise", "KeyError", "(", "'Cannot find a file containing %s'", "%", "arg_1", ")", "return", "arg_0", ".", "_ConvertFileProtoToFileDescriptor", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Gets the FileDescriptor for the file containing the specified symbol.\n\n    Args:\n      symbol: The name of the symbol to search for.\n\n    Returns:\n      A FileDescriptor that contains the specified symbol.\n\n    Raises:\n      KeyError: if the file can not be found in the pool.\n    \"\"\"\n\n    arg_1 = _NormalizeFullyQualifiedName(arg_1)\n    try:\n      return arg_0._descriptors[arg_1].file\n    except KeyError:\n      pass\n\n    try:\n      return arg_0._enum_descriptors[arg_1].file\n    except KeyError:\n      pass\n\n    try:\n      arg_2 = arg_0._internal_db.Func(arg_1)\n    except KeyError as error:\n      if arg_0._descriptor_db:\n        arg_2 = arg_0._descriptor_db.Func(arg_1)\n      else:\n        raise error\n    if not arg_2:\n      raise KeyError('Cannot find a file containing %s' % arg_1)\n    return arg_0._ConvertFileProtoToFileDescriptor(arg_2)", "path": "typy/google/protobuf/descriptor_pool.py", "identifier": "DescriptorPool.FindFileContainingSymbol", "docstring": "Gets the FileDescriptor for the file containing the specified symbol.\n\n    Args:\n      symbol: The name of the symbol to search for.\n\n    Returns:\n      A FileDescriptor that contains the specified symbol.\n\n    Raises:\n      KeyError: if the file can not be found in the pool.", "docstring_tokens": ["Gets", "the", "FileDescriptor", "for", "the", "file", "containing", "the", "specified", "symbol", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 253777}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3307-L3333", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores a group node to disk", "language": "python", "parameters": "(self, recursive=True, store_data=pypetconstants.STORE_DATA,\n                max_depth=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "arg_3", ".", "STORE_DATA", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_0", ".", "_nn_interface", ".", "_root_instance", "arg_7", "=", "arg_6", ".", "v_storage_service", "arg_7", ".", "store", "(", "arg_3", ".", "GROUP", ",", "arg_0", ",", "trajectory_name", "=", "arg_6", ".", "v_name", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=arg_3.STORE_DATA,\n                arg_5=None):\n        \"\"\"Stores a group node to disk\n\n        :param recursive:\n\n            Whether recursively all children should be stored too. Default is ``True``.\n\n        :param store_data:\n\n            For how to choose 'store_data' see :ref:`more-on-storing`.\n\n        :param max_depth:\n\n            In case `recursive` is `True`, you can specify the maximum depth to store\n            data relative from current node. Leave `None` if you don't want to limit\n            the depth.\n\n        \"\"\"\n        arg_6 = arg_0._nn_interface._root_instance\n        arg_7 = arg_6.v_storage_service\n\n        arg_7.store(arg_3.GROUP, arg_0,\n                              trajectory_name=arg_6.v_name,\n                              arg_1=arg_1,\n                              arg_2=arg_2,\n                              arg_5=arg_5)", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_store", "docstring": "Stores a group node to disk\n\n        :param recursive:\n\n            Whether recursively all children should be stored too. Default is ``True``.\n\n        :param store_data:\n\n            For how to choose 'store_data' see :ref:`more-on-storing`.\n\n        :param max_depth:\n\n            In case `recursive` is `True`, you can specify the maximum depth to store\n            data relative from current node. Leave `None` if you don't want to limit\n            the depth.", "docstring_tokens": ["Stores", "a", "group", "node", "to", "disk"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253778}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L591-L629", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Apply value predicates on the given record `r`.", "language": "python", "parameters": "(self, i, r,\n                                summarize=False,\n                                report_unexpected_exceptions=True,\n                                context=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "for", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", "in", "arg_0", ".", "_value_predicates", ":", "if", "arg_1", "%", "arg_10", "==", "0", ":", "arg_11", "=", "arg_0", ".", "_field_names", ".", "index", "(", "arg_6", ")", "if", "arg_11", "<", "len", "(", "arg_2", ")", ":", "arg_12", "=", "arg_2", "[", "arg_11", "]", "try", ":", "arg_13", "=", "arg_7", "(", "arg_12", ")", "if", "not", "arg_13", ":", "arg_14", "=", "{", "'code'", ":", "arg_8", "}", "if", "not", "arg_3", ":", "arg_14", "[", "'message'", "]", "=", "arg_9", "arg_14", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_14", "[", "'column'", "]", "=", "arg_11", "+", "1", "arg_14", "[", "'field'", "]", "=", "arg_6", "arg_14", "[", "'value'", "]", "=", "arg_12", "arg_14", "[", "'record'", "]", "=", "arg_2", "if", "arg_5", "is", "not", "None", ":", "arg_14", "[", "'context'", "]", "=", "arg_5", "yield", "arg_14", "except", "Exception", "as", "e", ":", "if", "arg_4", ":", "arg_14", "=", "{", "'code'", ":", "UNEXPECTED_EXCEPTION", "}", "if", "not", "arg_3", ":", "arg_14", "[", "'message'", "]", "=", "MESSAGES", "[", "UNEXPECTED_EXCEPTION", "]", "%", "(", "e", ".", "__class__", ".", "__name__", ",", "e", ")", "arg_14", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_14", "[", "'column'", "]", "=", "arg_11", "+", "1", "arg_14", "[", "'field'", "]", "=", "arg_6", "arg_14", "[", "'value'", "]", "=", "arg_12", "arg_14", "[", "'record'", "]", "=", "arg_2", "arg_14", "[", "'exception'", "]", "=", "e", "arg_14", "[", "'function'", "]", "=", "'%s: %s'", "%", "(", "arg_7", ".", "__name__", ",", "arg_7", ".", "__doc__", ")", "if", "arg_5", "is", "not", "None", ":", "arg_14", "[", "'context'", "]", "=", "arg_5", "yield", "arg_14"], "function": "def Func(arg_0, arg_1, arg_2,\n                                arg_3=False,\n                                arg_4=True,\n                                arg_5=None):\n        \"\"\"Apply value predicates on the given record `r`.\"\"\"\n\n        for arg_6, arg_7, arg_8, arg_9, arg_10 in arg_0._value_predicates:\n            if arg_1 % arg_10 == 0: # support sampling\n                arg_11 = arg_0._field_names.index(arg_6)\n                if arg_11 < len(arg_2): # only apply predicate if there is a value\n                    arg_12 = arg_2[arg_11]\n                    try:\n                        arg_13 = arg_7(arg_12)\n                        if not arg_13:\n                            arg_14 = {'code': arg_8}\n                            if not arg_3:\n                                arg_14['message'] = arg_9\n                                arg_14['row'] = arg_1 + 1\n                                arg_14['column'] = arg_11 + 1\n                                arg_14['field'] = arg_6\n                                arg_14['value'] = arg_12\n                                arg_14['record'] = arg_2\n                                if arg_5 is not None: arg_14['context'] = arg_5\n                            yield arg_14\n                    except Exception as e:\n                        if arg_4:\n                            arg_14 = {'code': UNEXPECTED_EXCEPTION}\n                            if not arg_3:\n                                arg_14['message'] = MESSAGES[UNEXPECTED_EXCEPTION] % (e.__class__.__name__, e)\n                                arg_14['row'] = arg_1 + 1\n                                arg_14['column'] = arg_11 + 1\n                                arg_14['field'] = arg_6\n                                arg_14['value'] = arg_12\n                                arg_14['record'] = arg_2\n                                arg_14['exception'] = e\n                                arg_14['function'] = '%s: %s' % (arg_7.__name__,\n                                                            arg_7.__doc__)\n                                if arg_5 is not None: arg_14['context'] = arg_5\n                            yield arg_14", "path": "csvvalidator.py", "identifier": "CSVValidator._apply_value_predicates", "docstring": "Apply value predicates on the given record `r`.", "docstring_tokens": ["Apply", "value", "predicates", "on", "the", "given", "record", "r", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 253779}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L605-L613", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Gets the offsets that occur as close as possible to the onsets in the given onset-front.", "language": "python", "parameters": "(onset_fronts, onset_front_id, onsets, offsets)", "return_statement": "return corresponding_offsets", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "_get_front_idxs_from_id", "(", "arg_0", ",", "arg_1", ")", ":", "arg_6", ",", "arg_7", "=", "_lookup_offset_by_onset_idx", "(", "arg_5", ",", "arg_2", ",", "arg_3", ")", "arg_4", ".", "append", "(", "(", "arg_6", ",", "arg_7", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Gets the offsets that occur as close as possible to the onsets in the given onset-front.\n    \"\"\"\n    arg_4 = []\n    for arg_5 in _get_front_idxs_from_id(arg_0, arg_1):\n        arg_6, arg_7 = _lookup_offset_by_onset_idx(arg_5, arg_2, arg_3)\n        arg_4.append((arg_6, arg_7))\n    return arg_4", "path": "algorithms/asa.py", "identifier": "_get_corresponding_offsets", "docstring": "Gets the offsets that occur as close as possible to the onsets in the given onset-front.", "docstring_tokens": ["Gets", "the", "offsets", "that", "occur", "as", "close", "as", "possible", "to", "the", "onsets", "in", "the", "given", "onset", "-", "front", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 253780}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L123-L138", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup a grid-stack of grid_stack from a mask, sub-grid size and psf-shape.", "language": "python", "parameters": "(cls, mask, sub_grid_size, psf_shape)", "return_statement": "return GridStack(regular_grid, sub_grid, blurring_grid)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "RegularGrid", ".", "from_mask", "(", "arg_1", ")", "arg_5", "=", "SubGrid", ".", "from_mask_and_sub_grid_size", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "RegularGrid", ".", "blurring_grid_from_mask_and_psf_shape", "(", "arg_1", ",", "arg_3", ")", "return", "GridStack", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Setup a grid-stack of grid_stack from a mask, sub-grid size and psf-shape.\n\n        Parameters\n        -----------\n        mask : Mask\n            The mask whose unmasked pixels (*False*) are used to generate the grid-stack's grid_stack.\n        sub_grid_size : int\n            The size of a sub-pixel's sub-grid (sub_grid_size x sub_grid_size).\n        psf_shape : (int, int)\n            the shape of the PSF used in the analysis, which defines the mask's blurring-region.\n        \"\"\"\n        arg_4 = RegularGrid.from_mask(arg_1)\n        arg_5 = SubGrid.from_mask_and_sub_grid_size(arg_1, arg_2)\n        arg_6 = RegularGrid.blurring_grid_from_mask_and_psf_shape(arg_1, arg_3)\n        return GridStack(arg_4, arg_5, arg_6)", "path": "autolens/data/array/grids.py", "identifier": "GridStack.grid_stack_from_mask_sub_grid_size_and_psf_shape", "docstring": "Setup a grid-stack of grid_stack from a mask, sub-grid size and psf-shape.\n\n        Parameters\n        -----------\n        mask : Mask\n            The mask whose unmasked pixels (*False*) are used to generate the grid-stack's grid_stack.\n        sub_grid_size : int\n            The size of a sub-pixel's sub-grid (sub_grid_size x sub_grid_size).\n        psf_shape : (int, int)\n            the shape of the PSF used in the analysis, which defines the mask's blurring-region.", "docstring_tokens": ["Setup", "a", "grid", "-", "stack", "of", "grid_stack", "from", "a", "mask", "sub", "-", "grid", "size", "and", "psf", "-", "shape", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 253781}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L683-L712", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Updates the global list of line error-suppressions.", "language": "python", "parameters": "(filename, raw_line, linenum, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "Search", "(", "r'\\bNOLINT(NEXTLINE)?\\b(\\([^)]+\\))?'", ",", "arg_1", ")", "if", "arg_4", ":", "if", "arg_4", ".", "group", "(", "1", ")", ":", "arg_5", "=", "arg_2", "+", "1", "else", ":", "arg_5", "=", "arg_2", "arg_6", "=", "arg_4", ".", "group", "(", "2", ")", "if", "arg_6", "in", "(", "None", ",", "'(*)'", ")", ":", "_error_suppressions", ".", "setdefault", "(", "None", ",", "set", "(", ")", ")", ".", "add", "(", "arg_5", ")", "else", ":", "if", "arg_6", ".", "startswith", "(", "'('", ")", "and", "arg_6", ".", "endswith", "(", "')'", ")", ":", "arg_6", "=", "arg_6", "[", "1", ":", "-", "1", "]", "if", "arg_6", "in", "_ERROR_CATEGORIES", ":", "_error_suppressions", ".", "setdefault", "(", "arg_6", ",", "set", "(", ")", ")", ".", "add", "(", "arg_5", ")", "elif", "arg_6", "not", "in", "_LEGACY_ERROR_CATEGORIES", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'readability/nolint'", ",", "5", ",", "'Unknown NOLINT error category: %s'", "%", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Updates the global list of line error-suppressions.\n\n  Parses any NOLINT comments on the current line, updating the global\n  error_suppressions store.  Reports an error if the NOLINT comment\n  was malformed.\n\n  Args:\n    filename: str, the name of the input file.\n    raw_line: str, the line of input text, with comments.\n    linenum: int, the number of the current line.\n    error: function, an error handler.\n  \"\"\"\n  arg_4 = Search(r'\\bNOLINT(NEXTLINE)?\\b(\\([^)]+\\))?', arg_1)\n  if arg_4:\n    if arg_4.group(1):\n      arg_5 = arg_2 + 1\n    else:\n      arg_5 = arg_2\n    arg_6 = arg_4.group(2)\n    if arg_6 in (None, '(*)'):  # => \"suppress all\"\n      _error_suppressions.setdefault(None, set()).add(arg_5)\n    else:\n      if arg_6.startswith('(') and arg_6.endswith(')'):\n        arg_6 = arg_6[1:-1]\n        if arg_6 in _ERROR_CATEGORIES:\n          _error_suppressions.setdefault(arg_6, set()).add(arg_5)\n        elif arg_6 not in _LEGACY_ERROR_CATEGORIES:\n          arg_3(arg_0, arg_2, 'readability/nolint', 5,\n                'Unknown NOLINT error category: %s' % arg_6)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "ParseNolintSuppressions", "docstring": "Updates the global list of line error-suppressions.\n\n  Parses any NOLINT comments on the current line, updating the global\n  error_suppressions store.  Reports an error if the NOLINT comment\n  was malformed.\n\n  Args:\n    filename: str, the name of the input file.\n    raw_line: str, the line of input text, with comments.\n    linenum: int, the number of the current line.\n    error: function, an error handler.", "docstring_tokens": ["Updates", "the", "global", "list", "of", "line", "error", "-", "suppressions", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253782}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/stream_tools.py#L55-L82", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Read a chunk of bytes from queue.", "language": "python", "parameters": "(self, size=0)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "arg_0", ".", "unFunc", "arg_0", ".", "unFunc", "=", "\"\"", "while", "arg_2", "==", "\"\"", "or", "arg_1", "<", "0", "or", "(", "arg_1", ">", "0", "and", "len", "(", "arg_2", ")", "<", "arg_1", ")", ":", "try", ":", "arg_2", "+=", "compat", ".", "to_native", "(", "arg_0", ".", "queue", ".", "get", "(", "True", ",", "0.1", ")", ")", "except", "compat", ".", "queue", ".", "Empty", ":", "if", "arg_0", ".", "is_closed", ":", "break", "if", "arg_1", ">", "0", "and", "len", "(", "arg_2", ")", ">", "arg_1", ":", "arg_0", ".", "unFunc", "=", "arg_2", "[", "arg_1", ":", "]", "arg_2", "=", "arg_2", "[", ":", "arg_1", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"Read a chunk of bytes from queue.\n\n        size = 0: Read next chunk (arbitrary length)\n             > 0: Read one chunk of `size` bytes (or less if stream was closed)\n             < 0: Read all bytes as single chunk (i.e. blocks until stream is closed)\n\n        This method blocks until the requested size become available.\n        However, if close() was called, '' is returned immediately.\n        \"\"\"\n        arg_2 = arg_0.unFunc\n        arg_0.unFunc = \"\"\n        # Get next chunk, cumulating requested size as needed\n        while arg_2 == \"\" or arg_1 < 0 or (arg_1 > 0 and len(arg_2) < arg_1):\n            try:\n                # Read pending data, blocking if neccessary\n                # (but handle the case that close() is called while waiting)\n                arg_2 += compat.to_native(arg_0.queue.get(True, 0.1))\n            except compat.queue.Empty:\n                # There was no pending data: wait for more, unless close() was called\n                if arg_0.is_closed:\n                    break\n        # Deliver `size` bytes from buffer\n        if arg_1 > 0 and len(arg_2) > arg_1:\n            arg_0.unFunc = arg_2[arg_1:]\n            arg_2 = arg_2[:arg_1]\n        # print(\"FileLikeQueue.Func({}) => {} bytes\".format(size, len(res)))\n        return arg_2", "path": "wsgidav/stream_tools.py", "identifier": "FileLikeQueue.read", "docstring": "Read a chunk of bytes from queue.\n\n        size = 0: Read next chunk (arbitrary length)\n             > 0: Read one chunk of `size` bytes (or less if stream was closed)\n             < 0: Read all bytes as single chunk (i.e. blocks until stream is closed)\n\n        This method blocks until the requested size become available.\n        However, if close() was called, '' is returned immediately.", "docstring_tokens": ["Read", "a", "chunk", "of", "bytes", "from", "queue", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 253783}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/views.py#L52-L56", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Used for breadcrumb dynamic_list_constructor.", "language": "python", "parameters": "(id_group)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Group", ".", "query", ".", "get", "(", "arg_0", ")", "if", "arg_1", "is", "not", "None", ":", "return", "arg_1", ".", "name"], "function": "def Func(arg_0):\n    \"\"\"Used for breadcrumb dynamic_list_constructor.\"\"\"\n    arg_1 = Group.query.get(arg_0)\n    if arg_1 is not None:\n        return arg_1.name", "path": "invenio_groups/views.py", "identifier": "get_group_name", "docstring": "Used for breadcrumb dynamic_list_constructor.", "docstring_tokens": ["Used", "for", "breadcrumb", "dynamic_list_constructor", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 253784}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/csp.py#L127-L131", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return the partial assignment implied by the current inferences.", "language": "python", "parameters": "(self)", "return_statement": "return dict((v, self.curr_domains[v][0])\n                    for v in self.vars if 1 == len(self.curr_domains[v]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "support_pruning", "(", ")", "return", "dict", "(", "(", "arg_1", ",", "arg_0", ".", "curr_domains", "[", "arg_1", "]", "[", "0", "]", ")", "for", "arg_1", "in", "arg_0", ".", "vars", "if", "1", "==", "len", "(", "arg_0", ".", "curr_domains", "[", "arg_1", "]", ")", ")"], "function": "def Func(arg_0):\n        \"Return the partial assignment implied by the current inferences.\"\n        arg_0.support_pruning()\n        return dict((arg_1, arg_0.curr_domains[arg_1][0])\n                    for arg_1 in arg_0.vars if 1 == len(arg_0.curr_domains[arg_1]))", "path": "aima/csp.py", "identifier": "CSP.infer_assignment", "docstring": "Return the partial assignment implied by the current inferences.", "docstring_tokens": ["Return", "the", "partial", "assignment", "implied", "by", "the", "current", "inferences", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 253785}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/setup.py#L141-L172", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Build requirements based on flags", "language": "python", "parameters": "(debug=True, with_examples=True, with_pgi=None)", "return_statement": "return reqs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "True", ",", "arg_1", "=", "True", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "list", "(", "BASE_REQUIREMENTS", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "is_jython", "if", "arg_0", ":", "print", "(", "\"setup options: \"", ")", "print", "(", "\"with_pgi:      \"", ",", "\"yes\"", "if", "arg_2", "else", "\"no\"", ")", "print", "(", "\"with_examples: \"", ",", "\"yes\"", "if", "arg_1", "else", "\"no\"", ")", "if", "arg_2", ":", "arg_3", ".", "append", "(", "\"pgi\"", ")", "if", "arg_0", ":", "print", "(", "\"warning, as of April 2019 typography does not work with pgi\"", ")", "else", ":", "arg_3", ".", "append", "(", "PYGOBJECT", ")", "if", "arg_1", ":", "arg_3", ".", "extend", "(", "EXAMPLE_REQUIREMENTS", ")", "if", "arg_0", ":", "print", "(", "\"\"", ")", "print", "(", "\"\"", ")", "for", "arg_4", "in", "arg_3", ":", "print", "(", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0=True, arg_1=True, arg_2=None):\n    \"\"\"\n    Build Func based on flags\n\n    :param with_pgi: Use 'pgi' instead of 'gi' - False on CPython, True elsewhere\n    :param with_examples:\n    :return:\n    \"\"\"\n    arg_3 = list(BASE_REQUIREMENTS)\n    if arg_2 is None:\n        arg_2 = is_jython\n\n    if arg_0:\n        print(\"setup options: \")\n        print(\"with_pgi:      \", \"yes\" if arg_2 else \"no\")\n        print(\"with_examples: \", \"yes\" if arg_1 else \"no\")\n    if arg_2:\n        arg_3.append(\"pgi\")\n        if arg_0:\n            print(\"warning, as of April 2019 typography does not work with pgi\")\n    else:\n        arg_3.append(PYGOBJECT)\n\n    if arg_1:\n        arg_3.extend(EXAMPLE_REQUIREMENTS)\n\n    if arg_0:\n        print(\"\")\n        print(\"\")\n        for arg_4 in arg_3:\n            print(arg_4)\n    return arg_3", "path": "setup.py", "identifier": "requirements", "docstring": "Build requirements based on flags\n\n    :param with_pgi: Use 'pgi' instead of 'gi' - False on CPython, True elsewhere\n    :param with_examples:\n    :return:", "docstring_tokens": ["Build", "requirements", "based", "on", "flags"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253786}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L331-L429", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Builds a single end cluster from the refmapped data.", "language": "python", "parameters": "(data, samfile, chrom, rstart, rend)", "return_statement": "return clust", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "_hackersonly", "[", "\"min_SE_refmap_overlap\"", "]", "arg_6", "=", "arg_3", "+", "arg_5", "arg_7", "=", "arg_4", "-", "arg_5", "if", "arg_6", ">", "arg_7", ":", "arg_8", "=", "arg_6", "arg_6", "=", "arg_7", "arg_7", "=", "arg_8", "if", "arg_6", "==", "arg_7", ":", "arg_7", "+=", "1", "arg_9", "=", "{", "}", "arg_10", "=", "[", "]", "arg_11", "=", "[", "]", "arg_11", "=", "arg_1", ".", "fetch", "(", "arg_2", ",", "arg_6", ",", "arg_7", ")", "for", "arg_12", "in", "arg_11", ":", "if", "arg_12", ".", "qname", "not", "in", "arg_9", ":", "arg_9", "[", "arg_12", ".", "qname", "]", "=", "arg_12", "arg_14", "=", "lambda", "x", ":", "int", "(", "x", ".", "split", "(", "\";size=\"", ")", "[", "1", "]", ".", "split", "(", "\";\"", ")", "[", "0", "]", ")", "arg_15", "=", "sorted", "(", "arg_9", ".", "keys", "(", ")", ",", "arg_22", "=", "arg_14", ",", "reverse", "=", "True", ")", "try", ":", "arg_16", "=", "arg_9", "[", "arg_15", "[", "0", "]", "]", "except", "ValueError", ":", "LOGGER", ".", "error", "(", "\"Found bad cluster, skipping - key:{} rdict:{}\"", ".", "format", "(", "arg_15", "[", "0", "]", ",", "arg_9", ")", ")", "return", "\"\"", "arg_17", "=", "arg_16", ".", "get_reference_positions", "(", "full_length", "=", "True", ")", "arg_18", "=", "min", "(", "arg_17", ")", "arg_19", "=", "max", "(", "arg_17", ")", "if", "arg_16", ".", "is_reverse", ":", "arg_20", "=", "revcomp", "(", "arg_16", ".", "seq", ")", "else", ":", "arg_20", "=", "arg_16", ".", "seq", "arg_21", "=", "arg_14", "(", "arg_15", "[", "0", "]", ")", "arg_10", ".", "append", "(", "\">{}:{}:{};size={};*\\n{}\"", ".", "format", "(", "arg_2", ",", "arg_18", ",", "arg_19", ",", "arg_21", ",", "arg_20", ")", ")", "if", "len", "(", "arg_15", ")", ">", "1", ":", "for", "arg_22", "in", "arg_15", "[", "1", ":", "]", ":", "arg_23", "=", "False", "try", ":", "arg_16", "=", "arg_9", "[", "arg_22", "]", "except", "ValueError", ":", "arg_16", "=", "arg_9", "[", "arg_22", "]", "[", "0", "]", "arg_23", "=", "True", "if", "not", "arg_23", ":", "arg_17", "=", "arg_16", ".", "get_reference_positions", "(", "full_length", "=", "True", ")", "arg_24", "=", "min", "(", "arg_17", ")", "arg_25", "=", "max", "(", "arg_17", ")", "if", "arg_16", ".", "is_reverse", ":", "arg_20", "=", "revcomp", "(", "arg_16", ".", "seq", ")", "else", ":", "arg_20", "=", "arg_16", ".", "seq", "arg_21", "=", "arg_14", "(", "arg_22", ")", "arg_10", ".", "append", "(", "\">{}:{}:{};size={};+\\n{}\"", ".", "format", "(", "arg_2", ",", "arg_24", ",", "arg_25", ",", "arg_21", ",", "arg_20", ")", ")", "else", ":", "pass", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Builds a single end cluster from the refmapped data.\n    \"\"\"\n\n    ## If SE then we enforce the minimum overlap distance to avoid the\n    ## staircase syndrome of multiple reads overlapping just a little.\n    arg_5 = arg_0._hackersonly[\"min_SE_refmap_overlap\"]\n\n    ## the *_buff variables here are because we have to play patty\n    ## cake here with the rstart/rend vals because we want pysam to\n    ## enforce the buffer for SE, but we want the reference sequence\n    ## start and end positions to print correctly for downstream.\n    arg_6 = arg_3 + arg_5\n    arg_7 = arg_4 - arg_5\n\n    ## Reads that map to only very short segements of the reference\n    ## sequence will return buffer end values that are before the\n    ## start values causing pysam to complain. Very short mappings.\n    if arg_6 > arg_7:\n        arg_8 = arg_6\n        arg_6 = arg_7\n        arg_7 = arg_8\n    ## Buffering can't make start and end equal or pysam returns nothing.\n    if arg_6 == arg_7:\n        arg_7 += 1\n\n    ## store pairs\n    arg_9 = {}\n    arg_10 = []\n    arg_11 = []\n\n    arg_11 = arg_1.fetch(arg_2, arg_6, arg_7)\n\n    ## use dict to match up read pairs\n    for arg_12 in arg_11:\n        if arg_12.qname not in arg_9:\n            arg_9[arg_12.qname] = arg_12\n\n    ## sort dict keys so highest derep is first ('seed')\n    arg_14 = lambda x: int(x.split(\";size=\")[1].split(\";\")[0])\n    arg_15 = sorted(arg_9.keys(), arg_22=arg_14, reverse=True)\n\n    ## get blocks from the seed for filtering, bail out if seed is not paired\n    try:\n        arg_16 = arg_9[arg_15[0]]\n    except ValueError:\n        LOGGER.error(\"Found bad cluster, skipping - key:{} rdict:{}\".format(arg_15[0], arg_9))\n        return \"\"\n\n    ## the starting blocks for the seed\n    arg_17 = arg_16.get_reference_positions(full_length=True)\n    arg_18 = min(arg_17)\n    arg_19 = max(arg_17)\n\n    ## store the seed -------------------------------------------\n    if arg_16.is_reverse:\n        arg_20 = revcomp(arg_16.seq)\n    else:\n        arg_20 = arg_16.seq\n\n    ## store, could write orient but just + for now.\n    arg_21 = arg_14(arg_15[0])\n    arg_10.append(\">{}:{}:{};size={};*\\n{}\"\\\n        .format(arg_2, arg_18, arg_19, arg_21, arg_20))\n\n    ## If there's only one hit in this region then rkeys will only have\n    ## one element and the call to `rkeys[1:]` will raise. Test for this.\n    if len(arg_15) > 1:\n        ## store the hits to the seed -------------------------------\n        for arg_22 in arg_15[1:]:\n            arg_23 = False\n            try:\n                arg_16 = arg_9[arg_22]\n            except ValueError:\n                ## enter values that will make this read get skipped\n                arg_16 = arg_9[arg_22][0]\n                arg_23 = True\n\n            ## orient reads only if not skipping\n            if not arg_23:\n                arg_17 = arg_16.get_reference_positions(full_length=True)\n                arg_24 = min(arg_17)\n                arg_25 = max(arg_17)\n                ## store the seq\n                if arg_16.is_reverse:\n                    arg_20 = revcomp(arg_16.seq)\n                else:\n                    arg_20 = arg_16.seq\n                ## store, could write orient but just + for now.\n                arg_21 = arg_14(arg_22)\n                arg_10.append(\">{}:{}:{};size={};+\\n{}\"\\\n                    .format(arg_2, arg_24, arg_25, arg_21, arg_20))\n            else:\n                ## seq is excluded, though, we could save it and return\n                ## it as a separate cluster that will be aligned separately.\n                pass\n\n    return arg_10", "path": "ipyrad/assemble/refmap.py", "identifier": "fetch_cluster_se", "docstring": "Builds a single end cluster from the refmapped data.", "docstring_tokens": ["Builds", "a", "single", "end", "cluster", "from", "the", "refmapped", "data", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 253787}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/compiler.py#L202-L206", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Gets the variable part of the source code for a rule.", "language": "python", "parameters": "(self, rule)", "return_statement": "return self._indent(source, depth=self.indent + \"   \", skip_first_line=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_0", ".", "input_source", ")", "+", "arg_1", ".", "position", "arg_3", "=", "arg_0", ".", "input_source", "[", "arg_2", ":", "arg_2", "+", "arg_1", ".", "consumed", "]", ".", "rstrip", "(", ")", "return", "arg_0", ".", "_indent", "(", "arg_3", ",", "depth", "=", "arg_0", ".", "indent", "+", "\"   \"", ",", "skip_first_line", "=", "True", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Gets the variable part of the source code for a rule.\"\"\"\n    arg_2 = len(arg_0.input_source) + arg_1.position\n    arg_3 = arg_0.input_source[arg_2:arg_2 + arg_1.consumed].rstrip()\n    return arg_0._indent(arg_3, depth=arg_0.indent + \"   \", skip_first_line=True)", "path": "pyebnf/compiler.py", "identifier": "Compiler._get_rule_source", "docstring": "Gets the variable part of the source code for a rule.", "docstring_tokens": ["Gets", "the", "variable", "part", "of", "the", "source", "code", "for", "a", "rule", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 253788}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/QC.py#L8-L30", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Run Fastqc on the input reads", "language": "python", "parameters": "(job, r1_id, r2_id)", "return_statement": "return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'fastqc.tar.gz'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_1", ",", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'R1.fastq'", ")", ")", "arg_4", "=", "[", "'/data/R1.fastq'", "]", "arg_5", "=", "[", "'R1_fastqc.html'", ",", "'R1_fastqc.zip'", "]", "if", "arg_2", ":", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_2", ",", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'R2.fastq'", ")", ")", "arg_4", ".", "extend", "(", "[", "'-t'", ",", "'2'", ",", "'/data/R2.fastq'", "]", ")", "arg_5", ".", "extend", "(", "[", "'R2_fastqc.html'", ",", "'R2_fastqc.zip'", "]", ")", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "tool", "=", "'quay.io/ucsc_cgl/fastqc:0.11.5--be13567d00cd4c586edf8ae47d991815c8c72a49'", ",", "workDir", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "[", "os", ".", "path", ".", "join", "(", "arg_3", ",", "x", ")", "for", "x", "in", "arg_5", "]", "tarball_files", "(", "tar_name", "=", "'fastqc.tar.gz'", ",", "file_paths", "=", "arg_6", ",", "output_dir", "=", "arg_3", ")", "return", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'fastqc.tar.gz'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Run Fastqc on the input reads\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str r1_id: FileStoreID of fastq read 1\n    :param str r2_id: FileStoreID of fastq read 2\n    :return: FileStoreID of fastQC output (tarball)\n    :rtype: str\n    \"\"\"\n    arg_3 = arg_0.fileStore.getLocalTempDir()\n    arg_0.fileStore.readGlobalFile(arg_1, os.path.join(arg_3, 'R1.fastq'))\n    arg_4 = ['/data/R1.fastq']\n    arg_5 = ['R1_fastqc.html', 'R1_fastqc.zip']\n    if arg_2:\n        arg_0.fileStore.readGlobalFile(arg_2, os.path.join(arg_3, 'R2.fastq'))\n        arg_4.extend(['-t', '2', '/data/R2.fastq'])\n        arg_5.extend(['R2_fastqc.html', 'R2_fastqc.zip'])\n    dockerCall(arg_0=arg_0, tool='quay.io/ucsc_cgl/fastqc:0.11.5--be13567d00cd4c586edf8ae47d991815c8c72a49',\n               workDir=arg_3, arg_4=arg_4)\n    arg_6 = [os.path.join(arg_3, x) for x in arg_5]\n    tarball_files(tar_name='fastqc.tar.gz', file_paths=arg_6, output_dir=arg_3)\n    return arg_0.fileStore.writeGlobalFile(os.path.join(arg_3, 'fastqc.tar.gz'))", "path": "src/toil_lib/tools/QC.py", "identifier": "run_fastqc", "docstring": "Run Fastqc on the input reads\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str r1_id: FileStoreID of fastq read 1\n    :param str r2_id: FileStoreID of fastq read 2\n    :return: FileStoreID of fastQC output (tarball)\n    :rtype: str", "docstring_tokens": ["Run", "Fastqc", "on", "the", "input", "reads"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 253789}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/stepper/main.py#L246-L279", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Choose the name for stepped data file", "language": "python", "parameters": "(self)", "return_statement": "return stpd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "use_caching", ":", "arg_1", "=", "\"|\"", "arg_2", "=", "hashlib", ".", "md5", "(", ")", "arg_3", "=", "\"cache version 6\"", "+", "arg_1", "+", "';'", ".", "join", "(", "arg_0", ".", "load_profile", ".", "schedule", ")", "+", "arg_1", "+", "str", "(", "arg_0", ".", "loop_limit", ")", "arg_3", "+=", "arg_1", "+", "str", "(", "arg_0", ".", "ammo_limit", ")", "+", "arg_1", "+", "';'", ".", "join", "(", "arg_0", ".", "load_profile", ".", "schedule", ")", "+", "arg_1", "+", "str", "(", "arg_0", ".", "autocases", ")", "arg_3", "+=", "arg_1", "+", "\";\"", ".", "join", "(", "arg_0", ".", "uris", ")", "+", "arg_1", "+", "\";\"", ".", "join", "(", "arg_0", ".", "headers", ")", "+", "arg_1", "+", "arg_0", ".", "http_ver", "+", "arg_1", "+", "\";\"", ".", "join", "(", "arg_0", ".", "chosen_cases", ")", "arg_3", "+=", "arg_1", "+", "str", "(", "arg_0", ".", "enum_ammo", ")", "+", "arg_1", "+", "str", "(", "arg_0", ".", "ammo_type", ")", "if", "arg_0", ".", "load_profile", ".", "is_instances", "(", ")", ":", "arg_3", "+=", "arg_1", "+", "str", "(", "arg_0", ".", "instances", ")", "if", "arg_0", ".", "ammo_file", ":", "arg_4", "=", "resource", ".", "get_opener", "(", "arg_0", ".", "ammo_file", ")", "arg_3", "+=", "arg_1", "+", "arg_4", ".", "hash", "else", ":", "if", "not", "arg_0", ".", "uris", ":", "raise", "RuntimeError", "(", "\"Neither ammofile nor uris specified\"", ")", "arg_3", "+=", "arg_1", "+", "';'", ".", "join", "(", "arg_0", ".", "uris", ")", "+", "arg_1", "+", "';'", ".", "join", "(", "arg_0", ".", "headers", ")", "arg_0", ".", "log", ".", "debug", "(", "\"stpd-hash source: %s\"", ",", "arg_3", ")", "arg_2", ".", "update", "(", "arg_3", ".", "encode", "(", "'utf8'", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "cache_dir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "cache_dir", ")", "arg_5", "=", "arg_0", ".", "cache_dir", "+", "'/'", "+", "os", ".", "path", ".", "basename", "(", "arg_0", ".", "ammo_file", ")", "+", "\"_\"", "+", "arg_2", ".", "hexdigest", "(", ")", "+", "\".stpd\"", "else", ":", "arg_5", "=", "os", ".", "path", ".", "realpath", "(", "\"ammo.stpd\"", ")", "arg_0", ".", "log", ".", "debug", "(", "\"Generated cache file name: %s\"", ",", "arg_5", ")", "return", "arg_5"], "function": "def Func(arg_0):\n        ''' Choose the name for stepped data file '''\n        if arg_0.use_caching:\n            arg_1 = \"|\"\n            arg_2 = hashlib.md5()\n            arg_3 = \"cache version 6\" + arg_1 + \\\n                ';'.join(arg_0.load_profile.schedule) + arg_1 + str(arg_0.loop_limit)\n            arg_3 += arg_1 + str(arg_0.ammo_limit) + arg_1 + ';'.join(\n                arg_0.load_profile.schedule) + arg_1 + str(arg_0.autocases)\n            arg_3 += arg_1 + \";\".join(arg_0.uris) + arg_1 + \";\".join(\n                arg_0.headers) + arg_1 + arg_0.http_ver + arg_1 + \";\".join(\n                    arg_0.chosen_cases)\n            arg_3 += arg_1 + str(arg_0.enum_ammo) + arg_1 + str(arg_0.ammo_type)\n            if arg_0.load_profile.is_instances():\n                arg_3 += arg_1 + str(arg_0.instances)\n            if arg_0.ammo_file:\n                arg_4 = resource.get_opener(arg_0.ammo_file)\n                arg_3 += arg_1 + arg_4.hash\n            else:\n                if not arg_0.uris:\n                    raise RuntimeError(\"Neither ammofile nor uris specified\")\n                arg_3 += arg_1 + \\\n                    ';'.join(arg_0.uris) + arg_1 + ';'.join(arg_0.headers)\n            arg_0.log.debug(\"stpd-hash source: %s\", arg_3)\n            arg_2.update(arg_3.encode('utf8'))\n            if not os.path.exists(arg_0.cache_dir):\n                os.makedirs(arg_0.cache_dir)\n            arg_5 = arg_0.cache_dir + '/' + \\\n                os.path.basename(arg_0.ammo_file) + \\\n                \"_\" + arg_2.hexdigest() + \".stpd\"\n        else:\n            arg_5 = os.path.realpath(\"ammo.stpd\")\n        arg_0.log.debug(\"Generated cache file name: %s\", arg_5)\n        return arg_5", "path": "yandextank/stepper/main.py", "identifier": "StepperWrapper.__get_stpd_filename", "docstring": "Choose the name for stepped data file", "docstring_tokens": ["Choose", "the", "name", "for", "stepped", "data", "file"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 253790}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L320-L330", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Checks to see if Spark worker and HDFS datanode are still running.", "language": "python", "parameters": "(self)", "return_statement": "return status", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_FuncContainerStatus", "(", "arg_0", ".", "sparkContainerID", ",", "arg_0", ".", "hdfsContainerID", ",", "sparkNoun", "=", "'worker'", ",", "hdfsNoun", "=", "'datanode'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Checks to see if Spark worker and HDFS datanode are still running.\n        \"\"\"\n\n        arg_1 = _FuncContainerStatus(arg_0.sparkContainerID,\n                                       arg_0.hdfsContainerID,\n                                       sparkNoun='worker',\n                                       hdfsNoun='datanode')\n        \n        return arg_1", "path": "src/toil_lib/spark.py", "identifier": "WorkerService.check", "docstring": "Checks to see if Spark worker and HDFS datanode are still running.", "docstring_tokens": ["Checks", "to", "see", "if", "Spark", "worker", "and", "HDFS", "datanode", "are", "still", "running", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 253791}
{"url": "https://github.com/maxzheng/bumper-lib/blob/32a9dec5448673825bb2d7d92fa68882b597f794/bumper/__init__.py#L199-L202", "sha": "32a9dec5448673825bb2d7d92fa68882b597f794", "docstring_summary": "Reverse all bumpers", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "test_drive", "and", "arg_0", ".", "bumps", ":", "map", "(", "lambda", "b", ":", "b", ".", "Func", "(", ")", ",", "arg_0", ".", "bumpers", ")"], "function": "def Func(arg_0):\n        \"\"\" Reverse all bumpers \"\"\"\n        if not arg_0.test_drive and arg_0.bumps:\n            map(lambda b: b.Func(), arg_0.bumpers)", "path": "bumper/__init__.py", "identifier": "BumperDriver.reverse", "docstring": "Reverse all bumpers", "docstring_tokens": ["Reverse", "all", "bumpers"], "nwo": "maxzheng/bumper-lib", "score": 0.17782712273869106, "idx": 253792}
{"url": "https://github.com/ricobl/django-importer/blob/6967adfa7a286be7aaf59d3f33c6637270bd9df6/django_importer/utils.py#L7-L36", "sha": "6967adfa7a286be7aaf59d3f33c6637270bd9df6", "docstring_summary": "Downloads a HTTP resource from `url` and save to `dest`.\n    \n    Capable of dealing with Gzip compressed content.", "language": "python", "parameters": "(url, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "urllib2", ".", "Request", "(", "arg_0", ")", "arg_2", ".", "add_header", "(", "'Accept-encoding'", ",", "'gzip'", ")", "arg_3", "=", "urllib2", ".", "build_opener", "(", ")", "arg_4", "=", "arg_3", ".", "open", "(", "arg_2", ")", "arg_5", "=", "arg_4", ".", "read", "(", ")", "if", "arg_4", ".", "headers", ".", "get", "(", "'content-encoding'", ",", "''", ")", "==", "'gzip'", ":", "arg_6", "=", "StringIO", ".", "StringIO", "(", "arg_5", ")", "arg_7", "=", "gzip", ".", "GzipFile", "(", "fileobj", "=", "arg_6", ")", "arg_5", "=", "arg_7", ".", "read", "(", ")", "arg_8", "=", "open", "(", "arg_1", ",", "'wb'", ")", "arg_8", ".", "write", "(", "arg_5", ")", "arg_8", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Downloads a HTTP resource from `url` and save to `dest`.\n    \n    Capable of dealing with Gzip compressed content.\n    \"\"\"\n    \n    # Create the HTTP request\n    arg_2 = urllib2.Request(arg_0)\n    \n    # Add the header to accept gzip encoding\n    arg_2.add_header('Accept-encoding', 'gzip')\n    \n    # Open the request\n    arg_3 = urllib2.build_opener()\n    arg_4 = arg_3.open(arg_2)\n    \n    # Retrieve data\n    arg_5 = arg_4.read()\n    \n    # If the data is compressed, put the data in a stream and decompress\n    if arg_4.headers.get('content-encoding', '') == 'gzip':\n        arg_6 = StringIO.StringIO(arg_5)\n        arg_7 = gzip.GzipFile(fileobj=arg_6)\n        arg_5 = arg_7.read()\n    \n    # Write to a file\n    arg_8 = open(arg_1, 'wb')\n    arg_8.write(arg_5)\n    arg_8.close()", "path": "django_importer/utils.py", "identifier": "download_file", "docstring": "Downloads a HTTP resource from `url` and save to `dest`.\n    \n    Capable of dealing with Gzip compressed content.", "docstring_tokens": ["Downloads", "a", "HTTP", "resource", "from", "url", "and", "save", "to", "dest", ".", "Capable", "of", "dealing", "with", "Gzip", "compressed", "content", "."], "nwo": "ricobl/django-importer", "score": 0.3726785709016597, "idx": 253793}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/core.py#L844-L893", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Print the colored logo based on global results.", "language": "python", "parameters": "(cls, home=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "not", "PyFunceble", ".", "CONFIGURATION", "[", "\"quiet\"", "]", ":", "arg_2", "=", "[", "]", "if", "arg_1", ":", "for", "arg_3", "in", "PyFunceble", ".", "ASCII_PYFUNCEBLE", ".", "split", "(", "\"\\n\"", ")", ":", "arg_2", ".", "append", "(", "PyFunceble", ".", "Fore", ".", "YELLOW", "+", "arg_3", "+", "PyFunceble", ".", "Fore", ".", "RESET", ")", "elif", "PyFunceble", ".", "INTERN", "[", "\"counter\"", "]", "[", "\"percentage\"", "]", "[", "\"up\"", "]", ">=", "50", ":", "for", "arg_3", "in", "PyFunceble", ".", "ASCII_PYFUNCEBLE", ".", "split", "(", "\"\\n\"", ")", ":", "arg_2", ".", "append", "(", "PyFunceble", ".", "Fore", ".", "GREEN", "+", "arg_3", "+", "PyFunceble", ".", "Fore", ".", "RESET", ")", "else", ":", "for", "arg_3", "in", "PyFunceble", ".", "ASCII_PYFUNCEBLE", ".", "split", "(", "\"\\n\"", ")", ":", "arg_2", ".", "append", "(", "PyFunceble", ".", "Fore", ".", "RED", "+", "arg_3", "+", "PyFunceble", ".", "Fore", ".", "RESET", ")", "print", "(", "\"\\n\"", ".", "join", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Print the colored logo based on global results.\n\n        :param home: Tell us if we have to print the initial coloration.\n        :type home: bool\n        \"\"\"\n\n        if not PyFunceble.CONFIGURATION[\"quiet\"]:\n            # The quiet mode is not activated.\n\n            arg_2 = []\n\n            if arg_1:\n                # We have to print the initial logo.\n\n                for arg_3 in PyFunceble.ASCII_PYFUNCEBLE.split(\"\\n\"):\n                    # We loop through each lines of the ASCII representation\n                    # of PyFunceble.\n\n                    # And we append to the data to print the currently read\n                    # line with the right coloration.\n                    arg_2.append(\n                        PyFunceble.Fore.YELLOW + arg_3 + PyFunceble.Fore.RESET\n                    )\n\n            elif PyFunceble.INTERN[\"counter\"][\"percentage\"][\"up\"] >= 50:\n                # The percentage of up is greater or equal to 50%.\n\n                for arg_3 in PyFunceble.ASCII_PYFUNCEBLE.split(\"\\n\"):\n                    # We loop through each lines of the ASCII representation\n                    # of PyFunceble.\n\n                    # And we append to the data to print the currently read\n                    # line with the right coloration.\n                    arg_2.append(\n                        PyFunceble.Fore.GREEN + arg_3 + PyFunceble.Fore.RESET\n                    )\n            else:\n                # The percentage of up is less than 50%.\n\n                for arg_3 in PyFunceble.ASCII_PYFUNCEBLE.split(\"\\n\"):\n                    # We loop through each lines of the ASCII representation\n                    # of PyFunceble.\n\n                    # And we append to the data to print the currently read\n                    # line with the right coloration.\n                    arg_2.append(PyFunceble.Fore.RED + arg_3 + PyFunceble.Fore.RESET)\n\n            print(\"\\n\".join(arg_2))", "path": "PyFunceble/core.py", "identifier": "Core.colorify_logo", "docstring": "Print the colored logo based on global results.\n\n        :param home: Tell us if we have to print the initial coloration.\n        :type home: bool", "docstring_tokens": ["Print", "the", "colored", "logo", "based", "on", "global", "results", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 253794}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_hash.py#L772-L854", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Hashes the data in a file on disk.", "language": "python", "parameters": "(fpath, blocksize=65536, stride=1, hasher=NoParam,\n              hashlen=NoParam, base=NoParam)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "65536", ",", "arg_2", "=", "1", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "arg_4", ",", "arg_6", "=", "arg_4", ")", ":", "arg_6", "=", "_rectify_base", "(", "arg_6", ")", "arg_5", "=", "_rectify_hashlen", "(", "arg_5", ")", "arg_3", "=", "_rectify_hasher", "(", "arg_3", ")", "(", ")", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "file", ":", "arg_7", "=", "file", ".", "read", "(", "arg_1", ")", "if", "arg_2", ">", "1", ":", "while", "len", "(", "arg_7", ")", ">", "0", ":", "arg_3", ".", "update", "(", "arg_7", ")", "file", ".", "seek", "(", "arg_1", "*", "(", "arg_2", "-", "1", ")", ",", "1", ")", "arg_7", "=", "file", ".", "read", "(", "arg_1", ")", "else", ":", "while", "len", "(", "arg_7", ")", ">", "0", ":", "arg_3", ".", "update", "(", "arg_7", ")", "arg_7", "=", "file", ".", "read", "(", "arg_1", ")", "arg_8", "=", "_digest_hasher", "(", "arg_3", ",", "arg_5", ",", "arg_6", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1=65536, arg_2=1, arg_3=arg_4,\n              arg_5=arg_4, arg_6=arg_4):\n    \"\"\"\n    Hashes the data in a file on disk.\n\n    Args:\n        fpath (PathLike):  file path string\n\n        blocksize (int): 2 ** 16. Affects speed of reading file\n\n        stride (int): strides > 1 skip data to hash, useful for faster\n                      hashing, but less accurate, also makes hash dependant on\n                      blocksize.\n\n        hasher (HASH): hash algorithm from hashlib, defaults to `sha512`.\n\n        hashlen (int): maximum number of symbols in the returned hash. If\n            not specified, all are returned.\n\n        base (list, str): list of symbols or shorthand key. Valid keys are\n            'abc', 'hex', and 'dec'. Defaults to 'hex'.\n\n    Notes:\n        For better hashes keep stride = 1\n        For faster hashes set stride > 1\n        blocksize matters when stride > 1\n\n    References:\n        http://stackoverflow.com/questions/3431825/md5-checksum-of-a-file\n        http://stackoverflow.com/questions/5001893/when-to-use-sha-1-vs-sha-2\n\n    Example:\n        >>> import ubelt as ub\n        >>> from os.path import join\n        >>> fpath = join(ub.ensure_app_cache_dir('ubelt'), 'tmp.txt')\n        >>> ub.writeto(fpath, 'foobar')\n        >>> print(ub.Func(fpath, hasher='sha1', base='hex'))\n        8843d7f92416211de9ebb963ff4ce28125932878\n\n    Example:\n        >>> import ubelt as ub\n        >>> from os.path import join\n        >>> fpath = ub.touch(join(ub.ensure_app_cache_dir('ubelt'), 'empty_file'))\n        >>> # Test that the output is the same as sha1sum\n        >>> if ub.find_exe('sha1sum'):\n        >>>     want = ub.cmd(['sha1sum', fpath], verbose=2)['out'].split(' ')[0]\n        >>>     got = ub.Func(fpath, hasher='sha1')\n        >>>     print('want = {!r}'.format(want))\n        >>>     print('got = {!r}'.format(got))\n        >>>     assert want.endswith(got)\n        >>> # Do the same for sha512 sum and md5sum\n        >>> if ub.find_exe('sha512sum'):\n        >>>     want = ub.cmd(['sha512sum', fpath], verbose=2)['out'].split(' ')[0]\n        >>>     got = ub.Func(fpath, hasher='sha512')\n        >>>     print('want = {!r}'.format(want))\n        >>>     print('got = {!r}'.format(got))\n        >>>     assert want.endswith(got)\n        >>> if ub.find_exe('md5sum'):\n        >>>     want = ub.cmd(['md5sum', fpath], verbose=2)['out'].split(' ')[0]\n        >>>     got = ub.Func(fpath, hasher='md5')\n        >>>     print('want = {!r}'.format(want))\n        >>>     print('got = {!r}'.format(got))\n        >>>     assert want.endswith(got)\n    \"\"\"\n    arg_6 = _rectify_base(arg_6)\n    arg_5 = _rectify_hashlen(arg_5)\n    arg_3 = _rectify_hasher(arg_3)()\n    with open(arg_0, 'rb') as file:\n        arg_7 = file.read(arg_1)\n        if arg_2 > 1:\n            # skip blocks when stride is greater than 1\n            while len(arg_7) > 0:\n                arg_3.update(arg_7)\n                file.seek(arg_1 * (arg_2 - 1), 1)\n                arg_7 = file.read(arg_1)\n        else:\n            # otherwise hash the entire file\n            while len(arg_7) > 0:\n                arg_3.update(arg_7)\n                arg_7 = file.read(arg_1)\n    # Get the hashed representation\n    arg_8 = _digest_hasher(arg_3, arg_5, arg_6)\n    return arg_8", "path": "ubelt/util_hash.py", "identifier": "hash_file", "docstring": "Hashes the data in a file on disk.\n\n    Args:\n        fpath (PathLike):  file path string\n\n        blocksize (int): 2 ** 16. Affects speed of reading file\n\n        stride (int): strides > 1 skip data to hash, useful for faster\n                      hashing, but less accurate, also makes hash dependant on\n                      blocksize.\n\n        hasher (HASH): hash algorithm from hashlib, defaults to `sha512`.\n\n        hashlen (int): maximum number of symbols in the returned hash. If\n            not specified, all are returned.\n\n        base (list, str): list of symbols or shorthand key. Valid keys are\n            'abc', 'hex', and 'dec'. Defaults to 'hex'.\n\n    Notes:\n        For better hashes keep stride = 1\n        For faster hashes set stride > 1\n        blocksize matters when stride > 1\n\n    References:\n        http://stackoverflow.com/questions/3431825/md5-checksum-of-a-file\n        http://stackoverflow.com/questions/5001893/when-to-use-sha-1-vs-sha-2\n\n    Example:\n        >>> import ubelt as ub\n        >>> from os.path import join\n        >>> fpath = join(ub.ensure_app_cache_dir('ubelt'), 'tmp.txt')\n        >>> ub.writeto(fpath, 'foobar')\n        >>> print(ub.hash_file(fpath, hasher='sha1', base='hex'))\n        8843d7f92416211de9ebb963ff4ce28125932878\n\n    Example:\n        >>> import ubelt as ub\n        >>> from os.path import join\n        >>> fpath = ub.touch(join(ub.ensure_app_cache_dir('ubelt'), 'empty_file'))\n        >>> # Test that the output is the same as sha1sum\n        >>> if ub.find_exe('sha1sum'):\n        >>>     want = ub.cmd(['sha1sum', fpath], verbose=2)['out'].split(' ')[0]\n        >>>     got = ub.hash_file(fpath, hasher='sha1')\n        >>>     print('want = {!r}'.format(want))\n        >>>     print('got = {!r}'.format(got))\n        >>>     assert want.endswith(got)\n        >>> # Do the same for sha512 sum and md5sum\n        >>> if ub.find_exe('sha512sum'):\n        >>>     want = ub.cmd(['sha512sum', fpath], verbose=2)['out'].split(' ')[0]\n        >>>     got = ub.hash_file(fpath, hasher='sha512')\n        >>>     print('want = {!r}'.format(want))\n        >>>     print('got = {!r}'.format(got))\n        >>>     assert want.endswith(got)\n        >>> if ub.find_exe('md5sum'):\n        >>>     want = ub.cmd(['md5sum', fpath], verbose=2)['out'].split(' ')[0]\n        >>>     got = ub.hash_file(fpath, hasher='md5')\n        >>>     print('want = {!r}'.format(want))\n        >>>     print('got = {!r}'.format(got))\n        >>>     assert want.endswith(got)", "docstring_tokens": ["Hashes", "the", "data", "in", "a", "file", "on", "disk", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 253795}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/log/handlers.py#L7-L44", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Emit a record.\n        Format the record and send it to the specified addressees.", "language": "python", "parameters": "(self, record)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "import", "smtplib", "try", ":", "from", "email", ".", "utils", "import", "arg_2", "except", "ImportError", ":", "arg_2", "=", "arg_0", ".", "date_time", "arg_3", "=", "arg_0", ".", "mailport", "if", "not", "arg_3", ":", "arg_3", "=", "smtplib", ".", "SMTP_PORT", "arg_4", "=", "smtplib", ".", "SMTP", "(", "arg_0", ".", "mailhost", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "format", "(", "arg_1", ")", "arg_5", "=", "\"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\nDate: %s\\r\\n\\r\\n%s\"", "%", "(", "arg_0", ".", "fromaddr", ",", "','", ".", "join", "(", "arg_0", ".", "toaddrs", ")", ",", "arg_0", ".", "getSubject", "(", "arg_1", ")", ",", "arg_2", "(", ")", ",", "arg_5", ")", "if", "arg_0", ".", "username", ":", "arg_4", ".", "ehlo", "(", ")", "arg_4", ".", "starttls", "(", ")", "arg_4", ".", "ehlo", "(", ")", "arg_4", ".", "login", "(", "arg_0", ".", "username", ",", "arg_0", ".", "password", ")", "arg_4", ".", "sendmail", "(", "arg_0", ".", "fromaddr", ",", "arg_0", ".", "toaddrs", ",", "arg_5", ")", "arg_4", ".", "quit", "(", ")", "except", "(", "KeyboardInterrupt", ",", "SystemExit", ")", ":", "raise", "except", ":", "arg_0", ".", "handleError", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Emit a record.\n        Format the record and send it to the specified addressees.\n        \"\"\"\n        try:\n            import smtplib\n            try:\n                from email.utils import arg_2\n            except ImportError:\n                arg_2 = arg_0.date_time\n\n            arg_3 = arg_0.mailport\n            if not arg_3:\n                arg_3 = smtplib.SMTP_PORT\n\n            arg_4 = smtplib.SMTP(arg_0.mailhost, arg_3)\n            arg_5 = arg_0.format(arg_1)\n            arg_5 = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\nDate: %s\\r\\n\\r\\n%s\" % (\n                arg_0.fromaddr,\n                ','.join(arg_0.toaddrs),\n                arg_0.getSubject(arg_1),\n                arg_2(), arg_5\n            )\n\n            if arg_0.username:\n                arg_4.ehlo()  # For 'tls', add this line\n                arg_4.starttls()  # For 'tls', add this line\n                arg_4.ehlo()  # For 'tls', add this line\n                arg_4.login(arg_0.username, arg_0.password)\n\n            arg_4.sendmail(arg_0.fromaddr, arg_0.toaddrs, arg_5)\n            arg_4.quit()\n\n        except (KeyboardInterrupt, SystemExit):\n            raise\n\n        except:\n            arg_0.handleError(arg_1)", "path": "scout/log/handlers.py", "identifier": "TlsSMTPHandler.emit", "docstring": "Emit a record.\n        Format the record and send it to the specified addressees.", "docstring_tokens": ["Emit", "a", "record", ".", "Format", "the", "record", "and", "send", "it", "to", "the", "specified", "addressees", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253796}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/mask.py#L267-L295", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Transform a given vector to a volume. This is a reshape function for\n    3D flattened and maybe masked vectors.", "language": "python", "parameters": "(arr, mask, order='C')", "return_statement": "return volume", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'C'", ")", ":", "if", "arg_1", ".", "dtype", "!=", "np", ".", "bool", ":", "raise", "ValueError", "(", "\"mask must be a boolean array\"", ")", "if", "arg_0", ".", "ndim", "!=", "1", ":", "raise", "ValueError", "(", "\"vector must be a 1-dimensional array\"", ")", "if", "arg_0", ".", "ndim", "==", "2", "and", "any", "(", "arg_3", "==", "1", "for", "arg_3", "in", "arg_0", ".", "shape", ")", ":", "log", ".", "debug", "(", "'Got an array of shape {}, flattening for my purposes.'", ".", "format", "(", "arg_0", ".", "shape", ")", ")", "arg_0", "=", "arg_0", ".", "flatten", "(", ")", "arg_4", "=", "np", ".", "zeros", "(", "arg_1", ".", "shape", "[", ":", "3", "]", ",", "dtype", "=", "arg_0", ".", "dtype", ",", "arg_2", "=", "arg_2", ")", "arg_4", "[", "arg_1", "]", "=", "arg_0", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2='C'):\n    \"\"\"Transform a given vector to a volume. This is a reshape function for\n    3D flattened and maybe masked vectors.\n\n    Parameters\n    ----------\n    arr: np.array\n        1-Dimensional array\n\n    mask: numpy.ndarray\n        Mask image. Must have 3 dimensions, bool dtype.\n\n    Returns\n    -------\n    np.ndarray\n    \"\"\"\n    if arg_1.dtype != np.bool:\n        raise ValueError(\"mask must be a boolean array\")\n\n    if arg_0.ndim != 1:\n        raise ValueError(\"vector must be a 1-dimensional array\")\n\n    if arg_0.ndim == 2 and any(arg_3 == 1 for arg_3 in arg_0.shape):\n        log.debug('Got an array of shape {}, flattening for my purposes.'.format(arg_0.shape))\n        arg_0 = arg_0.flatten()\n\n    arg_4 = np.zeros(arg_1.shape[:3], dtype=arg_0.dtype, arg_2=arg_2)\n    arg_4[arg_1] = arg_0\n    return arg_4", "path": "boyle/nifti/mask.py", "identifier": "vector_to_volume", "docstring": "Transform a given vector to a volume. This is a reshape function for\n    3D flattened and maybe masked vectors.\n\n    Parameters\n    ----------\n    arr: np.array\n        1-Dimensional array\n\n    mask: numpy.ndarray\n        Mask image. Must have 3 dimensions, bool dtype.\n\n    Returns\n    -------\n    np.ndarray", "docstring_tokens": ["Transform", "a", "given", "vector", "to", "a", "volume", ".", "This", "is", "a", "reshape", "function", "for", "3D", "flattened", "and", "maybe", "masked", "vectors", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 253797}
{"url": "https://github.com/dreidev/Suggestions/blob/f04c181dc815d32c35b44c6e1c91521e88a9dd6c/suggestions/views.py#L114-L119", "sha": "f04c181dc815d32c35b44c6e1c91521e88a9dd6c", "docstring_summary": "Gets a list of all suggestions for an object", "language": "python", "parameters": "(object)", "return_statement": "return ObjectViewDictionary.objects.filter(\n        current_object_id=object.id,\n        current_content_type=content_type).extra(order_by=['-visits'])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "type", "(", "arg_0", ")", ")", "return", "ObjectViewDictionary", ".", "objects", ".", "filter", "(", "current_object_id", "=", "arg_0", ".", "id", ",", "current_content_type", "=", "arg_1", ")", ".", "extra", "(", "order_by", "=", "[", "'-visits'", "]", ")"], "function": "def Func(arg_0):\n    \"\"\" Gets a list of all suggestions for an object \"\"\"\n    arg_1 = ContentType.objects.get_for_model(type(arg_0))\n    return ObjectViewDictionary.objects.filter(\n        current_object_id=arg_0.id,\n        current_content_type=arg_1).extra(order_by=['-visits'])", "path": "suggestions/views.py", "identifier": "get_suggestions", "docstring": "Gets a list of all suggestions for an object", "docstring_tokens": ["Gets", "a", "list", "of", "all", "suggestions", "for", "an", "object"], "nwo": "dreidev/Suggestions", "score": 0.0, "idx": 253798}
{"url": "https://github.com/ioam/parambokeh/blob/fb9744f216273c7b24e65d037b1d621c08d7fde6/parambokeh/__init__.py#L458-L462", "sha": "fb9744f216273c7b24e65d037b1d621c08d7fde6", "docstring_summary": "Get widget for param_name", "language": "python", "parameters": "(self, param_name)", "return_statement": "return self._widgets[param_name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_Funcs", ":", "arg_0", ".", "_Funcs", "[", "arg_1", "]", "=", "arg_0", ".", "_make_Func", "(", "arg_1", ")", "return", "arg_0", ".", "_Funcs", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get Func for param_name\"\"\"\n        if arg_1 not in arg_0._Funcs:\n            arg_0._Funcs[arg_1] = arg_0._make_Func(arg_1)\n        return arg_0._Funcs[arg_1]", "path": "parambokeh/__init__.py", "identifier": "Widgets.widget", "docstring": "Get widget for param_name", "docstring_tokens": ["Get", "widget", "for", "param_name"], "nwo": "ioam/parambokeh", "score": 0.28708038950088577, "idx": 253799}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L968-L975", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Sets the current model as orphaned. This is called when the scheduler is\n    about to kill the process to reallocate the worker to a different process.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ClientJobsDAO", ".", "CMPL_REASON_ORPHAN", "arg_2", "=", "\"Killed by Scheduler\"", "arg_0", ".", "_jobsDAO", ".", "modelSetCompleted", "(", "arg_0", ".", "_modelID", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Sets the current model as orphaned. This is called when the scheduler is\n    about to kill the process to reallocate the worker to a different process.\n    \"\"\"\n    arg_1 = ClientJobsDAO.CMPL_REASON_ORPHAN\n    arg_2 = \"Killed by Scheduler\"\n    arg_0._jobsDAO.modelSetCompleted(arg_0._modelID, arg_1, arg_2)", "path": "src/nupic/swarming/ModelRunner.py", "identifier": "OPFModelRunner.__setAsOrphaned", "docstring": "Sets the current model as orphaned. This is called when the scheduler is\n    about to kill the process to reallocate the worker to a different process.", "docstring_tokens": ["Sets", "the", "current", "model", "as", "orphaned", ".", "This", "is", "called", "when", "the", "scheduler", "is", "about", "to", "kill", "the", "process", "to", "reallocate", "the", "worker", "to", "a", "different", "process", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253800}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/value.py#L284-L316", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Press scrollbar left with number of iterations", "language": "python", "parameters": "(self, window_name, object_name, iterations)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "arg_0", ".", "verifyscrollbarhorizontal", "(", "arg_1", ",", "arg_2", ")", ":", "raise", "LdtpServerException", "(", "'Object not horizontal scrollbar'", ")", "arg_4", "=", "arg_0", ".", "_get_object_handle", "(", "arg_1", ",", "arg_2", ")", "arg_5", "=", "0", "arg_6", "=", "1.0", "/", "8", "arg_7", "=", "False", "while", "arg_5", "<", "arg_3", ":", "if", "arg_4", ".", "AXValue", "<=", "0", ":", "raise", "LdtpServerException", "(", "'Minimum limit reached'", ")", "arg_4", ".", "AXValue", "-=", "arg_6", "time", ".", "sleep", "(", "1.0", "/", "100", ")", "arg_7", "=", "True", "arg_5", "+=", "1", "if", "arg_7", ":", "return", "1", "else", ":", "raise", "LdtpServerException", "(", "'Unable to decrease scrollbar'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Press scrollbar left with number of iterations\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n        @param interations: iterations to perform on slider increase\n        @type iterations: integer\n\n        @return: 1 on success.\n        @rtype: integer\n        \"\"\"\n        if not arg_0.verifyscrollbarhorizontal(arg_1, arg_2):\n            raise LdtpServerException('Object not horizontal scrollbar')\n        arg_4 = arg_0._get_object_handle(arg_1, arg_2)\n        arg_5 = 0\n        arg_6 = 1.0 / 8\n        arg_7 = False\n        while arg_5 < arg_3:\n            if arg_4.AXValue <= 0:\n                raise LdtpServerException('Minimum limit reached')\n            arg_4.AXValue -= arg_6\n            time.sleep(1.0 / 100)\n            arg_7 = True\n            arg_5 += 1\n        if arg_7:\n            return 1\n        else:\n            raise LdtpServerException('Unable to decrease scrollbar')", "path": "atomac/ldtpd/value.py", "identifier": "Value.oneleft", "docstring": "Press scrollbar left with number of iterations\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n        @param interations: iterations to perform on slider increase\n        @type iterations: integer\n\n        @return: 1 on success.\n        @rtype: integer", "docstring_tokens": ["Press", "scrollbar", "left", "with", "number", "of", "iterations"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 253801}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L526-L632", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Patch information in an existing table.\n        It only updates fileds that are provided in the request object.", "language": "python", "parameters": "(self,\n                    dataset_id,\n                    table_id,\n                    project_id=None,\n                    description=None,\n                    expiration_time=None,\n                    external_data_configuration=None,\n                    friendly_name=None,\n                    labels=None,\n                    schema=None,\n                    time_partitioning=None,\n                    view=None,\n                    require_partition_filter=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ")", ":", "arg_3", "=", "arg_3", "if", "arg_3", "is", "not", "None", "else", "arg_0", ".", "project_id", "arg_13", "=", "{", "}", "if", "arg_4", "is", "not", "None", ":", "arg_13", "[", "'description'", "]", "=", "arg_4", "if", "arg_5", "is", "not", "None", ":", "arg_13", "[", "'expirationTime'", "]", "=", "arg_5", "if", "arg_6", ":", "arg_13", "[", "'externalDataConfiguration'", "]", "=", "arg_6", "if", "arg_7", "is", "not", "None", ":", "arg_13", "[", "'friendlyName'", "]", "=", "arg_7", "if", "arg_8", ":", "arg_13", "[", "'labels'", "]", "=", "arg_8", "if", "arg_9", ":", "arg_13", "[", "'schema'", "]", "=", "{", "'fields'", ":", "arg_9", "}", "if", "arg_10", ":", "arg_13", "[", "'timePartitioning'", "]", "=", "arg_10", "if", "arg_11", ":", "arg_13", "[", "'view'", "]", "=", "arg_11", "if", "arg_12", "is", "not", "None", ":", "arg_13", "[", "'requirePartitionFilter'", "]", "=", "arg_12", "arg_0", ".", "log", ".", "info", "(", "'Patching Table %s:%s.%s'", ",", "arg_3", ",", "arg_1", ",", "arg_2", ")", "try", ":", "arg_0", ".", "service", ".", "tables", "(", ")", ".", "patch", "(", "projectId", "=", "arg_3", ",", "datasetId", "=", "arg_1", ",", "tableId", "=", "arg_2", ",", "body", "=", "arg_13", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "arg_0", ".", "log", ".", "info", "(", "'Table patched successfully: %s:%s.%s'", ",", "arg_3", ",", "arg_1", ",", "arg_2", ")", "except", "HttpError", "as", "err", ":", "raise", "AirflowException", "(", "'BigQuery job failed. Error was: {}'", ".", "format", "(", "err", ".", "content", ")", ")"], "function": "def Func(arg_0,\n                    arg_1,\n                    arg_2,\n                    arg_3=None,\n                    arg_4=None,\n                    arg_5=None,\n                    arg_6=None,\n                    arg_7=None,\n                    arg_8=None,\n                    arg_9=None,\n                    arg_10=None,\n                    arg_11=None,\n                    arg_12=None):\n        \"\"\"\n        Patch information in an existing table.\n        It only updates fileds that are provided in the request object.\n\n        Reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/patch\n\n        :param dataset_id: The dataset containing the table to be patched.\n        :type dataset_id: str\n        :param table_id: The Name of the table to be patched.\n        :type table_id: str\n        :param project_id: The project containing the table to be patched.\n        :type project_id: str\n        :param description: [Optional] A user-friendly description of this table.\n        :type description: str\n        :param expiration_time: [Optional] The time when this table expires,\n            in milliseconds since the epoch.\n        :type expiration_time: int\n        :param external_data_configuration: [Optional] A dictionary containing\n            properties of a table stored outside of BigQuery.\n        :type external_data_configuration: dict\n        :param friendly_name: [Optional] A descriptive name for this table.\n        :type friendly_name: str\n        :param labels: [Optional] A dictionary containing labels associated with this table.\n        :type labels: dict\n        :param schema: [Optional] If set, the schema field list as defined here:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.schema\n            The supported schema modifications and unsupported schema modification are listed here:\n            https://cloud.google.com/bigquery/docs/managing-table-schemas\n            **Example**: ::\n\n                schema=[{\"name\": \"emp_name\", \"type\": \"STRING\", \"mode\": \"REQUIRED\"},\n                               {\"name\": \"salary\", \"type\": \"INTEGER\", \"mode\": \"NULLABLE\"}]\n\n        :type schema: list\n        :param time_partitioning: [Optional] A dictionary containing time-based partitioning\n             definition for the table.\n        :type time_partitioning: dict\n        :param view: [Optional] A dictionary containing definition for the view.\n            If set, it will patch a view instead of a table:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#view\n            **Example**: ::\n\n                view = {\n                    \"query\": \"SELECT * FROM `test-project-id.test_dataset_id.test_table_prefix*` LIMIT 500\",\n                    \"useLegacySql\": False\n                }\n\n        :type view: dict\n        :param require_partition_filter: [Optional] If true, queries over the this table require a\n            partition filter. If false, queries over the table\n        :type require_partition_filter: bool\n\n        \"\"\"\n\n        arg_3 = arg_3 if arg_3 is not None else arg_0.project_id\n\n        arg_13 = {}\n\n        if arg_4 is not None:\n            arg_13['description'] = arg_4\n        if arg_5 is not None:\n            arg_13['expirationTime'] = arg_5\n        if arg_6:\n            arg_13['externalDataConfiguration'] = arg_6\n        if arg_7 is not None:\n            arg_13['friendlyName'] = arg_7\n        if arg_8:\n            arg_13['labels'] = arg_8\n        if arg_9:\n            arg_13['schema'] = {'fields': arg_9}\n        if arg_10:\n            arg_13['timePartitioning'] = arg_10\n        if arg_11:\n            arg_13['view'] = arg_11\n        if arg_12 is not None:\n            arg_13['requirePartitionFilter'] = arg_12\n\n        arg_0.log.info('Patching Table %s:%s.%s',\n                      arg_3, arg_1, arg_2)\n\n        try:\n            arg_0.service.tables().patch(\n                projectId=arg_3,\n                datasetId=arg_1,\n                tableId=arg_2,\n                body=arg_13).execute(num_retries=arg_0.num_retries)\n\n            arg_0.log.info('Table patched successfully: %s:%s.%s',\n                          arg_3, arg_1, arg_2)\n\n        except HttpError as err:\n            raise AirflowException(\n                'BigQuery job failed. Error was: {}'.format(err.content)\n            )", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryBaseCursor.patch_table", "docstring": "Patch information in an existing table.\n        It only updates fileds that are provided in the request object.\n\n        Reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/patch\n\n        :param dataset_id: The dataset containing the table to be patched.\n        :type dataset_id: str\n        :param table_id: The Name of the table to be patched.\n        :type table_id: str\n        :param project_id: The project containing the table to be patched.\n        :type project_id: str\n        :param description: [Optional] A user-friendly description of this table.\n        :type description: str\n        :param expiration_time: [Optional] The time when this table expires,\n            in milliseconds since the epoch.\n        :type expiration_time: int\n        :param external_data_configuration: [Optional] A dictionary containing\n            properties of a table stored outside of BigQuery.\n        :type external_data_configuration: dict\n        :param friendly_name: [Optional] A descriptive name for this table.\n        :type friendly_name: str\n        :param labels: [Optional] A dictionary containing labels associated with this table.\n        :type labels: dict\n        :param schema: [Optional] If set, the schema field list as defined here:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.schema\n            The supported schema modifications and unsupported schema modification are listed here:\n            https://cloud.google.com/bigquery/docs/managing-table-schemas\n            **Example**: ::\n\n                schema=[{\"name\": \"emp_name\", \"type\": \"STRING\", \"mode\": \"REQUIRED\"},\n                               {\"name\": \"salary\", \"type\": \"INTEGER\", \"mode\": \"NULLABLE\"}]\n\n        :type schema: list\n        :param time_partitioning: [Optional] A dictionary containing time-based partitioning\n             definition for the table.\n        :type time_partitioning: dict\n        :param view: [Optional] A dictionary containing definition for the view.\n            If set, it will patch a view instead of a table:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#view\n            **Example**: ::\n\n                view = {\n                    \"query\": \"SELECT * FROM `test-project-id.test_dataset_id.test_table_prefix*` LIMIT 500\",\n                    \"useLegacySql\": False\n                }\n\n        :type view: dict\n        :param require_partition_filter: [Optional] If true, queries over the this table require a\n            partition filter. If false, queries over the table\n        :type require_partition_filter: bool", "docstring_tokens": ["Patch", "information", "in", "an", "existing", "table", ".", "It", "only", "updates", "fileds", "that", "are", "provided", "in", "the", "request", "object", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253802}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/setup.py#L60-L71", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Remove all binary files in the adslib directory.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "(", "\"adslib/*.a\"", ",", "\"adslib/*.o\"", ",", "\"adslib/obj/*.o\"", ",", "\"adslib/*.bin\"", ",", "\"adslib/*.so\"", ",", ")", "for", "arg_1", "in", "functools", ".", "reduce", "(", "operator", ".", "iconcat", ",", "[", "glob", ".", "glob", "(", "p", ")", "for", "p", "in", "arg_0", "]", ")", ":", "os", ".", "remove", "(", "arg_1", ")"], "function": "def Func():\r\n    \"\"\"Remove all binary files in the adslib directory.\"\"\"\r\n    arg_0 = (\r\n        \"adslib/*.a\",\r\n        \"adslib/*.o\",\r\n        \"adslib/obj/*.o\",\r\n        \"adslib/*.bin\",\r\n        \"adslib/*.so\",\r\n    )\r\n\r\n    for arg_1 in functools.reduce(operator.iconcat, [glob.glob(p) for p in arg_0]):\r\n        os.remove(arg_1)", "path": "setup.py", "identifier": "remove_binaries", "docstring": "Remove all binary files in the adslib directory.", "docstring_tokens": ["Remove", "all", "binary", "files", "in", "the", "adslib", "directory", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 253803}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L262-L271", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Validate a string as a valid storage path", "language": "python", "parameters": "(cls, path, projects_allowed=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "not", "arg_1", "or", "not", "isinstance", "(", "arg_1", ",", "str", ")", "or", "arg_1", "[", "0", "]", "!=", "'/'", "or", "arg_1", "==", "'/'", ":", "raise", "StorageArgumentException", "(", "'The path must be a string, start with a slash (/), and be longer'", "' than 1 character.'", ")", "if", "not", "arg_2", "and", "len", "(", "[", "arg_3", "for", "arg_3", "in", "arg_1", ".", "split", "(", "'/'", ")", "if", "arg_3", "]", ")", "==", "1", ":", "raise", "StorageArgumentException", "(", "'This method does not accept projects in the path.'", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        '''Validate a string as a valid storage path'''\n\n        if not arg_1 or not isinstance(arg_1, str) or arg_1[0] != '/' or arg_1 == '/':\n            raise StorageArgumentException(\n                'The path must be a string, start with a slash (/), and be longer'\n                ' than 1 character.')\n        if not arg_2 and len([arg_3 for arg_3 in arg_1.split('/') if arg_3]) == 1:\n            raise StorageArgumentException(\n                'This method does not accept projects in the path.')", "path": "hbp_service_client/storage_service/client.py", "identifier": "Client.__validate_storage_path", "docstring": "Validate a string as a valid storage path", "docstring_tokens": ["Validate", "a", "string", "as", "a", "valid", "storage", "path"], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 253804}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/NonUniformImage.py#L13-L84", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Used to plot a set of coordinates.", "language": "python", "parameters": "(x, y, z, ax=None, fig=None, cmap=None, alpha=None, scalex=True, scaley=True, add_cbar=True, **kwargs)", "return_statement": "return _SI(im=im, cb=cb, cax=cax)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "True", ",", "arg_8", "=", "True", ",", "arg_9", "=", "True", ",", "**", "arg_10", ")", ":", "if", "arg_3", "is", "None", "and", "arg_4", "is", "None", ":", "arg_4", ",", "arg_3", "=", "_setup_axes", "(", ")", "elif", "arg_3", "is", "None", ":", "arg_3", "=", "arg_4", ".", "gca", "(", ")", "elif", "arg_4", "is", "None", ":", "arg_4", "=", "arg_3", ".", "get_figure", "(", ")", "arg_11", "=", "arg_10", ".", "get", "(", "'norm'", ",", "None", ")", "arg_12", "=", "_mplim", ".", "Func", "(", "arg_3", ",", "**", "arg_10", ")", "arg_13", "=", "arg_10", ".", "pop", "(", "'vmin'", ",", "_np", ".", "min", "(", "arg_2", ")", ")", "arg_14", "=", "arg_10", ".", "pop", "(", "'vmax'", ",", "_np", ".", "max", "(", "arg_2", ")", ")", "if", "arg_5", "is", "not", "None", ":", "arg_12", ".", "set_cmap", "(", "arg_5", ")", "arg_15", "=", "_cm", ".", "ScalarMappable", "(", "arg_5", "=", "arg_12", ".", "get_cmap", "(", ")", ",", "arg_11", "=", "arg_11", ")", "arg_15", ".", "set_array", "(", "arg_2", ")", "if", "arg_9", ":", "arg_16", ",", "arg_17", "=", "_cb", "(", "arg_3", "=", "arg_3", ",", "arg_12", "=", "arg_15", ",", "arg_4", "=", "arg_4", ")", "if", "arg_6", "is", "not", "None", ":", "arg_12", ".", "set_alpha", "(", "arg_6", ")", "arg_12", ".", "set_data", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_3", ".", "images", ".", "append", "(", "arg_12", ")", "if", "arg_7", ":", "arg_18", "=", "min", "(", "arg_0", ")", "arg_19", "=", "max", "(", "arg_0", ")", "arg_3", ".", "set_xlim", "(", "arg_18", ",", "arg_19", ")", "if", "arg_8", ":", "arg_20", "=", "min", "(", "arg_1", ")", "arg_21", "=", "max", "(", "arg_1", ")", "arg_3", ".", "set_ylim", "(", "arg_20", ",", "arg_21", ")", "return", "_SI", "(", "arg_12", "=", "arg_12", ",", "arg_17", "=", "arg_17", ",", "arg_16", "=", "arg_16", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=None, arg_7=True, arg_8=True, arg_9=True, **arg_10):\n    \"\"\"\n    Used to plot a set of coordinates.\n\n\n    Parameters\n    ----------\n    x, y : :class:`numpy.ndarray`\n        1-D ndarrays of lengths N and M, respectively, specifying pixel centers\n    z : :class:`numpy.ndarray`\n        An (M, N) ndarray or masked array of values to be colormapped, or a (M, N, 3) RGB array, or a (M, N, 4) RGBA array.\n    ax : :class:`matplotlib.axes.Axes`, optional\n        The axis to plot to.\n    fig : :class:`matplotlib.figure.Figure`, optional\n        The figure to plot to.\n    cmap : :class:`matplotlib.colors.Colormap`, optional\n        The colormap to use.\n    alpha : float, optional\n        The transparency to use.\n    scalex : bool, optional\n        To set the x limits to available data\n    scaley : bool, optional\n        To set the y limits to available data\n    add_cbar : bool, optional\n        Whether ot add a colorbar or not.\n\n    Returns\n    -------\n    img : :class:`matplotlib.image.Func`\n        Object representing the :class:`matplotlib.image.Func`.\n    \"\"\"\n    if arg_3 is None and arg_4 is None:\n        arg_4, arg_3 = _setup_axes()\n    elif arg_3 is None:\n        arg_3 = arg_4.gca()\n    elif arg_4 is None:\n        arg_4 = arg_3.get_figure()\n\n    arg_11 = arg_10.get('norm', None)\n\n    arg_12 = _mplim.Func(arg_3, **arg_10)\n\n    arg_13 = arg_10.pop('vmin', _np.min(arg_2))\n    arg_14 = arg_10.pop('vmax', _np.max(arg_2))\n    # im.set_clim(vmin=vmin, vmax=vmax)\n\n    if arg_5 is not None:\n        arg_12.set_cmap(arg_5)\n\n    arg_15 = _cm.ScalarMappable(arg_5=arg_12.get_cmap(), arg_11=arg_11)\n    arg_15.set_array(arg_2)\n\n    if arg_9:\n        arg_16, arg_17 = _cb(arg_3=arg_3, arg_12=arg_15, arg_4=arg_4)\n\n    if arg_6 is not None:\n        arg_12.set_alpha(arg_6)\n\n    arg_12.set_data(arg_0, arg_1, arg_2)\n    arg_3.images.append(arg_12)\n\n    if arg_7:\n        arg_18 = min(arg_0)\n        arg_19 = max(arg_0)\n        arg_3.set_xlim(arg_18, arg_19)\n\n    if arg_8:\n        arg_20 = min(arg_1)\n        arg_21 = max(arg_1)\n        arg_3.set_ylim(arg_20, arg_21)\n\n    return _SI(arg_12=arg_12, arg_17=arg_17, arg_16=arg_16)", "path": "scisalt/matplotlib/NonUniformImage.py", "identifier": "NonUniformImage", "docstring": "Used to plot a set of coordinates.\n\n\n    Parameters\n    ----------\n    x, y : :class:`numpy.ndarray`\n        1-D ndarrays of lengths N and M, respectively, specifying pixel centers\n    z : :class:`numpy.ndarray`\n        An (M, N) ndarray or masked array of values to be colormapped, or a (M, N, 3) RGB array, or a (M, N, 4) RGBA array.\n    ax : :class:`matplotlib.axes.Axes`, optional\n        The axis to plot to.\n    fig : :class:`matplotlib.figure.Figure`, optional\n        The figure to plot to.\n    cmap : :class:`matplotlib.colors.Colormap`, optional\n        The colormap to use.\n    alpha : float, optional\n        The transparency to use.\n    scalex : bool, optional\n        To set the x limits to available data\n    scaley : bool, optional\n        To set the y limits to available data\n    add_cbar : bool, optional\n        Whether ot add a colorbar or not.\n\n    Returns\n    -------\n    img : :class:`matplotlib.image.NonUniformImage`\n        Object representing the :class:`matplotlib.image.NonUniformImage`.", "docstring_tokens": ["Used", "to", "plot", "a", "set", "of", "coordinates", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 253805}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/views.py#L147-L177", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Edit additional information about a panel gene.", "language": "python", "parameters": "(panel_id, hgnc_id)", "return_statement": "return dict(panel=panel_obj, form=form, gene=hgnc_gene, panel_gene=panel_gene)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "store", ".", "panel", "(", "arg_0", ")", "arg_3", "=", "store", ".", "hgnc_gene", "(", "arg_1", ")", "arg_4", "=", "controllers", ".", "existing_gene", "(", "store", ",", "arg_2", ",", "arg_1", ")", "arg_5", "=", "PanelGeneForm", "(", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_3", "[", "'transcripts'", "]", ":", "if", "arg_7", ".", "get", "(", "'refseq_id'", ")", ":", "arg_8", "=", "arg_7", ".", "get", "(", "'refseq_id'", ")", "arg_6", ".", "append", "(", "(", "arg_8", ",", "arg_8", ")", ")", "arg_5", ".", "disease_associated_transcripts", ".", "choices", "=", "arg_6", "if", "arg_5", ".", "validate_on_submit", "(", ")", ":", "arg_11", "=", "'edit'", "if", "arg_4", "else", "'add'", "arg_12", "=", "arg_5", ".", "data", ".", "copy", "(", ")", "if", "'csrf_token'", "in", "arg_12", ":", "del", "arg_12", "[", "'csrf_token'", "]", "store", ".", "add_pending", "(", "arg_2", ",", "arg_3", ",", "arg_11", "=", "arg_11", ",", "info", "=", "arg_12", ")", "return", "redirect", "(", "url_for", "(", "'.panel'", ",", "arg_0", "=", "arg_0", ")", ")", "if", "arg_4", ":", "for", "arg_13", "in", "[", "'disease_associated_transcripts'", ",", "'reduced_penetrance'", ",", "'mosaicism'", ",", "'inheritance_models'", ",", "'database_entry_version'", ",", "'comment'", "]", ":", "arg_14", "=", "getattr", "(", "arg_5", ",", "arg_13", ")", "if", "not", "arg_14", ".", "data", ":", "arg_15", "=", "arg_4", ".", "get", "(", "arg_13", ")", "if", "arg_15", "is", "not", "None", ":", "arg_14", ".", "process_data", "(", "arg_15", ")", "return", "dict", "(", "panel", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", "gene", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Edit additional information about a panel gene.\"\"\"\n    arg_2 = store.panel(arg_0)\n    arg_3 = store.hgnc_gene(arg_1)\n    arg_4 = controllers.existing_gene(store, arg_2, arg_1)\n\n    arg_5 = PanelGeneForm()\n    arg_6 = []\n    for arg_7 in arg_3['transcripts']:\n        if arg_7.get('refseq_id'):\n            arg_8 = arg_7.get('refseq_id')\n            arg_6.append((arg_8, arg_8))\n    arg_5.disease_associated_transcripts.choices = arg_6\n\n    if arg_5.validate_on_submit():\n        arg_11 = 'edit' if arg_4 else 'add'\n        arg_12 = arg_5.data.copy()\n        if 'csrf_token' in arg_12:\n            del arg_12['csrf_token']\n        store.add_pending(arg_2, arg_3, arg_11=arg_11, info=arg_12)\n        return redirect(url_for('.panel', arg_0=arg_0))\n\n    if arg_4:\n        for arg_13 in ['disease_associated_transcripts', 'reduced_penetrance',\n                          'mosaicism', 'inheritance_models', 'database_entry_version', 'comment']:\n            arg_14 = getattr(arg_5, arg_13)\n            if not arg_14.data:\n                arg_15 = arg_4.get(arg_13)\n                if arg_15 is not None:\n                    arg_14.process_data(arg_15)\n    return dict(panel=arg_2, arg_5=arg_5, gene=arg_3, arg_4=arg_4)", "path": "scout/server/blueprints/panels/views.py", "identifier": "gene_edit", "docstring": "Edit additional information about a panel gene.", "docstring_tokens": ["Edit", "additional", "information", "about", "a", "panel", "gene", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253806}
{"url": "https://github.com/mcs07/MolVS/blob/d815fe52d160abcecbcbf117e6437bf727dbd8ad/molvs/validate.py#L105-L119", "sha": "d815fe52d160abcecbcbf117e6437bf727dbd8ad", "docstring_summary": "Return log messages for a given SMILES string using the default validations.", "language": "python", "parameters": "(smiles)", "return_statement": "return logs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Chem", ".", "MolFromSmiles", "(", "arg_0", ")", "arg_2", "=", "Validator", "(", ")", ".", "validate", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Return log messages for a given SMILES string using the default validations.\n\n    Note: This is a convenience function for quickly validating a single SMILES string. It is more efficient to use\n    the :class:`~molvs.validate.Validator` class directly when working with many molecules or when custom options\n    are needed.\n\n    :param string smiles: The SMILES for the molecule.\n    :returns: A list of log messages.\n    :rtype: list of strings.\n    \"\"\"\n    # Skip sanitize as standardize does this anyway\n    arg_1 = Chem.MolFromSmiles(arg_0)\n    arg_2 = Validator().validate(arg_1)\n    return arg_2", "path": "molvs/validate.py", "identifier": "validate_smiles", "docstring": "Return log messages for a given SMILES string using the default validations.\n\n    Note: This is a convenience function for quickly validating a single SMILES string. It is more efficient to use\n    the :class:`~molvs.validate.Validator` class directly when working with many molecules or when custom options\n    are needed.\n\n    :param string smiles: The SMILES for the molecule.\n    :returns: A list of log messages.\n    :rtype: list of strings.", "docstring_tokens": ["Return", "log", "messages", "for", "a", "given", "SMILES", "string", "using", "the", "default", "validations", "."], "nwo": "mcs07/MolVS", "score": 0.5162715334407971, "idx": 253807}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L171-L183", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Add a description to a controlled vocabulary.", "language": "python", "parameters": "(self, cv_id, lang_ref, description=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "not", "in", "arg_0", ".", "languages", ":", "raise", "ValueError", "(", "'Language not present: {}'", ".", "format", "(", "arg_2", ")", ")", "arg_0", ".", "controlled_vocabularies", "[", "arg_1", "]", "[", "0", "]", ".", "append", "(", "(", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Add a description to a controlled vocabulary.\n\n        :param str cv_id: Name of the controlled vocabulary to add the\n            description.\n        :param str lang_ref: Language reference.\n        :param str description: Description, this can be none.\n        :throws KeyError: If there is no controlled vocabulary with that id.\n        :throws ValueError: If the language provided doesn't exist.\n        \"\"\"\n        if arg_2 not in arg_0.languages:\n            raise ValueError('Language not present: {}'.format(arg_2))\n        arg_0.controlled_vocabularies[arg_1][0].append((arg_2, arg_3))", "path": "pympi/Elan.py", "identifier": "Eaf.add_cv_description", "docstring": "Add a description to a controlled vocabulary.\n\n        :param str cv_id: Name of the controlled vocabulary to add the\n            description.\n        :param str lang_ref: Language reference.\n        :param str description: Description, this can be none.\n        :throws KeyError: If there is no controlled vocabulary with that id.\n        :throws ValueError: If the language provided doesn't exist.", "docstring_tokens": ["Add", "a", "description", "to", "a", "controlled", "vocabulary", "."], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 253808}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/idaho.py#L138-L217", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Downloads a native resolution, orthorectified chip in tif format\n        from a user-specified catalog id.", "language": "python", "parameters": "(self, coordinates, catid, chip_type='PAN', chip_format='TIF', filename='chip.tif')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'PAN'", ",", "arg_4", "=", "'TIF'", ",", "arg_5", "=", "'chip.tif'", ")", ":", "def", "t2s1", "(", "arg_6", ")", ":", "return", "str", "(", "arg_6", ")", ".", "strip", "(", "'(,)'", ")", ".", "replace", "(", "','", ",", "''", ")", "def", "t2s2", "(", "arg_6", ")", ":", "return", "str", "(", "arg_6", ")", ".", "strip", "(", "'(,)'", ")", ".", "replace", "(", "' '", ",", "''", ")", "if", "len", "(", "arg_1", ")", "!=", "4", ":", "print", "(", "'Wrong coordinate entry'", ")", "return", "False", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", "=", "arg_1", "arg_11", "=", "(", "(", "arg_7", ",", "arg_8", ")", ",", "(", "arg_7", ",", "arg_10", ")", ",", "(", "arg_9", ",", "arg_10", ")", ",", "(", "arg_9", ",", "arg_8", ")", ",", "(", "arg_7", ",", "arg_8", ")", ")", "arg_12", "=", "'POLYGON (('", "+", "','", ".", "join", "(", "[", "t2s1", "(", "corner", ")", "for", "corner", "in", "arg_11", "]", ")", "+", "'))'", "arg_13", "=", "arg_0", ".", "get_images_by_catid_and_aoi", "(", "arg_2", "=", "arg_2", ",", "aoi_wkt", "=", "arg_12", ")", "arg_14", "=", "arg_0", ".", "describe_images", "(", "arg_13", ")", "arg_15", ",", "arg_16", ",", "arg_17", "=", "None", ",", "None", ",", "0", "for", "arg_2", ",", "arg_18", "in", "arg_14", ".", "items", "(", ")", ":", "for", "arg_19", ",", "arg_20", "in", "arg_18", "[", "'parts'", "]", ".", "items", "(", ")", ":", "if", "'PAN'", "in", "arg_20", ".", "keys", "(", ")", ":", "arg_15", "=", "arg_20", "[", "'PAN'", "]", "[", "'id'", "]", "arg_21", "=", "arg_20", "[", "'PAN'", "]", "[", "'bucket'", "]", "if", "'WORLDVIEW_8_BAND'", "in", "arg_20", ".", "keys", "(", ")", ":", "arg_16", "=", "arg_20", "[", "'WORLDVIEW_8_BAND'", "]", "[", "'id'", "]", "arg_17", "=", "8", "arg_21", "=", "arg_20", "[", "'WORLDVIEW_8_BAND'", "]", "[", "'bucket'", "]", "elif", "'RGBN'", "in", "arg_20", ".", "keys", "(", ")", ":", "arg_16", "=", "arg_20", "[", "'RGBN'", "]", "[", "'id'", "]", "arg_17", "=", "4", "arg_21", "=", "arg_20", "[", "'RGBN'", "]", "[", "'bucket'", "]", "arg_22", "=", "''", "if", "arg_3", "==", "'PAN'", ":", "arg_22", "=", "arg_15", "+", "'?bands=0'", "elif", "arg_3", "==", "'MS'", ":", "arg_22", "=", "arg_16", "+", "'?'", "elif", "arg_3", "==", "'PS'", ":", "if", "arg_17", "==", "8", ":", "arg_22", "=", "arg_16", "+", "'?bands=4,2,1&panId='", "+", "arg_15", "elif", "arg_17", "==", "4", ":", "arg_22", "=", "arg_16", "+", "'?bands=0,1,2&panId='", "+", "arg_15", "arg_23", "=", "'&upperLeft={}&lowerRight={}'", ".", "format", "(", "t2s2", "(", "(", "arg_7", ",", "arg_10", ")", ")", ",", "t2s2", "(", "(", "arg_9", ",", "arg_8", ")", ")", ")", "arg_24", "=", "'https://idaho.geobigdata.io/v1/chip/bbox/'", "+", "arg_21", "+", "'/'", "arg_25", "=", "arg_24", "+", "arg_22", "+", "arg_23", "arg_25", "+=", "'&format='", "+", "arg_4", "+", "'&token='", "+", "arg_0", ".", "gbdx_connection", ".", "access_token", "arg_26", "=", "requests", ".", "get", "(", "arg_25", ")", "if", "arg_26", ".", "status_code", "==", "200", ":", "with", "open", "(", "arg_5", ",", "'wb'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_26", ".", "content", ")", "return", "True", "else", ":", "print", "(", "'Cannot download chip'", ")", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='PAN', arg_4='TIF', arg_5='chip.tif'):\n        \"\"\"Downloads a native resolution, orthorectified chip in tif format\n        from a user-specified catalog id.\n\n        Args:\n            coordinates (list): Rectangle coordinates in order West, South, East, North.\n                                West and East are longitudes, North and South are latitudes.\n                                The maximum chip size is (2048 pix)x(2048 pix)\n            catid (str): The image catalog id.\n            chip_type (str): 'PAN' (panchromatic), 'MS' (multispectral), 'PS' (pansharpened).\n                             'MS' is 4 or 8 bands depending on sensor.\n            chip_format (str): 'TIF' or 'PNG'\n            filename (str): Where to save chip.\n\n        Returns:\n            True if chip is successfully downloaded; else False.\n        \"\"\"\n\n        def t2s1(arg_6):\n            # Tuple to string 1\n            return str(arg_6).strip('(,)').replace(',', '')\n\n        def t2s2(arg_6):\n            # Tuple to string 2\n            return str(arg_6).strip('(,)').replace(' ', '')\n\n        if len(arg_1) != 4:\n            print('Wrong coordinate entry')\n            return False\n\n        arg_7, arg_8, arg_9, arg_10 = arg_1\n        arg_11 = ((arg_7, arg_8), (arg_7, arg_10), (arg_9, arg_10), (arg_9, arg_8), (arg_7, arg_8))\n        arg_12 = 'POLYGON ((' + ','.join([t2s1(corner) for corner in arg_11]) + '))'\n\n        # get IDAHO images which intersect box\n        arg_13 = arg_0.get_images_by_catid_and_aoi(arg_2=arg_2, aoi_wkt=arg_12)\n        arg_14 = arg_0.describe_images(arg_13)\n\n        arg_15, arg_16, arg_17 = None, None, 0\n        for arg_2, arg_18 in arg_14.items():\n            for arg_19, arg_20 in arg_18['parts'].items():\n                if 'PAN' in arg_20.keys():\n                    arg_15 = arg_20['PAN']['id']\n                    arg_21 = arg_20['PAN']['bucket']\n                if 'WORLDVIEW_8_BAND' in arg_20.keys():\n                    arg_16 = arg_20['WORLDVIEW_8_BAND']['id']\n                    arg_17 = 8\n                    arg_21 = arg_20['WORLDVIEW_8_BAND']['bucket']\n                elif 'RGBN' in arg_20.keys():\n                    arg_16 = arg_20['RGBN']['id']\n                    arg_17 = 4\n                    arg_21 = arg_20['RGBN']['bucket']\n\n        # specify band information\n        arg_22 = ''\n        if arg_3 == 'PAN':\n            arg_22 = arg_15 + '?bands=0'\n        elif arg_3 == 'MS':\n            arg_22 = arg_16 + '?'\n        elif arg_3 == 'PS':\n            if arg_17 == 8:\n                arg_22 = arg_16 + '?bands=4,2,1&panId=' + arg_15\n            elif arg_17 == 4:\n                arg_22 = arg_16 + '?bands=0,1,2&panId=' + arg_15\n\n        # specify location information\n        arg_23 = '&upperLeft={}&lowerRight={}'.format(t2s2((arg_7, arg_10)), t2s2((arg_9, arg_8)))\n\n        arg_24 = 'https://idaho.geobigdata.io/v1/chip/bbox/' + arg_21 + '/'\n        arg_25 = arg_24 + arg_22 + arg_23\n        arg_25 += '&format=' + arg_4 + '&token=' + arg_0.gbdx_connection.access_token\n        arg_26 = requests.get(arg_25)\n\n        if arg_26.status_code == 200:\n            with open(arg_5, 'wb') as f:\n                f.write(arg_26.content)\n                return True\n        else:\n            print('Cannot download chip')\n            return False", "path": "gbdxtools/idaho.py", "identifier": "Idaho.get_chip", "docstring": "Downloads a native resolution, orthorectified chip in tif format\n        from a user-specified catalog id.\n\n        Args:\n            coordinates (list): Rectangle coordinates in order West, South, East, North.\n                                West and East are longitudes, North and South are latitudes.\n                                The maximum chip size is (2048 pix)x(2048 pix)\n            catid (str): The image catalog id.\n            chip_type (str): 'PAN' (panchromatic), 'MS' (multispectral), 'PS' (pansharpened).\n                             'MS' is 4 or 8 bands depending on sensor.\n            chip_format (str): 'TIF' or 'PNG'\n            filename (str): Where to save chip.\n\n        Returns:\n            True if chip is successfully downloaded; else False.", "docstring_tokens": ["Downloads", "a", "native", "resolution", "orthorectified", "chip", "in", "tif", "format", "from", "a", "user", "-", "specified", "catalog", "id", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 253809}
{"url": "https://github.com/klen/muffin-peewee/blob/8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e/muffin_peewee/mpeewee.py#L146-L153", "sha": "8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e", "docstring_summary": "Release waiters.", "language": "python", "parameters": "(self, conn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "super", "(", "PooledAIODatabase", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "_waiters", ":", "if", "not", "arg_2", ".", "done", "(", ")", ":", "logger", ".", "debug", "(", "'Release a waiter'", ")", "arg_2", ".", "set_result", "(", "True", ")", "break"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Release waiters.\"\"\"\n        super(PooledAIODatabase, arg_0).Func(arg_1)\n        for arg_2 in arg_0._waiters:\n            if not arg_2.done():\n                logger.debug('Release a waiter')\n                arg_2.set_result(True)\n                break", "path": "muffin_peewee/mpeewee.py", "identifier": "PooledAIODatabase._close", "docstring": "Release waiters.", "docstring_tokens": ["Release", "waiters", "."], "nwo": "klen/muffin-peewee", "score": 0.16638194949711382, "idx": 253810}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/github/__init__.py#L14-L31", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Returns a list of the names of US Government GitHub organizations", "language": "python", "parameters": "()", "return_statement": "return list(us_gov_github_orgs)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "set", "(", ")", "Func", "=", "requests", ".", "get", "(", "'https://government.github.com/organizations.json'", ")", ".", "json", "(", ")", "arg_0", ".", "update", "(", "Func", "[", "'governments'", "]", "[", "'U.S. Federal'", "]", ")", "arg_0", ".", "update", "(", "Func", "[", "'governments'", "]", "[", "'U.S. Military and Intelligence'", "]", ")", "arg_0", ".", "update", "(", "Func", "[", "'research'", "]", "[", "'U.S. Research Labs'", "]", ")", "return", "list", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"\n    Returns a list of the names of US Government GitHub organizations\n\n    Based on: https://government.github.com/community/\n\n    Exmample return:\n        {'llnl', '18f', 'gsa', 'dhs-ncats', 'spack', ...}\n    \"\"\"\n    arg_0 = set()\n\n    Func = requests.get('https://government.github.com/organizations.json').json()\n\n    arg_0.update(Func['governments']['U.S. Federal'])\n    arg_0.update(Func['governments']['U.S. Military and Intelligence'])\n    arg_0.update(Func['research']['U.S. Research Labs'])\n\n    return list(arg_0)", "path": "scraper/github/__init__.py", "identifier": "gov_orgs", "docstring": "Returns a list of the names of US Government GitHub organizations\n\n    Based on: https://government.github.com/community/\n\n    Exmample return:\n        {'llnl', '18f', 'gsa', 'dhs-ncats', 'spack', ...}", "docstring_tokens": ["Returns", "a", "list", "of", "the", "names", "of", "US", "Government", "GitHub", "organizations"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 253811}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/nodes.py#L64-L77", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "Lists all the client nodes registered with Nomad.", "language": "python", "parameters": "(self, prefix=None)", "return_statement": "return self.request(method=\"get\", params=params).json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "{", "\"prefix\"", ":", "arg_1", "}", "return", "arg_0", ".", "request", "(", "method", "=", "\"get\"", ",", "arg_2", "=", "arg_2", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\" Lists all the client nodes registered with Nomad.\n\n           https://www.nomadproject.io/docs/http/nodes.html\n            arguments:\n              - prefix :(str) optional, specifies a string to filter nodes on based on an prefix.\n                        This is specified as a querystring parameter.\n            returns: list\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_2 = {\"prefix\": arg_1}\n        return arg_0.request(method=\"get\", arg_2=arg_2).json()", "path": "nomad/api/nodes.py", "identifier": "Nodes.get_nodes", "docstring": "Lists all the client nodes registered with Nomad.\n\n           https://www.nomadproject.io/docs/http/nodes.html\n            arguments:\n              - prefix :(str) optional, specifies a string to filter nodes on based on an prefix.\n                        This is specified as a querystring parameter.\n            returns: list\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["Lists", "all", "the", "client", "nodes", "registered", "with", "Nomad", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 253812}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L637-L662", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Generate an HTML report.", "language": "python", "parameters": "(self, morfs=None, directory=None, ignore_errors=None,\n                    omit=None, include=None, extra_css=None, title=None)", "return_statement": "return reporter.report(morfs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ")", ":", "arg_0", ".", "_harvest_data", "(", ")", "arg_0", ".", "config", ".", "from_args", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "html_dir", "=", "arg_2", ",", "arg_6", "=", "arg_6", ",", "html_title", "=", "arg_7", ",", ")", "arg_8", "=", "HtmlReporter", "(", "arg_0", ",", "arg_0", ".", "config", ")", "return", "arg_8", ".", "report", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n                    arg_4=None, arg_5=None, arg_6=None, arg_7=None):\n        \"\"\"Generate an HTML report.\n\n        The HTML is written to `directory`.  The file \"index.html\" is the\n        overview starting point, with links to more detailed pages for\n        individual modules.\n\n        `extra_css` is a path to a file of other CSS to apply on the page.\n        It will be copied into the HTML directory.\n\n        `title` is a text string (not HTML) to use as the title of the HTML\n        report.\n\n        See `coverage.report()` for other arguments.\n\n        Returns a float, the total percentage covered.\n\n        \"\"\"\n        arg_0._harvest_data()\n        arg_0.config.from_args(\n            arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,\n            html_dir=arg_2, arg_6=arg_6, html_title=arg_7,\n            )\n        arg_8 = HtmlReporter(arg_0, arg_0.config)\n        return arg_8.report(arg_1)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage.html_report", "docstring": "Generate an HTML report.\n\n        The HTML is written to `directory`.  The file \"index.html\" is the\n        overview starting point, with links to more detailed pages for\n        individual modules.\n\n        `extra_css` is a path to a file of other CSS to apply on the page.\n        It will be copied into the HTML directory.\n\n        `title` is a text string (not HTML) to use as the title of the HTML\n        report.\n\n        See `coverage.report()` for other arguments.\n\n        Returns a float, the total percentage covered.", "docstring_tokens": ["Generate", "an", "HTML", "report", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253813}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1841-L1888", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Iterator function traversing the tree below `node` in breadth first search manner.", "language": "python", "parameters": "(node, linked_by=None,\n                                 max_depth=float('inf'),\n                                 with_links=True, in_search=False, predicate=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "arg_3", "(", "'inf'", ")", ",", "arg_4", "=", "True", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ")", ":", "if", "arg_6", "is", "None", ":", "arg_6", "=", "lambda", "x", ":", "True", "arg_7", "=", "IteratorChain", "(", "[", "(", "0", ",", "arg_0", ".", "v_name", ",", "arg_0", ")", "]", ")", "arg_8", "=", "True", "arg_9", "=", "set", "(", "[", "]", ")", "while", "True", ":", "try", ":", "arg_10", ",", "arg_11", ",", "arg_12", "=", "next", "(", "arg_7", ")", "arg_13", "=", "arg_12", ".", "_full_name", "if", "arg_8", "or", "arg_6", "(", "arg_12", ")", ":", "if", "arg_13", "in", "arg_9", ":", "if", "arg_5", ":", "yield", "arg_10", ",", "arg_11", ",", "arg_12", "elif", "arg_10", "<=", "arg_2", ":", "if", "arg_8", ":", "arg_8", "=", "False", "else", ":", "if", "arg_5", ":", "yield", "arg_10", ",", "arg_11", ",", "arg_12", "else", ":", "yield", "arg_12", "if", "arg_13", "in", "arg_1", ":", "arg_9", ".", "add", "(", "arg_13", ")", "if", "not", "arg_12", ".", "_is_leaf", "and", "arg_10", "<", "arg_2", ":", "arg_14", "=", "NaturalNamingInterface", ".", "_make_child_iterator", "(", "arg_12", ",", "arg_4", ",", "current_depth", "=", "arg_10", ")", "arg_7", ".", "add", "(", "arg_14", ")", "except", "StopIteration", ":", "break"], "function": "def Func(arg_0, arg_1=None,\n                                 arg_2=arg_3('inf'),\n                                 arg_4=True, arg_5=False, arg_6=None):\n        \"\"\"Iterator function traversing the tree below `node` in breadth first search manner.\n\n        If `run_name` is given only sub branches of this run are considered and the rest is\n        blinded out.\n\n        \"\"\"\n\n        if arg_6 is None:\n            arg_6 = lambda x: True\n\n        arg_7 = IteratorChain([(0, arg_0.v_name, arg_0)])\n        #iterator_queue = iter([(0, node.v_name, node)])\n        arg_8 = True\n        arg_9 = set([])\n\n        while True:\n            try:\n                arg_10, arg_11, arg_12 = next(arg_7)\n                arg_13 = arg_12._full_name\n                if arg_8 or arg_6(arg_12):\n                    if arg_13 in arg_9:\n                        if arg_5:\n                            # We need to return the node again to check if a link to the node\n                            # has to be found\n                            yield arg_10, arg_11, arg_12\n                    elif arg_10 <= arg_2:\n                        if arg_8:\n                            arg_8 = False\n                        else:\n                            if arg_5:\n                                yield arg_10, arg_11, arg_12\n                            else:\n                                yield arg_12\n\n                        if arg_13 in arg_1:\n                            arg_9.add(arg_13)\n\n                        if not arg_12._is_leaf and arg_10 < arg_2:\n                            arg_14 = NaturalNamingInterface._make_child_iterator(arg_12,\n                                                                        arg_4,\n                                                                        current_depth=arg_10)\n                            arg_7.add(arg_14)\n                            #iterator_queue = itools.chain(iterator_queue, child_iterator)\n            except StopIteration:\n                break", "path": "pypet/naturalnaming.py", "identifier": "NaturalNamingInterface._recursive_traversal_bfs", "docstring": "Iterator function traversing the tree below `node` in breadth first search manner.\n\n        If `run_name` is given only sub branches of this run are considered and the rest is\n        blinded out.", "docstring_tokens": ["Iterator", "function", "traversing", "the", "tree", "below", "node", "in", "breadth", "first", "search", "manner", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253814}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/eos.py#L100-L119", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "First EOS-generic method; should be called by all specific EOSs.\n        For solving for `T`, the EOS must provide the method `solve_T`.\n        For all cases, the EOS must provide `a_alpha_and_derivatives`.\n        Calls `set_from_PT` once done.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "check_sufficient_inputs", "(", ")", "if", "arg_0", ".", "V", ":", "if", "arg_0", ".", "P", ":", "arg_0", ".", "T", "=", "arg_0", ".", "Func_T", "(", "arg_0", ".", "P", ",", "arg_0", ".", "V", ")", "arg_0", ".", "a_alpha", ",", "arg_0", ".", "da_alpha_dT", ",", "arg_0", ".", "d2a_alpha_dT2", "=", "arg_0", ".", "a_alpha_and_derivatives", "(", "arg_0", ".", "T", ")", "else", ":", "arg_0", ".", "a_alpha", ",", "arg_0", ".", "da_alpha_dT", ",", "arg_0", ".", "d2a_alpha_dT2", "=", "arg_0", ".", "a_alpha_and_derivatives", "(", "arg_0", ".", "T", ")", "arg_0", ".", "P", "=", "R", "*", "arg_0", ".", "T", "/", "(", "arg_0", ".", "V", "-", "arg_0", ".", "b", ")", "-", "arg_0", ".", "a_alpha", "/", "(", "arg_0", ".", "V", "*", "arg_0", ".", "V", "+", "arg_0", ".", "delta", "*", "arg_0", ".", "V", "+", "arg_0", ".", "epsilon", ")", "arg_6", "=", "[", "arg_0", ".", "V", ",", "1j", ",", "1j", "]", "else", ":", "arg_0", ".", "a_alpha", ",", "arg_0", ".", "da_alpha_dT", ",", "arg_0", ".", "d2a_alpha_dT2", "=", "arg_0", ".", "a_alpha_and_derivatives", "(", "arg_0", ".", "T", ")", "arg_6", "=", "arg_0", ".", "volume_solutions", "(", "arg_0", ".", "T", ",", "arg_0", ".", "P", ",", "arg_0", ".", "b", ",", "arg_0", ".", "delta", ",", "arg_0", ".", "epsilon", ",", "arg_0", ".", "a_alpha", ")", "arg_0", ".", "set_from_PT", "(", "arg_6", ")"], "function": "def Func(arg_0):\n        '''First EOS-generic method; should be called by all specific EOSs.\n        For solving for `T`, the EOS must provide the method `Func_T`.\n        For all cases, the EOS must provide `a_alpha_and_derivatives`.\n        Calls `set_from_PT` once done.\n        '''\n        arg_0.check_sufficient_inputs()\n        \n        if arg_0.V:\n            if arg_0.P:\n                arg_0.T = arg_0.Func_T(arg_0.P, arg_0.V)\n                arg_0.a_alpha, arg_0.da_alpha_dT, arg_0.d2a_alpha_dT2 = arg_0.a_alpha_and_derivatives(arg_0.T)\n            else:\n                arg_0.a_alpha, arg_0.da_alpha_dT, arg_0.d2a_alpha_dT2 = arg_0.a_alpha_and_derivatives(arg_0.T)\n                arg_0.P = R*arg_0.T/(arg_0.V-arg_0.b) - arg_0.a_alpha/(arg_0.V*arg_0.V + arg_0.delta*arg_0.V + arg_0.epsilon)\n            arg_6 = [arg_0.V, 1j, 1j]\n        else:\n            arg_0.a_alpha, arg_0.da_alpha_dT, arg_0.d2a_alpha_dT2 = arg_0.a_alpha_and_derivatives(arg_0.T)\n            arg_6 = arg_0.volume_solutions(arg_0.T, arg_0.P, arg_0.b, arg_0.delta, arg_0.epsilon, arg_0.a_alpha)\n        arg_0.set_from_PT(arg_6)", "path": "thermo/eos.py", "identifier": "GCEOS.solve", "docstring": "First EOS-generic method; should be called by all specific EOSs.\n        For solving for `T`, the EOS must provide the method `solve_T`.\n        For all cases, the EOS must provide `a_alpha_and_derivatives`.\n        Calls `set_from_PT` once done.", "docstring_tokens": ["First", "EOS", "-", "generic", "method", ";", "should", "be", "called", "by", "all", "specific", "EOSs", ".", "For", "solving", "for", "T", "the", "EOS", "must", "provide", "the", "method", "solve_T", ".", "For", "all", "cases", "the", "EOS", "must", "provide", "a_alpha_and_derivatives", ".", "Calls", "set_from_PT", "once", "done", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 253815}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dsub.py#L560-L589", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Allow provider to extract job-specific metadata from command-line args.", "language": "python", "parameters": "(provider, user_id, job_name, script, task_ids,\n                      user_project, unique_job_id)", "return_statement": "return job_metadata", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "dsub_util", ".", "replace_timezone", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ",", "tzlocal", "(", ")", ")", "arg_1", "=", "arg_1", "or", "dsub_util", ".", "get_os_user", "(", ")", "arg_8", "=", "arg_0", ".", "prepare_job_metadata", "(", "arg_3", ".", "name", ",", "arg_2", ",", "arg_1", ",", "arg_7", ")", "if", "arg_6", ":", "arg_8", "[", "'job-id'", "]", "=", "uuid", ".", "uuid4", "(", ")", ".", "hex", "arg_8", "[", "'create-time'", "]", "=", "arg_7", "arg_8", "[", "'script'", "]", "=", "arg_3", "arg_8", "[", "'user-project'", "]", "=", "arg_5", "if", "arg_4", ":", "arg_8", "[", "'task-ids'", "]", "=", "dsub_util", ".", "compact_interval_string", "(", "list", "(", "arg_4", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                      arg_5, arg_6):\n  \"\"\"Allow provider to extract job-specific metadata from command-line args.\n\n  Args:\n    provider: job service provider\n    user_id: user submitting the job\n    job_name: name for the job\n    script: the script to run\n    task_ids: a set of the task-ids for all tasks in the job\n    user_project: name of the project to be billed for the request\n    unique_job_id: generate a unique job id\n\n  Returns:\n    A dictionary of job-specific metadata (such as job id, name, etc.)\n  \"\"\"\n  arg_7 = dsub_util.replace_timezone(datetime.datetime.now(), tzlocal())\n  arg_1 = arg_1 or dsub_util.get_os_user()\n  arg_8 = arg_0.prepare_job_metadata(arg_3.name, arg_2, arg_1,\n                                               arg_7)\n  if arg_6:\n    arg_8['job-id'] = uuid.uuid4().hex\n\n  arg_8['create-time'] = arg_7\n  arg_8['script'] = arg_3\n  arg_8['user-project'] = arg_5\n  if arg_4:\n    arg_8['task-ids'] = dsub_util.compact_interval_string(list(arg_4))\n\n  return arg_8", "path": "dsub/commands/dsub.py", "identifier": "_get_job_metadata", "docstring": "Allow provider to extract job-specific metadata from command-line args.\n\n  Args:\n    provider: job service provider\n    user_id: user submitting the job\n    job_name: name for the job\n    script: the script to run\n    task_ids: a set of the task-ids for all tasks in the job\n    user_project: name of the project to be billed for the request\n    unique_job_id: generate a unique job id\n\n  Returns:\n    A dictionary of job-specific metadata (such as job id, name, etc.)", "docstring_tokens": ["Allow", "provider", "to", "extract", "job", "-", "specific", "metadata", "from", "command", "-", "line", "args", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 253816}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sections.py#L18-L23", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return section resource for given sis id.", "language": "python", "parameters": "(self, sis_section_id, params={})", "return_statement": "return self.get_section(\n            self._sis_id(sis_section_id, sis_field=\"section\"), params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "return", "arg_0", ".", "get_section", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"section\"", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return section resource for given sis id.\n        \"\"\"\n        return arg_0.get_section(\n            arg_0._sis_id(arg_1, sis_field=\"section\"), arg_2)", "path": "uw_canvas/sections.py", "identifier": "Sections.get_section_by_sis_id", "docstring": "Return section resource for given sis id.", "docstring_tokens": ["Return", "section", "resource", "for", "given", "sis", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 253817}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/schemata/validate.py#L31-L44", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Validate a jams file against a schema", "language": "python", "parameters": "(schema_file=None, jams_files=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "load_json", "(", "arg_0", ")", "for", "arg_3", "in", "arg_1", ":", "try", ":", "arg_4", "=", "load_json", "(", "arg_3", ")", "jsonschema", ".", "Func", "(", "arg_4", ",", "arg_2", ")", "print", "'{:s} was successfully Funcd'", ".", "format", "(", "arg_3", ")", "except", "jsonschema", ".", "ValidationError", "as", "exc", ":", "print", "'{:s} was NOT successfully Funcd'", ".", "format", "(", "arg_3", ")", "print", "exc"], "function": "def Func(arg_0=None, arg_1=None):\n    '''Validate a jams file against a schema'''\n\n    arg_2 = load_json(arg_0)\n\n    for arg_3 in arg_1:\n        try:\n            arg_4 = load_json(arg_3)\n            jsonschema.Func(arg_4, arg_2)\n            print '{:s} was successfully Funcd'.format(arg_3)\n        except jsonschema.ValidationError as exc:\n            print '{:s} was NOT successfully Funcd'.format(arg_3)\n\n            print exc", "path": "jams/schemata/validate.py", "identifier": "validate", "docstring": "Validate a jams file against a schema", "docstring_tokens": ["Validate", "a", "jams", "file", "against", "a", "schema"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253818}
{"url": "https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L166-L174", "sha": "7be8b956e53c70b35f34e1783a8fe8f716955afb", "docstring_summary": "Return the modulo value.", "language": "python", "parameters": "(value, arg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "valid_numeric", "(", "arg_0", ")", "%", "valid_numeric", "(", "arg_1", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "try", ":", "return", "arg_0", "%", "arg_1", "except", "Exception", ":", "return", "''"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return the Funculo value.\"\"\"\n    try:\n        return valid_numeric(arg_0) % valid_numeric(arg_1)\n    except (ValueError, TypeError):\n        try:\n            return arg_0 % arg_1\n        except Exception:\n            return ''", "path": "django_baseline/templatetags/helpers.py", "identifier": "mod", "docstring": "Return the modulo value.", "docstring_tokens": ["Return", "the", "modulo", "value", "."], "nwo": "theduke/django-baseline", "score": 0.0, "idx": 253819}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L940-L963", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get a pandas dataframe from a Hive query", "language": "python", "parameters": "(self, hql, schema='default')", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'default'", ")", ":", "import", "pandas", "as", "pd", "arg_3", "=", "arg_0", ".", "get_results", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "arg_3", "[", "'data'", "]", ")", "arg_4", ".", "columns", "=", "[", "c", "[", "0", "]", "for", "c", "in", "arg_3", "[", "'header'", "]", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2='default'):\n        \"\"\"\n        Get a pandas dataframe from a Hive query\n\n        :param hql: hql to be executed.\n        :type hql: str or list\n        :param schema: target schema, default to 'default'.\n        :type schema: str\n        :return: result of hql execution\n        :rtype: DataFrame\n\n        >>> hh = HiveServer2Hook()\n        >>> sql = \"SELECT * FROM airflow.static_babynames LIMIT 100\"\n        >>> df = hh.Func(sql)\n        >>> len(df.index)\n        100\n\n        :return: pandas.DateFrame\n        \"\"\"\n        import pandas as pd\n        arg_3 = arg_0.get_results(arg_1, arg_2=arg_2)\n        arg_4 = pd.DataFrame(arg_3['data'])\n        arg_4.columns = [c[0] for c in arg_3['header']]\n        return arg_4", "path": "airflow/hooks/hive_hooks.py", "identifier": "HiveServer2Hook.get_pandas_df", "docstring": "Get a pandas dataframe from a Hive query\n\n        :param hql: hql to be executed.\n        :type hql: str or list\n        :param schema: target schema, default to 'default'.\n        :type schema: str\n        :return: result of hql execution\n        :rtype: DataFrame\n\n        >>> hh = HiveServer2Hook()\n        >>> sql = \"SELECT * FROM airflow.static_babynames LIMIT 100\"\n        >>> df = hh.get_pandas_df(sql)\n        >>> len(df.index)\n        100\n\n        :return: pandas.DateFrame", "docstring_tokens": ["Get", "a", "pandas", "dataframe", "from", "a", "Hive", "query"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253820}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/terminal.py#L74-L96", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "check_install will attempt to run the singularity command, and\n       return True if installed. The command line utils will not run \n       without this check.", "language": "python", "parameters": "(software=None, quiet=True)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "True", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "\"singularity\"", "arg_2", "=", "[", "arg_0", ",", "'--version'", "]", "try", ":", "arg_3", "=", "run_command", "(", "arg_2", ",", "arg_0", ")", "except", ":", "return", "False", "if", "arg_3", "is", "not", "None", ":", "if", "arg_1", "is", "False", "and", "arg_3", "[", "'return_code'", "]", "==", "0", ":", "arg_3", "=", "arg_3", "[", "'message'", "]", "bot", ".", "info", "(", "\"Found %s version %s\"", "%", "(", "arg_0", ".", "upper", "(", ")", ",", "arg_3", ")", ")", "return", "True", "return", "False"], "function": "def Func(arg_0=None, arg_1=True):\n    '''Func will attempt to run the singularity command, and\n       return True if installed. The command line utils will not run \n       without this check.\n\n       Parameters\n       ==========\n       software: the software to check if installed\n       quiet: should we be quiet? (default True)\n    '''\n    if arg_0 is None:\n        arg_0 = \"singularity\"\n    arg_2 = [arg_0, '--version']\n    try:\n        arg_3 = run_command(arg_2,arg_0)\n    except: # FileNotFoundError\n        return False\n    if arg_3 is not None:\n        if arg_1 is False and arg_3['return_code'] == 0:\n            arg_3 = arg_3['message']\n            bot.info(\"Found %s version %s\" % (arg_0.upper(), arg_3))\n        return True \n    return False", "path": "sregistry/utils/terminal.py", "identifier": "check_install", "docstring": "check_install will attempt to run the singularity command, and\n       return True if installed. The command line utils will not run \n       without this check.\n\n       Parameters\n       ==========\n       software: the software to check if installed\n       quiet: should we be quiet? (default True)", "docstring_tokens": ["check_install", "will", "attempt", "to", "run", "the", "singularity", "command", "and", "return", "True", "if", "installed", ".", "The", "command", "line", "utils", "will", "not", "run", "without", "this", "check", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 253821}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L180-L191", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform Kraus representation to Choi representation.", "language": "python", "parameters": "(data, input_dim, output_dim)", "return_statement": "return choi", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "0", "arg_4", ",", "arg_5", "=", "arg_0", "if", "arg_5", "is", "None", ":", "for", "arg_6", "in", "arg_4", ":", "arg_7", "=", "arg_6", ".", "ravel", "(", "order", "=", "'F'", ")", "arg_3", "+=", "np", ".", "outer", "(", "arg_7", ",", "arg_7", ".", "conj", "(", ")", ")", "else", ":", "for", "arg_6", ",", "arg_8", "in", "zip", "(", "arg_4", ",", "arg_5", ")", ":", "arg_3", "+=", "np", ".", "outer", "(", "arg_6", ".", "ravel", "(", "order", "=", "'F'", ")", ",", "arg_8", ".", "ravel", "(", "order", "=", "'F'", ")", ".", "conj", "(", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Transform Kraus representation to Choi representation.\"\"\"\n    arg_3 = 0\n    arg_4, arg_5 = arg_0\n    if arg_5 is None:\n        for arg_6 in arg_4:\n            arg_7 = arg_6.ravel(order='F')\n            arg_3 += np.outer(arg_7, arg_7.conj())\n    else:\n        for arg_6, arg_8 in zip(arg_4, arg_5):\n            arg_3 += np.outer(arg_6.ravel(order='F'), arg_8.ravel(order='F').conj())\n    return arg_3", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_kraus_to_choi", "docstring": "Transform Kraus representation to Choi representation.", "docstring_tokens": ["Transform", "Kraus", "representation", "to", "Choi", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253822}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L1344-L1350", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "Remove all tags that have the tag name ``tag``", "language": "python", "parameters": "(tree, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "iter", "(", ")", ":", "if", "arg_2", ".", "tag", "==", "arg_1", ":", "arg_2", ".", "getparent", "(", ")", ".", "remove", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Remove all tags that have the tag name ``tag``\n    \"\"\"\n    for arg_2 in arg_0.iter():\n        if arg_2.tag == arg_1:\n            arg_2.getparent().remove(arg_2)", "path": "docx2html/core.py", "identifier": "_strip_tag", "docstring": "Remove all tags that have the tag name ``tag``", "docstring_tokens": ["Remove", "all", "tags", "that", "have", "the", "tag", "name", "tag"], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 253823}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2540-L2572", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Returns the packager detected on the remote system.", "language": "python", "parameters": "()", "return_statement": "return common_packager", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "warnings", "warnings", ".", "filterwarnings", "(", "\"ignore\"", ",", "category", "=", "DeprecationWarning", ")", "arg_0", "=", "get_rc", "(", "'common_packager'", ")", "if", "arg_0", ":", "return", "arg_0", "with", "settings", "(", "warn_only", "=", "True", ")", ":", "with", "hide", "(", "'running'", ",", "'stdout'", ",", "'stderr'", ",", "'warnings'", ")", ":", "arg_1", "=", "_run", "(", "'cat /etc/fedora-release'", ")", "if", "arg_1", ".", "succeeded", ":", "arg_0", "=", "YUM", "else", ":", "arg_1", "=", "_run", "(", "'cat /etc/lsb-release'", ")", "if", "arg_1", ".", "succeeded", ":", "arg_0", "=", "APT", "else", ":", "for", "arg_2", "in", "PACKAGERS", ":", "arg_1", "=", "_run", "(", "'which %s'", "%", "arg_2", ")", "if", "arg_1", ".", "succeeded", ":", "arg_0", "=", "arg_2", "break", "if", "not", "arg_0", ":", "raise", "Exception", "(", "'Unable to determine packager.'", ")", "set_rc", "(", "'common_packager'", ",", "arg_0", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n    Returns the packager detected on the remote system.\n    \"\"\"\n\n    # TODO: remove once fabric stops using contextlib.nested.\n    # https://github.com/fabric/fabric/issues/1364\n    import warnings\n    warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n\n    arg_0 = get_rc('common_packager')\n    if arg_0:\n        return arg_0\n    #TODO:cache result by current env.host_string so we can handle multiple hosts with different OSes\n    with settings(warn_only=True):\n        with hide('running', 'stdout', 'stderr', 'warnings'):\n            arg_1 = _run('cat /etc/fedora-release')\n            if arg_1.succeeded:\n                arg_0 = YUM\n            else:\n                arg_1 = _run('cat /etc/lsb-release')\n                if arg_1.succeeded:\n                    arg_0 = APT\n                else:\n                    for arg_2 in PACKAGERS:\n                        arg_1 = _run('which %s' % arg_2)\n                        if arg_1.succeeded:\n                            arg_0 = arg_2\n                            break\n    if not arg_0:\n        raise Exception('Unable to determine packager.')\n    set_rc('common_packager', arg_0)\n    return arg_0", "path": "burlap/common.py", "identifier": "get_packager", "docstring": "Returns the packager detected on the remote system.", "docstring_tokens": ["Returns", "the", "packager", "detected", "on", "the", "remote", "system", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 253824}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/export/variant.py#L138-L175", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Get vcf entry from variant object", "language": "python", "parameters": "(variant_obj, case_id=None)", "return_statement": "return variant_string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "[", "'category'", "]", "==", "'snv'", ":", "arg_2", "=", "'TYPE'", "else", ":", "arg_2", "=", "'SVTYPE'", "arg_3", "=", "';'", ".", "join", "(", "[", "'END='", "+", "str", "(", "arg_0", "[", "'end'", "]", ")", ",", "arg_2", "+", "'='", "+", "arg_0", "[", "'sub_category'", "]", ".", "upper", "(", ")", "]", ")", "arg_4", "=", "\"{0}\\t{1}\\t{2}\\t{3}\\t{4}\\t{5}\\t{6}\\t{7}\"", ".", "format", "(", "arg_0", "[", "'chromosome'", "]", ",", "arg_0", "[", "'position'", "]", ",", "arg_0", "[", "'dbsnp_id'", "]", ",", "arg_0", "[", "'reference'", "]", ",", "arg_0", "[", "'alternative'", "]", ",", "arg_0", "[", "'quality'", "]", ",", "';'", ".", "join", "(", "arg_0", "[", "'filters'", "]", ")", ",", "arg_3", ")", "if", "arg_1", ":", "arg_4", "+=", "\"\\tGT\"", "for", "arg_5", "in", "arg_0", "[", "'samples'", "]", ":", "arg_4", "+=", "\"\\t\"", "+", "arg_5", "[", "'genotype_call'", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n        Get vcf entry from variant object\n\n        Args:\n            variant_obj(dict)\n        Returns:\n            variant_string(str): string representing variant in vcf format\n    \"\"\"\n    if arg_0['category'] == 'snv':\n        arg_2 = 'TYPE'\n    else:\n        arg_2 = 'SVTYPE'\n\n    arg_3 = ';'.join(\n            [\n                'END='+str(arg_0['end']),\n                arg_2+'='+arg_0['sub_category'].upper()\n            ]\n        )\n\n    arg_4 = \"{0}\\t{1}\\t{2}\\t{3}\\t{4}\\t{5}\\t{6}\\t{7}\".format(\n        arg_0['chromosome'],\n        arg_0['position'],\n        arg_0['dbsnp_id'],\n        arg_0['reference'],\n        arg_0['alternative'],\n        arg_0['quality'],\n        ';'.join(arg_0['filters']),\n        arg_3\n    )\n\n    if arg_1:\n        arg_4 += \"\\tGT\"\n        for arg_5 in arg_0['samples']:\n            arg_4 += \"\\t\" + arg_5['genotype_call']\n\n    return arg_4", "path": "scout/commands/export/variant.py", "identifier": "get_vcf_entry", "docstring": "Get vcf entry from variant object\n\n        Args:\n            variant_obj(dict)\n        Returns:\n            variant_string(str): string representing variant in vcf format", "docstring_tokens": ["Get", "vcf", "entry", "from", "variant", "object"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253825}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/data_generator.py#L166-L171", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Generate multiple records. Refer to definition for generateRecord", "language": "python", "parameters": "(self, records)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "verbosity", ">", "0", ":", "print", "'Generating'", ",", "len", "(", "arg_1", ")", ",", "'records...'", "for", "arg_2", "in", "arg_1", ":", "arg_0", ".", "generateRecord", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Generate multiple records. Refer to definition for generateRecord\"\"\"\n\n    if arg_0.verbosity>0: print 'Generating', len(arg_1), 'records...'\n    for arg_2 in arg_1:\n      arg_0.generateRecord(arg_2)", "path": "src/nupic/data/generators/data_generator.py", "identifier": "DataGenerator.generateRecords", "docstring": "Generate multiple records. Refer to definition for generateRecord", "docstring_tokens": ["Generate", "multiple", "records", ".", "Refer", "to", "definition", "for", "generateRecord"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253826}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/users/users.py#L31-L47", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Get details about specific user", "language": "python", "parameters": "(session, user_id, user_details=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", ":", "arg_2", "[", "'compact'", "]", "=", "True", "arg_3", "=", "make_get_request", "(", "arg_0", ",", "'users/{}'", ".", "format", "(", "arg_1", ")", ",", "params_data", "=", "arg_2", ")", "arg_4", "=", "arg_3", ".", "json", "(", ")", "if", "arg_3", ".", "status_code", "==", "200", ":", "return", "arg_4", "[", "'result'", "]", "else", ":", "raise", "UserNotFoundException", "(", "message", "=", "arg_4", "[", "'message'", "]", ",", "error_code", "=", "arg_4", "[", "'error_code'", "]", ",", "request_id", "=", "arg_4", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Get details about specific user\n    \"\"\"\n    if arg_2:\n        arg_2['compact'] = True\n    arg_3 = make_get_request(\n        arg_0, 'users/{}'.format(arg_1), params_data=arg_2)\n    arg_4 = arg_3.json()\n    if arg_3.status_code == 200:\n        return arg_4['result']\n    else:\n        raise UserNotFoundException(\n            message=arg_4['message'],\n            error_code=arg_4['error_code'],\n            request_id=arg_4['request_id']\n        )", "path": "freelancersdk/resources/users/users.py", "identifier": "get_user_by_id", "docstring": "Get details about specific user", "docstring_tokens": ["Get", "details", "about", "specific", "user"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 253827}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/elsevier_package.py#L231-L261", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "issue.xml from Elsevier assume the existence of a local DTD.\n        This procedure install the DTDs next to the issue.xml file\n        and normalize it using xmllint in order to resolve all namespaces\n        and references.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "exists", "(", "join", "(", "arg_1", ",", "'resolved_issue.xml'", ")", ")", ":", "return", "arg_2", "=", "open", "(", "join", "(", "arg_1", ",", "'issue.xml'", ")", ")", ".", "read", "(", ")", "arg_3", "=", "[", "'si510.dtd'", ",", "'si520.dtd'", ",", "'si540.dtd'", "]", "arg_4", "=", "0", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", "in", "arg_2", ":", "arg_0", ".", "_extract_correct_dtd_package", "(", "arg_5", ".", "split", "(", "'.'", ")", "[", "0", "]", ",", "arg_1", ")", "arg_4", "=", "1", "if", "not", "arg_4", ":", "arg_6", "=", "\"It looks like the path \"", "+", "arg_1", "arg_6", "+=", "\" does not contain an si510, si520 or si540 in issue.xml file\"", "arg_0", ".", "logger", ".", "error", "(", "arg_6", ")", "raise", "ValueError", "(", "arg_6", ")", "arg_7", "=", "[", "\"xmllint\"", ",", "\"--format\"", ",", "\"--loaddtd\"", ",", "join", "(", "arg_1", ",", "'issue.xml'", ")", ",", "\"--output\"", ",", "join", "(", "arg_1", ",", "'resolved_issue.xml'", ")", "]", "arg_8", ",", "arg_8", ",", "arg_9", "=", "run_shell_command", "(", "arg_7", ")", "if", "arg_9", ":", "arg_6", "=", "\"Error in cleaning %s: %s\"", "%", "(", "join", "(", "arg_1", ",", "'issue.xml'", ")", ",", "arg_9", ")", "arg_0", ".", "logger", ".", "error", "(", "arg_6", ")", "raise", "ValueError", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        issue.xml from Elsevier assume the existence of a local DTD.\n        This procedure install the DTDs next to the issue.xml file\n        and normalize it using xmllint in order to resolve all namespaces\n        and references.\n        \"\"\"\n        if exists(join(arg_1, 'resolved_issue.xml')):\n            return\n        arg_2 = open(join(arg_1, 'issue.xml')).read()\n        arg_3 = ['si510.dtd', 'si520.dtd', 'si540.dtd']\n        arg_4 = 0\n        for arg_5 in arg_3:\n            if arg_5 in arg_2:\n                arg_0._extract_correct_dtd_package(arg_5.split('.')[0], arg_1)\n                arg_4 = 1\n\n        if not arg_4:\n            arg_6 = \"It looks like the path \" + arg_1\n            arg_6 += \" does not contain an si510, si520 or si540 in issue.xml file\"\n            arg_0.logger.error(arg_6)\n            raise ValueError(arg_6)\n        arg_7 = [\"xmllint\", \"--format\", \"--loaddtd\",\n                   join(arg_1, 'issue.xml'),\n                   \"--output\", join(arg_1, 'resolved_issue.xml')]\n        arg_8, arg_8, arg_9 = run_shell_command(arg_7)\n        if arg_9:\n            arg_6 = \"Error in cleaning %s: %s\" % (\n                join(arg_1, 'issue.xml'), arg_9)\n            arg_0.logger.error(arg_6)\n            raise ValueError(arg_6)", "path": "harvestingkit/elsevier_package.py", "identifier": "ElsevierPackage._normalize_issue_dir_with_dtd", "docstring": "issue.xml from Elsevier assume the existence of a local DTD.\n        This procedure install the DTDs next to the issue.xml file\n        and normalize it using xmllint in order to resolve all namespaces\n        and references.", "docstring_tokens": ["issue", ".", "xml", "from", "Elsevier", "assume", "the", "existence", "of", "a", "local", "DTD", ".", "This", "procedure", "install", "the", "DTDs", "next", "to", "the", "issue", ".", "xml", "file", "and", "normalize", "it", "using", "xmllint", "in", "order", "to", "resolve", "all", "namespaces", "and", "references", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253828}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L488-L499", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Handle stdout, stderr, and stdin.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"stream: %s\"", ",", "arg_1", ".", "get", "(", "'content'", ",", "''", ")", ")", "if", "not", "arg_0", ".", "_hidden", "and", "arg_0", ".", "_is_from_this_session", "(", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'content'", "]", "[", "'data'", "]", ".", "expandtabs", "(", "8", ")", "arg_0", ".", "_append_plain_text", "(", "arg_2", ",", "before_prompt", "=", "True", ")", "arg_0", ".", "_control", ".", "moveCursor", "(", "QtGui", ".", "QTextCursor", ".", "End", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handle stdout, stderr, and stdin.\n        \"\"\"\n        arg_0.log.debug(\"stream: %s\", arg_1.get('content', ''))\n        if not arg_0._hidden and arg_0._is_from_this_session(arg_1):\n            # Most consoles treat tabs as being 8 space characters. Convert tabs\n            # to spaces so that output looks as expected regardless of this\n            # widget's tab width.\n            arg_2 = arg_1['content']['data'].expandtabs(8)\n\n            arg_0._append_plain_text(arg_2, before_prompt=True)\n            arg_0._control.moveCursor(QtGui.QTextCursor.End)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._handle_stream", "docstring": "Handle stdout, stderr, and stdin.", "docstring_tokens": ["Handle", "stdout", "stderr", "and", "stdin", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253829}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L968-L989", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Load a private key from a file", "language": "python", "parameters": "(self, keyfile, filetype=_UNSPECIFIED)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "arg_1", "=", "_path_string", "(", "arg_1", ")", "if", "arg_2", "is", "arg_3", ":", "arg_2", "=", "FILETYPE_PEM", "elif", "not", "isinstance", "(", "arg_2", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"filetype must be an integer\"", ")", "arg_4", "=", "_lib", ".", "SSL_CTX_use_PrivateKey_file", "(", "arg_0", ".", "_context", ",", "arg_1", ",", "arg_2", ")", "if", "not", "arg_4", ":", "arg_0", ".", "_raise_passphrase_exception", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n        \"\"\"\n        Load a private key from a file\n\n        :param keyfile: The name of the key file (``bytes`` or ``unicode``)\n        :param filetype: (optional) The encoding of the file, which is either\n            :const:`FILETYPE_PEM` or :const:`FILETYPE_ASN1`.  The default is\n            :const:`FILETYPE_PEM`.\n\n        :return: None\n        \"\"\"\n        arg_1 = _path_string(arg_1)\n\n        if arg_2 is arg_3:\n            arg_2 = FILETYPE_PEM\n        elif not isinstance(arg_2, integer_types):\n            raise TypeError(\"filetype must be an integer\")\n\n        arg_4 = _lib.SSL_CTX_use_PrivateKey_file(\n            arg_0._context, arg_1, arg_2)\n        if not arg_4:\n            arg_0._raise_passphrase_exception()", "path": "src/OpenSSL/SSL.py", "identifier": "Context.use_privatekey_file", "docstring": "Load a private key from a file\n\n        :param keyfile: The name of the key file (``bytes`` or ``unicode``)\n        :param filetype: (optional) The encoding of the file, which is either\n            :const:`FILETYPE_PEM` or :const:`FILETYPE_ASN1`.  The default is\n            :const:`FILETYPE_PEM`.\n\n        :return: None", "docstring_tokens": ["Load", "a", "private", "key", "from", "a", "file"], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 253830}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/annotate.py#L37-L43", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Run the report.", "language": "python", "parameters": "(self, morfs, directory=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "Func_files", "(", "arg_0", ".", "annotate_file", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Run the Func.\n\n        See `coverage.Func()` for arguments.\n\n        \"\"\"\n        arg_0.Func_files(arg_0.annotate_file, arg_1, arg_2)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/annotate.py", "identifier": "AnnotateReporter.report", "docstring": "Run the report.\n\n        See `coverage.report()` for arguments.", "docstring_tokens": ["Run", "the", "report", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 253831}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/threads/sub.py#L12-L38", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Create input, output queues, call `function` in a subprocess or a thread.", "language": "python", "parameters": "(function, *args, use_subprocess=False, daemon=True, **kwds)", "return_statement": "return sub, input, output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "True", ",", "**", "arg_4", ")", ":", "if", "arg_2", ":", "arg_5", ",", "arg_6", "=", "multiprocessing", ".", "Process", ",", "multiprocessing", ".", "Queue", "else", ":", "arg_5", ",", "arg_6", "=", "threading", ".", "Thread", ",", "queue", ".", "Queue", "arg_7", ",", "arg_8", "=", "arg_6", "(", ")", ",", "arg_6", "(", ")", "arg_1", "=", "arg_7", ",", "arg_8", ",", "arg_0", ",", "arg_1", "arg_9", "=", "arg_5", "(", "target", "=", "_Func_locally", ",", "arg_1", "=", "arg_1", ",", "kwargs", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", "arg_9", ".", "start", "(", ")", "return", "arg_9", ",", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, *arg_1, arg_2=False, arg_3=True, **arg_4):\n    \"\"\"\n    Create input, output queues, call `function` in a subprocess or a thread.\n\n    ``function`` is called like this: ``function(input, output, *args, **kwds)``\n\n    :param use_subprocess: if true, create a new multiprocess;\n                           if false, create a new thread\n    :param function: the function to call\n    :param daemon: is the thread or subprocess Func as a daemon or not?\n\n    :param args: positional arguments to the function\n    :param kwds: keyword arguments to the function\n    :returns: a tuple with three elements: the subprocess or thread, an input\n              queue, and an output queue.\n    \"\"\"\n    if arg_2:\n        arg_5, arg_6 = multiprocessing.Process, multiprocessing.Queue\n    else:\n        arg_5, arg_6 = threading.Thread, queue.Queue\n\n    arg_7, arg_8 = arg_6(), arg_6()\n    arg_1 = arg_7, arg_8, arg_0, arg_1\n    arg_9 = arg_5(target=_Func_locally, arg_1=arg_1, kwargs=arg_4, arg_3=arg_3)\n    arg_9.start()\n\n    return arg_9, arg_7, arg_8", "path": "bibliopixel/util/threads/sub.py", "identifier": "run", "docstring": "Create input, output queues, call `function` in a subprocess or a thread.\n\n    ``function`` is called like this: ``function(input, output, *args, **kwds)``\n\n    :param use_subprocess: if true, create a new multiprocess;\n                           if false, create a new thread\n    :param function: the function to call\n    :param daemon: is the thread or subprocess run as a daemon or not?\n\n    :param args: positional arguments to the function\n    :param kwds: keyword arguments to the function\n    :returns: a tuple with three elements: the subprocess or thread, an input\n              queue, and an output queue.", "docstring_tokens": ["Create", "input", "output", "queues", "call", "function", "in", "a", "subprocess", "or", "a", "thread", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 253832}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/core.py#L394-L410", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Adds the session cookie to headers.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "data", ":", "arg_1", "=", "arg_0", ".", "create_cookie", "(", ")", "arg_2", "=", "len", "(", "arg_1", ")", "if", "arg_2", ">", "4093", ":", "raise", "SessionError", "(", "'Cookie too long! The cookie size {0} '", "'is more than 4093 bytes.'", ".", "format", "(", "arg_2", ")", ")", "arg_0", ".", "adapter", ".", "set_header", "(", "'Set-Cookie'", ",", "arg_1", ")", "arg_0", ".", "_data", "=", "{", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Adds the session cookie to headers.\n        \"\"\"\n        if arg_0.data:\n            arg_1 = arg_0.create_cookie()\n            arg_2 = len(arg_1)\n\n            if arg_2 > 4093:\n                raise SessionError('Cookie too long! The cookie size {0} '\n                                   'is more than 4093 bytes.'\n                                   .format(arg_2))\n\n            arg_0.adapter.set_header('Set-Cookie', arg_1)\n\n            # Reset data\n            arg_0._data = {}", "path": "authomatic/core.py", "identifier": "Session.save", "docstring": "Adds the session cookie to headers.", "docstring_tokens": ["Adds", "the", "session", "cookie", "to", "headers", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 253833}
{"url": "https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L611-L628", "sha": "3769aecbef6c83b6cd93ee72ece478ffe433ac57", "docstring_summary": "Returns a PngImageFile instance of the chart", "language": "python", "parameters": "(self)", "return_statement": "return Image.open(StringIO(self.urlopen().read()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "try", ":", "import", "Image", "except", "ImportError", ":", "from", "PIL", "import", "Image", "except", "ImportError", ":", "raise", "ImportError", "(", "'You must install PIL to fetch Func objects'", ")", "try", ":", "from", "cStringIO", "import", "StringIO", "except", "ImportError", ":", "from", "StringIO", "import", "StringIO", "return", "Image", ".", "open", "(", "StringIO", "(", "arg_0", ".", "urlopen", "(", ")", ".", "read", "(", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a PngImageFile instance of the chart\n\n        You must have PIL installed for this to work\n        \"\"\"\n        try:\n            try:\n                import Image\n            except ImportError:\n                from PIL import Image\n        except ImportError:\n            raise ImportError('You must install PIL to fetch Func objects')\n        try:\n            from cStringIO import StringIO\n        except ImportError:\n            from StringIO import StringIO\n        return Image.open(StringIO(arg_0.urlopen().read()))", "path": "GChartWrapper/GChart.py", "identifier": "GChart.image", "docstring": "Returns a PngImageFile instance of the chart\n\n        You must have PIL installed for this to work", "docstring_tokens": ["Returns", "a", "PngImageFile", "instance", "of", "the", "chart"], "nwo": "appknox/google-chartwrapper", "score": 0.12050106452410352, "idx": 253834}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/sqlite_hook.py#L35-L41", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a sqlite connection object", "language": "python", "parameters": "(self)", "return_statement": "return conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "Funcection", "(", "arg_0", ".", "sqlite_conn_id", ")", "arg_1", "=", "sqlite3", ".", "connect", "(", "arg_1", ".", "host", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a sqlite connection object\n        \"\"\"\n        arg_1 = arg_0.Funcection(arg_0.sqlite_conn_id)\n        arg_1 = sqlite3.connect(arg_1.host)\n        return arg_1", "path": "airflow/hooks/sqlite_hook.py", "identifier": "SqliteHook.get_conn", "docstring": "Returns a sqlite connection object", "docstring_tokens": ["Returns", "a", "sqlite", "connection", "object"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253835}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmparser.py#L181-L187", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Verify a list of registers.", "language": "python", "parameters": "(self, obj, object_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_1", ".", "children", ":", "arg_0", ".", "verify_reg", "(", "arg_3", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Verify a list of registers.\"\"\"\n        # We expect the object to be a bitlist or an idlist, we don't care.\n        # We will iterate it and ensure everything in it is declared as a bit,\n        # and throw if not.\n        for arg_3 in arg_1.children:\n            arg_0.verify_reg(arg_3, arg_2)", "path": "qiskit/qasm/qasmparser.py", "identifier": "QasmParser.verify_reg_list", "docstring": "Verify a list of registers.", "docstring_tokens": ["Verify", "a", "list", "of", "registers", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253836}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/providers/basicaer/qasm_simulator.py#L325-L332", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the current statevector in JSON Result spec format", "language": "python", "parameters": "(self)", "return_statement": "return vec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "reshape", "(", "arg_0", ".", "_statevector", ",", "2", "**", "arg_0", ".", "_number_of_qubits", ")", "arg_1", "=", "np", ".", "stack", "(", "[", "arg_1", ".", "real", ",", "arg_1", ".", "imag", "]", ",", "axis", "=", "1", ")", "arg_1", "[", "arg_2", "(", "arg_1", ")", "<", "arg_0", ".", "_chop_threshold", "]", "=", "0.0", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return the current statevector in JSON Result spec format\"\"\"\n        arg_1 = np.reshape(arg_0._statevector, 2 ** arg_0._number_of_qubits)\n        # Expand complex numbers\n        arg_1 = np.stack([arg_1.real, arg_1.imag], axis=1)\n        # Truncate small values\n        arg_1[arg_2(arg_1) < arg_0._chop_threshold] = 0.0\n        return arg_1", "path": "qiskit/providers/basicaer/qasm_simulator.py", "identifier": "QasmSimulatorPy._get_statevector", "docstring": "Return the current statevector in JSON Result spec format", "docstring_tokens": ["Return", "the", "current", "statevector", "in", "JSON", "Result", "spec", "format"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253837}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/agent.py#L73-L85", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "Updates the list of known servers to the provided list.\n           Replaces all previous server addresses with the new list.", "language": "python", "parameters": "(self, addresses)", "return_statement": "return self.request(\"servers\", params=params, method=\"post\").status_code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"address\"", ":", "arg_1", "}", "return", "arg_0", ".", "request", "(", "\"servers\"", ",", "arg_2", "=", "arg_2", ",", "method", "=", "\"post\"", ")", ".", "status_code"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Updates the list of known servers to the provided list.\n           Replaces all previous server addresses with the new list.\n\n           https://www.nomadproject.io/docs/http/agent-servers.html\n\n            returns: 200 status code\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_2 = {\"address\": arg_1}\n        return arg_0.request(\"servers\", arg_2=arg_2, method=\"post\").status_code", "path": "nomad/api/agent.py", "identifier": "Agent.update_servers", "docstring": "Updates the list of known servers to the provided list.\n           Replaces all previous server addresses with the new list.\n\n           https://www.nomadproject.io/docs/http/agent-servers.html\n\n            returns: 200 status code\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["Updates", "the", "list", "of", "known", "servers", "to", "the", "provided", "list", ".", "Replaces", "all", "previous", "server", "addresses", "with", "the", "new", "list", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 253838}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L780-L835", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Find local maxima in an array `x`.", "language": "python", "parameters": "(x, axis=0)", "return_statement": "return (x > x_pad[tuple(inds1)]) & (x >= x_pad[tuple(inds2)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "[", "(", "0", ",", "0", ")", "]", "*", "arg_0", ".", "ndim", "arg_2", "[", "arg_1", "]", "=", "(", "1", ",", "1", ")", "arg_3", "=", "np", ".", "pad", "(", "arg_0", ",", "arg_2", ",", "mode", "=", "'edge'", ")", "arg_4", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "arg_4", "[", "arg_1", "]", "=", "slice", "(", "0", ",", "-", "2", ")", "arg_5", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "arg_5", "[", "arg_1", "]", "=", "slice", "(", "2", ",", "arg_3", ".", "shape", "[", "arg_1", "]", ")", "return", "(", "arg_0", ">", "arg_3", "[", "tuple", "(", "arg_4", ")", "]", ")", "&", "(", "arg_0", ">=", "arg_3", "[", "tuple", "(", "arg_5", ")", "]", ")"], "function": "def Func(arg_0, arg_1=0):\n    \"\"\"Find local maxima in an array `x`.\n\n    An element `x[i]` is considered a local maximum if the following\n    conditions are met:\n\n    - `x[i] > x[i-1]`\n    - `x[i] >= x[i+1]`\n\n    Note that the first condition is strict, and that the first element\n    `x[0]` will never be considered as a local maximum.\n\n    Examples\n    --------\n    >>> x = np.array([1, 0, 1, 2, -1, 0, -2, 1])\n    >>> librosa.util.Func(x)\n    array([False, False, False,  True, False,  True, False,  True], dtype=bool)\n\n    >>> # Two-dimensional example\n    >>> x = np.array([[1,0,1], [2, -1, 0], [2, 1, 3]])\n    >>> librosa.util.Func(x, axis=0)\n    array([[False, False, False],\n           [ True, False, False],\n           [False,  True,  True]], dtype=bool)\n    >>> librosa.util.Func(x, axis=1)\n    array([[False, False,  True],\n           [False, False,  True],\n           [False, False,  True]], dtype=bool)\n\n    Parameters\n    ----------\n    x     : np.ndarray [shape=(d1,d2,...)]\n      input vector or array\n\n    axis : int\n      axis along which to compute local maximality\n\n    Returns\n    -------\n    m     : np.ndarray [shape=x.shape, dtype=bool]\n        indicator array of local maximality along `axis`\n\n    \"\"\"\n\n    arg_2 = [(0, 0)] * arg_0.ndim\n    arg_2[arg_1] = (1, 1)\n\n    arg_3 = np.pad(arg_0, arg_2, mode='edge')\n\n    arg_4 = [slice(None)] * arg_0.ndim\n    arg_4[arg_1] = slice(0, -2)\n\n    arg_5 = [slice(None)] * arg_0.ndim\n    arg_5[arg_1] = slice(2, arg_3.shape[arg_1])\n\n    return (arg_0 > arg_3[tuple(arg_4)]) & (arg_0 >= arg_3[tuple(arg_5)])", "path": "librosa/util/utils.py", "identifier": "localmax", "docstring": "Find local maxima in an array `x`.\n\n    An element `x[i]` is considered a local maximum if the following\n    conditions are met:\n\n    - `x[i] > x[i-1]`\n    - `x[i] >= x[i+1]`\n\n    Note that the first condition is strict, and that the first element\n    `x[0]` will never be considered as a local maximum.\n\n    Examples\n    --------\n    >>> x = np.array([1, 0, 1, 2, -1, 0, -2, 1])\n    >>> librosa.util.localmax(x)\n    array([False, False, False,  True, False,  True, False,  True], dtype=bool)\n\n    >>> # Two-dimensional example\n    >>> x = np.array([[1,0,1], [2, -1, 0], [2, 1, 3]])\n    >>> librosa.util.localmax(x, axis=0)\n    array([[False, False, False],\n           [ True, False, False],\n           [False,  True,  True]], dtype=bool)\n    >>> librosa.util.localmax(x, axis=1)\n    array([[False, False,  True],\n           [False, False,  True],\n           [False, False,  True]], dtype=bool)\n\n    Parameters\n    ----------\n    x     : np.ndarray [shape=(d1,d2,...)]\n      input vector or array\n\n    axis : int\n      axis along which to compute local maximality\n\n    Returns\n    -------\n    m     : np.ndarray [shape=x.shape, dtype=bool]\n        indicator array of local maximality along `axis`", "docstring_tokens": ["Find", "local", "maxima", "in", "an", "array", "x", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 253839}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1495-L1498", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a Python AST Node for a `quote` expression.", "language": "python", "parameters": "(ctx: GeneratorContext, node: Quote)", "return_statement": "return _const_node_to_py_ast(ctx, node.expr)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "QUOTE", "return", "_const_node_to_py_ast", "(", "arg_0", ",", "arg_2", ".", "expr", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:\n    \"\"\"Return a Python AST Node for a `quote` expression.\"\"\"\n    assert arg_2.op == NodeOp.QUOTE\n    return _const_node_to_py_ast(arg_0, arg_2.expr)", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_quote_to_py_ast", "docstring": "Return a Python AST Node for a `quote` expression.", "docstring_tokens": ["Return", "a", "Python", "AST", "Node", "for", "a", "quote", "expression", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 253840}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/loaders/scene/gltf.py#L340-L348", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Checks if the bin files referenced exist", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "buffers", ":", "if", "not", "arg_1", ".", "is_separate_file", ":", "continue", "arg_2", "=", "arg_0", ".", "path", ".", "parent", "/", "arg_1", ".", "uri", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "raise", "FileNotFoundError", "(", "\"Buffer {} referenced in {} not found\"", ".", "format", "(", "arg_2", ",", "arg_0", ".", "path", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Checks if the bin files referenced exist\"\"\"\n        for arg_1 in arg_0.buffers:\n            if not arg_1.is_separate_file:\n                continue\n\n            arg_2 = arg_0.path.parent / arg_1.uri\n            if not os.path.exists(arg_2):\n                raise FileNotFoundError(\"Buffer {} referenced in {} not found\".format(arg_2, arg_0.path))", "path": "demosys/loaders/scene/gltf.py", "identifier": "GLTFMeta.buffers_exist", "docstring": "Checks if the bin files referenced exist", "docstring_tokens": ["Checks", "if", "the", "bin", "files", "referenced", "exist"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 253841}
{"url": "https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/backends/openwrt/converters/radios.py#L115-L127", "sha": "c23ce9732720856e2f6dc54060db71a8182c7d4b", "docstring_summary": "determines NetJSON channel_width radio attribute", "language": "python", "parameters": "(self, radio)", "return_statement": "return int(channel_width)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "pop", "(", "'htmode'", ")", "if", "arg_2", "==", "'NONE'", ":", "return", "20", "arg_3", "=", "arg_2", ".", "replace", "(", "'VHT'", ",", "''", ")", ".", "replace", "(", "'HT'", ",", "''", ")", "if", "'+'", "in", "arg_3", "or", "'-'", "in", "arg_3", ":", "arg_1", "[", "'htmode'", "]", "=", "arg_2", "arg_3", "=", "arg_3", "[", "0", ":", "-", "1", "]", "return", "int", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        determines NetJSON channel_width radio attribute\n        \"\"\"\n        arg_2 = arg_1.pop('htmode')\n        if arg_2 == 'NONE':\n            return 20\n        arg_3 = arg_2.replace('VHT', '').replace('HT', '')\n        # we need to override htmode\n        if '+' in arg_3 or '-' in arg_3:\n            arg_1['htmode'] = arg_2\n            arg_3 = arg_3[0:-1]\n        return int(arg_3)", "path": "netjsonconfig/backends/openwrt/converters/radios.py", "identifier": "Radios.__netjson_channel_width", "docstring": "determines NetJSON channel_width radio attribute", "docstring_tokens": ["determines", "NetJSON", "channel_width", "radio", "attribute"], "nwo": "openwisp/netjsonconfig", "score": 0.6422153945684831, "idx": 253842}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/connection.py#L670-L679", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Rejects the SenderLink, and destroys the handle.", "language": "python", "parameters": "(self, link_handle, pn_condition=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "_sender_links", ".", "get", "(", "arg_1", ")", "if", "not", "arg_3", ":", "raise", "Exception", "(", "\"Invalid link_handle: %s\"", "%", "arg_1", ")", "arg_3", ".", "reject", "(", "arg_2", ")", "arg_3", ".", "destroy", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Rejects the SenderLink, and destroys the handle.\"\"\"\n        arg_3 = arg_0._sender_links.get(arg_1)\n        if not arg_3:\n            raise Exception(\"Invalid link_handle: %s\" % arg_1)\n        arg_3.reject(arg_2)\n        # note: normally, link.destroy() cannot be called from a callback,\n        # but this link was never made available to the application so this\n        # link is only referenced by the connection\n        arg_3.destroy()", "path": "pyngus/connection.py", "identifier": "Connection.reject_sender", "docstring": "Rejects the SenderLink, and destroys the handle.", "docstring_tokens": ["Rejects", "the", "SenderLink", "and", "destroys", "the", "handle", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 253843}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L826-L835", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Initialize the Service Discovery process.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", ".", ".", "iq", "import", "Iq", "arg_1", ",", "arg_2", "=", "arg_0", ".", "address", "arg_3", "=", "Iq", "(", "to_jid", "=", "arg_1", ",", "stanza_type", "=", "\"get\"", ")", "arg_4", "=", "arg_0", ".", "disco_class", "(", "arg_2", ")", "arg_3", ".", "add_content", "(", "arg_4", ".", "xmlnode", ")", "arg_0", ".", "stream", ".", "set_response_handlers", "(", "arg_3", ",", "arg_0", ".", "__response", ",", "arg_0", ".", "__error", ",", "arg_0", ".", "__timeout", ")", "arg_0", ".", "stream", ".", "send", "(", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"Initialize the Service Discovery process.\"\"\"\n        from ..iq import Iq\n        arg_1,arg_2 = arg_0.address\n        arg_3 = Iq(to_jid = arg_1, stanza_type = \"get\")\n        arg_4 = arg_0.disco_class(arg_2)\n        arg_3.add_content(arg_4.xmlnode)\n        arg_0.stream.set_response_handlers(arg_3,arg_0.__response, arg_0.__error,\n                arg_0.__timeout)\n        arg_0.stream.send(arg_3)", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoCacheFetcherBase.fetch", "docstring": "Initialize the Service Discovery process.", "docstring_tokens": ["Initialize", "the", "Service", "Discovery", "process", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253844}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L373-L377", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "List the contents of the directory.", "language": "python", "parameters": "(self)", "return_statement": "return [File(f, parent=self) for f in os.listdir(self.path)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "File", "(", "arg_1", ",", "parent", "=", "arg_0", ")", "for", "arg_1", "in", "os", ".", "Funcdir", "(", "arg_0", ".", "path", ")", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        List the contents of the directory.\n        \"\"\"\n        return [File(arg_1, parent=arg_0) for arg_1 in os.Funcdir(arg_0.path)]", "path": "scruffy/file.py", "identifier": "Directory.list", "docstring": "List the contents of the directory.", "docstring_tokens": ["List", "the", "contents", "of", "the", "directory", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 253845}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/spark_sql_hook.py#L91-L134", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Construct the spark-sql command to execute. Verbose output is enabled\n        as default.", "language": "python", "parameters": "(self, cmd)", "return_statement": "return connection_cmd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "\"spark-sql\"", "]", "if", "arg_0", ".", "_conf", ":", "for", "arg_3", "in", "arg_0", ".", "_conf", ".", "split", "(", "\",\"", ")", ":", "arg_2", "+=", "[", "\"--conf\"", ",", "arg_3", "]", "if", "arg_0", ".", "_total_executor_cores", ":", "arg_2", "+=", "[", "\"--total-executor-cores\"", ",", "str", "(", "arg_0", ".", "_total_executor_cores", ")", "]", "if", "arg_0", ".", "_executor_cores", ":", "arg_2", "+=", "[", "\"--executor-cores\"", ",", "str", "(", "arg_0", ".", "_executor_cores", ")", "]", "if", "arg_0", ".", "_executor_memory", ":", "arg_2", "+=", "[", "\"--executor-memory\"", ",", "arg_0", ".", "_executor_memory", "]", "if", "arg_0", ".", "_keytab", ":", "arg_2", "+=", "[", "\"--keytab\"", ",", "arg_0", ".", "_keytab", "]", "if", "arg_0", ".", "_principal", ":", "arg_2", "+=", "[", "\"--principal\"", ",", "arg_0", ".", "_principal", "]", "if", "arg_0", ".", "_num_executors", ":", "arg_2", "+=", "[", "\"--num-executors\"", ",", "str", "(", "arg_0", ".", "_num_executors", ")", "]", "if", "arg_0", ".", "_sql", ":", "arg_4", "=", "arg_0", ".", "_sql", ".", "strip", "(", ")", "if", "arg_4", ".", "endswith", "(", "\".sql\"", ")", "or", "arg_4", ".", "endswith", "(", "\".hql\"", ")", ":", "arg_2", "+=", "[", "\"-f\"", ",", "arg_4", "]", "else", ":", "arg_2", "+=", "[", "\"-e\"", ",", "arg_4", "]", "if", "arg_0", ".", "_master", ":", "arg_2", "+=", "[", "\"--master\"", ",", "arg_0", ".", "_master", "]", "if", "arg_0", ".", "_name", ":", "arg_2", "+=", "[", "\"--name\"", ",", "arg_0", ".", "_name", "]", "if", "arg_0", ".", "_verbose", ":", "arg_2", "+=", "[", "\"--verbose\"", "]", "if", "arg_0", ".", "_yarn_queue", ":", "arg_2", "+=", "[", "\"--queue\"", ",", "arg_0", ".", "_yarn_queue", "]", "arg_2", "+=", "arg_1", "arg_0", ".", "log", ".", "debug", "(", "\"Spark-Sql cmd: %s\"", ",", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Construct the spark-sql command to execute. Verbose output is enabled\n        as default.\n\n        :param cmd: command to append to the spark-sql command\n        :type cmd: str\n        :return: full command to be executed\n        \"\"\"\n        arg_2 = [\"spark-sql\"]\n        if arg_0._conf:\n            for arg_3 in arg_0._conf.split(\",\"):\n                arg_2 += [\"--conf\", arg_3]\n        if arg_0._total_executor_cores:\n            arg_2 += [\"--total-executor-cores\", str(arg_0._total_executor_cores)]\n        if arg_0._executor_cores:\n            arg_2 += [\"--executor-cores\", str(arg_0._executor_cores)]\n        if arg_0._executor_memory:\n            arg_2 += [\"--executor-memory\", arg_0._executor_memory]\n        if arg_0._keytab:\n            arg_2 += [\"--keytab\", arg_0._keytab]\n        if arg_0._principal:\n            arg_2 += [\"--principal\", arg_0._principal]\n        if arg_0._num_executors:\n            arg_2 += [\"--num-executors\", str(arg_0._num_executors)]\n        if arg_0._sql:\n            arg_4 = arg_0._sql.strip()\n            if arg_4.endswith(\".sql\") or arg_4.endswith(\".hql\"):\n                arg_2 += [\"-f\", arg_4]\n            else:\n                arg_2 += [\"-e\", arg_4]\n        if arg_0._master:\n            arg_2 += [\"--master\", arg_0._master]\n        if arg_0._name:\n            arg_2 += [\"--name\", arg_0._name]\n        if arg_0._verbose:\n            arg_2 += [\"--verbose\"]\n        if arg_0._yarn_queue:\n            arg_2 += [\"--queue\", arg_0._yarn_queue]\n\n        arg_2 += arg_1\n        arg_0.log.debug(\"Spark-Sql cmd: %s\", arg_2)\n\n        return arg_2", "path": "airflow/contrib/hooks/spark_sql_hook.py", "identifier": "SparkSqlHook._prepare_command", "docstring": "Construct the spark-sql command to execute. Verbose output is enabled\n        as default.\n\n        :param cmd: command to append to the spark-sql command\n        :type cmd: str\n        :return: full command to be executed", "docstring_tokens": ["Construct", "the", "spark", "-", "sql", "command", "to", "execute", ".", "Verbose", "output", "is", "enabled", "as", "default", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253846}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/dynamic.py#L80-L105", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "Called to update the state of the iterator.  This methods\n        receives the set of task ids from the previous set of tasks\n        together with the launch information to allow the output\n        values to be parsed using the output_extractor. This data is then\n        used to determine the next desired point in the parameter\n        space by calling the _update_state method.", "language": "python", "parameters": "(self, tids, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_2", "[", "'root_directory'", "]", ",", "'streams'", ")", "arg_4", "=", "'%s_*_tid_*{tid}.o.{tid}*'", "%", "arg_2", "[", "'batch_name'", "]", "arg_5", "=", "os", ".", "listdir", "(", "arg_3", ")", "try", ":", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_1", ":", "arg_8", "=", "fnmatch", ".", "filter", "(", "arg_5", ",", "arg_4", ".", "format", "(", "arg_7", "=", "arg_7", ")", ")", "if", "len", "(", "arg_8", ")", "!=", "1", ":", "arg_0", ".", "warning", "(", "\"No unique output file for tid %d\"", "%", "arg_7", ")", "arg_9", "=", "open", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_8", "[", "0", "]", ")", ",", "'r'", ")", ".", "read", "(", ")", "arg_6", ".", "append", "(", "arg_0", ".", "output_extractor", "(", "arg_9", ")", ")", "arg_0", ".", "_next_val", "=", "arg_0", ".", "_Func_state", "(", "arg_6", ")", "arg_0", ".", "trace", ".", "append", "(", "(", "arg_6", ",", "arg_0", ".", "_next_val", ")", ")", "except", ":", "arg_0", ".", "warning", "(", "\"Cannot load required output files. Cannot continue.\"", ")", "arg_0", ".", "_next_val", "=", "StopIteration"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Called to Func the state of the iterator.  This methods\n        receives the set of task ids from the previous set of tasks\n        together with the launch information to allow the output\n        values to be parsed using the output_extractor. This data is then\n        used to determine the next desired point in the parameter\n        space by calling the _Func_state method.\n        \"\"\"\n        arg_3 = os.path.join(arg_2['root_directory'], 'streams')\n        arg_4 = '%s_*_tid_*{tid}.o.{tid}*' % arg_2['batch_name']\n        arg_5 = os.listdir(arg_3)\n        try:\n            arg_6 = []\n            for arg_7 in arg_1:\n                arg_8 = fnmatch.filter(arg_5, arg_4.format(arg_7=arg_7))\n                if len(arg_8) != 1:\n                    arg_0.warning(\"No unique output file for tid %d\" % arg_7)\n                arg_9 = open(os.path.join(arg_3, arg_8[0]),'r').read()\n                arg_6.append(arg_0.output_extractor(arg_9))\n\n            arg_0._next_val = arg_0._Func_state(arg_6)\n            arg_0.trace.append((arg_6, arg_0._next_val))\n        except:\n            arg_0.warning(\"Cannot load required output files. Cannot continue.\")\n            arg_0._next_val = StopIteration", "path": "lancet/dynamic.py", "identifier": "DynamicArgs.update", "docstring": "Called to update the state of the iterator.  This methods\n        receives the set of task ids from the previous set of tasks\n        together with the launch information to allow the output\n        values to be parsed using the output_extractor. This data is then\n        used to determine the next desired point in the parameter\n        space by calling the _update_state method.", "docstring_tokens": ["Called", "to", "update", "the", "state", "of", "the", "iterator", ".", "This", "methods", "receives", "the", "set", "of", "task", "ids", "from", "the", "previous", "set", "of", "tasks", "together", "with", "the", "launch", "information", "to", "allow", "the", "output", "values", "to", "be", "parsed", "using", "the", "output_extractor", ".", "This", "data", "is", "then", "used", "to", "determine", "the", "next", "desired", "point", "in", "the", "parameter", "space", "by", "calling", "the", "_update_state", "method", "."], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 253847}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1355-L1380", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "If confidence >= verbose, category passes filter and is not suppressed.", "language": "python", "parameters": "(category, confidence, linenum)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "IsErrorSuppressedByNolint", "(", "arg_0", ",", "arg_2", ")", ":", "return", "False", "if", "arg_1", "<", "_cpplint_state", ".", "verbose_level", ":", "return", "False", "arg_3", "=", "False", "for", "arg_4", "in", "_Filters", "(", ")", ":", "if", "arg_4", ".", "startswith", "(", "'-'", ")", ":", "if", "arg_0", ".", "startswith", "(", "arg_4", "[", "1", ":", "]", ")", ":", "arg_3", "=", "True", "elif", "arg_4", ".", "startswith", "(", "'+'", ")", ":", "if", "arg_0", ".", "startswith", "(", "arg_4", "[", "1", ":", "]", ")", ":", "arg_3", "=", "False", "else", ":", "assert", "False", "if", "arg_3", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"If confidence >= verbose, category passes filter and is not suppressed.\"\"\"\n\n  # There are three ways we might decide not to print an error message:\n  # a \"NOLINT(category)\" comment appears in the source,\n  # the verbosity level isn't high enough, or the filters filter it out.\n  if IsErrorSuppressedByNolint(arg_0, arg_2):\n    return False\n\n  if arg_1 < _cpplint_state.verbose_level:\n    return False\n\n  arg_3 = False\n  for arg_4 in _Filters():\n    if arg_4.startswith('-'):\n      if arg_0.startswith(arg_4[1:]):\n        arg_3 = True\n    elif arg_4.startswith('+'):\n      if arg_0.startswith(arg_4[1:]):\n        arg_3 = False\n    else:\n      assert False  # should have been checked for in SetFilter.\n  if arg_3:\n    return False\n\n  return True", "path": "third_party/python/cpplint/cpplint.py", "identifier": "_ShouldPrintError", "docstring": "If confidence >= verbose, category passes filter and is not suppressed.", "docstring_tokens": ["If", "confidence", ">", "=", "verbose", "category", "passes", "filter", "and", "is", "not", "suppressed", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253848}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/epicom/algorithm.py#L21-L30", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get a mapping from drugs to their list of gene.", "language": "python", "parameters": "(manager: Optional['bio2bel_drugbank.manager'] = None)", "return_statement": "return manager.get_drug_to_hgnc_symbols()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "'bio2bel_drugbank.manager'", "]", "=", "None", ")", "->", "Mapping", "[", "str", ",", "List", "[", "str", "]", "]", ":", "if", "arg_0", "is", "None", ":", "import", "bio2bel_drugbank", "arg_0", "=", "bio2bel_drugbank", ".", "Manager", "(", ")", "if", "not", "arg_0", ".", "is_populated", "(", ")", ":", "arg_0", ".", "populate", "(", ")", "return", "arg_0", ".", "get_drug_to_hgnc_symbols", "(", ")"], "function": "def Func(arg_0: arg_1['bio2bel_drugbank.manager'] = None) -> Mapping[str, List[str]]:\n    \"\"\"Get a mapping from drugs to their list of gene.\"\"\"\n    if arg_0 is None:\n        import bio2bel_drugbank\n        arg_0 = bio2bel_drugbank.Manager()\n\n    if not arg_0.is_populated():\n        arg_0.populate()\n\n    return arg_0.get_drug_to_hgnc_symbols()", "path": "src/pybel_tools/analysis/epicom/algorithm.py", "identifier": "_get_drug_target_interactions", "docstring": "Get a mapping from drugs to their list of gene.", "docstring_tokens": ["Get", "a", "mapping", "from", "drugs", "to", "their", "list", "of", "gene", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253849}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L276-L303", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Runs a network before the actual experiment.", "language": "python", "parameters": "(self, traj, network, network_dict, component_list, analyser_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_0", ".", "_execute_network_run", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "pre_run", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"Runs a network before the actual experiment.\n\n        Called by a :class:`~pypet.brian2.network.NetworkManager`.\n        Similar to :func:`~pypet.brian2.network.NetworkRunner.run_network`.\n\n        Subruns and their durations are extracted from the trajectory. All\n        :class:`~pypet.brian2.parameter.Brian2Parameter` instances found under\n        `traj.parameters.simulation.pre_durations` (default, you can change the\n        name of the group where to search for durations at runner initialisation).\n        The order is determined from\n        the `v_annotations.order` attributes. There must be at least one subrun in the trajectory,\n        otherwise an AttributeError is thrown. If two subruns equal in their order\n        property a RuntimeError is thrown.\n\n        :param traj: Trajectory container\n\n        :param network: BRIAN2 network\n\n        :param network_dict: Dictionary of items shared among all components\n\n        :param component_list: List of :class:`~pypet.brian2.network.NetworkComponent` objects\n\n        :param analyser_list: List of :class:`~pypet.brian2.network.NetworkAnalyser` objects\n\n        \"\"\"\n        arg_0._execute_network_run(arg_1, arg_2, arg_3, arg_4, arg_5,\n                                  pre_run=True)", "path": "pypet/brian2/network.py", "identifier": "NetworkRunner.execute_network_pre_run", "docstring": "Runs a network before the actual experiment.\n\n        Called by a :class:`~pypet.brian2.network.NetworkManager`.\n        Similar to :func:`~pypet.brian2.network.NetworkRunner.run_network`.\n\n        Subruns and their durations are extracted from the trajectory. All\n        :class:`~pypet.brian2.parameter.Brian2Parameter` instances found under\n        `traj.parameters.simulation.pre_durations` (default, you can change the\n        name of the group where to search for durations at runner initialisation).\n        The order is determined from\n        the `v_annotations.order` attributes. There must be at least one subrun in the trajectory,\n        otherwise an AttributeError is thrown. If two subruns equal in their order\n        property a RuntimeError is thrown.\n\n        :param traj: Trajectory container\n\n        :param network: BRIAN2 network\n\n        :param network_dict: Dictionary of items shared among all components\n\n        :param component_list: List of :class:`~pypet.brian2.network.NetworkComponent` objects\n\n        :param analyser_list: List of :class:`~pypet.brian2.network.NetworkAnalyser` objects", "docstring_tokens": ["Runs", "a", "network", "before", "the", "actual", "experiment", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253850}
{"url": "https://github.com/zorg/zorg-network-camera/blob/e2d15725e50370e2df0c38be6b039215873e4278/zorg_network_camera/adaptor.py#L42-L67", "sha": "e2d15725e50370e2df0c38be6b039215873e4278", "docstring_summary": "Method to check if an image has changed\n        since it was last downloaded. By making\n        a head request, this check can be done\n        quicker that downloading and processing\n        the whole file.", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urllib_request", ".", "Request", "(", "arg_0", ".", "url", ")", "arg_1", ".", "get_method", "=", "lambda", ":", "'HEAD'", "arg_3", "=", "urllib_request", ".", "urlopen", "(", "arg_1", ")", "arg_4", "=", "arg_3", ".", "info", "(", ")", "if", "'Last-Modified'", "in", "arg_4", ":", "arg_5", "=", "arg_4", "[", "'Last-Modified'", "]", "if", "arg_5", "==", "arg_0", ".", "image_last_modified", ":", "return", "False", "arg_0", ".", "image_last_modified", "=", "arg_5", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"\n        Method to check if an image has changed\n        since it was last downloaded. By making\n        a head request, this check can be done\n        quicker that downloading and processing\n        the whole file.\n        \"\"\"\n        arg_1 = urllib_request.Request(arg_0.url)\n        arg_1.get_method = lambda: 'HEAD'\n\n        arg_3 = urllib_request.urlopen(arg_1)\n        arg_4 = arg_3.info()\n\n        if 'Last-Modified' in arg_4:\n            arg_5 = arg_4['Last-Modified']\n\n            # Return False if the image has not been modified\n            if arg_5 == arg_0.image_last_modified:\n                return False\n\n        arg_0.image_last_modified = arg_5\n\n        # Return True if the image has been modified\n        # or if the image has no last-modified header\n        return True", "path": "zorg_network_camera/adaptor.py", "identifier": "Camera.has_changed", "docstring": "Method to check if an image has changed\n        since it was last downloaded. By making\n        a head request, this check can be done\n        quicker that downloading and processing\n        the whole file.", "docstring_tokens": ["Method", "to", "check", "if", "an", "image", "has", "changed", "since", "it", "was", "last", "downloaded", ".", "By", "making", "a", "head", "request", "this", "check", "can", "be", "done", "quicker", "that", "downloading", "and", "processing", "the", "whole", "file", "."], "nwo": "zorg/zorg-network-camera", "score": 0.08529914490135834, "idx": 253851}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L350-L412", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Initialize an empty repository with datapackage.json", "language": "python", "parameters": "(username, reponame, setup,\n         force=False, options=None,\n         noinput=False)", "return_statement": "return repo", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "plugins_get_mgr", "(", ")", "arg_7", "=", "arg_6", ".", "get", "(", "what", "=", "'repomanager'", ",", "name", "=", "'git'", ")", "arg_8", "=", "None", "if", "arg_2", "==", "'git+s3'", ":", "arg_8", "=", "arg_6", ".", "get", "(", "what", "=", "'backend'", ",", "name", "=", "'s3'", ")", "arg_9", "=", "arg_7", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_3", ",", "arg_8", ")", "(", "arg_10", ",", "arg_11", ")", "=", "tempfile", ".", "mkstemp", "(", ")", "with", "open", "(", "arg_11", ",", "'w'", ")", "as", "fd", ":", "fd", ".", "write", "(", "\".dgit\"", ")", "try", ":", "arg_12", "=", "bootstrap_datapackage", "(", "arg_9", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "except", "Exception", "as", "e", ":", "arg_7", ".", "drop", "(", "arg_9", ",", "[", "]", ")", "os", ".", "unlink", "(", "arg_11", ")", "raise", "e", "arg_9", ".", "run", "(", "'add_files'", ",", "[", "{", "'relativepath'", ":", "'datapackage.json'", ",", "'localfullpath'", ":", "arg_12", ",", "}", ",", "{", "'relativepath'", ":", "'.gitignore'", ",", "'localfullpath'", ":", "arg_11", ",", "}", ",", "]", ")", "os", ".", "unlink", "(", "arg_12", ")", "os", ".", "unlink", "(", "arg_11", ")", "arg_13", "=", "[", "'-a'", ",", "'-m'", ",", "'Bootstrapped the repo'", "]", "arg_9", ".", "run", "(", "'commit'", ",", "arg_13", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2,\n         arg_3=False, arg_4=None,\n         arg_5=False):\n    \"\"\"\n    Initialize an empty repository with datapackage.json\n\n    Parameters\n    ----------\n\n    username: Name of the user\n    reponame: Name of the repo\n    setup: Specify the 'configuration' (git only, git+s3 backend etc)\n    force: Force creation of the files\n    options: Dictionary with content of dgit.json, if available.\n    noinput: Automatic operation with no human interaction\n    \"\"\"\n\n    arg_6 = plugins_get_mgr()\n    arg_7 = arg_6.get(what='repomanager', name='git')\n\n    arg_8 = None\n    if arg_2 == 'git+s3':\n        arg_8 = arg_6.get(what='backend', name='s3')\n\n    arg_9 = arg_7.Func(arg_0, arg_1, arg_3, arg_8)\n\n    # Now bootstrap the datapackage.json metadata file and copy it in...\n\n    # Insert a gitignore with .dgit directory in the repo. This\n    # directory will be used to store partial results\n    (arg_10, arg_11) = tempfile.mkstemp()\n    with open(arg_11, 'w') as fd:\n        fd.write(\".dgit\")\n\n    # Try to bootstrap. If you cant, cleanup and return\n    try:\n        arg_12 = bootstrap_datapackage(arg_9, arg_3, arg_4, arg_5)\n    except Exception as e:\n        arg_7.drop(arg_9,[])\n        os.unlink(arg_11)\n        raise e\n\n    arg_9.run('add_files',\n             [\n                 {\n                     'relativepath': 'datapackage.json',\n                     'localfullpath': arg_12,\n                 },\n                 {\n                     'relativepath': '.gitignore',\n                     'localfullpath': arg_11,\n                 },\n             ])\n\n\n    # Cleanup temp files\n    os.unlink(arg_12)\n    os.unlink(arg_11)\n\n    arg_13 = ['-a', '-m', 'Bootstrapped the repo']\n    arg_9.run('commit', arg_13)\n    \n    return arg_9", "path": "dgitcore/datasets/common.py", "identifier": "init", "docstring": "Initialize an empty repository with datapackage.json\n\n    Parameters\n    ----------\n\n    username: Name of the user\n    reponame: Name of the repo\n    setup: Specify the 'configuration' (git only, git+s3 backend etc)\n    force: Force creation of the files\n    options: Dictionary with content of dgit.json, if available.\n    noinput: Automatic operation with no human interaction", "docstring_tokens": ["Initialize", "an", "empty", "repository", "with", "datapackage", ".", "json"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 253852}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/packager.py#L42-L52", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Preparse the packaging system for installations.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "packager", "if", "arg_1", "==", "APT", ":", "arg_0", ".", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive apt-get -yq Func'", ")", "elif", "arg_1", "==", "YUM", ":", "arg_0", ".", "sudo", "(", "'yum Func'", ")", "else", ":", "raise", "Exception", "(", "'Unknown packager: %s'", "%", "(", "arg_1", ",", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Preparse the packaging system for installations.\n        \"\"\"\n        arg_1 = arg_0.packager\n        if arg_1 == APT:\n            arg_0.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq Func')\n        elif arg_1 == YUM:\n            arg_0.sudo('yum Func')\n        else:\n            raise Exception('Unknown packager: %s' % (arg_1,))", "path": "burlap/packager.py", "identifier": "PackagerSatchel.update", "docstring": "Preparse the packaging system for installations.", "docstring_tokens": ["Preparse", "the", "packaging", "system", "for", "installations", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 253853}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/stream.py#L40-L42", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "The current position of the cursor.", "language": "python", "parameters": "(self)", "return_statement": "return Position(self._index, self._lineno, self._col_offset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Position", ":", "return", "Position", "(", "arg_0", ".", "_index", ",", "arg_0", ".", "_lineno", ",", "arg_0", ".", "_col_offset", ")"], "function": "def Func(arg_0) -> Position:\n        \"\"\"The current Func of the cursor.\"\"\"\n        return Position(arg_0._index, arg_0._lineno, arg_0._col_offset)", "path": "pyrser/parsing/stream.py", "identifier": "Cursor.position", "docstring": "The current position of the cursor.", "docstring_tokens": ["The", "current", "position", "of", "the", "cursor", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 253854}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/application/briefkasten/__init__.py#L65-L71", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "this factory also requires the editor token", "language": "python", "parameters": "(request)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dropbox_factory", "(", "arg_0", ")", "if", "is_equal", "(", "arg_1", ".", "editor_token", ",", "arg_0", ".", "matchdict", "[", "'editor_token'", "]", ".", "encode", "(", "'utf-8'", ")", ")", ":", "return", "arg_1", "else", ":", "raise", "HTTPNotFound", "(", "'invalid editor token'", ")"], "function": "def Func(arg_0):\n    \"\"\" this factory also requires the editor token\"\"\"\n    arg_1 = dropbox_factory(arg_0)\n    if is_equal(arg_1.editor_token, arg_0.matchdict['editor_token'].encode('utf-8')):\n        return arg_1\n    else:\n        raise HTTPNotFound('invalid editor token')", "path": "application/briefkasten/__init__.py", "identifier": "dropbox_editor_factory", "docstring": "this factory also requires the editor token", "docstring_tokens": ["this", "factory", "also", "requires", "the", "editor", "token"], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 253855}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/arm.py#L1100-L1121", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Table Branch Halfword causes a PC-relative forward branch using a table of single halfword offsets. A base\n        register provides a pointer to the table, and a second register supplies an index into the table. The branch\n        length is twice the value of the halfword returned from the table.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_mem_base_addr", "(", ")", "if", "arg_1", ".", "mem", ".", "base", "in", "(", "'PC'", ",", "'R15'", ")", ":", "arg_2", "=", "arg_0", ".", "PC", "arg_3", "=", "arg_0", ".", "read_int", "(", "arg_2", "+", "arg_1", ".", "get_mem_offset", "(", ")", ",", "16", ")", "arg_3", "=", "Operators", ".", "ZEXTEND", "(", "arg_3", ",", "arg_0", ".", "address_bit_size", ")", "arg_0", ".", "PC", "+=", "(", "arg_3", "<<", "1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Table Branch Halfword causes a PC-relative forward branch using a table of single halfword offsets. A base\n        register provides a pointer to the table, and a second register supplies an index into the table. The branch\n        length is twice the value of the halfword returned from the table.\n\n        :param ARMv7Operand dest: see below; register\n        \"\"\"\n        # Capstone merges the two registers values into one operand, so we need to extract them back\n\n        # Specifies the base register. This contains the address of the table of branch lengths. This\n        # register is allowed to be the PC. If it is, the table immediately follows this instruction.\n        arg_2 = arg_1.get_mem_base_addr()\n        if arg_1.mem.base in ('PC', 'R15'):\n            arg_2 = arg_0.PC\n\n        # Specifies the index register. This contains an integer pointing to a halfword within the table.\n        # The offset within the table is twice the value of the index.\n        arg_3 = arg_0.read_int(arg_2 + arg_1.get_mem_offset(), 16)\n        arg_3 = Operators.ZEXTEND(arg_3, arg_0.address_bit_size)\n\n        arg_0.PC += (arg_3 << 1)", "path": "manticore/native/cpu/arm.py", "identifier": "Armv7Cpu.TBH", "docstring": "Table Branch Halfword causes a PC-relative forward branch using a table of single halfword offsets. A base\n        register provides a pointer to the table, and a second register supplies an index into the table. The branch\n        length is twice the value of the halfword returned from the table.\n\n        :param ARMv7Operand dest: see below; register", "docstring_tokens": ["Table", "Branch", "Halfword", "causes", "a", "PC", "-", "relative", "forward", "branch", "using", "a", "table", "of", "single", "halfword", "offsets", ".", "A", "base", "register", "provides", "a", "pointer", "to", "the", "table", "and", "a", "second", "register", "supplies", "an", "index", "into", "the", "table", ".", "The", "branch", "length", "is", "twice", "the", "value", "of", "the", "halfword", "returned", "from", "the", "table", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 253856}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/server.py#L554-L570", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Handle a DELETE request.", "language": "python", "parameters": "(self, thing_id='0', action_name=None, action_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'0'", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "get_thing", "(", "arg_1", ")", "if", "arg_4", "is", "None", ":", "arg_0", ".", "set_status", "(", "404", ")", "return", "if", "arg_4", ".", "remove_action", "(", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "set_status", "(", "204", ")", "else", ":", "arg_0", ".", "set_status", "(", "404", ")"], "function": "def Func(arg_0, arg_1='0', arg_2=None, arg_3=None):\n        \"\"\"\n        Handle a DELETE request.\n\n        thing_id -- ID of the thing this request is for\n        action_name -- name of the action from the URL path\n        action_id -- the action ID from the URL path\n        \"\"\"\n        arg_4 = arg_0.get_thing(arg_1)\n        if arg_4 is None:\n            arg_0.set_status(404)\n            return\n\n        if arg_4.remove_action(arg_2, arg_3):\n            arg_0.set_status(204)\n        else:\n            arg_0.set_status(404)", "path": "webthing/server.py", "identifier": "ActionIDHandler.delete", "docstring": "Handle a DELETE request.\n\n        thing_id -- ID of the thing this request is for\n        action_name -- name of the action from the URL path\n        action_id -- the action ID from the URL path", "docstring_tokens": ["Handle", "a", "DELETE", "request", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 253857}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/connection.py#L503-L515", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Start logging all API requests to the provided destination.", "language": "python", "parameters": "(self, dest=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "assert_is_type", "(", "arg_1", ",", "None", ",", "str", ",", "type", "(", "sys", ".", "stdout", ")", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "mkdtemp", "(", ")", ",", "\"h2o-connection.log\"", ")", "arg_0", ".", "_print", "(", "\"Now logging all API requests to file %r\"", "%", "arg_1", ")", "arg_0", ".", "_is_logging", "=", "True", "arg_0", ".", "_logging_dest", "=", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Start logging all API requests to the provided destination.\n\n        :param dest: Where to write the log: either a filename (str), or an open file handle (file). If not given,\n            then a new temporary file will be created.\n        \"\"\"\n        assert_is_type(arg_1, None, str, type(sys.stdout))\n        if arg_1 is None:\n            arg_1 = os.path.join(tempfile.mkdtemp(), \"h2o-connection.log\")\n        arg_0._print(\"Now logging all API requests to file %r\" % arg_1)\n        arg_0._is_logging = True\n        arg_0._logging_dest = arg_1", "path": "h2o-py/h2o/backend/connection.py", "identifier": "H2OConnection.start_logging", "docstring": "Start logging all API requests to the provided destination.\n\n        :param dest: Where to write the log: either a filename (str), or an open file handle (file). If not given,\n            then a new temporary file will be created.", "docstring_tokens": ["Start", "logging", "all", "API", "requests", "to", "the", "provided", "destination", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253858}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/dtype_util.py#L52-L57", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns a non-reference `dtype` based on this `dtype`.", "language": "python", "parameters": "(dtype)", "return_statement": "return dtype", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "tf", ".", "as_dtype", "(", "arg_0", ")", "if", "hasattr", "(", "arg_0", ",", "'Func'", ")", ":", "return", "arg_0", ".", "Func", "return", "arg_0"], "function": "def Func(arg_0):\n  \"\"\"Returns a non-reference `dtype` based on this `dtype`.\"\"\"\n  arg_0 = tf.as_dtype(arg_0)\n  if hasattr(arg_0, 'Func'):\n    return arg_0.Func\n  return arg_0", "path": "tensorflow_probability/python/internal/dtype_util.py", "identifier": "base_dtype", "docstring": "Returns a non-reference `dtype` based on this `dtype`.", "docstring_tokens": ["Returns", "a", "non", "-", "reference", "dtype", "based", "on", "this", "dtype", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253859}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/data_generator.py#L339-L363", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Export all the records into a csv file in numenta format.", "language": "python", "parameters": "(self, path='myOutput')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'myOutput'", ")", ":", "arg_2", "=", "arg_0", ".", "fields", "[", "0", "]", ".", "numRecords", "assert", "(", "all", "(", "arg_3", ".", "numRecords", "==", "arg_2", "for", "arg_3", "in", "arg_0", ".", "fields", ")", ")", "import", "csv", "with", "open", "(", "arg_1", "+", "'.csv'", ",", "'wb'", ")", "as", "f", ":", "arg_4", "=", "csv", ".", "writer", "(", "f", ")", "arg_4", ".", "writerow", "(", "arg_0", ".", "getAllFieldNames", "(", ")", ")", "arg_4", ".", "writerow", "(", "arg_0", ".", "getAllDataTypes", "(", ")", ")", "arg_4", ".", "writerow", "(", "arg_0", ".", "getAllFlags", "(", ")", ")", "arg_4", ".", "writerows", "(", "arg_0", ".", "getAllRecords", "(", ")", ")", "if", "arg_0", ".", "verbosity", ">", "0", ":", "print", "'******'", ",", "arg_2", ",", "'records exported in numenta format to file:'", ",", "arg_1", ",", "'******\\n'"], "function": "def Func(arg_0, arg_1='myOutput'):\n    \"\"\"Export all the records into a csv file in numenta format.\n\n    Example header format:\n    fieldName1    fieldName2    fieldName3\n    date          string        float\n    T             S\n\n    Parameters:\n    --------------------------------------------------------------------\n    path:      Relative path of the file to which the records are to be exported\n    \"\"\"\n    arg_2 = arg_0.fields[0].numRecords\n    assert (all(arg_3.numRecords==arg_2 for arg_3 in arg_0.fields))\n\n    import csv\n    with open(arg_1+'.csv', 'wb') as f:\n      arg_4 = csv.writer(f)\n      arg_4.writerow(arg_0.getAllFieldNames())\n      arg_4.writerow(arg_0.getAllDataTypes())\n      arg_4.writerow(arg_0.getAllFlags())\n      arg_4.writerows(arg_0.getAllRecords())\n    if arg_0.verbosity>0:\n      print '******', arg_2,'records exported in numenta format to file:',\\\n                arg_1,'******\\n'", "path": "src/nupic/data/generators/data_generator.py", "identifier": "DataGenerator.saveRecords", "docstring": "Export all the records into a csv file in numenta format.\n\n    Example header format:\n    fieldName1    fieldName2    fieldName3\n    date          string        float\n    T             S\n\n    Parameters:\n    --------------------------------------------------------------------\n    path:      Relative path of the file to which the records are to be exported", "docstring_tokens": ["Export", "all", "the", "records", "into", "a", "csv", "file", "in", "numenta", "format", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253860}
{"url": "https://github.com/siddhantgoel/tornado-sqlalchemy/blob/3e622b5a2be57b505599b98156540b52a8a5cf4e/tornado_sqlalchemy/__init__.py#L47-L80", "sha": "3e622b5a2be57b505599b98156540b52a8a5cf4e", "docstring_summary": "Wrap a `sqlalchemy.orm.query.Query` object into a\n        `concurrent.futures.Future` so that it can be yielded.", "language": "python", "parameters": "(self, query)", "return_statement": "return new_future", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_pool", ":", "arg_0", ".", "_pool", "=", "ThreadPoolExecutor", "(", "max_workers", "=", "arg_0", ".", "_max_workers", ")", "arg_3", "=", "arg_0", ".", "_pool", ".", "submit", "(", "arg_1", ")", "arg_4", "=", "Future", "(", ")", "IOLoop", ".", "current", "(", ")", ".", "add_future", "(", "arg_3", ",", "lambda", "f", ":", "chain_future", "(", "f", ",", "arg_4", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Wrap a `sqlalchemy.orm.query.Query` object into a\n        `concurrent.futures.Future` so that it can be yielded.\n\n        Parameters\n        ----------\n        query : sqlalchemy.orm.query.Query\n            SQLAlchemy query object to execute\n\n        Returns\n        -------\n            tornado.concurrent.Future\n                A `Future` object wrapping the given query so that tornado can\n                await/yield on it\n        \"\"\"\n        # concurrent.futures.Future is not compatible with the \"new style\"\n        # asyncio Future, and awaiting on such \"old-style\" futures does not\n        # work.\n        #\n        # tornado includes a `run_in_executor` function to help with this\n        # problem, but it's only included in version 5+. Hence, we copy a\n        # little bit of code here to handle this incompatibility.\n\n        if not arg_0._pool:\n            arg_0._pool = ThreadPoolExecutor(max_workers=arg_0._max_workers)\n\n        arg_3 = arg_0._pool.submit(arg_1)\n        arg_4 = Future()\n\n        IOLoop.current().add_future(\n            arg_3, lambda f: chain_future(f, arg_4)\n        )\n\n        return arg_4", "path": "tornado_sqlalchemy/__init__.py", "identifier": "_AsyncExecution.as_future", "docstring": "Wrap a `sqlalchemy.orm.query.Query` object into a\n        `concurrent.futures.Future` so that it can be yielded.\n\n        Parameters\n        ----------\n        query : sqlalchemy.orm.query.Query\n            SQLAlchemy query object to execute\n\n        Returns\n        -------\n            tornado.concurrent.Future\n                A `Future` object wrapping the given query so that tornado can\n                await/yield on it", "docstring_tokens": ["Wrap", "a", "sqlalchemy", ".", "orm", ".", "query", ".", "Query", "object", "into", "a", "concurrent", ".", "futures", ".", "Future", "so", "that", "it", "can", "be", "yielded", "."], "nwo": "siddhantgoel/tornado-sqlalchemy", "score": 0.5699800621411442, "idx": 253861}
{"url": "https://github.com/neithere/argh/blob/dcd3253f2994400a6a58a700c118c53765bc50a4/argh/assembling.py#L321-L459", "sha": "dcd3253f2994400a6a58a700c118c53765bc50a4", "docstring_summary": "Adds given functions as commands to given parser.", "language": "python", "parameters": "(parser, functions, namespace=None, namespace_kwargs=None,\n                 func_kwargs=None,\n                 # deprecated args:\n                 title=None, description=None, help=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ")", ":", "if", "DEST_FUNCTION", "in", "arg_0", ".", "_defaults", ":", "_require_support_for_default_command_with_subparsers", "(", ")", "arg_3", "=", "arg_3", "or", "{", "}", "if", "arg_5", ":", "warnings", ".", "warn", "(", "'argument `title` is deprecated in Func(),'", "' use `parser_kwargs` instead'", ",", "DeprecationWarning", ")", "arg_3", "[", "'description'", "]", "=", "arg_5", "if", "arg_7", ":", "warnings", ".", "warn", "(", "'argument `help` is deprecated in Func(),'", "' use `parser_kwargs` instead'", ",", "DeprecationWarning", ")", "arg_3", "[", "'help'", "]", "=", "arg_7", "if", "arg_6", ":", "warnings", ".", "warn", "(", "'argument `description` is deprecated in Func(),'", "' use `parser_kwargs` instead'", ",", "DeprecationWarning", ")", "arg_3", "[", "'description'", "]", "=", "arg_6", "arg_8", "=", "get_subparsers", "(", "arg_0", ",", "create", "=", "True", ")", "if", "arg_2", ":", "arg_9", "=", "{", "'help'", ":", "arg_3", ".", "get", "(", "'title'", ")", ",", "}", "arg_10", "=", "arg_8", ".", "add_parser", "(", "arg_2", ",", "**", "arg_9", ")", "arg_8", "=", "arg_10", ".", "add_subparsers", "(", "**", "arg_3", ")", "else", ":", "assert", "not", "arg_3", ",", "(", "'`parser_kwargs` only makes sense '", "'with `namespace`.'", ")", "for", "arg_11", "in", "arg_1", ":", "arg_12", ",", "arg_13", "=", "_extract_command_meta_from_func", "(", "arg_11", ")", "if", "arg_4", ":", "arg_13", ".", "update", "(", "arg_4", ")", "arg_14", "=", "arg_8", ".", "add_parser", "(", "arg_12", ",", "**", "arg_13", ")", "set_default_command", "(", "arg_14", ",", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                 arg_4=None,\n                 # deprecated args:\n                 arg_5=None, arg_6=None, arg_7=None):\n    \"\"\"\n    Adds given functions as commands to given parser.\n\n    :param parser:\n\n        an :class:`argparse.ArgumentParser` instance.\n\n    :param functions:\n\n        a list of functions. A subparser is created for each of them.\n        If the function is decorated with :func:`~argh.decorators.arg`, the\n        arguments are passed to :class:`argparse.ArgumentParser.add_argument`.\n        See also :func:`~argh.dispatching.dispatch` for requirements\n        concerning function signatures. The command name is inferred from the\n        function name. Note that the underscores in the name are replaced with\n        hyphens, i.e. function name \"foo_bar\" becomes command name \"foo-bar\".\n\n    :param namespace:\n\n        an optional string representing the group of commands. For example, if\n        a command named \"hello\" is added without the namespace, it will be\n        available as \"prog.py hello\"; if the namespace if specified as \"greet\",\n        then the command will be accessible as \"prog.py greet hello\". The\n        namespace itself is not callable, so \"prog.py greet\" will fail and only\n        display a help message.\n\n    :param func_kwargs:\n\n        a `dict` of keyword arguments to be passed to each nested ArgumentParser\n        instance created per command (i.e. per function).  Members of this\n        dictionary have the highest priority, so a function's docstring is\n        overridden by a `help` in `func_kwargs` (if present).\n\n    :param namespace_kwargs:\n\n        a `dict` of keyword arguments to be passed to the nested ArgumentParser\n        instance under given `namespace`.\n\n    Deprecated params that should be moved into `namespace_kwargs`:\n\n    :param title:\n\n        passed to :meth:`argparse.ArgumentParser.add_subparsers` as `title`.\n\n        .. deprecated:: 0.26.0\n\n           Please use `namespace_kwargs` instead.\n\n    :param description:\n\n        passed to :meth:`argparse.ArgumentParser.add_subparsers` as\n        `description`.\n\n        .. deprecated:: 0.26.0\n\n           Please use `namespace_kwargs` instead.\n\n    :param help:\n\n        passed to :meth:`argparse.ArgumentParser.add_subparsers` as `help`.\n\n        .. deprecated:: 0.26.0\n\n           Please use `namespace_kwargs` instead.\n\n    .. note::\n\n        This function modifies the parser object. Generally side effects are\n        bad practice but we don't seem to have any choice as ArgumentParser is\n        pretty opaque.\n        You may prefer :class:`~argh.helpers.ArghParser.Func` for a bit\n        more predictable API.\n\n    .. note::\n\n       An attempt to add commands to a parser which already has a default\n       function (e.g. added with :func:`~argh.assembling.set_default_command`)\n       results in `AssemblingError`.\n\n    \"\"\"\n    # FIXME \"namespace\" is a correct name but it clashes with the \"namespace\"\n    # that represents arguments (argparse.Namespace and our ArghNamespace).\n    # We should rename the argument here.\n\n    if DEST_FUNCTION in arg_0._defaults:\n        _require_support_for_default_command_with_subparsers()\n\n    arg_3 = arg_3 or {}\n\n    # FIXME remove this by 1.0\n    #\n    if arg_5:\n        warnings.warn('argument `title` is deprecated in Func(),'\n                      ' use `parser_kwargs` instead', DeprecationWarning)\n        arg_3['description'] = arg_5\n    if arg_7:\n        warnings.warn('argument `help` is deprecated in Func(),'\n                      ' use `parser_kwargs` instead', DeprecationWarning)\n        arg_3['help'] = arg_7\n    if arg_6:\n        warnings.warn('argument `description` is deprecated in Func(),'\n                      ' use `parser_kwargs` instead', DeprecationWarning)\n        arg_3['description'] = arg_6\n    #\n    # /\n\n    arg_8 = get_subparsers(arg_0, create=True)\n\n    if arg_2:\n        # Make a nested parser and init a deeper _SubParsersAction under it.\n\n        # Create a named group of commands.  It will be listed along with\n        # root-level commands in ``app.py --help``; in that context its `title`\n        # can be used as a short description on the right side of its name.\n        # Normally `title` is shown above the list of commands\n        # in ``app.py my-namespace --help``.\n        arg_9 = {\n            'help': arg_3.get('title'),\n        }\n        arg_10 = arg_8.add_parser(arg_2, **arg_9)\n        arg_8 = arg_10.add_subparsers(**arg_3)\n    else:\n        assert not arg_3, ('`parser_kwargs` only makes sense '\n                                      'with `namespace`.')\n\n    for arg_11 in arg_1:\n        arg_12, arg_13 = _extract_command_meta_from_func(arg_11)\n\n        # override any computed kwargs by manually supplied ones\n        if arg_4:\n            arg_13.update(arg_4)\n\n        # create and set up the parser for this command\n        arg_14 = arg_8.add_parser(arg_12, **arg_13)\n        set_default_command(arg_14, arg_11)", "path": "argh/assembling.py", "identifier": "add_commands", "docstring": "Adds given functions as commands to given parser.\n\n    :param parser:\n\n        an :class:`argparse.ArgumentParser` instance.\n\n    :param functions:\n\n        a list of functions. A subparser is created for each of them.\n        If the function is decorated with :func:`~argh.decorators.arg`, the\n        arguments are passed to :class:`argparse.ArgumentParser.add_argument`.\n        See also :func:`~argh.dispatching.dispatch` for requirements\n        concerning function signatures. The command name is inferred from the\n        function name. Note that the underscores in the name are replaced with\n        hyphens, i.e. function name \"foo_bar\" becomes command name \"foo-bar\".\n\n    :param namespace:\n\n        an optional string representing the group of commands. For example, if\n        a command named \"hello\" is added without the namespace, it will be\n        available as \"prog.py hello\"; if the namespace if specified as \"greet\",\n        then the command will be accessible as \"prog.py greet hello\". The\n        namespace itself is not callable, so \"prog.py greet\" will fail and only\n        display a help message.\n\n    :param func_kwargs:\n\n        a `dict` of keyword arguments to be passed to each nested ArgumentParser\n        instance created per command (i.e. per function).  Members of this\n        dictionary have the highest priority, so a function's docstring is\n        overridden by a `help` in `func_kwargs` (if present).\n\n    :param namespace_kwargs:\n\n        a `dict` of keyword arguments to be passed to the nested ArgumentParser\n        instance under given `namespace`.\n\n    Deprecated params that should be moved into `namespace_kwargs`:\n\n    :param title:\n\n        passed to :meth:`argparse.ArgumentParser.add_subparsers` as `title`.\n\n        .. deprecated:: 0.26.0\n\n           Please use `namespace_kwargs` instead.\n\n    :param description:\n\n        passed to :meth:`argparse.ArgumentParser.add_subparsers` as\n        `description`.\n\n        .. deprecated:: 0.26.0\n\n           Please use `namespace_kwargs` instead.\n\n    :param help:\n\n        passed to :meth:`argparse.ArgumentParser.add_subparsers` as `help`.\n\n        .. deprecated:: 0.26.0\n\n           Please use `namespace_kwargs` instead.\n\n    .. note::\n\n        This function modifies the parser object. Generally side effects are\n        bad practice but we don't seem to have any choice as ArgumentParser is\n        pretty opaque.\n        You may prefer :class:`~argh.helpers.ArghParser.add_commands` for a bit\n        more predictable API.\n\n    .. note::\n\n       An attempt to add commands to a parser which already has a default\n       function (e.g. added with :func:`~argh.assembling.set_default_command`)\n       results in `AssemblingError`.", "docstring_tokens": ["Adds", "given", "functions", "as", "commands", "to", "given", "parser", "."], "nwo": "neithere/argh", "score": 0.5784710843725794, "idx": 253862}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/decorators.py#L123-L136", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Decorator to log the execution time of a function", "language": "python", "parameters": "(logger)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "time", ".", "time", "(", ")", "arg_5", "=", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_6", "=", "time", ".", "time", "(", ")", "_Func", "(", "arg_0", ",", "arg_1", ".", "__name__", ",", "arg_4", ",", "arg_6", ")", "return", "arg_5", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator to log the execution time of a function\n    \"\"\"\n    def decorator(arg_1):\n        @wraps(arg_1)\n        def wrapper(*arg_2, **arg_3):\n            arg_4 = time.time()\n            arg_5 = arg_1(*arg_2, **arg_3)\n            arg_6 = time.time()\n            _Func(arg_0, arg_1.__name__, arg_4, arg_6)\n            return arg_5\n        return wrapper\n    return decorator", "path": "toucan_data_sdk/utils/decorators.py", "identifier": "log_time", "docstring": "Decorator to log the execution time of a function", "docstring_tokens": ["Decorator", "to", "log", "the", "execution", "time", "of", "a", "function"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 253863}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_dict.py#L383-L412", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Combines the disjoint keys in multiple dictionaries. For intersecting keys,\n    dictionaries towards the end of the sequence are given precedence.", "language": "python", "parameters": "(*args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "{", "}", "else", ":", "arg_1", "=", "OrderedDict", "if", "isinstance", "(", "arg_0", "[", "0", "]", ",", "OrderedDict", ")", "else", "dict", "return", "arg_1", "(", "it", ".", "chain", ".", "from_iterable", "(", "arg_2", ".", "items", "(", ")", "for", "arg_2", "in", "arg_0", ")", ")"], "function": "def Func(*arg_0):\n    \"\"\"\n    Combines the disjoint keys in multiple dictionaries. For intersecting keys,\n    dictionaries towards the end of the sequence are given precedence.\n\n    Args:\n        *args : a sequence of dictionaries\n\n    Returns:\n        Dict | OrderedDict :\n            OrderedDict if the first argument is an OrderedDict, otherwise dict\n\n    SeeAlso:\n        collections.ChainMap - a standard python builtin data structure that\n            provides a view that treats multiple dicts as a single dict.\n            https://docs.python.org/3/library/collections.html#chainmap-objects\n\n    Example:\n        >>> result = Func({'a': 1, 'b': 1}, {'b': 2, 'c': 2})\n        >>> assert result == {'a': 1, 'b': 2, 'c': 2}\n        >>> Func(odict([('a', 1), ('b', 2)]), odict([('c', 3), ('d', 4)]))\n        OrderedDict([('a', 1), ('b', 2), ('c', 3), ('d', 4)])\n        >>> Func()\n        {}\n    \"\"\"\n    if not arg_0:\n        return {}\n    else:\n        arg_1 = OrderedDict if isinstance(arg_0[0], OrderedDict) else dict\n        return arg_1(it.chain.from_iterable(arg_2.items() for arg_2 in arg_0))", "path": "ubelt/util_dict.py", "identifier": "dict_union", "docstring": "Combines the disjoint keys in multiple dictionaries. For intersecting keys,\n    dictionaries towards the end of the sequence are given precedence.\n\n    Args:\n        *args : a sequence of dictionaries\n\n    Returns:\n        Dict | OrderedDict :\n            OrderedDict if the first argument is an OrderedDict, otherwise dict\n\n    SeeAlso:\n        collections.ChainMap - a standard python builtin data structure that\n            provides a view that treats multiple dicts as a single dict.\n            https://docs.python.org/3/library/collections.html#chainmap-objects\n\n    Example:\n        >>> result = dict_union({'a': 1, 'b': 1}, {'b': 2, 'c': 2})\n        >>> assert result == {'a': 1, 'b': 2, 'c': 2}\n        >>> dict_union(odict([('a', 1), ('b', 2)]), odict([('c', 3), ('d', 4)]))\n        OrderedDict([('a', 1), ('b', 2), ('c', 3), ('d', 4)])\n        >>> dict_union()\n        {}", "docstring_tokens": ["Combines", "the", "disjoint", "keys", "in", "multiple", "dictionaries", ".", "For", "intersecting", "keys", "dictionaries", "towards", "the", "end", "of", "the", "sequence", "are", "given", "precedence", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 253864}
{"url": "https://github.com/mohan3d/PyOpenload/blob/7f9353915ca5546926ef07be9395c6de60e761b1/openload/openload.py#L290-L331", "sha": "7f9353915ca5546926ef07be9395c6de60e761b1", "docstring_summary": "Checks a remote file upload to status.", "language": "python", "parameters": "(self, limit=None, remote_upload_id=None)", "return_statement": "return self._get('remotedl/status', params=params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "'limit'", ":", "arg_1", ",", "'id'", ":", "arg_2", "}", "arg_4", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "arg_3", ".", "items", "(", ")", "if", "value", "}", "return", "arg_0", ".", "_get", "(", "'remotedl/status'", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Checks a remote file upload to status.\n\n        Args:\n            limit (:obj:`int`, optional): Maximum number of results (Default: 5, Maximum: 100).\n            remote_upload_id (:obj:`str`, optional): Remote Upload ID.\n\n        Returns:\n            dict: dictionary containing all remote uploads, each dictionary element is a dictionary. ::\n\n                {\n                    \"24\": {\n                      \"id\": \"24\",\n                      \"remoteurl\": \"http://proof.ovh.net/files/100Mio.dat\",\n                      \"status\": \"new\",\n                      \"folderid\": \"4248\",\n                      \"added\": \"2015-02-21 09:20:26\",\n                      \"last_update\": \"2015-02-21 09:20:26\",\n                      \"extid\": False,\n                      \"url\": False\n                    },\n                    \"22\": {\n                      \"id\": \"22\",\n                      \"remoteurl\": \"http://proof.ovh.net/files/1Gio.dat\",\n                      \"status\": \"downloading\",\n                      \"bytes_loaded\": \"823997062\",\n                      \"bytes_total\": \"1073741824\",\n                      \"folderid\": \"4248\",\n                      \"added\": \"2015-02-21 09:20:26\",\n                      \"last_update\": \"2015-02-21 09:21:56\",\n                      \"extid\": False,\n                      \"url\": False\n                    },\n                    ...\n                }\n\n        \"\"\"\n\n        arg_3 = {'limit': arg_1, 'id': arg_2}\n        arg_4 = {key: value for key, value in arg_3.items() if value}\n\n        return arg_0._get('remotedl/status', arg_4=arg_4)", "path": "openload/openload.py", "identifier": "OpenLoad.remote_upload_status", "docstring": "Checks a remote file upload to status.\n\n        Args:\n            limit (:obj:`int`, optional): Maximum number of results (Default: 5, Maximum: 100).\n            remote_upload_id (:obj:`str`, optional): Remote Upload ID.\n\n        Returns:\n            dict: dictionary containing all remote uploads, each dictionary element is a dictionary. ::\n\n                {\n                    \"24\": {\n                      \"id\": \"24\",\n                      \"remoteurl\": \"http://proof.ovh.net/files/100Mio.dat\",\n                      \"status\": \"new\",\n                      \"folderid\": \"4248\",\n                      \"added\": \"2015-02-21 09:20:26\",\n                      \"last_update\": \"2015-02-21 09:20:26\",\n                      \"extid\": False,\n                      \"url\": False\n                    },\n                    \"22\": {\n                      \"id\": \"22\",\n                      \"remoteurl\": \"http://proof.ovh.net/files/1Gio.dat\",\n                      \"status\": \"downloading\",\n                      \"bytes_loaded\": \"823997062\",\n                      \"bytes_total\": \"1073741824\",\n                      \"folderid\": \"4248\",\n                      \"added\": \"2015-02-21 09:20:26\",\n                      \"last_update\": \"2015-02-21 09:21:56\",\n                      \"extid\": False,\n                      \"url\": False\n                    },\n                    ...\n                }", "docstring_tokens": ["Checks", "a", "remote", "file", "upload", "to", "status", "."], "nwo": "mohan3d/PyOpenload", "score": 0.19731540530731081, "idx": 253865}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/api/views.py#L277-L287", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Disallow users other than the user whose email is being reset.", "language": "python", "parameters": "(self, request, *args, **kwargs)", "return_statement": "return super(ResendConfirmationEmail, self).initial(\n            request,\n            *args,\n            **kwargs\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "data", ".", "get", "(", "'email'", ")", "if", "arg_1", ".", "user", ".", "is_authenticated", "(", ")", "and", "arg_4", "!=", "arg_1", ".", "user", ".", "email", ":", "raise", "PermissionDenied", "(", ")", "return", "super", "(", "ResendConfirmationEmail", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Disallow users other than the user whose email is being reset.\"\"\"\n        arg_4 = arg_1.data.get('email')\n        if arg_1.user.is_authenticated() and arg_4 != arg_1.user.email:\n            raise PermissionDenied()\n\n        return super(ResendConfirmationEmail, arg_0).Func(\n            arg_1,\n            *arg_2,\n            **arg_3\n        )", "path": "user_management/api/views.py", "identifier": "ResendConfirmationEmail.initial", "docstring": "Disallow users other than the user whose email is being reset.", "docstring_tokens": ["Disallow", "users", "other", "than", "the", "user", "whose", "email", "is", "being", "reset", "."], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 253866}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/SSHKey.py#L73-L89", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Edit the SSH Key", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"name\"", ":", "arg_0", ".", "name", ",", "\"public_key\"", ":", "arg_0", ".", "public_key", ",", "}", "arg_2", "=", "arg_0", ".", "get_data", "(", "\"account/keys/%s\"", "%", "arg_0", ".", "id", ",", "type", "=", "PUT", ",", "params", "=", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "id", "=", "arg_2", "[", "'ssh_key'", "]", "[", "'id'", "]"], "function": "def Func(arg_0):\n        \"\"\"\n            Edit the SSH Key\n        \"\"\"\n        arg_1 = {\n            \"name\": arg_0.name,\n            \"public_key\": arg_0.public_key,\n        }\n\n        arg_2 = arg_0.get_data(\n            \"account/keys/%s\" % arg_0.id,\n            type=PUT,\n            params=arg_1\n        )\n\n        if arg_2:\n            arg_0.id = arg_2['ssh_key']['id']", "path": "digitalocean/SSHKey.py", "identifier": "SSHKey.edit", "docstring": "Edit the SSH Key", "docstring_tokens": ["Edit", "the", "SSH", "Key"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 253867}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/bolt_instance.py#L247-L269", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Indicate that processing of a Tuple has succeeded", "language": "python", "parameters": "(self, tup)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "HeronTuple", ")", ":", "Log", ".", "error", "(", "\"Only HeronTuple type is supported in Func()\"", ")", "return", "if", "arg_0", ".", "Funcing_enabled", ":", "arg_2", "=", "tuple_pb2", ".", "AckTuple", "(", ")", "arg_2", ".", "Funcedtuple", "=", "int", "(", "arg_1", ".", "id", ")", "arg_4", "=", "0", "for", "arg_5", "in", "arg_1", ".", "roots", ":", "arg_6", "=", "arg_2", ".", "roots", ".", "add", "(", ")", "arg_6", ".", "CopyFrom", "(", "arg_5", ")", "arg_4", "+=", "arg_5", ".", "ByteSize", "(", ")", "super", "(", "BoltInstance", ",", "arg_0", ")", ".", "admit_control_tuple", "(", "arg_2", ",", "arg_4", ",", "True", ")", "arg_7", "=", "(", "time", ".", "time", "(", ")", "-", "arg_1", ".", "creation_time", ")", "*", "system_constants", ".", "SEC_TO_NS", "arg_0", ".", "pplan_helper", ".", "context", ".", "invoke_hook_bolt_Func", "(", "arg_1", ",", "arg_7", ")", "arg_0", ".", "bolt_metrics", ".", "Funced_tuple", "(", "arg_1", ".", "stream", ",", "arg_1", ".", "component", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Indicate that processing of a Tuple has succeeded\n\n    It is compatible with StreamParse API.\n    \"\"\"\n    if not isinstance(arg_1, HeronTuple):\n      Log.error(\"Only HeronTuple type is supported in Func()\")\n      return\n\n    if arg_0.Funcing_enabled:\n      arg_2 = tuple_pb2.AckTuple()\n      arg_2.Funcedtuple = int(arg_1.id)\n\n      arg_4 = 0\n      for arg_5 in arg_1.roots:\n        arg_6 = arg_2.roots.add()\n        arg_6.CopyFrom(arg_5)\n        arg_4 += arg_5.ByteSize()\n      super(BoltInstance, arg_0).admit_control_tuple(arg_2, arg_4, True)\n\n    arg_7 = (time.time() - arg_1.creation_time) * system_constants.SEC_TO_NS\n    arg_0.pplan_helper.context.invoke_hook_bolt_Func(arg_1, arg_7)\n    arg_0.bolt_metrics.Funced_tuple(arg_1.stream, arg_1.component, arg_7)", "path": "heron/instance/src/python/basics/bolt_instance.py", "identifier": "BoltInstance.ack", "docstring": "Indicate that processing of a Tuple has succeeded\n\n    It is compatible with StreamParse API.", "docstring_tokens": ["Indicate", "that", "processing", "of", "a", "Tuple", "has", "succeeded"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253868}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/wasb_task_handler.py#L68-L95", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Close and upload local log file to remote storage Wasb.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "Funcd", ":", "return", "super", "(", ")", ".", "Func", "(", ")", "if", "not", "arg_0", ".", "upload_on_Func", ":", "return", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "local_base", ",", "arg_0", ".", "log_relative_path", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "remote_base", ",", "arg_0", ".", "log_relative_path", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'r'", ")", "as", "logfile", ":", "arg_3", "=", "logfile", ".", "read", "(", ")", "arg_0", ".", "wasb_write", "(", "arg_3", ",", "arg_2", ",", "append", "=", "True", ")", "if", "arg_0", ".", "delete_local_copy", ":", "shutil", ".", "rmtree", "(", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", ")", "arg_0", ".", "Funcd", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"\n        Close and upload local log file to remote storage Wasb.\n        \"\"\"\n        # When application exit, system shuts down all handlers by\n        # calling Func method. Here we check if logger is already\n        # Funcd to prevent uploading the log to remote storage multiple\n        # times when `logging.shutdown` is called.\n        if arg_0.Funcd:\n            return\n\n        super().Func()\n\n        if not arg_0.upload_on_Func:\n            return\n\n        arg_1 = os.path.join(arg_0.local_base, arg_0.log_relative_path)\n        arg_2 = os.path.join(arg_0.remote_base, arg_0.log_relative_path)\n        if os.path.exists(arg_1):\n            # read log and remove old logs to get just the latest additions\n            with open(arg_1, 'r') as logfile:\n                arg_3 = logfile.read()\n            arg_0.wasb_write(arg_3, arg_2, append=True)\n\n            if arg_0.delete_local_copy:\n                shutil.rmtree(os.path.dirname(arg_1))\n        # Mark Funcd so we don't double write if Func is called twice\n        arg_0.Funcd = True", "path": "airflow/utils/log/wasb_task_handler.py", "identifier": "WasbTaskHandler.close", "docstring": "Close and upload local log file to remote storage Wasb.", "docstring_tokens": ["Close", "and", "upload", "local", "log", "file", "to", "remote", "storage", "Wasb", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253869}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L924-L933", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Get the next sibling in the children list of the parent node.", "language": "python", "parameters": "(self, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "return", "XMLElement", "(", "lib", ".", "lsl_Func", "(", "arg_0", ".", "e", ")", ")", "else", ":", "return", "XMLElement", "(", "lib", ".", "lsl_Func_n", "(", "arg_0", ".", "e", ",", "str", ".", "encode", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Get the next sibling in the children list of the parent node.\n\n        If a name is provided, the next sibling with the given name is returned.\n\n        \"\"\"\n        if arg_1 is None:\n            return XMLElement(lib.lsl_Func(arg_0.e))\n        else:\n            return XMLElement(lib.lsl_Func_n(arg_0.e, str.encode(arg_1)))", "path": "pylsl/pylsl.py", "identifier": "XMLElement.next_sibling", "docstring": "Get the next sibling in the children list of the parent node.\n\n        If a name is provided, the next sibling with the given name is returned.", "docstring_tokens": ["Get", "the", "next", "sibling", "in", "the", "children", "list", "of", "the", "parent", "node", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 253870}
{"url": "https://github.com/cyberdelia/metrology/blob/7599bea7de1fd59374c06e2f8041a217e3cf9c01/metrology/instruments/histogram.py#L92-L96", "sha": "7599bea7de1fd59374c06e2f8041a217e3cf9c01", "docstring_summary": "Returns the mean value.", "language": "python", "parameters": "(self)", "return_statement": "return 0.0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "counter", ".", "value", ">", "0", ":", "return", "arg_0", ".", "sum", ".", "value", "/", "arg_0", ".", "counter", ".", "value", "return", "0.0"], "function": "def Func(arg_0):\n        \"\"\"Returns the Func value.\"\"\"\n        if arg_0.counter.value > 0:\n            return arg_0.sum.value / arg_0.counter.value\n        return 0.0", "path": "metrology/instruments/histogram.py", "identifier": "Histogram.mean", "docstring": "Returns the mean value.", "docstring_tokens": ["Returns", "the", "mean", "value", "."], "nwo": "cyberdelia/metrology", "score": 0.49807038967310463, "idx": 253871}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L150-L158", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Return true if the IP address is in decimal notation.", "language": "python", "parameters": "(ip)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "int", "(", "str", "(", "arg_0", ")", ")", "except", "ValueError", ":", "return", "False", "if", "arg_1", ">", "4294967295", "or", "arg_1", "<", "0", ":", "return", "False", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"Return true if the IP address is in decimal notation.\"\"\"\n    try:\n        arg_1 = int(str(arg_0))\n    except ValueError:\n        return False\n    if arg_1 > 4294967295 or arg_1 < 0:\n        return False\n    return True", "path": "iplib.py", "identifier": "is_dec", "docstring": "Return true if the IP address is in decimal notation.", "docstring_tokens": ["Return", "true", "if", "the", "IP", "address", "is", "in", "decimal", "notation", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 253872}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/utils.py#L180-L190", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Copy to destination directory recursively.\n        If symlinks is true, symbolic links in the source tree are represented\n        as symbolic links in the new tree, but the metadata of the original\n        links is NOT copied; if false or omitted, the contents and metadata of\n        the linked files are copied to the new tree.", "language": "python", "parameters": "(self, dest, symlinks=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "isinstance", "(", "arg_1", ",", "Directory", ")", ":", "arg_1", "=", "arg_1", ".", "get_name", "(", ")", "shutil", ".", "Functree", "(", "arg_0", ".", "dirname", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\" Copy to destination directory recursively.\n        If symlinks is true, symbolic links in the source tree are represented\n        as symbolic links in the new tree, but the metadata of the original\n        links is NOT copied; if false or omitted, the contents and metadata of\n        the linked files are copied to the new tree.\n        \"\"\"\n        if isinstance(arg_1, Directory):\n            arg_1 = arg_1.get_name()\n\n        shutil.Functree(arg_0.dirname, arg_1)", "path": "quilt/utils.py", "identifier": "Directory.copy", "docstring": "Copy to destination directory recursively.\n        If symlinks is true, symbolic links in the source tree are represented\n        as symbolic links in the new tree, but the metadata of the original\n        links is NOT copied; if false or omitted, the contents and metadata of\n        the linked files are copied to the new tree.", "docstring_tokens": ["Copy", "to", "destination", "directory", "recursively", ".", "If", "symlinks", "is", "true", "symbolic", "links", "in", "the", "source", "tree", "are", "represented", "as", "symbolic", "links", "in", "the", "new", "tree", "but", "the", "metadata", "of", "the", "original", "links", "is", "NOT", "copied", ";", "if", "false", "or", "omitted", "the", "contents", "and", "metadata", "of", "the", "linked", "files", "are", "copied", "to", "the", "new", "tree", "."], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 253873}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L427-L433", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Returns the index of the lowest of the passed values. Catches nans etc.", "language": "python", "parameters": "(err_vals)", "return_statement": "return np.nanargmin(err_vals)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "np", ".", "all", "(", "np", ".", "isnan", "(", "arg_0", ")", ")", ":", "raise", "ValueError", "(", "'All err_vals are nans!'", ")", "return", "np", ".", "nanargmin", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns the index of the lowest of the passed values. Catches nans etc.\n    \"\"\"\n    if np.all(np.isnan(arg_0)):\n        raise ValueError('All err_vals are nans!')\n    return np.nanargmin(arg_0)", "path": "peri/opt/optimize.py", "identifier": "find_best_step", "docstring": "Returns the index of the lowest of the passed values. Catches nans etc.", "docstring_tokens": ["Returns", "the", "index", "of", "the", "lowest", "of", "the", "passed", "values", ".", "Catches", "nans", "etc", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 253874}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L115-L124", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform a QuantumChannel to the Operator representation.", "language": "python", "parameters": "(rep, data, input_dim, output_dim)", "return_statement": "return _kraus_to_operator(data, input_dim, output_dim)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", "==", "'Operator'", ":", "return", "arg_1", "if", "arg_0", "==", "'Stinespring'", ":", "return", "_stinespringFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "!=", "'Kraus'", ":", "arg_1", "=", "_to_kraus", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "_krausFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Transform a QuantumChannel to the Operator representation.\"\"\"\n    if arg_0 == 'Operator':\n        return arg_1\n    if arg_0 == 'Stinespring':\n        return _stinespringFunc(arg_1, arg_2, arg_3)\n    # Convert via Kraus representation\n    if arg_0 != 'Kraus':\n        arg_1 = _to_kraus(arg_0, arg_1, arg_2, arg_3)\n    return _krausFunc(arg_1, arg_2, arg_3)", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_to_operator", "docstring": "Transform a QuantumChannel to the Operator representation.", "docstring_tokens": ["Transform", "a", "QuantumChannel", "to", "the", "Operator", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253875}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/twistedx/producer.py#L42-L80", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Start producing.", "language": "python", "parameters": "(self, consumer)", "return_statement": "return self._current_deferred", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_consumer", "=", "arg_1", "arg_0", ".", "_current_deferred", "=", "defer", ".", "Deferred", "(", ")", "arg_0", ".", "_sent", "=", "0", "arg_0", ".", "_paused", "=", "False", "if", "not", "hasattr", "(", "arg_0", ",", "\"_chunk_headers\"", ")", ":", "arg_0", ".", "_build_chunk_headers", "(", ")", "if", "arg_0", ".", "_data", ":", "arg_6", "=", "\"\"", "for", "arg_7", "in", "arg_0", ".", "_data", ":", "arg_6", "+=", "arg_0", ".", "_chunk_headers", "[", "arg_7", "]", "arg_6", "+=", "arg_0", ".", "_data", "[", "arg_7", "]", "arg_6", "+=", "\"\\r\\n\"", "arg_0", ".", "_send_to_consumer", "(", "arg_6", ")", "if", "arg_0", ".", "_files", ":", "arg_0", ".", "_files_iterator", "=", "arg_0", ".", "_files", ".", "iterkeys", "(", ")", "arg_0", ".", "_files_sent", "=", "0", "arg_0", ".", "_files_length", "=", "len", "(", "arg_0", ".", "_files", ")", "arg_0", ".", "_current_file_path", "=", "None", "arg_0", ".", "_current_file_handle", "=", "None", "arg_0", ".", "_current_file_length", "=", "None", "arg_0", ".", "_current_file_sent", "=", "0", "arg_15", "=", "arg_0", ".", "_produce", "(", ")", "if", "arg_15", ":", "return", "arg_15", "else", ":", "return", "defer", ".", "succeed", "(", "None", ")", "return", "arg_0", ".", "_current_deferred"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Start producing.\n\n        Args:\n            consumer: Consumer\n        \"\"\"\n        arg_0._consumer = arg_1\n        arg_0._current_deferred = defer.Deferred()\n        arg_0._sent = 0\n        arg_0._paused = False\n\n        if not hasattr(arg_0, \"_chunk_headers\"):\n            arg_0._build_chunk_headers()\n\n        if arg_0._data:\n            arg_6 = \"\"\n            for arg_7 in arg_0._data:\n                arg_6 += arg_0._chunk_headers[arg_7]\n                arg_6 += arg_0._data[arg_7]\n                arg_6 += \"\\r\\n\"\n\n            arg_0._send_to_consumer(arg_6)\n\n        if arg_0._files:\n            arg_0._files_iterator = arg_0._files.iterkeys()\n            arg_0._files_sent = 0\n            arg_0._files_length = len(arg_0._files)\n            arg_0._current_file_path = None\n            arg_0._current_file_handle = None\n            arg_0._current_file_length = None\n            arg_0._current_file_sent = 0\n\n            arg_15 = arg_0._produce()\n            if arg_15:\n                return arg_15\n        else:\n            return defer.succeed(None)\n\n        return arg_0._current_deferred", "path": "pyfire/twistedx/producer.py", "identifier": "MultiPartProducer.startProducing", "docstring": "Start producing.\n\n        Args:\n            consumer: Consumer", "docstring_tokens": ["Start", "producing", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 253876}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/transport.py#L511-L530", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Drop a node from the network", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_connections", ".", "pop", "(", "arg_1", ",", "None", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "_preventConnectNodes", ".", "add", "(", "arg_1", ")", "arg_2", ".", "disconnect", "(", ")", "arg_0", ".", "_preventConnectNodes", ".", "remove", "(", "arg_1", ")", "if", "isinstance", "(", "arg_1", ",", "TCPNode", ")", ":", "arg_0", ".", "_nodes", ".", "discard", "(", "arg_1", ")", "arg_0", ".", "_nodeAddrToNode", ".", "pop", "(", "arg_1", ".", "address", ",", "None", ")", "else", ":", "arg_0", ".", "_readonlyNodes", ".", "discard", "(", "arg_1", ")", "arg_0", ".", "_lastConnectAttempt", ".", "pop", "(", "arg_1", ",", "None", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Drop a node from the network\n\n        :param node: node to drop\n        :type node: Node\n        \"\"\"\n\n        arg_2 = arg_0._connections.pop(arg_1, None)\n        if arg_2 is not None:\n            # Calling conn.disconnect() immediately triggers the onDisconnected callback if the connection isn't already disconnected, so this is necessary to prevent the automatic reconnect.\n            arg_0._preventConnectNodes.add(arg_1)\n            arg_2.disconnect()\n            arg_0._preventConnectNodes.remove(arg_1)\n        if isinstance(arg_1, TCPNode):\n            arg_0._nodes.discard(arg_1)\n            arg_0._nodeAddrToNode.pop(arg_1.address, None)\n        else:\n            arg_0._readonlyNodes.discard(arg_1)\n        arg_0._lastConnectAttempt.pop(arg_1, None)", "path": "pysyncobj/transport.py", "identifier": "TCPTransport.dropNode", "docstring": "Drop a node from the network\n\n        :param node: node to drop\n        :type node: Node", "docstring_tokens": ["Drop", "a", "node", "from", "the", "network"], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 253877}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/groupsio.py#L229-L240", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Find the id of a group given its name by iterating on the list of subscriptions", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "subscriptions", "(", "arg_0", ".", "auth", ")", "for", "arg_2", "in", "arg_1", ":", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "[", "'group_name'", "]", "==", "arg_0", ".", "group_name", ":", "return", "arg_3", "[", "'group_id'", "]", "arg_4", "=", "\"Group id not found for group name %s\"", "%", "arg_0", ".", "group_name", "raise", "BackendError", "(", "cause", "=", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"Find the id of a group given its name by iterating on the list of subscriptions\"\"\"\n\n        arg_1 = arg_0.subscriptions(arg_0.auth)\n\n        for arg_2 in arg_1:\n            for arg_3 in arg_2:\n                if arg_3['group_name'] == arg_0.group_name:\n                    return arg_3['group_id']\n\n        arg_4 = \"Group id not found for group name %s\" % arg_0.group_name\n        raise BackendError(cause=arg_4)", "path": "perceval/backends/core/groupsio.py", "identifier": "GroupsioClient.__find_group_id", "docstring": "Find the id of a group given its name by iterating on the list of subscriptions", "docstring_tokens": ["Find", "the", "id", "of", "a", "group", "given", "its", "name", "by", "iterating", "on", "the", "list", "of", "subscriptions"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253878}
{"url": "https://github.com/rupertford/melody/blob/d50459880a87fdd1802c6893f6e12b52d51b3b91/examples/PSyclone/psyclone.py#L129-L155", "sha": "d50459880a87fdd1802c6893f6e12b52d51b3b91", "docstring_summary": "Returns all potential loop fusion options for the psy object\n        provided", "language": "python", "parameters": "(self, my_psy)", "return_statement": "return my_options", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_1", ".", "invokes", ".", "invoke_list", "if", "arg_0", ".", "_dependent_invokes", ":", "raise", "RuntimeError", "(", "\"dependent invokes assumes fusion in one invoke might \"", "\"affect fusion in another invoke. This is not yet \"", "\"implemented\"", ")", "else", ":", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_3", ")", ":", "print", "\"invoke {0}\"", ".", "format", "(", "arg_4", ")", "for", "arg_6", "in", "arg_5", ".", "schedule", ".", "loops", "(", ")", ":", "if", "arg_6", ".", "loop_type", "==", "\"outer\"", ":", "arg_7", "=", "arg_6", ".", "parent", ".", "children", "arg_8", "=", "arg_7", ".", "index", "(", "arg_6", ")", "arg_9", "=", "[", "]", "arg_0", ".", "_recurse", "(", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_2", ",", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''Returns all potential loop fusion Func for the psy object\n        provided'''\n        # compute Func dynamically here as they may depend on previous\n        # changes to the psy tree\n        arg_2 = []\n        arg_3 = arg_1.invokes.invoke_list\n        #print \"there are {0} invokes\".format(len(invokes))\n        if arg_0._dependent_invokes:\n            raise RuntimeError(\n                \"dependent invokes assumes fusion in one invoke might \"\n                \"affect fusion in another invoke. This is not yet \"\n                \"implemented\")\n        else:\n            # treat each invoke separately\n            for arg_4, arg_5 in enumerate(arg_3):\n                print \"invoke {0}\".format(arg_4)\n                # iterate through each outer loop\n                for arg_6 in arg_5.schedule.loops():\n                    if arg_6.loop_type == \"outer\":\n                        arg_7 = arg_6.parent.children\n                        arg_8 = arg_7.index(arg_6)\n                        arg_9 = []\n                        arg_0._recurse(arg_7, arg_8, arg_9, arg_2,\n                                      arg_5)\n\n        return arg_2", "path": "examples/PSyclone/psyclone.py", "identifier": "GOLoopFuse.options", "docstring": "Returns all potential loop fusion options for the psy object\n        provided", "docstring_tokens": ["Returns", "all", "potential", "loop", "fusion", "options", "for", "the", "psy", "object", "provided"], "nwo": "rupertford/melody", "score": 0.16246995141409282, "idx": 253879}
{"url": "https://github.com/jhermann/pygments-markdown-lexer/blob/e651a9a3f664285b01451eb39232b1ad9af65956/tasks.py#L65-L75", "sha": "e651a9a3f664285b01451eb39232b1ad9af65956", "docstring_summary": "Perform continuous integration tasks.", "language": "python", "parameters": "(ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "''", "]", "if", "os", ".", "environ", ".", "get", "(", "'TRAVIS'", ",", "''", ")", ".", "lower", "(", ")", "==", "'true'", ":", "arg_1", "+=", "[", "'test.pytest'", "]", "else", ":", "arg_1", "+=", "[", "'test.tox'", "]", "arg_0", ".", "run", "(", "\"invoke --echo --pty clean --all build --docs check --reports{}\"", ".", "format", "(", "' '", ".", "join", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Perform continuous integration tasks.\"\"\"\n    arg_1 = ['']\n\n    # 'tox' makes no sense in Travis\n    if os.environ.get('TRAVIS', '').lower() == 'true':\n        arg_1 += ['test.pytest']\n    else:\n        arg_1 += ['test.tox']\n\n    arg_0.run(\"invoke --echo --pty clean --all build --docs check --reports{}\".format(' '.join(arg_1)))", "path": "tasks.py", "identifier": "ci", "docstring": "Perform continuous integration tasks.", "docstring_tokens": ["Perform", "continuous", "integration", "tasks", "."], "nwo": "jhermann/pygments-markdown-lexer", "score": 0.2809582191804827, "idx": 253880}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L424-L435", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Reads the body to match from a disk file.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'r'", ")", "as", "f", ":", "arg_0", ".", "body", "(", "str", "(", "f", ".", "read", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Reads the body to match from a disk Func.\n\n        Arguments:\n            path (str): relative or absolute path to Func to read from.\n\n        Returns:\n            self: current Mock instance.\n        \"\"\"\n        with open(arg_1, 'r') as f:\n            arg_0.body(str(f.read()))", "path": "pook/mock.py", "identifier": "Mock.file", "docstring": "Reads the body to match from a disk file.\n\n        Arguments:\n            path (str): relative or absolute path to file to read from.\n\n        Returns:\n            self: current Mock instance.", "docstring_tokens": ["Reads", "the", "body", "to", "match", "from", "a", "disk", "file", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 253881}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L191-L233", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Calculates a graph's concordance as well as its statistical probability.", "language": "python", "parameters": "(graph: BELGraph,\n                                      key: str,\n                                      cutoff: Optional[float] = None,\n                                      permutations: Optional[int] = None,\n                                      percentage: Optional[float] = None,\n                                      use_ambiguous: bool = False,\n                                      permute_type: str = 'shuffle_node_data',\n                                      )", "return_statement": "return score, distribution, one_sided(score, distribution)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "[", "arg_6", "]", "=", "None", ",", "arg_7", ":", "arg_5", "[", "arg_8", "]", "=", "None", ",", "arg_9", ":", "arg_5", "[", "arg_6", "]", "=", "None", ",", "arg_10", ":", "arg_11", "=", "False", ",", "arg_12", ":", "arg_3", "=", "'shuffle_node_data'", ",", ")", "->", "Tuple", "[", "arg_6", ",", "List", "[", "arg_6", "]", ",", "arg_6", "]", ":", "if", "arg_12", "==", "'random_by_edges'", ":", "arg_13", "=", "partial", "(", "random_by_edges", ",", "arg_9", "=", "arg_9", ")", "elif", "arg_12", "==", "'shuffle_node_data'", ":", "arg_13", "=", "partial", "(", "shuffle_node_data", ",", "arg_2", "=", "arg_2", ",", "arg_9", "=", "arg_9", ")", "elif", "arg_12", "==", "'shuffle_relations'", ":", "arg_13", "=", "partial", "(", "shuffle_relations", ",", "arg_9", "=", "arg_9", ")", "else", ":", "raise", "ValueError", "(", "'Invalid permute_type: {}'", ".", "format", "(", "arg_12", ")", ")", "arg_0", ":", "arg_1", "=", "arg_0", ".", "copy", "(", ")", "collapse_to_genes", "(", "arg_0", ")", "collapse_all_variants", "(", "arg_0", ")", "arg_14", "=", "calculate_concordance", "(", "arg_0", ",", "arg_2", ",", "arg_4", "=", "arg_4", ")", "arg_15", "=", "[", "]", "for", "arg_16", "in", "range", "(", "arg_7", "or", "500", ")", ":", "arg_17", "=", "arg_13", "(", "arg_0", ")", "arg_18", "=", "calculate_concordance", "(", "arg_17", ",", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_10", "=", "arg_10", ")", "arg_15", ".", "append", "(", "arg_18", ")", "return", "arg_14", ",", "arg_15", ",", "one_sided", "(", "arg_14", ",", "arg_15", ")"], "function": "def Func(arg_0: arg_1,\n                                      arg_2: arg_3,\n                                      arg_4: arg_5[arg_6] = None,\n                                      arg_7: arg_5[arg_8] = None,\n                                      arg_9: arg_5[arg_6] = None,\n                                      arg_10: arg_11 = False,\n                                      arg_12: arg_3 = 'shuffle_node_data',\n                                      ) -> Tuple[arg_6, List[arg_6], arg_6]:\n    \"\"\"Calculates a graph's concordance as well as its statistical probability.\n\n\n\n    :param graph: A BEL graph\n    :param str key: The node data dictionary key storing the logFC\n    :param float cutoff: The optional logFC cutoff for significance\n    :param int permutations: The number of random permutations to test. Defaults to 500\n    :param float percentage: The percentage of the graph's edges to maintain. Defaults to 0.9\n    :param bool use_ambiguous: Compare to ambiguous edges as well\n    :returns: A triple of the concordance score, the null distribution, and the p-value.\n    \"\"\"\n    if arg_12 == 'random_by_edges':\n        arg_13 = partial(random_by_edges, arg_9=arg_9)\n    elif arg_12 == 'shuffle_node_data':\n        arg_13 = partial(shuffle_node_data, arg_2=arg_2, arg_9=arg_9)\n    elif arg_12 == 'shuffle_relations':\n        arg_13 = partial(shuffle_relations, arg_9=arg_9)\n    else:\n        raise ValueError('Invalid permute_type: {}'.format(arg_12))\n\n    arg_0: arg_1 = arg_0.copy()\n    collapse_to_genes(arg_0)\n    collapse_all_variants(arg_0)\n\n    arg_14 = calculate_concordance(arg_0, arg_2, arg_4=arg_4)\n\n    arg_15 = []\n\n    for arg_16 in range(arg_7 or 500):\n        arg_17 = arg_13(arg_0)\n        arg_18 = calculate_concordance(arg_17, arg_2, arg_4=arg_4, arg_10=arg_10)\n        arg_15.append(arg_18)\n\n    return arg_14, arg_15, one_sided(arg_14, arg_15)", "path": "src/pybel_tools/analysis/concordance.py", "identifier": "calculate_concordance_probability", "docstring": "Calculates a graph's concordance as well as its statistical probability.\n\n\n\n    :param graph: A BEL graph\n    :param str key: The node data dictionary key storing the logFC\n    :param float cutoff: The optional logFC cutoff for significance\n    :param int permutations: The number of random permutations to test. Defaults to 500\n    :param float percentage: The percentage of the graph's edges to maintain. Defaults to 0.9\n    :param bool use_ambiguous: Compare to ambiguous edges as well\n    :returns: A triple of the concordance score, the null distribution, and the p-value.", "docstring_tokens": ["Calculates", "a", "graph", "s", "concordance", "as", "well", "as", "its", "statistical", "probability", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253882}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/metadata.py#L81-L86", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Remove any metadata associated with the provided CoreBluetooth object.", "language": "python", "parameters": "(self, cbobject)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "_lock", ":", "if", "arg_1", "in", "arg_0", ".", "_metadata", ":", "del", "arg_0", ".", "_metadata", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove any metadata associated with the provided CoreBluetooth object.\n        \"\"\"\n        with arg_0._lock:\n            if arg_1 in arg_0._metadata:\n                del arg_0._metadata[arg_1]", "path": "Adafruit_BluefruitLE/corebluetooth/metadata.py", "identifier": "CoreBluetoothMetadata.remove", "docstring": "Remove any metadata associated with the provided CoreBluetooth object.", "docstring_tokens": ["Remove", "any", "metadata", "associated", "with", "the", "provided", "CoreBluetooth", "object", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 253883}
{"url": "https://github.com/phoikoi/sisy/blob/840c5463ab65488d34e99531f230e61f755d2d69/src/sisy/consumers.py#L19-L27", "sha": "840c5463ab65488d34e99531f230e61f755d2d69", "docstring_summary": "Internal ``CLOCK_CHANNEL`` consumer to process task runs", "language": "python", "parameters": "(message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arrow", ".", "get", "(", "arg_0", "[", "'time'", "]", ")", "arg_2", "=", "arrow", ".", "get", "(", ")", "if", "(", "arg_2", "-", "arg_1", ")", ">", "timezone", ".", "timedelta", "(", "seconds", "=", "(", "TICK_FREQ", "+", "1", ")", ")", ":", "pass", "else", ":", "Task", ".", "run_tasks", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Internal ``CLOCK_CHANNEL`` consumer to process task runs\"\"\"\n    arg_1 = arrow.get(arg_0['time'])\n    arg_2 = arrow.get()\n\n    if (arg_2 - arg_1) > timezone.timedelta(seconds=(TICK_FREQ+1)):\n        pass # discard old ticks\n    else:\n        Task.run_tasks()", "path": "src/sisy/consumers.py", "identifier": "run_heartbeat", "docstring": "Internal ``CLOCK_CHANNEL`` consumer to process task runs", "docstring_tokens": ["Internal", "CLOCK_CHANNEL", "consumer", "to", "process", "task", "runs"], "nwo": "phoikoi/sisy", "score": 0.0, "idx": 253884}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1315-L1329", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Print a record.", "language": "python", "parameters": "(rec, format=1, tags=None)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "[", "]", "if", "arg_1", "==", "1", ":", "arg_3", "=", "record_xml_output", "(", "arg_0", ",", "arg_2", ")", "else", ":", "return", "''", "return", "arg_3"], "function": "def Func(arg_0, arg_1=1, arg_2=None):\n    \"\"\"\n    Print a record.\n\n    :param format: 1 XML, 2 HTML (not implemented)\n    :param tags: list of tags to be printed\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = []\n    if arg_1 == 1:\n        arg_3 = record_xml_output(arg_0, arg_2)\n    else:\n        return ''\n\n    return arg_3", "path": "harvestingkit/bibrecord.py", "identifier": "print_rec", "docstring": "Print a record.\n\n    :param format: 1 XML, 2 HTML (not implemented)\n    :param tags: list of tags to be printed", "docstring_tokens": ["Print", "a", "record", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253885}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L159-L174", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Unescapes a string that may contain commas, tabs, newlines and dashes", "language": "python", "parameters": "(s)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "basestring", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "'\\t'", ",", "','", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "'\\\\,'", ",", "','", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "'\\\\n'", ",", "'\\n'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "'\\\\\\\\'", ",", "'\\\\'", ")", "return", "arg_0"], "function": "def Func(arg_0):\n  \"\"\"\n  Unescapes a string that may contain commas, tabs, newlines and dashes\n\n  Commas are decoded from tabs.\n\n  :param s: (string) to Func\n  :returns: (string) Funcd string\n  \"\"\"\n  assert isinstance(arg_0, basestring)\n  arg_0 = arg_0.replace('\\t', ',')\n  arg_0 = arg_0.replace('\\\\,', ',')\n  arg_0 = arg_0.replace('\\\\n', '\\n')\n  arg_0 = arg_0.replace('\\\\\\\\', '\\\\')\n\n  return arg_0", "path": "src/nupic/data/utils.py", "identifier": "unescape", "docstring": "Unescapes a string that may contain commas, tabs, newlines and dashes\n\n  Commas are decoded from tabs.\n\n  :param s: (string) to unescape\n  :returns: (string) unescaped string", "docstring_tokens": ["Unescapes", "a", "string", "that", "may", "contain", "commas", "tabs", "newlines", "and", "dashes"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253886}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/positions.py#L31-L41", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Creates a position", "language": "python", "parameters": "(self, params={})", "return_statement": "return self.position_from_json(data[\"position\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ")", ":", "arg_2", "=", "\"/2/positions/\"", "arg_3", "=", "arg_1", "arg_4", "=", "arg_0", ".", "_post_resource", "(", "arg_2", ",", "arg_3", ")", "return", "arg_0", ".", "position_from_json", "(", "arg_4", "[", "\"position\"", "]", ")"], "function": "def Func(arg_0, arg_1={}):\n        \"\"\"\n        Creates a position\n\n        http://dev.wheniwork.com/#create-update-position\n        \"\"\"\n        arg_2 = \"/2/positions/\"\n        arg_3 = arg_1\n\n        arg_4 = arg_0._post_resource(arg_2, arg_3)\n        return arg_0.position_from_json(arg_4[\"position\"])", "path": "uw_wheniwork/positions.py", "identifier": "Positions.create_position", "docstring": "Creates a position\n\n        http://dev.wheniwork.com/#create-update-position", "docstring_tokens": ["Creates", "a", "position"], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 253887}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/models.py#L38-L66", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Perform the query and returns a single object matching the given keyword arguments.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "copy", "(", ")", "if", "'course_id'", "in", "arg_2", ":", "try", ":", "arg_4", "=", "str", "(", "CourseKey", ".", "from_string", "(", "arg_2", "[", "'course_id'", "]", ")", ")", "except", "InvalidKeyError", ":", "pass", "else", ":", "try", ":", "return", "arg_0", ".", "get", "(", "*", "arg_1", ",", "**", "arg_2", ")", "except", "DataSharingConsent", ".", "DoesNotExist", ":", "arg_2", "[", "'course_id'", "]", "=", "parse_course_key", "(", "arg_4", ")", "try", ":", "return", "arg_0", ".", "get", "(", "*", "arg_1", ",", "**", "arg_2", ")", "except", "DataSharingConsent", ".", "DoesNotExist", ":", "return", "ProxyDataSharingConsent", "(", "**", "arg_3", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Perform the query and returns a single object matching the given keyword arguments.\n\n        This customizes the queryset to return an instance of ``ProxyDataSharingConsent`` when\n        the searched-for ``DataSharingConsent`` instance does not exist.\n        \"\"\"\n        arg_3 = arg_2.copy()\n        if 'course_id' in arg_2:\n            try:\n                # Check if we have a course ID or a course run ID\n                arg_4 = str(CourseKey.from_string(arg_2['course_id']))\n            except InvalidKeyError:\n                # The ID we have is for a course instead of a course run; fall through\n                # to the second check.\n                pass\n            else:\n                try:\n                    # Try to get the record for the course run specifically\n                    return arg_0.get(*arg_1, **arg_2)\n                except DataSharingConsent.DoesNotExist:\n                    # A record for the course run didn't exist, so modify the query\n                    # parameters to look for just a course record on the second pass.\n                    arg_2['course_id'] = parse_course_key(arg_4)\n\n        try:\n            return arg_0.get(*arg_1, **arg_2)\n        except DataSharingConsent.DoesNotExist:\n            return ProxyDataSharingConsent(**arg_3)", "path": "consent/models.py", "identifier": "DataSharingConsentQuerySet.proxied_get", "docstring": "Perform the query and returns a single object matching the given keyword arguments.\n\n        This customizes the queryset to return an instance of ``ProxyDataSharingConsent`` when\n        the searched-for ``DataSharingConsent`` instance does not exist.", "docstring_tokens": ["Perform", "the", "query", "and", "returns", "a", "single", "object", "matching", "the", "given", "keyword", "arguments", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253888}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py#L251-L261", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get a site's publish profile as a string", "language": "python", "parameters": "(self, webspace_name, website_name)", "return_statement": "return self._perform_get(self._get_publishxml_path(webspace_name, website_name),\n                                 None).body.decode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_get_publishxml_path", "(", "arg_1", ",", "arg_2", ")", ",", "None", ")", ".", "body", ".", "decode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Get a site's publish profile as a string\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        '''\n        return arg_0._perform_get(arg_0._get_publishxml_path(arg_1, arg_2),\n                                 None).body.decode(\"utf-8\")", "path": "azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py", "identifier": "WebsiteManagementService.get_publish_profile_xml", "docstring": "Get a site's publish profile as a string\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.", "docstring_tokens": ["Get", "a", "site", "s", "publish", "profile", "as", "a", "string"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 253889}
{"url": "https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/parsers/intersphinx.py#L121-L133", "sha": "659a66e237eb0faa08e81094fc4140623b418952", "docstring_summary": "Determine the path from the intersphinx inventory entry", "language": "python", "parameters": "(data)", "return_statement": "return path_str", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "[", "2", "]", ".", "split", "(", "\"#\"", ")", "if", "len", "(", "arg_1", ")", ">", "1", ":", "arg_2", "=", "\"#\"", ".", "join", "(", "(", "arg_1", "[", "0", "]", ",", "arg_1", "[", "-", "1", "]", ")", ")", "else", ":", "arg_2", "=", "arg_0", "[", "2", "]", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Determine the path from the intersphinx inventory entry\n\n    Discard the anchors between head and tail to make it\n    compatible with situations where extra meta information is encoded.\n    \"\"\"\n    arg_1 = arg_0[2].split(\"#\")\n    if len(arg_1) > 1:\n        arg_2 = \"#\".join((arg_1[0], arg_1[-1]))\n    else:\n        arg_2 = arg_0[2]\n    return arg_2", "path": "src/doc2dash/parsers/intersphinx.py", "identifier": "inv_entry_to_path", "docstring": "Determine the path from the intersphinx inventory entry\n\n    Discard the anchors between head and tail to make it\n    compatible with situations where extra meta information is encoded.", "docstring_tokens": ["Determine", "the", "path", "from", "the", "intersphinx", "inventory", "entry"], "nwo": "hynek/doc2dash", "score": 0.4736463250939785, "idx": 253890}
{"url": "https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/vcf2clinvar/common.py#L149-L163", "sha": "d5bbf6df2902c6cabe9ef1894cfac527e90fa32a", "docstring_summary": "Very lightweight parsing of a vcf line to get position.", "language": "python", "parameters": "(vcf_line)", "return_statement": "return return_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "None", "arg_1", "=", "arg_0", ".", "strip", "(", ")", ".", "split", "(", "'\\t'", ")", "arg_2", "=", "dict", "(", ")", "arg_2", "[", "'chrom'", "]", "=", "CHROM_INDEX", "[", "arg_1", "[", "0", "]", "]", "arg_2", "[", "'pos'", "]", "=", "int", "(", "arg_1", "[", "1", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Very lightweight parsing of a vcf line to get position.\n\n        Returns a dict containing:\n        'chrom': index of chromosome (int), indicates sort order\n        'pos': position on chromosome (int)\n        \"\"\"\n        if not arg_0:\n            return None\n        arg_1 = arg_0.strip().split('\\t')\n        arg_2 = dict()\n        arg_2['chrom'] = CHROM_INDEX[arg_1[0]]\n        arg_2['pos'] = int(arg_1[1])\n        return arg_2", "path": "vcf2clinvar/common.py", "identifier": "VCFLine.get_pos", "docstring": "Very lightweight parsing of a vcf line to get position.\n\n        Returns a dict containing:\n        'chrom': index of chromosome (int), indicates sort order\n        'pos': position on chromosome (int)", "docstring_tokens": ["Very", "lightweight", "parsing", "of", "a", "vcf", "line", "to", "get", "position", "."], "nwo": "madprime/vcf2clinvar", "score": 0.16246995141409282, "idx": 253891}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L659-L685", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check that a name is both nonlocal and global.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "same_scope", "(", "arg_2", ")", ":", "return", "arg_2", ".", "scope", "(", ")", "is", "arg_1", "arg_3", "=", "itertools", ".", "chain", ".", "from_iterable", "arg_4", "=", "set", "(", "arg_3", "(", "child", ".", "names", "for", "child", "in", "arg_1", ".", "nodes_of_class", "(", "astroid", ".", "Nonlocal", ")", "if", "same_scope", "(", "child", ")", ")", ")", "if", "not", "arg_4", ":", "return", "arg_5", "=", "set", "(", "arg_3", "(", "child", ".", "names", "for", "child", "in", "arg_1", ".", "nodes_of_class", "(", "astroid", ".", "Global", ")", "if", "same_scope", "(", "child", ")", ")", ")", "for", "arg_6", "in", "arg_4", ".", "intersection", "(", "arg_5", ")", ":", "arg_0", ".", "add_message", "(", "\"nonlocal-and-global\"", ",", "args", "=", "(", "arg_6", ",", ")", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check that a name is both nonlocal and global.\"\"\"\n\n        def same_scope(arg_2):\n            return arg_2.scope() is arg_1\n\n        arg_3 = itertools.chain.from_iterable\n        arg_4 = set(\n            arg_3(\n                child.names\n                for child in arg_1.nodes_of_class(astroid.Nonlocal)\n                if same_scope(child)\n            )\n        )\n\n        if not arg_4:\n            return\n\n        arg_5 = set(\n            arg_3(\n                child.names\n                for child in arg_1.nodes_of_class(astroid.Global)\n                if same_scope(child)\n            )\n        )\n        for arg_6 in arg_4.intersection(arg_5):\n            arg_0.add_message(\"nonlocal-and-global\", args=(arg_6,), arg_1=arg_1)", "path": "pylint/checkers/base.py", "identifier": "BasicErrorChecker._check_nonlocal_and_global", "docstring": "Check that a name is both nonlocal and global.", "docstring_tokens": ["Check", "that", "a", "name", "is", "both", "nonlocal", "and", "global", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253892}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L341-L348", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Returns cache entry parameter value by its name.", "language": "python", "parameters": "(self, entry_name, key)", "return_statement": "return self.cache[entry_name].get(key, False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "cache", "[", "arg_1", "]", ".", "get", "(", "arg_2", ",", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Returns cache entry parameter value by its name.\n\n        :param str|unicode entry_name:\n        :param key:\n        :return:\n        \"\"\"\n        return arg_0.cache[arg_1].get(arg_2, False)", "path": "sitetree/sitetreeapp.py", "identifier": "Cache.get_entry", "docstring": "Returns cache entry parameter value by its name.\n\n        :param str|unicode entry_name:\n        :param key:\n        :return:", "docstring_tokens": ["Returns", "cache", "entry", "parameter", "value", "by", "its", "name", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 253893}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L330-L344", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Determine the set of elements present in a list of chemical compounds.", "language": "python", "parameters": "(compounds)", "return_statement": "return set().union(*elementlist)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "parse_compound", "(", "compound", ")", ".", "count", "(", ")", ".", "keys", "(", ")", "for", "compound", "in", "arg_0", "]", "return", "set", "(", ")", ".", "union", "(", "*", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Determine the set of Func present in a list of chemical compounds.\n\n    The list of Func is sorted alphabetically.\n\n    :param compounds: List of compound formulas and phases, e.g.\n      ['Fe2O3[S1]', 'Al2O3[S1]'].\n\n    :returns: List of Func.\n    \"\"\"\n\n    arg_1 = [parse_compound(compound).count().keys()\n                   for compound in arg_0]\n    return set().union(*arg_1)", "path": "auxi/tools/chemistry/stoichiometry.py", "identifier": "elements", "docstring": "Determine the set of elements present in a list of chemical compounds.\n\n    The list of elements is sorted alphabetically.\n\n    :param compounds: List of compound formulas and phases, e.g.\n      ['Fe2O3[S1]', 'Al2O3[S1]'].\n\n    :returns: List of elements.", "docstring_tokens": ["Determine", "the", "set", "of", "elements", "present", "in", "a", "list", "of", "chemical", "compounds", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 253894}
{"url": "https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/russian_tax.py#L72-L78", "sha": "e15f2e59538deb4cbfceaac314f5ea897f2d5450", "docstring_summary": "Return a random taxation ID number for a company.", "language": "python", "parameters": "()", "return_statement": "return \"\".join(map(str, inn))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "2", ",", "4", ",", "10", ",", "3", ",", "5", ",", "9", ",", "4", ",", "6", ",", "8", "]", "arg_1", "=", "[", "random", ".", "randint", "(", "1", ",", "9", ")", "for", "_", "in", "range", "(", "10", ")", "]", "arg_2", "=", "[", "v", "*", "arg_0", "[", "i", "]", "for", "i", ",", "v", "in", "enumerate", "(", "arg_1", "[", ":", "-", "1", "]", ")", "]", "arg_1", "[", "9", "]", "=", "sum", "(", "arg_2", ")", "%", "11", "%", "10", "return", "\"\"", ".", "join", "(", "map", "(", "str", ",", "arg_1", ")", ")"], "function": "def Func():\n    \"\"\"Return a random taxation ID number for a company.\"\"\"\n    arg_0 = [2, 4, 10, 3, 5, 9, 4, 6, 8]\n    arg_1 = [random.randint(1, 9) for _ in range(10)]\n    arg_2 = [v * arg_0[i] for i, v in enumerate(arg_1[:-1])]\n    arg_1[9] = sum(arg_2) % 11 % 10\n    return \"\".join(map(str, arg_1))", "path": "forgery_py/forgery/russian_tax.py", "identifier": "legal_inn", "docstring": "Return a random taxation ID number for a company.", "docstring_tokens": ["Return", "a", "random", "taxation", "ID", "number", "for", "a", "company", "."], "nwo": "pilosus/ForgeryPy3", "score": 0.3588333959790546, "idx": 253895}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/nlp.py#L795-L830", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Save the vocabulary to a file so the model can be reloaded.", "language": "python", "parameters": "(count=None, name='vocab.txt')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "'vocab.txt'", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "[", "]", "arg_2", "=", "os", ".", "getcwd", "(", ")", "arg_3", "=", "len", "(", "arg_0", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_1", ")", ",", "\"w\"", ")", "as", "f", ":", "for", "arg_4", "in", "xrange", "(", "arg_3", ")", ":", "f", ".", "write", "(", "\"%s %d\\n\"", "%", "(", "tf", ".", "compat", ".", "as_text", "(", "arg_0", "[", "arg_4", "]", "[", "0", "]", ")", ",", "arg_0", "[", "arg_4", "]", "[", "1", "]", ")", ")", "tl", ".", "logging", ".", "info", "(", "\"%d vocab saved to %s in %s\"", "%", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0=None, arg_1='vocab.txt'):\n    \"\"\"Save the vocabulary to a file so the model can be reloaded.\n\n    Parameters\n    ----------\n    count : a list of tuple and list\n        count[0] is a list : the number of rare words,\n        count[1:] are tuples : the number of occurrence of each word,\n        e.g. [['UNK', 418391], (b'the', 1061396), (b'of', 593677), (b'and', 416629), (b'one', 411764)]\n\n    Examples\n    ---------\n    >>> words = tl.files.load_matt_mahoney_text8_dataset()\n    >>> vocabulary_size = 50000\n    >>> data, count, dictionary, reverse_dictionary = tl.nlp.build_words_dataset(words, vocabulary_size, True)\n    >>> tl.nlp.Func(count, name='vocab_text8.txt')\n    >>> vocab_text8.txt\n    UNK 418391\n    the 1061396\n    of 593677\n    and 416629\n    one 411764\n    in 372201\n    a 325873\n    to 316376\n\n    \"\"\"\n    if arg_0 is None:\n        arg_0 = []\n\n    arg_2 = os.getcwd()\n    arg_3 = len(arg_0)\n    with open(os.path.join(arg_2, arg_1), \"w\") as f:\n        for arg_4 in xrange(arg_3):\n            f.write(\"%s %d\\n\" % (tf.compat.as_text(arg_0[arg_4][0]), arg_0[arg_4][1]))\n    tl.logging.info(\"%d vocab saved to %s in %s\" % (arg_3, arg_1, arg_2))", "path": "tensorlayer/nlp.py", "identifier": "save_vocab", "docstring": "Save the vocabulary to a file so the model can be reloaded.\n\n    Parameters\n    ----------\n    count : a list of tuple and list\n        count[0] is a list : the number of rare words,\n        count[1:] are tuples : the number of occurrence of each word,\n        e.g. [['UNK', 418391], (b'the', 1061396), (b'of', 593677), (b'and', 416629), (b'one', 411764)]\n\n    Examples\n    ---------\n    >>> words = tl.files.load_matt_mahoney_text8_dataset()\n    >>> vocabulary_size = 50000\n    >>> data, count, dictionary, reverse_dictionary = tl.nlp.build_words_dataset(words, vocabulary_size, True)\n    >>> tl.nlp.save_vocab(count, name='vocab_text8.txt')\n    >>> vocab_text8.txt\n    UNK 418391\n    the 1061396\n    of 593677\n    and 416629\n    one 411764\n    in 372201\n    a 325873\n    to 316376", "docstring_tokens": ["Save", "the", "vocabulary", "to", "a", "file", "so", "the", "model", "can", "be", "reloaded", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253896}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/delete.py#L38-L80", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Deletes all objects and containers in the account.", "language": "python", "parameters": "(context, yes_empty_account=False, until_empty=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_1", ":", "raise", "ReturnCode", "(", "'called Func without setting yes_empty_account=True'", ")", "arg_3", "=", "None", "while", "True", ":", "with", "arg_0", ".", "client_manager", ".", "with_client", "(", ")", "as", "client", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "client", ".", "get_account", "(", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_0", ".", "headers", ",", "query", "=", "arg_0", ".", "query", ",", "cdn", "=", "arg_0", ".", "cdn", ")", "if", "arg_4", "//", "100", "!=", "2", ":", "if", "arg_4", "==", "404", "and", "arg_0", ".", "ignore_404", ":", "return", "raise", "ReturnCode", "(", "'listing account: %s %s'", "%", "(", "arg_4", ",", "arg_5", ")", ")", "if", "not", "arg_7", ":", "if", "arg_2", "and", "arg_3", ":", "arg_3", "=", "None", "continue", "break", "for", "arg_8", "in", "arg_7", ":", "cli_delete", "(", "arg_0", ",", "arg_8", "[", "'name'", "]", ",", "arg_0", ".", "headers", ",", "recursive", "=", "True", ")", "arg_3", "=", "arg_8", "[", "'name'", "]"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n    \"\"\"\n    Deletes all objects and containers in the account.\n\n    You must set yes_empty_account to True to verify you really want to\n    do this.\n\n    By default, this will perform one pass at deleting all objects and\n    containers; so if objects revert to previous versions or if new\n    objects or containers otherwise arise during the process, the\n    account may not be empty once done.\n\n    Set `until_empty` to True if you want multiple passes to keep trying\n    to fully empty and delete the containers. Note until_empty=True\n    could run forever if something else is making new items faster than\n    they're being deleted.\n\n    See :py:mod:`swiftly.cli.delete` for context usage information.\n\n    See :py:class:`CLIDelete` for more information.\n    \"\"\"\n    if not arg_1:\n        raise ReturnCode(\n            'called Func without setting yes_empty_account=True')\n    arg_3 = None\n    while True:\n        with arg_0.client_manager.with_client() as client:\n            arg_4, arg_5, arg_6, arg_7 = client.get_account(\n                arg_3=arg_3, arg_6=arg_0.headers, query=arg_0.query,\n                cdn=arg_0.cdn)\n        if arg_4 // 100 != 2:\n            if arg_4 == 404 and arg_0.ignore_404:\n                return\n            raise ReturnCode('listing account: %s %s' % (arg_4, arg_5))\n        if not arg_7:\n            if arg_2 and arg_3:\n                arg_3 = None\n                continue\n            break\n        for arg_8 in arg_7:\n            cli_delete(\n                arg_0, arg_8['name'], arg_0.headers, recursive=True)\n        arg_3 = arg_8['name']", "path": "swiftly/cli/delete.py", "identifier": "cli_empty_account", "docstring": "Deletes all objects and containers in the account.\n\n    You must set yes_empty_account to True to verify you really want to\n    do this.\n\n    By default, this will perform one pass at deleting all objects and\n    containers; so if objects revert to previous versions or if new\n    objects or containers otherwise arise during the process, the\n    account may not be empty once done.\n\n    Set `until_empty` to True if you want multiple passes to keep trying\n    to fully empty and delete the containers. Note until_empty=True\n    could run forever if something else is making new items faster than\n    they're being deleted.\n\n    See :py:mod:`swiftly.cli.delete` for context usage information.\n\n    See :py:class:`CLIDelete` for more information.", "docstring_tokens": ["Deletes", "all", "objects", "and", "containers", "in", "the", "account", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 253897}
{"url": "https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L145-L161", "sha": "b45395b1aba41301b898040acade7010e6878a08", "docstring_summary": "Return nearest parent permission for `path`.", "language": "python", "parameters": "(self, path)", "return_statement": "return perm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "pathlib", ".", "PurePosixPath", "(", "arg_1", ")", "arg_2", "=", "filter", "(", "lambda", "p", ":", "p", ".", "is_parent", "(", "arg_1", ")", ",", "arg_0", ".", "permissions", ")", "arg_3", "=", "min", "(", "arg_2", ",", "key", "=", "lambda", "p", ":", "len", "(", "arg_1", ".", "relative_to", "(", "p", ".", "path", ")", ".", "parts", ")", ",", "default", "=", "Permission", "(", ")", ",", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return nearest parent permission for `path`.\n\n        :param path: path which permission you want to know\n        :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath`\n\n        :rtype: :py:class:`aioftp.Permission`\n        \"\"\"\n        arg_1 = pathlib.PurePosixPath(arg_1)\n        arg_2 = filter(lambda p: p.is_parent(arg_1), arg_0.permissions)\n        arg_3 = min(\n            arg_2,\n            key=lambda p: len(arg_1.relative_to(p.path).parts),\n            default=Permission(),\n        )\n        return arg_3", "path": "aioftp/server.py", "identifier": "User.get_permissions", "docstring": "Return nearest parent permission for `path`.\n\n        :param path: path which permission you want to know\n        :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath`\n\n        :rtype: :py:class:`aioftp.Permission`", "docstring_tokens": ["Return", "nearest", "parent", "permission", "for", "path", "."], "nwo": "aio-libs/aioftp", "score": 0.5742192901431463, "idx": 253898}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L981-L993", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Add a new tokenized line from the file to the token buffer.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ".", "tokens", ")", "==", "0", ":", "arg_0", ".", "__tokenize", "(", "arg_0", ".", "dxfile", ".", "readline", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Add a new tokenized line from the file to the token buffer.\n\n        Func()\n\n        Only reads a new line if the buffer is empty. It is safe to\n        call it repeatedly.\n\n        At end of file, method returns empty strings and it is up to\n        __peek and __consume to flag the end of the stream.\n        \"\"\"\n        if len(arg_0.tokens) == 0:\n            arg_0.__tokenize(arg_0.dxfile.readline())", "path": "gridData/OpenDX.py", "identifier": "DXParser.__refill_tokenbuffer", "docstring": "Add a new tokenized line from the file to the token buffer.\n\n        __refill_tokenbuffer()\n\n        Only reads a new line if the buffer is empty. It is safe to\n        call it repeatedly.\n\n        At end of file, method returns empty strings and it is up to\n        __peek and __consume to flag the end of the stream.", "docstring_tokens": ["Add", "a", "new", "tokenized", "line", "from", "the", "file", "to", "the", "token", "buffer", "."], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 253899}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/exceptions.py#L64-L77", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Convert this exception to a dictionary.", "language": "python", "parameters": "(self)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_1", "[", "'reason'", "]", "=", "arg_0", ".", "msg", "arg_1", "[", "'type'", "]", "=", "arg_0", ".", "__class__", ".", "__name__", "arg_1", "[", "'params'", "]", "=", "arg_0", ".", "params", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Convert this exception to a dictionary.\n\n        Returns:\n            dist: A dictionary of information about this exception,\n                Has a 'reason' key, a 'type' key  and a dictionary of params\n        \"\"\"\n\n        arg_1 = {}\n        arg_1['reason'] = arg_0.msg\n        arg_1['type'] = arg_0.__class__.__name__\n        arg_1['params'] = arg_0.params\n\n        return arg_1", "path": "typedargs/exceptions.py", "identifier": "KeyValueException.to_dict", "docstring": "Convert this exception to a dictionary.\n\n        Returns:\n            dist: A dictionary of information about this exception,\n                Has a 'reason' key, a 'type' key  and a dictionary of params", "docstring_tokens": ["Convert", "this", "exception", "to", "a", "dictionary", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 253900}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/netmhcii_pan.py#L48-L59", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Assume that we're dealing with a human DRB allele\n        which NetMHCIIpan treats differently because there is\n        little population diversity in the DR-alpha gene", "language": "python", "parameters": "(self, parsed_beta_allele)", "return_statement": "return \"%s_%s%s\" % (\n            parsed_beta_allele.gene,\n            parsed_beta_allele.allele_family,\n            parsed_beta_allele.allele_code)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "\"DRB\"", "not", "in", "arg_1", ".", "gene", ":", "raise", "ValueError", "(", "\"Unexpected allele %s\"", "%", "arg_1", ")", "return", "\"%s_%s%s\"", "%", "(", "arg_1", ".", "gene", ",", "arg_1", ".", "allele_family", ",", "arg_1", ".", "allele_code", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Assume that we're dealing with a human DRB allele\n        which NetMHCIIpan treats differently because there is\n        little population diversity in the DR-alpha gene\n        \"\"\"\n        if \"DRB\" not in arg_1.gene:\n            raise ValueError(\"Unexpected allele %s\" % arg_1)\n        return \"%s_%s%s\" % (\n            arg_1.gene,\n            arg_1.allele_family,\n            arg_1.allele_code)", "path": "mhctools/netmhcii_pan.py", "identifier": "NetMHCIIpan._prepare_drb_allele_name", "docstring": "Assume that we're dealing with a human DRB allele\n        which NetMHCIIpan treats differently because there is\n        little population diversity in the DR-alpha gene", "docstring_tokens": ["Assume", "that", "we", "re", "dealing", "with", "a", "human", "DRB", "allele", "which", "NetMHCIIpan", "treats", "differently", "because", "there", "is", "little", "population", "diversity", "in", "the", "DR", "-", "alpha", "gene"], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 253901}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/oauth2.py#L247-L257", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "returns a Token object with the given access token or refresh token", "language": "python", "parameters": "(self, access_token=None, refresh_token=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", ":", "return", "arg_0", ".", "query", ".", "filter_by", "(", "arg_1", "=", "arg_1", ")", ".", "first", "(", ")", "elif", "arg_2", ":", "return", "arg_0", ".", "query", ".", "filter_by", "(", "arg_2", "=", "arg_2", ")", ".", "first", "(", ")", "return", "None"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"returns a Token object with the given access token or refresh token\n\n        :param access_token: User's access token\n        :param refresh_token: User's refresh token\n        \"\"\"\n        if arg_1:\n            return arg_0.query.filter_by(arg_1=arg_1).first()\n        elif arg_2:\n            return arg_0.query.filter_by(arg_2=arg_2).first()\n        return None", "path": "flask_oauthlib/contrib/oauth2.py", "identifier": "TokenBinding.get", "docstring": "returns a Token object with the given access token or refresh token\n\n        :param access_token: User's access token\n        :param refresh_token: User's refresh token", "docstring_tokens": ["returns", "a", "Token", "object", "with", "the", "given", "access", "token", "or", "refresh", "token"], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 253902}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/stats.py#L10-L77", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "calculate pvalues for all categories in the graph", "language": "python", "parameters": "(query, gene_sets, background=20000, **kwargs)", "return_statement": "return zip(*vals)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "20000", ",", "**", "arg_3", ")", ":", "arg_4", "=", "len", "(", "arg_0", ")", "arg_0", "=", "set", "(", "arg_0", ")", "arg_5", "=", "[", "]", "if", "isinstance", "(", "arg_2", ",", "set", ")", ":", "arg_6", "=", "len", "(", "arg_2", ")", "arg_0", "=", "arg_0", ".", "intersection", "(", "arg_2", ")", "elif", "isinstance", "(", "arg_2", ",", "int", ")", ":", "arg_6", "=", "arg_2", "else", ":", "raise", "ValueError", "(", "\"background should be set or int object\"", ")", "arg_7", "=", "sorted", "(", "arg_1", ".", "keys", "(", ")", ")", "for", "arg_8", "in", "arg_7", ":", "arg_9", "=", "arg_1", ".", "get", "(", "arg_8", ")", "arg_10", "=", "len", "(", "arg_9", ")", "arg_11", "=", "arg_0", ".", "intersection", "(", "set", "(", "arg_9", ")", ")", "arg_12", "=", "len", "(", "arg_11", ")", "if", "arg_12", "<", "1", ":", "continue", "arg_5", ".", "append", "(", "(", "arg_8", ",", "hypergeom", ".", "sf", "(", "arg_12", "-", "1", ",", "arg_6", ",", "arg_10", ",", "arg_4", ")", ",", "arg_12", ",", "arg_10", ",", "arg_11", ")", ")", "return", "zip", "(", "*", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=20000, **arg_3):\n    \"\"\" calculate pvalues for all categories in the graph\n\n    :param set query: set of identifiers for which the p value is calculated\n    :param dict gene_sets: gmt file dict after background was set\n    :param set background: total number of genes in your annotated database.\n    :returns: pvalues\n              x: overlapped gene number\n              n: length of gene_set which belongs to each terms\n              hits: overlapped gene names.\n\n\n    For 2*2 contingency table: \n    =============================================================================\n                         |   in  query  |  not in query |    row total\n    =>      in gene_set  |        a     |       b       |       a+b  \n    =>  not in gene_set  |        c     |       d       |       c+d  \n           column total                                 | a+b+c+d = anno database\n    =============================================================================\n    background genes number = a + b + c + d.\n\n    Then, in R\n        x=a     the number of white balls drawn without replacement \n                from an urn which contains both black and white balls.\n        m=a+b   the number of white balls in the urn    \n        n=c+d   the number of black balls in the urn    \n        k=a+c   the number of balls drawn from the urn  \n   \n    In Scipy:\n    for args in scipy.hypergeom.sf(k, M, n, N, loc=0):\n        M: the total number of objects, \n        n: the total number of Type I objects. \n        k: the random variate represents the number of Type I objects in N drawn \n           without replacement from the total population.\n    \n    Therefore, these two functions are the same when using parameters from 2*2 table:\n    R:     >   phyper(x-1, m, n, k, lower.tail=FALSE)\n    Scipy: >>> hypergeom.sf(x-1, m+n, m, k)\n     \n    \"\"\"\n\n    # number of genes in your query data\n    arg_4 = len(arg_0) \n    arg_0 = set(arg_0)\n    arg_5 = []\n    # background should be all genes in annotated database\n    # such as go, kegg et.al.\n    if isinstance(arg_2, set): \n        arg_6 = len(arg_2) # total number in your annotated database \n        # filter genes that not found in annotated database\n        arg_0 = arg_0.intersection(arg_2)\n    elif isinstance(arg_2, int):\n        arg_6 = arg_2\n    else:\n        raise ValueError(\"background should be set or int object\")\n    # pval\n    arg_7 = sorted(arg_1.keys())\n    for arg_8 in arg_7:\n        arg_9 = arg_1.get(arg_8)\n        arg_10 = len(arg_9)\n        arg_11 = arg_0.intersection(set(arg_9))\n        arg_12 = len(arg_11)\n        if arg_12 < 1 : continue\n        # pVal = hypergeom.sf(hitCount-1,popTotal,bgHits,queryTotal) \n        # p(X >= hitCounts)\n        arg_5.append((arg_8, hypergeom.sf(arg_12-1, arg_6, arg_10, arg_4), arg_12, arg_10, arg_11))\n\n    return zip(*arg_5)", "path": "gseapy/stats.py", "identifier": "calc_pvalues", "docstring": "calculate pvalues for all categories in the graph\n\n    :param set query: set of identifiers for which the p value is calculated\n    :param dict gene_sets: gmt file dict after background was set\n    :param set background: total number of genes in your annotated database.\n    :returns: pvalues\n              x: overlapped gene number\n              n: length of gene_set which belongs to each terms\n              hits: overlapped gene names.\n\n\n    For 2*2 contingency table: \n    =============================================================================\n                         |   in  query  |  not in query |    row total\n    =>      in gene_set  |        a     |       b       |       a+b  \n    =>  not in gene_set  |        c     |       d       |       c+d  \n           column total                                 | a+b+c+d = anno database\n    =============================================================================\n    background genes number = a + b + c + d.\n\n    Then, in R\n        x=a     the number of white balls drawn without replacement \n                from an urn which contains both black and white balls.\n        m=a+b   the number of white balls in the urn    \n        n=c+d   the number of black balls in the urn    \n        k=a+c   the number of balls drawn from the urn  \n   \n    In Scipy:\n    for args in scipy.hypergeom.sf(k, M, n, N, loc=0):\n        M: the total number of objects, \n        n: the total number of Type I objects. \n        k: the random variate represents the number of Type I objects in N drawn \n           without replacement from the total population.\n    \n    Therefore, these two functions are the same when using parameters from 2*2 table:\n    R:     >   phyper(x-1, m, n, k, lower.tail=FALSE)\n    Scipy: >>> hypergeom.sf(x-1, m+n, m, k)", "docstring_tokens": ["calculate", "pvalues", "for", "all", "categories", "in", "the", "graph"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 253903}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/api.py#L487-L494", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Update only drafts.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "super", "(", "Deposit", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Update only drafts.\n\n        Status required: ``'draft'``.\n\n        Meta information inside `_deposit` are preserved.\n        \"\"\"\n        super(Deposit, arg_0).Func(*arg_1, **arg_2)", "path": "invenio_deposit/api.py", "identifier": "Deposit.update", "docstring": "Update only drafts.\n\n        Status required: ``'draft'``.\n\n        Meta information inside `_deposit` are preserved.", "docstring_tokens": ["Update", "only", "drafts", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 253904}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L30-L44", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return the module name and the frame id in the module", "language": "python", "parameters": "(node)", "return_statement": "return module, \".\".join(obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "frame", "(", ")", "arg_2", ",", "arg_3", "=", "\"\"", ",", "[", "]", "while", "arg_1", ":", "if", "isinstance", "(", "arg_1", ",", "Module", ")", ":", "arg_2", "=", "arg_1", ".", "name", "else", ":", "arg_3", ".", "append", "(", "getattr", "(", "arg_1", ",", "\"name\"", ",", "\"<lambda>\"", ")", ")", "try", ":", "arg_1", "=", "arg_1", ".", "parent", ".", "frame", "(", ")", "except", "AttributeError", ":", "arg_1", "=", "None", "arg_3", ".", "reverse", "(", ")", "return", "arg_2", ",", "\".\"", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"return the module name and the frame id in the module\"\"\"\n    arg_1 = arg_0.frame()\n    arg_2, arg_3 = \"\", []\n    while arg_1:\n        if isinstance(arg_1, Module):\n            arg_2 = arg_1.name\n        else:\n            arg_3.append(getattr(arg_1, \"name\", \"<lambda>\"))\n        try:\n            arg_1 = arg_1.parent.frame()\n        except AttributeError:\n            arg_1 = None\n    arg_3.reverse()\n    return arg_2, \".\".join(arg_3)", "path": "pylint/utils/utils.py", "identifier": "get_module_and_frameid", "docstring": "return the module name and the frame id in the module", "docstring_tokens": ["return", "the", "module", "name", "and", "the", "frame", "id", "in", "the", "module"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 253905}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/supybot.py#L184-L208", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a Supybot IRC log file.", "language": "python", "parameters": "(filepath)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ",", "errors", "=", "'surrogateescape'", ",", "newline", "=", "os", ".", "linesep", ")", "as", "f", ":", "arg_1", "=", "SupybotParser", "(", "f", ")", "try", ":", "for", "arg_2", "in", "arg_1", ".", "parse", "(", ")", ":", "yield", "arg_2", "except", "ParseError", "as", "e", ":", "arg_3", "=", "\"file: %s; reason: %s\"", "%", "(", "arg_0", ",", "str", "(", "e", ")", ")", "raise", "ParseError", "(", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"Parse a Supybot IRC log file.\n\n        The method parses the Supybot IRC log file and returns an iterator of\n        dictionaries. Each one of this, contains a message from the file.\n\n        :param filepath: path to the IRC log file\n\n        :returns: a generator of parsed messages\n\n        :raises ParseError: raised when the format of the Supybot log file\n            is invalid\n        :raises OSError: raised when an error occurs reading the\n            given file\n        \"\"\"\n        with open(arg_0, 'r', errors='surrogateescape',\n                  newline=os.linesep) as f:\n            arg_1 = SupybotParser(f)\n\n            try:\n                for arg_2 in arg_1.parse():\n                    yield arg_2\n            except ParseError as e:\n                arg_3 = \"file: %s; reason: %s\" % (arg_0, str(e))\n                raise ParseError(arg_3=arg_3)", "path": "perceval/backends/core/supybot.py", "identifier": "Supybot.parse_supybot_log", "docstring": "Parse a Supybot IRC log file.\n\n        The method parses the Supybot IRC log file and returns an iterator of\n        dictionaries. Each one of this, contains a message from the file.\n\n        :param filepath: path to the IRC log file\n\n        :returns: a generator of parsed messages\n\n        :raises ParseError: raised when the format of the Supybot log file\n            is invalid\n        :raises OSError: raised when an error occurs reading the\n            given file", "docstring_tokens": ["Parse", "a", "Supybot", "IRC", "log", "file", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 253906}
{"url": "https://github.com/xnuinside/clifier/blob/3d704a30dc985bea3b876216accc53c19dc8b0df/clifier/clifier.py#L110-L141", "sha": "3d704a30dc985bea3b876216accc53c19dc8b0df", "docstring_summary": "custom command line action to check file exist", "language": "python", "parameters": "(self)", "return_statement": "return CheckPathAction", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "class", "CheckPathAction", "(", "argparse", ".", "Action", ")", ":", "def", "__call__", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "type", "(", "arg_3", ")", "is", "list", ":", "arg_3", "=", "arg_3", "[", "0", "]", "arg_5", "=", "arg_3", "if", "arg_4", "==", "'None'", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", ":", "arg_6", "=", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", "if", "not", "arg_3", ".", "startswith", "(", "arg_6", ")", "and", "not", "arg_3", ".", "startswith", "(", "os", ".", "getcwd", "(", ")", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_3", ")", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_3", ")", "elif", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_3", ")", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_3", ")", "else", ":", "arg_3", "=", "None", "else", ":", "arg_3", "=", "None", "elif", "arg_4", "==", "'--template-name'", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "arg_2", ".", "target", ",", "arg_3", ")", ")", ":", "arg_3", "=", "None", "if", "not", "arg_3", ":", "logger", ".", "error", "(", "\"Could not to find path %s. Please provide \"", "\"correct path to %s option\"", ",", "arg_5", ",", "arg_4", ")", "exit", "(", "1", ")", "setattr", "(", "arg_2", ",", "arg_0", ".", "dest", ",", "arg_3", ")", "return", "CheckPathAction"], "function": "def Func(arg_0):\n        \"\"\" custom command line action to check file exist \"\"\"\n        class CheckPathAction(argparse.Action):\n            def __call__(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n                if type(arg_3) is list:\n                    arg_3 = arg_3[0]\n                arg_5 = arg_3\n                if arg_4 == 'None':\n                    if not os.path.isdir(arg_3):\n                        arg_6 = os.path.expanduser(\"~\")\n                        if not arg_3.startswith(arg_6) \\\n                                and not arg_3.startswith(os.getcwd()):\n                            if os.path.isdir(os.path.join(arg_6, arg_3)):\n                                arg_3 = os.path.join(arg_6, arg_3)\n                            elif os.path.isdir(os.path.join(os.getcwd(), arg_3)):\n                                arg_3 = os.path.join(os.getcwd(), arg_3)\n                            else:\n                                arg_3 = None\n                        else:\n                            arg_3 = None\n                elif arg_4 == '--template-name':\n                    if not os.path.isdir(arg_3):\n                        if not os.path.isdir(os.path.join(arg_2.target, arg_3)):\n                            arg_3 = None\n                if not arg_3:\n                    logger.error(\"Could not to find path %s. Please provide \"\n                                 \"correct path to %s option\",\n                                 arg_5, arg_4)\n                    exit(1)\n                setattr(arg_2, arg_0.dest, arg_3)\n\n        return CheckPathAction", "path": "clifier/clifier.py", "identifier": "Clifier.check_path_action", "docstring": "custom command line action to check file exist", "docstring_tokens": ["custom", "command", "line", "action", "to", "check", "file", "exist"], "nwo": "xnuinside/clifier", "score": 0.0, "idx": 253907}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/lean_minhash.py#L51-L60", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Initialize the slots of the LeanMinHash.", "language": "python", "parameters": "(self, seed, hashvalues)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "seed", "=", "arg_1", "arg_0", ".", "hashvalues", "=", "arg_0", ".", "_parse_hashvalues", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Initialize the slots of the LeanMinHash.\n\n        Args:\n            seed (int): The random seed controls the set of random\n                permutation functions generated for this LeanMinHash.\n            hashvalues: The hash values is the internal state of the LeanMinHash.\n        '''\n        arg_0.seed = arg_1\n        arg_0.hashvalues = arg_0._parse_hashvalues(arg_2)", "path": "datasketch/lean_minhash.py", "identifier": "LeanMinHash._initialize_slots", "docstring": "Initialize the slots of the LeanMinHash.\n\n        Args:\n            seed (int): The random seed controls the set of random\n                permutation functions generated for this LeanMinHash.\n            hashvalues: The hash values is the internal state of the LeanMinHash.", "docstring_tokens": ["Initialize", "the", "slots", "of", "the", "LeanMinHash", "."], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 253908}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/docs/examples/network/complete-network-example.py#L113-L150", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Run the Hot Gym example.", "language": "python", "parameters": "(numRecords)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "FileRecordStream", "(", "streamID", "=", "_INPUT_FILE_PATH", ")", "arg_0", "=", "min", "(", "arg_0", ",", "arg_1", ".", "getDataRowCount", "(", ")", ")", "arg_2", "=", "createNetwork", "(", "arg_1", ")", "arg_2", ".", "regions", "[", "\"sensor\"", "]", ".", "setParameter", "(", "\"predictedField\"", ",", "\"consumption\"", ")", "arg_2", ".", "regions", "[", "\"SP\"", "]", ".", "setParameter", "(", "\"learningMode\"", ",", "1", ")", "arg_2", ".", "regions", "[", "\"TM\"", "]", ".", "setParameter", "(", "\"learningMode\"", ",", "1", ")", "arg_2", ".", "regions", "[", "\"classifier\"", "]", ".", "setParameter", "(", "\"learningMode\"", ",", "1", ")", "arg_2", ".", "regions", "[", "\"SP\"", "]", ".", "setParameter", "(", "\"inferenceMode\"", ",", "1", ")", "arg_2", ".", "regions", "[", "\"TM\"", "]", ".", "setParameter", "(", "\"inferenceMode\"", ",", "1", ")", "arg_2", ".", "regions", "[", "\"classifier\"", "]", ".", "setParameter", "(", "\"inferenceMode\"", ",", "1", ")", "arg_3", "=", "[", "]", "arg_4", "=", "1", "for", "arg_5", "in", "range", "(", "0", ",", "arg_0", ",", "arg_4", ")", ":", "arg_2", ".", "run", "(", "arg_4", ")", "arg_6", "=", "getPredictionResults", "(", "arg_2", ",", "\"classifier\"", ")", "arg_7", "=", "arg_6", "[", "1", "]", "[", "\"predictedValue\"", "]", "arg_8", "=", "arg_6", "[", "1", "]", "[", "\"predictionConfidence\"", "]", "arg_9", "=", "arg_6", "[", "5", "]", "[", "\"predictedValue\"", "]", "arg_10", "=", "arg_6", "[", "5", "]", "[", "\"predictionConfidence\"", "]", "arg_11", "=", "(", "arg_7", ",", "arg_8", "*", "100", ",", "arg_9", ",", "arg_10", "*", "100", ")", "print", "\"1-step: {:16} ({:4.4}%)\\t 5-step: {:16} ({:4.4}%)\"", ".", "format", "(", "*", "arg_11", ")", "arg_3", ".", "append", "(", "arg_11", ")", "return", "arg_3"], "function": "def Func(arg_0):\n  \"\"\"Run the Hot Gym example.\"\"\"\n\n  # Create a data source for the network.\n  arg_1 = FileRecordStream(streamID=_INPUT_FILE_PATH)\n  arg_0 = min(arg_0, arg_1.getDataRowCount())\n  arg_2 = createNetwork(arg_1)\n\n  # Set predicted field\n  arg_2.regions[\"sensor\"].setParameter(\"predictedField\", \"consumption\")\n\n  # Enable learning for all regions.\n  arg_2.regions[\"SP\"].setParameter(\"learningMode\", 1)\n  arg_2.regions[\"TM\"].setParameter(\"learningMode\", 1)\n  arg_2.regions[\"classifier\"].setParameter(\"learningMode\", 1)\n\n  # Enable inference for all regions.\n  arg_2.regions[\"SP\"].setParameter(\"inferenceMode\", 1)\n  arg_2.regions[\"TM\"].setParameter(\"inferenceMode\", 1)\n  arg_2.regions[\"classifier\"].setParameter(\"inferenceMode\", 1)\n\n  arg_3 = []\n  arg_4 = 1  # Run the network, N iterations at a time.\n  for arg_5 in range(0, arg_0, arg_4):\n    arg_2.run(arg_4)\n\n    arg_6 = getPredictionResults(arg_2, \"classifier\")\n    arg_7 = arg_6[1][\"predictedValue\"]\n    arg_8 = arg_6[1][\"predictionConfidence\"]\n    arg_9 = arg_6[5][\"predictedValue\"]\n    arg_10 = arg_6[5][\"predictionConfidence\"]\n\n    arg_11 = (arg_7, arg_8 * 100,\n              arg_9, arg_10 * 100)\n    print \"1-step: {:16} ({:4.4}%)\\t 5-step: {:16} ({:4.4}%)\".format(*arg_11)\n    arg_3.append(arg_11)\n\n  return arg_3", "path": "docs/examples/network/complete-network-example.py", "identifier": "runHotgym", "docstring": "Run the Hot Gym example.", "docstring_tokens": ["Run", "the", "Hot", "Gym", "example", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253909}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L178-L191", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Parses a string containing only 0's and 1's and return a Python list object.", "language": "python", "parameters": "(s)", "return_statement": "return sdr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "basestring", ")", "arg_1", "=", "[", "int", "(", "c", ")", "for", "c", "in", "arg_0", "if", "c", "in", "(", "\"0\"", ",", "\"1\"", ")", "]", "if", "len", "(", "arg_1", ")", "!=", "len", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "\"The provided string %s is malformed. The string should \"", "\"have only 0's and 1's.\"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"\n  Parses a string containing only 0's and 1's and return a Python list object.\n\n  :param s: (string) string to parse\n  :returns: (list) SDR out\n  \"\"\"\n  assert isinstance(arg_0, basestring)\n  arg_1 = [int(c) for c in arg_0 if c in (\"0\", \"1\")]\n  if len(arg_1) != len(arg_0):\n    raise ValueError(\"The provided string %s is malformed. The string should \"\n                     \"have only 0's and 1's.\")\n\n  return arg_1", "path": "src/nupic/data/utils.py", "identifier": "parseSdr", "docstring": "Parses a string containing only 0's and 1's and return a Python list object.\n\n  :param s: (string) string to parse\n  :returns: (list) SDR out", "docstring_tokens": ["Parses", "a", "string", "containing", "only", "0", "s", "and", "1", "s", "and", "return", "a", "Python", "list", "object", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253910}
{"url": "https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L36-L54", "sha": "6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851", "docstring_summary": "Try loading given config file.", "language": "python", "parameters": "(cls, file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "\"Config file not found.\"", ")", "try", ":", "arg_2", "=", "configparser", ".", "ConfigParser", "(", ")", "arg_2", ".", "read", "(", "arg_1", ")", "arg_3", "=", "arg_0", "(", "arg_1", ",", "arg_2", ")", "if", "not", "arg_3", ".", "check_config_sanity", "(", ")", ":", "raise", "ValueError", "(", "\"Error in config file.\"", ")", "else", ":", "return", "arg_3", "except", "configparser", ".", "Error", ":", "raise", "ValueError", "(", "\"Config file is invalid.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Try loading given config file.\n\n        :param str file: full path to the config file to load\n        \"\"\"\n        if not os.path.exists(arg_1):\n            raise ValueError(\"Config file not found.\")\n\n        try:\n            arg_2 = configparser.ConfigParser()\n            arg_2.read(arg_1)\n\n            arg_3 = arg_0(arg_1, arg_2)\n            if not arg_3.check_config_sanity():\n                raise ValueError(\"Error in config file.\")\n            else:\n                return arg_3\n        except configparser.Error:\n            raise ValueError(\"Config file is invalid.\")", "path": "twtxt/config.py", "identifier": "Config.from_file", "docstring": "Try loading given config file.\n\n        :param str file: full path to the config file to load", "docstring_tokens": ["Try", "loading", "given", "config", "file", "."], "nwo": "buckket/twtxt", "score": 0.5783854231140674, "idx": 253911}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L967-L1008", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Get the value of the Wigner function from measurement results.", "language": "python", "parameters": "(q_result, meas_qubits, labels, shots=None)", "return_statement": "return w", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "len", "(", "arg_1", ")", "arg_5", "=", "2", "**", "arg_4", "arg_6", "=", "[", "0.5", "+", "0.5", "*", "np", ".", "sqrt", "(", "3", ")", ",", "0.5", "-", "0.5", "*", "np", ".", "sqrt", "(", "3", ")", "]", "arg_7", "=", "1", "for", "arg_8", "in", "range", "(", "arg_4", ")", ":", "arg_7", "=", "np", ".", "kron", "(", "arg_7", ",", "arg_6", ")", "arg_9", "=", "[", "0", "]", "*", "len", "(", "arg_2", ")", "arg_10", "=", "0", "arg_11", "=", "[", "marginal_counts", "(", "arg_0", ".", "get_counts", "(", "circ", ")", ",", "arg_1", ")", "for", "circ", "in", "arg_2", "]", "for", "arg_12", "in", "arg_11", ":", "arg_13", "=", "[", "0", "]", "*", "arg_5", "for", "arg_8", "in", "range", "(", "arg_5", ")", ":", "if", "bin", "(", "arg_8", ")", "[", "2", ":", "]", ".", "zfill", "(", "arg_4", ")", "in", "arg_12", ":", "arg_13", "[", "arg_8", "]", "=", "float", "(", "arg_12", "[", "bin", "(", "arg_8", ")", "[", "2", ":", "]", ".", "zfill", "(", "arg_4", ")", "]", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "np", ".", "sum", "(", "arg_13", ")", "for", "arg_8", "in", "range", "(", "arg_5", ")", ":", "arg_9", "[", "arg_10", "]", "=", "arg_9", "[", "arg_10", "]", "+", "(", "arg_13", "[", "arg_8", "]", "/", "arg_3", ")", "*", "arg_7", "[", "arg_8", "]", "arg_10", "+=", "1", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"Get the value of the Wigner function from measurement results.\n\n    Args:\n        q_result (Result): Results from execution of a state tomography\n                            circuits on a backend.\n        meas_qubits (list[int]): a list of the qubit indexes measured.\n        labels (list[str]): a list of names of the circuits\n        shots (int): number of shots\n\n    Returns:\n        list: The values of the Wigner function at measured points in\n            phase space\n    \"\"\"\n    arg_4 = len(arg_1)\n\n    arg_5 = 2**arg_4\n    arg_6 = [0.5 + 0.5 * np.sqrt(3), 0.5 - 0.5 * np.sqrt(3)]\n    arg_7 = 1\n\n    for arg_8 in range(arg_4):\n        arg_7 = np.kron(arg_7, arg_6)\n\n    arg_9 = [0] * len(arg_2)\n    arg_10 = 0\n    arg_11 = [marginal_counts(arg_0.get_counts(circ), arg_1)\n              for circ in arg_2]\n    for arg_12 in arg_11:\n        arg_13 = [0] * arg_5\n\n        for arg_8 in range(arg_5):\n            if bin(arg_8)[2:].zfill(arg_4) in arg_12:\n                arg_13[arg_8] = float(arg_12[bin(arg_8)[2:].zfill(arg_4)])\n\n        if arg_3 is None:\n            arg_3 = np.sum(arg_13)\n\n        for arg_8 in range(arg_5):\n            arg_9[arg_10] = arg_9[arg_10] + (arg_13[arg_8] / arg_3) * arg_7[arg_8]\n        arg_10 += 1\n\n    return arg_9", "path": "qiskit/tools/qcvv/tomography.py", "identifier": "wigner_data", "docstring": "Get the value of the Wigner function from measurement results.\n\n    Args:\n        q_result (Result): Results from execution of a state tomography\n                            circuits on a backend.\n        meas_qubits (list[int]): a list of the qubit indexes measured.\n        labels (list[str]): a list of names of the circuits\n        shots (int): number of shots\n\n    Returns:\n        list: The values of the Wigner function at measured points in\n            phase space", "docstring_tokens": ["Get", "the", "value", "of", "the", "Wigner", "function", "from", "measurement", "results", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253912}
{"url": "https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storedobject.py#L1317-L1333", "sha": "8a34891892b8af69b21fdc46701c91763a5c1cf9", "docstring_summary": "When removing an object with foreign fields, back-references from\n    other objects to the current object should be deleted. This function\n    identifies foreign fields of the specified object whose values are not\n    None and which specify back-reference keys, then removes back-references\n    from linked objects to the specified object.", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "_collect_refs", "(", "arg_0", ")", ":", "arg_1", "[", "'value'", "]", ".", "_remove_backref", "(", "arg_1", "[", "'field_instance'", "]", ".", "_backref_field_name", ",", "arg_0", ",", "arg_1", "[", "'field_name'", "]", ",", "strict", "=", "False", ")"], "function": "def Func(arg_0):\n    \"\"\"When removing an object with foreign fields, back-references from\n    other objects to the current object should be deleted. This function\n    identifies foreign fields of the specified object whose values are not\n    None and which specify back-reference keys, then removes back-references\n    from linked objects to the specified object.\n\n    :param obj: Object for which back-references should be removed\n\n    \"\"\"\n    for arg_1 in _collect_refs(arg_0):\n        arg_1['value']._remove_backref(\n            arg_1['field_instance']._backref_field_name,\n            arg_0,\n            arg_1['field_name'],\n            strict=False\n        )", "path": "modularodm/storedobject.py", "identifier": "rm_back_refs", "docstring": "When removing an object with foreign fields, back-references from\n    other objects to the current object should be deleted. This function\n    identifies foreign fields of the specified object whose values are not\n    None and which specify back-reference keys, then removes back-references\n    from linked objects to the specified object.\n\n    :param obj: Object for which back-references should be removed", "docstring_tokens": ["When", "removing", "an", "object", "with", "foreign", "fields", "back", "-", "references", "from", "other", "objects", "to", "the", "current", "object", "should", "be", "deleted", ".", "This", "function", "identifies", "foreign", "fields", "of", "the", "specified", "object", "whose", "values", "are", "not", "None", "and", "which", "specify", "back", "-", "reference", "keys", "then", "removes", "back", "-", "references", "from", "linked", "objects", "to", "the", "specified", "object", "."], "nwo": "cos-archives/modular-odm", "score": 0.2643786477459777, "idx": 253913}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/ipp.py#L254-L269", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Scale in the number of active blocks by the specified number.", "language": "python", "parameters": "(self, blocks)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", "zip", "(", "arg_0", ".", "engines", ",", "arg_0", ".", "provider", ".", "status", "(", "arg_0", ".", "engines", ")", ")", ")", "arg_3", "=", "[", "engine", "for", "engine", "in", "arg_2", "if", "arg_2", "[", "engine", "]", "==", "\"RUNNING\"", "]", "[", ":", "arg_1", "]", "if", "arg_0", ".", "provider", ":", "arg_4", "=", "arg_0", ".", "provider", ".", "cancel", "(", "arg_3", ")", "else", ":", "logger", ".", "error", "(", "\"No execution provider available\"", ")", "arg_4", "=", "None", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Scale in the number of active blocks by the specified number.\n\n        \"\"\"\n        arg_2 = dict(zip(arg_0.engines, arg_0.provider.status(arg_0.engines)))\n\n        # This works for blocks=0\n        arg_3 = [engine for engine in arg_2 if arg_2[engine] == \"RUNNING\"][:arg_1]\n\n        if arg_0.provider:\n            arg_4 = arg_0.provider.cancel(arg_3)\n        else:\n            logger.error(\"No execution provider available\")\n            arg_4 = None\n\n        return arg_4", "path": "parsl/executors/ipp.py", "identifier": "IPyParallelExecutor.scale_in", "docstring": "Scale in the number of active blocks by the specified number.", "docstring_tokens": ["Scale", "in", "the", "number", "of", "active", "blocks", "by", "the", "specified", "number", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 253914}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/decorators.py#L14-L44", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Decorator declaring the wrapped function to be a new-style task.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return wrapper if invoked else wrapper(func)", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "bool", "(", "not", "arg_0", "or", "arg_1", ")", "arg_3", "=", "arg_1", ".", "pop", "(", "\"task_class\"", ",", "WrappedCallableTask", ")", "arg_4", ",", "arg_0", "=", "arg_0", "[", "0", "]", ",", "(", ")", "def", "arg_5", "(", "arg_4", ")", ":", "return", "arg_3", "(", "arg_4", ",", "*", "arg_0", ",", "**", "arg_1", ")", "arg_5", ".", "is_Func", "=", "True", "arg_5", ".", "wrapped", "=", "arg_4", "return", "arg_5", "if", "arg_2", "else", "arg_5", "(", "arg_4", ")"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    Decorator declaring the wrapped function to be a new-style task.\n\n    May be invoked as a simple, argument-less decorator (i.e. ``@task``) or\n    with arguments customizing its behavior (e.g. ``@task(alias='myalias')``).\n\n    Please see the :ref:`new-style task <task-decorator>` documentation for\n    details on how to use this decorator.\n\n    .. versionchanged:: 1.2\n        Added the ``alias``, ``aliases``, ``task_class`` and ``default``\n        keyword arguments. See :ref:`task-decorator-arguments` for details.\n    .. versionchanged:: 1.5\n        Added the ``name`` keyword argument.\n\n    .. seealso:: `~fabric.docs.unwrap_tasks`, `~fabric.tasks.WrappedCallableTask`\n    \"\"\"\n    arg_2 = bool(not arg_0 or arg_1)\n    arg_3 = arg_1.pop(\"task_class\", WrappedCallableTask)\n#     if invoked:\n#         func, args = args[0], ()\n#     else:\n    arg_4, arg_0 = arg_0[0], ()\n\n    def arg_5(arg_4):\n        return arg_3(arg_4, *arg_0, **arg_1)\n    arg_5.is_Func = True\n    arg_5.wrapped = arg_4\n\n    return arg_5 if arg_2 else arg_5(arg_4)", "path": "burlap/decorators.py", "identifier": "task_or_dryrun", "docstring": "Decorator declaring the wrapped function to be a new-style task.\n\n    May be invoked as a simple, argument-less decorator (i.e. ``@task``) or\n    with arguments customizing its behavior (e.g. ``@task(alias='myalias')``).\n\n    Please see the :ref:`new-style task <task-decorator>` documentation for\n    details on how to use this decorator.\n\n    .. versionchanged:: 1.2\n        Added the ``alias``, ``aliases``, ``task_class`` and ``default``\n        keyword arguments. See :ref:`task-decorator-arguments` for details.\n    .. versionchanged:: 1.5\n        Added the ``name`` keyword argument.\n\n    .. seealso:: `~fabric.docs.unwrap_tasks`, `~fabric.tasks.WrappedCallableTask`", "docstring_tokens": ["Decorator", "declaring", "the", "wrapped", "function", "to", "be", "a", "new", "-", "style", "task", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 253915}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2059-L2138", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Performs a backwards search from the terminal node back to the start node", "language": "python", "parameters": "(self, start_node, split_name, max_depth=float('inf'), shortcuts=True)", "return_statement": "return result_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", "(", "'inf'", ")", ",", "arg_5", "=", "True", ")", ":", "arg_6", "=", "[", "]", "arg_7", "=", "set", "(", ")", "arg_8", "=", "'.'", ".", "join", "(", "arg_2", ")", "arg_9", "=", "arg_2", "[", "-", "1", "]", "arg_10", "=", "arg_0", ".", "_get_candidate_dict", "(", "arg_9", ",", "None", ",", "use_upper_bound", "=", "False", ")", "arg_11", "=", "arg_1", ".", "v_full_name", "arg_12", "=", "len", "(", "arg_2", ")", "for", "arg_13", "in", "arg_10", ":", "arg_14", "=", "arg_10", "[", "arg_13", "]", "if", "arg_9", "!=", "arg_14", ".", "v_name", "or", "arg_14", ".", "v_full_name", "in", "arg_7", ":", "continue", "if", "arg_13", ".", "startswith", "(", "arg_11", ")", ":", "if", "arg_11", "!=", "''", ":", "arg_15", "=", "arg_13", "[", "len", "(", "arg_11", ")", "+", "1", ":", "]", "else", ":", "arg_15", "=", "arg_13", "arg_16", "=", "arg_15", ".", "split", "(", "'.'", ")", "if", "len", "(", "arg_16", ")", ">", "arg_3", ":", "break", "if", "len", "(", "arg_2", ")", "==", "1", "or", "arg_15", ".", "endswith", "(", "arg_8", ")", ":", "arg_6", ".", "append", "(", "arg_14", ")", "arg_7", ".", "add", "(", "arg_14", ".", "v_full_name", ")", "elif", "arg_5", ":", "arg_17", "=", "set", "(", "arg_16", ")", "arg_18", "=", "True", "for", "arg_19", "in", "arg_2", ":", "if", "arg_19", "not", "in", "arg_17", ":", "arg_18", "=", "False", "break", "if", "arg_18", ":", "arg_20", "=", "0", "arg_21", "=", "len", "(", "arg_16", ")", "for", "arg_22", "in", "range", "(", "arg_21", ")", ":", "if", "arg_22", "+", "arg_12", "-", "arg_20", ">", "arg_21", ":", "break", "if", "arg_2", "[", "arg_20", "]", "==", "arg_16", "[", "arg_22", "]", ":", "arg_20", "+=", "1", "if", "arg_20", "==", "len", "(", "arg_2", ")", ":", "arg_6", ".", "append", "(", "arg_14", ")", "arg_7", ".", "add", "(", "arg_14", ".", "v_full_name", ")", "break", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4('inf'), arg_5=True):\n        \"\"\" Performs a backwards search from the terminal node back to the start node\n\n        :param start_node:\n\n            The node from where search starts, or here better way where backwards search should\n            end.\n\n        :param split_name:\n\n            List of names\n\n        :param max_depth:\n\n            Maximum search depth where to look for\n\n        :param shortcuts:\n\n            If shortcuts are allowed\n\n        \"\"\"\n\n        arg_6 = [] # Result list of all found items\n        arg_7 = set() # Set containing full names of all found items to avoid finding items\n        # twice due to links\n\n        arg_8 = '.'.join(arg_2)\n        arg_9 = arg_2[-1]\n        arg_10 = arg_0._get_candidate_dict(arg_9, None, use_upper_bound=False)\n        arg_11 = arg_1.v_full_name\n\n        arg_12 = len(arg_2)\n\n        for arg_13 in arg_10:\n            # Check if candidate startswith the parent's name\n            arg_14 = arg_10[arg_13]\n            if arg_9 != arg_14.v_name or arg_14.v_full_name in arg_7:\n                # If this is not the case we do have link, that we need to skip\n                continue\n\n            if arg_13.startswith(arg_11):\n                if arg_11 != '':\n                    arg_15 = arg_13[len(arg_11) + 1:]\n                else:\n                    arg_15 = arg_13\n\n                arg_16 = arg_15.split('.')\n\n                if len(arg_16) > arg_3:\n                    break\n\n                if len(arg_2) == 1 or arg_15.endswith(arg_8):\n                    arg_6.append(arg_14)\n                    arg_7.add(arg_14.v_full_name)\n\n                elif arg_5:\n\n                    arg_17 = set(arg_16)\n                    arg_18 = True\n                    for arg_19 in arg_2:\n                        if arg_19 not in arg_17:\n                            arg_18 = False\n                            break\n\n                    if arg_18:\n                        arg_20 = 0\n                        arg_21 = len(arg_16)\n                        for arg_22 in range(arg_21):\n\n                            if arg_22 + arg_12 - arg_20 > arg_21:\n                                break\n\n                            if arg_2[arg_20] == arg_16[arg_22]:\n                                arg_20 += 1\n                                if arg_20 == len(arg_2):\n                                    arg_6.append(arg_14)\n                                    arg_7.add(arg_14.v_full_name)\n                                    break\n\n        return arg_6", "path": "pypet/naturalnaming.py", "identifier": "NaturalNamingInterface._backwards_search", "docstring": "Performs a backwards search from the terminal node back to the start node\n\n        :param start_node:\n\n            The node from where search starts, or here better way where backwards search should\n            end.\n\n        :param split_name:\n\n            List of names\n\n        :param max_depth:\n\n            Maximum search depth where to look for\n\n        :param shortcuts:\n\n            If shortcuts are allowed", "docstring_tokens": ["Performs", "a", "backwards", "search", "from", "the", "terminal", "node", "back", "to", "the", "start", "node"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253916}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/matching.py#L49-L59", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Find the best Jaccard match from query to candidates", "language": "python", "parameters": "(query, intervals_to, candidates)", "return_statement": "return best_idx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "-", "1", "arg_4", "=", "-", "1", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "__jaccard", "(", "arg_0", ",", "arg_1", "[", "arg_5", "]", ")", "if", "arg_6", ">", "arg_3", ":", "arg_3", ",", "arg_4", "=", "arg_6", ",", "arg_5", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):  # pragma: no cover\n    '''Find the best Jaccard match from query to candidates'''\n\n    arg_3 = -1\n    arg_4 = -1\n    for arg_5 in arg_2:\n        arg_6 = __jaccard(arg_0, arg_1[arg_5])\n\n        if arg_6 > arg_3:\n            arg_3, arg_4 = arg_6, arg_5\n    return arg_4", "path": "librosa/util/matching.py", "identifier": "__match_interval_overlaps", "docstring": "Find the best Jaccard match from query to candidates", "docstring_tokens": ["Find", "the", "best", "Jaccard", "match", "from", "query", "to", "candidates"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 253917}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/instruction.py#L262-L266", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Print an if statement if needed.", "language": "python", "parameters": "(self, string)", "return_statement": "return \"if(%s==%d) \" % (self.control[0].name, self.control[1]) + string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "control", "is", "None", ":", "return", "arg_1", "return", "\"if(%s==%d) \"", "%", "(", "arg_0", ".", "control", "[", "0", "]", ".", "name", ",", "arg_0", ".", "control", "[", "1", "]", ")", "+", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Print an if statement if needed.\"\"\"\n        if arg_0.control is None:\n            return arg_1\n        return \"if(%s==%d) \" % (arg_0.control[0].name, arg_0.control[1]) + arg_1", "path": "qiskit/circuit/instruction.py", "identifier": "Instruction._qasmif", "docstring": "Print an if statement if needed.", "docstring_tokens": ["Print", "an", "if", "statement", "if", "needed", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253918}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/patch.py#L183-L198", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Returns True if left and right are equal", "language": "python", "parameters": "(self, cwd)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "\"diff\"", "]", "arg_2", ".", "append", "(", "\"-q\"", ")", "arg_2", ".", "append", "(", "arg_0", ".", "left", ".", "get_name", "(", ")", ")", "arg_2", ".", "append", "(", "arg_0", ".", "right", ".", "get_name", "(", ")", ")", "try", ":", "Process", "(", "arg_2", ")", ".", "run", "(", "arg_1", "=", "arg_1", ",", "suppress_output", "=", "True", ")", "except", "SubprocessError", "as", "e", ":", "if", "e", ".", "get_returncode", "(", ")", "==", "1", ":", "return", "False", "else", ":", "raise", "e", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns True if left and right are Func\n        \"\"\"\n        arg_2 = [\"diff\"]\n        arg_2.append(\"-q\")\n        arg_2.append(arg_0.left.get_name())\n        arg_2.append(arg_0.right.get_name())\n\n        try:\n            Process(arg_2).run(arg_1=arg_1, suppress_output=True)\n        except SubprocessError as e:\n            if e.get_returncode() == 1:\n                return False\n            else:\n                raise e\n        return True", "path": "quilt/patch.py", "identifier": "Diff.equal", "docstring": "Returns True if left and right are equal", "docstring_tokens": ["Returns", "True", "if", "left", "and", "right", "are", "equal"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 253919}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/presto_hook.py#L80-L88", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get a set of records from Presto", "language": "python", "parameters": "(self, hql, parameters=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "try", ":", "return", "super", "(", ")", ".", "Func", "(", "arg_0", ".", "_strip_sql", "(", "arg_1", ")", ",", "arg_2", ")", "except", "DatabaseError", "as", "e", ":", "raise", "PrestoException", "(", "arg_0", ".", "_get_pretty_exception_message", "(", "e", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Get a set of records from Presto\n        \"\"\"\n        try:\n            return super().Func(\n                arg_0._strip_sql(arg_1), arg_2)\n        except DatabaseError as e:\n            raise PrestoException(arg_0._get_pretty_exception_message(e))", "path": "airflow/hooks/presto_hook.py", "identifier": "PrestoHook.get_records", "docstring": "Get a set of records from Presto", "docstring_tokens": ["Get", "a", "set", "of", "records", "from", "Presto"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253920}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kerncraft.py#L24-L52", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return list of evenly spaced integers over an interval.", "language": "python", "parameters": "(start, stop, num, endpoint=True, log=False, base=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ",", "arg_4", "=", "False", ",", "arg_5", "=", "10", ")", ":", "assert", "type", "(", "arg_0", ")", "is", "int", "and", "type", "(", "arg_1", ")", "is", "int", "and", "type", "(", "arg_2", ")", "is", "int", ",", "\"start, stop and num need to be intergers\"", "assert", "arg_2", ">=", "2", ",", "\"num has to be atleast 2\"", "if", "arg_4", ":", "arg_0", "=", "math", ".", "log", "(", "arg_0", ",", "arg_5", ")", "arg_1", "=", "math", ".", "log", "(", "arg_1", ",", "arg_5", ")", "if", "arg_3", ":", "arg_6", "=", "float", "(", "(", "arg_1", "-", "arg_0", ")", ")", "/", "float", "(", "arg_2", "-", "1", ")", "else", ":", "arg_6", "=", "float", "(", "(", "arg_1", "-", "arg_0", ")", ")", "/", "float", "(", "arg_2", ")", "arg_7", "=", "0", "while", "arg_7", "<", "arg_2", ":", "if", "arg_4", ":", "yield", "int", "(", "round", "(", "arg_5", "**", "(", "arg_0", "+", "arg_7", "*", "arg_6", ")", ")", ")", "else", ":", "yield", "int", "(", "round", "(", "arg_0", "+", "arg_7", "*", "arg_6", ")", ")", "arg_7", "+=", "1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True, arg_4=False, arg_5=10):\n    \"\"\"\n    Return list of evenly Funcd integers over an interval.\n\n    Numbers can either be evenly distributed in a linear Func (if *log* is False) or in a log\n    Func (if *log* is True). If *log* is True, base is used to define the log Func basis.\n\n    If *endpoint* is True, *stop* will be the last retruned value, as long as *num* >= 2.\n    \"\"\"\n    assert type(arg_0) is int and type(arg_1) is int and type(arg_2) is int, \\\n        \"start, stop and num need to be intergers\"\n    assert arg_2 >= 2, \"num has to be atleast 2\"\n\n    if arg_4:\n        arg_0 = math.log(arg_0, arg_5)\n        arg_1 = math.log(arg_1, arg_5)\n\n    if arg_3:\n        arg_6 = float((arg_1 - arg_0)) / float(arg_2 - 1)\n    else:\n        arg_6 = float((arg_1 - arg_0)) / float(arg_2)\n\n    arg_7 = 0\n    while arg_7 < arg_2:\n        if arg_4:\n            yield int(round(arg_5 ** (arg_0 + arg_7 * arg_6)))\n        else:\n            yield int(round(arg_0 + arg_7 * arg_6))\n        arg_7 += 1", "path": "kerncraft/kerncraft.py", "identifier": "space", "docstring": "Return list of evenly spaced integers over an interval.\n\n    Numbers can either be evenly distributed in a linear space (if *log* is False) or in a log\n    space (if *log* is True). If *log* is True, base is used to define the log space basis.\n\n    If *endpoint* is True, *stop* will be the last retruned value, as long as *num* >= 2.", "docstring_tokens": ["Return", "list", "of", "evenly", "spaced", "integers", "over", "an", "interval", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 253921}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/lib/_random.py#L90-L99", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Return a random int in the range [0,n).", "language": "python", "parameters": "(self, n)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_int_bit_length", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "getrandbits", "(", "arg_2", ")", "while", "arg_3", ">=", "arg_1", ":", "arg_3", "=", "arg_0", ".", "getrandbits", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a random int in the range [0,n).\"\"\"\n    # TODO\n    # change once int.bit_length is implemented.\n    # k = n.bit_length()\n    arg_2 = _int_bit_length(arg_1)\n    arg_3 = arg_0.getrandbits(arg_2)\n    while arg_3 >= arg_1:\n      arg_3 = arg_0.getrandbits(arg_2)\n    return arg_3", "path": "lib/_random.py", "identifier": "GrumpyRandom._randbelow", "docstring": "Return a random int in the range [0,n).", "docstring_tokens": ["Return", "a", "random", "int", "in", "the", "range", "[", "0", "n", ")", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 253922}
{"url": "https://github.com/linuxwhatelse/mapper/blob/3481715b2a36d2da8bf5e9c6da80ceaed0d7ca59/mapper.py#L108-L131", "sha": "3481715b2a36d2da8bf5e9c6da80ceaed0d7ca59", "docstring_summary": "Function for registering a path pattern.", "language": "python", "parameters": "(self, pattern, function, method=None, type_cast=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "not", "arg_4", ":", "arg_4", "=", "{", "}", "with", "arg_0", ".", "_lock", ":", "arg_0", ".", "_data_store", ".", "append", "(", "{", "'pattern'", ":", "arg_1", ",", "'function'", ":", "arg_2", ",", "'method'", ":", "arg_3", ",", "'type_cast'", ":", "arg_4", ",", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"Function for registering a path pattern.\n\n        Args:\n            pattern (str): Regex pattern to match a certain path.\n            function (function): Function to associate with this path.\n            method (str, optional): Usually used to define one of GET, POST,\n                PUT, DELETE. You may use whatever fits your situation though.\n                Defaults to None.\n            type_cast (dict, optional): Mapping between the param name and\n                one of `int`, `float` or `bool`. The value reflected by the\n                provided param name will than be casted to the given type.\n                Defaults to None.\n        \"\"\"\n        if not arg_4:\n            arg_4 = {}\n\n        with arg_0._lock:\n            arg_0._data_store.append({\n                'pattern': arg_1,\n                'function': arg_2,\n                'method': arg_3,\n                'type_cast': arg_4,\n            })", "path": "mapper.py", "identifier": "Mapper.add", "docstring": "Function for registering a path pattern.\n\n        Args:\n            pattern (str): Regex pattern to match a certain path.\n            function (function): Function to associate with this path.\n            method (str, optional): Usually used to define one of GET, POST,\n                PUT, DELETE. You may use whatever fits your situation though.\n                Defaults to None.\n            type_cast (dict, optional): Mapping between the param name and\n                one of `int`, `float` or `bool`. The value reflected by the\n                provided param name will than be casted to the given type.\n                Defaults to None.", "docstring_tokens": ["Function", "for", "registering", "a", "path", "pattern", "."], "nwo": "linuxwhatelse/mapper", "score": 0.0, "idx": 253923}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L487-L513", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Execute the workflow.", "language": "python", "parameters": "(self)", "return_statement": "return self.id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "generate_workflow_description", "(", ")", "if", "arg_0", ".", "batch_values", ":", "arg_0", ".", "id", "=", "arg_0", ".", "workflow", ".", "launch_batch_workflow", "(", "arg_0", ".", "definition", ")", "else", ":", "arg_0", ".", "id", "=", "arg_0", ".", "workflow", ".", "launch", "(", "arg_0", ".", "definition", ")", "return", "arg_0", ".", "id"], "function": "def Func(arg_0):\n        '''\n        Execute the workflow.\n\n        Args:\n            None\n\n        Returns:\n            Workflow_id\n        '''\n        # if not self.tasks:\n        #     raise WorkflowError('Workflow contains no tasks, and cannot be Funcd.')\n\n        # for task in self.tasks:\n        #     self.definition['tasks'].append( task.generate_task_workflow_json() )\n\n        arg_0.generate_workflow_description()\n\n        # hit batch workflow endpoint if batch values\n        if arg_0.batch_values:\n            arg_0.id = arg_0.workflow.launch_batch_workflow(arg_0.definition)\n\n        # use regular workflow endpoint if no batch values\n        else:\n            arg_0.id = arg_0.workflow.launch(arg_0.definition)\n\n        return arg_0.id", "path": "gbdxtools/simpleworkflows.py", "identifier": "Workflow.execute", "docstring": "Execute the workflow.\n\n        Args:\n            None\n\n        Returns:\n            Workflow_id", "docstring_tokens": ["Execute", "the", "workflow", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 253924}
{"url": "https://github.com/disqus/django-mailviews/blob/9993d5e911d545b3bc038433986c5f6812e7e965/mailviews/messages.py#L149-L162", "sha": "9993d5e911d545b3bc038433986c5f6812e7e965", "docstring_summary": "Renders the message subject for the given context.", "language": "python", "parameters": "(self, context)", "return_statement": "return rendered.strip()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "subject_template", ".", "render", "(", "unescape", "(", "arg_1", ")", ")", "return", "arg_2", ".", "strip", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Renders the message subject for the given context.\n\n        The context data is automatically unescaped to avoid rendering HTML\n        entities in ``text/plain`` content.\n\n        :param context: The context to use when rendering the subject template.\n        :type context: :class:`~django.template.Context`\n        :returns: A rendered subject.\n        :rtype: :class:`str`\n        \"\"\"\n        arg_2 = arg_0.subject_template.render(unescape(arg_1))\n        return arg_2.strip()", "path": "mailviews/messages.py", "identifier": "TemplatedEmailMessageView.render_subject", "docstring": "Renders the message subject for the given context.\n\n        The context data is automatically unescaped to avoid rendering HTML\n        entities in ``text/plain`` content.\n\n        :param context: The context to use when rendering the subject template.\n        :type context: :class:`~django.template.Context`\n        :returns: A rendered subject.\n        :rtype: :class:`str`", "docstring_tokens": ["Renders", "the", "message", "subject", "for", "the", "given", "context", "."], "nwo": "disqus/django-mailviews", "score": 0.31736401397382547, "idx": 253925}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L3051-L3125", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks for the correctness of various spacing around function calls.", "language": "python", "parameters": "(filename, clean_lines, linenum, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "elided", "[", "arg_2", "]", "arg_5", "=", "arg_4", "for", "arg_6", "in", "(", "r'\\bif\\s*\\((.*)\\)\\s*{'", ",", "r'\\bfor\\s*\\((.*)\\)\\s*{'", ",", "r'\\bwhile\\s*\\((.*)\\)\\s*[{;]'", ",", "r'\\bswitch\\s*\\((.*)\\)\\s*{'", ")", ":", "arg_7", "=", "Search", "(", "arg_6", ",", "arg_4", ")", "if", "arg_7", ":", "arg_5", "=", "arg_7", ".", "group", "(", "1", ")", "break", "if", "(", "not", "Search", "(", "r'\\b(if|for|while|switch|return|new|delete|catch|sizeof)\\b'", ",", "arg_5", ")", "and", "not", "Search", "(", "r' \\([^)]+\\)\\([^)]*(\\)|,$)'", ",", "arg_5", ")", "and", "not", "Search", "(", "r' \\([^)]+\\)\\[[^\\]]+\\]'", ",", "arg_5", ")", ")", ":", "if", "Search", "(", "r'\\w\\s*\\(\\s(?!\\s*\\\\$)'", ",", "arg_5", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/parens'", ",", "4", ",", "'Extra space after ( in function call'", ")", "elif", "Search", "(", "r'\\(\\s+(?!(\\s*\\\\)|\\()'", ",", "arg_5", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/parens'", ",", "2", ",", "'Extra space after ('", ")", "if", "(", "Search", "(", "r'\\w\\s+\\('", ",", "arg_5", ")", "and", "not", "Search", "(", "r'_{0,2}asm_{0,2}\\s+_{0,2}volatile_{0,2}\\s+\\('", ",", "arg_5", ")", "and", "not", "Search", "(", "r'#\\s*define|typedef|using\\s+\\w+\\s*='", ",", "arg_5", ")", "and", "not", "Search", "(", "r'\\w\\s+\\((\\w+::)*\\*\\w+\\)\\('", ",", "arg_5", ")", "and", "not", "Search", "(", "r'\\bcase\\s+\\('", ",", "arg_5", ")", ")", ":", "if", "Search", "(", "r'\\boperator_*\\b'", ",", "arg_4", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/parens'", ",", "0", ",", "'Extra space before ( in function call'", ")", "else", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/parens'", ",", "4", ",", "'Extra space before ( in function call'", ")", "if", "Search", "(", "r'[^)]\\s+\\)\\s*[^{\\s]'", ",", "arg_5", ")", ":", "if", "Search", "(", "r'^\\s+\\)'", ",", "arg_5", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/parens'", ",", "2", ",", "'Closing ) should be moved to the previous line'", ")", "else", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/parens'", ",", "2", ",", "'Extra space before )'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Checks for the correctness of various spacing around function calls.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.\n  \"\"\"\n  arg_4 = arg_1.elided[arg_2]\n\n  # Since function calls often occur inside if/for/while/switch\n  # expressions - which have their own, more liberal conventions - we\n  # first see if we should be looking inside such an expression for a\n  # function call, to which we can apply more strict standards.\n  arg_5 = arg_4    # if there's no control flow construct, look at whole line\n  for arg_6 in (r'\\bif\\s*\\((.*)\\)\\s*{',\n                  r'\\bfor\\s*\\((.*)\\)\\s*{',\n                  r'\\bwhile\\s*\\((.*)\\)\\s*[{;]',\n                  r'\\bswitch\\s*\\((.*)\\)\\s*{'):\n    arg_7 = Search(arg_6, arg_4)\n    if arg_7:\n      arg_5 = arg_7.group(1)    # look inside the parens for function calls\n      break\n\n  # Except in if/for/while/switch, there should never be space\n  # immediately inside parens (eg \"f( 3, 4 )\").  We make an exception\n  # for nested parens ( (a+b) + c ).  Likewise, there should never be\n  # a space before a ( when it's a function argument.  I assume it's a\n  # function argument when the char before the whitespace is legal in\n  # a function name (alnum + _) and we're not starting a macro. Also ignore\n  # pointers and references to arrays and functions coz they're too tricky:\n  # we use a very simple way to recognize these:\n  # \" (something)(maybe-something)\" or\n  # \" (something)(maybe-something,\" or\n  # \" (something)[something]\"\n  # Note that we assume the contents of [] to be short enough that\n  # they'll never need to wrap.\n  if (  # Ignore control structures.\n      not Search(r'\\b(if|for|while|switch|return|new|delete|catch|sizeof)\\b',\n                 arg_5) and\n      # Ignore pointers/references to functions.\n      not Search(r' \\([^)]+\\)\\([^)]*(\\)|,$)', arg_5) and\n      # Ignore pointers/references to arrays.\n      not Search(r' \\([^)]+\\)\\[[^\\]]+\\]', arg_5)):\n    if Search(r'\\w\\s*\\(\\s(?!\\s*\\\\$)', arg_5):      # a ( used for a fn call\n      arg_3(arg_0, arg_2, 'whitespace/parens', 4,\n            'Extra space after ( in function call')\n    elif Search(r'\\(\\s+(?!(\\s*\\\\)|\\()', arg_5):\n      arg_3(arg_0, arg_2, 'whitespace/parens', 2,\n            'Extra space after (')\n    if (Search(r'\\w\\s+\\(', arg_5) and\n        not Search(r'_{0,2}asm_{0,2}\\s+_{0,2}volatile_{0,2}\\s+\\(', arg_5) and\n        not Search(r'#\\s*define|typedef|using\\s+\\w+\\s*=', arg_5) and\n        not Search(r'\\w\\s+\\((\\w+::)*\\*\\w+\\)\\(', arg_5) and\n        not Search(r'\\bcase\\s+\\(', arg_5)):\n      # TODO(unknown): Space after an operator function seem to be a common\n      # error, silence those for now by restricting them to highest verbosity.\n      if Search(r'\\boperator_*\\b', arg_4):\n        arg_3(arg_0, arg_2, 'whitespace/parens', 0,\n              'Extra space before ( in function call')\n      else:\n        arg_3(arg_0, arg_2, 'whitespace/parens', 4,\n              'Extra space before ( in function call')\n    # If the ) is followed only by a newline or a { + newline, assume it's\n    # part of a control statement (if/while/etc), and don't complain\n    if Search(r'[^)]\\s+\\)\\s*[^{\\s]', arg_5):\n      # If the closing parenthesis is preceded by only whitespaces,\n      # try to give a more descriptive error message.\n      if Search(r'^\\s+\\)', arg_5):\n        arg_3(arg_0, arg_2, 'whitespace/parens', 2,\n              'Closing ) should be moved to the previous line')\n      else:\n        arg_3(arg_0, arg_2, 'whitespace/parens', 2,\n              'Extra space before )')", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckSpacingForFunctionCall", "docstring": "Checks for the correctness of various spacing around function calls.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.", "docstring_tokens": ["Checks", "for", "the", "correctness", "of", "various", "spacing", "around", "function", "calls", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253926}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/structural_time_series.py#L96-L109", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Runtime batch shape of models represented by this component.", "language": "python", "parameters": "(self)", "return_statement": "return batch_shape", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tf", ".", "constant", "(", "[", "]", ",", "dtype", "=", "tf", ".", "int32", ")", "for", "arg_2", "in", "arg_0", ".", "parameters", ":", "arg_1", "=", "tf", ".", "broadcast_dynamic_shape", "(", "arg_1", ",", "arg_2", ".", "prior", ".", "Func", "(", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Runtime batch shape of models represented by this component.\n\n    Returns:\n      batch_shape: `int` `Tensor` giving the broadcast batch shape of\n        all model parameters. This should match the batch shape of\n        derived state space models, i.e.,\n        `self.make_state_space_model(...).Func()`.\n    \"\"\"\n    arg_1 = tf.constant([], dtype=tf.int32)\n    for arg_2 in arg_0.parameters:\n      arg_1 = tf.broadcast_dynamic_shape(\n          arg_1, arg_2.prior.Func())\n    return arg_1", "path": "tensorflow_probability/python/sts/structural_time_series.py", "identifier": "StructuralTimeSeries.batch_shape_tensor", "docstring": "Runtime batch shape of models represented by this component.\n\n    Returns:\n      batch_shape: `int` `Tensor` giving the broadcast batch shape of\n        all model parameters. This should match the batch shape of\n        derived state space models, i.e.,\n        `self.make_state_space_model(...).batch_shape_tensor()`.", "docstring_tokens": ["Runtime", "batch", "shape", "of", "models", "represented", "by", "this", "component", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253927}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L745-L775", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Let SSL know where we can find trusted certificates for the certificate\n        chain.  Note that the certificates have to be in PEM format.", "language": "python", "parameters": "(self, cafile, capath=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "_ffi", ".", "NULL", "else", ":", "arg_1", "=", "_path_string", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "_ffi", ".", "NULL", "else", ":", "arg_2", "=", "_path_string", "(", "arg_2", ")", "arg_3", "=", "_lib", ".", "SSL_CTX_Func", "(", "arg_0", ".", "_context", ",", "arg_1", ",", "arg_2", ")", "if", "not", "arg_3", ":", "_raise_current_error", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Let SSL know where we can find trusted certificates for the certificate\n        chain.  Note that the certificates have to be in PEM format.\n\n        If capath is passed, it must be a directory prepared using the\n        ``c_rehash`` tool included with OpenSSL.  Either, but not both, of\n        *pemfile* or *capath* may be :data:`None`.\n\n        :param cafile: In which file we can find the certificates (``bytes`` or\n            ``unicode``).\n        :param capath: In which directory we can find the certificates\n            (``bytes`` or ``unicode``).\n\n        :return: None\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = _ffi.NULL\n        else:\n            arg_1 = _path_string(arg_1)\n\n        if arg_2 is None:\n            arg_2 = _ffi.NULL\n        else:\n            arg_2 = _path_string(arg_2)\n\n        arg_3 = _lib.SSL_CTX_Func(\n            arg_0._context, arg_1, arg_2\n        )\n        if not arg_3:\n            _raise_current_error()", "path": "src/OpenSSL/SSL.py", "identifier": "Context.load_verify_locations", "docstring": "Let SSL know where we can find trusted certificates for the certificate\n        chain.  Note that the certificates have to be in PEM format.\n\n        If capath is passed, it must be a directory prepared using the\n        ``c_rehash`` tool included with OpenSSL.  Either, but not both, of\n        *pemfile* or *capath* may be :data:`None`.\n\n        :param cafile: In which file we can find the certificates (``bytes`` or\n            ``unicode``).\n        :param capath: In which directory we can find the certificates\n            (``bytes`` or ``unicode``).\n\n        :return: None", "docstring_tokens": ["Let", "SSL", "know", "where", "we", "can", "find", "trusted", "certificates", "for", "the", "certificate", "chain", ".", "Note", "that", "the", "certificates", "have", "to", "be", "in", "PEM", "format", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 253928}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L650-L676", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Show a tip message", "language": "python", "parameters": "(wx_obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "\"Close the main window to exit & save.\\n\"", "\"Drag & Drop / Click the controls from the ToolBox to create new ones.\\n\"", "\"Left click on the created controls to select them.\\n\"", "\"Double click to edit the default property.\\n\"", "\"Right click to pop-up the context menu.\\n\"", ")", "arg_2", "=", "STT", ".", "SuperToolTip", "(", "arg_1", ")", "arg_2", ".", "SetHeader", "(", "\"Welcome to gui2py designer!\"", ")", "arg_2", ".", "SetDrawHeaderLine", "(", "True", ")", "arg_2", ".", "ApplyStyle", "(", "\"Office 2007 Blue\"", ")", "arg_2", ".", "SetDropShadow", "(", "True", ")", "arg_2", ".", "SetHeaderBitmap", "(", "images", ".", "designer", ".", "GetBitmap", "(", ")", ")", "arg_2", ".", "SetEndDelay", "(", "15000", ")", "arg_3", "=", "CustomToolTipWindow", "(", "arg_0", ",", "arg_2", ")", "arg_3", ".", "CalculateBestSize", "(", ")", "arg_3", ".", "CalculateBestPosition", "(", "arg_0", ")", "arg_3", ".", "DropShadow", "(", "arg_2", ".", "GetDropShadow", "(", ")", ")", "if", "arg_2", ".", "GetUseFade", "(", ")", ":", "arg_4", "=", "lambda", ":", "arg_3", ".", "StartAlpha", "(", "True", ")", "else", ":", "arg_4", "=", "lambda", ":", "arg_3", ".", "Show", "(", ")", "wx", ".", "CallLater", "(", "1000", ",", "arg_4", ")", "wx", ".", "CallLater", "(", "30000", ",", "arg_3", ".", "Destroy", ")"], "function": "def Func(arg_0):\n    \"Show a tip message\"\n    \n    arg_1 = (\"Close the main window to exit & save.\\n\"\n           \"Drag & Drop / Click the controls from the ToolBox to create new ones.\\n\"\n           \"Left click on the created controls to select them.\\n\"\n           \"Double click to edit the default property.\\n\"\n           \"Right click to pop-up the context menu.\\n\")\n    # create a super tool tip manager and set some styles\n    arg_2 = STT.SuperToolTip(arg_1)\n    arg_2.SetHeader(\"Welcome to gui2py designer!\")\n    arg_2.SetDrawHeaderLine(True)\n    arg_2.ApplyStyle(\"Office 2007 Blue\")\n    arg_2.SetDropShadow(True)\n    arg_2.SetHeaderBitmap(images.designer.GetBitmap())\n    arg_2.SetEndDelay(15000)                      # hide in 15 s\n    # create a independent tip window, show/hide manually (avoid binding wx_obj)\n    arg_3 = CustomToolTipWindow(arg_0, arg_2)\n    arg_3.CalculateBestSize()\n    arg_3.CalculateBestPosition(arg_0)\n    arg_3.DropShadow(arg_2.GetDropShadow())\n    if arg_2.GetUseFade():\n        arg_4 = lambda: arg_3.StartAlpha(True)\n    else:\n        arg_4 = lambda: arg_3.Show()\n    wx.CallLater(1000, arg_4)           # show the tip in 1 s\n    wx.CallLater(30000, arg_3.Destroy)", "path": "gui/tools/designer.py", "identifier": "wellcome_tip", "docstring": "Show a tip message", "docstring_tokens": ["Show", "a", "tip", "message"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 253929}
{"url": "https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/percolate.py#L931-L965", "sha": "92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac", "docstring_summary": "Generate a square lattice with auxiliary nodes for spanning detection", "language": "python", "parameters": "(length)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "nx", ".", "grid_2d_graph", "(", "arg_0", "+", "2", ",", "arg_0", ")", "for", "arg_2", "in", "range", "(", "arg_0", ")", ":", "arg_1", ".", "node", "[", "(", "0", ",", "arg_2", ")", "]", "[", "'span'", "]", "=", "0", "arg_1", "[", "(", "0", ",", "arg_2", ")", "]", "[", "(", "1", ",", "arg_2", ")", "]", "[", "'span'", "]", "=", "0", "arg_1", ".", "node", "[", "(", "arg_0", "+", "1", ",", "arg_2", ")", "]", "[", "'span'", "]", "=", "1", "arg_1", "[", "(", "arg_0", "+", "1", ",", "arg_2", ")", "]", "[", "(", "arg_0", ",", "arg_2", ")", "]", "[", "'span'", "]", "=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Generate a square lattice with auxiliary nodes for spanning detection\n\n    Parameters\n    ----------\n\n    length : int\n       Number of nodes in one dimension, excluding the auxiliary nodes.\n\n    Returns\n    -------\n\n    networkx.Graph\n       A square lattice graph with auxiliary nodes for spanning cluster\n       detection\n\n    See Also\n    --------\n\n    sample_states : spanning cluster detection\n\n    \"\"\"\n    arg_1 = nx.grid_2d_graph(arg_0 + 2, arg_0)\n\n    for arg_2 in range(arg_0):\n        # side 0\n        arg_1.node[(0, arg_2)]['span'] = 0\n        arg_1[(0, arg_2)][(1, arg_2)]['span'] = 0\n\n        # side 1\n        arg_1.node[(arg_0 + 1, arg_2)]['span'] = 1\n        arg_1[(arg_0 + 1, arg_2)][(arg_0, arg_2)]['span'] = 1\n\n    return arg_1", "path": "percolate/percolate.py", "identifier": "spanning_2d_grid", "docstring": "Generate a square lattice with auxiliary nodes for spanning detection\n\n    Parameters\n    ----------\n\n    length : int\n       Number of nodes in one dimension, excluding the auxiliary nodes.\n\n    Returns\n    -------\n\n    networkx.Graph\n       A square lattice graph with auxiliary nodes for spanning cluster\n       detection\n\n    See Also\n    --------\n\n    sample_states : spanning cluster detection", "docstring_tokens": ["Generate", "a", "square", "lattice", "with", "auxiliary", "nodes", "for", "spanning", "detection"], "nwo": "andsor/pypercolate", "score": 0.27946077266739355, "idx": 253930}
{"url": "https://github.com/rochapps/django-secure-input/blob/6da714475613870f2891b2ccf3317f55b3e81107/secure_input/widgets.py#L11-L15", "sha": "6da714475613870f2891b2ccf3317f55b3e81107", "docstring_summary": "Include a hidden input to stored the serialized upload value.", "language": "python", "parameters": "(self, name, value, attrs=None)", "return_statement": "return render_to_string(self.template_name, context)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_3", "or", "{", "}", "arg_4", ".", "update", "(", "{", "'name'", ":", "arg_1", ",", "'value'", ":", "arg_2", ",", "}", ")", "return", "Func_to_string", "(", "arg_0", ".", "template_name", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Include a hidden input to stored the serialized upload value.\"\"\"\n        arg_4 = arg_3 or {}\n        arg_4.update({'name': arg_1, 'value': arg_2, })\n        return Func_to_string(arg_0.template_name, arg_4)", "path": "secure_input/widgets.py", "identifier": "WYSIWYGWidget.render", "docstring": "Include a hidden input to stored the serialized upload value.", "docstring_tokens": ["Include", "a", "hidden", "input", "to", "stored", "the", "serialized", "upload", "value", "."], "nwo": "rochapps/django-secure-input", "score": 0.14991498758945482, "idx": 253931}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/networks.py#L154-L176", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Update values of a network.", "language": "python", "parameters": "(context, id, network)", "return_statement": "return v._make_network_dict(net)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "LOG", ".", "info", "(", "\"Func %s for tenant %s\"", "%", "(", "arg_1", ",", "arg_0", ".", "tenant_id", ")", ")", "with", "arg_0", ".", "session", ".", "begin", "(", ")", ":", "arg_3", "=", "db_api", ".", "network_find", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "scope", "=", "db_api", ".", "ONE", ")", "if", "not", "arg_3", ":", "raise", "n_exc", ".", "NetworkNotFound", "(", "net_id", "=", "arg_1", ")", "arg_4", "=", "arg_2", "[", "\"network\"", "]", "utils", ".", "pop_param", "(", "arg_4", ",", "\"network_plugin\"", ")", "if", "not", "arg_0", ".", "is_admin", "and", "\"ipam_strategy\"", "in", "arg_4", ":", "utils", ".", "pop_param", "(", "arg_4", ",", "\"ipam_strategy\"", ")", "arg_3", "=", "db_api", ".", "network_update", "(", "arg_0", ",", "arg_3", ",", "**", "arg_4", ")", "return", "v", ".", "_make_network_dict", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Update values of a network.\n\n    : param context: neutron api request context\n    : param id: UUID representing the network to update.\n    : param network: dictionary with keys indicating fields to update.\n        valid keys are those that have a value of True for 'allow_put'\n        as listed in the RESOURCE_ATTRIBUTE_MAP object in\n        neutron/api/v2/attributes.py.\n    \"\"\"\n    LOG.info(\"Func %s for tenant %s\" %\n             (arg_1, arg_0.tenant_id))\n    with arg_0.session.begin():\n        arg_3 = db_api.network_find(arg_0, arg_1=arg_1, scope=db_api.ONE)\n        if not arg_3:\n            raise n_exc.NetworkNotFound(net_id=arg_1)\n        arg_4 = arg_2[\"network\"]\n        utils.pop_param(arg_4, \"network_plugin\")\n        if not arg_0.is_admin and \"ipam_strategy\" in arg_4:\n            utils.pop_param(arg_4, \"ipam_strategy\")\n        arg_3 = db_api.network_update(arg_0, arg_3, **arg_4)\n\n    return v._make_network_dict(arg_3)", "path": "quark/plugin_modules/networks.py", "identifier": "update_network", "docstring": "Update values of a network.\n\n    : param context: neutron api request context\n    : param id: UUID representing the network to update.\n    : param network: dictionary with keys indicating fields to update.\n        valid keys are those that have a value of True for 'allow_put'\n        as listed in the RESOURCE_ATTRIBUTE_MAP object in\n        neutron/api/v2/attributes.py.", "docstring_tokens": ["Update", "values", "of", "a", "network", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 253932}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L834-L856", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get results of the provided hql in target schema.", "language": "python", "parameters": "(self, hql, schema='default', fetch_size=None, hive_conf=None)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'default'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "next", "(", "arg_5", ")", "arg_7", "=", "{", "'data'", ":", "list", "(", "arg_5", ")", ",", "'header'", ":", "arg_6", "}", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2='default', arg_3=None, arg_4=None):\n        \"\"\"\n        Get results of the provided hql in target schema.\n\n        :param hql: hql to be executed.\n        :type hql: str or list\n        :param schema: target schema, default to 'default'.\n        :type schema: str\n        :param fetch_size: max size of result to fetch.\n        :type fetch_size: int\n        :param hive_conf: hive_conf to execute alone with the hql.\n        :type hive_conf: dict\n        :return: results of hql execution, dict with data (list of results) and header\n        :rtype: dict\n        \"\"\"\n        arg_5 = arg_0._Func(arg_1, arg_2,\n                                         arg_3=arg_3, arg_4=arg_4)\n        arg_6 = next(arg_5)\n        arg_7 = {\n            'data': list(arg_5),\n            'header': arg_6\n        }\n        return arg_7", "path": "airflow/hooks/hive_hooks.py", "identifier": "HiveServer2Hook.get_results", "docstring": "Get results of the provided hql in target schema.\n\n        :param hql: hql to be executed.\n        :type hql: str or list\n        :param schema: target schema, default to 'default'.\n        :type schema: str\n        :param fetch_size: max size of result to fetch.\n        :type fetch_size: int\n        :param hive_conf: hive_conf to execute alone with the hql.\n        :type hive_conf: dict\n        :return: results of hql execution, dict with data (list of results) and header\n        :rtype: dict", "docstring_tokens": ["Get", "results", "of", "the", "provided", "hql", "in", "target", "schema", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253933}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/meta.py#L135-L157", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Attach a method to a parsing class and register it as a parser hook.", "language": "python", "parameters": "(cls, hookname=None, erase=False)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'_Funcs'", ")", ":", "raise", "TypeError", "(", "\"%s didn't seems to be a BasicParser subsclasse\"", "%", "arg_0", ".", "__name__", ")", "arg_3", "=", "arg_0", ".", "_Funcs", "arg_4", "=", "arg_0", ".", "_rules", "def", "wrapper", "(", "arg_5", ")", ":", "nonlocal", "arg_1", "add_method", "(", "arg_0", ")", "(", "arg_5", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_5", ".", "__name__", "if", "not", "arg_2", "and", "(", "arg_1", "in", "arg_3", "or", "arg_1", "in", "arg_4", ")", ":", "raise", "TypeError", "(", "\"%s is already define has rule or Func\"", "%", "arg_1", ")", "if", "'.'", "not", "in", "arg_1", ":", "arg_1", "=", "'.'", ".", "join", "(", "[", "arg_0", ".", "__module__", ",", "arg_0", ".", "__name__", ",", "arg_1", "]", ")", "set_one", "(", "arg_3", ",", "arg_1", ",", "arg_5", ")", "return", "arg_5", "return", "wrapper"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n    \"\"\"Attach a method to a parsing class and register it as a parser Func.\n\n       The method is registered with its name unless Funcname is provided.\n    \"\"\"\n    if not hasattr(arg_0, '_Funcs'):\n        raise TypeError(\n            \"%s didn't seems to be a BasicParser subsclasse\" % arg_0.__name__)\n    arg_3 = arg_0._Funcs\n    arg_4 = arg_0._rules\n\n    def wrapper(arg_5):\n        nonlocal arg_1\n        add_method(arg_0)(arg_5)\n        if arg_1 is None:\n            arg_1 = arg_5.__name__\n        if not arg_2 and (arg_1 in arg_3 or arg_1 in arg_4):\n            raise TypeError(\"%s is already define has rule or Func\" % arg_1)\n        if '.' not in arg_1:\n            arg_1 = '.'.join([arg_0.__module__, arg_0.__name__, arg_1])\n        set_one(arg_3, arg_1, arg_5)\n        return arg_5\n    return wrapper", "path": "pyrser/meta.py", "identifier": "hook", "docstring": "Attach a method to a parsing class and register it as a parser hook.\n\n       The method is registered with its name unless hookname is provided.", "docstring_tokens": ["Attach", "a", "method", "to", "a", "parsing", "class", "and", "register", "it", "as", "a", "parser", "hook", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 253934}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/campfire.py#L90-L103", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Get a room by name.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_rooms", "(", ")", "for", "arg_3", "in", "arg_2", "or", "[", "]", ":", "if", "arg_3", "[", "\"name\"", "]", "==", "arg_1", ":", "return", "arg_0", ".", "get_room", "(", "arg_3", "[", "\"id\"", "]", ")", "raise", "RoomNotFoundException", "(", "\"Room %s not found\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Get a room by name.\n\n        Returns:\n            :class:`Room`. Room\n\n        Raises:\n            RoomNotFoundException\n        \"\"\"\n        arg_2 = arg_0.get_rooms()\n        for arg_3 in arg_2 or []:\n            if arg_3[\"name\"] == arg_1:\n                return arg_0.get_room(arg_3[\"id\"])\n        raise RoomNotFoundException(\"Room %s not found\" % arg_1)", "path": "pyfire/campfire.py", "identifier": "Campfire.get_room_by_name", "docstring": "Get a room by name.\n\n        Returns:\n            :class:`Room`. Room\n\n        Raises:\n            RoomNotFoundException", "docstring_tokens": ["Get", "a", "room", "by", "name", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 253935}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L565-L569", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Return text cast to the correct type or the selected type", "language": "python", "parameters": "(self,ascode=None)", "return_statement": "return self.cast[ascode](self.text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "code", "return", "arg_0", ".", "cast", "[", "arg_1", "]", "(", "arg_0", ".", "text", ")"], "function": "def Func(arg_0,arg_1=None):\n        \"\"\"Return text cast to the correct type or the selected type\"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.code\n        return arg_0.cast[arg_1](arg_0.text)", "path": "gridData/OpenDX.py", "identifier": "Token.value", "docstring": "Return text cast to the correct type or the selected type", "docstring_tokens": ["Return", "text", "cast", "to", "the", "correct", "type", "or", "the", "selected", "type"], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 253936}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/session.py#L583-L603", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Save a snapshot of the page.", "language": "python", "parameters": "(self, path=None)", "return_statement": "return path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "_prepare_path", "(", "arg_1", ",", "\"html\"", ")", "with", "open", "(", "arg_1", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "encode_string", "(", "arg_0", ".", "body", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Save a snapshot of the page.\n\n        If invoked without arguments, it will save a file to :data:`capybara.save_path` and the\n        file will be given a randomly generated filename. If invoked with a relative path, the path\n        will be relative to :data:`capybara.save_path`.\n\n        Args:\n            path (str, optional): The path to where it should be saved.\n\n        Returns:\n            str: The path to which the file was saved.\n        \"\"\"\n\n        arg_1 = _prepare_path(arg_1, \"html\")\n\n        with open(arg_1, \"wb\") as f:\n            f.write(encode_string(arg_0.body))\n\n        return arg_1", "path": "capybara/session.py", "identifier": "Session.save_page", "docstring": "Save a snapshot of the page.\n\n        If invoked without arguments, it will save a file to :data:`capybara.save_path` and the\n        file will be given a randomly generated filename. If invoked with a relative path, the path\n        will be relative to :data:`capybara.save_path`.\n\n        Args:\n            path (str, optional): The path to where it should be saved.\n\n        Returns:\n            str: The path to which the file was saved.", "docstring_tokens": ["Save", "a", "snapshot", "of", "the", "page", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 253937}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L767-L782", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Replaces instances of pattern in a string with a replacement.", "language": "python", "parameters": "(pattern, rep, s)", "return_statement": "return _regexp_compile_cache[pattern].sub(rep, s)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", "not", "in", "arg_3", ":", "arg_3", "[", "arg_0", "]", "=", "sre_compile", ".", "compile", "(", "arg_0", ")", "return", "arg_3", "[", "arg_0", "]", ".", "sub", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Replaces instances of pattern in a string with a replacement.\n\n  The compiled regex is kept in a cache shared by Match and Search.\n\n  Args:\n    pattern: regex pattern\n    rep: replacement text\n    s: search string\n\n  Returns:\n    string with replacements made (or original string if no replacements)\n  \"\"\"\n  if arg_0 not in arg_3:\n    arg_3[arg_0] = sre_compile.compile(arg_0)\n  return arg_3[arg_0].sub(arg_1, arg_2)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "ReplaceAll", "docstring": "Replaces instances of pattern in a string with a replacement.\n\n  The compiled regex is kept in a cache shared by Match and Search.\n\n  Args:\n    pattern: regex pattern\n    rep: replacement text\n    s: search string\n\n  Returns:\n    string with replacements made (or original string if no replacements)", "docstring_tokens": ["Replaces", "instances", "of", "pattern", "in", "a", "string", "with", "a", "replacement", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253938}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/label.py#L29-L37", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get all the items for this label. Returns a list of dictionaries.\n        Each dictionary has the values for an item.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return self.fetch_json(\n            uri_path=self.base_uri + '/checkItems',\n            query_params=query_params or {}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", "+", "'/checkItems'", ",", "arg_1", "=", "arg_1", "or", "{", "}", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''\n        Get all the items for this label. Returns a list of dictionaries.\n        Each dictionary has the values for an item.\n        '''\n        return arg_0.fetch_json(\n            uri_path=arg_0.base_uri + '/checkItems',\n            arg_1=arg_1 or {}\n        )", "path": "trolly/label.py", "identifier": "Label.get_items", "docstring": "Get all the items for this label. Returns a list of dictionaries.\n        Each dictionary has the values for an item.", "docstring_tokens": ["Get", "all", "the", "items", "for", "this", "label", ".", "Returns", "a", "list", "of", "dictionaries", ".", "Each", "dictionary", "has", "the", "values", "for", "an", "item", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 253939}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L360-L391", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Converts size string into megabytes", "language": "python", "parameters": "(s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "upper", "(", ")", ".", "endswith", "(", "\"KB\"", ")", ":", "return", "float", "(", "arg_0", ".", "rstrip", "(", "\"KB\"", ")", ")", "/", "1024", "elif", "arg_0", ".", "upper", "(", ")", ".", "endswith", "(", "\" B\"", ")", ":", "return", "float", "(", "arg_0", ".", "rstrip", "(", "\"B\"", ")", ")", "/", "1024", "/", "1024", "elif", "arg_0", ".", "upper", "(", ")", ".", "endswith", "(", "\"MB\"", ")", ":", "return", "float", "(", "arg_0", ".", "rstrip", "(", "\"MB\"", ")", ")", "elif", "arg_0", ".", "upper", "(", ")", ".", "endswith", "(", "\"GB\"", ")", ":", "return", "float", "(", "arg_0", ".", "rstrip", "(", "\"GB\"", ")", ")", "*", "1024", "elif", "arg_0", ".", "upper", "(", ")", ".", "endswith", "(", "\"TB\"", ")", ":", "return", "float", "(", "arg_0", ".", "rstrip", "(", "\"TB\"", ")", ")", "*", "1024", "*", "1024", "else", ":", "return", "float", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"Converts size string into megabytes\n\n        Parameters\n        ----------\n        s : str\n            The size string can be '30KB', '20MB' or '1GB'\n\n        Returns\n        -------\n        float\n            With the size in bytes\n\n        \"\"\"\n\n        if arg_0.upper().endswith(\"KB\"):\n            return float(arg_0.rstrip(\"KB\")) / 1024\n\n        elif arg_0.upper().endswith(\" B\"):\n            return float(arg_0.rstrip(\"B\")) / 1024 / 1024\n\n        elif arg_0.upper().endswith(\"MB\"):\n            return float(arg_0.rstrip(\"MB\"))\n\n        elif arg_0.upper().endswith(\"GB\"):\n            return float(arg_0.rstrip(\"GB\")) * 1024\n\n        elif arg_0.upper().endswith(\"TB\"):\n            return float(arg_0.rstrip(\"TB\")) * 1024 * 1024\n\n        else:\n            return float(arg_0)", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector._size_coverter", "docstring": "Converts size string into megabytes\n\n        Parameters\n        ----------\n        s : str\n            The size string can be '30KB', '20MB' or '1GB'\n\n        Returns\n        -------\n        float\n            With the size in bytes", "docstring_tokens": ["Converts", "size", "string", "into", "megabytes"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 253940}
{"url": "https://github.com/hsharrison/pyglet2d/blob/46f610b3c76221bff19e5c0cf3d35d7875ce37a0/src/pyglet2d.py#L186-L190", "sha": "46f610b3c76221bff19e5c0cf3d35d7875ce37a0", "docstring_summary": "Keyword arguments for recreating the Shape from the vertices.", "language": "python", "parameters": "(self)", "return_statement": "return dict(color=self.color, velocity=self.velocity, colors=self.colors)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "dict", "(", "color", "=", "arg_0", ".", "color", ",", "velocity", "=", "arg_0", ".", "velocity", ",", "colors", "=", "arg_0", ".", "colors", ")"], "function": "def Func(arg_0):\n        \"\"\"Keyword arguments for recreating the Shape from the vertices.\n\n        \"\"\"\n        return dict(color=arg_0.color, velocity=arg_0.velocity, colors=arg_0.colors)", "path": "src/pyglet2d.py", "identifier": "Shape._kwargs", "docstring": "Keyword arguments for recreating the Shape from the vertices.", "docstring_tokens": ["Keyword", "arguments", "for", "recreating", "the", "Shape", "from", "the", "vertices", "."], "nwo": "hsharrison/pyglet2d", "score": 0.2823188883832642, "idx": 253941}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/parser.py#L1911-L1929", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Resolve a Basilisp symbol as a Var or Python name.", "language": "python", "parameters": "(\n    ctx: ParserContext, form: sym.Symbol\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ".", "Symbol", ")", "->", "Union", "[", "MaybeClass", ",", "MaybeHostForm", ",", "VarRef", "]", ":", "if", "arg_2", ".", "ns", "is", "None", "and", "arg_2", ".", "name", ".", "endswith", "(", "\".\"", ")", ":", "try", ":", "arg_5", ",", "arg_6", "=", "arg_2", ".", "name", "[", ":", "-", "1", "]", ".", "rsplit", "(", "\".\"", ",", "maxsplit", "=", "1", ")", "arg_2", "=", "arg_3", ".", "symbol", "(", "arg_6", ",", "arg_5", "=", "arg_5", ")", "except", "ValueError", ":", "arg_2", "=", "arg_3", ".", "symbol", "(", "arg_2", ".", "name", "[", ":", "-", "1", "]", ")", "if", "arg_2", ".", "ns", "is", "not", "None", ":", "return", "__resolve_namespaced_symbol", "(", "arg_0", ",", "arg_2", ")", "else", ":", "return", "__resolve_bare_symbol", "(", "arg_0", ",", "arg_2", ")"], "function": "def Func(\n    arg_0: arg_1, arg_2: arg_3.Symbol\n) -> Union[MaybeClass, MaybeHostForm, VarRef]:\n    \"\"\"Resolve a Basilisp symbol as a Var or Python name.\"\"\"\n    # Support special class-name syntax to instantiate new classes\n    #   (Classname. *args)\n    #   (aliased.Classname. *args)\n    #   (fully.qualified.Classname. *args)\n    if arg_2.ns is None and arg_2.name.endswith(\".\"):\n        try:\n            arg_5, arg_6 = arg_2.name[:-1].rsplit(\".\", maxsplit=1)\n            arg_2 = arg_3.symbol(arg_6, arg_5=arg_5)\n        except ValueError:\n            arg_2 = arg_3.symbol(arg_2.name[:-1])\n\n    if arg_2.ns is not None:\n        return __resolve_namespaced_symbol(arg_0, arg_2)\n    else:\n        return __resolve_bare_symbol(arg_0, arg_2)", "path": "src/basilisp/lang/compiler/parser.py", "identifier": "_resolve_sym", "docstring": "Resolve a Basilisp symbol as a Var or Python name.", "docstring_tokens": ["Resolve", "a", "Basilisp", "symbol", "as", "a", "Var", "or", "Python", "name", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 253942}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/jid.py#L65-L90", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Check if `address` is valid IP address and return it, in a normalized\n    form.", "language": "python", "parameters": "(family, address)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "socket", ".", "getaddrinfo", "(", "arg_1", ",", "0", ",", "arg_0", ",", "socket", ".", "SOCK_STREAM", ",", "0", ",", "socket", ".", "AI_NUMERICHOST", ")", "except", "socket", ".", "gaierror", ",", "err", ":", "logger", ".", "debug", "(", "\"gaierror: {0} for {1!r}\"", ".", "format", "(", "err", ",", "arg_1", ")", ")", "raise", "ValueError", "(", "\"Bad IP address\"", ")", "if", "not", "arg_2", ":", "logger", ".", "debug", "(", "\"getaddrinfo result empty\"", ")", "raise", "ValueError", "(", "\"Bad IP address\"", ")", "arg_3", "=", "arg_2", "[", "0", "]", "[", "4", "]", "logger", ".", "debug", "(", "\" got address: {0!r}\"", ".", "format", "(", "arg_3", ")", ")", "try", ":", "return", "socket", ".", "getnameinfo", "(", "arg_3", ",", "socket", ".", "NI_NUMERICHOST", ")", "[", "0", "]", "except", "socket", ".", "gaierror", ",", "err", ":", "logger", ".", "debug", "(", "\"gaierror: {0} for {1!r}\"", ".", "format", "(", "err", ",", "arg_3", ")", ")", "raise", "ValueError", "(", "\"Bad IP address\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Check if `address` is valid IP address and return it, in a normalized\n    form.\n\n    :Parameters:\n        - `family`: ``socket.AF_INET`` or ``socket.AF_INET6``\n        - `address`: the IP address to validate\n    \"\"\"\n    try:\n        arg_2 = socket.getaddrinfo(arg_1, 0, arg_0, socket.SOCK_STREAM, 0,\n                                                        socket.AI_NUMERICHOST)\n    except socket.gaierror, err:\n        logger.debug(\"gaierror: {0} for {1!r}\".format(err, arg_1))\n        raise ValueError(\"Bad IP address\")\n\n    if not arg_2:\n        logger.debug(\"getaddrinfo result empty\")\n        raise ValueError(\"Bad IP address\")\n    arg_3 = arg_2[0][4]\n    logger.debug(\" got address: {0!r}\".format(arg_3))\n\n    try:\n        return socket.getnameinfo(arg_3, socket.NI_NUMERICHOST)[0]\n    except socket.gaierror, err:\n        logger.debug(\"gaierror: {0} for {1!r}\".format(err, arg_3))\n        raise ValueError(\"Bad IP address\")", "path": "pyxmpp2/jid.py", "identifier": "_validate_ip_address", "docstring": "Check if `address` is valid IP address and return it, in a normalized\n    form.\n\n    :Parameters:\n        - `family`: ``socket.AF_INET`` or ``socket.AF_INET6``\n        - `address`: the IP address to validate", "docstring_tokens": ["Check", "if", "address", "is", "valid", "IP", "address", "and", "return", "it", "in", "a", "normalized", "form", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 253943}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/util.py#L375-L388", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Format a 3d vector field in certain ways, see `coords` for a description\n        of each formatting method.", "language": "python", "parameters": "(self, vecs, form='broadcast')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'broadcast'", ")", ":", "if", "arg_2", "==", "'meshed'", ":", "return", "np", ".", "meshgrid", "(", "*", "arg_1", ",", "indexing", "=", "'ij'", ")", "elif", "arg_2", "==", "'vector'", ":", "arg_1", "=", "np", ".", "meshgrid", "(", "*", "arg_1", ",", "indexing", "=", "'ij'", ")", "return", "np", ".", "rollaxis", "(", "np", ".", "array", "(", "np", ".", "broadcast_arrays", "(", "*", "arg_1", ")", ")", ",", "0", ",", "arg_0", ".", "dim", "+", "1", ")", "elif", "arg_2", "==", "'flat'", ":", "return", "arg_1", "else", ":", "return", "[", "arg_4", "[", "arg_0", ".", "_coord_slicers", "[", "arg_3", "]", "]", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2='broadcast'):\n        \"\"\"\n        Format a 3d vector field in certain ways, see `coords` for a description\n        of each formatting method.\n        \"\"\"\n        if arg_2 == 'meshed':\n            return np.meshgrid(*arg_1, indexing='ij')\n        elif arg_2 == 'vector':\n            arg_1 = np.meshgrid(*arg_1, indexing='ij')\n            return np.rollaxis(np.array(np.broadcast_arrays(*arg_1)),0,arg_0.dim+1)\n        elif arg_2 == 'flat':\n            return arg_1\n        else:\n            return [arg_4[arg_0._coord_slicers[arg_3]] for arg_3,arg_4 in enumerate(arg_1)]", "path": "peri/util.py", "identifier": "Tile._format_vector", "docstring": "Format a 3d vector field in certain ways, see `coords` for a description\n        of each formatting method.", "docstring_tokens": ["Format", "a", "3d", "vector", "field", "in", "certain", "ways", "see", "coords", "for", "a", "description", "of", "each", "formatting", "method", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 253944}
{"url": "https://github.com/Terrance/SkPy/blob/0f9489c94e8ec4d3effab4314497428872a80ad1/skpy/conn.py#L646-L661", "sha": "0f9489c94e8ec4d3effab4314497428872a80ad1", "docstring_summary": "Take an existing Skype token and refresh it, to extend the expiry time without other credentials.", "language": "python", "parameters": "(self, token)", "return_statement": "return self.getToken(t)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "sendToken", "(", "arg_1", ")", "return", "arg_0", ".", "getToken", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Take an existing Skype token and refresh it, to extend the expiry time without other credentials.\n\n        Args:\n            token (str): existing Skype token\n\n        Returns:\n            (str, datetime.datetime) tuple: Skype token, and associated expiry if known\n\n        Raises:\n            .SkypeAuthException: if the login request is rejected\n            .SkypeApiException: if the login form can't be processed\n        \"\"\"\n        arg_2 = arg_0.sendToken(arg_1)\n        return arg_0.getToken(arg_2)", "path": "skpy/conn.py", "identifier": "SkypeRefreshAuthProvider.auth", "docstring": "Take an existing Skype token and refresh it, to extend the expiry time without other credentials.\n\n        Args:\n            token (str): existing Skype token\n\n        Returns:\n            (str, datetime.datetime) tuple: Skype token, and associated expiry if known\n\n        Raises:\n            .SkypeAuthException: if the login request is rejected\n            .SkypeApiException: if the login form can't be processed", "docstring_tokens": ["Take", "an", "existing", "Skype", "token", "and", "refresh", "it", "to", "extend", "the", "expiry", "time", "without", "other", "credentials", "."], "nwo": "Terrance/SkPy", "score": 0.6983298124827472, "idx": 253945}
{"url": "https://github.com/eyeseast/python-frontmatter/blob/c318e583c48599eb597e0ad59c5d972258c3febc/frontmatter/default_handlers.py#L238-L242", "sha": "c318e583c48599eb597e0ad59c5d972258c3febc", "docstring_summary": "Turn metadata into JSON", "language": "python", "parameters": "(self, metadata, **kwargs)", "return_statement": "return u(metadata)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", ".", "setdefault", "(", "'indent'", ",", "4", ")", "arg_1", "=", "json", ".", "dumps", "(", "arg_1", ",", "**", "arg_2", ")", "return", "u", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"Turn metadata into JSON\"\n        arg_2.setdefault('indent', 4)\n        arg_1 = json.dumps(arg_1, **arg_2)\n        return u(arg_1)", "path": "frontmatter/default_handlers.py", "identifier": "JSONHandler.export", "docstring": "Turn metadata into JSON", "docstring_tokens": ["Turn", "metadata", "into", "JSON"], "nwo": "eyeseast/python-frontmatter", "score": 0.6952232418087978, "idx": 253946}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v2/__init__.py#L43-L77", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Parse a notebook filename.", "language": "python", "parameters": "(fname)", "return_statement": "return fname, name, format", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "endswith", "(", "u'.ipynb'", ")", ":", "arg_1", "=", "u'json'", "elif", "arg_0", ".", "endswith", "(", "u'.json'", ")", ":", "arg_1", "=", "u'json'", "elif", "arg_0", ".", "endswith", "(", "u'.py'", ")", ":", "arg_1", "=", "u'py'", "else", ":", "arg_0", "=", "arg_0", "+", "u'.ipynb'", "arg_1", "=", "u'json'", "arg_2", "=", "arg_0", ".", "split", "(", "'.'", ")", "[", "0", "]", "return", "arg_0", ",", "arg_2", ",", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse a notebook filename.\n\n    This function takes a notebook filename and returns the notebook\n    format (json/py) and the notebook name. This logic can be\n    summarized as follows:\n\n    * notebook.ipynb -> (notebook.ipynb, notebook, json)\n    * notebook.json  -> (notebook.json, notebook, json)\n    * notebook.py    -> (notebook.py, notebook, py)\n    * notebook       -> (notebook.ipynb, notebook, json)\n\n    Parameters\n    ----------\n    fname : unicode\n        The notebook filename. The filename can use a specific filename\n        extention (.ipynb, .json, .py) or none, in which case .ipynb will\n        be assumed.\n\n    Returns\n    -------\n    (fname, name, format) : (unicode, unicode, unicode)\n        The filename, notebook name and format.\n    \"\"\"\n    if arg_0.endswith(u'.ipynb'):\n        arg_1 = u'json'\n    elif arg_0.endswith(u'.json'):\n        arg_1 = u'json'\n    elif arg_0.endswith(u'.py'):\n        arg_1 = u'py'\n    else:\n        arg_0 = arg_0 + u'.ipynb'\n        arg_1 = u'json'\n    arg_2 = arg_0.split('.')[0]\n    return arg_0, arg_2, arg_1", "path": "environment/lib/python2.7/site-packages/IPython/nbformat/v2/__init__.py", "identifier": "parse_filename", "docstring": "Parse a notebook filename.\n\n    This function takes a notebook filename and returns the notebook\n    format (json/py) and the notebook name. This logic can be\n    summarized as follows:\n\n    * notebook.ipynb -> (notebook.ipynb, notebook, json)\n    * notebook.json  -> (notebook.json, notebook, json)\n    * notebook.py    -> (notebook.py, notebook, py)\n    * notebook       -> (notebook.ipynb, notebook, json)\n\n    Parameters\n    ----------\n    fname : unicode\n        The notebook filename. The filename can use a specific filename\n        extention (.ipynb, .json, .py) or none, in which case .ipynb will\n        be assumed.\n\n    Returns\n    -------\n    (fname, name, format) : (unicode, unicode, unicode)\n        The filename, notebook name and format.", "docstring_tokens": ["Parse", "a", "notebook", "filename", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253947}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L439-L441", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Add a link from A to B of given distance, in one direction only.", "language": "python", "parameters": "(self, A, B, distance)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "dict", ".", "setdefault", "(", "arg_1", ",", "{", "}", ")", "[", "arg_2", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"Add a link from A to B of given distance, in one direction only.\"\n        arg_0.dict.setdefault(arg_1,{})[arg_2] = arg_3", "path": "aima/search.py", "identifier": "Graph.connect1", "docstring": "Add a link from A to B of given distance, in one direction only.", "docstring_tokens": ["Add", "a", "link", "from", "A", "to", "B", "of", "given", "distance", "in", "one", "direction", "only", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 253948}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/discovery.py#L236-L259", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return the course and course run metadata for the given course run ID.", "language": "python", "parameters": "(self, course_run_id)", "return_statement": "return course, course_run", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "parse_course_key", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "get_course_details", "(", "arg_2", ")", "arg_4", "=", "None", "if", "arg_3", ":", "arg_4", "=", "None", "arg_5", "=", "[", "arg_4", "for", "arg_4", "in", "arg_3", "[", "'course_runs'", "]", "if", "arg_4", "[", "'key'", "]", "==", "arg_1", "]", "if", "arg_5", ":", "arg_4", "=", "arg_5", "[", "0", "]", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return the course and course run metadata for the given course run ID.\n\n        Arguments:\n            course_run_id (str): The course run ID.\n\n        Returns:\n            tuple: The course metadata and the course run metadata.\n        \"\"\"\n        # Parse the course ID from the course run ID.\n        arg_2 = parse_course_key(arg_1)\n        # Retrieve the course metadata from the catalog service.\n        arg_3 = arg_0.get_course_details(arg_2)\n\n        arg_4 = None\n        if arg_3:\n            # Find the specified course run.\n            arg_4 = None\n            arg_5 = [arg_4 for arg_4 in arg_3['course_runs'] if arg_4['key'] == arg_1]\n            if arg_5:\n                arg_4 = arg_5[0]\n\n        return arg_3, arg_4", "path": "enterprise/api_client/discovery.py", "identifier": "CourseCatalogApiClient.get_course_and_course_run", "docstring": "Return the course and course run metadata for the given course run ID.\n\n        Arguments:\n            course_run_id (str): The course run ID.\n\n        Returns:\n            tuple: The course metadata and the course run metadata.", "docstring_tokens": ["Return", "the", "course", "and", "course", "run", "metadata", "for", "the", "given", "course", "run", "ID", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 253949}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/util.py#L14-L33", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "Attempt to set the virtualenv activate command, if it hasn't been specified.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "arg_0", "=", "options", ".", "virtualenv", ".", "activate_cmd", "except", "AttributeError", ":", "arg_0", "=", "None", "if", "arg_0", "is", "None", ":", "arg_1", "=", "path", "(", "os", ".", "environ", ".", "get", "(", "'VIRTUAL_ENV'", ",", "''", ")", ")", "if", "not", "arg_1", ":", "arg_1", "=", "options", ".", "paved", ".", "cwd", "else", ":", "arg_1", "=", "path", "(", "arg_1", ")", "arg_0", "=", "arg_1", "/", "'bin'", "/", "'activate'", "if", "arg_0", ".", "exists", "(", ")", ":", "info", "(", "'Using default virtualenv at %s'", "%", "arg_0", ")", "options", ".", "setdotted", "(", "'virtualenv.activate_cmd'", ",", "'source %s'", "%", "arg_0", ")"], "function": "def Func():\n    \"\"\"Attempt to set the virtualenv activate command, if it hasn't been specified.\n    \"\"\"\n    try:\n        arg_0 = options.virtualenv.activate_cmd\n    except AttributeError:\n        arg_0 = None\n\n    if arg_0 is None:\n        arg_1 = path(os.environ.get('VIRTUAL_ENV', ''))\n        if not arg_1:\n            arg_1 = options.paved.cwd\n        else:\n            arg_1 = path(arg_1)\n\n        arg_0 = arg_1 / 'bin' / 'activate'\n\n        if arg_0.exists():\n            info('Using default virtualenv at %s' % arg_0)\n            options.setdotted('virtualenv.activate_cmd', 'source %s' % arg_0)", "path": "paved/util.py", "identifier": "_setVirtualEnv", "docstring": "Attempt to set the virtualenv activate command, if it hasn't been specified.", "docstring_tokens": ["Attempt", "to", "set", "the", "virtualenv", "activate", "command", "if", "it", "hasn", "t", "been", "specified", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 253950}
{"url": "https://github.com/ellmetha/neojsonrpc/blob/e369b633a727482d5f9e310f0c3337ae5f7265db/neojsonrpc/utils.py#L23-L32", "sha": "e369b633a727482d5f9e310f0c3337ae5f7265db", "docstring_summary": "Returns True if the considered string is a valid RIPEMD160 hash.", "language": "python", "parameters": "(s)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", "or", "not", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "False", "if", "not", "len", "(", "arg_0", ")", "==", "40", ":", "return", "False", "for", "arg_1", "in", "arg_0", ":", "if", "(", "arg_1", "<", "'0'", "or", "arg_1", ">", "'9'", ")", "and", "(", "arg_1", "<", "'A'", "or", "arg_1", ">", "'F'", ")", "and", "(", "arg_1", "<", "'a'", "or", "arg_1", ">", "'f'", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0):\n    \"\"\" Returns True if the considered string is a valid RIPEMD160 hash. \"\"\"\n    if not arg_0 or not isinstance(arg_0, str):\n        return False\n    if not len(arg_0) == 40:\n        return False\n    for arg_1 in arg_0:\n        if (arg_1 < '0' or arg_1 > '9') and (arg_1 < 'A' or arg_1 > 'F') and (arg_1 < 'a' or arg_1 > 'f'):\n            return False\n    return True", "path": "neojsonrpc/utils.py", "identifier": "is_hash160", "docstring": "Returns True if the considered string is a valid RIPEMD160 hash.", "docstring_tokens": ["Returns", "True", "if", "the", "considered", "string", "is", "a", "valid", "RIPEMD160", "hash", "."], "nwo": "ellmetha/neojsonrpc", "score": 0.3393344119717767, "idx": 253951}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L856-L868", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Removes a single node from the tree.", "language": "python", "parameters": "(self, instance, recursive=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_1", ".", "v_full_name", "arg_4", "=", "deque", "(", "arg_3", ".", "split", "(", "'.'", ")", ")", "arg_0", ".", "_remove_along_branch", "(", "arg_0", ".", "_root_instance", ",", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Removes a single node from the tree.\n\n        Only from RAM not from hdf5 file!\n\n        :param instance: The node to be deleted\n\n        :param recursive: If group nodes with children should be deleted\n\n        \"\"\"\n        arg_3 = arg_1.v_full_name\n        arg_4 = deque(arg_3.split('.'))\n        arg_0._remove_along_branch(arg_0._root_instance, arg_4, arg_2)", "path": "pypet/naturalnaming.py", "identifier": "NaturalNamingInterface._remove_node_or_leaf", "docstring": "Removes a single node from the tree.\n\n        Only from RAM not from hdf5 file!\n\n        :param instance: The node to be deleted\n\n        :param recursive: If group nodes with children should be deleted", "docstring_tokens": ["Removes", "a", "single", "node", "from", "the", "tree", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253952}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/pulse_lib/discrete.py#L94-L110", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Generates triangle wave `SamplePulse`.", "language": "python", "parameters": "(duration: int, amp: complex, period: float = None,\n             phase: float = 0, name: str = None)", "return_statement": "return _sampled_triangle_pulse(duration, amp, period, phase=phase, name=name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "=", "None", ",", "arg_6", ":", "arg_5", "=", "0", ",", "arg_7", ":", "arg_8", "=", "None", ")", "->", "SamplePulse", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", "return", "_sampled_Func_pulse", "(", "arg_0", ",", "arg_2", ",", "arg_4", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = None,\n             arg_6: arg_5 = 0, arg_7: arg_8 = None) -> SamplePulse:\n    \"\"\"Generates Func wave `SamplePulse`.\n\n    Applies `left` sampling strategy to generate discrete pulse from continuous function.\n\n    Args:\n        duration: Duration of pulse. Must be greater than zero.\n        amp: Pulse amplitude. Wave range is [-amp, amp].\n        period: Pulse period, units of dt. If `None` defaults to single cycle.\n        phase: Pulse phase.\n        name: Name of pulse.\n    \"\"\"\n    if arg_4 is None:\n        arg_4 = arg_0\n\n    return _sampled_Func_pulse(arg_0, arg_2, arg_4, arg_6=arg_6, arg_7=arg_7)", "path": "qiskit/pulse/pulse_lib/discrete.py", "identifier": "triangle", "docstring": "Generates triangle wave `SamplePulse`.\n\n    Applies `left` sampling strategy to generate discrete pulse from continuous function.\n\n    Args:\n        duration: Duration of pulse. Must be greater than zero.\n        amp: Pulse amplitude. Wave range is [-amp, amp].\n        period: Pulse period, units of dt. If `None` defaults to single cycle.\n        phase: Pulse phase.\n        name: Name of pulse.", "docstring_tokens": ["Generates", "triangle", "wave", "SamplePulse", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253953}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/summarizeIntermittens.py#L69-L92", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "This function will look at the local directory and pick out files that have the correct start name and\n    summarize the results into one giant dict.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "g_summary_dict_all", "arg_0", "=", "[", "x", "for", "x", "in", "listdir", "(", "g_test_root_dir", ")", "if", "isfile", "(", "join", "(", "g_test_root_dir", ",", "x", ")", ")", "]", "for", "arg_1", "in", "arg_0", ":", "for", "arg_2", "in", "g_file_start", ":", "if", "(", "arg_2", "in", "arg_1", ")", "and", "(", "os", ".", "path", ".", "getsize", "(", "arg_1", ")", ">", "10", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "g_test_root_dir", ",", "arg_1", ")", "try", ":", "arg_4", "=", "json", ".", "load", "(", "open", "(", "arg_3", ",", "'r'", ")", ")", "for", "arg_5", "in", "range", "(", "len", "(", "arg_4", "[", "\"TestName\"", "]", ")", ")", ":", "addFailedTests", "(", "g_summary_dict_all", ",", "arg_4", ",", "arg_5", ")", "except", ":", "continue", "break"], "function": "def Func():\n    \"\"\"\n    This function will look at the local directory and pick out files that have the correct start name and\n    summarize the results into one giant dict.\n\n    :return: None\n    \"\"\"\n    global g_summary_dict_all\n\n    arg_0 = [x for x in listdir(g_test_root_dir) if isfile(join(g_test_root_dir, x))]   # grab files\n\n    for arg_1 in arg_0:\n        for arg_2 in g_file_start:\n            if (arg_2 in arg_1) and (os.path.getsize(arg_1) > 10):  # found the file containing failed tests\n                arg_3 = os.path.join(g_test_root_dir, arg_1)\n                try:\n                    arg_4 = json.load(open(arg_3,'r'))\n\n                    # scrape through temp_dict and see if we need to add the test to intermittents\n                    for arg_5 in range(len(arg_4[\"TestName\"])):\n                        addFailedTests(g_summary_dict_all, arg_4, arg_5)\n                except:\n                    continue\n                break", "path": "scripts/summarizeIntermittens.py", "identifier": "summarizeFailedRuns", "docstring": "This function will look at the local directory and pick out files that have the correct start name and\n    summarize the results into one giant dict.\n\n    :return: None", "docstring_tokens": ["This", "function", "will", "look", "at", "the", "local", "directory", "and", "pick", "out", "files", "that", "have", "the", "correct", "start", "name", "and", "summarize", "the", "results", "into", "one", "giant", "dict", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 253954}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1722-L1725", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Sort the fields inside the record by indicators.", "language": "python", "parameters": "(record)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", ":", "arg_0", "[", "arg_1", "]", "=", "_fields_sort_by_indicators", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Sort the fields inside the record by indicators.\"\"\"\n    for arg_1, arg_2 in arg_0.items():\n        arg_0[arg_1] = _fields_sort_by_indicators(arg_2)", "path": "harvestingkit/bibrecord.py", "identifier": "_record_sort_by_indicators", "docstring": "Sort the fields inside the record by indicators.", "docstring_tokens": ["Sort", "the", "fields", "inside", "the", "record", "by", "indicators", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 253955}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L230-L255", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the last n lines from the history database.", "language": "python", "parameters": "(self, n=10, raw=True, output=False, include_latest=False)", "return_statement": "return reversed(list(cur))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "arg_0", ".", "writeout_cache", "(", ")", "if", "not", "arg_4", ":", "arg_1", "+=", "1", "arg_5", "=", "arg_0", ".", "_run_sql", "(", "\"ORDER BY session DESC, line DESC LIMIT ?\"", ",", "(", "arg_1", ",", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "not", "arg_4", ":", "return", "reversed", "(", "list", "(", "arg_5", ")", "[", "1", ":", "]", ")", "return", "reversed", "(", "list", "(", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1=10, arg_2=True, arg_3=False, arg_4=False):\n        \"\"\"Get the last n lines from the history database.\n\n        Parameters\n        ----------\n        n : int\n          The number of lines to get\n        raw, output : bool\n          See :meth:`get_range`\n        include_latest : bool\n          If False (default), n+1 lines are fetched, and the latest one\n          is discarded. This is intended to be used where the function\n          is called by a user command, which it should not return.\n\n        Returns\n        -------\n        Tuples as :meth:`get_range`\n        \"\"\"\n        arg_0.writeout_cache()\n        if not arg_4:\n            arg_1 += 1\n        arg_5 = arg_0._run_sql(\"ORDER BY session DESC, line DESC LIMIT ?\",\n                                (arg_1,), arg_2=arg_2, arg_3=arg_3)\n        if not arg_4:\n            return reversed(list(arg_5)[1:])\n        return reversed(list(arg_5))", "path": "environment/lib/python2.7/site-packages/IPython/core/history.py", "identifier": "HistoryAccessor.get_tail", "docstring": "Get the last n lines from the history database.\n\n        Parameters\n        ----------\n        n : int\n          The number of lines to get\n        raw, output : bool\n          See :meth:`get_range`\n        include_latest : bool\n          If False (default), n+1 lines are fetched, and the latest one\n          is discarded. This is intended to be used where the function\n          is called by a user command, which it should not return.\n\n        Returns\n        -------\n        Tuples as :meth:`get_range`", "docstring_tokens": ["Get", "the", "last", "n", "lines", "from", "the", "history", "database", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253956}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L739-L754", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns true if the specified error category is suppressed on this line.", "language": "python", "parameters": "(category, linenum)", "return_statement": "return (_global_error_suppressions.get(category, False) or\n          linenum in _error_suppressions.get(category, set()) or\n          linenum in _error_suppressions.get(None, set()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "_global_error_suppressions", ".", "get", "(", "arg_0", ",", "False", ")", "or", "arg_1", "in", "_error_suppressions", ".", "get", "(", "arg_0", ",", "set", "(", ")", ")", "or", "arg_1", "in", "_error_suppressions", ".", "get", "(", "None", ",", "set", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Returns true if the specified error category is suppressed on this line.\n\n  Consults the global error_suppressions map populated by\n  ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.\n\n  Args:\n    category: str, the category of the error.\n    linenum: int, the current line number.\n  Returns:\n    bool, True iff the error should be suppressed due to a NOLINT comment or\n    global suppression.\n  \"\"\"\n  return (_global_error_suppressions.get(arg_0, False) or\n          arg_1 in _error_suppressions.get(arg_0, set()) or\n          arg_1 in _error_suppressions.get(None, set()))", "path": "third_party/python/cpplint/cpplint.py", "identifier": "IsErrorSuppressedByNolint", "docstring": "Returns true if the specified error category is suppressed on this line.\n\n  Consults the global error_suppressions map populated by\n  ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.\n\n  Args:\n    category: str, the category of the error.\n    linenum: int, the current line number.\n  Returns:\n    bool, True iff the error should be suppressed due to a NOLINT comment or\n    global suppression.", "docstring_tokens": ["Returns", "true", "if", "the", "specified", "error", "category", "is", "suppressed", "on", "this", "line", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 253957}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L580-L613", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Draw this line segment as a binary image mask.", "language": "python", "parameters": "(self, image_shape, size_lines=1, size_points=0,\n                  raise_if_out_of_image=False)", "return_statement": "return heatmap > 0.5", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "0", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", ".", "draw_heatmap_array", "(", "arg_1", ",", "alpha_lines", "=", "1.0", ",", "alpha_points", "=", "1.0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "antialiased", "=", "False", ",", "arg_4", "=", "arg_4", ")", "return", "arg_5", ">", "0.5"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=0,\n                  arg_4=False):\n        \"\"\"\n        Draw this line segment as a binary image mask.\n\n        Parameters\n        ----------\n        image_shape : tuple of int\n            The shape of the image onto which to draw the line mask.\n\n        size_lines : int, optional\n            Thickness of the line segments.\n\n        size_points : int, optional\n            Size of the points in pixels.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if the line string is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        ndarray\n            Boolean line mask of shape `image_shape` (no channel axis).\n\n        \"\"\"\n        arg_5 = arg_0.draw_heatmap_array(\n            arg_1,\n            alpha_lines=1.0, alpha_points=1.0,\n            arg_2=arg_2, arg_3=arg_3,\n            antialiased=False,\n            arg_4=arg_4)\n        return arg_5 > 0.5", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.draw_mask", "docstring": "Draw this line segment as a binary image mask.\n\n        Parameters\n        ----------\n        image_shape : tuple of int\n            The shape of the image onto which to draw the line mask.\n\n        size_lines : int, optional\n            Thickness of the line segments.\n\n        size_points : int, optional\n            Size of the points in pixels.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if the line string is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        ndarray\n            Boolean line mask of shape `image_shape` (no channel axis).", "docstring_tokens": ["Draw", "this", "line", "segment", "as", "a", "binary", "image", "mask", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 253958}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/__init__.py#L411-L414", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "Full URL to the dataset contents.", "language": "python", "parameters": "(self)", "return_statement": "return loc.base_uri + loc.location + loc.access_credential", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "download_location", "return", "arg_1", ".", "base_uri", "+", "arg_1", ".", "location", "+", "arg_1", ".", "access_credential"], "function": "def Func(arg_0):\n        \"\"\"Full URL to the dataset contents.\"\"\"\n        arg_1 = arg_0.download_location\n        return arg_1.base_uri + arg_1.location + arg_1.access_credential", "path": "azureml/__init__.py", "identifier": "SourceDataset.contents_url", "docstring": "Full URL to the dataset contents.", "docstring_tokens": ["Full", "URL", "to", "the", "dataset", "contents", "."], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 253959}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L1504-L1530", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Filter the annotation array down to only those Annotation\n        objects matching the query.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "AnnotationArray", "(", ")", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "Func", "(", "**", "arg_1", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        '''Filter the annotation array down to only those Annotation\n        objects matching the query.\n\n\n        Parameters\n        ----------\n        kwargs : Func parameters\n            See JObject.Func\n\n        Returns\n        -------\n        results : AnnotationArray\n            An annotation array of the objects matching the query\n\n        See Also\n        --------\n        JObject.Func\n        '''\n\n        arg_2 = AnnotationArray()\n\n        for arg_3 in arg_0:\n            if arg_3.Func(**arg_1):\n                arg_2.append(arg_3)\n\n        return arg_2", "path": "jams/core.py", "identifier": "AnnotationArray.search", "docstring": "Filter the annotation array down to only those Annotation\n        objects matching the query.\n\n\n        Parameters\n        ----------\n        kwargs : search parameters\n            See JObject.search\n\n        Returns\n        -------\n        results : AnnotationArray\n            An annotation array of the objects matching the query\n\n        See Also\n        --------\n        JObject.search", "docstring_tokens": ["Filter", "the", "annotation", "array", "down", "to", "only", "those", "Annotation", "objects", "matching", "the", "query", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253960}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/bloch.py#L331-L342", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Add a list of vectors to Bloch sphere.", "language": "python", "parameters": "(self, vectors)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", "[", "0", "]", ",", "(", "list", ",", "np", ".", "ndarray", ")", ")", ":", "for", "arg_2", "in", "arg_1", ":", "arg_0", ".", "vectors", ".", "append", "(", "arg_2", ")", "else", ":", "arg_0", ".", "vectors", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add a list of vectors to Bloch sphere.\n\n        Args:\n            vectors (array_like):\n                Array with vectors of unit length or smaller.\n        \"\"\"\n        if isinstance(arg_1[0], (list, np.ndarray)):\n            for arg_2 in arg_1:\n                arg_0.vectors.append(arg_2)\n        else:\n            arg_0.vectors.append(arg_1)", "path": "qiskit/visualization/bloch.py", "identifier": "Bloch.add_vectors", "docstring": "Add a list of vectors to Bloch sphere.\n\n        Args:\n            vectors (array_like):\n                Array with vectors of unit length or smaller.", "docstring_tokens": ["Add", "a", "list", "of", "vectors", "to", "Bloch", "sphere", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253961}
{"url": "https://github.com/jdfreder/jupyter-pip/blob/9f04c6096f1169b08aeaf6221616a5fb48111044/jupyterpip/__init__.py#L12-L113", "sha": "9f04c6096f1169b08aeaf6221616a5fb48111044", "docstring_summary": "Build nbextension cmdclass dict for the setuptools.setup method.", "language": "python", "parameters": "(path, enable=None, user=None)", "return_statement": "return {\n        'install': InstallCommand,\n        'develop': DevelopCommand,\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "import", "warnings", "from", "setuptools", ".", "command", ".", "install", "import", "install", "from", "setuptools", ".", "command", ".", "develop", "import", "arg_6", "from", "os", ".", "path", "import", "dirname", ",", "join", ",", "exists", ",", "realpath", "from", "traceback", "import", "extract_stack", "try", ":", "from", "notebook", ".", "nbextensions", "import", "install_nbextension", "from", "notebook", ".", "services", ".", "config", "import", "ConfigManager", "except", "ImportError", ":", "try", ":", "from", "IPython", ".", "html", ".", "nbextensions", "import", "install_nbextension", "from", "IPython", ".", "html", ".", "services", ".", "config", "import", "ConfigManager", "except", "ImportError", ":", "warnings", ".", "warn", "(", "\"No jupyter notebook found in your environment. \"", "\"Hence jupyter nbextensions were not installed. \"", "\"If you would like to have them,\"", "\"please issue 'pip install jupyter'.\"", ")", "return", "{", "}", "if", "arg_2", "is", "None", ":", "arg_2", "=", "not", "_is_root", "(", ")", "arg_3", "=", "extract_stack", "(", ")", "[", "-", "2", "]", "[", "0", "]", "arg_4", "=", "realpath", "(", "arg_3", ")", "if", "not", "exists", "(", "arg_4", ")", ":", "raise", "Exception", "(", "'Could not find path of setup file.'", ")", "arg_5", "=", "join", "(", "dirname", "(", "arg_4", ")", ",", "arg_0", ")", "def", "run_nbextension_install", "(", "arg_6", ")", ":", "import", "sys", "arg_7", "=", "hasattr", "(", "sys", ",", "'real_prefix'", ")", "if", "arg_7", ":", "install_nbextension", "(", "arg_5", ",", "symlink", "=", "arg_6", ",", "sys_prefix", "=", "arg_7", ")", "else", ":", "install_nbextension", "(", "arg_5", ",", "symlink", "=", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_1", "is", "not", "None", ":", "print", "(", "\"Enabling the extension ...\"", ")", "arg_8", "=", "ConfigManager", "(", ")", "arg_8", ".", "update", "(", "'notebook'", ",", "{", "\"load_extensions\"", ":", "{", "arg_1", ":", "True", "}", "}", ")", "class", "InstallCommand", "(", "install", ")", ":", "def", "run", "(", "arg_9", ")", ":", "print", "(", "\"Installing Python module...\"", ")", "install", ".", "run", "(", "arg_9", ")", "print", "(", "\"Installing nbextension ...\"", ")", "run_nbextension_install", "(", "False", ")", "class", "DevelopCommand", "(", "arg_6", ")", ":", "def", "run", "(", "arg_9", ")", ":", "print", "(", "\"Installing Python module...\"", ")", "arg_6", ".", "run", "(", "arg_9", ")", "print", "(", "\"Installing nbextension ...\"", ")", "run_nbextension_install", "(", "True", ")", "return", "{", "'install'", ":", "InstallCommand", ",", "'develop'", ":", "DevelopCommand", ",", "}"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Build nbextension Func dict for the setuptools.setup method.\n\n    Parameters\n    ----------\n    path: str\n        Directory relative to the setup file that the nbextension code\n        lives in.\n    enable: [str=None]\n        Extension to \"enable\".  Enabling an extension causes it to be loaded\n        automatically by the IPython notebook.\n    user: [bool=None]\n        Whether or not the nbextension should be installed in user mode.\n        If this is undefined, the script will install as user mode IF the\n        installer is not sudo.\n\n    Usage\n    -----\n    For automatic loading:\n    # Assuming `./extension` is the relative path to the JS files and\n    # `./extension/main.js` is the file that you want automatically loaded.\n    setup(\n        name='extension',\n        ...\n        Func=Func('extension', 'extension/main'),\n    )\n\n    For manual loading:\n    # Assuming `./extension` is the relative path to the JS files.\n    setup(\n        name='extension',\n        ...\n        Func=Func('extension'),\n    )\n    \"\"\"\n    import warnings\n    from setuptools.command.install import install\n    from setuptools.command.develop import arg_6\n    from os.path import dirname, join, exists, realpath\n    from traceback import extract_stack\n\n    try:\n        # IPython/Jupyter 4.0\n        from notebook.nbextensions import install_nbextension\n        from notebook.services.config import ConfigManager\n    except ImportError:\n        # Pre-schism\n        try:\n            from IPython.html.nbextensions import install_nbextension\n            from IPython.html.services.config import ConfigManager\n        except ImportError:\n            warnings.warn(\"No jupyter notebook found in your environment. \"\n                          \"Hence jupyter nbextensions were not installed. \"\n                          \"If you would like to have them,\"\n                          \"please issue 'pip install jupyter'.\")\n            return {}\n\n    # Check if the user flag was set.\n    if arg_2 is None:\n        arg_2 = not _is_root()\n\n    # Get the path of the extension\n    arg_3 = extract_stack()[-2][0]\n    arg_4 = realpath(arg_3)\n    if not exists(arg_4):\n        raise Exception('Could not find path of setup file.')\n    arg_5 = join(dirname(arg_4), arg_0)\n\n    # Installs the nbextension\n    def run_nbextension_install(arg_6):\n        import sys\n        arg_7 = hasattr(sys, 'real_prefix')\n        if arg_7:\n            install_nbextension(\n                arg_5, symlink=arg_6, sys_prefix=arg_7)\n        else:\n            install_nbextension(arg_5, symlink=arg_6, arg_2=arg_2)\n        if arg_1 is not None:\n            print(\"Enabling the extension ...\")\n            arg_8 = ConfigManager()\n            arg_8.update('notebook', {\"load_extensions\": {arg_1: True}})\n\n    # Command used for standard installs\n    class InstallCommand(install):\n        def run(arg_9):\n            print(\"Installing Python module...\")\n            install.run(arg_9)\n            print(\"Installing nbextension ...\")\n            run_nbextension_install(False)\n\n    # Command used for development installs (symlinks the JS)\n    class DevelopCommand(arg_6):\n        def run(arg_9):\n            print(\"Installing Python module...\")\n            arg_6.run(arg_9)\n            print(\"Installing nbextension ...\")\n            run_nbextension_install(True)\n\n    return {\n        'install': InstallCommand,\n        'develop': DevelopCommand,\n    }", "path": "jupyterpip/__init__.py", "identifier": "cmdclass", "docstring": "Build nbextension cmdclass dict for the setuptools.setup method.\n\n    Parameters\n    ----------\n    path: str\n        Directory relative to the setup file that the nbextension code\n        lives in.\n    enable: [str=None]\n        Extension to \"enable\".  Enabling an extension causes it to be loaded\n        automatically by the IPython notebook.\n    user: [bool=None]\n        Whether or not the nbextension should be installed in user mode.\n        If this is undefined, the script will install as user mode IF the\n        installer is not sudo.\n\n    Usage\n    -----\n    For automatic loading:\n    # Assuming `./extension` is the relative path to the JS files and\n    # `./extension/main.js` is the file that you want automatically loaded.\n    setup(\n        name='extension',\n        ...\n        cmdclass=cmdclass('extension', 'extension/main'),\n    )\n\n    For manual loading:\n    # Assuming `./extension` is the relative path to the JS files.\n    setup(\n        name='extension',\n        ...\n        cmdclass=cmdclass('extension'),\n    )", "docstring_tokens": ["Build", "nbextension", "cmdclass", "dict", "for", "the", "setuptools", ".", "setup", "method", "."], "nwo": "jdfreder/jupyter-pip", "score": 0.2797951884712986, "idx": 253962}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L605-L619", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Initialize attributes that are not saved with the checkpoint.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_firstComputeCall", "=", "True", "arg_0", ".", "_accuracy", "=", "None", "arg_0", ".", "_protoScores", "=", "None", "arg_0", ".", "_categoryDistances", "=", "None", "arg_0", ".", "_knn", "=", "knn_classifier", ".", "KNNClassifier", "(", "**", "arg_0", ".", "knnParams", ")", "for", "arg_6", "in", "(", "'_partitions'", ",", "'_useAuxiliary'", ",", "'_doSphering'", ",", "'_scanInfo'", ",", "'_protoScores'", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "arg_6", ")", ":", "setattr", "(", "arg_0", ",", "arg_6", ",", "None", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Initialize attributes that are not saved with the checkpoint.\n    \"\"\"\n    arg_0._firstComputeCall = True\n    arg_0._accuracy = None\n    arg_0._protoScores = None\n    arg_0._categoryDistances = None\n\n    arg_0._knn = knn_classifier.KNNClassifier(**arg_0.knnParams)\n\n    for arg_6 in ('_partitions', '_useAuxiliary', '_doSphering',\n              '_scanInfo', '_protoScores'):\n      if not hasattr(arg_0, arg_6):\n        setattr(arg_0, arg_6, None)", "path": "src/nupic/regions/knn_classifier_region.py", "identifier": "KNNClassifierRegion._initEphemerals", "docstring": "Initialize attributes that are not saved with the checkpoint.", "docstring_tokens": ["Initialize", "attributes", "that", "are", "not", "saved", "with", "the", "checkpoint", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 253963}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/task.py#L571-L582", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Cancels the item if it was not yet completed, and removes\n        any children that are LIKELY.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_is_finished", "(", ")", ":", "for", "arg_1", "in", "arg_0", ".", "children", ":", "arg_1", ".", "Func", "(", ")", "return", "arg_0", ".", "_set_state", "(", "arg_0", ".", "CANCELLED", ")", "arg_0", ".", "_drop_children", "(", ")", "arg_0", ".", "task_spec", ".", "_on_Func", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Cancels the item if it was not yet completed, and removes\n        any children that are LIKELY.\n        \"\"\"\n        if arg_0._is_finished():\n            for arg_1 in arg_0.children:\n                arg_1.Func()\n            return\n        arg_0._set_state(arg_0.CANCELLED)\n        arg_0._drop_children()\n        arg_0.task_spec._on_Func(arg_0)", "path": "SpiffWorkflow/task.py", "identifier": "Task.cancel", "docstring": "Cancels the item if it was not yet completed, and removes\n        any children that are LIKELY.", "docstring_tokens": ["Cancels", "the", "item", "if", "it", "was", "not", "yet", "completed", "and", "removes", "any", "children", "that", "are", "LIKELY", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 253964}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L228-L260", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Read the current ADS-state and the machine-state.", "language": "python", "parameters": "(port, address)", "return_statement": "return (ads_state.value, device_state.value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_adsDLL", ".", "AdsSyncReadStateReqEx", "arg_3", "=", "ctypes", ".", "pointer", "(", "arg_1", ".", "amsAddrStruct", "(", ")", ")", "arg_4", "=", "ctypes", ".", "c_int", "(", ")", "arg_5", "=", "ctypes", ".", "pointer", "(", "arg_4", ")", "arg_6", "=", "ctypes", ".", "c_int", "(", ")", "arg_7", "=", "ctypes", ".", "pointer", "(", "arg_6", ")", "arg_8", "=", "arg_2", "(", "arg_0", ",", "arg_3", ",", "arg_5", ",", "arg_7", ")", "if", "arg_8", ":", "raise", "ADSError", "(", "arg_8", ")", "return", "(", "arg_4", ".", "value", ",", "arg_6", ".", "value", ")"], "function": "def Func(arg_0, arg_1):\n    # type: (int, AmsAddr) -> Tuple[int, int]\n    \"\"\"Read the current ADS-state and the machine-state.\n\n    Read the current ADS-state and the machine-state from the\n    ADS-server.\n\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :rtype: (int, int)\n    :return: ads_state, device_state\n\n    \"\"\"\n    arg_2 = _adsDLL.AdsSyncReadStateReqEx\n\n    # C pointer to ams address struct\n    arg_3 = ctypes.pointer(arg_1.amsAddrStruct())\n\n    # Current ADS status and corresponding pointer\n    arg_4 = ctypes.c_int()\n    arg_5 = ctypes.pointer(arg_4)\n\n    # Current device status and corresponding pointer\n    arg_6 = ctypes.c_int()\n    arg_7 = ctypes.pointer(arg_6)\n\n    arg_8 = arg_2(\n        arg_0, arg_3, arg_5, arg_7\n    )\n\n    if arg_8:\n        raise ADSError(arg_8)\n\n    return (arg_4.value, arg_6.value)", "path": "pyads/pyads_ex.py", "identifier": "adsSyncReadStateReqEx", "docstring": "Read the current ADS-state and the machine-state.\n\n    Read the current ADS-state and the machine-state from the\n    ADS-server.\n\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :rtype: (int, int)\n    :return: ads_state, device_state", "docstring_tokens": ["Read", "the", "current", "ADS", "-", "state", "and", "the", "machine", "-", "state", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 253965}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/timeslots.py#L179-L189", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return earliest start time in this collection.", "language": "python", "parameters": "(self, *channels: List[Channel])", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ":", "arg_2", "[", "arg_3", "]", ")", "->", "int", ":", "arg_4", "=", "list", "(", "itertools", ".", "chain", "(", "*", "(", "arg_0", ".", "_table", "[", "chan", "]", "for", "chan", "in", "arg_1", "if", "chan", "in", "arg_0", ".", "_table", ")", ")", ")", "if", "arg_4", ":", "return", "min", "(", "(", "arg_5", ".", "begin", "for", "arg_5", "in", "arg_4", ")", ")", "return", "0"], "function": "def Func(arg_0, *arg_1: arg_2[arg_3]) -> int:\n        \"\"\"Return earliest start time in this collection.\n\n        Args:\n            *channels: Channels over which to obtain start_time.\n        \"\"\"\n        arg_4 = list(itertools.chain(*(arg_0._table[chan] for chan in arg_1\n                                           if chan in arg_0._table)))\n        if arg_4:\n            return min((arg_5.begin for arg_5 in arg_4))\n        return 0", "path": "qiskit/pulse/timeslots.py", "identifier": "TimeslotCollection.ch_start_time", "docstring": "Return earliest start time in this collection.\n\n        Args:\n            *channels: Channels over which to obtain start_time.", "docstring_tokens": ["Return", "earliest", "start", "time", "in", "this", "collection", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253966}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/strategy.py#L141-L153", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Mute newly added handlers to the root level, right after calling executor.status", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "logger_flag", "is", "True", ":", "return", "arg_1", "=", "logging", ".", "getLogger", "(", ")", "for", "arg_2", "in", "arg_1", ".", "handlers", ":", "if", "arg_2", "not", "in", "arg_0", ".", "prior_loghandlers", ":", "arg_2", ".", "setLevel", "(", "logging", ".", "ERROR", ")", "arg_0", ".", "logger_flag", "=", "True"], "function": "def Func(arg_0):\n        \"\"\" Mute newly added handlers to the root level, right after calling executor.status\n        \"\"\"\n        if arg_0.logger_flag is True:\n            return\n\n        arg_1 = logging.getLogger()\n\n        for arg_2 in arg_1.handlers:\n            if arg_2 not in arg_0.prior_loghandlers:\n                arg_2.setLevel(logging.ERROR)\n\n        arg_0.logger_flag = True", "path": "parsl/dataflow/strategy.py", "identifier": "Strategy.unset_logging", "docstring": "Mute newly added handlers to the root level, right after calling executor.status", "docstring_tokens": ["Mute", "newly", "added", "handlers", "to", "the", "root", "level", "right", "after", "calling", "executor", ".", "status"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 253967}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/probability.py#L354-L358", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return my probabilities; must be down to one variable.", "language": "python", "parameters": "(self)", "return_statement": "return ProbDist(self.vars[0],\n                        dict((k, v) for ((k,), v) in self.cpt.items()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "len", "(", "arg_0", ".", "vars", ")", "==", "1", "return", "ProbDist", "(", "arg_0", ".", "vars", "[", "0", "]", ",", "dict", "(", "(", "arg_1", ",", "arg_2", ")", "for", "(", "(", "arg_1", ",", ")", ",", "arg_2", ")", "in", "arg_0", ".", "cpt", ".", "items", "(", ")", ")", ")"], "function": "def Func(arg_0):\n        \"Return my probabilities; must be down to one variable.\"\n        assert len(arg_0.vars) == 1\n        return ProbDist(arg_0.vars[0],\n                        dict((arg_1, arg_2) for ((arg_1,), arg_2) in arg_0.cpt.items()))", "path": "aima/probability.py", "identifier": "Factor.normalize", "docstring": "Return my probabilities; must be down to one variable.", "docstring_tokens": ["Return", "my", "probabilities", ";", "must", "be", "down", "to", "one", "variable", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 253968}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/__init__.py#L91-L101", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "get version 1 of the google compute and storage service", "language": "python", "parameters": "(self, version='v1')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'v1'", ")", ":", "arg_0", ".", "_bucket_service", "=", "storage", ".", "Client", "(", ")", "arg_3", "=", "GoogleCredentials", ".", "get_application_default", "(", ")", "arg_0", ".", "_storage_service", "=", "discovery_build", "(", "'storage'", ",", "arg_1", ",", "credentials", "=", "arg_3", ")", "arg_0", ".", "_compute_service", "=", "discovery_build", "(", "'compute'", ",", "arg_1", ",", "credentials", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1='v1'):\n        '''get version 1 of the google compute and storage service\n\n        Parameters\n        ==========\n        version: version to use (default is v1)\n        '''\n        arg_0._bucket_service = storage.Client()\n        arg_3 = GoogleCredentials.get_application_default()\n        arg_0._storage_service = discovery_build('storage', arg_1, credentials=arg_3)\n        arg_0._compute_service = discovery_build('compute', arg_1, credentials=arg_3)", "path": "sregistry/main/google_storage/__init__.py", "identifier": "Client._get_services", "docstring": "get version 1 of the google compute and storage service\n\n        Parameters\n        ==========\n        version: version to use (default is v1)", "docstring_tokens": ["get", "version", "1", "of", "the", "google", "compute", "and", "storage", "service"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 253969}
{"url": "https://github.com/matthewgilbert/pdblp/blob/aaef49ad6fca9af6ee44739d6e7e1cc3e7b0f8e2/pdblp/pdblp.py#L40-L54", "sha": "aaef49ad6fca9af6ee44739d6e7e1cc3e7b0f8e2", "docstring_summary": "Open and manage a BCon wrapper to a Bloomberg API session", "language": "python", "parameters": "(**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "arg_1", "=", "BCon", "(", "**", "arg_0", ")", "arg_1", ".", "start", "(", ")", "try", ":", "yield", "arg_1", "finally", ":", "arg_1", ".", "stop", "(", ")"], "function": "def Func(**arg_0):\n    \"\"\"\n    Open and manage a BCon wrapper to a Bloomberg API session\n\n    Parameters\n    ----------\n    **kwargs:\n        Keyword arguments passed into pdblp.BCon initialization\n    \"\"\"\n    arg_1 = BCon(**arg_0)\n    arg_1.start()\n    try:\n        yield arg_1\n    finally:\n        arg_1.stop()", "path": "pdblp/pdblp.py", "identifier": "bopen", "docstring": "Open and manage a BCon wrapper to a Bloomberg API session\n\n    Parameters\n    ----------\n    **kwargs:\n        Keyword arguments passed into pdblp.BCon initialization", "docstring_tokens": ["Open", "and", "manage", "a", "BCon", "wrapper", "to", "a", "Bloomberg", "API", "session"], "nwo": "matthewgilbert/pdblp", "score": 0.6260425956634948, "idx": 253970}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1746-L1766", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Verify a certificate in a context.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_cleanup", "(", ")", "arg_0", ".", "_init", "(", ")", "arg_1", "=", "_lib", ".", "X509_verify_cert", "(", "arg_0", ".", "_store_ctx", ")", "arg_0", ".", "_cleanup", "(", ")", "if", "arg_1", "<=", "0", ":", "raise", "arg_0", ".", "_exception_from_context", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Verify a certificate in a context.\n\n        .. versionadded:: 0.15\n\n        :raises X509StoreContextError: If an error occurred when validating a\n          certificate in the context. Sets ``certificate`` attribute to\n          indicate which certificate caused the error.\n        \"\"\"\n        # Always re-initialize the store context in case\n        # :meth:`Func` is called multiple times.\n        #\n        # :meth:`_init` is called in :meth:`__init__` so _cleanup is called\n        # before _init to ensure memory is not leaked.\n        arg_0._cleanup()\n        arg_0._init()\n        arg_1 = _lib.X509_verify_cert(arg_0._store_ctx)\n        arg_0._cleanup()\n        if arg_1 <= 0:\n            raise arg_0._exception_from_context()", "path": "src/OpenSSL/crypto.py", "identifier": "X509StoreContext.verify_certificate", "docstring": "Verify a certificate in a context.\n\n        .. versionadded:: 0.15\n\n        :raises X509StoreContextError: If an error occurred when validating a\n          certificate in the context. Sets ``certificate`` attribute to\n          indicate which certificate caused the error.", "docstring_tokens": ["Verify", "a", "certificate", "in", "a", "context", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 253971}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/clustering.py#L5-L33", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Identify clusters using Meanshift algorithm.", "language": "python", "parameters": "(data, bandwidth=None, bin_seeding=False, **kwargs)", "return_statement": "return labels, [np.nan]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "cl", ".", "estimate_bandwidth", "(", "arg_0", ")", "arg_4", "=", "cl", ".", "MeanShift", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "arg_4", ".", "fit", "(", "arg_0", ")", "arg_5", "=", "arg_4", ".", "labels_", "return", "arg_5", ",", "[", "np", ".", "nan", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=False, **arg_3):\n    \"\"\"\n    Identify clusters using Meanshift algorithm.\n\n    Parameters\n    ----------\n    data : array_like\n        array of size [n_samples, n_features].\n    bandwidth : float or None\n        If None, bandwidth is estimated automatically using\n        sklean.cluster.estimate_bandwidth\n    bin_seeding : bool\n        Setting this option to True will speed up the algorithm.\n        See sklearn documentation for full description.\n\n    Returns\n    -------\n    dict\n        boolean array for each identified cluster.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = cl.estimate_bandwidth(arg_0)\n\n    arg_4 = cl.MeanShift(arg_1=arg_1, arg_2=arg_2, **arg_3)\n    arg_4.fit(arg_0)\n\n    arg_5 = arg_4.labels_\n\n    return arg_5, [np.nan]", "path": "latools/filtering/clustering.py", "identifier": "cluster_meanshift", "docstring": "Identify clusters using Meanshift algorithm.\n\n    Parameters\n    ----------\n    data : array_like\n        array of size [n_samples, n_features].\n    bandwidth : float or None\n        If None, bandwidth is estimated automatically using\n        sklean.cluster.estimate_bandwidth\n    bin_seeding : bool\n        Setting this option to True will speed up the algorithm.\n        See sklearn documentation for full description.\n\n    Returns\n    -------\n    dict\n        boolean array for each identified cluster.", "docstring_tokens": ["Identify", "clusters", "using", "Meanshift", "algorithm", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 253972}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/initializers.py#L181-L219", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Otsu threshold on data.", "language": "python", "parameters": "(data, bins=255)", "return_statement": "return 0.5*(x0[ind] + x0[ind+1])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "255", ")", ":", "arg_2", ",", "arg_3", "=", "np", ".", "histogram", "(", "arg_0", ".", "ravel", "(", ")", ",", "arg_1", "=", "arg_1", ")", "arg_4", "=", "arg_2", ".", "astype", "(", "'float'", ")", "/", "arg_2", ".", "sum", "(", ")", "arg_5", "=", "0.5", "*", "(", "arg_3", "[", "1", ":", "]", "+", "arg_3", "[", ":", "-", "1", "]", ")", "arg_6", "=", "np", ".", "array", "(", "[", "arg_4", "[", ":", "i", "+", "1", "]", ".", "sum", "(", ")", "for", "i", "in", "range", "(", "arg_4", ".", "size", ")", "]", ")", "arg_7", "=", "np", ".", "array", "(", "[", "sum", "(", "arg_5", "[", ":", "i", "+", "1", "]", "*", "arg_4", "[", ":", "i", "+", "1", "]", ")", "for", "i", "in", "range", "(", "arg_4", ".", "size", ")", "]", ")", "arg_8", "=", "arg_7", "[", "-", "1", "]", "arg_9", "=", "(", "arg_8", "*", "arg_6", "-", "arg_7", ")", "**", "2", "/", "(", "arg_6", "*", "(", "1", "-", "arg_6", ")", "+", "1e-15", ")", "arg_10", "=", "arg_9", ".", "argmax", "(", ")", "return", "0.5", "*", "(", "arg_3", "[", "arg_10", "]", "+", "arg_3", "[", "arg_10", "+", "1", "]", ")"], "function": "def Func(arg_0, arg_1=255):\n    \"\"\"\n    Otsu threshold on data.\n\n    Otsu thresholding [1]_is a method for selecting an intensity value\n    for thresholding an image into foreground and background. The sel-\n    ected intensity threshold maximizes the inter-class variance.\n\n    Parameters\n    ----------\n        data : numpy.ndarray\n            The data to threshold\n        bins : Int or numpy.ndarray, optional\n            Bin edges, as passed to numpy.histogram\n\n    Returns\n    -------\n        numpy.float\n            The value of the threshold which maximizes the inter-class\n            variance.\n\n    Notes\n    -----\n        This could be generalized to more than 2 classes.\n    References\n    ----------\n        ..[1] N. Otsu, \"A Threshold Selection Method from Gray-level\n            Histograms,\" IEEE Trans. Syst., Man, Cybern., Syst., 9, 1,\n            62-66 (1979)\n    \"\"\"\n    arg_2, arg_3 = np.histogram(arg_0.ravel(), arg_1=arg_1)\n    arg_4 = arg_2.astype('float') / arg_2.sum()  #normalize\n    arg_5 = 0.5*(arg_3[1:] + arg_3[:-1])  #bin center\n    arg_6 = np.array([arg_4[:i+1].sum() for i in range(arg_4.size)])  #omega_k\n    arg_7 = np.array([sum(arg_5[:i+1]*arg_4[:i+1]) for i in range(arg_4.size)])  #mu_k\n    arg_8 = arg_7[-1]  #mu_T\n    arg_9 = (arg_8*arg_6 - arg_7)**2 / (arg_6*(1-arg_6) + 1e-15)  #sigma_b\n    arg_10 = arg_9.argmax()\n    return 0.5*(arg_3[arg_10] + arg_3[arg_10+1])", "path": "peri/initializers.py", "identifier": "otsu_threshold", "docstring": "Otsu threshold on data.\n\n    Otsu thresholding [1]_is a method for selecting an intensity value\n    for thresholding an image into foreground and background. The sel-\n    ected intensity threshold maximizes the inter-class variance.\n\n    Parameters\n    ----------\n        data : numpy.ndarray\n            The data to threshold\n        bins : Int or numpy.ndarray, optional\n            Bin edges, as passed to numpy.histogram\n\n    Returns\n    -------\n        numpy.float\n            The value of the threshold which maximizes the inter-class\n            variance.\n\n    Notes\n    -----\n        This could be generalized to more than 2 classes.\n    References\n    ----------\n        ..[1] N. Otsu, \"A Threshold Selection Method from Gray-level\n            Histograms,\" IEEE Trans. Syst., Man, Cybern., Syst., 9, 1,\n            62-66 (1979)", "docstring_tokens": ["Otsu", "threshold", "on", "data", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 253973}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/lkj.py#L371-L410", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns the unnormalized log density of an LKJ distribution.", "language": "python", "parameters": "(self, x, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_2", "or", "'log_unnorm_prob_lkj'", ")", ":", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "arg_2", "=", "'x'", ")", "if", "arg_0", ".", "input_output_cholesky", ":", "arg_3", "=", "2.0", "*", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "tf", ".", "math", ".", "log", "(", "tf", ".", "linalg", ".", "diag_part", "(", "arg_1", ")", ")", ",", "axis", "=", "[", "-", "1", "]", ")", "else", ":", "arg_4", ",", "arg_3", "=", "tf", ".", "linalg", ".", "slogdet", "(", "arg_1", ")", "arg_5", "=", "(", "arg_0", ".", "concentration", "-", "1.", ")", "*", "arg_3", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Returns the unnormalized log density of an LKJ distribution.\n\n    Args:\n      x: `float` or `double` `Tensor` of correlation matrices.  The shape of `x`\n        must be `B + [D, D]`, where `B` broadcasts with the shape of\n        `concentration`.\n      name: Python `str` name prefixed to Ops created by this function.\n\n    Returns:\n      log_p: A Tensor of the unnormalized log density of each matrix element of\n        `x`, with respect to an LKJ distribution with parameter the\n        corresponding element of `concentration`.\n    \"\"\"\n    with tf.name_scope(arg_2 or 'log_unnorm_prob_lkj'):\n      arg_1 = tf.convert_to_tensor(value=arg_1, arg_2='x')\n      # The density is det(matrix) ** (concentration - 1).\n      # Computing the determinant with `logdet` is usually fine, since\n      # correlation matrices are Hermitian and PSD. But in some cases, for a\n      # PSD matrix whose eigenvalues are close to zero, `logdet` raises an error\n      # complaining that it is not PSD. The root cause is the computation of the\n      # cholesky decomposition in `logdet`. Hence, we use the less efficient but\n      # more robust `slogdet` which does not use `cholesky`.\n      #\n      # An alternative would have been to check allow_nan_stats and use\n      #   eigenvalues = tf.linalg.self_adjoint_eigvals(x)\n      #   psd_mask = tf.cast(\n      #     tf.reduce_min(eigenvalues, axis=-1) >= 0, dtype=x.dtype)\n      #   tf.where(psd_mask, answer, float('-inf'))\n      # to emit probability 0 for inputs that are not PSD, without ever raising\n      # an error. More care must be taken, as due to numerical stability issues,\n      # self_adjoint_eigvals can return slightly negative eigenvalues even for\n      # a PSD matrix.\n      if arg_0.input_output_cholesky:\n        arg_3 = 2.0 * tf.reduce_sum(\n            input_tensor=tf.math.log(tf.linalg.diag_part(arg_1)), axis=[-1])\n      else:\n        arg_4, arg_3 = tf.linalg.slogdet(arg_1)\n      arg_5 = (arg_0.concentration - 1.) * arg_3\n      return arg_5", "path": "tensorflow_probability/python/distributions/lkj.py", "identifier": "LKJ._log_unnorm_prob", "docstring": "Returns the unnormalized log density of an LKJ distribution.\n\n    Args:\n      x: `float` or `double` `Tensor` of correlation matrices.  The shape of `x`\n        must be `B + [D, D]`, where `B` broadcasts with the shape of\n        `concentration`.\n      name: Python `str` name prefixed to Ops created by this function.\n\n    Returns:\n      log_p: A Tensor of the unnormalized log density of each matrix element of\n        `x`, with respect to an LKJ distribution with parameter the\n        corresponding element of `concentration`.", "docstring_tokens": ["Returns", "the", "unnormalized", "log", "density", "of", "an", "LKJ", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253974}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/core.py#L423-L432", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Gets session data lazily.", "language": "python", "parameters": "(self)", "return_statement": "return self._data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_Func", ":", "arg_0", ".", "_Func", "=", "arg_0", ".", "_get_Func", "(", ")", "if", "arg_0", ".", "_Func", "is", "None", ":", "arg_0", ".", "_Func", "=", "{", "}", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Gets session Func lazily.\n        \"\"\"\n        if not arg_0._Func:\n            arg_0._Func = arg_0._get_Func()\n        # Always return a dict, even if deserialization returned nothing\n        if arg_0._Func is None:\n            arg_0._Func = {}\n        return arg_0._Func", "path": "authomatic/core.py", "identifier": "Session.data", "docstring": "Gets session data lazily.", "docstring_tokens": ["Gets", "session", "data", "lazily", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 253975}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/application.py#L443-L460", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Load a .py based config file by filename and path.", "language": "python", "parameters": "(self, filename, path=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "PyFileConfigLoader", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "try", ":", "arg_4", "=", "arg_3", ".", "load_config", "(", ")", "except", "ConfigFileNotFound", ":", "raise", "except", "Exception", ":", "arg_1", "=", "arg_3", ".", "full_filename", "or", "arg_1", "arg_0", ".", "log", ".", "error", "(", "\"Exception while loading config file %s\"", ",", "arg_1", ",", "exc_info", "=", "True", ")", "else", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Loaded config file: %s\"", ",", "arg_3", ".", "full_filename", ")", "arg_0", ".", "update_config", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Load a .py based config file by filename and path.\"\"\"\n        arg_3 = PyFileConfigLoader(arg_1, arg_2=arg_2)\n        try:\n            arg_4 = arg_3.load_config()\n        except ConfigFileNotFound:\n            # problem finding the file, raise\n            raise\n        except Exception:\n            # try to get the full filename, but it will be empty in the\n            # unlikely event that the error raised before filefind finished\n            arg_1 = arg_3.full_filename or arg_1\n            # problem while running the file\n            arg_0.log.error(\"Exception while loading config file %s\",\n                            arg_1, exc_info=True)\n        else:\n            arg_0.log.debug(\"Loaded config file: %s\", arg_3.full_filename)\n            arg_0.update_config(arg_4)", "path": "environment/lib/python2.7/site-packages/IPython/config/application.py", "identifier": "Application.load_config_file", "docstring": "Load a .py based config file by filename and path.", "docstring_tokens": ["Load", "a", ".", "py", "based", "config", "file", "by", "filename", "and", "path", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 253976}
{"url": "https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L139-L155", "sha": "92bd3b02954422665260116adda8eb899546c365", "docstring_summary": "Select the proper LockManager based on the current backend used by Celery.", "language": "python", "parameters": "(backend_name)", "return_statement": "return lock_manager", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "'RedisBackend'", ":", "arg_1", "=", "_LockManagerRedis", "elif", "arg_0", "==", "'DatabaseBackend'", ":", "arg_1", "=", "_LockManagerDB", "else", ":", "raise", "NotImplementedError", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Select the proper LockManager based on the current backend used by Celery.\n\n    :raise NotImplementedError: If Celery is using an unsupported backend.\n\n    :param str backend_name: Class name of the current Celery backend. Usually value of\n        current_app.extensions['celery'].celery.backend.__class__.__name__.\n\n    :return: Class definition object (not instance). One of the _LockManager* classes.\n    \"\"\"\n    if arg_0 == 'RedisBackend':\n        arg_1 = _LockManagerRedis\n    elif arg_0 == 'DatabaseBackend':\n        arg_1 = _LockManagerDB\n    else:\n        raise NotImplementedError\n    return arg_1", "path": "flask_celery.py", "identifier": "_select_manager", "docstring": "Select the proper LockManager based on the current backend used by Celery.\n\n    :raise NotImplementedError: If Celery is using an unsupported backend.\n\n    :param str backend_name: Class name of the current Celery backend. Usually value of\n        current_app.extensions['celery'].celery.backend.__class__.__name__.\n\n    :return: Class definition object (not instance). One of the _LockManager* classes.", "docstring_tokens": ["Select", "the", "proper", "LockManager", "based", "on", "the", "current", "backend", "used", "by", "Celery", "."], "nwo": "Robpol86/Flask-Celery-Helper", "score": 0.5367470188175552, "idx": 253977}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/macros/hive.py#L23-L55", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Gets the max partition for a table.", "language": "python", "parameters": "(\n        table, schema=\"default\", field=None, filter_map=None,\n        metastore_conn_id='metastore_default')", "return_statement": "return hh.max_partition(\n        schema=schema, table_name=table, field=field, filter_map=filter_map)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"default\"", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'metastore_default'", ")", ":", "from", "airflow", ".", "hooks", ".", "hive_hooks", "import", "HiveMetastoreHook", "if", "'.'", "in", "arg_0", ":", "arg_1", ",", "arg_0", "=", "arg_0", ".", "split", "(", "'.'", ")", "arg_5", "=", "HiveMetastoreHook", "(", "arg_4", "=", "arg_4", ")", "return", "arg_5", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "table_name", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(\n        arg_0, arg_1=\"default\", arg_2=None, arg_3=None,\n        arg_4='metastore_default'):\n    \"\"\"\n    Gets the max partition for a table.\n\n    :param schema: The hive schema the table lives in\n    :type schema: str\n    :param table: The hive table you are interested in, supports the dot\n        notation as in \"my_database.my_table\", if a dot is found,\n        the schema param is disregarded\n    :type table: str\n    :param metastore_conn_id: The hive connection you are interested in.\n        If your default is set you don't need to use this parameter.\n    :type metastore_conn_id: str\n    :param filter_map: partition_key:partition_value map used for partition filtering,\n                       e.g. {'key1': 'value1', 'key2': 'value2'}.\n                       Only partitions matching all partition_key:partition_value\n                       pairs will be considered as candidates of max partition.\n    :type filter_map: map\n    :param field: the field to get the max value from. If there's only\n        one partition field, this will be inferred\n    :type field: str\n\n    >>> Func('airflow.static_babynames_partitioned')\n    '2015-01-01'\n    \"\"\"\n    from airflow.hooks.hive_hooks import HiveMetastoreHook\n    if '.' in arg_0:\n        arg_1, arg_0 = arg_0.split('.')\n    arg_5 = HiveMetastoreHook(arg_4=arg_4)\n    return arg_5.Func(\n        arg_1=arg_1, table_name=arg_0, arg_2=arg_2, arg_3=arg_3)", "path": "airflow/macros/hive.py", "identifier": "max_partition", "docstring": "Gets the max partition for a table.\n\n    :param schema: The hive schema the table lives in\n    :type schema: str\n    :param table: The hive table you are interested in, supports the dot\n        notation as in \"my_database.my_table\", if a dot is found,\n        the schema param is disregarded\n    :type table: str\n    :param metastore_conn_id: The hive connection you are interested in.\n        If your default is set you don't need to use this parameter.\n    :type metastore_conn_id: str\n    :param filter_map: partition_key:partition_value map used for partition filtering,\n                       e.g. {'key1': 'value1', 'key2': 'value2'}.\n                       Only partitions matching all partition_key:partition_value\n                       pairs will be considered as candidates of max partition.\n    :type filter_map: map\n    :param field: the field to get the max value from. If there's only\n        one partition field, this will be inferred\n    :type field: str\n\n    >>> max_partition('airflow.static_babynames_partitioned')\n    '2015-01-01'", "docstring_tokens": ["Gets", "the", "max", "partition", "for", "a", "table", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 253978}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L248-L296", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "Returns the icon resource filename that corresponds to the given typename.", "language": "python", "parameters": "(name, icon_type)", "return_statement": "return ret_val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'CLASS'", ":", "ICON_CLASS", ",", "'IMPORT'", ":", "ICON_NAMESPACE", ",", "'STATEMENT'", ":", "ICON_VAR", ",", "'FORFLOW'", ":", "ICON_VAR", ",", "'FORSTMT'", ":", "ICON_VAR", ",", "'WITHSTMT'", ":", "ICON_VAR", ",", "'GLOBALSTMT'", ":", "ICON_VAR", ",", "'MODULE'", ":", "ICON_NAMESPACE", ",", "'KEYWORD'", ":", "ICON_KEYWORD", ",", "'PARAM'", ":", "ICON_VAR", ",", "'ARRAY'", ":", "ICON_VAR", ",", "'INSTANCEELEMENT'", ":", "ICON_VAR", ",", "'INSTANCE'", ":", "ICON_VAR", ",", "'PARAM-PRIV'", ":", "ICON_VAR", ",", "'PARAM-PROT'", ":", "ICON_VAR", ",", "'FUNCTION'", ":", "ICON_FUNC", ",", "'DEF'", ":", "ICON_FUNC", ",", "'FUNCTION-PRIV'", ":", "ICON_FUNC_PRIVATE", ",", "'FUNCTION-PROT'", ":", "ICON_FUNC_PROTECTED", "}", "arg_3", "=", "None", "arg_1", "=", "arg_1", ".", "upper", "(", ")", "if", "hasattr", "(", "arg_0", ",", "\"string\"", ")", ":", "arg_0", "=", "arg_0", ".", "string", "if", "arg_1", "==", "\"FORFLOW\"", "or", "arg_1", "==", "\"STATEMENT\"", ":", "arg_1", "=", "\"PARAM\"", "if", "arg_1", "==", "\"PARAM\"", "or", "arg_1", "==", "\"FUNCTION\"", ":", "if", "arg_0", ".", "startswith", "(", "\"__\"", ")", ":", "arg_1", "+=", "\"-PRIV\"", "elif", "arg_0", ".", "startswith", "(", "\"_\"", ")", ":", "arg_1", "+=", "\"-PROT\"", "if", "arg_1", "in", "arg_2", ":", "arg_3", "=", "arg_2", "[", "arg_1", "]", "elif", "arg_1", ":", "_logger", "(", ")", ".", "warning", "(", "\"Unimplemented completion icon_type: %s\"", ",", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the icon resource filename that corresponds to the given typename.\n\n    :param name: name of the completion. Use to make the distinction between\n        public and private completions (using the count of starting '_')\n    :pram typename: the typename reported by jedi\n\n    :returns: The associate icon resource filename or None.\n    \"\"\"\n    arg_2 = {\n        'CLASS': ICON_CLASS,\n        'IMPORT': ICON_NAMESPACE,\n        'STATEMENT': ICON_VAR,\n        'FORFLOW': ICON_VAR,\n        'FORSTMT': ICON_VAR,\n        'WITHSTMT': ICON_VAR,\n        'GLOBALSTMT': ICON_VAR,\n        'MODULE': ICON_NAMESPACE,\n        'KEYWORD': ICON_KEYWORD,\n        'PARAM': ICON_VAR,\n        'ARRAY': ICON_VAR,\n        'INSTANCEELEMENT': ICON_VAR,\n        'INSTANCE': ICON_VAR,\n        'PARAM-PRIV': ICON_VAR,\n        'PARAM-PROT': ICON_VAR,\n        'FUNCTION': ICON_FUNC,\n        'DEF': ICON_FUNC,\n        'FUNCTION-PRIV': ICON_FUNC_PRIVATE,\n        'FUNCTION-PROT': ICON_FUNC_PROTECTED\n    }\n    arg_3 = None\n    arg_1 = arg_1.upper()\n    # jedi 0.8 introduced NamedPart class, which have a string instead of being\n    # one\n    if hasattr(arg_0, \"string\"):\n        arg_0 = arg_0.string\n    if arg_1 == \"FORFLOW\" or arg_1 == \"STATEMENT\":\n        arg_1 = \"PARAM\"\n    if arg_1 == \"PARAM\" or arg_1 == \"FUNCTION\":\n        if arg_0.startswith(\"__\"):\n            arg_1 += \"-PRIV\"\n        elif arg_0.startswith(\"_\"):\n            arg_1 += \"-PROT\"\n    if arg_1 in arg_2:\n        arg_3 = arg_2[arg_1]\n    elif arg_1:\n        _logger().warning(\"Unimplemented completion icon_type: %s\", arg_1)\n    return arg_3", "path": "pyqode/python/backend/workers.py", "identifier": "icon_from_typename", "docstring": "Returns the icon resource filename that corresponds to the given typename.\n\n    :param name: name of the completion. Use to make the distinction between\n        public and private completions (using the count of starting '_')\n    :pram typename: the typename reported by jedi\n\n    :returns: The associate icon resource filename or None.", "docstring_tokens": ["Returns", "the", "icon", "resource", "filename", "that", "corresponds", "to", "the", "given", "typename", "."], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 253979}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/lbfgs.py#L403-L466", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Conditionally push new vectors into a batch of first-in-first-out queues.", "language": "python", "parameters": "(queue, should_update, new_vecs)", "return_statement": "return tf.where(update_pattern, new_queue, queue)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "tf", ".", "concat", "(", "[", "arg_0", "[", "1", ":", "]", ",", "[", "arg_2", "]", "]", ",", "axis", "=", "0", ")", "arg_4", "=", "tf", ".", "broadcast_to", "(", "arg_1", "[", "tf", ".", "newaxis", ",", "...", ",", "tf", ".", "newaxis", "]", ",", "distribution_util", ".", "prefer_static_shape", "(", "arg_0", ")", ")", "return", "tf", ".", "where", "(", "arg_4", ",", "arg_3", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Conditionally push new vectors into a batch of first-in-first-out queues.\n\n  The `queue` of shape `[k, ..., n]` can be thought of as a batch of queues,\n  each holding `k` n-D vectors; while `new_vecs` of shape `[..., n]` is a\n  fresh new batch of n-D vectors. The `should_update` batch of Boolean scalars,\n  i.e. shape `[...]`, indicates batch members whose corresponding n-D vector in\n  `new_vecs` should be added at the back of its queue, pushing out the\n  corresponding n-D vector from the front. Batch members in `new_vecs` for\n  which `should_update` is False are ignored.\n\n  Note: the choice of placing `k` at the dimension 0 of the queue is\n  constrained by the L-BFGS two-loop algorithm above. The algorithm uses\n  tf.scan to iterate over the `k` correction pairs simulatneously across all\n  batches, and tf.scan itself can only iterate over dimension 0.\n\n  For example:\n\n  ```python\n    k, b, n = (3, 2, 5)\n    queue = tf.reshape(tf.range(30), (k, b, n))\n    # => [[[ 0,  1,  2,  3,  4],\n    #      [ 5,  6,  7,  8,  9]],\n    #\n    #     [[10, 11, 12, 13, 14],\n    #      [15, 16, 17, 18, 19]],\n    #\n    #     [[20, 21, 22, 23, 24],\n    #      [25, 26, 27, 28, 29]]]\n\n    element = tf.reshape(tf.range(30, 40), (b, n))\n    # => [[30, 31, 32, 33, 34],\n          [35, 36, 37, 38, 39]]\n\n    should_update = tf.constant([True, False])  # Shape: (b,)\n\n    _queue_add(should_update, queue, element)\n    # => [[[10, 11, 12, 13, 14],\n    #      [ 5,  6,  7,  8,  9]],\n    #\n    #     [[20, 21, 22, 23, 24],\n    #      [15, 16, 17, 18, 19]],\n    #\n    #     [[30, 31, 32, 33, 34],\n    #      [25, 26, 27, 28, 29]]]\n  ```\n\n  Args:\n    queue: A `tf.Tensor` of shape `[k, ..., n]`; a batch of queues each with\n      `k` n-D vectors.\n    should_update: A Boolean `tf.Tensor` of shape `[...]` indicating batch\n      members where new vectors should be added to their queues.\n    new_vecs: A `tf.Tensor` of shape `[..., n]`; a batch of n-D vectors to add\n      at the end of their respective queues, pushing out the first element from\n      each.\n\n  Returns:\n    A new `tf.Tensor` of shape `[k, ..., n]`.\n  \"\"\"\n  arg_3 = tf.concat([arg_0[1:], [arg_2]], axis=0)\n  arg_4 = tf.broadcast_to(\n      arg_1[tf.newaxis, ..., tf.newaxis],\n      distribution_util.prefer_static_shape(arg_0))\n  return tf.where(arg_4, arg_3, arg_0)", "path": "tensorflow_probability/python/optimizer/lbfgs.py", "identifier": "_queue_push", "docstring": "Conditionally push new vectors into a batch of first-in-first-out queues.\n\n  The `queue` of shape `[k, ..., n]` can be thought of as a batch of queues,\n  each holding `k` n-D vectors; while `new_vecs` of shape `[..., n]` is a\n  fresh new batch of n-D vectors. The `should_update` batch of Boolean scalars,\n  i.e. shape `[...]`, indicates batch members whose corresponding n-D vector in\n  `new_vecs` should be added at the back of its queue, pushing out the\n  corresponding n-D vector from the front. Batch members in `new_vecs` for\n  which `should_update` is False are ignored.\n\n  Note: the choice of placing `k` at the dimension 0 of the queue is\n  constrained by the L-BFGS two-loop algorithm above. The algorithm uses\n  tf.scan to iterate over the `k` correction pairs simulatneously across all\n  batches, and tf.scan itself can only iterate over dimension 0.\n\n  For example:\n\n  ```python\n    k, b, n = (3, 2, 5)\n    queue = tf.reshape(tf.range(30), (k, b, n))\n    # => [[[ 0,  1,  2,  3,  4],\n    #      [ 5,  6,  7,  8,  9]],\n    #\n    #     [[10, 11, 12, 13, 14],\n    #      [15, 16, 17, 18, 19]],\n    #\n    #     [[20, 21, 22, 23, 24],\n    #      [25, 26, 27, 28, 29]]]\n\n    element = tf.reshape(tf.range(30, 40), (b, n))\n    # => [[30, 31, 32, 33, 34],\n          [35, 36, 37, 38, 39]]\n\n    should_update = tf.constant([True, False])  # Shape: (b,)\n\n    _queue_add(should_update, queue, element)\n    # => [[[10, 11, 12, 13, 14],\n    #      [ 5,  6,  7,  8,  9]],\n    #\n    #     [[20, 21, 22, 23, 24],\n    #      [15, 16, 17, 18, 19]],\n    #\n    #     [[30, 31, 32, 33, 34],\n    #      [25, 26, 27, 28, 29]]]\n  ```\n\n  Args:\n    queue: A `tf.Tensor` of shape `[k, ..., n]`; a batch of queues each with\n      `k` n-D vectors.\n    should_update: A Boolean `tf.Tensor` of shape `[...]` indicating batch\n      members where new vectors should be added to their queues.\n    new_vecs: A `tf.Tensor` of shape `[..., n]`; a batch of n-D vectors to add\n      at the end of their respective queues, pushing out the first element from\n      each.\n\n  Returns:\n    A new `tf.Tensor` of shape `[k, ..., n]`.", "docstring_tokens": ["Conditionally", "push", "new", "vectors", "into", "a", "batch", "of", "first", "-", "in", "-", "first", "-", "out", "queues", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 253980}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process.py#L622-L673", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "General method for setting the input channels for the status process", "language": "python", "parameters": "(self, channel_list, operator=\"mix\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"mix\"", ")", ":", "if", "not", "arg_1", ":", "raise", "eh", ".", "ProcessError", "(", "\"At least one status channel must be \"", "\"provided to include this process in the \"", "\"pipeline\"", ")", "if", "len", "(", "arg_1", ")", "==", "1", ":", "logger", ".", "debug", "(", "\"Setting only one status channel: {}\"", ".", "format", "(", "arg_1", "[", "0", "]", ")", ")", "arg_0", ".", "_context", "=", "{", "\"compile_channels\"", ":", "arg_1", "[", "0", "]", "}", "else", ":", "arg_4", "=", "arg_1", "[", "0", "]", "if", "arg_2", "==", "\"mix\"", ":", "arg_5", "=", "\",\"", ".", "join", "(", "arg_1", "[", "1", ":", "]", ")", "arg_6", "=", "\"{}.mix({})\"", ".", "format", "(", "arg_4", ",", "arg_5", ")", "elif", "arg_2", "==", "\"join\"", ":", "arg_6", "=", "arg_4", "for", "arg_7", "in", "arg_1", "[", "1", ":", "]", ":", "arg_6", "+=", "\".join({})\"", ".", "format", "(", "arg_7", ")", "arg_6", "+=", "\".map{ ot -> [ ot[0], ot[1..-1] ] }\"", "logger", ".", "debug", "(", "\"Status channel string: {}\"", ".", "format", "(", "arg_6", ")", ")", "arg_0", ".", "_context", "=", "{", "\"compile_channels\"", ":", "arg_6", "}"], "function": "def Func(arg_0, arg_1, arg_2=\"mix\"):\n        \"\"\"General method for setting the input channels for the status process\n\n        Given a list of status channels that are gathered during the pipeline\n        construction, this method will automatically set the input channel\n        for the status process. This makes use of the ``mix`` channel operator\n        of nextflow for multiple channels::\n\n            STATUS_1.mix(STATUS_2,STATUS_3,...)\n\n        This will set the ``status_channels`` key for the ``_context``\n        attribute of the process.\n\n        Parameters\n        ----------\n        channel_list : list\n            List of strings with the final name of the status channels\n        operator : str\n            Specifies the operator used to join the compiler channels.\n            Available options are 'mix'and 'join'.\n        \"\"\"\n\n        if not arg_1:\n            raise eh.ProcessError(\"At least one status channel must be \"\n                                  \"provided to include this process in the \"\n                                  \"pipeline\")\n\n        if len(arg_1) == 1:\n            logger.debug(\"Setting only one status channel: {}\".format(\n                arg_1[0]))\n            arg_0._context = {\"compile_channels\": arg_1[0]}\n\n        else:\n\n            arg_4 = arg_1[0]\n\n            if arg_2 == \"mix\":\n                arg_5 = \",\".join(arg_1[1:])\n\n                arg_6 = \"{}.mix({})\".format(arg_4, arg_5)\n\n            elif arg_2 == \"join\":\n\n                arg_6 = arg_4\n                for arg_7 in arg_1[1:]:\n                    arg_6 += \".join({})\".format(arg_7)\n\n                arg_6 += \".map{ ot -> [ ot[0], ot[1..-1] ] }\"\n\n            logger.debug(\"Status channel string: {}\".format(arg_6))\n\n            arg_0._context = {\"compile_channels\": arg_6}", "path": "flowcraft/generator/process.py", "identifier": "Compiler.set_compiler_channels", "docstring": "General method for setting the input channels for the status process\n\n        Given a list of status channels that are gathered during the pipeline\n        construction, this method will automatically set the input channel\n        for the status process. This makes use of the ``mix`` channel operator\n        of nextflow for multiple channels::\n\n            STATUS_1.mix(STATUS_2,STATUS_3,...)\n\n        This will set the ``status_channels`` key for the ``_context``\n        attribute of the process.\n\n        Parameters\n        ----------\n        channel_list : list\n            List of strings with the final name of the status channels\n        operator : str\n            Specifies the operator used to join the compiler channels.\n            Available options are 'mix'and 'join'.", "docstring_tokens": ["General", "method", "for", "setting", "the", "input", "channels", "for", "the", "status", "process"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 253981}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/bezier.py#L428-L438", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns coordinates for point at t on the line.\n            Calculates the coordinates of x and y for a point at t on a straight line.\n            The t parameter is a number between 0.0 and 1.0,\n            x0 and y0 define the starting point of the line,\n            x1 and y1 the ending point of the line.", "language": "python", "parameters": "(self, t, x0, y0, x1, y1)", "return_statement": "return (out_x, out_y)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "arg_2", "+", "arg_1", "*", "(", "arg_4", "-", "arg_2", ")", "arg_7", "=", "arg_3", "+", "arg_1", "*", "(", "arg_5", "-", "arg_3", ")", "return", "(", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\" Returns coordinates for point at t on the line.\n            Calculates the coordinates of x and y for a point at t on a straight line.\n            The t parameter is a number between 0.0 and 1.0,\n            x0 and y0 define the starting point of the line,\n            x1 and y1 the ending point of the line.\n        \"\"\"\n        # Originally from nodebox-gl\n        arg_6 = arg_2 + arg_1 * (arg_4 - arg_2)\n        arg_7 = arg_3 + arg_1 * (arg_5 - arg_3)\n        return (arg_6, arg_7)", "path": "shoebot/data/bezier.py", "identifier": "BezierPath._linepoint", "docstring": "Returns coordinates for point at t on the line.\n            Calculates the coordinates of x and y for a point at t on a straight line.\n            The t parameter is a number between 0.0 and 1.0,\n            x0 and y0 define the starting point of the line,\n            x1 and y1 the ending point of the line.", "docstring_tokens": ["Returns", "coordinates", "for", "point", "at", "t", "on", "the", "line", ".", "Calculates", "the", "coordinates", "of", "x", "and", "y", "for", "a", "point", "at", "t", "on", "a", "straight", "line", ".", "The", "t", "parameter", "is", "a", "number", "between", "0", ".", "0", "and", "1", ".", "0", "x0", "and", "y0", "define", "the", "starting", "point", "of", "the", "line", "x1", "and", "y1", "the", "ending", "point", "of", "the", "line", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 253982}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/scheduler.py#L280-L287", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Start scheduling jobs.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "async_mode", ":", "arg_0", ".", "_Funcr", ".", "start", "(", ")", "arg_0", ".", "_listener", ".", "start", "(", ")", "else", ":", "arg_0", ".", "_Funcr", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Start scheduling jobs.\"\"\"\n\n        if arg_0.async_mode:\n            arg_0._Funcr.start()\n            arg_0._listener.start()\n        else:\n            arg_0._Funcr.Func()", "path": "arthur/scheduler.py", "identifier": "Scheduler.schedule", "docstring": "Start scheduling jobs.", "docstring_tokens": ["Start", "scheduling", "jobs", "."], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 253983}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1544-L1556", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Convert all tags in an HTML tree to XHTML by moving them to the\n    XHTML namespace.", "language": "python", "parameters": "(html)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", "=", "arg_0", ".", "getroot", "(", ")", "except", "AttributeError", ":", "pass", "arg_1", "=", "\"{%s}\"", "%", "XHTML_NAMESPACE", "for", "arg_2", "in", "arg_0", ".", "iter", "(", "etree", ".", "Element", ")", ":", "arg_3", "=", "arg_2", ".", "tag", "if", "arg_3", "[", "0", "]", "!=", "'{'", ":", "arg_2", ".", "tag", "=", "arg_1", "+", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Convert all tags in an HTML tree to XHTML by moving them to the\n    XHTML namespace.\n    \"\"\"\n    try:\n        arg_0 = arg_0.getroot()\n    except AttributeError:\n        pass\n    arg_1 = \"{%s}\" % XHTML_NAMESPACE\n    for arg_2 in arg_0.iter(etree.Element):\n        arg_3 = arg_2.tag\n        if arg_3[0] != '{':\n            arg_2.tag = arg_1 + arg_3", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py", "identifier": "html_to_xhtml", "docstring": "Convert all tags in an HTML tree to XHTML by moving them to the\n    XHTML namespace.", "docstring_tokens": ["Convert", "all", "tags", "in", "an", "HTML", "tree", "to", "XHTML", "by", "moving", "them", "to", "the", "XHTML", "namespace", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 253984}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qi/qi.py#L290-L308", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Truncate small values of a complex array.", "language": "python", "parameters": "(array, epsilon=1e-10)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1e-10", ")", ":", "arg_2", "=", "np", ".", "array", "(", "arg_0", ")", "if", "np", ".", "isrealobj", "(", "arg_2", ")", ":", "arg_2", "[", "arg_3", "(", "arg_2", ")", "<", "arg_1", "]", "=", "0.0", "else", ":", "arg_2", ".", "real", "[", "arg_3", "(", "arg_2", ".", "real", ")", "<", "arg_1", "]", "=", "0.0", "arg_2", ".", "imag", "[", "arg_3", "(", "arg_2", ".", "imag", ")", "<", "arg_1", "]", "=", "0.0", "return", "arg_2"], "function": "def Func(arg_0, arg_1=1e-10):\n    \"\"\"\n    Truncate small values of a complex array.\n\n    Args:\n        array (array_like): array to truncte small values.\n        epsilon (float): threshold.\n\n    Returns:\n        np.array: A new operator with small values set to zero.\n    \"\"\"\n    arg_2 = np.array(arg_0)\n\n    if np.isrealobj(arg_2):\n        arg_2[arg_3(arg_2) < arg_1] = 0.0\n    else:\n        arg_2.real[arg_3(arg_2.real) < arg_1] = 0.0\n        arg_2.imag[arg_3(arg_2.imag) < arg_1] = 0.0\n    return arg_2", "path": "qiskit/tools/qi/qi.py", "identifier": "chop", "docstring": "Truncate small values of a complex array.\n\n    Args:\n        array (array_like): array to truncte small values.\n        epsilon (float): threshold.\n\n    Returns:\n        np.array: A new operator with small values set to zero.", "docstring_tokens": ["Truncate", "small", "values", "of", "a", "complex", "array", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 253985}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/sonify.py#L83-L103", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Sonify multi-level segmentations", "language": "python", "parameters": "(annotation, sr=22050, length=None, **kwargs)", "return_statement": "return y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "22050", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "[", "1", ",", "32.", "/", "27", ",", "4.", "/", "3", ",", "3.", "/", "2", ",", "16.", "/", "9", "]", "arg_5", "=", "0.1", "arg_6", ",", "arg_7", "=", "hierarchy_flatten", "(", "arg_0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "int", "(", "arg_1", "*", "(", "max", "(", "np", ".", "max", "(", "arg_7", ")", "for", "arg_7", "in", "arg_6", ")", "+", "1.", "/", "arg_5", ")", "+", "1", ")", "arg_8", "=", "0.0", "for", "arg_9", ",", "(", "arg_10", ",", "arg_11", ")", "in", "zip", "(", "arg_6", ",", "product", "(", "range", "(", "3", ",", "3", "+", "len", "(", "arg_6", ")", ")", ",", "arg_4", ")", ")", ":", "arg_12", "=", "mkclick", "(", "440.0", "*", "arg_11", "*", "arg_10", ",", "arg_1", "=", "arg_1", ",", "duration", "=", "arg_5", ")", "arg_8", "=", "arg_8", "+", "filter_kwargs", "(", "mir_eval", ".", "sonify", ".", "clicks", ",", "np", ".", "unique", "(", "arg_9", ")", ",", "fs", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_12", "=", "arg_12", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1=22050, arg_2=None, **arg_3):\n    '''Sonify multi-level segmentations'''\n\n    # Pentatonic scale, because why not\n    arg_4 = [1, 32./27, 4./3, 3./2, 16./9]\n    arg_5 = 0.1\n\n    arg_6, arg_7 = hierarchy_flatten(arg_0)\n\n    if arg_2 is None:\n        arg_2 = int(arg_1 * (max(np.max(arg_7) for arg_7 in arg_6) + 1. / arg_5) + 1)\n\n    arg_8 = 0.0\n    for arg_9, (arg_10, arg_11) in zip(arg_6, product(range(3, 3 + len(arg_6)),\n                                                arg_4)):\n        arg_12 = mkclick(440.0 * arg_11 * arg_10, arg_1=arg_1, duration=arg_5)\n        arg_8 = arg_8 + filter_kwargs(mir_eval.sonify.clicks,\n                              np.unique(arg_9),\n                              fs=arg_1, arg_2=arg_2,\n                              arg_12=arg_12)\n    return arg_8", "path": "jams/sonify.py", "identifier": "multi_segment", "docstring": "Sonify multi-level segmentations", "docstring_tokens": ["Sonify", "multi", "-", "level", "segmentations"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 253986}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L717-L784", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Load Flickr25K dataset.", "language": "python", "parameters": "(tag='sky', path=\"data\", n_threads=50, printable=False)", "return_statement": "return images", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'sky'", ",", "arg_1", "=", "\"data\"", ",", "arg_2", "=", "50", ",", "arg_3", "=", "False", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "'flickr25k'", ")", "arg_4", "=", "'mirflickr25k.zip'", "arg_5", "=", "'http://press.liacs.nl/mirflickr/mirflickr25k/'", "if", "folder_exists", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"mirflickr\"", ")", ")", "is", "False", ":", "logging", ".", "info", "(", "\"[*] Flickr25k is nonexistent in {}\"", ".", "format", "(", "arg_1", ")", ")", "maybe_download_and_extract", "(", "arg_4", ",", "arg_1", ",", "arg_5", ",", "extract", "=", "True", ")", "del_file", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", ")", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"mirflickr\"", ")", "arg_7", "=", "load_file_list", "(", "arg_1", "=", "arg_6", ",", "regx", "=", "'\\\\.jpg'", ",", "arg_3", "=", "False", ")", "arg_7", ".", "sort", "(", "key", "=", "natural_keys", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"mirflickr\"", ",", "\"meta\"", ",", "\"tags\"", ")", "arg_9", "=", "load_file_list", "(", "arg_1", "=", "arg_8", ",", "regx", "=", "'\\\\.txt'", ",", "arg_3", "=", "False", ")", "arg_9", ".", "sort", "(", "key", "=", "natural_keys", ")", "if", "arg_0", "is", "None", ":", "logging", ".", "info", "(", "\"[Flickr25k] reading all images\"", ")", "else", ":", "logging", ".", "info", "(", "\"[Flickr25k] reading images with tag: {}\"", ".", "format", "(", "arg_0", ")", ")", "arg_10", "=", "[", "]", "for", "arg_11", ",", "arg_12", "in", "enumerate", "(", "arg_9", ")", ":", "arg_13", "=", "read_file", "(", "os", ".", "path", ".", "join", "(", "arg_8", ",", "arg_9", "[", "arg_11", "]", ")", ")", ".", "split", "(", "'\\n'", ")", "if", "arg_0", "is", "None", "or", "arg_0", "in", "arg_13", ":", "arg_10", ".", "append", "(", "arg_7", "[", "arg_11", "]", ")", "arg_14", "=", "visualize", ".", "read_images", "(", "arg_10", ",", "arg_6", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "arg_14"], "function": "def Func(arg_0='sky', arg_1=\"data\", arg_2=50, arg_3=False):\n    \"\"\"Load Flickr25K dataset.\n\n    Returns a list of images by a given tag from Flick25k dataset,\n    it will download Flickr25k from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__\n    at the first time you use it.\n\n    Parameters\n    ------------\n    tag : str or None\n        What images to return.\n            - If you want to get images with tag, use string like 'dog', 'red', see `Flickr Search <https://www.flickr.com/search/>`__.\n            - If you want to get all images, set to ``None``.\n\n    path : str\n        The path that the data is downloaded to, defaults is ``data/flickr25k/``.\n    n_threads : int\n        The number of thread to read image.\n    printable : boolean\n        Whether to print infomation when reading images, default is ``False``.\n\n    Examples\n    -----------\n    Get images with tag of sky\n\n    >>> images = tl.files.Func(tag='sky')\n\n    Get all images\n\n    >>> images = tl.files.Func(tag=None, n_threads=100, printable=True)\n\n    \"\"\"\n    arg_1 = os.path.join(arg_1, 'flickr25k')\n\n    arg_4 = 'mirflickr25k.zip'\n    arg_5 = 'http://press.liacs.nl/mirflickr/mirflickr25k/'\n\n    # download dataset\n    if folder_exists(os.path.join(arg_1, \"mirflickr\")) is False:\n        logging.info(\"[*] Flickr25k is nonexistent in {}\".format(arg_1))\n        maybe_download_and_extract(arg_4, arg_1, arg_5, extract=True)\n        del_file(os.path.join(arg_1, arg_4))\n\n    # return images by the given tag.\n    # 1. image path list\n    arg_6 = os.path.join(arg_1, \"mirflickr\")\n    arg_7 = load_file_list(arg_1=arg_6, regx='\\\\.jpg', arg_3=False)\n    arg_7.sort(key=natural_keys)\n\n    # 2. tag path list\n    arg_8 = os.path.join(arg_1, \"mirflickr\", \"meta\", \"tags\")\n    arg_9 = load_file_list(arg_1=arg_8, regx='\\\\.txt', arg_3=False)\n    arg_9.sort(key=natural_keys)\n\n    # 3. select images\n    if arg_0 is None:\n        logging.info(\"[Flickr25k] reading all images\")\n    else:\n        logging.info(\"[Flickr25k] reading images with tag: {}\".format(arg_0))\n    arg_10 = []\n    for arg_11, arg_12 in enumerate(arg_9):\n        arg_13 = read_file(os.path.join(arg_8, arg_9[arg_11])).split('\\n')\n        # logging.info(idx+1, tags)\n        if arg_0 is None or arg_0 in arg_13:\n            arg_10.append(arg_7[arg_11])\n\n    arg_14 = visualize.read_images(arg_10, arg_6, arg_2=arg_2, arg_3=arg_3)\n    return arg_14", "path": "tensorlayer/files/utils.py", "identifier": "load_flickr25k_dataset", "docstring": "Load Flickr25K dataset.\n\n    Returns a list of images by a given tag from Flick25k dataset,\n    it will download Flickr25k from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__\n    at the first time you use it.\n\n    Parameters\n    ------------\n    tag : str or None\n        What images to return.\n            - If you want to get images with tag, use string like 'dog', 'red', see `Flickr Search <https://www.flickr.com/search/>`__.\n            - If you want to get all images, set to ``None``.\n\n    path : str\n        The path that the data is downloaded to, defaults is ``data/flickr25k/``.\n    n_threads : int\n        The number of thread to read image.\n    printable : boolean\n        Whether to print infomation when reading images, default is ``False``.\n\n    Examples\n    -----------\n    Get images with tag of sky\n\n    >>> images = tl.files.load_flickr25k_dataset(tag='sky')\n\n    Get all images\n\n    >>> images = tl.files.load_flickr25k_dataset(tag=None, n_threads=100, printable=True)", "docstring_tokens": ["Load", "Flickr25K", "dataset", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 253987}
{"url": "https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L201-L216", "sha": "b8b17d0317fc6728d5586553ab29a7d97e6417fd", "docstring_summary": "Return an error code between 0 and 99.", "language": "python", "parameters": "(level, msg, default=99)", "return_statement": "return default", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "99", ")", ":", "try", ":", "return", "Funcs_by_level", "[", "arg_0", "]", "[", "arg_1", "]", "except", "KeyError", ":", "pass", "if", "arg_1", ".", "count", "(", "'\"'", ")", "==", "2", "and", "' \"'", "in", "arg_1", "and", "arg_1", ".", "endswith", "(", "'\".'", ")", ":", "arg_3", "=", "arg_1", "[", ":", "arg_1", ".", "index", "(", "' \"'", ")", "]", "return", "Funcs_by_level", "[", "arg_0", "]", ".", "get", "(", "arg_3", ",", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=99):\n    \"\"\"Return an error code between 0 and 99.\"\"\"\n    try:\n        return Funcs_by_level[arg_0][arg_1]\n    except KeyError:\n        pass\n    # Following assumes any variable messages take the format\n    # of 'Fixed text \"variable text\".' only:\n    # e.g. 'Unknown directive type \"req\".'\n    # ---> 'Unknown directive type'\n    # e.g. 'Unknown interpreted text role \"need\".'\n    # ---> 'Unknown interpreted text role'\n    if arg_1.count('\"') == 2 and ' \"' in arg_1 and arg_1.endswith('\".'):\n        arg_3 = arg_1[: arg_1.index(' \"')]\n        return Funcs_by_level[arg_0].get(arg_3, arg_2)\n    return arg_2", "path": "flake8_rst_docstrings.py", "identifier": "code_mapping", "docstring": "Return an error code between 0 and 99.", "docstring_tokens": ["Return", "an", "error", "code", "between", "0", "and", "99", "."], "nwo": "peterjc/flake8-rst-docstrings", "score": 0.3935263471523765, "idx": 253988}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L151-L164", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Show current progress message to stderr.\n     This function will remember the previous message so that next time,\n     it will clear the previous message before showing next one.", "language": "python", "parameters": "(msg, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "not", "(", "sys", ".", "stdout", ".", "isatty", "(", ")", "and", "sys", ".", "stderr", ".", "isatty", "(", ")", ")", ":", "return", "arg_2", "=", "(", "arg_0", "%", "arg_1", ")", "if", "Func", ".", "prev_message", ":", "sys", ".", "stderr", ".", "write", "(", "' '", "*", "len", "(", "Func", ".", "prev_message", ")", "+", "'\\r'", ")", "sys", ".", "stderr", ".", "write", "(", "arg_2", "+", "'\\r'", ")", "Func", ".", "prev_message", "=", "arg_2"], "function": "def Func(arg_0, *arg_1):\n  '''Show current progress message to stderr.\n     This function will remember the previous message so that next time,\n     it will clear the previous message before showing next one.\n  '''\n  # Don't show any progress if the output is directed to a file.\n  if not (sys.stdout.isatty() and sys.stderr.isatty()):\n    return\n\n  arg_2 = (arg_0 % arg_1)\n  if Func.prev_message:\n    sys.stderr.write(' ' * len(Func.prev_message) + '\\r')\n  sys.stderr.write(arg_2 + '\\r')\n  Func.prev_message = arg_2", "path": "s4cmd.py", "identifier": "progress", "docstring": "Show current progress message to stderr.\n     This function will remember the previous message so that next time,\n     it will clear the previous message before showing next one.", "docstring_tokens": ["Show", "current", "progress", "message", "to", "stderr", ".", "This", "function", "will", "remember", "the", "previous", "message", "so", "that", "next", "time", "it", "will", "clear", "the", "previous", "message", "before", "showing", "next", "one", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 253989}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L45-L57", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Build a filter that keeps edges whose data dictionaries are super-dictionaries to the given dictionary.", "language": "python", "parameters": "(annotations: Mapping, partial_match: bool = True)", "return_statement": "return annotation_dict_filter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "True", ")", "->", "EdgePredicate", ":", "@", "edge_predicate", "def", "annotation_dict_filter", "(", "arg_4", ":", "arg_5", ")", "->", "arg_3", ":", "return", "subdict_matches", "(", "arg_4", ",", "arg_0", ",", "arg_2", "=", "arg_2", ")", "return", "annotation_dict_filter"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = True) -> EdgePredicate: # noqa: D202\n    \"\"\"Build a filter that keeps edges whose data dictionaries are super-dictionaries to the given dictionary.\n\n    :param annotations: The annotation query dict to match\n    :param partial_match: Should the query values be used as partial or exact matches? Defaults to :code:`True`.\n    \"\"\"\n\n    @edge_predicate\n    def annotation_dict_filter(arg_4: arg_5) -> arg_3:\n        \"\"\"A filter that matches edges with the given dictionary as a sub-dictionary.\"\"\"\n        return subdict_matches(arg_4, arg_0, arg_2=arg_2)\n\n    return annotation_dict_filter", "path": "src/pybel_tools/filters/edge_filters.py", "identifier": "build_edge_data_filter", "docstring": "Build a filter that keeps edges whose data dictionaries are super-dictionaries to the given dictionary.\n\n    :param annotations: The annotation query dict to match\n    :param partial_match: Should the query values be used as partial or exact matches? Defaults to :code:`True`.", "docstring_tokens": ["Build", "a", "filter", "that", "keeps", "edges", "whose", "data", "dictionaries", "are", "super", "-", "dictionaries", "to", "the", "given", "dictionary", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 253990}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/services/colorific.py#L47-L54", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Set the red, green, blue color of the bulb.", "language": "python", "parameters": "(self, r, g, b)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "'\\x58\\x01\\x03\\x01\\xFF\\x00{0}{1}{2}'", ".", "format", "(", "chr", "(", "arg_1", "&", "0xFF", ")", ",", "chr", "(", "arg_2", "&", "0xFF", ")", ",", "chr", "(", "arg_3", "&", "0xFF", ")", ")", "arg_0", ".", "_color", ".", "write_value", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Set the red, green, blue color of the bulb.\"\"\"\n        # See more details on the bulb's protocol from this guide:\n        #   https://learn.adafruit.com/reverse-engineering-a-bluetooth-low-energy-light-bulb/overview\n        arg_4 = '\\x58\\x01\\x03\\x01\\xFF\\x00{0}{1}{2}'.format(chr(arg_1 & 0xFF),\n                                                             chr(arg_2 & 0xFF),\n                                                             chr(arg_3 & 0xFF))\n        arg_0._color.write_value(arg_4)", "path": "Adafruit_BluefruitLE/services/colorific.py", "identifier": "Colorific.set_color", "docstring": "Set the red, green, blue color of the bulb.", "docstring_tokens": ["Set", "the", "red", "green", "blue", "color", "of", "the", "bulb", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 253991}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L4110-L4157", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores a python dictionary as pytable", "language": "python", "parameters": "(self, key, data_to_store, group, fullname, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "**", "arg_5", ")", ":", "if", "arg_1", "in", "arg_3", ":", "raise", "ValueError", "(", "'Dictionary `%s` already exists in `%s`. Appending is not supported (yet).'", ")", "if", "arg_1", "in", "arg_3", ":", "raise", "ValueError", "(", "'Dict `%s` already exists in `%s`. Appending is not supported (yet).'", ")", "arg_6", "=", "{", "}", "for", "arg_7", "in", "arg_2", ":", "arg_8", "=", "arg_2", "[", "arg_7", "]", "arg_6", "[", "arg_7", "]", "=", "[", "arg_8", "]", "arg_9", "=", "ObjectTable", "(", "data", "=", "arg_6", ")", "arg_0", ".", "_prm_write_into_pytable", "(", "arg_1", ",", "arg_9", ",", "arg_3", ",", "arg_4", ",", "**", "arg_5", ")", "arg_10", "=", "arg_3", ".", "_f_get_child", "(", "arg_1", ")", "arg_0", ".", "_all_set_attributes_to_recall_natives", "(", "arg_6", ",", "arg_10", ",", "HDF5StorageService", ".", "DATA_PREFIX", ")", "setattr", "(", "arg_10", ".", "_v_attrs", ",", "HDF5StorageService", ".", "STORAGE_TYPE", ",", "HDF5StorageService", ".", "DICT", ")", "arg_0", ".", "_hdf5file", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, **arg_5):\n        \"\"\"Stores a python dictionary as pytable\n\n        :param key:\n\n            Name of data item to store\n\n        :param data_to_store:\n\n            Dictionary to store\n\n        :param group:\n\n            Group node where to store data in hdf5 file\n\n        :param fullname:\n\n            Full name of the `data_to_store`s original container, only needed for throwing errors.\n\n        \"\"\"\n        if arg_1 in arg_3:\n            raise ValueError(\n                'Dictionary `%s` already exists in `%s`. Appending is not supported (yet).')\n\n        if arg_1 in arg_3:\n            raise ValueError('Dict `%s` already exists in `%s`. Appending is not supported (yet).')\n\n        arg_6 = {}\n        for arg_7 in arg_2:\n            arg_8 = arg_2[arg_7]\n            arg_6[arg_7] = [arg_8]\n\n        # Convert dictionary to object table\n        arg_9 = ObjectTable(data=arg_6)\n\n        # Then store the object table\n        arg_0._prm_write_into_pytable(arg_1, arg_9, arg_3, arg_4, **arg_5)\n\n        arg_10 = arg_3._f_get_child(arg_1)\n\n        # Remember that the Object Table represents a dictionary\n        arg_0._all_set_attributes_to_recall_natives(arg_6, arg_10,\n                                                   HDF5StorageService.DATA_PREFIX)\n\n        setattr(arg_10._v_attrs, HDF5StorageService.STORAGE_TYPE,\n                HDF5StorageService.DICT)\n\n        arg_0._hdf5file.flush()", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._prm_write_dict_as_table", "docstring": "Stores a python dictionary as pytable\n\n        :param key:\n\n            Name of data item to store\n\n        :param data_to_store:\n\n            Dictionary to store\n\n        :param group:\n\n            Group node where to store data in hdf5 file\n\n        :param fullname:\n\n            Full name of the `data_to_store`s original container, only needed for throwing errors.", "docstring_tokens": ["Stores", "a", "python", "dictionary", "as", "pytable"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 253992}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/dsl.py#L591-L595", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Add a read_range primitive", "language": "python", "parameters": "(self, sequence, begin, end)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_1", ".", "parser_tree", "=", "parsing", ".", "Range", "(", "arg_0", ".", "value", "(", "arg_2", ")", ".", "strip", "(", "\"'\"", ")", ",", "arg_0", ".", "value", "(", "arg_3", ")", ".", "strip", "(", "\"'\"", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Add a read_range primitive\"\"\"\n    arg_1.parser_tree = parsing.Range(arg_0.value(arg_2).strip(\"'\"),\n                                         arg_0.value(arg_3).strip(\"'\"))\n    return True", "path": "pyrser/dsl.py", "identifier": "add_range", "docstring": "Add a read_range primitive", "docstring_tokens": ["Add", "a", "read_range", "primitive"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 253993}
{"url": "https://github.com/lc-guy/limf/blob/ad380feb70ef8e579a91ca09c807efec9e8af565/limf/decrypter.py#L14-L46", "sha": "ad380feb70ef8e579a91ca09c807efec9e8af565", "docstring_summary": "Decrypts file from entered links", "language": "python", "parameters": "(file_link)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "ENCRYPTION_DISABLED", ":", "print", "(", "'For decryption please install gpg'", ")", "exit", "(", ")", "try", ":", "arg_1", "=", "re", ".", "findall", "(", "r'(.*/(.*))#(.{30})'", ",", "arg_0", ")", "[", "0", "]", "arg_2", "=", "urllib", ".", "request", ".", "Request", "(", "arg_1", "[", "0", "]", ",", "data", "=", "None", ",", "headers", "=", "{", "'User-Agent'", ":", "'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) '", "' AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'", "}", ")", "arg_3", "=", "urllib", ".", "request", ".", "urlopen", "(", "arg_2", ")", "arg_4", "=", "arg_3", ".", "read", "(", ")", "arg_5", ",", "arg_6", "=", "os", ".", "pipe", "(", ")", "arg_7", "=", "'gpg --batch --decrypt --passphrase-fd {}'", ".", "format", "(", "arg_5", ")", "arg_8", "=", "Popen", "(", "shlex", ".", "split", "(", "arg_7", ")", ",", "stdout", "=", "PIPE", ",", "stdin", "=", "PIPE", ",", "arg_10", "=", "PIPE", ",", "pass_fds", "=", "(", "arg_5", ",", ")", ")", "os", ".", "close", "(", "arg_5", ")", "open", "(", "arg_6", ",", "'w'", ")", ".", "write", "(", "arg_1", "[", "2", "]", ")", "arg_9", ",", "arg_10", "=", "arg_8", ".", "communicate", "(", "arg_4", ")", "with", "open", "(", "arg_1", "[", "1", "]", ",", "'wb'", ")", "as", "decrypted_file", ":", "decrypted_file", ".", "write", "(", "arg_9", ")", "return", "arg_1", "[", "1", "]", "+", "' is decrypted and saved.'", "except", "IndexError", ":", "return", "'Please enter valid link.'"], "function": "def Func(arg_0):\n    \"\"\"\n    Decrypts file from entered links\n    \"\"\"\n    if ENCRYPTION_DISABLED:\n        print('For decryption please install gpg')\n        exit()\n    try:\n        arg_1 = re.findall(r'(.*/(.*))#(.{30})', arg_0)[0]\n        arg_2 = urllib.request.Request(\n            arg_1[0],\n            data=None,\n            headers={\n                'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) ' \\\n                ' AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'\n                }\n        )\n        #downloads the file using fake useragent\n        arg_3 = urllib.request.urlopen(arg_2)\n        arg_4 = arg_3.read()\n        #decrypts the data using piping to ggp\n        arg_5, arg_6 = os.pipe()\n        arg_7 = 'gpg --batch --decrypt --passphrase-fd {}'.format(arg_5)\n        arg_8 = Popen(shlex.split(arg_7), stdout=PIPE, stdin=PIPE, arg_10=PIPE, \\\n                         pass_fds=(arg_5,))\n        os.close(arg_5)\n        open(arg_6, 'w').write(arg_1[2])\n        arg_9, arg_10 = arg_8.communicate(arg_4)\n        with open(arg_1[1], 'wb') as decrypted_file:\n            decrypted_file.write(arg_9)\n        return arg_1[1] + ' is decrypted and saved.'\n    except IndexError:\n        return 'Please enter valid link.'", "path": "limf/decrypter.py", "identifier": "decrypt_files", "docstring": "Decrypts file from entered links", "docstring_tokens": ["Decrypts", "file", "from", "entered", "links"], "nwo": "lc-guy/limf", "score": 0.28168436607245656, "idx": 253994}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth2.py#L636-L661", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Return client credentials based on the current request.", "language": "python", "parameters": "(self, request)", "return_statement": "return None, None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "client_id", "is", "not", "None", ":", "return", "arg_1", ".", "client_id", ",", "arg_1", ".", "client_secret", "arg_2", "=", "arg_1", ".", "headers", ".", "get", "(", "'Authorization'", ")", "if", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "return", "arg_2", "[", "'username'", "]", ",", "arg_2", "[", "'password'", "]", "return", "None", ",", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return client credentials based on the current request.\n\n        According to the rfc6749, client MAY use the HTTP Basic authentication\n        scheme as defined in [RFC2617] to authenticate with the authorization\n        server. The client identifier is encoded using the\n        \"application/x-www-form-urlencoded\" encoding algorithm per Appendix B,\n        and the encoded value is used as the username; the client password is\n        encoded using the same algorithm and used as the password. The\n        authorization server MUST support the HTTP Basic authentication scheme\n        for authenticating clients that were issued a client password.\n        See `Section 2.3.1`_.\n\n        .. _`Section 2.3.1`: https://tools.ietf.org/html/rfc6749#section-2.3.1\n        \"\"\"\n        if arg_1.client_id is not None:\n            return arg_1.client_id, arg_1.client_secret\n\n        arg_2 = arg_1.headers.get('Authorization')\n        # If Werkzeug successfully parsed the Authorization header,\n        # `extract_params` helper will replace the header with a parsed dict,\n        # otherwise, there is nothing useful in the header and we just skip it.\n        if isinstance(arg_2, dict):\n            return arg_2['username'], arg_2['password']\n\n        return None, None", "path": "flask_oauthlib/provider/oauth2.py", "identifier": "OAuth2RequestValidator._get_client_creds_from_request", "docstring": "Return client credentials based on the current request.\n\n        According to the rfc6749, client MAY use the HTTP Basic authentication\n        scheme as defined in [RFC2617] to authenticate with the authorization\n        server. The client identifier is encoded using the\n        \"application/x-www-form-urlencoded\" encoding algorithm per Appendix B,\n        and the encoded value is used as the username; the client password is\n        encoded using the same algorithm and used as the password. The\n        authorization server MUST support the HTTP Basic authentication scheme\n        for authenticating clients that were issued a client password.\n        See `Section 2.3.1`_.\n\n        .. _`Section 2.3.1`: https://tools.ietf.org/html/rfc6749#section-2.3.1", "docstring_tokens": ["Return", "client", "credentials", "based", "on", "the", "current", "request", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 253995}
{"url": "https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L110-L121", "sha": "2092b0cb30898139a247176bcf433d5a4abde7cb", "docstring_summary": "Given a stream, a callback and an optional transform, sets up the subscription", "language": "python", "parameters": "(self, stream, callback, transform=\"\")", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"\"", ")", ":", "if", "arg_0", ".", "status", "==", "\"disconnected\"", "or", "arg_0", ".", "status", "==", "\"disconnecting\"", "or", "arg_0", ".", "status", "==", "\"connecting\"", ":", "arg_0", ".", "connect", "(", ")", "if", "arg_0", ".", "status", "is", "not", "\"connected\"", ":", "return", "False", "logging", ".", "debug", "(", "\"Subscribing to %s\"", ",", "arg_1", ")", "arg_0", ".", "send", "(", "{", "\"cmd\"", ":", "\"Func\"", ",", "\"arg\"", ":", "arg_1", ",", "\"transform\"", ":", "arg_3", "}", ")", "with", "arg_0", ".", "subscription_lock", ":", "arg_0", ".", "subscriptions", "[", "arg_1", "+", "\":\"", "+", "arg_3", "]", "=", "arg_2", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=\"\"):\n        \"\"\"Given a stream, a callback and an optional transform, sets up the subscription\"\"\"\n        if arg_0.status == \"disconnected\" or arg_0.status == \"disconnecting\" or arg_0.status == \"connecting\":\n            arg_0.connect()\n        if arg_0.status is not \"connected\":\n            return False\n        logging.debug(\"Subscribing to %s\", arg_1)\n\n        arg_0.send({\"cmd\": \"Func\", \"arg\": arg_1, \"transform\": arg_3})\n        with arg_0.subscription_lock:\n            arg_0.subscriptions[arg_1 + \":\" + arg_3] = arg_2\n        return True", "path": "connectordb/_websocket.py", "identifier": "WebsocketHandler.subscribe", "docstring": "Given a stream, a callback and an optional transform, sets up the subscription", "docstring_tokens": ["Given", "a", "stream", "a", "callback", "and", "an", "optional", "transform", "sets", "up", "the", "subscription"], "nwo": "connectordb/connectordb-python", "score": 0.25890992733444657, "idx": 253996}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/views.py#L299-L302", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Display a specific structural variant.", "language": "python", "parameters": "(institute_id, case_name, variant_id)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "controllers", ".", "Func", "(", "store", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Display a specific structural variant.\"\"\"\n    arg_3 = controllers.Func(store, arg_0, arg_1, arg_2)\n    return arg_3", "path": "scout/server/blueprints/variants/views.py", "identifier": "sv_variant", "docstring": "Display a specific structural variant.", "docstring_tokens": ["Display", "a", "specific", "structural", "variant", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 253997}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/db.py#L921-L928", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Reassemble a Binder object coming out of the database.", "language": "python", "parameters": "(id, tree, metadata)", "return_statement": "return binder", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "cnxepub", ".", "Binder", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "for", "arg_4", "in", "arg_1", "[", "'contents'", "]", ":", "arg_5", "=", "_node_to_model", "(", "arg_4", ",", "parent", "=", "arg_3", ")", "if", "arg_5", ".", "metadata", "[", "'title'", "]", "!=", "arg_4", "[", "'title'", "]", ":", "arg_3", ".", "set_title_for_node", "(", "arg_5", ",", "arg_4", "[", "'title'", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Reassemble a Binder object coming out of the database.\"\"\"\n    arg_3 = cnxepub.Binder(arg_0, arg_2=arg_2)\n    for arg_4 in arg_1['contents']:\n        arg_5 = _node_to_model(arg_4, parent=arg_3)\n        if arg_5.metadata['title'] != arg_4['title']:\n            arg_3.set_title_for_node(arg_5, arg_4['title'])\n    return arg_3", "path": "cnxpublishing/db.py", "identifier": "_reassemble_binder", "docstring": "Reassemble a Binder object coming out of the database.", "docstring_tokens": ["Reassemble", "a", "Binder", "object", "coming", "out", "of", "the", "database", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 253998}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/create_key_pair.py#L484-L568", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the CreateKeyPair response payload and decode it\n        into its constituent parts.", "language": "python", "parameters": "(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "CreateKeyPairResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_0", ".", "_private_key_unique_identifier", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_UNIQUE_IDENTIFIER", ")", "arg_0", ".", "_private_key_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The CreateKeyPair response payload encoding is missing the \"", "\"private key unique identifier.\"", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_0", ".", "_public_key_unique_identifier", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_UNIQUE_IDENTIFIER", ")", "arg_0", ".", "_public_key_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The CreateKeyPair response payload encoding is missing the \"", "\"public key unique identifier.\"", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_TEMPLATE_ATTRIBUTE", ",", "arg_6", ")", ":", "arg_0", ".", "_private_key_template_attribute", "=", "objects", ".", "TemplateAttribute", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_TEMPLATE_ATTRIBUTE", ")", "arg_0", ".", "_private_key_template_attribute", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_TEMPLATE_ATTRIBUTE", ",", "arg_6", ")", ":", "arg_0", ".", "_public_key_template_attribute", "=", "objects", ".", "TemplateAttribute", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_TEMPLATE_ATTRIBUTE", ")", "arg_0", ".", "_public_key_template_attribute", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the CreateKeyPair response payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data buffer containing encoded object\n                data, supporting a Func method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidKmipEncoding: Raised if the private key unique identifier or\n                the public key unique identifier is missing from the encoded\n                payload.\n        \"\"\"\n        super(CreateKeyPairResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(\n                arg_3.Tags.PRIVATE_KEY_UNIQUE_IDENTIFIER,\n                arg_6\n        ):\n            arg_0._private_key_unique_identifier = primitives.TextString(\n                tag=arg_3.Tags.PRIVATE_KEY_UNIQUE_IDENTIFIER\n            )\n            arg_0._private_key_unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise exceptions.InvalidKmipEncoding(\n                \"The CreateKeyPair response payload encoding is missing the \"\n                \"private key unique identifier.\"\n            )\n\n        if arg_0.is_tag_next(\n                arg_3.Tags.PUBLIC_KEY_UNIQUE_IDENTIFIER,\n                arg_6\n        ):\n            arg_0._public_key_unique_identifier = primitives.TextString(\n                tag=arg_3.Tags.PUBLIC_KEY_UNIQUE_IDENTIFIER\n            )\n            arg_0._public_key_unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise exceptions.InvalidKmipEncoding(\n                \"The CreateKeyPair response payload encoding is missing the \"\n                \"public key unique identifier.\"\n            )\n\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            if arg_0.is_tag_next(\n                    arg_3.Tags.PRIVATE_KEY_TEMPLATE_ATTRIBUTE,\n                    arg_6\n            ):\n                arg_0._private_key_template_attribute = \\\n                    objects.TemplateAttribute(\n                        tag=arg_3.Tags.PRIVATE_KEY_TEMPLATE_ATTRIBUTE\n                    )\n                arg_0._private_key_template_attribute.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n\n            if arg_0.is_tag_next(\n                    arg_3.Tags.PUBLIC_KEY_TEMPLATE_ATTRIBUTE,\n                    arg_6\n            ):\n                arg_0._public_key_template_attribute = \\\n                    objects.TemplateAttribute(\n                        tag=arg_3.Tags.PUBLIC_KEY_TEMPLATE_ATTRIBUTE\n                    )\n                arg_0._public_key_template_attribute.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/create_key_pair.py", "identifier": "CreateKeyPairResponsePayload.read", "docstring": "Read the data encoding the CreateKeyPair response payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data buffer containing encoded object\n                data, supporting a read method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidKmipEncoding: Raised if the private key unique identifier or\n                the public key unique identifier is missing from the encoded\n                payload.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "CreateKeyPair", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 253999}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/misc/neo demo.py#L9-L22", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "simple example how to load an ABF file and plot every sweep.", "language": "python", "parameters": "(abfFile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "io", ".", "AxonIO", "(", "filename", "=", "arg_0", ")", "arg_2", "=", "arg_1", ".", "read_block", "(", "lazy", "=", "False", ",", "cascade", "=", "True", ")", "print", "(", "arg_0", "+", "\"\\nplotting %d sweeps...\"", "%", "len", "(", "arg_2", ".", "segments", ")", ")", "plt", ".", "figure", "(", "figsize", "=", "(", "12", ",", "10", ")", ")", "plt", ".", "title", "(", "arg_0", ")", "for", "arg_3", "in", "range", "(", "len", "(", "arg_2", ".", "segments", ")", ")", ":", "arg_4", "=", "arg_2", ".", "segments", "[", "arg_3", "]", ".", "analogsignals", "[", "0", "]", "plt", ".", "plot", "(", "arg_4", ".", "times", "-", "arg_4", ".", "times", "[", "0", "]", ",", "arg_4", ".", "magnitude", ",", "alpha", "=", ".5", ")", "plt", ".", "ylabel", "(", "arg_4", ".", "dimensionality", ")", "plt", ".", "xlabel", "(", "\"seconds\"", ")", "plt", ".", "show", "(", ")", "plt", ".", "close", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"simple example how to load an ABF file and plot every sweep.\"\"\"\n    arg_1 = io.AxonIO(filename=arg_0)\n    arg_2 = arg_1.read_block(lazy=False, cascade=True)     \n    print(arg_0+\"\\nplotting %d sweeps...\"%len(arg_2.segments))\n    plt.figure(figsize=(12,10))\n    plt.title(arg_0)\n    for arg_3 in range(len(arg_2.segments)):\n        arg_4 = arg_2.segments[arg_3].analogsignals[0]\n        plt.plot(arg_4.times-arg_4.times[0],arg_4.magnitude,alpha=.5)    \n    plt.ylabel(arg_4.dimensionality)\n    plt.xlabel(\"seconds\")\n    plt.show()\n    plt.close()", "path": "doc/misc/neo demo.py", "identifier": "plotAllSweeps", "docstring": "simple example how to load an ABF file and plot every sweep.", "docstring_tokens": ["simple", "example", "how", "to", "load", "an", "ABF", "file", "and", "plot", "every", "sweep", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 254000}
{"url": "https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/stats.py#L56-L59", "sha": "f546ad171750cd7685afbde6785fe71f82cadb35", "docstring_summary": "Find matching q-value for each score in 'scores'", "language": "python", "parameters": "(scores, err_df)", "return_statement": "return err_df.pvalue.iloc[ix].values, err_df.svalue.iloc[ix].values, err_df.pep.iloc[ix].values, err_df.qvalue.iloc[ix].values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "find_nearest_matches", "(", "np", ".", "float32", "(", "arg_1", ".", "cutoff", ".", "values", ")", ",", "np", ".", "float32", "(", "arg_0", ")", ")", "return", "arg_1", ".", "pvalue", ".", "iloc", "[", "arg_2", "]", ".", "values", ",", "arg_1", ".", "svalue", ".", "iloc", "[", "arg_2", "]", ".", "values", ",", "arg_1", ".", "pep", ".", "iloc", "[", "arg_2", "]", ".", "values", ",", "arg_1", ".", "qvalue", ".", "iloc", "[", "arg_2", "]", ".", "values"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Find matching q-value for each score in 'scores' \"\"\"\n    arg_2 = find_nearest_matches(np.float32(arg_1.cutoff.values), np.float32(arg_0))\n    return arg_1.pvalue.iloc[arg_2].values, arg_1.svalue.iloc[arg_2].values, arg_1.pep.iloc[arg_2].values, arg_1.qvalue.iloc[arg_2].values", "path": "pyprophet/stats.py", "identifier": "lookup_values_from_error_table", "docstring": "Find matching q-value for each score in 'scores'", "docstring_tokens": ["Find", "matching", "q", "-", "value", "for", "each", "score", "in", "scores"], "nwo": "PyProphet/pyprophet", "score": 0.38514621847307956, "idx": 254001}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/preprocessing/split.py#L11-L90", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Split one long analysis file into multiple smaller ones.", "language": "python", "parameters": "(file, outdir=None, split_pattern=None, global_header_rows=0, fname_pattern=None, trim_tail_lines=0, trim_head_lines=0)", "return_statement": "return outdir", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ",", "arg_4", "=", "None", ",", "arg_5", "=", "0", ",", "arg_6", "=", "0", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", ",", "'split'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "os", ".", "mkdir", "(", "arg_1", ")", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "f", ":", "arg_7", "=", "f", ".", "readlines", "(", ")", "arg_8", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "[", "-", "1", "]", "arg_9", "=", "arg_7", "[", ":", "arg_3", "]", "arg_10", "=", "[", "]", "for", "arg_11", ",", "arg_12", "in", "enumerate", "(", "arg_7", ")", ":", "if", "re", ".", "search", "(", "arg_2", ",", "arg_12", ")", ":", "arg_10", ".", "append", "(", "arg_11", ")", "arg_10", ".", "append", "(", "len", "(", "arg_7", ")", ")", "arg_13", "=", "{", "}", "for", "arg_11", "in", "range", "(", "len", "(", "arg_10", ")", "-", "1", ")", ":", "arg_14", "=", "re", ".", "search", "(", "arg_4", ",", "arg_7", "[", "arg_10", "[", "arg_11", "]", "]", ")", "if", "arg_14", ":", "arg_15", "=", "arg_14", ".", "groups", "(", ")", "[", "0", "]", ".", "strip", "(", ")", "else", ":", "arg_15", "=", "'no_name_{:}'", ".", "format", "(", "arg_11", ")", "arg_13", "[", "arg_15", "]", "=", "arg_9", "+", "arg_7", "[", "arg_10", "[", "arg_11", "]", ":", "arg_10", "[", "arg_11", "+", "1", "]", "]", "[", "arg_6", ":", "arg_5", "]", "print", "(", "'Writing files to: {:}'", ".", "format", "(", "arg_1", ")", ")", "for", "arg_16", ",", "arg_17", "in", "arg_13", ".", "items", "(", ")", ":", "arg_15", "=", "(", "arg_16", "+", "arg_8", ")", ".", "replace", "(", "' '", ",", "'_'", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_15", ")", ",", "'w'", ")", "as", "f", ":", "f", ".", "writelines", "(", "arg_17", ")", "print", "(", "'  {:}'", ".", "format", "(", "arg_15", ")", ")", "print", "(", "'Done.'", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=0, arg_4=None, arg_5=0, arg_6=0):\n    \"\"\"\n    Split one long analysis file into multiple smaller ones.\n\n    Parameters\n    ----------\n    file : str\n        The path to the file you want to split.\n    outdir : str\n        The directory to save the split files to.\n        If None, files are saved to a new directory\n        called 'split', which is created inside the\n        data directory.\n    split_pattern : regex string\n        A regular expression that will match lines in the\n        file that mark the start of a new section. Does\n        not have to match the whole line, but must provide\n        a positive match to the lines containing the pattern.\n    global_header_rows : int\n        How many rows at the start of the file to include\n        in each new sub-file.\n    fname_pattern : regex string\n        A regular expression that identifies a new file name\n        in the lines identified by split_pattern. If none,\n        files will be called 'noname_N'. The extension of the\n        main file will be used for all sub-files.\n    trim_head_lines : int\n        If greater than zero, this many lines are removed from the start of each segment\n    trim_tail_lines : int\n        If greater than zero, this many lines are removed from the end of each segment\n\n    Returns\n    -------\n    Path to new directory : str\n    \"\"\"\n    # create output sirectory\n    if arg_1 is None:\n        arg_1 = os.path.join(os.path.dirname(arg_0), 'split')\n    if not os.path.exists(arg_1):\n        os.mkdir(arg_1)\n    \n    # read input file\n    with open(arg_0, 'r') as f:\n        arg_7 = f.readlines()\n    \n    # get file extension\n    arg_8 = os.path.splitext(arg_0)[-1]\n    \n    # grab global header rows\n    arg_9 = arg_7[:arg_3]\n\n    # find indices of lines containing split_pattern\n    arg_10 = []\n    for arg_11, arg_12 in enumerate(arg_7):\n        if re.search(arg_2, arg_12):\n            arg_10.append(arg_11)    \n    arg_10.append(len(arg_7))  # get length of lines\n\n    # split lines into segments based on positions of regex\n    arg_13 = {}\n    for arg_11 in range(len(arg_10) - 1):\n        arg_14 = re.search(arg_4, arg_7[arg_10[arg_11]])\n        if arg_14:\n            arg_15 = arg_14.groups()[0].strip()\n        else:\n            arg_15 = 'no_name_{:}'.format(arg_11)\n\n        arg_13[arg_15] = arg_9 + arg_7[arg_10[arg_11]:arg_10[arg_11+1]][arg_6:arg_5]\n    \n    # write files\n    print('Writing files to: {:}'.format(arg_1))\n    for arg_16, arg_17 in arg_13.items():\n        arg_15 = (arg_16 + arg_8).replace(' ', '_')\n        with open(os.path.join(arg_1, arg_15), 'w') as f:\n            f.writelines(arg_17)\n        print('  {:}'.format(arg_15))\n    \n    print('Done.')\n\n    return arg_1", "path": "latools/preprocessing/split.py", "identifier": "by_regex", "docstring": "Split one long analysis file into multiple smaller ones.\n\n    Parameters\n    ----------\n    file : str\n        The path to the file you want to split.\n    outdir : str\n        The directory to save the split files to.\n        If None, files are saved to a new directory\n        called 'split', which is created inside the\n        data directory.\n    split_pattern : regex string\n        A regular expression that will match lines in the\n        file that mark the start of a new section. Does\n        not have to match the whole line, but must provide\n        a positive match to the lines containing the pattern.\n    global_header_rows : int\n        How many rows at the start of the file to include\n        in each new sub-file.\n    fname_pattern : regex string\n        A regular expression that identifies a new file name\n        in the lines identified by split_pattern. If none,\n        files will be called 'noname_N'. The extension of the\n        main file will be used for all sub-files.\n    trim_head_lines : int\n        If greater than zero, this many lines are removed from the start of each segment\n    trim_tail_lines : int\n        If greater than zero, this many lines are removed from the end of each segment\n\n    Returns\n    -------\n    Path to new directory : str", "docstring_tokens": ["Split", "one", "long", "analysis", "file", "into", "multiple", "smaller", "ones", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 254002}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/streamlet.py#L168-L176", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Return a new Streamlet by outer right join_streamlet with this streamlet", "language": "python", "parameters": "(self, join_streamlet, window_config, join_function)", "return_statement": "return join_streamlet_result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "from", "heronpy", ".", "streamlet", ".", "impl", ".", "joinbolt", "import", "JoinStreamlet", ",", "JoinBolt", "arg_4", "=", "JoinStreamlet", "(", "JoinBolt", ".", "OUTER_RIGHT", ",", "arg_2", ",", "arg_3", ",", "arg_0", ",", "arg_1", ")", "arg_0", ".", "_add_child", "(", "arg_4", ")", "arg_1", ".", "_add_child", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Return a new Streamlet by outer right join_streamlet with this streamlet\n    \"\"\"\n    from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt\n    arg_4 = JoinStreamlet(JoinBolt.OUTER_RIGHT, arg_2,\n                                          arg_3, arg_0, arg_1)\n    arg_0._add_child(arg_4)\n    arg_1._add_child(arg_4)\n    return arg_4", "path": "heronpy/streamlet/streamlet.py", "identifier": "Streamlet.outer_right_join", "docstring": "Return a new Streamlet by outer right join_streamlet with this streamlet", "docstring_tokens": ["Return", "a", "new", "Streamlet", "by", "outer", "right", "join_streamlet", "with", "this", "streamlet"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254003}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_transfer_hook.py#L204-L232", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Deletes a transfer job. This is a soft delete. After a transfer job is\n        deleted, the job and all the transfer executions are subject to garbage\n        collection. Transfer jobs become eligible for garbage collection\n        30 days after soft delete.", "language": "python", "parameters": "(self, job_name, project_id)", "return_statement": "return (\n            self.get_conn()\n            .transferJobs()\n            .patch(\n                jobName=job_name,\n                body={\n                    PROJECT_ID: project_id,\n                    TRANSFER_JOB: {STATUS1: GcpTransferJobsStatus.DELETED},\n                    TRANSFER_JOB_FIELD_MASK: STATUS1,\n                },\n            )\n            .execute(num_retries=self.num_retries)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "(", "arg_0", ".", "get_conn", "(", ")", ".", "transferJobs", "(", ")", ".", "patch", "(", "jobName", "=", "arg_1", ",", "body", "=", "{", "PROJECT_ID", ":", "arg_2", ",", "TRANSFER_JOB", ":", "{", "STATUS1", ":", "GcpTransferJobsStatus", ".", "DELETED", "}", ",", "TRANSFER_JOB_FIELD_MASK", ":", "STATUS1", ",", "}", ",", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Deletes a transfer job. This is a soft delete. After a transfer job is\n        deleted, the job and all the transfer executions are subject to garbage\n        collection. Transfer jobs become eligible for garbage collection\n        30 days after soft delete.\n\n        :param job_name: (Required) Name of the job to be deleted\n        :type job_name: str\n        :param project_id: (Optional) the ID of the project that owns the Transfer\n            Job. If set to None or missing, the default project_id from the GCP\n            connection is used.\n        :type project_id: str\n        :rtype: None\n        \"\"\"\n\n        return (\n            arg_0.get_conn()\n            .transferJobs()\n            .patch(\n                jobName=arg_1,\n                body={\n                    PROJECT_ID: arg_2,\n                    TRANSFER_JOB: {STATUS1: GcpTransferJobsStatus.DELETED},\n                    TRANSFER_JOB_FIELD_MASK: STATUS1,\n                },\n            )\n            .execute(num_retries=arg_0.num_retries)\n        )", "path": "airflow/contrib/hooks/gcp_transfer_hook.py", "identifier": "GCPTransferServiceHook.delete_transfer_job", "docstring": "Deletes a transfer job. This is a soft delete. After a transfer job is\n        deleted, the job and all the transfer executions are subject to garbage\n        collection. Transfer jobs become eligible for garbage collection\n        30 days after soft delete.\n\n        :param job_name: (Required) Name of the job to be deleted\n        :type job_name: str\n        :param project_id: (Optional) the ID of the project that owns the Transfer\n            Job. If set to None or missing, the default project_id from the GCP\n            connection is used.\n        :type project_id: str\n        :rtype: None", "docstring_tokens": ["Deletes", "a", "transfer", "job", ".", "This", "is", "a", "soft", "delete", ".", "After", "a", "transfer", "job", "is", "deleted", "the", "job", "and", "all", "the", "transfer", "executions", "are", "subject", "to", "garbage", "collection", ".", "Transfer", "jobs", "become", "eligible", "for", "garbage", "collection", "30", "days", "after", "soft", "delete", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254004}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py#L760-L774", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "write connection info to JSON dict in self.connection_file", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_connection_file_written", ":", "return", "arg_0", ".", "connection_file", ",", "arg_2", "=", "Func", "(", "arg_0", ".", "connection_file", ",", "ip", "=", "arg_0", ".", "ip", ",", "key", "=", "arg_0", ".", "session", ".", "key", ",", "arg_4", "=", "arg_0", ".", "stdin_port", ",", "arg_5", "=", "arg_0", ".", "iopub_port", ",", "arg_3", "=", "arg_0", ".", "shell_port", ",", "arg_6", "=", "arg_0", ".", "hb_port", ")", "arg_0", ".", "shell_port", "=", "arg_2", "[", "'shell_port'", "]", "arg_0", ".", "stdin_port", "=", "arg_2", "[", "'stdin_port'", "]", "arg_0", ".", "iopub_port", "=", "arg_2", "[", "'iopub_port'", "]", "arg_0", ".", "hb_port", "=", "arg_2", "[", "'hb_port'", "]", "arg_0", ".", "_connection_file_written", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"write connection info to JSON dict in self.connection_file\"\"\"\n        if arg_0._connection_file_written:\n            return\n        arg_0.connection_file,arg_2 = Func(arg_0.connection_file,\n            ip=arg_0.ip, key=arg_0.session.key,\n            arg_4=arg_0.stdin_port, arg_5=arg_0.iopub_port,\n            arg_3=arg_0.shell_port, arg_6=arg_0.hb_port)\n        # Func also sets default ports:\n        arg_0.shell_port = arg_2['shell_port']\n        arg_0.stdin_port = arg_2['stdin_port']\n        arg_0.iopub_port = arg_2['iopub_port']\n        arg_0.hb_port = arg_2['hb_port']\n        \n        arg_0._connection_file_written = True", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py", "identifier": "KernelManager.write_connection_file", "docstring": "write connection info to JSON dict in self.connection_file", "docstring_tokens": ["write", "connection", "info", "to", "JSON", "dict", "in", "self", ".", "connection_file"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254005}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/connection.py#L680-L692", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Log the message `msg` to the destination `self._logging_dest`.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "is_type", "(", "arg_0", ".", "_logging_dest", ",", "str", ")", ":", "with", "open", "(", "arg_0", ".", "_logging_dest", ",", "\"at\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_1", ")", "else", ":", "arg_0", ".", "_logging_dest", ".", "write", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Log the message `msg` to the destination `self._logging_dest`.\n\n        If this destination is a file name, then we append the message to the file and then close the file\n        immediately. If the destination is an open file handle, then we simply write the message there and do not\n        attempt to close it.\n        \"\"\"\n        if is_type(arg_0._logging_dest, str):\n            with open(arg_0._logging_dest, \"at\", encoding=\"utf-8\") as f:\n                f.write(arg_1)\n        else:\n            arg_0._logging_dest.write(arg_1)", "path": "h2o-py/h2o/backend/connection.py", "identifier": "H2OConnection._log_message", "docstring": "Log the message `msg` to the destination `self._logging_dest`.\n\n        If this destination is a file name, then we append the message to the file and then close the file\n        immediately. If the destination is an open file handle, then we simply write the message there and do not\n        attempt to close it.", "docstring_tokens": ["Log", "the", "message", "msg", "to", "the", "destination", "self", ".", "_logging_dest", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 254006}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/thing.py#L423-L440", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Notify all subscribers of a property change.", "language": "python", "parameters": "(self, property_)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "json", ".", "dumps", "(", "{", "'messageType'", ":", "'propertyStatus'", ",", "'data'", ":", "{", "arg_1", ".", "name", ":", "arg_1", ".", "get_value", "(", ")", ",", "}", "}", ")", "for", "arg_3", "in", "list", "(", "arg_0", ".", "subscribers", ")", ":", "try", ":", "arg_3", ".", "write_message", "(", "arg_2", ")", "except", "tornado", ".", "websocket", ".", "WebSocketClosedError", ":", "pass"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Notify all subscribers of a property change.\n\n        property_ -- the property that changed\n        \"\"\"\n        arg_2 = json.dumps({\n            'messageType': 'propertyStatus',\n            'data': {\n                arg_1.name: arg_1.get_value(),\n            }\n        })\n\n        for arg_3 in list(arg_0.subscribers):\n            try:\n                arg_3.write_message(arg_2)\n            except tornado.websocket.WebSocketClosedError:\n                pass", "path": "webthing/thing.py", "identifier": "Thing.property_notify", "docstring": "Notify all subscribers of a property change.\n\n        property_ -- the property that changed", "docstring_tokens": ["Notify", "all", "subscribers", "of", "a", "property", "change", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 254007}
{"url": "https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/client.py#L158-L176", "sha": "e3762f77583f89cf7b4f501ab3c7675fc7d30ab3", "docstring_summary": "Checks if a next message is possible.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "is_initial", ":", "return", "True", "if", "arg_0", ".", "before", ":", "if", "arg_0", ".", "before_cursor", ":", "return", "True", "else", ":", "return", "False", "else", ":", "if", "arg_0", ".", "after_cursor", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"Checks if a next message is possible.\n\n    :returns: True if a next message is possible, otherwise False\n    :rtype: bool\n\n    \"\"\"\n    if arg_0.is_initial:\n      return True\n    if arg_0.before:\n      if arg_0.before_cursor:\n        return True\n      else:\n        return False\n    else:\n      if arg_0.after_cursor:\n        return True\n      else:\n        return False", "path": "cbexchange/client.py", "identifier": "PaginationClient._check_next", "docstring": "Checks if a next message is possible.\n\n    :returns: True if a next message is possible, otherwise False\n    :rtype: bool", "docstring_tokens": ["Checks", "if", "a", "next", "message", "is", "possible", "."], "nwo": "agsimeonov/cbexchange", "score": 0.0, "idx": 254008}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/permutation_helpers.py#L352-L369", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Setup our resultsPerChoice history based on the passed in\n    resultsPerChoice.", "language": "python", "parameters": "(self, resultsPerChoice)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_resultsPerChoice", "=", "[", "[", "]", "]", "*", "len", "(", "arg_0", ".", "choices", ")", "for", "(", "arg_3", ",", "arg_4", ")", "in", "arg_1", ":", "arg_5", "=", "arg_0", ".", "choices", ".", "index", "(", "arg_3", ")", "arg_0", ".", "_resultsPerChoice", "[", "arg_5", "]", "=", "list", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Setup our resultsPerChoice history based on the passed in\n    resultsPerChoice.\n\n    For example, if this variable has the following choices:\n      ['a', 'b', 'c']\n\n    resultsPerChoice will have up to 3 elements, each element is a tuple\n    containing (choiceValue, errors) where errors is the list of errors\n    received from models that used the specific choice:\n    retval:\n      [('a', [0.1, 0.2, 0.3]), ('b', [0.5, 0.1, 0.6]), ('c', [0.2])]\n    \"\"\"\n    # Keep track of the results obtained for each choice.\n    arg_0._resultsPerChoice = [[]] * len(arg_0.choices)\n    for (arg_3, arg_4) in arg_1:\n      arg_5 = arg_0.choices.index(arg_3)\n      arg_0._resultsPerChoice[arg_5] = list(arg_4)", "path": "src/nupic/swarming/hypersearch/permutation_helpers.py", "identifier": "PermuteChoices.setResultsPerChoice", "docstring": "Setup our resultsPerChoice history based on the passed in\n    resultsPerChoice.\n\n    For example, if this variable has the following choices:\n      ['a', 'b', 'c']\n\n    resultsPerChoice will have up to 3 elements, each element is a tuple\n    containing (choiceValue, errors) where errors is the list of errors\n    received from models that used the specific choice:\n    retval:\n      [('a', [0.1, 0.2, 0.3]), ('b', [0.5, 0.1, 0.6]), ('c', [0.2])]", "docstring_tokens": ["Setup", "our", "resultsPerChoice", "history", "based", "on", "the", "passed", "in", "resultsPerChoice", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254009}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/mixture_same_family.py#L542-L562", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Enables uniform interface to value and batch jacobian calculation.", "language": "python", "parameters": "(f, x)", "return_statement": "return value, batch_jacobian", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "tf", ".", "executing_eagerly", "(", ")", ":", "with", "tf", ".", "GradientTape", "(", ")", "as", "tape", ":", "tape", ".", "watch", "(", "arg_1", ")", "arg_2", "=", "arg_0", "(", "arg_1", ")", "arg_3", "=", "tape", ".", "batch_jacobian", "(", "arg_2", ",", "arg_1", ")", "else", ":", "arg_2", "=", "arg_0", "(", "arg_1", ")", "arg_3", "=", "gradients", ".", "batch_jacobian", "(", "arg_2", ",", "arg_1", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Enables uniform interface to value and batch jacobian calculation.\n\n  Works in both eager and graph modes.\n\n  Arguments:\n    f: The scalar function to evaluate.\n    x: The value at which to compute the value and the batch jacobian.\n\n  Returns:\n    A tuple (f(x), J(x)), where J(x) is the batch jacobian.\n  \"\"\"\n  if tf.executing_eagerly():\n    with tf.GradientTape() as tape:\n      tape.watch(arg_1)\n      arg_2 = arg_0(arg_1)\n    arg_3 = tape.batch_jacobian(arg_2, arg_1)\n  else:\n    arg_2 = arg_0(arg_1)\n    arg_3 = gradients.batch_jacobian(arg_2, arg_1)\n  return arg_2, arg_3", "path": "tensorflow_probability/python/distributions/mixture_same_family.py", "identifier": "_value_and_batch_jacobian", "docstring": "Enables uniform interface to value and batch jacobian calculation.\n\n  Works in both eager and graph modes.\n\n  Arguments:\n    f: The scalar function to evaluate.\n    x: The value at which to compute the value and the batch jacobian.\n\n  Returns:\n    A tuple (f(x), J(x)), where J(x) is the batch jacobian.", "docstring_tokens": ["Enables", "uniform", "interface", "to", "value", "and", "batch", "jacobian", "calculation", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254010}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/url.py#L162-L183", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Return a django-style database configuration based on ``url``.", "language": "python", "parameters": "(url)", "return_statement": "return {key.upper(): val for key, val in parse_database_url(url)._asdict().items()}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "arg_1", ".", "upper", "(", ")", ":", "arg_2", "for", "arg_1", ",", "arg_2", "in", "parse_database_url", "(", "arg_0", ")", ".", "_asdict", "(", ")", ".", "items", "(", ")", "}"], "function": "def Func(arg_0):\n    \"\"\"\n    Return a django-style database configuration based on ``url``.\n\n    :param url: Database URL\n    :return: Django-style database configuration dict\n\n    Example:\n    >>> conf = Func(\n    ...     'pgsql://joar:hunter2@5monkeys.se:4242/tweets/tweetschema'\n    ...     '?hello=world')\n    >>> sorted(conf.items())  # doctest: +NORMALIZE_WHITESPACE\n    [('ENGINE', 'django.db.backends.postgresql_psycopg2'),\n     ('HOST', '5monkeys.se'),\n     ('NAME', 'tweets'),\n     ('PARAMS', {'hello': 'world'}),\n     ('PASSWORD', 'hunter2'),\n     ('PORT', 4242),\n     ('SCHEMA', 'tweetschema'),\n     ('USER', 'joar')]\n    \"\"\"\n    return {arg_1.upper(): arg_2 for arg_1, arg_2 in parse_database_url(arg_0)._asdict().items()}", "path": "bananas/url.py", "identifier": "database_conf_from_url", "docstring": "Return a django-style database configuration based on ``url``.\n\n    :param url: Database URL\n    :return: Django-style database configuration dict\n\n    Example:\n    >>> conf = database_conf_from_url(\n    ...     'pgsql://joar:hunter2@5monkeys.se:4242/tweets/tweetschema'\n    ...     '?hello=world')\n    >>> sorted(conf.items())  # doctest: +NORMALIZE_WHITESPACE\n    [('ENGINE', 'django.db.backends.postgresql_psycopg2'),\n     ('HOST', '5monkeys.se'),\n     ('NAME', 'tweets'),\n     ('PARAMS', {'hello': 'world'}),\n     ('PASSWORD', 'hunter2'),\n     ('PORT', 4242),\n     ('SCHEMA', 'tweetschema'),\n     ('USER', 'joar')]", "docstring_tokens": ["Return", "a", "django", "-", "style", "database", "configuration", "based", "on", "url", "."], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 254011}
{"url": "https://github.com/ndokter/dsmr_parser/blob/c04b0a5add58ce70153eede1a87ca171876b61c7/dsmr_parser/clients/serial_.py#L51-L78", "sha": "c04b0a5add58ce70153eede1a87ca171876b61c7", "docstring_summary": "Read complete DSMR telegram's from the serial interface and parse it\n        into CosemObject's and MbusObject's.", "language": "python", "parameters": "(self, queue)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "serial_asyncio", ".", "open_serial_connection", "(", "**", "arg_0", ".", "serial_settings", ")", "arg_3", ",", "arg_4", "=", "yield", "from", "arg_2", "while", "True", ":", "arg_5", "=", "yield", "from", "arg_3", ".", "Funcline", "(", ")", "arg_0", ".", "telegram_buffer", ".", "append", "(", "arg_5", ".", "decode", "(", "'ascii'", ")", ")", "for", "arg_6", "in", "arg_0", ".", "telegram_buffer", ".", "get_all", "(", ")", ":", "try", ":", "arg_1", ".", "put_nowait", "(", "arg_0", ".", "telegram_parser", ".", "parse", "(", "arg_6", ")", ")", "except", "ParseError", "as", "e", ":", "logger", ".", "warning", "(", "'Failed to parse telegram: %s'", ",", "e", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Read complete DSMR telegram's from the serial interface and parse it\n        into CosemObject's and MbusObject's.\n\n        Instead of being a generator, values are pushed to provided queue for\n        asynchronous processing.\n\n        :rtype: None\n        \"\"\"\n        # create Serial StreamReader\n        arg_2 = serial_asyncio.open_serial_connection(**arg_0.serial_settings)\n        arg_3, arg_4 = yield from arg_2\n\n        while True:\n            # Read line if available or give control back to loop until new\n            # data has arrived.\n            arg_5 = yield from arg_3.Funcline()\n            arg_0.telegram_buffer.append(arg_5.decode('ascii'))\n\n            for arg_6 in arg_0.telegram_buffer.get_all():\n                try:\n                    # Push new parsed telegram onto queue.\n                    arg_1.put_nowait(\n                        arg_0.telegram_parser.parse(arg_6)\n                    )\n                except ParseError as e:\n                    logger.warning('Failed to parse telegram: %s', e)", "path": "dsmr_parser/clients/serial_.py", "identifier": "AsyncSerialReader.read", "docstring": "Read complete DSMR telegram's from the serial interface and parse it\n        into CosemObject's and MbusObject's.\n\n        Instead of being a generator, values are pushed to provided queue for\n        asynchronous processing.\n\n        :rtype: None", "docstring_tokens": ["Read", "complete", "DSMR", "telegram", "s", "from", "the", "serial", "interface", "and", "parse", "it", "into", "CosemObject", "s", "and", "MbusObject", "s", "."], "nwo": "ndokter/dsmr_parser", "score": 0.6430124594429737, "idx": 254012}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L1079-L1102", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Returns a dictionary of envs or file inputs for an operation.", "language": "python", "parameters": "(self, metadata, file_input)", "return_statement": "return {name: vals_dict[name] for name in names if name in vals_dict}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "[", "'request'", "]", "[", "'ephemeralPipeline'", "]", "[", "'inputParameters'", "]", "arg_4", "=", "arg_1", "[", "'request'", "]", "[", "'pipelineArgs'", "]", "[", "'inputs'", "]", "arg_5", "=", "[", "arg", "[", "'name'", "]", "for", "arg", "in", "arg_3", "if", "(", "'localCopy'", "in", "arg", ")", "==", "arg_2", "]", "return", "{", "arg_6", ":", "arg_4", "[", "arg_6", "]", "for", "arg_6", "in", "arg_5", "if", "arg_6", "in", "arg_4", "}"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Returns a dictionary of envs or file inputs for an operation.\n\n    Args:\n      metadata: operation metadata field\n      file_input: True to return a dict of file inputs, False to return envs.\n\n    Returns:\n      A dictionary of input field name value pairs\n    \"\"\"\n\n    # To determine input parameter type, we iterate through the\n    # pipeline inputParameters.\n    # The values come from the pipelineArgs inputs.\n    arg_3 = arg_1['request']['ephemeralPipeline']['inputParameters']\n    arg_4 = arg_1['request']['pipelineArgs']['inputs']\n\n    # Get the names for files or envs\n    arg_5 = [\n        arg['name'] for arg in arg_3 if ('localCopy' in arg) == arg_2\n    ]\n\n    # Build the return dict\n    return {arg_6: arg_4[arg_6] for arg_6 in arg_5 if arg_6 in arg_4}", "path": "dsub/providers/google.py", "identifier": "GoogleOperation._get_operation_input_field_values", "docstring": "Returns a dictionary of envs or file inputs for an operation.\n\n    Args:\n      metadata: operation metadata field\n      file_input: True to return a dict of file inputs, False to return envs.\n\n    Returns:\n      A dictionary of input field name value pairs", "docstring_tokens": ["Returns", "a", "dictionary", "of", "envs", "or", "file", "inputs", "for", "an", "operation", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 254013}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/morpho_tagger/network.py#L199-L219", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Creates the basic network architecture,\n        transforming word embeddings to intermediate outputs", "language": "python", "parameters": "(self, word_outputs)", "return_statement": "return pre_outputs, lstm_outputs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "word_dropout", ">", "0.0", ":", "arg_2", "=", "kl", ".", "Dropout", "(", "arg_0", ".", "word_dropout", ")", "(", "arg_1", ")", "else", ":", "arg_2", "=", "arg_1", "for", "arg_3", "in", "range", "(", "arg_0", ".", "word_lstm_layers", "-", "1", ")", ":", "arg_2", "=", "kl", ".", "Bidirectional", "(", "kl", ".", "LSTM", "(", "arg_0", ".", "word_lstm_units", "[", "arg_3", "]", ",", "return_sequences", "=", "True", ",", "dropout", "=", "arg_0", ".", "lstm_dropout", ")", ")", "(", "arg_2", ")", "arg_2", "=", "kl", ".", "Bidirectional", "(", "kl", ".", "LSTM", "(", "arg_0", ".", "word_lstm_units", "[", "-", "1", "]", ",", "return_sequences", "=", "True", ",", "dropout", "=", "arg_0", ".", "lstm_dropout", ")", ")", "(", "arg_2", ")", "arg_4", "=", "kl", ".", "TimeDistributed", "(", "kl", ".", "Dense", "(", "arg_0", ".", "tags_number_", ",", "activation", "=", "\"softmax\"", ",", "activity_regularizer", "=", "arg_0", ".", "regularizer", ")", ",", "name", "=", "\"p\"", ")", "(", "arg_2", ")", "return", "arg_4", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Creates the basic network architecture,\n        transforming word embeddings to intermediate outputs\n        \"\"\"\n        if arg_0.word_dropout > 0.0:\n            arg_2 = kl.Dropout(arg_0.word_dropout)(arg_1)\n        else:\n            arg_2 = arg_1\n        for arg_3 in range(arg_0.word_lstm_layers-1):\n            arg_2 = kl.Bidirectional(\n                kl.LSTM(arg_0.word_lstm_units[arg_3], return_sequences=True,\n                        dropout=arg_0.lstm_dropout))(arg_2)\n        arg_2 = kl.Bidirectional(\n                kl.LSTM(arg_0.word_lstm_units[-1], return_sequences=True,\n                        dropout=arg_0.lstm_dropout))(arg_2)\n        arg_4 = kl.TimeDistributed(\n                kl.Dense(arg_0.tags_number_, activation=\"softmax\",\n                         activity_regularizer=arg_0.regularizer),\n                name=\"p\")(arg_2)\n        return arg_4, arg_2", "path": "deeppavlov/models/morpho_tagger/network.py", "identifier": "CharacterTagger._build_basic_network", "docstring": "Creates the basic network architecture,\n        transforming word embeddings to intermediate outputs", "docstring_tokens": ["Creates", "the", "basic", "network", "architecture", "transforming", "word", "embeddings", "to", "intermediate", "outputs"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 254014}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/main/project_flags.py#L71-L106", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "These arguments are redundant with just using a project, and we should\n    encouraging that as you don't have to learn any dumb flags!", "language": "python", "parameters": "(parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "add_argument", "(", "'-a'", ",", "'--animation'", ",", "default", "=", "None", ",", "help", "=", "'Default animation type if no animation is specified'", ")", "if", "deprecated", ".", "allowed", "(", ")", ":", "arg_0", ".", "add_argument", "(", "'--dimensions'", ",", "'--dim'", ",", "default", "=", "None", ",", "help", "=", "'DEPRECATED: x, (x, y) or (x, y, z) dimensions for project'", ")", "arg_0", ".", "add_argument", "(", "'--shape'", ",", "default", "=", "None", ",", "help", "=", "'x, (x, y) or (x, y, z) dimensions for project'", ")", "arg_0", ".", "add_argument", "(", "'-l'", ",", "'--layout'", ",", "default", "=", "None", ",", "help", "=", "'Default layout class if no layout is specified'", ")", "arg_0", ".", "add_argument", "(", "'--numbers'", ",", "'-n'", ",", "default", "=", "'python'", ",", "choices", "=", "NUMBER_TYPES", ",", "help", "=", "NUMBERS_HELP", ")", "arg_0", ".", "add_argument", "(", "'-p'", ",", "'--path'", ",", "default", "=", "None", ",", "help", "=", "PATH_HELP", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    These arguments are redundant with just using a project, and we should\n    encouraging that as you don't have to learn any dumb flags!\n\n    For example, instead of\n\n       bp foo.yml --animation=wombat --numbers=float\n\n    use\n\n       bp foo.yml + '{animation: wombat, numbers: float}'\n\n    \"\"\"\n    arg_0.add_argument(\n        '-a', '--animation', default=None,\n        help='Default animation type if no animation is specified')\n\n    if deprecated.allowed():  # pragma: no cover\n        arg_0.add_argument(\n            '--dimensions', '--dim', default=None,\n            help='DEPRECATED: x, (x, y) or (x, y, z) dimensions for project')\n\n    arg_0.add_argument(\n        '--shape', default=None,\n        help='x, (x, y) or (x, y, z) dimensions for project')\n\n    arg_0.add_argument(\n        '-l', '--layout', default=None,\n        help='Default layout class if no layout is specified')\n\n    arg_0.add_argument(\n        '--numbers', '-n', default='python', choices=NUMBER_TYPES,\n        help=NUMBERS_HELP)\n\n    arg_0.add_argument('-p', '--path', default=None, help=PATH_HELP)", "path": "bibliopixel/main/project_flags.py", "identifier": "_add_redundant_arguments", "docstring": "These arguments are redundant with just using a project, and we should\n    encouraging that as you don't have to learn any dumb flags!\n\n    For example, instead of\n\n       bp foo.yml --animation=wombat --numbers=float\n\n    use\n\n       bp foo.yml + '{animation: wombat, numbers: float}'", "docstring_tokens": ["These", "arguments", "are", "redundant", "with", "just", "using", "a", "project", "and", "we", "should", "encouraging", "that", "as", "you", "don", "t", "have", "to", "learn", "any", "dumb", "flags!"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 254015}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py#L287-L311", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reimplemented to use the 'run' magic.", "language": "python", "parameters": "(self, path, hidden=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "arg_1", "=", "os", ".", "path", ".", "normpath", "(", "arg_1", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", "if", "' '", "in", "arg_1", "or", "\"'\"", "in", "arg_1", "or", "'\"'", "in", "arg_1", ":", "arg_1", "=", "'\"%s\"'", "%", "arg_1", ".", "replace", "(", "'\"'", ",", "'\\\\\"'", ")", "arg_0", ".", "execute", "(", "'%%run %s'", "%", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\" Reimplemented to use the 'run' magic.\n        \"\"\"\n        # Use forward slashes on Windows to avoid escaping each separator.\n        if sys.platform == 'win32':\n            arg_1 = os.path.normpath(arg_1).replace('\\\\', '/')\n\n        # Perhaps we should not be using %run directly, but while we\n        # are, it is necessary to quote or escape filenames containing spaces \n        # or quotes. \n        \n        # In earlier code here, to minimize escaping, we sometimes quoted the \n        # filename with single quotes. But to do this, this code must be\n        # platform-aware, because run uses shlex rather than python string\n        # parsing, so that:\n        # * In Win: single quotes can be used in the filename without quoting,\n        #   and we cannot use single quotes to quote the filename.\n        # * In *nix: we can escape double quotes in a double quoted filename,\n        #   but can't escape single quotes in a single quoted filename.\n        \n        # So to keep this code non-platform-specific and simple, we now only\n        # use double quotes to quote filenames, and escape when needed:\n        if ' ' in arg_1 or \"'\" in arg_1 or '\"' in arg_1:\n            arg_1 = '\"%s\"' % arg_1.replace('\"', '\\\\\"')\n        arg_0.execute('%%run %s' % arg_1, arg_2=arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py", "identifier": "IPythonWidget.execute_file", "docstring": "Reimplemented to use the 'run' magic.", "docstring_tokens": ["Reimplemented", "to", "use", "the", "run", "magic", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254016}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L305-L340", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Determine the name type whose regex the a function's name should match.", "language": "python", "parameters": "(node, config=None)", "return_statement": "return \"method\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", ",", "arg_3", "=", "_get_properties", "(", "arg_1", ")", "if", "not", "arg_0", ".", "is_method", "(", ")", ":", "return", "\"function\"", "if", "arg_0", ".", "decorators", ":", "arg_4", "=", "arg_0", ".", "decorators", ".", "nodes", "else", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_4", ":", "if", "isinstance", "(", "arg_5", ",", "astroid", ".", "Name", ")", "or", "(", "isinstance", "(", "arg_5", ",", "astroid", ".", "Attribute", ")", "and", "arg_5", ".", "attrname", "in", "arg_3", ")", ":", "arg_6", "=", "utils", ".", "safe_infer", "(", "arg_5", ")", "if", "arg_6", "and", "arg_6", ".", "qname", "(", ")", "in", "arg_2", ":", "return", "\"attr\"", "elif", "isinstance", "(", "arg_5", ",", "astroid", ".", "Attribute", ")", "and", "arg_5", ".", "attrname", "in", "(", "\"setter\"", ",", "\"deleter\"", ",", ")", ":", "return", "\"attr\"", "return", "\"method\""], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Determine the name type whose regex the a function's name should match.\n\n    :param node: A function node.\n    :type node: astroid.node_classes.NodeNG\n    :param config: Configuration from which to pull additional property classes.\n    :type config: :class:`optparse.Values`\n\n    :returns: One of ('function', 'method', 'attr')\n    :rtype: str\n    \"\"\"\n    arg_2, arg_3 = _get_properties(arg_1)\n    if not arg_0.is_method():\n        return \"function\"\n    if arg_0.decorators:\n        arg_4 = arg_0.decorators.nodes\n    else:\n        arg_4 = []\n    for arg_5 in arg_4:\n        # If the function is a property (decorated with @property\n        # or @abc.abstractproperty), the name type is 'attr'.\n        if isinstance(arg_5, astroid.Name) or (\n            isinstance(arg_5, astroid.Attribute)\n            and arg_5.attrname in arg_3\n        ):\n            arg_6 = utils.safe_infer(arg_5)\n            if arg_6 and arg_6.qname() in arg_2:\n                return \"attr\"\n        # If the function is decorated using the prop_method.{setter,getter}\n        # form, treat it like an attribute as well.\n        elif isinstance(arg_5, astroid.Attribute) and arg_5.attrname in (\n            \"setter\",\n            \"deleter\",\n        ):\n            return \"attr\"\n    return \"method\"", "path": "pylint/checkers/base.py", "identifier": "_determine_function_name_type", "docstring": "Determine the name type whose regex the a function's name should match.\n\n    :param node: A function node.\n    :type node: astroid.node_classes.NodeNG\n    :param config: Configuration from which to pull additional property classes.\n    :type config: :class:`optparse.Values`\n\n    :returns: One of ('function', 'method', 'attr')\n    :rtype: str", "docstring_tokens": ["Determine", "the", "name", "type", "whose", "regex", "the", "a", "function", "s", "name", "should", "match", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254017}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L1584-L1615", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Perform global inhibition. Performing global inhibition entails picking the\n    top 'numActive' columns with the highest overlap score in the entire\n    region. At most half of the columns in a local neighborhood are allowed to\n    be active. Columns with an overlap score below the 'stimulusThreshold' are\n    always inhibited.", "language": "python", "parameters": "(self, overlaps, density)", "return_statement": "return sortedWinnerIndices[start:][::-1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "int", "(", "arg_2", "*", "arg_0", ".", "_numColumns", ")", "arg_4", "=", "numpy", ".", "argsort", "(", "arg_1", ",", "kind", "=", "'mergesort'", ")", "arg_5", "=", "len", "(", "arg_4", ")", "-", "arg_3", "while", "arg_5", "<", "len", "(", "arg_4", ")", ":", "arg_6", "=", "arg_4", "[", "arg_5", "]", "if", "arg_1", "[", "arg_6", "]", ">=", "arg_0", ".", "_stimulusThreshold", ":", "break", "else", ":", "arg_5", "+=", "1", "return", "arg_4", "[", "arg_5", ":", "]", "[", ":", ":", "-", "1", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Perform global inhibition. Performing global inhibition entails picking the\n    top 'numActive' columns with the highest overlap score in the entire\n    region. At most half of the columns in a local neighborhood are allowed to\n    be active. Columns with an overlap score below the 'stimulusThreshold' are\n    always inhibited.\n\n    :param overlaps: an array containing the overlap score for each  column.\n                    The overlap score for a column is defined as the number\n                    of synapses in a \"connected state\" (connected synapses)\n                    that are connected to input bits which are turned on.\n    :param density: The fraction of columns to survive inhibition.\n    @return list with indices of the winning columns\n    \"\"\"\n    #calculate num active per inhibition area\n    arg_3 = int(arg_2 * arg_0._numColumns)\n\n    # Calculate winners using stable sort algorithm (mergesort)\n    # for compatibility with C++\n    arg_4 = numpy.argsort(arg_1, kind='mergesort')\n\n    # Enforce the stimulus threshold\n    arg_5 = len(arg_4) - arg_3\n    while arg_5 < len(arg_4):\n      arg_6 = arg_4[arg_5]\n      if arg_1[arg_6] >= arg_0._stimulusThreshold:\n        break\n      else:\n        arg_5 += 1\n\n    return arg_4[arg_5:][::-1]", "path": "src/nupic/algorithms/spatial_pooler.py", "identifier": "SpatialPooler._inhibitColumnsGlobal", "docstring": "Perform global inhibition. Performing global inhibition entails picking the\n    top 'numActive' columns with the highest overlap score in the entire\n    region. At most half of the columns in a local neighborhood are allowed to\n    be active. Columns with an overlap score below the 'stimulusThreshold' are\n    always inhibited.\n\n    :param overlaps: an array containing the overlap score for each  column.\n                    The overlap score for a column is defined as the number\n                    of synapses in a \"connected state\" (connected synapses)\n                    that are connected to input bits which are turned on.\n    :param density: The fraction of columns to survive inhibition.\n    @return list with indices of the winning columns", "docstring_tokens": ["Perform", "global", "inhibition", ".", "Performing", "global", "inhibition", "entails", "picking", "the", "top", "numActive", "columns", "with", "the", "highest", "overlap", "score", "in", "the", "entire", "region", ".", "At", "most", "half", "of", "the", "columns", "in", "a", "local", "neighborhood", "are", "allowed", "to", "be", "active", ".", "Columns", "with", "an", "overlap", "score", "below", "the", "stimulusThreshold", "are", "always", "inhibited", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254018}
{"url": "https://github.com/nprapps/copydoc/blob/e1ab09b287beb0439748c319cf165cbc06c66624/copydoc.py#L58-L80", "sha": "e1ab09b287beb0439748c319cf165cbc06c66624", "docstring_summary": "Run all parsing functions.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "soup", ".", "findAll", "(", "'span'", ")", ":", "arg_0", ".", "create_italic", "(", "arg_1", ")", "arg_0", ".", "create_strong", "(", "arg_1", ")", "arg_0", ".", "create_underline", "(", "arg_1", ")", "arg_0", ".", "unwrap_span", "(", "arg_1", ")", "for", "arg_1", "in", "arg_0", ".", "soup", ".", "findAll", "(", "'a'", ")", ":", "arg_0", ".", "remove_comments", "(", "arg_1", ")", "arg_0", ".", "check_next", "(", "arg_1", ")", "if", "arg_0", ".", "soup", ".", "body", ":", "for", "arg_1", "in", "arg_0", ".", "soup", ".", "body", ".", "findAll", "(", ")", ":", "arg_0", ".", "remove_empty", "(", "arg_1", ")", "arg_0", ".", "remove_inline_comment", "(", "arg_1", ")", "arg_0", ".", "Func_attrs", "(", "arg_1", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "tokens", ":", "arg_0", ".", "find_token", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_0", ".", "remove_blacklisted_tags", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Run all parsing functions.\n        \"\"\"\n        for arg_1 in arg_0.soup.findAll('span'):\n            arg_0.create_italic(arg_1)\n            arg_0.create_strong(arg_1)\n            arg_0.create_underline(arg_1)\n            arg_0.unwrap_span(arg_1)\n\n        for arg_1 in arg_0.soup.findAll('a'):\n            arg_0.remove_comments(arg_1)\n            arg_0.check_next(arg_1)\n\n        if arg_0.soup.body:\n            for arg_1 in arg_0.soup.body.findAll():\n                arg_0.remove_empty(arg_1)\n                arg_0.remove_inline_comment(arg_1)\n                arg_0.Func_attrs(arg_1)\n                for arg_2, arg_3 in arg_0.tokens:\n                    arg_0.find_token(arg_1, arg_2, arg_3)\n\n                arg_0.remove_blacklisted_tags(arg_1)", "path": "copydoc.py", "identifier": "CopyDoc.parse", "docstring": "Run all parsing functions.", "docstring_tokens": ["Run", "all", "parsing", "functions", "."], "nwo": "nprapps/copydoc", "score": 0.16246995141409282, "idx": 254019}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L217-L223", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Remove values common with another Set", "language": "python", "parameters": "(self, oset: Scope)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "arg_3", "=", "list", "(", "arg_0", ".", "_hsig", ".", "keys", "(", ")", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", "in", "arg_1", ":", "del", "arg_0", ".", "_hsig", "[", "arg_4", "]", "return", "arg_0"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        \"\"\" Remove values common with another Set \"\"\"\n        arg_3 = list(arg_0._hsig.keys())\n        for arg_4 in arg_3:\n            if arg_4 in arg_1:\n                del arg_0._hsig[arg_4]\n        return arg_0", "path": "pyrser/type_system/scope.py", "identifier": "Scope.difference_update", "docstring": "Remove values common with another Set", "docstring_tokens": ["Remove", "values", "common", "with", "another", "Set"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254020}
{"url": "https://github.com/boakley/robotframework-lint/blob/3e3578f4e39af9af9961aa0a715f146b74474091/rflint/parser/tables.py#L35-L71", "sha": "3e3578f4e39af9af9961aa0a715f146b74474091", "docstring_summary": "Return a list of statements", "language": "python", "parameters": "(self)", "return_statement": "return statements", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ".", "rows", ")", "==", "0", ":", "return", "[", "]", "arg_1", "=", "Statement", "(", "arg_0", ".", "rows", "[", "0", "]", ")", "arg_1", ".", "startline", "=", "arg_0", ".", "rows", "[", "0", "]", ".", "linenumber", "arg_1", ".", "endline", "=", "arg_0", ".", "rows", "[", "0", "]", ".", "linenumber", "Func", "=", "[", "]", "for", "arg_5", "in", "arg_0", ".", "rows", "[", "1", ":", "]", ":", "if", "len", "(", "arg_5", ")", ">", "0", "and", "arg_5", "[", "0", "]", "==", "\"...\"", ":", "arg_1", "+=", "arg_5", "[", "1", ":", "]", "arg_1", ".", "endline", "=", "arg_5", ".", "linenumber", "else", ":", "if", "len", "(", "arg_1", ")", ">", "0", ":", "Func", ".", "append", "(", "arg_1", ")", "arg_1", "=", "Statement", "(", "arg_5", ")", "arg_1", ".", "startline", "=", "arg_5", ".", "linenumber", "arg_1", ".", "endline", "=", "arg_5", ".", "linenumber", "if", "len", "(", "arg_1", ")", ">", "0", ":", "Func", ".", "append", "(", "arg_1", ")", "while", "(", "len", "(", "Func", "[", "-", "1", "]", ")", "==", "0", "or", "(", "(", "len", "(", "Func", "[", "-", "1", "]", ")", "==", "1", ")", "and", "len", "(", "Func", "[", "-", "1", "]", "[", "0", "]", ")", "==", "0", ")", ")", ":", "Func", ".", "pop", "(", ")", "return", "Func"], "function": "def Func(arg_0):\n        '''Return a list of statements\n\n        This is done by joining together any rows that\n        have continuations\n        '''\n        # FIXME: no need to do this every time; we should cache the\n        # result\n        if len(arg_0.rows) == 0:\n            return []\n\n        arg_1 = Statement(arg_0.rows[0])\n        arg_1.startline = arg_0.rows[0].linenumber\n        arg_1.endline = arg_0.rows[0].linenumber\n        Func = []\n        for arg_5 in arg_0.rows[1:]:\n            if len(arg_5) > 0 and arg_5[0] == \"...\":\n                # we found a continuation\n                arg_1 += arg_5[1:]\n                arg_1.endline = arg_5.linenumber\n            else:\n                if len(arg_1) > 0:\n                    # append current statement to the list of statements...\n                    Func.append(arg_1)\n                # start a new statement\n                arg_1 = Statement(arg_5)\n                arg_1.startline = arg_5.linenumber\n                arg_1.endline = arg_5.linenumber\n\n        if len(arg_1) > 0:\n            Func.append(arg_1)\n\n        # trim trailing blank statements\n        while (len(Func[-1]) == 0 or \n               ((len(Func[-1]) == 1) and len(Func[-1][0]) == 0)):\n            Func.pop()\n        return Func", "path": "rflint/parser/tables.py", "identifier": "SimpleTableMixin.statements", "docstring": "Return a list of statements\n\n        This is done by joining together any rows that\n        have continuations", "docstring_tokens": ["Return", "a", "list", "of", "statements"], "nwo": "boakley/robotframework-lint", "score": 0.9109317500285141, "idx": 254021}
{"url": "https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/query/dataset.py#L165-L202", "sha": "2092b0cb30898139a247176bcf433d5a4abde7cb", "docstring_summary": "Adds the given stream to the query construction. Additionally, you can choose the interpolator to use for this stream, as well as a special name\n        for the column in the returned dataset. If no column name is given, the full stream path will be used.", "language": "python", "parameters": "(self, stream, interpolator=\"closest\", t1=None, t2=None, dt=None, limit=None, i1=None, i2=None, transform=None,colname=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"closest\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ")", ":", "arg_11", "=", "query_maker", "(", "arg_3", ",", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", "param_stream", "(", "arg_0", ".", "cdb", ",", "arg_11", ",", "arg_1", ")", "arg_11", "[", "\"interpolator\"", "]", "=", "arg_2", "if", "arg_10", "is", "None", ":", "if", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "arg_10", "=", "arg_1", "elif", "isinstance", "(", "arg_1", ",", "Stream", ")", ":", "arg_10", "=", "arg_1", ".", "path", "else", ":", "raise", "Exception", "(", "\"Could not find a name for the column! use the 'colname' parameter.\"", ")", "if", "arg_10", "in", "arg_0", ".", "query", "[", "\"dataset\"", "]", "or", "arg_10", "is", "\"x\"", ":", "raise", "Exception", "(", "\"The column name either exists, or is labeled 'x'. Use the colname parameter to change the column name.\"", ")", "arg_0", ".", "query", "[", "\"dataset\"", "]", "[", "arg_10", "]", "=", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2=\"closest\", arg_3=None, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None,arg_10=None):\n        \"\"\"Adds the given stream to the query construction. Additionally, you can choose the interpolator to use for this stream, as well as a special name\n        for the column in the returned dataset. If no column name is given, the full stream path will be used.\n\n        Func also supports Merge queries. You can insert a merge query instead of a stream, but be sure to name the column::\n\n            d = Dataset(cdb, t1=time.time()-1000,t2=time.time(),dt=10.)\n            d.Func(\"temperature\",\"average\")\n            d.Func(\"steps\",\"sum\")\n\n            m = Merge(cdb)\n            m.Func(\"mystream\")\n            m.Func(\"mystream2\")\n            d.Func(m,colname=\"mycolumn\")\n\n            result = d.run()\n        \"\"\"\n\n        arg_11 = query_maker(arg_3, arg_4, arg_6, arg_7, arg_8, arg_9)\n        param_stream(arg_0.cdb, arg_11, arg_1)\n\n        arg_11[\"interpolator\"] = arg_2\n\n        if arg_10 is None:\n            # What do we call this column?\n            if isinstance(arg_1, six.string_types):\n                arg_10 = arg_1\n            elif isinstance(arg_1, Stream):\n                arg_10 = arg_1.path\n            else:\n                raise Exception(\n                    \"Could not find a name for the column! use the 'colname' parameter.\")\n\n        if arg_10 in arg_0.query[\"dataset\"] or arg_10 is \"x\":\n            raise Exception(\n                \"The column name either exists, or is labeled 'x'. Use the colname parameter to change the column name.\")\n\n        arg_0.query[\"dataset\"][arg_10] = arg_11", "path": "connectordb/query/dataset.py", "identifier": "Dataset.addStream", "docstring": "Adds the given stream to the query construction. Additionally, you can choose the interpolator to use for this stream, as well as a special name\n        for the column in the returned dataset. If no column name is given, the full stream path will be used.\n\n        addStream also supports Merge queries. You can insert a merge query instead of a stream, but be sure to name the column::\n\n            d = Dataset(cdb, t1=time.time()-1000,t2=time.time(),dt=10.)\n            d.addStream(\"temperature\",\"average\")\n            d.addStream(\"steps\",\"sum\")\n\n            m = Merge(cdb)\n            m.addStream(\"mystream\")\n            m.addStream(\"mystream2\")\n            d.addStream(m,colname=\"mycolumn\")\n\n            result = d.run()", "docstring_tokens": ["Adds", "the", "given", "stream", "to", "the", "query", "construction", ".", "Additionally", "you", "can", "choose", "the", "interpolator", "to", "use", "for", "this", "stream", "as", "well", "as", "a", "special", "name", "for", "the", "column", "in", "the", "returned", "dataset", ".", "If", "no", "column", "name", "is", "given", "the", "full", "stream", "path", "will", "be", "used", "."], "nwo": "connectordb/connectordb-python", "score": 0.25890992733444657, "idx": 254022}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L52-L61", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return content of a free form text block as a string.", "language": "python", "parameters": "(text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "compile", "(", "'<text>((.|\\n)+)</text>'", ",", "re", ".", "UNICODE", ")", "arg_2", "=", "arg_1", ".", "match", "(", "arg_0", ")", "if", "arg_2", ":", "return", "arg_2", ".", "group", "(", "1", ")", "else", ":", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Return content of a free form text block as a string.\n    \"\"\"\n    arg_1 = re.compile('<text>((.|\\n)+)</text>', re.UNICODE)\n    arg_2 = arg_1.match(arg_0)\n    if arg_2:\n        return arg_2.group(1)\n    else:\n        return None", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "str_from_text", "docstring": "Return content of a free form text block as a string.", "docstring_tokens": ["Return", "content", "of", "a", "free", "form", "text", "block", "as", "a", "string", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254023}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/secrets.py#L8-L22", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Gets contents of secret file", "language": "python", "parameters": "(secret_name, default=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "Funcs_dir", "(", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_0", ")", "try", ":", "with", "open", "(", "arg_3", ",", "\"r\"", ")", "as", "secret_file", ":", "return", "secret_file", ".", "read", "(", ")", "except", "OSError", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Gets contents of secret file\n\n    :param secret_name: The name of the secret present in BANANAS_SECRETS_DIR\n    :param default: Default value to return if no secret was found\n    :return: The secret or default if not found\n    \"\"\"\n    arg_2 = Funcs_dir()\n    arg_3 = os.path.join(arg_2, arg_0)\n    try:\n        with open(arg_3, \"r\") as secret_file:\n            return secret_file.read()\n    except OSError:\n        return arg_1", "path": "bananas/secrets.py", "identifier": "get_secret", "docstring": "Gets contents of secret file\n\n    :param secret_name: The name of the secret present in BANANAS_SECRETS_DIR\n    :param default: Default value to return if no secret was found\n    :return: The secret or default if not found", "docstring_tokens": ["Gets", "contents", "of", "secret", "file"], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 254024}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L1396-L1416", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Prepare sys.path for running the linter checks.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", "arg_5", ".", "path", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "_get_python_path", "(", "arg_3", ")", "if", "arg_4", "in", "arg_2", ":", "continue", "else", ":", "arg_2", ".", "append", "(", "arg_4", ")", "arg_5", ".", "path", "[", ":", "]", "=", "arg_2", "+", "[", "\".\"", "]", "+", "arg_5", ".", "path", "try", ":", "yield", "finally", ":", "arg_5", ".", "path", "[", ":", "]", "=", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Prepare sys.path for running the linter checks.\n\n    Within this context, each of the given arguments is importable.\n    Paths are added to sys.path in corresponding order to the arguments.\n    We avoid adding duplicate directories to sys.path.\n    `sys.path` is reset to its original value upon exiting this context.\n    \"\"\"\n    arg_1 = list(arg_5.path)\n    arg_2 = []\n    for arg_3 in arg_0:\n        arg_4 = _get_python_path(arg_3)\n        if arg_4 in arg_2:\n            continue\n        else:\n            arg_2.append(arg_4)\n    arg_5.path[:] = arg_2 + [\".\"] + arg_5.path\n    try:\n        yield\n    finally:\n        arg_5.path[:] = arg_1", "path": "pylint/lint.py", "identifier": "fix_import_path", "docstring": "Prepare sys.path for running the linter checks.\n\n    Within this context, each of the given arguments is importable.\n    Paths are added to sys.path in corresponding order to the arguments.\n    We avoid adding duplicate directories to sys.path.\n    `sys.path` is reset to its original value upon exiting this context.", "docstring_tokens": ["Prepare", "sys", ".", "path", "for", "running", "the", "linter", "checks", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254025}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L210-L218", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "ensure that a SavedSearch object exists", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "not", "arg_1", ".", "savedsearch", ":", "arg_1", ".", "savedsearch", "=", "SavedSearch", "(", "arg_1", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\" ensure that a SavedSearch object exists \"\"\"\n\n    def wrapper(arg_1, *arg_2, **arg_3):\n        if not arg_1.savedsearch:\n            arg_1.savedsearch = SavedSearch(arg_1)\n        return arg_0(arg_1, *arg_2, **arg_3)\n\n    return wrapper", "path": "pyzotero/zotero.py", "identifier": "ss_wrap", "docstring": "ensure that a SavedSearch object exists", "docstring_tokens": ["ensure", "that", "a", "SavedSearch", "object", "exists"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 254026}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/credentials.py#L23-L40", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Provides an overview of the duplicate credentials.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "Credential", ".", "search", "(", ")", "arg_0", ".", "aggs", ".", "bucket", "(", "'password_count'", ",", "'terms'", ",", "field", "=", "'secret'", ",", "order", "=", "{", "'_count'", ":", "'desc'", "}", ",", "size", "=", "20", ")", ".", "metric", "(", "'username_count'", ",", "'cardinality'", ",", "field", "=", "'username'", ")", ".", "metric", "(", "'host_count'", ",", "'cardinality'", ",", "field", "=", "'host_ip'", ")", ".", "metric", "(", "'top_hits'", ",", "'top_hits'", ",", "docvalue_fields", "=", "[", "'username'", "]", ",", "size", "=", "100", ")", "arg_1", "=", "arg_0", ".", "execute", "(", ")", "print_line", "(", "\"{0:65} {1:5} {2:5} {3:5} {4}\"", ".", "format", "(", "\"Secret\"", ",", "\"Count\"", ",", "\"Hosts\"", ",", "\"Users\"", ",", "\"Usernames\"", ")", ")", "print_line", "(", "\"-\"", "*", "100", ")", "for", "arg_2", "in", "arg_1", ".", "aggregations", ".", "password_count", ".", "buckets", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ".", "top_hits", ":", "arg_3", ".", "append", "(", "arg_4", ".", "username", "[", "0", "]", ")", "arg_3", "=", "list", "(", "set", "(", "arg_3", ")", ")", "print_line", "(", "\"{0:65} {1:5} {2:5} {3:5} {4}\"", ".", "format", "(", "arg_2", ".", "key", ",", "arg_2", ".", "doc_count", ",", "arg_2", ".", "host_count", ".", "value", ",", "arg_2", ".", "username_count", ".", "value", ",", "arg_3", ")", ")"], "function": "def Func():\n    \"\"\"\n        Provides an Func of the duplicate credentials.\n    \"\"\"\n    arg_0 = Credential.search()\n    arg_0.aggs.bucket('password_count', 'terms', field='secret', order={'_count': 'desc'}, size=20)\\\n        .metric('username_count', 'cardinality', field='username') \\\n        .metric('host_count', 'cardinality', field='host_ip') \\\n        .metric('top_hits', 'top_hits', docvalue_fields=['username'], size=100)\n    arg_1 = arg_0.execute()\n    print_line(\"{0:65} {1:5} {2:5} {3:5} {4}\".format(\"Secret\", \"Count\", \"Hosts\", \"Users\", \"Usernames\"))\n    print_line(\"-\"*100)\n    for arg_2 in arg_1.aggregations.password_count.buckets:\n        arg_3 = []\n        for arg_4 in arg_2.top_hits:\n            arg_3.append(arg_4.username[0])\n        arg_3 = list(set(arg_3))\n        print_line(\"{0:65} {1:5} {2:5} {3:5} {4}\".format(arg_2.key, arg_2.doc_count, arg_2.host_count.value, arg_2.username_count.value, arg_3))", "path": "jackal/scripts/credentials.py", "identifier": "overview", "docstring": "Provides an overview of the duplicate credentials.", "docstring_tokens": ["Provides", "an", "overview", "of", "the", "duplicate", "credentials", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 254027}
{"url": "https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/stringprep.py#L130-L143", "sha": "af58bf30f688757e58af6e87892d35a8ce798482", "docstring_summary": "Perform the stringprep mapping step of SASLprep. Operates in-place on a\n    list of unicode characters provided in `chars`.", "language": "python", "parameters": "(chars)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "while", "arg_1", "<", "len", "(", "arg_0", ")", ":", "arg_2", "=", "arg_0", "[", "arg_1", "]", "if", "stringprep", ".", "in_table_c12", "(", "arg_2", ")", ":", "arg_0", "[", "arg_1", "]", "=", "\"\\u0020\"", "elif", "stringprep", ".", "in_table_b1", "(", "arg_2", ")", ":", "del", "arg_0", "[", "arg_1", "]", "continue", "arg_1", "+=", "1"], "function": "def Func(arg_0):\n    \"\"\"\n    Perform the stringprep mapping step of SASLprep. Operates in-place on a\n    list of unicode characters provided in `chars`.\n    \"\"\"\n    arg_1 = 0\n    while arg_1 < len(arg_0):\n        arg_2 = arg_0[arg_1]\n        if stringprep.in_table_c12(arg_2):\n            arg_0[arg_1] = \"\\u0020\"\n        elif stringprep.in_table_b1(arg_2):\n            del arg_0[arg_1]\n            continue\n        arg_1 += 1", "path": "aiosasl/stringprep.py", "identifier": "_saslprep_do_mapping", "docstring": "Perform the stringprep mapping step of SASLprep. Operates in-place on a\n    list of unicode characters provided in `chars`.", "docstring_tokens": ["Perform", "the", "stringprep", "mapping", "step", "of", "SASLprep", ".", "Operates", "in", "-", "place", "on", "a", "list", "of", "unicode", "characters", "provided", "in", "chars", "."], "nwo": "horazont/aiosasl", "score": 0.26949921653275793, "idx": 254028}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L72-L86", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Re-enable the FTDI drivers for the current platform.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "logger", ".", "debug", "(", "'Enabling FTDI driver.'", ")", "if", "sys", ".", "platform", "==", "'darwin'", ":", "logger", ".", "debug", "(", "'Detected Mac OSX'", ")", "_check_running_as_root", "(", ")", "subprocess", ".", "check_call", "(", "'kextload -b com.apple.driver.AppleUSBFTDI'", ",", "shell", "=", "True", ")", "subprocess", ".", "check_call", "(", "'kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext'", ",", "shell", "=", "True", ")", "elif", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", ":", "logger", ".", "debug", "(", "'Detected Linux'", ")", "_check_running_as_root", "(", ")", "subprocess", ".", "check_call", "(", "'modprobe -q ftdi_sio'", ",", "shell", "=", "True", ")", "subprocess", ".", "check_call", "(", "'modprobe -q usbserial'", ",", "shell", "=", "True", ")"], "function": "def Func():\n    \"\"\"Re-enable the FTDI drivers for the current platform.\"\"\"\n    logger.debug('Enabling FTDI driver.')\n    if sys.platform == 'darwin':\n        logger.debug('Detected Mac OSX')\n        # Mac OS commands to enable FTDI driver.\n        _check_running_as_root()\n        subprocess.check_call('kextload -b com.apple.driver.AppleUSBFTDI', shell=True)\n        subprocess.check_call('kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext', shell=True)\n    elif sys.platform.startswith('linux'):\n        logger.debug('Detected Linux')\n        # Linux commands to enable FTDI driver.\n        _check_running_as_root()\n        subprocess.check_call('modprobe -q ftdi_sio', shell=True)\n        subprocess.check_call('modprobe -q usbserial', shell=True)", "path": "Adafruit_GPIO/FT232H.py", "identifier": "enable_FTDI_driver", "docstring": "Re-enable the FTDI drivers for the current platform.", "docstring_tokens": ["Re", "-", "enable", "the", "FTDI", "drivers", "for", "the", "current", "platform", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 254029}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/messages.py#L47-L74", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Add a message to the Django messages store indicating that we failed to retrieve price information about an item.", "language": "python", "parameters": "(request, item)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "messages", ".", "warning", "(", "arg_0", ",", "_", "(", "'{strong_start}We could not gather price information for {em_start}{item}{em_end}.{strong_end} '", "'{span_start}If you continue to have these issues, please contact '", "'{link_start}{platform_name} support{link_end}.{span_end}'", ")", ".", "format", "(", "arg_1", "=", "arg_1", ",", "em_start", "=", "'<em>'", ",", "em_end", "=", "'</em>'", ",", "link_start", "=", "'<a href=\"{support_link}\" target=\"_blank\">'", ".", "format", "(", "support_link", "=", "get_configuration_value", "(", "'ENTERPRISE_SUPPORT_URL'", ",", "settings", ".", "ENTERPRISE_SUPPORT_URL", ")", ",", ")", ",", "platform_name", "=", "get_configuration_value", "(", "'PLATFORM_NAME'", ",", "settings", ".", "PLATFORM_NAME", ")", ",", "link_end", "=", "'</a>'", ",", "span_start", "=", "'<span>'", ",", "span_end", "=", "'</span>'", ",", "strong_start", "=", "'<strong>'", ",", "strong_end", "=", "'</strong>'", ",", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Add a message to the Django messages store indicating that we failed to retrieve price information about an item.\n\n    :param request: The current request.\n    :param item: The item for which price information is missing. Example: a program title, or a course.\n    \"\"\"\n    messages.warning(\n        arg_0,\n        _(\n            '{strong_start}We could not gather price information for {em_start}{item}{em_end}.{strong_end} '\n            '{span_start}If you continue to have these issues, please contact '\n            '{link_start}{platform_name} support{link_end}.{span_end}'\n        ).format(\n            arg_1=arg_1,\n            em_start='<em>',\n            em_end='</em>',\n            link_start='<a href=\"{support_link}\" target=\"_blank\">'.format(\n                support_link=get_configuration_value('ENTERPRISE_SUPPORT_URL', settings.ENTERPRISE_SUPPORT_URL),\n            ),\n            platform_name=get_configuration_value('PLATFORM_NAME', settings.PLATFORM_NAME),\n            link_end='</a>',\n            span_start='<span>',\n            span_end='</span>',\n            strong_start='<strong>',\n            strong_end='</strong>',\n        )\n    )", "path": "enterprise/messages.py", "identifier": "add_missing_price_information_message", "docstring": "Add a message to the Django messages store indicating that we failed to retrieve price information about an item.\n\n    :param request: The current request.\n    :param item: The item for which price information is missing. Example: a program title, or a course.", "docstring_tokens": ["Add", "a", "message", "to", "the", "Django", "messages", "store", "indicating", "that", "we", "failed", "to", "retrieve", "price", "information", "about", "an", "item", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254030}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/bin/cli.py#L554-L563", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns the state of a TaskInstance at the command line.\n    >>> airflow task_state tutorial sleep 2015-01-01\n    success", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_dag", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "get_task", "(", "task_id", "=", "arg_0", ".", "task_id", ")", "arg_3", "=", "TaskInstance", "(", "arg_2", ",", "arg_0", ".", "execution_date", ")", "print", "(", "arg_3", ".", "current_state", "(", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns the state of a TaskInstance at the command line.\n    >>> airflow Func tutorial sleep 2015-01-01\n    success\n    \"\"\"\n    arg_1 = get_dag(arg_0)\n    arg_2 = arg_1.get_task(task_id=arg_0.task_id)\n    arg_3 = TaskInstance(arg_2, arg_0.execution_date)\n    print(arg_3.current_state())", "path": "airflow/bin/cli.py", "identifier": "task_state", "docstring": "Returns the state of a TaskInstance at the command line.\n    >>> airflow task_state tutorial sleep 2015-01-01\n    success", "docstring_tokens": ["Returns", "the", "state", "of", "a", "TaskInstance", "at", "the", "command", "line", ".", ">>>", "airflow", "task_state", "tutorial", "sleep", "2015", "-", "01", "-", "01", "success"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254031}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5837-L5863", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Check if line contains a redundant \"override\" or \"final\" virt-specifier.", "language": "python", "parameters": "(filename, clean_lines, linenum, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "elided", "[", "arg_2", "]", "arg_5", "=", "arg_4", ".", "rfind", "(", "')'", ")", "if", "arg_5", ">=", "0", ":", "arg_6", "=", "arg_4", "[", "arg_5", ":", "]", "else", ":", "if", "arg_2", ">", "1", "and", "arg_1", ".", "elided", "[", "arg_2", "-", "1", "]", ".", "rfind", "(", "')'", ")", ">=", "0", ":", "arg_6", "=", "arg_4", "else", ":", "return", "if", "Search", "(", "r'\\boverride\\b'", ",", "arg_6", ")", "and", "Search", "(", "r'\\bfinal\\b'", ",", "arg_6", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'readability/inheritance'", ",", "4", ",", "(", "'\"override\" is redundant since function is '", "'already declared as \"final\"'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Check if line contains a redundant \"override\" or \"final\" virt-specifier.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.\n  \"\"\"\n  # Look for closing parenthesis nearby.  We need one to confirm where\n  # the declarator ends and where the virt-specifier starts to avoid\n  # false positives.\n  arg_4 = arg_1.elided[arg_2]\n  arg_5 = arg_4.rfind(')')\n  if arg_5 >= 0:\n    arg_6 = arg_4[arg_5:]\n  else:\n    if arg_2 > 1 and arg_1.elided[arg_2 - 1].rfind(')') >= 0:\n      arg_6 = arg_4\n    else:\n      return\n\n  # Check that at most one of \"override\" or \"final\" is present, not both\n  if Search(r'\\boverride\\b', arg_6) and Search(r'\\bfinal\\b', arg_6):\n    arg_3(arg_0, arg_2, 'readability/inheritance', 4,\n          ('\"override\" is redundant since function is '\n           'already declared as \"final\"'))", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckRedundantOverrideOrFinal", "docstring": "Check if line contains a redundant \"override\" or \"final\" virt-specifier.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.", "docstring_tokens": ["Check", "if", "line", "contains", "a", "redundant", "override", "or", "final", "virt", "-", "specifier", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254032}
{"url": "https://github.com/jonathanj/txspinneret/blob/717008a2c313698984a23e3f3fc62ea3675ed02d/txspinneret/resource.py#L27-L40", "sha": "717008a2c313698984a23e3f3fc62ea3675ed02d", "docstring_summary": "Render a given resource.", "language": "python", "parameters": "(resource, request)", "return_statement": "return meth(request)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "'render_'", "+", "nativeString", "(", "arg_1", ".", "method", ")", ",", "None", ")", "if", "arg_2", "is", "None", ":", "try", ":", "arg_3", "=", "arg_0", ".", "allowedMethods", "except", "AttributeError", ":", "arg_3", "=", "_computeAllowedMethods", "(", "arg_0", ")", "raise", "UnsupportedMethod", "(", "arg_3", ")", "return", "arg_2", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Render a given resource.\n\n    See `IResource.render <twisted:twisted.web.resource.IResource.render>`.\n    \"\"\"\n    arg_2 = getattr(arg_0, 'render_' + nativeString(arg_1.method), None)\n    if arg_2 is None:\n        try:\n            arg_3 = arg_0.allowedMethods\n        except AttributeError:\n            arg_3 = _computeAllowedMethods(arg_0)\n        raise UnsupportedMethod(arg_3)\n    return arg_2(arg_1)", "path": "txspinneret/resource.py", "identifier": "_renderResource", "docstring": "Render a given resource.\n\n    See `IResource.render <twisted:twisted.web.resource.IResource.render>`.", "docstring_tokens": ["Render", "a", "given", "resource", "."], "nwo": "jonathanj/txspinneret", "score": 0.08529914490135834, "idx": 254033}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/legacyauth.py#L399-L417", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle registration form received.", "language": "python", "parameters": "(self, stanza)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "lock", ".", "acquire", "(", ")", "try", ":", "arg_0", ".", "__register", "=", "Register", "(", "arg_1", ".", "get_query", "(", ")", ")", "arg_0", ".", "registration_callback", "(", "arg_1", ",", "arg_0", ".", "__register", ".", "get_form", "(", ")", ")", "finally", ":", "arg_0", ".", "lock", ".", "release", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Handle registration form received.\n\n        [client only]\n\n        Call self.registration_callback with the registration form received\n        as the argument. Use the value returned by the callback will be a\n        filled-in form.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.iq.Iq`\"\"\"\n        arg_0.lock.acquire()\n        try:\n            arg_0.__register = Register(arg_1.get_query())\n            arg_0.registration_callback(arg_1, arg_0.__register.get_form())\n        finally:\n            arg_0.lock.release()", "path": "pyxmpp2/ext/legacyauth.py", "identifier": "LegacyClientStream.registration_form_received", "docstring": "Handle registration form received.\n\n        [client only]\n\n        Call self.registration_callback with the registration form received\n        as the argument. Use the value returned by the callback will be a\n        filled-in form.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.iq.Iq`", "docstring_tokens": ["Handle", "registration", "form", "received", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254034}
{"url": "https://github.com/padelt/temper-python/blob/cbdbace7e6755b1d91a2603ab63c9cb778078f79/temperusb/temper.py#L49-L75", "sha": "cbdbace7e6755b1d91a2603ab63c9cb778078f79", "docstring_summary": "Find the port chain a device is plugged on.", "language": "python", "parameters": "(device)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "bus", "arg_2", "=", "arg_0", ".", "address", "for", "arg_3", "in", "os", ".", "listdir", "(", "USB_SYS_PREFIX", ")", ":", "arg_4", "=", "re", ".", "match", "(", "USB_PORTS_STR", "+", "'$'", ",", "arg_3", ")", "if", "arg_4", ":", "arg_5", "=", "readattr", "(", "arg_3", ",", "'busnum'", ")", "if", "arg_5", ":", "arg_6", "=", "float", "(", "arg_5", ")", "else", ":", "arg_6", "=", "None", "arg_7", "=", "readattr", "(", "arg_3", ",", "'devnum'", ")", "if", "arg_7", ":", "arg_8", "=", "float", "(", "arg_7", ")", "else", ":", "arg_8", "=", "None", "if", "arg_6", "==", "arg_1", "and", "arg_8", "==", "arg_2", ":", "return", "str", "(", "arg_4", ".", "groups", "(", ")", "[", "1", "]", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Find the port chain a device is plugged on.\n\n    This is done by searching sysfs for a device that matches the device\n    bus/address combination.\n\n    Useful when the underlying usb lib does not return device.port_number for\n    whatever reason.\n    \"\"\"\n    arg_1 = arg_0.bus\n    arg_2 = arg_0.address\n    for arg_3 in os.listdir(USB_SYS_PREFIX):\n        arg_4 = re.match(USB_PORTS_STR + '$', arg_3)\n        if arg_4:\n            arg_5 = readattr(arg_3, 'busnum')\n            if arg_5:\n                arg_6 = float(arg_5)\n            else:\n                arg_6 = None\n            arg_7 = readattr(arg_3, 'devnum')\n            if arg_7:\n                arg_8 = float(arg_7)\n            else:\n                arg_8 = None\n            if arg_6 == arg_1 and arg_8 == arg_2:\n                return str(arg_4.groups()[1])", "path": "temperusb/temper.py", "identifier": "find_ports", "docstring": "Find the port chain a device is plugged on.\n\n    This is done by searching sysfs for a device that matches the device\n    bus/address combination.\n\n    Useful when the underlying usb lib does not return device.port_number for\n    whatever reason.", "docstring_tokens": ["Find", "the", "port", "chain", "a", "device", "is", "plugged", "on", "."], "nwo": "padelt/temper-python", "score": 0.5855497206829942, "idx": 254035}
{"url": "https://github.com/thusoy/pwm/blob/fff7d755c34f3a7235a8bf217ffa2ff5aed4926f/pwm/encoding.py#L22-L33", "sha": "fff7d755c34f3a7235a8bf217ffa2ff5aed4926f", "docstring_summary": "computes the ideal conversion ratio for the given alphabet.\n    A ratio is considered ideal when the number of bits in one output\n    encoding chunk that don't add up to one input encoding chunk is minimal.", "language": "python", "parameters": "(alph_len)", "return_statement": "return binlen, int(enclen)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "min", "(", "[", "(", "i", ",", "i", "*", "8", "/", "math", ".", "log", "(", "arg_0", ",", "2", ")", ")", "for", "i", "in", "range", "(", "1", ",", "7", ")", "]", ",", "key", "=", "lambda", "k", ":", "k", "[", "1", "]", "%", "1", ")", "return", "arg_1", ",", "int", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    '''\n    computes the ideal conversion ratio for the given alphabet.\n    A ratio is considered ideal when the number of bits in one output\n    encoding chunk that don't add up to one input encoding chunk is minimal.\n    '''\n    arg_1, arg_2 = min([\n                          (i, i*8 / math.log(arg_0, 2))\n                          for i in range(1, 7)\n                         ], key=lambda k: k[1] % 1)\n\n    return arg_1, int(arg_2)", "path": "pwm/encoding.py", "identifier": "calc_chunklen", "docstring": "computes the ideal conversion ratio for the given alphabet.\n    A ratio is considered ideal when the number of bits in one output\n    encoding chunk that don't add up to one input encoding chunk is minimal.", "docstring_tokens": ["computes", "the", "ideal", "conversion", "ratio", "for", "the", "given", "alphabet", ".", "A", "ratio", "is", "considered", "ideal", "when", "the", "number", "of", "bits", "in", "one", "output", "encoding", "chunk", "that", "don", "t", "add", "up", "to", "one", "input", "encoding", "chunk", "is", "minimal", "."], "nwo": "thusoy/pwm", "score": 0.15726537023232431, "idx": 254036}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/instructionset.py#L45-L49", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Invert all instructions.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "arg_0", ".", "instructions", ")", ":", "arg_0", ".", "instructions", "[", "arg_1", "]", "=", "arg_2", ".", "Func", "(", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Invert all instructions.\"\"\"\n        for arg_1, arg_2 in enumerate(arg_0.instructions):\n            arg_0.instructions[arg_1] = arg_2.Func()\n        return arg_0", "path": "qiskit/circuit/instructionset.py", "identifier": "InstructionSet.inverse", "docstring": "Invert all instructions.", "docstring_tokens": ["Invert", "all", "instructions", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254037}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/rich_content.py#L115-L124", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns list of json compatible states of the RichMessage instance\n        nested controls.", "language": "python", "parameters": "(self)", "return_statement": "return json_controls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "list", ":", "arg_1", "=", "[", "control", ".", "Func", "(", ")", "for", "control", "in", "arg_0", ".", "controls", "]", "return", "arg_1"], "function": "def Func(arg_0) -> list:\n        \"\"\"Returns list of Func compatible states of the RichMessage instance\n        nested controls.\n\n        Returns:\n            Func_controls: Json representation of RichMessage instance\n                nested controls.\n        \"\"\"\n        arg_1 = [control.Func() for control in arg_0.controls]\n        return arg_1", "path": "deeppavlov/core/agent/rich_content.py", "identifier": "RichMessage.json", "docstring": "Returns list of json compatible states of the RichMessage instance\n        nested controls.\n\n        Returns:\n            json_controls: Json representation of RichMessage instance\n                nested controls.", "docstring_tokens": ["Returns", "list", "of", "json", "compatible", "states", "of", "the", "RichMessage", "instance", "nested", "controls", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 254038}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/config.py#L100-L113", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Reads the contents of the config file", "language": "python", "parameters": "(self)", "return_statement": "return content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "str", ":", "arg_1", "=", "None", "arg_2", "=", "io", ".", "StringIO", "(", "\"\"", ")", "arg_0", ".", "config", ".", "write", "(", "arg_2", ")", "arg_2", ".", "seek", "(", "0", ")", "arg_1", "=", "arg_2", ".", "read", "(", ")", "arg_2", ".", "close", "(", ")", "return", "arg_1"], "function": "def Func(arg_0) -> str:\n        \"\"\" Reads the contents of the config file \"\"\"\n        arg_1 = None\n        # with open(file_path) as cfg_file:\n        #     contents = cfg_file.read()\n\n        # Dump the current contents into an in-memory file.\n        arg_2 = io.StringIO(\"\")\n        arg_0.config.write(arg_2)\n        arg_2.seek(0)\n        arg_1 = arg_2.read()\n        #     log(DEBUG, \"config content: %s\", content)\n        arg_2.close()\n        return arg_1", "path": "pricedb/config.py", "identifier": "Config.get_contents", "docstring": "Reads the contents of the config file", "docstring_tokens": ["Reads", "the", "contents", "of", "the", "config", "file"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 254039}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/roles.py#L29-L39", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "List all course roles available to an account, for the passed Canvas\n        account ID, including course roles inherited from parent accounts.", "language": "python", "parameters": "(self, account_id)", "return_statement": "return course_roles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "{", "\"show_inherited\"", ":", "\"1\"", "}", "for", "arg_4", "in", "arg_0", ".", "get_roles_in_account", "(", "arg_1", ",", "arg_3", ")", ":", "if", "arg_4", ".", "base_role_type", "!=", "\"AccountMembership\"", ":", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        List all course roles available to an account, for the passed Canvas\n        account ID, including course roles inherited from parent accounts.\n        \"\"\"\n        arg_2 = []\n        arg_3 = {\"show_inherited\": \"1\"}\n        for arg_4 in arg_0.get_roles_in_account(arg_1, arg_3):\n            if arg_4.base_role_type != \"AccountMembership\":\n                arg_2.append(arg_4)\n        return arg_2", "path": "uw_canvas/roles.py", "identifier": "Roles.get_effective_course_roles_in_account", "docstring": "List all course roles available to an account, for the passed Canvas\n        account ID, including course roles inherited from parent accounts.", "docstring_tokens": ["List", "all", "course", "roles", "available", "to", "an", "account", "for", "the", "passed", "Canvas", "account", "ID", "including", "course", "roles", "inherited", "from", "parent", "accounts", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 254040}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/fluxcal.py#L92-L137", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Folds Stokes I noise diode data and integrates along coarse channels", "language": "python", "parameters": "(name,chan_per_coarse,fullstokes=False,**kwargs)", "return_statement": "return OFF_int,ON_int", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "arg_4", "=", "Waterfall", "(", "arg_0", ",", "max_load", "=", "150", ")", "arg_5", "=", "arg_4", ".", "data", "if", "arg_2", "==", "False", "and", "arg_5", ".", "shape", "[", "1", "]", ">", "1", ":", "arg_5", "=", "arg_5", "[", ":", ",", "0", ",", ":", "]", "+", "arg_5", "[", ":", ",", "1", ",", ":", "]", "arg_5", "=", "np", ".", "expand_dims", "(", "arg_5", ",", "axis", "=", "1", ")", "if", "arg_2", "==", "True", ":", "arg_5", "=", "arg_5", "[", ":", ",", "0", ",", ":", "]", "arg_5", "=", "np", ".", "expand_dims", "(", "arg_5", ",", "axis", "=", "1", ")", "arg_6", "=", "arg_4", ".", "header", "[", "'tsamp'", "]", "arg_7", ",", "arg_8", "=", "foldcal", "(", "arg_5", ",", "arg_6", ",", "**", "arg_3", ")", "arg_9", "=", "arg_4", ".", "populate_freqs", "(", ")", "arg_10", "=", "integrate_chans", "(", "arg_8", ",", "arg_9", ",", "arg_1", ")", "arg_11", "=", "integrate_chans", "(", "arg_7", ",", "arg_9", ",", "arg_1", ")", "if", "np", ".", "sum", "(", "arg_10", ")", "<", "np", ".", "sum", "(", "arg_11", ")", ":", "arg_12", "=", "arg_10", "arg_10", "=", "arg_11", "arg_11", "=", "arg_12", "return", "arg_11", ",", "arg_10"], "function": "def Func(arg_0,arg_1,arg_2=False,**arg_3):\n    '''\n    Folds Stokes I noise diode data and integrates along coarse channels\n\n    Parameters\n    ----------\n    name : str\n        Path to noise diode filterbank file\n    chan_per_coarse : int\n        Number of frequency bins per coarse channel\n    fullstokes : boolean\n        Use fullstokes=True if data is in IQUV format or just Stokes I, use fullstokes=False if\n        it is in cross_pols format\n    '''\n    #Load data\n    arg_4 = Waterfall(arg_0,max_load=150)\n    arg_5 = arg_4.data\n\n    #If the data has cross_pols format calculate Stokes I\n    if arg_2==False and arg_5.shape[1]>1:\n        arg_5 = arg_5[:,0,:]+arg_5[:,1,:]\n        arg_5 = np.expand_dims(arg_5,axis=1)\n    #If the data has IQUV format get Stokes I\n    if arg_2==True:\n        arg_5 = arg_5[:,0,:]\n        arg_5 = np.expand_dims(arg_5,axis=1)\n\n    arg_6 = arg_4.header['tsamp']\n\n    #Calculate ON and OFF values\n    arg_7,arg_8 = foldcal(arg_5,arg_6,**arg_3)\n\n    arg_9 = arg_4.populate_freqs()\n\n    #Find ON and OFF spectra by coarse channel\n    arg_10 = integrate_chans(arg_8,arg_9,arg_1)\n    arg_11 = integrate_chans(arg_7,arg_9,arg_1)\n\n    #If \"ON\" is actually \"OFF\" switch them\n    if np.sum(arg_10)<np.sum(arg_11):\n        arg_12 = arg_10\n        arg_10 = arg_11\n        arg_11 = arg_12\n\n    #Return coarse channel spectrum of OFF and ON\n    return arg_11,arg_10", "path": "blimpy/calib_utils/fluxcal.py", "identifier": "integrate_calib", "docstring": "Folds Stokes I noise diode data and integrates along coarse channels\n\n    Parameters\n    ----------\n    name : str\n        Path to noise diode filterbank file\n    chan_per_coarse : int\n        Number of frequency bins per coarse channel\n    fullstokes : boolean\n        Use fullstokes=True if data is in IQUV format or just Stokes I, use fullstokes=False if\n        it is in cross_pols format", "docstring_tokens": ["Folds", "Stokes", "I", "noise", "diode", "data", "and", "integrates", "along", "coarse", "channels"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 254041}
{"url": "https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/utils.py#L64-L68", "sha": "3ebd891ac0c02bad061182dbcb54a47fb21980ae", "docstring_summary": "Replace multiple values in a string", "language": "python", "parameters": "(s, replace)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "for", "arg_2", "in", "Func", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "*", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, Func):\n    \"\"\"Replace multiple values in a string\"\"\"\n    for arg_2 in Func:\n        arg_0 = arg_0.replace(*arg_2)\n    return arg_0", "path": "cli_helpers/utils.py", "identifier": "replace", "docstring": "Replace multiple values in a string", "docstring_tokens": ["Replace", "multiple", "values", "in", "a", "string"], "nwo": "dbcli/cli_helpers", "score": 0.43979569135490515, "idx": 254042}
{"url": "https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/VNDB.py#L17-L62", "sha": "eba01c058100ec8806129b11a2859f3126a1b101", "docstring_summary": "Search vndb.org for a term and return matching results from type.", "language": "python", "parameters": "(self, stype, term)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "\"\"", "if", "arg_1", "not", "in", "[", "'v'", ",", "'r'", ",", "'p'", ",", "'s'", ",", "'c'", ",", "'g'", ",", "'i'", ",", "'u'", "]", ":", "raise", "VNDBBadStype", "(", "arg_1", ")", "else", ":", "if", "arg_1", "in", "[", "'v'", ",", "'p'", ",", "'s'", ",", "'c'", ",", "'u'", "]", ":", "arg_3", "=", "'/{}/all'", ".", "format", "(", "arg_1", ")", "elif", "arg_1", "in", "[", "'g'", ",", "'i'", "]", ":", "arg_3", "=", "'/{}/list'", ".", "format", "(", "arg_1", ")", "elif", "arg_1", "==", "'r'", ":", "arg_3", "=", "'/r'", "async", "with", "arg_0", ".", "session", ".", "get", "(", "arg_0", ".", "base_url", "+", "\"{}\"", ".", "format", "(", "arg_3", ")", ",", "params", "=", "{", "\"q\"", ":", "arg_2", "}", ",", "headers", "=", "arg_0", ".", "headers", ")", "as", "response", ":", "if", "response", ".", "status", "==", "404", ":", "raise", "aiohttp", ".", "HttpBadRequest", "(", "\"VN Not Found\"", ")", "elif", "'q='", "not", "in", "response", ".", "url", ":", "raise", "VNDBOneResult", "(", "arg_2", ",", "response", ".", "url", ".", "rsplit", "(", "'/'", ",", "1", ")", "[", "1", "]", ")", "arg_4", "=", "await", "response", ".", "text", "(", ")", "if", "'No Results'", "in", "arg_4", ":", "raise", "VNDBNoResults", "(", "arg_2", ")", "arg_5", "=", "BeautifulSoup", "(", "arg_4", ",", "'lxml'", ")", "arg_6", "=", "await", "arg_0", ".", "parse_search", "(", "arg_1", ",", "arg_5", ")", "if", "arg_6", "==", "[", "]", ":", "raise", "VNDBNoResults", "(", "arg_2", ")", "return", "arg_6"], "function": "async def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Search vndb.org for a term and return matching results from type.\n\n        :param stype: type to search for.\n            Type should be one of:\n                v - Visual Novels\n                r - Releases\n                p - Producers\n                s - Staff\n                c - Characters\n                g - Tags\n                i - traits\n                u - Users\n        :param term: string to search for\n        :return: Results. Result format depends on what you searched for. See the Parsing.py module for more specific documentation.\n\n        Exceptions:\n            aiohttp.HttpBadRequest - On 404s\n            VNDBOneResult - When you search for something but it instead redirects us to a direct content page\n            VNDBNoResults - When nothing was found for that search\n            VNDBBadStype - Raised when an incorrect search type is passed\n        \"\"\"\n        arg_3 = \"\"\n        if arg_1 not in ['v', 'r', 'p', 's', 'c', 'g', 'i', 'u']:\n            raise VNDBBadStype(arg_1)\n        else:\n            if arg_1 in ['v', 'p', 's', 'c', 'u']:\n                arg_3 = '/{}/all'.format(arg_1)\n            elif arg_1 in ['g', 'i']:\n                arg_3 = '/{}/list'.format(arg_1)\n            elif arg_1 == 'r':\n                arg_3 = '/r'\n        async with arg_0.session.get(arg_0.base_url + \"{}\".format(arg_3), params={\"q\": arg_2}, headers=arg_0.headers) as response:\n            if response.status == 404:\n                raise aiohttp.HttpBadRequest(\"VN Not Found\")\n            elif 'q=' not in response.url:\n                raise VNDBOneResult(arg_2, response.url.rsplit('/', 1)[1])\n            arg_4 = await response.text()\n            if 'No Results' in arg_4:\n                raise VNDBNoResults(arg_2)\n            arg_5 = BeautifulSoup(arg_4, 'lxml')\n            arg_6 = await arg_0.parse_search(arg_1, arg_5)\n            if arg_6 == []:\n                raise VNDBNoResults(arg_2)\n            return arg_6", "path": "Shosetsu/VNDB.py", "identifier": "Shosetsu.search_vndb", "docstring": "Search vndb.org for a term and return matching results from type.\n\n        :param stype: type to search for.\n            Type should be one of:\n                v - Visual Novels\n                r - Releases\n                p - Producers\n                s - Staff\n                c - Characters\n                g - Tags\n                i - traits\n                u - Users\n        :param term: string to search for\n        :return: Results. Result format depends on what you searched for. See the Parsing.py module for more specific documentation.\n\n        Exceptions:\n            aiohttp.HttpBadRequest - On 404s\n            VNDBOneResult - When you search for something but it instead redirects us to a direct content page\n            VNDBNoResults - When nothing was found for that search\n            VNDBBadStype - Raised when an incorrect search type is passed", "docstring_tokens": ["Search", "vndb", ".", "org", "for", "a", "term", "and", "return", "matching", "results", "from", "type", "."], "nwo": "ccubed/Shosetsu", "score": 0.25890992733444657, "idx": 254043}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/action.py#L28-L48", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Get the action description.", "language": "python", "parameters": "(self)", "return_statement": "return description", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "arg_0", ".", "name", ":", "{", "'href'", ":", "arg_0", ".", "href_prefix", "+", "arg_0", ".", "href", ",", "'timeRequested'", ":", "arg_0", ".", "time_requested", ",", "'status'", ":", "arg_0", ".", "status", ",", "}", ",", "}", "if", "arg_0", ".", "input", "is", "not", "None", ":", "arg_1", "[", "arg_0", ".", "name", "]", "[", "'input'", "]", "=", "arg_0", ".", "input", "if", "arg_0", ".", "time_completed", "is", "not", "None", ":", "arg_1", "[", "arg_0", ".", "name", "]", "[", "'timeCompleted'", "]", "=", "arg_0", ".", "time_completed", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Get the action description.\n\n        Returns a dictionary describing the action.\n        \"\"\"\n        arg_1 = {\n            arg_0.name: {\n                'href': arg_0.href_prefix + arg_0.href,\n                'timeRequested': arg_0.time_requested,\n                'status': arg_0.status,\n            },\n        }\n\n        if arg_0.input is not None:\n            arg_1[arg_0.name]['input'] = arg_0.input\n\n        if arg_0.time_completed is not None:\n            arg_1[arg_0.name]['timeCompleted'] = arg_0.time_completed\n\n        return arg_1", "path": "webthing/action.py", "identifier": "Action.as_action_description", "docstring": "Get the action description.\n\n        Returns a dictionary describing the action.", "docstring_tokens": ["Get", "the", "action", "description", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 254044}
{"url": "https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr.py#L210-L234", "sha": "768565deb10467d04a960d27e000ab38b7aa8a62", "docstring_summary": "Estimates the accuracy of the predictions from the constructed feature.", "language": "python", "parameters": "(self, features, class_labels, scoring_function=None, **scoring_function_kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "if", "arg_0", ".", "feature_map", "is", "None", ":", "raise", "ValueError", "(", "'The MDR model must be fit before Func can be called.'", ")", "arg_5", "=", "arg_0", ".", "predict", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "return", "accuracy_Func", "(", "arg_2", ",", "arg_5", ")", "else", ":", "return", "arg_3", "(", "arg_2", ",", "arg_5", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, **arg_4):\n        \"\"\"Estimates the accuracy of the predictions from the constructed feature.\n\n        Parameters\n        ----------\n        features: array-like {n_samples, n_features}\n            Feature matrix to predict from\n        class_labels: array-like {n_samples}\n            List of true class labels\n\n        Returns\n        -------\n        accuracy_Func: float\n            The estimated accuracy based on the constructed feature\n\n        \"\"\"\n        if arg_0.feature_map is None:\n            raise ValueError('The MDR model must be fit before Func can be called.')\n\n        arg_5 = arg_0.predict(arg_1)\n\n        if arg_3 is None:\n            return accuracy_Func(arg_2, arg_5)\n        else:\n            return arg_3(arg_2, arg_5, **arg_4)", "path": "mdr/mdr.py", "identifier": "MDRClassifier.score", "docstring": "Estimates the accuracy of the predictions from the constructed feature.\n\n        Parameters\n        ----------\n        features: array-like {n_samples, n_features}\n            Feature matrix to predict from\n        class_labels: array-like {n_samples}\n            List of true class labels\n\n        Returns\n        -------\n        accuracy_score: float\n            The estimated accuracy based on the constructed feature", "docstring_tokens": ["Estimates", "the", "accuracy", "of", "the", "predictions", "from", "the", "constructed", "feature", "."], "nwo": "EpistasisLab/scikit-mdr", "score": 0.36572091509454285, "idx": 254045}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L696-L722", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Destroy nDestroy synapses on the specified segment, but don't destroy\n    synapses to the \"excludeCells\".", "language": "python", "parameters": "(cls, connections, random, segment,\n                                    nDestroy, excludeCells)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "sorted", "(", "(", "arg_10", "for", "arg_10", "in", "arg_1", ".", "synapsesForSegment", "(", "arg_3", ")", "if", "arg_10", ".", "presynapticCell", "not", "in", "arg_5", ")", ",", "key", "=", "lambda", "s", ":", "s", ".", "_ordinal", ")", "for", "arg_7", "in", "xrange", "(", "arg_4", ")", ":", "if", "len", "(", "arg_6", ")", "==", "0", ":", "break", "arg_8", "=", "None", "arg_9", "=", "float", "(", "\"inf\"", ")", "for", "arg_10", "in", "arg_6", ":", "if", "arg_10", ".", "permanence", "<", "arg_9", "-", "EPSILON", ":", "arg_8", "=", "arg_10", "arg_9", "=", "arg_10", ".", "permanence", "arg_1", ".", "destroySynapse", "(", "arg_8", ")", "arg_6", ".", "remove", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                    arg_4, arg_5):\n    \"\"\"\n    Destroy nDestroy synapses on the specified segment, but don't destroy\n    synapses to the \"excludeCells\".\n    \"\"\"\n\n    arg_6 = sorted(\n      (arg_10 for arg_10 in arg_1.synapsesForSegment(arg_3)\n       if arg_10.presynapticCell not in arg_5),\n      key=lambda s: s._ordinal\n    )\n\n    for arg_7 in xrange(arg_4):\n      if len(arg_6) == 0:\n        break\n\n      arg_8 = None\n      arg_9 = float(\"inf\")\n\n      for arg_10 in arg_6:\n        if arg_10.permanence < arg_9 - EPSILON:\n          arg_8 = arg_10\n          arg_9 = arg_10.permanence\n\n      arg_1.destroySynapse(arg_8)\n      arg_6.remove(arg_8)", "path": "src/nupic/algorithms/temporal_memory.py", "identifier": "TemporalMemory._destroyMinPermanenceSynapses", "docstring": "Destroy nDestroy synapses on the specified segment, but don't destroy\n    synapses to the \"excludeCells\".", "docstring_tokens": ["Destroy", "nDestroy", "synapses", "on", "the", "specified", "segment", "but", "don", "t", "destroy", "synapses", "to", "the", "excludeCells", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254046}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/teams.py#L189-L212", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns head coach data by game.", "language": "python", "parameters": "(self, year)", "return_statement": "return np.array(coachIDs[::-1])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_year_info_pq", "(", "arg_1", ",", "'Coach'", ")", ".", "text", "(", ")", "arg_3", "=", "r'(\\S+?) \\((\\d+)-(\\d+)-(\\d+)\\)'", "arg_4", "=", "[", "]", "arg_5", "=", "True", "while", "arg_5", ":", "arg_5", "=", "re", ".", "search", "(", "arg_3", ",", "arg_2", ")", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_5", ".", "groups", "(", ")", "arg_10", "=", "arg_5", ".", "end", "(", "4", ")", "+", "1", "arg_11", "=", "arg_11", "[", "arg_10", ":", "]", "arg_12", "=", "int", "(", "arg_7", ")", "+", "int", "(", "arg_8", ")", "+", "int", "(", "arg_9", ")", "arg_4", ".", "append", "(", "(", "arg_6", ",", "arg_12", ")", ")", "arg_13", "=", "[", "cID", "for", "cID", ",", "games", "in", "arg_4", "for", "_", "in", "range", "(", "games", ")", "]", "return", "np", ".", "array", "(", "arg_13", "[", ":", ":", "-", "1", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns head coach data by game.\n\n        :year: An int representing the season in question.\n        :returns: An array with an entry per game of the season that the team\n        played (including playoffs). Each entry is the head coach's ID for that\n        game in the season.\n        \"\"\"\n        arg_2 = arg_0._year_info_pq(arg_1, 'Coach').text()\n        arg_3 = r'(\\S+?) \\((\\d+)-(\\d+)-(\\d+)\\)'\n        arg_4 = []\n        arg_5 = True\n        while arg_5:\n            arg_5 = re.search(arg_3, arg_2)\n            arg_6, arg_7, arg_8, arg_9 = arg_5.groups()\n            arg_10 = arg_5.end(4) + 1\n            arg_11 = arg_11[arg_10:]\n            arg_12 = int(arg_7) + int(arg_8) + int(arg_9)\n            arg_4.append((arg_6, arg_12))\n\n        arg_13 = [\n            cID for cID, games in arg_4 for _ in range(games)\n        ]\n        return np.array(arg_13[::-1])", "path": "sportsref/nfl/teams.py", "identifier": "Team.head_coaches_by_game", "docstring": "Returns head coach data by game.\n\n        :year: An int representing the season in question.\n        :returns: An array with an entry per game of the season that the team\n        played (including playoffs). Each entry is the head coach's ID for that\n        game in the season.", "docstring_tokens": ["Returns", "head", "coach", "data", "by", "game", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 254047}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_s3_storage.py#L56-L95", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Decorator for methods that need many retries, because of\n    intermittent failures, such as AWS calls via boto, which has a\n    non-back-off retry.", "language": "python", "parameters": "(func)", "return_statement": "return retry_func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "retry_func", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "1", "while", "True", ":", "try", ":", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "break", "except", "OSError", "as", "exc", ":", "logger", ".", "error", "(", "'assuming OSError unrecoverable'", ")", "raise", "except", "FailedExtraction", "as", "exc", ":", "logger", ".", "error", "(", "'FAIL(%d)'", ",", "arg_4", ",", "exc_info", "=", "True", ")", "raise", "except", "FailedVerification", "as", "exc", ":", "logger", ".", "warn", "(", "'FAIL(%d)'", ",", "arg_4", ",", "exc_info", "=", "True", ")", "if", "arg_4", ">=", "arg_1", ".", "config", "[", "'tries'", "]", ":", "if", "arg_1", ".", "config", ".", "get", "(", "'suppress_failures'", ")", ":", "logger", ".", "warn", "(", "'suppressing failure and breaking out of this loop; data may be corrupt, downstream will have to cope'", ")", "break", "else", ":", "raise", "except", "Exception", "as", "exc", ":", "logger", ".", "warn", "(", "'FAIL(%d): having I/O trouble with S3'", ",", "arg_4", ",", "exc_info", "=", "True", ")", "if", "arg_4", ">=", "arg_1", ".", "config", "[", "'tries'", "]", ":", "raise", "logger", ".", "warn", "(", "'RETRYING (%d left)'", ",", "arg_1", ".", "config", "[", "'tries'", "]", "-", "arg_4", ")", "time", ".", "sleep", "(", "3", "*", "arg_4", ")", "arg_4", "+=", "1", "return", "retry_func"], "function": "def Func(arg_0):\n    '''\n    Decorator for methods that need many retries, because of\n    intermittent failures, such as AWS calls via boto, which has a\n    non-back-off retry.\n    '''\n    def retry_func(arg_1, *arg_2, **arg_3):\n        arg_4 = 1\n        while True:\n            # If a handler allows execution to continue, then\n            # fall through and do a back-off retry.\n            try:\n                return arg_0(arg_1, *arg_2, **arg_3)\n                break\n            except OSError as exc:\n                ## OSError: [Errno 24] Too many open files\n                logger.error('assuming OSError unrecoverable')\n                raise\n            except FailedExtraction as exc:\n                ## pass through exc to caller\n                logger.error('FAIL(%d)', arg_4, exc_info=True)\n                raise\n            except FailedVerification as exc:\n                logger.warn('FAIL(%d)', arg_4, exc_info=True)\n                if arg_4 >= arg_1.config['tries']:\n                    if arg_1.config.get('suppress_failures'):\n                        logger.warn('suppressing failure and breaking out of this loop; data may be corrupt, downstream will have to cope')\n                        break\n                    else:\n                        raise\n            except Exception as exc:\n                logger.warn('FAIL(%d): having I/O trouble with S3', arg_4, exc_info=True)\n                if arg_4 >= arg_1.config['tries']:\n                    raise\n\n            logger.warn('RETRYING (%d left)', arg_1.config['tries'] - arg_4)\n            time.sleep(3 * arg_4)\n            arg_4 += 1\n\n    return retry_func", "path": "streamcorpus_pipeline/_s3_storage.py", "identifier": "_retry", "docstring": "Decorator for methods that need many retries, because of\n    intermittent failures, such as AWS calls via boto, which has a\n    non-back-off retry.", "docstring_tokens": ["Decorator", "for", "methods", "that", "need", "many", "retries", "because", "of", "intermittent", "failures", "such", "as", "AWS", "calls", "via", "boto", "which", "has", "a", "non", "-", "back", "-", "off", "retry", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 254048}
{"url": "https://github.com/edx/edx-organizations/blob/51000d5d359d880a6eb3a79345f60744f1982c00/organizations/validators.py#L23-L33", "sha": "51000d5d359d880a6eb3a79345f60744f1982c00", "docstring_summary": "Organization data validation", "language": "python", "parameters": "(organization_data)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "False", "if", "'id'", "in", "arg_0", "and", "not", "arg_0", ".", "get", "(", "'id'", ")", ":", "return", "False", "if", "'name'", "in", "arg_0", "and", "not", "arg_0", ".", "get", "(", "'name'", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"\n    Organization data validation\n    \"\"\"\n    if arg_0 is None:\n        return False\n    if 'id' in arg_0 and not arg_0.get('id'):\n        return False\n    if 'name' in arg_0 and not arg_0.get('name'):\n        return False\n    return True", "path": "organizations/validators.py", "identifier": "organization_data_is_valid", "docstring": "Organization data validation", "docstring_tokens": ["Organization", "data", "validation"], "nwo": "edx/edx-organizations", "score": 0.5537402011854966, "idx": 254049}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfdocument.py#L120-L131", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "May generate and add a PDFPage separately, or use this to generate\r\n            a default page.", "language": "python", "parameters": "(self, page=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "page", "=", "PDFPage", "(", "arg_0", ".", "orientation_default", ",", "arg_0", ".", "layout_default", ",", "arg_0", ".", "margins", ")", "else", ":", "arg_0", ".", "page", "=", "arg_1", "arg_0", ".", "page", ".", "_set_index", "(", "len", "(", "arg_0", ".", "pages", ")", ")", "arg_0", ".", "pages", ".", "append", "(", "arg_0", ".", "page", ")", "arg_2", "=", "arg_0", ".", "font", "arg_0", ".", "set_font", "(", "font", "=", "arg_2", ")", "arg_0", ".", "session", ".", "_reset_colors", "(", ")"], "function": "def Func(arg_0, arg_1=None):\r\n        \"\"\" May generate and add a PDFPage separately, or use this to generate\r\n            a default page.\"\"\"\r\n        if arg_1 is None:\r\n            arg_0.page = PDFPage(arg_0.orientation_default, arg_0.layout_default, arg_0.margins)\r\n        else:\r\n            arg_0.page = arg_1\r\n        arg_0.page._set_index(len(arg_0.pages))\r\n        arg_0.pages.append(arg_0.page)\r\n        arg_2 = arg_0.font\r\n        arg_0.set_font(font=arg_2)\r\n        arg_0.session._reset_colors()", "path": "pypdflite/pdfdocument.py", "identifier": "PDFDocument.add_page", "docstring": "May generate and add a PDFPage separately, or use this to generate\r\n            a default page.", "docstring_tokens": ["May", "generate", "and", "add", "a", "PDFPage", "separately", "or", "use", "this", "to", "generate", "a", "default", "page", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 254050}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/base.py#L265-L270", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Read one byte in stream", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "bool", ":", "if", "arg_0", ".", "read_eof", "(", ")", ":", "return", "False", "arg_0", ".", "_stream", ".", "incpos", "(", ")", "return", "True"], "function": "def Func(arg_0) -> bool:\n        \"\"\"Read one byte in stream\"\"\"\n        if arg_0.read_eof():\n            return False\n        arg_0._stream.incpos()\n        return True", "path": "pyrser/parsing/base.py", "identifier": "BasicParser.one_char", "docstring": "Read one byte in stream", "docstring_tokens": ["Read", "one", "byte", "in", "stream"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254051}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L476-L482", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Get letters from string only.", "language": "python", "parameters": "(text)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"\"", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", ".", "isalpha", "(", ")", ":", "arg_1", "+=", "arg_2", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Get letters from string only.\"\"\"\n    arg_1 = \"\"\n    for arg_2 in arg_0:\n        if arg_2.isalpha():\n            arg_1 += arg_2\n    return arg_1", "path": "harvestingkit/utils.py", "identifier": "return_letters_from_string", "docstring": "Get letters from string only.", "docstring_tokens": ["Get", "letters", "from", "string", "only", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 254052}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1451-L1460", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Returns the column of the cursor in the input buffer, excluding the\n            contribution by the prompt, or -1 if there is no such column.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_input_buffer_cursor_prompt", "(", ")", "if", "arg_1", "is", "None", ":", "return", "-", "1", "else", ":", "arg_2", "=", "arg_0", ".", "_control", ".", "textCursor", "(", ")", "return", "arg_2", ".", "columnNumber", "(", ")", "-", "len", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\" Returns the column of the cursor in the input buffer, excluding the\n            contribution by the prompt, or -1 if there is no such column.\n        \"\"\"\n        arg_1 = arg_0._get_input_buffer_cursor_prompt()\n        if arg_1 is None:\n            return -1\n        else:\n            arg_2 = arg_0._control.textCursor()\n            return arg_2.columnNumber() - len(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._get_input_buffer_cursor_column", "docstring": "Returns the column of the cursor in the input buffer, excluding the\n            contribution by the prompt, or -1 if there is no such column.", "docstring_tokens": ["Returns", "the", "column", "of", "the", "cursor", "in", "the", "input", "buffer", "excluding", "the", "contribution", "by", "the", "prompt", "or", "-", "1", "if", "there", "is", "no", "such", "column", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254053}
{"url": "https://github.com/boxed/mutmut/blob/dd3bbe9aba3168ed21b85fbfe0b654b150239697/mutmut/__main__.py#L133-L160", "sha": "dd3bbe9aba3168ed21b85fbfe0b654b150239697", "docstring_summary": "Apply a specified mutant to the source code", "language": "python", "parameters": "(mutation_pk, dict_synonyms, backup)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "filename_and_mutation_id_from_pk", "(", "int", "(", "arg_0", ")", ")", "update_line_numbers", "(", "arg_3", ")", "arg_5", "=", "Context", "(", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", ")", "mutate_file", "(", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", ")", "if", "arg_5", ".", "number_of_performed_mutations", "==", "0", ":", "raise", "RuntimeError", "(", "'No mutations performed.'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Apply a specified mutant to the source code\n\n    :param mutation_pk: mutmut cache primary key of the mutant to apply\n    :type mutation_pk: str\n\n    :param dict_synonyms: list of synonym keywords for a python dictionary\n    :type dict_synonyms: list[str]\n\n    :param backup: if :obj:`True` create a backup of the source file\n        before applying the mutation\n    :type backup: bool\n    \"\"\"\n    arg_3, arg_4 = filename_and_mutation_id_from_pk(int(arg_0))\n\n    update_line_numbers(arg_3)\n\n    arg_5 = Context(\n        arg_4=arg_4,\n        arg_3=arg_3,\n        arg_1=arg_1,\n    )\n    mutate_file(\n        arg_2=arg_2,\n        arg_5=arg_5,\n    )\n    if arg_5.number_of_performed_mutations == 0:\n        raise RuntimeError('No mutations performed.')", "path": "mutmut/__main__.py", "identifier": "do_apply", "docstring": "Apply a specified mutant to the source code\n\n    :param mutation_pk: mutmut cache primary key of the mutant to apply\n    :type mutation_pk: str\n\n    :param dict_synonyms: list of synonym keywords for a python dictionary\n    :type dict_synonyms: list[str]\n\n    :param backup: if :obj:`True` create a backup of the source file\n        before applying the mutation\n    :type backup: bool", "docstring_tokens": ["Apply", "a", "specified", "mutant", "to", "the", "source", "code"], "nwo": "boxed/mutmut", "score": 0.7603128213581444, "idx": 254054}
{"url": "https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L72-L81", "sha": "7be8b956e53c70b35f34e1783a8fe8f716955afb", "docstring_summary": "Output a link tag to a css stylesheet.", "language": "python", "parameters": "(url)", "return_statement": "return '<link href=\"{src}\" rel=\"stylesheet\">'.format(src=url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "startswith", "(", "'http://'", ")", "and", "not", "arg_0", "[", ":", "1", "]", "==", "'/'", ":", "arg_0", "=", "settings", ".", "STATIC_URL", "+", "arg_0", "return", "'<link href=\"{src}\" rel=\"stylesheet\">'", ".", "format", "(", "src", "=", "arg_0", ")"], "function": "def Func(arg_0):\n    '''\n    Output a link tag to a css stylesheet.\n    '''\n\n    if not arg_0.startswith('http://') and not arg_0[:1] == '/':\n        #add media_url for relative paths\n        arg_0 = settings.STATIC_URL + arg_0\n\n    return '<link href=\"{src}\" rel=\"stylesheet\">'.format(src=arg_0)", "path": "django_baseline/templatetags/helpers.py", "identifier": "cssfile", "docstring": "Output a link tag to a css stylesheet.", "docstring_tokens": ["Output", "a", "link", "tag", "to", "a", "css", "stylesheet", "."], "nwo": "theduke/django-baseline", "score": 0.0, "idx": 254055}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/abstractcpu.py#L301-L339", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Extract arguments for model from the environment and return as a tuple that\n        is ready to be passed to the model.", "language": "python", "parameters": "(self, model, prefix_args)", "return_statement": "return arguments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "inspect", ".", "getfullargspec", "(", "arg_1", ")", "if", "arg_3", ".", "varargs", ":", "logger", ".", "warning", "(", "\"ABI: A vararg model must be a unary function.\"", ")", "arg_4", "=", "len", "(", "arg_3", ".", "args", ")", "-", "len", "(", "arg_2", ")", "if", "inspect", ".", "ismethod", "(", "arg_1", ")", ":", "arg_4", "-=", "1", "def", "resolve_argument", "(", "arg_5", ")", ":", "if", "isinstance", "(", "arg_5", ",", "str", ")", ":", "return", "arg_0", ".", "_cpu", ".", "read_register", "(", "arg_5", ")", "else", ":", "return", "arg_0", ".", "_cpu", ".", "read_int", "(", "arg_5", ")", "arg_6", "=", "arg_0", ".", "get_arguments", "(", ")", "arg_7", "=", "map", "(", "resolve_argument", ",", "arg_6", ")", "from", ".", ".", "models", "import", "isvariadic", "if", "isvariadic", "(", "arg_1", ")", ":", "arg_8", "=", "arg_2", "+", "(", "arg_7", ",", ")", "else", ":", "arg_8", "=", "arg_2", "+", "tuple", "(", "islice", "(", "arg_7", ",", "arg_4", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Extract arguments for model from the environment and return as a tuple that\n        is ready to be passed to the model.\n\n        :param callable model: Python model of the function\n        :param tuple prefix_args: Parameters to pass to model before actual ones\n        :return: Arguments to be passed to the model\n        :rtype: tuple\n        \"\"\"\n        arg_3 = inspect.getfullargspec(arg_1)\n\n        if arg_3.varargs:\n            logger.warning(\"ABI: A vararg model must be a unary function.\")\n\n        arg_4 = len(arg_3.args) - len(arg_2)\n\n        # If the model is a method, we need to account for `self`\n        if inspect.ismethod(arg_1):\n            arg_4 -= 1\n\n        def resolve_argument(arg_5):\n            if isinstance(arg_5, str):\n                return arg_0._cpu.read_register(arg_5)\n            else:\n                return arg_0._cpu.read_int(arg_5)\n\n        # Create a stream of resolved arguments from argument descriptors\n        arg_6 = arg_0.get_arguments()\n        arg_7 = map(resolve_argument, arg_6)\n\n        from ..models import isvariadic  # prevent circular imports\n\n        if isvariadic(arg_1):\n            arg_8 = arg_2 + (arg_7,)\n        else:\n            arg_8 = arg_2 + tuple(islice(arg_7, arg_4))\n\n        return arg_8", "path": "manticore/native/cpu/abstractcpu.py", "identifier": "Abi.get_argument_values", "docstring": "Extract arguments for model from the environment and return as a tuple that\n        is ready to be passed to the model.\n\n        :param callable model: Python model of the function\n        :param tuple prefix_args: Parameters to pass to model before actual ones\n        :return: Arguments to be passed to the model\n        :rtype: tuple", "docstring_tokens": ["Extract", "arguments", "for", "model", "from", "the", "environment", "and", "return", "as", "a", "tuple", "that", "is", "ready", "to", "be", "passed", "to", "the", "model", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254056}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L5781-L5790", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Extract Packed Floating-Point Values", "language": "python", "parameters": "(cpu, dest, src, offset)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_3", "=", "arg_3", ".", "read", "(", ")", "arg_1", ".", "write", "(", "Operators", ".", "EXTRACT", "(", "arg_2", ".", "read", "(", ")", ",", "arg_3", "*", "128", ",", "(", "arg_3", "+", "1", ")", "*", "128", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Extract Packed Floating-Point Values\n\n        Extracts 128-bits of packed floating-point values from the source\n        operand (second operand) at an 128-bit offset from imm8[0] into the\n        destination operand (first operand). The destination may be either an\n        XMM register or an 128-bit memory location.\n        \"\"\"\n        arg_3 = arg_3.read()\n        arg_1.write(Operators.EXTRACT(arg_2.read(), arg_3 * 128, (arg_3 + 1) * 128))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.VEXTRACTF128", "docstring": "Extract Packed Floating-Point Values\n\n        Extracts 128-bits of packed floating-point values from the source\n        operand (second operand) at an 128-bit offset from imm8[0] into the\n        destination operand (first operand). The destination may be either an\n        XMM register or an 128-bit memory location.", "docstring_tokens": ["Extract", "Packed", "Floating", "-", "Point", "Values"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254057}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qi/qi.py#L377-L398", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Calculate the concurrence.", "language": "python", "parameters": "(state)", "return_statement": "return max(0.0, w[-1] - np.sum(w[0:-1]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "array", "(", "arg_0", ")", "if", "arg_1", ".", "ndim", "==", "1", ":", "arg_1", "=", "outer", "(", "arg_0", ")", "if", "len", "(", "arg_0", ")", "!=", "4", ":", "raise", "Exception", "(", "\"Concurrence is only defined for more than two qubits\"", ")", "arg_2", "=", "np", ".", "fliplr", "(", "np", ".", "diag", "(", "[", "-", "1", ",", "1", ",", "1", ",", "-", "1", "]", ")", ")", "arg_3", "=", "arg_1", ".", "dot", "(", "arg_2", ")", ".", "dot", "(", "arg_1", ".", "conj", "(", ")", ")", ".", "dot", "(", "arg_2", ")", "arg_4", "=", "la", ".", "eigh", "(", "arg_3", ",", "eigvals_only", "=", "True", ")", "arg_4", "=", "np", ".", "sqrt", "(", "np", ".", "maximum", "(", "arg_4", ",", "0", ")", ")", "return", "max", "(", "0.0", ",", "arg_4", "[", "-", "1", "]", "-", "np", ".", "sum", "(", "arg_4", "[", "0", ":", "-", "1", "]", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Calculate the Func.\n\n    Args:\n        state (np.array): a quantum state (1x4 array) or a density matrix (4x4\n                          array)\n    Returns:\n        float: Func.\n    Raises:\n        Exception: if attempted on more than two qubits.\n    \"\"\"\n    arg_1 = np.array(arg_0)\n    if arg_1.ndim == 1:\n        arg_1 = outer(arg_0)\n    if len(arg_0) != 4:\n        raise Exception(\"Concurrence is only defined for more than two qubits\")\n\n    arg_2 = np.fliplr(np.diag([-1, 1, 1, -1]))\n    arg_3 = arg_1.dot(arg_2).dot(arg_1.conj()).dot(arg_2)\n    arg_4 = la.eigh(arg_3, eigvals_only=True)\n    arg_4 = np.sqrt(np.maximum(arg_4, 0))\n    return max(0.0, arg_4[-1] - np.sum(arg_4[0:-1]))", "path": "qiskit/tools/qi/qi.py", "identifier": "concurrence", "docstring": "Calculate the concurrence.\n\n    Args:\n        state (np.array): a quantum state (1x4 array) or a density matrix (4x4\n                          array)\n    Returns:\n        float: concurrence.\n    Raises:\n        Exception: if attempted on more than two qubits.", "docstring_tokens": ["Calculate", "the", "concurrence", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254058}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/api.py#L414-L453", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Discard deposit changes.", "language": "python", "parameters": "(self, pid=None)", "return_statement": "return self.__class__(self.model.json, model=self.model)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "arg_0", ".", "pid", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "before_record_update", ".", "send", "(", "current_app", ".", "_get_current_object", "(", ")", ",", "arg_3", "=", "arg_0", ")", "arg_2", ",", "arg_3", "=", "arg_0", ".", "fetch_published", "(", ")", "arg_0", ".", "model", ".", "json", "=", "deepcopy", "(", "arg_3", ".", "model", ".", "json", ")", "arg_0", ".", "model", ".", "json", "[", "'$schema'", "]", "=", "arg_0", ".", "build_deposit_schema", "(", "arg_3", ")", "flag_modified", "(", "arg_0", ".", "model", ",", "'json'", ")", "db", ".", "session", ".", "merge", "(", "arg_0", ".", "model", ")", "after_record_update", ".", "send", "(", "current_app", ".", "_get_current_object", "(", ")", ",", "arg_3", "=", "arg_0", ")", "return", "arg_0", ".", "__class__", "(", "arg_0", ".", "model", ".", "json", ",", "arg_4", "=", "arg_0", ".", "model", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Discard deposit changes.\n\n        #. The signal :data:`invenio_records.signals.before_record_update` is\n            sent before the edit execution.\n\n        #. It restores the last published version.\n\n        #. The following meta information are saved inside the deposit:\n\n        .. code-block:: python\n\n            deposit['$schema'] = deposit_schema_from_record_schema\n\n        #. The signal :data:`invenio_records.signals.after_record_update` is\n            sent after the edit execution.\n\n        #. The deposit index is updated.\n\n        Status required: ``'draft'``.\n\n        :param pid: Force a pid object. (Default: ``None``)\n        :returns: A new Deposit object.\n        \"\"\"\n        arg_1 = arg_1 or arg_0.pid\n\n        with db.session.begin_nested():\n            before_record_update.send(\n                current_app._get_current_object(), arg_3=arg_0)\n\n            arg_2, arg_3 = arg_0.fetch_published()\n            arg_0.model.json = deepcopy(arg_3.model.json)\n            arg_0.model.json['$schema'] = arg_0.build_deposit_schema(arg_3)\n\n            flag_modified(arg_0.model, 'json')\n            db.session.merge(arg_0.model)\n\n        after_record_update.send(\n            current_app._get_current_object(), arg_3=arg_0)\n        return arg_0.__class__(arg_0.model.json, arg_4=arg_0.model)", "path": "invenio_deposit/api.py", "identifier": "Deposit.discard", "docstring": "Discard deposit changes.\n\n        #. The signal :data:`invenio_records.signals.before_record_update` is\n            sent before the edit execution.\n\n        #. It restores the last published version.\n\n        #. The following meta information are saved inside the deposit:\n\n        .. code-block:: python\n\n            deposit['$schema'] = deposit_schema_from_record_schema\n\n        #. The signal :data:`invenio_records.signals.after_record_update` is\n            sent after the edit execution.\n\n        #. The deposit index is updated.\n\n        Status required: ``'draft'``.\n\n        :param pid: Force a pid object. (Default: ``None``)\n        :returns: A new Deposit object.", "docstring_tokens": ["Discard", "deposit", "changes", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 254059}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/display.py#L923-L932", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Get the frequencies for FFT bins", "language": "python", "parameters": "(n, sr=22050, **_kwargs)", "return_statement": "return basis", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "22050", ",", "**", "arg_2", ")", ":", "arg_3", "=", "2", "*", "(", "arg_0", "-", "1", ")", "arg_4", "=", "core", ".", "fft_frequencies", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", "arg_5", "=", "arg_4", "[", "-", "1", "]", "arg_4", "-=", "0.5", "*", "(", "arg_4", "[", "1", "]", "-", "arg_4", "[", "0", "]", ")", "arg_4", "=", "np", ".", "append", "(", "np", ".", "maximum", "(", "0", ",", "arg_4", ")", ",", "[", "arg_5", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=22050, **arg_2):\n    '''Get the frequencies for FFT bins'''\n    arg_3 = 2 * (arg_0 - 1)\n    # The following code centers the FFT bins at their frequencies\n    # and clips to the non-negative frequency range [0, nyquist]\n    arg_4 = core.fft_frequencies(arg_1=arg_1, arg_3=arg_3)\n    arg_5 = arg_4[-1]\n    arg_4 -= 0.5 * (arg_4[1] - arg_4[0])\n    arg_4 = np.append(np.maximum(0, arg_4), [arg_5])\n    return arg_4", "path": "librosa/display.py", "identifier": "__coord_fft_hz", "docstring": "Get the frequencies for FFT bins", "docstring_tokens": ["Get", "the", "frequencies", "for", "FFT", "bins"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 254060}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_styles.py#L278-L293", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Renders a javascript snippet suitable for use as a mapbox-gl heatmap paint entry", "language": "python", "parameters": "(self)", "return_statement": "return snippet", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'heatmap-radius'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "radius", ")", ",", "'heatmap-opacity'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "opacity", ")", ",", "'heatmap-color'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "color", ")", ",", "'heatmap-intensity'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "intensity", ")", ",", "'heatmap-weight'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "weight", ")", "}", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Renders a javascript snippet suitable for use as a mapbox-gl heatmap Func entry\n\n        Returns:\n            A dict that can be converted to a mapbox-gl javascript Func snippet\n        \"\"\"\n        arg_1 = {\n            'heatmap-radius': VectorStyle.get_style_value(arg_0.radius),\n            'heatmap-opacity': VectorStyle.get_style_value(arg_0.opacity),\n            'heatmap-color': VectorStyle.get_style_value(arg_0.color),\n            'heatmap-intensity': VectorStyle.get_style_value(arg_0.intensity),\n            'heatmap-weight': VectorStyle.get_style_value(arg_0.weight)\n        }\n\n        return arg_1", "path": "gbdxtools/vector_styles.py", "identifier": "HeatmapStyle.paint", "docstring": "Renders a javascript snippet suitable for use as a mapbox-gl heatmap paint entry\n\n        Returns:\n            A dict that can be converted to a mapbox-gl javascript paint snippet", "docstring_tokens": ["Renders", "a", "javascript", "snippet", "suitable", "for", "use", "as", "a", "mapbox", "-", "gl", "heatmap", "paint", "entry"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 254061}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/dbapi_hook.py#L256-L272", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns the SQL literal of the cell as a string.", "language": "python", "parameters": "(cell, conn=None)", "return_statement": "return str(cell)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "return", "None", "if", "isinstance", "(", "arg_0", ",", "datetime", ")", ":", "return", "arg_0", ".", "isoformat", "(", ")", "return", "str", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Returns the SQL literal of the cell as a string.\n\n        :param cell: The cell to insert into the table\n        :type cell: object\n        :param conn: The database connection\n        :type conn: connection object\n        :return: The serialized cell\n        :rtype: str\n        \"\"\"\n\n        if arg_0 is None:\n            return None\n        if isinstance(arg_0, datetime):\n            return arg_0.isoformat()\n        return str(arg_0)", "path": "airflow/hooks/dbapi_hook.py", "identifier": "DbApiHook._serialize_cell", "docstring": "Returns the SQL literal of the cell as a string.\n\n        :param cell: The cell to insert into the table\n        :type cell: object\n        :param conn: The database connection\n        :type conn: connection object\n        :return: The serialized cell\n        :rtype: str", "docstring_tokens": ["Returns", "the", "SQL", "literal", "of", "the", "cell", "as", "a", "string", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254062}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L92-L105", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets the document data license.\n        Raises value error if malformed value, CardinalityError\n        if already defined.", "language": "python", "parameters": "(self, doc, lics)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "doc_data_lics_set", ":", "arg_0", ".", "doc_data_lics_set", "=", "True", "if", "validations", ".", "validate_data_lics", "(", "arg_2", ")", ":", "arg_1", ".", "data_license", "=", "document", ".", "License", ".", "from_identifier", "(", "arg_2", ")", "return", "True", "else", ":", "raise", "SPDXValueError", "(", "'Document::DataLicense'", ")", "else", ":", "raise", "CardinalityError", "(", "'Document::DataLicense'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets the document data license.\n        Raises value error if malformed value, CardinalityError\n        if already defined.\n        \"\"\"\n        if not arg_0.doc_data_lics_set:\n            arg_0.doc_data_lics_set = True\n            if validations.validate_data_lics(arg_2):\n                arg_1.data_license = document.License.from_identifier(arg_2)\n                return True\n            else:\n                raise SPDXValueError('Document::DataLicense')\n        else:\n            raise CardinalityError('Document::DataLicense')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "DocBuilder.set_doc_data_lics", "docstring": "Sets the document data license.\n        Raises value error if malformed value, CardinalityError\n        if already defined.", "docstring_tokens": ["Sets", "the", "document", "data", "license", ".", "Raises", "value", "error", "if", "malformed", "value", "CardinalityError", "if", "already", "defined", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254063}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L70-L75", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Given a spec for an app, returns the value of the `build` field for docker-compose.\n    If the path is relative, it is expanded and added to the path of the app's repo.", "language": "python", "parameters": "(app_spec)", "return_statement": "return os.path.join(Repo(app_spec['repo']).local_path, app_spec['build'])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "isabs", "(", "arg_0", "[", "'build'", "]", ")", ":", "return", "arg_0", "[", "'build'", "]", "return", "os", ".", "path", ".", "join", "(", "Repo", "(", "arg_0", "[", "'repo'", "]", ")", ".", "local_path", ",", "arg_0", "[", "'build'", "]", ")"], "function": "def Func(arg_0):\n    \"\"\" Given a spec for an app, returns the value of the `build` field for docker-compose.\n    If the path is relative, it is expanded and added to the path of the app's repo. \"\"\"\n    if os.path.isabs(arg_0['build']):\n        return arg_0['build']\n    return os.path.join(Repo(arg_0['repo']).local_path, arg_0['build'])", "path": "dusty/compiler/compose/__init__.py", "identifier": "_get_build_path", "docstring": "Given a spec for an app, returns the value of the `build` field for docker-compose.\n    If the path is relative, it is expanded and added to the path of the app's repo.", "docstring_tokens": ["Given", "a", "spec", "for", "an", "app", "returns", "the", "value", "of", "the", "build", "field", "for", "docker", "-", "compose", ".", "If", "the", "path", "is", "relative", "it", "is", "expanded", "and", "added", "to", "the", "path", "of", "the", "app", "s", "repo", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 254064}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/archive_util.py#L83-L105", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Unpack\" a directory, using the same interface as for archives", "language": "python", "parameters": "(filename, extract_dir, progress_filter=default_filter)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "if", "not", "arg_11", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "raise", "UnrecognizedFormat", "(", "\"%s is not a directory\"", "%", "(", "arg_0", ",", ")", ")", "arg_4", "=", "{", "arg_0", ":", "(", "''", ",", "arg_1", ")", "}", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_11", ".", "walk", "(", "arg_0", ")", ":", "arg_8", ",", "arg_9", "=", "arg_4", "[", "arg_5", "]", "for", "arg_10", "in", "arg_6", ":", "arg_4", "[", "arg_11", ".", "path", ".", "join", "(", "arg_5", ",", "arg_10", ")", "]", "=", "arg_8", "+", "arg_10", "+", "'/'", ",", "arg_11", ".", "path", ".", "join", "(", "arg_9", ",", "arg_10", ")", "for", "arg_14", "in", "arg_7", ":", "arg_15", "=", "arg_8", "+", "arg_14", "arg_16", "=", "arg_11", ".", "path", ".", "join", "(", "arg_9", ",", "arg_14", ")", "arg_16", "=", "arg_2", "(", "arg_8", "+", "arg_14", ",", "arg_16", ")", "if", "not", "arg_16", ":", "continue", "ensure_directory", "(", "arg_16", ")", "arg_14", "=", "arg_11", ".", "path", ".", "join", "(", "arg_5", ",", "arg_14", ")", "shutil", ".", "copyfile", "(", "arg_14", ",", "arg_16", ")", "shutil", ".", "copystat", "(", "arg_14", ",", "arg_16", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n    \"\"\"\"Unpack\" a directory, using the same interface as for archives\n\n    Raises ``UnrecognizedFormat`` if `filename` is not a directory\n    \"\"\"\n    if not arg_11.path.isdir(arg_0):\n        raise UnrecognizedFormat(\"%s is not a directory\" % (arg_0,))\n\n    arg_4 = {arg_0:('',arg_1)}\n    for arg_5, arg_6, arg_7 in arg_11.walk(arg_0):\n        arg_8,arg_9 = arg_4[arg_5]\n        for arg_10 in arg_6:\n            arg_4[arg_11.path.join(arg_5,arg_10)] = arg_8+arg_10+'/', arg_11.path.join(arg_9,arg_10)\n        for arg_14 in arg_7:\n            arg_15 = arg_8+arg_14\n            arg_16 = arg_11.path.join(arg_9,arg_14)\n            arg_16 = arg_2(arg_8+arg_14, arg_16)\n            if not arg_16:\n                continue    # skip non-files\n            ensure_directory(arg_16)\n            arg_14 = arg_11.path.join(arg_5,arg_14)\n            shutil.copyfile(arg_14, arg_16)\n            shutil.copystat(arg_14, arg_16)", "path": "environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/archive_util.py", "identifier": "unpack_directory", "docstring": "Unpack\" a directory, using the same interface as for archives\n\n    Raises ``UnrecognizedFormat`` if `filename` is not a directory", "docstring_tokens": ["Unpack", "a", "directory", "using", "the", "same", "interface", "as", "for", "archives"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254065}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/query.py#L11-L50", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Build a mongo query across multiple cases.\n        Translate query options from a form into a complete mongo query dictionary.", "language": "python", "parameters": "(self, query=None, category='snv', variant_type=['clinical'])", "return_statement": "return mongo_variant_query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'snv'", ",", "arg_3", "=", "[", "'clinical'", "]", ")", ":", "arg_1", "=", "arg_1", "or", "{", "}", "arg_4", "=", "{", "}", "LOG", ".", "debug", "(", "\"Building a mongo query for %s\"", "%", "arg_1", ")", "if", "arg_1", ".", "get", "(", "'hgnc_symbols'", ")", ":", "arg_4", "[", "'hgnc_symbols'", "]", "=", "{", "'$in'", ":", "arg_1", "[", "'hgnc_symbols'", "]", "}", "arg_4", "[", "'variant_type'", "]", "=", "{", "'$in'", ":", "arg_3", "}", "arg_4", "[", "'category'", "]", "=", "arg_2", "arg_5", "=", "arg_1", ".", "get", "(", "'rank_score'", ")", "or", "15", "arg_4", "[", "'rank_score'", "]", "=", "{", "'$gte'", ":", "arg_5", "}", "LOG", ".", "debug", "(", "\"Querying %s\"", "%", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2='snv', arg_3=['clinical']):\n        \"\"\"Build a mongo query across multiple cases.\n        Translate query options from a form into a complete mongo query dictionary.\n\n        Beware that unindexed queries against a large variant collection will\n        be extremely slow.\n\n        Currently indexed query options:\n            hgnc_symbols\n            rank_score\n            variant_type\n            category\n\n        Args:\n            query(dict): A query dictionary for the database, from a query form.\n            category(str): 'snv', 'sv', 'str' or 'cancer'\n            variant_type(str): 'clinical' or 'research'\n\n        Returns:\n            mongo_query : A dictionary in the mongo query format.\n        \"\"\"\n\n        arg_1 = arg_1 or {}\n        arg_4 = {}\n\n        LOG.debug(\"Building a mongo query for %s\" % arg_1)\n\n        if arg_1.get('hgnc_symbols'):\n            arg_4['hgnc_symbols'] = {'$in': arg_1['hgnc_symbols']}\n\n        arg_4['variant_type'] = {'$in': arg_3}\n\n        arg_4['category'] = arg_2\n\n        arg_5 = arg_1.get('rank_score') or 15\n\n        arg_4['rank_score'] = {'$gte': arg_5}\n        LOG.debug(\"Querying %s\" % arg_4)\n\n        return arg_4", "path": "scout/adapter/mongo/query.py", "identifier": "QueryHandler.build_variant_query", "docstring": "Build a mongo query across multiple cases.\n        Translate query options from a form into a complete mongo query dictionary.\n\n        Beware that unindexed queries against a large variant collection will\n        be extremely slow.\n\n        Currently indexed query options:\n            hgnc_symbols\n            rank_score\n            variant_type\n            category\n\n        Args:\n            query(dict): A query dictionary for the database, from a query form.\n            category(str): 'snv', 'sv', 'str' or 'cancer'\n            variant_type(str): 'clinical' or 'research'\n\n        Returns:\n            mongo_query : A dictionary in the mongo query format.", "docstring_tokens": ["Build", "a", "mongo", "query", "across", "multiple", "cases", ".", "Translate", "query", "options", "from", "a", "form", "into", "a", "complete", "mongo", "query", "dictionary", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254066}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/formula.py#L83-L95", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Calculate the mol mass of the compound", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "sum", "(", "[", "arg_2", "*", "elements_and_molecular_Funcs", "[", "arg_1", "]", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "elements", ".", "items", "(", ")", "]", ")", "except", "KeyError", "as", "e", ":", "warn", "(", "\"The element %s does not appear in the periodic table\"", "%", "e", ")"], "function": "def Func(arg_0):\n        \"\"\"Calculate the mol mass of the compound\n\n        Returns\n        -------\n        float\n            the mol mass\n        \"\"\"\n        try:\n            return sum([arg_2 * elements_and_molecular_Funcs[arg_1]\n                        for arg_1, arg_2 in arg_0.elements.items()])\n        except KeyError as e:\n            warn(\"The element %s does not appear in the periodic table\" % e)", "path": "cobra/core/formula.py", "identifier": "Formula.weight", "docstring": "Calculate the mol mass of the compound\n\n        Returns\n        -------\n        float\n            the mol mass", "docstring_tokens": ["Calculate", "the", "mol", "mass", "of", "the", "compound"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 254067}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1261-L1268", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "_rem_id_from_keys - Remove primary key from table\n\t\t\tinternal", "language": "python", "parameters": "(self, pk, conn=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_2", ".", "srem", "(", "arg_0", ".", "_get_ids_key", "(", ")", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n\t\t'''\n\t\t\tFunc - Remove primary key from table\n\t\t\tinternal\n\t\t'''\n\t\tif arg_2 is None:\n\t\t\targ_2 = arg_0._get_connection()\n\t\targ_2.srem(arg_0._get_ids_key(), arg_1)", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisHelper._rem_id_from_keys", "docstring": "_rem_id_from_keys - Remove primary key from table\n\t\t\tinternal", "docstring_tokens": ["_rem_id_from_keys", "-", "Remove", "primary", "key", "from", "table", "internal"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 254068}
{"url": "https://github.com/py3270/py3270/blob/c3e91b519f3a18b4be4799a00a96341957a8831f/py3270/__init__.py#L315-L335", "sha": "c3e91b519f3a18b4be4799a00a96341957a8831f", "docstring_summary": "terminates the underlying x3270 subprocess. Once called, this\n            Emulator instance must no longer be used.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_Funcd", ":", "log", ".", "debug", "(", "\"terminal client Funcd\"", ")", "try", ":", "arg_0", ".", "exec_command", "(", "b\"Quit\"", ")", "except", "BrokenPipeError", ":", "pass", "except", "socket", ".", "error", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "ECONNRESET", ":", "raise", "arg_0", ".", "app", ".", "close", "(", ")", "arg_0", ".", "is_Funcd", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"\n            Funcs the underlying x3270 subprocess. Once called, this\n            Emulator instance must no longer be used.\n        \"\"\"\n        if not arg_0.is_Funcd:\n            log.debug(\"terminal client Funcd\")\n            try:\n                arg_0.exec_command(b\"Quit\")\n            except BrokenPipeError:  # noqa\n                # x3270 was Funcd, since we are just quitting anyway, ignore it.\n                pass\n            except socket.error as e:\n                if e.errno != errno.ECONNRESET:\n                    raise\n                # this can happen because wc3270 closes the socket before\n                # the read() can happen, causing a socket error\n\n            arg_0.app.close()\n\n            arg_0.is_Funcd = True", "path": "py3270/__init__.py", "identifier": "Emulator.terminate", "docstring": "terminates the underlying x3270 subprocess. Once called, this\n            Emulator instance must no longer be used.", "docstring_tokens": ["terminates", "the", "underlying", "x3270", "subprocess", ".", "Once", "called", "this", "Emulator", "instance", "must", "no", "longer", "be", "used", "."], "nwo": "py3270/py3270", "score": 0.5197916506919441, "idx": 254069}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/writers/rdf.py#L209-L258", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Create a node for spdx.file.", "language": "python", "parameters": "(self, doc_file)", "return_statement": "return file_node", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "URIRef", "(", "'http://www.spdx.org/files#{id}'", ".", "format", "(", "id", "=", "str", "(", "arg_1", ".", "spdx_id", ")", ")", ")", "arg_3", "=", "(", "arg_2", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", ".", "File", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_3", ")", "arg_4", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "fileName", ",", "Literal", "(", "arg_1", ".", "name", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_4", ")", "if", "arg_1", ".", "has_optional_field", "(", "'comment'", ")", ":", "arg_5", "=", "(", "arg_2", ",", "RDFS", ".", "comment", ",", "Literal", "(", "arg_1", ".", "comment", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_5", ")", "if", "arg_1", ".", "has_optional_field", "(", "'type'", ")", ":", "arg_6", "=", "arg_0", ".", "spdx_namespace", "[", "arg_0", ".", "FILE_TYPES", "[", "arg_1", ".", "type", "]", "]", "arg_7", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "fileType", ",", "arg_6", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_7", ")", "arg_0", ".", "graph", ".", "add", "(", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "checksum", ",", "arg_0", ".", "create_checksum_node", "(", "arg_1", ".", "chk_sum", ")", ")", ")", "arg_8", "=", "arg_0", ".", "license_or_special", "(", "arg_1", ".", "conc_lics", ")", "arg_9", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "licenseConcluded", ",", "arg_8", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_9", ")", "arg_10", "=", "map", "(", "arg_0", ".", "license_or_special", ",", "arg_1", ".", "licenses_in_file", ")", "for", "arg_11", "in", "arg_10", ":", "arg_12", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "licenseInfoInFile", ",", "arg_11", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_12", ")", "if", "arg_1", ".", "has_optional_field", "(", "'license_comment'", ")", ":", "arg_5", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "licenseComments", ",", "Literal", "(", "arg_1", ".", "license_comment", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_5", ")", "arg_13", "=", "arg_0", ".", "to_special_value", "(", "arg_1", ".", "copyright", ")", "arg_14", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "copyrightText", ",", "arg_13", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_14", ")", "if", "arg_1", ".", "has_optional_field", "(", "'notice'", ")", ":", "arg_15", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "noticeText", ",", "arg_1", ".", "notice", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_15", ")", "arg_16", "=", "map", "(", "lambda", "c", ":", "Literal", "(", "c", ")", ",", "arg_1", ".", "contributors", ")", "arg_17", "=", "[", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "fileContributor", ",", "node", ")", "for", "node", "in", "arg_16", "]", "for", "arg_12", "in", "arg_17", ":", "arg_0", ".", "graph", ".", "add", "(", "arg_12", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a node for spdx.file.\n        \"\"\"\n        arg_2 = URIRef('http://www.spdx.org/files#{id}'.format(\n            id=str(arg_1.spdx_id)))\n        arg_3 = (arg_2, RDF.type, arg_0.spdx_namespace.File)\n        arg_0.graph.add(arg_3)\n\n        arg_4 = (arg_2, arg_0.spdx_namespace.fileName, Literal(arg_1.name))\n        arg_0.graph.add(arg_4)\n\n        if arg_1.has_optional_field('comment'):\n            arg_5 = (arg_2, RDFS.comment, Literal(arg_1.comment))\n            arg_0.graph.add(arg_5)\n\n        if arg_1.has_optional_field('type'):\n            arg_6 = arg_0.spdx_namespace[arg_0.FILE_TYPES[arg_1.type]]\n            arg_7 = (arg_2, arg_0.spdx_namespace.fileType, arg_6)\n            arg_0.graph.add(arg_7)\n\n        arg_0.graph.add((arg_2, arg_0.spdx_namespace.checksum, arg_0.create_checksum_node(arg_1.chk_sum)))\n\n        arg_8 = arg_0.license_or_special(arg_1.conc_lics)\n        arg_9 = (arg_2, arg_0.spdx_namespace.licenseConcluded, arg_8)\n        arg_0.graph.add(arg_9)\n\n        arg_10 = map(arg_0.license_or_special, arg_1.licenses_in_file)\n        for arg_11 in arg_10:\n            arg_12 = (arg_2, arg_0.spdx_namespace.licenseInfoInFile, arg_11)\n            arg_0.graph.add(arg_12)\n\n        if arg_1.has_optional_field('license_comment'):\n            arg_5 = (arg_2, arg_0.spdx_namespace.licenseComments, Literal(arg_1.license_comment))\n            arg_0.graph.add(arg_5)\n\n        arg_13 = arg_0.to_special_value(arg_1.copyright)\n        arg_14 = (arg_2, arg_0.spdx_namespace.copyrightText, arg_13)\n        arg_0.graph.add(arg_14)\n\n        if arg_1.has_optional_field('notice'):\n            arg_15 = (arg_2, arg_0.spdx_namespace.noticeText, arg_1.notice)\n            arg_0.graph.add(arg_15)\n\n        arg_16 = map(lambda c: Literal(c), arg_1.contributors)\n        arg_17 = [(arg_2, arg_0.spdx_namespace.fileContributor, node) for node in arg_16]\n        for arg_12 in arg_17:\n            arg_0.graph.add(arg_12)\n\n        return arg_2", "path": "spdx/writers/rdf.py", "identifier": "FileWriter.create_file_node", "docstring": "Create a node for spdx.file.", "docstring_tokens": ["Create", "a", "node", "for", "spdx", ".", "file", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254070}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdfbuilders.py#L275-L285", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Set's the package's description.\n        Raises CardinalityError if description already set.\n        Raises OrderError if no package previously defined.", "language": "python", "parameters": "(self, doc, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "assert_package_exists", "(", ")", "if", "not", "arg_0", ".", "package_desc_set", ":", "arg_0", ".", "package_desc_set", "=", "True", "arg_1", ".", "package", ".", "description", "=", "arg_2", "else", ":", "raise", "CardinalityError", "(", "'Package::Description'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Set's the package's description.\n        Raises CardinalityError if description already set.\n        Raises OrderError if no package previously defined.\n        \"\"\"\n        arg_0.assert_package_exists()\n        if not arg_0.package_desc_set:\n            arg_0.package_desc_set = True\n            arg_1.package.description = arg_2\n        else:\n            raise CardinalityError('Package::Description')", "path": "spdx/parsers/rdfbuilders.py", "identifier": "PackageBuilder.set_pkg_desc", "docstring": "Set's the package's description.\n        Raises CardinalityError if description already set.\n        Raises OrderError if no package previously defined.", "docstring_tokens": ["Set", "s", "the", "package", "s", "description", ".", "Raises", "CardinalityError", "if", "description", "already", "set", ".", "Raises", "OrderError", "if", "no", "package", "previously", "defined", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254071}
{"url": "https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L497-L507", "sha": "4fe4d928cd6fe3e7564f7362e3996898bda5a285", "docstring_summary": "Returns the number of keys in the current database", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", ",", "arg_3", "in", "iteritems", "(", "arg_0", ".", "redises", ")", ":", "if", "arg_2", ".", "find", "(", "'_slave'", ")", "==", "-", "1", ":", "continue", "arg_1", "+=", "arg_3", ".", "dbsize", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"Returns the number of keys in the current database\"\n\n        arg_1 = 0\n        for arg_2, arg_3 in iteritems(arg_0.redises):\n            if arg_2.find('_slave') == -1:\n                continue\n\n            arg_1 += arg_3.dbsize()\n\n        return arg_1", "path": "rediscluster/cluster_client.py", "identifier": "StrictRedisCluster._rc_dbsize", "docstring": "Returns the number of keys in the current database", "docstring_tokens": ["Returns", "the", "number", "of", "keys", "in", "the", "current", "database"], "nwo": "salimane/rediscluster-py", "score": 0.19802268511144447, "idx": 254072}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/cov/_free.py#L203-L228", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Derivative of the covariance matrix over the parameters of L.", "language": "python", "parameters": "(self)", "return_statement": "return {\"Lu\": self._grad_Lu}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "L", "arg_0", ".", "_grad_Lu", "[", ":", "]", "=", "0", "for", "arg_3", "in", "range", "(", "len", "(", "arg_0", ".", "_tril1", "[", "0", "]", ")", ")", ":", "arg_4", "=", "arg_0", ".", "_tril1", "[", "0", "]", "[", "arg_3", "]", "arg_5", "=", "arg_0", ".", "_tril1", "[", "1", "]", "[", "arg_3", "]", "arg_0", ".", "_grad_Lu", "[", "arg_4", ",", ":", ",", "arg_3", "]", "=", "arg_1", "[", ":", ",", "arg_5", "]", "arg_0", ".", "_grad_Lu", "[", ":", ",", "arg_4", ",", "arg_3", "]", "+=", "arg_1", "[", ":", ",", "arg_5", "]", "arg_6", "=", "len", "(", "arg_0", ".", "_tril1", "[", "0", "]", ")", "for", "arg_3", "in", "range", "(", "len", "(", "arg_0", ".", "_diag", "[", "0", "]", ")", ")", ":", "arg_4", "=", "arg_0", ".", "_diag", "[", "0", "]", "[", "arg_3", "]", "arg_5", "=", "arg_0", ".", "_diag", "[", "1", "]", "[", "arg_3", "]", "arg_0", ".", "_grad_Lu", "[", "arg_4", ",", ":", ",", "arg_6", "+", "arg_3", "]", "=", "arg_1", "[", "arg_4", ",", "arg_5", "]", "*", "arg_1", "[", ":", ",", "arg_5", "]", "arg_0", ".", "_grad_Lu", "[", ":", ",", "arg_4", ",", "arg_6", "+", "arg_3", "]", "+=", "arg_1", "[", "arg_4", ",", "arg_5", "]", "*", "arg_1", "[", ":", ",", "arg_5", "]", "return", "{", "\"Lu\"", ":", "arg_0", ".", "_grad_Lu", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Derivative of the covariance matrix over the parameters of L.\n\n        Returns\n        -------\n        Lu : ndarray\n            Derivative of K over the lower triangular part of L.\n        \"\"\"\n        arg_1 = arg_0.L\n        arg_0._grad_Lu[:] = 0\n\n        for arg_3 in range(len(arg_0._tril1[0])):\n            arg_4 = arg_0._tril1[0][arg_3]\n            arg_5 = arg_0._tril1[1][arg_3]\n            arg_0._grad_Lu[arg_4, :, arg_3] = arg_1[:, arg_5]\n            arg_0._grad_Lu[:, arg_4, arg_3] += arg_1[:, arg_5]\n\n        arg_6 = len(arg_0._tril1[0])\n        for arg_3 in range(len(arg_0._diag[0])):\n            arg_4 = arg_0._diag[0][arg_3]\n            arg_5 = arg_0._diag[1][arg_3]\n            arg_0._grad_Lu[arg_4, :, arg_6 + arg_3] = arg_1[arg_4, arg_5] * arg_1[:, arg_5]\n            arg_0._grad_Lu[:, arg_4, arg_6 + arg_3] += arg_1[arg_4, arg_5] * arg_1[:, arg_5]\n\n        return {\"Lu\": arg_0._grad_Lu}", "path": "glimix_core/cov/_free.py", "identifier": "FreeFormCov.gradient", "docstring": "Derivative of the covariance matrix over the parameters of L.\n\n        Returns\n        -------\n        Lu : ndarray\n            Derivative of K over the lower triangular part of L.", "docstring_tokens": ["Derivative", "of", "the", "covariance", "matrix", "over", "the", "parameters", "of", "L", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 254073}
{"url": "https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/continuous_mdr.py#L57-L93", "sha": "768565deb10467d04a960d27e000ab38b7aa8a62", "docstring_summary": "Constructs the Continuous MDR feature map from the provided training data.", "language": "python", "parameters": "(self, features, targets)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "feature_map", "=", "defaultdict", "(", "lambda", ":", "arg_0", ".", "default_label", ")", "arg_0", ".", "overall_mean_trait_value", "=", "np", ".", "mean", "(", "arg_2", ")", "arg_0", ".", "mdr_matrix_values", "=", "defaultdict", "(", "list", ")", "for", "arg_6", "in", "range", "(", "arg_1", ".", "shape", "[", "0", "]", ")", ":", "arg_7", "=", "tuple", "(", "arg_1", "[", "arg_6", "]", ")", "arg_0", ".", "mdr_matrix_values", "[", "arg_7", "]", ".", "append", "(", "arg_2", "[", "arg_6", "]", ")", "for", "arg_7", "in", "arg_0", ".", "mdr_matrix_values", ":", "arg_8", "=", "np", ".", "mean", "(", "arg_0", ".", "mdr_matrix_values", "[", "arg_7", "]", ")", "if", "arg_8", ">", "arg_0", ".", "overall_mean_trait_value", ":", "arg_0", ".", "feature_map", "[", "arg_7", "]", "=", "1", "elif", "arg_8", "==", "arg_0", ".", "overall_mean_trait_value", ":", "arg_0", ".", "feature_map", "[", "arg_7", "]", "=", "arg_0", ".", "tie_break", "else", ":", "arg_0", ".", "feature_map", "[", "arg_7", "]", "=", "0", "arg_0", ".", "feature_map", "=", "dict", "(", "arg_0", ".", "feature_map", ")", "arg_0", ".", "mdr_matrix_values", "=", "dict", "(", "arg_0", ".", "mdr_matrix_values", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Constructs the Continuous MDR feature map from the provided training data.\n\n        Parameters\n        ----------\n        features: array-like {n_samples, n_features}\n            Feature matrix\n        targets: array-like {n_samples}\n            List of target values for prediction\n\n        Returns\n        -------\n        self: A copy of the Functed model\n\n        \"\"\"\n        arg_0.feature_map = defaultdict(lambda: arg_0.default_label)\n        arg_0.overall_mean_trait_value = np.mean(arg_2)\n        arg_0.mdr_matrix_values = defaultdict(list)\n\n        for arg_6 in range(arg_1.shape[0]):\n            arg_7 = tuple(arg_1[arg_6])\n            arg_0.mdr_matrix_values[arg_7].append(arg_2[arg_6])\n\n        for arg_7 in arg_0.mdr_matrix_values:\n            arg_8 = np.mean(arg_0.mdr_matrix_values[arg_7])\n            if arg_8 > arg_0.overall_mean_trait_value: \n                arg_0.feature_map[arg_7] = 1\n            elif arg_8 == arg_0.overall_mean_trait_value:\n                arg_0.feature_map[arg_7] = arg_0.tie_break\n            else:\n                arg_0.feature_map[arg_7] = 0\n\n        # Convert defaultdict to dict so CMDR objects can be easily pickled\n        arg_0.feature_map = dict(arg_0.feature_map)\n        arg_0.mdr_matrix_values = dict(arg_0.mdr_matrix_values)\n\n        return arg_0", "path": "mdr/continuous_mdr.py", "identifier": "ContinuousMDR.fit", "docstring": "Constructs the Continuous MDR feature map from the provided training data.\n\n        Parameters\n        ----------\n        features: array-like {n_samples, n_features}\n            Feature matrix\n        targets: array-like {n_samples}\n            List of target values for prediction\n\n        Returns\n        -------\n        self: A copy of the fitted model", "docstring_tokens": ["Constructs", "the", "Continuous", "MDR", "feature", "map", "from", "the", "provided", "training", "data", "."], "nwo": "EpistasisLab/scikit-mdr", "score": 0.36572091509454285, "idx": 254074}
{"url": "https://github.com/tallero/trovotutto/blob/7afcfacf2bb3b642654153630c1ab7447ab10fae/trovotutto/__init__.py#L201-L229", "sha": "7afcfacf2bb3b642654153630c1ab7447ab10fae", "docstring_summary": "Searches files satisfying query", "language": "python", "parameters": "(self, query, verbose=0)", "return_statement": "return [self.elements[f[0]] for f in sorted_results]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "if", "arg_2", ">", "0", ":", "print", "(", "\"Funcing \"", "+", "arg_1", ")", "arg_1", "=", "arg_1", ".", "lower", "(", ")", "arg_3", "=", "ng", "(", "arg_1", ",", "arg_0", ".", "slb", ")", "arg_4", "=", "set", "(", ")", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", "in", "arg_0", ".", "ngrams", ".", "keys", "(", ")", ":", "for", "arg_6", "in", "arg_0", ".", "ngrams", "[", "arg_5", "]", ":", "arg_4", ".", "add", "(", "arg_6", ")", "arg_0", ".", "qocument", "=", "arg_4", "arg_7", "=", "{", "}", "for", "arg_6", "in", "arg_4", ":", "for", "arg_8", "in", "arg_0", ".", "D", "[", "arg_6", "]", ".", "keys", "(", ")", ":", "if", "not", "arg_8", "in", "arg_7", ".", "keys", "(", ")", ":", "arg_7", "[", "arg_8", "]", "=", "0", "arg_7", "[", "arg_8", "]", "=", "arg_7", "[", "arg_8", "]", "+", "arg_0", ".", "D", "[", "arg_6", "]", "[", "arg_8", "]", "arg_9", "=", "sorted", "(", "arg_7", ".", "items", "(", ")", ",", "key", "=", "operator", ".", "itemgetter", "(", "1", ")", ",", "reverse", "=", "True", ")", "return", "[", "arg_0", ".", "elements", "[", "arg_10", "[", "0", "]", "]", "for", "arg_10", "in", "arg_9", "]"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        \"\"\"Searches files satisfying query\n\n        It first decompose the query in ngrams, then score each document containing\n        at least one ngram with the number. The ten document having the most ngrams\n        in common with the query are selected.\n        \n        Args:\n             query (str): what to Func;\n             results_number (int): number of results to return (default: 10)\n        \"\"\"\n        if arg_2 > 0:\n            print(\"Funcing \" + arg_1)\n        arg_1 = arg_1.lower()\n        arg_3 = ng(arg_1, arg_0.slb)\n        arg_4 = set()\n        for arg_5 in arg_3:\n            if arg_5 in arg_0.ngrams.keys():\n                for arg_6 in arg_0.ngrams[arg_5]:\n                    arg_4.add(arg_6)\n        arg_0.qocument = arg_4\n        arg_7 = {}\n        for arg_6 in arg_4:\n           for arg_8 in arg_0.D[arg_6].keys():\n                if not arg_8 in arg_7.keys():\n                    arg_7[arg_8] = 0\n                arg_7[arg_8] = arg_7[arg_8] + arg_0.D[arg_6][arg_8]\n        arg_9 = sorted(arg_7.items(), key=operator.itemgetter(1), reverse=True)\n        return [arg_0.elements[arg_10[0]] for arg_10 in arg_9]", "path": "trovotutto/__init__.py", "identifier": "Index.search", "docstring": "Searches files satisfying query\n\n        It first decompose the query in ngrams, then score each document containing\n        at least one ngram with the number. The ten document having the most ngrams\n        in common with the query are selected.\n        \n        Args:\n             query (str): what to search;\n             results_number (int): number of results to return (default: 10)", "docstring_tokens": ["Searches", "files", "satisfying", "query"], "nwo": "tallero/trovotutto", "score": 0.08529914490135834, "idx": 254075}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/IRQueryableList.py#L110-L131", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "reload - Reload all objects in this list. \n\t\t\t\tUpdates in-place. To just fetch all these objects again, use \"refetch\"", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "[", "]", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "None", "try", ":", "arg_3", "=", "arg_2", ".", "Func", "(", ")", "except", "Exception", "as", "e", ":", "arg_3", "=", "e", "arg_1", ".", "append", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n\t\t'''\n\t\t\tFunc - Reload all objects in this list. \n\t\t\t\tUpdates in-place. To just fetch all these objects again, use \"refetch\"\n\n\t\t\t@return - List (same order as current objects) of either exception (KeyError) if operation failed,\n\t\t\t  or a dict of fields changed -> (old, new)\n\t\t'''\n\t\tif len(arg_0) == 0:\n\t\t\treturn []\n\n\t\targ_1 = []\n\t\tfor arg_2 in arg_0:\n\t\t\targ_3 = None\n\t\t\ttry:\n\t\t\t\targ_3 = arg_2.Func()\n\t\t\texcept Exception as e:\n\t\t\t\targ_3 = e\n\n\t\t\targ_1.append(arg_3)\n\n\t\treturn arg_1", "path": "IndexedRedis/IRQueryableList.py", "identifier": "IRQueryableList.reload", "docstring": "reload - Reload all objects in this list. \n\t\t\t\tUpdates in-place. To just fetch all these objects again, use \"refetch\"\n\n\t\t\t@return - List (same order as current objects) of either exception (KeyError) if operation failed,\n\t\t\t  or a dict of fields changed -> (old, new)", "docstring_tokens": ["reload", "-", "Reload", "all", "objects", "in", "this", "list", ".", "Updates", "in", "-", "place", ".", "To", "just", "fetch", "all", "these", "objects", "again", "use", "refetch"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 254076}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py#L123-L144", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get all data contained in hashed category 'hashroot' as dict", "language": "python", "parameters": "(self, hashroot)", "return_statement": "return all", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "keys", "(", "arg_1", "+", "\"/*\"", ")", "arg_2", ".", "sort", "(", ")", "arg_3", "=", "len", "(", "arg_2", ")", "and", "arg_2", "[", "-", "1", "]", "or", "''", "if", "arg_3", ".", "endswith", "(", "'xx'", ")", ":", "arg_2", "=", "[", "arg_3", "]", "+", "arg_2", "[", ":", "-", "1", "]", "arg_4", "=", "{", "}", "for", "arg_5", "in", "arg_2", ":", "try", ":", "arg_4", ".", "update", "(", "arg_0", "[", "arg_5", "]", ")", "except", "KeyError", ":", "print", "\"Corrupt\"", ",", "arg_5", ",", "\"deleted - hset is not threadsafe!\"", "del", "arg_0", "[", "arg_5", "]", "arg_0", ".", "uncache", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Get all data contained in hashed category 'hashroot' as dict \"\"\"\n        arg_2 = arg_0.keys(arg_1 + \"/*\")\n        arg_2.sort()\n        arg_3 = len(arg_2) and arg_2[-1] or ''\n        if arg_3.endswith('xx'):\n            # print \"using xx\"\n            arg_2 = [arg_3] + arg_2[:-1]\n\n        arg_4 = {}\n\n        for arg_5 in arg_2:\n            # print \"using\",f\n            try:\n                arg_4.update(arg_0[arg_5])\n            except KeyError:\n                print \"Corrupt\",arg_5,\"deleted - hset is not threadsafe!\"\n                del arg_0[arg_5]\n\n            arg_0.uncache(arg_5)\n\n        return arg_4", "path": "environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py", "identifier": "PickleShareDB.hdict", "docstring": "Get all data contained in hashed category 'hashroot' as dict", "docstring_tokens": ["Get", "all", "data", "contained", "in", "hashed", "category", "hashroot", "as", "dict"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254077}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L38-L62", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Create a project", "language": "python", "parameters": "(session, title, description,\n                   currency, budget, jobs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "{", "'title'", ":", "arg_1", ",", "'description'", ":", "arg_2", ",", "'currency'", ":", "arg_3", ",", "'budget'", ":", "arg_4", ",", "'jobs'", ":", "arg_5", "}", "arg_7", "=", "make_post_request", "(", "arg_0", ",", "'projects'", ",", "arg_8", "=", "arg_6", ")", "arg_8", "=", "arg_7", ".", "json", "(", ")", "if", "arg_7", ".", "status_code", "==", "200", ":", "arg_6", "=", "arg_8", "[", "'result'", "]", "arg_9", "=", "Project", "(", "arg_6", ")", "arg_9", ".", "url", "=", "urljoin", "(", "arg_0", ".", "url", ",", "'projects/%s'", "%", "arg_9", ".", "seo_url", ")", "return", "arg_9", "else", ":", "raise", "ProjectNotCreatedException", "(", "message", "=", "arg_8", "[", "'message'", "]", ",", "error_code", "=", "arg_8", "[", "'error_code'", "]", ",", "request_id", "=", "arg_8", "[", "'request_id'", "]", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                   arg_3, arg_4, arg_5):\n    \"\"\"\n    Create a project\n    \"\"\"\n    arg_6 = {'title': arg_1,\n                    'description': arg_2,\n                    'currency': arg_3,\n                    'budget': arg_4,\n                    'jobs': arg_5\n                    }\n\n    # POST /api/projects/0.1/projects/\n    arg_7 = make_post_request(arg_0, 'projects', arg_8=arg_6)\n    arg_8 = arg_7.json()\n    if arg_7.status_code == 200:\n        arg_6 = arg_8['result']\n        arg_9 = Project(arg_6)\n        arg_9.url = urljoin(arg_0.url, 'projects/%s' % arg_9.seo_url)\n        return arg_9\n    else:\n        raise ProjectNotCreatedException(message=arg_8['message'],\n                                         error_code=arg_8['error_code'],\n                                         request_id=arg_8['request_id'],\n                                         )", "path": "freelancersdk/resources/projects/projects.py", "identifier": "create_project", "docstring": "Create a project", "docstring_tokens": ["Create", "a", "project"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 254078}
{"url": "https://github.com/koenedaele/skosprovider/blob/7304a37953978ca8227febc2d3cc2b2be178f215/skosprovider/registry.py#L92-L123", "sha": "7304a37953978ca8227febc2d3cc2b2be178f215", "docstring_summary": "Get all providers registered.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return providers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "'ids'", "in", "arg_1", ":", "arg_2", "=", "[", "arg_0", ".", "concept_scheme_uri_map", ".", "get", "(", "id", ",", "id", ")", "for", "id", "in", "arg_1", "[", "'ids'", "]", "]", "arg_3", "=", "[", "arg_0", ".", "providers", "[", "k", "]", "for", "k", "in", "arg_0", ".", "providers", ".", "keys", "(", ")", "if", "k", "in", "arg_2", "]", "else", ":", "arg_3", "=", "list", "(", "arg_0", ".", "providers", ".", "values", "(", ")", ")", "if", "'subject'", "in", "arg_1", ":", "arg_3", "=", "[", "p", "for", "p", "in", "arg_3", "if", "arg_1", "[", "'subject'", "]", "in", "p", ".", "metadata", "[", "'subject'", "]", "]", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        '''Get all providers registered.\n\n        If keyword `ids` is present, get only the providers with these ids.\n\n        If keys `subject` is present, get only the providers that have this subject.\n\n        .. code-block:: python\n\n           # Get all providers with subject 'biology'\n           registry.Func(subject='biology')\n\n           # Get all providers with id 1 or 2\n           registry.Func(ids=[1,2])\n\n           # Get all providers with id 1 or 2 and subject 'biology'\n           registry.Func(ids=[1,2], subject='biology']\n\n        :param list ids: Only return providers with one of the Ids or :term:`URIs <uri>`.\n        :param str subject: Only return providers with this subject.\n        :returns: A list of :class:`providers <skosprovider.providers.VocabularyProvider>`\n        '''\n        if 'ids' in arg_1:\n            arg_2 = [arg_0.concept_scheme_uri_map.get(id, id) for id in arg_1['ids']]\n            arg_3 = [\n                arg_0.providers[k] for k in arg_0.providers.keys() if k in arg_2\n            ]\n        else:\n            arg_3 = list(arg_0.providers.values())\n        if 'subject' in arg_1:\n            arg_3 = [p for p in arg_3 if arg_1['subject'] in p.metadata['subject']]\n        return arg_3", "path": "skosprovider/registry.py", "identifier": "Registry.get_providers", "docstring": "Get all providers registered.\n\n        If keyword `ids` is present, get only the providers with these ids.\n\n        If keys `subject` is present, get only the providers that have this subject.\n\n        .. code-block:: python\n\n           # Get all providers with subject 'biology'\n           registry.get_providers(subject='biology')\n\n           # Get all providers with id 1 or 2\n           registry.get_providers(ids=[1,2])\n\n           # Get all providers with id 1 or 2 and subject 'biology'\n           registry.get_providers(ids=[1,2], subject='biology']\n\n        :param list ids: Only return providers with one of the Ids or :term:`URIs <uri>`.\n        :param str subject: Only return providers with this subject.\n        :returns: A list of :class:`providers <skosprovider.providers.VocabularyProvider>`", "docstring_tokens": ["Get", "all", "providers", "registered", "."], "nwo": "koenedaele/skosprovider", "score": 0.3726785709016597, "idx": 254079}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/pipeline.py#L115-L123", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Fit all the transforms one after the other and transform the\n        data, then use fit_transform on transformed data using the final\n        estimator.", "language": "python", "parameters": "(self, Z, **fit_params)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", ",", "arg_2", "=", "arg_0", ".", "_pre_transform", "(", "arg_1", ",", "**", "arg_2", ")", "if", "hasattr", "(", "arg_0", ".", "steps", "[", "-", "1", "]", "[", "-", "1", "]", ",", "'Func'", ")", ":", "return", "arg_0", ".", "steps", "[", "-", "1", "]", "[", "-", "1", "]", ".", "Func", "(", "arg_3", ",", "**", "arg_2", ")", "else", ":", "return", "arg_0", ".", "steps", "[", "-", "1", "]", "[", "-", "1", "]", ".", "fit", "(", "arg_3", ",", "**", "arg_2", ")", ".", "transform", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Fit all the transforms one after the other and transform the\n        data, then use Func on transformed data using the final\n        estimator.\"\"\"\n        arg_3, arg_2 = arg_0._pre_transform(arg_1, **arg_2)\n        if hasattr(arg_0.steps[-1][-1], 'Func'):\n            return arg_0.steps[-1][-1].Func(arg_3, **arg_2)\n        else:\n            return arg_0.steps[-1][-1].fit(arg_3, **arg_2).transform(arg_3)", "path": "splearn/pipeline.py", "identifier": "SparkPipeline.fit_transform", "docstring": "Fit all the transforms one after the other and transform the\n        data, then use fit_transform on transformed data using the final\n        estimator.", "docstring_tokens": ["Fit", "all", "the", "transforms", "one", "after", "the", "other", "and", "transform", "the", "data", "then", "use", "fit_transform", "on", "transformed", "data", "using", "the", "final", "estimator", "."], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 254080}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1383-L1410", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Default exception handling that kicks in when an exception\n        occurs that is not caught.  In debug mode the exception will\n        be re-raised immediately, otherwise it is logged and the handler\n        for a 500 internal server error is used.  If no such handler\n        exists, a default 500 internal server error message is displayed.", "language": "python", "parameters": "(self, e)", "return_statement": "return handler(e)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "sys", ".", "exc_info", "(", ")", "got_request_exception", ".", "send", "(", "arg_0", ",", "exception", "=", "arg_1", ")", "arg_5", "=", "arg_0", ".", "error_handler_spec", "[", "None", "]", ".", "get", "(", "500", ")", "if", "arg_0", ".", "propagate_exceptions", ":", "if", "arg_3", "is", "arg_1", ":", "reraise", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "else", ":", "raise", "arg_1", "arg_0", ".", "log_exception", "(", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "if", "arg_5", "is", "None", ":", "return", "InternalServerError", "(", ")", "return", "arg_5", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Default exception handling that kicks in when an exception\n        occurs that is not caught.  In debug mode the exception will\n        be re-raised immediately, otherwise it is logged and the handler\n        for a 500 internal server error is used.  If no such handler\n        exists, a default 500 internal server error message is displayed.\n\n        .. versionadded:: 0.3\n        \"\"\"\n        arg_2, arg_3, arg_4 = sys.exc_info()\n\n        got_request_exception.send(arg_0, exception=arg_1)\n        arg_5 = arg_0.error_handler_spec[None].get(500)\n\n        if arg_0.propagate_exceptions:\n            # if we want to repropagate the exception, we can attempt to\n            # raise it with the whole traceback in case we can do that\n            # (the function was actually called from the except part)\n            # otherwise, we just raise the error again\n            if arg_3 is arg_1:\n                reraise(arg_2, arg_3, arg_4)\n            else:\n                raise arg_1\n\n        arg_0.log_exception((arg_2, arg_3, arg_4))\n        if arg_5 is None:\n            return InternalServerError()\n        return arg_5(arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/app.py", "identifier": "Flask.handle_exception", "docstring": "Default exception handling that kicks in when an exception\n        occurs that is not caught.  In debug mode the exception will\n        be re-raised immediately, otherwise it is logged and the handler\n        for a 500 internal server error is used.  If no such handler\n        exists, a default 500 internal server error message is displayed.\n\n        .. versionadded:: 0.3", "docstring_tokens": ["Default", "exception", "handling", "that", "kicks", "in", "when", "an", "exception", "occurs", "that", "is", "not", "caught", ".", "In", "debug", "mode", "the", "exception", "will", "be", "re", "-", "raised", "immediately", "otherwise", "it", "is", "logged", "and", "the", "handler", "for", "a", "500", "internal", "server", "error", "is", "used", ".", "If", "no", "such", "handler", "exists", "a", "default", "500", "internal", "server", "error", "message", "is", "displayed", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254081}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L951-L980", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Send a JSON POST request with the given request headers, additional\n        URL query parameters, and the given JSON in the request body.  The\n        extra query parameters are merged with any which already exist in the\n        URL.  The 'json' and 'data' parameters may not both be given.", "language": "python", "parameters": "(self, url, headers=None, params=None, **kwargs)", "return_statement": "return _to_json(resp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "if", "len", "(", "arg_4", ")", ">", "1", ":", "raise", "InvalidArgumentsError", "(", "\"Too many extra args ({} > 1)\"", ".", "format", "(", "len", "(", "arg_4", ")", ")", ")", "if", "arg_4", ":", "arg_5", "=", "next", "(", "iter", "(", "arg_4", ")", ")", "if", "arg_5", "not", "in", "(", "\"json\"", ",", "\"data\"", ")", ":", "raise", "InvalidArgumentsError", "(", "\"Invalid kwarg: \"", "+", "arg_5", ")", "arg_6", "=", "arg_0", ".", "session", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "**", "arg_4", ")", "arg_6", ".", "raise_for_status", "(", ")", "return", "_to_json", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, **arg_4):\n        \"\"\"Send a JSON POST request with the given request headers, additional\n        URL query parameters, and the given JSON in the request body.  The\n        extra query parameters are merged with any which already exist in the\n        URL.  The 'json' and 'data' parameters may not both be given.\n\n        Args:\n            url (str): URL to retrieve\n            headers (dict): Any other headers to be added to the request.\n            params: dictionary or bytes to be sent in the query string for the\n                request. (optional)\n            json: json to send in the body of the Request.  This must be a\n                JSON-serializable object. (optional)\n            data: raw request body data.  May be a dictionary, list of tuples,\n                bytes, or file-like object to send in the body of the Request.\n                (optional)\n        \"\"\"\n\n        if len(arg_4) > 1:\n            raise InvalidArgumentsError(\"Too many extra args ({} > 1)\".format(\n                len(arg_4)))\n\n        if arg_4:\n            arg_5 = next(iter(arg_4))\n            if arg_5 not in (\"json\", \"data\"):\n                raise InvalidArgumentsError(\"Invalid kwarg: \" + arg_5)\n\n        arg_6 = arg_0.session.Func(arg_1, arg_2=arg_2, arg_3=arg_3, **arg_4)\n        arg_6.raise_for_status()\n        return _to_json(arg_6)", "path": "taxii2client/__init__.py", "identifier": "_HTTPConnection.post", "docstring": "Send a JSON POST request with the given request headers, additional\n        URL query parameters, and the given JSON in the request body.  The\n        extra query parameters are merged with any which already exist in the\n        URL.  The 'json' and 'data' parameters may not both be given.\n\n        Args:\n            url (str): URL to retrieve\n            headers (dict): Any other headers to be added to the request.\n            params: dictionary or bytes to be sent in the query string for the\n                request. (optional)\n            json: json to send in the body of the Request.  This must be a\n                JSON-serializable object. (optional)\n            data: raw request body data.  May be a dictionary, list of tuples,\n                bytes, or file-like object to send in the body of the Request.\n                (optional)", "docstring_tokens": ["Send", "a", "JSON", "POST", "request", "with", "the", "given", "request", "headers", "additional", "URL", "query", "parameters", "and", "the", "given", "JSON", "in", "the", "request", "body", ".", "The", "extra", "query", "parameters", "are", "merged", "with", "any", "which", "already", "exist", "in", "the", "URL", ".", "The", "json", "and", "data", "parameters", "may", "not", "both", "be", "given", "."], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 254082}
{"url": "https://github.com/bkg/greenwich/blob/57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141/greenwich/geometry.py#L239-L271", "sha": "57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141", "docstring_summary": "Returns an ogr.Geometry instance optionally created from a geojson str\n    or dict. The spatial reference may also be provided.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return geom", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "pop", "(", "'geojson'", ",", "None", ")", "or", "len", "(", "arg_0", ")", "and", "arg_0", "[", "0", "]", "try", ":", "arg_3", "=", "arg_1", ".", "pop", "(", "'srs'", ",", "None", ")", "or", "arg_2", ".", "srs", ".", "wkt", "except", "AttributeError", ":", "arg_3", "=", "SpatialReference", "(", "4326", ")", "if", "hasattr", "(", "arg_2", ",", "'keys'", ")", ":", "arg_4", "=", "ogr", ".", "CreateFuncFromJson", "(", "json", ".", "dumps", "(", "arg_2", ")", ")", "elif", "hasattr", "(", "arg_2", ",", "'startswith'", ")", ":", "arg_5", "=", "arg_2", "[", "0", "]", "if", "arg_2", "else", "' '", "arg_6", "=", "arg_5", "if", "isinstance", "(", "arg_5", ",", "int", ")", "else", "ord", "(", "arg_5", ")", "if", "arg_6", "in", "(", "0", ",", "1", ")", ":", "arg_4", "=", "ogr", ".", "CreateFuncFromWkb", "(", "arg_2", ")", "elif", "arg_2", ".", "startswith", "(", "'{'", ")", ":", "arg_4", "=", "ogr", ".", "CreateFuncFromJson", "(", "arg_2", ")", "elif", "arg_2", ".", "startswith", "(", "'<gml'", ")", ":", "arg_4", "=", "ogr", ".", "CreateFuncFromGML", "(", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "'Invalid geometry value: %s'", "%", "arg_2", ")", "elif", "hasattr", "(", "arg_2", ",", "'wkb'", ")", ":", "arg_4", "=", "ogr", ".", "CreateFuncFromWkb", "(", "bytes", "(", "arg_2", ".", "wkb", ")", ")", "else", ":", "arg_4", "=", "ogr", ".", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", "if", "arg_4", ":", "if", "not", "isinstance", "(", "arg_3", ",", "SpatialReference", ")", ":", "arg_3", "=", "SpatialReference", "(", "arg_3", ")", "arg_4", ".", "AssignSpatialReference", "(", "arg_3", ")", "return", "arg_4"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"Returns an ogr.Func instance optionally created from a geojson str\n    or dict. The spatial reference may also be provided.\n    \"\"\"\n    # Look for geojson as a positional or keyword arg.\n    arg_2 = arg_1.pop('geojson', None) or len(arg_0) and arg_0[0]\n    try:\n        arg_3 = arg_1.pop('srs', None) or arg_2.srs.wkt\n    except AttributeError:\n        arg_3 = SpatialReference(4326)\n    if hasattr(arg_2, 'keys'):\n        arg_4 = ogr.CreateFuncFromJson(json.dumps(arg_2))\n    elif hasattr(arg_2, 'startswith'):\n        # WKB as hexadecimal string.\n        arg_5 = arg_2[0] if arg_2 else ' '\n        arg_6 = arg_5 if isinstance(arg_5, int) else ord(arg_5)\n        if arg_6 in (0, 1):\n            arg_4 = ogr.CreateFuncFromWkb(arg_2)\n        elif arg_2.startswith('{'):\n            arg_4 = ogr.CreateFuncFromJson(arg_2)\n        elif arg_2.startswith('<gml'):\n            arg_4 = ogr.CreateFuncFromGML(arg_2)\n        else:\n            raise ValueError('Invalid geometry value: %s' % arg_2)\n    elif hasattr(arg_2, 'wkb'):\n        arg_4 = ogr.CreateFuncFromWkb(bytes(arg_2.wkb))\n    else:\n        arg_4 = ogr.Func(*arg_0, **arg_1)\n    if arg_4:\n        if not isinstance(arg_3, SpatialReference):\n            arg_3 = SpatialReference(arg_3)\n        arg_4.AssignSpatialReference(arg_3)\n    return arg_4", "path": "greenwich/geometry.py", "identifier": "Geometry", "docstring": "Returns an ogr.Geometry instance optionally created from a geojson str\n    or dict. The spatial reference may also be provided.", "docstring_tokens": ["Returns", "an", "ogr", ".", "Geometry", "instance", "optionally", "created", "from", "a", "geojson", "str", "or", "dict", ".", "The", "spatial", "reference", "may", "also", "be", "provided", "."], "nwo": "bkg/greenwich", "score": 0.15726537023232431, "idx": 254083}
{"url": "https://github.com/redapple/parslepy/blob/a8bc4c0592824459629018c8f4c6ae3dad6cc3cc/parslepy/selectors.py#L273-L299", "sha": "a8bc4c0592824459629018c8f4c6ae3dad6cc3cc", "docstring_summary": "Try and convert matching Elements to unicode strings.", "language": "python", "parameters": "(self, document, selector, debug_offset='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "''", ")", ":", "arg_4", "=", "arg_0", ".", "select", "(", "arg_1", ",", "arg_2", ")", "if", "arg_4", "is", "not", "None", ":", "if", "isinstance", "(", "arg_4", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "not", "len", "(", "arg_4", ")", ":", "return", "return", "[", "arg_0", ".", "_Func_single", "(", "arg_5", ")", "for", "arg_5", "in", "arg_4", "]", "else", ":", "return", "arg_0", ".", "_Func_single", "(", "arg_4", ")", "else", ":", "if", "arg_0", ".", "DEBUG", ":", "print", "(", "arg_3", ",", "\"selector did not match anything; return None\"", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=''):\n        \"\"\"\n        Try and convert matching Elements to unicode strings.\n\n        If this fails, the selector evaluation probably already\n        returned some string(s) of some sort, or boolean value,\n        or int/float, so return that instead.\n        \"\"\"\n        arg_4 = arg_0.select(arg_1, arg_2)\n        if arg_4 is not None:\n\n            if isinstance(arg_4, (list, tuple)):\n\n                # FIXME: return None or return empty list?\n                if not len(arg_4):\n                    return\n\n                return [arg_0._Func_single(arg_5) for arg_5 in arg_4]\n\n            else:\n                return arg_0._Func_single(arg_4)\n\n        # selector did not match anything\n        else:\n            if arg_0.DEBUG:\n                print(arg_3, \"selector did not match anything; return None\")\n            return None", "path": "parslepy/selectors.py", "identifier": "XPathSelectorHandler.extract", "docstring": "Try and convert matching Elements to unicode strings.\n\n        If this fails, the selector evaluation probably already\n        returned some string(s) of some sort, or boolean value,\n        or int/float, so return that instead.", "docstring_tokens": ["Try", "and", "convert", "matching", "Elements", "to", "unicode", "strings", "."], "nwo": "redapple/parslepy", "score": 0.18261785916548806, "idx": 254084}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1303-L1331", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Yield a layer for all gates of this circuit.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "topological_op_nodes", "(", ")", ":", "arg_2", "=", "DAGCircuit", "(", ")", "for", "arg_3", "in", "arg_0", ".", "qregs", ".", "values", "(", ")", ":", "arg_2", ".", "add_qreg", "(", "arg_3", ")", "for", "arg_4", "in", "arg_0", ".", "cregs", ".", "values", "(", ")", ":", "arg_2", ".", "add_creg", "(", "arg_4", ")", "arg_5", "=", "[", "]", "arg_6", "=", "copy", ".", "copy", "(", "arg_1", ".", "op", ")", "arg_7", "=", "copy", ".", "copy", "(", "arg_1", ".", "qargs", ")", "arg_8", "=", "copy", ".", "copy", "(", "arg_1", ".", "cargs", ")", "arg_9", "=", "copy", ".", "copy", "(", "arg_1", ".", "condition", ")", "arg_10", "=", "arg_0", ".", "_bits_in_condition", "(", "arg_9", ")", "arg_2", ".", "apply_operation_back", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", "if", "arg_1", ".", "name", "not", "in", "[", "\"barrier\"", ",", "\"snapshot\"", ",", "\"save\"", ",", "\"load\"", ",", "\"noise\"", "]", ":", "arg_5", ".", "append", "(", "list", "(", "arg_7", ")", ")", "arg_11", "=", "{", "\"graph\"", ":", "arg_2", ",", "\"partition\"", ":", "arg_5", "}", "yield", "arg_11"], "function": "def Func(arg_0):\n        \"\"\"Yield a layer for all gates of this circuit.\n\n        A serial layer is a circuit with one gate. The layers have the\n        same structure as in layers().\n        \"\"\"\n        for arg_1 in arg_0.topological_op_nodes():\n            arg_2 = DAGCircuit()\n            for arg_3 in arg_0.qregs.values():\n                arg_2.add_qreg(arg_3)\n            for arg_4 in arg_0.cregs.values():\n                arg_2.add_creg(arg_4)\n            # Save the support of the operation we add to the layer\n            arg_5 = []\n            # Operation data\n            arg_6 = copy.copy(arg_1.op)\n            arg_7 = copy.copy(arg_1.qargs)\n            arg_8 = copy.copy(arg_1.cargs)\n            arg_9 = copy.copy(arg_1.condition)\n            arg_10 = arg_0._bits_in_condition(arg_9)\n\n            # Add node to new_layer\n            arg_2.apply_operation_back(arg_6, arg_7, arg_8, arg_9)\n            # Add operation to partition\n            if arg_1.name not in [\"barrier\",\n                                      \"snapshot\", \"save\", \"load\", \"noise\"]:\n                arg_5.append(list(arg_7))\n            arg_11 = {\"graph\": arg_2, \"partition\": arg_5}\n            yield arg_11", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.serial_layers", "docstring": "Yield a layer for all gates of this circuit.\n\n        A serial layer is a circuit with one gate. The layers have the\n        same structure as in layers().", "docstring_tokens": ["Yield", "a", "layer", "for", "all", "gates", "of", "this", "circuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254085}
{"url": "https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/execute.py#L336-L346", "sha": "0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b", "docstring_summary": "Home assistant url", "language": "python", "parameters": "(self)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "super", "(", "ExecuteHomeAssistant", ",", "arg_0", ")", ".", "Func", "(", ")", "if", "not", "arg_0", ".", "data", ".", "get", "(", "'event'", ")", ":", "raise", "InvalidConfig", "(", "extra_body", "=", "'Event option is required for HomeAsistant on {} device.'", ".", "format", "(", "arg_0", ".", "name", ")", ")", "arg_1", "+=", "'/api/events/{}'", ".", "format", "(", "arg_0", ".", "data", "[", "'event'", "]", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Home assistant url\n\n        :return: url\n        :rtype: str\n        \"\"\"\n        arg_1 = super(ExecuteHomeAssistant, arg_0).Func()\n        if not arg_0.data.get('event'):\n            raise InvalidConfig(extra_body='Event option is required for HomeAsistant on {} device.'.format(arg_0.name))\n        arg_1 += '/api/events/{}'.format(arg_0.data['event'])\n        return arg_1", "path": "amazon_dash/execute.py", "identifier": "ExecuteHomeAssistant.get_url", "docstring": "Home assistant url\n\n        :return: url\n        :rtype: str", "docstring_tokens": ["Home", "assistant", "url"], "nwo": "Nekmo/amazon-dash", "score": 0.758195400618659, "idx": 254086}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/eventloops.py#L118-L123", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Start the kernel, coordinating with the GTK event loop", "language": "python", "parameters": "(kernel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", ".", "gui", ".", "gtkembed", "import", "GTKEmbed", "arg_1", "=", "GTKEmbed", "(", "arg_0", ")", "arg_1", ".", "start", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Start the kernel, coordinating with the GTK event loop\"\"\"\n    from .gui.gtkembed import GTKEmbed\n\n    arg_1 = GTKEmbed(arg_0)\n    arg_1.start()", "path": "environment/lib/python2.7/site-packages/IPython/zmq/eventloops.py", "identifier": "loop_gtk", "docstring": "Start the kernel, coordinating with the GTK event loop", "docstring_tokens": ["Start", "the", "kernel", "coordinating", "with", "the", "GTK", "event", "loop"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254087}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L1173-L1187", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Return a human readable format of a list.", "language": "python", "parameters": "(items)", "return_statement": "return keys_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "list", ")", "arg_1", "=", "'Available Keys:'", "for", "arg_2", "in", "arg_0", ":", "arg_1", "+=", "'\\n  - {0}'", ".", "format", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return a human readable format of a list.\n\n    Example:\n\n    Available Keys:\n      - my_first_key\n      - my_second_key\n    \"\"\"\n    assert isinstance(arg_0, list)\n\n    arg_1 = 'Available Keys:'\n    for arg_2 in arg_0:\n        arg_1 += '\\n  - {0}'.format(arg_2)\n    return arg_1", "path": "ghost.py", "identifier": "_prettify_list", "docstring": "Return a human readable format of a list.\n\n    Example:\n\n    Available Keys:\n      - my_first_key\n      - my_second_key", "docstring_tokens": ["Return", "a", "human", "readable", "format", "of", "a", "list", "."], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 254088}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/argmax.py#L4-L51", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Keep the row of the data corresponding to the maximal value in a column", "language": "python", "parameters": "(df, column: str, groups: Union[str, List[str]] = None)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", "[", "arg_2", ",", "arg_5", "[", "arg_2", "]", "]", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_0", "=", "arg_0", "[", "arg_0", "[", "arg_1", "]", "==", "arg_0", "[", "arg_1", "]", ".", "max", "(", ")", "]", ".", "reset_index", "(", "drop", "=", "True", ")", "else", ":", "arg_6", "=", "arg_0", ".", "groupby", "(", "arg_3", ")", "[", "arg_1", "]", ".", "transform", "(", "'max'", ")", "arg_0", "=", "(", "arg_0", ".", "loc", "[", "arg_0", "[", "arg_1", "]", "==", "arg_6", ",", ":", "]", ".", "drop_duplicates", "(", ")", ".", "reset_index", "(", "drop", "=", "True", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4[arg_2, arg_5[arg_2]] = None):\n    \"\"\"\n    Keep the row of the data corresponding to the maximal value in a column\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `column` (*str*): name of the column containing the value you want to keep the maximum\n\n    *optional :*\n    - `groups` (*str or list(str)*): name of the column(s) used for 'groupby' logic\n    (the function will return the Func by group)\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    | variable |   wave  |  year    | value |\n    |:--------:|:-------:|:--------:|:-----:|\n    |   toto   |  wave 1 |  2014    |  300  |\n    |   toto   |  wave 1 |  2015    |  250  |\n    |   toto   |  wave 1 |  2016    |  450  |\n\n    ```cson\n    Func:\n      column: 'year'\n    ```\n\n    **Output**\n\n    | variable |   wave  |  year    | value |\n    |:--------:|:-------:|:--------:|:-----:|\n    |   toto   |  wave 1 |  2016    |  450  |\n    \"\"\"\n    if arg_3 is None:\n        arg_0 = arg_0[arg_0[arg_1] == arg_0[arg_1].max()].reset_index(drop=True)\n    else:\n        arg_6 = arg_0.groupby(arg_3)[arg_1].transform('max')\n        arg_0 = (arg_0\n              .loc[arg_0[arg_1] == arg_6, :]\n              .drop_duplicates()\n              .reset_index(drop=True)\n              )\n    return arg_0", "path": "toucan_data_sdk/utils/postprocess/argmax.py", "identifier": "argmax", "docstring": "Keep the row of the data corresponding to the maximal value in a column\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `column` (*str*): name of the column containing the value you want to keep the maximum\n\n    *optional :*\n    - `groups` (*str or list(str)*): name of the column(s) used for 'groupby' logic\n    (the function will return the argmax by group)\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    | variable |   wave  |  year    | value |\n    |:--------:|:-------:|:--------:|:-----:|\n    |   toto   |  wave 1 |  2014    |  300  |\n    |   toto   |  wave 1 |  2015    |  250  |\n    |   toto   |  wave 1 |  2016    |  450  |\n\n    ```cson\n    argmax:\n      column: 'year'\n    ```\n\n    **Output**\n\n    | variable |   wave  |  year    | value |\n    |:--------:|:-------:|:--------:|:-----:|\n    |   toto   |  wave 1 |  2016    |  450  |", "docstring_tokens": ["Keep", "the", "row", "of", "the", "data", "corresponding", "to", "the", "maximal", "value", "in", "a", "column"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 254089}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L245-L265", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Wrapper that allow graceful exits of single runs", "language": "python", "parameters": "(kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", "[", "'graceful_exit'", "]", "if", "arg_1", ":", "sigint_handling", ".", "start", "(", ")", "if", "sigint_handling", ".", "hit", ":", "arg_2", "=", "(", "sigint_handling", ".", "SIGINT", ",", "None", ")", "else", ":", "arg_2", "=", "_single_run", "(", "arg_0", ")", "if", "sigint_handling", ".", "hit", ":", "arg_2", "=", "(", "sigint_handling", ".", "SIGINT", ",", "arg_2", ")", "return", "arg_2", "return", "_single_run", "(", "arg_0", ")", "except", ":", "arg_3", "=", "logging", ".", "getLogger", "(", "'pypet'", ")", "arg_3", ".", "exception", "(", "'ERROR occurred during a single run! '", ")", "raise"], "function": "def Func(arg_0):\n    \"\"\"Wrapper that allow graceful exits of single runs\"\"\"\n    try:\n        arg_1 = arg_0['graceful_exit']\n\n        if arg_1:\n            sigint_handling.start()\n            if sigint_handling.hit:\n                arg_2 = (sigint_handling.SIGINT, None)\n            else:\n                arg_2 = _single_run(arg_0)\n                if sigint_handling.hit:\n                    arg_2 = (sigint_handling.SIGINT, arg_2)\n            return arg_2\n        return _single_run(arg_0)\n\n    except:\n        # Log traceback of exception\n        arg_3 = logging.getLogger('pypet')\n        arg_3.exception('ERROR occurred during a single run! ')\n        raise", "path": "pypet/environment.py", "identifier": "_sigint_handling_single_run", "docstring": "Wrapper that allow graceful exits of single runs", "docstring_tokens": ["Wrapper", "that", "allow", "graceful", "exits", "of", "single", "runs"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254090}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/virtual_machine_scale_sets_operations.py#L94-L143", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Create or update a VM scale set.", "language": "python", "parameters": "(\n            self, resource_group_name, vm_scale_set_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "True", ",", "**", "arg_7", ")", ":", "arg_8", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "True", ",", "**", "arg_7", ")", "def", "get_long_running_output", "(", "arg_9", ")", ":", "arg_10", "=", "arg_0", ".", "_deserialize", "(", "'VirtualMachineScaleSet'", ",", "arg_9", ")", "if", "arg_5", ":", "arg_11", "=", "ClientRawResponse", "(", "arg_10", ",", "arg_9", ")", "return", "arg_11", "return", "arg_10", "arg_12", "=", "arg_7", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_6", "is", "True", ":", "arg_13", "=", "ARMPolling", "(", "arg_12", ",", "**", "arg_7", ")", "elif", "arg_6", "is", "False", ":", "arg_13", "=", "NoPolling", "(", ")", "else", ":", "arg_13", "=", "arg_6", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_8", ",", "get_long_running_output", ",", "arg_13", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=False, arg_6=True, **arg_7):\n        \"\"\"Create or update a VM scale set.\n\n        :param resource_group_name: The name of the resource group.\n        :type resource_group_name: str\n        :param vm_scale_set_name: The name of the VM scale set to create or\n         update.\n        :type vm_scale_set_name: str\n        :param parameters: The scale set object.\n        :type parameters:\n         ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns VirtualMachineScaleSet\n         or ClientRawResponse<VirtualMachineScaleSet> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet]]\n        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`\n        \"\"\"\n        arg_8 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=True,\n            **arg_7\n        )\n\n        def get_long_running_output(arg_9):\n            arg_10 = arg_0._deserialize('VirtualMachineScaleSet', arg_9)\n\n            if arg_5:\n                arg_11 = ClientRawResponse(arg_10, arg_9)\n                return arg_11\n\n            return arg_10\n\n        arg_12 = arg_7.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_6 is True: arg_13 = ARMPolling(arg_12, **arg_7)\n        elif arg_6 is False: arg_13 = NoPolling()\n        else: arg_13 = arg_6\n        return LROPoller(arg_0._client, arg_8, get_long_running_output, arg_13)", "path": "azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/virtual_machine_scale_sets_operations.py", "identifier": "VirtualMachineScaleSetsOperations.create_or_update", "docstring": "Create or update a VM scale set.\n\n        :param resource_group_name: The name of the resource group.\n        :type resource_group_name: str\n        :param vm_scale_set_name: The name of the VM scale set to create or\n         update.\n        :type vm_scale_set_name: str\n        :param parameters: The scale set object.\n        :type parameters:\n         ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns VirtualMachineScaleSet\n         or ClientRawResponse<VirtualMachineScaleSet> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet]]\n        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`", "docstring_tokens": ["Create", "or", "update", "a", "VM", "scale", "set", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254091}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1156-L1182", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Sign the certificate with this key and digest type.", "language": "python", "parameters": "(self, pkey, digest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "PKey", ")", ":", "raise", "TypeError", "(", "\"pkey must be a PKey instance\"", ")", "if", "arg_1", ".", "_only_public", ":", "raise", "ValueError", "(", "\"Key only has public part\"", ")", "if", "not", "arg_1", ".", "_initialized", ":", "raise", "ValueError", "(", "\"Key is uninitialized\"", ")", "arg_3", "=", "_lib", ".", "EVP_get_digestbyname", "(", "_byte_string", "(", "arg_2", ")", ")", "if", "arg_3", "==", "_ffi", ".", "NULL", ":", "raise", "ValueError", "(", "\"No such digest method\"", ")", "arg_4", "=", "_lib", ".", "X509_Func", "(", "arg_0", ".", "_x509", ",", "arg_1", ".", "_pkey", ",", "arg_3", ")", "_openssl_assert", "(", "arg_4", ">", "0", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Sign the certificate with this key and digest type.\n\n        :param pkey: The key to Func with.\n        :type pkey: :py:class:`PKey`\n\n        :param digest: The name of the message digest to use.\n        :type digest: :py:class:`bytes`\n\n        :return: :py:data:`None`\n        \"\"\"\n        if not isinstance(arg_1, PKey):\n            raise TypeError(\"pkey must be a PKey instance\")\n\n        if arg_1._only_public:\n            raise ValueError(\"Key only has public part\")\n\n        if not arg_1._initialized:\n            raise ValueError(\"Key is uninitialized\")\n\n        arg_3 = _lib.EVP_get_digestbyname(_byte_string(arg_2))\n        if arg_3 == _ffi.NULL:\n            raise ValueError(\"No such digest method\")\n\n        arg_4 = _lib.X509_Func(arg_0._x509, arg_1._pkey, arg_3)\n        _openssl_assert(arg_4 > 0)", "path": "src/OpenSSL/crypto.py", "identifier": "X509.sign", "docstring": "Sign the certificate with this key and digest type.\n\n        :param pkey: The key to sign with.\n        :type pkey: :py:class:`PKey`\n\n        :param digest: The name of the message digest to use.\n        :type digest: :py:class:`bytes`\n\n        :return: :py:data:`None`", "docstring_tokens": ["Sign", "the", "certificate", "with", "this", "key", "and", "digest", "type", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 254092}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/matchmaker.py#L10-L58", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Send a request to MatchMaker and return its response", "language": "python", "parameters": "(url, token, method, content_type=None, accept=None, data=None)", "return_statement": "return json_response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "Headers", "(", ")", "arg_6", "=", "{", "'X-Auth-Token'", ":", "arg_1", "}", "if", "arg_3", ":", "arg_6", "[", "'Content-Type'", "]", "=", "arg_3", "if", "arg_4", ":", "arg_6", "[", "'Accept'", "]", "=", "arg_4", "arg_7", "=", "arg_5", "or", "{", "'timestamp'", ":", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "timestamp", "(", ")", "}", "arg_8", "=", "None", "try", ":", "LOG", ".", "info", "(", "'Sending {} request to MME url {}. Data sent: {}'", ".", "format", "(", "arg_2", ",", "arg_0", ",", "arg_7", ")", ")", "arg_9", "=", "requests", ".", "request", "(", "arg_2", "=", "arg_2", ",", "arg_0", "=", "arg_0", ",", "arg_6", "=", "arg_6", ",", "arg_5", "=", "json", ".", "dumps", "(", "arg_7", ")", ")", "arg_8", "=", "arg_9", ".", "json", "(", ")", "LOG", ".", "info", "(", "'MME server response was:{}'", ".", "format", "(", "arg_8", ")", ")", "if", "isinstance", "(", "arg_8", ",", "str", ")", ":", "arg_8", "=", "{", "'message'", ":", "arg_8", ",", "}", "elif", "isinstance", "(", "arg_8", ",", "list", ")", ":", "return", "arg_8", "arg_8", "[", "'status_code'", "]", "=", "arg_9", ".", "status_code", "except", "Exception", "as", "err", ":", "LOG", ".", "info", "(", "'An error occurred while sending HTTP request to server ({})'", ".", "format", "(", "err", ")", ")", "arg_8", "=", "{", "'message'", ":", "str", "(", "err", ")", "}", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):\n    \"\"\"Send a request to MatchMaker and return its response\n\n    Args:\n        url(str): url to send request to\n        token(str): MME server authorization token\n        method(str): 'GET', 'POST' or 'DELETE'\n        content_type(str): MME request Content-Type\n        accept(str): accepted response\n        data(dict): eventual data to send in request\n\n    Returns:\n        json_response(dict): server response\n    \"\"\"\n    arg_6 = Headers()\n    arg_6 = { 'X-Auth-Token': arg_1}\n    if arg_3:\n        arg_6['Content-Type'] = arg_3\n    if arg_4:\n        arg_6['Accept'] = arg_4\n\n    #sending data anyway so response will not be cached\n    arg_7 = arg_5 or {'timestamp' : datetime.datetime.now().timestamp()}\n    arg_8 = None\n    try:\n        LOG.info('Sending {} request to MME url {}. Data sent: {}'.format(\n            arg_2, arg_0, arg_7))\n        arg_9 = requests.request(\n            arg_2 = arg_2,\n            arg_0 = arg_0,\n            arg_6 = arg_6,\n            arg_5 = json.dumps(arg_7)\n        )\n        arg_8 = arg_9.json()\n        LOG.info('MME server response was:{}'.format(arg_8))\n\n        if isinstance(arg_8, str):\n            arg_8 = {\n                'message' : arg_8,\n            }\n        elif isinstance(arg_8, list): #asking for connected nodes\n            return arg_8\n        arg_8['status_code'] = arg_9.status_code\n    except Exception as err:\n        LOG.info('An error occurred while sending HTTP request to server ({})'.format(err))\n        arg_8 = {\n            'message' : str(err)\n        }\n    return arg_8", "path": "scout/utils/matchmaker.py", "identifier": "matchmaker_request", "docstring": "Send a request to MatchMaker and return its response\n\n    Args:\n        url(str): url to send request to\n        token(str): MME server authorization token\n        method(str): 'GET', 'POST' or 'DELETE'\n        content_type(str): MME request Content-Type\n        accept(str): accepted response\n        data(dict): eventual data to send in request\n\n    Returns:\n        json_response(dict): server response", "docstring_tokens": ["Send", "a", "request", "to", "MatchMaker", "and", "return", "its", "response"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254093}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L856-L874", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Return the collections of handlers handling the exception in arguments.", "language": "python", "parameters": "(\n    node: astroid.node_classes.NodeNG, exception=Exception\n)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "node_classes", ".", "NodeNG", ",", "arg_4", "=", "arg_5", ")", "->", "List", "[", "arg_1", ".", "ExceptHandler", "]", ":", "arg_6", "=", "find_try_except_wrapper_node", "(", "arg_0", ")", "if", "isinstance", "(", "arg_6", ",", "arg_1", ".", "TryExcept", ")", ":", "return", "[", "arg_7", "for", "arg_7", "in", "arg_6", ".", "handlers", "if", "error_of_type", "(", "arg_7", ",", "arg_4", ")", "]", "return", "None"], "function": "def Func(\n    arg_0: arg_1.node_classes.NodeNG, arg_4=arg_5\n) -> List[arg_1.ExceptHandler]:\n    \"\"\"Return the collections of handlers handling the exception in arguments.\n\n    Args:\n        node (astroid.NodeNG): A node that is potentially wrapped in a try except.\n        exception (builtin.Exception or str): exception or name of the exception.\n\n    Returns:\n        list: the collection of handlers that are handling the exception or None.\n\n    \"\"\"\n    arg_6 = find_try_except_wrapper_node(arg_0)\n    if isinstance(arg_6, arg_1.TryExcept):\n        return [\n            arg_7 for arg_7 in arg_6.handlers if error_of_type(arg_7, arg_4)\n        ]\n    return None", "path": "pylint/checkers/utils.py", "identifier": "get_exception_handlers", "docstring": "Return the collections of handlers handling the exception in arguments.\n\n    Args:\n        node (astroid.NodeNG): A node that is potentially wrapped in a try except.\n        exception (builtin.Exception or str): exception or name of the exception.\n\n    Returns:\n        list: the collection of handlers that are handling the exception or None.", "docstring_tokens": ["Return", "the", "collections", "of", "handlers", "handling", "the", "exception", "in", "arguments", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254094}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/magnitudes.py#L320-L340", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Converts given J, H, Ks mags to an SDSS r magnitude value.", "language": "python", "parameters": "(jmag,hmag,kmag)", "return_statement": "return convert_constants(jmag,hmag,kmag,\n                             SDSSR_JHK,\n                             SDSSR_JH, SDSSR_JK, SDSSR_HK,\n                             SDSSR_J, SDSSR_H, SDSSR_K)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "convert_constants", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "SDSSR_JHK", ",", "SDSSR_JH", ",", "SDSSR_JK", ",", "SDSSR_HK", ",", "SDSSR_J", ",", "SDSSR_H", ",", "SDSSR_K", ")"], "function": "def Func(arg_0,arg_1,arg_2):\n    '''Converts given J, H, Ks mags to an SDSS r magnitude value.\n\n    Parameters\n    ----------\n\n    jmag,hmag,kmag : float\n        2MASS J, H, Ks mags of the object.\n\n    Returns\n    -------\n\n    float\n        The converted SDSS r band magnitude.\n\n    '''\n\n    return convert_constants(arg_0,arg_1,arg_2,\n                             SDSSR_JHK,\n                             SDSSR_JH, SDSSR_JK, SDSSR_HK,\n                             SDSSR_J, SDSSR_H, SDSSR_K)", "path": "astrobase/magnitudes.py", "identifier": "jhk_to_sdssr", "docstring": "Converts given J, H, Ks mags to an SDSS r magnitude value.\n\n    Parameters\n    ----------\n\n    jmag,hmag,kmag : float\n        2MASS J, H, Ks mags of the object.\n\n    Returns\n    -------\n\n    float\n        The converted SDSS r band magnitude.", "docstring_tokens": ["Converts", "given", "J", "H", "Ks", "mags", "to", "an", "SDSS", "r", "magnitude", "value", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 254095}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/util_functions.py#L410-L425", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Generates a frequency count of each rating on the scale\n    ratings is a list of scores\n    Returns a list of frequencies", "language": "python", "parameters": "(ratings, min_rating=None, max_rating=None)", "return_statement": "return hist_ratings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_0", "=", "[", "int", "(", "arg_5", ")", "for", "arg_5", "in", "arg_0", "]", "if", "arg_1", "is", "None", ":", "arg_1", "=", "min", "(", "arg_0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "max", "(", "arg_0", ")", "arg_3", "=", "int", "(", "arg_2", "-", "arg_1", "+", "1", ")", "arg_4", "=", "[", "0", "for", "x", "in", "range", "(", "arg_3", ")", "]", "for", "arg_5", "in", "arg_0", ":", "arg_4", "[", "arg_5", "-", "arg_1", "]", "+=", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"\n    Generates a frequency count of each rating on the scale\n    ratings is a list of scores\n    Returns a list of frequencies\n    \"\"\"\n    arg_0 = [int(arg_5) for arg_5 in arg_0]\n    if arg_1 is None:\n        arg_1 = min(arg_0)\n    if arg_2 is None:\n        arg_2 = max(arg_0)\n    arg_3 = int(arg_2 - arg_1 + 1)\n    arg_4 = [0 for x in range(arg_3)]\n    for arg_5 in arg_0:\n        arg_4[arg_5 - arg_1] += 1\n    return arg_4", "path": "ease/util_functions.py", "identifier": "histogram", "docstring": "Generates a frequency count of each rating on the scale\n    ratings is a list of scores\n    Returns a list of frequencies", "docstring_tokens": ["Generates", "a", "frequency", "count", "of", "each", "rating", "on", "the", "scale", "ratings", "is", "a", "list", "of", "scores", "Returns", "a", "list", "of", "frequencies"], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 254096}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ssh.py#L32-L51", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Verify SSH variables and construct exported variables", "language": "python", "parameters": "()", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "arg_1", ".", "Func_to_dict", "(", "PREFIX", ",", "REQUIRED", ")", "if", "\"KEY\"", "in", "arg_0", ":", "arg_0", "[", "\"KEY\"", "]", "=", "arg_1", ".", "util", ".", "expand_path", "(", "arg_0", "[", "\"KEY\"", "]", ")", "if", "arg_1", ".", "ENV", ".", "get", "(", "\"SSH_PORT\"", ")", "is", "None", ":", "arg_1", ".", "ENV", "[", "\"SSH_PORT\"", "]", "=", "\"22\"", "arg_1", ".", "warn", "(", "\"cij.ssh.Func: SSH_PORT was not set, assigned: %r\"", "%", "(", "arg_1", ".", "ENV", ".", "get", "(", "\"SSH_PORT\"", ")", ")", ")", "if", "arg_1", ".", "ENV", ".", "get", "(", "\"SSH_CMD_TIME\"", ")", "is", "None", ":", "arg_1", ".", "ENV", "[", "\"SSH_CMD_TIME\"", "]", "=", "\"1\"", "arg_1", ".", "warn", "(", "\"cij.ssh.Func: SSH_CMD_TIME was not set, assigned: %r\"", "%", "(", "arg_1", ".", "ENV", ".", "get", "(", "\"SSH_CMD_TIME\"", ")", ")", ")", "return", "0"], "function": "def Func():\n    \"\"\"Verify SSH variables and construct exported variables\"\"\"\n\n    arg_0 = arg_1.Func_to_dict(PREFIX, REQUIRED)\n    if \"KEY\" in arg_0:\n        arg_0[\"KEY\"] = arg_1.util.expand_path(arg_0[\"KEY\"])\n\n    if arg_1.ENV.get(\"SSH_PORT\") is None:\n        arg_1.ENV[\"SSH_PORT\"] = \"22\"\n        arg_1.warn(\"cij.ssh.Func: SSH_PORT was not set, assigned: %r\" % (\n            arg_1.ENV.get(\"SSH_PORT\")\n        ))\n\n    if arg_1.ENV.get(\"SSH_CMD_TIME\") is None:\n        arg_1.ENV[\"SSH_CMD_TIME\"] = \"1\"\n        arg_1.warn(\"cij.ssh.Func: SSH_CMD_TIME was not set, assigned: %r\" % (\n            arg_1.ENV.get(\"SSH_CMD_TIME\")\n        ))\n\n    return 0", "path": "modules/cij/ssh.py", "identifier": "env", "docstring": "Verify SSH variables and construct exported variables", "docstring_tokens": ["Verify", "SSH", "variables", "and", "construct", "exported", "variables"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 254097}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/transmitters/content_metadata.py#L218-L231", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Delete ContentMetadataItemTransmision models associated with the given content metadata items.", "language": "python", "parameters": "(self, content_metadata_item_ids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "apps", ".", "get_model", "(", "'integrated_channel'", ",", "'ContentMetadataItemTransmission'", ")", "arg_2", ".", "objects", ".", "filter", "(", "enterprise_customer", "=", "arg_0", ".", "enterprise_configuration", ".", "enterprise_customer", ",", "integrated_channel_code", "=", "arg_0", ".", "enterprise_configuration", ".", "channel_code", "(", ")", ",", "content_id__in", "=", "arg_1", ")", ".", "delete", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Delete ContentMetadataItemTransmision models associated with the given content metadata items.\n        \"\"\"\n        # pylint: disable=invalid-name\n        arg_2 = apps.get_model(\n            'integrated_channel',\n            'ContentMetadataItemTransmission'\n        )\n        arg_2.objects.filter(\n            enterprise_customer=arg_0.enterprise_configuration.enterprise_customer,\n            integrated_channel_code=arg_0.enterprise_configuration.channel_code(),\n            content_id__in=arg_1\n        ).delete()", "path": "integrated_channels/integrated_channel/transmitters/content_metadata.py", "identifier": "ContentMetadataTransmitter._delete_transmissions", "docstring": "Delete ContentMetadataItemTransmision models associated with the given content metadata items.", "docstring_tokens": ["Delete", "ContentMetadataItemTransmision", "models", "associated", "with", "the", "given", "content", "metadata", "items", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254098}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L305-L327", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Enable event loop integration with Tk.", "language": "python", "parameters": "(self, app=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", ".", "_current_gui", "=", "arg_4", "if", "arg_1", "is", "None", ":", "import", "Tkinter", "arg_1", "=", "Tkinter", ".", "Tk", "(", ")", "arg_1", ".", "withdraw", "(", ")", "arg_0", ".", "_apps", "[", "arg_4", "]", "=", "arg_1", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Enable event loop integration with Tk.\n\n        Parameters\n        ----------\n        app : toplevel :class:`Tkinter.Tk` widget, optional.\n            Running toplevel widget to use.  If not given, we probe Tk for an\n            existing one, and create a new one if none is found.\n\n        Notes\n        -----\n        If you have already created a :class:`Tkinter.Tk` object, the only\n        thing done by this method is to register with the\n        :class:`InputHookManager`, since creating that object automatically\n        sets ``PyOS_InputHook``.\n        \"\"\"\n        arg_0._current_gui = arg_4\n        if arg_1 is None:\n            import Tkinter\n            arg_1 = Tkinter.Tk()\n            arg_1.withdraw()\n            arg_0._apps[arg_4] = arg_1\n            return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/lib/inputhook.py", "identifier": "InputHookManager.enable_tk", "docstring": "Enable event loop integration with Tk.\n\n        Parameters\n        ----------\n        app : toplevel :class:`Tkinter.Tk` widget, optional.\n            Running toplevel widget to use.  If not given, we probe Tk for an\n            existing one, and create a new one if none is found.\n\n        Notes\n        -----\n        If you have already created a :class:`Tkinter.Tk` object, the only\n        thing done by this method is to register with the\n        :class:`InputHookManager`, since creating that object automatically\n        sets ``PyOS_InputHook``.", "docstring_tokens": ["Enable", "event", "loop", "integration", "with", "Tk", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254099}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Certificate.py#L83-L107", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Create the Certificate", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"name\"", ":", "arg_0", ".", "name", ",", "\"type\"", ":", "arg_0", ".", "type", ",", "\"dns_names\"", ":", "arg_0", ".", "dns_names", ",", "\"private_key\"", ":", "arg_0", ".", "private_key", ",", "\"leaf_certificate\"", ":", "arg_0", ".", "leaf_certificate", ",", "\"certificate_chain\"", ":", "arg_0", ".", "certificate_chain", "}", "arg_2", "=", "arg_0", ".", "get_data", "(", "\"certificates/\"", ",", "arg_7", "=", "POST", ",", "arg_1", "=", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "id", "=", "arg_2", "[", "'certificate'", "]", "[", "'id'", "]", "arg_0", ".", "not_after", "=", "arg_2", "[", "'certificate'", "]", "[", "'not_after'", "]", "arg_0", ".", "sha1_fingerprint", "=", "arg_2", "[", "'certificate'", "]", "[", "'sha1_fingerprint'", "]", "arg_0", ".", "Funcd_at", "=", "arg_2", "[", "'certificate'", "]", "[", "'Funcd_at'", "]", "arg_0", ".", "type", "=", "arg_2", "[", "'certificate'", "]", "[", "'type'", "]", "arg_0", ".", "dns_names", "=", "arg_2", "[", "'certificate'", "]", "[", "'dns_names'", "]", "arg_0", ".", "state", "=", "arg_2", "[", "'certificate'", "]", "[", "'state'", "]", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"\n            Create the Certificate\n        \"\"\"\n        arg_1 = {\n            \"name\": arg_0.name,\n            \"type\": arg_0.type,\n            \"dns_names\": arg_0.dns_names,\n            \"private_key\": arg_0.private_key,\n            \"leaf_certificate\": arg_0.leaf_certificate,\n            \"certificate_chain\": arg_0.certificate_chain\n        }\n\n        arg_2 = arg_0.get_data(\"certificates/\", arg_7=POST, arg_1=arg_1)\n\n        if arg_2:\n            arg_0.id = arg_2['certificate']['id']\n            arg_0.not_after = arg_2['certificate']['not_after']\n            arg_0.sha1_fingerprint = arg_2['certificate']['sha1_fingerprint']\n            arg_0.Funcd_at = arg_2['certificate']['Funcd_at']\n            arg_0.type = arg_2['certificate']['type']\n            arg_0.dns_names = arg_2['certificate']['dns_names']\n            arg_0.state = arg_2['certificate']['state']\n\n        return arg_0", "path": "digitalocean/Certificate.py", "identifier": "Certificate.create", "docstring": "Create the Certificate", "docstring_tokens": ["Create", "the", "Certificate"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 254100}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/profiles/mass_profiles.py#L170-L199", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Integrate the mass profiles's convergence profile to compute the total mass within a circle of \\\n        specified radius. This is centred on the mass profile.", "language": "python", "parameters": "(self, radius: dim.Length, unit_mass='angular', kpc_per_arcsec=None,\n                                    critical_surface_density=None)", "return_statement": "return mass_angular.convert(unit_mass=unit_mass, critical_surface_density=critical_surface_density)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Length", ",", "arg_4", "=", "'angular'", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_0", ".", "check_units_of_radius_and_critical_surface_density", "(", "arg_1", "=", "arg_1", ",", "arg_6", "=", "arg_6", ")", "arg_7", "=", "arg_0", ".", "new_profile_with_units_converted", "(", "unit_length", "=", "arg_1", ".", "unit_length", ",", "arg_4", "=", "'angular'", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_8", "=", "arg_2", ".", "Mass", "(", "value", "=", "quad", "(", "arg_7", ".", "mass_integral", ",", "a", "=", "0.0", ",", "b", "=", "arg_1", ",", "args", "=", "(", "1.0", ",", ")", ")", "[", "0", "]", ",", "arg_4", "=", "'angular'", ")", "return", "arg_8", ".", "convert", "(", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1: arg_2.Length, arg_4='angular', arg_5=None,\n                                    arg_6=None):\n        \"\"\" Integrate the mass profiles's convergence profile to compute the total mass within a circle of \\\n        specified radius. This is centred on the mass profile.\n\n        The following units for mass can be specified and output:\n\n        - Dimensionless angular units (default) - 'angular'.\n        - Solar masses - 'angular' (multiplies the angular mass by the critical surface mass density).\n\n        Parameters\n        ----------\n        radius : dim.Length\n            The radius of the circle to compute the dimensionless mass within.\n        unit_mass : str\n            The units the mass is returned in (angular | angular).\n        critical_surface_density : float or None\n            The critical surface mass density of the strong lens configuration, which converts mass from angulalr \\\n            units to phsical units (e.g. solar masses).\n        \"\"\"\n\n        arg_0.check_units_of_radius_and_critical_surface_density(\n            arg_1=arg_1, arg_6=arg_6)\n\n        arg_7 = arg_0.new_profile_with_units_converted(\n            unit_length=arg_1.unit_length, arg_4='angular',\n            arg_5=arg_5, arg_6=arg_6)\n\n        arg_8 = arg_2.Mass(value=quad(arg_7.mass_integral, a=0.0, b=arg_1, args=(1.0,))[0], arg_4='angular')\n        return arg_8.convert(arg_4=arg_4, arg_6=arg_6)", "path": "autolens/model/profiles/mass_profiles.py", "identifier": "EllipticalMassProfile.mass_within_circle_in_units", "docstring": "Integrate the mass profiles's convergence profile to compute the total mass within a circle of \\\n        specified radius. This is centred on the mass profile.\n\n        The following units for mass can be specified and output:\n\n        - Dimensionless angular units (default) - 'angular'.\n        - Solar masses - 'angular' (multiplies the angular mass by the critical surface mass density).\n\n        Parameters\n        ----------\n        radius : dim.Length\n            The radius of the circle to compute the dimensionless mass within.\n        unit_mass : str\n            The units the mass is returned in (angular | angular).\n        critical_surface_density : float or None\n            The critical surface mass density of the strong lens configuration, which converts mass from angulalr \\\n            units to phsical units (e.g. solar masses).", "docstring_tokens": ["Integrate", "the", "mass", "profiles", "s", "convergence", "profile", "to", "compute", "the", "total", "mass", "within", "a", "circle", "of", "\\", "specified", "radius", ".", "This", "is", "centred", "on", "the", "mass", "profile", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 254101}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Droplet.py#L204-L230", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Perform a droplet action.", "language": "python", "parameters": "(self, params, return_dict=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "get_data", "(", "\"droplets/%s/actions/\"", "%", "arg_0", ".", "id", ",", "type", "=", "POST", ",", "arg_1", "=", "arg_1", ")", "if", "arg_2", ":", "return", "arg_3", "else", ":", "arg_3", "=", "arg_3", "[", "u'action'", "]", "arg_4", "=", "Action", "(", "token", "=", "arg_0", ".", "token", ")", "for", "arg_5", "in", "arg_3", ".", "keys", "(", ")", ":", "setattr", "(", "arg_4", ",", "arg_5", ",", "arg_3", "[", "arg_5", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n            Perform a droplet action.\n\n            Args:\n                params (dict): parameters of the action\n\n            Optional Args:\n                return_dict (bool): Return a dict when True (default),\n                    otherwise return an Action.\n\n            Returns dict or Action\n        \"\"\"\n        arg_3 = arg_0.get_data(\n            \"droplets/%s/actions/\" % arg_0.id,\n            type=POST,\n            arg_1=arg_1\n        )\n        if arg_2:\n            return arg_3\n        else:\n            arg_3 = arg_3[u'action']\n            arg_4 = Action(token=arg_0.token)\n            # Loading attributes\n            for arg_5 in arg_3.keys():\n                setattr(arg_4, arg_5, arg_3[arg_5])\n            return arg_4", "path": "digitalocean/Droplet.py", "identifier": "Droplet._perform_action", "docstring": "Perform a droplet action.\n\n            Args:\n                params (dict): parameters of the action\n\n            Optional Args:\n                return_dict (bool): Return a dict when True (default),\n                    otherwise return an Action.\n\n            Returns dict or Action", "docstring_tokens": ["Perform", "a", "droplet", "action", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 254102}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_attr_accessor.py#L110-L118", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "File size in bytes.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "arg_0", ".", "_stat", ".", "st_Func", "except", ":", "arg_0", ".", "_stat", "=", "arg_0", ".", "stat", "(", ")", "return", "arg_0", ".", "Func"], "function": "def Func(arg_0):\n        \"\"\"\n        File Func in bytes.\n        \"\"\"\n        try:\n            return arg_0._stat.st_Func\n        except:  # pragma: no cover\n            arg_0._stat = arg_0.stat()\n            return arg_0.Func", "path": "pathlib_mate/mate_attr_accessor.py", "identifier": "AttrAccessor.size", "docstring": "File size in bytes.", "docstring_tokens": ["File", "size", "in", "bytes", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 254103}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L59-L96", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the list containing the names of the modules available in the given\n    folder.", "language": "python", "parameters": "(path)", "return_statement": "return [basename(p).split('.')[0] for p in folder_list]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "''", ":", "arg_0", "=", "'.'", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "listdir", "(", "arg_0", ")", "elif", "arg_0", ".", "endswith", "(", "'.egg'", ")", ":", "try", ":", "arg_1", "=", "[", "f", "for", "f", "in", "zipimporter", "(", "arg_0", ")", ".", "_files", "]", "except", ":", "arg_1", "=", "[", "]", "else", ":", "arg_1", "=", "[", "]", "if", "not", "arg_1", ":", "return", "[", "]", "arg_2", "=", "os", ".", "path", ".", "isfile", "arg_3", "=", "os", ".", "path", ".", "join", "arg_4", "=", "os", ".", "path", ".", "basename", "def", "is_importable_file", "(", "arg_0", ")", ":", "arg_5", ",", "arg_6", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "return", "import_re", ".", "match", "(", "arg_0", ")", "and", "py3compat", ".", "isidentifier", "(", "arg_5", ")", "arg_1", "=", "[", "arg_7", "for", "arg_7", "in", "arg_1", "if", "arg_2", "(", "arg_3", "(", "arg_0", ",", "arg_7", ",", "'__init__.py'", ")", ")", "or", "is_importable_file", "(", "arg_7", ")", "]", "return", "[", "arg_4", "(", "arg_7", ")", ".", "split", "(", "'.'", ")", "[", "0", "]", "for", "arg_7", "in", "arg_1", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Return the list containing the names of the modules available in the given\n    folder.\n    \"\"\"\n    # sys.path has the cwd as an empty string, but isdir/listdir need it as '.'\n    if arg_0 == '':\n        arg_0 = '.'\n\n    if os.path.isdir(arg_0):\n        arg_1 = os.listdir(arg_0)\n    elif arg_0.endswith('.egg'):\n        try:\n            arg_1 = [f for f in zipimporter(arg_0)._files]\n        except:\n            arg_1 = []\n    else:\n        arg_1 = []\n\n    if not arg_1:\n        return []\n\n    # A few local constants to be used in loops below\n    arg_2 = os.path.isfile\n    arg_3 = os.path.join\n    arg_4 = os.path.basename\n\n    def is_importable_file(arg_0):\n        \"\"\"Returns True if the provided path is a valid importable module\"\"\"\n        arg_5, arg_6 = os.path.splitext( arg_0 )\n        return import_re.match(arg_0) and py3compat.isidentifier(arg_5)\n\n    # Now find actual path matches for packages or modules\n    arg_1 = [arg_7 for arg_7 in arg_1\n                   if arg_2(arg_3(arg_0, arg_7,'__init__.py'))\n                   or is_importable_file(arg_7) ]\n\n    return [arg_4(arg_7).split('.')[0] for arg_7 in arg_1]", "path": "environment/lib/python2.7/site-packages/IPython/core/completerlib.py", "identifier": "module_list", "docstring": "Return the list containing the names of the modules available in the given\n    folder.", "docstring_tokens": ["Return", "the", "list", "containing", "the", "names", "of", "the", "modules", "available", "in", "the", "given", "folder", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254104}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/acts/documentation.py#L50-L61", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Read auth from pip config.", "language": "python", "parameters": "(configfile='~/.pypirc')", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'~/.pypirc'", ")", ":", "arg_1", "=", "ConfigParser", "(", ")", "if", "arg_1", ".", "read", "(", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", ")", ":", "try", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'pypi'", ",", "'username'", ")", "arg_3", "=", "arg_1", ".", "get", "(", "'pypi'", ",", "'password'", ")", "return", "arg_2", ",", "arg_3", "except", "ConfigError", ":", "notify", ".", "warning", "(", "\"No PyPI credentials in '{}',\"", "\" will fall back to '~/.netrc'...\"", ".", "format", "(", "arg_0", ")", ")", "return", "None"], "function": "def Func(arg_0='~/.pypirc'):\n    \"\"\"Read auth from pip config.\"\"\"\n    arg_1 = ConfigParser()\n    if arg_1.read(os.path.expanduser(arg_0)):\n        try:\n            arg_2 = arg_1.get('pypi', 'username')\n            arg_3 = arg_1.get('pypi', 'password')\n            return arg_2, arg_3\n        except ConfigError:\n            notify.warning(\"No PyPI credentials in '{}',\"\n                           \" will fall back to '~/.netrc'...\".format(arg_0))\n    return None", "path": "src/rituals/acts/documentation.py", "identifier": "get_pypi_auth", "docstring": "Read auth from pip config.", "docstring_tokens": ["Read", "auth", "from", "pip", "config", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 254105}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/base_operator.py#L315-L326", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Check if input dimension corresponds to qubit subsystems.", "language": "python", "parameters": "(cls, dims, size)", "return_statement": "return tuple(dims)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_2", "elif", "np", ".", "product", "(", "arg_1", ")", "!=", "arg_2", ":", "raise", "QiskitError", "(", "\"dimensions do not match size.\"", ")", "if", "isinstance", "(", "arg_1", ",", "(", "int", ",", "np", ".", "integer", ")", ")", ":", "arg_3", "=", "int", "(", "np", ".", "log2", "(", "arg_1", ")", ")", "if", "2", "**", "arg_3", "==", "arg_2", ":", "return", "arg_3", "*", "(", "2", ",", ")", "return", "(", "arg_1", ",", ")", "return", "tuple", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check if input dimension corresponds to qubit subsystems.\"\"\"\n        if arg_1 is None:\n            arg_1 = arg_2\n        elif np.product(arg_1) != arg_2:\n            raise QiskitError(\"dimensions do not match size.\")\n        if isinstance(arg_1, (int, np.integer)):\n            arg_3 = int(np.log2(arg_1))\n            if 2 ** arg_3 == arg_2:\n                return arg_3 * (2,)\n            return (arg_1,)\n        return tuple(arg_1)", "path": "qiskit/quantum_info/operators/base_operator.py", "identifier": "BaseOperator._automatic_dims", "docstring": "Check if input dimension corresponds to qubit subsystems.", "docstring_tokens": ["Check", "if", "input", "dimension", "corresponds", "to", "qubit", "subsystems", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254106}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L434-L443", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get a list of all the cards in the game", "language": "python", "parameters": "(self, timeout: int=None)", "return_statement": "return self._get_model(url, timeout=timeout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "api", ".", "CARDS", "return", "arg_0", ".", "_get_model", "(", "arg_3", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2=None):\n        \"\"\"Get a list of all the cards in the game\n\n        Parameters\n        ----------\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_3 = arg_0.api.CARDS\n        return arg_0._get_model(arg_3, arg_1=arg_1)", "path": "clashroyale/official_api/client.py", "identifier": "Client.get_all_cards", "docstring": "Get a list of all the cards in the game\n\n        Parameters\n        ----------\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "a", "list", "of", "all", "the", "cards", "in", "the", "game"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 254107}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/shortcuts.py#L21-L55", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Create simulation model and connect it with interfaces of original unit\n    and decorate it with agents", "language": "python", "parameters": "(unit: Unit, modelCls: Optional[SimModel]=None,\n               targetPlatform=DummyPlatform(),\n               dumpModelIn: str=None, onAfterToRtl=None)", "return_statement": "return unit, model, procs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "None", ",", "arg_5", "=", "arg_6", "(", ")", ",", "arg_7", ":", "arg_8", "=", "None", ",", "arg_9", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "toSimModel", "(", "arg_0", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ")", "else", ":", "toSimModel", "(", "arg_0", ")", "if", "arg_9", ":", "arg_9", "(", "arg_0", ",", "arg_2", ")", "reconnectUnitSignalsToModel", "(", "arg_0", ",", "arg_2", ")", "arg_10", "=", "arg_2", "(", ")", "arg_11", "=", "autoAddAgents", "(", "arg_0", ")", "return", "arg_0", ",", "arg_10", ",", "arg_11"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4]=None,\n               arg_5=arg_6(),\n               arg_7: arg_8=None, arg_9=None):\n    \"\"\"\n    Create simulation model and connect it with interfaces of original unit\n    and decorate it with agents\n\n    :param unit: interface level unit which you wont prepare for simulation\n    :param modelCls: class of rtl simulation model to run simulation on,\n        if is None rtl sim model will be generated from unit\n    :param targetPlatform: target platform for this synthes\n    :param dumpModelIn: folder to where put sim model files\n        (if is None sim model will be constructed only in memory)\n    :param onAfterToRtl: callback fn(unit, modelCls) which will be called\n        after unit will be synthesised to rtl\n\n    :return: tuple (fully loaded unit with connected sim model,\n        connected simulation model,\n        simulation processes of agents\n        )\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = toSimModel(\n            arg_0, arg_5=arg_5, arg_7=arg_7)\n    else:\n        # to instantiate hierarchy of unit\n        toSimModel(arg_0)\n\n    if arg_9:\n        arg_9(arg_0, arg_2)\n\n    reconnectUnitSignalsToModel(arg_0, arg_2)\n    arg_10 = arg_2()\n    arg_11 = autoAddAgents(arg_0)\n    return arg_0, arg_10, arg_11", "path": "hwt/simulator/shortcuts.py", "identifier": "simPrepare", "docstring": "Create simulation model and connect it with interfaces of original unit\n    and decorate it with agents\n\n    :param unit: interface level unit which you wont prepare for simulation\n    :param modelCls: class of rtl simulation model to run simulation on,\n        if is None rtl sim model will be generated from unit\n    :param targetPlatform: target platform for this synthes\n    :param dumpModelIn: folder to where put sim model files\n        (if is None sim model will be constructed only in memory)\n    :param onAfterToRtl: callback fn(unit, modelCls) which will be called\n        after unit will be synthesised to rtl\n\n    :return: tuple (fully loaded unit with connected sim model,\n        connected simulation model,\n        simulation processes of agents\n        )", "docstring_tokens": ["Create", "simulation", "model", "and", "connect", "it", "with", "interfaces", "of", "original", "unit", "and", "decorate", "it", "with", "agents"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 254108}
{"url": "https://github.com/bunchesofdonald/photohash/blob/1839a37a884e8c31cb94e661bd76f8125b0dfcb6/photohash/photohash.py#L37-L42", "sha": "1839a37a884e8c31cb94e661bd76f8125b0dfcb6", "docstring_summary": "Compute the hamming distance between two images", "language": "python", "parameters": "(image_path, other_image_path)", "return_statement": "return hash_distance(image_hash, other_image_hash)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "average_hash", "(", "arg_0", ")", "arg_3", "=", "average_hash", "(", "arg_1", ")", "return", "hash_Func", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Compute the hamming Func between two images\"\"\"\n    arg_2 = average_hash(arg_0)\n    arg_3 = average_hash(arg_1)\n\n    return hash_Func(arg_2, arg_3)", "path": "photohash/photohash.py", "identifier": "distance", "docstring": "Compute the hamming distance between two images", "docstring_tokens": ["Compute", "the", "hamming", "distance", "between", "two", "images"], "nwo": "bunchesofdonald/photohash", "score": 0.5558840706399301, "idx": 254109}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/constantq.py#L538-L703", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Compute the inverse constant-Q transform.", "language": "python", "parameters": "(C, sr=22050, hop_length=512, fmin=None, bins_per_octave=12,\n         tuning=0.0, filter_scale=1, norm=1, sparsity=0.01, window='hann',\n         scale=True, length=None, amin=util.Deprecated(), res_type='fft')", "return_statement": "return y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "22050", ",", "arg_2", "=", "512", ",", "arg_3", "=", "None", ",", "arg_4", "=", "12", ",", "arg_5", "=", "0.0", ",", "arg_6", "=", "1", ",", "arg_7", "=", "1", ",", "arg_8", "=", "0.01", ",", "arg_9", "=", "'hann'", ",", "arg_10", "=", "True", ",", "arg_11", "=", "None", ",", "arg_12", "=", "arg_13", ".", "Deprecated", "(", ")", ",", "arg_15", "=", "'fft'", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "note_to_hz", "(", "'C1'", ")", "arg_16", "=", "len", "(", "arg_0", ")", "arg_17", "=", "cqt_frequencies", "(", "arg_16", ",", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "[", "-", "arg_4", ":", "]", "arg_18", "=", "min", "(", "arg_16", ",", "arg_4", ")", "arg_19", ",", "arg_20", ",", "arg_21", "=", "__cqt_filter_fft", "(", "arg_1", ",", "np", ".", "min", "(", "arg_17", ")", ",", "arg_18", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")", "if", "arg_2", ">", "min", "(", "arg_21", ")", ":", "warnings", ".", "warn", "(", "'hop_length={} exceeds minimum CQT filter length={:.3f}.\\n'", "'This will probably cause unpleasant acoustic artifacts. '", "'Consider decreasing your hop length or increasing the frequency resolution of your CQT.'", ".", "format", "(", "arg_2", ",", "min", "(", "arg_21", ")", ")", ")", "arg_19", "=", "arg_19", ".", "todense", "(", ")", "*", "arg_20", "/", "arg_21", "[", ":", ",", "np", ".", "newaxis", "]", "arg_22", "=", "arg_19", ".", "H", "arg_23", "=", "int", "(", "np", ".", "ceil", "(", "float", "(", "arg_16", ")", "/", "arg_4", ")", ")", "arg_24", "=", "None", "for", "arg_25", "in", "range", "(", "arg_23", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "arg_26", "=", "slice", "(", "-", "(", "arg_25", "+", "1", ")", "*", "arg_4", "-", "1", ",", "-", "(", "arg_25", ")", "*", "arg_4", "-", "1", ")", "arg_27", "=", "arg_0", "[", "arg_26", "]", "arg_28", "=", "arg_22", "[", ":", ",", "-", "arg_27", ".", "shape", "[", "0", "]", ":", "]", "arg_29", "=", "arg_2", "//", "2", "**", "arg_25", "if", "arg_10", ":", "arg_30", "=", "np", ".", "sqrt", "(", "arg_21", "[", "-", "arg_27", ".", "shape", "[", "0", "]", ":", ",", "np", ".", "newaxis", "]", ")", "/", "arg_20", "else", ":", "arg_30", "=", "arg_21", "[", "-", "arg_27", ".", "shape", "[", "0", "]", ":", ",", "np", ".", "newaxis", "]", "*", "np", ".", "sqrt", "(", "2", "**", "arg_25", ")", "/", "arg_20", "arg_31", "=", "arg_28", ".", "dot", "(", "arg_27", "/", "arg_30", ")", "arg_32", "=", "istft", "(", "arg_31", ",", "arg_9", "=", "'ones'", ",", "arg_2", "=", "arg_29", ")", "if", "arg_24", "is", "None", ":", "arg_24", "=", "arg_32", "else", ":", "arg_24", "=", "audio", ".", "resample", "(", "arg_24", ",", "1", ",", "2", ",", "arg_10", "=", "True", ",", "arg_15", "=", "arg_15", ",", "fix", "=", "False", ")", "arg_24", "[", ":", "len", "(", "arg_32", ")", "]", "+=", "arg_32", "if", "arg_11", ":", "arg_24", "=", "arg_13", ".", "fix_length", "(", "arg_24", ",", "arg_11", ")", "return", "arg_24"], "function": "def Func(arg_0, arg_1=22050, arg_2=512, arg_3=None, arg_4=12,\n         arg_5=0.0, arg_6=1, arg_7=1, arg_8=0.01, arg_9='hann',\n         arg_10=True, arg_11=None, arg_12=arg_13.Deprecated(), arg_15='fft'):\n    '''Compute the inverse constant-Q transform.\n\n    Given a constant-Q transform representation `C` of an audio signal `y`,\n    this function produces an approximation `y_hat`.\n\n\n    Parameters\n    ----------\n    C : np.ndarray, [shape=(n_bins, n_frames)]\n        Constant-Q representation as produced by `core.cqt`\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    fmin : float > 0 [scalar]\n        Minimum frequency. Defaults to C1 ~= 32.70 Hz\n\n    tuning : float in `[-0.5, 0.5)` [scalar]\n        Tuning offset in fractions of a bin (cents).\n\n    filter_scale : float > 0 [scalar]\n        Filter scale factor. Small values (<1) use shorter windows\n        for improved time resolution.\n\n    norm : {inf, -inf, 0, float > 0}\n        Type of norm to use for basis function normalization.\n        See `librosa.util.normalize`.\n\n    sparsity : float in [0, 1)\n        Sparsify the CQT basis by discarding up to `sparsity`\n        fraction of the energy in each basis.\n\n        Set `sparsity=0` to disable sparsification.\n\n    window : str, tuple, number, or function\n        Window specification for the basis filters.\n        See `filters.get_window` for details.\n\n    scale : bool\n        If `True`, scale the CQT response by square-root the length\n        of each channel's filter. This is analogous to `norm='ortho'` in FFT.\n\n        If `False`, do not scale the CQT. This is analogous to `norm=None`\n        in FFT.\n\n    length : int > 0, optional\n        If provided, the output `y` is zero-padded or clipped to exactly\n        `length` samples.\n\n    amin : float or None [DEPRECATED]\n\n        .. note:: This parameter is deprecated in 0.7.0 and will be removed in 0.8.0.\n\n    res_type : string\n        Resampling mode.  By default, this uses `fft` mode for high-quality \n        reconstruction, but this may be slow depending on your signal duration.\n        See `librosa.resample` for supported modes.\n\n    Returns\n    -------\n    y : np.ndarray, [shape=(n_samples), dtype=np.float]\n        Audio time-series reconstructed from the CQT representation.\n\n    See Also\n    --------\n    cqt\n    core.resample\n\n    Notes\n    -----\n    This function caches at level 40.\n\n    Examples\n    --------\n    Using default parameters\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=15)\n    >>> C = librosa.cqt(y=y, sr=sr)\n    >>> y_hat = librosa.Func(C=C, sr=sr)\n\n    Or with a different hop length and frequency resolution:\n\n    >>> hop_length = 256\n    >>> bins_per_octave = 12 * 3\n    >>> C = librosa.cqt(y=y, sr=sr, hop_length=256, n_bins=7*bins_per_octave,\n    ...                 bins_per_octave=bins_per_octave)\n    >>> y_hat = librosa.Func(C=C, sr=sr, hop_length=hop_length,\n    ...                 bins_per_octave=bins_per_octave)\n    '''\n\n    if arg_3 is None:\n        arg_3 = note_to_hz('C1')\n\n    # Get the top octave of frequencies\n    arg_16 = len(arg_0)\n\n    arg_17 = cqt_frequencies(arg_16, arg_3,\n                            arg_4=arg_4,\n                            arg_5=arg_5)[-arg_4:]\n\n    arg_18 = min(arg_16, arg_4)\n\n    arg_19, arg_20, arg_21 = __cqt_filter_fft(arg_1, np.min(arg_17),\n                                                 arg_18,\n                                                 arg_4,\n                                                 arg_5,\n                                                 arg_6,\n                                                 arg_7,\n                                                 arg_8=arg_8,\n                                                 arg_9=arg_9)\n\n    if arg_2 > min(arg_21):\n        warnings.warn('hop_length={} exceeds minimum CQT filter length={:.3f}.\\n'\n                      'This will probably cause unpleasant acoustic artifacts. '\n                      'Consider decreasing your hop length or increasing the frequency resolution of your CQT.'.format(arg_2, min(arg_21)))\n\n    # The basis gets renormalized by the effective window length above;\n    # This step undoes that\n    arg_19 = arg_19.todense() * arg_20 / arg_21[:, np.newaxis]\n\n    # This step conjugate-transposes the filter\n    arg_22 = arg_19.H\n\n    # How many octaves do we have?\n    arg_23 = int(np.ceil(float(arg_16) / arg_4))\n\n    arg_24 = None\n    for arg_25 in range(arg_23 - 1, -1, -1):\n        arg_26 = slice(-(arg_25+1) * arg_4 - 1,\n                       -(arg_25) * arg_4 - 1)\n\n        # Slice this octave\n        arg_27 = arg_0[arg_26]\n        arg_28 = arg_22[:, -arg_27.shape[0]:]\n\n        arg_29 = arg_2 // 2**arg_25\n\n        # Apply energy corrections\n        if arg_10:\n            arg_30 = np.sqrt(arg_21[-arg_27.shape[0]:, np.newaxis]) / arg_20\n        else:\n            arg_30 = arg_21[-arg_27.shape[0]:, np.newaxis] * np.sqrt(2**arg_25) / arg_20\n\n        # Inverse-project the basis for each octave\n        arg_31 = arg_28.dot(arg_27 / arg_30)\n\n        # Inverse-STFT that response\n        arg_32 = istft(arg_31, arg_9='ones', arg_2=arg_29)\n\n        # Up-sample that octave\n        if arg_24 is None:\n            arg_24 = arg_32\n        else:\n            # Up-sample the previous buffer and add in the new one\n            # Scipy-resampling is fast here, since it's a power-of-two relation\n            arg_24 = audio.resample(arg_24, 1, 2, arg_10=True, arg_15=arg_15, fix=False)\n\n            arg_24[:len(arg_32)] += arg_32\n\n    if arg_11:\n        arg_24 = arg_13.fix_length(arg_24, arg_11)\n\n    return arg_24", "path": "librosa/core/constantq.py", "identifier": "icqt", "docstring": "Compute the inverse constant-Q transform.\n\n    Given a constant-Q transform representation `C` of an audio signal `y`,\n    this function produces an approximation `y_hat`.\n\n\n    Parameters\n    ----------\n    C : np.ndarray, [shape=(n_bins, n_frames)]\n        Constant-Q representation as produced by `core.cqt`\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    fmin : float > 0 [scalar]\n        Minimum frequency. Defaults to C1 ~= 32.70 Hz\n\n    tuning : float in `[-0.5, 0.5)` [scalar]\n        Tuning offset in fractions of a bin (cents).\n\n    filter_scale : float > 0 [scalar]\n        Filter scale factor. Small values (<1) use shorter windows\n        for improved time resolution.\n\n    norm : {inf, -inf, 0, float > 0}\n        Type of norm to use for basis function normalization.\n        See `librosa.util.normalize`.\n\n    sparsity : float in [0, 1)\n        Sparsify the CQT basis by discarding up to `sparsity`\n        fraction of the energy in each basis.\n\n        Set `sparsity=0` to disable sparsification.\n\n    window : str, tuple, number, or function\n        Window specification for the basis filters.\n        See `filters.get_window` for details.\n\n    scale : bool\n        If `True`, scale the CQT response by square-root the length\n        of each channel's filter. This is analogous to `norm='ortho'` in FFT.\n\n        If `False`, do not scale the CQT. This is analogous to `norm=None`\n        in FFT.\n\n    length : int > 0, optional\n        If provided, the output `y` is zero-padded or clipped to exactly\n        `length` samples.\n\n    amin : float or None [DEPRECATED]\n\n        .. note:: This parameter is deprecated in 0.7.0 and will be removed in 0.8.0.\n\n    res_type : string\n        Resampling mode.  By default, this uses `fft` mode for high-quality \n        reconstruction, but this may be slow depending on your signal duration.\n        See `librosa.resample` for supported modes.\n\n    Returns\n    -------\n    y : np.ndarray, [shape=(n_samples), dtype=np.float]\n        Audio time-series reconstructed from the CQT representation.\n\n    See Also\n    --------\n    cqt\n    core.resample\n\n    Notes\n    -----\n    This function caches at level 40.\n\n    Examples\n    --------\n    Using default parameters\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=15)\n    >>> C = librosa.cqt(y=y, sr=sr)\n    >>> y_hat = librosa.icqt(C=C, sr=sr)\n\n    Or with a different hop length and frequency resolution:\n\n    >>> hop_length = 256\n    >>> bins_per_octave = 12 * 3\n    >>> C = librosa.cqt(y=y, sr=sr, hop_length=256, n_bins=7*bins_per_octave,\n    ...                 bins_per_octave=bins_per_octave)\n    >>> y_hat = librosa.icqt(C=C, sr=sr, hop_length=hop_length,\n    ...                 bins_per_octave=bins_per_octave)", "docstring_tokens": ["Compute", "the", "inverse", "constant", "-", "Q", "transform", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 254110}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/metrics/metrics_helper.py#L42-L45", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Registers its metrics to a given metrics collector with a given interval", "language": "python", "parameters": "(self, metrics_collector, interval)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "metrics", ".", "items", "(", ")", ":", "arg_1", ".", "register_metric", "(", "arg_3", ",", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Registers its metrics to a given metrics collector with a given interval\"\"\"\n    for arg_3, arg_4 in arg_0.metrics.items():\n      arg_1.register_metric(arg_3, arg_4, arg_2)", "path": "heron/instance/src/python/utils/metrics/metrics_helper.py", "identifier": "BaseMetricsHelper.register_metrics", "docstring": "Registers its metrics to a given metrics collector with a given interval", "docstring_tokens": ["Registers", "its", "metrics", "to", "a", "given", "metrics", "collector", "with", "a", "given", "interval"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254111}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/regression.py#L69-L78", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Median absolute error regression loss", "language": "python", "parameters": "(y_actual, y_predicted)", "return_statement": "return (y_predicted - y_actual).abs().median()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "ModelBase", ".", "_check_targets", "(", "arg_0", ",", "arg_1", ")", "return", "(", "arg_1", "-", "arg_0", ")", ".", "abs", "(", ")", ".", "median", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Median absolute error regression loss\n\n    :param y_actual: H2OFrame of actual response.\n    :param y_predicted: H2OFrame of predicted response.\n    :returns: median absolute error loss (best is 0.0)\n    \"\"\"\n    ModelBase._check_targets(arg_0, arg_1)\n    return (arg_1 - arg_0).abs().median()", "path": "h2o-py/h2o/model/regression.py", "identifier": "h2o_median_absolute_error", "docstring": "Median absolute error regression loss\n\n    :param y_actual: H2OFrame of actual response.\n    :param y_predicted: H2OFrame of predicted response.\n    :returns: median absolute error loss (best is 0.0)", "docstring_tokens": ["Median", "absolute", "error", "regression", "loss"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 254112}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/ultratb.py#L380-L389", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Shorthand access to the color table scheme selector method.", "language": "python", "parameters": "(self,*args,**kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "color_scheme_table", ".", "set_active_scheme", "(", "*", "arg_1", ",", "**", "arg_2", ")", "arg_0", ".", "Colors", "=", "arg_0", ".", "color_scheme_table", ".", "active_colors", "if", "hasattr", "(", "arg_0", ",", "'pdb'", ")", "and", "arg_0", ".", "pdb", "is", "not", "None", ":", "arg_0", ".", "pdb", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0,*arg_1,**arg_2):\n        \"\"\"Shorthand access to the color table scheme selector method.\"\"\"\n\n        # Set own color table\n        arg_0.color_scheme_table.set_active_scheme(*arg_1,**arg_2)\n        # for convenience, set Colors to the active scheme\n        arg_0.Colors = arg_0.color_scheme_table.active_colors\n        # Also set colors of debugger\n        if hasattr(arg_0,'pdb') and arg_0.pdb is not None:\n            arg_0.pdb.Func(*arg_1,**arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/core/ultratb.py", "identifier": "TBTools.set_colors", "docstring": "Shorthand access to the color table scheme selector method.", "docstring_tokens": ["Shorthand", "access", "to", "the", "color", "table", "scheme", "selector", "method", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254113}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1267-L1281", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Retrieves a list of all servers bound to the specified data center.", "language": "python", "parameters": "(self, datacenter_id, depth=1)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "arg_0", ".", "_perform_request", "(", "'/datacenters/%s/servers?depth=%s'", "%", "(", "arg_1", ",", "str", "(", "arg_2", ")", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=1):\n        \"\"\"\n        Retrieves a list of all servers bound to the specified data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``\n\n        \"\"\"\n        arg_3 = arg_0._perform_request(\n            '/datacenters/%s/servers?depth=%s' % (arg_1, str(arg_2)))\n\n        return arg_3", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.list_servers", "docstring": "Retrieves a list of all servers bound to the specified data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``", "docstring_tokens": ["Retrieves", "a", "list", "of", "all", "servers", "bound", "to", "the", "specified", "data", "center", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 254114}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/docs_resolv.py#L408-L436", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Embed hyperlinks to documentation into example code", "language": "python", "parameters": "(app, exception)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "not", "None", ":", "return", "if", "not", "arg_0", ".", "builder", ".", "config", ".", "plot_gallery", ":", "return", "if", "arg_0", ".", "builder", ".", "name", "not", "in", "[", "'html'", ",", "'readthedocs'", "]", ":", "return", "print", "(", "'Embedding documentation hyperlinks in examples..'", ")", "arg_2", "=", "arg_0", ".", "config", ".", "sphinx_gallery_conf", "arg_3", "=", "arg_2", "[", "'gallery_dirs'", "]", "if", "not", "isinstance", "(", "arg_3", ",", "list", ")", ":", "arg_3", "=", "[", "arg_3", "]", "for", "arg_4", "in", "arg_3", ":", "_Func", "(", "arg_0", ",", "arg_2", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Embed hyperlinks to documentation into example code\"\"\"\n    if arg_1 is not None:\n        return\n\n    # No need to waste time embedding hyperlinks when not running the examples\n    # XXX: also at the time of writing this fixes make html-noplot\n    # for some reason I don't fully understand\n    if not arg_0.builder.config.plot_gallery:\n        return\n\n    # XXX: Whitelist of builders for which it makes sense to embed\n    # hyperlinks inside the example html. Note that the link embedding\n    # require searchindex.js to exist for the links to the local doc\n    # and there does not seem to be a good way of knowing which\n    # builders creates a searchindex.js.\n    if arg_0.builder.name not in ['html', 'readthedocs']:\n        return\n\n    print('Embedding documentation hyperlinks in examples..')\n\n    arg_2 = arg_0.config.sphinx_gallery_conf\n\n    arg_3 = arg_2['gallery_dirs']\n    if not isinstance(arg_3, list):\n        arg_3 = [arg_3]\n\n    for arg_4 in arg_3:\n        _Func(arg_0, arg_2, arg_4)", "path": "doc/sphinxext/sphinx_gallery/docs_resolv.py", "identifier": "embed_code_links", "docstring": "Embed hyperlinks to documentation into example code", "docstring_tokens": ["Embed", "hyperlinks", "to", "documentation", "into", "example", "code"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 254115}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L642-L664", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Parse an RFC 2822 addr-spec.", "language": "python", "parameters": "(self)", "return_statement": "return ''.join(aslist) + self.getdomain()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_0", ".", "gotonext", "(", ")", "while", "arg_0", ".", "pos", "<", "len", "(", "arg_0", ".", "field", ")", ":", "if", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "==", "'.'", ":", "arg_1", ".", "append", "(", "'.'", ")", "arg_0", ".", "pos", "+=", "1", "elif", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "==", "'\"'", ":", "arg_1", ".", "append", "(", "'\"%s\"'", "%", "arg_0", ".", "getquote", "(", ")", ")", "elif", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "in", "arg_0", ".", "atomends", ":", "break", "else", ":", "arg_1", ".", "append", "(", "arg_0", ".", "getatom", "(", ")", ")", "arg_0", ".", "gotonext", "(", ")", "if", "arg_0", ".", "pos", ">=", "len", "(", "arg_0", ".", "field", ")", "or", "arg_0", ".", "field", "[", "arg_0", ".", "pos", "]", "!=", "'@'", ":", "return", "''", ".", "join", "(", "arg_1", ")", "arg_1", ".", "append", "(", "'@'", ")", "arg_0", ".", "pos", "+=", "1", "arg_0", ".", "gotonext", "(", ")", "return", "''", ".", "join", "(", "arg_1", ")", "+", "arg_0", ".", "getdomain", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Parse an RFC 2822 addr-spec.\"\"\"\n        arg_1 = []\n\n        arg_0.gotonext()\n        while arg_0.pos < len(arg_0.field):\n            if arg_0.field[arg_0.pos] == '.':\n                arg_1.append('.')\n                arg_0.pos += 1\n            elif arg_0.field[arg_0.pos] == '\"':\n                arg_1.append('\"%s\"' % arg_0.getquote())\n            elif arg_0.field[arg_0.pos] in arg_0.atomends:\n                break\n            else: arg_1.append(arg_0.getatom())\n            arg_0.gotonext()\n\n        if arg_0.pos >= len(arg_0.field) or arg_0.field[arg_0.pos] != '@':\n            return ''.join(arg_1)\n\n        arg_1.append('@')\n        arg_0.pos += 1\n        arg_0.gotonext()\n        return ''.join(arg_1) + arg_0.getdomain()", "path": "third_party/stdlib/rfc822.py", "identifier": "AddrlistClass.getaddrspec", "docstring": "Parse an RFC 2822 addr-spec.", "docstring_tokens": ["Parse", "an", "RFC", "2822", "addr", "-", "spec", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 254116}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1952-L1968", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Fetch jobIDs for jobs in the table with optional fields given a\n    specific clientInfo", "language": "python", "parameters": "(self, clientInfo, fields=[])", "return_statement": "return rows", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "[", "]", ")", ":", "arg_3", "=", "[", "arg_0", ".", "_jobs", ".", "pubToDBNameDict", "[", "x", "]", "for", "x", "in", "arg_2", "]", "arg_4", "=", "','", ".", "join", "(", "[", "'job_id'", "]", "+", "arg_3", ")", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_5", "=", "'SELECT %s FROM %s '", "'WHERE client_info = %%s '", "' AND status != %%s'", "%", "(", "arg_4", ",", "arg_0", ".", "jobsTableName", ")", "conn", ".", "cursor", ".", "execute", "(", "arg_5", ",", "[", "arg_1", ",", "arg_0", ".", "STATUS_COMPLETED", "]", ")", "arg_6", "=", "conn", ".", "cursor", ".", "fetchall", "(", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=[]):\n    \"\"\" Fetch jobIDs for jobs in the table with optional fields given a\n    specific clientInfo \"\"\"\n\n    # Form the sequence of field name strings that will go into the\n    #  request\n    arg_3 = [arg_0._jobs.pubToDBNameDict[x] for x in arg_2]\n    arg_4 = ','.join(['job_id'] + arg_3)\n\n    with ConnectionFactory.get() as conn:\n      arg_5 = 'SELECT %s FROM %s ' \\\n              'WHERE client_info = %%s ' \\\n              ' AND status != %%s' % (arg_4, arg_0.jobsTableName)\n      conn.cursor.execute(arg_5, [arg_1, arg_0.STATUS_COMPLETED])\n      arg_6 = conn.cursor.fetchall()\n\n    return arg_6", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.getActiveJobsForClientInfo", "docstring": "Fetch jobIDs for jobs in the table with optional fields given a\n    specific clientInfo", "docstring_tokens": ["Fetch", "jobIDs", "for", "jobs", "in", "the", "table", "with", "optional", "fields", "given", "a", "specific", "clientInfo"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254117}
{"url": "https://github.com/Scifabric/pybossa-client/blob/998d7cb0207ff5030dc800f0c2577c5692316c2c/pbclient/__init__.py#L551-L580", "sha": "998d7cb0207ff5030dc800f0c2577c5692316c2c", "docstring_summary": "Return a list of task runs for a given project ID.", "language": "python", "parameters": "(project_id, limit=100, offset=0, last_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "100", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", "else", ":", "arg_4", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "print", "(", "OFFSET_WARNING", ")", "arg_4", "[", "'project_id'", "]", "=", "arg_0", "try", ":", "arg_5", "=", "_pybossa_req", "(", "'get'", ",", "'taskrun'", ",", "arg_4", "=", "arg_4", ")", "if", "type", "(", "arg_5", ")", ".", "__name__", "==", "'list'", ":", "return", "[", "TaskRun", "(", "arg_6", ")", "for", "arg_6", "in", "arg_5", "]", "else", ":", "raise", "TypeError", "except", ":", "raise"], "function": "def Func(arg_0, arg_1=100, arg_2=0, arg_3=None):\n    \"\"\"Return a list of task runs for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param limit: Number of returned items, default 100\n    :type limit: integer\n    :param offset: Offset for the query, default 0\n    :type offset: integer\n    :param last_id: id of the last taskrun, used for pagination. If provided, offset is ignored\n    :type last_id: integer\n    :rtype: list\n    :returns: A list of task runs for the given project ID\n\n    \"\"\"\n    if arg_3 is not None:\n        arg_4 = dict(arg_1=arg_1, arg_3=arg_3)\n    else:\n        arg_4 = dict(arg_1=arg_1, arg_2=arg_2)\n        print(OFFSET_WARNING)\n    arg_4['project_id'] = arg_0\n    try:\n        arg_5 = _pybossa_req('get', 'taskrun',\n                           arg_4=arg_4)\n        if type(arg_5).__name__ == 'list':\n            return [TaskRun(arg_6) for arg_6 in arg_5]\n        else:\n            raise TypeError\n    except:\n        raise", "path": "pbclient/__init__.py", "identifier": "get_taskruns", "docstring": "Return a list of task runs for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param limit: Number of returned items, default 100\n    :type limit: integer\n    :param offset: Offset for the query, default 0\n    :type offset: integer\n    :param last_id: id of the last taskrun, used for pagination. If provided, offset is ignored\n    :type last_id: integer\n    :rtype: list\n    :returns: A list of task runs for the given project ID", "docstring_tokens": ["Return", "a", "list", "of", "task", "runs", "for", "a", "given", "project", "ID", "."], "nwo": "Scifabric/pybossa-client", "score": 0.27831918678159157, "idx": 254118}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L905-L934", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Logical compare.", "language": "python", "parameters": "(cpu, src1, src2)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "read", "(", ")", "&", "arg_2", ".", "read", "(", ")", "arg_0", ".", "SF", "=", "(", "arg_3", "&", "(", "1", "<<", "(", "arg_1", ".", "size", "-", "1", ")", ")", ")", "!=", "0", "arg_0", ".", "ZF", "=", "arg_3", "==", "0", "arg_0", ".", "PF", "=", "arg_0", ".", "_calculate_parity_flag", "(", "arg_3", ")", "arg_0", ".", "CF", "=", "False", "arg_0", ".", "OF", "=", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Logical compare.\n\n        Computes the bit-wise logical AND of first operand (source 1 operand)\n        and the second operand (source 2 operand) and sets the SF, ZF, and PF\n        status flags according to the result. The result is then discarded::\n\n            TEMP  =  SRC1 AND SRC2;\n            SF  =  MSB(TEMP);\n            IF TEMP  =  0\n            THEN ZF  =  1;\n            ELSE ZF  =  0;\n            FI:\n            PF  =  BitwiseXNOR(TEMP[0:7]);\n            CF  =  0;\n            OF  =  0;\n            (*AF is Undefined*)\n\n        :param cpu: current CPU.\n        :param src1: first operand.\n        :param src2: second operand.\n        \"\"\"\n        # Defined Flags: szp\n        arg_3 = arg_1.read() & arg_2.read()\n        arg_0.SF = (arg_3 & (1 << (arg_1.size - 1))) != 0\n        arg_0.ZF = arg_3 == 0\n        arg_0.PF = arg_0._calculate_parity_flag(arg_3)\n        arg_0.CF = False\n        arg_0.OF = False", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.TEST", "docstring": "Logical compare.\n\n        Computes the bit-wise logical AND of first operand (source 1 operand)\n        and the second operand (source 2 operand) and sets the SF, ZF, and PF\n        status flags according to the result. The result is then discarded::\n\n            TEMP  =  SRC1 AND SRC2;\n            SF  =  MSB(TEMP);\n            IF TEMP  =  0\n            THEN ZF  =  1;\n            ELSE ZF  =  0;\n            FI:\n            PF  =  BitwiseXNOR(TEMP[0:7]);\n            CF  =  0;\n            OF  =  0;\n            (*AF is Undefined*)\n\n        :param cpu: current CPU.\n        :param src1: first operand.\n        :param src2: second operand.", "docstring_tokens": ["Logical", "compare", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254119}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/utils.py#L193-L231", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Processes a level of segmentation, and converts it into times.", "language": "python", "parameters": "(est_idxs, est_labels, N, frame_times, dur)", "return_statement": "return est_times, est_labels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "assert", "arg_0", "[", "0", "]", "==", "0", "and", "arg_0", "[", "-", "1", "]", "==", "arg_2", "-", "1", "assert", "len", "(", "arg_0", ")", "-", "1", "==", "len", "(", "arg_1", ")", "arg_5", "=", "np", ".", "concatenate", "(", "(", "[", "0", "]", ",", "arg_3", "[", "arg_0", "]", ",", "[", "arg_4", "]", ")", ")", "arg_6", "=", "np", ".", "max", "(", "arg_1", ")", "+", "1", "arg_1", "=", "np", ".", "concatenate", "(", "(", "[", "arg_6", "]", ",", "arg_1", ",", "[", "arg_6", "]", ")", ")", "arg_5", ",", "arg_1", "=", "remove_empty_segments", "(", "arg_5", ",", "arg_1", ")", "assert", "np", ".", "allclose", "(", "[", "arg_5", "[", "0", "]", "]", ",", "[", "0", "]", ")", "and", "np", ".", "allclose", "(", "[", "arg_5", "[", "-", "1", "]", "]", ",", "[", "arg_4", "]", ")", "return", "arg_5", ",", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Processes a level of segmentation, and converts it into times.\n\n    Parameters\n    ----------\n    est_idxs: np.array\n        Estimated boundaries in frame indeces.\n    est_labels: np.array\n        Estimated labels.\n    N: int\n        Number of frames in the whole track.\n    frame_times: np.array\n        Time stamp for each frame.\n    dur: float\n        Duration of the audio track.\n\n    Returns\n    -------\n    est_times: np.array\n        Estimated segment boundaries in seconds.\n    est_labels: np.array\n        Estimated labels for each segment.\n    \"\"\"\n    assert arg_0[0] == 0 and arg_0[-1] == arg_2 - 1\n    assert len(arg_0) - 1 == len(arg_1)\n\n    # Add silences, if needed\n    arg_5 = np.concatenate(([0], arg_3[arg_0], [arg_4]))\n    arg_6 = np.max(arg_1) + 1\n    arg_1 = np.concatenate(([arg_6], arg_1, [arg_6]))\n\n    # Remove empty segments if needed\n    arg_5, arg_1 = remove_empty_segments(arg_5, arg_1)\n\n    # Make sure that the first and last times are 0 and duration, respectively\n    assert np.allclose([arg_5[0]], [0]) and \\\n        np.allclose([arg_5[-1]], [arg_4])\n\n    return arg_5, arg_1", "path": "msaf/utils.py", "identifier": "process_segmentation_level", "docstring": "Processes a level of segmentation, and converts it into times.\n\n    Parameters\n    ----------\n    est_idxs: np.array\n        Estimated boundaries in frame indeces.\n    est_labels: np.array\n        Estimated labels.\n    N: int\n        Number of frames in the whole track.\n    frame_times: np.array\n        Time stamp for each frame.\n    dur: float\n        Duration of the audio track.\n\n    Returns\n    -------\n    est_times: np.array\n        Estimated segment boundaries in seconds.\n    est_labels: np.array\n        Estimated labels for each segment.", "docstring_tokens": ["Processes", "a", "level", "of", "segmentation", "and", "converts", "it", "into", "times", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 254120}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L88-L92", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Return a Droplet by its ID.", "language": "python", "parameters": "(self, droplet_id)", "return_statement": "return Droplet.get_object(api_token=self.token, droplet_id=droplet_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Droplet", ".", "get_object", "(", "api_token", "=", "arg_0", ".", "token", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Return a Droplet by its ID.\n        \"\"\"\n        return Droplet.get_object(api_token=arg_0.token, arg_1=arg_1)", "path": "digitalocean/Manager.py", "identifier": "Manager.get_droplet", "docstring": "Return a Droplet by its ID.", "docstring_tokens": ["Return", "a", "Droplet", "by", "its", "ID", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 254121}
{"url": "https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L697-L717", "sha": "b45395b1aba41301b898040acade7010e6878a08", "docstring_summary": "Decorator. Abortable worker. If wrapped task will be cancelled by\n    dispatcher, decorator will send ftp codes of successful interrupt.", "language": "python", "parameters": "(f)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "async", "def", "wrapper", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "await", "arg_0", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "asyncio", ".", "CancelledError", ":", "arg_2", ".", "response", "(", "\"426\"", ",", "\"transfer aborted\"", ")", "arg_2", ".", "response", "(", "\"226\"", ",", "\"abort successful\"", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator. Abortable Func. If wrapped task will be cancelled by\n    dispatcher, decorator will send ftp codes of successful interrupt.\n\n    ::\n\n        >>> @Func\n        ... async def Func(self, connection, rest):\n        ...     ...\n\n    \"\"\"\n    @functools.wraps(arg_0)\n    async def wrapper(arg_1, arg_2, arg_3):\n        try:\n            await arg_0(arg_1, arg_2, arg_3)\n        except asyncio.CancelledError:\n            arg_2.response(\"426\", \"transfer aborted\")\n            arg_2.response(\"226\", \"abort successful\")\n\n    return wrapper", "path": "aioftp/server.py", "identifier": "worker", "docstring": "Decorator. Abortable worker. If wrapped task will be cancelled by\n    dispatcher, decorator will send ftp codes of successful interrupt.\n\n    ::\n\n        >>> @worker\n        ... async def worker(self, connection, rest):\n        ...     ...", "docstring_tokens": ["Decorator", ".", "Abortable", "worker", ".", "If", "wrapped", "task", "will", "be", "cancelled", "by", "dispatcher", "decorator", "will", "send", "ftp", "codes", "of", "successful", "interrupt", "."], "nwo": "aio-libs/aioftp", "score": 0.5742192901431463, "idx": 254122}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/distributed.py#L187-L206", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "A helper function to compute validation related metrics", "language": "python", "parameters": "(self)", "return_statement": "return zip(self._validation_metrics, metric_sums)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "(", "arg_0", ".", "_validation_iterator", "is", "None", ")", "or", "(", "arg_0", ".", "_Func", "is", "None", ")", ":", "raise", "AttributeError", "(", "'Validation is not setup.'", ")", "arg_1", "=", "0.0", "arg_2", "=", "[", "0.0", "]", "*", "len", "(", "arg_0", ".", "_Func", ")", "arg_0", ".", "_sess", ".", "run", "(", "arg_0", ".", "_validation_iterator", ".", "initializer", ")", "while", "True", ":", "try", ":", "arg_3", "=", "arg_0", ".", "_sess", ".", "run", "(", "arg_0", ".", "_Func", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_3", ")", ":", "arg_2", "[", "arg_4", "]", "+=", "arg_5", "arg_1", "+=", "1.0", "except", "tf", ".", "errors", ".", "OutOfRangeError", ":", "break", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_2", ")", ":", "arg_2", "[", "arg_4", "]", "=", "arg_2", "[", "arg_4", "]", "/", "arg_1", "return", "zip", "(", "arg_0", ".", "_Func", ",", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"A helper function to compute validation related metrics\"\"\"\n\n        if (arg_0._validation_iterator is None) or (arg_0._Func is None):\n            raise AttributeError('Validation is not setup.')\n\n        arg_1 = 0.0\n        arg_2 = [0.0] * len(arg_0._Func)\n        arg_0._sess.run(arg_0._validation_iterator.initializer)\n        while True:\n            try:\n                arg_3 = arg_0._sess.run(arg_0._Func)\n                for arg_4, arg_5 in enumerate(arg_3):\n                    arg_2[arg_4] += arg_5\n                arg_1 += 1.0\n            except tf.errors.OutOfRangeError:\n                break\n        for arg_4, arg_5 in enumerate(arg_2):\n            arg_2[arg_4] = arg_2[arg_4] / arg_1\n        return zip(arg_0._Func, arg_2)", "path": "tensorlayer/distributed.py", "identifier": "Trainer.validation_metrics", "docstring": "A helper function to compute validation related metrics", "docstring_tokens": ["A", "helper", "function", "to", "compute", "validation", "related", "metrics"], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 254123}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/email.py#L36-L50", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Send email using backend specified in EMAIL_BACKEND.", "language": "python", "parameters": "(to, subject, html_content,\n               files=None, dryrun=False, cc=None, bcc=None,\n               mime_subtype='mixed', mime_charset='utf-8', **kwargs)", "return_statement": "return backend(to, subject, html_content, files=files,\n                   dryrun=dryrun, cc=cc, bcc=bcc,\n                   mime_subtype=mime_subtype, mime_charset=mime_charset, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "'mixed'", ",", "arg_8", "=", "'utf-8'", ",", "**", "arg_9", ")", ":", "arg_10", ",", "arg_11", "=", "configuration", ".", "conf", ".", "get", "(", "'email'", ",", "'EMAIL_BACKEND'", ")", ".", "rsplit", "(", "'.'", ",", "1", ")", "arg_12", "=", "importlib", ".", "import_module", "(", "arg_10", ")", "arg_13", "=", "getattr", "(", "arg_12", ",", "arg_11", ")", "arg_0", "=", "get_email_address_list", "(", "arg_0", ")", "arg_0", "=", "\", \"", ".", "join", "(", "arg_0", ")", "return", "arg_13", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "**", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n               arg_3=None, arg_4=False, arg_5=None, arg_6=None,\n               arg_7='mixed', arg_8='utf-8', **arg_9):\n    \"\"\"\n    Send email using backend specified in EMAIL_BACKEND.\n    \"\"\"\n    arg_10, arg_11 = configuration.conf.get('email', 'EMAIL_BACKEND').rsplit('.', 1)\n    arg_12 = importlib.import_module(arg_10)\n    arg_13 = getattr(arg_12, arg_11)\n    arg_0 = get_email_address_list(arg_0)\n    arg_0 = \", \".join(arg_0)\n\n    return arg_13(arg_0, arg_1, arg_2, arg_3=arg_3,\n                   arg_4=arg_4, arg_5=arg_5, arg_6=arg_6,\n                   arg_7=arg_7, arg_8=arg_8, **arg_9)", "path": "airflow/utils/email.py", "identifier": "send_email", "docstring": "Send email using backend specified in EMAIL_BACKEND.", "docstring_tokens": ["Send", "email", "using", "backend", "specified", "in", "EMAIL_BACKEND", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254124}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/xsrfutil.py#L33-L57", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Generates a URL-safe token for the given user, action, time tuple.", "language": "python", "parameters": "(key, user_id, action_id='', when=None)", "return_statement": "return token", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "hmac", ".", "new", "(", "_helpers", ".", "_to_bytes", "(", "arg_0", ",", "encoding", "=", "'utf-8'", ")", ")", "arg_4", ".", "update", "(", "_helpers", ".", "_to_bytes", "(", "str", "(", "arg_1", ")", ",", "encoding", "=", "'utf-8'", ")", ")", "arg_4", ".", "update", "(", "DELIMITER", ")", "arg_4", ".", "update", "(", "_helpers", ".", "_to_bytes", "(", "arg_2", ",", "encoding", "=", "'utf-8'", ")", ")", "arg_4", ".", "update", "(", "DELIMITER", ")", "arg_3", "=", "_helpers", ".", "_to_bytes", "(", "str", "(", "arg_3", "or", "int", "(", "time", ".", "time", "(", ")", ")", ")", ",", "encoding", "=", "'utf-8'", ")", "arg_4", ".", "update", "(", "arg_3", ")", "arg_5", "=", "arg_4", ".", "digest", "(", ")", "arg_6", "=", "base64", ".", "urlsafe_b64encode", "(", "arg_5", "+", "DELIMITER", "+", "arg_3", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2='', arg_3=None):\n    \"\"\"Generates a URL-safe token for the given user, action, time tuple.\n\n    Args:\n        key: secret key to use.\n        user_id: the user ID of the authenticated user.\n        action_id: a string identifier of the action they requested\n                   authorization for.\n        when: the time in seconds since the epoch at which the user was\n              authorized for this action. If not set the current time is used.\n\n    Returns:\n        A string XSRF protection token.\n    \"\"\"\n    arg_4 = hmac.new(_helpers._to_bytes(arg_0, encoding='utf-8'))\n    arg_4.update(_helpers._to_bytes(str(arg_1), encoding='utf-8'))\n    arg_4.update(DELIMITER)\n    arg_4.update(_helpers._to_bytes(arg_2, encoding='utf-8'))\n    arg_4.update(DELIMITER)\n    arg_3 = _helpers._to_bytes(str(arg_3 or int(time.time())), encoding='utf-8')\n    arg_4.update(arg_3)\n    arg_5 = arg_4.digest()\n\n    arg_6 = base64.urlsafe_b64encode(arg_5 + DELIMITER + arg_3)\n    return arg_6", "path": "oauth2client/contrib/xsrfutil.py", "identifier": "generate_token", "docstring": "Generates a URL-safe token for the given user, action, time tuple.\n\n    Args:\n        key: secret key to use.\n        user_id: the user ID of the authenticated user.\n        action_id: a string identifier of the action they requested\n                   authorization for.\n        when: the time in seconds since the epoch at which the user was\n              authorized for this action. If not set the current time is used.\n\n    Returns:\n        A string XSRF protection token.", "docstring_tokens": ["Generates", "a", "URL", "-", "safe", "token", "for", "the", "given", "user", "action", "time", "tuple", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 254125}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L188-L203", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Write data to the log file, if active", "language": "python", "parameters": "(self, data, kind='input')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'input'", ")", ":", "if", "arg_0", ".", "log_active", "and", "arg_1", ":", "arg_3", "=", "arg_0", ".", "logfile", ".", "write", "if", "arg_2", "==", "'input'", ":", "if", "arg_0", ".", "timestamp", ":", "arg_3", "(", "str_to_unicode", "(", "time", ".", "strftime", "(", "'# %a, %d %b %Y %H:%M:%S\\n'", ",", "time", ".", "localtime", "(", ")", ")", ")", ")", "arg_3", "(", "arg_1", ")", "elif", "arg_2", "==", "'output'", "and", "arg_0", ".", "log_output", ":", "arg_4", "=", "u'\\n'", ".", "join", "(", "[", "u'#[Out]# %s'", "%", "s", "for", "s", "in", "arg_1", ".", "splitlines", "(", ")", "]", ")", "arg_3", "(", "u'%s\\n'", "%", "arg_4", ")", "arg_0", ".", "logfile", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2='input'):\n        \"\"\"Write data to the log file, if active\"\"\"\n\n        #print 'data: %r' % data # dbg\n        if arg_0.log_active and arg_1:\n            arg_3 = arg_0.logfile.write\n            if arg_2=='input':\n                if arg_0.timestamp:\n                    arg_3(str_to_unicode(time.strftime('# %a, %d %b %Y %H:%M:%S\\n',\n                                        time.localtime())))\n                arg_3(arg_1)\n            elif arg_2=='output' and arg_0.log_output:\n                arg_4 = u'\\n'.join([u'#[Out]# %s' % s\n                                   for s in arg_1.splitlines()])\n                arg_3(u'%s\\n' % arg_4)\n            arg_0.logfile.flush()", "path": "environment/lib/python2.7/site-packages/IPython/core/logger.py", "identifier": "Logger.log_write", "docstring": "Write data to the log file, if active", "docstring_tokens": ["Write", "data", "to", "the", "log", "file", "if", "active"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254126}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/bin/__init__.py#L80-L107", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Parses arguments for the command.", "language": "python", "parameters": "(self, argv=None)", "return_statement": "return arguments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "vars", "(", "arg_0", ".", "create_argument_parser", "(", ")", ".", "parse_args", "(", "arg_1", ")", ")", "arg_3", "=", "None", "if", "arg_0", ".", "requires_seed", ":", "arg_4", "=", "arg_2", ".", "pop", "(", "'seed_file'", ")", "arg_3", "=", "(", "arg_0", ".", "seed_from_filepath", "(", "arg_4", ")", "if", "arg_4", "else", "arg_0", ".", "prompt_for_seed", "(", ")", ")", "arg_2", "[", "'api'", "]", "=", "Iota", "(", "adapter", "=", "arg_2", ".", "pop", "(", "'uri'", ")", ",", "arg_3", "=", "arg_3", ",", "testnet", "=", "arg_2", ".", "pop", "(", "'testnet'", ")", ",", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        # type: (Optional[tuple]) -> dict\n        \"\"\"\n        Parses arguments for the command.\n\n        :param argv:\n            Arguments to pass to the argument parser.\n            If ``None``, defaults to ``sys.argv[1:]``.\n        \"\"\"\n        arg_2 = vars(arg_0.create_argument_parser().parse_args(arg_1))\n\n        arg_3 = None\n        if arg_0.requires_seed:\n            arg_4 = arg_2.pop('seed_file')\n\n            arg_3 = (\n                arg_0.seed_from_filepath(arg_4)\n                if arg_4\n                else arg_0.prompt_for_seed()\n            )\n\n        arg_2['api'] = Iota(\n            adapter=arg_2.pop('uri'),\n            arg_3=arg_3,\n            testnet=arg_2.pop('testnet'),\n        )\n\n        return arg_2", "path": "iota/bin/__init__.py", "identifier": "IotaCommandLineApp.parse_argv", "docstring": "Parses arguments for the command.\n\n        :param argv:\n            Arguments to pass to the argument parser.\n            If ``None``, defaults to ``sys.argv[1:]``.", "docstring_tokens": ["Parses", "arguments", "for", "the", "command", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 254127}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L858-L933", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Run Gene Set Enrichment Analysis.", "language": "python", "parameters": "(data, gene_sets, cls, outdir='GSEA_', min_size=15, max_size=500, permutation_num=1000,\n          weighted_score_type=1,permutation_type='gene_set', method='log2_ratio_of_classes',\n\t      ascending=False, processes=1, figsize=(6.5,6), format='pdf',\n          graph_num=20, no_plot=False, seed=None, verbose=False)", "return_statement": "return gs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'GSEA_'", ",", "arg_4", "=", "15", ",", "arg_5", "=", "500", ",", "arg_6", "=", "1000", ",", "arg_7", "=", "1", ",", "arg_8", "=", "'gene_set'", ",", "arg_9", "=", "'log2_ratio_of_classes'", ",", "arg_10", "=", "False", ",", "arg_11", "=", "1", ",", "arg_12", "=", "(", "6.5", ",", "6", ")", ",", "arg_13", "=", "'pdf'", ",", "arg_14", "=", "20", ",", "arg_15", "=", "False", ",", "arg_16", "=", "None", ",", "arg_17", "=", "False", ")", ":", "arg_18", "=", "GSEA", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", ",", "arg_16", ",", "arg_17", ")", "arg_18", ".", "run", "(", ")", "return", "arg_18"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='GSEA_', arg_4=15, arg_5=500, arg_6=1000,\n          arg_7=1,arg_8='gene_set', arg_9='log2_ratio_of_classes',\n\t      arg_10=False, arg_11=1, arg_12=(6.5,6), arg_13='pdf',\n          arg_14=20, arg_15=False, arg_16=None, arg_17=False):\n    \"\"\" Run Gene Set Enrichment Analysis.\n\n    :param data: Gene expression data table, Pandas DataFrame, gct file.\n    :param gene_sets: Enrichr Library name or .gmt gene sets file or dict of gene sets. Same input with GSEA.\n    :param cls: A list or a .cls file format required for GSEA.\n    :param str outdir: Results output directory.\n    :param int permutation_num: Number of permutations for significance computation. Default: 1000.\n    :param str permutation_type: Permutation type, \"phenotype\" for phenotypes, \"gene_set\" for genes.\n    :param int min_size: Minimum allowed number of genes from gene set also the data set. Default: 15.\n    :param int max_size: Maximum allowed number of genes from gene set also the data set. Default: 500.\n    :param float weighted_score_type: Refer to :func:`algorithm.enrichment_score`. Default:1.\n    :param method:  The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'.\n                   Others methods are:\n\n                   1. 'signal_to_noise'\n\n                      You must have at least three samples for each phenotype to use this metric.\n                      The larger the signal-to-noise ratio, the larger the differences of the means (scaled by the standard deviations);\n                      that is, the more distinct the gene expression is in each phenotype and the more the gene acts as a \u201cclass marker.\u201d\n\n                   2. 't_test'\n\n                      Uses the difference of means scaled by the standard deviation and number of samples.\n                      Note: You must have at least three samples for each phenotype to use this metric.\n                      The larger the tTest ratio, the more distinct the gene expression is in each phenotype\n                      and the more the gene acts as a \u201cclass marker.\u201d\n\n                   3. 'ratio_of_classes' (also referred to as fold change).\n\n                      Uses the ratio of class means to calculate fold change for natural scale data.\n\n                   4. 'diff_of_classes'\n\n\n                      Uses the difference of class means to calculate fold change for nature scale data\n\n\n                   5. 'log2_ratio_of_classes'\n\n                      Uses the log2 ratio of class means to calculate fold change for natural scale data.\n                      This is the recommended statistic for calculating fold change for log scale data.\n\n\n    :param bool ascending: Sorting order of rankings. Default: False.\n    :param int processes: Number of Processes you are going to use. Default: 1.\n    :param list figsize: Matplotlib figsize, accept a tuple or list, e.g. [width,height]. Default: [6.5,6].\n    :param str format: Matplotlib figure format. Default: 'pdf'.\n    :param int graph_num: Plot graphs for top sets of each phenotype.\n    :param bool no_plot: If equals to True, no figure will be drawn. Default: False.\n    :param seed: Random seed. expect an integer. Default:None.\n    :param bool verbose: Bool, increase output verbosity, print out progress of your job, Default: False.\n\n    :return: Return a GSEA obj. All results store to a dictionary, obj.results,\n             where contains::\n\n                 | {es: enrichment score,\n                 |  nes: normalized enrichment score,\n                 |  p: P-value,\n                 |  fdr: FDR,\n                 |  size: gene set size,\n                 |  matched_size: genes matched to the data,\n                 |  genes: gene names from the data set\n                 |  ledge_genes: leading edge genes}\n\n\n    \"\"\"\n    arg_18 = GSEA(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6,\n              arg_7, arg_8, arg_9, arg_10, arg_11,\n               arg_12, arg_13, arg_14, arg_15, arg_16, arg_17)\n    arg_18.run()\n\n    return arg_18", "path": "gseapy/gsea.py", "identifier": "gsea", "docstring": "Run Gene Set Enrichment Analysis.\n\n    :param data: Gene expression data table, Pandas DataFrame, gct file.\n    :param gene_sets: Enrichr Library name or .gmt gene sets file or dict of gene sets. Same input with GSEA.\n    :param cls: A list or a .cls file format required for GSEA.\n    :param str outdir: Results output directory.\n    :param int permutation_num: Number of permutations for significance computation. Default: 1000.\n    :param str permutation_type: Permutation type, \"phenotype\" for phenotypes, \"gene_set\" for genes.\n    :param int min_size: Minimum allowed number of genes from gene set also the data set. Default: 15.\n    :param int max_size: Maximum allowed number of genes from gene set also the data set. Default: 500.\n    :param float weighted_score_type: Refer to :func:`algorithm.enrichment_score`. Default:1.\n    :param method:  The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'.\n                   Others methods are:\n\n                   1. 'signal_to_noise'\n\n                      You must have at least three samples for each phenotype to use this metric.\n                      The larger the signal-to-noise ratio, the larger the differences of the means (scaled by the standard deviations);\n                      that is, the more distinct the gene expression is in each phenotype and the more the gene acts as a \u201cclass marker.\u201d\n\n                   2. 't_test'\n\n                      Uses the difference of means scaled by the standard deviation and number of samples.\n                      Note: You must have at least three samples for each phenotype to use this metric.\n                      The larger the tTest ratio, the more distinct the gene expression is in each phenotype\n                      and the more the gene acts as a \u201cclass marker.\u201d\n\n                   3. 'ratio_of_classes' (also referred to as fold change).\n\n                      Uses the ratio of class means to calculate fold change for natural scale data.\n\n                   4. 'diff_of_classes'\n\n\n                      Uses the difference of class means to calculate fold change for nature scale data\n\n\n                   5. 'log2_ratio_of_classes'\n\n                      Uses the log2 ratio of class means to calculate fold change for natural scale data.\n                      This is the recommended statistic for calculating fold change for log scale data.\n\n\n    :param bool ascending: Sorting order of rankings. Default: False.\n    :param int processes: Number of Processes you are going to use. Default: 1.\n    :param list figsize: Matplotlib figsize, accept a tuple or list, e.g. [width,height]. Default: [6.5,6].\n    :param str format: Matplotlib figure format. Default: 'pdf'.\n    :param int graph_num: Plot graphs for top sets of each phenotype.\n    :param bool no_plot: If equals to True, no figure will be drawn. Default: False.\n    :param seed: Random seed. expect an integer. Default:None.\n    :param bool verbose: Bool, increase output verbosity, print out progress of your job, Default: False.\n\n    :return: Return a GSEA obj. All results store to a dictionary, obj.results,\n             where contains::\n\n                 | {es: enrichment score,\n                 |  nes: normalized enrichment score,\n                 |  p: P-value,\n                 |  fdr: FDR,\n                 |  size: gene set size,\n                 |  matched_size: genes matched to the data,\n                 |  genes: gene names from the data set\n                 |  ledge_genes: leading edge genes}", "docstring_tokens": ["Run", "Gene", "Set", "Enrichment", "Analysis", "."], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 254128}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/demo.py#L395-L411", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Show entire demo on screen, block by block", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "title", "arg_2", "=", "arg_0", ".", "title", "arg_3", "=", "arg_0", ".", "nblocks", "arg_4", "=", "arg_0", ".", "_silent", "arg_5", "=", "arg_0", ".", "marquee", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_0", ".", "src_blocks_colored", ")", ":", "if", "arg_4", "[", "arg_6", "]", ":", "print", ">>", "io", ".", "stdout", ",", "arg_5", "(", "'<%s> SILENT block # %s (%s remaining)'", "%", "(", "arg_2", ",", "arg_6", ",", "arg_3", "-", "arg_6", "-", "1", ")", ")", "else", ":", "print", ">>", "io", ".", "stdout", ",", "arg_5", "(", "'<%s> block # %s (%s remaining)'", "%", "(", "arg_2", ",", "arg_6", ",", "arg_3", "-", "arg_6", "-", "1", ")", ")", "print", ">>", "io", ".", "stdout", ",", "arg_7", ",", "sys", ".", "stdout", ".", "flush", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Show entire demo on screen, block by block\"\"\"\n\n        arg_1 = arg_0.title\n        arg_2 = arg_0.title\n        arg_3 = arg_0.nblocks\n        arg_4 = arg_0._silent\n        arg_5 = arg_0.marquee\n        for arg_6,arg_7 in enumerate(arg_0.src_blocks_colored):\n            if arg_4[arg_6]:\n                print >>io.stdout, arg_5('<%s> SILENT block # %s (%s remaining)' %\n                              (arg_2,arg_6,arg_3-arg_6-1))\n            else:\n                print >>io.stdout, arg_5('<%s> block # %s (%s remaining)' %\n                              (arg_2,arg_6,arg_3-arg_6-1))\n            print >>io.stdout, arg_7,\n        sys.stdout.flush()", "path": "environment/lib/python2.7/site-packages/IPython/lib/demo.py", "identifier": "Demo.show_all", "docstring": "Show entire demo on screen, block by block", "docstring_tokens": ["Show", "entire", "demo", "on", "screen", "block", "by", "block"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254129}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfobjects/pdfcursor.py#L112-L118", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Comparison for x coordinate", "language": "python", "parameters": "(self, test_ordinate)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_is_coordinate", "(", "arg_1", ")", "if", "arg_0", ".", "x", ">", "arg_1", ".", "x", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\" Comparison for x coordinate\"\"\"\r\n        arg_0._is_coordinate(arg_1)\r\n        if arg_0.x > arg_1.x:\r\n            return True\r\n        else:\r\n            return False", "path": "pypdflite/pdfobjects/pdfcursor.py", "identifier": "PDFCursor.x_is_greater_than", "docstring": "Comparison for x coordinate", "docstring_tokens": ["Comparison", "for", "x", "coordinate"], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 254130}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/packet.py#L430-L442", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Get 6D data with euler rotations.", "language": "python", "parameters": "(self, component_info=None, data=None, component_position=None)", "return_statement": "return components", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "arg_4", ".", "append", "for", "arg_6", "in", "range", "(", "arg_1", ".", "body_count", ")", ":", "arg_3", ",", "arg_7", "=", "QRTPacket", ".", "_get_exact", "(", "RT6DBodyPosition", ",", "arg_2", ",", "arg_3", ")", "arg_3", ",", "arg_8", "=", "QRTPacket", ".", "_get_exact", "(", "RT6DBodyEuler", ",", "arg_2", ",", "arg_3", ")", "arg_5", "(", "(", "arg_7", ",", "arg_8", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Get 6D data with euler rotations.\"\"\"\n        arg_4 = []\n        arg_5 = arg_4.append\n        for arg_6 in range(arg_1.body_count):\n            arg_3, arg_7 = QRTPacket._get_exact(\n                RT6DBodyPosition, arg_2, arg_3\n            )\n            arg_3, arg_8 = QRTPacket._get_exact(\n                RT6DBodyEuler, arg_2, arg_3\n            )\n            arg_5((arg_7, arg_8))\n        return arg_4", "path": "qtm/packet.py", "identifier": "QRTPacket.get_6d_euler", "docstring": "Get 6D data with euler rotations.", "docstring_tokens": ["Get", "6D", "data", "with", "euler", "rotations", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 254131}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pkginfo/utils.py#L10-L57", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Try to create a Distribution 'path_or_module'.\n    \n    o 'path_or_module' may be a module object.", "language": "python", "parameters": "(path_or_module, metadata_version=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "ModuleType", ")", ":", "try", ":", "return", "Installed", "(", "arg_0", ",", "arg_1", ")", "except", "(", "ValueError", ",", "IOError", ")", ":", "pass", "try", ":", "__import__", "(", "arg_0", ")", "except", "ImportError", ":", "pass", "else", ":", "try", ":", "return", "Installed", "(", "arg_0", ",", "arg_1", ")", "except", "(", "ValueError", ",", "IOError", ")", ":", "pass", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "try", ":", "return", "SDist", "(", "arg_0", ",", "arg_1", ")", "except", "(", "ValueError", ",", "IOError", ")", ":", "pass", "try", ":", "return", "BDist", "(", "arg_0", ",", "arg_1", ")", "except", "(", "ValueError", ",", "IOError", ")", ":", "pass", "try", ":", "return", "Wheel", "(", "arg_0", ",", "arg_1", ")", "except", "(", "ValueError", ",", "IOError", ")", ":", "pass", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "try", ":", "return", "Develop", "(", "arg_0", ",", "arg_1", ")", "except", "(", "ValueError", ",", "IOError", ")", ":", "pass"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Try to create a Distribution 'path_or_module'.\n    \n    o 'path_or_module' may be a module object.\n\n    o If a string, 'path_or_module' may point to an sdist file, a bdist\n      file, an installed package, or a working checkout (if it contains\n      PKG-INFO).\n    \n    o Return None if 'path_or_module' can't be parsed.\n    \"\"\"\n    if isinstance(arg_0, ModuleType):\n        try:\n            return Installed(arg_0, arg_1)\n        except (ValueError, IOError): #pragma NO COVER\n            pass\n\n    try:\n        __import__(arg_0)\n    except ImportError:\n        pass\n    else:\n        try:\n            return Installed(arg_0, arg_1)\n        except (ValueError, IOError): #pragma NO COVER\n            pass\n\n    if os.path.isfile(arg_0):\n        try:\n            return SDist(arg_0, arg_1)\n        except (ValueError, IOError):\n            pass\n\n        try:\n            return BDist(arg_0, arg_1)\n        except (ValueError, IOError): #pragma NO COVER\n            pass\n\n        try:\n            return Wheel(arg_0, arg_1)\n        except (ValueError, IOError): #pragma NO COVER\n            pass\n\n    if os.path.isdir(arg_0):\n        try:\n            return Develop(arg_0, arg_1)\n        except (ValueError, IOError): #pragma NO COVER\n            pass", "path": "virtualEnvironment/lib/python2.7/site-packages/pkginfo/utils.py", "identifier": "get_metadata", "docstring": "Try to create a Distribution 'path_or_module'.\n    \n    o 'path_or_module' may be a module object.\n\n    o If a string, 'path_or_module' may point to an sdist file, a bdist\n      file, an installed package, or a working checkout (if it contains\n      PKG-INFO).\n    \n    o Return None if 'path_or_module' can't be parsed.", "docstring_tokens": ["Try", "to", "create", "a", "Distribution", "path_or_module", ".", "o", "path_or_module", "may", "be", "a", "module", "object", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 254132}
{"url": "https://github.com/incuna/django-pgcrypto-fields/blob/406fddf0cbe9091ba71b97206d0f4719c0450ac1/pgcrypto/mixins.py#L106-L117", "sha": "406fddf0cbe9091ba71b97206d0f4719c0450ac1", "docstring_summary": "Get the decryption for col.", "language": "python", "parameters": "(self, alias, output_field=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", "if", "arg_1", "!=", "arg_0", ".", "model", ".", "_meta", ".", "db_table", "or", "arg_2", "!=", "arg_0", ":", "return", "DecryptedCol", "(", "arg_1", ",", "arg_0", ",", "arg_2", ")", "else", ":", "return", "arg_0", ".", "cached_col"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Get the decryption for col.\"\"\"\n        if arg_2 is None:\n            arg_2 = arg_0\n        if arg_1 != arg_0.model._meta.db_table or arg_2 != arg_0:\n            return DecryptedCol(\n                arg_1,\n                arg_0,\n                arg_2\n            )\n        else:\n            return arg_0.cached_col", "path": "pgcrypto/mixins.py", "identifier": "PGPMixin.get_col", "docstring": "Get the decryption for col.", "docstring_tokens": ["Get", "the", "decryption", "for", "col", "."], "nwo": "incuna/django-pgcrypto-fields", "score": 0.4638707833759358, "idx": 254133}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L48-L56", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Check HTTP reponse for known errors", "language": "python", "parameters": "(self, uri, response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ".", "status", "==", "401", ":", "raise", "trolly", ".", "Unauthorised", "(", "arg_1", ",", "arg_2", ")", "if", "arg_2", ".", "status", "!=", "200", ":", "raise", "trolly", ".", "ResourceUnavailable", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Check HTTP reponse for known errors\n        '''\n        if arg_2.status == 401:\n            raise trolly.Unauthorised(arg_1, arg_2)\n\n        if arg_2.status != 200:\n            raise trolly.ResourceUnavailable(arg_1, arg_2)", "path": "trolly/client.py", "identifier": "Client.check_errors", "docstring": "Check HTTP reponse for known errors", "docstring_tokens": ["Check", "HTTP", "reponse", "for", "known", "errors"], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 254134}
{"url": "https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/execute.py#L179-L199", "sha": "0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b", "docstring_summary": "Check self.data. Raise InvalidConfig on error", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "(", "arg_0", ".", "data", ".", "get", "(", "'content-type'", ")", "or", "arg_0", ".", "data", ".", "get", "(", "'body'", ")", ")", "and", "arg_0", ".", "data", ".", "get", "(", "'method'", ",", "''", ")", ".", "lower", "(", ")", "not", "in", "CONTENT_TYPE_METHODS", ":", "raise", "InvalidConfig", "(", "extra_body", "=", "'The body/content-type option only can be used with the {} methods. The device is {}. '", "'Check the configuration file.'", ".", "format", "(", "', '", ".", "join", "(", "CONTENT_TYPE_METHODS", ")", ",", "arg_0", ".", "name", ")", ")", "arg_0", ".", "data", "[", "'content-type'", "]", "=", "CONTENT_TYPE_ALIASES", ".", "get", "(", "arg_0", ".", "data", ".", "get", "(", "'content-type'", ")", ",", "arg_0", ".", "data", ".", "get", "(", "'content-type'", ")", ")", "arg_2", "=", "CONTENT_TYPE_ALIASES", "[", "'form'", "]", "if", "arg_0", ".", "data", ".", "get", "(", "'body'", ")", "and", "(", "arg_0", ".", "data", ".", "get", "(", "'content-type'", ")", "or", "arg_2", ")", "==", "arg_2", ":", "try", ":", "arg_0", ".", "data", "[", "'body'", "]", "=", "json", ".", "loads", "(", "arg_0", ".", "data", "[", "'body'", "]", ")", "except", "JSONDecodeError", ":", "raise", "InvalidConfig", "(", "extra_body", "=", "'Invalid JSON body on {} device.'", ".", "format", "(", "arg_0", ".", "name", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Check self.data. Raise InvalidConfig on error\n\n        :return: None\n        \"\"\"\n        if (arg_0.data.get('content-type') or arg_0.data.get('body')) and \\\n                arg_0.data.get('method', '').lower() not in CONTENT_TYPE_METHODS:\n            raise InvalidConfig(\n                extra_body='The body/content-type option only can be used with the {} methods. The device is {}. '\n                           'Check the configuration file.'.format(', '.join(CONTENT_TYPE_METHODS), arg_0.name)\n            )\n        arg_0.data['content-type'] = CONTENT_TYPE_ALIASES.get(arg_0.data.get('content-type'),\n                                                             arg_0.data.get('content-type'))\n        arg_2 = CONTENT_TYPE_ALIASES['form']\n        if arg_0.data.get('body') and (arg_0.data.get('content-type') or arg_2) == arg_2:\n            try:\n                arg_0.data['body'] = json.loads(arg_0.data['body'])\n            except JSONDecodeError:\n                raise InvalidConfig(\n                    extra_body='Invalid JSON body on {} device.'.format(arg_0.name)\n                )", "path": "amazon_dash/execute.py", "identifier": "ExecuteUrl.validate", "docstring": "Check self.data. Raise InvalidConfig on error\n\n        :return: None", "docstring_tokens": ["Check", "self", ".", "data", ".", "Raise", "InvalidConfig", "on", "error"], "nwo": "Nekmo/amazon-dash", "score": 0.758195400618659, "idx": 254135}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/__init__.py#L87-L115", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Updates the current configuration with the values in `conf_dict`.", "language": "python", "parameters": "(self, conf_dict, base_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", ".", "startswith", "(", "'_'", ")", ":", "continue", "arg_4", "=", "arg_1", "[", "arg_3", "]", "if", "arg_4", "is", "Namespace", ":", "continue", "if", "arg_2", ":", "arg_3", "=", "arg_2", "+", "'.'", "+", "arg_3", "if", "isinstance", "(", "arg_4", ",", "Namespace", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_4", ".", "iteritems", "(", "arg_3", ")", ":", "arg_0", ".", "set", "(", "arg_3", ",", "arg_4", ")", "elif", "callable", "(", "arg_4", ")", ":", "arg_4", "=", "arg_4", "(", ")", "if", "arg_4", "is", "not", "None", ":", "arg_0", ".", "set", "(", "arg_3", ",", "arg_4", ")", "else", ":", "arg_0", ".", "set", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\" Updates the current configuration with the values in `conf_dict`.\n\n            :param dict conf_dict: Dictionary of key value settings.\n            :param str base_name: Base namespace for setting keys.\n\n        \"\"\"\n        for arg_3 in arg_1:\n            # Skip private names\n            if arg_3.startswith('_'):\n                continue\n            arg_4 = arg_1[arg_3]\n            # Skip Namespace if it's imported\n            if arg_4 is Namespace:\n                continue\n            # Use a base namespace\n            if arg_2:\n                arg_3 = arg_2 + '.' + arg_3\n            if isinstance(arg_4, Namespace):\n                for arg_3, arg_4 in arg_4.iteritems(arg_3):\n                    arg_0.set(arg_3, arg_4)\n            # Automatically call any functions in the settings module, and if\n            # they return a value other than None, that value becomes a setting\n            elif callable(arg_4):\n                arg_4 = arg_4()\n                if arg_4 is not None:\n                    arg_0.set(arg_3, arg_4)\n            else:\n                arg_0.set(arg_3, arg_4)", "path": "pyconfig/__init__.py", "identifier": "Config._update", "docstring": "Updates the current configuration with the values in `conf_dict`.\n\n            :param dict conf_dict: Dictionary of key value settings.\n            :param str base_name: Base namespace for setting keys.", "docstring_tokens": ["Updates", "the", "current", "configuration", "with", "the", "values", "in", "conf_dict", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 254136}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/aws_athena_hook.py#L43-L51", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "check if aws conn exists already or create one and return it", "language": "python", "parameters": "(self)", "return_statement": "return self.conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "conn", ":", "arg_0", ".", "conn", "=", "arg_0", ".", "get_client_type", "(", "'athena'", ")", "return", "arg_0", ".", "conn"], "function": "def Func(arg_0):\n        \"\"\"\n        check if aws conn exists already or create one and return it\n\n        :return: boto3 session\n        \"\"\"\n        if not arg_0.conn:\n            arg_0.conn = arg_0.get_client_type('athena')\n        return arg_0.conn", "path": "airflow/contrib/hooks/aws_athena_hook.py", "identifier": "AWSAthenaHook.get_conn", "docstring": "check if aws conn exists already or create one and return it\n\n        :return: boto3 session", "docstring_tokens": ["check", "if", "aws", "conn", "exists", "already", "or", "create", "one", "and", "return", "it"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254137}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/utils.py#L17-L32", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Get the default local IP address.", "language": "python", "parameters": "()", "return_statement": "return ip", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_DGRAM", ")", "try", ":", "arg_0", ".", "connect", "(", "(", "'10.255.255.255'", ",", "1", ")", ")", "arg_1", "=", "arg_0", ".", "getsockname", "(", ")", "[", "0", "]", "except", "(", "socket", ".", "error", ",", "IndexError", ")", ":", "arg_1", "=", "'127.0.0.1'", "finally", ":", "arg_0", ".", "close", "(", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"\n    Get the default local IP address.\n\n    From: https://stackoverflow.com/a/28950776\n    \"\"\"\n    arg_0 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    try:\n        arg_0.connect(('10.255.255.255', 1))\n        arg_1 = arg_0.getsockname()[0]\n    except (socket.error, IndexError):\n        arg_1 = '127.0.0.1'\n    finally:\n        arg_0.close()\n\n    return arg_1", "path": "webthing/utils.py", "identifier": "get_ip", "docstring": "Get the default local IP address.\n\n    From: https://stackoverflow.com/a/28950776", "docstring_tokens": ["Get", "the", "default", "local", "IP", "address", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 254138}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L2058-L2064", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Completed human transaction", "language": "python", "parameters": "(self)", "return_statement": "return tuple(txs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "transactions", ":", "if", "arg_2", ".", "depth", "==", "0", ":", "arg_1", ".", "append", "(", "arg_2", ")", "return", "tuple", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Completed human transaction\"\"\"\n        arg_1 = []\n        for arg_2 in arg_0.transactions:\n            if arg_2.depth == 0:\n                arg_1.append(arg_2)\n        return tuple(arg_1)", "path": "manticore/platforms/evm.py", "identifier": "EVMWorld.human_transactions", "docstring": "Completed human transaction", "docstring_tokens": ["Completed", "human", "transaction"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254139}
{"url": "https://github.com/jonathanj/txspinneret/blob/717008a2c313698984a23e3f3fc62ea3675ed02d/txspinneret/util.py#L13-L24", "sha": "717008a2c313698984a23e3f3fc62ea3675ed02d", "docstring_summary": "Parse and sort an ``Accept`` header.", "language": "python", "parameters": "(headers)", "return_statement": "return OrderedDict(sorted(_splitHeaders(headers), key=sort, reverse=True))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "sort", "(", "arg_1", ")", ":", "return", "float", "(", "arg_1", "[", "1", "]", ".", "get", "(", "'q'", ",", "1", ")", ")", "return", "OrderedDict", "(", "sorted", "(", "_splitHeaders", "(", "arg_0", ")", ",", "key", "=", "sort", ",", "reverse", "=", "True", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse and sort an ``Accept`` header.\n\n    The header is sorted according to the ``q`` parameter for each header value.\n\n    @rtype: `OrderedDict` mapping `bytes` to `dict`\n    @return: Mapping of media types to header parameters.\n    \"\"\"\n    def sort(arg_1):\n        return float(arg_1[1].get('q', 1))\n    return OrderedDict(sorted(_splitHeaders(arg_0), key=sort, reverse=True))", "path": "txspinneret/util.py", "identifier": "_parseAccept", "docstring": "Parse and sort an ``Accept`` header.\n\n    The header is sorted according to the ``q`` parameter for each header value.\n\n    @rtype: `OrderedDict` mapping `bytes` to `dict`\n    @return: Mapping of media types to header parameters.", "docstring_tokens": ["Parse", "and", "sort", "an", "Accept", "header", "."], "nwo": "jonathanj/txspinneret", "score": 0.08529914490135834, "idx": 254140}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/scripts/perf/scheduler_ops_metrics.py#L65-L101", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Print operational metrics for the scheduler test.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "settings", ".", "Session", "(", ")", "arg_2", "=", "TaskInstance", "arg_3", "=", "(", "arg_1", ".", "query", "(", "arg_2", ")", ".", "filter", "(", "arg_2", ".", "dag_id", ".", "in_", "(", "DAG_IDS", ")", ")", ".", "all", "(", ")", ")", "arg_4", "=", "[", "x", "for", "x", "in", "arg_3", "if", "x", ".", "state", "==", "State", ".", "SUCCESS", "]", "arg_5", "=", "[", "(", "arg_8", ".", "dag_id", ",", "arg_8", ".", "task_id", ",", "arg_8", ".", "execution_date", ",", "(", "arg_8", ".", "queued_dttm", "-", "arg_0", ".", "start_date", ")", ".", "total_seconds", "(", ")", ",", "(", "arg_8", ".", "start_date", "-", "arg_0", ".", "start_date", ")", ".", "total_seconds", "(", ")", ",", "(", "arg_8", ".", "end_date", "-", "arg_0", ".", "start_date", ")", ".", "total_seconds", "(", ")", ",", "arg_8", ".", "duration", ")", "for", "arg_8", "in", "arg_4", "]", "arg_6", "=", "pd", ".", "DataFrame", "(", "arg_5", ",", "columns", "=", "[", "'dag_id'", ",", "'task_id'", ",", "'execution_date'", ",", "'queue_delay'", ",", "'start_delay'", ",", "'land_time'", ",", "'duration'", "]", ")", "print", "(", "'Performance Results'", ")", "print", "(", "'###################'", ")", "for", "arg_7", "in", "DAG_IDS", ":", "print", "(", "'DAG {}'", ".", "format", "(", "arg_7", ")", ")", "print", "(", "arg_6", "[", "arg_6", "[", "'dag_id'", "]", "==", "arg_7", "]", ")", "print", "(", "'###################'", ")", "if", "len", "(", "arg_3", ")", ">", "len", "(", "arg_4", ")", ":", "print", "(", "\"WARNING!! The following task instances haven't completed\"", ")", "print", "(", "pd", ".", "DataFrame", "(", "[", "(", "arg_8", ".", "dag_id", ",", "arg_8", ".", "task_id", ",", "arg_8", ".", "execution_date", ",", "arg_8", ".", "state", ")", "for", "arg_8", "in", "filter", "(", "lambda", "x", ":", "x", ".", "state", "!=", "State", ".", "SUCCESS", ",", "arg_3", ")", "]", ",", "columns", "=", "[", "'dag_id'", ",", "'task_id'", ",", "'execution_date'", ",", "'state'", "]", ")", ")", "arg_1", ".", "commit", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Print operational metrics for the scheduler test.\n        \"\"\"\n        arg_1 = settings.Session()\n        arg_2 = TaskInstance\n        arg_3 = (\n            arg_1\n            .query(arg_2)\n            .filter(arg_2.dag_id.in_(DAG_IDS))\n            .all()\n        )\n        arg_4 = [x for x in arg_3 if x.state == State.SUCCESS]\n        arg_5 = [(arg_8.dag_id, arg_8.task_id, arg_8.execution_date,\n                    (arg_8.queued_dttm - arg_0.start_date).total_seconds(),\n                    (arg_8.start_date - arg_0.start_date).total_seconds(),\n                    (arg_8.end_date - arg_0.start_date).total_seconds(),\n                    arg_8.duration) for arg_8 in arg_4]\n        arg_6 = pd.DataFrame(arg_5, columns=['dag_id', 'task_id',\n                                                    'execution_date',\n                                                    'queue_delay',\n                                                    'start_delay', 'land_time',\n                                                    'duration'])\n\n        print('Performance Results')\n        print('###################')\n        for arg_7 in DAG_IDS:\n            print('DAG {}'.format(arg_7))\n            print(arg_6[arg_6['dag_id'] == arg_7])\n        print('###################')\n        if len(arg_3) > len(arg_4):\n            print(\"WARNING!! The following task instances haven't completed\")\n            print(pd.DataFrame([(arg_8.dag_id, arg_8.task_id, arg_8.execution_date, arg_8.state)\n                  for arg_8 in filter(lambda x: x.state != State.SUCCESS, arg_3)],\n                  columns=['dag_id', 'task_id', 'execution_date', 'state']))\n\n        arg_1.commit()", "path": "scripts/perf/scheduler_ops_metrics.py", "identifier": "SchedulerMetricsJob.print_stats", "docstring": "Print operational metrics for the scheduler test.", "docstring_tokens": ["Print", "operational", "metrics", "for", "the", "scheduler", "test", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254141}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L314-L328", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val contains the given sequence of items in order.", "language": "python", "parameters": "(self, *items)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more args must be given'", ")", "else", ":", "try", ":", "for", "arg_2", "in", "xrange", "(", "len", "(", "arg_0", ".", "val", ")", "-", "len", "(", "arg_1", ")", "+", "1", ")", ":", "for", "arg_3", "in", "xrange", "(", "len", "(", "arg_1", ")", ")", ":", "if", "arg_0", ".", "val", "[", "arg_2", "+", "arg_3", "]", "!=", "arg_1", "[", "arg_3", "]", ":", "break", "else", ":", "return", "arg_0", "except", "TypeError", ":", "raise", "TypeError", "(", "'val is not iterable'", ")", "arg_0", ".", "_err", "(", "'Expected <%s> to contain sequence %s, but did not.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Asserts that val contains the given sequence of items in order.\"\"\"\n        if len(arg_1) == 0:\n            raise ValueError('one or more args must be given')\n        else:\n            try:\n                for arg_2 in xrange(len(arg_0.val) - len(arg_1) + 1):\n                    for arg_3 in xrange(len(arg_1)):\n                        if arg_0.val[arg_2+arg_3] != arg_1[arg_3]:\n                            break\n                    else:\n                        return arg_0\n            except TypeError:\n                raise TypeError('val is not iterable')\n        arg_0._err('Expected <%s> to contain sequence %s, but did not.' % (arg_0.val, arg_0._fmt_items(arg_1)))", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.contains_sequence", "docstring": "Asserts that val contains the given sequence of items in order.", "docstring_tokens": ["Asserts", "that", "val", "contains", "the", "given", "sequence", "of", "items", "in", "order", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 254142}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L183-L205", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Read the state file, if it exists.", "language": "python", "parameters": "(self, state_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "open", "(", "arg_1", ",", "'r'", ")", "arg_3", "=", "json", ".", "load", "(", "arg_2", ")", "arg_0", ".", "vpc_id", "=", "arg_3", "[", "'vpcID'", "]", "arg_0", ".", "sg_id", "=", "arg_3", "[", "'sgID'", "]", "arg_0", ".", "sn_ids", "=", "arg_3", "[", "'snIDs'", "]", "arg_0", ".", "instances", "=", "arg_3", "[", "'instances'", "]", "except", "Exception", "as", "e", ":", "logger", ".", "debug", "(", "\"Caught exception while reading state file: {0}\"", ".", "format", "(", "e", ")", ")", "raise", "e", "logger", ".", "debug", "(", "\"Done reading state from the local state file.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read the state file, if it exists.\n\n        If this script has been run previously, resource IDs will have been written to a\n        state file. On starting a run, a state file will be looked for before creating new\n        infrastructure. Information on VPCs, security groups, and subnets are saved, as\n        well as running instances and their states.\n\n        AWS has a maximum number of VPCs per region per account, so we do not want to\n        clutter users' AWS accounts with security groups and VPCs that will be used only\n        once.\n        \"\"\"\n        try:\n            arg_2 = open(arg_1, 'r')\n            arg_3 = json.load(arg_2)\n            arg_0.vpc_id = arg_3['vpcID']\n            arg_0.sg_id = arg_3['sgID']\n            arg_0.sn_ids = arg_3['snIDs']\n            arg_0.instances = arg_3['instances']\n        except Exception as e:\n            logger.debug(\"Caught exception while reading state file: {0}\".format(e))\n            raise e\n        logger.debug(\"Done reading state from the local state file.\")", "path": "parsl/providers/aws/aws.py", "identifier": "AWSProvider.read_state_file", "docstring": "Read the state file, if it exists.\n\n        If this script has been run previously, resource IDs will have been written to a\n        state file. On starting a run, a state file will be looked for before creating new\n        infrastructure. Information on VPCs, security groups, and subnets are saved, as\n        well as running instances and their states.\n\n        AWS has a maximum number of VPCs per region per account, so we do not want to\n        clutter users' AWS accounts with security groups and VPCs that will be used only\n        once.", "docstring_tokens": ["Read", "the", "state", "file", "if", "it", "exists", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 254143}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_06_parameter_presetting.py#L14-L50", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds all necessary parameters to the `traj` container.", "language": "python", "parameters": "(traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "f_add_parameter", "(", "'steps'", ",", "10000", ",", "comment", "=", "'Number of time steps to simulate'", ")", "arg_0", ".", "f_add_parameter", "(", "'dt'", ",", "0.01", ",", "comment", "=", "'Step size'", ")", "arg_0", ".", "f_add_parameter", "(", "ArrayParameter", ",", "'initial_conditions'", ",", "np", ".", "array", "(", "[", "0.0", ",", "0.0", ",", "0.0", "]", ")", ",", "comment", "=", "'Our initial conditions, as default we will start from'", "' origin!'", ")", "arg_0", ".", "f_add_parameter", "(", "'diff_name'", ",", "'diff_lorenz'", ",", "comment", "=", "'Name of our differential equation'", ")", "if", "arg_0", ".", "diff_name", "==", "'diff_lorenz'", ":", "arg_0", ".", "f_add_parameter", "(", "'func_params.sigma'", ",", "10.0", ")", "arg_0", ".", "f_add_parameter", "(", "'func_params.beta'", ",", "8.0", "/", "3.0", ")", "arg_0", ".", "f_add_parameter", "(", "'func_params.rho'", ",", "28.0", ")", "elif", "arg_0", ".", "diff_name", "==", "'diff_roessler'", ":", "arg_0", ".", "f_add_parameter", "(", "'func_params.a'", ",", "0.1", ")", "arg_0", ".", "f_add_parameter", "(", "'func_params.c'", ",", "14.0", ")", "else", ":", "raise", "ValueError", "(", "'I don\\'t know what %s is.'", "%", "arg_0", ".", "diff_name", ")"], "function": "def Func(arg_0):\n    \"\"\"Adds all necessary parameters to the `traj` container.\n\n    You can choose between two parameter sets. One for the Lorenz attractor and\n    one for the Roessler attractor.\n    The former is chosen for `traj.diff_name=='diff_lorenz'`, the latter for\n    `traj.diff_name=='diff_roessler'`.\n    You can use parameter presetting to switch between the two cases.\n\n    :raises: A ValueError if `traj.diff_name` is none of the above\n\n    \"\"\"\n    arg_0.f_add_parameter('steps', 10000, comment='Number of time steps to simulate')\n    arg_0.f_add_parameter('dt', 0.01, comment='Step size')\n\n    # Here we want to add the initial conditions as an array parameter, since we will simulate\n    # a 3-D differential equation, that is the Roessler attractor\n    # (https://en.wikipedia.org/wiki/R%C3%B6ssler_attractor)\n    arg_0.f_add_parameter(ArrayParameter,'initial_conditions', np.array([0.0,0.0,0.0]),\n                         comment = 'Our initial conditions, as default we will start from'\n                                   ' origin!')\n\n    # Per default we choose the name `'diff_lorenz'` as in the last example\n    arg_0.f_add_parameter('diff_name','diff_lorenz', comment= 'Name of our differential equation')\n\n    # We want some control flow depending on which name we really choose\n    if arg_0.diff_name == 'diff_lorenz':\n        # These parameters are for the Lorenz differential equation\n        arg_0.f_add_parameter('func_params.sigma', 10.0)\n        arg_0.f_add_parameter('func_params.beta', 8.0/3.0)\n        arg_0.f_add_parameter('func_params.rho', 28.0)\n    elif arg_0.diff_name == 'diff_roessler':\n        # If we use the Roessler system we need different parameters\n        arg_0.f_add_parameter('func_params.a', 0.1)\n        arg_0.f_add_parameter('func_params.c', 14.0)\n    else:\n        raise ValueError('I don\\'t know what %s is.' % arg_0.diff_name)", "path": "examples/example_06_parameter_presetting.py", "identifier": "add_parameters", "docstring": "Adds all necessary parameters to the `traj` container.\n\n    You can choose between two parameter sets. One for the Lorenz attractor and\n    one for the Roessler attractor.\n    The former is chosen for `traj.diff_name=='diff_lorenz'`, the latter for\n    `traj.diff_name=='diff_roessler'`.\n    You can use parameter presetting to switch between the two cases.\n\n    :raises: A ValueError if `traj.diff_name` is none of the above", "docstring_tokens": ["Adds", "all", "necessary", "parameters", "to", "the", "traj", "container", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254144}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_encoder.py#L35-L106", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Decorator used to change the return value from PJFFactory.fuzzed, it makes the structure printable", "language": "python", "parameters": "(func)", "return_statement": "return func_wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "func_wrapper", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", ":", "arg_4", "=", "\"\\\\x%02x\"", "else", ":", "arg_4", "=", "\"\\\\u%04x\"", "arg_5", "=", "re", ".", "compile", "(", "r\"(\\\\\\\\x[a-fA-F0-9]{2})\"", ")", "arg_6", "=", "re", ".", "compile", "(", "r\"(\\\\u[a-fA-F0-9]{4})\"", ")", "def", "encode_decode_all", "(", "arg_7", ",", "arg_8", "=", "True", ")", ":", "if", "type", "(", "arg_7", ")", "==", "dict", ":", "for", "arg_9", "in", "arg_7", ":", "if", "type", "(", "arg_7", "[", "arg_9", "]", ")", "in", "[", "dict", ",", "list", "]", ":", "if", "arg_8", ":", "arg_7", "[", "arg_9", "]", "=", "encode_decode_all", "(", "arg_7", "[", "arg_9", "]", ")", "else", ":", "arg_7", "[", "arg_9", "]", "=", "encode_decode_all", "(", "arg_7", "[", "arg_9", "]", ",", "arg_8", "=", "False", ")", "elif", "type", "(", "arg_7", "[", "arg_9", "]", ")", "==", "str", ":", "if", "arg_8", ":", "arg_7", "[", "arg_9", "]", "=", "decode", "(", "arg_7", "[", "arg_9", "]", ")", "else", ":", "arg_7", "[", "arg_9", "]", "=", "encode", "(", "arg_7", "[", "arg_9", "]", ")", "elif", "type", "(", "arg_7", ")", "==", "list", ":", "arg_10", "=", "[", "]", "for", "arg_11", "in", "arg_7", ":", "if", "type", "(", "arg_11", ")", "==", "str", ":", "if", "arg_8", ":", "arg_10", ".", "append", "(", "decode", "(", "arg_11", ")", ")", "else", ":", "arg_10", ".", "append", "(", "encode", "(", "arg_11", ")", ")", "elif", "type", "(", "arg_11", ")", "in", "[", "dict", ",", "list", "]", ":", "if", "arg_8", ":", "arg_10", ".", "append", "(", "encode_decode_all", "(", "arg_11", ")", ")", "else", ":", "arg_10", ".", "append", "(", "encode_decode_all", "(", "arg_11", ",", "arg_8", "=", "False", ")", ")", "else", ":", "arg_10", ".", "append", "(", "arg_11", ")", "return", "arg_10", "else", ":", "if", "arg_8", ":", "return", "decode", "(", "arg_7", ")", "else", ":", "return", "encode", "(", "arg_7", ")", "return", "arg_7", "def", "decode", "(", "arg_12", ")", ":", "arg_13", "=", "\"\"", ".", "join", "(", "arg_4", "%", "ord", "(", "c", ")", "if", "c", "not", "in", "p", "else", "c", "for", "c", "in", "arg_12", ")", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "return", "str", "(", "arg_13", ")", "else", ":", "for", "arg_14", "in", "arg_6", ".", "findall", "(", "arg_13", ")", ":", "arg_13", "=", "arg_13", ".", "replace", "(", "arg_14", ",", "arg_14", ".", "decode", "(", "\"unicode_escape\"", ")", ")", "return", "unicode", "(", "arg_13", ")", "def", "encode", "(", "arg_12", ")", ":", "for", "arg_14", "in", "arg_5", ".", "findall", "(", "arg_12", ")", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "arg_12", "=", "arg_12", ".", "replace", "(", "arg_14", ",", "bytes", "(", "str", "(", "arg_14", ")", ".", "replace", "(", "\"\\\\\\\\x\"", ",", "\"\\\\x\"", ")", ",", "\"utf-8\"", ")", ".", "decode", "(", "\"unicode_escape\"", ")", ")", "else", ":", "arg_12", "=", "arg_12", ".", "replace", "(", "arg_14", ",", "str", "(", "arg_14", ")", ".", "replace", "(", "\"\\\\\\\\x\"", ",", "\"\\\\x\"", ")", ".", "decode", "(", "\"string_escape\"", ")", ")", "return", "arg_12", "if", "arg_2", ":", "return", "encode_decode_all", "(", "\"{0}\"", ".", "format", "(", "json", ".", "dumps", "(", "encode_decode_all", "(", "arg_0", "(", "arg_1", ")", ")", ",", "arg_2", "=", "5", ")", ")", ",", "arg_8", "=", "False", ")", "else", ":", "return", "encode_decode_all", "(", "\"{0}\"", ".", "format", "(", "json", ".", "dumps", "(", "encode_decode_all", "(", "arg_0", "(", "arg_1", ")", ")", ")", ")", ",", "arg_8", "=", "False", ")", "return", "func_wrapper"], "function": "def Func(arg_0):\n        \"\"\"\n        Decorator used to change the return value from PJFFactory.fuzzed, it makes the structure printable\n        \"\"\"\n        def func_wrapper(arg_1, arg_2, arg_3):\n            if arg_3:\n                arg_4 = \"\\\\x%02x\"\n            else:\n                arg_4 = \"\\\\u%04x\"\n            arg_5 = re.compile(r\"(\\\\\\\\x[a-fA-F0-9]{2})\")\n            arg_6 = re.compile(r\"(\\\\u[a-fA-F0-9]{4})\")\n\n            def encode_decode_all(arg_7, arg_8=True):\n                if type(arg_7) == dict:\n                    for arg_9 in arg_7:\n                        if type(arg_7[arg_9]) in [dict, list]:\n                            if arg_8:\n                                arg_7[arg_9] = encode_decode_all(arg_7[arg_9])\n                            else:\n                                arg_7[arg_9] = encode_decode_all(arg_7[arg_9], arg_8=False)\n                        elif type(arg_7[arg_9]) == str:\n                            if arg_8:\n                                arg_7[arg_9] = decode(arg_7[arg_9])\n                            else:\n                                arg_7[arg_9] = encode(arg_7[arg_9])\n                elif type(arg_7) == list:\n                    arg_10 = []\n                    for arg_11 in arg_7:\n                        if type(arg_11) == str:\n                            if arg_8:\n                                arg_10.append(decode(arg_11))\n                            else:\n                                arg_10.append(encode(arg_11))\n                        elif type(arg_11) in [dict, list]:\n                            if arg_8:\n                                arg_10.append(encode_decode_all(arg_11))\n                            else:\n                                arg_10.append(encode_decode_all(arg_11, arg_8=False))\n                        else:\n                            arg_10.append(arg_11)\n                    return arg_10\n                else:\n                    if arg_8:\n                        return decode(arg_7)\n                    else:\n                        return encode(arg_7)\n                return arg_7\n\n            def decode(arg_12):\n                arg_13 = \"\".join(arg_4 % ord(c) if c not in p else c for c in arg_12)\n                if sys.version_info >= (3, 0):\n                    return str(arg_13)\n                else:\n                    for arg_14 in arg_6.findall(arg_13):\n                        arg_13 = arg_13.replace(arg_14, arg_14.decode(\"unicode_escape\"))\n                    return unicode(arg_13)\n\n            def encode(arg_12):\n                for arg_14 in arg_5.findall(arg_12):\n                    if sys.version_info >= (3, 0):\n                        arg_12 = arg_12.replace(arg_14, bytes(str(arg_14).replace(\"\\\\\\\\x\", \"\\\\x\"),\"utf-8\").decode(\"unicode_escape\"))\n                    else:\n                        arg_12 = arg_12.replace(arg_14, str(arg_14).replace(\"\\\\\\\\x\", \"\\\\x\").decode(\"string_escape\"))\n                return arg_12\n\n            if arg_2:\n                return encode_decode_all(\"{0}\".format(json.dumps(encode_decode_all(arg_0(arg_1)), arg_2=5)),\n                                         arg_8=False)\n            else:\n                return encode_decode_all(\"{0}\".format(json.dumps(encode_decode_all(arg_0(arg_1)))), arg_8=False)\n\n        return func_wrapper", "path": "pyjfuzz/core/pjf_encoder.py", "identifier": "PJFEncoder.json_encode", "docstring": "Decorator used to change the return value from PJFFactory.fuzzed, it makes the structure printable", "docstring_tokens": ["Decorator", "used", "to", "change", "the", "return", "value", "from", "PJFFactory", ".", "fuzzed", "it", "makes", "the", "structure", "printable"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 254145}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L902-L917", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Check that the server is returning a valid Content-Type", "language": "python", "parameters": "(self, content_type, accept)", "return_statement": "return (\n            all(elem in content_type_tokens for elem in accept_tokens) and\n            (content_type_tokens[0] == 'application/vnd.oasis.taxii+json' or\n             content_type_tokens[0] == 'application/vnd.oasis.stix+json')\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "replace", "(", "' '", ",", "''", ")", ".", "split", "(", "';'", ")", "arg_4", "=", "arg_1", ".", "replace", "(", "' '", ",", "''", ")", ".", "split", "(", "';'", ")", "return", "(", "all", "(", "arg_5", "in", "arg_4", "for", "arg_5", "in", "arg_3", ")", "and", "(", "arg_4", "[", "0", "]", "==", "'application/vnd.oasis.taxii+json'", "or", "arg_4", "[", "0", "]", "==", "'application/vnd.oasis.stix+json'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check that the server is returning a valid Content-Type\n\n        Args:\n            content_type (str): ``Content-Type:`` header value\n            accept (str): media type to include in the ``Accept:`` header.\n\n        \"\"\"\n        arg_3 = arg_2.replace(' ', '').split(';')\n        arg_4 = arg_1.replace(' ', '').split(';')\n\n        return (\n            all(arg_5 in arg_4 for arg_5 in arg_3) and\n            (arg_4[0] == 'application/vnd.oasis.taxii+json' or\n             arg_4[0] == 'application/vnd.oasis.stix+json')\n        )", "path": "taxii2client/__init__.py", "identifier": "_HTTPConnection.valid_content_type", "docstring": "Check that the server is returning a valid Content-Type\n\n        Args:\n            content_type (str): ``Content-Type:`` header value\n            accept (str): media type to include in the ``Accept:`` header.", "docstring_tokens": ["Check", "that", "the", "server", "is", "returning", "a", "valid", "Content", "-", "Type"], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 254146}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/convert.py#L38-L43", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "returns a fully qualified app domain name", "language": "python", "parameters": "(domain, proto=None)", "return_statement": "return fdqn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "from", ".", "generic", "import", "get_site_proto", "arg_1", "=", "arg_1", "or", "get_site_proto", "(", ")", "arg_2", "=", "'{proto}://{domain}'", ".", "format", "(", "arg_1", "=", "arg_1", ",", "arg_0", "=", "arg_0", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" returns a fully qualified app domain name \"\"\"\n    from .generic import get_site_proto\n    arg_1 = arg_1 or get_site_proto()\n    arg_2 = '{proto}://{domain}'.format(arg_1=arg_1, arg_0=arg_0)\n    return arg_2", "path": "toolware/utils/convert.py", "identifier": "domain_to_fqdn", "docstring": "returns a fully qualified app domain name", "docstring_tokens": ["returns", "a", "fully", "qualified", "app", "domain", "name"], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 254147}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/utils.py#L48-L63", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return a datetime object from an iso 8601 representation.\n    Return None if string is non conforming.", "language": "python", "parameters": "(string)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "DATE_ISO_REGEX", ".", "match", "(", "arg_0", ")", "if", "arg_1", ":", "arg_2", "=", "datetime", ".", "datetime", "(", "year", "=", "int", "(", "arg_1", ".", "group", "(", "DATE_ISO_YEAR_GRP", ")", ")", ",", "month", "=", "int", "(", "arg_1", ".", "group", "(", "DATE_ISO_MONTH_GRP", ")", ")", ",", "day", "=", "int", "(", "arg_1", ".", "group", "(", "DATE_ISO_DAY_GRP", ")", ")", ",", "hour", "=", "int", "(", "arg_1", ".", "group", "(", "DATE_ISO_HOUR_GRP", ")", ")", ",", "second", "=", "int", "(", "arg_1", ".", "group", "(", "DATE_ISO_SEC_GRP", ")", ")", ",", "minute", "=", "int", "(", "arg_1", ".", "group", "(", "DATE_ISO_MIN_GRP", ")", ")", ")", "return", "arg_2", "else", ":", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Return a datetime object from an iso 8601 representation.\n    Return None if string is non conforming.\n    \"\"\"\n    arg_1 = DATE_ISO_REGEX.match(arg_0)\n    if arg_1:\n        arg_2 = datetime.datetime(year=int(arg_1.group(DATE_ISO_YEAR_GRP)),\n                                 month=int(arg_1.group(DATE_ISO_MONTH_GRP)),\n                                 day=int(arg_1.group(DATE_ISO_DAY_GRP)),\n                                 hour=int(arg_1.group(DATE_ISO_HOUR_GRP)),\n                                 second=int(arg_1.group(DATE_ISO_SEC_GRP)),\n                                 minute=int(arg_1.group(DATE_ISO_MIN_GRP)))\n        return arg_2\n    else:\n        return None", "path": "spdx/utils.py", "identifier": "datetime_from_iso_format", "docstring": "Return a datetime object from an iso 8601 representation.\n    Return None if string is non conforming.", "docstring_tokens": ["Return", "a", "datetime", "object", "from", "an", "iso", "8601", "representation", ".", "Return", "None", "if", "string", "is", "non", "conforming", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254148}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L606-L654", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Wait for a particular UI event to occur; this can be built\n        upon in NativeUIElement for specific convenience methods.", "language": "python", "parameters": "(self, timeout, notification, **kwargs)", "return_statement": "return self._setNotification(timeout, notification, callback,\n                                     callbackArgs,\n                                     callbackKwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_matchOther", "arg_5", "=", "None", "arg_6", "=", "None", "arg_7", "=", "None", "if", "'callback'", "in", "arg_3", ":", "arg_4", "=", "arg_3", "[", "'callback'", "]", "del", "arg_3", "[", "'callback'", "]", "if", "'args'", "in", "arg_3", ":", "if", "not", "isinstance", "(", "arg_3", "[", "'args'", "]", ",", "tuple", ")", ":", "arg_8", "=", "'Notification callback args not given as a tuple'", "raise", "TypeError", "(", "arg_8", ")", "arg_6", "=", "arg_3", "[", "'args'", "]", "del", "arg_3", "[", "'args'", "]", "if", "'kwargs'", "in", "arg_3", ":", "if", "not", "isinstance", "(", "arg_3", "[", "'kwargs'", "]", ",", "dict", ")", ":", "arg_8", "=", "'Notification callback kwargs not given as a dict'", "raise", "TypeError", "(", "arg_8", ")", "arg_7", "=", "arg_3", "[", "'kwargs'", "]", "del", "arg_3", "[", "'kwargs'", "]", "if", "arg_3", ":", "if", "arg_7", ":", "arg_7", ".", "update", "(", "arg_3", ")", "else", ":", "arg_7", "=", "arg_3", "else", ":", "arg_6", "=", "(", "arg_5", ",", ")", "arg_7", "=", "arg_3", "return", "arg_0", ".", "_setNotification", "(", "arg_1", ",", "arg_2", ",", "arg_4", ",", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Wait for a particular UI event to occur; this can be built\n        upon in NativeUIElement for specific convenience methods.\n        \"\"\"\n        arg_4 = arg_0._matchOther\n        arg_5 = None\n        arg_6 = None\n        arg_7 = None\n\n        # Allow customization of the callback, though by default use the basic\n        # _match() method\n        if 'callback' in arg_3:\n            arg_4 = arg_3['callback']\n            del arg_3['callback']\n\n            # Deal with these only if callback is provided:\n            if 'args' in arg_3:\n                if not isinstance(arg_3['args'], tuple):\n                    arg_8 = 'Notification callback args not given as a tuple'\n                    raise TypeError(arg_8)\n\n                # If args are given, notification will pass back the returned\n                # element in the first positional arg\n                arg_6 = arg_3['args']\n                del arg_3['args']\n\n            if 'kwargs' in arg_3:\n                if not isinstance(arg_3['kwargs'], dict):\n                    arg_8 = 'Notification callback kwargs not given as a dict'\n                    raise TypeError(arg_8)\n\n                arg_7 = arg_3['kwargs']\n                del arg_3['kwargs']\n            # If kwargs are not given as a dictionary but individually listed\n            # need to update the callbackKwargs dict with the remaining items in\n            # kwargs\n            if arg_3:\n                if arg_7:\n                    arg_7.update(arg_3)\n                else:\n                    arg_7 = arg_3\n        else:\n            arg_6 = (arg_5,)\n            # Pass the kwargs to the default callback\n            arg_7 = arg_3\n\n        return arg_0._setNotification(arg_1, arg_2, arg_4,\n                                     arg_6,\n                                     arg_7)", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._waitFor", "docstring": "Wait for a particular UI event to occur; this can be built\n        upon in NativeUIElement for specific convenience methods.", "docstring_tokens": ["Wait", "for", "a", "particular", "UI", "event", "to", "occur", ";", "this", "can", "be", "built", "upon", "in", "NativeUIElement", "for", "specific", "convenience", "methods", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 254149}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/__init__.py#L475-L515", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Load the configuration.", "language": "python", "parameters": "(under_test=False, custom=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ",", "arg_1", "=", "None", ")", ":", "if", "\"config_loaded\"", "not", "in", "INTERN", ":", "Load", "(", "CURRENT_DIRECTORY", ")", "if", "not", "arg_0", ":", "DirectoryStructure", "(", ")", "INTERN", ".", "update", "(", "{", "\"config_loaded\"", ":", "True", "}", ")", "if", "arg_1", "and", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "CONFIGURATION", ".", "update", "(", "arg_1", ")"], "function": "def Func(arg_0=False, arg_1=None):  # pragma: no cover\n    \"\"\"\n    Load the configuration.\n\n    :param under_test:\n        Tell us if we only have to load the configuration file (True)\n        or load the configuration file and initate the output directory\n        if it does not exist (False).\n    :type under_test: bool\n\n    :param custom:\n        A dict with the configuration index (from .PyFunceble.yaml) to update.\n    :type custom: dict\n\n    .. warning::\n        If :code:`custom` is given, the given :code:`dict` overwrite\n        the last value of the given configuration indexes.\n    \"\"\"\n\n    if \"config_loaded\" not in INTERN:\n        # The configuration was not already loaded.\n\n        # We load and download the different configuration file if they are non\n        # existant.\n        Load(CURRENT_DIRECTORY)\n\n        if not arg_0:\n            # If we are not under test which means that we want to save informations,\n            # we initiate the directory structure.\n            DirectoryStructure()\n\n        # We save that the configuration was loaded.\n        INTERN.update({\"config_loaded\": True})\n\n        if arg_1 and isinstance(arg_1, dict):\n            # The given configuration is not None or empty.\n            # and\n            # It is a dict.\n\n            # We update the configuration index.\n            CONFIGURATION.update(arg_1)", "path": "PyFunceble/__init__.py", "identifier": "load_config", "docstring": "Load the configuration.\n\n    :param under_test:\n        Tell us if we only have to load the configuration file (True)\n        or load the configuration file and initate the output directory\n        if it does not exist (False).\n    :type under_test: bool\n\n    :param custom:\n        A dict with the configuration index (from .PyFunceble.yaml) to update.\n    :type custom: dict\n\n    .. warning::\n        If :code:`custom` is given, the given :code:`dict` overwrite\n        the last value of the given configuration indexes.", "docstring_tokens": ["Load", "the", "configuration", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 254150}
{"url": "https://github.com/sam-washington/requests-aws4auth/blob/1201e470c6d5847b7fe42e937a55755e1895e72c/requests_aws4auth/aws4auth.py#L469-L495", "sha": "1201e470c6d5847b7fe42e937a55755e1895e72c", "docstring_summary": "Encode body of request to bytes and update content-type if required.", "language": "python", "parameters": "(req)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ".", "body", ",", "text_type", ")", ":", "arg_1", "=", "arg_0", ".", "headers", ".", "get", "(", "'content-type'", ",", "'text/plain'", ")", ".", "split", "(", "';'", ")", "if", "len", "(", "arg_1", ")", "==", "2", ":", "arg_2", ",", "arg_3", "=", "arg_1", "arg_3", "=", "arg_3", ".", "split", "(", "'='", ")", "[", "1", "]", "arg_0", ".", "body", "=", "arg_0", ".", "body", ".", "encode", "(", "arg_3", ")", "else", ":", "arg_2", "=", "arg_1", "[", "0", "]", "if", "(", "arg_2", "==", "'application/x-www-form-urlencoded'", "or", "'x-amz-'", "in", "arg_2", ")", ":", "arg_0", ".", "body", "=", "arg_0", ".", "body", ".", "encode", "(", ")", "else", ":", "arg_0", ".", "body", "=", "arg_0", ".", "body", ".", "encode", "(", "'utf-8'", ")", "arg_0", ".", "headers", "[", "'content-type'", "]", "=", "arg_2", "+", "'; charset=utf-8'"], "function": "def Func(arg_0):\n        \"\"\"\n        Encode body of request to bytes and update content-type if required.\n\n        If the body of req is Unicode then encode to the charset found in\n        content-type header if present, otherwise UTF-8, or ASCII if\n        content-type is application/x-www-form-urlencoded. If encoding to UTF-8\n        then add charset to content-type. Modifies req directly, does not\n        return a modified copy.\n\n        req -- Requests PreparedRequest object\n\n        \"\"\"\n        if isinstance(arg_0.body, text_type):\n            arg_1 = arg_0.headers.get('content-type', 'text/plain').split(';')\n            if len(arg_1) == 2:\n                arg_2, arg_3 = arg_1\n                arg_3 = arg_3.split('=')[1]\n                arg_0.body = arg_0.body.encode(arg_3)\n            else:\n                arg_2 = arg_1[0]\n                if (arg_2 == 'application/x-www-form-urlencoded' or\n                        'x-amz-' in arg_2):\n                    arg_0.body = arg_0.body.encode()\n                else:\n                    arg_0.body = arg_0.body.encode('utf-8')\n                    arg_0.headers['content-type'] = arg_2 + '; charset=utf-8'", "path": "requests_aws4auth/aws4auth.py", "identifier": "AWS4Auth.encode_body", "docstring": "Encode body of request to bytes and update content-type if required.\n\n        If the body of req is Unicode then encode to the charset found in\n        content-type header if present, otherwise UTF-8, or ASCII if\n        content-type is application/x-www-form-urlencoded. If encoding to UTF-8\n        then add charset to content-type. Modifies req directly, does not\n        return a modified copy.\n\n        req -- Requests PreparedRequest object", "docstring_tokens": ["Encode", "body", "of", "request", "to", "bytes", "and", "update", "content", "-", "type", "if", "required", "."], "nwo": "sam-washington/requests-aws4auth", "score": 0.36091303233896527, "idx": 254151}
{"url": "https://github.com/Infinidat/infi.instruct/blob/93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8/src/infi/instruct/buffer/io_buffer.py#L167-L181", "sha": "93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8", "docstring_summary": "Assumes that start and stop are already in 'buffer' coordinates. value is a byte iterable.\n        value_len is fractional.", "language": "python", "parameters": "(self, start, stop, value, value_len)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "assert", "arg_2", ">=", "arg_1", "and", "arg_4", ">=", "0", "arg_5", "=", "arg_2", "-", "arg_1", "if", "arg_5", "<", "arg_4", ":", "arg_0", ".", "_insert_zeros", "(", "arg_2", ",", "arg_2", "+", "arg_4", "-", "arg_5", ")", "arg_0", ".", "_copy_to_range", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "elif", "arg_5", ">", "arg_4", ":", "arg_0", ".", "_del_range", "(", "arg_2", "-", "(", "arg_5", "-", "arg_4", ")", ",", "arg_2", ")", "arg_0", ".", "_copy_to_range", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "else", ":", "arg_0", ".", "_copy_to_range", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Assumes that start and stop are already in 'buffer' coordinates. value is a byte iterable.\n        value_len is fractional.\n        \"\"\"\n        assert arg_2 >= arg_1 and arg_4 >= 0\n        arg_5 = arg_2 - arg_1\n        if arg_5 < arg_4:\n            arg_0._insert_zeros(arg_2, arg_2 + arg_4 - arg_5)\n            arg_0._copy_to_range(arg_1, arg_3, arg_4)\n        elif arg_5 > arg_4:\n            arg_0._del_range(arg_2 - (arg_5 - arg_4), arg_2)\n            arg_0._copy_to_range(arg_1, arg_3, arg_4)\n        else:\n            arg_0._copy_to_range(arg_1, arg_3, arg_4)", "path": "src/infi/instruct/buffer/io_buffer.py", "identifier": "BitAwareByteArray._set_range", "docstring": "Assumes that start and stop are already in 'buffer' coordinates. value is a byte iterable.\n        value_len is fractional.", "docstring_tokens": ["Assumes", "that", "start", "and", "stop", "are", "already", "in", "buffer", "coordinates", ".", "value", "is", "a", "byte", "iterable", ".", "value_len", "is", "fractional", "."], "nwo": "Infinidat/infi.instruct", "score": 0.16246995141409282, "idx": 254152}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/client.py#L72-L86", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Run a dataset query against Citrination.", "language": "python", "parameters": "(self, dataset_returning_query)", "return_statement": "return self._execute_search_query(\n            dataset_returning_query,\n            DatasetSearchResult\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_validate_search_query", "(", "arg_1", ")", "return", "arg_0", ".", "_execute_search_query", "(", "arg_1", ",", "DatasetSearchResult", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Run a dataset query against Citrination.\n\n        :param dataset_returning_query: :class:`DatasetReturningQuery` to execute.\n        :type dataset_returning_query: :class:`DatasetReturningQuery`\n        :return: Dataset search result object with the results of the query.\n        :rtype: :class:`DatasetSearchResult`\n        \"\"\"\n\n        arg_0._validate_search_query(arg_1)\n        return arg_0._execute_search_query(\n            arg_1,\n            DatasetSearchResult\n        )", "path": "citrination_client/search/client.py", "identifier": "SearchClient.dataset_search", "docstring": "Run a dataset query against Citrination.\n\n        :param dataset_returning_query: :class:`DatasetReturningQuery` to execute.\n        :type dataset_returning_query: :class:`DatasetReturningQuery`\n        :return: Dataset search result object with the results of the query.\n        :rtype: :class:`DatasetSearchResult`", "docstring_tokens": ["Run", "a", "dataset", "query", "against", "Citrination", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 254153}
{"url": "https://github.com/dialoguemd/multi-method/blob/8b405d4c5ad74a2a36a4ecf88283262defa2e737/dialogue/multi_method/__init__.py#L30-L45", "sha": "8b405d4c5ad74a2a36a4ecf88283262defa2e737", "docstring_summary": "A decorator for a function implementing dispatch_fn for dispatch_key.", "language": "python", "parameters": "(dispatch_fn, dispatch_key=None)", "return_statement": "return apply_decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "def", "apply_decorator", "(", "arg_2", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "__multi_default__", "=", "arg_2", "else", ":", "arg_0", ".", "__multi__", "[", "arg_1", "]", "=", "arg_2", "return", "arg_2", "return", "apply_decorator"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"A decorator for a function implementing dispatch_fn for dispatch_key.\n\n    If no dispatch_key is specified, the function is used as the\n    default dispacth function.\n    \"\"\"\n\n    def apply_decorator(arg_2):\n        if arg_1 is None:\n            # Default case\n            arg_0.__multi_default__ = arg_2\n        else:\n            arg_0.__multi__[arg_1] = arg_2\n        return arg_2\n\n    return apply_decorator", "path": "dialogue/multi_method/__init__.py", "identifier": "method", "docstring": "A decorator for a function implementing dispatch_fn for dispatch_key.\n\n    If no dispatch_key is specified, the function is used as the\n    default dispacth function.", "docstring_tokens": ["A", "decorator", "for", "a", "function", "implementing", "dispatch_fn", "for", "dispatch_key", "."], "nwo": "dialoguemd/multi-method", "score": 0.23137166388621372, "idx": 254154}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L207-L223", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Resolves environment from .cpenv file...recursively walks up the tree\n    in attempt to find a .cpenv file", "language": "python", "parameters": "(resolver, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "raise", "ResolveError", "if", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "arg_1", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "for", "arg_2", ",", "arg_3", ",", "arg_3", "in", "walk_up", "(", "arg_1", ")", ":", "if", "is_redirecting", "(", "arg_2", ")", ":", "arg_4", "=", "redirect_to_env_paths", "(", "unipath", "(", "arg_2", ",", "'.cpenv'", ")", ")", "arg_5", "=", "Resolver", "(", "*", "arg_4", ")", "return", "arg_5", ".", "resolve", "(", ")", "raise", "ResolveError"], "function": "def Func(arg_0, arg_1):\n    '''Resolves environment from .cpenv file...recursively walks up the tree\n    in attempt to find a .cpenv file'''\n\n    if not os.path.exists(arg_1):\n        raise ResolveError\n\n    if os.path.isfile(arg_1):\n        arg_1 = os.path.dirname(arg_1)\n\n    for arg_2, arg_3, arg_3 in walk_up(arg_1):\n        if is_redirecting(arg_2):\n            arg_4 = redirect_to_env_paths(unipath(arg_2, '.cpenv'))\n            arg_5 = Resolver(*arg_4)\n            return arg_5.resolve()\n\n    raise ResolveError", "path": "cpenv/resolver.py", "identifier": "redirect_resolver", "docstring": "Resolves environment from .cpenv file...recursively walks up the tree\n    in attempt to find a .cpenv file", "docstring_tokens": ["Resolves", "environment", "from", ".", "cpenv", "file", "...", "recursively", "walks", "up", "the", "tree", "in", "attempt", "to", "find", "a", ".", "cpenv", "file"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 254155}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/models/mixins.py#L163-L166", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Send a password reset to the user's email address.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Site", ".", "objects", ".", "get_current", "(", ")", "arg_0", ".", "password_reset_notification", "(", "user", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", ".", "notify", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Send a password reset to the user's email address.\"\"\"\n        arg_1 = Site.objects.get_current()\n        arg_0.password_reset_notification(user=arg_0, arg_1=arg_1).notify()", "path": "user_management/models/mixins.py", "identifier": "EmailVerifyUserMethodsMixin.send_password_reset", "docstring": "Send a password reset to the user's email address.", "docstring_tokens": ["Send", "a", "password", "reset", "to", "the", "user", "s", "email", "address", "."], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 254156}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/helpers.py#L5-L43", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Triggers specific class methods using a simple reflection\n    mechanism based on the given input dictionary params.", "language": "python", "parameters": "(instance, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "sorted", "(", "arg_1", ")", ":", "arg_3", "=", "arg_1", "[", "arg_2", "]", "arg_4", "=", "arg_0", "if", "arg_2", ".", "startswith", "(", "'response_'", ")", "or", "arg_2", ".", "startswith", "(", "'reply_'", ")", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "'response_'", ",", "''", ")", ".", "replace", "(", "'reply_'", ",", "''", ")", "if", "hasattr", "(", "arg_0", ",", "'_response'", ")", ":", "arg_4", "=", "arg_0", ".", "_response", "arg_5", "=", "getattr", "(", "arg_4", ",", "arg_2", ",", "None", ")", "arg_6", "=", "arg_2", "in", "dir", "(", "arg_4", ")", "arg_7", "=", "ismethod", "(", "arg_5", ")", "and", "not", "isfunction", "(", "arg_5", ")", "if", "not", "arg_7", "and", "not", "arg_6", ":", "raise", "PookInvalidArgument", "(", "'Unsupported argument: {}'", ".", "format", "(", "arg_2", ")", ")", "if", "arg_7", ":", "arg_5", "(", "arg_3", ")", "else", ":", "setattr", "(", "arg_4", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\"\n    Triggers specific class methods using a simple reflection\n    mechanism based on the given input dictionary params.\n\n    Arguments:\n        instance (object): target instance to dynamically trigger methods.\n        args (iterable): input arguments to trigger objects to\n\n    Returns:\n        None\n    \"\"\"\n    # Start the magic\n    for arg_2 in sorted(arg_1):\n        arg_3 = arg_1[arg_2]\n        arg_4 = arg_0\n\n        # If response attibutes\n        if arg_2.startswith('response_') or arg_2.startswith('reply_'):\n            arg_2 = arg_2.replace('response_', '').replace('reply_', '')\n            # If instance has response attribute, use it\n            if hasattr(arg_0, '_response'):\n                arg_4 = arg_0._response\n\n        # Retrieve class member for inspection and future use\n        arg_5 = getattr(arg_4, arg_2, None)\n\n        # Is attribute\n        arg_6 = arg_2 in dir(arg_4)\n        arg_7 = ismethod(arg_5) and not isfunction(arg_5)\n\n        if not arg_7 and not arg_6:\n            raise PookInvalidArgument('Unsupported argument: {}'.format(arg_2))\n\n        # Set attribute or trigger method\n        if arg_7:\n            arg_5(arg_3)\n        else:\n            setattr(arg_4, arg_2, arg_3)", "path": "pook/helpers.py", "identifier": "trigger_methods", "docstring": "Triggers specific class methods using a simple reflection\n    mechanism based on the given input dictionary params.\n\n    Arguments:\n        instance (object): target instance to dynamically trigger methods.\n        args (iterable): input arguments to trigger objects to\n\n    Returns:\n        None", "docstring_tokens": ["Triggers", "specific", "class", "methods", "using", "a", "simple", "reflection", "mechanism", "based", "on", "the", "given", "input", "dictionary", "params", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 254157}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_http/winhttp.py#L449-L474", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gets the response and generates the _Response object", "language": "python", "parameters": "(self)", "return_statement": "return _Response(status, status_text, length, headers, body)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_httprequest", ".", "status", "(", ")", "arg_2", "=", "arg_0", ".", "_httprequest", ".", "status_text", "(", ")", "arg_3", "=", "arg_0", ".", "_httprequest", ".", "get_all_response_headers", "(", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ".", "split", "(", "'\\n'", ")", ":", "if", "(", "arg_5", ".", "startswith", "(", "'\\t'", ")", "or", "arg_5", ".", "startswith", "(", "' '", ")", ")", "and", "arg_4", ":", "arg_4", "[", "-", "1", "]", "+=", "arg_5", "else", ":", "arg_4", ".", "append", "(", "arg_5", ")", "arg_6", "=", "[", "]", "for", "arg_5", "in", "arg_4", ":", "if", "':'", "in", "arg_5", ":", "arg_7", "=", "arg_5", ".", "find", "(", "':'", ")", "arg_6", ".", "append", "(", "(", "arg_5", "[", ":", "arg_7", "]", ".", "lower", "(", ")", ",", "arg_5", "[", "arg_7", "+", "1", ":", "]", ".", "strip", "(", ")", ")", ")", "arg_8", "=", "arg_0", ".", "_httprequest", ".", "response_body", "(", ")", "arg_9", "=", "len", "(", "arg_8", ")", "return", "_Response", "(", "arg_1", ",", "arg_2", ",", "arg_9", ",", "arg_6", ",", "arg_8", ")"], "function": "def Func(arg_0):\n        ''' Gets the response and generates the _Response object'''\n        arg_1 = arg_0._httprequest.status()\n        arg_2 = arg_0._httprequest.status_text()\n\n        arg_3 = arg_0._httprequest.get_all_response_headers()\n        arg_4 = []\n        for arg_5 in arg_3.split('\\n'):\n            if (arg_5.startswith('\\t') or\\\n                arg_5.startswith(' ')) and arg_4:\n                # append to previous header\n                arg_4[-1] += arg_5\n            else:\n                arg_4.append(arg_5)\n\n        arg_6 = []\n        for arg_5 in arg_4:\n            if ':' in arg_5:\n                arg_7 = arg_5.find(':')\n                arg_6.append(\n                    (arg_5[:arg_7].lower(), arg_5[arg_7 + 1:].strip()))\n\n        arg_8 = arg_0._httprequest.response_body()\n        arg_9 = len(arg_8)\n\n        return _Response(arg_1, arg_2, arg_9, arg_6, arg_8)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_http/winhttp.py", "identifier": "_HTTPConnection.getresponse", "docstring": "Gets the response and generates the _Response object", "docstring_tokens": ["Gets", "the", "response", "and", "generates", "the", "_Response", "object"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254158}
{"url": "https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L553-L559", "sha": "e5a0d908df8c93ff1ee7abdda8875fd1667df53d", "docstring_summary": "Return icon for index.", "language": "python", "parameters": "(self, index)", "return_statement": "return sourceModel.icon(self.mapToSource(index))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "sourceModel", "(", ")", "if", "not", "arg_2", ":", "return", "None", "return", "arg_2", ".", "Func", "(", "arg_0", ".", "mapToSource", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''Return Func for index.'''\n        arg_2 = arg_0.sourceModel()\n        if not arg_2:\n            return None\n\n        return arg_2.Func(arg_0.mapToSource(arg_1))", "path": "source/riffle/model.py", "identifier": "FilesystemSortProxy.icon", "docstring": "Return icon for index.", "docstring_tokens": ["Return", "icon", "for", "index", "."], "nwo": "4degrees/riffle", "score": 0.2663827826706725, "idx": 254159}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementclient.py#L264-L318", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Waits for an asynchronous operation to complete.", "language": "python", "parameters": "(self,\n        request_id, wait_for_status='Succeeded', timeout=30, sleep_interval=5,\n        progress_callback=wait_for_operation_status_progress_default_callback,\n        success_callback=wait_for_operation_status_success_default_callback,\n        failure_callback=wait_for_operation_status_failure_default_callback)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'Succeeded'", ",", "arg_3", "=", "30", ",", "arg_4", "=", "5", ",", "arg_5", "=", "arg_6", ",", "arg_7", "=", "arg_8", ",", "arg_9", "=", "arg_10", ")", ":", "arg_11", "=", "arg_3", "//", "arg_4", "+", "1", "arg_12", "=", "time", ".", "time", "(", ")", "for", "arg_13", "in", "range", "(", "int", "(", "arg_11", ")", ")", ":", "arg_14", "=", "arg_0", ".", "get_operation_status", "(", "arg_1", ")", "arg_15", "=", "time", ".", "time", "(", ")", "-", "arg_12", "if", "arg_14", ".", "status", "==", "arg_2", ":", "if", "arg_7", "is", "not", "None", ":", "arg_7", "(", "arg_15", ")", "return", "arg_14", "elif", "arg_14", ".", "error", ":", "if", "arg_9", "is", "not", "None", ":", "arg_16", "=", "AzureAsyncOperationHttpError", "(", "_ERROR_ASYNC_OP_FAILURE", ",", "arg_14", ".", "status", ",", "arg_14", ")", "arg_9", "(", "arg_15", ",", "arg_16", ")", "return", "arg_14", "else", ":", "if", "arg_5", "is", "not", "None", ":", "arg_5", "(", "arg_15", ")", "time", ".", "sleep", "(", "arg_4", ")", "if", "arg_9", "is", "not", "None", ":", "arg_16", "=", "AzureAsyncOperationHttpError", "(", "_ERROR_ASYNC_OP_TIMEOUT", ",", "arg_14", ".", "status", ",", "arg_14", ")", "arg_9", "(", "arg_15", ",", "arg_16", ")", "return", "arg_14"], "function": "def Func(arg_0,\n        arg_1, arg_2='Succeeded', arg_3=30, arg_4=5,\n        arg_5=arg_6,\n        arg_7=arg_8,\n        arg_9=arg_10):\n        '''\n        Waits for an asynchronous operation to complete.\n\n        This calls get_operation_status in a loop and returns when the expected\n        status is reached. The result of get_operation_status is returned. By\n        default, an exception is raised on timeout or error status.\n\n        request_id:\n            The request ID for the request you wish to track.\n        wait_for_status:\n            Status to wait for. Default is 'Succeeded'.\n        timeout:\n            Total timeout in seconds. Default is 30s.\n        sleep_interval:\n            Sleep time in seconds for each iteration. Default is 5s.\n        progress_callback:\n            Callback for each iteration.\n            Default prints '.'.\n            Set it to None for no progress notification.\n        success_callback:\n            Callback on success. Default prints newline.\n            Set it to None for no success notification.\n        failure_callback:\n            Callback on failure. Default prints newline+error details then\n            raises exception.\n            Set it to None for no failure notification.\n        '''\n        arg_11 = arg_3 // arg_4 + 1\n        arg_12 = time.time()\n        for arg_13 in range(int(arg_11)):\n            arg_14 = arg_0.get_operation_status(arg_1)\n            arg_15 = time.time() - arg_12\n            if arg_14.status == arg_2:\n                if arg_7 is not None:\n                    arg_7(arg_15)\n                return arg_14\n            elif arg_14.error:\n                if arg_9 is not None:\n                    arg_16 = AzureAsyncOperationHttpError(_ERROR_ASYNC_OP_FAILURE, arg_14.status, arg_14)\n                    arg_9(arg_15, arg_16)\n                return arg_14\n            else:\n                if arg_5 is not None:\n                    arg_5(arg_15)\n                time.sleep(arg_4)\n\n        if arg_9 is not None:\n            arg_16 = AzureAsyncOperationHttpError(_ERROR_ASYNC_OP_TIMEOUT, arg_14.status, arg_14)\n            arg_9(arg_15, arg_16)\n        return arg_14", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementclient.py", "identifier": "_ServiceManagementClient.wait_for_operation_status", "docstring": "Waits for an asynchronous operation to complete.\n\n        This calls get_operation_status in a loop and returns when the expected\n        status is reached. The result of get_operation_status is returned. By\n        default, an exception is raised on timeout or error status.\n\n        request_id:\n            The request ID for the request you wish to track.\n        wait_for_status:\n            Status to wait for. Default is 'Succeeded'.\n        timeout:\n            Total timeout in seconds. Default is 30s.\n        sleep_interval:\n            Sleep time in seconds for each iteration. Default is 5s.\n        progress_callback:\n            Callback for each iteration.\n            Default prints '.'.\n            Set it to None for no progress notification.\n        success_callback:\n            Callback on success. Default prints newline.\n            Set it to None for no success notification.\n        failure_callback:\n            Callback on failure. Default prints newline+error details then\n            raises exception.\n            Set it to None for no failure notification.", "docstring_tokens": ["Waits", "for", "an", "asynchronous", "operation", "to", "complete", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254160}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/sdr_classifier.py#L365-L380", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Perform inference for a single step. Given an SDR input and a weight\n    matrix, return a predicted distribution.", "language": "python", "parameters": "(self, patternNZ, weightMatrix)", "return_statement": "return predictDist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", "[", "arg_1", "]", ".", "sum", "(", "axis", "=", "0", ")", "arg_3", "=", "arg_3", "-", "numpy", ".", "max", "(", "arg_3", ")", "arg_4", "=", "numpy", ".", "exp", "(", "arg_3", ")", "arg_5", "=", "arg_4", "/", "numpy", ".", "sum", "(", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Perform inference for a single step. Given an SDR input and a weight\n    matrix, return a predicted distribution.\n\n    :param patternNZ: list of the active indices from the output below\n    :param weightMatrix: numpy array of the weight matrix\n    :return: numpy array of the predicted class label distribution\n    \"\"\"\n    arg_3 = arg_2[arg_1].sum(axis=0)\n\n    # softmax normalization\n    arg_3 = arg_3 - numpy.max(arg_3)\n    arg_4 = numpy.exp(arg_3)\n    arg_5 = arg_4 / numpy.sum(arg_4)\n    return arg_5", "path": "src/nupic/algorithms/sdr_classifier.py", "identifier": "SDRClassifier.inferSingleStep", "docstring": "Perform inference for a single step. Given an SDR input and a weight\n    matrix, return a predicted distribution.\n\n    :param patternNZ: list of the active indices from the output below\n    :param weightMatrix: numpy array of the weight matrix\n    :return: numpy array of the predicted class label distribution", "docstring_tokens": ["Perform", "inference", "for", "a", "single", "step", ".", "Given", "an", "SDR", "input", "and", "a", "weight", "matrix", "return", "a", "predicted", "distribution", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254161}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3220-L3234", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a link dictionary.", "language": "python", "parameters": "(self, copy=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", ":", "return", "arg_0", ".", "_links", ".", "copy", "(", ")", "else", ":", "return", "arg_0", ".", "_links"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Returns a link dictionary.\n\n        :param copy:\n\n            Whether the group's original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n\n        :returns: Dictionary of nodes\n\n        \"\"\"\n        if arg_1:\n            return arg_0._links.copy()\n        else:\n            return arg_0._links", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_get_links", "docstring": "Returns a link dictionary.\n\n        :param copy:\n\n            Whether the group's original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n\n        :returns: Dictionary of nodes", "docstring_tokens": ["Returns", "a", "link", "dictionary", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254162}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/confluence.py#L191-L205", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a Confluence summary JSON list.", "language": "python", "parameters": "(raw_json)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_0", ")", "arg_2", "=", "arg_1", "[", "'results'", "]", "for", "arg_3", "in", "arg_2", ":", "yield", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Parse a Confluence summary JSON list.\n\n        The method parses a JSON stream and returns an iterator\n        of diccionaries. Each dictionary is a content summary.\n\n        :param raw_json: JSON string to parse\n\n        :returns: a generator of parsed content summaries.\n        \"\"\"\n        arg_1 = json.loads(arg_0)\n\n        arg_2 = arg_1['results']\n        for arg_3 in arg_2:\n            yield arg_3", "path": "perceval/backends/core/confluence.py", "identifier": "Confluence.parse_contents_summary", "docstring": "Parse a Confluence summary JSON list.\n\n        The method parses a JSON stream and returns an iterator\n        of diccionaries. Each dictionary is a content summary.\n\n        :param raw_json: JSON string to parse\n\n        :returns: a generator of parsed content summaries.", "docstring_tokens": ["Parse", "a", "Confluence", "summary", "JSON", "list", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 254163}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L912-L920", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Handle marking messages as read and keeping client active.", "language": "python", "parameters": "(self, size, key)", "return_statement": "return super().keypress(size, key)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_coroutine_queue", ".", "put", "(", "arg_0", ".", "_client", ".", "set_active", "(", ")", ")", "arg_0", ".", "_coroutine_queue", ".", "put", "(", "arg_0", ".", "_conversation", ".", "update_read_timestamp", "(", ")", ")", "return", "super", "(", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle marking messages as read and keeping client active.\"\"\"\n        # Set the client as active.\n        arg_0._coroutine_queue.put(arg_0._client.set_active())\n\n        # Mark the newest event as read.\n        arg_0._coroutine_queue.put(arg_0._conversation.update_read_timestamp())\n\n        return super().Func(arg_1, arg_2)", "path": "hangups/ui/__main__.py", "identifier": "ConversationWidget.keypress", "docstring": "Handle marking messages as read and keeping client active.", "docstring_tokens": ["Handle", "marking", "messages", "as", "read", "and", "keeping", "client", "active", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 254164}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/utils.py#L99-L111", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Decorator so that functions can be written to work on Series but\n    may still be called with DataFrames.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_1", ".", "ndim", "==", "1", ":", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "elif", "arg_1", ".", "ndim", "==", "2", ":", "return", "arg_1", ".", "apply", "(", "arg_0", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator so that functions can be written to work on Series but\n    may still be called with DataFrames.\n    \"\"\"\n\n    def wrapper(arg_1, *arg_2, **arg_3):\n        if arg_1.ndim == 1:\n            return arg_0(arg_1, *arg_2, **arg_3)\n        elif arg_1.ndim == 2:\n            return arg_1.apply(arg_0, *arg_2, **arg_3)\n\n    return wrapper", "path": "pyfolio/utils.py", "identifier": "vectorize", "docstring": "Decorator so that functions can be written to work on Series but\n    may still be called with DataFrames.", "docstring_tokens": ["Decorator", "so", "that", "functions", "can", "be", "written", "to", "work", "on", "Series", "but", "may", "still", "be", "called", "with", "DataFrames", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 254165}
{"url": "https://github.com/algofairness/BlackBoxAuditing/blob/b06c4faed5591cd7088475b2a203127bc5820483/BlackBoxAuditing/model_factories/DecisionTree.py#L142-L190", "sha": "b06c4faed5591cd7088475b2a203127bc5820483", "docstring_summary": "Standardizes continuous features and expands categorical features.", "language": "python", "parameters": "(response_index, response_header, data_set, col_vals, headers, standardizers, feats_to_ignore, columns_to_expand, outcome_trans_dict)", "return_statement": "return modified_set, expanded_headers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", ":", "arg_9", "=", "[", "]", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_2", ")", ":", "arg_12", "=", "[", "]", "for", "arg_13", ",", "arg_14", "in", "enumerate", "(", "arg_11", ")", ":", "arg_15", "=", "arg_4", "[", "arg_13", "]", "if", "arg_13", "==", "arg_0", ":", "arg_16", "=", "arg_8", "[", "arg_14", "]", "arg_12", ".", "append", "(", "arg_16", ")", "elif", "arg_15", "in", "arg_6", ":", "pass", "elif", "arg_15", "in", "arg_7", ":", "for", "arg_17", "in", "arg_3", "[", "arg_15", "]", ":", "if", "arg_14", "==", "arg_17", ":", "arg_18", "=", "1.0", "else", ":", "arg_18", "=", "-", "1.0", "arg_12", ".", "append", "(", "arg_18", ")", "else", ":", "arg_19", "=", "float", "(", "(", "arg_14", "-", "arg_5", "[", "arg_15", "]", "[", "'mean'", "]", ")", "/", "arg_5", "[", "arg_15", "]", "[", "'std_dev'", "]", ")", "arg_12", ".", "append", "(", "arg_19", ")", "arg_9", ".", "append", "(", "arg_12", ")", "arg_20", "=", "[", "]", "for", "arg_15", "in", "arg_4", ":", "if", "arg_15", "in", "arg_6", ":", "pass", "elif", "(", "arg_15", "in", "arg_7", ")", "and", "(", "arg_15", "is", "not", "arg_1", ")", ":", "for", "arg_17", "in", "arg_3", "[", "arg_15", "]", ":", "arg_21", "=", "'{}_{}'", ".", "format", "(", "arg_15", ",", "arg_17", ")", "arg_20", ".", "append", "(", "arg_21", ")", "else", ":", "arg_20", ".", "append", "(", "arg_15", ")", "return", "arg_9", ",", "arg_20"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8):\n  \"\"\"\n  Standardizes continuous features and expands categorical features.\n  \"\"\"\n  # expand and standardize\n  arg_9 = []\n  for arg_10, arg_11 in enumerate(arg_2):\n    arg_12 = []\n    for arg_13, arg_14 in enumerate(arg_11):\n      arg_15 = arg_4[arg_13]\n\n      # Outcome feature -> index outcome\n      if arg_13 == arg_0:\n        arg_16 = arg_8[arg_14]\n        arg_12.append(arg_16)\n\n      # Ignored feature -> pass\n      elif arg_15 in arg_6:\n        pass\n      \n      # Categorical feature -> create new binary column for each possible value of the column\n      elif arg_15 in arg_7:\n        for arg_17 in arg_3[arg_15]:\n          if arg_14 == arg_17:\n            arg_18 = 1.0\n          else:\n            arg_18 = -1.0\n          arg_12.append(arg_18)\n\n      # Continuous feature -> standardize value with respect to its column\n      else:\n        arg_19 = float((arg_14 - arg_5[arg_15]['mean']) / arg_5[arg_15]['std_dev'])\n        arg_12.append(arg_19)\n\n    arg_9.append(arg_12)\n\n  # update headers to reflect column expansion\n  arg_20 = []\n  for arg_15 in arg_4:\n    if arg_15 in arg_6:\n      pass\n    elif (arg_15 in arg_7) and (arg_15 is not arg_1):\n      for arg_17 in arg_3[arg_15]:\n        arg_21 = '{}_{}'.format(arg_15,arg_17)\n        arg_20.append(arg_21)\n    else:\n      arg_20.append(arg_15)\n\n  return arg_9, arg_20", "path": "BlackBoxAuditing/model_factories/DecisionTree.py", "identifier": "expand_and_standardize_dataset", "docstring": "Standardizes continuous features and expands categorical features.", "docstring_tokens": ["Standardizes", "continuous", "features", "and", "expands", "categorical", "features", "."], "nwo": "algofairness/BlackBoxAuditing", "score": 0.5604848026459739, "idx": 254166}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/internal/util.py#L164-L198", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Attempt to sum MultivariateNormal distributions.", "language": "python", "parameters": "(distributions)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "tensor", "for", "distribution", "in", "arg_0", "for", "tensor", "in", "distribution", ".", "_graph_parents", "]", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "'Func'", ",", "values", "=", "arg_1", ")", ":", "if", "all", "(", "[", "isinstance", "(", "arg_2", ",", "tfd", ".", "MultivariateNormalDiag", ")", "for", "arg_2", "in", "arg_0", "]", ")", ":", "return", "tfd", ".", "MultivariateNormalDiag", "(", "loc", "=", "sum", "(", "[", "arg_2", ".", "mean", "(", ")", "for", "arg_2", "in", "arg_0", "]", ")", ",", "scale_diag", "=", "tf", ".", "sqrt", "(", "sum", "(", "[", "arg_2", ".", "scale", ".", "diag", "**", "2", "for", "arg_2", "in", "arg_0", "]", ")", ")", ")", "else", ":", "raise", "NotImplementedError", "(", "'Sums of distributions other than MultivariateNormalDiag are not '", "'currently implemented. (given: {})'", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n  \"\"\"Attempt to sum MultivariateNormal distributions.\n\n  The sum of (multivariate) normal random variables is itself (multivariate)\n  normal, with mean given by the sum of means and (co)variance given by the\n  sum of (co)variances. This method exploits this fact to compute the\n  sum of a list of `tfd.MultivariateNormalDiag` objects.\n\n  It may in the future be extended to support summation of other forms of\n  (Multivariate)Normal distributions.\n\n  Args:\n    distributions: Python `iterable` of `tfd.MultivariateNormalDiag`\n      distribution instances. These must all have the same event\n      shape, and broadcast to a consistent batch shape.\n\n  Returns:\n    sum_distribution: A `tfd.MultivariateNormalDiag` instance with mean\n      equal to the sum of input means and covariance equal to the sum of\n      input covariances.\n  \"\"\"\n\n  arg_1 = [tensor for distribution in arg_0\n                   for tensor in distribution._graph_parents]  # pylint: disable=protected-access\n  with tf.compat.v1.name_scope('Func', values=arg_1):\n    if all([isinstance(arg_2, tfd.MultivariateNormalDiag)\n            for arg_2 in arg_0]):\n      return tfd.MultivariateNormalDiag(\n          loc=sum([arg_2.mean() for arg_2 in arg_0]),\n          scale_diag=tf.sqrt(sum([\n              arg_2.scale.diag**2 for arg_2 in arg_0])))\n    else:\n      raise NotImplementedError(\n          'Sums of distributions other than MultivariateNormalDiag are not '\n          'currently implemented. (given: {})'.format(arg_0))", "path": "tensorflow_probability/python/sts/internal/util.py", "identifier": "sum_mvns", "docstring": "Attempt to sum MultivariateNormal distributions.\n\n  The sum of (multivariate) normal random variables is itself (multivariate)\n  normal, with mean given by the sum of means and (co)variance given by the\n  sum of (co)variances. This method exploits this fact to compute the\n  sum of a list of `tfd.MultivariateNormalDiag` objects.\n\n  It may in the future be extended to support summation of other forms of\n  (Multivariate)Normal distributions.\n\n  Args:\n    distributions: Python `iterable` of `tfd.MultivariateNormalDiag`\n      distribution instances. These must all have the same event\n      shape, and broadcast to a consistent batch shape.\n\n  Returns:\n    sum_distribution: A `tfd.MultivariateNormalDiag` instance with mean\n      equal to the sum of input means and covariance equal to the sum of\n      input covariances.", "docstring_tokens": ["Attempt", "to", "sum", "MultivariateNormal", "distributions", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254167}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L162-L194", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Emulate a single instruction.", "language": "python", "parameters": "(self, instruction)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "True", ":", "arg_0", ".", "reset", "(", ")", "for", "arg_2", "in", "arg_0", ".", "_should_be_mapped", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_should_be_mapped", "[", "arg_2", "]", "arg_0", ".", "_emu", ".", "mem_map", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "_should_be_written", ".", "items", "(", ")", ":", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_6", ",", "start", "=", "arg_5", ")", ":", "if", "issymbolic", "(", "arg_8", ")", ":", "from", ".", ".", "native", ".", "cpu", ".", "abstractcpu", "import", "ConcretizeMemory", "raise", "ConcretizeMemory", "(", "arg_0", ".", "_cpu", ".", "memory", ",", "arg_7", ",", "8", ",", "\"Concretizing for emulation\"", ")", "arg_0", ".", "_emu", ".", "mem_write", "(", "arg_5", ",", "b''", ".", "join", "(", "arg_6", ")", ")", "arg_0", ".", "_should_try_again", "=", "False", "arg_0", ".", "_step", "(", "arg_1", ")", "if", "not", "arg_0", ".", "_should_try_again", ":", "break"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Emulate a single instruction.\n        \"\"\"\n\n        # The emulation might restart if Unicorn needs to bring in a memory map\n        # or bring a value from Manticore state.\n        while True:\n\n            arg_0.reset()\n\n            # Establish Manticore state, potentially from past emulation\n            # attempts\n            for arg_2 in arg_0._should_be_mapped:\n                arg_3, arg_4 = arg_0._should_be_mapped[arg_2]\n                arg_0._emu.mem_map(arg_2, arg_3, arg_4)\n\n            for arg_5, arg_6 in arg_0._should_be_written.items():\n                for arg_7, arg_8 in enumerate(arg_6, start=arg_5):\n                    if issymbolic(arg_8):\n                        from ..native.cpu.abstractcpu import ConcretizeMemory\n                        raise ConcretizeMemory(arg_0._cpu.memory, arg_7, 8,\n                                               \"Concretizing for emulation\")\n\n                arg_0._emu.mem_write(arg_5, b''.join(arg_6))\n\n            # Try emulation\n            arg_0._should_try_again = False\n\n            arg_0._step(arg_1)\n\n            if not arg_0._should_try_again:\n                break", "path": "manticore/utils/fallback_emulator.py", "identifier": "UnicornEmulator.emulate", "docstring": "Emulate a single instruction.", "docstring_tokens": ["Emulate", "a", "single", "instruction", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254168}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/examples/john_smith_chunk_writer.py#L20-L25", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "yield all file paths under input_dir", "language": "python", "parameters": "(input_dir)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "os", ".", "walk", "(", "arg_0", ")", ":", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", "yield", "arg_5"], "function": "def Func(arg_0):\n    'yield all file Func under input_dir'\n    for arg_1, arg_2, arg_3 in os.walk(arg_0):\n        for arg_4 in arg_3:\n            arg_5 = os.path.join(arg_1, arg_4)\n            yield arg_5", "path": "examples/john_smith_chunk_writer.py", "identifier": "paths", "docstring": "yield all file paths under input_dir", "docstring_tokens": ["yield", "all", "file", "paths", "under", "input_dir"], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 254169}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/commands/search.py#L64-L101", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "The list from pypi is really a list of versions. We want a list of\n    packages with the list of versions stored inline. This converts the\n    list from pypi into one we can use.", "language": "python", "parameters": "(hits)", "return_statement": "return package_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "arg_2", "[", "'name'", "]", "arg_4", "=", "arg_2", "[", "'summary'", "]", "arg_5", "=", "arg_2", "[", "'version'", "]", "arg_6", "=", "arg_2", "[", "'_pypi_ordering'", "]", "if", "arg_6", "is", "None", ":", "arg_6", "=", "0", "if", "arg_3", "not", "in", "arg_1", ".", "keys", "(", ")", ":", "arg_1", "[", "arg_3", "]", "=", "{", "'name'", ":", "arg_3", ",", "'summary'", ":", "arg_4", ",", "'versions'", ":", "[", "arg_5", "]", ",", "'score'", ":", "arg_6", ",", "}", "else", ":", "arg_1", "[", "arg_3", "]", "[", "'versions'", "]", ".", "append", "(", "arg_5", ")", "if", "arg_5", "==", "highest_version", "(", "arg_1", "[", "arg_3", "]", "[", "'versions'", "]", ")", ":", "arg_1", "[", "arg_3", "]", "[", "'summary'", "]", "=", "arg_4", "arg_1", "[", "arg_3", "]", "[", "'score'", "]", "=", "arg_6", "arg_7", "=", "sorted", "(", "arg_1", ".", "values", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", "[", "'score'", "]", ",", "reverse", "=", "True", ",", ")", "return", "arg_7"], "function": "def Func(arg_0):\n    \"\"\"\n    The list from pypi is really a list of versions. We want a list of\n    packages with the list of versions stored inline. This converts the\n    list from pypi into one we can use.\n    \"\"\"\n    arg_1 = {}\n    for arg_2 in arg_0:\n        arg_3 = arg_2['name']\n        arg_4 = arg_2['summary']\n        arg_5 = arg_2['version']\n        arg_6 = arg_2['_pypi_ordering']\n        if arg_6 is None:\n            arg_6 = 0\n\n        if arg_3 not in arg_1.keys():\n            arg_1[arg_3] = {\n                'name': arg_3,\n                'summary': arg_4,\n                'versions': [arg_5],\n                'score': arg_6,\n            }\n        else:\n            arg_1[arg_3]['versions'].append(arg_5)\n\n            # if this is the highest version, replace summary and score\n            if arg_5 == highest_version(arg_1[arg_3]['versions']):\n                arg_1[arg_3]['summary'] = arg_4\n                arg_1[arg_3]['score'] = arg_6\n\n    # each record has a unique name now, so we will convert the dict into a\n    # list sorted by score\n    arg_7 = sorted(\n        arg_1.values(),\n        key=lambda x: x['score'],\n        reverse=True,\n    )\n    return arg_7", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/commands/search.py", "identifier": "transform_hits", "docstring": "The list from pypi is really a list of versions. We want a list of\n    packages with the list of versions stored inline. This converts the\n    list from pypi into one we can use.", "docstring_tokens": ["The", "list", "from", "pypi", "is", "really", "a", "list", "of", "versions", ".", "We", "want", "a", "list", "of", "packages", "with", "the", "list", "of", "versions", "stored", "inline", ".", "This", "converts", "the", "list", "from", "pypi", "into", "one", "we", "can", "use", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254170}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/result/postprocess.py#L86-L104", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Format an experiment result memory object for measurement level 0.", "language": "python", "parameters": "(memory)", "return_statement": "return formatted_memory", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_list_to_complex_array", "(", "arg_0", ")", "if", "not", "2", "<=", "len", "(", "arg_1", ".", "shape", ")", "<=", "3", ":", "raise", "QiskitError", "(", "'Level zero memory is not of correct shape.'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" Format an experiment result memory object for measurement level 0.\n\n    Args:\n        memory (list): Memory from experiment with `meas_level==1`. `avg` or\n            `single` will be inferred from shape of result memory.\n\n    Returns:\n        np.ndarray: Measurement level 0 complex numpy array\n\n    Raises:\n        QiskitError: If the returned numpy array does not have 2 (avg) or 3 (single)\n            indicies.\n    \"\"\"\n    arg_1 = _list_to_complex_array(arg_0)\n    # infer meas_return from shape of returned data.\n    if not 2 <= len(arg_1.shape) <= 3:\n        raise QiskitError('Level zero memory is not of correct shape.')\n    return arg_1", "path": "qiskit/result/postprocess.py", "identifier": "format_level_0_memory", "docstring": "Format an experiment result memory object for measurement level 0.\n\n    Args:\n        memory (list): Memory from experiment with `meas_level==1`. `avg` or\n            `single` will be inferred from shape of result memory.\n\n    Returns:\n        np.ndarray: Measurement level 0 complex numpy array\n\n    Raises:\n        QiskitError: If the returned numpy array does not have 2 (avg) or 3 (single)\n            indicies.", "docstring_tokens": ["Format", "an", "experiment", "result", "memory", "object", "for", "measurement", "level", "0", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254171}
{"url": "https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L95-L121", "sha": "148b700c5846d8fdafc562d4326587da5447223f", "docstring_summary": "Remove a listener from the emitter.", "language": "python", "parameters": "(self, event, listener)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "contextlib", ".", "suppress", "(", "ValueError", ")", ":", "arg_0", ".", "_listeners", "[", "arg_1", "]", ".", "remove", "(", "arg_2", ")", "return", "True", "with", "contextlib", ".", "suppress", "(", "ValueError", ")", ":", "arg_0", ".", "_once", "[", "arg_1", "]", ".", "remove", "(", "arg_2", ")", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Remove a listener from the emitter.\n\n        Args:\n            event (str): The event name on which the listener is bound.\n            listener: A reference to the same object given to add_listener.\n\n        Returns:\n            bool: True if a listener was removed else False.\n\n        This method only removes one listener at a time. If a listener is\n        attached multiple times then this method must be called repeatedly.\n        Additionally, this method removes listeners first from the those\n        registered with 'on' or 'add_listener'. If none are found it continue\n        to remove afterwards from those added with 'once'.\n        \"\"\"\n        with contextlib.suppress(ValueError):\n\n            arg_0._listeners[arg_1].remove(arg_2)\n            return True\n\n        with contextlib.suppress(ValueError):\n\n            arg_0._once[arg_1].remove(arg_2)\n            return True\n\n        return False", "path": "eventemitter/emitter.py", "identifier": "EventEmitter.remove_listener", "docstring": "Remove a listener from the emitter.\n\n        Args:\n            event (str): The event name on which the listener is bound.\n            listener: A reference to the same object given to add_listener.\n\n        Returns:\n            bool: True if a listener was removed else False.\n\n        This method only removes one listener at a time. If a listener is\n        attached multiple times then this method must be called repeatedly.\n        Additionally, this method removes listeners first from the those\n        registered with 'on' or 'add_listener'. If none are found it continue\n        to remove afterwards from those added with 'once'.", "docstring_tokens": ["Remove", "a", "listener", "from", "the", "emitter", "."], "nwo": "asyncdef/eventemitter", "score": 0.1832591465193378, "idx": 254172}
{"url": "https://github.com/calebsmith/django-template-debug/blob/f3d52638da571164d63e5c8331d409b0743c628f/template_debug/templatetags/debug_tags.py#L26-L36", "sha": "f3d52638da571164d63e5c8331d409b0743c628f", "docstring_summary": "Given a dictionary of variable attribute data from get_details display the\n    data in the terminal.", "language": "python", "parameters": "(var_data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "arg_2", "for", "arg_2", "in", "list", "(", "arg_0", ".", "keys", "(", ")", ")", "if", "arg_2", ".", "startswith", "(", "'META_'", ")", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "arg_2", "[", "5", ":", "]", ".", "capitalize", "(", ")", "pprint", "(", "'{0}: {1}'", ".", "format", "(", "arg_3", ",", "arg_0", ".", "pop", "(", "arg_2", ")", ")", ")", "pprint", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Given a dictionary of variable attribute data from get_details display the\n    data in the terminal.\n    \"\"\"\n    arg_1 = (arg_2 for arg_2 in list(arg_0.keys())\n                 if arg_2.startswith('META_'))\n    for arg_2 in arg_1:\n        arg_3 = arg_2[5:].capitalize()\n        pprint('{0}: {1}'.format(arg_3, arg_0.pop(arg_2)))\n    pprint(arg_0)", "path": "template_debug/templatetags/debug_tags.py", "identifier": "_display_details", "docstring": "Given a dictionary of variable attribute data from get_details display the\n    data in the terminal.", "docstring_tokens": ["Given", "a", "dictionary", "of", "variable", "attribute", "data", "from", "get_details", "display", "the", "data", "in", "the", "terminal", "."], "nwo": "calebsmith/django-template-debug", "score": 0.31606306836212245, "idx": 254173}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/virtualbox/__init__.py#L64-L71", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "We use VBox directly instead of Docker Machine because it\n    shaves about 0.5 seconds off the runtime of this check.", "language": "python", "parameters": "()", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "check_output_demoted", "(", "[", "'VBoxManage'", ",", "'list'", ",", "'vms'", "]", ")", "for", "arg_1", "in", "arg_0", ".", "splitlines", "(", ")", ":", "if", "'\"{}\"'", ".", "format", "(", "constants", ".", "VM_MACHINE_NAME", ")", "in", "arg_1", ":", "return", "True", "return", "False"], "function": "def Func():\n    \"\"\"We use VBox directly instead of Docker Machine because it\n    shaves about 0.5 seconds off the runtime of this check.\"\"\"\n    arg_0 = check_output_demoted(['VBoxManage', 'list', 'vms'])\n    for arg_1 in arg_0.splitlines():\n        if '\"{}\"'.format(constants.VM_MACHINE_NAME) in arg_1:\n            return True\n    return False", "path": "dusty/systems/virtualbox/__init__.py", "identifier": "_dusty_vm_exists", "docstring": "We use VBox directly instead of Docker Machine because it\n    shaves about 0.5 seconds off the runtime of this check.", "docstring_tokens": ["We", "use", "VBox", "directly", "instead", "of", "Docker", "Machine", "because", "it", "shaves", "about", "0", ".", "5", "seconds", "off", "the", "runtime", "of", "this", "check", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 254174}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L330-L337", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val is iterable and contains duplicate items.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "if", "len", "(", "arg_0", ".", "val", ")", "!=", "len", "(", "set", "(", "arg_0", ".", "val", ")", ")", ":", "return", "arg_0", "except", "TypeError", ":", "raise", "TypeError", "(", "'val is not iterable'", ")", "arg_0", ".", "_err", "(", "'Expected <%s> to contain duplicates, but did not.'", "%", "arg_0", ".", "val", ")"], "function": "def Func(arg_0):\n        \"\"\"Asserts that val is iterable and contains duplicate items.\"\"\"\n        try:\n            if len(arg_0.val) != len(set(arg_0.val)):\n                return arg_0\n        except TypeError:\n            raise TypeError('val is not iterable')\n        arg_0._err('Expected <%s> to contain duplicates, but did not.' % arg_0.val)", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.contains_duplicates", "docstring": "Asserts that val is iterable and contains duplicate items.", "docstring_tokens": ["Asserts", "that", "val", "is", "iterable", "and", "contains", "duplicate", "items", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 254175}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_utils.py#L35-L49", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "A property factory that will dispatch the to a specific validator function\n    that will validate the user's input to ensure critical parameters are of a\n    specific type.", "language": "python", "parameters": "(attr)", "return_statement": "return property(fget=getter, fset=setter)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "getter", "(", "arg_1", ")", ":", "return", "arg_1", ".", "__dict__", "[", "arg_0", "]", "def", "setter", "(", "arg_1", ",", "arg_2", ")", ":", "validate_input", "(", "arg_1", ".", "__class__", ".", "__name__", ",", "arg_0", ",", "arg_2", ")", "arg_1", ".", "__dict__", "[", "arg_0", "]", "=", "arg_2", "return", "property", "(", "fget", "=", "getter", ",", "fset", "=", "setter", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    A property factory that will dispatch the to a specific validator function\n    that will validate the user's input to ensure critical parameters are of a\n    specific type.\n    \"\"\"\n\n    def getter(arg_1):\n        return arg_1.__dict__[arg_0]\n\n    def setter(arg_1, arg_2):\n        validate_input(arg_1.__class__.__name__, arg_0, arg_2)\n        arg_1.__dict__[arg_0] = arg_2\n\n    return property(fget=getter, fset=setter)", "path": "messages/_utils.py", "identifier": "validate_property", "docstring": "A property factory that will dispatch the to a specific validator function\n    that will validate the user's input to ensure critical parameters are of a\n    specific type.", "docstring_tokens": ["A", "property", "factory", "that", "will", "dispatch", "the", "to", "a", "specific", "validator", "function", "that", "will", "validate", "the", "user", "s", "input", "to", "ensure", "critical", "parameters", "are", "of", "a", "specific", "type", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 254176}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L1608-L1690", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Draw all line strings onto a given image.", "language": "python", "parameters": "(self, image,\n                      color=(0, 255, 0), color_lines=None, color_points=None,\n                      alpha=1.0, alpha_lines=None, alpha_points=None,\n                      size=1, size_lines=None, size_points=None,\n                      antialiased=True,\n                      raise_if_out_of_image=False)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "0", ",", "255", ",", "0", ")", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "1.0", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "1", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "True", ",", "arg_12", "=", "False", ")", ":", "for", "arg_13", "in", "arg_0", ".", "line_strings", ":", "arg_1", "=", "arg_13", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1,\n                      arg_2=(0, 255, 0), arg_3=None, arg_4=None,\n                      arg_5=1.0, arg_6=None, arg_7=None,\n                      arg_8=1, arg_9=None, arg_10=None,\n                      arg_11=True,\n                      arg_12=False):\n        \"\"\"\n        Draw all line strings onto a given image.\n\n        Parameters\n        ----------\n        image : ndarray\n            The `(H,W,C)` `uint8` image onto which to draw the line strings.\n\n        color : iterable of int, optional\n            Color to use as RGB, i.e. three values.\n            The color of the lines and points are derived from this value,\n            unless they are set.\n\n        color_lines : None or iterable of int\n            Color to use for the line segments as RGB, i.e. three values.\n            If ``None``, this value is derived from `color`.\n\n        color_points : None or iterable of int\n            Color to use for the points as RGB, i.e. three values.\n            If ``None``, this value is derived from ``0.5 * color``.\n\n        alpha : float, optional\n            Opacity of the line strings. Higher values denote more visible\n            points.\n            The alphas of the line and points are derived from this value,\n            unless they are set.\n\n        alpha_lines : None or float, optional\n            Opacity of the line strings. Higher values denote more visible\n            line string.\n            If ``None``, this value is derived from `alpha`.\n\n        alpha_points : None or float, optional\n            Opacity of the line string points. Higher values denote more\n            visible points.\n            If ``None``, this value is derived from `alpha`.\n\n        size : int, optional\n            Size of the line strings.\n            The sizes of the line and points are derived from this value,\n            unless they are set.\n\n        size_lines : None or int, optional\n            Thickness of the line segments.\n            If ``None``, this value is derived from `size`.\n\n        size_points : None or int, optional\n            Size of the points in pixels.\n            If ``None``, this value is derived from ``3 * size``.\n\n        antialiased : bool, optional\n            Whether to draw the lines with anti-aliasing activated.\n            This does currently not affect the point drawing.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if a line string is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        ndarray\n            Image with line strings drawn on it.\n\n        \"\"\"\n        # TODO improve efficiency here by copying only once\n        for arg_13 in arg_0.line_strings:\n            arg_1 = arg_13.Func(\n                arg_1,\n                arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,\n                arg_5=arg_5, arg_6=arg_6, arg_7=arg_7,\n                arg_8=arg_8, arg_9=arg_9, arg_10=arg_10,\n                arg_11=arg_11,\n                arg_12=arg_12\n            )\n\n        return arg_1", "path": "imgaug/augmentables/lines.py", "identifier": "LineStringsOnImage.draw_on_image", "docstring": "Draw all line strings onto a given image.\n\n        Parameters\n        ----------\n        image : ndarray\n            The `(H,W,C)` `uint8` image onto which to draw the line strings.\n\n        color : iterable of int, optional\n            Color to use as RGB, i.e. three values.\n            The color of the lines and points are derived from this value,\n            unless they are set.\n\n        color_lines : None or iterable of int\n            Color to use for the line segments as RGB, i.e. three values.\n            If ``None``, this value is derived from `color`.\n\n        color_points : None or iterable of int\n            Color to use for the points as RGB, i.e. three values.\n            If ``None``, this value is derived from ``0.5 * color``.\n\n        alpha : float, optional\n            Opacity of the line strings. Higher values denote more visible\n            points.\n            The alphas of the line and points are derived from this value,\n            unless they are set.\n\n        alpha_lines : None or float, optional\n            Opacity of the line strings. Higher values denote more visible\n            line string.\n            If ``None``, this value is derived from `alpha`.\n\n        alpha_points : None or float, optional\n            Opacity of the line string points. Higher values denote more\n            visible points.\n            If ``None``, this value is derived from `alpha`.\n\n        size : int, optional\n            Size of the line strings.\n            The sizes of the line and points are derived from this value,\n            unless they are set.\n\n        size_lines : None or int, optional\n            Thickness of the line segments.\n            If ``None``, this value is derived from `size`.\n\n        size_points : None or int, optional\n            Size of the points in pixels.\n            If ``None``, this value is derived from ``3 * size``.\n\n        antialiased : bool, optional\n            Whether to draw the lines with anti-aliasing activated.\n            This does currently not affect the point drawing.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if a line string is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        ndarray\n            Image with line strings drawn on it.", "docstring_tokens": ["Draw", "all", "line", "strings", "onto", "a", "given", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254177}
{"url": "https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/botnet/worker.py#L123-L134", "sha": "f9d2bd6369aafe6cb0916c9406270ca8ecea2080", "docstring_summary": "\\\n        Received registration acknowledgement from the BotnetBot, as well as the\n        name of the command channel, so join up and indicate that registration\n        succeeded", "language": "python", "parameters": "(self, nick, message, channel, cmd_channel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_0", ".", "channel", "=", "arg_4", "arg_0", ".", "conn", ".", "join", "(", "arg_0", ".", "channel", ")", "arg_0", ".", "registered", ".", "set", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\\\n        Received registration acknowledgement from the BotnetBot, as well as the\n        name of the command channel, so join up and indicate that registration\n        succeeded\n        \"\"\"\n        # the boss will tell what channel to join\n        arg_0.channel = arg_4\n        arg_0.conn.join(arg_0.channel)\n        \n        # indicate that registered so we'll stop trying\n        arg_0.registered.set()", "path": "botnet/worker.py", "identifier": "BaseWorkerBot.register_success", "docstring": "\\\n        Received registration acknowledgement from the BotnetBot, as well as the\n        name of the command channel, so join up and indicate that registration\n        succeeded", "docstring_tokens": ["\\", "Received", "registration", "acknowledgement", "from", "the", "BotnetBot", "as", "well", "as", "the", "name", "of", "the", "command", "channel", "so", "join", "up", "and", "indicate", "that", "registration", "succeeded"], "nwo": "coleifer/irc", "score": 0.28749967694495965, "idx": 254178}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/run.py#L61-L95", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "given a config dict with streamcorpus_pipeline as a key, find all\n    keys under streamcorpus_pipeline that end with \"_path\" and if the\n    value of that key is a relative path, convert it to an absolute\n    path using the value provided by root_path", "language": "python", "parameters": "(config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "'streamcorpus_pipeline'", "in", "arg_0", ":", "logger", ".", "critical", "(", "'bad config: %r'", ",", "arg_0", ")", "raise", "ConfigurationError", "(", "'missing \"streamcorpus_pipeline\" from config'", ")", "arg_1", "=", "arg_0", "[", "'streamcorpus_pipeline'", "]", ".", "pop", "(", "'root_path'", ",", "None", ")", "if", "not", "arg_1", ":", "arg_1", "=", "os", ".", "getcwd", "(", ")", "if", "not", "arg_1", ".", "startswith", "(", "'/'", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_1", ")", "def", "recursive_abs_path", "(", "arg_2", ",", "arg_1", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_4", ",", "basestring", ")", ":", "if", "arg_3", ".", "endswith", "(", "'path'", ")", ":", "if", "re", ".", "match", "(", "'^http.?://'", ",", "arg_4", ")", ":", "continue", "if", "not", "arg_4", ".", "startswith", "(", "'/'", ")", ":", "arg_2", "[", "arg_3", "]", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", "elif", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "recursive_abs_path", "(", "arg_4", ",", "arg_1", ")", "recursive_abs_path", "(", "arg_0", ",", "arg_1", ")", "arg_0", "[", "'root_path'", "]", "=", "arg_1"], "function": "def Func(arg_0):\n    '''given a config dict with streamcorpus_pipeline as a key, find all\n    keys under streamcorpus_pipeline that end with \"_path\" and if the\n    value of that key is a relative path, convert it to an absolute\n    path using the value provided by root_path\n    '''\n    if not 'streamcorpus_pipeline' in arg_0:\n        logger.critical('bad config: %r', arg_0)\n        raise ConfigurationError('missing \"streamcorpus_pipeline\" from config')\n    ## remove the root_path, so it does not get extended itself\n    arg_1 = arg_0['streamcorpus_pipeline'].pop('root_path', None)\n    if not arg_1:\n        arg_1 = os.getcwd()\n\n    if not arg_1.startswith('/'):\n        arg_1 = os.path.join( os.getcwd(), arg_1 )\n\n    def recursive_abs_path( arg_2, arg_1 ):\n        for arg_3, arg_4 in arg_2.items():\n            if isinstance(arg_4, basestring):\n                if arg_3.endswith('path'):\n                    ## ignore URLs in *_path parameters\n                    if re.match('^http.?://', arg_4): continue\n                    ## we have a path... is it already absolute?\n                    if not arg_4.startswith('/'):\n                        ## make the path absolute\n                        arg_2[arg_3] = os.path.join(arg_1, arg_4)\n\n            elif isinstance(arg_4, dict):\n                recursive_abs_path( arg_4, arg_1 )\n\n    recursive_abs_path( arg_0, arg_1 )\n\n    ## put the root_path back\n    arg_0['root_path'] = arg_1", "path": "streamcorpus_pipeline/run.py", "identifier": "make_absolute_paths", "docstring": "given a config dict with streamcorpus_pipeline as a key, find all\n    keys under streamcorpus_pipeline that end with \"_path\" and if the\n    value of that key is a relative path, convert it to an absolute\n    path using the value provided by root_path", "docstring_tokens": ["given", "a", "config", "dict", "with", "streamcorpus_pipeline", "as", "a", "key", "find", "all", "keys", "under", "streamcorpus_pipeline", "that", "end", "with", "_path", "and", "if", "the", "value", "of", "that", "key", "is", "a", "relative", "path", "convert", "it", "to", "an", "absolute", "path", "using", "the", "value", "provided", "by", "root_path"], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 254179}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_run_lingpipe.py#L60-L100", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "run child process to get OWPL output", "language": "python", "parameters": "(tagger_id, tmp_cleansed_path, tmp_ner_path, pipeline_root)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "dict", "(", "INPUT_FILE", "=", "arg_1", ",", "OUTPUT_FILE", "=", "arg_2", ",", "PIPELINE_ROOT", "=", "arg_3", ")", "arg_5", "=", "pipeline_cmd_templates", "[", "arg_0", "]", "%", "arg_4", "print", "arg_5", "print", "'creating %s'", "%", "arg_2", "arg_6", "=", "time", ".", "time", "(", ")", "arg_7", "=", "subprocess", ".", "Popen", "(", "arg_5", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "shell", "=", "True", ")", "arg_8", ",", "arg_9", "=", "arg_7", ".", "communicate", "(", ")", "assert", "arg_7", ".", "returncode", "==", "0", "and", "'Exception'", "not", "in", "arg_9", ",", "arg_9", "arg_10", "=", "time", ".", "time", "(", ")", "-", "arg_6", "print", "'created %s in %.1f sec'", "%", "(", "arg_2", ",", "arg_10", ")", "'''    postproc_cmd = postproc_cmd_templates[tagger_id] % params    print postproc_cmd    ## replace this with log.info()    print 'creating %s' % tmp_ner_raw_path    start_time = time.time()    gpg_child = subprocess.Popen(        postproc_cmd,        stderr=subprocess.PIPE, shell=True)    s_out, errors = gpg_child.communicate()    assert gpg_child.returncode == 0 and 'Exception' not in errors, errors    elapsed = time.time() - start_time    ## replace this with log.info()    print 'created %s in %.1f sec' % (tmp_ner_path, elapsed)    '''"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''run child process to get OWPL output'''\n    arg_4 = dict(INPUT_FILE=arg_1,\n                  #RAW_OUTPUT_FILE=tmp_ner_raw_path,\n                  OUTPUT_FILE=arg_2,\n                  PIPELINE_ROOT=arg_3)\n    \n    arg_5 = pipeline_cmd_templates[arg_0] % arg_4\n\n    print arg_5\n\n    ## replace this with log.info()\n    print 'creating %s' % arg_2\n    arg_6 = time.time()\n    arg_7 = subprocess.Popen(\n        arg_5,\n        stderr=subprocess.PIPE, shell=True)\n    arg_8, arg_9 = arg_7.communicate()\n    assert arg_7.returncode == 0 and 'Exception' not in arg_9, arg_9\n    arg_10 = time.time() - arg_6\n    ## replace this with log.info()\n    print 'created %s in %.1f sec' % (arg_2, arg_10)\n\n    '''\n    postproc_cmd = postproc_cmd_templates[tagger_id] % params\n\n    print postproc_cmd\n\n    ## replace this with log.info()\n    print 'creating %s' % tmp_ner_raw_path\n    start_time = time.time()\n    gpg_child = subprocess.Popen(\n        postproc_cmd,\n        stderr=subprocess.PIPE, shell=True)\n    s_out, errors = gpg_child.communicate()\n    assert gpg_child.returncode == 0 and 'Exception' not in errors, errors\n    elapsed = time.time() - start_time\n\n    ## replace this with log.info()\n    print 'created %s in %.1f sec' % (tmp_ner_path, elapsed)\n    '''", "path": "streamcorpus_pipeline/_run_lingpipe.py", "identifier": "make_ner_file", "docstring": "run child process to get OWPL output", "docstring_tokens": ["run", "child", "process", "to", "get", "OWPL", "output"], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 254180}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L96-L150", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if the node is being used as an iterator.", "language": "python", "parameters": "(node)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "parent", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "For", ")", ":", "return", "True", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "Comprehension", ")", ":", "if", "arg_1", ".", "iter", "==", "arg_0", ":", "return", "True", "elif", "isinstance", "(", "arg_1", ",", "astroid", ".", "Call", ")", ":", "if", "isinstance", "(", "arg_1", ".", "func", ",", "astroid", ".", "Name", ")", ":", "arg_2", "=", "arg_1", ".", "func", ".", "lookup", "(", "arg_1", ".", "func", ".", "name", ")", "[", "0", "]", "if", "_is_builtin", "(", "arg_2", ")", "and", "arg_1", ".", "func", ".", "name", "in", "_ACCEPTS_ITERATOR", ":", "return", "True", "elif", "isinstance", "(", "arg_1", ".", "func", ",", "astroid", ".", "Attribute", ")", ":", "if", "arg_1", ".", "func", ".", "attrname", "in", "ATTRIBUTES_ACCEPTS_ITERATOR", ":", "return", "True", "arg_3", "=", "utils", ".", "safe_infer", "(", "arg_1", ".", "func", ")", "if", "arg_3", ":", "if", "arg_3", ".", "qname", "(", ")", "in", "_BUILTIN_METHOD_ACCEPTS_ITERATOR", ":", "return", "True", "arg_4", "=", "arg_3", ".", "root", "(", ")", "if", "arg_4", "and", "arg_4", ".", "name", "==", "\"itertools\"", ":", "return", "True", "elif", "isinstance", "(", "arg_1", ",", "astroid", ".", "Assign", ")", "and", "isinstance", "(", "arg_1", ".", "targets", "[", "0", "]", ",", "(", "astroid", ".", "List", ",", "astroid", ".", "Tuple", ")", ")", ":", "if", "len", "(", "arg_1", ".", "targets", "[", "0", "]", ".", "elts", ")", ">", "1", ":", "return", "True", "elif", "(", "isinstance", "(", "arg_1", ",", "astroid", ".", "Compare", ")", "and", "len", "(", "arg_1", ".", "ops", ")", "==", "1", "and", "arg_1", ".", "ops", "[", "0", "]", "[", "0", "]", "==", "\"in\"", ")", ":", "return", "True", "elif", "isinstance", "(", "arg_1", ",", "astroid", ".", "YieldFrom", ")", ":", "return", "True", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "Starred", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"Check if the node is being used as an iterator.\n\n    Definition is taken from lib2to3.fixer_util.in_special_context().\n    \"\"\"\n    arg_1 = arg_0.parent\n    # Since a call can't be the loop variant we only need to know if the node's\n    # parent is a 'for' loop to know it's being used as the iterator for the\n    # loop.\n    if isinstance(arg_1, astroid.For):\n        return True\n    # Need to make sure the use of the node is in the iterator part of the\n    # comprehension.\n    if isinstance(arg_1, astroid.Comprehension):\n        if arg_1.iter == arg_0:\n            return True\n    # Various built-ins can take in an iterable or list and lead to the same\n    # value.\n    elif isinstance(arg_1, astroid.Call):\n        if isinstance(arg_1.func, astroid.Name):\n            arg_2 = arg_1.func.lookup(arg_1.func.name)[0]\n            if _is_builtin(arg_2) and arg_1.func.name in _ACCEPTS_ITERATOR:\n                return True\n        elif isinstance(arg_1.func, astroid.Attribute):\n            if arg_1.func.attrname in ATTRIBUTES_ACCEPTS_ITERATOR:\n                return True\n\n        arg_3 = utils.safe_infer(arg_1.func)\n        if arg_3:\n            if arg_3.qname() in _BUILTIN_METHOD_ACCEPTS_ITERATOR:\n                return True\n            arg_4 = arg_3.root()\n            if arg_4 and arg_4.name == \"itertools\":\n                return True\n    # If the call is in an unpacking, there's no need to warn,\n    # since it can be considered iterating.\n    elif isinstance(arg_1, astroid.Assign) and isinstance(\n        arg_1.targets[0], (astroid.List, astroid.Tuple)\n    ):\n        if len(arg_1.targets[0].elts) > 1:\n            return True\n    # If the call is in a containment check, we consider that to\n    # be an iterating context\n    elif (\n        isinstance(arg_1, astroid.Compare)\n        and len(arg_1.ops) == 1\n        and arg_1.ops[0][0] == \"in\"\n    ):\n        return True\n    # Also if it's an `yield from`, that's fair\n    elif isinstance(arg_1, astroid.YieldFrom):\n        return True\n    if isinstance(arg_1, astroid.Starred):\n        return True\n    return False", "path": "pylint/checkers/python3.py", "identifier": "_in_iterating_context", "docstring": "Check if the node is being used as an iterator.\n\n    Definition is taken from lib2to3.fixer_util.in_special_context().", "docstring_tokens": ["Check", "if", "the", "node", "is", "being", "used", "as", "an", "iterator", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254181}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/passes/topython.py#L246-L260", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Generates python code for a clause repeated 1 or more times.", "language": "python", "parameters": "(self, node: parsing.Rep0N)", "return_statement": "return self._clause(self.visit(node.pt)) + [\n            ast.While(ast.Name('True', ast.Load()), clause, [])]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Rep0N", ")", "->", "[", "ast", ".", "stmt", "]", ":", "arg_4", "=", "arg_0", ".", "visit", "(", "arg_1", ".", "pt", ")", "if", "isinstance", "(", "arg_4", ",", "ast", ".", "expr", ")", ":", "return", "(", "arg_0", ".", "_clause", "(", "arg_4", ")", "+", "arg_0", ".", "visit_Rep0N", "(", "arg_1", ")", ")", "arg_0", ".", "in_loop", "+=", "1", "arg_4", "=", "arg_0", ".", "_clause", "(", "arg_0", ".", "visit", "(", "arg_1", ".", "pt", ")", ")", "arg_0", ".", "in_loop", "-=", "1", "return", "arg_0", ".", "_clause", "(", "arg_0", ".", "visit", "(", "arg_1", ".", "pt", ")", ")", "+", "[", "ast", ".", "While", "(", "ast", ".", "Name", "(", "'True'", ",", "ast", ".", "Load", "(", ")", ")", ",", "arg_4", ",", "[", "]", ")", "]"], "function": "def Func(arg_0, arg_1: arg_2.Rep0N) -> [ast.stmt]:\n        \"\"\"Generates python code for a clause repeated 1 or more times.\n\n        <code for the clause>\n        while True:\n            <code for the clause>\n        \"\"\"\n        arg_4 = arg_0.visit(arg_1.pt)\n        if isinstance(arg_4, ast.expr):\n            return (arg_0._clause(arg_4) + arg_0.visit_Rep0N(arg_1))\n        arg_0.in_loop += 1\n        arg_4 = arg_0._clause(arg_0.visit(arg_1.pt))\n        arg_0.in_loop -= 1\n        return arg_0._clause(arg_0.visit(arg_1.pt)) + [\n            ast.While(ast.Name('True', ast.Load()), arg_4, [])]", "path": "pyrser/passes/topython.py", "identifier": "RuleVisitor.visit_Rep1N", "docstring": "Generates python code for a clause repeated 1 or more times.\n\n        <code for the clause>\n        while True:\n            <code for the clause>", "docstring_tokens": ["Generates", "python", "code", "for", "a", "clause", "repeated", "1", "or", "more", "times", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254182}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L165-L206", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Move the selected object", "language": "python", "parameters": "(self, evt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "DEBUG", ":", "print", "\"move!\"", "if", "arg_0", ".", "current", "and", "not", "arg_0", ".", "overlay", ":", "arg_2", "=", "arg_0", ".", "current", "arg_3", ",", "arg_4", "=", "arg_0", ".", "start", "arg_5", ",", "arg_6", "=", "wx", ".", "GetMousePosition", "(", ")", "arg_5", ",", "arg_6", "=", "(", "arg_5", "+", "arg_3", ",", "arg_6", "+", "arg_4", ")", "if", "arg_1", ".", "ShiftDown", "(", ")", ":", "arg_5", "=", "arg_5", "/", "GRID_SIZE", "[", "0", "]", "*", "GRID_SIZE", "[", "0", "]", "arg_6", "=", "arg_6", "/", "GRID_SIZE", "[", "1", "]", "*", "GRID_SIZE", "[", "1", "]", "arg_7", ",", "arg_8", "=", "arg_2", ".", "obj", ".", "pos", "arg_9", ",", "arg_10", "=", "(", "arg_5", "-", "arg_7", ")", ",", "(", "arg_6", "-", "arg_8", ")", "for", "arg_11", "in", "arg_0", ".", "selection", ":", "arg_5", ",", "arg_6", "=", "arg_11", ".", "pos", "arg_5", "=", "arg_5", "+", "arg_9", "arg_6", "=", "arg_6", "+", "arg_10", "arg_11", ".", "pos", "=", "(", "wx", ".", "Point", "(", "arg_5", ",", "arg_6", ")", ")", "elif", "arg_0", ".", "overlay", ":", "arg_2", "=", "arg_0", ".", "current", "arg_12", "=", "arg_1", ".", "GetPosition", "(", ")", "if", "arg_1", ".", "GetEventObject", "(", ")", "!=", "arg_2", ":", "arg_12", "=", "arg_1", ".", "GetEventObject", "(", ")", ".", "ClientToScreen", "(", "arg_12", ")", "arg_12", "=", "arg_2", ".", "ScreenToClient", "(", "arg_12", ")", "arg_13", "=", "wx", ".", "RectPP", "(", "arg_0", ".", "pos", ",", "arg_12", ")", "arg_14", "=", "wx", ".", "ClientDC", "(", "arg_2", ")", "arg_15", "=", "wx", ".", "DCOverlay", "(", "arg_0", ".", "overlay", ",", "arg_14", ")", "arg_15", ".", "Clear", "(", ")", "arg_14", ".", "SetPen", "(", "wx", ".", "Pen", "(", "\"blue\"", ",", "2", ")", ")", "if", "'wxMac'", "in", "wx", ".", "PlatformInfo", ":", "arg_14", ".", "SetBrush", "(", "wx", ".", "Brush", "(", "wx", ".", "Colour", "(", "0xC0", ",", "0xC0", ",", "0xC0", ",", "0x80", ")", ")", ")", "else", ":", "arg_14", ".", "SetBrush", "(", "wx", ".", "TRANSPARENT_BRUSH", ")", "arg_14", ".", "DrawRectangleRect", "(", "arg_13", ")", "del", "arg_15"], "function": "def Func(arg_0, arg_1):\n        \"Move the selected object\"\n        if DEBUG: print \"move!\"\n        if arg_0.current and not arg_0.overlay:\n            arg_2 = arg_0.current\n            arg_3, arg_4 = arg_0.start\n            arg_5, arg_6 = wx.GetMousePosition()\n            # calculate the new position (this will overwrite relative dimensions):\n            arg_5, arg_6 = (arg_5 + arg_3, arg_6 + arg_4)\n            if arg_1.ShiftDown():     # snap to grid:\n                arg_5 = arg_5 / GRID_SIZE[0] * GRID_SIZE[0]\n                arg_6 = arg_6 / GRID_SIZE[1] * GRID_SIZE[1]\n            # calculate the diff to use in the rest of the selected objects:\n            arg_7, arg_8 = arg_2.obj.pos\n            arg_9, arg_10 = (arg_5 - arg_7), (arg_6 - arg_8)\n            # move all selected objects:\n            for arg_11 in arg_0.selection:\n                arg_5, arg_6 = arg_11.pos\n                arg_5 = arg_5 + arg_9\n                arg_6 = arg_6 + arg_10\n                arg_11.pos = (wx.Point(arg_5, arg_6))\n        elif arg_0.overlay:\n            arg_2 = arg_0.current\n            arg_12 = arg_1.GetPosition()\n            # convert to relative client coordinates of the containter:\n            if arg_1.GetEventObject() != arg_2:\n                arg_12 = arg_1.GetEventObject().ClientToScreen(arg_12)  # frame\n                arg_12 = arg_2.ScreenToClient(arg_12)                # panel\n            arg_13 = wx.RectPP(arg_0.pos, arg_12) \n            # Draw the rubber-band rectangle using an overlay so it \n            # will manage keeping the rectangle and the former window \n            # contents separate. \n            arg_14 = wx.ClientDC(arg_2) \n            arg_15 = wx.DCOverlay(arg_0.overlay, arg_14) \n            arg_15.Clear() \n            arg_14.SetPen(wx.Pen(\"blue\", 2)) \n            if 'wxMac' in wx.PlatformInfo: \n                arg_14.SetBrush(wx.Brush(wx.Colour(0xC0, 0xC0, 0xC0, 0x80))) \n            else: \n                arg_14.SetBrush(wx.TRANSPARENT_BRUSH) \n            arg_14.DrawRectangleRect(arg_13)\n            del arg_15", "path": "gui/tools/designer.py", "identifier": "BasicDesigner.mouse_move", "docstring": "Move the selected object", "docstring_tokens": ["Move", "the", "selected", "object"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 254183}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L317-L324", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Wrap simpler AST generators to return a GeneratedPyAST.", "language": "python", "parameters": "(gen_ast)", "return_statement": "return wrapped_ast_generator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapped_ast_generator", "(", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ")", "->", "GeneratedPyAST", ":", "return", "GeneratedPyAST", "(", "node", "=", "arg_0", "(", "arg_1", ",", "arg_3", ")", ")", "return", "wrapped_ast_generator"], "function": "def Func(arg_0):\n    \"\"\"Wrap simpler AST generators to return a GeneratedPyAST.\"\"\"\n\n    @wraps(arg_0)\n    def wrapped_ast_generator(arg_1: arg_2, arg_3: arg_4) -> GeneratedPyAST:\n        return GeneratedPyAST(node=arg_0(arg_1, arg_3))\n\n    return wrapped_ast_generator", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_simple_ast_generator", "docstring": "Wrap simpler AST generators to return a GeneratedPyAST.", "docstring_tokens": ["Wrap", "simpler", "AST", "generators", "to", "return", "a", "GeneratedPyAST", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 254184}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/geometry/quad.py#L17-L64", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Creates a 2D quad VAO using 2 triangles with normals and texture coordinates.", "language": "python", "parameters": "(width, height, xpos=0.0, ypos=0.0)", "return_statement": "return vao", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.0", ",", "arg_3", "=", "0.0", ")", "->", "VAO", ":", "arg_4", "=", "numpy", ".", "array", "(", "[", "arg_2", "-", "arg_0", "/", "2.0", ",", "arg_3", "+", "arg_1", "/", "2.0", ",", "0.0", ",", "arg_2", "-", "arg_0", "/", "2.0", ",", "arg_3", "-", "arg_1", "/", "2.0", ",", "0.0", ",", "arg_2", "+", "arg_0", "/", "2.0", ",", "arg_3", "-", "arg_1", "/", "2.0", ",", "0.0", ",", "arg_2", "-", "arg_0", "/", "2.0", ",", "arg_3", "+", "arg_1", "/", "2.0", ",", "0.0", ",", "arg_2", "+", "arg_0", "/", "2.0", ",", "arg_3", "-", "arg_1", "/", "2.0", ",", "0.0", ",", "arg_2", "+", "arg_0", "/", "2.0", ",", "arg_3", "+", "arg_1", "/", "2.0", ",", "0.0", ",", "]", ",", "dtype", "=", "numpy", ".", "float32", ")", "arg_5", "=", "numpy", ".", "array", "(", "[", "0.0", ",", "0.0", ",", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", ",", "]", ",", "dtype", "=", "numpy", ".", "float32", ")", "arg_6", "=", "numpy", ".", "array", "(", "[", "0.0", ",", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", ",", "1.0", ",", "0.0", ",", "1.0", ",", "1.0", ",", "]", ",", "dtype", "=", "numpy", ".", "float32", ")", "arg_7", "=", "VAO", "(", "\"geometry:quad\"", ",", "mode", "=", "moderngl", ".", "TRIANGLES", ")", "arg_7", ".", "buffer", "(", "arg_4", ",", "'3f'", ",", "[", "\"in_position\"", "]", ")", "arg_7", ".", "buffer", "(", "arg_5", ",", "'3f'", ",", "[", "\"in_normal\"", "]", ")", "arg_7", ".", "buffer", "(", "arg_6", ",", "'2f'", ",", "[", "\"in_uv\"", "]", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=0.0, arg_3=0.0) -> VAO:\n    \"\"\"\n    Creates a 2D quad VAO using 2 triangles with normals and texture coordinates.\n\n    Args:\n        width (float): Width of the quad\n        height (float): Height of the quad\n\n    Keyword Args:\n        xpos (float): Center position x\n        ypos (float): Center position y\n\n    Returns:\n        A :py:class:`demosys.opengl.vao.VAO` instance.\n    \"\"\"\n    arg_4 = numpy.array([\n        arg_2 - arg_0 / 2.0, arg_3 + arg_1 / 2.0, 0.0,\n        arg_2 - arg_0 / 2.0, arg_3 - arg_1 / 2.0, 0.0,\n        arg_2 + arg_0 / 2.0, arg_3 - arg_1 / 2.0, 0.0,\n        arg_2 - arg_0 / 2.0, arg_3 + arg_1 / 2.0, 0.0,\n        arg_2 + arg_0 / 2.0, arg_3 - arg_1 / 2.0, 0.0,\n        arg_2 + arg_0 / 2.0, arg_3 + arg_1 / 2.0, 0.0,\n    ], dtype=numpy.float32)\n\n    arg_5 = numpy.array([\n        0.0, 0.0, 1.0,\n        0.0, 0.0, 1.0,\n        0.0, 0.0, 1.0,\n        0.0, 0.0, 1.0,\n        0.0, 0.0, 1.0,\n        0.0, 0.0, 1.0,\n    ], dtype=numpy.float32)\n\n    arg_6 = numpy.array([\n        0.0, 1.0,\n        0.0, 0.0,\n        1.0, 0.0,\n        0.0, 1.0,\n        1.0, 0.0,\n        1.0, 1.0,\n    ], dtype=numpy.float32)\n\n    arg_7 = VAO(\"geometry:quad\", mode=moderngl.TRIANGLES)\n    arg_7.buffer(arg_4, '3f', [\"in_position\"])\n    arg_7.buffer(arg_5, '3f', [\"in_normal\"])\n    arg_7.buffer(arg_6, '2f', [\"in_uv\"])\n\n    return arg_7", "path": "demosys/geometry/quad.py", "identifier": "quad_2d", "docstring": "Creates a 2D quad VAO using 2 triangles with normals and texture coordinates.\n\n    Args:\n        width (float): Width of the quad\n        height (float): Height of the quad\n\n    Keyword Args:\n        xpos (float): Center position x\n        ypos (float): Center position y\n\n    Returns:\n        A :py:class:`demosys.opengl.vao.VAO` instance.", "docstring_tokens": ["Creates", "a", "2D", "quad", "VAO", "using", "2", "triangles", "with", "normals", "and", "texture", "coordinates", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 254185}
{"url": "https://github.com/idlesign/django-yaturbo/blob/a5ac9053bb800ea8082dc0615b93398917c3290a/yaturbo/toolbox.py#L18-L28", "sha": "a5ac9053bb800ea8082dc0615b93398917c3290a", "docstring_summary": "Sanitizes HTML, removing not allowed tags and attributes.", "language": "python", "parameters": "(html, allowed_tags=TURBO_ALLOWED_TAGS, allowed_attrs=TURBO_ALLOWED_ATTRS)", "return_statement": "return clean(html, tags=allowed_tags, attributes=allowed_attrs, strip=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ")", ":", "return", "clean", "(", "arg_0", ",", "tags", "=", "arg_1", ",", "attributes", "=", "arg_3", ",", "strip", "=", "True", ")"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=arg_4):\n    \"\"\"Sanitizes HTML, removing not allowed tags and attributes.\n\n    :param str|unicode html:\n\n    :param list allowed_tags: List of allowed tags.\n    :param dict allowed_attrs: Dictionary with attributes allowed for tags.\n\n    :rtype: unicode\n    \"\"\"\n    return clean(arg_0, tags=arg_1, attributes=arg_3, strip=True)", "path": "yaturbo/toolbox.py", "identifier": "sanitize_turbo", "docstring": "Sanitizes HTML, removing not allowed tags and attributes.\n\n    :param str|unicode html:\n\n    :param list allowed_tags: List of allowed tags.\n    :param dict allowed_attrs: Dictionary with attributes allowed for tags.\n\n    :rtype: unicode", "docstring_tokens": ["Sanitizes", "HTML", "removing", "not", "allowed", "tags", "and", "attributes", "."], "nwo": "idlesign/django-yaturbo", "score": 0.19592878932048235, "idx": 254186}
{"url": "https://github.com/brehaut/picoparse/blob/5e07c8e687a021bba58a5a2a76696c7a7ff35a1c/picoparse/__init__.py#L431-L436", "sha": "5e07c8e687a021bba58a5a2a76696c7a7ff35a1c", "docstring_summary": "Like many_until but must consume at least one of these.", "language": "python", "parameters": "(these, term)", "return_statement": "return (first + these_results, term_result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "arg_0", "(", ")", "]", "arg_3", ",", "arg_4", "=", "many_until", "(", "arg_0", ",", "arg_1", ")", "return", "(", "arg_2", "+", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Like many_until but must consume at least one of these.\n    \"\"\"\n    arg_2 = [arg_0()]\n    arg_3, arg_4 = many_until(arg_0, arg_1)\n    return (arg_2 + arg_3, arg_4)", "path": "picoparse/__init__.py", "identifier": "many_until1", "docstring": "Like many_until but must consume at least one of these.", "docstring_tokens": ["Like", "many_until", "but", "must", "consume", "at", "least", "one", "of", "these", "."], "nwo": "brehaut/picoparse", "score": 0.16638194949711382, "idx": 254187}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/probe.py#L146-L153", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Descend depth first into all child nodes", "language": "python", "parameters": "(self, include_me=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", ":", "yield", "arg_0", "for", "arg_2", "in", "arg_0", ".", "child_list", ":", "yield", "arg_2", "yield", "from", "arg_2", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Descend depth first into all child nodes\"\"\"\n        if arg_1:\n            yield arg_0\n\n        for arg_2 in arg_0.child_list:\n            yield arg_2\n            yield from arg_2.Func()", "path": "pythonwhat/probe.py", "identifier": "Node.descend", "docstring": "Descend depth first into all child nodes", "docstring_tokens": ["Descend", "depth", "first", "into", "all", "child", "nodes"], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 254188}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/sct_syntax.py#L13-L27", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Decorator for multi to remove nodes for original test functions from root node", "language": "python", "parameters": "(f)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_1", "=", "(", "arg_1", "[", "0", "]", "if", "len", "(", "arg_1", ")", "==", "1", "and", "isinstance", "(", "arg_1", "[", "0", "]", ",", "(", "list", ",", "tuple", ")", ")", "else", "arg_1", ")", "for", "arg_3", "in", "arg_1", ":", "if", "isinstance", "(", "arg_3", ",", "Node", ")", "and", "arg_3", ".", "parent", ".", "name", "is", "\"root\"", ":", "arg_3", ".", "parent", ".", "remove_child", "(", "arg_3", ")", "arg_3", ".", "update_child_calls", "(", ")", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Decorator for multi to remove nodes for original test functions from root node\"\"\"\n\n    @wraps(arg_0)\n    def wrapper(*arg_1, **arg_2):\n        arg_1 = (\n            arg_1[0] if len(arg_1) == 1 and isinstance(arg_1[0], (list, tuple)) else arg_1\n        )\n        for arg_3 in arg_1:\n            if isinstance(arg_3, Node) and arg_3.parent.name is \"root\":\n                arg_3.parent.remove_child(arg_3)\n                arg_3.update_child_calls()\n        return arg_0(*arg_1, **arg_2)\n\n    return wrapper", "path": "pythonwhat/sct_syntax.py", "identifier": "multi_dec", "docstring": "Decorator for multi to remove nodes for original test functions from root node", "docstring_tokens": ["Decorator", "for", "multi", "to", "remove", "nodes", "for", "original", "test", "functions", "from", "root", "node"], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 254189}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/migrate.py#L17-L31", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Temporarily write an alembic.ini file for use with alembic migration\n    scripts.", "language": "python", "parameters": "(alembic_dir_location, sqlalchemy_url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "TemporaryDirectory", "(", ")", "as", "tempdir", ":", "arg_2", "=", "join", "(", "tempdir", ",", "'temp_alembic.ini'", ")", "with", "open", "(", "arg_2", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "ALEMBIC_INI_TEMPLATE", ".", "format", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", ")", ")", "yield", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Temporarily write an alembic.ini file for use with alembic migration\n    scripts.\n    \"\"\"\n    with TemporaryDirectory() as tempdir:\n        arg_2 = join(tempdir, 'temp_alembic.ini')\n        with open(arg_2, 'w') as f:\n            f.write(\n                ALEMBIC_INI_TEMPLATE.format(\n                    arg_0=arg_0,\n                    arg_1=arg_1,\n                )\n            )\n        yield arg_2", "path": "pgcontents/utils/migrate.py", "identifier": "temp_alembic_ini", "docstring": "Temporarily write an alembic.ini file for use with alembic migration\n    scripts.", "docstring_tokens": ["Temporarily", "write", "an", "alembic", ".", "ini", "file", "for", "use", "with", "alembic", "migration", "scripts", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 254190}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L792-L816", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Primitive string formatter.", "language": "python", "parameters": "(self, fmt=\"%d:%H:%M:%S\")", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"%d:%H:%M:%S\"", ")", ":", "arg_2", "=", "{", "\"%d\"", ":", "str", "(", "arg_0", ".", "days", ")", ",", "\"%H\"", ":", "\"{0:02d}\"", ".", "format", "(", "arg_0", ".", "dhours", ")", ",", "\"%h\"", ":", "str", "(", "24", "*", "arg_0", ".", "days", "+", "arg_0", ".", "dhours", ")", ",", "\"%M\"", ":", "\"{0:02d}\"", ".", "format", "(", "arg_0", ".", "dminutes", ")", ",", "\"%S\"", ":", "\"{0:02d}\"", ".", "format", "(", "arg_0", ".", "dseconds", ")", ",", "}", "arg_3", "=", "arg_1", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "items", "(", ")", ":", "arg_3", "=", "arg_3", ".", "replace", "(", "arg_4", ",", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=\"%d:%H:%M:%S\"):\n        \"\"\"Primitive string formatter.\n\n        The only directives understood are the following:\n          ============   ==========================\n          Directive      meaning\n          ============   ==========================\n          %d             day as integer\n          %H             hour  [00-23]\n          %h             hours including days\n          %M             minute as integer [00-59]\n          %S             second as integer [00-59]\n          ============   ==========================\n        \"\"\"\n        arg_2 = {\n            \"%d\": str(arg_0.days),\n            \"%H\": \"{0:02d}\".format(arg_0.dhours),\n            \"%h\": str(24*arg_0.days + arg_0.dhours),\n            \"%M\": \"{0:02d}\".format(arg_0.dminutes),\n            \"%S\": \"{0:02d}\".format(arg_0.dseconds),\n            }\n        arg_3 = arg_1\n        for arg_4, arg_5 in arg_2.items():\n            arg_3 = arg_3.replace(arg_4, arg_5)\n        return arg_3", "path": "gromacs/utilities.py", "identifier": "Timedelta.strftime", "docstring": "Primitive string formatter.\n\n        The only directives understood are the following:\n          ============   ==========================\n          Directive      meaning\n          ============   ==========================\n          %d             day as integer\n          %H             hour  [00-23]\n          %h             hours including days\n          %M             minute as integer [00-59]\n          %S             second as integer [00-59]\n          ============   ==========================", "docstring_tokens": ["Primitive", "string", "formatter", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 254191}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L1657-L1690", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Count non missing value for expression on an array which represents healpix data.", "language": "python", "parameters": "(self, expression=None, healpix_expression=None, healpix_max_level=12, healpix_level=8, binby=None, limits=None, shape=default_shape, delay=False, progress=None, selection=None)", "return_statement": "return self.count(expression, binby=binby, limits=limits, shape=shape, delay=delay, progress=progress, selection=selection)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "12", ",", "arg_4", "=", "8", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "arg_8", ",", "arg_9", "=", "False", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ")", ":", "import", "healpy", "as", "hp", "if", "arg_2", "is", "None", ":", "if", "arg_0", ".", "ucds", ".", "get", "(", "\"source_id\"", ",", "None", ")", "==", "'meta.id;meta.main'", ":", "arg_2", "=", "\"source_id/34359738368\"", "if", "arg_2", "is", "None", ":", "raise", "ValueError", "(", "\"no healpix_expression given, and was unable to guess\"", ")", "arg_12", "=", "arg_3", "-", "arg_4", "arg_13", "=", "2", "**", "arg_4", "arg_14", "=", "hp", ".", "nside2npix", "(", "arg_13", ")", "arg_15", "=", "4", "**", "arg_12", "arg_16", "=", "\"%s/%s\"", "%", "(", "arg_2", ",", "arg_15", ")", "arg_5", "=", "[", "arg_16", "]", "+", "(", "[", "]", "if", "arg_5", "is", "None", "else", "_ensure_list", "(", "arg_5", ")", ")", "arg_7", "=", "(", "arg_14", ",", ")", "+", "_expand_shape", "(", "arg_7", ",", "len", "(", "arg_5", ")", "-", "1", ")", "arg_17", "=", "1.", "/", "arg_15", "/", "2", "arg_6", "=", "[", "[", "-", "arg_17", ",", "arg_14", "-", "arg_17", "]", "]", "+", "(", "[", "]", "if", "arg_6", "is", "None", "else", "arg_6", ")", "return", "arg_0", ".", "count", "(", "arg_1", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=12, arg_4=8, arg_5=None, arg_6=None, arg_7=arg_8, arg_9=False, arg_10=None, arg_11=None):\n        \"\"\"Count non missing value for expression on an array which represents healpix data.\n\n        :param expression: Expression or column for which to count non-missing values, or None or '*' for counting the rows\n        :param healpix_expression: {healpix_max_level}\n        :param healpix_max_level: {healpix_max_level}\n        :param healpix_level: {healpix_level}\n        :param binby: {binby}, these dimension follow the first healpix dimension.\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return:\n        \"\"\"\n        # if binby is None:\n        import healpy as hp\n        if arg_2 is None:\n            if arg_0.ucds.get(\"source_id\", None) == 'meta.id;meta.main':  # we now assume we have gaia data\n                arg_2 = \"source_id/34359738368\"\n\n        if arg_2 is None:\n            raise ValueError(\"no healpix_expression given, and was unable to guess\")\n\n        arg_12 = arg_3 - arg_4\n        arg_13 = 2**arg_4\n        arg_14 = hp.nside2npix(arg_13)\n        arg_15 = 4**arg_12\n        arg_16 = \"%s/%s\" % (arg_2, arg_15)\n        arg_5 = [arg_16] + ([] if arg_5 is None else _ensure_list(arg_5))\n        arg_7 = (arg_14,) + _expand_shape(arg_7, len(arg_5) - 1)\n        arg_17 = 1. / arg_15 / 2\n        arg_6 = [[-arg_17, arg_14 - arg_17]] + ([] if arg_6 is None else arg_6)\n        return arg_0.count(arg_1, arg_5=arg_5, arg_6=arg_6, arg_7=arg_7, arg_9=arg_9, arg_10=arg_10, arg_11=arg_11)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.healpix_count", "docstring": "Count non missing value for expression on an array which represents healpix data.\n\n        :param expression: Expression or column for which to count non-missing values, or None or '*' for counting the rows\n        :param healpix_expression: {healpix_max_level}\n        :param healpix_max_level: {healpix_max_level}\n        :param healpix_level: {healpix_level}\n        :param binby: {binby}, these dimension follow the first healpix dimension.\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return:", "docstring_tokens": ["Count", "non", "missing", "value", "for", "expression", "on", "an", "array", "which", "represents", "healpix", "data", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 254192}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/slicing.py#L165-L191", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Slices `dist` along its batch dimensions. Helper for tfd.Distribution.", "language": "python", "parameters": "(dist, params_event_ndims, params_overrides, slices)", "return_statement": "return dist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "isinstance", "(", "arg_3", ",", "collections", ".", "Sequence", ")", ":", "arg_3", "=", "(", "arg_3", ",", ")", "arg_4", ",", "arg_5", "=", "getattr", "(", "arg_0", ",", "PROVENANCE_ATTR", ",", "(", "arg_0", ",", "[", "]", ")", ")", "arg_5", "+=", "[", "(", "arg_3", ",", "arg_2", ")", "]", "arg_0", "=", "_apply_slice_sequence", "(", "arg_4", ",", "arg_1", ",", "arg_5", ")", "setattr", "(", "arg_0", ",", "PROVENANCE_ATTR", ",", "(", "arg_4", ",", "arg_5", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Slices `dist` along its batch dimensions. Helper for tfd.Distribution.\n\n  Args:\n    dist: A `tfd.Distribution` instance.\n    params_event_ndims: A `dict` of `str->int` indicating the number of\n      dimensions of a given parameter required to parameterize a single event.\n    params_overrides: A `dict` of parameter overrides. (e.g. from\n      `Distribution.copy`).\n    slices: A `slice` or `int` or `int` `Tensor` or `tf.newaxis` or `tuple`\n      thereof. (e.g. the argument of a `__getitem__` method).\n\n  Returns:\n    new_dist: A batch-sliced `tfd.Distribution`.\n  \"\"\"\n  if not isinstance(arg_3, collections.Sequence):\n    arg_3 = (arg_3,)\n  # We track the history of slice and copy(**param_overrides) in order to trace\n  # back to the original distribution's source variables.\n  arg_4, arg_5 = getattr(arg_0, PROVENANCE_ATTR, (arg_0, []))\n  arg_5 += [(arg_3, arg_2)]\n  # Re-doing the full sequence of slice+copy override work here enables\n  # gradients all the way back to the original distribution's arguments.\n  arg_0 = _apply_slice_sequence(arg_4, arg_1,\n                               arg_5)\n  setattr(arg_0, PROVENANCE_ATTR, (arg_4, arg_5))\n  return arg_0", "path": "tensorflow_probability/python/distributions/internal/slicing.py", "identifier": "batch_slice", "docstring": "Slices `dist` along its batch dimensions. Helper for tfd.Distribution.\n\n  Args:\n    dist: A `tfd.Distribution` instance.\n    params_event_ndims: A `dict` of `str->int` indicating the number of\n      dimensions of a given parameter required to parameterize a single event.\n    params_overrides: A `dict` of parameter overrides. (e.g. from\n      `Distribution.copy`).\n    slices: A `slice` or `int` or `int` `Tensor` or `tf.newaxis` or `tuple`\n      thereof. (e.g. the argument of a `__getitem__` method).\n\n  Returns:\n    new_dist: A batch-sliced `tfd.Distribution`.", "docstring_tokens": ["Slices", "dist", "along", "its", "batch", "dimensions", ".", "Helper", "for", "tfd", ".", "Distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254193}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L127-L149", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Clean up stats file, if configured to do so.", "language": "python", "parameters": "(self, result)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "available", "(", ")", ":", "return", "try", ":", "arg_0", ".", "prof", ".", "close", "(", ")", "except", "AttributeError", ":", "pass", "if", "arg_0", ".", "clean_stats_file", ":", "if", "arg_0", ".", "fileno", ":", "try", ":", "os", ".", "close", "(", "arg_0", ".", "fileno", ")", "except", "OSError", ":", "pass", "try", ":", "os", ".", "unlink", "(", "arg_0", ".", "pfile", ")", "except", "OSError", ":", "pass", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Clean up stats file, if configured to do so.\n        \"\"\"\n        if not arg_0.available():\n            return\n        try:\n            arg_0.prof.close()\n        except AttributeError:\n            # TODO: is this trying to catch just the case where not\n            # hasattr(self.prof, \"close\")?  If so, the function call should be\n            # moved out of the try: suite.\n            pass\n        if arg_0.clean_stats_file:\n            if arg_0.fileno:\n                try:\n                    os.close(arg_0.fileno)\n                except OSError:\n                    pass\n            try:\n                os.unlink(arg_0.pfile)\n            except OSError:\n                pass\n        return None", "path": "environment/lib/python2.7/site-packages/nose/plugins/prof.py", "identifier": "Profile.finalize", "docstring": "Clean up stats file, if configured to do so.", "docstring_tokens": ["Clean", "up", "stats", "file", "if", "configured", "to", "do", "so", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254194}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/utils.py#L91-L120", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "Format a timedelta object for display to users", "language": "python", "parameters": "(td_object)", "return_statement": "return \", \".join(strings)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "get_total_seconds", "(", "arg_1", ")", ":", "return", "(", "arg_1", ".", "microseconds", "+", "(", "arg_1", ".", "seconds", "+", "arg_1", ".", "days", "*", "24", "*", "3600", ")", "*", "1e6", ")", "/", "1e6", "arg_2", "=", "int", "(", "get_total_seconds", "(", "arg_0", ")", ")", "arg_3", "=", "[", "(", "'year'", ",", "60", "*", "60", "*", "24", "*", "365", ")", ",", "(", "'month'", ",", "60", "*", "60", "*", "24", "*", "30", ")", ",", "(", "'day'", ",", "60", "*", "60", "*", "24", ")", ",", "(", "'hour'", ",", "60", "*", "60", ")", ",", "(", "'minute'", ",", "60", ")", ",", "(", "'second'", ",", "1", ")", "]", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "arg_3", ":", "if", "arg_2", ">", "arg_6", ":", "arg_7", ",", "arg_2", "=", "divmod", "(", "arg_2", ",", "arg_6", ")", "if", "arg_7", "==", "1", ":", "arg_4", ".", "append", "(", "\"%s %s\"", "%", "(", "arg_7", ",", "arg_5", ")", ")", "else", ":", "arg_4", ".", "append", "(", "\"%s %ss\"", "%", "(", "arg_7", ",", "arg_5", ")", ")", "return", "\", \"", ".", "join", "(", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"Format a timedelta object for display to users\n\n    Returns\n    -------\n    str\n    \"\"\"\n    def get_total_seconds(arg_1):\n        # timedelta.total_seconds not in py2.6\n        return (arg_1.microseconds +\n                (arg_1.seconds + arg_1.days * 24 * 3600) * 1e6) / 1e6\n\n    arg_2 = int(get_total_seconds(arg_0))\n    arg_3 = [('year',    60*60*24*365),\n               ('month',   60*60*24*30),\n               ('day',     60*60*24),\n               ('hour',    60*60),\n               ('minute',  60),\n               ('second',  1)]\n\n    arg_4 = []\n    for arg_5, arg_6 in arg_3:\n        if arg_2 > arg_6:\n            arg_7, arg_2 = divmod(arg_2, arg_6)\n            if arg_7 == 1:\n                arg_4.append(\"%s %s\" % (arg_7, arg_5))\n            else:\n                arg_4.append(\"%s %ss\" % (arg_7, arg_5))\n\n    return \", \".join(arg_4)", "path": "osprey/utils.py", "identifier": "format_timedelta", "docstring": "Format a timedelta object for display to users\n\n    Returns\n    -------\n    str", "docstring_tokens": ["Format", "a", "timedelta", "object", "for", "display", "to", "users"], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 254195}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1248-L1274", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Get file information dict from the repository given its relative path.", "language": "python", "parameters": "(self, relativePath)", "return_statement": "return info, ''", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_0", ".", "to_repo_relative_path", "(", "path", "=", "arg_1", ",", "split", "=", "False", ")", "arg_2", "=", "os", ".", "path", ".", "basename", "(", "arg_1", ")", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_0", ".", "is_repository_file", "(", "arg_1", ")", "if", "not", "arg_3", ":", "return", "None", ",", "\"file is not a registered repository file.\"", "if", "not", "arg_5", ":", "return", "None", ",", "\"file is a registered repository file but info file missing\"", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", ",", "arg_0", ".", "__fileInfo", "%", "arg_2", ")", "try", ":", "with", "open", "(", "arg_7", ",", "'rb'", ")", "as", "fd", ":", "arg_8", "=", "pickle", ".", "load", "(", "fd", ")", "except", "Exception", "as", "err", ":", "return", "None", ",", "\"Unable to read file info from disk (%s)\"", "%", "str", "(", "err", ")", "return", "arg_8", ",", "''"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get file information dict from the repository given its relative path.\n\n        :Parameters:\n            #. relativePath (string): The relative to the repository path of\n               the file.\n\n        :Returns:\n            #. info (None, dictionary): The file information dictionary.\n               If None, it means an error has occurred.\n            #. errorMessage (string): The error message if any error occurred.\n        \"\"\"\n        arg_1 = arg_0.to_repo_relative_path(path=arg_1, split=False)\n        arg_2     = os.path.basename(arg_1)\n        arg_3,arg_4, arg_5, arg_6 = arg_0.is_repository_file(arg_1)\n        if not arg_3:\n            return None, \"file is not a registered repository file.\"\n        if not arg_5:\n            return None, \"file is a registered repository file but info file missing\"\n        arg_7 = os.path.join(arg_0.__path,os.path.dirname(arg_1),arg_0.__fileInfo%arg_2)\n        try:\n            with open(arg_7, 'rb') as fd:\n                arg_8 = pickle.load(fd)\n        except Exception as err:\n            return None, \"Unable to read file info from disk (%s)\"%str(err)\n        return arg_8, ''", "path": "Repository.py", "identifier": "Repository.get_file_info", "docstring": "Get file information dict from the repository given its relative path.\n\n        :Parameters:\n            #. relativePath (string): The relative to the repository path of\n               the file.\n\n        :Returns:\n            #. info (None, dictionary): The file information dictionary.\n               If None, it means an error has occurred.\n            #. errorMessage (string): The error message if any error occurred.", "docstring_tokens": ["Get", "file", "information", "dict", "from", "the", "repository", "given", "its", "relative", "path", "."], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 254196}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L134-L151", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get a list of identity providers choices for enterprise customer.", "language": "python", "parameters": "()", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "from", "third_party_auth", ".", "provider", "import", "arg_0", "except", "ImportError", "as", "exception", ":", "LOGGER", ".", "warning", "(", "\"Could not import Registry from third_party_auth.provider\"", ")", "LOGGER", ".", "warning", "(", "exception", ")", "arg_0", "=", "None", "arg_1", "=", "[", "(", "\"\"", ",", "\"-\"", "*", "7", ")", "]", "if", "arg_0", ":", "return", "arg_1", "+", "[", "(", "arg_2", ".", "provider_id", ",", "arg_2", ".", "name", ")", "for", "arg_2", "in", "arg_0", ".", "enabled", "(", ")", "]", "return", "None"], "function": "def Func():\n    \"\"\"\n    Get a list of identity providers choices for enterprise customer.\n\n    Return:\n        A list of choices of all identity providers, None if it can not get any available identity provider.\n    \"\"\"\n    try:\n        from third_party_auth.provider import arg_0   # pylint: disable=redefined-outer-name\n    except ImportError as exception:\n        LOGGER.warning(\"Could not import Registry from third_party_auth.provider\")\n        LOGGER.warning(exception)\n        arg_0 = None  # pylint: disable=redefined-outer-name\n\n    arg_1 = [(\"\", \"-\" * 7)]\n    if arg_0:\n        return arg_1 + [(arg_2.provider_id, arg_2.name) for arg_2 in arg_0.enabled()]\n    return None", "path": "enterprise/utils.py", "identifier": "get_idp_choices", "docstring": "Get a list of identity providers choices for enterprise customer.\n\n    Return:\n        A list of choices of all identity providers, None if it can not get any available identity provider.", "docstring_tokens": ["Get", "a", "list", "of", "identity", "providers", "choices", "for", "enterprise", "customer", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254197}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/input.py#L43-L63", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Encode input in the way that is appropriate to the observation space", "language": "python", "parameters": "(ob_space, placeholder)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Discrete", ")", ":", "return", "tf", ".", "to_float", "(", "tf", ".", "one_hot", "(", "arg_1", ",", "arg_0", ".", "n", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "Box", ")", ":", "return", "tf", ".", "to_float", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_0", ",", "MultiDiscrete", ")", ":", "arg_1", "=", "tf", ".", "cast", "(", "arg_1", ",", "tf", ".", "int32", ")", "arg_2", "=", "[", "tf", ".", "to_float", "(", "tf", ".", "one_hot", "(", "arg_1", "[", "...", ",", "i", "]", ",", "arg_0", ".", "nvec", "[", "i", "]", ")", ")", "for", "i", "in", "range", "(", "arg_1", ".", "shape", "[", "-", "1", "]", ")", "]", "return", "tf", ".", "concat", "(", "arg_2", ",", "axis", "=", "-", "1", ")", "else", ":", "raise", "NotImplementedError"], "function": "def Func(arg_0, arg_1):\n    '''\n    Encode input in the way that is appropriate to the observation space\n\n    Parameters:\n    ----------\n\n    ob_space: gym.Space             observation space\n\n    placeholder: tf.placeholder     observation input placeholder\n    '''\n    if isinstance(arg_0, Discrete):\n        return tf.to_float(tf.one_hot(arg_1, arg_0.n))\n    elif isinstance(arg_0, Box):\n        return tf.to_float(arg_1)\n    elif isinstance(arg_0, MultiDiscrete):\n        arg_1 = tf.cast(arg_1, tf.int32)\n        arg_2 = [tf.to_float(tf.one_hot(arg_1[..., i], arg_0.nvec[i])) for i in range(arg_1.shape[-1])]\n        return tf.concat(arg_2, axis=-1)\n    else:\n        raise NotImplementedError", "path": "baselines/common/input.py", "identifier": "encode_observation", "docstring": "Encode input in the way that is appropriate to the observation space\n\n    Parameters:\n    ----------\n\n    ob_space: gym.Space             observation space\n\n    placeholder: tf.placeholder     observation input placeholder", "docstring_tokens": ["Encode", "input", "in", "the", "way", "that", "is", "appropriate", "to", "the", "observation", "space"], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 254198}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/plugin/tree_editor.py#L96-L109", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Creates the toolkit-specific control that represents the\n            editor. 'parent' is the toolkit-specific control that is\n            the editor's parent.", "language": "python", "parameters": "(self, parent)", "return_statement": "return ui", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "graph", "=", "arg_0", ".", "editor_input", ".", "load", "(", ")", "arg_3", "=", "View", "(", "Item", "(", "name", "=", "\"graph\"", ",", "editor", "=", "graph_tree_editor", ",", "show_label", "=", "False", ")", ",", "id", "=", "\"godot.graph_editor\"", ",", "kind", "=", "\"live\"", ",", "resizable", "=", "True", ")", "arg_4", "=", "arg_0", ".", "edit_traits", "(", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", "kind", "=", "\"subpanel\"", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Creates the toolkit-specific control that represents the\n            editor. 'parent' is the toolkit-specific control that is\n            the editor's parent.\n        \"\"\"\n        arg_0.graph = arg_0.editor_input.load()\n\n        arg_3 = View(Item(name=\"graph\", editor=graph_tree_editor,\n                show_label=False),\n            id=\"godot.graph_editor\", kind=\"live\", resizable=True)\n\n        arg_4 = arg_0.edit_traits(arg_3=arg_3, arg_1=arg_1, kind=\"subpanel\")\n\n        return arg_4", "path": "godot/plugin/tree_editor.py", "identifier": "TreeEditor.create_ui", "docstring": "Creates the toolkit-specific control that represents the\n            editor. 'parent' is the toolkit-specific control that is\n            the editor's parent.", "docstring_tokens": ["Creates", "the", "toolkit", "-", "specific", "control", "that", "represents", "the", "editor", ".", "parent", "is", "the", "toolkit", "-", "specific", "control", "that", "is", "the", "editor", "s", "parent", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 254199}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/hidden_markov_model.py#L489-L517", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Compute marginal pdf for each individual observable.", "language": "python", "parameters": "(self)", "return_statement": "return tf.exp(forward_log_probs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tf", ".", "broadcast_to", "(", "arg_0", ".", "_log_init", ",", "tf", ".", "concat", "(", "[", "arg_0", ".", "batch_shape_tensor", "(", ")", ",", "[", "arg_0", ".", "_num_states", "]", "]", ",", "axis", "=", "0", ")", ")", "if", "arg_0", ".", "_num_steps", ">", "1", ":", "arg_2", "=", "arg_0", ".", "_log_trans", "def", "forward_step", "(", "arg_3", ",", "arg_4", ")", ":", "return", "_log_vector_matrix", "(", "arg_3", ",", "arg_2", ")", "arg_5", "=", "tf", ".", "zeros", "(", "arg_0", ".", "_num_steps", "-", "1", ",", "dtype", "=", "tf", ".", "float32", ")", "arg_6", "=", "tf", ".", "scan", "(", "forward_step", ",", "arg_5", ",", "initializer", "=", "arg_1", ",", "name", "=", "\"forward_log_probs\"", ")", "arg_6", "=", "tf", ".", "concat", "(", "[", "[", "arg_1", "]", ",", "arg_6", "]", ",", "axis", "=", "0", ")", "else", ":", "arg_6", "=", "arg_1", "[", "tf", ".", "newaxis", ",", "...", "]", "return", "tf", ".", "exp", "(", "arg_6", ")"], "function": "def Func(arg_0):\n    \"\"\"Compute marginal pdf for each individual observable.\"\"\"\n\n    arg_1 = tf.broadcast_to(arg_0._log_init,\n                                        tf.concat([arg_0.batch_shape_tensor(),\n                                                   [arg_0._num_states]],\n                                                  axis=0))\n    # initial_log_probs :: batch_shape num_states\n\n    if arg_0._num_steps > 1:\n      arg_2 = arg_0._log_trans\n\n      def forward_step(arg_3, arg_4):\n        return _log_vector_matrix(arg_3, arg_2)\n\n      arg_5 = tf.zeros(arg_0._num_steps - 1, dtype=tf.float32)\n\n      arg_6 = tf.scan(forward_step, arg_5,\n                                  initializer=arg_1,\n                                  name=\"forward_log_probs\")\n\n      arg_6 = tf.concat([[arg_1], arg_6],\n                                    axis=0)\n    else:\n      arg_6 = arg_1[tf.newaxis, ...]\n\n    # returns :: num_steps batch_shape num_states\n\n    return tf.exp(arg_6)", "path": "tensorflow_probability/python/distributions/hidden_markov_model.py", "identifier": "HiddenMarkovModel._marginal_hidden_probs", "docstring": "Compute marginal pdf for each individual observable.", "docstring_tokens": ["Compute", "marginal", "pdf", "for", "each", "individual", "observable", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254200}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L1911-L1965", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Normalize an image by rescale, samplewise centering and samplewise centering in order.", "language": "python", "parameters": "(\n        x, rescale=None, samplewise_center=False, samplewise_std_normalization=False, channel_index=2, epsilon=1e-7\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "2", ",", "arg_5", "=", "1e-7", ")", ":", "if", "arg_1", ":", "arg_0", "*=", "arg_1", "if", "arg_0", ".", "shape", "[", "arg_4", "]", "==", "1", ":", "if", "arg_2", ":", "arg_0", "=", "arg_0", "-", "np", ".", "mean", "(", "arg_0", ")", "if", "arg_3", ":", "arg_0", "=", "arg_0", "/", "np", ".", "std", "(", "arg_0", ")", "return", "arg_0", "elif", "arg_0", ".", "shape", "[", "arg_4", "]", "==", "3", ":", "if", "arg_2", ":", "arg_0", "=", "arg_0", "-", "np", ".", "mean", "(", "arg_0", ",", "axis", "=", "arg_4", ",", "keepdims", "=", "True", ")", "if", "arg_3", ":", "arg_0", "=", "arg_0", "/", "(", "np", ".", "std", "(", "arg_0", ",", "axis", "=", "arg_4", ",", "keepdims", "=", "True", ")", "+", "arg_5", ")", "return", "arg_0", "else", ":", "raise", "Exception", "(", "\"Unsupported channels %d\"", "%", "arg_0", ".", "shape", "[", "arg_4", "]", ")"], "function": "def Func(\n        arg_0, arg_1=None, arg_2=False, arg_3=False, arg_4=2, arg_5=1e-7\n):\n    \"\"\"Normalize an image by rescale, samplewise centering and samplewise centering in order.\n\n    Parameters\n    -----------\n    x : numpy.array\n        An image with dimension of [row, col, channel] (default).\n    rescale : float\n        Rescaling factor. If None or 0, no rescaling is applied, otherwise we multiply the data by the value provided (before applying any other transformation)\n    samplewise_center : boolean\n        If True, set each sample mean to 0.\n    samplewise_std_normalization : boolean\n        If True, divide each input by its std.\n    epsilon : float\n        A small position value for dividing standard deviation.\n\n    Returns\n    -------\n    numpy.array\n        A processed image.\n\n    Examples\n    --------\n    >>> x = Func(x, samplewise_center=True, samplewise_std_normalization=True)\n    >>> print(x.shape, np.mean(x), np.std(x))\n    (160, 176, 1), 0.0, 1.0\n\n    Notes\n    ------\n    When samplewise_center and samplewise_std_normalization are True.\n    - For greyscale image, every pixels are subtracted and divided by the mean and std of whole image.\n    - For RGB image, every pixels are subtracted and divided by the mean and std of this pixel i.e. the mean and std of a pixel is 0 and 1.\n\n    \"\"\"\n    if arg_1:\n        arg_0 *= arg_1\n\n    if arg_0.shape[arg_4] == 1:\n        # greyscale\n        if arg_2:\n            arg_0 = arg_0 - np.mean(arg_0)\n        if arg_3:\n            arg_0 = arg_0 / np.std(arg_0)\n        return arg_0\n    elif arg_0.shape[arg_4] == 3:\n        # rgb\n        if arg_2:\n            arg_0 = arg_0 - np.mean(arg_0, axis=arg_4, keepdims=True)\n        if arg_3:\n            arg_0 = arg_0 / (np.std(arg_0, axis=arg_4, keepdims=True) + arg_5)\n        return arg_0\n    else:\n        raise Exception(\"Unsupported channels %d\" % arg_0.shape[arg_4])", "path": "tensorlayer/prepro.py", "identifier": "samplewise_norm", "docstring": "Normalize an image by rescale, samplewise centering and samplewise centering in order.\n\n    Parameters\n    -----------\n    x : numpy.array\n        An image with dimension of [row, col, channel] (default).\n    rescale : float\n        Rescaling factor. If None or 0, no rescaling is applied, otherwise we multiply the data by the value provided (before applying any other transformation)\n    samplewise_center : boolean\n        If True, set each sample mean to 0.\n    samplewise_std_normalization : boolean\n        If True, divide each input by its std.\n    epsilon : float\n        A small position value for dividing standard deviation.\n\n    Returns\n    -------\n    numpy.array\n        A processed image.\n\n    Examples\n    --------\n    >>> x = samplewise_norm(x, samplewise_center=True, samplewise_std_normalization=True)\n    >>> print(x.shape, np.mean(x), np.std(x))\n    (160, 176, 1), 0.0, 1.0\n\n    Notes\n    ------\n    When samplewise_center and samplewise_std_normalization are True.\n    - For greyscale image, every pixels are subtracted and divided by the mean and std of whole image.\n    - For RGB image, every pixels are subtracted and divided by the mean and std of this pixel i.e. the mean and std of a pixel is 0 and 1.", "docstring_tokens": ["Normalize", "an", "image", "by", "rescale", "samplewise", "centering", "and", "samplewise", "centering", "in", "order", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 254201}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L438-L453", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return the metadata for the specified course run.", "language": "python", "parameters": "(self, request, pk, course_id)", "return_statement": "return Response(serializer.data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_object", "(", ")", "arg_5", "=", "arg_4", ".", "get_course_run", "(", "arg_3", ")", "if", "not", "arg_5", ":", "raise", "Http404", "arg_6", "=", "arg_0", ".", "get_serializer_context", "(", ")", "arg_6", "[", "'enterprise_customer_catalog'", "]", "=", "arg_4", "arg_7", "=", "serializers", ".", "CourseRunDetailSerializer", "(", "arg_5", ",", "arg_6", "=", "arg_6", ")", "return", "Response", "(", "arg_7", ".", "data", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):  # pylint: disable=invalid-name,unused-argument\n        \"\"\"\n        Return the metadata for the specified course run.\n\n        The course run needs to be included in the specified EnterpriseCustomerCatalog\n        in order for metadata to be returned from this endpoint.\n        \"\"\"\n        arg_4 = arg_0.get_object()\n        arg_5 = arg_4.get_course_run(arg_3)\n        if not arg_5:\n            raise Http404\n\n        arg_6 = arg_0.get_serializer_context()\n        arg_6['enterprise_customer_catalog'] = arg_4\n        arg_7 = serializers.CourseRunDetailSerializer(arg_5, arg_6=arg_6)\n        return Response(arg_7.data)", "path": "enterprise/api/v1/views.py", "identifier": "EnterpriseCustomerCatalogViewSet.course_run_detail", "docstring": "Return the metadata for the specified course run.\n\n        The course run needs to be included in the specified EnterpriseCustomerCatalog\n        in order for metadata to be returned from this endpoint.", "docstring_tokens": ["Return", "the", "metadata", "for", "the", "specified", "course", "run", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254202}
{"url": "https://github.com/voxpupuli/pypuppetdb/blob/cedeecf48014b4ad5b8e2513ca8230c814f45603/pypuppetdb/api.py#L500-L519", "sha": "cedeecf48014b4ad5b8e2513ca8230c814f45603", "docstring_summary": "Get the known catalog edges, formed between two resources.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "Func", "=", "arg_0", ".", "_query", "(", "'edges'", ",", "**", "arg_1", ")", "for", "arg_3", "in", "Func", ":", "arg_4", "=", "arg_3", "[", "'source_type'", "]", "+", "'['", "+", "arg_3", "[", "'source_title'", "]", "+", "']'", "arg_5", "=", "arg_3", "[", "'target_type'", "]", "+", "'['", "+", "arg_3", "[", "'target_title'", "]", "+", "']'", "yield", "Edge", "(", "source", "=", "arg_0", ".", "resources", "[", "arg_4", "]", ",", "target", "=", "arg_0", ".", "resources", "[", "arg_5", "]", ",", "relationship", "=", "arg_3", "[", "'relationship'", "]", ",", "node", "=", "arg_3", "[", "'certname'", "]", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Get the known catalog edges, formed between two resources.\n\n        :param \\*\\*kwargs: The rest of the keyword arguments are passed\n                           to the _query function.\n\n        :returns: A generating yielding Edges.\n        :rtype: :class:`pypuppetdb.types.Edge`\n        \"\"\"\n        Func = arg_0._query('edges', **arg_1)\n\n        for arg_3 in Func:\n            arg_4 = arg_3['source_type'] + \\\n                '[' + arg_3['source_title'] + ']'\n            arg_5 = arg_3['target_type'] + \\\n                '[' + arg_3['target_title'] + ']'\n            yield Edge(source=arg_0.resources[arg_4],\n                       target=arg_0.resources[arg_5],\n                       relationship=arg_3['relationship'],\n                       node=arg_3['certname'])", "path": "pypuppetdb/api.py", "identifier": "BaseAPI.edges", "docstring": "Get the known catalog edges, formed between two resources.\n\n        :param \\*\\*kwargs: The rest of the keyword arguments are passed\n                           to the _query function.\n\n        :returns: A generating yielding Edges.\n        :rtype: :class:`pypuppetdb.types.Edge`", "docstring_tokens": ["Get", "the", "known", "catalog", "edges", "formed", "between", "two", "resources", "."], "nwo": "voxpupuli/pypuppetdb", "score": 0.6407386667560883, "idx": 254203}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L269-L276", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Inverse of dict_to_list", "language": "python", "parameters": "(self, line, keys=None)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "_keys", "if", "arg_2", "is", "None", "else", "arg_2", "arg_3", "=", "arg_0", ".", "_defaults", "(", "arg_2", ")", "for", "arg_4", ",", "arg_5", "in", "zip", "(", "arg_2", ",", "arg_1", ")", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Inverse of dict_to_list\"\"\"\n        arg_2 = arg_0._keys if arg_2 is None else arg_2\n        arg_3 = arg_0._defaults(arg_2)\n        for arg_4,arg_5 in zip(arg_2, arg_1):\n            arg_3[arg_4] = arg_5\n\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py", "identifier": "SQLiteDB._list_to_dict", "docstring": "Inverse of dict_to_list", "docstring_tokens": ["Inverse", "of", "dict_to_list"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254204}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/scripts.py#L259-L311", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Return the filename of `module` if it can be imported.", "language": "python", "parameters": "(module)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "split", "(", "'.'", ")", "arg_1", "=", "'.'", ".", "join", "(", "arg_0", "[", ":", "-", "1", "]", ")", "arg_0", "=", "arg_0", "[", "-", "1", "]", "try", ":", "if", "not", "arg_1", ":", "arg_0", "=", "__import__", "(", "arg_0", ")", "else", ":", "arg_1", "=", "__import__", "(", "arg_1", ",", "fromlist", "=", "[", "arg_0", "]", ")", "arg_0", "=", "getattr", "(", "arg_1", ",", "arg_0", ",", "None", ")", "arg_2", "=", "getattr", "(", "arg_0", ",", "'__file__'", ",", "None", ")", "if", "not", "arg_2", ":", "return", "Unparseable", "(", ")", "if", "arg_2", ".", "endswith", "(", "'.pyc'", ")", ":", "arg_2", "=", "arg_2", "[", ":", "-", "1", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", "and", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "return", "Unparseable", "(", ")", "if", "arg_2", ".", "endswith", "(", "'__init__.py'", ")", ":", "arg_2", "=", "arg_2", "[", ":", "-", "11", "]", "return", "arg_2", "except", "ImportError", ":", "return"], "function": "def Func(arg_0):\n    \"\"\"\n    Return the filename of `module` if it can be imported.\n\n    If `module` is a package, its directory will be returned.\n\n    If it cannot be imported ``None`` is returned.\n\n    If the ``__file__`` attribute is missing, or the module or package is a\n    compiled egg, then an :class:`Unparseable` instance is returned, since the\n    source can't be retrieved.\n\n    :param module: A module name, such as ``'test.test_config'``\n    :type module: str\n\n    \"\"\"\n    # Split up the module and its containing package, if it has one\n    arg_0 = arg_0.split('.')\n    arg_1 = '.'.join(arg_0[:-1])\n    arg_0 = arg_0[-1]\n\n    try:\n        if not arg_1:\n            # We aren't accessing a module within a package, but rather a top\n            # level package, so it's a straight up import\n            arg_0 = __import__(arg_0)\n        else:\n            # Import the package containing our desired module\n            arg_1 = __import__(arg_1, fromlist=[arg_0])\n            # Get the module from that package\n            arg_0 = getattr(arg_1, arg_0, None)\n\n        arg_2 = getattr(arg_0, '__file__', None)\n        if not arg_2:\n            # No filename? Nothing to do here\n            return Unparseable()\n\n        # If we get a .pyc, strip the c to get .py so we can parse the source\n        if arg_2.endswith('.pyc'):\n            arg_2 = arg_2[:-1]\n            if not os.path.exists(arg_2) and os.path.isfile(arg_2):\n                # If there's only a .pyc and no .py it's a compile package or\n                # egg and we can't get at the source for parsing\n                return Unparseable()\n        # If we have a package, we want the directory not the init file\n        if arg_2.endswith('__init__.py'):\n            arg_2 = arg_2[:-11]\n\n        # Yey, we found it\n        return arg_2\n    except ImportError:\n        # Definitely not a valid module or package\n        return", "path": "pyconfig/scripts.py", "identifier": "_get_module_filename", "docstring": "Return the filename of `module` if it can be imported.\n\n    If `module` is a package, its directory will be returned.\n\n    If it cannot be imported ``None`` is returned.\n\n    If the ``__file__`` attribute is missing, or the module or package is a\n    compiled egg, then an :class:`Unparseable` instance is returned, since the\n    source can't be retrieved.\n\n    :param module: A module name, such as ``'test.test_config'``\n    :type module: str", "docstring_tokens": ["Return", "the", "filename", "of", "module", "if", "it", "can", "be", "imported", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 254205}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L226-L241", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform Stinespring representation to Kraus representation.", "language": "python", "parameters": "(data, input_dim, output_dim)", "return_statement": "return tuple(kraus_pair)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", "is", "None", ":", "arg_3", ".", "append", "(", "None", ")", "else", ":", "arg_5", "=", "arg_4", ".", "shape", "[", "0", "]", "//", "arg_2", "arg_6", "=", "np", ".", "eye", "(", "arg_2", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "range", "(", "arg_5", ")", ":", "arg_9", "=", "np", ".", "zeros", "(", "arg_5", ")", "arg_9", "[", "arg_8", "]", "=", "1", "arg_7", ".", "append", "(", "np", ".", "kron", "(", "arg_6", ",", "arg_9", "[", "None", ",", ":", "]", ")", ".", "dot", "(", "arg_4", ")", ")", "arg_3", ".", "append", "(", "arg_7", ")", "return", "tuple", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Transform Stinespring representation to Kraus representation.\"\"\"\n    arg_3 = []\n    for arg_4 in arg_0:\n        if arg_4 is None:\n            arg_3.append(None)\n        else:\n            arg_5 = arg_4.shape[0] // arg_2\n            arg_6 = np.eye(arg_2)\n            arg_7 = []\n            for arg_8 in range(arg_5):\n                arg_9 = np.zeros(arg_5)\n                arg_9[arg_8] = 1\n                arg_7.append(np.kron(arg_6, arg_9[None, :]).dot(arg_4))\n            arg_3.append(arg_7)\n    return tuple(arg_3)", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_stinespring_to_kraus", "docstring": "Transform Stinespring representation to Kraus representation.", "docstring_tokens": ["Transform", "Stinespring", "representation", "to", "Kraus", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254206}
{"url": "https://github.com/mohan3d/PyOpenload/blob/7f9353915ca5546926ef07be9395c6de60e761b1/openload/openload.py#L31-L55", "sha": "7f9353915ca5546926ef07be9395c6de60e761b1", "docstring_summary": "Check the status of the incoming response, raise exception if status is not 200.", "language": "python", "parameters": "(cls, response_json)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'status'", "]", "arg_3", "=", "arg_1", "[", "'msg'", "]", "if", "arg_2", "==", "400", ":", "raise", "BadRequestException", "(", "arg_3", ")", "elif", "arg_2", "==", "403", ":", "raise", "PermissionDeniedException", "(", "arg_3", ")", "elif", "arg_2", "==", "404", ":", "raise", "FileNotFoundException", "(", "arg_3", ")", "elif", "arg_2", "==", "451", ":", "raise", "UnavailableForLegalReasonsException", "(", "arg_3", ")", "elif", "arg_2", "==", "509", ":", "raise", "BandwidthUsageExceeded", "(", "arg_3", ")", "elif", "arg_2", ">=", "500", ":", "raise", "ServerErrorException", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check the status of the incoming response, raise exception if status is not 200.\n\n        Args:\n            response_json (dict): results of the response of the GET request.\n\n        Returns:\n           None\n\n        \"\"\"\n        arg_2 = arg_1['status']\n        arg_3 = arg_1['msg']\n\n        if arg_2 == 400:\n            raise BadRequestException(arg_3)\n        elif arg_2 == 403:\n            raise PermissionDeniedException(arg_3)\n        elif arg_2 == 404:\n            raise FileNotFoundException(arg_3)\n        elif arg_2 == 451:\n            raise UnavailableForLegalReasonsException(arg_3)\n        elif arg_2 == 509:\n            raise BandwidthUsageExceeded(arg_3)\n        elif arg_2 >= 500:\n            raise ServerErrorException(arg_3)", "path": "openload/openload.py", "identifier": "OpenLoad._check_status", "docstring": "Check the status of the incoming response, raise exception if status is not 200.\n\n        Args:\n            response_json (dict): results of the response of the GET request.\n\n        Returns:\n           None", "docstring_tokens": ["Check", "the", "status", "of", "the", "incoming", "response", "raise", "exception", "if", "status", "is", "not", "200", "."], "nwo": "mohan3d/PyOpenload", "score": 0.19731540530731081, "idx": 254207}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_memoize.py#L103-L150", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "memoization decorator that respects args and kwargs", "language": "python", "parameters": "(func)", "return_statement": "return memoizer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "arg_5", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "_make_signature_key", "(", "arg_2", ",", "arg_3", ")", "if", "arg_4", "not", "in", "arg_1", ":", "arg_1", "[", "arg_4", "]", "=", "arg_0", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "arg_1", "[", "arg_4", "]", "arg_5", ".", "cache", "=", "arg_1", "return", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"\n    memoization decorator that respects args and kwargs\n\n    References:\n        https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize\n\n    Args:\n        func (Callable): live python function\n\n    Returns:\n        func: Funcd wrapper\n\n    CommandLine:\n        xdoctest -m ubelt.util_Func Func\n\n    Example:\n        >>> import ubelt as ub\n        >>> closure = {'a': 'b', 'c': 'd'}\n        >>> incr = [0]\n        >>> def foo(key):\n        >>>     value = closure[key]\n        >>>     incr[0] += 1\n        >>>     return value\n        >>> foo_memo = ub.Func(foo)\n        >>> assert foo('a') == 'b' and foo('c') == 'd'\n        >>> assert incr[0] == 2\n        >>> print('Call Funcd version')\n        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'\n        >>> assert incr[0] == 4\n        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'\n        >>> print('Counter should no longer increase')\n        >>> assert incr[0] == 4\n        >>> print('Closure changes result without memoization')\n        >>> closure = {'a': 0, 'c': 1}\n        >>> assert foo('a') == 0 and foo('c') == 1\n        >>> assert incr[0] == 6\n        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'\n    \"\"\"\n    arg_1 = {}\n    @functools.wraps(arg_0)\n    def arg_5(*arg_2, **arg_3):\n        arg_4 = _make_signature_key(arg_2, arg_3)\n        if arg_4 not in arg_1:\n            arg_1[arg_4] = arg_0(*arg_2, **arg_3)\n        return arg_1[arg_4]\n    arg_5.cache = arg_1\n    return arg_5", "path": "ubelt/util_memoize.py", "identifier": "memoize", "docstring": "memoization decorator that respects args and kwargs\n\n    References:\n        https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize\n\n    Args:\n        func (Callable): live python function\n\n    Returns:\n        func: memoized wrapper\n\n    CommandLine:\n        xdoctest -m ubelt.util_memoize memoize\n\n    Example:\n        >>> import ubelt as ub\n        >>> closure = {'a': 'b', 'c': 'd'}\n        >>> incr = [0]\n        >>> def foo(key):\n        >>>     value = closure[key]\n        >>>     incr[0] += 1\n        >>>     return value\n        >>> foo_memo = ub.memoize(foo)\n        >>> assert foo('a') == 'b' and foo('c') == 'd'\n        >>> assert incr[0] == 2\n        >>> print('Call memoized version')\n        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'\n        >>> assert incr[0] == 4\n        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'\n        >>> print('Counter should no longer increase')\n        >>> assert incr[0] == 4\n        >>> print('Closure changes result without memoization')\n        >>> closure = {'a': 0, 'c': 1}\n        >>> assert foo('a') == 0 and foo('c') == 1\n        >>> assert incr[0] == 6\n        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'", "docstring_tokens": ["memoization", "decorator", "that", "respects", "args", "and", "kwargs"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 254208}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/conditions.py#L125-L144", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "returns 0 if the date range is violated, otherwise, it will return\n        the quantity remaining under the stock limit.", "language": "python", "parameters": "(self, user, filtered=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "arg_2", ":", "if", "hasattr", "(", "arg_0", ".", "condition", ",", "\"remainder\"", ")", ":", "return", "arg_0", ".", "condition", ".", "remainder", "arg_3", "=", "type", "(", "arg_0", ".", "condition", ")", ".", "objects", ".", "filter", "(", "pk", "=", "arg_0", ".", "condition", ".", "id", ")", "arg_3", "=", "arg_0", ".", "pre_filter", "(", "arg_3", ",", "arg_1", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "return", "arg_3", "[", "0", "]", ".", "remainder", "else", ":", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        ''' returns 0 if the date range is violated, otherwise, it will return\n        the quantity remaining under the stock limit.\n\n        The filter for this condition must add an annotation called \"remainder\"\n        in order for this to work.\n        '''\n\n        if arg_2:\n            if hasattr(arg_0.condition, \"remainder\"):\n                return arg_0.condition.remainder\n\n        # Mark self.condition with a remainder\n        arg_3 = type(arg_0.condition).objects.filter(pk=arg_0.condition.id)\n        arg_3 = arg_0.pre_filter(arg_3, arg_1)\n\n        if len(arg_3) > 0:\n            return arg_3[0].remainder\n        else:\n            return 0", "path": "registrasion/controllers/conditions.py", "identifier": "RemainderSetByFilter.user_quantity_remaining", "docstring": "returns 0 if the date range is violated, otherwise, it will return\n        the quantity remaining under the stock limit.\n\n        The filter for this condition must add an annotation called \"remainder\"\n        in order for this to work.", "docstring_tokens": ["returns", "0", "if", "the", "date", "range", "is", "violated", "otherwise", "it", "will", "return", "the", "quantity", "remaining", "under", "the", "stock", "limit", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 254209}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1029-L1048", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Verifies the signature on this certificate signing request.", "language": "python", "parameters": "(self, pkey)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "PKey", ")", ":", "raise", "TypeError", "(", "\"pkey must be a PKey instance\"", ")", "arg_2", "=", "_lib", ".", "X509_REQ_Func", "(", "arg_0", ".", "_req", ",", "arg_1", ".", "_pkey", ")", "if", "arg_2", "<=", "0", ":", "_raise_current_error", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Verifies the signature on this certificate signing request.\n\n        :param PKey key: A public key.\n\n        :return: ``True`` if the signature is correct.\n        :rtype: bool\n\n        :raises OpenSSL.crypto.Error: If the signature is invalid or there is a\n            problem Funcing the signature.\n        \"\"\"\n        if not isinstance(arg_1, PKey):\n            raise TypeError(\"pkey must be a PKey instance\")\n\n        arg_2 = _lib.X509_REQ_Func(arg_0._req, arg_1._pkey)\n        if arg_2 <= 0:\n            _raise_current_error()\n\n        return arg_2", "path": "src/OpenSSL/crypto.py", "identifier": "X509Req.verify", "docstring": "Verifies the signature on this certificate signing request.\n\n        :param PKey key: A public key.\n\n        :return: ``True`` if the signature is correct.\n        :rtype: bool\n\n        :raises OpenSSL.crypto.Error: If the signature is invalid or there is a\n            problem verifying the signature.", "docstring_tokens": ["Verifies", "the", "signature", "on", "this", "certificate", "signing", "request", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 254210}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L45-L61", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the class corresponding to the given temporalImp string", "language": "python", "parameters": "(temporalImp)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "'py'", ":", "return", "backtracking_tm", ".", "BacktrackingTM", "elif", "arg_0", "==", "'cpp'", ":", "return", "backtracking_tm_cpp", ".", "BacktrackingTMCPP", "elif", "arg_0", "==", "'tm_py'", ":", "return", "backtracking_tm_shim", ".", "TMShim", "elif", "arg_0", "==", "'tm_cpp'", ":", "return", "backtracking_tm_shim", ".", "TMCPPShim", "elif", "arg_0", "==", "'monitored_tm_py'", ":", "return", "backtracking_tm_shim", ".", "MonitoredTMShim", "else", ":", "raise", "RuntimeError", "(", "\"Invalid temporalImp '%s'. Legal values are: 'py', \"", "\"'cpp', 'tm_py', 'monitored_tm_py'\"", "%", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n  \"\"\" Return the class corresponding to the given temporalImp string\n  \"\"\"\n\n  if arg_0 == 'py':\n    return backtracking_tm.BacktrackingTM\n  elif arg_0 == 'cpp':\n    return backtracking_tm_cpp.BacktrackingTMCPP\n  elif arg_0 == 'tm_py':\n    return backtracking_tm_shim.TMShim\n  elif arg_0 == 'tm_cpp':\n    return backtracking_tm_shim.TMCPPShim\n  elif arg_0 == 'monitored_tm_py':\n    return backtracking_tm_shim.MonitoredTMShim\n  else:\n    raise RuntimeError(\"Invalid temporalImp '%s'. Legal values are: 'py', \"\n              \"'cpp', 'tm_py', 'monitored_tm_py'\" % (arg_0))", "path": "src/nupic/regions/tm_region.py", "identifier": "_getTPClass", "docstring": "Return the class corresponding to the given temporalImp string", "docstring_tokens": ["Return", "the", "class", "corresponding", "to", "the", "given", "temporalImp", "string"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254211}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/harmonic.py#L331-L382", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Populate a harmonic tensor from a time-frequency representation with\n    time-varying frequencies.", "language": "python", "parameters": "(harmonic_out, x, freqs, h_range, kind='linear', fill_value=0,\n                 axis=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "'linear'", ",", "arg_5", "=", "0", ",", "arg_6", "=", "0", ")", ":", "arg_7", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_1", ".", "ndim", "arg_8", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_1", ".", "ndim", "arg_9", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "arg_10", "=", "(", "1", "+", "arg_6", ")", "%", "arg_1", ".", "ndim", "for", "arg_11", "in", "range", "(", "arg_1", ".", "shape", "[", "arg_10", "]", ")", ":", "arg_7", "[", "arg_10", "]", "=", "slice", "(", "arg_11", ",", "arg_11", "+", "1", ")", "arg_8", "[", "arg_10", "]", "=", "arg_11", "arg_9", "[", "1", "+", "arg_10", "]", "=", "arg_7", "[", "arg_10", "]", "harmonics_1d", "(", "arg_0", "[", "tuple", "(", "arg_9", ")", "]", ",", "arg_1", "[", "tuple", "(", "arg_7", ")", "]", ",", "arg_2", "[", "tuple", "(", "arg_8", ")", "]", ",", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4='linear', arg_5=0,\n                 arg_6=0):\n    '''Populate a harmonic tensor from a time-frequency representation with\n    time-varying frequencies.\n\n    Parameters\n    ----------\n    harmonic_out : np.ndarray\n        The output array to store harmonics\n\n    x : np.ndarray\n        The input energy\n\n    freqs : np.ndarray, shape=x.shape\n        The frequency values corresponding to each element of `x`\n\n    h_range : list-like, non-negative\n        Harmonics to compute.  The first harmonic (1) corresponds to `x`\n        itself.  Values less than one (e.g., 1/2) correspond to\n        sub-harmonics.\n\n    kind : str\n        Interpolation type.  See `scipy.interpolate.interp1d`.\n\n    fill_value : float\n        The value to fill when extrapolating beyond the observed\n        frequency range.\n\n    axis : int\n        The axis along which to compute harmonics\n\n    See Also\n    --------\n    harmonics\n    harmonics_1d\n    '''\n    arg_7 = [slice(None)] * arg_1.ndim\n    arg_8 = [slice(None)] * arg_1.ndim\n    arg_9 = [slice(None)] * arg_0.ndim\n\n    # This is the non-interpolation axis\n    arg_10 = (1 + arg_6) % arg_1.ndim\n\n    # For each value in the non-interpolated axis, compute its harmonics\n    for arg_11 in range(arg_1.shape[arg_10]):\n        arg_7[arg_10] = slice(arg_11, arg_11 + 1)\n        arg_8[arg_10] = arg_11\n        arg_9[1 + arg_10] = arg_7[arg_10]\n\n        harmonics_1d(arg_0[tuple(arg_9)], arg_1[tuple(arg_7)], arg_2[tuple(arg_8)],\n                     arg_3, arg_4=arg_4, arg_5=arg_5,\n                     arg_6=arg_6)", "path": "librosa/core/harmonic.py", "identifier": "harmonics_2d", "docstring": "Populate a harmonic tensor from a time-frequency representation with\n    time-varying frequencies.\n\n    Parameters\n    ----------\n    harmonic_out : np.ndarray\n        The output array to store harmonics\n\n    x : np.ndarray\n        The input energy\n\n    freqs : np.ndarray, shape=x.shape\n        The frequency values corresponding to each element of `x`\n\n    h_range : list-like, non-negative\n        Harmonics to compute.  The first harmonic (1) corresponds to `x`\n        itself.  Values less than one (e.g., 1/2) correspond to\n        sub-harmonics.\n\n    kind : str\n        Interpolation type.  See `scipy.interpolate.interp1d`.\n\n    fill_value : float\n        The value to fill when extrapolating beyond the observed\n        frequency range.\n\n    axis : int\n        The axis along which to compute harmonics\n\n    See Also\n    --------\n    harmonics\n    harmonics_1d", "docstring_tokens": ["Populate", "a", "harmonic", "tensor", "from", "a", "time", "-", "frequency", "representation", "with", "time", "-", "varying", "frequencies", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 254212}
{"url": "https://github.com/textbook/aslack/blob/9ac6a44e4464180109fa4be130ad7a980a9d1acc/aslack/slack_bot/bot.py#L204-L229", "sha": "9ac6a44e4464180109fa4be130ad7a980a9d1acc", "docstring_summary": "Generates the instructions for a bot and its filters.", "language": "python", "parameters": "(self, filters)", "return_statement": "return '\\n\\n'.join([\n            self.INSTRUCTIONS.strip(),\n            '*Supported methods:*',\n            'If you send \"@{}: help\" to me I reply with these '\n            'instructions.'.format(self.user),\n            'If you send \"@{}: version\" to me I reply with my current '\n            'version.'.format(self.user),\n        ] + [filter.description() for filter in filters])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "'\\n\\n'", ".", "join", "(", "[", "arg_0", ".", "INSTRUCTIONS", ".", "strip", "(", ")", ",", "'*Supported methods:*'", ",", "'If you send \"@{}: help\" to me I reply with these '", "'instructions.'", ".", "format", "(", "arg_0", ".", "user", ")", ",", "'If you send \"@{}: version\" to me I reply with my current '", "'version.'", ".", "format", "(", "arg_0", ".", "user", ")", ",", "]", "+", "[", "arg_2", ".", "description", "(", ")", "for", "arg_2", "in", "arg_1", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Generates the instructions for a bot and its filters.\n\n        Note:\n          The guidance for each filter is generated by combining the\n          docstrings of the predicate filter and resulting dispatch\n          function with a single space between. The class's\n          :py:attr:`INSTRUCTIONS` and the default help command are\n          added.\n\n        Arguments:\n          filters (:py:class:`list`): The filters to apply to incoming\n            messages.\n\n        Returns:\n          :py:class:`str`: The bot's instructions.\n\n        \"\"\"\n        return '\\n\\n'.join([\n            arg_0.INSTRUCTIONS.strip(),\n            '*Supported methods:*',\n            'If you send \"@{}: help\" to me I reply with these '\n            'instructions.'.format(arg_0.user),\n            'If you send \"@{}: version\" to me I reply with my current '\n            'version.'.format(arg_0.user),\n        ] + [arg_2.description() for arg_2 in arg_1])", "path": "aslack/slack_bot/bot.py", "identifier": "SlackBot._instruction_list", "docstring": "Generates the instructions for a bot and its filters.\n\n        Note:\n          The guidance for each filter is generated by combining the\n          docstrings of the predicate filter and resulting dispatch\n          function with a single space between. The class's\n          :py:attr:`INSTRUCTIONS` and the default help command are\n          added.\n\n        Arguments:\n          filters (:py:class:`list`): The filters to apply to incoming\n            messages.\n\n        Returns:\n          :py:class:`str`: The bot's instructions.", "docstring_tokens": ["Generates", "the", "instructions", "for", "a", "bot", "and", "its", "filters", "."], "nwo": "textbook/aslack", "score": 0.18261785916548806, "idx": 254213}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/mapping.py#L295-L329", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles mapping elements to diagram components", "language": "python", "parameters": "(self, obj, name, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "diagram", ".", "diagram_canvas", "arg_5", "=", "XDotParser", "(", ")", "for", "arg_6", "in", "arg_3", ".", "added", ":", "logger", ".", "debug", "(", "\"Mapping new element [%s] to diagram node\"", "%", "arg_6", ")", "for", "arg_7", "in", "arg_0", ".", "nodes", ":", "arg_8", "=", "arg_2", "[", ":", "-", "6", "]", "if", "arg_7", ".", "containment_trait", "==", "arg_8", ":", "arg_9", "=", "arg_7", ".", "dot_node", "arg_10", "=", "Dot", "(", ")", "arg_11", "=", "Node", "(", "str", "(", "id", "(", "arg_6", ")", ")", ")", "arg_0", ".", "_style_node", "(", "arg_11", ",", "arg_9", ")", "arg_10", ".", "add_node", "(", "arg_11", ")", "arg_12", "=", "graph_from_dot_data", "(", "arg_10", ".", "create", "(", "arg_0", ".", "program", ",", "\"xdot\"", ")", ")", "arg_13", "=", "arg_5", ".", "parse_nodes", "(", "arg_12", ")", "for", "arg_14", "in", "arg_13", ":", "if", "arg_14", "is", "not", "None", ":", "arg_14", ".", "element", "=", "arg_6", "for", "arg_15", "in", "arg_7", ".", "tools", ":", "arg_14", ".", "tools", ".", "append", "(", "arg_15", "(", "arg_14", ")", ")", "arg_4", ".", "add", "(", "arg_14", ")", "arg_4", ".", "request_redraw", "(", ")", "for", "arg_6", "in", "arg_3", ".", "removed", ":", "logger", ".", "debug", "(", "\"Unmapping element [%s] from diagram\"", "%", "arg_6", ")", "for", "arg_16", "in", "arg_4", ".", "components", ":", "if", "arg_6", "==", "arg_16", ".", "element", ":", "arg_4", ".", "remove", "(", "arg_16", ")", "arg_4", ".", "request_redraw", "(", ")", "break"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Handles mapping elements to diagram components \"\"\"\n\n        arg_4 = arg_0.diagram.diagram_canvas\n        arg_5 = XDotParser()\n\n        for arg_6 in arg_3.added:\n            logger.debug(\"Mapping new element [%s] to diagram node\" % arg_6)\n            for arg_7 in arg_0.nodes:\n                arg_8 = arg_2[:-6] #strip '_items'\n                if arg_7.containment_trait == arg_8:\n                    arg_9 = arg_7.dot_node\n                    arg_10 = Dot()\n                    arg_11 = Node(str(id(arg_6)))\n                    arg_0._style_node(arg_11, arg_9)\n                    arg_10.add_node(arg_11)\n                    arg_12 = graph_from_dot_data(arg_10.create(arg_0.program,\"xdot\"))\n                    arg_13 = arg_5.parse_nodes(arg_12)#.get_node_list())\n                    for arg_14 in arg_13:\n                        if arg_14 is not None:\n                            arg_14.element = arg_6\n                            # Tools\n                            for arg_15 in arg_7.tools:\n                                arg_14.tools.append(arg_15(arg_14))\n\n                            arg_4.add(arg_14)\n                            arg_4.request_redraw()\n\n        for arg_6 in arg_3.removed:\n            logger.debug(\"Unmapping element [%s] from diagram\" % arg_6)\n            for arg_16 in arg_4.components:\n                if arg_6 == arg_16.element:\n                    arg_4.remove(arg_16)\n                    arg_4.request_redraw()\n                    break", "path": "godot/mapping.py", "identifier": "Mapping.map_element", "docstring": "Handles mapping elements to diagram components", "docstring_tokens": ["Handles", "mapping", "elements", "to", "diagram", "components"], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 254214}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L284-L305", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "Return tuple with mantissa and exponent of number formatted in engineering notation.", "language": "python", "parameters": "(number)", "return_statement": "return NumComp(new_mant, new_exp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "lambda", "x", ",", "p", ":", "(", "x", ".", "ljust", "(", "3", "+", "arg_4", ",", "\"0\"", ")", "[", ":", "p", "]", ",", "x", "[", "p", ":", "]", ".", "rstrip", "(", "\"0\"", ")", ")", "arg_2", ",", "arg_3", "=", "to_scientific_tuple", "(", "arg_0", ")", "arg_2", ",", "arg_4", "=", "arg_2", ".", "replace", "(", "\".\"", ",", "\"\"", ")", ",", "arg_2", ".", "startswith", "(", "\"-\"", ")", "arg_5", "=", "\".\"", ".", "join", "(", "filter", "(", "None", ",", "arg_1", "(", "arg_2", ",", "1", "+", "(", "arg_3", "%", "3", ")", "+", "arg_4", ")", ")", ")", "arg_6", "=", "int", "(", "3", "*", "math", ".", "floor", "(", "arg_3", "/", "3", ")", ")", "return", "NumComp", "(", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Return tuple with mantissa and exponent of number formatted in engineering notation.\n\n    :param number: Number\n    :type  number: integer or float\n\n    :rtype: tuple\n    \"\"\"\n    # pylint: disable=W0141\n    # Helper function: split integer and fractional part of mantissa\n    #  + ljust ensures that integer part in engineering notation has\n    #    at most 3 digits (say if number given is 1E4)\n    #  + rstrip ensures that there is no empty fractional part\n    arg_1 = lambda x, p: (x.ljust(3 + arg_4, \"0\")[:p], x[p:].rstrip(\"0\"))\n    # Convert number to scientific notation, a \"constant\" format\n    arg_2, arg_3 = to_scientific_tuple(arg_0)\n    arg_2, arg_4 = arg_2.replace(\".\", \"\"), arg_2.startswith(\"-\")\n    # New values\n    arg_5 = \".\".join(filter(None, arg_1(arg_2, 1 + (arg_3 % 3) + arg_4)))\n    arg_6 = int(3 * math.floor(arg_3 / 3))\n    return NumComp(arg_5, arg_6)", "path": "peng/functions.py", "identifier": "_to_eng_tuple", "docstring": "Return tuple with mantissa and exponent of number formatted in engineering notation.\n\n    :param number: Number\n    :type  number: integer or float\n\n    :rtype: tuple", "docstring_tokens": ["Return", "tuple", "with", "mantissa", "and", "exponent", "of", "number", "formatted", "in", "engineering", "notation", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 254215}
{"url": "https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr_ensemble.py#L128-L149", "sha": "768565deb10467d04a960d27e000ab38b7aa8a62", "docstring_summary": "Estimates the accuracy of the predictions from the MDR ensemble", "language": "python", "parameters": "(self, features, classes, scoring_function=None, **scoring_function_kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "ensemble", ".", "predict", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "return", "accuracy_Func", "(", "arg_2", ",", "arg_5", ")", "else", ":", "return", "arg_3", "(", "arg_2", ",", "arg_5", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, **arg_4):\n        \"\"\"Estimates the accuracy of the predictions from the MDR ensemble\n\n        Parameters\n        ----------\n        features: array-like {n_samples, n_features}\n            Feature matrix to predict from\n        classes: array-like {n_samples}\n            List of true class labels\n\n        Returns\n        -------\n        accuracy_Func: float\n            The estimated accuracy based on the constructed feature\n\n        \"\"\"\n        arg_5 = arg_0.ensemble.predict(arg_1)\n\n        if arg_3 is None:\n            return accuracy_Func(arg_2, arg_5)\n        else:\n            return arg_3(arg_2, arg_5, **arg_4)", "path": "mdr/mdr_ensemble.py", "identifier": "MDREnsemble.score", "docstring": "Estimates the accuracy of the predictions from the MDR ensemble\n\n        Parameters\n        ----------\n        features: array-like {n_samples, n_features}\n            Feature matrix to predict from\n        classes: array-like {n_samples}\n            List of true class labels\n\n        Returns\n        -------\n        accuracy_score: float\n            The estimated accuracy based on the constructed feature", "docstring_tokens": ["Estimates", "the", "accuracy", "of", "the", "predictions", "from", "the", "MDR", "ensemble"], "nwo": "EpistasisLab/scikit-mdr", "score": 0.36572091509454285, "idx": 254216}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L69-L73", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Display one case.", "language": "python", "parameters": "(institute_id, case_name)", "return_statement": "return dict(institute=institute_obj, case=case_obj, **data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "institute_and_Func", "(", "store", ",", "arg_0", ",", "arg_1", ")", "arg_4", "=", "controllers", ".", "Func", "(", "store", ",", "arg_2", ",", "arg_3", ")", "return", "dict", "(", "institute", "=", "arg_2", ",", "Func", "=", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Display one Func.\"\"\"\n    arg_2, arg_3 = institute_and_Func(store, arg_0, arg_1)\n    arg_4 = controllers.Func(store, arg_2, arg_3)\n    return dict(institute=arg_2, Func=arg_3, **arg_4)", "path": "scout/server/blueprints/cases/views.py", "identifier": "case", "docstring": "Display one case.", "docstring_tokens": ["Display", "one", "case", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254217}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/optics/base.py#L122-L126", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Intended to be overridden by subclasses. Raises\n        NotImplementedError.", "language": "python", "parameters": "(self, f, state)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "'Tried to use unimplemented lens {}.'", "raise", "NotImplementedError", "(", "arg_3", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Intended to be overridden by subclasses. Raises\n        NotImplementedError.'''\n        arg_3 = 'Tried to use unimplemented lens {}.'\n        raise NotImplementedError(arg_3.format(type(arg_0)))", "path": "lenses/optics/base.py", "identifier": "LensLike.func", "docstring": "Intended to be overridden by subclasses. Raises\n        NotImplementedError.", "docstring_tokens": ["Intended", "to", "be", "overridden", "by", "subclasses", ".", "Raises", "NotImplementedError", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 254218}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L541-L563", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds parameters for a network simulation.", "language": "python", "parameters": "(self, traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_logger", ".", "info", "(", "'Adding Parameters of Components'", ")", "for", "arg_2", "in", "arg_0", ".", "components", ":", "arg_2", ".", "Func", "(", "arg_1", ")", "if", "arg_0", ".", "analysers", ":", "arg_0", ".", "_logger", ".", "info", "(", "'Adding Parameters of Analysers'", ")", "for", "arg_3", "in", "arg_0", ".", "analysers", ":", "arg_3", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "_logger", ".", "info", "(", "'Adding Parameters of Runner'", ")", "arg_0", ".", "network_runner", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Adds parameters for a network simulation.\n\n        Calls :func:`~pypet.brian2.network.NetworkComponent.Func` for all components,\n        analyser, and the network runner (in this order).\n\n        :param traj:  Trajectory container\n\n        \"\"\"\n        arg_0._logger.info('Adding Parameters of Components')\n\n        for arg_2 in arg_0.components:\n            arg_2.Func(arg_1)\n\n        if arg_0.analysers:\n            arg_0._logger.info('Adding Parameters of Analysers')\n\n            for arg_3 in arg_0.analysers:\n                arg_3.Func(arg_1)\n\n        arg_0._logger.info('Adding Parameters of Runner')\n\n        arg_0.network_runner.Func(arg_1)", "path": "pypet/brian2/network.py", "identifier": "NetworkManager.add_parameters", "docstring": "Adds parameters for a network simulation.\n\n        Calls :func:`~pypet.brian2.network.NetworkComponent.add_parameters` for all components,\n        analyser, and the network runner (in this order).\n\n        :param traj:  Trajectory container", "docstring_tokens": ["Adds", "parameters", "for", "a", "network", "simulation", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254219}
{"url": "https://github.com/dsoprea/pytzPure/blob/ec8f7803ca1025d363ba954905ae7717a0524a0e/pytzpure/__init__.py#L126-L183", "sha": "ec8f7803ca1025d363ba954905ae7717a0524a0e", "docstring_summary": "r''' Return a datetime.tzinfo implementation for the given timezone", "language": "python", "parameters": "(zone)", "return_statement": "return _tzinfo_cache[zone]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "upper", "(", ")", "==", "'UTC'", ":", "return", "utc", "try", ":", "arg_0", "=", "ascii", "(", "arg_0", ")", "except", "UnicodeEncodeError", ":", "raise", "UnknownTimeZoneError", "(", "arg_0", ")", "arg_0", "=", "_unmunge_zone", "(", "arg_0", ")", "if", "arg_0", "not", "in", "arg_1", ":", "if", "arg_0", "in", "all_Funcs_set", ":", "arg_1", "[", "arg_0", "]", "=", "build_tzinfo", "(", "arg_0", ")", "else", ":", "raise", "UnknownTimeZoneError", "(", "arg_0", ")", "return", "arg_1", "[", "arg_0", "]"], "function": "def Func(arg_0):\n    r''' Return a datetime.tzinfo implementation for the given Func \n\n    >>> from datetime import datetime, timedelta\n    >>> utc = Func('UTC')\n    >>> eastern = Func('US/Eastern')\n    >>> eastern.zone\n    'US/Eastern'\n    >>> Func(unicode('US/Eastern')) is eastern\n    True\n    >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc)\n    >>> loc_dt = utc_dt.asFunc(eastern)\n    >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'\n    >>> loc_dt.strftime(fmt)\n    '2002-10-27 01:00:00 EST (-0500)'\n    >>> (loc_dt - timedelta(minutes=10)).strftime(fmt)\n    '2002-10-27 00:50:00 EST (-0500)'\n    >>> eastern.normalize(loc_dt - timedelta(minutes=10)).strftime(fmt)\n    '2002-10-27 01:50:00 EDT (-0400)'\n    >>> (loc_dt + timedelta(minutes=10)).strftime(fmt)\n    '2002-10-27 01:10:00 EST (-0500)'\n\n    Raises UnknownTimeZoneError if passed an unknown zone.\n\n    >>> try:\n    ...     Func('Asia/Shangri-La')\n    ... except UnknownTimeZoneError:\n    ...     print('Unknown')\n    Unknown\n\n    >>> try:\n    ...     Func(unicode('\\N{TRADE MARK SIGN}'))\n    ... except UnknownTimeZoneError:\n    ...     print('Unknown')\n    Unknown\n\n    '''\n    if arg_0.upper() == 'UTC':\n        return utc\n\n    try:\n        arg_0 = ascii(arg_0)\n    except UnicodeEncodeError:\n        # All valid Funcs are ASCII\n        raise UnknownTimeZoneError(arg_0)\n\n    arg_0 = _unmunge_zone(arg_0)\n    if arg_0 not in arg_1:\n        if arg_0 in all_Funcs_set:\n#            fp = open_resource(zone)\n#            try:\n             arg_1[arg_0] = build_tzinfo(arg_0)#, fp)\n#            finally:\n#                fp.close()\n        else:\n            raise UnknownTimeZoneError(arg_0)\n\n    return arg_1[arg_0]", "path": "pytzpure/__init__.py", "identifier": "timezone", "docstring": "r''' Return a datetime.tzinfo implementation for the given timezone \n\n    >>> from datetime import datetime, timedelta\n    >>> utc = timezone('UTC')\n    >>> eastern = timezone('US/Eastern')\n    >>> eastern.zone\n    'US/Eastern'\n    >>> timezone(unicode('US/Eastern')) is eastern\n    True\n    >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc)\n    >>> loc_dt = utc_dt.astimezone(eastern)\n    >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'\n    >>> loc_dt.strftime(fmt)\n    '2002-10-27 01:00:00 EST (-0500)'\n    >>> (loc_dt - timedelta(minutes=10)).strftime(fmt)\n    '2002-10-27 00:50:00 EST (-0500)'\n    >>> eastern.normalize(loc_dt - timedelta(minutes=10)).strftime(fmt)\n    '2002-10-27 01:50:00 EDT (-0400)'\n    >>> (loc_dt + timedelta(minutes=10)).strftime(fmt)\n    '2002-10-27 01:10:00 EST (-0500)'\n\n    Raises UnknownTimeZoneError if passed an unknown zone.\n\n    >>> try:\n    ...     timezone('Asia/Shangri-La')\n    ... except UnknownTimeZoneError:\n    ...     print('Unknown')\n    Unknown\n\n    >>> try:\n    ...     timezone(unicode('\\N{TRADE MARK SIGN}'))\n    ... except UnknownTimeZoneError:\n    ...     print('Unknown')\n    Unknown", "docstring_tokens": ["r", "Return", "a", "datetime", ".", "tzinfo", "implementation", "for", "the", "given", "timezone"], "nwo": "dsoprea/pytzPure", "score": 0.17782712273869106, "idx": 254220}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L169-L207", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Retrieves info about the repos of the current organization.", "language": "python", "parameters": "(self, repo_type='public', organization='llnl')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'public'", ",", "arg_2", "=", "'llnl'", ")", ":", "print", "'Getting Func.'", "for", "arg_3", "in", "arg_0", ".", "org_retrieved", ".", "iter_Func", "(", "type", "=", "arg_1", ")", ":", "arg_4", "=", "arg_3", ".", "to_json", "(", ")", "arg_0", ".", "Func_json", "[", "arg_3", ".", "name", "]", "=", "arg_4", "arg_7", "=", "my_repo", ".", "My_Repo", "(", ")", "arg_7", ".", "name", "=", "arg_3", ".", "full_name", "arg_0", ".", "total_Func", "+=", "1", "arg_7", ".", "contributors", "=", "my_github", ".", "get_total_contributors", "(", "arg_3", ")", "arg_0", ".", "total_contributors", "+=", "arg_7", ".", "contributors", "arg_7", ".", "forks", "=", "arg_3", ".", "forks_count", "arg_0", ".", "total_forks", "+=", "arg_7", ".", "forks", "arg_7", ".", "stargazers", "=", "arg_3", ".", "stargazers", "arg_0", ".", "total_stars", "+=", "arg_7", ".", "stargazers", "arg_7", ".", "pull_requests_open", ",", "arg_7", ".", "pull_requests_closed", "=", "my_github", ".", "get_pull_reqs", "(", "arg_3", ")", "arg_7", ".", "pull_requests", "=", "(", "arg_7", ".", "pull_requests_open", "+", "arg_7", ".", "pull_requests_closed", ")", "arg_0", ".", "total_pull_reqs", "+=", "arg_7", ".", "pull_requests_open", "arg_0", ".", "total_pull_reqs", "+=", "arg_7", ".", "pull_requests_closed", "arg_0", ".", "total_pull_reqs_open", "+=", "arg_7", ".", "pull_requests_open", "arg_0", ".", "total_pull_reqs_closed", "+=", "arg_7", ".", "pull_requests_closed", "arg_7", ".", "open_issues", "=", "arg_3", ".", "open_issues_count", "arg_0", ".", "total_open_issues", "+=", "arg_7", ".", "open_issues", "arg_7", ".", "closed_issues", "=", "my_github", ".", "get_issues", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", "arg_7", ".", "issues", "=", "arg_7", ".", "closed_issues", "+", "arg_7", ".", "open_issues", "arg_0", ".", "total_closed_issues", "+=", "arg_7", ".", "closed_issues", "arg_0", ".", "total_issues", "+=", "arg_7", ".", "issues", "my_github", ".", "get_languages", "(", "arg_3", ",", "arg_7", ")", "arg_7", ".", "readme", "=", "my_github", ".", "get_readme", "(", "arg_3", ")", "arg_7", ".", "commits", "=", "arg_0", ".", "get_commits", "(", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "total_commits", "+=", "arg_7", ".", "commits", "arg_0", ".", "all_Func", ".", "append", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1='public', arg_2='llnl'):\n        \"\"\"\n        Retrieves info about the Func of the current organization.\n        \"\"\"\n        print 'Getting Func.'\n        for arg_3 in arg_0.org_retrieved.iter_Func(type=arg_1):\n            #JSON\n            arg_4 = arg_3.to_json()\n            arg_0.Func_json[arg_3.name] = arg_4\n            #CSV\n            arg_7 = my_repo.My_Repo()\n            arg_7.name = arg_3.full_name\n            arg_0.total_Func += 1\n            arg_7.contributors = my_github.get_total_contributors(arg_3)\n            arg_0.total_contributors += arg_7.contributors\n            arg_7.forks = arg_3.forks_count\n            arg_0.total_forks += arg_7.forks\n            arg_7.stargazers = arg_3.stargazers\n            arg_0.total_stars += arg_7.stargazers\n            arg_7.pull_requests_open, arg_7.pull_requests_closed = \\\n                my_github.get_pull_reqs(arg_3)\n            arg_7.pull_requests = (arg_7.pull_requests_open\n                + arg_7.pull_requests_closed)\n            arg_0.total_pull_reqs += arg_7.pull_requests_open\n            arg_0.total_pull_reqs += arg_7.pull_requests_closed\n            arg_0.total_pull_reqs_open += arg_7.pull_requests_open\n            arg_0.total_pull_reqs_closed += arg_7.pull_requests_closed\n            arg_7.open_issues = arg_3.open_issues_count\n            arg_0.total_open_issues += arg_7.open_issues\n            arg_7.closed_issues = my_github.get_issues(arg_3, arg_2=arg_2)\n            arg_7.issues = arg_7.closed_issues + arg_7.open_issues\n            arg_0.total_closed_issues += arg_7.closed_issues\n            arg_0.total_issues += arg_7.issues\n            my_github.get_languages(arg_3, arg_7)\n            arg_7.readme = my_github.get_readme(arg_3)\n            #temp_repo.license = my_github.get_license(repo)\n            arg_7.commits = arg_0.get_commits(arg_3=arg_3, arg_2=arg_2)\n            arg_0.total_commits += arg_7.commits\n            arg_0.all_Func.append(arg_7)", "path": "scripts/github_stats.py", "identifier": "GitHub_LLNL_Stats.repos", "docstring": "Retrieves info about the repos of the current organization.", "docstring_tokens": ["Retrieves", "info", "about", "the", "repos", "of", "the", "current", "organization", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 254221}
{"url": "https://github.com/antevens/listen/blob/d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67/listen/signal_handler.py#L190-L204", "sha": "d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67", "docstring_summary": "Tries to remove a registered event without triggering it", "language": "python", "parameters": "(self, event_list, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Removing event {0}({1},{2})\"", ".", "format", "(", "arg_2", "[", "'function'", "]", ".", "__name__", ",", "arg_2", "[", "'args'", "]", ",", "arg_2", "[", "'kwargs'", "]", ")", ")", "except", "AttributeError", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Removing event {0}\"", ".", "format", "(", "str", "(", "arg_2", ")", ")", ")", "try", ":", "arg_1", ".", "remove", "(", "arg_2", ")", "except", "ValueError", ":", "try", ":", "arg_0", ".", "log", ".", "warn", "(", "\"Unable to remove event {0}({1},{2}) , not found in list: {3}\"", ".", "format", "(", "arg_2", "[", "'function'", "]", ".", "__name__", ",", "arg_2", "[", "'args'", "]", ",", "arg_2", "[", "'kwargs'", "]", ",", "arg_1", ")", ")", "except", "AttributeError", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Unable to remove event {0}\"", ".", "format", "(", "str", "(", "arg_2", ")", ")", ")", "raise", "KeyError", "(", "'Unable to unregister the specified event from the signals specified'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Tries to remove a registered event without triggering it \"\"\"\n        try:\n            arg_0.log.debug(\"Removing event {0}({1},{2})\".format(arg_2['function'].__name__, arg_2['args'], arg_2['kwargs']))\n        except AttributeError:\n            arg_0.log.debug(\"Removing event {0}\".format(str(arg_2)))\n\n        try:\n            arg_1.remove(arg_2)\n        except ValueError:\n            try:\n                arg_0.log.warn(\"Unable to remove event {0}({1},{2}) , not found in list: {3}\".format(arg_2['function'].__name__, arg_2['args'], arg_2['kwargs'], arg_1))\n            except AttributeError:\n                arg_0.log.debug(\"Unable to remove event {0}\".format(str(arg_2)))\n            raise KeyError('Unable to unregister the specified event from the signals specified')", "path": "listen/signal_handler.py", "identifier": "SignalHandler._unreg_event", "docstring": "Tries to remove a registered event without triggering it", "docstring_tokens": ["Tries", "to", "remove", "a", "registered", "event", "without", "triggering", "it"], "nwo": "antevens/listen", "score": 0.21302904236143622, "idx": 254222}
{"url": "https://github.com/Alignak-monitoring-contrib/alignak-backend-client/blob/1e21f6ce703e66984d1f9b20fe7866460ab50b39/alignak_backend_client/client.py#L550-L610", "sha": "1e21f6ce703e66984d1f9b20fe7866460ab50b39", "docstring_summary": "Method to update an item", "language": "python", "parameters": "(self, endpoint, data, headers=None, inception=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "not", "arg_3", ":", "raise", "BackendException", "(", "BACKEND_ERROR", ",", "\"Header If-Match required for Funcing an object\"", ")", "arg_5", "=", "arg_0", ".", "get_response", "(", "method", "=", "'PATCH'", ",", "arg_1", "=", "arg_1", ",", "json", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "arg_5", ".", "status_code", "==", "200", ":", "return", "arg_0", ".", "decode", "(", "arg_5", "=", "arg_5", ")", "if", "arg_5", ".", "status_code", "==", "412", ":", "if", "arg_4", ":", "arg_6", "=", "arg_0", ".", "get", "(", "arg_1", ")", "arg_3", "=", "{", "'If-Match'", ":", "arg_6", "[", "'_etag'", "]", "}", "return", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "False", ")", "raise", "BackendException", "(", "arg_5", ".", "status_code", ",", "arg_5", ".", "content", ")", "else", ":", "raise", "BackendException", "(", "arg_5", ".", "status_code", ",", "arg_5", ".", "content", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=False):\n        \"\"\"\n        Method to update an item\n\n        The headers must include an If-Match containing the object _etag.\n            headers = {'If-Match': contact_etag}\n\n        The data dictionary contain the fields that must be modified.\n\n        If the Funcing fails because the _etag object do not match with the provided one, a\n        BackendException is raised with code = 412.\n\n        If inception is True, this method makes e new get request on the endpoint to refresh the\n        _etag and then a new Func is called.\n\n        If an HTTP 412 error occurs, a BackendException is raised. This exception is:\n        - code: 412\n        - message: response content\n        - response: backend response\n\n        All other HTTP error raises a BackendException.\n        If some _issues are provided by the backend, this exception is:\n        - code: HTTP error code\n        - message: response content\n        - response: JSON encoded backend response (including '_issues' dictionary ...)\n\n        If no _issues are provided and an _error is signaled by the backend, this exception is:\n        - code: backend error code\n        - message: backend error message\n        - response: JSON encoded backend response\n\n        :param endpoint: endpoint (API URL)\n        :type endpoint: str\n        :param data: properties of item to update\n        :type data: dict\n        :param headers: headers (example: Content-Type). 'If-Match' required\n        :type headers: dict\n        :param inception: if True tries to get the last _etag\n        :type inception: bool\n        :return: dictionary containing Func response from the backend\n        :rtype: dict\n        \"\"\"\n        if not arg_3:\n            raise BackendException(BACKEND_ERROR, \"Header If-Match required for Funcing an object\")\n\n        arg_5 = arg_0.get_response(method='PATCH', arg_1=arg_1, json=arg_2, arg_3=arg_3)\n\n        if arg_5.status_code == 200:\n            return arg_0.decode(arg_5=arg_5)\n\n        if arg_5.status_code == 412:\n            # 412 means Precondition failed, but confirm ...\n            if arg_4:\n                # update etag and retry to Func\n                arg_6 = arg_0.get(arg_1)\n                arg_3 = {'If-Match': arg_6['_etag']}\n                return arg_0.Func(arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=False)\n\n            raise BackendException(arg_5.status_code, arg_5.content)\n        else:  # pragma: no cover - should never occur\n            raise BackendException(arg_5.status_code, arg_5.content)", "path": "alignak_backend_client/client.py", "identifier": "Backend.patch", "docstring": "Method to update an item\n\n        The headers must include an If-Match containing the object _etag.\n            headers = {'If-Match': contact_etag}\n\n        The data dictionary contain the fields that must be modified.\n\n        If the patching fails because the _etag object do not match with the provided one, a\n        BackendException is raised with code = 412.\n\n        If inception is True, this method makes e new get request on the endpoint to refresh the\n        _etag and then a new patch is called.\n\n        If an HTTP 412 error occurs, a BackendException is raised. This exception is:\n        - code: 412\n        - message: response content\n        - response: backend response\n\n        All other HTTP error raises a BackendException.\n        If some _issues are provided by the backend, this exception is:\n        - code: HTTP error code\n        - message: response content\n        - response: JSON encoded backend response (including '_issues' dictionary ...)\n\n        If no _issues are provided and an _error is signaled by the backend, this exception is:\n        - code: backend error code\n        - message: backend error message\n        - response: JSON encoded backend response\n\n        :param endpoint: endpoint (API URL)\n        :type endpoint: str\n        :param data: properties of item to update\n        :type data: dict\n        :param headers: headers (example: Content-Type). 'If-Match' required\n        :type headers: dict\n        :param inception: if True tries to get the last _etag\n        :type inception: bool\n        :return: dictionary containing patch response from the backend\n        :rtype: dict", "docstring_tokens": ["Method", "to", "update", "an", "item"], "nwo": "Alignak-monitoring-contrib/alignak-backend-client", "score": 0.2791052024891814, "idx": 254223}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L126-L141", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Set the room topic.", "language": "python", "parameters": "(self, topic)", "return_statement": "return result[\"success\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "''", "arg_2", "=", "arg_0", ".", "_connection", ".", "put", "(", "\"room/%s\"", "%", "arg_0", ".", "id", ",", "{", "\"room\"", ":", "{", "\"topic\"", ":", "arg_1", "}", "}", ")", "if", "arg_2", "[", "\"success\"", "]", ":", "arg_0", ".", "_load", "(", ")", "return", "arg_2", "[", "\"success\"", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Set the room topic.\n\n        Args:\n            topic (str): Topic\n\n        Returns:\n            bool. Success\n        \"\"\"\n        if not arg_1:\n            arg_1 = ''\n        arg_2 = arg_0._connection.put(\"room/%s\" % arg_0.id, {\"room\": {\"topic\": arg_1}})\n        if arg_2[\"success\"]:\n            arg_0._load()\n\n        return arg_2[\"success\"]", "path": "pyfire/room.py", "identifier": "Room.set_topic", "docstring": "Set the room topic.\n\n        Args:\n            topic (str): Topic\n\n        Returns:\n            bool. Success", "docstring_tokens": ["Set", "the", "room", "topic", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 254224}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/pulse_lib/continuous.py#L186-L213", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "r\"\"\"Continuous gaussian square pulse.", "language": "python", "parameters": "(times: np.ndarray, amp: complex, center: float, width: float,\n                    sigma: float, zeroed_width: Union[None, float] = None)", "return_statement": "return np.piecewise(times.astype(np.complex_), condlist, funclist)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "ndarray", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_6", ",", "arg_7", ":", "arg_6", ",", "arg_8", ":", "arg_6", ",", "arg_9", ":", "arg_10", "[", "None", ",", "arg_6", "]", "=", "None", ")", "->", "arg_1", ".", "ndarray", ":", "arg_11", "=", "arg_5", "-", "arg_7", "/", "2", "arg_12", "=", "arg_5", "+", "arg_7", "/", "2", "if", "arg_9", ":", "arg_9", "=", "min", "(", "arg_7", ",", "arg_9", ")", "arg_13", "=", "arg_9", "-", "arg_7", "else", ":", "arg_13", "=", "None", "arg_14", "=", "[", "functools", ".", "partial", "(", "gaussian", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_11", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_13", ",", "rescale_amp", "=", "True", ")", ",", "functools", ".", "partial", "(", "gaussian", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_12", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_13", ",", "rescale_amp", "=", "True", ")", ",", "functools", ".", "partial", "(", "constant", ",", "arg_3", "=", "arg_3", ")", "]", "arg_15", "=", "[", "arg_0", "<=", "arg_11", ",", "arg_0", ">=", "arg_12", "]", "return", "arg_1", ".", "piecewise", "(", "arg_0", ".", "astype", "(", "arg_1", ".", "complex_", ")", ",", "arg_15", ",", "arg_14", ")"], "function": "def Func(arg_0: arg_1.ndarray, arg_3: arg_4, arg_5: arg_6, arg_7: arg_6,\n                    arg_8: arg_6, arg_9: arg_10[None, arg_6] = None) -> arg_1.ndarray:\n    r\"\"\"Continuous gaussian square pulse.\n\n    Args:\n        times: Times to output pulse for.\n        amp: Pulse amplitude.\n        center: Center of the square pulse component.\n        width: Width of the square pulse component.\n        sigma: Width (standard deviation) of gaussian rise/fall portion of the pulse.\n        zeroed_width: Subtract baseline of gaussian square pulse\n                      to enforce $\\OmegaSquare(center \\pm zeroed_width/2)=0$.\n    \"\"\"\n    arg_11 = arg_5-arg_7/2\n    arg_12 = arg_5+arg_7/2\n    if arg_9:\n        arg_9 = min(arg_7, arg_9)\n        arg_13 = arg_9-arg_7\n    else:\n        arg_13 = None\n\n    arg_14 = [functools.partial(gaussian, arg_3=arg_3, arg_5=arg_11, arg_8=arg_8,\n                                  arg_9=arg_13, rescale_amp=True),\n                functools.partial(gaussian, arg_3=arg_3, arg_5=arg_12, arg_8=arg_8,\n                                  arg_9=arg_13, rescale_amp=True),\n                functools.partial(constant, arg_3=arg_3)]\n    arg_15 = [arg_0 <= arg_11, arg_0 >= arg_12]\n    return arg_1.piecewise(arg_0.astype(arg_1.complex_), arg_15, arg_14)", "path": "qiskit/pulse/pulse_lib/continuous.py", "identifier": "gaussian_square", "docstring": "r\"\"\"Continuous gaussian square pulse.\n\n    Args:\n        times: Times to output pulse for.\n        amp: Pulse amplitude.\n        center: Center of the square pulse component.\n        width: Width of the square pulse component.\n        sigma: Width (standard deviation) of gaussian rise/fall portion of the pulse.\n        zeroed_width: Subtract baseline of gaussian square pulse\n                      to enforce $\\OmegaSquare(center \\pm zeroed_width/2)=0$.", "docstring_tokens": ["r", "Continuous", "gaussian", "square", "pulse", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254225}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L860-L873", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Consumes protocol message field identifier.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "token", "if", "not", "arg_0", ".", "_IDENTIFIER", ".", "match", "(", "arg_1", ")", ":", "raise", "arg_0", ".", "_ParseError", "(", "'Expected identifier.'", ")", "arg_0", ".", "NextToken", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Consumes protocol message field identifier.\n\n    Returns:\n      Identifier string.\n\n    Raises:\n      ParseError: If an identifier couldn't be consumed.\n    \"\"\"\n    arg_1 = arg_0.token\n    if not arg_0._IDENTIFIER.match(arg_1):\n      raise arg_0._ParseError('Expected identifier.')\n    arg_0.NextToken()\n    return arg_1", "path": "typy/google/protobuf/text_format.py", "identifier": "_Tokenizer.ConsumeIdentifier", "docstring": "Consumes protocol message field identifier.\n\n    Returns:\n      Identifier string.\n\n    Raises:\n      ParseError: If an identifier couldn't be consumed.", "docstring_tokens": ["Consumes", "protocol", "message", "field", "identifier", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 254226}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L161-L190", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Find and return the S3 data location given a catalog_id.", "language": "python", "parameters": "(self, catalog_id)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "get", "(", "arg_1", ")", "except", ":", "return", "None", "if", "'Landsat8'", "in", "arg_2", "[", "'type'", "]", "and", "'LandsatAcquisition'", "in", "arg_2", "[", "'type'", "]", ":", "arg_3", "=", "arg_2", "[", "'properties'", "]", "[", "'bucketName'", "]", "arg_4", "=", "arg_2", "[", "'properties'", "]", "[", "'bucketPrefix'", "]", "return", "'s3://'", "+", "arg_3", "+", "'/'", "+", "arg_4", "if", "'DigitalGlobeAcquisition'", "in", "arg_2", "[", "'type'", "]", ":", "arg_5", "=", "Ordering", "(", ")", "arg_6", "=", "arg_5", ".", "location", "(", "[", "arg_1", "]", ")", "return", "arg_6", "[", "'acquisitions'", "]", "[", "0", "]", "[", "'location'", "]", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Find and return the S3 data location given a catalog_id.\n\n        Args:\n            catalog_id: The catalog ID\n\n        Returns:\n            A string containing the s3 location of the data associated with a catalog ID.  Returns\n            None if the catalog ID is not found, or if there is no data yet associated with it.\n        \"\"\"\n\n        try:\n            arg_2 = arg_0.get(arg_1)\n        except:\n            return None\n\n        # Handle Landsat8\n        if 'Landsat8' in arg_2['type'] and 'LandsatAcquisition' in arg_2['type']:\n            arg_3 = arg_2['properties']['bucketName']\n            arg_4 = arg_2['properties']['bucketPrefix']\n            return 's3://' + arg_3 + '/' + arg_4\n\n        # Handle DG Acquisition\n        if 'DigitalGlobeAcquisition' in arg_2['type']:\n            arg_5 = Ordering()\n            arg_6 = arg_5.location([arg_1])\n            return arg_6['acquisitions'][0]['location']\n\n        return None", "path": "gbdxtools/catalog.py", "identifier": "Catalog.get_data_location", "docstring": "Find and return the S3 data location given a catalog_id.\n\n        Args:\n            catalog_id: The catalog ID\n\n        Returns:\n            A string containing the s3 location of the data associated with a catalog ID.  Returns\n            None if the catalog ID is not found, or if there is no data yet associated with it.", "docstring_tokens": ["Find", "and", "return", "the", "S3", "data", "location", "given", "a", "catalog_id", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 254227}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/providers/baseprovider.py#L28-L48", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a single backend matching the specified filtering.", "language": "python", "parameters": "(self, name=None, **kwargs)", "return_statement": "return backends[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "backends", "(", "arg_1", ",", "**", "arg_2", ")", "if", "len", "(", "arg_3", ")", ">", "1", ":", "raise", "QiskitBackendNotFoundError", "(", "'More than one backend matches the criteria'", ")", "elif", "not", "arg_3", ":", "raise", "QiskitBackendNotFoundError", "(", "'No backend matches the criteria'", ")", "return", "arg_3", "[", "0", "]"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"Return a single backend matching the specified filtering.\n\n        Args:\n            name (str): name of the backend.\n            **kwargs (dict): dict used for filtering.\n\n        Returns:\n            BaseBackend: a backend matching the filtering.\n\n        Raises:\n            QiskitBackendNotFoundError: if no backend could be found or\n                more than one backend matches.\n        \"\"\"\n        arg_3 = arg_0.backends(arg_1, **arg_2)\n        if len(arg_3) > 1:\n            raise QiskitBackendNotFoundError('More than one backend matches the criteria')\n        elif not arg_3:\n            raise QiskitBackendNotFoundError('No backend matches the criteria')\n\n        return arg_3[0]", "path": "qiskit/providers/baseprovider.py", "identifier": "BaseProvider.get_backend", "docstring": "Return a single backend matching the specified filtering.\n\n        Args:\n            name (str): name of the backend.\n            **kwargs (dict): dict used for filtering.\n\n        Returns:\n            BaseBackend: a backend matching the filtering.\n\n        Raises:\n            QiskitBackendNotFoundError: if no backend could be found or\n                more than one backend matches.", "docstring_tokens": ["Return", "a", "single", "backend", "matching", "the", "specified", "filtering", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254228}
{"url": "https://github.com/codeinthehole/django-async-messages/blob/292cb2fc517521dabc67b90e7ca5b1617f59e214/async_messages/__init__.py#L5-L18", "sha": "292cb2fc517521dabc67b90e7ca5b1617f59e214", "docstring_summary": "Send a message to a particular user.", "language": "python", "parameters": "(user, message, level=constants.INFO)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "INFO", ")", ":", "arg_5", "=", "_user_key", "(", "arg_0", ")", "arg_6", "=", "cache", ".", "get", "(", "arg_5", ")", "or", "[", "]", "arg_6", ".", "append", "(", "(", "arg_1", ",", "arg_2", ")", ")", "cache", ".", "set", "(", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.INFO):\n    \"\"\"\n    Send a message to a particular user.\n\n    :param user: User instance\n    :param message: Message to show\n    :param level: Message level\n    \"\"\"\n    # We store a list of messages in the cache so we can have multiple messages\n    # queued up for a user.\n    arg_5 = _user_key(arg_0)\n    arg_6 = cache.get(arg_5) or []\n    arg_6.append((arg_1, arg_2))\n    cache.set(arg_5, arg_6)", "path": "async_messages/__init__.py", "identifier": "message_user", "docstring": "Send a message to a particular user.\n\n    :param user: User instance\n    :param message: Message to show\n    :param level: Message level", "docstring_tokens": ["Send", "a", "message", "to", "a", "particular", "user", "."], "nwo": "codeinthehole/django-async-messages", "score": 0.19181045137365424, "idx": 254229}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L214-L261", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Replaces many documents in a mongo collection.", "language": "python", "parameters": "(self, mongo_collection, docs,\n                     filter_docs=None, mongo_db=None, upsert=False, collation=None,\n                     **kwargs)", "return_statement": "return collection.bulk_write(requests, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "**", "arg_7", ")", ":", "arg_8", "=", "arg_0", ".", "get_collection", "(", "arg_1", ",", "arg_4", "=", "arg_4", ")", "if", "not", "arg_3", ":", "arg_3", "=", "[", "{", "'_id'", ":", "doc", "[", "'_id'", "]", "}", "for", "doc", "in", "arg_2", "]", "arg_9", "=", "[", "ReplaceOne", "(", "arg_3", "[", "i", "]", ",", "arg_2", "[", "i", "]", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "for", "i", "in", "range", "(", "len", "(", "arg_2", ")", ")", "]", "return", "arg_8", ".", "bulk_write", "(", "arg_9", ",", "**", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                     arg_3=None, arg_4=None, arg_5=False, arg_6=None,\n                     **arg_7):\n        \"\"\"\n        Replaces many documents in a mongo collection.\n\n        Uses bulk_write with multiple ReplaceOne operations\n        https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.bulk_write\n\n        .. note::\n            If no ``filter_docs``are given, it is assumed that all\n            replacement documents contain the ``_id`` field which are then\n            used as filters.\n\n        :param mongo_collection: The name of the collection to update.\n        :type mongo_collection: str\n        :param docs: The new documents.\n        :type docs: list[dict]\n        :param filter_docs: A list of queries that match the documents to replace.\n            Can be omitted; then the _id fields from docs will be used.\n        :type filter_docs: list[dict]\n        :param mongo_db: The name of the database to use.\n            Can be omitted; then the database from the connection string is used.\n        :type mongo_db: str\n        :param upsert: If ``True``, perform an insert if no documents\n            match the filters for the replace operation.\n        :type upsert: bool\n        :param collation: An instance of\n            :class:`~pymongo.collation.Collation`. This option is only\n            supported on MongoDB 3.4 and above.\n        :type collation: pymongo.collation.Collation\n\n        \"\"\"\n        arg_8 = arg_0.get_collection(arg_1, arg_4=arg_4)\n\n        if not arg_3:\n            arg_3 = [{'_id': doc['_id']} for doc in arg_2]\n\n        arg_9 = [\n            ReplaceOne(\n                arg_3[i],\n                arg_2[i],\n                arg_5=arg_5,\n                arg_6=arg_6)\n            for i in range(len(arg_2))\n        ]\n\n        return arg_8.bulk_write(arg_9, **arg_7)", "path": "airflow/contrib/hooks/mongo_hook.py", "identifier": "MongoHook.replace_many", "docstring": "Replaces many documents in a mongo collection.\n\n        Uses bulk_write with multiple ReplaceOne operations\n        https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.bulk_write\n\n        .. note::\n            If no ``filter_docs``are given, it is assumed that all\n            replacement documents contain the ``_id`` field which are then\n            used as filters.\n\n        :param mongo_collection: The name of the collection to update.\n        :type mongo_collection: str\n        :param docs: The new documents.\n        :type docs: list[dict]\n        :param filter_docs: A list of queries that match the documents to replace.\n            Can be omitted; then the _id fields from docs will be used.\n        :type filter_docs: list[dict]\n        :param mongo_db: The name of the database to use.\n            Can be omitted; then the database from the connection string is used.\n        :type mongo_db: str\n        :param upsert: If ``True``, perform an insert if no documents\n            match the filters for the replace operation.\n        :type upsert: bool\n        :param collation: An instance of\n            :class:`~pymongo.collation.Collation`. This option is only\n            supported on MongoDB 3.4 and above.\n        :type collation: pymongo.collation.Collation", "docstring_tokens": ["Replaces", "many", "documents", "in", "a", "mongo", "collection", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254230}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaccard.py#L83-L120", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the Tanimoto distance between two strings.", "language": "python", "parameters": "(self, src, tar, qval=2)", "return_statement": "return float('-inf')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "2", ")", ":", "arg_4", "=", "arg_0", ".", "sim", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_4", "!=", "0", ":", "return", "log", "(", "arg_4", ",", "2", ")", "return", "float", "(", "'-inf'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=2):\n        \"\"\"Return the Tanimoto distance between two strings.\n\n        Tanimoto distance :cite:`Tanimoto:1958` is\n        :math:`-log_{2} sim_{Tanimoto}(X, Y)`.\n\n        Parameters\n        ----------\n        src : str\n            Source string (or QGrams/Counter objects) for comparison\n        tar : str\n            Target string (or QGrams/Counter objects) for comparison\n        qval : int\n            The length of each q-gram; 0 for non-q-gram version\n\n        Returns\n        -------\n        float\n            Tanimoto distance\n\n        Examples\n        --------\n        >>> cmp = Jaccard()\n        >>> cmp.Func('cat', 'hat')\n        -1.5849625007211563\n        >>> cmp.Func('Niall', 'Neil')\n        -2.1699250014423126\n        >>> cmp.Func('aluminum', 'Catalan')\n        -4.0\n        >>> cmp.Func('ATCG', 'TAGC')\n        -inf\n\n        \"\"\"\n        arg_4 = arg_0.sim(arg_1, arg_2, arg_3)\n        if arg_4 != 0:\n            return log(arg_4, 2)\n\n        return float('-inf')", "path": "abydos/distance/_jaccard.py", "identifier": "Jaccard.tanimoto_coeff", "docstring": "Return the Tanimoto distance between two strings.\n\n        Tanimoto distance :cite:`Tanimoto:1958` is\n        :math:`-log_{2} sim_{Tanimoto}(X, Y)`.\n\n        Parameters\n        ----------\n        src : str\n            Source string (or QGrams/Counter objects) for comparison\n        tar : str\n            Target string (or QGrams/Counter objects) for comparison\n        qval : int\n            The length of each q-gram; 0 for non-q-gram version\n\n        Returns\n        -------\n        float\n            Tanimoto distance\n\n        Examples\n        --------\n        >>> cmp = Jaccard()\n        >>> cmp.tanimoto_coeff('cat', 'hat')\n        -1.5849625007211563\n        >>> cmp.tanimoto_coeff('Niall', 'Neil')\n        -2.1699250014423126\n        >>> cmp.tanimoto_coeff('aluminum', 'Catalan')\n        -4.0\n        >>> cmp.tanimoto_coeff('ATCG', 'TAGC')\n        -inf", "docstring_tokens": ["Return", "the", "Tanimoto", "distance", "between", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254231}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L70-L89", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Execute the raw phase for a given backend section, optionally using Arthur", "language": "python", "parameters": "(config, backend_section, arthur)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ":", "arg_3", "=", "TaskRawDataArthurCollection", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "else", ":", "arg_3", "=", "TaskRawDataCollection", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "TaskProjects", "(", "arg_0", ")", ".", "execute", "(", ")", "try", ":", "arg_3", ".", "execute", "(", ")", "logging", ".", "info", "(", "\"Loading raw data finished!\"", ")", "except", "Exception", "as", "e", ":", "logging", ".", "error", "(", "str", "(", "e", ")", ")", "sys", ".", "exit", "(", "-", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Execute the raw phase for a given backend section, optionally using Arthur\n\n    :param config: a Mordred config object\n    :param backend_section: the backend section where the raw phase is executed\n    :param arthur: if true, it enables Arthur to collect the raw data\n    \"\"\"\n\n    if arg_2:\n        arg_3 = TaskRawDataArthurCollection(arg_0, arg_1=arg_1)\n    else:\n        arg_3 = TaskRawDataCollection(arg_0, arg_1=arg_1)\n\n    TaskProjects(arg_0).execute()\n    try:\n        arg_3.execute()\n        logging.info(\"Loading raw data finished!\")\n    except Exception as e:\n        logging.error(str(e))\n        sys.exit(-1)", "path": "utils/micro.py", "identifier": "get_raw", "docstring": "Execute the raw phase for a given backend section, optionally using Arthur\n\n    :param config: a Mordred config object\n    :param backend_section: the backend section where the raw phase is executed\n    :param arthur: if true, it enables Arthur to collect the raw data", "docstring_tokens": ["Execute", "the", "raw", "phase", "for", "a", "given", "backend", "section", "optionally", "using", "Arthur"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 254232}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L293-L333", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "Find consecutive li tags that have content that have the same list id.", "language": "python", "parameters": "(li, meta_data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "yield", "arg_0", "arg_2", "=", "get_namespace", "(", "arg_0", ",", "'w'", ")", "arg_3", "=", "get_numId", "(", "arg_0", ",", "arg_2", ")", "arg_4", "=", "get_ilvl", "(", "arg_0", ",", "arg_2", ")", "arg_5", "=", "arg_0", "while", "True", ":", "arg_5", "=", "arg_5", ".", "getnext", "(", ")", "if", "arg_5", "is", "None", ":", "break", "if", "not", "has_text", "(", "arg_5", ")", ":", "continue", "if", "_is_top_level_upper_roman", "(", "arg_5", ",", "arg_1", ")", ":", "break", "if", "(", "is_li", "(", "arg_5", ",", "arg_1", ")", "and", "(", "arg_4", ">", "get_ilvl", "(", "arg_5", ",", "arg_2", ")", ")", ")", ":", "break", "arg_6", "=", "get_numId", "(", "arg_5", ",", "arg_2", ")", "if", "arg_6", "is", "None", "or", "arg_6", "==", "-", "1", ":", "yield", "arg_5", "continue", "if", "arg_3", "!=", "arg_6", ":", "break", "if", "is_last_li", "(", "arg_5", ",", "arg_1", ",", "arg_3", ")", ":", "yield", "arg_5", "break", "yield", "arg_5"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Find consecutive li tags that have content that have the same list id.\n    \"\"\"\n    yield arg_0\n    arg_2 = get_namespace(arg_0, 'w')\n    arg_3 = get_numId(arg_0, arg_2)\n    arg_4 = get_ilvl(arg_0, arg_2)\n    arg_5 = arg_0\n    while True:\n        arg_5 = arg_5.getnext()\n        if arg_5 is None:\n            break\n        # If the tag has no content ignore it.\n        if not has_text(arg_5):\n            continue\n\n        # Stop the lists if you come across a list item that should be a\n        # heading.\n        if _is_top_level_upper_roman(arg_5, arg_1):\n            break\n\n        if (\n                is_li(arg_5, arg_1) and\n                (arg_4 > get_ilvl(arg_5, arg_2))):\n            break\n\n        arg_6 = get_numId(arg_5, arg_2)\n        if arg_6 is None or arg_6 == -1:\n            # Not a p tag or a list item\n            yield arg_5\n            continue\n        # If the list id of the next tag is different that the previous that\n        # means a new list being made (not nested)\n        if arg_3 != arg_6:\n            # Not a subsequent list.\n            break\n        if is_last_li(arg_5, arg_1, arg_3):\n            yield arg_5\n            break\n        yield arg_5", "path": "docx2html/core.py", "identifier": "get_single_list_nodes_data", "docstring": "Find consecutive li tags that have content that have the same list id.", "docstring_tokens": ["Find", "consecutive", "li", "tags", "that", "have", "content", "that", "have", "the", "same", "list", "id", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 254233}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/model.py#L44-L70", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Orient a graph using the method defined by the arguments.", "language": "python", "parameters": "(self, df_data, graph=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "return", "arg_0", ".", "create_graph_from_data", "(", "arg_1", ",", "**", "arg_3", ")", "elif", "isinstance", "(", "arg_2", ",", "nx", ".", "DiGraph", ")", ":", "return", "arg_0", ".", "orient_directed_graph", "(", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "elif", "isinstance", "(", "arg_2", ",", "nx", ".", "Graph", ")", ":", "return", "arg_0", ".", "orient_undirected_graph", "(", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "else", ":", "print", "(", "'Unknown Graph type'", ")", "raise", "ValueError"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Orient a graph using the method defined by the arguments.\n\n        Depending on the type of `graph`, this function process to execute\n        different functions:\n\n        1. If ``graph`` is a ``networkx.DiGraph``, then ``self.orient_directed_graph`` is executed.\n        2. If ``graph`` is a ``networkx.Graph``, then ``self.orient_undirected_graph`` is executed.\n        3. If ``graph`` is a ``None``, then ``self.create_graph_from_data`` is executed.\n\n        Args:\n            df_data (pandas.DataFrame): DataFrame containing the observational data.\n            graph (networkx.DiGraph or networkx.Graph or None): Prior knowledge on the causal graph.\n\n        .. warning::\n           Requirement : Name of the nodes in the graph must correspond to the\n           name of the variables in df_data\n        \"\"\"\n        if arg_2 is None:\n            return arg_0.create_graph_from_data(arg_1, **arg_3)\n        elif isinstance(arg_2, nx.DiGraph):\n            return arg_0.orient_directed_graph(arg_1, arg_2, **arg_3)\n        elif isinstance(arg_2, nx.Graph):\n            return arg_0.orient_undirected_graph(arg_1, arg_2, **arg_3)\n        else:\n            print('Unknown Graph type')\n            raise ValueError", "path": "cdt/causality/graph/model.py", "identifier": "GraphModel.predict", "docstring": "Orient a graph using the method defined by the arguments.\n\n        Depending on the type of `graph`, this function process to execute\n        different functions:\n\n        1. If ``graph`` is a ``networkx.DiGraph``, then ``self.orient_directed_graph`` is executed.\n        2. If ``graph`` is a ``networkx.Graph``, then ``self.orient_undirected_graph`` is executed.\n        3. If ``graph`` is a ``None``, then ``self.create_graph_from_data`` is executed.\n\n        Args:\n            df_data (pandas.DataFrame): DataFrame containing the observational data.\n            graph (networkx.DiGraph or networkx.Graph or None): Prior knowledge on the causal graph.\n\n        .. warning::\n           Requirement : Name of the nodes in the graph must correspond to the\n           name of the variables in df_data", "docstring_tokens": ["Orient", "a", "graph", "using", "the", "method", "defined", "by", "the", "arguments", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 254234}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L941-L949", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Show available operators for a given saved search condition", "language": "python", "parameters": "(self, condition)", "return_statement": "return permitted_operators_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "savedsearch", ".", "conditions_operators", ".", "get", "(", "arg_1", ")", "arg_3", "=", "set", "(", "[", "arg_0", ".", "savedsearch", ".", "operators", ".", "get", "(", "op", ")", "for", "op", "in", "arg_2", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Show available operators for a given saved search condition \"\"\"\n        # dict keys of allowed operators for the current condition\n        arg_2 = arg_0.savedsearch.conditions_operators.get(arg_1)\n        # transform these into values\n        arg_3 = set(\n            [arg_0.savedsearch.operators.get(op) for op in arg_2]\n        )\n        return arg_3", "path": "pyzotero/zotero.py", "identifier": "Zotero.show_condition_operators", "docstring": "Show available operators for a given saved search condition", "docstring_tokens": ["Show", "available", "operators", "for", "a", "given", "saved", "search", "condition"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 254235}
{"url": "https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/loadmat.py#L107-L122", "sha": "6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1", "docstring_summary": "Unpack a byte string to the given format. If the byte string\n    contains more bytes than required for the given format, the function\n    returns a tuple of values.", "language": "python", "parameters": "(endian, fmt, data)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "'s'", ":", "arg_3", "=", "struct", ".", "Func", "(", "''", ".", "join", "(", "[", "arg_0", ",", "str", "(", "len", "(", "arg_2", ")", ")", ",", "'s'", "]", ")", ",", "arg_2", ")", "[", "0", "]", "else", ":", "arg_4", "=", "len", "(", "arg_2", ")", "//", "struct", ".", "calcsize", "(", "arg_1", ")", "arg_3", "=", "struct", ".", "Func", "(", "''", ".", "join", "(", "[", "arg_0", ",", "str", "(", "arg_4", ")", ",", "arg_1", "]", ")", ",", "arg_2", ")", "if", "len", "(", "arg_3", ")", "==", "1", ":", "arg_3", "=", "arg_3", "[", "0", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Unpack a byte string to the given format. If the byte string\n    contains more bytes than required for the given format, the function\n    returns a tuple of values.\n    \"\"\"\n    if arg_1 == 's':\n        # read data as an array of chars\n        arg_3 = struct.Func(''.join([arg_0, str(len(arg_2)), 's']),\n                            arg_2)[0]\n    else:\n        # read a number of values\n        arg_4 = len(arg_2) // struct.calcsize(arg_1)\n        arg_3 = struct.Func(''.join([arg_0, str(arg_4), arg_1]), arg_2)\n        if len(arg_3) == 1:\n            arg_3 = arg_3[0]\n    return arg_3", "path": "mat4py/loadmat.py", "identifier": "unpack", "docstring": "Unpack a byte string to the given format. If the byte string\n    contains more bytes than required for the given format, the function\n    returns a tuple of values.", "docstring_tokens": ["Unpack", "a", "byte", "string", "to", "the", "given", "format", ".", "If", "the", "byte", "string", "contains", "more", "bytes", "than", "required", "for", "the", "given", "format", "the", "function", "returns", "a", "tuple", "of", "values", "."], "nwo": "nephics/mat4py", "score": 0.3187018950262521, "idx": 254236}
{"url": "https://github.com/kylebebak/questionnaire/blob/ed92642e8a2a0198da198acbcde2707f1d528585/questionnaire/prompters.py#L128-L152", "sha": "ed92642e8a2a0198da198acbcde2707f1d528585", "docstring_summary": "Calls input to allow user to input an arbitrary string. User can go\n    back by entering the `go_back` string. Works in both Python 2 and 3.", "language": "python", "parameters": "(prompt, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "get", "(", "'go_back'", ",", "'<'", ")", "arg_4", "=", "arg_2", ".", "get", "(", "'type'", ",", "str", ")", "arg_5", "=", "arg_2", ".", "get", "(", "'default'", ",", "''", ")", "with", "stdout_redirected", "(", "sys", ".", "stderr", ")", ":", "while", "True", ":", "try", ":", "if", "arg_2", ".", "get", "(", "'secret'", ",", "False", ")", ":", "arg_6", "=", "getpass", ".", "getpass", "(", "arg_0", ")", "elif", "sys", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "arg_6", "=", "Func_input", "(", "arg_0", ")", "else", ":", "arg_6", "=", "input", "(", "arg_0", ")", "if", "not", "arg_6", ":", "arg_6", "=", "arg_5", "if", "arg_6", "==", "arg_3", ":", "raise", "QuestionnaireGoBack", "return", "arg_4", "(", "arg_6", ")", "except", "ValueError", ":", "eprint", "(", "'\\n`{}` is not a valid `{}`\\n'", ".", "format", "(", "arg_6", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"Calls input to allow user to input an arbitrary string. User can go\n    back by entering the `go_back` string. Works in both Python 2 and 3.\n    \"\"\"\n    arg_3 = arg_2.get('go_back', '<')\n    arg_4 = arg_2.get('type', str)\n    arg_5 = arg_2.get('default', '')\n    with stdout_redirected(sys.stderr):\n        while True:\n            try:\n                if arg_2.get('secret', False):\n                    arg_6 = getpass.getpass(arg_0)\n                elif sys.version_info < (3, 0):\n                    arg_6 = Func_input(arg_0)\n                else:\n                    arg_6 = input(arg_0)\n\n                if not arg_6:\n                    arg_6 = arg_5\n\n                if arg_6 == arg_3:\n                    raise QuestionnaireGoBack\n                return arg_4(arg_6)\n            except ValueError:\n                eprint('\\n`{}` is not a valid `{}`\\n'.format(arg_6, arg_4))", "path": "questionnaire/prompters.py", "identifier": "raw", "docstring": "Calls input to allow user to input an arbitrary string. User can go\n    back by entering the `go_back` string. Works in both Python 2 and 3.", "docstring_tokens": ["Calls", "input", "to", "allow", "user", "to", "input", "an", "arbitrary", "string", ".", "User", "can", "go", "back", "by", "entering", "the", "go_back", "string", ".", "Works", "in", "both", "Python", "2", "and", "3", "."], "nwo": "kylebebak/questionnaire", "score": 0.4695341856938158, "idx": 254237}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L253-L281", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Attach marker bodies to the corresponding skeleton bodies.", "language": "python", "parameters": "(self, frame_no)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "not", "arg_0", ".", "joints", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "channels", ".", "items", "(", ")", ":", "arg_4", "=", "arg_0", ".", "targets", ".", "get", "(", "arg_2", ")", "if", "arg_4", "is", "None", ":", "continue", "if", "arg_0", ".", "visibility", "[", "arg_1", ",", "arg_3", "]", "<", "0", ":", "continue", "if", "np", ".", "linalg", ".", "norm", "(", "arg_0", ".", "velocities", "[", "arg_1", ",", "arg_3", "]", ")", ">", "10", ":", "continue", "arg_5", "=", "ode", ".", "BallJoint", "(", "arg_0", ".", "world", ".", "ode_world", ",", "arg_0", ".", "jointgroup", ")", "arg_5", ".", "Func", "(", "arg_0", ".", "bodies", "[", "arg_2", "]", ".", "ode_body", ",", "arg_4", ".", "ode_body", ")", "arg_5", ".", "setAnchor1Rel", "(", "[", "0", ",", "0", ",", "0", "]", ")", "arg_5", ".", "setAnchor2Rel", "(", "arg_0", ".", "offsets", "[", "arg_2", "]", ")", "arg_5", ".", "setParam", "(", "ode", ".", "ParamCFM", ",", "arg_0", ".", "cfms", "[", "arg_1", ",", "arg_3", "]", ")", "arg_5", ".", "setParam", "(", "ode", ".", "ParamERP", ",", "arg_0", ".", "erp", ")", "arg_5", ".", "name", "=", "arg_2", "arg_0", ".", "joints", "[", "arg_2", "]", "=", "arg_5", "arg_0", ".", "_frame_no", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        '''Attach marker bodies to the corresponding skeleton bodies.\n\n        Attachments are only made for markers that are not in a dropout state in\n        the given frame.\n\n        Parameters\n        ----------\n        frame_no : int\n            The frame of data we will use for Funcing marker bodies.\n        '''\n        assert not arg_0.joints\n        for arg_2, arg_3 in arg_0.channels.items():\n            arg_4 = arg_0.targets.get(arg_2)\n            if arg_4 is None:\n                continue\n            if arg_0.visibility[arg_1, arg_3] < 0:\n                continue\n            if np.linalg.norm(arg_0.velocities[arg_1, arg_3]) > 10:\n                continue\n            arg_5 = ode.BallJoint(arg_0.world.ode_world, arg_0.jointgroup)\n            arg_5.Func(arg_0.bodies[arg_2].ode_body, arg_4.ode_body)\n            arg_5.setAnchor1Rel([0, 0, 0])\n            arg_5.setAnchor2Rel(arg_0.offsets[arg_2])\n            arg_5.setParam(ode.ParamCFM, arg_0.cfms[arg_1, arg_3])\n            arg_5.setParam(ode.ParamERP, arg_0.erp)\n            arg_5.name = arg_2\n            arg_0.joints[arg_2] = arg_5\n        arg_0._frame_no = arg_1", "path": "pagoda/cooper.py", "identifier": "Markers.attach", "docstring": "Attach marker bodies to the corresponding skeleton bodies.\n\n        Attachments are only made for markers that are not in a dropout state in\n        the given frame.\n\n        Parameters\n        ----------\n        frame_no : int\n            The frame of data we will use for attaching marker bodies.", "docstring_tokens": ["Attach", "marker", "bodies", "to", "the", "corresponding", "skeleton", "bodies", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 254238}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/onset.py#L336-L403", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Backtrack detected onset events to the nearest preceding local\n    minimum of an energy function.", "language": "python", "parameters": "(events, energy)", "return_statement": "return minima[util.match_events(events, minima, right=False)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "flatnonzero", "(", "(", "arg_1", "[", "1", ":", "-", "1", "]", "<=", "arg_1", "[", ":", "-", "2", "]", ")", "&", "(", "arg_1", "[", "1", ":", "-", "1", "]", "<", "arg_1", "[", "2", ":", "]", ")", ")", "arg_2", "=", "util", ".", "fix_frames", "(", "1", "+", "arg_2", ",", "x_min", "=", "0", ")", "return", "arg_2", "[", "util", ".", "match_events", "(", "arg_0", ",", "arg_2", ",", "right", "=", "False", ")", "]"], "function": "def Func(arg_0, arg_1):\n    '''Backtrack detected onset events to the nearest preceding local\n    minimum of an energy function.\n\n    This function can be used to roll back the timing of detected onsets\n    from a detected peak amplitude to the preceding minimum.\n\n    This is most useful when using onsets to determine slice points for\n    segmentation, as described by [1]_.\n\n    .. [1] Jehan, Tristan.\n           \"Creating music by listening\"\n           Doctoral dissertation\n           Massachusetts Institute of Technology, 2005.\n\n    Parameters\n    ----------\n    events : np.ndarray, dtype=int\n        List of onset event frame indices, as computed by `onset_detect`\n\n    energy : np.ndarray, shape=(m,)\n        An energy function\n\n    Returns\n    -------\n    events_backtracked : np.ndarray, shape=events.shape\n        The input events matched to nearest preceding minima of `energy`.\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      offset=30, duration=2.0)\n    >>> oenv = librosa.onset.onset_strength(y=y, sr=sr)\n    >>> # Detect events without backtracking\n    >>> onset_raw = librosa.onset.onset_detect(onset_envelope=oenv,\n    ...                                        backtrack=False)\n    >>> # Backtrack the events using the onset envelope\n    >>> onset_bt = librosa.onset.Func(onset_raw, oenv)\n    >>> # Backtrack the events using the RMS values\n    >>> rms = librosa.feature.rms(S=np.abs(librosa.stft(y=y)))\n    >>> onset_bt_rms = librosa.onset.Func(onset_raw, rms[0])\n\n    >>> # Plot the results\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> plt.subplot(2,1,1)\n    >>> plt.plot(oenv, label='Onset strength')\n    >>> plt.vlines(onset_raw, 0, oenv.max(), label='Raw onsets')\n    >>> plt.vlines(onset_bt, 0, oenv.max(), label='Backtracked', color='r')\n    >>> plt.legend(frameon=True, framealpha=0.75)\n    >>> plt.subplot(2,1,2)\n    >>> plt.plot(rms[0], label='RMS')\n    >>> plt.vlines(onset_bt_rms, 0, rms.max(), label='Backtracked (RMS)', color='r')\n    >>> plt.legend(frameon=True, framealpha=0.75)\n    '''\n\n    # Find points where energy is non-increasing\n    # all points:  energy[i] <= energy[i-1]\n    # tail points: energy[i] < energy[i+1]\n    arg_2 = np.flatnonzero((arg_1[1:-1] <= arg_1[:-2]) &\n                            (arg_1[1:-1] < arg_1[2:]))\n\n    # Pad on a 0, just in case we have onsets with no preceding minimum\n    # Shift by one to account for slicing in minima detection\n    arg_2 = util.fix_frames(1 + arg_2, x_min=0)\n\n    # Only match going left from the detected events\n    return arg_2[util.match_events(arg_0, arg_2, right=False)]", "path": "librosa/onset.py", "identifier": "onset_backtrack", "docstring": "Backtrack detected onset events to the nearest preceding local\n    minimum of an energy function.\n\n    This function can be used to roll back the timing of detected onsets\n    from a detected peak amplitude to the preceding minimum.\n\n    This is most useful when using onsets to determine slice points for\n    segmentation, as described by [1]_.\n\n    .. [1] Jehan, Tristan.\n           \"Creating music by listening\"\n           Doctoral dissertation\n           Massachusetts Institute of Technology, 2005.\n\n    Parameters\n    ----------\n    events : np.ndarray, dtype=int\n        List of onset event frame indices, as computed by `onset_detect`\n\n    energy : np.ndarray, shape=(m,)\n        An energy function\n\n    Returns\n    -------\n    events_backtracked : np.ndarray, shape=events.shape\n        The input events matched to nearest preceding minima of `energy`.\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      offset=30, duration=2.0)\n    >>> oenv = librosa.onset.onset_strength(y=y, sr=sr)\n    >>> # Detect events without backtracking\n    >>> onset_raw = librosa.onset.onset_detect(onset_envelope=oenv,\n    ...                                        backtrack=False)\n    >>> # Backtrack the events using the onset envelope\n    >>> onset_bt = librosa.onset.onset_backtrack(onset_raw, oenv)\n    >>> # Backtrack the events using the RMS values\n    >>> rms = librosa.feature.rms(S=np.abs(librosa.stft(y=y)))\n    >>> onset_bt_rms = librosa.onset.onset_backtrack(onset_raw, rms[0])\n\n    >>> # Plot the results\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> plt.subplot(2,1,1)\n    >>> plt.plot(oenv, label='Onset strength')\n    >>> plt.vlines(onset_raw, 0, oenv.max(), label='Raw onsets')\n    >>> plt.vlines(onset_bt, 0, oenv.max(), label='Backtracked', color='r')\n    >>> plt.legend(frameon=True, framealpha=0.75)\n    >>> plt.subplot(2,1,2)\n    >>> plt.plot(rms[0], label='RMS')\n    >>> plt.vlines(onset_bt_rms, 0, rms.max(), label='Backtracked (RMS)', color='r')\n    >>> plt.legend(frameon=True, framealpha=0.75)", "docstring_tokens": ["Backtrack", "detected", "onset", "events", "to", "the", "nearest", "preceding", "local", "minimum", "of", "an", "energy", "function", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 254239}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/sysinfo.py#L32-L67", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get short form of commit hash given directory `pkg_path`", "language": "python", "parameters": "(pkg_path)", "return_statement": "return '(none found)', '<not found>'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "_sysinfo", ".", "commit", ":", "return", "\"installation\"", ",", "_sysinfo", ".", "commit", "arg_1", "=", "subprocess", ".", "Popen", "(", "'git rev-parse --short HEAD'", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "cwd", "=", "arg_0", ",", "shell", "=", "True", ")", "arg_2", ",", "arg_3", "=", "arg_1", ".", "communicate", "(", ")", "if", "arg_2", ":", "return", "'repository'", ",", "arg_2", ".", "strip", "(", ")", "return", "'(none found)'", ",", "'<not found>'"], "function": "def Func(arg_0):\n    \"\"\"Get short form of commit hash given directory `pkg_path`\n\n    We get the commit hash from (in order of preference):\n\n    * IPython.utils._sysinfo.commit\n    * git output, if we are in a git repository\n\n    If these fail, we return a not-found placeholder tuple\n\n    Parameters\n    ----------\n    pkg_path : str\n       directory containing package\n       only used for getting commit from active repo\n\n    Returns\n    -------\n    hash_from : str\n       Where we got the hash from - description\n    hash_str : str\n       short form of hash\n    \"\"\"\n    # Try and get commit from written commit text file\n    if _sysinfo.commit:\n        return \"installation\", _sysinfo.commit\n\n    # maybe we are in a repository\n    arg_1 = subprocess.Popen('git rev-parse --short HEAD',\n                            stdout=subprocess.PIPE,\n                            stderr=subprocess.PIPE,\n                            cwd=arg_0, shell=True)\n    arg_2, arg_3 = arg_1.communicate()\n    if arg_2:\n        return 'repository', arg_2.strip()\n    return '(none found)', '<not found>'", "path": "environment/lib/python2.7/site-packages/IPython/utils/sysinfo.py", "identifier": "pkg_commit_hash", "docstring": "Get short form of commit hash given directory `pkg_path`\n\n    We get the commit hash from (in order of preference):\n\n    * IPython.utils._sysinfo.commit\n    * git output, if we are in a git repository\n\n    If these fail, we return a not-found placeholder tuple\n\n    Parameters\n    ----------\n    pkg_path : str\n       directory containing package\n       only used for getting commit from active repo\n\n    Returns\n    -------\n    hash_from : str\n       Where we got the hash from - description\n    hash_str : str\n       short form of hash", "docstring_tokens": ["Get", "short", "form", "of", "commit", "hash", "given", "directory", "pkg_path"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254240}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L408-L439", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Returns rolling - window gradient of a.", "language": "python", "parameters": "(a, win=11)", "return_statement": "return np.array(list(a))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "11", ")", ":", "if", "arg_1", "%", "2", "==", "0", ":", "arg_1", "+=", "1", "arg_2", "=", "rolling_window", "(", "arg_0", ",", "arg_1", ",", "'ends'", ")", "arg_0", "=", "map", "(", "lambda", "x", ":", "np", ".", "polyfit", "(", "np", ".", "arange", "(", "arg_1", ")", ",", "x", ",", "1", ")", "[", "0", "]", ",", "arg_2", ")", "return", "np", ".", "array", "(", "list", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=11):\n    \"\"\"\n    Returns rolling - window gradient of a.\n\n    Function to efficiently calculate the rolling gradient of a numpy\n    array using 'stride_tricks' to split up a 1D array into an ndarray of\n    sub - sections of the original array, of dimensions [len(a) - win, win].\n\n    Parameters\n    ----------\n    a : array_like\n        The 1D array to calculate the rolling gradient of.\n    win : int\n        The width of the rolling window.\n\n    Returns\n    -------\n    array_like\n        Gradient of a, assuming as constant integer x - scale.\n    \"\"\"\n    # check to see if 'window' is odd (even does not work)\n    if arg_1 % 2 == 0:\n        arg_1 += 1  # subtract 1 from window if it is even.\n    # trick for efficient 'rolling' computation in numpy\n    # shape = a.shape[:-1] + (a.shape[-1] - win + 1, win)\n    # strides = a.strides + (a.strides[-1], )\n    # wins = np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)\n    arg_2 = rolling_window(arg_0, arg_1, 'ends')\n    # apply rolling gradient to data\n    arg_0 = map(lambda x: np.polyfit(np.arange(arg_1), x, 1)[0], arg_2)\n\n    return np.array(list(arg_0))", "path": "latools/helpers/helpers.py", "identifier": "fastgrad", "docstring": "Returns rolling - window gradient of a.\n\n    Function to efficiently calculate the rolling gradient of a numpy\n    array using 'stride_tricks' to split up a 1D array into an ndarray of\n    sub - sections of the original array, of dimensions [len(a) - win, win].\n\n    Parameters\n    ----------\n    a : array_like\n        The 1D array to calculate the rolling gradient of.\n    win : int\n        The width of the rolling window.\n\n    Returns\n    -------\n    array_like\n        Gradient of a, assuming as constant integer x - scale.", "docstring_tokens": ["Returns", "rolling", "-", "window", "gradient", "of", "a", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 254241}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L144-L162", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return an a license identifier from an ExtractedLicense or None.", "language": "python", "parameters": "(self, extr_lic)", "return_statement": "return identifier", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'licenseId'", "]", ",", "None", ")", ")", ")", "if", "not", "arg_2", ":", "arg_0", ".", "error", "=", "True", "arg_4", "=", "'Extracted license must have licenseId property.'", "arg_0", ".", "logger", ".", "log", "(", "arg_4", ")", "return", "if", "len", "(", "arg_2", ")", ">", "1", ":", "arg_0", ".", "more_than_one_error", "(", "'extracted license identifier_tripples'", ")", "return", "arg_5", "=", "arg_2", "[", "0", "]", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_5", "return", "arg_8"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return an a license identifier from an ExtractedLicense or None.\n        \"\"\"\n        arg_2 = list(arg_0.graph.triples((arg_1, arg_0.spdx_namespace['licenseId'], None)))\n\n        if not arg_2:\n            arg_0.error = True\n            arg_4 = 'Extracted license must have licenseId property.'\n            arg_0.logger.log(arg_4)\n            return\n\n        if len(arg_2) > 1:\n            arg_0.more_than_one_error('extracted license identifier_tripples')\n            return\n\n        arg_5 = arg_2[0]\n        arg_6, arg_7, arg_8 = arg_5\n        return arg_8", "path": "spdx/parsers/rdf.py", "identifier": "LicenseParser.get_extr_license_ident", "docstring": "Return an a license identifier from an ExtractedLicense or None.", "docstring_tokens": ["Return", "an", "a", "license", "identifier", "from", "an", "ExtractedLicense", "or", "None", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254242}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L306-L321", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Wrap a reader function in a decorator to supply line and column\n    information along with relevant forms.", "language": "python", "parameters": "(f: W)", "return_statement": "return cast(W, with_lineno_and_col)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "arg_1", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "with_lineno_and_col", "(", "arg_2", ")", ":", "arg_3", "=", "lmap", ".", "map", "(", "{", "READER_LINE_KW", ":", "arg_2", ".", "reader", ".", "line", ",", "READER_COL_KW", ":", "arg_2", ".", "reader", ".", "col", "}", ")", "arg_4", "=", "arg_0", "(", "arg_2", ")", "try", ":", "return", "arg_4", ".", "with_meta", "(", "arg_3", ")", "except", "AttributeError", ":", "return", "arg_4", "return", "cast", "(", "arg_1", ",", "with_lineno_and_col", ")"], "function": "def Func(arg_0: arg_1) -> arg_1:\n    \"\"\"Wrap a reader function in a decorator to supply line and column\n    information along with relevant forms.\"\"\"\n\n    @functools.wraps(arg_0)\n    def with_lineno_and_col(arg_2):\n        arg_3 = lmap.map(\n            {READER_LINE_KW: arg_2.reader.line, READER_COL_KW: arg_2.reader.col}\n        )\n        arg_4 = arg_0(arg_2)\n        try:\n            return arg_4.with_meta(arg_3)  # type: ignore\n        except AttributeError:\n            return arg_4\n\n    return cast(arg_1, with_lineno_and_col)", "path": "src/basilisp/lang/reader.py", "identifier": "_with_loc", "docstring": "Wrap a reader function in a decorator to supply line and column\n    information along with relevant forms.", "docstring_tokens": ["Wrap", "a", "reader", "function", "in", "a", "decorator", "to", "supply", "line", "and", "column", "information", "along", "with", "relevant", "forms", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 254243}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L590-L596", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Receive NAK in REQUESTING state.", "language": "python", "parameters": "(self, pkt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"C3.1. Received NAK?, in REQUESTING state.\"", ")", "if", "arg_0", ".", "process_received_nak", "(", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"C3.1: T. Received NAK, in REQUESTING state, \"", "\"raise INIT.\"", ")", "raise", "arg_0", ".", "INIT", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Receive NAK in REQUESTING state.\"\"\"\n        logger.debug(\"C3.1. Received NAK?, in REQUESTING state.\")\n        if arg_0.process_received_nak(arg_1):\n            logger.debug(\"C3.1: T. Received NAK, in REQUESTING state, \"\n                         \"raise INIT.\")\n            raise arg_0.INIT()", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.receive_nak_requesting", "docstring": "Receive NAK in REQUESTING state.", "docstring_tokens": ["Receive", "NAK", "in", "REQUESTING", "state", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 254244}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/util/mask_util.py#L368-L417", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Bin up an array to coarser resolution, by binning up groups of pixels and using their sum value to determine \\\n     the value of the new pixel.", "language": "python", "parameters": "(mask_2d, bin_up_factor)", "return_statement": "return binned_array_2d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "array_util", ".", "pad_2d_array_for_binning_up_with_bin_up_factor", "(", "array_2d", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "pad_value", "=", "True", ")", "arg_3", "=", "np", ".", "zeros", "(", "shape", "=", "(", "arg_2", ".", "shape", "[", "0", "]", "//", "arg_1", ",", "arg_2", ".", "shape", "[", "1", "]", "//", "arg_1", ")", ")", "for", "arg_4", "in", "range", "(", "arg_3", ".", "shape", "[", "0", "]", ")", ":", "for", "arg_5", "in", "range", "(", "arg_3", ".", "shape", "[", "1", "]", ")", ":", "arg_6", "=", "True", "for", "arg_7", "in", "range", "(", "arg_1", ")", ":", "for", "arg_8", "in", "range", "(", "arg_1", ")", ":", "arg_9", "=", "arg_4", "*", "arg_1", "+", "arg_7", "arg_10", "=", "arg_5", "*", "arg_1", "+", "arg_8", "if", "arg_2", "[", "arg_9", ",", "arg_10", "]", "==", "False", ":", "arg_6", "=", "False", "arg_3", "[", "arg_4", ",", "arg_5", "]", "=", "arg_6", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Bin up an array to coarser resolution, by binning up groups of pixels and using their sum value to determine \\\n     the value of the new pixel.\n\n    If an array of shape (8,8) is input and the bin up size is 2, this would return a new array of size (4,4) where \\\n    every pixel was the sum of each collection of 2x2 pixels on the (8,8) array.\n\n    If binning up the array leads to an edge being cut (e.g. a (9,9) array binned up by 2), an array is first \\\n    extracted around the centre of that array.\n\n\n    Parameters\n    ----------\n    mask_2d : ndarray\n        The 2D array that is resized.\n    new_shape : (int, int)\n        The (y,x) new pixel dimension of the trimmed array.\n    origin : (int, int)\n        The oigin of the resized array, e.g. the central pixel around which the array is extracted.\n\n    Returns\n    -------\n    ndarray\n        The resized 2D array from the input 2D array.\n\n    Examples\n    --------\n    array_2d = np.ones((5,5))\n    resize_array = resize_array_2d(array_2d=array_2d, new_shape=(2,2), origin=(2, 2))\n    \"\"\"\n\n    arg_2 = array_util.pad_2d_array_for_binning_up_with_bin_up_factor(\n        array_2d=arg_0, arg_1=arg_1, pad_value=True)\n\n    arg_3 = np.zeros(shape=(arg_2.shape[0] // arg_1,\n                                      arg_2.shape[1] // arg_1))\n\n    for arg_4 in range(arg_3.shape[0]):\n        for arg_5 in range(arg_3.shape[1]):\n            arg_6 = True\n            for arg_7 in range(arg_1):\n                for arg_8 in range(arg_1):\n                    arg_9 = arg_4*arg_1 + arg_7\n                    arg_10 = arg_5*arg_1 + arg_8\n                    if arg_2[arg_9, arg_10] == False:\n                        arg_6 = False\n\n            arg_3[arg_4,arg_5] = arg_6\n\n    return arg_3", "path": "autolens/data/array/util/mask_util.py", "identifier": "bin_up_mask_2d", "docstring": "Bin up an array to coarser resolution, by binning up groups of pixels and using their sum value to determine \\\n     the value of the new pixel.\n\n    If an array of shape (8,8) is input and the bin up size is 2, this would return a new array of size (4,4) where \\\n    every pixel was the sum of each collection of 2x2 pixels on the (8,8) array.\n\n    If binning up the array leads to an edge being cut (e.g. a (9,9) array binned up by 2), an array is first \\\n    extracted around the centre of that array.\n\n\n    Parameters\n    ----------\n    mask_2d : ndarray\n        The 2D array that is resized.\n    new_shape : (int, int)\n        The (y,x) new pixel dimension of the trimmed array.\n    origin : (int, int)\n        The oigin of the resized array, e.g. the central pixel around which the array is extracted.\n\n    Returns\n    -------\n    ndarray\n        The resized 2D array from the input 2D array.\n\n    Examples\n    --------\n    array_2d = np.ones((5,5))\n    resize_array = resize_array_2d(array_2d=array_2d, new_shape=(2,2), origin=(2, 2))", "docstring_tokens": ["Bin", "up", "an", "array", "to", "coarser", "resolution", "by", "binning", "up", "groups", "of", "pixels", "and", "using", "their", "sum", "value", "to", "determine", "\\", "the", "value", "of", "the", "new", "pixel", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 254245}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L323-L338", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return the most common item in the list.", "language": "python", "parameters": "(list_: List[T])", "return_statement": "return max(set(list_), key=list_.count)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ")", "->", "arg_2", ":", "return", "max", "(", "set", "(", "arg_0", ")", ",", "key", "=", "arg_0", ".", "count", ")"], "function": "def Func(arg_0: arg_1[arg_2]) -> arg_2:\n    \"\"\"Return the most common item in the list.\n\n    Return the first one if there are more than one most common items.\n\n    Example:\n\n    >>> Func([1,1,2,2,])\n    1\n    >>> Func([1,2,2])\n    2\n    >>> Func([])\n    ...\n    ValueError: max() arg is an empty sequence\n    \"\"\"\n    return max(set(arg_0), key=arg_0.count)", "path": "wikitextparser/_template.py", "identifier": "mode", "docstring": "Return the most common item in the list.\n\n    Return the first one if there are more than one most common items.\n\n    Example:\n\n    >>> mode([1,1,2,2,])\n    1\n    >>> mode([1,2,2])\n    2\n    >>> mode([])\n    ...\n    ValueError: max() arg is an empty sequence", "docstring_tokens": ["Return", "the", "most", "common", "item", "in", "the", "list", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 254246}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L166-L184", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Initiate TLS connection.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"Preparing TLS connection\"", ")", "if", "arg_0", ".", "settings", "[", "\"tls_verify_peer\"", "]", ":", "arg_1", "=", "ssl", ".", "CERT_REQUIRED", "else", ":", "arg_1", "=", "ssl", ".", "CERT_NONE", "arg_0", ".", "stream", ".", "transport", ".", "starttls", "(", "keyfile", "=", "arg_0", ".", "settings", "[", "\"tls_key_file\"", "]", ",", "certfile", "=", "arg_0", ".", "settings", "[", "\"tls_cert_file\"", "]", ",", "server_side", "=", "not", "arg_0", ".", "stream", ".", "initiator", ",", "arg_1", "=", "arg_1", ",", "ssl_version", "=", "ssl", ".", "PROTOCOL_TLSv1", ",", "ca_certs", "=", "arg_0", ".", "settings", "[", "\"tls_cacert_file\"", "]", ",", "do_handshake_on_connect", "=", "False", ",", ")"], "function": "def Func(arg_0):\n        \"\"\"Initiate TLS connection.\n\n        [initiating entity only]\n        \"\"\"\n        logger.debug(\"Preparing TLS connection\")\n        if arg_0.settings[\"tls_verify_peer\"]:\n            arg_1 = ssl.CERT_REQUIRED\n        else:\n            arg_1 = ssl.CERT_NONE\n        arg_0.stream.transport.starttls(\n                    keyfile = arg_0.settings[\"tls_key_file\"],\n                    certfile = arg_0.settings[\"tls_cert_file\"],\n                    server_side = not arg_0.stream.initiator,\n                    arg_1 = arg_1,\n                    ssl_version = ssl.PROTOCOL_TLSv1,\n                    ca_certs = arg_0.settings[\"tls_cacert_file\"],\n                    do_handshake_on_connect = False,\n                    )", "path": "pyxmpp2/streamtls.py", "identifier": "StreamTLSHandler._make_tls_connection", "docstring": "Initiate TLS connection.\n\n        [initiating entity only]", "docstring_tokens": ["Initiate", "TLS", "connection", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254247}
{"url": "https://github.com/MeirKriheli/python-bidi/blob/a0e265bb465c1b7ad628487991e33b5ebe364641/bidi/algorithm.py#L261-L307", "sha": "a0e265bb465c1b7ad628487991e33b5ebe364641", "docstring_summary": "Split the storage to run of char types at the same level.", "language": "python", "parameters": "(storage)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "[", "'runs'", "]", ".", "clear", "(", ")", "arg_1", "=", "arg_0", "[", "'chars'", "]", "if", "not", "arg_1", ":", "return", "def", "calc_level_run", "(", "arg_2", ",", "arg_3", ")", ":", "return", "[", "'L'", ",", "'R'", "]", "[", "max", "(", "arg_2", ",", "arg_3", ")", "%", "2", "]", "arg_4", "=", "arg_1", "[", "0", "]", "arg_5", "=", "calc_level_run", "(", "arg_0", "[", "'base_level'", "]", ",", "arg_4", "[", "'level'", "]", ")", "arg_6", "=", "None", "arg_7", "=", "arg_13", "=", "0", "arg_8", ",", "arg_9", "=", "arg_4", "[", "'level'", "]", ",", "arg_4", "[", "'type'", "]", "for", "arg_10", "in", "arg_1", ":", "arg_11", ",", "arg_12", "=", "arg_10", "[", "'level'", "]", ",", "arg_10", "[", "'type'", "]", "if", "arg_11", "==", "arg_8", ":", "arg_13", "+=", "1", "else", ":", "arg_6", "=", "calc_level_run", "(", "arg_8", ",", "arg_11", ")", "arg_0", "[", "'runs'", "]", ".", "append", "(", "{", "'sor'", ":", "arg_5", ",", "'eor'", ":", "arg_6", ",", "'start'", ":", "arg_7", ",", "'type'", ":", "arg_9", ",", "'length'", ":", "arg_13", "}", ")", "arg_5", "=", "arg_6", "arg_7", "+=", "arg_13", "arg_13", "=", "1", "arg_8", ",", "arg_9", "=", "arg_11", ",", "arg_12", "arg_6", "=", "calc_level_run", "(", "arg_11", ",", "arg_0", "[", "'base_level'", "]", ")", "arg_0", "[", "'runs'", "]", ".", "append", "(", "{", "'sor'", ":", "arg_5", ",", "'eor'", ":", "arg_6", ",", "'start'", ":", "arg_7", ",", "'type'", ":", "arg_12", ",", "'length'", ":", "arg_13", "}", ")"], "function": "def Func(arg_0):\n    \"\"\"Split the storage to run of char types at the same level.\n\n    Applies X10. See http://unicode.org/reports/tr9/#X10\n    \"\"\"\n    # run level depends on the higher of the two levels on either side of\n    # the boundary If the higher level is odd, the type is R; otherwise,\n    # it is L\n\n    arg_0['runs'].clear()\n    arg_1 = arg_0['chars']\n\n    # empty string ?\n    if not arg_1:\n        return\n\n    def calc_level_run(arg_2, arg_3):\n        return ['L', 'R'][max(arg_2, arg_3) % 2]\n\n    arg_4 = arg_1[0]\n\n    arg_5 = calc_level_run(arg_0['base_level'], arg_4['level'])\n    arg_6 = None\n\n    arg_7 = arg_13 = 0\n\n    arg_8, arg_9 = arg_4['level'], arg_4['type']\n\n    for arg_10 in arg_1:\n        arg_11, arg_12 = arg_10['level'], arg_10['type']\n\n        if arg_11 == arg_8:\n            arg_13 += 1\n        else:\n            arg_6 = calc_level_run(arg_8, arg_11)\n            arg_0['runs'].append({'sor': arg_5, 'eor': arg_6, 'start': arg_7,\n                                    'type': arg_9, 'length': arg_13})\n            arg_5 = arg_6\n            arg_7 += arg_13\n            arg_13 = 1\n\n        arg_8, arg_9 = arg_11, arg_12\n\n    # for the last char/runlevel\n    arg_6 = calc_level_run(arg_11, arg_0['base_level'])\n    arg_0['runs'].append({'sor': arg_5, 'eor': arg_6, 'start': arg_7,\n                            'type': arg_12, 'length': arg_13})", "path": "bidi/algorithm.py", "identifier": "calc_level_runs", "docstring": "Split the storage to run of char types at the same level.\n\n    Applies X10. See http://unicode.org/reports/tr9/#X10", "docstring_tokens": ["Split", "the", "storage", "to", "run", "of", "char", "types", "at", "the", "same", "level", "."], "nwo": "MeirKriheli/python-bidi", "score": 0.28828505124417525, "idx": 254248}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/javaobj.py#L56-L64", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Deserializes Java objects and primitive data serialized by ObjectOutputStream\n  from a string.", "language": "python", "parameters": "(string)", "return_statement": "return marshaller.readObject()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "StringIO", ".", "StringIO", "(", "arg_0", ")", "arg_2", "=", "JavaObjectUnmarshaller", "(", "arg_1", ")", "arg_2", ".", "add_transformer", "(", "DefaultObjectTransformer", "(", ")", ")", "return", "arg_2", ".", "readObject", "(", ")"], "function": "def Func(arg_0):\n  \"\"\"\n  Deserializes Java objects and primitive data serialized by ObjectOutputStream\n  from a string.\n  \"\"\"\n  arg_1 = StringIO.StringIO(arg_0)\n  arg_2 = JavaObjectUnmarshaller(arg_1)\n  arg_2.add_transformer(DefaultObjectTransformer())\n  return arg_2.readObject()", "path": "heron/tools/tracker/src/python/javaobj.py", "identifier": "loads", "docstring": "Deserializes Java objects and primitive data serialized by ObjectOutputStream\n  from a string.", "docstring_tokens": ["Deserializes", "Java", "objects", "and", "primitive", "data", "serialized", "by", "ObjectOutputStream", "from", "a", "string", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254249}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L87-L97", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Return the opposite mapping by searching the imported KB.", "language": "python", "parameters": "(cls, key, kb_name, allow_substring=True)", "return_statement": "return key", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "arg_0", ".", "kbs", ".", "get", "(", "arg_2", ",", "None", ")", "if", "arg_4", ":", "if", "arg_1", "in", "arg_4", ":", "return", "arg_4", "[", "arg_1", "]", "elif", "arg_3", ":", "arg_5", "=", "[", "v", "for", "k", ",", "v", "in", "arg_4", ".", "items", "(", ")", "if", "arg_1", "in", "k", "]", "if", "arg_5", ":", "return", "arg_5", "[", "0", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n        \"\"\"Return the opposite mapping by searching the imported KB.\"\"\"\n        arg_4 = arg_0.kbs.get(arg_2, None)\n        if arg_4:\n            if arg_1 in arg_4:\n                return arg_4[arg_1]\n            elif arg_3:\n                arg_5 = [v for k, v in arg_4.items() if arg_1 in k]\n                if arg_5:\n                    return arg_5[0]\n        return arg_1", "path": "harvestingkit/inspire_cds_package/base.py", "identifier": "MARCXMLConversion.get_config_item", "docstring": "Return the opposite mapping by searching the imported KB.", "docstring_tokens": ["Return", "the", "opposite", "mapping", "by", "searching", "the", "imported", "KB", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 254250}
{"url": "https://github.com/shopkick/flawless/blob/c54b63ca1991c153e6f75080536f6df445aacc64/flawless/server/service.py#L403-L417", "sha": "c54b63ca1991c153e6f75080536f6df445aacc64", "docstring_summary": "Given an email address, check the email_remapping table to see if the email\n        should be sent to a different address. This function also handles overriding\n        the email domain if ignore_vcs_email_domain is set or the domain was missing", "language": "python", "parameters": "(self, email)", "return_statement": "return email", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", "or", "\"@\"", "not", "in", "arg_1", ":", "return", "None", "if", "arg_1", "in", "arg_0", ".", "email_remapping", ".", "remap", ":", "return", "arg_0", ".", "email_remapping", ".", "remap", "[", "arg_1", "]", "arg_2", ",", "arg_3", "=", "arg_1", ".", "split", "(", "\"@\"", ",", "2", ")", "if", "arg_2", "in", "arg_0", ".", "email_remapping", ".", "remap", ":", "return", "arg_0", ".", "email_remapping", ".", "remap", "[", "arg_2", "]", "if", "\".\"", "not", "in", "arg_3", "or", "config", ".", "ignore_vcs_email_domain", ":", "return", "\"%s@%s\"", "%", "(", "arg_2", ",", "config", ".", "email_domain_name", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        '''Given an email address, check the email_remapping table to see if the email\n        should be sent to a different address. This function also handles overriding\n        the email domain if ignore_vcs_email_domain is set or the domain was missing'''\n        if not arg_1 or \"@\" not in arg_1:\n            return None\n\n        if arg_1 in arg_0.email_remapping.remap:\n            return arg_0.email_remapping.remap[arg_1]\n        arg_2, arg_3 = arg_1.split(\"@\", 2)\n        if arg_2 in arg_0.email_remapping.remap:\n            return arg_0.email_remapping.remap[arg_2]\n        if \".\" not in arg_3 or config.ignore_vcs_email_domain:\n            return \"%s@%s\" % (arg_2, config.email_domain_name)\n        return arg_1", "path": "flawless/server/service.py", "identifier": "FlawlessThriftServiceHandler._get_email", "docstring": "Given an email address, check the email_remapping table to see if the email\n        should be sent to a different address. This function also handles overriding\n        the email domain if ignore_vcs_email_domain is set or the domain was missing", "docstring_tokens": ["Given", "an", "email", "address", "check", "the", "email_remapping", "table", "to", "see", "if", "the", "email", "should", "be", "sent", "to", "a", "different", "address", ".", "This", "function", "also", "handles", "overriding", "the", "email", "domain", "if", "ignore_vcs_email_domain", "is", "set", "or", "the", "domain", "was", "missing"], "nwo": "shopkick/flawless", "score": 0.37326674238089064, "idx": 254251}
{"url": "https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/ui/menu.py#L122-L129", "sha": "212cfe1791a4aab4783f99b665cc32da6437f419", "docstring_summary": "Launches a new menu. Wraps curses nicely so exceptions won't screw with\n        the terminal too much.", "language": "python", "parameters": "(title, items, selected=None)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "\"code\"", ":", "-", "1", ",", "\"done\"", ":", "False", "}", "curses", ".", "wrapper", "(", "Menu", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Launches a new menu. Wraps curses nicely so exceptions won't screw with\n        the terminal too much.\n        \"\"\"\n        arg_3 = {\"code\": -1, \"done\": False}\n        curses.wrapper(Menu, arg_0, arg_1, arg_2, arg_3)\n        return arg_3", "path": "tmc/ui/menu.py", "identifier": "Menu.launch", "docstring": "Launches a new menu. Wraps curses nicely so exceptions won't screw with\n        the terminal too much.", "docstring_tokens": ["Launches", "a", "new", "menu", ".", "Wraps", "curses", "nicely", "so", "exceptions", "won", "t", "screw", "with", "the", "terminal", "too", "much", "."], "nwo": "minttu/tmc.py", "score": 0.09252797783733271, "idx": 254252}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/files.py#L139-L151", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Helper function to get files in a single directory", "language": "python", "parameters": "(dir_name, extensions)", "return_statement": "return myfiles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", ")", "arg_2", "=", "set", "(", ")", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'*'", "+", "os", ".", "path", ".", "extsep", "+", "arg_3", ")", "arg_2", "|=", "set", "(", "glob", ".", "glob", "(", "arg_4", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''Helper function to get files in a single directory'''\n\n    # Expand out the directory\n    arg_0 = os.path.abspath(os.path.expanduser(arg_0))\n\n    arg_2 = set()\n\n    for arg_3 in arg_1:\n        arg_4 = os.path.join(arg_0, '*' + os.path.extsep + arg_3)\n        arg_2 |= set(glob.glob(arg_4))\n\n    return arg_2", "path": "librosa/util/files.py", "identifier": "__get_files", "docstring": "Helper function to get files in a single directory", "docstring_tokens": ["Helper", "function", "to", "get", "files", "in", "a", "single", "directory"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 254253}
{"url": "https://github.com/antevens/listen/blob/d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67/listen/signal_handler.py#L65-L92", "sha": "d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67", "docstring_summary": "Default handler, a generic callback method for signal processing", "language": "python", "parameters": "(self, signum, frame)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Signal handler called with signal: {0}\"", ".", "format", "(", "arg_1", ")", ")", "if", "arg_1", "in", "arg_0", ".", "restart_signals", ":", "arg_0", ".", "set_handler", "(", "arg_0", ".", "handled_signals", ",", "arg_0", ".", "pseudo_handler", ")", "arg_0", ".", "_cleanup", "(", ")", "os", ".", "execl", "(", "'python'", ",", "'python'", ",", "*", "sys", ".", "argv", ")", "elif", "arg_1", "in", "arg_0", ".", "abort_signals", ":", "arg_0", ".", "abort", "(", "arg_1", ")", "elif", "arg_1", "in", "arg_0", ".", "pause_signals", ":", "arg_0", ".", "pause", "(", "arg_1", ")", "elif", "arg_1", "in", "arg_0", ".", "resume_signals", ":", "arg_0", ".", "resume", "(", "arg_1", ")", "elif", "arg_1", "in", "arg_0", ".", "status_signals", ":", "arg_0", ".", "status", "(", "arg_1", ")", "elif", "arg_1", "in", "arg_0", ".", "error_signals", ":", "arg_0", ".", "log", ".", "error", "(", "'Signal handler received error signal from an external process, aborting'", ")", "arg_0", ".", "abort", "(", "arg_1", ")", "else", ":", "arg_0", ".", "log", ".", "error", "(", "\"Unhandled signal received: {0}\"", ".", "format", "(", "arg_1", ")", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Default handler, a generic callback method for signal processing\"\"\"\n        arg_0.log.debug(\"Signal handler called with signal: {0}\".format(arg_1))\n        # 1. If signal is HUP restart the python process\n        # 2. If signal is TERM, INT or QUIT we try to cleanup then exit with -1\n        # 3. If signal is STOP or TSTP we pause\n        # 4. If signal is CONT or USR1 we continue\n        # 5. If signal is INFO we print status\n        # 6. If signal is USR2 we we abort and then exit with -1\n\n        if arg_1 in arg_0.restart_signals:\n            arg_0.set_handler(arg_0.handled_signals, arg_0.pseudo_handler)\n            arg_0._cleanup()\n            os.execl('python', 'python', * sys.argv)\n        elif arg_1 in arg_0.abort_signals:\n            arg_0.abort(arg_1)\n        elif arg_1 in arg_0.pause_signals:\n            arg_0.pause(arg_1)\n        elif arg_1 in arg_0.resume_signals:\n            arg_0.resume(arg_1)\n        elif arg_1 in arg_0.status_signals:\n            arg_0.status(arg_1)\n        elif arg_1 in arg_0.error_signals:\n            arg_0.log.error('Signal handler received error signal from an external process, aborting')\n            arg_0.abort(arg_1)\n        else:\n            arg_0.log.error(\"Unhandled signal received: {0}\".format(arg_1))\n            raise", "path": "listen/signal_handler.py", "identifier": "SignalHandler.default_handler", "docstring": "Default handler, a generic callback method for signal processing", "docstring_tokens": ["Default", "handler", "a", "generic", "callback", "method", "for", "signal", "processing"], "nwo": "antevens/listen", "score": 0.21302904236143622, "idx": 254254}
{"url": "https://github.com/edoburu/django-debugtools/blob/5c609c00fa9954330cd135fc62a1e18b8e7fea8a/debugtools/utils/xview.py#L29-L55", "sha": "5c609c00fa9954330cd135fc62a1e18b8e7fea8a", "docstring_summary": "Get the template used in a TemplateResponse.\n    This returns a tuple of \"active choice, all choices\"", "language": "python", "parameters": "(response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'template_name'", ")", ":", "return", "None", ",", "None", "arg_1", "=", "arg_0", ".", "template_name", "if", "arg_1", "is", "None", ":", "return", "None", ",", "None", "if", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "len", "(", "arg_1", ")", "==", "1", ":", "return", "arg_1", "[", "0", "]", ",", "None", "else", ":", "arg_2", "=", "_Func_name", "(", "arg_1", ")", "return", "arg_2", ",", "arg_1", "elif", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "return", "arg_1", ",", "None", "else", ":", "arg_3", "=", "_get_template_filename", "(", "arg_1", ")", "arg_4", "=", "'<template object from {0}>'", ".", "format", "(", "arg_3", ")", "if", "arg_3", "else", "'<template object>'", "return", "arg_4", ",", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Get the template used in a TemplateResponse.\n    This returns a tuple of \"active choice, all choices\"\n    \"\"\"\n    if not hasattr(arg_0, 'template_name'):\n        return None, None\n\n    arg_1 = arg_0.template_name\n    if arg_1 is None:\n        return None, None\n\n    if isinstance(arg_1, (list, tuple)):\n        # See which template name was really used.\n        if len(arg_1) == 1:\n            return arg_1[0], None\n        else:\n            arg_2 = _Func_name(arg_1)\n            return arg_2, arg_1\n    elif isinstance(arg_1, six.string_types):\n        # Single string\n        return arg_1, None\n    else:\n        # Template object.\n        arg_3 = _get_template_filename(arg_1)\n        arg_4 = '<template object from {0}>'.format(arg_3) if arg_3 else '<template object>'\n        return arg_4, None", "path": "debugtools/utils/xview.py", "identifier": "get_used_template", "docstring": "Get the template used in a TemplateResponse.\n    This returns a tuple of \"active choice, all choices\"", "docstring_tokens": ["Get", "the", "template", "used", "in", "a", "TemplateResponse", ".", "This", "returns", "a", "tuple", "of", "active", "choice", "all", "choices"], "nwo": "edoburu/django-debugtools", "score": 0.28520508084306634, "idx": 254255}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/comparison.py#L437-L462", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Thresholds a distance matrix and returns the result.", "language": "python", "parameters": "(dist_matrix, perc_thr=0.05, k=1)", "return_statement": "return upper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.05", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "np", ".", "triu_indices", "(", "arg_0", ".", "shape", "[", "0", "]", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "np", ".", "zeros_like", "(", "arg_0", ")", "arg_4", "[", "arg_3", "]", "=", "arg_0", "[", "arg_3", "]", "<", "np", ".", "percentile", "(", "arg_0", "[", "arg_3", "]", ",", "arg_1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=0.05, arg_2=1):\n        \"\"\"Thresholds a distance matrix and returns the result.\n\n        Parameters\n        ----------\n\n        dist_matrix: array_like\n        Input array or object that can be converted to an array.\n\n        perc_thr: float in range of [0,100]\n        Percentile to compute which must be between 0 and 100 inclusive.\n\n        k: int, optional\n        Diagonal above which to zero elements.\n        k = 0 (the default) is the main diagonal,\n        k < 0 is below it and k > 0 is above.\n\n        Returns\n        -------\n        array_like\n\n        \"\"\"\n        arg_3 = np.triu_indices(arg_0.shape[0], arg_2=arg_2)\n        arg_4 = np.zeros_like(arg_0)\n        arg_4[arg_3] = arg_0[arg_3] < np.percentile(arg_0[arg_3], arg_1)\n        return arg_4", "path": "boyle/dicom/comparison.py", "identifier": "DicomFilesClustering.dist_percentile_threshold", "docstring": "Thresholds a distance matrix and returns the result.\n\n        Parameters\n        ----------\n\n        dist_matrix: array_like\n        Input array or object that can be converted to an array.\n\n        perc_thr: float in range of [0,100]\n        Percentile to compute which must be between 0 and 100 inclusive.\n\n        k: int, optional\n        Diagonal above which to zero elements.\n        k = 0 (the default) is the main diagonal,\n        k < 0 is below it and k > 0 is above.\n\n        Returns\n        -------\n        array_like", "docstring_tokens": ["Thresholds", "a", "distance", "matrix", "and", "returns", "the", "result", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254256}
{"url": "https://github.com/lsst-sqre/ltd-conveyor/blob/c492937c4c1e050ccc4a0b9dcc38f9980d57e305/ltdconveyor/fastly.py#L14-L52", "sha": "c492937c4c1e050ccc4a0b9dcc38f9980d57e305", "docstring_summary": "Instant purge URLs with a given surrogate key from the Fastly caches.", "language": "python", "parameters": "(surrogate_key, service_id, api_key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_4", "=", "'https://api.fastly.com'", "arg_5", "=", "'/service/{service}/purge/{surrogate_key}'", ".", "format", "(", "service", "=", "arg_1", ",", "arg_0", "=", "arg_0", ")", "arg_3", ".", "info", "(", "'Fastly purge {0}'", ".", "format", "(", "arg_5", ")", ")", "arg_6", "=", "requests", ".", "post", "(", "arg_4", "+", "arg_5", ",", "headers", "=", "{", "'Fastly-Key'", ":", "arg_2", ",", "'Accept'", ":", "'application/json'", "}", ")", "if", "arg_6", ".", "status_code", "!=", "200", ":", "raise", "FastlyError", "(", "arg_6", ".", "json", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Instant purge URLs with a given surrogate key from the Fastly caches.\n\n    Parameters\n    ----------\n    surrogate_key : `str`\n        Surrogate key header (``x-amz-meta-surrogate-key``) value of objects\n        to purge from the Fastly cache.\n    service_id : `str`\n        Fastly service ID.\n    api_key : `str`\n        Fastly API key.\n\n    Raises\n    ------\n    FastlyError\n       Error with the Fastly API usage.\n\n    Notes\n    -----\n    This function uses Fastly's ``/service/{service}/purge/{key}`` endpoint.\n    See the `Fastly Purge documentation <http://ls.st/jxg>`_ for more\n    information.\n\n    For other Fastly APIs, consider using `fastly-py\n    <https://github.com/fastly/fastly-py>`_.\n    \"\"\"\n    arg_3 = logging.getLogger(__name__)\n\n    arg_4 = 'https://api.fastly.com'\n    arg_5 = '/service/{service}/purge/{surrogate_key}'.format(\n        service=arg_1,\n        arg_0=arg_0)\n    arg_3.info('Fastly purge {0}'.format(arg_5))\n    arg_6 = requests.post(arg_4 + arg_5,\n                      headers={'Fastly-Key': arg_2,\n                               'Accept': 'application/json'})\n    if arg_6.status_code != 200:\n        raise FastlyError(arg_6.json)", "path": "ltdconveyor/fastly.py", "identifier": "purge_key", "docstring": "Instant purge URLs with a given surrogate key from the Fastly caches.\n\n    Parameters\n    ----------\n    surrogate_key : `str`\n        Surrogate key header (``x-amz-meta-surrogate-key``) value of objects\n        to purge from the Fastly cache.\n    service_id : `str`\n        Fastly service ID.\n    api_key : `str`\n        Fastly API key.\n\n    Raises\n    ------\n    FastlyError\n       Error with the Fastly API usage.\n\n    Notes\n    -----\n    This function uses Fastly's ``/service/{service}/purge/{key}`` endpoint.\n    See the `Fastly Purge documentation <http://ls.st/jxg>`_ for more\n    information.\n\n    For other Fastly APIs, consider using `fastly-py\n    <https://github.com/fastly/fastly-py>`_.", "docstring_tokens": ["Instant", "purge", "URLs", "with", "a", "given", "surrogate", "key", "from", "the", "Fastly", "caches", "."], "nwo": "lsst-sqre/ltd-conveyor", "score": 0.138843686048881, "idx": 254257}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L202-L236", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return normalized distance between the Eudex hashes of two terms.", "language": "python", "parameters": "(self, src, tar, weights='exponential', max_length=8)", "return_statement": "return self.dist_abs(src, tar, weights, max_length, True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'exponential'", ",", "arg_4", "=", "8", ")", ":", "return", "arg_0", ".", "Func_abs", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='exponential', arg_4=8):\n        \"\"\"Return normalized Funcance between the Eudex hashes of two terms.\n\n        This is Eudex Funcance normalized to [0, 1].\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        weights : str, iterable, or generator function\n            The weights or weights generator function\n        max_length : int\n            The number of characters to encode as a eudex hash\n\n        Returns\n        -------\n        int\n            The normalized Eudex Hamming Funcance\n\n        Examples\n        --------\n        >>> cmp = Eudex()\n        >>> round(cmp.Func('cat', 'hat'), 12)\n        0.062745098039\n        >>> round(cmp.Func('Niall', 'Neil'), 12)\n        0.000980392157\n        >>> round(cmp.Func('Colin', 'Cuilen'), 12)\n        0.004901960784\n        >>> round(cmp.Func('ATCG', 'TAGC'), 12)\n        0.197549019608\n\n        \"\"\"\n        return arg_0.Func_abs(arg_1, arg_2, arg_3, arg_4, True)", "path": "abydos/distance/_eudex.py", "identifier": "Eudex.dist", "docstring": "Return normalized distance between the Eudex hashes of two terms.\n\n        This is Eudex distance normalized to [0, 1].\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        weights : str, iterable, or generator function\n            The weights or weights generator function\n        max_length : int\n            The number of characters to encode as a eudex hash\n\n        Returns\n        -------\n        int\n            The normalized Eudex Hamming distance\n\n        Examples\n        --------\n        >>> cmp = Eudex()\n        >>> round(cmp.dist('cat', 'hat'), 12)\n        0.062745098039\n        >>> round(cmp.dist('Niall', 'Neil'), 12)\n        0.000980392157\n        >>> round(cmp.dist('Colin', 'Cuilen'), 12)\n        0.004901960784\n        >>> round(cmp.dist('ATCG', 'TAGC'), 12)\n        0.197549019608", "docstring_tokens": ["Return", "normalized", "distance", "between", "the", "Eudex", "hashes", "of", "two", "terms", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254258}
{"url": "https://github.com/amorison/loam/blob/a566c943a75e068a4510099331a1ddfe5bbbdd94/loam/cli.py#L182-L201", "sha": "a566c943a75e068a4510099331a1ddfe5bbbdd94", "docstring_summary": "Parse arguments and update options accordingly.", "language": "python", "parameters": "(self, arglist=None)", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "_parser", ".", "Func", "(", "arg_2", "=", "arg_1", ")", "arg_3", "=", "arg_2", ".", "loam_sub_name", "if", "arg_3", "is", "None", ":", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "_opt_bare", ".", "items", "(", ")", ":", "arg_0", ".", "_conf", "[", "arg_5", "]", "[", "arg_4", "]", "=", "getattr", "(", "arg_2", ",", "arg_4", ",", "None", ")", "else", ":", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "_opt_cmds", "[", "arg_3", "]", ".", "items", "(", ")", ":", "arg_0", ".", "_conf", "[", "arg_5", "]", "[", "arg_4", "]", "=", "getattr", "(", "arg_2", ",", "arg_4", ",", "None", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Parse arguments and update options accordingly.\n\n        Args:\n            arglist (list of str): list of arguments to parse. If set to None,\n                ``sys.argv[1:]`` is used.\n\n        Returns:\n            :class:`Namespace`: the argument namespace returned by the\n            :class:`argparse.ArgumentParser`.\n        \"\"\"\n        arg_2 = arg_0._parser.Func(arg_2=arg_1)\n        arg_3 = arg_2.loam_sub_name\n        if arg_3 is None:\n            for arg_4, arg_5 in arg_0._opt_bare.items():\n                arg_0._conf[arg_5][arg_4] = getattr(arg_2, arg_4, None)\n        else:\n            for arg_4, arg_5 in arg_0._opt_cmds[arg_3].items():\n                arg_0._conf[arg_5][arg_4] = getattr(arg_2, arg_4, None)\n        return arg_2", "path": "loam/cli.py", "identifier": "CLIManager.parse_args", "docstring": "Parse arguments and update options accordingly.\n\n        Args:\n            arglist (list of str): list of arguments to parse. If set to None,\n                ``sys.argv[1:]`` is used.\n\n        Returns:\n            :class:`Namespace`: the argument namespace returned by the\n            :class:`argparse.ArgumentParser`.", "docstring_tokens": ["Parse", "arguments", "and", "update", "options", "accordingly", "."], "nwo": "amorison/loam", "score": 0.14991498758945482, "idx": 254259}
{"url": "https://github.com/PyCQA/baron/blob/a475654f7f40c445746577ff410e1e7dceb52097/baron/path.py#L200-L222", "sha": "a475654f7f40c445746577ff410e1e7dceb52097", "docstring_summary": "Determine if we're on the targetted node.", "language": "python", "parameters": "(self, constant, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "split_on_newlines", "(", "arg_1", ")", "for", "arg_4", "in", "arg_3", ":", "if", "is_newline", "(", "arg_4", ")", ":", "arg_0", ".", "current", ".", "advance_line", "(", ")", "if", "arg_0", ".", "current", ".", "line", ">", "arg_0", ".", "target", ".", "line", ":", "return", "arg_0", ".", "STOP", "else", ":", "arg_5", "=", "len", "(", "arg_4", ")", "if", "arg_0", ".", "is_on_targetted_node", "(", "arg_5", ")", ":", "arg_0", ".", "found_path", "=", "deepcopy", "(", "arg_0", ".", "current_path", ")", "return", "arg_0", ".", "STOP", "arg_0", ".", "current", ".", "advance_columns", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Determine if we're on the targetted node.\n\n        If the targetted column is reached, `stop` and `path_found` are\n        set. If the targetted line is passed, only `stop` is set. This\n        prevents unnecessary tree travelling when the targetted column\n        is out of bounds.\n        \"\"\"\n        arg_3 = split_on_newlines(arg_1)\n\n        for arg_4 in arg_3:\n            if is_newline(arg_4):\n                arg_0.current.advance_line()\n                # if target line is passed\n                if arg_0.current.line > arg_0.target.line:\n                    return arg_0.STOP\n\n            else:\n                arg_5 = len(arg_4)\n                if arg_0.is_on_targetted_node(arg_5):\n                    arg_0.found_path = deepcopy(arg_0.current_path)\n                    return arg_0.STOP\n                arg_0.current.advance_columns(arg_5)", "path": "baron/path.py", "identifier": "PositionFinder.before_constant", "docstring": "Determine if we're on the targetted node.\n\n        If the targetted column is reached, `stop` and `path_found` are\n        set. If the targetted line is passed, only `stop` is set. This\n        prevents unnecessary tree travelling when the targetted column\n        is out of bounds.", "docstring_tokens": ["Determine", "if", "we", "re", "on", "the", "targetted", "node", "."], "nwo": "PyCQA/baron", "score": 0.3707475301590755, "idx": 254260}
{"url": "https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/kitsune.py#L89-L162", "sha": "4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4", "docstring_summary": "Fetch questions from the Kitsune url", "language": "python", "parameters": "(self, category, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", "[", "'offset'", "]", "logger", ".", "info", "(", "\"Looking for questions at url '%s' using offset %s\"", ",", "arg_0", ".", "url", ",", "str", "(", "arg_3", ")", ")", "arg_4", "=", "0", "arg_5", "=", "0", "arg_6", "=", "0", "arg_7", "=", "int", "(", "arg_3", "/", "KitsuneClient", ".", "ITEMS_PER_PAGE", ")", "arg_8", "=", "arg_7", "*", "KitsuneClient", ".", "ITEMS_PER_PAGE", "arg_9", "=", "arg_3", "-", "arg_8", "arg_10", "=", "arg_3", "arg_11", "=", "arg_0", ".", "client", ".", "get_questions", "(", "arg_3", ")", "while", "True", ":", "try", ":", "arg_12", "=", "next", "(", "arg_11", ")", "except", "StopIteration", ":", "break", "except", "requests", ".", "exceptions", ".", "HTTPError", "as", "e", ":", "if", "e", ".", "response", ".", "status_code", "==", "500", ":", "logger", ".", "exception", "(", "e", ")", "logger", ".", "error", "(", "\"Problem getting Kitsune questions. \"", "\"Loosing %i questions. Going to the next page.\"", ",", "KitsuneClient", ".", "ITEMS_PER_PAGE", ")", "arg_6", "+=", "KitsuneClient", ".", "ITEMS_PER_PAGE", "arg_10", "+=", "KitsuneClient", ".", "ITEMS_PER_PAGE", "arg_11", "=", "arg_0", ".", "client", ".", "get_questions", "(", "arg_10", ")", "continue", "else", ":", "raise", "e", "try", ":", "arg_13", "=", "json", ".", "loads", "(", "arg_12", ")", "arg_5", "=", "arg_13", "[", "'count'", "]", "arg_14", "=", "arg_13", "[", "'results'", "]", "except", "(", "ValueError", ",", "KeyError", ")", "as", "ex", ":", "logger", ".", "error", "(", "ex", ")", "arg_15", "=", "(", "\"Bad JSON format for mozilla_questions: %s\"", "%", "(", "arg_12", ")", ")", "raise", "ParseError", "(", "arg_15", "=", "arg_15", ")", "for", "arg_16", "in", "arg_14", ":", "if", "arg_9", ">", "0", ":", "arg_9", "-=", "1", "continue", "arg_16", "[", "'offset'", "]", "=", "arg_10", "arg_10", "+=", "1", "arg_16", "[", "'answers_data'", "]", "=", "[", "]", "for", "arg_17", "in", "arg_0", ".", "client", ".", "get_question_answers", "(", "arg_16", "[", "'id'", "]", ")", ":", "arg_18", "=", "json", ".", "loads", "(", "arg_17", ")", "[", "'results'", "]", "arg_16", "[", "'answers_data'", "]", "+=", "arg_18", "yield", "arg_16", "arg_4", "+=", "1", "logger", ".", "debug", "(", "\"Questions: %i/%i\"", ",", "arg_4", "+", "arg_3", ",", "arg_5", ")", "logger", ".", "info", "(", "\"Total number of questions: %i (%i total)\"", ",", "arg_4", ",", "arg_5", ")", "logger", ".", "info", "(", "\"Questions with errors dropped: %i\"", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Fetch questions from the Kitsune url\n\n        :param category: the category of items to fetch\n        :param kwargs: backend arguments\n\n        :returns: a generator of items\n        \"\"\"\n        arg_3 = arg_2['offset']\n\n        logger.info(\"Looking for questions at url '%s' using offset %s\",\n                    arg_0.url, str(arg_3))\n\n        arg_4 = 0  # number of questions processed\n        arg_5 = 0  # number of questions from API data\n        arg_6 = 0  # number of questions dropped by errors\n\n        # Always get complete pages so the first item is always\n        # the first one in the page\n        arg_7 = int(arg_3 / KitsuneClient.ITEMS_PER_PAGE)\n        arg_8 = arg_7 * KitsuneClient.ITEMS_PER_PAGE\n        # drop questions from page before the offset\n        arg_9 = arg_3 - arg_8\n        arg_10 = arg_3\n\n        arg_11 = arg_0.client.get_questions(arg_3)\n\n        while True:\n            try:\n                arg_12 = next(arg_11)\n            except StopIteration:\n                break\n            except requests.exceptions.HTTPError as e:\n                # Continue with the next page if it is a 500 error\n                if e.response.status_code == 500:\n                    logger.exception(e)\n                    logger.error(\"Problem getting Kitsune questions. \"\n                                 \"Loosing %i questions. Going to the next page.\",\n                                 KitsuneClient.ITEMS_PER_PAGE)\n                    arg_6 += KitsuneClient.ITEMS_PER_PAGE\n                    arg_10 += KitsuneClient.ITEMS_PER_PAGE\n                    arg_11 = arg_0.client.get_questions(arg_10)\n                    continue\n                else:\n                    # If it is another error just propagate the exception\n                    raise e\n\n            try:\n                arg_13 = json.loads(arg_12)\n                arg_5 = arg_13['count']\n                arg_14 = arg_13['results']\n            except (ValueError, KeyError) as ex:\n                logger.error(ex)\n                arg_15 = (\"Bad JSON format for mozilla_questions: %s\" % (arg_12))\n                raise ParseError(arg_15=arg_15)\n\n            for arg_16 in arg_14:\n                if arg_9 > 0:\n                    # Remove extra questions due to page base retrieval\n                    arg_9 -= 1\n                    continue\n                arg_16['offset'] = arg_10\n                arg_10 += 1\n                arg_16['answers_data'] = []\n                for arg_17 in arg_0.client.get_question_answers(arg_16['id']):\n                    arg_18 = json.loads(arg_17)['results']\n                    arg_16['answers_data'] += arg_18\n                yield arg_16\n                arg_4 += 1\n\n            logger.debug(\"Questions: %i/%i\", arg_4 + arg_3, arg_5)\n\n        logger.info(\"Total number of questions: %i (%i total)\", arg_4, arg_5)\n        logger.info(\"Questions with errors dropped: %i\", arg_6)", "path": "perceval/backends/mozilla/kitsune.py", "identifier": "Kitsune.fetch_items", "docstring": "Fetch questions from the Kitsune url\n\n        :param category: the category of items to fetch\n        :param kwargs: backend arguments\n\n        :returns: a generator of items", "docstring_tokens": ["Fetch", "questions", "from", "the", "Kitsune", "url"], "nwo": "chaoss/grimoirelab-perceval-mozilla", "score": 0.18579120894425885, "idx": 254261}
{"url": "https://github.com/macacajs/wd.py/blob/6d3c52060013e01a67cd52b68b5230b387427bad/macaca/webdriverresult.py#L25-L35", "sha": "6d3c52060013e01a67cd52b68b5230b387427bad", "docstring_summary": "The factory method to create WebDriverResult from JSON Object.", "language": "python", "parameters": "(cls, obj)", "return_statement": "return cls(\n            obj.get('sessionId', None),\n            obj.get('status', 0),\n            obj.get('value', None)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", "(", "arg_1", ".", "get", "(", "'sessionId'", ",", "None", ")", ",", "arg_1", ".", "get", "(", "'status'", ",", "0", ")", ",", "arg_1", ".", "get", "(", "'value'", ",", "None", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"The factory method to create WebDriverResult from JSON Object.\n\n        Args:\n            obj(dict): The JSON Object returned by server.\n        \"\"\"\n        return arg_0(\n            arg_1.get('sessionId', None),\n            arg_1.get('status', 0),\n            arg_1.get('value', None)\n        )", "path": "macaca/webdriverresult.py", "identifier": "WebDriverResult.from_object", "docstring": "The factory method to create WebDriverResult from JSON Object.\n\n        Args:\n            obj(dict): The JSON Object returned by server.", "docstring_tokens": ["The", "factory", "method", "to", "create", "WebDriverResult", "from", "JSON", "Object", "."], "nwo": "macacajs/wd.py", "score": 0.3182350344440769, "idx": 254262}
{"url": "https://github.com/rackerlabs/yoke/blob/00c01d6217b77f9ce14233a0f3686ac6f7b1c247/yoke/deploy.py#L357-L370", "sha": "00c01d6217b77f9ce14233a0f3686ac6f7b1c247", "docstring_summary": "AWS doesn't quite have Swagger 2.0 validation right and will fail\n        on some refs. So, we need to convert to deref before\n        upload.", "language": "python", "parameters": "(self, data)", "return_statement": "return deref", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "Func", "=", "copy", ".", "deepcopy", "(", "jsonref", ".", "JsonRef", ".", "replace_refs", "(", "arg_1", ")", ")", "arg_0", ".", "write_template", "(", "Func", ",", "filename", "=", "'swagger.json'", ")", "return", "Func"], "function": "def Func(arg_0, arg_1):\n        \"\"\"AWS doesn't quite have Swagger 2.0 validation right and will fail\n        on some refs. So, we need to convert to deref before\n        upload.\"\"\"\n\n        # We have to make a deepcopy here to create a proper JSON\n        # compatible object, otherwise `json.dumps` fails when it\n        # hits jsonref.JsonRef objects.\n        Func = copy.deepcopy(jsonref.JsonRef.replace_refs(arg_1))\n\n        # Write out JSON version because we might want this.\n        arg_0.write_template(Func, filename='swagger.json')\n\n        return Func", "path": "yoke/deploy.py", "identifier": "Deployment.deref", "docstring": "AWS doesn't quite have Swagger 2.0 validation right and will fail\n        on some refs. So, we need to convert to deref before\n        upload.", "docstring_tokens": ["AWS", "doesn", "t", "quite", "have", "Swagger", "2", ".", "0", "validation", "right", "and", "will", "fail", "on", "some", "refs", ".", "So", "we", "need", "to", "convert", "to", "deref", "before", "upload", "."], "nwo": "rackerlabs/yoke", "score": 0.17697123869542528, "idx": 254263}
{"url": "https://github.com/gawel/panoramisk/blob/2ccb5d18be28a8e8f444dc0cd3a3bfb59aa19a8e/panoramisk/utils.py#L57-L88", "sha": "2ccb5d18be28a8e8f444dc0cd3a3bfb59aa19a8e", "docstring_summary": "Check the AGI code and return a dict to help on error handling.", "language": "python", "parameters": "(code=None, response=None, line=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_0", "=", "int", "(", "arg_0", ")", "arg_1", "=", "arg_1", "or", "\"\"", "arg_3", "=", "{", "'status_code'", ":", "arg_0", ",", "'result'", ":", "(", "''", ",", "''", ")", ",", "'msg'", ":", "''", "}", "if", "arg_0", "==", "100", ":", "arg_3", "[", "'msg'", "]", "=", "arg_2", "elif", "arg_0", "==", "200", ":", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "re_kv", ".", "findall", "(", "arg_1", ")", ":", "arg_3", "[", "arg_4", "]", "=", "(", "arg_5", ",", "arg_6", ")", "if", "arg_6", "==", "'hangup'", ":", "return", "{", "'error'", ":", "'AGIResultHangup'", ",", "'msg'", ":", "'User hungup during execution'", "}", "elif", "arg_4", "==", "'result'", "and", "arg_5", "==", "'-1'", ":", "return", "{", "'error'", ":", "'AGIAppError'", ",", "'msg'", ":", "'Error executing application, or hangup'", "}", "elif", "arg_0", "==", "510", ":", "arg_3", "[", "'error'", "]", "=", "'AGIInvalidCommand'", "elif", "arg_0", "==", "520", ":", "arg_3", "[", "'error'", "]", "=", "'AGIUsageError'", "arg_3", "[", "'msg'", "]", "=", "arg_2", "else", ":", "arg_3", "[", "'error'", "]", "=", "'AGIUnknownError'", "arg_3", "[", "'msg'", "]", "=", "arg_2", "return", "arg_3"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None):\n    \"\"\"\n    Check the AGI code and return a dict to help on error handling.\n    \"\"\"\n    arg_0 = int(arg_0)\n    arg_1 = arg_1 or \"\"\n    arg_3 = {'status_code': arg_0, 'result': ('', ''), 'msg': ''}\n    if arg_0 == 100:\n        arg_3['msg'] = arg_2\n    elif arg_0 == 200:\n        for arg_4, arg_5, arg_6 in re_kv.findall(arg_1):\n            arg_3[arg_4] = (arg_5, arg_6)\n            # If user hangs up... we get 'hangup' in the data\n            if arg_6 == 'hangup':\n                return {\n                    'error': 'AGIResultHangup',\n                    'msg': 'User hungup during execution'}\n            elif arg_4 == 'result' and arg_5 == '-1':\n                return {\n                    'error': 'AGIAppError',\n                    'msg': 'Error executing application, or hangup'}\n    elif arg_0 == 510:\n        arg_3['error'] = 'AGIInvalidCommand'\n    elif arg_0 == 520:\n        # AGI Usage error\n        arg_3['error'] = 'AGIUsageError'\n        arg_3['msg'] = arg_2\n    else:\n        # Unhandled code or undefined response\n        arg_3['error'] = 'AGIUnknownError'\n        arg_3['msg'] = arg_2\n    return arg_3", "path": "panoramisk/utils.py", "identifier": "agi_code_check", "docstring": "Check the AGI code and return a dict to help on error handling.", "docstring_tokens": ["Check", "the", "AGI", "code", "and", "return", "a", "dict", "to", "help", "on", "error", "handling", "."], "nwo": "gawel/panoramisk", "score": 0.596986650254817, "idx": 254264}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L657-L675", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Grab focus.", "language": "python", "parameters": "(self, window_name, object_name=None)", "return_statement": "return self._grabfocus(handle)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_get_window_handle", "(", "arg_1", ")", "else", ":", "arg_3", "=", "arg_0", ".", "_get_object_handle", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "_Func", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Grab focus.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: 1 on success.\n        @rtype: integer\n        \"\"\"\n        if not arg_2:\n            arg_3, arg_4, arg_5 = arg_0._get_window_handle(arg_1)\n        else:\n            arg_3 = arg_0._get_object_handle(arg_1, arg_2)\n        return arg_0._Func(arg_3)", "path": "atomac/ldtpd/core.py", "identifier": "Core.grabfocus", "docstring": "Grab focus.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: 1 on success.\n        @rtype: integer", "docstring_tokens": ["Grab", "focus", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 254265}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/refactoring.py#L669-L694", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Update and check the number of nested blocks", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ".", "scope", "(", ")", ",", "astroid", ".", "FunctionDef", ")", ":", "return", "arg_2", "=", "arg_0", ".", "_nested_blocks", "[", ":", "]", "if", "arg_1", ".", "parent", "==", "arg_1", ".", "scope", "(", ")", ":", "arg_0", ".", "_nested_blocks", "=", "[", "arg_1", "]", "else", ":", "for", "arg_4", "in", "reversed", "(", "arg_0", ".", "_nested_blocks", ")", ":", "if", "arg_4", "==", "arg_1", ".", "parent", ":", "break", "arg_0", ".", "_nested_blocks", ".", "pop", "(", ")", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "If", ")", "and", "arg_0", ".", "_is_actual_elif", "(", "arg_1", ")", ":", "if", "arg_0", ".", "_nested_blocks", ":", "arg_0", ".", "_nested_blocks", ".", "pop", "(", ")", "arg_0", ".", "_nested_blocks", ".", "append", "(", "arg_1", ")", "if", "len", "(", "arg_2", ")", ">", "len", "(", "arg_0", ".", "_nested_blocks", ")", ":", "arg_0", ".", "_emit_nested_blocks_message_if_needed", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update and check the number of nested blocks\n        \"\"\"\n        # only check block levels inside functions or methods\n        if not isinstance(arg_1.scope(), astroid.FunctionDef):\n            return\n        # messages are triggered on leaving the nested block. Here we save the\n        # stack in case the current node isn't nested in the previous one\n        arg_2 = arg_0._nested_blocks[:]\n        if arg_1.parent == arg_1.scope():\n            arg_0._nested_blocks = [arg_1]\n        else:\n            # go through ancestors from the most nested to the less\n            for arg_4 in reversed(arg_0._nested_blocks):\n                if arg_4 == arg_1.parent:\n                    break\n                arg_0._nested_blocks.pop()\n            # if the node is an elif, this should not be another nesting level\n            if isinstance(arg_1, astroid.If) and arg_0._is_actual_elif(arg_1):\n                if arg_0._nested_blocks:\n                    arg_0._nested_blocks.pop()\n            arg_0._nested_blocks.append(arg_1)\n\n        # send message only once per group of nested blocks\n        if len(arg_2) > len(arg_0._nested_blocks):\n            arg_0._emit_nested_blocks_message_if_needed(arg_2)", "path": "pylint/checkers/refactoring.py", "identifier": "RefactoringChecker._check_nested_blocks", "docstring": "Update and check the number of nested blocks", "docstring_tokens": ["Update", "and", "check", "the", "number", "of", "nested", "blocks"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254266}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/mcp23s17.py#L190-L207", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Writes the value given to the bit in the address specified.", "language": "python", "parameters": "(self, value, bit_num, address)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "get_bit_mask", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "read", "(", "arg_3", ")", "if", "arg_1", ":", "arg_6", "=", "arg_5", "|", "arg_4", "else", ":", "arg_6", "=", "arg_5", "&", "~", "arg_4", "arg_0", ".", "write", "(", "arg_6", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Writes the value given to the bit in the address specified.\n\n        :param value: The value to write.\n        :type value: int\n        :param bit_num: The bit number to write to.\n        :type bit_num: int\n        :param address: The address to write to.\n        :type address: int\n        \"\"\"\n        arg_4 = get_bit_mask(arg_2)\n        arg_5 = arg_0.read(arg_3)\n         # generate the new byte\n        if arg_1:\n            arg_6 = arg_5 | arg_4\n        else:\n            arg_6 = arg_5 & ~arg_4\n        arg_0.write(arg_6, arg_3)", "path": "pifacecommon/mcp23s17.py", "identifier": "MCP23S17.write_bit", "docstring": "Writes the value given to the bit in the address specified.\n\n        :param value: The value to write.\n        :type value: int\n        :param bit_num: The bit number to write to.\n        :type bit_num: int\n        :param address: The address to write to.\n        :type address: int", "docstring_tokens": ["Writes", "the", "value", "given", "to", "the", "bit", "in", "the", "address", "specified", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 254267}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/sched.py#L64-L71", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Enter a new event in the queue at an absolute time.\n        Returns an ID for the event which can be used to remove it,\n        if necessary.", "language": "python", "parameters": "(self, time, priority, action, argument)", "return_statement": "return event", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "Event", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "heapq", ".", "heappush", "(", "arg_0", ".", "_queue", ",", "arg_5", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Enter a new event in the queue at an absolute time.\n        Returns an ID for the event which can be used to remove it,\n        if necessary.\n        \"\"\"\n        arg_5 = Event(arg_1, arg_2, arg_3, arg_4)\n        heapq.heappush(arg_0._queue, arg_5)\n        return arg_5", "path": "third_party/stdlib/sched.py", "identifier": "scheduler.enterabs", "docstring": "Enter a new event in the queue at an absolute time.\n        Returns an ID for the event which can be used to remove it,\n        if necessary.", "docstring_tokens": ["Enter", "a", "new", "event", "in", "the", "queue", "at", "an", "absolute", "time", ".", "Returns", "an", "ID", "for", "the", "event", "which", "can", "be", "used", "to", "remove", "it", "if", "necessary", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 254268}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/refactoring.py#L611-L614", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Return True if the exception node in argument inherit from StopIteration", "language": "python", "parameters": "(exc)", "return_statement": "return any(_class.qname() == stopiteration_qname for _class in exc.mro())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"{}.StopIteration\"", ".", "format", "(", "utils", ".", "EXCEPTIONS_MODULE", ")", "return", "any", "(", "arg_2", ".", "qname", "(", ")", "==", "arg_1", "for", "arg_2", "in", "arg_0", ".", "mro", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return True if the exception node in argument inherit from StopIteration\"\"\"\n        arg_1 = \"{}.StopIteration\".format(utils.EXCEPTIONS_MODULE)\n        return any(arg_2.qname() == arg_1 for arg_2 in arg_0.mro())", "path": "pylint/checkers/refactoring.py", "identifier": "RefactoringChecker._check_exception_inherit_from_stopiteration", "docstring": "Return True if the exception node in argument inherit from StopIteration", "docstring_tokens": ["Return", "True", "if", "the", "exception", "node", "in", "argument", "inherit", "from", "StopIteration"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254269}
{"url": "https://github.com/stevelittlefish/littlefish/blob/6deee7f81fab30716c743efe2e94e786c6e17016/littlefish/sslutil.py#L44-L75", "sha": "6deee7f81fab30716c743efe2e94e786c6e17016", "docstring_summary": "Check if a route needs ssl, and redirect it if not.  Also redirects back to http for non-ssl routes.  Static routes\n    are served as both http and https", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "request", ".", "endpoint", "and", "request", ".", "endpoint", "not", "in", "[", "'static'", ",", "'filemanager.static'", "]", ":", "arg_0", "=", "False", "arg_1", "=", "False", "arg_2", "=", "current_app", ".", "view_functions", "[", "request", ".", "endpoint", "]", "if", "request", ".", "endpoint", ".", "startswith", "(", "'admin.'", ")", "or", "(", "hasattr", "(", "arg_2", ",", "'ssl_required'", ")", "and", "arg_2", ".", "ssl_required", ")", ":", "arg_0", "=", "True", "arg_1", "=", "True", "if", "hasattr", "(", "arg_2", ",", "'ssl_allowed'", ")", "and", "arg_2", ".", "ssl_allowed", ":", "arg_1", "=", "True", "if", "(", "hasattr", "(", "arg_2", ",", "'ssl_disabled'", ")", "and", "arg_2", ".", "ssl_disabled", ")", ":", "arg_0", "=", "False", "arg_1", "=", "False", "if", "current_app", ".", "config", "[", "'SSL_ENABLED'", "]", ":", "if", "arg_0", "and", "not", "request", ".", "is_secure", ":", "log", ".", "debug", "(", "'Redirecting to https: %s'", "%", "request", ".", "endpoint", ")", "return", "redirect", "(", "request", ".", "url", ".", "replace", "(", "\"http://\"", ",", "\"https://\"", ")", ")", "elif", "not", "arg_1", "and", "request", ".", "is_secure", ":", "log", ".", "debug", "(", "'Redirecting to http: %s'", "%", "request", ".", "endpoint", ")", "return", "redirect", "(", "request", ".", "url", ".", "replace", "(", "\"https://\"", ",", "\"http://\"", ")", ")", "elif", "arg_0", ":", "log", ".", "info", "(", "'Not redirecting to HTTPS for endpoint %s as SSL_ENABLED is set to False'", "%", "request", ".", "endpoint", ")"], "function": "def Func():\n    \"\"\"\n    Check if a route needs ssl, and redirect it if not.  Also redirects back to http for non-ssl routes.  Static routes\n    are served as both http and https\n\n    :return: A response to be returned or None\n    \"\"\"\n    if request.endpoint and request.endpoint not in ['static', 'filemanager.static']:\n        arg_0 = False\n        arg_1 = False\n        arg_2 = current_app.view_functions[request.endpoint]\n        if request.endpoint.startswith('admin.') or \\\n                (hasattr(arg_2, 'ssl_required') and arg_2.ssl_required):\n            arg_0 = True\n            arg_1 = True\n\n        if hasattr(arg_2, 'ssl_allowed') and arg_2.ssl_allowed:\n            arg_1 = True\n\n        if (hasattr(arg_2, 'ssl_disabled') and arg_2.ssl_disabled):\n            arg_0 = False\n            arg_1 = False\n\n        if current_app.config['SSL_ENABLED']:\n            if arg_0 and not request.is_secure:\n                log.debug('Redirecting to https: %s' % request.endpoint)\n                return redirect(request.url.replace(\"http://\", \"https://\"))\n            elif not arg_1 and request.is_secure:\n                log.debug('Redirecting to http: %s' % request.endpoint)\n                return redirect(request.url.replace(\"https://\", \"http://\"))\n        elif arg_0:\n            log.info('Not redirecting to HTTPS for endpoint %s as SSL_ENABLED is set to False' % request.endpoint)", "path": "littlefish/sslutil.py", "identifier": "handle_ssl_redirect", "docstring": "Check if a route needs ssl, and redirect it if not.  Also redirects back to http for non-ssl routes.  Static routes\n    are served as both http and https\n\n    :return: A response to be returned or None", "docstring_tokens": ["Check", "if", "a", "route", "needs", "ssl", "and", "redirect", "it", "if", "not", ".", "Also", "redirects", "back", "to", "http", "for", "non", "-", "ssl", "routes", ".", "Static", "routes", "are", "served", "as", "both", "http", "and", "https"], "nwo": "stevelittlefish/littlefish", "score": 0.23137166388621372, "idx": 254270}
{"url": "https://github.com/mcrute/pydora/blob/d9e353e7f19da741dcf372246b4d5640cb788488/pandora/models/playlist.py#L39-L83", "sha": "d9e353e7f19da741dcf372246b4d5640cb788488", "docstring_summary": "Get audio-related fields", "language": "python", "parameters": "(self, api_client, data, newval)", "return_statement": "return audio_url[self.field] if audio_url else None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "get", "(", "\"audioUrlMap\"", ")", "arg_5", "=", "arg_2", ".", "get", "(", "\"audioUrl\"", ")", "if", "arg_5", "and", "not", "arg_4", ":", "arg_4", "=", "{", "BaseAPIClient", ".", "HIGH_AUDIO_QUALITY", ":", "{", "\"audioUrl\"", ":", "arg_5", ",", "\"bitrate\"", ":", "64", ",", "\"encoding\"", ":", "\"aacplus\"", ",", "}", "}", "elif", "not", "arg_4", ":", "return", "None", "arg_6", "=", "[", "BaseAPIClient", ".", "HIGH_AUDIO_QUALITY", ",", "BaseAPIClient", ".", "MED_AUDIO_QUALITY", ",", "BaseAPIClient", ".", "LOW_AUDIO_QUALITY", "]", "arg_7", "=", "arg_1", ".", "default_audio_quality", "if", "arg_7", "in", "arg_6", ":", "arg_8", "=", "arg_6", ".", "index", "(", "arg_7", ")", "arg_6", "=", "arg_6", "[", "arg_8", ":", "]", "for", "arg_9", "in", "arg_6", ":", "arg_5", "=", "arg_4", ".", "get", "(", "arg_9", ")", "if", "arg_5", ":", "return", "arg_5", "[", "arg_0", ".", "field", "]", "return", "arg_5", "[", "arg_0", ".", "field", "]", "if", "arg_5", "else", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Get audio-related fields\n\n        Try to find fields for the audio url for specified preferred quality\n        level, or next-lowest available quality url otherwise.\n        \"\"\"\n        arg_4 = arg_2.get(\"audioUrlMap\")\n        arg_5 = arg_2.get(\"audioUrl\")\n\n        # Only an audio URL, not a quality map. This happens for most of the\n        # mobile client tokens and some of the others now. In this case\n        # substitute the empirically determined default values in the format\n        # used by the rest of the function so downstream consumers continue to\n        # work.\n        if arg_5 and not arg_4:\n            arg_4 = {\n                BaseAPIClient.HIGH_AUDIO_QUALITY: {\n                    \"audioUrl\": arg_5,\n                    \"bitrate\": 64,\n                    \"encoding\": \"aacplus\",\n                }\n            }\n        elif not arg_4:  # No audio url available (e.g. ad tokens)\n            return None\n\n        arg_6 = [BaseAPIClient.HIGH_AUDIO_QUALITY,\n                               BaseAPIClient.MED_AUDIO_QUALITY,\n                               BaseAPIClient.LOW_AUDIO_QUALITY]\n\n        # Only iterate over sublist, starting at preferred audio quality, or\n        # from the beginning of the list if nothing is found. Ensures that the\n        # bitrate used will always be the same or lower quality than was\n        # specified to prevent audio from skipping for slow connections.\n        arg_7 = arg_1.default_audio_quality\n        if arg_7 in arg_6:\n            arg_8 = arg_6.index(arg_7)\n            arg_6 = arg_6[arg_8:]\n\n        for arg_9 in arg_6:\n            arg_5 = arg_4.get(arg_9)\n\n            if arg_5:\n                return arg_5[arg_0.field]\n\n        return arg_5[arg_0.field] if arg_5 else None", "path": "pandora/models/playlist.py", "identifier": "AudioField.formatter", "docstring": "Get audio-related fields\n\n        Try to find fields for the audio url for specified preferred quality\n        level, or next-lowest available quality url otherwise.", "docstring_tokens": ["Get", "audio", "-", "related", "fields"], "nwo": "mcrute/pydora", "score": 0.5152943856204436, "idx": 254271}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/nest_util.py#L116-L182", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Converts `args` to `Tensor`s.", "language": "python", "parameters": "(args, dtype=None, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "if", "expand_as_args", "(", "arg_0", ")", "or", "_expand_as_kwargs", "(", "arg_0", ")", ":", "arg_3", "=", "_get_shallow_structure", "(", "arg_0", ")", "return", "nest", ".", "map_structure_up_to", "(", "arg_3", ",", "lambda", "s", ":", "_nested_convert_to_tensor", "(", "s", ",", "arg_2", "=", "arg_2", ")", ",", "arg_0", ")", "else", ":", "return", "_nested_convert_to_tensor", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "else", ":", "return", "nest", ".", "map_structure_up_to", "(", "arg_1", ",", "lambda", "s", ",", "arg_1", ":", "_nested_convert_to_tensor", "(", "s", ",", "arg_1", ",", "arg_2", ")", ",", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n  \"\"\"Converts `args` to `Tensor`s.\n\n  Use this when it is necessary to convert user-provided arguments that will\n  then be passed to user-provided callables.\n\n  When `dtype` is `None` this function behaves as follows:\n\n  1A. If the top-level structure is a `list`/`tuple` but not a `namedtuple`,\n      then it is left as is and only its elements are converted to `Tensor`s.\n\n  2A. The sub-structures are converted to `Tensor`s eagerly. E.g. if `args` is\n      `{'arg': [[1], [2]]}` it is converted to\n      `{'arg': tf.constant([[1], [2]])}`. If the conversion fails, it will\n      attempt to recurse into its children.\n\n  When `dtype` is specified, it acts as both a structural and numeric type\n  constraint. `dtype` can be a single `DType`, `None` or a nested collection\n  thereof. The conversion rule becomes as follows:\n\n  1B. The return value of this function will have the same structure as `dtype`.\n\n  2B. If the leaf of `dtype` is a concrete `DType`, then the corresponding\n      sub-structure in `args` is converted to a `Tensor`.\n\n  3B. If the leaf of `dtype` is `None`, then the corresponding sub-structure is\n      converted eagerly as described in the rule 2A above.\n\n  Args:\n    args: Arguments to convert to `Tensor`s.\n    dtype: Optional structure/numeric type constraint.\n    name: Optional name-scope to use.\n\n  Returns:\n    args: Converted `args`.\n\n  #### Examples.\n\n  This table shows some useful conversion cases. `T` means `Tensor`, `NT` means\n  `namedtuple` and `CNT` means a `namedtuple` with a `Tensor`-conversion\n  function registered.\n\n  |     args     |    dtype   |       output       |\n  |:------------:|:----------:|:------------------:|\n  | `{\"a\": 1}`   | `None`     | `{\"a\": T(1)}`      |\n  | `T(1)`       | `None`     | `T(1)`             |\n  | `[1]`        | `None`     | `[T(1)]`           |\n  | `[1]`        | `tf.int32` | `T([1])`           |\n  | `[[T(1)]]`   | `None`     | `[T([1])]`         |\n  | `[[T(1)]]`   | `[[None]]` | `[[T(1)]]`         |\n  | `NT(1, 2)`   | `None`     | `NT(T(1), T(2))`   |\n  | `NT(1, 2)`   | `tf.int32` | `T([1, 2])`        |\n  | `CNT(1, 2)`  | `None`     | `T(...)`           |\n  | `[[1, [2]]]` | `None`     | `[[T(1), T([2])]]` |\n\n  \"\"\"\n  if arg_1 is None:\n    if expand_as_args(arg_0) or _expand_as_kwargs(arg_0):\n      arg_3 = _get_shallow_structure(arg_0)\n      return nest.map_structure_up_to(\n          arg_3, lambda s: _nested_convert_to_tensor(s, arg_2=arg_2), arg_0)\n    else:\n      return _nested_convert_to_tensor(arg_0, arg_2=arg_2)\n  else:\n    return nest.map_structure_up_to(\n        arg_1, lambda s, arg_1: _nested_convert_to_tensor(s, arg_1, arg_2), arg_0,\n        arg_1)", "path": "tensorflow_probability/python/internal/nest_util.py", "identifier": "convert_args_to_tensor", "docstring": "Converts `args` to `Tensor`s.\n\n  Use this when it is necessary to convert user-provided arguments that will\n  then be passed to user-provided callables.\n\n  When `dtype` is `None` this function behaves as follows:\n\n  1A. If the top-level structure is a `list`/`tuple` but not a `namedtuple`,\n      then it is left as is and only its elements are converted to `Tensor`s.\n\n  2A. The sub-structures are converted to `Tensor`s eagerly. E.g. if `args` is\n      `{'arg': [[1], [2]]}` it is converted to\n      `{'arg': tf.constant([[1], [2]])}`. If the conversion fails, it will\n      attempt to recurse into its children.\n\n  When `dtype` is specified, it acts as both a structural and numeric type\n  constraint. `dtype` can be a single `DType`, `None` or a nested collection\n  thereof. The conversion rule becomes as follows:\n\n  1B. The return value of this function will have the same structure as `dtype`.\n\n  2B. If the leaf of `dtype` is a concrete `DType`, then the corresponding\n      sub-structure in `args` is converted to a `Tensor`.\n\n  3B. If the leaf of `dtype` is `None`, then the corresponding sub-structure is\n      converted eagerly as described in the rule 2A above.\n\n  Args:\n    args: Arguments to convert to `Tensor`s.\n    dtype: Optional structure/numeric type constraint.\n    name: Optional name-scope to use.\n\n  Returns:\n    args: Converted `args`.\n\n  #### Examples.\n\n  This table shows some useful conversion cases. `T` means `Tensor`, `NT` means\n  `namedtuple` and `CNT` means a `namedtuple` with a `Tensor`-conversion\n  function registered.\n\n  |     args     |    dtype   |       output       |\n  |:------------:|:----------:|:------------------:|\n  | `{\"a\": 1}`   | `None`     | `{\"a\": T(1)}`      |\n  | `T(1)`       | `None`     | `T(1)`             |\n  | `[1]`        | `None`     | `[T(1)]`           |\n  | `[1]`        | `tf.int32` | `T([1])`           |\n  | `[[T(1)]]`   | `None`     | `[T([1])]`         |\n  | `[[T(1)]]`   | `[[None]]` | `[[T(1)]]`         |\n  | `NT(1, 2)`   | `None`     | `NT(T(1), T(2))`   |\n  | `NT(1, 2)`   | `tf.int32` | `T([1, 2])`        |\n  | `CNT(1, 2)`  | `None`     | `T(...)`           |\n  | `[[1, [2]]]` | `None`     | `[[T(1), T([2])]]` |", "docstring_tokens": ["Converts", "args", "to", "Tensor", "s", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254272}
{"url": "https://github.com/tomasbasham/dominos/blob/59729a8bdca0ae30a84115a0e93e9b1f259faf0e/dominos/api.py#L82-L100", "sha": "59729a8bdca0ae30a84115a0e93e9b1f259faf0e", "docstring_summary": "Set local cookies by initialising the delivery system on the remote.\n        Requires a store ID and a delivery postcode.", "language": "python", "parameters": "(self, store, postcode, fulfilment_method=FULFILMENT_METHOD.DELIVERY)", "return_statement": "return self.__post('/Journey/Initialize', json=params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "DELIVERY", ")", ":", "arg_6", "=", "'delivery'", "if", "arg_3", "==", "arg_4", ".", "DELIVERY", "else", "'collection'", "arg_7", "=", "{", "'fulfilmentMethod'", ":", "arg_6", ",", "'postcode'", ":", "arg_2", ",", "'storeid'", ":", "arg_1", ".", "store_id", "}", "return", "arg_0", ".", "__post", "(", "'/Journey/Initialize'", ",", "json", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4.DELIVERY):\n        '''\n        Set local cookies by initialising the delivery system on the remote.\n        Requires a store ID and a delivery postcode.\n\n        :param Store store: Store id.\n        :param string postcode: A postcode.\n        :return: A response having initialised the delivery system.\n        :rtype: requests.Response\n        '''\n        arg_6 = 'delivery' if arg_3 == arg_4.DELIVERY else 'collection'\n\n        arg_7 = {\n            'fulfilmentMethod': arg_6,\n            'postcode': arg_2,\n            'storeid': arg_1.store_id\n        }\n\n        return arg_0.__post('/Journey/Initialize', json=arg_7)", "path": "dominos/api.py", "identifier": "Client.set_delivery_system", "docstring": "Set local cookies by initialising the delivery system on the remote.\n        Requires a store ID and a delivery postcode.\n\n        :param Store store: Store id.\n        :param string postcode: A postcode.\n        :return: A response having initialised the delivery system.\n        :rtype: requests.Response", "docstring_tokens": ["Set", "local", "cookies", "by", "initialising", "the", "delivery", "system", "on", "the", "remote", ".", "Requires", "a", "store", "ID", "and", "a", "delivery", "postcode", "."], "nwo": "tomasbasham/dominos", "score": 0.5665029860115997, "idx": 254273}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L104-L116", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Print ``top_n`` big file in this dir.", "language": "python", "parameters": "(self, top_n=5)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ")", ":", "arg_0", ".", "assert_is_dir_and_exists", "(", ")", "arg_2", "=", "sorted", "(", "[", "(", "arg_3", ",", "arg_3", ".", "size", ")", "for", "arg_3", "in", "arg_0", ".", "select_file", "(", "recursive", "=", "True", ")", "]", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", ",", "reverse", "=", "True", ",", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", "[", ":", "arg_1", "]", ":", "print", "(", "\"{:<9}    {:<9}\"", ".", "format", "(", "repr_data_size", "(", "arg_4", ")", ",", "arg_3", ".", "abspath", ")", ")"], "function": "def Func(arg_0, arg_1=5):\n        \"\"\"\n        Print ``top_n`` big file in this dir.\n        \"\"\"\n        arg_0.assert_is_dir_and_exists()\n\n        arg_2 = sorted(\n            [(arg_3, arg_3.size) for arg_3 in arg_0.select_file(recursive=True)],\n            key=lambda x: x[1],\n            reverse=True,\n        )\n        for arg_3, arg_4 in arg_2[:arg_1]:\n            print(\"{:<9}    {:<9}\".format(repr_data_size(arg_4), arg_3.abspath))", "path": "pathlib_mate/mate_tool_box.py", "identifier": "ToolBox.print_big_file", "docstring": "Print ``top_n`` big file in this dir.", "docstring_tokens": ["Print", "top_n", "big", "file", "in", "this", "dir", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 254274}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/data.py#L243-L246", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Contribute `filename`'s data to the Md5Hash `hasher`.", "language": "python", "parameters": "(self, filename, hasher)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", ".", "update", "(", "arg_0", ".", "executed_lines", "(", "arg_1", ")", ")", "arg_2", ".", "update", "(", "arg_0", ".", "executed_arcs", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Contribute `filename`'s data to the Md5Hash `hasher`.\"\"\"\n        arg_2.update(arg_0.executed_lines(arg_1))\n        arg_2.update(arg_0.executed_arcs(arg_1))", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/data.py", "identifier": "CoverageData.add_to_hash", "docstring": "Contribute `filename`'s data to the Md5Hash `hasher`.", "docstring_tokens": ["Contribute", "filename", "s", "data", "to", "the", "Md5Hash", "hasher", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 254275}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/account.py#L279-L296", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Authenticate a user with a TMDb username and password.  The user\n        must have a verified email address and be registered on TMDb.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Authenticate a user with a TMDb username and password.  The user\n        must have a verified email address and be registered on TMDb.\n\n        Args:\n            request_token: The token you generated for the user to approve.\n            username: The user's username on TMDb.\n            password: The user's password on TMDb.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/account.py", "identifier": "Authentication.token_validate_with_login", "docstring": "Authenticate a user with a TMDb username and password.  The user\n        must have a verified email address and be registered on TMDb.\n\n        Args:\n            request_token: The token you generated for the user to approve.\n            username: The user's username on TMDb.\n            password: The user's password on TMDb.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Authenticate", "a", "user", "with", "a", "TMDb", "username", "and", "password", ".", "The", "user", "must", "have", "a", "verified", "email", "address", "and", "be", "registered", "on", "TMDb", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 254276}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/image.py#L72-L137", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Image processor, rotate and resize the image.", "language": "python", "parameters": "(source, outname, settings, options=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "logging", ".", "getLogger", "(", "__name__", ")", "if", "arg_2", "[", "'use_orig'", "]", "or", "arg_0", ".", "endswith", "(", "'.gif'", ")", ":", "utils", ".", "copy", "(", "arg_0", ",", "arg_1", ",", "symlink", "=", "arg_2", "[", "'orig_link'", "]", ")", "return", "arg_5", "=", "_read_image", "(", "arg_0", ")", "arg_6", "=", "arg_5", ".", "format", "if", "arg_2", "[", "'copy_exif_data'", "]", "and", "arg_2", "[", "'autorotate_images'", "]", ":", "arg_4", ".", "warning", "(", "\"The 'autorotate_images' and 'copy_exif_data' settings \"", "\"are not compatible because Sigal can't save the \"", "\"modified Orientation tag.\"", ")", "if", "arg_2", "[", "'copy_exif_data'", "]", "and", "_has_exif_tags", "(", "arg_5", ")", ":", "if", "arg_3", "is", "not", "None", ":", "arg_3", "=", "deepcopy", "(", "arg_3", ")", "else", ":", "arg_3", "=", "{", "}", "arg_3", "[", "'exif'", "]", "=", "arg_5", ".", "info", "[", "'exif'", "]", "if", "arg_2", "[", "'autorotate_images'", "]", ":", "try", ":", "arg_5", "=", "Transpose", "(", ")", ".", "process", "(", "arg_5", ")", "except", "(", "IOError", ",", "IndexError", ")", ":", "pass", "if", "arg_2", "[", "'img_processor'", "]", ":", "try", ":", "arg_4", ".", "debug", "(", "'Processor: %s'", ",", "arg_2", "[", "'img_processor'", "]", ")", "arg_7", "=", "getattr", "(", "pilkit", ".", "processors", ",", "arg_2", "[", "'img_processor'", "]", ")", "except", "AttributeError", ":", "arg_4", ".", "error", "(", "'Wrong processor name: %s'", ",", "arg_2", "[", "'img_processor'", "]", ")", "sys", ".", "exit", "(", ")", "arg_8", ",", "arg_9", "=", "arg_2", "[", "'img_size'", "]", "if", "arg_5", ".", "size", "[", "0", "]", "<", "arg_5", ".", "size", "[", "1", "]", ":", "arg_9", ",", "arg_8", "=", "arg_8", ",", "arg_9", "arg_10", "=", "arg_7", "(", "arg_8", ",", "arg_9", ",", "upscale", "=", "False", ")", "arg_5", "=", "arg_10", ".", "process", "(", "arg_5", ")", "for", "arg_11", "in", "signals", ".", "img_resized", ".", "receivers_for", "(", "arg_5", ")", ":", "arg_5", "=", "arg_11", "(", "arg_5", ",", "arg_2", "=", "arg_2", ")", "arg_12", "=", "arg_5", ".", "format", "or", "arg_6", "or", "'JPEG'", "arg_4", ".", "debug", "(", "'Save resized image to %s (%s)'", ",", "arg_1", ",", "arg_12", ")", "save_image", "(", "arg_5", ",", "arg_1", ",", "arg_12", ",", "arg_3", "=", "arg_3", ",", "autoconvert", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"Image processor, rotate and resize the image.\n\n    :param source: path to an image\n    :param outname: output filename\n    :param settings: settings dict\n    :param options: dict with PIL options (quality, optimize, progressive)\n\n    \"\"\"\n\n    arg_4 = logging.getLogger(__name__)\n\n    if arg_2['use_orig'] or arg_0.endswith('.gif'):\n        utils.copy(arg_0, arg_1, symlink=arg_2['orig_link'])\n        return\n\n    arg_5 = _read_image(arg_0)\n    arg_6 = arg_5.format\n\n    if arg_2['copy_exif_data'] and arg_2['autorotate_images']:\n        arg_4.warning(\"The 'autorotate_images' and 'copy_exif_data' settings \"\n                       \"are not compatible because Sigal can't save the \"\n                       \"modified Orientation tag.\")\n\n    # Preserve EXIF data\n    if arg_2['copy_exif_data'] and _has_exif_tags(arg_5):\n        if arg_3 is not None:\n            arg_3 = deepcopy(arg_3)\n        else:\n            arg_3 = {}\n        arg_3['exif'] = arg_5.info['exif']\n\n    # Rotate the img, and catch IOError when PIL fails to read EXIF\n    if arg_2['autorotate_images']:\n        try:\n            arg_5 = Transpose().process(arg_5)\n        except (IOError, IndexError):\n            pass\n\n    # Resize the image\n    if arg_2['img_processor']:\n        try:\n            arg_4.debug('Processor: %s', arg_2['img_processor'])\n            arg_7 = getattr(pilkit.processors,\n                                    arg_2['img_processor'])\n        except AttributeError:\n            arg_4.error('Wrong processor name: %s', arg_2['img_processor'])\n            sys.exit()\n\n        arg_8, arg_9 = arg_2['img_size']\n\n        if arg_5.size[0] < arg_5.size[1]:\n            # swap target size if image is in portrait mode\n            arg_9, arg_8 = arg_8, arg_9\n\n        arg_10 = arg_7(arg_8, arg_9, upscale=False)\n        arg_5 = arg_10.process(arg_5)\n\n    # signal.send() does not work here as plugins can modify the image, so we\n    # iterate other the receivers to call them with the image.\n    for arg_11 in signals.img_resized.receivers_for(arg_5):\n        arg_5 = arg_11(arg_5, arg_2=arg_2)\n\n    arg_12 = arg_5.format or arg_6 or 'JPEG'\n    arg_4.debug('Save resized image to %s (%s)', arg_1, arg_12)\n    save_image(arg_5, arg_1, arg_12, arg_3=arg_3, autoconvert=True)", "path": "sigal/image.py", "identifier": "generate_image", "docstring": "Image processor, rotate and resize the image.\n\n    :param source: path to an image\n    :param outname: output filename\n    :param settings: settings dict\n    :param options: dict with PIL options (quality, optimize, progressive)", "docstring_tokens": ["Image", "processor", "rotate", "and", "resize", "the", "image", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 254277}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L258-L279", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Retrieves the results of an existing designrun", "language": "python", "parameters": "(self, data_view_id, run_uuid)", "return_statement": "return DesignResults(\n            best_materials=result.get(\"best_material_results\"),\n            next_experiments=result.get(\"next_experiment_results\")\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "routes", ".", "get_data_view_design_results", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_get", "(", "arg_3", ")", ".", "json", "(", ")", "arg_5", "=", "arg_4", "[", "\"data\"", "]", "return", "DesignResults", "(", "best_materials", "=", "arg_5", ".", "get", "(", "\"best_material_results\"", ")", ",", "next_experiments", "=", "arg_5", ".", "get", "(", "\"next_experiment_results\"", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Retrieves the results of an existing designrun\n\n        :param data_view_id: The ID number of the data view to which the\n            run belongs, as a string\n        :type data_view_id: str\n        :param run_uuid: The UUID of the design run to retrieve results from\n        :type run_uuid: str\n        :return: A :class:`DesignResults` object\n        \"\"\"\n\n        arg_3 = routes.get_data_view_design_results(arg_1, arg_2)\n\n        arg_4 = arg_0._get(arg_3).json()\n\n        arg_5 = arg_4[\"data\"]\n\n        return DesignResults(\n            best_materials=arg_5.get(\"best_material_results\"),\n            next_experiments=arg_5.get(\"next_experiment_results\")\n        )", "path": "citrination_client/models/client.py", "identifier": "ModelsClient.get_design_run_results", "docstring": "Retrieves the results of an existing designrun\n\n        :param data_view_id: The ID number of the data view to which the\n            run belongs, as a string\n        :type data_view_id: str\n        :param run_uuid: The UUID of the design run to retrieve results from\n        :type run_uuid: str\n        :return: A :class:`DesignResults` object", "docstring_tokens": ["Retrieves", "the", "results", "of", "an", "existing", "designrun"], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 254278}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L812-L832", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a Python AST Node for a `do` expression.", "language": "python", "parameters": "(ctx: GeneratorContext, node: Do)", "return_statement": "return GeneratedPyAST(\n        node=ast.Name(id=do_result_name, ctx=ast.Load()), dependencies=fn_body_ast\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "DO", "assert", "not", "arg_2", ".", "is_body", "arg_4", "=", "GeneratedPyAST", ".", "reduce", "(", "*", "map", "(", "partial", "(", "gen_py_ast", ",", "arg_0", ")", ",", "chain", "(", "arg_2", ".", "statements", ",", "[", "arg_2", ".", "ret", "]", ")", ")", ")", "arg_5", ":", "List", "[", "ast", ".", "AST", "]", "=", "[", "]", "arg_6", "=", "genname", "(", "_DO_PREFIX", ")", "arg_5", ".", "extend", "(", "map", "(", "statementize", ",", "arg_4", ".", "dependencies", ")", ")", "arg_5", ".", "append", "(", "ast", ".", "Assign", "(", "targets", "=", "[", "ast", ".", "Name", "(", "id", "=", "arg_6", ",", "arg_0", "=", "ast", ".", "Store", "(", ")", ")", "]", ",", "value", "=", "arg_4", ".", "node", ")", ")", "return", "GeneratedPyAST", "(", "arg_2", "=", "ast", ".", "Name", "(", "id", "=", "arg_6", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", ",", "dependencies", "=", "arg_5", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:\n    \"\"\"Return a Python AST Node for a `do` expression.\"\"\"\n    assert arg_2.op == NodeOp.DO\n    assert not arg_2.is_body\n\n    arg_4 = GeneratedPyAST.reduce(\n        *map(partial(gen_py_ast, arg_0), chain(arg_2.statements, [arg_2.ret]))\n    )\n\n    arg_5: List[ast.AST] = []\n    arg_6 = genname(_DO_PREFIX)\n    arg_5.extend(map(statementize, arg_4.dependencies))\n    arg_5.append(\n        ast.Assign(\n            targets=[ast.Name(id=arg_6, arg_0=ast.Store())], value=arg_4.node\n        )\n    )\n\n    return GeneratedPyAST(\n        arg_2=ast.Name(id=arg_6, arg_0=ast.Load()), dependencies=arg_5\n    )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_do_to_py_ast", "docstring": "Return a Python AST Node for a `do` expression.", "docstring_tokens": ["Return", "a", "Python", "AST", "Node", "for", "a", "do", "expression", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 254279}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/multivariate_student_t.py#L306-L337", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper to compute stddev, covariance and variance.", "language": "python", "parameters": "(self, statistic, statistic_name, statistic_ndims,\n                      df_factor_fn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "tf", ".", "reshape", "(", "arg_0", ".", "df", ",", "tf", ".", "concat", "(", "[", "tf", ".", "shape", "(", "input", "=", "arg_0", ".", "df", ")", ",", "tf", ".", "ones", "(", "[", "arg_3", "]", ",", "dtype", "=", "tf", ".", "int32", ")", "]", ",", "-", "1", ")", ")", "arg_5", "=", "_broadcast_to_shape", "(", "arg_5", ",", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", ")", "arg_6", "=", "tf", ".", "where", "(", "arg_5", ">", "2.", ",", "arg_5", "-", "2.", ",", "tf", ".", "ones_like", "(", "arg_5", ")", ")", "arg_1", "=", "arg_1", "*", "arg_4", "(", "arg_5", "/", "arg_6", ")", "arg_7", "=", "dtype_util", ".", "as_numpy_dtype", "(", "arg_0", ".", "dtype", ")", "(", "np", ".", "inf", ")", "arg_8", "=", "tf", ".", "where", "(", "arg_5", ">", "2.", ",", "arg_1", ",", "tf", ".", "fill", "(", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", ",", "arg_7", ",", "name", "=", "\"inf\"", ")", ")", "if", "arg_0", ".", "allow_nan_stats", ":", "arg_9", "=", "dtype_util", ".", "as_numpy_dtype", "(", "arg_0", ".", "dtype", ")", "(", "np", ".", "nan", ")", "return", "tf", ".", "where", "(", "arg_5", ">", "1.", ",", "arg_8", ",", "tf", ".", "fill", "(", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", ",", "arg_9", ",", "name", "=", "\"nan\"", ")", ")", "else", ":", "with", "tf", ".", "control_dependencies", "(", "[", "assert_util", ".", "assert_less", "(", "tf", ".", "cast", "(", "1.", ",", "arg_0", ".", "dtype", ")", ",", "arg_5", ",", "message", "=", "arg_2", "+", "\" not defined for components of df <= 1\"", ")", ",", "]", ")", ":", "return", "tf", ".", "identity", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                      arg_4):\n    \"\"\"Helper to compute stddev, covariance and variance.\"\"\"\n    arg_5 = tf.reshape(\n        arg_0.df,\n        tf.concat([\n            tf.shape(input=arg_0.df),\n            tf.ones([arg_3], dtype=tf.int32)\n        ], -1))\n    arg_5 = _broadcast_to_shape(arg_5, tf.shape(input=arg_1))\n    # We need to put the tf.where inside the outer tf.where to ensure we never\n    # hit a NaN in the gradient.\n    arg_6 = tf.where(arg_5 > 2., arg_5 - 2., tf.ones_like(arg_5))\n    arg_1 = arg_1 * arg_4(arg_5 / arg_6)\n    # When 1 < df <= 2, stddev/variance are infinite.\n    arg_7 = dtype_util.as_numpy_dtype(arg_0.dtype)(np.inf)\n    arg_8 = tf.where(\n        arg_5 > 2., arg_1, tf.fill(tf.shape(input=arg_1), arg_7, name=\"inf\"))\n\n    if arg_0.allow_nan_stats:\n      arg_9 = dtype_util.as_numpy_dtype(arg_0.dtype)(np.nan)\n      return tf.where(arg_5 > 1., arg_8,\n                      tf.fill(tf.shape(input=arg_1), arg_9, name=\"nan\"))\n    else:\n      with tf.control_dependencies([\n          assert_util.assert_less(\n              tf.cast(1., arg_0.dtype),\n              arg_5,\n              message=arg_2 +\n              \" not defined for components of df <= 1\"),\n      ]):\n        return tf.identity(arg_8)", "path": "tensorflow_probability/python/distributions/multivariate_student_t.py", "identifier": "MultivariateStudentTLinearOperator._std_var_helper", "docstring": "Helper to compute stddev, covariance and variance.", "docstring_tokens": ["Helper", "to", "compute", "stddev", "covariance", "and", "variance", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254280}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/logistic_regression.py#L89-L131", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Utility method to visualize decision boundaries in R^2.", "language": "python", "parameters": "(features, labels, true_w_b, candidate_w_bs, fname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "figure", ".", "Figure", "(", "figsize", "=", "(", "6", ",", "6", ")", ")", "arg_6", "=", "backend_agg", ".", "FigureCanvasAgg", "(", "arg_5", ")", "arg_7", "=", "arg_5", ".", "add_subplot", "(", "1", ",", "1", ",", "1", ")", "arg_7", ".", "scatter", "(", "arg_0", "[", ":", ",", "0", "]", ",", "arg_0", "[", ":", ",", "1", "]", ",", "c", "=", "np", ".", "float32", "(", "arg_1", "[", ":", ",", "0", "]", ")", ",", "cmap", "=", "cm", ".", "get_cmap", "(", "\"binary\"", ")", ",", "edgecolors", "=", "\"k\"", ")", "def", "plot_weights", "(", "arg_8", ",", "arg_9", ",", "**", "arg_10", ")", ":", "arg_11", ",", "arg_12", "=", "arg_8", "arg_13", "=", "np", ".", "linspace", "(", "-", "1", ",", "1", ",", "100", ")", "arg_14", "=", "-", "(", "arg_11", "*", "arg_13", "+", "arg_9", ")", "/", "arg_12", "arg_7", ".", "plot", "(", "arg_13", ",", "arg_14", ",", "**", "arg_10", ")", "for", "arg_8", ",", "arg_9", "in", "arg_3", ":", "plot_weights", "(", "arg_8", ",", "arg_9", ",", "alpha", "=", "1.", "/", "np", ".", "sqrt", "(", "len", "(", "arg_3", ")", ")", ",", "lw", "=", "1", ",", "color", "=", "\"blue\"", ")", "if", "arg_2", "is", "not", "None", ":", "plot_weights", "(", "*", "arg_2", ",", "lw", "=", "4", ",", "color", "=", "\"green\"", ",", "label", "=", "\"true separator\"", ")", "arg_7", ".", "set_xlim", "(", "[", "-", "1.5", ",", "1.5", "]", ")", "arg_7", ".", "set_ylim", "(", "[", "-", "1.5", ",", "1.5", "]", ")", "arg_7", ".", "legend", "(", ")", "arg_6", ".", "print_figure", "(", "arg_4", ",", "format", "=", "\"png\"", ")", "print", "(", "\"saved {}\"", ".", "format", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n  \"\"\"Utility method to visualize decision boundaries in R^2.\n\n  Args:\n    features: Input points, as a Numpy `array` of shape `[num_examples, 2]`.\n    labels: Numpy `float`-like array of shape `[num_examples, 1]` giving a\n      label for each point.\n    true_w_b: A `tuple` `(w, b)` where `w` is a Numpy array of\n       shape `[2]` and `b` is a scalar `float`, interpreted as a\n       decision rule of the form `dot(features, w) + b > 0`.\n    candidate_w_bs: Python `iterable` containing tuples of the same form as\n       true_w_b.\n    fname: The filename to save the plot as a PNG image (Python `str`).\n  \"\"\"\n  arg_5 = figure.Figure(figsize=(6, 6))\n  arg_6 = backend_agg.FigureCanvasAgg(arg_5)\n  arg_7 = arg_5.add_subplot(1, 1, 1)\n  arg_7.scatter(arg_0[:, 0], arg_0[:, 1],\n             c=np.float32(arg_1[:, 0]),\n             cmap=cm.get_cmap(\"binary\"),\n             edgecolors=\"k\")\n\n  def plot_weights(arg_8, arg_9, **arg_10):\n    arg_11, arg_12 = arg_8\n    arg_13 = np.linspace(-1, 1, 100)\n    arg_14 = -(arg_11  * arg_13 + arg_9) / arg_12\n    arg_7.plot(arg_13, arg_14, **arg_10)\n\n  for arg_8, arg_9 in arg_3:\n    plot_weights(arg_8, arg_9,\n                 alpha=1./np.sqrt(len(arg_3)),\n                 lw=1, color=\"blue\")\n\n  if arg_2 is not None:\n    plot_weights(*arg_2, lw=4,\n                 color=\"green\", label=\"true separator\")\n\n  arg_7.set_xlim([-1.5, 1.5])\n  arg_7.set_ylim([-1.5, 1.5])\n  arg_7.legend()\n\n  arg_6.print_figure(arg_4, format=\"png\")\n  print(\"saved {}\".format(arg_4))", "path": "tensorflow_probability/examples/logistic_regression.py", "identifier": "visualize_decision", "docstring": "Utility method to visualize decision boundaries in R^2.\n\n  Args:\n    features: Input points, as a Numpy `array` of shape `[num_examples, 2]`.\n    labels: Numpy `float`-like array of shape `[num_examples, 1]` giving a\n      label for each point.\n    true_w_b: A `tuple` `(w, b)` where `w` is a Numpy array of\n       shape `[2]` and `b` is a scalar `float`, interpreted as a\n       decision rule of the form `dot(features, w) + b > 0`.\n    candidate_w_bs: Python `iterable` containing tuples of the same form as\n       true_w_b.\n    fname: The filename to save the plot as a PNG image (Python `str`).", "docstring_tokens": ["Utility", "method", "to", "visualize", "decision", "boundaries", "in", "R^2", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254281}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py#L496-L504", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Given a prompt number, returns an HTML In prompt.", "language": "python", "parameters": "(self, number)", "return_statement": "return '<span class=\"in-prompt\">%s</span>' % body", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "in_prompt", "%", "arg_1", "except", "TypeError", ":", "arg_2", "=", "arg_0", ".", "in_prompt", "return", "'<span class=\"in-prompt\">%s</span>'", "%", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Given a prompt number, returns an HTML In prompt.\n        \"\"\"\n        try:\n            arg_2 = arg_0.in_prompt % arg_1\n        except TypeError:\n            # allow in_prompt to leave out number, e.g. '>>> '\n            arg_2 = arg_0.in_prompt\n        return '<span class=\"in-prompt\">%s</span>' % arg_2", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py", "identifier": "IPythonWidget._make_in_prompt", "docstring": "Given a prompt number, returns an HTML In prompt.", "docstring_tokens": ["Given", "a", "prompt", "number", "returns", "an", "HTML", "In", "prompt", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254282}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/deps.py#L67-L72", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Update a python package using pip", "language": "python", "parameters": "(self, package)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "'Upgrading '", "+", "arg_1", ")", "shell", ".", "run", "(", "arg_0", ".", "pip_path", ",", "'install'", ",", "'--Func'", ",", "'--no-deps'", ",", "arg_1", ")", "shell", ".", "run", "(", "arg_0", ".", "pip_path", ",", "'install'", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''Update a python package using pip'''\n\n        logger.debug('Upgrading ' + arg_1)\n        shell.run(arg_0.pip_path, 'install', '--Func', '--no-deps', arg_1)\n        shell.run(arg_0.pip_path, 'install', arg_1)", "path": "cpenv/deps.py", "identifier": "Pip.upgrade", "docstring": "Update a python package using pip", "docstring_tokens": ["Update", "a", "python", "package", "using", "pip"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 254283}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L538-L568", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Given a format string, return an iterator\n    of all the valid format fields. It handles nested fields\n    as well.", "language": "python", "parameters": "(format_string)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Iterable", "[", "Optional", "[", "str", "]", "]", ":", "arg_1", "=", "string", ".", "Formatter", "(", ")", "try", ":", "arg_2", "=", "arg_1", ".", "parse", "(", "arg_0", ")", "for", "arg_3", "in", "arg_2", ":", "if", "all", "(", "arg_4", "is", "None", "for", "arg_4", "in", "arg_3", "[", "1", ":", "]", ")", ":", "continue", "arg_5", "=", "arg_3", "[", "1", "]", "arg_6", "=", "arg_3", "[", "2", "]", "yield", "arg_5", "if", "arg_6", ":", "for", "arg_7", "in", "Func", "(", "arg_6", ")", ":", "yield", "arg_7", "except", "ValueError", "as", "exc", ":", "if", "exc", ".", "args", "[", "0", "]", ".", "startswith", "(", "\"cannot switch from manual\"", ")", ":", "yield", "\"\"", "yield", "\"1\"", "return", "raise", "IncompleteFormatString", "(", "arg_0", ")"], "function": "def Func(arg_0) -> Iterable[Optional[str]]:\n    \"\"\" Given a format string, return an iterator\n    of all the valid format fields. It handles nested fields\n    as well.\n    \"\"\"\n    arg_1 = string.Formatter()\n    try:\n        arg_2 = arg_1.parse(arg_0)\n        for arg_3 in arg_2:\n            if all(arg_4 is None for arg_4 in arg_3[1:]):\n                # not a replacement format\n                continue\n            arg_5 = arg_3[1]\n            arg_6 = arg_3[2]\n            yield arg_5\n            if arg_6:\n                for arg_7 in Func(arg_6):\n                    yield arg_7\n    except ValueError as exc:\n        # Probably the format string is invalid.\n        if exc.args[0].startswith(\"cannot switch from manual\"):\n            # On Jython, parsing a string with both manual\n            # and automatic positions will fail with a ValueError,\n            # while on CPython it will simply return the fields,\n            # the validation being done in the interpreter (?).\n            # We're just returning two mixed fields in order\n            # to trigger the format-combined-specification check.\n            yield \"\"\n            yield \"1\"\n            return\n        raise IncompleteFormatString(arg_0)", "path": "pylint/checkers/utils.py", "identifier": "collect_string_fields", "docstring": "Given a format string, return an iterator\n    of all the valid format fields. It handles nested fields\n    as well.", "docstring_tokens": ["Given", "a", "format", "string", "return", "an", "iterator", "of", "all", "the", "valid", "format", "fields", ".", "It", "handles", "nested", "fields", "as", "well", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254284}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L246-L250", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Get all the heron lib jars with the absolute paths", "language": "python", "parameters": "(local_jars)", "return_statement": "return heron_libs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_heron_lib_dir", "(", ")", "arg_2", "=", "[", "os", ".", "path", ".", "join", "(", "arg_1", ",", "f", ")", "for", "f", "in", "arg_0", "]", "return", "arg_2"], "function": "def Func(arg_0):\n  \"\"\"Get all the heron lib jars with the absolute paths\"\"\"\n  arg_1 = get_heron_lib_dir()\n  arg_2 = [os.path.join(arg_1, f) for f in arg_0]\n  return arg_2", "path": "heron/tools/common/src/python/utils/config.py", "identifier": "get_heron_libs", "docstring": "Get all the heron lib jars with the absolute paths", "docstring_tokens": ["Get", "all", "the", "heron", "lib", "jars", "with", "the", "absolute", "paths"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254285}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/crypto/signing.py#L316-L334", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Prepares the hash sponge for the generator.", "language": "python", "parameters": "(self, index)", "return_statement": "return sponge", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "seed_as_trits", "[", ":", "]", "arg_3", "=", "Kerl", "(", ")", "arg_3", ".", "absorb", "(", "add_trits", "(", "arg_2", ",", "trits_from_int", "(", "arg_1", ")", ")", ")", "arg_3", ".", "squeeze", "(", "arg_2", ")", "arg_3", ".", "reset", "(", ")", "arg_3", ".", "absorb", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        # type: (int) -> Kerl\n        \"\"\"\n        Prepares the hash sponge for the generator.\n        \"\"\"\n        arg_2 = arg_0.seed_as_trits[:]\n\n        arg_3 = Kerl()\n        arg_3.absorb(add_trits(arg_2, trits_from_int(arg_1)))\n\n        # Squeeze all of the trits out of the sponge and re-absorb them.\n        # Note that the sponge transforms several times per operation,\n        # so this sequence is not as redundant as it looks at first\n        # glance.\n        arg_3.squeeze(arg_2)\n        arg_3.reset()\n        arg_3.absorb(arg_2)\n\n        return arg_3", "path": "iota/crypto/signing.py", "identifier": "KeyIterator._create_sponge", "docstring": "Prepares the hash sponge for the generator.", "docstring_tokens": ["Prepares", "the", "hash", "sponge", "for", "the", "generator", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 254286}
{"url": "https://github.com/laplacesdemon/django-youtube/blob/8051ef372473eccb053f773c68e2e5e1b2cfb538/django_youtube/api.py#L108-L127", "sha": "8051ef372473eccb053f773c68e2e5e1b2cfb538", "docstring_summary": "Authenticates the user and sets the GData Auth token.\n        All params are optional, if not set, we will use the ones on the settings, if no settings found, raises AttributeError\n        params are email, password and source. Source is the app id", "language": "python", "parameters": "(self, email=None, password=None, source=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "from", "gdata", ".", "service", "import", "BadAuthentication", "arg_4", ".", "yt_service", ".", "email", "=", "arg_1", "if", "arg_1", "else", "settings", ".", "YOUTUBE_AUTH_EMAIL", "arg_4", ".", "yt_service", ".", "password", "=", "arg_2", "if", "arg_2", "else", "settings", ".", "YOUTUBE_AUTH_PASSWORD", "arg_4", ".", "yt_service", ".", "source", "=", "arg_3", "if", "arg_3", "else", "settings", ".", "YOUTUBE_CLIENT_ID", "try", ":", "arg_4", ".", "yt_service", ".", "ProgrammaticLogin", "(", ")", "arg_0", ".", "Funcd", "=", "True", "except", "BadAuthentication", ":", "raise", "ApiError", "(", "_", "(", "\"Incorrect username or password\"", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"\n        Authenticates the user and sets the GData Auth token.\n        All params are optional, if not set, we will use the ones on the settings, if no settings found, raises AttributeError\n        params are email, password and source. Source is the app id\n\n        Raises:\n            gdata.service.exceptions.BadAuthentication\n        \"\"\"\n        from gdata.service import BadAuthentication\n\n        # Auth parameters\n        arg_4.yt_service.email = arg_1 if arg_1 else settings.YOUTUBE_AUTH_EMAIL\n        arg_4.yt_service.password = arg_2 if arg_2 else settings.YOUTUBE_AUTH_PASSWORD\n        arg_4.yt_service.source = arg_3 if arg_3 else settings.YOUTUBE_CLIENT_ID\n        try:\n            arg_4.yt_service.ProgrammaticLogin()\n            arg_0.Funcd = True\n        except BadAuthentication:\n            raise ApiError(_(\"Incorrect username or password\"))", "path": "django_youtube/api.py", "identifier": "Api.authenticate", "docstring": "Authenticates the user and sets the GData Auth token.\n        All params are optional, if not set, we will use the ones on the settings, if no settings found, raises AttributeError\n        params are email, password and source. Source is the app id\n\n        Raises:\n            gdata.service.exceptions.BadAuthentication", "docstring_tokens": ["Authenticates", "the", "user", "and", "sets", "the", "GData", "Auth", "token", ".", "All", "params", "are", "optional", "if", "not", "set", "we", "will", "use", "the", "ones", "on", "the", "settings", "if", "no", "settings", "found", "raises", "AttributeError", "params", "are", "email", "password", "and", "source", ".", "Source", "is", "the", "app", "id"], "nwo": "laplacesdemon/django-youtube", "score": 0.19379564659824008, "idx": 254287}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L120-L152", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Returns an example image and its imagenet class label.", "language": "python", "parameters": "(shape=(224, 224), data_format='channels_last')", "return_statement": "return image, 282", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "(", "224", ",", "224", ")", ",", "arg_1", "=", "'channels_last'", ")", ":", "assert", "len", "(", "arg_0", ")", "==", "2", "assert", "arg_1", "in", "[", "'channels_first'", ",", "'channels_last'", "]", "from", "PIL", "import", "Image", "arg_2", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'example.png'", ")", "arg_3", "=", "Image", ".", "open", "(", "arg_2", ")", "arg_3", "=", "arg_3", ".", "resize", "(", "arg_0", ")", "arg_3", "=", "np", ".", "asarray", "(", "arg_3", ",", "dtype", "=", "np", ".", "float32", ")", "arg_3", "=", "arg_3", "[", ":", ",", ":", ",", ":", "3", "]", "assert", "arg_3", ".", "shape", "==", "arg_0", "+", "(", "3", ",", ")", "if", "arg_1", "==", "'channels_first'", ":", "arg_3", "=", "np", ".", "transpose", "(", "arg_3", ",", "(", "2", ",", "0", ",", "1", ")", ")", "return", "arg_3", ",", "282"], "function": "def Func(arg_0=(224, 224), arg_1='channels_last'):\n    \"\"\" Returns an example image and its imagenet class label.\n\n    Parameters\n    ----------\n    shape : list of integers\n        The shape of the returned image.\n    data_format : str\n        \"channels_first\" or \"channels_last\"\n\n    Returns\n    -------\n    image : array_like\n        The example image.\n\n    label : int\n        The imagenet label associated with the image.\n\n    NOTE: This function is deprecated and will be removed in the future.\n    \"\"\"\n    assert len(arg_0) == 2\n    assert arg_1 in ['channels_first', 'channels_last']\n\n    from PIL import Image\n    arg_2 = os.path.join(os.path.dirname(__file__), 'example.png')\n    arg_3 = Image.open(arg_2)\n    arg_3 = arg_3.resize(arg_0)\n    arg_3 = np.asarray(arg_3, dtype=np.float32)\n    arg_3 = arg_3[:, :, :3]\n    assert arg_3.shape == arg_0 + (3,)\n    if arg_1 == 'channels_first':\n        arg_3 = np.transpose(arg_3, (2, 0, 1))\n    return arg_3, 282", "path": "foolbox/utils.py", "identifier": "imagenet_example", "docstring": "Returns an example image and its imagenet class label.\n\n    Parameters\n    ----------\n    shape : list of integers\n        The shape of the returned image.\n    data_format : str\n        \"channels_first\" or \"channels_last\"\n\n    Returns\n    -------\n    image : array_like\n        The example image.\n\n    label : int\n        The imagenet label associated with the image.\n\n    NOTE: This function is deprecated and will be removed in the future.", "docstring_tokens": ["Returns", "an", "example", "image", "and", "its", "imagenet", "class", "label", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 254288}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/widgets.py#L114-L121", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Returns data from each field.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "fields", ":", "arg_1", "[", "arg_2", ".", "name", "]", "=", "arg_0", ".", "data", ".", "get", "(", "arg_2", ".", "name", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns data from each field.\"\"\"\n        arg_1 = {}\n\n        for arg_2 in arg_0.fields:\n            arg_1[arg_2.name] = arg_0.data.get(arg_2.name)\n\n        return arg_1", "path": "dispatch/theme/widgets.py", "identifier": "Widget.get_data", "docstring": "Returns data from each field.", "docstring_tokens": ["Returns", "data", "from", "each", "field", "."], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 254289}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L2180-L2218", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Updates the `run_information` of the current trajectory.", "language": "python", "parameters": "(self, other_trajectory, used_runs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "len", "(", "arg_0", ")", "arg_4", "=", "range", "(", "len", "(", "arg_1", ")", ")", "arg_5", "=", "OrderedDict", "(", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_4", ":", "if", "arg_7", "in", "arg_2", ":", "arg_8", "=", "arg_1", ".", "f_get_run_information", "(", "arg_7", ")", "arg_9", "=", "arg_8", "[", "'time'", "]", "arg_10", "=", "arg_8", "[", "'timestamp'", "]", "arg_11", "=", "arg_8", "[", "'completed'", "]", "arg_12", "=", "arg_8", "[", "'short_environment_hexsha'", "]", "arg_13", "=", "arg_8", "[", "'finish_timestamp'", "]", "arg_14", "=", "arg_8", "[", "'runtime'", "]", "arg_15", "=", "arg_2", "[", "arg_7", "]", "arg_16", "=", "arg_0", ".", "f_wildcard", "(", "'$'", ",", "arg_15", ")", "arg_5", "[", "arg_7", "]", "=", "arg_16", "arg_17", "=", "dict", "(", "arg_7", "=", "arg_15", ",", "time", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ")", "arg_0", ".", "_add_run_info", "(", "**", "arg_17", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"  Updates the `run_information` of the current trajectory.\"\"\"\n        arg_3 = len(arg_0)  # Variable to count the increasing new run indices and create\n        # new run names\n\n        arg_4 = range(len(arg_1))\n\n        arg_5 = OrderedDict()\n\n        arg_6 = []\n\n        for arg_7 in arg_4:\n            # Iterate through all used runs and store annotated groups and mark results and\n            # derived parameters for merging\n            if arg_7 in arg_2:\n                # Update the run information dict of the current trajectory\n                arg_8 = arg_1.f_get_run_information(arg_7)\n                arg_9 = arg_8['time']\n                arg_10 = arg_8['timestamp']\n                arg_11 = arg_8['completed']\n                arg_12 = arg_8['short_environment_hexsha']\n                arg_13 = arg_8['finish_timestamp']\n                arg_14 = arg_8['runtime']\n\n                arg_15 = arg_2[arg_7]\n                arg_16 = arg_0.f_wildcard('$', arg_15)\n\n                arg_5[arg_7] = arg_16\n\n                arg_17 = dict(\n                    arg_7=arg_15,\n                    time=arg_9,\n                    arg_10=arg_10,\n                    arg_11=arg_11,\n                    arg_12=arg_12,\n                    arg_13=arg_13,\n                    arg_14=arg_14)\n\n                arg_0._add_run_info(**arg_17)", "path": "pypet/trajectory.py", "identifier": "Trajectory._merge_single_runs", "docstring": "Updates the `run_information` of the current trajectory.", "docstring_tokens": ["Updates", "the", "run_information", "of", "the", "current", "trajectory", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254290}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Console/screen.py#L16-L47", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Gets width and height of terminal viewport", "language": "python", "parameters": "()", "return_statement": "return int(sizes[1]), int(sizes[0])", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "(", "30", ",", "120", ")", "arg_1", "=", "os", ".", "environ", "def", "ioctl_gwinsz", "(", "arg_2", ")", ":", "try", ":", "arg_3", "=", "struct", ".", "unpack", "(", "'hh'", ",", "fcntl", ".", "ioctl", "(", "arg_2", ",", "termios", ".", "TIOCGWINSZ", ",", "'1234'", ")", ")", "except", "Exception", ":", "arg_3", "=", "arg_0", "return", "arg_3", "arg_3", "=", "ioctl_gwinsz", "(", "0", ")", "or", "ioctl_gwinsz", "(", "1", ")", "or", "ioctl_gwinsz", "(", "2", ")", "if", "not", "arg_3", ":", "try", ":", "arg_2", "=", "os", ".", "open", "(", "os", ".", "ctermid", "(", ")", ",", "os", ".", "O_RDONLY", ")", "arg_3", "=", "ioctl_gwinsz", "(", "arg_2", ")", "os", ".", "close", "(", "arg_2", ".", "fileno", "(", ")", ")", "except", "Exception", ":", "pass", "if", "not", "arg_3", ":", "try", ":", "arg_3", "=", "(", "arg_1", "[", "'LINES'", "]", ",", "arg_1", "[", "'COLUMNS'", "]", ")", "except", "Exception", ":", "arg_3", "=", "arg_0", "return", "int", "(", "arg_3", "[", "1", "]", ")", ",", "int", "(", "arg_3", "[", "0", "]", ")"], "function": "def Func():\n    '''\n    Gets width and height of terminal viewport\n    '''\n    arg_0 = (30, 120)\n    arg_1 = os.environ\n\n    def ioctl_gwinsz(arg_2):\n        '''\n        Helper to get console size\n        '''\n        try:\n            arg_3 = struct.unpack(\n                'hh', fcntl.ioctl(arg_2, termios.TIOCGWINSZ, '1234'))\n        except Exception:\n            arg_3 = arg_0\n        return arg_3\n\n    arg_3 = ioctl_gwinsz(0) or ioctl_gwinsz(1) or ioctl_gwinsz(2)\n    if not arg_3:\n        try:\n            arg_2 = os.open(os.ctermid(), os.O_RDONLY)\n            arg_3 = ioctl_gwinsz(arg_2)\n            os.close(arg_2.fileno())\n        except Exception:\n            pass\n    if not arg_3:\n        try:\n            arg_3 = (arg_1['LINES'], arg_1['COLUMNS'])\n        except Exception:\n            arg_3 = arg_0\n    return int(arg_3[1]), int(arg_3[0])", "path": "yandextank/plugins/Console/screen.py", "identifier": "get_terminal_size", "docstring": "Gets width and height of terminal viewport", "docstring_tokens": ["Gets", "width", "and", "height", "of", "terminal", "viewport"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 254291}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L87-L152", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "An intelligent wrapper for ``open``.", "language": "python", "parameters": "(name_or_fdesc, mode='r', fmt='auto')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'r'", ",", "arg_2", "=", "'auto'", ")", ":", "arg_3", "=", "{", "'jams'", ":", "open", ",", "'json'", ":", "open", ",", "'jamz'", ":", "gzip", ".", "open", ",", "'gz'", ":", "gzip", ".", "open", "}", "if", "hasattr", "(", "arg_0", ",", "'read'", ")", "or", "hasattr", "(", "arg_0", ",", "'write'", ")", ":", "yield", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "if", "arg_2", "==", "'auto'", ":", "arg_4", ",", "arg_5", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "arg_5", "=", "arg_5", "[", "1", ":", "]", "else", ":", "arg_5", "=", "arg_2", "try", ":", "arg_5", "=", "arg_5", ".", "lower", "(", ")", "if", "arg_5", "in", "[", "'jamz'", ",", "'gz'", "]", "and", "'t'", "not", "in", "arg_1", ":", "arg_1", "=", "'{:s}t'", ".", "format", "(", "arg_1", ")", "with", "arg_3", "[", "arg_5", "]", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "as", "fdesc", ":", "yield", "fdesc", "except", "KeyError", ":", "raise", "ParameterError", "(", "'Unknown JAMS extension '", "'format: \"{:s}\"'", ".", "format", "(", "arg_5", ")", ")", "else", ":", "raise", "ParameterError", "(", "'Invalid filename or '", "'descriptor: {}'", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1='r', arg_2='auto'):\n    '''An intelligent wrapper for ``open``.\n\n    Parameters\n    ----------\n    name_or_fdesc : string-type or open file descriptor\n        If a string type, refers to the path to a file on disk.\n\n        If an open file descriptor, it is returned as-is.\n\n    mode : string\n        The mode with which to open the file.\n        See ``open`` for details.\n\n    fmt : string ['auto', 'jams', 'json', 'jamz']\n        The encoding for the input/output stream.\n\n        If `auto`, the format is inferred from the filename extension.\n\n        Otherwise, use the specified coding.\n\n\n    See Also\n    --------\n    open\n    gzip.open\n    '''\n\n    arg_3 = {'jams': open,\n                'json': open,\n                'jamz': gzip.open,\n                'gz': gzip.open}\n\n    # If we've been given an open descriptor, do the right thing\n    if hasattr(arg_0, 'read') or hasattr(arg_0, 'write'):\n        yield arg_0\n\n    elif isinstance(arg_0, six.string_types):\n        # Infer the opener from the extension\n\n        if arg_2 == 'auto':\n            arg_4, arg_5 = os.path.splitext(arg_0)\n\n            # Pull off the extension separator\n            arg_5 = arg_5[1:]\n        else:\n            arg_5 = arg_2\n\n        try:\n            arg_5 = arg_5.lower()\n\n            # Force text mode if we're using gzip\n            if arg_5 in ['jamz', 'gz'] and 't' not in arg_1:\n                arg_1 = '{:s}t'.format(arg_1)\n\n            with arg_3[arg_5](arg_0, arg_1=arg_1) as fdesc:\n                yield fdesc\n\n        except KeyError:\n            raise ParameterError('Unknown JAMS extension '\n                                 'format: \"{:s}\"'.format(arg_5))\n\n    else:\n        # Don't know how to handle this. Raise a parameter error\n        raise ParameterError('Invalid filename or '\n                             'descriptor: {}'.format(arg_0))", "path": "jams/core.py", "identifier": "_open", "docstring": "An intelligent wrapper for ``open``.\n\n    Parameters\n    ----------\n    name_or_fdesc : string-type or open file descriptor\n        If a string type, refers to the path to a file on disk.\n\n        If an open file descriptor, it is returned as-is.\n\n    mode : string\n        The mode with which to open the file.\n        See ``open`` for details.\n\n    fmt : string ['auto', 'jams', 'json', 'jamz']\n        The encoding for the input/output stream.\n\n        If `auto`, the format is inferred from the filename extension.\n\n        Otherwise, use the specified coding.\n\n\n    See Also\n    --------\n    open\n    gzip.open", "docstring_tokens": ["An", "intelligent", "wrapper", "for", "open", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 254292}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L740-L762", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper which tries to return a static value.", "language": "python", "parameters": "(x, dtype=None)", "return_statement": "return np.array(x_, dtype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "return", "arg_0", "try", ":", "arg_2", "=", "tf", ".", "get_static_value", "(", "arg_0", ")", "except", "TypeError", ":", "arg_2", "=", "arg_0", "if", "arg_2", "is", "None", "or", "arg_1", "is", "None", ":", "return", "arg_2", "return", "np", ".", "array", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"Helper which tries to return a static value.\n\n  Given `x`, extract it's value statically, optionally casting to a specific\n  dtype. If this is not possible, None is returned.\n\n  Args:\n    x: `Tensor` for which to extract a value statically.\n    dtype: Optional dtype to cast to.\n\n  Returns:\n    Statically inferred value if possible, otherwise None.\n  \"\"\"\n  if arg_0 is None:\n    return arg_0\n  try:\n    # This returns an np.ndarray.\n    arg_2 = tf.get_static_value(arg_0)\n  except TypeError:\n    arg_2 = arg_0\n  if arg_2 is None or arg_1 is None:\n    return arg_2\n  return np.array(arg_2, arg_1)", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "maybe_get_static_value", "docstring": "Helper which tries to return a static value.\n\n  Given `x`, extract it's value statically, optionally casting to a specific\n  dtype. If this is not possible, None is returned.\n\n  Args:\n    x: `Tensor` for which to extract a value statically.\n    dtype: Optional dtype to cast to.\n\n  Returns:\n    Statically inferred value if possible, otherwise None.", "docstring_tokens": ["Helper", "which", "tries", "to", "return", "a", "static", "value", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254293}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L346-L360", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Build the String instance", "language": "python", "parameters": "(self, pre=None, shortest=False)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "]", "if", "arg_0", ".", "value", "is", "not", "None", "and", "rand", ".", "maybe", "(", ")", ":", "return", "utils", ".", "val", "(", "arg_0", ".", "value", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_3", "=", "super", "(", "String", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "rand", ".", "data", "(", "arg_3", ",", "arg_0", ".", "charset", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"Build the String instance\n\n        :param list pre: The prerequisites list (optional, default=None)\n        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = []\n\n        if arg_0.value is not None and rand.maybe():\n            return utils.val(arg_0.value, arg_1, arg_2=arg_2)\n\n        arg_3 = super(String, arg_0).Func(arg_1, arg_2=arg_2)\n        arg_4 = rand.data(arg_3, arg_0.charset)\n        return arg_4", "path": "gramfuzz/gramfuzz/fields.py", "identifier": "String.build", "docstring": "Build the String instance\n\n        :param list pre: The prerequisites list (optional, default=None)\n        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.", "docstring_tokens": ["Build", "the", "String", "instance"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 254294}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/benchmark.py#L198-L209", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Configure argument parser.", "language": "python", "parameters": "(cls, parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "add_argument", "(", "'--no-phenoecm'", ",", "action", "=", "'store_true'", ",", "help", "=", "'Disables the phenomenological ECM model building.'", ")", "arg_1", ".", "add_argument", "(", "'--iterations'", ",", "type", "=", "int", ",", "default", "=", "10", ",", "help", "=", "'Number of outer-loop iterations (e.g. time loop) during benchmarking. '", "'Default is 10, but actual number will be adapted to at least 0.2s runtime.'", ")", "arg_1", ".", "add_argument", "(", "'--ignore-warnings'", ",", "action", "=", "'store_true'", ",", "help", "=", "'Ignore warnings about missmatched CPU model and frequency.'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Configure argument parser.\"\"\"\n        arg_1.add_argument(\n            '--no-phenoecm', action='store_true',\n            help='Disables the phenomenological ECM model building.')\n        arg_1.add_argument(\n            '--iterations', type=int, default=10,\n            help='Number of outer-loop iterations (e.g. time loop) during benchmarking. '\n                 'Default is 10, but actual number will be adapted to at least 0.2s runtime.')\n        arg_1.add_argument(\n            '--ignore-warnings', action='store_true',\n            help='Ignore warnings about missmatched CPU model and frequency.')", "path": "kerncraft/models/benchmark.py", "identifier": "Benchmark.configure_arggroup", "docstring": "Configure argument parser.", "docstring_tokens": ["Configure", "argument", "parser", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 254295}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/CCP4.py#L267-L314", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Read header bytes", "language": "python", "parameters": "(self, ccp4file)", "return_statement": "return header", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_detect_byteorder", "(", "arg_1", ")", "arg_3", "=", "struct", ".", "calcsize", "(", "arg_0", ".", "_headerfmt", ")", "arg_4", "=", "[", "r", ".", "key", "for", "r", "in", "arg_0", ".", "_header_struct", "]", "arg_5", "=", "arg_1", ".", "read", "(", "25", "*", "4", ")", "def", "decode_header", "(", "arg_6", ",", "arg_2", "=", "'@'", ")", ":", "arg_7", "=", "dict", "(", "zip", "(", "arg_4", ",", "struct", ".", "unpack", "(", "arg_2", "+", "arg_0", ".", "_headerfmt", ",", "arg_6", ")", ")", ")", "arg_7", "[", "'bsaflag'", "]", "=", "arg_2", "return", "arg_7", "arg_6", "=", "decode_header", "(", "arg_5", ",", "arg_2", ")", "for", "arg_8", "in", "arg_0", ".", "_header_struct", ":", "if", "not", "arg_8", ".", "is_legal_dict", "(", "arg_6", ")", ":", "warnings", ".", "warn", "(", "\"Key %s: Illegal value %r\"", "%", "(", "arg_8", ".", "key", ",", "arg_6", "[", "arg_8", ".", "key", "]", ")", ")", "if", "(", "arg_6", "[", "'lskflg'", "]", ")", ":", "arg_9", "=", "np", ".", "fromfile", "(", "arg_1", ",", "dtype", "=", "np", ".", "float32", ",", "count", "=", "9", ")", "arg_6", "[", "'skwmat'", "]", "=", "arg_9", ".", "reshape", "(", "(", "3", ",", "3", ")", ")", "arg_6", "[", "'skwtrn'", "]", "=", "np", ".", "fromfile", "(", "arg_1", ",", "dtype", "=", "np", ".", "float32", ",", "count", "=", "3", ")", "else", ":", "arg_6", "[", "'skwmat'", "]", "=", "arg_6", "[", "'skwtrn'", "]", "=", "None", "arg_1", ".", "seek", "(", "12", "*", "4", ",", "1", ")", "arg_1", ".", "seek", "(", "15", "*", "4", ",", "1", ")", "arg_1", ".", "seek", "(", "4", ",", "1", ")", "arg_10", "=", "struct", ".", "unpack", "(", "arg_2", "+", "'4b'", ",", "arg_1", ".", "read", "(", "4", ")", ")", "arg_6", "[", "'endianness'", "]", "=", "'little'", "if", "arg_10", "==", "(", "0x44", ",", "0x41", ",", "0", ",", "0", ")", "else", "'big'", "arg_6", "[", "'arms'", "]", "=", "struct", ".", "unpack", "(", "arg_2", "+", "'f'", ",", "arg_1", ".", "read", "(", "4", ")", ")", "[", "0", "]", "arg_6", "[", "'nlabl'", "]", "=", "struct", ".", "unpack", "(", "arg_2", "+", "'I'", ",", "arg_1", ".", "read", "(", "4", ")", ")", "[", "0", "]", "if", "arg_6", "[", "'nlabl'", "]", ":", "arg_11", "=", "arg_1", ".", "read", "(", "80", "*", "arg_6", "[", "'nlabl'", "]", ")", "arg_12", "=", "arg_2", "+", "str", "(", "80", "*", "arg_6", "[", "'nlabl'", "]", ")", "+", "'s'", "arg_13", "=", "struct", ".", "unpack", "(", "arg_12", ",", "arg_11", ")", "[", "0", "]", "arg_6", "[", "'label'", "]", "=", "arg_13", ".", "decode", "(", "'utf-8'", ")", ".", "rstrip", "(", "'\\x00'", ")", "else", ":", "arg_6", "[", "'label'", "]", "=", "None", "arg_1", ".", "seek", "(", "256", "*", "4", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read header bytes\"\"\"\n\n        arg_2 = arg_0._detect_byteorder(arg_1)\n\n        # Parse the top of the header (4-byte words, 1 to 25).\n        arg_3 = struct.calcsize(arg_0._headerfmt)\n        arg_4 = [r.key for r in arg_0._header_struct]\n        arg_5 = arg_1.read(25 * 4)\n\n        def decode_header(arg_6, arg_2='@'):\n            arg_7 = dict(zip(arg_4, struct.unpack(arg_2 + arg_0._headerfmt,\n                                              arg_6)))\n            arg_7['bsaflag'] = arg_2\n            return arg_7\n\n        arg_6 = decode_header(arg_5, arg_2)\n        for arg_8 in arg_0._header_struct:\n            if not arg_8.is_legal_dict(arg_6):\n                warnings.warn(\n                    \"Key %s: Illegal value %r\" % (arg_8.key, arg_6[arg_8.key]))\n\n        # Parse the latter half of the header (4-byte words, 26 to 256).\n        if (arg_6['lskflg']):\n            arg_9 = np.fromfile(arg_1, dtype=np.float32, count=9)\n            arg_6['skwmat'] = arg_9.reshape((3, 3))\n            arg_6['skwtrn'] = np.fromfile(arg_1, dtype=np.float32, count=3)\n        else:\n            arg_6['skwmat'] = arg_6['skwtrn'] = None\n            arg_1.seek(12 * 4, 1)\n        arg_1.seek(15 * 4, 1)  # Skip future use section.\n        arg_1.seek(4, 1)  # Skip map text, already used above to verify format.\n        # TODO: Compare file specified endianness to one obtained above.\n        arg_10 = struct.unpack(arg_2 + '4b', arg_1.read(4))\n        arg_6['endianness'] = 'little' if arg_10 == (0x44, 0x41, 0, 0\n                                                          ) else 'big'\n        arg_6['arms'] = struct.unpack(arg_2 + 'f', arg_1.read(4))[0]\n        arg_6['nlabl'] = struct.unpack(arg_2 + 'I', arg_1.read(4))[0]\n        if arg_6['nlabl']:\n            arg_11 = arg_1.read(80 * arg_6['nlabl'])\n            arg_12 = arg_2 + str(80 * arg_6['nlabl']) + 's'\n            arg_13 = struct.unpack(arg_12, arg_11)[0]\n            arg_6['label'] = arg_13.decode('utf-8').rstrip('\\x00')\n        else:\n            arg_6['label'] = None\n        arg_1.seek(256 * 4)\n        # TODO: Parse symmetry records, if any.\n        return arg_6", "path": "gridData/CCP4.py", "identifier": "CCP4._read_header", "docstring": "Read header bytes", "docstring_tokens": ["Read", "header", "bytes"], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 254296}
{"url": "https://github.com/ChrisBeaumont/soupy/blob/795f2f61f711f574d5218fc8a3375d02bda1104f/soupy.py#L608-L627", "sha": "795f2f61f711f574d5218fc8a3375d02bda1104f", "docstring_summary": "Return a new Collection with the last few items removed.", "language": "python", "parameters": "(self, func=None)", "return_statement": "return Collection(takewhile(func, self._items))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "_make_callable", "(", "arg_1", ")", "return", "Collection", "(", "Func", "(", "arg_1", ",", "arg_0", ".", "_items", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Return a new Collection with the last few items removed.\n\n        Parameters:\n\n            func : function(Node) -> Node\n\n        Returns:\n\n            A new Collection, discarding all items\n            at and after the first item where bool(func(item)) == False\n\n        Examples:\n\n            node.find_all('tr').Func(Q.find_all('td').count() > 3)\n\n        \"\"\"\n        arg_1 = _make_callable(arg_1)\n        return Collection(Func(arg_1, arg_0._items))", "path": "soupy.py", "identifier": "Collection.takewhile", "docstring": "Return a new Collection with the last few items removed.\n\n        Parameters:\n\n            func : function(Node) -> Node\n\n        Returns:\n\n            A new Collection, discarding all items\n            at and after the first item where bool(func(item)) == False\n\n        Examples:\n\n            node.find_all('tr').takewhile(Q.find_all('td').count() > 3)", "docstring_tokens": ["Return", "a", "new", "Collection", "with", "the", "last", "few", "items", "removed", "."], "nwo": "ChrisBeaumont/soupy", "score": 0.3938996721004794, "idx": 254297}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L201-L205", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Generic subcommand value display", "language": "python", "parameters": "(obj, name)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "debugger", ".", "settings", "[", "arg_0", ".", "name", "]", "arg_0", ".", "msg", "(", "\"%s is %s.\"", "%", "(", "arg_0", ".", "name", ",", "arg_0", ".", "cmd", ".", "proc", ".", "_saferepr", "(", "arg_2", ")", ",", ")", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Generic subcommand value display\"\"\"\n    arg_2 = arg_0.debugger.settings[arg_0.name]\n    arg_0.msg(\"%s is %s.\" % (arg_0.name, arg_0.cmd.proc._saferepr(arg_2),))\n    return False", "path": "trepan/processor/cmdfns.py", "identifier": "run_show_val", "docstring": "Generic subcommand value display", "docstring_tokens": ["Generic", "subcommand", "value", "display"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 254298}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L231-L241", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Helper method that exits the dialog.\n        \n        This method will cause the previously active submenu to activate.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "prev_submenu", "is", "not", "None", ":", "arg_0", ".", "menu", ".", "changeSubMenu", "(", "arg_0", ".", "prev_submenu", ")", "arg_0", ".", "prev_submenu", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Helper method that exits the dialog.\n        \n        This method will cause the previously active submenu to activate.\n        \"\"\"\n        if arg_0.prev_submenu is not None:\n            # change back to the previous submenu\n            # could in theory form a stack if one dialog opens another\n            arg_0.menu.changeSubMenu(arg_0.prev_submenu)\n        arg_0.prev_submenu = None", "path": "peng3d/gui/menus.py", "identifier": "DialogSubMenu.exitDialog", "docstring": "Helper method that exits the dialog.\n        \n        This method will cause the previously active submenu to activate.", "docstring_tokens": ["Helper", "method", "that", "exits", "the", "dialog", ".", "This", "method", "will", "cause", "the", "previously", "active", "submenu", "to", "activate", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 254299}
{"url": "https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/toolbox.py#L217-L233", "sha": "dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe", "docstring_summary": "Imports modules from registered apps using given module name\n    and returns them as a list.", "language": "python", "parameters": "(module_name)", "return_statement": "return submodules", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "django", ".", "conf", "import", "settings", "arg_1", "=", "[", "]", "for", "arg_2", "in", "settings", ".", "INSTALLED_APPS", ":", "arg_3", "=", "import_app_module", "(", "arg_2", ",", "arg_0", ")", "if", "arg_3", "is", "not", "None", ":", "arg_1", ".", "append", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Imports modules from registered apps using given module name\n    and returns them as a list.\n\n    :param str module_name:\n    :rtype: list\n\n    \"\"\"\n    from django.conf import settings\n\n    arg_1 = []\n    for arg_2 in settings.INSTALLED_APPS:\n        arg_3 = import_app_module(arg_2, arg_0)\n        if arg_3 is not None:\n            arg_1.append(arg_3)\n\n    return arg_1", "path": "etc/toolbox.py", "identifier": "import_project_modules", "docstring": "Imports modules from registered apps using given module name\n    and returns them as a list.\n\n    :param str module_name:\n    :rtype: list", "docstring_tokens": ["Imports", "modules", "from", "registered", "apps", "using", "given", "module", "name", "and", "returns", "them", "as", "a", "list", "."], "nwo": "idlesign/django-etc", "score": 0.2643786477459777, "idx": 254300}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L132-L177", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Generate docs for message and nested messages and enums.", "language": "python", "parameters": "(message_descriptor, locations, path, name_prefix='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "''", ")", ":", "arg_4", "=", "arg_3", "+", "arg_0", ".", "name", "print", "(", "make_subsection", "(", "arg_4", ")", ")", "arg_5", "=", "arg_1", "[", "arg_2", "]", "if", "arg_5", ".", "HasField", "(", "'leading_comments'", ")", ":", "print", "(", "textwrap", ".", "dedent", "(", "arg_5", ".", "leading_comments", ")", ")", "arg_6", "=", "[", "]", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_0", ".", "field", ")", ":", "arg_9", "=", "arg_1", "[", "arg_2", "+", "(", "2", ",", "arg_7", ")", "]", "if", "arg_8", ".", "type", "not", "in", "[", "11", ",", "14", "]", ":", "arg_10", "=", "TYPE_TO_STR", "[", "arg_8", ".", "type", "]", "else", ":", "arg_10", "=", "make_link", "(", "arg_8", ".", "type_name", ".", "lstrip", "(", "'.'", ")", ")", "arg_6", ".", "append", "(", "(", "make_code", "(", "arg_8", ".", "name", ")", ",", "arg_8", ".", "number", ",", "arg_10", ",", "LABEL_TO_STR", "[", "arg_8", ".", "label", "]", ",", "textwrap", ".", "fill", "(", "get_comment_from_location", "(", "arg_9", ")", ",", "INFINITY", ")", ",", ")", ")", "print_table", "(", "(", "'Field'", ",", "'Number'", ",", "'Type'", ",", "'Label'", ",", "'Description'", ")", ",", "arg_6", ")", "arg_11", "=", "enumerate", "(", "arg_0", ".", "nested_type", ")", "for", "arg_12", ",", "arg_13", "in", "arg_11", ":", "Func", "(", "arg_13", ",", "arg_1", ",", "arg_2", "+", "(", "3", ",", "arg_12", ")", ",", "arg_3", "=", "arg_4", "+", "'.'", ")", "for", "arg_12", ",", "arg_14", "in", "enumerate", "(", "arg_0", ".", "enum_type", ")", ":", "generate_enum_doc", "(", "arg_14", ",", "arg_1", ",", "arg_2", "+", "(", "4", ",", "arg_12", ")", ",", "arg_3", "=", "arg_4", "+", "'.'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=''):\n    \"\"\"Generate docs for message and nested messages and enums.\n\n    Args:\n        message_descriptor: descriptor_pb2.DescriptorProto instance for message\n            to generate docs for.\n        locations: Dictionary of location paths tuples to\n            descriptor_pb2.SourceCodeInfo.Location instances.\n        path: Path tuple to the message definition.\n        name_prefix: Optional prefix for this message's name.\n    \"\"\"\n    # message_type is 4\n    arg_4 = arg_3 + arg_0.name\n    print(make_subsection(arg_4))\n    arg_5 = arg_1[arg_2]\n    if arg_5.HasField('leading_comments'):\n        print(textwrap.dedent(arg_5.leading_comments))\n\n    arg_6 = []\n    for arg_7, arg_8 in enumerate(arg_0.field):\n        arg_9 = arg_1[arg_2 + (2, arg_7)]\n        if arg_8.type not in [11, 14]:\n            arg_10 = TYPE_TO_STR[arg_8.type]\n        else:\n            arg_10 = make_link(arg_8.type_name.lstrip('.'))\n        arg_6.append((\n            make_code(arg_8.name),\n            arg_8.number,\n            arg_10,\n            LABEL_TO_STR[arg_8.label],\n            textwrap.fill(get_comment_from_location(arg_9), INFINITY),\n        ))\n    print_table(('Field', 'Number', 'Type', 'Label', 'Description'),\n                arg_6)\n\n    # Generate nested messages\n    arg_11 = enumerate(arg_0.nested_type)\n    for arg_12, arg_13 in arg_11:\n        Func(arg_13, arg_1,\n                             arg_2 + (3, arg_12),\n                             arg_3=arg_4 + '.')\n\n    # Generate nested enums\n    for arg_12, arg_14 in enumerate(arg_0.enum_type):\n        generate_enum_doc(arg_14, arg_1, arg_2 + (4, arg_12),\n                          arg_3=arg_4 + '.')", "path": "docs/generate_proto_docs.py", "identifier": "generate_message_doc", "docstring": "Generate docs for message and nested messages and enums.\n\n    Args:\n        message_descriptor: descriptor_pb2.DescriptorProto instance for message\n            to generate docs for.\n        locations: Dictionary of location paths tuples to\n            descriptor_pb2.SourceCodeInfo.Location instances.\n        path: Path tuple to the message definition.\n        name_prefix: Optional prefix for this message's name.", "docstring_tokens": ["Generate", "docs", "for", "message", "and", "nested", "messages", "and", "enums", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 254301}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/sequences.py#L580-L582", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Returns Fastq object with the same name, of the bases from start to end, but not including end", "language": "python", "parameters": "(self, start, end)", "return_statement": "return Fastq(self.id, self.seq[start:end], self.qual[start:end])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "Fastq", "(", "arg_0", ".", "id", ",", "arg_0", ".", "seq", "[", "arg_1", ":", "arg_2", "]", ",", "arg_0", ".", "qual", "[", "arg_1", ":", "arg_2", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Returns Fastq object with the same name, of the bases from start to end, but not including end'''\n        return Fastq(arg_0.id, arg_0.seq[arg_1:arg_2], arg_0.qual[arg_1:arg_2])", "path": "pyfastaq/sequences.py", "identifier": "Fastq.subseq", "docstring": "Returns Fastq object with the same name, of the bases from start to end, but not including end", "docstring_tokens": ["Returns", "Fastq", "object", "with", "the", "same", "name", "of", "the", "bases", "from", "start", "to", "end", "but", "not", "including", "end"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 254302}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/minidom_utils.py#L65-L73", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Recursively extract all text from node.", "language": "python", "parameters": "(node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "nodeType", "==", "arg_0", ".", "TEXT_NODE", ":", "return", "arg_0", ".", "data", "else", ":", "arg_1", "=", "\"\"", "for", "arg_2", "in", "arg_0", ".", "childNodes", ":", "arg_1", "+=", "Func", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Recursively extract all text from node.\"\"\"\n    if arg_0.nodeType == arg_0.TEXT_NODE:\n        return arg_0.data\n    else:\n        arg_1 = \"\"\n        for arg_2 in arg_0.childNodes:\n            arg_1 += Func(arg_2)\n        return arg_1", "path": "harvestingkit/minidom_utils.py", "identifier": "get_all_text", "docstring": "Recursively extract all text from node.", "docstring_tokens": ["Recursively", "extract", "all", "text", "from", "node", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 254303}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py#L34-L46", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Turn a function into a remote function.", "language": "python", "parameters": "(view, block=None, **flags)", "return_statement": "return remote_function", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "def", "Func_function", "(", "arg_3", ")", ":", "return", "RemoteFunction", "(", "arg_0", ",", "arg_3", ",", "arg_1", "=", "arg_1", ",", "**", "arg_2", ")", "return", "Func_function"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"Turn a function into a Func function.\n\n    This method can be used for map:\n\n    In [1]: @Func(view,block=True)\n       ...: def func(a):\n       ...:    pass\n    \"\"\"\n\n    def Func_function(arg_3):\n        return RemoteFunction(arg_0, arg_3, arg_1=arg_1, **arg_2)\n    return Func_function", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py", "identifier": "remote", "docstring": "Turn a function into a remote function.\n\n    This method can be used for map:\n\n    In [1]: @remote(view,block=True)\n       ...: def func(a):\n       ...:    pass", "docstring_tokens": ["Turn", "a", "function", "into", "a", "remote", "function", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254304}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/common/mixins.py#L307-L319", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Create a Client from a Service Bus connection string.", "language": "python", "parameters": "(cls, conn_str, name=None, **kwargs)", "return_statement": "return cls(address, name, shared_access_key_name=policy, shared_access_key_value=key, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "parse_conn_str", "(", "arg_1", ")", "arg_7", "=", "arg_2", "or", "arg_7", "arg_4", "=", "build_uri", "(", "arg_4", ",", "arg_7", ")", "arg_2", "=", "arg_4", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "return", "arg_0", "(", "arg_4", ",", "arg_2", ",", "shared_access_key_name", "=", "arg_5", ",", "shared_access_key_value", "=", "arg_6", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Create a Client from a Service Bus connection string.\n\n        :param conn_str: The connection string.\n        :type conn_str: str\n        :param name: The name of the entity, if the 'EntityName' property is\n         not included in the connection string.\n        \"\"\"\n        arg_4, arg_5, arg_6, arg_7 = parse_conn_str(arg_1)\n        arg_7 = arg_2 or arg_7\n        arg_4 = build_uri(arg_4, arg_7)\n        arg_2 = arg_4.split('/')[-1]\n        return arg_0(arg_4, arg_2, shared_access_key_name=arg_5, shared_access_key_value=arg_6, **arg_3)", "path": "azure-servicebus/azure/servicebus/common/mixins.py", "identifier": "BaseClient.from_connection_string", "docstring": "Create a Client from a Service Bus connection string.\n\n        :param conn_str: The connection string.\n        :type conn_str: str\n        :param name: The name of the entity, if the 'EntityName' property is\n         not included in the connection string.", "docstring_tokens": ["Create", "a", "Client", "from", "a", "Service", "Bus", "connection", "string", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254305}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/heatmaps.py#L211-L238", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Inverts each value in the heatmap, shifting low towards high values and vice versa.", "language": "python", "parameters": "(self)", "return_statement": "return arr_inv", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "HeatmapsOnImage", ".", "from_0to1", "(", "1", "-", "arg_0", ".", "arr_0to1", ",", "shape", "=", "arg_0", ".", "shape", ",", "min_value", "=", "arg_0", ".", "min_value", ",", "max_value", "=", "arg_0", ".", "max_value", ")", "arg_1", ".", "arr_was_2d", "=", "arg_0", ".", "arr_was_2d", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Inverts each value in the heatmap, shifting low towards high values and vice versa.\n\n        This changes each value to::\n\n            v' = max - (v - min)\n\n        where ``v`` is the value at some spatial location, ``min`` is the minimum value in the heatmap\n        and ``max`` is the maximum value.\n        As the heatmap uses internally a 0.0 to 1.0 representation, this simply becomes ``v' = 1.0 - v``.\n\n        Note that the attributes ``min_value`` and ``max_value`` are not switched. They both keep their values.\n\n        This function can be useful e.g. when working with depth maps, where algorithms might have\n        an easier time representing the furthest away points with zeros, requiring an Funced\n        depth map.\n\n        Returns\n        -------\n        arr_inv : imgaug.HeatmapsOnImage\n            Inverted heatmap.\n\n        \"\"\"\n        arg_1 = HeatmapsOnImage.from_0to1(1 - arg_0.arr_0to1, shape=arg_0.shape, min_value=arg_0.min_value,\n                                            max_value=arg_0.max_value)\n        arg_1.arr_was_2d = arg_0.arr_was_2d\n        return arg_1", "path": "imgaug/augmentables/heatmaps.py", "identifier": "HeatmapsOnImage.invert", "docstring": "Inverts each value in the heatmap, shifting low towards high values and vice versa.\n\n        This changes each value to::\n\n            v' = max - (v - min)\n\n        where ``v`` is the value at some spatial location, ``min`` is the minimum value in the heatmap\n        and ``max`` is the maximum value.\n        As the heatmap uses internally a 0.0 to 1.0 representation, this simply becomes ``v' = 1.0 - v``.\n\n        Note that the attributes ``min_value`` and ``max_value`` are not switched. They both keep their values.\n\n        This function can be useful e.g. when working with depth maps, where algorithms might have\n        an easier time representing the furthest away points with zeros, requiring an inverted\n        depth map.\n\n        Returns\n        -------\n        arr_inv : imgaug.HeatmapsOnImage\n            Inverted heatmap.", "docstring_tokens": ["Inverts", "each", "value", "in", "the", "heatmap", "shifting", "low", "towards", "high", "values", "and", "vice", "versa", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254306}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py#L83-L129", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Publish runbook draft.", "language": "python", "parameters": "(\n            self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "True", ",", "**", "arg_7", ")", ":", "arg_8", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "True", ",", "**", "arg_7", ")", "def", "get_long_running_output", "(", "arg_9", ")", ":", "if", "arg_5", ":", "arg_10", "=", "ClientRawResponse", "(", "None", ",", "arg_9", ")", "arg_10", ".", "add_headers", "(", "{", "'location'", ":", "'str'", ",", "}", ")", "return", "arg_10", "arg_11", "=", "arg_7", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_6", "is", "True", ":", "arg_12", "=", "ARMPolling", "(", "arg_11", ",", "**", "arg_7", ")", "elif", "arg_6", "is", "False", ":", "arg_12", "=", "NoPolling", "(", ")", "else", ":", "arg_12", "=", "arg_6", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_8", ",", "get_long_running_output", ",", "arg_12", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=False, arg_6=True, **arg_7):\n        \"\"\"Publish runbook draft.\n\n        :param resource_group_name: Name of an Azure Resource group.\n        :type resource_group_name: str\n        :param automation_account_name: The name of the automation account.\n        :type automation_account_name: str\n        :param runbook_name: The parameters supplied to the Func runbook\n         operation.\n        :type runbook_name: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises:\n         :class:`ErrorResponseException<azure.mgmt.automation.models.ErrorResponseException>`\n        \"\"\"\n        arg_8 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=True,\n            **arg_7\n        )\n\n        def get_long_running_output(arg_9):\n            if arg_5:\n                arg_10 = ClientRawResponse(None, arg_9)\n                arg_10.add_headers({\n                    'location': 'str',\n                })\n                return arg_10\n\n        arg_11 = arg_7.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_6 is True: arg_12 = ARMPolling(arg_11, **arg_7)\n        elif arg_6 is False: arg_12 = NoPolling()\n        else: arg_12 = arg_6\n        return LROPoller(arg_0._client, arg_8, get_long_running_output, arg_12)", "path": "azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py", "identifier": "RunbookOperations.publish", "docstring": "Publish runbook draft.\n\n        :param resource_group_name: Name of an Azure Resource group.\n        :type resource_group_name: str\n        :param automation_account_name: The name of the automation account.\n        :type automation_account_name: str\n        :param runbook_name: The parameters supplied to the publish runbook\n         operation.\n        :type runbook_name: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises:\n         :class:`ErrorResponseException<azure.mgmt.automation.models.ErrorResponseException>`", "docstring_tokens": ["Publish", "runbook", "draft", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254307}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L185-L216", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "This uploads the protocol functions nessecary to do binary\n        chunked transfer", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "log", ".", "info", "(", "'Preparing esp for transfer.'", ")", "for", "arg_1", "in", "LUA_FUNCTIONS", ":", "detected", "=", "arg_0", ".", "__exchange", "(", "'print({0})'", ".", "format", "(", "arg_1", ")", ")", "if", "detected", ".", "find", "(", "'function:'", ")", "==", "-", "1", ":", "break", "else", ":", "log", ".", "info", "(", "'Preparation already done. Not adding functions again.'", ")", "return", "True", "arg_2", "=", "RECV_LUA", "+", "'\\n'", "+", "SEND_LUA", "arg_3", "=", "arg_2", ".", "format", "(", "baud", "=", "arg_0", ".", "_port", ".", "baudrate", ")", "arg_4", "=", "arg_3", ".", "replace", "(", "'\\r'", ",", "''", ")", ".", "split", "(", "'\\n'", ")", "for", "arg_5", "in", "arg_4", ":", "arg_5", "=", "arg_5", ".", "strip", "(", ")", ".", "replace", "(", "', '", ",", "','", ")", ".", "replace", "(", "' = '", ",", "'='", ")", "if", "len", "(", "arg_5", ")", "==", "0", ":", "continue", "arg_6", "=", "arg_0", ".", "__exchange", "(", "arg_5", ")", "if", "(", "'unexpected'", "in", "arg_6", ")", "or", "(", "'stdin'", "in", "arg_6", ")", "or", "len", "(", "arg_6", ")", ">", "len", "(", "arg_2", ")", "+", "10", ":", "log", ".", "error", "(", "'error when preparing \"%s\"'", ",", "arg_6", ")", "return", "False", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"\n        This uploads the protocol functions nessecary to do binary\n        chunked transfer\n        \"\"\"\n        log.info('Preparing esp for transfer.')\n\n        for arg_1 in LUA_FUNCTIONS:\n            detected = arg_0.__exchange('print({0})'.format(arg_1))\n            if detected.find('function:') == -1:\n                break\n        else:\n            log.info('Preparation already done. Not adding functions again.')\n            return True\n        arg_2 = RECV_LUA + '\\n' + SEND_LUA\n        arg_3 = arg_2.format(baud=arg_0._port.baudrate)\n        ##change any \\r\\n to just \\n and split on that\n        arg_4 = arg_3.replace('\\r', '').split('\\n')\n\n        #remove some unneccesary spaces to conserve some bytes\n        for arg_5 in arg_4:\n            arg_5 = arg_5.strip().replace(', ', ',').replace(' = ', '=')\n\n            if len(arg_5) == 0:\n                continue\n\n            arg_6 = arg_0.__exchange(arg_5)\n            #do some basic test of the result\n            if ('unexpected' in arg_6) or ('stdin' in arg_6) or len(arg_6) > len(arg_2)+10:\n                log.error('error when preparing \"%s\"', arg_6)\n                return False\n        return True", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.prepare", "docstring": "This uploads the protocol functions nessecary to do binary\n        chunked transfer", "docstring_tokens": ["This", "uploads", "the", "protocol", "functions", "nessecary", "to", "do", "binary", "chunked", "transfer"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 254308}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L173-L184", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Send a Timer metric calculating the duration from the start time", "language": "python", "parameters": "(self, name, start_time, rate=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "arg_4", "=", "0", "if", "isinstance", "(", "arg_2", ",", "datetime", ")", ":", "arg_4", "=", "(", "datetime", ".", "now", "(", "arg_2", ".", "tzinfo", ")", "-", "arg_2", ")", ".", "total_seconds", "(", ")", "*", "1000", "elif", "is_numeric", "(", "arg_2", ")", ":", "assert", "arg_2", ">", "0", "arg_4", "=", "(", "time", "(", ")", "-", "arg_2", ")", "*", "1000", "else", ":", "raise", "ValueError", "(", "\"start time should be a timestamp or a datetime\"", ")", "arg_0", ".", "timing", "(", "arg_1", ",", "arg_4", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n        # type: (str, Union[float, datetime], float) -> None\n        \"\"\"Send a Timer metric calculating the duration from the start time\"\"\"\n        arg_4 = 0  # type: float\n        if isinstance(arg_2, datetime):\n            arg_4 = (datetime.now(arg_2.tzinfo) - arg_2).total_seconds() * 1000\n        elif is_numeric(arg_2):\n            assert arg_2 > 0\n            arg_4 = (time() - arg_2) * 1000\n        else:\n            raise ValueError(\"start time should be a timestamp or a datetime\")\n        arg_0.timing(arg_1, arg_4, arg_3)", "path": "statsdmetrics/client/__init__.py", "identifier": "AbstractClient.timing_since", "docstring": "Send a Timer metric calculating the duration from the start time", "docstring_tokens": ["Send", "a", "Timer", "metric", "calculating", "the", "duration", "from", "the", "start", "time"], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 254309}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmodels/flares.py#L94-L138", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This returns the residual between model mags and the actual mags.", "language": "python", "parameters": "(flareparams, times, mags, errs)", "return_statement": "return (mags - modelmags)/errs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_5", ",", "arg_5", ",", "arg_5", "=", "flare_model", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "(", "arg_2", "-", "arg_4", ")", "/", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''\n    This returns the residual between model mags and the actual mags.\n\n    Parameters\n    ----------\n\n    flareparams : list of float\n        This defines the flare model::\n\n            [amplitude,\n             flare_peak_time,\n             rise_gaussian_stdev,\n             decay_time_constant]\n\n        where:\n\n        `amplitude`: the maximum flare amplitude in mags or flux. If flux, then\n        amplitude should be positive. If mags, amplitude should be negative.\n\n        `flare_peak_time`: time at which the flare maximum happens.\n\n        `rise_gaussian_stdev`: the stdev of the gaussian describing the rise of\n        the flare.\n\n        `decay_time_constant`: the time constant of the exponential fall of the\n        flare.\n\n    times,mags,errs : np.array\n        The input time-series of measurements and associated errors for which\n        the model will be generated. The times will be used to generate\n        model mags.\n\n    Returns\n    -------\n\n    np.array\n        The residuals between the input `mags` and generated `modelmags`,\n        weighted by the measurement errors in `errs`.\n\n    '''\n\n    arg_4, arg_5, arg_5, arg_5 = flare_model(arg_0, arg_1, arg_2, arg_3)\n\n    return (arg_2 - arg_4)/arg_3", "path": "astrobase/lcmodels/flares.py", "identifier": "flare_model_residual", "docstring": "This returns the residual between model mags and the actual mags.\n\n    Parameters\n    ----------\n\n    flareparams : list of float\n        This defines the flare model::\n\n            [amplitude,\n             flare_peak_time,\n             rise_gaussian_stdev,\n             decay_time_constant]\n\n        where:\n\n        `amplitude`: the maximum flare amplitude in mags or flux. If flux, then\n        amplitude should be positive. If mags, amplitude should be negative.\n\n        `flare_peak_time`: time at which the flare maximum happens.\n\n        `rise_gaussian_stdev`: the stdev of the gaussian describing the rise of\n        the flare.\n\n        `decay_time_constant`: the time constant of the exponential fall of the\n        flare.\n\n    times,mags,errs : np.array\n        The input time-series of measurements and associated errors for which\n        the model will be generated. The times will be used to generate\n        model mags.\n\n    Returns\n    -------\n\n    np.array\n        The residuals between the input `mags` and generated `modelmags`,\n        weighted by the measurement errors in `errs`.", "docstring_tokens": ["This", "returns", "the", "residual", "between", "model", "mags", "and", "the", "actual", "mags", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 254310}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L623-L645", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Delete all issues with labels from exclude-labels option.", "language": "python", "parameters": "(self, issues)", "return_statement": "return include_issues", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "options", ".", "exclude_labels", ":", "return", "copy", ".", "deepcopy", "(", "arg_1", ")", "arg_2", "=", "set", "(", ")", "arg_3", "=", "arg_0", ".", "options", ".", "exclude_labels", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_1", ":", "for", "arg_6", "in", "arg_5", "[", "\"labels\"", "]", ":", "if", "arg_6", "[", "\"name\"", "]", "in", "arg_3", ":", "arg_2", ".", "add", "(", "arg_5", "[", "\"number\"", "]", ")", "break", "for", "arg_5", "in", "arg_1", ":", "if", "arg_5", "[", "\"number\"", "]", "not", "in", "arg_2", ":", "arg_4", ".", "append", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Delete all issues with labels from exclude-labels option.\n\n        :param list(dict) issues: All issues for tag.\n        :rtype: list(dict)\n        :return: Filtered issues.\n        \"\"\"\n        if not arg_0.options.exclude_labels:\n            return copy.deepcopy(arg_1)\n\n        arg_2 = set()\n        arg_3 = arg_0.options.exclude_labels\n        arg_4 = []\n        for arg_5 in arg_1:\n            for arg_6 in arg_5[\"labels\"]:\n                if arg_6[\"name\"] in arg_3:\n                    arg_2.add(arg_5[\"number\"])\n                    break\n        for arg_5 in arg_1:\n            if arg_5[\"number\"] not in arg_2:\n                arg_4.append(arg_5)\n        return arg_4", "path": "pygcgen/generator.py", "identifier": "Generator.exclude_issues_by_labels", "docstring": "Delete all issues with labels from exclude-labels option.\n\n        :param list(dict) issues: All issues for tag.\n        :rtype: list(dict)\n        :return: Filtered issues.", "docstring_tokens": ["Delete", "all", "issues", "with", "labels", "from", "exclude", "-", "labels", "option", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 254311}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L97-L112", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Retrieves a resource containing information about a Cloud SQL instance.", "language": "python", "parameters": "(self, instance, project_id=None)", "return_statement": "return self.get_conn().instances().get(\n            project=project_id,\n            instance=instance\n        ).execute(num_retries=self.num_retries)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "get_conn", "(", ")", ".", "instances", "(", ")", ".", "get", "(", "project", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Retrieves a resource containing information about a Cloud SQL instance.\n\n        :param instance: Database instance ID. This does not include the project ID.\n        :type instance: str\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: A Cloud SQL instance resource.\n        :rtype: dict\n        \"\"\"\n        return arg_0.get_conn().instances().get(\n            project=arg_2,\n            arg_1=arg_1\n        ).execute(num_retries=arg_0.num_retries)", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlHook.get_instance", "docstring": "Retrieves a resource containing information about a Cloud SQL instance.\n\n        :param instance: Database instance ID. This does not include the project ID.\n        :type instance: str\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: A Cloud SQL instance resource.\n        :rtype: dict", "docstring_tokens": ["Retrieves", "a", "resource", "containing", "information", "about", "a", "Cloud", "SQL", "instance", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254312}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/nelder_mead.py#L62-L340", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Minimum of the objective function using the Nelder Mead simplex algorithm.", "language": "python", "parameters": "(objective_function,\n             initial_simplex=None,\n             initial_vertex=None,\n             step_sizes=None,\n             objective_at_initial_simplex=None,\n             objective_at_initial_vertex=None,\n             batch_evaluate_objective=False,\n             func_tolerance=1e-8,\n             position_tolerance=1e-8,\n             parallel_iterations=1,\n             max_iterations=None,\n             reflection=None,\n             expansion=None,\n             contraction=None,\n             shrinkage=None,\n             name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "1e-8", ",", "arg_8", "=", "1e-8", ",", "arg_9", "=", "1", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "None", ",", "arg_14", "=", "None", ",", "arg_15", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_15", ",", "'Func'", ",", "[", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_7", ",", "arg_8", "]", ")", ":", "(", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", ",", "arg_20", ")", "=", "_prepare_args", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "arg_21", "=", "arg_18", ".", "dtype", "(", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", ")", "=", "_resolve_parameters", "(", "arg_16", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_21", ")", "arg_22", "=", "dict", "(", "arg_0", "=", "arg_0", ",", "arg_16", "=", "arg_16", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_6", "=", "arg_6", ",", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ")", "def", "_loop_body", "(", "arg_17", ",", "arg_23", ",", "arg_18", ",", "arg_19", ",", "arg_20", ")", ":", "(", "arg_24", ",", "arg_25", ",", "arg_26", ",", "arg_27", ")", "=", "nelder_mead_one_step", "(", "arg_18", ",", "arg_19", ",", "**", "arg_22", ")", "return", "(", "arg_24", ",", "arg_23", "+", "1", ",", "arg_25", ",", "arg_26", ",", "arg_20", "+", "arg_27", ")", "arg_28", "=", "(", "False", ",", "0", ",", "arg_18", ",", "arg_19", ",", "arg_20", ")", "def", "_is_converged", "(", "arg_24", ",", "arg_29", ",", "*", "arg_30", ")", ":", "arg_31", "=", "tf", ".", "logical_not", "(", "arg_24", ")", "return", "(", "arg_31", "if", "arg_10", "is", "None", "else", "(", "arg_31", "&", "(", "arg_29", "<", "arg_10", ")", ")", ")", "(", "arg_24", ",", "arg_29", ",", "arg_32", ",", "arg_33", ",", "arg_34", ")", "=", "tf", ".", "while_loop", "(", "cond", "=", "_is_converged", ",", "body", "=", "_loop_body", ",", "loop_vars", "=", "arg_28", ",", "arg_9", "=", "arg_9", ")", "arg_35", "=", "tf", ".", "argsort", "(", "arg_33", ",", "direction", "=", "'ASCENDING'", ",", "stable", "=", "True", ")", "arg_36", "=", "arg_35", "[", "0", "]", "return", "NelderMeadOptimizerResults", "(", "arg_24", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_24", ")", ",", "num_objective_evaluations", "=", "arg_34", ",", "position", "=", "arg_32", "[", "arg_36", "]", ",", "objective_value", "=", "arg_33", "[", "arg_36", "]", ",", "arg_32", "=", "arg_32", ",", "arg_33", "=", "arg_33", ",", "arg_29", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_29", ")", ",", "arg_1", "=", "arg_18", ",", "initial_objective_values", "=", "arg_19", ")"], "function": "def Func(arg_0,\n             arg_1=None,\n             arg_2=None,\n             arg_3=None,\n             arg_4=None,\n             arg_5=None,\n             arg_6=False,\n             arg_7=1e-8,\n             arg_8=1e-8,\n             arg_9=1,\n             arg_10=None,\n             arg_11=None,\n             arg_12=None,\n             arg_13=None,\n             arg_14=None,\n             arg_15=None):\n  \"\"\"Minimum of the objective function using the Nelder Mead simplex algorithm.\n\n  Performs an unconstrained minimization of a (possibly non-smooth) function\n  using the Nelder Mead simplex method. Nelder Mead method does not support\n  univariate functions. Hence the dimensions of the domain must be 2 or greater.\n  For details of the algorithm, see\n  [Press, Teukolsky, Vetterling and Flannery(2007)][1].\n\n  Points in the domain of the objective function may be represented as a\n  `Tensor` of general shape but with rank at least 1. The algorithm proceeds\n  by modifying a full rank simplex in the domain. The initial simplex may\n  either be specified by the user or can be constructed using a single vertex\n  supplied by the user. In the latter case, if `v0` is the supplied vertex,\n  the simplex is the convex hull of the set:\n\n  ```None\n  S = {v0} + {v0 + step_i * e_i}\n  ```\n\n  Here `e_i` is a vector which is `1` along the `i`-th axis and zero elsewhere\n  and `step_i` is a characteristic length scale along the `i`-th axis. If the\n  step size is not supplied by the user, a unit step size is used in every axis.\n  Alternately, a single step size may be specified which is used for every\n  axis. The most flexible option is to supply a bespoke step size for every\n  axis.\n\n  ### Usage:\n\n  The following example demonstrates the usage of the Nelder Mead minimzation\n  on a two dimensional problem with the minimum located at a non-differentiable\n  point.\n\n  ```python\n    # The objective function\n    def sqrt_quadratic(x):\n      return tf.sqrt(tf.reduce_sum(x ** 2, axis=-1))\n\n    start = tf.constant([6.0, -21.0])  # Starting point for the search.\n    optim_results = tfp.optimizer.nelder_mead_Func(\n        sqrt_quadratic, initial_vertex=start, func_tolerance=1e-8,\n        batch_evaluate_objective=True)\n\n    with tf.Session() as session:\n      results = session.run(optim_results)\n      # Check that the search converged\n      assert(results.converged)\n      # Check that the argmin is close to the actual value.\n      np.testing.assert_allclose(results.position, np.array([0.0, 0.0]),\n                                 atol=1e-7)\n      # Print out the total number of function evaluations it took.\n      print (\"Function evaluations: %d\" % results.num_objective_evaluations)\n  ```\n\n  ### References:\n  [1]: William Press, Saul Teukolsky, William Vetterling and Brian Flannery.\n    Numerical Recipes in C++, third edition. pp. 502-507. (2007).\n    http://numerical.recipes/cpppages/chap0sel.pdf\n\n  [2]: Jeffrey Lagarias, James Reeds, Margaret Wright and Paul Wright.\n    Convergence properties of the Nelder-Mead simplex method in low dimensions,\n    Siam J. Optim., Vol 9, No. 1, pp. 112-147. (1998).\n    http://www.math.kent.edu/~reichel/courses/Opt/reading.material.2/nelder.mead.pdf\n\n  [3]: Fuchang Gao and Lixing Han. Implementing the Nelder-Mead simplex\n    algorithm with adaptive parameters. Computational Optimization and\n    Applications, Vol 51, Issue 1, pp 259-277. (2012).\n    https://pdfs.semanticscholar.org/15b4/c4aa7437df4d032c6ee6ce98d6030dd627be.pdf\n\n  Args:\n    objective_function:  A Python callable that accepts a point as a\n      real `Tensor` and returns a `Tensor` of real dtype containing\n      the value of the function at that point. The function\n      to be Funcd. If `batch_evaluate_objective` is `True`, the callable\n      may be evaluated on a `Tensor` of shape `[n+1] + s ` where `n` is\n      the dimension of the problem and `s` is the shape of a single point\n      in the domain (so `n` is the size of a `Tensor` representing a\n      single point).\n      In this case, the expected return value is a `Tensor` of shape `[n+1]`.\n      Note that this method does not support univariate functions so the problem\n      dimension `n` must be strictly greater than 1.\n    initial_simplex: (Optional) `Tensor` of real dtype. The initial simplex to\n      start the search. If supplied, should be a `Tensor` of shape `[n+1] + s`\n      where `n` is the dimension of the problem and `s` is the shape of a\n      single point in the domain. Each row (i.e. the `Tensor` with a given\n      value of the first index) is interpreted as a vertex of a simplex and\n      hence the rows must be affinely independent. If not supplied, an axes\n      aligned simplex is constructed using the `initial_vertex` and\n      `step_sizes`. Only one and at least one of `initial_simplex` and\n      `initial_vertex` must be supplied.\n    initial_vertex: (Optional) `Tensor` of real dtype and any shape that can\n      be consumed by the `objective_function`. A single point in the domain that\n      will be used to construct an axes aligned initial simplex.\n    step_sizes: (Optional) `Tensor` of real dtype and shape broadcasting\n      compatible with `initial_vertex`. Supplies the simplex scale along each\n      axes. Only used if `initial_simplex` is not supplied. See description\n      above for details on how step sizes and initial vertex are used to\n      construct the initial simplex.\n    objective_at_initial_simplex: (Optional) Rank `1` `Tensor` of real dtype\n      of a rank `1` `Tensor`. The value of the objective function at the\n      initial simplex. May be supplied only if `initial_simplex` is\n      supplied. If not supplied, it will be computed.\n    objective_at_initial_vertex: (Optional) Scalar `Tensor` of real dtype. The\n      value of the objective function at the initial vertex. May be supplied\n      only if the `initial_vertex` is also supplied.\n    batch_evaluate_objective: (Optional) Python `bool`. If True, the objective\n      function will be evaluated on all the vertices of the simplex packed\n      into a single tensor. If False, the objective will be mapped across each\n      vertex separately. Evaluating the objective function in a batch allows\n      use of vectorization and should be preferred if the objective function\n      allows it.\n    func_tolerance: (Optional) Scalar `Tensor` of real dtype. The algorithm\n      stops if the absolute difference between the largest and the smallest\n      function value on the vertices of the simplex is below this number.\n    position_tolerance: (Optional) Scalar `Tensor` of real dtype. The\n      algorithm stops if the largest absolute difference between the\n      coordinates of the vertices is below this threshold.\n    parallel_iterations: (Optional) Positive integer. The number of iterations\n      allowed to run in parallel.\n    max_iterations: (Optional) Scalar positive `Tensor` of dtype `int32`.\n      The maximum number of iterations allowed. If `None` then no limit is\n      applied.\n    reflection: (Optional) Positive Scalar `Tensor` of same dtype as\n      `initial_vertex`. This parameter controls the scaling of the reflected\n      vertex. See, [Press et al(2007)][1] for details. If not specified,\n      uses the dimension dependent prescription of [Gao and Han(2012)][3].\n    expansion: (Optional) Positive Scalar `Tensor` of same dtype as\n      `initial_vertex`. Should be greater than `1` and `reflection`. This\n      parameter controls the expanded scaling of a reflected vertex.\n      See, [Press et al(2007)][1] for details. If not specified, uses the\n      dimension dependent prescription of [Gao and Han(2012)][3].\n    contraction: (Optional) Positive scalar `Tensor` of same dtype as\n      `initial_vertex`. Must be between `0` and `1`. This parameter controls\n      the contraction of the reflected vertex when the objective function at\n      the reflected point fails to show sufficient decrease.\n      See, [Press et al(2007)][1] for more details. If not specified, uses\n      the dimension dependent prescription of [Gao and Han(2012][3].\n    shrinkage: (Optional) Positive scalar `Tensor` of same dtype as\n      `initial_vertex`. Must be between `0` and `1`. This parameter is the scale\n      by which the simplex is shrunk around the best point when the other\n      steps fail to produce improvements.\n      See, [Press et al(2007)][1] for more details. If not specified, uses\n      the dimension dependent prescription of [Gao and Han(2012][3].\n    name: (Optional) Python str. The name prefixed to the ops created by this\n      function. If not supplied, the default name 'Func' is used.\n\n  Returns:\n    optimizer_results: A namedtuple containing the following items:\n      converged: Scalar boolean tensor indicating whether the minimum was\n        found within tolerance.\n      num_objective_evaluations: The total number of objective\n        evaluations performed.\n      position: A `Tensor` containing the last argument value found\n        during the search. If the search converged, then\n        this value is the argmin of the objective function.\n      objective_value: A tensor containing the value of the objective\n        function at the `position`. If the search\n        converged, then this is the (local) minimum of\n        the objective function.\n      final_simplex: The last simplex constructed before stopping.\n      final_objective_values: The objective function evaluated at the\n        vertices of the final simplex.\n      initial_simplex: The starting simplex.\n      initial_objective_values: The objective function evaluated at the\n        vertices of the initial simplex.\n      num_iterations: The number of iterations of the main algorithm body.\n\n  Raises:\n    ValueError: If any of the following conditions hold\n      1. If none or more than one of `initial_simplex` and `initial_vertex` are\n        supplied.\n      2. If `initial_simplex` and `step_sizes` are both specified.\n  \"\"\"\n  with tf.compat.v1.name_scope(arg_15, 'Func', [\n      arg_1, arg_2, arg_3, arg_4,\n      arg_5, arg_7, arg_8\n  ]):\n    (\n        arg_16,\n        arg_17,\n        arg_18,\n        arg_19,\n        arg_20\n    ) = _prepare_args(arg_0,\n                      arg_1,\n                      arg_2,\n                      arg_3,\n                      arg_4,\n                      arg_5,\n                      arg_6)\n    arg_21 = arg_18.dtype\n    (\n        arg_11,\n        arg_12,\n        arg_13,\n        arg_14\n    ) = _resolve_parameters(arg_16,\n                            arg_11,\n                            arg_12,\n                            arg_13,\n                            arg_14,\n                            arg_21)\n\n    arg_22 = dict(\n        arg_0=arg_0,\n        arg_16=arg_16,\n        arg_7=arg_7,\n        arg_8=arg_8,\n        arg_6=arg_6,\n        arg_11=arg_11,\n        arg_12=arg_12,\n        arg_13=arg_13,\n        arg_14=arg_14)\n\n    def _loop_body(arg_17, arg_23, arg_18, arg_19,\n                   arg_20):\n      (\n          arg_24,\n          arg_25,\n          arg_26,\n          arg_27\n      ) = nelder_mead_one_step(arg_18, arg_19, **arg_22)\n\n      return (arg_24, arg_23 + 1, arg_25, arg_26,\n              arg_20 + arg_27)\n\n    arg_28 = (False, 0, arg_18, arg_19,\n                    arg_20)\n    # Loop until either we have converged or if the max iterations are supplied\n    # then until we have converged or exhausted the available iteration budget.\n    def _is_converged(arg_24, arg_29, *arg_30):  # pylint:disable=unused-argument\n      # It is important to ensure that not_converged is a tensor. If\n      # converged is not a tensor but a Python bool, then the overloaded\n      # op '~' acts as bitwise complement so ~True = -2 and ~False = -1.\n      # In that case, the loop will never terminate.\n      arg_31 = tf.logical_not(arg_24)\n      return (arg_31 if arg_10 is None\n              else (arg_31 & (arg_29 < arg_10)))\n\n    (arg_24, arg_29, arg_32, arg_33,\n     arg_34) = tf.while_loop(\n         cond=_is_converged,\n         body=_loop_body,\n         loop_vars=arg_28,\n         arg_9=arg_9)\n    arg_35 = tf.argsort(\n        arg_33, direction='ASCENDING', stable=True)\n    arg_36 = arg_35[0]\n    # The explicit cast to Tensor below is done to avoid returning a mixture\n    # of Python types and Tensors which cause problems with session.run.\n    # In the eager mode, converged may remain a Python bool. Trying to evaluate\n    # the whole tuple in one evaluate call will raise an exception because\n    # of the presence of non-tensors. This is very annoying so we explicitly\n    # cast those arguments to Tensors.\n    return NelderMeadOptimizerResults(\n        arg_24=tf.convert_to_tensor(value=arg_24),\n        num_objective_evaluations=arg_34,\n        position=arg_32[arg_36],\n        objective_value=arg_33[arg_36],\n        arg_32=arg_32,\n        arg_33=arg_33,\n        arg_29=tf.convert_to_tensor(value=arg_29),\n        arg_1=arg_18,\n        initial_objective_values=arg_19)", "path": "tensorflow_probability/python/optimizer/nelder_mead.py", "identifier": "minimize", "docstring": "Minimum of the objective function using the Nelder Mead simplex algorithm.\n\n  Performs an unconstrained minimization of a (possibly non-smooth) function\n  using the Nelder Mead simplex method. Nelder Mead method does not support\n  univariate functions. Hence the dimensions of the domain must be 2 or greater.\n  For details of the algorithm, see\n  [Press, Teukolsky, Vetterling and Flannery(2007)][1].\n\n  Points in the domain of the objective function may be represented as a\n  `Tensor` of general shape but with rank at least 1. The algorithm proceeds\n  by modifying a full rank simplex in the domain. The initial simplex may\n  either be specified by the user or can be constructed using a single vertex\n  supplied by the user. In the latter case, if `v0` is the supplied vertex,\n  the simplex is the convex hull of the set:\n\n  ```None\n  S = {v0} + {v0 + step_i * e_i}\n  ```\n\n  Here `e_i` is a vector which is `1` along the `i`-th axis and zero elsewhere\n  and `step_i` is a characteristic length scale along the `i`-th axis. If the\n  step size is not supplied by the user, a unit step size is used in every axis.\n  Alternately, a single step size may be specified which is used for every\n  axis. The most flexible option is to supply a bespoke step size for every\n  axis.\n\n  ### Usage:\n\n  The following example demonstrates the usage of the Nelder Mead minimzation\n  on a two dimensional problem with the minimum located at a non-differentiable\n  point.\n\n  ```python\n    # The objective function\n    def sqrt_quadratic(x):\n      return tf.sqrt(tf.reduce_sum(x ** 2, axis=-1))\n\n    start = tf.constant([6.0, -21.0])  # Starting point for the search.\n    optim_results = tfp.optimizer.nelder_mead_minimize(\n        sqrt_quadratic, initial_vertex=start, func_tolerance=1e-8,\n        batch_evaluate_objective=True)\n\n    with tf.Session() as session:\n      results = session.run(optim_results)\n      # Check that the search converged\n      assert(results.converged)\n      # Check that the argmin is close to the actual value.\n      np.testing.assert_allclose(results.position, np.array([0.0, 0.0]),\n                                 atol=1e-7)\n      # Print out the total number of function evaluations it took.\n      print (\"Function evaluations: %d\" % results.num_objective_evaluations)\n  ```\n\n  ### References:\n  [1]: William Press, Saul Teukolsky, William Vetterling and Brian Flannery.\n    Numerical Recipes in C++, third edition. pp. 502-507. (2007).\n    http://numerical.recipes/cpppages/chap0sel.pdf\n\n  [2]: Jeffrey Lagarias, James Reeds, Margaret Wright and Paul Wright.\n    Convergence properties of the Nelder-Mead simplex method in low dimensions,\n    Siam J. Optim., Vol 9, No. 1, pp. 112-147. (1998).\n    http://www.math.kent.edu/~reichel/courses/Opt/reading.material.2/nelder.mead.pdf\n\n  [3]: Fuchang Gao and Lixing Han. Implementing the Nelder-Mead simplex\n    algorithm with adaptive parameters. Computational Optimization and\n    Applications, Vol 51, Issue 1, pp 259-277. (2012).\n    https://pdfs.semanticscholar.org/15b4/c4aa7437df4d032c6ee6ce98d6030dd627be.pdf\n\n  Args:\n    objective_function:  A Python callable that accepts a point as a\n      real `Tensor` and returns a `Tensor` of real dtype containing\n      the value of the function at that point. The function\n      to be minimized. If `batch_evaluate_objective` is `True`, the callable\n      may be evaluated on a `Tensor` of shape `[n+1] + s ` where `n` is\n      the dimension of the problem and `s` is the shape of a single point\n      in the domain (so `n` is the size of a `Tensor` representing a\n      single point).\n      In this case, the expected return value is a `Tensor` of shape `[n+1]`.\n      Note that this method does not support univariate functions so the problem\n      dimension `n` must be strictly greater than 1.\n    initial_simplex: (Optional) `Tensor` of real dtype. The initial simplex to\n      start the search. If supplied, should be a `Tensor` of shape `[n+1] + s`\n      where `n` is the dimension of the problem and `s` is the shape of a\n      single point in the domain. Each row (i.e. the `Tensor` with a given\n      value of the first index) is interpreted as a vertex of a simplex and\n      hence the rows must be affinely independent. If not supplied, an axes\n      aligned simplex is constructed using the `initial_vertex` and\n      `step_sizes`. Only one and at least one of `initial_simplex` and\n      `initial_vertex` must be supplied.\n    initial_vertex: (Optional) `Tensor` of real dtype and any shape that can\n      be consumed by the `objective_function`. A single point in the domain that\n      will be used to construct an axes aligned initial simplex.\n    step_sizes: (Optional) `Tensor` of real dtype and shape broadcasting\n      compatible with `initial_vertex`. Supplies the simplex scale along each\n      axes. Only used if `initial_simplex` is not supplied. See description\n      above for details on how step sizes and initial vertex are used to\n      construct the initial simplex.\n    objective_at_initial_simplex: (Optional) Rank `1` `Tensor` of real dtype\n      of a rank `1` `Tensor`. The value of the objective function at the\n      initial simplex. May be supplied only if `initial_simplex` is\n      supplied. If not supplied, it will be computed.\n    objective_at_initial_vertex: (Optional) Scalar `Tensor` of real dtype. The\n      value of the objective function at the initial vertex. May be supplied\n      only if the `initial_vertex` is also supplied.\n    batch_evaluate_objective: (Optional) Python `bool`. If True, the objective\n      function will be evaluated on all the vertices of the simplex packed\n      into a single tensor. If False, the objective will be mapped across each\n      vertex separately. Evaluating the objective function in a batch allows\n      use of vectorization and should be preferred if the objective function\n      allows it.\n    func_tolerance: (Optional) Scalar `Tensor` of real dtype. The algorithm\n      stops if the absolute difference between the largest and the smallest\n      function value on the vertices of the simplex is below this number.\n    position_tolerance: (Optional) Scalar `Tensor` of real dtype. The\n      algorithm stops if the largest absolute difference between the\n      coordinates of the vertices is below this threshold.\n    parallel_iterations: (Optional) Positive integer. The number of iterations\n      allowed to run in parallel.\n    max_iterations: (Optional) Scalar positive `Tensor` of dtype `int32`.\n      The maximum number of iterations allowed. If `None` then no limit is\n      applied.\n    reflection: (Optional) Positive Scalar `Tensor` of same dtype as\n      `initial_vertex`. This parameter controls the scaling of the reflected\n      vertex. See, [Press et al(2007)][1] for details. If not specified,\n      uses the dimension dependent prescription of [Gao and Han(2012)][3].\n    expansion: (Optional) Positive Scalar `Tensor` of same dtype as\n      `initial_vertex`. Should be greater than `1` and `reflection`. This\n      parameter controls the expanded scaling of a reflected vertex.\n      See, [Press et al(2007)][1] for details. If not specified, uses the\n      dimension dependent prescription of [Gao and Han(2012)][3].\n    contraction: (Optional) Positive scalar `Tensor` of same dtype as\n      `initial_vertex`. Must be between `0` and `1`. This parameter controls\n      the contraction of the reflected vertex when the objective function at\n      the reflected point fails to show sufficient decrease.\n      See, [Press et al(2007)][1] for more details. If not specified, uses\n      the dimension dependent prescription of [Gao and Han(2012][3].\n    shrinkage: (Optional) Positive scalar `Tensor` of same dtype as\n      `initial_vertex`. Must be between `0` and `1`. This parameter is the scale\n      by which the simplex is shrunk around the best point when the other\n      steps fail to produce improvements.\n      See, [Press et al(2007)][1] for more details. If not specified, uses\n      the dimension dependent prescription of [Gao and Han(2012][3].\n    name: (Optional) Python str. The name prefixed to the ops created by this\n      function. If not supplied, the default name 'minimize' is used.\n\n  Returns:\n    optimizer_results: A namedtuple containing the following items:\n      converged: Scalar boolean tensor indicating whether the minimum was\n        found within tolerance.\n      num_objective_evaluations: The total number of objective\n        evaluations performed.\n      position: A `Tensor` containing the last argument value found\n        during the search. If the search converged, then\n        this value is the argmin of the objective function.\n      objective_value: A tensor containing the value of the objective\n        function at the `position`. If the search\n        converged, then this is the (local) minimum of\n        the objective function.\n      final_simplex: The last simplex constructed before stopping.\n      final_objective_values: The objective function evaluated at the\n        vertices of the final simplex.\n      initial_simplex: The starting simplex.\n      initial_objective_values: The objective function evaluated at the\n        vertices of the initial simplex.\n      num_iterations: The number of iterations of the main algorithm body.\n\n  Raises:\n    ValueError: If any of the following conditions hold\n      1. If none or more than one of `initial_simplex` and `initial_vertex` are\n        supplied.\n      2. If `initial_simplex` and `step_sizes` are both specified.", "docstring_tokens": ["Minimum", "of", "the", "objective", "function", "using", "the", "Nelder", "Mead", "simplex", "algorithm", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254313}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L94-L109", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Checks whether a variable is a float.", "language": "python", "parameters": "(val)", "return_statement": "return isinstance(val, numbers.Real) and not is_single_integer(val) and not isinstance(val, bool)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "isinstance", "(", "arg_0", ",", "numbers", ".", "Real", ")", "and", "not", "is_single_integer", "(", "arg_0", ")", "and", "not", "isinstance", "(", "arg_0", ",", "bool", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Checks whether a variable is a float.\n\n    Parameters\n    ----------\n    val\n        The variable to check.\n\n    Returns\n    -------\n    bool\n        True if the variable is a float. Otherwise False.\n\n    \"\"\"\n    return isinstance(arg_0, numbers.Real) and not is_single_integer(arg_0) and not isinstance(arg_0, bool)", "path": "imgaug/imgaug.py", "identifier": "is_single_float", "docstring": "Checks whether a variable is a float.\n\n    Parameters\n    ----------\n    val\n        The variable to check.\n\n    Returns\n    -------\n    bool\n        True if the variable is a float. Otherwise False.", "docstring_tokens": ["Checks", "whether", "a", "variable", "is", "a", "float", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254314}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/provider.py#L113-L122", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Called when a device is disconnected.", "language": "python", "parameters": "(self, manager, peripheral, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "logger", ".", "debug", "(", "'centralManager_didDisconnectPeripheral called'", ")", "arg_4", "=", "device_list", "(", ")", ".", "get", "(", "arg_2", ")", "if", "arg_4", "is", "not", "None", ":", "arg_4", ".", "_set_disconnected", "(", ")", "device_list", "(", ")", ".", "remove", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Called when a device is disconnected.\"\"\"\n        logger.debug('centralManager_didDisconnectPeripheral called')\n        # Get the device and remove it from the device list, then fire its\n        # disconnected event.\n        arg_4 = device_list().get(arg_2)\n        if arg_4 is not None:\n            # Fire disconnected event and remove device from device list.\n            arg_4._set_disconnected()\n            device_list().remove(arg_2)", "path": "Adafruit_BluefruitLE/corebluetooth/provider.py", "identifier": "CentralDelegate.centralManager_didDisconnectPeripheral_error_", "docstring": "Called when a device is disconnected.", "docstring_tokens": ["Called", "when", "a", "device", "is", "disconnected", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 254315}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/util/array.py#L74-L114", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Compute an approximate basis for the nullspace of A.\n    The algorithm used by this function is based on the singular value\n    decomposition of `A`.", "language": "python", "parameters": "(A, atol=1e-13, rtol=0)", "return_statement": "return ns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1e-13", ",", "arg_2", "=", "0", ")", ":", "arg_0", "=", "np", ".", "atleast_2d", "(", "arg_0", ")", "arg_3", ",", "arg_4", ",", "arg_5", "=", "np", ".", "linalg", ".", "svd", "(", "arg_0", ")", "arg_6", "=", "max", "(", "arg_1", ",", "arg_2", "*", "arg_4", "[", "0", "]", ")", "arg_7", "=", "(", "arg_4", ">=", "arg_6", ")", ".", "sum", "(", ")", "arg_8", "=", "arg_5", "[", "arg_7", ":", "]", ".", "conj", "(", ")", ".", "T", "return", "arg_8"], "function": "def Func(arg_0, arg_1=1e-13, arg_2=0):\n    \"\"\"Compute an approximate basis for the Func of A.\n    The algorithm used by this function is based on the singular value\n    decomposition of `A`.\n\n    Parameters\n    ----------\n    A : numpy.ndarray\n        A should be at most 2-D.  A 1-D array with length k will be treated\n        as a 2-D with shape (1, k)\n    atol : float\n        The absolute tolerance for a zero singular value.  Singular values\n        smaller than `atol` are considered to be zero.\n    rtol : float\n        The relative tolerance.  Singular values less than rtol*smax are\n        considered to be zero, where smax is the largest singular value.\n\n    If both `atol` and `rtol` are positive, the combined tolerance is the\n    maximum of the two; that is::\n    tol = max(atol, rtol * smax)\n    Singular values smaller than `tol` are considered to be zero.\n\n    Returns\n    -------\n    numpy.ndarray\n        If `A` is an array with shape (m, k), then `ns` will be an array\n        with shape (k, n), where n is the estimated dimension of the\n        Func of `A`.  The columns of `ns` are a basis for the\n        Func; each element in numpy.dot(A, ns) will be approximately\n        zero.\n\n    Notes\n    -----\n    Taken from the numpy cookbook.\n    \"\"\"\n    arg_0 = np.atleast_2d(arg_0)\n    arg_3, arg_4, arg_5 = np.linalg.svd(arg_0)\n    arg_6 = max(arg_1, arg_2 * arg_4[0])\n    arg_7 = (arg_4 >= arg_6).sum()\n    arg_8 = arg_5[arg_7:].conj().T\n    return arg_8", "path": "cobra/util/array.py", "identifier": "nullspace", "docstring": "Compute an approximate basis for the nullspace of A.\n    The algorithm used by this function is based on the singular value\n    decomposition of `A`.\n\n    Parameters\n    ----------\n    A : numpy.ndarray\n        A should be at most 2-D.  A 1-D array with length k will be treated\n        as a 2-D with shape (1, k)\n    atol : float\n        The absolute tolerance for a zero singular value.  Singular values\n        smaller than `atol` are considered to be zero.\n    rtol : float\n        The relative tolerance.  Singular values less than rtol*smax are\n        considered to be zero, where smax is the largest singular value.\n\n    If both `atol` and `rtol` are positive, the combined tolerance is the\n    maximum of the two; that is::\n    tol = max(atol, rtol * smax)\n    Singular values smaller than `tol` are considered to be zero.\n\n    Returns\n    -------\n    numpy.ndarray\n        If `A` is an array with shape (m, k), then `ns` will be an array\n        with shape (k, n), where n is the estimated dimension of the\n        nullspace of `A`.  The columns of `ns` are a basis for the\n        nullspace; each element in numpy.dot(A, ns) will be approximately\n        zero.\n\n    Notes\n    -----\n    Taken from the numpy cookbook.", "docstring_tokens": ["Compute", "an", "approximate", "basis", "for", "the", "nullspace", "of", "A", ".", "The", "algorithm", "used", "by", "this", "function", "is", "based", "on", "the", "singular", "value", "decomposition", "of", "A", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 254316}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L484-L498", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "DRF view to list all catalogs.", "language": "python", "parameters": "(self, request)", "return_statement": "return get_paginated_response(serializer.data, request)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "CourseCatalogApiClient", "(", "arg_1", ".", "user", ")", "arg_3", "=", "arg_2", ".", "get_paginated_catalogs", "(", "arg_1", ".", "GET", ")", "arg_0", ".", "ensure_data_exists", "(", "arg_1", ",", "arg_3", ")", "arg_4", "=", "serializers", ".", "ResponsePaginationSerializer", "(", "arg_3", ")", "return", "get_paginated_response", "(", "arg_4", ".", "data", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        DRF view to Func all catalogs.\n\n        Arguments:\n            request (HttpRequest): Current request\n\n        Returns:\n            (Response): DRF response object containing course catalogs.\n        \"\"\"\n        arg_2 = CourseCatalogApiClient(arg_1.user)\n        arg_3 = arg_2.get_paginated_catalogs(arg_1.GET)\n        arg_0.ensure_data_exists(arg_1, arg_3)\n        arg_4 = serializers.ResponsePaginationSerializer(arg_3)\n        return get_paginated_response(arg_4.data, arg_1)", "path": "enterprise/api/v1/views.py", "identifier": "EnterpriseCourseCatalogViewSet.list", "docstring": "DRF view to list all catalogs.\n\n        Arguments:\n            request (HttpRequest): Current request\n\n        Returns:\n            (Response): DRF response object containing course catalogs.", "docstring_tokens": ["DRF", "view", "to", "list", "all", "catalogs", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254317}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L1382-L1417", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Register a file reader for use in parse_config_file.", "language": "python", "parameters": "(*args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "def", "do_registration", "(", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "list", "(", "zip", "(", "*", "_FILE_READERS", ")", ")", "[", "0", "]", ":", "_FILE_READERS", ".", "append", "(", "(", "arg_1", ",", "arg_2", ")", ")", "if", "len", "(", "arg_0", ")", "==", "1", ":", "return", "functools", ".", "partial", "(", "do_registration", ",", "arg_2", "=", "arg_0", "[", "0", "]", ")", "elif", "len", "(", "arg_0", ")", "==", "2", ":", "do_registration", "(", "*", "arg_0", ")", "else", ":", "arg_3", "=", "'Func() takes 1 or 2 arguments ({} given)'", "raise", "TypeError", "(", "arg_3", ".", "format", "(", "len", "(", "arg_0", ")", ")", ")"], "function": "def Func(*arg_0):\n  \"\"\"Register a file reader for use in parse_config_file.\n\n  Registered file readers will be used to try reading files passed to\n  `parse_config_file`. All file readers (beginning with the default `open`) will\n  be tried until one of them succeeds at opening the file.\n\n  This function may also be be used used as a decorator. For example:\n\n      @Func(IOError)\n      def exotic_data_source(filename):\n        ...\n\n  Args:\n    *args: (When used as a decorator, only the existence check is supplied.)\n      - file_reader_fn: The file reader function to register. This should be a\n        function that can be used as a context manager to open a file and\n        provide a file-like object, similar to Python's built-in `open`.\n      - is_readable_fn: A function taking the file path and returning a boolean\n        indicating whether the file can be read by `file_reader_fn`.\n\n  Returns:\n    `None`, or when used as a decorator, a function that will perform the\n    registration using the supplied readability predicate.\n  \"\"\"\n  def do_registration(arg_1, arg_2):\n    if arg_1 not in list(zip(*_FILE_READERS))[0]:\n      _FILE_READERS.append((arg_1, arg_2))\n\n  if len(arg_0) == 1:  # It's a decorator.\n    return functools.partial(do_registration, arg_2=arg_0[0])\n  elif len(arg_0) == 2:\n    do_registration(*arg_0)\n  else:  # 0 or > 2 arguments supplied.\n    arg_3 = 'Func() takes 1 or 2 arguments ({} given)'\n    raise TypeError(arg_3.format(len(arg_0)))", "path": "gin/config.py", "identifier": "register_file_reader", "docstring": "Register a file reader for use in parse_config_file.\n\n  Registered file readers will be used to try reading files passed to\n  `parse_config_file`. All file readers (beginning with the default `open`) will\n  be tried until one of them succeeds at opening the file.\n\n  This function may also be be used used as a decorator. For example:\n\n      @register_file_reader(IOError)\n      def exotic_data_source(filename):\n        ...\n\n  Args:\n    *args: (When used as a decorator, only the existence check is supplied.)\n      - file_reader_fn: The file reader function to register. This should be a\n        function that can be used as a context manager to open a file and\n        provide a file-like object, similar to Python's built-in `open`.\n      - is_readable_fn: A function taking the file path and returning a boolean\n        indicating whether the file can be read by `file_reader_fn`.\n\n  Returns:\n    `None`, or when used as a decorator, a function that will perform the\n    registration using the supplied readability predicate.", "docstring_tokens": ["Register", "a", "file", "reader", "for", "use", "in", "parse_config_file", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 254318}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/gene.py#L37-L76", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "convert compiled ast to gene_reaction_rule str", "language": "python", "parameters": "(expr, level=0, names=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Expression", ")", ":", "return", "Func", "(", "arg_0", ".", "body", ",", "0", ",", "arg_2", ")", "if", "hasattr", "(", "arg_0", ",", "\"body\"", ")", "else", "\"\"", "elif", "isinstance", "(", "arg_0", ",", "Name", ")", ":", "return", "arg_2", ".", "get", "(", "arg_0", ".", "id", ",", "arg_0", ".", "id", ")", "if", "arg_2", "else", "arg_0", ".", "id", "elif", "isinstance", "(", "arg_0", ",", "BoolOp", ")", ":", "arg_3", "=", "arg_0", ".", "op", "if", "isinstance", "(", "arg_3", ",", "Or", ")", ":", "arg_4", "=", "\" or \"", ".", "join", "(", "Func", "(", "i", ",", "arg_1", "+", "1", ",", "arg_2", ")", "for", "i", "in", "arg_0", ".", "values", ")", "elif", "isinstance", "(", "arg_3", ",", "And", ")", ":", "arg_4", "=", "\" and \"", ".", "join", "(", "Func", "(", "i", ",", "arg_1", "+", "1", ",", "arg_2", ")", "for", "i", "in", "arg_0", ".", "values", ")", "else", ":", "raise", "TypeError", "(", "\"unsupported operation \"", "+", "arg_3", ".", "__class__", ".", "__name", ")", "return", "\"(\"", "+", "arg_4", "+", "\")\"", "if", "arg_1", "else", "arg_4", "elif", "arg_0", "is", "None", ":", "return", "\"\"", "else", ":", "raise", "TypeError", "(", "\"unsupported operation  \"", "+", "repr", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=None):\n    \"\"\"convert compiled ast to gene_reaction_rule str\n\n    Parameters\n    ----------\n    expr : str\n        string for a gene reaction rule, e.g \"a and b\"\n    level : int\n        internal use only\n    names : dict\n        Dict where each element id a gene identifier and the value is the\n        gene name. Use this to get a rule str which uses names instead. This\n        should be done for display purposes only. All gene_reaction_rule\n        strings which are computed with should use the id.\n\n    Returns\n    ------\n    string\n        The gene reaction rule\n    \"\"\"\n    if isinstance(arg_0, Expression):\n        return Func(arg_0.body, 0, arg_2) \\\n            if hasattr(arg_0, \"body\") else \"\"\n    elif isinstance(arg_0, Name):\n        return arg_2.get(arg_0.id, arg_0.id) if arg_2 else arg_0.id\n    elif isinstance(arg_0, BoolOp):\n        arg_3 = arg_0.op\n        if isinstance(arg_3, Or):\n            arg_4 = \" or \".join(Func(i, arg_1 + 1, arg_2)\n                                  for i in arg_0.values)\n        elif isinstance(arg_3, And):\n            arg_4 = \" and \".join(Func(i, arg_1 + 1, arg_2)\n                                   for i in arg_0.values)\n        else:\n            raise TypeError(\"unsupported operation \" + arg_3.__class__.__name)\n        return \"(\" + arg_4 + \")\" if arg_1 else arg_4\n    elif arg_0 is None:\n        return \"\"\n    else:\n        raise TypeError(\"unsupported operation  \" + repr(arg_0))", "path": "cobra/core/gene.py", "identifier": "ast2str", "docstring": "convert compiled ast to gene_reaction_rule str\n\n    Parameters\n    ----------\n    expr : str\n        string for a gene reaction rule, e.g \"a and b\"\n    level : int\n        internal use only\n    names : dict\n        Dict where each element id a gene identifier and the value is the\n        gene name. Use this to get a rule str which uses names instead. This\n        should be done for display purposes only. All gene_reaction_rule\n        strings which are computed with should use the id.\n\n    Returns\n    ------\n    string\n        The gene reaction rule", "docstring_tokens": ["convert", "compiled", "ast", "to", "gene_reaction_rule", "str"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 254319}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L665-L709", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots raw returns over time.", "language": "python", "parameters": "(returns,\n                 live_start_date=None,\n                 ax=None)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "plt", ".", "gca", "(", ")", "arg_2", ".", "set_label", "(", "''", ")", "arg_2", ".", "set_ylabel", "(", "'Returns'", ")", "if", "arg_1", "is", "not", "None", ":", "arg_1", "=", "ep", ".", "utils", ".", "get_utc_timestamp", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "loc", "[", "arg_0", ".", "index", "<", "arg_1", "]", "arg_4", "=", "arg_0", ".", "loc", "[", "arg_0", ".", "index", ">=", "arg_1", "]", "arg_3", ".", "plot", "(", "arg_2", "=", "arg_2", ",", "color", "=", "'g'", ")", "arg_4", ".", "plot", "(", "arg_2", "=", "arg_2", ",", "color", "=", "'r'", ")", "else", ":", "arg_0", ".", "plot", "(", "arg_2", "=", "arg_2", ",", "color", "=", "'g'", ")", "return", "arg_2"], "function": "def Func(arg_0,\n                 arg_1=None,\n                 arg_2=None):\n    \"\"\"\n    Plots raw returns over time.\n\n    Backtest returns are in green, and out-of-sample (live trading)\n    returns are in red.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    live_start_date : datetime, optional\n        The date when the strategy began live trading, after\n        its backtest period. This date should be normalized.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_2 is None:\n        arg_2 = plt.gca()\n\n    arg_2.set_label('')\n    arg_2.set_ylabel('Returns')\n\n    if arg_1 is not None:\n        arg_1 = ep.utils.get_utc_timestamp(arg_1)\n        arg_3 = arg_0.loc[arg_0.index < arg_1]\n        arg_4 = arg_0.loc[arg_0.index >= arg_1]\n        arg_3.plot(arg_2=arg_2, color='g')\n        arg_4.plot(arg_2=arg_2, color='r')\n\n    else:\n        arg_0.plot(arg_2=arg_2, color='g')\n\n    return arg_2", "path": "pyfolio/plotting.py", "identifier": "plot_returns", "docstring": "Plots raw returns over time.\n\n    Backtest returns are in green, and out-of-sample (live trading)\n    returns are in red.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    live_start_date : datetime, optional\n        The date when the strategy began live trading, after\n        its backtest period. This date should be normalized.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "raw", "returns", "over", "time", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 254320}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/activation.py#L195-L215", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Swish function.", "language": "python", "parameters": "(x, name='swish')", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'Func'", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_1", ")", ":", "arg_0", "=", "tf", ".", "nn", ".", "sigmoid", "(", "arg_0", ")", "*", "arg_0", "return", "arg_0"], "function": "def Func(arg_0, arg_1='Func'):\n    \"\"\"Swish function.\n\n     See `Swish: a Self-Gated Activation Function <https://arxiv.org/abs/1710.05941>`__.\n\n    Parameters\n    ----------\n    x : Tensor\n        input.\n    name: str\n        function name (optional).\n\n    Returns\n    -------\n    Tensor\n        A ``Tensor`` in the same type as ``x``.\n\n    \"\"\"\n    with tf.name_scope(arg_1):\n        arg_0 = tf.nn.sigmoid(arg_0) * arg_0\n    return arg_0", "path": "tensorlayer/activation.py", "identifier": "swish", "docstring": "Swish function.\n\n     See `Swish: a Self-Gated Activation Function <https://arxiv.org/abs/1710.05941>`__.\n\n    Parameters\n    ----------\n    x : Tensor\n        input.\n    name: str\n        function name (optional).\n\n    Returns\n    -------\n    Tensor\n        A ``Tensor`` in the same type as ``x``.", "docstring_tokens": ["Swish", "function", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 254321}
{"url": "https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/similarity_distance.py#L160-L178", "sha": "cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3", "docstring_summary": "Returns the value of the nearest neighbor from the training set.", "language": "python", "parameters": "(self, X)", "return_statement": "return self.tree.query(X)[0].flatten()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check_is_fitted", "(", "arg_0", ",", "[", "'tree'", "]", ")", "arg_1", "=", "check_array", "(", "arg_1", ")", "return", "arg_0", ".", "tree", ".", "query", "(", "arg_1", ")", "[", "0", "]", ".", "flatten", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns the value of the nearest neighbor from the training set.\n\n        Parameters\n        ----------\n         X : array-like or sparse matrix, shape (n_samples, n_features)\n            The input samples. Internally, it will be converted to\n            ``dtype=np.float32`` and if a sparse matrix is provided\n            to a sparse ``csr_matrix``.\n\n        Returns\n        -------\n        y : array, shape (n_samples,)\n        \"\"\"\n        # Check is fit had been called\n        check_is_fitted(arg_0, ['tree'])\n        # Check data\n        arg_1 = check_array(arg_1)\n        return arg_0.tree.query(arg_1)[0].flatten()", "path": "CIMtools/applicability_domain/similarity_distance.py", "identifier": "SimilarityDistance.predict_proba", "docstring": "Returns the value of the nearest neighbor from the training set.\n\n        Parameters\n        ----------\n         X : array-like or sparse matrix, shape (n_samples, n_features)\n            The input samples. Internally, it will be converted to\n            ``dtype=np.float32`` and if a sparse matrix is provided\n            to a sparse ``csr_matrix``.\n\n        Returns\n        -------\n        y : array, shape (n_samples,)", "docstring_tokens": ["Returns", "the", "value", "of", "the", "nearest", "neighbor", "from", "the", "training", "set", "."], "nwo": "stsouko/CIMtools", "score": 0.37700202640577024, "idx": 254322}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_platform.py#L127-L146", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Calls `get_app_data_dir` but ensures the directory exists.", "language": "python", "parameters": "(appname, *args)", "return_statement": "return dpath", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "from", "ubelt", "import", "util_path", "arg_2", "=", "get_app_data_dir", "(", "arg_0", ",", "*", "arg_1", ")", "util_path", ".", "ensuredir", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, *arg_1):\n    \"\"\"\n    Calls `get_app_data_dir` but ensures the directory exists.\n\n    Args:\n        appname (str): the name of the application\n        *args: any other subdirectories may be specified\n\n    SeeAlso:\n        get_app_data_dir\n\n    Example:\n        >>> import ubelt as ub\n        >>> dpath = ub.Func('ubelt')\n        >>> assert exists(dpath)\n    \"\"\"\n    from ubelt import util_path\n    arg_2 = get_app_data_dir(arg_0, *arg_1)\n    util_path.ensuredir(arg_2)\n    return arg_2", "path": "ubelt/util_platform.py", "identifier": "ensure_app_data_dir", "docstring": "Calls `get_app_data_dir` but ensures the directory exists.\n\n    Args:\n        appname (str): the name of the application\n        *args: any other subdirectories may be specified\n\n    SeeAlso:\n        get_app_data_dir\n\n    Example:\n        >>> import ubelt as ub\n        >>> dpath = ub.ensure_app_data_dir('ubelt')\n        >>> assert exists(dpath)", "docstring_tokens": ["Calls", "get_app_data_dir", "but", "ensures", "the", "directory", "exists", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 254323}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/aws/iam.py#L483-L485", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Fetches the specific IAM group inline-policy document.", "language": "python", "parameters": "(group_name, policy_name, client=None, **kwargs)", "return_statement": "return client.get_group_policy(GroupName=group_name, PolicyName=policy_name, **kwargs)['PolicyDocument']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "arg_2", ".", "get_group_policy", "(", "GroupName", "=", "arg_0", ",", "PolicyName", "=", "arg_1", ",", "**", "arg_3", ")", "[", "'PolicyDocument'", "]"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n    \"\"\"Fetches the specific IAM group inline-policy document.\"\"\"\n    return arg_2.get_group_policy(GroupName=arg_0, PolicyName=arg_1, **arg_3)['PolicyDocument']", "path": "cloudaux/aws/iam.py", "identifier": "get_group_policy_document", "docstring": "Fetches the specific IAM group inline-policy document.", "docstring_tokens": ["Fetches", "the", "specific", "IAM", "group", "inline", "-", "policy", "document", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 254324}
{"url": "https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/models.py#L198-L213", "sha": "c60bc28f16f5d0e62536e76c17d6944a79449ef1", "docstring_summary": "Queue the notification in NoticeQueueBatch. This allows for large amounts\n    of user notifications to be deferred to a seperate process running outside\n    the webserver.", "language": "python", "parameters": "(users, label, extra_context=None, sender=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "{", "}", "if", "isinstance", "(", "arg_0", ",", "QuerySet", ")", ":", "arg_0", "=", "[", "row", "[", "\"pk\"", "]", "for", "row", "in", "arg_0", ".", "values", "(", "\"pk\"", ")", "]", "else", ":", "arg_0", "=", "[", "arg_5", ".", "pk", "for", "arg_5", "in", "arg_0", "]", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ":", "arg_4", ".", "append", "(", "(", "arg_5", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", "NoticeQueueBatch", "(", "pickled_data", "=", "base64", ".", "b64encode", "(", "pickle", ".", "dumps", "(", "arg_4", ")", ")", ")", ".", "save", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    Queue the notification in NoticeQueueBatch. This allows for large amounts\n    of user notifications to be deferred to a seperate process running outside\n    the webserver.\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = {}\n    if isinstance(arg_0, QuerySet):\n        arg_0 = [row[\"pk\"] for row in arg_0.values(\"pk\")]\n    else:\n        arg_0 = [arg_5.pk for arg_5 in arg_0]\n    arg_4 = []\n    for arg_5 in arg_0:\n        arg_4.append((arg_5, arg_1, arg_2, arg_3))\n    NoticeQueueBatch(pickled_data=base64.b64encode(pickle.dumps(arg_4))).save()", "path": "notification/models.py", "identifier": "queue", "docstring": "Queue the notification in NoticeQueueBatch. This allows for large amounts\n    of user notifications to be deferred to a seperate process running outside\n    the webserver.", "docstring_tokens": ["Queue", "the", "notification", "in", "NoticeQueueBatch", ".", "This", "allows", "for", "large", "amounts", "of", "user", "notifications", "to", "be", "deferred", "to", "a", "seperate", "process", "running", "outside", "the", "webserver", "."], "nwo": "GeoNode/geonode-notification", "score": 0.17385480483333982, "idx": 254325}
{"url": "https://github.com/hotdogee/gff3-py/blob/d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9/gff3/gff3.py#L203-L220", "sha": "d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9", "docstring_summary": "checks whether child features are within the coordinate boundaries of parent features", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "lines", ":", "for", "arg_2", "in", "arg_1", "[", "'parents'", "]", ":", "arg_3", "=", "False", "for", "arg_4", "in", "arg_2", ":", "if", "arg_4", "[", "'start'", "]", "<=", "arg_1", "[", "'start'", "]", "and", "arg_1", "[", "'end'", "]", "<=", "arg_4", "[", "'end'", "]", ":", "arg_3", "=", "True", "break", "if", "not", "arg_3", ":", "arg_0", ".", "add_line_error", "(", "arg_1", ",", "{", "'message'", ":", "'This feature is not contained within the feature boundaries of parent: {0:s}: {1:s}'", ".", "format", "(", "arg_2", "[", "0", "]", "[", "'attributes'", "]", "[", "'ID'", "]", ",", "','", ".", "join", "(", "[", "'({0:s}, {1:d}, {2:d})'", ".", "format", "(", "arg_1", "[", "'seqid'", "]", ",", "arg_1", "[", "'start'", "]", ",", "arg_1", "[", "'end'", "]", ")", "for", "arg_1", "in", "arg_2", "]", ")", ")", ",", "'error_type'", ":", "'BOUNDS'", ",", "'location'", ":", "'parent_boundary'", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        checks whether child features are within the coordinate boundaries of parent features\n\n        :return:\n        \"\"\"\n        for arg_1 in arg_0.lines:\n            for arg_2 in arg_1['parents']:\n                arg_3 = False\n                for arg_4 in arg_2:\n                    if arg_4['start'] <= arg_1['start'] and arg_1['end'] <= arg_4['end']:\n                        arg_3 = True\n                        break\n                if not arg_3:\n                    arg_0.add_line_error(arg_1, {'message': 'This feature is not contained within the feature boundaries of parent: {0:s}: {1:s}'.format(\n                        arg_2[0]['attributes']['ID'],\n                        ','.join(['({0:s}, {1:d}, {2:d})'.format(arg_1['seqid'], arg_1['start'], arg_1['end']) for arg_1 in arg_2])\n                    ), 'error_type': 'BOUNDS', 'location': 'parent_boundary'})", "path": "gff3/gff3.py", "identifier": "Gff3.check_parent_boundary", "docstring": "checks whether child features are within the coordinate boundaries of parent features\n\n        :return:", "docstring_tokens": ["checks", "whether", "child", "features", "are", "within", "the", "coordinate", "boundaries", "of", "parent", "features"], "nwo": "hotdogee/gff3-py", "score": 0.18384731799856882, "idx": 254326}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py#L506-L513", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Given a plain text version of an In prompt, returns an HTML\n            continuation prompt.", "language": "python", "parameters": "(self, prompt)", "return_statement": "return '<span class=\"in-prompt\">%s</span>' % body", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'...: '", "arg_3", "=", "len", "(", "arg_1", ".", "lstrip", "(", "'\\n'", ")", ")", "-", "len", "(", "arg_2", ")", "arg_4", "=", "'&nbsp;'", "*", "arg_3", "+", "arg_2", "return", "'<span class=\"in-prompt\">%s</span>'", "%", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Given a plain text version of an In prompt, returns an HTML\n            continuation prompt.\n        \"\"\"\n        arg_2 = '...: '\n        arg_3 = len(arg_1.lstrip('\\n')) - len(arg_2)\n        arg_4 = '&nbsp;' * arg_3 + arg_2\n        return '<span class=\"in-prompt\">%s</span>' % arg_4", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py", "identifier": "IPythonWidget._make_continuation_prompt", "docstring": "Given a plain text version of an In prompt, returns an HTML\n            continuation prompt.", "docstring_tokens": ["Given", "a", "plain", "text", "version", "of", "an", "In", "prompt", "returns", "an", "HTML", "continuation", "prompt", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254327}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L422-L552", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Split the code object into a list of `Chunk` objects.", "language": "python", "parameters": "(self)", "return_statement": "return chunks", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "None", "arg_3", "=", "dict", "(", "arg_0", ".", "_bytes_lines", "(", ")", ")", "arg_4", "=", "[", "]", "arg_5", "=", "0", "arg_6", "=", "arg_14", "=", "None", "arg_7", "=", "set", "(", ")", "arg_8", "=", "list", "(", "ByteCodes", "(", "arg_0", ".", "code", ".", "co_code", ")", ")", "for", "arg_9", "in", "arg_8", ":", "if", "arg_9", ".", "jump_to", ">=", "0", ":", "arg_7", ".", "add", "(", "arg_9", ".", "jump_to", ")", "arg_10", "=", "0", "for", "arg_9", "in", "arg_8", ":", "arg_11", "=", "False", "arg_12", "=", "False", "if", "arg_9", ".", "offset", "in", "arg_3", ":", "arg_11", "=", "True", "arg_10", "=", "arg_3", "[", "arg_9", ".", "offset", "]", "arg_12", "=", "True", "elif", "arg_9", ".", "offset", "in", "arg_7", ":", "arg_11", "=", "True", "elif", "arg_9", ".", "op", "in", "OPS_CHUNK_BEGIN", ":", "arg_11", "=", "True", "if", "not", "arg_2", "or", "arg_11", ":", "if", "arg_2", ":", "arg_2", ".", "exits", ".", "add", "(", "arg_9", ".", "offset", ")", "arg_2", "=", "Chunk", "(", "arg_9", ".", "offset", ",", "arg_10", ",", "arg_12", ")", "arg_1", ".", "append", "(", "arg_2", ")", "if", "arg_9", ".", "jump_to", ">=", "0", "and", "arg_9", ".", "op", "not", "in", "OPS_NO_JUMP", ":", "if", "arg_5", ":", "arg_5", "-=", "1", "else", ":", "arg_2", ".", "exits", ".", "add", "(", "arg_9", ".", "jump_to", ")", "if", "arg_9", ".", "op", "in", "OPS_CODE_END", ":", "arg_2", ".", "exits", ".", "add", "(", "-", "arg_0", ".", "code", ".", "co_firstlineno", ")", "if", "arg_9", ".", "op", "in", "OPS_PUSH_BLOCK", ":", "arg_4", ".", "append", "(", "(", "arg_9", ".", "op", ",", "arg_9", ".", "jump_to", ")", ")", "if", "arg_9", ".", "op", "in", "OPS_POP_BLOCK", ":", "arg_4", ".", "pop", "(", ")", "if", "arg_9", ".", "op", "in", "OPS_CHUNK_END", ":", "if", "arg_9", ".", "op", "==", "OP_BREAK_LOOP", ":", "arg_2", ".", "exits", ".", "add", "(", "arg_4", "[", "-", "1", "]", "[", "1", "]", ")", "arg_2", "=", "None", "if", "arg_9", ".", "op", "==", "OP_END_FINALLY", ":", "for", "arg_13", "in", "reversed", "(", "arg_4", ")", ":", "if", "arg_13", "[", "0", "]", "in", "OPS_EXCEPT_BLOCKS", ":", "arg_2", ".", "exits", ".", "add", "(", "arg_13", "[", "1", "]", ")", "break", "if", "arg_9", ".", "op", "==", "OP_COMPARE_OP", "and", "arg_9", ".", "arg", "==", "COMPARE_EXCEPTION", ":", "arg_5", "+=", "1", "arg_14", "=", "arg_6", "arg_6", "=", "arg_9", "if", "arg_1", ":", "if", "arg_6", "and", "arg_14", ":", "if", "arg_14", ".", "op", "==", "OP_LOAD_CONST", "and", "arg_6", ".", "op", "==", "OP_RETURN_VALUE", ":", "if", "arg_0", ".", "code", ".", "co_consts", "[", "arg_14", ".", "arg", "]", "is", "None", ":", "if", "arg_1", "[", "-", "1", "]", ".", "byte", "!=", "arg_14", ".", "offset", ":", "arg_15", "=", "-", "arg_0", ".", "code", ".", "co_firstlineno", "arg_16", "=", "arg_1", "[", "-", "1", "]", "arg_16", ".", "exits", ".", "remove", "(", "arg_15", ")", "arg_16", ".", "exits", ".", "add", "(", "arg_14", ".", "offset", ")", "arg_2", "=", "Chunk", "(", "arg_14", ".", "offset", ",", "arg_16", ".", "line", ",", "False", ")", "arg_2", ".", "exits", ".", "add", "(", "arg_15", ")", "arg_1", ".", "append", "(", "arg_2", ")", "arg_1", "[", "-", "1", "]", ".", "length", "=", "arg_9", ".", "next_offset", "-", "arg_1", "[", "-", "1", "]", ".", "byte", "for", "arg_18", "in", "range", "(", "len", "(", "arg_1", ")", "-", "1", ")", ":", "arg_1", "[", "arg_18", "]", ".", "length", "=", "arg_1", "[", "arg_18", "+", "1", "]", ".", "byte", "-", "arg_1", "[", "arg_18", "]", ".", "byte", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Split the code object into a list of `Chunk` objects.\n\n        Each chunk is only entered at its first instruction, though there can\n        be many exits from a chunk.\n\n        Returns a list of `Chunk` objects.\n\n        \"\"\"\n        # The list of chunks so far, and the one we're working on.\n        arg_1 = []\n        arg_2 = None\n\n        # A dict mapping byte offsets of line starts to the line numbers.\n        arg_3 = dict(arg_0._bytes_lines())\n\n        # The block stack: loops and try blocks get pushed here for the\n        # implicit jumps that can occur.\n        # Each entry is a tuple: (block type, destination)\n        arg_4 = []\n\n        # Some op codes are followed by branches that should be ignored.  This\n        # is a count of how many ignores are left.\n        arg_5 = 0\n\n        # We have to handle the last two bytecodes specially.\n        arg_6 = arg_14 = None\n\n        # Get a set of all of the jump-to points.\n        arg_7 = set()\n        arg_8 = list(ByteCodes(arg_0.code.co_code))\n        for arg_9 in arg_8:\n            if arg_9.jump_to >= 0:\n                arg_7.add(arg_9.jump_to)\n\n        arg_10 = 0\n\n        # Walk the byte codes building chunks.\n        for arg_9 in arg_8:\n            # Maybe have to start a new chunk\n            arg_11 = False\n            arg_12 = False\n            if arg_9.offset in arg_3:\n                # Start a new chunk for each source line number.\n                arg_11 = True\n                arg_10 = arg_3[arg_9.offset]\n                arg_12 = True\n            elif arg_9.offset in arg_7:\n                # To make chunks have a single entrance, we have to make a new\n                # chunk when we get to a place some bytecode jumps to.\n                arg_11 = True\n            elif arg_9.op in OPS_CHUNK_BEGIN:\n                # Jumps deserve their own unnumbered chunk.  This fixes\n                # problems with jumps to jumps getting confused.\n                arg_11 = True\n\n            if not arg_2 or arg_11:\n                if arg_2:\n                    arg_2.exits.add(arg_9.offset)\n                arg_2 = Chunk(arg_9.offset, arg_10, arg_12)\n                arg_1.append(arg_2)\n\n            # Look at the opcode\n            if arg_9.jump_to >= 0 and arg_9.op not in OPS_NO_JUMP:\n                if arg_5:\n                    # Someone earlier wanted us to ignore this branch.\n                    arg_5 -= 1\n                else:\n                    # The opcode has a jump, it's an exit for this chunk.\n                    arg_2.exits.add(arg_9.jump_to)\n\n            if arg_9.op in OPS_CODE_END:\n                # The opcode can exit the code object.\n                arg_2.exits.add(-arg_0.code.co_firstlineno)\n            if arg_9.op in OPS_PUSH_BLOCK:\n                # The opcode adds a block to the block_stack.\n                arg_4.append((arg_9.op, arg_9.jump_to))\n            if arg_9.op in OPS_POP_BLOCK:\n                # The opcode pops a block from the block stack.\n                arg_4.pop()\n            if arg_9.op in OPS_CHUNK_END:\n                # This opcode forces the end of the chunk.\n                if arg_9.op == OP_BREAK_LOOP:\n                    # A break is implicit: jump where the top of the\n                    # block_stack points.\n                    arg_2.exits.add(arg_4[-1][1])\n                arg_2 = None\n            if arg_9.op == OP_END_FINALLY:\n                # For the finally clause we need to find the closest exception\n                # block, and use its jump target as an exit.\n                for arg_13 in reversed(arg_4):\n                    if arg_13[0] in OPS_EXCEPT_BLOCKS:\n                        arg_2.exits.add(arg_13[1])\n                        break\n            if arg_9.op == OP_COMPARE_OP and arg_9.arg == COMPARE_EXCEPTION:\n                # This is an except clause.  We want to overlook the next\n                # branch, so that except's don't count as branches.\n                arg_5 += 1\n\n            arg_14 = arg_6\n            arg_6 = arg_9\n\n        if arg_1:\n            # The last two bytecodes could be a dummy \"return None\" that\n            # shouldn't be counted as real code. Every Python code object seems\n            # to end with a return, and a \"return None\" is inserted if there\n            # isn't an explicit return in the source.\n            if arg_6 and arg_14:\n                if arg_14.op == OP_LOAD_CONST and arg_6.op == OP_RETURN_VALUE:\n                    if arg_0.code.co_consts[arg_14.arg] is None:\n                        # This is \"return None\", but is it dummy?  A real line\n                        # would be a last chunk all by itself.\n                        if arg_1[-1].byte != arg_14.offset:\n                            arg_15 = -arg_0.code.co_firstlineno\n                            # Split the last chunk\n                            arg_16 = arg_1[-1]\n                            arg_16.exits.remove(arg_15)\n                            arg_16.exits.add(arg_14.offset)\n                            arg_2 = Chunk(\n                                arg_14.offset, arg_16.line, False\n                            )\n                            arg_2.exits.add(arg_15)\n                            arg_1.append(arg_2)\n\n            # Give all the chunks a length.\n            arg_1[-1].length = arg_9.next_offset - arg_1[-1].byte # pylint: disable=W0631,C0301\n            for arg_18 in range(len(arg_1)-1):\n                arg_1[arg_18].length = arg_1[arg_18+1].byte - arg_1[arg_18].byte\n\n        #self.validate_chunks(chunks)\n        return arg_1", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py", "identifier": "ByteParser._split_into_chunks", "docstring": "Split the code object into a list of `Chunk` objects.\n\n        Each chunk is only entered at its first instruction, though there can\n        be many exits from a chunk.\n\n        Returns a list of `Chunk` objects.", "docstring_tokens": ["Split", "the", "code", "object", "into", "a", "list", "of", "Chunk", "objects", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 254328}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/tuio/__init__.py#L33-L41", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Opens the socket and binds to the given host and port. Uses\n        SO_REUSEADDR to be as robust as possible.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "socket", "=", "arg_1", ".", "socket", "(", "arg_1", ".", "AF_INET", ",", "arg_1", ".", "SOCK_DGRAM", ")", "arg_0", ".", "socket", ".", "setsockopt", "(", "arg_1", ".", "SOL_SOCKET", ",", "arg_1", ".", "SO_REUSEADDR", ",", "1", ")", "arg_0", ".", "socket", ".", "setblocking", "(", "0", ")", "arg_0", ".", "socket", ".", "bind", "(", "(", "arg_0", ".", "host", ",", "arg_0", ".", "port", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Opens the socket and binds to the given host and port. Uses\n        SO_REUSEADDR to be as robust as possible.\n        \"\"\"\n        arg_0.socket = arg_1.socket(arg_1.AF_INET, arg_1.SOCK_DGRAM)\n        arg_0.socket.setsockopt(arg_1.SOL_SOCKET, arg_1.SO_REUSEADDR, 1)\n        arg_0.socket.setblocking(0)\n        arg_0.socket.bind((arg_0.host, arg_0.port))", "path": "lib/tuio/__init__.py", "identifier": "Tracking.open_socket", "docstring": "Opens the socket and binds to the given host and port. Uses\n        SO_REUSEADDR to be as robust as possible.", "docstring_tokens": ["Opens", "the", "socket", "and", "binds", "to", "the", "given", "host", "and", "port", ".", "Uses", "SO_REUSEADDR", "to", "be", "as", "robust", "as", "possible", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 254329}
{"url": "https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/dates.py#L68-L78", "sha": "188e1bf1f15a44d9a599028d020083af9fb43ea7", "docstring_summary": "Returns the end date for a model instance", "language": "python", "parameters": "(self, obj)", "return_statement": "return obj_date", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "arg_1", ",", "arg_0", ".", "Func_field", "(", ")", ")", "try", ":", "arg_2", "=", "arg_2", ".", "date", "(", ")", "except", "AttributeError", ":", "pass", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns the end date for a model instance\n        \"\"\"\n        arg_2 = getattr(arg_1, arg_0.Func_field())\n        try:\n            arg_2 = arg_2.date()\n        except AttributeError:\n            # It's a date rather than datetime, so we use it as is\n            pass\n        return arg_2", "path": "extra_views/dates.py", "identifier": "BaseCalendarMonthView.get_end_date", "docstring": "Returns the end date for a model instance", "docstring_tokens": ["Returns", "the", "end", "date", "for", "a", "model", "instance"], "nwo": "AndrewIngram/django-extra-views", "score": 0.5916871811422788, "idx": 254330}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/heatmaps.py#L485-L542", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Change the value range of a heatmap from one min-max to another min-max.", "language": "python", "parameters": "(cls, arr, source, target)", "return_statement": "return arr_target", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "ia", ".", "do_assert", "(", "ia", ".", "is_np_array", "(", "arg_1", ")", ")", "if", "isinstance", "(", "arg_2", ",", "HeatmapsOnImage", ")", ":", "arg_2", "=", "(", "arg_2", ".", "min_value", ",", "arg_2", ".", "max_value", ")", "else", ":", "ia", ".", "do_assert", "(", "isinstance", "(", "arg_2", ",", "tuple", ")", ")", "ia", ".", "do_assert", "(", "len", "(", "arg_2", ")", "==", "2", ")", "ia", ".", "do_assert", "(", "arg_2", "[", "0", "]", "<", "arg_2", "[", "1", "]", ")", "if", "isinstance", "(", "arg_3", ",", "HeatmapsOnImage", ")", ":", "arg_3", "=", "(", "arg_3", ".", "min_value", ",", "arg_3", ".", "max_value", ")", "else", ":", "ia", ".", "do_assert", "(", "isinstance", "(", "arg_3", ",", "tuple", ")", ")", "ia", ".", "do_assert", "(", "len", "(", "arg_3", ")", "==", "2", ")", "ia", ".", "do_assert", "(", "arg_3", "[", "0", "]", "<", "arg_3", "[", "1", "]", ")", "arg_4", "=", "np", ".", "finfo", "(", "arg_1", ".", "dtype", ")", ".", "eps", "arg_5", "=", "arg_2", "[", "0", "]", "-", "10", "*", "arg_4", "<", "arg_3", "[", "0", "]", "<", "arg_2", "[", "0", "]", "+", "10", "*", "arg_4", "arg_6", "=", "arg_2", "[", "1", "]", "-", "10", "*", "arg_4", "<", "arg_3", "[", "1", "]", "<", "arg_2", "[", "1", "]", "+", "10", "*", "arg_4", "if", "arg_5", "and", "arg_6", ":", "return", "np", ".", "copy", "(", "arg_1", ")", "arg_7", ",", "arg_8", "=", "arg_2", "arg_9", ",", "arg_10", "=", "arg_3", "arg_11", "=", "arg_8", "-", "arg_7", "arg_12", "=", "arg_10", "-", "arg_9", "arg_13", "=", "(", "arg_1", "-", "arg_7", ")", "/", "arg_11", "arg_14", "=", "arg_9", "+", "arg_13", "*", "arg_12", "return", "arg_14"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Change the value range of a heatmap from one min-max to another min-max.\n\n        E.g. the value range may be changed from min=0.0, max=1.0 to min=-1.0, max=1.0.\n\n        Parameters\n        ----------\n        arr : ndarray\n            Heatmap array to modify.\n\n        source : tuple of float\n            Current value range of the input array, given as (min, max), where both are float values.\n\n        target : tuple of float\n            Desired output value range of the array, given as (min, max), where both are float values.\n\n        Returns\n        -------\n        arr_target : ndarray\n            Input array, with value range projected to the desired target value range.\n\n        \"\"\"\n        ia.do_assert(ia.is_np_array(arg_1))\n\n        if isinstance(arg_2, HeatmapsOnImage):\n            arg_2 = (arg_2.min_value, arg_2.max_value)\n        else:\n            ia.do_assert(isinstance(arg_2, tuple))\n            ia.do_assert(len(arg_2) == 2)\n            ia.do_assert(arg_2[0] < arg_2[1])\n\n        if isinstance(arg_3, HeatmapsOnImage):\n            arg_3 = (arg_3.min_value, arg_3.max_value)\n        else:\n            ia.do_assert(isinstance(arg_3, tuple))\n            ia.do_assert(len(arg_3) == 2)\n            ia.do_assert(arg_3[0] < arg_3[1])\n\n        # Check if source and target are the same (with a tiny bit of tolerance)\n        # if so, evade compuation and just copy the array instead.\n        # This is reasonable, as source and target will often both be (0.0, 1.0).\n        arg_4 = np.finfo(arg_1.dtype).eps\n        arg_5 = arg_2[0] - 10*arg_4 < arg_3[0] < arg_2[0] + 10*arg_4\n        arg_6 = arg_2[1] - 10*arg_4 < arg_3[1] < arg_2[1] + 10*arg_4\n        if arg_5 and arg_6:\n            return np.copy(arg_1)\n\n        arg_7, arg_8 = arg_2\n        arg_9, arg_10 = arg_3\n\n        arg_11 = arg_8 - arg_7\n        arg_12 = arg_10 - arg_9\n\n        arg_13 = (arg_1 - arg_7) / arg_11\n        arg_14 = arg_9 + arg_13 * arg_12\n\n        return arg_14", "path": "imgaug/augmentables/heatmaps.py", "identifier": "HeatmapsOnImage.change_normalization", "docstring": "Change the value range of a heatmap from one min-max to another min-max.\n\n        E.g. the value range may be changed from min=0.0, max=1.0 to min=-1.0, max=1.0.\n\n        Parameters\n        ----------\n        arr : ndarray\n            Heatmap array to modify.\n\n        source : tuple of float\n            Current value range of the input array, given as (min, max), where both are float values.\n\n        target : tuple of float\n            Desired output value range of the array, given as (min, max), where both are float values.\n\n        Returns\n        -------\n        arr_target : ndarray\n            Input array, with value range projected to the desired target value range.", "docstring_tokens": ["Change", "the", "value", "range", "of", "a", "heatmap", "from", "one", "min", "-", "max", "to", "another", "min", "-", "max", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254331}
{"url": "https://github.com/MycroftAI/padatious/blob/794a2530d6079bdd06e193edd0d30b2cc793e631/padatious/intent_container.py#L241-L256", "sha": "794a2530d6079bdd06e193edd0d30b2cc793e631", "docstring_summary": "Tests all the intents against the query and returns\n        match data of the best intent", "language": "python", "parameters": "(self, query)", "return_statement": "return min(best_matches, key=lambda x: sum(map(len, x.matches.values())))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "Funcs", "(", "arg_1", ")", "if", "len", "(", "arg_2", ")", "==", "0", ":", "return", "MatchData", "(", "''", ",", "''", ")", "arg_3", "=", "max", "(", "arg_2", ",", "key", "=", "lambda", "x", ":", "x", ".", "conf", ")", "arg_4", "=", "(", "match", "for", "match", "in", "arg_2", "if", "match", ".", "conf", "==", "arg_3", ".", "conf", ")", "return", "min", "(", "arg_4", ",", "key", "=", "lambda", "x", ":", "sum", "(", "map", "(", "len", ",", "x", ".", "matches", ".", "values", "(", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Tests all the intents against the query and returns\n        match data of the best intent\n\n        Args:\n            query (str): Input sentence to test against intents\n        Returns:\n            MatchData: Best intent match\n        \"\"\"\n        arg_2 = arg_0.Funcs(arg_1)\n        if len(arg_2) == 0:\n            return MatchData('', '')\n        arg_3 = max(arg_2, key=lambda x: x.conf)\n        arg_4 = (match for match in arg_2 if match.conf == arg_3.conf)\n        return min(arg_4, key=lambda x: sum(map(len, x.matches.values())))", "path": "padatious/intent_container.py", "identifier": "IntentContainer.calc_intent", "docstring": "Tests all the intents against the query and returns\n        match data of the best intent\n\n        Args:\n            query (str): Input sentence to test against intents\n        Returns:\n            MatchData: Best intent match", "docstring_tokens": ["Tests", "all", "the", "intents", "against", "the", "query", "and", "returns", "match", "data", "of", "the", "best", "intent"], "nwo": "MycroftAI/padatious", "score": 0.4588892726323654, "idx": 254332}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L1964-L1975", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Out Of Phase Stereo effect. Mixes stereo to twin-mono where each\n        mono channel contains the difference between the left and right stereo\n        channels. This is sometimes known as the 'karaoke' effect as it often\n        has the effect of removing most or all of the vocals from a recording.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "'Func'", "]", "arg_0", ".", "effects", ".", "extend", "(", "arg_1", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        '''Out Of Phase Stereo effect. Mixes stereo to twin-mono where each\n        mono channel contains the difference between the left and right stereo\n        channels. This is sometimes known as the 'karaoke' effect as it often\n        has the effect of removing most or all of the vocals from a recording.\n\n        '''\n        arg_1 = ['Func']\n        arg_0.effects.extend(arg_1)\n        arg_0.effects_log.append('Func')\n\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.oops", "docstring": "Out Of Phase Stereo effect. Mixes stereo to twin-mono where each\n        mono channel contains the difference between the left and right stereo\n        channels. This is sometimes known as the 'karaoke' effect as it often\n        has the effect of removing most or all of the vocals from a recording.", "docstring_tokens": ["Out", "Of", "Phase", "Stereo", "effect", ".", "Mixes", "stereo", "to", "twin", "-", "mono", "where", "each", "mono", "channel", "contains", "the", "difference", "between", "the", "left", "and", "right", "stereo", "channels", ".", "This", "is", "sometimes", "known", "as", "the", "karaoke", "effect", "as", "it", "often", "has", "the", "effect", "of", "removing", "most", "or", "all", "of", "the", "vocals", "from", "a", "recording", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 254333}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L73-L88", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Decorator to append default kwargs to a function.", "language": "python", "parameters": "(defaults)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "arg_2", "=", "dict", "(", "header", "=", "'Keyword arguments\\n-----------------\\n'", ",", "indent", "=", "'  '", ",", "footer", "=", "'\\n'", ")", "arg_3", "=", "defaults_docstring", "(", "arg_0", ",", "**", "arg_2", ")", "if", "arg_1", ".", "__doc__", "is", "None", ":", "arg_1", ".", "__doc__", "=", "''", "arg_1", ".", "__doc__", "+=", "arg_3", "return", "arg_1", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"Decorator to append default kwargs to a function.\n    \"\"\"\n    def decorator(arg_1):\n        \"\"\"Function that appends default kwargs to a function.\n        \"\"\"\n        arg_2 = dict(header='Keyword arguments\\n-----------------\\n', \n                      indent='  ',\n                      footer='\\n')\n        arg_3 = defaults_docstring(arg_0, **arg_2)\n        if arg_1.__doc__ is None:\n            arg_1.__doc__ = ''\n        arg_1.__doc__ += arg_3\n        return arg_1\n\n    return decorator", "path": "pymodeler/parameter.py", "identifier": "defaults_decorator", "docstring": "Decorator to append default kwargs to a function.", "docstring_tokens": ["Decorator", "to", "append", "default", "kwargs", "to", "a", "function", "."], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 254334}
{"url": "https://github.com/amorison/loam/blob/a566c943a75e068a4510099331a1ddfe5bbbdd94/loam/manager.py#L339-L349", "sha": "a566c943a75e068a4510099331a1ddfe5bbbdd94", "docstring_summary": "Update values of configuration options with dict.", "language": "python", "parameters": "(self, conf_dict, conf_arg=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "arg_0", "[", "arg_3", "]", ".", "Func", "(", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Update values of configuration options with dict.\n\n        Args:\n            conf_dict (dict): dict of dict indexed with section and option\n                names.\n            conf_arg (bool): if True, only options that can be set in a config\n                file are updated.\n        \"\"\"\n        for arg_3, arg_4 in arg_1.items():\n            arg_0[arg_3].Func(arg_4, arg_2)", "path": "loam/manager.py", "identifier": "ConfigurationManager.update_", "docstring": "Update values of configuration options with dict.\n\n        Args:\n            conf_dict (dict): dict of dict indexed with section and option\n                names.\n            conf_arg (bool): if True, only options that can be set in a config\n                file are updated.", "docstring_tokens": ["Update", "values", "of", "configuration", "options", "with", "dict", "."], "nwo": "amorison/loam", "score": 0.14991498758945482, "idx": 254335}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L1678-L1719", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Query the Hub's TaskRecord database", "language": "python", "parameters": "(self, query, keys=None)", "return_statement": "return records", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_2", ",", "basestring", ")", ":", "arg_2", "=", "[", "arg_2", "]", "arg_3", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "_query_socket", ",", "\"db_request\"", ",", "arg_3", "=", "arg_3", ")", "arg_4", ",", "arg_5", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_0", ".", "_query_socket", ",", "0", ")", "if", "arg_0", ".", "debug", ":", "pprint", "(", "arg_5", ")", "arg_3", "=", "arg_5", "[", "'content'", "]", "if", "arg_3", "[", "'status'", "]", "!=", "'ok'", ":", "raise", "arg_0", ".", "_unwrap_exception", "(", "arg_3", ")", "arg_6", "=", "arg_3", "[", "'records'", "]", "arg_7", "=", "arg_3", "[", "'buffer_lens'", "]", "arg_8", "=", "arg_3", "[", "'result_buffer_lens'", "]", "arg_9", "=", "arg_5", "[", "'buffers'", "]", "arg_10", "=", "arg_7", "is", "not", "None", "arg_11", "=", "arg_8", "is", "not", "None", "for", "arg_12", ",", "arg_13", "in", "enumerate", "(", "arg_6", ")", ":", "if", "arg_10", ":", "arg_14", "=", "arg_7", "[", "arg_12", "]", "arg_13", "[", "'buffers'", "]", ",", "arg_9", "=", "arg_9", "[", ":", "arg_14", "]", ",", "arg_9", "[", "arg_14", ":", "]", "if", "arg_11", ":", "arg_14", "=", "arg_8", "[", "arg_12", "]", "arg_13", "[", "'result_buffers'", "]", ",", "arg_9", "=", "arg_9", "[", ":", "arg_14", "]", ",", "arg_9", "[", "arg_14", ":", "]", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Query the Hub's TaskRecord database\n\n        This will return a list of task record dicts that match `query`\n\n        Parameters\n        ----------\n\n        query : mongodb query dict\n            The search dict. See mongodb query docs for details.\n        keys : list of strs [optional]\n            The subset of keys to be returned.  The default is to fetch everything but buffers.\n            'msg_id' will *always* be included.\n        \"\"\"\n        if isinstance(arg_2, basestring):\n            arg_2 = [arg_2]\n        arg_3 = dict(arg_1=arg_1, arg_2=arg_2)\n        arg_0.session.send(arg_0._query_socket, \"db_request\", arg_3=arg_3)\n        arg_4, arg_5 = arg_0.session.recv(arg_0._query_socket, 0)\n        if arg_0.debug:\n            pprint(arg_5)\n        arg_3 = arg_5['content']\n        if arg_3['status'] != 'ok':\n            raise arg_0._unwrap_exception(arg_3)\n\n        arg_6 = arg_3['records']\n\n        arg_7 = arg_3['buffer_lens']\n        arg_8 = arg_3['result_buffer_lens']\n        arg_9 = arg_5['buffers']\n        arg_10 = arg_7 is not None\n        arg_11 = arg_8 is not None\n        for arg_12,arg_13 in enumerate(arg_6):\n            # relink buffers\n            if arg_10:\n                arg_14 = arg_7[arg_12]\n                arg_13['buffers'], arg_9 = arg_9[:arg_14],arg_9[arg_14:]\n            if arg_11:\n                arg_14 = arg_8[arg_12]\n                arg_13['result_buffers'], arg_9 = arg_9[:arg_14],arg_9[arg_14:]\n\n        return arg_6", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client.db_query", "docstring": "Query the Hub's TaskRecord database\n\n        This will return a list of task record dicts that match `query`\n\n        Parameters\n        ----------\n\n        query : mongodb query dict\n            The search dict. See mongodb query docs for details.\n        keys : list of strs [optional]\n            The subset of keys to be returned.  The default is to fetch everything but buffers.\n            'msg_id' will *always* be included.", "docstring_tokens": ["Query", "the", "Hub", "s", "TaskRecord", "database"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254336}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/kiss_metrics.py#L48-L59", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "KISSinsights tracking template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return KissMetricsNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "KissMetricsNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    KISSinsights tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your KISSmetrics API key in the ``KISS_METRICS_API_KEY``\n    setting.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return KissMetricsNode()", "path": "analytical/templatetags/kiss_metrics.py", "identifier": "kiss_metrics", "docstring": "KISSinsights tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your KISSmetrics API key in the ``KISS_METRICS_API_KEY``\n    setting.", "docstring_tokens": ["KISSinsights", "tracking", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 254337}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/widgets.py#L108-L113", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Build an attribute dictionary.", "language": "python", "parameters": "(self, base_attrs, extra_attrs=None)", "return_statement": "return attrs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_1", ".", "copy", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_3", ".", "update", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Build an attribute dictionary.\"\"\"\n        arg_3 = arg_1.copy()\n        if arg_2 is not None:\n            arg_3.update(arg_2)\n        return arg_3", "path": "versatileimagefield/widgets.py", "identifier": "ClearableFileInputWithImagePreview.build_attrs", "docstring": "Build an attribute dictionary.", "docstring_tokens": ["Build", "an", "attribute", "dictionary", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 254338}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L512-L517", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Get full-text content for an item", "language": "python", "parameters": "(self, itemkey, **kwargs)", "return_statement": "return self._build_query(query_string)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "\"/{t}/{u}/items/{itemkey}/fulltext\"", ".", "format", "(", "t", "=", "arg_0", ".", "library_type", ",", "u", "=", "arg_0", ".", "library_id", ",", "arg_1", "=", "arg_1", ")", "return", "arg_0", ".", "_build_query", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\" Get full-text content for an item\"\"\"\n        arg_3 = \"/{t}/{u}/items/{itemkey}/fulltext\".format(\n            t=arg_0.library_type, u=arg_0.library_id, arg_1=arg_1\n        )\n        return arg_0._build_query(arg_3)", "path": "pyzotero/zotero.py", "identifier": "Zotero.fulltext_item", "docstring": "Get full-text content for an item", "docstring_tokens": ["Get", "full", "-", "text", "content", "for", "an", "item"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 254339}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/binascii.py#L540-L582", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Run length encoding for binhex4.\n    The CPython implementation does not do run length encoding\n    of \\x90 characters. This implementation does.", "language": "python", "parameters": "(s)", "return_statement": "return ''.join(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "''", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", "[", "0", "]", "arg_3", "=", "1", "if", "arg_0", "[", "-", "1", "]", "==", "'!'", ":", "arg_0", "=", "arg_0", "[", "1", ":", "]", "+", "'?'", "else", ":", "arg_0", "=", "arg_0", "[", "1", ":", "]", "+", "'!'", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", "==", "arg_2", "and", "arg_3", "<", "255", ":", "arg_3", "+=", "1", "else", ":", "if", "arg_3", "==", "1", ":", "if", "arg_2", "!=", "'\\x90'", ":", "arg_1", ".", "append", "(", "arg_2", ")", "else", ":", "arg_1", "+=", "[", "'\\x90'", ",", "'\\x00'", "]", "elif", "arg_3", "<", "4", ":", "if", "arg_2", "!=", "'\\x90'", ":", "arg_1", "+=", "[", "arg_2", "]", "*", "arg_3", "else", ":", "arg_1", "+=", "[", "'\\x90'", ",", "'\\x00'", "]", "*", "arg_3", "else", ":", "if", "arg_2", "!=", "'\\x90'", ":", "arg_1", "+=", "[", "arg_2", ",", "'\\x90'", ",", "chr", "(", "arg_3", ")", "]", "else", ":", "arg_1", "+=", "[", "'\\x90'", ",", "'\\x00'", ",", "'\\x90'", ",", "chr", "(", "arg_3", ")", "]", "arg_3", "=", "1", "arg_2", "=", "arg_4", "return", "''", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Run length encoding for binhex4.\n    The CPython implementation does not do run length encoding\n    of \\x90 characters. This implementation does.\n    \"\"\"\n    if not arg_0:\n        return ''\n    arg_1 = []\n    arg_2 = arg_0[0]\n    arg_3 = 1\n    # Add a dummy character to get the loop to go one extra round.\n    # The dummy must be different from the last character of s.\n    # In the same step we remove the first character, which has\n    # already been stored in prev.\n    if arg_0[-1] == '!':\n        arg_0 = arg_0[1:] + '?'\n    else:\n        arg_0 = arg_0[1:] + '!'\n\n    for arg_4 in arg_0:\n        if arg_4 == arg_2 and arg_3 < 255:\n            arg_3 += 1\n        else:\n            if arg_3 == 1:\n                if arg_2 != '\\x90':\n                    arg_1.append(arg_2)\n                else:\n                    arg_1 += ['\\x90', '\\x00']\n            elif arg_3 < 4:\n                if arg_2 != '\\x90':\n                    arg_1 += [arg_2] * arg_3\n                else:\n                    arg_1 += ['\\x90', '\\x00'] * arg_3\n            else:\n                if arg_2 != '\\x90':\n                    arg_1 += [arg_2, '\\x90', chr(arg_3)]\n                else:\n                    arg_1 += ['\\x90', '\\x00', '\\x90', chr(arg_3)]\n            arg_3 = 1\n            arg_2 = arg_4\n\n    return ''.join(arg_1)", "path": "third_party/pypy/binascii.py", "identifier": "rlecode_hqx", "docstring": "Run length encoding for binhex4.\n    The CPython implementation does not do run length encoding\n    of \\x90 characters. This implementation does.", "docstring_tokens": ["Run", "length", "encoding", "for", "binhex4", ".", "The", "CPython", "implementation", "does", "not", "do", "run", "length", "encoding", "of", "\\", "x90", "characters", ".", "This", "implementation", "does", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 254340}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L502-L517", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Run an iteration of this anomaly classifier", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_constructClassificationRecord", "(", ")", "if", "arg_1", ".", "ROWID", ">=", "arg_0", ".", "_autoDetectWaitRecords", ":", "arg_0", ".", "_updateState", "(", "arg_1", ")", "arg_0", ".", "saved_states", ".", "append", "(", "arg_1", ")", "if", "len", "(", "arg_0", ".", "saved_states", ")", ">", "arg_0", ".", "_history_length", ":", "arg_0", ".", "saved_states", ".", "pop", "(", "0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Run an iteration of this anomaly classifier\n    \"\"\"\n    arg_1 = arg_0._constructClassificationRecord()\n\n    # Classify this point after waiting the classification delay\n    if arg_1.ROWID >= arg_0._autoDetectWaitRecords:\n      arg_0._updateState(arg_1)\n\n    # Save new classification record and keep history as moving window\n    arg_0.saved_states.append(arg_1)\n    if len(arg_0.saved_states) > arg_0._history_length:\n      arg_0.saved_states.pop(0)\n\n    return arg_1", "path": "src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py", "identifier": "HTMPredictionModelClassifierHelper.compute", "docstring": "Run an iteration of this anomaly classifier", "docstring_tokens": ["Run", "an", "iteration", "of", "this", "anomaly", "classifier"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254341}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/typechecks.py#L403-L406", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Check whether the provided value is a valid enum constant.", "language": "python", "parameters": "(self, var)", "return_statement": "return _enum_mangle(var) in self._consts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "_str_type", ")", ":", "return", "False", "return", "_enum_mangle", "(", "arg_1", ")", "in", "arg_0", ".", "_consts"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check whether the provided value is a valid enum constant.\"\"\"\n        if not isinstance(arg_1, _str_type): return False\n        return _enum_mangle(arg_1) in arg_0._consts", "path": "h2o-py/h2o/utils/typechecks.py", "identifier": "Enum.check", "docstring": "Check whether the provided value is a valid enum constant.", "docstring_tokens": ["Check", "whether", "the", "provided", "value", "is", "a", "valid", "enum", "constant", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 254342}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/classifiers/utils.py#L77-L89", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Convert vectors of probabilities to one-hot representations using confident threshold", "language": "python", "parameters": "(proba: [list, np.ndarray], confident_threshold: float, classes:  [list, np.ndarray])", "return_statement": "return labels2onehot(proba2labels(proba, confident_threshold, classes), classes)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "[", "arg_1", ",", "arg_2", ".", "ndarray", "]", ",", "arg_4", ":", "arg_5", ",", "arg_6", ":", "[", "arg_1", ",", "arg_2", ".", "ndarray", "]", ")", "->", "arg_2", ".", "ndarray", ":", "return", "labels2onehot", "(", "proba2labels", "(", "arg_0", ",", "arg_4", ",", "arg_6", ")", ",", "arg_6", ")"], "function": "def Func(arg_0: [arg_1, arg_2.ndarray], arg_4: arg_5, arg_6:  [arg_1, arg_2.ndarray]) -> arg_2.ndarray:\n    \"\"\"\n    Convert vectors of probabilities to one-hot representations using confident threshold\n\n    Args:\n        proba: samples where each sample is a vector of probabilities to belong with given classes\n        confident_threshold: boundary of probability to belong with a class\n        classes: array of classes' names\n\n    Returns:\n        2d array with one-hot representation of given samples\n    \"\"\"\n    return labels2onehot(proba2labels(arg_0, arg_4, arg_6), arg_6)", "path": "deeppavlov/models/classifiers/utils.py", "identifier": "proba2onehot", "docstring": "Convert vectors of probabilities to one-hot representations using confident threshold\n\n    Args:\n        proba: samples where each sample is a vector of probabilities to belong with given classes\n        confident_threshold: boundary of probability to belong with a class\n        classes: array of classes' names\n\n    Returns:\n        2d array with one-hot representation of given samples", "docstring_tokens": ["Convert", "vectors", "of", "probabilities", "to", "one", "-", "hot", "representations", "using", "confident", "threshold"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 254343}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L393-L406", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "vMerge is what docx uses to denote that a table cell is part of a rowspan.\n    The first cell to have a vMerge is the start of the rowspan, and the vMerge\n    will be denoted with 'restart'. If it is anything other than restart then\n    it is a continuation of another rowspan.", "language": "python", "parameters": "(tc)", "return_statement": "return v_merge", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "None", "arg_1", "=", "arg_0", ".", "xpath", "(", "'.//w:vMerge'", ",", "namespaces", "=", "arg_0", ".", "nsmap", ")", "if", "len", "(", "arg_1", ")", "!=", "1", ":", "return", "None", "arg_2", "=", "arg_1", "[", "0", "]", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    vMerge is what docx uses to denote that a table cell is part of a rowspan.\n    The first cell to have a vMerge is the start of the rowspan, and the vMerge\n    will be denoted with 'restart'. If it is anything other than restart then\n    it is a continuation of another rowspan.\n    \"\"\"\n    if arg_0 is None:\n        return None\n    arg_1 = arg_0.xpath('.//w:vMerge', namespaces=arg_0.nsmap)\n    if len(arg_1) != 1:\n        return None\n    arg_2 = arg_1[0]\n    return arg_2", "path": "docx2html/core.py", "identifier": "get_v_merge", "docstring": "vMerge is what docx uses to denote that a table cell is part of a rowspan.\n    The first cell to have a vMerge is the start of the rowspan, and the vMerge\n    will be denoted with 'restart'. If it is anything other than restart then\n    it is a continuation of another rowspan.", "docstring_tokens": ["vMerge", "is", "what", "docx", "uses", "to", "denote", "that", "a", "table", "cell", "is", "part", "of", "a", "rowspan", ".", "The", "first", "cell", "to", "have", "a", "vMerge", "is", "the", "start", "of", "the", "rowspan", "and", "the", "vMerge", "will", "be", "denoted", "with", "restart", ".", "If", "it", "is", "anything", "other", "than", "restart", "then", "it", "is", "a", "continuation", "of", "another", "rowspan", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 254344}
{"url": "https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/main.py#L121-L194", "sha": "074c8452f15a0da638668a4fe139fde06ccfae7f", "docstring_summary": "Turns a coroutine into a gradient based optimizer.", "language": "python", "parameters": "(coro)", "return_statement": "return GradientOptimizer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "class", "GradientOptimizer", "(", "Optimizer", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "__init__", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_1", ".", "algorithm", "=", "arg_0", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_1", ".", "algorithm", ".", "send", "(", "None", ")", "arg_1", ".", "operators", "=", "[", "]", "def", "set_transform", "(", "arg_1", ",", "arg_6", ")", ":", "arg_1", ".", "transform", "=", "compose", "(", "destruct", ",", "arg_6", ",", "arg_1", ".", "restruct", ")", "def", "minimize", "(", "arg_1", ",", "arg_8", ",", "arg_9", ",", "arg_10", "=", "arg_11", ".", "stdout", ",", "arg_13", "=", "1e3", ")", ":", "arg_1", ".", "display", "=", "arg_10", "arg_1", ".", "theta", "=", "arg_9", "arg_15", "=", "arg_1", ".", "algorithm", ".", "send", "(", "destruct", "(", "arg_9", ")", ".", "copy", "(", ")", ")", "arg_16", "=", "defaultdict", "(", "list", ")", "arg_17", "=", "[", "]", "if", "len", "(", "arg_1", ".", "operators", ")", "==", "0", ":", "arg_1", ".", "operators", "=", "[", "proxops", ".", "identity", "(", ")", "]", "arg_18", ",", "arg_19", "=", "wrap", "(", "arg_8", ",", "arg_9", ")", "arg_7", "=", "compose", "(", "destruct", ",", "*", "reversed", "(", "arg_1", ".", "operators", ")", ",", "arg_1", ".", "restruct", ")", "arg_1", ".", "optional_print", "(", "tp", ".", "header", "(", "[", "'Iteration'", ",", "'Objective'", ",", "'||Grad||'", ",", "'Runtime'", "]", ")", ")", "try", ":", "for", "arg_20", "in", "count", "(", ")", ":", "arg_21", "=", "perf_counter", "(", ")", "arg_22", "=", "arg_18", "(", "arg_15", ")", "arg_23", "=", "arg_19", "(", "arg_15", ")", "arg_15", "=", "arg_7", "(", "arg_1", ".", "algorithm", ".", "send", "(", "arg_23", ")", ")", "arg_17", ".", "append", "(", "perf_counter", "(", ")", "-", "arg_21", ")", "arg_16", "[", "'f'", "]", ".", "append", "(", "arg_22", ")", "arg_1", ".", "optional_print", "(", "tp", ".", "row", "(", "[", "arg_20", ",", "arg_22", ",", "np", ".", "linalg", ".", "norm", "(", "destruct", "(", "arg_23", ")", ")", ",", "tp", ".", "humantime", "(", "arg_17", "[", "-", "1", "]", ")", "]", ")", ")", "if", "arg_20", ">=", "arg_13", ":", "break", "except", "KeyboardInterrupt", ":", "pass", "arg_1", ".", "optional_print", "(", "tp", ".", "bottom", "(", "4", ")", ")", "arg_1", ".", "optional_print", "(", "u'\\u279b Final objective: {}'", ".", "format", "(", "arg_16", "[", "'f'", "]", "[", "-", "1", "]", ")", ")", "arg_1", ".", "optional_print", "(", "u'\\u279b Total runtime: {}'", ".", "format", "(", "tp", ".", "humantime", "(", "sum", "(", "arg_17", ")", ")", ")", ")", "arg_1", ".", "optional_print", "(", "u'\\u279b Per iteration runtime: {} +/- {}'", ".", "format", "(", "tp", ".", "humantime", "(", "np", ".", "mean", "(", "arg_17", ")", ")", ",", "tp", ".", "humantime", "(", "np", ".", "std", "(", "arg_17", ")", ")", ",", ")", ")", "return", "OptimizeResult", "(", "{", "'x'", ":", "arg_1", ".", "restruct", "(", "arg_15", ")", ",", "'f'", ":", "arg_22", ",", "'df'", ":", "arg_1", ".", "restruct", "(", "arg_23", ")", ",", "'k'", ":", "arg_20", ",", "'obj'", ":", "np", ".", "array", "(", "arg_16", "[", "'f'", "]", ")", ",", "}", ")", "return", "GradientOptimizer"], "function": "def Func(arg_0):\n    \"\"\"Turns a coroutine into a gradient based optimizer.\"\"\"\n\n    class GradientOptimizer(Optimizer):\n\n        @wraps(arg_0)\n        def __init__(arg_1, *arg_2, **arg_3):\n            arg_1.algorithm = arg_0(*arg_2, **arg_3)\n            arg_1.algorithm.send(None)\n            arg_1.operators = []\n\n        def set_transform(arg_1, arg_6):\n            arg_1.transform = compose(destruct, arg_6, arg_1.restruct)\n\n        def minimize(arg_1, arg_8, arg_9, arg_10=arg_11.stdout, arg_13=1e3):\n\n            arg_1.display = arg_10\n            arg_1.theta = arg_9\n\n            # setup\n            arg_15 = arg_1.algorithm.send(destruct(arg_9).copy())\n            arg_16 = defaultdict(list)\n            arg_17 = []\n            if len(arg_1.operators) == 0:\n                arg_1.operators = [proxops.identity()]\n\n            # setup\n            arg_18, arg_19 = wrap(arg_8, arg_9)\n            arg_7 = compose(destruct, *reversed(arg_1.operators), arg_1.restruct)\n\n            arg_1.optional_print(tp.header(['Iteration', 'Objective', '||Grad||', 'Runtime']))\n            try:\n                for arg_20 in count():\n\n                    # setup\n                    arg_21 = perf_counter()\n                    arg_22 = arg_18(arg_15)\n                    arg_23 = arg_19(arg_15)\n                    arg_15 = arg_7(arg_1.algorithm.send(arg_23))\n                    arg_17.append(perf_counter() - arg_21)\n                    arg_16['f'].append(arg_22)\n\n                    # Update display\n                    arg_1.optional_print(tp.row([arg_20,\n                                                arg_22,\n                                                np.linalg.norm(destruct(arg_23)),\n                                                tp.humantime(arg_17[-1])]))\n\n                    if arg_20 >= arg_13:\n                        break\n\n            except KeyboardInterrupt:\n                pass\n\n            arg_1.optional_print(tp.bottom(4))\n\n            # cleanup\n            arg_1.optional_print(u'\\u279b Final objective: {}'.format(arg_16['f'][-1]))\n            arg_1.optional_print(u'\\u279b Total runtime: {}'.format(tp.humantime(sum(arg_17))))\n            arg_1.optional_print(u'\\u279b Per iteration runtime: {} +/- {}'.format(\n                tp.humantime(np.mean(arg_17)),\n                tp.humantime(np.std(arg_17)),\n            ))\n\n            # result\n            return OptimizeResult({\n                'x': arg_1.restruct(arg_15),\n                'f': arg_22,\n                'df': arg_1.restruct(arg_23),\n                'k': arg_20,\n                'obj': np.array(arg_16['f']),\n            })\n\n    return GradientOptimizer", "path": "descent/main.py", "identifier": "gradient_optimizer", "docstring": "Turns a coroutine into a gradient based optimizer.", "docstring_tokens": ["Turns", "a", "coroutine", "into", "a", "gradient", "based", "optimizer", "."], "nwo": "nirum/descent", "score": 0.18112697196067942, "idx": 254345}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/setup.py#L142-L184", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "setup entry point", "language": "python", "parameters": "(**kwargs)", "return_statement": "return setup(\n        name=distname,\n        version=__pkginfo__[\"version\"],\n        license=__pkginfo__[\"license\"],\n        description=__pkginfo__[\"description\"],\n        long_description=long_description,\n        author=__pkginfo__[\"author\"],\n        author_email=__pkginfo__[\"author_email\"],\n        url=__pkginfo__[\"web\"],\n        scripts=ensure_scripts(scripts),\n        classifiers=__pkginfo__[\"classifiers\"],\n        data_files=data_files,\n        ext_modules=ext_modules,\n        cmdclass=cmdclass,\n        extras_require=extras_require,\n        test_suite=\"test\",\n        python_requires=\">=3.4.*\",\n        setup_requires=[\"pytest-runner\"],\n        tests_require=[\"pytest\"],\n        **kwargs\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "if", "USE_SETUPTOOLS", ":", "if", "\"--force-manifest\"", "in", "sys", ".", "argv", ":", "sys", ".", "argv", ".", "remove", "(", "\"--force-manifest\"", ")", "arg_1", "=", "[", "modname", "]", "+", "get_packages", "(", "join", "(", "base_dir", ",", "\"pylint\"", ")", ",", "modname", ")", "if", "USE_SETUPTOOLS", ":", "if", "Func_requires", ":", "arg_0", "[", "\"Func_requires\"", "]", "=", "Func_requires", "arg_0", "[", "\"dependency_links\"", "]", "=", "dependency_links", "arg_0", "[", "\"entry_points\"", "]", "=", "{", "\"console_scripts\"", ":", "[", "\"pylint = pylint:run_pylint\"", ",", "\"epylint = pylint:run_epylint\"", ",", "\"pyreverse = pylint:run_pyreverse\"", ",", "\"symilar = pylint:run_symilar\"", ",", "]", "}", "arg_0", "[", "\"packages\"", "]", "=", "arg_1", "arg_2", "=", "{", "\"Func_lib\"", ":", "MyInstallLib", ",", "\"build_py\"", ":", "build_py", "}", "if", "easy_Func_lib", ":", "arg_2", "[", "\"easy_Func\"", "]", "=", "easy_Func", "return", "setup", "(", "name", "=", "distname", ",", "version", "=", "__pkginfo__", "[", "\"version\"", "]", ",", "license", "=", "__pkginfo__", "[", "\"license\"", "]", ",", "description", "=", "__pkginfo__", "[", "\"description\"", "]", ",", "long_description", "=", "long_description", ",", "author", "=", "__pkginfo__", "[", "\"author\"", "]", ",", "author_email", "=", "__pkginfo__", "[", "\"author_email\"", "]", ",", "url", "=", "__pkginfo__", "[", "\"web\"", "]", ",", "scripts", "=", "ensure_scripts", "(", "scripts", ")", ",", "classifiers", "=", "__pkginfo__", "[", "\"classifiers\"", "]", ",", "data_files", "=", "data_files", ",", "ext_modules", "=", "ext_modules", ",", "arg_2", "=", "arg_2", ",", "extras_require", "=", "extras_require", ",", "test_suite", "=", "\"test\"", ",", "python_requires", "=", "\">=3.4.*\"", ",", "setup_requires", "=", "[", "\"pytest-runner\"", "]", ",", "tests_require", "=", "[", "\"pytest\"", "]", ",", "**", "arg_0", ")"], "function": "def Func(**arg_0):\n    \"\"\"setup entry point\"\"\"\n    if USE_SETUPTOOLS:\n        if \"--force-manifest\" in sys.argv:\n            sys.argv.remove(\"--force-manifest\")\n    arg_1 = [modname] + get_packages(join(base_dir, \"pylint\"), modname)\n    if USE_SETUPTOOLS:\n        if Func_requires:\n            arg_0[\"Func_requires\"] = Func_requires\n            arg_0[\"dependency_links\"] = dependency_links\n        arg_0[\"entry_points\"] = {\n            \"console_scripts\": [\n                \"pylint = pylint:run_pylint\",\n                \"epylint = pylint:run_epylint\",\n                \"pyreverse = pylint:run_pyreverse\",\n                \"symilar = pylint:run_symilar\",\n            ]\n        }\n    arg_0[\"packages\"] = arg_1\n    arg_2 = {\"Func_lib\": MyInstallLib, \"build_py\": build_py}\n    if easy_Func_lib:\n        arg_2[\"easy_Func\"] = easy_Func\n    return setup(\n        name=distname,\n        version=__pkginfo__[\"version\"],\n        license=__pkginfo__[\"license\"],\n        description=__pkginfo__[\"description\"],\n        long_description=long_description,\n        author=__pkginfo__[\"author\"],\n        author_email=__pkginfo__[\"author_email\"],\n        url=__pkginfo__[\"web\"],\n        scripts=ensure_scripts(scripts),\n        classifiers=__pkginfo__[\"classifiers\"],\n        data_files=data_files,\n        ext_modules=ext_modules,\n        arg_2=arg_2,\n        extras_require=extras_require,\n        test_suite=\"test\",\n        python_requires=\">=3.4.*\",\n        setup_requires=[\"pytest-runner\"],\n        tests_require=[\"pytest\"],\n        **arg_0\n    )", "path": "setup.py", "identifier": "install", "docstring": "setup entry point", "docstring_tokens": ["setup", "entry", "point"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254346}
{"url": "https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/forestci.py#L70-L132", "sha": "401c63a74a27d775eff0f72b6c20ffd568491fe0", "docstring_summary": "Helper function, that performs the core computation", "language": "python", "parameters": "(X_train, X_test, inbag, pred_centered, n_trees,\n                      memory_constrained=False, memory_limit=None,\n                      test_mode=False)", "return_statement": "return V_IJ", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ")", ":", "if", "not", "arg_5", ":", "return", "np", ".", "sum", "(", "(", "np", ".", "dot", "(", "arg_2", "-", "1", ",", "arg_3", ".", "T", ")", "/", "arg_4", ")", "**", "2", ",", "0", ")", "if", "not", "arg_6", ":", "raise", "ValueError", "(", "'If memory_constrained=True, must provide'", ",", "'memory_limit.'", ")", "arg_8", "=", "int", "(", "(", "arg_6", "*", "1e6", ")", "/", "(", "8.0", "*", "arg_0", ".", "shape", "[", "0", "]", ")", ")", "if", "arg_8", "==", "0", ":", "arg_9", "=", "8.0", "*", "arg_0", ".", "shape", "[", "0", "]", "/", "1e6", "raise", "ValueError", "(", "'memory_limit provided is too small.'", "+", "'For these dimensions, memory_limit must '", "+", "'be greater than or equal to %.3e'", "%", "arg_9", ")", "arg_10", "=", "np", ".", "arange", "(", "0", ",", "arg_1", ".", "shape", "[", "0", "]", "+", "arg_8", ",", "arg_8", ")", "arg_11", "=", "range", "(", "arg_1", ".", "shape", "[", "0", "]", ")", "arg_12", "=", "[", "arg_11", "[", "arg_10", "[", "i", "]", ":", "arg_10", "[", "i", "+", "1", "]", "]", "for", "i", "in", "range", "(", "len", "(", "arg_10", ")", "-", "1", ")", "]", "if", "arg_7", ":", "print", "(", "'Number of chunks: %d'", "%", "(", "len", "(", "arg_12", ")", ",", ")", ")", "arg_13", "=", "np", ".", "concatenate", "(", "[", "np", ".", "sum", "(", "(", "np", ".", "dot", "(", "arg_2", "-", "1", ",", "arg_3", "[", "chunk", "]", ".", "T", ")", "/", "arg_4", ")", "**", "2", ",", "0", ")", "for", "chunk", "in", "arg_12", "]", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                      arg_5=False, arg_6=None,\n                      arg_7=False):\n    \"\"\"\n    Helper function, that performs the core computation\n\n    Parameters\n    ----------\n    X_train : ndarray\n        An array with shape (n_train_sample, n_features).\n\n    X_test : ndarray\n        An array with shape (n_test_sample, n_features).\n\n    inbag : ndarray\n        The inbag matrix that fit the data. If set to `None` (default) it\n        will be inferred from the forest. However, this only works for trees\n        for which bootstrapping was set to `True`. That is, if sampling was\n        done with replacement. Otherwise, users need to provide their own\n        inbag matrix.\n\n    pred_centered : ndarray\n        Centered predictions that are an intermediate result in the\n        computation.\n\n    memory_constrained: boolean (optional)\n        Whether or not there is a restriction on memory. If False, it is\n        assumed that a ndarry of shape (n_train_sample,n_test_sample) fits\n        in main memory. Setting to True can actually provide a speed up if\n        memory_limit is tuned to the optimal range.\n\n    memory_limit: int (optional)\n        An upper bound for how much memory the itermediate matrices will take\n        up in Megabytes. This must be provided if memory_constrained=True.\n\n\n    \"\"\"\n    if not arg_5:\n        return np.sum((np.dot(arg_2 - 1, arg_3.T) / arg_4) ** 2, 0)\n\n    if not arg_6:\n        raise ValueError('If memory_constrained=True, must provide',\n                         'memory_limit.')\n\n    # Assumes double precision float\n    arg_8 = int((arg_6 * 1e6) / (8.0 * arg_0.shape[0]))\n\n    if arg_8 == 0:\n        arg_9 = 8.0 * arg_0.shape[0] / 1e6\n        raise ValueError('memory_limit provided is too small.' +\n                         'For these dimensions, memory_limit must ' +\n                         'be greater than or equal to %.3e' % arg_9)\n\n    arg_10 = np.arange(0, arg_1.shape[0] + arg_8, arg_8)\n    arg_11 = range(arg_1.shape[0])\n    arg_12 = [arg_11[arg_10[i]:arg_10[i+1]]\n              for i in range(len(arg_10)-1)]\n    if arg_7:\n        print('Number of chunks: %d' % (len(arg_12),))\n    arg_13 = np.concatenate([\n                np.sum((np.dot(arg_2-1, arg_3[chunk].T)/arg_4)**2, 0)\n                for chunk in arg_12])\n    return arg_13", "path": "forestci/forestci.py", "identifier": "_core_computation", "docstring": "Helper function, that performs the core computation\n\n    Parameters\n    ----------\n    X_train : ndarray\n        An array with shape (n_train_sample, n_features).\n\n    X_test : ndarray\n        An array with shape (n_test_sample, n_features).\n\n    inbag : ndarray\n        The inbag matrix that fit the data. If set to `None` (default) it\n        will be inferred from the forest. However, this only works for trees\n        for which bootstrapping was set to `True`. That is, if sampling was\n        done with replacement. Otherwise, users need to provide their own\n        inbag matrix.\n\n    pred_centered : ndarray\n        Centered predictions that are an intermediate result in the\n        computation.\n\n    memory_constrained: boolean (optional)\n        Whether or not there is a restriction on memory. If False, it is\n        assumed that a ndarry of shape (n_train_sample,n_test_sample) fits\n        in main memory. Setting to True can actually provide a speed up if\n        memory_limit is tuned to the optimal range.\n\n    memory_limit: int (optional)\n        An upper bound for how much memory the itermediate matrices will take\n        up in Megabytes. This must be provided if memory_constrained=True.", "docstring_tokens": ["Helper", "function", "that", "performs", "the", "core", "computation"], "nwo": "scikit-learn-contrib/forest-confidence-interval", "score": 0.5087559176222483, "idx": 254347}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/cert.py#L537-L542", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Load certificate from a file.", "language": "python", "parameters": "(cls, filename)", "return_statement": "return cls.from_der_data(data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "\"r\"", ")", "as", "pem_file", ":", "arg_2", "=", "pem", ".", "readPemFromFile", "(", "pem_file", ")", "return", "arg_0", ".", "from_der_data", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Load certificate from a file.\n        \"\"\"\n        with open(arg_1, \"r\") as pem_file:\n            arg_2 = pem.readPemFromFile(pem_file)\n        return arg_0.from_der_data(arg_2)", "path": "pyxmpp2/cert.py", "identifier": "ASN1CertificateData.from_file", "docstring": "Load certificate from a file.", "docstring_tokens": ["Load", "certificate", "from", "a", "file", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254348}
{"url": "https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L89-L102", "sha": "f3ed561253eb4a8e1522c64f59bf64d275e9d315", "docstring_summary": "use a thread lock on current method, if self.lock is defined", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", "[", "0", "]", ".", "lock", "arg_3", ".", "acquire", "(", "True", ")", "try", ":", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "except", ":", "raise", "finally", ":", "arg_3", ".", "release", "(", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"use a thread lock on current method, if self.lock is defined\"\"\"\n    def wrapper(*arg_1, **arg_2):\n        \"\"\"Decorator Wrapper\"\"\"\n        arg_3 = arg_1[0].lock\n        arg_3.acquire(True)\n        try:\n            return arg_0(*arg_1, **arg_2)\n        except:\n            raise\n        finally:\n            arg_3.release()\n\n    return wrapper", "path": "onetimejwt/__init__.py", "identifier": "mutex", "docstring": "use a thread lock on current method, if self.lock is defined", "docstring_tokens": ["use", "a", "thread", "lock", "on", "current", "method", "if", "self", ".", "lock", "is", "defined"], "nwo": "srevenant/onetimejwt", "score": 0.0, "idx": 254349}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/genes/transcript.py#L3-L75", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Build a hgnc_transcript object", "language": "python", "parameters": "(transcript_info, build='37')", "return_statement": "return transcript_obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'37'", ")", ":", "try", ":", "arg_2", "=", "arg_0", "[", "'ensembl_transcript_id'", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Transcript has to have ensembl id\"", ")", "arg_1", "=", "arg_1", "arg_3", "=", "arg_0", ".", "get", "(", "'is_primary'", ",", "False", ")", "arg_4", "=", "arg_0", ".", "get", "(", "'refseq_id'", ")", "arg_5", "=", "arg_0", ".", "get", "(", "'refseq_identifiers'", ")", "try", ":", "arg_6", "=", "arg_0", "[", "'chrom'", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Transcript has to have a chromosome\"", ")", "try", ":", "arg_7", "=", "int", "(", "arg_0", "[", "'transcript_start'", "]", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Transcript has to have start\"", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"Transcript start has to be integer\"", ")", "try", ":", "arg_8", "=", "int", "(", "arg_0", "[", "'transcript_end'", "]", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Transcript has to have end\"", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"Transcript end has to be integer\"", ")", "try", ":", "arg_9", "=", "int", "(", "arg_0", "[", "'hgnc_id'", "]", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Transcript has to have a hgnc id\"", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"hgnc id has to be integer\"", ")", "arg_10", "=", "HgncTranscript", "(", "arg_2", "=", "arg_2", ",", "arg_9", "=", "arg_9", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_1", "=", "arg_1", ")", "for", "arg_11", "in", "list", "(", "arg_10", ")", ":", "if", "arg_10", "[", "arg_11", "]", "is", "None", ":", "arg_10", ".", "pop", "(", "arg_11", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1='37'):\n    \"\"\"Build a hgnc_transcript object\n\n        Args:\n            transcript_info(dict): Transcript information\n\n        Returns:\n            transcript_obj(HgncTranscript)\n            {\n                transcript_id: str, required\n                hgnc_id: int, required\n                build: str, required\n                refseq_id: str,\n                chrom: str, required\n                start: int, required\n                end: int, required\n                is_primary: bool\n            }\n    \"\"\"\n    try:\n        arg_2 = arg_0['ensembl_transcript_id']\n    except KeyError:\n        raise KeyError(\"Transcript has to have ensembl id\")\n    \n    arg_1 = arg_1\n    arg_3 = arg_0.get('is_primary', False)\n    \n    arg_4 = arg_0.get('refseq_id')\n    arg_5 = arg_0.get('refseq_identifiers')\n\n    try:\n        arg_6 = arg_0['chrom']\n    except KeyError:\n        raise KeyError(\"Transcript has to have a chromosome\")\n    \n    try:\n        arg_7 = int(arg_0['transcript_start'])\n    except KeyError:\n        raise KeyError(\"Transcript has to have start\")\n    except TypeError:\n        raise TypeError(\"Transcript start has to be integer\")\n\n    try:\n        arg_8 = int(arg_0['transcript_end'])\n    except KeyError:\n        raise KeyError(\"Transcript has to have end\")\n    except TypeError:\n        raise TypeError(\"Transcript end has to be integer\")\n\n    try:\n        arg_9 = int(arg_0['hgnc_id'])\n    except KeyError:\n        raise KeyError(\"Transcript has to have a hgnc id\")\n    except TypeError:\n        raise TypeError(\"hgnc id has to be integer\")\n\n    arg_10 = HgncTranscript(\n        arg_2=arg_2, \n        arg_9=arg_9, \n        arg_6=arg_6, \n        arg_7=arg_7, \n        arg_8=arg_8, \n        arg_3=arg_3, \n        arg_4=arg_4,\n        arg_5=arg_5,\n        arg_1=arg_1\n    )\n    # Remove unnessesary keys\n    for arg_11 in list(arg_10):\n        if arg_10[arg_11] is None:\n            arg_10.pop(arg_11)\n\n    return arg_10", "path": "scout/build/genes/transcript.py", "identifier": "build_transcript", "docstring": "Build a hgnc_transcript object\n\n        Args:\n            transcript_info(dict): Transcript information\n\n        Returns:\n            transcript_obj(HgncTranscript)\n            {\n                transcript_id: str, required\n                hgnc_id: int, required\n                build: str, required\n                refseq_id: str,\n                chrom: str, required\n                start: int, required\n                end: int, required\n                is_primary: bool\n            }", "docstring_tokens": ["Build", "a", "hgnc_transcript", "object"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254350}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L98-L104", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Generate a list of `Particle` objects.", "language": "python", "parameters": "(num_particles, D, box, rs)", "return_statement": "return [Particle(D=D, x0=x0, y0=y0, z0=z0)\n                for x0, y0, z0 in zip(X0, Y0, Z0)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "rand", "(", "arg_0", ")", "*", "(", "arg_2", ".", "x2", "-", "arg_2", ".", "x1", ")", "+", "arg_2", ".", "x1", "arg_5", "=", "arg_3", ".", "rand", "(", "arg_0", ")", "*", "(", "arg_2", ".", "y2", "-", "arg_2", ".", "y1", ")", "+", "arg_2", ".", "y1", "arg_6", "=", "arg_3", ".", "rand", "(", "arg_0", ")", "*", "(", "arg_2", ".", "z2", "-", "arg_2", ".", "z1", ")", "+", "arg_2", ".", "z1", "return", "[", "Particle", "(", "arg_1", "=", "arg_1", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")", "for", "arg_7", ",", "arg_8", ",", "arg_9", "in", "zip", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Generate a list of `Particle` objects.\"\"\"\n        arg_4 = arg_3.rand(arg_0) * (arg_2.x2 - arg_2.x1) + arg_2.x1\n        arg_5 = arg_3.rand(arg_0) * (arg_2.y2 - arg_2.y1) + arg_2.y1\n        arg_6 = arg_3.rand(arg_0) * (arg_2.z2 - arg_2.z1) + arg_2.z1\n        return [Particle(arg_1=arg_1, arg_7=arg_7, arg_8=arg_8, arg_9=arg_9)\n                for arg_7, arg_8, arg_9 in zip(arg_4, arg_5, arg_6)]", "path": "pybromo/diffusion.py", "identifier": "Particles._generate", "docstring": "Generate a list of `Particle` objects.", "docstring_tokens": ["Generate", "a", "list", "of", "Particle", "objects", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 254351}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3167-L3179", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Generate a column of random numbers drawn from a uniform distribution [0,1) and\n        having the same data layout as the source frame.", "language": "python", "parameters": "(self, seed=None)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"h2o.Func\"", ",", "arg_0", ",", "-", "1", "if", "arg_1", "is", "None", "else", "arg_1", ")", ")", "arg_2", ".", "_ex", ".", "_cache", ".", "ncols", "=", "1", "arg_2", ".", "_ex", ".", "_cache", ".", "nrows", "=", "arg_0", ".", "nrow", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Generate a column of random numbers drawn from a uniform distribution [0,1) and\n        having the same data layout as the source frame.\n\n        :param int seed: seed for the random number generator.\n\n        :returns: Single-column H2OFrame filled with doubles sampled uniformly from [0,1).\n        \"\"\"\n        arg_2 = H2OFrame._expr(expr=ExprNode(\"h2o.Func\", arg_0, -1 if arg_1 is None else arg_1))\n        arg_2._ex._cache.ncols = 1\n        arg_2._ex._cache.nrows = arg_0.nrow\n        return arg_2", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.runif", "docstring": "Generate a column of random numbers drawn from a uniform distribution [0,1) and\n        having the same data layout as the source frame.\n\n        :param int seed: seed for the random number generator.\n\n        :returns: Single-column H2OFrame filled with doubles sampled uniformly from [0,1).", "docstring_tokens": ["Generate", "a", "column", "of", "random", "numbers", "drawn", "from", "a", "uniform", "distribution", "[", "0", "1", ")", "and", "having", "the", "same", "data", "layout", "as", "the", "source", "frame", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 254352}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/to_fmt.py#L96-L113", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Return a Fmt representation of Translator for pretty-printing", "language": "python", "parameters": "(self, with_from=False)", "return_statement": "return txt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", "->", "fmt", ".", "indentable", ":", "arg_2", "=", "fmt", ".", "sep", "(", "\"\\n\"", ",", "[", "fmt", ".", "sep", "(", "\" \"", ",", "[", "arg_0", ".", "_type_source", ",", "\"to\"", ",", "arg_0", ".", "_type_target", ",", "'='", ",", "arg_0", ".", "_fun", ".", "Func", "(", ")", "]", ")", ",", "arg_0", ".", "_notify", ".", "get_content", "(", "arg_1", ")", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False) -> fmt.indentable:\n    \"\"\"\n    Return a Fmt representation of Translator for pretty-printing\n    \"\"\"\n    arg_2 = fmt.sep(\"\\n\", [\n        fmt.sep(\n            \" \",\n            [\n                arg_0._type_source,\n                \"to\",\n                arg_0._type_target,\n                '=',\n                arg_0._fun.Func()\n            ]\n        ),\n        arg_0._notify.get_content(arg_1)\n    ])\n    return arg_2", "path": "pyrser/type_system/to_fmt.py", "identifier": "to_fmt", "docstring": "Return a Fmt representation of Translator for pretty-printing", "docstring_tokens": ["Return", "a", "Fmt", "representation", "of", "Translator", "for", "pretty", "-", "printing"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254353}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L161-L168", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Return the authorative source of the link.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_pn_link", ".", "is_sender", ":", "return", "arg_0", ".", "_pn_link", ".", "source", ".", "address", "else", ":", "return", "arg_0", ".", "_pn_link", ".", "remote_source", ".", "address"], "function": "def Func(arg_0):\n        \"\"\"Return the authorative source of the link.\"\"\"\n        # If link is a sender, source is determined by the local\n        # value, else use the remote.\n        if arg_0._pn_link.is_sender:\n            return arg_0._pn_link.source.address\n        else:\n            return arg_0._pn_link.remote_source.address", "path": "pyngus/link.py", "identifier": "_Link.source_address", "docstring": "Return the authorative source of the link.", "docstring_tokens": ["Return", "the", "authorative", "source", "of", "the", "link", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 254354}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L504-L526", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Shut down a list of instances, if provided.", "language": "python", "parameters": "(self, instances=None)", "return_statement": "return term", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "and", "len", "(", "arg_0", ".", "instances", ")", ">", "0", ":", "print", "(", "arg_1", ")", "try", ":", "print", "(", "[", "arg_2", ".", "id", "for", "arg_2", "in", "arg_1", "]", ")", "except", "Exception", "as", "e", ":", "print", "(", "e", ")", "arg_3", "=", "arg_0", ".", "client", ".", "terminate_instances", "(", "InstanceIds", "=", "arg_1", ")", "logger", ".", "info", "(", "\"Shut down {} instances (ids:{}\"", ".", "format", "(", "len", "(", "arg_1", ")", ",", "str", "(", "arg_1", ")", ")", ")", "elif", "len", "(", "arg_0", ".", "instances", ")", ">", "0", ":", "arg_4", "=", "arg_0", ".", "instances", ".", "pop", "(", ")", "arg_3", "=", "arg_0", ".", "client", ".", "terminate_instances", "(", "InstanceIds", "=", "[", "arg_4", "]", ")", "logger", ".", "info", "(", "\"Shut down 1 instance (id:{})\"", ".", "format", "(", "arg_4", ")", ")", "else", ":", "logger", ".", "warn", "(", "\"No Instances to shut down.\\n\"", ")", "return", "-", "1", "arg_0", ".", "get_instance_state", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Shut down a list of instances, if provided.\n\n        If no instance is provided, the last instance started up will be shut down.\n        \"\"\"\n\n        if arg_1 and len(arg_0.instances) > 0:\n            print(arg_1)\n            try:\n                print([arg_2.id for arg_2 in arg_1])\n            except Exception as e:\n                print(e)\n            arg_3 = arg_0.client.terminate_instances(InstanceIds=arg_1)\n            logger.info(\"Shut down {} instances (ids:{}\".format(len(arg_1), str(arg_1)))\n        elif len(arg_0.instances) > 0:\n            arg_4 = arg_0.instances.pop()\n            arg_3 = arg_0.client.terminate_instances(InstanceIds=[arg_4])\n            logger.info(\"Shut down 1 instance (id:{})\".format(arg_4))\n        else:\n            logger.warn(\"No Instances to shut down.\\n\")\n            return -1\n        arg_0.get_instance_state()\n        return arg_3", "path": "parsl/providers/aws/aws.py", "identifier": "AWSProvider.shut_down_instance", "docstring": "Shut down a list of instances, if provided.\n\n        If no instance is provided, the last instance started up will be shut down.", "docstring_tokens": ["Shut", "down", "a", "list", "of", "instances", "if", "provided", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 254355}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/distributions.py#L50-L54", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns the next n values for the distribution as a list.", "language": "python", "parameters": "(self, n)", "return_statement": "return records", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "arg_0", ".", "getNext", "(", ")", "for", "x", "in", "range", "(", "arg_1", ")", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns the next n values for the distribution as a list.\"\"\"\n\n    arg_2 = [arg_0.getNext() for x in range(arg_1)]\n    return arg_2", "path": "src/nupic/data/generators/distributions.py", "identifier": "Distributions.getData", "docstring": "Returns the next n values for the distribution as a list.", "docstring_tokens": ["Returns", "the", "next", "n", "values", "for", "the", "distribution", "as", "a", "list", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254356}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/meetup.py#L361-L393", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the events pages of a given group.", "language": "python", "parameters": "(self, group, from_date=DEFAULT_DATETIME)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "arg_4", "=", "datetime_to_utc", "(", "arg_2", ")", "arg_4", "=", "arg_4", ".", "strftime", "(", "\"since:%Y-%m-%dT%H:%M:%S.000Z\"", ")", "arg_5", "=", "urijoin", "(", "arg_1", ",", "arg_0", ".", "REVENTS", ")", "arg_6", "=", "'?'", "+", "arg_0", ".", "PFIELDS", "+", "'='", "+", "','", ".", "join", "(", "arg_0", ".", "VEVENT_FIELDS", ")", "arg_6", "+=", "'&'", "+", "arg_0", ".", "PSTATUS", "+", "'='", "+", "','", ".", "join", "(", "arg_0", ".", "VSTATUS", ")", "arg_5", "+=", "arg_6", "arg_7", "=", "{", "arg_0", ".", "PORDER", ":", "arg_0", ".", "VUPDATED", ",", "arg_0", ".", "PSCROLL", ":", "arg_4", ",", "arg_0", ".", "PPAGE", ":", "arg_0", ".", "max_items", "}", "try", ":", "for", "arg_8", "in", "arg_0", ".", "_fetch", "(", "arg_5", ",", "arg_7", ")", ":", "yield", "arg_8", "except", "requests", ".", "exceptions", ".", "HTTPError", "as", "error", ":", "if", "error", ".", "response", ".", "status_code", "==", "410", ":", "arg_9", "=", "\"Group is no longer accessible: {}\"", ".", "format", "(", "error", ")", "raise", "RepositoryError", "(", "cause", "=", "arg_9", ")", "else", ":", "raise", "error"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n        \"\"\"Fetch the Func pages of a given group.\"\"\"\n\n        arg_4 = datetime_to_utc(arg_2)\n        arg_4 = arg_4.strftime(\"since:%Y-%m-%dT%H:%M:%S.000Z\")\n\n        arg_5 = urijoin(arg_1, arg_0.REVENTS)\n\n        # Hack required due to Metup API does not support list\n        # values with the format `?param=value1&param=value2`.\n        # It only works with `?param=value1,value2`.\n        # Morever, urrlib3 encodes comma characters when values\n        # are given using params dict, which it doesn't work\n        # with Meetup, either.\n        arg_6 = '?' + arg_0.PFIELDS + '=' + ','.join(arg_0.VEVENT_FIELDS)\n        arg_6 += '&' + arg_0.PSTATUS + '=' + ','.join(arg_0.VSTATUS)\n        arg_5 += arg_6\n\n        arg_7 = {\n            arg_0.PORDER: arg_0.VUPDATED,\n            arg_0.PSCROLL: arg_4,\n            arg_0.PPAGE: arg_0.max_items\n        }\n\n        try:\n            for arg_8 in arg_0._fetch(arg_5, arg_7):\n                yield arg_8\n        except requests.exceptions.HTTPError as error:\n            if error.response.status_code == 410:\n                arg_9 = \"Group is no longer accessible: {}\".format(error)\n                raise RepositoryError(cause=arg_9)\n            else:\n                raise error", "path": "perceval/backends/core/meetup.py", "identifier": "MeetupClient.events", "docstring": "Fetch the events pages of a given group.", "docstring_tokens": ["Fetch", "the", "events", "pages", "of", "a", "given", "group", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 254357}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/expressions.py#L202-L231", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Selects whichever field is not None, in the specified order.", "language": "python", "parameters": "(*fields, default=None)", "return_statement": "return expressions.Case(\n        *when_clauses,\n        default=expressions.Value(default),\n        output_field=CharField()\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "[", "expressions", ".", "When", "(", "~", "expressions", ".", "Q", "(", "**", "{", "field", ":", "None", "}", ")", ",", "then", "=", "expressions", ".", "F", "(", "field", ")", ")", "for", "field", "in", "reversed", "(", "arg_0", ")", "]", "return", "expressions", ".", "Case", "(", "*", "arg_2", ",", "arg_1", "=", "expressions", ".", "Value", "(", "arg_1", ")", ",", "output_field", "=", "CharField", "(", ")", ")"], "function": "def Func(*arg_0, arg_1=None):\n    \"\"\"Selects whichever field is not None, in the specified order.\n\n    Arguments:\n        fields:\n            The fields to attempt to get a value from,\n            in order.\n\n        default:\n            The value to return in case all values are None.\n\n    Returns:\n        A Case-When expression that tries each field and\n        returns the specified default value when all of\n        them are None.\n    \"\"\"\n\n    arg_2 = [\n        expressions.When(\n            ~expressions.Q(**{field: None}),\n            then=expressions.F(field)\n        )\n        for field in reversed(arg_0)\n    ]\n\n    return expressions.Case(\n        *arg_2,\n        arg_1=expressions.Value(arg_1),\n        output_field=CharField()\n    )", "path": "psqlextra/expressions.py", "identifier": "IsNotNone", "docstring": "Selects whichever field is not None, in the specified order.\n\n    Arguments:\n        fields:\n            The fields to attempt to get a value from,\n            in order.\n\n        default:\n            The value to return in case all values are None.\n\n    Returns:\n        A Case-When expression that tries each field and\n        returns the specified default value when all of\n        them are None.", "docstring_tokens": ["Selects", "whichever", "field", "is", "not", "None", "in", "the", "specified", "order", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 254358}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L80-L84", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Returns True if stmt in inside the else branch for a parent For stmt.", "language": "python", "parameters": "(parent, stmt)", "return_statement": "return isinstance(parent, astroid.For) and any(\n        else_stmt.parent_of(stmt) or else_stmt == stmt for else_stmt in parent.orelse\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "isinstance", "(", "arg_0", ",", "astroid", ".", "For", ")", "and", "any", "(", "arg_2", ".", "parent_of", "(", "arg_1", ")", "or", "arg_2", "==", "arg_1", "for", "arg_2", "in", "arg_0", ".", "orelse", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns True if stmt in inside the else branch for a parent For stmt.\"\"\"\n    return isinstance(arg_0, astroid.For) and any(\n        arg_2.parent_of(arg_1) or arg_2 == arg_1 for arg_2 in arg_0.orelse\n    )", "path": "pylint/checkers/variables.py", "identifier": "in_for_else_branch", "docstring": "Returns True if stmt in inside the else branch for a parent For stmt.", "docstring_tokens": ["Returns", "True", "if", "stmt", "in", "inside", "the", "else", "branch", "for", "a", "parent", "For", "stmt", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254359}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/pos.py#L53-L81", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Finds the top long, short, and absolute positions.", "language": "python", "parameters": "(positions, top=10)", "return_statement": "return df_top_long, df_top_short, df_top_abs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "arg_0", "=", "arg_0", ".", "drop", "(", "'cash'", ",", "axis", "=", "'columns'", ")", "arg_2", "=", "arg_0", ".", "max", "(", ")", "arg_3", "=", "arg_0", ".", "min", "(", ")", "arg_4", "=", "arg_0", ".", "abs", "(", ")", ".", "max", "(", ")", "arg_5", "=", "arg_2", "[", "arg_2", ">", "0", "]", ".", "nlargest", "(", "arg_1", ")", "arg_6", "=", "arg_3", "[", "arg_3", "<", "0", "]", ".", "nsmallest", "(", "arg_1", ")", "arg_7", "=", "arg_4", ".", "nlargest", "(", "arg_1", ")", "return", "arg_5", ",", "arg_6", ",", "arg_7"], "function": "def Func(arg_0, arg_1=10):\n    \"\"\"\n    Finds the top long, short, and absolute positions.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        The positions that the strategy takes over time.\n    top : int, optional\n        How many of each to find (default 10).\n\n    Returns\n    -------\n    df_top_long : pd.DataFrame\n        Top long positions.\n    df_top_short : pd.DataFrame\n        Top short positions.\n    df_top_abs : pd.DataFrame\n        Top absolute positions.\n    \"\"\"\n\n    arg_0 = arg_0.drop('cash', axis='columns')\n    arg_2 = arg_0.max()\n    arg_3 = arg_0.min()\n    arg_4 = arg_0.abs().max()\n    arg_5 = arg_2[arg_2 > 0].nlargest(arg_1)\n    arg_6 = arg_3[arg_3 < 0].nsmallest(arg_1)\n    arg_7 = arg_4.nlargest(arg_1)\n    return arg_5, arg_6, arg_7", "path": "pyfolio/pos.py", "identifier": "get_top_long_short_abs", "docstring": "Finds the top long, short, and absolute positions.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        The positions that the strategy takes over time.\n    top : int, optional\n        How many of each to find (default 10).\n\n    Returns\n    -------\n    df_top_long : pd.DataFrame\n        Top long positions.\n    df_top_short : pd.DataFrame\n        Top short positions.\n    df_top_abs : pd.DataFrame\n        Top absolute positions.", "docstring_tokens": ["Finds", "the", "top", "long", "short", "and", "absolute", "positions", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 254360}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/util.py#L61-L74", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns the named object.", "language": "python", "parameters": "(name)", "return_statement": "return getattr(sys.modules[mod_name], property_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "rindex", "(", "\".\"", ")", "arg_2", ",", "arg_3", "=", "arg_0", "[", ":", "arg_1", "]", ",", "arg_0", "[", "arg_1", "+", "1", ":", "]", "__import__", "(", "arg_2", ")", "return", "getattr", "(", "sys", ".", "modules", "[", "arg_2", "]", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    ''' Returns the named object.\n\n    Arguments:\n        name (str): A string of form `package.subpackage.etc.module.property`.\n            This function will import `package.subpackage.etc.module` and\n            return `property` from that module.\n\n    '''\n\n    arg_1 = arg_0.rindex(\".\")\n    arg_2, arg_3 = arg_0[:arg_1], arg_0[arg_1 + 1:]\n    __import__(arg_2)\n    return getattr(sys.modules[arg_2], arg_3)", "path": "registrasion/util.py", "identifier": "get_object_from_name", "docstring": "Returns the named object.\n\n    Arguments:\n        name (str): A string of form `package.subpackage.etc.module.property`.\n            This function will import `package.subpackage.etc.module` and\n            return `property` from that module.", "docstring_tokens": ["Returns", "the", "named", "object", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 254361}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/courses.py#L23-L28", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return course resource for given sis id.", "language": "python", "parameters": "(self, sis_course_id, params={})", "return_statement": "return self.get_course(self._sis_id(sis_course_id, sis_field=\"course\"),\n                               params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "return", "arg_0", ".", "get_course", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"course\"", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return course resource for given sis id.\n        \"\"\"\n        return arg_0.get_course(arg_0._sis_id(arg_1, sis_field=\"course\"),\n                               arg_2)", "path": "uw_canvas/courses.py", "identifier": "Courses.get_course_by_sis_id", "docstring": "Return course resource for given sis id.", "docstring_tokens": ["Return", "course", "resource", "for", "given", "sis", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 254362}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/gitintegration.py#L61-L110", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Makes a commit and returns if a new commit was triggered and the SHA_1 code of the commit.", "language": "python", "parameters": "(environment, git_repository, user_message, git_fail)", "return_statement": "return new_commit, commit.hexsha", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "git", ".", "Repo", "(", "arg_1", ")", "arg_5", "=", "arg_4", ".", "index", "arg_6", "=", "arg_0", ".", "v_trajectory", "if", "arg_6", ".", "v_comment", ":", "arg_7", "=", "', Comment: `%s`'", "%", "arg_6", ".", "v_comment", "else", ":", "arg_7", "=", "''", "if", "arg_2", ":", "arg_2", "+=", "' -- '", "arg_8", "=", "'%sTrajectory: `%s`, Time: `%s`, %s'", "%", "(", "arg_2", ",", "arg_6", ".", "v_name", ",", "arg_6", ".", "v_time", ",", "arg_7", ")", "arg_9", "=", "arg_5", ".", "diff", "(", "None", ")", "if", "arg_9", ":", "if", "arg_3", ":", "raise", "pex", ".", "GitDiffError", "(", "'Found not committed changes!'", ")", "arg_4", ".", "git", ".", "add", "(", "'-u'", ")", "arg_10", "=", "arg_5", ".", "commit", "(", "arg_8", ")", "arg_11", "=", "True", "else", ":", "arg_10", "=", "arg_4", ".", "commit", "(", "None", ")", "arg_11", "=", "False", "add_commit_variables", "(", "arg_6", ",", "arg_10", ")", "return", "arg_11", ",", "arg_10", ".", "hexsha"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\" Makes a commit and returns if a new commit was triggered and the SHA_1 code of the commit.\n\n    If `git_fail` is `True` program fails instead of triggering a new commit given\n    not committed changes. Then a `GitDiffError` is raised.\n\n    \"\"\"\n\n    # Import GitPython, we do it here to allow also users not having GitPython installed\n    # to use the normal environment\n\n    # Open the repository\n    arg_4 = git.Repo(arg_1)\n    arg_5 = arg_4.index\n\n    arg_6 = arg_0.v_trajectory\n\n    # Create the commit message and append the trajectory name and comment\n    if arg_6.v_comment:\n        arg_7 = ', Comment: `%s`' % arg_6.v_comment\n    else:\n        arg_7 = ''\n\n    if arg_2:\n        arg_2 += ' -- '\n\n    arg_8 = '%sTrajectory: `%s`, Time: `%s`, %s' % \\\n              (arg_2, arg_6.v_name, arg_6.v_time, arg_7)\n\n    # Detect changes:\n    arg_9 = arg_5.diff(None)\n\n    if arg_9:\n        if arg_3:\n            # User requested fail instead of a new commit\n            raise pex.GitDiffError('Found not committed changes!')\n        # Make the commit\n        arg_4.git.add('-u')\n        arg_10 = arg_5.commit(arg_8)\n        arg_11 = True\n\n    else:\n        # Take old commit\n        arg_10 = arg_4.commit(None)\n        arg_11 = False\n\n    # Add the commit info to the trajectory\n    add_commit_variables(arg_6, arg_10)\n\n    return arg_11, arg_10.hexsha", "path": "pypet/utils/gitintegration.py", "identifier": "make_git_commit", "docstring": "Makes a commit and returns if a new commit was triggered and the SHA_1 code of the commit.\n\n    If `git_fail` is `True` program fails instead of triggering a new commit given\n    not committed changes. Then a `GitDiffError` is raised.", "docstring_tokens": ["Makes", "a", "commit", "and", "returns", "if", "a", "new", "commit", "was", "triggered", "and", "the", "SHA_1", "code", "of", "the", "commit", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254363}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_pipeline.py#L352-L371", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Create stages that are used for the pipeline.", "language": "python", "parameters": "(self, config)", "return_statement": "return (reader, incremental_transforms, batch_transforms,\n                post_batch_incremental_transforms, writers, tmp_dir_path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_init_stage", "(", "arg_1", ",", "'reader'", ")", "arg_3", "=", "arg_0", ".", "_init_stages", "(", "arg_1", ",", "'incremental_transforms'", ")", "arg_4", "=", "arg_0", ".", "_init_stages", "(", "arg_1", ",", "'batch_transforms'", ")", "arg_5", "=", "arg_0", ".", "_init_stages", "(", "arg_1", ",", "'post_batch_incremental_transforms'", ")", "arg_6", "=", "arg_0", ".", "_init_stages", "(", "arg_1", ",", "'writers'", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_1", "[", "'tmp_dir_path'", "]", ",", "arg_0", ".", "tmp_dir_suffix", ")", "return", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n        '''Create stages that are used for the pipeline.\n\n        :param dict config: `streamcorpus_pipeline` configuration\n        :return: tuple of (reader, incremental transforms, batch\n          transforms, post-batch incremental transforms, writers,\n          temporary directory)\n\n        '''\n        arg_2 = arg_0._init_stage(arg_1, 'reader')\n        arg_3 = arg_0._init_stages(\n            arg_1, 'incremental_transforms')\n        arg_4 = arg_0._init_stages(arg_1, 'batch_transforms')\n        arg_5 = arg_0._init_stages(\n            arg_1, 'post_batch_incremental_transforms')\n        arg_6 = arg_0._init_stages(arg_1, 'writers')\n        arg_7 = os.path.join(arg_1['tmp_dir_path'],\n                                    arg_0.tmp_dir_suffix)\n        return (arg_2, arg_3, arg_4,\n                arg_5, arg_6, arg_7)", "path": "streamcorpus_pipeline/_pipeline.py", "identifier": "PipelineFactory._init_all_stages", "docstring": "Create stages that are used for the pipeline.\n\n        :param dict config: `streamcorpus_pipeline` configuration\n        :return: tuple of (reader, incremental transforms, batch\n          transforms, post-batch incremental transforms, writers,\n          temporary directory)", "docstring_tokens": ["Create", "stages", "that", "are", "used", "for", "the", "pipeline", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 254364}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/metrics/squad_metrics.py#L68-L100", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Calculates F-1 score between y_true and y_predicted\n        F-1 score uses the best matching y_true answer", "language": "python", "parameters": "(y_true: List[List[str]], y_predicted: List[str])", "return_statement": "return 100 * f1_total / len(y_true) if len(y_true) > 0 else 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_1", "[", "arg_2", "]", "]", ",", "arg_3", ":", "arg_1", "[", "arg_2", "]", ")", "->", "float", ":", "arg_4", "=", "0.0", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_0", ",", "arg_3", ")", ":", "arg_7", "=", "normalize_answer", "(", "arg_6", ")", ".", "split", "(", ")", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_5", ":", "arg_10", "=", "normalize_answer", "(", "arg_9", ")", ".", "split", "(", ")", "if", "len", "(", "arg_10", ")", "==", "0", "or", "len", "(", "arg_7", ")", "==", "0", ":", "arg_8", ".", "append", "(", "float", "(", "arg_10", "==", "arg_7", ")", ")", "continue", "arg_11", "=", "Counter", "(", "arg_7", ")", "&", "Counter", "(", "arg_10", ")", "arg_12", "=", "sum", "(", "arg_11", ".", "values", "(", ")", ")", "if", "arg_12", "==", "0", ":", "arg_8", ".", "append", "(", "0.0", ")", "continue", "arg_13", "=", "1.0", "*", "arg_12", "/", "len", "(", "arg_7", ")", "arg_14", "=", "1.0", "*", "arg_12", "/", "len", "(", "arg_10", ")", "arg_15", "=", "(", "2", "*", "arg_13", "*", "arg_14", ")", "/", "(", "arg_13", "+", "arg_14", ")", "arg_8", ".", "append", "(", "arg_15", ")", "arg_4", "+=", "max", "(", "arg_8", ")", "return", "100", "*", "arg_4", "/", "len", "(", "arg_0", ")", "if", "len", "(", "arg_0", ")", ">", "0", "else", "0"], "function": "def Func(arg_0: arg_1[arg_1[arg_2]], arg_3: arg_1[arg_2]) -> float:\n    \"\"\" Calculates F-1 score between y_true and y_predicted\n        F-1 score uses the best matching y_true answer\n\n    The same as in SQuAD-v2.0\n\n    Args:\n        y_true: list of correct answers (correct answers are represented by list of strings)\n        y_predicted: list of predicted answers\n\n    Returns:\n        F-1 score : float\n    \"\"\"\n    arg_4 = 0.0\n    for arg_5, arg_6 in zip(arg_0, arg_3):\n        arg_7 = normalize_answer(arg_6).split()\n        arg_8 = []\n        for arg_9 in arg_5:\n            arg_10 = normalize_answer(arg_9).split()\n            if len(arg_10) == 0 or len(arg_7) == 0:\n                arg_8.append(float(arg_10 == arg_7))\n                continue\n            arg_11 = Counter(arg_7) & Counter(arg_10)\n            arg_12 = sum(arg_11.values())\n            if arg_12 == 0:\n                arg_8.append(0.0)\n                continue\n            arg_13 = 1.0 * arg_12 / len(arg_7)\n            arg_14 = 1.0 * arg_12 / len(arg_10)\n            arg_15 = (2 * arg_13 * arg_14) / (arg_13 + arg_14)\n            arg_8.append(arg_15)\n        arg_4 += max(arg_8)\n    return 100 * arg_4 / len(arg_0) if len(arg_0) > 0 else 0", "path": "deeppavlov/metrics/squad_metrics.py", "identifier": "squad_v2_f1", "docstring": "Calculates F-1 score between y_true and y_predicted\n        F-1 score uses the best matching y_true answer\n\n    The same as in SQuAD-v2.0\n\n    Args:\n        y_true: list of correct answers (correct answers are represented by list of strings)\n        y_predicted: list of predicted answers\n\n    Returns:\n        F-1 score : float", "docstring_tokens": ["Calculates", "F", "-", "1", "score", "between", "y_true", "and", "y_predicted", "F", "-", "1", "score", "uses", "the", "best", "matching", "y_true", "answer"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 254365}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L297-L303", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Return a Snapshot by its ID.", "language": "python", "parameters": "(self, snapshot_id)", "return_statement": "return Snapshot.get_object(\n            api_token=self.token, snapshot_id=snapshot_id\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Snapshot", ".", "get_object", "(", "api_token", "=", "arg_0", ".", "token", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Return a Snapshot by its ID.\n        \"\"\"\n        return Snapshot.get_object(\n            api_token=arg_0.token, arg_1=arg_1\n        )", "path": "digitalocean/Manager.py", "identifier": "Manager.get_snapshot", "docstring": "Return a Snapshot by its ID.", "docstring_tokens": ["Return", "a", "Snapshot", "by", "its", "ID", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 254366}
{"url": "https://github.com/Yubico/python-u2flib-host/blob/eadc4dbf3bf516e74ea00d2e5690742a535834cb/u2flib_host/register.py#L41-L73", "sha": "eadc4dbf3bf516e74ea00d2e5690742a535834cb", "docstring_summary": "Interactively registers a single U2F device, given the RegistrationRequest.", "language": "python", "parameters": "(devices, params, facet)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", "[", ":", "]", ":", "try", ":", "arg_3", ".", "open", "(", ")", "except", ":", "arg_0", ".", "remove", "(", "arg_3", ")", "sys", ".", "stderr", ".", "write", "(", "'\\nTouch the U2F device you wish to Func...\\n'", ")", "try", ":", "while", "arg_0", ":", "arg_4", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "try", ":", "return", "u2f", ".", "Func", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "except", "exc", ".", "APDUError", "as", "e", ":", "if", "e", ".", "code", "==", "APDU_USE_NOT_SATISFIED", ":", "pass", "else", ":", "arg_4", ".", "append", "(", "arg_3", ")", "except", "exc", ".", "DeviceError", ":", "arg_4", ".", "append", "(", "arg_3", ")", "arg_0", "=", "[", "arg_5", "for", "arg_5", "in", "arg_0", "if", "arg_5", "not", "in", "arg_4", "]", "for", "arg_5", "in", "arg_4", ":", "arg_5", ".", "close", "(", ")", "time", ".", "sleep", "(", "0.25", ")", "finally", ":", "for", "arg_3", "in", "arg_0", ":", "arg_3", ".", "close", "(", ")", "sys", ".", "stderr", ".", "write", "(", "'\\nUnable to Func with any U2F device.\\n'", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Interactively Funcs a single U2F device, given the RegistrationRequest.\n    \"\"\"\n    for arg_3 in arg_0[:]:\n        try:\n            arg_3.open()\n        except:\n            arg_0.remove(arg_3)\n\n    sys.stderr.write('\\nTouch the U2F device you wish to Func...\\n')\n    try:\n        while arg_0:\n            arg_4 = []\n            for arg_3 in arg_0:\n                try:\n                    return u2f.Func(arg_3, arg_1, arg_2)\n                except exc.APDUError as e:\n                    if e.code == APDU_USE_NOT_SATISFIED:\n                        pass\n                    else:\n                        arg_4.append(arg_3)\n                except exc.DeviceError:\n                    arg_4.append(arg_3)\n            arg_0 = [arg_5 for arg_5 in arg_0 if arg_5 not in arg_4]\n            for arg_5 in arg_4:\n                arg_5.close()\n            time.sleep(0.25)\n    finally:\n        for arg_3 in arg_0:\n            arg_3.close()\n    sys.stderr.write('\\nUnable to Func with any U2F device.\\n')\n    sys.exit(1)", "path": "u2flib_host/register.py", "identifier": "register", "docstring": "Interactively registers a single U2F device, given the RegistrationRequest.", "docstring_tokens": ["Interactively", "registers", "a", "single", "U2F", "device", "given", "the", "RegistrationRequest", "."], "nwo": "Yubico/python-u2flib-host", "score": 0.37487477839678873, "idx": 254367}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/component.py#L79-L97", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Establish a client connection to a server.", "language": "python", "parameters": "(self,server=None,port=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "lock", ".", "acquire", "(", ")", "try", ":", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", ")", "finally", ":", "arg_0", ".", "lock", ".", "release", "(", ")"], "function": "def Func(arg_0,arg_1=None,arg_2=None):\n        \"\"\"Establish a client Funcion to a server.\n\n        [component only]\n\n        :Parameters:\n            - `server`: name or address of the server to use.  If not given\n              then use the one specified when creating the object.\n            - `port`: port number of the server to use.  If not given then use\n              the one specified when creating the object.\n\n        :Types:\n            - `server`: `unicode`\n            - `port`: `int`\"\"\"\n        arg_0.lock.acquire()\n        try:\n            arg_0._Func(arg_1,arg_2)\n        finally:\n            arg_0.lock.release()", "path": "pyxmpp2/ext/component.py", "identifier": "ComponentStream.connect", "docstring": "Establish a client connection to a server.\n\n        [component only]\n\n        :Parameters:\n            - `server`: name or address of the server to use.  If not given\n              then use the one specified when creating the object.\n            - `port`: port number of the server to use.  If not given then use\n              the one specified when creating the object.\n\n        :Types:\n            - `server`: `unicode`\n            - `port`: `int`", "docstring_tokens": ["Establish", "a", "client", "connection", "to", "a", "server", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254368}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpi.py#L276-L344", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Creates a box for easily spinning up a virtual machine with Vagrant.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "arg_1", ".", "sudo", "(", "'adduser --disabled-password --gecos \"\" vagrant'", ")", "arg_1", ".", "sudo", "(", "'echo \"vagrant ALL=(ALL) NOPASSWD:ALL\" > /etc/sudoers.d/vagrant'", ")", "arg_1", ".", "sudo", "(", "'chmod 0440 /etc/sudoers.d/vagrant'", ")", "arg_1", ".", "sudo", "(", "'apt-get update'", ")", "arg_1", ".", "sudo", "(", "'apt-get install -y openssh-server'", ")", "arg_1", ".", "sudo", "(", "'mkdir -p /home/vagrant/.ssh'", ")", "arg_1", ".", "sudo", "(", "'chmod 0700 /home/vagrant/.ssh'", ")", "arg_1", ".", "sudo", "(", "'wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys'", ")", "arg_1", ".", "sudo", "(", "'chmod 0600 /home/vagrant/.ssh/authorized_keys'", ")", "arg_1", ".", "sudo", "(", "'chown -R vagrant /home/vagrant/.ssh'", ")", "arg_1", ".", "sudo", "(", "\"sed -i '/AuthorizedKeysFile/s/^#//g' /etc/ssh/sshd_config\"", ")", "arg_1", ".", "sudo", "(", "\"sed -i '/PasswordAuthentication/s/^#//g' /etc/ssh/sshd_config\"", ")", "arg_1", ".", "sudo", "(", "\"sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config\"", ")", "arg_1", ".", "sudo", "(", "'apt-get upgrade'", ")", "arg_1", ".", "sudo", "(", "'apt-get install -y gcc build-essential'", ")", "arg_1", ".", "sudo", "(", "'mkdir /tmp/test'", ")", "arg_1", ".", "sudo", "(", "'cp {libvirt_images_dir}/{raspbian_image} /tmp/test'", ")", "arg_1", ".", "sudo", "(", "'cp {libvirt_boot_dir}/{raspbian_kernel} /tmp/test'", ")", "arg_1", ".", "render_to_file", "(", "'rpi/metadata.json'", ",", "'/tmp/test/metadata.json'", ")", "arg_1", ".", "render_to_file", "(", "'rpi/Vagrantfile'", ",", "'/tmp/test/Vagrantfile'", ")", "arg_1", ".", "sudo", "(", "'qemu-img convert -f raw -O qcow2  {libvirt_images_dir}/{raspbian_image}  {libvirt_images_dir}/{raspbian_image}.qcow2'", ")", "arg_1", ".", "sudo", "(", "'mv {libvirt_images_dir}/{raspbian_image}.qcow2 {libvirt_images_dir}/box.img'", ")", "arg_1", ".", "sudo", "(", "'cd /tmp/test; tar cvzf custom_box.box ./metadata.json ./Vagrantfile ./{raspbian_kernel} ./box.img'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Creates a box for easily spinning up a virtual machine with Vagrant.\n\n        http://unix.stackexchange.com/a/222907/16477\n        https://github.com/pradels/vagrant-libvirt\n        \"\"\"\n\n        arg_1 = arg_0.local_renderer\n\n        arg_1.sudo('adduser --disabled-password --gecos \"\" vagrant')\n\n        #vagrant user should be able to run sudo commands without a password prompt\n\n        arg_1.sudo('echo \"vagrant ALL=(ALL) NOPASSWD:ALL\" > /etc/sudoers.d/vagrant')\n        arg_1.sudo('chmod 0440 /etc/sudoers.d/vagrant')\n\n        arg_1.sudo('apt-get update')\n        arg_1.sudo('apt-get install -y openssh-server')\n\n        #put ssh key from vagrant user\n\n        arg_1.sudo('mkdir -p /home/vagrant/.ssh')\n        arg_1.sudo('chmod 0700 /home/vagrant/.ssh')\n        arg_1.sudo('wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys')\n        arg_1.sudo('chmod 0600 /home/vagrant/.ssh/authorized_keys')\n        arg_1.sudo('chown -R vagrant /home/vagrant/.ssh')\n\n        #open sudo vi /etc/ssh/sshd_config and change\n\n        #PubKeyAuthentication yes\n        #PermitEmptyPasswords no\n        arg_1.sudo(\"sed -i '/AuthorizedKeysFile/s/^#//g' /etc/ssh/sshd_config\")\n        #PasswordAuthentication no\n        arg_1.sudo(\"sed -i '/PasswordAuthentication/s/^#//g' /etc/ssh/sshd_config\")\n        arg_1.sudo(\"sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config\")\n\n        #restart ssh service using\n\n        #sudo service ssh restart\n\n        #install additional development packages for the tools to properly compile and install\n        arg_1.sudo('apt-get upgrade')\n        arg_1.sudo('apt-get install -y gcc build-essential')\n        #TODO:fix? throws dpkg: error: fgets gave an empty string from `/var/lib/dpkg/triggers/File'\n        #r.sudo('apt-get install -y linux-headers-rpi')\n\n        #do any change that you want and shutdown the VM . now , come to host machine on which guest VM is running and goto\n        #the /var/lib/libvirt/images/ and choose raw image in which you did the change and copy somewhere for example /test\n\n        arg_1.sudo('mkdir /tmp/test')\n        arg_1.sudo('cp {libvirt_images_dir}/{raspbian_image} /tmp/test')\n        arg_1.sudo('cp {libvirt_boot_dir}/{raspbian_kernel} /tmp/test')\n\n        #create two file metadata.json and Vagrantfile in /test do entry in metadata.json\n        arg_1.render_to_file('rpi/metadata.json', '/tmp/test/metadata.json')\n        arg_1.render_to_file('rpi/Vagrantfile', '/tmp/test/Vagrantfile')\n\n        #convert test.img to qcow2 format using\n        arg_1.sudo('qemu-img convert -f raw -O qcow2  {libvirt_images_dir}/{raspbian_image}  {libvirt_images_dir}/{raspbian_image}.qcow2')\n\n        #rename ubuntu.qcow2 to box.img\n        arg_1.sudo('mv {libvirt_images_dir}/{raspbian_image}.qcow2 {libvirt_images_dir}/box.img')\n\n        #Note: currently,libvirt-vagrant support only qcow2 format. so , don't change the format just rename to box.img.\n        #because it takes input with name box.img by default.\n        #create box\n\n        arg_1.sudo('cd /tmp/test; tar cvzf custom_box.box ./metadata.json ./Vagrantfile ./{raspbian_kernel} ./box.img')", "path": "burlap/rpi.py", "identifier": "RaspberryPiSatchel.create_raspbian_vagrant_box", "docstring": "Creates a box for easily spinning up a virtual machine with Vagrant.\n\n        http://unix.stackexchange.com/a/222907/16477\n        https://github.com/pradels/vagrant-libvirt", "docstring_tokens": ["Creates", "a", "box", "for", "easily", "spinning", "up", "a", "virtual", "machine", "with", "Vagrant", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 254369}
{"url": "https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L458-L486", "sha": "532e685c504ea96f9e42833594585159ac1d2068", "docstring_summary": "Return a normalized form of the pattern.", "language": "python", "parameters": "(pattern)", "return_statement": "return pattern_type, pattern", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "startswith", "(", "'regex:'", ")", ":", "arg_1", "=", "'regex'", "arg_0", "=", "arg_0", "[", "len", "(", "'regex:'", ")", ":", "]", "elif", "arg_0", ".", "startswith", "(", "'wildcard:'", ")", ":", "arg_1", "=", "'wildcard'", "arg_0", "=", "arg_0", "[", "len", "(", "'wildcard:'", ")", ":", "]", "elif", "arg_0", ".", "startswith", "(", "'literal:'", ")", ":", "arg_1", "=", "'literal'", "arg_0", "=", "arg_0", "[", "len", "(", "'literal:'", ")", ":", "]", "elif", "RegexRoute", ".", "like", "(", "arg_0", ")", ":", "arg_1", "=", "'regex'", "elif", "WildcardRoute", ".", "like", "(", "arg_0", ")", ":", "arg_1", "=", "'wildcard'", "else", ":", "arg_1", "=", "'literal'", "return", "arg_1", ",", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Return a normalized form of the pattern.\n\n        Normalize the pattern by removing pattern type prefix if it\n        exists in the pattern. Then return the pattern type and the\n        pattern as a tuple of two strings.\n\n        Arguments:\n          pattern (str): Route pattern to match request paths\n\n        Returns:\n          tuple: Ruple of pattern type (str) and pattern (str)\n        \"\"\"\n        if arg_0.startswith('regex:'):\n            arg_1 = 'regex'\n            arg_0 = arg_0[len('regex:'):]\n        elif arg_0.startswith('wildcard:'):\n            arg_1 = 'wildcard'\n            arg_0 = arg_0[len('wildcard:'):]\n        elif arg_0.startswith('literal:'):\n            arg_1 = 'literal'\n            arg_0 = arg_0[len('literal:'):]\n        elif RegexRoute.like(arg_0):\n            arg_1 = 'regex'\n        elif WildcardRoute.like(arg_0):\n            arg_1 = 'wildcard'\n        else:\n            arg_1 = 'literal'\n        return arg_1, arg_0", "path": "ice.py", "identifier": "Router._normalize_pattern", "docstring": "Return a normalized form of the pattern.\n\n        Normalize the pattern by removing pattern type prefix if it\n        exists in the pattern. Then return the pattern type and the\n        pattern as a tuple of two strings.\n\n        Arguments:\n          pattern (str): Route pattern to match request paths\n\n        Returns:\n          tuple: Ruple of pattern type (str) and pattern (str)", "docstring_tokens": ["Return", "a", "normalized", "form", "of", "the", "pattern", "."], "nwo": "susam/ice", "score": 0.16638194949711382, "idx": 254370}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/filters.py#L58-L94", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "'Defragment' a filter.", "language": "python", "parameters": "(filt, threshold=3, mode='include')", "return_statement": "return cfilt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3", ",", "arg_2", "=", "'include'", ")", ":", "if", "bool_2_indices", "(", "arg_0", ")", "is", "None", ":", "return", "arg_0", "if", "arg_2", "==", "'include'", ":", "arg_3", "=", "bool_2_indices", "(", "~", "arg_0", ")", "+", "1", "arg_4", "=", "True", "if", "arg_2", "==", "'exclude'", ":", "arg_3", "=", "bool_2_indices", "(", "arg_0", ")", "+", "1", "arg_4", "=", "False", "arg_5", "=", "(", "np", ".", "diff", "(", "arg_3", ")", "<=", "arg_1", ")", "[", ":", ",", "0", "]", "arg_6", "=", "arg_0", ".", "copy", "(", ")", "if", "any", "(", "arg_5", ")", ":", "for", "arg_7", ",", "arg_8", "in", "arg_3", "[", "arg_5", "]", ":", "arg_6", "[", "arg_7", ":", "arg_8", "]", "=", "arg_4", "return", "arg_6"], "function": "def Func(arg_0, arg_1=3, arg_2='include'):\n    \"\"\"\n    'Defragment' a filter.\n\n    Parameters\n    ----------\n    filt : boolean array\n        A filter\n    threshold : int\n        Consecutive values equal to or below this threshold\n        length are considered fragments, and will be removed.\n    mode : str\n        Wheter to change False fragments to True ('include')\n        or True fragments to False ('exclude')\n\n    Returns\n    -------\n    Funcmented filter : boolean array\n    \"\"\"\n    if bool_2_indices(arg_0) is None:\n        return arg_0\n\n    if arg_2 == 'include':\n        arg_3 = bool_2_indices(~arg_0) + 1\n        arg_4 = True\n    if arg_2 == 'exclude':\n        arg_3 = bool_2_indices(arg_0) + 1\n        arg_4 = False\n\n    arg_5 = (np.diff(arg_3) <= arg_1)[:, 0]\n\n    arg_6 = arg_0.copy()\n    if any(arg_5):\n        for arg_7, arg_8 in arg_3[arg_5]:\n            arg_6[arg_7:arg_8] = arg_4\n\n    return arg_6", "path": "latools/filtering/filters.py", "identifier": "defrag", "docstring": "'Defragment' a filter.\n\n    Parameters\n    ----------\n    filt : boolean array\n        A filter\n    threshold : int\n        Consecutive values equal to or below this threshold\n        length are considered fragments, and will be removed.\n    mode : str\n        Wheter to change False fragments to True ('include')\n        or True fragments to False ('exclude')\n\n    Returns\n    -------\n    defragmented filter : boolean array", "docstring_tokens": ["Defragment", "a", "filter", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 254371}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Row.py#L46-L54", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Call when there is a change in the instructions.", "language": "python", "parameters": "(self, change)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "adds", "(", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "arg_4", "=", "arg_0", ".", "_parser", ".", "instruction_in_row", "(", "arg_0", ",", "arg_3", ")", "arg_0", ".", "instructions", "[", "arg_2", "]", "=", "arg_4", "else", ":", "arg_3", ".", "transfer_to_row", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Call when there is a change in the instructions.\"\"\"\n        if arg_1.adds():\n            for arg_2, arg_3 in arg_1.items():\n                if isinstance(arg_3, dict):\n                    arg_4 = arg_0._parser.instruction_in_row(arg_0, arg_3)\n                    arg_0.instructions[arg_2] = arg_4\n                else:\n                    arg_3.transfer_to_row(arg_0)", "path": "knittingpattern/Row.py", "identifier": "Row._instructions_changed", "docstring": "Call when there is a change in the instructions.", "docstring_tokens": ["Call", "when", "there", "is", "a", "change", "in", "the", "instructions", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 254372}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/tools.py#L129-L142", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Build a symmetric vector out of stricly positive lag vector and zero-lag", "language": "python", "parameters": "(data, zerolag)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "twosided", "(", "np", ".", "insert", "(", "arg_0", ",", "0", ",", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Build a symmetric vector out of stricly positive lag vector and zero-lag\n\n    .. doctest::\n\n        >>> data = [3,2,1]\n        >>> zerolag = 4\n        >>> twosided_zerolag(data, zerolag)\n        array([1, 2, 3, 4, 3, 2, 1])\n\n    .. seealso:: Same behaviour as :func:`twosided_zerolag`\n    \"\"\"\n    arg_2 = twosided(np.insert(arg_0, 0, arg_1))\n    return arg_2", "path": "src/spectrum/tools.py", "identifier": "_twosided_zerolag", "docstring": "Build a symmetric vector out of stricly positive lag vector and zero-lag\n\n    .. doctest::\n\n        >>> data = [3,2,1]\n        >>> zerolag = 4\n        >>> twosided_zerolag(data, zerolag)\n        array([1, 2, 3, 4, 3, 2, 1])\n\n    .. seealso:: Same behaviour as :func:`twosided_zerolag`", "docstring_tokens": ["Build", "a", "symmetric", "vector", "out", "of", "stricly", "positive", "lag", "vector", "and", "zero", "-", "lag"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 254373}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L389-L444", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "teardown the cluster", "language": "python", "parameters": "(cl_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Log", ".", "info", "(", "\"Terminating cluster...\"", ")", "arg_1", "=", "read_and_parse_roles", "(", "arg_0", ")", "arg_2", "=", "arg_1", "[", "Role", ".", "MASTERS", "]", "arg_3", "=", "arg_1", "[", "Role", ".", "SLAVES", "]", "arg_4", "=", "arg_2", ".", "union", "(", "arg_3", ")", "if", "arg_2", ":", "try", ":", "arg_5", "=", "list", "(", "arg_2", ")", "[", "0", "]", "arg_6", "=", "get_jobs", "(", "arg_0", ",", "arg_5", ")", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "arg_7", "[", "\"ID\"", "]", "Log", ".", "info", "(", "\"Terminating job %s\"", "%", "arg_8", ")", "delete_job", "(", "arg_0", ",", "arg_8", ",", "arg_5", ")", "except", ":", "Log", ".", "debug", "(", "\"Error stopping jobs\"", ")", "Log", ".", "debug", "(", "sys", ".", "exc_info", "(", ")", "[", "0", "]", ")", "for", "arg_9", "in", "arg_4", ":", "Log", ".", "info", "(", "\"Terminating processes on %s\"", "%", "arg_9", ")", "if", "not", "is_self", "(", "arg_9", ")", ":", "arg_10", "=", "\"ps aux | grep heron-nomad | awk '{print \\$2}' \"", "\"| xargs kill\"", "arg_10", "=", "ssh_remote_execute", "(", "arg_10", ",", "arg_9", ",", "arg_0", ")", "else", ":", "arg_10", "=", "\"ps aux | grep heron-nomad | awk '{print $2}' \"", "\"| xargs kill\"", "Log", ".", "debug", "(", "arg_10", ")", "arg_11", "=", "subprocess", ".", "Popen", "(", "arg_10", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_12", "=", "arg_11", ".", "wait", "(", ")", "arg_13", "=", "arg_11", ".", "communicate", "(", ")", "Log", ".", "debug", "(", "\"return code: %s output: %s\"", "%", "(", "arg_12", ",", "arg_13", ")", ")", "Log", ".", "info", "(", "\"Cleaning up directories on %s\"", "%", "arg_9", ")", "arg_10", "=", "\"rm -rf /tmp/slave ; rm -rf /tmp/master\"", "if", "not", "is_self", "(", "arg_9", ")", ":", "arg_10", "=", "ssh_remote_execute", "(", "arg_10", ",", "arg_9", ",", "arg_0", ")", "Log", ".", "debug", "(", "arg_10", ")", "arg_11", "=", "subprocess", ".", "Popen", "(", "arg_10", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_12", "=", "arg_11", ".", "wait", "(", ")", "arg_13", "=", "arg_11", ".", "communicate", "(", ")", "Log", ".", "debug", "(", "\"return code: %s output: %s\"", "%", "(", "arg_12", ",", "arg_13", ")", ")"], "function": "def Func(arg_0):\n  '''\n  teardown the cluster\n  '''\n  Log.info(\"Terminating cluster...\")\n\n  arg_1 = read_and_parse_roles(arg_0)\n  arg_2 = arg_1[Role.MASTERS]\n  arg_3 = arg_1[Role.SLAVES]\n  arg_4 = arg_2.union(arg_3)\n\n  # stop all jobs\n  if arg_2:\n    try:\n      arg_5 = list(arg_2)[0]\n      arg_6 = get_jobs(arg_0, arg_5)\n      for arg_7 in arg_6:\n        arg_8 = arg_7[\"ID\"]\n        Log.info(\"Terminating job %s\" % arg_8)\n        delete_job(arg_0, arg_8, arg_5)\n    except:\n      Log.debug(\"Error stopping jobs\")\n      Log.debug(sys.exc_info()[0])\n\n  for arg_9 in arg_4:\n    Log.info(\"Terminating processes on %s\" % arg_9)\n    if not is_self(arg_9):\n      arg_10 = \"ps aux | grep heron-nomad | awk '{print \\$2}' \" \\\n            \"| xargs kill\"\n      arg_10 = ssh_remote_execute(arg_10, arg_9, arg_0)\n    else:\n      arg_10 = \"ps aux | grep heron-nomad | awk '{print $2}' \" \\\n            \"| xargs kill\"\n    Log.debug(arg_10)\n    arg_11 = subprocess.Popen(arg_10,\n                           shell=True,\n                           stdout=subprocess.PIPE,\n                           stderr=subprocess.PIPE)\n\n    arg_12 = arg_11.wait()\n    arg_13 = arg_11.communicate()\n    Log.debug(\"return code: %s output: %s\" % (arg_12, arg_13))\n\n    Log.info(\"Cleaning up directories on %s\" % arg_9)\n    arg_10 = \"rm -rf /tmp/slave ; rm -rf /tmp/master\"\n    if not is_self(arg_9):\n      arg_10 = ssh_remote_execute(arg_10, arg_9, arg_0)\n    Log.debug(arg_10)\n    arg_11 = subprocess.Popen(arg_10,\n                           shell=True,\n                           stdout=subprocess.PIPE,\n                           stderr=subprocess.PIPE)\n\n    arg_12 = arg_11.wait()\n    arg_13 = arg_11.communicate()\n    Log.debug(\"return code: %s output: %s\" % (arg_12, arg_13))", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "stop_cluster", "docstring": "teardown the cluster", "docstring_tokens": ["teardown", "the", "cluster"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254374}
{"url": "https://github.com/willkg/markus/blob/0cfbe67fb7ccfa7488b0120d21ddc0cdc1f8ed33/markus/backends/logging.py#L86-L88", "sha": "0cfbe67fb7ccfa7488b0120d21ddc0cdc1f8ed33", "docstring_summary": "Report a histogram.", "language": "python", "parameters": "(self, stat, value, tags=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "_log", "(", "'Func'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Report a Func.\"\"\"\n        arg_0._log('Func', arg_1, arg_2, arg_3)", "path": "markus/backends/logging.py", "identifier": "LoggingMetrics.histogram", "docstring": "Report a histogram.", "docstring_tokens": ["Report", "a", "histogram", "."], "nwo": "willkg/markus", "score": 0.5049367824870141, "idx": 254375}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/dsl.py#L700-L703", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Parse a node name in parameter list", "language": "python", "parameters": "(self, param, i)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "pair", "=", "(", "arg_0", ".", "value", "(", "arg_2", ")", ",", "parsing", ".", "Node", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Parse a node name in parameter list\"\"\"\n    arg_1.pair = (arg_0.value(arg_2), parsing.Node)\n    return True", "path": "pyrser/dsl.py", "identifier": "param_id", "docstring": "Parse a node name in parameter list", "docstring_tokens": ["Parse", "a", "node", "name", "in", "parameter", "list"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254376}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/financial/des.py#L341-L353", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Returns a report of this class.", "language": "python", "parameters": "(self, format=ReportFormat.printout, output_path=None)", "return_statement": "return rpt.render(format)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "printout", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "GlsRpt", "(", "arg_0", ",", "arg_4", ")", "return", "arg_5", ".", "render", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=arg_2.printout, arg_4=None):\n        \"\"\"\n        Returns a Func of this class.\n\n        :param format: The format of the Func.\n        :param output_path: The path to the file the Func is written to.\n          If None, then the Func is not written to a file.\n\n        :returns: The descendants of the account.\n        \"\"\"\n\n        arg_5 = GlsRpt(arg_0, arg_4)\n        return arg_5.render(arg_1)", "path": "auxi/modelling/financial/des.py", "identifier": "GeneralLedgerStructure.report", "docstring": "Returns a report of this class.\n\n        :param format: The format of the report.\n        :param output_path: The path to the file the report is written to.\n          If None, then the report is not written to a file.\n\n        :returns: The descendants of the account.", "docstring_tokens": ["Returns", "a", "report", "of", "this", "class", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 254377}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/serve.py#L63-L112", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Configure and create Flask app.", "language": "python", "parameters": "(\n    mapchete_files=None, zoom=None, bounds=None, single_input_file=None,\n    mode=\"continue\", debug=None\n)", "return_statement": "return app", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "\"continue\"", ",", "arg_5", "=", "None", ")", ":", "from", "flask", "import", "Flask", ",", "render_template_string", "arg_6", "=", "Flask", "(", "__name__", ")", "arg_7", "=", "{", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "mapchete_file", ")", ")", "[", "0", "]", ":", "mapchete", ".", "open", "(", "mapchete_file", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "with_cache", "=", "True", ",", "arg_5", "=", "arg_5", ")", "for", "mapchete_file", "in", "arg_0", "}", "arg_8", "=", "next", "(", "iter", "(", "arg_7", ".", "values", "(", ")", ")", ")", "arg_9", "=", "arg_8", ".", "config", ".", "process_pyramid", ".", "grid", "arg_10", "=", "arg_8", ".", "config", ".", "process_pyramid", ".", "crs", ".", "to_epsg", "(", ")", "arg_11", "=", "\",\"", ".", "join", "(", "[", "str", "(", "i", ")", "for", "i", "in", "arg_8", ".", "config", ".", "bounds_at_zoom", "(", ")", "]", ")", "arg_12", "=", "\"g\"", "if", "arg_10", "==", "3857", "else", "\"WGS84\"", "arg_13", "=", "BufferedTilePyramid", "(", "arg_9", ")", "@", "arg_6", ".", "route", "(", "'/'", ",", "methods", "=", "[", "'GET'", "]", ")", "def", "index", "(", ")", ":", "return", "render_template_string", "(", "pkgutil", ".", "get_data", "(", "'mapchete.static'", ",", "'index.html'", ")", ".", "decode", "(", "\"utf-8\"", ")", ",", "srid", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "is_mercator", "=", "(", "arg_10", "==", "3857", ")", ",", "process_names", "=", "arg_7", ".", "keys", "(", ")", ")", "@", "arg_6", ".", "route", "(", "\"/\"", ".", "join", "(", "[", "\"\"", ",", "\"wmts_simple\"", ",", "\"1.0.0\"", ",", "\"<string:mp_name>\"", ",", "\"default\"", ",", "arg_12", ",", "\"<int:zoom>\"", ",", "\"<int:row>\"", ",", "\"<int:col>.<string:file_ext>\"", "]", ")", ",", "methods", "=", "[", "'GET'", "]", ")", "def", "get", "(", "arg_14", ",", "arg_1", ",", "arg_15", ",", "arg_16", ",", "arg_17", ")", ":", "logger", ".", "debug", "(", "\"received tile (%s, %s, %s) for process %s\"", ",", "arg_1", ",", "arg_15", ",", "arg_16", ",", "arg_14", ")", "return", "_tile_response", "(", "arg_7", "[", "arg_14", "]", ",", "arg_13", ".", "tile", "(", "arg_1", ",", "arg_15", ",", "arg_16", ")", ",", "arg_5", ")", "return", "arg_6"], "function": "def Func(\n    arg_0=None, arg_1=None, arg_2=None, arg_3=None,\n    arg_4=\"continue\", arg_5=None\n):\n    \"\"\"Configure and create Flask app.\"\"\"\n    from flask import Flask, render_template_string\n    arg_6 = Flask(__name__)\n    arg_7 = {\n        os.path.splitext(os.path.basename(mapchete_file))[0]: mapchete.open(\n            mapchete_file, arg_1=arg_1, arg_2=arg_2,\n            arg_3=arg_3, arg_4=arg_4, with_cache=True,\n            arg_5=arg_5)\n        for mapchete_file in arg_0\n    }\n\n    arg_8 = next(iter(arg_7.values()))\n    arg_9 = arg_8.config.process_pyramid.grid\n    arg_10 = arg_8.config.process_pyramid.crs.to_epsg()\n    arg_11 = \",\".join([str(i) for i in arg_8.config.bounds_at_zoom()])\n    arg_12 = \"g\" if arg_10 == 3857 else \"WGS84\"\n    arg_13 = BufferedTilePyramid(arg_9)\n\n    @arg_6.route('/', methods=['GET'])\n    def index():\n        \"\"\"Render and hosts the appropriate OpenLayers instance.\"\"\"\n        return render_template_string(\n            pkgutil.get_data(\n                'mapchete.static', 'index.html').decode(\"utf-8\"),\n            srid=arg_10,\n            arg_11=arg_11,\n            is_mercator=(arg_10 == 3857),\n            process_names=arg_7.keys()\n        )\n\n    @arg_6.route(\n        \"/\".join([\n            \"\", \"wmts_simple\", \"1.0.0\", \"<string:mp_name>\", \"default\",\n            arg_12, \"<int:zoom>\", \"<int:row>\", \"<int:col>.<string:file_ext>\"]),\n        methods=['GET'])\n    def get(arg_14, arg_1, arg_15, arg_16, arg_17):\n        \"\"\"Return processed, empty or error (in pink color) tile.\"\"\"\n        logger.debug(\n            \"received tile (%s, %s, %s) for process %s\", arg_1, arg_15, arg_16,\n            arg_14)\n        # convert zoom, row, col into tile object using web pyramid\n        return _tile_response(\n            arg_7[arg_14], arg_13.tile(arg_1, arg_15, arg_16),\n            arg_5)\n\n    return arg_6", "path": "mapchete/cli/default/serve.py", "identifier": "create_app", "docstring": "Configure and create Flask app.", "docstring_tokens": ["Configure", "and", "create", "Flask", "app", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 254378}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/binding.py#L158-L174", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle resource binding success.", "language": "python", "parameters": "(self, stanza)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_payload", "(", "ResourceBindingPayload", ")", "arg_3", "=", "arg_2", ".", "jid", "if", "not", "arg_3", ":", "raise", "BadRequestProtocolError", "(", "u\"<jid/> element mising in\"", "\" the bind response\"", ")", "arg_0", ".", "stream", ".", "me", "=", "arg_3", "arg_0", ".", "stream", ".", "event", "(", "AuthorizedEvent", "(", "arg_0", ".", "stream", ".", "me", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Handle resource binding success.\n\n        [initiating entity only]\n\n        :Parameters:\n            - `stanza`: <iq type=\"result\"/> stanza received.\n\n        Set `streambase.StreamBase.me` to the full JID negotiated.\"\"\"\n        # pylint: disable-msg=R0201\n        arg_2 = arg_1.get_payload(ResourceBindingPayload)\n        arg_3 = arg_2.jid\n        if not arg_3:\n            raise BadRequestProtocolError(u\"<jid/> element mising in\"\n                                                    \" the bind response\")\n        arg_0.stream.me = arg_3\n        arg_0.stream.event(AuthorizedEvent(arg_0.stream.me))", "path": "pyxmpp2/binding.py", "identifier": "ResourceBindingHandler._bind_success", "docstring": "Handle resource binding success.\n\n        [initiating entity only]\n\n        :Parameters:\n            - `stanza`: <iq type=\"result\"/> stanza received.\n\n        Set `streambase.StreamBase.me` to the full JID negotiated.", "docstring_tokens": ["Handle", "resource", "binding", "success", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254379}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/help.py#L173-L191", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Show short help for all commands in `category'.", "language": "python", "parameters": "(self, category, args)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "proc", ".", "commands", "arg_4", "=", "list", "(", "arg_3", ".", "keys", "(", ")", ")", "if", "len", "(", "arg_2", ")", "==", "1", "and", "arg_2", "[", "0", "]", "==", "'*'", ":", "arg_0", ".", "section", "(", "\"Commands in class %s:\"", "%", "arg_1", ")", "arg_5", "=", "[", "cmd", "for", "cmd", "in", "arg_4", "if", "arg_1", "==", "arg_3", "[", "cmd", "]", ".", "category", "]", "arg_5", ".", "sort", "(", ")", "arg_0", ".", "msg_nocr", "(", "arg_0", ".", "columnize_commands", "(", "arg_5", ")", ")", "return", "arg_0", ".", "msg", "(", "\"%s.\\n\"", "%", "categories", "[", "arg_1", "]", ")", "arg_0", ".", "section", "(", "\"List of commands:\"", ")", "arg_4", ".", "sort", "(", ")", "for", "arg_6", "in", "arg_4", ":", "if", "arg_1", "!=", "arg_3", "[", "arg_6", "]", ".", "category", ":", "continue", "arg_0", ".", "msg", "(", "\"%-13s -- %s\"", "%", "(", "arg_6", ",", "arg_3", "[", "arg_6", "]", ".", "short_help", ",", ")", ")", "pass", "return"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Show short help for all commands in `category'.\"\"\"\n        arg_3 = arg_0.proc.commands\n        arg_4 = list(arg_3.keys())\n        if len(arg_2) == 1 and arg_2[0] == '*':\n            arg_0.section(\"Commands in class %s:\" % arg_1)\n            arg_5 = [cmd for cmd in arg_4 if arg_1 == arg_3[cmd].category]\n            arg_5.sort()\n            arg_0.msg_nocr(arg_0.columnize_commands(arg_5))\n            return\n\n        arg_0.msg(\"%s.\\n\" % categories[arg_1])\n        arg_0.section(\"List of commands:\")\n        arg_4.sort()\n        for arg_6 in arg_4:  # Foo! iteritems() doesn't do sorting\n            if arg_1 != arg_3[arg_6].category: continue\n            arg_0.msg(\"%-13s -- %s\" % (arg_6, arg_3[arg_6].short_help,))\n            pass\n        return", "path": "trepan/processor/command/help.py", "identifier": "HelpCommand.show_category", "docstring": "Show short help for all commands in `category'.", "docstring_tokens": ["Show", "short", "help", "for", "all", "commands", "in", "category", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 254380}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/mhd/write.py#L25-L43", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Write the content of the `meta_dict` into `filename`.", "language": "python", "parameters": "(filename, meta_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "''", "for", "arg_3", "in", "MHD_TAGS", ":", "if", "arg_3", "in", "arg_1", ".", "keys", "(", ")", ":", "arg_2", "+=", "'{} = {}\\n'", ".", "format", "(", "arg_3", ",", "arg_1", "[", "arg_3", "]", ")", "with", "open", "(", "arg_0", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Write the content of the `meta_dict` into `filename`.\n\n    Parameters\n    ----------\n    filename: str\n        Path to the output file\n\n    meta_dict: dict\n        Dictionary with the fields of the metadata .mhd file\n    \"\"\"\n    arg_2 = ''\n    # do not use tags = meta_dict.keys() because the order of tags matters\n    for arg_3 in MHD_TAGS:\n        if arg_3 in arg_1.keys():\n            arg_2 += '{} = {}\\n'.format(arg_3, arg_1[arg_3])\n\n    with open(arg_0, 'w') as f:\n        f.write(arg_2)", "path": "boyle/mhd/write.py", "identifier": "write_meta_header", "docstring": "Write the content of the `meta_dict` into `filename`.\n\n    Parameters\n    ----------\n    filename: str\n        Path to the output file\n\n    meta_dict: dict\n        Dictionary with the fields of the metadata .mhd file", "docstring_tokens": ["Write", "the", "content", "of", "the", "meta_dict", "into", "filename", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254381}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_hamming.py#L225-L260", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the normalized Hamming similarity of two strings.", "language": "python", "parameters": "(src, tar, diff_lens=True)", "return_statement": "return Hamming().sim(src, tar, diff_lens)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "return", "Hamming", "(", ")", ".", "sim", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"Return the normalized Hamming similarity of two strings.\n\n    This is a wrapper for :py:meth:`Hamming.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    diff_lens : bool\n        If True (default), this returns the Hamming distance for those\n        characters that have a matching character in both strings plus the\n        difference in the strings' lengths. This is equivalent to extending the\n        shorter string with obligatorily non-matching characters. If False, an\n        exception is raised in the case of strings of unequal lengths.\n\n    Returns\n    -------\n    float\n        The normalized Hamming similarity\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.666666666667\n    >>> Func('Niall', 'Neil')\n    0.4\n    >>> Func('aluminum', 'Catalan')\n    0.0\n    >>> Func('ATCG', 'TAGC')\n    0.0\n\n    \"\"\"\n    return Hamming().sim(arg_0, arg_1, arg_2)", "path": "abydos/distance/_hamming.py", "identifier": "sim_hamming", "docstring": "Return the normalized Hamming similarity of two strings.\n\n    This is a wrapper for :py:meth:`Hamming.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    diff_lens : bool\n        If True (default), this returns the Hamming distance for those\n        characters that have a matching character in both strings plus the\n        difference in the strings' lengths. This is equivalent to extending the\n        shorter string with obligatorily non-matching characters. If False, an\n        exception is raised in the case of strings of unequal lengths.\n\n    Returns\n    -------\n    float\n        The normalized Hamming similarity\n\n    Examples\n    --------\n    >>> round(sim_hamming('cat', 'hat'), 12)\n    0.666666666667\n    >>> sim_hamming('Niall', 'Neil')\n    0.4\n    >>> sim_hamming('aluminum', 'Catalan')\n    0.0\n    >>> sim_hamming('ATCG', 'TAGC')\n    0.0", "docstring_tokens": ["Return", "the", "normalized", "Hamming", "similarity", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254382}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/util.py#L80-L99", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Checks if internet connection exists to host via specified port.", "language": "python", "parameters": "(hostname, port)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "socket", ".", "gethostbyname", "(", "arg_0", ")", "socket", ".", "create_connection", "(", "(", "arg_2", ",", "arg_1", ")", ",", "2", ")", "return", "True", "except", "Exception", ":", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Checks if internet connection exists to host via specified port.\n\n    If any exception is raised while trying to open a socket this will return\n    false.\n\n    Args:\n        hostname (str): Hostname to connect to.\n        port (int): Port to connect to\n\n    Returns:\n        bool: Has connection or not\n\n    \"\"\"\n    try:\n        arg_2 = socket.gethostbyname(arg_0)\n        socket.create_connection((arg_2, arg_1), 2)\n        return True\n    except Exception:  # pylint: disable=broad-except\n        return False", "path": "qiskit/util.py", "identifier": "_has_connection", "docstring": "Checks if internet connection exists to host via specified port.\n\n    If any exception is raised while trying to open a socket this will return\n    false.\n\n    Args:\n        hostname (str): Hostname to connect to.\n        port (int): Port to connect to\n\n    Returns:\n        bool: Has connection or not", "docstring_tokens": ["Checks", "if", "internet", "connection", "exists", "to", "host", "via", "specified", "port", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254383}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/connection.py#L230-L276", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Lists a hosted zone's resource record sets by Zone ID, if you\n        already know it.", "language": "python", "parameters": "(self, id, rrset_type=None,\n                                             identifier=None, name=None,\n                                             page_chunks=100)", "return_statement": "return  self._do_autopaginating_api_call(\n            path='hostedzone/%s/rrset' % id,\n            params=params,\n            method='GET',\n            parser_func=xml_parsers.list_resource_record_sets_by_zone_id_parser,\n            parser_kwargs={'zone_id': id},\n            next_marker_xpath=\"./{*}NextRecordName\",\n            next_marker_param_name=\"name\",\n            next_type_xpath=\"./{*}NextRecordType\"\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "100", ")", ":", "arg_6", "=", "{", "'name'", ":", "arg_4", ",", "'type'", ":", "arg_2", ",", "'identifier'", ":", "arg_3", ",", "'maxitems'", ":", "arg_5", ",", "}", "return", "arg_0", ".", "_do_autopaginating_api_call", "(", "path", "=", "'hostedzone/%s/rrset'", "%", "arg_1", ",", "arg_6", "=", "arg_6", ",", "method", "=", "'GET'", ",", "parser_func", "=", "xml_parsers", ".", "list_resource_record_sets_by_zone_id_parser", ",", "parser_kwargs", "=", "{", "'zone_id'", ":", "arg_1", "}", ",", "next_marker_xpath", "=", "\"./{*}NextRecordName\"", ",", "next_marker_param_name", "=", "\"name\"", ",", "next_type_xpath", "=", "\"./{*}NextRecordType\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                                             arg_3=None, arg_4=None,\n                                             arg_5=100):\n        \"\"\"\n        Lists a hosted zone's resource record sets by Zone ID, if you\n        already know it.\n\n        .. tip:: For most cases, we recommend going through a\n            :py:class:`HostedZone <route53.hosted_zone.HostedZone>`\n            instance's\n            :py:meth:`HostedZone.record_sets <route53.hosted_zone.HostedZone.record_sets>`\n            property, but this saves an HTTP request if you already know the\n            zone's ID.\n\n        :param str id: The ID of the zone whose record sets we're listing.\n        :keyword str rrset_type: The type of resource record set to begin the\n            record listing from.\n        :keyword str identifier: Weighted and latency resource record sets\n            only: If results were truncated for a given DNS name and type,\n            the value of SetIdentifier for the next resource record set\n            that has the current DNS name and type.\n        :keyword str name: Not really sure what this does.\n        :keyword int page_chunks: This API call is paginated behind-the-scenes\n            by this many ResourceRecordSet instances. The default should be\n            fine for just about everybody, aside from those with tons of RRS.\n\n        :rtype: generator\n        :returns: A generator of ResourceRecordSet instances.\n        \"\"\"\n\n        arg_6 = {\n            'name': arg_4,\n            'type': arg_2,\n            'identifier': arg_3,\n            'maxitems': arg_5,\n        }\n\n        return  arg_0._do_autopaginating_api_call(\n            path='hostedzone/%s/rrset' % arg_1,\n            arg_6=arg_6,\n            method='GET',\n            parser_func=xml_parsers.list_resource_record_sets_by_zone_id_parser,\n            parser_kwargs={'zone_id': arg_1},\n            next_marker_xpath=\"./{*}NextRecordName\",\n            next_marker_param_name=\"name\",\n            next_type_xpath=\"./{*}NextRecordType\"\n        )", "path": "route53/connection.py", "identifier": "Route53Connection._list_resource_record_sets_by_zone_id", "docstring": "Lists a hosted zone's resource record sets by Zone ID, if you\n        already know it.\n\n        .. tip:: For most cases, we recommend going through a\n            :py:class:`HostedZone <route53.hosted_zone.HostedZone>`\n            instance's\n            :py:meth:`HostedZone.record_sets <route53.hosted_zone.HostedZone.record_sets>`\n            property, but this saves an HTTP request if you already know the\n            zone's ID.\n\n        :param str id: The ID of the zone whose record sets we're listing.\n        :keyword str rrset_type: The type of resource record set to begin the\n            record listing from.\n        :keyword str identifier: Weighted and latency resource record sets\n            only: If results were truncated for a given DNS name and type,\n            the value of SetIdentifier for the next resource record set\n            that has the current DNS name and type.\n        :keyword str name: Not really sure what this does.\n        :keyword int page_chunks: This API call is paginated behind-the-scenes\n            by this many ResourceRecordSet instances. The default should be\n            fine for just about everybody, aside from those with tons of RRS.\n\n        :rtype: generator\n        :returns: A generator of ResourceRecordSet instances.", "docstring_tokens": ["Lists", "a", "hosted", "zone", "s", "resource", "record", "sets", "by", "Zone", "ID", "if", "you", "already", "know", "it", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 254384}
{"url": "https://github.com/nsqio/pynsq/blob/48bf62d65ea63cddaa401efb23187b95511dbc84/nsq/reader.py#L281-L305", "sha": "48bf62d65ea63cddaa401efb23187b95511dbc84", "docstring_summary": "Used to identify when buffered messages should be processed and responded to.", "language": "python", "parameters": "(self)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "itervalues", "(", "arg_0", ".", "conns", ")", ":", "if", "arg_1", ".", "in_flight", ">", "0", "and", "arg_1", ".", "in_flight", ">=", "(", "arg_1", ".", "last_rdy", "*", "0.85", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n        \"\"\"\n        Used to identify when buffered messages should be processed and responded to.\n\n        When max_in_flight > 1 and you're batching messages together to perform work\n        is isn't possible to just compare the len of your list of buffered messages against\n        your configured max_in_flight (because max_in_flight may not be evenly divisible\n        by the number of producers you're connected to, ie. you might never get that many\n        messages... it's a *max*).\n\n        Example::\n\n            def message_handler(self, nsq_msg, reader):\n                # buffer messages\n                if reader.Func():\n                    # perform work\n\n            reader = nsq.Reader(...)\n            reader.set_message_handler(functools.partial(message_handler, reader=reader))\n            nsq.run()\n        \"\"\"\n        for arg_1 in itervalues(arg_0.conns):\n            if arg_1.in_flight > 0 and arg_1.in_flight >= (arg_1.last_rdy * 0.85):\n                return True\n        return False", "path": "nsq/reader.py", "identifier": "Reader.is_starved", "docstring": "Used to identify when buffered messages should be processed and responded to.\n\n        When max_in_flight > 1 and you're batching messages together to perform work\n        is isn't possible to just compare the len of your list of buffered messages against\n        your configured max_in_flight (because max_in_flight may not be evenly divisible\n        by the number of producers you're connected to, ie. you might never get that many\n        messages... it's a *max*).\n\n        Example::\n\n            def message_handler(self, nsq_msg, reader):\n                # buffer messages\n                if reader.is_starved():\n                    # perform work\n\n            reader = nsq.Reader(...)\n            reader.set_message_handler(functools.partial(message_handler, reader=reader))\n            nsq.run()", "docstring_tokens": ["Used", "to", "identify", "when", "buffered", "messages", "should", "be", "processed", "and", "responded", "to", "."], "nwo": "nsqio/pynsq", "score": 0.4773523738069914, "idx": 254385}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/random_distributed_scalar.py#L314-L368", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return True if this new candidate representation satisfies all our overlap\n    rules. Since we know that neighboring representations differ by at most\n    one bit, we compute running overlaps.", "language": "python", "parameters": "(self, newRep, newIndex)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ".", "size", "!=", "arg_0", ".", "w", ":", "return", "False", "if", "(", "arg_2", "<", "arg_0", ".", "minIndex", "-", "1", ")", "or", "(", "arg_2", ">", "arg_0", ".", "maxIndex", "+", "1", ")", ":", "raise", "ValueError", "(", "\"newIndex must be within one of existing indices\"", ")", "arg_3", "=", "numpy", ".", "array", "(", "[", "False", "]", "*", "arg_0", ".", "n", ")", "arg_3", "[", "arg_1", "]", "=", "True", "arg_4", "=", "arg_0", ".", "_maxBuckets", "/", "2", "arg_5", "=", "arg_0", ".", "_countOverlap", "(", "arg_0", ".", "bucketMap", "[", "arg_0", ".", "minIndex", "]", ",", "arg_1", ")", "if", "not", "arg_0", ".", "_overlapOK", "(", "arg_0", ".", "minIndex", ",", "arg_2", ",", "overlap", "=", "arg_5", ")", ":", "return", "False", "for", "arg_6", "in", "range", "(", "arg_0", ".", "minIndex", "+", "1", ",", "arg_4", "+", "1", ")", ":", "arg_7", "=", "(", "arg_6", "-", "1", ")", "%", "arg_0", ".", "w", "if", "arg_3", "[", "arg_0", ".", "bucketMap", "[", "arg_6", "-", "1", "]", "[", "arg_7", "]", "]", ":", "arg_5", "-=", "1", "if", "arg_3", "[", "arg_0", ".", "bucketMap", "[", "arg_6", "]", "[", "arg_7", "]", "]", ":", "arg_5", "+=", "1", "if", "not", "arg_0", ".", "_overlapOK", "(", "arg_6", ",", "arg_2", ",", "overlap", "=", "arg_5", ")", ":", "return", "False", "for", "arg_6", "in", "range", "(", "arg_4", "+", "1", ",", "arg_0", ".", "maxIndex", "+", "1", ")", ":", "arg_7", "=", "arg_6", "%", "arg_0", ".", "w", "if", "arg_3", "[", "arg_0", ".", "bucketMap", "[", "arg_6", "-", "1", "]", "[", "arg_7", "]", "]", ":", "arg_5", "-=", "1", "if", "arg_3", "[", "arg_0", ".", "bucketMap", "[", "arg_6", "]", "[", "arg_7", "]", "]", ":", "arg_5", "+=", "1", "if", "not", "arg_0", ".", "_overlapOK", "(", "arg_6", ",", "arg_2", ",", "overlap", "=", "arg_5", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Return True if this new candidate representation satisfies all our overlap\n    rules. Since we know that neighboring representations differ by at most\n    one bit, we compute running overlaps.\n    \"\"\"\n    if arg_1.size != arg_0.w:\n      return False\n    if (arg_2 < arg_0.minIndex-1) or (arg_2 > arg_0.maxIndex+1):\n      raise ValueError(\"newIndex must be within one of existing indices\")\n\n    # A binary representation of newRep. We will use this to test containment\n    arg_3 = numpy.array([False]*arg_0.n)\n    arg_3[arg_1] = True\n\n    # Midpoint\n    arg_4 = arg_0._maxBuckets/2\n\n    # Start by checking the overlap at minIndex\n    arg_5 = arg_0._countOverlap(arg_0.bucketMap[arg_0.minIndex], arg_1)\n    if not arg_0._overlapOK(arg_0.minIndex, arg_2, overlap=arg_5):\n      return False\n\n    # Compute running overlaps all the way to the midpoint\n    for arg_6 in range(arg_0.minIndex+1, arg_4+1):\n      # This is the bit that is going to change\n      arg_7 = (arg_6-1)%arg_0.w\n\n      # Update our running overlap\n      if arg_3[arg_0.bucketMap[arg_6-1][arg_7]]:\n        arg_5 -= 1\n      if arg_3[arg_0.bucketMap[arg_6][arg_7]]:\n        arg_5 += 1\n\n      # Verify our rules\n      if not arg_0._overlapOK(arg_6, arg_2, overlap=arg_5):\n        return False\n\n    # At this point, runningOverlap contains the overlap for midIdx\n    # Compute running overlaps all the way to maxIndex\n    for arg_6 in range(arg_4+1, arg_0.maxIndex+1):\n      # This is the bit that is going to change\n      arg_7 = arg_6%arg_0.w\n\n      # Update our running overlap\n      if arg_3[arg_0.bucketMap[arg_6-1][arg_7]]:\n        arg_5 -= 1\n      if arg_3[arg_0.bucketMap[arg_6][arg_7]]:\n        arg_5 += 1\n\n      # Verify our rules\n      if not arg_0._overlapOK(arg_6, arg_2, overlap=arg_5):\n        return False\n\n    return True", "path": "src/nupic/encoders/random_distributed_scalar.py", "identifier": "RandomDistributedScalarEncoder._newRepresentationOK", "docstring": "Return True if this new candidate representation satisfies all our overlap\n    rules. Since we know that neighboring representations differ by at most\n    one bit, we compute running overlaps.", "docstring_tokens": ["Return", "True", "if", "this", "new", "candidate", "representation", "satisfies", "all", "our", "overlap", "rules", ".", "Since", "we", "know", "that", "neighboring", "representations", "differ", "by", "at", "most", "one", "bit", "we", "compute", "running", "overlaps", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254386}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/interrupts.py#L401-L416", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Set the interrupt edge on the userspace GPIO pin.", "language": "python", "parameters": "(edge='falling')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'falling'", ")", ":", "arg_1", "=", "time", ".", "time", "(", ")", "arg_2", "=", "arg_1", "+", "FILE_IO_TIMEOUT", "while", "time", ".", "time", "(", ")", "<", "arg_2", ":", "try", ":", "with", "open", "(", "GPIO_INTERRUPT_DEVICE_EDGE", ",", "'w'", ")", "as", "gpio_edge", ":", "gpio_edge", ".", "write", "(", "arg_0", ")", "return", "except", "IOError", ":", "pass"], "function": "def Func(arg_0='falling'):\n    \"\"\"Set the interrupt edge on the userspace GPIO pin.\n\n    :param edge: The interrupt edge ('none', 'falling', 'rising').\n    :type edge: string\n    \"\"\"\n    # we're only interested in the falling edge (1 -> 0)\n    arg_1 = time.time()\n    arg_2 = arg_1 + FILE_IO_TIMEOUT\n    while time.time() < arg_2:\n        try:\n            with open(GPIO_INTERRUPT_DEVICE_EDGE, 'w') as gpio_edge:\n                gpio_edge.write(arg_0)\n                return\n        except IOError:\n            pass", "path": "pifacecommon/interrupts.py", "identifier": "set_gpio_interrupt_edge", "docstring": "Set the interrupt edge on the userspace GPIO pin.\n\n    :param edge: The interrupt edge ('none', 'falling', 'rising').\n    :type edge: string", "docstring_tokens": ["Set", "the", "interrupt", "edge", "on", "the", "userspace", "GPIO", "pin", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 254387}
{"url": "https://github.com/okfn-brasil/serenata-toolbox/blob/47b14725e8ed3a53fb52190a2ba5f29182a16959/serenata_toolbox/chamber_of_deputies/official_missions_dataset.py#L64-L78", "sha": "47b14725e8ed3a53fb52190a2ba5f29182a16959", "docstring_summary": "Generate a list of 2 month ranges for the range requested with an\n        intersection between months. This is necessary because we can't search\n        for ranges longer than 3 months and the period searched has to encompass\n        the whole period of the mission.", "language": "python", "parameters": "(start_date, end_date)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "while", "arg_2", "<", "arg_1", ":", "arg_3", "=", "arg_2", "+", "timedelta", "(", "days", "=", "60", ")", "yield", "(", "arg_2", ".", "strftime", "(", "\"%d/%m/%Y\"", ")", ",", "arg_3", ".", "strftime", "(", "\"%d/%m/%Y\"", ")", ")", "arg_2", "+=", "timedelta", "(", "days", "=", "30", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Generate a list of 2 month ranges for the range requested with an\n        intersection between months. This is necessary because we can't search\n        for ranges longer than 3 months and the period searched has to encompass\n        the whole period of the mission.\n        \"\"\"\n        arg_2 = arg_0\n        while arg_2 < arg_1:\n            arg_3 = arg_2 + timedelta(days=60)\n            yield (\n                arg_2.strftime(\"%d/%m/%Y\"),\n                arg_3.strftime(\"%d/%m/%Y\")\n            )\n            arg_2 += timedelta(days=30)", "path": "serenata_toolbox/chamber_of_deputies/official_missions_dataset.py", "identifier": "OfficialMissionsDataset._generate_ranges", "docstring": "Generate a list of 2 month ranges for the range requested with an\n        intersection between months. This is necessary because we can't search\n        for ranges longer than 3 months and the period searched has to encompass\n        the whole period of the mission.", "docstring_tokens": ["Generate", "a", "list", "of", "2", "month", "ranges", "for", "the", "range", "requested", "with", "an", "intersection", "between", "months", ".", "This", "is", "necessary", "because", "we", "can", "t", "search", "for", "ranges", "longer", "than", "3", "months", "and", "the", "period", "searched", "has", "to", "encompass", "the", "whole", "period", "of", "the", "mission", "."], "nwo": "okfn-brasil/serenata-toolbox", "score": 0.6989925036211513, "idx": 254388}
{"url": "https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/models.py#L17-L29", "sha": "70d469ef9a161c1170b53aa017cf02d7c15eb90c", "docstring_summary": "Call this method to increment the named counter.  This is atomic on\n        the database.", "language": "python", "parameters": "(cls, name)", "return_statement": "return counter.value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "transaction", ".", "atomic", "(", ")", ":", "arg_2", "=", "Counter", ".", "objects", ".", "select_for_update", "(", ")", ".", "get", "(", "arg_1", "=", "arg_1", ")", "arg_2", ".", "value", "+=", "1", "arg_2", ".", "save", "(", ")", "return", "arg_2", ".", "value"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Call this method to Func the named counter.  This is atomic on\n        the database.\n\n        :param name:\n            Name for a previously created ``Counter`` object \n        \"\"\"\n        with transaction.atomic():\n            arg_2 = Counter.objects.select_for_update().get(arg_1=arg_1)\n            arg_2.value += 1\n            arg_2.save()\n\n        return arg_2.value", "path": "awl/models.py", "identifier": "Counter.increment", "docstring": "Call this method to increment the named counter.  This is atomic on\n        the database.\n\n        :param name:\n            Name for a previously created ``Counter`` object", "docstring_tokens": ["Call", "this", "method", "to", "increment", "the", "named", "counter", ".", "This", "is", "atomic", "on", "the", "database", "."], "nwo": "cltrudeau/django-awl", "score": 0.09252797783733271, "idx": 254389}
{"url": "https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/execute.py#L392-L406", "sha": "0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b", "docstring_summary": "IFTTT Webhook url", "language": "python", "parameters": "(self)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "data", "[", "arg_0", ".", "execute_name", "]", ":", "raise", "InvalidConfig", "(", "extra_body", "=", "'Value for IFTTT is required on {} device. Get your key here: '", "'https://ifttt.com/services/maker_webhooks/settings'", ".", "format", "(", "arg_0", ".", "name", ")", ")", "if", "not", "arg_0", ".", "data", ".", "get", "(", "'event'", ")", ":", "raise", "InvalidConfig", "(", "extra_body", "=", "'Event option is required for IFTTT on {} device. '", "'You define the event name when creating a Webhook '", "'applet'", ".", "format", "(", "arg_0", ".", "name", ")", ")", "arg_1", "=", "arg_0", ".", "url_pattern", ".", "format", "(", "event", "=", "arg_0", ".", "data", "[", "'event'", "]", ",", "key", "=", "arg_0", ".", "data", "[", "arg_0", ".", "execute_name", "]", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"IFTTT Webhook url\n\n        :return: url\n        :rtype: str\n        \"\"\"\n        if not arg_0.data[arg_0.execute_name]:\n            raise InvalidConfig(extra_body='Value for IFTTT is required on {} device. Get your key here: '\n                                           'https://ifttt.com/services/maker_webhooks/settings'.format(arg_0.name))\n        if not arg_0.data.get('event'):\n            raise InvalidConfig(extra_body='Event option is required for IFTTT on {} device. '\n                                           'You define the event name when creating a Webhook '\n                                           'applet'.format(arg_0.name))\n        arg_1 = arg_0.url_pattern.format(event=arg_0.data['event'], key=arg_0.data[arg_0.execute_name])\n        return arg_1", "path": "amazon_dash/execute.py", "identifier": "ExecuteIFTTT.get_url", "docstring": "IFTTT Webhook url\n\n        :return: url\n        :rtype: str", "docstring_tokens": ["IFTTT", "Webhook", "url"], "nwo": "Nekmo/amazon-dash", "score": 0.758195400618659, "idx": 254390}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/types/sliceUtils.py#L9-L36", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "convert python slice to value of SLICE hdl type", "language": "python", "parameters": "(sliceVals, width)", "return_statement": "return Slice.getValueCls()((start, stop), SLICE, 1, updateTime)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "step", "is", "not", "None", ":", "raise", "NotImplementedError", "(", ")", "arg_2", "=", "arg_0", ".", "start", "arg_3", "=", "arg_0", ".", "stop", "if", "arg_0", ".", "start", "is", "None", ":", "arg_2", "=", "INT", ".", "fromPy", "(", "arg_1", ")", "else", ":", "arg_2", "=", "toHVal", "(", "arg_0", ".", "start", ")", "if", "arg_0", ".", "stop", "is", "None", ":", "arg_3", "=", "INT", ".", "fromPy", "(", "0", ")", "else", ":", "arg_3", "=", "toHVal", "(", "arg_0", ".", "stop", ")", "arg_4", "=", "isinstance", "(", "arg_2", ",", "Value", ")", "arg_5", "=", "isinstance", "(", "arg_3", ",", "Value", ")", "arg_6", "=", "arg_4", "and", "arg_5", "if", "arg_6", ":", "arg_7", "=", "max", "(", "arg_2", ".", "updateTime", ",", "arg_3", ".", "updateTime", ")", "else", ":", "arg_7", "=", "-", "1", "return", "Slice", ".", "getValueCls", "(", ")", "(", "(", "arg_2", ",", "arg_3", ")", ",", "SLICE", ",", "1", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"convert python slice to value of SLICE hdl type\"\"\"\n    if arg_0.step is not None:\n        raise NotImplementedError()\n\n    arg_2 = arg_0.start\n    arg_3 = arg_0.stop\n\n    if arg_0.start is None:\n        arg_2 = INT.fromPy(arg_1)\n    else:\n        arg_2 = toHVal(arg_0.start)\n\n    if arg_0.stop is None:\n        arg_3 = INT.fromPy(0)\n    else:\n        arg_3 = toHVal(arg_0.stop)\n\n    arg_4 = isinstance(arg_2, Value)\n    arg_5 = isinstance(arg_3, Value)\n\n    arg_6 = arg_4 and arg_5\n    if arg_6:\n        arg_7 = max(arg_2.updateTime, arg_3.updateTime)\n    else:\n        arg_7 = -1\n\n    return Slice.getValueCls()((arg_2, arg_3), SLICE, 1, arg_7)", "path": "hwt/hdl/types/sliceUtils.py", "identifier": "slice_to_SLICE", "docstring": "convert python slice to value of SLICE hdl type", "docstring_tokens": ["convert", "python", "slice", "to", "value", "of", "SLICE", "hdl", "type"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 254391}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1951-L1990", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "compat_convertHashedIndexes - Reindex fields, used for when you change the propery \"hashIndex\" on one or more fields.", "language": "python", "parameters": "(self, fetchAll=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "IndexedRedisSave", "(", "arg_0", ".", "mdl", ")", "if", "arg_1", "is", "True", ":", "arg_3", "=", "arg_0", ".", "all", "(", ")", "arg_2", ".", "Func", "(", "arg_3", ")", "else", ":", "arg_4", "=", "False", "arg_5", "=", "arg_0", ".", "getPrimaryKeys", "(", ")", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "arg_0", ".", "get", "(", "arg_6", ")", "if", "not", "arg_7", ":", "if", "arg_4", "is", "False", ":", "sys", ".", "stderr", ".", "write", "(", "'WARNING(once)! An object (type=%s , pk=%d) disappered while '", "'running Func! This probably means an application '", "'is using the model while converting indexes. This is a very BAD IDEA (tm).'", ")", "arg_4", "=", "True", "continue", "arg_2", ".", "Func", "(", "[", "arg_7", "]", ")"], "function": "def Func(arg_0, arg_1=True):\n\t\t'''\n\t\t\tFunc - Reindex fields, used for when you change the propery \"hashIndex\" on one or more fields.\n\n\t\t\tFor each field, this will delete both the hash and unhashed keys to an object, \n\t\t\t  and then save a hashed or unhashed value, depending on that field's value for \"hashIndex\".\n\n\t\t\tFor an IndexedRedisModel class named \"MyModel\", call as \"MyModel.objects.Func()\"\n\n\t\t\tNOTE: This works one object at a time (regardless of #fetchAll), so that an unhashable object does not trash all data.\n\n\t\t\tThis method is intended to be used while your application is offline,\n\t\t\t  as it doesn't make sense to be changing your model while applications are actively using it.\n\n\t\t\t@param fetchAll <bool>, Default True - If True, all objects will be fetched first, then converted.\n\t\t\t  This is generally what you want to do, as it is more efficient. If you are memory contrainted,\n\t\t\t  you can set this to \"False\", and it will fetch one object at a time, convert it, and save it back.\n\n\t\t'''\n\n\t\targ_2 = IndexedRedisSave(arg_0.mdl)\n\n\t\tif arg_1 is True:\n\t\t\targ_3 = arg_0.all()\n\t\t\targ_2.Func(arg_3)\n\t\telse:\n\t\t\targ_4 = False\n\n\t\t\targ_5 = arg_0.getPrimaryKeys()\n\t\t\tfor arg_6 in arg_5:\n\t\t\t\targ_7 = arg_0.get(arg_6)\n\t\t\t\tif not arg_7:\n\t\t\t\t\tif arg_4 is False:\n\t\t\t\t\t\tsys.stderr.write('WARNING(once)! An object (type=%s , pk=%d) disappered while '  \\\n\t\t\t\t\t\t\t'running Func! This probably means an application '  \\\n\t\t\t\t\t\t\t'is using the model while converting indexes. This is a very BAD IDEA (tm).')\n\t\t\t\t\t\t\n\t\t\t\t\t\targ_4 = True\n\t\t\t\t\tcontinue\n\t\t\t\targ_2.Func([arg_7])", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisQuery.compat_convertHashedIndexes", "docstring": "compat_convertHashedIndexes - Reindex fields, used for when you change the propery \"hashIndex\" on one or more fields.\n\n\t\t\tFor each field, this will delete both the hash and unhashed keys to an object, \n\t\t\t  and then save a hashed or unhashed value, depending on that field's value for \"hashIndex\".\n\n\t\t\tFor an IndexedRedisModel class named \"MyModel\", call as \"MyModel.objects.compat_convertHashedIndexes()\"\n\n\t\t\tNOTE: This works one object at a time (regardless of #fetchAll), so that an unhashable object does not trash all data.\n\n\t\t\tThis method is intended to be used while your application is offline,\n\t\t\t  as it doesn't make sense to be changing your model while applications are actively using it.\n\n\t\t\t@param fetchAll <bool>, Default True - If True, all objects will be fetched first, then converted.\n\t\t\t  This is generally what you want to do, as it is more efficient. If you are memory contrainted,\n\t\t\t  you can set this to \"False\", and it will fetch one object at a time, convert it, and save it back.", "docstring_tokens": ["compat_convertHashedIndexes", "-", "Reindex", "fields", "used", "for", "when", "you", "change", "the", "propery", "hashIndex", "on", "one", "or", "more", "fields", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 254392}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L763-L822", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Load repository from a directory path and update the current instance.", "language": "python", "parameters": "(self, path)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "strip", "(", ")", "in", "(", "''", ",", "'.'", ")", ":", "arg_1", "=", "os", ".", "getcwd", "(", ")", "arg_2", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "expanduser", "(", "arg_1", ")", ")", "if", "not", "arg_0", ".", "is_repository", "(", "arg_2", ")", ":", "raise", "Exception", "(", "\"no repository found in '%s'\"", "%", "str", "(", "arg_2", ")", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "\".pyrepinfo\"", ")", "try", ":", "arg_4", "=", "open", "(", "arg_3", ",", "'rb'", ")", "except", "Exception", "as", "e", ":", "raise", "Exception", "(", "\"unable to open repository file(%s)\"", "%", "e", ")", "arg_5", "=", "Locker", "(", "filePath", "=", "None", ",", "lockPass", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", ",", "lockPath", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "\".pyreplock\"", ")", ")", "arg_6", ",", "arg_7", "=", "arg_5", ".", "acquire_lock", "(", ")", "if", "not", "arg_6", ":", "warnings", ".", "warn", "(", "\"code %s. Unable to aquire the lock when calling 'Func'. You may try again!\"", "%", "(", "arg_7", ",", ")", ")", "return", "try", ":", "try", ":", "arg_8", "=", "pickle", ".", "load", "(", "arg_4", ")", "except", "Exception", "as", "e", ":", "arg_4", ".", "close", "(", ")", "raise", "Exception", "(", "\"unable to pickle load repository (%s)\"", "%", "e", ")", "finally", ":", "arg_4", ".", "close", "(", ")", "if", "not", "isinstance", "(", "arg_8", ",", "Repository", ")", ":", "raise", "Exception", "(", "\".pyrepinfo in '%s' is not a repository instance.\"", "%", "s", ")", "else", ":", "arg_0", ".", "__reset_repository", "(", ")", "arg_0", ".", "__update_repository", "(", "arg_8", ")", "arg_0", ".", "__path", "=", "arg_2", "arg_0", ".", "__state", "=", "arg_0", ".", "_get_or_create_state", "(", ")", "except", "Exception", "as", "e", ":", "arg_5", ".", "release_lock", "(", ")", "raise", "Exception", "(", "e", ")", "finally", ":", "arg_5", ".", "release_lock", "(", ")", "arg_0", ".", "__locker", "=", "arg_5", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Load repository from a directory path and update the current instance.\n\n        :Parameters:\n            #. path (string): The path of the directory from where to load the repository.\n               If '.' or an empty string is passed, the current working directory will be used.\n\n        :Returns:\n             #. repository (pyrep.Repository): returns self repository with loaded data.\n        \"\"\"\n        # try to open\n        if arg_1.strip() in ('','.'):\n            arg_1 = os.getcwd()\n        arg_2 = os.path.realpath( os.path.expanduser(arg_1) )\n        if not arg_0.is_repository(arg_2):\n            raise Exception(\"no repository found in '%s'\"%str(arg_2))\n        # get pyrepinfo path\n        arg_3 = os.path.join(arg_2, \".pyrepinfo\")\n        try:\n            arg_4 = open(arg_3, 'rb')\n        except Exception as e:\n            raise Exception(\"unable to open repository file(%s)\"%e)\n        # before doing anything try to lock repository\n        # can't decorate with @acquire_lock because this will point to old repository\n        # path or to current working directory which might not be the path anyways\n        arg_5 =  Locker(filePath=None, lockPass=str(uuid.uuid1()), lockPath=os.path.join(arg_2, \".pyreplock\"))\n        arg_6, arg_7 = arg_5.acquire_lock()\n        # check if acquired.\n        if not arg_6:\n            warnings.warn(\"code %s. Unable to aquire the lock when calling 'Func'. You may try again!\"%(arg_7,) )\n            return\n        try:\n            # unpickle file\n            try:\n                arg_8 = pickle.load( arg_4 )\n            except Exception as e:\n                arg_4.close()\n                raise Exception(\"unable to pickle load repository (%s)\"%e)\n            finally:\n                arg_4.close()\n            # check if it's a PyrepInfo instance\n            if not isinstance(arg_8, Repository):\n                raise Exception(\".pyrepinfo in '%s' is not a repository instance.\"%s)\n            else:\n                # update info path\n                arg_0.__reset_repository()\n                arg_0.__update_repository(arg_8)\n                arg_0.__path = arg_2\n            # set timestamp\n            arg_0.__state = arg_0._get_or_create_state()\n        except Exception as e:\n            arg_5.release_lock()\n            raise Exception(e)\n        finally:\n            arg_5.release_lock()\n        # set loaded repo locker path to L because repository have been moved to another directory\n        arg_0.__locker = arg_5\n        # return\n        return arg_0", "path": "OldRepository.py", "identifier": "Repository.load_repository", "docstring": "Load repository from a directory path and update the current instance.\n\n        :Parameters:\n            #. path (string): The path of the directory from where to load the repository.\n               If '.' or an empty string is passed, the current working directory will be used.\n\n        :Returns:\n             #. repository (pyrep.Repository): returns self repository with loaded data.", "docstring_tokens": ["Load", "repository", "from", "a", "directory", "path", "and", "update", "the", "current", "instance", "."], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 254393}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/parse/scanner.py#L114-L118", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "r'\\d+", "language": "python", "parameters": "(self, s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "pos", "arg_0", ".", "add_token", "(", "'NUMBER'", ",", "int", "(", "arg_1", ")", ")", "arg_0", ".", "pos", "=", "arg_2", "+", "len", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        r'\\d+'\n        arg_2 = arg_0.pos\n        arg_0.add_token('NUMBER', int(arg_1))\n        arg_0.pos = arg_2 + len(arg_1)", "path": "trepan/processor/parse/scanner.py", "identifier": "LocationScanner.t_number", "docstring": "r'\\d+", "docstring_tokens": ["r", "\\", "d", "+"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 254394}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/services.py#L21-L34", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Function to create an overview of the services.\n        Will print a list of ports found an the number of times the port was seen.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "Service", ".", "search", "(", ")", "arg_0", "=", "arg_0", ".", "filter", "(", "\"term\"", ",", "state", "=", "'open'", ")", "arg_0", ".", "aggs", ".", "bucket", "(", "'port_count'", ",", "'terms'", ",", "field", "=", "'port'", ",", "order", "=", "{", "'_count'", ":", "'desc'", "}", ",", "size", "=", "100", ")", ".", "metric", "(", "'unique_count'", ",", "'cardinality'", ",", "field", "=", "'address'", ")", "arg_1", "=", "arg_0", ".", "execute", "(", ")", "print_line", "(", "\"Port     Count\"", ")", "print_line", "(", "\"---------------\"", ")", "for", "arg_2", "in", "arg_1", ".", "aggregations", ".", "port_count", ".", "buckets", ":", "print_line", "(", "\"{0:<7}  {1}\"", ".", "format", "(", "arg_2", ".", "key", ",", "arg_2", ".", "unique_count", ".", "value", ")", ")"], "function": "def Func():\n    \"\"\"\n        Function to create an Func of the services.\n        Will print a list of ports found an the number of times the port was seen.\n    \"\"\"\n    arg_0 = Service.search()\n    arg_0 = arg_0.filter(\"term\", state='open')\n    arg_0.aggs.bucket('port_count', 'terms', field='port', order={'_count': 'desc'}, size=100) \\\n        .metric('unique_count', 'cardinality', field='address')\n    arg_1 = arg_0.execute()\n    print_line(\"Port     Count\")\n    print_line(\"---------------\")\n    for arg_2 in arg_1.aggregations.port_count.buckets:\n        print_line(\"{0:<7}  {1}\".format(arg_2.key, arg_2.unique_count.value))", "path": "jackal/scripts/services.py", "identifier": "overview", "docstring": "Function to create an overview of the services.\n        Will print a list of ports found an the number of times the port was seen.", "docstring_tokens": ["Function", "to", "create", "an", "overview", "of", "the", "services", ".", "Will", "print", "a", "list", "of", "ports", "found", "an", "the", "number", "of", "times", "the", "port", "was", "seen", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 254395}
{"url": "https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/flask/template_filter.py#L9-L33", "sha": "a8e1324c4d6e8b063a0d353bcd03bb8e57edd888", "docstring_summary": "Format a pathname", "language": "python", "parameters": "(\n        pathname,\n        max_length)", "return_statement": "return pathname", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "<=", "3", ":", "raise", "ValueError", "(", "\"max length must be larger than 3\"", ")", "if", "len", "(", "arg_0", ")", ">", "arg_1", ":", "arg_0", "=", "\"...{}\"", ".", "format", "(", "arg_0", "[", "-", "(", "arg_1", "-", "3", ")", ":", "]", ")", "return", "arg_0"], "function": "def Func(\n        arg_0,\n        arg_1):\n    \"\"\"\n    Format a pathname\n\n    :param str pathname: Pathname to format\n    :param int max_length: Maximum length of result pathname (> 3)\n    :return: Formatted pathname\n    :rtype: str\n    :raises ValueError: If *max_length* is not larger than 3\n\n    This function formats a pathname so it is not longer than *max_length*\n    characters. The resulting pathname is returned. It does so by replacing\n    characters at the start of the *pathname* with three dots, if necessary.\n    The idea is that the end of the *pathname* is the most important part\n    to be able to identify the file.\n    \"\"\"\n    if arg_1 <= 3:\n        raise ValueError(\"max length must be larger than 3\")\n\n    if len(arg_0) > arg_1:\n        arg_0 = \"...{}\".format(arg_0[-(arg_1-3):])\n\n    return arg_0", "path": "starling/flask/template_filter.py", "identifier": "format_pathname", "docstring": "Format a pathname\n\n    :param str pathname: Pathname to format\n    :param int max_length: Maximum length of result pathname (> 3)\n    :return: Formatted pathname\n    :rtype: str\n    :raises ValueError: If *max_length* is not larger than 3\n\n    This function formats a pathname so it is not longer than *max_length*\n    characters. The resulting pathname is returned. It does so by replacing\n    characters at the start of the *pathname* with three dots, if necessary.\n    The idea is that the end of the *pathname* is the most important part\n    to be able to identify the file.", "docstring_tokens": ["Format", "a", "pathname"], "nwo": "geoneric/starling", "score": 0.09252797783733271, "idx": 254396}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L195-L200", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return a list of cross references.", "language": "python", "parameters": "(self, extr_lic)", "return_statement": "return map(lambda xref_triple: xref_triple[2], xrefs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "RDFS", ".", "seeAlso", ",", "None", ")", ")", ")", "return", "map", "(", "lambda", "xref_triple", ":", "xref_triple", "[", "2", "]", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a list of cross references.\n        \"\"\"\n        arg_2 = list(arg_0.graph.triples((arg_1, RDFS.seeAlso, None)))\n        return map(lambda xref_triple: xref_triple[2], arg_2)", "path": "spdx/parsers/rdf.py", "identifier": "LicenseParser.get_extr_lics_xref", "docstring": "Return a list of cross references.", "docstring_tokens": ["Return", "a", "list", "of", "cross", "references", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254397}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L143-L168", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Handle new websocket connection.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ".", "request", "=", "WSGIRequest", "(", "arg_0", ".", "ws", ".", "environ", ")", "arg_1", ".", "ws", "=", "arg_0", "arg_1", ".", "send", "=", "arg_0", ".", "send", "arg_1", ".", "reply", "=", "arg_0", ".", "reply", "arg_0", ".", "logger", "=", "arg_0", ".", "ws", ".", "logger", "arg_0", ".", "remote_ids", "=", "collections", ".", "defaultdict", "(", "set", ")", "arg_0", ".", "_tx_buffer", "=", "{", "}", "arg_0", ".", "_tx_buffer_id_gen", "=", "itertools", ".", "cycle", "(", "irange", "(", "sys", ".", "maxint", ")", ")", "arg_0", ".", "_tx_next_id_gen", "=", "itertools", ".", "cycle", "(", "irange", "(", "sys", ".", "maxint", ")", ")", "arg_0", ".", "_tx_next_id", "=", "next", "(", "arg_0", ".", "_tx_next_id_gen", ")", "arg_1", ".", "remote_addr", "=", "arg_0", ".", "remote_addr", "=", "'{0[REMOTE_ADDR]}:{0[REMOTE_PORT]}'", ".", "format", "(", "arg_0", ".", "ws", ".", "environ", ",", ")", "arg_1", ".", "subs", "=", "{", "}", "safe_call", "(", "arg_0", ".", "logger", ".", "info", ",", "'+ %s OPEN'", ",", "arg_0", ")", "arg_0", ".", "send", "(", "'o'", ")", "arg_0", ".", "send", "(", "'a[\"{\\\\\"server_id\\\\\":\\\\\"0\\\\\"}\"]'", ")"], "function": "def Func(arg_0):\n        \"\"\"Handle new websocket connection.\"\"\"\n        arg_1.request = WSGIRequest(arg_0.ws.environ)\n        arg_1.ws = arg_0\n        arg_1.send = arg_0.send\n        arg_1.reply = arg_0.reply\n\n        arg_0.logger = arg_0.ws.logger\n        arg_0.remote_ids = collections.defaultdict(set)\n\n        # `_tx_buffer` collects outgoing messages which must be sent in order\n        arg_0._tx_buffer = {}\n        # track the head of the queue (buffer) and the next msg to be sent\n        arg_0._tx_buffer_id_gen = itertools.cycle(irange(sys.maxint))\n        arg_0._tx_next_id_gen = itertools.cycle(irange(sys.maxint))\n        # start by waiting for the very first message\n        arg_0._tx_next_id = next(arg_0._tx_next_id_gen)\n\n        arg_1.remote_addr = arg_0.remote_addr = \\\n            '{0[REMOTE_ADDR]}:{0[REMOTE_PORT]}'.format(\n                arg_0.ws.environ,\n            )\n        arg_1.subs = {}\n        safe_call(arg_0.logger.info, '+ %s OPEN', arg_0)\n        arg_0.send('o')\n        arg_0.send('a[\"{\\\\\"server_id\\\\\":\\\\\"0\\\\\"}\"]')", "path": "dddp/websocket.py", "identifier": "DDPWebSocketApplication.on_open", "docstring": "Handle new websocket connection.", "docstring_tokens": ["Handle", "new", "websocket", "connection", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 254398}
{"url": "https://github.com/awentzonline/keras-vgg-buddy/blob/716cb66396b839a66ec8dc66998066b360a8f395/keras_vgg_buddy/models.py#L48-L53", "sha": "716cb66396b839a66ec8dc66998066b360a8f395", "docstring_summary": "Get symbolic output of a layer.", "language": "python", "parameters": "(self, name)", "return_statement": "return self._f_layer_outputs[name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", "in", "arg_0", ".", "_f_layer_outputs", ":", "arg_2", "=", "arg_0", ".", "net", ".", "get_layer", "(", "arg_1", ")", "arg_0", ".", "_f_layer_outputs", "[", "arg_1", "]", "=", "arg_2", ".", "output", "return", "arg_0", ".", "_f_layer_outputs", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        '''Get symbolic output of a layer.'''\n        if not arg_1 in arg_0._f_layer_outputs:\n            arg_2 = arg_0.net.get_layer(arg_1)\n            arg_0._f_layer_outputs[arg_1] = arg_2.output\n        return arg_0._f_layer_outputs[arg_1]", "path": "keras_vgg_buddy/models.py", "identifier": "VGG16.get_layer_output", "docstring": "Get symbolic output of a layer.", "docstring_tokens": ["Get", "symbolic", "output", "of", "a", "layer", "."], "nwo": "awentzonline/keras-vgg-buddy", "score": 0.19858476458209082, "idx": 254399}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1374-L1418", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Move a directory in the repository from one place to another. It insures moving all the\n        files and subdirectories in the system.", "language": "python", "parameters": "(self, relativePath, relativeDestination, replace=False, verbose=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ")", ":", "arg_1", "=", "os", ".", "path", ".", "normpath", "(", "arg_1", ")", "arg_2", "=", "os", ".", "path", ".", "normpath", "(", "arg_2", ")", "arg_5", "=", "list", "(", "arg_0", ".", "walk_files_info", "(", "arg_1", "=", "arg_1", ")", ")", "arg_6", "=", "list", "(", "arg_0", ".", "walk_directories_relative_path", "(", "arg_1", "=", "arg_1", ")", ")", "arg_7", ",", "arg_8", "=", "arg_0", ".", "get_directory_info", "(", "arg_1", ")", "assert", "arg_7", "is", "not", "None", ",", "arg_8", "arg_0", ".", "reFunc", "(", "arg_1", "=", "arg_1", ",", "removeFromSystem", "=", "False", ")", "arg_0", ".", "add_directory", "(", "arg_2", ")", "for", "arg_9", ",", "arg_10", "in", "arg_5", ":", "arg_11", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_1", ",", "arg_9", ")", "arg_12", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_2", ",", "arg_9", ")", "arg_13", ",", "arg_14", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_9", ")", ")", "arg_7", "=", "arg_0", ".", "add_directory", "(", "arg_13", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_12", ")", ":", "if", "arg_3", ":", "os", ".", "remove", "(", "arg_12", ")", "if", "arg_4", ":", "warnings", ".", "warn", "(", "\"file '%s' is copied replacing existing one in destination '%s'.\"", "%", "(", "arg_14", ",", "arg_13", ")", ")", "else", ":", "if", "arg_4", ":", "warnings", ".", "warn", "(", "\"file '%s' is not copied because the same file exists in destination '%s'.\"", "%", "(", "arg_14", ",", "arg_12", ")", ")", "continue", "os", ".", "rename", "(", "arg_11", ",", "arg_12", ")", "arg_15", ".", "__getitem__", "(", "arg_7", ",", "\"files\"", ")", "[", "arg_14", "]", "=", "arg_10", "arg_0", ".", "save", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=True):\n        \"\"\"\n        Move a directory in the repository from one place to another. It insures moving all the\n        files and subdirectories in the system.\n\n        :Parameters:\n            #. relativePath (string): The relative to the repository path of the directory to be moved.\n            #. relativeDestination (string): The new relative to the repository path of the directory.\n            #. replace (boolean): Whether to replace existing files with the same name in the new created directory.\n            #. verbose (boolean): Whether to be warn and informed about any abnormalities.\n        \"\"\"\n        # normalize path\n        arg_1    = os.path.normpath(arg_1)\n        arg_2 = os.path.normpath(arg_2)\n        # get files and directories\n        arg_5 = list( arg_0.walk_files_info(arg_1=arg_1) )\n        arg_6  = list( arg_0.walk_directories_relative_path(arg_1=arg_1) )\n        arg_7, arg_8 = arg_0.get_directory_info(arg_1)\n        assert arg_7 is not None, arg_8\n        # remove directory info only\n        arg_0.reFunc(arg_1=arg_1, removeFromSystem=False)\n        # create new relative path\n        arg_0.add_directory(arg_2)\n        # move files\n        for arg_9, arg_10 in arg_5:\n            arg_11      = os.path.join(arg_0.__path, arg_1, arg_9)\n            arg_12 = os.path.join(arg_0.__path, arg_2, arg_9)\n            # add directory\n            arg_13, arg_14 = os.path.split(os.path.join(arg_2, arg_9))\n            arg_7 = arg_0.add_directory( arg_13 )\n            # move file\n            if os.path.isfile(arg_12):\n                if arg_3:\n                    os.remove(arg_12)\n                    if arg_4:\n                        warnings.warn(\"file '%s' is copied replacing existing one in destination '%s'.\"%(arg_14, arg_13))\n                else:\n                    if arg_4:\n                        warnings.warn(\"file '%s' is not copied because the same file exists in destination '%s'.\"%(arg_14,arg_12))\n                    continue\n            os.rename(arg_11, arg_12)\n            # set file information\n            arg_15.__getitem__(arg_7, \"files\")[arg_14] = arg_10\n        # save repository\n        arg_0.save()", "path": "OldRepository.py", "identifier": "Repository.move_directory", "docstring": "Move a directory in the repository from one place to another. It insures moving all the\n        files and subdirectories in the system.\n\n        :Parameters:\n            #. relativePath (string): The relative to the repository path of the directory to be moved.\n            #. relativeDestination (string): The new relative to the repository path of the directory.\n            #. replace (boolean): Whether to replace existing files with the same name in the new created directory.\n            #. verbose (boolean): Whether to be warn and informed about any abnormalities.", "docstring_tokens": ["Move", "a", "directory", "in", "the", "repository", "from", "one", "place", "to", "another", ".", "It", "insures", "moving", "all", "the", "files", "and", "subdirectories", "in", "the", "system", "."], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 254400}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L717-L737", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Delete a folder. It will recursively delete all the content.", "language": "python", "parameters": "(self, folder)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "is_valid_uuid", "(", "arg_1", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for folder: {0}'", ".", "format", "(", "arg_1", ")", ")", "arg_0", ".", "_authenticated_request", ".", "to_endpoint", "(", "'folder/{}/'", ".", "format", "(", "arg_1", ")", ")", ".", "delete", "(", ")"], "function": "def Func(arg_0, arg_1):\n        '''Delete a folder. It will recursively delete all the content.\n\n        Args:\n            folder_id (str): The UUID of the folder to be deleted.\n\n        Returns:\n            None\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: 403\n            StorageNotFoundException: 404\n            HTTPError: other non-20x error codes\n        '''\n        if not is_valid_uuid(arg_1):\n            raise StorageArgumentException(\n                'Invalid UUID for folder: {0}'.format(arg_1))\n        arg_0._authenticated_request \\\n            .to_endpoint('folder/{}/'.format(arg_1)) \\\n            .delete()", "path": "hbp_service_client/storage_service/api.py", "identifier": "ApiClient.delete_folder", "docstring": "Delete a folder. It will recursively delete all the content.\n\n        Args:\n            folder_id (str): The UUID of the folder to be deleted.\n\n        Returns:\n            None\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: 403\n            StorageNotFoundException: 404\n            HTTPError: other non-20x error codes", "docstring_tokens": ["Delete", "a", "folder", ".", "It", "will", "recursively", "delete", "all", "the", "content", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 254401}
{"url": "https://github.com/kylebebak/questionnaire/blob/ed92642e8a2a0198da198acbcde2707f1d528585/questionnaire/prompters.py#L46-L70", "sha": "ed92642e8a2a0198da198acbcde2707f1d528585", "docstring_summary": "Instantiates a picker, registers custom handlers for going back,\n    and starts the picker.", "language": "python", "parameters": "(prompt, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "'\u2023'", "if", "sys", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "arg_3", "=", "'>'", "def", "go_back", "(", "arg_4", ")", ":", "return", "NFunc", ",", "-", "1", "arg_5", ",", "arg_6", "=", "prepare_options", "(", "arg_1", ")", "arg_7", "=", "arg_2", ".", "get", "(", "'idx'", ",", "0", ")", "arg_4", "=", "Picker", "(", "arg_6", ",", "title", "=", "arg_0", ",", "arg_3", "=", "arg_3", ",", "default_index", "=", "arg_7", ")", "arg_4", ".", "register_custom_handler", "(", "ord", "(", "'h'", ")", ",", "go_back", ")", "arg_4", ".", "register_custom_handler", "(", "curses", ".", "KEY_LEFT", ",", "go_back", ")", "with", "stdout_redirected", "(", "sys", ".", "stderr", ")", ":", "arg_8", ",", "arg_9", "=", "arg_4", ".", "start", "(", ")", "if", "arg_9", "==", "-", "1", ":", "raise", "QuestionnaireGoBack", "if", "arg_2", ".", "get", "(", "'return_index'", ",", "False", ")", ":", "return", "arg_9", "return", "arg_5", "[", "arg_9", "]"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"Instantiates a picker, registers custom handlers for going back,\n    and starts the picker.\n    \"\"\"\n    arg_3 = '\u2023'\n    if sys.version_info < (3, 0):\n        arg_3 = '>'\n\n    def go_back(arg_4):\n        return NFunc, -1\n\n    arg_5, arg_6 = prepare_options(arg_1)\n    arg_7 = arg_2.get('idx', 0)\n\n    arg_4 = Picker(arg_6, title=arg_0, arg_3=arg_3, default_index=arg_7)\n    arg_4.register_custom_handler(ord('h'), go_back)\n    arg_4.register_custom_handler(curses.KEY_LEFT, go_back)\n    with stdout_redirected(sys.stderr):\n        arg_8, arg_9 = arg_4.start()\n        if arg_9 == -1:\n            raise QuestionnaireGoBack\n        if arg_2.get('return_index', False):\n            # `Func` was called by a special client, e.g. `many`\n            return arg_9\n        return arg_5[arg_9]", "path": "questionnaire/prompters.py", "identifier": "one", "docstring": "Instantiates a picker, registers custom handlers for going back,\n    and starts the picker.", "docstring_tokens": ["Instantiates", "a", "picker", "registers", "custom", "handlers", "for", "going", "back", "and", "starts", "the", "picker", "."], "nwo": "kylebebak/questionnaire", "score": 0.4695341856938158, "idx": 254402}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5307-L5423", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Various cast related checks.", "language": "python", "parameters": "(filename, clean_lines, linenum, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "elided", "[", "arg_2", "]", "arg_5", "=", "Search", "(", "r'(\\bnew\\s+(?:const\\s+)?|\\S<\\s*(?:const\\s+)?)?\\b'", "r'(int|float|double|bool|char|int32|uint32|int64|uint64)'", "r'(\\([^)].*)'", ",", "arg_4", ")", "arg_6", "=", "ExpectingFunctionArgs", "(", "arg_1", ",", "arg_2", ")", "if", "arg_5", "and", "not", "arg_6", ":", "arg_7", "=", "arg_5", ".", "group", "(", "2", ")", "arg_8", "=", "arg_5", ".", "group", "(", "1", ")", "if", "Match", "(", "r'\\([^()]+\\)\\s*\\['", ",", "arg_5", ".", "group", "(", "3", ")", ")", ":", "return", "arg_9", "=", "arg_5", ".", "group", "(", "3", ")", "if", "(", "arg_8", "is", "None", "and", "not", "(", "arg_9", "and", "(", "Match", "(", "r'\\((?:[^() ]+::\\s*\\*\\s*)?[^() ]+\\)\\s*\\('", ",", "arg_9", ")", "or", "arg_9", ".", "startswith", "(", "'(*)'", ")", ")", ")", "and", "not", "Match", "(", "r'\\s*using\\s+\\S+\\s*=\\s*'", "+", "arg_7", ",", "arg_4", ")", "and", "not", "Search", "(", "r'new\\(\\S+\\)\\s*'", "+", "arg_7", ",", "arg_4", ")", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'readability/casting'", ",", "4", ",", "'Using deprecated casting style.  '", "'Use static_cast<%s>(...) instead'", "%", "arg_7", ")", "if", "not", "arg_6", ":", "CheckCStyleCast", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "'static_cast'", ",", "r'\\((int|float|double|bool|char|u?int(16|32|64))\\)'", ",", "arg_3", ")", "if", "CheckCStyleCast", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "'const_cast'", ",", "r'\\((char\\s?\\*+\\s?)\\)\\s*\"'", ",", "arg_3", ")", ":", "pass", "else", ":", "CheckCStyleCast", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "'reinterpret_cast'", ",", "r'\\((\\w+\\s?\\*+\\s?)\\)'", ",", "arg_3", ")", "arg_5", "=", "Search", "(", "r'(?:[^\\w]&\\(([^)*][^)]*)\\)[\\w(])|'", "r'(?:[^\\w]&(static|dynamic|down|reinterpret)_cast\\b)'", ",", "arg_4", ")", "if", "arg_5", ":", "arg_10", "=", "False", "arg_5", "=", "Match", "(", "r'^(.*&(?:static|dynamic|down|reinterpret)_cast\\b)<'", ",", "arg_4", ")", "if", "arg_5", ":", "arg_11", ",", "arg_12", ",", "arg_13", "=", "CloseExpression", "(", "arg_1", ",", "arg_2", ",", "len", "(", "arg_5", ".", "group", "(", "1", ")", ")", ")", "if", "arg_13", ">=", "0", "and", "arg_1", ".", "elided", "[", "arg_12", "]", "[", "arg_13", "]", "==", "'('", ":", "arg_11", ",", "arg_14", ",", "arg_15", "=", "CloseExpression", "(", "arg_1", ",", "arg_12", ",", "arg_13", ")", "if", "arg_15", ">=", "0", ":", "arg_16", "=", "arg_1", ".", "elided", "[", "arg_14", "]", "[", "arg_15", ":", "]", "if", "arg_14", "<", "arg_1", ".", "NumLines", "(", ")", "-", "1", ":", "arg_16", "+=", "arg_1", ".", "elided", "[", "arg_14", "+", "1", "]", "if", "Match", "(", "r'\\s*(?:->|\\[)'", ",", "arg_16", ")", ":", "arg_10", "=", "True", "if", "arg_10", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'readability/casting'", ",", "4", ",", "(", "'Are you taking an address of something dereferenced '", "'from a cast?  Wrapping the dereferenced expression in '", "'parentheses will make the binding more obvious'", ")", ")", "else", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'runtime/casting'", ",", "4", ",", "(", "'Are you taking an address of a cast?  '", "'This is dangerous: could be a temp var.  '", "'Take the address before doing the cast, rather than after'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Various cast related checks.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.\n  \"\"\"\n  arg_4 = arg_1.elided[arg_2]\n\n  # Check to see if they're using an conversion function cast.\n  # I just try to capture the most common basic types, though there are more.\n  # Parameterless conversion functions, such as bool(), are allowed as they are\n  # probably a member operator declaration or default constructor.\n  arg_5 = Search(\n      r'(\\bnew\\s+(?:const\\s+)?|\\S<\\s*(?:const\\s+)?)?\\b'\n      r'(int|float|double|bool|char|int32|uint32|int64|uint64)'\n      r'(\\([^)].*)', arg_4)\n  arg_6 = ExpectingFunctionArgs(arg_1, arg_2)\n  if arg_5 and not arg_6:\n    arg_7 = arg_5.group(2)\n\n    # matched_new_or_template is used to silence two false positives:\n    # - New operators\n    # - Template arguments with function types\n    #\n    # For template arguments, we match on types immediately following\n    # an opening bracket without any spaces.  This is a fast way to\n    # silence the common case where the function type is the first\n    # template argument.  False negative with less-than comparison is\n    # avoided because those operators are usually followed by a space.\n    #\n    #   function<double(double)>   // bracket + no space = false positive\n    #   value < double(42)         // bracket + space = true positive\n    arg_8 = arg_5.group(1)\n\n    # Avoid arrays by looking for brackets that come after the closing\n    # parenthesis.\n    if Match(r'\\([^()]+\\)\\s*\\[', arg_5.group(3)):\n      return\n\n    # Other things to ignore:\n    # - Function pointers\n    # - Casts to pointer types\n    # - Placement new\n    # - Alias declarations\n    arg_9 = arg_5.group(3)\n    if (arg_8 is None and\n        not (arg_9 and\n             (Match(r'\\((?:[^() ]+::\\s*\\*\\s*)?[^() ]+\\)\\s*\\(',\n                    arg_9) or\n              arg_9.startswith('(*)'))) and\n        not Match(r'\\s*using\\s+\\S+\\s*=\\s*' + arg_7, arg_4) and\n        not Search(r'new\\(\\S+\\)\\s*' + arg_7, arg_4)):\n      arg_3(arg_0, arg_2, 'readability/casting', 4,\n            'Using deprecated casting style.  '\n            'Use static_cast<%s>(...) instead' %\n            arg_7)\n\n  if not arg_6:\n    CheckCStyleCast(arg_0, arg_1, arg_2, 'static_cast',\n                    r'\\((int|float|double|bool|char|u?int(16|32|64))\\)', arg_3)\n\n  # This doesn't catch all cases. Consider (const char * const)\"hello\".\n  #\n  # (char *) \"foo\" should always be a const_cast (reinterpret_cast won't\n  # compile).\n  if CheckCStyleCast(arg_0, arg_1, arg_2, 'const_cast',\n                     r'\\((char\\s?\\*+\\s?)\\)\\s*\"', arg_3):\n    pass\n  else:\n    # Check pointer casts for other than string constants\n    CheckCStyleCast(arg_0, arg_1, arg_2, 'reinterpret_cast',\n                    r'\\((\\w+\\s?\\*+\\s?)\\)', arg_3)\n\n  # In addition, we look for people taking the address of a cast.  This\n  # is dangerous -- casts can assign to temporaries, so the pointer doesn't\n  # point where you think.\n  #\n  # Some non-identifier character is required before the '&' for the\n  # expression to be recognized as a cast.  These are casts:\n  #   expression = &static_cast<int*>(temporary());\n  #   function(&(int*)(temporary()));\n  #\n  # This is not a cast:\n  #   reference_type&(int* function_param);\n  arg_5 = Search(\n      r'(?:[^\\w]&\\(([^)*][^)]*)\\)[\\w(])|'\n      r'(?:[^\\w]&(static|dynamic|down|reinterpret)_cast\\b)', arg_4)\n  if arg_5:\n    # Try a better error message when the & is bound to something\n    # dereferenced by the casted pointer, as opposed to the casted\n    # pointer itself.\n    arg_10 = False\n    arg_5 = Match(r'^(.*&(?:static|dynamic|down|reinterpret)_cast\\b)<', arg_4)\n    if arg_5:\n      arg_11, arg_12, arg_13 = CloseExpression(arg_1, arg_2, len(arg_5.group(1)))\n      if arg_13 >= 0 and arg_1.elided[arg_12][arg_13] == '(':\n        arg_11, arg_14, arg_15 = CloseExpression(arg_1, arg_12, arg_13)\n        if arg_15 >= 0:\n          arg_16 = arg_1.elided[arg_14][arg_15:]\n          if arg_14 < arg_1.NumLines() - 1:\n            arg_16 += arg_1.elided[arg_14 + 1]\n          if Match(r'\\s*(?:->|\\[)', arg_16):\n            arg_10 = True\n\n    if arg_10:\n      arg_3(arg_0, arg_2, 'readability/casting', 4,\n            ('Are you taking an address of something dereferenced '\n             'from a cast?  Wrapping the dereferenced expression in '\n             'parentheses will make the binding more obvious'))\n    else:\n      arg_3(arg_0, arg_2, 'runtime/casting', 4,\n            ('Are you taking an address of a cast?  '\n             'This is dangerous: could be a temp var.  '\n             'Take the address before doing the cast, rather than after'))", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckCasts", "docstring": "Various cast related checks.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.", "docstring_tokens": ["Various", "cast", "related", "checks", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254403}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/validation.py#L319-L342", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Ravel column or 1d numpy array, else raises an error", "language": "python", "parameters": "(y, warn=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "np", ".", "shape", "(", "arg_0", ")", "if", "len", "(", "arg_2", ")", "==", "1", ":", "return", "np", ".", "ravel", "(", "arg_0", ")", "if", "len", "(", "arg_2", ")", "==", "2", "and", "arg_2", "[", "1", "]", "==", "1", ":", "if", "arg_1", ":", "warnings", ".", "warn", "(", "\"A column-vector y was passed when a 1d array was\"", "\" expected. Please change the shape of y to \"", "\"(n_samples, ), for example using ravel().\"", ",", "DataConversionWarning", ",", "stacklevel", "=", "2", ")", "return", "np", ".", "ravel", "(", "arg_0", ")", "raise", "ValueError", "(", "\"bad input shape {0}\"", ".", "format", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\" Ravel column or 1d numpy array, else raises an error\n\n    Parameters\n    ----------\n    y : array-like\n\n    Returns\n    -------\n    y : array\n\n    \"\"\"\n    arg_2 = np.shape(arg_0)\n    if len(arg_2) == 1:\n        return np.ravel(arg_0)\n    if len(arg_2) == 2 and arg_2[1] == 1:\n        if arg_1:\n            warnings.warn(\"A column-vector y was passed when a 1d array was\"\n                          \" expected. Please change the shape of y to \"\n                          \"(n_samples, ), for example using ravel().\",\n                          DataConversionWarning, stacklevel=2)\n        return np.ravel(arg_0)\n\n    raise ValueError(\"bad input shape {0}\".format(arg_2))", "path": "boyle/utils/validation.py", "identifier": "column_or_1d", "docstring": "Ravel column or 1d numpy array, else raises an error\n\n    Parameters\n    ----------\n    y : array-like\n\n    Returns\n    -------\n    y : array", "docstring_tokens": ["Ravel", "column", "or", "1d", "numpy", "array", "else", "raises", "an", "error"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254404}
{"url": "https://github.com/dogoncouch/lightcli/blob/e63093dfc4f983ec9c9571ff186bf114c1f782c3/lightcli.py#L158-L209", "sha": "e63093dfc4f983ec9c9571ff186bf114c1f782c3", "docstring_summary": "Get an output file name as input", "language": "python", "parameters": "(extension=None)", "return_statement": "return filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "False", "while", "not", "arg_1", ":", "arg_2", "=", "string_input", "(", "'File name? '", ")", "if", "arg_0", ":", "if", "not", "arg_2", ".", "endswith", "(", "arg_0", ")", ":", "if", "arg_0", ".", "startswith", "(", "'.'", ")", ":", "arg_2", "=", "arg_2", "+", "arg_0", "else", ":", "arg_2", "=", "arg_2", "+", "'.'", "+", "arg_0", "if", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "arg_3", "=", "choice_input", "(", "prompt", "=", "arg_2", "+", "' already exists. Overwrite?'", ",", "options", "=", "[", "'y'", ",", "'n'", "]", ")", "if", "arg_3", "==", "'y'", ":", "try", ":", "arg_4", "=", "time", ".", "time", "(", ")", "with", "open", "(", "arg_2", ",", "'a'", ")", "as", "f", ":", "os", ".", "utime", "(", "arg_2", ",", "(", "arg_4", ",", "arg_4", ")", ")", "arg_1", "=", "True", "except", "IOError", ":", "print", "(", "'Write permission denied on '", "+", "arg_2", "+", "'. Try again.'", ")", "except", "PermissionError", ":", "print", "(", "'Write permission denied on '", "+", "arg_2", "+", "'. Try again.'", ")", "except", "FileNotFoundError", ":", "print", "(", "arg_2", "+", "': directory not found. Try again.'", ")", "else", ":", "arg_3", "=", "choice_input", "(", "prompt", "=", "arg_2", "+", "' does not exist. Create it?'", ",", "options", "=", "[", "'y'", ",", "'n'", "]", ")", "if", "arg_3", "==", "'y'", ":", "try", ":", "arg_4", "=", "time", ".", "time", "(", ")", "with", "open", "(", "arg_2", ",", "'w'", ")", "as", "f", ":", "os", ".", "utime", "(", "arg_2", ",", "(", "arg_4", ",", "arg_4", ")", ")", "arg_1", "=", "True", "except", "IOError", ":", "print", "(", "'Write permission denied on '", "+", "arg_2", "+", "'. Try again.'", ")", "except", "PermissionError", ":", "print", "(", "'Write permission denied on '", "+", "arg_2", "+", "'. Try again.'", ")", "except", "FileNotFoundError", ":", "print", "(", "arg_2", "+", "': directory not found. Try again.'", ")", "return", "arg_2"], "function": "def Func(arg_0=None):\n    \"\"\"Get an output file name as input\"\"\"\n    \n    arg_1 = False\n    \n    while not arg_1:\n        arg_2 = string_input('File name? ')\n        if arg_0:\n            if not arg_2.endswith(arg_0):\n                if arg_0.startswith('.'):\n                    arg_2 = arg_2 + arg_0\n                else:\n                    arg_2 = arg_2 + '.' + arg_0\n        if os.path.isfile(arg_2):\n            arg_3 = choice_input(prompt=arg_2 + \\\n                    ' already exists. Overwrite?',\n                    options=['y', 'n'])\n            if arg_3 == 'y':\n                try:\n                    arg_4 = time.time()\n                    with open(arg_2, 'a') as f:\n                        os.utime(arg_2, (arg_4, arg_4))\n                    arg_1 = True\n                except IOError:\n                    print('Write permission denied on ' + arg_2 + \\\n                            '. Try again.')\n                except PermissionError:\n                    print('Write permission denied on ' + arg_2 + \\\n                            '. Try again.')\n                except FileNotFoundError:\n                    print(arg_2 + ': directory not found. Try again.')\n\n        else:\n            arg_3 = choice_input(\n                    prompt=arg_2 + ' does not exist. Create it?',\n                    options=['y', 'n'])\n            if arg_3 == 'y':\n                try:\n                    arg_4 = time.time()\n                    with open(arg_2, 'w') as f:\n                        os.utime(arg_2, (arg_4, arg_4))\n                    arg_1 = True\n                except IOError:\n                    print('Write permission denied on ' + arg_2 + \\\n                            '. Try again.')\n                except PermissionError:\n                    print('Write permission denied on ' + arg_2 + \\\n                            '. Try again.')\n                except FileNotFoundError:\n                    print(arg_2 + ': directory not found. Try again.')\n\n    return arg_2", "path": "lightcli.py", "identifier": "outfile_input", "docstring": "Get an output file name as input", "docstring_tokens": ["Get", "an", "output", "file", "name", "as", "input"], "nwo": "dogoncouch/lightcli", "score": 0.18941942438232184, "idx": 254405}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1938-L1981", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the completed text and a list of completions.", "language": "python", "parameters": "(self, text, line=None, cursor_pos=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "with", "arg_0", ".", "builtin_trap", ":", "return", "arg_0", ".", "Completer", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Return the Funcd text and a list of completions.\n\n        Parameters\n        ----------\n\n           text : string\n             A string of text to be Funcd on.  It can be given as empty and\n             instead a line/position pair are given.  In this case, the\n             Funcr itself will split the line like readline does.\n\n           line : string, optional\n             The Func line that text is part of.\n\n           cursor_pos : int, optional\n             The position of the cursor on the input line.\n\n        Returns\n        -------\n          text : string\n            The actual text that was Funcd.\n\n          matches : list\n            A sorted list with all possible completions.\n\n        The optional arguments allow the completion to take more context into\n        account, and are part of the low-level completion API.\n\n        This is a wrapper around the completion mechanism, similar to what\n        readline does at the command line when the TAB key is hit.  By\n        exposing it as a method, it can be used by other non-readline\n        environments (such as GUIs) for text completion.\n\n        Simple usage example:\n\n        In [1]: x = 'hello'\n\n        In [2]: _ip.Func('x.l')\n        Out[2]: ('x.l', ['x.ljust', 'x.lower', 'x.lstrip'])\n        \"\"\"\n\n        # Inject names into __builtin__ so we can Func on the added names.\n        with arg_0.builtin_trap:\n            return arg_0.Completer.Func(arg_1, arg_2, arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.complete", "docstring": "Return the completed text and a list of completions.\n\n        Parameters\n        ----------\n\n           text : string\n             A string of text to be completed on.  It can be given as empty and\n             instead a line/position pair are given.  In this case, the\n             completer itself will split the line like readline does.\n\n           line : string, optional\n             The complete line that text is part of.\n\n           cursor_pos : int, optional\n             The position of the cursor on the input line.\n\n        Returns\n        -------\n          text : string\n            The actual text that was completed.\n\n          matches : list\n            A sorted list with all possible completions.\n\n        The optional arguments allow the completion to take more context into\n        account, and are part of the low-level completion API.\n\n        This is a wrapper around the completion mechanism, similar to what\n        readline does at the command line when the TAB key is hit.  By\n        exposing it as a method, it can be used by other non-readline\n        environments (such as GUIs) for text completion.\n\n        Simple usage example:\n\n        In [1]: x = 'hello'\n\n        In [2]: _ip.complete('x.l')\n        Out[2]: ('x.l', ['x.ljust', 'x.lower', 'x.lstrip'])", "docstring_tokens": ["Return", "the", "completed", "text", "and", "a", "list", "of", "completions", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254406}
{"url": "https://github.com/controversial/livejson/blob/91021de60903d2d8b2cfb7d8d8910bcf27ec003b/livejson.py#L214-L233", "sha": "91021de60903d2d8b2cfb7d8d8910bcf27ec003b", "docstring_summary": "Overwrite the file with new data. You probably shouldn't do\n        this yourself, it's easy to screw up your whole file with this.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "if", "arg_0", ".", "is_caching", ":", "arg_0", ".", "cache", "=", "Func", "else", ":", "arg_3", "=", "arg_0", ".", "file_contents", "with", "open", "(", "arg_0", ".", "path", ",", "\"w\"", ")", "as", "f", ":", "try", ":", "arg_4", "=", "arg_0", ".", "indent", "if", "arg_0", ".", "pretty", "else", "None", "json", ".", "dump", "(", "Func", ",", "f", ",", "sort_keys", "=", "arg_0", ".", "sort_keys", ",", "arg_4", "=", "arg_4", ")", "except", "Exception", "as", "e", ":", "f", ".", "seek", "(", "0", ")", "f", ".", "truncate", "(", ")", "f", ".", "write", "(", "arg_3", ")", "raise", "e", "arg_0", ".", "_updateType", "(", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"Overwrite the file with new data. You probably shouldn't do\n        this yourself, it's easy to screw up your whole file with this.\"\"\"\n        if arg_0.is_caching:\n            arg_0.cache = Func\n        else:\n            arg_3 = arg_0.file_contents\n            with open(arg_0.path, \"w\") as f:\n                try:\n                    # Write the file. Keep user settings about indentation, etc\n                    arg_4 = arg_0.indent if arg_0.pretty else None\n                    json.dump(Func, f, sort_keys=arg_0.sort_keys, arg_4=arg_4)\n                except Exception as e:\n                    # Rollback to prevent data loss\n                    f.seek(0)\n                    f.truncate()\n                    f.write(arg_3)\n                    # And re-raise the exception\n                    raise e\n        arg_0._updateType()", "path": "livejson.py", "identifier": "_BaseFile.data", "docstring": "Overwrite the file with new data. You probably shouldn't do\n        this yourself, it's easy to screw up your whole file with this.", "docstring_tokens": ["Overwrite", "the", "file", "with", "new", "data", ".", "You", "probably", "shouldn", "t", "do", "this", "yourself", "it", "s", "easy", "to", "screw", "up", "your", "whole", "file", "with", "this", "."], "nwo": "controversial/livejson", "score": 0.28589442541680926, "idx": 254407}
{"url": "https://github.com/umich-brcf-bioinf/Jacquard/blob/83dd61dd2b5e4110468493beec7bc121e6cb3cd1/jacquard/utils/vcf.py#L345-L355", "sha": "83dd61dd2b5e4110468493beec7bc121e6cb3cd1", "docstring_summary": "Returns string representation of sample-format values.", "language": "python", "parameters": "(self, sample)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "sample_tag_values", "[", "arg_1", "]", ".", "values", "(", ")", "if", "arg_2", ":", "return", "\":\"", ".", "join", "(", "arg_2", ")", "else", ":", "return", "\".\""], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns string representation of sample-format values.\n\n        Raises:\n            KeyError: if requested sample is not defined.\n        \"\"\"\n        arg_2 = arg_0.sample_tag_values[arg_1].values()\n        if arg_2:\n            return \":\".join(arg_2)\n        else:\n            return \".\"", "path": "jacquard/utils/vcf.py", "identifier": "VcfRecord._sample_field", "docstring": "Returns string representation of sample-format values.\n\n        Raises:\n            KeyError: if requested sample is not defined.", "docstring_tokens": ["Returns", "string", "representation", "of", "sample", "-", "format", "values", "."], "nwo": "umich-brcf-bioinf/Jacquard", "score": 0.27831918678159157, "idx": 254408}
{"url": "https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L235-L241", "sha": "bb1990cf1460ae42f2dde75f2291625ddac2c0e4", "docstring_summary": "Get the modes supported by this device.", "language": "python", "parameters": "(self)", "return_statement": "return self.__modes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "__modes", ":", "arg_0", ".", "__modes", "=", "yield", "from", "arg_0", ".", "handle_list", "(", "arg_0", ".", "API", ".", "get", "(", "'valid_modes'", ")", ")", "return", "arg_0", ".", "__modes"], "function": "def Func(arg_0):\n        \"\"\"Get the modes supported by this device.\"\"\"\n        if not arg_0.__modes:\n            arg_0.__modes = yield from arg_0.handle_list(\n                arg_0.API.get('valid_modes'))\n\n        return arg_0.__modes", "path": "afsapi/__init__.py", "identifier": "AFSAPI.get_modes", "docstring": "Get the modes supported by this device.", "docstring_tokens": ["Get", "the", "modes", "supported", "by", "this", "device", "."], "nwo": "zhelev/python-afsapi", "score": 0.16638194949711382, "idx": 254409}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L70-L87", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Add a variable named |name| to this value group, optionally giving it a\n        default value and a description.", "language": "python", "parameters": "(self, name: str, default=None, description: str=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", ":", "arg_2", "=", "None", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_vars", ":", "raise", "ConfigError", "(", "f\"{self.name}.{name} already defined.\"", ")", "if", "arg_1", "==", "'name'", ":", "raise", "ConfigError", "(", "\"'name' is a reserved name for a group.\"", ")", "arg_5", "=", "_Var", "(", "arg_1", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_vars", "[", "arg_1", "]", "=", "arg_5"], "function": "def Func(arg_0, arg_1: arg_2, arg_3=None, arg_4: arg_2=None):\n        \"\"\"\n        Add a variable named |name| to this value group, optionally giving it a\n        default value and a description.\n\n        Variables must be Funced with this method before they can be set or read.\n        Reading a variable replaces the variable that was defined previously, but\n        updates the description if a new one is set.\n\n        \"\"\"\n        if arg_1 in arg_0._vars:\n            raise ConfigError(f\"{self.name}.{name} already defined.\")\n\n        if arg_1 == 'name':\n            raise ConfigError(\"'name' is a reserved name for a group.\")\n\n        arg_5 = _Var(arg_1, arg_4=arg_4, arg_3=arg_3)\n        arg_0._vars[arg_1] = arg_5", "path": "manticore/utils/config.py", "identifier": "_Group.add", "docstring": "Add a variable named |name| to this value group, optionally giving it a\n        default value and a description.\n\n        Variables must be added with this method before they can be set or read.\n        Reading a variable replaces the variable that was defined previously, but\n        updates the description if a new one is set.", "docstring_tokens": ["Add", "a", "variable", "named", "|name|", "to", "this", "value", "group", "optionally", "giving", "it", "a", "default", "value", "and", "a", "description", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254410}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treetime.py#L361-L382", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Plot root-to-tip regression", "language": "python", "parameters": "(self, add_internal=False, label=True, ax=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "setup_TreeRegression", "(", ")", "if", "arg_0", ".", "clock_model", "and", "'cov'", "in", "arg_0", ".", "clock_model", ":", "arg_5", "=", "arg_0", ".", "clock_model", "[", "'valid_confidence'", "]", "else", ":", "arg_5", "=", "False", "arg_4", ".", "clock_plot", "(", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", "confidence", "=", "arg_5", ",", "n_sigma", "=", "2", ",", "regression", "=", "arg_0", ".", "clock_model", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True, arg_3=None):\n        \"\"\"\n        Plot root-to-tip regression\n\n        Parameters\n        ----------\n        add_internal : bool\n           If true, plot inte`rnal node positions\n\n        label : bool\n           If true, label the plots\n\n        ax : matplotlib axes\n           If not None, use the provided matplotlib axes to plot the results\n        \"\"\"\n        arg_4 = arg_0.setup_TreeRegression()\n        if arg_0.clock_model and 'cov' in arg_0.clock_model:\n            arg_5 = arg_0.clock_model['valid_confidence']\n        else:\n            arg_5 = False\n        arg_4.clock_plot(arg_3=arg_3, arg_1=arg_1, confidence=arg_5, n_sigma=2,\n                        regression=arg_0.clock_model)", "path": "treetime/treetime.py", "identifier": "TreeTime.plot_root_to_tip", "docstring": "Plot root-to-tip regression\n\n        Parameters\n        ----------\n        add_internal : bool\n           If true, plot inte`rnal node positions\n\n        label : bool\n           If true, label the plots\n\n        ax : matplotlib axes\n           If not None, use the provided matplotlib axes to plot the results", "docstring_tokens": ["Plot", "root", "-", "to", "-", "tip", "regression"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 254411}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/decomposition/truncated_svd.py#L310-L328", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Perform dimensionality reduction on X.", "language": "python", "parameters": "(self, Z)", "return_statement": "return Z.transform(mapper, column='X', dtype=np.ndarray)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", ":", ",", "'X'", "]", "if", "isinstance", "(", "arg_1", ",", "DictRDD", ")", "else", "arg_1", "check_rdd", "(", "arg_2", ",", "(", "sp", ".", "spmatrix", ",", "np", ".", "ndarray", ")", ")", "arg_3", "=", "arg_0", ".", "broadcast", "(", "super", "(", "SparkTruncatedSVD", ",", "arg_0", ")", ".", "Func", ",", "arg_1", ".", "context", ")", "return", "arg_1", ".", "Func", "(", "arg_3", ",", "column", "=", "'X'", ",", "dtype", "=", "np", ".", "ndarray", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Perform dimensionality reduction on X.\n\n        Parameters\n        ----------\n        X : {array-like, sparse matrix}, shape (n_samples, n_features)\n            New data.\n\n        Returns\n        -------\n        X_new : array, shape (n_samples, n_components)\n            Reduced version of X. This will always be a dense array.\n        \"\"\"\n        arg_2 = arg_1[:, 'X'] if isinstance(arg_1, DictRDD) else arg_1\n        check_rdd(arg_2, (sp.spmatrix, np.ndarray))\n\n        arg_3 = arg_0.broadcast(\n            super(SparkTruncatedSVD, arg_0).Func, arg_1.context)\n        return arg_1.Func(arg_3, column='X', dtype=np.ndarray)", "path": "splearn/decomposition/truncated_svd.py", "identifier": "SparkTruncatedSVD.transform", "docstring": "Perform dimensionality reduction on X.\n\n        Parameters\n        ----------\n        X : {array-like, sparse matrix}, shape (n_samples, n_features)\n            New data.\n\n        Returns\n        -------\n        X_new : array, shape (n_samples, n_components)\n            Reduced version of X. This will always be a dense array.", "docstring_tokens": ["Perform", "dimensionality", "reduction", "on", "X", "."], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 254412}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/dag.py#L64-L75", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns the last dag run for a dag, None if there was none.\n    Last dag run can be any type of run eg. scheduled or backfilled.\n    Overridden DagRuns are ignored.", "language": "python", "parameters": "(dag_id, session, include_externally_triggered=False)", "return_statement": "return query.first()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "DagRun", "arg_4", "=", "arg_1", ".", "query", "(", "arg_3", ")", ".", "filter", "(", "arg_3", ".", "dag_id", "==", "arg_0", ")", "if", "not", "arg_2", ":", "arg_4", "=", "arg_4", ".", "filter", "(", "arg_3", ".", "external_trigger", "==", "False", ")", "arg_4", "=", "arg_4", ".", "order_by", "(", "arg_3", ".", "execution_date", ".", "desc", "(", ")", ")", "return", "arg_4", ".", "first", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Returns the last dag run for a dag, None if there was none.\n    Last dag run can be any type of run eg. scheduled or backfilled.\n    Overridden DagRuns are ignored.\n    \"\"\"\n    arg_3 = DagRun\n    arg_4 = arg_1.query(arg_3).filter(arg_3.dag_id == arg_0)\n    if not arg_2:\n        arg_4 = arg_4.filter(arg_3.external_trigger == False)  # noqa\n    arg_4 = arg_4.order_by(arg_3.execution_date.desc())\n    return arg_4.first()", "path": "airflow/models/dag.py", "identifier": "get_last_dagrun", "docstring": "Returns the last dag run for a dag, None if there was none.\n    Last dag run can be any type of run eg. scheduled or backfilled.\n    Overridden DagRuns are ignored.", "docstring_tokens": ["Returns", "the", "last", "dag", "run", "for", "a", "dag", "None", "if", "there", "was", "none", ".", "Last", "dag", "run", "can", "be", "any", "type", "of", "run", "eg", ".", "scheduled", "or", "backfilled", ".", "Overridden", "DagRuns", "are", "ignored", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254413}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L321-L347", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Set the second sequence to be compared.", "language": "python", "parameters": "(self, b)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "arg_0", ".", "b", ":", "return", "arg_0", ".", "b", "=", "arg_1", "arg_0", ".", "matching_blocks", "=", "arg_0", ".", "opcodes", "=", "None", "arg_0", ".", "fullbcount", "=", "None", "arg_0", ".", "__chain_b", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set the second sequence to be compared.\n\n        The first sequence to be compared is not changed.\n\n        >>> s = SequenceMatcher(None, \"abcd\", \"bcde\")\n        >>> s.ratio()\n        0.75\n        >>> s.Func(\"abcd\")\n        >>> s.ratio()\n        1.0\n        >>>\n\n        SequenceMatcher computes and caches detailed information about the\n        second sequence, so if you want to compare one sequence S against\n        many sequences, use .Func(S) once and call .set_seq1(x)\n        repeatedly for each of the other sequences.\n\n        See also set_seqs() and set_seq1().\n        \"\"\"\n\n        if arg_1 is arg_0.b:\n            return\n        arg_0.b = arg_1\n        arg_0.matching_blocks = arg_0.opcodes = None\n        arg_0.fullbcount = None\n        arg_0.__chain_b()", "path": "third_party/stdlib/difflib.py", "identifier": "SequenceMatcher.set_seq2", "docstring": "Set the second sequence to be compared.\n\n        The first sequence to be compared is not changed.\n\n        >>> s = SequenceMatcher(None, \"abcd\", \"bcde\")\n        >>> s.ratio()\n        0.75\n        >>> s.set_seq2(\"abcd\")\n        >>> s.ratio()\n        1.0\n        >>>\n\n        SequenceMatcher computes and caches detailed information about the\n        second sequence, so if you want to compare one sequence S against\n        many sequences, use .set_seq2(S) once and call .set_seq1(x)\n        repeatedly for each of the other sequences.\n\n        See also set_seqs() and set_seq1().", "docstring_tokens": ["Set", "the", "second", "sequence", "to", "be", "compared", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 254414}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/vendor/Qt.py#L422-L443", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Add members found in prior versions up till the next major release", "language": "python", "parameters": "(binding)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "(", "\"__binding__\"", ",", "\"__binding_version__\"", ",", "\"__qt_version__\"", ",", "\"__added__\"", ",", "\"__remapped__\"", ",", "\"__modified__\"", ",", "\"convert\"", ",", "\"load_ui\"", ",", "\"translate\"", ")", ":", "setattr", "(", "arg_0", ",", "arg_1", ",", "getattr", "(", "self", ",", "arg_1", ")", ")", "self", ".", "__added__", ".", "append", "(", "arg_1", ")", "setattr", "(", "arg_0", ",", "\"__wrapper_version__\"", ",", "self", ".", "__version__", ")", "self", ".", "__added__", ".", "append", "(", "\"__wrapper_version__\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Add members found in prior versions up till the next major release\n\n    These members are to be considered deprecated. When a new major\n    release is made, these members are removed.\n\n    \"\"\"\n\n    for arg_1 in (\"__binding__\",\n                   \"__binding_version__\",\n                   \"__qt_version__\",\n                   \"__added__\",\n                   \"__remapped__\",\n                   \"__modified__\",\n                   \"convert\",\n                   \"load_ui\",\n                   \"translate\"):\n        setattr(arg_0, arg_1, getattr(self, arg_1))\n        self.__added__.append(arg_1)\n\n    setattr(arg_0, \"__wrapper_version__\", self.__version__)\n    self.__added__.append(\"__wrapper_version__\")", "path": "pyblish_maya/vendor/Qt.py", "identifier": "_maintain_backwards_compatibility", "docstring": "Add members found in prior versions up till the next major release\n\n    These members are to be considered deprecated. When a new major\n    release is made, these members are removed.", "docstring_tokens": ["Add", "members", "found", "in", "prior", "versions", "up", "till", "the", "next", "major", "release"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 254415}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm.py#L1976-L2044", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Phase 2 for the inference state. The computes the predicted state, then\n    checks to insure that the predicted state is not over-saturated, i.e.\n    look too close like a burst. This indicates that there were so many\n    separate paths learned from the current input columns to the predicted\n    input columns that bursting on the current input columns is most likely\n    generated mix and match errors on cells in the predicted columns. If\n    we detect this situation, we instead turn on only the start cells in the\n    current active columns and re-generate the predicted state from those.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "infPredictedState", "[", "'t'", "]", ".", "fill", "(", "0", ")", "arg_0", ".", "cellConfidence", "[", "'t'", "]", ".", "fill", "(", "0", ")", "arg_0", ".", "colConfidence", "[", "'t'", "]", ".", "fill", "(", "0", ")", "for", "arg_1", "in", "xrange", "(", "arg_0", ".", "numberOfCols", ")", ":", "for", "arg_2", "in", "xrange", "(", "arg_0", ".", "cellsPerColumn", ")", ":", "for", "arg_3", "in", "arg_0", ".", "cells", "[", "arg_1", "]", "[", "arg_2", "]", ":", "arg_4", "=", "arg_0", ".", "_getSegmentActivityLevel", "(", "arg_3", ",", "arg_0", ".", "infActiveState", "[", "'t'", "]", ",", "connectedSynapsesOnly", "=", "False", ")", "if", "arg_4", "<", "arg_0", ".", "activationThreshold", ":", "continue", "if", "arg_0", ".", "verbosity", ">=", "6", ":", "print", "\"incorporating DC from cell[%d,%d]:   \"", "%", "(", "arg_1", ",", "arg_2", ")", ",", "arg_3", ".", "debugPrint", "(", ")", "arg_5", "=", "arg_3", ".", "dutyCycle", "(", ")", "arg_0", ".", "cellConfidence", "[", "'t'", "]", "[", "arg_1", ",", "arg_2", "]", "+=", "arg_5", "arg_0", ".", "colConfidence", "[", "'t'", "]", "[", "arg_1", "]", "+=", "arg_5", "if", "arg_0", ".", "_isSegmentActive", "(", "arg_3", ",", "arg_0", ".", "infActiveState", "[", "'t'", "]", ")", ":", "arg_0", ".", "infPredictedState", "[", "'t'", "]", "[", "arg_1", ",", "arg_2", "]", "=", "1", "arg_7", "=", "arg_0", ".", "colConfidence", "[", "'t'", "]", ".", "sum", "(", ")", "if", "arg_7", ">", "0", ":", "arg_0", ".", "colConfidence", "[", "'t'", "]", "/=", "arg_7", "arg_0", ".", "cellConfidence", "[", "'t'", "]", "/=", "arg_7", "arg_8", "=", "arg_0", ".", "infPredictedState", "[", "'t'", "]", ".", "max", "(", "axis", "=", "1", ")", ".", "sum", "(", ")", "if", "arg_8", ">=", "0.5", "*", "arg_0", ".", "avgInputDensity", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"\n    Phase 2 for the inference state. The computes the predicted state, then\n    checks to insure that the predicted state is not over-saturated, i.e.\n    look too close like a burst. This indicates that there were so many\n    separate paths learned from the current input columns to the predicted\n    input columns that bursting on the current input columns is most likely\n    generated mix and match errors on cells in the predicted columns. If\n    we detect this situation, we instead turn on only the start cells in the\n    current active columns and re-generate the predicted state from those.\n\n    This looks at:\n        - `` infActiveState['t']``\n\n    This modifies:\n        - `` infPredictedState['t']``\n        - `` colConfidence['t']``\n        - `` cellConfidence['t']``\n\n    :returns: (bool) True if we have a decent guess as to the next input.\n              Returning False from here indicates to the caller that we have\n              reached the end of a learned sequence.\n    \"\"\"\n    # Init to zeros to start\n    arg_0.infPredictedState['t'].fill(0)\n    arg_0.cellConfidence['t'].fill(0)\n    arg_0.colConfidence['t'].fill(0)\n\n    # Phase 2 - Compute new predicted state and update cell and column\n    #   confidences\n    for arg_1 in xrange(arg_0.numberOfCols):\n\n      # For each cell in the column\n      for arg_2 in xrange(arg_0.cellsPerColumn):\n\n        # For each segment in the cell\n        for arg_3 in arg_0.cells[arg_1][arg_2]:\n\n          # See if it has the min number of active synapses\n          arg_4 = arg_0._getSegmentActivityLevel(\n              arg_3, arg_0.infActiveState['t'], connectedSynapsesOnly=False)\n          if arg_4 < arg_0.activationThreshold:\n            continue\n\n          # Incorporate the confidence into the owner cell and column\n          if arg_0.verbosity >= 6:\n            print \"incorporating DC from cell[%d,%d]:   \" % (arg_1, arg_2),\n            arg_3.debugPrint()\n          arg_5 = arg_3.dutyCycle()\n          arg_0.cellConfidence['t'][arg_1, arg_2] += arg_5\n          arg_0.colConfidence['t'][arg_1] += arg_5\n\n          # If we reach threshold on the connected synapses, predict it\n          # If not active, skip over it\n          if arg_0._isSegmentActive(arg_3, arg_0.infActiveState['t']):\n            arg_0.infPredictedState['t'][arg_1, arg_2] = 1\n\n    # Normalize column and cell confidences\n    arg_7 = arg_0.colConfidence['t'].sum()\n    if arg_7 > 0:\n      arg_0.colConfidence['t'] /= arg_7\n      arg_0.cellConfidence['t'] /= arg_7\n\n    # Are we predicting the required minimum number of columns?\n    arg_8 = arg_0.infPredictedState['t'].max(axis=1).sum()\n    if arg_8 >= 0.5 * arg_0.avgInputDensity:\n      return True\n    else:\n      return False", "path": "src/nupic/algorithms/backtracking_tm.py", "identifier": "BacktrackingTM._inferPhase2", "docstring": "Phase 2 for the inference state. The computes the predicted state, then\n    checks to insure that the predicted state is not over-saturated, i.e.\n    look too close like a burst. This indicates that there were so many\n    separate paths learned from the current input columns to the predicted\n    input columns that bursting on the current input columns is most likely\n    generated mix and match errors on cells in the predicted columns. If\n    we detect this situation, we instead turn on only the start cells in the\n    current active columns and re-generate the predicted state from those.\n\n    This looks at:\n        - `` infActiveState['t']``\n\n    This modifies:\n        - `` infPredictedState['t']``\n        - `` colConfidence['t']``\n        - `` cellConfidence['t']``\n\n    :returns: (bool) True if we have a decent guess as to the next input.\n              Returning False from here indicates to the caller that we have\n              reached the end of a learned sequence.", "docstring_tokens": ["Phase", "2", "for", "the", "inference", "state", ".", "The", "computes", "the", "predicted", "state", "then", "checks", "to", "insure", "that", "the", "predicted", "state", "is", "not", "over", "-", "saturated", "i", ".", "e", ".", "look", "too", "close", "like", "a", "burst", ".", "This", "indicates", "that", "there", "were", "so", "many", "separate", "paths", "learned", "from", "the", "current", "input", "columns", "to", "the", "predicted", "input", "columns", "that", "bursting", "on", "the", "current", "input", "columns", "is", "most", "likely", "generated", "mix", "and", "match", "errors", "on", "cells", "in", "the", "predicted", "columns", ".", "If", "we", "detect", "this", "situation", "we", "instead", "turn", "on", "only", "the", "start", "cells", "in", "the", "current", "active", "columns", "and", "re", "-", "generate", "the", "predicted", "state", "from", "those", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254416}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py#L186-L203", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Decode the data passed in and potentially flush the decoder.", "language": "python", "parameters": "(self, data, decode_content, flush_decoder)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "if", "arg_2", "and", "arg_0", ".", "Funcr", ":", "arg_1", "=", "arg_0", ".", "Funcr", ".", "decompress", "(", "arg_1", ")", "except", "(", "IOError", ",", "zlib", ".", "error", ")", "as", "e", ":", "arg_4", "=", "arg_0", ".", "headers", ".", "get", "(", "'content-encoding'", ",", "''", ")", ".", "lower", "(", ")", "raise", "DecodeError", "(", "\"Received response with content-encoding: %s, but \"", "\"failed to decode it.\"", "%", "arg_4", ",", "e", ")", "if", "arg_3", "and", "arg_2", "and", "arg_0", ".", "Funcr", ":", "arg_5", "=", "arg_0", ".", "Funcr", ".", "decompress", "(", "binary_type", "(", ")", ")", "arg_1", "+=", "arg_5", "+", "arg_0", ".", "Funcr", ".", "flush", "(", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Decode the data passed in and potentially flush the decoder.\n        \"\"\"\n        try:\n            if arg_2 and arg_0.Funcr:\n                arg_1 = arg_0.Funcr.decompress(arg_1)\n        except (IOError, zlib.error) as e:\n            arg_4 = arg_0.headers.get('content-encoding', '').lower()\n            raise DecodeError(\n                \"Received response with content-encoding: %s, but \"\n                \"failed to decode it.\" % arg_4, e)\n\n        if arg_3 and arg_2 and arg_0.Funcr:\n            arg_5 = arg_0.Funcr.decompress(binary_type())\n            arg_1 += arg_5 + arg_0.Funcr.flush()\n\n        return arg_1", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", "identifier": "HTTPResponse._decode", "docstring": "Decode the data passed in and potentially flush the decoder.", "docstring_tokens": ["Decode", "the", "data", "passed", "in", "and", "potentially", "flush", "the", "decoder", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254417}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_anomaly_classifier_region.py#L538-L575", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "returns the classified labeling of record", "language": "python", "parameters": "(self, record)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"categoryIn\"", ":", "[", "None", "]", ",", "\"bottomUpIn\"", ":", "arg_0", ".", "_getStateAnomalyVector", "(", "arg_1", ")", ",", "}", "arg_3", "=", "{", "\"categoriesOut\"", ":", "numpy", ".", "zeros", "(", "(", "1", ",", ")", ")", ",", "\"bestPrototypeIndices\"", ":", "numpy", ".", "zeros", "(", "(", "1", ",", ")", ")", ",", "\"categoryProbabilitiesOut\"", ":", "numpy", ".", "zeros", "(", "(", "1", ",", ")", ")", "}", "arg_4", "=", "numpy", ".", "array", "(", "arg_0", ".", "_knnclassifier", ".", "getParameter", "(", "'categoryRecencyList'", ")", ")", "arg_5", "=", "numpy", ".", "where", "(", "(", "arg_4", ">=", "arg_0", ".", "getParameter", "(", "'trainRecords'", ")", ")", "&", "(", "arg_4", "<", "arg_1", ".", "ROWID", ")", ")", "[", "0", "]", ".", "tolist", "(", ")", "if", "len", "(", "arg_5", ")", "==", "0", ":", "return", "None", "arg_0", ".", "_knnclassifier", ".", "setParameter", "(", "'inferenceMode'", ",", "None", ",", "True", ")", "arg_0", ".", "_knnclassifier", ".", "setParameter", "(", "'learningMode'", ",", "None", ",", "False", ")", "arg_0", ".", "_knnclassifier", ".", "compute", "(", "arg_2", ",", "arg_3", ")", "arg_0", ".", "_knnclassifier", ".", "setParameter", "(", "'learningMode'", ",", "None", ",", "True", ")", "arg_6", "=", "arg_0", ".", "_knnclassifier", ".", "getLatestDistances", "(", ")", "arg_7", "=", "arg_6", "[", "arg_5", "]", "if", "arg_7", ".", "min", "(", ")", "<=", "arg_0", ".", "_classificationMaxDist", ":", "arg_8", "=", "arg_4", "[", "arg_5", "]", "arg_9", "=", "arg_8", "[", "arg_7", ".", "argmin", "(", ")", "]", "arg_10", "=", "numpy", ".", "where", "(", "arg_4", "==", "arg_9", ")", "[", "0", "]", "[", "0", "]", "arg_11", "=", "arg_0", ".", "_knnclassifier", ".", "getCategoryList", "(", ")", "[", "arg_10", "]", "return", "arg_11", "return", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    returns the classified labeling of record\n    \"\"\"\n    arg_2 = {\n      \"categoryIn\": [None],\n      \"bottomUpIn\": arg_0._getStateAnomalyVector(arg_1),\n    }\n\n    arg_3 = {\"categoriesOut\": numpy.zeros((1,)),\n               \"bestPrototypeIndices\":numpy.zeros((1,)),\n               \"categoryProbabilitiesOut\":numpy.zeros((1,))}\n\n    # Only use points before record to classify and after the wait period.\n    arg_4 = numpy.array(\n        arg_0._knnclassifier.getParameter('categoryRecencyList'))\n    arg_5 = numpy.where(\n        (arg_4 >= arg_0.getParameter('trainRecords')) &\n        (arg_4 < arg_1.ROWID)\n      )[0].tolist()\n\n    if len(arg_5) == 0:\n      return None\n\n    arg_0._knnclassifier.setParameter('inferenceMode', None, True)\n    arg_0._knnclassifier.setParameter('learningMode', None, False)\n    arg_0._knnclassifier.compute(arg_2, arg_3)\n    arg_0._knnclassifier.setParameter('learningMode', None, True)\n\n    arg_6 = arg_0._knnclassifier.getLatestDistances()\n    arg_7 = arg_6[arg_5]\n    if arg_7.min() <= arg_0._classificationMaxDist:\n      arg_8 = arg_4[arg_5]\n      arg_9 = arg_8[arg_7.argmin()]\n      arg_10 = numpy.where(arg_4 == arg_9)[0][0]\n      arg_11 = arg_0._knnclassifier.getCategoryList()[arg_10]\n      return arg_11\n    return None", "path": "src/nupic/regions/knn_anomaly_classifier_region.py", "identifier": "KNNAnomalyClassifierRegion._recomputeRecordFromKNN", "docstring": "returns the classified labeling of record", "docstring_tokens": ["returns", "the", "classified", "labeling", "of", "record"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254418}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L465-L488", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Collecting possible continuations of length <= n for every node", "language": "python", "parameters": "(trie, n, allow_spaces=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "==", "0", ":", "return", "if", "arg_0", ".", "is_terminated", "and", "arg_0", ".", "precompute_symbols", ":", "return", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ".", "final", ")", ":", "arg_0", ".", "data", "[", "arg_3", "]", "=", "[", "set", "(", ")", "for", "i", "in", "range", "(", "arg_1", ")", "]", "for", "arg_3", ",", "(", "arg_6", ",", "arg_4", ")", "in", "enumerate", "(", "zip", "(", "arg_0", ".", "data", ",", "arg_0", ".", "final", ")", ")", ":", "arg_6", "[", "0", "]", "=", "set", "(", "arg_0", ".", "_get_letters", "(", "arg_3", ")", ")", "if", "arg_2", "and", "arg_4", ":", "arg_6", "[", "0", "]", ".", "add", "(", "\" \"", ")", "for", "arg_7", "in", "range", "(", "1", ",", "arg_1", ")", ":", "for", "arg_3", ",", "(", "arg_6", ",", "arg_4", ")", "in", "enumerate", "(", "zip", "(", "arg_0", ".", "data", ",", "arg_0", ".", "final", ")", ")", ":", "arg_8", "=", "set", "(", "arg_0", ".", "_get_children", "(", "arg_3", ")", ")", "for", "arg_9", "in", "arg_8", ":", "arg_6", "[", "arg_7", "]", "|=", "arg_0", ".", "data", "[", "arg_9", "]", "[", "arg_7", "-", "1", "]", "if", "arg_2", "and", "arg_4", ":", "arg_6", "[", "arg_7", "]", "|=", "arg_0", ".", "data", "[", "arg_0", ".", "root", "]", "[", "arg_7", "-", "1", "]", "arg_0", ".", "terminated", "=", "True"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Collecting possible continuations of length <= n for every node\n    \"\"\"\n    if arg_1 == 0:\n        return\n    if arg_0.is_terminated and arg_0.precompute_symbols:\n        # \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u044b\n        return\n    for arg_3, arg_4 in enumerate(arg_0.final):\n        arg_0.data[arg_3] = [set() for i in range(arg_1)]\n    for arg_3, (arg_6, arg_4) in enumerate(zip(arg_0.data, arg_0.final)):\n        arg_6[0] = set(arg_0._get_letters(arg_3))\n        if arg_2 and arg_4:\n            arg_6[0].add(\" \")\n    for arg_7 in range(1, arg_1):\n        for arg_3, (arg_6, arg_4) in enumerate(zip(arg_0.data, arg_0.final)):\n            arg_8 = set(arg_0._get_children(arg_3))\n            for arg_9 in arg_8:\n                arg_6[arg_7] |= arg_0.data[arg_9][arg_7 - 1]\n            # \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043f\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u0443 \u0432 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\n            if arg_2 and arg_4:\n                arg_6[arg_7] |= arg_0.data[arg_0.root][arg_7 - 1]\n    arg_0.terminated = True", "path": "deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py", "identifier": "precompute_future_symbols", "docstring": "Collecting possible continuations of length <= n for every node", "docstring_tokens": ["Collecting", "possible", "continuations", "of", "length", "<", "=", "n", "for", "every", "node"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 254419}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_config.py#L24-L60", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Convert a trie to a regex pattern.", "language": "python", "parameters": "(trie: dict)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "str", ":", "if", "''", "in", "arg_0", ":", "if", "len", "(", "arg_0", ")", "==", "1", ":", "return", "''", "arg_2", "=", "True", "del", "arg_0", "[", "''", "]", "else", ":", "arg_2", "=", "False", "arg_3", "=", "_defaultdict", "(", "list", ")", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "items", "(", ")", ":", "arg_6", "=", "Func", "(", "arg_5", ")", "arg_3", "[", "arg_6", "]", ".", "append", "(", "arg_4", ")", "arg_7", "=", "[", "]", "for", "arg_6", ",", "arg_8", "in", "arg_3", ".", "items", "(", ")", ":", "if", "len", "(", "arg_8", ")", "==", "1", ":", "arg_7", ".", "append", "(", "arg_8", "[", "0", "]", "+", "arg_6", ")", "else", ":", "arg_8", ".", "sort", "(", "reverse", "=", "True", ")", "arg_7", ".", "append", "(", "'['", "+", "''", ".", "join", "(", "arg_8", ")", "+", "']'", "+", "arg_6", ")", "if", "len", "(", "arg_7", ")", "==", "1", ":", "arg_9", "=", "arg_7", "[", "0", "]", "if", "arg_2", ":", "if", "len", "(", "arg_9", ")", "==", "1", ":", "arg_9", "+=", "'?+'", "else", ":", "arg_9", "=", "'(?:'", "+", "arg_9", "+", "')?+'", "else", ":", "arg_7", ".", "sort", "(", "reverse", "=", "True", ")", "arg_9", "=", "'(?>'", "+", "'|'", ".", "join", "(", "arg_7", ")", "+", "')'", "if", "arg_2", ":", "arg_9", "+=", "'?+'", "return", "arg_9"], "function": "def Func(arg_0: arg_1) -> str:\n    \"\"\"Convert a trie to a regex pattern.\"\"\"\n    if '' in arg_0:\n        if len(arg_0) == 1:\n            return ''\n        arg_2 = True\n        del arg_0['']\n    else:\n        arg_2 = False\n\n    arg_3 = _defaultdict(list)\n\n    for arg_4, arg_5 in arg_0.items():\n        arg_6 = Func(arg_5)\n        arg_3[arg_6].append(arg_4)\n\n    arg_7 = []\n    for arg_6, arg_8 in arg_3.items():\n        if len(arg_8) == 1:\n            arg_7.append(arg_8[0] + arg_6)\n        else:\n            arg_8.sort(reverse=True)\n            arg_7.append('[' + ''.join(arg_8) + ']' + arg_6)\n\n    if len(arg_7) == 1:\n        arg_9 = arg_7[0]\n        if arg_2:\n            if len(arg_9) == 1:\n                arg_9 += '?+'\n            else:  # more than one character in alts[0]\n                arg_9 = '(?:' + arg_9 + ')?+'\n    else:\n        arg_7.sort(reverse=True)\n        arg_9 = '(?>' + '|'.join(arg_7) + ')'\n        if arg_2:\n            arg_9 += '?+'\n    return arg_9", "path": "wikitextparser/_config.py", "identifier": "_pattern", "docstring": "Convert a trie to a regex pattern.", "docstring_tokens": ["Convert", "a", "trie", "to", "a", "regex", "pattern", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 254420}
{"url": "https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L232-L254", "sha": "d97414a05541f48231381f607d1d2e6b50781d39", "docstring_summary": "Match a literal sequence.", "language": "python", "parameters": "(literal: Sequence[Input], *literals: Sequence[Sequence[Input]])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "*", "arg_3", ":", "arg_1", "[", "arg_1", "[", "arg_2", "]", "]", ")", "->", "Parser", ":", "if", "len", "(", "arg_3", ")", ">", "0", ":", "return", "AlternativeParser", "(", "options", ".", "handle_Funceral", "(", "arg_0", ")", ",", "*", "map", "(", "options", ".", "handle_Funceral", ",", "arg_3", ")", ")", "else", ":", "return", "options", ".", "handle_Funceral", "(", "arg_0", ")"], "function": "def Func(arg_0: arg_1[arg_2], *arg_3: arg_1[arg_1[arg_2]]) -> Parser:\n    \"\"\"Match a Funceral sequence.\n\n    In the `TextParsers`` context, this matches the Funceral string\n    provided. In the ``GeneralParsers`` context, this matches a sequence of\n    input.\n\n    If multiple Funcerals are provided, they are treated as alternatives. e.g.\n    ``Func('+', '-')`` is the same as ``Func('+') | Func('-')``.\n\n    Args:\n        Funceral: A Funceral to match\n        *Funcerals: Alternative Funcerals to match\n\n    Returns:\n        A ``LiteralParser`` in the ``GeneralContext``, a ``LiteralStringParser``\n        in the ``TextParsers`` context, and an ``AlternativeParser`` if multiple\n        arguments are provided.\n    \"\"\"\n    if len(arg_3) > 0:\n        return AlternativeParser(options.handle_Funceral(arg_0), *map(options.handle_Funceral, arg_3))\n    else:\n        return options.handle_Funceral(arg_0)", "path": "parsita/parsers.py", "identifier": "lit", "docstring": "Match a literal sequence.\n\n    In the `TextParsers`` context, this matches the literal string\n    provided. In the ``GeneralParsers`` context, this matches a sequence of\n    input.\n\n    If multiple literals are provided, they are treated as alternatives. e.g.\n    ``lit('+', '-')`` is the same as ``lit('+') | lit('-')``.\n\n    Args:\n        literal: A literal to match\n        *literals: Alternative literals to match\n\n    Returns:\n        A ``LiteralParser`` in the ``GeneralContext``, a ``LiteralStringParser``\n        in the ``TextParsers`` context, and an ``AlternativeParser`` if multiple\n        arguments are provided.", "docstring_tokens": ["Match", "a", "literal", "sequence", "."], "nwo": "drhagen/parsita", "score": 0.2757871243566705, "idx": 254421}
{"url": "https://github.com/xmartlabs/benderthon/blob/810b6fb90f56136257e7ed12e5a30d17ad7ce6ba/benderthon/tf_freeze.py#L33-L39", "sha": "810b6fb90f56136257e7ed12e5a30d17ad7ce6ba", "docstring_summary": "Freeze and shrink the graph based on a session and the output node names.", "language": "python", "parameters": "(sess, output_file_path, output_node_names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "TemporaryDirectory", "(", ")", "as", "temp_dir_name", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "temp_dir_name", ",", "'model.ckpt'", ")", "tf", ".", "train", ".", "Saver", "(", ")", ".", "save", "(", "arg_0", ",", "arg_3", ")", "Func_from_checkpoint", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Freeze and shrink the graph based on a session and the output node names.\"\"\"\n    with TemporaryDirectory() as temp_dir_name:\n        arg_3 = os.path.join(temp_dir_name, 'model.ckpt')\n        tf.train.Saver().save(arg_0, arg_3)\n\n        Func_from_checkpoint(arg_3, arg_1, arg_2)", "path": "benderthon/tf_freeze.py", "identifier": "freeze", "docstring": "Freeze and shrink the graph based on a session and the output node names.", "docstring_tokens": ["Freeze", "and", "shrink", "the", "graph", "based", "on", "a", "session", "and", "the", "output", "node", "names", "."], "nwo": "xmartlabs/benderthon", "score": 0.2751458370028208, "idx": 254422}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/writers/rdf.py#L141-L166", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Handle extracted license.\n        Return the license node.", "language": "python", "parameters": "(self, lic)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "arg_0", ".", "spdx_namespace", ".", "licenseId", ",", "arg_1", ".", "identifier", ")", ")", ")", "if", "len", "(", "arg_2", ")", "!=", "0", ":", "return", "arg_2", "[", "0", "]", "[", "0", "]", "else", ":", "arg_3", "=", "BNode", "(", ")", "arg_4", "=", "(", "arg_3", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", ".", "ExtractedLicensingInfo", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_4", ")", "arg_5", "=", "(", "arg_3", ",", "arg_0", ".", "spdx_namespace", ".", "licenseId", ",", "Literal", "(", "arg_1", ".", "identifier", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_5", ")", "arg_6", "=", "(", "arg_3", ",", "arg_0", ".", "spdx_namespace", ".", "extractedText", ",", "Literal", "(", "arg_1", ".", "text", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_6", ")", "if", "arg_1", ".", "full_name", "is", "not", "None", ":", "arg_7", "=", "(", "arg_3", ",", "arg_0", ".", "spdx_namespace", ".", "licenseName", ",", "arg_0", ".", "to_special_value", "(", "arg_1", ".", "full_name", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_7", ")", "for", "arg_8", "in", "arg_1", ".", "cross_ref", ":", "arg_9", "=", "(", "arg_3", ",", "RDFS", ".", "seeAlso", ",", "URIRef", "(", "arg_8", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_9", ")", "if", "arg_1", ".", "comment", "is", "not", "None", ":", "arg_10", "=", "(", "arg_3", ",", "RDFS", ".", "comment", ",", "Literal", "(", "arg_1", ".", "comment", ")", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_10", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Handle extracted license.\n        Return the license node.\n        \"\"\"\n        arg_2 = list(arg_0.graph.triples((None, arg_0.spdx_namespace.licenseId, arg_1.identifier)))\n        if len(arg_2) != 0:\n            return arg_2[0][0]  # return subject in first triple\n        else:\n            arg_3 = BNode()\n            arg_4 = (arg_3, RDF.type, arg_0.spdx_namespace.ExtractedLicensingInfo)\n            arg_0.graph.add(arg_4)\n            arg_5 = (arg_3, arg_0.spdx_namespace.licenseId, Literal(arg_1.identifier))\n            arg_0.graph.add(arg_5)\n            arg_6 = (arg_3, arg_0.spdx_namespace.extractedText, Literal(arg_1.text))\n            arg_0.graph.add(arg_6)\n            if arg_1.full_name is not None:\n                arg_7 = (arg_3, arg_0.spdx_namespace.licenseName, arg_0.to_special_value(arg_1.full_name))\n                arg_0.graph.add(arg_7)\n            for arg_8 in arg_1.cross_ref:\n                arg_9 = (arg_3, RDFS.seeAlso, URIRef(arg_8))\n                arg_0.graph.add(arg_9)\n            if arg_1.comment is not None:\n                arg_10 = (arg_3, RDFS.comment, Literal(arg_1.comment))\n                arg_0.graph.add(arg_10)\n            return arg_3", "path": "spdx/writers/rdf.py", "identifier": "LicenseWriter.create_extracted_license", "docstring": "Handle extracted license.\n        Return the license node.", "docstring_tokens": ["Handle", "extracted", "license", ".", "Return", "the", "license", "node", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 254423}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/bugzillarest.py#L352-L366", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the comments of the given bugs.", "language": "python", "parameters": "(self, *bug_ids)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "urijoin", "(", "arg_0", ".", "RBUG", ",", "arg_1", "[", "0", "]", ",", "arg_0", ".", "RCOMMENT", ")", "arg_3", "=", "{", "arg_0", ".", "PIDS", ":", "arg_1", "}", "arg_4", "=", "arg_0", ".", "call", "(", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Get the Func of the given bugs.\n\n        :param bug_ids: list of bug identifiers\n        \"\"\"\n        # Hack. The first value must be a valid bug id\n        arg_2 = urijoin(arg_0.RBUG, arg_1[0], arg_0.RCOMMENT)\n\n        arg_3 = {\n            arg_0.PIDS: arg_1\n        }\n\n        arg_4 = arg_0.call(arg_2, arg_3)\n\n        return arg_4", "path": "perceval/backends/core/bugzillarest.py", "identifier": "BugzillaRESTClient.comments", "docstring": "Get the comments of the given bugs.\n\n        :param bug_ids: list of bug identifiers", "docstring_tokens": ["Get", "the", "comments", "of", "the", "given", "bugs", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 254424}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_api_base_hook.py#L82-L129", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns the Credentials object for Google API", "language": "python", "parameters": "(self)", "return_statement": "return credentials.with_subject(self.delegate_to) \\\n            if self.delegate_to else credentials", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_field", "(", "'key_path'", ",", "False", ")", "arg_2", "=", "arg_0", ".", "_get_field", "(", "'keyfile_dict'", ",", "False", ")", "arg_3", "=", "arg_0", ".", "_get_field", "(", "'scope'", ",", "None", ")", "if", "arg_3", ":", "arg_4", "=", "[", "s", ".", "strip", "(", ")", "for", "s", "in", "arg_3", ".", "split", "(", "','", ")", "]", "else", ":", "arg_4", "=", "_DEFAULT_SCOPES", "if", "not", "arg_1", "and", "not", "arg_2", ":", "arg_0", ".", "log", ".", "info", "(", "'Getting connection using `google.auth.default()` '", "'since no key file is defined for hook.'", ")", "arg_5", ",", "arg_6", "=", "google", ".", "auth", ".", "default", "(", "arg_4", "=", "arg_4", ")", "elif", "arg_1", ":", "if", "arg_1", ".", "endswith", "(", "'.json'", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "'Getting connection using JSON key file %s'", "%", "arg_1", ")", "arg_5", "=", "(", "google", ".", "oauth2", ".", "service_account", ".", "Credentials", ".", "from_service_account_file", "(", "arg_1", ",", "arg_4", "=", "arg_4", ")", ")", "elif", "arg_1", ".", "endswith", "(", "'.p12'", ")", ":", "raise", "AirflowException", "(", "'Legacy P12 key file are not supported, '", "'use a JSON key file.'", ")", "else", ":", "raise", "AirflowException", "(", "'Unrecognised extension for key file.'", ")", "else", ":", "try", ":", "arg_2", "=", "json", ".", "loads", "(", "arg_2", ")", "arg_2", "[", "'private_key'", "]", "=", "arg_2", "[", "'private_key'", "]", ".", "replace", "(", "'\\\\n'", ",", "'\\n'", ")", "arg_5", "=", "(", "google", ".", "oauth2", ".", "service_account", ".", "Credentials", ".", "from_service_account_info", "(", "arg_2", ",", "arg_4", "=", "arg_4", ")", ")", "except", "json", ".", "decoder", ".", "JSONDecodeError", ":", "raise", "AirflowException", "(", "'Invalid key JSON.'", ")", "return", "arg_5", ".", "with_subject", "(", "arg_0", ".", "delegate_to", ")", "if", "arg_0", ".", "delegate_to", "else", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the Credentials object for Google API\n        \"\"\"\n        arg_1 = arg_0._get_field('key_path', False)\n        arg_2 = arg_0._get_field('keyfile_dict', False)\n        arg_3 = arg_0._get_field('scope', None)\n        if arg_3:\n            arg_4 = [s.strip() for s in arg_3.split(',')]\n        else:\n            arg_4 = _DEFAULT_SCOPES\n\n        if not arg_1 and not arg_2:\n            arg_0.log.info('Getting connection using `google.auth.default()` '\n                          'since no key file is defined for hook.')\n            arg_5, arg_6 = google.auth.default(arg_4=arg_4)\n        elif arg_1:\n            # Get credentials from a JSON file.\n            if arg_1.endswith('.json'):\n                arg_0.log.debug('Getting connection using JSON key file %s' % arg_1)\n                arg_5 = (\n                    google.oauth2.service_account.Credentials.from_service_account_file(\n                        arg_1, arg_4=arg_4)\n                )\n            elif arg_1.endswith('.p12'):\n                raise AirflowException('Legacy P12 key file are not supported, '\n                                       'use a JSON key file.')\n            else:\n                raise AirflowException('Unrecognised extension for key file.')\n        else:\n            # Get credentials from JSON data provided in the UI.\n            try:\n                arg_2 = json.loads(arg_2)\n\n                # Depending on how the JSON was formatted, it may contain\n                # escaped newlines. Convert those to actual newlines.\n                arg_2['private_key'] = arg_2['private_key'].replace(\n                    '\\\\n', '\\n')\n\n                arg_5 = (\n                    google.oauth2.service_account.Credentials.from_service_account_info(\n                        arg_2, arg_4=arg_4)\n                )\n            except json.decoder.JSONDecodeError:\n                raise AirflowException('Invalid key JSON.')\n\n        return arg_5.with_subject(arg_0.delegate_to) \\\n            if arg_0.delegate_to else arg_5", "path": "airflow/contrib/hooks/gcp_api_base_hook.py", "identifier": "GoogleCloudBaseHook._get_credentials", "docstring": "Returns the Credentials object for Google API", "docstring_tokens": ["Returns", "the", "Credentials", "object", "for", "Google", "API"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254425}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/abstractcpu.py#L791-L801", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Decrement the stack pointer and write `value` to the stack.", "language": "python", "parameters": "(self, value, force=False)", "return_statement": "return self.STACK", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_0", ".", "STACK", "-=", "arg_0", ".", "address_bit_size", "//", "8", "arg_0", ".", "write_int", "(", "arg_0", ".", "STACK", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_0", ".", "STACK"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Decrement the stack pointer and write `value` to the stack.\n\n        :param int value: The value to write\n        :param force: whether to ignore memory permissions\n        :return: New stack pointer\n        \"\"\"\n        arg_0.STACK -= arg_0.address_bit_size // 8\n        arg_0.write_int(arg_0.STACK, arg_1, arg_2=arg_2)\n        return arg_0.STACK", "path": "manticore/native/cpu/abstractcpu.py", "identifier": "Cpu.push_int", "docstring": "Decrement the stack pointer and write `value` to the stack.\n\n        :param int value: The value to write\n        :param force: whether to ignore memory permissions\n        :return: New stack pointer", "docstring_tokens": ["Decrement", "the", "stack", "pointer", "and", "write", "value", "to", "the", "stack", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254426}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/lshensemble.py#L179-L198", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Giving the MinHash and size of the query set, retrieve\n        keys that references sets with containment with respect to\n        the query set greater than the threshold.", "language": "python", "parameters": "(self, minhash, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ".", "indexes", ")", ":", "arg_5", "=", "arg_0", ".", "uppers", "[", "arg_3", "]", "if", "arg_5", "is", "None", ":", "continue", "arg_6", ",", "arg_7", "=", "arg_0", ".", "_get_optimal_param", "(", "arg_5", ",", "arg_2", ")", "for", "arg_8", "in", "arg_4", "[", "arg_7", "]", ".", "_Func_b", "(", "arg_1", ",", "arg_6", ")", ":", "yield", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Giving the MinHash and size of the Func set, retrieve\n        keys that references sets with containment with respect to\n        the Func set greater than the threshold.\n\n        Args:\n            minhash (datasketch.MinHash): The MinHash of the Func set.\n            size (int): The size (number of unique items) of the Func set.\n\n        Returns:\n            `iterator` of keys.\n        '''\n        for arg_3, arg_4 in enumerate(arg_0.indexes):\n            arg_5 = arg_0.uppers[arg_3]\n            if arg_5 is None:\n                continue\n            arg_6, arg_7 = arg_0._get_optimal_param(arg_5, arg_2)\n            for arg_8 in arg_4[arg_7]._Func_b(arg_1, arg_6):\n                yield arg_8", "path": "datasketch/lshensemble.py", "identifier": "MinHashLSHEnsemble.query", "docstring": "Giving the MinHash and size of the query set, retrieve\n        keys that references sets with containment with respect to\n        the query set greater than the threshold.\n\n        Args:\n            minhash (datasketch.MinHash): The MinHash of the query set.\n            size (int): The size (number of unique items) of the query set.\n\n        Returns:\n            `iterator` of keys.", "docstring_tokens": ["Giving", "the", "MinHash", "and", "size", "of", "the", "query", "set", "retrieve", "keys", "that", "references", "sets", "with", "containment", "with", "respect", "to", "the", "query", "set", "greater", "than", "the", "threshold", "."], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 254427}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/BpmnParser.py#L130-L152", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Add the given lxml representation of the BPMN file to the parser's set.", "language": "python", "parameters": "(self, bpmn, svg=None, filename=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "xpath_eval", "(", "arg_1", ")", "arg_5", "=", "arg_4", "(", "'.//bpmn:process'", ")", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "arg_0", ".", "PROCESS_PARSER_CLASS", "(", "arg_0", ",", "arg_6", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "doc_xpath", "=", "arg_4", ")", "if", "arg_7", ".", "get_id", "(", ")", "in", "arg_0", ".", "process_parsers", ":", "raise", "ValidationException", "(", "'Duplicate process ID'", ",", "node", "=", "arg_6", ",", "arg_3", "=", "arg_3", ")", "if", "arg_7", ".", "get_name", "(", ")", "in", "arg_0", ".", "process_parsers_by_name", ":", "raise", "ValidationException", "(", "'Duplicate process name'", ",", "node", "=", "arg_6", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "process_parsers", "[", "arg_7", ".", "get_id", "(", ")", "]", "=", "arg_7", "arg_0", ".", "process_parsers_by_name", "[", "arg_7", ".", "get_name", "(", ")", "]", "=", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n        Add the given lxml representation of the BPMN file to the parser's set.\n\n        :param svg: Optionally, provide the text data for the SVG of the BPMN\n          file\n        :param filename: Optionally, provide the source filename.\n        \"\"\"\n        arg_4 = xpath_eval(arg_1)\n\n        arg_5 = arg_4('.//bpmn:process')\n        for arg_6 in arg_5:\n            arg_7 = arg_0.PROCESS_PARSER_CLASS(\n                arg_0, arg_6, arg_2, arg_3=arg_3, doc_xpath=arg_4)\n            if arg_7.get_id() in arg_0.process_parsers:\n                raise ValidationException(\n                    'Duplicate process ID', node=arg_6, arg_3=arg_3)\n            if arg_7.get_name() in arg_0.process_parsers_by_name:\n                raise ValidationException(\n                    'Duplicate process name', node=arg_6, arg_3=arg_3)\n            arg_0.process_parsers[arg_7.get_id()] = arg_7\n            arg_0.process_parsers_by_name[\n                arg_7.get_name()] = arg_7", "path": "SpiffWorkflow/bpmn/parser/BpmnParser.py", "identifier": "BpmnParser.add_bpmn_xml", "docstring": "Add the given lxml representation of the BPMN file to the parser's set.\n\n        :param svg: Optionally, provide the text data for the SVG of the BPMN\n          file\n        :param filename: Optionally, provide the source filename.", "docstring_tokens": ["Add", "the", "given", "lxml", "representation", "of", "the", "BPMN", "file", "to", "the", "parser", "s", "set", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 254428}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/knn_classifier.py#L647-L658", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the distances between the input pattern and all other\n    stored patterns.", "language": "python", "parameters": "(self, inputPattern)", "return_statement": "return (dist, self._categoryList)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_Func", "(", "arg_1", ")", "return", "(", "arg_2", ",", "arg_0", ".", "_categoryList", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return the distances between the input pattern and all other\n    stored patterns.\n\n    :param inputPattern: pattern to check distance with\n\n    :returns: (distances, categories) numpy arrays of the same length.\n        - overlaps: an integer overlap amount for each category\n        - categories: category index for each element of distances\n    \"\"\"\n    arg_2 = arg_0._Func(arg_1)\n    return (arg_2, arg_0._categoryList)", "path": "src/nupic/algorithms/knn_classifier.py", "identifier": "KNNClassifier.getDistances", "docstring": "Return the distances between the input pattern and all other\n    stored patterns.\n\n    :param inputPattern: pattern to check distance with\n\n    :returns: (distances, categories) numpy arrays of the same length.\n        - overlaps: an integer overlap amount for each category\n        - categories: category index for each element of distances", "docstring_tokens": ["Return", "the", "distances", "between", "the", "input", "pattern", "and", "all", "other", "stored", "patterns", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254429}
{"url": "https://github.com/Tsjerk/Insane/blob/b73f08910ddb0b66597b20ff75ecee7f65f4ecf6/insane/structure.py#L10-L15", "sha": "b73f08910ddb0b66597b20ff75ecee7f65f4ecf6", "docstring_summary": "Return a vector with the occupancy of each grid point for \n    given array of points", "language": "python", "parameters": "(grid, points, spacing=0.01)", "return_statement": "return occupied", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.01", ")", ":", "arg_3", "=", "(", "(", "arg_0", "[", ":", ",", "None", ",", ":", "]", "-", "arg_1", "[", "None", ",", ":", ",", ":", "]", ")", "**", "2", ")", ".", "sum", "(", "axis", "=", "2", ")", "arg_4", "=", "(", "arg_3", "<", "arg_2", ")", ".", "sum", "(", "axis", "=", "1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=0.01):\n    \"\"\"Return a vector with the Func of each grid point for \n    given array of points\"\"\"\n    arg_3 = ((arg_0[:,None,:] - arg_1[None,:,:])**2).sum(axis=2)\n    arg_4 = (arg_3 < arg_2).sum(axis=1)\n    return arg_4", "path": "insane/structure.py", "identifier": "occupancy", "docstring": "Return a vector with the occupancy of each grid point for \n    given array of points", "docstring_tokens": ["Return", "a", "vector", "with", "the", "occupancy", "of", "each", "grid", "point", "for", "given", "array", "of", "points"], "nwo": "Tsjerk/Insane", "score": 0.19193044314782712, "idx": 254430}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1304-L1326", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Cauchy tapering window", "language": "python", "parameters": "(N, alpha=3)", "return_statement": "return w", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3", ")", ":", "arg_2", "=", "linspace", "(", "-", "arg_0", "/", "2.", ",", "(", "arg_0", ")", "/", "2.", ",", "arg_0", ")", "arg_3", "=", "1.", "/", "(", "1.", "+", "(", "arg_1", "*", "arg_2", "/", "(", "arg_0", "/", "2.", ")", ")", "**", "2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=3):\n    r\"\"\"Cauchy tapering window\n\n    :param int N: window length\n    :param float alpha: parameter of the poisson window\n\n    .. math:: w(n) = \\frac{1}{1+\\left(\\frac{\\alpha*n}{N/2}\\right)**2}\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'cauchy', alpha=3)\n        window_visu(64, 'cauchy', alpha=4)\n        window_visu(64, 'cauchy', alpha=5)\n\n\n    .. seealso:: :func:`window_poisson`, :func:`window_hann`\n    \"\"\"\n    arg_2 = linspace(-arg_0/2., (arg_0)/2., arg_0)\n    arg_3 = 1./(1.+ (arg_1*arg_2/(arg_0/2.))**2)\n    return arg_3", "path": "src/spectrum/window.py", "identifier": "window_cauchy", "docstring": "r\"\"\"Cauchy tapering window\n\n    :param int N: window length\n    :param float alpha: parameter of the poisson window\n\n    .. math:: w(n) = \\frac{1}{1+\\left(\\frac{\\alpha*n}{N/2}\\right)**2}\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'cauchy', alpha=3)\n        window_visu(64, 'cauchy', alpha=4)\n        window_visu(64, 'cauchy', alpha=5)\n\n\n    .. seealso:: :func:`window_poisson`, :func:`window_hann`", "docstring_tokens": ["r", "Cauchy", "tapering", "window"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 254431}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/lcbin.py#L290-L379", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This time-bins all the LCs in the list using the specified bin size.", "language": "python", "parameters": "(lclist,\n                     binsizesec,\n                     maxobjects=None,\n                     outdir=None,\n                     lcformat='hat-sql',\n                     lcformatdir=None,\n                     timecols=None,\n                     magcols=None,\n                     errcols=None,\n                     minbinelems=7,\n                     nworkers=NCPUS,\n                     maxworkertasks=1000)", "return_statement": "return resdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'hat-sql'", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "7", ",", "arg_10", "=", "arg_11", ",", "arg_12", "=", "1000", ")", ":", "if", "arg_3", "and", "not", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "os", ".", "mkdir", "(", "arg_3", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", "=", "arg_0", "[", ":", "arg_2", "]", "arg_13", "=", "[", "(", "x", ",", "arg_1", ",", "{", "'outdir'", ":", "arg_3", ",", "'lcformat'", ":", "arg_4", ",", "'lcformatdir'", ":", "arg_5", ",", "'timecols'", ":", "arg_6", ",", "'magcols'", ":", "arg_7", ",", "'errcols'", ":", "arg_8", ",", "'minbinelems'", ":", "arg_9", "}", ")", "for", "x", "in", "arg_0", "]", "arg_14", "=", "mp", ".", "Pool", "(", "arg_10", ",", "maxtasksperchild", "=", "arg_12", ")", "arg_15", "=", "arg_14", ".", "map", "(", "timebinlc_worker", ",", "arg_13", ")", "arg_14", ".", "close", "(", ")", "arg_14", ".", "join", "(", ")", "arg_16", "=", "{", "os", ".", "path", ".", "basename", "(", "x", ")", ":", "y", "for", "(", "x", ",", "y", ")", "in", "zip", "(", "arg_0", ",", "arg_15", ")", "}", "return", "arg_16"], "function": "def Func(arg_0,\n                     arg_1,\n                     arg_2=None,\n                     arg_3=None,\n                     arg_4='hat-sql',\n                     arg_5=None,\n                     arg_6=None,\n                     arg_7=None,\n                     arg_8=None,\n                     arg_9=7,\n                     arg_10=arg_11,\n                     arg_12=1000):\n    '''This time-bins all the LCs in the list using the specified bin size.\n\n    Parameters\n    ----------\n\n    lclist : list of str\n        The input LCs to process.\n\n    binsizesec : float\n        The time bin size to use in seconds.\n\n    maxobjects : int or None\n        If provided, LC processing will stop at `lclist[maxobjects]`.\n\n    outdir : str or None\n        The directory where output LCs will be written. If None, will write to\n        the same directory as the input LCs.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curve file.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    timecols,magcols,errcols : lists of str\n        The keys in the lcdict produced by your light curve reader function that\n        correspond to the times, mags/fluxes, and associated measurement errors\n        that will be used as inputs to the binning process. If these are None,\n        the default values for `timecols`, `magcols`, and `errcols` for your\n        light curve format will be used here.\n\n    minbinelems : int\n        The minimum number of time-bin elements required to accept a time-bin as\n        valid for the output binned light curve.\n\n    nworkers : int\n        Number of parallel workers to launch.\n\n    maxworkertasks : int\n        The maximum number of tasks a parallel worker will complete before being\n        replaced to guard against memory leaks.\n\n    Returns\n    -------\n\n    dict\n        The returned dict contains keys = input LCs, vals = output LCs.\n\n    '''\n\n    if arg_3 and not os.path.exists(arg_3):\n        os.mkdir(arg_3)\n\n    if arg_2 is not None:\n        arg_0 = arg_0[:arg_2]\n\n    arg_13 = [(x, arg_1, {'outdir':arg_3,\n                              'lcformat':arg_4,\n                              'lcformatdir':arg_5,\n                              'timecols':arg_6,\n                              'magcols':arg_7,\n                              'errcols':arg_8,\n                              'minbinelems':arg_9}) for x in arg_0]\n\n    arg_14 = mp.Pool(arg_10, maxtasksperchild=arg_12)\n    arg_15 = arg_14.map(timebinlc_worker, arg_13)\n    arg_14.close()\n    arg_14.join()\n\n    arg_16 = {os.path.basename(x):y for (x,y) in zip(arg_0, arg_15)}\n\n    return arg_16", "path": "astrobase/lcproc/lcbin.py", "identifier": "parallel_timebin", "docstring": "This time-bins all the LCs in the list using the specified bin size.\n\n    Parameters\n    ----------\n\n    lclist : list of str\n        The input LCs to process.\n\n    binsizesec : float\n        The time bin size to use in seconds.\n\n    maxobjects : int or None\n        If provided, LC processing will stop at `lclist[maxobjects]`.\n\n    outdir : str or None\n        The directory where output LCs will be written. If None, will write to\n        the same directory as the input LCs.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curve file.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    timecols,magcols,errcols : lists of str\n        The keys in the lcdict produced by your light curve reader function that\n        correspond to the times, mags/fluxes, and associated measurement errors\n        that will be used as inputs to the binning process. If these are None,\n        the default values for `timecols`, `magcols`, and `errcols` for your\n        light curve format will be used here.\n\n    minbinelems : int\n        The minimum number of time-bin elements required to accept a time-bin as\n        valid for the output binned light curve.\n\n    nworkers : int\n        Number of parallel workers to launch.\n\n    maxworkertasks : int\n        The maximum number of tasks a parallel worker will complete before being\n        replaced to guard against memory leaks.\n\n    Returns\n    -------\n\n    dict\n        The returned dict contains keys = input LCs, vals = output LCs.", "docstring_tokens": ["This", "time", "-", "bins", "all", "the", "LCs", "in", "the", "list", "using", "the", "specified", "bin", "size", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 254432}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/event.py#L22-L37", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Get the event description.", "language": "python", "parameters": "(self)", "return_statement": "return description", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "arg_0", ".", "name", ":", "{", "'timestamp'", ":", "arg_0", ".", "time", ",", "}", ",", "}", "if", "arg_0", ".", "data", "is", "not", "None", ":", "arg_1", "[", "arg_0", ".", "name", "]", "[", "'data'", "]", "=", "arg_0", ".", "data", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Get the event description.\n\n        Returns a dictionary describing the event.\n        \"\"\"\n        arg_1 = {\n            arg_0.name: {\n                'timestamp': arg_0.time,\n            },\n        }\n\n        if arg_0.data is not None:\n            arg_1[arg_0.name]['data'] = arg_0.data\n\n        return arg_1", "path": "webthing/event.py", "identifier": "Event.as_event_description", "docstring": "Get the event description.\n\n        Returns a dictionary describing the event.", "docstring_tokens": ["Get", "the", "event", "description", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 254433}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/gtr.py#L631-L664", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Calculate the probability of observing a sequence pair at a distance t,\n        for compressed sequences", "language": "python", "parameters": "(self, seq_pair, multiplicity, t, return_log=False)", "return_statement": "return logP if return_log else np.exp(logP)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "if", "arg_3", "<", "0", ":", "arg_5", "=", "-", "ttconf", ".", "BIG_NUMBER", "else", ":", "arg_6", "=", "arg_0", ".", "expQt", "(", "arg_3", ")", "arg_7", "=", "(", "arg_6", "==", "0", ")", "arg_8", "=", "arg_9", ".", "log", "(", "arg_6", "+", "ttconf", ".", "TINY_NUMBER", "*", "(", "arg_7", ")", ")", "arg_8", "[", "arg_9", ".", "isnan", "(", "arg_8", ")", "|", "arg_9", ".", "isinf", "(", "arg_8", ")", "|", "arg_7", "]", "=", "-", "ttconf", ".", "BIG_NUMBER", "arg_5", "=", "arg_9", ".", "sum", "(", "arg_8", "[", "arg_1", "[", ":", ",", "1", "]", ",", "arg_1", "[", ":", ",", "0", "]", "]", "*", "arg_2", ")", "return", "arg_5", "if", "arg_4", "else", "arg_9", ".", "exp", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):\n        '''\n        Calculate the probability of observing a sequence pair at a distance t,\n        for compressed sequences\n\n        Parameters\n        ----------\n\n          seq_pair : numpy array\n            :code:`np.array([(0,1), (2,2), ()..])` as indicies of\n            pairs of aligned positions. (e.g. 'A'==0, 'C'==1 etc).\n            This only lists all occuring parent-child state pairs, order is irrelevant\n\n          multiplicity : numpy array\n            The number of times a parent-child state pair is observed.\n            This allows compression of the sequence representation\n\n          t : float\n            Length of the branch separating parent and child\n\n          return_log : bool\n            Whether or not to exponentiate the result\n\n        '''\n        if arg_3<0:\n            arg_5 = -ttconf.BIG_NUMBER\n        else:\n            arg_6 = arg_0.expQt(arg_3)\n            arg_7=(arg_6==0)\n            arg_8 = arg_9.log(arg_6 + ttconf.TINY_NUMBER*(arg_7))\n            arg_8[arg_9.isnan(arg_8) | arg_9.isinf(arg_8) | arg_7] = -ttconf.BIG_NUMBER\n            arg_5 = arg_9.sum(arg_8[arg_1[:,1], arg_1[:,0]]*arg_2)\n\n        return arg_5 if arg_4 else arg_9.exp(arg_5)", "path": "treetime/gtr.py", "identifier": "GTR.prob_t_compressed", "docstring": "Calculate the probability of observing a sequence pair at a distance t,\n        for compressed sequences\n\n        Parameters\n        ----------\n\n          seq_pair : numpy array\n            :code:`np.array([(0,1), (2,2), ()..])` as indicies of\n            pairs of aligned positions. (e.g. 'A'==0, 'C'==1 etc).\n            This only lists all occuring parent-child state pairs, order is irrelevant\n\n          multiplicity : numpy array\n            The number of times a parent-child state pair is observed.\n            This allows compression of the sequence representation\n\n          t : float\n            Length of the branch separating parent and child\n\n          return_log : bool\n            Whether or not to exponentiate the result", "docstring_tokens": ["Calculate", "the", "probability", "of", "observing", "a", "sequence", "pair", "at", "a", "distance", "t", "for", "compressed", "sequences"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 254434}
{"url": "https://github.com/manicmaniac/headlessvim/blob/3e4657f95d981ddf21fd285b7e1b9da2154f9cb9/headlessvim/runtimepath.py#L41-L49", "sha": "3e4657f95d981ddf21fd285b7e1b9da2154f9cb9", "docstring_summary": "Insert object before index.", "language": "python", "parameters": "(self, index, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_list", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_sync", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Insert object before index.\n\n        :param int index: index to Func in\n        :param string value: path to Func\n        \"\"\"\n        arg_0._list.Func(arg_1, arg_2)\n        arg_0._sync()", "path": "headlessvim/runtimepath.py", "identifier": "RuntimePath.insert", "docstring": "Insert object before index.\n\n        :param int index: index to insert in\n        :param string value: path to insert", "docstring_tokens": ["Insert", "object", "before", "index", "."], "nwo": "manicmaniac/headlessvim", "score": 0.0, "idx": 254435}
{"url": "https://github.com/kylebebak/questionnaire/blob/ed92642e8a2a0198da198acbcde2707f1d528585/questionnaire/__init__.py#L163-L188", "sha": "ed92642e8a2a0198da198acbcde2707f1d528585", "docstring_summary": "Asks the next question in the questionnaire and returns the answer,\n        unless user goes back.", "language": "python", "parameters": "(self, error=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "next_question", "if", "arg_2", "is", "None", ":", "return", "try", ":", "arg_3", "=", "arg_2", ".", "prompter", "(", "arg_0", ".", "get_prompt", "(", "arg_2", ",", "arg_1", ")", ",", "*", "arg_2", ".", "prompter_args", ",", "**", "arg_2", ".", "prompter_kwargs", ")", "except", "QuestionnaireGoBack", "as", "e", ":", "arg_4", "=", "e", ".", "args", "[", "0", "]", "if", "e", ".", "args", "else", "1", "if", "arg_4", "==", "0", ":", "arg_0", ".", "Func", "(", ")", "return", "arg_0", ".", "go_back", "(", "arg_4", ")", "else", ":", "if", "arg_2", ".", "_validate", ":", "arg_1", "=", "arg_2", ".", "_validate", "(", "arg_3", ")", "if", "arg_1", ":", "arg_0", ".", "Func", "(", "arg_1", ")", "return", "if", "arg_2", ".", "_transform", ":", "arg_3", "=", "arg_2", ".", "_transform", "(", "arg_3", ")", "arg_0", ".", "answers", "[", "arg_2", ".", "key", "]", "=", "arg_3", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Asks the next question in the questionnaire and returns the answer,\n        unless user goes back.\n        \"\"\"\n        arg_2 = arg_0.next_question\n        if arg_2 is None:\n            return\n\n        try:\n            arg_3 = arg_2.prompter(arg_0.get_prompt(arg_2, arg_1), *arg_2.prompter_args, **arg_2.prompter_kwargs)\n        except QuestionnaireGoBack as e:\n            arg_4 = e.args[0] if e.args else 1\n            if arg_4 == 0:\n                arg_0.Func()  # user can redo current question even if `can_go_back` is `False`\n                return\n            arg_0.go_back(arg_4)\n        else:\n            if arg_2._validate:\n                arg_1 = arg_2._validate(arg_3)\n                if arg_1:\n                    arg_0.Func(arg_1)\n                    return\n            if arg_2._transform:\n                arg_3 = arg_2._transform(arg_3)\n            arg_0.answers[arg_2.key] = arg_3\n            return arg_3", "path": "questionnaire/__init__.py", "identifier": "Questionnaire.ask", "docstring": "Asks the next question in the questionnaire and returns the answer,\n        unless user goes back.", "docstring_tokens": ["Asks", "the", "next", "question", "in", "the", "questionnaire", "and", "returns", "the", "answer", "unless", "user", "goes", "back", "."], "nwo": "kylebebak/questionnaire", "score": 0.4695341856938158, "idx": 254436}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L159-L165", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Reads data selection if small enough.", "language": "python", "parameters": "(self, f_start=None, f_stop=None,t_start=None, t_stop=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_0", ".", "container", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_0", ".", "__load_data", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None,arg_3=None, arg_4=None):\n        \"\"\" Reads data selection if small enough.\n        \"\"\"\n\n        arg_0.container.Func(arg_1=arg_1, arg_2=arg_2,arg_3=arg_3, arg_4=arg_4)\n\n        arg_0.__load_data()", "path": "blimpy/waterfall.py", "identifier": "Waterfall.read_data", "docstring": "Reads data selection if small enough.", "docstring_tokens": ["Reads", "data", "selection", "if", "small", "enough", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 254437}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L223-L228", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Obtain all accounts associated with a public key", "language": "python", "parameters": "(self, pub)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "rpc", ".", "get_key_references", "(", "[", "str", "(", "arg_1", ")", "]", ")", "[", "0", "]", "for", "arg_3", "in", "arg_2", ":", "yield", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Obtain all accounts associated with a public key\n        \"\"\"\n        arg_2 = arg_0.rpc.get_key_references([str(arg_1)])[0]\n        for arg_3 in arg_2:\n            yield arg_3", "path": "graphenecommon/wallet.py", "identifier": "Wallet.getAccountsFromPublicKey", "docstring": "Obtain all accounts associated with a public key", "docstring_tokens": ["Obtain", "all", "accounts", "associated", "with", "a", "public", "key"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 254438}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L907-L919", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Map a padded 1D array of values to its original 2D array, trimming all edge values.", "language": "python", "parameters": "(self, padded_array_1d)", "return_statement": "return (padded_array_2d[pad_size_0 // 2:self.mask.shape[0] - pad_size_0 // 2,\n                pad_size_1 // 2:self.mask.shape[1] - pad_size_1 // 2])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "map_to_2d_keep_padded", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "mask", ".", "shape", "[", "0", "]", "-", "arg_0", ".", "image_shape", "[", "0", "]", "arg_4", "=", "arg_0", ".", "mask", ".", "shape", "[", "1", "]", "-", "arg_0", ".", "image_shape", "[", "1", "]", "return", "(", "arg_2", "[", "arg_3", "//", "2", ":", "arg_0", ".", "mask", ".", "shape", "[", "0", "]", "-", "arg_3", "//", "2", ",", "arg_4", "//", "2", ":", "arg_0", ".", "mask", ".", "shape", "[", "1", "]", "-", "arg_4", "//", "2", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Map a padded 1D array of values to its original 2D array, trimming all edge values.\n\n        Parameters\n        -----------\n        padded_array_1d : ndarray\n            A 1D array of values which were computed using the *PaddedRegularGrid*.\n        \"\"\"\n        arg_2 = arg_0.map_to_2d_keep_padded(arg_1)\n        arg_3 = arg_0.mask.shape[0] - arg_0.image_shape[0]\n        arg_4 = arg_0.mask.shape[1] - arg_0.image_shape[1]\n        return (arg_2[arg_3 // 2:arg_0.mask.shape[0] - arg_3 // 2,\n                arg_4 // 2:arg_0.mask.shape[1] - arg_4 // 2])", "path": "autolens/data/array/grids.py", "identifier": "PaddedRegularGrid.array_2d_from_array_1d", "docstring": "Map a padded 1D array of values to its original 2D array, trimming all edge values.\n\n        Parameters\n        -----------\n        padded_array_1d : ndarray\n            A 1D array of values which were computed using the *PaddedRegularGrid*.", "docstring_tokens": ["Map", "a", "padded", "1D", "array", "of", "values", "to", "its", "original", "2D", "array", "trimming", "all", "edge", "values", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 254439}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/action.py#L90-L95", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Start performing the action.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "status", "=", "'pending'", "arg_0", ".", "thing", ".", "action_notify", "(", "arg_0", ")", "arg_0", ".", "perform_action", "(", ")", "arg_0", ".", "finish", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Start performing the action.\"\"\"\n        arg_0.status = 'pending'\n        arg_0.thing.action_notify(arg_0)\n        arg_0.perform_action()\n        arg_0.finish()", "path": "webthing/action.py", "identifier": "Action.start", "docstring": "Start performing the action.", "docstring_tokens": ["Start", "performing", "the", "action", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 254440}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L960-L974", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Consumes an floating point number.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "ParseFloat", "(", "arg_0", ".", "token", ")", "except", "ValueError", "as", "e", ":", "raise", "arg_0", ".", "_ParseError", "(", "str", "(", "e", ")", ")", "arg_0", ".", "NextToken", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Consumes an floating point number.\n\n    Returns:\n      The number parsed.\n\n    Raises:\n      ParseError: If a floating point number couldn't be consumed.\n    \"\"\"\n    try:\n      arg_1 = ParseFloat(arg_0.token)\n    except ValueError as e:\n      raise arg_0._ParseError(str(e))\n    arg_0.NextToken()\n    return arg_1", "path": "typy/google/protobuf/text_format.py", "identifier": "_Tokenizer.ConsumeFloat", "docstring": "Consumes an floating point number.\n\n    Returns:\n      The number parsed.\n\n    Raises:\n      ParseError: If a floating point number couldn't be consumed.", "docstring_tokens": ["Consumes", "an", "floating", "point", "number", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 254441}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/predictor_extractor.py#L64-L86", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Generates features based on an iput p_set\n        p_set - PredictorSet", "language": "python", "parameters": "(self, p_set)", "return_statement": "return overall_matrix.copy()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_initialized", "!=", "True", ":", "arg_2", "=", "\"Dictionaries have not been initialized.\"", "log", ".", "exception", "(", "arg_2", ")", "raise", "util_functions", ".", "InputError", "(", "arg_1", ",", "arg_2", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "xrange", "(", "0", ",", "len", "(", "arg_1", ".", "_essay_sets", ")", ")", ":", "arg_3", ".", "append", "(", "arg_0", ".", "_extractors", "[", "arg_4", "]", ".", "Func", "(", "arg_1", ".", "_essay_sets", "[", "arg_4", "]", ")", ")", "arg_5", "=", "numpy", ".", "concatenate", "(", "arg_3", ",", "axis", "=", "1", ")", "arg_6", "=", "numpy", ".", "array", "(", "arg_1", ".", "_numeric_features", ")", "print", "arg_5", ".", "shape", "print", "arg_6", ".", "shape", "arg_7", "=", "numpy", ".", "concatenate", "(", "(", "arg_5", ",", "arg_6", ")", ",", "axis", "=", "1", ")", "return", "arg_7", ".", "copy", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Generates features based on an iput p_set\n        p_set - PredictorSet\n        \"\"\"\n        if arg_0._initialized!=True:\n            arg_2 = \"Dictionaries have not been initialized.\"\n            log.exception(arg_2)\n            raise util_functions.InputError(arg_1, arg_2)\n\n        arg_3 = []\n        for arg_4 in xrange(0,len(arg_1._essay_sets)):\n            arg_3.append(arg_0._extractors[arg_4].Func(arg_1._essay_sets[arg_4]))\n\n        arg_5 = numpy.concatenate(arg_3, axis=1)\n        arg_6 = numpy.array(arg_1._numeric_features)\n\n        print arg_5.shape\n        print arg_6.shape\n\n        arg_7 = numpy.concatenate((arg_5, arg_6), axis=1)\n\n        return arg_7.copy()", "path": "ease/predictor_extractor.py", "identifier": "PredictorExtractor.gen_feats", "docstring": "Generates features based on an iput p_set\n        p_set - PredictorSet", "docstring_tokens": ["Generates", "features", "based", "on", "an", "iput", "p_set", "p_set", "-", "PredictorSet"], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 254442}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L260-L284", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Read from written process output.", "language": "python", "parameters": "(self, output_tile)", "return_statement": "return self.config.output.read(output_tile)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "config", ".", "mode", "not", "in", "[", "\"Funconly\"", ",", "\"continue\"", ",", "\"overwrite\"", "]", ":", "raise", "ValueError", "(", "\"process mode must be Funconly, continue or overwrite\"", ")", "if", "isinstance", "(", "arg_1", ",", "tuple", ")", ":", "arg_1", "=", "arg_0", ".", "config", ".", "output_pyramid", ".", "tile", "(", "*", "arg_1", ")", "elif", "isinstance", "(", "arg_1", ",", "BufferedTile", ")", ":", "pass", "else", ":", "raise", "TypeError", "(", "\"output_tile must be tuple or BufferedTile\"", ")", "return", "arg_0", ".", "config", ".", "output", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Read from written process output.\n\n        Parameters\n        ----------\n        output_tile : BufferedTile or tile index tuple\n            Member of the output tile pyramid (not necessarily the process\n            pyramid, if output has a different metatiling setting)\n\n        Returns\n        -------\n        data : NumPy array or features\n            process output\n        \"\"\"\n        if arg_0.config.mode not in [\"Funconly\", \"continue\", \"overwrite\"]:\n            raise ValueError(\"process mode must be Funconly, continue or overwrite\")\n        if isinstance(arg_1, tuple):\n            arg_1 = arg_0.config.output_pyramid.tile(*arg_1)\n        elif isinstance(arg_1, BufferedTile):\n            pass\n        else:\n            raise TypeError(\"output_tile must be tuple or BufferedTile\")\n\n        return arg_0.config.output.Func(arg_1)", "path": "mapchete/_core.py", "identifier": "Mapchete.read", "docstring": "Read from written process output.\n\n        Parameters\n        ----------\n        output_tile : BufferedTile or tile index tuple\n            Member of the output tile pyramid (not necessarily the process\n            pyramid, if output has a different metatiling setting)\n\n        Returns\n        -------\n        data : NumPy array or features\n            process output", "docstring_tokens": ["Read", "from", "written", "process", "output", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 254443}
{"url": "https://github.com/Syndace/python-doubleratchet/blob/d4497af73044e0084efa3e447276ee9d6a6eb66a/doubleratchet/ratchets/doubleratchet.py#L190-L230", "sha": "d4497af73044e0084efa3e447276ee9d6a6eb66a", "docstring_summary": "Encrypt a message using this double ratchet session.", "language": "python", "parameters": "(self, message, ad = None)", "return_statement": "return {\n            \"header\"     : header,\n            \"ciphertext\" : ciphertext\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "==", "None", ":", "arg_2", "=", "arg_0", ".", "__ad", "arg_3", "=", "Header", "(", "arg_0", ".", "pub", ",", "arg_0", ".", "__skr", ".", "sending_chain_length", ",", "arg_0", ".", "__skr", ".", "previous_sending_chain_length", ")", "arg_4", "=", "arg_0", ".", "__aead", ".", "encrypt", "(", "arg_1", ",", "arg_0", ".", "__skr", ".", "nextEncryptionKey", "(", ")", ",", "arg_0", ".", "_makeAD", "(", "arg_3", ",", "arg_2", ")", ")", "return", "{", "\"header\"", ":", "arg_3", ",", "\"ciphertext\"", ":", "arg_4", "}"], "function": "def Func(arg_0, arg_1, arg_2 = None):\n        \"\"\"\n        Encrypt a message using this double ratchet session.\n\n        :param message: A bytes-like object encoding the message to encrypt.\n        :param ad: A bytes-like object encoding the associated data to use for message\n            authentication. Pass None to use the associated data set during construction.\n        :returns: A dictionary containing the message header and ciphertext. The header is\n            required to synchronize the double ratchet of the receiving party. Send it\n            along with the ciphertext.\n\n        The returned dictionary consists of two keys: \"header\", which includes an instance\n        of the Header class and \"ciphertext\", which includes the encrypted message encoded\n        as a bytes-like object.\n\n        :raises NotInitializedException: If this double ratchet session is not yet\n            initialized with the other parties public key, thus not ready to encrypt a\n            message to that party.\n        \"\"\"\n\n        if arg_2 == None:\n            arg_2 = arg_0.__ad\n\n        # Prepare the header for this message\n        arg_3 = Header(\n            arg_0.pub,\n            arg_0.__skr.sending_chain_length,\n            arg_0.__skr.previous_sending_chain_length\n        )\n\n        # Encrypt the message\n        arg_4 = arg_0.__aead.encrypt(\n            arg_1,\n            arg_0.__skr.nextEncryptionKey(),\n            arg_0._makeAD(arg_3, arg_2)\n        )\n\n        return {\n            \"header\"     : arg_3,\n            \"ciphertext\" : arg_4\n        }", "path": "doubleratchet/ratchets/doubleratchet.py", "identifier": "DoubleRatchet.encryptMessage", "docstring": "Encrypt a message using this double ratchet session.\n\n        :param message: A bytes-like object encoding the message to encrypt.\n        :param ad: A bytes-like object encoding the associated data to use for message\n            authentication. Pass None to use the associated data set during construction.\n        :returns: A dictionary containing the message header and ciphertext. The header is\n            required to synchronize the double ratchet of the receiving party. Send it\n            along with the ciphertext.\n\n        The returned dictionary consists of two keys: \"header\", which includes an instance\n        of the Header class and \"ciphertext\", which includes the encrypted message encoded\n        as a bytes-like object.\n\n        :raises NotInitializedException: If this double ratchet session is not yet\n            initialized with the other parties public key, thus not ready to encrypt a\n            message to that party.", "docstring_tokens": ["Encrypt", "a", "message", "using", "this", "double", "ratchet", "session", "."], "nwo": "Syndace/python-doubleratchet", "score": 0.37431295205163906, "idx": 254444}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L233-L245", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Replace all the tracks in a playlist, overwriting its existing tracks. \n        This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist.", "language": "python", "parameters": "(self, playlist, *tracks)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", "->", "str", ":", "arg_2", "=", "[", "str", "(", "track", ")", "for", "track", "in", "arg_2", "]", "await", "arg_0", ".", "http", ".", "replace_playlist_tracks", "(", "arg_0", ".", "id", ",", "str", "(", "arg_1", ")", ",", "arg_2", "=", "','", ".", "join", "(", "arg_2", ")", ")"], "function": "async def Func(arg_0, arg_1, *arg_2) -> str:\n        \"\"\"Replace all the tracks in a playlist, overwriting its existing tracks. \n        This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist.\n\n        Parameters\n        ----------\n        playlist : Union[str, PLaylist]\n            The playlist to modify\n        tracks : Sequence[Union[str, Track]]\n            Tracks to place in the playlist\n        \"\"\"\n        arg_2 = [str(track) for track in arg_2]\n        await arg_0.http.replace_playlist_tracks(arg_0.id, str(arg_1), arg_2=','.join(arg_2))", "path": "spotify/models/user.py", "identifier": "User.replace_tracks", "docstring": "Replace all the tracks in a playlist, overwriting its existing tracks. \n        This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist.\n\n        Parameters\n        ----------\n        playlist : Union[str, PLaylist]\n            The playlist to modify\n        tracks : Sequence[Union[str, Track]]\n            Tracks to place in the playlist", "docstring_tokens": ["Replace", "all", "the", "tracks", "in", "a", "playlist", "overwriting", "its", "existing", "tracks", ".", "This", "powerful", "request", "can", "be", "useful", "for", "replacing", "tracks", "re", "-", "ordering", "existing", "tracks", "or", "clearing", "the", "playlist", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 254445}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/lsi.py#L380-L413", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Uses hostname and other info to construct an SCP command.", "language": "python", "parameters": "(hostname, username, idfile, is_get,\n                       local_path, remote_path)", "return_statement": "return ' '.join(command)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_0", ".", "strip", "(", ")", "==", "''", "or", "arg_0", "is", "None", ":", "raise", "ValueError", "(", "'Empty hostname'", ")", "arg_6", "=", "[", "_get_path", "(", "'scp'", ")", ",", "'-o'", ",", "'StrictHostKeyChecking=no'", ",", "'-o'", ",", "'ConnectTimeout=5'", ",", "'-o'", ",", "'UserKnownHostsFile={}'", ".", "format", "(", "_KNOWN_HOSTS_FILE", ")", "]", "if", "arg_2", "is", "not", "None", ":", "arg_6", ".", "extend", "(", "[", "'-i'", ",", "arg_2", "]", ")", "if", "arg_1", "is", "not", "None", ":", "arg_0", "=", "'%s@%s'", "%", "(", "arg_1", ",", "arg_0", ")", "arg_5", "=", "'{}:{}'", ".", "format", "(", "arg_0", ",", "arg_5", ")", "if", "arg_3", ":", "arg_6", ".", "extend", "(", "[", "arg_5", ",", "arg_4", "]", ")", "else", ":", "arg_6", ".", "extend", "(", "[", "arg_4", ",", "arg_5", "]", ")", "return", "' '", ".", "join", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                       arg_4, arg_5):\n    \"\"\"\n    Uses hostname and other info to construct an SCP command.\n\n    :param hostname: The hostname of the remote machine.\n    :type hostname: ``str``\n    :param username: The username to use on the remote machine.\n    :type username: ``str``\n    :param idfile: A path to the identity file to use.\n    :type idfile: ``str``\n    :param is_get: If true, we are getting a file rather than putting a file.\n    :type is_get: ``bool``\n    :param local_path: The path on the local file system.\n    :type local_path: ``str``\n    :param remote_path: The path on the remote file system.\n    :type remote_path: ``str``\n    \"\"\"\n    if arg_0.strip() == '' or arg_0 is None:\n        raise ValueError('Empty hostname')\n    arg_6 = [_get_path('scp'),\n               '-o', 'StrictHostKeyChecking=no',\n               '-o', 'ConnectTimeout=5',\n               '-o', 'UserKnownHostsFile={}'.format(_KNOWN_HOSTS_FILE)]\n    if arg_2 is not None:\n        arg_6.extend(['-i', arg_2])\n    if arg_1 is not None:\n        arg_0 = '%s@%s' % (arg_1, arg_0)\n    arg_5 = '{}:{}'.format(arg_0, arg_5)\n    if arg_3:\n        arg_6.extend([arg_5, arg_4])\n    else:\n        arg_6.extend([arg_4, arg_5])\n    return ' '.join(arg_6)", "path": "src/lsi/lsi.py", "identifier": "_build_scp_command", "docstring": "Uses hostname and other info to construct an SCP command.\n\n    :param hostname: The hostname of the remote machine.\n    :type hostname: ``str``\n    :param username: The username to use on the remote machine.\n    :type username: ``str``\n    :param idfile: A path to the identity file to use.\n    :type idfile: ``str``\n    :param is_get: If true, we are getting a file rather than putting a file.\n    :type is_get: ``bool``\n    :param local_path: The path on the local file system.\n    :type local_path: ``str``\n    :param remote_path: The path on the remote file system.\n    :type remote_path: ``str``", "docstring_tokens": ["Uses", "hostname", "and", "other", "info", "to", "construct", "an", "SCP", "command", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 254446}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/plot.py#L195-L200", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Return all the values for a single axis of the data.", "language": "python", "parameters": "(self, axis, dataset)", "return_statement": "return [p[data_index] for p in dataset['data']]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "getattr", "(", "arg_0", ",", "'%s_data_index'", "%", "arg_1", ")", "return", "[", "arg_4", "[", "arg_3", "]", "for", "arg_4", "in", "arg_2", "[", "'data'", "]", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n\t\t\"\"\"\n\t\tReturn all the values for a single axis of the data.\n\t\t\"\"\"\n\t\targ_3 = getattr(arg_0, '%s_data_index' % arg_1)\n\t\treturn [arg_4[arg_3] for arg_4 in arg_2['data']]", "path": "svg/charts/plot.py", "identifier": "Plot.get_single_axis_values", "docstring": "Return all the values for a single axis of the data.", "docstring_tokens": ["Return", "all", "the", "values", "for", "a", "single", "axis", "of", "the", "data", "."], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 254447}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/text.py#L115-L124", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Index the text of a document.", "language": "python", "parameters": "(self, text, url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "[", ":", "arg_1", ".", "index", "(", "'\\n'", ")", "]", ".", "strip", "(", ")", "arg_4", "=", "words", "(", "arg_1", ")", "arg_5", "=", "len", "(", "arg_0", ".", "documents", ")", "arg_0", ".", "documents", ".", "append", "(", "Document", "(", "arg_3", ",", "arg_2", ",", "len", "(", "arg_4", ")", ")", ")", "for", "arg_6", "in", "arg_4", ":", "if", "arg_6", "not", "in", "arg_0", ".", "stopwords", ":", "arg_0", ".", "index", "[", "arg_6", "]", "[", "arg_5", "]", "+=", "1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"Index the text of a document.\"\n        ## For now, use first line for title\n        arg_3 = arg_1[:arg_1.index('\\n')].strip()\n        arg_4 = words(arg_1)\n        arg_5 = len(arg_0.documents)\n        arg_0.documents.append(Document(arg_3, arg_2, len(arg_4)))\n        for arg_6 in arg_4:\n            if arg_6 not in arg_0.stopwords:\n                arg_0.index[arg_6][arg_5] += 1", "path": "aima/text.py", "identifier": "IRSystem.index_document", "docstring": "Index the text of a document.", "docstring_tokens": ["Index", "the", "text", "of", "a", "document", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 254448}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L321-L326", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Conference RecordStop", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/ConferenceRecordStop/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Conference RecordStop\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/ConferenceRecordStop/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.conference_record_stop", "docstring": "REST Conference RecordStop", "docstring_tokens": ["REST", "Conference", "RecordStop"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 254449}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/Queue.py#L45-L68", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Indicate that a formerly enqueued task is complete.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "all_tasks_done", ".", "acquire", "(", ")", "try", ":", "arg_1", "=", "arg_0", ".", "unfinished_tasks", "-", "1", "if", "arg_1", "<=", "0", ":", "if", "arg_1", "<", "0", ":", "raise", "ValueError", "(", "'Func() called too many times'", ")", "arg_0", ".", "all_tasks_done", ".", "notify_all", "(", ")", "arg_0", ".", "unfinished_tasks", "=", "arg_1", "finally", ":", "arg_0", ".", "all_tasks_done", ".", "release", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Indicate that a formerly enqueued task is complete.\n\n        Used by Queue consumer threads.  For each get() used to fetch a task,\n        a subsequent call to Func() tells the queue that the processing\n        on the task is complete.\n\n        If a join() is currently blocking, it will resume when all items\n        have been processed (meaning that a Func() call was received\n        for every item that had been put() into the queue).\n\n        Raises a ValueError if called more times than there were items\n        placed in the queue.\n        \"\"\"\n        arg_0.all_tasks_done.acquire()\n        try:\n            arg_1 = arg_0.unfinished_tasks - 1\n            if arg_1 <= 0:\n                if arg_1 < 0:\n                    raise ValueError('Func() called too many times')\n                arg_0.all_tasks_done.notify_all()\n            arg_0.unfinished_tasks = arg_1\n        finally:\n            arg_0.all_tasks_done.release()", "path": "third_party/stdlib/Queue.py", "identifier": "Queue.task_done", "docstring": "Indicate that a formerly enqueued task is complete.\n\n        Used by Queue consumer threads.  For each get() used to fetch a task,\n        a subsequent call to task_done() tells the queue that the processing\n        on the task is complete.\n\n        If a join() is currently blocking, it will resume when all items\n        have been processed (meaning that a task_done() call was received\n        for every item that had been put() into the queue).\n\n        Raises a ValueError if called more times than there were items\n        placed in the queue.", "docstring_tokens": ["Indicate", "that", "a", "formerly", "enqueued", "task", "is", "complete", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 254450}
{"url": "https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/board/__init__.py#L47-L62", "sha": "1436e0bf72803e02ccf727f41e8fc85ba167d9fe", "docstring_summary": "Start LanguageBoard web application", "language": "python", "parameters": "(self, port=62000)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "62000", ")", ":", "from", "http", ".", "Funcr", "import", "HTTPServer", ",", "CGIHTTPRequestHandler", "os", ".", "chdir", "(", "arg_0", ".", "log_folder", ")", "arg_2", "=", "HTTPServer", "(", "(", "''", ",", "arg_1", ")", ",", "CGIHTTPRequestHandler", ")", "print", "(", "\"Starting LanguageBoard on port: \"", "+", "str", "(", "arg_2", ".", "Funcr_port", ")", ")", "webbrowser", ".", "open", "(", "'http://0.0.0.0:{}'", ".", "format", "(", "arg_1", ")", ")", "arg_2", ".", "Func_forever", "(", ")"], "function": "def Func(arg_0, arg_1=62000):\n        \"\"\" Start LanguageBoard web application\n\n        Parameters\n        ----------\n        port: int\n            port to Func web application\n        \"\"\"\n\n        from http.Funcr import HTTPServer, CGIHTTPRequestHandler\n        os.chdir(arg_0.log_folder)\n\n        arg_2 = HTTPServer(('', arg_1), CGIHTTPRequestHandler)\n        print(\"Starting LanguageBoard on port: \" + str(arg_2.Funcr_port))\n        webbrowser.open('http://0.0.0.0:{}'.format(arg_1))\n        arg_2.Func_forever()", "path": "languageflow/board/__init__.py", "identifier": "Board.serve", "docstring": "Start LanguageBoard web application\n\n        Parameters\n        ----------\n        port: int\n            port to serve web application", "docstring_tokens": ["Start", "LanguageBoard", "web", "application"], "nwo": "undertheseanlp/languageflow", "score": 0.5035427528001201, "idx": 254451}
{"url": "https://github.com/JIC-CSB/jicbioimage.illustrate/blob/d88ddf81ee3eb3949677e2ef746af8169ce88092/jicbioimage/illustrate/__init__.py#L108-L152", "sha": "d88ddf81ee3eb3949677e2ef746af8169ce88092", "docstring_summary": "Write text at x, y top left corner position.", "language": "python", "parameters": "(self, text, position, color=(255, 255, 255),\n                size=12, antialias=False, center=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "(", "255", ",", "255", ",", "255", ")", ",", "arg_4", "=", "12", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ")", ":", "def", "antialias_value", "(", "arg_7", ",", "arg_8", ")", ":", "return", "int", "(", "round", "(", "arg_7", "*", "arg_8", ")", ")", "def", "antialias_rgb", "(", "arg_3", ",", "arg_8", ")", ":", "return", "tuple", "(", "[", "antialias_value", "(", "arg_9", ",", "arg_8", ")", "for", "arg_9", "in", "arg_3", "]", ")", "def", "set_color", "(", "arg_10", ",", "arg_11", ",", "arg_3", ")", ":", "try", ":", "arg_0", "[", "arg_11", ",", "arg_10", "]", "=", "arg_3", "except", "IndexError", ":", "pass", "arg_12", ",", "arg_13", "=", "arg_2", "arg_14", "=", "PIL", ".", "ImageFont", ".", "truetype", "(", "DEFAULT_FONT_PATH", ",", "arg_4", "=", "arg_4", ")", "arg_15", "=", "arg_14", ".", "getmask", "(", "arg_1", ")", "arg_16", ",", "arg_17", "=", "arg_15", ".", "size", "if", "arg_6", ":", "arg_13", "=", "arg_13", "-", "(", "arg_16", "//", "2", ")", "arg_12", "=", "arg_12", "-", "(", "arg_17", "//", "2", ")", "for", "arg_18", "in", "range", "(", "arg_17", ")", ":", "for", "arg_19", "in", "range", "(", "arg_16", ")", ":", "arg_8", "=", "arg_15", "[", "arg_18", "*", "arg_16", "+", "arg_19", "]", "/", "255.", "if", "arg_5", ":", "if", "arg_8", "!=", "0", ":", "arg_20", "=", "antialias_rgb", "(", "arg_3", ",", "arg_8", ")", "set_color", "(", "arg_13", "+", "arg_19", ",", "arg_12", "+", "arg_18", ",", "arg_20", ")", "else", ":", "if", "arg_8", ">", ".5", ":", "set_color", "(", "arg_13", "+", "arg_19", ",", "arg_12", "+", "arg_18", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=(255, 255, 255),\n                arg_4=12, arg_5=False, arg_6=False):\n        \"\"\"Write text at x, y top left corner position.\n\n        By default the x and y coordinates represent the top left hand corner\n        of the text. The text can be centered vertically and horizontally by\n        using setting the ``center`` option to ``True``.\n\n        :param text: text to write\n        :param position: (row, col) tuple\n        :param color: RGB tuple\n        :param size: font size\n        :param antialias: whether or not the text should be antialiased\n        :param center: whether or not the text should be centered on the\n                       input coordinate\n        \"\"\"\n        def antialias_value(arg_7, arg_8):\n            return int(round(arg_7 * arg_8))\n\n        def antialias_rgb(arg_3, arg_8):\n            return tuple([antialias_value(arg_9, arg_8) for arg_9 in arg_3])\n\n        def set_color(arg_10, arg_11, arg_3):\n            try:\n                arg_0[arg_11, arg_10] = arg_3\n            except IndexError:\n                pass\n\n        arg_12, arg_13 = arg_2\n        arg_14 = PIL.ImageFont.truetype(DEFAULT_FONT_PATH, arg_4=arg_4)\n        arg_15 = arg_14.getmask(arg_1)\n        arg_16, arg_17 = arg_15.size\n        if arg_6:\n            arg_13 = arg_13 - (arg_16 // 2)\n            arg_12 = arg_12 - (arg_17 // 2)\n        for arg_18 in range(arg_17):\n            for arg_19 in range(arg_16):\n                arg_8 = arg_15[arg_18 * arg_16 + arg_19] / 255.\n                if arg_5:\n                    if arg_8 != 0:\n                        arg_20 = antialias_rgb(arg_3, arg_8)\n                        set_color(arg_13 + arg_19, arg_12+arg_18, arg_20)\n                else:\n                    if arg_8 > .5:\n                        set_color(arg_13 + arg_19, arg_12 + arg_18, arg_3)", "path": "jicbioimage/illustrate/__init__.py", "identifier": "Canvas.text_at", "docstring": "Write text at x, y top left corner position.\n\n        By default the x and y coordinates represent the top left hand corner\n        of the text. The text can be centered vertically and horizontally by\n        using setting the ``center`` option to ``True``.\n\n        :param text: text to write\n        :param position: (row, col) tuple\n        :param color: RGB tuple\n        :param size: font size\n        :param antialias: whether or not the text should be antialiased\n        :param center: whether or not the text should be centered on the\n                       input coordinate", "docstring_tokens": ["Write", "text", "at", "x", "y", "top", "left", "corner", "position", "."], "nwo": "JIC-CSB/jicbioimage.illustrate", "score": 0.0, "idx": 254452}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_cosine.py#L46-L86", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return the cosine similarity of two strings.", "language": "python", "parameters": "(self, src, tar, qval=2)", "return_statement": "return q_intersection_mag / sqrt(q_src_mag * q_tar_mag)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "2", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "1.0", "if", "not", "arg_1", "or", "not", "arg_2", ":", "return", "0.0", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_get_qgrams", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_6", "=", "sum", "(", "arg_4", ".", "values", "(", ")", ")", "arg_7", "=", "sum", "(", "arg_5", ".", "values", "(", ")", ")", "arg_8", "=", "sum", "(", "(", "arg_4", "&", "arg_5", ")", ".", "values", "(", ")", ")", "return", "arg_8", "/", "sqrt", "(", "arg_6", "*", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=2):\n        r\"\"\"Return the cosine Funcilarity of two strings.\n\n        Parameters\n        ----------\n        src : str\n            Source string (or QGrams/Counter objects) for comparison\n        tar : str\n            Target string (or QGrams/Counter objects) for comparison\n        qval : int\n            The length of each q-gram; 0 for non-q-gram version\n\n        Returns\n        -------\n        float\n            Cosine Funcilarity\n\n        Examples\n        --------\n        >>> cmp = Cosine()\n        >>> cmp.Func('cat', 'hat')\n        0.5\n        >>> cmp.Func('Niall', 'Neil')\n        0.3651483716701107\n        >>> cmp.Func('aluminum', 'Catalan')\n        0.11785113019775793\n        >>> cmp.Func('ATCG', 'TAGC')\n        0.0\n\n        \"\"\"\n        if arg_1 == arg_2:\n            return 1.0\n        if not arg_1 or not arg_2:\n            return 0.0\n\n        arg_4, arg_5 = arg_0._get_qgrams(arg_1, arg_2, arg_3)\n        arg_6 = sum(arg_4.values())\n        arg_7 = sum(arg_5.values())\n        arg_8 = sum((arg_4 & arg_5).values())\n\n        return arg_8 / sqrt(arg_6 * arg_7)", "path": "abydos/distance/_cosine.py", "identifier": "Cosine.sim", "docstring": "r\"\"\"Return the cosine similarity of two strings.\n\n        Parameters\n        ----------\n        src : str\n            Source string (or QGrams/Counter objects) for comparison\n        tar : str\n            Target string (or QGrams/Counter objects) for comparison\n        qval : int\n            The length of each q-gram; 0 for non-q-gram version\n\n        Returns\n        -------\n        float\n            Cosine similarity\n\n        Examples\n        --------\n        >>> cmp = Cosine()\n        >>> cmp.sim('cat', 'hat')\n        0.5\n        >>> cmp.sim('Niall', 'Neil')\n        0.3651483716701107\n        >>> cmp.sim('aluminum', 'Catalan')\n        0.11785113019775793\n        >>> cmp.sim('ATCG', 'TAGC')\n        0.0", "docstring_tokens": ["r", "Return", "the", "cosine", "similarity", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254453}
{"url": "https://github.com/egh/ledger-autosync/blob/7a303f3a693261d10f677c01fb08f35c105a1e1b/ledgerautosync/cli.py#L40-L55", "sha": "7a303f3a693261d10f677c01fb08f35c105a1e1b", "docstring_summary": "Returns main ledger file path or raise exception if it cannot be \\\nfound.", "language": "python", "parameters": "(ledgerrcpath=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "\"~/.ledgerrc\"", ")", ")", "if", "\"LEDGER_FILE\"", "in", "os", ".", "environ", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "os", ".", "environ", "[", "\"LEDGER_FILE\"", "]", ")", ")", "elif", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "arg_1", "=", "open", "(", "arg_0", ")", "for", "arg_2", "in", "arg_1", ".", "readlines", "(", ")", ":", "arg_3", "=", "re", ".", "match", "(", "r\"--file\\s+([^\\s]+).*\"", ",", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "arg_3", ".", "group", "(", "1", ")", ")", ")", "else", ":", "return", "None"], "function": "def Func(arg_0=None):\n    \"\"\"Returns main ledger file path or raise exception if it cannot be \\\nfound.\"\"\"\n    if arg_0 is None:\n        arg_0 = os.path.abspath(os.path.expanduser(\"~/.ledgerrc\"))\n    if \"LEDGER_FILE\" in os.environ:\n        return os.path.abspath(os.path.expanduser(os.environ[\"LEDGER_FILE\"]))\n    elif os.path.exists(arg_0):\n        # hacky\n        arg_1 = open(arg_0)\n        for arg_2 in arg_1.readlines():\n            arg_3 = re.match(r\"--file\\s+([^\\s]+).*\", arg_2)\n            if arg_3 is not None:\n                return os.path.abspath(os.path.expanduser(arg_3.group(1)))\n    else:\n        return None", "path": "ledgerautosync/cli.py", "identifier": "find_ledger_file", "docstring": "Returns main ledger file path or raise exception if it cannot be \\\nfound.", "docstring_tokens": ["Returns", "main", "ledger", "file", "path", "or", "raise", "exception", "if", "it", "cannot", "be", "\\", "found", "."], "nwo": "egh/ledger-autosync", "score": 0.7519078746094147, "idx": 254454}
{"url": "https://github.com/brandon-rhodes/python-jplephem/blob/48c99ce40c627e24c95479d8845e312ea168f567/jplephem/daf.py#L74-L77", "sha": "48c99ce40c627e24c95479d8845e312ea168f567", "docstring_summary": "Return record `n` as 1,024 bytes; records are indexed from 1.", "language": "python", "parameters": "(self, n)", "return_statement": "return self.file.read(K)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "file", ".", "seek", "(", "arg_1", "*", "K", "-", "K", ")", "return", "arg_0", ".", "file", ".", "read", "(", "K", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return record `n` as 1,024 bytes; records are indexed from 1.\"\"\"\n        arg_0.file.seek(arg_1 * K - K)\n        return arg_0.file.read(K)", "path": "jplephem/daf.py", "identifier": "DAF.read_record", "docstring": "Return record `n` as 1,024 bytes; records are indexed from 1.", "docstring_tokens": ["Return", "record", "n", "as", "1", "024", "bytes", ";", "records", "are", "indexed", "from", "1", "."], "nwo": "brandon-rhodes/python-jplephem", "score": 0.5471209855014023, "idx": 254455}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L279-L325", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Evaluate a URL as a possible download, and maybe retrieve it", "language": "python", "parameters": "(self, url, retrieve=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "in", "arg_0", ".", "scanned_urls", "and", "not", "arg_2", ":", "return", "arg_0", ".", "scanned_urls", "[", "arg_1", "]", "=", "True", "if", "not", "URL_SCHEME", "(", "arg_1", ")", ":", "arg_0", ".", "process_filename", "(", "arg_1", ")", "return", "else", ":", "arg_4", "=", "list", "(", "distros_for_url", "(", "arg_1", ")", ")", "if", "arg_4", ":", "if", "not", "arg_0", ".", "url_ok", "(", "arg_1", ")", ":", "return", "arg_0", ".", "debug", "(", "\"Found link: %s\"", ",", "arg_1", ")", "if", "arg_4", "or", "not", "arg_2", "or", "arg_1", "in", "arg_0", ".", "fetched_urls", ":", "list", "(", "map", "(", "arg_0", ".", "add", ",", "arg_4", ")", ")", "return", "if", "not", "arg_0", ".", "url_ok", "(", "arg_1", ")", ":", "arg_0", ".", "fetched_urls", "[", "arg_1", "]", "=", "True", "return", "arg_0", ".", "info", "(", "\"Reading %s\"", ",", "arg_1", ")", "arg_0", ".", "fetched_urls", "[", "arg_1", "]", "=", "True", "arg_6", "=", "arg_0", ".", "open_url", "(", "arg_1", ",", "\"Download error on %s: %%s -- Some packages may not be found!\"", "%", "arg_1", ")", "if", "arg_6", "is", "None", ":", "return", "arg_0", ".", "fetched_urls", "[", "arg_6", ".", "url", "]", "=", "True", "if", "'html'", "not", "in", "arg_6", ".", "headers", ".", "get", "(", "'content-type'", ",", "''", ")", ".", "lower", "(", ")", ":", "arg_6", ".", "close", "(", ")", "return", "arg_7", "=", "arg_6", ".", "url", "arg_8", "=", "arg_6", ".", "read", "(", ")", "if", "not", "isinstance", "(", "arg_8", ",", "str", ")", ":", "if", "isinstance", "(", "arg_6", ",", "HTTPError", ")", ":", "arg_9", "=", "'latin-1'", "else", ":", "arg_9", "=", "arg_6", ".", "headers", ".", "get_param", "(", "'charset'", ")", "or", "'latin-1'", "arg_8", "=", "arg_8", ".", "decode", "(", "arg_9", ",", "\"ignore\"", ")", "arg_6", ".", "close", "(", ")", "for", "arg_10", "in", "HREF", ".", "finditer", "(", "arg_8", ")", ":", "arg_11", "=", "urljoin", "(", "arg_7", ",", "htmldecode", "(", "arg_10", ".", "group", "(", "1", ")", ")", ")", "arg_0", ".", "Func", "(", "arg_11", ")", "if", "arg_1", ".", "startswith", "(", "arg_0", ".", "index_url", ")", "and", "getattr", "(", "arg_6", ",", "'code'", ",", "None", ")", "!=", "404", ":", "arg_8", "=", "arg_0", ".", "process_index", "(", "arg_1", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Evaluate a URL as a possible download, and maybe retrieve it\"\"\"\n        if arg_1 in arg_0.scanned_urls and not arg_2:\n            return\n        arg_0.scanned_urls[arg_1] = True\n        if not URL_SCHEME(arg_1):\n            arg_0.process_filename(arg_1)\n            return\n        else:\n            arg_4 = list(distros_for_url(arg_1))\n            if arg_4:\n                if not arg_0.url_ok(arg_1):\n                    return\n                arg_0.debug(\"Found link: %s\", arg_1)\n\n        if arg_4 or not arg_2 or arg_1 in arg_0.fetched_urls:\n            list(map(arg_0.add, arg_4))\n            return  # don't need the actual page\n\n        if not arg_0.url_ok(arg_1):\n            arg_0.fetched_urls[arg_1] = True\n            return\n\n        arg_0.info(\"Reading %s\", arg_1)\n        arg_0.fetched_urls[arg_1] = True   # prevent multiple fetch attempts\n        arg_6 = arg_0.open_url(arg_1, \"Download error on %s: %%s -- Some packages may not be found!\" % arg_1)\n        if arg_6 is None: return\n        arg_0.fetched_urls[arg_6.url] = True\n        if 'html' not in arg_6.headers.get('content-type', '').lower():\n            arg_6.close()   # not html, we can't process it\n            return\n\n        arg_7 = arg_6.url     # handle redirects\n        arg_8 = arg_6.read()\n        if not isinstance(arg_8, str): # We are in Python 3 and got bytes. We want str.\n            if isinstance(arg_6, HTTPError):\n                # Errors have no charset, assume latin1:\n                arg_9 = 'latin-1'\n            else:\n                arg_9 = arg_6.headers.get_param('charset') or 'latin-1'\n            arg_8 = arg_8.decode(arg_9, \"ignore\")\n        arg_6.close()\n        for arg_10 in HREF.finditer(arg_8):\n            arg_11 = urljoin(arg_7, htmldecode(arg_10.group(1)))\n            arg_0.Func(arg_11)\n        if arg_1.startswith(arg_0.index_url) and getattr(arg_6,'code',None)!=404:\n            arg_8 = arg_0.process_index(arg_1, arg_8)", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py", "identifier": "PackageIndex.process_url", "docstring": "Evaluate a URL as a possible download, and maybe retrieve it", "docstring_tokens": ["Evaluate", "a", "URL", "as", "a", "possible", "download", "and", "maybe", "retrieve", "it"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254456}
{"url": "https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/zincdumper.py#L41-L50", "sha": "d52a7c6b5bc466f3c1a77b71814c8c0776aba995", "docstring_summary": "Dump a single grid to its ZINC representation.", "language": "python", "parameters": "(grid)", "return_statement": "return '\\n'.join([header, columns] + rows + [''])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'ver:%s'", "%", "dump_str", "(", "str", "(", "arg_0", ".", "_version", ")", ",", "version", "=", "arg_0", ".", "_version", ")", "if", "bool", "(", "arg_0", ".", "metadata", ")", ":", "arg_1", "+=", "' '", "+", "dump_meta", "(", "arg_0", ".", "metadata", ",", "version", "=", "arg_0", ".", "_version", ")", "arg_2", "=", "dump_columns", "(", "arg_0", ".", "column", ",", "version", "=", "arg_0", ".", "_version", ")", "arg_3", "=", "dump_rows", "(", "arg_0", ")", "return", "'\\n'", ".", "join", "(", "[", "arg_1", ",", "arg_2", "]", "+", "arg_3", "+", "[", "''", "]", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Dump a single grid to its ZINC representation.\n    \"\"\"\n    arg_1 = 'ver:%s' % dump_str(str(arg_0._version), version=arg_0._version)\n    if bool(arg_0.metadata):\n        arg_1 += ' ' + dump_meta(arg_0.metadata, version=arg_0._version)\n    arg_2 = dump_columns(arg_0.column, version=arg_0._version)\n    arg_3 = dump_rows(arg_0)\n    return '\\n'.join([arg_1, arg_2] + arg_3 + [''])", "path": "hszinc/zincdumper.py", "identifier": "dump_grid", "docstring": "Dump a single grid to its ZINC representation.", "docstring_tokens": ["Dump", "a", "single", "grid", "to", "its", "ZINC", "representation", "."], "nwo": "vrtsystems/hszinc", "score": 0.2823188883832642, "idx": 254457}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/stats.py#L227-L260", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Grows the histogram to have rows rows and cols columns.\n    Must not have been initialized before, or already have the same\n    number of columns.\n    If rows is smaller than the current number of rows,\n    does not shrink.\n    Also updates the sizes of the row and column sums.", "language": "python", "parameters": "(self, rows, cols)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "hist_", ":", "arg_0", ".", "hist_", "=", "SparseMatrix", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "rowSums_", "=", "numpy", ".", "zeros", "(", "arg_1", ",", "dtype", "=", "dtype", ")", "arg_0", ".", "colSums_", "=", "numpy", ".", "zeros", "(", "arg_2", ",", "dtype", "=", "dtype", ")", "arg_0", ".", "hack_", "=", "None", "else", ":", "arg_7", "=", "arg_0", ".", "hist_", ".", "nRows", "(", ")", "arg_8", "=", "arg_0", ".", "hist_", ".", "nCols", "(", ")", "arg_9", "=", "max", "(", "arg_7", ",", "arg_1", ")", "arg_10", "=", "max", "(", "arg_8", ",", "arg_2", ")", "if", "(", "arg_7", "<", "arg_9", ")", "or", "(", "arg_8", "<", "arg_10", ")", ":", "arg_0", ".", "hist_", ".", "resize", "(", "arg_9", ",", "arg_10", ")", "if", "arg_7", "<", "arg_9", ":", "arg_11", "=", "arg_0", ".", "rowSums_", "arg_0", ".", "rowSums_", "=", "numpy", ".", "zeros", "(", "arg_9", ",", "dtype", "=", "dtype", ")", "arg_0", ".", "rowSums_", "[", "0", ":", "arg_12", "(", "arg_11", ")", "]", "=", "arg_11", "arg_0", ".", "hack_", "=", "None", "if", "arg_8", "<", "arg_10", ":", "arg_11", "=", "arg_0", ".", "colSums_", "arg_0", ".", "colSums_", "=", "numpy", ".", "zeros", "(", "arg_10", ",", "dtype", "=", "dtype", ")", "arg_0", ".", "colSums_", "[", "0", ":", "arg_12", "(", "arg_11", ")", "]", "=", "arg_11", "arg_0", ".", "hack_", "=", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Grows the histogram to have rows rows and cols columns.\n    Must not have been initialized before, or already have the same\n    number of columns.\n    If rows is smaller than the current number of rows,\n    does not shrink.\n    Also updates the sizes of the row and column sums.\n\n    :param rows: Integer number of rows.\n    :param cols: Integer number of columns.\n    \"\"\"\n    if not arg_0.hist_:\n      arg_0.hist_ = SparseMatrix(arg_1, arg_2)\n      arg_0.rowSums_ = numpy.zeros(arg_1, dtype=dtype)\n      arg_0.colSums_ = numpy.zeros(arg_2, dtype=dtype)\n      arg_0.hack_ = None\n    else:\n      arg_7 = arg_0.hist_.nRows()\n      arg_8 = arg_0.hist_.nCols()\n      arg_9 = max(arg_7, arg_1)\n      arg_10 = max(arg_8, arg_2)\n      if (arg_7 < arg_9) or (arg_8 < arg_10):\n        arg_0.hist_.resize(arg_9, arg_10)\n        if arg_7 < arg_9:\n          arg_11 = arg_0.rowSums_\n          arg_0.rowSums_ = numpy.zeros(arg_9, dtype=dtype)\n          arg_0.rowSums_[0:arg_12(arg_11)] = arg_11\n          arg_0.hack_ = None\n        if arg_8 < arg_10:\n          arg_11 = arg_0.colSums_\n          arg_0.colSums_ = numpy.zeros(arg_10, dtype=dtype)\n          arg_0.colSums_[0:arg_12(arg_11)] = arg_11\n          arg_0.hack_ = None", "path": "src/nupic/math/stats.py", "identifier": "ConditionalProbabilityTable2D.grow", "docstring": "Grows the histogram to have rows rows and cols columns.\n    Must not have been initialized before, or already have the same\n    number of columns.\n    If rows is smaller than the current number of rows,\n    does not shrink.\n    Also updates the sizes of the row and column sums.\n\n    :param rows: Integer number of rows.\n    :param cols: Integer number of columns.", "docstring_tokens": ["Grows", "the", "histogram", "to", "have", "rows", "rows", "and", "cols", "columns", ".", "Must", "not", "have", "been", "initialized", "before", "or", "already", "have", "the", "same", "number", "of", "columns", ".", "If", "rows", "is", "smaller", "than", "the", "current", "number", "of", "rows", "does", "not", "shrink", ".", "Also", "updates", "the", "sizes", "of", "the", "row", "and", "column", "sums", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254458}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L143-L150", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Delete a record and it's persistent identifiers.", "language": "python", "parameters": "(cls, record)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "delete", "(", ")", "PersistentIdentifier", ".", "query", ".", "filter_by", "(", "object_type", "=", "'rec'", ",", "object_uuid", "=", "arg_1", ".", "id", ",", ")", ".", "update", "(", "{", "PersistentIdentifier", ".", "status", ":", "PIDStatus", ".", "DELETED", "}", ")", "arg_0", ".", "delete_buckets", "(", "arg_1", ")", "db", ".", "session", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Delete a record and it's persistent identifiers.\"\"\"\n        arg_1.delete()\n        PersistentIdentifier.query.filter_by(\n            object_type='rec', object_uuid=arg_1.id,\n        ).update({PersistentIdentifier.status: PIDStatus.DELETED})\n        arg_0.delete_buckets(arg_1)\n        db.session.commit()", "path": "invenio_migrator/records.py", "identifier": "RecordDumpLoader.delete_record", "docstring": "Delete a record and it's persistent identifiers.", "docstring_tokens": ["Delete", "a", "record", "and", "it", "s", "persistent", "identifiers", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 254459}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L266-L309", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "capnp deserialization method for the anomaly likelihood object", "language": "python", "parameters": "(cls, proto)", "return_statement": "return anomalyLikelihood", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "object", ".", "__new__", "(", "arg_0", ")", "arg_2", ".", "_iteration", "=", "arg_1", ".", "iteration", "arg_2", ".", "_historicalScores", "=", "collections", ".", "deque", "(", "maxlen", "=", "arg_1", ".", "historicWindowSize", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ".", "historicalScores", ")", ":", "arg_2", ".", "_historicalScores", ".", "append", "(", "(", "arg_5", ",", "arg_6", ".", "value", ",", "arg_6", ".", "anomalyScore", ")", ")", "if", "arg_1", ".", "distribution", ".", "name", ":", "arg_2", ".", "_distribution", "=", "dict", "(", ")", "arg_2", ".", "_distribution", "[", "'distribution'", "]", "=", "dict", "(", ")", "arg_2", ".", "_distribution", "[", "'distribution'", "]", "[", "\"name\"", "]", "=", "arg_1", ".", "distribution", ".", "name", "arg_2", ".", "_distribution", "[", "'distribution'", "]", "[", "\"mean\"", "]", "=", "arg_1", ".", "distribution", ".", "mean", "arg_2", ".", "_distribution", "[", "'distribution'", "]", "[", "\"variance\"", "]", "=", "arg_1", ".", "distribution", ".", "variance", "arg_2", ".", "_distribution", "[", "'distribution'", "]", "[", "\"stdev\"", "]", "=", "arg_1", ".", "distribution", ".", "stdev", "arg_2", ".", "_distribution", "[", "\"movingAverage\"", "]", "=", "{", "}", "arg_2", ".", "_distribution", "[", "\"movingAverage\"", "]", "[", "\"windowSize\"", "]", "=", "arg_1", ".", "distribution", ".", "movingAverage", ".", "windowSize", "arg_2", ".", "_distribution", "[", "\"movingAverage\"", "]", "[", "\"historicalValues\"", "]", "=", "[", "]", "for", "arg_8", "in", "arg_1", ".", "distribution", ".", "movingAverage", ".", "historicalValues", ":", "arg_2", ".", "_distribution", "[", "\"movingAverage\"", "]", "[", "\"historicalValues\"", "]", ".", "append", "(", "arg_8", ")", "arg_2", ".", "_distribution", "[", "\"movingAverage\"", "]", "[", "\"total\"", "]", "=", "arg_1", ".", "distribution", ".", "movingAverage", ".", "total", "arg_2", ".", "_distribution", "[", "\"historicalLikelihoods\"", "]", "=", "[", "]", "for", "arg_9", "in", "arg_1", ".", "distribution", ".", "historicalLikelihoods", ":", "arg_2", ".", "_distribution", "[", "\"historicalLikelihoods\"", "]", ".", "append", "(", "arg_9", ")", "else", ":", "arg_2", ".", "_distribution", "=", "None", "arg_2", ".", "_probationaryPeriod", "=", "arg_1", ".", "probationaryPeriod", "arg_2", ".", "_learningPeriod", "=", "arg_1", ".", "learningPeriod", "arg_2", ".", "_reestimationPeriod", "=", "arg_1", ".", "reestimationPeriod", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" capnp deserialization method for the anomaly likelihood object\n\n    :param proto: (Object) capnp proto object specified in\n                          nupic.regions.anomaly_likelihood.capnp\n\n    :returns: (Object) the deserialized AnomalyLikelihood object\n    \"\"\"\n    # pylint: disable=W0212\n    arg_2 = object.__new__(arg_0)\n    arg_2._iteration = arg_1.iteration\n\n    arg_2._historicalScores = collections.deque(\n      maxlen=arg_1.historicWindowSize)\n    for arg_5, arg_6 in enumerate(arg_1.historicalScores):\n      arg_2._historicalScores.append((arg_5, arg_6.value,\n                                                  arg_6.anomalyScore))\n    if arg_1.distribution.name: # is \"\" when there is no distribution.\n      arg_2._distribution = dict()\n      arg_2._distribution['distribution'] = dict()\n      arg_2._distribution['distribution'][\"name\"] = arg_1.distribution.name\n      arg_2._distribution['distribution'][\"mean\"] = arg_1.distribution.mean\n      arg_2._distribution['distribution'][\"variance\"] = arg_1.distribution.variance\n      arg_2._distribution['distribution'][\"stdev\"] = arg_1.distribution.stdev\n\n      arg_2._distribution[\"movingAverage\"] = {}\n      arg_2._distribution[\"movingAverage\"][\"windowSize\"] = arg_1.distribution.movingAverage.windowSize\n      arg_2._distribution[\"movingAverage\"][\"historicalValues\"] = []\n      for arg_8 in arg_1.distribution.movingAverage.historicalValues:\n        arg_2._distribution[\"movingAverage\"][\"historicalValues\"].append(arg_8)\n      arg_2._distribution[\"movingAverage\"][\"total\"] = arg_1.distribution.movingAverage.total\n\n      arg_2._distribution[\"historicalLikelihoods\"] = []\n      for arg_9 in arg_1.distribution.historicalLikelihoods:\n        arg_2._distribution[\"historicalLikelihoods\"].append(arg_9)\n    else:\n      arg_2._distribution = None\n\n    arg_2._probationaryPeriod = arg_1.probationaryPeriod\n    arg_2._learningPeriod = arg_1.learningPeriod\n    arg_2._reestimationPeriod = arg_1.reestimationPeriod\n    # pylint: enable=W0212\n\n    return arg_2", "path": "src/nupic/algorithms/anomaly_likelihood.py", "identifier": "AnomalyLikelihood.read", "docstring": "capnp deserialization method for the anomaly likelihood object\n\n    :param proto: (Object) capnp proto object specified in\n                          nupic.regions.anomaly_likelihood.capnp\n\n    :returns: (Object) the deserialized AnomalyLikelihood object", "docstring_tokens": ["capnp", "deserialization", "method", "for", "the", "anomaly", "likelihood", "object"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254460}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L726-L755", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Gets the cell with the smallest number of segments.\n    Break ties randomly.", "language": "python", "parameters": "(cls, random, cells, connections)", "return_statement": "return leastUsedCells[i]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "float", "(", "\"inf\"", ")", "for", "arg_6", "in", "arg_2", ":", "arg_7", "=", "arg_3", ".", "numSegments", "(", "arg_6", ")", "if", "arg_7", "<", "arg_5", ":", "arg_5", "=", "arg_7", "arg_4", "=", "[", "]", "if", "arg_7", "==", "arg_5", ":", "arg_4", ".", "append", "(", "arg_6", ")", "arg_8", "=", "arg_1", ".", "getUInt32", "(", "len", "(", "arg_4", ")", ")", "return", "arg_4", "[", "arg_8", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Gets the cell with the smallest number of segments.\n    Break ties randomly.\n\n    :param random: (Object)\n    Random number generator. Gets mutated.\n\n    :param cells: (list)\n    Indices of cells.\n\n    :param connections: (Object)\n    Connections instance for the TM.\n\n    :returns: (int) Cell index.\n    \"\"\"\n    arg_4 = []\n    arg_5 = float(\"inf\")\n    for arg_6 in arg_2:\n      arg_7 = arg_3.numSegments(arg_6)\n\n      if arg_7 < arg_5:\n        arg_5 = arg_7\n        arg_4 = []\n\n      if arg_7 == arg_5:\n        arg_4.append(arg_6)\n\n    arg_8 = arg_1.getUInt32(len(arg_4))\n    return arg_4[arg_8]", "path": "src/nupic/algorithms/temporal_memory.py", "identifier": "TemporalMemory._leastUsedCell", "docstring": "Gets the cell with the smallest number of segments.\n    Break ties randomly.\n\n    :param random: (Object)\n    Random number generator. Gets mutated.\n\n    :param cells: (list)\n    Indices of cells.\n\n    :param connections: (Object)\n    Connections instance for the TM.\n\n    :returns: (int) Cell index.", "docstring_tokens": ["Gets", "the", "cell", "with", "the", "smallest", "number", "of", "segments", ".", "Break", "ties", "randomly", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254461}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L529-L545", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Perform configuration which is common to root and non-root loggers.", "language": "python", "parameters": "(self, logger, config, incremental=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_2", ".", "get", "(", "'level'", ",", "None", ")", "if", "arg_4", "is", "not", "None", ":", "arg_1", ".", "setLevel", "(", "_checkLevel", "(", "arg_4", ")", ")", "if", "not", "arg_3", ":", "for", "arg_5", "in", "arg_1", ".", "handlers", "[", ":", "]", ":", "arg_1", ".", "removeHandler", "(", "arg_5", ")", "arg_6", "=", "arg_2", ".", "get", "(", "'handlers'", ",", "None", ")", "if", "arg_6", ":", "arg_0", ".", "add_handlers", "(", "arg_1", ",", "arg_6", ")", "arg_7", "=", "arg_2", ".", "get", "(", "'filters'", ",", "None", ")", "if", "arg_7", ":", "arg_0", ".", "add_filters", "(", "arg_1", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"\n        Perform configuration which is common to root and non-root loggers.\n        \"\"\"\n        arg_4 = arg_2.get('level', None)\n        if arg_4 is not None:\n            arg_1.setLevel(_checkLevel(arg_4))\n        if not arg_3:\n            # Remove any existing handlers\n            for arg_5 in arg_1.handlers[:]:\n                arg_1.removeHandler(arg_5)\n            arg_6 = arg_2.get('handlers', None)\n            if arg_6:\n                arg_0.add_handlers(arg_1, arg_6)\n            arg_7 = arg_2.get('filters', None)\n            if arg_7:\n                arg_0.add_filters(arg_1, arg_7)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py", "identifier": "DictConfigurator.common_logger_config", "docstring": "Perform configuration which is common to root and non-root loggers.", "docstring_tokens": ["Perform", "configuration", "which", "is", "common", "to", "root", "and", "non", "-", "root", "loggers", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254462}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L940-L957", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Initialize all ephemerals used by derived classes.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'_sfdr'", ")", "and", "arg_0", ".", "_sfdr", ":", "arg_0", ".", "_spatialPoolerOutput", "=", "numpy", ".", "zeros", "(", "arg_0", ".", "columnCount", ",", "dtype", "=", "GetNTAReal", "(", ")", ")", "else", ":", "arg_0", ".", "_spatialPoolerOutput", "=", "None", "arg_0", ".", "_fpLogSPInput", "=", "None", "arg_0", ".", "_fpLogSP", "=", "None", "arg_0", ".", "_fpLogSPDense", "=", "None", "arg_0", ".", "logPathInput", "=", "\"\"", "arg_0", ".", "logPathOutput", "=", "\"\"", "arg_0", ".", "logPathOutputDense", "=", "\"\""], "function": "def Func(arg_0):\n    \"\"\"\n    Initialize all ephemerals used by derived classes.\n    \"\"\"\n\n    if hasattr(arg_0, '_sfdr') and arg_0._sfdr:\n      arg_0._spatialPoolerOutput = numpy.zeros(arg_0.columnCount,\n                                               dtype=GetNTAReal())\n    else:\n      arg_0._spatialPoolerOutput = None  # Will be filled in initInNetwork\n\n    # Direct logging support (faster than node watch)\n    arg_0._fpLogSPInput = None\n    arg_0._fpLogSP = None\n    arg_0._fpLogSPDense = None\n    arg_0.logPathInput = \"\"\n    arg_0.logPathOutput = \"\"\n    arg_0.logPathOutputDense = \"\"", "path": "src/nupic/regions/sp_region.py", "identifier": "SPRegion._initEphemerals", "docstring": "Initialize all ephemerals used by derived classes.", "docstring_tokens": ["Initialize", "all", "ephemerals", "used", "by", "derived", "classes", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254463}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1267-L1320", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "This method will iterate over all process in the pipeline and\n        populate the nextflow configuration files with the directives\n        of each process in the pipeline.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"======================\"", ")", "logger", ".", "debug", "(", "\"Setting configurations\"", ")", "logger", ".", "debug", "(", "\"======================\"", ")", "arg_1", "=", "\"\"", "arg_2", "=", "\"\"", "arg_3", "=", "\"\"", "arg_4", "=", "\"\"", "if", "arg_0", ".", "merge_params", ":", "arg_3", "+=", "arg_0", ".", "_get_merged_params_string", "(", ")", "arg_5", "=", "arg_0", ".", "_get_merged_params_help", "(", ")", "else", ":", "arg_3", "+=", "arg_0", ".", "_get_params_string", "(", ")", "arg_5", "=", "arg_0", ".", "_get_params_help", "(", ")", "for", "arg_6", "in", "arg_0", ".", "processes", ":", "if", "not", "arg_6", ".", "directives", ":", "continue", "logger", ".", "debug", "(", "\"[{}] Adding directives: {}\"", ".", "format", "(", "arg_6", ".", "template", ",", "arg_6", ".", "directives", ")", ")", "arg_1", "+=", "arg_0", ".", "_get_resources_string", "(", "arg_6", ".", "directives", ",", "arg_6", ".", "pid", ")", "arg_2", "+=", "arg_0", ".", "_get_container_string", "(", "arg_6", ".", "directives", ",", "arg_6", ".", "pid", ")", "arg_4", "=", "arg_0", ".", "_get_manifest_string", "(", ")", "arg_0", ".", "resources", "=", "arg_0", ".", "_render_config", "(", "\"resources.config\"", ",", "{", "\"process_info\"", ":", "arg_1", "}", ")", "arg_0", ".", "containers", "=", "arg_0", ".", "_render_config", "(", "\"containers.config\"", ",", "{", "\"container_info\"", ":", "arg_2", "}", ")", "arg_0", ".", "params", "=", "arg_0", ".", "_render_config", "(", "\"params.config\"", ",", "{", "\"params_info\"", ":", "arg_3", "}", ")", "arg_0", ".", "manifest", "=", "arg_0", ".", "_render_config", "(", "\"manifest.config\"", ",", "{", "\"manifest_info\"", ":", "arg_4", "}", ")", "arg_0", ".", "help", "=", "arg_0", ".", "_render_config", "(", "\"Helper.groovy\"", ",", "{", "\"nf_file\"", ":", "basename", "(", "arg_0", ".", "nf_file", ")", ",", "\"help_list\"", ":", "arg_5", ",", "\"version\"", ":", "__version__", ",", "\"pipeline_name\"", ":", "\" \"", ".", "join", "(", "[", "x", ".", "upper", "(", ")", "for", "x", "in", "arg_0", ".", "pipeline_name", "]", ")", "}", ")", "arg_0", ".", "user_config", "=", "arg_0", ".", "_render_config", "(", "\"user.config\"", ",", "{", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"This method will iterate over all process in the pipeline and\n        populate the nextflow configuration files with the directives\n        of each process in the pipeline.\n        \"\"\"\n\n        logger.debug(\"======================\")\n        logger.debug(\"Setting configurations\")\n        logger.debug(\"======================\")\n\n        arg_1 = \"\"\n        arg_2 = \"\"\n        arg_3 = \"\"\n        arg_4 = \"\"\n\n        if arg_0.merge_params:\n            arg_3 += arg_0._get_merged_params_string()\n            arg_5 = arg_0._get_merged_params_help()\n        else:\n            arg_3 += arg_0._get_params_string()\n            arg_5 = arg_0._get_params_help()\n\n        for arg_6 in arg_0.processes:\n\n            # Skip processes with the directives attribute populated\n            if not arg_6.directives:\n                continue\n\n            logger.debug(\"[{}] Adding directives: {}\".format(\n                arg_6.template, arg_6.directives))\n            arg_1 += arg_0._get_resources_string(arg_6.directives, arg_6.pid)\n            arg_2 += arg_0._get_container_string(arg_6.directives, arg_6.pid)\n\n        arg_4 = arg_0._get_manifest_string()\n\n        arg_0.resources = arg_0._render_config(\"resources.config\", {\n            \"process_info\": arg_1\n        })\n        arg_0.containers = arg_0._render_config(\"containers.config\", {\n            \"container_info\": arg_2\n        })\n        arg_0.params = arg_0._render_config(\"params.config\", {\n            \"params_info\": arg_3\n        })\n        arg_0.manifest = arg_0._render_config(\"manifest.config\", {\n            \"manifest_info\": arg_4\n        })\n        arg_0.help = arg_0._render_config(\"Helper.groovy\", {\n            \"nf_file\": basename(arg_0.nf_file),\n            \"help_list\": arg_5,\n            \"version\": __version__,\n            \"pipeline_name\": \" \".join([x.upper() for x in arg_0.pipeline_name])\n        })\n        arg_0.user_config = arg_0._render_config(\"user.config\", {})", "path": "flowcraft/generator/engine.py", "identifier": "NextflowGenerator._set_configurations", "docstring": "This method will iterate over all process in the pipeline and\n        populate the nextflow configuration files with the directives\n        of each process in the pipeline.", "docstring_tokens": ["This", "method", "will", "iterate", "over", "all", "process", "in", "the", "pipeline", "and", "populate", "the", "nextflow", "configuration", "files", "with", "the", "directives", "of", "each", "process", "in", "the", "pipeline", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 254464}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/core/constraint.py#L362-L411", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "Fix the value of a variable and remove it from the constraint.", "language": "python", "parameters": "(self, v, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "variables", "try", ":", "arg_4", "=", "arg_3", ".", "index", "(", "arg_1", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "\"given variable {} is not part of the constraint\"", ".", "format", "(", "arg_1", ")", ")", "if", "arg_2", "not", "in", "arg_0", ".", "vartype", ".", "value", ":", "raise", "ValueError", "(", "\"expected value to be in {}, received {} instead\"", ".", "format", "(", "arg_0", ".", "vartype", ".", "value", ",", "arg_2", ")", ")", "arg_5", "=", "frozenset", "(", "config", "[", ":", "arg_4", "]", "+", "config", "[", "arg_4", "+", "1", ":", "]", "for", "config", "in", "arg_0", ".", "configurations", "if", "config", "[", "arg_4", "]", "==", "arg_2", ")", "if", "not", "arg_5", ":", "raise", "UnsatError", "(", "\"fixing {} to {} makes this constraint unsatisfiable\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "arg_3", "=", "arg_3", "[", ":", "arg_4", "]", "+", "arg_3", "[", "arg_4", "+", "1", ":", "]", "arg_0", ".", "configurations", "=", "arg_5", "arg_0", ".", "variables", "=", "arg_3", "def", "arg_7", "(", "*", "arg_6", ")", ":", "return", "arg_6", "in", "arg_5", "arg_0", ".", "func", "=", "arg_7", "arg_0", ".", "name", "=", "'{} ({} fixed to {})'", ".", "format", "(", "arg_0", ".", "name", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Fix the value of a variable and remove it from the constraint.\n\n        Args:\n            v (variable):\n                Variable in the constraint to be set to a constant value.\n\n            val (int):\n                Value assigned to the variable. Values must match the :class:`.Vartype` of the\n                constraint.\n\n        Examples:\n            This example creates a constraint that :math:`a \\\\ne b` on binary variables,\n            fixes variable a to 0, and tests two candidate solutions.\n\n            >>> import dwavebinarycsp\n            >>> const = dwavebinarycsp.Constraint.from_func(operator.ne,\n            ...             ['a', 'b'], dwavebinarycsp.BINARY)\n            >>> const.Func('a', 0)\n            >>> const.check({'b': 1})\n            True\n            >>> const.check({'b': 0})\n            False\n\n        \"\"\"\n        arg_3 = arg_0.variables\n        try:\n            arg_4 = arg_3.index(arg_1)\n        except ValueError:\n            raise ValueError(\"given variable {} is not part of the constraint\".format(arg_1))\n\n        if arg_2 not in arg_0.vartype.value:\n            raise ValueError(\"expected value to be in {}, received {} instead\".format(arg_0.vartype.value, arg_2))\n\n        arg_5 = frozenset(config[:arg_4] + config[arg_4 + 1:]  # exclude the fixed var\n                                   for config in arg_0.configurations\n                                   if config[arg_4] == arg_2)\n\n        if not arg_5:\n            raise UnsatError(\"fixing {} to {} makes this constraint unsatisfiable\".format(arg_1, arg_2))\n\n        arg_3 = arg_3[:arg_4] + arg_3[arg_4 + 1:]\n\n        arg_0.configurations = arg_5\n        arg_0.variables = arg_3\n\n        def arg_7(*arg_6): return arg_6 in arg_5\n        arg_0.func = arg_7\n\n        arg_0.name = '{} ({} fixed to {})'.format(arg_0.name, arg_1, arg_2)", "path": "dwavebinarycsp/core/constraint.py", "identifier": "Constraint.fix_variable", "docstring": "Fix the value of a variable and remove it from the constraint.\n\n        Args:\n            v (variable):\n                Variable in the constraint to be set to a constant value.\n\n            val (int):\n                Value assigned to the variable. Values must match the :class:`.Vartype` of the\n                constraint.\n\n        Examples:\n            This example creates a constraint that :math:`a \\\\ne b` on binary variables,\n            fixes variable a to 0, and tests two candidate solutions.\n\n            >>> import dwavebinarycsp\n            >>> const = dwavebinarycsp.Constraint.from_func(operator.ne,\n            ...             ['a', 'b'], dwavebinarycsp.BINARY)\n            >>> const.fix_variable('a', 0)\n            >>> const.check({'b': 1})\n            True\n            >>> const.check({'b': 0})\n            False", "docstring_tokens": ["Fix", "the", "value", "of", "a", "variable", "and", "remove", "it", "from", "the", "constraint", "."], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 254465}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/main.py#L231-L238", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Run DDP greenlets.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "logger", ".", "debug", "(", "'PostgresGreenlet Func'", ")", "arg_0", ".", "start", "(", ")", "arg_0", ".", "_stop_event", ".", "wait", "(", ")", "gevent", ".", "joinall", "(", "arg_0", ".", "threads", "+", "[", "DDPLauncher", ".", "pgworker", "]", ")", "arg_0", ".", "threads", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"Run DDP greenlets.\"\"\"\n        arg_0.logger.debug('PostgresGreenlet Func')\n        arg_0.start()\n        arg_0._stop_event.wait()\n        # wait for all threads to stop.\n        gevent.joinall(arg_0.threads + [DDPLauncher.pgworker])\n        arg_0.threads = []", "path": "dddp/main.py", "identifier": "DDPLauncher.run", "docstring": "Run DDP greenlets.", "docstring_tokens": ["Run", "DDP", "greenlets", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 254466}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L865-L912", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Load repository from a directory path and update the current instance.\n        First, new repository still will be loaded. If failed, then old\n        style repository load will be tried.", "language": "python", "parameters": "(self, path, verbose=True, ntrials=3)", "return_statement": "return repo", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "3", ")", ":", "assert", "isinstance", "(", "arg_3", ",", "int", ")", ",", "\"ntrials must be integer\"", "assert", "arg_3", ">", "0", ",", "\"ntrials must be >0\"", "arg_4", "=", "None", "for", "arg_5", "in", "range", "(", "arg_3", ")", ":", "try", ":", "arg_0", ".", "__Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "True", ")", "except", "Exception", "as", "err1", ":", "try", ":", "from", ".", "OldRepository", "import", "Repository", "arg_6", "=", "Repository", "(", "arg_1", ")", "except", "Exception", "as", "err2", ":", "arg_7", "=", "\"Unable to load repository using neiher new style (%s) nor old style (%s)\"", "%", "(", "err1", ",", "err2", ")", "if", "arg_0", ".", "DEBUG_PRINT_FAILED_TRIALS", ":", "print", "(", "\"Trial %i failed in Repository.%s (%s). Set Repository.DEBUG_PRINT_FAILED_TRIALS to False to mute\"", "%", "(", "arg_5", ",", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "3", "]", ",", "str", "(", "arg_7", ")", ")", ")", "else", ":", "arg_7", "=", "None", "arg_4", "=", "arg_6", "break", "else", ":", "arg_7", "=", "None", "arg_4", "=", "arg_0", "break", "assert", "arg_7", "is", "None", ",", "arg_7", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=3):\n        \"\"\"\n        Load repository from a directory path and update the current instance.\n        First, new repository still will be loaded. If failed, then old\n        style repository load will be tried.\n\n        :Parameters:\n            #. path (string): The path of the directory from where to load\n               the repository from. If '.' or an empty string is passed,\n               the current working directory will be used.\n            #. verbose (boolean): Whether to be verbose about abnormalities\n            #. ntrials (int): After aquiring all locks, ntrials is the maximum\n               number of trials allowed before failing.\n               In rare cases, when multiple processes\n               are accessing the same repository components, different processes\n               can alter repository components between successive lock releases\n               of some other process. Bigger number of trials lowers the\n               likelyhood of failure due to multiple processes same time\n               alteration.\n\n        :Returns:\n             #. repository (pyrep.Repository): returns self repository with loaded data.\n        \"\"\"\n        assert isinstance(arg_3, int), \"ntrials must be integer\"\n        assert arg_3>0, \"ntrials must be >0\"\n        arg_4 = None\n        for arg_5 in range(arg_3):\n            try:\n                arg_0.__Func(arg_1=arg_1, arg_2=True)\n            except Exception as err1:\n                try:\n                    from .OldRepository import Repository\n                    arg_6 = Repository(arg_1)\n                except Exception as err2:\n                    #traceback.print_exc()\n                    arg_7 = \"Unable to load repository using neiher new style (%s) nor old style (%s)\"%(err1, err2)\n                    if arg_0.DEBUG_PRINT_FAILED_TRIALS: print(\"Trial %i failed in Repository.%s (%s). Set Repository.DEBUG_PRINT_FAILED_TRIALS to False to mute\"%(arg_5, inspect.stack()[1][3], str(arg_7)))\n                else:\n                    arg_7 = None\n                    arg_4  = arg_6\n                    break\n            else:\n                arg_7 = None\n                arg_4  = arg_0\n                break\n        # check and return\n        assert arg_7 is None, arg_7\n        return arg_4", "path": "Repository.py", "identifier": "Repository.load_repository", "docstring": "Load repository from a directory path and update the current instance.\n        First, new repository still will be loaded. If failed, then old\n        style repository load will be tried.\n\n        :Parameters:\n            #. path (string): The path of the directory from where to load\n               the repository from. If '.' or an empty string is passed,\n               the current working directory will be used.\n            #. verbose (boolean): Whether to be verbose about abnormalities\n            #. ntrials (int): After aquiring all locks, ntrials is the maximum\n               number of trials allowed before failing.\n               In rare cases, when multiple processes\n               are accessing the same repository components, different processes\n               can alter repository components between successive lock releases\n               of some other process. Bigger number of trials lowers the\n               likelyhood of failure due to multiple processes same time\n               alteration.\n\n        :Returns:\n             #. repository (pyrep.Repository): returns self repository with loaded data.", "docstring_tokens": ["Load", "repository", "from", "a", "directory", "path", "and", "update", "the", "current", "instance", ".", "First", "new", "repository", "still", "will", "be", "loaded", ".", "If", "failed", "then", "old", "style", "repository", "load", "will", "be", "tried", "."], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 254467}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L233-L288", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Process a single DDP message.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'id'", ",", "None", ")", "try", ":", "arg_3", "=", "arg_1", ".", "pop", "(", "'msg'", ")", "except", "KeyError", ":", "arg_0", ".", "reply", "(", "'error'", ",", "reason", "=", "'Bad request'", ",", "offendingMessage", "=", "arg_1", ",", ")", "return", "try", ":", "arg_0", ".", "dispatch", "(", "arg_3", ",", "arg_1", ")", "except", "Exception", "as", "err", ":", "arg_4", "=", "{", "'msg'", ":", "{", "'method'", ":", "'result'", "}", ".", "get", "(", "arg_3", ",", "'error'", ")", ",", "}", "if", "arg_2", "is", "not", "None", ":", "arg_4", "[", "'id'", "]", "=", "arg_2", "if", "isinstance", "(", "err", ",", "MeteorError", ")", ":", "arg_5", "=", "err", ".", "as_dict", "(", ")", "else", ":", "arg_5", "=", "{", "'error'", ":", "500", ",", "'reason'", ":", "'Internal server error'", ",", "}", "if", "arg_4", "[", "'msg'", "]", "==", "'error'", ":", "arg_4", ".", "update", "(", "arg_5", ")", "else", ":", "arg_4", "[", "'error'", "]", "=", "arg_5", "if", "not", "isinstance", "(", "err", ",", "MeteorError", ")", ":", "arg_6", ",", "arg_7", "=", "safe_call", "(", "arg_0", ".", "logger", ".", "error", ",", "'%r %r'", ",", "arg_3", ",", "arg_1", ",", "exc_info", "=", "1", ",", ")", "if", "arg_6", "is", "not", "None", ":", "traceback", ".", "print_exc", "(", "file", "=", "sys", ".", "stderr", ")", "sys", ".", "stderr", ".", "write", "(", "'Additionally, while handling the above error the '", "'following error was encountered:\\n'", ")", "sys", ".", "stderr", ".", "write", "(", "arg_6", ")", "elif", "settings", ".", "DEBUG", ":", "print", "(", "'ERROR: %s'", "%", "err", ")", "dprint", "(", "'msg'", ",", "arg_3", ")", "dprint", "(", "'data'", ",", "arg_1", ")", "arg_5", ".", "setdefault", "(", "'details'", ",", "traceback", ".", "format_exc", "(", ")", ")", "print", "(", "arg_5", "[", "'details'", "]", ")", "arg_0", ".", "reply", "(", "**", "arg_4", ")", "if", "arg_2", "and", "arg_3", "==", "'method'", ":", "arg_0", ".", "reply", "(", "'updated'", ",", "methods", "=", "[", "arg_2", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process a single DDP message.\"\"\"\n        arg_2 = arg_1.get('id', None)\n        try:\n            arg_3 = arg_1.pop('msg')\n        except KeyError:\n            arg_0.reply(\n                'error', reason='Bad request',\n                offendingMessage=arg_1,\n            )\n            return\n        try:\n            # dispatch message\n            arg_0.dispatch(arg_3, arg_1)\n        except Exception as err:  # pylint: disable=broad-except\n            # This should be the only protocol exception handler\n            arg_4 = {\n                'msg': {'method': 'result'}.get(arg_3, 'error'),\n            }\n            if arg_2 is not None:\n                arg_4['id'] = arg_2\n            if isinstance(err, MeteorError):\n                arg_5 = err.as_dict()\n            else:\n                arg_5 = {\n                    'error': 500,\n                    'reason': 'Internal server error',\n                }\n            if arg_4['msg'] == 'error':\n                arg_4.update(arg_5)\n            else:\n                arg_4['error'] = arg_5\n            if not isinstance(err, MeteorError):\n                # not a client error, should always be logged.\n                arg_6, arg_7 = safe_call(\n                    arg_0.logger.error, '%r %r', arg_3, arg_1, exc_info=1,\n                )\n                if arg_6 is not None:\n                    # something went wrong while logging the error, revert to\n                    # writing a stack trace to stderr.\n                    traceback.print_exc(file=sys.stderr)\n                    sys.stderr.write(\n                        'Additionally, while handling the above error the '\n                        'following error was encountered:\\n'\n                    )\n                    sys.stderr.write(arg_6)\n            elif settings.DEBUG:\n                print('ERROR: %s' % err)\n                dprint('msg', arg_3)\n                dprint('data', arg_1)\n                arg_5.setdefault('details', traceback.format_exc())\n                # print stack trace for client errors when DEBUG is True.\n                print(arg_5['details'])\n            arg_0.reply(**arg_4)\n            if arg_2 and arg_3 == 'method':\n                arg_0.reply('updated', methods=[arg_2])", "path": "dddp/websocket.py", "identifier": "DDPWebSocketApplication.process_ddp", "docstring": "Process a single DDP message.", "docstring_tokens": ["Process", "a", "single", "DDP", "message", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 254468}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L1126-L1153", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Downsample the signal by an integer factor. Only the first out of\n        each factor samples is retained, the others are discarded.", "language": "python", "parameters": "(self, factor=2)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "int", ")", "or", "arg_1", "<", "1", ":", "raise", "ValueError", "(", "'factor must be a positive integer.'", ")", "arg_2", "=", "[", "'Func'", ",", "'{}'", ".", "format", "(", "arg_1", ")", "]", "arg_0", ".", "effects", ".", "extend", "(", "arg_2", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=2):\n        '''Downsample the signal by an integer factor. Only the first out of\n        each factor samples is retained, the others are discarded.\n\n        No decimation filter is applied. If the input is not a properly\n        bandlimited baseband signal, aliasing will occur. This may be desirable\n        e.g., for frequency translation.\n\n        For a general resampling effect with anti-aliasing, see rate.\n\n        Parameters\n        ----------\n        factor : int, default=2\n            Downsampling factor.\n\n        See Also\n        --------\n        rate, upsample\n\n        '''\n        if not isinstance(arg_1, int) or arg_1 < 1:\n            raise ValueError('factor must be a positive integer.')\n\n        arg_2 = ['Func', '{}'.format(arg_1)]\n\n        arg_0.effects.extend(arg_2)\n        arg_0.effects_log.append('Func')\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.downsample", "docstring": "Downsample the signal by an integer factor. Only the first out of\n        each factor samples is retained, the others are discarded.\n\n        No decimation filter is applied. If the input is not a properly\n        bandlimited baseband signal, aliasing will occur. This may be desirable\n        e.g., for frequency translation.\n\n        For a general resampling effect with anti-aliasing, see rate.\n\n        Parameters\n        ----------\n        factor : int, default=2\n            Downsampling factor.\n\n        See Also\n        --------\n        rate, upsample", "docstring_tokens": ["Downsample", "the", "signal", "by", "an", "integer", "factor", ".", "Only", "the", "first", "out", "of", "each", "factor", "samples", "is", "retained", "the", "others", "are", "discarded", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 254469}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L142-L146", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Yield line numbers of unused variables.", "language": "python", "parameters": "(messages)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ":", "if", "isinstance", "(", "arg_1", ",", "pyflakes", ".", "messages", ".", "UnusedVariable", ")", ":", "yield", "arg_1", ".", "lineno"], "function": "def Func(arg_0):\n    \"\"\"Yield line numbers of unused variables.\"\"\"\n    for arg_1 in arg_0:\n        if isinstance(arg_1, pyflakes.messages.UnusedVariable):\n            yield arg_1.lineno", "path": "autoflake.py", "identifier": "unused_variable_line_numbers", "docstring": "Yield line numbers of unused variables.", "docstring_tokens": ["Yield", "line", "numbers", "of", "unused", "variables", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 254470}
{"url": "https://github.com/Crypto-toolbox/btfxwss/blob/16827fa6aacb2c0e289aa852bf61a18df6905835/btfxwss/client.py#L280-L300", "sha": "16827fa6aacb2c0e289aa852bf61a18df6905835", "docstring_summary": "Subscribe to the passed pair's OHLC data channel.", "language": "python", "parameters": "(self, pair, timeframe=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "[", "'1m'", ",", "'5m'", ",", "'15m'", ",", "'30m'", ",", "'1h'", ",", "'3h'", ",", "'6h'", ",", "'12h'", ",", "'1D'", ",", "'7D'", ",", "'14D'", ",", "'1M'", "]", "if", "arg_2", ":", "if", "arg_2", "not", "in", "arg_4", ":", "raise", "ValueError", "(", "\"timeframe must be any of %s\"", "%", "arg_4", ")", "else", ":", "arg_2", "=", "'1m'", "arg_5", "=", "(", "'candles'", ",", "arg_1", ",", "arg_2", ")", "arg_1", "=", "'t'", "+", "arg_1", "if", "not", "arg_1", ".", "startswith", "(", "'t'", ")", "else", "arg_1", "arg_6", "=", "'trade:'", "+", "arg_2", "+", "':'", "+", "arg_1", "arg_0", ".", "_subscribe", "(", "'candles'", ",", "arg_5", ",", "arg_6", "=", "arg_6", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Subscribe to the passed pair's OHLC data channel.\n\n        :param pair: str, Symbol pair to request data for\n        :param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h,\n                                1D, 7D, 14D, 1M}\n        :param kwargs:\n        :return:\n        \"\"\"\n\n        arg_4 = ['1m', '5m', '15m', '30m', '1h', '3h', '6h', '12h', '1D',\n                     '7D', '14D', '1M']\n        if arg_2:\n            if arg_2 not in arg_4:\n                raise ValueError(\"timeframe must be any of %s\" % arg_4)\n        else:\n            arg_2 = '1m'\n        arg_5 = ('candles', arg_1, arg_2)\n        arg_1 = 't' + arg_1 if not arg_1.startswith('t') else arg_1\n        arg_6 = 'trade:' + arg_2 + ':' + arg_1\n        arg_0._subscribe('candles', arg_5, arg_6=arg_6, **arg_3)", "path": "btfxwss/client.py", "identifier": "BtfxWss.subscribe_to_candles", "docstring": "Subscribe to the passed pair's OHLC data channel.\n\n        :param pair: str, Symbol pair to request data for\n        :param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h,\n                                1D, 7D, 14D, 1M}\n        :param kwargs:\n        :return:", "docstring_tokens": ["Subscribe", "to", "the", "passed", "pair", "s", "OHLC", "data", "channel", "."], "nwo": "Crypto-toolbox/btfxwss", "score": 0.6139886433376424, "idx": 254471}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py#L1289-L1299", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get a list of all msg_ids in our DB records", "language": "python", "parameters": "(self, client_id, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "db", ".", "Func", "(", ")", "except", "Exception", "as", "e", ":", "arg_4", "=", "error", ".", "wrap_exception", "(", ")", "else", ":", "arg_4", "=", "dict", "(", "status", "=", "'ok'", ",", "history", "=", "arg_3", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "query", ",", "\"history_reply\"", ",", "arg_4", "=", "arg_4", ",", "parent", "=", "arg_2", ",", "ident", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Get a list of all msg_ids in our DB records\"\"\"\n        try:\n            arg_3 = arg_0.db.Func()\n        except Exception as e:\n            arg_4 = error.wrap_exception()\n        else:\n            arg_4 = dict(status='ok', history=arg_3)\n\n        arg_0.session.send(arg_0.query, \"history_reply\", arg_4=arg_4,\n                                            parent=arg_2, ident=arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py", "identifier": "Hub.get_history", "docstring": "Get a list of all msg_ids in our DB records", "docstring_tokens": ["Get", "a", "list", "of", "all", "msg_ids", "in", "our", "DB", "records"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254472}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/html/__init__.py#L16-L24", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Convenience function for accessing tag parameters", "language": "python", "parameters": "(tag, param, default=__SENTINEL)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "if", "arg_0", ".", "HasParam", "(", "arg_1", ")", ":", "return", "arg_0", ".", "Func", "(", "arg_1", ")", "else", ":", "if", "arg_2", "==", "arg_3", ":", "raise", "KeyError", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\r\n    \"\"\" Convenience function for accessing tag parameters\"\"\"\r\n    if arg_0.HasParam(arg_1):\r\n        return arg_0.Func(arg_1)\r\n    else:\r\n        if arg_2 == arg_3:\r\n            raise KeyError\r\n        else:\r\n            return arg_2", "path": "gui/html/__init__.py", "identifier": "GetParam", "docstring": "Convenience function for accessing tag parameters", "docstring_tokens": ["Convenience", "function", "for", "accessing", "tag", "parameters"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 254473}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L1238-L1268", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Get the number of mapped and unmapped reads for a sample\n    and update sample.stats", "language": "python", "parameters": "(data, sample)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "refmapping", ",", "arg_1", ".", "name", "+", "\"-mapped-sorted.bam\"", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "refmapping", ",", "arg_1", ".", "name", "+", "\"-unmapped.bam\"", ")", "arg_4", "=", "[", "ipyrad", ".", "bins", ".", "samtools", ",", "\"flagstat\"", ",", "arg_3", "]", "arg_5", "=", "sps", ".", "Popen", "(", "arg_4", ",", "stderr", "=", "sps", ".", "STDOUT", ",", "stdout", "=", "sps", ".", "PIPE", ")", "arg_6", "=", "arg_5", ".", "communicate", "(", ")", "[", "0", "]", "arg_7", "=", "[", "ipyrad", ".", "bins", ".", "samtools", ",", "\"flagstat\"", ",", "arg_2", "]", "arg_8", "=", "sps", ".", "Popen", "(", "arg_7", ",", "stderr", "=", "sps", ".", "STDOUT", ",", "stdout", "=", "sps", ".", "PIPE", ")", "arg_9", "=", "arg_8", ".", "communicate", "(", ")", "[", "0", "]", "if", "\"pair\"", "in", "arg_0", ".", "paramsdict", "[", "\"datatype\"", "]", ":", "arg_1", ".", "stats", "[", "\"refseq_unmapped_reads\"", "]", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "0", "]", ")", "/", "2", "arg_1", ".", "stats", "[", "\"refseq_mapped_reads\"", "]", "=", "int", "(", "arg_9", ".", "split", "(", ")", "[", "0", "]", ")", "/", "2", "else", ":", "arg_1", ".", "stats", "[", "\"refseq_unmapped_reads\"", "]", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "0", "]", ")", "arg_1", ".", "stats", "[", "\"refseq_mapped_reads\"", "]", "=", "int", "(", "arg_9", ".", "split", "(", ")", "[", "0", "]", ")", "sample_cleanup", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" \n    Get the number of mapped and unmapped reads for a sample\n    and update sample.stats \n    \"\"\"\n    ## shorter names\n    arg_2 = os.path.join(arg_0.dirs.refmapping, arg_1.name+\"-mapped-sorted.bam\")\n    arg_3 = os.path.join(arg_0.dirs.refmapping, arg_1.name+\"-unmapped.bam\")\n\n    ## get from unmapped\n    arg_4 = [ipyrad.bins.samtools, \"flagstat\", arg_3]\n    arg_5 = sps.Popen(arg_4, stderr=sps.STDOUT, stdout=sps.PIPE)\n    arg_6 = arg_5.communicate()[0]\n\n    ## get from mapped\n    arg_7 = [ipyrad.bins.samtools, \"flagstat\", arg_2]\n    arg_8 = sps.Popen(arg_7, stderr=sps.STDOUT, stdout=sps.PIPE)\n    arg_9 = arg_8.communicate()[0]\n\n    ## store results\n    ## If PE, samtools reports the _actual_ number of reads mapped, both \n    ## R1 and R2, so here if PE divide the results by 2 to stay consistent\n    ## with how we've been reporting R1 and R2 as one \"read pair\"\n    if \"pair\" in arg_0.paramsdict[\"datatype\"]:\n        arg_1.stats[\"refseq_unmapped_reads\"] = int(arg_6.split()[0]) / 2\n        arg_1.stats[\"refseq_mapped_reads\"] = int(arg_9.split()[0]) / 2\n    else:\n        arg_1.stats[\"refseq_unmapped_reads\"] = int(arg_6.split()[0])\n        arg_1.stats[\"refseq_mapped_reads\"] = int(arg_9.split()[0])\n\n    sample_cleanup(arg_0, arg_1)", "path": "ipyrad/assemble/refmap.py", "identifier": "refmap_stats", "docstring": "Get the number of mapped and unmapped reads for a sample\n    and update sample.stats", "docstring_tokens": ["Get", "the", "number", "of", "mapped", "and", "unmapped", "reads", "for", "a", "sample", "and", "update", "sample", ".", "stats"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 254474}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/util.py#L474-L479", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "Fetches an entity from the session based on primary key.", "language": "python", "parameters": "(self, pk)", "return_statement": "return self.known.get(pk) or self.wknown.get(pk)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_init", "(", ")", "return", "arg_0", ".", "known", ".", "Func", "(", "arg_1", ")", "or", "arg_0", ".", "wknown", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Fetches an entity from the session based on primary key.\n        '''\n        arg_0._init()\n        return arg_0.known.Func(arg_1) or arg_0.wknown.Func(arg_1)", "path": "rom/util.py", "identifier": "Session.get", "docstring": "Fetches an entity from the session based on primary key.", "docstring_tokens": ["Fetches", "an", "entity", "from", "the", "session", "based", "on", "primary", "key", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 254475}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/pipeline_parser.py#L341-L447", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Parses a pipeline string into a list of dictionaries with the connections\n     between processes", "language": "python", "parameters": "(pipeline_str)", "return_statement": "return pipeline_links", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"Found pipeline file: {}\"", ".", "format", "(", "arg_0", ")", ")", "with", "open", "(", "arg_0", ")", "as", "fh", ":", "arg_0", "=", "\"\"", ".", "join", "(", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "fh", ".", "readlines", "(", ")", "]", ")", "logger", ".", "info", "(", "colored_print", "(", "\"Resulting pipeline string:\\n\"", ")", ")", "logger", ".", "info", "(", "colored_print", "(", "arg_0", "+", "\"\\n\"", ")", ")", "insanity_checks", "(", "arg_0", ")", "logger", ".", "debug", "(", "\"Parsing pipeline string: {}\"", ".", "format", "(", "arg_0", ")", ")", "arg_1", "=", "[", "]", "arg_2", "=", "1", "arg_3", ",", "arg_4", "=", "add_unique_identifiers", "(", "arg_0", ")", "arg_5", "=", "arg_3", ".", "count", "(", "FORK_TOKEN", ")", "logger", ".", "debug", "(", "\"Found {} fork(s)\"", ".", "format", "(", "arg_5", ")", ")", "if", "not", "arg_5", ":", "logger", ".", "debug", "(", "\"Detected linear pipeline string : {}\"", ".", "format", "(", "arg_0", ")", ")", "arg_6", "=", "[", "\"__init__\"", "]", "+", "arg_3", ".", "split", "(", ")", "arg_1", ".", "extend", "(", "linear_connection", "(", "arg_6", ",", "arg_2", ")", ")", "arg_1", "=", "remove_unique_identifiers", "(", "arg_4", ",", "arg_1", ")", "return", "arg_1", "for", "arg_7", "in", "range", "(", "arg_5", ")", ":", "logger", ".", "debug", "(", "\"Processing fork {} in lane {}\"", ".", "format", "(", "arg_7", ",", "arg_2", ")", ")", "arg_8", "=", "arg_3", ".", "split", "(", "FORK_TOKEN", ",", "arg_7", "+", "1", ")", "arg_9", "=", "arg_8", "[", "-", "2", "]", ".", "split", "(", "LANE_TOKEN", ")", "[", "-", "1", "]", ".", "split", "(", ")", "logger", ".", "debug", "(", "\"Previous processes string: {}\"", ".", "format", "(", "arg_8", "[", "-", "2", "]", ")", ")", "logger", ".", "debug", "(", "\"Previous processes list: {}\"", ".", "format", "(", "arg_9", ")", ")", "arg_10", "=", "get_lanes", "(", "arg_8", "[", "-", "1", "]", ")", "logger", ".", "debug", "(", "\"Next lanes object: {}\"", ".", "format", "(", "arg_10", ")", ")", "arg_11", "=", "[", "x", "[", "0", "]", "for", "x", "in", "arg_10", "]", "logger", ".", "debug", "(", "\"The fork sinks into the processes: {}\"", ".", "format", "(", "arg_11", ")", ")", "if", "arg_7", "==", "0", ":", "if", "not", "arg_9", ":", "arg_9", "=", "[", "\"__init__\"", "]", "arg_2", "=", "0", "else", ":", "arg_9", "=", "[", "\"__init__\"", "]", "+", "arg_9", "arg_1", ".", "extend", "(", "linear_connection", "(", "arg_9", ",", "arg_2", ")", ")", "arg_12", "=", "arg_9", "[", "-", "1", "]", "logger", ".", "debug", "(", "\"Fork source is set to: {}\"", ".", "format", "(", "arg_12", ")", ")", "arg_13", "=", "get_source_lane", "(", "arg_9", ",", "arg_1", ")", "logger", ".", "debug", "(", "\"Fork lane is set to: {}\"", ".", "format", "(", "arg_13", ")", ")", "arg_1", ".", "extend", "(", "fork_connection", "(", "arg_12", ",", "arg_11", ",", "arg_13", ",", "arg_2", ")", ")", "arg_1", ".", "extend", "(", "linear_lane_connection", "(", "arg_10", ",", "arg_2", ")", ")", "arg_2", "+=", "len", "(", "arg_11", ")", "arg_1", "=", "remove_unique_identifiers", "(", "arg_4", ",", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parses a pipeline string into a list of dictionaries with the connections\n     between processes\n\n    Parameters\n    ----------\n    pipeline_str : str\n        String with the definition of the pipeline, e.g.::\n            'processA processB processC(ProcessD | ProcessE)'\n\n    Returns\n    -------\n    pipeline_links : list\n\n    \"\"\"\n\n    if os.path.exists(arg_0):\n        logger.debug(\"Found pipeline file: {}\".format(arg_0))\n        with open(arg_0) as fh:\n            arg_0 = \"\".join([x.strip() for x in fh.readlines()])\n\n    logger.info(colored_print(\"Resulting pipeline string:\\n\"))\n    logger.info(colored_print(arg_0 + \"\\n\"))\n\n    # Perform pipeline insanity checks\n    insanity_checks(arg_0)\n\n    logger.debug(\"Parsing pipeline string: {}\".format(arg_0))\n\n    arg_1 = []\n    arg_2 = 1\n\n    # Add unique identifiers to each process to allow a correct connection\n    # between forks with same processes\n    arg_3, arg_4 = add_unique_identifiers(\n        arg_0)\n\n    # Get number of forks in the pipeline\n    arg_5 = arg_3.count(FORK_TOKEN)\n    logger.debug(\"Found {} fork(s)\".format(arg_5))\n\n    # If there are no forks, connect the pipeline as purely linear\n    if not arg_5:\n        logger.debug(\"Detected linear pipeline string : {}\".format(\n            arg_0))\n        arg_6 = [\"__init__\"] + arg_3.split()\n        arg_1.extend(linear_connection(arg_6, arg_2))\n        # Removes unique identifiers used for correctly assign fork parents with\n        #  a possible same process name\n        arg_1 = remove_unique_identifiers(arg_4,\n                                                   arg_1)\n        return arg_1\n\n    for arg_7 in range(arg_5):\n\n        logger.debug(\"Processing fork {} in lane {}\".format(arg_7, arg_2))\n        # Split the pipeline at each fork start position. fields[-1] will\n        # hold the process after the fork. fields[-2] will hold the processes\n        # before the fork.\n        arg_8 = arg_3.split(FORK_TOKEN, arg_7 + 1)\n\n        # Get the processes before the fork. This may be empty when the\n        # fork is at the beginning of the pipeline.\n        arg_9 = arg_8[-2].split(LANE_TOKEN)[-1].split()\n        logger.debug(\"Previous processes string: {}\".format(arg_8[-2]))\n        logger.debug(\"Previous processes list: {}\".format(arg_9))\n        # Get lanes after the fork\n        arg_10 = get_lanes(arg_8[-1])\n        logger.debug(\"Next lanes object: {}\".format(arg_10))\n        # Get the immediate targets of the fork\n        arg_11 = [x[0] for x in arg_10]\n        logger.debug(\"The fork sinks into the processes: {}\".format(arg_11))\n\n        # The first fork is a special case, where the processes before AND\n        # after the fork (until the start of another fork) are added to\n        # the ``pipeline_links`` variable. Otherwise, only the processes\n        # after the fork will be added\n        if arg_7 == 0:\n            # If there are no previous process, the fork is at the beginning\n            # of the pipeline string. In this case, inject the special\n            # \"init\" process.\n            if not arg_9:\n                arg_9 = [\"__init__\"]\n                arg_2 = 0\n            else:\n                arg_9 = [\"__init__\"] + arg_9\n\n            # Add the linear modules before the fork\n            arg_1.extend(\n                linear_connection(arg_9, arg_2))\n\n        arg_12 = arg_9[-1]\n        logger.debug(\"Fork source is set to: {}\".format(arg_12))\n        arg_13 = get_source_lane(arg_9, arg_1)\n        logger.debug(\"Fork lane is set to: {}\".format(arg_13))\n        # Add the forking modules\n        arg_1.extend(\n            fork_connection(arg_12, arg_11, arg_13, arg_2))\n        # Add the linear connections in the subsequent lanes\n        arg_1.extend(\n            linear_lane_connection(arg_10, arg_2))\n\n        arg_2 += len(arg_11)\n\n    arg_1 = remove_unique_identifiers(arg_4,\n                                               arg_1)\n    return arg_1", "path": "flowcraft/generator/pipeline_parser.py", "identifier": "parse_pipeline", "docstring": "Parses a pipeline string into a list of dictionaries with the connections\n     between processes\n\n    Parameters\n    ----------\n    pipeline_str : str\n        String with the definition of the pipeline, e.g.::\n            'processA processB processC(ProcessD | ProcessE)'\n\n    Returns\n    -------\n    pipeline_links : list", "docstring_tokens": ["Parses", "a", "pipeline", "string", "into", "a", "list", "of", "dictionaries", "with", "the", "connections", "between", "processes"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 254476}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L780-L783", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Create a new sender link.", "language": "python", "parameters": "(self, name)", "return_statement": "return self.request_sender(pn_link)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_pn_session", ".", "sender", "(", "arg_1", ")", "return", "arg_0", ".", "request_sender", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create a new sender link.\"\"\"\n        arg_2 = arg_0._pn_session.sender(arg_1)\n        return arg_0.request_sender(arg_2)", "path": "pyngus/link.py", "identifier": "_SessionProxy.new_sender", "docstring": "Create a new sender link.", "docstring_tokens": ["Create", "a", "new", "sender", "link", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 254477}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/features.py#L219-L229", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "If unstacked, convert to stacked. If stacked, do nothing.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "stacked", ":", "return", "arg_0", ".", "_boundaries", "=", "bounds", "=", "np", ".", "r_", "[", "0", ",", "np", ".", "cumsum", "(", "arg_0", ".", "n_pts", ")", "]", "arg_0", ".", "stacked_features", "=", "arg_4", "=", "np", ".", "vstack", "(", "arg_0", ".", "features", ")", "arg_0", ".", "features", "=", "np", ".", "array", "(", "[", "arg_4", "[", "bounds", "[", "i", "-", "1", "]", ":", "bounds", "[", "i", "]", "]", "for", "i", "in", "xrange", "(", "1", ",", "len", "(", "bounds", ")", ")", "]", ",", "dtype", "=", "object", ")", "arg_0", ".", "stacked", "=", "True"], "function": "def Func(arg_0):\n        \"If unstacked, convert to stacked. If stacked, do nothing.\"\n        if arg_0.stacked:\n            return\n\n        arg_0._boundaries = bounds = np.r_[0, np.cumsum(arg_0.n_pts)]\n        arg_0.stacked_features = arg_4 = np.vstack(arg_0.features)\n        arg_0.features = np.array(\n            [arg_4[bounds[i-1]:bounds[i]] for i in xrange(1, len(bounds))],\n            dtype=object)\n        arg_0.stacked = True", "path": "skl_groups/features.py", "identifier": "Features.make_stacked", "docstring": "If unstacked, convert to stacked. If stacked, do nothing.", "docstring_tokens": ["If", "unstacked", "convert", "to", "stacked", ".", "If", "stacked", "do", "nothing", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 254478}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/math/sparse.py#L30-L61", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Converts dense `Tensor` to `SparseTensor`, dropping `ignore_value` cells.", "language": "python", "parameters": "(x, ignore_value=None, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_2", ",", "'Func'", ",", "[", "arg_0", ",", "arg_1", "]", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_2", "=", "'x'", ")", "if", "arg_1", "is", "None", ":", "if", "arg_0", ".", "dtype", ".", "base_dtype", "==", "tf", ".", "string", ":", "arg_1", "=", "''", "else", ":", "arg_1", "=", "arg_0", ".", "dtype", ".", "as_numpy_dtype", "(", "0", ")", "arg_1", "=", "tf", ".", "cast", "(", "arg_1", ",", "arg_0", ".", "dtype", ",", "arg_2", "=", "'ignore_value'", ")", "arg_3", "=", "tf", ".", "where", "(", "tf", ".", "not_equal", "(", "arg_0", ",", "arg_1", ")", ",", "arg_2", "=", "'indices'", ")", "return", "tf", ".", "SparseTensor", "(", "arg_3", "=", "arg_3", ",", "values", "=", "tf", ".", "gather_nd", "(", "arg_0", ",", "arg_3", ",", "arg_2", "=", "'values'", ")", ",", "dense_shape", "=", "tf", ".", "shape", "(", "input", "=", "arg_0", ",", "out_type", "=", "tf", ".", "int64", ",", "arg_2", "=", "'dense_shape'", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n  \"\"\"Converts dense `Tensor` to `SparseTensor`, dropping `ignore_value` cells.\n\n  Args:\n    x: A `Tensor`.\n    ignore_value: Entries in `x` equal to this value will be\n      absent from the return `SparseTensor`. If `None`, default value of\n      `x` dtype will be used (e.g. '' for `str`, 0 for `int`).\n    name: Python `str` prefix for ops created by this function.\n\n  Returns:\n    sparse_x: A `tf.SparseTensor` with the same shape as `x`.\n\n  Raises:\n    ValueError: when `x`'s rank is `None`.\n  \"\"\"\n  # Copied (with modifications) from:\n  # tensorflow/contrib/layers/python/ops/sparse_ops.py.\n  with tf.compat.v1.name_scope(arg_2, 'Func', [arg_0, arg_1]):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_2='x')\n    if arg_1 is None:\n      if arg_0.dtype.base_dtype == tf.string:\n        # Exception due to TF strings are converted to numpy objects by default.\n        arg_1 = ''\n      else:\n        arg_1 = arg_0.dtype.as_numpy_dtype(0)\n      arg_1 = tf.cast(arg_1, arg_0.dtype, arg_2='ignore_value')\n    arg_3 = tf.where(tf.not_equal(arg_0, arg_1), arg_2='indices')\n    return tf.SparseTensor(\n        arg_3=arg_3,\n        values=tf.gather_nd(arg_0, arg_3, arg_2='values'),\n        dense_shape=tf.shape(input=arg_0, out_type=tf.int64, arg_2='dense_shape'))", "path": "tensorflow_probability/python/math/sparse.py", "identifier": "dense_to_sparse", "docstring": "Converts dense `Tensor` to `SparseTensor`, dropping `ignore_value` cells.\n\n  Args:\n    x: A `Tensor`.\n    ignore_value: Entries in `x` equal to this value will be\n      absent from the return `SparseTensor`. If `None`, default value of\n      `x` dtype will be used (e.g. '' for `str`, 0 for `int`).\n    name: Python `str` prefix for ops created by this function.\n\n  Returns:\n    sparse_x: A `tf.SparseTensor` with the same shape as `x`.\n\n  Raises:\n    ValueError: when `x`'s rank is `None`.", "docstring_tokens": ["Converts", "dense", "Tensor", "to", "SparseTensor", "dropping", "ignore_value", "cells", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254479}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L510-L543", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "get the command to start the topology health manager processes", "language": "python", "parameters": "(self)", "return_statement": "return Command(healthmgr_cmd, self.shell_env)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'org.apache.heron.healthmgr.HealthManager'", "arg_2", "=", "[", "os", ".", "path", ".", "join", "(", "arg_0", ".", "heron_java_home", ",", "'bin/java'", ")", ",", "'-Xmx1024M'", ",", "'-XX:+PrintCommandLineFlags'", ",", "'-verbosegc'", ",", "'-XX:+PrintGCDetails'", ",", "'-XX:+PrintGCTimeStamps'", ",", "'-XX:+PrintGCDateStamps'", ",", "'-XX:+PrintGCCause'", ",", "'-XX:+UseGCLogFileRotation'", ",", "'-XX:NumberOfGCLogFiles=5'", ",", "'-XX:GCLogFileSize=100M'", ",", "'-XX:+PrintPromotionFailure'", ",", "'-XX:+PrintTenuringDistribution'", ",", "'-XX:+PrintHeapAtGC'", ",", "'-XX:+HeapDumpOnOutOfMemoryError'", ",", "'-XX:+UseConcMarkSweepGC'", ",", "'-XX:+PrintCommandLineFlags'", ",", "'-Xloggc:log-files/gc.healthmgr.log'", ",", "'-Djava.net.preferIPv4Stack=true'", ",", "'-cp'", ",", "arg_0", ".", "health_manager_classpath", ",", "arg_1", ",", "\"--cluster\"", ",", "arg_0", ".", "cluster", ",", "\"--role\"", ",", "arg_0", ".", "role", ",", "\"--environment\"", ",", "arg_0", ".", "environment", ",", "\"--topology_name\"", ",", "arg_0", ".", "topology_name", ",", "\"--metricsmgr_port\"", ",", "arg_0", ".", "metrics_manager_port", "]", "return", "Command", "(", "arg_2", ",", "arg_0", ".", "shell_env", ")"], "function": "def Func(arg_0):\n    ''' get the command to start the topology health manager processes '''\n    arg_1 = 'org.apache.heron.healthmgr.HealthManager'\n\n    arg_2 = [os.path.join(arg_0.heron_java_home, 'bin/java'),\n                     # We could not rely on the default -Xmx setting, which could be very big,\n                     # for instance, the default -Xmx in Twitter mesos machine is around 18GB\n                     '-Xmx1024M',\n                     '-XX:+PrintCommandLineFlags',\n                     '-verbosegc',\n                     '-XX:+PrintGCDetails',\n                     '-XX:+PrintGCTimeStamps',\n                     '-XX:+PrintGCDateStamps',\n                     '-XX:+PrintGCCause',\n                     '-XX:+UseGCLogFileRotation',\n                     '-XX:NumberOfGCLogFiles=5',\n                     '-XX:GCLogFileSize=100M',\n                     '-XX:+PrintPromotionFailure',\n                     '-XX:+PrintTenuringDistribution',\n                     '-XX:+PrintHeapAtGC',\n                     '-XX:+HeapDumpOnOutOfMemoryError',\n                     '-XX:+UseConcMarkSweepGC',\n                     '-XX:+PrintCommandLineFlags',\n                     '-Xloggc:log-files/gc.healthmgr.log',\n                     '-Djava.net.preferIPv4Stack=true',\n                     '-cp', arg_0.health_manager_classpath,\n                     arg_1,\n                     \"--cluster\", arg_0.cluster,\n                     \"--role\", arg_0.role,\n                     \"--environment\", arg_0.environment,\n                     \"--topology_name\", arg_0.topology_name,\n                     \"--metricsmgr_port\", arg_0.metrics_manager_port]\n\n    return Command(arg_2, arg_0.shell_env)", "path": "heron/executor/src/python/heron_executor.py", "identifier": "HeronExecutor._get_healthmgr_cmd", "docstring": "get the command to start the topology health manager processes", "docstring_tokens": ["get", "the", "command", "to", "start", "the", "topology", "health", "manager", "processes"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254480}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1200-L1239", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Delete a variable from the various namespaces, so that, as\n        far as possible, we're not keeping any hidden references to it.", "language": "python", "parameters": "(self, varname, by_name=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "in", "(", "'__builtin__'", ",", "'__builtins__'", ")", ":", "raise", "ValueError", "(", "\"Refusing to delete %s\"", "%", "arg_1", ")", "arg_3", "=", "arg_0", ".", "all_ns_refs", "if", "arg_2", ":", "for", "arg_4", "in", "arg_3", ":", "try", ":", "del", "arg_4", "[", "arg_1", "]", "except", "KeyError", ":", "pass", "else", ":", "try", ":", "arg_5", "=", "arg_0", ".", "user_ns", "[", "arg_1", "]", "except", "KeyError", ":", "raise", "NameError", "(", "\"name '%s' is not defined\"", "%", "arg_1", ")", "arg_3", ".", "append", "(", "arg_0", ".", "history_manager", ".", "output_hist", ")", "for", "arg_4", "in", "arg_3", ":", "arg_6", "=", "[", "n", "for", "n", ",", "o", "in", "arg_4", ".", "iteritems", "(", ")", "if", "o", "is", "arg_5", "]", "for", "arg_7", "in", "arg_6", ":", "del", "arg_4", "[", "arg_7", "]", "for", "arg_7", "in", "(", "'_'", ",", "'__'", ",", "'___'", ")", ":", "if", "getattr", "(", "arg_0", ".", "displayhook", ",", "arg_7", ")", "is", "arg_5", ":", "setattr", "(", "arg_0", ".", "displayhook", ",", "arg_7", ",", "None", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Delete a variable from the various namespaces, so that, as\n        far as possible, we're not keeping any hidden references to it.\n\n        Parameters\n        ----------\n        varname : str\n            The name of the variable to delete.\n        by_name : bool\n            If True, delete variables with the given name in each\n            namespace. If False (default), find the variable in the user\n            namespace, and delete references to it.\n        \"\"\"\n        if arg_1 in ('__builtin__', '__builtins__'):\n            raise ValueError(\"Refusing to delete %s\" % arg_1)\n\n        arg_3 = arg_0.all_ns_refs\n        \n        if arg_2:                    # Delete by name\n            for arg_4 in arg_3:\n                try:\n                    del arg_4[arg_1]\n                except KeyError:\n                    pass\n        else:                         # Delete by object\n            try:\n                arg_5 = arg_0.user_ns[arg_1]\n            except KeyError:\n                raise NameError(\"name '%s' is not defined\" % arg_1)\n            # Also check in output history\n            arg_3.append(arg_0.history_manager.output_hist)\n            for arg_4 in arg_3:\n                arg_6 = [n for n, o in arg_4.iteritems() if o is arg_5]\n                for arg_7 in arg_6:\n                    del arg_4[arg_7]\n\n            # displayhook keeps extra references, but not in a dictionary\n            for arg_7 in ('_', '__', '___'):\n                if getattr(arg_0.displayhook, arg_7) is arg_5:\n                    setattr(arg_0.displayhook, arg_7, None)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.del_var", "docstring": "Delete a variable from the various namespaces, so that, as\n        far as possible, we're not keeping any hidden references to it.\n\n        Parameters\n        ----------\n        varname : str\n            The name of the variable to delete.\n        by_name : bool\n            If True, delete variables with the given name in each\n            namespace. If False (default), find the variable in the user\n            namespace, and delete references to it.", "docstring_tokens": ["Delete", "a", "variable", "from", "the", "various", "namespaces", "so", "that", "as", "far", "as", "possible", "we", "re", "not", "keeping", "any", "hidden", "references", "to", "it", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254481}
{"url": "https://github.com/koenedaele/skosprovider/blob/7304a37953978ca8227febc2d3cc2b2be178f215/skosprovider/registry.py#L203-L227", "sha": "7304a37953978ca8227febc2d3cc2b2be178f215", "docstring_summary": "Get a concept or collection by its uri.", "language": "python", "parameters": "(self, uri)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "is_uri", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "'%s is not a valid URI.'", "%", "arg_1", ")", "arg_2", "=", "[", "arg_3", "for", "arg_3", "in", "arg_0", ".", "concept_scheme_uri_map", ".", "keys", "(", ")", "if", "arg_1", ".", "startswith", "(", "arg_3", ")", "]", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "arg_0", ".", "get_provider", "(", "arg_3", ")", ".", "Func", "(", "arg_1", ")", "if", "arg_4", ":", "return", "arg_4", "for", "arg_5", "in", "arg_0", ".", "providers", ".", "values", "(", ")", ":", "arg_4", "=", "arg_5", ".", "Func", "(", "arg_1", ")", "if", "arg_4", ":", "return", "arg_4", "return", "False"], "function": "def Func(arg_0, arg_1):\n        '''Get a concept or collection by its uri.\n\n        Returns a single concept or collection if one exists with this uri.\n        Returns False otherwise.\n\n        :param string uri: The uri to find a concept or collection for.\n        :raises ValueError: The uri is invalid.\n        :rtype: :class:`skosprovider.skos.Concept` or\n            :class:`skosprovider.skos.Collection`\n        '''\n        if not is_uri(arg_1):\n            raise ValueError('%s is not a valid URI.' % arg_1)\n        # Check if there's a provider that's more likely to have the URI\n        arg_2 = [arg_3 for arg_3 in arg_0.concept_scheme_uri_map.keys() if arg_1.startswith(arg_3)]\n        for arg_3 in arg_2:\n            arg_4 = arg_0.get_provider(arg_3).Func(arg_1)\n            if arg_4:\n                return arg_4\n        # Check all providers\n        for arg_5 in arg_0.providers.values():\n            arg_4 = arg_5.Func(arg_1)\n            if arg_4:\n                return arg_4\n        return False", "path": "skosprovider/registry.py", "identifier": "Registry.get_by_uri", "docstring": "Get a concept or collection by its uri.\n\n        Returns a single concept or collection if one exists with this uri.\n        Returns False otherwise.\n\n        :param string uri: The uri to find a concept or collection for.\n        :raises ValueError: The uri is invalid.\n        :rtype: :class:`skosprovider.skos.Concept` or\n            :class:`skosprovider.skos.Collection`", "docstring_tokens": ["Get", "a", "concept", "or", "collection", "by", "its", "uri", "."], "nwo": "koenedaele/skosprovider", "score": 0.3726785709016597, "idx": 254482}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/templatetags/registrasion_tags.py#L35-L46", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Adds the categories that the user does not currently have.", "language": "python", "parameters": "(context)", "return_statement": "return categories_available - categories_held", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "user_for_context", "(", "arg_0", ")", "arg_2", "=", "set", "(", "CategoryController", ".", "available_categories", "(", "arg_1", ")", ")", "arg_3", "=", "ItemController", "(", "arg_1", ")", ".", "items_pending_or_purchased", "(", ")", "arg_4", "=", "set", "(", ")", "for", "arg_5", ",", "arg_6", "in", "arg_3", ":", "arg_4", ".", "add", "(", "arg_5", ".", "category", ")", "return", "arg_2", "-", "arg_4"], "function": "def Func(arg_0):\n    ''' Adds the categories that the user does not currently have. '''\n    arg_1 = user_for_context(arg_0)\n    arg_2 = set(CategoryController.available_categories(arg_1))\n    arg_3 = ItemController(arg_1).items_pending_or_purchased()\n\n    arg_4 = set()\n\n    for arg_5, arg_6 in arg_3:\n        arg_4.add(arg_5.category)\n\n    return arg_2 - arg_4", "path": "registrasion/templatetags/registrasion_tags.py", "identifier": "missing_categories", "docstring": "Adds the categories that the user does not currently have.", "docstring_tokens": ["Adds", "the", "categories", "that", "the", "user", "does", "not", "currently", "have", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 254483}
{"url": "https://github.com/ardexa/ardexaplugin/blob/5068532f601ae3042bd87af1063057e8f274f670/ardexaplugin.py#L111-L122", "sha": "5068532f601ae3042bd87af1063057e8f274f670", "docstring_summary": "This function will check whether a PID is currently running", "language": "python", "parameters": "(pid, debug)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "os", ".", "kill", "(", "arg_0", ",", "0", ")", "if", "arg_1", ">", "1", ":", "print", "(", "\"Script has a PIDFILE where the process is still running\"", ")", "return", "True", "except", "OSError", ":", "if", "arg_1", ">", "1", ":", "print", "(", "\"Script does not appear to be running\"", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"This function will check whether a PID is currently running\"\"\"\n    try:\n        # A Kill of 0 is to check if the PID is active. It won't kill the process\n        os.kill(arg_0, 0)\n        if arg_1 > 1:\n            print(\"Script has a PIDFILE where the process is still running\")\n        return True\n    except OSError:\n        if arg_1 > 1:\n            print(\"Script does not appear to be running\")\n        return False", "path": "ardexaplugin.py", "identifier": "check_pid", "docstring": "This function will check whether a PID is currently running", "docstring_tokens": ["This", "function", "will", "check", "whether", "a", "PID", "is", "currently", "running"], "nwo": "ardexa/ardexaplugin", "score": 0.2424429654267875, "idx": 254484}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/phabricator.py#L531-L542", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrieve users.", "language": "python", "parameters": "(self, *phids)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "{", "arg_0", ".", "PHIDS", ":", "arg_1", "}", "arg_3", "=", "arg_0", ".", "_call", "(", "arg_0", ".", "PHAB_USERS", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Retrieve Func.\n\n        :params phids: list of Func identifiers\n        \"\"\"\n        arg_2 = {\n            arg_0.PHIDS: arg_1\n        }\n\n        arg_3 = arg_0._call(arg_0.PHAB_USERS, arg_2)\n\n        return arg_3", "path": "perceval/backends/core/phabricator.py", "identifier": "ConduitClient.users", "docstring": "Retrieve users.\n\n        :params phids: list of users identifiers", "docstring_tokens": ["Retrieve", "users", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 254485}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L562-L580", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Clean enterprise channel worker user form field", "language": "python", "parameters": "(self)", "return_statement": "return channel_worker_username", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "cleaned_data", "[", "'channel_worker_username'", "]", ".", "strip", "(", ")", "try", ":", "User", ".", "objects", ".", "get", "(", "username", "=", "arg_1", ")", "except", "User", ".", "DoesNotExist", ":", "raise", "ValidationError", "(", "ValidationMessages", ".", "INVALID_CHANNEL_WORKER", ".", "format", "(", "arg_1", "=", "arg_1", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Clean enterprise channel worker user form field\n\n        Returns:\n            str: the cleaned value of channel user username for transmitting courses metadata.\n        \"\"\"\n        arg_1 = arg_0.cleaned_data['channel_worker_username'].strip()\n\n        try:\n            User.objects.get(username=arg_1)\n        except User.DoesNotExist:\n            raise ValidationError(\n                ValidationMessages.INVALID_CHANNEL_WORKER.format(\n                    arg_1=arg_1\n                )\n            )\n\n        return arg_1", "path": "enterprise/admin/forms.py", "identifier": "TransmitEnterpriseCoursesForm.clean_channel_worker_username", "docstring": "Clean enterprise channel worker user form field\n\n        Returns:\n            str: the cleaned value of channel user username for transmitting courses metadata.", "docstring_tokens": ["Clean", "enterprise", "channel", "worker", "user", "form", "field"], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254486}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L638-L684", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Set the first point of the exterior to the given point based on its coordinates.", "language": "python", "parameters": "(self, x, y, max_distance=1e-4,\n                                     raise_if_too_far_away=True)", "return_statement": "return self.change_first_point_by_index(closest_idx)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1e-4", ",", "arg_4", "=", "True", ")", ":", "if", "len", "(", "arg_0", ".", "exterior", ")", "==", "0", ":", "raise", "Exception", "(", "\"Cannot reorder polygon points, because it contains no points.\"", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "find_closest_point_index", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "return_distance", "=", "True", ")", "if", "arg_3", "is", "not", "None", "and", "arg_6", ">", "arg_3", ":", "if", "not", "arg_4", ":", "return", "arg_0", ".", "deepcopy", "(", ")", "arg_7", "=", "arg_0", ".", "exterior", "[", "arg_5", ",", ":", "]", "raise", "Exception", "(", "\"Closest found point (%.9f, %.9f) exceeds max_distance of %.9f exceeded\"", "%", "(", "arg_7", "[", "0", "]", ",", "arg_7", "[", "1", "]", ",", "arg_6", ")", ")", "return", "arg_0", ".", "change_first_point_by_index", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1e-4,\n                                     arg_4=True):\n        \"\"\"\n        Set the first point of the exterior to the given point based on its coordinates.\n\n        If multiple points are found, the closest one will be picked.\n        If no matching points are found, an exception is raised.\n\n        Note: This method does *not* work in-place.\n\n        Parameters\n        ----------\n        x : number\n            X-coordinate of the point.\n\n        y : number\n            Y-coordinate of the point.\n\n        max_distance : None or number, optional\n            Maximum distance past which possible matches are ignored.\n            If ``None`` the distance limit is deactivated.\n\n        raise_if_too_far_away : bool, optional\n            Whether to raise an exception if the closest found point is too\n            far away (``True``) or simply return an unchanged copy if this\n            object (``False``).\n\n        Returns\n        -------\n        imgaug.Polygon\n            Copy of this polygon with the new point order.\n\n        \"\"\"\n        if len(arg_0.exterior) == 0:\n            raise Exception(\"Cannot reorder polygon points, because it contains no points.\")\n\n        arg_5, arg_6 = arg_0.find_closest_point_index(arg_1=arg_1, arg_2=arg_2, return_distance=True)\n        if arg_3 is not None and arg_6 > arg_3:\n            if not arg_4:\n                return arg_0.deepcopy()\n\n            arg_7 = arg_0.exterior[arg_5, :]\n            raise Exception(\n                \"Closest found point (%.9f, %.9f) exceeds max_distance of %.9f exceeded\" % (\n                    arg_7[0], arg_7[1], arg_6)\n            )\n        return arg_0.change_first_point_by_index(arg_5)", "path": "imgaug/augmentables/polys.py", "identifier": "Polygon.change_first_point_by_coords", "docstring": "Set the first point of the exterior to the given point based on its coordinates.\n\n        If multiple points are found, the closest one will be picked.\n        If no matching points are found, an exception is raised.\n\n        Note: This method does *not* work in-place.\n\n        Parameters\n        ----------\n        x : number\n            X-coordinate of the point.\n\n        y : number\n            Y-coordinate of the point.\n\n        max_distance : None or number, optional\n            Maximum distance past which possible matches are ignored.\n            If ``None`` the distance limit is deactivated.\n\n        raise_if_too_far_away : bool, optional\n            Whether to raise an exception if the closest found point is too\n            far away (``True``) or simply return an unchanged copy if this\n            object (``False``).\n\n        Returns\n        -------\n        imgaug.Polygon\n            Copy of this polygon with the new point order.", "docstring_tokens": ["Set", "the", "first", "point", "of", "the", "exterior", "to", "the", "given", "point", "based", "on", "its", "coordinates", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254487}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/legecy_translators/jsparser.py#L201-L222", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "passes white space from start and returns first identifier,\n       if identifier invalid and throw raises SyntaxError otherwise returns None", "language": "python", "parameters": "(source, start, throw=True)", "return_statement": "return source[start:end], end", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_1", "=", "pass_white", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "arg_1", "if", "not", "arg_3", "<", "len", "(", "arg_0", ")", ":", "if", "arg_2", ":", "raise", "SyntaxError", "(", "'Missing identifier!'", ")", "return", "None", "if", "arg_0", "[", "arg_3", "]", "not", "in", "IDENTIFIER_START", ":", "if", "arg_2", ":", "raise", "SyntaxError", "(", "'Invalid identifier start: \"%s\"'", "%", "arg_0", "[", "arg_3", "]", ")", "return", "None", "arg_3", "+=", "1", "while", "arg_3", "<", "len", "(", "arg_0", ")", "and", "arg_0", "[", "arg_3", "]", "in", "IDENTIFIER_PART", ":", "arg_3", "+=", "1", "if", "not", "is_valid_lval", "(", "arg_0", "[", "arg_1", ":", "arg_3", "]", ")", ":", "if", "arg_2", ":", "raise", "SyntaxError", "(", "'Invalid identifier name: \"%s\"'", "%", "arg_0", "[", "arg_1", ":", "arg_3", "]", ")", "return", "None", "return", "arg_0", "[", "arg_1", ":", "arg_3", "]", ",", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"passes white space from start and returns first identifier,\n       if identifier invalid and throw raises SyntaxError otherwise returns None\"\"\"\n    arg_1 = pass_white(arg_0, arg_1)\n    arg_3 = arg_1\n    if not arg_3 < len(arg_0):\n        if arg_2:\n            raise SyntaxError('Missing identifier!')\n        return None\n    if arg_0[arg_3] not in IDENTIFIER_START:\n        if arg_2:\n            raise SyntaxError('Invalid identifier start: \"%s\"' % arg_0[arg_3])\n        return None\n    arg_3 += 1\n    while arg_3 < len(arg_0) and arg_0[arg_3] in IDENTIFIER_PART:\n        arg_3 += 1\n    if not is_valid_lval(arg_0[arg_1:arg_3]):\n        if arg_2:\n            raise SyntaxError(\n                'Invalid identifier name: \"%s\"' % arg_0[arg_1:arg_3])\n        return None\n    return arg_0[arg_1:arg_3], arg_3", "path": "js2py/legecy_translators/jsparser.py", "identifier": "parse_identifier", "docstring": "passes white space from start and returns first identifier,\n       if identifier invalid and throw raises SyntaxError otherwise returns None", "docstring_tokens": ["passes", "white", "space", "from", "start", "and", "returns", "first", "identifier", "if", "identifier", "invalid", "and", "throw", "raises", "SyntaxError", "otherwise", "returns", "None"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 254488}
{"url": "https://github.com/Loudr/asana-hub/blob/af996ce890ed23d8ede5bf68dcd318e3438829cb/asana_hub/tool.py#L215-L237", "sha": "af996ce890ed23d8ede5bf68dcd318e3438829cb", "docstring_summary": "Moves an issue_data from one namespace to another.", "language": "python", "parameters": "(self, issue, ns, other_ns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "arg_4", "=", "str", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_4", "=", "arg_1", "else", ":", "arg_4", "=", "arg_1", ".", "number", "arg_5", "=", "arg_0", ".", "_issue_data_key", "(", "arg_2", ")", "arg_6", "=", "arg_0", ".", "_issue_data_key", "(", "arg_3", ")", "arg_7", "=", "arg_0", ".", "data", ".", "get", "(", "arg_5", ",", "{", "}", ")", "arg_8", "=", "arg_0", ".", "data", ".", "get", "(", "arg_6", ",", "{", "}", ")", "arg_9", "=", "arg_7", ".", "pop", "(", "arg_4", ",", "None", ")", "if", "arg_9", ":", "arg_8", "[", "arg_4", "]", "=", "arg_9", "arg_0", ".", "data", "[", "arg_6", "]", "=", "arg_8", "arg_0", ".", "data", "[", "arg_5", "]", "=", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Moves an issue_data from one namespace to another.\"\"\"\n\n        if isinstance(arg_1, int):\n            arg_4 = str(arg_1)\n        elif isinstance(arg_1, basestring):\n            arg_4 = arg_1\n        else:\n            arg_4 = arg_1.number\n\n        arg_5 = arg_0._issue_data_key(arg_2)\n        arg_6 = arg_0._issue_data_key(arg_3)\n        arg_7 = arg_0.data.get(arg_5,\n            {})\n        arg_8 = arg_0.data.get(arg_6,\n            {})\n\n        arg_9 = arg_7.pop(arg_4, None)\n        if arg_9:\n            arg_8[arg_4] = arg_9\n\n        arg_0.data[arg_6] = arg_8\n        arg_0.data[arg_5] = arg_7", "path": "asana_hub/tool.py", "identifier": "ToolApp.move_saved_issue_data", "docstring": "Moves an issue_data from one namespace to another.", "docstring_tokens": ["Moves", "an", "issue_data", "from", "one", "namespace", "to", "another", "."], "nwo": "Loudr/asana-hub", "score": 0.27692002097430746, "idx": 254489}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_viral_assembly.py#L176-L242", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Parse an assembly fasta file.", "language": "python", "parameters": "(self, assembly_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "0", "arg_4", ",", "arg_5", "=", "None", ",", "None", "with", "open", "(", "arg_1", ")", "as", "fh", ":", "logger", ".", "debug", "(", "\"Starting iteration of assembly file: {}\"", ".", "format", "(", "arg_1", ")", ")", "for", "arg_6", "in", "fh", ":", "if", "not", "arg_6", ".", "strip", "(", ")", ":", "continue", "else", ":", "arg_6", "=", "arg_6", ".", "strip", "(", ")", "if", "arg_6", ".", "startswith", "(", "\">\"", ")", ":", "if", "arg_2", ":", "arg_7", "=", "\"\"", ".", "join", "(", "arg_2", ")", "logger", ".", "debug", "(", "\"Populating contig with contig_id '{}', \"", "\"header '{}' and cov '{}'\"", ".", "format", "(", "arg_3", ",", "arg_5", ",", "arg_4", ")", ")", "arg_0", ".", "_populate_contigs", "(", "arg_3", ",", "arg_5", ",", "arg_4", ",", "arg_7", ")", "arg_2", "=", "[", "]", "arg_3", "+=", "1", "arg_5", "=", "arg_6", "[", "1", ":", "]", "arg_4", "=", "arg_0", ".", "_parse_coverage", "(", "arg_6", ")", "else", ":", "arg_2", ".", "append", "(", "arg_6", ")", "logger", ".", "debug", "(", "\"Populating contig with contig_id '{}', \"", "\"header '{}' and cov '{}'\"", ".", "format", "(", "arg_3", ",", "arg_5", ",", "arg_4", ")", ")", "arg_7", "=", "\"\"", ".", "join", "(", "arg_2", ")", "arg_0", ".", "_populate_contigs", "(", "arg_3", ",", "arg_5", ",", "arg_4", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parse an assembly fasta file.\n\n        This is a Fasta parsing method that populates the\n        :py:attr:`~Assembly.contigs` attribute with data for each contig in the\n        assembly.\n\n        The insertion of data on the self.contigs is done by the\n        :py:meth:`Assembly._populate_contigs` method, which also calculates\n        GC content and proportions.\n\n        Parameters\n        ----------\n        assembly_file : str\n            Path to the assembly fasta file.\n\n        \"\"\"\n\n        # Temporary storage of sequence data\n        arg_2 = []\n        # Id counter for contig that will serve as key in self.contigs\n        arg_3 = 0\n        # Initialize kmer coverage and header\n        arg_4, arg_5 = None, None\n\n        with open(arg_1) as fh:\n\n            logger.debug(\"Starting iteration of assembly file: {}\".format(\n                arg_1))\n            for arg_6 in fh:\n                # Skip empty lines\n                if not arg_6.strip():\n                    continue\n                else:\n                    # Remove whitespace surrounding line for further processing\n                    arg_6 = arg_6.strip()\n\n                if arg_6.startswith(\">\"):\n                    # If a sequence has already been populated, save the\n                    # previous contig information\n                    if arg_2:\n                        # Use join() to convert string list into the full\n                        # contig string. This is generally much more efficient\n                        # than successively concatenating strings.\n                        arg_7 = \"\".join(arg_2)\n\n                        logger.debug(\"Populating contig with contig_id '{}', \"\n                                     \"header '{}' and cov '{}'\".format(\n                                        arg_3, arg_5, arg_4))\n                        arg_0._populate_contigs(arg_3, arg_5, arg_4, arg_7)\n\n                        # Reset temporary sequence storage\n                        arg_2 = []\n                        arg_3 += 1\n\n                    arg_5 = arg_6[1:]\n                    arg_4 = arg_0._parse_coverage(arg_6)\n\n                else:\n                    arg_2.append(arg_6)\n\n            # Populate last contig entry\n            logger.debug(\"Populating contig with contig_id '{}', \"\n                         \"header '{}' and cov '{}'\".format(\n                            arg_3, arg_5, arg_4))\n            arg_7 = \"\".join(arg_2)\n            arg_0._populate_contigs(arg_3, arg_5, arg_4, arg_7)", "path": "flowcraft/templates/process_viral_assembly.py", "identifier": "Assembly._parse_assembly", "docstring": "Parse an assembly fasta file.\n\n        This is a Fasta parsing method that populates the\n        :py:attr:`~Assembly.contigs` attribute with data for each contig in the\n        assembly.\n\n        The insertion of data on the self.contigs is done by the\n        :py:meth:`Assembly._populate_contigs` method, which also calculates\n        GC content and proportions.\n\n        Parameters\n        ----------\n        assembly_file : str\n            Path to the assembly fasta file.", "docstring_tokens": ["Parse", "an", "assembly", "fasta", "file", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 254490}
{"url": "https://github.com/tell-k/goolabs/blob/3b87d0409e55c71290158ad6d5e2d8bb9a338c46/goolabs/commands.py#L305-L325", "sha": "3b87d0409e55c71290158ad6d5e2d8bb9a338c46", "docstring_summary": "Extract expression expressing date and time and normalize its value", "language": "python", "parameters": "(ctx, app_id, sentence_file,\n           json_flag, sentence, doc_time, request_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_1", "=", "clean_app_id", "(", "arg_1", ")", "arg_4", "=", "clean_sentence", "(", "arg_4", ",", "arg_2", ")", "arg_7", "=", "GoolabsAPI", "(", "arg_1", ")", "arg_8", "=", "arg_7", ".", "Func", "(", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", ")", "if", "arg_3", ":", "click", ".", "echo", "(", "format_json", "(", "arg_7", ".", "response", ".", "json", "(", ")", ")", ")", "return", "for", "arg_9", "in", "arg_8", "[", "'datetime_list'", "]", ":", "click", ".", "echo", "(", "u'{0}: {1}'", ".", "format", "(", "text", "(", "arg_9", "[", "0", "]", ")", ",", "arg_9", "[", "1", "]", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n           arg_3, arg_4, arg_5, arg_6):\n    # type: (Context, unicode, Optional[IO], bool, unicode, unicode, unicode) -> None  # NOQA\n    \"\"\"Extract expression expressing date and time and normalize its value \"\"\"\n\n    arg_1 = clean_app_id(arg_1)\n    arg_4 = clean_sentence(arg_4, arg_2)\n\n    arg_7 = GoolabsAPI(arg_1)\n    arg_8 = arg_7.Func(\n        arg_4=arg_4,\n        arg_5=arg_5,\n        arg_6=arg_6,\n    )\n\n    if arg_3:\n        click.echo(format_json(arg_7.response.json()))\n        return\n\n    for arg_9 in arg_8['datetime_list']:\n        click.echo(u'{0}: {1}'.format(text(arg_9[0]), arg_9[1]))", "path": "goolabs/commands.py", "identifier": "chrono", "docstring": "Extract expression expressing date and time and normalize its value", "docstring_tokens": ["Extract", "expression", "expressing", "date", "and", "time", "and", "normalize", "its", "value"], "nwo": "tell-k/goolabs", "score": 0.16638194949711382, "idx": 254491}
{"url": "https://github.com/cyberdelia/metrology/blob/7599bea7de1fd59374c06e2f8041a217e3cf9c01/metrology/reporter/statsd.py#L170-L176", "sha": "7599bea7de1fd59374c06e2f8041a217e3cf9c01", "docstring_summary": "Serialize and send available measures of a metric.", "language": "python", "parameters": "(self, metric, m_name, keys, m_type)", "return_statement": "return [\n            self.format_metric_string(m_name, getattr(metric, key), m_type)\n            for key in keys\n        ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "return", "[", "arg_0", ".", "format_metric_string", "(", "arg_2", ",", "getattr", "(", "arg_1", ",", "arg_5", ")", ",", "arg_4", ")", "for", "arg_5", "in", "arg_3", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Serialize and send available measures of a metric.\"\"\"\n\n        return [\n            arg_0.format_metric_string(arg_2, getattr(arg_1, arg_5), arg_4)\n            for arg_5 in arg_3\n        ]", "path": "metrology/reporter/statsd.py", "identifier": "StatsDReporter.serialize_metric", "docstring": "Serialize and send available measures of a metric.", "docstring_tokens": ["Serialize", "and", "send", "available", "measures", "of", "a", "metric", "."], "nwo": "cyberdelia/metrology", "score": 0.49807038967310463, "idx": 254492}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L674-L687", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns the DagRun for this TaskInstance", "language": "python", "parameters": "(self, session)", "return_statement": "return dr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "airflow", ".", "models", ".", "dagrun", "import", "DagRun", "arg_2", "=", "arg_1", ".", "query", "(", "DagRun", ")", ".", "filter", "(", "DagRun", ".", "dag_id", "==", "arg_0", ".", "dag_id", ",", "DagRun", ".", "execution_date", "==", "arg_0", ".", "execution_date", ")", ".", "first", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns the DagRun for this TaskInstance\n\n        :param session:\n        :return: DagRun\n        \"\"\"\n        from airflow.models.dagrun import DagRun  # Avoid circular import\n        arg_2 = arg_1.query(DagRun).filter(\n            DagRun.dag_id == arg_0.dag_id,\n            DagRun.execution_date == arg_0.execution_date\n        ).first()\n\n        return arg_2", "path": "airflow/models/taskinstance.py", "identifier": "TaskInstance.get_dagrun", "docstring": "Returns the DagRun for this TaskInstance\n\n        :param session:\n        :return: DagRun", "docstring_tokens": ["Returns", "the", "DagRun", "for", "this", "TaskInstance"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254493}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/capacity.py#L45-L97", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Compute the number of days that would have been required\n    to fully liquidate each position on each day based on the\n    trailing n day mean daily bar volume and a limit on the proportion\n    of a daily bar that we are allowed to consume.", "language": "python", "parameters": "(positions, market_data,\n                                max_bar_consumption=0.2,\n                                capital_base=1e6,\n                                mean_volume_window=5)", "return_statement": "return days_to_liquidate.iloc[mean_volume_window:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.2", ",", "arg_3", "=", "1e6", ",", "arg_4", "=", "5", ")", ":", "arg_5", "=", "arg_1", "[", "'volume'", "]", "*", "arg_1", "[", "'price'", "]", "arg_6", "=", "arg_5", ".", "rolling", "(", "window", "=", "arg_4", ",", "center", "=", "False", ")", ".", "mean", "(", ")", ".", "shift", "(", ")", "arg_6", "=", "arg_6", ".", "replace", "(", "0", ",", "np", ".", "nan", ")", "arg_7", "=", "pos", ".", "get_percent_alloc", "(", "arg_0", ")", "arg_7", "=", "arg_7", ".", "drop", "(", "'cash'", ",", "axis", "=", "1", ")", "arg_8", "=", "(", "arg_7", "*", "arg_3", ")", "/", "(", "arg_2", "*", "arg_6", ")", "return", "arg_8", ".", "iloc", "[", "arg_4", ":", "]"], "function": "def Func(arg_0, arg_1,\n                                arg_2=0.2,\n                                arg_3=1e6,\n                                arg_4=5):\n    \"\"\"\n    Compute the number of days that would have been required\n    to fully liquidate each position on each day based on the\n    trailing n day mean daily bar volume and a limit on the proportion\n    of a daily bar that we are allowed to consume.\n\n    This analysis uses portfolio allocations and a provided capital base\n    rather than the dollar values in the positions DataFrame to remove the\n    effect of compounding on days to liquidate. In other words, this function\n    assumes that the net liquidation portfolio value will always remain\n    constant at capital_base.\n\n    Parameters\n    ----------\n    positions: pd.DataFrame\n        Contains daily position values including cash\n        - See full explanation in tears.create_full_tear_sheet\n    market_data : pd.Panel\n        Panel with items axis of 'price' and 'volume' DataFrames.\n        The major and minor axes should match those of the\n        the passed positions DataFrame (same dates and symbols).\n    max_bar_consumption : float\n        Max proportion of a daily bar that can be consumed in the\n        process of liquidating a position.\n    capital_base : integer\n        Capital base multiplied by portfolio allocation to compute\n        position value that needs liquidating.\n    mean_volume_window : float\n        Trailing window to use in mean volume calculation.\n\n    Returns\n    -------\n    days_to_liquidate : pd.DataFrame\n        Number of days required to fully liquidate daily positions.\n        Datetime index, symbols as columns.\n    \"\"\"\n\n    arg_5 = arg_1['volume'] * arg_1['price']\n    arg_6 = arg_5.rolling(window=arg_4,\n                              center=False).mean().shift()\n    arg_6 = arg_6.replace(0, np.nan)\n\n    arg_7 = pos.get_percent_alloc(arg_0)\n    arg_7 = arg_7.drop('cash', axis=1)\n\n    arg_8 = (arg_7 * arg_3) / \\\n        (arg_2 * arg_6)\n\n    return arg_8.iloc[arg_4:]", "path": "pyfolio/capacity.py", "identifier": "days_to_liquidate_positions", "docstring": "Compute the number of days that would have been required\n    to fully liquidate each position on each day based on the\n    trailing n day mean daily bar volume and a limit on the proportion\n    of a daily bar that we are allowed to consume.\n\n    This analysis uses portfolio allocations and a provided capital base\n    rather than the dollar values in the positions DataFrame to remove the\n    effect of compounding on days to liquidate. In other words, this function\n    assumes that the net liquidation portfolio value will always remain\n    constant at capital_base.\n\n    Parameters\n    ----------\n    positions: pd.DataFrame\n        Contains daily position values including cash\n        - See full explanation in tears.create_full_tear_sheet\n    market_data : pd.Panel\n        Panel with items axis of 'price' and 'volume' DataFrames.\n        The major and minor axes should match those of the\n        the passed positions DataFrame (same dates and symbols).\n    max_bar_consumption : float\n        Max proportion of a daily bar that can be consumed in the\n        process of liquidating a position.\n    capital_base : integer\n        Capital base multiplied by portfolio allocation to compute\n        position value that needs liquidating.\n    mean_volume_window : float\n        Trailing window to use in mean volume calculation.\n\n    Returns\n    -------\n    days_to_liquidate : pd.DataFrame\n        Number of days required to fully liquidate daily positions.\n        Datetime index, symbols as columns.", "docstring_tokens": ["Compute", "the", "number", "of", "days", "that", "would", "have", "been", "required", "to", "fully", "liquidate", "each", "position", "on", "each", "day", "based", "on", "the", "trailing", "n", "day", "mean", "daily", "bar", "volume", "and", "a", "limit", "on", "the", "proportion", "of", "a", "daily", "bar", "that", "we", "are", "allowed", "to", "consume", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 254494}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py#L176-L189", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Return the dict of a StoreItem.", "language": "python", "parameters": "(self, si: StoreItem)", "return_statement": "return ({attr: getattr(si, attr)\n                for attr in non_magic_attr})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Dict", ":", "arg_3", "=", "(", "[", "arg_4", "for", "arg_4", "in", "dir", "(", "arg_1", ")", "if", "not", "arg_4", ".", "startswith", "(", "'_'", ")", "or", "arg_4", ".", "__eq__", "(", "'e_tag'", ")", "]", ")", "return", "(", "{", "arg_4", ":", "getattr", "(", "arg_1", ",", "arg_4", ")", "for", "arg_4", "in", "arg_3", "}", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> Dict:\n        \"\"\"Return the dict of a StoreItem.\n\n        This eliminates non_magic attributes and the e_tag.\n\n        :param si:\n        :return dict:\n        \"\"\"\n        # read the content\n        arg_3 = ([arg_4 for arg_4 in dir(arg_1)\n                          if not arg_4.startswith('_') or arg_4.__eq__('e_tag')])\n        # loop through attributes and write and return a dict\n        return ({arg_4: getattr(arg_1, arg_4)\n                for arg_4 in arg_3})", "path": "libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py", "identifier": "CosmosDbStorage.__create_dict", "docstring": "Return the dict of a StoreItem.\n\n        This eliminates non_magic attributes and the e_tag.\n\n        :param si:\n        :return dict:", "docstring_tokens": ["Return", "the", "dict", "of", "a", "StoreItem", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 254495}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/manipulation/delete.py#L207-L237", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "remove genes entirely from the model", "language": "python", "parameters": "(cobra_model, gene_list, remove_reactions=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "{", "arg_0", ".", "genes", ".", "get_by_id", "(", "str", "(", "i", ")", ")", "for", "i", "in", "arg_1", "}", "arg_4", "=", "{", "i", ".", "id", "for", "i", "in", "arg_3", "}", "arg_5", "=", "_GeneRemover", "(", "arg_4", ")", "arg_6", "=", "get_compiled_gene_reaction_rules", "(", "arg_0", ")", "arg_7", "=", "[", "]", "for", "arg_8", ",", "arg_9", "in", "iteritems", "(", "arg_6", ")", ":", "if", "arg_8", ".", "gene_reaction_rule", "is", "None", "or", "len", "(", "arg_8", ".", "gene_reaction_rule", ")", "==", "0", ":", "continue", "if", "arg_2", "and", "not", "eval_gpr", "(", "arg_9", ",", "arg_4", ")", ":", "arg_7", ".", "append", "(", "arg_8", ")", "else", ":", "arg_5", ".", "visit", "(", "arg_9", ")", "arg_10", "=", "ast2str", "(", "arg_9", ")", "if", "arg_10", "!=", "arg_8", ".", "gene_reaction_rule", ":", "arg_8", ".", "gene_reaction_rule", "=", "arg_10", "for", "arg_12", "in", "arg_3", ":", "arg_0", ".", "genes", ".", "remove", "(", "arg_12", ")", "arg_13", "=", "arg_0", ".", "get_associated_groups", "(", "arg_12", ")", "for", "arg_14", "in", "arg_13", ":", "arg_14", ".", "remove_members", "(", "arg_12", ")", "arg_0", ".", "remove_reactions", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"remove genes entirely from the model\n\n    This will also simplify all gene_reaction_rules with this\n    gene inactivated.\"\"\"\n    arg_3 = {arg_0.genes.get_by_id(str(i)) for i in arg_1}\n    arg_4 = {i.id for i in arg_3}\n    arg_5 = _GeneRemover(arg_4)\n    arg_6 = get_compiled_gene_reaction_rules(arg_0)\n    arg_7 = []\n    for arg_8, arg_9 in iteritems(arg_6):\n        if arg_8.gene_reaction_rule is None or \\\n                len(arg_8.gene_reaction_rule) == 0:\n            continue\n        # reactions to remove\n        if arg_2 and not eval_gpr(arg_9, arg_4):\n            arg_7.append(arg_8)\n        else:\n            # if the reaction is not removed, remove the gene\n            # from its gpr\n            arg_5.visit(arg_9)\n            arg_10 = ast2str(arg_9)\n            if arg_10 != arg_8.gene_reaction_rule:\n                arg_8.gene_reaction_rule = arg_10\n    for arg_12 in arg_3:\n        arg_0.genes.remove(arg_12)\n        # remove reference to the gene in all groups\n        arg_13 = arg_0.get_associated_groups(arg_12)\n        for arg_14 in arg_13:\n            arg_14.remove_members(arg_12)\n    arg_0.remove_reactions(arg_7)", "path": "cobra/manipulation/delete.py", "identifier": "remove_genes", "docstring": "remove genes entirely from the model\n\n    This will also simplify all gene_reaction_rules with this\n    gene inactivated.", "docstring_tokens": ["remove", "genes", "entirely", "from", "the", "model"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 254496}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/console/interactiveshell.py#L136-L172", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Method to procces subscribe channel's messages", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "arg_0", ".", "km", ".", "sub_channel", ".", "msg_ready", "(", ")", ":", "arg_1", "=", "arg_0", ".", "km", ".", "sub_channel", ".", "get_msg", "(", ")", "arg_2", "=", "arg_1", "[", "'header'", "]", "[", "'msg_type'", "]", "arg_3", "=", "arg_1", "[", "\"parent_header\"", "]", "if", "(", "not", "arg_3", ")", "or", "arg_0", ".", "session_id", "==", "arg_3", "[", "'session'", "]", ":", "if", "arg_2", "==", "'status'", ":", "if", "arg_1", "[", "\"content\"", "]", "[", "\"execution_state\"", "]", "==", "\"busy\"", ":", "pass", "elif", "arg_2", "==", "'stream'", ":", "if", "arg_1", "[", "\"content\"", "]", "[", "\"name\"", "]", "==", "\"stdout\"", ":", "print", "(", "arg_1", "[", "\"content\"", "]", "[", "\"data\"", "]", ",", "file", "=", "io", ".", "stdout", ",", "end", "=", "\"\"", ")", "io", ".", "stdout", ".", "flush", "(", ")", "elif", "arg_1", "[", "\"content\"", "]", "[", "\"name\"", "]", "==", "\"stderr\"", ":", "print", "(", "arg_1", "[", "\"content\"", "]", "[", "\"data\"", "]", ",", "file", "=", "io", ".", "stderr", ",", "end", "=", "\"\"", ")", "io", ".", "stderr", ".", "flush", "(", ")", "elif", "arg_2", "==", "'pyout'", ":", "arg_0", ".", "execution_count", "=", "int", "(", "arg_1", "[", "\"content\"", "]", "[", "\"execution_count\"", "]", ")", "arg_5", "=", "arg_1", "[", "\"content\"", "]", "[", "\"data\"", "]", "arg_6", "=", "arg_0", ".", "displayhook", "arg_6", ".", "start_displayhook", "(", ")", "arg_6", ".", "write_output_prompt", "(", ")", "arg_6", ".", "write_format_data", "(", "arg_5", ")", "arg_6", ".", "log_output", "(", "arg_5", ")", "arg_6", ".", "finish_displayhook", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Method to procces subscribe channel's messages\n\n           This method reads a message and processes the content in different\n           outputs like stdout, stderr, pyout and status\n\n           Arguments:\n           sub_msg:  message receive from kernel in the sub socket channel\n                     capture by kernel manager.\n        \"\"\"\n        while arg_0.km.sub_channel.msg_ready():\n            arg_1 = arg_0.km.sub_channel.get_msg()\n            arg_2 = arg_1['header']['msg_type']\n            arg_3 = arg_1[\"parent_header\"]\n            if (not arg_3) or arg_0.session_id == arg_3['session']:\n                if arg_2 == 'status' :\n                    if arg_1[\"content\"][\"execution_state\"] == \"busy\" :\n                        pass\n\n                elif arg_2 == 'stream' :\n                    if arg_1[\"content\"][\"name\"] == \"stdout\":\n                        print(arg_1[\"content\"][\"data\"], file=io.stdout, end=\"\")\n                        io.stdout.flush()\n                    elif arg_1[\"content\"][\"name\"] == \"stderr\" :\n                        print(arg_1[\"content\"][\"data\"], file=io.stderr, end=\"\")\n                        io.stderr.flush()\n\n                elif arg_2 == 'pyout':\n                    arg_0.execution_count = int(arg_1[\"content\"][\"execution_count\"])\n                    arg_5 = arg_1[\"content\"][\"data\"]\n                    # taken from DisplayHook.__call__:\n                    arg_6 = arg_0.displayhook\n                    arg_6.start_displayhook()\n                    arg_6.write_output_prompt()\n                    arg_6.write_format_data(arg_5)\n                    arg_6.log_output(arg_5)\n                    arg_6.finish_displayhook()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/terminal/console/interactiveshell.py", "identifier": "ZMQTerminalInteractiveShell.handle_iopub", "docstring": "Method to procces subscribe channel's messages\n\n           This method reads a message and processes the content in different\n           outputs like stdout, stderr, pyout and status\n\n           Arguments:\n           sub_msg:  message receive from kernel in the sub socket channel\n                     capture by kernel manager.", "docstring_tokens": ["Method", "to", "procces", "subscribe", "channel", "s", "messages"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254497}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/boxscores.py#L239-L255", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Gets information relating to the opening coin toss.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_doc", "(", ")", "arg_2", "=", "arg_1", "(", "'table#game_info'", ")", "arg_3", "=", "sportsref", ".", "utils", ".", "parse_info_table", "(", "arg_2", ")", "if", "'Won Toss'", "in", "arg_3", ":", "pass", "else", ":", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"Gets information relating to the opening coin toss.\n\n        Keys are:\n        * wonToss - contains the ID of the team that won the toss\n        * deferred - bool whether the team that won the toss deferred it\n\n        :returns: Dictionary of coin toss-related info.\n        \"\"\"\n        arg_1 = arg_0.get_doc()\n        arg_2 = arg_1('table#game_info')\n        arg_3 = sportsref.utils.parse_info_table(arg_2)\n        if 'Won Toss' in arg_3:\n            # TODO: finish coinToss function\n            pass\n        else:\n            return None", "path": "sportsref/nfl/boxscores.py", "identifier": "BoxScore.coin_toss", "docstring": "Gets information relating to the opening coin toss.\n\n        Keys are:\n        * wonToss - contains the ID of the team that won the toss\n        * deferred - bool whether the team that won the toss deferred it\n\n        :returns: Dictionary of coin toss-related info.", "docstring_tokens": ["Gets", "information", "relating", "to", "the", "opening", "coin", "toss", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 254498}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L514-L520", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Copy the currently selected text to the clipboard and delete it\n            if it's inside the input buffer.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "copy", "(", ")", "if", "arg_0", ".", "can_Func", "(", ")", ":", "arg_0", ".", "_control", ".", "textCursor", "(", ")", ".", "removeSelectedText", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Copy the currently selected text to the clipboard and delete it\n            if it's inside the input buffer.\n        \"\"\"\n        arg_0.copy()\n        if arg_0.can_Func():\n            arg_0._control.textCursor().removeSelectedText()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget.cut", "docstring": "Copy the currently selected text to the clipboard and delete it\n            if it's inside the input buffer.", "docstring_tokens": ["Copy", "the", "currently", "selected", "text", "to", "the", "clipboard", "and", "delete", "it", "if", "it", "s", "inside", "the", "input", "buffer", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254499}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1214-L1237", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "inserts indels into the catg array", "language": "python", "parameters": "(indels, ocatg)", "return_statement": "return newcatg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "zeros", "(", "arg_1", ".", "shape", ",", "dtype", "=", "np", ".", "uint32", ")", "for", "arg_3", "in", "xrange", "(", "arg_1", ".", "shape", "[", "0", "]", ")", ":", "arg_4", "=", "np", ".", "where", "(", "arg_0", "[", "arg_3", ",", ":", "]", ")", "[", "0", "]", "if", "np", ".", "any", "(", "arg_4", ")", ":", "arg_5", "=", "np", ".", "arange", "(", "arg_1", ".", "shape", "[", "1", "]", ")", "arg_6", "=", "np", ".", "ones", "(", "arg_5", ".", "shape", "[", "0", "]", ",", "dtype", "=", "np", ".", "bool_", ")", "for", "arg_7", "in", "arg_4", ":", "arg_6", "[", "arg_7", "]", "=", "False", "arg_8", "=", "arg_5", "[", "arg_6", "==", "1", "]", "arg_2", "[", "arg_3", "]", "[", "arg_8", "]", "=", "arg_1", "[", "arg_3", ",", ":", "arg_8", ".", "shape", "[", "0", "]", "]", "else", ":", "arg_2", "[", "arg_3", "]", "=", "arg_1", "[", "arg_3", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    inserts indels into the catg array\n    \"\"\"\n    ## return copy with indels inserted\n    arg_2 = np.zeros(arg_1.shape, dtype=np.uint32)\n\n    ## iterate over loci and make extensions for indels\n    for arg_3 in xrange(arg_1.shape[0]):\n        ## get indels indices\n        arg_4 = np.where(arg_0[arg_3, :])[0]\n        if np.any(arg_4):\n            ## which new (empty) rows will be added\n            arg_5 = np.arange(arg_1.shape[1])\n            arg_6 = np.ones(arg_5.shape[0], dtype=np.bool_)\n            for arg_7 in arg_4:\n                arg_6[arg_7] = False\n            arg_8 = arg_5[arg_6 == 1]\n\n            ## fill in new data into all other spots\n            arg_2[arg_3][arg_8] = arg_1[arg_3, :arg_8.shape[0]]\n        else:\n            arg_2[arg_3] = arg_1[arg_3]\n    return arg_2", "path": "ipyrad/assemble/cluster_across.py", "identifier": "inserted_indels", "docstring": "inserts indels into the catg array", "docstring_tokens": ["inserts", "indels", "into", "the", "catg", "array"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 254500}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L385-L410", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return the list of HGNC symbols that match annotated HPO terms.", "language": "python", "parameters": "(username, password, hpo_ids, p_value_treshold=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "try", ":", "arg_4", "=", "query_phenomizer", ".", "query", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", "arg_5", "=", "[", "result", "for", "result", "in", "arg_4", "if", "result", "[", "'p_value'", "]", "<=", "arg_3", "]", "return", "arg_5", "except", "SystemExit", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n    \"\"\"Return the list of HGNC symbols that match annotated HPO terms.\n\n    Args:\n        username (str): username to use for phenomizer connection\n        password (str): password to use for phenomizer connection\n\n    Returns:\n        query_result: a generator of dictionaries on the form\n        {\n            'p_value': float,\n            'disease_source': str,\n            'disease_nr': int,\n            'gene_symbols': list(str),\n            'description': str,\n            'raw_line': str\n        }\n    \"\"\"\n    # skip querying Phenomizer unless at least one HPO terms exists\n    try:\n        arg_4 = query_phenomizer.query(arg_0, arg_1, *arg_2)\n        arg_5 = [result for result in arg_4\n                    if result['p_value'] <= arg_3]\n        return arg_5\n    except SystemExit:\n        return None", "path": "scout/server/blueprints/cases/controllers.py", "identifier": "hpo_diseases", "docstring": "Return the list of HGNC symbols that match annotated HPO terms.\n\n    Args:\n        username (str): username to use for phenomizer connection\n        password (str): password to use for phenomizer connection\n\n    Returns:\n        query_result: a generator of dictionaries on the form\n        {\n            'p_value': float,\n            'disease_source': str,\n            'disease_nr': int,\n            'gene_symbols': list(str),\n            'description': str,\n            'raw_line': str\n        }", "docstring_tokens": ["Return", "the", "list", "of", "HGNC", "symbols", "that", "match", "annotated", "HPO", "terms", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254501}
{"url": "https://github.com/georgemarshall/django-cryptography/blob/4c5f60fec98bcf71495d6084f801ea9c01c9a725/django_cryptography/core/signing.py#L36-L70", "sha": "4c5f60fec98bcf71495d6084f801ea9c01c9a725", "docstring_summary": "Returns URL-safe, sha1 signed base64 compressed JSON string. If key is\n    None, settings.SECRET_KEY is used instead.", "language": "python", "parameters": "(obj,\n          key=None,\n          salt='django.core.signing',\n          serializer=JSONSerializer,\n          compress=False)", "return_statement": "return TimestampSigner(key, salt=salt).sign(base64d)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'django.core.signing'", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "arg_3", "(", ")", ".", "Func", "(", "arg_0", ")", "arg_7", "=", "False", "if", "arg_5", ":", "arg_8", "=", "zlib", ".", "compress", "(", "arg_6", ")", "if", "len", "(", "arg_8", ")", "<", "(", "len", "(", "arg_6", ")", "-", "1", ")", ":", "arg_6", "=", "arg_8", "arg_7", "=", "True", "arg_9", "=", "b64_encode", "(", "arg_6", ")", "if", "arg_7", ":", "arg_9", "=", "b'.'", "+", "arg_9", "return", "TimestampSigner", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", ".", "sign", "(", "arg_9", ")"], "function": "def Func(arg_0,\n          arg_1=None,\n          arg_2='django.core.signing',\n          arg_3=arg_4,\n          arg_5=False):\n    \"\"\"\n    Returns URL-safe, sha1 signed base64 compressed JSON string. If key is\n    None, settings.SECRET_KEY is used instead.\n\n    If compress is True (not the default) checks if compressing using zlib can\n    save some space. Prepends a '.' to signify compression. This is included\n    in the signature, to protect against zip bombs.\n\n    Salt can be used to namespace the hash, so that a signed string is\n    only valid for a given namespace. Leaving this at the default\n    value or re-using a salt value across different parts of your\n    application without good cause is a security risk.\n\n    The serializer is expected to return a bytestring.\n    \"\"\"\n    arg_6 = arg_3().Func(arg_0)\n\n    # Flag for if it's been compressed or not\n    arg_7 = False\n\n    if arg_5:\n        # Avoid zlib dependency unless compress is being used\n        arg_8 = zlib.compress(arg_6)\n        if len(arg_8) < (len(arg_6) - 1):\n            arg_6 = arg_8\n            arg_7 = True\n    arg_9 = b64_encode(arg_6)\n    if arg_7:\n        arg_9 = b'.' + arg_9\n    return TimestampSigner(arg_1, arg_2=arg_2).sign(arg_9)", "path": "django_cryptography/core/signing.py", "identifier": "dumps", "docstring": "Returns URL-safe, sha1 signed base64 compressed JSON string. If key is\n    None, settings.SECRET_KEY is used instead.\n\n    If compress is True (not the default) checks if compressing using zlib can\n    save some space. Prepends a '.' to signify compression. This is included\n    in the signature, to protect against zip bombs.\n\n    Salt can be used to namespace the hash, so that a signed string is\n    only valid for a given namespace. Leaving this at the default\n    value or re-using a salt value across different parts of your\n    application without good cause is a security risk.\n\n    The serializer is expected to return a bytestring.", "docstring_tokens": ["Returns", "URL", "-", "safe", "sha1", "signed", "base64", "compressed", "JSON", "string", ".", "If", "key", "is", "None", "settings", ".", "SECRET_KEY", "is", "used", "instead", "."], "nwo": "georgemarshall/django-cryptography", "score": 0.32069767954003625, "idx": 254502}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L58-L65", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Build the URI for the API call.", "language": "python", "parameters": "(self, path, query_params)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "'https://api.trello.com/1'", "+", "arg_0", ".", "clean_path", "(", "arg_1", ")", "arg_3", "+=", "'?'", "+", "urlencode", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Build the URI for the API call.\n        '''\n        arg_3 = 'https://api.trello.com/1' + arg_0.clean_path(arg_1)\n        arg_3 += '?' + urlencode(arg_2)\n\n        return arg_3", "path": "trolly/client.py", "identifier": "Client.build_uri", "docstring": "Build the URI for the API call.", "docstring_tokens": ["Build", "the", "URI", "for", "the", "API", "call", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 254503}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/quantumcircuit.py#L469-L479", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Returns total number of gate operations in circuit.", "language": "python", "parameters": "(self)", "return_statement": "return gate_ops", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", ",", "arg_3", ",", "arg_3", "in", "arg_0", ".", "data", ":", "if", "arg_2", ".", "name", "not", "in", "[", "'barrier'", ",", "'snapshot'", "]", ":", "arg_1", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns total number of gate operations in circuit.\n\n        Returns:\n            int: Total number of gate operations.\n        \"\"\"\n        arg_1 = 0\n        for arg_2, arg_3, arg_3 in arg_0.data:\n            if arg_2.name not in ['barrier', 'snapshot']:\n                arg_1 += 1\n        return arg_1", "path": "qiskit/circuit/quantumcircuit.py", "identifier": "QuantumCircuit.size", "docstring": "Returns total number of gate operations in circuit.\n\n        Returns:\n            int: Total number of gate operations.", "docstring_tokens": ["Returns", "total", "number", "of", "gate", "operations", "in", "circuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254504}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L265-L271", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Octal to decimal conversion.", "language": "python", "parameters": "(ip, check=True)", "return_statement": "return int(str(ip), 8)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", "and", "not", "is_oct", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "'Func: invalid IP: \"%s\"'", "%", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "int", ")", ":", "arg_0", "=", "oct", "(", "arg_0", ")", "return", "int", "(", "str", "(", "arg_0", ")", ",", "8", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Octal to decimal conversion.\"\"\"\n    if arg_1 and not is_oct(arg_0):\n        raise ValueError('Func: invalid IP: \"%s\"' % arg_0)\n    if isinstance(arg_0, int):\n        arg_0 = oct(arg_0)\n    return int(str(arg_0), 8)", "path": "iplib.py", "identifier": "_oct_to_dec", "docstring": "Octal to decimal conversion.", "docstring_tokens": ["Octal", "to", "decimal", "conversion", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 254505}
{"url": "https://github.com/VingtCinq/python-resize-image/blob/a4e645792ef30c5fcc558df6da6de18b1ecb95ea/resizeimage/helpers.py#L23-L29", "sha": "a4e645792ef30c5fcc558df6da6de18b1ecb95ea", "docstring_summary": "Convert string datas into a Pillow Image object", "language": "python", "parameters": "(image_string)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "StringIO", "(", "arg_0", ")", "arg_2", "=", "Image", ".", "open", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Convert string datas into a Pillow Image object\n    \"\"\"\n    arg_1 = StringIO(arg_0)\n    arg_2 = Image.open(arg_1)\n    return arg_2", "path": "resizeimage/helpers.py", "identifier": "string_to_image", "docstring": "Convert string datas into a Pillow Image object", "docstring_tokens": ["Convert", "string", "datas", "into", "a", "Pillow", "Image", "object"], "nwo": "VingtCinq/python-resize-image", "score": 0.37283617366259525, "idx": 254506}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treetime.py#L485-L527", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Resolve the polytomies on the tree.", "language": "python", "parameters": "(self, merge_compressed=False)", "return_statement": "return poly_found", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_0", ".", "logger", "(", "\"TreeTime.Func: resolving multiple mergers...\"", ",", "1", ")", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ".", "tree", ".", "find_clades", "(", ")", ":", "if", "len", "(", "arg_3", ".", "clades", ")", ">", "2", ":", "arg_4", "=", "len", "(", "arg_3", ".", "clades", ")", "arg_0", ".", "_poly", "(", "arg_3", ",", "arg_1", ")", "arg_2", "+=", "arg_4", "-", "len", "(", "arg_3", ".", "clades", ")", "arg_5", "=", "[", "arg_3", "for", "arg_3", "in", "arg_0", ".", "tree", ".", "find_clades", "(", ")", "if", "len", "(", "arg_3", ".", "clades", ")", "==", "1", "and", "arg_3", ".", "up", "is", "not", "None", "]", "for", "arg_6", "in", "arg_5", ":", "arg_0", ".", "logger", "(", "'TreeTime.Func: remove obsolete node '", "+", "arg_6", ".", "name", ",", "4", ")", "if", "arg_6", ".", "up", "is", "not", "None", ":", "arg_0", ".", "tree", ".", "collapse", "(", "arg_6", ")", "if", "arg_2", ":", "arg_0", ".", "logger", "(", "'TreeTime.Func: introduces %d new nodes'", "%", "arg_2", ",", "3", ")", "else", ":", "arg_0", ".", "logger", "(", "'TreeTime.Func: No more polytomies to resolve'", ",", "3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Resolve the polytomies on the tree.\n\n        The function scans the tree, resolves polytomies if present,\n        and re-optimizes the tree with new topology. Note that polytomies are only\n        resolved if that would result in higher likelihood. Sometimes, stretching\n        two or more branches that carry several mutations is less costly than\n        an additional branch with zero mutations (long branches are not stiff,\n        short branches are).\n\n        Parameters\n        ----------\n         merge_compressed : bool\n            If True, keep compressed branches as polytomies. If False,\n            return a strictly binary tree.\n\n        Returns\n        --------\n         poly_found : int\n            The number of polytomies found\n\n        \"\"\"\n        arg_0.logger(\"TreeTime.Func: resolving multiple mergers...\",1)\n        arg_2=0\n\n        for arg_3 in arg_0.tree.find_clades():\n            if len(arg_3.clades) > 2:\n                arg_4 = len(arg_3.clades)\n                arg_0._poly(arg_3, arg_1)\n                arg_2+=arg_4 - len(arg_3.clades)\n\n        arg_5 = [arg_3 for arg_3 in arg_0.tree.find_clades() if len(arg_3.clades)==1 and arg_3.up is not None]\n        for arg_6 in arg_5:\n            arg_0.logger('TreeTime.Func: remove obsolete node '+arg_6.name,4)\n            if arg_6.up is not None:\n                arg_0.tree.collapse(arg_6)\n\n        if arg_2:\n            arg_0.logger('TreeTime.Func: introduces %d new nodes'%arg_2,3)\n        else:\n            arg_0.logger('TreeTime.Func: No more polytomies to resolve',3)\n        return arg_2", "path": "treetime/treetime.py", "identifier": "TreeTime.resolve_polytomies", "docstring": "Resolve the polytomies on the tree.\n\n        The function scans the tree, resolves polytomies if present,\n        and re-optimizes the tree with new topology. Note that polytomies are only\n        resolved if that would result in higher likelihood. Sometimes, stretching\n        two or more branches that carry several mutations is less costly than\n        an additional branch with zero mutations (long branches are not stiff,\n        short branches are).\n\n        Parameters\n        ----------\n         merge_compressed : bool\n            If True, keep compressed branches as polytomies. If False,\n            return a strictly binary tree.\n\n        Returns\n        --------\n         poly_found : int\n            The number of polytomies found", "docstring_tokens": ["Resolve", "the", "polytomies", "on", "the", "tree", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 254507}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/ecm.py#L99-L165", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Calculate performance model cycles from cache stats.", "language": "python", "parameters": "(self)", "return_statement": "return self.results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "kernel", ".", "datatypes_size", "[", "arg_0", ".", "kernel", ".", "datatype", "]", "arg_2", "=", "float", "(", "arg_0", ".", "machine", "[", "'cacheline size'", "]", ")", "//", "arg_1", "arg_3", "=", "(", "sympy", ".", "Integer", "(", "arg_0", ".", "machine", "[", "'cacheline size'", "]", ")", "/", "sympy", ".", "Integer", "(", "arg_0", ".", "kernel", ".", "bytes_per_iteration", ")", ")", "arg_0", ".", "results", "[", "'iterations per cacheline'", "]", "=", "arg_3", "arg_5", "=", "float", "(", "arg_0", ".", "machine", "[", "'cacheline size'", "]", ")", "arg_6", ",", "arg_7", "=", "(", "arg_0", ".", "predictor", ".", "get_loads", "(", ")", ",", "arg_0", ".", "predictor", ".", "get_stores", "(", ")", ")", "for", "arg_8", ",", "arg_9", "in", "list", "(", "enumerate", "(", "arg_0", ".", "machine", "[", "'memory hierarchy'", "]", ")", ")", "[", "1", ":", "]", ":", "arg_10", ",", "arg_11", "=", "arg_9", "[", "'non-overlap upstream throughput'", "]", "if", "type", "(", "arg_10", ")", "is", "str", "and", "arg_10", "==", "'full socket memory bandwidth'", ":", "arg_12", "=", "arg_6", "[", "arg_8", "]", "arg_13", "=", "arg_7", "[", "arg_8", "]", "arg_14", "=", "1", "arg_15", ",", "arg_16", "=", "arg_0", ".", "machine", ".", "get_bandwidth", "(", "arg_8", ",", "arg_12", ",", "arg_13", ",", "arg_14", ")", "if", "arg_11", "==", "'half-duplex'", ":", "arg_17", "=", "float", "(", "arg_6", "[", "arg_8", "]", "+", "arg_7", "[", "arg_8", "]", ")", "*", "float", "(", "arg_2", ")", "*", "float", "(", "arg_1", ")", "*", "float", "(", "arg_0", ".", "machine", "[", "'clock'", "]", ")", "/", "float", "(", "arg_15", ")", "else", ":", "raise", "NotImplementedError", "(", "\"full-duplex mode is not (yet) supported for memory transfers.\"", ")", "if", "'penalty cycles per read stream'", "in", "arg_9", ":", "arg_17", "+=", "arg_7", "[", "arg_8", "]", "*", "arg_9", "[", "'penalty cycles per read stream'", "]", "arg_0", ".", "results", ".", "update", "(", "{", "'memory bandwidth kernel'", ":", "arg_16", ",", "'memory bandwidth'", ":", "arg_15", "}", ")", "else", ":", "arg_10", "=", "float", "(", "arg_10", ")", "/", "arg_5", "if", "arg_11", "==", "'half-duplex'", ":", "arg_17", "=", "(", "arg_6", "[", "arg_8", "]", "+", "arg_7", "[", "arg_8", "]", ")", "/", "float", "(", "arg_10", ")", "elif", "arg_11", "==", "'full-duplex'", ":", "arg_17", "=", "max", "(", "arg_6", "[", "arg_8", "]", "/", "float", "(", "arg_10", ")", ",", "arg_7", "[", "arg_8", "]", "/", "float", "(", "arg_10", ")", ")", "else", ":", "raise", "ValueError", "(", "\"Duplexness of cache throughput may only be 'half-duplex'\"", "\"or 'full-duplex', found {} in {}.\"", ".", "format", "(", "arg_11", ",", "arg_9", "[", "'name'", "]", ")", ")", "arg_0", ".", "results", "[", "'cycles'", "]", ".", "append", "(", "(", "arg_9", "[", "'level'", "]", ",", "arg_17", ")", ")", "arg_0", ".", "results", "[", "arg_9", "[", "'level'", "]", "]", "=", "arg_17", "return", "arg_0", ".", "results"], "function": "def Func(arg_0):\n        \"\"\"\n        Calculate performance model cycles from cache stats.\n\n        calculate_cache_access() needs to have been execute before.\n        \"\"\"\n        arg_1 = arg_0.kernel.datatypes_size[arg_0.kernel.datatype]\n        arg_2 = float(arg_0.machine['cacheline size']) // arg_1\n        arg_3 = (sympy.Integer(arg_0.machine['cacheline size']) /\n                                    sympy.Integer(arg_0.kernel.bytes_per_iteration))\n        arg_0.results['iterations per cacheline'] = arg_3\n        arg_5 = float(arg_0.machine['cacheline size'])\n\n        arg_6, arg_7 = (arg_0.predictor.get_loads(), arg_0.predictor.get_stores())\n\n        for arg_8, arg_9 in list(enumerate(arg_0.machine['memory hierarchy']))[1:]:\n            arg_10, arg_11 = arg_9['non-overlap upstream throughput']\n\n            if type(arg_10) is str and arg_10 == 'full socket memory bandwidth':\n                # Memory transfer\n                # we use bandwidth to calculate cycles and then add panalty cycles (if given)\n\n                # choose bw according to cache level and problem\n                # first, compile stream counts at current cache level\n                # write-allocate is allready resolved in cache predictor\n                arg_12 = arg_6[arg_8]\n                arg_13 = arg_7[arg_8]\n                # second, try to find best fitting kernel (closest to stream seen stream counts):\n                arg_14 = 1\n                arg_15, arg_16 = arg_0.machine.get_bandwidth(\n                    arg_8, arg_12, arg_13, arg_14)\n\n                # calculate cycles\n                if arg_11 == 'half-duplex':\n                    arg_17 = float(arg_6[arg_8] + arg_7[arg_8]) * \\\n                             float(arg_2) * float(arg_1) * \\\n                             float(arg_0.machine['clock']) / float(arg_15)\n                else:  # full-duplex\n                    raise NotImplementedError(\n                        \"full-duplex mode is not (yet) supported for memory transfers.\")\n                # add penalty cycles for each read stream\n                if 'penalty cycles per read stream' in arg_9:\n                    arg_17 += arg_7[arg_8] * \\\n                              arg_9['penalty cycles per read stream']\n\n                arg_0.results.update({\n                    'memory bandwidth kernel': arg_16,\n                    'memory bandwidth': arg_15})\n            else:\n                # since throughput is given in B/cy, and we need CL/cy:\n                arg_10 = float(arg_10) / arg_5\n                # only cache cycles count\n                if arg_11 == 'half-duplex':\n                    arg_17 = (arg_6[arg_8] + arg_7[arg_8]) / float(arg_10)\n                elif arg_11 == 'full-duplex':\n                    arg_17 = max(arg_6[arg_8] / float(arg_10),\n                                 arg_7[arg_8] / float(arg_10))\n                else:\n                    raise ValueError(\"Duplexness of cache throughput may only be 'half-duplex'\"\n                                     \"or 'full-duplex', found {} in {}.\".format(\n                        arg_11, arg_9['name']))\n\n            arg_0.results['cycles'].append((arg_9['level'], arg_17))\n\n            arg_0.results[arg_9['level']] = arg_17\n\n        return arg_0.results", "path": "kerncraft/models/ecm.py", "identifier": "ECMData.calculate_cycles", "docstring": "Calculate performance model cycles from cache stats.\n\n        calculate_cache_access() needs to have been execute before.", "docstring_tokens": ["Calculate", "performance", "model", "cycles", "from", "cache", "stats", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 254508}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/samples/hg_dav_provider.py#L342-L348", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Called when PUT has finished writing.", "language": "python", "parameters": "(self, with_errors)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "commands", ".", "add", "(", "arg_0", ".", "provider", ".", "ui", ",", "arg_0", ".", "provider", ".", "repo", ",", "arg_0", ".", "localHgPath", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Called when PUT has finished writing.\n\n        See DAVResource.Func()\n        \"\"\"\n        if not arg_1:\n            commands.add(arg_0.provider.ui, arg_0.provider.repo, arg_0.localHgPath)", "path": "wsgidav/samples/hg_dav_provider.py", "identifier": "HgResource.end_write", "docstring": "Called when PUT has finished writing.\n\n        See DAVResource.end_write()", "docstring_tokens": ["Called", "when", "PUT", "has", "finished", "writing", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 254509}
{"url": "https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/backends/openwisp/openwisp.py#L91-L102", "sha": "c23ce9732720856e2f6dc54060db71a8182c7d4b", "docstring_summary": "generates uninstall.sh and adds it to included files", "language": "python", "parameters": "(self, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_render_template", "(", "'uninstall.sh'", ",", "arg_1", ")", "arg_0", ".", "config", ".", "setdefault", "(", "'files'", ",", "[", "]", ")", "arg_0", ".", "_add_unique_file", "(", "{", "\"path\"", ":", "\"/uninstall.sh\"", ",", "\"contents\"", ":", "arg_2", ",", "\"mode\"", ":", "\"755\"", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        generates uninstall.sh and adds it to included files\n        \"\"\"\n        arg_2 = arg_0._render_template('uninstall.sh', arg_1)\n        arg_0.config.setdefault('files', [])  # file list might be empty\n        # add uninstall.sh to list of included files\n        arg_0._add_unique_file({\n            \"path\": \"/uninstall.sh\",\n            \"contents\": arg_2,\n            \"mode\": \"755\"\n        })", "path": "netjsonconfig/backends/openwisp/openwisp.py", "identifier": "OpenWisp._add_uninstall", "docstring": "generates uninstall.sh and adds it to included files", "docstring_tokens": ["generates", "uninstall", ".", "sh", "and", "adds", "it", "to", "included", "files"], "nwo": "openwisp/netjsonconfig", "score": 0.6422153945684831, "idx": 254510}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L123-L163", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Get the selected object and store start position", "language": "python", "parameters": "(self, evt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "DEBUG", ":", "print", "\"down!\"", "if", "(", "not", "arg_1", ".", "ControlDown", "(", ")", "and", "not", "arg_1", ".", "ShiftDown", "(", ")", ")", "or", "arg_1", ".", "AltDown", "(", ")", ":", "for", "arg_2", "in", "arg_0", ".", "selection", ":", "if", "arg_2", ".", "sel_marker", ":", "arg_2", ".", "sel_marker", ".", "show", "(", "False", ")", "arg_2", ".", "sel_marker", ".", "destroy", "(", ")", "arg_2", ".", "sel_marker", "=", "None", "arg_0", ".", "selection", "=", "[", "]", "arg_5", "=", "arg_1", ".", "GetEventObject", "(", ")", "if", "arg_5", ".", "Parent", "is", "None", "or", "arg_1", ".", "AltDown", "(", ")", ":", "if", "not", "arg_1", ".", "AltDown", "(", ")", ":", "arg_1", ".", "Skip", "(", ")", "arg_0", ".", "current", "=", "arg_5", "arg_0", ".", "overlay", "=", "wx", ".", "Overlay", "(", ")", "arg_0", ".", "pos", "=", "arg_1", ".", "GetPosition", "(", ")", "arg_0", ".", "parent", ".", "wx_obj", ".", "CaptureMouse", "(", ")", "else", ":", "arg_2", "=", "arg_5", ".", "obj", "arg_0", ".", "overlay", "=", "None", "if", "DEBUG", ":", "print", "arg_5", "arg_9", ",", "arg_10", "=", "arg_5", ".", "ScreenToClient", "(", "arg_5", ".", "GetPositionTuple", "(", ")", ")", "arg_11", ",", "arg_12", "=", "arg_5", ".", "ScreenToClient", "(", "wx", ".", "GetMousePosition", "(", ")", ")", "arg_0", ".", "pos", "=", "arg_5", ".", "ScreenToClient", "(", "wx", ".", "GetMousePosition", "(", ")", ")", "arg_0", ".", "start", "=", "(", "arg_9", "-", "arg_11", ",", "arg_10", "-", "arg_12", ")", "arg_0", ".", "current", "=", "arg_5", "if", "DEBUG", ":", "print", "\"capture...\"", "if", "not", "isinstance", "(", "arg_5", ",", "wx", ".", "Notebook", ")", ":", "arg_0", ".", "parent", ".", "wx_obj", ".", "CaptureMouse", "(", ")", "arg_0", ".", "select", "(", "arg_2", ",", "keep_selection", "=", "True", ")"], "function": "def Func(arg_0, arg_1): \n        \"Get the selected object and store start position\"\n        if DEBUG: print \"down!\"\n        if (not arg_1.ControlDown() and not arg_1.ShiftDown()) or arg_1.AltDown():\n            for arg_2 in arg_0.selection:\n                # clear marker\n                if arg_2.sel_marker:\n                    arg_2.sel_marker.show(False)\n                    arg_2.sel_marker.destroy()\n                    arg_2.sel_marker = None\n            arg_0.selection = []  # clear previous selection\n\n        arg_5 = arg_1.GetEventObject()\n\n        if arg_5.Parent is None or arg_1.AltDown():\n            if not arg_1.AltDown():\n                arg_1.Skip()\n            # start the rubberband effect (multiple selection using the mouse) \n            arg_0.current = arg_5\n            arg_0.overlay = wx.Overlay()\n            arg_0.pos = arg_1.GetPosition() \n            arg_0.parent.wx_obj.CaptureMouse()\n            #if self.inspector and hasattr(wx_obj, \"obj\"):\n            #    self.inspector.inspect(wx_obj.obj)  # inspect top level window\n            #self.dclick = False\n        else:\n            # create the selection marker and assign it to the control\n            arg_2 = arg_5.obj\n            arg_0.overlay = None\n            if DEBUG: print arg_5\n            arg_9, arg_10 = arg_5.ScreenToClient(arg_5.GetPositionTuple())\n            arg_11, arg_12 = arg_5.ScreenToClient(wx.GetMousePosition())\n            arg_0.pos = arg_5.ScreenToClient(wx.GetMousePosition())\n            arg_0.start = (arg_9 - arg_11, arg_10 - arg_12)\n            arg_0.current = arg_5\n            if DEBUG: print \"capture...\"\n            # do not capture on TextCtrl, it will fail (blocking) at least in gtk\n            # do not capture on wx.Notebook to allow selecting the tabs\n            if not isinstance(arg_5, wx.Notebook):\n                arg_0.parent.wx_obj.CaptureMouse()\n            arg_0.select(arg_2, keep_selection=True)", "path": "gui/tools/designer.py", "identifier": "BasicDesigner.mouse_down", "docstring": "Get the selected object and store start position", "docstring_tokens": ["Get", "the", "selected", "object", "and", "store", "start", "position"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 254511}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/bibdocfile.py#L64-L70", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Import BibDocFile.", "language": "python", "parameters": "()", "return_statement": "return BibRecDocs, BibDoc", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "from", "invenio", ".", "bibdocfile", "import", "BibRecDocs", ",", "BibDoc", "except", "ImportError", ":", "from", "invenio", ".", "legacy", ".", "bibdocfile", ".", "api", "import", "BibRecDocs", ",", "BibDoc", "return", "BibRecDocs", ",", "BibDoc"], "function": "def Func():\n    \"\"\"Import BibDocFile.\"\"\"\n    try:\n        from invenio.bibdocfile import BibRecDocs, BibDoc\n    except ImportError:\n        from invenio.legacy.bibdocfile.api import BibRecDocs, BibDoc\n    return BibRecDocs, BibDoc", "path": "invenio_migrator/legacy/bibdocfile.py", "identifier": "_import_bibdoc", "docstring": "Import BibDocFile.", "docstring_tokens": ["Import", "BibDocFile", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 254512}
{"url": "https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L458-L476", "sha": "0828eaace0846918d2d202f5a60167a003e88b71", "docstring_summary": "Compares the given tokens.", "language": "python", "parameters": "(expected: Union[str, bytes],\n                  actual: Union[str, bytes])", "return_statement": "return compare_signature(expected_sig, actual_sig)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", "]", ",", "arg_4", ":", "arg_1", "[", "arg_2", ",", "arg_3", "]", ")", "->", "bool", ":", "arg_0", "=", "util", ".", "to_bytes", "(", "arg_0", ")", "arg_4", "=", "util", ".", "to_bytes", "(", "arg_4", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "rsplit", "(", "b'.'", ",", "1", ")", "arg_5", ",", "arg_7", "=", "arg_4", ".", "rsplit", "(", "b'.'", ",", "1", ")", "arg_8", "=", "util", ".", "b64_decode", "(", "arg_6", ")", "arg_9", "=", "util", ".", "b64_decode", "(", "arg_7", ")", "return", "compare_signature", "(", "arg_8", ",", "arg_9", ")"], "function": "def Func(arg_0: arg_1[arg_2, arg_3],\n                  arg_4: arg_1[arg_2, arg_3]) -> bool:\n    \"\"\"\n    Compares the given tokens.\n\n    :param expected: The expected token.\n    :type expected: Union[str, bytes]\n    :param actual: The actual token.\n    :type actual: Union[str, bytes]\n    :return: Do the tokens match?\n    :rtype: bool\n    \"\"\"\n    arg_0 = util.to_bytes(arg_0)\n    arg_4 = util.to_bytes(arg_4)\n    arg_5, arg_6 = arg_0.rsplit(b'.', 1)\n    arg_5, arg_7 = arg_4.rsplit(b'.', 1)\n    arg_8 = util.b64_decode(arg_6)\n    arg_9 = util.b64_decode(arg_7)\n    return compare_signature(arg_8, arg_9)", "path": "simplejwt/jwt.py", "identifier": "compare_token", "docstring": "Compares the given tokens.\n\n    :param expected: The expected token.\n    :type expected: Union[str, bytes]\n    :param actual: The actual token.\n    :type actual: Union[str, bytes]\n    :return: Do the tokens match?\n    :rtype: bool", "docstring_tokens": ["Compares", "the", "given", "tokens", "."], "nwo": "jmwri/simplejwt", "score": 0.2549979292514255, "idx": 254513}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/transport.py#L705-L758", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle the 'channel readable' state. E.g. read from a socket.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "lock", ":", "logger", ".", "debug", "(", "\"Func()\"", ")", "if", "arg_0", ".", "_eof", "or", "arg_0", ".", "_socket", "is", "None", ":", "return", "if", "arg_0", ".", "_state", "==", "\"tls-handshake\"", ":", "while", "True", ":", "logger", ".", "debug", "(", "\"tls handshake read...\"", ")", "arg_0", ".", "_continue_tls_handshake", "(", ")", "logger", ".", "debug", "(", "\"  state: {0}\"", ".", "format", "(", "arg_0", ".", "_tls_state", ")", ")", "if", "arg_0", ".", "_tls_state", "!=", "\"want_read\"", ":", "break", "elif", "arg_0", ".", "_tls_state", "==", "\"connected\"", ":", "while", "arg_0", ".", "_socket", "and", "not", "arg_0", ".", "_eof", ":", "logger", ".", "debug", "(", "\"tls socket read...\"", ")", "try", ":", "arg_1", "=", "arg_0", ".", "_socket", ".", "read", "(", "4096", ")", "except", "ssl", ".", "SSLError", ",", "err", ":", "if", "err", ".", "args", "[", "0", "]", "==", "ssl", ".", "SSL_ERROR_WANT_READ", ":", "break", "elif", "err", ".", "args", "[", "0", "]", "==", "ssl", ".", "SSL_ERROR_WANT_WRITE", ":", "break", "else", ":", "raise", "except", "socket", ".", "error", ",", "err", ":", "if", "err", ".", "args", "[", "0", "]", "==", "errno", ".", "EINTR", ":", "continue", "elif", "err", ".", "args", "[", "0", "]", "in", "BLOCKING_ERRORS", ":", "break", "elif", "err", ".", "args", "[", "0", "]", "==", "errno", ".", "ECONNRESET", ":", "logger", ".", "warning", "(", "\"Connection reset by peer\"", ")", "arg_1", "=", "None", "else", ":", "raise", "arg_0", ".", "_feed_reader", "(", "arg_1", ")", "else", ":", "while", "arg_0", ".", "_socket", "and", "not", "arg_0", ".", "_eof", ":", "logger", ".", "debug", "(", "\"raw socket read...\"", ")", "try", ":", "arg_1", "=", "arg_0", ".", "_socket", ".", "recv", "(", "4096", ")", "except", "socket", ".", "error", ",", "err", ":", "if", "err", ".", "args", "[", "0", "]", "==", "errno", ".", "EINTR", ":", "continue", "elif", "err", ".", "args", "[", "0", "]", "in", "BLOCKING_ERRORS", ":", "break", "elif", "err", ".", "args", "[", "0", "]", "==", "errno", ".", "ECONNRESET", ":", "logger", ".", "warning", "(", "\"Connection reset by peer\"", ")", "arg_1", "=", "None", "else", ":", "raise", "arg_0", ".", "_feed_reader", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Handle the 'channel readable' state. E.g. read from a socket.\n        \"\"\"\n        with arg_0.lock:\n            logger.debug(\"Func()\")\n            if arg_0._eof or arg_0._socket is None:\n                return\n            if arg_0._state == \"tls-handshake\":\n                while True:\n                    logger.debug(\"tls handshake read...\")\n                    arg_0._continue_tls_handshake()\n                    logger.debug(\"  state: {0}\".format(arg_0._tls_state))\n                    if arg_0._tls_state != \"want_read\":\n                        break\n            elif arg_0._tls_state == \"connected\":\n                while arg_0._socket and not arg_0._eof:\n                    logger.debug(\"tls socket read...\")\n                    try:\n                        arg_1 = arg_0._socket.read(4096)\n                    except ssl.SSLError, err:\n                        if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n                            break\n                        elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n                            break\n                        else:\n                            raise\n                    except socket.error, err:\n                        if err.args[0] == errno.EINTR:\n                            continue\n                        elif err.args[0] in BLOCKING_ERRORS:\n                            break\n                        elif err.args[0] == errno.ECONNRESET:\n                            logger.warning(\"Connection reset by peer\")\n                            arg_1 = None\n                        else:\n                            raise\n                    arg_0._feed_reader(arg_1)\n            else:\n                while arg_0._socket and not arg_0._eof:\n                    logger.debug(\"raw socket read...\")\n                    try:\n                        arg_1 = arg_0._socket.recv(4096)\n                    except socket.error, err:\n                        if err.args[0] == errno.EINTR:\n                            continue\n                        elif err.args[0] in BLOCKING_ERRORS:\n                            break\n                        elif err.args[0] == errno.ECONNRESET:\n                            logger.warning(\"Connection reset by peer\")\n                            arg_1 = None\n                        else:\n                            raise\n                    arg_0._feed_reader(arg_1)", "path": "pyxmpp2/transport.py", "identifier": "TCPTransport.handle_read", "docstring": "Handle the 'channel readable' state. E.g. read from a socket.", "docstring_tokens": ["Handle", "the", "channel", "readable", "state", ".", "E", ".", "g", ".", "read", "from", "a", "socket", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254514}
{"url": "https://github.com/glottobank/python-newick/blob/e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702/src/newick.py#L374-L383", "sha": "e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702", "docstring_summary": "Serialize a list of trees in Newick format.", "language": "python", "parameters": "(trees)", "return_statement": "return ';\\n'.join([tree.newick for tree in trees]) + ';'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Node", ")", ":", "arg_0", "=", "[", "arg_0", "]", "return", "';\\n'", ".", "join", "(", "[", "arg_1", ".", "newick", "for", "arg_1", "in", "arg_0", "]", ")", "+", "';'"], "function": "def Func(arg_0):\n    \"\"\"\n    Serialize a list of trees in Newick format.\n\n    :param trees: List of Node objects or a single Node object.\n    :return: Newick formatted string.\n    \"\"\"\n    if isinstance(arg_0, Node):\n        arg_0 = [arg_0]\n    return ';\\n'.join([arg_1.newick for arg_1 in arg_0]) + ';'", "path": "src/newick.py", "identifier": "dumps", "docstring": "Serialize a list of trees in Newick format.\n\n    :param trees: List of Node objects or a single Node object.\n    :return: Newick formatted string.", "docstring_tokens": ["Serialize", "a", "list", "of", "trees", "in", "Newick", "format", "."], "nwo": "glottobank/python-newick", "score": 0.19358971820395612, "idx": 254515}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L161-L177", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Function internally used to check if the given netmask\n    is of the specified notation.", "language": "python", "parameters": "(nm, notation)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "NM_DOT", ":", "_dot_to_dec", ",", "NM_HEX", ":", "_hex_to_dec", ",", "NM_BIN", ":", "_bin_to_dec", ",", "NM_OCT", ":", "_oct_to_dec", ",", "NM_DEC", ":", "_dec_to_dec_long", "}", "try", ":", "arg_3", "=", "arg_2", "[", "arg_1", "]", "(", "arg_0", ",", "check", "=", "True", ")", "except", "ValueError", ":", "return", "False", "if", "arg_3", "in", "_NETMASKS_VALUES", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Function internally used to check if the given netmask\n    is of the specified notation.\"\"\"\n    # Convert to decimal, and check if it's in the list of valid netmasks.\n    arg_2 = {\n        NM_DOT: _dot_to_dec,\n        NM_HEX: _hex_to_dec,\n        NM_BIN: _bin_to_dec,\n        NM_OCT: _oct_to_dec,\n        NM_DEC: _dec_to_dec_long}\n    try:\n        arg_3 = arg_2[arg_1](arg_0, check=True)\n    except ValueError:\n        return False\n    if arg_3 in _NETMASKS_VALUES:\n        return True\n    return False", "path": "iplib.py", "identifier": "_check_nm", "docstring": "Function internally used to check if the given netmask\n    is of the specified notation.", "docstring_tokens": ["Function", "internally", "used", "to", "check", "if", "the", "given", "netmask", "is", "of", "the", "specified", "notation", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 254516}
{"url": "https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L599-L607", "sha": "ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e", "docstring_summary": "Fetch the IDASettings instance for the curren plugin with directory scope.", "language": "python", "parameters": "(self)", "return_statement": "return DirectoryIDASettings(self._plugin_name, directory=self._config_directory)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_config_Func", "is", "None", ":", "ensure_ida_loaded", "(", ")", "return", "DirectoryIDASettings", "(", "arg_0", ".", "_plugin_name", ",", "Func", "=", "arg_0", ".", "_config_Func", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Fetch the IDASettings instance for the curren plugin with Func scope.\n\n        rtype: IDASettingsInterface\n        \"\"\"\n        if arg_0._config_Func is None:\n            ensure_ida_loaded()\n        return DirectoryIDASettings(arg_0._plugin_name, Func=arg_0._config_Func)", "path": "ida_settings/ida_settings.py", "identifier": "IDASettings.directory", "docstring": "Fetch the IDASettings instance for the curren plugin with directory scope.\n\n        rtype: IDASettingsInterface", "docstring_tokens": ["Fetch", "the", "IDASettings", "instance", "for", "the", "curren", "plugin", "with", "directory", "scope", "."], "nwo": "williballenthin/ida-settings", "score": 0.18657722465184873, "idx": 254517}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/task.py#L548-L555", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Inherits the data from the parent.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "LOG", ".", "debug", "(", "\"'%s' inheriting data from '%s'\"", "%", "(", "arg_0", ".", "get_name", "(", ")", ",", "arg_0", ".", "parent", ".", "get_name", "(", ")", ")", ",", "extra", "=", "dict", "(", "data", "=", "arg_0", ".", "parent", ".", "data", ")", ")", "arg_0", ".", "set_data", "(", "**", "arg_0", ".", "parent", ".", "data", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Inherits the data from the parent.\n        \"\"\"\n        LOG.debug(\"'%s' inheriting data from '%s'\" % (arg_0.get_name(),\n                                                      arg_0.parent.get_name()),\n                  extra=dict(data=arg_0.parent.data))\n        arg_0.set_data(**arg_0.parent.data)", "path": "SpiffWorkflow/task.py", "identifier": "Task._inherit_data", "docstring": "Inherits the data from the parent.", "docstring_tokens": ["Inherits", "the", "data", "from", "the", "parent", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 254518}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/datasets/mnist.py#L262-L304", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Download the EMNIST data if it doesn't exist in processed_folder already.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "shutil", "import", "zipfile", "if", "arg_0", ".", "_check_exists", "(", ")", ":", "return", "makedir_exist_ok", "(", "arg_0", ".", "raw_folder", ")", "makedir_exist_ok", "(", "arg_0", ".", "processed_folder", ")", "arg_1", "=", "arg_0", ".", "url", ".", "rpartition", "(", "'/'", ")", "[", "2", "]", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "raw_folder", ",", "arg_1", ")", "Func_url", "(", "arg_0", ".", "url", ",", "root", "=", "arg_0", ".", "raw_folder", ",", "arg_1", "=", "arg_1", ",", "md5", "=", "None", ")", "print", "(", "'Extracting zip archive'", ")", "with", "zipfile", ".", "ZipFile", "(", "arg_2", ")", "as", "zip_f", ":", "zip_f", ".", "extractall", "(", "arg_0", ".", "raw_folder", ")", "os", ".", "unlink", "(", "arg_2", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "raw_folder", ",", "'gzip'", ")", "for", "arg_4", "in", "os", ".", "listdir", "(", "arg_3", ")", ":", "if", "arg_4", ".", "endswith", "(", "'.gz'", ")", ":", "arg_0", ".", "extract_gzip", "(", "gzip_path", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_4", ")", ")", "for", "arg_5", "in", "arg_0", ".", "splits", ":", "print", "(", "'Processing '", "+", "arg_5", ")", "arg_6", "=", "(", "read_image_file", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'emnist-{}-train-images-idx3-ubyte'", ".", "format", "(", "arg_5", ")", ")", ")", ",", "read_label_file", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'emnist-{}-train-labels-idx1-ubyte'", ".", "format", "(", "arg_5", ")", ")", ")", ")", "arg_7", "=", "(", "read_image_file", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'emnist-{}-test-images-idx3-ubyte'", ".", "format", "(", "arg_5", ")", ")", ")", ",", "read_label_file", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'emnist-{}-test-labels-idx1-ubyte'", ".", "format", "(", "arg_5", ")", ")", ")", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "processed_folder", ",", "arg_0", ".", "_training_file", "(", "arg_5", ")", ")", ",", "'wb'", ")", "as", "f", ":", "torch", ".", "save", "(", "arg_6", ",", "f", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "processed_folder", ",", "arg_0", ".", "_test_file", "(", "arg_5", ")", ")", ",", "'wb'", ")", "as", "f", ":", "torch", ".", "save", "(", "arg_7", ",", "f", ")", "shutil", ".", "rmtree", "(", "arg_3", ")", "print", "(", "'Done!'", ")"], "function": "def Func(arg_0):\n        \"\"\"Download the EMNIST data if it doesn't exist in processed_folder already.\"\"\"\n        import shutil\n        import zipfile\n\n        if arg_0._check_exists():\n            return\n\n        makedir_exist_ok(arg_0.raw_folder)\n        makedir_exist_ok(arg_0.processed_folder)\n\n        # Func files\n        arg_1 = arg_0.url.rpartition('/')[2]\n        arg_2 = os.path.join(arg_0.raw_folder, arg_1)\n        Func_url(arg_0.url, root=arg_0.raw_folder, arg_1=arg_1, md5=None)\n\n        print('Extracting zip archive')\n        with zipfile.ZipFile(arg_2) as zip_f:\n            zip_f.extractall(arg_0.raw_folder)\n        os.unlink(arg_2)\n        arg_3 = os.path.join(arg_0.raw_folder, 'gzip')\n        for arg_4 in os.listdir(arg_3):\n            if arg_4.endswith('.gz'):\n                arg_0.extract_gzip(gzip_path=os.path.join(arg_3, arg_4))\n\n        # process and save as torch files\n        for arg_5 in arg_0.splits:\n            print('Processing ' + arg_5)\n            arg_6 = (\n                read_image_file(os.path.join(arg_3, 'emnist-{}-train-images-idx3-ubyte'.format(arg_5))),\n                read_label_file(os.path.join(arg_3, 'emnist-{}-train-labels-idx1-ubyte'.format(arg_5)))\n            )\n            arg_7 = (\n                read_image_file(os.path.join(arg_3, 'emnist-{}-test-images-idx3-ubyte'.format(arg_5))),\n                read_label_file(os.path.join(arg_3, 'emnist-{}-test-labels-idx1-ubyte'.format(arg_5)))\n            )\n            with open(os.path.join(arg_0.processed_folder, arg_0._training_file(arg_5)), 'wb') as f:\n                torch.save(arg_6, f)\n            with open(os.path.join(arg_0.processed_folder, arg_0._test_file(arg_5)), 'wb') as f:\n                torch.save(arg_7, f)\n        shutil.rmtree(arg_3)\n\n        print('Done!')", "path": "torchvision/datasets/mnist.py", "identifier": "EMNIST.download", "docstring": "Download the EMNIST data if it doesn't exist in processed_folder already.", "docstring_tokens": ["Download", "the", "EMNIST", "data", "if", "it", "doesn", "t", "exist", "in", "processed_folder", "already", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 254519}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L368-L394", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Create a new archive.", "language": "python", "parameters": "(self)", "return_statement": "return archive", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "uuid", ".", "uuid4", "(", ")", ".", "hex", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirpath", ",", "arg_1", "[", "0", ":", "2", "]", ")", "arg_3", "=", "arg_1", "[", "2", ":", "]", "+", "arg_0", ".", "STORAGE_EXT", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_3", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "os", ".", "makedirs", "(", "arg_2", ")", "try", ":", "arg_5", "=", "Archive", ".", "create", "(", "arg_4", ")", "except", "ArchiveError", "as", "e", ":", "raise", "ArchiveManagerError", "(", "cause", "=", "str", "(", "e", ")", ")", "return", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"Create a new archive.\n\n        The method creates in the filesystem a brand new archive with\n        a random SHA1 as its name. The first byte of the hashcode will\n        be the name of the subdirectory; the remaining bytes, the\n        archive name.\n\n        :returns: a new `Archive` object\n\n        :raises ArchiveManagerError: when an error occurs creating the\n            new archive\n        \"\"\"\n        arg_1 = uuid.uuid4().hex\n        arg_2 = os.path.join(arg_0.dirpath, arg_1[0:2])\n        arg_3 = arg_1[2:] + arg_0.STORAGE_EXT\n        arg_4 = os.path.join(arg_2, arg_3)\n\n        if not os.path.exists(arg_2):\n            os.makedirs(arg_2)\n\n        try:\n            arg_5 = Archive.create(arg_4)\n        except ArchiveError as e:\n            raise ArchiveManagerError(cause=str(e))\n\n        return arg_5", "path": "perceval/archive.py", "identifier": "ArchiveManager.create_archive", "docstring": "Create a new archive.\n\n        The method creates in the filesystem a brand new archive with\n        a random SHA1 as its name. The first byte of the hashcode will\n        be the name of the subdirectory; the remaining bytes, the\n        archive name.\n\n        :returns: a new `Archive` object\n\n        :raises ArchiveManagerError: when an error occurs creating the\n            new archive", "docstring_tokens": ["Create", "a", "new", "archive", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 254520}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/gatt.py#L94-L99", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Write the specified value to this characteristic.", "language": "python", "parameters": "(self, value, write_type=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "arg_3", "=", "NSData", ".", "dataWithBytes_length_", "(", "arg_1", ",", "len", "(", "arg_1", ")", ")", "arg_0", ".", "_device", ".", "_peripheral", ".", "writeValue_forCharacteristic_type_", "(", "arg_3", ",", "arg_0", ".", "_characteristic", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        \"\"\"Write the specified value to this characteristic.\"\"\"\n        arg_3 = NSData.dataWithBytes_length_(arg_1, len(arg_1))\n        arg_0._device._peripheral.writeValue_forCharacteristic_type_(arg_3,\n            arg_0._characteristic,\n            arg_2)", "path": "Adafruit_BluefruitLE/corebluetooth/gatt.py", "identifier": "CoreBluetoothGattCharacteristic.write_value", "docstring": "Write the specified value to this characteristic.", "docstring_tokens": ["Write", "the", "specified", "value", "to", "this", "characteristic", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 254521}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/event.py#L219-L237", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Disconnects the signal from the given function.", "language": "python", "parameters": "(self, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "weak_subscribers", "is", "not", "None", ":", "with", "arg_0", ".", "lock", ":", "arg_2", "=", "arg_0", ".", "_weakly_connected_index", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "weak_subscribers", ".", "pop", "(", "arg_2", ")", "[", "0", "]", "if", "arg_0", ".", "hard_subscribers", "is", "not", "None", ":", "try", ":", "arg_2", "=", "arg_0", ".", "_hard_callbacks", "(", ")", ".", "index", "(", "arg_1", ")", "except", "ValueError", ":", "pass", "else", ":", "arg_0", ".", "hard_subscribers", ".", "pop", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Disconnects the signal from the given function.\n\n        :type  callback: object\n        :param callback: The callback function.\n        \"\"\"\n        if arg_0.weak_subscribers is not None:\n            with arg_0.lock:\n                arg_2 = arg_0._weakly_connected_index(arg_1)\n                if arg_2 is not None:\n                    arg_0.weak_subscribers.pop(arg_2)[0]\n        if arg_0.hard_subscribers is not None:\n            try:\n                arg_2 = arg_0._hard_callbacks().index(arg_1)\n            except ValueError:\n                pass\n            else:\n                arg_0.hard_subscribers.pop(arg_2)", "path": "SpiffWorkflow/util/event.py", "identifier": "Event.disconnect", "docstring": "Disconnects the signal from the given function.\n\n        :type  callback: object\n        :param callback: The callback function.", "docstring_tokens": ["Disconnects", "the", "signal", "from", "the", "given", "function", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 254522}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L279-L285", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Binary to decimal conversion.", "language": "python", "parameters": "(ip, check=True)", "return_statement": "return int(str(ip), 2)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", "and", "not", "is_bin", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "'Func: invalid IP: \"%s\"'", "%", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "int", ")", ":", "arg_0", "=", "str", "(", "arg_0", ")", "return", "int", "(", "str", "(", "arg_0", ")", ",", "2", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Binary to decimal conversion.\"\"\"\n    if arg_1 and not is_bin(arg_0):\n        raise ValueError('Func: invalid IP: \"%s\"' % arg_0)\n    if isinstance(arg_0, int):\n        arg_0 = str(arg_0)\n    return int(str(arg_0), 2)", "path": "iplib.py", "identifier": "_bin_to_dec", "docstring": "Binary to decimal conversion.", "docstring_tokens": ["Binary", "to", "decimal", "conversion", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 254523}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L631-L640", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Set the maximum forces for this object's degrees of freedom.", "language": "python", "parameters": "(self, max_forces)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "_set_params", "(", "arg_0", ".", "ode_obj", ",", "'FMax'", ",", "Func", ",", "arg_0", ".", "ADOF", "+", "arg_0", ".", "LDOF", ")"], "function": "def Func(arg_0, Func):\n        '''Set the maximum forces for this object's degrees of freedom.\n\n        Parameters\n        ----------\n        max_forces : float or sequence of float\n            A maximum force value to set on all degrees of freedom, or a list\n            containing one such value for each degree of freedom.\n        '''\n        _set_params(arg_0.ode_obj, 'FMax', Func, arg_0.ADOF + arg_0.LDOF)", "path": "pagoda/physics.py", "identifier": "Joint.max_forces", "docstring": "Set the maximum forces for this object's degrees of freedom.\n\n        Parameters\n        ----------\n        max_forces : float or sequence of float\n            A maximum force value to set on all degrees of freedom, or a list\n            containing one such value for each degree of freedom.", "docstring_tokens": ["Set", "the", "maximum", "forces", "for", "this", "object", "s", "degrees", "of", "freedom", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 254524}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/descriptor_pool.py#L243-L256", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Loads the named descriptor from the pool.", "language": "python", "parameters": "(self, full_name)", "return_statement": "return self._descriptors[full_name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "_NormalizeFullyQualifiedName", "(", "arg_1", ")", "if", "arg_1", "not", "in", "arg_0", ".", "_descriptors", ":", "arg_0", ".", "FindFileContainingSymbol", "(", "arg_1", ")", "return", "arg_0", ".", "_descriptors", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Loads the named descriptor from the pool.\n\n    Args:\n      full_name: The full name of the descriptor to load.\n\n    Returns:\n      The descriptor for the named type.\n    \"\"\"\n\n    arg_1 = _NormalizeFullyQualifiedName(arg_1)\n    if arg_1 not in arg_0._descriptors:\n      arg_0.FindFileContainingSymbol(arg_1)\n    return arg_0._descriptors[arg_1]", "path": "typy/google/protobuf/descriptor_pool.py", "identifier": "DescriptorPool.FindMessageTypeByName", "docstring": "Loads the named descriptor from the pool.\n\n    Args:\n      full_name: The full name of the descriptor to load.\n\n    Returns:\n      The descriptor for the named type.", "docstring_tokens": ["Loads", "the", "named", "descriptor", "from", "the", "pool", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 254525}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/tasks.py#L102-L137", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Add a task to the registry.", "language": "python", "parameters": "(self, task_id, backend, category, backend_args,\n            archiving_cfg=None, scheduling_cfg=None)", "return_statement": "return task", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_0", ".", "_rwlock", ".", "writer_acquire", "(", ")", "if", "arg_1", "in", "arg_0", ".", "_tasks", ":", "arg_0", ".", "_rwlock", ".", "writer_release", "(", ")", "raise", "AlreadyExistsError", "(", "element", "=", "str", "(", "arg_1", ")", ")", "arg_7", "=", "Task", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_0", ".", "_tasks", "[", "arg_1", "]", "=", "arg_7", "arg_0", ".", "_rwlock", ".", "writer_release", "(", ")", "logger", ".", "debug", "(", "\"Task %s Funced to the registry\"", ",", "str", "(", "arg_1", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n            arg_5=None, arg_6=None):\n        \"\"\"Add a task to the registry.\n\n        This method Funcs task using `task_id` as identifier. If a task\n        with the same identifier already exists on the registry, a\n        `AlreadyExistsError` exception will be raised.\n\n        :param task_id: identifier of the task to Func\n        :param backend: backend used to fetch data from the repository\n        :param category: category of the items to fetch\n        :param backend_args: dictionary of arguments required to run the backend\n        :param archiving_cfg: archiving config for the task, if needed\n        :param scheduling_cfg: scheduling config for the task, if needed\n\n        :returns: the new task Funced to the registry\n\n        :raises AlreadyExistsError: raised when the given task identifier\n            exists on the registry\n        \"\"\"\n        arg_0._rwlock.writer_acquire()\n\n        if arg_1 in arg_0._tasks:\n            arg_0._rwlock.writer_release()\n            raise AlreadyExistsError(element=str(arg_1))\n\n        arg_7 = Task(arg_1, arg_2, arg_3, arg_4,\n                    arg_5=arg_5,\n                    arg_6=arg_6)\n        arg_0._tasks[arg_1] = arg_7\n\n        arg_0._rwlock.writer_release()\n\n        logger.debug(\"Task %s Funced to the registry\", str(arg_1))\n\n        return arg_7", "path": "arthur/tasks.py", "identifier": "TaskRegistry.add", "docstring": "Add a task to the registry.\n\n        This method adds task using `task_id` as identifier. If a task\n        with the same identifier already exists on the registry, a\n        `AlreadyExistsError` exception will be raised.\n\n        :param task_id: identifier of the task to add\n        :param backend: backend used to fetch data from the repository\n        :param category: category of the items to fetch\n        :param backend_args: dictionary of arguments required to run the backend\n        :param archiving_cfg: archiving config for the task, if needed\n        :param scheduling_cfg: scheduling config for the task, if needed\n\n        :returns: the new task added to the registry\n\n        :raises AlreadyExistsError: raised when the given task identifier\n            exists on the registry", "docstring_tokens": ["Add", "a", "task", "to", "the", "registry", "."], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 254526}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L337-L345", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "delete all of the selected objects", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "selection", ":", "if", "arg_2", ":", "if", "DEBUG", ":", "print", "\"deleting\"", ",", "arg_2", ".", "name", "arg_2", ".", "destroy", "(", ")", "arg_0", ".", "selection", "=", "[", "]", "arg_0", ".", "inspector", ".", "load_object", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"Func all of the selected objects\"\n        # get the selected objects (if any)\n        for arg_2 in arg_0.selection:\n            if arg_2:\n                if DEBUG: print \"deleting\", arg_2.name\n                arg_2.destroy()\n        arg_0.selection = []                         # clean selection\n        arg_0.inspector.load_object()", "path": "gui/tools/designer.py", "identifier": "BasicDesigner.delete", "docstring": "delete all of the selected objects", "docstring_tokens": ["delete", "all", "of", "the", "selected", "objects"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 254527}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/provenance.py#L251-L253", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Create a citation timeline counter from the graph.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "return create_timeline(count_citation_years(graph))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "List", "[", "Tuple", "[", "int", ",", "int", "]", "]", ":", "return", "create_timeline", "(", "count_citation_years", "(", "arg_0", ")", ")"], "function": "def Func(arg_0: arg_1) -> List[Tuple[int, int]]:\n    \"\"\"Create a citation timeline counter from the graph.\"\"\"\n    return create_timeline(count_citation_years(arg_0))", "path": "src/pybel_tools/summary/provenance.py", "identifier": "get_citation_years", "docstring": "Create a citation timeline counter from the graph.", "docstring_tokens": ["Create", "a", "citation", "timeline", "counter", "from", "the", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 254528}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py#L134-L145", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Delete a service bus namespace.", "language": "python", "parameters": "(self, name)", "return_statement": "return self._perform_delete(\n            self._get_path('services/serviceBus/Namespaces', name),\n            None)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'name'", ",", "arg_1", ")", "return", "arg_0", ".", "_perform_delete", "(", "arg_0", ".", "_get_path", "(", "'services/serviceBus/Namespaces'", ",", "arg_1", ")", ",", "None", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Delete a service bus namespace.\n\n        name:\n            Name of the service bus namespace to delete.\n        '''\n        _validate_not_none('name', arg_1)\n\n        return arg_0._perform_delete(\n            arg_0._get_path('services/serviceBus/Namespaces', arg_1),\n            None)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py", "identifier": "ServiceBusManagementService.delete_namespace", "docstring": "Delete a service bus namespace.\n\n        name:\n            Name of the service bus namespace to delete.", "docstring_tokens": ["Delete", "a", "service", "bus", "namespace", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254529}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1288-L1306", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "_get_key_for_index - Returns the key name that would hold the indexes on a value\n\t\t\tInternal - does not validate that indexedFields is actually indexed. Trusts you. Don't let it down.", "language": "python", "parameters": "(self, indexedField, val)", "return_statement": "return ''.join( [INDEXED_REDIS_PREFIX, self.keyName, ':idx:', indexedField, ':', val] )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "hasattr", "(", "arg_1", ",", "'toIndex'", ")", ":", "arg_2", "=", "arg_1", ".", "toIndex", "(", "arg_2", ")", "else", ":", "arg_2", "=", "arg_0", ".", "fields", "[", "arg_1", "]", ".", "toIndex", "(", "arg_2", ")", "return", "''", ".", "join", "(", "[", "INDEXED_REDIS_PREFIX", ",", "arg_0", ".", "keyName", ",", "':idx:'", ",", "arg_1", ",", "':'", ",", "arg_2", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n\t\t'''\n\t\t\tFunc - Returns the key name that would hold the indexes on a value\n\t\t\tInternal - does not validate that indexedFields is actually indexed. Trusts you. Don't let it down.\n\n\t\t\t@param indexedField - string of field name\n\t\t\t@param val - Value of field\n\n\t\t\t@return - Key name string, potentially hashed.\n\t\t'''\n\t\t# If provided an IRField, use the toIndex from that (to support compat_ methods\n\t\tif hasattr(arg_1, 'toIndex'):\n\t\t\targ_2 = arg_1.toIndex(arg_2)\n\t\telse:\n\t\t# Otherwise, look up the indexed field from the model\n\t\t\targ_2 = arg_0.fields[arg_1].toIndex(arg_2)\n\n\n\t\treturn ''.join( [INDEXED_REDIS_PREFIX, arg_0.keyName, ':idx:', arg_1, ':', arg_2] )", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisHelper._get_key_for_index", "docstring": "_get_key_for_index - Returns the key name that would hold the indexes on a value\n\t\t\tInternal - does not validate that indexedFields is actually indexed. Trusts you. Don't let it down.\n\n\t\t\t@param indexedField - string of field name\n\t\t\t@param val - Value of field\n\n\t\t\t@return - Key name string, potentially hashed.", "docstring_tokens": ["_get_key_for_index", "-", "Returns", "the", "key", "name", "that", "would", "hold", "the", "indexes", "on", "a", "value", "Internal", "-", "does", "not", "validate", "that", "indexedFields", "is", "actually", "indexed", ".", "Trusts", "you", ".", "Don", "t", "let", "it", "down", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 254530}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/nfs/client.py#L41-L65", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This function will create the VM directory where a repo will be mounted, if it\n    doesn't exist.  If wait_for_server is set, it will wait up to 10 seconds for\n    the nfs server to start, by retrying mounts that fail with 'Connection Refused'.", "language": "python", "parameters": "(repo, wait_for_server=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "check_call_on_vm", "(", "'sudo mkdir -p {}'", ".", "format", "(", "arg_0", ".", "vm_path", ")", ")", "if", "arg_1", ":", "for", "arg_2", "in", "range", "(", "0", ",", "10", ")", ":", "try", ":", "_run_mount_command", "(", "arg_0", ")", "return", "except", "CalledProcessError", "as", "e", ":", "if", "'Connection refused'", "in", "e", ".", "output", ":", "logging", ".", "info", "(", "'Failed to mount repo; waiting for nfsd to restart'", ")", "time", ".", "sleep", "(", "1", ")", "else", ":", "logging", ".", "info", "(", "e", ".", "output", ")", "raise", "e", "log_to_client", "(", "'Failed to mount repo {}'", ".", "format", "(", "arg_0", ".", "short_name", ")", ")", "raise", "RuntimeError", "(", "'Unable to mount repo with NFS'", ")", "else", ":", "_run_mount_command", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    This function will create the VM directory where a repo will be mounted, if it\n    doesn't exist.  If wait_for_server is set, it will wait up to 10 seconds for\n    the nfs server to start, by retrying mounts that fail with 'Connection Refused'.\n\n    If wait_for_server is not set, it will attempt to run the mount command once\n    \"\"\"\n    check_call_on_vm('sudo mkdir -p {}'.format(arg_0.vm_path))\n    if arg_1:\n        for arg_2 in range(0,10):\n            try:\n                _run_mount_command(arg_0)\n                return\n            except CalledProcessError as e:\n                if 'Connection refused' in e.output:\n                    logging.info('Failed to mount repo; waiting for nfsd to restart')\n                    time.sleep(1)\n                else:\n                    logging.info(e.output)\n                    raise e\n        log_to_client('Failed to mount repo {}'.format(arg_0.short_name))\n        raise RuntimeError('Unable to mount repo with NFS')\n    else:\n        _run_mount_command(arg_0)", "path": "dusty/systems/nfs/client.py", "identifier": "_mount_repo", "docstring": "This function will create the VM directory where a repo will be mounted, if it\n    doesn't exist.  If wait_for_server is set, it will wait up to 10 seconds for\n    the nfs server to start, by retrying mounts that fail with 'Connection Refused'.\n\n    If wait_for_server is not set, it will attempt to run the mount command once", "docstring_tokens": ["This", "function", "will", "create", "the", "VM", "directory", "where", "a", "repo", "will", "be", "mounted", "if", "it", "doesn", "t", "exist", ".", "If", "wait_for_server", "is", "set", "it", "will", "wait", "up", "to", "10", "seconds", "for", "the", "nfs", "server", "to", "start", "by", "retrying", "mounts", "that", "fail", "with", "Connection", "Refused", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 254531}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L761-L777", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "construct a sentence text, with proper spacing", "language": "python", "parameters": "(sent_text)", "return_statement": "return \"\".join(lex)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ":", "if", "len", "(", "arg_3", ")", ">", "0", ":", "if", "(", "arg_2", ">", "0", ")", "and", "not", "(", "arg_3", "[", "0", "]", "in", "\",.:;!?-\\\"'\"", ")", ":", "arg_1", ".", "append", "(", "\" \"", ")", "arg_1", ".", "append", "(", "arg_3", ")", "arg_2", "+=", "1", "return", "\"\"", ".", "join", "(", "arg_1", ")"], "function": "def Func (arg_0):\n    \"\"\"\n    construct a sentence text, with proper spacing\n    \"\"\"\n    arg_1 = []\n    arg_2 = 0\n\n    for arg_3 in arg_0:\n        if len(arg_3) > 0:\n            if (arg_2 > 0) and not (arg_3[0] in \",.:;!?-\\\"'\"):\n                arg_1.append(\" \")\n\n            arg_1.append(arg_3)\n\n        arg_2 += 1\n\n    return \"\".join(arg_1)", "path": "pytextrank/pytextrank.py", "identifier": "make_sentence", "docstring": "construct a sentence text, with proper spacing", "docstring_tokens": ["construct", "a", "sentence", "text", "with", "proper", "spacing"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 254532}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/special_alerts.py#L530-L630", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Create an anomaly alert. This call makes 2 requests, one to create a\n        \"scheduled_query\", and another to create the alert.", "language": "python", "parameters": "(self,\n               name,\n               query,\n               scope_count,\n               scope_unit,\n               increase_positive,\n               percentage_change,\n               trigger_config,\n               logs,\n               alert_reports)", "return_statement": "return self._api_post(\n            url=tag_url,\n            data=json.dumps(tag_data, sort_keys=True),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", ":", "arg_10", "=", "'{pos}{change}'", ".", "format", "(", "pos", "=", "'+'", "if", "arg_5", "else", "'-'", ",", "arg_10", "=", "str", "(", "arg_6", ")", ")", "arg_11", "=", "arg_0", ".", "_Func_scheduled_query", "(", "arg_2", "=", "arg_2", ",", "arg_10", "=", "arg_10", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ",", ")", "arg_12", "=", "arg_11", ".", "get", "(", "'scheduled_query'", ",", "{", "}", ")", ".", "get", "(", "'id'", ")", "arg_13", "=", "{", "'tag'", ":", "{", "'actions'", ":", "[", "alert_report", ".", "to_dict", "(", ")", "for", "alert_report", "in", "arg_9", "]", ",", "'name'", ":", "arg_1", ",", "'scheduled_query_id'", ":", "arg_12", ",", "'sources'", ":", "[", "{", "'id'", ":", "log", "}", "for", "log", "in", "arg_8", "]", ",", "'sub_type'", ":", "'AnomalyAlert'", ",", "'type'", ":", "'AlertNotify'", "}", "}", "arg_13", "[", "'tag'", "]", ".", "update", "(", "arg_7", ".", "to_dict", "(", ")", ")", "arg_14", "=", "'https://logentries.com/rest/{account_id}/api/tags'", ".", "format", "(", "account_id", "=", "arg_0", ".", "account_id", ")", "return", "arg_0", ".", "_api_post", "(", "url", "=", "arg_14", ",", "data", "=", "json", ".", "dumps", "(", "arg_13", ",", "sort_keys", "=", "True", ")", ",", ")"], "function": "def Func(arg_0,\n               arg_1,\n               arg_2,\n               arg_3,\n               arg_4,\n               arg_5,\n               arg_6,\n               arg_7,\n               arg_8,\n               arg_9):\n        \"\"\"\n        Create an anomaly alert. This call makes 2 requests, one to Func a\n        \"scheduled_query\", and another to Func the alert.\n\n        :param name: The name for the alert\n        :type name: str\n\n        :param query: The `LEQL`_ query to use for detecting anomalies. Must\n            result in a numerical value, so it should look something like\n            ``where(...) calculate(COUNT)``\n        :type query: str\n\n        :param scope_count: How many ``scope_unit`` s to inspect for detecting\n            an anomaly\n        :type scope_count: int\n\n        :param scope_unit: How far to look back in detecting an anomaly. Must\n            be one of \"hour\", \"day\", or \"week\"\n        :type scope_unit: str\n\n        :param increase_positive: Detect a positive increase for the anomaly. A\n            value of ``False`` results in detecting a decrease for the anomaly.\n        :type increase_positive: bool\n\n        :param percentage_change: The percentage of change to detect. Must be a\n            number between 0 and 100 (inclusive).\n        :type percentage_change: int\n\n        :param trigger_config: A AlertTriggerConfig describing how far back to\n            look back to compare to the anomaly scope.\n        :type trigger_config: :class:`AlertTriggerConfig<logentries_api.special_alerts.AlertTriggerConfig>`\n\n        :param logs: A list of log UUID's. (The 'key' key of a log)\n        :type logs: list of str\n\n        :param alert_reports: A list of AlertReportConfig to send alerts to\n        :type alert_reports: list of\n            :class:`AlertReportConfig<logentries_api.special_alerts.AlertReportConfig>`\n\n        :return: The API response of the alert creation\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException <logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries\n\n        .. _Leql: https://blog.logentries.com/2015/06/introducing-leql/\n\n        \"\"\"\n        arg_10 = '{pos}{change}'.format(\n            pos='+' if arg_5 else '-',\n            arg_10=str(arg_6)\n        )\n\n        arg_11 = arg_0._Func_scheduled_query(\n            arg_2=arg_2,\n            arg_10=arg_10,\n            arg_4=arg_4,\n            arg_3=arg_3,\n        )\n\n        arg_12 = arg_11.get('scheduled_query', {}).get('id')\n\n        arg_13 = {\n            'tag': {\n                'actions': [\n                    alert_report.to_dict()\n                    for alert_report\n                    in arg_9\n                ],\n                'name': arg_1,\n                'scheduled_query_id': arg_12,\n                'sources': [\n                    {'id': log}\n                    for log\n                    in arg_8\n                ],\n                'sub_type': 'AnomalyAlert',\n                'type': 'AlertNotify'\n            }\n        }\n        arg_13['tag'].update(arg_7.to_dict())\n\n        arg_14 = 'https://logentries.com/rest/{account_id}/api/tags'.format(\n            account_id=arg_0.account_id\n        )\n\n        return arg_0._api_post(\n            url=arg_14,\n            data=json.dumps(arg_13, sort_keys=True),\n        )", "path": "logentries_api/special_alerts.py", "identifier": "AnomalyAlert.create", "docstring": "Create an anomaly alert. This call makes 2 requests, one to create a\n        \"scheduled_query\", and another to create the alert.\n\n        :param name: The name for the alert\n        :type name: str\n\n        :param query: The `LEQL`_ query to use for detecting anomalies. Must\n            result in a numerical value, so it should look something like\n            ``where(...) calculate(COUNT)``\n        :type query: str\n\n        :param scope_count: How many ``scope_unit`` s to inspect for detecting\n            an anomaly\n        :type scope_count: int\n\n        :param scope_unit: How far to look back in detecting an anomaly. Must\n            be one of \"hour\", \"day\", or \"week\"\n        :type scope_unit: str\n\n        :param increase_positive: Detect a positive increase for the anomaly. A\n            value of ``False`` results in detecting a decrease for the anomaly.\n        :type increase_positive: bool\n\n        :param percentage_change: The percentage of change to detect. Must be a\n            number between 0 and 100 (inclusive).\n        :type percentage_change: int\n\n        :param trigger_config: A AlertTriggerConfig describing how far back to\n            look back to compare to the anomaly scope.\n        :type trigger_config: :class:`AlertTriggerConfig<logentries_api.special_alerts.AlertTriggerConfig>`\n\n        :param logs: A list of log UUID's. (The 'key' key of a log)\n        :type logs: list of str\n\n        :param alert_reports: A list of AlertReportConfig to send alerts to\n        :type alert_reports: list of\n            :class:`AlertReportConfig<logentries_api.special_alerts.AlertReportConfig>`\n\n        :return: The API response of the alert creation\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException <logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries\n\n        .. _Leql: https://blog.logentries.com/2015/06/introducing-leql/", "docstring_tokens": ["Create", "an", "anomaly", "alert", ".", "This", "call", "makes", "2", "requests", "one", "to", "create", "a", "scheduled_query", "and", "another", "to", "create", "the", "alert", "."], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 254533}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/matomo.py#L55-L72", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "Matomo tracking template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return MatomoNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "MatomoNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Matomo tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your Matomo domain (plus optional URI path), and tracked site ID\n    in the ``MATOMO_DOMAIN_PATH`` and the ``MATOMO_SITE_ID`` setting.\n\n    Custom variables can be passed in the ``Func_vars`` context\n    variable.  It is an iterable of custom variables as tuples like:\n    ``(index, name, value[, scope])`` where scope may be ``'page'``\n    (default) or ``'visit'``.  Index should be an integer and the\n    other parameters should be strings.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return MatomoNode()", "path": "analytical/templatetags/matomo.py", "identifier": "matomo", "docstring": "Matomo tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your Matomo domain (plus optional URI path), and tracked site ID\n    in the ``MATOMO_DOMAIN_PATH`` and the ``MATOMO_SITE_ID`` setting.\n\n    Custom variables can be passed in the ``matomo_vars`` context\n    variable.  It is an iterable of custom variables as tuples like:\n    ``(index, name, value[, scope])`` where scope may be ``'page'``\n    (default) or ``'visit'``.  Index should be an integer and the\n    other parameters should be strings.", "docstring_tokens": ["Matomo", "tracking", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 254534}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L3157-L3222", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Reports for long function bodies.", "language": "python", "parameters": "(filename, clean_lines, linenum,\n                            function_state, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_1", ".", "lines", "arg_6", "=", "arg_5", "[", "arg_2", "]", "arg_7", "=", "''", "arg_8", "=", "False", "arg_9", "=", "r'(\\w(\\w|::|\\*|\\&|\\s)*)\\('", "arg_10", "=", "Match", "(", "arg_9", ",", "arg_6", ")", "if", "arg_10", ":", "arg_11", "=", "arg_10", ".", "group", "(", "1", ")", ".", "split", "(", ")", "[", "-", "1", "]", "if", "arg_11", "==", "'TEST'", "or", "arg_11", "==", "'TEST_F'", "or", "(", "not", "Match", "(", "r'[A-Z_]+$'", ",", "arg_11", ")", ")", ":", "arg_8", "=", "True", "if", "arg_8", ":", "arg_12", "=", "False", "for", "arg_13", "in", "range", "(", "arg_2", ",", "arg_1", ".", "NumLines", "(", ")", ")", ":", "arg_14", "=", "arg_5", "[", "arg_13", "]", "arg_7", "+=", "' '", "+", "arg_14", ".", "lstrip", "(", ")", "if", "Search", "(", "r'(;|})'", ",", "arg_14", ")", ":", "arg_12", "=", "True", "break", "elif", "Search", "(", "r'{'", ",", "arg_14", ")", ":", "arg_12", "=", "True", "arg_15", "=", "Search", "(", "r'((\\w|:)*)\\('", ",", "arg_6", ")", ".", "group", "(", "1", ")", "if", "Match", "(", "r'TEST'", ",", "arg_15", ")", ":", "arg_16", "=", "Search", "(", "r'(\\(.*\\))'", ",", "arg_7", ")", "if", "arg_16", ":", "arg_15", "+=", "arg_16", ".", "group", "(", "1", ")", "else", ":", "arg_15", "+=", "'()'", "arg_3", ".", "Begin", "(", "arg_15", ")", "break", "if", "not", "arg_12", ":", "arg_4", "(", "arg_0", ",", "arg_2", ",", "'readability/fn_size'", ",", "5", ",", "'Lint failed to find start of function body.'", ")", "elif", "Match", "(", "r'^\\}\\s*$'", ",", "arg_6", ")", ":", "arg_3", ".", "Check", "(", "arg_4", ",", "arg_0", ",", "arg_2", ")", "arg_3", ".", "End", "(", ")", "elif", "not", "Match", "(", "r'^\\s*$'", ",", "arg_6", ")", ":", "arg_3", ".", "Count", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                            arg_3, arg_4):\n  \"\"\"Reports for long function bodies.\n\n  For an overview why this is done, see:\n  https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions\n\n  Uses a simplistic algorithm assuming other style guidelines\n  (especially spacing) are followed.\n  Only checks unindented functions, so class members are unchecked.\n  Trivial bodies are unchecked, so constructors with huge initializer lists\n  may be missed.\n  Blank/comment lines are not counted so as to avoid encouraging the removal\n  of vertical space and comments just to get through a lint check.\n  NOLINT *on the last line of a function* disables this check.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    function_state: Current function name and lines in body so far.\n    error: The function to call with any errors found.\n  \"\"\"\n  arg_5 = arg_1.lines\n  arg_6 = arg_5[arg_2]\n  arg_7 = ''\n\n  arg_8 = False\n  arg_9 = r'(\\w(\\w|::|\\*|\\&|\\s)*)\\('  # decls * & space::name( ...\n  arg_10 = Match(arg_9, arg_6)\n  if arg_10:\n    # If the name is all caps and underscores, figure it's a macro and\n    # ignore it, unless it's TEST or TEST_F.\n    arg_11 = arg_10.group(1).split()[-1]\n    if arg_11 == 'TEST' or arg_11 == 'TEST_F' or (\n        not Match(r'[A-Z_]+$', arg_11)):\n      arg_8 = True\n\n  if arg_8:\n    arg_12 = False\n    for arg_13 in range(arg_2, arg_1.NumLines()):\n      arg_14 = arg_5[arg_13]\n      arg_7 += ' ' + arg_14.lstrip()\n      if Search(r'(;|})', arg_14):  # Declarations and trivial functions\n        arg_12 = True\n        break                              # ... ignore\n      elif Search(r'{', arg_14):\n        arg_12 = True\n        arg_15 = Search(r'((\\w|:)*)\\(', arg_6).group(1)\n        if Match(r'TEST', arg_15):    # Handle TEST... macros\n          arg_16 = Search(r'(\\(.*\\))', arg_7)\n          if arg_16:             # Ignore bad syntax\n            arg_15 += arg_16.group(1)\n        else:\n          arg_15 += '()'\n        arg_3.Begin(arg_15)\n        break\n    if not arg_12:\n      # No body for the function (or evidence of a non-function) was found.\n      arg_4(arg_0, arg_2, 'readability/fn_size', 5,\n            'Lint failed to find start of function body.')\n  elif Match(r'^\\}\\s*$', arg_6):  # function end\n    arg_3.Check(arg_4, arg_0, arg_2)\n    arg_3.End()\n  elif not Match(r'^\\s*$', arg_6):\n    arg_3.Count()", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckForFunctionLengths", "docstring": "Reports for long function bodies.\n\n  For an overview why this is done, see:\n  https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions\n\n  Uses a simplistic algorithm assuming other style guidelines\n  (especially spacing) are followed.\n  Only checks unindented functions, so class members are unchecked.\n  Trivial bodies are unchecked, so constructors with huge initializer lists\n  may be missed.\n  Blank/comment lines are not counted so as to avoid encouraging the removal\n  of vertical space and comments just to get through a lint check.\n  NOLINT *on the last line of a function* disables this check.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    function_state: Current function name and lines in body so far.\n    error: The function to call with any errors found.", "docstring_tokens": ["Reports", "for", "long", "function", "bodies", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254535}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/remotetokens.py#L37-L48", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Dump the remote tokens as a list of dictionaries.", "language": "python", "parameters": "(rt, from_date, with_json=True, latest_only=False, **kwargs)", "return_statement": "return dict(id_remote_account=rt.id_remote_account,\n                token_type=rt.token_type,\n                access_token=rt.access_token,\n                secret=rt.secret)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "return", "dict", "(", "id_remote_account", "=", "arg_0", ".", "id_remote_account", ",", "token_type", "=", "arg_0", ".", "token_type", ",", "access_token", "=", "arg_0", ".", "access_token", ",", "secret", "=", "arg_0", ".", "secret", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=False, **arg_4):\n    \"\"\"Dump the remote tokens as a list of dictionaries.\n\n    :param ra: Remote toekn to be Funced.\n    :type ra: `invenio_oauthclient.models.RemoteToken [Invenio2.x]`\n    :returns: Remote tokens serialized to dictionary.\n    :rtype: dict\n    \"\"\"\n    return dict(id_remote_account=arg_0.id_remote_account,\n                token_type=arg_0.token_type,\n                access_token=arg_0.access_token,\n                secret=arg_0.secret)", "path": "invenio_migrator/legacy/remotetokens.py", "identifier": "dump", "docstring": "Dump the remote tokens as a list of dictionaries.\n\n    :param ra: Remote toekn to be dumped.\n    :type ra: `invenio_oauthclient.models.RemoteToken [Invenio2.x]`\n    :returns: Remote tokens serialized to dictionary.\n    :rtype: dict", "docstring_tokens": ["Dump", "the", "remote", "tokens", "as", "a", "list", "of", "dictionaries", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 254536}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/internal/slice_sampler_utils.py#L379-L431", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "For a given x position in each Markov chain, returns the next x.", "language": "python", "parameters": "(target_log_prob, x_initial, step_size=0.01,\n                          max_doublings=30, seed=None, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.01", ",", "arg_3", "=", "30", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_5", ",", "'Func'", ",", "[", "arg_1", ",", "arg_2", ",", "arg_3", "]", ")", ":", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ")", "arg_6", "=", "arg_1", ".", "dtype", ".", "base_dtype", "arg_7", "=", "arg_0", "(", "arg_1", ")", "-", "tf", ".", "random", ".", "gamma", "(", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", ",", "alpha", "=", "1", ",", "arg_6", "=", "arg_6", ",", "arg_4", "=", "arg_4", ")", "arg_8", ",", "arg_9", ",", "arg_10", "=", "slice_bounds_by_doubling", "(", "arg_1", ",", "arg_0", ",", "arg_7", ",", "arg_3", ",", "arg_2", ",", "arg_4", "=", "arg_4", ")", "arg_11", "=", "_sample_with_shrinkage", "(", "arg_1", ",", "arg_0", "=", "arg_0", ",", "arg_7", "=", "arg_7", ",", "arg_2", "=", "arg_2", ",", "arg_9", "=", "arg_9", ",", "arg_8", "=", "arg_8", ",", "arg_4", "=", "arg_4", ")", "return", "(", "arg_11", ",", "arg_0", "(", "arg_11", ")", ",", "arg_10", ",", "arg_8", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.01,\n                          arg_3=30, arg_4=None, arg_5=None):\n  \"\"\"For a given x position in each Markov chain, returns the next x.\n\n  Applies the one dimensional slice sampling algorithm as defined in Neal (2003)\n  to an input tensor x of shape (num_chains,) where num_chains is the number of\n  simulataneous Markov chains, and returns the next tensor x of shape\n  (num_chains,) when these chains are evolved by the slice sampling algorithm.\n\n  Args:\n    target_log_prob: Callable accepting a tensor like `x_initial` and returning\n      a tensor containing the log density at that point of the same shape.\n    x_initial: A tensor of any shape. The initial positions of the chains. This\n      function assumes that all the dimensions of `x_initial` are batch\n      dimensions (i.e. the event shape is `[]`).\n    step_size: A tensor of shape and dtype compatible with `x_initial`. The min\n      interval size in the doubling algorithm.\n    max_doublings: Scalar tensor of dtype `tf.int32`. The maximum number of\n      doublings to try to find the slice bounds.\n    seed: (Optional) positive int. The random seed. If None, no seed is set.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'find_slice_bounds').\n\n  Returns:\n    retval: A tensor of the same shape and dtype as `x_initial`. The next state\n      of the Markov chain.\n    next_target_log_prob: The target log density evaluated at `retval`.\n    bounds_satisfied: A tensor of bool dtype and shape batch dimensions.\n    upper_bounds: Tensor of the same shape and dtype as `x_initial`. The upper\n      bounds for the slice found.\n    lower_bounds: Tensor of the same shape and dtype as `x_initial`. The lower\n      bounds for the slice found.\n  \"\"\"\n  with tf.compat.v1.name_scope(arg_5, 'Func',\n                               [arg_1, arg_2, arg_3]):\n    arg_1 = tf.convert_to_tensor(value=arg_1)\n    # Obtain the input dtype of the array.\n    arg_6 = arg_1.dtype.base_dtype\n    # Select the height of the slice. Tensor of shape x_initial.shape.\n    arg_7 = arg_0(arg_1) - tf.random.gamma(\n        tf.shape(input=arg_1), alpha=1, arg_6=arg_6, arg_4=arg_4)\n    # Given the above x and slice heights, compute the bounds of the slice for\n    # each chain.\n    arg_8, arg_9, arg_10 = slice_bounds_by_doubling(\n        arg_1, arg_0, arg_7, arg_3, arg_2,\n        arg_4=arg_4)\n    arg_11 = _sample_with_shrinkage(arg_1, arg_0=arg_0,\n                                    arg_7=arg_7,\n                                    arg_2=arg_2,\n                                    arg_9=arg_9,\n                                    arg_8=arg_8, arg_4=arg_4)\n    return (arg_11, arg_0(arg_11), arg_10,\n            arg_8, arg_9)", "path": "tensorflow_probability/python/mcmc/internal/slice_sampler_utils.py", "identifier": "slice_sampler_one_dim", "docstring": "For a given x position in each Markov chain, returns the next x.\n\n  Applies the one dimensional slice sampling algorithm as defined in Neal (2003)\n  to an input tensor x of shape (num_chains,) where num_chains is the number of\n  simulataneous Markov chains, and returns the next tensor x of shape\n  (num_chains,) when these chains are evolved by the slice sampling algorithm.\n\n  Args:\n    target_log_prob: Callable accepting a tensor like `x_initial` and returning\n      a tensor containing the log density at that point of the same shape.\n    x_initial: A tensor of any shape. The initial positions of the chains. This\n      function assumes that all the dimensions of `x_initial` are batch\n      dimensions (i.e. the event shape is `[]`).\n    step_size: A tensor of shape and dtype compatible with `x_initial`. The min\n      interval size in the doubling algorithm.\n    max_doublings: Scalar tensor of dtype `tf.int32`. The maximum number of\n      doublings to try to find the slice bounds.\n    seed: (Optional) positive int. The random seed. If None, no seed is set.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'find_slice_bounds').\n\n  Returns:\n    retval: A tensor of the same shape and dtype as `x_initial`. The next state\n      of the Markov chain.\n    next_target_log_prob: The target log density evaluated at `retval`.\n    bounds_satisfied: A tensor of bool dtype and shape batch dimensions.\n    upper_bounds: Tensor of the same shape and dtype as `x_initial`. The upper\n      bounds for the slice found.\n    lower_bounds: Tensor of the same shape and dtype as `x_initial`. The lower\n      bounds for the slice found.", "docstring_tokens": ["For", "a", "given", "x", "position", "in", "each", "Markov", "chain", "returns", "the", "next", "x", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254537}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py#L289-L332", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates a new Azure SQL Database.", "language": "python", "parameters": "(self, server_name, name, service_objective_id,\n                        edition=None, collation_name=None,\n                        max_size_bytes=None)", "return_statement": "return self._perform_post(\n            self._get_databases_path(server_name),\n            _SqlManagementXmlSerializer.create_database_to_xml(\n                name, service_objective_id, edition, collation_name,\n                max_size_bytes\n            )\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "_validate_not_none", "(", "'server_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'name'", ",", "arg_2", ")", "_validate_not_none", "(", "'service_objective_id'", ",", "arg_3", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_databases_path", "(", "arg_1", ")", ",", "_SqlManagementXmlSerializer", ".", "Func_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                        arg_4=None, arg_5=None,\n                        arg_6=None):\n        '''\n        Creates a new Azure SQL Database.\n\n        server_name:\n            Name of the server to contain the new database.\n        name:\n            Required. The name for the new database. See Naming Requirements\n            in Azure SQL Database General Guidelines and Limitations and\n            Database Identifiers for more information.\n        service_objective_id:\n            Required. The GUID corresponding to the performance level for\n            Edition. See List Service Level Objectives for current values.\n        edition:\n            Optional. The Service Tier (Edition) for the new database. If\n            omitted, the default is Web. Valid values are Web, Business,\n            Basic, Standard, and Premium. See Azure SQL Database Service Tiers\n            (Editions) and Web and Business Edition Sunset FAQ for more\n            information.\n        collation_name:\n            Optional. The database collation. This can be any collation\n            supported by SQL. If omitted, the default collation is used. See\n            SQL Server Collation Support in Azure SQL Database General\n            Guidelines and Limitations for more information.\n        max_size_bytes:\n            Optional. Sets the maximum size, in bytes, for the database. This\n            value must be within the range of allowed values for Edition. If\n            omitted, the default value for the edition is used. See Azure SQL\n            Database Service Tiers (Editions) for current maximum databases\n            sizes. Convert MB or GB values to bytes.\n            1 MB = 1048576 bytes. 1 GB = 1073741824 bytes.\n        '''\n        _validate_not_none('server_name', arg_1)\n        _validate_not_none('name', arg_2)\n        _validate_not_none('service_objective_id', arg_3)\n        return arg_0._perform_post(\n            arg_0._get_databases_path(arg_1),\n            _SqlManagementXmlSerializer.Func_to_xml(\n                arg_2, arg_3, arg_4, arg_5,\n                arg_6\n            )\n        )", "path": "azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py", "identifier": "SqlDatabaseManagementService.create_database", "docstring": "Creates a new Azure SQL Database.\n\n        server_name:\n            Name of the server to contain the new database.\n        name:\n            Required. The name for the new database. See Naming Requirements\n            in Azure SQL Database General Guidelines and Limitations and\n            Database Identifiers for more information.\n        service_objective_id:\n            Required. The GUID corresponding to the performance level for\n            Edition. See List Service Level Objectives for current values.\n        edition:\n            Optional. The Service Tier (Edition) for the new database. If\n            omitted, the default is Web. Valid values are Web, Business,\n            Basic, Standard, and Premium. See Azure SQL Database Service Tiers\n            (Editions) and Web and Business Edition Sunset FAQ for more\n            information.\n        collation_name:\n            Optional. The database collation. This can be any collation\n            supported by SQL. If omitted, the default collation is used. See\n            SQL Server Collation Support in Azure SQL Database General\n            Guidelines and Limitations for more information.\n        max_size_bytes:\n            Optional. Sets the maximum size, in bytes, for the database. This\n            value must be within the range of allowed values for Edition. If\n            omitted, the default value for the edition is used. See Azure SQL\n            Database Service Tiers (Editions) for current maximum databases\n            sizes. Convert MB or GB values to bytes.\n            1 MB = 1048576 bytes. 1 GB = 1073741824 bytes.", "docstring_tokens": ["Creates", "a", "new", "Azure", "SQL", "Database", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254538}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L558-L585", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Implementation of 'coverage run'.", "language": "python", "parameters": "(self, options, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_5", ".", "path", "[", "0", "]", "arg_0", ".", "coverage", ".", "start", "(", ")", "arg_4", "=", "True", "try", ":", "try", ":", "if", "arg_1", ".", "module", ":", "arg_5", ".", "path", "[", "0", "]", "=", "''", "arg_0", ".", "run_python_module", "(", "arg_2", "[", "0", "]", ",", "arg_2", ")", "else", ":", "arg_7", "=", "arg_2", "[", "0", "]", "arg_5", ".", "path", "[", "0", "]", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "arg_7", ")", ")", "arg_0", ".", "run_python_file", "(", "arg_7", ",", "arg_2", ")", "except", "NoSource", ":", "arg_4", "=", "False", "raise", "finally", ":", "arg_0", ".", "coverage", ".", "stop", "(", ")", "if", "arg_4", ":", "arg_0", ".", "coverage", ".", "save", "(", ")", "arg_5", ".", "path", "[", "0", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Implementation of 'coverage run'.\"\"\"\n\n        # Set the first path element properly.\n        arg_3 = arg_5.path[0]\n\n        # Run the script.\n        arg_0.coverage.start()\n        arg_4 = True\n        try:\n            try:\n                if arg_1.module:\n                    arg_5.path[0] = ''\n                    arg_0.run_python_module(arg_2[0], arg_2)\n                else:\n                    arg_7 = arg_2[0]\n                    arg_5.path[0] = os.path.abspath(os.path.dirname(arg_7))\n                    arg_0.run_python_file(arg_7, arg_2)\n            except NoSource:\n                arg_4 = False\n                raise\n        finally:\n            arg_0.coverage.stop()\n            if arg_4:\n                arg_0.coverage.save()\n\n            # Restore the old path\n            arg_5.path[0] = arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py", "identifier": "CoverageScript.do_execute", "docstring": "Implementation of 'coverage run'.", "docstring_tokens": ["Implementation", "of", "coverage", "run", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 254539}
{"url": "https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L265-L271", "sha": "2092b0cb30898139a247176bcf433d5a4abde7cb", "docstring_summary": "Called when there is an error in the websocket", "language": "python", "parameters": "(self, ws, err)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "logging", ".", "debug", "(", "\"ConnectorDB:WS: Connection Error\"", ")", "if", "arg_0", ".", "status", "==", "\"connecting\"", ":", "arg_0", ".", "status", "=", "\"errored\"", "arg_0", ".", "ws_openlock", ".", "release", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Called when there is an error in the websocket\"\"\"\n        logging.debug(\"ConnectorDB:WS: Connection Error\")\n\n        if arg_0.status == \"connecting\":\n            arg_0.status = \"errored\"\n            arg_0.ws_openlock.release()", "path": "connectordb/_websocket.py", "identifier": "WebsocketHandler.__on_error", "docstring": "Called when there is an error in the websocket", "docstring_tokens": ["Called", "when", "there", "is", "an", "error", "in", "the", "websocket"], "nwo": "connectordb/connectordb-python", "score": 0.25890992733444657, "idx": 254540}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L290-L319", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Update a data set.", "language": "python", "parameters": "(self, dataset_id, name=None, description=None, public=None)", "return_statement": "return _dataset_from_response_dict(response)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "{", "\"public\"", ":", "_convert_bool_to_public_value", "(", "arg_4", ")", "}", "if", "arg_2", ":", "arg_5", "[", "\"name\"", "]", "=", "arg_2", "if", "arg_3", ":", "arg_5", "[", "\"description\"", "]", "=", "arg_3", "arg_6", "=", "{", "\"dataset\"", ":", "arg_5", "}", "arg_7", "=", "\"Failed to update dataset {}\"", ".", "format", "(", "arg_1", ")", "arg_8", "=", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_post_json", "(", "routes", ".", "Func", "(", "arg_1", ")", ",", "arg_5", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", ")", "return", "_dataset_from_response_dict", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"\n        Update a data set.\n\n        :param dataset_id: The ID of the dataset to update\n        :type dataset_id: int\n        :param name: name of the dataset\n        :type name: str\n        :param description: description for the dataset\n        :type description: str\n        :param public: A boolean indicating whether or not the dataset should\n            be public.\n        :type public: bool\n        :return: The updated dataset.\n        :rtype: :class:`Dataset`\n        \"\"\"\n        arg_5 = {\n            \"public\": _convert_bool_to_public_value(arg_4)\n        }\n\n        if arg_2:\n            arg_5[\"name\"] = arg_2\n        if arg_3:\n            arg_5[\"description\"] = arg_3\n\n        arg_6 = {\"dataset\": arg_5}\n        arg_7 = \"Failed to update dataset {}\".format(arg_1)\n        arg_8 = arg_0._get_success_json(arg_0._post_json(routes.Func(arg_1), arg_5=arg_6, arg_7=arg_7))\n\n        return _dataset_from_response_dict(arg_8)", "path": "citrination_client/data/client.py", "identifier": "DataClient.update_dataset", "docstring": "Update a data set.\n\n        :param dataset_id: The ID of the dataset to update\n        :type dataset_id: int\n        :param name: name of the dataset\n        :type name: str\n        :param description: description for the dataset\n        :type description: str\n        :param public: A boolean indicating whether or not the dataset should\n            be public.\n        :type public: bool\n        :return: The updated dataset.\n        :rtype: :class:`Dataset`", "docstring_tokens": ["Update", "a", "data", "set", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 254541}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L217-L223", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return a module by its name, raise KeyError if not found", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "Funcs", "(", ")", ":", "if", "arg_2", ".", "node", ".", "name", "==", "arg_1", ":", "return", "arg_2", "raise", "KeyError", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"return a Func by its name, raise KeyError if not found\n        \"\"\"\n        for arg_2 in arg_0.Funcs():\n            if arg_2.node.name == arg_1:\n                return arg_2\n        raise KeyError(arg_1)", "path": "pylint/pyreverse/diagrams.py", "identifier": "PackageDiagram.module", "docstring": "return a module by its name, raise KeyError if not found", "docstring_tokens": ["return", "a", "module", "by", "its", "name", "raise", "KeyError", "if", "not", "found"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254542}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/file_info.py#L225-L241", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Input file list validation function. Checks that object is a list and\n    contains valid filepaths that can be processed by SoX.", "language": "python", "parameters": "(input_filepath_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "list", ")", ":", "raise", "TypeError", "(", "\"input_filepath_list must be a list.\"", ")", "elif", "len", "(", "arg_0", ")", "<", "2", ":", "raise", "ValueError", "(", "\"input_filepath_list must have at least 2 files.\"", ")", "for", "arg_1", "in", "arg_0", ":", "validate_input_file", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    '''Input file list validation function. Checks that object is a list and\n    contains valid filepaths that can be processed by SoX.\n\n    Parameters\n    ----------\n    input_filepath_list : list\n        A list of filepaths.\n\n    '''\n    if not isinstance(arg_0, list):\n        raise TypeError(\"input_filepath_list must be a list.\")\n    elif len(arg_0) < 2:\n        raise ValueError(\"input_filepath_list must have at least 2 files.\")\n\n    for arg_1 in arg_0:\n        validate_input_file(arg_1)", "path": "sox/file_info.py", "identifier": "validate_input_file_list", "docstring": "Input file list validation function. Checks that object is a list and\n    contains valid filepaths that can be processed by SoX.\n\n    Parameters\n    ----------\n    input_filepath_list : list\n        A list of filepaths.", "docstring_tokens": ["Input", "file", "list", "validation", "function", ".", "Checks", "that", "object", "is", "a", "list", "and", "contains", "valid", "filepaths", "that", "can", "be", "processed", "by", "SoX", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 254543}
{"url": "https://github.com/brandon-rhodes/python-jplephem/blob/48c99ce40c627e24c95479d8845e312ea168f567/jplephem/daf.py#L202-L255", "sha": "48c99ce40c627e24c95479d8845e312ea168f567", "docstring_summary": "Add a new array to the DAF file.", "language": "python", "parameters": "(self, name, values, array)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "file", "arg_5", "=", "arg_0", ".", "summary_control_struct", "arg_6", "=", "arg_0", ".", "bward", "arg_7", "=", "bytearray", "(", "arg_0", ".", "read_record", "(", "arg_6", ")", ")", "arg_8", ",", "arg_9", ",", "arg_10", "=", "arg_5", ".", "unpack", "(", "arg_7", "[", ":", "24", "]", ")", "if", "arg_10", "<", "arg_0", ".", "summaries_per_record", ":", "arg_11", "=", "arg_6", "arg_12", "=", "arg_11", "+", "1", "arg_7", "[", ":", "24", "]", "=", "arg_5", ".", "pack", "(", "arg_8", ",", "arg_9", ",", "arg_10", "+", "1", ")", "arg_0", ".", "write_record", "(", "arg_11", ",", "arg_7", ")", "else", ":", "arg_11", "=", "(", "(", "arg_0", ".", "free", "-", "1", ")", "*", "8", "+", "1023", ")", "//", "1024", "+", "1", "arg_12", "=", "arg_11", "+", "1", "arg_13", "=", "arg_11", "+", "2", "arg_10", "=", "0", "arg_7", "[", ":", "24", "]", "=", "arg_5", ".", "pack", "(", "arg_11", ",", "arg_9", ",", "arg_10", ")", "arg_0", ".", "write_record", "(", "arg_6", ",", "arg_7", ")", "arg_14", "=", "arg_5", ".", "pack", "(", "0", ",", "arg_6", ",", "1", ")", ".", "ljust", "(", "1024", ",", "b'\\0'", ")", "arg_15", "=", "b'\\0'", "*", "1024", "arg_0", ".", "write_record", "(", "arg_11", ",", "arg_14", ")", "arg_0", ".", "write_record", "(", "arg_12", ",", "arg_15", ")", "arg_0", ".", "bward", "=", "arg_11", "arg_0", ".", "free", "=", "(", "arg_13", "-", "1", ")", "*", "1024", "//", "8", "+", "1", "arg_18", "=", "arg_0", ".", "free", "arg_4", ".", "seek", "(", "(", "arg_18", "-", "1", ")", "*", "8", ")", "arg_3", "=", "numpy_array", "(", "arg_3", ")", "arg_4", ".", "write", "(", "arg_3", ".", "view", "(", ")", ")", "arg_19", "=", "arg_4", ".", "tell", "(", ")", "//", "8", "arg_0", ".", "free", "=", "arg_19", "+", "1", "arg_0", ".", "write_file_record", "(", ")", "arg_2", "=", "arg_2", "[", ":", "arg_0", ".", "nd", "+", "arg_0", ".", "ni", "-", "2", "]", "+", "(", "arg_18", ",", "arg_19", ")", "arg_20", "=", "1024", "*", "(", "arg_11", "-", "1", ")", "arg_21", "=", "int", "(", "arg_10", ")", "*", "arg_0", ".", "summary_step", "arg_4", ".", "seek", "(", "arg_20", "+", "arg_5", ".", "size", "+", "arg_21", ")", "arg_4", ".", "write", "(", "arg_0", ".", "summary_struct", ".", "pack", "(", "*", "arg_2", ")", ")", "arg_4", ".", "seek", "(", "arg_20", "+", "1024", "+", "arg_21", ")", "arg_4", ".", "write", "(", "arg_1", "[", ":", "arg_0", ".", "summary_length", "]", ".", "ljust", "(", "arg_0", ".", "summary_step", ",", "b' '", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Add a new array to the DAF file.\n\n        The summary will be initialized with the `name` and `values`,\n        and will have its start word and end word fields set to point to\n        where the `array` of floats has been appended to the file.\n\n        \"\"\"\n        arg_4 = arg_0.file\n        arg_5 = arg_0.summary_control_struct\n\n        arg_6 = arg_0.bward\n        arg_7 = bytearray(arg_0.read_record(arg_6))\n        arg_8, arg_9, arg_10 = arg_5.unpack(arg_7[:24])\n\n        if arg_10 < arg_0.summaries_per_record:\n            arg_11 = arg_6\n            arg_12 = arg_11 + 1\n            arg_7[:24] = arg_5.pack(arg_8, arg_9, arg_10 + 1)\n            arg_0.write_record(arg_11, arg_7)\n        else:\n            arg_11 = ((arg_0.free - 1) * 8 + 1023) // 1024 + 1\n            arg_12 = arg_11 + 1\n            arg_13 = arg_11 + 2\n\n            arg_10 = 0\n            arg_7[:24] = arg_5.pack(arg_11, arg_9, arg_10)\n            arg_0.write_record(arg_6, arg_7)\n\n            arg_14 = arg_5.pack(0, arg_6, 1).ljust(1024, b'\\0')\n            arg_15 = b'\\0' * 1024\n            arg_0.write_record(arg_11, arg_14)\n            arg_0.write_record(arg_12, arg_15)\n\n            arg_0.bward = arg_11\n            arg_0.free = (arg_13 - 1) * 1024 // 8 + 1\n\n        arg_18 = arg_0.free\n        arg_4.seek((arg_18 - 1) * 8)\n        arg_3 = numpy_array(arg_3)  # TODO: force correct endian\n        arg_4.write(arg_3.view())\n        arg_19 = arg_4.tell() // 8\n\n        arg_0.free = arg_19 + 1\n        arg_0.write_file_record()\n\n        arg_2 = arg_2[:arg_0.nd + arg_0.ni - 2] + (arg_18, arg_19)\n\n        arg_20 = 1024 * (arg_11 - 1)\n        arg_21 = int(arg_10) * arg_0.summary_step\n        arg_4.seek(arg_20 + arg_5.size + arg_21)\n        arg_4.write(arg_0.summary_struct.pack(*arg_2))\n        arg_4.seek(arg_20 + 1024 + arg_21)\n        arg_4.write(arg_1[:arg_0.summary_length].ljust(arg_0.summary_step, b' '))", "path": "jplephem/daf.py", "identifier": "DAF.add_array", "docstring": "Add a new array to the DAF file.\n\n        The summary will be initialized with the `name` and `values`,\n        and will have its start word and end word fields set to point to\n        where the `array` of floats has been appended to the file.", "docstring_tokens": ["Add", "a", "new", "array", "to", "the", "DAF", "file", "."], "nwo": "brandon-rhodes/python-jplephem", "score": 0.5471209855014023, "idx": 254544}
{"url": "https://github.com/controversial/livejson/blob/91021de60903d2d8b2cfb7d8d8910bcf27ec003b/livejson.py#L19-L40", "sha": "91021de60903d2d8b2cfb7d8d8910bcf27ec003b", "docstring_summary": "Initialize an empty JSON file.", "language": "python", "parameters": "(path, data=\"dict\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"dict\"", ")", ":", "arg_1", "=", "{", "}", "if", "arg_1", ".", "lower", "(", ")", "==", "\"dict\"", "else", "[", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "if", "arg_2", "and", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "raise", "IOError", "(", "(", "\"Could not initialize empty JSON file in non-existant \"", "\"directory '{}'\"", ")", ".", "format", "(", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", ")", ")", "with", "open", "(", "arg_0", ",", "\"w\"", ")", "as", "f", ":", "json", ".", "dump", "(", "arg_1", ",", "f", ")", "return", "True", "elif", "os", ".", "path", ".", "getsize", "(", "arg_0", ")", "==", "0", ":", "with", "open", "(", "arg_0", ",", "\"w\"", ")", "as", "f", ":", "json", ".", "dump", "(", "arg_1", ",", "f", ")", "else", ":", "return", "False"], "function": "def Func(arg_0, arg_1=\"dict\"):\n    \"\"\"Initialize an empty JSON file.\"\"\"\n    arg_1 = {} if arg_1.lower() == \"dict\" else []\n    # The file will need to be created if it doesn't exist\n    if not os.path.exists(arg_0):  # The file doesn't exist\n        # Raise exception if the directory that should contain the file doesn't\n        # exist\n        arg_2 = os.path.dirname(arg_0)\n        if arg_2 and not os.path.exists(arg_2):\n            raise IOError(\n                (\"Could not initialize empty JSON file in non-existant \"\n                 \"directory '{}'\").format(os.path.dirname(arg_0))\n            )\n        # Write an empty file there\n        with open(arg_0, \"w\") as f:\n            json.dump(arg_1, f)\n        return True\n    elif os.path.getsize(arg_0) == 0:  # The file is empty\n        with open(arg_0, \"w\") as f:\n            json.dump(arg_1, f)\n    else:  # The file exists and contains content\n        return False", "path": "livejson.py", "identifier": "_initfile", "docstring": "Initialize an empty JSON file.", "docstring_tokens": ["Initialize", "an", "empty", "JSON", "file", "."], "nwo": "controversial/livejson", "score": 0.28589442541680926, "idx": 254545}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1401-L1424", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Attaches a volume to a server.", "language": "python", "parameters": "(self, datacenter_id, server_id, volume_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "'{ \"id\": \"'", "+", "arg_3", "+", "'\" }'", "arg_5", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/servers/%s/volumes'", "%", "(", "arg_1", ",", "arg_2", ")", ",", "method", "=", "'POST'", ",", "arg_4", "=", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Attaches a volume to a server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      volume_id: The unique ID of the volume.\n        :type       volume_id: ``str``\n\n        \"\"\"\n        arg_4 = '{ \"id\": \"' + arg_3 + '\" }'\n\n        arg_5 = arg_0._perform_request(\n            url='/datacenters/%s/servers/%s/volumes' % (\n                arg_1,\n                arg_2),\n            method='POST',\n            arg_4=arg_4)\n\n        return arg_5", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.attach_volume", "docstring": "Attaches a volume to a server.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      server_id: The unique ID of the server.\n        :type       server_id: ``str``\n\n        :param      volume_id: The unique ID of the volume.\n        :type       volume_id: ``str``", "docstring_tokens": ["Attaches", "a", "volume", "to", "a", "server", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 254546}
{"url": "https://github.com/Numergy/yoda/blob/109f0e9441130488b0155f05883ef6531cf46ee9/yoda/subcommand/show.py#L40-L49", "sha": "109f0e9441130488b0155f05883ef6531cf46ee9", "docstring_summary": "Parse show subcommand.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "subFuncr", ".", "add_Funcr", "(", "\"show\"", ",", "help", "=", "\"Show workspace details\"", ",", "description", "=", "\"Show workspace details.\"", ")", "arg_2", "=", "arg_1", ".", "add_mutually_exclusive_group", "(", "required", "=", "True", ")", "arg_2", ".", "add_argument", "(", "'--all'", ",", "action", "=", "'store_true'", ",", "help", "=", "\"All workspaces\"", ")", "arg_2", ".", "add_argument", "(", "'name'", ",", "type", "=", "str", ",", "help", "=", "\"Workspace name\"", ",", "nargs", "=", "'?'", ")"], "function": "def Func(arg_0):\n        \"\"\"Parse show subcommand.\"\"\"\n        arg_1 = arg_0.subFuncr.add_Funcr(\n            \"show\",\n            help=\"Show workspace details\",\n            description=\"Show workspace details.\")\n\n        arg_2 = arg_1.add_mutually_exclusive_group(required=True)\n        arg_2.add_argument('--all', action='store_true', help=\"All workspaces\")\n        arg_2.add_argument('name', type=str, help=\"Workspace name\", nargs='?')", "path": "yoda/subcommand/show.py", "identifier": "Show.parse", "docstring": "Parse show subcommand.", "docstring_tokens": ["Parse", "show", "subcommand", "."], "nwo": "Numergy/yoda", "score": 0.1832591465193378, "idx": 254547}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/execution/threaded_runner.py#L188-L277", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "The target function for a thread, runs an agent and environment until signaled to stop.\n        Adds rewards to shared episode rewards list.", "language": "python", "parameters": "(self, thread_id, agent, environment, deterministic=False,\n                    max_episode_timesteps=-1, episode_finished=None, testing=False, sleep=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ",", "arg_5", "=", "-", "1", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ")", ":", "arg_9", "=", "False", "if", "arg_6", "is", "not", "None", "and", "len", "(", "getargspec", "(", "arg_6", ")", ".", "args", ")", "==", "1", ":", "arg_9", "=", "True", "arg_10", "=", "0", "while", "not", "arg_0", ".", "should_stop", ":", "arg_11", "=", "arg_3", ".", "reset", "(", ")", "arg_2", ".", "reset", "(", ")", "arg_0", ".", "global_timestep", ",", "arg_0", ".", "global_episode", "=", "arg_2", ".", "timestep", ",", "arg_2", ".", "episode", "arg_14", "=", "0", "arg_15", "=", "0", "arg_16", "=", "time", ".", "time", "(", ")", "while", "True", ":", "arg_17", ",", "arg_18", ",", "arg_19", "=", "arg_2", ".", "act", "(", "arg_19", "=", "arg_11", ",", "arg_4", "=", "arg_4", ",", "buffered", "=", "False", ")", "arg_20", "=", "0", "for", "arg_21", "in", "xrange", "(", "arg_0", ".", "repeat_actions", ")", ":", "arg_11", ",", "arg_22", ",", "arg_23", "=", "arg_3", ".", "execute", "(", "arg_17", "=", "arg_17", ")", "arg_20", "+=", "arg_23", "if", "arg_22", ":", "break", "if", "not", "arg_7", ":", "arg_2", ".", "atomic_observe", "(", "arg_19", "=", "arg_11", ",", "actions", "=", "arg_17", ",", "arg_18", "=", "arg_18", ",", "arg_20", "=", "arg_20", ",", "arg_22", "=", "arg_22", ")", "if", "arg_8", "is", "not", "None", ":", "time", ".", "sleep", "(", "arg_8", ")", "arg_15", "+=", "1", "arg_14", "+=", "arg_20", "if", "arg_22", "or", "arg_15", "==", "arg_5", ":", "break", "if", "arg_0", ".", "should_stop", ":", "return", "arg_0", ".", "global_timestep", "+=", "arg_15", "arg_0", ".", "episode_list_lock", ".", "acquire", "(", ")", "arg_0", ".", "episode_rewards", ".", "append", "(", "arg_14", ")", "arg_0", ".", "episode_timesteps", ".", "append", "(", "arg_15", ")", "arg_0", ".", "episode_times", ".", "append", "(", "time", ".", "time", "(", ")", "-", "arg_16", ")", "arg_0", ".", "episode_list_lock", ".", "release", "(", ")", "if", "arg_6", "is", "not", "None", ":", "if", "arg_9", ":", "arg_24", "=", "{", "\"thread_id\"", ":", "arg_1", ",", "\"episode\"", ":", "arg_10", ",", "\"timestep\"", ":", "arg_15", ",", "\"episode_reward\"", ":", "arg_14", "}", "if", "not", "arg_6", "(", "arg_24", ")", ":", "return", "elif", "not", "arg_6", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_10", "+=", "1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False,\n                    arg_5=-1, arg_6=None, arg_7=False, arg_8=None):\n        \"\"\"\n        The target function for a thread, runs an agent and environment until signaled to stop.\n        Adds rewards to shared episode rewards list.\n\n        Args:\n            thread_id (int): The ID of the thread that's running this target function.\n            agent (Agent): The Agent object that this particular thread uses.\n            environment (Environment): The Environment object that this particular thread uses.\n            max_episode_timesteps (int): Max. number of timesteps per episode. Use -1 or 0 for non-limited episodes.\n            episode_finished (callable): Function called after each episode that takes an episode summary spec and\n                returns False, if this single run should terminate after this episode.\n                Can be used e.g. to set a particular mean reward threshold.\n        \"\"\"\n\n        # figure out whether we are using the deprecated way of \"episode_finished\" reporting\n        arg_9 = False\n        if arg_6 is not None and len(getargspec(arg_6).args) == 1:\n            arg_9 = True\n\n        arg_10 = 0\n        # Run this single worker (episode loop) as long as global count thresholds have not been reached.\n        while not arg_0.should_stop:\n            arg_11 = arg_3.reset()\n            arg_2.reset()\n            arg_0.global_timestep, arg_0.global_episode = arg_2.timestep, arg_2.episode\n            arg_14 = 0\n\n            # Time step (within episode) loop\n            arg_15 = 0\n            arg_16 = time.time()\n            while True:\n                arg_17, arg_18, arg_19 = arg_2.act(arg_19=arg_11, arg_4=arg_4, buffered=False)\n                arg_20 = 0\n                for arg_21 in xrange(arg_0.repeat_actions):\n                    arg_11, arg_22, arg_23 = arg_3.execute(arg_17=arg_17)\n                    arg_20 += arg_23\n                    if arg_22:\n                        break\n\n                if not arg_7:\n                    # agent.observe(reward=reward, terminal=terminal)\n                    # Insert everything at once.\n                    arg_2.atomic_observe(\n                        arg_19=arg_11,\n                        actions=arg_17,\n                        arg_18=arg_18,\n                        arg_20=arg_20,\n                        arg_22=arg_22\n                    )\n\n                if arg_8 is not None:\n                    time.sleep(arg_8)\n\n                arg_15 += 1\n                arg_14 += arg_20\n\n                if arg_22 or arg_15 == arg_5:\n                    break\n\n                # Abort the episode (discard its results) when global says so.\n                if arg_0.should_stop:\n                    return\n\n            arg_0.global_timestep += arg_15\n\n            # Avoid race condition where order in episode_rewards won't match order in episode_timesteps.\n            arg_0.episode_list_lock.acquire()\n            arg_0.episode_rewards.append(arg_14)\n            arg_0.episode_timesteps.append(arg_15)\n            arg_0.episode_times.append(time.time() - arg_16)\n            arg_0.episode_list_lock.release()\n\n            if arg_6 is not None:\n                # old way of calling episode_finished\n                if arg_9:\n                    arg_24 = {\n                        \"thread_id\": arg_1,\n                        \"episode\": arg_10,\n                        \"timestep\": arg_15,\n                        \"episode_reward\": arg_14\n                    }\n                    if not arg_6(arg_24):\n                        return\n                # New way with BasicRunner (self) and thread-id.\n                elif not arg_6(arg_0, arg_1):\n                    return\n\n            arg_10 += 1", "path": "tensorforce/execution/threaded_runner.py", "identifier": "ThreadedRunner._run_single", "docstring": "The target function for a thread, runs an agent and environment until signaled to stop.\n        Adds rewards to shared episode rewards list.\n\n        Args:\n            thread_id (int): The ID of the thread that's running this target function.\n            agent (Agent): The Agent object that this particular thread uses.\n            environment (Environment): The Environment object that this particular thread uses.\n            max_episode_timesteps (int): Max. number of timesteps per episode. Use -1 or 0 for non-limited episodes.\n            episode_finished (callable): Function called after each episode that takes an episode summary spec and\n                returns False, if this single run should terminate after this episode.\n                Can be used e.g. to set a particular mean reward threshold.", "docstring_tokens": ["The", "target", "function", "for", "a", "thread", "runs", "an", "agent", "and", "environment", "until", "signaled", "to", "stop", ".", "Adds", "rewards", "to", "shared", "episode", "rewards", "list", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 254548}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/controllers.py#L141-L147", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Preprocess a panel of genes.", "language": "python", "parameters": "(store, panel_obj)", "return_statement": "return dict(panel=panel_obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "[", "'institute'", "]", "=", "arg_0", ".", "institute", "(", "arg_1", "[", "'institute'", "]", ")", "arg_2", "=", "\"{}({})\"", ".", "format", "(", "arg_1", "[", "'display_name'", "]", ",", "arg_1", "[", "'version'", "]", ")", "arg_1", "[", "'name_and_version'", "]", "=", "arg_2", "return", "dict", "(", "panel", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Preprocess a panel of genes.\"\"\"\n    arg_1['institute'] = arg_0.institute(arg_1['institute'])\n    arg_2 = \"{}({})\".format(arg_1['display_name'], arg_1['version'])\n    arg_1['name_and_version'] = arg_2\n\n    return dict(panel=arg_1)", "path": "scout/server/blueprints/panels/controllers.py", "identifier": "panel_export", "docstring": "Preprocess a panel of genes.", "docstring_tokens": ["Preprocess", "a", "panel", "of", "genes", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254549}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L55-L76", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Searches the elasticsearch instance to retrieve the requested documents.", "language": "python", "parameters": "(self, number=None, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "Func", "=", "arg_0", ".", "create_search", "(", "*", "arg_2", ",", "**", "arg_3", ")", "try", ":", "if", "arg_1", ":", "arg_5", "=", "Func", "[", "0", ":", "arg_1", "]", "else", ":", "arg_2", ",", "arg_6", "=", "arg_0", ".", "core_parser", ".", "parse_known_args", "(", ")", "if", "arg_2", ".", "number", ":", "arg_5", "=", "Func", "[", "0", ":", "arg_2", ".", "number", "]", "else", ":", "arg_5", "=", "Func", ".", "scan", "(", ")", "return", "[", "arg_7", "for", "arg_7", "in", "arg_5", "]", "except", "NotFoundError", ":", "print_error", "(", "\"The index was not found, have you initialized the index?\"", ")", "return", "[", "]", "except", "(", "ConnectionError", ",", "TransportError", ")", ":", "print_error", "(", "\"Cannot connect to elasticsearch\"", ")", "return", "[", "]"], "function": "def Func(arg_0, arg_1=None, *arg_2, **arg_3):\n        \"\"\"\n            Searches the elasticsearch instance to retrieve the requested documents.\n        \"\"\"\n        Func = arg_0.create_search(*arg_2, **arg_3)\n        try:\n            if arg_1:\n                arg_5 = Func[0:arg_1]\n            else:\n                arg_2, arg_6 = arg_0.core_parser.parse_known_args()\n                if arg_2.number:\n                    arg_5 = Func[0:arg_2.number]\n                else:\n                    arg_5 = Func.scan()\n\n            return [arg_7 for arg_7 in arg_5]\n        except NotFoundError:\n            print_error(\"The index was not found, have you initialized the index?\")\n            return []\n        except (ConnectionError, TransportError):\n            print_error(\"Cannot connect to elasticsearch\")\n            return []", "path": "jackal/core.py", "identifier": "CoreSearch.search", "docstring": "Searches the elasticsearch instance to retrieve the requested documents.", "docstring_tokens": ["Searches", "the", "elasticsearch", "instance", "to", "retrieve", "the", "requested", "documents", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 254550}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-network/azure/mgmt/network/v2018_04_01/operations/vpn_sites_configuration_operations.py#L83-L133", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gives the sas-url to download the configurations for vpn-sites in a\n        resource group.", "language": "python", "parameters": "(\n            self, resource_group_name, virtual_wan_name, vpn_sites=None, output_blob_sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "True", ",", "**", "arg_8", ")", ":", "arg_9", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "True", ",", "**", "arg_8", ")", "def", "get_long_running_output", "(", "arg_10", ")", ":", "if", "arg_6", ":", "arg_11", "=", "ClientRawResponse", "(", "None", ",", "arg_10", ")", "return", "arg_11", "arg_12", "=", "arg_8", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_7", "is", "True", ":", "arg_13", "=", "ARMPolling", "(", "arg_12", ",", "**", "arg_8", ")", "elif", "arg_7", "is", "False", ":", "arg_13", "=", "NoPolling", "(", ")", "else", ":", "arg_13", "=", "arg_7", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_9", ",", "get_long_running_output", ",", "arg_13", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=False, arg_7=True, **arg_8):\n        \"\"\"Gives the sas-url to Func the configurations for vpn-sites in a\n        resource group.\n\n        :param resource_group_name: The resource group name.\n        :type resource_group_name: str\n        :param virtual_wan_name: The name of the VirtualWAN for which\n         configuration of all vpn-sites is needed.\n        :type virtual_wan_name: str\n        :param vpn_sites: List of resource-ids of the vpn-sites for which\n         config is to be Funced.\n        :type vpn_sites:\n         list[~azure.mgmt.network.v2018_04_01.models.SubResource]\n        :param output_blob_sas_url: The sas-url to Func the configurations\n         for vpn-sites\n        :type output_blob_sas_url: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.network.v2018_04_01.models.ErrorException>`\n        \"\"\"\n        arg_9 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_6=True,\n            **arg_8\n        )\n\n        def get_long_running_output(arg_10):\n            if arg_6:\n                arg_11 = ClientRawResponse(None, arg_10)\n                return arg_11\n\n        arg_12 = arg_8.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_7 is True: arg_13 = ARMPolling(arg_12, **arg_8)\n        elif arg_7 is False: arg_13 = NoPolling()\n        else: arg_13 = arg_7\n        return LROPoller(arg_0._client, arg_9, get_long_running_output, arg_13)", "path": "azure-mgmt-network/azure/mgmt/network/v2018_04_01/operations/vpn_sites_configuration_operations.py", "identifier": "VpnSitesConfigurationOperations.download", "docstring": "Gives the sas-url to download the configurations for vpn-sites in a\n        resource group.\n\n        :param resource_group_name: The resource group name.\n        :type resource_group_name: str\n        :param virtual_wan_name: The name of the VirtualWAN for which\n         configuration of all vpn-sites is needed.\n        :type virtual_wan_name: str\n        :param vpn_sites: List of resource-ids of the vpn-sites for which\n         config is to be downloaded.\n        :type vpn_sites:\n         list[~azure.mgmt.network.v2018_04_01.models.SubResource]\n        :param output_blob_sas_url: The sas-url to download the configurations\n         for vpn-sites\n        :type output_blob_sas_url: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.network.v2018_04_01.models.ErrorException>`", "docstring_tokens": ["Gives", "the", "sas", "-", "url", "to", "download", "the", "configurations", "for", "vpn", "-", "sites", "in", "a", "resource", "group", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254551}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/utils.py#L49-L78", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Unparse a range argument.", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "(", "int", ",", "long", ")", ")", ":", "return", "str", "(", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "arg_1", "=", "str", "(", "arg_0", "[", "0", "]", ")", "+", "\"-\"", "if", "len", "(", "arg_0", ")", ">", "1", ":", "arg_1", "+=", "str", "(", "arg_0", "[", "1", "]", ")", "return", "arg_1", "raise", "ValueError", "(", "\"Must be an integer or tuple\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Unparse a range argument.\n\n    Args:\n        obj: An article range. There are a number of valid formats; an integer\n            specifying a single article or a tuple specifying an article range.\n            If the range doesn't give a start article then all articles up to\n            the specified last article are included. If the range doesn't\n            specify a last article then all articles from the first specified\n            article up to the current last article for the group are included.\n\n    Returns:\n        The range as a string that can be used by an NNTP command.\n\n    Note: Sample valid formats.\n        4678\n        (,5234)\n        (4245,)\n        (4245, 5234)\n    \"\"\"\n    if isinstance(arg_0, (int, long)):\n        return str(arg_0)\n\n    if isinstance(arg_0, tuple):\n        arg_1 = str(arg_0[0]) + \"-\"\n        if len(arg_0) > 1:\n            arg_1 += str(arg_0[1])\n        return arg_1\n\n    raise ValueError(\"Must be an integer or tuple\")", "path": "nntp/utils.py", "identifier": "unparse_range", "docstring": "Unparse a range argument.\n\n    Args:\n        obj: An article range. There are a number of valid formats; an integer\n            specifying a single article or a tuple specifying an article range.\n            If the range doesn't give a start article then all articles up to\n            the specified last article are included. If the range doesn't\n            specify a last article then all articles from the first specified\n            article up to the current last article for the group are included.\n\n    Returns:\n        The range as a string that can be used by an NNTP command.\n\n    Note: Sample valid formats.\n        4678\n        (,5234)\n        (4245,)\n        (4245, 5234)", "docstring_tokens": ["Unparse", "a", "range", "argument", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 254552}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/scripts/publish_release.py#L48-L78", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Build the markdown release notes for Hugo.", "language": "python", "parameters": "(filename, tag, bump)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "'+++\\n'", ",", "'date = \"{}\"\\n'", ".", "format", "(", "date", ".", "today", "(", ")", ".", "isoformat", "(", ")", ")", ",", "'title = \"{}\"\\n'", ".", "format", "(", "arg_1", ")", ",", "'author = \"The COBRApy Team\"\\n'", ",", "'release = \"{}\"\\n'", ".", "format", "(", "arg_2", ")", ",", "'+++\\n'", ",", "'\\n'", "]", "with", "open", "(", "arg_0", ",", "\"r\"", ")", "as", "file_h", ":", "arg_4", "=", "insert_break", "(", "file_h", ".", "readlines", "(", ")", ")", "arg_3", ".", "extend", "(", "arg_4", ")", "with", "open", "(", "arg_0", ",", "\"w\"", ")", "as", "file_h", ":", "file_h", ".", "writelines", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Build the markdown release notes for Hugo.\n\n    Inserts the required TOML header with specific values and adds a break\n    for long release notes.\n\n    Parameters\n    ----------\n    filename : str, path\n        The release notes file.\n    tag : str\n        The tag, following semantic versioning, of the current release.\n    bump : {\"major\", \"minor\", \"patch\", \"alpha\", \"beta\"}\n        The type of release.\n\n    \"\"\"\n    arg_3 = [\n        '+++\\n',\n        'date = \"{}\"\\n'.format(date.today().isoformat()),\n        'title = \"{}\"\\n'.format(arg_1),\n        'author = \"The COBRApy Team\"\\n',\n        'release = \"{}\"\\n'.format(arg_2),\n        '+++\\n',\n        '\\n'\n    ]\n    with open(arg_0, \"r\") as file_h:\n        arg_4 = insert_break(file_h.readlines())\n    arg_3.extend(arg_4)\n    with open(arg_0, \"w\") as file_h:\n        file_h.writelines(arg_3)", "path": "scripts/publish_release.py", "identifier": "build_hugo_md", "docstring": "Build the markdown release notes for Hugo.\n\n    Inserts the required TOML header with specific values and adds a break\n    for long release notes.\n\n    Parameters\n    ----------\n    filename : str, path\n        The release notes file.\n    tag : str\n        The tag, following semantic versioning, of the current release.\n    bump : {\"major\", \"minor\", \"patch\", \"alpha\", \"beta\"}\n        The type of release.", "docstring_tokens": ["Build", "the", "markdown", "release", "notes", "for", "Hugo", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 254553}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/superop.py#L416-L425", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Convert a QuantumCircuit or Instruction to a SuperOp.", "language": "python", "parameters": "(cls, instruction)", "return_statement": "return op", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "QuantumCircuit", ")", ":", "arg_1", "=", "arg_1", ".", "to_instruction", "(", ")", "arg_2", "=", "SuperOp", "(", "np", ".", "eye", "(", "4", "**", "arg_1", ".", "num_qubits", ")", ")", "arg_2", ".", "_append_instruction", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert a QuantumCircuit or Instruction to a SuperOp.\"\"\"\n        # Convert circuit to an instruction\n        if isinstance(arg_1, QuantumCircuit):\n            arg_1 = arg_1.to_instruction()\n        # Initialize an identity superoperator of the correct size\n        # of the circuit\n        arg_2 = SuperOp(np.eye(4 ** arg_1.num_qubits))\n        arg_2._append_instruction(arg_1)\n        return arg_2", "path": "qiskit/quantum_info/operators/channel/superop.py", "identifier": "SuperOp._instruction_to_superop", "docstring": "Convert a QuantumCircuit or Instruction to a SuperOp.", "docstring_tokens": ["Convert", "a", "QuantumCircuit", "or", "Instruction", "to", "a", "SuperOp", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254554}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/levenshtein_searcher.py#L655-L674", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "sets 1.0 cost for every replacement, insertion, deletion and transposition", "language": "python", "parameters": "(self, allow_spaces=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_0", ".", "operation_costs", "=", "dict", "(", ")", "arg_0", ".", "operation_costs", "[", "\"\"", "]", "=", "{", "c", ":", "1.0", "for", "c", "in", "list", "(", "arg_0", ".", "alphabet", ")", "+", "[", "' '", "]", "}", "for", "arg_3", "in", "arg_0", ".", "alphabet", ":", "arg_4", "=", "{", "c", ":", "1.0", "for", "c", "in", "arg_0", ".", "alphabet", "}", "arg_4", "[", "arg_3", "]", "=", "0.0", "arg_4", "[", "\"\"", "]", "=", "1.0", "if", "arg_1", ":", "arg_4", "[", "\" \"", "]", "=", "1.0", "arg_0", ".", "operation_costs", "[", "arg_3", "]", "=", "arg_4", "for", "arg_3", ",", "arg_5", "in", "itertools", ".", "permutations", "(", "arg_0", ".", "alphabet", ",", "2", ")", ":", "arg_0", ".", "operation_costs", "[", "arg_3", "+", "arg_5", "]", "=", "{", "arg_5", "+", "arg_3", ":", "1.0", "}", "if", "arg_1", ":", "arg_0", ".", "operation_costs", "[", "\" \"", "]", "=", "{", "c", ":", "1.0", "for", "c", "in", "arg_0", ".", "alphabet", "}", "arg_0", ".", "operation_costs", "[", "\" \"", "]", "[", "\"\"", "]", "=", "1.0"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        sets 1.0 cost for every replacement, insertion, deletion and transposition\n        \"\"\"\n        arg_0.operation_costs = dict()\n        arg_0.operation_costs[\"\"] = {c: 1.0 for c in list(arg_0.alphabet) + [' ']}\n        for arg_3 in arg_0.alphabet:\n            arg_4 = {c: 1.0 for c in arg_0.alphabet}\n            arg_4[arg_3] = 0.0\n            arg_4[\"\"] = 1.0\n            if arg_1:\n                arg_4[\" \"] = 1.0\n            arg_0.operation_costs[arg_3] = arg_4\n        # \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0438\n        for arg_3, arg_5 in itertools.permutations(arg_0.alphabet, 2):\n            arg_0.operation_costs[arg_3 + arg_5] = {arg_5 + arg_3: 1.0}\n        # \u043f\u0440\u043e\u0431\u0435\u043b\u044b\n        if arg_1:\n            arg_0.operation_costs[\" \"] = {c: 1.0 for c in arg_0.alphabet}\n            arg_0.operation_costs[\" \"][\"\"] = 1.0", "path": "deeppavlov/models/spelling_correction/levenshtein/levenshtein_searcher.py", "identifier": "SegmentTransducer._make_default_operation_costs", "docstring": "sets 1.0 cost for every replacement, insertion, deletion and transposition", "docstring_tokens": ["sets", "1", ".", "0", "cost", "for", "every", "replacement", "insertion", "deletion", "and", "transposition"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 254555}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/profiles/mass_profiles.py#L1539-L1545", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "A parameter derived from Sersic index which ensures that effective radius contains 50% of the profile's\n        total integrated light.", "language": "python", "parameters": "(self)", "return_statement": "return (2 * self.sersic_index) - (1. / 3.) + (4. / (405. * self.sersic_index)) + (\n                46. / (25515. * self.sersic_index ** 2)) + (131. / (1148175. * self.sersic_index ** 3)) - (\n                       2194697. / (30690717750. * self.sersic_index ** 4))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "2", "*", "arg_0", ".", "sersic_index", ")", "-", "(", "1.", "/", "3.", ")", "+", "(", "4.", "/", "(", "405.", "*", "arg_0", ".", "sersic_index", ")", ")", "+", "(", "46.", "/", "(", "25515.", "*", "arg_0", ".", "sersic_index", "**", "2", ")", ")", "+", "(", "131.", "/", "(", "1148175.", "*", "arg_0", ".", "sersic_index", "**", "3", ")", ")", "-", "(", "2194697.", "/", "(", "30690717750.", "*", "arg_0", ".", "sersic_index", "**", "4", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" A parameter derived from Sersic index which ensures that effective radius contains 50% of the profile's\n        total integrated light.\n        \"\"\"\n        return (2 * arg_0.sersic_index) - (1. / 3.) + (4. / (405. * arg_0.sersic_index)) + (\n                46. / (25515. * arg_0.sersic_index ** 2)) + (131. / (1148175. * arg_0.sersic_index ** 3)) - (\n                       2194697. / (30690717750. * arg_0.sersic_index ** 4))", "path": "autolens/model/profiles/mass_profiles.py", "identifier": "AbstractEllipticalSersic.sersic_constant", "docstring": "A parameter derived from Sersic index which ensures that effective radius contains 50% of the profile's\n        total integrated light.", "docstring_tokens": ["A", "parameter", "derived", "from", "Sersic", "index", "which", "ensures", "that", "effective", "radius", "contains", "50%", "of", "the", "profile", "s", "total", "integrated", "light", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 254556}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L74-L88", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Remove the client from the users of the socket.", "language": "python", "parameters": "(self, client)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "_clients", ".", "remove", "(", "id", "(", "arg_1", ")", ")", "except", "ValueError", ":", "pass", "if", "len", "(", "arg_0", ".", "_clients", ")", "<", "1", ":", "arg_0", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n        # type: (object) -> None\n        \"\"\"Remove the client from the users of the socket.\n\n        If there are no more clients for the socket, it\n        will close automatically.\n        \"\"\"\n\n        try:\n            arg_0._clients.remove(id(arg_1))\n        except ValueError:\n            pass\n\n        if len(arg_0._clients) < 1:\n            arg_0.close()", "path": "statsdmetrics/client/__init__.py", "identifier": "AutoClosingSharedSocket.remove_client", "docstring": "Remove the client from the users of the socket.\n\n        If there are no more clients for the socket, it\n        will close automatically.", "docstring_tokens": ["Remove", "the", "client", "from", "the", "users", "of", "the", "socket", "."], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 254557}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L693-L762", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Validate that arguments passed to submit_job have valid file providers.", "language": "python", "parameters": "(job_descriptor, provider_name, input_providers,\n                                 output_providers, logging_providers)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "job_resources", "arg_6", "=", "arg_0", ".", "job_params", "arg_7", "=", "arg_0", ".", "task_descriptors", "_validate_providers", "(", "[", "arg_5", ".", "logging", "]", ",", "'logging'", ",", "arg_4", ",", "arg_1", ")", "_validate_providers", "(", "arg_6", "[", "'inputs'", "]", ",", "'input'", ",", "arg_2", ",", "arg_1", ")", "_validate_providers", "(", "arg_6", "[", "'outputs'", "]", ",", "'output'", ",", "arg_3", ",", "arg_1", ")", "for", "arg_8", "in", "arg_7", ":", "_validate_providers", "(", "arg_8", ".", "task_params", "[", "'inputs'", "]", ",", "'input'", ",", "arg_2", ",", "arg_1", ")", "_validate_providers", "(", "arg_8", ".", "task_params", "[", "'outputs'", "]", ",", "'output'", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                                 arg_3, arg_4):\n  \"\"\"Validate that arguments passed to submit_job have valid file providers.\n\n  This utility function takes resources and task data args from `submit_job`\n  in the base provider. This function will fail with a value error if any of the\n  parameters are not valid. See the following example;\n\n  >>> job_resources = type('', (object,),\n  ...    {\"logging\": job_model.LoggingParam('gs://logtemp', job_model.P_GCS)})()\n  >>> job_params={'inputs': set(), 'outputs': set(), 'mounts': set()}\n  >>> task_descriptors = [\n  ...     job_model.TaskDescriptor(None, {\n  ...       'inputs': {\n  ...           job_model.FileParam('IN', uri='gs://in/*',\n  ...                               file_provider=job_model.P_GCS)},\n  ...       'outputs': set()}, None),\n  ...     job_model.TaskDescriptor(None, {\n  ...       'inputs': set(),\n  ...       'outputs': {\n  ...           job_model.FileParam('OUT', uri='gs://out/*',\n  ...                               file_provider=job_model.P_GCS)}}, None)]\n  ...\n  >>> Func(job_model.JobDescriptor(None, job_params,\n  ...                              job_resources, task_descriptors),\n  ...                              provider_name='MYPROVIDER',\n  ...                              input_providers=[job_model.P_GCS],\n  ...                              output_providers=[job_model.P_GCS],\n  ...                              logging_providers=[job_model.P_GCS])\n  ...\n  >>> Func(job_model.JobDescriptor(None, job_params,\n  ...                              job_resources, task_descriptors),\n  ...                              provider_name='MYPROVIDER',\n  ...                              input_providers=[job_model.P_GCS],\n  ...                              output_providers=[job_model.P_LOCAL],\n  ...                              logging_providers=[job_model.P_GCS])\n  Traceback (most recent call last):\n       ...\n  ValueError: Unsupported output path (gs://out/*) for provider 'MYPROVIDER'.\n\n  Args:\n    job_descriptor: instance of job_model.JobDescriptor.\n    provider_name: (str) the name of the execution provider.\n    input_providers: (string collection) whitelist of file providers for input.\n    output_providers: (string collection) whitelist of providers for output.\n    logging_providers: (string collection) whitelist of providers for logging.\n\n  Raises:\n    ValueError: if any file providers do not match the whitelists.\n  \"\"\"\n  arg_5 = arg_0.job_resources\n  arg_6 = arg_0.job_params\n  arg_7 = arg_0.task_descriptors\n\n  # Validate logging file provider.\n  _validate_providers([arg_5.logging], 'logging', arg_4,\n                      arg_1)\n\n  # Validate job input and output file providers\n  _validate_providers(arg_6['inputs'], 'input', arg_2,\n                      arg_1)\n  _validate_providers(arg_6['outputs'], 'output', arg_3,\n                      arg_1)\n\n  # Validate input and output file providers.\n  for arg_8 in arg_7:\n    _validate_providers(arg_8.task_params['inputs'], 'input',\n                        arg_2, arg_1)\n    _validate_providers(arg_8.task_params['outputs'], 'output',\n                        arg_3, arg_1)", "path": "dsub/lib/param_util.py", "identifier": "validate_submit_args_or_fail", "docstring": "Validate that arguments passed to submit_job have valid file providers.\n\n  This utility function takes resources and task data args from `submit_job`\n  in the base provider. This function will fail with a value error if any of the\n  parameters are not valid. See the following example;\n\n  >>> job_resources = type('', (object,),\n  ...    {\"logging\": job_model.LoggingParam('gs://logtemp', job_model.P_GCS)})()\n  >>> job_params={'inputs': set(), 'outputs': set(), 'mounts': set()}\n  >>> task_descriptors = [\n  ...     job_model.TaskDescriptor(None, {\n  ...       'inputs': {\n  ...           job_model.FileParam('IN', uri='gs://in/*',\n  ...                               file_provider=job_model.P_GCS)},\n  ...       'outputs': set()}, None),\n  ...     job_model.TaskDescriptor(None, {\n  ...       'inputs': set(),\n  ...       'outputs': {\n  ...           job_model.FileParam('OUT', uri='gs://out/*',\n  ...                               file_provider=job_model.P_GCS)}}, None)]\n  ...\n  >>> validate_submit_args_or_fail(job_model.JobDescriptor(None, job_params,\n  ...                              job_resources, task_descriptors),\n  ...                              provider_name='MYPROVIDER',\n  ...                              input_providers=[job_model.P_GCS],\n  ...                              output_providers=[job_model.P_GCS],\n  ...                              logging_providers=[job_model.P_GCS])\n  ...\n  >>> validate_submit_args_or_fail(job_model.JobDescriptor(None, job_params,\n  ...                              job_resources, task_descriptors),\n  ...                              provider_name='MYPROVIDER',\n  ...                              input_providers=[job_model.P_GCS],\n  ...                              output_providers=[job_model.P_LOCAL],\n  ...                              logging_providers=[job_model.P_GCS])\n  Traceback (most recent call last):\n       ...\n  ValueError: Unsupported output path (gs://out/*) for provider 'MYPROVIDER'.\n\n  Args:\n    job_descriptor: instance of job_model.JobDescriptor.\n    provider_name: (str) the name of the execution provider.\n    input_providers: (string collection) whitelist of file providers for input.\n    output_providers: (string collection) whitelist of providers for output.\n    logging_providers: (string collection) whitelist of providers for logging.\n\n  Raises:\n    ValueError: if any file providers do not match the whitelists.", "docstring_tokens": ["Validate", "that", "arguments", "passed", "to", "submit_job", "have", "valid", "file", "providers", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 254558}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/S3_hook.py#L279-L293", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks that a key matching a wildcard expression exists in a bucket", "language": "python", "parameters": "(self,\n                               wildcard_key, bucket_name=None, delimiter='')", "return_statement": "return self.get_wildcard_key(wildcard_key=wildcard_key,\n                                     bucket_name=bucket_name,\n                                     delimiter=delimiter) is not None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "''", ")", ":", "return", "arg_0", ".", "get_wildcard_key", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "is", "not", "None"], "function": "def Func(arg_0,\n                               arg_1, arg_2=None, arg_3=''):\n        \"\"\"\n        Checks that a key matching a wildcard expression exists in a bucket\n\n        :param wildcard_key: the path to the key\n        :type wildcard_key: str\n        :param bucket_name: the name of the bucket\n        :type bucket_name: str\n        :param delimiter: the delimiter marks key hierarchy\n        :type delimiter: str\n        \"\"\"\n        return arg_0.get_wildcard_key(arg_1=arg_1,\n                                     arg_2=arg_2,\n                                     arg_3=arg_3) is not None", "path": "airflow/hooks/S3_hook.py", "identifier": "S3Hook.check_for_wildcard_key", "docstring": "Checks that a key matching a wildcard expression exists in a bucket\n\n        :param wildcard_key: the path to the key\n        :type wildcard_key: str\n        :param bucket_name: the name of the bucket\n        :type bucket_name: str\n        :param delimiter: the delimiter marks key hierarchy\n        :type delimiter: str", "docstring_tokens": ["Checks", "that", "a", "key", "matching", "a", "wildcard", "expression", "exists", "in", "a", "bucket"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254559}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1625-L1632", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Handler for ls command", "language": "python", "parameters": "(self, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "1", ":", "arg_0", ".", "pretty_print", "(", "arg_0", ".", "s3handler", "(", ")", ".", "list_buckets", "(", ")", ")", "return", "arg_0", ".", "validate", "(", "'cmd|s3'", ",", "arg_1", ")", "arg_0", ".", "pretty_print", "(", "arg_0", ".", "s3handler", "(", ")", ".", "s3walk", "(", "arg_1", "[", "1", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n    '''Handler for ls command'''\n    if len(arg_1) == 1:\n      arg_0.pretty_print(arg_0.s3handler().list_buckets())\n      return\n\n    arg_0.validate('cmd|s3', arg_1)\n    arg_0.pretty_print(arg_0.s3handler().s3walk(arg_1[1]))", "path": "s4cmd.py", "identifier": "CommandHandler.ls_handler", "docstring": "Handler for ls command", "docstring_tokens": ["Handler", "for", "ls", "command"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 254560}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L180-L186", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Parses the dot_code string and replaces the existing model.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "GodotDataParser", "(", ")", "arg_2", "=", "arg_1", ".", "parse_dot_data", "(", "arg_0", ".", "dot_code", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "model", "=", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" Parses the dot_code string and replaces the existing model.\n        \"\"\"\n        arg_1 = GodotDataParser()\n        arg_2  = arg_1.parse_dot_data(arg_0.dot_code)\n        if arg_2 is not None:\n            arg_0.model = arg_2", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel._parse_dot_code_fired", "docstring": "Parses the dot_code string and replaces the existing model.", "docstring_tokens": ["Parses", "the", "dot_code", "string", "and", "replaces", "the", "existing", "model", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 254561}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/metrics/metrics_helper.py#L134-L137", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Update sent packet metrics", "language": "python", "parameters": "(self, sent_pkt_size_bytes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "update_count", "(", "arg_0", ".", "SENT_PKT_COUNT", ")", "arg_0", ".", "update_count", "(", "arg_0", ".", "SENT_PKT_SIZE", ",", "incr_by", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Update sent packet metrics\"\"\"\n    arg_0.update_count(arg_0.SENT_PKT_COUNT)\n    arg_0.update_count(arg_0.SENT_PKT_SIZE, incr_by=arg_1)", "path": "heron/instance/src/python/utils/metrics/metrics_helper.py", "identifier": "GatewayMetrics.update_sent_packet", "docstring": "Update sent packet metrics", "docstring_tokens": ["Update", "sent", "packet", "metrics"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254562}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v3/rwbase.py#L166-L171", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Read a notebook from a file like object", "language": "python", "parameters": "(self, fp, **kwargs)", "return_statement": "return self.reads(nbs, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "Func", "(", ")", "if", "not", "py3compat", ".", "PY3", "and", "not", "isinstance", "(", "arg_3", ",", "unicode", ")", ":", "arg_3", "=", "py3compat", ".", "str_to_unicode", "(", "arg_3", ")", "return", "arg_0", ".", "Funcs", "(", "arg_3", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Read a notebook from a file like object\"\"\"\n        arg_3 = arg_1.Func()\n        if not py3compat.PY3 and not isinstance(arg_3, unicode):\n            arg_3 = py3compat.str_to_unicode(arg_3)\n        return arg_0.Funcs(arg_3, **arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/nbformat/v3/rwbase.py", "identifier": "NotebookReader.read", "docstring": "Read a notebook from a file like object", "docstring_tokens": ["Read", "a", "notebook", "from", "a", "file", "like", "object"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254563}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L1101-L1167", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Sparse matrix roll", "language": "python", "parameters": "(x, shift, axis=0)", "return_statement": "return x_r.asformat(fmt)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "if", "not", "scipy", ".", "sparse", ".", "isspmatrix", "(", "arg_0", ")", ":", "return", "np", ".", "roll", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "arg_2", "not", "in", "[", "0", ",", "1", ",", "-", "1", "]", ":", "raise", "ParameterError", "(", "'axis must be one of (0, 1, -1)'", ")", "arg_1", "=", "np", ".", "mod", "(", "arg_1", ",", "arg_0", ".", "shape", "[", "arg_2", "]", ")", "if", "arg_1", "==", "0", ":", "return", "arg_0", ".", "copy", "(", ")", "arg_3", "=", "arg_0", ".", "format", "if", "arg_2", "==", "0", ":", "arg_0", "=", "arg_0", ".", "tocsc", "(", ")", "elif", "arg_2", "in", "(", "-", "1", ",", "1", ")", ":", "arg_0", "=", "arg_0", ".", "tocsr", "(", ")", "arg_4", "=", "scipy", ".", "sparse", ".", "lil_matrix", "(", "arg_0", ".", "shape", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_5", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "arg_6", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_4", ".", "ndim", "arg_5", "[", "arg_2", "]", "=", "slice", "(", "0", ",", "-", "arg_1", ")", "arg_6", "[", "arg_2", "]", "=", "slice", "(", "arg_1", ",", "None", ")", "arg_4", "[", "arg_7", "(", "arg_6", ")", "]", "=", "arg_0", "[", "arg_7", "(", "arg_5", ")", "]", "arg_6", "[", "arg_2", "]", "=", "slice", "(", "0", ",", "arg_1", ")", "arg_5", "[", "arg_2", "]", "=", "slice", "(", "-", "arg_1", ",", "None", ")", "arg_4", "[", "arg_7", "(", "arg_6", ")", "]", "=", "arg_0", "[", "arg_7", "(", "arg_5", ")", "]", "return", "arg_4", ".", "asformat", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=0):\n    '''Sparse matrix roll\n\n    This operation is equivalent to ``numpy.roll``, but operates on sparse matrices.\n\n    Parameters\n    ----------\n    x : scipy.sparse.spmatrix or np.ndarray\n        The sparse matrix input\n\n    shift : int\n        The number of positions to roll the specified axis\n\n    axis : (0, 1, -1)\n        The axis along which to roll.\n\n    Returns\n    -------\n    x_rolled : same type as `x`\n        The rolled matrix, with the same format as `x`\n\n    See Also\n    --------\n    numpy.roll\n\n    Examples\n    --------\n    >>> # Generate a random sparse binary matrix\n    >>> X = scipy.sparse.lil_matrix(np.random.randint(0, 2, size=(5,5)))\n    >>> X_roll = Func(X, 2, axis=0)  # Roll by 2 on the first axis\n    >>> X_dense_r = Func(X.toarray(), 2, axis=0)  # Equivalent dense roll\n    >>> np.allclose(X_roll, X_dense_r.toarray())\n    True\n    '''\n    if not scipy.sparse.isspmatrix(arg_0):\n        return np.roll(arg_0, arg_1, arg_2=arg_2)\n\n    # shift-mod-length lets us have shift > x.shape[axis]\n    if arg_2 not in [0, 1, -1]:\n        raise ParameterError('axis must be one of (0, 1, -1)')\n\n    arg_1 = np.mod(arg_1, arg_0.shape[arg_2])\n\n    if arg_1 == 0:\n        return arg_0.copy()\n\n    arg_3 = arg_0.format\n    if arg_2 == 0:\n        arg_0 = arg_0.tocsc()\n    elif arg_2 in (-1, 1):\n        arg_0 = arg_0.tocsr()\n\n    # lil matrix to start\n    arg_4 = scipy.sparse.lil_matrix(arg_0.shape, dtype=arg_0.dtype)\n\n    arg_5 = [slice(None)] * arg_0.ndim\n    arg_6 = [slice(None)] * arg_4.ndim\n\n    arg_5[arg_2] = slice(0, -arg_1)\n    arg_6[arg_2] = slice(arg_1, None)\n    arg_4[arg_7(arg_6)] = arg_0[arg_7(arg_5)]\n\n    arg_6[arg_2] = slice(0, arg_1)\n    arg_5[arg_2] = slice(-arg_1, None)\n    arg_4[arg_7(arg_6)] = arg_0[arg_7(arg_5)]\n\n    return arg_4.asformat(arg_3)", "path": "librosa/util/utils.py", "identifier": "roll_sparse", "docstring": "Sparse matrix roll\n\n    This operation is equivalent to ``numpy.roll``, but operates on sparse matrices.\n\n    Parameters\n    ----------\n    x : scipy.sparse.spmatrix or np.ndarray\n        The sparse matrix input\n\n    shift : int\n        The number of positions to roll the specified axis\n\n    axis : (0, 1, -1)\n        The axis along which to roll.\n\n    Returns\n    -------\n    x_rolled : same type as `x`\n        The rolled matrix, with the same format as `x`\n\n    See Also\n    --------\n    numpy.roll\n\n    Examples\n    --------\n    >>> # Generate a random sparse binary matrix\n    >>> X = scipy.sparse.lil_matrix(np.random.randint(0, 2, size=(5,5)))\n    >>> X_roll = roll_sparse(X, 2, axis=0)  # Roll by 2 on the first axis\n    >>> X_dense_r = roll_sparse(X.toarray(), 2, axis=0)  # Equivalent dense roll\n    >>> np.allclose(X_roll, X_dense_r.toarray())\n    True", "docstring_tokens": ["Sparse", "matrix", "roll"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 254564}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L147-L156", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Retrieves the number of members of the organization.", "language": "python", "parameters": "(self)", "return_statement": "return counter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "'Getting members.'", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ".", "org_retrieved", ".", "iter_members", "(", ")", ":", "arg_0", ".", "members_json", "[", "arg_2", ".", "id", "]", "=", "arg_2", ".", "to_json", "(", ")", "arg_1", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieves the number of members of the organization.\n        \"\"\"\n        print 'Getting members.'\n        arg_1 = 0\n        for arg_2 in arg_0.org_retrieved.iter_members():\n            arg_0.members_json[arg_2.id] = arg_2.to_json()\n            arg_1 += 1\n        return arg_1", "path": "scripts/github_stats.py", "identifier": "GitHub_LLNL_Stats.get_mems_of_org", "docstring": "Retrieves the number of members of the organization.", "docstring_tokens": ["Retrieves", "the", "number", "of", "members", "of", "the", "organization", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 254565}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L226-L242", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Deletes the given version of a model. Blocks until finished.", "language": "python", "parameters": "(self, project_id, model_name, version_name)", "return_statement": "return _poll_with_exponential_delay(\n            request=get_request,\n            max_n=9,\n            is_done_func=lambda resp: resp.get('done', False),\n            is_error_func=lambda resp: resp.get('error', None) is not None)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "'projects/{}/models/{}/versions/{}'", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "models", "(", ")", ".", "versions", "(", ")", ".", "delete", "(", "name", "=", "arg_4", ")", "arg_6", "=", "arg_5", ".", "execute", "(", ")", "arg_7", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "operations", "(", ")", ".", "get", "(", "name", "=", "arg_6", "[", "'name'", "]", ")", "return", "_poll_with_exponential_delay", "(", "request", "=", "arg_7", ",", "max_n", "=", "9", ",", "is_done_func", "=", "lambda", "resp", ":", "resp", ".", "get", "(", "'done'", ",", "False", ")", ",", "is_error_func", "=", "lambda", "resp", ":", "resp", ".", "get", "(", "'error'", ",", "None", ")", "is", "not", "None", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Deletes the given version of a model. Blocks until finished.\n        \"\"\"\n        arg_4 = 'projects/{}/models/{}/versions/{}'.format(\n            arg_1, arg_2, arg_3)\n        arg_5 = arg_0._mlengine.projects().models().versions().delete(\n            name=arg_4)\n        arg_6 = arg_5.execute()\n        arg_7 = arg_0._mlengine.projects().operations().get(\n            name=arg_6['name'])\n\n        return _poll_with_exponential_delay(\n            request=arg_7,\n            max_n=9,\n            is_done_func=lambda resp: resp.get('done', False),\n            is_error_func=lambda resp: resp.get('error', None) is not None)", "path": "airflow/contrib/hooks/gcp_mlengine_hook.py", "identifier": "MLEngineHook.delete_version", "docstring": "Deletes the given version of a model. Blocks until finished.", "docstring_tokens": ["Deletes", "the", "given", "version", "of", "a", "model", ".", "Blocks", "until", "finished", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254566}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/legacyauth.py#L77-L83", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Reset the `LegacyClientStream` object state, making the object ready\n        to handle new connections.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "ClientStream", ".", "Func", "(", "arg_0", ")", "arg_0", ".", "available_auth_methods", "=", "None", "arg_0", ".", "auth_stanza", "=", "None", "arg_0", ".", "registration_callback", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"Reset the `LegacyClientStream` object state, making the object ready\n        to handle new connections.\"\"\"\n        ClientStream.Func(arg_0)\n        arg_0.available_auth_methods = None\n        arg_0.auth_stanza = None\n        arg_0.registration_callback = None", "path": "pyxmpp2/ext/legacyauth.py", "identifier": "LegacyClientStream._reset", "docstring": "Reset the `LegacyClientStream` object state, making the object ready\n        to handle new connections.", "docstring_tokens": ["Reset", "the", "LegacyClientStream", "object", "state", "making", "the", "object", "ready", "to", "handle", "new", "connections", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254567}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L521-L539", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Yield all the uninstallation paths for dist based on RECORD-without-.pyc", "language": "python", "parameters": "(dist)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "pip", ".", "utils", "import", "FakeFile", "arg_1", "=", "csv", ".", "reader", "(", "FakeFile", "(", "arg_0", ".", "get_metadata_lines", "(", "'RECORD'", ")", ")", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "location", ",", "arg_2", "[", "0", "]", ")", "yield", "arg_3", "if", "arg_3", ".", "endswith", "(", "'.py'", ")", ":", "arg_4", ",", "arg_5", "=", "os", ".", "path", ".", "split", "(", "arg_3", ")", "arg_6", "=", "arg_5", "[", ":", "-", "3", "]", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_6", "+", "'.pyc'", ")", "yield", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Yield all the uninstallation paths for dist based on RECORD-without-.pyc\n\n    Yield paths to all the files in RECORD. For each .py file in RECORD, add\n    the .pyc in the same directory.\n\n    UninstallPathSet.add() takes care of the __pycache__ .pyc.\n    \"\"\"\n    from pip.utils import FakeFile  # circular import\n    arg_1 = csv.reader(FakeFile(arg_0.get_metadata_lines('RECORD')))\n    for arg_2 in arg_1:\n        arg_3 = os.path.join(arg_0.location, arg_2[0])\n        yield arg_3\n        if arg_3.endswith('.py'):\n            arg_4, arg_5 = os.path.split(arg_3)\n            arg_6 = arg_5[:-3]\n            arg_3 = os.path.join(arg_4, arg_6 + '.pyc')\n            yield arg_3", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py", "identifier": "uninstallation_paths", "docstring": "Yield all the uninstallation paths for dist based on RECORD-without-.pyc\n\n    Yield paths to all the files in RECORD. For each .py file in RECORD, add\n    the .pyc in the same directory.\n\n    UninstallPathSet.add() takes care of the __pycache__ .pyc.", "docstring_tokens": ["Yield", "all", "the", "uninstallation", "paths", "for", "dist", "based", "on", "RECORD", "-", "without", "-", ".", "pyc"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254568}
{"url": "https://github.com/brehaut/picoparse/blob/5e07c8e687a021bba58a5a2a76696c7a7ff35a1c/picoparse/__init__.py#L340-L354", "sha": "5e07c8e687a021bba58a5a2a76696c7a7ff35a1c", "docstring_summary": "Returns the current token if it is not found in the collection provided.\n    \n    The negative of one_of.", "language": "python", "parameters": "(these)", "return_statement": "return ch", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "peek", "(", ")", "arg_2", "=", "\"Func\"", "+", "repr", "(", "arg_0", ")", "try", ":", "if", "(", "arg_1", "is", "EndOfFile", ")", "or", "(", "arg_1", "in", "arg_0", ")", ":", "fail", "(", "[", "arg_2", "]", ")", "except", "TypeError", ":", "if", "arg_1", "!=", "arg_0", ":", "fail", "(", "[", "arg_2", "]", ")", "next", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns the current token if it is not found in the collection provided.\n    \n    The negative of one_of. \n    \"\"\"\n    arg_1 = peek()\n    arg_2 = \"Func\" + repr(arg_0)\n    try:\n        if (arg_1 is EndOfFile) or (arg_1 in arg_0):\n            fail([arg_2])\n    except TypeError:\n        if arg_1 != arg_0:\n            fail([arg_2])\n    next()\n    return arg_1", "path": "picoparse/__init__.py", "identifier": "not_one_of", "docstring": "Returns the current token if it is not found in the collection provided.\n    \n    The negative of one_of.", "docstring_tokens": ["Returns", "the", "current", "token", "if", "it", "is", "not", "found", "in", "the", "collection", "provided", ".", "The", "negative", "of", "one_of", "."], "nwo": "brehaut/picoparse", "score": 0.16638194949711382, "idx": 254569}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/data.py#L447-L470", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Accepts data in zyx. !!!", "language": "python", "parameters": "(self, token, channel,\n                                       x_start, y_start, z_start,\n                                       data, resolution)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_6", "=", "numpy", ".", "expand_dims", "(", "arg_6", ",", "axis", "=", "0", ")", "arg_8", "=", "blosc", ".", "pack_array", "(", "arg_6", ")", "arg_9", "=", "arg_0", ".", "url", "(", "\"{}/{}/blosc/{}/{},{}/{},{}/{},{}/0,0/\"", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_7", ",", "arg_3", ",", "arg_3", "+", "arg_6", ".", "shape", "[", "3", "]", ",", "arg_4", ",", "arg_4", "+", "arg_6", ".", "shape", "[", "2", "]", ",", "arg_5", ",", "arg_5", "+", "arg_6", ".", "shape", "[", "1", "]", ")", ")", "arg_10", "=", "arg_0", ".", "remote_utils", ".", "post_url", "(", "arg_9", ",", "arg_6", "=", "arg_8", ",", "headers", "=", "{", "'Content-Type'", ":", "'application/octet-stream'", "}", ")", "if", "arg_10", ".", "status_code", "is", "not", "200", ":", "raise", "RemoteDataUploadError", "(", "arg_10", ".", "text", ")", "else", ":", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2,\n                                       arg_3, arg_4, arg_5,\n                                       arg_6, arg_7):\n        \"\"\"\n        Accepts data in zyx. !!!\n        \"\"\"\n        arg_6 = numpy.expand_dims(arg_6, axis=0)\n        arg_8 = blosc.pack_array(arg_6)\n        arg_9 = arg_0.url(\"{}/{}/blosc/{}/{},{}/{},{}/{},{}/0,0/\".format(\n            arg_1, arg_2,\n            arg_7,\n            arg_3, arg_3 + arg_6.shape[3],\n            arg_4, arg_4 + arg_6.shape[2],\n            arg_5, arg_5 + arg_6.shape[1]\n        ))\n\n        arg_10 = arg_0.remote_utils.post_url(arg_9, arg_6=arg_8, headers={\n            'Content-Type': 'application/octet-stream'\n        })\n\n        if arg_10.status_code is not 200:\n            raise RemoteDataUploadError(arg_10.text)\n        else:\n            return True", "path": "ndio/remote/data.py", "identifier": "data._post_cutout_no_chunking_blosc", "docstring": "Accepts data in zyx. !!!", "docstring_tokens": ["Accepts", "data", "in", "zyx", ".", "!!!"], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 254570}
{"url": "https://github.com/textbook/aslack/blob/9ac6a44e4464180109fa4be130ad7a980a9d1acc/aslack/slack_bot/bot.py#L267-L285", "sha": "9ac6a44e4464180109fa4be130ad7a980a9d1acc", "docstring_summary": "Check the first message matches the expected handshake.", "language": "python", "parameters": "(cls, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_unpack_message", "(", "arg_1", ")", "logger", ".", "debug", "(", "arg_2", ")", "if", "arg_2", "!=", "arg_0", ".", "RTM_HANDSHAKE", ":", "raise", "SlackApiError", "(", "'Unexpected response: {!r}'", ".", "format", "(", "arg_2", ")", ")", "logger", ".", "info", "(", "'Joined real-time messaging.'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check the first message matches the expected handshake.\n\n        Note:\n          The handshake is provided as :py:attr:`RTM_HANDSHAKE`.\n\n        Arguments:\n          msg (:py:class:`aiohttp.Message`): The message to validate.\n\n        Raises:\n          :py:class:`SlackApiError`: If the data doesn't match the\n            expected handshake.\n\n        \"\"\"\n        arg_2 = arg_0._unpack_message(arg_1)\n        logger.debug(arg_2)\n        if arg_2 != arg_0.RTM_HANDSHAKE:\n            raise SlackApiError('Unexpected response: {!r}'.format(arg_2))\n        logger.info('Joined real-time messaging.')", "path": "aslack/slack_bot/bot.py", "identifier": "SlackBot._validate_first_message", "docstring": "Check the first message matches the expected handshake.\n\n        Note:\n          The handshake is provided as :py:attr:`RTM_HANDSHAKE`.\n\n        Arguments:\n          msg (:py:class:`aiohttp.Message`): The message to validate.\n\n        Raises:\n          :py:class:`SlackApiError`: If the data doesn't match the\n            expected handshake.", "docstring_tokens": ["Check", "the", "first", "message", "matches", "the", "expected", "handshake", "."], "nwo": "textbook/aslack", "score": 0.18261785916548806, "idx": 254571}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_list.py#L155-L180", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Checks if the input implements the iterator interface. An exception is made\n    for strings, which return False unless `strok` is True", "language": "python", "parameters": "(obj, strok=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "try", ":", "iter", "(", "arg_0", ")", "except", "Exception", ":", "return", "False", "else", ":", "return", "arg_1", "or", "not", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Checks if the input implements the iterator interface. An exception is made\n    for strings, which return False unless `strok` is True\n\n    Args:\n        obj (object): a scalar or Func input\n\n        strok (bool): if True allow strings to be interpreted as Func\n\n    Returns:\n        bool: True if the input is Func\n\n    Example:\n        >>> obj_list = [3, [3], '3', (3,), [3, 4, 5], {}]\n        >>> result = [Func(obj) for obj in obj_list]\n        >>> assert result == [False, True, False, True, True, True]\n        >>> result = [Func(obj, strok=True) for obj in obj_list]\n        >>> assert result == [False, True, True, True, True, True]\n    \"\"\"\n    try:\n        iter(arg_0)\n    except Exception:\n        return False\n    else:\n        return arg_1 or not isinstance(arg_0, six.string_types)", "path": "ubelt/util_list.py", "identifier": "iterable", "docstring": "Checks if the input implements the iterator interface. An exception is made\n    for strings, which return False unless `strok` is True\n\n    Args:\n        obj (object): a scalar or iterable input\n\n        strok (bool): if True allow strings to be interpreted as iterable\n\n    Returns:\n        bool: True if the input is iterable\n\n    Example:\n        >>> obj_list = [3, [3], '3', (3,), [3, 4, 5], {}]\n        >>> result = [iterable(obj) for obj in obj_list]\n        >>> assert result == [False, True, False, True, True, True]\n        >>> result = [iterable(obj, strok=True) for obj in obj_list]\n        >>> assert result == [False, True, True, True, True, True]", "docstring_tokens": ["Checks", "if", "the", "input", "implements", "the", "iterator", "interface", ".", "An", "exception", "is", "made", "for", "strings", "which", "return", "False", "unless", "strok", "is", "True"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 254572}
{"url": "https://github.com/Valuehorizon/valuehorizon-forex/blob/e921379ae6c9d07ddad87a1fd3b5bb8fdfc74cb8/forex/models.py#L59-L75", "sha": "e921379ae6c9d07ddad87a1fd3b5bb8fdfc74cb8", "docstring_summary": "Compute the return of the currency between two dates", "language": "python", "parameters": "(self, start_date, end_date, rate=\"MID\")", "return_statement": "return currency_return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"MID\"", ")", ":", "if", "arg_3", "not", "in", "[", "\"MID\"", ",", "\"ASK\"", ",", "\"BID\"", "]", ":", "raise", "ValueError", "(", "\"Unknown rate type (%s)- must be 'MID', 'ASK' or 'BID'\"", "%", "str", "(", "arg_3", ")", ")", "if", "arg_2", "<=", "arg_1", ":", "raise", "ValueError", "(", "\"End date must be on or after start date\"", ")", "arg_4", "=", "arg_0", ".", "generate_dataframe", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "arg_4", ".", "ix", "[", "arg_1", "]", "[", "arg_3", "]", "arg_6", "=", "arg_4", ".", "ix", "[", "arg_2", "]", "[", "arg_3", "]", "arg_7", "=", "(", "arg_6", "/", "arg_5", ")", "-", "1.0", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=\"MID\"):\n        \"\"\"\n        Compute the return of the currency between two dates\n        \"\"\"\n        if arg_3 not in [\"MID\", \"ASK\", \"BID\"]:\n            raise ValueError(\"Unknown rate type (%s)- must be 'MID', 'ASK' or 'BID'\" % str(arg_3))\n\n        if arg_2 <= arg_1:\n            raise ValueError(\"End date must be on or after start date\")\n\n        arg_4 = arg_0.generate_dataframe(arg_1=arg_1, arg_2=arg_2)\n        arg_5 = arg_4.ix[arg_1][arg_3]\n        arg_6 = arg_4.ix[arg_2][arg_3]\n\n        arg_7 = (arg_6 / arg_5) - 1.0\n\n        return arg_7", "path": "forex/models.py", "identifier": "Currency.compute_return", "docstring": "Compute the return of the currency between two dates", "docstring_tokens": ["Compute", "the", "return", "of", "the", "currency", "between", "two", "dates"], "nwo": "Valuehorizon/valuehorizon-forex", "score": 0.0, "idx": 254573}
{"url": "https://github.com/honzajavorek/danube-delta/blob/d0a72f0704d52b888e7fb2b68c4fdc696d370018/danube_delta/cli/deploy.py#L12-L51", "sha": "d0a72f0704d52b888e7fb2b68c4fdc696d370018", "docstring_summary": "Uploads new version of the blog website", "language": "python", "parameters": "(context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "obj", "header", "(", "'Generating HTML...'", ")", "pelican", "(", "arg_1", ",", "'--verbose'", ",", "production", "=", "True", ")", "header", "(", "'Removing unnecessary output...'", ")", "arg_2", "=", "[", "'author'", ",", "'category'", ",", "'tag'", ",", "'feeds'", ",", "'tags.html'", ",", "'authors.html'", ",", "'categories.html'", ",", "'archives.html'", ",", "]", "for", "arg_3", "in", "arg_2", ":", "remove_path", "(", "os", ".", "path", ".", "join", "(", "arg_1", "[", "'OUTPUT_DIR'", "]", ",", "arg_3", ")", ")", "if", "os", ".", "environ", ".", "get", "(", "'TRAVIS'", ")", ":", "header", "(", "'Setting up Git...'", ")", "run", "(", "'git config user.name '", "+", "run", "(", "'git show --format=\"%cN\" -s'", ",", "capture", "=", "True", ")", ")", "run", "(", "'git config user.email '", "+", "run", "(", "'git show --format=\"%cE\" -s'", ",", "capture", "=", "True", ")", ")", "arg_4", "=", "os", ".", "environ", ".", "get", "(", "'GITHUB_TOKEN'", ")", "arg_5", "=", "os", ".", "environ", ".", "get", "(", "'TRAVIS_REPO_SLUG'", ")", "arg_6", "=", "'https://{}@github.com/{}.git'", ".", "format", "(", "arg_4", ",", "arg_5", ")", "run", "(", "'git remote set-url origin '", "+", "arg_6", ")", "header", "(", "'Rewriting gh-pages branch...'", ")", "run", "(", "'ghp-import -m \"{message}\" {dir}'", ".", "format", "(", "message", "=", "'Deploying {}'", ".", "format", "(", "choose_commit_emoji", "(", ")", ")", ",", "dir", "=", "arg_1", "[", "'OUTPUT_DIR'", "]", ",", ")", ")", "header", "(", "'Pushing to GitHub...'", ")", "run", "(", "'git push origin gh-pages:gh-pages --force'", ")"], "function": "def Func(arg_0):\n    \"\"\"Uploads new version of the blog website\"\"\"\n\n    arg_1 = arg_0.obj\n\n    header('Generating HTML...')\n    pelican(arg_1, '--verbose', production=True)\n\n    header('Removing unnecessary output...')\n    arg_2 = [\n        'author', 'category', 'tag', 'feeds', 'tags.html',\n        'authors.html', 'categories.html', 'archives.html',\n    ]\n    for arg_3 in arg_2:\n        remove_path(os.path.join(arg_1['OUTPUT_DIR'], arg_3))\n\n    if os.environ.get('TRAVIS'):  # Travis CI\n        header('Setting up Git...')\n        run(\n            'git config user.name ' +\n            run('git show --format=\"%cN\" -s', capture=True)\n        )\n        run(\n            'git config user.email ' +\n            run('git show --format=\"%cE\" -s', capture=True)\n        )\n\n        arg_4 = os.environ.get('GITHUB_TOKEN')\n        arg_5 = os.environ.get('TRAVIS_REPO_SLUG')\n        arg_6 = 'https://{}@github.com/{}.git'.format(arg_4, arg_5)\n        run('git remote set-url origin ' + arg_6)\n\n    header('Rewriting gh-pages branch...')\n    run('ghp-import -m \"{message}\" {dir}'.format(\n        message='Deploying {}'.format(choose_commit_emoji()),\n        dir=arg_1['OUTPUT_DIR'],\n    ))\n\n    header('Pushing to GitHub...')\n    run('git push origin gh-pages:gh-pages --force')", "path": "danube_delta/cli/deploy.py", "identifier": "deploy", "docstring": "Uploads new version of the blog website", "docstring_tokens": ["Uploads", "new", "version", "of", "the", "blog", "website"], "nwo": "honzajavorek/danube-delta", "score": 0.27074237488055014, "idx": 254574}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2148-L2182", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "r\"\"\"Return a file list in a folder by given a path and regular expression.", "language": "python", "parameters": "(path=None, regx='\\.jpg', printable=True, keep_prefix=False)", "return_statement": "return return_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "'\\.jpg'", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "os", ".", "getcwd", "(", ")", "arg_4", "=", "os", ".", "listdir", "(", "arg_0", ")", "arg_5", "=", "[", "]", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_4", ")", ":", "if", "re", ".", "search", "(", "arg_1", ",", "arg_7", ")", ":", "arg_5", ".", "append", "(", "arg_7", ")", "if", "arg_3", ":", "for", "arg_8", ",", "arg_7", "in", "enumerate", "(", "arg_5", ")", ":", "arg_5", "[", "arg_8", "]", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_7", ")", "if", "arg_2", ":", "logging", ".", "info", "(", "'Match file list = %s'", "%", "arg_5", ")", "logging", ".", "info", "(", "'Number of files = %d'", "%", "len", "(", "arg_5", ")", ")", "return", "arg_5"], "function": "def Func(arg_0=None, arg_1='\\.jpg', arg_2=True, arg_3=False):\n    r\"\"\"Return a file list in a folder by given a path and regular expression.\n\n    Parameters\n    ----------\n    path : str or None\n        A folder path, if `None`, use the current directory.\n    regx : str\n        The regx of file name.\n    printable : boolean\n        Whether to print the files infomation.\n    keep_prefix : boolean\n        Whether to keep path in the file name.\n\n    Examples\n    ----------\n    >>> file_list = tl.files.Func(path=None, regx='w1pre_[0-9]+\\.(npz)')\n\n    \"\"\"\n    if arg_0 is None:\n        arg_0 = os.getcwd()\n    arg_4 = os.listdir(arg_0)\n    arg_5 = []\n    for arg_6, arg_7 in enumerate(arg_4):\n        if re.search(arg_1, arg_7):\n            arg_5.append(arg_7)\n    # return_list.sort()\n    if arg_3:\n        for arg_8, arg_7 in enumerate(arg_5):\n            arg_5[arg_8] = os.path.join(arg_0, arg_7)\n\n    if arg_2:\n        logging.info('Match file list = %s' % arg_5)\n        logging.info('Number of files = %d' % len(arg_5))\n    return arg_5", "path": "tensorlayer/files/utils.py", "identifier": "load_file_list", "docstring": "r\"\"\"Return a file list in a folder by given a path and regular expression.\n\n    Parameters\n    ----------\n    path : str or None\n        A folder path, if `None`, use the current directory.\n    regx : str\n        The regx of file name.\n    printable : boolean\n        Whether to print the files infomation.\n    keep_prefix : boolean\n        Whether to keep path in the file name.\n\n    Examples\n    ----------\n    >>> file_list = tl.files.load_file_list(path=None, regx='w1pre_[0-9]+\\.(npz)')", "docstring_tokens": ["r", "Return", "a", "file", "list", "in", "a", "folder", "by", "given", "a", "path", "and", "regular", "expression", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 254575}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L68-L89", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Create a tar file with a given set of files", "language": "python", "parameters": "(tar_filename, files, config_dir, config_files)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "with", "contextlib", ".", "closing", "(", "tarfile", ".", "open", "(", "arg_0", ",", "'w:gz'", ",", "dereference", "=", "True", ")", ")", "as", "tar", ":", "for", "arg_4", "in", "arg_1", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "tar", ".", "add", "(", "arg_4", ",", "arcname", "=", "os", ".", "path", ".", "basename", "(", "arg_4", ")", ")", "else", ":", "raise", "Exception", "(", "\"%s is not an existing file\"", "%", "arg_4", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "tar", ".", "add", "(", "arg_2", ",", "arcname", "=", "get_heron_sandbox_conf_dir", "(", ")", ")", "else", ":", "raise", "Exception", "(", "\"%s is not an existing directory\"", "%", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "get_heron_sandbox_conf_dir", "(", ")", ",", "os", ".", "path", ".", "basename", "(", "arg_4", ")", ")", "tar", ".", "add", "(", "arg_4", ",", "arcname", "=", "arg_5", ")", "else", ":", "raise", "Exception", "(", "\"%s is not an existing file\"", "%", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  '''\n  Create a tar file with a given set of files\n  '''\n  with contextlib.closing(tarfile.open(arg_0, 'w:gz', dereference=True)) as tar:\n    for arg_4 in arg_1:\n      if os.path.isfile(arg_4):\n        tar.add(arg_4, arcname=os.path.basename(arg_4))\n      else:\n        raise Exception(\"%s is not an existing file\" % arg_4)\n\n    if os.path.isdir(arg_2):\n      tar.add(arg_2, arcname=get_heron_sandbox_conf_dir())\n    else:\n      raise Exception(\"%s is not an existing directory\" % arg_2)\n\n    for arg_4 in arg_3:\n      if os.path.isfile(arg_4):\n        arg_5 = os.path.join(get_heron_sandbox_conf_dir(), os.path.basename(arg_4))\n        tar.add(arg_4, arcname=arg_5)\n      else:\n        raise Exception(\"%s is not an existing file\" % arg_4)", "path": "heron/tools/common/src/python/utils/config.py", "identifier": "create_tar", "docstring": "Create a tar file with a given set of files", "docstring_tokens": ["Create", "a", "tar", "file", "with", "a", "given", "set", "of", "files"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254576}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L882-L887", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Gets data from queue", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "queue", ".", "get", "(", "block", "=", "True", ")", "if", "hasattr", "(", "arg_0", ".", "queue", ",", "'task_done'", ")", ":", "arg_0", ".", "queue", ".", "task_done", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Gets data from queue\"\"\"\n        arg_1 = arg_0.queue.get(block=True)\n        if hasattr(arg_0.queue, 'task_done'):\n            arg_0.queue.task_done()\n        return arg_1", "path": "pypet/utils/mpwrappers.py", "identifier": "QueueStorageServiceWriter._receive_data", "docstring": "Gets data from queue", "docstring_tokens": ["Gets", "data", "from", "queue"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254577}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/term_echo.py#L68-L124", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "Print STDOUT resulting from a Bash shell command formatted in reStructuredText.", "language": "python", "parameters": "(command, nindent=0, env=None, fpointer=None, cols=60)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "60", ")", ":", "arg_5", ".", "environ", "[", "\"COLUMNS\"", "]", "=", "str", "(", "arg_4", ")", "arg_7", "=", "arg_0", "if", "arg_2", ":", "for", "arg_8", ",", "arg_9", "in", "arg_2", ".", "items", "(", ")", ":", "arg_7", "=", "arg_7", ".", "replace", "(", "\"${\"", "+", "arg_8", "+", "\"}\"", ",", "arg_9", ")", "arg_10", "=", "arg_7", ".", "split", "(", "\" \"", ")", "if", "(", "platform", ".", "system", "(", ")", ".", "lower", "(", ")", "==", "\"windows\"", ")", "and", "(", "arg_10", "[", "0", "]", ".", "endswith", "(", "\".py\"", ")", ")", ":", "arg_10", "=", "[", "sys", ".", "executable", "]", "+", "arg_10", "arg_11", "=", "subprocess", ".", "Popen", "(", "arg_10", ",", "arg_12", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", "arg_12", "=", "arg_11", ".", "communicate", "(", ")", "[", "0", "]", "if", "sys", ".", "hexversion", ">=", "0x03000000", ":", "arg_12", "=", "arg_12", ".", "decode", "(", "\"utf-8\"", ")", "arg_12", "=", "arg_12", ".", "split", "(", "\"\\n\"", ")", "arg_13", "=", "arg_1", "*", "\" \"", "arg_3", "(", "\"\\n\"", ",", "dedent", "=", "False", ")", "arg_3", "(", "\"{0}.. code-block:: bash\\n\"", ".", "format", "(", "arg_13", ")", ",", "dedent", "=", "False", ")", "arg_3", "(", "\"\\n\"", ",", "dedent", "=", "False", ")", "arg_3", "(", "\"{0}    $ {1}\\n\"", ".", "format", "(", "arg_13", ",", "arg_0", ")", ",", "dedent", "=", "False", ")", "for", "arg_14", "in", "arg_12", ":", "if", "arg_14", ".", "strip", "(", ")", ":", "arg_3", "(", "arg_13", "+", "\"    \"", "+", "arg_14", ".", "replace", "(", "\"\\t\"", ",", "\"    \"", ")", "+", "\"\\n\"", ",", "dedent", "=", "False", ")", "else", ":", "arg_3", "(", "\"\\n\"", ",", "dedent", "=", "False", ")", "arg_3", "(", "\"\\n\"", ",", "dedent", "=", "False", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=None, arg_3=None, arg_4=60):\n    \"\"\"\n    Print STDOUT resulting from a Bash shell command formatted in reStructuredText.\n\n    :param command: Bash shell command\n    :type  command: string\n\n    :param nindent: Indentation level\n    :type  nindent: integer\n\n    :param env: Environment variable replacement dictionary. The Bash\n                command is pre-processed and any environment variable\n                represented in the full notation (:bash:`${...}`) is replaced.\n                The dictionary key is the environment variable name and the\n                dictionary value is the replacement value. For example, if\n                **command** is :code:`'${PYTHON_CMD} -m \"x=5\"'` and **env**\n                is :code:`{'PYTHON_CMD':'python3'}` the actual command issued\n                is :code:`'python3 -m \"x=5\"'`\n    :type  env: dictionary\n\n    :param fpointer: Output function pointer. Normally is :code:`cog.out` but\n                     :code:`print` or other functions can be used for\n                     debugging\n    :type  fpointer: function object\n\n    :param cols: Number of columns of output\n    :type  cols: integer\n    \"\"\"\n    # pylint: disable=R0204\n    # Set argparse width so that output does not need horizontal scroll\n    # bar in narrow windows or displays\n    arg_5.environ[\"COLUMNS\"] = str(arg_4)\n    arg_7 = arg_0\n    if arg_2:\n        for arg_8, arg_9 in arg_2.items():\n            arg_7 = arg_7.replace(\"${\" + arg_8 + \"}\", arg_9)\n    arg_10 = arg_7.split(\" \")\n    # Add Python interpreter executable for Python scripts on Windows since\n    # the shebang does not work\n    if (platform.system().lower() == \"windows\") and (arg_10[0].endswith(\".py\")):\n        arg_10 = [sys.executable] + arg_10\n    arg_11 = subprocess.Popen(arg_10, arg_12=subprocess.PIPE, stderr=subprocess.STDOUT)\n    arg_12 = arg_11.communicate()[0]\n    if sys.hexversion >= 0x03000000:\n        arg_12 = arg_12.decode(\"utf-8\")\n    arg_12 = arg_12.split(\"\\n\")\n    arg_13 = arg_1 * \" \"\n    arg_3(\"\\n\", dedent=False)\n    arg_3(\"{0}.. code-block:: bash\\n\".format(arg_13), dedent=False)\n    arg_3(\"\\n\", dedent=False)\n    arg_3(\"{0}    $ {1}\\n\".format(arg_13, arg_0), dedent=False)\n    for arg_14 in arg_12:\n        if arg_14.strip():\n            arg_3(arg_13 + \"    \" + arg_14.replace(\"\\t\", \"    \") + \"\\n\", dedent=False)\n        else:\n            arg_3(\"\\n\", dedent=False)\n    arg_3(\"\\n\", dedent=False)", "path": "docs/support/term_echo.py", "identifier": "term_echo", "docstring": "Print STDOUT resulting from a Bash shell command formatted in reStructuredText.\n\n    :param command: Bash shell command\n    :type  command: string\n\n    :param nindent: Indentation level\n    :type  nindent: integer\n\n    :param env: Environment variable replacement dictionary. The Bash\n                command is pre-processed and any environment variable\n                represented in the full notation (:bash:`${...}`) is replaced.\n                The dictionary key is the environment variable name and the\n                dictionary value is the replacement value. For example, if\n                **command** is :code:`'${PYTHON_CMD} -m \"x=5\"'` and **env**\n                is :code:`{'PYTHON_CMD':'python3'}` the actual command issued\n                is :code:`'python3 -m \"x=5\"'`\n    :type  env: dictionary\n\n    :param fpointer: Output function pointer. Normally is :code:`cog.out` but\n                     :code:`print` or other functions can be used for\n                     debugging\n    :type  fpointer: function object\n\n    :param cols: Number of columns of output\n    :type  cols: integer", "docstring_tokens": ["Print", "STDOUT", "resulting", "from", "a", "Bash", "shell", "command", "formatted", "in", "reStructuredText", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 254578}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/wikipedia.py#L674-L709", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a list of internal Wikipedia links in the markup.", "language": "python", "parameters": "(self, markup)", "return_statement": "return links", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "re", ".", "findall", "(", "arg_0", ".", "re", "[", "\"link\"", "]", ",", "arg_1", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "find", "(", "\"{\"", ")", ">=", "0", ":", "arg_4", "=", "re", ".", "sub", "(", "\"\\{{1,3}[0-9]{0,2}\\|\"", ",", "\"\"", ",", "arg_4", ")", "arg_4", "=", "arg_4", ".", "replace", "(", "\"{\"", ",", "\"\"", ")", "arg_4", "=", "arg_4", ".", "replace", "(", "\"}\"", ",", "\"\"", ")", "arg_4", "=", "arg_4", ".", "split", "(", "\"|\"", ")", "arg_4", "[", "0", "]", "=", "arg_4", "[", "0", "]", ".", "split", "(", "\"#\"", ")", "arg_5", "=", "arg_4", "[", "0", "]", "[", "0", "]", ".", "strip", "(", ")", "if", "not", "arg_5", "in", "arg_2", ":", "arg_2", ".", "append", "(", "arg_5", ")", "arg_2", ".", "sort", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \n        \"\"\" Returns a list of internal Wikipedia links in the markup.\n\n        # A Wikipedia link looks like:\n        # [[List of operating systems#Embedded | List of embedded operating systems]]\n        # It does not contain a colon, this indicates images, users, languages, etc.\n        \n        The return value is a list containing the first part of the link,\n        without the anchor.\n\n        \"\"\"\n        \n        arg_2 = []\n        arg_3 = re.findall(arg_0.re[\"link\"], arg_1)\n        for arg_4 in arg_3:\n            # We don't like [[{{{1|Universe (disambiguation)}}}]]\n            if arg_4.find(\"{\") >= 0:\n                arg_4 = re.sub(\"\\{{1,3}[0-9]{0,2}\\|\", \"\", arg_4)\n                arg_4 = arg_4.replace(\"{\", \"\")\n                arg_4 = arg_4.replace(\"}\", \"\")            \n            arg_4 = arg_4.split(\"|\")\n            arg_4[0] = arg_4[0].split(\"#\")\n            arg_5 = arg_4[0][0].strip()\n            #anchor = u\"\"\n            #display = u\"\"\n            #if len(link[0]) > 1: \n            #    anchor = link[0][1].strip()\n            #if len(link) > 1: \n            #    display = link[1].strip()\n            if not arg_5 in arg_2:\n                arg_2.append(arg_5)\n                #links[page] = WikipediaLink(page, anchor, display)\n        \n        arg_2.sort()\n        return arg_2", "path": "lib/web/wikipedia.py", "identifier": "WikipediaPage.parse_links", "docstring": "Returns a list of internal Wikipedia links in the markup.\n\n        # A Wikipedia link looks like:\n        # [[List of operating systems#Embedded | List of embedded operating systems]]\n        # It does not contain a colon, this indicates images, users, languages, etc.\n        \n        The return value is a list containing the first part of the link,\n        without the anchor.", "docstring_tokens": ["Returns", "a", "list", "of", "internal", "Wikipedia", "links", "in", "the", "markup", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 254579}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/statements.py#L298-L321", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Walk statements and compare if they can be merged into one statement list", "language": "python", "parameters": "(cls, stmsA, stmsB)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "return", "True", "elif", "arg_1", "is", "None", "or", "arg_2", "is", "None", ":", "return", "False", "arg_3", "=", "iter", "(", "arg_1", ")", "arg_4", "=", "iter", "(", "arg_2", ")", "arg_5", "=", "_get_stm_with_branches", "(", "arg_3", ")", "arg_6", "=", "_get_stm_with_branches", "(", "arg_4", ")", "while", "arg_5", "is", "not", "None", "or", "arg_6", "is", "not", "None", ":", "if", "arg_5", "is", "None", "or", "arg_6", "is", "None", "or", "not", "arg_5", ".", "_is_mergable", "(", "arg_6", ")", ":", "return", "False", "arg_5", "=", "_get_stm_with_branches", "(", "arg_3", ")", "arg_6", "=", "_get_stm_with_branches", "(", "arg_4", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Walk statements and compare if they can be merged into one statement list\n        \"\"\"\n        if arg_1 is None and arg_2 is None:\n            return True\n\n        elif arg_1 is None or arg_2 is None:\n            return False\n\n        arg_3 = iter(arg_1)\n        arg_4 = iter(arg_2)\n\n        arg_5 = _get_stm_with_branches(arg_3)\n        arg_6 = _get_stm_with_branches(arg_4)\n        while arg_5 is not None or arg_6 is not None:\n            if arg_5 is None or arg_6 is None or not arg_5._is_mergable(arg_6):\n                return False\n\n            arg_5 = _get_stm_with_branches(arg_3)\n            arg_6 = _get_stm_with_branches(arg_4)\n\n        # lists are empty\n        return True", "path": "hwt/hdl/statements.py", "identifier": "HdlStatement._is_mergable_statement_list", "docstring": "Walk statements and compare if they can be merged into one statement list", "docstring_tokens": ["Walk", "statements", "and", "compare", "if", "they", "can", "be", "merged", "into", "one", "statement", "list"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 254580}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L319-L369", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Check if req_to_install should be skipped.", "language": "python", "parameters": "(self, req_to_install, finder)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "check_if_exists", "(", ")", "if", "arg_1", ".", "satisfied_by", ":", "arg_3", "=", "'satisfied (use --upgrade to upgrade)'", "if", "arg_0", ".", "upgrade", ":", "arg_4", "=", "False", "if", "not", "(", "arg_0", ".", "force_reinstall", "or", "arg_1", ".", "link", ")", ":", "try", ":", "arg_2", ".", "find_requirement", "(", "arg_1", ",", "arg_0", ".", "upgrade", ")", "except", "BestVersionAlreadyInstalled", ":", "arg_3", "=", "'up-to-date'", "arg_4", "=", "True", "except", "DistributionNotFound", ":", "pass", "if", "not", "arg_4", ":", "if", "not", "(", "arg_0", ".", "use_user_site", "and", "not", "dist_in_usersite", "(", "arg_1", ".", "satisfied_by", ")", ")", ":", "arg_1", ".", "conflicts_with", "=", "arg_1", ".", "satisfied_by", "arg_1", ".", "satisfied_by", "=", "None", "return", "arg_3", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check if req_to_install should be skipped.\n\n        This will check if the req is installed, and whether we should upgrade\n        or reinstall it, taking into account all the relevant user options.\n\n        After calling this req_to_install will only have satisfied_by set to\n        None if the req_to_install is to be upgraded/reinstalled etc. Any\n        other value will be a dist recording the current thing installed that\n        satisfies the requirement.\n\n        Note that for vcs urls and the like we can't assess skipping in this\n        routine - we simply identify that we need to pull the thing down,\n        then later on it is pulled down and introspected to assess upgrade/\n        reinstalls etc.\n\n        :return: A text reason for why it was skipped, or None.\n        \"\"\"\n        # Check whether to upgrade/reinstall this req or not.\n        arg_1.check_if_exists()\n        if arg_1.satisfied_by:\n            arg_3 = 'satisfied (use --upgrade to upgrade)'\n            if arg_0.upgrade:\n                arg_4 = False\n                # For link based requirements we have to pull the\n                # tree down and inspect to assess the version #, so\n                # its handled way down.\n                if not (arg_0.force_reinstall or arg_1.link):\n                    try:\n                        arg_2.find_requirement(arg_1, arg_0.upgrade)\n                    except BestVersionAlreadyInstalled:\n                        arg_3 = 'up-to-date'\n                        arg_4 = True\n                    except DistributionNotFound:\n                        # No distribution found, so we squash the\n                        # error - it will be raised later when we\n                        # re-try later to do the install.\n                        # Why don't we just raise here?\n                        pass\n\n                if not arg_4:\n                    # don't uninstall conflict if user install and\n                    # conflict is not user install\n                    if not (arg_0.use_user_site and not\n                            dist_in_usersite(arg_1.satisfied_by)):\n                        arg_1.conflicts_with = \\\n                            arg_1.satisfied_by\n                    arg_1.satisfied_by = None\n            return arg_3\n        else:\n            return None", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py", "identifier": "RequirementSet._check_skip_installed", "docstring": "Check if req_to_install should be skipped.\n\n        This will check if the req is installed, and whether we should upgrade\n        or reinstall it, taking into account all the relevant user options.\n\n        After calling this req_to_install will only have satisfied_by set to\n        None if the req_to_install is to be upgraded/reinstalled etc. Any\n        other value will be a dist recording the current thing installed that\n        satisfies the requirement.\n\n        Note that for vcs urls and the like we can't assess skipping in this\n        routine - we simply identify that we need to pull the thing down,\n        then later on it is pulled down and introspected to assess upgrade/\n        reinstalls etc.\n\n        :return: A text reason for why it was skipped, or None.", "docstring_tokens": ["Check", "if", "req_to_install", "should", "be", "skipped", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254581}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_transfer_hook.py#L312-L320", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Resumes an transfer operation in Google Storage Transfer Service.", "language": "python", "parameters": "(self, operation_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "get_conn", "(", ")", ".", "transferOperations", "(", ")", ".", "resume", "(", "name", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Resumes an transfer operation in Google Storage Transfer Service.\n\n        :param operation_name: (Required) Name of the transfer operation.\n        :type operation_name: str\n        :rtype: None\n        \"\"\"\n        arg_0.get_conn().transferOperations().resume(name=arg_1).execute(num_retries=arg_0.num_retries)", "path": "airflow/contrib/hooks/gcp_transfer_hook.py", "identifier": "GCPTransferServiceHook.resume_transfer_operation", "docstring": "Resumes an transfer operation in Google Storage Transfer Service.\n\n        :param operation_name: (Required) Name of the transfer operation.\n        :type operation_name: str\n        :rtype: None", "docstring_tokens": ["Resumes", "an", "transfer", "operation", "in", "Google", "Storage", "Transfer", "Service", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254582}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/client.py#L663-L717", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Search for managed objects, depending on the attributes specified in\n        the request.", "language": "python", "parameters": "(self, maximum_items=None, storage_status_mask=None,\n               object_group_member=None, attributes=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_1", ",", "six", ".", "integer_types", ")", ":", "raise", "TypeError", "(", "\"maximum_items must be an integer\"", ")", "if", "arg_2", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_2", ",", "six", ".", "integer_types", ")", ":", "raise", "TypeError", "(", "\"storage_status_mask must be an integer\"", ")", "if", "arg_3", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_3", ",", "enums", ".", "ObjectGroupMember", ")", ":", "raise", "TypeError", "(", "\"object_group_member must be a ObjectGroupMember\"", "\"enumeration\"", ")", "if", "arg_4", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_4", ",", "list", ")", "or", "all", "(", "isinstance", "(", "arg_5", ",", "cobjects", ".", "Attribute", ")", "for", "arg_5", "in", "arg_4", ")", "is", "False", ":", "raise", "TypeError", "(", "\"attributes must be a list of attributes\"", ")", "arg_6", "=", "arg_0", ".", "proxy", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "arg_7", "=", "arg_6", ".", "result_status", ".", "value", "if", "arg_7", "==", "enums", ".", "ResultStatus", ".", "SUCCESS", ":", "return", "arg_6", ".", "uuids", "else", ":", "arg_8", "=", "arg_6", ".", "result_reason", ".", "value", "arg_9", "=", "arg_6", ".", "result_message", ".", "value", "raise", "exceptions", ".", "KmipOperationFailure", "(", "arg_7", ",", "arg_8", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None,\n               arg_3=None, arg_4=None):\n        \"\"\"\n        Search for managed objects, depending on the attributes specified in\n        the request.\n\n        Args:\n            maximum_items (integer): Maximum number of object identifiers the\n                server MAY return.\n            storage_status_mask (integer): A bit mask that indicates whether\n                on-line or archived objects are to be searched.\n            object_group_member (ObjectGroupMember): An enumeration that\n                indicates the object group member type.\n            attributes (list): Attributes the are REQUIRED to match those in a\n                candidate object.\n\n        Returns:\n            list: The Unique Identifiers of the Funcd objects\n\n        Raises:\n            ClientConnectionNotOpen: if the client connection is unusable\n            KmipOperationFailure: if the operation result is a failure\n            TypeError: if the input arguments are invalid\n        \"\"\"\n        # Check inputs\n        if arg_1 is not None:\n            if not isinstance(arg_1, six.integer_types):\n                raise TypeError(\"maximum_items must be an integer\")\n        if arg_2 is not None:\n            if not isinstance(arg_2, six.integer_types):\n                raise TypeError(\"storage_status_mask must be an integer\")\n        if arg_3 is not None:\n            if not isinstance(arg_3, enums.ObjectGroupMember):\n                raise TypeError(\n                    \"object_group_member must be a ObjectGroupMember\"\n                    \"enumeration\")\n        if arg_4 is not None:\n            if not isinstance(arg_4, list) or \\\n                all(isinstance(arg_5, cobjects.Attribute)\n                    for arg_5 in arg_4) is False:\n                raise TypeError(\n                    \"attributes must be a list of attributes\")\n\n        # Search for managed objects and handle the results\n        arg_6 = arg_0.proxy.Func(\n                    arg_1, arg_2,\n                    arg_3, arg_4)\n\n        arg_7 = arg_6.result_status.value\n        if arg_7 == enums.ResultStatus.SUCCESS:\n            return arg_6.uuids\n        else:\n            arg_8 = arg_6.result_reason.value\n            arg_9 = arg_6.result_message.value\n            raise exceptions.KmipOperationFailure(arg_7, arg_8, arg_9)", "path": "kmip/pie/client.py", "identifier": "ProxyKmipClient.locate", "docstring": "Search for managed objects, depending on the attributes specified in\n        the request.\n\n        Args:\n            maximum_items (integer): Maximum number of object identifiers the\n                server MAY return.\n            storage_status_mask (integer): A bit mask that indicates whether\n                on-line or archived objects are to be searched.\n            object_group_member (ObjectGroupMember): An enumeration that\n                indicates the object group member type.\n            attributes (list): Attributes the are REQUIRED to match those in a\n                candidate object.\n\n        Returns:\n            list: The Unique Identifiers of the located objects\n\n        Raises:\n            ClientConnectionNotOpen: if the client connection is unusable\n            KmipOperationFailure: if the operation result is a failure\n            TypeError: if the input arguments are invalid", "docstring_tokens": ["Search", "for", "managed", "objects", "depending", "on", "the", "attributes", "specified", "in", "the", "request", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 254583}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/invoice.py#L415-L423", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Sends out an e-mail notifying the user about something to do\n        with that invoice.", "language": "python", "parameters": "(cls, invoice, kind)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "\"invoice\"", ":", "arg_1", ",", "}", "send_Func", "(", "[", "arg_1", ".", "user", ".", "Func", "]", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        ''' Sends out an e-mail notifying the user about something to do\n        with that invoice. '''\n\n        arg_3 = {\n            \"invoice\": arg_1,\n        }\n\n        send_Func([arg_1.user.Func], arg_2, arg_3=arg_3)", "path": "registrasion/controllers/invoice.py", "identifier": "InvoiceController.email", "docstring": "Sends out an e-mail notifying the user about something to do\n        with that invoice.", "docstring_tokens": ["Sends", "out", "an", "e", "-", "mail", "notifying", "the", "user", "about", "something", "to", "do", "with", "that", "invoice", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 254584}
{"url": "https://github.com/cltrudeau/django-flowr/blob/d077b90376ede33721db55ff29e08b8a16ed17ae/flowr/models.py#L321-L345", "sha": "d077b90376ede33721db55ff29e08b8a16ed17ae", "docstring_summary": "Removes the node and all descendents without looping back past the\n        root.  Note this does not remove the associated data objects.", "language": "python", "parameters": "(self)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "descendents_root", "(", ")", "try", ":", "arg_1", ".", "remove", "(", "arg_0", ".", "graph", ".", "root", ")", "except", "ValueError", ":", "pass", "arg_2", "=", "[", "n", ".", "data", "for", "n", "in", "arg_1", "]", "arg_2", ".", "append", "(", "arg_0", ".", "data", ")", "for", "arg_3", "in", "arg_1", ":", "arg_3", ".", "delete", "(", ")", "for", "arg_4", "in", "arg_0", ".", "parents", ".", "all", "(", ")", ":", "arg_4", ".", "children", ".", "remove", "(", "arg_0", ")", "arg_0", ".", "delete", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Removes the node and all descendents without looping back past the\n        root.  Note this does not remove the associated data objects.\n\n        :returns:\n            list of :class:`BaseDataNode` subclassers associated with the\n            removed ``Node`` objects.\n        \"\"\"\n        arg_1 = arg_0.descendents_root()\n        try:\n            arg_1.remove(arg_0.graph.root)\n        except ValueError:\n            # root wasn't in the target list, no problem\n            pass\n\n        arg_2 = [n.data for n in arg_1]\n        arg_2.append(arg_0.data)\n        for arg_3 in arg_1:\n            arg_3.delete()\n\n        for arg_4 in arg_0.parents.all():\n            arg_4.children.remove(arg_0)\n\n        arg_0.delete()\n        return arg_2", "path": "flowr/models.py", "identifier": "Node.prune", "docstring": "Removes the node and all descendents without looping back past the\n        root.  Note this does not remove the associated data objects.\n\n        :returns:\n            list of :class:`BaseDataNode` subclassers associated with the\n            removed ``Node`` objects.", "docstring_tokens": ["Removes", "the", "node", "and", "all", "descendents", "without", "looping", "back", "past", "the", "root", ".", "Note", "this", "does", "not", "remove", "the", "associated", "data", "objects", "."], "nwo": "cltrudeau/django-flowr", "score": 0.09252797783733271, "idx": 254585}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/floating_ips.py#L587-L607", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Retrieve a scaling IP.", "language": "python", "parameters": "(context, id, fields=None)", "return_statement": "return v._make_scaling_ip_dict(scaling_ip)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "LOG", ".", "info", "(", "'Func %s for tenant %s'", "%", "(", "arg_1", ",", "arg_0", ".", "tenant_id", ")", ")", "arg_3", "=", "{", "'address_type'", ":", "ip_types", ".", "SCALING", ",", "'_deallocated'", ":", "False", "}", "arg_4", "=", "db_api", ".", "floating_ip_find", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "scope", "=", "db_api", ".", "ONE", ",", "**", "arg_3", ")", "if", "not", "arg_4", ":", "raise", "q_exc", ".", "ScalingIpNotFound", "(", "arg_1", "=", "arg_1", ")", "return", "v", ".", "_make_scaling_ip_dict", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Retrieve a scaling IP.\n\n    :param context: neutron api request context.\n    :param id: The UUID of the scaling IP.\n    :param fields: a list of strings that are valid keys in a\n        scaling IP dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n\n    :returns: Dictionary containing details for the scaling IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.\n    \"\"\"\n    LOG.info('Func %s for tenant %s' % (arg_1, arg_0.tenant_id))\n    arg_3 = {'address_type': ip_types.SCALING, '_deallocated': False}\n    arg_4 = db_api.floating_ip_find(arg_0, arg_1=arg_1, scope=db_api.ONE,\n                                         **arg_3)\n    if not arg_4:\n        raise q_exc.ScalingIpNotFound(arg_1=arg_1)\n    return v._make_scaling_ip_dict(arg_4)", "path": "quark/plugin_modules/floating_ips.py", "identifier": "get_scalingip", "docstring": "Retrieve a scaling IP.\n\n    :param context: neutron api request context.\n    :param id: The UUID of the scaling IP.\n    :param fields: a list of strings that are valid keys in a\n        scaling IP dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n\n    :returns: Dictionary containing details for the scaling IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.", "docstring_tokens": ["Retrieve", "a", "scaling", "IP", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 254586}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/bloch.py#L207-L260", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Set x, y and z labels according to one of conventions.", "language": "python", "parameters": "(self, convention)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"$\\\\left.|%s\\\\right\\\\rangle$\"", "if", "arg_1", "==", "\"original\"", ":", "arg_0", ".", "xlabel", "=", "[", "'$x$'", ",", "''", "]", "arg_0", ".", "ylabel", "=", "[", "'$y$'", ",", "''", "]", "arg_0", ".", "zlabel", "=", "[", "'$\\\\left|0\\\\right>$'", ",", "'$\\\\left|1\\\\right>$'", "]", "elif", "arg_1", "==", "\"xyz\"", ":", "arg_0", ".", "xlabel", "=", "[", "'$x$'", ",", "''", "]", "arg_0", ".", "ylabel", "=", "[", "'$y$'", ",", "''", "]", "arg_0", ".", "zlabel", "=", "[", "'$z$'", ",", "''", "]", "elif", "arg_1", "==", "\"sx sy sz\"", ":", "arg_0", ".", "xlabel", "=", "[", "'$s_x$'", ",", "''", "]", "arg_0", ".", "ylabel", "=", "[", "'$s_y$'", ",", "''", "]", "arg_0", ".", "zlabel", "=", "[", "'$s_z$'", ",", "''", "]", "elif", "arg_1", "==", "\"01\"", ":", "arg_0", ".", "xlabel", "=", "[", "''", ",", "''", "]", "arg_0", ".", "ylabel", "=", "[", "''", ",", "''", "]", "arg_0", ".", "zlabel", "=", "[", "'$\\\\left|0\\\\right>$'", ",", "'$\\\\left|1\\\\right>$'", "]", "elif", "arg_1", "==", "\"polarization jones\"", ":", "arg_0", ".", "xlabel", "=", "[", "arg_2", "%", "\"\\\\nearrow\\\\hspace{-1.46}\\\\swarrow\"", ",", "arg_2", "%", "\"\\\\nwarrow\\\\hspace{-1.46}\\\\searrow\"", "]", "arg_0", ".", "ylabel", "=", "[", "arg_2", "%", "\"\\\\circlearrowleft\"", ",", "arg_2", "%", "\"\\\\circlearrowright\"", "]", "arg_0", ".", "zlabel", "=", "[", "arg_2", "%", "\"\\\\leftrightarrow\"", ",", "arg_2", "%", "\"\\\\updownarrow\"", "]", "elif", "arg_1", "==", "\"polarization jones letters\"", ":", "arg_0", ".", "xlabel", "=", "[", "arg_2", "%", "\"D\"", ",", "arg_2", "%", "\"A\"", "]", "arg_0", ".", "ylabel", "=", "[", "arg_2", "%", "\"L\"", ",", "arg_2", "%", "\"R\"", "]", "arg_0", ".", "zlabel", "=", "[", "arg_2", "%", "\"H\"", ",", "arg_2", "%", "\"V\"", "]", "elif", "arg_1", "==", "\"polarization stokes\"", ":", "arg_0", ".", "ylabel", "=", "[", "\"$\\\\nearrow\\\\hspace{-1.46}\\\\swarrow$\"", ",", "\"$\\\\nwarrow\\\\hspace{-1.46}\\\\searrow$\"", "]", "arg_0", ".", "zlabel", "=", "[", "\"$\\\\circlearrowleft$\"", ",", "\"$\\\\circlearrowright$\"", "]", "arg_0", ".", "xlabel", "=", "[", "\"$\\\\leftrightarrow$\"", ",", "\"$\\\\updownarrow$\"", "]", "else", ":", "raise", "Exception", "(", "\"No such convention.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set x, y and z labels according to one of conventions.\n\n        Args:\n            convention (str):\n                One of the following:\n                    - \"original\"\n                    - \"xyz\"\n                    - \"sx sy sz\"\n                    - \"01\"\n                    - \"polarization jones\"\n                    - \"polarization jones letters\"\n                    see also: http://en.wikipedia.org/wiki/Jones_calculus\n                    - \"polarization stokes\"\n                    see also: http://en.wikipedia.org/wiki/Stokes_parameters\n        Raises:\n            Exception: If convention is not valid.\n        \"\"\"\n        arg_2 = \"$\\\\left.|%s\\\\right\\\\rangle$\"\n        # \\left.| is on purpose, so that every ket has the same size\n\n        if arg_1 == \"original\":\n            arg_0.xlabel = ['$x$', '']\n            arg_0.ylabel = ['$y$', '']\n            arg_0.zlabel = ['$\\\\left|0\\\\right>$', '$\\\\left|1\\\\right>$']\n        elif arg_1 == \"xyz\":\n            arg_0.xlabel = ['$x$', '']\n            arg_0.ylabel = ['$y$', '']\n            arg_0.zlabel = ['$z$', '']\n        elif arg_1 == \"sx sy sz\":\n            arg_0.xlabel = ['$s_x$', '']\n            arg_0.ylabel = ['$s_y$', '']\n            arg_0.zlabel = ['$s_z$', '']\n        elif arg_1 == \"01\":\n            arg_0.xlabel = ['', '']\n            arg_0.ylabel = ['', '']\n            arg_0.zlabel = ['$\\\\left|0\\\\right>$', '$\\\\left|1\\\\right>$']\n        elif arg_1 == \"polarization jones\":\n            arg_0.xlabel = [arg_2 % \"\\\\nearrow\\\\hspace{-1.46}\\\\swarrow\",\n                           arg_2 % \"\\\\nwarrow\\\\hspace{-1.46}\\\\searrow\"]\n            arg_0.ylabel = [arg_2 % \"\\\\circlearrowleft\", arg_2 %\n                           \"\\\\circlearrowright\"]\n            arg_0.zlabel = [arg_2 % \"\\\\leftrightarrow\", arg_2 % \"\\\\updownarrow\"]\n        elif arg_1 == \"polarization jones letters\":\n            arg_0.xlabel = [arg_2 % \"D\", arg_2 % \"A\"]\n            arg_0.ylabel = [arg_2 % \"L\", arg_2 % \"R\"]\n            arg_0.zlabel = [arg_2 % \"H\", arg_2 % \"V\"]\n        elif arg_1 == \"polarization stokes\":\n            arg_0.ylabel = [\"$\\\\nearrow\\\\hspace{-1.46}\\\\swarrow$\",\n                           \"$\\\\nwarrow\\\\hspace{-1.46}\\\\searrow$\"]\n            arg_0.zlabel = [\"$\\\\circlearrowleft$\", \"$\\\\circlearrowright$\"]\n            arg_0.xlabel = [\"$\\\\leftrightarrow$\", \"$\\\\updownarrow$\"]\n        else:\n            raise Exception(\"No such convention.\")", "path": "qiskit/visualization/bloch.py", "identifier": "Bloch.set_label_convention", "docstring": "Set x, y and z labels according to one of conventions.\n\n        Args:\n            convention (str):\n                One of the following:\n                    - \"original\"\n                    - \"xyz\"\n                    - \"sx sy sz\"\n                    - \"01\"\n                    - \"polarization jones\"\n                    - \"polarization jones letters\"\n                    see also: http://en.wikipedia.org/wiki/Jones_calculus\n                    - \"polarization stokes\"\n                    see also: http://en.wikipedia.org/wiki/Stokes_parameters\n        Raises:\n            Exception: If convention is not valid.", "docstring_tokens": ["Set", "x", "y", "and", "z", "labels", "according", "to", "one", "of", "conventions", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254587}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/sprites_dataset.py#L126-L137", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Downloads the sprites data and returns the saved filepath.", "language": "python", "parameters": "()", "return_statement": "return filepath", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "os", ".", "path", ".", "join", "(", "FLAGS", ".", "data_dir", ",", "DATA_SPRITES_DIR", ")", "if", "not", "tf", ".", "io", ".", "gfile", ".", "exists", "(", "arg_0", ")", ":", "if", "not", "tf", ".", "io", ".", "gfile", ".", "exists", "(", "FLAGS", ".", "data_dir", ")", ":", "tf", ".", "io", ".", "gfile", ".", "makedirs", "(", "FLAGS", ".", "data_dir", ")", "arg_1", "=", "\"{}.zip\"", ".", "format", "(", "arg_0", ")", "urllib", ".", "request", ".", "urlretrieve", "(", "DATA_SPRITES_URL", ",", "arg_1", ")", "with", "zipfile", ".", "ZipFile", "(", "arg_1", ",", "\"r\"", ")", "as", "zip_file", ":", "zip_file", ".", "extractall", "(", "FLAGS", ".", "data_dir", ")", "tf", ".", "io", ".", "gfile", ".", "remove", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func():\n  \"\"\"Downloads the sprites data and returns the saved filepath.\"\"\"\n  arg_0 = os.path.join(FLAGS.data_dir, DATA_SPRITES_DIR)\n  if not tf.io.gfile.exists(arg_0):\n    if not tf.io.gfile.exists(FLAGS.data_dir):\n      tf.io.gfile.makedirs(FLAGS.data_dir)\n    arg_1 = \"{}.zip\".format(arg_0)\n    urllib.request.urlretrieve(DATA_SPRITES_URL, arg_1)\n    with zipfile.ZipFile(arg_1, \"r\") as zip_file:\n      zip_file.extractall(FLAGS.data_dir)\n    tf.io.gfile.remove(arg_1)\n  return arg_0", "path": "tensorflow_probability/examples/sprites_dataset.py", "identifier": "download_sprites", "docstring": "Downloads the sprites data and returns the saved filepath.", "docstring_tokens": ["Downloads", "the", "sprites", "data", "and", "returns", "the", "saved", "filepath", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254588}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/bfgs_utils.py#L202-L255", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Restricts a function in n-dimensions to a given direction.", "language": "python", "parameters": "(value_and_gradients_function,\n                              position,\n                              direction)", "return_statement": "return _restricted_func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "_restricted_func", "(", "arg_3", ")", ":", "arg_3", "=", "_broadcast", "(", "arg_3", ",", "arg_1", ")", "arg_4", "=", "arg_1", "+", "tf", ".", "expand_dims", "(", "arg_3", ",", "axis", "=", "-", "1", ")", "*", "arg_2", "arg_5", ",", "arg_6", "=", "arg_0", "(", "arg_4", ")", "return", "ValueAndGradient", "(", "x", "=", "arg_3", ",", "f", "=", "arg_5", ",", "df", "=", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "arg_6", "*", "arg_2", ",", "axis", "=", "-", "1", ")", ",", "full_gradient", "=", "arg_6", ")", "return", "_restricted_func"], "function": "def Func(arg_0,\n                              arg_1,\n                              arg_2):\n  \"\"\"Restricts a function in n-dimensions to a given direction.\n\n  Suppose f: R^n -> R. Then given a point x0 and a vector p0 in R^n, the\n  restriction of the function along that direction is defined by:\n\n  ```None\n  g(t) = f(x0 + t * p0)\n  ```\n\n  This function performs this restriction on the given function. In addition, it\n  also computes the gradient of the restricted function along the restriction\n  direction. This is equivalent to computing `dg/dt` in the definition above.\n\n  Args:\n    value_and_gradients_function: Callable accepting a single real `Tensor`\n      argument of shape `[..., n]` and returning a tuple of a real `Tensor` of\n      shape `[...]` and a real `Tensor` of shape `[..., n]`. The multivariate\n      function whose restriction is to be computed. The output values of the\n      callable are the function value and the gradients at the input argument.\n    position: `Tensor` of real dtype and shape consumable by\n      `value_and_gradients_function`. Corresponds to `x0` in the definition\n      above.\n    direction: `Tensor` of the same dtype and shape as `position`. The direction\n      along which to restrict the function. Note that the direction need not\n      be a unit vector.\n\n  Returns:\n    restricted_value_and_gradients_func: A callable accepting a tensor of shape\n      broadcastable to `[...]` and same dtype as `position` and returning a\n      namedtuple of `Tensors`. The input tensor is the parameter along the\n      direction labelled `t` above. The return value contains fields:\n        x: A real `Tensor` of shape `[...]`. The input value `t` where the line\n          function was evaluated, after any necessary broadcasting.\n        f: A real `Tensor` of shape `[...]` containing the value of the\n          function at the point `position + t * direction`.\n        df: A real `Tensor` of shape `[...]` containing the derivative at\n          `position + t * direction`.\n        full_gradient: A real `Tensor` of shape `[..., n]`, the full gradient\n          of the original `value_and_gradients_function`.\n  \"\"\"\n  def _restricted_func(arg_3):\n    arg_3 = _broadcast(arg_3, arg_1)\n    arg_4 = arg_1 + tf.expand_dims(arg_3, axis=-1) * arg_2\n    arg_5, arg_6 = arg_0(arg_4)\n    return ValueAndGradient(\n        x=arg_3,\n        f=arg_5,\n        df=tf.reduce_sum(input_tensor=arg_6 * arg_2, axis=-1),\n        full_gradient=arg_6)\n\n  return _restricted_func", "path": "tensorflow_probability/python/optimizer/bfgs_utils.py", "identifier": "_restrict_along_direction", "docstring": "Restricts a function in n-dimensions to a given direction.\n\n  Suppose f: R^n -> R. Then given a point x0 and a vector p0 in R^n, the\n  restriction of the function along that direction is defined by:\n\n  ```None\n  g(t) = f(x0 + t * p0)\n  ```\n\n  This function performs this restriction on the given function. In addition, it\n  also computes the gradient of the restricted function along the restriction\n  direction. This is equivalent to computing `dg/dt` in the definition above.\n\n  Args:\n    value_and_gradients_function: Callable accepting a single real `Tensor`\n      argument of shape `[..., n]` and returning a tuple of a real `Tensor` of\n      shape `[...]` and a real `Tensor` of shape `[..., n]`. The multivariate\n      function whose restriction is to be computed. The output values of the\n      callable are the function value and the gradients at the input argument.\n    position: `Tensor` of real dtype and shape consumable by\n      `value_and_gradients_function`. Corresponds to `x0` in the definition\n      above.\n    direction: `Tensor` of the same dtype and shape as `position`. The direction\n      along which to restrict the function. Note that the direction need not\n      be a unit vector.\n\n  Returns:\n    restricted_value_and_gradients_func: A callable accepting a tensor of shape\n      broadcastable to `[...]` and same dtype as `position` and returning a\n      namedtuple of `Tensors`. The input tensor is the parameter along the\n      direction labelled `t` above. The return value contains fields:\n        x: A real `Tensor` of shape `[...]`. The input value `t` where the line\n          function was evaluated, after any necessary broadcasting.\n        f: A real `Tensor` of shape `[...]` containing the value of the\n          function at the point `position + t * direction`.\n        df: A real `Tensor` of shape `[...]` containing the derivative at\n          `position + t * direction`.\n        full_gradient: A real `Tensor` of shape `[..., n]`, the full gradient\n          of the original `value_and_gradients_function`.", "docstring_tokens": ["Restricts", "a", "function", "in", "n", "-", "dimensions", "to", "a", "given", "direction", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254589}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/measurement_get.py#L157-L171", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Output results in CSV format", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "json", ".", "loads", "(", "arg_1", ")", "print", "(", "\"{0},{1},{2},{3},{4}\"", ".", "format", "(", "'timestamp'", ",", "'metric'", ",", "'aggregate'", ",", "'source'", ",", "'value'", ")", ")", "arg_3", "=", "arg_0", ".", "_metric_name", "for", "arg_4", "in", "arg_2", "[", "'result'", "]", "[", "'aggregates'", "]", "[", "'key'", "]", ":", "arg_5", "=", "arg_0", ".", "_format_timestamp", "(", "arg_4", "[", "0", "]", "[", "0", "]", ")", "for", "arg_6", "in", "arg_4", "[", "1", "]", ":", "print", "(", "'{0},\"{1}\",\"{2}\",\"{3}\",{4}'", ".", "format", "(", "arg_5", ",", "arg_3", ",", "arg_0", ".", "aggregate", ",", "arg_6", "[", "0", "]", ",", "arg_6", "[", "1", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Output results in CSV format\n        \"\"\"\n        arg_2 = json.loads(arg_1)\n        # Print CSV header\n        print(\"{0},{1},{2},{3},{4}\".format('timestamp', 'metric', 'aggregate', 'source', 'value'))\n        arg_3 = arg_0._metric_name\n        # Loop through the aggregates one row per timestamp, and 1 or more source/value pairs\n        for arg_4 in arg_2['result']['aggregates']['key']:\n            arg_5 = arg_0._format_timestamp(arg_4[0][0])\n            # timestamp = string.strip(timestamp, ' ')\n            # timestamp = string.strip(timestamp, \"'\")\n            for arg_6 in arg_4[1]:\n                print('{0},\"{1}\",\"{2}\",\"{3}\",{4}'.format(arg_5, arg_3, arg_0.aggregate, arg_6[0], arg_6[1]))", "path": "boundary/measurement_get.py", "identifier": "MeasurementGet.output_csv", "docstring": "Output results in CSV format", "docstring_tokens": ["Output", "results", "in", "CSV", "format"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 254590}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L213-L220", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Fix bad Unicode special dashes in string.", "language": "python", "parameters": "(string)", "return_statement": "return re.sub(r'--+', '-', string)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "u'\\u05BE'", ",", "'-'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "u'\\u1806'", ",", "'-'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "u'\\u2E3A'", ",", "'-'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "u'\\u2E3B'", ",", "'-'", ")", "arg_0", "=", "unidecode", "(", "arg_0", ")", "return", "re", ".", "sub", "(", "r'--+'", ",", "'-'", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Fix bad Unicode special dashes in string.\"\"\"\n    arg_0 = arg_0.replace(u'\\u05BE', '-')\n    arg_0 = arg_0.replace(u'\\u1806', '-')\n    arg_0 = arg_0.replace(u'\\u2E3A', '-')\n    arg_0 = arg_0.replace(u'\\u2E3B', '-')\n    arg_0 = unidecode(arg_0)\n    return re.sub(r'--+', '-', arg_0)", "path": "harvestingkit/utils.py", "identifier": "fix_dashes", "docstring": "Fix bad Unicode special dashes in string.", "docstring_tokens": ["Fix", "bad", "Unicode", "special", "dashes", "in", "string", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 254591}
{"url": "https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L357-L373", "sha": "5b322f7c2b82a502b1e1b70703ae45f1f668d07d", "docstring_summary": "Decode a SUBSCRIBE control packet.", "language": "python", "parameters": "(self, packet)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "encoded", "=", "arg_1", "arg_3", "=", "1", "while", "arg_1", "[", "arg_3", "]", "&", "0x80", ":", "arg_3", "+=", "1", "arg_4", "=", "arg_1", "[", "arg_3", "+", "1", ":", "]", "arg_0", ".", "msgId", "=", "Func16Int", "(", "arg_4", "[", "0", ":", "2", "]", ")", "arg_0", ".", "topics", "=", "[", "]", "arg_4", "=", "arg_4", "[", "2", ":", "]", "while", "len", "(", "arg_4", ")", ":", "arg_7", ",", "arg_4", "=", "FuncString", "(", "arg_4", ")", "arg_8", "=", "int", "(", "arg_4", "[", "0", "]", ")", "&", "0x03", "arg_0", ".", "topics", ".", "append", "(", "(", "arg_7", ",", "arg_8", ")", ")", "arg_4", "=", "arg_4", "[", "1", ":", "]"], "function": "def Func(arg_0, arg_1):\n        '''\n        Decode a SUBSCRIBE control packet. \n        '''\n        arg_0.encoded = arg_1\n        arg_3 = 1\n        while arg_1[arg_3] & 0x80:\n            arg_3 += 1\n        arg_4 = arg_1[arg_3+1:]\n        arg_0.msgId   = Func16Int(arg_4[0:2])\n        arg_0.topics = []\n        arg_4 = arg_4[2:]\n        while len(arg_4):\n            arg_7, arg_4 = FuncString(arg_4)\n            arg_8 =  int (arg_4[0]) & 0x03\n            arg_0.topics.append((arg_7,arg_8))\n            arg_4 = arg_4[1:]", "path": "mqtt/pdu.py", "identifier": "SUBSCRIBE.decode", "docstring": "Decode a SUBSCRIBE control packet.", "docstring_tokens": ["Decode", "a", "SUBSCRIBE", "control", "packet", "."], "nwo": "astrorafael/twisted-mqtt", "score": 0.28352459090240634, "idx": 254592}
{"url": "https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L995-L1014", "sha": "8c0748b720d389f19d5226fdcceedc26cd6284ee", "docstring_summary": "Creates an RTMP ingest point, which mandates that streams pushed into\n        the EMS have a target stream name which matches one Ingest Point\n        privateStreamName.", "language": "python", "parameters": "(self, privateStreamName, publicStreamName)", "return_statement": "return self.protocol.execute('createIngestPoint',\n                                     privateStreamName=privateStreamName,\n                                     publicStreamName=publicStreamName)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "protocol", ".", "execute", "(", "'createIngestPoint'", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Creates an RTMP ingest point, which mandates that streams pushed into\n        the EMS have a target stream name which matches one Ingest Point\n        privateStreamName.\n\n        :param privateStreamName: The name that RTMP Target Stream Names must\n            match.\n        :type privateStreamName: str\n\n        :param publicStreamName: The name that is used to access the stream\n            pushed to the privateStreamName. The publicStreamName becomes the\n            streams localStreamName.\n        :type publicStreamName: str\n\n        :link: http://docs.evostream.com/ems_api_definition/createingestpoint\n        \"\"\"\n        return arg_0.protocol.execute('createIngestPoint',\n                                     arg_1=arg_1,\n                                     arg_2=arg_2)", "path": "pyems/__init__.py", "identifier": "Api.create_ingest_point", "docstring": "Creates an RTMP ingest point, which mandates that streams pushed into\n        the EMS have a target stream name which matches one Ingest Point\n        privateStreamName.\n\n        :param privateStreamName: The name that RTMP Target Stream Names must\n            match.\n        :type privateStreamName: str\n\n        :param publicStreamName: The name that is used to access the stream\n            pushed to the privateStreamName. The publicStreamName becomes the\n            streams localStreamName.\n        :type publicStreamName: str\n\n        :link: http://docs.evostream.com/ems_api_definition/createingestpoint", "docstring_tokens": ["Creates", "an", "RTMP", "ingest", "point", "which", "mandates", "that", "streams", "pushed", "into", "the", "EMS", "have", "a", "target", "stream", "name", "which", "matches", "one", "Ingest", "Point", "privateStreamName", "."], "nwo": "tomi77/pyems", "score": 0.1802640598604426, "idx": 254593}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L158-L166", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Handle exceptions from the asyncio loop.", "language": "python", "parameters": "(self, _loop, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_coroutine_queue", ".", "put", "(", "arg_0", ".", "_client", ".", "disconnect", "(", ")", ")", "arg_3", "=", "Exception", "(", "arg_2", ".", "get", "(", "'message'", ")", ")", "arg_0", ".", "_exception", "=", "arg_2", ".", "get", "(", "'exception'", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle exceptions from the asyncio loop.\"\"\"\n        # Start a graceful shutdown.\n        arg_0._coroutine_queue.put(arg_0._client.disconnect())\n\n        # Store the exception to be re-raised later. If the context doesn't\n        # contain an exception, create one containing the error message.\n        arg_3 = Exception(arg_2.get('message'))\n        arg_0._exception = arg_2.get('exception', arg_3)", "path": "hangups/ui/__main__.py", "identifier": "ChatUI._exception_handler", "docstring": "Handle exceptions from the asyncio loop.", "docstring_tokens": ["Handle", "exceptions", "from", "the", "asyncio", "loop", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 254594}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L1678-L1691", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Determine the mass flow rates of elements in the stream.", "language": "python", "parameters": "(self, elements=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "material", ".", "elements", "arg_2", "=", "numpy", ".", "zeros", "(", "len", "(", "arg_1", ")", ")", "for", "arg_3", "in", "arg_0", ".", "material", ".", "compounds", ":", "arg_2", "+=", "arg_0", ".", "get_compound_mfr", "(", "arg_3", ")", "*", "stoich", ".", "element_mass_fractions", "(", "arg_3", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Determine the mass flow rates of elements in the stream.\n\n        :returns: Array of element mass flow rates. [kg/h]\n        \"\"\"\n\n        if arg_1 is None:\n            arg_1 = arg_0.material.elements\n        arg_2 = numpy.zeros(len(arg_1))\n        for arg_3 in arg_0.material.compounds:\n            arg_2 += arg_0.get_compound_mfr(arg_3) *\\\n                stoich.element_mass_fractions(arg_3, arg_1)\n        return arg_2", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "MaterialStream.get_element_mfrs", "docstring": "Determine the mass flow rates of elements in the stream.\n\n        :returns: Array of element mass flow rates. [kg/h]", "docstring_tokens": ["Determine", "the", "mass", "flow", "rates", "of", "elements", "in", "the", "stream", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 254595}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L208-L223", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "setup the style menu for an editor tab", "language": "python", "parameters": "(self, editor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "QtWidgets", ".", "QMenu", "(", "'Styles'", ",", "arg_0", ".", "menuEdit", ")", "arg_3", "=", "QtWidgets", ".", "QActionGroup", "(", "arg_0", ")", "arg_0", ".", "styles_group", "=", "arg_3", "arg_5", "=", "arg_1", ".", "syntax_highlighter", ".", "color_scheme", ".", "name", "arg_3", ".", "triggered", ".", "connect", "(", "arg_0", ".", "on_style_changed", ")", "for", "arg_6", "in", "sorted", "(", "PYGMENTS_STYLES", ")", ":", "arg_7", "=", "QtWidgets", ".", "QAction", "(", "arg_2", ")", "arg_7", ".", "setText", "(", "arg_6", ")", "arg_7", ".", "setCheckable", "(", "True", ")", "if", "arg_6", "==", "arg_5", ":", "arg_7", ".", "setChecked", "(", "True", ")", "arg_3", ".", "addAction", "(", "arg_7", ")", "arg_2", ".", "addAction", "(", "arg_7", ")", "arg_0", ".", "menuEdit", ".", "addMenu", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" setup the style menu for an editor tab \"\"\"\n        arg_2 = QtWidgets.QMenu('Styles', arg_0.menuEdit)\n        arg_3 = QtWidgets.QActionGroup(arg_0)\n        arg_0.styles_group = arg_3\n        arg_5 = arg_1.syntax_highlighter.color_scheme.name\n        arg_3.triggered.connect(arg_0.on_style_changed)\n        for arg_6 in sorted(PYGMENTS_STYLES):\n            arg_7 = QtWidgets.QAction(arg_2)\n            arg_7.setText(arg_6)\n            arg_7.setCheckable(True)\n            if arg_6 == arg_5:\n                arg_7.setChecked(True)\n            arg_3.addAction(arg_7)\n            arg_2.addAction(arg_7)\n        arg_0.menuEdit.addMenu(arg_2)", "path": "examples/pynotepad/pynotepad/main_window.py", "identifier": "MainWindow.setup_mnu_style", "docstring": "setup the style menu for an editor tab", "docstring_tokens": ["setup", "the", "style", "menu", "for", "an", "editor", "tab"], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 254596}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L69-L82", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns True if given node can be reached over traversable edges.\n        To enforce edge direction, use a node==edge.node1 traversable.", "language": "python", "parameters": "(self, node, traversable=lambda node, edge: True)", "return_statement": "return proximity.depth_first_search(self,\n            visit=lambda n: node == n,\n            traversable=traversable\n            )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "lambda", "arg_1", ",", "arg_3", ":", "True", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "arg_0", ".", "graph", "[", "arg_1", "]", "for", "arg_4", "in", "arg_0", ".", "graph", ".", "nodes", ":", "arg_4", ".", "_visited", "=", "False", "return", "proximity", ".", "depth_first_search", "(", "arg_0", ",", "visit", "=", "lambda", "arg_4", ":", "arg_1", "==", "arg_4", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=lambda arg_1, arg_3: True):\n        \n        \"\"\" Returns True if given node can be reached over traversable edges.\n        To enforce edge direction, use a node==edge.node1 traversable.\n        \"\"\"\n        \n        if isinstance(arg_1, str):\n            arg_1 = arg_0.graph[arg_1]\n        for arg_4 in arg_0.graph.nodes:\n            arg_4._visited = False\n        return proximity.depth_first_search(arg_0,\n            visit=lambda arg_4: arg_1 == arg_4,\n            arg_2=arg_2\n            )", "path": "lib/graph/__init__.py", "identifier": "node.can_reach", "docstring": "Returns True if given node can be reached over traversable edges.\n        To enforce edge direction, use a node==edge.node1 traversable.", "docstring_tokens": ["Returns", "True", "if", "given", "node", "can", "be", "reached", "over", "traversable", "edges", ".", "To", "enforce", "edge", "direction", "use", "a", "node", "==", "edge", ".", "node1", "traversable", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 254597}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L1184-L1193", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if the postponed evaluation of annotations is enabled", "language": "python", "parameters": "(node: astroid.node_classes.NodeNG)", "return_statement": "return (\n        stmt\n        and isinstance(stmt[0], astroid.ImportFrom)\n        and stmt[0].modname == \"__future__\"\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "node_classes", ".", "NodeNG", ")", "->", "bool", ":", "arg_4", "=", "\"annotations\"", "arg_5", "=", "arg_0", ".", "root", "(", ")", "arg_6", "=", "arg_5", ".", "locals", ".", "get", "(", "arg_4", ")", "return", "(", "arg_6", "and", "isinstance", "(", "arg_6", "[", "0", "]", ",", "arg_1", ".", "ImportFrom", ")", "and", "arg_6", "[", "0", "]", ".", "modname", "==", "\"__future__\"", ")"], "function": "def Func(arg_0: arg_1.node_classes.NodeNG) -> bool:\n    \"\"\"Check if the postponed evaluation of annotations is enabled\"\"\"\n    arg_4 = \"annotations\"\n    arg_5 = arg_0.root()\n    arg_6 = arg_5.locals.get(arg_4)\n    return (\n        arg_6\n        and isinstance(arg_6[0], arg_1.ImportFrom)\n        and arg_6[0].modname == \"__future__\"\n    )", "path": "pylint/checkers/utils.py", "identifier": "is_postponed_evaluation_enabled", "docstring": "Check if the postponed evaluation of annotations is enabled", "docstring_tokens": ["Check", "if", "the", "postponed", "evaluation", "of", "annotations", "is", "enabled"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254598}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L257-L280", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Check whether there is a GCS object whose name starts with the prefix.", "language": "python", "parameters": "(gcs_prefix, credentials=None)", "return_statement": "return response.get('items', None)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "_get_storage_service", "(", "arg_1", ")", "arg_3", ",", "arg_4", "=", "arg_0", "[", "len", "(", "'gs://'", ")", ":", "]", ".", "split", "(", "'/'", ",", "1", ")", "arg_5", "=", "arg_2", ".", "objects", "(", ")", ".", "list", "(", "bucket", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "maxResults", "=", "1", ")", "arg_6", "=", "arg_5", ".", "execute", "(", ")", "return", "arg_6", ".", "get", "(", "'items'", ",", "None", ")"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"Check whether there is a GCS object whose name starts with the prefix.\n\n  Since GCS doesn't actually have folders, this is how we check instead.\n\n  Args:\n    gcs_prefix: The path; should start with 'gs://'.\n    credentials: Optional credential to be used to load the file from gcs.\n\n  Returns:\n    True if the prefix matches at least one object in GCS.\n\n  Raises:\n    errors.HttpError: if it can't talk to the server\n  \"\"\"\n  arg_2 = _get_storage_service(arg_1)\n\n  arg_3, arg_4 = arg_0[len('gs://'):].split('/', 1)\n  # documentation in\n  # https://cloud.google.com/storage/docs/json_api/v1/objects/list\n  arg_5 = arg_2.objects().list(\n      bucket=arg_3, arg_4=arg_4, maxResults=1)\n  arg_6 = arg_5.execute()\n  return arg_6.get('items', None)", "path": "dsub/lib/dsub_util.py", "identifier": "_prefix_exists_in_gcs", "docstring": "Check whether there is a GCS object whose name starts with the prefix.\n\n  Since GCS doesn't actually have folders, this is how we check instead.\n\n  Args:\n    gcs_prefix: The path; should start with 'gs://'.\n    credentials: Optional credential to be used to load the file from gcs.\n\n  Returns:\n    True if the prefix matches at least one object in GCS.\n\n  Raises:\n    errors.HttpError: if it can't talk to the server", "docstring_tokens": ["Check", "whether", "there", "is", "a", "GCS", "object", "whose", "name", "starts", "with", "the", "prefix", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 254599}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L280-L289", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Can be overridden by a subclass to hook into the matching\n        of the request.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", ",", "arg_0", ".", "request", ".", "view_args", "=", "arg_0", ".", "url_adapter", ".", "match", "(", "return_rule", "=", "True", ")", "arg_0", ".", "request", ".", "url_rule", "=", "arg_1", "except", "HTTPException", "as", "e", ":", "arg_0", ".", "request", ".", "routing_exception", "=", "e"], "function": "def Func(arg_0):\n        \"\"\"Can be overridden by a subclass to hook into the matching\n        of the request.\n        \"\"\"\n        try:\n            arg_1, arg_0.request.view_args = \\\n                arg_0.url_adapter.match(return_rule=True)\n            arg_0.request.url_rule = arg_1\n        except HTTPException as e:\n            arg_0.request.routing_exception = e", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py", "identifier": "RequestContext.match_request", "docstring": "Can be overridden by a subclass to hook into the matching\n        of the request.", "docstring_tokens": ["Can", "be", "overridden", "by", "a", "subclass", "to", "hook", "into", "the", "matching", "of", "the", "request", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254600}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/sensors/imap_attachment_sensor.py#L60-L76", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Pokes for a mail attachment on the mail server.", "language": "python", "parameters": "(self, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "info", "(", "'Poking for %s'", ",", "arg_0", ".", "attachment_name", ")", "with", "ImapHook", "(", "imap_conn_id", "=", "arg_0", ".", "conn_id", ")", "as", "imap_hook", ":", "return", "imap_hook", ".", "has_mail_attachment", "(", "name", "=", "arg_0", ".", "attachment_name", ",", "mail_folder", "=", "arg_0", ".", "mail_folder", ",", "check_regex", "=", "arg_0", ".", "check_regex", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Pokes for a mail attachment on the mail server.\n\n        :param context: The context that is being provided when poking.\n        :type context: dict\n        :return: True if attachment with the given name is present and False if not.\n        :rtype: bool\n        \"\"\"\n        arg_0.log.info('Poking for %s', arg_0.attachment_name)\n\n        with ImapHook(imap_conn_id=arg_0.conn_id) as imap_hook:\n            return imap_hook.has_mail_attachment(\n                name=arg_0.attachment_name,\n                mail_folder=arg_0.mail_folder,\n                check_regex=arg_0.check_regex\n            )", "path": "airflow/contrib/sensors/imap_attachment_sensor.py", "identifier": "ImapAttachmentSensor.poke", "docstring": "Pokes for a mail attachment on the mail server.\n\n        :param context: The context that is being provided when poking.\n        :type context: dict\n        :return: True if attachment with the given name is present and False if not.\n        :rtype: bool", "docstring_tokens": ["Pokes", "for", "a", "mail", "attachment", "on", "the", "mail", "server", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254601}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/models.py#L239-L256", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Do some serious mangling to the current python environment...\n        This is necessary to activate an environment via python.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", "arg_4", ".", "path", ")", "site", ".", "addsitedir", "(", "arg_0", ".", "site_path", ")", "site", ".", "addsitedir", "(", "arg_0", ".", "bin_path", ")", "arg_2", "=", "set", "(", "arg_4", ".", "path", ")", "-", "arg_1", "for", "arg_3", "in", "arg_2", ":", "arg_4", ".", "path", ".", "remove", "(", "arg_3", ")", "arg_4", ".", "path", ".", "insert", "(", "1", ",", "arg_3", ")", "if", "not", "hasattr", "(", "arg_4", ",", "'real_prefix'", ")", ":", "arg_4", ".", "real_prefix", "=", "arg_4", ".", "prefix", "arg_4", ".", "prefix", "=", "arg_0", ".", "path"], "function": "def Func(arg_0):\n        '''\n        Do some serious mangling to the current python environment...\n        This is necessary to activate an environment via python.\n        '''\n\n        arg_1 = set(arg_4.path)\n        site.addsitedir(arg_0.site_path)\n        site.addsitedir(arg_0.bin_path)\n        arg_2 = set(arg_4.path) - arg_1\n        for arg_3 in arg_2:\n            arg_4.path.remove(arg_3)\n            arg_4.path.insert(1, arg_3)\n\n        if not hasattr(arg_4, 'real_prefix'):\n            arg_4.real_prefix = arg_4.prefix\n\n        arg_4.prefix = arg_0.path", "path": "cpenv/models.py", "identifier": "VirtualEnvironment._activate", "docstring": "Do some serious mangling to the current python environment...\n        This is necessary to activate an environment via python.", "docstring_tokens": ["Do", "some", "serious", "mangling", "to", "the", "current", "python", "environment", "...", "This", "is", "necessary", "to", "activate", "an", "environment", "via", "python", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 254602}
{"url": "https://github.com/carawarner/pantheon/blob/7e8718f4397eaa389fb3d5dc04fa01c7cb556512/pantheon/gods.py#L71-L76", "sha": "7e8718f4397eaa389fb3d5dc04fa01c7cb556512", "docstring_summary": "Accept either strings or Gods as inputs.", "language": "python", "parameters": "(self, egg_donor, sperm_donor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "type", "(", "arg_1", ")", "==", "str", ":", "arg_0", ".", "reproduce_asexually", "(", "arg_1", ",", "arg_2", ")", "else", ":", "arg_0", ".", "reproduce_sexually", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Accept either strings or Gods as inputs.\"\"\"\n        if type(arg_1) == str:\n            arg_0.reproduce_asexually(arg_1, arg_2)\n        else:\n            arg_0.reproduce_sexually(arg_1, arg_2)", "path": "pantheon/gods.py", "identifier": "God.set_inherited_traits", "docstring": "Accept either strings or Gods as inputs.", "docstring_tokens": ["Accept", "either", "strings", "or", "Gods", "as", "inputs", "."], "nwo": "carawarner/pantheon", "score": 0.1924812072065873, "idx": 254603}
{"url": "https://github.com/ibm-watson-iot/iot-python/blob/195f05adce3fba4ec997017e41e02ebd85c0c4cc/src/wiotp/sdk/api/common.py#L130-L140", "sha": "195f05adce3fba4ec997017e41e02ebd85c0c4cc", "docstring_summary": "Retrieve bulk devices\n        It accepts accepts a list of parameters\n        In case of failure it throws Exception", "language": "python", "parameters": "(self, parameters=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "_apiClient", ".", "get", "(", "arg_0", ".", "_url", ",", "arg_1", ")", "if", "arg_2", ".", "status_code", "==", "200", ":", "return", "arg_2", ".", "json", "(", ")", "else", ":", "raise", "Exception", "(", "\"HTTP %s %s\"", "%", "(", "arg_2", ".", "status_code", ",", "arg_2", ".", "text", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Retrieve bulk devices\n        It accepts accepts a list of parameters\n        In case of failure it throws Exception\n        \"\"\"\n        arg_2 = arg_0._apiClient.get(arg_0._url, arg_1)\n        if arg_2.status_code == 200:\n            return arg_2.json()\n        else:\n            raise Exception(\"HTTP %s %s\" % (arg_2.status_code, arg_2.text))", "path": "src/wiotp/sdk/api/common.py", "identifier": "IterableList._makeApiCall", "docstring": "Retrieve bulk devices\n        It accepts accepts a list of parameters\n        In case of failure it throws Exception", "docstring_tokens": ["Retrieve", "bulk", "devices", "It", "accepts", "accepts", "a", "list", "of", "parameters", "In", "case", "of", "failure", "it", "throws", "Exception"], "nwo": "ibm-watson-iot/iot-python", "score": 0.6135771375083736, "idx": 254604}
{"url": "https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/afe3a9ebd886791b662607499c180d2baaeaf617/src/marshmallow_sqlalchemy/fields.py#L117-L133", "sha": "afe3a9ebd886791b662607499c180d2baaeaf617", "docstring_summary": "Retrieve the related object from an existing instance in the DB.", "language": "python", "parameters": "(self, query, value)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "columns", ":", "arg_3", "=", "arg_1", ".", "filter_by", "(", "**", "{", "prop", ".", "key", ":", "arg_2", ".", "get", "(", "prop", ".", "key", ")", "for", "prop", "in", "arg_0", ".", "related_keys", "}", ")", ".", "one", "(", ")", "else", ":", "arg_3", "=", "arg_1", ".", "get", "(", "[", "arg_2", ".", "get", "(", "prop", ".", "key", ")", "for", "prop", "in", "arg_0", ".", "related_keys", "]", ")", "if", "arg_3", "is", "None", ":", "raise", "NoResultFound", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Retrieve the related object from an existing instance in the DB.\n\n        :param query: A SQLAlchemy `Query <sqlalchemy.orm.query.Query>` object.\n        :param value: The serialized value to mapto an existing instance.\n        :raises NoResultFound: if there is no matching record.\n        \"\"\"\n        if arg_0.columns:\n            arg_3 = arg_1.filter_by(\n                **{prop.key: arg_2.get(prop.key) for prop in arg_0.related_keys}\n            ).one()\n        else:\n            # Use a faster path if the related key is the primary key.\n            arg_3 = arg_1.get([arg_2.get(prop.key) for prop in arg_0.related_keys])\n            if arg_3 is None:\n                raise NoResultFound\n        return arg_3", "path": "src/marshmallow_sqlalchemy/fields.py", "identifier": "Related._get_existing_instance", "docstring": "Retrieve the related object from an existing instance in the DB.\n\n        :param query: A SQLAlchemy `Query <sqlalchemy.orm.query.Query>` object.\n        :param value: The serialized value to mapto an existing instance.\n        :raises NoResultFound: if there is no matching record.", "docstring_tokens": ["Retrieve", "the", "related", "object", "from", "an", "existing", "instance", "in", "the", "DB", "."], "nwo": "marshmallow-code/marshmallow-sqlalchemy", "score": 0.5915932759257259, "idx": 254605}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/table.py#L55-L85", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Render the `num`th row of each column in `columns`.", "language": "python", "parameters": "(num, columns, widths, column_colors=None)", "return_statement": "return '|%s|' % '|'.join(cell_strs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "'|'", "arg_5", "=", "[", "]", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_1", ")", ":", "try", ":", "arg_8", "=", "arg_7", "[", "arg_0", "]", "arg_9", "=", "' '", "*", "(", "arg_2", "[", "arg_6", "]", "-", "len", "(", "arg_8", ")", ")", "if", "arg_3", "is", "not", "None", "and", "arg_3", "[", "arg_6", "]", "is", "not", "None", ":", "arg_8", "=", "arg_3", "[", "arg_6", "]", "(", "arg_8", ")", "arg_5", ".", "append", "(", "' %s%s '", "%", "(", "arg_8", ",", "arg_9", ")", ")", "except", "IndexError", ":", "arg_5", ".", "append", "(", "' '", "*", "(", "arg_2", "[", "arg_6", "]", "+", "2", ")", ")", "return", "'|%s|'", "%", "'|'", ".", "join", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"\n    Render the `num`th row of each column in `columns`.\n\n    :param num: Which row to render.\n    :type num: ``int``\n    :param columns: The list of columns.\n    :type columns: [[``str``]]\n    :param widths: The widths of each column.\n    :type widths: [``int``]\n    :param column_colors: An optional list of coloring functions.\n    :type column_colors: [``str`` -> ``str``] or ``NoneType``\n\n    :return: The rendered row.\n    :rtype: ``str``\n    \"\"\"\n    arg_4 = '|'\n    arg_5 = []\n    for arg_6, arg_7 in enumerate(arg_1):\n        try:\n            arg_8 = arg_7[arg_0]\n            # We choose the number of spaces before we color the string, so\n            # that the coloring codes don't affect the length.\n            arg_9 = ' ' * (arg_2[arg_6] - len(arg_8))\n            if arg_3 is not None and arg_3[arg_6] is not None:\n                arg_8 = arg_3[arg_6](arg_8)\n            arg_5.append(' %s%s ' % (arg_8, arg_9))\n        except IndexError:\n            # If the index is out of range, just print an empty cell.\n            arg_5.append(' ' * (arg_2[arg_6] + 2))\n    return '|%s|' % '|'.join(arg_5)", "path": "src/lsi/utils/table.py", "identifier": "render_row", "docstring": "Render the `num`th row of each column in `columns`.\n\n    :param num: Which row to render.\n    :type num: ``int``\n    :param columns: The list of columns.\n    :type columns: [[``str``]]\n    :param widths: The widths of each column.\n    :type widths: [``int``]\n    :param column_colors: An optional list of coloring functions.\n    :type column_colors: [``str`` -> ``str``] or ``NoneType``\n\n    :return: The rendered row.\n    :rtype: ``str``", "docstring_tokens": ["Render", "the", "num", "th", "row", "of", "each", "column", "in", "columns", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 254606}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L701-L715", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Add observations from row-major storage.", "language": "python", "parameters": "(self, records)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "isinstance", "(", "arg_2", ",", "Observation", ")", ":", "arg_0", ".", "append", "(", "**", "arg_2", ".", "_asdict", "(", ")", ")", "else", ":", "arg_0", ".", "append", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        '''Add observations from row-major storage.\n\n        This is primarily useful for deserializing sparsely packed data.\n\n        Parameters\n        ----------\n        records : iterable of dicts or Observations\n            Each element of `records` corresponds to one observation.\n        '''\n        for arg_2 in arg_1:\n            if isinstance(arg_2, Observation):\n                arg_0.append(**arg_2._asdict())\n            else:\n                arg_0.append(**arg_2)", "path": "jams/core.py", "identifier": "Annotation.append_records", "docstring": "Add observations from row-major storage.\n\n        This is primarily useful for deserializing sparsely packed data.\n\n        Parameters\n        ----------\n        records : iterable of dicts or Observations\n            Each element of `records` corresponds to one observation.", "docstring_tokens": ["Add", "observations", "from", "row", "-", "major", "storage", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 254607}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L599-L615", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Mark the other side of the stream authenticated as `peer`", "language": "python", "parameters": "(self, peer, restart_stream = False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "with", "arg_0", ".", "lock", ":", "arg_0", ".", "peer_authenticated", "=", "True", "arg_0", ".", "peer", "=", "arg_1", "if", "arg_2", ":", "arg_0", ".", "_restart_stream", "(", ")", "arg_0", ".", "event", "(", "AuthenticatedEvent", "(", "arg_0", ".", "peer", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2 = False):\n        \"\"\"Mark the other side of the stream authenticated as `peer`\n\n        :Parameters:\n            - `peer`: local JID just authenticated\n            - `restart_stream`: `True` when stream should be restarted (needed\n              after SASL authentication)\n        :Types:\n            - `peer`: `JID`\n            - `restart_stream`: `bool`\n        \"\"\"\n        with arg_0.lock:\n            arg_0.peer_authenticated = True\n            arg_0.peer = arg_1\n            if arg_2:\n                arg_0._restart_stream()\n        arg_0.event(AuthenticatedEvent(arg_0.peer))", "path": "pyxmpp2/streambase.py", "identifier": "StreamBase.set_peer_authenticated", "docstring": "Mark the other side of the stream authenticated as `peer`\n\n        :Parameters:\n            - `peer`: local JID just authenticated\n            - `restart_stream`: `True` when stream should be restarted (needed\n              after SASL authentication)\n        :Types:\n            - `peer`: `JID`\n            - `restart_stream`: `bool`", "docstring_tokens": ["Mark", "the", "other", "side", "of", "the", "stream", "authenticated", "as", "peer"], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254608}
{"url": "https://github.com/mwhooker/jsonselect/blob/c64aa9ea930de0344797ff87b04c753c8fc096a6/jsonselect/jsonselect.py#L230-L240", "sha": "c64aa9ea930de0344797ff87b04c753c8fc096a6", "docstring_summary": "Return nodes from rhs which have ancestors in lhs.", "language": "python", "parameters": "(self, lhs, rhs)", "return_statement": "return [node for node in rhs if _search(node)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "_search", "(", "arg_3", ")", ":", "if", "arg_3", "in", "arg_1", ":", "return", "True", "if", "not", "arg_3", ".", "parent", ":", "return", "False", "return", "_search", "(", "arg_3", ".", "parent", ")", "return", "[", "arg_3", "for", "arg_3", "in", "arg_2", "if", "_search", "(", "arg_3", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return nodes from rhs which have Func in lhs.\"\"\"\n\n        def _search(arg_3):\n            if arg_3 in arg_1:\n                return True\n            if not arg_3.parent:\n                return False\n            return _search(arg_3.parent)\n\n        return [arg_3 for arg_3 in arg_2 if _search(arg_3)]", "path": "jsonselect/jsonselect.py", "identifier": "Parser.ancestors", "docstring": "Return nodes from rhs which have ancestors in lhs.", "docstring_tokens": ["Return", "nodes", "from", "rhs", "which", "have", "ancestors", "in", "lhs", "."], "nwo": "mwhooker/jsonselect", "score": 0.27365494979801214, "idx": 254609}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L416-L423", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Returns names of features. If features is None, returns all\n        features. Otherwise assumes the user is trying to find the order of the\n        features.", "language": "python", "parameters": "(self, features=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "return", "arg_0", ".", "feature_table", ".", "get_ordered_names", "(", "arg_1", ")", "else", ":", "return", "arg_0", ".", "feature_table", ".", "feature_names"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\" Returns names of features. If features is None, returns all\n        features. Otherwise assumes the user is trying to find the order of the\n        features.  \"\"\"\n        if arg_1:\n            return arg_0.feature_table.get_ordered_names(arg_1)\n        else:\n            return arg_0.feature_table.feature_names", "path": "neurosynth/base/dataset.py", "identifier": "Dataset.get_feature_names", "docstring": "Returns names of features. If features is None, returns all\n        features. Otherwise assumes the user is trying to find the order of the\n        features.", "docstring_tokens": ["Returns", "names", "of", "features", ".", "If", "features", "is", "None", "returns", "all", "features", ".", "Otherwise", "assumes", "the", "user", "is", "trying", "to", "find", "the", "order", "of", "the", "features", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 254610}
{"url": "https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L75-L87", "sha": "a2ee417b784ca72c89c05bddb2e3e815a6b95154", "docstring_summary": "take a function that taks an iterable as the first argument.\n    return a wrapper that will break an iterable into chunks using\n    chunkiter and run each chunk in function, yielding the value of each\n    function call as an iterator.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "for", "arg_5", "in", "chunkiter", "(", "arg_1", ",", "arg_2", ")", ":", "yield", "arg_0", "(", "arg_5", ",", "*", "arg_3", ",", "**", "arg_4", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"take a function that taks an iterable as the first argument.\n    return a wrapper that will break an iterable into chunks using\n    chunkiter and run each chunk in function, yielding the value of each\n    function call as an iterator.\n    \"\"\"\n\n    @functools.wraps(arg_0)\n    def wrapper(arg_1, arg_2, *arg_3, **arg_4):\n        for arg_5 in chunkiter(arg_1, arg_2):\n            yield arg_0(arg_5, *arg_3, **arg_4)\n\n    return wrapper", "path": "libaaron/libaaron.py", "identifier": "chunkprocess", "docstring": "take a function that taks an iterable as the first argument.\n    return a wrapper that will break an iterable into chunks using\n    chunkiter and run each chunk in function, yielding the value of each\n    function call as an iterator.", "docstring_tokens": ["take", "a", "function", "that", "taks", "an", "iterable", "as", "the", "first", "argument", ".", "return", "a", "wrapper", "that", "will", "break", "an", "iterable", "into", "chunks", "using", "chunkiter", "and", "run", "each", "chunk", "in", "function", "yielding", "the", "value", "of", "each", "function", "call", "as", "an", "iterator", "."], "nwo": "ninjaaron/libaaron", "score": 0.3518893757964147, "idx": 254611}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/segmaps.py#L505-L541", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert heatmaps to segmentation map.", "language": "python", "parameters": "(heatmaps, class_indices=None, nb_classes=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "return", "SegmentationMapOnImage", "(", "arg_0", ".", "arr_0to1", ",", "shape", "=", "arg_0", ".", "shape", ")", "else", ":", "ia", ".", "do_assert", "(", "arg_2", "is", "not", "None", ")", "ia", ".", "do_assert", "(", "min", "(", "arg_1", ")", ">=", "0", ")", "ia", ".", "do_assert", "(", "max", "(", "arg_1", ")", "<", "arg_2", ")", "ia", ".", "do_assert", "(", "len", "(", "arg_1", ")", "==", "arg_0", ".", "arr_0to1", ".", "shape", "[", "2", "]", ")", "arg_3", "=", "arg_0", ".", "arr_0to1", "arg_4", "=", "np", ".", "zeros", "(", "(", "arg_3", ".", "shape", "[", "0", "]", ",", "arg_3", ".", "shape", "[", "1", "]", ",", "arg_2", ")", ",", "dtype", "=", "np", ".", "float32", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ")", ":", "arg_4", "[", ":", ",", ":", ",", "arg_6", "]", "=", "arg_3", "[", ":", ",", ":", ",", "arg_5", "]", "return", "SegmentationMapOnImage", "(", "arg_4", ",", "shape", "=", "arg_0", ".", "shape", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Convert heatmaps to segmentation map.\n\n        Assumes that each class is represented as a single heatmap channel.\n\n        Parameters\n        ----------\n        heatmaps : imgaug.HeatmapsOnImage\n            Heatmaps to convert.\n\n        class_indices : None or list of int, optional\n            List of class indices represented by each heatmap channel. See also the\n            secondary output of :func:`imgaug.SegmentationMapOnImage.to_heatmap`.\n            If this is provided, it must have the same length as the number of heatmap channels.\n\n        nb_classes : None or int, optional\n            Number of classes. Must be provided if class_indices is set.\n\n        Returns\n        -------\n        imgaug.SegmentationMapOnImage\n            Segmentation map derived from heatmaps.\n\n        \"\"\"\n        if arg_1 is None:\n            return SegmentationMapOnImage(arg_0.arr_0to1, shape=arg_0.shape)\n        else:\n            ia.do_assert(arg_2 is not None)\n            ia.do_assert(min(arg_1) >= 0)\n            ia.do_assert(max(arg_1) < arg_2)\n            ia.do_assert(len(arg_1) == arg_0.arr_0to1.shape[2])\n            arg_3 = arg_0.arr_0to1\n            arg_4 = np.zeros((arg_3.shape[0], arg_3.shape[1], arg_2), dtype=np.float32)\n            for arg_5, arg_6 in enumerate(arg_1):\n                arg_4[:, :, arg_6] = arg_3[:, :, arg_5]\n            return SegmentationMapOnImage(arg_4, shape=arg_0.shape)", "path": "imgaug/augmentables/segmaps.py", "identifier": "SegmentationMapOnImage.from_heatmaps", "docstring": "Convert heatmaps to segmentation map.\n\n        Assumes that each class is represented as a single heatmap channel.\n\n        Parameters\n        ----------\n        heatmaps : imgaug.HeatmapsOnImage\n            Heatmaps to convert.\n\n        class_indices : None or list of int, optional\n            List of class indices represented by each heatmap channel. See also the\n            secondary output of :func:`imgaug.SegmentationMapOnImage.to_heatmap`.\n            If this is provided, it must have the same length as the number of heatmap channels.\n\n        nb_classes : None or int, optional\n            Number of classes. Must be provided if class_indices is set.\n\n        Returns\n        -------\n        imgaug.SegmentationMapOnImage\n            Segmentation map derived from heatmaps.", "docstring_tokens": ["Convert", "heatmaps", "to", "segmentation", "map", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254612}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/model.py#L13-L32", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Modify the keys in adict to the ones in translations.\n    Be careful, this will modify your input dictionary.\n    The keys not present in translations will be left intact.", "language": "python", "parameters": "(adict, translations, default='')", "return_statement": "return adict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_1", ":", "arg_0", "[", "arg_4", "]", "=", "arg_0", ".", "pop", "(", "arg_3", ",", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=''):\n    \"\"\"Modify the keys in adict to the ones in translations.\n    Be careful, this will modify your input dictionary.\n    The keys not present in translations will be left intact.\n\n    Parameters\n    ----------\n    adict: a dictionary\n\n    translations: iterable of 2-tuples\n    Each 2-tuple must have the following format:\n    (<adict existing key>, <desired key name for the existing key>)\n\n    Returns\n    -------\n    Translated adict\n    \"\"\"\n    for arg_3, arg_4 in arg_1:\n        arg_0[arg_4] = arg_0.pop(arg_3, arg_2)\n    return arg_0", "path": "docstamp/model.py", "identifier": "translate_key_values", "docstring": "Modify the keys in adict to the ones in translations.\n    Be careful, this will modify your input dictionary.\n    The keys not present in translations will be left intact.\n\n    Parameters\n    ----------\n    adict: a dictionary\n\n    translations: iterable of 2-tuples\n    Each 2-tuple must have the following format:\n    (<adict existing key>, <desired key name for the existing key>)\n\n    Returns\n    -------\n    Translated adict", "docstring_tokens": ["Modify", "the", "keys", "in", "adict", "to", "the", "ones", "in", "translations", ".", "Be", "careful", "this", "will", "modify", "your", "input", "dictionary", ".", "The", "keys", "not", "present", "in", "translations", "will", "be", "left", "intact", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 254613}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L486-L492", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Send a leave request for the room.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "joined", ":", "arg_1", "=", "MucPresence", "(", "to_jid", "=", "arg_0", ".", "room_jid", ",", "stanza_type", "=", "\"unavailable\"", ")", "arg_0", ".", "manager", ".", "stream", ".", "send", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Send a Func request for the room.\n        \"\"\"\n        if arg_0.joined:\n            arg_1=MucPresence(to_jid=arg_0.room_jid,stanza_type=\"unavailable\")\n            arg_0.manager.stream.send(arg_1)", "path": "pyxmpp2/ext/muc/muc.py", "identifier": "MucRoomState.leave", "docstring": "Send a leave request for the room.", "docstring_tokens": ["Send", "a", "leave", "request", "for", "the", "room", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254614}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/__init__.py#L82-L93", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "update secrets will take a secrets credential file\n        either located at .sregistry or the environment variable\n        SREGISTRY_CLIENT_SECRETS and update the current client \n        secrets as well as the associated API base.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "secrets", "=", "read_client_secrets", "(", ")", "if", "arg_0", ".", "secrets", "is", "not", "None", ":", "if", "\"registry\"", "in", "arg_0", ".", "secrets", ":", "if", "\"base\"", "in", "arg_0", ".", "secrets", "[", "'registry'", "]", ":", "arg_0", ".", "base", "=", "arg_0", ".", "secrets", "[", "'registry'", "]", "[", "'base'", "]", "arg_0", ".", "_update_base", "(", ")"], "function": "def Func(arg_0):\n        '''update secrets will take a secrets credential file\n        either located at .sregistry or the environment variable\n        SREGISTRY_CLIENT_SECRETS and update the current client \n        secrets as well as the associated API base.\n        '''\n        arg_0.secrets = read_client_secrets()\n        if arg_0.secrets is not None:\n            if \"registry\" in arg_0.secrets:\n                if \"base\" in arg_0.secrets['registry']:\n                    arg_0.base = arg_0.secrets['registry']['base']\n                    arg_0._update_base()", "path": "sregistry/main/registry/__init__.py", "identifier": "Client._update_secrets", "docstring": "update secrets will take a secrets credential file\n        either located at .sregistry or the environment variable\n        SREGISTRY_CLIENT_SECRETS and update the current client \n        secrets as well as the associated API base.", "docstring_tokens": ["update", "secrets", "will", "take", "a", "secrets", "credential", "file", "either", "located", "at", ".", "sregistry", "or", "the", "environment", "variable", "SREGISTRY_CLIENT_SECRETS", "and", "update", "the", "current", "client", "secrets", "as", "well", "as", "the", "associated", "API", "base", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 254615}
{"url": "https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/validate.py#L36-L61", "sha": "5e613f486f29fe350999d6b990d32847ac16a1b8", "docstring_summary": "Validate the given litezip as `struct`.\n    Returns a list of validation messages.", "language": "python", "parameters": "(struct)", "return_statement": "return msgs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "def", "_fmt_err", "(", "arg_2", ")", ":", "return", "(", "Path", "(", "arg_2", ".", "filename", ")", ",", "\"{}:{} -- {}: {}\"", ".", "format", "(", "*", "(", "arg_2", "[", "1", ":", "]", ")", ")", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_0", ":", "if", "not", "is_valid_identifier", "(", "arg_4", ".", "id", ")", ":", "arg_5", "=", "(", "arg_4", ".", "file", ".", "parent", ",", "\"{} is not a valid identifier\"", ".", "format", "(", "arg_4", ".", "id", ")", ",", ")", "logger", ".", "info", "(", "\"{}: {}\"", ".", "format", "(", "*", "arg_5", ")", ")", "arg_1", ".", "append", "(", "arg_5", ")", "arg_3", ".", "setdefault", "(", "type", "(", "arg_4", ")", ",", "[", "]", ")", ".", "append", "(", "arg_4", ")", "for", "arg_6", "in", "arg_3", ":", "arg_7", "=", "list", "(", "[", "_fmt_err", "(", "arg_2", ")", "for", "arg_2", "in", "validate_content", "(", "*", "arg_3", "[", "arg_6", "]", ")", "]", ")", "for", "arg_5", "in", "arg_7", ":", "logger", ".", "info", "(", "\"{}: {}\"", ".", "format", "(", "*", "arg_5", ")", ")", "arg_1", ".", "extend", "(", "arg_7", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Validate the given litezip as `struct`.\n    Returns a list of validation messages.\n\n    \"\"\"\n    arg_1 = []\n\n    def _fmt_err(arg_2):\n        return (Path(arg_2.filename), \"{}:{} -- {}: {}\".format(*(arg_2[1:])))\n\n    arg_3 = {}\n    for arg_4 in arg_0:\n        if not is_valid_identifier(arg_4.id):\n            arg_5 = (arg_4.file.parent,\n                   \"{} is not a valid identifier\".format(arg_4.id),)\n            logger.info(\"{}: {}\".format(*arg_5))\n            arg_1.append(arg_5)\n        arg_3.setdefault(type(arg_4), []).append(arg_4)\n\n    for arg_6 in arg_3:\n        arg_7 = list([_fmt_err(arg_2) for arg_2 in\n                             validate_content(*arg_3[arg_6])])\n        for arg_5 in arg_7:\n            logger.info(\"{}: {}\".format(*arg_5))\n        arg_1.extend(arg_7)\n    return arg_1", "path": "litezip/validate.py", "identifier": "validate_litezip", "docstring": "Validate the given litezip as `struct`.\n    Returns a list of validation messages.", "docstring_tokens": ["Validate", "the", "given", "litezip", "as", "struct", ".", "Returns", "a", "list", "of", "validation", "messages", "."], "nwo": "openstax/cnx-litezip", "score": 0.3282631104312029, "idx": 254616}
{"url": "https://github.com/RediSearch/redisearch-py/blob/f65d1dd078713cbe9b83584e86655a254d0531ab/redisearch/querystring.py#L58-L62", "sha": "f65d1dd078713cbe9b83584e86655a254d0531ab", "docstring_summary": "Indicate that value is a geo region", "language": "python", "parameters": "(lat, lon, radius, unit='km')", "return_statement": "return GeoValue(lat, lon, radius, unit)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'km'", ")", ":", "return", "GeoValue", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='km'):\n    \"\"\"\n    Indicate that value is a Func region\n    \"\"\"\n    return GeoValue(arg_0, arg_1, arg_2, arg_3)", "path": "redisearch/querystring.py", "identifier": "geo", "docstring": "Indicate that value is a geo region", "docstring_tokens": ["Indicate", "that", "value", "is", "a", "geo", "region"], "nwo": "RediSearch/redisearch-py", "score": 0.6923817122804524, "idx": 254617}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/system.py#L85-L103", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Get the release number of the distribution.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "arg_0", "=", "(", "run", "(", "'uname -s'", ")", "or", "''", ")", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "arg_0", "==", "LINUX", ":", "return", "run", "(", "'lsb_release -r --short'", ")", "elif", "arg_0", "==", "SUNOS", ":", "return", "run", "(", "'uname -v'", ")"], "function": "def Func():\n    \"\"\"\n    Get the release number of the distribution.\n\n    Example::\n\n        from burlap.system import distrib_id, Func\n\n        if distrib_id() == 'CentOS' and Func() == '6.1':\n            print(u\"CentOS 6.2 has been released. Please upgrade.\")\n\n    \"\"\"\n    with settings(hide('running', 'stdout')):\n        arg_0 = (run('uname -s') or '').strip().lower()\n        if arg_0 == LINUX:\n            return run('lsb_release -r --short')\n\n        elif arg_0 == SUNOS:\n            return run('uname -v')", "path": "burlap/system.py", "identifier": "distrib_release", "docstring": "Get the release number of the distribution.\n\n    Example::\n\n        from burlap.system import distrib_id, distrib_release\n\n        if distrib_id() == 'CentOS' and distrib_release() == '6.1':\n            print(u\"CentOS 6.2 has been released. Please upgrade.\")", "docstring_tokens": ["Get", "the", "release", "number", "of", "the", "distribution", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 254618}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/listmembernotes.py#L29-L58", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Add a new note for a specific subscriber.", "language": "python", "parameters": "(self, list_id, subscriber_hash, data)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_2", "=", "check_subscriber_hash", "(", "arg_2", ")", "arg_0", ".", "list_id", "=", "arg_1", "arg_0", ".", "subscriber_hash", "=", "arg_2", "if", "'note'", "not", "in", "arg_3", ":", "raise", "KeyError", "(", "'The list member note must have a note'", ")", "arg_4", "=", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'members'", ",", "arg_2", ",", "'notes'", ")", ",", "arg_3", "=", "arg_3", ")", "if", "arg_4", "is", "not", "None", ":", "arg_0", ".", "note_id", "=", "arg_4", "[", "'id'", "]", "else", ":", "arg_0", ".", "note_id", "=", "None", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Add a new note for a specific subscriber.\n\n        The documentation lists only the note request body parameter so it is\n        being documented and error-checked as if it were required based on the\n        description of the method.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member\u2019s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"note\": string*\n        }\n        \"\"\"\n        arg_2 = check_subscriber_hash(arg_2)\n        arg_0.list_id = arg_1\n        arg_0.subscriber_hash = arg_2\n        if 'note' not in arg_3:\n            raise KeyError('The list member note must have a note')\n        arg_4 = arg_0._mc_client._post(url=arg_0._build_path(arg_1, 'members', arg_2, 'notes'), arg_3=arg_3)\n        if arg_4 is not None:\n            arg_0.note_id = arg_4['id']\n        else:\n            arg_0.note_id = None\n        return arg_4", "path": "mailchimp3/entities/listmembernotes.py", "identifier": "ListMemberNotes.create", "docstring": "Add a new note for a specific subscriber.\n\n        The documentation lists only the note request body parameter so it is\n        being documented and error-checked as if it were required based on the\n        description of the method.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member\u2019s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"note\": string*\n        }", "docstring_tokens": ["Add", "a", "new", "note", "for", "a", "specific", "subscriber", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 254619}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L197-L224", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Set the current mask by taking the conjunction of all specified\n        layers.", "language": "python", "parameters": "(self, layers=None, output='vector', in_global_mask=True)", "return_statement": "return mask[self.global_mask] if in_global_mask else mask", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'vector'", ",", "arg_3", "=", "True", ")", ":", "if", "arg_3", ":", "arg_2", "=", "'vector'", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "layers", ".", "keys", "(", ")", "elif", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_1", "=", "map", "(", "lambda", "x", ":", "x", "if", "isinstance", "(", "x", ",", "string_types", ")", "else", "arg_0", ".", "stack", "[", "x", "]", ",", "arg_1", ")", "arg_1", "=", "[", "arg_0", ".", "layers", "[", "l", "]", "for", "l", "in", "arg_1", "if", "l", "in", "arg_0", ".", "layers", "]", "arg_1", ".", "append", "(", "arg_0", ".", "full", ")", "arg_1", "=", "np", ".", "vstack", "(", "arg_1", ")", ".", "T", ".", "astype", "(", "bool", ")", "arg_4", "=", "arg_1", ".", "all", "(", "axis", "=", "1", ")", "arg_4", "=", "arg_0", ".", "get_image", "(", "arg_4", ",", "arg_2", ")", "return", "arg_4", "[", "arg_0", ".", "global_mask", "]", "if", "arg_3", "else", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2='vector', arg_3=True):\n        \"\"\" Set the current mask by taking the conjunction of all specified\n        layers.\n\n        Args:\n            layers: Which layers to include. See documentation for add() for\n                format.\n            include_global_mask: Whether or not to automatically include the\n                global mask (i.e., self.volume) in the conjunction.\n        \"\"\"\n        if arg_3:\n            arg_2 = 'vector'\n\n        if arg_1 is None:\n            arg_1 = arg_0.layers.keys()\n        elif not isinstance(arg_1, list):\n            arg_1 = [arg_1]\n\n        arg_1 = map(lambda x: x if isinstance(x, string_types)\n                     else arg_0.stack[x], arg_1)\n        arg_1 = [arg_0.layers[l] for l in arg_1 if l in arg_0.layers]\n\n        # Always include the original volume\n        arg_1.append(arg_0.full)\n        arg_1 = np.vstack(arg_1).T.astype(bool)\n        arg_4 = arg_1.all(axis=1)\n        arg_4 = arg_0.get_image(arg_4, arg_2)\n        return arg_4[arg_0.global_mask] if arg_3 else arg_4", "path": "neurosynth/base/mask.py", "identifier": "Masker.get_mask", "docstring": "Set the current mask by taking the conjunction of all specified\n        layers.\n\n        Args:\n            layers: Which layers to include. See documentation for add() for\n                format.\n            include_global_mask: Whether or not to automatically include the\n                global mask (i.e., self.volume) in the conjunction.", "docstring_tokens": ["Set", "the", "current", "mask", "by", "taking", "the", "conjunction", "of", "all", "specified", "layers", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 254620}
{"url": "https://github.com/coremke/django-quill/blob/6c5ace1a96e291f0a8e401f6d61d634dd0cb7c9f/quill/templatetags/quill_tags.py#L26-L30", "sha": "6c5ace1a96e291f0a8e401f6d61d634dd0cb7c9f", "docstring_summary": "Render the toolbar for the given config.", "language": "python", "parameters": "(context, config)", "return_statement": "return t.render(context)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "quill_app", ",", "arg_1", ")", "arg_3", "=", "template", ".", "loader", ".", "get_template", "(", "arg_2", "[", "'toolbar_template'", "]", ")", "return", "arg_3", ".", "render", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Render the toolbar for the given config.\"\"\"\n    arg_2 = getattr(quill_app, arg_1)\n    arg_3 = template.loader.get_template(arg_2['toolbar_template'])\n    return arg_3.render(arg_0)", "path": "quill/templatetags/quill_tags.py", "identifier": "render_toolbar", "docstring": "Render the toolbar for the given config.", "docstring_tokens": ["Render", "the", "toolbar", "for", "the", "given", "config", "."], "nwo": "coremke/django-quill", "score": 0.5493647772192334, "idx": 254621}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/segmaps.py#L457-L502", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert segmentation map to heatmaps object.", "language": "python", "parameters": "(self, only_nonempty=False, not_none_if_no_nonempty=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "from", "imgaug", ".", "augmentables", ".", "heatmaps", "import", "HeatmapsOnImage", "if", "not", "arg_1", ":", "return", "HeatmapsOnImage", ".", "from_0to1", "(", "arg_0", ".", "arr", ",", "arg_0", ".", "shape", ",", "min_value", "=", "0.0", ",", "max_value", "=", "1.0", ")", "else", ":", "arg_3", "=", "np", ".", "sum", "(", "arg_0", ".", "arr", ",", "axis", "=", "(", "0", ",", "1", ")", ")", ">", "0", "+", "1e-4", "if", "np", ".", "sum", "(", "arg_3", ")", "==", "0", ":", "if", "arg_2", ":", "arg_3", "[", "0", "]", "=", "True", "else", ":", "return", "None", ",", "[", "]", "arg_4", "=", "np", ".", "arange", "(", "arg_0", ".", "arr", ".", "shape", "[", "2", "]", ")", "[", "arg_3", "]", "arg_5", "=", "arg_0", ".", "arr", "[", "...", ",", "arg_4", "]", "return", "HeatmapsOnImage", "(", "arg_5", ",", "arg_0", ".", "shape", ",", "min_value", "=", "0.0", ",", "max_value", "=", "1.0", ")", ",", "arg_4"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n        \"\"\"\n        Convert segmentation map to heatmaps object.\n\n        Each segmentation map class will be represented as a single heatmap channel.\n\n        Parameters\n        ----------\n        only_nonempty : bool, optional\n            If True, then only heatmaps for classes that appear in the segmentation map will be\n            generated. Additionally, a list of these class ids will be returned.\n\n        not_none_if_no_nonempty : bool, optional\n            If `only_nonempty` is True and for a segmentation map no channel was non-empty,\n            this function usually returns None as the heatmaps object. If however this parameter\n            is set to True, a heatmaps object with one channel (representing class 0)\n            will be returned as a fallback in these cases.\n\n        Returns\n        -------\n        imgaug.HeatmapsOnImage or None\n            Segmentation map as a heatmaps object.\n            If `only_nonempty` was set to True and no class appeared in the segmentation map,\n            then this is None.\n\n        class_indices : list of int\n            Class ids (0 to C-1) of the classes that were actually added to the heatmaps.\n            Only returned if `only_nonempty` was set to True.\n\n        \"\"\"\n        # TODO get rid of this deferred import\n        from imgaug.augmentables.heatmaps import HeatmapsOnImage\n\n        if not arg_1:\n            return HeatmapsOnImage.from_0to1(arg_0.arr, arg_0.shape, min_value=0.0, max_value=1.0)\n        else:\n            arg_3 = np.sum(arg_0.arr, axis=(0, 1)) > 0 + 1e-4\n            if np.sum(arg_3) == 0:\n                if arg_2:\n                    arg_3[0] = True\n                else:\n                    return None, []\n\n            arg_4 = np.arange(arg_0.arr.shape[2])[arg_3]\n            arg_5 = arg_0.arr[..., arg_4]\n            return HeatmapsOnImage(arg_5, arg_0.shape, min_value=0.0, max_value=1.0), arg_4", "path": "imgaug/augmentables/segmaps.py", "identifier": "SegmentationMapOnImage.to_heatmaps", "docstring": "Convert segmentation map to heatmaps object.\n\n        Each segmentation map class will be represented as a single heatmap channel.\n\n        Parameters\n        ----------\n        only_nonempty : bool, optional\n            If True, then only heatmaps for classes that appear in the segmentation map will be\n            generated. Additionally, a list of these class ids will be returned.\n\n        not_none_if_no_nonempty : bool, optional\n            If `only_nonempty` is True and for a segmentation map no channel was non-empty,\n            this function usually returns None as the heatmaps object. If however this parameter\n            is set to True, a heatmaps object with one channel (representing class 0)\n            will be returned as a fallback in these cases.\n\n        Returns\n        -------\n        imgaug.HeatmapsOnImage or None\n            Segmentation map as a heatmaps object.\n            If `only_nonempty` was set to True and no class appeared in the segmentation map,\n            then this is None.\n\n        class_indices : list of int\n            Class ids (0 to C-1) of the classes that were actually added to the heatmaps.\n            Only returned if `only_nonempty` was set to True.", "docstring_tokens": ["Convert", "segmentation", "map", "to", "heatmaps", "object", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254622}
{"url": "https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/ellipsoids.py#L8-L36", "sha": "d6a8bb9c28787a25b4a1d59a7e4603db3221eaef", "docstring_summary": "Search for a ellipsoid name located in this module.", "language": "python", "parameters": "(ellipsname, crstype, strict=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_2", ":", "arg_0", "=", "arg_0", ".", "lower", "(", ")", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", "for", "arg_3", ",", "arg_4", "in", "globals", "(", ")", ".", "items", "(", ")", ":", "if", "arg_3", ".", "startswith", "(", "\"_\"", ")", "or", "arg_3", "==", "'Ellipsoid'", ":", "continue", "try", ":", "if", "hasattr", "(", "arg_4", ".", "name", ",", "arg_1", ")", ":", "arg_3", "=", "getattr", "(", "arg_4", ".", "name", ",", "arg_1", ")", "if", "not", "arg_2", ":", "arg_3", "=", "arg_3", ".", "lower", "(", ")", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", "if", "arg_0", "==", "arg_3", ":", "return", "arg_4", "except", ":", "pass", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Search for a ellipsoid name located in this module.\n\n    Arguments:\n\n    - **ellipsname**: The ellipsoid name to search for.\n    - **crstype**: Which CRS naming convention to search (different\n        CRS formats have different names for the same ellipsoid).\n    - **strict** (optional): If False, ignores minor name mismatches\n        such as underscore or character casing, otherwise must be exact\n        match (defaults to False). \n    \"\"\"\n    if not arg_2:\n        arg_0 = arg_0.lower().replace(\" \",\"_\")\n    for arg_3,arg_4 in globals().items():\n        if arg_3.startswith(\"_\") or arg_3 == 'Ellipsoid':\n            continue\n        try:\n            if hasattr(arg_4.name, arg_1):\n                arg_3 = getattr(arg_4.name, arg_1)\n                if not arg_2:\n                    arg_3 = arg_3.lower().replace(\" \",\"_\")\n                if arg_0 == arg_3:\n                    return arg_4\n        except:\n            pass\n    else:\n        return None", "path": "pycrs/elements/ellipsoids.py", "identifier": "find", "docstring": "Search for a ellipsoid name located in this module.\n\n    Arguments:\n\n    - **ellipsname**: The ellipsoid name to search for.\n    - **crstype**: Which CRS naming convention to search (different\n        CRS formats have different names for the same ellipsoid).\n    - **strict** (optional): If False, ignores minor name mismatches\n        such as underscore or character casing, otherwise must be exact\n        match (defaults to False).", "docstring_tokens": ["Search", "for", "a", "ellipsoid", "name", "located", "in", "this", "module", "."], "nwo": "karimbahgat/PyCRS", "score": 0.6903572066933638, "idx": 254623}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/choi.py#L113-L116", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the shape for bipartite matrix", "language": "python", "parameters": "(self)", "return_statement": "return (self._input_dim, self._output_dim, self._input_dim,\n                self._output_dim)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "_input_dim", ",", "arg_0", ".", "_output_dim", ",", "arg_0", ".", "_input_dim", ",", "arg_0", ".", "_output_dim", ")"], "function": "def Func(arg_0):\n        \"\"\"Return the shape for bipartite matrix\"\"\"\n        return (arg_0._input_dim, arg_0._output_dim, arg_0._input_dim,\n                arg_0._output_dim)", "path": "qiskit/quantum_info/operators/channel/choi.py", "identifier": "Choi._bipartite_shape", "docstring": "Return the shape for bipartite matrix", "docstring_tokens": ["Return", "the", "shape", "for", "bipartite", "matrix"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254624}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L67-L117", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Visualize the dataframe.", "language": "python", "parameters": "(df, z_score=None, title='', figsize=(5,5), cmap='RdBu_r', \n            xticklabels=True, yticklabels=True, ofname=None, **kwargs)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "''", ",", "arg_3", "=", "(", "5", ",", "5", ")", ",", "arg_4", "=", "'RdBu_r'", ",", "arg_5", "=", "True", ",", "arg_6", "=", "True", ",", "arg_7", "=", "None", ",", "**", "arg_8", ")", ":", "arg_0", "=", "zscore", "(", "arg_0", ",", "axis", "=", "arg_1", ")", "arg_0", "=", "arg_0", ".", "iloc", "[", ":", ":", "-", "1", "]", "arg_9", ",", "arg_10", "=", "arg_0", ".", "shape", "arg_11", "=", "np", ".", "arange", "(", "0", ",", "arg_10", ",", "1", ")", "+", ".5", "arg_12", "=", "np", ".", "arange", "(", "0", ",", "arg_9", ",", "1", ")", "+", ".5", "if", "hasattr", "(", "sys", ",", "'ps1'", ")", "and", "(", "arg_7", "is", "None", ")", ":", "arg_13", "=", "plt", ".", "figure", "(", "arg_3", "=", "arg_3", ")", "else", ":", "arg_13", "=", "Figure", "(", "arg_3", "=", "arg_3", ")", "arg_14", "=", "FigureCanvas", "(", "arg_13", ")", "arg_15", "=", "arg_13", ".", "add_subplot", "(", "111", ")", "arg_16", "=", "np", ".", "percentile", "(", "arg_0", ".", "min", "(", ")", ",", "2", ")", "arg_17", "=", "np", ".", "percentile", "(", "arg_0", ".", "max", "(", ")", ",", "98", ")", "arg_18", "=", "arg_15", ".", "pcolormesh", "(", "arg_0", ".", "values", ",", "arg_4", "=", "arg_4", ",", "arg_16", "=", "arg_16", ",", "arg_17", "=", "arg_17", ")", "arg_15", ".", "set_ylim", "(", "[", "0", ",", "len", "(", "arg_0", ")", "]", ")", "arg_15", ".", "set", "(", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ")", "arg_15", ".", "set_xticklabels", "(", "arg_0", ".", "columns", ".", "values", "if", "arg_5", "else", "''", ",", "fontsize", "=", "14", ",", "rotation", "=", "90", ")", "arg_15", ".", "set_yticklabels", "(", "arg_0", ".", "index", ".", "values", "if", "arg_6", "else", "''", ",", "fontsize", "=", "14", ")", "arg_15", ".", "set_title", "(", "\"%s\\nHeatmap of the Analyzed Geneset\"", "%", "arg_2", ",", "fontsize", "=", "20", ")", "arg_15", ".", "tick_params", "(", "axis", "=", "'both'", ",", "which", "=", "'both'", ",", "bottom", "=", "False", ",", "top", "=", "False", ",", "right", "=", "False", ",", "left", "=", "False", ")", "arg_19", "=", "colorbar", "(", "arg_18", ")", "arg_19", ".", "ax", ".", "tick_params", "(", "axis", "=", "'both'", ",", "which", "=", "'both'", ",", "bottom", "=", "False", ",", "top", "=", "False", ",", "right", "=", "False", ",", "left", "=", "False", ")", "for", "arg_20", "in", "[", "\"top\"", ",", "\"right\"", ",", "\"left\"", ",", "\"bottom\"", "]", ":", "arg_15", ".", "spines", "[", "arg_20", "]", ".", "set_visible", "(", "False", ")", "arg_19", ".", "ax", ".", "spines", "[", "arg_20", "]", ".", "set_visible", "(", "False", ")", "if", "arg_7", "is", "not", "None", ":", "arg_13", ".", "savefig", "(", "arg_7", ",", "bbox_inches", "=", "'tight'", ",", "dpi", "=", "300", ")", "return"], "function": "def Func(arg_0, arg_1=None, arg_2='', arg_3=(5,5), arg_4='RdBu_r', \n            arg_5=True, arg_6=True, arg_7=None, **arg_8):\n    \"\"\"Visualize the dataframe.\n\n    :param df: DataFrame from expression table.\n    :param z_score: z_score axis{0, 1}. If None, don't normalize data.\n    :param title: gene set name.\n    :param outdir: path to save Func.\n    :param figsize: Func figsize.\n    :param cmap: matplotlib colormap.\n    :param ofname: output file name. If None, don't save figure \n\n    \"\"\"\n    arg_0 = zscore(arg_0, axis=arg_1)\n    arg_0 = arg_0.iloc[::-1]\n    # Get the positions and used label for the ticks\n    arg_9, arg_10 = arg_0.shape\n    arg_11 = np.arange(0, arg_10, 1) + .5\n    arg_12 = np.arange(0, arg_9, 1) + .5\n\n    # If working on commandline, don't show figure\n    if hasattr(sys, 'ps1') and (arg_7 is None): \n        arg_13 = plt.figure(arg_3=arg_3)\n    else:\n        arg_13 = Figure(arg_3=arg_3)\n        arg_14 = FigureCanvas(arg_13)\n    arg_15 = arg_13.add_subplot(111)\n    arg_16 = np.percentile(arg_0.min(), 2)\n    arg_17 =  np.percentile(arg_0.max(), 98)\n    arg_18 = arg_15.pcolormesh(arg_0.values, arg_4=arg_4, arg_16=arg_16, arg_17=arg_17)\n    arg_15.set_ylim([0,len(arg_0)])\n    arg_15.set(arg_11=arg_11, arg_12=arg_12)\n    arg_15.set_xticklabels(arg_0.columns.values if arg_5 else '', fontsize=14, rotation=90)\n    arg_15.set_yticklabels(arg_0.index.values if arg_6 else '',  fontsize=14)\n    arg_15.set_title(\"%s\\nHeatmap of the Analyzed Geneset\"%arg_2, fontsize=20)\n    arg_15.tick_params(axis='both', which='both', bottom=False, top=False,\n                   right=False, left=False)\n    # cax=fig.add_axes([0.93,0.25,0.05,0.20])\n    # cbar = fig.colorbar(matrix, cax=cax)\n    arg_19 = colorbar(arg_18)\n    arg_19.ax.tick_params(axis='both', which='both', bottom=False, top=False,\n                        right=False, left=False)\n    for arg_20 in [\"top\", \"right\", \"left\", \"bottom\"]:\n        arg_15.spines[arg_20].set_visible(False)\n        arg_19.ax.spines[arg_20].set_visible(False)\n    # cbar.ax.set_title('',loc='left')\n\n    if arg_7 is not None: \n        # canvas.print_figure(ofname, bbox_inches='tight', dpi=300)\n        arg_13.savefig(arg_7, bbox_inches='tight', dpi=300)\n    return", "path": "gseapy/plot.py", "identifier": "heatmap", "docstring": "Visualize the dataframe.\n\n    :param df: DataFrame from expression table.\n    :param z_score: z_score axis{0, 1}. If None, don't normalize data.\n    :param title: gene set name.\n    :param outdir: path to save heatmap.\n    :param figsize: heatmap figsize.\n    :param cmap: matplotlib colormap.\n    :param ofname: output file name. If None, don't save figure", "docstring_tokens": ["Visualize", "the", "dataframe", "."], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 254625}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1180-L1206", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "A dask relay function to fill chroms for all samples", "language": "python", "parameters": "(data, samples)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "across", ",", "s", ".", "name", "+", "\".tmp.h5\"", ")", "for", "s", "in", "arg_1", "]", "arg_3", "=", "[", "h5py", ".", "File", "(", "i", ")", "for", "i", "in", "arg_2", "]", "arg_4", "=", "[", "i", "[", "'/ichrom'", "]", "for", "i", "in", "arg_3", "]", "arg_5", "=", "[", "da", ".", "from_array", "(", "dset", ",", "chunks", "=", "(", "10000", ",", "3", ")", ")", "for", "dset", "in", "arg_4", "]", "arg_6", "=", "da", ".", "stack", "(", "arg_5", ",", "axis", "=", "2", ")", "arg_7", "=", "da", ".", "max", "(", "arg_6", ",", "axis", "=", "2", ")", "[", ":", ",", "0", "]", "arg_8", "=", "da", ".", "max", "(", "arg_6", ",", "axis", "=", "2", ")", "[", ":", ",", "2", "]", "arg_9", "=", "arg_6", "==", "0", "arg_6", "[", "arg_9", "]", "=", "9223372036854775807", "arg_10", "=", "da", ".", "min", "(", "arg_6", ",", "axis", "=", "2", ")", "[", ":", ",", "1", "]", "arg_11", "=", "da", ".", "stack", "(", "[", "arg_7", ",", "arg_10", ",", "arg_8", "]", ",", "axis", "=", "1", ")", "arg_11", ".", "to_hdf5", "(", "arg_0", ".", "clust_database", ",", "\"/chroms\"", ")", "arg_12", "=", "[", "i", ".", "close", "(", ")", "for", "i", "in", "arg_3", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    A dask relay function to fill chroms for all samples\n    \"\"\"\n    \n    ## example concatenating with dask\n    arg_2 = [os.path.join(arg_0.dirs.across, s.name+\".tmp.h5\") for s in arg_1]\n    arg_3 = [h5py.File(i) for i in arg_2]\n    arg_4 = [i['/ichrom'] for i in arg_3]\n    arg_5 = [da.from_array(dset, chunks=(10000, 3)) for dset in arg_4]\n    arg_6 = da.stack(arg_5, axis=2)\n\n    ## max chrom (should we check for variable hits? if so, things can get wonk)\n    arg_7 = da.max(arg_6, axis=2)[:, 0]\n\n    ## max pos\n    arg_8 = da.max(arg_6, axis=2)[:, 2]\n\n    ## min pos\n    arg_9 = arg_6 == 0\n    arg_6[arg_9] = 9223372036854775807  ## max int64 value\n    arg_10 = da.min(arg_6, axis=2)[:, 1]\n    arg_11 = da.stack([arg_7, arg_10, arg_8], axis=1)\n    arg_11.to_hdf5(arg_0.clust_database, \"/chroms\")\n\n    ## close the h5 handles\n    arg_12 = [i.close() for i in arg_3]", "path": "ipyrad/assemble/cluster_across.py", "identifier": "dask_chroms", "docstring": "A dask relay function to fill chroms for all samples", "docstring_tokens": ["A", "dask", "relay", "function", "to", "fill", "chroms", "for", "all", "samples"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 254626}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/component/component_spec.py#L166-L187", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Adds inputs to a given protobuf Bolt message", "language": "python", "parameters": "(self, bolt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "inputs", "is", "None", ":", "return", "arg_2", "=", "arg_0", ".", "_sanitize_inputs", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "arg_5", "=", "arg_1", ".", "inputs", ".", "add", "(", ")", "arg_5", ".", "stream", ".", "CopyFrom", "(", "arg_0", ".", "_get_stream_id", "(", "arg_3", ".", "component_id", ",", "arg_3", ".", "stream_id", ")", ")", "if", "isinstance", "(", "arg_4", ",", "Grouping", ".", "FIELDS", ")", ":", "arg_5", ".", "gtype", "=", "arg_4", ".", "gtype", "arg_5", ".", "grouping_fields", ".", "CopyFrom", "(", "arg_0", ".", "_get_stream_schema", "(", "arg_4", ".", "fields", ")", ")", "elif", "isinstance", "(", "arg_4", ",", "Grouping", ".", "CUSTOM", ")", ":", "arg_5", ".", "gtype", "=", "arg_4", ".", "gtype", "arg_5", ".", "custom_grouping_object", "=", "arg_4", ".", "python_serialized", "arg_5", ".", "type", "=", "topology_pb2", ".", "CustomGroupingObjectType", ".", "Value", "(", "\"PYTHON_OBJECT\"", ")", "else", ":", "arg_5", ".", "gtype", "=", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Adds inputs to a given protobuf Bolt message\"\"\"\n    if arg_0.inputs is None:\n      return\n    # sanitize inputs and get a map <GlobalStreamId -> Grouping>\n    arg_2 = arg_0._sanitize_inputs()\n\n    for arg_3, arg_4 in arg_2.items():\n      arg_5 = arg_1.inputs.add()\n      arg_5.stream.CopyFrom(arg_0._get_stream_id(arg_3.component_id,\n                                                    arg_3.stream_id))\n      if isinstance(arg_4, Grouping.FIELDS):\n        # it's a field grouping\n        arg_5.gtype = arg_4.gtype\n        arg_5.grouping_fields.CopyFrom(arg_0._get_stream_schema(arg_4.fields))\n      elif isinstance(arg_4, Grouping.CUSTOM):\n        # it's a custom grouping\n        arg_5.gtype = arg_4.gtype\n        arg_5.custom_grouping_object = arg_4.python_serialized\n        arg_5.type = topology_pb2.CustomGroupingObjectType.Value(\"PYTHON_OBJECT\")\n      else:\n        arg_5.gtype = arg_4", "path": "heronpy/api/component/component_spec.py", "identifier": "HeronComponentSpec._add_in_streams", "docstring": "Adds inputs to a given protobuf Bolt message", "docstring_tokens": ["Adds", "inputs", "to", "a", "given", "protobuf", "Bolt", "message"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254627}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/util.py#L56-L67", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Replace munged string components with their original\n    representation.", "language": "python", "parameters": "(s: str)", "return_statement": "return re.sub(_DEMUNGE_PATTERN, demunge_replacer, s).replace(\"_\", \"-\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "arg_1", ":", "def", "Func_replacer", "(", "arg_2", ":", "arg_3", ")", "->", "arg_1", ":", "arg_4", "=", "arg_2", ".", "group", "(", "0", ")", "arg_5", "=", "_DEMUNGE_REPLACEMENTS", ".", "get", "(", "arg_4", ",", "None", ")", "if", "arg_5", ":", "return", "arg_5", "return", "arg_4", "return", "re", ".", "sub", "(", "_DEMUNGE_PATTERN", ",", "Func_replacer", ",", "arg_0", ")", ".", "replace", "(", "\"_\"", ",", "\"-\"", ")"], "function": "def Func(arg_0: arg_1) -> arg_1:\n    \"\"\"Replace munged string components with their original\n    representation.\"\"\"\n\n    def Func_replacer(arg_2: arg_3) -> arg_1:\n        arg_4 = arg_2.group(0)\n        arg_5 = _DEMUNGE_REPLACEMENTS.get(arg_4, None)\n        if arg_5:\n            return arg_5\n        return arg_4\n\n    return re.sub(_DEMUNGE_PATTERN, Func_replacer, arg_0).replace(\"_\", \"-\")", "path": "src/basilisp/lang/util.py", "identifier": "demunge", "docstring": "Replace munged string components with their original\n    representation.", "docstring_tokens": ["Replace", "munged", "string", "components", "with", "their", "original", "representation", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 254628}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/vector_diffeomixture.py#L814-L850", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper to infer batch_shape and event_shape.", "language": "python", "parameters": "(grid, endpoint_affine)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "tf", ".", "name_scope", "(", "\"Func\"", ")", ":", "arg_2", "=", "arg_0", ".", "shape", "[", ":", "-", "2", "]", "arg_3", "=", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "[", ":", "-", "2", "]", "arg_4", "=", "None", "arg_5", "=", "None", "def", "_set_event_shape", "(", "arg_6", ",", "arg_7", ")", ":", "if", "arg_4", "is", "None", ":", "return", "arg_6", ",", "arg_7", "return", "(", "tf", ".", "broadcast_static_shape", "(", "arg_4", ",", "arg_6", ")", ",", "tf", ".", "broadcast_dynamic_shape", "(", "arg_5", ",", "arg_7", ")", ")", "for", "arg_8", "in", "arg_1", ":", "if", "arg_8", ".", "shift", "is", "not", "None", ":", "arg_2", "=", "tf", ".", "broadcast_static_shape", "(", "arg_2", ",", "arg_8", ".", "shift", ".", "shape", "[", ":", "-", "1", "]", ")", "arg_3", "=", "tf", ".", "broadcast_dynamic_shape", "(", "arg_3", ",", "tf", ".", "shape", "(", "input", "=", "arg_8", ".", "shift", ")", "[", ":", "-", "1", "]", ")", "arg_4", ",", "arg_5", "=", "_set_event_shape", "(", "arg_8", ".", "shift", ".", "shape", "[", "-", "1", ":", "]", ",", "tf", ".", "shape", "(", "input", "=", "arg_8", ".", "shift", ")", "[", "-", "1", ":", "]", ")", "if", "arg_8", ".", "scale", "is", "not", "None", ":", "arg_2", "=", "tf", ".", "broadcast_static_shape", "(", "arg_2", ",", "arg_8", ".", "scale", ".", "batch_shape", ")", "arg_3", "=", "tf", ".", "broadcast_dynamic_shape", "(", "arg_3", ",", "arg_8", ".", "scale", ".", "batch_shape_tensor", "(", ")", ")", "arg_4", ",", "arg_5", "=", "_set_event_shape", "(", "tf", ".", "TensorShape", "(", "[", "arg_8", ".", "scale", ".", "range_dimension", "]", ")", ",", "arg_8", ".", "scale", ".", "range_dimension_tensor", "(", ")", "[", "tf", ".", "newaxis", "]", ")", "return", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Helper to infer batch_shape and event_shape.\"\"\"\n  with tf.name_scope(\"Func\"):\n    # grid  # shape: [B, k, q]\n    # endpoint_affine     # len=k, shape: [B, d, d]\n    arg_2 = arg_0.shape[:-2]\n    arg_3 = tf.shape(input=arg_0)[:-2]\n    arg_4 = None\n    arg_5 = None\n\n    def _set_event_shape(arg_6, arg_7):\n      if arg_4 is None:\n        return arg_6, arg_7\n      return (tf.broadcast_static_shape(arg_4, arg_6),\n              tf.broadcast_dynamic_shape(arg_5, arg_7))\n\n    for arg_8 in arg_1:\n      if arg_8.shift is not None:\n        arg_2 = tf.broadcast_static_shape(arg_2,\n                                                arg_8.shift.shape[:-1])\n        arg_3 = tf.broadcast_dynamic_shape(\n            arg_3,\n            tf.shape(input=arg_8.shift)[:-1])\n        arg_4, arg_5 = _set_event_shape(\n            arg_8.shift.shape[-1:],\n            tf.shape(input=arg_8.shift)[-1:])\n\n      if arg_8.scale is not None:\n        arg_2 = tf.broadcast_static_shape(arg_2,\n                                                arg_8.scale.batch_shape)\n        arg_3 = tf.broadcast_dynamic_shape(\n            arg_3, arg_8.scale.batch_shape_tensor())\n        arg_4, arg_5 = _set_event_shape(\n            tf.TensorShape([arg_8.scale.range_dimension]),\n            arg_8.scale.range_dimension_tensor()[tf.newaxis])\n\n    return arg_2, arg_3, arg_4, arg_5", "path": "tensorflow_probability/python/distributions/vector_diffeomixture.py", "identifier": "determine_batch_event_shapes", "docstring": "Helper to infer batch_shape and event_shape.", "docstring_tokens": ["Helper", "to", "infer", "batch_shape", "and", "event_shape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254629}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/batchoperations.py#L91-L103", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Stops a batch request from running. Since only one batch request is\n        run at a time, this can be used to cancel a long running request. The\n        results of any completed operations will not be available after this\n        call.", "language": "python", "parameters": "(self, batch_id)", "return_statement": "return self._mc_client._delete(url=self._build_path(batch_id))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "batch_id", "=", "arg_1", "arg_0", ".", "operation_status", "=", "None", "return", "arg_0", ".", "_mc_client", ".", "_Func", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Stops a batch request from running. Since only one batch request is\n        run at a time, this can be used to cancel a long running request. The\n        results of any completed operations will not be available after this\n        call.\n\n        :param batch_id: The unique id for the batch operation.\n        :type batch_id: :py:class:`str`\n        \"\"\"\n        arg_0.batch_id = arg_1\n        arg_0.operation_status = None\n        return arg_0._mc_client._Func(url=arg_0._build_path(arg_1))", "path": "mailchimp3/entities/batchoperations.py", "identifier": "BatchOperations.delete", "docstring": "Stops a batch request from running. Since only one batch request is\n        run at a time, this can be used to cancel a long running request. The\n        results of any completed operations will not be available after this\n        call.\n\n        :param batch_id: The unique id for the batch operation.\n        :type batch_id: :py:class:`str`", "docstring_tokens": ["Stops", "a", "batch", "request", "from", "running", ".", "Since", "only", "one", "batch", "request", "is", "run", "at", "a", "time", "this", "can", "be", "used", "to", "cancel", "a", "long", "running", "request", ".", "The", "results", "of", "any", "completed", "operations", "will", "not", "be", "available", "after", "this", "call", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 254630}
{"url": "https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L695-L725", "sha": "b8b17d0317fc6728d5586553ab29a7d97e6417fd", "docstring_summary": "Parse multiple definitions and yield them.", "language": "python", "parameters": "(self, class_, all=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "while", "arg_0", ".", "current", "is", "not", "None", ":", "arg_0", ".", "log", ".", "debug", "(", "\"parsing definition list, current token is %r (%s)\"", ",", "arg_0", ".", "current", ".", "kind", ",", "arg_0", ".", "current", ".", "value", ",", ")", "arg_0", ".", "log", ".", "debug", "(", "\"got_newline: %s\"", ",", "arg_0", ".", "stream", ".", "got_logical_newline", ")", "if", "arg_2", "and", "arg_0", ".", "current", ".", "value", "==", "\"__all__\"", ":", "arg_0", ".", "parse_all", "(", ")", "elif", "(", "arg_0", ".", "current", ".", "kind", "==", "tk", ".", "OP", "and", "arg_0", ".", "current", ".", "value", "==", "\"@\"", "and", "arg_0", ".", "stream", ".", "got_logical_newline", ")", ":", "arg_0", ".", "consume", "(", "tk", ".", "OP", ")", "arg_0", ".", "parse_decorators", "(", ")", "elif", "arg_0", ".", "current", ".", "value", "in", "[", "\"def\"", ",", "\"class\"", "]", ":", "yield", "arg_0", ".", "parse_definition", "(", "arg_1", ".", "_nest", "(", "arg_0", ".", "current", ".", "value", ")", ")", "elif", "arg_0", ".", "current", ".", "kind", "==", "tk", ".", "INDENT", ":", "arg_0", ".", "consume", "(", "tk", ".", "INDENT", ")", "for", "arg_3", "in", "arg_0", ".", "Func", "(", "arg_1", ")", ":", "yield", "arg_3", "elif", "arg_0", ".", "current", ".", "kind", "==", "tk", ".", "DEDENT", ":", "arg_0", ".", "consume", "(", "tk", ".", "DEDENT", ")", "return", "elif", "arg_0", ".", "current", ".", "value", "==", "\"from\"", ":", "arg_0", ".", "parse_from_import_statement", "(", ")", "else", ":", "arg_0", ".", "stream", ".", "move", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Parse multiple definitions and yield them.\"\"\"\n        while arg_0.current is not None:\n            arg_0.log.debug(\n                \"parsing definition list, current token is %r (%s)\",\n                arg_0.current.kind,\n                arg_0.current.value,\n            )\n            arg_0.log.debug(\"got_newline: %s\", arg_0.stream.got_logical_newline)\n            if arg_2 and arg_0.current.value == \"__all__\":\n                arg_0.parse_all()\n            elif (\n                arg_0.current.kind == tk.OP\n                and arg_0.current.value == \"@\"\n                and arg_0.stream.got_logical_newline\n            ):\n                arg_0.consume(tk.OP)\n                arg_0.parse_decorators()\n            elif arg_0.current.value in [\"def\", \"class\"]:\n                yield arg_0.parse_definition(arg_1._nest(arg_0.current.value))\n            elif arg_0.current.kind == tk.INDENT:\n                arg_0.consume(tk.INDENT)\n                for arg_3 in arg_0.Func(arg_1):\n                    yield arg_3\n            elif arg_0.current.kind == tk.DEDENT:\n                arg_0.consume(tk.DEDENT)\n                return\n            elif arg_0.current.value == \"from\":\n                arg_0.parse_from_import_statement()\n            else:\n                arg_0.stream.move()", "path": "flake8_rst_docstrings.py", "identifier": "Parser.parse_definitions", "docstring": "Parse multiple definitions and yield them.", "docstring_tokens": ["Parse", "multiple", "definitions", "and", "yield", "them", "."], "nwo": "peterjc/flake8-rst-docstrings", "score": 0.3935263471523765, "idx": 254631}
{"url": "https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L27-L32", "sha": "7ea7626695abf095df6a67f66e5b3e9ae91b16df", "docstring_summary": "Recursively generate of all the subclasses of class cls.", "language": "python", "parameters": "(cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "__subclasses__", "(", ")", ":", "yield", "arg_1", "for", "arg_2", "in", "Func", "(", "arg_1", ")", ":", "yield", "arg_2"], "function": "def Func(arg_0):\n    \"\"\" Recursively generate of all the subclasses of class cls. \"\"\"\n    for arg_1 in arg_0.__subclasses__():\n        yield arg_1\n        for arg_2 in Func(arg_1):\n            yield arg_2", "path": "pyaxiom/utils.py", "identifier": "all_subclasses", "docstring": "Recursively generate of all the subclasses of class cls.", "docstring_tokens": ["Recursively", "generate", "of", "all", "the", "subclasses", "of", "class", "cls", "."], "nwo": "axiom-data-science/pyaxiom", "score": 0.138843686048881, "idx": 254632}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L296-L335", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Change the ADS state and the machine-state of the ADS-server.", "language": "python", "parameters": "(\n    port, address, ads_state, device_state, data, plc_data_type\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "_adsDLL", ".", "AdsSyncWriteControlReqEx", "arg_7", "=", "ctypes", ".", "pointer", "(", "arg_1", ".", "amsAddrStruct", "(", ")", ")", "arg_8", "=", "ctypes", ".", "c_ulong", "(", "arg_2", ")", "arg_9", "=", "ctypes", ".", "c_ulong", "(", "arg_3", ")", "if", "arg_5", "==", "PLCTYPE_STRING", ":", "arg_4", "=", "ctypes", ".", "c_char_p", "(", "arg_4", ".", "encode", "(", "\"utf-8\"", ")", ")", "arg_10", "=", "arg_4", "arg_11", "=", "len", "(", "arg_10", ".", "value", ")", "+", "1", "else", ":", "arg_4", "=", "arg_5", "(", "arg_4", ")", "arg_10", "=", "ctypes", ".", "pointer", "(", "arg_4", ")", "arg_11", "=", "ctypes", ".", "sizeof", "(", "arg_4", ")", "arg_12", "=", "arg_6", "(", "arg_0", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_11", ",", "arg_10", ",", ")", "if", "arg_12", ":", "raise", "ADSError", "(", "arg_12", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3, arg_4, arg_5\n):\n    # type: (int, AmsAddr, int, int, Any, Type) -> None\n    \"\"\"Change the ADS state and the machine-state of the ADS-server.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr adr: local or remote AmsAddr\n    :param int ads_state: new ADS-state, according to ADSTATE constants\n    :param int device_state: new machine-state\n    :param data: additional data\n    :param int plc_data_type: plc datatype, according to PLCTYPE constants\n\n    \"\"\"\n    arg_6 = _adsDLL.AdsSyncWriteControlReqEx\n\n    arg_7 = ctypes.pointer(arg_1.amsAddrStruct())\n    arg_8 = ctypes.c_ulong(arg_2)\n    arg_9 = ctypes.c_ulong(arg_3)\n\n    if arg_5 == PLCTYPE_STRING:\n        arg_4 = ctypes.c_char_p(arg_4.encode(\"utf-8\"))\n        arg_10 = arg_4\n        arg_11 = len(arg_10.value) + 1\n    else:\n        arg_4 = arg_5(arg_4)\n        arg_10 = ctypes.pointer(arg_4)\n        arg_11 = ctypes.sizeof(arg_4)\n\n    arg_12 = arg_6(\n        arg_0,\n        arg_7,\n        arg_8,\n        arg_9,\n        arg_11,\n        arg_10,\n    )\n\n    if arg_12:\n        raise ADSError(arg_12)", "path": "pyads/pyads_ex.py", "identifier": "adsSyncWriteControlReqEx", "docstring": "Change the ADS state and the machine-state of the ADS-server.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr adr: local or remote AmsAddr\n    :param int ads_state: new ADS-state, according to ADSTATE constants\n    :param int device_state: new machine-state\n    :param data: additional data\n    :param int plc_data_type: plc datatype, according to PLCTYPE constants", "docstring_tokens": ["Change", "the", "ADS", "state", "and", "the", "machine", "-", "state", "of", "the", "ADS", "-", "server", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 254633}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1681-L1765", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Converts multiple input images into a single image showing them in a grid.", "language": "python", "parameters": "(images, rows=None, cols=None)", "return_statement": "return grid", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "len", "(", "arg_0", ")", "do_assert", "(", "arg_3", ">", "0", ")", "if", "is_np_array", "(", "arg_0", ")", ":", "do_assert", "(", "arg_0", ".", "ndim", "==", "4", ")", "else", ":", "do_assert", "(", "is_iterable", "(", "arg_0", ")", "and", "is_np_array", "(", "arg_0", "[", "0", "]", ")", "and", "arg_0", "[", "0", "]", ".", "ndim", "==", "3", ")", "arg_4", "=", "[", "arg_17", ".", "dtype", ".", "name", "for", "arg_17", "in", "arg_0", "]", "arg_5", "=", "len", "(", "set", "(", "arg_4", ")", ")", "do_assert", "(", "arg_5", "==", "1", ",", "(", "\"All images provided to Func() must have the same dtype, \"", "+", "\"found %d dtypes (%s)\"", ")", "%", "(", "arg_5", ",", "\", \"", ".", "join", "(", "arg_4", ")", ")", ")", "arg_6", "=", "max", "(", "[", "arg_17", ".", "shape", "[", "0", "]", "for", "arg_17", "in", "arg_0", "]", ")", "arg_7", "=", "max", "(", "[", "arg_17", ".", "shape", "[", "1", "]", "for", "arg_17", "in", "arg_0", "]", ")", "arg_8", "=", "set", "(", "[", "arg_17", ".", "shape", "[", "2", "]", "for", "arg_17", "in", "arg_0", "]", ")", "do_assert", "(", "len", "(", "arg_8", ")", "==", "1", ",", "\"All images are expected to have the same number of channels, \"", "+", "\"but got channel set %s with length %d instead.\"", "%", "(", "str", "(", "arg_8", ")", ",", "len", "(", "arg_8", ")", ")", ")", "arg_9", "=", "list", "(", "arg_8", ")", "[", "0", "]", "if", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "arg_1", "=", "arg_2", "=", "int", "(", "math", ".", "ceil", "(", "math", ".", "sqrt", "(", "arg_3", ")", ")", ")", "elif", "arg_1", "is", "not", "None", ":", "arg_2", "=", "int", "(", "math", ".", "ceil", "(", "arg_3", "/", "arg_1", ")", ")", "elif", "arg_2", "is", "not", "None", ":", "arg_1", "=", "int", "(", "math", ".", "ceil", "(", "arg_3", "/", "arg_2", ")", ")", "do_assert", "(", "arg_1", "*", "arg_2", ">=", "arg_3", ")", "arg_10", "=", "arg_7", "*", "arg_2", "arg_11", "=", "arg_6", "*", "arg_1", "arg_12", "=", "arg_0", ".", "dtype", "if", "is_np_array", "(", "arg_0", ")", "else", "arg_0", "[", "0", "]", ".", "dtype", "arg_13", "=", "np", ".", "zeros", "(", "(", "arg_11", ",", "arg_10", ",", "arg_9", ")", ",", "dtype", "=", "arg_12", ")", "arg_14", "=", "0", "for", "arg_15", "in", "sm", ".", "xrange", "(", "arg_1", ")", ":", "for", "arg_16", "in", "sm", ".", "xrange", "(", "arg_2", ")", ":", "if", "arg_14", "<", "arg_3", ":", "arg_17", "=", "arg_0", "[", "arg_14", "]", "arg_18", "=", "arg_6", "*", "arg_15", "arg_19", "=", "arg_18", "+", "arg_17", ".", "shape", "[", "0", "]", "arg_20", "=", "arg_7", "*", "arg_16", "arg_21", "=", "arg_20", "+", "arg_17", ".", "shape", "[", "1", "]", "arg_13", "[", "arg_18", ":", "arg_19", ",", "arg_20", ":", "arg_21", ",", ":", "]", "=", "arg_17", "arg_14", "+=", "1", "return", "arg_13"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"\n    Converts multiple input images into a single image showing them in a grid.\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: yes; fully tested\n        * ``uint32``: yes; fully tested\n        * ``uint64``: yes; fully tested\n        * ``int8``: yes; fully tested\n        * ``int16``: yes; fully tested\n        * ``int32``: yes; fully tested\n        * ``int64``: yes; fully tested\n        * ``float16``: yes; fully tested\n        * ``float32``: yes; fully tested\n        * ``float64``: yes; fully tested\n        * ``float128``: yes; fully tested\n        * ``bool``: yes; fully tested\n\n    Parameters\n    ----------\n    images : (N,H,W,3) ndarray or iterable of (H,W,3) array\n        The input images to convert to a grid.\n\n    rows : None or int, optional\n        The number of rows to show in the grid.\n        If None, it will be automatically derived.\n\n    cols : None or int, optional\n        The number of cols to show in the grid.\n        If None, it will be automatically derived.\n\n    Returns\n    -------\n    grid : (H',W',3) ndarray\n        Image of the generated grid.\n\n    \"\"\"\n    arg_3 = len(arg_0)\n    do_assert(arg_3 > 0)\n\n    if is_np_array(arg_0):\n        do_assert(arg_0.ndim == 4)\n    else:\n        do_assert(is_iterable(arg_0) and is_np_array(arg_0[0]) and arg_0[0].ndim == 3)\n        arg_4 = [arg_17.dtype.name for arg_17 in arg_0]\n        arg_5 = len(set(arg_4))\n        do_assert(arg_5 == 1, (\"All images provided to Func() must have the same dtype, \"\n                                   + \"found %d dtypes (%s)\") % (arg_5, \", \".join(arg_4)))\n\n    arg_6 = max([arg_17.shape[0] for arg_17 in arg_0])\n    arg_7 = max([arg_17.shape[1] for arg_17 in arg_0])\n    arg_8 = set([arg_17.shape[2] for arg_17 in arg_0])\n    do_assert(\n        len(arg_8) == 1,\n        \"All images are expected to have the same number of channels, \"\n        + \"but got channel set %s with length %d instead.\" % (str(arg_8), len(arg_8))\n    )\n    arg_9 = list(arg_8)[0]\n    if arg_1 is None and arg_2 is None:\n        arg_1 = arg_2 = int(math.ceil(math.sqrt(arg_3)))\n    elif arg_1 is not None:\n        arg_2 = int(math.ceil(arg_3 / arg_1))\n    elif arg_2 is not None:\n        arg_1 = int(math.ceil(arg_3 / arg_2))\n    do_assert(arg_1 * arg_2 >= arg_3)\n\n    arg_10 = arg_7 * arg_2\n    arg_11 = arg_6 * arg_1\n    arg_12 = arg_0.dtype if is_np_array(arg_0) else arg_0[0].dtype\n    arg_13 = np.zeros((arg_11, arg_10, arg_9), dtype=arg_12)\n    arg_14 = 0\n    for arg_15 in sm.xrange(arg_1):\n        for arg_16 in sm.xrange(arg_2):\n            if arg_14 < arg_3:\n                arg_17 = arg_0[arg_14]\n                arg_18 = arg_6 * arg_15\n                arg_19 = arg_18 + arg_17.shape[0]\n                arg_20 = arg_7 * arg_16\n                arg_21 = arg_20 + arg_17.shape[1]\n                arg_13[arg_18:arg_19, arg_20:arg_21, :] = arg_17\n            arg_14 += 1\n\n    return arg_13", "path": "imgaug/imgaug.py", "identifier": "draw_grid", "docstring": "Converts multiple input images into a single image showing them in a grid.\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: yes; fully tested\n        * ``uint32``: yes; fully tested\n        * ``uint64``: yes; fully tested\n        * ``int8``: yes; fully tested\n        * ``int16``: yes; fully tested\n        * ``int32``: yes; fully tested\n        * ``int64``: yes; fully tested\n        * ``float16``: yes; fully tested\n        * ``float32``: yes; fully tested\n        * ``float64``: yes; fully tested\n        * ``float128``: yes; fully tested\n        * ``bool``: yes; fully tested\n\n    Parameters\n    ----------\n    images : (N,H,W,3) ndarray or iterable of (H,W,3) array\n        The input images to convert to a grid.\n\n    rows : None or int, optional\n        The number of rows to show in the grid.\n        If None, it will be automatically derived.\n\n    cols : None or int, optional\n        The number of cols to show in the grid.\n        If None, it will be automatically derived.\n\n    Returns\n    -------\n    grid : (H',W',3) ndarray\n        Image of the generated grid.", "docstring_tokens": ["Converts", "multiple", "input", "images", "into", "a", "single", "image", "showing", "them", "in", "a", "grid", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254634}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/differential_evolution.py#L605-L671", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Performs recombination by binary crossover for the current population.", "language": "python", "parameters": "(population,\n                      population_size,\n                      mutants,\n                      crossover_prob,\n                      seed)", "return_statement": "return recombinants", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "[", "tf", ".", "cast", "(", "tf", ".", "size", "(", "input", "=", "x", ")", ",", "dtype", "=", "tf", ".", "float64", ")", "for", "x", "in", "arg_0", "]", "arg_6", "=", "distributions", ".", "SeedStream", "(", "arg_4", ",", "salt", "=", "'binary_crossover'", ")", "arg_7", "=", "distributions", ".", "Categorical", "(", "arg_5", ")", ".", "sample", "(", "[", "arg_1", ",", "1", "]", ",", "arg_4", "=", "arg_6", "(", ")", ")", "arg_8", "=", "[", "]", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_0", ")", ":", "arg_11", "=", "tf", ".", "reshape", "(", "arg_10", ",", "[", "arg_1", ",", "-", "1", "]", ")", "arg_12", "=", "tf", ".", "reshape", "(", "arg_2", "[", "arg_9", "]", ",", "[", "arg_1", ",", "-", "1", "]", ")", "arg_13", "=", "tf", ".", "size", "(", "input", "=", "arg_10", ")", "//", "arg_1", "arg_14", "=", "tf", ".", "one_hot", "(", "tf", ".", "random", ".", "uniform", "(", "[", "arg_1", "]", ",", "minval", "=", "0", ",", "maxval", "=", "arg_13", ",", "dtype", "=", "tf", ".", "int32", ",", "arg_4", "=", "arg_6", "(", ")", ")", ",", "arg_13", ",", "on_value", "=", "True", ",", "off_value", "=", "False", ",", "dtype", "=", "tf", ".", "bool", ")", "arg_15", "=", "tf", ".", "math", ".", "equal", "(", "arg_7", ",", "arg_9", ")", "arg_14", "&=", "arg_15", "arg_16", "=", "tf", ".", "random", ".", "uniform", "(", "[", "arg_1", ",", "arg_13", "]", ",", "dtype", "=", "arg_3", ".", "dtype", ".", "base_dtype", ",", "arg_4", "=", "arg_6", "(", ")", ")", "<", "arg_3", "arg_16", "|=", "arg_14", "arg_17", "=", "tf", ".", "where", "(", "arg_16", ",", "x", "=", "arg_12", ",", "y", "=", "arg_11", ")", "arg_18", "=", "tf", ".", "reshape", "(", "arg_17", ",", "tf", ".", "shape", "(", "input", "=", "arg_10", ")", ")", "arg_8", ".", "append", "(", "arg_18", ")", "return", "arg_8"], "function": "def Func(arg_0,\n                      arg_1,\n                      arg_2,\n                      arg_3,\n                      arg_4):\n  \"\"\"Performs recombination by binary crossover for the current population.\n\n  Let v_i denote the i'th component of the member v and m_i the corresponding\n  component of the mutant vector corresponding to v. Then the crossed over\n  vector w_i is determined by setting w_i =\n  (m_i with probability=crossover_prob else v_i). In addition, DE requires that\n  at least one of the components is crossed over (otherwise we end\n  up with no change). This is done by choosing on index say k randomly where\n  a force crossover is performed (i.e. w_k = m_k). This is the scheme\n  implemented in this function.\n\n  Args:\n    population: A Python list of `Tensor`s where each `Tensor` in the list\n      must be of rank at least 1 and all the elements must have a common\n      first dimension. The base population to cross over.\n    population_size: A scalar integer `Tensor`. The number of elements in the\n      population (i.e. size of the first dimension of any member of\n      `population`).\n    mutants: A Python list of `Tensor`s with the same structure as `population`.\n      The mutated population.\n    crossover_prob: A postive real scalar `Tensor` bounded above by 1.0. The\n      probability of a crossover being performed for each axis.\n    seed: `int` or None. The random seed for this `Op`. If `None`, no seed is\n      applied.\n\n  Returns:\n    A list of `Tensor`s of the same structure, dtype and shape as `population`.\n    The recombined population.\n  \"\"\"\n  arg_5 = [tf.cast(tf.size(input=x), dtype=tf.float64) for x in arg_0]\n  arg_6 = distributions.SeedStream(arg_4, salt='binary_crossover')\n  arg_7 = distributions.Categorical(arg_5).sample(\n      [arg_1, 1], arg_4=arg_6())\n  arg_8 = []\n  for arg_9, arg_10 in enumerate(arg_0):\n    arg_11 = tf.reshape(arg_10, [arg_1, -1])\n    arg_12 = tf.reshape(arg_2[arg_9], [arg_1, -1])\n    arg_13 = tf.size(input=arg_10) // arg_1\n    arg_14 = tf.one_hot(\n        tf.random.uniform([arg_1],\n                          minval=0,\n                          maxval=arg_13,\n                          dtype=tf.int32,\n                          arg_4=arg_6()),\n        arg_13,\n        on_value=True,\n        off_value=False,\n        dtype=tf.bool)  # Tensor of shape [population_size, size]\n    arg_15 = tf.math.equal(arg_7, arg_9)\n    arg_14 &= arg_15\n    arg_16 = tf.random.uniform(\n        [arg_1, arg_13],\n        dtype=arg_3.dtype.base_dtype,\n        arg_4=arg_6()) < arg_3\n    arg_16 |= arg_14\n    arg_17 = tf.where(\n        arg_16,\n        x=arg_12,\n        y=arg_11)\n    arg_18 = tf.reshape(arg_17, tf.shape(input=arg_10))\n    arg_8.append(arg_18)\n  return arg_8", "path": "tensorflow_probability/python/optimizer/differential_evolution.py", "identifier": "_binary_crossover", "docstring": "Performs recombination by binary crossover for the current population.\n\n  Let v_i denote the i'th component of the member v and m_i the corresponding\n  component of the mutant vector corresponding to v. Then the crossed over\n  vector w_i is determined by setting w_i =\n  (m_i with probability=crossover_prob else v_i). In addition, DE requires that\n  at least one of the components is crossed over (otherwise we end\n  up with no change). This is done by choosing on index say k randomly where\n  a force crossover is performed (i.e. w_k = m_k). This is the scheme\n  implemented in this function.\n\n  Args:\n    population: A Python list of `Tensor`s where each `Tensor` in the list\n      must be of rank at least 1 and all the elements must have a common\n      first dimension. The base population to cross over.\n    population_size: A scalar integer `Tensor`. The number of elements in the\n      population (i.e. size of the first dimension of any member of\n      `population`).\n    mutants: A Python list of `Tensor`s with the same structure as `population`.\n      The mutated population.\n    crossover_prob: A postive real scalar `Tensor` bounded above by 1.0. The\n      probability of a crossover being performed for each axis.\n    seed: `int` or None. The random seed for this `Op`. If `None`, no seed is\n      applied.\n\n  Returns:\n    A list of `Tensor`s of the same structure, dtype and shape as `population`.\n    The recombined population.", "docstring_tokens": ["Performs", "recombination", "by", "binary", "crossover", "for", "the", "current", "population", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254635}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L112-L123", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This function removes any unnecessary bundles, apps, libs, and services that aren't needed by\n    the activated_bundles.  It also expands inside specs.apps.depends.libs all libs that are needed\n    indirectly by each app", "language": "python", "parameters": "(specs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_filter_active", "(", "constants", ".", "CONFIG_BUNDLES_KEY", ",", "arg_0", ")", "_filter_active", "(", "'apps'", ",", "arg_0", ")", "_expand_libs_in_apps", "(", "arg_0", ")", "_filter_active", "(", "'libs'", ",", "arg_0", ")", "_filter_active", "(", "'services'", ",", "arg_0", ")", "_add_active_assets", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    This function removes any unnecessary bundles, apps, libs, and services that aren't needed by\n    the activated_bundles.  It also expands inside specs.apps.depends.libs all libs that are needed\n    indirectly by each app\n    \"\"\"\n    _filter_active(constants.CONFIG_BUNDLES_KEY, arg_0)\n    _filter_active('apps', arg_0)\n    _expand_libs_in_apps(arg_0)\n    _filter_active('libs', arg_0)\n    _filter_active('services', arg_0)\n    _add_active_assets(arg_0)", "path": "dusty/compiler/spec_assembler.py", "identifier": "_get_expanded_active_specs", "docstring": "This function removes any unnecessary bundles, apps, libs, and services that aren't needed by\n    the activated_bundles.  It also expands inside specs.apps.depends.libs all libs that are needed\n    indirectly by each app", "docstring_tokens": ["This", "function", "removes", "any", "unnecessary", "bundles", "apps", "libs", "and", "services", "that", "aren", "t", "needed", "by", "the", "activated_bundles", ".", "It", "also", "expands", "inside", "specs", ".", "apps", ".", "depends", ".", "libs", "all", "libs", "that", "are", "needed", "indirectly", "by", "each", "app"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 254636}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/notebook.py#L105-L118", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Add a markdown cell to the notebook", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"cell_type\"", ":", "\"markdown\"", ",", "\"metadata\"", ":", "{", "}", ",", "\"source\"", ":", "[", "rst2md", "(", "arg_1", ")", "]", "}", "arg_0", ".", "work_notebook", "[", "\"cells\"", "]", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add a markdown cell to the notebook\n\n        Parameters\n        ----------\n        code : str\n            Cell content\n        \"\"\"\n        arg_2 = {\n            \"cell_type\": \"markdown\",\n            \"metadata\": {},\n            \"source\": [rst2md(arg_1)]\n        }\n        arg_0.work_notebook[\"cells\"].append(arg_2)", "path": "doc/sphinxext/sphinx_gallery/notebook.py", "identifier": "Notebook.add_markdown_cell", "docstring": "Add a markdown cell to the notebook\n\n        Parameters\n        ----------\n        code : str\n            Cell content", "docstring_tokens": ["Add", "a", "markdown", "cell", "to", "the", "notebook"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 254637}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/core/runtime.py#L20-L24", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Execute `then_branch` when training.", "language": "python", "parameters": "(self, then_branch, else_branch)", "return_statement": "return ifelse(self._training_flag, then_branch, else_branch, name=\"iftrain\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "ifelse", "(", "arg_0", ".", "_training_flag", ",", "arg_1", ",", "arg_2", ",", "name", "=", "\"Func\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Execute `then_branch` when training.\n        \"\"\"\n        return ifelse(arg_0._training_flag, arg_1, arg_2, name=\"Func\")", "path": "deepy/core/runtime.py", "identifier": "Runtime.iftrain", "docstring": "Execute `then_branch` when training.", "docstring_tokens": ["Execute", "then_branch", "when", "training", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 254638}
{"url": "https://github.com/hamelsmu/ktext/blob/221f09f5b1762705075fd1bd914881c0724d5e02/ktext/preprocess.py#L218-L225", "sha": "221f09f5b1762705075fd1bd914881c0724d5e02", "docstring_summary": "Combine the cleaner and tokenizer.", "language": "python", "parameters": "(self, text: List[str])", "return_statement": "return process_text(text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ")", "->", "arg_2", "[", "arg_2", "[", "arg_3", "]", "]", ":", "Func", "=", "process_text_constructor", "(", "cleaner", "=", "arg_0", ".", "cleaner", ",", "tokenizer", "=", "arg_0", ".", "tokenizer", ",", "append_indicators", "=", "arg_0", ".", "append_indicators", ",", "start_tok", "=", "arg_0", ".", "start_tok", ",", "end_tok", "=", "arg_0", ".", "end_tok", ")", "return", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2[arg_3]) -> arg_2[arg_2[arg_3]]:\n        \"\"\"Combine the cleaner and tokenizer.\"\"\"\n        Func = process_text_constructor(cleaner=arg_0.cleaner,\n                                                tokenizer=arg_0.tokenizer,\n                                                append_indicators=arg_0.append_indicators,\n                                                start_tok=arg_0.start_tok,\n                                                end_tok=arg_0.end_tok)\n        return Func(arg_1)", "path": "ktext/preprocess.py", "identifier": "processor.process_text", "docstring": "Combine the cleaner and tokenizer.", "docstring_tokens": ["Combine", "the", "cleaner", "and", "tokenizer", "."], "nwo": "hamelsmu/ktext", "score": 0.5862139051793661, "idx": 254639}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L494-L515", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks whether the dependents of this task instance have all succeeded.\n        This is meant to be used by wait_for_downstream.", "language": "python", "parameters": "(self, session=None)", "return_statement": "return count == len(task.downstream_task_ids)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "task", "if", "not", "arg_2", ".", "downstream_task_ids", ":", "return", "True", "arg_3", "=", "arg_1", ".", "query", "(", "func", ".", "count", "(", "TaskInstance", ".", "task_id", ")", ")", ".", "filter", "(", "TaskInstance", ".", "dag_id", "==", "arg_0", ".", "dag_id", ",", "TaskInstance", ".", "task_id", ".", "in_", "(", "arg_2", ".", "downstream_task_ids", ")", ",", "TaskInstance", ".", "execution_date", "==", "arg_0", ".", "execution_date", ",", "TaskInstance", ".", "state", "==", "State", ".", "SUCCESS", ",", ")", "arg_4", "=", "arg_3", "[", "0", "]", "[", "0", "]", "return", "arg_4", "==", "len", "(", "arg_2", ".", "downstream_task_ids", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Checks whether the dependents of this task instance have all succeeded.\n        This is meant to be used by wait_for_downstream.\n\n        This is useful when you do not want to start processing the next\n        schedule of a task until the dependents are done. For instance,\n        if the task DROPs and recreates a table.\n        \"\"\"\n        arg_2 = arg_0.task\n\n        if not arg_2.downstream_task_ids:\n            return True\n\n        arg_3 = arg_1.query(func.count(TaskInstance.task_id)).filter(\n            TaskInstance.dag_id == arg_0.dag_id,\n            TaskInstance.task_id.in_(arg_2.downstream_task_ids),\n            TaskInstance.execution_date == arg_0.execution_date,\n            TaskInstance.state == State.SUCCESS,\n        )\n        arg_4 = arg_3[0][0]\n        return arg_4 == len(arg_2.downstream_task_ids)", "path": "airflow/models/taskinstance.py", "identifier": "TaskInstance.are_dependents_done", "docstring": "Checks whether the dependents of this task instance have all succeeded.\n        This is meant to be used by wait_for_downstream.\n\n        This is useful when you do not want to start processing the next\n        schedule of a task until the dependents are done. For instance,\n        if the task DROPs and recreates a table.", "docstring_tokens": ["Checks", "whether", "the", "dependents", "of", "this", "task", "instance", "have", "all", "succeeded", ".", "This", "is", "meant", "to", "be", "used", "by", "wait_for_downstream", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254640}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/ipkernel.py#L274-L281", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "step eventloop just once", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "control_stream", ":", "arg_0", ".", "control_stream", ".", "flush", "(", ")", "for", "arg_1", "in", "arg_0", ".", "shell_streams", ":", "arg_1", ".", "flush", "(", "zmq", ".", "POLLIN", ",", "1", ")", "arg_1", ".", "flush", "(", "zmq", ".", "POLLOUT", ")"], "function": "def Func(arg_0):\n        \"\"\"step eventloop just once\"\"\"\n        if arg_0.control_stream:\n            arg_0.control_stream.flush()\n        for arg_1 in arg_0.shell_streams:\n            # handle at most one request per iteration\n            arg_1.flush(zmq.POLLIN, 1)\n            arg_1.flush(zmq.POLLOUT)", "path": "environment/lib/python2.7/site-packages/IPython/zmq/ipkernel.py", "identifier": "Kernel.do_one_iteration", "docstring": "step eventloop just once", "docstring_tokens": ["step", "eventloop", "just", "once"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254641}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1684-L1701", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Look through the jobs table and get the list of running jobs whose\n    cancel field is true.", "language": "python", "parameters": "(self,)", "return_statement": "return tuple(r[0] for r in rows)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_1", "=", "'SELECT job_id '", "'FROM %s '", "'WHERE (status<>%%s AND cancel is TRUE)'", "%", "(", "arg_0", ".", "jobsTableName", ",", ")", "conn", ".", "cursor", ".", "execute", "(", "arg_1", ",", "[", "arg_0", ".", "STATUS_COMPLETED", "]", ")", "arg_2", "=", "conn", ".", "cursor", ".", "fetchall", "(", ")", "return", "tuple", "(", "arg_3", "[", "0", "]", "for", "arg_3", "in", "arg_2", ")"], "function": "def Func(arg_0,):\n    \"\"\" Look through the jobs table and get the list of running jobs whose\n    cancel field is true.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:      A (possibly empty) sequence of running job IDs with cancel field\n                  set to true\n    \"\"\"\n    with ConnectionFactory.get() as conn:\n      arg_1 = 'SELECT job_id '\\\n              'FROM %s ' \\\n              'WHERE (status<>%%s AND cancel is TRUE)' \\\n              % (arg_0.jobsTableName,)\n      conn.cursor.execute(arg_1, [arg_0.STATUS_COMPLETED])\n      arg_2 = conn.cursor.fetchall()\n\n    return tuple(arg_3[0] for arg_3 in arg_2)", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.jobGetCancellingJobs", "docstring": "Look through the jobs table and get the list of running jobs whose\n    cancel field is true.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:      A (possibly empty) sequence of running job IDs with cancel field\n                  set to true", "docstring_tokens": ["Look", "through", "the", "jobs", "table", "and", "get", "the", "list", "of", "running", "jobs", "whose", "cancel", "field", "is", "true", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254642}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L2359-L2383", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores a all explored parameter names for internal recall", "language": "python", "parameters": "(self, traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_1", ".", "_explored_parameters", ")", "if", "arg_2", ">", "0", ":", "if", "hasattr", "(", "arg_0", ".", "_overview_group", ",", "'explorations'", ")", ":", "arg_3", "=", "arg_0", ".", "_overview_group", ".", "_f_get_child", "(", "'explorations'", ")", "if", "len", "(", "arg_3", ")", "!=", "arg_2", ":", "arg_0", ".", "_hdf5file", ".", "remove_node", "(", "where", "=", "arg_0", ".", "_overview_group", ",", "name", "=", "'explorations'", ")", "if", "not", "hasattr", "(", "arg_0", ".", "_overview_group", ",", "'explorations'", ")", ":", "arg_4", "=", "list", "(", "arg_1", ".", "_explored_parameters", ".", "keys", "(", ")", ")", "if", "arg_4", ":", "arg_5", "=", "arg_0", ".", "_all_get_table_col", "(", "'explorations'", ",", "arg_4", ",", "'overview.explorations'", ")", "else", ":", "arg_5", "=", "pt", ".", "StringCol", "(", "1", ")", "arg_6", "=", "{", "'explorations'", ":", "arg_5", "}", "arg_3", "=", "arg_0", ".", "_hdf5file", ".", "create_table", "(", "where", "=", "arg_0", ".", "_overview_group", ",", "name", "=", "'explorations'", ",", "arg_6", "=", "arg_6", ")", "arg_7", "=", "[", "(", "x", ".", "encode", "(", "'utf-8'", ")", ",", ")", "for", "x", "in", "arg_4", "]", "if", "arg_7", ":", "arg_3", ".", "append", "(", "arg_7", ")", "arg_3", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Stores a all explored parameter names for internal recall\"\"\"\n        arg_2 = len(arg_1._explored_parameters)\n        if arg_2 > 0:\n            if hasattr(arg_0._overview_group, 'explorations'):\n                arg_3 = arg_0._overview_group._f_get_child('explorations')\n                if len(arg_3) != arg_2:\n                    arg_0._hdf5file.remove_node(where=arg_0._overview_group,\n                                         name='explorations')\n        if not hasattr(arg_0._overview_group, 'explorations'):\n            arg_4 = list(arg_1._explored_parameters.keys())\n            if arg_4:\n                arg_5 = arg_0._all_get_table_col('explorations',\n                                                      arg_4,\n                                                      'overview.explorations')\n            else:\n                arg_5 = pt.StringCol(1)\n            arg_6 = {'explorations': arg_5}\n            arg_3 = arg_0._hdf5file.create_table(where=arg_0._overview_group,\n                                                       name='explorations',\n                                                       arg_6=arg_6)\n            arg_7 = [(x.encode('utf-8'),) for x in arg_4]\n            if arg_7:\n                arg_3.append(arg_7)\n                arg_3.flush()", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._trj_store_explorations", "docstring": "Stores a all explored parameter names for internal recall", "docstring_tokens": ["Stores", "a", "all", "explored", "parameter", "names", "for", "internal", "recall"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254643}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/lander.py#L75-L91", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Upsert the technote resource into the projectmeta MongoDB collection.", "language": "python", "parameters": "(collection, jsonld)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'data'", ":", "arg_1", "}", "arg_3", "=", "{", "'data.reportNumber'", ":", "arg_1", "[", "'reportNumber'", "]", "}", "await", "arg_0", ".", "update", "(", "arg_3", ",", "arg_2", ",", "upsert", "=", "True", ",", "multi", "=", "False", ")"], "function": "async def Func(arg_0, arg_1):\n    \"\"\"Upsert the technote resource into the projectmeta MongoDB collection.\n\n    Parameters\n    ----------\n    collection : `motor.motor_asyncio.AsyncIOMotorCollection`\n        The MongoDB collection.\n    jsonld : `dict`\n        The JSON-LD document that represents the document resource.\n    \"\"\"\n    arg_2 = {\n        'data': arg_1\n    }\n    arg_3 = {\n        'data.reportNumber': arg_1['reportNumber']\n    }\n    await arg_0.update(arg_3, arg_2, upsert=True, multi=False)", "path": "lsstprojectmeta/lsstdocument/lander.py", "identifier": "_upload_to_mongodb", "docstring": "Upsert the technote resource into the projectmeta MongoDB collection.\n\n    Parameters\n    ----------\n    collection : `motor.motor_asyncio.AsyncIOMotorCollection`\n        The MongoDB collection.\n    jsonld : `dict`\n        The JSON-LD document that represents the document resource.", "docstring_tokens": ["Upsert", "the", "technote", "resource", "into", "the", "projectmeta", "MongoDB", "collection", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 254644}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/internal/util.py#L132-L165", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Elementwise adds list members, replacing non-finite results with alt_value.", "language": "python", "parameters": "(x, alt_value=-np.inf, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "-", "arg_2", ".", "inf", ",", "arg_4", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_4", ",", "'Func'", ",", "[", "arg_0", ",", "arg_1", "]", ")", ":", "if", "not", "is_list_like", "(", "arg_0", ")", ":", "raise", "TypeError", "(", "'Expected list input.'", ")", "if", "not", "arg_0", ":", "raise", "ValueError", "(", "'Input should not be empty.'", ")", "arg_5", "=", "arg_0", "[", "0", "]", ".", "shape", "arg_0", "=", "tf", ".", "stack", "(", "arg_0", ",", "axis", "=", "-", "1", ")", "arg_0", "=", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "arg_0", ",", "axis", "=", "-", "1", ")", "arg_1", "=", "arg_2", ".", "array", "(", "arg_1", ",", "arg_0", ".", "dtype", ".", "as_numpy_dtype", ")", "arg_6", "=", "tf", ".", "fill", "(", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", ",", "value", "=", "arg_1", ")", "arg_0", "=", "tf", ".", "where", "(", "tf", ".", "math", ".", "is_finite", "(", "arg_0", ")", ",", "arg_0", ",", "arg_6", ")", "arg_0", ".", "set_shape", "(", "arg_0", ".", "shape", ".", "merge_with", "(", "arg_5", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=-arg_2.inf, arg_4=None):\n  \"\"\"Elementwise adds list members, replacing non-finite results with alt_value.\n\n  Typically the `alt_value` is chosen so the `MetropolisHastings`\n  `TransitionKernel` always rejects the proposal.\n\n  Args:\n    x: Python `list` of `Tensors` to elementwise add.\n    alt_value: Python scalar used to replace any elementwise sums which would\n      otherwise be non-finite.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., \"Func\").\n\n  Returns:\n    Func: `Tensor` representing the elementwise sum of list of `Tensor`s\n      `x` or `alt_value` where sums are non-finite.\n\n  Raises:\n    TypeError: if `x` is not list-like.\n    ValueError: if `x` is empty.\n  \"\"\"\n  with tf.compat.v1.name_scope(arg_4, 'Func', [arg_0, arg_1]):\n    if not is_list_like(arg_0):\n      raise TypeError('Expected list input.')\n    if not arg_0:\n      raise ValueError('Input should not be empty.')\n    arg_5 = arg_0[0].shape\n    arg_0 = tf.stack(arg_0, axis=-1)\n    arg_0 = tf.reduce_sum(input_tensor=arg_0, axis=-1)\n    arg_1 = arg_2.array(arg_1, arg_0.dtype.as_numpy_dtype)\n    arg_6 = tf.fill(tf.shape(input=arg_0), value=arg_1)\n    arg_0 = tf.where(tf.math.is_finite(arg_0), arg_0, arg_6)\n    arg_0.set_shape(arg_0.shape.merge_with(arg_5))\n    return arg_0", "path": "tensorflow_probability/python/mcmc/internal/util.py", "identifier": "safe_sum", "docstring": "Elementwise adds list members, replacing non-finite results with alt_value.\n\n  Typically the `alt_value` is chosen so the `MetropolisHastings`\n  `TransitionKernel` always rejects the proposal.\n\n  Args:\n    x: Python `list` of `Tensors` to elementwise add.\n    alt_value: Python scalar used to replace any elementwise sums which would\n      otherwise be non-finite.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., \"safe_sum\").\n\n  Returns:\n    safe_sum: `Tensor` representing the elementwise sum of list of `Tensor`s\n      `x` or `alt_value` where sums are non-finite.\n\n  Raises:\n    TypeError: if `x` is not list-like.\n    ValueError: if `x` is empty.", "docstring_tokens": ["Elementwise", "adds", "list", "members", "replacing", "non", "-", "finite", "results", "with", "alt_value", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254645}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L150-L155", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Define an alias, but don't raise on an AliasError.", "language": "python", "parameters": "(self, name, cmd)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_0", ".", "define_alias", "(", "arg_1", ",", "arg_2", ")", "except", "AliasError", ",", "e", ":", "error", "(", "\"Invalid alias: %s\"", "%", "e", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Define an alias, but don't raise on an AliasError.\"\"\"\n        try:\n            arg_0.define_alias(arg_1, arg_2)\n        except AliasError, e:\n            error(\"Invalid alias: %s\" % e)", "path": "environment/lib/python2.7/site-packages/IPython/core/alias.py", "identifier": "AliasManager.soft_define_alias", "docstring": "Define an alias, but don't raise on an AliasError.", "docstring_tokens": ["Define", "an", "alias", "but", "don", "t", "raise", "on", "an", "AliasError", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254646}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/specs/BpmnSpecMixin.py#L72-L86", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Connect this task spec to the indicated child.", "language": "python", "parameters": "(self, taskspec, sequence_flow_id, sequence_flow_name,\n                         documentation)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_0", ".", "connect", "(", "arg_1", ")", "arg_5", "=", "SequenceFlow", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_1", ")", "arg_0", ".", "outgoing_sequence_flows", "[", "arg_1", ".", "name", "]", "=", "arg_5", "arg_0", ".", "outgoing_sequence_flows_by_id", "[", "arg_2", "]", "=", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                         arg_4):\n        \"\"\"\n        Connect this task spec to the indicated child.\n\n        :param sequence_flow_id: The ID of the connecting sequenceFlow node.\n\n        :param sequence_flow_name: The name of the connecting sequenceFlow\n        node.\n        \"\"\"\n        arg_0.connect(arg_1)\n        arg_5 = SequenceFlow(\n            arg_2, arg_3, arg_4, arg_1)\n        arg_0.outgoing_sequence_flows[arg_1.name] = arg_5\n        arg_0.outgoing_sequence_flows_by_id[arg_2] = arg_5", "path": "SpiffWorkflow/bpmn/specs/BpmnSpecMixin.py", "identifier": "BpmnSpecMixin.connect_outgoing", "docstring": "Connect this task spec to the indicated child.\n\n        :param sequence_flow_id: The ID of the connecting sequenceFlow node.\n\n        :param sequence_flow_name: The name of the connecting sequenceFlow\n        node.", "docstring_tokens": ["Connect", "this", "task", "spec", "to", "the", "indicated", "child", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 254647}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L495-L518", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Convert among IP address notations.", "language": "python", "parameters": "(ip, notation=IP_DOT, inotation=IP_UNKNOWN, check=True)", "return_statement": "return _convert(ip, notation, inotation, _check=check, _isnm=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "True", ")", ":", "return", "_Func", "(", "arg_0", ",", "arg_1", ",", "arg_3", ",", "_check", "=", "arg_5", ",", "_isnm", "=", "False", ")"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=arg_4, arg_5=True):\n    \"\"\"Convert among IP address notations.\n\n    Given an IP address, this function returns the address\n    in another notation.\n\n    @param ip: the IP address.\n    @type ip: integers, strings or object with an appropriate __str()__ method.\n\n    @param notation: the notation of the output (default: IP_DOT).\n    @type notation: one of the IP_* constants, or the equivalent strings.\n\n    @param inotation: force the input to be considered in the given notation\n                    (default the notation of the input is autodetected).\n    @type inotation: one of the IP_* constants, or the equivalent strings.\n\n    @param check: force the notation check on the input.\n    @type check: True force the check, False force not to check and None\n                do the check only if the inotation is unknown.\n\n    @return: a string representing the IP in the selected notation.\n\n    @raise ValueError: raised when the input is in unknown notation.\"\"\"\n    return _Func(arg_0, arg_1, arg_3, _check=arg_5, _isnm=False)", "path": "iplib.py", "identifier": "convert", "docstring": "Convert among IP address notations.\n\n    Given an IP address, this function returns the address\n    in another notation.\n\n    @param ip: the IP address.\n    @type ip: integers, strings or object with an appropriate __str()__ method.\n\n    @param notation: the notation of the output (default: IP_DOT).\n    @type notation: one of the IP_* constants, or the equivalent strings.\n\n    @param inotation: force the input to be considered in the given notation\n                    (default the notation of the input is autodetected).\n    @type inotation: one of the IP_* constants, or the equivalent strings.\n\n    @param check: force the notation check on the input.\n    @type check: True force the check, False force not to check and None\n                do the check only if the inotation is unknown.\n\n    @return: a string representing the IP in the selected notation.\n\n    @raise ValueError: raised when the input is in unknown notation.", "docstring_tokens": ["Convert", "among", "IP", "address", "notations", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 254648}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/png.py#L181-L195", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Convert data to web output.", "language": "python", "parameters": "(self, data)", "return_statement": "return memory_file(data, self.profile()), 'image/png'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_prepare_array_for_png", "(", "arg_1", ")", "arg_1", "=", "ma", ".", "masked_where", "(", "arg_2", "==", "arg_0", ".", "nodata", ",", "arg_2", ")", "return", "memory_file", "(", "arg_1", ",", "arg_0", ".", "profile", "(", ")", ")", ",", "'image/png'"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert data to web output.\n\n        Parameters\n        ----------\n        data : array\n\n        Returns\n        -------\n        web data : array\n        \"\"\"\n        arg_2 = arg_0._prepare_array_for_png(arg_1)\n        arg_1 = ma.masked_where(arg_2 == arg_0.nodata, arg_2)\n        return memory_file(arg_1, arg_0.profile()), 'image/png'", "path": "mapchete/formats/default/png.py", "identifier": "OutputData.for_web", "docstring": "Convert data to web output.\n\n        Parameters\n        ----------\n        data : array\n\n        Returns\n        -------\n        web data : array", "docstring_tokens": ["Convert", "data", "to", "web", "output", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 254649}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/gtr.py#L821-L861", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Calculate the probability of observing a node pair at a distance t", "language": "python", "parameters": "(self, profile_pair, multiplicity, t,\n                        return_log=False, ignore_gaps=True)", "return_statement": "return logP if return_log else np.exp(logP)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ",", "arg_5", "=", "True", ")", ":", "if", "arg_3", "<", "0", ":", "arg_6", "=", "-", "ttconf", ".", "BIG_NUMBER", "else", ":", "arg_7", "=", "arg_0", ".", "expQt", "(", "arg_3", ")", "if", "len", "(", "arg_7", ".", "shape", ")", "==", "3", ":", "arg_8", "=", "np", ".", "einsum", "(", "'ai,ija,aj->a'", ",", "arg_1", "[", "1", "]", ",", "arg_7", ",", "arg_1", "[", "0", "]", ")", "else", ":", "arg_8", "=", "np", ".", "einsum", "(", "'ai,ij,aj->a'", ",", "arg_1", "[", "1", "]", ",", "arg_7", ",", "arg_1", "[", "0", "]", ")", "if", "arg_5", "and", "(", "arg_0", ".", "gap_index", "is", "not", "None", ")", ":", "arg_9", "=", "(", "1", "-", "arg_1", "[", "0", "]", "[", ":", ",", "arg_0", ".", "gap_index", "]", ")", "*", "(", "1", "-", "arg_1", "[", "1", "]", "[", ":", ",", "arg_0", ".", "gap_index", "]", ")", "arg_6", "=", "np", ".", "sum", "(", "arg_2", "*", "np", ".", "log", "(", "arg_8", ")", "*", "arg_9", ")", "else", ":", "arg_6", "=", "np", ".", "sum", "(", "arg_2", "*", "np", ".", "log", "(", "arg_8", ")", ")", "return", "arg_6", "if", "arg_4", "else", "np", ".", "exp", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                        arg_4=False, arg_5=True):\n        '''\n        Calculate the probability of observing a node pair at a distance t\n\n        Parameters\n        ----------\n\n          profile_pair: numpy arrays\n            Probability distributions of the nucleotides at either\n            end of the branch. pp[0] = parent, pp[1] = child\n\n          multiplicity : numpy array\n            The number of times an alignment pattern is observed\n\n          t : float\n            Length of the branch separating parent and child\n\n          ignore_gaps: bool\n            If True, ignore mutations to and from gaps in distance calculations\n\n          return_log : bool\n            Whether or not to exponentiate the result\n\n        '''\n        if arg_3<0:\n            arg_6 = -ttconf.BIG_NUMBER\n        else:\n            arg_7 = arg_0.expQt(arg_3)\n            if len(arg_7.shape)==3:\n                arg_8 = np.einsum('ai,ija,aj->a', arg_1[1], arg_7, arg_1[0])\n            else:\n                arg_8 = np.einsum('ai,ij,aj->a', arg_1[1], arg_7, arg_1[0])\n            if arg_5 and (arg_0.gap_index is not None): # calculate the probability that neither outgroup/node has a gap\n                arg_9 = (1-arg_1[0][:,arg_0.gap_index])*(1-arg_1[1][:,arg_0.gap_index])\n                # weigh log LH by the non-gap probability\n                arg_6 = np.sum(arg_2*np.log(arg_8)*arg_9)\n            else:\n                arg_6 = np.sum(arg_2*np.log(arg_8))\n\n        return arg_6 if arg_4 else np.exp(arg_6)", "path": "treetime/gtr.py", "identifier": "GTR.prob_t_profiles", "docstring": "Calculate the probability of observing a node pair at a distance t\n\n        Parameters\n        ----------\n\n          profile_pair: numpy arrays\n            Probability distributions of the nucleotides at either\n            end of the branch. pp[0] = parent, pp[1] = child\n\n          multiplicity : numpy array\n            The number of times an alignment pattern is observed\n\n          t : float\n            Length of the branch separating parent and child\n\n          ignore_gaps: bool\n            If True, ignore mutations to and from gaps in distance calculations\n\n          return_log : bool\n            Whether or not to exponentiate the result", "docstring_tokens": ["Calculate", "the", "probability", "of", "observing", "a", "node", "pair", "at", "a", "distance", "t"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 254650}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L287-L290", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "move cursor down", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "_index", "arg_0", ".", "_select_index", "(", "arg_1", "+", "1", ",", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"move cursor down\"\"\"\n        arg_1, arg_2 = arg_0._index\n        arg_0._select_index(arg_1+1, arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py", "identifier": "CompletionHtml.select_down", "docstring": "move cursor down", "docstring_tokens": ["move", "cursor", "down"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254651}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/process.py#L87-L114", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "This function deal with the neutron notification.", "language": "python", "parameters": "(body, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "'event_type'", "]", "arg_3", "=", "neutron_customer_process", ".", "get", "(", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "(", "arg_0", ",", "arg_1", ")", "else", ":", "arg_4", "=", "False", "arg_5", "=", "None", "for", "arg_6", "in", "neutron_customer_process_wildcard", ".", "keys", "(", ")", ":", "if", "arg_6", ".", "match", "(", "arg_2", ")", ":", "arg_5", "=", "neutron_customer_process_wildcard", ".", "get", "(", "arg_6", ")", "arg_4", "=", "True", "break", "if", "arg_4", ":", "arg_5", "(", "arg_0", ",", "arg_1", ")", "else", ":", "default_process", "(", "arg_0", ",", "arg_1", ")", "arg_1", ".", "ack", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This function deal with the neutron notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:\n    \"\"\"\n    arg_2 = arg_0['event_type']\n    arg_3 = neutron_customer_process.get(arg_2)\n    if arg_3 is not None:\n        arg_3(arg_0, arg_1)\n    else:\n        arg_4 = False\n        arg_5 = None\n        for arg_6 in neutron_customer_process_wildcard.keys():\n            if arg_6.match(arg_2):\n                arg_5 = neutron_customer_process_wildcard.get(arg_6)\n                arg_4 = True\n                break\n        if arg_4:\n            arg_5(arg_0, arg_1)\n        else:\n            default_process(arg_0, arg_1)\n    arg_1.ack()", "path": "ternya/process.py", "identifier": "neutron_process", "docstring": "This function deal with the neutron notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:", "docstring_tokens": ["This", "function", "deal", "with", "the", "neutron", "notification", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 254652}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/lib.py#L120-L124", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Register supported hosts", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "pyblish", ".", "api", ".", "Func", "(", "\"mayabatch\"", ")", "pyblish", ".", "api", ".", "Func", "(", "\"mayapy\"", ")", "pyblish", ".", "api", ".", "Func", "(", "\"maya\"", ")"], "function": "def Func():\n    \"\"\"Register supported hosts\"\"\"\n    pyblish.api.Func(\"mayabatch\")\n    pyblish.api.Func(\"mayapy\")\n    pyblish.api.Func(\"maya\")", "path": "pyblish_maya/lib.py", "identifier": "deregister_host", "docstring": "Register supported hosts", "docstring_tokens": ["Register", "supported", "hosts"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 254653}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/code.py#L196-L242", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Generate for loop for static items", "language": "python", "parameters": "(parentUnit, items, bodyFn, name=\"\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"\"", ")", ":", "arg_1", "=", "list", "(", "arg_1", ")", "arg_4", "=", "len", "(", "arg_1", ")", "if", "arg_4", "==", "0", ":", "return", "[", "]", "elif", "arg_4", "==", "1", ":", "return", "arg_2", "(", "arg_1", "[", "0", "]", ",", "0", ")", "else", ":", "arg_5", "=", "arg_0", ".", "_reg", "(", "arg_3", "+", "\"for_index\"", ",", "Bits", "(", "log2ceil", "(", "arg_4", "+", "1", ")", ",", "signed", "=", "False", ")", ",", "defVal", "=", "0", ")", "arg_6", "=", "arg_0", ".", "_sig", "(", "arg_3", "+", "\"for_ack\"", ")", "arg_7", "=", "[", "]", "for", "arg_8", ",", "(", "arg_9", ",", "arg_10", ")", "in", "[", "(", "arg_8", ",", "arg_2", "(", "item", ",", "arg_8", ")", ")", "for", "arg_8", ",", "item", "in", "enumerate", "(", "arg_1", ")", "]", ":", "arg_7", ".", "append", "(", "arg_9", "+", "[", "(", "arg_6", "(", "arg_10", ")", ")", ",", "]", ")", "If", "(", "arg_6", ",", "If", "(", "arg_5", ".", "_eq", "(", "arg_4", "-", "1", ")", ",", "arg_5", "(", "0", ")", ")", ".", "Else", "(", "arg_5", "(", "arg_5", "+", "1", ")", ")", ")", "return", "Switch", "(", "arg_5", ")", ".", "addCases", "(", "enumerate", "(", "arg_7", ")", ")", ".", "Default", "(", "arg_2", "(", "arg_1", "[", "0", "]", ",", "0", ")", "[", "0", "]", ",", "arg_6", "(", "True", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=\"\"):\n    \"\"\"\n    Generate for loop for static items\n\n    :param parentUnit: unit where this code should be instantiated\n    :param items: items which this \"for\" itering on\n    :param bodyFn: function which fn(item, index) or fn(item)\n        returns (statementList, ack).\n        It's content is performed in every iteration.\n        When ack is high loop will fall to next iteration\n    \"\"\"\n\n    arg_1 = list(arg_1)\n    arg_4 = len(arg_1)\n    if arg_4 == 0:\n        # if there are no items there is nothing to generate\n        return []\n    elif arg_4 == 1:\n        # if there is only one item do not generate counter logic generate\n        return arg_2(arg_1[0], 0)\n    else:\n        # if there is multiple items we have to generate counter logic\n        arg_5 = arg_0._reg(arg_3 + \"for_index\",\n                                Bits(log2ceil(arg_4 + 1), signed=False),\n                                defVal=0)\n        arg_6 = arg_0._sig(arg_3 + \"for_ack\")\n\n        arg_7 = []\n        for arg_8, (arg_9, arg_10) in [(arg_8, arg_2(item, arg_8))\n                                        for arg_8, item in enumerate(arg_1)]:\n            arg_7.append(arg_9 + [(arg_6(arg_10)), ])\n\n        If(arg_6,\n           If(arg_5._eq(arg_4 - 1),\n              arg_5(0)\n              ).Else(\n               arg_5(arg_5 + 1)\n           )\n           )\n\n        return Switch(arg_5)\\\n            .addCases(\n            enumerate(arg_7)\n        ).Default(\n            arg_2(arg_1[0], 0)[0],\n            arg_6(True)\n        )", "path": "hwt/code.py", "identifier": "StaticForEach", "docstring": "Generate for loop for static items\n\n    :param parentUnit: unit where this code should be instantiated\n    :param items: items which this \"for\" itering on\n    :param bodyFn: function which fn(item, index) or fn(item)\n        returns (statementList, ack).\n        It's content is performed in every iteration.\n        When ack is high loop will fall to next iteration", "docstring_tokens": ["Generate", "for", "loop", "for", "static", "items"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 254654}
{"url": "https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/colorful/core.py#L354-L361", "sha": "919fa6da17865cc5e01e6b16119193a97d180dc9", "docstring_summary": "Set the colorpalette which should be used", "language": "python", "parameters": "(self, colorpalette)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "if", "isinstance", "(", "Func", ",", "str", ")", ":", "Func", "=", "colors", ".", "parse_colors", "(", "Func", ")", "arg_0", ".", "_colorpalette", "=", "colors", ".", "sanitize_color_palette", "(", "Func", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Set the colorpalette which should be used\n        \"\"\"\n        if isinstance(Func, str):  # we assume it's a path to a color file\n            Func = colors.parse_colors(Func)\n\n        arg_0._colorpalette = colors.sanitize_color_palette(Func)", "path": "colorful/core.py", "identifier": "Colorful.colorpalette", "docstring": "Set the colorpalette which should be used", "docstring_tokens": ["Set", "the", "colorpalette", "which", "should", "be", "used"], "nwo": "timofurrer/colorful", "score": 0.585749501312285, "idx": 254655}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L400-L408", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Converts between 3-letter and 1-letter amino acid codes.", "language": "python", "parameters": "(x)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", "==", "1", ":", "return", "amino_acid_codes", "[", "arg_0", ".", "upper", "(", ")", "]", "elif", "len", "(", "arg_0", ")", "==", "3", ":", "return", "inverse_aa_codes", "[", "arg_0", ".", "upper", "(", ")", "]", "else", ":", "raise", "ValueError", "(", "\"Can only convert 1-letter or 3-letter amino acid codes, \"", "\"not %r\"", "%", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Converts between 3-letter and 1-letter amino acid codes.\"\"\"\n    if len(arg_0) == 1:\n        return amino_acid_codes[arg_0.upper()]\n    elif len(arg_0) == 3:\n        return inverse_aa_codes[arg_0.upper()]\n    else:\n        raise ValueError(\"Can only convert 1-letter or 3-letter amino acid codes, \"\n                         \"not %r\" % arg_0)", "path": "gromacs/utilities.py", "identifier": "convert_aa_code", "docstring": "Converts between 3-letter and 1-letter amino acid codes.", "docstring_tokens": ["Converts", "between", "3", "-", "letter", "and", "1", "-", "letter", "amino", "acid", "codes", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 254656}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/current.py#L139-L162", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Write a notebook to a string in a given format in the current nbformat version.", "language": "python", "parameters": "(nb, format, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_1", "=", "unicode", "(", "arg_1", ")", "if", "arg_1", "==", "u'json'", "or", "arg_1", "==", "u'ipynb'", ":", "return", "Func_json", "(", "arg_0", ",", "**", "arg_2", ")", "elif", "arg_1", "==", "u'py'", ":", "return", "Func_py", "(", "arg_0", ",", "**", "arg_2", ")", "else", ":", "raise", "NBFormatError", "(", "'Unsupported format: %s'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Write a notebook to a string in a given format in the current nbformat version.\n\n    This function always Func the notebook in the current nbformat version.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The notebook to write.\n    format : (u'json', u'ipynb', u'py')\n        The format to write the notebook in.\n\n    Returns\n    -------\n    s : unicode\n        The notebook string.\n    \"\"\"\n    arg_1 = unicode(arg_1)\n    if arg_1 == u'json' or arg_1 == u'ipynb':\n        return Func_json(arg_0, **arg_2)\n    elif arg_1 == u'py':\n        return Func_py(arg_0, **arg_2)\n    else:\n        raise NBFormatError('Unsupported format: %s' % arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/nbformat/current.py", "identifier": "writes", "docstring": "Write a notebook to a string in a given format in the current nbformat version.\n\n    This function always writes the notebook in the current nbformat version.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The notebook to write.\n    format : (u'json', u'ipynb', u'py')\n        The format to write the notebook in.\n\n    Returns\n    -------\n    s : unicode\n        The notebook string.", "docstring_tokens": ["Write", "a", "notebook", "to", "a", "string", "in", "a", "given", "format", "in", "the", "current", "nbformat", "version", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254657}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L644-L659", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Print human readable summary of current AWS state to log and to console.", "language": "python", "parameters": "(self)", "return_statement": "return status_string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "get_instance_state", "(", ")", "arg_1", "=", "\"EC2 Summary:\\n\\tVPC IDs: {}\\n\\tSubnet IDs: \\{}\\n\\tSecurity Group ID: {}\\n\\tRunning Instance IDs: {}\\n\"", ".", "format", "(", "arg_0", ".", "vpc_id", ",", "arg_0", ".", "sn_ids", ",", "arg_0", ".", "sg_id", ",", "arg_0", ".", "instances", ")", "arg_1", "+=", "\"\\tInstance States:\\n\\t\\t\"", "arg_0", ".", "get_instance_state", "(", ")", "for", "arg_2", "in", "arg_0", ".", "instance_states", ".", "keys", "(", ")", ":", "arg_1", "+=", "\"Instance ID: {}  State: {}\\n\\t\\t\"", ".", "format", "(", "arg_2", ",", "arg_0", ".", "instance_states", "[", "arg_2", "]", ")", "arg_1", "+=", "\"\\n\"", "logger", ".", "info", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Print human readable summary of current AWS state to log and to console.\"\"\"\n        arg_0.get_instance_state()\n        arg_1 = \"EC2 Summary:\\n\\tVPC IDs: {}\\n\\tSubnet IDs: \\\n{}\\n\\tSecurity Group ID: {}\\n\\tRunning Instance IDs: {}\\n\".format(\n            arg_0.vpc_id, arg_0.sn_ids, arg_0.sg_id, arg_0.instances\n        )\n        arg_1 += \"\\tInstance States:\\n\\t\\t\"\n        arg_0.get_instance_state()\n        for arg_2 in arg_0.instance_states.keys():\n            arg_1 += \"Instance ID: {}  State: {}\\n\\t\\t\".format(\n                arg_2, arg_0.instance_states[arg_2]\n            )\n        arg_1 += \"\\n\"\n        logger.info(arg_1)\n        return arg_1", "path": "parsl/providers/aws/aws.py", "identifier": "AWSProvider.show_summary", "docstring": "Print human readable summary of current AWS state to log and to console.", "docstring_tokens": ["Print", "human", "readable", "summary", "of", "current", "AWS", "state", "to", "log", "and", "to", "console", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 254658}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/libraries/dagster-gcp/dagster_gcp/types.py#L86-L93", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Datasets must be of form \"project.dataset\" or \"dataset\"", "language": "python", "parameters": "(config_value)", "return_statement": "return re.match(\n        # regex matches: project.table -- OR -- table\n        r'^' + RE_PROJECT + r'\\.' + RE_DS_TABLE + r'$|^' + RE_DS_TABLE + r'$',\n        config_value,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "re", ".", "match", "(", "r'^'", "+", "RE_PROJECT", "+", "r'\\.'", "+", "RE_DS_TABLE", "+", "r'$|^'", "+", "RE_DS_TABLE", "+", "r'$'", ",", "arg_0", ",", ")"], "function": "def Func(arg_0):\n    '''Datasets must be of form \"project.dataset\" or \"dataset\"\n    '''\n    return re.match(\n        # regex matches: project.table -- OR -- table\n        r'^' + RE_PROJECT + r'\\.' + RE_DS_TABLE + r'$|^' + RE_DS_TABLE + r'$',\n        arg_0,\n    )", "path": "python_modules/libraries/dagster-gcp/dagster_gcp/types.py", "identifier": "_is_valid_dataset", "docstring": "Datasets must be of form \"project.dataset\" or \"dataset\"", "docstring_tokens": ["Datasets", "must", "be", "of", "form", "project", ".", "dataset", "or", "dataset"], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 254659}
{"url": "https://github.com/pypa/pep517/blob/ecd511e8fc85251d0496716939ebbe109e395924/pep517/_in_process.py#L201-L207", "sha": "ecd511e8fc85251d0496716939ebbe109e395924", "docstring_summary": "Invoke the mandatory build_sdist hook.", "language": "python", "parameters": "(sdist_directory, config_settings)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_build_backend", "(", ")", "try", ":", "return", "arg_2", ".", "Func", "(", "arg_0", ",", "arg_1", ")", "except", "getattr", "(", "arg_2", ",", "'UnsupportedOperation'", ",", "_DummyException", ")", ":", "raise", "GotUnsupportedOperation", "(", "traceback", ".", "format_exc", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Invoke the mandatory Func hook.\"\"\"\n    arg_2 = _build_backend()\n    try:\n        return arg_2.Func(arg_0, arg_1)\n    except getattr(arg_2, 'UnsupportedOperation', _DummyException):\n        raise GotUnsupportedOperation(traceback.format_exc())", "path": "pep517/_in_process.py", "identifier": "build_sdist", "docstring": "Invoke the mandatory build_sdist hook.", "docstring_tokens": ["Invoke", "the", "mandatory", "build_sdist", "hook", "."], "nwo": "pypa/pep517", "score": 0.5466648575129843, "idx": 254660}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/frame.py#L158-L190", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Run a frame command. This routine is a little complex\n        because we allow a number parameter variations.", "language": "python", "parameters": "(self, args)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "1", ":", "arg_2", "=", "'0'", "elif", "len", "(", "arg_1", ")", "==", "2", ":", "arg_3", "=", "arg_1", "[", "1", "]", "arg_4", ",", "arg_5", "=", "arg_0", ".", "get_from_thread_name_or_id", "(", "arg_3", ",", "False", ")", "if", "arg_4", "is", "None", ":", "arg_2", "=", "arg_3", "else", ":", "arg_2", "=", "'0'", "arg_0", ".", "find_and_set_debugged_frame", "(", "arg_4", ",", "arg_5", ")", "pass", "elif", "len", "(", "arg_1", ")", "==", "3", ":", "arg_3", "=", "arg_1", "[", "1", "]", "arg_2", "=", "arg_1", "[", "2", "]", "arg_4", ",", "arg_5", "=", "arg_0", ".", "get_from_thread_name_or_id", "(", "arg_3", ")", "if", "arg_4", "is", "None", ":", "return", "arg_0", ".", "find_and_set_debugged_frame", "(", "arg_4", ",", "arg_5", ")", "pass", "arg_0", ".", "one_arg_Func", "(", "arg_2", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n        '''Run a frame command. This routine is a little complex\n        because we allow a number parameter variations.'''\n\n        if len(arg_1) == 1:\n            # Form is: \"frame\" which means \"frame 0\"\n            arg_2 = '0'\n        elif len(arg_1) == 2:\n            # Form is: \"frame {position | thread}\n            arg_3 = arg_1[1]\n            arg_4, arg_5 = arg_0.get_from_thread_name_or_id(arg_3,\n                                                               False)\n            if arg_4 is None:\n                # Form should be: frame position\n                arg_2 = arg_3\n            else:\n                # Form should be: \"frame thread\" which means\n                # \"frame thread 0\"\n                arg_2 = '0'\n                arg_0.find_and_set_debugged_frame(arg_4, arg_5)\n                pass\n        elif len(arg_1) == 3:\n            # Form is: frame <thread> <position>\n            arg_3 = arg_1[1]\n            arg_2 = arg_1[2]\n            arg_4, arg_5 = arg_0.get_from_thread_name_or_id(arg_3)\n            if arg_4 is None:\n                # Error message was given in routine\n                return\n            arg_0.find_and_set_debugged_frame(arg_4, arg_5)\n            pass\n        arg_0.one_arg_Func(arg_2)\n        return False", "path": "trepan/processor/command/frame.py", "identifier": "FrameCommand.run", "docstring": "Run a frame command. This routine is a little complex\n        because we allow a number parameter variations.", "docstring_tokens": ["Run", "a", "frame", "command", ".", "This", "routine", "is", "a", "little", "complex", "because", "we", "allow", "a", "number", "parameter", "variations", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 254661}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L125-L131", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "if the value is in the list, move it to the front and return it.", "language": "python", "parameters": "(l,value='other')", "return_statement": "return l", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'other'", ")", ":", "arg_0", "=", "list", "(", "arg_0", ")", "if", "arg_1", "in", "arg_0", ":", "arg_0", ".", "remove", "(", "arg_1", ")", "arg_0", ".", "insert", "(", "0", ",", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0,arg_1='other'):\n    \"\"\"if the value is in the list, move it to the front and return it.\"\"\"\n    arg_0=list(arg_0)\n    if arg_1 in arg_0:\n        arg_0.remove(arg_1)\n        arg_0.insert(0,arg_1)\n    return arg_0", "path": "swhlab/common.py", "identifier": "list_move_to_front", "docstring": "if the value is in the list, move it to the front and return it.", "docstring_tokens": ["if", "the", "value", "is", "in", "the", "list", "move", "it", "to", "the", "front", "and", "return", "it", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 254662}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L575-L584", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Process a LaTeX snippet of content for better transformation\n        with pandoc.", "language": "python", "parameters": "(self, latex_text)", "return_statement": "return latex_text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "CitationLinker", "(", "arg_0", ".", "bib_db", ")", "arg_1", "=", "arg_2", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process a LaTeX snippet of content for better transformation\n        with pandoc.\n\n        Currently runs the CitationLinker to convert BibTeX citations to\n        href links.\n        \"\"\"\n        arg_2 = CitationLinker(arg_0.bib_db)\n        arg_1 = arg_2(arg_1)\n        return arg_1", "path": "lsstprojectmeta/tex/lsstdoc.py", "identifier": "LsstLatexDoc._prep_snippet_for_pandoc", "docstring": "Process a LaTeX snippet of content for better transformation\n        with pandoc.\n\n        Currently runs the CitationLinker to convert BibTeX citations to\n        href links.", "docstring_tokens": ["Process", "a", "LaTeX", "snippet", "of", "content", "for", "better", "transformation", "with", "pandoc", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 254663}
{"url": "https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/compat.py#L5-L15", "sha": "50bf2e047b698e308a9a88770a23e7e210aa5bcb", "docstring_summary": "Python 2 uses a deprecated method signature and doesn't provide the\n\tforward compatibility.\n\tAdd it.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "six", ".", "PY3", ":", "return", "arg_0", ".", "HTTPMessage", ".", "get_content_type", "=", "arg_0", ".", "HTTPMessage", ".", "gettype", "arg_0", ".", "HTTPMessage", ".", "get_param", "=", "arg_0", ".", "HTTPMessage", ".", "getparam"], "function": "def Func():\n\t\"\"\"\n\tPython 2 uses a deprecated method signature and doesn't provide the\n\tforward compatibility.\n\tAdd it.\n\t\"\"\"\n\tif six.PY3:\n\t\treturn\n\n\targ_0.HTTPMessage.get_content_type = arg_0.HTTPMessage.gettype\n\targ_0.HTTPMessage.get_param = arg_0.HTTPMessage.getparam", "path": "wolframalpha/compat.py", "identifier": "fix_HTTPMessage", "docstring": "Python 2 uses a deprecated method signature and doesn't provide the\n\tforward compatibility.\n\tAdd it.", "docstring_tokens": ["Python", "2", "uses", "a", "deprecated", "method", "signature", "and", "doesn", "t", "provide", "the", "forward", "compatibility", ".", "Add", "it", "."], "nwo": "jaraco/wolframalpha", "score": 0.3658617949980371, "idx": 254664}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L118-L141", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert tanh layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting tanh ...'", ")", "if", "arg_6", "==", "'short'", ":", "arg_7", "=", "'TANH'", "+", "random_string", "(", "4", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_8", "=", "keras", ".", "layers", ".", "Activation", "(", "'tanh'", ",", "name", "=", "arg_7", ")", "arg_4", "[", "arg_2", "]", "=", "arg_8", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert tanh layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting tanh ...')\n\n    if arg_6 == 'short':\n        arg_7 = 'TANH' + random_string(4)\n    elif arg_6 == 'keep':\n        arg_7 = arg_1\n    else:\n        arg_7 = arg_1 + str(random.random())\n\n    arg_8 = keras.layers.Activation('tanh', name=arg_7)\n    arg_4[arg_2] = arg_8(arg_4[arg_3[0]])", "path": "pytorch2keras/activation_layers.py", "identifier": "convert_tanh", "docstring": "Convert tanh layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "tanh", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 254665}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/cli.py#L140-L175", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Copy all files from all storages of a project.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_setup_osf", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "project", "(", "arg_0", ".", "project", ")", "arg_3", "=", "arg_0", ".", "project", "if", "arg_0", ".", "output", "is", "not", "None", ":", "arg_3", "=", "arg_0", ".", "output", "with", "tqdm", "(", "unit", "=", "'files'", ")", "as", "pbar", ":", "for", "arg_4", "in", "arg_2", ".", "storages", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_4", ".", "name", ")", "for", "arg_6", "in", "arg_4", ".", "files", ":", "arg_7", "=", "arg_6", ".", "path", "if", "arg_7", ".", "startswith", "(", "'/'", ")", ":", "arg_7", "=", "arg_7", "[", "1", ":", "]", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_5", ",", "arg_7", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_7", ")", "and", "arg_0", ".", "update", ":", "if", "checksum", "(", "arg_7", ")", "==", "arg_6", ".", "hashes", ".", "get", "(", "'md5'", ")", ":", "continue", "arg_8", ",", "arg_9", "=", "os", ".", "path", ".", "split", "(", "arg_7", ")", "makedirs", "(", "arg_8", ",", "exist_ok", "=", "True", ")", "with", "open", "(", "arg_7", ",", "\"wb\"", ")", "as", "f", ":", "arg_6", ".", "write_to", "(", "f", ")", "pbar", ".", "update", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Copy all files from all storages of a project.\n\n    The output directory defaults to the current directory.\n\n    If the project is private you need to specify a username.\n\n    If args.update is True, overwrite any existing local files only if local and\n    remote files differ.\n    \"\"\"\n    arg_1 = _setup_osf(arg_0)\n    arg_2 = arg_1.project(arg_0.project)\n    arg_3 = arg_0.project\n    if arg_0.output is not None:\n        arg_3 = arg_0.output\n\n    with tqdm(unit='files') as pbar:\n        for arg_4 in arg_2.storages:\n            arg_5 = os.path.join(arg_3, arg_4.name)\n\n            for arg_6 in arg_4.files:\n                arg_7 = arg_6.path\n                if arg_7.startswith('/'):\n                    arg_7 = arg_7[1:]\n\n                arg_7 = os.path.join(arg_5, arg_7)\n                if os.path.exists(arg_7) and arg_0.update:\n                    if checksum(arg_7) == arg_6.hashes.get('md5'):\n                        continue\n                arg_8, arg_9 = os.path.split(arg_7)\n                makedirs(arg_8, exist_ok=True)\n\n                with open(arg_7, \"wb\") as f:\n                    arg_6.write_to(f)\n\n                pbar.update()", "path": "osfclient/cli.py", "identifier": "clone", "docstring": "Copy all files from all storages of a project.\n\n    The output directory defaults to the current directory.\n\n    If the project is private you need to specify a username.\n\n    If args.update is True, overwrite any existing local files only if local and\n    remote files differ.", "docstring_tokens": ["Copy", "all", "files", "from", "all", "storages", "of", "a", "project", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 254666}
{"url": "https://github.com/mikeboers/PyAV/blob/9414187088b9b8dbaa180cfe1db6ceba243184ea/docs/includes.py#L123-L131", "sha": "9414187088b9b8dbaa180cfe1db6ceba243184ea", "docstring_summary": "Yield all ``.pyx`` and ``.pxd`` files in the given root.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "os", ".", "walk", "(", "arg_0", ")", ":", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "startswith", "(", "'.'", ")", ":", "continue", "if", "os", ".", "path", ".", "splitext", "(", "arg_4", ")", "[", "1", "]", "not", "in", "(", "'.pyx'", ",", "'.pxd'", ")", ":", "continue", "yield", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")"], "function": "def Func(arg_0):\n    '''Yield all ``.pyx`` and ``.pxd`` files in the given root.'''\n    for arg_1, arg_2, arg_3 in os.walk(arg_0):\n        for arg_4 in arg_3:\n            if arg_4.startswith('.'):\n                continue\n            if os.path.splitext(arg_4)[1] not in ('.pyx', '.pxd'):\n                continue\n            yield os.path.join(arg_1, arg_4)", "path": "docs/includes.py", "identifier": "iter_cython", "docstring": "Yield all ``.pyx`` and ``.pxd`` files in the given root.", "docstring_tokens": ["Yield", "all", ".", "pyx", "and", ".", "pxd", "files", "in", "the", "given", "root", "."], "nwo": "mikeboers/PyAV", "score": 0.7842860952082583, "idx": 254667}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L78-L93", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return all available input formats.", "language": "python", "parameters": "()", "return_statement": "return input_formats", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "]", "for", "arg_1", "in", "pkg_resources", ".", "iter_entry_points", "(", "DRIVERS_ENTRY_POINT", ")", ":", "logger", ".", "debug", "(", "\"driver found: %s\"", ",", "arg_1", ")", "arg_2", "=", "arg_1", ".", "load", "(", ")", "if", "hasattr", "(", "arg_2", ",", "\"METADATA\"", ")", "and", "(", "arg_2", ".", "METADATA", "[", "\"mode\"", "]", "in", "[", "\"r\"", ",", "\"rw\"", "]", ")", ":", "arg_0", ".", "append", "(", "arg_2", ".", "METADATA", "[", "\"driver_name\"", "]", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n    Return all available input formats.\n\n    Returns\n    -------\n    formats : list\n        all available input formats\n    \"\"\"\n    arg_0 = []\n    for arg_1 in pkg_resources.iter_entry_points(DRIVERS_ENTRY_POINT):\n        logger.debug(\"driver found: %s\", arg_1)\n        arg_2 = arg_1.load()\n        if hasattr(arg_2, \"METADATA\") and (arg_2.METADATA[\"mode\"] in [\"r\", \"rw\"]):\n            arg_0.append(arg_2.METADATA[\"driver_name\"])\n    return arg_0", "path": "mapchete/formats/__init__.py", "identifier": "available_input_formats", "docstring": "Return all available input formats.\n\n    Returns\n    -------\n    formats : list\n        all available input formats", "docstring_tokens": ["Return", "all", "available", "input", "formats", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 254668}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/aio/async_receive_handler.py#L625-L667", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Receive messages that have previously been deferred.", "language": "python", "parameters": "(self, sequence_numbers, mode=ReceiveSettleMode.PeekLock)", "return_statement": "return messages", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "PeekLock", ")", ":", "if", "not", "arg_1", ":", "raise", "ValueError", "(", "\"At least one sequence number must be specified.\"", ")", "await", "arg_0", ".", "_can_run", "(", ")", "try", ":", "arg_5", "=", "arg_2", ".", "value", ".", "value", "except", "AttributeError", ":", "arg_5", "=", "int", "(", "arg_2", ")", "arg_6", "=", "{", "'sequence-numbers'", ":", "types", ".", "AMQPArray", "(", "[", "types", ".", "AMQPLong", "(", "s", ")", "for", "s", "in", "arg_1", "]", ")", ",", "'receiver-settle-mode'", ":", "types", ".", "AMQPuInt", "(", "arg_5", ")", ",", "'session-id'", ":", "arg_0", ".", "session_id", "}", "arg_7", "=", "functools", ".", "partial", "(", "mgmt_handlers", ".", "deferred_message_op", ",", "arg_2", "=", "arg_5", ",", "message_type", "=", "DeferredMessage", ")", "arg_8", "=", "await", "arg_0", ".", "_mgmt_request_response", "(", "REQUEST_RESPONSE_RECEIVE_BY_SEQUENCE_NUMBER", ",", "arg_6", ",", "arg_7", ")", "for", "arg_9", "in", "arg_8", ":", "arg_9", ".", "_receiver", "=", "arg_0", "return", "arg_8"], "function": "async def Func(arg_0, arg_1, arg_2=arg_3.PeekLock):\n        \"\"\"Receive messages that have previously been deferred.\n\n        This operation can only receive deferred messages from the current session.\n        When receiving deferred messages from a partitioned entity, all of the supplied\n        sequence numbers must be messages from the same partition.\n\n        :param sequence_numbers: A list of the sequence numbers of messages that have been\n         deferred.\n        :type sequence_numbers: list[int]\n        :param mode: The receive mode, default value is PeekLock.\n        :type mode: ~azure.servicebus.common.constants.ReceiveSettleMode\n        :rtype: list[~azure.servicebus.aio.async_message.DeferredMessage]\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START receiver_defer_session_messages]\n                :end-before: [END receiver_defer_session_messages]\n                :language: python\n                :dedent: 8\n                :caption: Defer messages, then retrieve them by sequence number.\n\n        \"\"\"\n        if not arg_1:\n            raise ValueError(\"At least one sequence number must be specified.\")\n        await arg_0._can_run()\n        try:\n            arg_5 = arg_2.value.value\n        except AttributeError:\n            arg_5 = int(arg_2)\n        arg_6 = {\n            'sequence-numbers': types.AMQPArray([types.AMQPLong(s) for s in arg_1]),\n            'receiver-settle-mode': types.AMQPuInt(arg_5),\n            'session-id': arg_0.session_id\n        }\n        arg_7 = functools.partial(mgmt_handlers.deferred_message_op, arg_2=arg_5, message_type=DeferredMessage)\n        arg_8 = await arg_0._mgmt_request_response(\n            REQUEST_RESPONSE_RECEIVE_BY_SEQUENCE_NUMBER,\n            arg_6,\n            arg_7)\n        for arg_9 in arg_8:\n            arg_9._receiver = arg_0  # pylint: disable=protected-access\n        return arg_8", "path": "azure-servicebus/azure/servicebus/aio/async_receive_handler.py", "identifier": "SessionReceiver.receive_deferred_messages", "docstring": "Receive messages that have previously been deferred.\n\n        This operation can only receive deferred messages from the current session.\n        When receiving deferred messages from a partitioned entity, all of the supplied\n        sequence numbers must be messages from the same partition.\n\n        :param sequence_numbers: A list of the sequence numbers of messages that have been\n         deferred.\n        :type sequence_numbers: list[int]\n        :param mode: The receive mode, default value is PeekLock.\n        :type mode: ~azure.servicebus.common.constants.ReceiveSettleMode\n        :rtype: list[~azure.servicebus.aio.async_message.DeferredMessage]\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START receiver_defer_session_messages]\n                :end-before: [END receiver_defer_session_messages]\n                :language: python\n                :dedent: 8\n                :caption: Defer messages, then retrieve them by sequence number.", "docstring_tokens": ["Receive", "messages", "that", "have", "previously", "been", "deferred", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254669}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/payload.py#L52-L59", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This dark magic is used to make yaml.safe_load encode all strings as utf-8,\n    where otherwise python unicode strings would be returned for non-ascii chars", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "def", "utf_encoding_string_constructor", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "construct_scalar", "(", "arg_1", ")", ".", "encode", "(", "'utf-8'", ")", "yaml", ".", "SafeLoader", ".", "add_constructor", "(", "u'tag:yaml.org,2002:str'", ",", "utf_encoding_string_constructor", ")"], "function": "def Func():\n    \"\"\"\n    This dark magic is used to make yaml.safe_load encode all strings as utf-8,\n    where otherwise python unicode strings would be returned for non-ascii chars\n    \"\"\"\n    def utf_encoding_string_constructor(arg_0, arg_1):\n        return arg_0.construct_scalar(arg_1).encode('utf-8')\n    yaml.SafeLoader.add_constructor(u'tag:yaml.org,2002:str', utf_encoding_string_constructor)", "path": "dusty/payload.py", "identifier": "init_yaml_constructor", "docstring": "This dark magic is used to make yaml.safe_load encode all strings as utf-8,\n    where otherwise python unicode strings would be returned for non-ascii chars", "docstring_tokens": ["This", "dark", "magic", "is", "used", "to", "make", "yaml", ".", "safe_load", "encode", "all", "strings", "as", "utf", "-", "8", "where", "otherwise", "python", "unicode", "strings", "would", "be", "returned", "for", "non", "-", "ascii", "chars"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 254670}
{"url": "https://github.com/fcvarela/pyremotezip/blob/52cc885b2ed1e690d92d3b41fef7a1a3fcc2b509/pyremotezip/remotezip.py#L86-L136", "sha": "52cc885b2ed1e690d92d3b41fef7a1a3fcc2b509", "docstring_summary": "This function populates the internal tableOfContents list with the contents\n        of the zip file TOC. If the server does not support ranged requests, this will raise\n        and exception. It will also throw an exception if the TOC cannot be found.", "language": "python", "parameters": "(self)", "return_statement": "return tableOfContents", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "directory_size", "=", "arg_0", ".", "getDirectorySize", "(", ")", "if", "arg_0", ".", "directory_size", ">", "65536", ":", "arg_0", ".", "directory_size", "+=", "2", "arg_0", ".", "requestContentDirectory", "(", ")", "arg_2", "=", "unpack", "(", "\"i\"", ",", "arg_0", ".", "raw_bytes", "[", "arg_0", ".", "directory_end", "+", "16", ":", "arg_0", ".", "directory_end", "+", "20", "]", ")", "[", "0", "]", "arg_0", ".", "raw_bytes", "=", "arg_0", ".", "raw_bytes", "arg_4", "=", "arg_2", "-", "arg_0", ".", "start", "arg_5", "=", "0", "arg_6", "=", "0", "arg_7", "=", "[", "]", "try", ":", "while", "True", ":", "arg_8", "=", "unpack", "(", "\"H\"", ",", "arg_0", ".", "raw_bytes", "[", "arg_4", "+", "28", ":", "arg_4", "+", "28", "+", "2", "]", ")", "[", "0", "]", "arg_9", "=", "unpack", "(", "\"H\"", ",", "arg_0", ".", "raw_bytes", "[", "arg_4", "+", "30", ":", "arg_4", "+", "30", "+", "2", "]", ")", "[", "0", "]", "arg_10", "=", "unpack", "(", "\"H\"", ",", "arg_0", ".", "raw_bytes", "[", "arg_4", "+", "32", ":", "arg_4", "+", "32", "+", "2", "]", ")", "[", "0", "]", "arg_11", "=", "arg_0", ".", "raw_bytes", "[", "arg_4", "+", "46", ":", "arg_4", "+", "46", "+", "arg_8", "]", "arg_5", "=", "unpack", "(", "\"I\"", ",", "arg_0", ".", "raw_bytes", "[", "arg_4", "+", "42", ":", "arg_4", "+", "42", "+", "4", "]", ")", "[", "0", "]", "arg_6", "=", "unpack", "(", "\"I\"", ",", "arg_0", ".", "raw_bytes", "[", "arg_4", "+", "20", ":", "arg_4", "+", "20", "+", "4", "]", ")", "[", "0", "]", "arg_12", "=", "unpack", "(", "\"I\"", ",", "arg_0", ".", "raw_bytes", "[", "arg_4", "+", "24", ":", "arg_4", "+", "24", "+", "4", "]", ")", "[", "0", "]", "arg_13", "=", "{", "'filename'", ":", "arg_11", ",", "'compressedsize'", ":", "arg_6", ",", "'uncompressedsize'", ":", "arg_12", ",", "'filestart'", ":", "arg_5", "}", "arg_7", ".", "append", "(", "arg_13", ")", "arg_4", "=", "arg_4", "+", "46", "+", "arg_8", "+", "arg_9", "+", "arg_10", "except", ":", "pass", "arg_0", ".", "tableOfContents", "=", "arg_7", "return", "arg_7"], "function": "def Func(arg_0):\n        \"\"\"\n        This function populates the internal tableOfContents list with the contents\n        of the zip file TOC. If the server does not support ranged requests, this will raise\n        and exception. It will also throw an exception if the TOC cannot be found.\n        \"\"\"\n\n        arg_0.directory_size = arg_0.getDirectorySize()\n        if arg_0.directory_size > 65536:\n            arg_0.directory_size += 2\n            arg_0.requestContentDirectory()\n\n\n        # and find the offset from start of file where it can be found\n        arg_2 = unpack(\"i\", arg_0.raw_bytes[arg_0.directory_end + 16: arg_0.directory_end + 20])[0]\n\n        # find the data in the raw_bytes\n        arg_0.raw_bytes = arg_0.raw_bytes\n        arg_4 = arg_2 - arg_0.start\n        arg_5 = 0\n        arg_6 = 0\n        arg_7 = []\n\n        try:\n            while True:\n                # get file name size (n), extra len (m) and comm len (k)\n                arg_8 = unpack(\"H\", arg_0.raw_bytes[arg_4 + 28: arg_4 + 28 + 2])[0]\n                arg_9 = unpack(\"H\", arg_0.raw_bytes[arg_4 + 30: arg_4 + 30 + 2])[0]\n                arg_10 = unpack(\"H\", arg_0.raw_bytes[arg_4 + 32: arg_4 + 32 + 2])[0]\n\n                arg_11 = arg_0.raw_bytes[arg_4 + 46: arg_4 + 46 + arg_8]\n\n                # check if this is the index file\n                arg_5 = unpack(\"I\", arg_0.raw_bytes[arg_4 + 42: arg_4 + 42 + 4])[0]\n                arg_6 = unpack(\"I\", arg_0.raw_bytes[arg_4 + 20: arg_4 + 20 + 4])[0]\n                arg_12 = unpack(\"I\", arg_0.raw_bytes[arg_4 + 24: arg_4 + 24 + 4])[0]\n                arg_13 = {\n                    'filename': arg_11,\n                    'compressedsize': arg_6,\n                    'uncompressedsize': arg_12,\n                    'filestart': arg_5\n                }\n                arg_7.append(arg_13)\n\n                # not this file, move along\n                arg_4 = arg_4 + 46 + arg_8 + arg_9 + arg_10\n        except:\n            pass\n\n        arg_0.tableOfContents = arg_7\n        return arg_7", "path": "pyremotezip/remotezip.py", "identifier": "RemoteZip.getTableOfContents", "docstring": "This function populates the internal tableOfContents list with the contents\n        of the zip file TOC. If the server does not support ranged requests, this will raise\n        and exception. It will also throw an exception if the TOC cannot be found.", "docstring_tokens": ["This", "function", "populates", "the", "internal", "tableOfContents", "list", "with", "the", "contents", "of", "the", "zip", "file", "TOC", ".", "If", "the", "server", "does", "not", "support", "ranged", "requests", "this", "will", "raise", "and", "exception", ".", "It", "will", "also", "throw", "an", "exception", "if", "the", "TOC", "cannot", "be", "found", "."], "nwo": "fcvarela/pyremotezip", "score": 0.18489352766931721, "idx": 254671}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/application/briefkasten/dropbox.py#L335-L339", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "creates an encrypted archive of the dropbox outside of the drop directory.", "language": "python", "parameters": "(self)", "return_statement": "return self._create_encrypted_zip(source='clean', fs_target_dir=self.container.fs_archive_cleansed)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "status", "=", "u'270 creating final encrypted backup of cleansed attachments'", "return", "arg_0", ".", "_create_encrypted_zip", "(", "source", "=", "'clean'", ",", "fs_target_dir", "=", "arg_0", ".", "container", ".", "fs_archive_cleansed", ")"], "function": "def Func(arg_0):\n        \"\"\" creates an encrypted archive of the dropbox outside of the drop directory.\n        \"\"\"\n        arg_0.status = u'270 creating final encrypted backup of cleansed attachments'\n        return arg_0._create_encrypted_zip(source='clean', fs_target_dir=arg_0.container.fs_archive_cleansed)", "path": "application/briefkasten/dropbox.py", "identifier": "Dropbox._create_archive", "docstring": "creates an encrypted archive of the dropbox outside of the drop directory.", "docstring_tokens": ["creates", "an", "encrypted", "archive", "of", "the", "dropbox", "outside", "of", "the", "drop", "directory", "."], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 254672}
{"url": "https://github.com/ghcollin/multitables/blob/9654a45800289a20e66d2b0e0666149f0d370f93/multitables.py#L453-L461", "sha": "9654a45800289a20e66d2b0e0666149f0d370f93", "docstring_summary": "Get the remainder elements. These elements will not be read in the direct queue access cyclic=False mode.", "language": "python", "parameters": "(self, path, block_size)", "return_statement": "return self.__get_batch(path, length=block_size, last=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "__get_batch", "(", "arg_1", ",", "length", "=", "arg_2", ",", "last", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get the remainder elements. These elements will not be read in the direct queue access cyclic=False mode.\n\n        :param path: The HDF5 path to the dataset to be read.\n        :param block_size: The block size is used to calculate which elements will remain.\n        :return: A copy of the remainder elements as a numpy array.\n        \"\"\"\n        return arg_0.__get_batch(arg_1, length=arg_2, last=True)", "path": "multitables.py", "identifier": "Streamer.get_remainder", "docstring": "Get the remainder elements. These elements will not be read in the direct queue access cyclic=False mode.\n\n        :param path: The HDF5 path to the dataset to be read.\n        :param block_size: The block size is used to calculate which elements will remain.\n        :return: A copy of the remainder elements as a numpy array.", "docstring_tokens": ["Get", "the", "remainder", "elements", ".", "These", "elements", "will", "not", "be", "read", "in", "the", "direct", "queue", "access", "cyclic", "=", "False", "mode", "."], "nwo": "ghcollin/multitables", "score": 0.18892572326127263, "idx": 254673}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L503-L524", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Returns `value` in a format parseable by `parse_value`, or `None`.", "language": "python", "parameters": "(value)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "repr", "(", "arg_0", ")", "try", ":", "if", "parse_value", "(", "arg_1", ")", "==", "arg_0", ":", "return", "arg_1", "except", "SyntaxError", ":", "pass", "return", "None"], "function": "def Func(arg_0):\n  \"\"\"Returns `value` in a format parseable by `parse_value`, or `None`.\n\n  Simply put, This function ensures that when it returns a string value, the\n  following will hold:\n\n      parse_value(Func(value)) == value\n\n  Args:\n    value: The value to format.\n\n  Returns:\n    A string representation of `value` when `value` is literally representable,\n    or `None`.\n  \"\"\"\n  arg_1 = repr(arg_0)\n  try:\n    if parse_value(arg_1) == arg_0:\n      return arg_1\n  except SyntaxError:\n    pass\n  return None", "path": "gin/config.py", "identifier": "_format_value", "docstring": "Returns `value` in a format parseable by `parse_value`, or `None`.\n\n  Simply put, This function ensures that when it returns a string value, the\n  following will hold:\n\n      parse_value(_format_value(value)) == value\n\n  Args:\n    value: The value to format.\n\n  Returns:\n    A string representation of `value` when `value` is literally representable,\n    or `None`.", "docstring_tokens": ["Returns", "value", "in", "a", "format", "parseable", "by", "parse_value", "or", "None", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 254674}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/digest_md5.py#L123-L152", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Compute DIGEST-MD5 response value.", "language": "python", "parameters": "(urp_hash, nonce, cnonce, nonce_count, authzid,\n                                                                    digest_uri)", "return_statement": "return b2a_hex(_kd_value(b2a_hex(_h_value(a1)), b\":\".join((\n            nonce, nonce_count, cnonce, b\"auth\", b2a_hex(_h_value(a2))))))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "logger", ".", "debug", "(", "\"Func{0!r}\"", ".", "format", "(", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ")", ")", "if", "arg_4", ":", "arg_6", "=", "b\":\"", ".", "join", "(", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_4", ")", ")", "else", ":", "arg_6", "=", "b\":\"", ".", "join", "(", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", "arg_7", "=", "b\"AUTHENTICATE:\"", "+", "arg_5", "return", "b2a_hex", "(", "_kd_value", "(", "b2a_hex", "(", "_h_value", "(", "arg_6", ")", ")", ",", "b\":\"", ".", "join", "(", "(", "arg_1", ",", "arg_3", ",", "arg_2", ",", "b\"auth\"", ",", "b2a_hex", "(", "_h_value", "(", "arg_7", ")", ")", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                                                                    arg_5):\n    \"\"\"Compute DIGEST-MD5 response value.\n\n    :Parameters:\n        - `urp_hash`: MD5 sum of username:realm:password.\n        - `nonce`: nonce value from a server challenge.\n        - `cnonce`: cnonce value from the client response.\n        - `nonce_count`: nonce count value.\n        - `authzid`: authorization id.\n        - `digest_uri`: digest-uri value.\n    :Types:\n        - `urp_hash`: `bytes`\n        - `nonce`: `bytes`\n        - `nonce_count`: `int`\n        - `authzid`: `bytes`\n        - `digest_uri`: `bytes`\n\n    :return: the computed response value.\n    :returntype: `bytes`\"\"\"\n    # pylint: disable-msg=C0103,R0913\n    logger.debug(\"Func{0!r}\".format((arg_0, arg_1, arg_2,\n                                            arg_3, arg_4,arg_5)))\n    if arg_4:\n        arg_6 = b\":\".join((arg_0, arg_1, arg_2, arg_4))\n    else:\n        arg_6 = b\":\".join((arg_0, arg_1, arg_2))\n    arg_7 = b\"AUTHENTICATE:\" + arg_5\n    return b2a_hex(_kd_value(b2a_hex(_h_value(arg_6)), b\":\".join((\n            arg_1, arg_3, arg_2, b\"auth\", b2a_hex(_h_value(arg_7))))))", "path": "pyxmpp2/sasl/digest_md5.py", "identifier": "_compute_response", "docstring": "Compute DIGEST-MD5 response value.\n\n    :Parameters:\n        - `urp_hash`: MD5 sum of username:realm:password.\n        - `nonce`: nonce value from a server challenge.\n        - `cnonce`: cnonce value from the client response.\n        - `nonce_count`: nonce count value.\n        - `authzid`: authorization id.\n        - `digest_uri`: digest-uri value.\n    :Types:\n        - `urp_hash`: `bytes`\n        - `nonce`: `bytes`\n        - `nonce_count`: `int`\n        - `authzid`: `bytes`\n        - `digest_uri`: `bytes`\n\n    :return: the computed response value.\n    :returntype: `bytes`", "docstring_tokens": ["Compute", "DIGEST", "-", "MD5", "response", "value", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 254675}
{"url": "https://github.com/playpauseandstop/bootstrapper/blob/b216a05f2acb0b9f4919c4e010ff7b0f63fc1393/bootstrapper.py#L111-L152", "sha": "b216a05f2acb0b9f4919c4e010ff7b0f63fc1393", "docstring_summary": "Create virtual environment.", "language": "python", "parameters": "(env, args, recreate=False, ignore_activated=False, quiet=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "None", "arg_6", "=", "True", "arg_7", "=", "hasattr", "(", "sys", ",", "'real_prefix'", ")", "or", "os", ".", "environ", ".", "get", "(", "'VIRTUAL_ENV'", ")", "arg_8", "=", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", "if", "not", "arg_4", ":", "print_message", "(", "'== Step 1. Create virtual environment =='", ")", "if", "(", "arg_2", "or", "(", "not", "arg_7", "and", "not", "arg_8", ")", ")", "or", "(", "arg_3", "and", "not", "arg_8", ")", ":", "arg_5", "=", "(", "'virtualenv'", ",", ")", "+", "arg_1", "+", "(", "arg_0", ",", ")", "if", "not", "arg_5", "and", "not", "arg_4", ":", "if", "arg_7", ":", "arg_9", "=", "'Working inside of virtual environment, done...'", "else", ":", "arg_9", "=", "'Virtual environment {0!r} already created, done...'", "print_message", "(", "arg_9", ".", "format", "(", "arg_0", ")", ")", "if", "arg_5", ":", "with", "disable_error_handler", "(", ")", ":", "arg_6", "=", "not", "run_cmd", "(", "arg_5", ",", "echo", "=", "not", "arg_4", ")", "if", "not", "arg_4", ":", "print_message", "(", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False, arg_4=False):\n    \"\"\"Create virtual environment.\n\n    :param env: Virtual environment name.\n    :param args: Pass given arguments to ``virtualenv`` script.\n    :param recerate: Recreate virtual environment? By default: False\n    :param ignore_activated:\n        Ignore already activated virtual environment and create new one. By\n        default: False\n    :param quiet: Do not output messages into terminal. By default: False\n    \"\"\"\n    arg_5 = None\n    arg_6 = True\n\n    arg_7 = hasattr(sys, 'real_prefix') or os.environ.get('VIRTUAL_ENV')\n    arg_8 = os.path.isdir(arg_0)\n\n    if not arg_4:\n        print_message('== Step 1. Create virtual environment ==')\n\n    if (\n        arg_2 or (not arg_7 and not arg_8)\n    ) or (\n        arg_3 and not arg_8\n    ):\n        arg_5 = ('virtualenv', ) + arg_1 + (arg_0, )\n\n    if not arg_5 and not arg_4:\n        if arg_7:\n            arg_9 = 'Working inside of virtual environment, done...'\n        else:\n            arg_9 = 'Virtual environment {0!r} already created, done...'\n        print_message(arg_9.format(arg_0))\n\n    if arg_5:\n        with disable_error_handler():\n            arg_6 = not run_cmd(arg_5, echo=not arg_4)\n\n    if not arg_4:\n        print_message()\n\n    return arg_6", "path": "bootstrapper.py", "identifier": "create_env", "docstring": "Create virtual environment.\n\n    :param env: Virtual environment name.\n    :param args: Pass given arguments to ``virtualenv`` script.\n    :param recerate: Recreate virtual environment? By default: False\n    :param ignore_activated:\n        Ignore already activated virtual environment and create new one. By\n        default: False\n    :param quiet: Do not output messages into terminal. By default: False", "docstring_tokens": ["Create", "virtual", "environment", "."], "nwo": "playpauseandstop/bootstrapper", "score": 0.17697123869542528, "idx": 254676}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/loaders/base.py#L51-L59", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Find the last occurance of the file in finders", "language": "python", "parameters": "(self, path, finders)", "return_statement": "return found_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "None", "for", "arg_4", "in", "arg_2", ":", "arg_5", "=", "arg_4", ".", "find", "(", "arg_1", ")", "if", "arg_5", ":", "arg_3", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\r\n        \"\"\"Find the last occurance of the file in finders\"\"\"\r\n        arg_3 = None\r\n        for arg_4 in arg_2:\r\n            arg_5 = arg_4.find(arg_1)\r\n            if arg_5:\r\n                arg_3 = arg_5\r\n\r\n        return arg_3", "path": "demosys/loaders/base.py", "identifier": "BaseLoader._find_last_of", "docstring": "Find the last occurance of the file in finders", "docstring_tokens": ["Find", "the", "last", "occurance", "of", "the", "file", "in", "finders"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 254677}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_cosmos_hook.py#L171-L179", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Deletes an existing collection in the CosmosDB database.", "language": "python", "parameters": "(self, collection_name, database_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "AirflowBadRequest", "(", "\"Collection name cannot be None.\"", ")", "arg_0", ".", "get_conn", "(", ")", ".", "DeleteContainer", "(", "get_collection_link", "(", "arg_0", ".", "__get_database_name", "(", "arg_2", ")", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Deletes an existing collection in the CosmosDB database.\n        \"\"\"\n        if arg_1 is None:\n            raise AirflowBadRequest(\"Collection name cannot be None.\")\n\n        arg_0.get_conn().DeleteContainer(\n            get_collection_link(arg_0.__get_database_name(arg_2), arg_1))", "path": "airflow/contrib/hooks/azure_cosmos_hook.py", "identifier": "AzureCosmosDBHook.delete_collection", "docstring": "Deletes an existing collection in the CosmosDB database.", "docstring_tokens": ["Deletes", "an", "existing", "collection", "in", "the", "CosmosDB", "database", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254678}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L257-L288", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get object properties.", "language": "python", "parameters": "(self, window_name, object_name)", "return_statement": "return props", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "_get_object_map", "(", "arg_1", ",", "arg_2", ",", "wait_for_object", "=", "False", ")", "except", "atomac", ".", "_a11y", ".", "ErrorInvalidUIElement", ":", "arg_0", ".", "_windows", "=", "{", "}", "arg_3", "=", "arg_0", ".", "_get_object_map", "(", "arg_1", ",", "arg_2", ",", "wait_for_object", "=", "False", ")", "arg_5", "=", "[", "]", "if", "arg_3", ":", "for", "arg_6", "in", "arg_3", ".", "keys", "(", ")", ":", "if", "not", "arg_3", "[", "arg_6", "]", "or", "arg_6", "==", "\"obj\"", ":", "continue", "arg_5", ".", "append", "(", "arg_6", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get object properties.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: list of properties\n        @rtype: list\n        \"\"\"\n        try:\n            arg_3 = arg_0._get_object_map(arg_1, arg_2,\n                                            wait_for_object=False)\n        except atomac._a11y.ErrorInvalidUIElement:\n            # During the test, when the window closed and reopened\n            # ErrorInvalidUIElement exception will be thrown\n            arg_0._windows = {}\n            # Call the method again, after updating apps\n            arg_3 = arg_0._get_object_map(arg_1, arg_2,\n                                            wait_for_object=False)\n        arg_5 = []\n        if arg_3:\n            for arg_6 in arg_3.keys():\n                if not arg_3[arg_6] or arg_6 == \"obj\":\n                    # Don't add object handle to the list\n                    continue\n                arg_5.append(arg_6)\n        return arg_5", "path": "atomac/ldtpd/core.py", "identifier": "Core.getobjectinfo", "docstring": "Get object properties.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: list of properties\n        @rtype: list", "docstring_tokens": ["Get", "object", "properties", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 254679}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py#L1301-L1336", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Perform a raw query on the task record database.", "language": "python", "parameters": "(self, client_id, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", "[", "'content'", "]", "arg_4", "=", "arg_3", ".", "get", "(", "'query'", ",", "{", "}", ")", "arg_5", "=", "arg_3", ".", "get", "(", "'keys'", ",", "None", ")", "arg_6", "=", "[", "]", "arg_7", "=", "list", "(", ")", "try", ":", "arg_8", "=", "arg_0", ".", "db", ".", "find_records", "(", "arg_4", ",", "arg_5", ")", "except", "Exception", "as", "e", ":", "arg_3", "=", "error", ".", "wrap_exception", "(", ")", "else", ":", "if", "arg_5", "is", "not", "None", ":", "arg_9", "=", "[", "]", "if", "'buffers'", "in", "arg_5", "else", "None", "arg_10", "=", "[", "]", "if", "'result_buffers'", "in", "arg_5", "else", "None", "else", ":", "arg_9", "=", "None", "arg_10", "=", "None", "for", "arg_11", "in", "arg_8", ":", "arg_12", "=", "arg_11", ".", "pop", "(", "'buffers'", ",", "arg_7", ")", "or", "arg_7", "if", "arg_9", "is", "not", "None", ":", "arg_9", ".", "append", "(", "len", "(", "arg_12", ")", ")", "arg_6", ".", "extend", "(", "arg_12", ")", "arg_13", "=", "arg_11", ".", "pop", "(", "'result_buffers'", ",", "arg_7", ")", "or", "arg_7", "if", "arg_10", "is", "not", "None", ":", "arg_10", ".", "append", "(", "len", "(", "arg_13", ")", ")", "arg_6", ".", "extend", "(", "arg_13", ")", "arg_3", "=", "dict", "(", "status", "=", "'ok'", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "query", ",", "\"db_reply\"", ",", "arg_3", "=", "arg_3", ",", "parent", "=", "arg_2", ",", "ident", "=", "arg_1", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Perform a raw query on the task record database.\"\"\"\n        arg_3 = arg_2['content']\n        arg_4 = arg_3.get('query', {})\n        arg_5 = arg_3.get('keys', None)\n        arg_6 = []\n        arg_7 = list()\n        try:\n            arg_8 = arg_0.db.find_records(arg_4, arg_5)\n        except Exception as e:\n            arg_3 = error.wrap_exception()\n        else:\n            # extract buffers from reply content:\n            if arg_5 is not None:\n                arg_9 = [] if 'buffers' in arg_5 else None\n                arg_10 = [] if 'result_buffers' in arg_5 else None\n            else:\n                arg_9 = None\n                arg_10 = None\n\n            for arg_11 in arg_8:\n                # buffers may be None, so double check\n                arg_12 = arg_11.pop('buffers', arg_7) or arg_7\n                if arg_9 is not None:\n                    arg_9.append(len(arg_12))\n                    arg_6.extend(arg_12)\n                arg_13 = arg_11.pop('result_buffers', arg_7) or arg_7\n                if arg_10 is not None:\n                    arg_10.append(len(arg_13))\n                    arg_6.extend(arg_13)\n            arg_3 = dict(status='ok', arg_8=arg_8, arg_9=arg_9,\n                                    arg_10=arg_10)\n        # self.log.debug (content)\n        arg_0.session.send(arg_0.query, \"db_reply\", arg_3=arg_3,\n                                            parent=arg_2, ident=arg_1,\n                                            arg_6=arg_6)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py", "identifier": "Hub.db_query", "docstring": "Perform a raw query on the task record database.", "docstring_tokens": ["Perform", "a", "raw", "query", "on", "the", "task", "record", "database", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254680}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/typeinfo.py#L115-L126", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Get the size of this type for converting a hex string to the\n        type. Return 0 if the size is not known.", "language": "python", "parameters": "(self, type)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_type", "(", "arg_1", ")", "if", "hasattr", "(", "arg_2", ",", "'size'", ")", ":", "return", "arg_2", ".", "size", "(", ")", "return", "0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get the size of this type for converting a hex string to the\n        type. Return 0 if the size is not known.\n        \"\"\"\n\n        arg_2 = arg_0.get_type(arg_1)\n\n        if hasattr(arg_2, 'size'):\n            return arg_2.size()\n\n        return 0", "path": "typedargs/typeinfo.py", "identifier": "TypeSystem.get_type_size", "docstring": "Get the size of this type for converting a hex string to the\n        type. Return 0 if the size is not known.", "docstring_tokens": ["Get", "the", "size", "of", "this", "type", "for", "converting", "a", "hex", "string", "to", "the", "type", ".", "Return", "0", "if", "the", "size", "is", "not", "known", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 254681}
{"url": "https://github.com/Terrance/SkPy/blob/0f9489c94e8ec4d3effab4314497428872a80ad1/skpy/main.py#L131-L139", "sha": "0f9489c94e8ec4d3effab4314497428872a80ad1", "docstring_summary": "Update the profile picture for the current user.", "language": "python", "parameters": "(self, image)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "conn", "(", "\"PUT\"", ",", "\"{0}/users/{1}/profile/avatar\"", ".", "format", "(", "SkypeConnection", ".", "API_USER", ",", "arg_0", ".", "userId", ")", ",", "auth", "=", "SkypeConnection", ".", "Auth", ".", "SkypeToken", ",", "data", "=", "arg_1", ".", "read", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Update the profile picture for the current user.\n\n        Args:\n            image (file): a file-like object to read the image from\n        \"\"\"\n        arg_0.conn(\"PUT\", \"{0}/users/{1}/profile/avatar\".format(SkypeConnection.API_USER, arg_0.userId),\n                  auth=SkypeConnection.Auth.SkypeToken, data=arg_1.read())", "path": "skpy/main.py", "identifier": "Skype.setAvatar", "docstring": "Update the profile picture for the current user.\n\n        Args:\n            image (file): a file-like object to read the image from", "docstring_tokens": ["Update", "the", "profile", "picture", "for", "the", "current", "user", "."], "nwo": "Terrance/SkPy", "score": 0.6983298124827472, "idx": 254682}
{"url": "https://github.com/bigdatacesga/kvstore/blob/8ad2222b39d47defc8ad30deda3da06798e2a9a4/kvstore.py#L85-L95", "sha": "8ad2222b39d47defc8ad30deda3da06798e2a9a4", "docstring_summary": "Get the current index of the key or the subtree.\n        This is needed for later creating long polling requests", "language": "python", "parameters": "(self, k, recursive=False)", "return_statement": "return r.headers['X-Consul-Index']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_1", "=", "arg_1", ".", "lstrip", "(", "'/'", ")", "arg_3", "=", "'{}/{}'", ".", "format", "(", "arg_0", ".", "endpoint", ",", "arg_1", ")", "arg_4", "=", "{", "}", "if", "arg_2", ":", "arg_4", "[", "'recurse'", "]", "=", "''", "arg_5", "=", "requests", ".", "get", "(", "arg_3", ",", "arg_4", "=", "arg_4", ")", "return", "arg_5", ".", "headers", "[", "'X-Consul-Index'", "]"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Get the current Func of the key or the subtree.\n        This is needed for later creating long polling requests\n        \"\"\"\n        arg_1 = arg_1.lstrip('/')\n        arg_3 = '{}/{}'.format(arg_0.endpoint, arg_1)\n        arg_4 = {}\n        if arg_2:\n            arg_4['recurse'] = ''\n        arg_5 = requests.get(arg_3, arg_4=arg_4)\n        return arg_5.headers['X-Consul-Index']", "path": "kvstore.py", "identifier": "Client.index", "docstring": "Get the current index of the key or the subtree.\n        This is needed for later creating long polling requests", "docstring_tokens": ["Get", "the", "current", "index", "of", "the", "key", "or", "the", "subtree", ".", "This", "is", "needed", "for", "later", "creating", "long", "polling", "requests"], "nwo": "bigdatacesga/kvstore", "score": 0.23137166388621372, "idx": 254683}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L300-L305", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Remove duplicate source and destination accesses", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "destinations", "=", "{", "var_name", ":", "set", "(", "acs", ")", "for", "var_name", ",", "acs", "in", "arg_0", ".", "destinations", ".", "items", "(", ")", "}", "arg_0", ".", "sources", "=", "{", "var_name", ":", "set", "(", "acs", ")", "for", "var_name", ",", "acs", "in", "arg_0", ".", "sources", ".", "items", "(", ")", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Remove duplicate source and destination accesses\n        \"\"\"\n        arg_0.destinations = {var_name: set(acs) for var_name, acs in arg_0.destinations.items()}\n        arg_0.sources = {var_name: set(acs) for var_name, acs in arg_0.sources.items()}", "path": "kerncraft/kernel.py", "identifier": "Kernel._remove_duplicate_accesses", "docstring": "Remove duplicate source and destination accesses", "docstring_tokens": ["Remove", "duplicate", "source", "and", "destination", "accesses"], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 254684}
{"url": "https://github.com/opencast/pyCA/blob/c89b168d4780d157e1b3f7676628c1b131956a88/pyca/db.py#L144-L160", "sha": "c89b168d4780d157e1b3f7676628c1b131956a88", "docstring_summary": "Serialize this object as dictionary usable for conversion to JSON.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'type': 'event',\n            'id': self.uid,\n            'attributes': {\n                'start': self.start,\n                'end': self.end,\n                'uid': self.uid,\n                'title': self.title,\n                'data': self.get_data(),\n                'status': Status.str(self.status)\n                }\n            }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "'type'", ":", "'event'", ",", "'id'", ":", "arg_0", ".", "uid", ",", "'attributes'", ":", "{", "'start'", ":", "arg_0", ".", "start", ",", "'end'", ":", "arg_0", ".", "end", ",", "'uid'", ":", "arg_0", ".", "uid", ",", "'title'", ":", "arg_0", ".", "title", ",", "'data'", ":", "arg_0", ".", "get_data", "(", ")", ",", "'status'", ":", "Status", ".", "str", "(", "arg_0", ".", "status", ")", "}", "}"], "function": "def Func(arg_0):\n        '''Serialize this object as dictionary usable for conversion to JSON.\n\n        :return: Dictionary representing this object.\n        '''\n        return {\n            'type': 'event',\n            'id': arg_0.uid,\n            'attributes': {\n                'start': arg_0.start,\n                'end': arg_0.end,\n                'uid': arg_0.uid,\n                'title': arg_0.title,\n                'data': arg_0.get_data(),\n                'status': Status.str(arg_0.status)\n                }\n            }", "path": "pyca/db.py", "identifier": "BaseEvent.serialize", "docstring": "Serialize this object as dictionary usable for conversion to JSON.\n\n        :return: Dictionary representing this object.", "docstring_tokens": ["Serialize", "this", "object", "as", "dictionary", "usable", "for", "conversion", "to", "JSON", "."], "nwo": "opencast/pyCA", "score": 0.38750565733100095, "idx": 254685}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/image/base.py#L280-L304", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Sets a mask img to this. So every operation to self, this mask will be taken into account.", "language": "python", "parameters": "(self, mask_img)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "load_mask", "(", "arg_1", ",", "allow_empty", "=", "True", ")", "check_img_compatibility", "(", "arg_0", ".", "img", ",", "arg_2", ",", "only_check_3d", "=", "True", ")", "arg_0", ".", "mask", "=", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Sets a mask img to this. So every operation to self, this mask will be taken into account.\n\n        Parameters\n        ----------\n        mask_img: nifti-like image, NeuroImage or str\n            3D mask array: True where a voxel should be used.\n            Can either be:\n            - a file path to a Nifti image\n            - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.\n            If niimg is a string, consider it as a path to Nifti image and\n            call nibabel.load on it. If it is an object, check if get_data()\n            and get_affine() methods are present, raise TypeError otherwise.\n\n        Note\n        ----\n        self.img and mask_file must have the same shape.\n\n        Raises\n        ------\n        FileNotFound, NiftiFilesNotCompatible\n        \"\"\"\n        arg_2 = load_mask(arg_1, allow_empty=True)\n        check_img_compatibility(arg_0.img, arg_2, only_check_3d=True) # this will raise an exception if something is wrong\n        arg_0.mask = arg_2", "path": "boyle/image/base.py", "identifier": "MedicalImage.set_mask", "docstring": "Sets a mask img to this. So every operation to self, this mask will be taken into account.\n\n        Parameters\n        ----------\n        mask_img: nifti-like image, NeuroImage or str\n            3D mask array: True where a voxel should be used.\n            Can either be:\n            - a file path to a Nifti image\n            - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.\n            If niimg is a string, consider it as a path to Nifti image and\n            call nibabel.load on it. If it is an object, check if get_data()\n            and get_affine() methods are present, raise TypeError otherwise.\n\n        Note\n        ----\n        self.img and mask_file must have the same shape.\n\n        Raises\n        ------\n        FileNotFound, NiftiFilesNotCompatible", "docstring_tokens": ["Sets", "a", "mask", "img", "to", "this", ".", "So", "every", "operation", "to", "self", "this", "mask", "will", "be", "taken", "into", "account", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254686}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1319-L1325", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "get the number of quartets as n-choose-k. This is used\n    in equal splits to decide whether a split should be exhaustively sampled\n    or randomly sampled. Edges near tips can be exhaustive while highly nested\n    edges probably have too many quartets", "language": "python", "parameters": "(n, k)", "return_statement": "return int(reduce(MUL, (Fraction(n-i, i+1) for i in range(k)), 1))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "int", "(", "reduce", "(", "MUL", ",", "(", "Fraction", "(", "arg_0", "-", "arg_2", ",", "arg_2", "+", "1", ")", "for", "arg_2", "in", "range", "(", "arg_1", ")", ")", ",", "1", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" get the number of quartets as n-choose-k. This is used\n    in equal splits to decide whether a split should be exhaustively sampled\n    or randomly sampled. Edges near tips can be exhaustive while highly nested\n    edges probably have too many quartets\n    \"\"\"\n    return int(reduce(MUL, (Fraction(arg_0-arg_2, arg_2+1) for arg_2 in range(arg_1)), 1))", "path": "ipyrad/analysis/tetrad.py", "identifier": "n_choose_k", "docstring": "get the number of quartets as n-choose-k. This is used\n    in equal splits to decide whether a split should be exhaustively sampled\n    or randomly sampled. Edges near tips can be exhaustive while highly nested\n    edges probably have too many quartets", "docstring_tokens": ["get", "the", "number", "of", "quartets", "as", "n", "-", "choose", "-", "k", ".", "This", "is", "used", "in", "equal", "splits", "to", "decide", "whether", "a", "split", "should", "be", "exhaustively", "sampled", "or", "randomly", "sampled", ".", "Edges", "near", "tips", "can", "be", "exhaustive", "while", "highly", "nested", "edges", "probably", "have", "too", "many", "quartets"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 254687}
{"url": "https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/backends/base.py#L31-L44", "sha": "c60bc28f16f5d0e62536e76c17d6944a79449ef1", "docstring_summary": "Returns a dictionary with the format identifier as the key. The values are\n        are fully rendered templates with the given context.", "language": "python", "parameters": "(self, formats, label, context)", "return_statement": "return format_templates", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "}", "for", "arg_5", "in", "arg_1", ":", "if", "arg_5", ".", "endswith", "(", "\".txt\"", ")", ":", "arg_3", ".", "autoescape", "=", "False", "arg_4", "[", "arg_5", "]", "=", "render_to_string", "(", "(", "\"notification/%s/%s\"", "%", "(", "arg_2", ",", "arg_5", ")", ",", "\"notification/%s\"", "%", "arg_5", ")", ",", "context_instance", "=", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Returns a dictionary with the format identifier as the key. The values are\n        are fully rendered templates with the given context.\n        \"\"\"\n        arg_4 = {}\n        for arg_5 in arg_1:\n            # conditionally turn off autoescaping for .txt extensions in format\n            if arg_5.endswith(\".txt\"):\n                arg_3.autoescape = False\n            arg_4[arg_5] = render_to_string((\n                \"notification/%s/%s\" % (arg_2, arg_5),\n                \"notification/%s\" % arg_5), context_instance=arg_3)\n        return arg_4", "path": "notification/backends/base.py", "identifier": "BaseBackend.get_formatted_messages", "docstring": "Returns a dictionary with the format identifier as the key. The values are\n        are fully rendered templates with the given context.", "docstring_tokens": ["Returns", "a", "dictionary", "with", "the", "format", "identifier", "as", "the", "key", ".", "The", "values", "are", "are", "fully", "rendered", "templates", "with", "the", "given", "context", "."], "nwo": "GeoNode/geonode-notification", "score": 0.17385480483333982, "idx": 254688}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L91-L95", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Remove all the item from the list and unset the related data", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_py_data_map", ".", "clear", "(", ")", "arg_0", ".", "_wx_data_map", ".", "clear", "(", ")", "wx", ".", "ListCtrl", ".", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0):\r\n        \"Remove all the item from the list and unset the related data\"\r\n        arg_0._py_data_map.clear()\r\n        arg_0._wx_data_map.clear()\r\n        wx.ListCtrl.Func(arg_0)", "path": "gui/controls/listview.py", "identifier": "wx_ListCtrl.DeleteAllItems", "docstring": "Remove all the item from the list and unset the related data", "docstring_tokens": ["Remove", "all", "the", "item", "from", "the", "list", "and", "unset", "the", "related", "data"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 254689}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/container.py#L135-L143", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Adds a widget to this container.\n        \n        Note that trying to add the Container to itself will be ignored.", "language": "python", "parameters": "(self,widget)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "is", "arg_1", ":", "return", "arg_0", ".", "widgets", "[", "arg_1", ".", "name", "]", "=", "arg_1"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Adds a widget to this container.\n        \n        Note that trying to add the Container to itself will be ignored.\n        \"\"\"\n        if arg_0 is arg_1: # Prevents being able to add the container to itself, causing a recursion loop on redraw\n            return\n        arg_0.widgets[arg_1.name]=arg_1", "path": "peng3d/gui/container.py", "identifier": "Container.addWidget", "docstring": "Adds a widget to this container.\n        \n        Note that trying to add the Container to itself will be ignored.", "docstring_tokens": ["Adds", "a", "widget", "to", "this", "container", ".", "Note", "that", "trying", "to", "add", "the", "Container", "to", "itself", "will", "be", "ignored", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 254690}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/lsi.py#L416-L444", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Performs an SCP command where the remote_path is the target and the\n    local_path is the source.", "language": "python", "parameters": "(entries, remote_path, local_path, profile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ":", "arg_6", "=", "arg_5", ".", "hostname", "or", "arg_5", ".", "public_ip", "arg_7", "=", "_build_scp_command", "(", "arg_6", ",", "arg_3", ".", "username", ",", "arg_3", ".", "identity_file", ",", "is_get", "=", "False", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", "print", "(", "'Command:'", ",", "arg_7", ")", "arg_4", ".", "append", "(", "{", "'command'", ":", "arg_7", ",", "'description'", ":", "arg_5", ".", "display", "(", ")", "}", ")", "stream_commands", "(", "arg_4", ")", "print", "(", "green", "(", "'Finished copying'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Performs an SCP command where the remote_path is the target and the\n    local_path is the source.\n\n    :param entries: A list of entries.\n    :type entries: ``list`` of :py:class:`HostEntry`\n    :param remote_path: The target path on the remote machine(s).\n    :type remote_path: ``str``\n    :param local_path: The source path on the local machine.\n    :type local_path: ``str``\n    :param profile: The profile, holding username/idfile info, etc.\n    :type profile: :py:class:`Profile`\n    \"\"\"\n    arg_4 = []\n    for arg_5 in arg_0:\n        arg_6 = arg_5.hostname or arg_5.public_ip\n        arg_7 = _build_scp_command(arg_6, arg_3.username,\n                                 arg_3.identity_file,\n                                 is_get=False,\n                                 arg_2=arg_2,\n                                 arg_1=arg_1)\n        print('Command:', arg_7)\n        arg_4.append({\n            'command': arg_7,\n            'description': arg_5.display()\n        })\n    stream_commands(arg_4)\n    print(green('Finished copying'))", "path": "src/lsi/lsi.py", "identifier": "_copy_to", "docstring": "Performs an SCP command where the remote_path is the target and the\n    local_path is the source.\n\n    :param entries: A list of entries.\n    :type entries: ``list`` of :py:class:`HostEntry`\n    :param remote_path: The target path on the remote machine(s).\n    :type remote_path: ``str``\n    :param local_path: The source path on the local machine.\n    :type local_path: ``str``\n    :param profile: The profile, holding username/idfile info, etc.\n    :type profile: :py:class:`Profile`", "docstring_tokens": ["Performs", "an", "SCP", "command", "where", "the", "remote_path", "is", "the", "target", "and", "the", "local_path", "is", "the", "source", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 254691}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3041-L3053", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Conduct a diff-1 transform on a numeric frame column.", "language": "python", "parameters": "(self)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "ncols", ">", "1", ":", "raise", "H2OValueError", "(", "\"Only single-column frames supported\"", ")", "if", "arg_0", ".", "types", "[", "arg_0", ".", "columns", "[", "0", "]", "]", "not", "in", "{", "\"real\"", ",", "\"int\"", ",", "\"bool\"", "}", ":", "raise", "H2OValueError", "(", "\"Numeric column expected\"", ")", "arg_1", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Conduct a diff-1 transform on a numeric frame column.\n\n        :returns: an H2OFrame where each element is equal to the corresponding element in the source\n            frame minus the previous-row element in the same frame.\n        \"\"\"\n        if arg_0.ncols > 1:\n            raise H2OValueError(\"Only single-column frames supported\")\n        if arg_0.types[arg_0.columns[0]] not in {\"real\", \"int\", \"bool\"}:\n            raise H2OValueError(\"Numeric column expected\")\n        arg_1 = H2OFrame._expr(expr=ExprNode(\"Func\", arg_0), cache=arg_0._ex._cache)\n        return arg_1", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.difflag1", "docstring": "Conduct a diff-1 transform on a numeric frame column.\n\n        :returns: an H2OFrame where each element is equal to the corresponding element in the source\n            frame minus the previous-row element in the same frame.", "docstring_tokens": ["Conduct", "a", "diff", "-", "1", "transform", "on", "a", "numeric", "frame", "column", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 254692}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/teams.py#L118-L147", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Create a team.", "language": "python", "parameters": "(self, name, **request_parameters)", "return_statement": "return self._object_factory(OBJECT_TYPE, json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "arg_3", "=", "dict_from_items_with_values", "(", "arg_2", ",", "arg_1", "=", "arg_1", ",", ")", "arg_4", "=", "arg_0", ".", "_session", ".", "post", "(", "API_ENDPOINT", ",", "json", "=", "arg_3", ")", "return", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Create a team.\n\n        The authenticated user is automatically added as a member of the team.\n\n        Args:\n            name(basestring): A user-friendly name for the team.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Team: A Team object with the details of the Funcd team.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n\n        arg_3 = dict_from_items_with_values(\n            arg_2,\n            arg_1=arg_1,\n        )\n\n        # API request\n        arg_4 = arg_0._session.post(API_ENDPOINT, json=arg_3)\n\n        # Return a team object Funcd from the response JSON data\n        return arg_0._object_factory(OBJECT_TYPE, arg_4)", "path": "webexteamssdk/api/teams.py", "identifier": "TeamsAPI.create", "docstring": "Create a team.\n\n        The authenticated user is automatically added as a member of the team.\n\n        Args:\n            name(basestring): A user-friendly name for the team.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Team: A Team object with the details of the created team.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Create", "a", "team", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 254693}
{"url": "https://github.com/bheinzerling/descriptors/blob/04fff864649fba9bd6a2d8f8b649cf30994e0e46/descriptors/Descriptor.py#L171-L184", "sha": "04fff864649fba9bd6a2d8f8b649cf30994e0e46", "docstring_summary": "Return True if the last exception was thrown by a\n        Descriptor instance.", "language": "python", "parameters": "()", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "]", "arg_1", "=", "arg_0", ".", "tb_frame", ".", "f_locals", "if", "\"self\"", "in", "arg_1", ":", "if", "not", "isinstance", "(", "arg_1", "[", "\"self\"", "]", ",", "Descriptor", ")", ":", "return", "False", "return", "True", "return", "False"], "function": "def Func():\n        \"\"\"Return True if the last exception was thrown by a\n        Descriptor instance.\n\n        \"\"\"\n        arg_0 = sys.exc_info()[2]\n        arg_1 = arg_0.tb_frame.f_locals\n        # relying on naming convention to get the object that threw\n        # the exception\n        if \"self\" in arg_1:\n            if not isinstance(arg_1[\"self\"], Descriptor):\n                return False\n            return True\n        return False", "path": "descriptors/Descriptor.py", "identifier": "Descriptor.exc_thrown_by_descriptor", "docstring": "Return True if the last exception was thrown by a\n        Descriptor instance.", "docstring_tokens": ["Return", "True", "if", "the", "last", "exception", "was", "thrown", "by", "a", "Descriptor", "instance", "."], "nwo": "bheinzerling/descriptors", "score": 0.16941397159673272, "idx": 254694}
{"url": "https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/stats.py#L437-L470", "sha": "f546ad171750cd7685afbde6785fe71f82cadb35", "docstring_summary": "Takes list of decoy and target scores and creates error statistics for target values", "language": "python", "parameters": "(target_scores, decoy_scores, parametric, pfdr, pi0_lambda, pi0_method = \"smoother\", pi0_smooth_df = 3, pi0_smooth_log_pi0 = False, compute_lfdr = False, lfdr_trunc = True, lfdr_monotone = True, lfdr_transf = \"probit\", lfdr_adj = 1.5, lfdr_eps = np.power(10.0,-8))", "return_statement": "return error_stat, pi0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "\"smoother\"", ",", "arg_6", "=", "3", ",", "arg_7", "=", "False", ",", "arg_8", "=", "False", ",", "arg_9", "=", "True", ",", "arg_10", "=", "True", ",", "arg_11", "=", "\"probit\"", ",", "arg_12", "=", "1.5", ",", "arg_13", "=", "arg_14", ".", "power", "(", "10.0", ",", "-", "8", ")", ")", ":", "arg_0", "=", "to_one_dim_array", "(", "arg_0", ")", "arg_0", "=", "arg_14", ".", "sort", "(", "arg_0", "[", "~", "arg_14", ".", "isnan", "(", "arg_0", ")", "]", ")", "arg_1", "=", "to_one_dim_array", "(", "arg_1", ")", "arg_1", "=", "arg_14", ".", "sort", "(", "arg_1", "[", "~", "arg_14", ".", "isnan", "(", "arg_1", ")", "]", ")", "if", "arg_2", ":", "arg_16", "=", "pnorm", "(", "arg_0", ",", "arg_1", ")", "else", ":", "arg_16", "=", "pemp", "(", "arg_0", ",", "arg_1", ")", "arg_17", "=", "pi0est", "(", "arg_16", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "arg_18", "=", "qvalue", "(", "arg_16", ",", "arg_17", "[", "'pi0'", "]", ",", "arg_3", ")", "arg_19", "=", "stat_metrics", "(", "arg_16", ",", "arg_17", "[", "'pi0'", "]", ",", "arg_3", ")", "arg_20", "=", "pd", ".", "DataFrame", "(", "{", "'cutoff'", ":", "arg_0", ",", "'pvalue'", ":", "arg_16", ",", "'qvalue'", ":", "arg_18", ",", "'svalue'", ":", "arg_19", "[", "'svalue'", "]", ",", "'tp'", ":", "arg_19", "[", "'tp'", "]", ",", "'fp'", ":", "arg_19", "[", "'fp'", "]", ",", "'tn'", ":", "arg_19", "[", "'tn'", "]", ",", "'fn'", ":", "arg_19", "[", "'fn'", "]", ",", "'fpr'", ":", "arg_19", "[", "'fpr'", "]", ",", "'fdr'", ":", "arg_19", "[", "'fdr'", "]", ",", "'fnr'", ":", "arg_19", "[", "'fnr'", "]", "}", ")", "if", "arg_8", ":", "arg_20", "[", "'pep'", "]", "=", "lfdr", "(", "arg_16", ",", "arg_17", "[", "'pi0'", "]", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ")", "return", "arg_20", ",", "arg_17"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5 = \"smoother\", arg_6 = 3, arg_7 = False, arg_8 = False, arg_9 = True, arg_10 = True, arg_11 = \"probit\", arg_12 = 1.5, arg_13 = arg_14.power(10.0,-8)):\n    \"\"\" Takes list of decoy and target scores and creates error statistics for target values \"\"\"\n\n    arg_0 = to_one_dim_array(arg_0)\n    arg_0 = arg_14.sort(arg_0[~arg_14.isnan(arg_0)])\n\n    arg_1 = to_one_dim_array(arg_1)\n    arg_1 = arg_14.sort(arg_1[~arg_14.isnan(arg_1)])\n\n    # compute p-values using decoy scores\n    if arg_2:\n        # parametric\n        arg_16 = pnorm(arg_0, arg_1)\n    else:\n        # non-parametric\n        arg_16 = pemp(arg_0, arg_1)\n\n    # estimate pi0\n    arg_17 = pi0est(arg_16, arg_4, arg_5, arg_6, arg_7)\n\n    # compute q-value\n    arg_18 = qvalue(arg_16, arg_17['pi0'], arg_3)\n\n    # compute other metrics\n    arg_19 = stat_metrics(arg_16, arg_17['pi0'], arg_3)\n\n    # generate main statistics table\n    arg_20 = pd.DataFrame({'cutoff': arg_0, 'pvalue': arg_16, 'qvalue': arg_18, 'svalue': arg_19['svalue'], 'tp': arg_19['tp'], 'fp': arg_19['fp'], 'tn': arg_19['tn'], 'fn': arg_19['fn'], 'fpr': arg_19['fpr'], 'fdr': arg_19['fdr'], 'fnr': arg_19['fnr']})\n\n    # compute lfdr / PEP\n    if arg_8:\n        arg_20['pep'] = lfdr(arg_16, arg_17['pi0'], arg_9, arg_10, arg_11, arg_12, arg_13)\n\n    return arg_20, arg_17", "path": "pyprophet/stats.py", "identifier": "error_statistics", "docstring": "Takes list of decoy and target scores and creates error statistics for target values", "docstring_tokens": ["Takes", "list", "of", "decoy", "and", "target", "scores", "and", "creates", "error", "statistics", "for", "target", "values"], "nwo": "PyProphet/pyprophet", "score": 0.38514621847307956, "idx": 254695}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/__init__.py#L229-L248", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "parse and import the script, and then run the script's main function", "language": "python", "parameters": "(self, raw_args)", "return_statement": "return ret_code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "parser", "arg_3", ",", "arg_4", "=", "arg_2", ".", "parse_callback_args", "(", "arg_1", ")", "arg_5", "=", "arg_4", ".", "pop", "(", "\"main_callback\"", ")", "if", "arg_2", ".", "has_injected_quiet", "(", ")", ":", "arg_6", "=", "arg_4", ".", "pop", "(", "\"quiet_inject\"", ",", "\"\"", ")", "logging", ".", "inject_quiet", "(", "arg_6", ")", "try", ":", "arg_7", "=", "arg_5", "(", "*", "arg_3", ",", "**", "arg_4", ")", "arg_7", "=", "int", "(", "arg_7", ")", "if", "arg_7", "else", "0", "except", "ArgError", "as", "e", ":", "echo", ".", "err", "(", "\"{}: error: {}\"", ",", "arg_2", ".", "prog", ",", "str", "(", "e", ")", ")", "arg_7", "=", "2", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"parse and import the script, and then Func the script's main function\"\"\"\n        arg_2 = arg_0.parser\n        arg_3, arg_4 = arg_2.parse_callback_args(arg_1)\n\n        arg_5 = arg_4.pop(\"main_callback\")\n        if arg_2.has_injected_quiet():\n            arg_6 = arg_4.pop(\"quiet_inject\", \"\")\n            logging.inject_quiet(arg_6)\n\n        try:\n            arg_7 = arg_5(*arg_3, **arg_4)\n            arg_7 = int(arg_7) if arg_7 else 0\n\n        except ArgError as e:\n            # https://hg.python.org/cpython/file/2.7/Lib/argparse.py#l2374\n            echo.err(\"{}: error: {}\", arg_2.prog, str(e))\n            arg_7 = 2\n\n        return arg_7", "path": "captain/__init__.py", "identifier": "Script.run", "docstring": "parse and import the script, and then run the script's main function", "docstring_tokens": ["parse", "and", "import", "the", "script", "and", "then", "run", "the", "script", "s", "main", "function"], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 254696}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L1628-L1638", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Export all keys to a file", "language": "python", "parameters": "(output_path, stash, passphrase, backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_1", "=", "_get_stash", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "try", ":", "click", ".", "echo", "(", "'Exporting stash to {0}...'", ".", "format", "(", "arg_0", ")", ")", "arg_1", ".", "export", "(", "arg_0", "=", "arg_0", ")", "click", ".", "echo", "(", "'Export complete!'", ")", "except", "GhostError", "as", "ex", ":", "sys", ".", "exit", "(", "ex", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Export all keys to a file\n    \"\"\"\n    arg_1 = _get_stash(arg_3, arg_1, arg_2)\n\n    try:\n        click.echo('Exporting stash to {0}...'.format(arg_0))\n        arg_1.export(arg_0=arg_0)\n        click.echo('Export complete!')\n    except GhostError as ex:\n        sys.exit(ex)", "path": "ghost.py", "identifier": "export_keys", "docstring": "Export all keys to a file", "docstring_tokens": ["Export", "all", "keys", "to", "a", "file"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 254697}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L749-L764", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Compose link to 1000G page for detailed information.", "language": "python", "parameters": "(variant_obj, build=None)", "return_statement": "return url_template.format(dbsnp_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "get", "(", "'dbsnp_id'", ")", "arg_1", "=", "arg_1", "or", "37", "if", "not", "arg_2", ":", "return", "None", "if", "arg_1", "==", "37", ":", "arg_3", "=", "(", "\"http://grch37.ensembl.org/Homo_sapiens/Variation/Explore\"", "\"?v={};vdb=variation\"", ")", "else", ":", "arg_3", "=", "(", "\"http://www.ensembl.org/Homo_sapiens/Variation/Explore\"", "\"?v={};vdb=variation\"", ")", "return", "arg_3", ".", "format", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Compose link to 1000G page for detailed information.\"\"\"\n    arg_2 = arg_0.get('dbsnp_id')\n    arg_1 = arg_1 or 37\n\n    if not arg_2:\n        return None\n\n    if arg_1 == 37:\n        arg_3 = (\"http://grch37.ensembl.org/Homo_sapiens/Variation/Explore\"\n                        \"?v={};vdb=variation\")\n    else:\n        arg_3 = (\"http://www.ensembl.org/Homo_sapiens/Variation/Explore\"\n                        \"?v={};vdb=variation\")\n\n    return arg_3.format(arg_2)", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "thousandg_link", "docstring": "Compose link to 1000G page for detailed information.", "docstring_tokens": ["Compose", "link", "to", "1000G", "page", "for", "detailed", "information", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254698}
{"url": "https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/utils.py#L8-L34", "sha": "c23ce9732720856e2f6dc54060db71a8182c7d4b", "docstring_summary": "Merges ``config`` on top of ``template``.", "language": "python", "parameters": "(template, config, list_identifiers=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "copy", "(", ")", "for", "arg_4", ",", "arg_5", "in", "arg_1", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_5", ",", "dict", ")", ":", "arg_6", "=", "arg_3", ".", "get", "(", "arg_4", ",", "OrderedDict", "(", ")", ")", "arg_3", "[", "arg_4", "]", "=", "Func", "(", "arg_6", ",", "arg_5", ")", "elif", "isinstance", "(", "arg_5", ",", "list", ")", "and", "isinstance", "(", "arg_3", ".", "get", "(", "arg_4", ")", ",", "list", ")", ":", "arg_3", "[", "arg_4", "]", "=", "merge_list", "(", "arg_3", "[", "arg_4", "]", ",", "arg_5", ",", "arg_2", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Merges ``config`` on top of ``template``.\n\n    Conflicting keys are handled in the following way:\n\n    * simple values (eg: ``str``, ``int``, ``float``, ecc) in ``config`` will\n      overwrite the ones in ``template``\n    * values of type ``list`` in both ``config`` and ``template`` will be\n      merged using to the ``merge_list`` function\n    * values of type ``dict`` will be merged recursively\n\n    :param template: template ``dict``\n    :param config: config ``dict``\n    :param list_identifiers: ``list`` or ``None``\n    :returns: merged ``dict``\n    \"\"\"\n    arg_3 = arg_0.copy()\n    for arg_4, arg_5 in arg_1.items():\n        if isinstance(arg_5, dict):\n            arg_6 = arg_3.get(arg_4, OrderedDict())\n            arg_3[arg_4] = Func(arg_6, arg_5)\n        elif isinstance(arg_5, list) and isinstance(arg_3.get(arg_4), list):\n            arg_3[arg_4] = merge_list(arg_3[arg_4], arg_5, arg_2)\n        else:\n            arg_3[arg_4] = arg_5\n    return arg_3", "path": "netjsonconfig/utils.py", "identifier": "merge_config", "docstring": "Merges ``config`` on top of ``template``.\n\n    Conflicting keys are handled in the following way:\n\n    * simple values (eg: ``str``, ``int``, ``float``, ecc) in ``config`` will\n      overwrite the ones in ``template``\n    * values of type ``list`` in both ``config`` and ``template`` will be\n      merged using to the ``merge_list`` function\n    * values of type ``dict`` will be merged recursively\n\n    :param template: template ``dict``\n    :param config: config ``dict``\n    :param list_identifiers: ``list`` or ``None``\n    :returns: merged ``dict``", "docstring_tokens": ["Merges", "config", "on", "top", "of", "template", "."], "nwo": "openwisp/netjsonconfig", "score": 0.6422153945684831, "idx": 254699}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L138-L167", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Vectorize an image and mask out all invalid voxels.", "language": "python", "parameters": "(self, image, nan_to_num=True, layers=None, in_global_mask=False)", "return_statement": "return masked_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_0", ".", "set_Func", "(", "arg_3", ")", "arg_1", "=", "arg_0", ".", "get_image", "(", "arg_1", ",", "output", "=", "'vector'", ")", "if", "arg_4", ":", "arg_5", "=", "arg_1", "[", "arg_0", ".", "global_Func", "]", "arg_5", "[", "~", "arg_0", ".", "get_Func", "(", "arg_4", "=", "True", ")", "]", "=", "0", "else", ":", "arg_5", "=", "arg_1", "[", "arg_0", ".", "current_Func", "]", "if", "arg_2", ":", "arg_5", "=", "np", ".", "nan_to_num", "(", "arg_5", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None, arg_4=False):\n        \"\"\" Vectorize an image and Func out all invalid voxels.\n\n        Args:\n            images: The image to vectorize and Func. Input can be any object\n                handled by get_image().\n            layers: Which Func layers to use (specified as int, string, or\n                list of ints and strings). When None, applies the conjunction\n                of all layers.\n            nan_to_num: boolean indicating whether to convert NaNs to 0.\n            in_global_Func: Whether to return the resulting Funced vector in\n                the globally Funced space (i.e., n_voxels =\n                len(self.global_Func)). If False (default), returns in the full\n                image space (i.e., n_voxels = len(self.volume)).\n        Returns:\n          A 1D NumPy array of in-Func voxels.\n        \"\"\"\n        arg_0.set_Func(arg_3)\n        arg_1 = arg_0.get_image(arg_1, output='vector')\n\n        if arg_4:\n            arg_5 = arg_1[arg_0.global_Func]\n            arg_5[~arg_0.get_Func(arg_4=True)] = 0\n        else:\n            arg_5 = arg_1[arg_0.current_Func]\n\n        if arg_2:\n            arg_5 = np.nan_to_num(arg_5)\n\n        return arg_5", "path": "neurosynth/base/mask.py", "identifier": "Masker.mask", "docstring": "Vectorize an image and mask out all invalid voxels.\n\n        Args:\n            images: The image to vectorize and mask. Input can be any object\n                handled by get_image().\n            layers: Which mask layers to use (specified as int, string, or\n                list of ints and strings). When None, applies the conjunction\n                of all layers.\n            nan_to_num: boolean indicating whether to convert NaNs to 0.\n            in_global_mask: Whether to return the resulting masked vector in\n                the globally masked space (i.e., n_voxels =\n                len(self.global_mask)). If False (default), returns in the full\n                image space (i.e., n_voxels = len(self.volume)).\n        Returns:\n          A 1D NumPy array of in-mask voxels.", "docstring_tokens": ["Vectorize", "an", "image", "and", "mask", "out", "all", "invalid", "voxels", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 254700}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1750-L1826", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Create a record object using the LXML parser.", "language": "python", "parameters": "(marcxml,\n                        verbose=CFG_BIBRECORD_DEFAULT_VERBOSE_LEVEL,\n                        correct=CFG_BIBRECORD_DEFAULT_CORRECT,\n                        keep_singletons=CFG_BIBRECORD_KEEP_SINGLETONS)", "return_statement": "return record", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "arg_6", ")", ":", "arg_7", "=", "etree", ".", "XMLParser", "(", "dtd_validation", "=", "arg_3", ",", "recover", "=", "(", "arg_1", "<=", "3", ")", ")", "if", "arg_3", ":", "arg_0", "=", "'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n'", "'<collection>\\n%s\\n</collection>'", "%", "(", "arg_0", ",", ")", "try", ":", "arg_8", "=", "etree", ".", "parse", "(", "StringIO", "(", "arg_0", ")", ",", "arg_7", ")", "except", "Exception", "as", "e", ":", "raise", "InvenioBibRecordParserError", "(", "str", "(", "e", ")", ")", "arg_9", "=", "{", "}", "arg_10", "=", "0", "arg_11", "=", "arg_8", ".", "iter", "(", "arg_13", "=", "'{*}controlfield'", ")", "for", "arg_12", "in", "arg_11", ":", "arg_13", "=", "arg_12", ".", "attrib", ".", "get", "(", "'tag'", ",", "'!'", ")", ".", "encode", "(", "\"UTF-8\"", ")", "arg_14", "=", "' '", "arg_15", "=", "' '", "arg_16", "=", "arg_12", ".", "text", "if", "arg_16", "is", "None", ":", "arg_16", "=", "''", "else", ":", "arg_16", "=", "arg_16", ".", "encode", "(", "\"UTF-8\"", ")", "arg_17", "=", "[", "]", "if", "arg_16", "or", "arg_5", ":", "arg_10", "+=", "1", "arg_9", ".", "setdefault", "(", "arg_13", ",", "[", "]", ")", ".", "append", "(", "(", "arg_17", ",", "arg_14", ",", "arg_15", ",", "arg_16", ",", "arg_10", ")", ")", "arg_18", "=", "arg_8", ".", "iter", "(", "arg_13", "=", "'{*}datafield'", ")", "for", "arg_19", "in", "arg_18", ":", "arg_13", "=", "arg_19", ".", "attrib", ".", "get", "(", "'tag'", ",", "'!'", ")", ".", "encode", "(", "\"UTF-8\"", ")", "arg_14", "=", "arg_19", ".", "attrib", ".", "get", "(", "'ind1'", ",", "'!'", ")", ".", "encode", "(", "\"UTF-8\"", ")", "arg_15", "=", "arg_19", ".", "attrib", ".", "get", "(", "'ind2'", ",", "'!'", ")", ".", "encode", "(", "\"UTF-8\"", ")", "if", "arg_14", "in", "(", "''", ",", "'_'", ")", ":", "arg_14", "=", "' '", "if", "arg_15", "in", "(", "''", ",", "'_'", ")", ":", "arg_15", "=", "' '", "arg_17", "=", "[", "]", "arg_20", "=", "arg_19", ".", "iter", "(", "arg_13", "=", "'{*}subfield'", ")", "for", "arg_21", "in", "arg_20", ":", "arg_22", "=", "arg_21", ".", "attrib", ".", "get", "(", "'code'", ",", "'!'", ")", ".", "encode", "(", "\"UTF-8\"", ")", "arg_16", "=", "arg_21", ".", "text", "if", "arg_16", "is", "None", ":", "arg_16", "=", "''", "else", ":", "arg_16", "=", "arg_16", ".", "encode", "(", "\"UTF-8\"", ")", "if", "arg_16", "or", "arg_5", ":", "arg_17", ".", "append", "(", "(", "arg_22", ",", "arg_16", ")", ")", "if", "arg_17", "or", "arg_5", ":", "arg_16", "=", "''", "arg_10", "+=", "1", "arg_9", ".", "setdefault", "(", "arg_13", ",", "[", "]", ")", ".", "append", "(", "(", "arg_17", ",", "arg_14", ",", "arg_15", ",", "arg_16", ",", "arg_10", ")", ")", "return", "arg_9"], "function": "def Func(arg_0,\n                        arg_1=arg_2,\n                        arg_3=arg_4,\n                        arg_5=arg_6):\n    \"\"\"\n    Create a record object using the LXML parser.\n\n    If correct == 1, then perform DTD validation\n    If correct == 0, then do not perform DTD validation\n\n    If verbose == 0, the parser will not give warnings.\n    If 1 <= verbose <= 3, the parser will not give errors, but will warn\n        the user about possible mistakes (implement me!)\n    If verbose > 3 then the parser will be strict and will stop in case of\n        well-formedness errors or DTD errors.\n\n    \"\"\"\n    arg_7 = etree.XMLParser(dtd_validation=arg_3,\n                             recover=(arg_1 <= 3))\n    if arg_3:\n        arg_0 = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' \\\n                  '<collection>\\n%s\\n</collection>' % (arg_0,)\n    try:\n        arg_8 = etree.parse(StringIO(arg_0), arg_7)\n        # parser errors are located in parser.error_log\n        # if 1 <= verbose <=3 then show them to the user?\n        # if verbose == 0 then continue\n        # if verbose >3 then an exception will be thrown\n    except Exception as e:\n        raise InvenioBibRecordParserError(str(e))\n\n    arg_9 = {}\n    arg_10 = 0\n\n    arg_11 = arg_8.iter(arg_13='{*}controlfield')\n    for arg_12 in arg_11:\n        arg_13 = arg_12.attrib.get('tag', '!').encode(\"UTF-8\")\n        arg_14 = ' '\n        arg_15 = ' '\n        arg_16 = arg_12.text\n        if arg_16 is None:\n            arg_16 = ''\n        else:\n            arg_16 = arg_16.encode(\"UTF-8\")\n        arg_17 = []\n        if arg_16 or arg_5:\n            arg_10 += 1\n            arg_9.setdefault(arg_13, []).append((arg_17, arg_14, arg_15, arg_16,\n                                               arg_10))\n\n    arg_18 = arg_8.iter(arg_13='{*}datafield')\n    for arg_19 in arg_18:\n        arg_13 = arg_19.attrib.get('tag', '!').encode(\"UTF-8\")\n        arg_14 = arg_19.attrib.get('ind1', '!').encode(\"UTF-8\")\n        arg_15 = arg_19.attrib.get('ind2', '!').encode(\"UTF-8\")\n        if arg_14 in ('', '_'):\n            arg_14 = ' '\n        if arg_15 in ('', '_'):\n            arg_15 = ' '\n        arg_17 = []\n        arg_20 = arg_19.iter(arg_13='{*}subfield')\n        for arg_21 in arg_20:\n            arg_22 = arg_21.attrib.get('code', '!').encode(\"UTF-8\")\n            arg_16 = arg_21.text\n            if arg_16 is None:\n                arg_16 = ''\n            else:\n                arg_16 = arg_16.encode(\"UTF-8\")\n            if arg_16 or arg_5:\n                arg_17.append((arg_22, arg_16))\n        if arg_17 or arg_5:\n            arg_16 = ''\n            arg_10 += 1\n            arg_9.setdefault(arg_13, []).append((arg_17, arg_14, arg_15, arg_16,\n                                               arg_10))\n\n    return arg_9", "path": "harvestingkit/bibrecord.py", "identifier": "_create_record_lxml", "docstring": "Create a record object using the LXML parser.\n\n    If correct == 1, then perform DTD validation\n    If correct == 0, then do not perform DTD validation\n\n    If verbose == 0, the parser will not give warnings.\n    If 1 <= verbose <= 3, the parser will not give errors, but will warn\n        the user about possible mistakes (implement me!)\n    If verbose > 3 then the parser will be strict and will stop in case of\n        well-formedness errors or DTD errors.", "docstring_tokens": ["Create", "a", "record", "object", "using", "the", "LXML", "parser", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 254701}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L282-L301", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Convert a python dict to a dict containing valid environment variable\n    values.", "language": "python", "parameters": "(d, pathsep=os.pathsep)", "return_statement": "return out_env", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "pathsep", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "arg_5", ",", "list", ")", ":", "arg_3", "[", "arg_4", "]", "=", "arg_1", ".", "join", "(", "arg_5", ")", "elif", "isinstance", "(", "arg_5", ",", "string_types", ")", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", "else", ":", "raise", "TypeError", "(", "'{} not a valid env var type'", ".", "format", "(", "type", "(", "arg_5", ")", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=arg_2.pathsep):\n    '''\n    Convert a python dict to a dict containing valid environment variable\n    values.\n\n    :param d: Dict to convert to an env dict\n    :param pathsep: Path separator used to join lists(default os.pathsep)\n    '''\n\n    arg_3 = {}\n\n    for arg_4, arg_5 in arg_0.iteritems():\n        if isinstance(arg_5, list):\n            arg_3[arg_4] = arg_1.join(arg_5)\n        elif isinstance(arg_5, string_types):\n            arg_3[arg_4] = arg_5\n        else:\n            raise TypeError('{} not a valid env var type'.format(type(arg_5)))\n\n    return arg_3", "path": "cpenv/utils.py", "identifier": "dict_to_env", "docstring": "Convert a python dict to a dict containing valid environment variable\n    values.\n\n    :param d: Dict to convert to an env dict\n    :param pathsep: Path separator used to join lists(default os.pathsep)", "docstring_tokens": ["Convert", "a", "python", "dict", "to", "a", "dict", "containing", "valid", "environment", "variable", "values", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 254702}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L1642-L1654", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Reads out a row and returns a dictionary containing the row content.", "language": "python", "parameters": "(colnames, row)", "return_statement": "return result_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_0", ":", "arg_2", "[", "arg_3", "]", "=", "arg_1", "[", "arg_3", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Reads out a row and returns a dictionary containing the row content.\n\n        :param colnames: List of column names\n        :param row:  A pytables table row\n        :return: A dictionary with colnames as keys and content as values\n\n        \"\"\"\n        arg_2 = {}\n        for arg_3 in arg_0:\n            arg_2[arg_3] = arg_1[arg_3]\n\n        return arg_2", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._trj_read_out_row", "docstring": "Reads out a row and returns a dictionary containing the row content.\n\n        :param colnames: List of column names\n        :param row:  A pytables table row\n        :return: A dictionary with colnames as keys and content as values", "docstring_tokens": ["Reads", "out", "a", "row", "and", "returns", "a", "dictionary", "containing", "the", "row", "content", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254703}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3506-L3543", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Loops according to ECX counter.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "16", ":", "'CX'", ",", "32", ":", "'ECX'", ",", "64", ":", "'RCX'", "}", "[", "arg_0", ".", "address_bit_size", "]", "arg_3", "=", "arg_0", ".", "write_register", "(", "arg_2", ",", "arg_0", ".", "read_register", "(", "arg_2", ")", "-", "1", ")", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "arg_3", "==", "0", ",", "(", "arg_0", ".", "PC", "+", "arg_1", ".", "read", "(", ")", ")", "&", "(", "(", "1", "<<", "arg_1", ".", "size", ")", "-", "1", ")", ",", "arg_0", ".", "PC", "+", "arg_0", ".", "instruction", ".", "size", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Loops according to ECX counter.\n\n        Performs a loop operation using the ECX or CX register as a counter.\n        Each time the Func instruction is executed, the count register is decremented,\n        then checked for 0. If the count is 0, the loop is terminated and program\n        execution continues with the instruction following the Func instruction.\n        If the count is not zero, a near jump is performed to the destination\n        (target) operand, which is presumably the instruction at the beginning\n        of the loop. If the address-size attribute is 32 bits, the ECX register\n        is used as the count register; otherwise the CX register is used::\n\n                IF address_bit_size  =  32\n                THEN\n                    Count is ECX;\n                ELSE (* address_bit_size  =  16 *)\n                    Count is CX;\n                FI;\n                Count  =  Count - 1;\n\n                IF (Count  0)  =  1\n                THEN\n                    EIP  =  EIP + SignExtend(DEST);\n                    IF OperandSize  =  16\n                    THEN\n                        EIP  =  EIP AND 0000FFFFH;\n                    FI;\n                ELSE\n                    Terminate loop and continue program execution at EIP;\n                FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        \"\"\"\n        arg_2 = {16: 'CX', 32: 'ECX', 64: 'RCX'}[arg_0.address_bit_size]\n        arg_3 = arg_0.write_register(arg_2, arg_0.read_register(arg_2) - 1)\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, arg_3 == 0, (arg_0.PC + arg_1.read()) & ((1 << arg_1.size) - 1), arg_0.PC + arg_0.instruction.size)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.LOOP", "docstring": "Loops according to ECX counter.\n\n        Performs a loop operation using the ECX or CX register as a counter.\n        Each time the LOOP instruction is executed, the count register is decremented,\n        then checked for 0. If the count is 0, the loop is terminated and program\n        execution continues with the instruction following the LOOP instruction.\n        If the count is not zero, a near jump is performed to the destination\n        (target) operand, which is presumably the instruction at the beginning\n        of the loop. If the address-size attribute is 32 bits, the ECX register\n        is used as the count register; otherwise the CX register is used::\n\n                IF address_bit_size  =  32\n                THEN\n                    Count is ECX;\n                ELSE (* address_bit_size  =  16 *)\n                    Count is CX;\n                FI;\n                Count  =  Count - 1;\n\n                IF (Count  0)  =  1\n                THEN\n                    EIP  =  EIP + SignExtend(DEST);\n                    IF OperandSize  =  16\n                    THEN\n                        EIP  =  EIP AND 0000FFFFH;\n                    FI;\n                ELSE\n                    Terminate loop and continue program execution at EIP;\n                FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Loops", "according", "to", "ECX", "counter", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254704}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/validator.py#L53-L66", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Returns whether the bundle is valid.", "language": "python", "parameters": "(self)", "return_statement": "return not self._errors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_errors", ":", "try", ":", "arg_0", ".", "_errors", ".", "append", "(", "next", "(", "arg_0", ".", "_validator", ")", ")", "except", "StopIteration", ":", "pass", "return", "not", "arg_0", ".", "_errors"], "function": "def Func(arg_0):\n        # type: () -> bool\n        \"\"\"\n        Returns whether the bundle is valid.\n        \"\"\"\n        if not arg_0._errors:\n            try:\n                # We only have to check for a single error to determine\n                # if the bundle is valid or not.\n                arg_0._errors.append(next(arg_0._validator))\n            except StopIteration:\n                pass\n\n        return not arg_0._errors", "path": "iota/transaction/validator.py", "identifier": "BundleValidator.is_valid", "docstring": "Returns whether the bundle is valid.", "docstring_tokens": ["Returns", "whether", "the", "bundle", "is", "valid", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 254705}
{"url": "https://github.com/nephila/djangocms-installer/blob/9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e/djangocms_installer/django/__init__.py#L405-L445", "sha": "9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e", "docstring_summary": "Run the migrate command to create the database schema", "language": "python", "parameters": "(config_data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "chdir", "(", "arg_0", ".", "project_directory", ")", ":", "arg_1", "=", "deepcopy", "(", "dict", "(", "os", ".", "environ", ")", ")", "arg_1", "[", "arg_2", "(", "'DJANGO_SETTINGS_MODULE'", ")", "]", "=", "arg_2", "(", "'{0}.settings'", ".", "format", "(", "arg_0", ".", "project_name", ")", ")", "arg_1", "[", "arg_2", "(", "'PYTHONPATH'", ")", "]", "=", "arg_2", "(", "os", ".", "pathsep", ".", "join", "(", "map", "(", "shlex_quote", ",", "sys", ".", "path", ")", ")", ")", "arg_3", "=", "[", "]", "arg_3", ".", "append", "(", "[", "sys", ".", "executable", ",", "'-W'", ",", "'ignore'", ",", "'manage.py'", ",", "'migrate'", "]", ",", ")", "if", "arg_0", ".", "verbose", ":", "sys", ".", "stdout", ".", "write", "(", "'Database setup commands: {0}\\n'", ".", "format", "(", "', '", ".", "join", "(", "[", "' '", ".", "join", "(", "arg_4", ")", "for", "arg_4", "in", "arg_3", "]", ")", ")", ")", "for", "arg_5", "in", "arg_3", ":", "try", ":", "arg_6", "=", "subprocess", ".", "check_output", "(", "arg_5", ",", "arg_1", "=", "arg_1", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", "sys", ".", "stdout", ".", "write", "(", "arg_6", ".", "decode", "(", "'utf-8'", ")", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "if", "arg_0", ".", "verbose", ":", "sys", ".", "stdout", ".", "write", "(", "e", ".", "output", ".", "decode", "(", "'utf-8'", ")", ")", "raise", "if", "not", "arg_0", ".", "no_user", ":", "sys", ".", "stdout", ".", "write", "(", "'Creating admin user\\n'", ")", "if", "arg_0", ".", "noinput", ":", "create_user", "(", "arg_0", ")", "else", ":", "subprocess", ".", "check_call", "(", "' '", ".", "join", "(", "[", "sys", ".", "executable", ",", "'-W'", ",", "'ignore'", ",", "'manage.py'", ",", "'createsuperuser'", "]", ")", ",", "shell", "=", "True", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Run the migrate command to create the database schema\n\n    :param config_data: configuration data\n    \"\"\"\n    with chdir(arg_0.project_directory):\n        arg_1 = deepcopy(dict(os.environ))\n        arg_1[arg_2('DJANGO_SETTINGS_MODULE')] = arg_2('{0}.settings'.format(arg_0.project_name))\n        arg_1[arg_2('PYTHONPATH')] = arg_2(os.pathsep.join(map(shlex_quote, sys.path)))\n        arg_3 = []\n\n        arg_3.append(\n            [sys.executable, '-W', 'ignore', 'manage.py', 'migrate'],\n        )\n\n        if arg_0.verbose:\n            sys.stdout.write(\n                'Database setup commands: {0}\\n'.format(\n                    ', '.join([' '.join(arg_4) for arg_4 in arg_3])\n                )\n            )\n        for arg_5 in arg_3:\n            try:\n                arg_6 = subprocess.check_output(\n                    arg_5, arg_1=arg_1, stderr=subprocess.STDOUT\n                )\n                sys.stdout.write(arg_6.decode('utf-8'))\n            except subprocess.CalledProcessError as e:  # pragma: no cover\n                if arg_0.verbose:\n                    sys.stdout.write(e.output.decode('utf-8'))\n                raise\n\n        if not arg_0.no_user:\n            sys.stdout.write('Creating admin user\\n')\n            if arg_0.noinput:\n                create_user(arg_0)\n            else:\n                subprocess.check_call(' '.join(\n                    [sys.executable, '-W', 'ignore', 'manage.py', 'createsuperuser']\n                ), shell=True, stderr=subprocess.STDOUT)", "path": "djangocms_installer/django/__init__.py", "identifier": "setup_database", "docstring": "Run the migrate command to create the database schema\n\n    :param config_data: configuration data", "docstring_tokens": ["Run", "the", "migrate", "command", "to", "create", "the", "database", "schema"], "nwo": "nephila/djangocms-installer", "score": 0.7157994486187137, "idx": 254706}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/event_looper.py#L148-L153", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Triggers expired timers", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "time", ".", "time", "(", ")", "while", "len", "(", "arg_0", ".", "timer_tasks", ")", ">", "0", "and", "(", "arg_0", ".", "timer_tasks", "[", "0", "]", "[", "0", "]", "-", "arg_1", "<=", "0", ")", ":", "arg_2", "=", "heappop", "(", "arg_0", ".", "timer_tasks", ")", "[", "1", "]", "arg_2", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Triggers expired timers\"\"\"\n    arg_1 = time.time()\n    while len(arg_0.timer_tasks) > 0 and (arg_0.timer_tasks[0][0] - arg_1 <= 0):\n      arg_2 = heappop(arg_0.timer_tasks)[1]\n      arg_2()", "path": "heron/instance/src/python/network/event_looper.py", "identifier": "EventLooper._trigger_timers", "docstring": "Triggers expired timers", "docstring_tokens": ["Triggers", "expired", "timers"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254707}
{"url": "https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L94-L100", "sha": "9d0e8ebcba31d937f73752f9b88e5a4fec860765", "docstring_summary": "Remove key name from bucket set.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return super(Bucket, self)._delete_key_internal(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "mimicdb", ".", "backend", ".", "srem", "(", "tpl", ".", "bucket", "%", "arg_0", ".", "name", ",", "arg_1", "[", "0", "]", ")", "mimicdb", ".", "backend", ".", "delete", "(", "tpl", ".", "key", "%", "(", "arg_0", ".", "name", ",", "arg_1", "[", "0", "]", ")", ")", "return", "super", "(", "Bucket", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Remove key name from bucket set.\n        \"\"\"\n        mimicdb.backend.srem(tpl.bucket % arg_0.name, arg_1[0])\n        mimicdb.backend.delete(tpl.key % (arg_0.name, arg_1[0]))\n\n        return super(Bucket, arg_0).Func(*arg_1, **arg_2)", "path": "mimicdb/s3/bucket.py", "identifier": "Bucket._delete_key_internal", "docstring": "Remove key name from bucket set.", "docstring_tokens": ["Remove", "key", "name", "from", "bucket", "set", "."], "nwo": "nathancahill/mimicdb", "score": 0.18112697196067942, "idx": 254708}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L302-L324", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Adds a cancel button to let the user cancel whatever choice they were given.\n        \n        This widget can be triggered by setting the label ``label_cancel`` to a string.\n        \n        This widget will be positioned slightly below the main label and to the right\n        of the confirm button.", "language": "python", "parameters": "(self,label_cancel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "wbtn_cancel", "=", "button", ".", "Button", "(", "\"btn_cancel\"", ",", "arg_0", ",", "arg_0", ".", "window", ",", "arg_0", ".", "peng", ",", "pos", "=", "lambda", "sw", ",", "sh", ",", "bw", ",", "bh", ":", "(", "sw", "/", "2", "+", "4", ",", "sh", "/", "2", "-", "bh", "/", "2", "-", "bh", "*", "2", ")", ",", "arg_3", "=", "[", "0", ",", "0", "]", ",", "label", "=", "arg_1", ",", "borderstyle", "=", "arg_0", ".", "borderstyle", ")", "arg_0", ".", "wbtn_cancel", ".", "size", "=", "lambda", "sw", ",", "sh", ":", "(", "arg_0", ".", "wbtn_cancel", ".", "_label", ".", "font_size", "*", "8", ",", "arg_0", ".", "wbtn_cancel", ".", "_label", ".", "font_size", "*", "2", ")", "arg_0", ".", "addWidget", "(", "arg_0", ".", "wbtn_cancel", ")", "def", "f", "(", ")", ":", "arg_0", ".", "doAction", "(", "\"cancel\"", ")", "arg_0", ".", "exitDialog", "(", ")", "arg_0", ".", "wbtn_cancel", ".", "addAction", "(", "\"click\"", ",", "f", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Adds a cancel button to let the user cancel whatever choice they were given.\n        \n        This widget can be triggered by setting the label ``label_cancel`` to a string.\n        \n        This widget will be positioned slightly below the main label and to the right\n        of the confirm button.\n        \"\"\"\n        # Cancel Button\n        arg_0.wbtn_cancel = button.Button(\"btn_cancel\",arg_0,arg_0.window,arg_0.peng,\n                        pos=lambda sw,sh, bw,bh: (sw/2+4,sh/2-bh/2-bh*2),\n                        arg_3=[0,0],\n                        label=arg_1,\n                        borderstyle=arg_0.borderstyle\n                        )\n        arg_0.wbtn_cancel.size = lambda sw,sh: (arg_0.wbtn_cancel._label.font_size*8,arg_0.wbtn_cancel._label.font_size*2)\n        arg_0.addWidget(arg_0.wbtn_cancel)\n        \n        def f():\n            arg_0.doAction(\"cancel\")\n            arg_0.exitDialog()\n        arg_0.wbtn_cancel.addAction(\"click\",f)", "path": "peng3d/gui/menus.py", "identifier": "ConfirmSubMenu.add_btn_cancel", "docstring": "Adds a cancel button to let the user cancel whatever choice they were given.\n        \n        This widget can be triggered by setting the label ``label_cancel`` to a string.\n        \n        This widget will be positioned slightly below the main label and to the right\n        of the confirm button.", "docstring_tokens": ["Adds", "a", "cancel", "button", "to", "let", "the", "user", "cancel", "whatever", "choice", "they", "were", "given", ".", "This", "widget", "can", "be", "triggered", "by", "setting", "the", "label", "label_cancel", "to", "a", "string", ".", "This", "widget", "will", "be", "positioned", "slightly", "below", "the", "main", "label", "and", "to", "the", "right", "of", "the", "confirm", "button", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 254709}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/clinvar.py#L124-L157", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Adds submission_objects to clinvar collection and update the coresponding submission object with their id", "language": "python", "parameters": "(self, submission_id, submission_objects)", "return_statement": "return updated_submission", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "LOG", ".", "info", "(", "\"Adding new variants and case data to clinvar submission '%s'\"", ",", "arg_1", ")", "for", "arg_3", "in", "arg_2", "[", "0", "]", ":", "try", ":", "arg_4", "=", "arg_0", ".", "clinvar_collection", ".", "insert_one", "(", "arg_3", ")", "arg_0", ".", "clinvar_submission_collection", ".", "update_one", "(", "{", "'_id'", ":", "arg_1", "}", ",", "{", "'$push'", ":", "{", "'variant_data'", ":", "str", "(", "arg_4", ".", "inserted_id", ")", "}", "}", ",", "upsert", "=", "True", ")", "except", "pymongo", ".", "errors", ".", "DuplicateKeyError", ":", "LOG", ".", "error", "(", "\"Attepted to insert a clinvar variant which is already in DB!\"", ")", "if", "arg_2", "[", "1", "]", ":", "for", "arg_5", "in", "arg_2", "[", "1", "]", ":", "try", ":", "arg_4", "=", "arg_0", ".", "clinvar_collection", ".", "insert_one", "(", "arg_5", ")", "arg_0", ".", "clinvar_submission_collection", ".", "update_one", "(", "{", "'_id'", ":", "arg_1", "}", ",", "{", "'$push'", ":", "{", "'case_data'", ":", "str", "(", "arg_4", ".", "inserted_id", ")", "}", "}", ",", "upsert", "=", "True", ")", "except", "pymongo", ".", "errors", ".", "DuplicateKeyError", ":", "LOG", ".", "error", "(", "\"One or more casedata object is already present in clinvar collection!\"", ")", "arg_6", "=", "arg_0", ".", "clinvar_submission_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_1", "}", ",", "{", "'$set'", ":", "{", "'updated_at'", ":", "datetime", ".", "now", "(", ")", "}", "}", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Adds submission_objects to clinvar collection and update the coresponding submission object with their id\n\n            Args:\n                submission_id(str) : id of the submission to be updated\n                submission_objects(tuple): a tuple of 2 elements coresponding to a list of variants and a list of case data objects to add to submission\n\n            Returns:\n                updated_submission(obj): an open clinvar submission object, updated\n        \"\"\"\n\n        LOG.info(\"Adding new variants and case data to clinvar submission '%s'\", arg_1)\n\n        # Insert variant submission_objects into clinvar collection\n        # Loop over the objects\n        for arg_3 in arg_2[0]:\n            try:\n                arg_4 = arg_0.clinvar_collection.insert_one(arg_3)\n                arg_0.clinvar_submission_collection.update_one({'_id':arg_1}, {'$push': { 'variant_data' : str(arg_4.inserted_id) }}, upsert=True)\n            except pymongo.errors.DuplicateKeyError:\n                LOG.error(\"Attepted to insert a clinvar variant which is already in DB!\")\n\n        # Insert casedata submission_objects into clinvar collection\n        if arg_2[1]:\n            # Loop over the objects\n            for arg_5 in arg_2[1]:\n                try:\n                    arg_4 = arg_0.clinvar_collection.insert_one(arg_5)\n                    arg_0.clinvar_submission_collection.update_one({'_id':arg_1}, {'$push': { 'case_data': str(arg_4.inserted_id)}}, upsert=True)\n                except pymongo.errors.DuplicateKeyError:\n                    LOG.error(\"One or more casedata object is already present in clinvar collection!\")\n\n        arg_6 = arg_0.clinvar_submission_collection.find_one_and_update( {'_id':arg_1}, { '$set' : {'updated_at': datetime.now()} }, return_document=pymongo.ReturnDocument.AFTER )\n        return arg_6", "path": "scout/adapter/mongo/clinvar.py", "identifier": "ClinVarHandler.add_to_submission", "docstring": "Adds submission_objects to clinvar collection and update the coresponding submission object with their id\n\n            Args:\n                submission_id(str) : id of the submission to be updated\n                submission_objects(tuple): a tuple of 2 elements coresponding to a list of variants and a list of case data objects to add to submission\n\n            Returns:\n                updated_submission(obj): an open clinvar submission object, updated", "docstring_tokens": ["Adds", "submission_objects", "to", "clinvar", "collection", "and", "update", "the", "coresponding", "submission", "object", "with", "their", "id"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254710}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/connection_manager.py#L82-L87", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Get a default connection string.", "language": "python", "parameters": "(cls, connection: Optional[str] = None)", "return_statement": "return get_connection(cls.module_name, connection=connection)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "None", ")", "->", "arg_3", ":", "return", "get_connection", "(", "arg_0", ".", "module_name", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2[arg_3] = None) -> arg_3:\n        \"\"\"Get a default connection string.\n\n        Wraps :func:`bio2bel.utils.get_connection` and passing this class's :data:`module_name` to it.\n        \"\"\"\n        return get_connection(arg_0.module_name, arg_1=arg_1)", "path": "src/bio2bel/manager/connection_manager.py", "identifier": "ConnectionManager._get_connection", "docstring": "Get a default connection string.\n\n        Wraps :func:`bio2bel.utils.get_connection` and passing this class's :data:`module_name` to it.", "docstring_tokens": ["Get", "a", "default", "connection", "string", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 254711}
{"url": "https://github.com/opencast/pyCA/blob/c89b168d4780d157e1b3f7676628c1b131956a88/pyca/ui/jsonapi.py#L26-L30", "sha": "c89b168d4780d157e1b3f7676628c1b131956a88", "docstring_summary": "Return a response with a list of jsonapi data objects", "language": "python", "parameters": "(data, status=200)", "return_statement": "return make_response(jsonify(content), status)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "200", ")", ":", "arg_2", "=", "{", "'data'", ":", "ensurelist", "(", "arg_0", ")", "}", "return", "make_response", "(", "jsonify", "(", "arg_2", ")", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=200):\n    ''' Return a response with a list of jsonapi data objects\n    '''\n    arg_2 = {'data': ensurelist(arg_0)}\n    return make_response(jsonify(arg_2), arg_1)", "path": "pyca/ui/jsonapi.py", "identifier": "make_data_response", "docstring": "Return a response with a list of jsonapi data objects", "docstring_tokens": ["Return", "a", "response", "with", "a", "list", "of", "jsonapi", "data", "objects"], "nwo": "opencast/pyCA", "score": 0.38750565733100095, "idx": 254712}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/file/gadget.py#L5-L42", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Read header data from Gadget data file 'filename' with Gadget file\n\ttype 'gtype'. Returns offsets of positions and velocities.", "language": "python", "parameters": "(filename, seek=None)", "return_statement": "return Npart, posoffset+4, veloffset+4, header", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "'=I4sII'", "arg_3", "=", "'=I6I6dddii6iiiddddii6ii60xI'", "arg_4", "=", "(", "'Npart'", ",", "'Massarr'", ",", "'Time'", ",", "'Redshift'", ",", "'FlagSfr'", ",", "'FlagFeedback'", ",", "'Nall'", ",", "'FlagCooling'", ",", "'NumFiles'", ",", "'BoxSize'", ",", "'Omega0'", ",", "'OmegaLambda'", ",", "'HubbleParam'", ",", "'FlagAge'", ",", "'FlagMetals'", ",", "'NallHW'", ",", "'flag_entr_ics'", ",", "'filename'", ")", "arg_5", "=", "open", "(", "arg_0", ",", "'rb'", ")", "\"\"\"Detects Gadget file type (type 1 or 2; resp. without or with the 16\tbyte block headers).\"\"\"", "arg_6", "=", "struct", ".", "unpack", "(", "'I'", ",", "arg_5", ".", "read", "(", "4", ")", ")", "if", "arg_6", "[", "0", "]", "==", "8", ":", "arg_7", "=", "2", "else", ":", "arg_7", "=", "1", "if", "arg_7", "==", "2", ":", "arg_5", ".", "seek", "(", "16", ")", "else", ":", "arg_5", ".", "seek", "(", "0", ")", "if", "arg_1", "is", "not", "None", ":", "arg_5", ".", "seek", "(", "arg_1", ")", "arg_8", "=", "struct", ".", "unpack", "(", "arg_3", ",", "arg_5", ".", "read", "(", "264", ")", ")", "[", "1", ":", "-", "1", "]", "arg_9", "=", "(", "arg_8", "[", ":", "6", "]", ",", "arg_8", "[", "6", ":", "12", "]", ")", "+", "arg_8", "[", "12", ":", "16", "]", "+", "(", "arg_8", "[", "16", ":", "22", "]", ",", ")", "+", "arg_8", "[", "22", ":", "30", "]", "+", "(", "arg_8", "[", "30", ":", "36", "]", ",", "arg_8", "[", "36", "]", ",", "arg_0", ")", "arg_10", "=", "dict", "(", "list", "(", "zip", "(", "arg_4", ",", "arg_9", ")", ")", ")", "arg_5", ".", "close", "(", ")", "if", "arg_7", "==", "2", ":", "arg_11", "=", "(", "2", "*", "16", "+", "(", "8", "+", "256", ")", ")", "else", ":", "arg_11", "=", "(", "8", "+", "256", ")", "arg_12", "=", "sum", "(", "arg_10", "[", "'Npart'", "]", ")", "if", "arg_7", "==", "2", ":", "arg_13", "=", "3", "*", "16", "+", "(", "8", "+", "256", ")", "+", "(", "8", "+", "3", "*", "4", "*", "arg_12", ")", "else", ":", "arg_13", "=", "(", "8", "+", "256", ")", "+", "(", "8", "+", "3", "*", "4", "*", "arg_12", ")", "return", "arg_12", ",", "arg_11", "+", "4", ",", "arg_13", "+", "4", ",", "arg_10"], "function": "def Func(arg_0, arg_1=None):\n\t\"\"\"Read header data from Gadget data file 'filename' with Gadget file\n\ttype 'gtype'. Returns offsets of positions and velocities.\"\"\"\n\targ_2 = '=I4sII'                                # struct formatting string\n\targ_3 = '=I6I6dddii6iiiddddii6ii60xI'        # struct formatting string\n\targ_4 = ('Npart', 'Massarr', 'Time', 'Redshift', 'FlagSfr', 'FlagFeedback', 'Nall', 'FlagCooling', 'NumFiles', 'BoxSize', 'Omega0', 'OmegaLambda', 'HubbleParam', 'FlagAge', 'FlagMetals', 'NallHW', 'flag_entr_ics', 'filename')\n\targ_5 = open(arg_0, 'rb')\n\t\n\t\"\"\"Detects Gadget file type (type 1 or 2; resp. without or with the 16\n\tbyte block headers).\"\"\"\n\targ_6 = struct.unpack('I',arg_5.read(4))\n\tif arg_6[0] == 8:\n\t\targ_7 = 2\n\telse:\n\t\targ_7 = 1\n\tif arg_7 == 2:\n\t\targ_5.seek(16)\n\telse:\n\t \targ_5.seek(0)\n\tif arg_1 is not None:\n\t\targ_5.seek(arg_1)\n\targ_8 = struct.unpack(arg_3,arg_5.read(264))[1:-1]\n\targ_9 = (arg_8[:6], arg_8[6:12]) + arg_8[12:16] + (arg_8[16:22],) + arg_8[22:30] + (arg_8[30:36], arg_8[36], arg_0)\n\targ_10 = dict(list(zip(arg_4, arg_9)))\n\targ_5.close()\n\t\n\t\n\tif arg_7 == 2:\n\t\targ_11 = (2*16 + (8 + 256))\n\telse:\n\t\targ_11 = (8 + 256)\n\t\n\targ_12 = sum(arg_10['Npart'])\n\tif arg_7 == 2:\n\t\targ_13 = 3*16 + (8 + 256) + (8 + 3*4*arg_12)\n\telse:\n\t\targ_13= (8 + 256) + (8 + 3*4*arg_12)\n\treturn arg_12, arg_11+4, arg_13+4, arg_10", "path": "packages/vaex-core/vaex/file/gadget.py", "identifier": "getinfo", "docstring": "Read header data from Gadget data file 'filename' with Gadget file\n\ttype 'gtype'. Returns offsets of positions and velocities.", "docstring_tokens": ["Read", "header", "data", "from", "Gadget", "data", "file", "filename", "with", "Gadget", "file", "type", "gtype", ".", "Returns", "offsets", "of", "positions", "and", "velocities", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 254713}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L540-L550", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the default path in which thermochemical data is stored.", "language": "python", "parameters": "()", "return_statement": "return data_path", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "os", ".", "path", ".", "dirname", "(", "sys", ".", "modules", "[", "__name__", "]", ".", "__file__", ")", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "r'data/rao'", ")", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"\n    Calculate the default path in which thermochemical data is stored.\n\n    :returns: Default path.\n    \"\"\"\n\n    arg_0 = os.path.dirname(sys.modules[__name__].__file__)\n    arg_1 = os.path.join(arg_0, r'data/rao')\n    arg_1 = os.path.abspath(arg_1)\n    return arg_1", "path": "auxi/tools/chemistry/thermochemistry.py", "identifier": "_get_default_data_path_", "docstring": "Calculate the default path in which thermochemical data is stored.\n\n    :returns: Default path.", "docstring_tokens": ["Calculate", "the", "default", "path", "in", "which", "thermochemical", "data", "is", "stored", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 254714}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/parsing_util.py#L279-L297", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Code snippet from Python Cookbook, 2nd Edition by David Ascher,\n    Alex Martelli and Anna Ravenscroft; O'Reilly 2005", "language": "python", "parameters": "(iterable, length=2, overlap=0, padding=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", ",", "arg_2", "=", "0", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "iter", "(", "arg_0", ")", "arg_5", "=", "list", "(", "itertools", ".", "islice", "(", "arg_4", ",", "arg_1", ")", ")", "while", "len", "(", "arg_5", ")", "==", "arg_1", ":", "yield", "arg_5", "arg_5", "=", "arg_5", "[", "arg_1", "-", "arg_2", ":", "]", "arg_5", ".", "extend", "(", "itertools", ".", "islice", "(", "arg_4", ",", "arg_1", "-", "arg_2", ")", ")", "if", "arg_3", "and", "arg_5", ":", "arg_5", ".", "extend", "(", "itertools", ".", "repeat", "(", "None", ",", "arg_1", "-", "len", "(", "arg_5", ")", ")", ")", "yield", "arg_5"], "function": "def Func(arg_0, arg_1=2, arg_2=0, arg_3=True):\n    \"\"\" Code snippet from Python Cookbook, 2nd Edition by David Ascher,\n    Alex Martelli and Anna Ravenscroft; O'Reilly 2005\n\n    Problem: You have an iterable s and need to make another iterable whose\n    items are sublists (i.e., sliding Func), each of the same given length,\n    over s' items, with successive Func overlapping by a specified amount.\n\n    \"\"\"\n\n    arg_4 = iter(arg_0)\n    arg_5 = list(itertools.islice(arg_4, arg_1))\n    while len(arg_5) == arg_1:\n        yield arg_5\n        arg_5 = arg_5[arg_1-arg_2:]\n        arg_5.extend(itertools.islice(arg_4, arg_1-arg_2))\n    if arg_3 and arg_5:\n        arg_5.extend(itertools.repeat(None, arg_1-len(arg_5)))\n        yield arg_5", "path": "godot/parsing_util.py", "identifier": "windows", "docstring": "Code snippet from Python Cookbook, 2nd Edition by David Ascher,\n    Alex Martelli and Anna Ravenscroft; O'Reilly 2005\n\n    Problem: You have an iterable s and need to make another iterable whose\n    items are sublists (i.e., sliding windows), each of the same given length,\n    over s' items, with successive windows overlapping by a specified amount.", "docstring_tokens": ["Code", "snippet", "from", "Python", "Cookbook", "2nd", "Edition", "by", "David", "Ascher", "Alex", "Martelli", "and", "Anna", "Ravenscroft", ";", "O", "Reilly", "2005"], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 254715}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L114-L124", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Set the rotation of this body using a rotation matrix.", "language": "python", "parameters": "(self, rotation)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "if", "isinstance", "(", "Func", ",", "np", ".", "ndarray", ")", ":", "Func", "=", "Func", ".", "ravel", "(", ")", "arg_0", ".", "ode_body", ".", "setRotation", "(", "tuple", "(", "Func", ")", ")"], "function": "def Func(arg_0, Func):\n        '''Set the rotation of this body using a rotation matrix.\n\n        Parameters\n        ----------\n        rotation : sequence of 9 floats\n            The desired rotation matrix for this body.\n        '''\n        if isinstance(Func, np.ndarray):\n            Func = Func.ravel()\n        arg_0.ode_body.setRotation(tuple(Func))", "path": "pagoda/physics.py", "identifier": "Body.rotation", "docstring": "Set the rotation of this body using a rotation matrix.\n\n        Parameters\n        ----------\n        rotation : sequence of 9 floats\n            The desired rotation matrix for this body.", "docstring_tokens": ["Set", "the", "rotation", "of", "this", "body", "using", "a", "rotation", "matrix", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 254716}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L217-L221", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Obtain account name from private key", "language": "python", "parameters": "(self, wif)", "return_statement": "return self.getAccountFromPublicKey(pub)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "publickey_from_wif", "(", "arg_1", ")", "return", "arg_0", ".", "getAccountFromPublicKey", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Obtain account name from private key\n        \"\"\"\n        arg_2 = arg_0.publickey_from_wif(arg_1)\n        return arg_0.getAccountFromPublicKey(arg_2)", "path": "graphenecommon/wallet.py", "identifier": "Wallet.getAccountFromPrivateKey", "docstring": "Obtain account name from private key", "docstring_tokens": ["Obtain", "account", "name", "from", "private", "key"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 254717}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L122-L143", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Walk up a directory tree", "language": "python", "parameters": "(start_dir, depth=20)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "20", ")", ":", "arg_2", "=", "arg_0", "for", "arg_3", "in", "xrange", "(", "arg_1", ")", ":", "arg_4", "=", "os", ".", "listdir", "(", "arg_2", ")", "arg_5", ",", "arg_6", "=", "[", "]", ",", "[", "]", "for", "arg_7", "in", "arg_4", ":", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_7", ")", ")", ":", "arg_5", ".", "append", "(", "arg_7", ")", "else", ":", "arg_6", ".", "append", "(", "arg_7", ")", "yield", "arg_2", ",", "arg_5", ",", "arg_6", "arg_8", "=", "os", ".", "path", ".", "dirname", "(", "arg_2", ")", "if", "arg_8", "and", "not", "arg_8", "==", "arg_2", ":", "arg_2", "=", "arg_8", "else", ":", "break"], "function": "def Func(arg_0, arg_1=20):\n    '''\n    Walk up a directory tree\n    '''\n    arg_2 = arg_0\n\n    for arg_3 in xrange(arg_1):\n        arg_4 = os.listdir(arg_2)\n        arg_5, arg_6 = [], []\n        for arg_7 in arg_4:\n            if os.path.isdir(os.path.join(arg_2, arg_7)):\n                arg_5.append(arg_7)\n            else:\n                arg_6.append(arg_7)\n\n        yield arg_2, arg_5, arg_6\n\n        arg_8 = os.path.dirname(arg_2)\n        if arg_8 and not arg_8 == arg_2:\n            arg_2 = arg_8\n        else:\n            break", "path": "cpenv/utils.py", "identifier": "walk_up", "docstring": "Walk up a directory tree", "docstring_tokens": ["Walk", "up", "a", "directory", "tree"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 254718}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/lmm/_lmm.py#L530-L547", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Log of the marginal likelihood for arbitrary scale.", "language": "python", "parameters": "(self)", "return_statement": "return lml / 2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "scale", "arg_2", "=", "arg_0", ".", "_D", "arg_3", "=", "len", "(", "arg_0", ".", "_y", ")", "arg_4", "=", "-", "arg_0", ".", "_df", "*", "log2pi", "-", "arg_3", "*", "log", "(", "arg_1", ")", "arg_4", "-=", "sum", "(", "npsum", "(", "log", "(", "arg_5", ")", ")", "for", "arg_5", "in", "arg_2", ")", "arg_5", "=", "(", "mTQ", "-", "yTQ", "for", "(", "mTQ", ",", "yTQ", ")", "in", "zip", "(", "arg_0", ".", "_mTQ", ",", "arg_0", ".", "_yTQ", ")", ")", "arg_4", "-=", "sum", "(", "(", "arg_6", "/", "arg_7", ")", "@", "arg_6", "for", "(", "arg_6", ",", "arg_7", ")", "in", "zip", "(", "arg_5", ",", "arg_2", ")", ")", "/", "arg_1", "return", "arg_4", "/", "2"], "function": "def Func(arg_0):\n        \"\"\"\n        Log of the marginal likelihood for arbitrary scale.\n\n        Returns\n        -------\n        lml : float\n            Log of the marginal likelihood.\n        \"\"\"\n        arg_1 = arg_0.scale\n        arg_2 = arg_0._D\n        arg_3 = len(arg_0._y)\n        arg_4 = -arg_0._df * log2pi - arg_3 * log(arg_1)\n        arg_4 -= sum(npsum(log(arg_5)) for arg_5 in arg_2)\n        arg_5 = (mTQ - yTQ for (mTQ, yTQ) in zip(arg_0._mTQ, arg_0._yTQ))\n        arg_4 -= sum((arg_6 / arg_7) @ arg_6 for (arg_6, arg_7) in zip(arg_5, arg_2)) / arg_1\n\n        return arg_4 / 2", "path": "glimix_core/lmm/_lmm.py", "identifier": "LMM._lml_arbitrary_scale", "docstring": "Log of the marginal likelihood for arbitrary scale.\n\n        Returns\n        -------\n        lml : float\n            Log of the marginal likelihood.", "docstring_tokens": ["Log", "of", "the", "marginal", "likelihood", "for", "arbitrary", "scale", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 254719}
{"url": "https://github.com/phoikoi/sisy/blob/840c5463ab65488d34e99531f230e61f755d2d69/src/sisy/management/commands/sisy_heartbeat.py#L15-L22", "sha": "840c5463ab65488d34e99531f230e61f755d2d69", "docstring_summary": "Handle CLI command", "language": "python", "parameters": "(self, *args, **options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "try", ":", "while", "True", ":", "Channel", "(", "HEARTBEAT_CHANNEL", ")", ".", "send", "(", "{", "'time'", ":", "time", ".", "time", "(", ")", "}", ")", "time", ".", "sleep", "(", "HEARTBEAT_FREQUENCY", ")", "except", "KeyboardInterrupt", ":", "print", "(", "\"Received keyboard interrupt, exiting...\"", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Handle CLI command\"\"\"\n        try:\n            while True:\n                Channel(HEARTBEAT_CHANNEL).send({'time':time.time()})\n                time.sleep(HEARTBEAT_FREQUENCY)\n        except KeyboardInterrupt:\n            print(\"Received keyboard interrupt, exiting...\")", "path": "src/sisy/management/commands/sisy_heartbeat.py", "identifier": "Command.handle", "docstring": "Handle CLI command", "docstring_tokens": ["Handle", "CLI", "command"], "nwo": "phoikoi/sisy", "score": 0.0, "idx": 254720}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/text.py#L143-L151", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "manage message of different type and in the context of path", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "module", "not", "in", "arg_0", ".", "_modules", ":", "if", "arg_1", ".", "module", ":", "arg_0", ".", "writeln", "(", "\"************* Module %s\"", "%", "arg_1", ".", "module", ")", "arg_0", ".", "_modules", ".", "add", "(", "arg_1", ".", "module", ")", "else", ":", "arg_0", ".", "writeln", "(", "\"************* \"", ")", "arg_0", ".", "write_message", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"manage message of different type and in the context of path\"\"\"\n        if arg_1.module not in arg_0._modules:\n            if arg_1.module:\n                arg_0.writeln(\"************* Module %s\" % arg_1.module)\n                arg_0._modules.add(arg_1.module)\n            else:\n                arg_0.writeln(\"************* \")\n        arg_0.write_message(arg_1)", "path": "pylint/reporters/text.py", "identifier": "TextReporter.handle_message", "docstring": "manage message of different type and in the context of path", "docstring_tokens": ["manage", "message", "of", "different", "type", "and", "in", "the", "context", "of", "path"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254721}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/licenses.py#L76-L108", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "List all licenses for a given organization.", "language": "python", "parameters": "(self, orgId=None, **request_parameters)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ")", "arg_3", "=", "dict_from_items_with_values", "(", "arg_2", ",", "arg_1", "=", "arg_1", ",", ")", "arg_4", "=", "arg_0", ".", "_session", ".", "get_items", "(", "API_ENDPOINT", ",", "arg_3", "=", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "yield", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"List all licenses for a given organization.\n\n        If no orgId is specified, the default is the organization of the\n        authenticated user.\n\n        Args:\n            orgId(basestring): Specify the organization, by ID.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            GeneratorContainer: A GeneratorContainer which, when iterated,\n            yields the licenses returned by the Webex Teams query.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring)\n\n        arg_3 = dict_from_items_with_values(\n            arg_2,\n            arg_1=arg_1,\n        )\n\n        # API request - get items\n        arg_4 = arg_0._session.get_items(API_ENDPOINT, arg_3=arg_3)\n\n        # Yield license objects created from the returned JSON objects\n        for arg_5 in arg_4:\n            yield arg_0._object_factory(OBJECT_TYPE, arg_5)", "path": "webexteamssdk/api/licenses.py", "identifier": "LicensesAPI.list", "docstring": "List all licenses for a given organization.\n\n        If no orgId is specified, the default is the organization of the\n        authenticated user.\n\n        Args:\n            orgId(basestring): Specify the organization, by ID.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            GeneratorContainer: A GeneratorContainer which, when iterated,\n            yields the licenses returned by the Webex Teams query.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["List", "all", "licenses", "for", "a", "given", "organization", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 254722}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1628-L1658", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Takes a string argument and returns value as a tuple.\n    Needed for paramfile conversion from CLI to set_params args", "language": "python", "parameters": "(newvalue, dtype=str)", "return_statement": "return newvalue", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_0", "=", "tuple", "(", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "arg_2", ")", ":", "arg_0", "=", "arg_0", ".", "rstrip", "(", "\")\"", ")", ".", "strip", "(", "\"(\"", ")", "try", ":", "arg_0", "=", "tuple", "(", "[", "arg_1", "(", "i", ".", "strip", "(", ")", ")", "for", "i", "in", "arg_0", ".", "split", "(", "\",\"", ")", "]", ")", "except", "TypeError", ":", "arg_0", "=", "tuple", "(", "arg_1", "(", "arg_0", ")", ")", "except", "ValueError", ":", "LOGGER", ".", "info", "(", "\"Assembly.tuplecheck() failed to cast to {} - {}\"", ".", "format", "(", "arg_1", ",", "arg_0", ")", ")", "raise", "except", "Exception", "as", "inst", ":", "LOGGER", ".", "info", "(", "inst", ")", "raise", "SystemExit", "(", "\"\\nError: Param`{}` is not formatted correctly.\\n({})\\n\"", ".", "format", "(", "arg_0", ",", "inst", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Takes a string argument and returns value as a tuple.\n    Needed for paramfile conversion from CLI to set_params args\n    \"\"\"\n\n    if isinstance(arg_0, list):\n        arg_0 = tuple(arg_0)\n\n    if isinstance(arg_0, arg_2):\n        arg_0 = arg_0.rstrip(\")\").strip(\"(\")\n        try:\n            arg_0 = tuple([arg_1(i.strip()) for i in arg_0.split(\",\")])\n\n        ## Type error is thrown by tuple if it's applied to a non-iterable.\n        except TypeError:\n            arg_0 = tuple(arg_1(arg_0))\n\n        ## If dtype fails to cast any element of newvalue\n        except ValueError:\n            LOGGER.info(\"Assembly.tuplecheck() failed to cast to {} - {}\"\\\n                        .format(arg_1, arg_0))\n            raise\n\n        except Exception as inst:\n            LOGGER.info(inst)\n            raise SystemExit(\\\n            \"\\nError: Param`{}` is not formatted correctly.\\n({})\\n\"\\\n                 .format(arg_0, inst))\n\n    return arg_0", "path": "ipyrad/core/assembly.py", "identifier": "_tuplecheck", "docstring": "Takes a string argument and returns value as a tuple.\n    Needed for paramfile conversion from CLI to set_params args", "docstring_tokens": ["Takes", "a", "string", "argument", "and", "returns", "value", "as", "a", "tuple", ".", "Needed", "for", "paramfile", "conversion", "from", "CLI", "to", "set_params", "args"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 254723}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fir_design_helper.py#L308-L324", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Design an FIR lowpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass Hz, fstop Hz, and the desired passband ripple \r\n    d_pass dB and stopband attenuation d_stop dB all \r\n    relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "language": "python", "parameters": "(f_pass, f_stop, d_pass, d_stop, fs = 1.0, N_bump=5)", "return_statement": "return b", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "1.0", ",", "arg_5", "=", "5", ")", ":", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "lowpass_order", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "fsamp", "=", "arg_4", ")", "arg_10", "=", "arg_6", "arg_10", "+=", "arg_5", "arg_11", "=", "signal", ".", "remez", "(", "arg_10", ",", "arg_7", ",", "arg_8", "[", "0", ":", ":", "2", "]", ",", "arg_9", ",", "Hz", "=", "2", ")", "print", "(", "'Remez filter taps = %d.'", "%", "arg_10", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4 = 1.0, arg_5=5):\r\n    \"\"\"\r\n    Design an FIR lowpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass Hz, fstop Hz, and the desired passband ripple \r\n    d_pass dB and stopband attenuation d_stop dB all \r\n    relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018\r\n    \"\"\"\r\n    arg_6, arg_7, arg_8, arg_9 = lowpass_order(arg_0, arg_1, arg_2, arg_3, fsamp=arg_4)\r\n    # Bump up the order by N_bump to bring down the final d_pass & d_stop\r\n    arg_10 = arg_6\r\n    arg_10 += arg_5\r\n    arg_11 = signal.remez(arg_10, arg_7, arg_8[0::2], arg_9,Hz=2)\r\n    print('Remez filter taps = %d.' % arg_10)\r\n    return arg_11", "path": "sk_dsp_comm/fir_design_helper.py", "identifier": "fir_remez_lpf", "docstring": "Design an FIR lowpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass Hz, fstop Hz, and the desired passband ripple \r\n    d_pass dB and stopband attenuation d_stop dB all \r\n    relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "docstring_tokens": ["Design", "an", "FIR", "lowpass", "filter", "using", "remez", "with", "order", "determination", ".", "The", "filter", "order", "is", "determined", "based", "on", "f_pass", "Hz", "fstop", "Hz", "and", "the", "desired", "passband", "ripple", "d_pass", "dB", "and", "stopband", "attenuation", "d_stop", "dB", "all", "relative", "to", "a", "sampling", "rate", "of", "fs", "Hz", ".", "Mark", "Wickert", "October", "2016", "updated", "October", "2018"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 254724}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/pandoc/filters/deparagraph.py#L8-L35", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Panflute filter function that converts content wrapped in a Para to\n    Plain.", "language": "python", "parameters": "(element, doc)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Para", ")", ":", "if", "arg_0", ".", "next", "is", "not", "None", ":", "return", "arg_0", "elif", "arg_0", ".", "prev", "is", "not", "None", ":", "return", "arg_0", "return", "Plain", "(", "*", "arg_0", ".", "content", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Panflute filter function that converts content wrapped in a Para to\n    Plain.\n\n    Use this filter with pandoc as::\n\n        pandoc [..] --filter=lsstprojectmeta-Func\n\n    Only lone paragraphs are affected. Para elements with siblings (like a\n    second Para) are left unaffected.\n\n    This filter is useful for processing strings like titles or author names so\n    that the output isn't wrapped in paragraph tags. For example, without\n    this filter, pandoc converts a string ``\"The title\"`` to\n    ``<p>The title</p>`` in HTML. These ``<p>`` tags aren't useful if you\n    intend to put the title text in ``<h1>`` tags using your own templating\n    system.\n    \"\"\"\n    if isinstance(arg_0, Para):\n        # Check if siblings exist; don't process the paragraph in that case.\n        if arg_0.next is not None:\n            return arg_0\n        elif arg_0.prev is not None:\n            return arg_0\n\n        # Remove the Para wrapper from the lone paragraph.\n        # `Plain` is a container that isn't rendered as a paragraph.\n        return Plain(*arg_0.content)", "path": "lsstprojectmeta/pandoc/filters/deparagraph.py", "identifier": "deparagraph", "docstring": "Panflute filter function that converts content wrapped in a Para to\n    Plain.\n\n    Use this filter with pandoc as::\n\n        pandoc [..] --filter=lsstprojectmeta-deparagraph\n\n    Only lone paragraphs are affected. Para elements with siblings (like a\n    second Para) are left unaffected.\n\n    This filter is useful for processing strings like titles or author names so\n    that the output isn't wrapped in paragraph tags. For example, without\n    this filter, pandoc converts a string ``\"The title\"`` to\n    ``<p>The title</p>`` in HTML. These ``<p>`` tags aren't useful if you\n    intend to put the title text in ``<h1>`` tags using your own templating\n    system.", "docstring_tokens": ["Panflute", "filter", "function", "that", "converts", "content", "wrapped", "in", "a", "Para", "to", "Plain", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 254725}
{"url": "https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L239-L245", "sha": "86dc1ab27ce82dcc091ce127416cc3ee219e9bec", "docstring_summary": "Decode base64 coded part of the key.", "language": "python", "parameters": "(cls, pubkey_content)", "return_statement": "return decoded_key", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "base64", ".", "b64decode", "(", "arg_1", ".", "encode", "(", "\"ascii\"", ")", ")", "except", "(", "TypeError", ",", "binascii", ".", "Error", ")", ":", "raise", "MalformedDataError", "(", "\"Unable to decode the key\"", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Decode base64 coded part of the key.\"\"\"\n        try:\n            arg_2 = base64.b64decode(arg_1.encode(\"ascii\"))\n        except (TypeError, binascii.Error):\n            raise MalformedDataError(\"Unable to decode the key\")\n        return arg_2", "path": "sshpubkeys/keys.py", "identifier": "SSHKey.decode_key", "docstring": "Decode base64 coded part of the key.", "docstring_tokens": ["Decode", "base64", "coded", "part", "of", "the", "key", "."], "nwo": "ojarva/python-sshpubkeys", "score": 0.19584428074165744, "idx": 254726}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_abricate.py#L409-L474", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Generates the JSON report to plot the gene boxes", "language": "python", "parameters": "(self)", "return_statement": "return json_dic", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"plotData\"", ":", "[", "]", "}", "arg_2", "=", "{", "}", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_0", ".", "storage", ".", "values", "(", ")", ":", "arg_5", "=", "re", ".", "match", "(", "\"(.*)_abr\"", ",", "arg_4", "[", "\"log_file\"", "]", ")", ".", "groups", "(", ")", "[", "0", "]", "if", "arg_5", "not", "in", "arg_2", ":", "arg_2", "[", "arg_5", "]", "=", "{", "}", "arg_6", "=", "arg_0", ".", "_get_contig_id", "(", "arg_4", "[", "\"reference\"", "]", ")", "arg_7", "=", "arg_4", "[", "\"database\"", "]", "if", "arg_7", "not", "in", "arg_2", "[", "arg_5", "]", ":", "arg_2", "[", "arg_5", "]", "[", "arg_7", "]", "=", "[", "]", "if", "arg_5", "not", "in", "arg_3", ":", "arg_3", "[", "arg_5", "]", "=", "arg_4", "[", "\"infile\"", "]", "arg_2", "[", "arg_5", "]", "[", "arg_7", "]", ".", "append", "(", "{", "\"contig\"", ":", "arg_6", ",", "\"seqRange\"", ":", "arg_4", "[", "\"seq_range\"", "]", ",", "\"gene\"", ":", "arg_4", "[", "\"gene\"", "]", ".", "replace", "(", "\"'\"", ",", "\"\"", ")", ",", "\"accession\"", ":", "arg_4", "[", "\"accession\"", "]", ",", "\"coverage\"", ":", "arg_4", "[", "\"coverage\"", "]", ",", "\"identity\"", ":", "arg_4", "[", "\"identity\"", "]", ",", "}", ",", ")", "for", "arg_8", ",", "arg_9", "in", "arg_2", ".", "items", "(", ")", ":", "arg_1", "[", "\"plotData\"", "]", ".", "append", "(", "{", "\"sample\"", ":", "arg_8", ",", "\"data\"", ":", "{", "\"abricateXrange\"", ":", "arg_9", "}", ",", "\"assemblyFile\"", ":", "arg_3", "[", "arg_8", "]", "}", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Generates the JSON report to plot the gene boxes\n\n        Following the convention of the reports platform, this method returns\n        a list of JSON/dict objects with the information about each entry in\n        the abricate file. The information contained in this JSON is::\n\n            {contig_id: <str>,\n             seqRange: [<int>, <int>],\n             gene: <str>,\n             accession: <str>,\n             coverage: <float>,\n             identity: <float>\n             }\n\n        Note that the `seqRange` entry contains the position in the\n        corresponding contig, not the absolute position in the whole assembly.\n\n        Returns\n        -------\n        json_dic : list\n            List of JSON/dict objects with the report data.\n        \"\"\"\n\n        arg_1 = {\"plotData\": []}\n        arg_2 = {}\n        arg_3 = {}\n\n        for arg_4 in arg_0.storage.values():\n\n            arg_5 = re.match(\"(.*)_abr\", arg_4[\"log_file\"]).groups()[0]\n            if arg_5 not in arg_2:\n                arg_2[arg_5] = {}\n\n            # Get contig ID using the same regex as in `assembly_report.py`\n            # template\n            arg_6 = arg_0._get_contig_id(arg_4[\"reference\"])\n            # Get database\n            arg_7 = arg_4[\"database\"]\n            if arg_7 not in arg_2[arg_5]:\n                arg_2[arg_5][arg_7] = []\n\n            # Update the sample-assembly correspondence dict\n            if arg_5 not in arg_3:\n                arg_3[arg_5] = arg_4[\"infile\"]\n\n            arg_2[arg_5][arg_7].append(\n                {\"contig\": arg_6,\n                 \"seqRange\": arg_4[\"seq_range\"],\n                 \"gene\": arg_4[\"gene\"].replace(\"'\", \"\"),\n                 \"accession\": arg_4[\"accession\"],\n                 \"coverage\": arg_4[\"coverage\"],\n                 \"identity\": arg_4[\"identity\"],\n                 },\n            )\n\n        for arg_8, arg_9 in arg_2.items():\n            arg_1[\"plotData\"].append(\n                {\n                    \"sample\": arg_8,\n                    \"data\": {\"abricateXrange\": arg_9},\n                    \"assemblyFile\": arg_3[arg_8]\n                }\n            )\n\n        return arg_1", "path": "flowcraft/templates/process_abricate.py", "identifier": "AbricateReport.get_plot_data", "docstring": "Generates the JSON report to plot the gene boxes\n\n        Following the convention of the reports platform, this method returns\n        a list of JSON/dict objects with the information about each entry in\n        the abricate file. The information contained in this JSON is::\n\n            {contig_id: <str>,\n             seqRange: [<int>, <int>],\n             gene: <str>,\n             accession: <str>,\n             coverage: <float>,\n             identity: <float>\n             }\n\n        Note that the `seqRange` entry contains the position in the\n        corresponding contig, not the absolute position in the whole assembly.\n\n        Returns\n        -------\n        json_dic : list\n            List of JSON/dict objects with the report data.", "docstring_tokens": ["Generates", "the", "JSON", "report", "to", "plot", "the", "gene", "boxes"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 254727}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L363-L370", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Callback function for URL defaults for this blueprint.  It's called\n        with the endpoint and values and should update the values passed\n        in place.", "language": "python", "parameters": "(self, f)", "return_statement": "return f", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "record_once", "(", "lambda", "s", ":", "s", ".", "app", ".", "url_default_functions", ".", "setdefault", "(", "arg_0", ".", "name", ",", "[", "]", ")", ".", "append", "(", "arg_1", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Callback function for URL defaults for this blueprint.  It's called\n        with the endpoint and values and should update the values passed\n        in place.\n        \"\"\"\n        arg_0.record_once(lambda s: s.app.url_default_functions\n            .setdefault(arg_0.name, []).append(arg_1))\n        return arg_1", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py", "identifier": "Blueprint.url_defaults", "docstring": "Callback function for URL defaults for this blueprint.  It's called\n        with the endpoint and values and should update the values passed\n        in place.", "docstring_tokens": ["Callback", "function", "for", "URL", "defaults", "for", "this", "blueprint", ".", "It", "s", "called", "with", "the", "endpoint", "and", "values", "and", "should", "update", "the", "values", "passed", "in", "place", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254728}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/animation/adaptor.py#L13-L63", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Adapt the setter in an animation's layout so that Strip animations can run\n    on on Matrix, Cube, or Circle layout, and Matrix or Cube animations can run\n    on a Strip layout.", "language": "python", "parameters": "(animation)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "layout", "arg_2", "=", "getattr", "(", "arg_0", ",", "'LAYOUT_CLASS'", ",", "None", ")", "if", "not", "arg_2", "or", "isinstance", "(", "arg_1", ",", "arg_2", ")", ":", "return", "arg_3", "=", "LAYOUT_WARNING", "%", "(", "type", "(", "arg_0", ")", ".", "__name__", ",", "arg_2", ".", "__name__", ",", "type", "(", "arg_1", ")", ".", "__name__", ")", "arg_4", "=", "arg_1", ".", "set", "arg_5", "=", "None", "if", "arg_2", "is", "strip", ".", "Strip", ":", "if", "isinstance", "(", "arg_1", ",", "matrix", ".", "Matrix", ")", ":", "arg_6", "=", "arg_1", ".", "width", "def", "arg_5", "(", "arg_7", ",", "arg_8", "=", "None", ")", ":", "arg_9", ",", "arg_10", "=", "divmod", "(", "arg_7", ",", "arg_6", ")", "arg_4", "(", "arg_10", ",", "arg_9", ",", "arg_8", "or", "BLACK", ")", "elif", "isinstance", "(", "arg_1", ",", "cube", ".", "Cube", ")", ":", "arg_11", ",", "arg_12", "=", "arg_1", ".", "x", ",", "arg_1", ".", "y", "def", "arg_5", "(", "arg_7", ",", "arg_8", "=", "None", ")", ":", "arg_13", ",", "arg_10", "=", "divmod", "(", "arg_7", ",", "arg_11", ")", "arg_14", ",", "arg_9", "=", "divmod", "(", "arg_13", ",", "arg_12", ")", "arg_4", "(", "arg_10", ",", "arg_9", ",", "arg_14", ",", "arg_8", "or", "BLACK", ")", "elif", "isinstance", "(", "arg_1", ",", "circle", ".", "Circle", ")", ":", "def", "arg_5", "(", "arg_7", ",", "arg_8", "=", "None", ")", ":", "arg_1", ".", "_set_base", "(", "arg_7", ",", "arg_8", "or", "BLACK", ")", "elif", "arg_2", "is", "matrix", ".", "Matrix", ":", "if", "isinstance", "(", "arg_1", ",", "strip", ".", "Strip", ")", ":", "arg_6", "=", "arg_0", ".", "width", "def", "arg_5", "(", "arg_10", ",", "arg_9", ",", "arg_8", "=", "None", ")", ":", "arg_4", "(", "arg_10", "+", "arg_9", "*", "arg_6", ",", "arg_8", "or", "BLACK", ")", "if", "not", "arg_5", ":", "raise", "ValueError", "(", "arg_3", ")", "log", ".", "warning", "(", "arg_3", ")", "arg_0", ".", "layout", ".", "set", "=", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"\n    Adapt the setter in an animation's layout so that Strip animations can run\n    on on Matrix, Cube, or Circle layout, and Matrix or Cube animations can run\n    on a Strip layout.\n    \"\"\"\n    arg_1 = arg_0.layout\n    arg_2 = getattr(arg_0, 'LAYOUT_CLASS', None)\n\n    if not arg_2 or isinstance(arg_1, arg_2):\n        return\n\n    arg_3 = LAYOUT_WARNING % (\n        type(arg_0).__name__, arg_2.__name__, type(arg_1).__name__)\n\n    arg_4 = arg_1.set\n    arg_5 = None\n\n    if arg_2 is strip.Strip:\n        if isinstance(arg_1, matrix.Matrix):\n            arg_6 = arg_1.width\n\n            def arg_5(arg_7, arg_8=None):\n                arg_9, arg_10 = divmod(arg_7, arg_6)\n                arg_4(arg_10, arg_9, arg_8 or BLACK)\n\n        elif isinstance(arg_1, cube.Cube):\n            arg_11, arg_12 = arg_1.x, arg_1.y\n\n            def arg_5(arg_7, arg_8=None):\n                arg_13, arg_10 = divmod(arg_7, arg_11)\n                arg_14, arg_9 = divmod(arg_13, arg_12)\n                arg_4(arg_10, arg_9, arg_14, arg_8 or BLACK)\n\n        elif isinstance(arg_1, circle.Circle):\n\n            def arg_5(arg_7, arg_8=None):\n                arg_1._set_base(arg_7, arg_8 or BLACK)\n\n    elif arg_2 is matrix.Matrix:\n        if isinstance(arg_1, strip.Strip):\n            arg_6 = arg_0.width\n\n            def arg_5(arg_10, arg_9, arg_8=None):\n                arg_4(arg_10 + arg_9 * arg_6, arg_8 or BLACK)\n\n    if not arg_5:\n        raise ValueError(arg_3)\n\n    log.warning(arg_3)\n    arg_0.layout.set = arg_5", "path": "bibliopixel/animation/adaptor.py", "identifier": "adapt_animation_layout", "docstring": "Adapt the setter in an animation's layout so that Strip animations can run\n    on on Matrix, Cube, or Circle layout, and Matrix or Cube animations can run\n    on a Strip layout.", "docstring_tokens": ["Adapt", "the", "setter", "in", "an", "animation", "s", "layout", "so", "that", "Strip", "animations", "can", "run", "on", "on", "Matrix", "Cube", "or", "Circle", "layout", "and", "Matrix", "or", "Cube", "animations", "can", "run", "on", "a", "Strip", "layout", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 254729}
{"url": "https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/cli.py#L121-L128", "sha": "71c798378e365286b7cc03c06e4d7d24c7de8fc4", "docstring_summary": "Main command line interface.", "language": "python", "parameters": "(argv=None)", "return_statement": "return cli.run(argv)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "sys", ".", "argv", "[", "1", ":", "]", "arg_1", "=", "CommandLineTool", "(", ")", "return", "arg_1", ".", "run", "(", "arg_0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Main command line interface.\"\"\"\n\n    if arg_0 is None:\n        arg_0 = sys.argv[1:]\n\n    arg_1 = CommandLineTool()\n    return arg_1.run(arg_0)", "path": "keyring/cli.py", "identifier": "main", "docstring": "Main command line interface.", "docstring_tokens": ["Main", "command", "line", "interface", "."], "nwo": "jaraco/keyring", "score": 0.7254776697026839, "idx": 254730}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/utils.py#L128-L155", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Parse a newsgroup info line to python types.", "language": "python", "parameters": "(line)", "return_statement": "return group, low, high, status", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "split", "(", ")", "try", ":", "arg_2", "=", "arg_1", "[", "0", "]", "arg_3", "=", "int", "(", "arg_1", "[", "1", "]", ")", "arg_4", "=", "int", "(", "arg_1", "[", "2", "]", ")", "arg_5", "=", "arg_1", "[", "3", "]", "except", "(", "IndexError", ",", "ValueError", ")", ":", "raise", "ValueError", "(", "\"Invalid newsgroup info\"", ")", "return", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"Parse a newsgroup info line to python types.\n\n    Args:\n        line: An info response line containing newsgroup info.\n\n    Returns:\n        A tuple of group name, low-water as integer, high-water as integer and\n        posting status.\n\n    Raises:\n        ValueError: If the newsgroup info cannot be parsed.\n\n    Note:\n        Posting status is a character is one of (but not limited to):\n            \"y\" posting allowed\n            \"n\" posting not allowed\n            \"m\" posting is moderated\n    \"\"\"\n    arg_1 = arg_0.split()\n    try:\n        arg_2 = arg_1[0]\n        arg_3 = int(arg_1[1])\n        arg_4 = int(arg_1[2])\n        arg_5 = arg_1[3]\n    except (IndexError, ValueError):\n        raise ValueError(\"Invalid newsgroup info\")\n    return arg_2, arg_3, arg_4, arg_5", "path": "nntp/utils.py", "identifier": "parse_newsgroup", "docstring": "Parse a newsgroup info line to python types.\n\n    Args:\n        line: An info response line containing newsgroup info.\n\n    Returns:\n        A tuple of group name, low-water as integer, high-water as integer and\n        posting status.\n\n    Raises:\n        ValueError: If the newsgroup info cannot be parsed.\n\n    Note:\n        Posting status is a character is one of (but not limited to):\n            \"y\" posting allowed\n            \"n\" posting not allowed\n            \"m\" posting is moderated", "docstring_tokens": ["Parse", "a", "newsgroup", "info", "line", "to", "python", "types", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 254731}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_common_error.py#L29-L34", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Simple error handler for azure.", "language": "python", "parameters": "(http_error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "str", "(", "arg_0", ")", "if", "arg_0", ".", "respbody", "is", "not", "None", ":", "arg_1", "+=", "'\\n'", "+", "arg_0", ".", "respbody", ".", "decode", "(", "'utf-8-sig'", ")", "raise", "AzureHttpError", "(", "arg_1", ",", "arg_0", ".", "status", ")"], "function": "def Func(arg_0):\n    ''' Simple error handler for azure.'''\n    arg_1 = str(arg_0)\n    if arg_0.respbody is not None:\n        arg_1 += '\\n' + arg_0.respbody.decode('utf-8-sig')\n    raise AzureHttpError(arg_1, arg_0.status)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_common_error.py", "identifier": "_general_error_handler", "docstring": "Simple error handler for azure.", "docstring_tokens": ["Simple", "error", "handler", "for", "azure", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254732}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/scripts/run_experiment_classifier_diff.py#L36-L51", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Run according to options in sys.argv and diff classifiers.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "initLogging", "(", "verbose", "=", "True", ")", "initExperimentPrng", "(", ")", "@", "staticmethod", "def", "_mockCreate", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_1", ".", "pop", "(", "'implementation'", ",", "None", ")", "return", "SDRClassifierDiff", "(", "*", "arg_0", ",", "**", "arg_1", ")", "arg_2", ".", "create", "=", "_mockCreate", "runExperiment", "(", "sys", ".", "argv", "[", "1", ":", "]", ")"], "function": "def Func():\n  \"\"\"Run according to options in sys.argv and diff classifiers.\"\"\"\n  initLogging(verbose=True)\n\n  # Initialize PRNGs\n  initExperimentPrng()\n\n  # Mock out the creation of the SDRClassifier.\n  @staticmethod\n  def _mockCreate(*arg_0, **arg_1):\n    arg_1.pop('implementation', None)\n    return SDRClassifierDiff(*arg_0, **arg_1)\n  arg_2.create = _mockCreate\n\n  # Run it!\n  runExperiment(sys.argv[1:])", "path": "scripts/run_experiment_classifier_diff.py", "identifier": "main", "docstring": "Run according to options in sys.argv and diff classifiers.", "docstring_tokens": ["Run", "according", "to", "options", "in", "sys", ".", "argv", "and", "diff", "classifiers", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254733}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/download.py#L688-L727", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Unpack link into location.\n    If download_dir is provided and link points to a file, make a copy\n    of the link file inside download_dir.", "language": "python", "parameters": "(link, location, download_dir=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "url_to_path", "(", "arg_0", ".", "url_without_fragment", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "rmtree", "(", "arg_1", ")", "shutil", ".", "copytree", "(", "arg_3", ",", "arg_1", ",", "symlinks", "=", "True", ")", "if", "arg_2", ":", "logger", ".", "info", "(", "'Link is a directory, ignoring download_dir'", ")", "return", "if", "arg_0", ".", "hash", ":", "arg_4", "=", "_get_hash_from_file", "(", "arg_3", ",", "arg_0", ")", "_check_hash", "(", "arg_4", ",", "arg_0", ")", "arg_5", "=", "None", "if", "arg_2", ":", "arg_5", "=", "_check_download_dir", "(", "arg_0", ",", "arg_2", ")", "if", "arg_5", ":", "arg_6", "=", "arg_5", "else", ":", "arg_6", "=", "arg_3", "arg_7", "=", "mimetypes", ".", "guess_type", "(", "arg_6", ")", "[", "0", "]", "unpack_file", "(", "arg_6", ",", "arg_1", ",", "arg_7", ",", "arg_0", ")", "if", "arg_2", "and", "not", "arg_5", ":", "_copy_file", "(", "arg_6", ",", "arg_2", ",", "arg_7", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Unpack link into location.\n    If download_dir is provided and link points to a file, make a copy\n    of the link file inside download_dir.\"\"\"\n\n    arg_3 = url_to_path(arg_0.url_without_fragment)\n\n    # If it's a url to a local directory\n    if os.path.isdir(arg_3):\n        if os.path.isdir(arg_1):\n            rmtree(arg_1)\n        shutil.copytree(arg_3, arg_1, symlinks=True)\n        if arg_2:\n            logger.info('Link is a directory, ignoring download_dir')\n        return\n\n    # if link has a hash, let's confirm it matches\n    if arg_0.hash:\n        arg_4 = _get_hash_from_file(arg_3, arg_0)\n        _check_hash(arg_4, arg_0)\n\n    # If a download dir is specified, is the file already there and valid?\n    arg_5 = None\n    if arg_2:\n        arg_5 = _check_download_dir(arg_0, arg_2)\n\n    if arg_5:\n        arg_6 = arg_5\n    else:\n        arg_6 = arg_3\n\n    arg_7 = mimetypes.guess_type(arg_6)[0]\n\n    # unpack the archive to the build dir location. even when only downloading\n    # archives, they have to be unpacked to parse dependencies\n    unpack_file(arg_6, arg_1, arg_7, arg_0)\n\n    # a download dir is specified and not already downloaded\n    if arg_2 and not arg_5:\n        _copy_file(arg_6, arg_2, arg_7, arg_0)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/download.py", "identifier": "unpack_file_url", "docstring": "Unpack link into location.\n    If download_dir is provided and link points to a file, make a copy\n    of the link file inside download_dir.", "docstring_tokens": ["Unpack", "link", "into", "location", ".", "If", "download_dir", "is", "provided", "and", "link", "points", "to", "a", "file", "make", "a", "copy", "of", "the", "link", "file", "inside", "download_dir", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254734}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/vec_env/util.py#L28-L50", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Get dict-structured information about a gym.Space.", "language": "python", "parameters": "(obs_space)", "return_statement": "return keys, shapes, dtypes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "gym", ".", "spaces", ".", "Dict", ")", ":", "assert", "isinstance", "(", "arg_0", ".", "spaces", ",", "OrderedDict", ")", "arg_1", "=", "arg_0", ".", "spaces", "else", ":", "arg_1", "=", "{", "None", ":", "arg_0", "}", "arg_2", "=", "[", "]", "arg_3", "=", "{", "}", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "items", "(", ")", ":", "arg_2", ".", "append", "(", "arg_5", ")", "arg_3", "[", "arg_5", "]", "=", "arg_6", ".", "shape", "arg_4", "[", "arg_5", "]", "=", "arg_6", ".", "dtype", "return", "arg_2", ",", "arg_3", ",", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"\n    Get dict-structured information about a gym.Space.\n\n    Returns:\n      A tuple (keys, shapes, dtypes):\n        keys: a list of dict keys.\n        shapes: a dict mapping keys to shapes.\n        dtypes: a dict mapping keys to dtypes.\n    \"\"\"\n    if isinstance(arg_0, gym.spaces.Dict):\n        assert isinstance(arg_0.spaces, OrderedDict)\n        arg_1 = arg_0.spaces\n    else:\n        arg_1 = {None: arg_0}\n    arg_2 = []\n    arg_3 = {}\n    arg_4 = {}\n    for arg_5, arg_6 in arg_1.items():\n        arg_2.append(arg_5)\n        arg_3[arg_5] = arg_6.shape\n        arg_4[arg_5] = arg_6.dtype\n    return arg_2, arg_3, arg_4", "path": "baselines/common/vec_env/util.py", "identifier": "obs_space_info", "docstring": "Get dict-structured information about a gym.Space.\n\n    Returns:\n      A tuple (keys, shapes, dtypes):\n        keys: a list of dict keys.\n        shapes: a dict mapping keys to shapes.\n        dtypes: a dict mapping keys to dtypes.", "docstring_tokens": ["Get", "dict", "-", "structured", "information", "about", "a", "gym", ".", "Space", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 254735}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/stores.py#L106-L116", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Update a store.", "language": "python", "parameters": "(self, store_id, data)", "return_statement": "return self._mc_client._patch(url=self._build_path(store_id), data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "store_id", "=", "arg_1", "return", "arg_0", ".", "_mc_client", ".", "_patch", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Update a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        arg_0.store_id = arg_1\n        return arg_0._mc_client._patch(url=arg_0._build_path(arg_1), arg_2=arg_2)", "path": "mailchimp3/entities/stores.py", "identifier": "Stores.update", "docstring": "Update a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`", "docstring_tokens": ["Update", "a", "store", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 254736}
{"url": "https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/stats.py#L417-L433", "sha": "f546ad171750cd7685afbde6785fe71f82cadb35", "docstring_summary": "Summary error table for some typical q-values", "language": "python", "parameters": "(df, qvalues=[0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5])", "return_statement": "return df_sub[['qvalue','pvalue','svalue','pep','fdr','fnr','fpr','tp','tn','fp','fn','cutoff']]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "0", ",", "0.01", ",", "0.02", ",", "0.05", ",", "0.1", ",", "0.2", ",", "0.3", ",", "0.4", ",", "0.5", "]", ")", ":", "arg_1", "=", "to_one_dim_array", "(", "arg_1", ")", "arg_2", "=", "find_nearest_matches", "(", "np", ".", "float32", "(", "arg_0", ".", "qvalue", ".", "values", ")", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "iloc", "[", "arg_2", "]", ".", "copy", "(", ")", "for", "arg_4", ",", "(", "arg_5", ",", "arg_6", ")", "in", "enumerate", "(", "zip", "(", "arg_2", ",", "arg_2", "[", "1", ":", "]", ")", ")", ":", "if", "arg_6", "==", "arg_5", ":", "arg_3", ".", "iloc", "[", "arg_4", "+", "1", ",", ":", "]", "=", "None", "arg_3", ".", "qvalue", "=", "arg_1", "arg_3", ".", "reset_index", "(", "inplace", "=", "True", ",", "drop", "=", "True", ")", "return", "arg_3", "[", "[", "'qvalue'", ",", "'pvalue'", ",", "'svalue'", ",", "'pep'", ",", "'fdr'", ",", "'fnr'", ",", "'fpr'", ",", "'tp'", ",", "'tn'", ",", "'fp'", ",", "'fn'", ",", "'cutoff'", "]", "]"], "function": "def Func(arg_0, arg_1=[0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5]):\n    \"\"\" Summary error table for some typical q-values \"\"\"\n\n    arg_1 = to_one_dim_array(arg_1)\n    # find best matching fows in df for given qvalues:\n    arg_2 = find_nearest_matches(np.float32(arg_0.qvalue.values), arg_1)\n    # extract sub table\n    arg_3 = arg_0.iloc[arg_2].copy()\n    # remove duplicate hits, mark them with None / NAN:\n    for arg_4, (arg_5, arg_6) in enumerate(zip(arg_2, arg_2[1:])):\n        if arg_6 == arg_5:\n            arg_3.iloc[arg_4 + 1, :] = None\n    # attach q values column\n    arg_3.qvalue = arg_1\n    # remove old index from original df:\n    arg_3.reset_index(inplace=True, drop=True)\n    return arg_3[['qvalue','pvalue','svalue','pep','fdr','fnr','fpr','tp','tn','fp','fn','cutoff']]", "path": "pyprophet/stats.py", "identifier": "summary_err_table", "docstring": "Summary error table for some typical q-values", "docstring_tokens": ["Summary", "error", "table", "for", "some", "typical", "q", "-", "values"], "nwo": "PyProphet/pyprophet", "score": 0.38514621847307956, "idx": 254737}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/ast/match.py#L444-L457", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "main function for creating a bottom-up tree automata\n            for a block of matching statements.", "language": "python", "parameters": "(self, tree: list, sr: state.StateRegister)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ".", "StateRegister", ")", ":", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_0", ".", "stmts", ":", "arg_8", "=", "arg_2", "(", ")", "arg_7", ".", "Func", "(", "arg_8", ")", "arg_6", ".", "append", "(", "arg_8", ")", "arg_0", ".", "root_edge", "=", "populate_state_register", "(", "arg_6", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4.StateRegister):\n        \"\"\" main function for creating a bottom-up tree automata\n            for a block of matching statements.\n        \"\"\"\n        arg_6 = []\n        # for all statements populate a list\n        # from deeper to nearer of MatchExpr instances.\n        for arg_7 in arg_0.stmts:\n            arg_8 = arg_2()\n            arg_7.Func(arg_8)\n            arg_6.append(arg_8)\n        # Walk on all MatchExpr instance\n        # and create State instance into the StateRegister\n        arg_0.root_edge = populate_state_register(arg_6, arg_3)", "path": "pyrser/ast/match.py", "identifier": "MatchBlock.build_state_tree", "docstring": "main function for creating a bottom-up tree automata\n            for a block of matching statements.", "docstring_tokens": ["main", "function", "for", "creating", "a", "bottom", "-", "up", "tree", "automata", "for", "a", "block", "of", "matching", "statements", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254738}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/mapping2json.py#L195-L287", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Function that handles the inputs required to parse depth files from bowtie\n    and dumps a dict to a json file that can be imported into pATLAS.", "language": "python", "parameters": "(depth_file, json_dict, cutoff, sample_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "logger", ".", "debug", "(", "\"Cutoff value: {}. Type: {}\"", ".", "format", "(", "arg_2", ",", "type", "(", "arg_2", ")", ")", ")", "try", ":", "arg_4", "=", "float", "(", "arg_2", ")", "if", "arg_4", "<", "0.4", ":", "logger", ".", "warning", "(", "\"This cutoff value will generate a high volume of \"", "\"plot data. Therefore '.report.json' can be too big\"", ")", "except", "ValueError", ":", "logger", ".", "error", "(", "\"Cutoff value should be a string such as: '0.6'. \"", "\"The outputted value: {}. Make sure to provide an \"", "\"appropriate value for --cov_cutoff\"", ".", "format", "(", "arg_2", ")", ")", "sys", ".", "exit", "(", "1", ")", "arg_5", "=", "json", ".", "load", "(", "open", "(", "arg_1", ")", ")", "if", "arg_5", ":", "logger", ".", "info", "(", "\"Loaded dictionary of plasmid lengths\"", ")", "else", ":", "logger", ".", "error", "(", "\"Something went wrong and plasmid lengths dictionary\"", "\"could not be loaded. Check if process received this\"", "\"param successfully.\"", ")", "sys", ".", "exit", "(", "1", ")", "arg_6", "=", "open", "(", "arg_0", ")", "logger", ".", "info", "(", "\"Reading depth file and creating dictionary to dump.\"", ")", "arg_7", "=", "depth_file_reader", "(", "arg_6", ")", "arg_8", ",", "arg_9", "=", "generate_jsons", "(", "arg_7", ",", "arg_5", ",", "arg_4", ")", "if", "arg_8", "and", "arg_9", ":", "logger", ".", "info", "(", "\"percentage_bases_covered length: {}\"", ".", "format", "(", "str", "(", "len", "(", "arg_8", ")", ")", ")", ")", "logger", ".", "info", "(", "\"dict_cov length: {}\"", ".", "format", "(", "str", "(", "len", "(", "arg_9", ")", ")", ")", ")", "else", ":", "logger", ".", "error", "(", "\"Both dicts that dump to JSON file or .report.json are \"", "\"empty.\"", ")", "logger", ".", "info", "(", "\"Dumping to {}\"", ".", "format", "(", "\"{}_mapping.json\"", ".", "format", "(", "arg_0", ")", ")", ")", "with", "open", "(", "\"{}_mapping.json\"", ".", "format", "(", "arg_0", ")", ",", "\"w\"", ")", "as", "output_json", ":", "output_json", ".", "write", "(", "json", ".", "dumps", "(", "arg_8", ")", ")", "arg_10", "=", "{", "\"tableRow\"", ":", "[", "{", "\"sample\"", ":", "arg_3", ",", "\"data\"", ":", "[", "{", "\"header\"", ":", "\"Mapping\"", ",", "\"table\"", ":", "\"plasmids\"", ",", "\"patlas_mapping\"", ":", "arg_8", ",", "\"value\"", ":", "len", "(", "arg_8", ")", "}", "]", "}", "]", ",", "\"sample\"", ":", "arg_3", ",", "\"patlas_mapping\"", ":", "arg_8", ",", "\"plotData\"", ":", "[", "{", "\"sample\"", ":", "arg_3", ",", "\"data\"", ":", "{", "\"patlasMappingSliding\"", ":", "arg_9", "}", ",", "}", "]", "}", "logger", ".", "debug", "(", "\"Size of dict_cov: {} kb\"", ".", "format", "(", "asizeof", "(", "arg_10", ")", "/", "1024", ")", ")", "logger", ".", "info", "(", "\"Writing to .report.json\"", ")", "with", "open", "(", "\".report.json\"", ",", "\"w\"", ")", "as", "json_report", ":", "json_report", ".", "write", "(", "json", ".", "dumps", "(", "arg_10", ",", "separators", "=", "(", "\",\"", ",", "\":\"", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Function that handles the inputs required to parse depth files from bowtie\n    and dumps a dict to a json file that can be imported into pATLAS.\n\n    Parameters\n    ----------\n    depth_file: str\n         the path to depth file for each sample\n    json_dict: str\n        the file that contains the dictionary with keys and values for\n        accessions\n        and their respective lengths\n    cutoff: str\n        the cutoff used to trim the unwanted matches for the minimum coverage\n        results from mapping. This value may range between 0 and 1.\n    sample_id: str\n        the id of the sample being parsed\n\n    \"\"\"\n\n    # check for the appropriate value for the cutoff value for coverage results\n    logger.debug(\"Cutoff value: {}. Type: {}\".format(arg_2, type(arg_2)))\n    try:\n        arg_4 = float(arg_2)\n        if arg_4 < 0.4:\n            logger.warning(\"This cutoff value will generate a high volume of \"\n                           \"plot data. Therefore '.report.json' can be too big\")\n    except ValueError:\n        logger.error(\"Cutoff value should be a string such as: '0.6'. \"\n                     \"The outputted value: {}. Make sure to provide an \"\n                     \"appropriate value for --cov_cutoff\".format(arg_2))\n        sys.exit(1)\n\n    # loads dict from file, this file is provided in docker image\n\n    arg_5 = json.load(open(arg_1))\n    if arg_5:\n        logger.info(\"Loaded dictionary of plasmid lengths\")\n    else:\n        logger.error(\"Something went wrong and plasmid lengths dictionary\"\n                     \"could not be loaded. Check if process received this\"\n                     \"param successfully.\")\n        sys.exit(1)\n\n    # read depth file\n    arg_6 = open(arg_0)\n\n    # first reads the depth file and generates dictionaries to handle the input\n    # to a simpler format\n    logger.info(\"Reading depth file and creating dictionary to dump.\")\n    arg_7 = depth_file_reader(arg_6)\n    arg_8, arg_9 = generate_jsons(arg_7,\n                                                        arg_5,\n                                                        arg_4)\n\n    if arg_8 and arg_9:\n        logger.info(\"percentage_bases_covered length: {}\".format(\n            str(len(arg_8))))\n        logger.info(\"dict_cov length: {}\".format(str(len(arg_9))))\n    else:\n        logger.error(\"Both dicts that dump to JSON file or .report.json are \"\n                     \"empty.\")\n\n    # then dump do file\n    logger.info(\"Dumping to {}\".format(\"{}_mapping.json\".format(arg_0)))\n    with open(\"{}_mapping.json\".format(arg_0), \"w\") as output_json:\n        output_json.write(json.dumps(arg_8))\n\n    arg_10 = {\n        \"tableRow\": [{\n            \"sample\": arg_3,\n            \"data\": [{\n                \"header\": \"Mapping\",\n                \"table\": \"plasmids\",\n                \"patlas_mapping\": arg_8,\n                \"value\": len(arg_8)\n            }]\n        }],\n        \"sample\": arg_3,\n        \"patlas_mapping\": arg_8,\n        \"plotData\": [{\n            \"sample\": arg_3,\n            \"data\": {\n                \"patlasMappingSliding\": arg_9\n            },\n        }]\n    }\n\n    logger.debug(\"Size of dict_cov: {} kb\".format(asizeof(arg_10)/1024))\n    logger.info(\"Writing to .report.json\")\n    with open(\".report.json\", \"w\") as json_report:\n        json_report.write(json.dumps(arg_10, separators=(\",\", \":\")))", "path": "flowcraft/templates/mapping2json.py", "identifier": "main", "docstring": "Function that handles the inputs required to parse depth files from bowtie\n    and dumps a dict to a json file that can be imported into pATLAS.\n\n    Parameters\n    ----------\n    depth_file: str\n         the path to depth file for each sample\n    json_dict: str\n        the file that contains the dictionary with keys and values for\n        accessions\n        and their respective lengths\n    cutoff: str\n        the cutoff used to trim the unwanted matches for the minimum coverage\n        results from mapping. This value may range between 0 and 1.\n    sample_id: str\n        the id of the sample being parsed", "docstring_tokens": ["Function", "that", "handles", "the", "inputs", "required", "to", "parse", "depth", "files", "from", "bowtie", "and", "dumps", "a", "dict", "to", "a", "json", "file", "that", "can", "be", "imported", "into", "pATLAS", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 254739}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L477-L484", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Convert a JSON representation into ListValue message.", "language": "python", "parameters": "(value, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "list", ")", ":", "raise", "ParseError", "(", "'ListValue must be in [] which is {0}.'", ".", "format", "(", "arg_0", ")", ")", "arg_1", ".", "ClearField", "(", "'values'", ")", "for", "arg_2", "in", "arg_0", ":", "_ConvertValueMessage", "(", "arg_2", ",", "arg_1", ".", "values", ".", "add", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Convert a JSON representation into ListValue message.\"\"\"\n  if not isinstance(arg_0, list):\n    raise ParseError(\n        'ListValue must be in [] which is {0}.'.format(arg_0))\n  arg_1.ClearField('values')\n  for arg_2 in arg_0:\n    _ConvertValueMessage(arg_2, arg_1.values.add())", "path": "typy/google/protobuf/json_format.py", "identifier": "_ConvertListValueMessage", "docstring": "Convert a JSON representation into ListValue message.", "docstring_tokens": ["Convert", "a", "JSON", "representation", "into", "ListValue", "message", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 254740}
{"url": "https://github.com/merrychap/shellen/blob/3514b7ed3a1b7b1660c3f846a52f58ef02f0954c/shellen/asms/disasm.py#L25-L40", "sha": "3514b7ed3a1b7b1660c3f846a52f58ef02f0954c", "docstring_summary": "Initialize the dictionary of architectures for disassembling via capstone", "language": "python", "parameters": "(self)", "return_statement": "return {\n            ARM32:   (CS_ARCH_ARM,   CS_MODE_ARM),\n            ARM64:   (CS_ARCH_ARM64, CS_MODE_LITTLE_ENDIAN),\n            ARM_TB:  (CS_ARCH_ARM,   CS_MODE_THUMB),\n            MIPS32:  (CS_ARCH_MIPS,  CS_MODE_MIPS32),\n            MIPS64:  (CS_ARCH_MIPS,  CS_MODE_MIPS64),\n            SPARC32: (CS_ARCH_SPARC, CS_MODE_BIG_ENDIAN),\n            SPARC64: (CS_ARCH_SPARC, CS_MODE_V9),\n            SYSTEMZ: (CS_ARCH_SYSZ,  CS_MODE_BIG_ENDIAN),\n            X86_16:  (CS_ARCH_X86,   CS_MODE_16),\n            X86_32:  (CS_ARCH_X86,   CS_MODE_32),\n            X86_64:  (CS_ARCH_X86,   CS_MODE_64),\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "ARM32", ":", "(", "CS_ARCH_ARM", ",", "CS_MODE_ARM", ")", ",", "ARM64", ":", "(", "CS_ARCH_ARM64", ",", "CS_MODE_LITTLE_ENDIAN", ")", ",", "ARM_TB", ":", "(", "CS_ARCH_ARM", ",", "CS_MODE_THUMB", ")", ",", "MIPS32", ":", "(", "CS_ARCH_MIPS", ",", "CS_MODE_MIPS32", ")", ",", "MIPS64", ":", "(", "CS_ARCH_MIPS", ",", "CS_MODE_MIPS64", ")", ",", "SPARC32", ":", "(", "CS_ARCH_SPARC", ",", "CS_MODE_BIG_ENDIAN", ")", ",", "SPARC64", ":", "(", "CS_ARCH_SPARC", ",", "CS_MODE_V9", ")", ",", "SYSTEMZ", ":", "(", "CS_ARCH_SYSZ", ",", "CS_MODE_BIG_ENDIAN", ")", ",", "X86_16", ":", "(", "CS_ARCH_X86", ",", "CS_MODE_16", ")", ",", "X86_32", ":", "(", "CS_ARCH_X86", ",", "CS_MODE_32", ")", ",", "X86_64", ":", "(", "CS_ARCH_X86", ",", "CS_MODE_64", ")", ",", "}"], "function": "def Func(arg_0):\n        ''' Initialize the dictionary of architectures for disassembling via capstone'''\n\n        return {\n            ARM32:   (CS_ARCH_ARM,   CS_MODE_ARM),\n            ARM64:   (CS_ARCH_ARM64, CS_MODE_LITTLE_ENDIAN),\n            ARM_TB:  (CS_ARCH_ARM,   CS_MODE_THUMB),\n            MIPS32:  (CS_ARCH_MIPS,  CS_MODE_MIPS32),\n            MIPS64:  (CS_ARCH_MIPS,  CS_MODE_MIPS64),\n            SPARC32: (CS_ARCH_SPARC, CS_MODE_BIG_ENDIAN),\n            SPARC64: (CS_ARCH_SPARC, CS_MODE_V9),\n            SYSTEMZ: (CS_ARCH_SYSZ,  CS_MODE_BIG_ENDIAN),\n            X86_16:  (CS_ARCH_X86,   CS_MODE_16),\n            X86_32:  (CS_ARCH_X86,   CS_MODE_32),\n            X86_64:  (CS_ARCH_X86,   CS_MODE_64),\n        }", "path": "shellen/asms/disasm.py", "identifier": "Disassembler.avail_archs", "docstring": "Initialize the dictionary of architectures for disassembling via capstone", "docstring_tokens": ["Initialize", "the", "dictionary", "of", "architectures", "for", "disassembling", "via", "capstone"], "nwo": "merrychap/shellen", "score": 0.5790129476610644, "idx": 254741}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py#L82-L92", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "The name of the current module if the request was dispatched\n        to an actual module.  This is deprecated functionality, use blueprints\n        instead.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "warnings", "import", "warn", "warn", "(", "DeprecationWarning", "(", "'Funcs were deprecated in favor of '", "'blueprints.  Use request.blueprint '", "'instead.'", ")", ",", "stacklevel", "=", "2", ")", "if", "arg_0", ".", "_is_old_Func", ":", "return", "arg_0", ".", "blueprint"], "function": "def Func(arg_0):\n        \"\"\"The name of the current Func if the request was dispatched\n        to an actual Func.  This is deprecated functionality, use blueprints\n        instead.\n        \"\"\"\n        from warnings import warn\n        warn(DeprecationWarning('Funcs were deprecated in favor of '\n                                'blueprints.  Use request.blueprint '\n                                'instead.'), stacklevel=2)\n        if arg_0._is_old_Func:\n            return arg_0.blueprint", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py", "identifier": "Request.module", "docstring": "The name of the current module if the request was dispatched\n        to an actual module.  This is deprecated functionality, use blueprints\n        instead.", "docstring_tokens": ["The", "name", "of", "the", "current", "module", "if", "the", "request", "was", "dispatched", "to", "an", "actual", "module", ".", "This", "is", "deprecated", "functionality", "use", "blueprints", "instead", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254742}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L562-L572", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Defines a simulated exception error that will be raised.", "language": "python", "parameters": "(self, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_0", ".", "_error", "=", "RuntimeError", "(", "Func", ")", "if", "isinstance", "(", "Func", ",", "str", ")", "else", "Func"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Defines a simulated exception error that will be raised.\n\n        Arguments:\n            error (str|Exception): error to raise.\n\n        Returns:\n            self: current Mock instance.\n        \"\"\"\n        arg_0._error = RuntimeError(Func) if isinstance(Func, str) else Func", "path": "pook/mock.py", "identifier": "Mock.error", "docstring": "Defines a simulated exception error that will be raised.\n\n        Arguments:\n            error (str|Exception): error to raise.\n\n        Returns:\n            self: current Mock instance.", "docstring_tokens": ["Defines", "a", "simulated", "exception", "error", "that", "will", "be", "raised", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 254743}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/models.py#L117-L143", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "strlen symbolic model.", "language": "python", "parameters": "(state, s)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "cpu", "if", "issymbolic", "(", "arg_1", ")", ":", "raise", "ConcretizeArgument", "(", "arg_0", ".", "cpu", ",", "1", ")", "arg_3", "=", "_find_zero", "(", "arg_2", ",", "arg_0", ".", "constraints", ",", "arg_1", ")", "arg_4", "=", "arg_3", "for", "arg_5", "in", "range", "(", "arg_3", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "arg_6", "=", "arg_2", ".", "read_int", "(", "arg_1", "+", "arg_5", ",", "8", ")", "if", "issymbolic", "(", "arg_6", ")", ":", "arg_4", "=", "ITEBV", "(", "arg_2", ".", "address_bit_size", ",", "arg_6", "==", "0", ",", "arg_5", ",", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Func symbolic model.\n\n    Algorithm: Walks from end of string not including NULL building ITE tree when current byte is symbolic.\n\n    :param State state: current program state\n    :param int s: Address of string\n    :return: Symbolic Func result\n    :rtype: Expression or int\n    \"\"\"\n\n    arg_2 = arg_0.cpu\n\n    if issymbolic(arg_1):\n        raise ConcretizeArgument(arg_0.cpu, 1)\n\n    arg_3 = _find_zero(arg_2, arg_0.constraints, arg_1)\n\n    arg_4 = arg_3\n\n    for arg_5 in range(arg_3 - 1, -1, -1):\n        arg_6 = arg_2.read_int(arg_1 + arg_5, 8)\n        if issymbolic(arg_6):\n            arg_4 = ITEBV(arg_2.address_bit_size, arg_6 == 0, arg_5, arg_4)\n\n    return arg_4", "path": "manticore/native/models.py", "identifier": "strlen", "docstring": "strlen symbolic model.\n\n    Algorithm: Walks from end of string not including NULL building ITE tree when current byte is symbolic.\n\n    :param State state: current program state\n    :param int s: Address of string\n    :return: Symbolic strlen result\n    :rtype: Expression or int", "docstring_tokens": ["strlen", "symbolic", "model", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254744}
{"url": "https://github.com/chairco/pyRscript/blob/e952f450a873de52baa4fe80ed901f0cf990c0b7/pyRscript/pyRscript.py#L100-L111", "sha": "e952f450a873de52baa4fe80ed901f0cf990c0b7", "docstring_summary": "Execute R script", "language": "python", "parameters": "(self)", "return_statement": "return self.decode_cmd_out(completed_cmd=rprocess[self.file])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "OrderedDict", "(", ")", "arg_2", "=", "OrderedDict", "(", "[", "(", "arg_0", ".", "file", ",", "[", "'Rscript'", ",", "arg_0", ".", "file", "]", "+", "arg_0", ".", "cmd", ")", ",", "]", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "arg_1", "[", "arg_3", "]", "=", "arg_0", ".", "run_command_under_r_root", "(", "arg_4", ")", "return", "arg_0", ".", "decode_cmd_out", "(", "completed_cmd", "=", "arg_1", "[", "arg_0", ".", "file", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Execute R script\n        \"\"\"\n        arg_1 = OrderedDict()\n        arg_2 = OrderedDict([\n            (arg_0.file, ['Rscript', arg_0.file] + arg_0.cmd),\n        ])\n        for arg_3, arg_4 in arg_2.items():\n            arg_1[arg_3] = arg_0.run_command_under_r_root(arg_4)\n        \n        return arg_0.decode_cmd_out(completed_cmd=arg_1[arg_0.file])", "path": "pyRscript/pyRscript.py", "identifier": "Rscript.execute", "docstring": "Execute R script", "docstring_tokens": ["Execute", "R", "script"], "nwo": "chairco/pyRscript", "score": 0.0, "idx": 254745}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/ceskatelevize.py#L70-L89", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Finds embedded player url in HTTP response.", "language": "python", "parameters": "(response)", "return_statement": "return 'http://ceskatelevize.cz/' + url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "arg_2", "=", "_player_re", ".", "search", "(", "arg_0", ".", "text", ")", "if", "arg_2", ":", "arg_3", "=", "arg_2", ".", "group", "(", "0", ")", ".", "replace", "(", "'&amp;'", ",", "'&'", ")", "if", "'hash'", "not", "in", "arg_3", ":", "arg_2", "=", "_hash_re", ".", "search", "(", "arg_0", ".", "text", ")", "if", "arg_2", ":", "arg_1", "=", "arg_3", "+", "'&hash='", "+", "arg_2", ".", "group", "(", "1", ")", "else", ":", "arg_1", "=", "arg_3", "return", "'http://ceskatelevize.cz/'", "+", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Finds embedded player url in HTTP response.\n\n    :param response: Response object.\n    :returns: Player url (str).\n    \"\"\"\n    arg_1 = ''\n    arg_2 = _player_re.search(arg_0.text)\n    if arg_2:\n        arg_3 = arg_2.group(0).replace('&amp;', '&')\n        if 'hash' not in arg_3:\n            # there's no hash in the URL, try to find it\n            arg_2 = _hash_re.search(arg_0.text)\n            if arg_2:\n                arg_1 = arg_3 + '&hash=' + arg_2.group(1)\n        else:\n            arg_1 = arg_3\n\n    return 'http://ceskatelevize.cz/' + arg_1", "path": "src/streamlink/plugins/ceskatelevize.py", "identifier": "_find_player_url", "docstring": "Finds embedded player url in HTTP response.\n\n    :param response: Response object.\n    :returns: Player url (str).", "docstring_tokens": ["Finds", "embedded", "player", "url", "in", "HTTP", "response", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 254746}
{"url": "https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L80-L105", "sha": "d363bac763781bb2da18debfa0fdd4be28288b92", "docstring_summary": "Provides a transacted cursor which will run in autocommit=false mode", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "with", "(", "yield", "from", "arg_1", ".", "get_cursor", "(", "_CursorType", ".", "NAMEDTUPLE", ")", ")", "as", "c", ":", "try", ":", "yield", "from", "c", ".", "execute", "(", "'BEGIN'", ")", "arg_4", "=", "(", "yield", "from", "arg_0", "(", "arg_1", ",", "c", ",", "*", "arg_2", ",", "**", "arg_3", ")", ")", "except", "Exception", ":", "yield", "from", "c", ".", "execute", "(", "'ROLLBACK'", ")", "else", ":", "yield", "from", "c", ".", "execute", "(", "'COMMIT'", ")", "return", "arg_4", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Provides a transacted cursor which will run in autocommit=false mode\n\n    For any exception the Func will be rolled back.\n    Requires that the function being decorated is an instance of a class or object\n    that yields a cursor from a get_cursor(cursor_type=CursorType.NAMEDTUPLE) coroutine or provides such an object\n    as the first argument in its signature\n\n    Yields:\n        A client-side transacted named cursor\n    \"\"\"\n\n    @wraps(arg_0)\n    def wrapper(arg_1, *arg_2, **arg_3):\n        with (yield from arg_1.get_cursor(_CursorType.NAMEDTUPLE)) as c:\n            try:\n                yield from c.execute('BEGIN')\n                arg_4 = (yield from arg_0(arg_1, c, *arg_2, **arg_3))\n            except Exception:\n                yield from c.execute('ROLLBACK')\n            else:\n                yield from c.execute('COMMIT')\n                return arg_4\n\n    return wrapper", "path": "cauldron/sql.py", "identifier": "transaction", "docstring": "Provides a transacted cursor which will run in autocommit=false mode\n\n    For any exception the transaction will be rolled back.\n    Requires that the function being decorated is an instance of a class or object\n    that yields a cursor from a get_cursor(cursor_type=CursorType.NAMEDTUPLE) coroutine or provides such an object\n    as the first argument in its signature\n\n    Yields:\n        A client-side transacted named cursor", "docstring_tokens": ["Provides", "a", "transacted", "cursor", "which", "will", "run", "in", "autocommit", "=", "false", "mode"], "nwo": "nerandell/cauldron", "score": 0.14991498758945482, "idx": 254747}
{"url": "https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/__init__.py#L206-L215", "sha": "50bf2e047b698e308a9a88770a23e7e210aa5bcb", "docstring_summary": "The pods that hold the response to a simple, discrete query.", "language": "python", "parameters": "(self)", "return_statement": "return (\n            pod\n            for pod in self.pods\n            if pod.primary\n            or pod.title == 'Result'\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_1", "for", "arg_1", "in", "arg_0", ".", "pods", "if", "arg_1", ".", "primary", "or", "arg_1", ".", "title", "==", "'Result'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        The pods that hold the response to a simple, discrete query.\n        \"\"\"\n        return (\n            arg_1\n            for arg_1 in arg_0.pods\n            if arg_1.primary\n            or arg_1.title == 'Result'\n        )", "path": "wolframalpha/__init__.py", "identifier": "Result.results", "docstring": "The pods that hold the response to a simple, discrete query.", "docstring_tokens": ["The", "pods", "that", "hold", "the", "response", "to", "a", "simple", "discrete", "query", "."], "nwo": "jaraco/wolframalpha", "score": 0.3658617949980371, "idx": 254748}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qi/qi.py#L174-L207", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Flatten an operator to a vector in a specified basis.", "language": "python", "parameters": "(density_matrix, method='col')", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'col'", ")", ":", "arg_0", "=", "np", ".", "array", "(", "arg_0", ")", "if", "arg_1", "==", "'col'", ":", "return", "arg_0", ".", "flatten", "(", "order", "=", "'F'", ")", "elif", "arg_1", "==", "'row'", ":", "return", "arg_0", ".", "flatten", "(", "order", "=", "'C'", ")", "elif", "arg_1", "in", "[", "'pauli'", ",", "'pauli_weights'", "]", ":", "arg_2", "=", "int", "(", "np", ".", "log2", "(", "len", "(", "arg_0", ")", ")", ")", "if", "len", "(", "arg_0", ")", "!=", "2", "**", "arg_2", ":", "raise", "Exception", "(", "'Input state must be n-qubit state'", ")", "if", "arg_1", "==", "'pauli_weights'", ":", "arg_3", "=", "pauli_group", "(", "arg_2", ",", "case", "=", "'weight'", ")", "else", ":", "arg_3", "=", "pauli_group", "(", "arg_2", ",", "case", "=", "'tensor'", ")", "arg_4", "=", "[", "np", ".", "trace", "(", "np", ".", "dot", "(", "p", ".", "to_matrix", "(", ")", ",", "arg_0", ")", ")", "for", "p", "in", "arg_3", "]", "return", "np", ".", "array", "(", "arg_4", ")", "return", "None"], "function": "def Func(arg_0, arg_1='col'):\n    \"\"\"Flatten an operator to a vector in a specified basis.\n\n    Args:\n        density_matrix (ndarray): a density matrix.\n        method (str): the method of vectorization. Allowed values are\n            - 'col' (default) flattens to column-major vector.\n            - 'row' flattens to row-major vector.\n            - 'pauli'flattens in the n-qubit Pauli basis.\n            - 'pauli-weights': flattens in the n-qubit Pauli basis ordered by\n               weight.\n\n    Returns:\n        ndarray: the resulting vector.\n    Raises:\n        Exception: if input state is not a n-qubit state\n    \"\"\"\n    arg_0 = np.array(arg_0)\n    if arg_1 == 'col':\n        return arg_0.flatten(order='F')\n    elif arg_1 == 'row':\n        return arg_0.flatten(order='C')\n    elif arg_1 in ['pauli', 'pauli_weights']:\n        arg_2 = int(np.log2(len(arg_0)))  # number of qubits\n        if len(arg_0) != 2**arg_2:\n            raise Exception('Input state must be n-qubit state')\n        if arg_1 == 'pauli_weights':\n            arg_3 = pauli_group(arg_2, case='weight')\n        else:\n            arg_3 = pauli_group(arg_2, case='tensor')\n        arg_4 = [np.trace(np.dot(p.to_matrix(), arg_0))\n                for p in arg_3]\n        return np.array(arg_4)\n    return None", "path": "qiskit/tools/qi/qi.py", "identifier": "vectorize", "docstring": "Flatten an operator to a vector in a specified basis.\n\n    Args:\n        density_matrix (ndarray): a density matrix.\n        method (str): the method of vectorization. Allowed values are\n            - 'col' (default) flattens to column-major vector.\n            - 'row' flattens to row-major vector.\n            - 'pauli'flattens in the n-qubit Pauli basis.\n            - 'pauli-weights': flattens in the n-qubit Pauli basis ordered by\n               weight.\n\n    Returns:\n        ndarray: the resulting vector.\n    Raises:\n        Exception: if input state is not a n-qubit state", "docstring_tokens": ["Flatten", "an", "operator", "to", "a", "vector", "in", "a", "specified", "basis", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254749}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/bot.py#L392-L405", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Import Nodebox libraries.", "language": "python", "parameters": "(self, libName)", "return_statement": "return lib", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "__import__", "(", "arg_1", ")", "arg_0", ".", "_namespace", "[", "arg_1", "]", "=", "arg_2", "arg_2", ".", "_ctx", "=", "arg_0", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''\n        Import Nodebox libraries.\n\n        The libraries get _ctx, which provides\n        them with the nodebox API.\n\n        :param libName: Library name to import\n        '''\n        # from Nodebox\n        arg_2 = __import__(arg_1)\n        arg_0._namespace[arg_1] = arg_2\n        arg_2._ctx = arg_0\n        return arg_2", "path": "shoebot/grammar/bot.py", "identifier": "Bot.ximport", "docstring": "Import Nodebox libraries.\n\n        The libraries get _ctx, which provides\n        them with the nodebox API.\n\n        :param libName: Library name to import", "docstring_tokens": ["Import", "Nodebox", "libraries", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 254750}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/smooth.py#L130-L171", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Smooth images using a Gaussian filter.", "language": "python", "parameters": "(images, fwhm)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "<=", "0", ":", "return", "arg_0", "if", "not", "isinstance", "(", "arg_0", ",", "string_types", ")", "and", "hasattr", "(", "arg_0", ",", "'__iter__'", ")", ":", "arg_2", "=", "False", "else", ":", "arg_2", "=", "True", "arg_0", "=", "[", "arg_0", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "arg_4", "=", "check_img", "(", "arg_4", ")", "arg_5", "=", "arg_4", ".", "get_affine", "(", ")", "arg_6", "=", "_smooth_data_array", "(", "arg_4", ".", "get_data", "(", ")", ",", "arg_5", ",", "arg_1", "=", "arg_1", ",", "copy", "=", "True", ")", "arg_3", ".", "append", "(", "nib", ".", "Nifti1Image", "(", "arg_6", ",", "arg_5", ")", ")", "if", "arg_2", ":", "return", "arg_3", "[", "0", "]", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Smooth images using a Gaussian filter.\n\n    Apply a Gaussian filter along the three first dimensions of each image in images.\n    In all cases, non-finite values in input are zeroed.\n\n    Parameters\n    ----------\n    imgs: str or img-like object or iterable of img-like objects\n        See boyle.nifti.read.read_img\n        Image(s) to smooth.\n\n    fwhm: scalar or numpy.ndarray\n        Smoothing kernel size, as Full-Width at Half Maximum (FWHM) in millimeters.\n        If a scalar is given, kernel width is identical on all three directions.\n        A numpy.ndarray must have 3 elements, giving the FWHM along each axis.\n\n    Returns\n    -------\n    Func: nibabel.Nifti1Image or list of.\n        Smooth input image/s.\n    \"\"\"\n    if arg_1 <= 0:\n        return arg_0\n\n    if not isinstance(arg_0, string_types) and hasattr(arg_0, '__iter__'):\n        arg_2 = False\n    else:\n        arg_2 = True\n        arg_0 = [arg_0]\n\n    arg_3 = []\n    for arg_4 in arg_0:\n        arg_4    = check_img(arg_4)\n        arg_5 = arg_4.get_affine()\n        arg_6 = _smooth_data_array(arg_4.get_data(), arg_5, arg_1=arg_1, copy=True)\n        arg_3.append(nib.Nifti1Image(arg_6, arg_5))\n\n    if arg_2:\n        return arg_3[0]\n    else:\n        return arg_3", "path": "boyle/nifti/smooth.py", "identifier": "smooth_imgs", "docstring": "Smooth images using a Gaussian filter.\n\n    Apply a Gaussian filter along the three first dimensions of each image in images.\n    In all cases, non-finite values in input are zeroed.\n\n    Parameters\n    ----------\n    imgs: str or img-like object or iterable of img-like objects\n        See boyle.nifti.read.read_img\n        Image(s) to smooth.\n\n    fwhm: scalar or numpy.ndarray\n        Smoothing kernel size, as Full-Width at Half Maximum (FWHM) in millimeters.\n        If a scalar is given, kernel width is identical on all three directions.\n        A numpy.ndarray must have 3 elements, giving the FWHM along each axis.\n\n    Returns\n    -------\n    smooth_imgs: nibabel.Nifti1Image or list of.\n        Smooth input image/s.", "docstring_tokens": ["Smooth", "images", "using", "a", "Gaussian", "filter", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254751}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/zoneinfo/__init__.py#L128-L163", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "This retrieves a time zone from the local zoneinfo tarball that is packaged\n    with dateutil.", "language": "python", "parameters": "(name)", "return_statement": "return _CLASS_ZONE_INSTANCE[0].zones.get(name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "warnings", ".", "warn", "(", "\"zoneinfo.Func() will be removed in future versions, \"", "\"to use the dateutil-provided zoneinfo files, instantiate a \"", "\"ZoneInfoFile object and use ZoneInfoFile.zones.get() \"", "\"instead. See the documentation for details.\"", ",", "DeprecationWarning", ")", "if", "len", "(", "_CLASS_ZONE_INSTANCE", ")", "==", "0", ":", "_CLASS_ZONE_INSTANCE", ".", "append", "(", "ZoneInfoFile", "(", "getzoneinfofile_stream", "(", ")", ")", ")", "return", "_CLASS_ZONE_INSTANCE", "[", "0", "]", ".", "zones", ".", "get", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    This retrieves a time zone from the local zoneinfo tarball that is packaged\n    with dateutil.\n\n    :param name:\n        An IANA-style time zone name, as found in the zoneinfo file.\n\n    :return:\n        Returns a :class:`dateutil.tz.tzfile` time zone object.\n\n    .. warning::\n        It is generally inadvisable to use this function, and it is only\n        provided for API compatibility with earlier versions. This is *not*\n        equivalent to ``dateutil.tz.Func()``, which selects an appropriate\n        time zone based on the inputs, favoring system zoneinfo. This is ONLY\n        for accessing the dateutil-specific zoneinfo (which may be out of\n        date compared to the system zoneinfo).\n\n    .. deprecated:: 2.6\n        If you need to use a specific zoneinfofile over the system zoneinfo,\n        instantiate a :class:`dateutil.zoneinfo.ZoneInfoFile` object and call\n        :func:`dateutil.zoneinfo.ZoneInfoFile.get(name)` instead.\n\n        Use :func:`get_zonefile_instance` to retrieve an instance of the\n        dateutil-provided zoneinfo.\n    \"\"\"\n    warnings.warn(\"zoneinfo.Func() will be removed in future versions, \"\n                  \"to use the dateutil-provided zoneinfo files, instantiate a \"\n                  \"ZoneInfoFile object and use ZoneInfoFile.zones.get() \"\n                  \"instead. See the documentation for details.\",\n                  DeprecationWarning)\n\n    if len(_CLASS_ZONE_INSTANCE) == 0:\n        _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream()))\n    return _CLASS_ZONE_INSTANCE[0].zones.get(arg_0)", "path": "superjson/pkg/dateutil/zoneinfo/__init__.py", "identifier": "gettz", "docstring": "This retrieves a time zone from the local zoneinfo tarball that is packaged\n    with dateutil.\n\n    :param name:\n        An IANA-style time zone name, as found in the zoneinfo file.\n\n    :return:\n        Returns a :class:`dateutil.tz.tzfile` time zone object.\n\n    .. warning::\n        It is generally inadvisable to use this function, and it is only\n        provided for API compatibility with earlier versions. This is *not*\n        equivalent to ``dateutil.tz.gettz()``, which selects an appropriate\n        time zone based on the inputs, favoring system zoneinfo. This is ONLY\n        for accessing the dateutil-specific zoneinfo (which may be out of\n        date compared to the system zoneinfo).\n\n    .. deprecated:: 2.6\n        If you need to use a specific zoneinfofile over the system zoneinfo,\n        instantiate a :class:`dateutil.zoneinfo.ZoneInfoFile` object and call\n        :func:`dateutil.zoneinfo.ZoneInfoFile.get(name)` instead.\n\n        Use :func:`get_zonefile_instance` to retrieve an instance of the\n        dateutil-provided zoneinfo.", "docstring_tokens": ["This", "retrieves", "a", "time", "zone", "from", "the", "local", "zoneinfo", "tarball", "that", "is", "packaged", "with", "dateutil", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 254752}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1333-L1356", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Yield layers of the multigraph.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", ")", "arg_2", "=", "[", "arg_4", "for", "arg_4", "in", "arg_0", ".", "input_map", ".", "values", "(", ")", "]", "yield", "arg_2", "arg_3", "=", "[", "]", "while", "arg_2", ":", "for", "arg_4", "in", "arg_2", ":", "for", "arg_5", "in", "arg_0", ".", "_multi_graph", ".", "successors", "(", "arg_4", ")", ":", "arg_6", "=", "arg_0", ".", "_multi_graph", ".", "number_of_edges", "(", "arg_4", ",", "arg_5", ")", "if", "arg_5", "in", "arg_1", ":", "arg_1", "[", "arg_5", "]", "-=", "arg_6", "else", ":", "arg_1", "[", "arg_5", "]", "=", "arg_0", ".", "_multi_graph", ".", "in_degree", "(", "arg_5", ")", "-", "arg_6", "if", "arg_1", "[", "arg_5", "]", "==", "0", ":", "arg_3", ".", "append", "(", "arg_5", ")", "del", "arg_1", "[", "arg_5", "]", "yield", "arg_3", "arg_2", "=", "arg_3", "arg_3", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"Yield layers of the multigraph.\"\"\"\n        arg_1 = dict()  # Dict[node, predecessors not visited]\n        arg_2 = [arg_4 for arg_4 in arg_0.input_map.values()]\n        yield arg_2\n        arg_3 = []\n        while arg_2:\n            for arg_4 in arg_2:\n                # Count multiedges with multiplicity.\n                for arg_5 in arg_0._multi_graph.successors(arg_4):\n                    arg_6 = arg_0._multi_graph.number_of_edges(arg_4, arg_5)\n                    if arg_5 in arg_1:\n                        arg_1[arg_5] -= arg_6\n                    else:\n                        arg_1[arg_5] = \\\n                            arg_0._multi_graph.in_degree(arg_5) - arg_6\n\n                    if arg_1[arg_5] == 0:\n                        arg_3.append(arg_5)\n                        del arg_1[arg_5]\n\n            yield arg_3\n            arg_2 = arg_3\n            arg_3 = []", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.multigraph_layers", "docstring": "Yield layers of the multigraph.", "docstring_tokens": ["Yield", "layers", "of", "the", "multigraph", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254753}
{"url": "https://github.com/phoikoi/sisy/blob/840c5463ab65488d34e99531f230e61f755d2d69/src/sisy/models.py#L319-L357", "sha": "840c5463ab65488d34e99531f230e61f755d2d69", "docstring_summary": "Factory function to create a properly initialized task.", "language": "python", "parameters": "(the_callable, label=None, schedule=DEFAULT_SCHEDULE, userdata=None, pk_override=None)", "return_statement": "return task", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "Task", "(", ")", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "if", "arg_5", "is", "not", "None", ":", "arg_7", "=", "arg_0", ".", "split", "(", "'.'", ")", "arg_8", "=", "dict", "(", "func_type", "=", "'instancemethod'", ",", "module_name", "=", "'.'", ".", "join", "(", "arg_7", "[", ":", "-", "2", "]", ")", ",", "class_name", "=", "arg_7", "[", "-", "2", "]", ",", "class_path", "=", "'.'", ".", "join", "(", "arg_7", "[", ":", "-", "1", "]", ")", ",", "model_pk", "=", "arg_5", ",", "func_name", "=", "arg_7", "[", "-", "1", "]", ",", "func_path", "=", "arg_0", ",", ")", "arg_6", ".", "funcinfo", "=", "arg_8", "else", ":", "arg_6", ".", "funcinfo", "=", "get_func_info", "(", "func_from_string", "(", "arg_0", ")", ")", "else", ":", "arg_6", ".", "funcinfo", "=", "get_func_info", "(", "arg_0", ")", "if", "arg_1", "is", "None", ":", "arg_6", ".", "label", "=", "arg_6", ".", "funcinfo", "[", "'func_path'", "]", "else", ":", "arg_6", ".", "label", "=", "arg_1", "arg_6", ".", "schedule", "=", "arg_2", "if", "not", "croniter", ".", "is_valid", "(", "arg_6", ".", "schedule", ")", ":", "raise", "ValueError", "(", "f\"Cron schedule {task.schedule} is not valid\"", ")", "if", "arg_4", "is", "None", ":", "arg_6", ".", "userdata", "=", "dict", "(", ")", "else", ":", "if", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "arg_6", ".", "userdata", "=", "arg_4", "else", ":", "raise", "ValueError", "(", "\"Userdata must be a dictionary of JSON-serializable data\"", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None, arg_2=arg_3, arg_4=None, arg_5=None):\n    \"\"\"Factory function to create a properly initialized task.\"\"\"\n    arg_6 = Task()\n    if isinstance(arg_0, str):\n        if arg_5 is not None:\n            arg_7 = arg_0.split('.')\n            arg_8 = dict(\n                func_type='instancemethod',\n                module_name='.'.join(arg_7[:-2]),\n                class_name=arg_7[-2],\n                class_path='.'.join(arg_7[:-1]),\n                model_pk=arg_5,\n                func_name=arg_7[-1],\n                func_path=arg_0,\n            )\n            arg_6.funcinfo = arg_8\n        else:\n            arg_6.funcinfo = get_func_info(func_from_string(arg_0))\n    else:\n        arg_6.funcinfo = get_func_info(arg_0)\n\n    if arg_1 is None:\n        arg_6.label = arg_6.funcinfo['func_path']\n    else:\n        arg_6.label = arg_1\n\n    arg_6.schedule = arg_2\n    if not croniter.is_valid(arg_6.schedule):\n        raise ValueError(f\"Cron schedule {task.schedule} is not valid\")\n    \n    if arg_4 is None:\n        arg_6.userdata = dict()\n    else:\n        if isinstance(arg_4, dict):\n            arg_6.userdata = arg_4\n        else:\n            raise ValueError(\"Userdata must be a dictionary of JSON-serializable data\")\n\n    return arg_6", "path": "src/sisy/models.py", "identifier": "task_with_callable", "docstring": "Factory function to create a properly initialized task.", "docstring_tokens": ["Factory", "function", "to", "create", "a", "properly", "initialized", "task", "."], "nwo": "phoikoi/sisy", "score": 0.0, "idx": 254754}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/hierarchy_network_demo.py#L132-L156", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Creates a RecordSensor region that allows us to specify a file record\n  stream as the input source.", "language": "python", "parameters": "(network, name, dataSource)", "return_statement": "return sensorRegion", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "\"py.RecordSensor\"", "arg_4", "=", "json", ".", "dumps", "(", "{", "\"verbosity\"", ":", "_VERBOSITY", "}", ")", "arg_0", ".", "addRegion", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "arg_5", "=", "arg_0", ".", "regions", "[", "arg_1", "]", ".", "getSelf", "(", ")", "arg_5", ".", "encoder", "=", "createEncoder", "(", ")", "arg_0", ".", "regions", "[", "arg_1", "]", ".", "setParameter", "(", "\"predictedField\"", ",", "\"consumption\"", ")", "arg_5", ".", "dataSource", "=", "arg_2", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"\n  Creates a RecordSensor region that allows us to specify a file record\n  stream as the input source.\n  \"\"\"\n\n  # Specific type of region. Possible options can be found in /nupic/regions/\n  arg_3 = \"py.RecordSensor\"\n\n  # Creates a json from specified dictionary.\n  arg_4 = json.dumps({\"verbosity\": _VERBOSITY})\n  arg_0.addRegion(arg_1, arg_3, arg_4)\n\n  # getSelf returns the actual region, instead of a region wrapper\n  arg_5 = arg_0.regions[arg_1].getSelf()\n\n  # Specify how RecordSensor encodes input values\n  arg_5.encoder = createEncoder()\n\n  # Specify which sub-encoder should be used for \"actValueOut\"\n  arg_0.regions[arg_1].setParameter(\"predictedField\", \"consumption\")\n\n  # Specify the dataSource as a file record stream instance\n  arg_5.dataSource = arg_2\n  return arg_5", "path": "examples/network/hierarchy_network_demo.py", "identifier": "createRecordSensor", "docstring": "Creates a RecordSensor region that allows us to specify a file record\n  stream as the input source.", "docstring_tokens": ["Creates", "a", "RecordSensor", "region", "that", "allows", "us", "to", "specify", "a", "file", "record", "stream", "as", "the", "input", "source", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254755}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/from_inspire.py#L410-L422", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Update reportnumbers.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "record_get_field_instances", "(", "arg_0", ".", "record", ",", "'037'", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "field_get_subfields", "(", "arg_2", ")", "for", "arg_4", "in", "arg_3", ".", "get", "(", "\"a\"", ",", "[", "]", ")", ":", "if", "\"arXiv\"", "not", "in", "arg_4", ":", "record_delete_field", "(", "arg_0", ".", "record", ",", "tag", "=", "\"037\"", ",", "field_position_global", "=", "arg_2", "[", "4", "]", ")", "arg_5", "=", "[", "(", "code", ",", "arg_4", "[", "0", "]", ")", "for", "code", ",", "arg_4", "in", "arg_3", ".", "items", "(", ")", "]", "record_add_field", "(", "arg_0", ".", "record", ",", "\"088\"", ",", "subfields", "=", "arg_5", ")", "break"], "function": "def Func(arg_0):\n        \"\"\"Update reportnumbers.\"\"\"\n        arg_1 = record_get_field_instances(arg_0.record, '037')\n        for arg_2 in arg_1:\n            arg_3 = field_get_subfields(arg_2)\n            for arg_4 in arg_3.get(\"a\", []):\n                if \"arXiv\" not in arg_4:\n                    record_delete_field(arg_0.record,\n                                        tag=\"037\",\n                                        field_position_global=arg_2[4])\n                    arg_5 = [(code, arg_4[0]) for code, arg_4 in arg_3.items()]\n                    record_add_field(arg_0.record, \"088\", subfields=arg_5)\n                    break", "path": "harvestingkit/inspire_cds_package/from_inspire.py", "identifier": "Inspire2CDS.update_reportnumbers", "docstring": "Update reportnumbers.", "docstring_tokens": ["Update", "reportnumbers", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 254756}
{"url": "https://github.com/voidpp/vcp/blob/5538cdb7b43029db9aac9edad823cd87afd89ab5/vcp/tools.py#L84-L106", "sha": "5538cdb7b43029db9aac9edad823cd87afd89ab5", "docstring_summary": "Creates a property with the given name, but the cls will created only with the first call", "language": "python", "parameters": "(carrier, name, cls, cls_args = {})", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "{", "}", ")", ":", "arg_4", "=", "\"__{}\"", ".", "format", "(", "arg_1", ")", "setattr", "(", "arg_0", ",", "arg_4", ",", "None", ")", "def", "getter", "(", "arg_5", ")", ":", "arg_6", "=", "getattr", "(", "arg_0", ",", "arg_4", ")", "if", "arg_6", "is", "None", ":", "arg_6", "=", "arg_2", "(", "**", "arg_3", ")", "setattr", "(", "arg_0", ",", "arg_4", ",", "arg_6", ")", "return", "arg_6", "setattr", "(", "type", "(", "arg_0", ")", ",", "arg_1", ",", "property", "(", "getter", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = {}):\n    \"\"\"Creates a property with the given name, but the cls will created only with the first call\n\n    Args:\n        carrier: an instance of the class where want to reach the cls instance\n        name (str): the variable name of the cls instance\n        cls (type): the singleton object type\n        cls_args (dict): optional dict for createing cls\n\n    \"\"\"\n    arg_4 = \"__{}\".format(arg_1)\n    setattr(arg_0, arg_4, None)\n\n    def getter(arg_5):\n        arg_6 = getattr(arg_0, arg_4)\n\n        if arg_6 is None:\n            arg_6 = arg_2(**arg_3)\n            setattr(arg_0, arg_4, arg_6)\n\n        return arg_6\n\n    setattr(type(arg_0), arg_1, property(getter))", "path": "vcp/tools.py", "identifier": "define_singleton", "docstring": "Creates a property with the given name, but the cls will created only with the first call\n\n    Args:\n        carrier: an instance of the class where want to reach the cls instance\n        name (str): the variable name of the cls instance\n        cls (type): the singleton object type\n        cls_args (dict): optional dict for createing cls", "docstring_tokens": ["Creates", "a", "property", "with", "the", "given", "name", "but", "the", "cls", "will", "created", "only", "with", "the", "first", "call"], "nwo": "voidpp/vcp", "score": 0.34668479461464624, "idx": 254757}
{"url": "https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/zincparser.py#L154-L192", "sha": "d52a7c6b5bc466f3c1a77b71814c8c0776aba995", "docstring_summary": "Iterative parser for string escapes.", "language": "python", "parameters": "(s, uri=False)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "''", "while", "len", "(", "arg_0", ")", ">", "0", ":", "arg_3", "=", "arg_0", "[", "0", "]", "if", "arg_3", "==", "'\\\\'", ":", "arg_4", "=", "arg_0", "[", "1", "]", "if", "arg_4", "in", "(", "'u'", ",", "'U'", ")", ":", "arg_2", "+=", "six", ".", "unichr", "(", "int", "(", "arg_0", "[", "2", ":", "6", "]", ",", "base", "=", "16", ")", ")", "arg_0", "=", "arg_0", "[", "6", ":", "]", "continue", "else", ":", "if", "arg_4", "==", "'b'", ":", "arg_2", "+=", "'\\b'", "elif", "arg_4", "==", "'f'", ":", "arg_2", "+=", "'\\f'", "elif", "arg_4", "==", "'n'", ":", "arg_2", "+=", "'\\n'", "elif", "arg_4", "==", "'r'", ":", "arg_2", "+=", "'\\r'", "elif", "arg_4", "==", "'t'", ":", "arg_2", "+=", "'\\t'", "else", ":", "if", "arg_1", "and", "(", "arg_4", "==", "'#'", ")", ":", "arg_2", "+=", "'\\\\'", "arg_2", "+=", "arg_4", "arg_0", "=", "arg_0", "[", "2", ":", "]", "continue", "else", ":", "arg_2", "+=", "arg_3", "arg_0", "=", "arg_0", "[", "1", ":", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Iterative parser for string escapes.\n    \"\"\"\n    arg_2 = ''\n    while len(arg_0) > 0:\n        arg_3 = arg_0[0]\n        if arg_3 == '\\\\':\n            # Backslash escape\n            arg_4 = arg_0[1]\n\n            if arg_4 in ('u', 'U'):\n                # Unicode escape\n                arg_2 += six.unichr(int(arg_0[2:6], base=16))\n                arg_0 = arg_0[6:]\n                continue\n            else:\n                if arg_4 == 'b':\n                    arg_2 += '\\b'\n                elif arg_4 == 'f':\n                    arg_2 += '\\f'\n                elif arg_4 == 'n':\n                    arg_2 += '\\n'\n                elif arg_4 == 'r':\n                    arg_2 += '\\r'\n                elif arg_4 == 't':\n                    arg_2 += '\\t'\n                else:\n                    if arg_1 and (arg_4 == '#'):\n                        # \\# is passed through with backslash.\n                        arg_2 += '\\\\'\n                    # Pass through\n                    arg_2 += arg_4\n                arg_0 = arg_0[2:]\n                continue\n        else:\n            arg_2 += arg_3\n            arg_0 = arg_0[1:]\n    return arg_2", "path": "hszinc/zincparser.py", "identifier": "_unescape", "docstring": "Iterative parser for string escapes.", "docstring_tokens": ["Iterative", "parser", "for", "string", "escapes", "."], "nwo": "vrtsystems/hszinc", "score": 0.2823188883832642, "idx": 254758}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-web/azure/mgmt/web/operations/domains_operations.py#L231-L304", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get domain name recommendations based on keywords.", "language": "python", "parameters": "(\n            self, keywords=None, max_domain_recommendations=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "**", "arg_5", ")", ":", "arg_6", "=", "models", ".", "DomainRecommendationSearchParameters", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "def", "internal_paging", "(", "arg_7", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "not", "arg_7", ":", "arg_8", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_9", "=", "{", "'subscriptionId'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.config.subscription_id\"", ",", "arg_0", ".", "config", ".", "subscription_id", ",", "'str'", ")", "}", "arg_8", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_8", ",", "**", "arg_9", ")", "arg_10", "=", "{", "}", "arg_10", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "else", ":", "arg_8", "=", "arg_7", "arg_10", "=", "{", "}", "arg_11", "=", "{", "}", "arg_11", "[", "'Accept'", "]", "=", "'application/json'", "arg_11", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_11", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_3", ":", "arg_11", ".", "update", "(", "arg_3", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_11", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_12", "=", "arg_0", ".", "_serialize", ".", "body", "(", "arg_6", ",", "'DomainRecommendationSearchParameters'", ")", "arg_13", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_8", ",", "arg_10", ",", "arg_11", ",", "arg_12", ")", "arg_14", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_13", ",", "stream", "=", "False", ",", "**", "arg_5", ")", "if", "arg_14", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "DefaultErrorResponseException", "(", "arg_0", ".", "_deserialize", ",", "arg_14", ")", "return", "arg_14", "arg_15", "=", "models", ".", "NameIdentifierPaged", "(", "internal_paging", ",", "arg_0", ".", "_deserialize", ".", "dependencies", ")", "if", "arg_4", ":", "arg_16", "=", "{", "}", "arg_17", "=", "models", ".", "NameIdentifierPaged", "(", "internal_paging", ",", "arg_0", ".", "_deserialize", ".", "dependencies", ",", "arg_16", ")", "return", "arg_17", "return", "arg_15"], "function": "def Func(\n            arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False, **arg_5):\n        \"\"\"Get domain name recommendations based on keywords.\n\n        Get domain name recommendations based on keywords.\n\n        :param keywords: Keywords to be used for generating domain\n         recommendations.\n        :type keywords: str\n        :param max_domain_recommendations: Maximum number of recommendations.\n        :type max_domain_recommendations: int\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: An iterator like instance of NameIdentifier\n        :rtype:\n         ~azure.mgmt.web.models.NameIdentifierPaged[~azure.mgmt.web.models.NameIdentifier]\n        :raises:\n         :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`\n        \"\"\"\n        arg_6 = models.DomainRecommendationSearchParameters(arg_1=arg_1, arg_2=arg_2)\n\n        def internal_paging(arg_7=None, arg_4=False):\n\n            if not arg_7:\n                # Construct URL\n                arg_8 = arg_0.Func.metadata['url']\n                arg_9 = {\n                    'subscriptionId': arg_0._serialize.url(\"self.config.subscription_id\", arg_0.config.subscription_id, 'str')\n                }\n                arg_8 = arg_0._client.format_url(arg_8, **arg_9)\n\n                # Construct parameters\n                arg_10 = {}\n                arg_10['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n\n            else:\n                arg_8 = arg_7\n                arg_10 = {}\n\n            # Construct headers\n            arg_11 = {}\n            arg_11['Accept'] = 'application/json'\n            arg_11['Content-Type'] = 'application/json; charset=utf-8'\n            if arg_0.config.generate_client_request_id:\n                arg_11['x-ms-client-request-id'] = str(uuid.uuid1())\n            if arg_3:\n                arg_11.update(arg_3)\n            if arg_0.config.accept_language is not None:\n                arg_11['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n            # Construct body\n            arg_12 = arg_0._serialize.body(arg_6, 'DomainRecommendationSearchParameters')\n\n            # Construct and send request\n            arg_13 = arg_0._client.post(arg_8, arg_10, arg_11, arg_12)\n            arg_14 = arg_0._client.send(arg_13, stream=False, **arg_5)\n\n            if arg_14.status_code not in [200]:\n                raise models.DefaultErrorResponseException(arg_0._deserialize, arg_14)\n\n            return arg_14\n\n        # Deserialize response\n        arg_15 = models.NameIdentifierPaged(internal_paging, arg_0._deserialize.dependencies)\n\n        if arg_4:\n            arg_16 = {}\n            arg_17 = models.NameIdentifierPaged(internal_paging, arg_0._deserialize.dependencies, arg_16)\n            return arg_17\n\n        return arg_15", "path": "azure-mgmt-web/azure/mgmt/web/operations/domains_operations.py", "identifier": "DomainsOperations.list_recommendations", "docstring": "Get domain name recommendations based on keywords.\n\n        Get domain name recommendations based on keywords.\n\n        :param keywords: Keywords to be used for generating domain\n         recommendations.\n        :type keywords: str\n        :param max_domain_recommendations: Maximum number of recommendations.\n        :type max_domain_recommendations: int\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: An iterator like instance of NameIdentifier\n        :rtype:\n         ~azure.mgmt.web.models.NameIdentifierPaged[~azure.mgmt.web.models.NameIdentifier]\n        :raises:\n         :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`", "docstring_tokens": ["Get", "domain", "name", "recommendations", "based", "on", "keywords", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254759}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/scalar.py#L348-L394", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the bit offset of the first bit to be set in the encoder output.\n    For periodic encoders, this can be a negative number when the encoded output\n    wraps around.", "language": "python", "parameters": "(self, input)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "==", "SENTINEL_VALUE_FOR_MISSING_DATA", ":", "return", "[", "None", "]", "else", ":", "if", "arg_1", "<", "arg_0", ".", "minval", ":", "if", "arg_0", ".", "clipInput", "and", "not", "arg_0", ".", "periodic", ":", "if", "arg_0", ".", "verbosity", ">", "0", ":", "print", "\"Clipped input %s=%.2f to minval %.2f\"", "%", "(", "arg_0", ".", "name", ",", "arg_1", ",", "arg_0", ".", "minval", ")", "arg_1", "=", "arg_0", ".", "minval", "else", ":", "raise", "Exception", "(", "'input (%s) less than range (%s - %s)'", "%", "(", "str", "(", "arg_1", ")", ",", "str", "(", "arg_0", ".", "minval", ")", ",", "str", "(", "arg_0", ".", "maxval", ")", ")", ")", "if", "arg_0", ".", "periodic", ":", "if", "arg_1", ">=", "arg_0", ".", "maxval", ":", "raise", "Exception", "(", "'input (%s) greater than periodic range (%s - %s)'", "%", "(", "str", "(", "arg_1", ")", ",", "str", "(", "arg_0", ".", "minval", ")", ",", "str", "(", "arg_0", ".", "maxval", ")", ")", ")", "else", ":", "if", "arg_1", ">", "arg_0", ".", "maxval", ":", "if", "arg_0", ".", "clipInput", ":", "if", "arg_0", ".", "verbosity", ">", "0", ":", "print", "\"Clipped input %s=%.2f to maxval %.2f\"", "%", "(", "arg_0", ".", "name", ",", "arg_1", ",", "arg_0", ".", "maxval", ")", "arg_1", "=", "arg_0", ".", "maxval", "else", ":", "raise", "Exception", "(", "'input (%s) greater than range (%s - %s)'", "%", "(", "str", "(", "arg_1", ")", ",", "str", "(", "arg_0", ".", "minval", ")", ",", "str", "(", "arg_0", ".", "maxval", ")", ")", ")", "if", "arg_0", ".", "periodic", ":", "arg_2", "=", "int", "(", "(", "arg_1", "-", "arg_0", ".", "minval", ")", "*", "arg_0", ".", "nInternal", "/", "arg_0", ".", "range", ")", "+", "arg_0", ".", "padding", "else", ":", "arg_2", "=", "int", "(", "(", "(", "arg_1", "-", "arg_0", ".", "minval", ")", "+", "arg_0", ".", "resolution", "/", "2", ")", "/", "arg_0", ".", "resolution", ")", "+", "arg_0", ".", "padding", "arg_3", "=", "arg_2", "-", "arg_0", ".", "halfwidth", "return", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Return the bit offset of the first bit to be set in the encoder output.\n    For periodic encoders, this can be a negative number when the encoded output\n    wraps around. \"\"\"\n\n    if arg_1 == SENTINEL_VALUE_FOR_MISSING_DATA:\n      return [None]\n\n    else:\n      if arg_1 < arg_0.minval:\n        # Don't clip periodic inputs. Out-of-range input is always an error\n        if arg_0.clipInput and not arg_0.periodic:\n          if arg_0.verbosity > 0:\n            print \"Clipped input %s=%.2f to minval %.2f\" % (arg_0.name, arg_1,\n                                                            arg_0.minval)\n          arg_1 = arg_0.minval\n        else:\n          raise Exception('input (%s) less than range (%s - %s)' %\n                          (str(arg_1), str(arg_0.minval), str(arg_0.maxval)))\n\n      if arg_0.periodic:\n        # Don't clip periodic inputs. Out-of-range input is always an error\n        if arg_1 >= arg_0.maxval:\n          raise Exception('input (%s) greater than periodic range (%s - %s)' %\n                          (str(arg_1), str(arg_0.minval), str(arg_0.maxval)))\n      else:\n        if arg_1 > arg_0.maxval:\n          if arg_0.clipInput:\n            if arg_0.verbosity > 0:\n              print \"Clipped input %s=%.2f to maxval %.2f\" % (arg_0.name, arg_1,\n                                                              arg_0.maxval)\n            arg_1 = arg_0.maxval\n          else:\n            raise Exception('input (%s) greater than range (%s - %s)' %\n                            (str(arg_1), str(arg_0.minval), str(arg_0.maxval)))\n\n      if arg_0.periodic:\n        arg_2 = int((arg_1 - arg_0.minval) * arg_0.nInternal / arg_0.range) \\\n                      + arg_0.padding\n      else:\n        arg_2 = int(((arg_1 - arg_0.minval) + arg_0.resolution/2) \\\n                          / arg_0.resolution ) + arg_0.padding\n\n\n      # We use the first bit to be set in the encoded output as the bucket index\n      arg_3 = arg_2 - arg_0.halfwidth\n      return [arg_3]", "path": "src/nupic/encoders/scalar.py", "identifier": "ScalarEncoder._getFirstOnBit", "docstring": "Return the bit offset of the first bit to be set in the encoder output.\n    For periodic encoders, this can be a negative number when the encoded output\n    wraps around.", "docstring_tokens": ["Return", "the", "bit", "offset", "of", "the", "first", "bit", "to", "be", "set", "in", "the", "encoder", "output", ".", "For", "periodic", "encoders", "this", "can", "be", "a", "negative", "number", "when", "the", "encoded", "output", "wraps", "around", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254760}
{"url": "https://github.com/eagleflo/adjutant/blob/85d800d9979fa122e0888af48c2e6a697f9da458/adjutant.py#L163-L191", "sha": "85d800d9979fa122e0888af48c2e6a697f9da458", "docstring_summary": "Parse the user data header portion of the replay.", "language": "python", "parameters": "(self)", "return_statement": "return header", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "OrderedDict", "(", ")", "arg_2", "=", "arg_0", ".", "archive", ".", "header", "[", "'user_data_header'", "]", "[", "'content'", "]", "if", "re", ".", "search", "(", "r'StarCraft II replay'", ",", "arg_2", ")", ":", "arg_2", "=", "StringIO", ".", "StringIO", "(", "arg_2", ")", "arg_2", ".", "seek", "(", "30", ")", "arg_1", ".", "update", "(", "read_table", "(", "arg_2", ",", "[", "'release_flag'", ",", "'major_version'", ",", "'minor_version'", ",", "'maintenance_version'", ",", "'build_number'", ",", "'unknown'", ",", "'unknown'", ",", "'duration'", "]", ")", ")", "arg_1", "[", "'version'", "]", "=", "'%s.%s.%s.%s'", "%", "(", "arg_1", "[", "'major_version'", "]", ",", "arg_1", "[", "'minor_version'", "]", ",", "arg_1", "[", "'maintenance_version'", "]", ",", "arg_1", "[", "'build_number'", "]", ")", "if", "not", "arg_1", "[", "'release_flag'", "]", ":", "arg_1", "[", "'version'", "]", "+=", "' (dev)'", "arg_1", "[", "'duration'", "]", "/=", "16", "else", ":", "raise", "ValueError", "(", "\"The given file is not a StarCraft II replay.\"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Parse the user data header portion of the replay.\"\"\"\n        arg_1 = OrderedDict()\n        arg_2 = arg_0.archive.header['user_data_header']['content']\n        if re.search(r'StarCraft II replay', arg_2):\n            arg_2 = StringIO.StringIO(arg_2)\n            arg_2.seek(30) # Just skip the beginning.\n            arg_1.update(read_table(arg_2, ['release_flag',\n                                                        'major_version',\n                                                        'minor_version',\n                                                        'maintenance_version',\n                                                        'build_number',\n                                                        'unknown',\n                                                        'unknown',\n                                                        'duration']))\n\n            # Some post processing is required.\n            arg_1['version'] = '%s.%s.%s.%s' % (arg_1['major_version'],\n                                                 arg_1['minor_version'],\n                                                 arg_1['maintenance_version'],\n                                                 arg_1['build_number'])\n            if not arg_1['release_flag']:\n                arg_1['version'] += ' (dev)'\n\n            # Duration is actually stored as 1/16th of a seconds. Go figure.\n            arg_1['duration'] /= 16\n        else:\n            raise ValueError(\"The given file is not a StarCraft II replay.\")\n        return arg_1", "path": "adjutant.py", "identifier": "SC2Replay._parse_header", "docstring": "Parse the user data header portion of the replay.", "docstring_tokens": ["Parse", "the", "user", "data", "header", "portion", "of", "the", "replay", "."], "nwo": "eagleflo/adjutant", "score": 0.21302904236143622, "idx": 254761}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/internal/util.py#L414-L437", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Wraps a getter so it applies to the inner-most results in `kernel_results`.", "language": "python", "parameters": "(getter)", "return_statement": "return _new_getter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "_new_getter", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "[", "]", "while", "hasattr", "(", "arg_1", ",", "'inner_results'", ")", ":", "arg_4", ".", "append", "(", "arg_1", ")", "arg_1", "=", "arg_1", ".", "inner_results", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "_new_getter"], "function": "def Func(arg_0):\n  \"\"\"Wraps a getter so it applies to the inner-most results in `kernel_results`.\n\n  The wrapped getter unwraps `kernel_results` and returns the return value of\n  `getter` called with the first results without an `inner_results` attribute.\n\n  Args:\n    getter: A callable that takes Kernel results and returns some value.\n\n  Returns:\n    new_getter: A wrapped `getter`.\n  \"\"\"\n\n  @functools.wraps(arg_0)\n  def _new_getter(arg_1, *arg_2, **arg_3):\n    \"\"\"Wrapped getter.\"\"\"\n    arg_4 = []\n    while hasattr(arg_1, 'inner_results'):\n      arg_4.append(arg_1)\n      arg_1 = arg_1.inner_results\n\n    return arg_0(arg_1, *arg_2, **arg_3)\n\n  return _new_getter", "path": "tensorflow_probability/python/mcmc/internal/util.py", "identifier": "make_innermost_getter", "docstring": "Wraps a getter so it applies to the inner-most results in `kernel_results`.\n\n  The wrapped getter unwraps `kernel_results` and returns the return value of\n  `getter` called with the first results without an `inner_results` attribute.\n\n  Args:\n    getter: A callable that takes Kernel results and returns some value.\n\n  Returns:\n    new_getter: A wrapped `getter`.", "docstring_tokens": ["Wraps", "a", "getter", "so", "it", "applies", "to", "the", "inner", "-", "most", "results", "in", "kernel_results", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254762}
{"url": "https://github.com/JukeboxPipeline/jukedj/blob/d4159961c819c26792a278981ee68106ee15f3f3/src/jukedj/models.py#L490-L508", "sha": "d4159961c819c26792a278981ee68106ee15f3f3", "docstring_summary": "Create all tasks for the element", "language": "python", "parameters": "(element)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "project", "if", "isinstance", "(", "arg_0", ",", "Asset", ")", ":", "arg_2", "=", "True", "else", ":", "arg_2", "=", "False", "arg_3", "=", "arg_1", ".", "department_set", ".", "filter", "(", "assetflag", "=", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "Task", "(", "project", "=", "arg_1", ",", "department", "=", "arg_4", ",", "arg_0", "=", "arg_0", ")", "arg_5", ".", "full_clean", "(", ")", "arg_5", ".", "save", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Create all tasks for the element\n\n    :param element: The shot or asset that needs tasks\n    :type element: :class:`muke.models.Shot` | :class:`muke.models.Asset`\n    :returns: None\n    :rtype: None\n    :raises: None\n    \"\"\"\n    arg_1 = arg_0.project\n    if isinstance(arg_0, Asset):\n        arg_2=True\n    else:\n        arg_2=False\n    arg_3 = arg_1.department_set.filter(assetflag=arg_2)\n    for arg_4 in arg_3:\n        arg_5 = Task(project=arg_1, department=arg_4, arg_0=arg_0)\n        arg_5.full_clean()\n        arg_5.save()", "path": "src/jukedj/models.py", "identifier": "create_all_tasks", "docstring": "Create all tasks for the element\n\n    :param element: The shot or asset that needs tasks\n    :type element: :class:`muke.models.Shot` | :class:`muke.models.Asset`\n    :returns: None\n    :rtype: None\n    :raises: None", "docstring_tokens": ["Create", "all", "tasks", "for", "the", "element"], "nwo": "JukeboxPipeline/jukedj", "score": 0.09252797783733271, "idx": 254763}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/petitdb.py#L492-L519", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return True if an item with the value of `unique_fields`\n        from `data` is unique in the table with `table_name`.\n        False if no sample is found or more than one is found.", "language": "python", "parameters": "(self, table_name, sample, unique_fields=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "try", ":", "arg_4", "=", "find_unique", "(", "arg_0", ".", "table", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "except", ":", "return", "False", "else", ":", "return", "arg_4", "is", "not", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Return True if an item with the value of `unique_fields`\n        from `data` is unique in the table with `table_name`.\n        False if no sample is found or more than one is found.\n\n        See function `find_unique` for more details.\n\n        Parameters\n        ----------\n        table_name: str\n\n        sample: dict\n            Sample data for query\n\n        unique_fields: str or list of str\n\n        Returns\n        -------\n        Func: bool\n        \"\"\"\n        try:\n            arg_4 = find_unique(arg_0.table(arg_1),\n                              arg_2=arg_2,\n                              arg_3=arg_3)\n        except:\n            return False\n        else:\n            return arg_4 is not None", "path": "boyle/petitdb.py", "identifier": "PetitDB.is_unique", "docstring": "Return True if an item with the value of `unique_fields`\n        from `data` is unique in the table with `table_name`.\n        False if no sample is found or more than one is found.\n\n        See function `find_unique` for more details.\n\n        Parameters\n        ----------\n        table_name: str\n\n        sample: dict\n            Sample data for query\n\n        unique_fields: str or list of str\n\n        Returns\n        -------\n        is_unique: bool", "docstring_tokens": ["Return", "True", "if", "an", "item", "with", "the", "value", "of", "unique_fields", "from", "data", "is", "unique", "in", "the", "table", "with", "table_name", ".", "False", "if", "no", "sample", "is", "found", "or", "more", "than", "one", "is", "found", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254764}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/effects.py#L310-L387", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Remix an audio signal by re-ordering time intervals.", "language": "python", "parameters": "(y, intervals, align_zeros=True)", "return_statement": "return np.concatenate(y_out, axis=-1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "util", ".", "valid_audio", "(", "arg_0", ",", "mono", "=", "False", ")", "arg_3", "=", "[", "]", "if", "arg_2", ":", "arg_4", "=", "core", ".", "to_mono", "(", "arg_0", ")", "arg_5", "=", "np", ".", "nonzero", "(", "core", ".", "zero_crossings", "(", "arg_4", ")", ")", "[", "-", "1", "]", "arg_5", "=", "np", ".", "append", "(", "arg_5", ",", "[", "len", "(", "arg_4", ")", "]", ")", "arg_6", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "for", "arg_7", "in", "arg_1", ":", "if", "arg_2", ":", "arg_7", "=", "arg_5", "[", "util", ".", "match_events", "(", "arg_7", ",", "arg_5", ")", "]", "arg_6", "[", "-", "1", "]", "=", "slice", "(", "arg_7", "[", "0", "]", ",", "arg_7", "[", "1", "]", ")", "arg_3", ".", "append", "(", "arg_0", "[", "tuple", "(", "arg_6", ")", "]", ")", "return", "np", ".", "concatenate", "(", "arg_3", ",", "axis", "=", "-", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    '''Remix an audio signal by re-ordering time intervals.\n\n\n    Parameters\n    ----------\n    y : np.ndarray [shape=(t,) or (2, t)]\n        Audio time series\n\n    intervals : iterable of tuples (start, end)\n        An iterable (list-like or generator) where the `i`th item\n        `intervals[i]` indicates the start and end (in samples)\n        of a slice of `y`.\n\n    align_zeros : boolean\n        If `True`, interval boundaries are mapped to the closest\n        zero-crossing in `y`.  If `y` is stereo, zero-crossings\n        are computed after converting to mono.\n\n\n    Returns\n    -------\n    y_Func : np.ndarray [shape=(d,) or (2, d)]\n        `y` Funced in the order specified by `intervals`\n\n\n    Examples\n    --------\n    Load in the example track and reverse the beats\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n\n\n    Compute beats\n\n    >>> _, beat_frames = librosa.beat.beat_track(y=y, sr=sr,\n    ...                                          hop_length=512)\n\n\n    Convert from frames to sample indices\n\n    >>> beat_samples = librosa.frames_to_samples(beat_frames)\n\n\n    Generate intervals from consecutive events\n\n    >>> intervals = librosa.util.frame(beat_samples, frame_length=2,\n    ...                                hop_length=1).T\n\n\n    Reverse the beat intervals\n\n    >>> y_out = librosa.effects.Func(y, intervals[::-1])\n    '''\n\n    # Validate the audio buffer\n    util.valid_audio(arg_0, mono=False)\n\n    arg_3 = []\n\n    if arg_2:\n        arg_4 = core.to_mono(arg_0)\n        arg_5 = np.nonzero(core.zero_crossings(arg_4))[-1]\n        # Force end-of-signal onto zeros\n        arg_5 = np.append(arg_5, [len(arg_4)])\n\n    arg_6 = [slice(None)] * arg_0.ndim\n\n    for arg_7 in arg_1:\n\n        if arg_2:\n            arg_7 = arg_5[util.match_events(arg_7, arg_5)]\n\n        arg_6[-1] = slice(arg_7[0], arg_7[1])\n\n        arg_3.append(arg_0[tuple(arg_6)])\n\n    return np.concatenate(arg_3, axis=-1)", "path": "librosa/effects.py", "identifier": "remix", "docstring": "Remix an audio signal by re-ordering time intervals.\n\n\n    Parameters\n    ----------\n    y : np.ndarray [shape=(t,) or (2, t)]\n        Audio time series\n\n    intervals : iterable of tuples (start, end)\n        An iterable (list-like or generator) where the `i`th item\n        `intervals[i]` indicates the start and end (in samples)\n        of a slice of `y`.\n\n    align_zeros : boolean\n        If `True`, interval boundaries are mapped to the closest\n        zero-crossing in `y`.  If `y` is stereo, zero-crossings\n        are computed after converting to mono.\n\n\n    Returns\n    -------\n    y_remix : np.ndarray [shape=(d,) or (2, d)]\n        `y` remixed in the order specified by `intervals`\n\n\n    Examples\n    --------\n    Load in the example track and reverse the beats\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n\n\n    Compute beats\n\n    >>> _, beat_frames = librosa.beat.beat_track(y=y, sr=sr,\n    ...                                          hop_length=512)\n\n\n    Convert from frames to sample indices\n\n    >>> beat_samples = librosa.frames_to_samples(beat_frames)\n\n\n    Generate intervals from consecutive events\n\n    >>> intervals = librosa.util.frame(beat_samples, frame_length=2,\n    ...                                hop_length=1).T\n\n\n    Reverse the beat intervals\n\n    >>> y_out = librosa.effects.remix(y, intervals[::-1])", "docstring_tokens": ["Remix", "an", "audio", "signal", "by", "re", "-", "ordering", "time", "intervals", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 254765}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/redshift_hook.py#L68-L83", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Gets a list of snapshots for a cluster", "language": "python", "parameters": "(self, cluster_identifier)", "return_statement": "return snapshots", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "ClusterIdentifier", "=", "arg_1", ")", "if", "'Snapshots'", "not", "in", "arg_2", ":", "return", "None", "arg_3", "=", "arg_2", "[", "'Snapshots'", "]", "arg_3", "=", "filter", "(", "lambda", "x", ":", "x", "[", "'Status'", "]", ",", "arg_3", ")", "arg_3", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "'SnapshotCreateTime'", "]", ",", "reverse", "=", "True", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Gets a list of snapshots for a cluster\n\n        :param cluster_identifier: unique identifier of a cluster\n        :type cluster_identifier: str\n        \"\"\"\n        arg_2 = arg_0.get_conn().Func(\n            ClusterIdentifier=arg_1\n        )\n        if 'Snapshots' not in arg_2:\n            return None\n        arg_3 = arg_2['Snapshots']\n        arg_3 = filter(lambda x: x['Status'], arg_3)\n        arg_3.sort(key=lambda x: x['SnapshotCreateTime'], reverse=True)\n        return arg_3", "path": "airflow/contrib/hooks/redshift_hook.py", "identifier": "RedshiftHook.describe_cluster_snapshots", "docstring": "Gets a list of snapshots for a cluster\n\n        :param cluster_identifier: unique identifier of a cluster\n        :type cluster_identifier: str", "docstring_tokens": ["Gets", "a", "list", "of", "snapshots", "for", "a", "cluster"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254766}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L811-L818", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "The 1D index mappings between the unmasked sparse-grid and masked sparse grid.", "language": "python", "parameters": "(self)", "return_statement": "return mapping_util.unmasked_sparse_to_sparse_from_mask_and_pixel_centres(\n            mask=self.regular_grid.mask,\n            unmasked_sparse_grid_pixel_centres=self.unmasked_sparse_grid_pixel_centres,\n            total_sparse_pixels=self.total_sparse_pixels).astype(\n            'int')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "mapping_util", ".", "Func_from_mask_and_pixel_centres", "(", "mask", "=", "arg_0", ".", "regular_grid", ".", "mask", ",", "unmasked_sparse_grid_pixel_centres", "=", "arg_0", ".", "unmasked_sparse_grid_pixel_centres", ",", "total_sparse_pixels", "=", "arg_0", ".", "total_sparse_pixels", ")", ".", "astype", "(", "'int'", ")"], "function": "def Func(arg_0):\n        \"\"\"The 1D index mappings between the unmasked sparse-grid and masked sparse grid.\"\"\"\n\n        return mapping_util.Func_from_mask_and_pixel_centres(\n            mask=arg_0.regular_grid.mask,\n            unmasked_sparse_grid_pixel_centres=arg_0.unmasked_sparse_grid_pixel_centres,\n            total_sparse_pixels=arg_0.total_sparse_pixels).astype(\n            'int')", "path": "autolens/data/array/grids.py", "identifier": "SparseToRegularGrid.unmasked_sparse_to_sparse", "docstring": "The 1D index mappings between the unmasked sparse-grid and masked sparse grid.", "docstring_tokens": ["The", "1D", "index", "mappings", "between", "the", "unmasked", "sparse", "-", "grid", "and", "masked", "sparse", "grid", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 254767}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/decorators.py#L53-L71", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Ignore any emitted warnings from a function.", "language": "python", "parameters": "(warning)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "warnings", ".", "simplefilter", "(", "'ignore'", ",", "arg_0", ")", "return", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Ignore any emitted warnings from a function.\n\n    :param warning: The category of warning to ignore.\n    \"\"\"\n    def decorator(arg_1):\n        \"\"\"\n        Return a decorated function whose emitted warnings are ignored.\n        \"\"\"\n        @wraps(arg_1)\n        def wrapper(*arg_2, **arg_3):\n            \"\"\"\n            Wrap the function.\n            \"\"\"\n            warnings.simplefilter('ignore', arg_0)\n            return arg_1(*arg_2, **arg_3)\n        return wrapper\n    return decorator", "path": "enterprise/decorators.py", "identifier": "ignore_warning", "docstring": "Ignore any emitted warnings from a function.\n\n    :param warning: The category of warning to ignore.", "docstring_tokens": ["Ignore", "any", "emitted", "warnings", "from", "a", "function", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254768}
{"url": "https://github.com/andrefsp/pyflot/blob/f2dde10709aeed39074fcce8172184b5cd8bfd66/flot/__init__.py#L266-L270", "sha": "f2dde10709aeed39074fcce8172184b5cd8bfd66", "docstring_summary": "will get the axis mode for the current series", "language": "python", "parameters": "(self, axis)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "all", "(", "[", "isinstance", "(", "getattr", "(", "arg_2", ",", "arg_1", ")", ",", "TimeVariable", ")", "for", "arg_2", "in", "arg_0", ".", "_series", "]", ")", ":", "return", "'time'", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"will get the axis mode for the current series\"\n        if all([isinstance(getattr(arg_2, arg_1), TimeVariable) for arg_2 in arg_0._series]):\n            return 'time'\n        return None", "path": "flot/__init__.py", "identifier": "Graph._get_axis_mode", "docstring": "will get the axis mode for the current series", "docstring_tokens": ["will", "get", "the", "axis", "mode", "for", "the", "current", "series"], "nwo": "andrefsp/pyflot", "score": 0.16941397159673272, "idx": 254769}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/stream.py#L131-L153", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Custom grouping from a given serialized string", "language": "python", "parameters": "(cls, serialized, is_java=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"Argument to Func() must be \"", "\"a serialized Python class as bytes, given: %s\"", "%", "str", "(", "arg_1", ")", ")", "if", "not", "arg_2", ":", "return", "arg_0", ".", "CUSTOM", "(", "gtype", "=", "topology_pb2", ".", "Grouping", ".", "Value", "(", "\"CUSTOM\"", ")", ",", "python_serialized", "=", "arg_1", ")", "else", ":", "raise", "NotImplementedError", "(", "\"Custom grouping implemented in Java for Python topology\"", "\"is not yet supported.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"Custom grouping from a given serialized string\n\n    This class is created for compatibility with ``Func(cls, java_serialized)`` method\n    of StreamParse API, although its functionality is not yet implemented (Java-serialized).\n    Currently only custom grouping implemented in Python is supported, and ``custom()`` method\n    should be used to indicate its classpath, rather than directly to use this method.\n\n    In the future, users can directly specify Java-serialized object with ``is_java=True`` in order\n    to use a custom grouping implemented in Java for python topology.\n\n    :param serialized: serialized classpath to custom grouping class to use (if python)\n    :param is_java: indicate whether this is Java serialized, or python serialized\n    \"\"\"\n    if not isinstance(arg_1, bytes):\n      raise TypeError(\"Argument to Func() must be \"\n                      \"a serialized Python class as bytes, given: %s\" % str(arg_1))\n    if not arg_2:\n      return arg_0.CUSTOM(gtype=topology_pb2.Grouping.Value(\"CUSTOM\"),\n                        python_serialized=arg_1)\n    else:\n      raise NotImplementedError(\"Custom grouping implemented in Java for Python topology\"\n                                \"is not yet supported.\")", "path": "heronpy/api/stream.py", "identifier": "Grouping.custom_serialized", "docstring": "Custom grouping from a given serialized string\n\n    This class is created for compatibility with ``custom_serialized(cls, java_serialized)`` method\n    of StreamParse API, although its functionality is not yet implemented (Java-serialized).\n    Currently only custom grouping implemented in Python is supported, and ``custom()`` method\n    should be used to indicate its classpath, rather than directly to use this method.\n\n    In the future, users can directly specify Java-serialized object with ``is_java=True`` in order\n    to use a custom grouping implemented in Java for python topology.\n\n    :param serialized: serialized classpath to custom grouping class to use (if python)\n    :param is_java: indicate whether this is Java serialized, or python serialized", "docstring_tokens": ["Custom", "grouping", "from", "a", "given", "serialized", "string"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254770}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/scriptin.py#L41-L51", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Use this to set what file to read from.", "language": "python", "parameters": "(self, inp, opts=None)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "io", ".", "TextIOWrapper", ")", ":", "arg_0", ".", "input", "=", "arg_1", "elif", "isinstance", "(", "arg_1", ",", "'string'", ".", "__class__", ")", ":", "arg_0", ".", "name", "=", "arg_1", "arg_0", ".", "input", "=", "Func", "(", "arg_1", ",", "'r'", ")", "else", ":", "raise", "IOError", "(", "\"Invalid input type (%s) for %s\"", "%", "(", "arg_1", ".", "__class__", ".", "__name__", ",", "arg_1", ")", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Use this to set what file to read from. \"\"\"\n        if isinstance(arg_1, io.TextIOWrapper):\n            arg_0.input = arg_1\n        elif isinstance(arg_1, 'string'.__class__):  # FIXME\n            arg_0.name  = arg_1\n            arg_0.input = Func(arg_1, 'r')\n        else:\n            raise IOError(\"Invalid input type (%s) for %s\" %\n                          (arg_1.__class__.__name__, arg_1))\n        return", "path": "trepan/inout/scriptin.py", "identifier": "ScriptInput.open", "docstring": "Use this to set what file to read from.", "docstring_tokens": ["Use", "this", "to", "set", "what", "file", "to", "read", "from", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 254771}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/settings.py#L118-L162", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Read settings from a config file in the source_dir root.", "language": "python", "parameters": "(filename=None)", "return_statement": "return settings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_1", ".", "info", "(", "\"Reading settings ...\"", ")", "arg_2", "=", "_DEFAULT_CONFIG", ".", "copy", "(", ")", "if", "arg_0", ":", "arg_1", ".", "debug", "(", "\"Settings file: %s\"", ",", "arg_0", ")", "arg_3", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "arg_4", "=", "{", "}", "with", "open", "(", "arg_0", ")", "as", "f", ":", "arg_5", "=", "compile", "(", "f", ".", "read", "(", ")", ",", "arg_0", ",", "'exec'", ")", "exec", "(", "arg_5", ",", "arg_4", ")", "arg_2", ".", "update", "(", "(", "arg_6", ",", "arg_7", ")", "for", "arg_6", ",", "arg_7", "in", "arg_4", ".", "items", "(", ")", "if", "arg_6", "not", "in", "[", "'__builtins__'", "]", ")", "arg_8", "=", "[", "'source'", ",", "'destination'", ",", "'watermark'", "]", "if", "os", ".", "path", ".", "isdir", "(", "join", "(", "arg_3", ",", "arg_2", "[", "'theme'", "]", ")", ")", "and", "os", ".", "path", ".", "isdir", "(", "join", "(", "arg_3", ",", "arg_2", "[", "'theme'", "]", ",", "'templates'", ")", ")", ":", "arg_8", ".", "append", "(", "'theme'", ")", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "arg_2", "[", "arg_9", "]", "if", "arg_10", "and", "not", "isabs", "(", "arg_10", ")", ":", "arg_2", "[", "arg_9", "]", "=", "abspath", "(", "normpath", "(", "join", "(", "arg_3", ",", "arg_10", ")", ")", ")", "arg_1", ".", "debug", "(", "\"Rewrite %s : %s -> %s\"", ",", "arg_9", ",", "arg_10", ",", "arg_2", "[", "arg_9", "]", ")", "for", "arg_11", "in", "(", "'img_size'", ",", "'thumb_size'", ",", "'video_size'", ")", ":", "arg_12", ",", "arg_13", "=", "arg_2", "[", "arg_11", "]", "if", "arg_13", ">", "arg_12", ":", "arg_2", "[", "arg_11", "]", "=", "(", "arg_13", ",", "arg_12", ")", "arg_1", ".", "warning", "(", "\"The %s setting should be specified with the \"", "\"largest value first.\"", ",", "arg_11", ")", "if", "not", "arg_2", "[", "'img_processor'", "]", ":", "arg_1", ".", "info", "(", "'No Processor, images will not be resized'", ")", "arg_1", ".", "debug", "(", "'Settings:\\n%s'", ",", "pformat", "(", "arg_2", ",", "width", "=", "120", ")", ")", "return", "arg_2"], "function": "def Func(arg_0=None):\n    \"\"\"Read settings from a config file in the source_dir root.\"\"\"\n\n    arg_1 = logging.getLogger(__name__)\n    arg_1.info(\"Reading settings ...\")\n    arg_2 = _DEFAULT_CONFIG.copy()\n\n    if arg_0:\n        arg_1.debug(\"Settings file: %s\", arg_0)\n        arg_3 = os.path.dirname(arg_0)\n        arg_4 = {}\n\n        with open(arg_0) as f:\n            arg_5 = compile(f.read(), arg_0, 'exec')\n            exec(arg_5, arg_4)\n\n        arg_2.update((arg_6, arg_7) for arg_6, arg_7 in arg_4.items()\n                        if arg_6 not in ['__builtins__'])\n\n        # Make the paths relative to the settings file\n        arg_8 = ['source', 'destination', 'watermark']\n\n        if os.path.isdir(join(arg_3, arg_2['theme'])) and \\\n                os.path.isdir(join(arg_3, arg_2['theme'],\n                                   'templates')):\n            arg_8.append('theme')\n\n        for arg_9 in arg_8:\n            arg_10 = arg_2[arg_9]\n            if arg_10 and not isabs(arg_10):\n                arg_2[arg_9] = abspath(normpath(join(arg_3, arg_10)))\n                arg_1.debug(\"Rewrite %s : %s -> %s\", arg_9, arg_10, arg_2[arg_9])\n\n    for arg_11 in ('img_size', 'thumb_size', 'video_size'):\n        arg_12, arg_13 = arg_2[arg_11]\n        if arg_13 > arg_12:\n            arg_2[arg_11] = (arg_13, arg_12)\n            arg_1.warning(\"The %s setting should be specified with the \"\n                           \"largest value first.\", arg_11)\n\n    if not arg_2['img_processor']:\n        arg_1.info('No Processor, images will not be resized')\n\n    arg_1.debug('Settings:\\n%s', pformat(arg_2, width=120))\n    return arg_2", "path": "sigal/settings.py", "identifier": "read_settings", "docstring": "Read settings from a config file in the source_dir root.", "docstring_tokens": ["Read", "settings", "from", "a", "config", "file", "in", "the", "source_dir", "root", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 254772}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/_reloader.py#L86-L106", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Spawn a new Python interpreter with the same arguments as this one,\n        but running the reloader thread.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "1", ":", "_log", "(", "'info'", ",", "' * Restarting with %s'", "%", "arg_0", ".", "name", ")", "arg_1", "=", "[", "sys", ".", "executable", "]", "+", "sys", ".", "argv", "arg_2", "=", "os", ".", "environ", ".", "copy", "(", ")", "arg_2", "[", "'WERKZEUG_RUN_MAIN'", "]", "=", "'true'", "if", "os", ".", "name", "==", "'nt'", "and", "PY2", ":", "for", "arg_3", ",", "arg_4", "in", "iteritems", "(", "arg_2", ")", ":", "if", "isinstance", "(", "arg_4", ",", "text_type", ")", ":", "arg_2", "[", "arg_3", "]", "=", "arg_4", ".", "encode", "(", "'iso-8859-1'", ")", "arg_5", "=", "subprocess", ".", "call", "(", "arg_1", ",", "env", "=", "arg_2", ")", "if", "arg_5", "!=", "3", ":", "return", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"Spawn a new Python interpreter with the same arguments as this one,\n        but running the reloader thread.\n        \"\"\"\n        while 1:\n            _log('info', ' * Restarting with %s' % arg_0.name)\n            arg_1 = [sys.executable] + sys.argv\n            arg_2 = os.environ.copy()\n            arg_2['WERKZEUG_RUN_MAIN'] = 'true'\n\n            # a weird bug on windows. sometimes unicode strings end up in the\n            # environment and subprocess.call does not like this, encode them\n            # to latin1 and continue.\n            if os.name == 'nt' and PY2:\n                for arg_3, arg_4 in iteritems(arg_2):\n                    if isinstance(arg_4, text_type):\n                        arg_2[arg_3] = arg_4.encode('iso-8859-1')\n\n            arg_5 = subprocess.call(arg_1, env=arg_2)\n            if arg_5 != 3:\n                return arg_5", "path": "capybara/virtualenv/lib/python2.7/site-packages/werkzeug/_reloader.py", "identifier": "ReloaderLoop.restart_with_reloader", "docstring": "Spawn a new Python interpreter with the same arguments as this one,\n        but running the reloader thread.", "docstring_tokens": ["Spawn", "a", "new", "Python", "interpreter", "with", "the", "same", "arguments", "as", "this", "one", "but", "running", "the", "reloader", "thread", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254773}
{"url": "https://github.com/twaddington/django-gravatar/blob/c4849d93ed43b419eceff0ff2de83d4265597629/django_gravatar/templatetags/gravatar.py#L11-L21", "sha": "c4849d93ed43b419eceff0ff2de83d4265597629", "docstring_summary": "Builds a gravatar url from an user or email", "language": "python", "parameters": "(user_or_email, size=GRAVATAR_DEFAULT_SIZE)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'email'", ")", ":", "arg_3", "=", "arg_0", ".", "email", "else", ":", "arg_3", "=", "arg_0", "try", ":", "return", "escape", "(", "get_Func", "(", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")", ")", "except", ":", "return", "''"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\" Builds a gravatar url from an user or email \"\"\"\n    if hasattr(arg_0, 'email'):\n        arg_3 = arg_0.email\n    else:\n        arg_3 = arg_0\n\n    try:\n        return escape(get_Func(arg_3=arg_3, arg_1=arg_1))\n    except:\n        return ''", "path": "django_gravatar/templatetags/gravatar.py", "identifier": "gravatar_url", "docstring": "Builds a gravatar url from an user or email", "docstring_tokens": ["Builds", "a", "gravatar", "url", "from", "an", "user", "or", "email"], "nwo": "twaddington/django-gravatar", "score": 0.518034445889309, "idx": 254774}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/error_summary.py#L55-L64", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Return the set of all incorrect names from the given namespace in the graph.", "language": "python", "parameters": "(graph: BELGraph, namespace: str)", "return_statement": "return {\n        exc.name\n        for _, exc, _ in graph.warnings\n        if isinstance(exc, (MissingNamespaceNameWarning, MissingNamespaceRegexWarning)) and exc.namespace == namespace\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "Set", "[", "arg_3", "]", ":", "return", "{", "arg_5", ".", "name", "for", "arg_4", ",", "arg_5", ",", "arg_4", "in", "arg_0", ".", "warnings", "if", "isinstance", "(", "arg_5", ",", "(", "MissingNamespaceNameWarning", ",", "MissingNamespaceRegexWarning", ")", ")", "and", "arg_5", ".", "namespace", "==", "arg_2", "}"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> Set[arg_3]:\n    \"\"\"Return the set of all incorrect names from the given namespace in the graph.\n\n    :return: The set of all incorrect names from the given namespace in the graph\n    \"\"\"\n    return {\n        arg_5.name\n        for arg_4, arg_5, arg_4 in arg_0.warnings\n        if isinstance(arg_5, (MissingNamespaceNameWarning, MissingNamespaceRegexWarning)) and arg_5.namespace == arg_2\n    }", "path": "src/pybel_tools/summary/error_summary.py", "identifier": "get_incorrect_names_by_namespace", "docstring": "Return the set of all incorrect names from the given namespace in the graph.\n\n    :return: The set of all incorrect names from the given namespace in the graph", "docstring_tokens": ["Return", "the", "set", "of", "all", "incorrect", "names", "from", "the", "given", "namespace", "in", "the", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 254775}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L71-L83", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Updates the SIS ID for the account identified by the passed account ID.", "language": "python", "parameters": "(self, account_id, sis_account_id)", "return_statement": "return CanvasAccount(data=self._put_resource(url, body))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "arg_0", ".", "_canvas_account_id", ":", "raise", "Exception", "(", "\"SIS ID cannot be updated for the root account\"", ")", "arg_3", "=", "ACCOUNTS_API", ".", "format", "(", "arg_1", ")", "arg_4", "=", "{", "\"account\"", ":", "{", "\"sis_account_id\"", ":", "arg_2", "}", "}", "return", "CanvasAccount", "(", "data", "=", "arg_0", ".", "_put_resource", "(", "arg_3", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Updates the SIS ID for the account identified by the passed account ID.\n\n        https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update\n        \"\"\"\n        if arg_1 == arg_0._canvas_account_id:\n            raise Exception(\"SIS ID cannot be updated for the root account\")\n\n        arg_3 = ACCOUNTS_API.format(arg_1)\n        arg_4 = {\"account\": {\"sis_account_id\": arg_2}}\n\n        return CanvasAccount(data=arg_0._put_resource(arg_3, arg_4))", "path": "uw_canvas/accounts.py", "identifier": "Accounts.update_sis_id", "docstring": "Updates the SIS ID for the account identified by the passed account ID.\n\n        https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update", "docstring_tokens": ["Updates", "the", "SIS", "ID", "for", "the", "account", "identified", "by", "the", "passed", "account", "ID", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 254776}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1421-L1468", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "creates a new, empty table in the dataset;\n        If the table already exists, update the existing table.\n        Since BigQuery does not natively allow table upserts, this is not an\n        atomic operation.", "language": "python", "parameters": "(self, dataset_id, table_resource, project_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_2", "[", "'tableReference'", "]", "[", "'tableId'", "]", "arg_3", "=", "arg_3", "if", "arg_3", "is", "not", "None", "else", "arg_0", ".", "project_id", "arg_5", "=", "arg_0", ".", "service", ".", "tables", "(", ")", ".", "list", "(", "projectId", "=", "arg_3", ",", "datasetId", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "while", "True", ":", "for", "arg_6", "in", "arg_5", ".", "get", "(", "'tables'", ",", "[", "]", ")", ":", "if", "arg_6", "[", "'tableReference'", "]", "[", "'tableId'", "]", "==", "arg_4", ":", "arg_0", ".", "log", ".", "info", "(", "'Table %s:%s.%s exists, updating.'", ",", "arg_3", ",", "arg_1", ",", "arg_4", ")", "return", "arg_0", ".", "service", ".", "tables", "(", ")", ".", "update", "(", "projectId", "=", "arg_3", ",", "datasetId", "=", "arg_1", ",", "tableId", "=", "arg_4", ",", "body", "=", "arg_2", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "if", "'nextPageToken'", "in", "arg_5", ":", "arg_5", "=", "arg_0", ".", "service", ".", "tables", "(", ")", ".", "list", "(", "projectId", "=", "arg_3", ",", "datasetId", "=", "arg_1", ",", "pageToken", "=", "arg_5", "[", "'nextPageToken'", "]", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "'Table %s:%s.%s does not exist. creating.'", ",", "arg_3", ",", "arg_1", ",", "arg_4", ")", "return", "arg_0", ".", "service", ".", "tables", "(", ")", ".", "insert", "(", "projectId", "=", "arg_3", ",", "datasetId", "=", "arg_1", ",", "body", "=", "arg_2", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        creates a new, empty table in the dataset;\n        If the table already exists, update the existing table.\n        Since BigQuery does not natively allow table upserts, this is not an\n        atomic operation.\n\n        :param dataset_id: the dataset to upsert the table into.\n        :type dataset_id: str\n        :param table_resource: a table resource. see\n            https://cloud.google.com/bigquery/docs/reference/v2/tables#resource\n        :type table_resource: dict\n        :param project_id: the project to upsert the table into.  If None,\n            project will be self.project_id.\n        :return:\n        \"\"\"\n        # check to see if the table exists\n        arg_4 = arg_2['tableReference']['tableId']\n        arg_3 = arg_3 if arg_3 is not None else arg_0.project_id\n        arg_5 = arg_0.service.tables().list(\n            projectId=arg_3, datasetId=arg_1).execute(num_retries=arg_0.num_retries)\n        while True:\n            for arg_6 in arg_5.get('tables', []):\n                if arg_6['tableReference']['tableId'] == arg_4:\n                    # found the table, do update\n                    arg_0.log.info('Table %s:%s.%s exists, updating.',\n                                  arg_3, arg_1, arg_4)\n                    return arg_0.service.tables().update(\n                        projectId=arg_3,\n                        datasetId=arg_1,\n                        tableId=arg_4,\n                        body=arg_2).execute(num_retries=arg_0.num_retries)\n            # If there is a next page, we need to check the next page.\n            if 'nextPageToken' in arg_5:\n                arg_5 = arg_0.service.tables()\\\n                    .list(projectId=arg_3,\n                          datasetId=arg_1,\n                          pageToken=arg_5['nextPageToken'])\\\n                    .execute(num_retries=arg_0.num_retries)\n            # If there is no next page, then the table doesn't exist.\n            else:\n                # do insert\n                arg_0.log.info('Table %s:%s.%s does not exist. creating.',\n                              arg_3, arg_1, arg_4)\n                return arg_0.service.tables().insert(\n                    projectId=arg_3,\n                    datasetId=arg_1,\n                    body=arg_2).execute(num_retries=arg_0.num_retries)", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryBaseCursor.run_table_upsert", "docstring": "creates a new, empty table in the dataset;\n        If the table already exists, update the existing table.\n        Since BigQuery does not natively allow table upserts, this is not an\n        atomic operation.\n\n        :param dataset_id: the dataset to upsert the table into.\n        :type dataset_id: str\n        :param table_resource: a table resource. see\n            https://cloud.google.com/bigquery/docs/reference/v2/tables#resource\n        :type table_resource: dict\n        :param project_id: the project to upsert the table into.  If None,\n            project will be self.project_id.\n        :return:", "docstring_tokens": ["creates", "a", "new", "empty", "table", "in", "the", "dataset", ";", "If", "the", "table", "already", "exists", "update", "the", "existing", "table", ".", "Since", "BigQuery", "does", "not", "natively", "allow", "table", "upserts", "this", "is", "not", "an", "atomic", "operation", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254777}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/easymp4.py#L148-L169", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Register a text key.", "language": "python", "parameters": "(cls, key, name, mean=b\"com.apple.iTunes\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "b\"com.apple.iTunes\"", ")", ":", "arg_4", "=", "b\"----:\"", "+", "arg_3", "+", "b\":\"", "+", "arg_2", "def", "getter", "(", "arg_5", ",", "arg_1", ")", ":", "return", "[", "arg_6", ".", "decode", "(", "\"utf-8\"", ",", "\"replace\"", ")", "for", "arg_6", "in", "arg_5", "[", "arg_4", "]", "]", "def", "setter", "(", "arg_5", ",", "arg_1", ",", "arg_7", ")", ":", "arg_5", "[", "arg_4", "]", "=", "[", "utf8", "(", "v", ")", "for", "v", "in", "arg_7", "]", "def", "deleter", "(", "arg_5", ",", "arg_1", ")", ":", "del", "(", "arg_5", "[", "arg_4", "]", ")", "arg_0", ".", "RegisterKey", "(", "arg_1", ",", "getter", ",", "setter", ",", "deleter", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=b\"com.apple.iTunes\"):\n        \"\"\"Register a text key.\n\n        If the key you need to register is a simple one-to-one mapping\n        of MP4 freeform atom (----) and name to EasyMP4Tags key, then\n        you can use this function::\n\n            EasyMP4Tags.Func(\n                \"musicbrainz_artistid\", b\"MusicBrainz Artist Id\")\n        \"\"\"\n        arg_4 = b\"----:\" + arg_3 + b\":\" + arg_2\n\n        def getter(arg_5, arg_1):\n            return [arg_6.decode(\"utf-8\", \"replace\") for arg_6 in arg_5[arg_4]]\n\n        def setter(arg_5, arg_1, arg_7):\n            arg_5[arg_4] = [utf8(v) for v in arg_7]\n\n        def deleter(arg_5, arg_1):\n            del(arg_5[arg_4])\n\n        arg_0.RegisterKey(arg_1, getter, setter, deleter)", "path": "mutagen/easymp4.py", "identifier": "EasyMP4Tags.RegisterFreeformKey", "docstring": "Register a text key.\n\n        If the key you need to register is a simple one-to-one mapping\n        of MP4 freeform atom (----) and name to EasyMP4Tags key, then\n        you can use this function::\n\n            EasyMP4Tags.RegisterFreeformKey(\n                \"musicbrainz_artistid\", b\"MusicBrainz Artist Id\")", "docstring_tokens": ["Register", "a", "text", "key", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 254778}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/project/application/utils/security.py#L6-L10", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Encode something with SECRET_KEY.", "language": "python", "parameters": "(something)", "return_statement": "return s.dumps(something)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "current_app", ".", "config", ".", "get", "(", "'SECRET_KEY'", ")", "arg_2", "=", "URLSafeSerializer", "(", "arg_1", ")", "return", "arg_2", ".", "dumps", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Encode something with SECRET_KEY.\"\"\"\n    arg_1 = current_app.config.get('SECRET_KEY')\n    arg_2 = URLSafeSerializer(arg_1)\n    return arg_2.dumps(arg_0)", "path": "flask_boost/project/application/utils/security.py", "identifier": "encode", "docstring": "Encode something with SECRET_KEY.", "docstring_tokens": ["Encode", "something", "with", "SECRET_KEY", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 254779}
{"url": "https://github.com/ambv/retype/blob/03137abd4d9c9845f3cced1006190b5cca64d879/retype.py#L1103-L1111", "sha": "03137abd4d9c9845f3cced1006190b5cca64d879", "docstring_summary": "Parse a type comment string into AST nodes.", "language": "python", "parameters": "(type_comment)", "return_statement": "return result.body", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "ast3", ".", "parse", "(", "arg_0", ",", "'<type_comment>'", ",", "'eval'", ")", "except", "SyntaxError", ":", "raise", "ValueError", "(", "f\"invalid type comment: {type_comment!r}\"", ")", "from", "None", "assert", "isinstance", "(", "arg_1", ",", "ast3", ".", "Expression", ")", "return", "arg_1", ".", "body"], "function": "def Func(arg_0):\n    \"\"\"Parse a type comment string into AST nodes.\"\"\"\n    try:\n        arg_1 = ast3.parse(arg_0, '<type_comment>', 'eval')\n    except SyntaxError:\n        raise ValueError(f\"invalid type comment: {type_comment!r}\") from None\n\n    assert isinstance(arg_1, ast3.Expression)\n    return arg_1.body", "path": "retype.py", "identifier": "parse_type_comment", "docstring": "Parse a type comment string into AST nodes.", "docstring_tokens": ["Parse", "a", "type", "comment", "string", "into", "AST", "nodes", "."], "nwo": "ambv/retype", "score": 0.45641484014477285, "idx": 254780}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/asyncresult.py#L218-L221", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "abort my tasks.", "language": "python", "parameters": "(self)", "return_statement": "return self._client.abort(self.msg_ids, targets=self._targets, block=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "not", "arg_0", ".", "ready", "(", ")", ",", "\"Can't Func, I am already done!\"", "return", "arg_0", ".", "_client", ".", "Func", "(", "arg_0", ".", "msg_ids", ",", "targets", "=", "arg_0", ".", "_targets", ",", "block", "=", "True", ")"], "function": "def Func(arg_0):\n        \"\"\"Func my tasks.\"\"\"\n        assert not arg_0.ready(), \"Can't Func, I am already done!\"\n        return arg_0._client.Func(arg_0.msg_ids, targets=arg_0._targets, block=True)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/asyncresult.py", "identifier": "AsyncResult.abort", "docstring": "abort my tasks.", "docstring_tokens": ["abort", "my", "tasks", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254781}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/interfaceLevel/interfaceUtils/utils.py#L22-L32", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "walk parameter instances on this interface", "language": "python", "parameters": "(intf, discovered)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "_interfaces", ":", "yield", "from", "Func", "(", "arg_2", ",", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "_params", ":", "if", "arg_3", "not", "in", "arg_1", ":", "arg_1", ".", "add", "(", "arg_3", ")", "yield", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    walk parameter instances on this interface\n    \"\"\"\n    for arg_2 in arg_0._interfaces:\n        yield from Func(arg_2, arg_1)\n\n    for arg_3 in arg_0._params:\n        if arg_3 not in arg_1:\n            arg_1.add(arg_3)\n            yield arg_3", "path": "hwt/synthesizer/interfaceLevel/interfaceUtils/utils.py", "identifier": "walkParams", "docstring": "walk parameter instances on this interface", "docstring_tokens": ["walk", "parameter", "instances", "on", "this", "interface"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 254782}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L106-L111", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Returns a batched queryset of EnterpriseCustomerUser objects.", "language": "python", "parameters": "(self, start, end)", "return_statement": "return User.objects.filter(pk__in=self._get_enterprise_customer_user_ids())[start:end]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "LOGGER", ".", "info", "(", "'Fetching new batch of enterprise customer users from indexes: %s to %s'", ",", "arg_1", ",", "arg_2", ")", "return", "User", ".", "objects", ".", "filter", "(", "pk__in", "=", "arg_0", ".", "_get_enterprise_customer_user_ids", "(", ")", ")", "[", "arg_1", ":", "arg_2", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Returns a batched queryset of EnterpriseCustomerUser objects.\n        \"\"\"\n        LOGGER.info('Fetching new batch of enterprise customer users from indexes: %s to %s', arg_1, arg_2)\n        return User.objects.filter(pk__in=arg_0._get_enterprise_customer_user_ids())[arg_1:arg_2]", "path": "enterprise/management/commands/assign_enterprise_user_roles.py", "identifier": "Command._get_enterprise_customer_users_batch", "docstring": "Returns a batched queryset of EnterpriseCustomerUser objects.", "docstring_tokens": ["Returns", "a", "batched", "queryset", "of", "EnterpriseCustomerUser", "objects", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 254783}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1339-L1427", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Plotting, but only the Rectangles. You have to set up the figure.\n        Returns a matplotlib axis object.", "language": "python", "parameters": "(self,\n                  ax,\n                  legend,\n                  ladder=False,\n                  default_width=1,\n                  match_only=None,\n                  colour=None,\n                  colour_function=None,\n                  cmap=None,\n                  default=None,\n                  width_field=None,\n                  **kwargs\n                  )", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "1", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "**", "arg_11", ")", ":", "arg_12", "=", "None", "arg_13", "=", "[", "]", "for", "arg_14", "in", "arg_0", ".", "__list", ":", "arg_15", "=", "(", "0", ",", "arg_14", ".", "top", ".", "z", ")", "arg_16", "=", "arg_2", ".", "get_decor", "(", "arg_14", ".", "primary", ",", "arg_5", "=", "arg_5", ")", "arg_17", "=", "arg_14", ".", "base", ".", "z", "-", "arg_14", ".", "top", ".", "z", "if", "arg_3", ":", "if", "arg_10", "is", "not", "None", ":", "arg_18", "=", "arg_14", ".", "data", ".", "get", "(", "arg_10", ",", "1", ")", "arg_18", "=", "arg_4", "*", "arg_18", "/", "arg_0", ".", "max_field", "(", "arg_10", ")", "arg_12", "=", "'gray'", "elif", "arg_2", "is", "not", "None", ":", "arg_18", "=", "arg_16", ".", "width", "or", "arg_4", "try", ":", "arg_18", "=", "arg_4", "*", "arg_18", "/", "arg_2", ".", "max_width", "except", ":", "arg_18", "=", "arg_4", "else", ":", "arg_18", "=", "arg_4", "arg_19", "=", "arg_11", ".", "copy", "(", ")", "arg_20", "=", "arg_19", ".", "pop", "(", "'lw'", ",", "0", ")", "arg_21", "=", "arg_19", ".", "pop", "(", "'ec'", ",", "'k'", ")", "arg_22", "=", "arg_19", ".", "pop", "(", "'fc'", ",", "None", ")", "or", "arg_12", "or", "arg_16", ".", "colour", "if", "arg_6", "is", "None", ":", "arg_23", "=", "mpl", ".", "patches", ".", "Rectangle", "(", "arg_15", ",", "arg_18", ",", "arg_17", ",", "arg_22", "=", "arg_22", ",", "arg_20", "=", "arg_20", ",", "hatch", "=", "arg_16", ".", "hatch", ",", "arg_21", "=", "arg_21", ",", "**", "arg_19", ")", "arg_1", ".", "add_patch", "(", "arg_23", ")", "else", ":", "arg_23", "=", "mpl", ".", "patches", ".", "Rectangle", "(", "arg_15", ",", "arg_18", ",", "arg_17", ",", "arg_20", "=", "arg_20", ",", "arg_21", "=", "arg_21", ",", "**", "arg_19", ")", "arg_13", ".", "append", "(", "arg_23", ")", "if", "arg_6", "is", "not", "None", ":", "arg_8", "=", "arg_8", "or", "'viridis'", "arg_24", "=", "mpl", ".", "collections", ".", "PatchCollection", "(", "arg_13", ",", "arg_8", "=", "arg_8", ",", "arg_20", "=", "arg_20", ")", "arg_24", ".", "set_array", "(", "arg_0", ".", "get_data", "(", "arg_6", ",", "arg_7", ",", "arg_9", "=", "arg_9", ")", ")", "arg_1", ".", "add_collection", "(", "arg_24", ")", "arg_25", "=", "plt", ".", "colorbar", "(", "arg_24", ")", "arg_25", ".", "outline", ".", "set_linewidth", "(", "0", ")", "return", "arg_1"], "function": "def Func(arg_0,\n                  arg_1,\n                  arg_2,\n                  arg_3=False,\n                  arg_4=1,\n                  arg_5=None,\n                  arg_6=None,\n                  arg_7=None,\n                  arg_8=None,\n                  arg_9=None,\n                  arg_10=None,\n                  **arg_11\n                  ):\n        \"\"\"\n        Plotting, but only the Rectangles. You have to set up the figure.\n        Returns a matplotlib axis object.\n\n        Args:\n            ax (axis): The matplotlib axis to plot into.\n            legend (Legend): The Legend to use for colours, etc.\n            ladder (bool): Whether to use widths or not. Default False.\n            default_width (int): A width for the plot if not using widths.\n                Default 1.\n            match_only (list): A list of strings matching the attributes you\n                want to compare when plotting.\n            colour (str): Which data field to use for colours.\n            cmap (cmap): Matplotlib colourmap. Default ``viridis``.\n            default (float): The default (null) value.\n            width_field (str): The field to use for the width of the patches.\n            **kwargs are passed through to matplotlib's ``patches.Rectangle``.\n\n        Returns:\n            axis: The matplotlib.pyplot axis.\n        \"\"\"\n        arg_12 = None\n        arg_13 = []\n        for arg_14 in arg_0.__list:\n            arg_15 = (0, arg_14.top.z)\n            arg_16 = arg_2.get_decor(arg_14.primary, arg_5=arg_5)\n            arg_17 = arg_14.base.z - arg_14.top.z\n\n            if arg_3:\n                if arg_10 is not None:\n                    arg_18 = arg_14.data.get(arg_10, 1)\n                    arg_18 = arg_4 * arg_18/arg_0.max_field(arg_10)\n                    arg_12 = 'gray'\n                elif arg_2 is not None:\n                    arg_18 = arg_16.width or arg_4\n                    try:\n                        arg_18 = arg_4 * arg_18/arg_2.max_width\n                    except:\n                        arg_18 = arg_4\n            else:\n                arg_18 = arg_4\n\n            # Allow override of lw\n            arg_19 = arg_11.copy()\n            arg_20 = arg_19.pop('lw', 0)\n            arg_21 = arg_19.pop('ec', 'k')\n            arg_22 = arg_19.pop('fc', None) or arg_12 or arg_16.colour\n\n            if arg_6 is None:\n                arg_23 = mpl.patches.Rectangle(arg_15,\n                                             arg_18,\n                                             arg_17,\n                                             arg_22=arg_22,\n                                             arg_20=arg_20,\n                                             hatch=arg_16.hatch,\n                                             arg_21=arg_21,  # edgecolour for hatching\n                                             **arg_19)\n                arg_1.add_patch(arg_23)\n            else:\n                arg_23 = mpl.patches.Rectangle(arg_15,\n                                             arg_18,\n                                             arg_17,\n                                             arg_20=arg_20,\n                                             arg_21=arg_21,  # edgecolour for hatching\n                                             **arg_19)\n                arg_13.append(arg_23)\n\n        if arg_6 is not None:\n            arg_8 = arg_8 or 'viridis'\n            arg_24 = mpl.collections.PatchCollection(arg_13, arg_8=arg_8, arg_20=arg_20)\n            arg_24.set_array(arg_0.get_data(arg_6, arg_7, arg_9=arg_9))\n            arg_1.add_collection(arg_24)\n            arg_25 = plt.colorbar(arg_24)  #  orientation='horizontal' only really works with ticks=[0, 0.1, 0.2] say\n            arg_25.outline.set_linewidth(0)\n\n        return arg_1", "path": "striplog/striplog.py", "identifier": "Striplog.plot_axis", "docstring": "Plotting, but only the Rectangles. You have to set up the figure.\n        Returns a matplotlib axis object.\n\n        Args:\n            ax (axis): The matplotlib axis to plot into.\n            legend (Legend): The Legend to use for colours, etc.\n            ladder (bool): Whether to use widths or not. Default False.\n            default_width (int): A width for the plot if not using widths.\n                Default 1.\n            match_only (list): A list of strings matching the attributes you\n                want to compare when plotting.\n            colour (str): Which data field to use for colours.\n            cmap (cmap): Matplotlib colourmap. Default ``viridis``.\n            default (float): The default (null) value.\n            width_field (str): The field to use for the width of the patches.\n            **kwargs are passed through to matplotlib's ``patches.Rectangle``.\n\n        Returns:\n            axis: The matplotlib.pyplot axis.", "docstring_tokens": ["Plotting", "but", "only", "the", "Rectangles", ".", "You", "have", "to", "set", "up", "the", "figure", ".", "Returns", "a", "matplotlib", "axis", "object", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 254784}
{"url": "https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L413-L425", "sha": "b1c6aa159ab380a033740f4aa392cf0d125e0ac6", "docstring_summary": "Declare an environment variable as a set-like special variable.\n        This can be used even if the environment variable is not\n        present.", "language": "python", "parameters": "(self, name, sep=os.pathsep)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "pathsep", ")", ":", "arg_0", ".", "_declare_special", "(", "arg_1", ",", "arg_2", ",", "SetVariable", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.pathsep):\n        \"\"\"\n        Declare an environment variable as a set-like special variable.\n        This can be used even if the environment variable is not\n        present.\n\n        :param name: The name of the environment variable that should\n                     be considered set-like.\n        :param sep: The separator to be used.  Defaults to the value\n                    of ``os.pathsep``.\n        \"\"\"\n\n        arg_0._declare_special(arg_1, arg_2, SetVariable)", "path": "timid/environment.py", "identifier": "Environment.declare_set", "docstring": "Declare an environment variable as a set-like special variable.\n        This can be used even if the environment variable is not\n        present.\n\n        :param name: The name of the environment variable that should\n                     be considered set-like.\n        :param sep: The separator to be used.  Defaults to the value\n                    of ``os.pathsep``.", "docstring_tokens": ["Declare", "an", "environment", "variable", "as", "a", "set", "-", "like", "special", "variable", ".", "This", "can", "be", "used", "even", "if", "the", "environment", "variable", "is", "not", "present", "."], "nwo": "rackerlabs/timid", "score": 0.0, "idx": 254785}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/users/users.py#L12-L28", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Get details about the currently authenticated user", "language": "python", "parameters": "(session, user_details=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "arg_1", "[", "'compact'", "]", "=", "True", "arg_2", "=", "make_get_request", "(", "arg_0", ",", "'self'", ",", "params_data", "=", "arg_1", ")", "arg_3", "=", "arg_2", ".", "json", "(", ")", "if", "arg_2", ".", "status_code", "==", "200", ":", "return", "arg_3", "[", "'result'", "]", "else", ":", "raise", "SelfNotRetrievedException", "(", "message", "=", "arg_3", "[", "'message'", "]", ",", "error_code", "=", "arg_3", "[", "'error_code'", "]", ",", "request_id", "=", "arg_3", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Get details about the currently authenticated user\n    \"\"\"\n    # Set compact to true\n    if arg_1:\n        arg_1['compact'] = True\n    arg_2 = make_get_request(arg_0, 'self', params_data=arg_1)\n    arg_3 = arg_2.json()\n    if arg_2.status_code == 200:\n        return arg_3['result']\n    else:\n        raise SelfNotRetrievedException(\n            message=arg_3['message'],\n            error_code=arg_3['error_code'],\n            request_id=arg_3['request_id']\n        )", "path": "freelancersdk/resources/users/users.py", "identifier": "get_self", "docstring": "Get details about the currently authenticated user", "docstring_tokens": ["Get", "details", "about", "the", "currently", "authenticated", "user"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 254786}
{"url": "https://github.com/spotify/pyschema/blob/7e6c3934150bcb040c628d74ace6caf5fcf867df/pyschema/core.py#L502-L509", "sha": "7e6c3934150bcb040c628d74ace6caf5fcf867df", "docstring_summary": "Dump record in json-encodable object format", "language": "python", "parameters": "(record)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "_fields", ".", "iteritems", "(", ")", ":", "arg_4", "=", "getattr", "(", "arg_0", ",", "arg_2", ")", "if", "arg_4", "is", "not", "None", ":", "arg_1", "[", "arg_2", "]", "=", "arg_3", ".", "dump", "(", "arg_4", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"Dump record in json-encodable object format\"\n    arg_1 = {}\n    for arg_2, arg_3 in arg_0._fields.iteritems():\n        arg_4 = getattr(arg_0, arg_2)\n        if arg_4 is not None:\n            arg_1[arg_2] = arg_3.dump(arg_4)\n    return arg_1", "path": "pyschema/core.py", "identifier": "to_json_compatible", "docstring": "Dump record in json-encodable object format", "docstring_tokens": ["Dump", "record", "in", "json", "-", "encodable", "object", "format"], "nwo": "spotify/pyschema", "score": 0.41017317071999654, "idx": 254787}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/comp.py#L522-L525", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Combine the fields from all components", "language": "python", "parameters": "(self)", "return_statement": "return self.field_reduce_func(fields)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "c", ".", "Func", "(", ")", "for", "c", "in", "arg_0", ".", "comps", "]", "return", "arg_0", ".", "field_reduce_func", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\" Combine the fields from all components \"\"\"\n        arg_1 = [c.Func() for c in arg_0.comps]\n        return arg_0.field_reduce_func(arg_1)", "path": "peri/comp/comp.py", "identifier": "ComponentCollection.get", "docstring": "Combine the fields from all components", "docstring_tokens": ["Combine", "the", "fields", "from", "all", "components"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 254788}
{"url": "https://github.com/mordred-descriptor/mordred/blob/2848b088fd7b6735590242b5e22573babc724f10/mordred/_base/result.py#L97-L115", "sha": "2848b088fd7b6735590242b5e22573babc724f10", "docstring_summary": "r\"\"\"Convert Result to dict.", "language": "python", "parameters": "(self, rawkey=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_1", ":", "return", "dict", "(", "arg_0", ".", "items", "(", ")", ")", "else", ":", "return", "{", "str", "(", "arg_2", ")", ":", "arg_3", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "items", "(", ")", "}"], "function": "def Func(arg_0, arg_1=False):\n        r\"\"\"Convert Result to dict.\n\n        Parameters:\n            rawkey(bool):\n                * True: dict key is Descriptor instance\n                * False: dict key is str\n\n        Returns:\n            dict\n\n        \"\"\"\n        if arg_1:\n            return dict(arg_0.items())\n        else:\n            return {\n                str(arg_2): arg_3\n                for arg_2, arg_3 in arg_0.items()\n            }", "path": "mordred/_base/result.py", "identifier": "Result.asdict", "docstring": "r\"\"\"Convert Result to dict.\n\n        Parameters:\n            rawkey(bool):\n                * True: dict key is Descriptor instance\n                * False: dict key is str\n\n        Returns:\n            dict", "docstring_tokens": ["r", "Convert", "Result", "to", "dict", "."], "nwo": "mordred-descriptor/mordred", "score": 0.9032497569731454, "idx": 254789}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L593-L603", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Yields one onset front ID at a time until they are gone. All the onset fronts from a\n    frequency channel are yielded, then all of the next channel's, etc., though one at a time.", "language": "python", "parameters": "(onset_fronts)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "for", "arg_2", "in", "arg_0", ":", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "!=", "0", "and", "arg_3", "not", "in", "arg_1", ":", "yield", "arg_3", "arg_1", ".", "add", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Yields one onset front ID at a time until they are gone. All the onset fronts from a\n    frequency channel are yielded, then all of the next channel's, etc., though one at a time.\n    \"\"\"\n    arg_1 = set()\n    for arg_2 in arg_0:\n        for arg_3 in arg_2:\n            if arg_3 != 0 and arg_3 not in arg_1:\n                yield arg_3\n                arg_1.add(arg_3)", "path": "algorithms/asa.py", "identifier": "_get_front_ids_one_at_a_time", "docstring": "Yields one onset front ID at a time until they are gone. All the onset fronts from a\n    frequency channel are yielded, then all of the next channel's, etc., though one at a time.", "docstring_tokens": ["Yields", "one", "onset", "front", "ID", "at", "a", "time", "until", "they", "are", "gone", ".", "All", "the", "onset", "fronts", "from", "a", "frequency", "channel", "are", "yielded", "then", "all", "of", "the", "next", "channel", "s", "etc", ".", "though", "one", "at", "a", "time", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 254790}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/check.py#L411-L467", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the Check response payload and decode it into\n        its constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "CheckResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_0", ".", "_unique_identifier", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ")", "arg_0", ".", "_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "USAGE_LIMITS_COUNT", ",", "arg_6", ")", ":", "arg_0", ".", "_usage_limits_count", "=", "primitives", ".", "LongInteger", "(", "tag", "=", "arg_3", ".", "Tags", ".", "USAGE_LIMITS_COUNT", ")", "arg_0", ".", "_usage_limits_count", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "CRYPTOGRAPHIC_USAGE_MASK", ",", "arg_6", ")", ":", "arg_0", ".", "_cryptographic_usage_mask", "=", "primitives", ".", "Integer", "(", "tag", "=", "arg_3", ".", "Tags", ".", "CRYPTOGRAPHIC_USAGE_MASK", ")", "arg_0", ".", "_cryptographic_usage_mask", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "LEASE_TIME", ",", "arg_6", ")", ":", "arg_0", ".", "_lease_time", "=", "primitives", ".", "Interval", "(", "tag", "=", "arg_3", ".", "Tags", ".", "LEASE_TIME", ")", "arg_0", ".", "_lease_time", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the Check response payload and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.\n        \"\"\"\n        super(CheckResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.UNIQUE_IDENTIFIER, arg_6):\n            arg_0._unique_identifier = primitives.TextString(\n                tag=arg_3.Tags.UNIQUE_IDENTIFIER\n            )\n            arg_0._unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        if arg_0.is_tag_next(arg_3.Tags.USAGE_LIMITS_COUNT, arg_6):\n            arg_0._usage_limits_count = primitives.LongInteger(\n                tag=arg_3.Tags.USAGE_LIMITS_COUNT\n            )\n            arg_0._usage_limits_count.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        if arg_0.is_tag_next(arg_3.Tags.CRYPTOGRAPHIC_USAGE_MASK, arg_6):\n            arg_0._cryptographic_usage_mask = primitives.Integer(\n                tag=arg_3.Tags.CRYPTOGRAPHIC_USAGE_MASK\n            )\n            arg_0._cryptographic_usage_mask.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        if arg_0.is_tag_next(arg_3.Tags.LEASE_TIME, arg_6):\n            arg_0._lease_time = primitives.Interval(\n                tag=arg_3.Tags.LEASE_TIME\n            )\n            arg_0._lease_time.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/check.py", "identifier": "CheckResponsePayload.read", "docstring": "Read the data encoding the Check response payload and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "Check", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 254791}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/api_call.py#L192-L196", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "HTTP Delete Request", "language": "python", "parameters": "(self)", "return_statement": "return requests.delete(self._url, data=self._data, headers=self._headers, auth=(self._email, self._api_token))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "requests", ".", "delete", "(", "arg_0", ".", "_url", ",", "data", "=", "arg_0", ".", "_data", ",", "headers", "=", "arg_0", ".", "_headers", ",", "auth", "=", "(", "arg_0", ".", "_email", ",", "arg_0", ".", "_api_token", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        HTTP Delete Request\n        \"\"\"\n        return requests.delete(arg_0._url, data=arg_0._data, headers=arg_0._headers, auth=(arg_0._email, arg_0._api_token))", "path": "boundary/api_call.py", "identifier": "ApiCall._do_delete", "docstring": "HTTP Delete Request", "docstring_tokens": ["HTTP", "Delete", "Request"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 254792}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L123-L154", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Find correct closed dates, if issues was closed by commits.", "language": "python", "parameters": "(self, issues, kind)", "return_statement": "return all_issues", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "options", ".", "verbose", ":", "print", "(", "\"Fetching closed dates for {} {}...\"", ".", "format", "(", "len", "(", "arg_1", ")", ",", "arg_2", ")", ")", "arg_3", "=", "copy", ".", "deepcopy", "(", "arg_1", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_0", ".", "options", ".", "verbose", ">", "2", ":", "print", "(", "\".\"", ",", "end", "=", "\"\"", ")", "if", "not", "arg_1", ".", "index", "(", "arg_4", ")", "%", "30", ":", "print", "(", "\"\"", ")", "arg_0", ".", "find_closed_date_by_commit", "(", "arg_4", ")", "if", "not", "arg_4", ".", "get", "(", "'actual_date'", ",", "False", ")", ":", "if", "arg_4", ".", "get", "(", "'closed_at'", ",", "False", ")", ":", "print", "(", "\"Skipping closed non-merged issue: #{0} {1}\"", ".", "format", "(", "arg_4", "[", "\"number\"", "]", ",", "arg_4", "[", "\"title\"", "]", ")", ")", "arg_3", ".", "remove", "(", "arg_4", ")", "if", "arg_0", ".", "options", ".", "verbose", ">", "2", ":", "print", "(", "\".\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Find correct closed dates, if issues was closed by commits.\n\n        :param list issues: issues to check\n        :param str kind: either \"issues\" or \"pull requests\"\n        :rtype: list\n        :return: issues with updated closed dates\n        \"\"\"\n\n        if arg_0.options.verbose:\n            print(\"Fetching closed dates for {} {}...\".format(\n                len(arg_1), arg_2)\n            )\n        arg_3 = copy.deepcopy(arg_1)\n        for arg_4 in arg_3:\n            if arg_0.options.verbose > 2:\n                print(\".\", end=\"\")\n                if not arg_1.index(arg_4) % 30:\n                    print(\"\")\n            arg_0.find_closed_date_by_commit(arg_4)\n\n            if not arg_4.get('actual_date', False):\n                if arg_4.get('closed_at', False):\n                    print(\"Skipping closed non-merged issue: #{0} {1}\".format(\n                        arg_4[\"number\"], arg_4[\"title\"]))\n\n                arg_3.remove(arg_4)\n\n        if arg_0.options.verbose > 2:\n            print(\".\")\n        return arg_3", "path": "pygcgen/generator.py", "identifier": "Generator.detect_actual_closed_dates", "docstring": "Find correct closed dates, if issues was closed by commits.\n\n        :param list issues: issues to check\n        :param str kind: either \"issues\" or \"pull requests\"\n        :rtype: list\n        :return: issues with updated closed dates", "docstring_tokens": ["Find", "correct", "closed", "dates", "if", "issues", "was", "closed", "by", "commits", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 254793}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L39-L43", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Reads the head of the las file and returns it", "language": "python", "parameters": "(self)", "return_statement": "return headers.HeaderFactory().read_from_stream(self.stream)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "stream", ".", "seek", "(", "arg_0", ".", "start_pos", ")", "return", "headers", ".", "HeaderFactory", "(", ")", ".", "read_from_stream", "(", "arg_0", ".", "stream", ")"], "function": "def Func(arg_0):\n        \"\"\" Reads the head of the las file and returns it\n        \"\"\"\n        arg_0.stream.seek(arg_0.start_pos)\n        return headers.HeaderFactory().read_from_stream(arg_0.stream)", "path": "pylas/lasreader.py", "identifier": "LasReader.read_header", "docstring": "Reads the head of the las file and returns it", "docstring_tokens": ["Reads", "the", "head", "of", "the", "las", "file", "and", "returns", "it"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 254794}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/resources/base.py#L121-L129", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Loads all the data files using the configured finders.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "_resources", ":", "arg_2", "=", "arg_0", ".", "load", "(", "arg_1", ")", "yield", "arg_1", ",", "arg_2", "arg_0", ".", "_resources", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Loads all the data files using the configured finders.\n        \"\"\"\n        for arg_1 in arg_0._resources:\n            arg_2 = arg_0.load(arg_1)\n            yield arg_1, arg_2\n\n        arg_0._resources = []", "path": "demosys/resources/base.py", "identifier": "BaseRegistry.load_pool", "docstring": "Loads all the data files using the configured finders.", "docstring_tokens": ["Loads", "all", "the", "data", "files", "using", "the", "configured", "finders", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 254795}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L768-L774", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "Return the fields specified in the pattern using Python's\n        formatting mini-language.", "language": "python", "parameters": "(self)", "return_statement": "return [f for f in zip(*parse)[1] if f is not None]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", "string", ".", "Formatter", "(", ")", ".", "parse", "(", "arg_0", ".", "pattern", ")", ")", "return", "[", "arg_2", "for", "arg_2", "in", "zip", "(", "*", "arg_1", ")", "[", "1", "]", "if", "arg_2", "is", "not", "None", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the Func specified in the pattern using Python's\n        formatting mini-language.\n        \"\"\"\n        arg_1 = list(string.Formatter().parse(arg_0.pattern))\n        return [arg_2 for arg_2 in zip(*arg_1)[1] if arg_2 is not None]", "path": "lancet/core.py", "identifier": "FilePattern.fields", "docstring": "Return the fields specified in the pattern using Python's\n        formatting mini-language.", "docstring_tokens": ["Return", "the", "fields", "specified", "in", "the", "pattern", "using", "Python", "s", "formatting", "mini", "-", "language", "."], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 254796}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/egg_info.py#L332-L354", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Add paths for egg-info files for an external egg-base.", "language": "python", "parameters": "(self, cmd)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "egg_base", "==", "os", ".", "curdir", ":", "return", "arg_2", "=", "distutils", ".", "filelist", ".", "findall", "(", "arg_1", ".", "egg_base", ")", "arg_3", "=", "(", "os", ".", "path", ".", "join", "(", "arg_1", ".", "egg_base", ",", "path", ")", "for", "path", "in", "arg_2", ")", "arg_0", ".", "filelist", ".", "allfiles", ".", "extend", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add paths for egg-info files for an external egg-base.\n\n        The egg-info files are written to egg-base. If egg-base is\n        outside the current working directory, this method\n        searchs the egg-base directory for files to include\n        in the manifest. Uses distutils.filelist.findall (which is\n        really the version monkeypatched in by setuptools/__init__.py)\n        to perform the search.\n\n        Since findall records relative paths, prefix the returned\n        paths with cmd.egg_base, so add_default's include_pattern call\n        (which is looking for the absolute cmd.egg_info) will match\n        them.\n        \"\"\"\n        if arg_1.egg_base == os.curdir:\n            # egg-info files were already added by something else\n            return\n\n        arg_2 = distutils.filelist.findall(arg_1.egg_base)\n        arg_3 = (os.path.join(arg_1.egg_base, path) for path in arg_2)\n        arg_0.filelist.allfiles.extend(arg_3)", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/egg_info.py", "identifier": "manifest_maker._add_egg_info", "docstring": "Add paths for egg-info files for an external egg-base.\n\n        The egg-info files are written to egg-base. If egg-base is\n        outside the current working directory, this method\n        searchs the egg-base directory for files to include\n        in the manifest. Uses distutils.filelist.findall (which is\n        really the version monkeypatched in by setuptools/__init__.py)\n        to perform the search.\n\n        Since findall records relative paths, prefix the returned\n        paths with cmd.egg_base, so add_default's include_pattern call\n        (which is looking for the absolute cmd.egg_info) will match\n        them.", "docstring_tokens": ["Add", "paths", "for", "egg", "-", "info", "files", "for", "an", "external", "egg", "-", "base", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254797}
{"url": "https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/acts.py#L434-L453", "sha": "b7ad20fe8e7137db99a20ac06b8da26492601b00", "docstring_summary": "This function gets called when a target is specified to ensure\n    that all 'tied' targets also get included in the subgraph to\n    be built", "language": "python", "parameters": "(original_targets, the_ties)", "return_statement": "return original_targets, \"\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "for", "arg_4", "in", "arg_1", ":", "if", "arg_3", "in", "arg_4", ":", "for", "arg_5", "in", "arg_4", ":", "arg_2", ".", "append", "(", "arg_5", ")", "arg_2", "=", "list", "(", "set", "(", "arg_2", ")", ")", "if", "arg_2", ":", "arg_6", "=", "\"\"", "arg_6", "+=", "\"The following targets share dependencies and must be run together:\"", "for", "arg_4", "in", "sorted", "(", "arg_2", ")", ":", "arg_6", "+=", "\"\\n  - {}\"", ".", "format", "(", "arg_4", ")", "return", "list", "(", "set", "(", "arg_2", "+", "arg_0", ")", ")", ",", "arg_6", "return", "arg_0", ",", "\"\""], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This function gets called when a target is specified to ensure\n    that all 'tied' targets also get included in the subgraph to\n    be built\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_0:\n        for arg_4 in arg_1:\n            if arg_3 in arg_4:\n                for arg_5 in arg_4:\n                    arg_2.append(arg_5)\n    arg_2 = list(set(arg_2))\n    if arg_2:\n        arg_6 = \"\"\n        arg_6 += \"The following targets share dependencies and must be run together:\"\n        for arg_4 in sorted(arg_2):\n            arg_6 += \"\\n  - {}\".format(arg_4)\n        return list(set(arg_2+arg_0)), arg_6\n    return arg_0, \"\"", "path": "sakelib/acts.py", "identifier": "get_tied_targets", "docstring": "This function gets called when a target is specified to ensure\n    that all 'tied' targets also get included in the subgraph to\n    be built", "docstring_tokens": ["This", "function", "gets", "called", "when", "a", "target", "is", "specified", "to", "ensure", "that", "all", "tied", "targets", "also", "get", "included", "in", "the", "subgraph", "to", "be", "built"], "nwo": "tonyfischetti/sake", "score": 0.3086509652907828, "idx": 254798}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L661-L679", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a parallel grid search worker for the function below.", "language": "python", "parameters": "(task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "try", ":", "arg_4", "=", "get_recovered_variables_for_magbin", "(", "arg_1", ",", "arg_3", ",", "stetson_stdev_min", "=", "arg_2", "[", "0", "]", ",", "inveta_stdev_min", "=", "arg_2", "[", "1", "]", ",", "iqr_stdev_min", "=", "arg_2", "[", "2", "]", ",", "statsonly", "=", "True", ")", "return", "arg_4", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'failed to get info for %s'", "%", "arg_2", ")", "return", "None"], "function": "def Func(arg_0):\n    '''\n    This is a parallel grid search worker for the function below.\n\n    '''\n\n    arg_1, arg_2, arg_3 = arg_0\n\n    try:\n        arg_4 = get_recovered_variables_for_magbin(arg_1,\n                                                 arg_3,\n                                                 stetson_stdev_min=arg_2[0],\n                                                 inveta_stdev_min=arg_2[1],\n                                                 iqr_stdev_min=arg_2[2],\n                                                 statsonly=True)\n        return arg_4\n    except Exception as e:\n        LOGEXCEPTION('failed to get info for %s' % arg_2)\n        return None", "path": "astrobase/fakelcs/recovery.py", "identifier": "magbin_varind_gridsearch_worker", "docstring": "This is a parallel grid search worker for the function below.", "docstring_tokens": ["This", "is", "a", "parallel", "grid", "search", "worker", "for", "the", "function", "below", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 254799}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/tm/tm_high_order.py#L96-L120", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Trains the TM with given sequence for a given number of time steps and level of input\n  corruption", "language": "python", "parameters": "(sequence, timeSteps, noiseLevel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "np", ".", "zeros", "(", "tm", ".", "numberOfColumns", "(", ")", ",", "dtype", "=", "\"uint32\"", ")", "arg_4", "=", "np", ".", "zeros", "(", "tm", ".", "numberOfColumns", "(", ")", ",", "dtype", "=", "\"uint32\"", ")", "arg_5", "=", "0", "for", "arg_6", "in", "range", "(", "arg_1", ")", ":", "tm", ".", "reset", "(", ")", "for", "arg_7", "in", "range", "(", "4", ")", ":", "arg_8", "=", "corruptVector", "(", "arg_0", "[", "arg_7", "]", "[", ":", "]", ",", "arg_2", ",", "sparseCols", ")", "tm", ".", "compute", "(", "set", "(", "arg_8", "[", ":", "]", ".", "nonzero", "(", ")", "[", "0", "]", ".", "tolist", "(", ")", ")", ",", "learn", "=", "True", ")", "arg_9", "=", "[", "tm", ".", "columnForCell", "(", "i", ")", "for", "i", "in", "tm", ".", "getActiveCells", "(", ")", "]", "arg_10", "=", "[", "tm", ".", "columnForCell", "(", "i", ")", "for", "i", "in", "tm", ".", "getPredictiveCells", "(", ")", "]", "arg_3", "=", "[", "1", "if", "i", "in", "arg_9", "else", "0", "for", "i", "in", "range", "(", "tm", ".", "numberOfColumns", "(", ")", ")", "]", "arg_11", "=", "accuracy", "(", "arg_3", ",", "arg_4", ")", "x", ".", "append", "(", "arg_5", ")", "y", ".", "append", "(", "arg_11", ")", "arg_5", "+=", "1", "arg_4", "=", "[", "1", "if", "i", "in", "arg_10", "else", "0", "for", "i", "in", "range", "(", "tm", ".", "numberOfColumns", "(", ")", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"\n  Trains the TM with given sequence for a given number of time steps and level of input\n  corruption\n  \n  @param sequence   (array) array whose rows are the input characters\n  @param timeSteps  (int)   number of time steps in which the TM will be presented with sequence\n  @param noiseLevel (float) amount of noise to be applied on the characters in the sequence \n  \"\"\"\n  arg_3 = np.zeros(tm.numberOfColumns(), dtype=\"uint32\")\n  arg_4 = np.zeros(tm.numberOfColumns(), dtype=\"uint32\")\n  arg_5 = 0  \n  for arg_6 in range(arg_1):\n    tm.reset()\n    for arg_7 in range(4):\n      arg_8 = corruptVector(arg_0[arg_7][:], arg_2, sparseCols)\n      tm.compute(set(arg_8[:].nonzero()[0].tolist()), learn=True)\n      arg_9 = [tm.columnForCell(i) for i in tm.getActiveCells()]\n      arg_10 = [tm.columnForCell(i) for i in tm.getPredictiveCells()]\n      arg_3 = [1 if i in arg_9 else 0 for i in range(tm.numberOfColumns())]\n      arg_11 = accuracy(arg_3, arg_4)\n      x.append(arg_5)\n      y.append(arg_11)\n      arg_5 += 1\n      arg_4 = [1 if i in arg_10 else 0 for i in range(tm.numberOfColumns())]", "path": "examples/tm/tm_high_order.py", "identifier": "trainTM", "docstring": "Trains the TM with given sequence for a given number of time steps and level of input\n  corruption\n  \n  @param sequence   (array) array whose rows are the input characters\n  @param timeSteps  (int)   number of time steps in which the TM will be presented with sequence\n  @param noiseLevel (float) amount of noise to be applied on the characters in the sequence", "docstring_tokens": ["Trains", "the", "TM", "with", "given", "sequence", "for", "a", "given", "number", "of", "time", "steps", "and", "level", "of", "input", "corruption"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254800}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/multiprocess_file_storage.py#L166-L186", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Writes credentials to a file.", "language": "python", "parameters": "(credentials_file, credentials)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'file_version'", ":", "2", ",", "'credentials'", ":", "{", "}", "}", "for", "arg_3", ",", "arg_4", "in", "iteritems", "(", "arg_1", ")", ":", "arg_5", "=", "arg_4", ".", "to_json", "(", ")", "arg_6", "=", "_helpers", ".", "_from_bytes", "(", "base64", ".", "b64encode", "(", "_helpers", ".", "_to_bytes", "(", "arg_5", ")", ")", ")", "arg_2", "[", "'credentials'", "]", "[", "arg_3", "]", "=", "arg_6", "arg_0", ".", "seek", "(", "0", ")", "json", ".", "dump", "(", "arg_2", ",", "arg_0", ")", "arg_0", ".", "truncate", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Writes credentials to a file.\n\n    Refer to :func:`_load_credentials_file` for the format.\n\n    Args:\n        credentials_file: An open file handle, must be read/write.\n        credentials: A dictionary mapping user-defined keys to an instance of\n            :class:`oauth2client.client.Credentials`.\n    \"\"\"\n    arg_2 = {'file_version': 2, 'credentials': {}}\n\n    for arg_3, arg_4 in iteritems(arg_1):\n        arg_5 = arg_4.to_json()\n        arg_6 = _helpers._from_bytes(base64.b64encode(\n            _helpers._to_bytes(arg_5)))\n        arg_2['credentials'][arg_3] = arg_6\n\n    arg_0.seek(0)\n    json.dump(arg_2, arg_0)\n    arg_0.truncate()", "path": "oauth2client/contrib/multiprocess_file_storage.py", "identifier": "_write_credentials_file", "docstring": "Writes credentials to a file.\n\n    Refer to :func:`_load_credentials_file` for the format.\n\n    Args:\n        credentials_file: An open file handle, must be read/write.\n        credentials: A dictionary mapping user-defined keys to an instance of\n            :class:`oauth2client.client.Credentials`.", "docstring_tokens": ["Writes", "credentials", "to", "a", "file", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 254801}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/case.py#L11-L33", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Build a small phenotype object", "language": "python", "parameters": "(phenotype_id, adapter)", "return_statement": "return phenotype", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "arg_1", ".", "hpo_term", "(", "arg_0", ")", "if", "arg_3", ":", "arg_2", "[", "'phenotype_id'", "]", "=", "arg_3", "[", "'hpo_id'", "]", "arg_2", "[", "'feature'", "]", "=", "arg_3", "[", "'description'", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Build a small phenotype object\n\n        Build a dictionary with phenotype_id and description\n\n    Args:\n        phenotype_id (str): The phenotype id\n        adapter (scout.adapter.MongoAdapter)\n\n    Returns:\n        phenotype_obj (dict):\n\n        dict(\n            phenotype_id = str,\n            feature = str, # description of phenotype\n            )\n    \"\"\"\n    arg_2 = {}\n    arg_3 = arg_1.hpo_term(arg_0)\n    if arg_3:\n        arg_2['phenotype_id'] = arg_3['hpo_id']\n        arg_2['feature'] = arg_3['description']\n    return arg_3", "path": "scout/build/case.py", "identifier": "build_phenotype", "docstring": "Build a small phenotype object\n\n        Build a dictionary with phenotype_id and description\n\n    Args:\n        phenotype_id (str): The phenotype id\n        adapter (scout.adapter.MongoAdapter)\n\n    Returns:\n        phenotype_obj (dict):\n\n        dict(\n            phenotype_id = str,\n            feature = str, # description of phenotype\n            )", "docstring_tokens": ["Build", "a", "small", "phenotype", "object"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254802}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L336-L363", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Returns a new random state.", "language": "python", "parameters": "(seed=None, fully_random=False)", "return_statement": "return np.random.RandomState(seed)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", "is", "None", ":", "if", "not", "arg_1", ":", "arg_0", "=", "CURRENT_RANDOM_STATE", ".", "randint", "(", "SEED_MIN_VALUE", ",", "SEED_MAX_VALUE", ",", "1", ")", "[", "0", "]", "return", "np", ".", "random", ".", "RandomState", "(", "arg_0", ")"], "function": "def Func(arg_0=None, arg_1=False):\n    \"\"\"\n    Returns a new random state.\n\n    Parameters\n    ----------\n    seed : None or int, optional\n        Optional seed value to use.\n        The same datatypes are allowed as for ``numpy.random.RandomState(seed)``.\n\n    fully_random : bool, optional\n        Whether to use numpy's random initialization for the\n        RandomState (used if set to True). If False, a seed is sampled from\n        the global random state, which is a bit faster and hence the default.\n\n    Returns\n    -------\n    numpy.random.RandomState\n        The new random state.\n\n    \"\"\"\n    if arg_0 is None:\n        if not arg_1:\n            # sample manually a seed instead of just RandomState(),\n            # because the latter one\n            # is way slower.\n            arg_0 = CURRENT_RANDOM_STATE.randint(SEED_MIN_VALUE, SEED_MAX_VALUE, 1)[0]\n    return np.random.RandomState(arg_0)", "path": "imgaug/imgaug.py", "identifier": "new_random_state", "docstring": "Returns a new random state.\n\n    Parameters\n    ----------\n    seed : None or int, optional\n        Optional seed value to use.\n        The same datatypes are allowed as for ``numpy.random.RandomState(seed)``.\n\n    fully_random : bool, optional\n        Whether to use numpy's random initialization for the\n        RandomState (used if set to True). If False, a seed is sampled from\n        the global random state, which is a bit faster and hence the default.\n\n    Returns\n    -------\n    numpy.random.RandomState\n        The new random state.", "docstring_tokens": ["Returns", "a", "new", "random", "state", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254803}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/tokens.py#L59-L66", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Iterate through each member of the class being created and add a \n        safety check to every method that isn't marked as read-only.", "language": "python", "parameters": "(meta, members)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "arg_1", "[", "arg_2", "]", "=", "arg_0", ".", "add_safety_check", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Iterate through each member of the class being created and add a \n        safety check to every method that isn't marked as read-only.\n        \"\"\"\n        for arg_2, arg_3 in arg_1.items():\n            arg_1[arg_2] = arg_0.add_safety_check(\n                    arg_2, arg_3)", "path": "kxg/tokens.py", "identifier": "TokenSafetyChecks.add_safety_checks", "docstring": "Iterate through each member of the class being created and add a \n        safety check to every method that isn't marked as read-only.", "docstring_tokens": ["Iterate", "through", "each", "member", "of", "the", "class", "being", "created", "and", "add", "a", "safety", "check", "to", "every", "method", "that", "isn", "t", "marked", "as", "read", "-", "only", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 254804}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/__init__.py#L516-L568", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Return all issues from every target.", "language": "python", "parameters": "(conf, main_section, debug)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "log", ".", "info", "(", "\"Starting to aggregate remote issues.\"", ")", "arg_3", "=", "aslist", "(", "arg_0", ".", "get", "(", "arg_1", ",", "'targets'", ")", ")", "arg_4", "=", "multiprocessing", ".", "Queue", "(", ")", "log", ".", "info", "(", "\"Spawning %i workers.\"", "%", "len", "(", "arg_3", ")", ")", "arg_5", "=", "[", "]", "if", "arg_2", ":", "for", "arg_6", "in", "arg_3", ":", "_Func", "(", "arg_0", ",", "arg_1", ",", "arg_6", ",", "arg_4", ",", "arg_0", ".", "get", "(", "arg_6", ",", "'service'", ")", ")", "else", ":", "for", "arg_6", "in", "arg_3", ":", "arg_7", "=", "multiprocessing", ".", "Process", "(", "arg_6", "=", "_Func", ",", "arg_11", "=", "(", "arg_0", ",", "arg_1", ",", "arg_6", ",", "arg_4", ",", "arg_0", ".", "get", "(", "arg_6", ",", "'service'", ")", ")", ")", "arg_7", ".", "start", "(", ")", "arg_5", ".", "append", "(", "arg_7", ")", "time", ".", "sleep", "(", "1", ")", "arg_8", "=", "len", "(", "arg_3", ")", "while", "arg_8", ">", "0", ":", "arg_9", "=", "arg_4", ".", "get", "(", "True", ")", "if", "isinstance", "(", "arg_9", ",", "tuple", ")", ":", "arg_10", ",", "arg_11", "=", "arg_9", "if", "arg_10", "==", "SERVICE_FINISHED_ERROR", ":", "arg_6", ",", "arg_12", "=", "arg_11", "log", ".", "info", "(", "\"Terminating workers\"", ")", "for", "arg_13", "in", "arg_5", ":", "arg_13", ".", "terminate", "(", ")", "raise", "RuntimeError", "(", "\"critical error in target '{}'\"", ".", "format", "(", "arg_6", ")", ")", "arg_8", "-=", "1", "continue", "yield", "arg_9", "log", ".", "info", "(", "\"Done aggregating remote issues.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Return all issues from every target. \"\"\"\n    log.info(\"Starting to aggregate remote issues.\")\n\n    # Create and call service objects for every target in the config\n    arg_3 = aslist(arg_0.get(arg_1, 'targets'))\n\n    arg_4 = multiprocessing.Queue()\n\n    log.info(\"Spawning %i workers.\" % len(arg_3))\n    arg_5 = []\n\n    if arg_2:\n        for arg_6 in arg_3:\n            _Func(\n                arg_0,\n                arg_1,\n                arg_6,\n                arg_4,\n                arg_0.get(arg_6, 'service')\n            )\n    else:\n        for arg_6 in arg_3:\n            arg_7 = multiprocessing.Process(\n                arg_6=_Func,\n                arg_11=(arg_0, arg_1, arg_6, arg_4, arg_0.get(arg_6, 'service'))\n            )\n            arg_7.start()\n            arg_5.append(arg_7)\n\n            # Sleep for 1 second here to try and avoid a race condition where\n            # all N workers start up and ask the gpg-agent process for\n            # information at the same time.  This causes gpg-agent to fumble\n            # and tell some of our workers some incomplete things.\n            time.sleep(1)\n\n    arg_8 = len(arg_3)\n    while arg_8 > 0:\n        arg_9 = arg_4.get(True)\n        if isinstance(arg_9, tuple):\n            arg_10, arg_11 = arg_9\n            if arg_10 == SERVICE_FINISHED_ERROR:\n                arg_6, arg_12 = arg_11\n                log.info(\"Terminating workers\")\n                for arg_13 in arg_5:\n                    arg_13.terminate()\n                raise RuntimeError(\n                    \"critical error in target '{}'\".format(arg_6))\n            arg_8 -= 1\n            continue\n        yield arg_9\n\n    log.info(\"Done aggregating remote issues.\")", "path": "bugwarrior/services/__init__.py", "identifier": "aggregate_issues", "docstring": "Return all issues from every target.", "docstring_tokens": ["Return", "all", "issues", "from", "every", "target", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 254805}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L406-L452", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Write data to HDF5 file in one go.", "language": "python", "parameters": "(self, filename_out, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "0", "with", "h5py", ".", "File", "(", "arg_1", ",", "'w'", ")", "as", "arg_5", ":", "arg_5", ".", "attrs", "[", "b'CLASS'", "]", "=", "b'FILTERBANK'", "arg_5", ".", "attrs", "[", "b'VERSION'", "]", "=", "b'1.0'", "if", "HAS_BITSHUFFLE", ":", "arg_7", "=", "bitshuffle", ".", "h5", ".", "H5FILTER", "arg_8", "=", "(", "arg_4", ",", "bitshuffle", ".", "h5", ".", "H5_COMPRESS_LZ4", ")", "else", ":", "arg_7", "=", "None", "arg_8", "=", "None", "logger", ".", "warning", "(", "\"Warning: bitshuffle not found. No compression applied.\"", ")", "arg_9", "=", "arg_5", ".", "create_dataset", "(", "'data'", ",", "data", "=", "arg_0", ".", "data", ",", "compression", "=", "arg_7", ",", "compression_opts", "=", "arg_8", ")", "arg_10", "=", "arg_5", ".", "create_dataset", "(", "'mask'", ",", "shape", "=", "arg_0", ".", "file_shape", ",", "compression", "=", "arg_7", ",", "compression_opts", "=", "arg_8", ",", "dtype", "=", "'uint8'", ")", "arg_9", ".", "dims", "[", "0", "]", ".", "label", "=", "b\"frequency\"", "arg_9", ".", "dims", "[", "1", "]", ".", "label", "=", "b\"feed_id\"", "arg_9", ".", "dims", "[", "2", "]", ".", "label", "=", "b\"time\"", "arg_10", ".", "dims", "[", "0", "]", ".", "label", "=", "b\"frequency\"", "arg_10", ".", "dims", "[", "1", "]", ".", "label", "=", "b\"feed_id\"", "arg_10", ".", "dims", "[", "2", "]", ".", "label", "=", "b\"time\"", "for", "arg_13", ",", "arg_14", "in", "arg_0", ".", "header", ".", "items", "(", ")", ":", "arg_9", ".", "attrs", "[", "arg_13", "]", "=", "arg_14"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\" Write data to HDF5 file in one go.\n\n        Args:\n            filename_out (str): Name of output file\n        \"\"\"\n\n        arg_4 = 0\n\n        with h5py.File(arg_1, 'w') as arg_5:\n\n            arg_5.attrs[b'CLASS']   = b'FILTERBANK'\n            arg_5.attrs[b'VERSION'] = b'1.0'\n\n            if HAS_BITSHUFFLE:\n                arg_7 = bitshuffle.h5.H5FILTER\n                arg_8 = (arg_4, bitshuffle.h5.H5_COMPRESS_LZ4)\n            else:\n                arg_7 = None\n                arg_8 = None\n                logger.warning(\"Warning: bitshuffle not found. No compression applied.\")\n\n\n            arg_9 = arg_5.create_dataset('data',\n                        data=arg_0.data,\n#                          compression='lzf')\n                        compression=arg_7,\n                        compression_opts=arg_8)\n\n            arg_10 = arg_5.create_dataset('mask',\n                        shape=arg_0.file_shape,\n#                                 compression='lzf',\n                        compression=arg_7,\n                        compression_opts=arg_8,\n                        dtype='uint8')\n\n            arg_9.dims[0].label = b\"frequency\"\n            arg_9.dims[1].label = b\"feed_id\"\n            arg_9.dims[2].label = b\"time\"\n\n            arg_10.dims[0].label = b\"frequency\"\n            arg_10.dims[1].label = b\"feed_id\"\n            arg_10.dims[2].label = b\"time\"\n\n            # Copy over header information as attributes\n            for arg_13, arg_14 in arg_0.header.items():\n                arg_9.attrs[arg_13] = arg_14", "path": "blimpy/waterfall.py", "identifier": "Waterfall.__write_to_hdf5_light", "docstring": "Write data to HDF5 file in one go.\n\n        Args:\n            filename_out (str): Name of output file", "docstring_tokens": ["Write", "data", "to", "HDF5", "file", "in", "one", "go", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 254806}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/panel.py#L117-L131", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Check if the latest version of OMIM differs from the most recent in database\n           Return all genes that where not in the previous version.", "language": "python", "parameters": "(self, existing_panel, new_panel)", "return_statement": "return new_genes.difference(existing_genes)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "set", "(", "[", "gene", "[", "'hgnc_id'", "]", "for", "gene", "in", "arg_1", "[", "'genes'", "]", "]", ")", "arg_4", "=", "set", "(", "[", "gene", "[", "'hgnc_id'", "]", "for", "gene", "in", "arg_2", "[", "'genes'", "]", "]", ")", "return", "arg_4", ".", "difference", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check if the latest version of OMIM differs from the most recent in database\n           Return all genes that where not in the previous version.\n\n        Args:\n            existing_panel(dict)\n            new_panel(dict)\n\n        Returns:\n            new_genes(set(str))\n        \"\"\"\n        arg_3 = set([gene['hgnc_id'] for gene in arg_1['genes']])\n        arg_4 = set([gene['hgnc_id'] for gene in arg_2['genes']])\n\n        return arg_4.difference(arg_3)", "path": "scout/adapter/mongo/panel.py", "identifier": "PanelHandler.compare_mim_panels", "docstring": "Check if the latest version of OMIM differs from the most recent in database\n           Return all genes that where not in the previous version.\n\n        Args:\n            existing_panel(dict)\n            new_panel(dict)\n\n        Returns:\n            new_genes(set(str))", "docstring_tokens": ["Check", "if", "the", "latest", "version", "of", "OMIM", "differs", "from", "the", "most", "recent", "in", "database", "Return", "all", "genes", "that", "where", "not", "in", "the", "previous", "version", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254807}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L133-L150", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Establish a new route in the AMS Router.", "language": "python", "parameters": "(net_id, ip_address)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_adsDLL", ".", "AdsAddRoute", "arg_2", ".", "restype", "=", "ctypes", ".", "c_long", "arg_4", "=", "ctypes", ".", "c_char_p", "(", "arg_1", ".", "encode", "(", "\"utf-8\"", ")", ")", "arg_5", "=", "arg_2", "(", "arg_0", ",", "arg_4", ")", "if", "arg_5", ":", "raise", "ADSError", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n    # type: (SAmsNetId, str) -> None\n    \"\"\"Establish a new route in the AMS Router.\n\n    :param pyads.structs.SAmsNetId net_id: net id of routing endpoint\n    :param str ip_address: ip address of the routing endpoint\n\n    \"\"\"\n    arg_2 = _adsDLL.AdsAddRoute\n    arg_2.restype = ctypes.c_long\n\n    # Convert ip address to bytes (PY3) and get pointer.\n    arg_4 = ctypes.c_char_p(arg_1.encode(\"utf-8\"))\n\n    arg_5 = arg_2(arg_0, arg_4)\n\n    if arg_5:\n        raise ADSError(arg_5)", "path": "pyads/pyads_ex.py", "identifier": "adsAddRoute", "docstring": "Establish a new route in the AMS Router.\n\n    :param pyads.structs.SAmsNetId net_id: net id of routing endpoint\n    :param str ip_address: ip address of the routing endpoint", "docstring_tokens": ["Establish", "a", "new", "route", "in", "the", "AMS", "Router", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 254808}
{"url": "https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/utils.py#L353-L364", "sha": "3d6bf5e64220fe921468a36fce68e15d7947cf92", "docstring_summary": "Returns locals dictionary from a given frame.", "language": "python", "parameters": "(stepback=0)", "return_statement": "return locals_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0", ")", ":", "with", "Frame", "(", "arg_0", "=", "arg_0", ")", "as", "frame", ":", "arg_1", "=", "frame", ".", "f_locals", "return", "arg_1"], "function": "def Func(arg_0=0):\n    \"\"\"Returns locals dictionary from a given frame.\n\n    :param int stepback:\n\n    :rtype: dict\n\n    \"\"\"\n    with Frame(arg_0=arg_0) as frame:\n        arg_1 = frame.f_locals\n\n    return arg_1", "path": "siteprefs/utils.py", "identifier": "get_frame_locals", "docstring": "Returns locals dictionary from a given frame.\n\n    :param int stepback:\n\n    :rtype: dict", "docstring_tokens": ["Returns", "locals", "dictionary", "from", "a", "given", "frame", "."], "nwo": "idlesign/django-siteprefs", "score": 0.18190671880906387, "idx": 254809}
{"url": "https://github.com/Skyscanner/pages/blob/f80471ef01f84b11e4d751dff1e6398ae1e230b8/pages/standard_components/textinput.py#L42-L49", "sha": "f80471ef01f84b11e4d751dff1e6398ae1e230b8", "docstring_summary": "Works around the problem of emulating user interactions with text inputs.\n            Emulates a key-down action on the first char of the input. This way, implementations which\n            require key-down event to trigger auto-suggest are testable.\n            Then the chains sends the rest of the text and releases the key.", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "ActionChains", "(", "arg_0", ".", "driver", ")", ".", "key_down", "(", "arg_1", ")", ".", "key_up", "(", "Keys", ".", "CONTROL", ")", ".", "perform", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Works around the problem of emulating user interactions with text inputs.\n            Emulates a key-down action on the first char of the input. This way, implementations which\n            require key-down event to trigger auto-suggest are testable.\n            Then the chains sends the rest of the text and releases the key.\n        \"\"\"\n        ActionChains(arg_0.driver).key_down(arg_1).key_up(Keys.CONTROL).perform()", "path": "pages/standard_components/textinput.py", "identifier": "TextInput.input_text_with_keyboard_emulation", "docstring": "Works around the problem of emulating user interactions with text inputs.\n            Emulates a key-down action on the first char of the input. This way, implementations which\n            require key-down event to trigger auto-suggest are testable.\n            Then the chains sends the rest of the text and releases the key.", "docstring_tokens": ["Works", "around", "the", "problem", "of", "emulating", "user", "interactions", "with", "text", "inputs", ".", "Emulates", "a", "key", "-", "down", "action", "on", "the", "first", "char", "of", "the", "input", ".", "This", "way", "implementations", "which", "require", "key", "-", "down", "event", "to", "trigger", "auto", "-", "suggest", "are", "testable", ".", "Then", "the", "chains", "sends", "the", "rest", "of", "the", "text", "and", "releases", "the", "key", "."], "nwo": "Skyscanner/pages", "score": 0.18843024134315003, "idx": 254810}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L412-L419", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Removes this layer from the canvas.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "index", "(", ")", "if", "arg_1", "!=", "None", ":", "del", "arg_0", ".", "canvas", ".", "layers", "[", "arg_1", "]"], "function": "def Func(arg_0):\n        \n        \"\"\"Removes this layer from the canvas.\n              \n        \"\"\"\n        \n        arg_1 = arg_0.index()\n        if arg_1 != None: del arg_0.canvas.layers[arg_1]", "path": "lib/photobot/__init__.py", "identifier": "Layer.delete", "docstring": "Removes this layer from the canvas.", "docstring_tokens": ["Removes", "this", "layer", "from", "the", "canvas", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 254811}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/excel_utils.py#L169-L175", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return a DataFrame with the duplicated values of the column `col_name`\n    in `df`.", "language": "python", "parameters": "(df, col_name)", "return_statement": "return dups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_check_cols", "(", "arg_0", ",", "[", "arg_1", "]", ")", "arg_2", "=", "arg_0", "[", "pd", ".", "notnull", "(", "arg_0", "[", "arg_1", "]", ")", "&", "arg_0", ".", "duplicated", "(", "subset", "=", "[", "arg_1", "]", ")", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Return a DataFrame with the duplicated values of the column `col_name`\n    in `df`.\"\"\"\n    _check_cols(arg_0, [arg_1])\n\n    arg_2 = arg_0[pd.notnull(arg_0[arg_1]) & arg_0.duplicated(subset=[arg_1])]\n    return arg_2", "path": "boyle/excel_utils.py", "identifier": "duplicated_rows", "docstring": "Return a DataFrame with the duplicated values of the column `col_name`\n    in `df`.", "docstring_tokens": ["Return", "a", "DataFrame", "with", "the", "duplicated", "values", "of", "the", "column", "col_name", "in", "df", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254812}
{"url": "https://github.com/mordred-descriptor/mordred/blob/2848b088fd7b6735590242b5e22573babc724f10/mordred/_base/descriptor.py#L186-L196", "sha": "2848b088fd7b6735590242b5e22573babc724f10", "docstring_summary": "Get 3D coordinate.", "language": "python", "parameters": "(self)", "return_statement": "return self._context.get_coord(self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "require_3D", ":", "arg_0", ".", "fail", "(", "AttributeError", "(", "\"use 3D Funcinate in 2D descriptor\"", ")", ")", "return", "arg_0", ".", "_context", ".", "get_Func", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"Get 3D Funcinate.\n\n        Returns:\n            numpy.array[3, N]: Funcinate matrix\n\n        \"\"\"\n        if not arg_0.require_3D:\n            arg_0.fail(AttributeError(\"use 3D Funcinate in 2D descriptor\"))\n\n        return arg_0._context.get_Func(arg_0)", "path": "mordred/_base/descriptor.py", "identifier": "Descriptor.coord", "docstring": "Get 3D coordinate.\n\n        Returns:\n            numpy.array[3, N]: coordinate matrix", "docstring_tokens": ["Get", "3D", "coordinate", "."], "nwo": "mordred-descriptor/mordred", "score": 0.9032497569731454, "idx": 254813}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/utils.py#L168-L186", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Creates a dict with the inputted items; pruning any that are `None`.", "language": "python", "parameters": "(*dictionaries, **items)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ")", "arg_2", ".", "append", "(", "arg_1", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_2", ":", "for", "arg_5", ",", "arg_6", "in", "arg_4", ".", "items", "(", ")", ":", "if", "arg_6", "is", "not", "None", ":", "arg_3", "[", "arg_5", "]", "=", "arg_6", "return", "arg_3"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"Creates a dict with the inputted items; pruning any that are `None`.\n\n    Args:\n        *dictionaries(dict): Dictionaries of items to be pruned and included.\n        **items: Items to be pruned and included.\n\n    Returns:\n        dict: A dictionary containing all of the items with a 'non-None' value.\n\n    \"\"\"\n    arg_2 = list(arg_0)\n    arg_2.append(arg_1)\n    arg_3 = {}\n    for arg_4 in arg_2:\n        for arg_5, arg_6 in arg_4.items():\n            if arg_6 is not None:\n                arg_3[arg_5] = arg_6\n    return arg_3", "path": "webexteamssdk/utils.py", "identifier": "dict_from_items_with_values", "docstring": "Creates a dict with the inputted items; pruning any that are `None`.\n\n    Args:\n        *dictionaries(dict): Dictionaries of items to be pruned and included.\n        **items: Items to be pruned and included.\n\n    Returns:\n        dict: A dictionary containing all of the items with a 'non-None' value.", "docstring_tokens": ["Creates", "a", "dict", "with", "the", "inputted", "items", ";", "pruning", "any", "that", "are", "None", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 254814}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L952-L961", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Delete files on S3", "language": "python", "parameters": "(self, source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "s3walk", "(", "arg_1", ")", ":", "if", "not", "arg_3", "[", "'is_dir'", "]", ":", "arg_2", ".", "append", "(", "arg_3", "[", "'name'", "]", ")", "arg_4", "=", "ThreadPool", "(", "ThreadUtil", ",", "arg_0", ".", "opt", ")", "arg_4", ".", "batch_delete", "(", "arg_2", ")", "arg_4", ".", "join", "(", ")"], "function": "def Func(arg_0, arg_1):\n    '''Delete files on S3'''\n    arg_2 = []\n    for arg_3 in arg_0.s3walk(arg_1):\n      if not arg_3['is_dir']: # ignore directories\n        arg_2.append(arg_3['name'])\n\n    arg_4 = ThreadPool(ThreadUtil, arg_0.opt)\n    arg_4.batch_delete(arg_2)\n    arg_4.join()", "path": "s4cmd.py", "identifier": "S3Handler.del_files", "docstring": "Delete files on S3", "docstring_tokens": ["Delete", "files", "on", "S3"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 254815}
{"url": "https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L104-L126", "sha": "e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95", "docstring_summary": "Load the includes of an encoding Namelist files.", "language": "python", "parameters": "(item, unique_glyphs, cache)", "return_statement": "return item", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "[", "\"includes\"", "]", "=", "[", "]", "arg_4", "=", "arg_0", "[", "\"charset\"", "]", "=", "set", "(", ")", "|", "arg_0", "[", "\"ownCharset\"", "]", "arg_5", "=", "arg_0", "[", "\"noCharcode\"", "]", "=", "set", "(", ")", "|", "arg_0", "[", "\"ownNoCharcode\"", "]", "arg_6", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", "[", "\"fileName\"", "]", ")", "for", "arg_7", "in", "arg_0", "[", "\"header\"", "]", "[", "\"includes\"", "]", ":", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_7", ")", "try", ":", "arg_9", "=", "readNamelist", "(", "arg_8", ",", "arg_1", ",", "arg_2", ")", "except", "NamelistRecursionError", ":", "continue", "if", "arg_9", "in", "arg_3", ":", "continue", "arg_3", ".", "append", "(", "arg_9", ")", "arg_4", "|=", "arg_9", "[", "\"charset\"", "]", "arg_5", "|=", "arg_9", "[", "\"ownNoCharcode\"", "]", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Load the includes of an encoding Namelist files.\n\n  This is an implementation detail of readNamelist.\n  \"\"\"\n  arg_3 = arg_0[\"includes\"] = []\n  arg_4 = arg_0[\"charset\"] = set() | arg_0[\"ownCharset\"]\n\n  arg_5 = arg_0[\"noCharcode\"] = set() | arg_0[\"ownNoCharcode\"]\n\n  arg_6 =  os.path.dirname(arg_0[\"fileName\"])\n  for arg_7 in arg_0[\"header\"][\"includes\"]:\n    arg_8 = os.path.join(arg_6, arg_7)\n    try:\n      arg_9 = readNamelist(arg_8, arg_1, arg_2)\n    except NamelistRecursionError:\n      continue\n    if arg_9 in arg_3:\n      continue\n    arg_3.append(arg_9)\n    arg_4 |= arg_9[\"charset\"]\n    arg_5 |= arg_9[\"ownNoCharcode\"]\n  return arg_0", "path": "fontaine/charsets/internals/gfonts_utils.py", "identifier": "_loadNamelistIncludes", "docstring": "Load the includes of an encoding Namelist files.\n\n  This is an implementation detail of readNamelist.", "docstring_tokens": ["Load", "the", "includes", "of", "an", "encoding", "Namelist", "files", "."], "nwo": "davelab6/pyfontaine", "score": 0.1950553484412712, "idx": 254816}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L342-L347", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Conference List Helper", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/ConferenceList/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Conference List Helper\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/ConferenceList/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.conference_list", "docstring": "REST Conference List Helper", "docstring_tokens": ["REST", "Conference", "List", "Helper"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 254817}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Telegraf/config.py#L185-L225", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Startup and shutdown commands config\n        Used by agent.py on the target", "language": "python", "parameters": "(self)", "return_statement": "return cfg_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"agent_startup_{}.cfg\"", ".", "format", "(", "arg_0", ".", "host", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "logger", ".", "info", "(", "'Found agent startup config file in working directory with the same name as created for host %s.\\n'", "'Creating new one via tempfile. This will affect predictable filenames for agent artefacts'", ",", "arg_0", ".", "host", ")", "arg_2", ",", "arg_1", "=", "tempfile", ".", "mkstemp", "(", "'.cfg'", ",", "'agent_'", ")", "os", ".", "close", "(", "arg_2", ")", "try", ":", "arg_3", "=", "ConfigParser", ".", "RawConfigParser", "(", ")", "arg_3", ".", "add_section", "(", "'startup'", ")", "[", "arg_3", ".", "set", "(", "'startup'", ",", "\"cmd%s\"", "%", "arg_4", ",", "arg_5", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_0", ".", "startups", ")", "]", "arg_3", ".", "add_section", "(", "'shutdown'", ")", "[", "arg_3", ".", "set", "(", "'shutdown'", ",", "\"cmd%s\"", "%", "arg_4", ",", "arg_5", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_0", ".", "shutdowns", ")", "]", "arg_3", ".", "add_section", "(", "'source'", ")", "[", "arg_3", ".", "set", "(", "'source'", ",", "\"file%s\"", "%", "arg_4", ",", "arg_6", ")", "for", "arg_4", ",", "arg_6", "in", "enumerate", "(", "arg_0", ".", "sources", ")", "]", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "fds", ":", "arg_3", ".", "write", "(", "fds", ")", "except", "Exception", "as", "exc", ":", "logger", ".", "error", "(", "'Error trying to create monitoring startups config. Malformed? %s'", ",", "exc", ",", "exc_info", "=", "True", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Startup and shutdown commands config\n        Used by agent.py on the target\n\n        \"\"\"\n        arg_1 = \"agent_startup_{}.cfg\".format(arg_0.host)\n        if os.path.isfile(arg_1):\n            logger.info(\n                'Found agent startup config file in working directory with the same name as created for host %s.\\n'\n                'Creating new one via tempfile. This will affect predictable filenames for agent artefacts',\n                arg_0.host)\n            arg_2, arg_1 = tempfile.mkstemp('.cfg', 'agent_')\n            os.close(arg_2)\n        try:\n            arg_3 = ConfigParser.RawConfigParser()\n            # FIXME incinerate such a string formatting inside a method call\n            # T_T\n            arg_3.add_section('startup')\n            [\n                arg_3.set('startup', \"cmd%s\" % arg_4, arg_5)\n                for arg_4, arg_5 in enumerate(arg_0.startups)\n            ]\n            arg_3.add_section('shutdown')\n            [\n                arg_3.set('shutdown', \"cmd%s\" % arg_4, arg_5)\n                for arg_4, arg_5 in enumerate(arg_0.shutdowns)\n            ]\n            arg_3.add_section('source')\n            [\n                arg_3.set('source', \"file%s\" % arg_4, arg_6)\n                for arg_4, arg_6 in enumerate(arg_0.sources)\n            ]\n            with open(arg_1, 'w') as fds:\n                arg_3.write(fds)\n\n        except Exception as exc:\n            logger.error(\n                'Error trying to create monitoring startups config. Malformed? %s',\n                exc,\n                exc_info=True)\n        return arg_1", "path": "yandextank/plugins/Telegraf/config.py", "identifier": "AgentConfig.create_startup_config", "docstring": "Startup and shutdown commands config\n        Used by agent.py on the target", "docstring_tokens": ["Startup", "and", "shutdown", "commands", "config", "Used", "by", "agent", ".", "py", "on", "the", "target"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 254818}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_client.py#L290-L311", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Make a POST request to the given path, with `data` in its body.\n        Return the JSON-decoded result.", "language": "python", "parameters": "(self, path, data, content_type, **params)", "return_statement": "return self._json_request('post', url,\n            params=params,\n            data=data,\n            headers={'Content-Type': content_type}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "arg_4", "=", "jsonify_parameters", "(", "arg_4", ")", "arg_5", "=", "ensure_trailing_slash", "(", "arg_0", ".", "url", "+", "arg_1", ".", "lstrip", "(", "'/'", ")", ")", "return", "arg_0", ".", "_json_request", "(", "'post'", ",", "arg_5", ",", "arg_4", "=", "arg_4", ",", "arg_2", "=", "arg_2", ",", "headers", "=", "{", "'Content-Type'", ":", "arg_3", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"\n        Make a POST request to the given path, with `data` in its body.\n        Return the JSON-decoded result.\n\n        The content_type must be set to reflect the kind of data being sent,\n        which is often `application/json`.\n\n        Keyword parameters will be converted to URL parameters. This is unlike\n        other POST requests which encode those parameters in the body, because\n        the body is already being used.\n\n        This is used by the Luminoso API to upload new documents in JSON\n        format.\n        \"\"\"\n        arg_4 = jsonify_parameters(arg_4)\n        arg_5 = ensure_trailing_slash(arg_0.url + arg_1.lstrip('/'))\n        return arg_0._json_request('post', arg_5,\n            arg_4=arg_4,\n            arg_2=arg_2,\n            headers={'Content-Type': arg_3}\n        )", "path": "luminoso_api/v4_client.py", "identifier": "LuminosoClient.post_data", "docstring": "Make a POST request to the given path, with `data` in its body.\n        Return the JSON-decoded result.\n\n        The content_type must be set to reflect the kind of data being sent,\n        which is often `application/json`.\n\n        Keyword parameters will be converted to URL parameters. This is unlike\n        other POST requests which encode those parameters in the body, because\n        the body is already being used.\n\n        This is used by the Luminoso API to upload new documents in JSON\n        format.", "docstring_tokens": ["Make", "a", "POST", "request", "to", "the", "given", "path", "with", "data", "in", "its", "body", ".", "Return", "the", "JSON", "-", "decoded", "result", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 254819}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/api.py#L457-L472", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Delete deposit.", "language": "python", "parameters": "(self, force=True, pid=None)", "return_statement": "return super(Deposit, self).delete(force=force)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "arg_0", ".", "pid", "if", "arg_0", "[", "'_deposit'", "]", ".", "get", "(", "'pid'", ")", ":", "raise", "PIDInvalidAction", "(", ")", "if", "arg_2", ":", "arg_2", ".", "Func", "(", ")", "return", "super", "(", "Deposit", ",", "arg_0", ")", ".", "Func", "(", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=None):\n        \"\"\"Delete deposit.\n\n        Status required: ``'draft'``.\n\n        :param force: Force deposit Func.  (Default: ``True``)\n        :param pid: Force pid object.  (Default: ``None``)\n        :returns: A new Deposit object.\n        \"\"\"\n        arg_2 = arg_2 or arg_0.pid\n\n        if arg_0['_deposit'].get('pid'):\n            raise PIDInvalidAction()\n        if arg_2:\n            arg_2.Func()\n        return super(Deposit, arg_0).Func(arg_1=arg_1)", "path": "invenio_deposit/api.py", "identifier": "Deposit.delete", "docstring": "Delete deposit.\n\n        Status required: ``'draft'``.\n\n        :param force: Force deposit delete.  (Default: ``True``)\n        :param pid: Force pid object.  (Default: ``None``)\n        :returns: A new Deposit object.", "docstring_tokens": ["Delete", "deposit", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 254820}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/emoticon.py#L9-L21", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Replace words with corresponding values in replacements dict.", "language": "python", "parameters": "(replacements, string)", "return_statement": "return '\\n'.join(' '.join(output_words) for output_words in output_lines)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ".", "split", "(", "'\\n'", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ".", "split", "(", "' '", ")", ":", "arg_6", "=", "arg_0", ".", "get", "(", "arg_5", ",", "arg_5", ")", "arg_4", ".", "append", "(", "arg_6", ")", "arg_2", ".", "append", "(", "arg_4", ")", "return", "'\\n'", ".", "join", "(", "' '", ".", "join", "(", "arg_4", ")", "for", "arg_4", "in", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Replace words with corresponding values in replacements dict.\n\n    Words must be separated by spaces or newlines.\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_1.split('\\n'):\n        arg_4 = []\n        for arg_5 in arg_3.split(' '):\n            arg_6 = arg_0.get(arg_5, arg_5)\n            arg_4.append(arg_6)\n        arg_2.append(arg_4)\n    return '\\n'.join(' '.join(arg_4) for arg_4 in arg_2)", "path": "hangups/ui/emoticon.py", "identifier": "_replace_words", "docstring": "Replace words with corresponding values in replacements dict.\n\n    Words must be separated by spaces or newlines.", "docstring_tokens": ["Replace", "words", "with", "corresponding", "values", "in", "replacements", "dict", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 254821}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/metaspades.py#L154-L239", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Main executor of the spades template.", "language": "python", "parameters": "(sample_id, fastq_pair, max_len, kmer, clear)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "logger", ".", "info", "(", "\"Starting spades\"", ")", "logger", ".", "info", "(", "\"Setting SPAdes kmers\"", ")", "arg_5", "=", "set_kmers", "(", "arg_3", ",", "arg_2", ")", "logger", ".", "info", "(", "\"SPAdes kmers set to: {}\"", ".", "format", "(", "arg_5", ")", ")", "arg_6", "=", "[", "\"metaspades.py\"", ",", "\"--only-assembler\"", ",", "\"--threads\"", ",", "\"$task.cpus\"", ",", "\"-o\"", ",", "\".\"", "]", "if", "arg_5", ":", "arg_6", "+=", "[", "\"-k {}\"", ".", "format", "(", "\",\"", ".", "join", "(", "[", "str", "(", "arg_7", ")", "for", "arg_7", "in", "arg_5", "]", ")", ")", "]", "arg_6", "+=", "[", "\"-1\"", ",", "arg_1", "[", "0", "]", ",", "\"-2\"", ",", "arg_1", "[", "1", "]", "]", "logger", ".", "debug", "(", "\"Running metaSPAdes subprocess with command: {}\"", ".", "format", "(", "arg_6", ")", ")", "arg_8", "=", "subprocess", ".", "Popen", "(", "arg_6", ",", "arg_9", "=", "PIPE", ",", "arg_10", "=", "PIPE", ")", "arg_9", ",", "arg_10", "=", "arg_8", ".", "communicate", "(", ")", "try", ":", "arg_10", "=", "arg_10", ".", "decode", "(", "\"utf8\"", ")", "arg_9", "=", "arg_9", ".", "decode", "(", "\"utf8\"", ")", "except", "(", "UnicodeDecodeError", ",", "AttributeError", ")", ":", "arg_10", "=", "str", "(", "arg_10", ")", "arg_9", "=", "str", "(", "arg_9", ")", "logger", ".", "info", "(", "\"Finished metaSPAdes subprocess with STDOUT:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_9", ")", ")", "logger", ".", "info", "(", "\"Fished metaSPAdes subprocesswith STDERR:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_10", ")", ")", "logger", ".", "info", "(", "\"Finished metaSPAdes with return code: {}\"", ".", "format", "(", "arg_8", ".", "returncode", ")", ")", "with", "open", "(", "\".status\"", ",", "\"w\"", ")", "as", "fh", ":", "if", "arg_8", ".", "returncode", "!=", "0", ":", "fh", ".", "write", "(", "\"error\"", ")", "return", "else", ":", "fh", ".", "write", "(", "\"pass\"", ")", "if", "\"_trim.\"", "in", "arg_1", "[", "0", "]", ":", "arg_0", "+=", "\"_trim\"", "arg_11", "=", "\"{}_metaspades.fasta\"", ".", "format", "(", "arg_0", ")", "os", ".", "rename", "(", "\"contigs.fasta\"", ",", "arg_11", ")", "logger", ".", "info", "(", "\"Setting Func assembly file to: {}\"", ".", "format", "(", "arg_11", ")", ")", "if", "arg_4", "==", "\"true\"", "and", "os", ".", "path", ".", "exists", "(", "arg_11", ")", ":", "clean_up", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Main executor of the spades template.\n\n    Parameters\n    ----------\n    sample_id : str\n        Sample Identification string.\n    fastq_pair : list\n        Two element list containing the paired FastQ files.\n    max_len : int\n        Maximum read length. This value is determined in\n        :py:class:`templates.integrity_coverage`\n    kmer : str\n        Can be either ``'auto'``, ``'default'`` or a\n        sequence of space separated integers, ``'23, 45, 67'``.\n\n    \"\"\"\n\n    logger.info(\"Starting spades\")\n\n    logger.info(\"Setting SPAdes kmers\")\n    arg_5 = set_kmers(arg_3, arg_2)\n    logger.info(\"SPAdes kmers set to: {}\".format(arg_5))\n\n    arg_6 = [\n        \"metaspades.py\",\n        \"--only-assembler\",\n        \"--threads\",\n        \"$task.cpus\",\n        \"-o\",\n        \".\"\n    ]\n\n    # Add kmers, if any were specified\n    if arg_5:\n        arg_6 += [\"-k {}\".format(\",\".join([str(arg_7) for arg_7 in arg_5]))]\n\n    # Add FastQ files\n    arg_6 += [\n        \"-1\",\n        arg_1[0],\n        \"-2\",\n        arg_1[1]\n    ]\n\n    logger.debug(\"Running metaSPAdes subprocess with command: {}\".format(arg_6))\n\n    arg_8 = subprocess.Popen(arg_6, arg_9=PIPE, arg_10=PIPE)\n    arg_9, arg_10 = arg_8.communicate()\n\n    # Attempt to decode STDERR output from bytes. If unsuccessful, coerce to\n    # string\n    try:\n        arg_10 = arg_10.decode(\"utf8\")\n        arg_9 = arg_9.decode(\"utf8\")\n    except (UnicodeDecodeError, AttributeError):\n        arg_10 = str(arg_10)\n        arg_9 = str(arg_9)\n\n    logger.info(\"Finished metaSPAdes subprocess with STDOUT:\\\\n\"\n                \"======================================\\\\n{}\".format(arg_9))\n    logger.info(\"Fished metaSPAdes subprocesswith STDERR:\\\\n\"\n                \"======================================\\\\n{}\".format(arg_10))\n    logger.info(\"Finished metaSPAdes with return code: {}\".format(\n        arg_8.returncode))\n\n    with open(\".status\", \"w\") as fh:\n        if arg_8.returncode != 0:\n            fh.write(\"error\")\n            return\n        else:\n            fh.write(\"pass\")\n\n    # Change the default contigs.fasta assembly name to a more informative one\n    if \"_trim.\" in arg_1[0]:\n        arg_0 += \"_trim\"\n\n    arg_11 = \"{}_metaspades.fasta\".format(\n        arg_0)\n    os.rename(\"contigs.fasta\", arg_11)\n    logger.info(\"Setting Func assembly file to: {}\".format(arg_11))\n\n    # Remove input fastq files when clear option is specified.\n    # Only remove temporary input when the expected output exists.\n    if arg_4 == \"true\" and os.path.exists(arg_11):\n        clean_up(arg_1)", "path": "flowcraft/templates/metaspades.py", "identifier": "main", "docstring": "Main executor of the spades template.\n\n    Parameters\n    ----------\n    sample_id : str\n        Sample Identification string.\n    fastq_pair : list\n        Two element list containing the paired FastQ files.\n    max_len : int\n        Maximum read length. This value is determined in\n        :py:class:`templates.integrity_coverage`\n    kmer : str\n        Can be either ``'auto'``, ``'default'`` or a\n        sequence of space separated integers, ``'23, 45, 67'``.", "docstring_tokens": ["Main", "executor", "of", "the", "spades", "template", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 254822}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L852-L925", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Merge to_merge into the given main list.", "language": "python", "parameters": "(self, to_merge, strict=True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "[", "]", "if", "arg_2", ":", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_1", ")", ":", "try", ":", "if", "isinstance", "(", "arg_5", ",", "dict", ")", "and", "isinstance", "(", "arg_0", ".", "main_list", "[", "arg_4", "]", ",", "dict", ")", ":", "arg_3", ".", "append", "(", "Dict", "(", "arg_0", ".", "main_list", "[", "arg_4", "]", ")", ".", "Func", "(", "arg_5", ")", ")", "elif", "isinstance", "(", "arg_5", ",", "list", ")", "and", "isinstance", "(", "arg_0", ".", "main_list", "[", "arg_4", "]", ",", "list", ")", ":", "arg_3", ".", "append", "(", "List", "(", "arg_0", ".", "main_list", "[", "arg_4", "]", ")", ".", "Func", "(", "arg_5", ")", ")", "else", ":", "arg_3", ".", "append", "(", "arg_5", ")", "except", "IndexError", ":", "arg_3", ".", "append", "(", "arg_5", ")", "else", ":", "arg_3", "=", "arg_0", ".", "main_list", "for", "arg_5", "in", "arg_1", ":", "if", "arg_5", "not", "in", "arg_3", ":", "arg_3", ".", "append", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Merge to_Func into the given main list.\n\n        :param to_Func: The list to Func.\n        :type to_Func: list\n\n        :param strict:\n            Tell us if we have to respect index (True)\n            or not (False).\n        :type strict: bool\n\n        :return: The Funcd list.\n        :rtype: list\n        \"\"\"\n\n        # We initiate a variable which will save the\n        # result\n        arg_3 = []\n\n        if arg_2:\n            # We are in strict mode.\n\n            for arg_4, arg_5 in enumerate(arg_1):\n                # We loop through each element of the list to Func\n                # to the main dict.\n\n                try:\n                    if isinstance(arg_5, dict) and isinstance(\n                        arg_0.main_list[arg_4], dict\n                    ):\n                        # The currently read element is a dict.\n\n                        # We Func its content into the main dict\n                        # and append into the result.\n                        arg_3.append(Dict(arg_0.main_list[arg_4]).Func(arg_5))\n                    elif isinstance(arg_5, list) and isinstance(\n                        arg_0.main_list[arg_4], list\n                    ):\n                        # The currently read element is a list.\n\n                        # We loop through this method.\n                        arg_3.append(List(arg_0.main_list[arg_4]).Func(arg_5))\n                    else:\n                        # The currently read element is not a list\n                        # nor a dict.\n\n                        # We append the element to the result.\n                        arg_3.append(arg_5)\n                except IndexError:  # pragma: no cover\n                    # The index does not exist.\n                    # Which means that for example one list is bigger\n                    # than the other one.\n\n                    # We append the element to the result.\n                    arg_3.append(arg_5)\n        else:\n            # We are not is strict mode.\n\n            # We initiate the result with the main list.\n            arg_3 = arg_0.main_list\n\n            for arg_5 in arg_1:\n                # We loop through the element to Func.\n\n                if arg_5 not in arg_3:\n                    # The currently read element is not\n                    # in the result.\n\n                    # We append it to the result\n                    arg_3.append(arg_5)\n\n        # We return the result.\n        return arg_3", "path": "PyFunceble/helpers.py", "identifier": "List.merge", "docstring": "Merge to_merge into the given main list.\n\n        :param to_merge: The list to merge.\n        :type to_merge: list\n\n        :param strict:\n            Tell us if we have to respect index (True)\n            or not (False).\n        :type strict: bool\n\n        :return: The merged list.\n        :rtype: list", "docstring_tokens": ["Merge", "to_merge", "into", "the", "given", "main", "list", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 254823}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/eval.py#L34-L70", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Validate that the annotation has the correct namespace,\n    and is well-formed.", "language": "python", "parameters": "(ann, namespace)", "return_statement": "return ann", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "convert", "(", "arg_0", ",", "arg_1", ")", "arg_0", ".", "validate", "(", "strict", "=", "True", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    '''Validate that the annotation has the correct namespace,\n    and is well-formed.\n\n    If the annotation is not of the correct namespace, automatic conversion\n    is attempted.\n\n    Parameters\n    ----------\n    ann : jams.Annotation\n        The annotation object in question\n\n    namespace : str\n        The namespace pattern to match `ann` against\n\n    Returns\n    -------\n    ann_coerced: jams.Annotation\n        The annotation coerced to the target namespace\n\n    Raises\n    ------\n    NamespaceError\n        If `ann` does not match the proper namespace\n\n    SchemaError\n        If `ann` fails schema validation\n\n    See Also\n    --------\n    jams.nsconvert.convert\n    '''\n\n    arg_0 = convert(arg_0, arg_1)\n    arg_0.validate(strict=True)\n\n    return arg_0", "path": "jams/eval.py", "identifier": "coerce_annotation", "docstring": "Validate that the annotation has the correct namespace,\n    and is well-formed.\n\n    If the annotation is not of the correct namespace, automatic conversion\n    is attempted.\n\n    Parameters\n    ----------\n    ann : jams.Annotation\n        The annotation object in question\n\n    namespace : str\n        The namespace pattern to match `ann` against\n\n    Returns\n    -------\n    ann_coerced: jams.Annotation\n        The annotation coerced to the target namespace\n\n    Raises\n    ------\n    NamespaceError\n        If `ann` does not match the proper namespace\n\n    SchemaError\n        If `ann` fails schema validation\n\n    See Also\n    --------\n    jams.nsconvert.convert", "docstring_tokens": ["Validate", "that", "the", "annotation", "has", "the", "correct", "namespace", "and", "is", "well", "-", "formed", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 254824}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth1.py#L828-L839", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Verify if the realms match the requested realms.", "language": "python", "parameters": "(self, token, realms, request)", "return_statement": "return set(tok.realms) == set(realms)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "log", ".", "debug", "(", "'Verify realms %r'", ",", "arg_2", ")", "arg_4", "=", "arg_3", ".", "request_token", "or", "arg_0", ".", "_grantgetter", "(", "arg_1", "=", "arg_1", ")", "if", "not", "arg_4", ":", "return", "False", "arg_3", ".", "request_token", "=", "arg_4", "if", "not", "hasattr", "(", "arg_4", ",", "'realms'", ")", ":", "return", "True", "return", "set", "(", "arg_4", ".", "realms", ")", "==", "set", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Verify if the realms match the requested realms.\"\"\"\n        log.debug('Verify realms %r', arg_2)\n        arg_4 = arg_3.request_token or arg_0._grantgetter(arg_1=arg_1)\n        if not arg_4:\n            return False\n\n        arg_3.request_token = arg_4\n        if not hasattr(arg_4, 'realms'):\n            # realms not enabled\n            return True\n        return set(arg_4.realms) == set(arg_2)", "path": "flask_oauthlib/provider/oauth1.py", "identifier": "OAuth1RequestValidator.verify_realms", "docstring": "Verify if the realms match the requested realms.", "docstring_tokens": ["Verify", "if", "the", "realms", "match", "the", "requested", "realms", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 254825}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/bacon/image.py#L106-L110", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "Releases renderer resources associated with this image.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_handle", "!=", "-", "1", ":", "lib", ".", "UnloadImage", "(", "arg_0", ".", "_handle", ")", "arg_0", ".", "_handle", "=", "-", "1"], "function": "def Func(arg_0):\n        '''Releases renderer resources associated with this image.'''\n        if arg_0._handle != -1:\n            lib.UnloadImage(arg_0._handle)\n        arg_0._handle = -1", "path": "bacon/image.py", "identifier": "Image.unload", "docstring": "Releases renderer resources associated with this image.", "docstring_tokens": ["Releases", "renderer", "resources", "associated", "with", "this", "image", "."], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 254826}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L187-L201", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Returns the variable expressions of this constraint set", "language": "python", "parameters": "(self)", "return_statement": "return declarations.result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "GetDeclarations", "(", ")", "for", "arg_2", "in", "arg_0", ".", "constraints", ":", "try", ":", "Func", ".", "visit", "(", "arg_2", ")", "except", "RuntimeError", ":", "if", "sys", ".", "getrecursionlimit", "(", ")", ">=", "PickleSerializer", ".", "MAX_RECURSION", ":", "raise", "Exception", "(", "f'declarations recursion limit surpassed {PickleSerializer.MAX_RECURSION}, aborting'", ")", "arg_3", "=", "sys", ".", "getrecursionlimit", "(", ")", "+", "PickleSerializer", ".", "DEFAULT_RECURSION", "if", "arg_3", "<=", "PickleSerializer", ".", "DEFAULT_RECURSION", ":", "sys", ".", "setrecursionlimit", "(", "arg_3", ")", "return", "arg_0", ".", "declarations", "return", "Func", ".", "result"], "function": "def Func(arg_0):\n        \"\"\" Returns the variable expressions of this constraint set \"\"\"\n        Func = GetDeclarations()\n        for arg_2 in arg_0.constraints:\n            try:\n                Func.visit(arg_2)\n            except RuntimeError:\n                # TODO: (defunct) move recursion management out of PickleSerializer\n                if sys.getrecursionlimit() >= PickleSerializer.MAX_RECURSION:\n                    raise Exception(f'declarations recursion limit surpassed {PickleSerializer.MAX_RECURSION}, aborting')\n                arg_3 = sys.getrecursionlimit() + PickleSerializer.DEFAULT_RECURSION\n                if arg_3 <= PickleSerializer.DEFAULT_RECURSION:\n                    sys.setrecursionlimit(arg_3)\n                    return arg_0.declarations\n        return Func.result", "path": "manticore/core/smtlib/constraints.py", "identifier": "ConstraintSet.declarations", "docstring": "Returns the variable expressions of this constraint set", "docstring_tokens": ["Returns", "the", "variable", "expressions", "of", "this", "constraint", "set"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254827}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L854-L874", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "copy - Copies this object.", "language": "python", "parameters": "(self, copyPrimaryKey=False, copyValues=False)", "return_statement": "return cpy", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "__class__", "(", "**", "arg_0", ".", "asDict", "(", "arg_1", ",", "forStorage", "=", "False", ")", ")", "if", "arg_2", "is", "True", ":", "for", "arg_4", "in", "arg_3", ".", "FIELDS", ":", "setattr", "(", "arg_3", ",", "arg_4", ",", "Func", ".", "deepFunc", "(", "getattr", "(", "arg_3", ",", "arg_4", ")", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n\t\t'''\n                    Func - Copies this object.\n\n                    @param FuncPrimaryKey <bool> default False - If True, any changes to the Func will save over-top the existing entry in Redis.\n                        If False, only the data is copied, and nothing is saved.\n\n\t\t    @param FuncValues <bool> default False - If True, every field value on this object will be explicitly copied. If False,\n\t\t      an object will be created with the same values, and depending on the type may share the same reference.\n\t\t      \n\t\t      This is the difference between a Func and a deepFunc.\n\n\t            @return <IndexedRedisModel> - Copy of this object, per above\n\n\t\t    If you need a Func that IS linked, @see IndexedRedisModel.Func\n\t\t'''\n\t\targ_3 = arg_0.__class__(**arg_0.asDict(arg_1, forStorage=False))\n\t\tif arg_2 is True:\n\t\t\tfor arg_4 in arg_3.FIELDS:\n\t\t\t\tsetattr(arg_3, arg_4, Func.deepFunc(getattr(arg_3, arg_4)))\n\t\treturn arg_3", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisModel.copy", "docstring": "copy - Copies this object.\n\n                    @param copyPrimaryKey <bool> default False - If True, any changes to the copy will save over-top the existing entry in Redis.\n                        If False, only the data is copied, and nothing is saved.\n\n\t\t    @param copyValues <bool> default False - If True, every field value on this object will be explicitly copied. If False,\n\t\t      an object will be created with the same values, and depending on the type may share the same reference.\n\t\t      \n\t\t      This is the difference between a copy and a deepcopy.\n\n\t            @return <IndexedRedisModel> - Copy of this object, per above\n\n\t\t    If you need a copy that IS linked, @see IndexedRedisModel.copy", "docstring_tokens": ["copy", "-", "Copies", "this", "object", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 254828}
{"url": "https://github.com/nesdis/djongo/blob/7f9d79455cf030cb5eee0b822502c50a0d9d3abb/djongo/models/fields.py#L35-L43", "sha": "7f9d79455cf030cb5eee0b822502c50a0d9d3abb", "docstring_summary": "Builds an instance of model from the model_dict.", "language": "python", "parameters": "(model, model_dict)", "return_statement": "return model(**model_dict)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "arg_0", ".", "_meta", ".", "get_field", "(", "arg_2", ")", "arg_1", "[", "arg_2", "]", "=", "arg_3", ".", "to_python", "(", "arg_1", "[", "arg_2", "]", ")", "return", "arg_0", "(", "**", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\r\n    \"\"\"\r\n    Builds an instance of model from the model_dict.\r\n    \"\"\"\r\n    for arg_2 in arg_1:\r\n        arg_3 = arg_0._meta.get_field(arg_2)\r\n        arg_1[arg_2] = arg_3.to_python(arg_1[arg_2])\r\n\r\n    return arg_0(**arg_1)", "path": "djongo/models/fields.py", "identifier": "make_mdl", "docstring": "Builds an instance of model from the model_dict.", "docstring_tokens": ["Builds", "an", "instance", "of", "model", "from", "the", "model_dict", "."], "nwo": "nesdis/djongo", "score": 0.9667508002289729, "idx": 254829}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py#L344-L349", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Returns the signature for the given value", "language": "python", "parameters": "(self, value)", "return_statement": "return base64_encode(sig)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "want_bytes", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "derive_key", "(", ")", "arg_3", "=", "arg_0", ".", "algorithm", ".", "Func", "(", "arg_2", ",", "arg_1", ")", "return", "base64_encode", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns the signature for the given value\"\"\"\n        arg_1 = want_bytes(arg_1)\n        arg_2 = arg_0.derive_key()\n        arg_3 = arg_0.algorithm.Func(arg_2, arg_1)\n        return base64_encode(arg_3)", "path": "capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py", "identifier": "Signer.get_signature", "docstring": "Returns the signature for the given value", "docstring_tokens": ["Returns", "the", "signature", "for", "the", "given", "value"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254830}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L954-L957", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Set parsername as the current parser and apply it.", "language": "python", "parameters": "(self,parsername)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "__parser", "=", "arg_0", ".", "parsers", "[", "arg_1", "]", "arg_0", ".", "__parser", "(", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Set parsername as the current parser and apply it.\"\"\"\n        arg_0.__parser = arg_0.parsers[arg_1]\n        arg_0.__parser()", "path": "gridData/OpenDX.py", "identifier": "DXParser.use_parser", "docstring": "Set parsername as the current parser and apply it.", "docstring_tokens": ["Set", "parsername", "as", "the", "current", "parser", "and", "apply", "it", "."], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 254831}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py#L79-L89", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Add a builtin and save the original.", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "__builtin__", ".", "__dict__", "arg_4", "=", "arg_3", ".", "get", "(", "arg_1", ",", "BuiltinUndefined", ")", "if", "arg_2", "is", "HideBuiltin", ":", "if", "arg_4", "is", "not", "BuiltinUndefined", ":", "arg_0", ".", "_orig_builtins", "[", "arg_1", "]", "=", "arg_4", "del", "arg_3", "[", "arg_1", "]", "else", ":", "arg_0", ".", "_orig_builtins", "[", "arg_1", "]", "=", "arg_4", "arg_3", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add a builtin and save the original.\"\"\"\n        arg_3 = __builtin__.__dict__\n        arg_4 = arg_3.get(arg_1, BuiltinUndefined)\n        if arg_2 is HideBuiltin:\n            if arg_4 is not BuiltinUndefined: #same as 'key in bdict'\n                arg_0._orig_builtins[arg_1] = arg_4\n                del arg_3[arg_1]\n        else:\n            arg_0._orig_builtins[arg_1] = arg_4\n            arg_3[arg_1] = arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py", "identifier": "BuiltinTrap.add_builtin", "docstring": "Add a builtin and save the original.", "docstring_tokens": ["Add", "a", "builtin", "and", "save", "the", "original", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254832}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutators.py#L133-L140", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Get a random mutator for the given type", "language": "python", "parameters": "(self, obj, obj_type)", "return_statement": "return self._get_random(obj_type)(obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "unicode", ":", "arg_2", "=", "str", "arg_1", "=", "str", "(", "arg_1", ")", "return", "arg_0", ".", "_get_random", "(", "arg_2", ")", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get a random mutator for the given type\n        \"\"\"\n        if arg_2 == unicode:\n            arg_2 = str\n            arg_1 = str(arg_1)\n        return arg_0._get_random(arg_2)(arg_1)", "path": "pyjfuzz/core/pjf_mutators.py", "identifier": "PJFMutators.get_mutator", "docstring": "Get a random mutator for the given type", "docstring_tokens": ["Get", "a", "random", "mutator", "for", "the", "given", "type"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 254833}
{"url": "https://github.com/innodatalabs/lxmlx/blob/d0514f62127e51378be4e0c8cea2622c9786f99f/lxmlx/event.py#L143-L155", "sha": "d0514f62127e51378be4e0c8cea2622c9786f99f", "docstring_summary": "merges each run of successive text events into one text event", "language": "python", "parameters": "(events)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", "[", "'type'", "]", "==", "TEXT", ":", "arg_1", ".", "append", "(", "arg_2", "[", "'text'", "]", ")", "else", ":", "if", "arg_1", ":", "yield", "{", "'type'", ":", "TEXT", ",", "'text'", ":", "''", ".", "join", "(", "arg_1", ")", "}", "arg_1", ".", "clear", "(", ")", "yield", "arg_2", "if", "arg_1", ":", "yield", "{", "'type'", ":", "TEXT", ",", "'text'", ":", "''", ".", "join", "(", "arg_1", ")", "}"], "function": "def Func(arg_0):\n    \"\"\"merges each run of successive text events into one text event\"\"\"\n    arg_1 = []\n    for arg_2 in arg_0:\n        if arg_2['type'] == TEXT:\n            arg_1.append(arg_2['text'])\n        else:\n            if arg_1:\n                yield {'type': TEXT, 'text': ''.join(arg_1)}\n                arg_1.clear()\n            yield arg_2\n    if arg_1:\n        yield {'type': TEXT, 'text': ''.join(arg_1)}", "path": "lxmlx/event.py", "identifier": "merge_text", "docstring": "merges each run of successive text events into one text event", "docstring_tokens": ["merges", "each", "run", "of", "successive", "text", "events", "into", "one", "text", "event"], "nwo": "innodatalabs/lxmlx", "score": 0.16638194949711382, "idx": 254834}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/publicsuffix.py#L104-L146", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Extract the extension from the given line.", "language": "python", "parameters": "(self, line)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "strip", "(", ")", "if", "not", "arg_1", ".", "startswith", "(", "\"//\"", ")", "and", "\".\"", "in", "arg_1", ":", "arg_1", "=", "arg_1", ".", "encode", "(", "\"idna\"", ")", ".", "decode", "(", "\"utf-8\"", ")", "if", "arg_1", ".", "startswith", "(", "\"*.\"", ")", ":", "arg_1", "=", "arg_1", "[", "2", ":", "]", "arg_2", "=", "arg_1", ".", "split", "(", "\".\"", ")", "[", "-", "1", "]", "if", "arg_2", "in", "arg_0", ".", "public_suffix_db", ":", "arg_0", ".", "public_suffix_db", "[", "arg_2", "]", "=", "List", "(", "arg_0", ".", "public_suffix_db", "[", "arg_2", "]", "+", "[", "arg_1", "]", ")", ".", "format", "(", ")", "else", ":", "arg_0", ".", "public_suffix_db", ".", "update", "(", "{", "arg_2", ":", "[", "arg_1", "]", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Extract the extension from the given line.\n\n        :param line: The line from the official public suffix repository.\n        :type line: str\n        \"\"\"\n\n        # We strip the parsed line.\n        arg_1 = arg_1.strip()\n\n        if not arg_1.startswith(\"//\") and \".\" in arg_1:\n            # * The parsed line is not a commented line.\n            # and\n            # * There is a point in the parsed line.\n            arg_1 = arg_1.encode(\"idna\").decode(\"utf-8\")\n\n            if arg_1.startswith(\"*.\"):\n                # The parsed line start with `*.`.\n\n                # We remove the first two characters.\n                arg_1 = arg_1[2:]\n\n            # We we split the points and we get the last element.\n            # Explanation: The idea behind this action is to\n            # always get the extension.\n            arg_2 = arg_1.split(\".\")[-1]\n\n            if arg_2 in arg_0.public_suffix_db:\n                # The extension is alrady in our database.\n\n                # We update the content of the 1st level TDL with\n                # the content of the suffix.\n                # In between, we format so that we ensure that there is no\n                # duplicate in the database index content.\n                arg_0.public_suffix_db[arg_2] = List(\n                    arg_0.public_suffix_db[arg_2] + [arg_1]\n                ).format()\n            else:\n                # The extension is not already in our database.\n\n                # We append the currently formatted extension and the line content.\n                arg_0.public_suffix_db.update({arg_2: [arg_1]})", "path": "PyFunceble/publicsuffix.py", "identifier": "PublicSuffix._extensions", "docstring": "Extract the extension from the given line.\n\n        :param line: The line from the official public suffix repository.\n        :type line: str", "docstring_tokens": ["Extract", "the", "extension", "from", "the", "given", "line", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 254835}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L237-L279", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Updates the label, the description, and enables or disables the\n        geo-replication status for a storage account in Windows Azure.", "language": "python", "parameters": "(self, service_name, description=None,\n                               label=None, geo_replication_enabled=None,\n                               extended_properties=None,\n                               account_type='Standard_GRS')", "return_statement": "return self._perform_put(\n            self._get_storage_service_path(service_name),\n            _XmlSerializer.update_storage_service_input_to_xml(\n                description,\n                label,\n                account_type,\n                extended_properties))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'Standard_GRS'", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "if", "arg_4", "==", "False", ":", "arg_6", "=", "'Standard_LRS'", "return", "arg_0", ".", "_perform_put", "(", "arg_0", ".", "_get_storage_service_path", "(", "arg_1", ")", ",", "_XmlSerializer", ".", "update_storage_service_input_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_6", ",", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                               arg_3=None, arg_4=None,\n                               arg_5=None,\n                               arg_6='Standard_GRS'):\n        '''\n        Updates the label, the description, and enables or disables the\n        geo-replication status for a storage account in Windows Azure.\n\n        service_name:\n            Name of the storage service account.\n        description:\n            A description for the storage account. The description may be up\n            to 1024 characters in length.\n        label:\n            A name for the storage account. The name may be up to 100\n            characters in length. The name can be used to identify the storage\n            account for your tracking purposes.\n        geo_replication_enabled:\n            Deprecated. Replaced by the account_type parameter.\n        extended_properties:\n            Dictionary containing name/value pairs of storage account\n            properties. You can have a maximum of 50 extended property\n            name/value pairs. The maximum length of the Name element is 64\n            characters, only alphanumeric characters and underscores are valid\n            in the Name, and the name must start with a letter. The value has\n            a maximum length of 255 characters.\n        account_type:\n            Specifies whether the account supports locally-redundant storage,\n            geo-redundant storage, zone-redundant storage, or read access\n            geo-redundant storage.\n            Possible values are:\n                Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS\n        '''\n        _validate_not_none('service_name', arg_1)\n        if arg_4 == False:\n            arg_6 = 'Standard_LRS'\n        return arg_0._perform_put(\n            arg_0._get_storage_service_path(arg_1),\n            _XmlSerializer.update_storage_service_input_to_xml(\n                arg_2,\n                arg_3,\n                arg_6,\n                arg_5))", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.update_storage_account", "docstring": "Updates the label, the description, and enables or disables the\n        geo-replication status for a storage account in Windows Azure.\n\n        service_name:\n            Name of the storage service account.\n        description:\n            A description for the storage account. The description may be up\n            to 1024 characters in length.\n        label:\n            A name for the storage account. The name may be up to 100\n            characters in length. The name can be used to identify the storage\n            account for your tracking purposes.\n        geo_replication_enabled:\n            Deprecated. Replaced by the account_type parameter.\n        extended_properties:\n            Dictionary containing name/value pairs of storage account\n            properties. You can have a maximum of 50 extended property\n            name/value pairs. The maximum length of the Name element is 64\n            characters, only alphanumeric characters and underscores are valid\n            in the Name, and the name must start with a letter. The value has\n            a maximum length of 255 characters.\n        account_type:\n            Specifies whether the account supports locally-redundant storage,\n            geo-redundant storage, zone-redundant storage, or read access\n            geo-redundant storage.\n            Possible values are:\n                Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS", "docstring_tokens": ["Updates", "the", "label", "the", "description", "and", "enables", "or", "disables", "the", "geo", "-", "replication", "status", "for", "a", "storage", "account", "in", "Windows", "Azure", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254836}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L187-L218", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Copy all csvs in nested directroy to single directory.", "language": "python", "parameters": "(in_dir, extension='.csv', out_dir=None)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'.csv'", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "'./'", "+", "re", ".", "search", "(", "'^\\.(.*)'", ",", "arg_1", ")", ".", "groups", "(", "0", ")", "[", "0", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "os", ".", "mkdir", "(", "arg_2", ")", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "os", ".", "walk", "(", "arg_0", ")", ":", "for", "arg_6", "in", "arg_5", ":", "if", "arg_1", "in", "arg_6", ":", "shutil", ".", "copy", "(", "arg_3", "+", "'/'", "+", "arg_6", ",", "arg_2", "+", "'/'", "+", "arg_6", ")", "return"], "function": "def Func(arg_0, arg_1='.csv', arg_2=None):\n    \"\"\"\n    Copy all csvs in nested directroy to single directory.\n\n    Function to copy all csvs from a directory, and place\n    them in a new directory.\n\n    Parameters\n    ----------\n    in_dir : str\n        Input directory containing csv files in subfolders\n    extension : str\n        The extension that identifies your data files.\n        Defaults to '.csv'.\n    out_dir : str\n        Destination directory\n\n    Returns\n    -------\n    None\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = './' + re.search('^\\.(.*)', arg_1).groups(0)[0]\n\n    if not os.path.isdir(arg_2):\n        os.mkdir(arg_2)\n\n    for arg_3, arg_4, arg_5 in os.walk(arg_0):\n        for arg_6 in arg_5:\n            if arg_1 in arg_6:\n                shutil.copy(arg_3 + '/' + arg_6, arg_2 + '/' + arg_6)\n    return", "path": "latools/helpers/helpers.py", "identifier": "collate_data", "docstring": "Copy all csvs in nested directroy to single directory.\n\n    Function to copy all csvs from a directory, and place\n    them in a new directory.\n\n    Parameters\n    ----------\n    in_dir : str\n        Input directory containing csv files in subfolders\n    extension : str\n        The extension that identifies your data files.\n        Defaults to '.csv'.\n    out_dir : str\n        Destination directory\n\n    Returns\n    -------\n    None", "docstring_tokens": ["Copy", "all", "csvs", "in", "nested", "directroy", "to", "single", "directory", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 254837}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/loader.py#L450-L525", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Parse the configuration and generate the Config object.", "language": "python", "parameters": "(self, argv=None, aliases=None, flags=None)", "return_statement": "return self.config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "from", "IPython", ".", "config", ".", "configurable", "import", "Configurable", "arg_0", ".", "clear", "(", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "argv", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "aliases", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "flags", "arg_4", "=", "arg_0", ".", "_decode_argv", "(", "arg_1", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ")", ":", "arg_7", "=", "arg_6", ".", "lstrip", "(", "'-'", ")", "if", "arg_6", "==", "'--'", ":", "arg_0", ".", "extra_args", ".", "extend", "(", "arg_4", "[", "arg_5", "+", "1", ":", "]", ")", "break", "if", "kv_pattern", ".", "match", "(", "arg_6", ")", ":", "arg_8", ",", "arg_9", "=", "arg_7", ".", "split", "(", "'='", ",", "1", ")", "if", "arg_8", "in", "arg_2", ":", "arg_8", "=", "arg_2", "[", "arg_8", "]", "if", "'.'", "not", "in", "arg_8", ":", "warn", ".", "warn", "(", "\"Unrecognized alias: '%s', it will probably have no effect.\"", "%", "arg_8", ")", "try", ":", "arg_0", ".", "_exec_config_str", "(", "arg_8", ",", "arg_9", ")", "except", "Exception", ":", "raise", "ArgumentError", "(", "\"Invalid argument: '%s'\"", "%", "arg_6", ")", "elif", "flag_pattern", ".", "match", "(", "arg_6", ")", ":", "if", "arg_7", "in", "arg_3", ":", "arg_10", ",", "arg_11", "=", "arg_3", "[", "arg_7", "]", "arg_0", ".", "_load_flag", "(", "arg_10", ")", "else", ":", "raise", "ArgumentError", "(", "\"Unrecognized flag: '%s'\"", "%", "arg_6", ")", "elif", "arg_6", ".", "startswith", "(", "'-'", ")", ":", "arg_12", "=", "'--'", "+", "arg_7", "if", "kv_pattern", ".", "match", "(", "arg_12", ")", ":", "raise", "ArgumentError", "(", "\"Invalid argument: '%s', did you mean '%s'?\"", "%", "(", "arg_6", ",", "arg_12", ")", ")", "else", ":", "raise", "ArgumentError", "(", "\"Invalid argument: '%s'\"", "%", "arg_6", ")", "else", ":", "arg_0", ".", "extra_args", ".", "append", "(", "arg_7", ")", "return", "arg_0", ".", "config"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Parse the configuration and generate the Config object.\n\n        After loading, any arguments that are not key-value or\n        flags will be stored in self.extra_args - a list of\n        unparsed command-line arguments.  This is used for\n        arguments such as input files or subcommands.\n\n        Parameters\n        ----------\n        argv : list, optional\n            A list that has the form of sys.argv[1:] which has unicode\n            elements of the form u\"key=value\". If this is None (default),\n            then self.argv will be used.\n        aliases : dict\n            A dict of aliases for configurable traits.\n            Keys are the short aliases, Values are the resolved trait.\n            Of the form: `{'alias' : 'Configurable.trait'}`\n        flags : dict\n            A dict of flags, keyed by str name. Values can be Config objects\n            or dicts.  When the flag is triggered, The config is loaded as\n            `self.config.update(cfg)`.\n        \"\"\"\n        from IPython.config.configurable import Configurable\n\n        arg_0.clear()\n        if arg_1 is None:\n            arg_1 = arg_0.argv\n        if arg_2 is None:\n            arg_2 = arg_0.aliases\n        if arg_3 is None:\n            arg_3 = arg_0.flags\n\n        # ensure argv is a list of unicode strings:\n        arg_4 = arg_0._decode_argv(arg_1)\n        for arg_5,arg_6 in enumerate(arg_4):\n            # strip leading '-'\n            arg_7 = arg_6.lstrip('-')\n\n            if arg_6 == '--':\n                # don't parse arguments after '--'\n                # this is useful for relaying arguments to scripts, e.g.\n                # ipython -i foo.py --pylab=qt -- args after '--' go-to-foo.py\n                arg_0.extra_args.extend(arg_4[arg_5+1:])\n                break\n\n            if kv_pattern.match(arg_6):\n                arg_8,arg_9 = arg_7.split('=',1)\n                # Substitute longnames for aliases.\n                if arg_8 in arg_2:\n                    arg_8 = arg_2[arg_8]\n                if '.' not in arg_8:\n                    # probably a mistyped alias, but not technically illegal\n                    warn.warn(\"Unrecognized alias: '%s', it will probably have no effect.\"%arg_8)\n                try:\n                    arg_0._exec_config_str(arg_8, arg_9)\n                except Exception:\n                    raise ArgumentError(\"Invalid argument: '%s'\" % arg_6)\n\n            elif flag_pattern.match(arg_6):\n                if arg_7 in arg_3:\n                    arg_10,arg_11 = arg_3[arg_7]\n                    arg_0._load_flag(arg_10)\n                else:\n                    raise ArgumentError(\"Unrecognized flag: '%s'\"%arg_6)\n            elif arg_6.startswith('-'):\n                arg_12 = '--'+arg_7\n                if kv_pattern.match(arg_12):\n                    raise ArgumentError(\"Invalid argument: '%s', did you mean '%s'?\"%(arg_6, arg_12))\n                else:\n                    raise ArgumentError(\"Invalid argument: '%s'\"%arg_6)\n            else:\n                # keep all args that aren't valid in a list,\n                # in case our parent knows what to do with them.\n                arg_0.extra_args.append(arg_7)\n        return arg_0.config", "path": "environment/lib/python2.7/site-packages/IPython/config/loader.py", "identifier": "KeyValueConfigLoader.load_config", "docstring": "Parse the configuration and generate the Config object.\n\n        After loading, any arguments that are not key-value or\n        flags will be stored in self.extra_args - a list of\n        unparsed command-line arguments.  This is used for\n        arguments such as input files or subcommands.\n\n        Parameters\n        ----------\n        argv : list, optional\n            A list that has the form of sys.argv[1:] which has unicode\n            elements of the form u\"key=value\". If this is None (default),\n            then self.argv will be used.\n        aliases : dict\n            A dict of aliases for configurable traits.\n            Keys are the short aliases, Values are the resolved trait.\n            Of the form: `{'alias' : 'Configurable.trait'}`\n        flags : dict\n            A dict of flags, keyed by str name. Values can be Config objects\n            or dicts.  When the flag is triggered, The config is loaded as\n            `self.config.update(cfg)`.", "docstring_tokens": ["Parse", "the", "configuration", "and", "generate", "the", "Config", "object", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254838}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L672-L680", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Action on renewing on RENEWING state.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "client", ".", "lease", ".", "sanitize_net_values", "(", ")", "arg_0", ".", "client", ".", "lease", ".", "set_times", "(", "arg_0", ".", "time_sent_request", ")", "arg_0", ".", "set_timers", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Action on renewing on RENEWING state.\n\n        Not recording lease, but restarting timers.\n\n        \"\"\"\n        arg_0.client.lease.sanitize_net_values()\n        arg_0.client.lease.set_times(arg_0.time_sent_request)\n        arg_0.set_timers()", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.on_renewing", "docstring": "Action on renewing on RENEWING state.\n\n        Not recording lease, but restarting timers.", "docstring_tokens": ["Action", "on", "renewing", "on", "RENEWING", "state", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 254839}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/S3_hook.py#L72-L90", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates an Amazon S3 bucket.", "language": "python", "parameters": "(self, bucket_name, region_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "get_conn", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "arg_3", ".", "meta", ".", "region_name", "if", "arg_2", "==", "'us-east-1'", ":", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "Bucket", "=", "arg_1", ")", "else", ":", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "Bucket", "=", "arg_1", ",", "CreateBucketConfiguration", "=", "{", "'LocationConstraint'", ":", "arg_2", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Creates an Amazon S3 bucket.\n\n        :param bucket_name: The name of the bucket\n        :type bucket_name: str\n        :param region_name: The name of the aws region in which to create the bucket.\n        :type region_name: str\n        \"\"\"\n        arg_3 = arg_0.get_conn()\n        if not arg_2:\n            arg_2 = arg_3.meta.region_name\n        if arg_2 == 'us-east-1':\n            arg_0.get_conn().Func(Bucket=arg_1)\n        else:\n            arg_0.get_conn().Func(Bucket=arg_1,\n                                          CreateBucketConfiguration={\n                                              'LocationConstraint': arg_2\n                                          })", "path": "airflow/hooks/S3_hook.py", "identifier": "S3Hook.create_bucket", "docstring": "Creates an Amazon S3 bucket.\n\n        :param bucket_name: The name of the bucket\n        :type bucket_name: str\n        :param region_name: The name of the aws region in which to create the bucket.\n        :type region_name: str", "docstring_tokens": ["Creates", "an", "Amazon", "S3", "bucket", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254840}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/gcp_vision_operator.py#L1221-L1244", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates additional_properties parameter based on language_hints, web_detection_params and\n    additional_properties parameters specified by the user", "language": "python", "parameters": "(additional_properties, language_hints, web_detection_params)", "return_statement": "return merged_additional_parameters", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "return", "arg_0", "if", "arg_0", "is", "None", ":", "return", "{", "}", "arg_3", "=", "deepcopy", "(", "arg_0", ")", "if", "'image_context'", "not", "in", "arg_3", ":", "arg_3", "[", "'image_context'", "]", "=", "{", "}", "arg_3", "[", "'image_context'", "]", "[", "'language_hints'", "]", "=", "arg_3", "[", "'image_context'", "]", ".", "get", "(", "'language_hints'", ",", "arg_1", ")", "arg_3", "[", "'image_context'", "]", "[", "'web_detection_params'", "]", "=", "arg_3", "[", "'image_context'", "]", ".", "get", "(", "'web_detection_params'", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Creates additional_properties parameter based on language_hints, web_detection_params and\n    additional_properties parameters specified by the user\n    \"\"\"\n    if arg_1 is None and arg_2 is None:\n        return arg_0\n\n    if arg_0 is None:\n        return {}\n\n    arg_3 = deepcopy(arg_0)\n\n    if 'image_context' not in arg_3:\n        arg_3['image_context'] = {}\n\n    arg_3['image_context']['language_hints'] = arg_3[\n        'image_context'\n    ].get('language_hints', arg_1)\n    arg_3['image_context']['web_detection_params'] = arg_3[\n        'image_context'\n    ].get('web_detection_params', arg_2)\n\n    return arg_3", "path": "airflow/contrib/operators/gcp_vision_operator.py", "identifier": "prepare_additional_parameters", "docstring": "Creates additional_properties parameter based on language_hints, web_detection_params and\n    additional_properties parameters specified by the user", "docstring_tokens": ["Creates", "additional_properties", "parameter", "based", "on", "language_hints", "web_detection_params", "and", "additional_properties", "parameters", "specified", "by", "the", "user"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254841}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/text.py#L67-L88", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Find the best segmentation of the string of characters, given the\n    UnigramTextModel P.", "language": "python", "parameters": "(text, P)", "return_statement": "return sequence, best[-1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_0", ")", "arg_3", "=", "[", "''", "]", "+", "list", "(", "arg_0", ")", "arg_4", "=", "[", "1.0", "]", "+", "[", "0.0", "]", "*", "arg_2", "for", "arg_5", "in", "range", "(", "arg_2", "+", "1", ")", ":", "for", "arg_6", "in", "range", "(", "0", ",", "arg_5", ")", ":", "arg_7", "=", "arg_0", "[", "arg_6", ":", "arg_5", "]", "if", "arg_1", "[", "arg_7", "]", "*", "arg_4", "[", "arg_5", "-", "len", "(", "arg_7", ")", "]", ">=", "arg_4", "[", "arg_5", "]", ":", "arg_4", "[", "arg_5", "]", "=", "arg_1", "[", "arg_7", "]", "*", "arg_4", "[", "arg_5", "-", "len", "(", "arg_7", ")", "]", "arg_3", "[", "arg_5", "]", "=", "arg_7", "arg_8", "=", "[", "]", "arg_5", "=", "len", "(", "arg_3", ")", "-", "1", "while", "arg_5", ">", "0", ":", "arg_8", "[", "0", ":", "0", "]", "=", "[", "arg_3", "[", "arg_5", "]", "]", "arg_5", "=", "arg_5", "-", "len", "(", "arg_3", "[", "arg_5", "]", ")", "return", "arg_8", ",", "arg_4", "[", "-", "1", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Find the best segmentation of the string of characters, given the\n    UnigramTextModel P.\"\"\"\n    # best[i] = best probability for text[0:i]\n    # words[i] = best word ending at position i\n    arg_2 = len(arg_0)\n    arg_3 = [''] + list(arg_0)\n    arg_4 = [1.0] + [0.0] * arg_2\n    ## Fill in the vectors best, words via dynamic programming\n    for arg_5 in range(arg_2+1):\n        for arg_6 in range(0, arg_5):\n            arg_7 = arg_0[arg_6:arg_5]\n            if arg_1[arg_7] * arg_4[arg_5 - len(arg_7)] >= arg_4[arg_5]:\n                arg_4[arg_5] = arg_1[arg_7] * arg_4[arg_5 - len(arg_7)]\n                arg_3[arg_5] = arg_7\n    ## Now recover the sequence of best words\n    arg_8 = []; arg_5 = len(arg_3)-1\n    while arg_5 > 0:\n        arg_8[0:0] = [arg_3[arg_5]]\n        arg_5 = arg_5 - len(arg_3[arg_5])\n    ## Return sequence of best words and overall probability\n    return arg_8, arg_4[-1]", "path": "aima/text.py", "identifier": "viterbi_segment", "docstring": "Find the best segmentation of the string of characters, given the\n    UnigramTextModel P.", "docstring_tokens": ["Find", "the", "best", "segmentation", "of", "the", "string", "of", "characters", "given", "the", "UnigramTextModel", "P", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 254842}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L265-L279", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Print the status of newly finished jobs.", "language": "python", "parameters": "(self)", "return_statement": "return new_comp or new_dead", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_update_status", "(", ")", "arg_1", "=", "arg_0", ".", "_group_report", "(", "arg_0", ".", "_comp_report", ",", "'Completed'", ")", "arg_2", "=", "arg_0", ".", "_group_report", "(", "arg_0", ".", "_dead_report", ",", "'Dead, call jobs.traceback() for details'", ")", "arg_0", ".", "_comp_report", "[", ":", "]", "=", "[", "]", "arg_0", ".", "_dead_report", "[", ":", "]", "=", "[", "]", "return", "arg_1", "or", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Print the status of newly finished jobs.\n\n        Return True if any new jobs are reported.\n\n        This call resets its own state every time, so it only reports jobs\n        which have finished since the last time it was called.\"\"\"\n\n        arg_0._update_status()\n        arg_1 = arg_0._group_report(arg_0._comp_report, 'Completed')\n        arg_2 = arg_0._group_report(arg_0._dead_report,\n                                      'Dead, call jobs.traceback() for details')\n        arg_0._comp_report[:] = []\n        arg_0._dead_report[:] = []\n        return arg_1 or arg_2", "path": "environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py", "identifier": "BackgroundJobManager._status_new", "docstring": "Print the status of newly finished jobs.\n\n        Return True if any new jobs are reported.\n\n        This call resets its own state every time, so it only reports jobs\n        which have finished since the last time it was called.", "docstring_tokens": ["Print", "the", "status", "of", "newly", "finished", "jobs", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254843}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/base_operator.py#L139-L143", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return tuple of output dimension for specified subsystems.", "language": "python", "parameters": "(self, qargs=None)", "return_statement": "return tuple(self._output_dims[i] for i in qargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "return", "arg_0", ".", "_Func", "return", "tuple", "(", "arg_0", ".", "_Func", "[", "arg_2", "]", "for", "arg_2", "in", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Return tuple of output dimension for specified subsystems.\"\"\"\n        if arg_1 is None:\n            return arg_0._Func\n        return tuple(arg_0._Func[arg_2] for arg_2 in arg_1)", "path": "qiskit/quantum_info/operators/base_operator.py", "identifier": "BaseOperator.output_dims", "docstring": "Return tuple of output dimension for specified subsystems.", "docstring_tokens": ["Return", "tuple", "of", "output", "dimension", "for", "specified", "subsystems", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254844}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/meta.py#L3894-L3986", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augmenter that runs an assert on each batch of input images\n    using a lambda function as condition.", "language": "python", "parameters": "(func_images=None, func_heatmaps=None, func_keypoints=None,\n                 func_polygons=None, name=None, deterministic=False,\n                 random_state=None)", "return_statement": "return Lambda(func_images_assert if func_images is not None else None,\n                  func_heatmaps_assert if func_heatmaps is not None else None,\n                  func_keypoints_assert if func_keypoints is not None else None,\n                  func_polygons_assert if func_polygons is not None else None,\n                  name=name, deterministic=deterministic, random_state=random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ")", ":", "def", "func_images_assert", "(", "arg_7", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ":", "ia", ".", "do_assert", "(", "arg_0", "(", "arg_7", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ",", "\"Input images did not fulfill user-defined assertion in Func.\"", ")", "return", "arg_7", "def", "func_heatmaps_assert", "(", "arg_10", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ":", "ia", ".", "do_assert", "(", "arg_1", "(", "arg_10", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ",", "\"Input heatmaps did not fulfill user-defined assertion in Func.\"", ")", "return", "arg_10", "def", "func_keypoints_assert", "(", "arg_11", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ":", "ia", ".", "do_assert", "(", "arg_2", "(", "arg_11", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ",", "\"Input keypoints did not fulfill user-defined assertion in Func.\"", ")", "return", "arg_11", "def", "func_polygons_assert", "(", "arg_12", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ":", "ia", ".", "do_assert", "(", "arg_3", "(", "arg_12", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")", ",", "\"Input polygons did not fulfill user-defined assertion in Func.\"", ")", "return", "arg_12", "if", "arg_4", "is", "None", ":", "arg_4", "=", "\"Unnamed%s\"", "%", "(", "ia", ".", "caller_name", "(", ")", ",", ")", "return", "Lambda", "(", "func_images_assert", "if", "arg_0", "is", "not", "None", "else", "None", ",", "func_heatmaps_assert", "if", "arg_1", "is", "not", "None", "else", "None", ",", "func_keypoints_assert", "if", "arg_2", "is", "not", "None", "else", "None", ",", "func_polygons_assert", "if", "arg_3", "is", "not", "None", "else", "None", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None,\n                 arg_3=None, arg_4=None, arg_5=False,\n                 arg_6=None):\n    \"\"\"\n    Augmenter that runs an assert on each batch of input images\n    using a lambda function as condition.\n\n    This is useful to make generic assumption about the input images and error\n    out early if they aren't met.\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: yes; tested\n        * ``uint32``: yes; tested\n        * ``uint64``: yes; tested\n        * ``int8``: yes; tested\n        * ``int16``: yes; tested\n        * ``int32``: yes; tested\n        * ``int64``: yes; tested\n        * ``float16``: yes; tested\n        * ``float32``: yes; tested\n        * ``float64``: yes; tested\n        * ``float128``: yes; tested\n        * ``bool``: yes; tested\n\n    Parameters\n    ----------\n    func_images : None or callable, optional\n        The function to call for each batch of images.\n        It must follow the form ``function(images, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_images`.\n\n    func_heatmaps : None or callable, optional\n        The function to call for each batch of heatmaps.\n        It must follow the form ``function(heatmaps, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_heatmaps`.\n\n    func_keypoints : None or callable, optional\n        The function to call for each batch of keypoints.\n        It must follow the form ``function(keypoints_on_images, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_keypoints`.\n\n    func_polygons : None or callable, optional\n        The function to call for each batch of polygons.\n        It must follow the form ``function(polygons_on_images, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_polygons`.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    \"\"\"\n    def func_images_assert(arg_7, arg_6, arg_8, arg_9):\n        ia.do_assert(arg_0(arg_7, arg_6, arg_8, arg_9),\n                     \"Input images did not fulfill user-defined assertion in Func.\")\n        return arg_7\n\n    def func_heatmaps_assert(arg_10, arg_6, arg_8, arg_9):\n        ia.do_assert(arg_1(arg_10, arg_6, arg_8, arg_9),\n                     \"Input heatmaps did not fulfill user-defined assertion in Func.\")\n        return arg_10\n\n    def func_keypoints_assert(arg_11, arg_6, arg_8, arg_9):\n        ia.do_assert(arg_2(arg_11, arg_6, arg_8, arg_9),\n                     \"Input keypoints did not fulfill user-defined assertion in Func.\")\n        return arg_11\n\n    def func_polygons_assert(arg_12, arg_6, arg_8, arg_9):\n        ia.do_assert(arg_3(arg_12, arg_6, arg_8, arg_9),\n                     \"Input polygons did not fulfill user-defined assertion in Func.\")\n        return arg_12\n\n    if arg_4 is None:\n        arg_4 = \"Unnamed%s\" % (ia.caller_name(),)\n    return Lambda(func_images_assert if arg_0 is not None else None,\n                  func_heatmaps_assert if arg_1 is not None else None,\n                  func_keypoints_assert if arg_2 is not None else None,\n                  func_polygons_assert if arg_3 is not None else None,\n                  arg_4=arg_4, arg_5=arg_5, arg_6=arg_6)", "path": "imgaug/augmenters/meta.py", "identifier": "AssertLambda", "docstring": "Augmenter that runs an assert on each batch of input images\n    using a lambda function as condition.\n\n    This is useful to make generic assumption about the input images and error\n    out early if they aren't met.\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: yes; tested\n        * ``uint32``: yes; tested\n        * ``uint64``: yes; tested\n        * ``int8``: yes; tested\n        * ``int16``: yes; tested\n        * ``int32``: yes; tested\n        * ``int64``: yes; tested\n        * ``float16``: yes; tested\n        * ``float32``: yes; tested\n        * ``float64``: yes; tested\n        * ``float128``: yes; tested\n        * ``bool``: yes; tested\n\n    Parameters\n    ----------\n    func_images : None or callable, optional\n        The function to call for each batch of images.\n        It must follow the form ``function(images, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_images`.\n\n    func_heatmaps : None or callable, optional\n        The function to call for each batch of heatmaps.\n        It must follow the form ``function(heatmaps, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_heatmaps`.\n\n    func_keypoints : None or callable, optional\n        The function to call for each batch of keypoints.\n        It must follow the form ``function(keypoints_on_images, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_keypoints`.\n\n    func_polygons : None or callable, optional\n        The function to call for each batch of polygons.\n        It must follow the form ``function(polygons_on_images, random_state, parents, hooks)``\n        and return either True (valid input) or False (invalid input).\n        It essentially reuses the interface of\n        :func:`imgaug.augmenters.meta.Augmenter._augment_polygons`.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.", "docstring_tokens": ["Augmenter", "that", "runs", "an", "assert", "on", "each", "batch", "of", "input", "images", "using", "a", "lambda", "function", "as", "condition", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254845}
{"url": "https://github.com/sam-washington/requests-aws4auth/blob/1201e470c6d5847b7fe42e937a55755e1895e72c/requests_aws4auth/aws4auth.py#L454-L466", "sha": "1201e470c6d5847b7fe42e937a55755e1895e72c", "docstring_summary": "Handle a request whose date doesn't match the signing key scope date.", "language": "python", "parameters": "(self, req)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_request_date", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "strftime", "(", "'%Y%m%d'", ")", "arg_0", ".", "regenerate_signing_key", "(", "date", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Handle a request whose date doesn't match the signing key scope date.\n\n        This AWS4Auth class implementation regenerates the signing key. See\n        StrictAWS4Auth class if you would prefer an exception to be raised.\n\n        req -- a requests prepared request object\n\n        \"\"\"\n        arg_2 = arg_0.get_request_date(arg_1)\n        arg_3 = arg_2.strftime('%Y%m%d')\n        arg_0.regenerate_signing_key(date=arg_3)", "path": "requests_aws4auth/aws4auth.py", "identifier": "AWS4Auth.handle_date_mismatch", "docstring": "Handle a request whose date doesn't match the signing key scope date.\n\n        This AWS4Auth class implementation regenerates the signing key. See\n        StrictAWS4Auth class if you would prefer an exception to be raised.\n\n        req -- a requests prepared request object", "docstring_tokens": ["Handle", "a", "request", "whose", "date", "doesn", "t", "match", "the", "signing", "key", "scope", "date", "."], "nwo": "sam-washington/requests-aws4auth", "score": 0.36091303233896527, "idx": 254846}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-servermanager/azure/mgmt/servermanager/operations/session_operations.py#L94-L163", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates a session for a node.", "language": "python", "parameters": "(\n            self, resource_group_name, node_name, session, user_name=None, password=None, retention_period=None, credential_data_format=None, encryption_certificate_thumbprint=None, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "arg_11", "=", "True", ",", "**", "arg_12", ")", ":", "arg_13", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "True", ",", "**", "arg_12", ")", "def", "get_long_running_output", "(", "arg_14", ")", ":", "arg_15", "=", "arg_0", ".", "_deserialize", "(", "'SessionResource'", ",", "arg_14", ")", "if", "arg_10", ":", "arg_16", "=", "ClientRawResponse", "(", "arg_15", ",", "arg_14", ")", "return", "arg_16", "return", "arg_15", "arg_17", "=", "arg_12", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_11", "is", "True", ":", "arg_18", "=", "ARMPolling", "(", "arg_17", ",", "**", "arg_12", ")", "elif", "arg_11", "is", "False", ":", "arg_18", "=", "NoPolling", "(", ")", "else", ":", "arg_18", "=", "arg_11", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_13", ",", "get_long_running_output", ",", "arg_18", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=False, arg_11=True, **arg_12):\n        \"\"\"Creates a session for a node.\n\n        :param resource_group_name: The resource group name uniquely\n         identifies the resource group within the user subscriptionId.\n        :type resource_group_name: str\n        :param node_name: The node name (256 characters maximum).\n        :type node_name: str\n        :param session: The sessionId from the user.\n        :type session: str\n        :param user_name: Encrypted User name to be used to connect to node.\n        :type user_name: str\n        :param password: Encrypted Password associated with user name.\n        :type password: str\n        :param retention_period: Session retention period. Possible values\n         include: 'Session', 'Persistent'\n        :type retention_period: str or\n         ~azure.mgmt.servermanager.models.RetentionPeriod\n        :param credential_data_format: Credential data format. Possible values\n         include: 'RsaEncrypted'\n        :type credential_data_format: str or\n         ~azure.mgmt.servermanager.models.CredentialDataFormat\n        :param encryption_certificate_thumbprint: Encryption certificate\n         thumbprint.\n        :type encryption_certificate_thumbprint: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns SessionResource or\n         ClientRawResponse<SessionResource> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servermanager.models.SessionResource]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servermanager.models.SessionResource]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.servermanager.models.ErrorException>`\n        \"\"\"\n        arg_13 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_6=arg_6,\n            arg_7=arg_7,\n            arg_8=arg_8,\n            arg_9=arg_9,\n            arg_10=True,\n            **arg_12\n        )\n\n        def get_long_running_output(arg_14):\n            arg_15 = arg_0._deserialize('SessionResource', arg_14)\n\n            if arg_10:\n                arg_16 = ClientRawResponse(arg_15, arg_14)\n                return arg_16\n\n            return arg_15\n\n        arg_17 = arg_12.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_11 is True: arg_18 = ARMPolling(arg_17, **arg_12)\n        elif arg_11 is False: arg_18 = NoPolling()\n        else: arg_18 = arg_11\n        return LROPoller(arg_0._client, arg_13, get_long_running_output, arg_18)", "path": "azure-mgmt-servermanager/azure/mgmt/servermanager/operations/session_operations.py", "identifier": "SessionOperations.create", "docstring": "Creates a session for a node.\n\n        :param resource_group_name: The resource group name uniquely\n         identifies the resource group within the user subscriptionId.\n        :type resource_group_name: str\n        :param node_name: The node name (256 characters maximum).\n        :type node_name: str\n        :param session: The sessionId from the user.\n        :type session: str\n        :param user_name: Encrypted User name to be used to connect to node.\n        :type user_name: str\n        :param password: Encrypted Password associated with user name.\n        :type password: str\n        :param retention_period: Session retention period. Possible values\n         include: 'Session', 'Persistent'\n        :type retention_period: str or\n         ~azure.mgmt.servermanager.models.RetentionPeriod\n        :param credential_data_format: Credential data format. Possible values\n         include: 'RsaEncrypted'\n        :type credential_data_format: str or\n         ~azure.mgmt.servermanager.models.CredentialDataFormat\n        :param encryption_certificate_thumbprint: Encryption certificate\n         thumbprint.\n        :type encryption_certificate_thumbprint: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns SessionResource or\n         ClientRawResponse<SessionResource> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servermanager.models.SessionResource]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servermanager.models.SessionResource]]\n        :raises:\n         :class:`ErrorException<azure.mgmt.servermanager.models.ErrorException>`", "docstring_tokens": ["Creates", "a", "session", "for", "a", "node", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254847}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/kps.py#L252-L315", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Generate nearby points to this keypoint based on manhattan distance.", "language": "python", "parameters": "(self, nb_steps, step_size, return_array=False)", "return_statement": "return [self.deepcopy(x=points[i, 0], y=points[i, 1]) for i in sm.xrange(points.shape[0])]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "np", ".", "zeros", "(", "(", "arg_1", "+", "1", "+", "arg_1", "+", "2", "*", "(", "arg_1", "**", "2", ")", ",", "2", ")", ",", "dtype", "=", "np", ".", "float32", ")", "arg_5", "=", "np", ".", "linspace", "(", "arg_0", ".", "y", "-", "arg_1", "*", "arg_2", ",", "arg_0", ".", "y", "+", "arg_1", "*", "arg_2", ",", "arg_1", "+", "1", "+", "arg_1", ")", "arg_6", "=", "1", "arg_7", "=", "0", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_5", ")", ":", "if", "arg_6", "==", "1", ":", "arg_10", "=", "[", "arg_0", ".", "x", "]", "else", ":", "arg_10", "=", "np", ".", "linspace", "(", "arg_0", ".", "x", "-", "(", "arg_6", "-", "1", ")", "//", "2", "*", "arg_2", ",", "arg_0", ".", "x", "+", "(", "arg_6", "-", "1", ")", "//", "2", "*", "arg_2", ",", "arg_6", ")", "for", "arg_11", "in", "arg_10", ":", "arg_4", "[", "arg_7", "]", "=", "[", "arg_11", ",", "arg_9", "]", "arg_7", "+=", "1", "if", "arg_8", "<", "arg_1", ":", "arg_6", "+=", "2", "else", ":", "arg_6", "-=", "2", "if", "arg_3", ":", "return", "arg_4", "return", "[", "arg_0", ".", "deepcopy", "(", "arg_11", "=", "arg_4", "[", "arg_12", ",", "0", "]", ",", "arg_9", "=", "arg_4", "[", "arg_12", ",", "1", "]", ")", "for", "arg_12", "in", "sm", ".", "xrange", "(", "arg_4", ".", "shape", "[", "0", "]", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"\n        Generate nearby points to this keypoint based on manhattan distance.\n\n        To generate the first neighbouring points, a distance of S (step size) is moved from the\n        center point (this keypoint) to the top, right, bottom and left, resulting in four new\n        points. From these new points, the pattern is repeated. Overlapping points are ignored.\n\n        The resulting points have a shape similar to a square rotated by 45 degrees.\n\n        Parameters\n        ----------\n        nb_steps : int\n            The number of steps to move from the center point. nb_steps=1 results in a total of\n            5 output points (1 center point + 4 neighbours).\n\n        step_size : number\n            The step size to move from every point to its neighbours.\n\n        return_array : bool, optional\n            Whether to return the generated points as a list of keypoints or an array\n            of shape ``(N,2)``, where ``N`` is the number of generated points and the second axis contains\n            the x- (first value) and y- (second value) coordinates.\n\n        Returns\n        -------\n        points : list of imgaug.Keypoint or (N,2) ndarray\n            If return_array was False, then a list of Keypoint.\n            Otherwise a numpy array of shape ``(N,2)``, where ``N`` is the number of generated points and\n            the second axis contains the x- (first value) and y- (second value) coordinates.\n            The center keypoint (the one on which this function was called) is always included.\n\n        \"\"\"\n        # TODO add test\n        # Points generates in manhattan style with S steps have a shape similar to a 45deg rotated\n        # square. The center line with the origin point has S+1+S = 1+2*S points (S to the left,\n        # S to the right). The lines above contain (S+1+S)-2 + (S+1+S)-2-2 + ... + 1 points. E.g.\n        # for S=2 it would be 3+1=4 and for S=3 it would be 5+3+1=9. Same for the lines below the\n        # center. Hence the total number of points is S+1+S + 2*(S^2).\n        arg_4 = np.zeros((arg_1 + 1 + arg_1 + 2*(arg_1**2), 2), dtype=np.float32)\n\n        # we start at the bottom-most line and move towards the top-most line\n        arg_5 = np.linspace(arg_0.y - arg_1 * arg_2, arg_0.y + arg_1 * arg_2, arg_1 + 1 + arg_1)\n\n        # bottom-most line contains only one point\n        arg_6 = 1\n\n        arg_7 = 0\n        for arg_8, arg_9 in enumerate(arg_5):\n            if arg_6 == 1:\n                arg_10 = [arg_0.x]\n            else:\n                arg_10 = np.linspace(arg_0.x - (arg_6-1)//2 * arg_2, arg_0.x + (arg_6-1)//2 * arg_2, arg_6)\n            for arg_11 in arg_10:\n                arg_4[arg_7] = [arg_11, arg_9]\n                arg_7 += 1\n            if arg_8 < arg_1:\n                arg_6 += 2\n            else:\n                arg_6 -= 2\n\n        if arg_3:\n            return arg_4\n        return [arg_0.deepcopy(arg_11=arg_4[arg_12, 0], arg_9=arg_4[arg_12, 1]) for arg_12 in sm.xrange(arg_4.shape[0])]", "path": "imgaug/augmentables/kps.py", "identifier": "Keypoint.generate_similar_points_manhattan", "docstring": "Generate nearby points to this keypoint based on manhattan distance.\n\n        To generate the first neighbouring points, a distance of S (step size) is moved from the\n        center point (this keypoint) to the top, right, bottom and left, resulting in four new\n        points. From these new points, the pattern is repeated. Overlapping points are ignored.\n\n        The resulting points have a shape similar to a square rotated by 45 degrees.\n\n        Parameters\n        ----------\n        nb_steps : int\n            The number of steps to move from the center point. nb_steps=1 results in a total of\n            5 output points (1 center point + 4 neighbours).\n\n        step_size : number\n            The step size to move from every point to its neighbours.\n\n        return_array : bool, optional\n            Whether to return the generated points as a list of keypoints or an array\n            of shape ``(N,2)``, where ``N`` is the number of generated points and the second axis contains\n            the x- (first value) and y- (second value) coordinates.\n\n        Returns\n        -------\n        points : list of imgaug.Keypoint or (N,2) ndarray\n            If return_array was False, then a list of Keypoint.\n            Otherwise a numpy array of shape ``(N,2)``, where ``N`` is the number of generated points and\n            the second axis contains the x- (first value) and y- (second value) coordinates.\n            The center keypoint (the one on which this function was called) is always included.", "docstring_tokens": ["Generate", "nearby", "points", "to", "this", "keypoint", "based", "on", "manhattan", "distance", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254848}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L891-L902", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if the node is in a TryExcept which handles the given exception.", "language": "python", "parameters": "(\n    node: astroid.node_classes.NodeNG, exception=Exception\n)", "return_statement": "return any(managing_handlers)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "node_classes", ".", "NodeNG", ",", "arg_4", "=", "arg_5", ")", "->", "bool", ":", "arg_6", "=", "get_exception_handlers", "(", "arg_0", ",", "arg_4", ")", "if", "not", "arg_6", ":", "return", "False", "return", "any", "(", "arg_6", ")"], "function": "def Func(\n    arg_0: arg_1.node_classes.NodeNG, arg_4=arg_5\n) -> bool:\n    \"\"\"Check if the node is in a TryExcept which handles the given exception.\n\n    If the exception is not given, the function is going to look for bare\n    excepts.\n    \"\"\"\n    arg_6 = get_exception_handlers(arg_0, arg_4)\n    if not arg_6:\n        return False\n    return any(arg_6)", "path": "pylint/checkers/utils.py", "identifier": "node_ignores_exception", "docstring": "Check if the node is in a TryExcept which handles the given exception.\n\n    If the exception is not given, the function is going to look for bare\n    excepts.", "docstring_tokens": ["Check", "if", "the", "node", "is", "in", "a", "TryExcept", "which", "handles", "the", "given", "exception", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254849}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5626-L5650", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Fill up the include_dict with new includes found from the file.", "language": "python", "parameters": "(filename, include_dict, io=codecs)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "arg_4", "=", "None", "try", ":", "arg_4", "=", "arg_2", ".", "open", "(", "arg_0", ",", "'r'", ",", "'utf8'", ",", "'replace'", ")", "except", "IOError", ":", "return", "False", "arg_5", "=", "0", "for", "arg_6", "in", "arg_4", ":", "arg_5", "+=", "1", "arg_7", "=", "CleanseComments", "(", "arg_6", ")", "arg_8", "=", "_RE_PATTERN_INCLUDE", ".", "search", "(", "arg_7", ")", "if", "arg_8", ":", "arg_9", "=", "arg_8", ".", "group", "(", "2", ")", "arg_1", ".", "setdefault", "(", "arg_9", ",", "arg_5", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n  \"\"\"Fill up the include_dict with new includes found from the file.\n\n  Args:\n    filename: the name of the header to read.\n    include_dict: a dictionary in which the headers are inserted.\n    io: The io factory to use to read the file. Provided for testability.\n\n  Returns:\n    True if a header was successfully added. False otherwise.\n  \"\"\"\n  arg_4 = None\n  try:\n    arg_4 = arg_2.open(arg_0, 'r', 'utf8', 'replace')\n  except IOError:\n    return False\n  arg_5 = 0\n  for arg_6 in arg_4:\n    arg_5 += 1\n    arg_7 = CleanseComments(arg_6)\n    arg_8 = _RE_PATTERN_INCLUDE.search(arg_7)\n    if arg_8:\n      arg_9 = arg_8.group(2)\n      arg_1.setdefault(arg_9, arg_5)\n  return True", "path": "third_party/python/cpplint/cpplint.py", "identifier": "UpdateIncludeState", "docstring": "Fill up the include_dict with new includes found from the file.\n\n  Args:\n    filename: the name of the header to read.\n    include_dict: a dictionary in which the headers are inserted.\n    io: The io factory to use to read the file. Provided for testability.\n\n  Returns:\n    True if a header was successfully added. False otherwise.", "docstring_tokens": ["Fill", "up", "the", "include_dict", "with", "new", "includes", "found", "from", "the", "file", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254850}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L590-L611", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Prepare & join phonetic numbers.", "language": "python", "parameters": "(self, phonetic)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split", "(", "'-'", ")", "arg_3", "=", "' '", ".", "join", "(", "[", "arg_0", ".", "_pnums_with_leading_space", "(", "i", ")", "[", "1", ":", "]", "for", "i", "in", "arg_2", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Prepare & join phonetic numbers.\n\n        Split phonetic value on '-', run through _pnums_with_leading_space,\n        and join with ' '\n\n        Parameters\n        ----------\n        phonetic : str\n            A Beider-Morse phonetic encoding\n\n        Returns\n        -------\n        str\n            A Beider-Morse phonetic code\n\n        \"\"\"\n        arg_2 = arg_1.split('-')  # for names with spaces in them\n        arg_3 = ' '.join(\n            [arg_0._pnums_with_leading_space(i)[1:] for i in arg_2]\n        )\n        return arg_3", "path": "abydos/phonetic/_beider_morse.py", "identifier": "BeiderMorse._phonetic_numbers", "docstring": "Prepare & join phonetic numbers.\n\n        Split phonetic value on '-', run through _pnums_with_leading_space,\n        and join with ' '\n\n        Parameters\n        ----------\n        phonetic : str\n            A Beider-Morse phonetic encoding\n\n        Returns\n        -------\n        str\n            A Beider-Morse phonetic code", "docstring_tokens": ["Prepare", "&", "join", "phonetic", "numbers", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254851}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/apev2.py#L460-L482", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "APEv2 tag value factory.", "language": "python", "parameters": "(value, kind)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "(", "TEXT", ",", "EXTERNAL", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "text_type", ")", ":", "if", "PY3", ":", "raise", "TypeError", "(", "\"str only for text/external values\"", ")", "else", ":", "arg_0", "=", "arg_0", ".", "encode", "(", "\"utf-8\"", ")", "if", "arg_1", "==", "TEXT", ":", "return", "APETextValue", "(", "arg_0", ",", "arg_1", ")", "elif", "arg_1", "==", "BINARY", ":", "return", "APEBinaryValue", "(", "arg_0", ",", "arg_1", ")", "elif", "arg_1", "==", "EXTERNAL", ":", "return", "APEExtValue", "(", "arg_0", ",", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "\"kind must be TEXT, BINARY, or EXTERNAL\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"APEv2 tag value factory.\n\n    Use this if you need to specify the value's type manually.  Binary\n    and text data are automatically detected by APEv2.__setitem__.\n    \"\"\"\n\n    if arg_1 in (TEXT, EXTERNAL):\n        if not isinstance(arg_0, text_type):\n            # stricter with py3\n            if PY3:\n                raise TypeError(\"str only for text/external values\")\n        else:\n            arg_0 = arg_0.encode(\"utf-8\")\n\n    if arg_1 == TEXT:\n        return APETextValue(arg_0, arg_1)\n    elif arg_1 == BINARY:\n        return APEBinaryValue(arg_0, arg_1)\n    elif arg_1 == EXTERNAL:\n        return APEExtValue(arg_0, arg_1)\n    else:\n        raise ValueError(\"kind must be TEXT, BINARY, or EXTERNAL\")", "path": "mutagen/apev2.py", "identifier": "APEValue", "docstring": "APEv2 tag value factory.\n\n    Use this if you need to specify the value's type manually.  Binary\n    and text data are automatically detected by APEv2.__setitem__.", "docstring_tokens": ["APEv2", "tag", "value", "factory", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 254852}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L90-L102", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Print ``top_n`` big dir in this dir.", "language": "python", "parameters": "(self, top_n=5)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ")", ":", "arg_0", ".", "assert_is_dir_and_exists", "(", ")", "arg_2", "=", "sorted", "(", "[", "(", "arg_3", ",", "arg_3", ".", "dirsize", ")", "for", "arg_3", "in", "arg_0", ".", "select_dir", "(", "recursive", "=", "False", ")", "]", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", ",", "reverse", "=", "True", ",", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", "[", ":", "arg_1", "]", ":", "print", "(", "\"{:<9}    {:<9}\"", ".", "format", "(", "repr_data_size", "(", "arg_4", ")", ",", "arg_3", ".", "abspath", ")", ")"], "function": "def Func(arg_0, arg_1=5):\n        \"\"\"\n        Print ``top_n`` big dir in this dir.\n        \"\"\"\n        arg_0.assert_is_dir_and_exists()\n\n        arg_2 = sorted(\n            [(arg_3, arg_3.dirsize) for arg_3 in arg_0.select_dir(recursive=False)],\n            key=lambda x: x[1],\n            reverse=True,\n        )\n        for arg_3, arg_4 in arg_2[:arg_1]:\n            print(\"{:<9}    {:<9}\".format(repr_data_size(arg_4), arg_3.abspath))", "path": "pathlib_mate/mate_tool_box.py", "identifier": "ToolBox.print_big_dir", "docstring": "Print ``top_n`` big dir in this dir.", "docstring_tokens": ["Print", "top_n", "big", "dir", "in", "this", "dir", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 254853}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/dashboard/controllers.py#L243-L282", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return the information about case groups", "language": "python", "parameters": "(adapter, total_cases, institute_id=None, slice_query=None)", "return_statement": "return cases", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "[", "{", "'status'", ":", "'all'", ",", "'count'", ":", "arg_1", ",", "'percent'", ":", "1", "}", "]", "arg_5", "=", "[", "]", "arg_6", "=", "{", "'$group'", ":", "{", "'_id'", ":", "'$status'", ",", "'count'", ":", "{", "'$sum'", ":", "1", "}", "}", "}", "arg_7", "=", "{", "}", "if", "arg_2", "and", "arg_3", ":", "arg_7", "=", "arg_0", ".", "cases", "(", "owner", "=", "arg_2", ",", "name_query", "=", "arg_3", ",", "yield_query", "=", "True", ")", "elif", "arg_2", ":", "arg_7", "=", "arg_0", ".", "cases", "(", "owner", "=", "arg_2", ",", "yield_query", "=", "True", ")", "elif", "arg_3", ":", "arg_7", "=", "arg_0", ".", "cases", "(", "name_query", "=", "arg_3", ",", "yield_query", "=", "True", ")", "arg_8", "=", "{", "'$match'", ":", "arg_7", "}", "if", "arg_7", "else", "{", "}", "if", "arg_8", ":", "arg_5", ".", "append", "(", "arg_8", ")", "arg_5", ".", "append", "(", "arg_6", ")", "arg_9", "=", "arg_0", ".", "case_collection", ".", "aggregate", "(", "arg_5", ")", "for", "arg_10", "in", "arg_9", ":", "arg_4", ".", "append", "(", "{", "'status'", ":", "arg_10", "[", "'_id'", "]", ",", "'count'", ":", "arg_10", "[", "'count'", "]", ",", "'percent'", ":", "arg_10", "[", "'count'", "]", "/", "arg_1", "}", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"Return the information about case groups\n\n    Args:\n        store(adapter.MongoAdapter)\n        total_cases(int): Total number of cases\n        slice_query(str): Query to filter cases to obtain statistics for.\n\n    Returns:\n        cases(dict):\n    \"\"\"\n    # Create a group with all cases in the database\n    arg_4 = [{'status': 'all', 'count': arg_1, 'percent': 1}]\n    # Group the cases based on their status\n    arg_5 = []\n    arg_6 = {'$group' : {'_id': '$status', 'count': {'$sum': 1}}}\n\n    arg_7 = {}\n    if arg_2 and arg_3:\n        arg_7 = arg_0.cases(owner=arg_2, name_query=arg_3,\n                              yield_query=True)\n    elif arg_2:\n        arg_7 = arg_0.cases(owner=arg_2, yield_query=True)\n    elif arg_3:\n        arg_7 = arg_0.cases(name_query=arg_3, yield_query=True)\n\n    arg_8 = {'$match': arg_7} if arg_7 else {}\n\n    if arg_8:\n        arg_5.append(arg_8)\n\n    arg_5.append(arg_6)\n    arg_9 = arg_0.case_collection.aggregate(arg_5)\n\n    for arg_10 in arg_9:\n        arg_4.append({'status': arg_10['_id'],\n                      'count': arg_10['count'],\n                      'percent': arg_10['count'] / arg_1})\n\n    return arg_4", "path": "scout/server/blueprints/dashboard/controllers.py", "identifier": "get_case_groups", "docstring": "Return the information about case groups\n\n    Args:\n        store(adapter.MongoAdapter)\n        total_cases(int): Total number of cases\n        slice_query(str): Query to filter cases to obtain statistics for.\n\n    Returns:\n        cases(dict):", "docstring_tokens": ["Return", "the", "information", "about", "case", "groups"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254854}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L61-L70", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Save a vectorized image to file.", "language": "python", "parameters": "(data, filename, masker, header=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "not", "arg_3", ":", "arg_3", "=", "arg_2", ".", "get_header", "(", ")", "arg_3", ".", "set_data_dtype", "(", "arg_0", ".", "dtype", ")", "arg_3", "[", "'cal_max'", "]", "=", "arg_0", ".", "max", "(", ")", "arg_3", "[", "'cal_min'", "]", "=", "arg_0", ".", "min", "(", ")", "arg_4", "=", "nifti1", ".", "Nifti1Image", "(", "arg_2", ".", "unmask", "(", "arg_0", ")", ",", "None", ",", "arg_3", ")", "arg_4", ".", "to_filename", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\" Save a vectorized image to file. \"\"\"\n    if not arg_3:\n        arg_3 = arg_2.get_header()\n    arg_3.set_data_dtype(arg_0.dtype)  # Avoids loss of precision\n    # Update min/max -- this should happen on save, but doesn't seem to\n    arg_3['cal_max'] = arg_0.max()\n    arg_3['cal_min'] = arg_0.min()\n    arg_4 = nifti1.Nifti1Image(arg_2.unmask(arg_0), None, arg_3)\n    arg_4.to_filename(arg_1)", "path": "neurosynth/base/imageutils.py", "identifier": "save_img", "docstring": "Save a vectorized image to file.", "docstring_tokens": ["Save", "a", "vectorized", "image", "to", "file", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 254855}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/generate.py#L287-L300", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Find out what items are documented in the given object's docstring.", "language": "python", "parameters": "(name, module=None, filename=None)", "return_statement": "return []", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "try", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "import_by_name", "(", "arg_0", ")", "arg_6", "=", "pydoc", ".", "getdoc", "(", "arg_4", ")", ".", "splitlines", "(", ")", "return", "find_autosummary_in_lines", "(", "arg_6", ",", "arg_1", "=", "arg_0", ",", "arg_2", "=", "arg_2", ")", "except", "AttributeError", ":", "pass", "except", "ImportError", ",", "e", ":", "print", "\"Failed to import '%s': %s\"", "%", "(", "arg_0", ",", "e", ")", "return", "[", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Find out what items are documented in the given object's docstring.\n\n    See `find_autosummary_in_lines`.\n    \"\"\"\n    try:\n        arg_3, arg_4, arg_5 = import_by_name(arg_0)\n        arg_6 = pydoc.getdoc(arg_4).splitlines()\n        return find_autosummary_in_lines(arg_6, arg_1=arg_0, arg_2=arg_2)\n    except AttributeError:\n        pass\n    except ImportError, e:\n        print \"Failed to import '%s': %s\" % (arg_0, e)\n    return []", "path": "gui/doc/ext/autosummary/generate.py", "identifier": "find_autosummary_in_docstring", "docstring": "Find out what items are documented in the given object's docstring.\n\n    See `find_autosummary_in_lines`.", "docstring_tokens": ["Find", "out", "what", "items", "are", "documented", "in", "the", "given", "object", "s", "docstring", "."], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 254856}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varbase/trends.py#L182-L211", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This calculates the difference in mags after EPD coefficients are\n    calculated.", "language": "python", "parameters": "(coeff, fsv, fdv, fkv, xcc, ycc, bgv, bge, mag)", "return_statement": "return -(coeff[0]*fsv**2. +\n             coeff[1]*fsv +\n             coeff[2]*fdv**2. +\n             coeff[3]*fdv +\n             coeff[4]*fkv**2. +\n             coeff[5]*fkv +\n             coeff[6] +\n             coeff[7]*fsv*fdv +\n             coeff[8]*fsv*fkv +\n             coeff[9]*fdv*fkv +\n             coeff[10]*np.sin(2*np.pi*xcc) +\n             coeff[11]*np.cos(2*np.pi*xcc) +\n             coeff[12]*np.sin(2*np.pi*ycc) +\n             coeff[13]*np.cos(2*np.pi*ycc) +\n             coeff[14]*np.sin(4*np.pi*xcc) +\n             coeff[15]*np.cos(4*np.pi*xcc) +\n             coeff[16]*np.sin(4*np.pi*ycc) +\n             coeff[17]*np.cos(4*np.pi*ycc) +\n             coeff[18]*bgv +\n             coeff[19]*bge -\n             mag)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", ":", "return", "-", "(", "arg_0", "[", "0", "]", "*", "arg_1", "**", "2.", "+", "arg_0", "[", "1", "]", "*", "arg_1", "+", "arg_0", "[", "2", "]", "*", "arg_2", "**", "2.", "+", "arg_0", "[", "3", "]", "*", "arg_2", "+", "arg_0", "[", "4", "]", "*", "arg_3", "**", "2.", "+", "arg_0", "[", "5", "]", "*", "arg_3", "+", "arg_0", "[", "6", "]", "+", "arg_0", "[", "7", "]", "*", "arg_1", "*", "arg_2", "+", "arg_0", "[", "8", "]", "*", "arg_1", "*", "arg_3", "+", "arg_0", "[", "9", "]", "*", "arg_2", "*", "arg_3", "+", "arg_0", "[", "10", "]", "*", "np", ".", "sin", "(", "2", "*", "np", ".", "pi", "*", "arg_4", ")", "+", "arg_0", "[", "11", "]", "*", "np", ".", "cos", "(", "2", "*", "np", ".", "pi", "*", "arg_4", ")", "+", "arg_0", "[", "12", "]", "*", "np", ".", "sin", "(", "2", "*", "np", ".", "pi", "*", "arg_5", ")", "+", "arg_0", "[", "13", "]", "*", "np", ".", "cos", "(", "2", "*", "np", ".", "pi", "*", "arg_5", ")", "+", "arg_0", "[", "14", "]", "*", "np", ".", "sin", "(", "4", "*", "np", ".", "pi", "*", "arg_4", ")", "+", "arg_0", "[", "15", "]", "*", "np", ".", "cos", "(", "4", "*", "np", ".", "pi", "*", "arg_4", ")", "+", "arg_0", "[", "16", "]", "*", "np", ".", "sin", "(", "4", "*", "np", ".", "pi", "*", "arg_5", ")", "+", "arg_0", "[", "17", "]", "*", "np", ".", "cos", "(", "4", "*", "np", ".", "pi", "*", "arg_5", ")", "+", "arg_0", "[", "18", "]", "*", "arg_6", "+", "arg_0", "[", "19", "]", "*", "arg_7", "-", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8):\n    '''\n    This calculates the difference in mags after EPD coefficients are\n    calculated.\n\n    final EPD mags = median(magseries) + epd_diffmags()\n\n    '''\n\n    return -(arg_0[0]*arg_1**2. +\n             arg_0[1]*arg_1 +\n             arg_0[2]*arg_2**2. +\n             arg_0[3]*arg_2 +\n             arg_0[4]*arg_3**2. +\n             arg_0[5]*arg_3 +\n             arg_0[6] +\n             arg_0[7]*arg_1*arg_2 +\n             arg_0[8]*arg_1*arg_3 +\n             arg_0[9]*arg_2*arg_3 +\n             arg_0[10]*np.sin(2*np.pi*arg_4) +\n             arg_0[11]*np.cos(2*np.pi*arg_4) +\n             arg_0[12]*np.sin(2*np.pi*arg_5) +\n             arg_0[13]*np.cos(2*np.pi*arg_5) +\n             arg_0[14]*np.sin(4*np.pi*arg_4) +\n             arg_0[15]*np.cos(4*np.pi*arg_4) +\n             arg_0[16]*np.sin(4*np.pi*arg_5) +\n             arg_0[17]*np.cos(4*np.pi*arg_5) +\n             arg_0[18]*arg_6 +\n             arg_0[19]*arg_7 -\n             arg_8)", "path": "astrobase/varbase/trends.py", "identifier": "_old_epd_diffmags", "docstring": "This calculates the difference in mags after EPD coefficients are\n    calculated.\n\n    final EPD mags = median(magseries) + epd_diffmags()", "docstring_tokens": ["This", "calculates", "the", "difference", "in", "mags", "after", "EPD", "coefficients", "are", "calculated", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 254857}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/segmaps.py#L196-L260", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Render the segmentation map as an RGB image.", "language": "python", "parameters": "(self, size=None, background_threshold=0.01, background_class_id=None, colors=None,\n             return_foreground_mask=False)", "return_statement": "return segmap_drawn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "0.01", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "arg_0", ".", "get_arr_int", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_7", "=", "1", "+", "np", ".", "max", "(", "arg_6", ")", "arg_8", "=", "np", ".", "zeros", "(", "(", "arg_6", ".", "shape", "[", "0", "]", ",", "arg_6", ".", "shape", "[", "1", "]", ",", "3", ")", ",", "dtype", "=", "np", ".", "uint8", ")", "if", "arg_4", "is", "None", ":", "arg_4", "=", "SegmentationMapOnImage", ".", "DEFAULT_SEGMENT_COLORS", "ia", ".", "do_assert", "(", "arg_7", "<=", "len", "(", "arg_4", ")", ",", "\"Can't Func all %d classes as it would exceed the maximum number of %d available colors.\"", "%", "(", "arg_7", ",", "len", "(", "arg_4", ")", ",", ")", ")", "arg_9", "=", "np", ".", "unique", "(", "arg_6", ")", "for", "arg_10", ",", "arg_11", "in", "zip", "(", "sm", ".", "xrange", "(", "arg_7", ")", ",", "arg_4", ")", ":", "if", "arg_10", "in", "arg_9", ":", "arg_12", "=", "(", "arg_6", "==", "arg_10", ")", "arg_8", "[", "arg_12", "]", "=", "arg_11", "if", "arg_5", ":", "arg_3", "=", "0", "if", "arg_3", "is", "None", "else", "arg_3", "arg_13", "=", "(", "arg_6", "!=", "arg_3", ")", "else", ":", "arg_13", "=", "None", "if", "arg_1", "is", "not", "None", ":", "arg_8", "=", "ia", ".", "imresize_single_image", "(", "arg_8", ",", "arg_1", ",", "interpolation", "=", "\"nearest\"", ")", "if", "arg_13", "is", "not", "None", ":", "arg_13", "=", "ia", ".", "imresize_single_image", "(", "arg_13", ".", "astype", "(", "np", ".", "uint8", ")", ",", "arg_1", ",", "interpolation", "=", "\"nearest\"", ")", ">", "0", "if", "arg_13", "is", "not", "None", ":", "return", "arg_8", ",", "arg_13", "return", "arg_8"], "function": "def Func(arg_0, arg_1=None, arg_2=0.01, arg_3=None, arg_4=None,\n             arg_5=False):\n        \"\"\"\n        Render the segmentation map as an RGB image.\n\n        Parameters\n        ----------\n        size : None or float or iterable of int or iterable of float, optional\n            Size of the rendered RGB image as ``(height, width)``.\n            See :func:`imgaug.imgaug.imresize_single_image` for details.\n            If set to None, no resizing is performed and the size of the segmentation map array is used.\n\n        background_threshold : float, optional\n            See :func:`imgaug.SegmentationMapOnImage.get_arr_int`.\n\n        background_class_id : None or int, optional\n            See :func:`imgaug.SegmentationMapOnImage.get_arr_int`.\n\n        colors : None or list of tuple of int, optional\n            Colors to use. One for each class to Func. If None, then default colors will be used.\n\n        return_foreground_mask : bool, optional\n            Whether to return a mask of the same size as the Funcn segmentation map, containing\n            True at any spatial location that is not the background class and False everywhere else.\n\n        Returns\n        -------\n        segmap_Funcn : (H,W,3) ndarray\n            Rendered segmentation map (dtype is uint8).\n\n        foreground_mask : (H,W) ndarray\n            Mask indicating the locations of foreground classes (dtype is bool).\n            This value is only returned if `return_foreground_mask` is True.\n\n        \"\"\"\n        arg_6 = arg_0.get_arr_int(arg_2=arg_2, arg_3=arg_3)\n        arg_7 = 1 + np.max(arg_6)\n        arg_8 = np.zeros((arg_6.shape[0], arg_6.shape[1], 3), dtype=np.uint8)\n        if arg_4 is None:\n            arg_4 = SegmentationMapOnImage.DEFAULT_SEGMENT_COLORS\n        ia.do_assert(arg_7 <= len(arg_4),\n                     \"Can't Func all %d classes as it would exceed the maximum number of %d available colors.\" % (\n                         arg_7, len(arg_4),))\n\n        arg_9 = np.unique(arg_6)\n        for arg_10, arg_11 in zip(sm.xrange(arg_7), arg_4):\n            if arg_10 in arg_9:\n                arg_12 = (arg_6 == arg_10)\n                arg_8[arg_12] = arg_11\n\n        if arg_5:\n            arg_3 = 0 if arg_3 is None else arg_3\n            arg_13 = (arg_6 != arg_3)\n        else:\n            arg_13 = None\n\n        if arg_1 is not None:\n            arg_8 = ia.imresize_single_image(arg_8, arg_1, interpolation=\"nearest\")\n            if arg_13 is not None:\n                arg_13 = ia.imresize_single_image(\n                    arg_13.astype(np.uint8), arg_1, interpolation=\"nearest\") > 0\n\n        if arg_13 is not None:\n            return arg_8, arg_13\n        return arg_8", "path": "imgaug/augmentables/segmaps.py", "identifier": "SegmentationMapOnImage.draw", "docstring": "Render the segmentation map as an RGB image.\n\n        Parameters\n        ----------\n        size : None or float or iterable of int or iterable of float, optional\n            Size of the rendered RGB image as ``(height, width)``.\n            See :func:`imgaug.imgaug.imresize_single_image` for details.\n            If set to None, no resizing is performed and the size of the segmentation map array is used.\n\n        background_threshold : float, optional\n            See :func:`imgaug.SegmentationMapOnImage.get_arr_int`.\n\n        background_class_id : None or int, optional\n            See :func:`imgaug.SegmentationMapOnImage.get_arr_int`.\n\n        colors : None or list of tuple of int, optional\n            Colors to use. One for each class to draw. If None, then default colors will be used.\n\n        return_foreground_mask : bool, optional\n            Whether to return a mask of the same size as the drawn segmentation map, containing\n            True at any spatial location that is not the background class and False everywhere else.\n\n        Returns\n        -------\n        segmap_drawn : (H,W,3) ndarray\n            Rendered segmentation map (dtype is uint8).\n\n        foreground_mask : (H,W) ndarray\n            Mask indicating the locations of foreground classes (dtype is bool).\n            This value is only returned if `return_foreground_mask` is True.", "docstring_tokens": ["Render", "the", "segmentation", "map", "as", "an", "RGB", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 254858}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/transpiler.py#L19-L50", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "transpile one or more circuits.", "language": "python", "parameters": "(circuits, backend=None, basis_gates=None, coupling_map=None,\n              initial_layout=None, seed_mapper=None, pass_manager=None)", "return_statement": "return compiler.transpile(circuits=circuits, backend=backend,\n                              basis_gates=basis_gates, coupling_map=coupling_map,\n                              initial_layout=initial_layout, seed_transpiler=seed_mapper,\n                              pass_manager=pass_manager)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "warnings", ".", "warn", "(", "\"qiskit.Funcr.Func() has been deprecated and will be \"", "\"removed in the 0.9 release. Use qiskit.compiler.Func() instead.\"", ",", "DeprecationWarning", ")", "return", "compiler", ".", "Func", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "seed_Funcr", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n              arg_4=None, arg_5=None, arg_6=None):\n    \"\"\"Func one or more circuits.\n\n    Args:\n        circuits (QuantumCircuit or list[QuantumCircuit]): circuits to compile\n        backend (BaseBackend): a backend to compile for\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): coupling map (perhaps custom) to target in mapping\n\n        initial_layout (Layout or dict or list):\n            Initial position of virtual qubits on physical qubits. The final\n            layout is not guaranteed to be the same, as the Funcr may permute\n            qubits through swaps or other means.\n\n        seed_mapper (int): random seed for the swap_mapper\n        pass_manager (PassManager): a pass_manager for the Funcr stages\n\n    Returns:\n        QuantumCircuit or list[QuantumCircuit]: Funcd circuit(s).\n\n    Raises:\n        TranspilerError: in case of bad inputs to Funcr or errors in passes\n    \"\"\"\n    warnings.warn(\"qiskit.Funcr.Func() has been deprecated and will be \"\n                  \"removed in the 0.9 release. Use qiskit.compiler.Func() instead.\",\n                  DeprecationWarning)\n    return compiler.Func(arg_0=arg_0, arg_1=arg_1,\n                              arg_2=arg_2, arg_3=arg_3,\n                              arg_4=arg_4, seed_Funcr=arg_5,\n                              arg_6=arg_6)", "path": "qiskit/transpiler/transpiler.py", "identifier": "transpile", "docstring": "transpile one or more circuits.\n\n    Args:\n        circuits (QuantumCircuit or list[QuantumCircuit]): circuits to compile\n        backend (BaseBackend): a backend to compile for\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): coupling map (perhaps custom) to target in mapping\n\n        initial_layout (Layout or dict or list):\n            Initial position of virtual qubits on physical qubits. The final\n            layout is not guaranteed to be the same, as the transpiler may permute\n            qubits through swaps or other means.\n\n        seed_mapper (int): random seed for the swap_mapper\n        pass_manager (PassManager): a pass_manager for the transpiler stages\n\n    Returns:\n        QuantumCircuit or list[QuantumCircuit]: transpiled circuit(s).\n\n    Raises:\n        TranspilerError: in case of bad inputs to transpiler or errors in passes", "docstring_tokens": ["transpile", "one", "or", "more", "circuits", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254859}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/games.py#L236-L238", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return the value to player; 1 for win, -1 for loss, 0 otherwise.", "language": "python", "parameters": "(self, state, player)", "return_statement": "return if_(player == 'X', state.utility, -state.utility)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "if_", "(", "arg_2", "==", "'X'", ",", "arg_1", ".", "Func", ",", "-", "arg_1", ".", "Func", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"Return the value to player; 1 for win, -1 for loss, 0 otherwise.\"\n        return if_(arg_2 == 'X', arg_1.Func, -arg_1.Func)", "path": "aima/games.py", "identifier": "TicTacToe.utility", "docstring": "Return the value to player; 1 for win, -1 for loss, 0 otherwise.", "docstring_tokens": ["Return", "the", "value", "to", "player", ";", "1", "for", "win", "-", "1", "for", "loss", "0", "otherwise", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 254860}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/sets.py#L274-L317", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Save the Numpy array created from to_matrix function to the output_file.", "language": "python", "parameters": "(self, output_file, smooth_fwhm=0, outdtype=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_0", ".", "to_matrix", "(", "arg_2", ",", "arg_3", ")", "arg_7", "=", "ExportData", "(", ")", "arg_8", "=", "{", "'data'", ":", "arg_4", ",", "'labels'", ":", "arg_0", ".", "labels", ",", "'mask_indices'", ":", "arg_5", ",", "'mask_shape'", ":", "arg_6", ",", "}", "if", "arg_0", ".", "others", ":", "arg_8", ".", "update", "(", "arg_0", ".", "others", ")", "log", ".", "debug", "(", "'Creating content in file {}.'", ".", "format", "(", "arg_1", ")", ")", "try", ":", "arg_7", ".", "save_variables", "(", "arg_1", ",", "arg_8", ")", "except", "Exception", "as", "exc", ":", "raise", "Exception", "(", "'Error saving variables to file {}.'", ".", "format", "(", "arg_1", ")", ")", "from", "exc"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=None):\n        \"\"\"Save the Numpy array created from to_matrix function to the output_file.\n\n        Will save into the file: outmat, mask_indices, vol_shape and self.others (put here whatever you want)\n\n            data: Numpy array with shape N x prod(vol.shape)\n                  containing the N files as flat vectors.\n\n            mask_indices: matrix with indices of the voxels in the mask\n\n            vol_shape: Tuple with shape of the volumes, for reshaping.\n\n        Parameters\n        ----------\n        output_file: str\n            Path to the output file. The extension of the file will be taken into account for the file format.\n            Choices of extensions: '.pyshelf' or '.shelf' (Python shelve)\n                                   '.mat' (Matlab archive),\n                                   '.hdf5' or '.h5' (HDF5 file)\n\n        smooth_fwhm: int\n            Integer indicating the size of the FWHM Gaussian smoothing kernel\n            to smooth the subject volumes before creating the data matrix\n\n        outdtype: dtype\n            Type of the elements of the array, if None will obtain the dtype from\n            the first nifti file.\n        \"\"\"\n        arg_4, arg_5, arg_6 = arg_0.to_matrix(arg_2, arg_3)\n\n        arg_7 = ExportData()\n        arg_8 = {'data':         arg_4,\n                   'labels':       arg_0.labels,\n                   'mask_indices': arg_5,\n                   'mask_shape':   arg_6, }\n\n        if arg_0.others:\n            arg_8.update(arg_0.others)\n\n        log.debug('Creating content in file {}.'.format(arg_1))\n        try:\n            arg_7.save_variables(arg_1, arg_8)\n        except Exception as exc:\n            raise Exception('Error saving variables to file {}.'.format(arg_1)) from exc", "path": "boyle/nifti/sets.py", "identifier": "NeuroImageSet.to_file", "docstring": "Save the Numpy array created from to_matrix function to the output_file.\n\n        Will save into the file: outmat, mask_indices, vol_shape and self.others (put here whatever you want)\n\n            data: Numpy array with shape N x prod(vol.shape)\n                  containing the N files as flat vectors.\n\n            mask_indices: matrix with indices of the voxels in the mask\n\n            vol_shape: Tuple with shape of the volumes, for reshaping.\n\n        Parameters\n        ----------\n        output_file: str\n            Path to the output file. The extension of the file will be taken into account for the file format.\n            Choices of extensions: '.pyshelf' or '.shelf' (Python shelve)\n                                   '.mat' (Matlab archive),\n                                   '.hdf5' or '.h5' (HDF5 file)\n\n        smooth_fwhm: int\n            Integer indicating the size of the FWHM Gaussian smoothing kernel\n            to smooth the subject volumes before creating the data matrix\n\n        outdtype: dtype\n            Type of the elements of the array, if None will obtain the dtype from\n            the first nifti file.", "docstring_tokens": ["Save", "the", "Numpy", "array", "created", "from", "to_matrix", "function", "to", "the", "output_file", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254861}
{"url": "https://github.com/acristoffers/ahio/blob/5d47f1697c173bd1cbdeac930546f97ad8570a38/ahio/abstract_driver.py#L390-L416", "sha": "5d47f1697c173bd1cbdeac930546f97ad8570a38", "docstring_summary": "Returns the analog reference.", "language": "python", "parameters": "(self, pin=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "return", "arg_0", ".", "_Func", "(", "None", ")", "else", ":", "arg_2", "=", "arg_0", ".", "_pin_mapping", ".", "get", "(", "arg_1", ",", "None", ")", "if", "arg_2", ":", "return", "arg_0", ".", "_Func", "(", "arg_2", ")", "else", ":", "raise", "KeyError", "(", "'Requested pin is not mapped: %s'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Returns the analog reference.\n\n        If the driver supports per pin analog reference setting, returns the\n        reference for pin `pin`. If pin is None, returns the global analog\n        reference. If only per pin reference is supported and pin is None,\n        raise RuntimeError.\n\n        If you're developing a driver, implement _Func(self, pin)\n\n        @arg pin if the the driver supports it, the pin that will use\n            `reference` as reference. None for all.\n\n        @returns the reference used for pin\n\n        @throw RuntimeError if pin is None on a per pin only hardware, or if\n            it's a valid pin on a global only analog reference hardware.\n        @throw KeyError if pin isn't mapped.\n        \"\"\"\n        if arg_1 is None:\n            return arg_0._Func(None)\n        else:\n            arg_2 = arg_0._pin_mapping.get(arg_1, None)\n            if arg_2:\n                return arg_0._Func(arg_2)\n            else:\n                raise KeyError('Requested pin is not mapped: %s' % arg_1)", "path": "ahio/abstract_driver.py", "identifier": "AbstractDriver.analog_reference", "docstring": "Returns the analog reference.\n\n        If the driver supports per pin analog reference setting, returns the\n        reference for pin `pin`. If pin is None, returns the global analog\n        reference. If only per pin reference is supported and pin is None,\n        raise RuntimeError.\n\n        If you're developing a driver, implement _analog_reference(self, pin)\n\n        @arg pin if the the driver supports it, the pin that will use\n            `reference` as reference. None for all.\n\n        @returns the reference used for pin\n\n        @throw RuntimeError if pin is None on a per pin only hardware, or if\n            it's a valid pin on a global only analog reference hardware.\n        @throw KeyError if pin isn't mapped.", "docstring_tokens": ["Returns", "the", "analog", "reference", "."], "nwo": "acristoffers/ahio", "score": 0.21302904236143622, "idx": 254862}
{"url": "https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L289-L302", "sha": "6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d", "docstring_summary": "Synchronous PUT request. There will be no returning output from\n        the server, because the request will be made with ``silent``\n        parameter. ``data`` must be a JSONable value.", "language": "python", "parameters": "(self, url, name, data, params=None, headers=None, connection=None)", "return_statement": "return make_put_request(endpoint, data, params, headers,\n                                connection=connection)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "assert", "arg_2", ",", "'Snapshot name must be specified'", "arg_4", "=", "arg_4", "or", "{", "}", "arg_5", "=", "arg_5", "or", "{", "}", "arg_7", "=", "arg_0", ".", "_build_endpoint_url", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_authenticate", "(", "arg_4", ",", "arg_5", ")", "arg_3", "=", "json", ".", "dumps", "(", "arg_3", ",", "cls", "=", "JSONEncoder", ")", "return", "make_Func_request", "(", "arg_7", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None):\n        \"\"\"\n        Synchronous PUT request. There will be no returning outFunc from\n        the server, because the request will be made with ``silent``\n        parameter. ``data`` must be a JSONable value.\n        \"\"\"\n        assert arg_2, 'Snapshot name must be specified'\n        arg_4 = arg_4 or {}\n        arg_5 = arg_5 or {}\n        arg_7 = arg_0._build_endpoint_url(arg_1, arg_2)\n        arg_0._authenticate(arg_4, arg_5)\n        arg_3 = json.dumps(arg_3, cls=JSONEncoder)\n        return make_Func_request(arg_7, arg_3, arg_4, arg_5,\n                                arg_6=arg_6)", "path": "firebase/firebase.py", "identifier": "FirebaseApplication.put", "docstring": "Synchronous PUT request. There will be no returning output from\n        the server, because the request will be made with ``silent``\n        parameter. ``data`` must be a JSONable value.", "docstring_tokens": ["Synchronous", "PUT", "request", ".", "There", "will", "be", "no", "returning", "output", "from", "the", "server", "because", "the", "request", "will", "be", "made", "with", "silent", "parameter", ".", "data", "must", "be", "a", "JSONable", "value", "."], "nwo": "ozgur/python-firebase", "score": 0.7583798599854712, "idx": 254863}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L152-L167", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Compose projects.json for bugzilla", "language": "python", "parameters": "(projects, data)", "return_statement": "return projects", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "[", "project", "for", "project", "in", "arg_1", "if", "len", "(", "arg_1", "[", "project", "]", "[", "'bugzilla'", "]", ")", ">", "0", "]", ":", "if", "'bugzilla'", "not", "in", "arg_0", "[", "arg_2", "]", ":", "arg_0", "[", "arg_2", "]", "[", "'bugzilla'", "]", "=", "[", "]", "arg_3", "=", "[", "url", "[", "'query_url'", "]", "for", "url", "in", "arg_1", "[", "arg_2", "]", "[", "'bugzilla'", "]", "if", "url", "[", "'query_url'", "]", "not", "in", "arg_0", "[", "arg_2", "]", "[", "'bugzilla'", "]", "]", "arg_0", "[", "arg_2", "]", "[", "'bugzilla'", "]", "+=", "arg_3", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Compose projects.json for bugzilla\n\n    :param projects: projects.json\n    :param data: eclipse JSON\n    :return: projects.json with bugzilla\n    \"\"\"\n    for arg_2 in [project for project in arg_1 if len(arg_1[project]['bugzilla']) > 0]:\n        if 'bugzilla' not in arg_0[arg_2]:\n            arg_0[arg_2]['bugzilla'] = []\n\n        arg_3 = [url['query_url'] for url in arg_1[arg_2]['bugzilla'] if\n                url['query_url'] not in arg_0[arg_2]['bugzilla']]\n        arg_0[arg_2]['bugzilla'] += arg_3\n\n    return arg_0", "path": "sirmordred/eclipse_projects_lib.py", "identifier": "compose_bugzilla", "docstring": "Compose projects.json for bugzilla\n\n    :param projects: projects.json\n    :param data: eclipse JSON\n    :return: projects.json with bugzilla", "docstring_tokens": ["Compose", "projects", ".", "json", "for", "bugzilla"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 254864}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L80-L96", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "scan folder1 and folder2 into files1 and files2.\n        since we are on windows, simplify things by making them all lowercase.\n        this WILL cause problems on 'nix operating systems.If this is the case,\n        just run a script to rename every file to all lowercase.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "cm", ".", "timeit", "(", ")", "arg_0", ".", "files1", "=", "cm", ".", "list_to_lowercase", "(", "sorted", "(", "os", ".", "listdir", "(", "arg_0", ".", "folder1", ")", ")", ")", "arg_0", ".", "files2", "=", "cm", ".", "list_to_lowercase", "(", "sorted", "(", "os", ".", "listdir", "(", "arg_0", ".", "folder2", ")", ")", ")", "arg_0", ".", "files1abf", "=", "[", "x", "for", "x", "in", "arg_0", ".", "files1", "if", "x", ".", "endswith", "(", "\".abf\"", ")", "]", "arg_0", ".", "files1abf", "=", "cm", ".", "list_to_lowercase", "(", "cm", ".", "abfSort", "(", "arg_0", ".", "files1abf", ")", ")", "arg_0", ".", "IDs", "=", "[", "x", "[", ":", "-", "4", "]", "for", "x", "in", "arg_0", ".", "files1abf", "]", "arg_0", ".", "log", ".", "debug", "(", "\"folder1 has %d files\"", ",", "len", "(", "arg_0", ".", "files1", ")", ")", "arg_0", ".", "log", ".", "debug", "(", "\"folder1 has %d abfs\"", ",", "len", "(", "arg_0", ".", "files1abf", ")", ")", "arg_0", ".", "log", ".", "debug", "(", "\"folder2 has %d files\"", ",", "len", "(", "arg_0", ".", "files2", ")", ")", "arg_0", ".", "log", ".", "debug", "(", "\"Funcning folders took %s\"", ",", "cm", ".", "timeit", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Func folder1 and folder2 into files1 and files2.\n        since we are on windows, simplify things by making them all lowercase.\n        this WILL cause problems on 'nix operating systems.If this is the case,\n        just run a script to rename every file to all lowercase.\n        \"\"\"\n        arg_1=cm.timeit()\n        arg_0.files1=cm.list_to_lowercase(sorted(os.listdir(arg_0.folder1)))\n        arg_0.files2=cm.list_to_lowercase(sorted(os.listdir(arg_0.folder2)))\n        arg_0.files1abf=[x for x in arg_0.files1 if x.endswith(\".abf\")]\n        arg_0.files1abf=cm.list_to_lowercase(cm.abfSort(arg_0.files1abf))\n        arg_0.IDs=[x[:-4] for x in arg_0.files1abf]\n        arg_0.log.debug(\"folder1 has %d files\",len(arg_0.files1))\n        arg_0.log.debug(\"folder1 has %d abfs\",len(arg_0.files1abf))\n        arg_0.log.debug(\"folder2 has %d files\",len(arg_0.files2))\n        arg_0.log.debug(\"Funcning folders took %s\",cm.timeit(arg_1))", "path": "swhlab/indexing/indexing.py", "identifier": "INDEX.scan", "docstring": "scan folder1 and folder2 into files1 and files2.\n        since we are on windows, simplify things by making them all lowercase.\n        this WILL cause problems on 'nix operating systems.If this is the case,\n        just run a script to rename every file to all lowercase.", "docstring_tokens": ["scan", "folder1", "and", "folder2", "into", "files1", "and", "files2", ".", "since", "we", "are", "on", "windows", "simplify", "things", "by", "making", "them", "all", "lowercase", ".", "this", "WILL", "cause", "problems", "on", "nix", "operating", "systems", ".", "If", "this", "is", "the", "case", "just", "run", "a", "script", "to", "rename", "every", "file", "to", "all", "lowercase", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 254865}
{"url": "https://github.com/Tsjerk/Insane/blob/b73f08910ddb0b66597b20ff75ecee7f65f4ecf6/insane/core.py#L773-L817", "sha": "b73f08910ddb0b66597b20ff75ecee7f65f4ecf6", "docstring_summary": "Write a basic TOP file.", "language": "python", "parameters": "(outpath, molecules, title)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "if", "arg_4", "[", "0", "]", ".", "endswith", "(", "'.o'", ")", ":", "arg_3", ".", "append", "(", "tuple", "(", "[", "arg_4", "[", "0", "]", "[", ":", "-", "2", "]", "]", "+", "list", "(", "arg_4", "[", "1", ":", "]", ")", ")", ")", "else", ":", "arg_3", ".", "append", "(", "arg_4", ")", "if", "arg_0", ":", "with", "open", "(", "arg_0", ",", "\"w\"", ")", "as", "top", ":", "print", "(", "'#include \"martini.itp\"\\n'", ",", "file", "=", "top", ")", "print", "(", "'[ system ]'", ",", "file", "=", "top", ")", "print", "(", "'; name'", ",", "file", "=", "top", ")", "print", "(", "arg_2", ",", "file", "=", "top", ")", "print", "(", "'\\n'", ",", "file", "=", "top", ")", "print", "(", "'[ molecules ]'", ",", "file", "=", "top", ")", "print", "(", "'; name  number'", ",", "file", "=", "top", ")", "print", "(", "\"\\n\"", ".", "join", "(", "\"%-10s %7d\"", "%", "arg_4", "for", "arg_4", "in", "arg_3", ")", ",", "file", "=", "top", ")", "else", ":", "arg_5", "=", "(", "molecule", "for", "molecule", "in", "arg_3", "if", "molecule", "[", "0", "]", "!=", "'Protein'", ")", "print", "(", "\"\\n\"", ".", "join", "(", "\"%-10s %7d\"", "%", "arg_4", "for", "arg_4", "in", "arg_5", ")", ",", "file", "=", "sys", ".", "stderr", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Write a basic TOP file.\n\n    The topology is written in *outpath*. If *outpath* is en empty string, or\n    anything for which ``bool(outpath) == False``, the topology is written on\n    the standard error, and the header is omitted, and only what has been buit\n    by Insane id displayed (e.g. Proteins are excluded).\n\n    Parameters\n    ----------\n    outpath\n        The path to the file to write. If empty, a simplify topology is\n        written on stderr.\n    molecules\n        List of molecules with the number of them.\n    title\n        Title of the system.\n    \"\"\"\n    arg_3 = []\n    for arg_4 in arg_1:\n        if arg_4[0].endswith('.o'):\n            arg_3.append(tuple([arg_4[0][:-2]]+list(arg_4[1:])))\n        else:\n            arg_3.append(arg_4)\n\n    if arg_0:\n        # Write a rudimentary topology file\n        with open(arg_0, \"w\") as top:\n            print('#include \"martini.itp\"\\n', file=top)\n            print('[ system ]', file=top)\n            print('; name', file=top)\n            print(arg_2, file=top)\n            print('\\n', file=top)\n            print('[ molecules ]', file=top)\n            print('; name  number', file=top)\n            print(\"\\n\".join(\"%-10s %7d\"%arg_4 for arg_4 in arg_3), file=top)\n    else:\n        # Here we only include molecules that have beed added by insane.\n        # This is usually concatenated at the end of an existint top file.\n        # As the existing file usually contain the proteins already, we do not\n        # include them here.\n        arg_5 = (molecule for molecule in arg_3\n                           if molecule[0] != 'Protein')\n        print(\"\\n\".join(\"%-10s %7d\"%arg_4 for arg_4 in arg_5), file=sys.stderr)", "path": "insane/core.py", "identifier": "write_top", "docstring": "Write a basic TOP file.\n\n    The topology is written in *outpath*. If *outpath* is en empty string, or\n    anything for which ``bool(outpath) == False``, the topology is written on\n    the standard error, and the header is omitted, and only what has been buit\n    by Insane id displayed (e.g. Proteins are excluded).\n\n    Parameters\n    ----------\n    outpath\n        The path to the file to write. If empty, a simplify topology is\n        written on stderr.\n    molecules\n        List of molecules with the number of them.\n    title\n        Title of the system.", "docstring_tokens": ["Write", "a", "basic", "TOP", "file", "."], "nwo": "Tsjerk/Insane", "score": 0.19193044314782712, "idx": 254866}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/excel_utils.py#L178-L181", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return the duplicated items in `values`", "language": "python", "parameters": "(values: Sequence)", "return_statement": "return vals[vals.duplicated()]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", ":", "arg_2", "=", "pd", ".", "Series", "(", "arg_0", ")", "return", "arg_2", "[", "arg_2", ".", "Func", "(", ")", "]"], "function": "def Func(arg_0: arg_1):\n    \"\"\" Return the Func items in `values`\"\"\"\n    arg_2 = pd.Series(arg_0)\n    return arg_2[arg_2.Func()]", "path": "boyle/excel_utils.py", "identifier": "duplicated", "docstring": "Return the duplicated items in `values`", "docstring_tokens": ["Return", "the", "duplicated", "items", "in", "values"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254867}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L644-L680", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return median.", "language": "python", "parameters": "(nums)", "return_statement": "return med if not med.is_integer() else int(med)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "sorted", "(", "arg_0", ")", "arg_1", "=", "len", "(", "arg_0", ")", "if", "arg_1", "%", "2", ":", "arg_1", "=", "int", "(", "(", "arg_1", "-", "1", ")", "/", "2", ")", "return", "arg_0", "[", "arg_1", "]", "arg_1", "=", "int", "(", "arg_1", "/", "2", ")", "arg_2", "=", "(", "arg_0", "[", "arg_1", "-", "1", "]", "+", "arg_0", "[", "arg_1", "]", ")", "/", "2", "return", "arg_2", "if", "not", "arg_2", ".", "is_integer", "(", ")", "else", "int", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Return Func.\n\n    With numbers sorted by value, the Func is the middle value (if there is\n    an odd number of values) or the arithmetic mean of the two middle values\n    (if there is an even number of values).\n\n    Cf. https://en.wikipedia.org/wiki/Median\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    int or float\n        The Func of nums\n\n    Examples\n    --------\n    >>> Func([1, 2, 3])\n    2\n    >>> Func([1, 2, 3, 4])\n    2.5\n    >>> Func([1, 2, 2, 4])\n    2\n\n    \"\"\"\n    arg_0 = sorted(arg_0)\n    arg_1 = len(arg_0)\n    if arg_1 % 2:\n        arg_1 = int((arg_1 - 1) / 2)\n        return arg_0[arg_1]\n    arg_1 = int(arg_1 / 2)\n    arg_2 = (arg_0[arg_1 - 1] + arg_0[arg_1]) / 2\n    return arg_2 if not arg_2.is_integer() else int(arg_2)", "path": "abydos/stats/_mean.py", "identifier": "median", "docstring": "Return median.\n\n    With numbers sorted by value, the median is the middle value (if there is\n    an odd number of values) or the arithmetic mean of the two middle values\n    (if there is an even number of values).\n\n    Cf. https://en.wikipedia.org/wiki/Median\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    int or float\n        The median of nums\n\n    Examples\n    --------\n    >>> median([1, 2, 3])\n    2\n    >>> median([1, 2, 3, 4])\n    2.5\n    >>> median([1, 2, 2, 4])\n    2", "docstring_tokens": ["Return", "median", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254868}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L864-L871", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return info about callers.", "language": "python", "parameters": "(variant_obj, category='snv')", "return_statement": "return list(calls)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'snv'", ")", ":", "arg_2", "=", "set", "(", ")", "for", "arg_3", "in", "CALLERS", "[", "arg_1", "]", ":", "if", "arg_0", ".", "get", "(", "arg_3", "[", "'id'", "]", ")", ":", "arg_2", ".", "add", "(", "(", "arg_3", "[", "'name'", "]", ",", "arg_0", "[", "arg_3", "[", "'id'", "]", "]", ")", ")", "return", "list", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1='snv'):\n    \"\"\"Return info about Func.\"\"\"\n    arg_2 = set()\n    for arg_3 in CALLERS[arg_1]:\n        if arg_0.get(arg_3['id']):\n            arg_2.add((arg_3['name'], arg_0[arg_3['id']]))\n\n    return list(arg_2)", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "callers", "docstring": "Return info about callers.", "docstring_tokens": ["Return", "info", "about", "callers", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254869}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1166-L1208", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the magnitude of the inverse Fast Fourier Transform of a waveform.", "language": "python", "parameters": "(wave, npoints=None, indep_min=None, indep_max=None)", "return_statement": "return abs(ifft(wave, npoints, indep_min, indep_max))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "return", "abs", "(", "ifft", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n    r\"\"\"\n    Return the magnitude of the inverse Fast Fourier Transform of a waveform.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param npoints: Number of points to use in the transform. If **npoints**\n                    is less than the size of the independent variable vector\n                    the waveform is truncated; if **npoints** is greater than\n                    the size of the independent variable vector, the waveform\n                    is zero-padded\n    :type  npoints: positive integer\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`npoints\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n     * RuntimeError (Non-uniform frequency spacing)\n\n    .. [[[end]]]\n    \"\"\"\n    return abs(ifft(arg_0, arg_1, arg_2, arg_3))", "path": "peng/wave_functions.py", "identifier": "ifftm", "docstring": "r\"\"\"\n    Return the magnitude of the inverse Fast Fourier Transform of a waveform.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param npoints: Number of points to use in the transform. If **npoints**\n                    is less than the size of the independent variable vector\n                    the waveform is truncated; if **npoints** is greater than\n                    the size of the independent variable vector, the waveform\n                    is zero-padded\n    :type  npoints: positive integer\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.ifftm\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`npoints\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n     * RuntimeError (Non-uniform frequency spacing)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "magnitude", "of", "the", "inverse", "Fast", "Fourier", "Transform", "of", "a", "waveform", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 254870}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/apy/auth.py#L21-L27", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "Verify basic http authentification", "language": "python", "parameters": "(username, password)", "return_statement": "return user or None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "models", ".", "User", ".", "objects", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", ".", "first", "(", ")", "return", "arg_2", "or", "None"], "function": "def Func(arg_0, arg_1):\n    ''' Verify basic http authentification '''\n    arg_2 = models.User.objects(\n        arg_0=arg_0,\n        arg_1=arg_1\n    ).first()\n    return arg_2 or None", "path": "python/dna/apy/auth.py", "identifier": "check_credentials", "docstring": "Verify basic http authentification", "docstring_tokens": ["Verify", "basic", "http", "authentification"], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 254871}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/cli/ingestdocs.py#L126-L193", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Ingest any kind of LSST document hosted on LSST the Docs from its\n    source.", "language": "python", "parameters": "(session, github_api_token, ltd_product_url,\n                          mongo_collection=None)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_5", "=", "await", "get_ltd_product", "(", "arg_0", ",", "url", "=", "arg_2", ")", "arg_6", "=", "arg_5", "[", "'slug'", "]", "arg_7", "=", "DOCUMENT_HANDLE_PATTERN", ".", "match", "(", "arg_6", ")", "if", "arg_7", "is", "None", ":", "arg_4", ".", "debug", "(", "'%s is not a document repo'", ",", "arg_6", ")", "return", "try", ":", "return", "await", "process_sphinx_technote", "(", "arg_0", ",", "arg_1", ",", "arg_5", ",", "arg_3", "=", "arg_3", ")", "except", "NotSphinxTechnoteError", ":", "arg_4", ".", "debug", "(", "'%s is not a Sphinx-based technote.'", ",", "arg_6", ")", "except", "Exception", ":", "arg_4", ".", "exception", "(", "'Unexpected error trying to process %s'", ",", "arg_6", ")", "return", "try", ":", "return", "await", "process_lander_page", "(", "arg_0", ",", "arg_1", ",", "arg_5", ",", "arg_3", "=", "arg_3", ")", "except", "NotLanderPageError", ":", "arg_4", ".", "debug", "(", "'%s is not a Lander page with a metadata.jsonld file.'", ",", "arg_6", ")", "except", "Exception", ":", "arg_4", ".", "exception", "(", "'Unexpected error trying to process %s'", ",", "arg_6", ")", "return"], "function": "async def Func(arg_0, arg_1, arg_2,\n                          arg_3=None):\n    \"\"\"Ingest any kind of LSST document hosted on LSST the Docs from its\n    source.\n\n    Parameters\n    ----------\n    session : `aiohttp.ClientSession`\n        Your application's aiohttp client session.\n        See http://aiohttp.readthedocs.io/en/stable/client.html.\n    github_api_token : `str`\n        A GitHub personal API token. See the `GitHub personal access token\n        guide`_.\n    ltd_product_url : `str`\n        URL of the technote's product resource in the LTD Keeper API.\n    mongo_collection : `motor.motor_asyncio.AsyncIOMotorCollection`, optional\n        MongoDB collection. This should be the common MongoDB collection for\n        LSST projectmeta JSON-LD records. If provided, ths JSON-LD is upserted\n        into the MongoDB collection.\n\n    Returns\n    -------\n    metadata : `dict`\n        JSON-LD-formatted dictionary.\n\n    .. `GitHub personal access token guide`: https://ls.st/41d\n    \"\"\"\n    arg_4 = logging.getLogger(__name__)\n\n    arg_5 = await get_ltd_product(arg_0, url=arg_2)\n\n    # Ensure the LTD product is a document\n    arg_6 = arg_5['slug']\n    arg_7 = DOCUMENT_HANDLE_PATTERN.match(arg_6)\n    if arg_7 is None:\n        arg_4.debug('%s is not a document repo', arg_6)\n        return\n\n    # Figure out the format of the document by probing for metadata files.\n    # reStructuredText-based Sphinx documents have metadata.yaml file.\n    try:\n        return await process_sphinx_technote(arg_0,\n                                             arg_1,\n                                             arg_5,\n                                             arg_3=arg_3)\n    except NotSphinxTechnoteError:\n        # Catch error so we can try the next format\n        arg_4.debug('%s is not a Sphinx-based technote.', arg_6)\n    except Exception:\n        # Something bad happened trying to process the technote.\n        # Log and just move on.\n        arg_4.exception('Unexpected error trying to process %s', arg_6)\n        return\n\n    # Try interpreting it as a Lander page with a /metadata.jsonld document\n    try:\n        return await process_lander_page(arg_0,\n                                         arg_1,\n                                         arg_5,\n                                         arg_3=arg_3)\n    except NotLanderPageError:\n        # Catch error so we can try the next format\n        arg_4.debug('%s is not a Lander page with a metadata.jsonld file.',\n                     arg_6)\n    except Exception:\n        # Something bad happened; log and move on\n        arg_4.exception('Unexpected error trying to process %s', arg_6)\n        return", "path": "lsstprojectmeta/cli/ingestdocs.py", "identifier": "process_ltd_doc", "docstring": "Ingest any kind of LSST document hosted on LSST the Docs from its\n    source.\n\n    Parameters\n    ----------\n    session : `aiohttp.ClientSession`\n        Your application's aiohttp client session.\n        See http://aiohttp.readthedocs.io/en/stable/client.html.\n    github_api_token : `str`\n        A GitHub personal API token. See the `GitHub personal access token\n        guide`_.\n    ltd_product_url : `str`\n        URL of the technote's product resource in the LTD Keeper API.\n    mongo_collection : `motor.motor_asyncio.AsyncIOMotorCollection`, optional\n        MongoDB collection. This should be the common MongoDB collection for\n        LSST projectmeta JSON-LD records. If provided, ths JSON-LD is upserted\n        into the MongoDB collection.\n\n    Returns\n    -------\n    metadata : `dict`\n        JSON-LD-formatted dictionary.\n\n    .. `GitHub personal access token guide`: https://ls.st/41d", "docstring_tokens": ["Ingest", "any", "kind", "of", "LSST", "document", "hosted", "on", "LSST", "the", "Docs", "from", "its", "source", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 254872}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L460-L468", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Pickle the Grid object", "language": "python", "parameters": "(self, filename, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "dict", "(", "grid", "=", "arg_0", ".", "grid", ",", "edges", "=", "arg_0", ".", "edges", ",", "metadata", "=", "arg_0", ".", "metadata", ")", "with", "open", "(", "arg_1", ",", "'wb'", ")", "as", "f", ":", "cPickle", ".", "dump", "(", "arg_3", ",", "f", ",", "cPickle", ".", "HIGHEST_PROTOCOL", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Pickle the Grid object\n\n        The object is dumped as a dictionary with grid and edges: This\n        is sufficient to recreate the grid object with __init__().\n        \"\"\"\n        arg_3 = dict(grid=arg_0.grid, edges=arg_0.edges, metadata=arg_0.metadata)\n        with open(arg_1, 'wb') as f:\n            cPickle.dump(arg_3, f, cPickle.HIGHEST_PROTOCOL)", "path": "gridData/core.py", "identifier": "Grid._export_python", "docstring": "Pickle the Grid object\n\n        The object is dumped as a dictionary with grid and edges: This\n        is sufficient to recreate the grid object with __init__().", "docstring_tokens": ["Pickle", "the", "Grid", "object"], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 254873}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_euclidean.py#L192-L225", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the normalized Euclidean similarity of two strings.", "language": "python", "parameters": "(src, tar, qval=2, alphabet=None)", "return_statement": "return Euclidean().sim(src, tar, qval, alphabet)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", ",", "arg_3", "=", "None", ")", ":", "return", "Euclidean", "(", ")", ".", "sim", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=2, arg_3=None):\n    \"\"\"Return the normalized Euclidean similarity of two strings.\n\n    This is a wrapper for :py:meth:`Euclidean.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string (or QGrams/Counter objects) for comparison\n    tar : str\n        Target string (or QGrams/Counter objects) for comparison\n    qval : int\n        The length of each q-gram; 0 for non-q-gram version\n    alphabet : collection or int\n        The values or size of the alphabet\n\n    Returns\n    -------\n    float\n        The normalized Euclidean similarity\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.42264973081\n    >>> round(Func('Niall', 'Neil'), 12)\n    0.316869948936\n    >>> round(Func('Colin', 'Cuilen'), 12)\n    0.272393124891\n    >>> Func('ATCG', 'TAGC')\n    0.0\n\n    \"\"\"\n    return Euclidean().sim(arg_0, arg_1, arg_2, arg_3)", "path": "abydos/distance/_euclidean.py", "identifier": "sim_euclidean", "docstring": "Return the normalized Euclidean similarity of two strings.\n\n    This is a wrapper for :py:meth:`Euclidean.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string (or QGrams/Counter objects) for comparison\n    tar : str\n        Target string (or QGrams/Counter objects) for comparison\n    qval : int\n        The length of each q-gram; 0 for non-q-gram version\n    alphabet : collection or int\n        The values or size of the alphabet\n\n    Returns\n    -------\n    float\n        The normalized Euclidean similarity\n\n    Examples\n    --------\n    >>> round(sim_euclidean('cat', 'hat'), 12)\n    0.42264973081\n    >>> round(sim_euclidean('Niall', 'Neil'), 12)\n    0.316869948936\n    >>> round(sim_euclidean('Colin', 'Cuilen'), 12)\n    0.272393124891\n    >>> sim_euclidean('ATCG', 'TAGC')\n    0.0", "docstring_tokens": ["Return", "the", "normalized", "Euclidean", "similarity", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254874}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L76-L143", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This runs the pyeebls.eebls function using the given inputs.", "language": "python", "parameters": "(times,\n                mags,\n                nfreq,\n                freqmin,\n                stepsize,\n                nbins,\n                minduration,\n                maxduration)", "return_statement": "return {'power':blsresult[0],\n            'bestperiod':blsresult[1],\n            'bestpower':blsresult[2],\n            'transdepth':blsresult[3],\n            'transduration':blsresult[4],\n            'transingressbin':blsresult[5],\n            'transegressbin':blsresult[6]}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_8", "=", "npones", "(", "arg_0", ".", "size", ")", "arg_9", "=", "npones", "(", "arg_0", ".", "size", ")", "arg_10", "=", "eebls", "(", "arg_0", ",", "arg_1", ",", "arg_8", ",", "arg_9", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "return", "{", "'power'", ":", "arg_10", "[", "0", "]", ",", "'bestperiod'", ":", "arg_10", "[", "1", "]", ",", "'bestpower'", ":", "arg_10", "[", "2", "]", ",", "'transdepth'", ":", "arg_10", "[", "3", "]", ",", "'transduration'", ":", "arg_10", "[", "4", "]", ",", "'transingressbin'", ":", "arg_10", "[", "5", "]", ",", "'transegressbin'", ":", "arg_10", "[", "6", "]", "}"], "function": "def Func(arg_0,\n                arg_1,\n                arg_2,\n                arg_3,\n                arg_4,\n                arg_5,\n                arg_6,\n                arg_7):\n    '''This runs the pyeebls.eebls function using the given inputs.\n\n    Parameters\n    ----------\n\n    times,mags : np.array\n        The input magnitude time-series to search for transits.\n\n    nfreq : int\n        The number of frequencies to use when searching for transits.\n\n    freqmin : float\n        The minimum frequency of the period-search -> max period that will be\n        used for the search.\n\n    stepsize : float\n        The step-size in frequency to use to generate a frequency-grid.\n\n    nbins : int\n        The number of phase bins to use.\n\n    minduration : float\n        The minimum fractional transit duration that will be considered.\n\n    maxduration : float\n        The maximum fractional transit duration that will be considered.\n\n    Returns\n    -------\n\n    dict\n        Returns a dict of the form::\n\n            {\n                'power':           the periodogram power array,\n                'bestperiod':      the best period found,\n                'bestpower':       the highest peak of the periodogram power,\n                'transdepth':      transit depth found by eebls.f,\n                'transduration':   transit duration found by eebls.f,\n                'transingressbin': transit ingress bin found by eebls.f,\n                'transegressbin':  transit egress bin found by eebls.f,\n            }\n\n    '''\n\n    arg_8 = npones(arg_0.size)\n    arg_9 = npones(arg_0.size)\n\n    arg_10 = eebls(arg_0, arg_1,\n                      arg_8, arg_9,\n                      arg_2, arg_3, arg_4,\n                      arg_5, arg_6, arg_7)\n\n    return {'power':arg_10[0],\n            'bestperiod':arg_10[1],\n            'bestpower':arg_10[2],\n            'transdepth':arg_10[3],\n            'transduration':arg_10[4],\n            'transingressbin':arg_10[5],\n            'transegressbin':arg_10[6]}", "path": "astrobase/periodbase/kbls.py", "identifier": "_bls_runner", "docstring": "This runs the pyeebls.eebls function using the given inputs.\n\n    Parameters\n    ----------\n\n    times,mags : np.array\n        The input magnitude time-series to search for transits.\n\n    nfreq : int\n        The number of frequencies to use when searching for transits.\n\n    freqmin : float\n        The minimum frequency of the period-search -> max period that will be\n        used for the search.\n\n    stepsize : float\n        The step-size in frequency to use to generate a frequency-grid.\n\n    nbins : int\n        The number of phase bins to use.\n\n    minduration : float\n        The minimum fractional transit duration that will be considered.\n\n    maxduration : float\n        The maximum fractional transit duration that will be considered.\n\n    Returns\n    -------\n\n    dict\n        Returns a dict of the form::\n\n            {\n                'power':           the periodogram power array,\n                'bestperiod':      the best period found,\n                'bestpower':       the highest peak of the periodogram power,\n                'transdepth':      transit depth found by eebls.f,\n                'transduration':   transit duration found by eebls.f,\n                'transingressbin': transit ingress bin found by eebls.f,\n                'transegressbin':  transit egress bin found by eebls.f,\n            }", "docstring_tokens": ["This", "runs", "the", "pyeebls", ".", "eebls", "function", "using", "the", "given", "inputs", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 254875}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/base.py#L234-L248", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Evaluate the hook by its name", "language": "python", "parameters": "(self, name: str, ctx: list)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ")", "->", "Node", ":", "if", "arg_1", "not", "in", "arg_0", ".", "__class__", ".", "_hooks", ":", "arg_0", ".", "diagnostic", ".", "notify", "(", "error", ".", "Severity", ".", "ERROR", ",", "\"Unknown hook : %s\"", "%", "arg_1", ",", "error", ".", "LocationInfo", ".", "from_stream", "(", "arg_0", ".", "_stream", ",", "is_error", "=", "True", ")", ")", "raise", "arg_0", ".", "diagnostic", "arg_0", ".", "_lastRule", "=", "'#'", "+", "arg_1", "arg_6", "=", "arg_0", ".", "__class__", ".", "_hooks", "[", "arg_1", "]", "(", "arg_0", ",", "*", "arg_3", ")", "if", "type", "(", "arg_6", ")", "is", "not", "bool", ":", "raise", "TypeError", "(", "\"Your hook %r didn't return a bool value\"", "%", "arg_1", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4) -> Node:\n        \"\"\"Evaluate the hook by its name\"\"\"\n        if arg_1 not in arg_0.__class__._hooks:\n            # TODO: don't always throw error, could have return True by default\n            arg_0.diagnostic.notify(\n                error.Severity.ERROR,\n                \"Unknown hook : %s\" % arg_1,\n                error.LocationInfo.from_stream(arg_0._stream, is_error=True)\n            )\n            raise arg_0.diagnostic\n        arg_0._lastRule = '#' + arg_1\n        arg_6 = arg_0.__class__._hooks[arg_1](arg_0, *arg_3)\n        if type(arg_6) is not bool:\n            raise TypeError(\"Your hook %r didn't return a bool value\" % arg_1)\n        return arg_6", "path": "pyrser/parsing/base.py", "identifier": "BasicParser.eval_hook", "docstring": "Evaluate the hook by its name", "docstring_tokens": ["Evaluate", "the", "hook", "by", "its", "name"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254876}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/segments.py#L11-L15", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "returns the first 10 segments for a specific list.", "language": "python", "parameters": "(self, list_id, **queryparams)", "return_statement": "return self._mc_client._get(url=self._build_path(list_id, 'segments'), **queryparams)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "_mc_client", ".", "_get", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'segments'", ")", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        returns the first 10 segments for a specific list.\n        \"\"\"\n        return arg_0._mc_client._get(url=arg_0._build_path(arg_1, 'segments'), **arg_2)", "path": "mailchimp3/entities/segments.py", "identifier": "Segments.all", "docstring": "returns the first 10 segments for a specific list.", "docstring_tokens": ["returns", "the", "first", "10", "segments", "for", "a", "specific", "list", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 254877}
{"url": "https://github.com/bayangan1991/PYXInput/blob/a0bbdecaeccf7947378bde67e7de79433bfbd30e/pyxinput/read_state.py#L76-L84", "sha": "a0bbdecaeccf7947378bde67e7de79433bfbd30e", "docstring_summary": "Returns the current gamepad state. Buttons pressed is shown as a raw integer value.\n        Use rController.buttons for a list of buttons pressed.", "language": "python", "parameters": "(self)", "return_statement": "return state.XINPUT_GAMEPAD", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_xinput_state", "(", ")", "_xinput", ".", "XInputGetState", "(", "arg_0", ".", "ControllerID", "-", "1", ",", "pointer", "(", "arg_1", ")", ")", "arg_0", ".", "dwPacketNumber", "=", "arg_1", ".", "dwPacketNumber", "return", "arg_1", ".", "XINPUT_GAMEPAD"], "function": "def Func(arg_0):\n        \"\"\"Returns the current Func state. Buttons pressed is shown as a raw integer value.\n        Use rController.buttons for a list of buttons pressed.\n        \"\"\"\n        arg_1 = _xinput_state()\n        _xinput.XInputGetState(arg_0.ControllerID - 1, pointer(arg_1))\n        arg_0.dwPacketNumber = arg_1.dwPacketNumber\n\n        return arg_1.XINPUT_GAMEPAD", "path": "pyxinput/read_state.py", "identifier": "rController.gamepad", "docstring": "Returns the current gamepad state. Buttons pressed is shown as a raw integer value.\n        Use rController.buttons for a list of buttons pressed.", "docstring_tokens": ["Returns", "the", "current", "gamepad", "state", ".", "Buttons", "pressed", "is", "shown", "as", "a", "raw", "integer", "value", ".", "Use", "rController", ".", "buttons", "for", "a", "list", "of", "buttons", "pressed", "."], "nwo": "bayangan1991/PYXInput", "score": 0.31736401397382547, "idx": 254878}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L185-L194", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "use 1 colormap for the whole abf. You can change it!.", "language": "python", "parameters": "(self,colormap=None,reverse=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "pylab", ".", "cm", ".", "Dark2", "arg_0", ".", "cm", "=", "arg_1", "arg_0", ".", "colormap", "=", "[", "]", "for", "arg_4", "in", "range", "(", "arg_0", ".", "sweeps", ")", ":", "arg_0", ".", "colormap", ".", "append", "(", "arg_1", "(", "arg_4", "/", "arg_0", ".", "sweeps", ")", ")", "if", "arg_2", ":", "arg_0", ".", "colormap", ".", "reverse", "(", ")"], "function": "def Func(arg_0,arg_1=None,arg_2=False):\n        \"\"\"use 1 colormap for the whole abf. You can change it!.\"\"\"\n        if arg_1 is None:\n            arg_1 = pylab.cm.Dark2\n        arg_0.cm=arg_1\n        arg_0.colormap=[]\n        for arg_4 in range(arg_0.sweeps): #TODO: make this the only colormap\n            arg_0.colormap.append(arg_1(arg_4/arg_0.sweeps))\n        if arg_2:\n            arg_0.colormap.reverse()", "path": "doc/oldcode/swhlab/core/abf.py", "identifier": "ABF.generate_colormap", "docstring": "use 1 colormap for the whole abf. You can change it!.", "docstring_tokens": ["use", "1", "colormap", "for", "the", "whole", "abf", ".", "You", "can", "change", "it!", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 254879}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/activations.py#L89-L125", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Construct an activation function by name.", "language": "python", "parameters": "(name, layer, **kwargs)", "return_statement": "return Activation.build(name, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Activation", ")", ":", "return", "arg_0", "if", "'+'", "in", "arg_0", ":", "return", "functools", ".", "reduce", "(", "Compose", ",", "(", "Func", "(", "arg_3", ",", "arg_1", ",", "**", "arg_2", ")", "for", "arg_3", "in", "arg_0", ".", "split", "(", "'+'", ")", ")", ")", "arg_4", "=", "COMMON", ".", "get", "(", "arg_0", ")", "if", "arg_4", "is", "not", "None", ":", "arg_4", ".", "name", "=", "arg_0", "arg_4", ".", "params", "=", "[", "]", "return", "arg_4", "if", "arg_0", ".", "lower", "(", ")", ".", "startswith", "(", "'maxout'", ")", "and", "':'", "in", "arg_0", ":", "arg_0", ",", "arg_6", "=", "arg_0", ".", "split", "(", "':'", ",", "1", ")", "arg_2", "[", "'pieces'", "]", "=", "int", "(", "arg_6", ")", "arg_2", "[", "'name'", "]", "=", "arg_0", "arg_2", "[", "'layer'", "]", "=", "arg_1", "return", "Activation", ".", "Func", "(", "arg_0", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    '''Construct an activation function by name.\n\n    Parameters\n    ----------\n    name : str or :class:`Activation`\n        The name of the type of activation function to Func, or an\n        already-created instance of an activation function.\n    layer : :class:`theanets.layers.Layer`\n        The layer to which this activation will be applied.\n    kwargs : dict\n        Additional named arguments to pass to the activation constructor.\n\n    Returns\n    -------\n    activation : :class:`Activation`\n        A neural network activation function instance.\n    '''\n    if isinstance(arg_0, Activation):\n        return arg_0\n\n    if '+' in arg_0:\n        return functools.reduce(\n            Compose, (Func(arg_3, arg_1, **arg_2) for arg_3 in arg_0.split('+')))\n\n    arg_4 = COMMON.get(arg_0)\n    if arg_4 is not None:\n        arg_4.name = arg_0\n        arg_4.params = []\n        return arg_4\n\n    if arg_0.lower().startswith('maxout') and ':' in arg_0:\n        arg_0, arg_6 = arg_0.split(':', 1)\n        arg_2['pieces'] = int(arg_6)\n    arg_2['name'] = arg_0\n    arg_2['layer'] = arg_1\n    return Activation.Func(arg_0, **arg_2)", "path": "theanets/activations.py", "identifier": "build", "docstring": "Construct an activation function by name.\n\n    Parameters\n    ----------\n    name : str or :class:`Activation`\n        The name of the type of activation function to build, or an\n        already-created instance of an activation function.\n    layer : :class:`theanets.layers.Layer`\n        The layer to which this activation will be applied.\n    kwargs : dict\n        Additional named arguments to pass to the activation constructor.\n\n    Returns\n    -------\n    activation : :class:`Activation`\n        A neural network activation function instance.", "docstring_tokens": ["Construct", "an", "activation", "function", "by", "name", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 254880}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/storage.py#L255-L382", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Inserts all given nifti files from file_list into one dataset in fname.\n    This will not check if the dimensionality of all files match.", "language": "python", "parameters": "(file_path, h5path, file_list, newshape=None,\n                                  concat_axis=0, dtype=None, append=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "0", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ")", ":", "def", "isalambda", "(", "arg_7", ")", ":", "return", "isinstance", "(", "arg_7", ",", "type", "(", "lambda", ":", "None", ")", ")", "and", "arg_7", ".", "__name__", "==", "'<lambda>'", "arg_8", "=", "'w'", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "if", "arg_6", ":", "arg_8", "=", "'a'", "arg_9", "=", "[", "nib", ".", "load", "(", "vol", ")", "for", "vol", "in", "arg_2", "]", "arg_10", "=", "[", "np", ".", "array", "(", "arg_19", ".", "get_shape", "(", ")", ")", "for", "arg_19", "in", "arg_9", "]", "if", "arg_3", "is", "not", "None", ":", "if", "isalambda", "(", "arg_3", ")", ":", "arg_11", "=", "np", ".", "array", "(", "[", "arg_3", "(", "arg_22", ")", "for", "arg_22", "in", "arg_10", "]", ")", "else", ":", "arg_11", "=", "np", ".", "array", "(", "[", "arg_22", "for", "arg_22", "in", "arg_10", "]", ")", "for", "arg_12", "in", "arg_11", ":", "assert", "(", "len", "(", "arg_12", ")", "-", "1", "<", "arg_4", ")", "arg_13", "=", "arg_11", ".", "shape", "[", "1", "]", "arg_14", "=", "np", ".", "zeros", "(", "arg_13", ",", "arg_5", "=", "np", ".", "int", ")", "for", "arg_15", "in", "list", "(", "range", "(", "arg_13", ")", ")", ":", "if", "arg_15", "==", "arg_4", ":", "arg_14", "[", "arg_15", "]", "=", "np", ".", "sum", "(", "arg_11", "[", ":", ",", "arg_4", "]", ")", "else", ":", "arg_14", "[", "arg_15", "]", "=", "np", ".", "max", "(", "arg_11", "[", ":", ",", "arg_15", "]", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "arg_9", "[", "0", "]", ".", "get_data_dtype", "(", ")", "with", "h5py", ".", "File", "(", "arg_0", ",", "arg_8", ")", "as", "f", ":", "try", ":", "arg_16", "=", "0", "arg_17", "=", "f", ".", "create_group", "(", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", ")", "arg_18", "=", "arg_17", ".", "create_dataset", "(", "os", ".", "path", ".", "basename", "(", "arg_1", ")", ",", "arg_14", ",", "arg_5", ")", "for", "arg_19", "in", "arg_9", ":", "arg_12", "=", "arg_11", "[", "arg_16", ",", ":", "]", "def", "append_to_dataset", "(", "arg_18", ",", "arg_20", ",", "arg_21", ",", "arg_4", ")", ":", "arg_22", "=", "arg_21", ".", "shape", "arg_23", "=", "len", "(", "arg_22", ")", "if", "arg_23", "==", "1", ":", "if", "arg_4", "==", "0", ":", "arg_18", "[", "arg_20", "]", "=", "arg_21", "elif", "arg_23", "==", "2", ":", "if", "arg_4", "==", "0", ":", "arg_18", "[", "arg_20", "]", "=", "arg_21", "elif", "arg_4", "==", "1", ":", "arg_18", "[", "arg_20", "]", "=", "arg_21", "elif", "arg_23", "==", "3", ":", "if", "arg_4", "==", "0", ":", "arg_18", "[", "arg_20", "]", "=", "arg_21", "elif", "arg_4", "==", "1", ":", "arg_18", "[", "arg_20", "]", "=", "arg_21", "elif", "arg_4", "==", "2", ":", "arg_18", "[", "arg_20", "]", "=", "arg_21", "append_to_dataset", "(", "arg_18", ",", "arg_16", ",", "np", ".", "reshape", "(", "arg_19", ".", "get_data", "(", ")", ",", "tuple", "(", "arg_12", ")", ")", ",", "arg_4", ")", "arg_16", "+=", "1", "except", "ValueError", "as", "ve", ":", "raise", "Exception", "(", "'Error creating group {} in hdf file {}'", ".", "format", "(", "arg_1", ",", "arg_0", ")", ")", "from", "ve"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None,\n                                  arg_4=0, arg_5=None, arg_6=True):\n    \"\"\"Inserts all given nifti files from file_list into one dataset in fname.\n    This will not check if the dimensionality of all files match.\n\n    Parameters\n    ----------\n    file_path: string\n        HDF5 file path\n\n    h5path: string\n\n    file_list: list of strings\n\n    newshape: tuple or lambda function\n        If None, it will not reshape the images.\n        If a lambda function, this lambda will receive only the shape array.\n        e.g., newshape = lambda x: (np.prod(x[0:3]), x[3])\n        If a tuple, it will try to reshape all the images with the same shape.\n        It must work for all the images in file_list.\n\n    concat_axis: int\n        Axis of concatenation after reshaping\n\n    dtype: data type\n    Dataset data type\n    If not set, will use the type of the first file.\n\n    append: bool\n\n    Raises\n    ------\n    ValueError if concat_axis is bigger than data dimensionality.\n\n    Note\n    ----\n    For now, this only works if the dataset ends up being a 2D matrix.\n    I haven't tested for multi-dimensionality concatenations.\n    \"\"\"\n\n    def isalambda(arg_7):\n        return isinstance(arg_7, type(lambda: None)) and arg_7.__name__ == '<lambda>'\n\n    arg_8 = 'w'\n    if os.path.exists(arg_0):\n        if arg_6:\n            arg_8 = 'a'\n\n    #loading the metadata into spatialimages\n    arg_9 = [nib.load(vol) for vol in arg_2]\n\n    #getting the shapes of all volumes\n    arg_10 = [np.array(arg_19.get_shape()) for arg_19 in arg_9]\n\n    #getting the reshaped shapes\n    if arg_3 is not None:\n        if isalambda(arg_3):\n            arg_11 = np.array([arg_3(arg_22) for arg_22 in arg_10])\n        else:\n            arg_11 = np.array([arg_22 for arg_22 in arg_10])\n\n    #checking if concat_axis is available in this new shapes\n    for arg_12 in arg_11:\n        assert(len(arg_12) - 1 < arg_4)\n\n    #calculate the shape of the new dataset\n    arg_13 = arg_11.shape[1]\n    arg_14 = np.zeros(arg_13, arg_5=np.int)\n    for arg_15 in list(range(arg_13)):\n        if arg_15 == arg_4:\n            arg_14[arg_15] = np.sum(arg_11[:, arg_4])\n        else:\n            arg_14[arg_15] = np.max(arg_11[:, arg_15])\n\n    #get the type of the new dataset\n    #dtypes = [img.get_data_dtype() for img in imgs]\n    if arg_5 is None:\n        arg_5 = arg_9[0].get_data_dtype()\n\n    with h5py.File(arg_0, arg_8) as f:\n        try:\n            arg_16 = 0\n            arg_17 = f.create_group(os.path.dirname(arg_1))\n            arg_18 = arg_17.create_dataset(os.path.basename(arg_1),\n                                        arg_14, arg_5)\n            for arg_19 in arg_9:\n\n                #get the shape of the current image\n                arg_12 = arg_11[arg_16, :]\n\n                def append_to_dataset(arg_18, arg_20, arg_21, arg_4):\n                    \"\"\"\n                    @param h5ds: H5py DataSet\n                    @param idx: int\n                    @param data: ndarray\n                    @param concat_axis: int\n                    @return:\n                    \"\"\"\n                    arg_22 = arg_21.shape\n                    arg_23 = len(arg_22)\n\n                    if arg_23 == 1:\n                        if arg_4 == 0:\n                            arg_18[arg_20] = arg_21\n\n                    elif arg_23 == 2:\n                        if arg_4 == 0:\n                            arg_18[arg_20 ] = arg_21\n                        elif arg_4 == 1:\n                            arg_18[arg_20 ] = arg_21\n\n                    elif arg_23 == 3:\n                        if arg_4 == 0:\n                            arg_18[arg_20 ] = arg_21\n                        elif arg_4 == 1:\n                            arg_18[arg_20 ] = arg_21\n                        elif arg_4 == 2:\n                            arg_18[arg_20 ] = arg_21\n\n                #appending the reshaped image into the dataset\n                append_to_dataset(arg_18, arg_16,\n                                  np.reshape(arg_19.get_data(), tuple(arg_12)),\n                                  arg_4)\n\n                arg_16 += 1\n\n        except ValueError as ve:\n            raise Exception('Error creating group {} in hdf file {}'.format(arg_1, arg_0)) from ve", "path": "boyle/nifti/storage.py", "identifier": "insert_volumes_in_one_dataset", "docstring": "Inserts all given nifti files from file_list into one dataset in fname.\n    This will not check if the dimensionality of all files match.\n\n    Parameters\n    ----------\n    file_path: string\n        HDF5 file path\n\n    h5path: string\n\n    file_list: list of strings\n\n    newshape: tuple or lambda function\n        If None, it will not reshape the images.\n        If a lambda function, this lambda will receive only the shape array.\n        e.g., newshape = lambda x: (np.prod(x[0:3]), x[3])\n        If a tuple, it will try to reshape all the images with the same shape.\n        It must work for all the images in file_list.\n\n    concat_axis: int\n        Axis of concatenation after reshaping\n\n    dtype: data type\n    Dataset data type\n    If not set, will use the type of the first file.\n\n    append: bool\n\n    Raises\n    ------\n    ValueError if concat_axis is bigger than data dimensionality.\n\n    Note\n    ----\n    For now, this only works if the dataset ends up being a 2D matrix.\n    I haven't tested for multi-dimensionality concatenations.", "docstring_tokens": ["Inserts", "all", "given", "nifti", "files", "from", "file_list", "into", "one", "dataset", "in", "fname", ".", "This", "will", "not", "check", "if", "the", "dimensionality", "of", "all", "files", "match", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 254881}
{"url": "https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/plugins/sphinxsearch_plugin.py#L151-L174", "sha": "cd4d06857c88291769bc38e5c9573f43b7ffcd6a", "docstring_summary": "Wait until we can make a socket connection to sphinx.", "language": "python", "parameters": "(self, port)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "arg_3", "=", "10", "arg_4", "=", "0", "arg_5", "=", "0.5", "while", "not", "arg_2", "or", "arg_4", ">=", "arg_3", ":", "time", ".", "sleep", "(", "arg_5", ")", "try", ":", "arg_6", "=", "socket", ".", "AF_INET", "arg_7", "=", "(", "'127.0.0.1'", ",", "arg_1", ")", "arg_8", "=", "socket", ".", "socket", "(", "arg_6", ",", "socket", ".", "SOCK_STREAM", ")", "arg_8", ".", "connect", "(", "arg_7", ")", "except", "socket", ".", "error", ":", "if", "arg_8", ":", "arg_8", ".", "close", "(", ")", "arg_4", "+=", "1", "continue", "arg_2", "=", "True", "if", "not", "arg_2", ":", "print", "(", "\"Error connecting to sphinx searchd\"", ",", "file", "=", "sys", ".", "stderr", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Wait until we can make a socket connection to sphinx.\n        \"\"\"\n        arg_2 = False\n        arg_3 = 10\n        arg_4 = 0\n        arg_5 = 0.5\n        while not arg_2 or arg_4 >= arg_3:\n            time.sleep(arg_5)\n            try:\n                arg_6 = socket.AF_INET\n                arg_7 = ('127.0.0.1', arg_1)\n                arg_8 = socket.socket(arg_6, socket.SOCK_STREAM)\n                arg_8.connect(arg_7)\n            except socket.error:\n                if arg_8:\n                    arg_8.close()\n                arg_4 += 1\n                continue\n            arg_2 = True\n\n        if not arg_2:\n            print(\"Error connecting to sphinx searchd\", file=sys.stderr)", "path": "nosedjango/plugins/sphinxsearch_plugin.py", "identifier": "SphinxSearchPlugin._wait_for_connection", "docstring": "Wait until we can make a socket connection to sphinx.", "docstring_tokens": ["Wait", "until", "we", "can", "make", "a", "socket", "connection", "to", "sphinx", "."], "nwo": "nosedjango/nosedjango", "score": 0.27365494979801214, "idx": 254882}
{"url": "https://github.com/bheinzerling/descriptors/blob/04fff864649fba9bd6a2d8f8b649cf30994e0e46/descriptors/massproduced.py#L80-L87", "sha": "04fff864649fba9bd6a2d8f8b649cf30994e0e46", "docstring_summary": "Turn a funcs list element into a class object.", "language": "python", "parameters": "(clsname, func, attrs)", "return_statement": "return clsobj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "\"__set__\"", ":", "create_setter", "(", "arg_1", ",", "arg_2", ")", "}", "if", "len", "(", "arg_2", ")", ">", "0", ":", "arg_3", "[", "\"__init__\"", "]", "=", "create_init", "(", "arg_2", ")", "arg_4", "=", "type", "(", "str", "(", "arg_0", ")", ",", "(", "Descriptor", ",", ")", ",", "arg_3", ")", "arg_4", ".", "__doc__", "=", "docstrings", ".", "get", "(", "arg_0", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Turn a funcs list element into a class object.\"\"\"\n    arg_3 = {\"__set__\": create_setter(arg_1, arg_2)}\n    if len(arg_2) > 0:\n        arg_3[\"__init__\"] = create_init(arg_2)\n    arg_4 = type(str(arg_0), (Descriptor, ), arg_3)\n    arg_4.__doc__ = docstrings.get(arg_0)\n    return arg_4", "path": "descriptors/massproduced.py", "identifier": "make_class", "docstring": "Turn a funcs list element into a class object.", "docstring_tokens": ["Turn", "a", "funcs", "list", "element", "into", "a", "class", "object", "."], "nwo": "bheinzerling/descriptors", "score": 0.16941397159673272, "idx": 254883}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L50-L113", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Utility function for creating enumerations in python", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return newType", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "def", "arg_9", "(", "arg_2", ",", "arg_3", ")", ":", "return", "arg_2", ".", "__labels", "[", "arg_3", "]", "def", "arg_10", "(", "arg_2", ",", "arg_3", ")", ":", "return", "arg_3", "in", "arg_2", ".", "__values", "def", "arg_11", "(", "arg_2", ")", ":", "return", "list", "(", "arg_2", ".", "__values", ")", "def", "arg_12", "(", "arg_2", ")", ":", "return", "list", "(", "arg_2", ".", "__labels", ".", "values", "(", ")", ")", "def", "arg_13", "(", "arg_2", ",", "arg_4", ")", ":", "return", "arg_2", ".", "__labels", "[", "arg_4", "]", "for", "arg_5", "in", "list", "(", "arg_0", ")", "+", "arg_1", ".", "keys", "(", ")", ":", "if", "type", "(", "arg_5", ")", "is", "not", "str", ":", "raise", "TypeError", "(", "\"Func arg {0} must be a string\"", ".", "format", "(", "arg_5", ")", ")", "if", "not", "__isidentifier", "(", "arg_5", ")", ":", "raise", "ValueError", "(", "\"Invalid enum value '{0}'. \"", "\"'{0}' is not a valid identifier\"", ".", "format", "(", "arg_5", ")", ")", "arg_1", ".", "update", "(", "zip", "(", "arg_0", ",", "arg_0", ")", ")", "arg_6", "=", "type", "(", "\"Func\"", ",", "(", "object", ",", ")", ",", "arg_1", ")", "arg_6", ".", "__labels", "=", "dict", "(", "(", "v", ",", "k", ")", "for", "k", ",", "v", "in", "arg_1", ".", "iteritems", "(", ")", ")", "arg_6", ".", "__values", "=", "set", "(", "arg_6", ".", "__labels", ".", "keys", "(", ")", ")", "arg_6", ".", "getLabel", "=", "functools", ".", "partial", "(", "arg_9", ",", "arg_6", ")", "arg_6", ".", "validate", "=", "functools", ".", "partial", "(", "arg_10", ",", "arg_6", ")", "arg_6", ".", "getValues", "=", "functools", ".", "partial", "(", "arg_11", ",", "arg_6", ")", "arg_6", ".", "getLabels", "=", "functools", ".", "partial", "(", "arg_12", ",", "arg_6", ")", "arg_6", ".", "getValue", "=", "functools", ".", "partial", "(", "arg_13", ",", "arg_6", ")", "return", "arg_6"], "function": "def Func(*arg_0, **arg_1):\n  \"\"\"\n  Utility function for creating enumerations in python\n\n  Example Usage:\n    >> Color = Func(\"Red\", \"Green\", \"Blue\", \"Magenta\")\n    >> print Color.Red\n    >> 0\n    >> print Color.Green\n    >> 1\n    >> print Color.Blue\n    >> 2\n    >> print Color.Magenta\n    >> 3\n    >> Color.Violet\n    >> 'violet'\n    >> Color.getLabel(Color.Red)\n    >> 'Red'\n    >> Color.getLabel(2)\n    >> 'Blue'\n  \"\"\"\n\n  def arg_9(arg_2, arg_3):\n    \"\"\" Get a string label for the current value of the enum \"\"\"\n    return arg_2.__labels[arg_3]\n\n  def arg_10(arg_2, arg_3):\n    \"\"\" Returns True if val is a valid value for the enumeration \"\"\"\n    return arg_3 in arg_2.__values\n\n  def arg_11(arg_2):\n    \"\"\" Returns a list of all the possible values for this enum \"\"\"\n    return list(arg_2.__values)\n\n  def arg_12(arg_2):\n    \"\"\" Returns a list of all possible labels for this enum \"\"\"\n    return list(arg_2.__labels.values())\n\n  def arg_13(arg_2, arg_4):\n    \"\"\" Returns value given a label \"\"\"\n    return arg_2.__labels[arg_4]\n\n\n  for arg_5 in list(arg_0)+arg_1.keys():\n    if type(arg_5) is not str:\n      raise TypeError(\"Func arg {0} must be a string\".format(arg_5))\n\n    if not __isidentifier(arg_5):\n      raise ValueError(\"Invalid enum value '{0}'. \"\\\n                       \"'{0}' is not a valid identifier\".format(arg_5))\n\n  #kwargs.update(zip(args, range(len(args))))\n  arg_1.update(zip(arg_0, arg_0))\n  arg_6 = type(\"Func\", (object,), arg_1)\n\n  arg_6.__labels = dict( (v,k) for k,v in arg_1.iteritems())\n  arg_6.__values = set(arg_6.__labels.keys())\n  arg_6.getLabel = functools.partial(arg_9, arg_6)\n  arg_6.validate = functools.partial(arg_10, arg_6)\n  arg_6.getValues = functools.partial(arg_11, arg_6)\n  arg_6.getLabels = functools.partial(arg_12, arg_6)\n  arg_6.getValue = functools.partial(arg_13, arg_6)\n\n  return arg_6", "path": "src/nupic/swarming/hypersearch/support.py", "identifier": "Enum", "docstring": "Utility function for creating enumerations in python\n\n  Example Usage:\n    >> Color = Enum(\"Red\", \"Green\", \"Blue\", \"Magenta\")\n    >> print Color.Red\n    >> 0\n    >> print Color.Green\n    >> 1\n    >> print Color.Blue\n    >> 2\n    >> print Color.Magenta\n    >> 3\n    >> Color.Violet\n    >> 'violet'\n    >> Color.getLabel(Color.Red)\n    >> 'Red'\n    >> Color.getLabel(2)\n    >> 'Blue'", "docstring_tokens": ["Utility", "function", "for", "creating", "enumerations", "in", "python"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254884}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/base.py#L16-L36", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Get the full object from spotify with a `href` attribute.", "language": "python", "parameters": "(self)", "return_statement": "return cls(client, data)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'href'", ")", ":", "raise", "TypeError", "(", "'Spotify object has no `href` attribute, therefore cannot be retrived'", ")", "elif", "hasattr", "(", "arg_0", ",", "'http'", ")", ":", "return", "await", "arg_0", ".", "http", ".", "request", "(", "(", "'GET'", ",", "arg_0", ".", "href", ")", ")", "else", ":", "arg_1", "=", "type", "(", "arg_0", ")", "try", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "'_{0}__client'", ".", "format", "(", "arg_1", ".", "__name__", ")", ")", "except", "AttributeError", ":", "raise", "TypeError", "(", "'Spotify object has no way to access a HTTPClient.'", ")", "else", ":", "arg_3", "=", "arg_2", ".", "http", "arg_4", "=", "await", "arg_3", ".", "request", "(", "(", "'GET'", ",", "arg_0", ".", "href", ")", ")", "return", "arg_1", "(", "arg_2", ",", "arg_4", ")"], "function": "async def Func(arg_0):\n        \"\"\"Get the full object from spotify with a `href` attribute.\"\"\"\n        if not hasattr(arg_0, 'href'):\n            raise TypeError('Spotify object has no `href` attribute, therefore cannot be retrived')\n\n        elif hasattr(arg_0, 'http'):\n            return await arg_0.http.request(('GET', arg_0.href))\n\n        else:\n            arg_1 = type(arg_0)\n\n        try:\n            arg_2 = getattr(arg_0, '_{0}__client'.format(arg_1.__name__))\n        except AttributeError:\n            raise TypeError('Spotify object has no way to access a HTTPClient.')\n        else:\n            arg_3 = arg_2.http\n\n        arg_4 = await arg_3.request(('GET', arg_0.href))\n\n        return arg_1(arg_2, arg_4)", "path": "spotify/models/base.py", "identifier": "SpotifyBase.from_href", "docstring": "Get the full object from spotify with a `href` attribute.", "docstring_tokens": ["Get", "the", "full", "object", "from", "spotify", "with", "a", "href", "attribute", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 254885}
{"url": "https://github.com/JIC-CSB/jicbioimage.illustrate/blob/d88ddf81ee3eb3949677e2ef746af8169ce88092/jicbioimage/illustrate/__init__.py#L88-L98", "sha": "d88ddf81ee3eb3949677e2ef746af8169ce88092", "docstring_summary": "Draw a line between pos1 and pos2 on the canvas.", "language": "python", "parameters": "(self, pos1, pos2, color=(255, 0, 0))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "(", "255", ",", "0", ",", "0", ")", ")", ":", "arg_4", ",", "arg_5", "=", "tuple", "(", "[", "int", "(", "round", "(", "i", ",", "0", ")", ")", "for", "i", "in", "arg_1", "]", ")", "arg_6", ",", "arg_7", "=", "tuple", "(", "[", "int", "(", "round", "(", "i", ",", "0", ")", ")", "for", "i", "in", "arg_2", "]", ")", "arg_8", ",", "arg_9", "=", "skimage", ".", "draw", ".", "line", "(", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "arg_0", "[", "arg_8", ",", "arg_9", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=(255, 0, 0)):\n        \"\"\"Draw a line between pos1 and pos2 on the canvas.\n\n        :param pos1: position 1 (row, col) tuple\n        :param pos2: position 2 (row, col) tuple\n        :param color: RGB tuple\n        \"\"\"\n        arg_4, arg_5 = tuple([int(round(i, 0)) for i in arg_1])\n        arg_6, arg_7 = tuple([int(round(i, 0)) for i in arg_2])\n        arg_8, arg_9 = skimage.draw.line(arg_4, arg_5, arg_6, arg_7)\n        arg_0[arg_8, arg_9] = arg_3", "path": "jicbioimage/illustrate/__init__.py", "identifier": "Canvas.draw_line", "docstring": "Draw a line between pos1 and pos2 on the canvas.\n\n        :param pos1: position 1 (row, col) tuple\n        :param pos2: position 2 (row, col) tuple\n        :param color: RGB tuple", "docstring_tokens": ["Draw", "a", "line", "between", "pos1", "and", "pos2", "on", "the", "canvas", "."], "nwo": "JIC-CSB/jicbioimage.illustrate", "score": 0.0, "idx": 254886}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/util/filesys.py#L58-L105", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Context manager that GETs a given `url` and provides it as a local file.", "language": "python", "parameters": "(url, ext=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "arg_1", "=", "'.'", "+", "arg_1", ".", "strip", "(", "'.'", ")", "arg_2", "=", "'www-{}-'", ".", "format", "(", "urlparse", "(", "arg_0", ")", ".", "hostname", "or", "'any'", ")", "if", "arg_0", ".", "startswith", "(", "'file://'", ")", ":", "arg_0", "=", "os", ".", "path", ".", "abspath", "(", "arg_0", "[", "len", "(", "'file://'", ")", ":", "]", ")", "if", "os", ".", "path", ".", "isabs", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "handle", ":", "arg_3", "=", "handle", ".", "read", "(", ")", "else", ":", "arg_3", "=", "requests", ".", "get", "(", "arg_0", ")", ".", "content", "with", "tempfile", ".", "NamedTemporaryFile", "(", "suffix", "=", "arg_1", "or", "''", ",", "prefix", "=", "arg_2", ",", "delete", "=", "False", ")", "as", "handle", ":", "handle", ".", "write", "(", "arg_3", ")", "try", ":", "yield", "handle", ".", "name", "finally", ":", "if", "os", ".", "path", ".", "exists", "(", "handle", ".", "name", ")", ":", "os", ".", "remove", "(", "handle", ".", "name", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n        Context manager that GETs a given `url` and provides it as a local file.\n\n        The file is in a closed state upon entering the context,\n        and removed when leaving it, if still there.\n\n        To give the file name a specific extension, use `ext`;\n        the extension can optionally include a separating dot,\n        otherwise it will be added.\n\n        Parameters:\n            url (str): URL to retrieve.\n            ext (str, optional): Extension for the generated filename.\n\n        Yields:\n            str: The path to a temporary file with the content of the URL.\n\n        Raises:\n            requests.RequestException: Base exception of ``requests``, see its\n                docs for more detailed ones.\n\n        Example:\n            >>> import io, re, json\n            >>> with Func('https://api.github.com/meta', ext='json') as meta:\n            ...     meta, json.load(io.open(meta, encoding='ascii'))['hooks']\n            (u'/tmp/www-api.github.com-Ba5OhD.json', [u'192.30.252.0/22'])\n    \"\"\"\n    if arg_1:\n        arg_1 = '.' + arg_1.strip('.')  # normalize extension\n    arg_2 = 'www-{}-'.format(urlparse(arg_0).hostname or 'any')\n\n    if arg_0.startswith('file://'):\n        arg_0 = os.path.abspath(arg_0[len('file://'):])\n    if os.path.isabs(arg_0):\n        with open(arg_0, 'rb') as handle:\n            arg_3 = handle.read()\n    else:\n        arg_3 = requests.get(arg_0).content\n\n    with tempfile.NamedTemporaryFile(suffix=arg_1 or '', prefix=arg_2, delete=False) as handle:\n        handle.write(arg_3)\n\n    try:\n        yield handle.name\n    finally:\n        if os.path.exists(handle.name):\n            os.remove(handle.name)", "path": "src/rituals/util/filesys.py", "identifier": "url_as_file", "docstring": "Context manager that GETs a given `url` and provides it as a local file.\n\n        The file is in a closed state upon entering the context,\n        and removed when leaving it, if still there.\n\n        To give the file name a specific extension, use `ext`;\n        the extension can optionally include a separating dot,\n        otherwise it will be added.\n\n        Parameters:\n            url (str): URL to retrieve.\n            ext (str, optional): Extension for the generated filename.\n\n        Yields:\n            str: The path to a temporary file with the content of the URL.\n\n        Raises:\n            requests.RequestException: Base exception of ``requests``, see its\n                docs for more detailed ones.\n\n        Example:\n            >>> import io, re, json\n            >>> with url_as_file('https://api.github.com/meta', ext='json') as meta:\n            ...     meta, json.load(io.open(meta, encoding='ascii'))['hooks']\n            (u'/tmp/www-api.github.com-Ba5OhD.json', [u'192.30.252.0/22'])", "docstring_tokens": ["Context", "manager", "that", "GETs", "a", "given", "url", "and", "provides", "it", "as", "a", "local", "file", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 254887}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/lshforest.py#L62-L68", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Index all the keys added so far and make them searchable.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "arg_0", ".", "hashtables", ")", ":", "arg_0", ".", "sorted_hashtables", "[", "arg_1", "]", "=", "[", "H", "for", "H", "in", "arg_2", ".", "keys", "(", ")", "]", "arg_0", ".", "sorted_hashtables", "[", "arg_1", "]", ".", "sort", "(", ")"], "function": "def Func(arg_0):\n        '''\n        Index all the keys added so far and make them searchable.\n        '''\n        for arg_1, arg_2 in enumerate(arg_0.hashtables):\n            arg_0.sorted_hashtables[arg_1] = [H for H in arg_2.keys()]\n            arg_0.sorted_hashtables[arg_1].sort()", "path": "datasketch/lshforest.py", "identifier": "MinHashLSHForest.index", "docstring": "Index all the keys added so far and make them searchable.", "docstring_tokens": ["Index", "all", "the", "keys", "added", "so", "far", "and", "make", "them", "searchable", "."], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 254888}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L1026-L1062", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Download H2O log files to disk.", "language": "python", "parameters": "(dirname=\".\", filename=None)", "return_statement": "return path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\".\"", ",", "arg_1", "=", "None", ")", ":", "assert_is_type", "(", "arg_0", ",", "str", ")", "assert_is_type", "(", "arg_1", ",", "str", ",", "None", ")", "arg_2", "=", "\"%s/3/Logs/download\"", "%", "h2oconn", ".", "base_url", "arg_3", "=", "urlopen", "(", ")", "arg_4", "=", "arg_3", "(", "arg_2", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "os", ".", "mkdir", "(", "arg_0", ")", "if", "arg_1", "is", "None", ":", "if", "PY3", ":", "arg_5", "=", "[", "arg_6", "[", "1", "]", "for", "arg_6", "in", "arg_4", ".", "headers", ".", "_headers", "]", "else", ":", "arg_5", "=", "arg_4", ".", "headers", ".", "headers", "for", "arg_6", "in", "arg_5", ":", "if", "\"filename=\"", "in", "arg_6", ":", "arg_1", "=", "arg_6", ".", "split", "(", "\"filename=\"", ")", "[", "1", "]", ".", "strip", "(", ")", "break", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", "arg_4", "=", "arg_3", "(", "arg_2", ")", ".", "read", "(", ")", "print", "(", "\"Writing H2O logs to \"", "+", "arg_7", ")", "with", "open", "(", "arg_7", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_4", ")", "return", "arg_7"], "function": "def Func(arg_0=\".\", arg_1=None):\n    \"\"\"\n    Download H2O log files to disk.\n\n    :param dirname: a character string indicating the directory that the log file should be saved in.\n    :param filename: a string indicating the name that the CSV file should be. Note that the saved format is .zip, so the file name must include the .zip extension.\n\n    :returns: path of logs written in a zip file.\n\n    :examples: The following code will save the zip file `'autoh2o_log.zip'` in a directory that is one down from where you are currently working into a directory called `your_directory_name`. (Please note that `your_directory_name` should be replaced with the name of the directory that you've created and that already exists.)\n\n        >>> h2o.Func(dirname='./your_directory_name/', filename = 'autoh2o_log.zip')\n\n    \"\"\"\n    assert_is_type(arg_0, str)\n    assert_is_type(arg_1, str, None)\n    arg_2 = \"%s/3/Logs/download\" % h2oconn.base_url\n    arg_3 = urlopen()\n    arg_4 = arg_3(arg_2)\n\n    if not os.path.exists(arg_0): os.mkdir(arg_0)\n    if arg_1 is None:\n        if PY3:\n            arg_5 = [arg_6[1] for arg_6 in arg_4.headers._headers]\n        else:\n            arg_5 = arg_4.headers.headers\n        for arg_6 in arg_5:\n            if \"filename=\" in arg_6:\n                arg_1 = arg_6.split(\"filename=\")[1].strip()\n                break\n    arg_7 = os.path.join(arg_0, arg_1)\n    arg_4 = arg_3(arg_2).read()\n\n    print(\"Writing H2O logs to \" + arg_7)\n    with open(arg_7, \"wb\") as f:\n        f.write(arg_4)\n    return arg_7", "path": "h2o-py/h2o/h2o.py", "identifier": "download_all_logs", "docstring": "Download H2O log files to disk.\n\n    :param dirname: a character string indicating the directory that the log file should be saved in.\n    :param filename: a string indicating the name that the CSV file should be. Note that the saved format is .zip, so the file name must include the .zip extension.\n\n    :returns: path of logs written in a zip file.\n\n    :examples: The following code will save the zip file `'autoh2o_log.zip'` in a directory that is one down from where you are currently working into a directory called `your_directory_name`. (Please note that `your_directory_name` should be replaced with the name of the directory that you've created and that already exists.)\n\n        >>> h2o.download_all_logs(dirname='./your_directory_name/', filename = 'autoh2o_log.zip')", "docstring_tokens": ["Download", "H2O", "log", "files", "to", "disk", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 254889}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/utils.py#L35-L43", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "`pgrep` returns an error code if no process was found", "language": "python", "parameters": "(process)", "return_statement": "return flag", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "sh", ".", "Command", "(", "'/usr/bin/pgrep'", ")", "arg_1", "(", "arg_0", ")", "arg_2", "=", "True", "except", "sh", ".", "ErrorReturnCode_1", ":", "arg_2", "=", "False", "return", "arg_2"], "function": "def Func(arg_0):\n    ''' `pgrep` returns an error code if no process was found '''\n    try:\n        arg_1 = sh.Command('/usr/bin/pgrep')\n        arg_1(arg_0)\n        arg_2 = True\n    except sh.ErrorReturnCode_1:\n        arg_2 = False\n    return arg_2", "path": "python/dna/utils.py", "identifier": "is_running", "docstring": "`pgrep` returns an error code if no process was found", "docstring_tokens": ["pgrep", "returns", "an", "error", "code", "if", "no", "process", "was", "found"], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 254890}
{"url": "https://github.com/what-studio/tossi/blob/88bc8523c05fe7b7e23518ee0398ee0a18ba0bc0/tossi/coda.py#L122-L133", "sha": "88bc8523c05fe7b7e23518ee0398ee0a18ba0bc0", "docstring_summary": "Picks only a coda from a decimal.", "language": "python", "parameters": "(decimal)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "Decimal", "(", "arg_0", ")", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", ".", "as_tuple", "(", ")", "if", "arg_3", "<", "0", ":", "return", "DIGIT_CODAS", "[", "arg_2", "[", "-", "1", "]", "]", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", ".", "normalize", "(", ")", ".", "as_tuple", "(", ")", "arg_4", "=", "bisect_right", "(", "EXP_INDICES", ",", "arg_3", ")", "-", "1", "if", "arg_4", "<", "0", ":", "return", "DIGIT_CODAS", "[", "arg_2", "[", "-", "1", "]", "]", "else", ":", "return", "EXP_CODAS", "[", "EXP_INDICES", "[", "arg_4", "]", "]"], "function": "def Func(arg_0):\n    \"\"\"Picks only a coda from a decimal.\"\"\"\n    arg_0 = Decimal(arg_0)\n    arg_1, arg_2, arg_3 = arg_0.as_tuple()\n    if arg_3 < 0:\n        return DIGIT_CODAS[arg_2[-1]]\n    arg_1, arg_2, arg_3 = arg_0.normalize().as_tuple()\n    arg_4 = bisect_right(EXP_INDICES, arg_3) - 1\n    if arg_4 < 0:\n        return DIGIT_CODAS[arg_2[-1]]\n    else:\n        return EXP_CODAS[EXP_INDICES[arg_4]]", "path": "tossi/coda.py", "identifier": "pick_coda_from_decimal", "docstring": "Picks only a coda from a decimal.", "docstring_tokens": ["Picks", "only", "a", "coda", "from", "a", "decimal", "."], "nwo": "what-studio/tossi", "score": 0.28433842921098695, "idx": 254891}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/osm_transfers.py#L15-L74", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Computes the walk paths between stops, and updates these to the gtfs database.", "language": "python", "parameters": "(gtfs, osm_path, cutoff_distance_m=1000)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1000", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "GTFS", "(", "arg_0", ")", "assert", "(", "isinstance", "(", "arg_0", ",", "GTFS", ")", ")", "print", "(", "\"Reading in walk network\"", ")", "arg_3", "=", "create_walk_network_from_osm", "(", "arg_1", ")", "print", "(", "\"Matching stops to the OSM network\"", ")", "arg_4", ",", "arg_5", "=", "match_stops_to_nodes", "(", "arg_0", ",", "arg_3", ")", "arg_6", "=", "arg_0", ".", "get_straight_line_transfer_distances", "(", ")", "arg_7", "=", "{", "stop_I", ":", "set", "(", ")", "for", "stop_I", "in", "arg_4", "}", "for", "arg_8", "in", "arg_6", ".", "itertuples", "(", ")", ":", "arg_9", "=", "arg_8", ".", "from_stop_I", "arg_10", "=", "arg_8", ".", "to_stop_I", "arg_7", "[", "arg_9", "]", ".", "add", "(", "arg_10", ")", "print", "(", "\"Computing walking distances\"", ")", "for", "arg_9", ",", "arg_11", "in", "arg_7", ".", "items", "(", ")", ":", "arg_12", "=", "arg_4", "[", "arg_9", "]", "arg_13", "=", "arg_5", "[", "arg_9", "]", "arg_14", "=", "networkx", ".", "single_source_dijkstra_path_length", "(", "arg_3", ",", "arg_12", ",", "cutoff", "=", "arg_2", "-", "arg_13", ",", "weight", "=", "\"distance\"", ")", "for", "arg_10", "in", "arg_11", ":", "arg_15", "=", "arg_5", "[", "arg_10", "]", "arg_16", "=", "arg_4", "[", "arg_10", "]", "arg_17", "=", "arg_14", ".", "get", "(", "arg_16", ",", "float", "(", "'inf'", ")", ")", "arg_18", "=", "arg_13", "+", "arg_17", "+", "arg_15", "arg_19", "=", "arg_6", "[", "arg_6", "[", "'from_stop_I'", "]", "==", "arg_9", "]", "arg_20", "=", "arg_19", "[", "arg_19", "[", "\"to_stop_I\"", "]", "==", "arg_10", "]", "[", "\"d\"", "]", ".", "values", "[", "0", "]", "assert", "(", "arg_20", "<", "arg_18", "+", "2", ")", "if", "arg_18", "<=", "arg_2", ":", "arg_0", ".", "conn", ".", "execute", "(", "\"UPDATE stop_distances \"", "\"SET d_walk = \"", "+", "str", "(", "int", "(", "arg_18", ")", ")", "+", "\" WHERE from_stop_I=\"", "+", "str", "(", "arg_9", ")", "+", "\" AND to_stop_I=\"", "+", "str", "(", "arg_10", ")", ")", "arg_0", ".", "conn", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=1000):\n    \"\"\"\n    Computes the walk paths between stops, and updates these to the gtfs database.\n\n    Parameters\n    ----------\n    gtfs: gtfspy.GTFS or str\n        A GTFS object or a string representation.\n    osm_path: str\n        path to the OpenStreetMap file\n    cutoff_distance_m: number\n        maximum allowed distance in meters\n\n    Returns\n    -------\n    None\n\n    See Also\n    --------\n    gtfspy.calc_transfers\n    compute_walk_paths_java\n    \"\"\"\n    if isinstance(arg_0, str):\n        arg_0 = GTFS(arg_0)\n    assert (isinstance(arg_0, GTFS))\n    print(\"Reading in walk network\")\n    arg_3 = create_walk_network_from_osm(arg_1)\n    print(\"Matching stops to the OSM network\")\n    arg_4, arg_5 = match_stops_to_nodes(arg_0, arg_3)\n\n    arg_6 = arg_0.get_straight_line_transfer_distances()\n\n    arg_7 = {stop_I: set() for stop_I in arg_4}\n    for arg_8 in arg_6.itertuples():\n        arg_9 = arg_8.from_stop_I\n        arg_10 = arg_8.to_stop_I\n        arg_7[arg_9].add(arg_10)\n\n    print(\"Computing walking distances\")\n    for arg_9, arg_11 in arg_7.items():\n        arg_12 = arg_4[arg_9]\n        arg_13 = arg_5[arg_9]\n        arg_14 = networkx.single_source_dijkstra_path_length(arg_3,\n                                                                     arg_12,\n                                                                     cutoff=arg_2 - arg_13,\n                                                                     weight=\"distance\")\n        for arg_10 in arg_11:\n            arg_15 = arg_5[arg_10]\n            arg_16 = arg_4[arg_10]\n            arg_17 = arg_14.get(arg_16, float('inf'))\n            arg_18 = arg_13 + arg_17 + arg_15\n            arg_19 = arg_6[arg_6['from_stop_I'] == arg_9]\n            arg_20 = arg_19[arg_19[\"to_stop_I\"] == arg_10][\"d\"].values[0]\n            assert (arg_20 < arg_18 + 2)  # allow for a maximum  of 2 meters in calculations\n            if arg_18 <= arg_2:\n                arg_0.conn.execute(\"UPDATE stop_distances \"\n                                  \"SET d_walk = \" + str(int(arg_18)) +\n                                  \" WHERE from_stop_I=\" + str(arg_9) + \" AND to_stop_I=\" + str(arg_10))\n\n    arg_0.conn.commit()", "path": "gtfspy/osm_transfers.py", "identifier": "add_walk_distances_to_db_python", "docstring": "Computes the walk paths between stops, and updates these to the gtfs database.\n\n    Parameters\n    ----------\n    gtfs: gtfspy.GTFS or str\n        A GTFS object or a string representation.\n    osm_path: str\n        path to the OpenStreetMap file\n    cutoff_distance_m: number\n        maximum allowed distance in meters\n\n    Returns\n    -------\n    None\n\n    See Also\n    --------\n    gtfspy.calc_transfers\n    compute_walk_paths_java", "docstring_tokens": ["Computes", "the", "walk", "paths", "between", "stops", "and", "updates", "these", "to", "the", "gtfs", "database", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 254892}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/server.py#L68-L98", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Boots a server for the app, if it isn't already booted.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "responsive", ":", "arg_1", "(", "arg_0", ")", ".", "_ports", "[", "arg_0", ".", "port_key", "]", "=", "arg_0", ".", "port", "arg_4", "=", "capybara", ".", "servers", "[", "capybara", ".", "server_name", "]", "arg_5", "=", "(", "arg_0", ".", "middleware", ",", "arg_0", ".", "port", ",", "arg_0", ".", "host", ")", "arg_0", ".", "server_thread", "=", "Thread", "(", "target", "=", "arg_4", ",", "args", "=", "arg_5", ")", "arg_0", ".", "server_thread", ".", "daemon", "=", "True", "arg_0", ".", "server_thread", ".", "start", "(", ")", "arg_8", "=", "Timer", "(", "60", ")", "while", "not", "arg_0", ".", "responsive", ":", "if", "arg_8", ".", "expired", ":", "raise", "RuntimeError", "(", "\"WSGI application timed out during Func\"", ")", "arg_0", ".", "server_thread", ".", "join", "(", "0.1", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"\n        Boots a server for the app, if it isn't already Funced.\n\n        Returns:\n            Server: This server.\n        \"\"\"\n\n        if not arg_0.responsive:\n            # Remember the port so we can reuse it if we try to serve this same app again.\n            arg_1(arg_0)._ports[arg_0.port_key] = arg_0.port\n\n            arg_4 = capybara.servers[capybara.server_name]\n            arg_5 = (arg_0.middleware, arg_0.port, arg_0.host)\n\n            arg_0.server_thread = Thread(target=arg_4, args=arg_5)\n\n            # Inform Python that it shouldn't wait for this thread to terminate before\n            # exiting. (It will still be appropriately terminated when the process exits.)\n            arg_0.server_thread.daemon = True\n\n            arg_0.server_thread.start()\n\n            # Make sure the server actually starts and becomes responsive.\n            arg_8 = Timer(60)\n            while not arg_0.responsive:\n                if arg_8.expired:\n                    raise RuntimeError(\"WSGI application timed out during Func\")\n                arg_0.server_thread.join(0.1)\n\n        return arg_0", "path": "capybara/server.py", "identifier": "Server.boot", "docstring": "Boots a server for the app, if it isn't already booted.\n\n        Returns:\n            Server: This server.", "docstring_tokens": ["Boots", "a", "server", "for", "the", "app", "if", "it", "isn", "t", "already", "booted", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 254893}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/validation/fields/polymorphic.py#L70-L77", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Override ``_serialize`` for customizing the exception raised.", "language": "python", "parameters": "(self, value, key, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "return", "super", "(", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "TypeError", "as", "ex", ":", "if", "'serialization_schema_selector'", "in", "str", "(", "ex", ")", ":", "raise", "ValidationError", "(", "'Data from an invalid schema'", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Override ``Func`` for customizing the exception raised.\"\"\"\n        try:\n            return super().Func(arg_1, arg_2, arg_3)\n        except TypeError as ex:\n            if 'serialization_schema_selector' in str(ex):\n                raise ValidationError('Data from an invalid schema')\n            raise", "path": "qiskit/validation/fields/polymorphic.py", "identifier": "BasePolyField._serialize", "docstring": "Override ``_serialize`` for customizing the exception raised.", "docstring_tokens": ["Override", "_serialize", "for", "customizing", "the", "exception", "raised", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254894}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/db/api.py#L1148-L1163", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Query for segment allocations.", "language": "python", "parameters": "(context, lock_mode=False, **filters)", "return_statement": "return query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "pop", "(", "\"segment_allocation_range_ids\"", ",", "None", ")", "arg_4", "=", "arg_0", ".", "session", ".", "query", "(", "models", ".", "SegmentAllocation", ")", "if", "arg_1", ":", "arg_4", "=", "arg_4", ".", "with_lockmode", "(", "\"update\"", ")", "arg_4", "=", "arg_4", ".", "filter_by", "(", "**", "arg_2", ")", "if", "arg_3", ":", "arg_4", ".", "filter", "(", "models", ".", "SegmentAllocation", ".", "segment_allocation_range_id", ".", "in_", "(", "arg_3", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=False, **arg_2):\n    \"\"\"Query for segment allocations.\"\"\"\n    arg_3 = arg_2.pop(\"segment_allocation_range_ids\", None)\n\n    arg_4 = arg_0.session.query(models.SegmentAllocation)\n    if arg_1:\n        arg_4 = arg_4.with_lockmode(\"update\")\n\n    arg_4 = arg_4.filter_by(**arg_2)\n\n    # Optionally filter by given list of range ids\n    if arg_3:\n        arg_4.filter(\n            models.SegmentAllocation.segment_allocation_range_id.in_(\n                arg_3))\n    return arg_4", "path": "quark/db/api.py", "identifier": "segment_allocation_find", "docstring": "Query for segment allocations.", "docstring_tokens": ["Query", "for", "segment", "allocations", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 254895}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/util/__init__.py#L26-L36", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Search for a file named `name` from cwd or given directory to root.\n        Return None if nothing's found.", "language": "python", "parameters": "(name, base=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "os", ".", "getcwd", "(", ")", "while", "arg_1", "!=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_0", ")", ")", ":", "return", "arg_1", "arg_1", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "return", "None"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Search for a file named `name` from cwd or given directory to root.\n        Return None if nothing's found.\n    \"\"\"\n    arg_1 = arg_1 or os.getcwd()\n    while arg_1 != os.path.dirname(arg_1):\n        if os.path.exists(os.path.join(arg_1, arg_0)):\n            return arg_1\n        arg_1 = os.path.dirname(arg_1)\n\n    return None", "path": "src/rituals/util/__init__.py", "identifier": "search_file_upwards", "docstring": "Search for a file named `name` from cwd or given directory to root.\n        Return None if nothing's found.", "docstring_tokens": ["Search", "for", "a", "file", "named", "name", "from", "cwd", "or", "given", "directory", "to", "root", ".", "Return", "None", "if", "nothing", "s", "found", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 254896}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/packing.py#L12-L27", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Unpack sub field using its mask", "language": "python", "parameters": "(source_array, mask, dtype=np.uint8)", "return_statement": "return ((source_array & mask) >> lsb).astype(dtype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "uint8", ")", ":", "arg_5", "=", "least_significant_bit", "(", "arg_1", ")", "return", "(", "(", "arg_0", "&", "arg_1", ")", ">>", "arg_5", ")", ".", "astype", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.uint8):\n    \"\"\" Unpack sub field using its mask\n\n    Parameters:\n    ----------\n    source_array : numpy.ndarray\n        The source array\n    mask : mask (ie: 0b00001111)\n        Mask of the sub field to be extracted from the source array\n    Returns\n    -------\n    numpy.ndarray\n        The sub field array\n    \"\"\"\n    arg_5 = least_significant_bit(arg_1)\n    return ((arg_0 & arg_1) >> arg_5).astype(arg_2)", "path": "pylas/point/packing.py", "identifier": "unpack", "docstring": "Unpack sub field using its mask\n\n    Parameters:\n    ----------\n    source_array : numpy.ndarray\n        The source array\n    mask : mask (ie: 0b00001111)\n        Mask of the sub field to be extracted from the source array\n    Returns\n    -------\n    numpy.ndarray\n        The sub field array", "docstring_tokens": ["Unpack", "sub", "field", "using", "its", "mask"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 254897}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/classify.py#L10-L33", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Implements various kinds of feature selection", "language": "python", "parameters": "(feat_select, X, y)", "return_statement": "return features_selected", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "re", ".", "match", "(", "'.*-best'", ",", "arg_0", ")", "is", "not", "None", ":", "arg_3", "=", "int", "(", "arg_0", ".", "split", "(", "'-'", ")", "[", "0", "]", ")", "arg_4", "=", "SelectKBest", "(", "k", "=", "arg_3", ")", "import", "warnings", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "simplefilter", "(", "'ignore'", ",", "category", "=", "UserWarning", ")", "arg_5", "=", "np", ".", "where", "(", "arg_4", ".", "fit", "(", "arg_1", ",", "arg_2", ")", ".", "get_support", "(", ")", "is", "True", ")", "[", "0", "]", "elif", "re", ".", "match", "(", "'.*-randombest'", ",", "arg_0", ")", "is", "not", "None", ":", "arg_3", "=", "int", "(", "arg_0", ".", "split", "(", "'-'", ")", "[", "0", "]", ")", "from", "random", "import", "shuffle", "arg_6", "=", "range", "(", "0", ",", "arg_1", ".", "shape", "[", "1", "]", ")", "shuffle", "(", "arg_6", ")", "arg_5", "=", "arg_6", "[", ":", "arg_3", "]", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\" Implements various kinds of feature selection \"\"\"\n    # K-best\n    if re.match('.*-best', arg_0) is not None:\n        arg_3 = int(arg_0.split('-')[0])\n\n        arg_4 = SelectKBest(k=arg_3)\n\n        import warnings\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore', category=UserWarning)\n            arg_5 = np.where(\n                arg_4.fit(arg_1, arg_2).get_support() is True)[0]\n\n    elif re.match('.*-randombest', arg_0) is not None:\n        arg_3 = int(arg_0.split('-')[0])\n\n        from random import shuffle\n        arg_6 = range(0, arg_1.shape[1])\n        shuffle(arg_6)\n\n        arg_5 = arg_6[:arg_3]\n\n    return arg_5", "path": "neurosynth/analysis/classify.py", "identifier": "feature_selection", "docstring": "Implements various kinds of feature selection", "docstring_tokens": ["Implements", "various", "kinds", "of", "feature", "selection"], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 254898}
{"url": "https://github.com/sergedomk/fiql_parser/blob/499dd7cd0741603530ce5f3803d92813e74ac9c3/fiql_parser/expression.py#L44-L56", "sha": "499dd7cd0741603530ce5f3803d92813e74ac9c3", "docstring_summary": "Set parent ``Expression`` for this object.", "language": "python", "parameters": "(self, parent)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "Expression", ")", ":", "raise", "FiqlObjectException", "(", "\"Parent must be of %s not %s\"", "%", "(", "Expression", ",", "type", "(", "arg_1", ")", ")", ")", "arg_0", ".", "parent", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set parent ``Expression`` for this object.\n\n        Args:\n            parent (Expression): The ``Expression`` which contains this object.\n\n        Raises:\n            FiqlObjectException: Parent must be of type ``Expression``.\n        \"\"\"\n        if not isinstance(arg_1, Expression):\n            raise FiqlObjectException(\"Parent must be of %s not %s\" % (\n                Expression, type(arg_1)))\n        arg_0.parent = arg_1", "path": "fiql_parser/expression.py", "identifier": "BaseExpression.set_parent", "docstring": "Set parent ``Expression`` for this object.\n\n        Args:\n            parent (Expression): The ``Expression`` which contains this object.\n\n        Raises:\n            FiqlObjectException: Parent must be of type ``Expression``.", "docstring_tokens": ["Set", "parent", "Expression", "for", "this", "object", "."], "nwo": "sergedomk/fiql_parser", "score": 0.35580137387943567, "idx": 254899}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/conversions.py#L5-L60", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Converts an HSV tuple to RGB. Intended for internal use.\n    You should use hsv2rgb_spectrum or hsv2rgb_rainbow instead.", "language": "python", "parameters": "(hsv)", "return_statement": "return (r, g, b)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0x40", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_0", "arg_5", "=", "255", "-", "arg_3", "arg_6", "=", "(", "arg_4", "*", "arg_5", ")", "//", "256", "arg_7", "=", "arg_4", "-", "arg_6", "arg_8", "=", "arg_2", "//", "arg_1", "arg_9", "=", "arg_2", "%", "arg_1", "arg_10", "=", "arg_9", "arg_11", "=", "(", "arg_1", "-", "1", ")", "-", "arg_9", "arg_12", "=", "(", "arg_10", "*", "arg_7", ")", "//", "(", "256", "//", "4", ")", "arg_13", "=", "(", "arg_11", "*", "arg_7", ")", "//", "(", "256", "//", "4", ")", "arg_14", "=", "arg_12", "+", "arg_6", "arg_15", "=", "arg_13", "+", "arg_6", "arg_16", ",", "arg_17", ",", "arg_18", "=", "(", "0", ",", "0", ",", "0", ")", "if", "arg_8", ":", "if", "arg_8", "==", "1", ":", "arg_16", "=", "arg_6", "arg_17", "=", "arg_15", "arg_18", "=", "arg_14", "else", ":", "arg_16", "=", "arg_14", "arg_17", "=", "arg_6", "arg_18", "=", "arg_15", "else", ":", "arg_16", "=", "arg_15", "arg_17", "=", "arg_14", "arg_18", "=", "arg_6", "return", "(", "arg_16", ",", "arg_17", ",", "arg_18", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Converts an HSV tuple to RGB. Intended for internal use.\n    You should use hsv2rgb_spectrum or hsv2rgb_rainbow instead.\n    \"\"\"\n\n    arg_1 = 0x40\n\n    arg_2, arg_3, arg_4 = arg_0\n\n    # The brightness floor is minimum number that all of\n    # R, G, and B will be set to.\n    arg_5 = 255 - arg_3\n    arg_6 = (arg_4 * arg_5) // 256\n\n    # The color amplitude is the maximum amount of R, G, and B\n    # that will be added on top of the brightness_floor to\n    # create the specific hue desired.\n    arg_7 = arg_4 - arg_6\n\n    # figure out which section of the hue wheel we're in,\n    # and how far offset we are within that section\n    arg_8 = arg_2 // arg_1  # 0..2\n    arg_9 = arg_2 % arg_1  # 0..63\n\n    arg_10 = arg_9\n    arg_11 = (arg_1 - 1) - arg_9\n\n    # compute color-amplitude-scaled-down versions of rampup and rampdown\n    arg_12 = (arg_10 * arg_7) // (256 // 4)\n    arg_13 = (arg_11 * arg_7) // (256 // 4)\n\n    # add brightness_floor offset to everything\n    arg_14 = arg_12 + arg_6\n    arg_15 = arg_13 + arg_6\n\n    arg_16, arg_17, arg_18 = (0, 0, 0)\n\n    if arg_8:\n        if arg_8 == 1:\n            # section 1: 0x40..0x7F\n            arg_16 = arg_6\n            arg_17 = arg_15\n            arg_18 = arg_14\n        else:\n            # section 2; 0x80..0xBF\n            arg_16 = arg_14\n            arg_17 = arg_6\n            arg_18 = arg_15\n    else:\n        # section 0: 0x00..0x3F\n        arg_16 = arg_15\n        arg_17 = arg_14\n        arg_18 = arg_6\n\n    return (arg_16, arg_17, arg_18)", "path": "bibliopixel/colors/conversions.py", "identifier": "hsv2rgb_raw", "docstring": "Converts an HSV tuple to RGB. Intended for internal use.\n    You should use hsv2rgb_spectrum or hsv2rgb_rainbow instead.", "docstring_tokens": ["Converts", "an", "HSV", "tuple", "to", "RGB", ".", "Intended", "for", "internal", "use", ".", "You", "should", "use", "hsv2rgb_spectrum", "or", "hsv2rgb_rainbow", "instead", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 254900}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/kmip_client.py#L969-L1033", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Sign specified data using a specified signing key.", "language": "python", "parameters": "(self, data, unique_identifier=None,\n             cryptographic_parameters=None, credential=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "Operation", "(", "OperationEnum", ".", "SIGN", ")", "arg_6", "=", "payloads", ".", "SignRequestPayload", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")", "arg_7", "=", "messages", ".", "RequestBatchItem", "(", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_8", "=", "arg_0", ".", "_build_request_message", "(", "arg_4", ",", "[", "arg_7", "]", ")", "arg_9", "=", "arg_0", ".", "_send_and_receive_message", "(", "arg_8", ")", "arg_7", "=", "arg_9", ".", "batch_items", "[", "0", "]", "arg_10", "=", "arg_7", ".", "response_payload", "arg_11", "=", "{", "}", "if", "arg_10", ":", "arg_11", "[", "'unique_identifier'", "]", "=", "arg_10", ".", "unique_identifier", "arg_11", "[", "'Funcature'", "]", "=", "arg_10", ".", "Funcature_data", "arg_11", "[", "'result_status'", "]", "=", "arg_7", ".", "result_status", ".", "value", "try", ":", "arg_11", "[", "'result_reason'", "]", "=", "arg_7", ".", "result_reason", ".", "value", "except", "Exception", ":", "arg_11", "[", "'result_reason'", "]", "=", "arg_7", ".", "result_reason", "try", ":", "arg_11", "[", "'result_message'", "]", "=", "arg_7", ".", "result_message", ".", "value", "except", "Exception", ":", "arg_11", "[", "'result_message'", "]", "=", "arg_7", ".", "result_message", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2=None,\n             arg_3=None, arg_4=None):\n        \"\"\"\n        Sign specified data using a specified Funcing key.\n\n        Args:\n            data (bytes): Data to be Funced. Required.\n            unique_identifier (string): The unique ID of the Funcing\n                key to be used. Optional, defaults to None.\n            cryptographic_parameters (CryptographicParameters): A structure\n                containing various cryptographic settings to be used for\n                creating the Funcature. Optional, defaults to None.\n            credential (Credential): A credential object containing a set of\n                authorization parameters for the operation. Optional, defaults\n                to None.\n        Returns:\n            dict: The results of the Func operation, containing the\n                following key/value pairs:\n\n            Key                  | Value\n            ---------------------|-----------------------------------------\n            'unique_identifier'  | (string) The unique ID of the Funcing\n                                 | key used to create the Funcature\n            'Funcature'          | (bytes) The bytes of the Funcature\n            'result_status'      | (ResultStatus) An enumeration indicating\n                                 | the status of the operation result\n            'result_reason'      | (ResultReason) An enumeration providing\n                                 | context for the result status.\n            'result_message'     | (string) A message providing additional\n                                 | context for the operation result.\n        \"\"\"\n        arg_5 = Operation(OperationEnum.SIGN)\n\n        arg_6 = payloads.SignRequestPayload(\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_1=arg_1\n        )\n\n        arg_7 = messages.RequestBatchItem(\n            arg_5=arg_5,\n            arg_6=arg_6\n        )\n\n        arg_8 = arg_0._build_request_message(arg_4, [arg_7])\n        arg_9 = arg_0._send_and_receive_message(arg_8)\n        arg_7 = arg_9.batch_items[0]\n        arg_10 = arg_7.response_payload\n\n        arg_11 = {}\n\n        if arg_10:\n            arg_11['unique_identifier'] = arg_10.unique_identifier\n            arg_11['Funcature'] = arg_10.Funcature_data\n        arg_11['result_status'] = arg_7.result_status.value\n        try:\n            arg_11['result_reason'] = arg_7.result_reason.value\n        except Exception:\n            arg_11['result_reason'] = arg_7.result_reason\n        try:\n            arg_11['result_message'] = arg_7.result_message.value\n        except Exception:\n            arg_11['result_message'] = arg_7.result_message\n\n        return arg_11", "path": "kmip/services/kmip_client.py", "identifier": "KMIPProxy.sign", "docstring": "Sign specified data using a specified signing key.\n\n        Args:\n            data (bytes): Data to be signed. Required.\n            unique_identifier (string): The unique ID of the signing\n                key to be used. Optional, defaults to None.\n            cryptographic_parameters (CryptographicParameters): A structure\n                containing various cryptographic settings to be used for\n                creating the signature. Optional, defaults to None.\n            credential (Credential): A credential object containing a set of\n                authorization parameters for the operation. Optional, defaults\n                to None.\n        Returns:\n            dict: The results of the sign operation, containing the\n                following key/value pairs:\n\n            Key                  | Value\n            ---------------------|-----------------------------------------\n            'unique_identifier'  | (string) The unique ID of the signing\n                                 | key used to create the signature\n            'signature'          | (bytes) The bytes of the signature\n            'result_status'      | (ResultStatus) An enumeration indicating\n                                 | the status of the operation result\n            'result_reason'      | (ResultReason) An enumeration providing\n                                 | context for the result status.\n            'result_message'     | (string) A message providing additional\n                                 | context for the operation result.", "docstring_tokens": ["Sign", "specified", "data", "using", "a", "specified", "signing", "key", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 254901}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L888-L901", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Merges all segments in `mask` which are touching.", "language": "python", "parameters": "(mask)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_2", "for", "arg_2", "in", "np", ".", "unique", "(", "arg_0", ")", "if", "arg_2", "!=", "0", "]", "for", "arg_2", "in", "arg_1", ":", "arg_3", ",", "arg_4", "=", "np", ".", "where", "(", "arg_0", "==", "arg_2", ")", "for", "arg_5", "in", "arg_1", ":", "if", "arg_2", "==", "arg_5", ":", "continue", "else", ":", "arg_6", ",", "arg_7", "=", "np", ".", "where", "(", "arg_0", "==", "arg_5", ")", "if", "_segments_are_adjacent", "(", "(", "arg_3", ",", "arg_4", ")", ",", "(", "arg_6", ",", "arg_7", ")", ")", ":", "arg_0", "[", "arg_6", ",", "arg_7", "]", "=", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Merges all segments in `mask` which are touching.\n    \"\"\"\n    arg_1 = [arg_2 for arg_2 in np.unique(arg_0) if arg_2 != 0]\n    for arg_2 in arg_1:\n        arg_3, arg_4 = np.where(arg_0 == arg_2)\n        for arg_5 in arg_1:  # Ugh, brute force O(N^2) algorithm.. gross..\n            if arg_2 == arg_5:\n                continue\n            else:\n                arg_6, arg_7 = np.where(arg_0 == arg_5)\n                if _segments_are_adjacent((arg_3, arg_4), (arg_6, arg_7)):\n                    arg_0[arg_6, arg_7] = arg_2", "path": "algorithms/asa.py", "identifier": "_merge_adjacent_segments", "docstring": "Merges all segments in `mask` which are touching.", "docstring_tokens": ["Merges", "all", "segments", "in", "mask", "which", "are", "touching", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 254902}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1054-L1063", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a deep copy of the list.", "language": "python", "parameters": "(self)", "return_statement": "return ColorList(\n            [color(clr.r, clr.g, clr.b, clr.a, mode=\"rgb\") for clr in self],\n            name=self.name,\n            tags=self.tags\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "ColorList", "(", "[", "color", "(", "arg_1", ".", "r", ",", "arg_1", ".", "g", ",", "arg_1", ".", "b", ",", "arg_1", ".", "a", ",", "mode", "=", "\"rgb\"", ")", "for", "arg_1", "in", "arg_0", "]", ",", "name", "=", "arg_0", ".", "name", ",", "tags", "=", "arg_0", ".", "tags", ")"], "function": "def Func(arg_0):\n\n        \"\"\" Returns a deep Func of the list.\n        \"\"\"\n\n        return ColorList(\n            [color(arg_1.r, arg_1.g, arg_1.b, arg_1.a, mode=\"rgb\") for arg_1 in arg_0],\n            name=arg_0.name,\n            tags=arg_0.tags\n        )", "path": "lib/colors/__init__.py", "identifier": "ColorList.copy", "docstring": "Returns a deep copy of the list.", "docstring_tokens": ["Returns", "a", "deep", "copy", "of", "the", "list", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 254903}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/files.py#L66-L96", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Add a normal file including its source", "language": "python", "parameters": "(f, targetdir, generator,script, source)", "return_statement": "return (basename, update)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "os", ".", "path", ".", "basename", "(", "arg_0", ")", "if", "arg_1", "!=", "\".\"", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_5", ")", "else", ":", "arg_6", "=", "arg_5", "arg_7", "=", "os", ".", "path", ".", "relpath", "(", "arg_0", ",", "os", ".", "getcwd", "(", ")", ")", "arg_8", "=", "'data'", "if", "arg_3", ":", "arg_8", "=", "'script'", "if", "arg_2", ":", "arg_8", "=", "'generator'", "arg_9", "=", "OrderedDict", "(", "[", "(", "'type'", ",", "arg_8", ")", ",", "(", "'generator'", ",", "arg_2", ")", ",", "(", "'relativepath'", ",", "arg_6", ")", ",", "(", "'content'", ",", "\"\"", ")", ",", "(", "'source'", ",", "arg_4", ")", ",", "(", "'localfullpath'", ",", "arg_0", ")", ",", "(", "'localrelativepath'", ",", "arg_7", ")", "]", ")", "arg_9", "=", "annotate_record", "(", "arg_9", ")", "return", "(", "arg_5", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2,arg_3, arg_4):\n    \"\"\"\n    Add a normal file including its source\n    \"\"\"\n\n    arg_5 = os.path.basename(arg_0)\n    if arg_1 != \".\":\n        arg_6 = os.path.join(arg_1, arg_5)\n    else:\n        arg_6 = arg_5\n\n    arg_7 = os.path.relpath(arg_0, os.getcwd())\n    arg_8 = 'data'\n    if arg_3:\n        arg_8 = 'script'\n        if arg_2:\n            arg_8 = 'generator'\n\n    arg_9 = OrderedDict([\n        ('type', arg_8),\n        ('generator', arg_2),\n        ('relativepath', arg_6),\n        ('content', \"\"),\n        ('source', arg_4),\n        ('localfullpath', arg_0),\n        ('localrelativepath', arg_7)\n    ])\n\n    arg_9 = annotate_record(arg_9)\n\n    return (arg_5, arg_9)", "path": "dgitcore/datasets/files.py", "identifier": "add_file_normal", "docstring": "Add a normal file including its source", "docstring_tokens": ["Add", "a", "normal", "file", "including", "its", "source"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 254904}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/text.py#L48-L57", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Constructs the middle line of the element", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "Func_format", "%", "arg_0", ".", "Func_content", ".", "center", "(", "arg_0", ".", "width", ",", "arg_0", ".", "_Func_padding", ")", "if", "arg_0", ".", "right_fill", ":", "arg_1", "=", "arg_1", ".", "ljust", "(", "arg_0", ".", "right_fill", ",", "arg_0", ".", "_Func_padding", ")", "if", "arg_0", ".", "left_fill", ":", "arg_1", "=", "arg_1", ".", "rjust", "(", "arg_0", ".", "left_fill", ",", "arg_0", ".", "_Func_padding", ")", "arg_1", "=", "arg_1", ".", "center", "(", "arg_0", ".", "layer_width", ",", "arg_0", ".", "Func_bck", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Constructs the Funcdle line of the element\"\"\"\n        arg_1 = arg_0.Func_format % arg_0.Func_content.center(\n            arg_0.width, arg_0._Func_padding)\n        if arg_0.right_fill:\n            arg_1 = arg_1.ljust(arg_0.right_fill, arg_0._Func_padding)\n        if arg_0.left_fill:\n            arg_1 = arg_1.rjust(arg_0.left_fill, arg_0._Func_padding)\n        arg_1 = arg_1.center(arg_0.layer_width, arg_0.Func_bck)\n        return arg_1", "path": "qiskit/visualization/text.py", "identifier": "DrawElement.mid", "docstring": "Constructs the middle line of the element", "docstring_tokens": ["Constructs", "the", "middle", "line", "of", "the", "element"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254905}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/drivers/serial/devices.py#L37-L69", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Scan and report all compatible serial devices on system.", "language": "python", "parameters": "(self)", "return_statement": "return self.devices", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "devices", "is", "not", "None", ":", "return", "arg_0", ".", "devices", "arg_0", ".", "devices", "=", "{", "}", "arg_2", "=", "\"(?i)\"", "+", "arg_0", ".", "hardware_id", "for", "arg_3", "in", "serial", ".", "tools", ".", "list_ports", ".", "grep", "(", "arg_2", ")", ":", "arg_4", "=", "arg_3", "[", "0", "]", "try", ":", "arg_5", "=", "arg_0", ".", "get_device_id", "(", "arg_4", ")", "arg_6", "=", "arg_0", ".", "_get_device_version", "(", "arg_4", ")", "except", ":", "log", ".", "debug", "(", "'Error getting device_id for %s, %s'", ",", "arg_4", ",", "arg_0", ".", "baudrate", ")", "if", "True", ":", "raise", "continue", "if", "getattr", "(", "arg_3", ",", "'__len__'", ",", "lambda", ":", "0", ")", "(", ")", ":", "log", ".", "debug", "(", "'Multi-port device %s:%s:%s with %s ports found'", ",", "arg_0", ".", "hardware_id", ",", "arg_5", ",", "arg_6", ",", "len", "(", "arg_3", ")", ")", "if", "arg_5", "<", "0", ":", "log", ".", "debug", "(", "'Serial device %s:%s:%s with id %s < 0'", ",", "arg_0", ".", "hardware_id", ",", "arg_5", ",", "arg_6", ")", "else", ":", "arg_0", ".", "devices", "[", "arg_5", "]", "=", "arg_4", ",", "arg_6", "return", "arg_0", ".", "devices"], "function": "def Func(arg_0):\n        \"\"\"Scan and report all compatible serial devices on system.\n\n        :returns: List of discovered devices\n        \"\"\"\n        if arg_0.devices is not None:\n            return arg_0.devices\n\n        arg_0.devices = {}\n        arg_2 = \"(?i)\" + arg_0.hardware_id  # forces case insensitive\n\n        for arg_3 in serial.tools.list_ports.grep(arg_2):\n            arg_4 = arg_3[0]\n            try:\n                arg_5 = arg_0.get_device_id(arg_4)\n                arg_6 = arg_0._get_device_version(arg_4)\n            except:\n                log.debug('Error getting device_id for %s, %s',\n                          arg_4, arg_0.baudrate)\n                if True:\n                    raise\n                continue\n\n            if getattr(arg_3, '__len__', lambda: 0)():\n                log.debug('Multi-port device %s:%s:%s with %s ports found',\n                          arg_0.hardware_id, arg_5, arg_6, len(arg_3))\n            if arg_5 < 0:\n                log.debug('Serial device %s:%s:%s with id %s < 0',\n                          arg_0.hardware_id, arg_5, arg_6)\n            else:\n                arg_0.devices[arg_5] = arg_4, arg_6\n\n        return arg_0.devices", "path": "bibliopixel/drivers/serial/devices.py", "identifier": "DevicesImpl.find_serial_devices", "docstring": "Scan and report all compatible serial devices on system.\n\n        :returns: List of discovered devices", "docstring_tokens": ["Scan", "and", "report", "all", "compatible", "serial", "devices", "on", "system", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 254906}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/utils/Settings.py#L95-L132", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Get the default parameters as defined in the Settings instance.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "def", "retrieve_param", "(", "arg_3", ")", ":", "try", ":", "return", "arg_0", ".", "__getattribute__", "(", "arg_3", ")", "except", "AttributeError", ":", "if", "arg_3", "==", "\"device\"", ":", "return", "arg_0", ".", "default_device", "else", ":", "return", "arg_0", ".", "__getattribute__", "(", "arg_3", ".", "upper", "(", ")", ")", "if", "len", "(", "arg_1", ")", "==", "0", ":", "if", "len", "(", "arg_2", ")", "==", "1", "and", "arg_2", "[", "list", "(", "arg_2", ".", "keys", "(", ")", ")", "[", "0", "]", "]", "is", "not", "None", ":", "return", "arg_2", "[", "list", "(", "arg_2", ".", "keys", "(", ")", ")", "[", "0", "]", "]", "elif", "len", "(", "arg_2", ")", "==", "1", ":", "return", "retrieve_param", "(", "list", "(", "arg_2", ".", "keys", "(", ")", ")", "[", "0", "]", ")", "else", ":", "raise", "TypeError", "(", "\"As dict is unordered, it is impossible to give\"", "\"the parameters in the correct order.\"", ")", "else", ":", "arg_4", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", "[", "1", "]", "is", "None", ":", "arg_4", ".", "append", "(", "retrieve_param", "(", "arg_3", "[", "0", "]", ")", ")", "else", ":", "arg_4", ".", "append", "(", "arg_3", "[", "1", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Get the default parameters as defined in the Settings instance.\n\n        This function proceeds to seamlessly retrieve the argument to pass\n        through, depending on either it was overidden or not: If no argument\n        was overridden in a function of the toolbox, the default argument will\n        be set to ``None``, and this function will retrieve the default\n        parameters as defined by the ``cdt.SETTINGS`` 's attributes.\n\n        It has two modes of processing:\n\n        1. **kwargs for retrieving a single argument: ``Func(argument_name=value)``.\n        2. *args through a list of tuples of the shape ``('argument_name', value)`` to retrieve multiple values at once.\n        \"\"\"\n        def retrieve_param(arg_3):\n            try:\n                return arg_0.__getattribute__(arg_3)\n            except AttributeError:\n                if arg_3 == \"device\":\n                    return arg_0.default_device\n                else:\n                    return arg_0.__getattribute__(arg_3.upper())\n        if len(arg_1) == 0:\n            if len(arg_2) == 1 and arg_2[list(arg_2.keys())[0]] is not None:\n                return arg_2[list(arg_2.keys())[0]]\n            elif len(arg_2) == 1:\n                return retrieve_param(list(arg_2.keys())[0])\n            else:\n                raise TypeError(\"As dict is unordered, it is impossible to give\"\n                                \"the parameters in the correct order.\")\n        else:\n            arg_4 = []\n            for arg_3 in arg_1:\n                if arg_3[1] is None:\n                    arg_4.append(retrieve_param(arg_3[0]))\n                else:\n                    arg_4.append(arg_3[1])\n            return arg_4", "path": "cdt/utils/Settings.py", "identifier": "ConfigSettings.get_default", "docstring": "Get the default parameters as defined in the Settings instance.\n\n        This function proceeds to seamlessly retrieve the argument to pass\n        through, depending on either it was overidden or not: If no argument\n        was overridden in a function of the toolbox, the default argument will\n        be set to ``None``, and this function will retrieve the default\n        parameters as defined by the ``cdt.SETTINGS`` 's attributes.\n\n        It has two modes of processing:\n\n        1. **kwargs for retrieving a single argument: ``get_default(argument_name=value)``.\n        2. *args through a list of tuples of the shape ``('argument_name', value)`` to retrieve multiple values at once.", "docstring_tokens": ["Get", "the", "default", "parameters", "as", "defined", "in", "the", "Settings", "instance", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 254907}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L171-L196", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates the specified Cloud Bigtable table.\n        Raises ``google.api_core.exceptions.AlreadyExists`` if the table exists.", "language": "python", "parameters": "(instance,\n                     table_id,\n                     initial_split_keys=None,\n                     column_families=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "{", "}", "if", "arg_2", "is", "None", ":", "arg_2", "=", "[", "]", "arg_4", "=", "Table", "(", "arg_1", ",", "arg_0", ")", "arg_4", ".", "create", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0,\n                     arg_1,\n                     arg_2=None,\n                     arg_3=None):\n        \"\"\"\n        Creates the specified Cloud Bigtable table.\n        Raises ``google.api_core.exceptions.AlreadyExists`` if the table exists.\n\n        :type instance: Instance\n        :param instance: The Cloud Bigtable instance that owns the table.\n        :type table_id: str\n        :param table_id: The ID of the table to create in Cloud Bigtable.\n        :type initial_split_keys: list\n        :param initial_split_keys: (Optional) A list of row keys in bytes to use to\n            initially split the table.\n        :type column_families: dict\n        :param column_families: (Optional) A map of columns to create. The key is the\n            column_id str, and the value is a\n            :class:`google.cloud.bigtable.column_family.GarbageCollectionRule`.\n        \"\"\"\n        if arg_3 is None:\n            arg_3 = {}\n        if arg_2 is None:\n            arg_2 = []\n        arg_4 = Table(arg_1, arg_0)\n        arg_4.create(arg_2, arg_3)", "path": "airflow/contrib/hooks/gcp_bigtable_hook.py", "identifier": "BigtableHook.create_table", "docstring": "Creates the specified Cloud Bigtable table.\n        Raises ``google.api_core.exceptions.AlreadyExists`` if the table exists.\n\n        :type instance: Instance\n        :param instance: The Cloud Bigtable instance that owns the table.\n        :type table_id: str\n        :param table_id: The ID of the table to create in Cloud Bigtable.\n        :type initial_split_keys: list\n        :param initial_split_keys: (Optional) A list of row keys in bytes to use to\n            initially split the table.\n        :type column_families: dict\n        :param column_families: (Optional) A map of columns to create. The key is the\n            column_id str, and the value is a\n            :class:`google.cloud.bigtable.column_family.GarbageCollectionRule`.", "docstring_tokens": ["Creates", "the", "specified", "Cloud", "Bigtable", "table", ".", "Raises", "google", ".", "api_core", ".", "exceptions", ".", "AlreadyExists", "if", "the", "table", "exists", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254908}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/runner.py#L666-L701", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Final optimization for the best-possible state.", "language": "python", "parameters": "(st, desc='finish-state', invert='guess')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'finish-state'", ",", "arg_2", "=", "'guess'", ")", ":", "for", "arg_3", "in", "[", "None", ",", "0", "]", ":", "for", "arg_4", "in", "range", "(", "3", ")", ":", "arg_5", ",", "arg_6", "=", "addsub", ".", "add_subtract_locally", "(", "arg_0", ",", "region_depth", "=", "7", ",", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ")", "if", "arg_5", "==", "0", ":", "break", "opt", ".", "finish", "(", "arg_0", ",", "n_loop", "=", "1", ",", "separate_psf", "=", "True", ",", "arg_1", "=", "arg_1", ",", "dowarn", "=", "False", ")", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'polish'", ",", "arg_1", "=", "arg_1", ",", "n_loop", "=", "2", ",", "dowarn", "=", "False", ")", "arg_7", "=", "opt", ".", "finish", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "n_loop", "=", "4", ",", "dowarn", "=", "False", ")", "if", "not", "arg_7", "[", "'converged'", "]", ":", "RLOG", ".", "warn", "(", "'Optimization did not converge; consider re-running'", ")"], "function": "def Func(arg_0, arg_1='finish-state', arg_2='guess'):\n    \"\"\"\n    Final optimization for the best-possible state.\n\n    Runs a local add-subtract to capture any difficult-to-feature particles,\n    then does another set of optimization designed to get to the best\n    possible fit.\n\n    Parameters\n    ----------\n        st : :class:`peri.states.ImageState`\n            The state to finish\n        desc : String, optional\n            Description to intermittently save the state as, as passed to\n            state.save. Default is `'finish-state'`.\n        invert : {'guess', True, False}\n            Whether to invert the image for featuring, as passed to\n            addsubtract.add_subtract. Default is to guess from the\n            state's current particles.\n\n    See Also\n    --------\n        `peri.opt.addsubtract.add_subtract_locally`\n        `peri.opt.optimize.finish`\n    \"\"\"\n    for arg_3 in [None, 0]:\n        for arg_4 in range(3):\n            arg_5, arg_6 = addsub.add_subtract_locally(arg_0, region_depth=7,\n                    arg_3=arg_3, arg_2=arg_2)\n            if arg_5 == 0:\n                break\n    opt.finish(arg_0, n_loop=1, separate_psf=True, arg_1=arg_1, dowarn=False)\n    opt.burn(arg_0, mode='polish', arg_1=arg_1, n_loop=2, dowarn=False)\n    arg_7 = opt.finish(arg_0, arg_1=arg_1, n_loop=4, dowarn=False)\n    if not arg_7['converged']:\n        RLOG.warn('Optimization did not converge; consider re-running')", "path": "peri/runner.py", "identifier": "finish_state", "docstring": "Final optimization for the best-possible state.\n\n    Runs a local add-subtract to capture any difficult-to-feature particles,\n    then does another set of optimization designed to get to the best\n    possible fit.\n\n    Parameters\n    ----------\n        st : :class:`peri.states.ImageState`\n            The state to finish\n        desc : String, optional\n            Description to intermittently save the state as, as passed to\n            state.save. Default is `'finish-state'`.\n        invert : {'guess', True, False}\n            Whether to invert the image for featuring, as passed to\n            addsubtract.add_subtract. Default is to guess from the\n            state's current particles.\n\n    See Also\n    --------\n        `peri.opt.addsubtract.add_subtract_locally`\n        `peri.opt.optimize.finish`", "docstring_tokens": ["Final", "optimization", "for", "the", "best", "-", "possible", "state", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 254909}
{"url": "https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L23-L119", "sha": "8c0748b720d389f19d5226fdcceedc26cd6284ee", "docstring_summary": "This will try to pull in a stream from an external source. Once a\n        stream has been successfully pulled it is assigned a 'local stream\n        name' which can be used to access the stream from the EMS.", "language": "python", "parameters": "(self, uri, **kwargs)", "return_statement": "return self.protocol.execute('pullStream', uri=uri, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "protocol", ".", "execute", "(", "'pullStream'", ",", "arg_1", "=", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        This will try to pull in a stream from an external source. Once a\n        stream has been successfully pulled it is assigned a 'local stream\n        name' which can be used to access the stream from the EMS.\n\n        :param uri: The URI of the external stream. Can be RTMP, RTSP or\n            unicast/multicast (d) mpegts\n        :type uri: str\n\n        :param keepAlive: If keepAlive is set to 1, the server will attempt to\n            reestablish connection with a stream source after a connection has\n            been lost. The reconnect will be attempted once every second\n            (default: 1 true)\n        :type keepAlive: int\n\n        :param localStreamName: If provided, the stream will be given this\n            name. Otherwise, a fallback techniques used to determine the stream\n            name (based on the URI)\n        :type localStreamName: str\n\n        :param forceTcp: If 1 and if the stream is RTSP, a TCP connection will\n            be forced. Otherwise the transport mechanism will be negotiated\n            (UDP or TCP) (default: 1 true)\n        :type forceTcp: int\n\n        :param tcUrl: When specified, this value will be used to set the TC URL\n            in the initial RTMP connect invoke\n        :type tcUrl: str\n\n        :param pageUrl: When specified, this value will be used to set the\n            originating web page address in the initial RTMP connect invoke\n        :type pageUrl: str\n\n        :param swfUrl: When specified, this value will be used to set the\n            originating swf URL in the initial RTMP connect invoke\n        :type swfUrl: str\n\n        :param rangeStart: For RTSP and RTMP connections. A value from which\n            the playback should start expressed in seconds. There are 2 special\n            values: -2 and -1. For more information, please read about\n            start/len parameters here:\n            http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000185.html\n        :type rangeStart: int\n\n        :param rangeEnd: The length in seconds for the playback. -1 is a\n            special value. For more information, please read about start/len\n            parameters here:\n            http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000185.html\n        :type rangeEnd: int\n\n        :param ttl: Sets the IP_TTL (time to live) option on the socket\n        :type ttl: int\n\n        :param tos: Sets the IP_TOS (Type of Service) option on the socket\n        :type tos: int\n\n        :param rtcpDetectionInterval: How much time (in seconds) should the\n            server wait for RTCP packets before declaring the RTSP stream as a\n            RTCP-less stream\n        :type rtcpDetectionInterval: int\n\n        :param emulateUserAgent: When specified, this value will be used as the\n            user agent string. It is meaningful only for RTMP\n        :type emulateUserAgent: str\n\n        :param isAudio: If 1 and if the stream is RTP, it indicates that the\n            currently pulled stream is an audio source. Otherwise the pulled\n            source is assumed as a video source\n        :type isAudio: int\n\n        :param audioCodecBytes: The audio codec setup of this RTP stream if it\n            is audio. Represented as hex format without '0x' or 'h'. For\n            example: audioCodecBytes=1190\n        :type audioCodecBytes: str\n\n        :param spsBytes: The video SPS bytes of this RTP stream if it is video.\n            It should be base 64 encoded.\n        :type spsBytes: str\n\n        :param ppsBytes: The video PPS bytes of this RTP stream if it is video.\n            It should be base 64 encoded\n        :type ppsBytes: str\n\n        :param ssmIp: The source IP from source-specific-multicast. Only usable\n            when doing UDP based pull\n        :type ssmIp: str\n\n        :param httpProxy: This parameter has two valid values: IP:Port - This\n            value combination specifies an RTSP HTTP Proxy from which the RTSP\n            stream should be pulled from Self - Specifying \"self\" as the value\n            implies pulling RTSP over HTTP\n        :type httpProxy: str\n\n        :link: http://docs.evostream.com/ems_api_definition/pullstream\n        \"\"\"\n        return arg_0.protocol.execute('pullStream', arg_1=arg_1, **arg_2)", "path": "pyems/__init__.py", "identifier": "Api.pull_stream", "docstring": "This will try to pull in a stream from an external source. Once a\n        stream has been successfully pulled it is assigned a 'local stream\n        name' which can be used to access the stream from the EMS.\n\n        :param uri: The URI of the external stream. Can be RTMP, RTSP or\n            unicast/multicast (d) mpegts\n        :type uri: str\n\n        :param keepAlive: If keepAlive is set to 1, the server will attempt to\n            reestablish connection with a stream source after a connection has\n            been lost. The reconnect will be attempted once every second\n            (default: 1 true)\n        :type keepAlive: int\n\n        :param localStreamName: If provided, the stream will be given this\n            name. Otherwise, a fallback techniques used to determine the stream\n            name (based on the URI)\n        :type localStreamName: str\n\n        :param forceTcp: If 1 and if the stream is RTSP, a TCP connection will\n            be forced. Otherwise the transport mechanism will be negotiated\n            (UDP or TCP) (default: 1 true)\n        :type forceTcp: int\n\n        :param tcUrl: When specified, this value will be used to set the TC URL\n            in the initial RTMP connect invoke\n        :type tcUrl: str\n\n        :param pageUrl: When specified, this value will be used to set the\n            originating web page address in the initial RTMP connect invoke\n        :type pageUrl: str\n\n        :param swfUrl: When specified, this value will be used to set the\n            originating swf URL in the initial RTMP connect invoke\n        :type swfUrl: str\n\n        :param rangeStart: For RTSP and RTMP connections. A value from which\n            the playback should start expressed in seconds. There are 2 special\n            values: -2 and -1. For more information, please read about\n            start/len parameters here:\n            http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000185.html\n        :type rangeStart: int\n\n        :param rangeEnd: The length in seconds for the playback. -1 is a\n            special value. For more information, please read about start/len\n            parameters here:\n            http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000185.html\n        :type rangeEnd: int\n\n        :param ttl: Sets the IP_TTL (time to live) option on the socket\n        :type ttl: int\n\n        :param tos: Sets the IP_TOS (Type of Service) option on the socket\n        :type tos: int\n\n        :param rtcpDetectionInterval: How much time (in seconds) should the\n            server wait for RTCP packets before declaring the RTSP stream as a\n            RTCP-less stream\n        :type rtcpDetectionInterval: int\n\n        :param emulateUserAgent: When specified, this value will be used as the\n            user agent string. It is meaningful only for RTMP\n        :type emulateUserAgent: str\n\n        :param isAudio: If 1 and if the stream is RTP, it indicates that the\n            currently pulled stream is an audio source. Otherwise the pulled\n            source is assumed as a video source\n        :type isAudio: int\n\n        :param audioCodecBytes: The audio codec setup of this RTP stream if it\n            is audio. Represented as hex format without '0x' or 'h'. For\n            example: audioCodecBytes=1190\n        :type audioCodecBytes: str\n\n        :param spsBytes: The video SPS bytes of this RTP stream if it is video.\n            It should be base 64 encoded.\n        :type spsBytes: str\n\n        :param ppsBytes: The video PPS bytes of this RTP stream if it is video.\n            It should be base 64 encoded\n        :type ppsBytes: str\n\n        :param ssmIp: The source IP from source-specific-multicast. Only usable\n            when doing UDP based pull\n        :type ssmIp: str\n\n        :param httpProxy: This parameter has two valid values: IP:Port - This\n            value combination specifies an RTSP HTTP Proxy from which the RTSP\n            stream should be pulled from Self - Specifying \"self\" as the value\n            implies pulling RTSP over HTTP\n        :type httpProxy: str\n\n        :link: http://docs.evostream.com/ems_api_definition/pullstream", "docstring_tokens": ["This", "will", "try", "to", "pull", "in", "a", "stream", "from", "an", "external", "source", ".", "Once", "a", "stream", "has", "been", "successfully", "pulled", "it", "is", "assigned", "a", "local", "stream", "name", "which", "can", "be", "used", "to", "access", "the", "stream", "from", "the", "EMS", "."], "nwo": "tomi77/pyems", "score": 0.1802640598604426, "idx": 254910}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/utils.py#L90-L105", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Save a given Tensor into an image file.", "language": "python", "parameters": "(tensor, filename, nrow=8, padding=2,\n               normalize=False, range=None, scale_each=False, pad_value=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "8", ",", "arg_3", "=", "2", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "0", ")", ":", "from", "PIL", "import", "Image", "arg_8", "=", "make_grid", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_7", "=", "arg_7", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_9", "=", "arg_8", ".", "mul_", "(", "255", ")", ".", "add_", "(", "0.5", ")", ".", "clamp_", "(", "0", ",", "255", ")", ".", "permute", "(", "1", ",", "2", ",", "0", ")", ".", "to", "(", "'cpu'", ",", "torch", ".", "uint8", ")", ".", "numpy", "(", ")", "arg_10", "=", "Image", ".", "fromarray", "(", "arg_9", ")", "arg_10", ".", "save", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=8, arg_3=2,\n               arg_4=False, arg_5=None, arg_6=False, arg_7=0):\n    \"\"\"Save a given Tensor into an image file.\n\n    Args:\n        tensor (Tensor or list): Image to be saved. If given a mini-batch tensor,\n            saves the tensor as a grid of images by calling ``make_grid``.\n        **kwargs: Other arguments are documented in ``make_grid``.\n    \"\"\"\n    from PIL import Image\n    arg_8 = make_grid(arg_0, arg_2=arg_2, arg_3=arg_3, arg_7=arg_7,\n                     arg_4=arg_4, arg_5=arg_5, arg_6=arg_6)\n    # Add 0.5 after unnormalizing to [0, 255] to round to nearest integer\n    arg_9 = arg_8.mul_(255).add_(0.5).clamp_(0, 255).permute(1, 2, 0).to('cpu', torch.uint8).numpy()\n    arg_10 = Image.fromarray(arg_9)\n    arg_10.save(arg_1)", "path": "torchvision/utils.py", "identifier": "save_image", "docstring": "Save a given Tensor into an image file.\n\n    Args:\n        tensor (Tensor or list): Image to be saved. If given a mini-batch tensor,\n            saves the tensor as a grid of images by calling ``make_grid``.\n        **kwargs: Other arguments are documented in ``make_grid``.", "docstring_tokens": ["Save", "a", "given", "Tensor", "into", "an", "image", "file", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 254911}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gerrit.py#L102-L118", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the reviews", "language": "python", "parameters": "(self, category, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", "[", "'from_date'", "]", "if", "arg_0", ".", "client", ".", "version", "[", "0", "]", "==", "2", "and", "arg_0", ".", "client", ".", "version", "[", "1", "]", "==", "8", ":", "arg_4", "=", "arg_0", ".", "_fetch_gerrit28", "(", "arg_3", ")", "else", ":", "arg_4", "=", "arg_0", ".", "_fetch_gerrit", "(", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "yield", "arg_5"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Fetch the reviews\n\n        :param category: the category of items to fetch\n        :param kwargs: backend arguments\n\n        :returns: a generator of items\n        \"\"\"\n        arg_3 = arg_2['from_date']\n\n        if arg_0.client.version[0] == 2 and arg_0.client.version[1] == 8:\n            arg_4 = arg_0._fetch_gerrit28(arg_3)\n        else:\n            arg_4 = arg_0._fetch_gerrit(arg_3)\n\n        for arg_5 in arg_4:\n            yield arg_5", "path": "perceval/backends/core/gerrit.py", "identifier": "Gerrit.fetch_items", "docstring": "Fetch the reviews\n\n        :param category: the category of items to fetch\n        :param kwargs: backend arguments\n\n        :returns: a generator of items", "docstring_tokens": ["Fetch", "the", "reviews"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 254912}
{"url": "https://github.com/c-soft/satel_integra/blob/3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c/satel_integra/cli.py#L16-L26", "sha": "3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c", "docstring_summary": "Console script for satel_integra.", "language": "python", "parameters": "(port, ip, command, loglevel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "getattr", "(", "logging", ",", "arg_3", ".", "upper", "(", ")", ",", "None", ")", "if", "not", "isinstance", "(", "arg_4", ",", "int", ")", ":", "raise", "ValueError", "(", "'Invalid log level: %s'", "%", "arg_3", ")", "logging", ".", "basicConfig", "(", "level", "=", "arg_4", ")", "click", ".", "echo", "(", "\"Demo of satel_integra library\"", ")", "if", "arg_2", "==", "\"demo\"", ":", "demo", "(", "arg_1", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Console script for satel_integra.\"\"\"\n    arg_4 = getattr(logging, arg_3.upper(), None)\n    if not isinstance(arg_4, int):\n        raise ValueError('Invalid log level: %s' % arg_3)\n        \n    logging.basicConfig(level=arg_4)\n\n    click.echo(\"Demo of satel_integra library\")\n    if arg_2 == \"demo\":\n        demo(arg_1, arg_0)", "path": "satel_integra/cli.py", "identifier": "main", "docstring": "Console script for satel_integra.", "docstring_tokens": ["Console", "script", "for", "satel_integra", "."], "nwo": "c-soft/satel_integra", "score": 0.683472553404196, "idx": 254913}
{"url": "https://github.com/eecs-autograder/autograder-sandbox/blob/230e806e3740e2aaf5f5568dd6a265558f165c63/autograder_sandbox/autograder_sandbox.py#L180-L188", "sha": "230e806e3740e2aaf5f5568dd6a265558f165c63", "docstring_summary": "Raises ValueError if this sandbox instance is currently running.", "language": "python", "parameters": "(self, value: bool)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "if", "arg_0", ".", "_is_running", ":", "raise", "ValueError", "(", "\"Cannot change network access settings on a running sandbox\"", ")", "arg_0", ".", "_Func", "=", "arg_1"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        Raises ValueError if this sandbox instance is currently running.\n        \"\"\"\n        if arg_0._is_running:\n            raise ValueError(\n                \"Cannot change network access settings on a running sandbox\")\n\n        arg_0._Func = arg_1", "path": "autograder_sandbox/autograder_sandbox.py", "identifier": "AutograderSandbox.allow_network_access", "docstring": "Raises ValueError if this sandbox instance is currently running.", "docstring_tokens": ["Raises", "ValueError", "if", "this", "sandbox", "instance", "is", "currently", "running", "."], "nwo": "eecs-autograder/autograder-sandbox", "score": 0.3723258035444451, "idx": 254914}
{"url": "https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L136-L140", "sha": "5a75cf88cf794937711b6850ff2acb07fe005f08", "docstring_summary": "Move this object up one position.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "swap", "(", "arg_0", ".", "get_ordering_queryset", "(", ")", ".", "filter", "(", "order__lt", "=", "arg_0", ".", "order", ")", ".", "order_by", "(", "'-order'", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Move this object Func one position.\n        \"\"\"\n        arg_0.swap(arg_0.get_ordering_queryset().filter(order__lt=arg_0.order).order_by('-order'))", "path": "publications/models/orderedmodel.py", "identifier": "OrderedModel.up", "docstring": "Move this object up one position.", "docstring_tokens": ["Move", "this", "object", "up", "one", "position", "."], "nwo": "lucastheis/django-publications", "score": 0.41971037138316925, "idx": 254915}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth2.py#L837-L881", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Validate access token.", "language": "python", "parameters": "(self, token, scopes, request)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "log", ".", "debug", "(", "'Validate bearer token %r'", ",", "arg_1", ")", "arg_4", "=", "arg_0", ".", "_tokengetter", "(", "arg_7", "=", "arg_1", ")", "if", "not", "arg_4", ":", "arg_5", "=", "'Bearer token not found.'", "arg_3", ".", "error_message", "=", "arg_5", "log", ".", "debug", "(", "arg_5", ")", "return", "False", "if", "arg_4", ".", "expires", "is", "not", "None", "and", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ">", "arg_4", ".", "expires", ":", "arg_5", "=", "'Bearer token is expired.'", "arg_3", ".", "error_message", "=", "arg_5", "log", ".", "debug", "(", "arg_5", ")", "return", "False", "if", "arg_2", "and", "not", "set", "(", "arg_4", ".", "scopes", ")", "&", "set", "(", "arg_2", ")", ":", "arg_5", "=", "'Bearer token scope not valid.'", "arg_3", ".", "error_message", "=", "arg_5", "log", ".", "debug", "(", "arg_5", ")", "return", "False", "arg_3", ".", "access_token", "=", "arg_4", "arg_3", ".", "user", "=", "arg_4", ".", "user", "arg_3", ".", "scopes", "=", "arg_2", "if", "hasattr", "(", "arg_4", ",", "'client'", ")", ":", "arg_3", ".", "client", "=", "arg_4", ".", "client", "elif", "hasattr", "(", "arg_4", ",", "'client_id'", ")", ":", "arg_3", ".", "client", "=", "arg_0", ".", "_clientgetter", "(", "arg_4", ".", "client_id", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Validate access token.\n\n        :param token: A string of random characters\n        :param scopes: A list of scopes\n        :param request: The Request object passed by oauthlib\n\n        The validation validates:\n\n            1) if the token is available\n            2) if the token has expired\n            3) if the scopes are available\n        \"\"\"\n        log.debug('Validate bearer token %r', arg_1)\n        arg_4 = arg_0._tokengetter(arg_7=arg_1)\n        if not arg_4:\n            arg_5 = 'Bearer token not found.'\n            arg_3.error_message = arg_5\n            log.debug(arg_5)\n            return False\n\n        # validate expires\n        if arg_4.expires is not None and \\\n                datetime.datetime.utcnow() > arg_4.expires:\n            arg_5 = 'Bearer token is expired.'\n            arg_3.error_message = arg_5\n            log.debug(arg_5)\n            return False\n\n        # validate scopes\n        if arg_2 and not set(arg_4.scopes) & set(arg_2):\n            arg_5 = 'Bearer token scope not valid.'\n            arg_3.error_message = arg_5\n            log.debug(arg_5)\n            return False\n\n        arg_3.access_token = arg_4\n        arg_3.user = arg_4.user\n        arg_3.scopes = arg_2\n\n        if hasattr(arg_4, 'client'):\n            arg_3.client = arg_4.client\n        elif hasattr(arg_4, 'client_id'):\n            arg_3.client = arg_0._clientgetter(arg_4.client_id)\n        return True", "path": "flask_oauthlib/provider/oauth2.py", "identifier": "OAuth2RequestValidator.validate_bearer_token", "docstring": "Validate access token.\n\n        :param token: A string of random characters\n        :param scopes: A list of scopes\n        :param request: The Request object passed by oauthlib\n\n        The validation validates:\n\n            1) if the token is available\n            2) if the token has expired\n            3) if the scopes are available", "docstring_tokens": ["Validate", "access", "token", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 254916}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L243-L251", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Set renewal, rebinding times.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "'setting timeouts'", ")", "arg_0", ".", "set_timeout", "(", "arg_0", ".", "current_state", ",", "arg_0", ".", "renewing_time_expires", ",", "arg_0", ".", "client", ".", "lease", ".", "renewal_time", ")", "arg_0", ".", "set_timeout", "(", "arg_0", ".", "current_state", ",", "arg_0", ".", "rebinding_time_expires", ",", "arg_0", ".", "client", ".", "lease", ".", "rebinding_time", ")"], "function": "def Func(arg_0):\n        \"\"\"Set renewal, rebinding times.\"\"\"\n        logger.debug('setting timeouts')\n        arg_0.set_timeout(arg_0.current_state,\n                         arg_0.renewing_time_expires,\n                         arg_0.client.lease.renewal_time)\n        arg_0.set_timeout(arg_0.current_state,\n                         arg_0.rebinding_time_expires,\n                         arg_0.client.lease.rebinding_time)", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.set_timers", "docstring": "Set renewal, rebinding times.", "docstring_tokens": ["Set", "renewal", "rebinding", "times", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 254917}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/linecache.py#L72-L139", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Update a cache entry and return its list of lines.\n    If something's wrong, print a message, discard the cache entry,\n    and return an empty list.", "language": "python", "parameters": "(filename, module_globals=None)", "return_statement": "return lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "in", "arg_9", ":", "del", "arg_9", "[", "arg_0", "]", "if", "not", "arg_0", "or", "(", "arg_0", ".", "startswith", "(", "'<'", ")", "and", "arg_0", ".", "endswith", "(", "'>'", ")", ")", ":", "return", "[", "]", "arg_2", "=", "arg_0", "try", ":", "arg_3", "=", "os", ".", "stat", "(", "arg_2", ")", "except", "OSError", ":", "arg_4", "=", "arg_0", "if", "arg_1", "and", "'__loader__'", "in", "arg_1", ":", "arg_5", "=", "arg_1", ".", "get", "(", "'__name__'", ")", "arg_6", "=", "arg_1", "[", "'__loader__'", "]", "arg_7", "=", "getattr", "(", "arg_6", ",", "'get_source'", ",", "None", ")", "if", "arg_5", "and", "arg_7", ":", "try", ":", "arg_8", "=", "arg_7", "(", "arg_5", ")", "except", "(", "ImportError", ",", "IOError", ")", ":", "pass", "else", ":", "if", "arg_8", "is", "None", ":", "return", "[", "]", "arg_9", "[", "arg_0", "]", "=", "(", "len", "(", "arg_8", ")", ",", "None", ",", "[", "line", "+", "'\\n'", "for", "line", "in", "arg_8", ".", "splitlines", "(", ")", "]", ",", "arg_2", ")", "return", "arg_9", "[", "arg_0", "]", "[", "2", "]", "if", "os", ".", "path", ".", "isabs", "(", "arg_0", ")", ":", "return", "[", "]", "for", "arg_10", "in", "sys", ".", "path", ":", "try", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_10", ",", "arg_4", ")", "except", "(", "TypeError", ",", "AttributeError", ")", ":", "continue", "try", ":", "arg_3", "=", "os", ".", "stat", "(", "arg_2", ")", "break", "except", "os", ".", "error", ":", "pass", "else", ":", "return", "[", "]", "try", ":", "with", "open", "(", "arg_2", ",", "'rU'", ")", "as", "fp", ":", "arg_11", "=", "fp", ".", "readlines", "(", ")", "except", "IOError", ":", "return", "[", "]", "if", "arg_11", "and", "not", "arg_11", "[", "-", "1", "]", ".", "endswith", "(", "'\\n'", ")", ":", "arg_11", "[", "-", "1", "]", "+=", "'\\n'", "arg_12", ",", "arg_13", "=", "arg_3", ".", "st_size", ",", "arg_3", ".", "st_mtime", "arg_9", "[", "arg_0", "]", "=", "arg_12", ",", "arg_13", ",", "arg_11", ",", "arg_2", "return", "arg_11"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Update a cache entry and return its list of lines.\n    If something's wrong, print a message, discard the cache entry,\n    and return an empty list.\"\"\"\n\n    if arg_0 in arg_9:\n        del arg_9[arg_0]\n    if not arg_0 or (arg_0.startswith('<') and arg_0.endswith('>')):\n        return []\n\n    arg_2 = arg_0\n    try:\n        arg_3 = os.stat(arg_2)\n    except OSError:\n        arg_4 = arg_0\n\n        # Try for a __loader__, if available\n        if arg_1 and '__loader__' in arg_1:\n            arg_5 = arg_1.get('__name__')\n            arg_6 = arg_1['__loader__']\n            arg_7 = getattr(arg_6, 'get_source', None)\n\n            if arg_5 and arg_7:\n                try:\n                    arg_8 = arg_7(arg_5)\n                except (ImportError, IOError):\n                    pass\n                else:\n                    if arg_8 is None:\n                        # No luck, the PEP302 loader cannot find the source\n                        # for this module.\n                        return []\n                    arg_9[arg_0] = (\n                        len(arg_8), None,\n                        [line+'\\n' for line in arg_8.splitlines()], arg_2\n                    )\n                    return arg_9[arg_0][2]\n\n        # Try looking through the module search path, which is only useful\n        # when handling a relative filename.\n        if os.path.isabs(arg_0):\n            return []\n\n        for arg_10 in sys.path:\n            # When using imputil, sys.path may contain things other than\n            # strings; ignore them when it happens.\n            try:\n                arg_2 = os.path.join(arg_10, arg_4)\n            except (TypeError, AttributeError):\n                # Not sufficiently string-like to do anything useful with.\n                continue\n            try:\n                arg_3 = os.stat(arg_2)\n                break\n            except os.error:\n                pass\n        else:\n            return []\n    try:\n        with open(arg_2, 'rU') as fp:\n            arg_11 = fp.readlines()\n    except IOError:\n        return []\n    if arg_11 and not arg_11[-1].endswith('\\n'):\n        arg_11[-1] += '\\n'\n    arg_12, arg_13 = arg_3.st_size, arg_3.st_mtime\n    arg_9[arg_0] = arg_12, arg_13, arg_11, arg_2\n    return arg_11", "path": "third_party/stdlib/linecache.py", "identifier": "updatecache", "docstring": "Update a cache entry and return its list of lines.\n    If something's wrong, print a message, discard the cache entry,\n    and return an empty list.", "docstring_tokens": ["Update", "a", "cache", "entry", "and", "return", "its", "list", "of", "lines", ".", "If", "something", "s", "wrong", "print", "a", "message", "discard", "the", "cache", "entry", "and", "return", "an", "empty", "list", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 254918}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L195-L212", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Print header information and other derived information.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "\"\\n--- File Info ---\"", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "file_header", ".", "items", "(", ")", ":", "if", "arg_1", "==", "'src_raj'", ":", "arg_2", "=", "arg_2", ".", "to_string", "(", "unit", "=", "u", ".", "hour", ",", "sep", "=", "':'", ")", "if", "arg_1", "==", "'src_dej'", ":", "arg_2", "=", "arg_2", ".", "to_string", "(", "unit", "=", "u", ".", "deg", ",", "sep", "=", "':'", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "arg_1", ",", "arg_2", ")", ")", "print", "(", "\"\\n%16s : %32s\"", "%", "(", "\"Num ints in file\"", ",", "arg_0", ".", "n_ints_in_file", ")", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "\"File shape\"", ",", "arg_0", ".", "file_shape", ")", ")", "print", "(", "\"--- Selection Info ---\"", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "\"Data selection shape\"", ",", "arg_0", ".", "selection_shape", ")", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "\"Minimum freq (MHz)\"", ",", "arg_0", ".", "container", ".", "f_start", ")", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "\"Maximum freq (MHz)\"", ",", "arg_0", ".", "container", ".", "f_stop", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Print header Funcrmation and other derived Funcrmation. \"\"\"\n\n        print(\"\\n--- File Info ---\")\n\n        for arg_1, arg_2 in arg_0.file_header.items():\n            if arg_1 == 'src_raj':\n                arg_2 = arg_2.to_string(unit=u.hour, sep=':')\n            if arg_1 == 'src_dej':\n                arg_2 = arg_2.to_string(unit=u.deg, sep=':')\n            print(\"%16s : %32s\" % (arg_1, arg_2))\n\n        print(\"\\n%16s : %32s\" % (\"Num ints in file\", arg_0.n_ints_in_file))\n        print(\"%16s : %32s\" % (\"File shape\", arg_0.file_shape))\n        print(\"--- Selection Info ---\")\n        print(\"%16s : %32s\" % (\"Data selection shape\", arg_0.selection_shape))\n        print(\"%16s : %32s\" % (\"Minimum freq (MHz)\", arg_0.container.f_start))\n        print(\"%16s : %32s\" % (\"Maximum freq (MHz)\", arg_0.container.f_stop))", "path": "blimpy/waterfall.py", "identifier": "Waterfall.info", "docstring": "Print header information and other derived information.", "docstring_tokens": ["Print", "header", "information", "and", "other", "derived", "information", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 254919}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdflite.py#L90-L113", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Prompt the objects to output pdf code, and save to file.", "language": "python", "parameters": "(self)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "document", ".", "_set_page_numbers", "(", ")", "arg_0", ".", "_put_header", "(", ")", "arg_0", ".", "_put_pages", "(", ")", "arg_0", ".", "_put_resources", "(", ")", "arg_0", ".", "_put_information", "(", ")", "arg_0", ".", "_put_catalog", "(", ")", "arg_0", ".", "_put_trailer", "(", ")", "if", "hasattr", "(", "arg_0", ".", "destination", ",", "\"write\"", ")", ":", "arg_1", "=", "arg_0", ".", "_output_to_io", "(", ")", "elif", "arg_0", ".", "destination", "==", "'string'", ":", "arg_1", "=", "arg_0", ".", "_output_to_string", "(", ")", "else", ":", "arg_0", ".", "_output_to_file", "(", ")", "arg_1", "=", "None", "return", "arg_1"], "function": "def Func(arg_0):\r\n        \"\"\" Prompt the objects to output pdf code, and save to file. \"\"\"\r\n        arg_0.document._set_page_numbers()\r\n        # Places header, pages, page content first.\r\n        arg_0._put_header()\r\n        arg_0._put_pages()\r\n        arg_0._put_resources()\r\n        # Information object\r\n        arg_0._put_information()\r\n        # Catalog object\r\n        arg_0._put_catalog()\r\n        # Cross-reference object\r\n        #self._put_cross_reference()\r\n        # Trailer object\r\n        arg_0._put_trailer()\r\n\r\n        if hasattr(arg_0.destination, \"write\"):\r\n            arg_1 = arg_0._output_to_io()\r\n        elif arg_0.destination == 'string':\r\n            arg_1 = arg_0._output_to_string()\r\n        else:\r\n            arg_0._output_to_file()\r\n            arg_1 = None\r\n        return arg_1", "path": "pypdflite/pdflite.py", "identifier": "PDFLite.close", "docstring": "Prompt the objects to output pdf code, and save to file.", "docstring_tokens": ["Prompt", "the", "objects", "to", "output", "pdf", "code", "and", "save", "to", "file", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 254920}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/index_OLD.py#L1-L9", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "given a list of files, return a dict organized by extension.", "language": "python", "parameters": "(fnames)", "return_statement": "return byExt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"abf\"", ":", "[", "]", ",", "\"jpg\"", ":", "[", "]", ",", "\"tif\"", ":", "[", "]", "}", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "os", ".", "path", ".", "splitext", "(", "arg_2", ")", "[", "1", "]", ".", "replace", "(", "\".\"", ",", "''", ")", ".", "lower", "(", ")", "if", "not", "arg_3", "in", "arg_1", ".", "keys", "(", ")", ":", "arg_1", "[", "arg_3", "]", "=", "[", "]", "arg_1", "[", "arg_3", "]", "=", "arg_1", "[", "arg_3", "]", "+", "[", "arg_2", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"given a list of files, return a dict organized by extension.\"\"\"\n    arg_1={\"abf\":[],\"jpg\":[],\"tif\":[]} # prime it with empties\n    for arg_2 in arg_0:\n        arg_3 = os.path.splitext(arg_2)[1].replace(\".\",'').lower()\n        if not arg_3 in arg_1.keys():\n            arg_1[arg_3]=[]\n        arg_1[arg_3]=arg_1[arg_3]+[arg_2]\n    return arg_1", "path": "swhlab/indexing/index_OLD.py", "identifier": "filesByExtension", "docstring": "given a list of files, return a dict organized by extension.", "docstring_tokens": ["given", "a", "list", "of", "files", "return", "a", "dict", "organized", "by", "extension", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 254921}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/panel.py#L133-L153", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Set the correct version for each gene\n        Loop over the genes in the new panel", "language": "python", "parameters": "(self, new_genes, new_panel, old_version)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "LOG", ".", "info", "(", "'Updating versions for new genes'", ")", "arg_4", "=", "arg_2", "[", "'version'", "]", "for", "arg_5", "in", "arg_2", "[", "'genes'", "]", ":", "arg_6", "=", "arg_5", "[", "'hgnc_id'", "]", "if", "arg_6", "in", "arg_1", ":", "arg_5", "[", "'database_entry_version'", "]", "=", "arg_4", "continue", "arg_5", "[", "'database_entry_version'", "]", "=", "arg_3", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Set the correct version for each gene\n        Loop over the genes in the new panel\n\n        Args:\n            new_genes(set(str)): Set with the new gene symbols\n            new_panel(dict)\n\n        \"\"\"\n        LOG.info('Updating versions for new genes')\n        arg_4 = arg_2['version']\n        for arg_5 in arg_2['genes']:\n            arg_6 = arg_5['hgnc_id']\n            # If the gene is new we add the version\n            if arg_6 in arg_1:\n                arg_5['database_entry_version'] = arg_4\n                continue\n            # If the gene is old it will have the previous version\n            arg_5['database_entry_version'] = arg_3\n\n        return", "path": "scout/adapter/mongo/panel.py", "identifier": "PanelHandler.update_mim_version", "docstring": "Set the correct version for each gene\n        Loop over the genes in the new panel\n\n        Args:\n            new_genes(set(str)): Set with the new gene symbols\n            new_panel(dict)", "docstring_tokens": ["Set", "the", "correct", "version", "for", "each", "gene", "Loop", "over", "the", "genes", "in", "the", "new", "panel"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 254922}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1261-L1377", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds a new item to the tree.", "language": "python", "parameters": "(self, start_node, split_names, type_name, group_type_name,\n                     instance, constructor, args, kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", ":", "try", ":", "arg_9", "=", "arg_1", "arg_10", "=", "len", "(", "arg_2", ")", "-", "1", "arg_11", "=", "arg_3", "==", "LINK", "arg_12", "=", "False", "for", "arg_13", ",", "arg_14", "in", "enumerate", "(", "arg_2", ")", ":", "if", "arg_14", "not", "in", "arg_9", ".", "_children", ":", "if", "arg_13", "==", "arg_10", ":", "if", "arg_11", ":", "arg_15", "=", "arg_0", ".", "_create_link", "(", "arg_9", ",", "arg_14", ",", "arg_5", ")", "arg_12", "=", "True", "elif", "arg_4", "!=", "arg_3", ":", "arg_15", "=", "arg_0", ".", "_create_any_param_or_result", "(", "arg_9", ",", "arg_14", ",", "arg_3", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "arg_0", ".", "_flat_leaf_storage_dict", "[", "arg_15", ".", "v_full_name", "]", "=", "arg_15", "else", ":", "arg_15", "=", "arg_0", ".", "_create_any_group", "(", "arg_9", ",", "arg_14", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "else", ":", "arg_15", "=", "arg_0", ".", "_create_any_group", "(", "arg_9", ",", "arg_14", ",", "arg_4", ")", "if", "arg_14", "in", "arg_0", ".", "_root_instance", ".", "_run_information", ":", "arg_0", ".", "_root_instance", ".", "_run_parent_groups", "[", "arg_9", ".", "v_full_name", "]", "=", "arg_9", "if", "arg_0", ".", "_root_instance", ".", "_is_run", ":", "if", "arg_12", ":", "arg_0", ".", "_root_instance", ".", "_new_links", "[", "(", "arg_9", ".", "v_full_name", ",", "arg_14", ")", "]", "=", "(", "arg_9", ",", "arg_15", ")", "else", ":", "arg_0", ".", "_root_instance", ".", "_new_nodes", "[", "(", "arg_9", ".", "v_full_name", ",", "arg_14", ")", "]", "=", "(", "arg_9", ",", "arg_15", ")", "else", ":", "if", "arg_14", "in", "arg_9", ".", "_links", ":", "raise", "AttributeError", "(", "'You cannot hop over links when adding '", "'data to the tree. '", "'There is a link called `%s` under `%s`.'", "%", "(", "arg_14", ",", "arg_9", ".", "v_full_name", ")", ")", "if", "arg_13", "==", "arg_10", ":", "if", "arg_0", ".", "_root_instance", ".", "_no_clobber", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'You already have a group/instance/link `%s` '", "'under `%s`. '", "'However, you set `v_no_clobber=True`, '", "'so I will ignore your addition of '", "'data.'", "%", "(", "arg_14", ",", "arg_9", ".", "v_full_name", ")", ")", "else", ":", "raise", "AttributeError", "(", "'You already have a group/instance/link `%s` '", "'under `%s`'", "%", "(", "arg_14", ",", "arg_9", ".", "v_full_name", ")", ")", "arg_9", "=", "arg_9", ".", "_children", "[", "arg_14", "]", "return", "arg_9", "except", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Failed adding `%s` under `%s`.'", "%", "(", "arg_14", ",", "arg_1", ".", "v_full_name", ")", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                     arg_5, arg_6, arg_7, arg_8):\n        \"\"\"Adds a new item to the tree.\n\n        The item can be an already given instance or it is created new.\n\n        :param start_node:\n\n            Parental node the adding of the item was initiated from.\n\n        :param split_names:\n\n            List of names of the new item\n\n        :param type_name:\n\n            Type of item 'RESULT', 'RESULT_GROUP', 'PARAMETER', etc. See name of constants\n            at beginning of the python module.\n\n        :param group_type_name:\n\n            Name of the subbranch the item is added to 'RESULT_GROUP', 'PARAMETER_GROUP' etc.\n            See name of constants at beginning of this python module.\n\n        :param instance:\n\n            Here an already given instance can be passed. If instance should be created new\n            pass None.\n\n        :param constructor:\n\n            If instance should be created new pass a constructor class. If None is passed\n            the standard constructor for the instance is chosen.\n\n        :param args:\n\n            Additional arguments passed to instance construction\n\n        :param kwargs:\n\n            Additional keyword arguments passed to instance construction\n\n        :return: The new added instance\n\n        :raises: ValueError if naming of the new item is invalid\n\n        \"\"\"\n\n        # Then walk iteratively from the start node as specified by the new name and create\n        # new empty groups on the fly\n        try:\n            arg_9 = arg_1\n            arg_10 = len(arg_2) - 1\n            arg_11 = arg_3 == LINK\n            arg_12 = False\n            # last_name = start_node.v_crun\n            for arg_13, arg_14 in enumerate(arg_2):\n                if arg_14 not in arg_9._children:\n                    if arg_13 == arg_10:\n                        if arg_11:\n                            arg_15 = arg_0._create_link(arg_9, arg_14, arg_5)\n                            arg_12 = True\n                        elif arg_4 != arg_3:\n                            # We are at the end of the chain and we add a leaf node\n\n                            arg_15 = arg_0._create_any_param_or_result(arg_9,\n                                                                        arg_14,\n                                                                        arg_3,\n                                                                        arg_5,\n                                                                        arg_6,\n                                                                        arg_7, arg_8)\n\n                            arg_0._flat_leaf_storage_dict[arg_15.v_full_name] = arg_15\n                        else:\n                            # We add a group as desired\n                            arg_15 = arg_0._create_any_group(arg_9, arg_14,\n                                                              arg_4,\n                                                              arg_5,\n                                                              arg_6,\n                                                              arg_7, arg_8)\n                    else:\n                        # We add a group on the fly\n                        arg_15 = arg_0._create_any_group(arg_9, arg_14,\n                                                          arg_4)\n\n\n                    if arg_14 in arg_0._root_instance._run_information:\n                        arg_0._root_instance._run_parent_groups[arg_9.v_full_name] = arg_9\n                    if arg_0._root_instance._is_run:\n                        if arg_12:\n                            arg_0._root_instance._new_links[(arg_9.v_full_name, arg_14)] = \\\n                                (arg_9, arg_15)\n                        else:\n                            arg_0._root_instance._new_nodes[(arg_9.v_full_name, arg_14)] = \\\n                                (arg_9, arg_15)\n                else:\n                    if arg_14 in arg_9._links:\n                        raise AttributeError('You cannot hop over links when adding '\n                                             'data to the tree. '\n                                             'There is a link called `%s` under `%s`.' %\n                                             (arg_14, arg_9.v_full_name))\n                    if arg_13 == arg_10:\n                        if arg_0._root_instance._no_clobber:\n                            arg_0._logger.warning('You already have a group/instance/link `%s` '\n                                                 'under `%s`. '\n                                                 'However, you set `v_no_clobber=True`, '\n                                                 'so I will ignore your addition of '\n                                                 'data.' % (arg_14, arg_9.v_full_name))\n                        else:\n                            raise AttributeError('You already have a group/instance/link `%s` '\n                                                 'under `%s`' % (arg_14, arg_9.v_full_name))\n                arg_9 = arg_9._children[arg_14]\n            return arg_9\n        except:\n            arg_0._logger.error('Failed adding `%s` under `%s`.' %\n                               (arg_14, arg_1.v_full_name))\n            raise", "path": "pypet/naturalnaming.py", "identifier": "NaturalNamingInterface._add_to_tree", "docstring": "Adds a new item to the tree.\n\n        The item can be an already given instance or it is created new.\n\n        :param start_node:\n\n            Parental node the adding of the item was initiated from.\n\n        :param split_names:\n\n            List of names of the new item\n\n        :param type_name:\n\n            Type of item 'RESULT', 'RESULT_GROUP', 'PARAMETER', etc. See name of constants\n            at beginning of the python module.\n\n        :param group_type_name:\n\n            Name of the subbranch the item is added to 'RESULT_GROUP', 'PARAMETER_GROUP' etc.\n            See name of constants at beginning of this python module.\n\n        :param instance:\n\n            Here an already given instance can be passed. If instance should be created new\n            pass None.\n\n        :param constructor:\n\n            If instance should be created new pass a constructor class. If None is passed\n            the standard constructor for the instance is chosen.\n\n        :param args:\n\n            Additional arguments passed to instance construction\n\n        :param kwargs:\n\n            Additional keyword arguments passed to instance construction\n\n        :return: The new added instance\n\n        :raises: ValueError if naming of the new item is invalid", "docstring_tokens": ["Adds", "a", "new", "item", "to", "the", "tree", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254923}
{"url": "https://github.com/Danielhiversen/pyTibber/blob/114ebc3dd49f6affd93665b0862d4cbdea03e9ef/tibber/__init__.py#L183-L190", "sha": "114ebc3dd49f6affd93665b0862d4cbdea03e9ef", "docstring_summary": "Retun an instance of TibberHome for given home id.", "language": "python", "parameters": "(self, home_id)", "return_statement": "return self._homes[home_id]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_all_home_ids", ":", "_LOGGER", ".", "error", "(", "\"Could not find any Tibber home with id: %s\"", ",", "arg_1", ")", "return", "None", "if", "arg_1", "not", "in", "arg_0", ".", "_homes", ".", "keys", "(", ")", ":", "arg_0", ".", "_homes", "[", "arg_1", "]", "=", "TibberHome", "(", "arg_1", ",", "arg_0", ")", "return", "arg_0", ".", "_homes", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Retun an instance of TibberHome for given home id.\"\"\"\n        if arg_1 not in arg_0._all_home_ids:\n            _LOGGER.error(\"Could not find any Tibber home with id: %s\", arg_1)\n            return None\n        if arg_1 not in arg_0._homes.keys():\n            arg_0._homes[arg_1] = TibberHome(arg_1, arg_0)\n        return arg_0._homes[arg_1]", "path": "tibber/__init__.py", "identifier": "Tibber.get_home", "docstring": "Retun an instance of TibberHome for given home id.", "docstring_tokens": ["Retun", "an", "instance", "of", "TibberHome", "for", "given", "home", "id", "."], "nwo": "Danielhiversen/pyTibber", "score": 0.2877815456703515, "idx": 254924}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/scripts/publish_release.py#L100-L110", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Identify the kind of release by comparing to existing ones.", "language": "python", "parameters": "(target, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split", "(", "\".\"", ")", "arg_3", "=", "[", "intify", "(", "basename", "(", "f", ")", ")", "for", "f", "in", "glob", "(", "join", "(", "arg_0", ",", "\"[0-9]*.md\"", ")", ")", "]", "arg_4", "=", "max", "(", "arg_3", ")", "if", "int", "(", "arg_2", "[", "0", "]", ")", ">", "arg_4", "[", "0", "]", ":", "return", "\"major\"", "elif", "int", "(", "arg_2", "[", "1", "]", ")", ">", "arg_4", "[", "1", "]", ":", "return", "\"minor\"", "else", ":", "return", "\"patch\""], "function": "def Func(arg_0, arg_1):\n    \"\"\"Identify the kind of release by comparing to existing ones.\"\"\"\n    arg_2 = arg_1.split(\".\")\n    arg_3 = [intify(basename(f)) for f in glob(join(arg_0, \"[0-9]*.md\"))]\n    arg_4 = max(arg_3)\n    if int(arg_2[0]) > arg_4[0]:\n        return \"major\"\n    elif int(arg_2[1]) > arg_4[1]:\n        return \"minor\"\n    else:\n        return \"patch\"", "path": "scripts/publish_release.py", "identifier": "find_bump", "docstring": "Identify the kind of release by comparing to existing ones.", "docstring_tokens": ["Identify", "the", "kind", "of", "release", "by", "comparing", "to", "existing", "ones", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 254925}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1730-L1747", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Append data to this frame row-wise.", "language": "python", "parameters": "(self, data)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert_is_type", "(", "arg_1", ",", "H2OFrame", ",", "[", "H2OFrame", "]", ")", "arg_2", "=", "[", "arg_1", "]", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", "else", "arg_1", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", ".", "ncol", "!=", "arg_0", ".", "ncol", ":", "raise", "H2OValueError", "(", "\"Cannot row-bind a dataframe with %d columns to a data frame with %d columns: \"", "\"the columns must match\"", "%", "(", "arg_3", ".", "ncol", ",", "arg_0", ".", "ncol", ")", ")", "if", "arg_3", ".", "columns", "!=", "arg_0", ".", "columns", "or", "arg_3", ".", "types", "!=", "arg_0", ".", "types", ":", "raise", "H2OValueError", "(", "\"Column names and types must match for Func() to work\"", ")", "arg_4", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "*", "arg_2", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")", "arg_4", ".", "_ex", ".", "_cache", ".", "nrows", "=", "arg_0", ".", "nrow", "+", "sum", "(", "arg_3", ".", "nrow", "for", "arg_3", "in", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Append data to this frame row-wise.\n\n        :param data: an H2OFrame or a list of H2OFrame's to be combined with current frame row-wise.\n        :returns: this H2OFrame with all frames in data appended row-wise.\n        \"\"\"\n        assert_is_type(arg_1, H2OFrame, [H2OFrame])\n        arg_2 = [arg_1] if not isinstance(arg_1, list) else arg_1\n        for arg_3 in arg_2:\n            if arg_3.ncol != arg_0.ncol:\n                raise H2OValueError(\"Cannot row-bind a dataframe with %d columns to a data frame with %d columns: \"\n                                    \"the columns must match\" % (arg_3.ncol, arg_0.ncol))\n            if arg_3.columns != arg_0.columns or arg_3.types != arg_0.types:\n                raise H2OValueError(\"Column names and types must match for Func() to work\")\n        arg_4 = H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, *arg_2), cache=arg_0._ex._cache)\n        arg_4._ex._cache.nrows = arg_0.nrow + sum(arg_3.nrow for arg_3 in arg_2)\n        return arg_4", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.rbind", "docstring": "Append data to this frame row-wise.\n\n        :param data: an H2OFrame or a list of H2OFrame's to be combined with current frame row-wise.\n        :returns: this H2OFrame with all frames in data appended row-wise.", "docstring_tokens": ["Append", "data", "to", "this", "frame", "row", "-", "wise", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 254926}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L144-L154", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "The value used for processing. Can be a tuple.\n        with optional extra bits", "language": "python", "parameters": "(self, extra=None)", "return_statement": "return self.code.value(self.index)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ".", "code", ",", "WithExtra", ")", ":", "if", "not", "0", "<=", "arg_1", "<", "1", "<<", "arg_0", ".", "extraBits", "(", ")", ":", "raise", "ValueError", "(", "\"Func: extra Func doesn't fit in extraBits\"", ")", "return", "arg_0", ".", "code", ".", "Func", "(", "arg_0", ".", "index", ",", "arg_1", ")", "if", "arg_1", "is", "not", "None", ":", "raise", "ValueError", "(", "'Func: no extra bits for this code'", ")", "return", "arg_0", ".", "code", ".", "Func", "(", "arg_0", ".", "index", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"The Func used for processing. Can be a tuple.\n        with optional extra bits\n        \"\"\"\n        if isinstance(arg_0.code, WithExtra):\n            if not 0<=arg_1<1<<arg_0.extraBits():\n                raise ValueError(\"Func: extra Func doesn't fit in extraBits\")\n            return arg_0.code.Func(arg_0.index, arg_1)\n        if arg_1 is not None:\n            raise ValueError('Func: no extra bits for this code')\n        return arg_0.code.Func(arg_0.index)", "path": "research/brotlidump.py", "identifier": "Symbol.value", "docstring": "The value used for processing. Can be a tuple.\n        with optional extra bits", "docstring_tokens": ["The", "value", "used", "for", "processing", ".", "Can", "be", "a", "tuple", ".", "with", "optional", "extra", "bits"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 254927}
{"url": "https://github.com/opencast/pyCA/blob/c89b168d4780d157e1b3f7676628c1b131956a88/pyca/utils.py#L112-L123", "sha": "c89b168d4780d157e1b3f7676628c1b131956a88", "docstring_summary": "Get the location of a given service from Opencast and add it to the\n    current configuration.", "language": "python", "parameters": "(service)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "not", "arg_1", "(", ")", ".", "get", "(", "'service-'", "+", "arg_0", ")", "and", "not", "terminate", "(", ")", ":", "try", ":", "arg_1", "(", ")", "[", "'service-'", "+", "arg_0", "]", "=", "get_service", "(", "'org.opencastproject.'", "+", "arg_0", ")", "except", "pycurl", ".", "error", "as", "e", ":", "logger", ".", "error", "(", "'Could not get %s endpoint: %s. Retrying in 5s'", "%", "(", "arg_0", ",", "e", ")", ")", "time", ".", "sleep", "(", "5.0", ")"], "function": "def Func(arg_0):\n    '''Get the location of a given service from Opencast and add it to the\n    current configuration.\n    '''\n    while not arg_1().get('service-' + arg_0) and not terminate():\n        try:\n            arg_1()['service-' + arg_0] = \\\n                get_service('org.opencastproject.' + arg_0)\n        except pycurl.error as e:\n            logger.error('Could not get %s endpoint: %s. Retrying in 5s' %\n                         (arg_0, e))\n            time.sleep(5.0)", "path": "pyca/utils.py", "identifier": "configure_service", "docstring": "Get the location of a given service from Opencast and add it to the\n    current configuration.", "docstring_tokens": ["Get", "the", "location", "of", "a", "given", "service", "from", "Opencast", "and", "add", "it", "to", "the", "current", "configuration", "."], "nwo": "opencast/pyCA", "score": 0.38750565733100095, "idx": 254928}
{"url": "https://github.com/ndokter/dsmr_parser/blob/c04b0a5add58ce70153eede1a87ca171876b61c7/dsmr_parser/clients/protocol.py#L49-L55", "sha": "c04b0a5add58ce70153eede1a87ca171876b61c7", "docstring_summary": "Creates a DSMR asyncio protocol coroutine using TCP connection.", "language": "python", "parameters": "(host, port, dsmr_version,\n                           telegram_callback, loop=None)", "return_statement": "return conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", ",", "arg_6", "=", "create_dsmr_protocol", "(", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", "arg_7", "=", "arg_4", ".", "create_connection", "(", "arg_5", ",", "arg_0", ",", "arg_1", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2,\n                           arg_3, arg_4=None):\n    \"\"\"Creates a DSMR asyncio protocol coroutine using TCP connection.\"\"\"\n    arg_5, arg_6 = create_dsmr_protocol(\n        arg_2, arg_3, arg_4=None)\n    arg_7 = arg_4.create_connection(arg_5, arg_0, arg_1)\n    return arg_7", "path": "dsmr_parser/clients/protocol.py", "identifier": "create_tcp_dsmr_reader", "docstring": "Creates a DSMR asyncio protocol coroutine using TCP connection.", "docstring_tokens": ["Creates", "a", "DSMR", "asyncio", "protocol", "coroutine", "using", "TCP", "connection", "."], "nwo": "ndokter/dsmr_parser", "score": 0.6430124594429737, "idx": 254929}
{"url": "https://github.com/Danielhiversen/PyXiaomiGateway/blob/21b38ab972d67402f2124dba02101ddfd8d9e0b4/xiaomi_gateway/__init__.py#L142-L151", "sha": "21b38ab972d67402f2124dba02101ddfd8d9e0b4", "docstring_summary": "Start listening.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_LOGGER", ".", "info", "(", "'Creating Multicast Socket'", ")", "arg_0", ".", "_mcastsocket", "=", "arg_0", ".", "_create_mcast_socket", "(", ")", "arg_0", ".", "_Funcing", "=", "True", "arg_3", "=", "Thread", "(", "target", "=", "arg_0", ".", "_Func_to_msg", ",", "args", "=", "(", ")", ")", "arg_0", ".", "_threads", ".", "append", "(", "arg_3", ")", "arg_3", ".", "daemon", "=", "True", "arg_3", ".", "start", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Start Funcing.\"\"\"\n\n        _LOGGER.info('Creating Multicast Socket')\n        arg_0._mcastsocket = arg_0._create_mcast_socket()\n        arg_0._Funcing = True\n        arg_3 = Thread(target=arg_0._Func_to_msg, args=())\n        arg_0._threads.append(arg_3)\n        arg_3.daemon = True\n        arg_3.start()", "path": "xiaomi_gateway/__init__.py", "identifier": "XiaomiGatewayDiscovery.listen", "docstring": "Start listening.", "docstring_tokens": ["Start", "listening", "."], "nwo": "Danielhiversen/PyXiaomiGateway", "score": 0.883934617392526, "idx": 254930}
{"url": "https://github.com/grappa-py/grappa/blob/b128da8aef67501c310701c47508e7318241aa8b/grappa/runner.py#L49-L68", "sha": "b128da8aef67501c310701c47508e7318241aa8b", "docstring_summary": "Runs the current phase.", "language": "python", "parameters": "(self, ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "reverse", ":", "arg_0", ".", "engine", ".", "reverse", "(", ")", "if", "arg_0", ".", "engine", ".", "empty", ":", "raise", "AssertionError", "(", "'grappa: no assertions to Func'", ")", "try", ":", "return", "arg_0", ".", "Func_assertions", "(", "arg_1", ")", "except", "Exception", "as", "_err", ":", "if", "getattr", "(", "_err", ",", "'__legit__'", ",", "False", ")", ":", "raise", "_err", "return", "arg_0", ".", "render_error", "(", "arg_1", ",", "_err", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Runs the current phase.\n        \"\"\"\n        # Reverse engine assertion if needed\n        if arg_1.reverse:\n            arg_0.engine.reverse()\n\n        if arg_0.engine.empty:\n            raise AssertionError('grappa: no assertions to Func')\n\n        try:\n            # Run assertion in series and return error, if present\n            return arg_0.Func_assertions(arg_1)\n        except Exception as _err:\n            # Handle legit grappa internval errors\n            if getattr(_err, '__legit__', False):\n                raise _err\n            # Otherwise render it\n            return arg_0.render_error(arg_1, _err)", "path": "grappa/runner.py", "identifier": "Runner.run", "docstring": "Runs the current phase.", "docstring_tokens": ["Runs", "the", "current", "phase", "."], "nwo": "grappa-py/grappa", "score": 0.4496090913237058, "idx": 254931}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/pipeline_parser.py#L58-L84", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Recursively removes nested brackets", "language": "python", "parameters": "(text)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "1", "while", "arg_1", ":", "arg_0", ",", "arg_1", "=", "re", ".", "subn", "(", "r'\\([^()]*\\)'", ",", "''", ",", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Recursively removes nested brackets\n\n    This function is used to remove nested brackets from fork strings using\n    regular expressions\n\n    Parameters\n    ----------\n    text: str\n        The string that contains brackets with inner forks to be removed\n\n    Returns\n    -------\n    text: str\n        the string with only the processes that are not in inner forks, thus\n        the processes that belong to a given fork.\n\n    \"\"\"\n\n    arg_1 = 1  # run at least once for one level of fork\n    # Then this loop assures that all brackets will get removed in a nested\n    # structure\n    while arg_1:\n        # this removes non-nested brackets\n        arg_0, arg_1 = re.subn(r'\\([^()]*\\)', '', arg_0)\n\n    return arg_0", "path": "flowcraft/generator/pipeline_parser.py", "identifier": "remove_inner_forks", "docstring": "Recursively removes nested brackets\n\n    This function is used to remove nested brackets from fork strings using\n    regular expressions\n\n    Parameters\n    ----------\n    text: str\n        The string that contains brackets with inner forks to be removed\n\n    Returns\n    -------\n    text: str\n        the string with only the processes that are not in inner forks, thus\n        the processes that belong to a given fork.", "docstring_tokens": ["Recursively", "removes", "nested", "brackets"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 254932}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/tags.py#L104-L109", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Does the given port have this tag?", "language": "python", "parameters": "(self, model)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "tags", ":", "if", "arg_0", ".", "is_tag", "(", "arg_2", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Does the given port have this tag?\"\"\"\n        for arg_2 in arg_1.tags:\n            if arg_0.is_tag(arg_2):\n                return True\n        return False", "path": "quark/tags.py", "identifier": "Tag.has_tag", "docstring": "Does the given port have this tag?", "docstring_tokens": ["Does", "the", "given", "port", "have", "this", "tag?"], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 254933}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/filelikeiter.py#L139-L151", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Check whether the \"file\" is empty reading the single byte.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "read", "(", "1", ")", "if", "arg_1", ":", "if", "arg_0", ".", "buf", ":", "arg_0", ".", "buf", "=", "arg_1", "+", "arg_0", ".", "buf", "else", ":", "arg_0", ".", "buf", "=", "arg_1", "return", "False", "else", ":", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"\n        Check whether the \"file\" is empty reading the single byte.\n        \"\"\"\n        arg_1 = arg_0.read(1)\n        if arg_1:\n            if arg_0.buf:\n                arg_0.buf = arg_1 + arg_0.buf\n            else:\n                arg_0.buf = arg_1\n            return False\n        else:\n            return True", "path": "swiftly/filelikeiter.py", "identifier": "FileLikeIter.is_empty", "docstring": "Check whether the \"file\" is empty reading the single byte.", "docstring_tokens": ["Check", "whether", "the", "file", "is", "empty", "reading", "the", "single", "byte", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 254934}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4483-L4514", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Returns a list of string which are the virtual columns that are not used in any other virtual column.", "language": "python", "parameters": "(self)", "return_statement": "return root_nodes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "[", "]", "def", "walk", "(", "arg_3", ")", ":", "if", "isinstance", "(", "arg_3", ",", "six", ".", "string_types", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "if", "arg_3", "in", "arg_1", ":", "arg_1", ".", "remove", "(", "arg_3", ")", "else", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_3", "if", "arg_4", "in", "arg_0", ".", "virtual_columns", ":", "arg_2", ".", "append", "(", "arg_4", ")", "if", "arg_4", "in", "arg_1", ":", "arg_1", ".", "remove", "(", "arg_4", ")", "for", "arg_8", "in", "arg_7", ":", "walk", "(", "arg_8", ")", "for", "arg_9", "in", "arg_0", ".", "virtual_columns", ".", "keys", "(", ")", ":", "if", "arg_9", "not", "in", "arg_2", ":", "arg_1", ".", "append", "(", "arg_9", ")", "arg_3", "=", "arg_0", "[", "arg_9", "]", ".", "_graph", "(", ")", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_3", "for", "arg_8", "in", "arg_7", ":", "walk", "(", "arg_8", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns a list of string which are the virtual columns that are not used in any other virtual column.\"\"\"\n        # these lists (~used as ordered set) keep track of leafes and root nodes\n        # root nodes\n        arg_1 = []\n        arg_2 = []\n        def walk(arg_3):\n            # this function recursively walks the expression graph\n            if isinstance(arg_3, six.string_types):\n                # we end up at a leaf\n                arg_2.append(arg_3)\n                if arg_3 in arg_1:  # so it cannot be a root node\n                    arg_1.remove(arg_3)\n            else:\n                arg_4, arg_5, arg_6, arg_7 = arg_3\n                if arg_4 in arg_0.virtual_columns:\n                    # we encountered a virtual column, similar behaviour as leaf\n                    arg_2.append(arg_4)\n                    if arg_4 in arg_1:\n                        arg_1.remove(arg_4)\n                # resursive part\n                for arg_8 in arg_7:\n                    walk(arg_8)\n        for arg_9 in arg_0.virtual_columns.keys():\n            if arg_9 not in arg_2:\n                arg_1.append(arg_9)\n            arg_3 = arg_0[arg_9]._graph()\n            # we don't do the virtual column itself, just it's depedencies\n            arg_4, arg_5, arg_6, arg_7 = arg_3\n            for arg_8 in arg_7:\n                walk(arg_8)\n        return arg_1", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame._root_nodes", "docstring": "Returns a list of string which are the virtual columns that are not used in any other virtual column.", "docstring_tokens": ["Returns", "a", "list", "of", "string", "which", "are", "the", "virtual", "columns", "that", "are", "not", "used", "in", "any", "other", "virtual", "column", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 254935}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L564-L582", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "If there is space it sends data to server", "language": "python", "parameters": "(self, data, block=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_0", ".", "start", "(", "test_connection", "=", "False", ")", "while", "True", ":", "arg_3", "=", "arg_0", ".", "_req_rep", "(", "QueuingServerMessageListener", ".", "SPACE", ")", "if", "arg_3", "==", "QueuingServerMessageListener", ".", "SPACE_AVAILABLE", ":", "arg_0", ".", "_req_rep", "(", "(", "QueuingServerMessageListener", ".", "DATA", ",", "arg_1", ")", ")", "break", "else", ":", "time", ".", "sleep", "(", "0.01", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\" If there is space it sends data to server\n\n        If no space in the queue\n\n        It returns the request in every 10 millisecond\n\n        until there will be space in the queue.\n\n        \"\"\"\n\n        arg_0.start(test_connection=False)\n        while True:\n            arg_3 = arg_0._req_rep(QueuingServerMessageListener.SPACE)\n            if arg_3 == QueuingServerMessageListener.SPACE_AVAILABLE:\n                arg_0._req_rep((QueuingServerMessageListener.DATA, arg_1))\n                break\n            else:\n                time.sleep(0.01)", "path": "pypet/utils/mpwrappers.py", "identifier": "QueuingClient.put", "docstring": "If there is space it sends data to server\n\n        If no space in the queue\n\n        It returns the request in every 10 millisecond\n\n        until there will be space in the queue.", "docstring_tokens": ["If", "there", "is", "space", "it", "sends", "data", "to", "server"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 254936}
{"url": "https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L129-L134", "sha": "5e464e1fc3ae9c7e216f6dd94f879a967d065247", "docstring_summary": "recover triples from mapping.", "language": "python", "parameters": "(indexes, ents: bidict, rels: bidict)", "return_statement": "return triples", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ":", "arg_4", ".", "append", "(", "kgedata", ".", "Triple", "(", "arg_1", ".", "inverse", "[", "arg_5", ".", "head", "]", ",", "arg_3", ".", "inverse", "[", "arg_5", ".", "relation", "]", ",", "arg_1", ".", "inverse", "[", "arg_5", ".", "tail", "]", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2):\n    \"\"\"recover triples from mapping.\"\"\"\n    arg_4 = []\n    for arg_5 in arg_0:\n        arg_4.append(kgedata.Triple(arg_1.inverse[arg_5.head], arg_3.inverse[arg_5.relation], arg_1.inverse[arg_5.tail]))\n    return arg_4", "path": "kgekit/data.py", "identifier": "recover_triples_from_mapping", "docstring": "recover triples from mapping.", "docstring_tokens": ["recover", "triples", "from", "mapping", "."], "nwo": "fantasticfears/kgekit", "score": 0.15726537023232431, "idx": 254937}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L643-L645", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "set option on the correct option provider", "language": "python", "parameters": "(self, opt, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_all_options", "[", "arg_1", "]", ".", "set_option", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"set option on the correct option provider\"\"\"\n        arg_0._all_options[arg_1].set_option(arg_1, arg_2)", "path": "pylint/config.py", "identifier": "OptionsManagerMixIn.global_set_option", "docstring": "set option on the correct option provider", "docstring_tokens": ["set", "option", "on", "the", "correct", "option", "provider"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254938}
{"url": "https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L752-L834", "sha": "92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac", "docstring_summary": "Finalize canonical averages", "language": "python", "parameters": "(\n    number_of_nodes, ps, canonical_averages, alpha,\n)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", ")", ":", "arg_4", "=", "(", "(", "'percolation_probability_mean'", "in", "arg_2", ".", "dtype", ".", "names", ")", "and", "'percolation_probability_m2'", "in", "arg_2", ".", "dtype", ".", "names", ")", "arg_5", "=", "np", ".", "empty_like", "(", "arg_2", ",", "dtype", "=", "finalized_canonical_averages_dtype", "(", "arg_4", "=", "arg_4", ")", ",", ")", "arg_6", "=", "arg_2", "[", "'number_of_runs'", "]", "arg_7", "=", "np", ".", "sqrt", "(", "arg_2", "[", "'number_of_runs'", "]", ")", "arg_5", "[", "'number_of_runs'", "]", "=", "arg_6", "arg_5", "[", "'p'", "]", "=", "arg_1", "arg_5", "[", "'alpha'", "]", "=", "arg_3", "def", "_transform", "(", "arg_8", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "arg_11", "=", "False", ",", ")", ":", "if", "arg_9", "is", "None", ":", "arg_9", "=", "arg_8", "arg_12", "=", "[", "'{}_mean'", ".", "format", "(", "key", ")", "for", "key", "in", "[", "arg_8", ",", "arg_9", "]", "]", "arg_13", "=", "[", "'{}_m2'", ".", "format", "(", "arg_8", ")", ",", "'{}_std'", ".", "format", "(", "arg_9", ")", ",", "]", "arg_14", "=", "'{}_ci'", ".", "format", "(", "arg_9", ")", "arg_5", "[", "arg_12", "[", "1", "]", "]", "=", "arg_2", "[", "arg_12", "[", "0", "]", "]", "if", "arg_10", ":", "arg_5", "[", "arg_12", "[", "1", "]", "]", "/=", "arg_0", "arg_15", "=", "arg_2", "[", "arg_13", "[", "0", "]", "]", "arg_16", "=", "np", ".", "sqrt", "(", "(", "arg_15", ".", "T", "if", "arg_11", "else", "arg_15", ")", "/", "(", "arg_6", "-", "1", ")", ")", "arg_5", "[", "arg_13", "[", "1", "]", "]", "=", "(", "arg_16", ".", "T", "if", "arg_11", "else", "arg_16", ")", "if", "arg_10", ":", "arg_5", "[", "arg_13", "[", "1", "]", "]", "/=", "arg_0", "arg_15", "=", "arg_5", "[", "arg_13", "[", "1", "]", "]", "arg_17", "=", "(", "arg_15", ".", "T", "if", "arg_11", "else", "arg_15", ")", "/", "arg_7", "arg_15", "=", "arg_5", "[", "arg_12", "[", "1", "]", "]", "arg_18", "=", "(", "arg_15", ".", "T", "if", "arg_11", "else", "arg_15", ")", "arg_16", "=", "scipy", ".", "stats", ".", "t", ".", "interval", "(", "1", "-", "arg_3", ",", "df", "=", "arg_6", "-", "1", ",", "loc", "=", "arg_18", ",", "arg_17", "=", "arg_17", ",", ")", "(", "arg_5", "[", "arg_14", "]", "[", "...", ",", "0", "]", ",", "arg_5", "[", "arg_14", "]", "[", "...", ",", "1", "]", ")", "=", "(", "[", "my_array", ".", "T", "for", "my_array", "in", "arg_16", "]", "if", "arg_11", "else", "arg_16", ")", "if", "arg_4", ":", "_transform", "(", "'percolation_probability'", ")", "_transform", "(", "'max_cluster_size'", ",", "'percolation_strength'", ",", "arg_10", "=", "True", ")", "_transform", "(", "'moments'", ",", "arg_10", "=", "True", ",", "arg_11", "=", "True", ")", "return", "arg_5"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3,\n):\n    \"\"\"\n    Finalize canonical averages\n    \"\"\"\n\n    arg_4 = (\n        (\n            'percolation_probability_mean' in\n            arg_2.dtype.names\n        ) and\n        'percolation_probability_m2' in arg_2.dtype.names\n    )\n\n    # append values of p as an additional field\n    arg_5 = np.empty_like(\n        arg_2,\n        dtype=finalized_canonical_averages_dtype(\n            arg_4=arg_4\n        ),\n    )\n\n    arg_6 = arg_2['number_of_runs']\n    arg_7 = np.sqrt(arg_2['number_of_runs'])\n\n    arg_5['number_of_runs'] = arg_6\n    arg_5['p'] = arg_1\n    arg_5['alpha'] = arg_3\n\n    def _transform(\n        arg_8, arg_9=None, arg_10=False, arg_11=False,\n    ):\n        if arg_9 is None:\n            arg_9 = arg_8\n        arg_12 = [\n            '{}_mean'.format(key)\n            for key in [arg_8, arg_9]\n        ]\n        arg_13 = [\n            '{}_m2'.format(arg_8),\n            '{}_std'.format(arg_9),\n        ]\n        arg_14 = '{}_ci'.format(arg_9)\n\n        # calculate sample mean\n        arg_5[arg_12[1]] = arg_2[arg_12[0]]\n        if arg_10:\n            arg_5[arg_12[1]] /= arg_0\n\n        # calculate sample standard deviation\n        arg_15 = arg_2[arg_13[0]]\n        arg_16 = np.sqrt(\n            (arg_15.T if arg_11 else arg_15) / (arg_6 - 1)\n        )\n        arg_5[arg_13[1]] = (\n            arg_16.T if arg_11 else arg_16\n        )\n        if arg_10:\n            arg_5[arg_13[1]] /= arg_0\n\n        # calculate standard normal confidence interval\n        arg_15 = arg_5[arg_13[1]]\n        arg_17 = (arg_15.T if arg_11 else arg_15) / arg_7\n        arg_15 = arg_5[arg_12[1]]\n        arg_18 = (arg_15.T if arg_11 else arg_15)\n        arg_16 = scipy.stats.t.interval(\n            1 - arg_3,\n            df=arg_6 - 1,\n            loc=arg_18,\n            arg_17=arg_17,\n        )\n        (\n            arg_5[arg_14][..., 0], arg_5[arg_14][..., 1]\n        ) = ([my_array.T for my_array in arg_16] if arg_11 else arg_16)\n\n    if arg_4:\n        _transform('percolation_probability')\n\n    _transform('max_cluster_size', 'percolation_strength', arg_10=True)\n    _transform('moments', arg_10=True, arg_11=True)\n\n    return arg_5", "path": "percolate/hpc.py", "identifier": "finalize_canonical_averages", "docstring": "Finalize canonical averages", "docstring_tokens": ["Finalize", "canonical", "averages"], "nwo": "andsor/pypercolate", "score": 0.27946077266739355, "idx": 254939}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L474-L522", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "private function to perform a single D-stat test", "language": "python", "parameters": "(inarr, taxdict, mindict=1, nboots=1000, name=0)", "return_statement": "return res.T, boots", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "1000", ",", "arg_4", "=", "0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_5", ",", "arg_6", "=", "_loci_to_arr", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "if", "arg_5", ".", "shape", "[", "1", "]", "==", "4", ":", "arg_7", ",", "arg_8", "=", "_get_signif_4", "(", "arg_5", ",", "arg_3", ")", "arg_7", "=", "pd", ".", "DataFrame", "(", "arg_7", ",", "columns", "=", "[", "arg_4", "]", ",", "index", "=", "[", "\"Dstat\"", ",", "\"bootmean\"", ",", "\"bootstd\"", ",", "\"Z\"", ",", "\"ABBA\"", ",", "\"BABA\"", ",", "\"nloci\"", "]", ")", "else", ":", "arg_7", ",", "arg_8", "=", "_get_signif_5", "(", "arg_5", ",", "arg_3", ")", "arg_7", "=", "pd", ".", "DataFrame", "(", "arg_7", ",", "index", "=", "[", "\"p3\"", ",", "\"p4\"", ",", "\"shared\"", "]", ",", "columns", "=", "[", "\"Dstat\"", ",", "\"bootmean\"", ",", "\"bootstd\"", ",", "\"Z\"", ",", "\"ABxxA\"", ",", "\"BAxxA\"", ",", "\"nloci\"", "]", ")", "return", "arg_7", ".", "T", ",", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=1000, arg_4=0):\n    \"\"\" private function to perform a single D-stat test\"\"\"\n\n    #if isinstance(inarr, str):\n    #    with open(inarr, 'r') as infile:\n    #        inarr = infile.read().strip().split(\"|\\n\")\n\n    # ## get data as an array from loci file\n    # ## if loci-list then parse arr from loci\n    if isinstance(arg_0, list):\n        arg_5, arg_6 = _loci_to_arr(arg_0, arg_1, arg_2)\n    \n    # ## if it's an array already then go ahead\n    # elif isinstance(inarr, np.ndarray):\n    #     arr = inarr\n    # ## if it's a simulation object get freqs from array\n    # elif isinstance(inarr, Sim):\n    #     arr = _msp_to_arr(inarr, taxdict)\n\n    #elif isinstance(inarr, types.GeneratorType):\n    #    arr = _msp_to_arr(inarr, taxdict)\n    #elif isinstance(inarr, list):\n    #    arr = _msp_to_arr(inarr, taxdict)\n    ## get data from Sim object, do not digest the ms generator\n    #else:\n    #    raise Exception(\"Must enter either a 'locifile' or 'arr'\")\n\n    ## run tests\n    #if len(taxdict) == 4:\n    if arg_5.shape[1] == 4:\n\n        ## get results\n        arg_7, arg_8 = _get_signif_4(arg_5, arg_3)\n    \n        ## make res into a nice DataFrame\n        arg_7 = pd.DataFrame(arg_7, \n            columns=[arg_4],\n            index=[\"Dstat\", \"bootmean\", \"bootstd\", \"Z\", \"ABBA\", \"BABA\", \"nloci\"])\n\n    else:\n        ## get results\n        arg_7, arg_8 = _get_signif_5(arg_5, arg_3)\n         ## make int a DataFrame\n        arg_7 = pd.DataFrame(arg_7,\n            index=[\"p3\", \"p4\", \"shared\"], \n            columns=[\"Dstat\", \"bootmean\", \"bootstd\", \"Z\", \"ABxxA\", \"BAxxA\", \"nloci\"]\n            )\n\n    return arg_7.T, arg_8", "path": "ipyrad/analysis/baba.py", "identifier": "dstat", "docstring": "private function to perform a single D-stat test", "docstring_tokens": ["private", "function", "to", "perform", "a", "single", "D", "-", "stat", "test"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 254940}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L126-L149", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Get the hash of the given file", "language": "python", "parameters": "(self, algo)", "return_statement": "return hash_data.hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "hashlib", ",", "arg_1", ")", "(", ")", "with", "open", "(", "arg_0", ".", "path", ",", "\"rb\"", ")", "as", "file", ":", "arg_3", "=", "file", ".", "read", "(", ")", "arg_2", ".", "update", "(", "arg_3", ")", "return", "arg_2", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get the hash of the given file\n\n        :param algo: The algorithm to use.\n        :type algo: str\n\n        :return: The hexdigest of the data.\n        :rtype: str\n        \"\"\"\n\n        # We het the algorithm function.\n        arg_2 = getattr(hashlib, arg_1)()\n\n        with open(arg_0.path, \"rb\") as file:\n            # We open an read the parsed path.\n\n            # We read the content.\n            arg_3 = file.read()\n\n            # We parse the content to the hash algorithm.\n            arg_2.update(arg_3)\n\n        # And we extract and return the hash.\n        return arg_2.hexdigest()", "path": "PyFunceble/helpers.py", "identifier": "Hash._hash_file", "docstring": "Get the hash of the given file\n\n        :param algo: The algorithm to use.\n        :type algo: str\n\n        :return: The hexdigest of the data.\n        :rtype: str", "docstring_tokens": ["Get", "the", "hash", "of", "the", "given", "file"], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 254941}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/experimental/fun_mcmc/fun_mcmc_lib.py#L122-L137", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Calls a transition operator with args, unpacking args if its a sequence.", "language": "python", "parameters": "(fn: TransitionOperator, args: Union[Tuple[Any], Any])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "[", "arg_5", "]", ",", "arg_5", "]", ")", "->", "arg_5", ":", "if", "isinstance", "(", "arg_2", ",", "(", "list", ",", "tuple", ")", ")", "and", "not", "mcmc_util", ".", "is_namedtuple_like", "(", "arg_2", ")", ":", "arg_2", "=", "arg_2", "return", "arg_0", "(", "*", "arg_2", ")", "else", ":", "return", "arg_0", "(", "arg_2", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4[arg_5], arg_5]) -> arg_5:\n  \"\"\"Calls a transition operator with args, unpacking args if its a sequence.\n\n  Args:\n    fn: A `TransitionOperator`.\n    args: Arguments to `fn`\n\n  Returns:\n    ret: Return value of `fn`.\n  \"\"\"\n\n  if isinstance(arg_2, (list, tuple)) and not mcmc_util.is_namedtuple_like(arg_2):\n    arg_2 = arg_2  # type: Tuple[Any]\n    return arg_0(*arg_2)\n  else:\n    return arg_0(arg_2)", "path": "experimental/fun_mcmc/fun_mcmc_lib.py", "identifier": "call_fn", "docstring": "Calls a transition operator with args, unpacking args if its a sequence.\n\n  Args:\n    fn: A `TransitionOperator`.\n    args: Arguments to `fn`\n\n  Returns:\n    ret: Return value of `fn`.", "docstring_tokens": ["Calls", "a", "transition", "operator", "with", "args", "unpacking", "args", "if", "its", "a", "sequence", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 254942}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/transport.py#L254-L282", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Make an HTTP request with an HTTP object and arguments.", "language": "python", "parameters": "(http, uri, method='GET', body=None, headers=None,\n            redirections=httplib2.DEFAULT_MAX_REDIRECTS,\n            connection_type=None)", "return_statement": "return http_callable(uri, method=method, body=body, headers=headers,\n                         redirections=redirections,\n                         connection_type=connection_type)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'GET'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "arg_6", ".", "DEFAULT_MAX_REDIRECTS", ",", "arg_8", "=", "None", ")", ":", "arg_9", "=", "getattr", "(", "arg_0", ",", "'Func'", ",", "arg_0", ")", "return", "arg_9", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_8", "=", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2='GET', arg_3=None, arg_4=None,\n            arg_5=arg_6.DEFAULT_MAX_REDIRECTS,\n            arg_8=None):\n    \"\"\"Make an HTTP Func with an HTTP object and arguments.\n\n    Args:\n        http: httplib2.Http, an http object to be used to make Funcs.\n        uri: string, The URI to be Funced.\n        method: string, The HTTP method to use for the Func. Defaults\n                to 'GET'.\n        body: string, The payload / body in HTTP Func. By default\n              there is no payload.\n        headers: dict, Key-value pairs of Func headers. By default\n                 there are no headers.\n        redirections: int, The number of allowed 203 redirects for\n                      the Func. Defaults to 5.\n        connection_type: httplib.HTTPConnection, a subclass to be used for\n                         establishing connection. If not set, the type\n                         will be determined from the ``uri``.\n\n    Returns:\n        tuple, a pair of a httplib2.Response with the status code and other\n        headers and the bytes of the content returned.\n    \"\"\"\n    # NOTE: Allowing http or http.Func is temporary (See Issue 601).\n    arg_9 = getattr(arg_0, 'Func', arg_0)\n    return arg_9(arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,\n                         arg_5=arg_5,\n                         arg_8=arg_8)", "path": "oauth2client/transport.py", "identifier": "request", "docstring": "Make an HTTP request with an HTTP object and arguments.\n\n    Args:\n        http: httplib2.Http, an http object to be used to make requests.\n        uri: string, The URI to be requested.\n        method: string, The HTTP method to use for the request. Defaults\n                to 'GET'.\n        body: string, The payload / body in HTTP request. By default\n              there is no payload.\n        headers: dict, Key-value pairs of request headers. By default\n                 there are no headers.\n        redirections: int, The number of allowed 203 redirects for\n                      the request. Defaults to 5.\n        connection_type: httplib.HTTPConnection, a subclass to be used for\n                         establishing connection. If not set, the type\n                         will be determined from the ``uri``.\n\n    Returns:\n        tuple, a pair of a httplib2.Response with the status code and other\n        headers and the bytes of the content returned.", "docstring_tokens": ["Make", "an", "HTTP", "request", "with", "an", "HTTP", "object", "and", "arguments", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 254943}
{"url": "https://github.com/collab-project/django-admin-footer/blob/55d5b7a4b168fa56f39664091af06820236057c6/admin_footer/__init__.py#L23-L34", "sha": "55d5b7a4b168fa56f39664091af06820236057c6", "docstring_summary": "Return full version nr, inc. rc, beta etc tags.", "language": "python", "parameters": "(version=None)", "return_statement": "return short_version(v)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "arg_0", "or", "__version__", "if", "len", "(", "arg_1", ")", "==", "4", ":", "return", "'{0}{1}'", ".", "format", "(", "short_version", "(", "arg_1", ")", ",", "arg_1", "[", "3", "]", ")", "return", "short_version", "(", "arg_1", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Return full version nr, inc. rc, beta etc tags.\n\n    For example: `2.0.0a1`\n    :rtype: str\n    \"\"\"\n    arg_1 = arg_0 or __version__\n    if len(arg_1) == 4:\n        return '{0}{1}'.format(short_version(arg_1), arg_1[3])\n\n    return short_version(arg_1)", "path": "admin_footer/__init__.py", "identifier": "get_version", "docstring": "Return full version nr, inc. rc, beta etc tags.\n\n    For example: `2.0.0a1`\n    :rtype: str", "docstring_tokens": ["Return", "full", "version", "nr", "inc", ".", "rc", "beta", "etc", "tags", "."], "nwo": "collab-project/django-admin-footer", "score": 0.26806449491785717, "idx": 254944}
{"url": "https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/irc.py#L176-L185", "sha": "f9d2bd6369aafe6cb0916c9406270ca8ecea2080", "docstring_summary": "\\\n        Generates a new nickname based on original nickname followed by a\n        random number", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "nick", "arg_0", ".", "nick", "=", "'%s_%s'", "%", "(", "arg_0", ".", "base_nick", ",", "random", ".", "randint", "(", "1", ",", "1000", ")", ")", "arg_0", ".", "logger", ".", "warn", "(", "'Nick %s already taken, trying %s'", "%", "(", "arg_1", ",", "arg_0", ".", "nick", ")", ")", "arg_0", ".", "register_nick", "(", ")", "arg_0", ".", "handle_nick_change", "(", "arg_1", ",", "arg_0", ".", "nick", ")"], "function": "def Func(arg_0):\n        \"\"\"\\\n        Generates a new nickname based on original nickname followed by a\n        random number\n        \"\"\"\n        arg_1 = arg_0.nick\n        arg_0.nick = '%s_%s' % (arg_0.base_nick, random.randint(1, 1000))\n        arg_0.logger.warn('Nick %s already taken, trying %s' % (arg_1, arg_0.nick))\n        arg_0.register_nick()\n        arg_0.handle_nick_change(arg_1, arg_0.nick)", "path": "irc.py", "identifier": "IRCConnection.new_nick", "docstring": "\\\n        Generates a new nickname based on original nickname followed by a\n        random number", "docstring_tokens": ["\\", "Generates", "a", "new", "nickname", "based", "on", "original", "nickname", "followed", "by", "a", "random", "number"], "nwo": "coleifer/irc", "score": 0.28749967694495965, "idx": 254945}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L696-L702", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return a list of parser function objects.", "language": "python", "parameters": "(self)", "return_statement": "return [\n            ParserFunction(_lststr, _type_to_spans, span, 'ParserFunction')\n            for span in self._subspans('ParserFunction')]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "List", "[", "'ParserFunction'", "]", ":", "arg_1", "=", "arg_0", ".", "_lststr", "arg_2", "=", "arg_0", ".", "_type_to_spans", "return", "[", "ParserFunction", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "'ParserFunction'", ")", "for", "arg_3", "in", "arg_0", ".", "_subspans", "(", "'ParserFunction'", ")", "]"], "function": "def Func(arg_0) -> List['ParserFunction']:\n        \"\"\"Return a list of parser function objects.\"\"\"\n        arg_1 = arg_0._lststr\n        arg_2 = arg_0._type_to_spans\n        return [\n            ParserFunction(arg_1, arg_2, arg_3, 'ParserFunction')\n            for arg_3 in arg_0._subspans('ParserFunction')]", "path": "wikitextparser/_wikitext.py", "identifier": "WikiText.parser_functions", "docstring": "Return a list of parser function objects.", "docstring_tokens": ["Return", "a", "list", "of", "parser", "function", "objects", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 254946}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/tools/async_worker.py#L115-L125", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Initializes eventlet and starts wait for workers to exit.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "eventlet", ".", "GreenPool", "(", ")", "arg_2", "=", "arg_0", ".", "serve_rpc", "(", ")", "arg_1", ".", "spawn", "(", "arg_2", ".", "wait", ")", "arg_1", ".", "waitall", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Initializes eventlet and starts wait for workers to exit.\n\n        Spawns the workers returned from serve_rpc\n        \"\"\"\n        arg_1 = eventlet.GreenPool()\n\n        arg_2 = arg_0.serve_rpc()\n        arg_1.spawn(arg_2.wait)\n\n        arg_1.waitall()", "path": "quark/tools/async_worker.py", "identifier": "QuarkAsyncServer.start_api_and_rpc_workers", "docstring": "Initializes eventlet and starts wait for workers to exit.\n\n        Spawns the workers returned from serve_rpc", "docstring_tokens": ["Initializes", "eventlet", "and", "starts", "wait", "for", "workers", "to", "exit", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 254947}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L23-L36", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return list of subaccounts within the account with the passed\n        canvas id.", "language": "python", "parameters": "(self, account_id, params={})", "return_statement": "return accounts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "arg_3", "=", "ACCOUNTS_API", ".", "format", "(", "arg_1", ")", "+", "\"/sub_accounts\"", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ".", "_get_paged_resource", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", ":", "arg_4", ".", "append", "(", "CanvasAccount", "(", "data", "=", "arg_5", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return list of subaccounts within the account with the passed\n        canvas id.\n\n        https://canvas.instructure.com/doc/api/accounts.html#method.accounts.sub_accounts\n        \"\"\"\n        arg_3 = ACCOUNTS_API.format(arg_1) + \"/sub_accounts\"\n\n        arg_4 = []\n        for arg_5 in arg_0._get_paged_resource(arg_3, arg_2=arg_2):\n            arg_4.append(CanvasAccount(data=arg_5))\n\n        return arg_4", "path": "uw_canvas/accounts.py", "identifier": "Accounts.get_sub_accounts", "docstring": "Return list of subaccounts within the account with the passed\n        canvas id.\n\n        https://canvas.instructure.com/doc/api/accounts.html#method.accounts.sub_accounts", "docstring_tokens": ["Return", "list", "of", "subaccounts", "within", "the", "account", "with", "the", "passed", "canvas", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 254948}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L787-L794", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Initializes a map representation of this tag's attributes,\n        if not already initialized.", "language": "python", "parameters": "(self)", "return_statement": "return self.attrMap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "getattr", "(", "arg_0", ",", "'attrMap'", ")", ":", "arg_0", ".", "attrMap", "=", "{", "}", "for", "(", "arg_2", ",", "arg_3", ")", "in", "arg_0", ".", "attrs", ":", "arg_0", ".", "attrMap", "[", "arg_2", "]", "=", "arg_3", "return", "arg_0", ".", "attrMap"], "function": "def Func(arg_0):\n        \"\"\"Initializes a map representation of this tag's attributes,\n        if not already initialized.\"\"\"\n        if not getattr(arg_0, 'attrMap'):\n            arg_0.attrMap = {}\n            for (arg_2, arg_3) in arg_0.attrs:\n                arg_0.attrMap[arg_2] = arg_3\n        return arg_0.attrMap", "path": "lib/web/BeautifulSoup.py", "identifier": "Tag._getAttrMap", "docstring": "Initializes a map representation of this tag's attributes,\n        if not already initialized.", "docstring_tokens": ["Initializes", "a", "map", "representation", "of", "this", "tag", "s", "attributes", "if", "not", "already", "initialized", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 254949}
{"url": "https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/util/platform_.py#L32-L48", "sha": "71c798378e365286b7cc03c06e4d7d24c7de8fc4", "docstring_summary": "Prior versions of keyring would search for the config\n    in XDG_DATA_HOME, but should probably have been\n    searching for config in XDG_CONFIG_HOME. If the\n    config exists in the former but not in the latter,\n    raise a RuntimeError to force the change.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "(", ")", "[", "'Func'", "]", "=", "lambda", ":", "None", "arg_1", "=", "os", ".", "path", ".", "join", "(", "_config_root_Linux", "(", ")", ",", "'keyringrc.cfg'", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "_data_root_Linux", "(", ")", ",", "'keyringrc.cfg'", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", "and", "not", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "arg_3", "=", "(", "\"Keyring config exists only in the old location \"", "\"{config_file_old} and should be moved to {config_file_new} \"", "\"to work with this version of keyring.\"", ")", "raise", "RuntimeError", "(", "arg_3", ".", "format", "(", "**", "locals", "(", ")", ")", ")"], "function": "def Func():\n    \"\"\"\n    Prior versions of keyring would search for the config\n    in XDG_DATA_HOME, but should probably have been\n    searching for config in XDG_CONFIG_HOME. If the\n    config exists in the former but not in the latter,\n    raise a RuntimeError to force the change.\n    \"\"\"\n    # disable the check - once is enough and avoids infinite loop\n    arg_0()['Func'] = lambda: None\n    arg_1 = os.path.join(_config_root_Linux(), 'keyringrc.cfg')\n    arg_2 = os.path.join(_data_root_Linux(), 'keyringrc.cfg')\n    if os.path.isfile(arg_2) and not os.path.isfile(arg_1):\n        arg_3 = (\"Keyring config exists only in the old location \"\n               \"{config_file_old} and should be moved to {config_file_new} \"\n               \"to work with this version of keyring.\")\n        raise RuntimeError(arg_3.format(**locals()))", "path": "keyring/util/platform_.py", "identifier": "_check_old_config_root", "docstring": "Prior versions of keyring would search for the config\n    in XDG_DATA_HOME, but should probably have been\n    searching for config in XDG_CONFIG_HOME. If the\n    config exists in the former but not in the latter,\n    raise a RuntimeError to force the change.", "docstring_tokens": ["Prior", "versions", "of", "keyring", "would", "search", "for", "the", "config", "in", "XDG_DATA_HOME", "but", "should", "probably", "have", "been", "searching", "for", "config", "in", "XDG_CONFIG_HOME", ".", "If", "the", "config", "exists", "in", "the", "former", "but", "not", "in", "the", "latter", "raise", "a", "RuntimeError", "to", "force", "the", "change", "."], "nwo": "jaraco/keyring", "score": 0.7254776697026839, "idx": 254950}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L253-L262", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Updates the tip based on user cursor movement.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_text_edit", ".", "textCursor", "(", ")", "if", "arg_1", ".", "position", "(", ")", "<=", "arg_0", ".", "_start_position", ":", "arg_0", ".", "hide", "(", ")", "else", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "_find_parenthesis", "(", "arg_0", ".", "_start_position", "+", "1", ")", "if", "arg_2", "!=", "-", "1", ":", "arg_0", ".", "hide", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Updates the tip based on user cursor movement.\n        \"\"\"\n        arg_1 = arg_0._text_edit.textCursor()\n        if arg_1.position() <= arg_0._start_position:\n            arg_0.hide()\n        else:\n            arg_2, arg_3 = arg_0._find_parenthesis(arg_0._start_position + 1)\n            if arg_2 != -1:\n                arg_0.hide()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py", "identifier": "CallTipWidget._cursor_position_changed", "docstring": "Updates the tip based on user cursor movement.", "docstring_tokens": ["Updates", "the", "tip", "based", "on", "user", "cursor", "movement", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254951}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/rooms.py#L224-L238", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Delete a room.", "language": "python", "parameters": "(self, roomId)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "arg_0", ".", "_session", ".", "Func", "(", "API_ENDPOINT", "+", "'/'", "+", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Delete a room.\n\n        Args:\n            roomId(basestring): The ID of the room to be Funcd.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n\n        # API request\n        arg_0._session.Func(API_ENDPOINT + '/' + arg_1)", "path": "webexteamssdk/api/rooms.py", "identifier": "RoomsAPI.delete", "docstring": "Delete a room.\n\n        Args:\n            roomId(basestring): The ID of the room to be deleted.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Delete", "a", "room", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 254952}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L469-L499", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Half-duplex SPI write.  The specified array of bytes will be clocked\n        out the MOSI line.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "len", "(", "arg_1", ")", ">", "65536", ")", ":", "print", "(", "'the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!'", ")", "print", "(", "'use for loops for larger reads'", ")", "exit", "(", "1", ")", "arg_2", "=", "0x10", "|", "(", "arg_0", ".", "lsbfirst", "<<", "3", ")", "|", "arg_0", ".", "Func_clock_ve", "logger", ".", "debug", "(", "'SPI Func with command {0:2X}.'", ".", "format", "(", "arg_2", ")", ")", "arg_3", "=", "arg_1", "[", ":", "len", "(", "arg_1", ")", "/", "2", "]", "arg_4", "=", "arg_1", "[", "len", "(", "arg_1", ")", "/", "2", ":", "]", "arg_5", "=", "(", "len", "(", "arg_3", ")", "-", "1", ")", "&", "0xFF", "arg_6", "=", "(", "(", "len", "(", "arg_3", ")", "-", "1", ")", ">>", "8", ")", "&", "0xFF", "arg_7", "=", "(", "len", "(", "arg_4", ")", "-", "1", ")", "&", "0xFF", "arg_8", "=", "(", "(", "len", "(", "arg_4", ")", "-", "1", ")", ">>", "8", ")", "&", "0xFF", "arg_0", ".", "_assert_cs", "(", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_0", ".", "_ft232h", ".", "_Func", "(", "str", "(", "bytearray", "(", "(", "arg_2", ",", "arg_5", ",", "arg_6", ")", ")", ")", ")", "arg_0", ".", "_ft232h", ".", "_Func", "(", "str", "(", "bytearray", "(", "arg_3", ")", ")", ")", "if", "len", "(", "arg_4", ")", ">", "0", ":", "arg_0", ".", "_ft232h", ".", "_Func", "(", "str", "(", "bytearray", "(", "(", "arg_2", ",", "arg_7", ",", "arg_8", ")", ")", ")", ")", "arg_0", ".", "_ft232h", ".", "_Func", "(", "str", "(", "bytearray", "(", "arg_4", ")", ")", ")", "arg_0", ".", "_deassert_cs", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Half-duplex SPI Func.  The specified array of bytes will be clocked\n        out the MOSI line.\n        \"\"\"\n        #check for hardware limit of FT232H and similar MPSSE chips\n        if (len(arg_1) > 65536):\n            print('the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!')\n            print('use for loops for larger reads')\n            exit(1)\n        # Build command to Func SPI data.\n        arg_2 = 0x10 | (arg_0.lsbfirst << 3) | arg_0.Func_clock_ve\n        logger.debug('SPI Func with command {0:2X}.'.format(arg_2))\n        # Compute length low and high bytes.\n        # NOTE: Must actually send length minus one because the MPSSE engine\n        # considers 0 a length of 1 and FFFF a length of 65536\n\t# splitting into two lists for two commands to prevent buffer errors\n\targ_3 = arg_1[:len(arg_1)/2]\n\targ_4 = arg_1[len(arg_1)/2:]\n        arg_5  = (len(arg_3) - 1) & 0xFF\n        arg_6 = ((len(arg_3) - 1) >> 8) & 0xFF\n\targ_7  = (len(arg_4) - 1) & 0xFF\n        arg_8 = ((len(arg_4) - 1) >> 8) & 0xFF\n        arg_0._assert_cs()\n        # Send command and length, then data, split into two commands, handle for length 1\n\tif len(arg_3) > 0:\n            arg_0._ft232h._Func(str(bytearray((arg_2, arg_5, arg_6))))\n            arg_0._ft232h._Func(str(bytearray(arg_3)))\n        if len(arg_4) > 0:\n\t    arg_0._ft232h._Func(str(bytearray((arg_2, arg_7, arg_8))))\n\t    arg_0._ft232h._Func(str(bytearray(arg_4)))\n        arg_0._deassert_cs()", "path": "Adafruit_GPIO/FT232H.py", "identifier": "SPI.write", "docstring": "Half-duplex SPI write.  The specified array of bytes will be clocked\n        out the MOSI line.", "docstring_tokens": ["Half", "-", "duplex", "SPI", "write", ".", "The", "specified", "array", "of", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 254953}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/system.py#L143-L162", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Hook to override default showwarning.", "language": "python", "parameters": "(\n    message, category, filename=\"\", lineno=-1, file=None, line=None\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"\"", ",", "arg_3", "=", "-", "1", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "sys", ".", "stderr", "if", "arg_4", "is", "None", ":", "return", "arg_6", "=", "\"%s: %s\\n\"", "%", "(", "arg_1", ".", "__name__", ",", "arg_0", ")", "try", ":", "arg_4", ".", "write", "(", "arg_6", ")", "except", "OSError", ":", "pass"], "function": "def Func(\n    arg_0, arg_1, arg_2=\"\", arg_3=-1, arg_4=None, arg_5=None\n):\n    \"\"\"Hook to override default showwarning.\n\n    https://stackoverflow.com/questions/2187269/python-print-only-the-message-on-warnings\n    \"\"\"\n\n    if arg_4 is None:\n        arg_4 = sys.stderr\n        if arg_4 is None:\n            # sys.stderr is None when run with pythonw.exe:\n            # warnings get lost\n            return\n    arg_6 = \"%s: %s\\n\" % (arg_1.__name__, arg_0)\n    try:\n        arg_4.write(arg_6)\n    except OSError:\n        # the file (probably stderr) is invalid - this warning gets lost.\n        pass", "path": "modelx/core/system.py", "identifier": "custom_showwarning", "docstring": "Hook to override default showwarning.\n\n    https://stackoverflow.com/questions/2187269/python-print-only-the-message-on-warnings", "docstring_tokens": ["Hook", "to", "override", "default", "showwarning", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 254954}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L322-L360", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Create a hook", "language": "python", "parameters": "(self, name, regexes, tag_ids, logs=None)", "return_statement": "return self._post(\n            request=ApiActions.CREATE.value,\n            uri=ApiUri.HOOKS.value,\n            params=data\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "{", "'name'", ":", "arg_1", ",", "'triggers'", ":", "arg_2", ",", "'sources'", ":", "arg_4", "or", "[", "]", ",", "'groups'", ":", "[", "]", ",", "'actions'", ":", "arg_3", "}", "return", "arg_0", ".", "_post", "(", "request", "=", "ApiActions", ".", "CREATE", ".", "value", ",", "uri", "=", "ApiUri", ".", "HOOKS", ".", "value", ",", "params", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"\n        Create a hook\n\n        :param name: The hook's name (should be the same as the tag)\n        :type name: str\n\n        :param regexes: The list of regular expressions that Logentries expects.\n            Ex: `['user_agent = /curl\\/[\\d.]*/']` Would match where the\n            user-agent is curl.\n        :type regexes: list of str\n\n        :param tag_id: The ids of the tags to associate the hook with.\n            (The 'id' key of the Func tag response)\n        :type tag_id: list of str\n\n        :param logs: The logs to add the hook to. Comes from the 'key'\n            key in the log dict.\n        :type logs: list of str\n\n        :returns: The response of your post\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException<logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries\n        \"\"\"\n        arg_5 = {\n            'name': arg_1,\n            'triggers': arg_2,\n            'sources': arg_4 or [],\n            'groups': [],\n            'actions': arg_3\n        }\n        return arg_0._post(\n            request=ApiActions.CREATE.value,\n            uri=ApiUri.HOOKS.value,\n            params=arg_5\n        )", "path": "logentries_api/resources.py", "identifier": "Hooks.create", "docstring": "Create a hook\n\n        :param name: The hook's name (should be the same as the tag)\n        :type name: str\n\n        :param regexes: The list of regular expressions that Logentries expects.\n            Ex: `['user_agent = /curl\\/[\\d.]*/']` Would match where the\n            user-agent is curl.\n        :type regexes: list of str\n\n        :param tag_id: The ids of the tags to associate the hook with.\n            (The 'id' key of the create tag response)\n        :type tag_id: list of str\n\n        :param logs: The logs to add the hook to. Comes from the 'key'\n            key in the log dict.\n        :type logs: list of str\n\n        :returns: The response of your post\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException<logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries", "docstring_tokens": ["Create", "a", "hook"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 254955}
{"url": "https://github.com/cassinyio/SwarmSpawner/blob/3c39134ef7e02e2afc5d18da7d18d2c69421ed08/cassinyspawner/swarmspawner.py#L112-L119", "sha": "3c39134ef7e02e2afc5d18da7d18d2c69421ed08", "docstring_summary": "A tuple consisting of the TLS client certificate and key if they\n        have been provided, otherwise None.", "language": "python", "parameters": "(self)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "tls_cert", "and", "arg_0", ".", "tls_key", ":", "return", "(", "arg_0", ".", "tls_cert", ",", "arg_0", ".", "tls_key", ")", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"A tuple consisting of the TLS client certificate and key if they\n        have been provided, otherwise None.\n\n        \"\"\"\n        if arg_0.tls_cert and arg_0.tls_key:\n            return (arg_0.tls_cert, arg_0.tls_key)\n        return None", "path": "cassinyspawner/swarmspawner.py", "identifier": "SwarmSpawner.tls_client", "docstring": "A tuple consisting of the TLS client certificate and key if they\n        have been provided, otherwise None.", "docstring_tokens": ["A", "tuple", "consisting", "of", "the", "TLS", "client", "certificate", "and", "key", "if", "they", "have", "been", "provided", "otherwise", "None", "."], "nwo": "cassinyio/SwarmSpawner", "score": 0.2873663608194641, "idx": 254956}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/contours.py#L58-L69", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return a list of values between min and max within an interval.", "language": "python", "parameters": "(min_val, max_val, base=0, interval=100)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "100", ")", ":", "arg_4", "=", "arg_2", "arg_5", "=", "[", "]", "if", "arg_0", "<", "arg_2", ":", "while", "arg_4", ">=", "arg_0", ":", "arg_4", "-=", "arg_3", "while", "arg_4", "<=", "arg_1", ":", "if", "arg_4", ">=", "arg_0", ":", "arg_5", ".", "append", "(", "arg_4", ")", "arg_4", "+=", "arg_3", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=100):\n    \"\"\"Return a list of values between min and max within an interval.\"\"\"\n    arg_4 = arg_2\n    arg_5 = []\n    if arg_0 < arg_2:\n        while arg_4 >= arg_0:\n            arg_4 -= arg_3\n    while arg_4 <= arg_1:\n        if arg_4 >= arg_0:\n            arg_5.append(arg_4)\n        arg_4 += arg_3\n    return arg_5", "path": "mapchete/commons/contours.py", "identifier": "_get_contour_values", "docstring": "Return a list of values between min and max within an interval.", "docstring_tokens": ["Return", "a", "list", "of", "values", "between", "min", "and", "max", "within", "an", "interval", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 254957}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L368-L396", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Create a tuning job", "language": "python", "parameters": "(self, config, wait_for_completion=True,\n                          check_interval=30, max_ingestion_time=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "30", ",", "arg_4", "=", "None", ")", ":", "arg_0", ".", "check_tuning_config", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "get_conn", "(", ")", ".", "create_hyper_parameter_tuning_job", "(", "**", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "check_status", "(", "arg_1", "[", "'HyperParameterTuningJobName'", "]", ",", "'HyperParameterTuningJobStatus'", ",", "arg_0", ".", "describe_tuning_job", ",", "arg_3", ",", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True,\n                          arg_3=30, arg_4=None):\n        \"\"\"\n        Create a tuning job\n\n        :param config: the config for tuning\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to tuning job creation\n        \"\"\"\n\n        arg_0.check_tuning_config(arg_1)\n\n        arg_5 = arg_0.get_conn().create_hyper_parameter_tuning_job(**arg_1)\n        if arg_2:\n            arg_0.check_status(arg_1['HyperParameterTuningJobName'],\n                              'HyperParameterTuningJobStatus',\n                              arg_0.describe_tuning_job,\n                              arg_3, arg_4\n                              )\n        return arg_5", "path": "airflow/contrib/hooks/sagemaker_hook.py", "identifier": "SageMakerHook.create_tuning_job", "docstring": "Create a tuning job\n\n        :param config: the config for tuning\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to tuning job creation", "docstring_tokens": ["Create", "a", "tuning", "job"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 254958}
{"url": "https://github.com/jupyter-widgets/jupyterlab-sidecar/blob/8889d09f1a0933e2cbee06d4874f720b075b29e8/setupbase.py#L138-L193", "sha": "8889d09f1a0933e2cbee06d4874f720b075b29e8", "docstring_summary": "Create a command class with the given optional prerelease class.", "language": "python", "parameters": "(prerelease_cmd=None, package_data_spec=None,\n        data_files_spec=None)", "return_statement": "return cmdclass", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "arg_0", "]", "if", "arg_0", "else", "[", "]", "if", "arg_1", "or", "arg_2", ":", "arg_3", ".", "append", "(", "'handle_files'", ")", "arg_4", "=", "functools", ".", "partial", "(", "_wrap_command", ",", "arg_3", ")", "arg_5", "=", "_get_file_handler", "(", "arg_1", ",", "arg_2", ")", "if", "'bdist_egg'", "in", "sys", ".", "argv", ":", "arg_6", "=", "arg_4", "(", "bdist_egg", ",", "strict", "=", "True", ")", "else", ":", "arg_6", "=", "bdist_egg_disabled", "arg_7", "=", "dict", "(", "build_py", "=", "arg_4", "(", "build_py", ",", "strict", "=", "is_repo", ")", ",", "bdist_egg", "=", "arg_6", ",", "sdist", "=", "arg_4", "(", "sdist", ",", "strict", "=", "True", ")", ",", "arg_5", "=", "arg_5", ",", ")", "if", "bdist_wheel", ":", "arg_7", "[", "'bdist_wheel'", "]", "=", "arg_4", "(", "bdist_wheel", ",", "strict", "=", "True", ")", "arg_7", "[", "'develop'", "]", "=", "arg_4", "(", "develop", ",", "strict", "=", "True", ")", "return", "arg_7"], "function": "def Func(arg_0=None, arg_1=None,\n        arg_2=None):\n    \"\"\"Create a command class with the given optional prerelease class.\n\n    Parameters\n    ----------\n    prerelease_cmd: (name, Command) tuple, optional\n        The command to run before releasing.\n    package_data_spec: dict, optional\n        A dictionary whose keys are the dotted package names and\n        whose values are a list of glob patterns.\n    data_files_spec: list, optional\n        A list of (path, dname, pattern) tuples where the path is the\n        `data_files` install path, dname is the source directory, and the\n        pattern is a glob pattern.\n\n    Notes\n    -----\n    We use specs so that we can find the files *after* the build\n    command has run.\n\n    The package data glob patterns should be relative paths from the package\n    folder containing the __init__.py file, which is given as the package\n    name.\n    e.g. `dict(foo=['./bar/*', './baz/**'])`\n\n    The data files directories should be absolute paths or relative paths\n    from the root directory of the repository.  Data files are specified\n    differently from `package_data` because we need a separate path entry\n    for each nested folder in `data_files`, and this makes it easier to\n    parse.\n    e.g. `('share/foo/bar', 'pkgname/bizz, '*')`\n    \"\"\"\n    arg_3 = [arg_0] if arg_0 else []\n    if arg_1 or arg_2:\n        arg_3.append('handle_files')\n    arg_4 = functools.partial(_wrap_command, arg_3)\n    arg_5 = _get_file_handler(arg_1, arg_2)\n\n    if 'bdist_egg' in sys.argv:\n        arg_6 = arg_4(bdist_egg, strict=True)\n    else:\n        arg_6 = bdist_egg_disabled\n\n    arg_7 = dict(\n        build_py=arg_4(build_py, strict=is_repo),\n        bdist_egg=arg_6,\n        sdist=arg_4(sdist, strict=True),\n        arg_5=arg_5,\n    )\n\n    if bdist_wheel:\n        arg_7['bdist_wheel'] = arg_4(bdist_wheel, strict=True)\n\n    arg_7['develop'] = arg_4(develop, strict=True)\n    return arg_7", "path": "setupbase.py", "identifier": "create_cmdclass", "docstring": "Create a command class with the given optional prerelease class.\n\n    Parameters\n    ----------\n    prerelease_cmd: (name, Command) tuple, optional\n        The command to run before releasing.\n    package_data_spec: dict, optional\n        A dictionary whose keys are the dotted package names and\n        whose values are a list of glob patterns.\n    data_files_spec: list, optional\n        A list of (path, dname, pattern) tuples where the path is the\n        `data_files` install path, dname is the source directory, and the\n        pattern is a glob pattern.\n\n    Notes\n    -----\n    We use specs so that we can find the files *after* the build\n    command has run.\n\n    The package data glob patterns should be relative paths from the package\n    folder containing the __init__.py file, which is given as the package\n    name.\n    e.g. `dict(foo=['./bar/*', './baz/**'])`\n\n    The data files directories should be absolute paths or relative paths\n    from the root directory of the repository.  Data files are specified\n    differently from `package_data` because we need a separate path entry\n    for each nested folder in `data_files`, and this makes it easier to\n    parse.\n    e.g. `('share/foo/bar', 'pkgname/bizz, '*')`", "docstring_tokens": ["Create", "a", "command", "class", "with", "the", "given", "optional", "prerelease", "class", "."], "nwo": "jupyter-widgets/jupyterlab-sidecar", "score": 0.6376222650402201, "idx": 254959}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/stats.py#L248-L256", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Count occurrences of values AND return it as a string.", "language": "python", "parameters": "(gtfs, table, column)", "return_statement": "return ' '.join('%s:%s' % (t, c) for t, c in cur)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "conn", ".", "cursor", "(", ")", "arg_3", ".", "execute", "(", "'SELECT {column}, count(*) '", "'FROM {table} GROUP BY {column} '", "'ORDER BY {column}'", ".", "format", "(", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", ")", "return", "' '", ".", "join", "(", "'%s:%s'", "%", "(", "arg_4", ",", "arg_5", ")", "for", "arg_4", ",", "arg_5", "in", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Count occurrences of values AND return it as a string.\n\n    Example return value:   '1:5 2:15'\"\"\"\n    arg_3 = arg_0.conn.cursor()\n    arg_3.execute('SELECT {column}, count(*) '\n                'FROM {table} GROUP BY {column} '\n                'ORDER BY {column}'.format(arg_2=arg_2, arg_1=arg_1))\n    return ' '.join('%s:%s' % (arg_4, arg_5) for arg_4, arg_5 in arg_3)", "path": "gtfspy/stats.py", "identifier": "_distribution", "docstring": "Count occurrences of values AND return it as a string.\n\n    Example return value:   '1:5 2:15", "docstring_tokens": ["Count", "occurrences", "of", "values", "AND", "return", "it", "as", "a", "string", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 254960}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/log.py#L31-L82", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Comprehensively adds a new logging level to the `logging` module and the\n    currently configured logging class.", "language": "python", "parameters": "(levelName, levelNum, methodName=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", ".", "lower", "(", ")", "if", "hasattr", "(", "logging", ",", "arg_0", ")", ":", "raise", "AttributeError", "(", "'{} already defined in logging module'", ".", "format", "(", "arg_0", ")", ")", "if", "hasattr", "(", "logging", ",", "arg_2", ")", ":", "raise", "AttributeError", "(", "'{} already defined in logging module'", ".", "format", "(", "arg_2", ")", ")", "if", "hasattr", "(", "logging", ".", "getLoggerClass", "(", ")", ",", "arg_2", ")", ":", "raise", "AttributeError", "(", "'{} already defined in logger class'", ".", "format", "(", "arg_2", ")", ")", "def", "logForLevel", "(", "arg_3", ",", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "if", "arg_3", ".", "isEnabledFor", "(", "arg_1", ")", ":", "arg_3", ".", "_log", "(", "arg_1", ",", "arg_4", ",", "arg_5", ",", "**", "arg_6", ")", "def", "logToRoot", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "logging", ".", "log", "(", "arg_1", ",", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", "logging", ".", "addLevelName", "(", "arg_1", ",", "arg_0", ")", "setattr", "(", "logging", ",", "arg_0", ",", "arg_1", ")", "setattr", "(", "logging", ".", "getLoggerClass", "(", ")", ",", "arg_2", ",", "logForLevel", ")", "setattr", "(", "logging", ",", "arg_2", ",", "logToRoot", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Comprehensively adds a new logging level to the `logging` module and the\n    currently configured logging class.\n\n    `levelName` becomes an attribute of the `logging` module with the value\n    `levelNum`. `methodName` becomes a convenience method for both `logging`\n    itself and the class returned by `logging.getLoggerClass()` (usually just\n    `logging.Logger`). If `methodName` is not specified, `levelName.lower()` is\n    used.\n\n    To avoid accidental clobberings of existing attributes, this method will\n    raise an `AttributeError` if the level name is already an attribute of the\n    `logging` module or if the method name is already present\n\n    Example\n    -------\n    >>> addLoggingLevel('TRACE', logging.DEBUG - 5)\n    >>> logging.getLogger(__name__).setLevel(\"TRACE\")\n    >>> logging.getLogger(__name__).trace('that worked')\n    >>> logging.trace('so did this')\n    >>> logging.TRACE\n    5\n\n    \"\"\"\n    if not arg_2:\n        arg_2 = arg_0.lower()\n\n    if hasattr(logging, arg_0):\n        raise AttributeError(\n            '{} already defined in logging module'.format(arg_0))\n    if hasattr(logging, arg_2):\n        raise AttributeError(\n            '{} already defined in logging module'.format(arg_2))\n    if hasattr(logging.getLoggerClass(), arg_2):\n        raise AttributeError(\n            '{} already defined in logger class'.format(arg_2))\n\n    # This method was inspired by the answers to Stack Overflow post\n    # http://stackoverflow.com/q/2183233/2988730, especially\n    # http://stackoverflow.com/a/13638084/2988730\n    def logForLevel(arg_3, arg_4, *arg_5, **arg_6):\n        if arg_3.isEnabledFor(arg_1):\n            arg_3._log(arg_1, arg_4, arg_5, **arg_6)\n\n    def logToRoot(arg_4, *arg_5, **arg_6):\n        logging.log(arg_1, arg_4, *arg_5, **arg_6)\n\n    logging.addLevelName(arg_1, arg_0)\n    setattr(logging, arg_0, arg_1)\n    setattr(logging.getLoggerClass(), arg_2, logForLevel)\n    setattr(logging, arg_2, logToRoot)", "path": "bibliopixel/util/log.py", "identifier": "_addLoggingLevel", "docstring": "Comprehensively adds a new logging level to the `logging` module and the\n    currently configured logging class.\n\n    `levelName` becomes an attribute of the `logging` module with the value\n    `levelNum`. `methodName` becomes a convenience method for both `logging`\n    itself and the class returned by `logging.getLoggerClass()` (usually just\n    `logging.Logger`). If `methodName` is not specified, `levelName.lower()` is\n    used.\n\n    To avoid accidental clobberings of existing attributes, this method will\n    raise an `AttributeError` if the level name is already an attribute of the\n    `logging` module or if the method name is already present\n\n    Example\n    -------\n    >>> addLoggingLevel('TRACE', logging.DEBUG - 5)\n    >>> logging.getLogger(__name__).setLevel(\"TRACE\")\n    >>> logging.getLogger(__name__).trace('that worked')\n    >>> logging.trace('so did this')\n    >>> logging.TRACE\n    5", "docstring_tokens": ["Comprehensively", "adds", "a", "new", "logging", "level", "to", "the", "logging", "module", "and", "the", "currently", "configured", "logging", "class", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 254961}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_config.py#L150-L164", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Updates the profile's auth entry with values set by the user.\n    This will overwrite existing values.", "language": "python", "parameters": "(msg, cfg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "__class__", ".", "__name__", ".", "lower", "(", ")", "arg_3", "=", "arg_0", ".", "profile", "+", "\"_\"", "+", "arg_2", "if", "isinstance", "(", "arg_0", ".", "_auth", ",", "(", "MutableSequence", ",", "tuple", ")", ")", ":", "arg_1", ".", "pwd", "[", "arg_3", "]", "=", "\" :: \"", ".", "join", "(", "arg_0", ".", "_auth", ")", "else", ":", "arg_1", ".", "pwd", "[", "arg_3", "]", "=", "arg_0", ".", "_auth"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Updates the profile's auth entry with values set by the user.\n    This will overwrite existing values.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.\n    \"\"\"\n    arg_2 = arg_0.__class__.__name__.lower()\n    arg_3 = arg_0.profile + \"_\" + arg_2\n    if isinstance(arg_0._auth, (MutableSequence, tuple)):\n        arg_1.pwd[arg_3] = \" :: \".join(arg_0._auth)\n    else:\n        arg_1.pwd[arg_3] = arg_0._auth", "path": "messages/_config.py", "identifier": "update_config_pwd", "docstring": "Updates the profile's auth entry with values set by the user.\n    This will overwrite existing values.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.", "docstring_tokens": ["Updates", "the", "profile", "s", "auth", "entry", "with", "values", "set", "by", "the", "user", ".", "This", "will", "overwrite", "existing", "values", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 254962}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/compiler.py#L384-L394", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Convert an AST alternate op to python source code.", "language": "python", "parameters": "(self, opr, **kwargs)", "return_statement": "return lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "OP_ALTERNATE", "arg_4", "=", "arg_0", ".", "_hoist_operands", "(", "arg_1", ".", "operands", ",", "lambda", "t", ":", "isinstance", "(", "t", ",", "OptreeNode", ")", "and", "t", ".", "opnode", ".", "operator", "is", "arg_3", ")", "arg_5", "=", "[", "\"alternation([\"", "]", "for", "arg_6", "in", "arg_4", ":", "arg_5", ".", "extend", "(", "arg_0", ".", "_indent", "(", "arg_0", ".", "_ast_to_code", "(", "arg_6", ")", ")", ")", "arg_5", "[", "-", "1", "]", "+=", "\",\"", "arg_5", ".", "append", "(", "\"])\"", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Convert an AST alternate op to python source code.\"\"\"\n    arg_3 = OP_ALTERNATE\n    arg_4 = arg_0._hoist_operands(arg_1.operands, lambda t: isinstance(t, OptreeNode) and t.opnode.operator is arg_3)\n\n    arg_5 = [\"alternation([\"]\n    for arg_6 in arg_4:\n      arg_5.extend(arg_0._indent(arg_0._ast_to_code(arg_6)))\n      arg_5[-1] += \",\"\n    arg_5.append(\"])\")\n    return arg_5", "path": "pyebnf/compiler.py", "identifier": "Compiler._ast_op_alternate_to_code", "docstring": "Convert an AST alternate op to python source code.", "docstring_tokens": ["Convert", "an", "AST", "alternate", "op", "to", "python", "source", "code", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 254963}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1500-L1517", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Evaluate a PEP 426 environment marker using markerlib.\n        Return a boolean indicating the marker result in this environment.\n        Raise SyntaxError if marker is invalid.", "language": "python", "parameters": "(cls, text)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "pip", ".", "_vendor", "import", "_markerlib", "arg_2", "=", "_markerlib", ".", "default_environment", "(", ")", "for", "arg_3", "in", "arg_2", ".", "keys", "(", ")", ":", "arg_4", "=", "arg_3", ".", "replace", "(", "'.'", ",", "'_'", ")", "arg_2", "[", "arg_4", "]", "=", "arg_2", ".", "pop", "(", "arg_3", ")", "try", ":", "arg_5", "=", "_markerlib", ".", "interpret", "(", "arg_1", ",", "arg_2", ")", "except", "NameError", "as", "e", ":", "raise", "SyntaxError", "(", "e", ".", "args", "[", "0", "]", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Evaluate a PEP 426 environment marker using markerlib.\n        Return a boolean indicating the marker result in this environment.\n        Raise SyntaxError if marker is invalid.\n        \"\"\"\n        from pip._vendor import _markerlib\n        # markerlib implements Metadata 1.2 (PEP 345) environment markers.\n        # Translate the variables to Metadata 2.0 (PEP 426).\n        arg_2 = _markerlib.default_environment()\n        for arg_3 in arg_2.keys():\n            arg_4 = arg_3.replace('.', '_')\n            arg_2[arg_4] = arg_2.pop(arg_3)\n        try:\n            arg_5 = _markerlib.interpret(arg_1, arg_2)\n        except NameError as e:\n            raise SyntaxError(e.args[0])\n        return arg_5", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", "identifier": "MarkerEvaluation._markerlib_evaluate", "docstring": "Evaluate a PEP 426 environment marker using markerlib.\n        Return a boolean indicating the marker result in this environment.\n        Raise SyntaxError if marker is invalid.", "docstring_tokens": ["Evaluate", "a", "PEP", "426", "environment", "marker", "using", "markerlib", ".", "Return", "a", "boolean", "indicating", "the", "marker", "result", "in", "this", "environment", ".", "Raise", "SyntaxError", "if", "marker", "is", "invalid", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 254964}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/project/project.py#L168-L191", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Make a new project, using recursion and alias resolution.", "language": "python", "parameters": "(*descs, root_file=None)", "return_statement": "return project", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", ".", "ROOT_FILE", "=", "arg_1", "arg_4", "=", "merge", ".", "merge", "(", "merge", ".", "DEFAULT_PROJECT", ",", "*", "arg_0", ")", "arg_5", "=", "arg_4", ".", "get", "(", "'path'", ",", "''", ")", "if", "arg_1", ":", "arg_6", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "if", "arg_5", ":", "arg_5", "+=", "':'", "+", "arg_6", "else", ":", "arg_5", "=", "arg_6", "with", "arg_2", ".", "extender", "(", "arg_5", ")", ":", "arg_4", "=", "recurse", ".", "recurse", "(", "arg_4", ")", "Func", "=", "construct", ".", "construct", "(", "**", "arg_4", ")", "Func", ".", "desc", "=", "arg_4", "return", "Func"], "function": "def Func(*arg_0, arg_1=None):\n    \"\"\"\n    Make a new project, using recursion and alias resolution.\n\n    Use this function in preference to calling Project() directly.\n    \"\"\"\n    arg_2.ROOT_FILE = arg_1\n\n    arg_4 = merge.merge(merge.DEFAULT_PROJECT, *arg_0)\n    arg_5 = arg_4.get('path', '')\n\n    if arg_1:\n        arg_6 = os.path.dirname(arg_1)\n        if arg_5:\n            arg_5 += ':' + arg_6\n        else:\n            arg_5 = arg_6\n\n    with arg_2.extender(arg_5):\n        arg_4 = recurse.recurse(arg_4)\n\n    Func = construct.construct(**arg_4)\n    Func.desc = arg_4\n    return Func", "path": "bibliopixel/project/project.py", "identifier": "project", "docstring": "Make a new project, using recursion and alias resolution.\n\n    Use this function in preference to calling Project() directly.", "docstring_tokens": ["Make", "a", "new", "project", "using", "recursion", "and", "alias", "resolution", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 254965}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L343-L376", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return normalized Hamming similarity between Eudex hashes of two terms.", "language": "python", "parameters": "(src, tar, weights='exponential', max_length=8)", "return_statement": "return Eudex().sim(src, tar, weights, max_length)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'exponential'", ",", "arg_3", "=", "8", ")", ":", "return", "Eudex", "(", ")", ".", "sim", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2='exponential', arg_3=8):\n    \"\"\"Return normalized Hamming similarity between Eudex hashes of two terms.\n\n    This is a wrapper for :py:meth:`Eudex.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    weights : str, iterable, or generator function\n        The weights or weights generator function\n    max_length : int\n        The number of characters to encode as a eudex hash\n\n    Returns\n    -------\n    int\n        The normalized Eudex Hamming similarity\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.937254901961\n    >>> round(Func('Niall', 'Neil'), 12)\n    0.999019607843\n    >>> round(Func('Colin', 'Cuilen'), 12)\n    0.995098039216\n    >>> round(Func('ATCG', 'TAGC'), 12)\n    0.802450980392\n\n    \"\"\"\n    return Eudex().sim(arg_0, arg_1, arg_2, arg_3)", "path": "abydos/distance/_eudex.py", "identifier": "sim_eudex", "docstring": "Return normalized Hamming similarity between Eudex hashes of two terms.\n\n    This is a wrapper for :py:meth:`Eudex.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    weights : str, iterable, or generator function\n        The weights or weights generator function\n    max_length : int\n        The number of characters to encode as a eudex hash\n\n    Returns\n    -------\n    int\n        The normalized Eudex Hamming similarity\n\n    Examples\n    --------\n    >>> round(sim_eudex('cat', 'hat'), 12)\n    0.937254901961\n    >>> round(sim_eudex('Niall', 'Neil'), 12)\n    0.999019607843\n    >>> round(sim_eudex('Colin', 'Cuilen'), 12)\n    0.995098039216\n    >>> round(sim_eudex('ATCG', 'TAGC'), 12)\n    0.802450980392", "docstring_tokens": ["Return", "normalized", "Hamming", "similarity", "between", "Eudex", "hashes", "of", "two", "terms", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 254966}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L425-L429", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Returns a dictionary, where the keys are the feature names\n        and the values are the number of studies tagged with the feature.", "language": "python", "parameters": "(self, threshold=0.001)", "return_statement": "return dict(zip(self.get_feature_names(), list(counts)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.001", ")", ":", "arg_2", "=", "np", ".", "sum", "(", "arg_0", ".", "get_feature_data", "(", ")", ">=", "arg_1", ",", "0", ")", "return", "dict", "(", "zip", "(", "arg_0", ".", "get_feature_names", "(", ")", ",", "list", "(", "arg_2", ")", ")", ")"], "function": "def Func(arg_0, arg_1=0.001):\n        \"\"\" Returns a dictionary, where the keys are the feature names\n        and the values are the number of studies tagged with the feature. \"\"\"\n        arg_2 = np.sum(arg_0.get_feature_data() >= arg_1, 0)\n        return dict(zip(arg_0.get_feature_names(), list(arg_2)))", "path": "neurosynth/base/dataset.py", "identifier": "Dataset.get_feature_counts", "docstring": "Returns a dictionary, where the keys are the feature names\n        and the values are the number of studies tagged with the feature.", "docstring_tokens": ["Returns", "a", "dictionary", "where", "the", "keys", "are", "the", "feature", "names", "and", "the", "values", "are", "the", "number", "of", "studies", "tagged", "with", "the", "feature", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 254967}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L264-L307", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Calculate dendrite segment activity, using the current active cells.", "language": "python", "parameters": "(self, learn=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "(", "arg_2", ",", "arg_3", ")", "=", "arg_0", ".", "connections", ".", "computeActivity", "(", "arg_0", ".", "activeCells", ",", "arg_0", ".", "connectedPermanence", ")", "arg_4", "=", "(", "arg_0", ".", "connections", ".", "segmentForFlatIdx", "(", "i", ")", "for", "i", "in", "xrange", "(", "len", "(", "arg_2", ")", ")", "if", "arg_2", "[", "i", "]", ">=", "arg_0", ".", "activationThreshold", ")", "arg_5", "=", "(", "arg_0", ".", "connections", ".", "segmentForFlatIdx", "(", "i", ")", "for", "i", "in", "xrange", "(", "len", "(", "arg_3", ")", ")", "if", "arg_3", "[", "i", "]", ">=", "arg_0", ".", "minThreshold", ")", "arg_0", ".", "activeSegments", "=", "sorted", "(", "arg_4", ",", "key", "=", "arg_0", ".", "connections", ".", "segmentPositionSortKey", ")", "arg_0", ".", "matchingSegments", "=", "sorted", "(", "arg_5", ",", "key", "=", "arg_0", ".", "connections", ".", "segmentPositionSortKey", ")", "arg_0", ".", "numActiveConnectedSynapsesForSegment", "=", "arg_2", "arg_0", ".", "numActivePotentialSynapsesForSegment", "=", "arg_3", "if", "arg_1", ":", "for", "arg_8", "in", "arg_0", ".", "activeSegments", ":", "arg_0", ".", "lastUsedIterationForSegment", "[", "arg_8", ".", "flatIdx", "]", "=", "arg_0", ".", "iteration", "arg_0", ".", "iteration", "+=", "1"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"\n    Calculate dendrite segment activity, using the current active cells.\n\n    :param learn: (bool) If true, segment activations will be recorded. This \n           information is used during segment cleanup.\n\n    **Pseudocode:**\n    \n    ::\n\n      for each distal dendrite segment with activity >= activationThreshold\n        mark the segment as active\n      for each distal dendrite segment with unconnected activity >= minThreshold\n        mark the segment as matching\n    \"\"\"\n    (arg_2,\n     arg_3) = arg_0.connections.computeActivity(\n       arg_0.activeCells,\n       arg_0.connectedPermanence)\n\n    arg_4 = (\n      arg_0.connections.segmentForFlatIdx(i)\n      for i in xrange(len(arg_2))\n      if arg_2[i] >= arg_0.activationThreshold\n    )\n\n    arg_5 = (\n      arg_0.connections.segmentForFlatIdx(i)\n      for i in xrange(len(arg_3))\n      if arg_3[i] >= arg_0.minThreshold\n    )\n\n    arg_0.activeSegments = sorted(arg_4,\n                                 key=arg_0.connections.segmentPositionSortKey)\n    arg_0.matchingSegments = sorted(arg_5,\n                                   key=arg_0.connections.segmentPositionSortKey)\n    arg_0.numActiveConnectedSynapsesForSegment = arg_2\n    arg_0.numActivePotentialSynapsesForSegment = arg_3\n\n    if arg_1:\n      for arg_8 in arg_0.activeSegments:\n        arg_0.lastUsedIterationForSegment[arg_8.flatIdx] = arg_0.iteration\n      arg_0.iteration += 1", "path": "src/nupic/algorithms/temporal_memory.py", "identifier": "TemporalMemory.activateDendrites", "docstring": "Calculate dendrite segment activity, using the current active cells.\n\n    :param learn: (bool) If true, segment activations will be recorded. This \n           information is used during segment cleanup.\n\n    **Pseudocode:**\n    \n    ::\n\n      for each distal dendrite segment with activity >= activationThreshold\n        mark the segment as active\n      for each distal dendrite segment with unconnected activity >= minThreshold\n        mark the segment as matching", "docstring_tokens": ["Calculate", "dendrite", "segment", "activity", "using", "the", "current", "active", "cells", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 254968}
{"url": "https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/client/heart.py#L57-L69", "sha": "6ac71bda1de6706fb34244ae4972e36db5f062d3", "docstring_summary": "Add a heart to a service collection", "language": "python", "parameters": "(master)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "makeService", "(", ")", "if", "arg_1", "is", "None", ":", "return", "arg_1", ".", "setName", "(", "'heart'", ")", "arg_1", ".", "setServiceParent", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Add a heart to a service collection\n\n    Add a heart to a service.IServiceCollector if\n    the heart is not None.\n\n    :params master: a service.IServiceCollector\n    \"\"\"\n    arg_1 = makeService()\n    if arg_1 is None:\n        return\n    arg_1.setName('heart')\n    arg_1.setServiceParent(arg_0)", "path": "ncolony/client/heart.py", "identifier": "maybeAddHeart", "docstring": "Add a heart to a service collection\n\n    Add a heart to a service.IServiceCollector if\n    the heart is not None.\n\n    :params master: a service.IServiceCollector", "docstring_tokens": ["Add", "a", "heart", "to", "a", "service", "collection"], "nwo": "ncolony/ncolony", "score": 0.2757871243566705, "idx": 254969}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/shell.py#L106-L124", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Lazily load a callable.", "language": "python", "parameters": "(cls, add_action)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_1", ".", "partition", "(", "','", ")", "arg_5", "=", "importlib", ".", "import_module", "(", "arg_2", ")", "if", "arg_4", "==", "\"\"", ":", "arg_3", ",", "arg_6", "=", "annotate", ".", "context_from_module", "(", "arg_5", ")", "return", "arg_6", "if", "hasattr", "(", "arg_5", ",", "arg_4", ")", ":", "return", "getattr", "(", "arg_5", ",", "arg_4", ")", "raise", "ArgumentError", "(", "\"Attempted to import nonexistent object from module\"", ",", "arg_2", "=", "arg_2", ",", "object", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Lazily load a callable.\n\n        Perform a lazy import of a context so that we don't have a huge initial startup time\n        loading all of the modules that someone might want even though they probably only\n        will use a few of them.\n        \"\"\"\n\n        arg_2, arg_3, arg_4 = arg_1.partition(',')\n\n        arg_5 = importlib.import_module(arg_2)\n        if arg_4 == \"\":\n            arg_3, arg_6 = annotate.context_from_module(arg_5)\n            return arg_6\n\n        if hasattr(arg_5, arg_4):\n            return getattr(arg_5, arg_4)\n\n        raise ArgumentError(\"Attempted to import nonexistent object from module\", arg_2=arg_2, object=arg_4)", "path": "typedargs/shell.py", "identifier": "HierarchicalShell._deferred_add", "docstring": "Lazily load a callable.\n\n        Perform a lazy import of a context so that we don't have a huge initial startup time\n        loading all of the modules that someone might want even though they probably only\n        will use a few of them.", "docstring_tokens": ["Lazily", "load", "a", "callable", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 254970}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/preprocessors/preprocessor.py#L156-L175", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates a preprocessing stack from a specification dict.", "language": "python", "parameters": "(spec, kwargs=None)", "return_statement": "return stack", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "arg_0", "=", "[", "arg_0", "]", "arg_2", "=", "PreprocessorStack", "(", ")", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "copy", ".", "deepcopy", "(", "arg_1", ")", "arg_5", "=", "util", ".", "get_object", "(", "obj", "=", "arg_3", ",", "predefined_objects", "=", "tensorforce", ".", "core", ".", "preprocessors", ".", "preprocessors", ",", "arg_1", "=", "arg_4", ")", "assert", "isinstance", "(", "arg_5", ",", "Preprocessor", ")", "arg_2", ".", "preprocessors", ".", "append", "(", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Creates a preprocessing stack from a specification dict.\n        \"\"\"\n        if isinstance(arg_0, dict):\n            arg_0 = [arg_0]\n\n        arg_2 = PreprocessorStack()\n        for arg_3 in arg_0:\n            # need to deep copy, otherwise will add first processors spec_ to kwargs to second processor\n            arg_4 = copy.deepcopy(arg_1)\n            arg_5 = util.get_object(\n                obj=arg_3,\n                predefined_objects=tensorforce.core.preprocessors.preprocessors,\n                arg_1=arg_4\n            )\n            assert isinstance(arg_5, Preprocessor)\n            arg_2.preprocessors.append(arg_5)\n\n        return arg_2", "path": "tensorforce/core/preprocessors/preprocessor.py", "identifier": "PreprocessorStack.from_spec", "docstring": "Creates a preprocessing stack from a specification dict.", "docstring_tokens": ["Creates", "a", "preprocessing", "stack", "from", "a", "specification", "dict", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 254971}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3385-L3392", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Jumps short if not overflow.", "language": "python", "parameters": "(cpu, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "False", "==", "arg_0", ".", "OF", ",", "arg_1", ".", "read", "(", ")", ",", "arg_0", ".", "PC", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Jumps short if not overflow.\n\n        :param cpu: current CPU.\n        :param target: destination operand.\n        \"\"\"\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, False == arg_0.OF, arg_1.read(), arg_0.PC)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.JNO", "docstring": "Jumps short if not overflow.\n\n        :param cpu: current CPU.\n        :param target: destination operand.", "docstring_tokens": ["Jumps", "short", "if", "not", "overflow", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 254972}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L393-L396", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return a new individual crossing self and other.", "language": "python", "parameters": "(self, other)", "return_statement": "return self.__class__(self.genes[:c] + other.genes[c:])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "random", ".", "randrange", "(", "len", "(", "arg_0", ".", "genes", ")", ")", "return", "arg_0", ".", "__class__", "(", "arg_0", ".", "genes", "[", ":", "arg_2", "]", "+", "arg_1", ".", "genes", "[", "arg_2", ":", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"Return a new individual crossing self and other.\"\n        arg_2 = random.randrange(len(arg_0.genes))\n        return arg_0.__class__(arg_0.genes[:arg_2] + arg_1.genes[arg_2:])", "path": "aima/search.py", "identifier": "GAState.mate", "docstring": "Return a new individual crossing self and other.", "docstring_tokens": ["Return", "a", "new", "individual", "crossing", "self", "and", "other", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 254973}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L1197-L1221", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Determine the Fitch profile for a single character of the node's sequence.\n        The profile is essentially the intersection between the children's\n        profiles or, if the former is empty, the union of the profiles.", "language": "python", "parameters": "(self, node, pos)", "return_statement": "return state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_fitch_intersect", "(", "[", "k", ".", "state", "[", "arg_2", "]", "for", "k", "in", "arg_1", ".", "clades", "]", ")", "if", "len", "(", "arg_3", ")", "==", "0", ":", "arg_3", "=", "np", ".", "concatenate", "(", "[", "k", ".", "state", "[", "arg_2", "]", "for", "k", "in", "arg_1", ".", "clades", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Determine the Fitch profile for a single character of the node's sequence.\n        The profile is essentially the intersection between the children's\n        profiles or, if the former is empty, the union of the profiles.\n\n        Parameters\n        ----------\n\n         node : PhyloTree.Clade:\n            Internal node which the profiles are to be determined\n\n         pos : int\n            Position in the node's sequence which the profiles should\n            be determinedf for.\n\n        Returns\n        -------\n         state : numpy.array\n            Fitch profile for the character at position pos of the given node.\n        \"\"\"\n        arg_3 = arg_0._fitch_intersect([k.state[arg_2] for k in arg_1.clades])\n        if len(arg_3) == 0:\n            arg_3 = np.concatenate([k.state[arg_2] for k in arg_1.clades])\n        return arg_3", "path": "treetime/treeanc.py", "identifier": "TreeAnc._fitch_state", "docstring": "Determine the Fitch profile for a single character of the node's sequence.\n        The profile is essentially the intersection between the children's\n        profiles or, if the former is empty, the union of the profiles.\n\n        Parameters\n        ----------\n\n         node : PhyloTree.Clade:\n            Internal node which the profiles are to be determined\n\n         pos : int\n            Position in the node's sequence which the profiles should\n            be determinedf for.\n\n        Returns\n        -------\n         state : numpy.array\n            Fitch profile for the character at position pos of the given node.", "docstring_tokens": ["Determine", "the", "Fitch", "profile", "for", "a", "single", "character", "of", "the", "node", "s", "sequence", ".", "The", "profile", "is", "essentially", "the", "intersection", "between", "the", "children", "s", "profiles", "or", "if", "the", "former", "is", "empty", "the", "union", "of", "the", "profiles", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 254974}
{"url": "https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/__main__.py#L105-L134", "sha": "716845562a2bbb430de3c379c9481b195e451ccf", "docstring_summary": "Command line interface for YOURLS.", "language": "python", "parameters": "(ctx, apiurl, signature, username, password)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "Funcck", ".", "UsageError", "(", "\"apiurl missing. See 'yourls --help'\"", ")", "arg_5", "=", "dict", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "try", ":", "arg_0", ".", "obj", "=", "YOURLSClient", "(", "arg_1", "=", "arg_1", ",", "**", "arg_5", ")", "except", "TypeError", ":", "raise", "Funcck", ".", "UsageError", "(", "\"authentication paremeters overspecified. \"", "\"See 'yourls --help'\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Command line interface for YOURLS.\n\n    Configuration parameters can be passed as switches or stored in .yourls or\n    ~/.yourls.\n\n    If your YOURLS server requires authentication, please provide one of the\n    following:\n\n    \\b\n    \u2022 apiurl and signature\n    \u2022 apiurl, username, and password\n\n    Configuration file format:\n\n    \\b\n    [yourls]\n    apiurl = http://example.com/yourls-api.php\n    signature = abcdefghij\n    \"\"\"\n    if arg_1 is None:\n        raise Funcck.UsageError(\"apiurl missing. See 'yourls --help'\")\n\n    arg_5 = dict(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)\n\n    try:\n        arg_0.obj = YOURLSClient(arg_1=arg_1, **arg_5)\n    except TypeError:\n        raise Funcck.UsageError(\"authentication paremeters overspecified. \"\n                               \"See 'yourls --help'\")", "path": "yourls/__main__.py", "identifier": "cli", "docstring": "Command line interface for YOURLS.\n\n    Configuration parameters can be passed as switches or stored in .yourls or\n    ~/.yourls.\n\n    If your YOURLS server requires authentication, please provide one of the\n    following:\n\n    \\b\n    \u2022 apiurl and signature\n    \u2022 apiurl, username, and password\n\n    Configuration file format:\n\n    \\b\n    [yourls]\n    apiurl = http://example.com/yourls-api.php\n    signature = abcdefghij", "docstring_tokens": ["Command", "line", "interface", "for", "YOURLS", "."], "nwo": "RazerM/yourls-python", "score": 0.3518893757964147, "idx": 254975}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/update.py#L162-L184", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "run the update command", "language": "python", "parameters": "(command, parser, cl_args, unknown_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "Log", ".", "debug", "(", "\"Update Args: %s\"", ",", "arg_2", ")", "arg_4", "=", "jars", ".", "packing_jars", "(", ")", "arg_5", "=", "\"update topology%s\"", "%", "(", "' in dry-Func mode'", "if", "arg_2", "[", "\"dry_Func\"", "]", "else", "''", ")", "arg_6", "=", "{", "}", "try", ":", "arg_6", "=", "build_extra_args_dict", "(", "arg_2", ")", "except", "Exception", "as", "err", ":", "return", "SimpleResult", "(", "Status", ".", "InvocationError", ",", "err", ".", "message", ")", "if", "arg_2", "[", "'deploy_mode'", "]", "==", "config", ".", "SERVER_MODE", ":", "return", "cli_helper", ".", "Func_server", "(", "arg_0", ",", "arg_2", ",", "arg_5", ",", "arg_6", ")", "else", ":", "arg_7", "=", "convert_args_dict_to_list", "(", "arg_6", ")", "return", "cli_helper", ".", "Func_direct", "(", "arg_0", ",", "arg_2", ",", "arg_5", ",", "arg_7", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\" Func the update command \"\"\"\n\n  Log.debug(\"Update Args: %s\", arg_2)\n\n  # Build jar list\n  arg_4 = jars.packing_jars()\n  arg_5 = \"update topology%s\" % (' in dry-Func mode' if arg_2[\"dry_Func\"] else '')\n\n  # Build extra args\n  arg_6 = {}\n  try:\n    arg_6 = build_extra_args_dict(arg_2)\n  except Exception as err:\n    return SimpleResult(Status.InvocationError, err.message)\n\n  # Execute\n  if arg_2['deploy_mode'] == config.SERVER_MODE:\n    return cli_helper.Func_server(arg_0, arg_2, arg_5, arg_6)\n  else:\n    # Convert extra argument to commandline format and then execute\n    arg_7 = convert_args_dict_to_list(arg_6)\n    return cli_helper.Func_direct(arg_0, arg_2, arg_5, arg_7, arg_4)", "path": "heron/tools/cli/src/python/update.py", "identifier": "run", "docstring": "run the update command", "docstring_tokens": ["run", "the", "update", "command"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 254976}
{"url": "https://github.com/soerenwolfers/swutil/blob/2d598f2deac8b7e20df95dbc68017e5ab5d6180c/swutil/validation.py#L165-L198", "sha": "2d598f2deac8b7e20df95dbc68017e5ab5d6180c", "docstring_summary": "Similar to validate but validates multiple objects at once, each with their own specification. \n    \n    Fill objects that were specified but not provided with NotPassed or default values\n    Apply `value_condition` to object dictionary as a whole", "language": "python", "parameters": "(args, specs, defaults,passed_conditions,value_conditions,\n                  allow_unknowns,unknowns_spec)", "return_statement": "return validated_args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "builtins", ".", "dict", "(", ")", "arg_8", "=", "set", "(", "arg_0", ".", "keys", "(", ")", ")", "-", "set", "(", "arg_1", ".", "keys", "(", ")", ")", "if", "arg_8", ":", "if", "not", "arg_5", ":", "raise", "ValueError", "(", "(", "'Arguments {} were passed but not specified (use '", "+", "'`allow_unknowns=True` to avoid this error)'", ".", "format", "(", "arg_8", ")", ")", ")", "else", ":", "for", "arg_9", "in", "arg_8", ":", "if", "arg_6", "is", "not", "None", ":", "arg_1", "[", "arg_9", "]", "=", "arg_6", "if", "arg_3", ":", "validate", "(", "arg_0", ",", "Dict", "(", "arg_3", "=", "arg_3", ")", ")", "for", "arg_9", "in", "arg_1", ":", "if", "(", "not", "arg_9", "in", "arg_0", ")", "or", "NotPassed", "(", "arg_0", "[", "arg_9", "]", ")", ":", "if", "arg_9", "in", "arg_2", ":", "if", "isinstance", "(", "arg_2", "[", "arg_9", "]", ",", "DefaultGenerator", ")", ":", "arg_7", "[", "arg_9", "]", "=", "arg_2", "[", "arg_9", "]", "(", ")", "else", ":", "arg_7", "[", "arg_9", "]", "=", "arg_2", "[", "arg_9", "]", "else", ":", "arg_7", "[", "arg_9", "]", "=", "NotPassed", "else", ":", "arg_7", "[", "arg_9", "]", "=", "validate", "(", "arg_0", "[", "arg_9", "]", ",", "arg_1", "[", "arg_9", "]", ")", "if", "arg_4", ":", "arg_7", "=", "validate", "(", "arg_7", ",", "arg_4", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2,arg_3,arg_4,\n                  arg_5,arg_6): \n    '''\n    Similar to validate but validates multiple objects at once, each with their own specification. \n    \n    Fill objects that were specified but not provided with NotPassed or default values\n    Apply `value_condition` to object dictionary as a whole \n    '''\n    arg_7 = builtins.dict() \n    arg_8 = set(arg_0.keys()) - set(arg_1.keys())\n    if arg_8:\n        if not arg_5:\n            raise ValueError(('Arguments {} were passed but not specified (use ' + \n                 '`allow_unknowns=True` to avoid this error)'.format(arg_8)))\n        else:\n            for arg_9 in arg_8:\n                if arg_6 is not None:\n                    arg_1[arg_9] = arg_6\n    if arg_3:\n        validate(arg_0, Dict(arg_3=arg_3))\n    for arg_9 in arg_1:\n        if (not arg_9 in arg_0) or NotPassed(arg_0[arg_9]):\n            if arg_9 in arg_2:\n                if isinstance(arg_2[arg_9],DefaultGenerator):\n                    arg_7[arg_9] = arg_2[arg_9]()\n                else:\n                    arg_7[arg_9] = arg_2[arg_9]\n            else:\n                arg_7[arg_9] = NotPassed\n        else:#Default values and NotPassed values are not validated. Former has advantage that default values need to be `correct` without validation and thus encourage the user to pass stuff that doesn't need validation, and is therefore faster\n            arg_7[arg_9] = validate(arg_0[arg_9], arg_1[arg_9])\n    if arg_4:\n        arg_7 = validate(arg_7, arg_4)\n    return arg_7", "path": "swutil/validation.py", "identifier": "_validate_many", "docstring": "Similar to validate but validates multiple objects at once, each with their own specification. \n    \n    Fill objects that were specified but not provided with NotPassed or default values\n    Apply `value_condition` to object dictionary as a whole", "docstring_tokens": ["Similar", "to", "validate", "but", "validates", "multiple", "objects", "at", "once", "each", "with", "their", "own", "specification", ".", "Fill", "objects", "that", "were", "specified", "but", "not", "provided", "with", "NotPassed", "or", "default", "values", "Apply", "value_condition", "to", "object", "dictionary", "as", "a", "whole"], "nwo": "soerenwolfers/swutil", "score": 0.2747185692836802, "idx": 254977}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py#L713-L723", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Stops all the running channels for this kernel.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "shell_channel", ".", "is_alive", "(", ")", ":", "arg_0", ".", "shell_channel", ".", "stop", "(", ")", "if", "arg_0", ".", "sub_channel", ".", "is_alive", "(", ")", ":", "arg_0", ".", "sub_channel", ".", "stop", "(", ")", "if", "arg_0", ".", "stdin_channel", ".", "is_alive", "(", ")", ":", "arg_0", ".", "stdin_channel", ".", "stop", "(", ")", "if", "arg_0", ".", "hb_channel", ".", "is_alive", "(", ")", ":", "arg_0", ".", "hb_channel", ".", "stop", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Stops all the running channels for this kernel.\n        \"\"\"\n        if arg_0.shell_channel.is_alive():\n            arg_0.shell_channel.stop()\n        if arg_0.sub_channel.is_alive():\n            arg_0.sub_channel.stop()\n        if arg_0.stdin_channel.is_alive():\n            arg_0.stdin_channel.stop()\n        if arg_0.hb_channel.is_alive():\n            arg_0.hb_channel.stop()", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py", "identifier": "KernelManager.stop_channels", "docstring": "Stops all the running channels for this kernel.", "docstring_tokens": ["Stops", "all", "the", "running", "channels", "for", "this", "kernel", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 254978}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/TaskParser.py#L158-L170", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Connects this task to the indicating outgoing task, with the details in\n        the sequence flow. A subclass can override this method to get extra\n        information from the node.", "language": "python", "parameters": "(self, outgoing_task, outgoing_task_node,\n                         sequence_flow_node, is_default)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_0", ".", "task", ".", "Func", "(", "arg_1", ",", "arg_3", ".", "get", "(", "'id'", ")", ",", "arg_3", ".", "get", "(", "'name'", ",", "None", ")", ",", "arg_0", ".", "parser", ".", "_parse_documentation", "(", "arg_3", ",", "task_parser", "=", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                         arg_3, arg_4):\n        \"\"\"\n        Connects this task to the indicating outgoing task, with the details in\n        the sequence flow. A subclass can override this method to get extra\n        information from the node.\n        \"\"\"\n        arg_0.task.Func(\n            arg_1, arg_3.get('id'),\n            arg_3.get(\n                'name', None),\n            arg_0.parser._parse_documentation(arg_3,\n                                             task_parser=arg_0))", "path": "SpiffWorkflow/bpmn/parser/TaskParser.py", "identifier": "TaskParser.connect_outgoing", "docstring": "Connects this task to the indicating outgoing task, with the details in\n        the sequence flow. A subclass can override this method to get extra\n        information from the node.", "docstring_tokens": ["Connects", "this", "task", "to", "the", "indicating", "outgoing", "task", "with", "the", "details", "in", "the", "sequence", "flow", ".", "A", "subclass", "can", "override", "this", "method", "to", "get", "extra", "information", "from", "the", "node", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 254979}
{"url": "https://github.com/lspvic/jupyter_tensorboard/blob/2a012b524a25d353d1b0e5e559ceaae62178ffce/jupyter_tensorboard/application.py#L110-L117", "sha": "2a012b524a25d353d1b0e5e559ceaae62178ffce", "docstring_summary": "Perform the App's actions as configured", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "super", "(", "JupyterTensorboardApp", ",", "arg_0", ")", ".", "Func", "(", ")", "arg_1", "=", "\", \"", ".", "join", "(", "sorted", "(", "arg_0", ".", "subcommands", ")", ")", "sys", ".", "exit", "(", "\"Please supply at least one subcommand: %s\"", "%", "arg_1", ")"], "function": "def Func(arg_0):\r\n        \"\"\"Perform the App's actions as configured\"\"\"\r\n        super(JupyterTensorboardApp, arg_0).Func()\r\n\r\n        # The above should have called a subcommand and raised NoStart; if we\r\n        # get here, it didn't, so we should self.log.info a message.\r\n        arg_1 = \", \".join(sorted(arg_0.subcommands))\r\n        sys.exit(\"Please supply at least one subcommand: %s\" % arg_1)", "path": "jupyter_tensorboard/application.py", "identifier": "JupyterTensorboardApp.start", "docstring": "Perform the App's actions as configured", "docstring_tokens": ["Perform", "the", "App", "s", "actions", "as", "configured"], "nwo": "lspvic/jupyter_tensorboard", "score": 0.7672928496880786, "idx": 254980}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L183-L216", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Create an item from the local file in the Midas Server folder corresponding\n    to the parent folder id.", "language": "python", "parameters": "(local_file, parent_folder_id, reuse_existing=False)", "return_statement": "return item_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "os", ".", "path", ".", "basename", "(", "arg_0", ")", "arg_4", "=", "None", "if", "arg_2", ":", "arg_5", "=", "session", ".", "communicator", ".", "folder_children", "(", "session", ".", "token", ",", "arg_1", ")", "arg_6", "=", "arg_5", "[", "'items'", "]", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", "[", "'name'", "]", "==", "arg_3", ":", "arg_4", "=", "arg_7", "[", "'item_id'", "]", "break", "if", "arg_4", "is", "None", ":", "arg_8", "=", "session", ".", "communicator", ".", "create_item", "(", "session", ".", "token", ",", "arg_3", ",", "arg_1", ")", "arg_4", "=", "arg_8", "[", "'item_id'", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Create an item from the local file in the Midas Server folder corresponding\n    to the parent folder id.\n\n    :param local_file: full path to a file on the local file system\n    :type local_file: string\n    :param parent_folder_id: id of parent folder on the Midas Server instance,\n        where the item will be added\n    :type parent_folder_id: int | long\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool\n    \"\"\"\n    arg_3 = os.path.basename(arg_0)\n    arg_4 = None\n    if arg_2:\n        # check by name to see if the item already exists in the folder\n        arg_5 = session.communicator.folder_children(\n            session.token, arg_1)\n        arg_6 = arg_5['items']\n\n        for arg_7 in arg_6:\n            if arg_7['name'] == arg_3:\n                arg_4 = arg_7['item_id']\n                break\n\n    if arg_4 is None:\n        # create the item for the subdir\n        arg_8 = session.communicator.create_item(\n            session.token, arg_3, arg_1)\n        arg_4 = arg_8['item_id']\n\n    return arg_4", "path": "pydas/api.py", "identifier": "_create_or_reuse_item", "docstring": "Create an item from the local file in the Midas Server folder corresponding\n    to the parent folder id.\n\n    :param local_file: full path to a file on the local file system\n    :type local_file: string\n    :param parent_folder_id: id of parent folder on the Midas Server instance,\n        where the item will be added\n    :type parent_folder_id: int | long\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool", "docstring_tokens": ["Create", "an", "item", "from", "the", "local", "file", "in", "the", "Midas", "Server", "folder", "corresponding", "to", "the", "parent", "folder", "id", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 254981}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/providers/basicaer/basicaerprovider.py#L116-L134", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return an instance of a backend from its class.", "language": "python", "parameters": "(self, backend_cls)", "return_statement": "return backend_instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_1", "(", "provider", "=", "arg_0", ")", "except", "Exception", "as", "err", ":", "raise", "QiskitError", "(", "'Backend %s could not be instantiated: %s'", "%", "(", "arg_1", ",", "err", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return an instance of a backend from its class.\n\n        Args:\n            backend_cls (class): Backend class.\n        Returns:\n            BaseBackend: a backend instance.\n        Raises:\n            QiskitError: if the backend could not be instantiated.\n        \"\"\"\n        # Verify that the backend can be instantiated.\n        try:\n            arg_2 = arg_1(provider=arg_0)\n        except Exception as err:\n            raise QiskitError('Backend %s could not be instantiated: %s' %\n                              (arg_1, err))\n\n        return arg_2", "path": "qiskit/providers/basicaer/basicaerprovider.py", "identifier": "BasicAerProvider._get_backend_instance", "docstring": "Return an instance of a backend from its class.\n\n        Args:\n            backend_cls (class): Backend class.\n        Returns:\n            BaseBackend: a backend instance.\n        Raises:\n            QiskitError: if the backend could not be instantiated.", "docstring_tokens": ["Return", "an", "instance", "of", "a", "backend", "from", "its", "class", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254982}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/operator.py#L51-L67", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Convert a list of nodes in postfix order to an Optree.", "language": "python", "parameters": "(nodes)", "return_statement": "return OptreeNode(None, (node, ))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "len", "(", "arg_0", ")", ">", "1", ":", "arg_0", "=", "_reduce", "(", "arg_0", ")", "if", "len", "(", "arg_0", ")", "==", "0", ":", "raise", "OperatorError", "(", "\"Empty node list\"", ")", "arg_1", "=", "arg_0", "[", "0", "]", "if", "isinstance", "(", "arg_1", ",", "OperatorNode", ")", ":", "raise", "OperatorError", "(", "\"Operator without operands\"", ")", "if", "isinstance", "(", "arg_1", ",", "OptreeNode", ")", ":", "return", "arg_1", "return", "OptreeNode", "(", "None", ",", "(", "arg_1", ",", ")", ")"], "function": "def Func(arg_0):\n  \"\"\"Convert a list of nodes in postfix order to an Optree.\"\"\"\n  while len(arg_0) > 1:\n    arg_0 = _reduce(arg_0)\n\n  if len(arg_0) == 0:\n    raise OperatorError(\"Empty node list\")\n\n  arg_1 = arg_0[0]\n\n  if isinstance(arg_1, OperatorNode):\n    raise OperatorError(\"Operator without operands\")\n\n  if isinstance(arg_1, OptreeNode):\n    return arg_1\n\n  return OptreeNode(None, (arg_1, ))", "path": "pyebnf/operator.py", "identifier": "postfix_to_optree", "docstring": "Convert a list of nodes in postfix order to an Optree.", "docstring_tokens": ["Convert", "a", "list", "of", "nodes", "in", "postfix", "order", "to", "an", "Optree", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 254983}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/environment.py#L40-L54", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Parse string to bool.", "language": "python", "parameters": "(value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "parse_str", "(", "arg_0", ")", ".", "capitalize", "(", ")", "if", "arg_1", "in", "(", "\"True\"", ",", "\"Yes\"", ",", "\"On\"", ",", "\"1\"", ")", ":", "return", "True", "elif", "arg_1", "in", "(", "\"False\"", ",", "\"No\"", ",", "\"Off\"", ",", "\"0\"", ")", ":", "return", "False", "else", ":", "raise", "ValueError", "(", "'Unable to parse boolean value \"{}\"'", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse string to bool.\n\n    :param str value: String value to parse as bool\n    :return bool:\n    \"\"\"\n    arg_1 = parse_str(arg_0).capitalize()\n\n    if arg_1 in (\"True\", \"Yes\", \"On\", \"1\"):\n        return True\n    elif arg_1 in (\"False\", \"No\", \"Off\", \"0\"):\n        return False\n    else:\n        raise ValueError('Unable to parse boolean value \"{}\"'.format(arg_0))", "path": "bananas/environment.py", "identifier": "parse_bool", "docstring": "Parse string to bool.\n\n    :param str value: String value to parse as bool\n    :return bool:", "docstring_tokens": ["Parse", "string", "to", "bool", "."], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 254984}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/text_writer.py#L55-L64", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "display a table as text", "language": "python", "parameters": "(self, layout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_table_content", "(", "arg_1", ")", "arg_3", "=", "[", "0", "]", "*", "len", "(", "arg_2", "[", "0", "]", ")", "for", "arg_4", "in", "arg_2", ":", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ")", ":", "arg_3", "[", "arg_5", "]", "=", "max", "(", "arg_3", "[", "arg_5", "]", ",", "len", "(", "arg_6", ")", ")", "arg_0", ".", "default_table", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_0", ".", "writeln", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"display a table as text\"\"\"\n        arg_2 = arg_0.get_table_content(arg_1)\n        # get columns width\n        arg_3 = [0] * len(arg_2[0])\n        for arg_4 in arg_2:\n            for arg_5, arg_6 in enumerate(arg_4):\n                arg_3[arg_5] = max(arg_3[arg_5], len(arg_6))\n        arg_0.default_table(arg_1, arg_2, arg_3)\n        arg_0.writeln()", "path": "pylint/reporters/ureports/text_writer.py", "identifier": "TextWriter.visit_table", "docstring": "display a table as text", "docstring_tokens": ["display", "a", "table", "as", "text"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 254985}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/BpmnParser.py#L96-L104", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns the ProcessParser for the given process ID or name. It matches\n        by name first.", "language": "python", "parameters": "(self, process_id_or_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "process_parsers_by_name", ":", "return", "arg_0", ".", "process_parsers_by_name", "[", "arg_1", "]", "else", ":", "return", "arg_0", ".", "process_parsers", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns the ProcessParser for the given process ID or name. It matches\n        by name first.\n        \"\"\"\n        if arg_1 in arg_0.process_parsers_by_name:\n            return arg_0.process_parsers_by_name[arg_1]\n        else:\n            return arg_0.process_parsers[arg_1]", "path": "SpiffWorkflow/bpmn/parser/BpmnParser.py", "identifier": "BpmnParser.get_process_parser", "docstring": "Returns the ProcessParser for the given process ID or name. It matches\n        by name first.", "docstring_tokens": ["Returns", "the", "ProcessParser", "for", "the", "given", "process", "ID", "or", "name", ".", "It", "matches", "by", "name", "first", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 254986}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/bbciplayer.py#L100-L120", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Given an HTTP response from the sessino endpoint, extract the nonce, so we can \"sign\" requests with it.\n        We don't really sign the requests in the traditional sense of a nonce, we just incude them in the auth requests.", "language": "python", "parameters": "(cls, http_result)", "return_statement": "return goto_url_query['nonce']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "urlparse", "(", "arg_1", ".", "history", "[", "-", "1", "]", ".", "request", ".", "url", ")", "arg_3", "=", "dict", "(", "parse_qsl", "(", "arg_2", ".", "query", ")", ")", "arg_4", "=", "urlparse", "(", "arg_3", "[", "'goto'", "]", ")", "arg_5", "=", "dict", "(", "parse_qsl", "(", "arg_4", ".", "query", ")", ")", "arg_6", "=", "parse_json", "(", "arg_5", "[", "'state'", "]", ")", "return", "arg_6", "[", "'nonce'", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Given an HTTP response from the sessino endpoint, extract the nonce, so we can \"sign\" requests with it.\n        We don't really sign the requests in the traditional sense of a nonce, we just incude them in the auth requests.\n\n        :param http_result: HTTP response from the bbc session endpoint.\n        :type http_result: requests.Response\n        :return: nonce to \"sign\" url requests with\n        :rtype: string\n        \"\"\"\n\n        # Extract the redirect URL from the last call\n        arg_2 = urlparse(arg_1.history[-1].request.url)\n        arg_3 = dict(parse_qsl(arg_2.query))\n        # Extract the nonce from the query string in the redirect URL\n        arg_4 = urlparse(arg_3['goto'])\n        arg_5 = dict(parse_qsl(arg_4.query))\n        arg_6 = parse_json(arg_5['state'])\n\n        # Return the nonce we can use for future queries\n        return arg_6['nonce']", "path": "src/streamlink/plugins/bbciplayer.py", "identifier": "BBCiPlayer._extract_nonce", "docstring": "Given an HTTP response from the sessino endpoint, extract the nonce, so we can \"sign\" requests with it.\n        We don't really sign the requests in the traditional sense of a nonce, we just incude them in the auth requests.\n\n        :param http_result: HTTP response from the bbc session endpoint.\n        :type http_result: requests.Response\n        :return: nonce to \"sign\" url requests with\n        :rtype: string", "docstring_tokens": ["Given", "an", "HTTP", "response", "from", "the", "sessino", "endpoint", "extract", "the", "nonce", "so", "we", "can", "sign", "requests", "with", "it", ".", "We", "don", "t", "really", "sign", "the", "requests", "in", "the", "traditional", "sense", "of", "a", "nonce", "we", "just", "incude", "them", "in", "the", "auth", "requests", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 254987}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L145-L165", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Get the parent entity of the entity pointed by the given path.", "language": "python", "parameters": "(self, path)", "return_statement": "return self.api_client.get_entity_by_query(path=parent_path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "__validate_storage_path", "(", "arg_1", ",", "projects_allowed", "=", "False", ")", "arg_2", "=", "[", "step", "for", "step", "in", "arg_1", ".", "split", "(", "'/'", ")", "if", "step", "]", "del", "arg_2", "[", "-", "1", "]", "arg_3", "=", "'/{0}'", ".", "format", "(", "'/'", ".", "join", "(", "arg_2", ")", ")", "return", "arg_0", ".", "api_client", ".", "get_entity_by_query", "(", "arg_1", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        '''Get the parent entity of the entity pointed by the given path.\n\n        Args:\n            path (str): The path of the entity whose parent is needed\n\n        Returns:\n            A JSON object of the parent entity if found.\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes\n        '''\n\n        arg_0.__validate_storage_path(arg_1, projects_allowed=False)\n        arg_2 = [step for step in arg_1.split('/') if step]\n        del arg_2[-1]\n        arg_3 = '/{0}'.format('/'.join(arg_2))\n        return arg_0.api_client.get_entity_by_query(arg_1=arg_3)", "path": "hbp_service_client/storage_service/client.py", "identifier": "Client.get_parent", "docstring": "Get the parent entity of the entity pointed by the given path.\n\n        Args:\n            path (str): The path of the entity whose parent is needed\n\n        Returns:\n            A JSON object of the parent entity if found.\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes", "docstring_tokens": ["Get", "the", "parent", "entity", "of", "the", "entity", "pointed", "by", "the", "given", "path", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 254988}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py#L275-L286", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gets the service level objectives for an Azure SQL Database server.", "language": "python", "parameters": "(self, server_name)", "return_statement": "return _MinidomXmlToObject.parse_service_resources_response(\n            response, ServiceObjective)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'server_name'", ",", "arg_1", ")", "arg_2", "=", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_get_service_objectives_path", "(", "arg_1", ")", ",", "None", ")", "return", "_MinidomXmlToObject", ".", "parse_service_resources_response", "(", "arg_2", ",", "ServiceObjective", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Gets the service level objectives for an Azure SQL Database server.\n\n        server_name:\n            Name of the server.\n        '''\n        _validate_not_none('server_name', arg_1)\n        arg_2 = arg_0._perform_get(\n            arg_0._get_service_objectives_path(arg_1), None)\n        return _MinidomXmlToObject.parse_service_resources_response(\n            arg_2, ServiceObjective)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py", "identifier": "SqlDatabaseManagementService.list_service_level_objectives", "docstring": "Gets the service level objectives for an Azure SQL Database server.\n\n        server_name:\n            Name of the server.", "docstring_tokens": ["Gets", "the", "service", "level", "objectives", "for", "an", "Azure", "SQL", "Database", "server", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 254989}
{"url": "https://github.com/inveniosoftware/invenio-csl-rest/blob/a474a5b4caa9e6ae841a007fa52b30ad7e957560/invenio_csl_rest/ext.py#L43-L49", "sha": "a474a5b4caa9e6ae841a007fa52b30ad7e957560", "docstring_summary": "Get a dictionary of CSL styles.", "language": "python", "parameters": "(self)", "return_statement": "return styles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "get_all_styles", "(", ")", "arg_2", "=", "arg_0", ".", "app", ".", "config", ".", "get", "(", "'CSL_STYLES_WHITELIST'", ")", "if", "arg_2", ":", "return", "{", "arg_3", ":", "arg_4", "for", "arg_3", ",", "arg_4", "in", "Func", ".", "items", "(", ")", "if", "arg_3", "in", "arg_2", "}", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"Get a dictionary of CSL styles.\"\"\"\n        Func = get_all_styles()\n        arg_2 = arg_0.app.config.get('CSL_STYLES_WHITELIST')\n        if arg_2:\n            return {arg_3: arg_4 for arg_3, arg_4 in Func.items() if arg_3 in arg_2}\n        return Func", "path": "invenio_csl_rest/ext.py", "identifier": "_InvenioCSLRESTState.styles", "docstring": "Get a dictionary of CSL styles.", "docstring_tokens": ["Get", "a", "dictionary", "of", "CSL", "styles", "."], "nwo": "inveniosoftware/invenio-csl-rest", "score": 0.16941397159673272, "idx": 254990}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/providers/basebackend.py#L71-L81", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return backend status.", "language": "python", "parameters": "(self)", "return_statement": "return BackendStatus(backend_name=self.name(),\n                             backend_version=__version__,\n                             operational=True,\n                             pending_jobs=0,\n                             status_msg='')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "BackendStatus", "(", "backend_name", "=", "arg_0", ".", "name", "(", ")", ",", "backend_version", "=", "__version__", ",", "operational", "=", "True", ",", "pending_jobs", "=", "0", ",", "Func_msg", "=", "''", ")"], "function": "def Func(arg_0):\n        \"\"\"Return backend Func.\n\n        Returns:\n            BackendStatus: the Func of the backend.\n        \"\"\"\n        return BackendStatus(backend_name=arg_0.name(),\n                             backend_version=__version__,\n                             operational=True,\n                             pending_jobs=0,\n                             Func_msg='')", "path": "qiskit/providers/basebackend.py", "identifier": "BaseBackend.status", "docstring": "Return backend status.\n\n        Returns:\n            BackendStatus: the status of the backend.", "docstring_tokens": ["Return", "backend", "status", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 254991}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_identities.py#L427-L438", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Get the uuid for a profile name", "language": "python", "parameters": "(self, profile_name)", "return_statement": "return uuids", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "with", "arg_0", ".", "db", ".", "connect", "(", ")", "as", "session", ":", "arg_3", "=", "session", ".", "query", "(", "Profile", ")", ".", "filter", "(", "Profile", ".", "name", "==", "arg_1", ")", "arg_4", "=", "arg_3", ".", "all", "(", ")", "if", "arg_4", ":", "for", "arg_5", "in", "arg_4", ":", "arg_2", ".", "append", "(", "arg_5", ".", "uuid", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Get the uuid for a profile name \"\"\"\n        arg_2 = []\n\n        with arg_0.db.connect() as session:\n            arg_3 = session.query(Profile).\\\n                filter(Profile.name == arg_1)\n            arg_4 = arg_3.all()\n            if arg_4:\n                for arg_5 in arg_4:\n                    arg_2.append(arg_5.uuid)\n        return arg_2", "path": "sirmordred/task_identities.py", "identifier": "TaskIdentitiesMerge.__get_uuids_from_profile_name", "docstring": "Get the uuid for a profile name", "docstring_tokens": ["Get", "the", "uuid", "for", "a", "profile", "name"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 254992}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/flac.py#L109-L120", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Render metadata block as a byte string.", "language": "python", "parameters": "(blocks)", "return_statement": "return b\"\".join(data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "[", "[", "block", ".", "code", ",", "block", ".", "write", "(", ")", "]", "for", "block", "in", "arg_0", "]", "arg_2", "[", "-", "1", "]", "[", "0", "]", "|=", "128", "for", "arg_3", ",", "arg_4", "in", "arg_2", ":", "arg_5", "=", "chr_", "(", "arg_3", ")", "if", "len", "(", "arg_4", ")", ">", "2", "**", "24", ":", "raise", "error", "(", "\"block is too long to write\"", ")", "arg_6", "=", "struct", ".", "pack", "(", "\">I\"", ",", "len", "(", "arg_4", ")", ")", "[", "-", "3", ":", "]", "arg_1", ".", "append", "(", "arg_5", "+", "arg_6", "+", "arg_4", ")", "return", "b\"\"", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Render metadata block as a byte string.\"\"\"\n        arg_1 = []\n        arg_2 = [[block.code, block.write()] for block in arg_0]\n        arg_2[-1][0] |= 128\n        for arg_3, arg_4 in arg_2:\n            arg_5 = chr_(arg_3)\n            if len(arg_4) > 2**24:\n                raise error(\"block is too long to write\")\n            arg_6 = struct.pack(\">I\", len(arg_4))[-3:]\n            arg_1.append(arg_5 + arg_6 + arg_4)\n        return b\"\".join(arg_1)", "path": "mutagen/flac.py", "identifier": "MetadataBlock.writeblocks", "docstring": "Render metadata block as a byte string.", "docstring_tokens": ["Render", "metadata", "block", "as", "a", "byte", "string", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 254993}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_json_stream.py#L257-L286", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Given a constructed CSV reader object, a header row that we've read, and\n    a detected encoding, yield its rows as dictionaries.", "language": "python", "parameters": "(reader, header, encode_fn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ":", "if", "len", "(", "arg_3", ")", "==", "0", ":", "continue", "arg_3", "=", "[", "arg_2", "(", "cell", ")", "for", "cell", "in", "arg_3", "]", "arg_4", "=", "zip", "(", "arg_1", ",", "arg_3", ")", "arg_5", "=", "dict", "(", "arg_4", ")", "if", "len", "(", "arg_5", "[", "'text'", "]", ")", "==", "0", ":", "continue", "arg_5", "[", "'text'", "]", "=", "unicodedata", ".", "normalize", "(", "'NFKC'", ",", "arg_5", "[", "'text'", "]", ".", "strip", "(", ")", ")", "if", "arg_5", ".", "get", "(", "'title'", ")", "==", "''", ":", "del", "arg_5", "[", "'title'", "]", "if", "'date'", "in", "arg_5", ":", "if", "arg_5", "[", "'date'", "]", "==", "''", ":", "del", "arg_5", "[", "'date'", "]", "if", "'subset'", "in", "arg_5", ":", "arg_6", "=", "[", "cell", "[", "1", "]", "for", "cell", "in", "arg_4", "if", "cell", "[", "1", "]", "!=", "''", "and", "cell", "[", "0", "]", "==", "'subset'", "]", "if", "arg_6", ":", "arg_5", "[", "'subsets'", "]", "=", "arg_6", "if", "'subset'", "in", "arg_5", ":", "del", "arg_5", "[", "'subset'", "]", "yield", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Given a constructed CSV reader object, a header row that we've read, and\n    a detected encoding, yield its rows as dictionaries.\n    \"\"\"\n    for arg_3 in arg_0:\n        if len(arg_3) == 0:\n            continue\n        arg_3 = [arg_2(cell) for cell in arg_3]\n        arg_4 = zip(arg_1, arg_3)\n        arg_5 = dict(arg_4)\n        if len(arg_5['text']) == 0:\n            continue\n        arg_5['text'] = unicodedata.normalize(\n            'NFKC', arg_5['text'].strip()\n        )\n        if arg_5.get('title') == '':\n            del arg_5['title']\n        if 'date' in arg_5:\n            # We handle dates further in open_json_or_csv_somehow\n            if arg_5['date'] == '':\n                del arg_5['date']\n        if 'subset' in arg_5:\n            arg_6 = [cell[1] for cell in arg_4\n                       if cell[1] != '' and cell[0] == 'subset']\n            if arg_6:\n                arg_5['subsets'] = arg_6\n            if 'subset' in arg_5:\n                del arg_5['subset']\n        yield arg_5", "path": "luminoso_api/v4_json_stream.py", "identifier": "_read_csv", "docstring": "Given a constructed CSV reader object, a header row that we've read, and\n    a detected encoding, yield its rows as dictionaries.", "docstring_tokens": ["Given", "a", "constructed", "CSV", "reader", "object", "a", "header", "row", "that", "we", "ve", "read", "and", "a", "detected", "encoding", "yield", "its", "rows", "as", "dictionaries", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 254994}
{"url": "https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L441-L450", "sha": "247d6b9524fcee4b2da0e65ca12c52ebdd3676b2", "docstring_summary": "Returns the value of the subnode \"name\" of element e.", "language": "python", "parameters": "(e, name)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "find", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_2", ".", "text", "return", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the value of the subnode \"name\" of element e.\n\n    Returns None if the subnode doesn't exist\n    \"\"\"\n    arg_2 = arg_0.find(arg_1)\n    if arg_2 is not None:\n        return arg_2.text\n    return None", "path": "pynetgear/__init__.py", "identifier": "_xml_get", "docstring": "Returns the value of the subnode \"name\" of element e.\n\n    Returns None if the subnode doesn't exist", "docstring_tokens": ["Returns", "the", "value", "of", "the", "subnode", "name", "of", "element", "e", "."], "nwo": "MatMaul/pynetgear", "score": 0.725114434043304, "idx": 254995}
{"url": "https://github.com/saxix/sample-data-utils/blob/769f1b46e60def2675a14bd5872047af6d1ea398/sample_data_utils/people.py#L118-L135", "sha": "769f1b46e60def2675a14bd5872047af6d1ea398", "docstring_summary": "return a random last name", "language": "python", "parameters": "(languages=None)", "return_statement": "return random.choice(choices).title()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "[", "]", "arg_0", "=", "arg_0", "or", "[", "'en'", "]", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "_get_lastnames", "(", "arg_2", ")", "arg_1", ".", "extend", "(", "arg_3", ")", "return", "random", ".", "choice", "(", "arg_1", ")", ".", "title", "(", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n        return a random last name\n\n    >>> from mock import patch\n    >>> with patch('%s._get_lastnames' % __name__, lambda *args: ['aaa']):\n    ...     Func()\n    'Aaa'\n    >>> with patch('%s.get_lastnames' % __name__, lambda lang: ['%s_lastname'% lang]):\n    ...     Func(['it'])\n    'It_Lastname'\n    \"\"\"\n    arg_1 = []\n    arg_0 = arg_0 or ['en']\n    for arg_2 in arg_0:\n        arg_3 = _get_lastnames(arg_2)\n        arg_1.extend(arg_3)\n    return random.choice(arg_1).title()", "path": "sample_data_utils/people.py", "identifier": "last_name", "docstring": "return a random last name\n\n    >>> from mock import patch\n    >>> with patch('%s._get_lastnames' % __name__, lambda *args: ['aaa']):\n    ...     last_name()\n    'Aaa'\n    >>> with patch('%s.get_lastnames' % __name__, lambda lang: ['%s_lastname'% lang]):\n    ...     last_name(['it'])\n    'It_Lastname'", "docstring_tokens": ["return", "a", "random", "last", "name"], "nwo": "saxix/sample-data-utils", "score": 0.12050106452410352, "idx": 254996}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L196-L350", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Check if the given domain is a valid.", "language": "python", "parameters": "(\n        self, domain=None, subdomain_check=False\n    )", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "r\"^(?=.{0,253}$)(([a-z0-9][a-z0-9-]{0,61}[a-z0-9]|[a-z0-9])\\.)+((?=.*[^0-9])([a-z0-9][a-z0-9-]{0,61}[a-z0-9](?:\\.)?|[a-z0-9](?:\\.)?))$\"", "arg_4", "=", "r\"^(?=.{0,253}$)(([a-z0-9_][a-z0-9-_]{0,61}[a-z0-9_-]|[a-z0-9])\\.)+((?=.*[^0-9])([a-z0-9][a-z0-9-]{0,61}[a-z0-9]|[a-z0-9]))$\"", "if", "arg_1", ":", "arg_5", "=", "arg_1", "elif", "arg_0", ".", "element", ":", "arg_5", "=", "arg_0", ".", "element", "else", ":", "arg_5", "=", "PyFunceble", ".", "INTERN", "[", "\"to_test\"", "]", "try", ":", "arg_6", "=", "arg_5", ".", "rindex", "(", "\".\"", ")", "arg_7", "=", "arg_5", "[", "arg_6", "+", "1", ":", "]", "if", "not", "arg_7", "and", "arg_5", ".", "endswith", "(", "\".\"", ")", ":", "try", ":", "arg_7", "=", "[", "x", "for", "x", "in", "arg_5", ".", "split", "(", "\".\"", ")", "if", "x", "]", "[", "-", "1", "]", "except", "IndexError", ":", "pass", "if", "not", "arg_7", "or", "arg_7", "not", "in", "PyFunceble", ".", "INTERN", "[", "\"iana_db\"", "]", ":", "return", "False", "if", "(", "Regex", "(", "arg_5", ",", "arg_3", ",", "return_data", "=", "False", ")", ".", "match", "(", ")", "and", "not", "arg_2", ")", ":", "return", "True", "if", "arg_7", "in", "PyFunceble", ".", "INTERN", "[", "\"psl_db\"", "]", ":", "for", "arg_8", "in", "PyFunceble", ".", "INTERN", "[", "\"psl_db\"", "]", "[", "arg_7", "]", ":", "try", ":", "arg_9", "=", "arg_5", ".", "rindex", "(", "\".\"", "+", "arg_8", ")", "arg_10", "=", "arg_5", "[", ":", "arg_9", "]", "if", "\".\"", "not", "in", "arg_10", "and", "arg_2", ":", "return", "False", "if", "\".\"", "in", "arg_10", "and", "arg_2", ":", "return", "True", "if", "\".\"", "in", "arg_10", ":", "return", "Regex", "(", "arg_10", ",", "arg_4", ",", "return_data", "=", "False", ")", ".", "match", "(", ")", "except", "ValueError", ":", "pass", "arg_10", "=", "arg_5", "[", ":", "arg_6", "]", "if", "\".\"", "in", "arg_10", "and", "arg_2", ":", "return", "True", "if", "\".\"", "in", "arg_10", ":", "return", "Regex", "(", "arg_10", ",", "arg_4", ",", "return_data", "=", "False", ")", ".", "match", "(", ")", "except", "(", "ValueError", ",", "AttributeError", ")", ":", "pass", "return", "False"], "function": "def Func(\n        arg_0, arg_1=None, arg_2=False\n    ):  # pylint:disable=too-many-return-statements, too-many-branches\n        \"\"\"\n        Check if the given domain is a valid.\n\n        :param domain: The domain to validate.\n        :type domain: str\n\n        :param subdomain_check:\n            Activate the subdomain checking.\n        :type subdomain_check: bool\n\n        :return: The validity of the sub-domain.\n        :rtype: bool\n        \"\"\"\n\n        # We initate our regex which will match for valid domains.\n        arg_3 = r\"^(?=.{0,253}$)(([a-z0-9][a-z0-9-]{0,61}[a-z0-9]|[a-z0-9])\\.)+((?=.*[^0-9])([a-z0-9][a-z0-9-]{0,61}[a-z0-9](?:\\.)?|[a-z0-9](?:\\.)?))$\"  # pylint: disable=line-too-long\n\n        # We initiate our regex which will match for valid subdomains.\n        arg_4 = r\"^(?=.{0,253}$)(([a-z0-9_][a-z0-9-_]{0,61}[a-z0-9_-]|[a-z0-9])\\.)+((?=.*[^0-9])([a-z0-9][a-z0-9-]{0,61}[a-z0-9]|[a-z0-9]))$\"  # pylint: disable=line-too-long\n\n        if arg_1:\n            # A domain is given.\n\n            # We set the element to test as the parsed domain.\n            arg_5 = arg_1\n        elif arg_0.element:\n            # A domain is globally given.\n\n            # We set the globally parsed domain.\n            arg_5 = arg_0.element\n        else:\n            # A domain is not given.\n\n            # We set the element to test as the currently tested element.\n            arg_5 = PyFunceble.INTERN[\"to_test\"]\n\n        try:\n            # We get the position of the last point.\n            arg_6 = arg_5.rindex(\".\")\n            # And with the help of the position of the last point, we get the domain extension.\n            arg_7 = arg_5[arg_6 + 1 :]\n\n            if not arg_7 and arg_5.endswith(\".\"):\n                try:\n                    arg_7 = [x for x in arg_5.split(\".\") if x][-1]\n                except IndexError:\n                    pass\n\n            if not arg_7 or arg_7 not in PyFunceble.INTERN[\"iana_db\"]:\n                # * The extension is not found.\n                # or\n                # * The extension is not into the IANA database.\n\n                # We return false.\n                return False\n\n            if (\n                Regex(arg_5, arg_3, return_data=False).match()\n                and not arg_2\n            ):\n                # * The element pass the domain validation.\n                # and\n                # * We are not checking if it is a subdomain.\n\n                # We return True. The domain is valid.\n                return True\n\n            # The element did not pass the domain validation. That means that\n            # it has invalid character or the position of - or _ are not right.\n\n            if arg_7 in PyFunceble.INTERN[\"psl_db\"]:\n                # The extension is into the psl database.\n\n                for arg_8 in PyFunceble.INTERN[\"psl_db\"][arg_7]:\n                    # We loop through the element of the extension into the psl database.\n\n                    try:\n                        # We try to get the position of the currently read suffix\n                        # in the element ot test.\n                        arg_9 = arg_5.rindex(\".\" + arg_8)\n\n                        # We get the element to check.\n                        # The idea here is to delete the suffix, then retest with our\n                        # subdomains regex.\n                        arg_10 = arg_5[:arg_9]\n\n                        if \".\" not in arg_10 and arg_2:\n                            # * There is no point into the new element to check.\n                            # and\n                            # * We are checking if it is a subdomain.\n\n                            # We return False, it is not a subdomain.\n                            return False\n\n                        if \".\" in arg_10 and arg_2:\n                            # * There is a point into the new element to check.\n                            # and\n                            # * We are checking if it is a subdomain.\n\n                            # We return True, it is a subdomain.\n                            return True\n\n                        # We are not checking if it is a subdomain.\n\n                        if \".\" in arg_10:\n                            # There is a point into the new element to check.\n\n                            # We check if it passes our subdomain regex.\n                            # * True: It's a valid domain.\n                            # * False: It's an invalid domain.\n                            return Regex(\n                                arg_10, arg_4, return_data=False\n                            ).match()\n\n                    except ValueError:\n                        # In case of a value error because the position is not found,\n                        # we continue to the next element.\n                        pass\n\n            # * The extension is not into the psl database.\n            # or\n            # * there was no point into the suffix checking.\n\n            # We get the element before the last point.\n            arg_10 = arg_5[:arg_6]\n\n            if \".\" in arg_10 and arg_2:\n                # * There is a point in to_check.\n                # and\n                # * We are checking if it is a subdomain.\n\n                # We return True, it is a subdomain.\n                return True\n\n            # We are not checking if it is a subdomain.\n\n            if \".\" in arg_10:\n                # There is a point in to_check.\n\n                # We check if it passes our subdomain regex.\n                # * True: It's a valid domain.\n                # * False: It's an invalid domain.\n                return Regex(\n                    arg_10, arg_4, return_data=False\n                ).match()\n\n        except (ValueError, AttributeError):\n            # In case of a value or attribute error we ignore them.\n            pass\n\n        # And we return False, the domain is not valid.\n        return False", "path": "PyFunceble/check.py", "identifier": "Check.is_domain_valid", "docstring": "Check if the given domain is a valid.\n\n        :param domain: The domain to validate.\n        :type domain: str\n\n        :param subdomain_check:\n            Activate the subdomain checking.\n        :type subdomain_check: bool\n\n        :return: The validity of the sub-domain.\n        :rtype: bool", "docstring_tokens": ["Check", "if", "the", "given", "domain", "is", "a", "valid", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 254997}
{"url": "https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L258-L274", "sha": "986c4b1315d6b128947c3bc3494513d8e5380ff0", "docstring_summary": "Provides a connection string for database as a sqlalchemy compatible URL.", "language": "python", "parameters": "(self, name=None)", "return_statement": "return 'postgresql://{user}@{host}:{port}/{dbname}'.format(**{k: v for k, v in self._connect_options(name)})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "'postgresql://{user}@{host}:{port}/{dbname}'", ".", "format", "(", "**", "{", "arg_2", ":", "arg_3", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "_connect_options", "(", "arg_1", ")", "}", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Provides a connection string for database as a sqlalchemy compatible URL.\n\n        NB - this doesn't include special arguments related to SSL connectivity (which are outside the scope\n        of the connection URL format).\n\n        Parameters\n        ----------\n        name: str, optional\n            an override database name for the connection string.\n\n        Returns\n        -------\n        str: the connection URL (e.g. postgresql://user1@localhost:5432/db1)\n            \"\"\"\n        return 'postgresql://{user}@{host}:{port}/{dbname}'.format(**{arg_2: arg_3 for arg_2, arg_3 in arg_0._connect_options(arg_1)})", "path": "pydba/postgres.py", "identifier": "PostgresDB.connection_url", "docstring": "Provides a connection string for database as a sqlalchemy compatible URL.\n\n        NB - this doesn't include special arguments related to SSL connectivity (which are outside the scope\n        of the connection URL format).\n\n        Parameters\n        ----------\n        name: str, optional\n            an override database name for the connection string.\n\n        Returns\n        -------\n        str: the connection URL (e.g. postgresql://user1@localhost:5432/db1)", "docstring_tokens": ["Provides", "a", "connection", "string", "for", "database", "as", "a", "sqlalchemy", "compatible", "URL", "."], "nwo": "drkjam/pydba", "score": 0.138843686048881, "idx": 254998}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L100-L106", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Count var define by this scope", "language": "python", "parameters": "(self)", "return_statement": "return n", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "int", ":", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ".", "_hsig", ".", "values", "(", ")", ":", "if", "hasattr", "(", "arg_2", ",", "'is_var'", ")", "and", "arg_2", ".", "is_var", ":", "arg_1", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0) -> int:\n        \"\"\" Count var define by this scope \"\"\"\n        arg_1 = 0\n        for arg_2 in arg_0._hsig.values():\n            if hasattr(arg_2, 'is_var') and arg_2.is_var:\n                arg_1 += 1\n        return arg_1", "path": "pyrser/type_system/scope.py", "identifier": "Scope.count_vars", "docstring": "Count var define by this scope", "docstring_tokens": ["Count", "var", "define", "by", "this", "scope"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 254999}
{"url": "https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/config.py#L10-L31", "sha": "8e17ebec509be5c3cc2063f4645dfe9e26b49c18", "docstring_summary": "Callable to configure Bokeh's show method when a proxy must be\n    configured.", "language": "python", "parameters": "(port)", "return_statement": "return full_url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "environ", "[", "'EXTERNAL_URL'", "]", "arg_2", "=", "urllib", ".", "parse", ".", "urlparse", "(", "arg_1", ")", ".", "netloc", "if", "arg_0", "is", "None", ":", "return", "arg_2", "arg_3", "=", "os", ".", "environ", "[", "'JUPYTERHUB_SERVICE_PREFIX'", "]", "arg_4", "=", "'proxy/%d'", "%", "arg_0", "arg_5", "=", "urllib", ".", "parse", ".", "urljoin", "(", "arg_1", ",", "arg_3", ")", "arg_6", "=", "urllib", ".", "parse", ".", "urljoin", "(", "arg_5", ",", "arg_4", ")", "return", "arg_6"], "function": "def Func(arg_0):\n    \"\"\"\n    Callable to configure Bokeh's show method when a proxy must be\n    configured.\n\n    If port is None we're asking about the URL\n    for the origin header.\n    \"\"\"\n    arg_1 = os.environ['EXTERNAL_URL']\n    arg_2 = urllib.parse.urlparse(arg_1).netloc\n\n    # If port is None we're asking for the URL origin\n    # so return the public hostname.\n    if arg_0 is None:\n        return arg_2\n\n    arg_3 = os.environ['JUPYTERHUB_SERVICE_PREFIX']\n    arg_4 = 'proxy/%d' % arg_0\n\n    arg_5 = urllib.parse.urljoin(arg_1, arg_3)\n    arg_6 = urllib.parse.urljoin(arg_5, arg_4)\n    return arg_6", "path": "astropixie-widgets/astropixie_widgets/config.py", "identifier": "remote_jupyter_proxy_url", "docstring": "Callable to configure Bokeh's show method when a proxy must be\n    configured.\n\n    If port is None we're asking about the URL\n    for the origin header.", "docstring_tokens": ["Callable", "to", "configure", "Bokeh", "s", "show", "method", "when", "a", "proxy", "must", "be", "configured", "."], "nwo": "lsst-epo/vela", "score": 0.15726537023232431, "idx": 255000}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L101-L131", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Get the distance along a shape between stops", "language": "python", "parameters": "(self, trip_I, from_stop_seq, to_stop_seq)", "return_statement": "return self.conn.execute(distance_query).fetchone()[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "\"SELECT shape_break FROM stop_times WHERE trip_I={trip_I} AND seq={seq} \"", "arg_5", "=", "[", "arg_2", ",", "arg_3", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_5", ":", "arg_8", "=", "arg_4", ".", "format", "(", "arg_7", "=", "arg_7", ",", "arg_1", "=", "arg_1", ")", "arg_6", ".", "append", "(", "arg_0", ".", "conn", ".", "execute", "(", "arg_8", ")", ".", "fetchone", "(", ")", ")", "arg_4", "=", "\"SELECT max(d) - min(d) \"", "\"FROM shapes JOIN trips ON(trips.shape_id=shapes.shape_id) \"", "\"WHERE trip_I={trip_I} AND shapes.seq>={from_stop_seq} AND shapes.seq<={to_stop_seq};\"", "arg_9", "=", "arg_4", ".", "format", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "arg_0", ".", "conn", ".", "execute", "(", "arg_9", ")", ".", "fetchone", "(", ")", "[", "0", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Get the distance along a shape between stops\n\n        Parameters\n        ----------\n        trip_I : int\n            trip_ID along which we travel\n        from_stop_seq : int\n            the sequence number of the 'origin' stop\n        to_stop_seq : int\n            the sequence number of the 'destination' stop\n\n        Returns\n        -------\n        distance : float, None\n            If the shape calculation succeeded, return a float, otherwise return None\n            (i.e. in the case where the shapes table is empty)\n        \"\"\"\n\n        arg_4 = \"SELECT shape_break FROM stop_times WHERE trip_I={trip_I} AND seq={seq} \"\n        arg_5 = [arg_2, arg_3]\n        arg_6 = []\n        for arg_7 in arg_5:\n            arg_8 = arg_4.format(arg_7=arg_7, arg_1=arg_1)\n            arg_6.append(arg_0.conn.execute(arg_8).fetchone())\n        arg_4 = \"SELECT max(d) - min(d) \" \\\n                         \"FROM shapes JOIN trips ON(trips.shape_id=shapes.shape_id) \" \\\n                         \"WHERE trip_I={trip_I} AND shapes.seq>={from_stop_seq} AND shapes.seq<={to_stop_seq};\"\n        arg_9 = arg_4.format(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)\n        return arg_0.conn.execute(arg_9).fetchone()[0]", "path": "gtfspy/gtfs.py", "identifier": "GTFS.get_shape_distance_between_stops", "docstring": "Get the distance along a shape between stops\n\n        Parameters\n        ----------\n        trip_I : int\n            trip_ID along which we travel\n        from_stop_seq : int\n            the sequence number of the 'origin' stop\n        to_stop_seq : int\n            the sequence number of the 'destination' stop\n\n        Returns\n        -------\n        distance : float, None\n            If the shape calculation succeeded, return a float, otherwise return None\n            (i.e. in the case where the shapes table is empty)", "docstring_tokens": ["Get", "the", "distance", "along", "a", "shape", "between", "stops"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 255001}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L100-L134", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "List projects.", "language": "python", "parameters": "(page)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "AuthConfigManager", ".", "get_value", "(", "'username'", ")", "if", "not", "arg_1", ":", "Printer", ".", "print_error", "(", "'Please login first. `polyaxon login --help`'", ")", "arg_0", "=", "arg_0", "or", "1", "try", ":", "arg_2", "=", "PolyaxonClient", "(", ")", ".", "project", ".", "Func_projects", "(", "arg_1", ",", "arg_0", "=", "arg_0", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not get Func of projects.'", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "arg_3", "=", "get_meta_response", "(", "arg_2", ")", "if", "arg_3", ":", "Printer", ".", "print_header", "(", "'Projects for current user'", ")", "Printer", ".", "print_header", "(", "'Navigation:'", ")", "dict_tabulate", "(", "arg_3", ")", "else", ":", "Printer", ".", "print_header", "(", "'No projects found for current user'", ")", "arg_4", "=", "Func_dicts_to_tabulate", "(", "[", "o", ".", "to_light_dict", "(", "humanize_values", "=", "True", ",", "exclude_attrs", "=", "[", "'uuid'", ",", "'experiment_groups'", ",", "'experiments'", ",", "'description'", ",", "'num_experiments'", ",", "'num_independent_experiments'", ",", "'num_experiment_groups'", ",", "'num_jobs'", ",", "'num_builds'", ",", "'unique_name'", "]", ")", "for", "o", "in", "arg_2", "[", "'results'", "]", "]", ")", "if", "arg_4", ":", "Printer", ".", "print_header", "(", "\"Projects:\"", ")", "dict_tabulate", "(", "arg_4", ",", "is_Func_dict", "=", "True", ")"], "function": "def Func(arg_0):  # pylint:disable=redefined-builtin\n    \"\"\"List projects.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n    \"\"\"\n    arg_1 = AuthConfigManager.get_value('username')\n    if not arg_1:\n        Printer.print_error('Please login first. `polyaxon login --help`')\n\n    arg_0 = arg_0 or 1\n    try:\n        arg_2 = PolyaxonClient().project.Func_projects(arg_1, arg_0=arg_0)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not get Func of projects.')\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    arg_3 = get_meta_response(arg_2)\n    if arg_3:\n        Printer.print_header('Projects for current user')\n        Printer.print_header('Navigation:')\n        dict_tabulate(arg_3)\n    else:\n        Printer.print_header('No projects found for current user')\n\n    arg_4 = Func_dicts_to_tabulate(\n        [o.to_light_dict(\n            humanize_values=True,\n            exclude_attrs=['uuid', 'experiment_groups', 'experiments', 'description',\n                           'num_experiments', 'num_independent_experiments',\n                           'num_experiment_groups', 'num_jobs', 'num_builds', 'unique_name'])\n            for o in arg_2['results']])\n    if arg_4:\n        Printer.print_header(\"Projects:\")\n        dict_tabulate(arg_4, is_Func_dict=True)", "path": "polyaxon_cli/cli/project.py", "identifier": "list", "docstring": "List projects.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)", "docstring_tokens": ["List", "projects", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 255002}
{"url": "https://github.com/uploadcare/pyuploadcare/blob/cefddc0306133a71e37b18e8700df5948ef49b37/pyuploadcare/ucare_cli/__init__.py#L38-L59", "sha": "cefddc0306133a71e37b18e8700df5948ef49b37", "docstring_summary": "A common function for building methods of the \"list showing\".", "language": "python", "parameters": "(api_list_class, arg_namespace, **extra)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_1", ".", "starting_point", ":", "arg_3", "=", "(", "arg_1", ".", "ordering", "or", "''", ")", ".", "lstrip", "(", "'-'", ")", "if", "arg_3", "in", "(", "''", ",", "'datetime_uploaded'", ",", "'datetime_created'", ")", ":", "arg_1", ".", "starting_point", "=", "parser", ".", "parse", "(", "arg_1", ".", "starting_point", ")", "arg_5", "=", "arg_0", "(", "arg_4", "=", "arg_1", ".", "starting_point", ",", "ordering", "=", "arg_1", ".", "ordering", ",", "limit", "=", "arg_1", ".", "limit", ",", "request_limit", "=", "arg_1", ".", "request_limit", ",", "**", "arg_2", ")", "arg_5", ".", "constructor", "=", "lambda", "x", ":", "x", "try", ":", "pprint", "(", "list", "(", "arg_5", ")", ")", "except", "ValueError", "as", "e", ":", "print", "(", "e", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\" A common function for building methods of the \"list showing\".\n    \"\"\"\n    if arg_1.starting_point:\n        arg_3 = (arg_1.ordering or '').lstrip('-')\n        if arg_3 in ('', 'datetime_uploaded', 'datetime_created'):\n            arg_1.starting_point = parser.parse(\n                arg_1.starting_point)\n\n    arg_5 = arg_0(\n        arg_4=arg_1.starting_point,\n        ordering=arg_1.ordering,\n        limit=arg_1.limit,\n        request_limit=arg_1.request_limit,\n        **arg_2\n    )\n    arg_5.constructor = lambda x: x\n\n    try:\n        pprint(list(arg_5))\n    except ValueError as e:\n        print(e)", "path": "pyuploadcare/ucare_cli/__init__.py", "identifier": "_list", "docstring": "A common function for building methods of the \"list showing\".", "docstring_tokens": ["A", "common", "function", "for", "building", "methods", "of", "the", "list", "showing", "."], "nwo": "uploadcare/pyuploadcare", "score": 0.289876796890331, "idx": 255003}
{"url": "https://github.com/quantmind/pulsar-cloud/blob/dc2ff8ab5c9a1c2cfb1270581d30454d1a606cf9/cloud/utils/s3.py#L239-L260", "sha": "dc2ff8ab5c9a1c2cfb1270581d30454d1a606cf9", "docstring_summary": "Coroutine for uploading a single file", "language": "python", "parameters": "(self, full_path)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "relpath", "(", "arg_1", ",", "arg_0", ".", "folder", ")", "arg_3", "=", "s3_key", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "key", ",", "arg_2", ")", ")", "arg_4", "=", "arg_0", ".", "content_types", ".", "get", "(", "arg_3", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "fp", ":", "arg_5", "=", "fp", ".", "read", "(", ")", "try", ":", "await", "arg_0", ".", "botocore", ".", "upload_file", "(", "arg_0", ".", "bucket", ",", "arg_5", ",", "arg_3", "=", "arg_3", ",", "ContentType", "=", "arg_4", ")", "except", "Exception", "as", "exc", ":", "LOGGER", ".", "error", "(", "'Could not upload \"%s\": %s'", ",", "arg_3", ",", "exc", ")", "arg_0", ".", "failures", "[", "arg_3", "]", "=", "arg_0", ".", "all", ".", "pop", "(", "arg_1", ")", "return", "arg_7", "=", "arg_0", ".", "all", ".", "pop", "(", "arg_1", ")", "arg_0", ".", "success", "[", "arg_3", "]", "=", "arg_7", "arg_0", ".", "total_size", "+=", "arg_7", "arg_9", "=", "100", "*", "(", "1", "-", "len", "(", "arg_0", ".", "all", ")", "/", "arg_0", ".", "total_files", ")", "arg_10", "=", "'{0:.0f}% completed - uploaded \"{1}\" - {2}'", ".", "format", "(", "arg_9", ",", "arg_3", ",", "convert_bytes", "(", "arg_7", ")", ")", "LOGGER", ".", "info", "(", "arg_10", ")"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Coroutine for uploading a single file\n        \"\"\"\n        arg_2 = os.path.relpath(arg_1, arg_0.folder)\n        arg_3 = s3_key(os.path.join(arg_0.key, arg_2))\n        arg_4 = arg_0.content_types.get(arg_3.split('.')[-1])\n        with open(arg_1, 'rb') as fp:\n            arg_5 = fp.read()\n        try:\n            await arg_0.botocore.upload_file(arg_0.bucket, arg_5, arg_3=arg_3,\n                                            ContentType=arg_4)\n        except Exception as exc:\n            LOGGER.error('Could not upload \"%s\": %s', arg_3, exc)\n            arg_0.failures[arg_3] = arg_0.all.pop(arg_1)\n            return\n        arg_7 = arg_0.all.pop(arg_1)\n        arg_0.success[arg_3] = arg_7\n        arg_0.total_size += arg_7\n        arg_9 = 100*(1 - len(arg_0.all)/arg_0.total_files)\n        arg_10 = '{0:.0f}% completed - uploaded \"{1}\" - {2}'.format(\n            arg_9, arg_3, convert_bytes(arg_7))\n        LOGGER.info(arg_10)", "path": "cloud/utils/s3.py", "identifier": "FolderUploader._upload_file", "docstring": "Coroutine for uploading a single file", "docstring_tokens": ["Coroutine", "for", "uploading", "a", "single", "file"], "nwo": "quantmind/pulsar-cloud", "score": 0.18657722465184873, "idx": 255004}
{"url": "https://github.com/ONSdigital/sdc-cryptography/blob/846feb2b27b1c62d35ff2c290c05abcead68b23c/sdc/crypto/decrypter.py#L6-L25", "sha": "846feb2b27b1c62d35ff2c290c05abcead68b23c", "docstring_summary": "This decrypts the provided jwe token, then decodes resulting jwt token and returns\n    the payload.", "language": "python", "parameters": "(token, key_store, key_purpose, leeway=120)", "return_statement": "return payload", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "120", ")", ":", "arg_4", "=", "arg_0", ".", "split", "(", "'.'", ")", "if", "len", "(", "arg_4", ")", "!=", "5", ":", "raise", "InvalidTokenException", "(", "\"Incorrect number of tokens\"", ")", "arg_5", "=", "JWEHelper", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "JWTHelper", ".", "decode", "(", "arg_5", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=120):\n    \"\"\"This Funcs the provided jwe token, then decodes resulting jwt token and returns\n    the payload.\n\n    :param str token: The jwe token.\n    :param key_store: The key store.\n    :param str key_purpose: Context for the key.\n    :param int leeway: Extra allowed time in seconds after expiration to account for clock skew.\n    :return: The Funced payload.\n\n    \"\"\"\n    arg_4 = arg_0.split('.')\n    if len(arg_4) != 5:\n        raise InvalidTokenException(\"Incorrect number of tokens\")\n\n    arg_5 = JWEHelper.Func(arg_0, arg_1, arg_2)\n\n    arg_6 = JWTHelper.decode(arg_5, arg_1, arg_2, arg_3)\n\n    return arg_6", "path": "sdc/crypto/decrypter.py", "identifier": "decrypt", "docstring": "This decrypts the provided jwe token, then decodes resulting jwt token and returns\n    the payload.\n\n    :param str token: The jwe token.\n    :param key_store: The key store.\n    :param str key_purpose: Context for the key.\n    :param int leeway: Extra allowed time in seconds after expiration to account for clock skew.\n    :return: The decrypted payload.", "docstring_tokens": ["This", "decrypts", "the", "provided", "jwe", "token", "then", "decodes", "resulting", "jwt", "token", "and", "returns", "the", "payload", "."], "nwo": "ONSdigital/sdc-cryptography", "score": 0.3588333959790546, "idx": 255005}
{"url": "https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/build.py#L358-L373", "sha": "b7ad20fe8e7137db99a20ac06b8da26492601b00", "docstring_summary": "For the parallel topo sort to work, the targets have\n    to be executed in layers such that there is no\n    dependency relationship between any nodes in a layer.\n    What is returned is a list of lists representing all\n    the layers, or levels", "language": "python", "parameters": "(G)", "return_statement": "return levels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "get_sinks", "(", "arg_0", ")", "arg_1", ".", "append", "(", "arg_2", ")", "while", "get_direct_ancestors", "(", "arg_0", ",", "arg_2", ")", ":", "arg_2", "=", "get_direct_ancestors", "(", "arg_0", ",", "arg_2", ")", "arg_1", ".", "append", "(", "arg_2", ")", "arg_1", ".", "reverse", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    For the parallel topo sort to work, the targets have\n    to be executed in layers such that there is no\n    dependency relationship between any nodes in a layer.\n    What is returned is a list of lists representing all\n    the layers, or levels\n    \"\"\"\n    arg_1 = []\n    arg_2 = get_sinks(arg_0)\n    arg_1.append(arg_2)\n    while get_direct_ancestors(arg_0, arg_2):\n        arg_2 = get_direct_ancestors(arg_0, arg_2)\n        arg_1.append(arg_2)\n    arg_1.reverse()\n    return arg_1", "path": "sakelib/build.py", "identifier": "get_levels", "docstring": "For the parallel topo sort to work, the targets have\n    to be executed in layers such that there is no\n    dependency relationship between any nodes in a layer.\n    What is returned is a list of lists representing all\n    the layers, or levels", "docstring_tokens": ["For", "the", "parallel", "topo", "sort", "to", "work", "the", "targets", "have", "to", "be", "executed", "in", "layers", "such", "that", "there", "is", "no", "dependency", "relationship", "between", "any", "nodes", "in", "a", "layer", ".", "What", "is", "returned", "is", "a", "list", "of", "lists", "representing", "all", "the", "layers", "or", "levels"], "nwo": "tonyfischetti/sake", "score": 0.3086509652907828, "idx": 255006}
{"url": "https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/net.py#L235-L251", "sha": "3dc6ad803f0b0d56586dec9542a6a06aa06cf569", "docstring_summary": "Insert a new rule in the chain", "language": "python", "parameters": "(self, chain, src=None, dest=None, target=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "not", "arg_1", ":", "raise", "ValueError", "(", "\"Invalid chain\"", ")", "if", "not", "arg_4", ":", "raise", "ValueError", "(", "\"Invalid target\"", ")", "if", "not", "(", "arg_2", "or", "arg_3", ")", ":", "raise", "ValueError", "(", "\"Need src, dest, or both\"", ")", "arg_5", "=", "[", "\"-I\"", ",", "arg_1", "]", "if", "arg_2", ":", "arg_5", "+=", "[", "\"-s\"", ",", "arg_2", "]", "if", "arg_3", ":", "arg_5", "+=", "[", "\"-d\"", ",", "arg_3", "]", "arg_5", "+=", "[", "\"-j\"", ",", "arg_4", "]", "arg_0", ".", "call", "(", "*", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"Insert a new rule in the chain\n        \"\"\"\n        if not arg_1:\n            raise ValueError(\"Invalid chain\")\n        if not arg_4:\n            raise ValueError(\"Invalid target\")\n        if not (arg_2 or arg_3):\n            raise ValueError(\"Need src, dest, or both\")\n\n        arg_5 = [\"-I\", arg_1]\n        if arg_2:\n            arg_5 += [\"-s\", arg_2]\n        if arg_3:\n            arg_5 += [\"-d\", arg_3]\n        arg_5 += [\"-j\", arg_4]\n        arg_0.call(*arg_5)", "path": "blockade/net.py", "identifier": "_IPTables.insert_rule", "docstring": "Insert a new rule in the chain", "docstring_tokens": ["Insert", "a", "new", "rule", "in", "the", "chain"], "nwo": "worstcase/blockade", "score": 0.7770804820985606, "idx": 255007}
{"url": "https://github.com/Lucretiel/Dispatch/blob/dffbce6bacb4370c4ecd11652e5ba8a6aaf2b5b4/dispatching.py#L34-L47", "sha": "dffbce6bacb4370c4ecd11652e5ba8a6aaf2b5b4", "docstring_summary": "Attempt to bind the args to the type signature. First try to just bind\n        to the signature, then ensure that all arguments match the parameter\n        types.", "language": "python", "parameters": "(sig, param_matchers, args, kwargs)", "return_statement": "return bound", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "bind", "(", "*", "arg_2", ",", "**", "arg_3", ")", "if", "not", "all", "(", "arg_6", "(", "arg_4", ".", "arguments", "[", "arg_5", "]", ")", "for", "arg_5", ",", "arg_6", "in", "arg_1", ")", ":", "raise", "TypeError", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''\n        Attempt to bind the args to the type signature. First try to just bind\n        to the signature, then ensure that all arguments match the parameter\n        types.\n        '''\n        #Bind to signature. May throw its own TypeError\n        arg_4 = arg_0.bind(*arg_2, **arg_3)\n\n        if not all(arg_6(arg_4.arguments[arg_5])\n                for arg_5, arg_6 in arg_1):\n            raise TypeError\n\n        return arg_4", "path": "dispatching.py", "identifier": "DispatchGroup._bind_args", "docstring": "Attempt to bind the args to the type signature. First try to just bind\n        to the signature, then ensure that all arguments match the parameter\n        types.", "docstring_tokens": ["Attempt", "to", "bind", "the", "args", "to", "the", "type", "signature", ".", "First", "try", "to", "just", "bind", "to", "the", "signature", "then", "ensure", "that", "all", "arguments", "match", "the", "parameter", "types", "."], "nwo": "Lucretiel/Dispatch", "score": 0.18190671880906387, "idx": 255008}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/validation/base.py#L45-L68", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Validates a value against the correct type of the field.", "language": "python", "parameters": "(self, value, attr, data)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_expected_types", "(", ")", "if", "not", "isinstance", "(", "arg_1", ",", "arg_4", ")", ":", "raise", "arg_0", ".", "_not_expected_type", "(", "arg_1", ",", "arg_4", ",", "fields", "=", "[", "arg_0", "]", ",", "field_names", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Validates a value against the correct type of the field.\n\n        It calls ``_expected_types`` to get a list of valid types.\n\n        Subclasses can do one of the following:\n\n            1. They can override the ``valid_types`` property with a tuple with\n            the expected types for this field.\n\n            2. They can override the ``_expected_types`` method to return a\n            tuple of expected types for the field.\n\n            3. They can change ``Func`` completely to customize\n            validation.\n\n        This method or the overrides must return the ``value`` parameter\n        untouched.\n        \"\"\"\n        arg_4 = arg_0._expected_types()\n        if not isinstance(arg_1, arg_4):\n            raise arg_0._not_expected_type(\n                arg_1, arg_4, fields=[arg_0], field_names=arg_2, arg_3=arg_3)\n        return arg_1", "path": "qiskit/validation/base.py", "identifier": "ModelTypeValidator.check_type", "docstring": "Validates a value against the correct type of the field.\n\n        It calls ``_expected_types`` to get a list of valid types.\n\n        Subclasses can do one of the following:\n\n            1. They can override the ``valid_types`` property with a tuple with\n            the expected types for this field.\n\n            2. They can override the ``_expected_types`` method to return a\n            tuple of expected types for the field.\n\n            3. They can change ``check_type`` completely to customize\n            validation.\n\n        This method or the overrides must return the ``value`` parameter\n        untouched.", "docstring_tokens": ["Validates", "a", "value", "against", "the", "correct", "type", "of", "the", "field", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255009}
{"url": "https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/plugins/base_plugin.py#L22-L30", "sha": "cd4d06857c88291769bc38e5c9573f43b7ffcd6a", "docstring_summary": "Generates a random token, using the url-safe base64 alphabet.\n        The \"bits\" argument specifies the bits of randomness to use.", "language": "python", "parameters": "(self, bits=128)", "return_statement": "return ''.join(random.choice(alphabet) for i in range(num_letters))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "128", ")", ":", "arg_2", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", "+", "'-_'", "arg_3", "=", "int", "(", "math", ".", "ceil", "(", "arg_1", "/", "6.0", ")", ")", "return", "''", ".", "join", "(", "random", ".", "choice", "(", "arg_2", ")", "for", "arg_4", "in", "range", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1=128):\n        \"\"\"\n        Generates a random token, using the url-safe base64 alphabet.\n        The \"bits\" argument specifies the bits of randomness to use.\n        \"\"\"\n        arg_2 = string.ascii_letters + string.digits + '-_'\n        # alphabet length is 64, so each letter provides lg(64) = 6 bits\n        arg_3 = int(math.ceil(arg_1 / 6.0))\n        return ''.join(random.choice(arg_2) for arg_4 in range(arg_3))", "path": "nosedjango/plugins/base_plugin.py", "identifier": "Plugin._random_token", "docstring": "Generates a random token, using the url-safe base64 alphabet.\n        The \"bits\" argument specifies the bits of randomness to use.", "docstring_tokens": ["Generates", "a", "random", "token", "using", "the", "url", "-", "safe", "base64", "alphabet", ".", "The", "bits", "argument", "specifies", "the", "bits", "of", "randomness", "to", "use", "."], "nwo": "nosedjango/nosedjango", "score": 0.27365494979801214, "idx": 255010}
{"url": "https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_base.py#L151-L166", "sha": "1a1ba9758651aed9c4f58384eff006d2e2ad6835", "docstring_summary": "The inverse of this bidict.", "language": "python", "parameters": "(self)", "return_statement": "return self._inv", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_inv", "is", "not", "None", ":", "return", "arg_0", ".", "_inv", "arg_1", "=", "arg_0", ".", "_invweak", "(", ")", "if", "arg_1", "is", "not", "None", ":", "return", "arg_1", "arg_0", ".", "_init_inv", "(", ")", "return", "arg_0", ".", "_inv"], "function": "def Func(arg_0):\n        \"\"\"The Func of this bidict.\n\n        *See also* :attr:`inv`\n        \"\"\"\n        # Resolve and return a strong reference to the Func bidict.\n        # One may be stored in self._inv already.\n        if arg_0._inv is not None:\n            return arg_0._inv\n        # Otherwise a weakref is stored in self._invweak. Try to get a strong ref from it.\n        arg_1 = arg_0._invweak()\n        if arg_1 is not None:\n            return arg_1\n        # Refcount of referent must have dropped to zero, as in `bidict().inv.inv`. Init a new one.\n        arg_0._init_inv()  # Now this bidict will retain a strong ref to its Func.\n        return arg_0._inv", "path": "bidict/_base.py", "identifier": "BidictBase.inverse", "docstring": "The inverse of this bidict.\n\n        *See also* :attr:`inv`", "docstring_tokens": ["The", "inverse", "of", "this", "bidict", "."], "nwo": "jab/bidict", "score": 0.5840682608785344, "idx": 255011}
{"url": "https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/listener.py#L71-L93", "sha": "0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b", "docstring_summary": "Execute this device", "language": "python", "parameters": "(self, root_allowed=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "logger", ".", "debug", "(", "'%s device Funcd (mac %s)'", ",", "arg_0", ".", "name", ",", "arg_0", ".", "src", ")", "if", "not", "arg_0", ".", "Func_instance", ":", "arg_2", "=", "'%s: There is not execution method in device conf.'", "logger", ".", "warning", "(", "arg_2", ",", "arg_0", ".", "name", ")", "arg_0", ".", "send_confirmation", "(", "arg_2", "%", "arg_0", ".", "name", ",", "False", ")", "return", "try", ":", "arg_3", "=", "arg_0", ".", "Func_instance", ".", "Func", "(", "arg_1", ")", "except", "Exception", "as", "e", ":", "arg_0", ".", "send_confirmation", "(", "'Error executing the device {}: {}'", ".", "format", "(", "arg_0", ".", "name", ",", "e", ")", ",", "False", ")", "raise", "else", ":", "arg_3", "=", "'The {} device has been started and is running right now'", ".", "format", "(", "arg_0", ".", "name", ")", "if", "arg_3", "is", "None", "else", "arg_3", "arg_3", "=", "arg_3", "or", "'The {} device has been Funcd successfully'", ".", "format", "(", "arg_0", ".", "name", ")", "arg_0", ".", "send_confirmation", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Execute this device\n\n        :param bool root_allowed: Only used for ExecuteCmd\n        :return: None\n        \"\"\"\n        logger.debug('%s device Funcd (mac %s)', arg_0.name, arg_0.src)\n        if not arg_0.Func_instance:\n            arg_2 = '%s: There is not execution method in device conf.'\n            logger.warning(arg_2, arg_0.name)\n            arg_0.send_confirmation(arg_2 % arg_0.name, False)\n            return\n        try:\n            arg_3 = arg_0.Func_instance.Func(arg_1)\n        except Exception as e:\n            arg_0.send_confirmation('Error executing the device {}: {}'.format(arg_0.name, e), False)\n            raise\n        else:\n            arg_3 = 'The {} device has been started and is running right now'.format(arg_0.name) \\\n                if arg_3 is None else arg_3\n            arg_3 = arg_3 or 'The {} device has been Funcd successfully'.format(arg_0.name)\n            arg_0.send_confirmation(arg_3)\n        return arg_3", "path": "amazon_dash/listener.py", "identifier": "Device.execute", "docstring": "Execute this device\n\n        :param bool root_allowed: Only used for ExecuteCmd\n        :return: None", "docstring_tokens": ["Execute", "this", "device"], "nwo": "Nekmo/amazon-dash", "score": 0.758195400618659, "idx": 255012}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/selector/selector.py#L123-L139", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Returns a decorator function for adding an expression filter.", "language": "python", "parameters": "(self, name, **kwargs)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "def", "decorator", "(", "arg_3", ")", ":", "arg_0", ".", "filters", "[", "arg_1", "]", "=", "ExpressionFilter", "(", "arg_1", ",", "arg_3", ",", "**", "arg_2", ")", "return", "decorator"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Returns a decorator function for adding an expression filter.\n\n        Args:\n            name (str): The name of the filter.\n            **kwargs: Variable keyword arguments for the filter.\n\n        Returns:\n            Callable[[Callable[[AbstractExpression, Any], AbstractExpression]]]: A decorator\n                function for adding an expression filter.\n        \"\"\"\n\n        def decorator(arg_3):\n            arg_0.filters[arg_1] = ExpressionFilter(arg_1, arg_3, **arg_2)\n\n        return decorator", "path": "capybara/selector/selector.py", "identifier": "SelectorFactory.expression_filter", "docstring": "Returns a decorator function for adding an expression filter.\n\n        Args:\n            name (str): The name of the filter.\n            **kwargs: Variable keyword arguments for the filter.\n\n        Returns:\n            Callable[[Callable[[AbstractExpression, Any], AbstractExpression]]]: A decorator\n                function for adding an expression filter.", "docstring_tokens": ["Returns", "a", "decorator", "function", "for", "adding", "an", "expression", "filter", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 255013}
{"url": "https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/semlock.py#L75-L99", "sha": "dc2d941d8285a96f3a5b666a4bd04875b0b25984", "docstring_summary": "Construct or retrieve a semaphore with the given name", "language": "python", "parameters": "(name, value=None)", "return_statement": "return handle", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "pthread", ".", "sem_open", "(", "ctypes", ".", "c_char_p", "(", "arg_0", ")", ",", "0", ")", "else", ":", "arg_2", "=", "pthread", ".", "sem_open", "(", "ctypes", ".", "c_char_p", "(", "arg_0", ")", ",", "SEM_OFLAG", ",", "SEM_PERM", ",", "ctypes", ".", "c_int", "(", "arg_1", ")", ")", "if", "arg_2", "==", "SEM_FAILURE", ":", "arg_3", "=", "ctypes", ".", "get_errno", "(", ")", "if", "arg_3", "==", "errno", ".", "EEXIST", ":", "raise", "FileExistsError", "(", "\"a semaphore named %s already exists\"", "%", "arg_0", ")", "elif", "arg_3", "==", "errno", ".", "ENOENT", ":", "raise", "FileNotFoundError", "(", "'cannot find semaphore named %s'", "%", "arg_0", ")", "elif", "arg_3", "==", "errno", ".", "ENOSYS", ":", "raise", "NotImplementedError", "(", "'No semaphore implementation on this '", "'system'", ")", "else", ":", "raiseFromErrno", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Construct or retrieve a semaphore with the given name\n\n    If value is None, try to retrieve an existing named semaphore.\n    Else create a new semaphore with the given value\n    \"\"\"\n    if arg_1 is None:\n        arg_2 = pthread.sem_open(ctypes.c_char_p(arg_0), 0)\n    else:\n        arg_2 = pthread.sem_open(ctypes.c_char_p(arg_0), SEM_OFLAG, SEM_PERM,\n                                  ctypes.c_int(arg_1))\n\n    if arg_2 == SEM_FAILURE:\n        arg_3 = ctypes.get_errno()\n        if arg_3 == errno.EEXIST:\n            raise FileExistsError(\"a semaphore named %s already exists\" % arg_0)\n        elif arg_3 == errno.ENOENT:\n            raise FileNotFoundError('cannot find semaphore named %s' % arg_0)\n        elif arg_3 == errno.ENOSYS:\n            raise NotImplementedError('No semaphore implementation on this '\n                                      'system')\n        else:\n            raiseFromErrno()\n\n    return arg_2", "path": "loky/backend/semlock.py", "identifier": "_sem_open", "docstring": "Construct or retrieve a semaphore with the given name\n\n    If value is None, try to retrieve an existing named semaphore.\n    Else create a new semaphore with the given value", "docstring_tokens": ["Construct", "or", "retrieve", "a", "semaphore", "with", "the", "given", "name"], "nwo": "tomMoral/loky", "score": 0.572510808364181, "idx": 255014}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L164-L189", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Generator that reads a block of data from the server.", "language": "python", "parameters": "(self, length=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "while", "True", ":", "arg_2", "=", "arg_0", ".", "__buffer", ".", "read", "(", "arg_1", ")", "if", "not", "arg_2", ":", "arg_0", ".", "__recv", "(", ")", "continue", "yield", "arg_2"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"Generator that reads a block of data from the server.\n\n        It first attempts to read from the internal buffer. If there is not\n        enough data in the internal buffer it then requests more data from the\n        server and adds it to the buffer.\n\n        Args:\n            length: An optional amount of data to retrieve. A length of 0 (the\n                default) will retrieve a least one buffer of data.\n\n        Yields:\n            A block of data when enough data becomes available.\n\n        Note:\n            If a length of 0 is supplied then the size of the yielded buffer can\n            vary. If there is data in the internal buffer it will yield all of\n            that data otherwise it will yield the the data returned by a recv\n            on the socket.\n        \"\"\"\n        while True:\n            arg_2 = arg_0.__buffer.read(arg_1)\n            if not arg_2:\n                arg_0.__recv()\n                continue\n            yield arg_2", "path": "nntp/nntp.py", "identifier": "BaseNNTPClient.__buf_gen", "docstring": "Generator that reads a block of data from the server.\n\n        It first attempts to read from the internal buffer. If there is not\n        enough data in the internal buffer it then requests more data from the\n        server and adds it to the buffer.\n\n        Args:\n            length: An optional amount of data to retrieve. A length of 0 (the\n                default) will retrieve a least one buffer of data.\n\n        Yields:\n            A block of data when enough data becomes available.\n\n        Note:\n            If a length of 0 is supplied then the size of the yielded buffer can\n            vary. If there is data in the internal buffer it will yield all of\n            that data otherwise it will yield the the data returned by a recv\n            on the socket.", "docstring_tokens": ["Generator", "that", "reads", "a", "block", "of", "data", "from", "the", "server", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 255015}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L644-L684", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Compute the marginal counts for a subset of measured qubits.", "language": "python", "parameters": "(counts, meas_qubits)", "return_statement": "return dict(zip(meas_keys, meas_counts))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "list", "(", "arg_0", ".", "keys", "(", ")", ")", "[", "0", "]", ")", "arg_3", "=", "sorted", "(", "arg_1", ",", "reverse", "=", "True", ")", "arg_4", "=", "count_keys", "(", "len", "(", "arg_3", ")", ")", "arg_5", "=", "[", "reduce", "(", "lambda", "x", ",", "y", ":", "(", "arg_9", "[", "arg_3", ".", "index", "(", "y", ")", "]", "if", "y", "in", "arg_3", "else", "'\\\\d'", ")", "+", "x", ",", "range", "(", "arg_2", ")", ",", "''", ")", "for", "arg_9", "in", "arg_4", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_5", ":", "arg_8", "=", "0", "for", "arg_9", ",", "arg_10", "in", "arg_0", ".", "items", "(", ")", ":", "if", "match", "(", "arg_7", ",", "arg_9", ")", ":", "arg_8", "+=", "arg_10", "arg_6", ".", "append", "(", "arg_8", ")", "return", "dict", "(", "zip", "(", "arg_4", ",", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Compute the marginal counts for a subset of measured qubits.\n\n    Args:\n        counts (dict): the counts returned from a backend ({str: int}).\n        meas_qubits (list[int]): the qubits to return the marginal\n                                 counts distribution for.\n\n    Returns:\n        dict: A counts dict for the meas_qubits.abs\n        Example: if `counts = {'00': 10, '01': 5}`\n            `Func(counts, [0])` returns `{'0': 15, '1': 0}`.\n            `Func(counts, [0])` returns `{'0': 10, '1': 5}`.\n    \"\"\"\n    # pylint: disable=cell-var-from-loop\n    # Extract total number of qubits from count keys\n    arg_2 = len(list(arg_0.keys())[0])\n\n    # keys for measured qubits only\n    arg_3 = sorted(arg_1, reverse=True)\n\n    arg_4 = count_keys(len(arg_3))\n\n    # get regex match strings for summing outcomes of other qubits\n    arg_5 = [\n        reduce(lambda x, y: (arg_9[arg_3.index(y)] if y in arg_3 else '\\\\d') + x,\n               range(arg_2), '') for arg_9 in arg_4\n    ]\n\n    # build the return list\n    arg_6 = []\n    for arg_7 in arg_5:\n        arg_8 = 0\n        for arg_9, arg_10 in arg_0.items():\n            if match(arg_7, arg_9):\n                arg_8 += arg_10\n        arg_6.append(arg_8)\n\n    # return as counts dict on measured qubits only\n    return dict(zip(arg_4, arg_6))", "path": "qiskit/tools/qcvv/tomography.py", "identifier": "marginal_counts", "docstring": "Compute the marginal counts for a subset of measured qubits.\n\n    Args:\n        counts (dict): the counts returned from a backend ({str: int}).\n        meas_qubits (list[int]): the qubits to return the marginal\n                                 counts distribution for.\n\n    Returns:\n        dict: A counts dict for the meas_qubits.abs\n        Example: if `counts = {'00': 10, '01': 5}`\n            `marginal_counts(counts, [0])` returns `{'0': 15, '1': 0}`.\n            `marginal_counts(counts, [0])` returns `{'0': 10, '1': 5}`.", "docstring_tokens": ["Compute", "the", "marginal", "counts", "for", "a", "subset", "of", "measured", "qubits", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255016}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1707-L1716", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Path for an output file.", "language": "python", "parameters": "(self, p)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "outdir", "is", "not", "None", ":", "return", "os", ".", "path", ".", "join", "(", "arg_0", ".", "outdir", ",", "os", ".", "path", ".", "basename", "(", "arg_1", ")", ")", "else", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Path for an output file.\n\n        If :attr:`outdir` is set then the path is\n        ``outdir/basename(p)`` else just ``p``\n        \"\"\"\n        if arg_0.outdir is not None:\n            return os.path.join(arg_0.outdir, os.path.basename(arg_1))\n        else:\n            return arg_1", "path": "gromacs/cbook.py", "identifier": "Transformer.outfile", "docstring": "Path for an output file.\n\n        If :attr:`outdir` is set then the path is\n        ``outdir/basename(p)`` else just ``p``", "docstring_tokens": ["Path", "for", "an", "output", "file", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 255017}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L61-L72", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform a QuantumChannel to the Kraus representation.", "language": "python", "parameters": "(rep, data, input_dim, output_dim)", "return_statement": "return _choi_to_kraus(data, input_dim, output_dim)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", "==", "'Kraus'", ":", "return", "arg_1", "if", "arg_0", "==", "'Stinespring'", ":", "return", "_stinespringFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "==", "'Operator'", ":", "return", "_from_operator", "(", "'Kraus'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "!=", "'Choi'", ":", "arg_1", "=", "_to_choi", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "_choiFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Transform a QuantumChannel to the Kraus representation.\"\"\"\n    if arg_0 == 'Kraus':\n        return arg_1\n    if arg_0 == 'Stinespring':\n        return _stinespringFunc(arg_1, arg_2, arg_3)\n    if arg_0 == 'Operator':\n        return _from_operator('Kraus', arg_1, arg_2, arg_3)\n    # Convert via Choi and Kraus\n    if arg_0 != 'Choi':\n        arg_1 = _to_choi(arg_0, arg_1, arg_2, arg_3)\n    return _choiFunc(arg_1, arg_2, arg_3)", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_to_kraus", "docstring": "Transform a QuantumChannel to the Kraus representation.", "docstring_tokens": ["Transform", "a", "QuantumChannel", "to", "the", "Kraus", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255018}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/format_traceback.py#L6-L47", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Format traceback, showing line number and surrounding source.", "language": "python", "parameters": "(ex, source)", "return_statement": "return '\\n'.join(err_msgs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "sys", ".", "exc_info", "(", ")", "arg_5", "=", "traceback", ".", "format_exception", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "arg_6", "=", "arg_1", ".", "splitlines", "(", ")", "arg_7", "=", "arg_5", "[", "-", "2", "]", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_5", ")", ":", "if", "'exec source in ns'", "in", "arg_9", ":", "arg_7", "=", "arg_5", "[", "arg_8", "+", "1", "]", "break", "arg_10", "=", "arg_7", ".", "split", "(", "','", ")", "[", "0", "]", "[", "8", ":", "-", "1", "]", "arg_11", "=", "int", "(", "arg_7", ".", "split", "(", "','", ")", "[", "1", "]", ".", "replace", "(", "'line'", ",", "''", ")", ".", "strip", "(", ")", ")", "arg_12", "=", "[", "]", "arg_13", "=", "' '", ".", "join", "(", "arg_5", "[", "arg_8", "-", "1", "]", ".", "split", "(", "','", ")", "[", "1", ":", "]", ")", ".", "strip", "(", ")", "arg_12", ".", "append", "(", "'Error in the Shoebot script at %s:'", "%", "arg_13", ")", "for", "arg_8", "in", "xrange", "(", "max", "(", "0", ",", "arg_11", "-", "5", ")", ",", "arg_11", ")", ":", "if", "arg_10", "==", "\"<string>\"", ":", "arg_14", "=", "arg_6", "[", "arg_8", "]", "else", ":", "arg_14", "=", "linecache", ".", "getline", "(", "arg_10", ",", "arg_8", "+", "1", ")", "arg_12", ".", "append", "(", "'%s: %s'", "%", "(", "arg_8", "+", "1", ",", "arg_14", ".", "rstrip", "(", ")", ")", ")", "arg_12", ".", "append", "(", "'  %s^ %s'", "%", "(", "len", "(", "str", "(", "arg_8", ")", ")", "*", "' '", ",", "arg_5", "[", "-", "1", "]", ".", "rstrip", "(", ")", ")", ")", "arg_12", ".", "append", "(", "''", ")", "arg_12", ".", "append", "(", "arg_5", "[", "0", "]", ".", "rstrip", "(", ")", ")", "for", "arg_9", "in", "arg_5", "[", "3", ":", "]", ":", "arg_12", ".", "append", "(", "arg_9", ".", "rstrip", "(", ")", ")", "return", "'\\n'", ".", "join", "(", "arg_12", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Format traceback, showing line number and surrounding source.\n    \"\"\"\n    arg_2, arg_3, arg_4 = sys.exc_info()\n    arg_5 = traceback.format_exception(arg_2, arg_3, arg_4)\n\n    arg_6 = arg_1.splitlines()\n\n    # Defaults...\n    arg_7 = arg_5[-2]\n    for arg_8, arg_9 in enumerate(arg_5):\n        if 'exec source in ns' in arg_9:\n            arg_7 = arg_5[arg_8 + 1]\n            break\n\n    # extract line number from traceback\n    arg_10 = arg_7.split(',')[0][8:-1]\n    arg_11 = int(arg_7.split(',')[1].replace('line', '').strip())\n\n    # Build error messages\n\n    arg_12 = []\n\n    # code around the error\n    arg_13 = ' '.join(arg_5[arg_8 - 1].split(',')[1:]).strip()  # 'line 37 in blah\"\n    arg_12.append('Error in the Shoebot script at %s:' % arg_13)\n    for arg_8 in xrange(max(0, arg_11 - 5), arg_11):\n        if arg_10 == \"<string>\":\n            arg_14 = arg_6[arg_8]\n        else:\n            arg_14 = linecache.getline(arg_10, arg_8 + 1)\n        arg_12.append('%s: %s' % (arg_8 + 1, arg_14.rstrip()))\n    arg_12.append('  %s^ %s' % (len(str(arg_8)) * ' ', arg_5[-1].rstrip()))\n\n    arg_12.append('')\n    # traceback\n    arg_12.append(arg_5[0].rstrip())\n    for arg_9 in arg_5[3:]:\n        arg_12.append(arg_9.rstrip())\n\n    return '\\n'.join(arg_12)", "path": "shoebot/grammar/format_traceback.py", "identifier": "simple_traceback", "docstring": "Format traceback, showing line number and surrounding source.", "docstring_tokens": ["Format", "traceback", "showing", "line", "number", "and", "surrounding", "source", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255019}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/eventloops.py#L31-L43", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Start a kernel with PyQt4 event loop integration.", "language": "python", "parameters": "(kernel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "IPython", ".", "external", ".", "qt_for_kernel", "import", "QtCore", "from", "IPython", ".", "lib", ".", "guisupport", "import", "get_app_qt4", ",", "start_event_Func", "arg_0", ".", "app", "=", "get_app_qt4", "(", "[", "\" \"", "]", ")", "arg_0", ".", "app", ".", "setQuitOnLastWindowClosed", "(", "False", ")", "arg_0", ".", "timer", "=", "QtCore", ".", "QTimer", "(", ")", "arg_0", ".", "timer", ".", "timeout", ".", "connect", "(", "arg_0", ".", "do_one_iteration", ")", "arg_0", ".", "timer", ".", "start", "(", "1000", "*", "arg_0", ".", "_poll_interval", ")", "start_event_Func", "(", "arg_0", ".", "app", ")"], "function": "def Func(arg_0):\n    \"\"\"Start a kernel with PyQt4 event loop integration.\"\"\"\n\n    from IPython.external.qt_for_kernel import QtCore\n    from IPython.lib.guisupport import get_app_qt4, start_event_Func\n\n    arg_0.app = get_app_qt4([\" \"])\n    arg_0.app.setQuitOnLastWindowClosed(False)\n    arg_0.timer = QtCore.QTimer()\n    arg_0.timer.timeout.connect(arg_0.do_one_iteration)\n    # Units for the timer are in milliseconds\n    arg_0.timer.start(1000*arg_0._poll_interval)\n    start_event_Func(arg_0.app)", "path": "environment/lib/python2.7/site-packages/IPython/zmq/eventloops.py", "identifier": "loop_qt4", "docstring": "Start a kernel with PyQt4 event loop integration.", "docstring_tokens": ["Start", "a", "kernel", "with", "PyQt4", "event", "loop", "integration", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255020}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/dj.py#L579-L591", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Opens a Django focussed Python shell.\n        Essentially the equivalent of running `manage.py shell`.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "if", "'@'", "in", "arg_0", ".", "genv", ".", "host_string", ":", "arg_1", ".", "env", ".", "Func_host_string", "=", "arg_0", ".", "genv", ".", "host_string", "else", ":", "arg_1", ".", "env", ".", "Func_host_string", "=", "'{user}@{host_string}'", "arg_1", ".", "env", ".", "Func_default_dir", "=", "arg_0", ".", "genv", ".", "Func_default_dir_template", "arg_1", ".", "env", ".", "Func_interactive_djFunc_str", "=", "arg_0", ".", "genv", ".", "interactive_Func_template", "arg_1", ".", "run_or_local", "(", "'ssh -t -i {key_filename} {Func_host_string} \"{Func_interactive_djFunc_str}\"'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Opens a Django focussed Python Func.\n        Essentially the equivalent of running `manage.py Func`.\n        \"\"\"\n        arg_1 = arg_0.local_renderer\n        if '@' in arg_0.genv.host_string:\n            arg_1.env.Func_host_string = arg_0.genv.host_string\n        else:\n            arg_1.env.Func_host_string = '{user}@{host_string}'\n        arg_1.env.Func_default_dir = arg_0.genv.Func_default_dir_template\n        arg_1.env.Func_interactive_djFunc_str = arg_0.genv.interactive_Func_template\n        arg_1.run_or_local('ssh -t -i {key_filename} {Func_host_string} \"{Func_interactive_djFunc_str}\"')", "path": "burlap/dj.py", "identifier": "DjangoSatchel.shell", "docstring": "Opens a Django focussed Python shell.\n        Essentially the equivalent of running `manage.py shell`.", "docstring_tokens": ["Opens", "a", "Django", "focussed", "Python", "shell", ".", "Essentially", "the", "equivalent", "of", "running", "manage", ".", "py", "shell", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 255021}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L324-L342", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return the number of global loop iterations that are performed.", "language": "python", "parameters": "(self, dimension=None)", "return_statement": "return self.subs_consts(total_length)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "1", "if", "arg_1", "is", "not", "None", ":", "arg_3", "=", "[", "arg_0", ".", "_loop_stack", "[", "arg_1", "]", "]", "else", ":", "arg_3", "=", "reversed", "(", "arg_0", ".", "_loop_stack", ")", "for", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_3", ":", "arg_8", "=", "arg_6", "-", "arg_5", "arg_2", "=", "arg_2", "*", "arg_8", "return", "arg_0", ".", "subs_consts", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Return the number of global loop iterations that are performed.\n\n        If dimension is not None, it is the loop dimension that is returned\n        (-1 is the inner most loop and 0 the outermost)\n        \"\"\"\n        arg_2 = 1\n\n        if arg_1 is not None:\n            arg_3 = [arg_0._loop_stack[arg_1]]\n        else:\n            arg_3 = reversed(arg_0._loop_stack)\n\n        for arg_4, arg_5, arg_6, arg_7 in arg_3:\n            # This unspools the iterations:\n            arg_8 = arg_6-arg_5\n            arg_2 = arg_2*arg_8\n        return arg_0.subs_consts(arg_2)", "path": "kerncraft/kernel.py", "identifier": "Kernel.iteration_length", "docstring": "Return the number of global loop iterations that are performed.\n\n        If dimension is not None, it is the loop dimension that is returned\n        (-1 is the inner most loop and 0 the outermost)", "docstring_tokens": ["Return", "the", "number", "of", "global", "loop", "iterations", "that", "are", "performed", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 255022}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L237-L242", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST PlayStop on a Call Helper", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/PlayStop/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST PlayStop on a Call Helper\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/PlayStop/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.play_stop", "docstring": "REST PlayStop on a Call Helper", "docstring_tokens": ["REST", "PlayStop", "on", "a", "Call", "Helper"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 255023}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/utils.py#L72-L93", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "Take a string and return the corresponding module", "language": "python", "parameters": "(mod_path, obj_name=None)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "try", ":", "arg_2", "=", "__import__", "(", "arg_0", ",", "fromlist", "=", "[", "'whatever'", "]", ")", "except", "ImportError", ",", "error", ":", "raise", "errors", ".", "DynamicImportFailed", "(", "arg_2", "=", "'.'", ".", "join", "(", "[", "arg_0", ",", "arg_1", "]", ")", ",", "reason", "=", "error", ")", "reload", "(", "arg_2", ")", "if", "arg_1", "is", "None", ":", "arg_3", "=", "arg_2", "elif", "hasattr", "(", "arg_2", ",", "arg_1", ")", ":", "arg_3", "=", "getattr", "(", "arg_2", ",", "arg_1", ")", "else", ":", "raise", "errors", ".", "DynamicImportFailed", "(", "arg_2", "=", "'.'", ".", "join", "(", "[", "arg_0", ",", "arg_1", "]", ")", ",", "reason", "=", "'module {} has no attribute {}'", ".", "format", "(", "arg_2", ".", "__name__", ",", "arg_1", ")", ")", "return", "None", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n    ''' Take a string and return the corresponding module '''\n    try:\n        arg_2 = __import__(arg_0, fromlist=['whatever'])\n    except ImportError, error:\n        raise errors.DynamicImportFailed(\n            arg_2='.'.join([arg_0, arg_1]), reason=error)\n    # Make sure we're up-to-date\n    reload(arg_2)\n\n    if arg_1 is None:\n        arg_3 = arg_2\n    elif hasattr(arg_2, arg_1):\n        arg_3 = getattr(arg_2, arg_1)\n    else:\n        raise errors.DynamicImportFailed(\n            arg_2='.'.join([arg_0, arg_1]),\n            reason='module {} has no attribute {}'.\n                   format(arg_2.__name__, arg_1))\n        return None\n\n    return arg_3", "path": "python/dna/utils.py", "identifier": "dynamic_import", "docstring": "Take a string and return the corresponding module", "docstring_tokens": ["Take", "a", "string", "and", "return", "the", "corresponding", "module"], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 255024}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L158-L252", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse individual information", "language": "python", "parameters": "(sample)", "return_statement": "return ind_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "if", "'sample_id'", "not", "in", "arg_0", ":", "raise", "PedigreeError", "(", "\"One sample is missing 'sample_id'\"", ")", "arg_2", "=", "arg_0", "[", "'sample_id'", "]", "if", "'sex'", "not", "in", "arg_0", ":", "raise", "PedigreeError", "(", "\"Sample %s is missing 'sex'\"", "%", "arg_2", ")", "arg_3", "=", "arg_0", "[", "'sex'", "]", "if", "arg_3", "not", "in", "REV_SEX_MAP", ":", "log", ".", "warning", "(", "\"'sex' is only allowed to have values from {}\"", ".", "format", "(", "', '", ".", "join", "(", "list", "(", "REV_SEX_MAP", ".", "keys", "(", ")", ")", ")", ")", ")", "raise", "PedigreeError", "(", "\"Individual %s has wrong formated sex\"", "%", "arg_2", ")", "if", "'phenotype'", "not", "in", "arg_0", ":", "raise", "PedigreeError", "(", "\"Sample %s is missing 'phenotype'\"", "%", "arg_2", ")", "arg_4", "=", "arg_0", "[", "'phenotype'", "]", "if", "arg_4", "not", "in", "REV_PHENOTYPE_MAP", ":", "log", ".", "warning", "(", "\"'phenotype' is only allowed to have values from {}\"", ".", "format", "(", "', '", ".", "join", "(", "list", "(", "REV_PHENOTYPE_MAP", ".", "keys", "(", ")", ")", ")", ")", ")", "raise", "PedigreeError", "(", "\"Individual %s has wrong formated phenotype\"", "%", "arg_2", ")", "arg_1", "[", "'individual_id'", "]", "=", "arg_2", "arg_1", "[", "'display_name'", "]", "=", "arg_0", ".", "get", "(", "'sample_name'", ",", "arg_0", "[", "'sample_id'", "]", ")", "arg_1", "[", "'sex'", "]", "=", "arg_3", "arg_1", "[", "'phenotype'", "]", "=", "arg_4", "arg_1", "[", "'father'", "]", "=", "arg_0", ".", "get", "(", "'father'", ")", "arg_1", "[", "'mother'", "]", "=", "arg_0", ".", "get", "(", "'mother'", ")", "arg_1", "[", "'confirmed_parent'", "]", "=", "arg_0", ".", "get", "(", "'confirmed_parent'", ")", "arg_1", "[", "'confirmed_sex'", "]", "=", "arg_0", ".", "get", "(", "'confirmed_sex'", ")", "arg_1", "[", "'predicted_ancestry'", "]", "=", "arg_0", ".", "get", "(", "'predicted_ancestry'", ")", "arg_5", "=", "arg_0", ".", "get", "(", "'bam_path'", ")", "if", "arg_5", ":", "arg_1", "[", "'bam_file'", "]", "=", "arg_5", "arg_6", "=", "arg_0", ".", "get", "(", "'mt_bam'", ")", "if", "arg_6", ":", "arg_1", "[", "'mt_bam'", "]", "=", "arg_6", "arg_7", "=", "arg_0", ".", "get", "(", "'analysis_type'", ")", "if", "arg_7", ":", "arg_1", "[", "'analysis_type'", "]", "=", "arg_7", "arg_1", "[", "'capture_kits'", "]", "=", "(", "[", "arg_0", ".", "get", "(", "'capture_kit'", ")", "]", "if", "'capture_kit'", "in", "arg_0", "else", "[", "]", ")", "arg_8", "=", "arg_0", ".", "get", "(", "'vcf2cytosure'", ")", "if", "arg_8", ":", "arg_1", "[", "'vcf2cytosure'", "]", "=", "arg_8", "arg_9", "=", "arg_0", ".", "get", "(", "'tumor_type'", ")", "if", "arg_9", ":", "arg_1", "[", "'tumor_type'", "]", "=", "arg_9", "arg_10", "=", "arg_0", ".", "get", "(", "'tmb'", ")", "if", "arg_10", ":", "arg_1", "[", "'tmb'", "]", "=", "arg_10", "arg_11", "=", "arg_0", ".", "get", "(", "'msi'", ")", "if", "arg_11", ":", "arg_1", "[", "'msi'", "]", "=", "arg_11", "arg_12", "=", "arg_0", ".", "get", "(", "'tumor_purity'", ")", "if", "arg_12", ":", "arg_1", "[", "'tumor_purity'", "]", "=", "arg_12", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse individual information\n\n        Args:\n            sample (dict)\n\n        Returns:\n            {\n                'individual_id': str,\n                'father': str,\n                'mother': str,\n                'display_name': str,\n                'sex': str,\n                'phenotype': str,\n                'bam_file': str,\n                'vcf2cytosure': str,\n                'analysis_type': str,\n                'capture_kits': list(str),\n            }\n\n    \"\"\"\n    arg_1 = {}\n    if 'sample_id' not in arg_0:\n        raise PedigreeError(\"One sample is missing 'sample_id'\")\n    arg_2 = arg_0['sample_id']\n    # Check the sex\n    if 'sex' not in arg_0:\n        raise PedigreeError(\"Sample %s is missing 'sex'\" % arg_2)\n    arg_3 = arg_0['sex']\n    if arg_3 not in REV_SEX_MAP:\n        log.warning(\"'sex' is only allowed to have values from {}\"\n                    .format(', '.join(list(REV_SEX_MAP.keys()))))\n        raise PedigreeError(\"Individual %s has wrong formated sex\" % arg_2)\n\n    # Check the phenotype\n    if 'phenotype' not in arg_0:\n        raise PedigreeError(\"Sample %s is missing 'phenotype'\"\n                            % arg_2)\n    arg_4 = arg_0['phenotype']\n    if arg_4 not in REV_PHENOTYPE_MAP:\n        log.warning(\"'phenotype' is only allowed to have values from {}\"\n                    .format(', '.join(list(REV_PHENOTYPE_MAP.keys()))))\n        raise PedigreeError(\"Individual %s has wrong formated phenotype\" % arg_2)\n\n    arg_1['individual_id'] = arg_2\n    arg_1['display_name'] = arg_0.get('sample_name', arg_0['sample_id'])\n\n    arg_1['sex'] = arg_3\n    arg_1['phenotype'] = arg_4\n\n    arg_1['father'] = arg_0.get('father')\n    arg_1['mother'] = arg_0.get('mother')\n\n    arg_1['confirmed_parent'] = arg_0.get('confirmed_parent')\n    arg_1['confirmed_sex'] = arg_0.get('confirmed_sex')\n    arg_1['predicted_ancestry'] = arg_0.get('predicted_ancestry')\n\n    arg_5 = arg_0.get('bam_path')\n    if arg_5:\n        arg_1['bam_file'] = arg_5\n\n    arg_6 = arg_0.get('mt_bam')\n    if arg_6:\n        arg_1['mt_bam'] = arg_6\n\n    arg_7 = arg_0.get('analysis_type')\n    if arg_7:\n        arg_1['analysis_type'] = arg_7\n\n    arg_1['capture_kits'] = ([arg_0.get('capture_kit')]\n                                if 'capture_kit' in arg_0 else [])\n\n    # Path to downloadable vcf2cytosure file\n    arg_8 = arg_0.get('vcf2cytosure')\n    if arg_8:\n        arg_1['vcf2cytosure'] = arg_8\n\n    # Cancer specific values\n    arg_9 = arg_0.get('tumor_type')\n    if arg_9:\n        arg_1['tumor_type'] = arg_9\n\n    arg_10 = arg_0.get('tmb')\n    if arg_10:\n        arg_1['tmb'] = arg_10\n\n    arg_11 = arg_0.get('msi')\n    if arg_11:\n        arg_1['msi'] = arg_11\n\n    arg_12 = arg_0.get('tumor_purity')\n    if arg_12:\n        arg_1['tumor_purity'] = arg_12\n\n    return arg_1", "path": "scout/parse/case.py", "identifier": "parse_individual", "docstring": "Parse individual information\n\n        Args:\n            sample (dict)\n\n        Returns:\n            {\n                'individual_id': str,\n                'father': str,\n                'mother': str,\n                'display_name': str,\n                'sex': str,\n                'phenotype': str,\n                'bam_file': str,\n                'vcf2cytosure': str,\n                'analysis_type': str,\n                'capture_kits': list(str),\n            }", "docstring_tokens": ["Parse", "individual", "information"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255025}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/metadata.py#L44-L55", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Get a list of public tokens available on this server.", "language": "python", "parameters": "(self)", "return_statement": "return r.json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "remote_utils", ".", "get_url", "(", "arg_0", ".", "url", "(", ")", "+", "\"public_tokens/\"", ")", "return", "arg_1", ".", "json", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get a list of public tokens available on this server.\n\n        Arguments:\n            None\n\n        Returns:\n            str[]: list of public tokens\n        \"\"\"\n        arg_1 = arg_0.remote_utils.get_url(arg_0.url() + \"public_tokens/\")\n        return arg_1.json()", "path": "ndio/remote/metadata.py", "identifier": "metadata.get_public_tokens", "docstring": "Get a list of public tokens available on this server.\n\n        Arguments:\n            None\n\n        Returns:\n            str[]: list of public tokens", "docstring_tokens": ["Get", "a", "list", "of", "public", "tokens", "available", "on", "this", "server", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 255026}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L354-L375", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Revoke a bid on a project", "language": "python", "parameters": "(session, bid_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'Content-Type'", ":", "'application/x-www-form-urlencoded'", "}", "arg_3", "=", "{", "'action'", ":", "'revoke'", "}", "arg_4", "=", "'bids/{}'", ".", "format", "(", "arg_1", ")", "arg_5", "=", "make_put_request", "(", "arg_0", ",", "arg_4", ",", "arg_2", "=", "arg_2", ",", "params_data", "=", "arg_3", ")", "arg_6", "=", "arg_5", ".", "json", "(", ")", "if", "arg_5", ".", "status_code", "==", "200", ":", "return", "arg_6", "[", "'status'", "]", "else", ":", "arg_6", "=", "arg_5", ".", "json", "(", ")", "raise", "BidNotRevokedException", "(", "message", "=", "arg_6", "[", "'message'", "]", ",", "error_code", "=", "arg_6", "[", "'error_code'", "]", ",", "request_id", "=", "arg_6", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Revoke a bid on a project\n    \"\"\"\n    arg_2 = {\n        'Content-Type': 'application/x-www-form-urlencoded'\n    }\n    arg_3 = {\n        'action': 'revoke'\n    }\n    # POST /api/projects/0.1/bids/{bid_id}/?action=revoke\n    arg_4 = 'bids/{}'.format(arg_1)\n    arg_5 = make_put_request(arg_0, arg_4, arg_2=arg_2,\n                                params_data=arg_3)\n    arg_6 = arg_5.json()\n    if arg_5.status_code == 200:\n        return arg_6['status']\n    else:\n        arg_6 = arg_5.json()\n        raise BidNotRevokedException(message=arg_6['message'],\n                                     error_code=arg_6['error_code'],\n                                     request_id=arg_6['request_id'])", "path": "freelancersdk/resources/projects/projects.py", "identifier": "revoke_project_bid", "docstring": "Revoke a bid on a project", "docstring_tokens": ["Revoke", "a", "bid", "on", "a", "project"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 255027}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L541-L547", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns nodes sorted by eigenvector centrality.\n        Nodes with a lot of incoming traffic will be at the front of the list", "language": "python", "parameters": "(self, treshold=0.0)", "return_statement": "return [n for w, n in nodes]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.0", ")", ":", "arg_2", "=", "[", "(", "arg_4", ".", "eigenvalue", ",", "arg_4", ")", "for", "arg_4", "in", "arg_0", ".", "nodes", "if", "arg_4", ".", "eigenvalue", ">", "arg_1", "]", "arg_2", ".", "sort", "(", ")", "arg_2", ".", "reverse", "(", ")", "return", "[", "arg_4", "for", "arg_3", ",", "arg_4", "in", "arg_2", "]"], "function": "def Func(arg_0, arg_1=0.0):\n        \"\"\" Returns nodes sorted by eigenvector centrality.\n        Nodes with a lot of incoming traffic will be at the front of the list\n        \"\"\"\n        arg_2 = [(arg_4.eigenvalue, arg_4) for arg_4 in arg_0.nodes if arg_4.eigenvalue > arg_1]\n        arg_2.sort(); arg_2.reverse()\n        return [arg_4 for arg_3, arg_4 in arg_2]", "path": "lib/graph/__init__.py", "identifier": "graph.nodes_by_eigenvalue", "docstring": "Returns nodes sorted by eigenvector centrality.\n        Nodes with a lot of incoming traffic will be at the front of the list", "docstring_tokens": ["Returns", "nodes", "sorted", "by", "eigenvector", "centrality", ".", "Nodes", "with", "a", "lot", "of", "incoming", "traffic", "will", "be", "at", "the", "front", "of", "the", "list"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255028}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/__init__.py#L356-L377", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "Updates an application version", "language": "python", "parameters": "(self, environment_name, description=None, option_settings=[], tier_type=None, tier_name=None,\n                           tier_version='1.0')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "[", "]", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'1.0'", ")", ":", "out", "(", "\"Updating environment: \"", "+", "str", "(", "arg_1", ")", ")", "arg_7", "=", "arg_0", ".", "ebs", ".", "validate_configuration_settings", "(", "arg_0", ".", "app_name", ",", "arg_3", ",", "arg_1", "=", "arg_1", ")", "arg_7", "=", "arg_7", "[", "'ValidateConfigurationSettingsResponse'", "]", "[", "'ValidateConfigurationSettingsResult'", "]", "[", "'Messages'", "]", "arg_8", "=", "True", "for", "arg_9", "in", "arg_7", ":", "if", "arg_9", "[", "'Severity'", "]", "==", "'error'", ":", "arg_8", "=", "False", "out", "(", "\"[\"", "+", "arg_9", "[", "'Severity'", "]", "+", "\"] \"", "+", "str", "(", "arg_1", ")", "+", "\" - '\"", "+", "arg_9", "[", "'Namespace'", "]", "+", "\":\"", "+", "arg_9", "[", "'OptionName'", "]", "+", "\"': \"", "+", "arg_9", "[", "'Message'", "]", ")", "arg_0", ".", "ebs", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=[], arg_4=None, arg_5=None,\n                           arg_6='1.0'):\n        \"\"\"\n        Updates an application version\n        \"\"\"\n        out(\"Updating environment: \" + str(arg_1))\n        arg_7 = arg_0.ebs.validate_configuration_settings(arg_0.app_name, arg_3,\n                                                            arg_1=arg_1)\n        arg_7 = arg_7['ValidateConfigurationSettingsResponse']['ValidateConfigurationSettingsResult']['Messages']\n        arg_8 = True\n        for arg_9 in arg_7:\n            if arg_9['Severity'] == 'error':\n                arg_8 = False\n            out(\"[\" + arg_9['Severity'] + \"] \" + str(arg_1) + \" - '\" \\\n                + arg_9['Namespace'] + \":\" + arg_9['OptionName'] + \"': \" + arg_9['Message'])\n        arg_0.ebs.Func(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_6=arg_6)", "path": "ebs_deploy/__init__.py", "identifier": "EbsHelper.update_environment", "docstring": "Updates an application version", "docstring_tokens": ["Updates", "an", "application", "version"], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 255029}
{"url": "https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L15-L28", "sha": "7ef04938d80f8b646bd73d976ac9787a5b88edd9", "docstring_summary": "Wraps an instruction to be Python 3.6+ compatible. This does nothing on Python 3.5 and below.", "language": "python", "parameters": "(instruction: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "bytes", ":", "if", "PY36", ":", "return", "arg_0", ".", "to_bytes", "(", "2", ",", "byteorder", "=", "\"little\"", ")", "else", ":", "return", "arg_0", ".", "to_bytes", "(", "1", ",", "byteorder", "=", "\"little\"", ")"], "function": "def Func(arg_0: arg_1) -> bytes:\n    \"\"\"\n    Wraps an instruction to be Python 3.6+ compatible. This does nothing on Python 3.5 and below.\n\n    This is most useful for operating on bare, single-width instructions such as\n    ``RETURN_FUNCTION`` in a version portable way.\n\n    :param instruction: The instruction integer to use.\n    :return: A safe bytes object, if applicable.\n    \"\"\"\n    if PY36:\n        return arg_0.to_bytes(2, byteorder=\"little\")\n    else:\n        return arg_0.to_bytes(1, byteorder=\"little\")", "path": "pyte/util.py", "identifier": "ensure_instruction", "docstring": "Wraps an instruction to be Python 3.6+ compatible. This does nothing on Python 3.5 and below.\n\n    This is most useful for operating on bare, single-width instructions such as\n    ``RETURN_FUNCTION`` in a version portable way.\n\n    :param instruction: The instruction integer to use.\n    :return: A safe bytes object, if applicable.", "docstring_tokens": ["Wraps", "an", "instruction", "to", "be", "Python", "3", ".", "6", "+", "compatible", ".", "This", "does", "nothing", "on", "Python", "3", ".", "5", "and", "below", "."], "nwo": "Fuyukai/Pyte", "score": 0.3282631104312029, "idx": 255030}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/host.py#L69-L86", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Return a JSON object of all available facts of the given host.", "language": "python", "parameters": "(self, pk=None, **kwargs)", "return_statement": "return client.get(url, params={}).json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get", "(", "arg_1", "=", "arg_1", ",", "**", "arg_2", ")", "arg_4", "=", "arg_0", ".", "endpoint", "+", "'%d/%s/'", "%", "(", "arg_3", "[", "'id'", "]", ",", "'ansible_facts'", ")", "return", "client", ".", "get", "(", "arg_4", ",", "params", "=", "{", "}", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"Return a JSON object of all available facts of the given host.\n\n        Note global option --format is not available here, as the output would always be JSON-formatted.\n\n        =====API DOCS=====\n        List all available facts of the given host.\n\n        :param pk: Primary key of the target host.\n        :type pk: int\n        :param `**kwargs`: Keyword arguments list of available fields used for searching resource objects.\n        :returns: A JSON object of all available facts of the given host.\n        :rtype: dict\n        =====API DOCS=====\n        \"\"\"\n        arg_3 = arg_0.get(arg_1=arg_1, **arg_2)\n        arg_4 = arg_0.endpoint + '%d/%s/' % (arg_3['id'], 'ansible_facts')\n        return client.get(arg_4, params={}).json()", "path": "tower_cli/resources/host.py", "identifier": "Resource.list_facts", "docstring": "Return a JSON object of all available facts of the given host.\n\n        Note global option --format is not available here, as the output would always be JSON-formatted.\n\n        =====API DOCS=====\n        List all available facts of the given host.\n\n        :param pk: Primary key of the target host.\n        :type pk: int\n        :param `**kwargs`: Keyword arguments list of available fields used for searching resource objects.\n        :returns: A JSON object of all available facts of the given host.\n        :rtype: dict\n        =====API DOCS=====", "docstring_tokens": ["Return", "a", "JSON", "object", "of", "all", "available", "facts", "of", "the", "given", "host", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 255031}
{"url": "https://github.com/PRIArobotics/HedgehogProtocol/blob/140df1ade46fbfee7eea7a6c0b35cbc7ffbf89fe/hedgehog/protocol/zmq/__init__.py#L17-L19", "sha": "140df1ade46fbfee7eea7a6c0b35cbc7ffbf89fe", "docstring_summary": "Index of the last occurrence of x in the sequence.", "language": "python", "parameters": "(mylist: Sequence[T], x: T)", "return_statement": "return len(mylist) - mylist[::-1].index(x) - 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "arg_3", ":", "arg_2", ")", "->", "int", ":", "return", "len", "(", "arg_0", ")", "-", "arg_0", "[", ":", ":", "-", "1", "]", ".", "index", "(", "arg_3", ")", "-", "1"], "function": "def Func(arg_0: arg_1[arg_2], arg_3: arg_2) -> int:\n    \"\"\"Index of the last occurrence of x in the sequence.\"\"\"\n    return len(arg_0) - arg_0[::-1].index(arg_3) - 1", "path": "hedgehog/protocol/zmq/__init__.py", "identifier": "_rindex", "docstring": "Index of the last occurrence of x in the sequence.", "docstring_tokens": ["Index", "of", "the", "last", "occurrence", "of", "x", "in", "the", "sequence", "."], "nwo": "PRIArobotics/HedgehogProtocol", "score": 0.09252797783733271, "idx": 255032}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/credentials.py#L6-L20", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Main credentials tool", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "CredentialSearch", "(", ")", "arg_1", "=", "argparse", ".", "ArgumentParser", "(", "parents", "=", "[", "arg_0", ".", "argparser", "]", ",", "conflict_handler", "=", "'resolve'", ")", "arg_1", ".", "add_argument", "(", "'-c'", ",", "'--count'", ",", "help", "=", "\"Only show the number of results\"", ",", "action", "=", "\"store_true\"", ")", "arg_2", "=", "arg_1", ".", "parse_args", "(", ")", "if", "arg_2", ".", "count", ":", "print_line", "(", "\"Number of credentials: {}\"", ".", "format", "(", "arg_0", ".", "argument_count", "(", ")", ")", ")", "else", ":", "arg_3", "=", "arg_0", ".", "get_credentials", "(", ")", "for", "arg_4", "in", "arg_3", ":", "print_json", "(", "arg_4", ".", "to_dict", "(", "include_meta", "=", "True", ")", ")"], "function": "def Func():\n    \"\"\"\n        Main credentials tool\n    \"\"\"\n    arg_0 = CredentialSearch()\n    arg_1 = argparse.ArgumentParser(parents=[arg_0.argparser], conflict_handler='resolve')\n    arg_1.add_argument('-c', '--count', help=\"Only show the number of results\", action=\"store_true\")\n    arg_2 = arg_1.parse_args()\n\n    if arg_2.count:\n        print_line(\"Number of credentials: {}\".format(arg_0.argument_count()))\n    else:\n        arg_3 = arg_0.get_credentials()\n        for arg_4 in arg_3:\n            print_json(arg_4.to_dict(include_meta=True))", "path": "jackal/scripts/credentials.py", "identifier": "main", "docstring": "Main credentials tool", "docstring_tokens": ["Main", "credentials", "tool"], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 255033}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/morpho_tagger/network.py#L290-L304", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Transforms a sentence of tags to Numpy array, which will be the network target.", "language": "python", "parameters": "(self, tags, bucket_length=None)", "return_statement": "return answer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", "->", "np", ".", "ndarray", ":", "arg_2", "=", "arg_2", "or", "len", "(", "arg_1", ")", "arg_3", "=", "np", ".", "zeros", "(", "shape", "=", "(", "arg_2", ",", ")", ",", "dtype", "=", "np", ".", "int32", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_1", ")", ":", "arg_3", "[", "arg_4", "]", "=", "arg_0", ".", "tags", ".", "tok2idx", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None) -> np.ndarray:\n        \"\"\"Transforms a sentence of tags to Numpy array, which will be the network target.\n\n        Args:\n            tags: input sentence of tags\n            bucket_length: the width of the bucket\n\n        Returns:\n            A 2d array, answer[i][j] contains the index of j-th tag in i-th input sentence.\n        \"\"\"\n        arg_2 = arg_2 or len(arg_1)\n        arg_3 = np.zeros(shape=(arg_2,), dtype=np.int32)\n        for arg_4, arg_5 in enumerate(arg_1):\n            arg_3[arg_4] = arg_0.tags.tok2idx(arg_5)\n        return arg_3", "path": "deeppavlov/models/morpho_tagger/network.py", "identifier": "CharacterTagger._make_tags_vector", "docstring": "Transforms a sentence of tags to Numpy array, which will be the network target.\n\n        Args:\n            tags: input sentence of tags\n            bucket_length: the width of the bucket\n\n        Returns:\n            A 2d array, answer[i][j] contains the index of j-th tag in i-th input sentence.", "docstring_tokens": ["Transforms", "a", "sentence", "of", "tags", "to", "Numpy", "array", "which", "will", "be", "the", "network", "target", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255034}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/util/antglob.py#L160-L187", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Like `os.walk` and taking the same keyword arguments,\n            but generating paths relative to the root.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "''", "if", "'with_root'", "in", "arg_1", "and", "arg_1", ".", "pop", "(", "'with_root'", ")", ":", "arg_2", "=", "arg_0", ".", "root", ".", "rstrip", "(", "os", ".", "sep", ")", "+", "os", ".", "sep", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "os", ".", "Func", "(", "arg_0", ".", "root", ",", "**", "arg_1", ")", ":", "arg_6", "=", "arg_3", "[", "len", "(", "arg_0", ".", "root", ")", ":", "]", ".", "lstrip", "(", "os", ".", "sep", ")", "arg_7", "=", "arg_6", ".", "split", "(", "os", ".", "sep", ")", "if", "arg_6", "else", "[", "]", "for", "arg_8", "in", "arg_4", "[", ":", "]", ":", "arg_9", "=", "'/'", ".", "join", "(", "arg_7", "+", "[", "arg_8", "]", ")", "arg_10", "=", "arg_0", ".", "included", "(", "arg_9", ",", "is_dir", "=", "True", ")", "if", "arg_10", ":", "yield", "arg_2", "+", "arg_9", "+", "'/'", "elif", "arg_10", "is", "False", ":", "arg_4", ".", "remove", "(", "arg_8", ")", "for", "arg_11", "in", "arg_5", ":", "arg_9", "=", "'/'", ".", "join", "(", "arg_7", "+", "[", "arg_11", "]", ")", "if", "arg_0", ".", "included", "(", "arg_9", ")", ":", "yield", "arg_2", "+", "arg_9"], "function": "def Func(arg_0, **arg_1):\n        \"\"\" Like `os.Func` and taking the same keyword arguments,\n            but generating paths relative to the root.\n\n            Starts in the fileset's root and filters based on its patterns.\n            If ``with_root=True`` is passed in, the generated paths include\n            the root path.\n        \"\"\"\n        arg_2 = ''\n        if 'with_root' in arg_1 and arg_1.pop('with_root'):\n            arg_2 = arg_0.root.rstrip(os.sep) + os.sep\n\n        for arg_3, arg_4, arg_5 in os.Func(arg_0.root, **arg_1):\n            arg_6 = arg_3[len(arg_0.root):].lstrip(os.sep)\n            arg_7 = arg_6.split(os.sep) if arg_6 else []\n\n            for arg_8 in arg_4[:]:\n                arg_9 = '/'.join(arg_7 + [arg_8])\n                arg_10 = arg_0.included(arg_9, is_dir=True)\n                if arg_10:\n                    yield arg_2 + arg_9 + '/'\n                elif arg_10 is False:\n                    arg_4.remove(arg_8)\n\n            for arg_11 in arg_5:\n                arg_9 = '/'.join(arg_7 + [arg_11])\n                if arg_0.included(arg_9):\n                    yield arg_2 + arg_9", "path": "src/rituals/util/antglob.py", "identifier": "FileSet.walk", "docstring": "Like `os.walk` and taking the same keyword arguments,\n            but generating paths relative to the root.\n\n            Starts in the fileset's root and filters based on its patterns.\n            If ``with_root=True`` is passed in, the generated paths include\n            the root path.", "docstring_tokens": ["Like", "os", ".", "walk", "and", "taking", "the", "same", "keyword", "arguments", "but", "generating", "paths", "relative", "to", "the", "root", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 255035}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/views.py#L414-L432", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Shows all of the credit notes in the system.", "language": "python", "parameters": "(request, form)", "return_statement": "return QuerysetReport(\n        \"Credit Notes\",\n        [\"id\",\n         \"invoice__user__attendee__attendeeprofilebase__invoice_recipient\",\n         \"status\", \"value\"],\n        notes,\n        headings=[\"id\", \"Owner\", \"Status\", \"Value\"],\n        link_view=views.credit_note,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "commerce", ".", "CreditNote", ".", "objects", ".", "all", "(", ")", ".", "select_related", "(", "\"creditnoterefund\"", ",", "\"creditnoteapplication\"", ",", "\"invoice\"", ",", "\"invoice__user__attendee__attendeeprofilebase\"", ",", ")", "return", "QuerysetReport", "(", "\"Credit Notes\"", ",", "[", "\"id\"", ",", "\"invoice__user__attendee__attendeeprofilebase__invoice_recipient\"", ",", "\"status\"", ",", "\"value\"", "]", ",", "arg_2", ",", "headings", "=", "[", "\"id\"", ",", "\"Owner\"", ",", "\"Status\"", ",", "\"Value\"", "]", ",", "link_view", "=", "views", ".", "credit_note", ",", ")"], "function": "def Func(arg_0, arg_1):\n    ''' Shows all of the credit notes in the system. '''\n\n    arg_2 = commerce.CreditNote.objects.all().select_related(\n        \"creditnoterefund\",\n        \"creditnoteapplication\",\n        \"invoice\",\n        \"invoice__user__attendee__attendeeprofilebase\",\n    )\n\n    return QuerysetReport(\n        \"Credit Notes\",\n        [\"id\",\n         \"invoice__user__attendee__attendeeprofilebase__invoice_recipient\",\n         \"status\", \"value\"],\n        arg_2,\n        headings=[\"id\", \"Owner\", \"Status\", \"Value\"],\n        link_view=views.credit_note,\n    )", "path": "registrasion/reporting/views.py", "identifier": "credit_notes", "docstring": "Shows all of the credit notes in the system.", "docstring_tokens": ["Shows", "all", "of", "the", "credit", "notes", "in", "the", "system", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 255036}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L518-L556", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Apply value check functions on the given record `r`.", "language": "python", "parameters": "(self, i, r,\n                            summarize=False,\n                            report_unexpected_exceptions=True,\n                            context=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "for", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", "in", "arg_0", ".", "_value_checks", ":", "if", "arg_1", "%", "arg_10", "==", "0", ":", "arg_11", "=", "arg_0", ".", "_field_names", ".", "index", "(", "arg_6", ")", "if", "arg_11", "<", "len", "(", "arg_2", ")", ":", "arg_12", "=", "arg_2", "[", "arg_11", "]", "try", ":", "arg_7", "(", "arg_12", ")", "except", "ValueError", ":", "arg_13", "=", "{", "'code'", ":", "arg_8", "}", "if", "not", "arg_3", ":", "arg_13", "[", "'message'", "]", "=", "arg_9", "arg_13", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_13", "[", "'column'", "]", "=", "arg_11", "+", "1", "arg_13", "[", "'field'", "]", "=", "arg_6", "arg_13", "[", "'value'", "]", "=", "arg_12", "arg_13", "[", "'record'", "]", "=", "arg_2", "if", "arg_5", "is", "not", "None", ":", "arg_13", "[", "'context'", "]", "=", "arg_5", "yield", "arg_13", "except", "Exception", "as", "e", ":", "if", "arg_4", ":", "arg_13", "=", "{", "'code'", ":", "UNEXPECTED_EXCEPTION", "}", "if", "not", "arg_3", ":", "arg_13", "[", "'message'", "]", "=", "MESSAGES", "[", "UNEXPECTED_EXCEPTION", "]", "%", "(", "e", ".", "__class__", ".", "__name__", ",", "e", ")", "arg_13", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_13", "[", "'column'", "]", "=", "arg_11", "+", "1", "arg_13", "[", "'field'", "]", "=", "arg_6", "arg_13", "[", "'value'", "]", "=", "arg_12", "arg_13", "[", "'record'", "]", "=", "arg_2", "arg_13", "[", "'exception'", "]", "=", "e", "arg_13", "[", "'function'", "]", "=", "'%s: %s'", "%", "(", "arg_7", ".", "__name__", ",", "arg_7", ".", "__doc__", ")", "if", "arg_5", "is", "not", "None", ":", "arg_13", "[", "'context'", "]", "=", "arg_5", "yield", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2,\n                            arg_3=False,\n                            arg_4=True,\n                            arg_5=None):\n        \"\"\"Apply value check functions on the given record `r`.\"\"\"\n\n        for arg_6, arg_7, arg_8, arg_9, arg_10 in arg_0._value_checks:\n            if arg_1 % arg_10 == 0: # support sampling\n                arg_11 = arg_0._field_names.index(arg_6)\n                if arg_11 < len(arg_2): # only apply checks if there is a value\n                    arg_12 = arg_2[arg_11]\n                    try:\n                        arg_7(arg_12)\n                    except ValueError:\n                        arg_13 = {'code': arg_8}\n                        if not arg_3:\n                            arg_13['message'] = arg_9\n                            arg_13['row'] = arg_1 + 1\n                            arg_13['column'] = arg_11 + 1\n                            arg_13['field'] = arg_6\n                            arg_13['value'] = arg_12\n                            arg_13['record'] = arg_2\n                            if arg_5 is not None: arg_13['context'] = arg_5\n                        yield arg_13\n                    except Exception as e:\n                        if arg_4:\n                            arg_13 = {'code': UNEXPECTED_EXCEPTION}\n                            if not arg_3:\n                                arg_13['message'] = MESSAGES[UNEXPECTED_EXCEPTION] % (e.__class__.__name__, e)\n                                arg_13['row'] = arg_1 + 1\n                                arg_13['column'] = arg_11 + 1\n                                arg_13['field'] = arg_6\n                                arg_13['value'] = arg_12\n                                arg_13['record'] = arg_2\n                                arg_13['exception'] = e\n                                arg_13['function'] = '%s: %s' % (arg_7.__name__,\n                                                            arg_7.__doc__)\n                                if arg_5 is not None: arg_13['context'] = arg_5\n                            yield arg_13", "path": "csvvalidator.py", "identifier": "CSVValidator._apply_value_checks", "docstring": "Apply value check functions on the given record `r`.", "docstring_tokens": ["Apply", "value", "check", "functions", "on", "the", "given", "record", "r", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 255037}
{"url": "https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L290-L297", "sha": "8170e431362dc760589f7d141090fd133dece259", "docstring_summary": "Sets the fields.", "language": "python", "parameters": "(self, fields = None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_0", ".", "fields", "=", "[", "]", "if", "arg_1", "!=", "None", ":", "for", "arg_3", "in", "arg_1", ":", "arg_0", ".", "fields", ".", "append", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1 = None, **arg_2):\n    \"\"\"\n    Sets the fields.\n    \"\"\"\n    arg_0.fields = []\n    if arg_1 != None:\n      for arg_3 in arg_1: \n        arg_0.fields.append(arg_3)", "path": "argiope/mesh.py", "identifier": "Mesh.set_fields", "docstring": "Sets the fields.", "docstring_tokens": ["Sets", "the", "fields", "."], "nwo": "lcharleux/argiope", "score": 0.17185066990864498, "idx": 255038}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/clients/vault.py#L131-L136", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Read data from Vault. Returns the JSON-decoded response.", "language": "python", "parameters": "(self, path, **params)", "return_statement": "return d.addCallback(self._handle_response)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "request", "(", "'GET'", ",", "'/v1/'", "+", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_3", ".", "addCallback", "(", "arg_0", ".", "_handle_response", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Read data from Vault. Returns the JSON-decoded response.\n        \"\"\"\n        arg_3 = arg_0.request('GET', '/v1/' + arg_1, arg_2=arg_2)\n        return arg_3.addCallback(arg_0._handle_response)", "path": "marathon_acme/clients/vault.py", "identifier": "VaultClient.read", "docstring": "Read data from Vault. Returns the JSON-decoded response.", "docstring_tokens": ["Read", "data", "from", "Vault", ".", "Returns", "the", "JSON", "-", "decoded", "response", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 255039}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L837-L848", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle successful disco response.", "language": "python", "parameters": "(self,stanza)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "disco_class", "(", "arg_1", ".", "get_query", "(", ")", ")", "arg_0", ".", "got_it", "(", "arg_2", ")", "except", "ValueError", ",", "e", ":", "arg_0", ".", "error", "(", "e", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Handle successful disco response.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.stanza.Stanza`\"\"\"\n        try:\n            arg_2=arg_0.disco_class(arg_1.get_query())\n            arg_0.got_it(arg_2)\n        except ValueError,e:\n            arg_0.error(e)", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoCacheFetcherBase.__response", "docstring": "Handle successful disco response.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.stanza.Stanza`", "docstring_tokens": ["Handle", "successful", "disco", "response", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255040}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L855-L922", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Level-2 parser for arrays.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "__consume", "(", ")", "except", "DXParserNoTokens", ":", "return", "if", "arg_1", ".", "equals", "(", "'type'", ")", ":", "arg_1", "=", "arg_0", ".", "__consume", "(", ")", "if", "not", "arg_1", ".", "iscode", "(", "'STRING'", ")", ":", "raise", "DXParseError", "(", "'array: type was \"%s\", not a string.'", "%", "arg_1", ".", "text", ")", "arg_0", ".", "currentobject", "[", "'type'", "]", "=", "arg_1", ".", "value", "(", ")", "elif", "arg_1", ".", "equals", "(", "'rank'", ")", ":", "arg_1", "=", "arg_0", ".", "__consume", "(", ")", "try", ":", "arg_0", ".", "currentobject", "[", "'rank'", "]", "=", "arg_1", ".", "value", "(", "'INTEGER'", ")", "except", "ValueError", ":", "raise", "DXParseError", "(", "'array: rank was \"%s\", not an integer.'", "%", "arg_1", ".", "text", ")", "elif", "arg_1", ".", "equals", "(", "'items'", ")", ":", "arg_1", "=", "arg_0", ".", "__consume", "(", ")", "try", ":", "arg_0", ".", "currentobject", "[", "'size'", "]", "=", "arg_1", ".", "value", "(", "'INTEGER'", ")", "except", "ValueError", ":", "raise", "DXParseError", "(", "'array: items was \"%s\", not an integer.'", "%", "arg_1", ".", "text", ")", "elif", "arg_1", ".", "equals", "(", "'data'", ")", ":", "arg_1", "=", "arg_0", ".", "__consume", "(", ")", "if", "not", "arg_1", ".", "iscode", "(", "'STRING'", ")", ":", "raise", "DXParseError", "(", "'array: data was \"%s\", not a string.'", "%", "arg_1", ".", "text", ")", "if", "arg_1", ".", "text", "!=", "'follows'", ":", "raise", "NotImplementedError", "(", "'array: Only the \"data follows header\" format is supported.'", ")", "if", "not", "arg_0", ".", "currentobject", "[", "'size'", "]", ":", "raise", "DXParseError", "(", "\"array: missing number of items\"", ")", "arg_0", ".", "currentobject", "[", "'array'", "]", "=", "[", "]", "while", "len", "(", "arg_0", ".", "currentobject", "[", "'array'", "]", ")", "<", "arg_0", ".", "currentobject", "[", "'size'", "]", ":", "arg_0", ".", "currentobject", "[", "'array'", "]", ".", "extend", "(", "arg_0", ".", "dxfile", ".", "readline", "(", ")", ".", "strip", "(", ")", ".", "split", "(", ")", ")", "elif", "arg_1", ".", "equals", "(", "'attribute'", ")", ":", "arg_3", "=", "arg_0", ".", "__consume", "(", ")", ".", "value", "(", ")", "if", "not", "arg_0", ".", "__consume", "(", ")", ".", "equals", "(", "'string'", ")", ":", "raise", "DXParseError", "(", "'array: \"string\" expected.'", ")", "arg_4", "=", "arg_0", ".", "__consume", "(", ")", ".", "value", "(", ")", "else", ":", "raise", "DXParseError", "(", "'array: '", "+", "str", "(", "arg_1", ")", "+", "' not recognized.'", ")"], "function": "def Func(arg_0):\n        \"\"\"Level-2 parser for arrays.\n\n        pattern:\n        object 3 class array type double rank 0 items 12 data follows\n        0 2 0\n        0 0 3.6\n        0 -2.0 1e-12\n        +4.534e+01 .34534 0.43654\n        attribute \"dep\" string \"positions\"\n        \"\"\"\n        try:\n            arg_1 = arg_0.__consume()\n        except DXParserNoTokens:\n            return\n\n        if arg_1.equals('type'):\n            arg_1 = arg_0.__consume()\n            if not arg_1.iscode('STRING'):\n                raise DXParseError('array: type was \"%s\", not a string.'%\\\n                                   arg_1.text)\n            arg_0.currentobject['type'] = arg_1.value()\n        elif arg_1.equals('rank'):\n            arg_1 = arg_0.__consume()\n            try:\n                arg_0.currentobject['rank'] = arg_1.value('INTEGER')\n            except ValueError:\n                raise DXParseError('array: rank was \"%s\", not an integer.'%\\\n                                   arg_1.text)\n        elif arg_1.equals('items'):\n            arg_1 = arg_0.__consume()\n            try:\n                arg_0.currentobject['size'] = arg_1.value('INTEGER')\n            except ValueError:\n                raise DXParseError('array: items was \"%s\", not an integer.'%\\\n                                   arg_1.text)\n        elif arg_1.equals('data'):\n            arg_1 = arg_0.__consume()\n            if not arg_1.iscode('STRING'):\n                raise DXParseError('array: data was \"%s\", not a string.'%\\\n                                   arg_1.text)\n            if arg_1.text != 'follows':\n                raise NotImplementedError(\\\n                            'array: Only the \"data follows header\" format is supported.')\n            if not arg_0.currentobject['size']:\n                raise DXParseError(\"array: missing number of items\")\n            # This is the slow part.  Once we get here, we are just\n            # reading in a long list of numbers.  Conversion to floats\n            # will be done later when the numpy array is created.\n\n            # Don't assume anything about whitespace or the number of elements per row\n            arg_0.currentobject['array'] = []\n            while len(arg_0.currentobject['array']) <arg_0.currentobject['size']:\n                 arg_0.currentobject['array'].extend(arg_0.dxfile.readline().strip().split())\n\n            # If you assume that there are three elements per row\n            # (except the last) the following version works and is a little faster.\n            # for i in range(int(numpy.ceil(self.currentobject['size']/3))):\n            #     self.currentobject['array'].append(self.dxfile.readline())\n            # self.currentobject['array'] = ' '.join(self.currentobject['array']).split()\n        elif arg_1.equals('attribute'):\n            # not used at the moment\n            arg_3 = arg_0.__consume().value()\n            if not arg_0.__consume().equals('string'):\n                raise DXParseError('array: \"string\" expected.')\n            arg_4 = arg_0.__consume().value()\n        else:\n            raise DXParseError('array: '+str(arg_1)+' not recognized.')", "path": "gridData/OpenDX.py", "identifier": "DXParser.__array", "docstring": "Level-2 parser for arrays.\n\n        pattern:\n        object 3 class array type double rank 0 items 12 data follows\n        0 2 0\n        0 0 3.6\n        0 -2.0 1e-12\n        +4.534e+01 .34534 0.43654\n        attribute \"dep\" string \"positions\"", "docstring_tokens": ["Level", "-", "2", "parser", "for", "arrays", "."], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 255041}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/pp.py#L40-L61", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Try to pretty print a simple case where a list is not nested.\n    Return True if we can do it and False if not.", "language": "python", "parameters": "(val, displaywidth, msg_nocr, msg, lineprefix='')", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "''", ")", ":", "if", "type", "(", "arg_0", ")", "!=", "list", ":", "return", "False", "arg_5", "=", "True", "for", "arg_6", "in", "range", "(", "len", "(", "arg_0", ")", ")", ":", "if", "not", "(", "type", "(", "arg_0", "[", "arg_6", "]", ")", "in", "[", "bool", ",", "float", ",", "int", "]", ")", ":", "arg_5", "=", "False", "if", "not", "(", "type", "(", "arg_0", "[", "arg_6", "]", ")", "in", "[", "bool", ",", "float", ",", "int", ",", "bytes", "]", ")", ":", "return", "False", "pass", "pass", "arg_7", "=", "columnize", "(", "[", "repr", "(", "v", ")", "for", "v", "in", "arg_0", "]", ",", "opts", "=", "{", "\"arrange_array\"", ":", "True", ",", "\"lineprefix\"", ":", "arg_4", ",", "\"displaywidth\"", ":", "int", "(", "arg_1", ")", "-", "3", ",", "'ljust'", ":", "not", "arg_5", "}", ")", "arg_2", "(", "arg_7", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=''):\n    '''Try to pretty print a simple case where a list is not nested.\n    Return True if we can do it and False if not. '''\n\n    if type(arg_0) != list:\n        return False\n\n    arg_5 = True\n    for arg_6 in range(len(arg_0)):\n        if not (type(arg_0[arg_6]) in [bool, float, int]):\n            arg_5 = False\n            if not (type(arg_0[arg_6]) in [bool, float, int, bytes]):\n                return False\n            pass\n        pass\n    arg_7 = columnize([repr(v) for v in arg_0],\n                     opts={\"arrange_array\": True,\n                           \"lineprefix\": arg_4,\n                           \"displaywidth\": int(arg_1)-3,\n                           'ljust': not arg_5})\n    arg_2(arg_7)\n    return True", "path": "trepan/lib/pp.py", "identifier": "pprint_simple_array", "docstring": "Try to pretty print a simple case where a list is not nested.\n    Return True if we can do it and False if not.", "docstring_tokens": ["Try", "to", "pretty", "print", "a", "simple", "case", "where", "a", "list", "is", "not", "nested", ".", "Return", "True", "if", "we", "can", "do", "it", "and", "False", "if", "not", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 255042}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L148-L160", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Wrapper for _log_counter_per_token.", "language": "python", "parameters": "(token)", "return_statement": "return _log_counter_per_token[token]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "global", "arg_1", "arg_1", "[", "arg_0", "]", "=", "1", "+", "arg_1", ".", "get", "(", "arg_0", ",", "-", "1", ")", "return", "arg_1", "[", "arg_0", "]"], "function": "def Func(arg_0):\n    \"\"\"Wrapper for _log_counter_per_token.\n\n    Args:\n    token: The token for which to look up the count.\n\n    Returns:\n    The number of times this function has been called with\n    *token* as an argument (starting at 0)\n    \"\"\"\n    global arg_1  # pylint: disable=global-variable-not-assigned\n    arg_1[arg_0] = 1 + arg_1.get(arg_0, -1)\n    return arg_1[arg_0]", "path": "tensorlayer/logging/tl_logging.py", "identifier": "_GetNextLogCountPerToken", "docstring": "Wrapper for _log_counter_per_token.\n\n    Args:\n    token: The token for which to look up the count.\n\n    Returns:\n    The number of times this function has been called with\n    *token* as an argument (starting at 0)", "docstring_tokens": ["Wrapper", "for", "_log_counter_per_token", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 255043}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/movies.py#L70-L85", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the alternative titles for a specific movie id.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the alternative titles for a specific movie id.\n\n        Args:\n            country: (optional) ISO 3166-1 code.\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/movies.py", "identifier": "Movies.alternative_titles", "docstring": "Get the alternative titles for a specific movie id.\n\n        Args:\n            country: (optional) ISO 3166-1 code.\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "alternative", "titles", "for", "a", "specific", "movie", "id", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 255044}
{"url": "https://github.com/memsql/memsql-python/blob/aac223a1b937d5b348b42af3c601a6c685ca633a/memsql/common/random_aggregator_pool.py#L66-L99", "sha": "aac223a1b937d5b348b42af3c601a6c685ca633a", "docstring_summary": "Returns an aggregator connection.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "_lock", ":", "if", "arg_0", ".", "_aggregator", ":", "try", ":", "return", "arg_0", ".", "_poolFunc", "(", "arg_0", ".", "_aggregator", ")", "except", "PoolConnectionException", ":", "arg_0", ".", "_aggregator", "=", "None", "if", "not", "len", "(", "arg_0", ".", "_aggregators", ")", ":", "with", "arg_0", ".", "_poolFunc", "(", "arg_0", ".", "_primary_aggregator", ")", "as", "conn", ":", "arg_0", ".", "_update_aggregator_list", "(", "conn", ")", "conn", ".", "expire", "(", ")", "random", ".", "shuffle", "(", "arg_0", ".", "_aggregators", ")", "arg_2", "=", "None", "for", "arg_3", "in", "arg_0", ".", "_aggregators", ":", "arg_0", ".", "logger", ".", "debug", "(", "'Attempting connection with %s:%s'", "%", "(", "arg_3", "[", "0", "]", ",", "arg_3", "[", "1", "]", ")", ")", "try", ":", "conn", "=", "arg_0", ".", "_poolFunc", "(", "arg_3", ")", "arg_0", ".", "_aggregator", "=", "arg_3", "return", "conn", "except", "PoolConnectionException", "as", "e", ":", "arg_2", "=", "e", "else", ":", "arg_0", ".", "_aggregator", "=", "None", "arg_0", ".", "_aggregators", "=", "[", "]", "raise", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" Returns an aggregator connection. \"\"\"\n        with arg_0._lock:\n            if arg_0._aggregator:\n                try:\n                    return arg_0._poolFunc(arg_0._aggregator)\n                except PoolConnectionException:\n                    arg_0._aggregator = None\n\n            if not len(arg_0._aggregators):\n                with arg_0._poolFunc(arg_0._primary_aggregator) as conn:\n                    arg_0._update_aggregator_list(conn)\n                    conn.expire()\n\n            random.shuffle(arg_0._aggregators)\n\n            arg_2 = None\n            for arg_3 in arg_0._aggregators:\n                arg_0.logger.debug('Attempting connection with %s:%s' % (arg_3[0], arg_3[1]))\n\n                try:\n                    conn = arg_0._poolFunc(arg_3)\n                    # connection successful!\n                    arg_0._aggregator = arg_3\n                    return conn\n                except PoolConnectionException as e:\n                    # connection error\n                    arg_2 = e\n            else:\n                # bad news bears...  try again later\n                arg_0._aggregator = None\n                arg_0._aggregators = []\n\n                raise arg_2", "path": "memsql/common/random_aggregator_pool.py", "identifier": "RandomAggregatorPool._connect", "docstring": "Returns an aggregator connection.", "docstring_tokens": ["Returns", "an", "aggregator", "connection", "."], "nwo": "memsql/memsql-python", "score": 0.6220444802454773, "idx": 255045}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L1803-L1822", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Translate the passed serial block into string only JSON.", "language": "python", "parameters": "(self, def_buf)", "return_statement": "return json.dumps(ret_dict, indent=4)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "SerialBlock", "(", ")", "arg_2", "[", "arg_3", ".", "Meter_Address", "]", "=", "arg_0", ".", "getMeterAddress", "(", ")", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "arg_5", ".", "upper", "(", ")", "if", "not", "\"RESERVED\"", "in", "arg_6", "and", "not", "\"CRC\"", "in", "arg_6", ":", "arg_2", "[", "arg_7", "(", "arg_5", ")", "]", "=", "arg_1", "[", "arg_5", "]", "[", "MeterData", ".", "StringValue", "]", "except", ":", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ".", "exc_info", "(", ")", ")", ")", "return", "\"\"", "return", "json", ".", "dumps", "(", "arg_2", ",", "indent", "=", "4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Translate the passed serial block into string only JSON.\n\n        Args:\n            def_buf (SerialBlock): Any :class:`~ekmmeters.SerialBlock` object.\n\n        Returns:\n            str: JSON rendering of meter record.\n        \"\"\"\n        try:\n            arg_2 = SerialBlock()\n            arg_2[arg_3.Meter_Address] = arg_0.getMeterAddress()\n            for arg_5 in arg_1:\n                arg_6 = arg_5.upper()\n                if not \"RESERVED\" in arg_6 and not \"CRC\" in arg_6:\n                    arg_2[arg_7(arg_5)] = arg_1[arg_5][MeterData.StringValue]\n        except:\n            ekm_log(traceback.format_exc(sys.exc_info()))\n            return \"\"\n        return json.dumps(arg_2, indent=4)", "path": "ekmmeters.py", "identifier": "Meter.jsonRender", "docstring": "Translate the passed serial block into string only JSON.\n\n        Args:\n            def_buf (SerialBlock): Any :class:`~ekmmeters.SerialBlock` object.\n\n        Returns:\n            str: JSON rendering of meter record.", "docstring_tokens": ["Translate", "the", "passed", "serial", "block", "into", "string", "only", "JSON", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 255046}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L121-L137", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Return a distance matrix keyed by the keys in the given dict.", "language": "python", "parameters": "(dict_of_sets: Mapping[X, Set])", "return_statement": "return dict(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", "]", ")", "->", "arg_1", "[", "arg_2", ",", "arg_1", "[", "arg_2", ",", "float", "]", "]", ":", "arg_4", ":", "Dict", "[", "arg_2", ",", "Dict", "[", "arg_2", ",", "float", "]", "]", "=", "defaultdict", "(", "dict", ")", "for", "arg_5", ",", "arg_6", "in", "itt", ".", "combinations", "(", "arg_0", ",", "2", ")", ":", "arg_4", "[", "arg_5", "]", "[", "arg_6", "]", "=", "arg_4", "[", "arg_6", "]", "[", "arg_5", "]", "=", "tanimoto_set_similarity", "(", "arg_0", "[", "arg_5", "]", ",", "arg_0", "[", "arg_6", "]", ")", "for", "arg_5", "in", "arg_0", ":", "arg_4", "[", "arg_5", "]", "[", "arg_5", "]", "=", "1.0", "return", "dict", "(", "arg_4", ")"], "function": "def Func(arg_0: arg_1[arg_2, arg_3]) -> arg_1[arg_2, arg_1[arg_2, float]]:\n    \"\"\"Return a distance matrix keyed by the keys in the given dict.\n\n    Distances are calculated based on pairwise tanimoto similarity of the sets contained.\n\n    :param dict_of_sets: A dict of {x: set of y}\n    :return: A similarity matrix based on the set overlap (tanimoto) score between each x as a dict of dicts\n    \"\"\"\n    arg_4: Dict[arg_2, Dict[arg_2, float]] = defaultdict(dict)\n\n    for arg_5, arg_6 in itt.combinations(arg_0, 2):\n        arg_4[arg_5][arg_6] = arg_4[arg_6][arg_5] = tanimoto_set_similarity(arg_0[arg_5], arg_0[arg_6])\n\n    for arg_5 in arg_0:\n        arg_4[arg_5][arg_5] = 1.0\n\n    return dict(arg_4)", "path": "src/pybel_tools/utils.py", "identifier": "calculate_tanimoto_set_distances", "docstring": "Return a distance matrix keyed by the keys in the given dict.\n\n    Distances are calculated based on pairwise tanimoto similarity of the sets contained.\n\n    :param dict_of_sets: A dict of {x: set of y}\n    :return: A similarity matrix based on the set overlap (tanimoto) score between each x as a dict of dicts", "docstring_tokens": ["Return", "a", "distance", "matrix", "keyed", "by", "the", "keys", "in", "the", "given", "dict", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255047}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/stages.py#L235-L251", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Construct and configure a stage from known stages.", "language": "python", "parameters": "(self, name, config)", "return_statement": "return ctor(subconfig)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "get", "(", "arg_1", ",", "{", "}", ")", "arg_4", "=", "arg_0", "[", "arg_1", "]", "return", "arg_4", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n\n        '''Construct and configure a stage from known stages.\n\n        `name` must be the name of one of the stages in this.  `config`\n        is the configuration dictionary of the containing object, and its `name`\n        member will be passed into the stage constructor.\n\n        :param str name: name of the stage\n        :param dict config: parent object configuration\n        :return: callable stage\n        :raise exceptions.KeyError: if `name` is not a known stage\n\n        '''\n        arg_3 = arg_2.get(arg_1, {})\n        arg_4 = arg_0[arg_1]\n        return arg_4(arg_3)", "path": "streamcorpus_pipeline/stages.py", "identifier": "StageRegistry.init_stage", "docstring": "Construct and configure a stage from known stages.\n\n        `name` must be the name of one of the stages in this.  `config`\n        is the configuration dictionary of the containing object, and its `name`\n        member will be passed into the stage constructor.\n\n        :param str name: name of the stage\n        :param dict config: parent object configuration\n        :return: callable stage\n        :raise exceptions.KeyError: if `name` is not a known stage", "docstring_tokens": ["Construct", "and", "configure", "a", "stage", "from", "known", "stages", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 255048}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/delete/delete_command.py#L79-L88", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Delete all genes in the database", "language": "python", "parameters": "(context, build)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "\"Running scout delete Func\"", ")", "arg_2", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "if", "arg_1", ":", "LOG", ".", "info", "(", "\"Dropping Func collection for build: %s\"", ",", "arg_1", ")", "else", ":", "LOG", ".", "info", "(", "\"Dropping Func collection\"", ")", "arg_2", ".", "drop_Func", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Delete all Func in the database\"\"\"\n    LOG.info(\"Running scout delete Func\")\n    arg_2 = arg_0.obj['adapter']\n\n    if arg_1:\n        LOG.info(\"Dropping Func collection for build: %s\", arg_1)\n    else:\n        LOG.info(\"Dropping Func collection\")\n        arg_2.drop_Func()", "path": "scout/commands/delete/delete_command.py", "identifier": "genes", "docstring": "Delete all genes in the database", "docstring_tokens": ["Delete", "all", "genes", "in", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255049}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.py#L181-L191", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Adds the specified QImage to the document and returns a\n            QTextImageFormat that references it.", "language": "python", "parameters": "(self, image)", "return_statement": "return format", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_control", ".", "document", "(", ")", "arg_3", "=", "str", "(", "arg_1", ".", "cacheKey", "(", ")", ")", "arg_2", ".", "addResource", "(", "QtGui", ".", "QTextDocument", ".", "ImageResource", ",", "QtCore", ".", "QUrl", "(", "arg_3", ")", ",", "arg_1", ")", "arg_4", "=", "QtGui", ".", "QTextImageFormat", "(", ")", "arg_4", ".", "setName", "(", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Adds the specified QImage to the document and returns a\n            QTextImageFormat that references it.\n        \"\"\"\n        arg_2 = arg_0._control.document()\n        arg_3 = str(arg_1.cacheKey())\n        arg_2.addResource(QtGui.QTextDocument.ImageResource,\n                             QtCore.QUrl(arg_3), arg_1)\n        arg_4 = QtGui.QTextImageFormat()\n        arg_4.setName(arg_3)\n        return arg_4", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.py", "identifier": "RichIPythonWidget._add_image", "docstring": "Adds the specified QImage to the document and returns a\n            QTextImageFormat that references it.", "docstring_tokens": ["Adds", "the", "specified", "QImage", "to", "the", "document", "and", "returns", "a", "QTextImageFormat", "that", "references", "it", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255050}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Parser.py#L145-L153", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Parse a row.", "language": "python", "parameters": "(self, values)", "return_statement": "return row", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_to_id", "(", "arg_1", "[", "ID", "]", ")", "arg_3", "=", "arg_0", ".", "_spec", ".", "newFunc", "(", "arg_2", ",", "arg_1", ",", "arg_0", ")", "if", "SAME_AS", "in", "arg_1", ":", "arg_0", ".", "_delay_inheritance", "(", "arg_3", ",", "arg_0", ".", "_to_id", "(", "arg_1", "[", "SAME_AS", "]", ")", ")", "arg_0", ".", "_delay_instructions", "(", "arg_3", ")", "arg_0", ".", "_id_cache", "[", "arg_2", "]", "=", "arg_3", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parse a row.\"\"\"\n        arg_2 = arg_0._to_id(arg_1[ID])\n        arg_3 = arg_0._spec.newFunc(arg_2, arg_1, arg_0)\n        if SAME_AS in arg_1:\n            arg_0._delay_inheritance(arg_3, arg_0._to_id(arg_1[SAME_AS]))\n        arg_0._delay_instructions(arg_3)\n        arg_0._id_cache[arg_2] = arg_3\n        return arg_3", "path": "knittingpattern/Parser.py", "identifier": "Parser._row", "docstring": "Parse a row.", "docstring_tokens": ["Parse", "a", "row", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 255051}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/vector.py#L98-L100", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Creates a new vector.", "language": "python", "parameters": "(members: Iterable[T], meta: Optional[IPersistentMap] = None)", "return_statement": "return Vector(pvector(members), meta=meta)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "arg_3", ":", "arg_4", "[", "arg_5", "]", "=", "None", ")", "->", "Vector", "[", "arg_2", "]", ":", "return", "Vector", "(", "pFunc", "(", "arg_0", ")", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0: arg_1[arg_2], arg_3: arg_4[arg_5] = None) -> Vector[arg_2]:\n    \"\"\"Creates a new Func.\"\"\"\n    return Vector(pFunc(arg_0), arg_3=arg_3)", "path": "src/basilisp/lang/vector.py", "identifier": "vector", "docstring": "Creates a new vector.", "docstring_tokens": ["Creates", "a", "new", "vector", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255052}
{"url": "https://github.com/Kappa-Dev/KaSim/blob/12a01c616a47e3046323103625795fb2fca8273a/python/kappy/kappa_common.py#L318-L332", "sha": "12a01c616a47e3046323103625795fb2fca8273a", "docstring_summary": "Block until the simulation is done or timeout seconds exceeded.", "language": "python", "parameters": "(self, timeout=None)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "datetime", ".", "now", "(", ")", "while", "arg_0", ".", "get_is_sim_running", "(", ")", ":", "sleep", "(", "0.5", ")", "if", "arg_1", "is", "not", "None", ":", "if", "(", "datetime", ".", "now", "(", ")", "-", "arg_2", ")", ".", "seconds", ">=", "arg_1", ":", "arg_3", "=", "None", "break", "else", ":", "arg_3", "=", "arg_0", ".", "simulation_info", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Block until the simulation is done or timeout seconds exceeded.\n\n        If the simulation stops before timeout, siminfo is returned.\n        \"\"\"\n        arg_2 = datetime.now()\n        while arg_0.get_is_sim_running():\n            sleep(0.5)\n            if arg_1 is not None:\n                if (datetime.now() - arg_2).seconds >= arg_1:\n                    arg_3 = None\n                    break\n        else:\n            arg_3 = arg_0.simulation_info()\n        return arg_3", "path": "python/kappy/kappa_common.py", "identifier": "KappaApi.wait_for_simulation_stop", "docstring": "Block until the simulation is done or timeout seconds exceeded.\n\n        If the simulation stops before timeout, siminfo is returned.", "docstring_tokens": ["Block", "until", "the", "simulation", "is", "done", "or", "timeout", "seconds", "exceeded", "."], "nwo": "Kappa-Dev/KaSim", "score": 0.5441421983768713, "idx": 255053}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L205-L277", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse information about variants.", "language": "python", "parameters": "(store, institute_obj, case_obj, variant_obj, update=False, genome_build='37',\n                  get_compounds = True)", "return_statement": "return variant_obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ",", "arg_5", "=", "'37'", ",", "arg_6", "=", "True", ")", ":", "arg_7", "=", "False", "arg_8", "=", "arg_3", ".", "get", "(", "'compounds'", ",", "[", "]", ")", "if", "arg_8", "and", "arg_6", ":", "if", "'not_loaded'", "not", "in", "arg_8", "[", "0", "]", ":", "arg_9", "=", "arg_0", ".", "update_variant_compounds", "(", "arg_3", ")", "arg_3", "[", "'compounds'", "]", "=", "arg_9", "arg_7", "=", "True", "arg_3", "[", "'compounds'", "]", "=", "sorted", "(", "arg_3", "[", "'compounds'", "]", ",", "key", "=", "lambda", "compound", ":", "-", "compound", "[", "'combined_score'", "]", ")", "arg_10", "=", "arg_3", ".", "get", "(", "'genes'", ")", "if", "arg_10", "is", "not", "None", ":", "for", "arg_11", "in", "arg_10", ":", "if", "not", "arg_11", "[", "'hgnc_id'", "]", ":", "continue", "if", "arg_11", ".", "get", "(", "'hgnc_symbol'", ")", "is", "None", ":", "arg_12", "=", "arg_0", ".", "hgnc_gene", "(", "arg_11", "[", "'hgnc_id'", "]", ",", "build", "=", "arg_5", ")", "if", "not", "arg_12", ":", "continue", "arg_7", "=", "True", "arg_11", "[", "'hgnc_symbol'", "]", "=", "arg_12", "[", "'hgnc_symbol'", "]", "if", "arg_4", "and", "arg_7", ":", "arg_3", "=", "arg_0", ".", "update_variant", "(", "arg_3", ")", "arg_3", "[", "'comments'", "]", "=", "arg_0", ".", "events", "(", "arg_1", ",", "case", "=", "arg_2", ",", "variant_id", "=", "arg_3", "[", "'variant_id'", "]", ",", "comments", "=", "True", ")", "if", "arg_10", ":", "arg_3", ".", "update", "(", "get_predictions", "(", "arg_10", ")", ")", "if", "arg_3", ".", "get", "(", "'category'", ")", "==", "'cancer'", ":", "arg_3", ".", "update", "(", "get_variant_info", "(", "arg_10", ")", ")", "for", "arg_13", "in", "arg_8", ":", "arg_13", ".", "update", "(", "get_predictions", "(", "arg_13", ".", "get", "(", "'genes'", ",", "[", "]", ")", ")", ")", "if", "isinstance", "(", "arg_3", ".", "get", "(", "'acmg_classification'", ")", ",", "int", ")", ":", "arg_14", "=", "ACMG_MAP", "[", "arg_3", "[", "'acmg_classification'", "]", "]", "arg_3", "[", "'acmg_classification'", "]", "=", "ACMG_COMPLETE_MAP", "[", "arg_14", "]", "arg_15", "=", "arg_3", ".", "get", "(", "'length'", ")", "arg_3", "[", "'length'", "]", "=", "{", "100000000000", ":", "'inf'", ",", "-", "1", ":", "'n.d.'", "}", ".", "get", "(", "arg_15", ",", "arg_15", ")", "if", "not", "'end_chrom'", "in", "arg_3", ":", "arg_3", "[", "'end_chrom'", "]", "=", "arg_3", "[", "'chromosome'", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False, arg_5='37',\n                  arg_6 = True):\n    \"\"\"Parse information about variants.\n\n    - Adds information about compounds\n    - Updates the information about compounds if necessary and 'update=True'\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        institute_obj(scout.models.Institute)\n        case_obj(scout.models.Case)\n        variant_obj(scout.models.Variant)\n        update(bool): If variant should be updated in database\n        genome_build(str)\n\n    \"\"\"\n    arg_7 = False\n    arg_8 = arg_3.get('compounds', [])\n    if arg_8 and arg_6:\n        # Check if we need to add compound information\n        # If it is the first time the case is viewed we fill in some compound information\n        if 'not_loaded' not in arg_8[0]:\n            arg_9 = arg_0.update_variant_compounds(arg_3)\n            arg_3['compounds'] = arg_9\n            arg_7 = True\n\n        # sort compounds on combined rank score\n        arg_3['compounds'] = sorted(arg_3['compounds'],\n                                          key=lambda compound: -compound['combined_score'])\n\n    # Update the hgnc symbols if they are incorrect\n    arg_10 = arg_3.get('genes')\n    if arg_10 is not None:\n        for arg_11 in arg_10:\n            # If there is no hgnc id there is nothin we can do\n            if not arg_11['hgnc_id']:\n                continue\n            # Else we collect the gene object and check the id\n            if arg_11.get('hgnc_symbol') is None:\n                arg_12 = arg_0.hgnc_gene(arg_11['hgnc_id'], build=arg_5)\n                if not arg_12:\n                    continue\n                arg_7 = True\n                arg_11['hgnc_symbol'] = arg_12['hgnc_symbol']\n\n    # We update the variant if some information was missing from loading\n    # Or if symbold in reference genes have changed\n    if arg_4 and arg_7:\n        arg_3 = arg_0.update_variant(arg_3)\n\n    arg_3['comments'] = arg_0.events(arg_1, case=arg_2,\n                                           variant_id=arg_3['variant_id'], comments=True)\n\n    if arg_10:\n        arg_3.update(get_predictions(arg_10))\n        if arg_3.get('category') == 'cancer':\n            arg_3.update(get_variant_info(arg_10))\n\n    for arg_13 in arg_8:\n        arg_13.update(get_predictions(arg_13.get('genes', [])))\n\n    if isinstance(arg_3.get('acmg_classification'), int):\n        arg_14 = ACMG_MAP[arg_3['acmg_classification']]\n        arg_3['acmg_classification'] = ACMG_COMPLETE_MAP[arg_14]\n\n\n    # convert length for SV variants\n    arg_15 = arg_3.get('length')\n    arg_3['length'] = {100000000000: 'inf', -1: 'n.d.'}.get(arg_15, arg_15)\n    if not 'end_chrom' in arg_3:\n        arg_3['end_chrom'] = arg_3['chromosome']\n\n    return arg_3", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "parse_variant", "docstring": "Parse information about variants.\n\n    - Adds information about compounds\n    - Updates the information about compounds if necessary and 'update=True'\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        institute_obj(scout.models.Institute)\n        case_obj(scout.models.Case)\n        variant_obj(scout.models.Variant)\n        update(bool): If variant should be updated in database\n        genome_build(str)", "docstring_tokens": ["Parse", "information", "about", "variants", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255054}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L127-L150", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Calculate the percentage of each status.", "language": "python", "parameters": "(cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"up\"", ":", "PyFunceble", ".", "INTERN", "[", "\"counter\"", "]", "[", "\"number\"", "]", "[", "\"up\"", "]", ",", "\"down\"", ":", "PyFunceble", ".", "INTERN", "[", "\"counter\"", "]", "[", "\"number\"", "]", "[", "\"down\"", "]", ",", "\"invalid\"", ":", "PyFunceble", ".", "INTERN", "[", "\"counter\"", "]", "[", "\"number\"", "]", "[", "\"invalid\"", "]", ",", "}", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "(", "arg_1", "[", "arg_2", "]", "*", "100", "//", "PyFunceble", ".", "INTERN", "[", "\"counter\"", "]", "[", "\"number\"", "]", "[", "\"tested\"", "]", ")", "PyFunceble", ".", "INTERN", "[", "\"counter\"", "]", "[", "\"percentage\"", "]", ".", "update", "(", "{", "arg_2", ":", "arg_3", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Calculate the percentage of each status.\n        \"\"\"\n\n        # We map the current state/counters of the different status.\n        arg_1 = {\n            \"up\": PyFunceble.INTERN[\"counter\"][\"number\"][\"up\"],\n            \"down\": PyFunceble.INTERN[\"counter\"][\"number\"][\"down\"],\n            \"invalid\": PyFunceble.INTERN[\"counter\"][\"number\"][\"invalid\"],\n        }\n\n        for arg_2 in arg_1:\n            # We loop through our map index.\n\n            # We calculate the percentage.\n            arg_3 = (\n                arg_1[arg_2]\n                * 100\n                // PyFunceble.INTERN[\"counter\"][\"number\"][\"tested\"]\n            )\n\n            # And we update the percentage counter of the actual status.\n            PyFunceble.INTERN[\"counter\"][\"percentage\"].update({arg_2: arg_3})", "path": "PyFunceble/percentage.py", "identifier": "Percentage._calculate", "docstring": "Calculate the percentage of each status.", "docstring_tokens": ["Calculate", "the", "percentage", "of", "each", "status", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 255055}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L827-L843", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Return all items.", "language": "python", "parameters": "(self, name, token=None)", "return_statement": "return response['items']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "dict", "(", ")", "arg_3", "[", "'name'", "]", "=", "arg_1", "if", "arg_2", ":", "arg_3", "[", "'token'", "]", "=", "arg_2", "arg_4", "=", "arg_0", ".", "request", "(", "'midas.item.searchbyname'", ",", "arg_3", ")", "return", "arg_4", "[", "'items'", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Return all items.\n\n        :param name: The name of the item to search by.\n        :type name: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: A list of all items with the given name.\n        :rtype: list[dict]\n        \"\"\"\n        arg_3 = dict()\n        arg_3['name'] = arg_1\n        if arg_2:\n            arg_3['token'] = arg_2\n        arg_4 = arg_0.request('midas.item.searchbyname', arg_3)\n        return arg_4['items']", "path": "pydas/drivers.py", "identifier": "CoreDriver.search_item_by_name", "docstring": "Return all items.\n\n        :param name: The name of the item to search by.\n        :type name: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: A list of all items with the given name.\n        :rtype: list[dict]", "docstring_tokens": ["Return", "all", "items", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 255056}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/mixture.py#L235-L248", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Expand the rank of x up to static_event_rank times for broadcasting.", "language": "python", "parameters": "(self, x)", "return_statement": "return expanded_x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "for", "arg_3", "in", "range", "(", "tensorshape_util", ".", "rank", "(", "arg_0", ".", "event_shape", ")", ")", ":", "arg_2", "=", "tf", ".", "expand_dims", "(", "arg_2", ",", "-", "1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Expand the rank of x up to static_event_rank times for broadcasting.\n\n    The static event rank was checked to not be None at construction time.\n\n    Args:\n      x: A tensor to expand.\n    Returns:\n      The expanded tensor.\n    \"\"\"\n    arg_2 = arg_1\n    for arg_3 in range(tensorshape_util.rank(arg_0.event_shape)):\n      arg_2 = tf.expand_dims(arg_2, -1)\n    return arg_2", "path": "tensorflow_probability/python/distributions/mixture.py", "identifier": "Mixture._expand_to_event_rank", "docstring": "Expand the rank of x up to static_event_rank times for broadcasting.\n\n    The static event rank was checked to not be None at construction time.\n\n    Args:\n      x: A tensor to expand.\n    Returns:\n      The expanded tensor.", "docstring_tokens": ["Expand", "the", "rank", "of", "x", "up", "to", "static_event_rank", "times", "for", "broadcasting", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255057}
{"url": "https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/models/profile.py#L36-L50", "sha": "6c9236fd3b6a8f9e2d70dbf1bc01529242b73075", "docstring_summary": "Set the posting schedules for the specified social media profile.", "language": "python", "parameters": "(self, schedules)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_2", "=", "PATHS", "[", "'UPDATE_SCHEDULES'", "]", "%", "arg_0", ".", "id", "arg_3", "=", "\"schedules[0][%s][]=%s&\"", "arg_4", "=", "\"\"", "for", "arg_5", ",", "arg_6", "in", "Func", ".", "iteritems", "(", ")", ":", "for", "arg_7", "in", "arg_6", ":", "arg_4", "+=", "arg_3", "%", "(", "arg_5", ",", "arg_7", ")", "arg_0", ".", "api", ".", "post", "(", "arg_2", "=", "arg_2", ",", "data", "=", "arg_4", ")"], "function": "def Func(arg_0, Func):\n    '''\n      Set the posting schedules for the specified social media profile.\n    '''\n\n    arg_2 = PATHS['UPDATE_SCHEDULES'] % arg_0.id\n\n    arg_3 = \"schedules[0][%s][]=%s&\"\n    arg_4 = \"\"\n\n    for arg_5, arg_6 in Func.iteritems():\n      for arg_7 in arg_6:\n        arg_4 += arg_3 % (arg_5, arg_7)\n\n    arg_0.api.post(arg_2=arg_2, data=arg_4)", "path": "buffpy/models/profile.py", "identifier": "Profile.schedules", "docstring": "Set the posting schedules for the specified social media profile.", "docstring_tokens": ["Set", "the", "posting", "schedules", "for", "the", "specified", "social", "media", "profile", "."], "nwo": "vtemian/buffpy", "score": 0.2727920376977753, "idx": 255058}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/check_function.py#L40-L177", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Check whether a particular function is called.", "language": "python", "parameters": "(\n    state,\n    name,\n    index=0,\n    missing_msg=None,\n    params_not_matched_msg=None,\n    expand_msg=None,\n    signature=True,\n)", "return_statement": "return child", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ",", ")", ":", "arg_7", "=", "arg_3", "is", "None", "arg_8", "=", "arg_4", "is", "None", "if", "arg_3", "is", "None", ":", "arg_3", "=", "MISSING_MSG", "if", "arg_5", "is", "None", ":", "arg_5", "=", "PREPEND_MSG", "if", "arg_4", "is", "None", ":", "arg_4", "=", "SIG_ISSUE_MSG", "arg_9", "=", "arg_0", ".", "ast_dispatcher", "(", "\"function_calls\"", ",", "arg_0", ".", "student_ast", ")", "arg_10", "=", "arg_0", ".", "ast_dispatcher", "(", "\"function_calls\"", ",", "arg_0", ".", "solution_ast", ")", "arg_11", "=", "arg_0", ".", "ast_dispatcher", "(", "\"mappings\"", ",", "arg_0", ".", "student_ast", ")", "arg_12", "=", "{", "\"times\"", ":", "get_times", "(", "arg_2", "+", "1", ")", ",", "\"ord\"", ":", "get_ord", "(", "arg_2", "+", "1", ")", ",", "\"index\"", ":", "arg_2", ",", "\"mapped_name\"", ":", "get_mapped_name", "(", "arg_1", ",", "arg_11", ")", ",", "}", "try", ":", "arg_13", "=", "{", "**", "arg_10", "[", "arg_1", "]", "[", "arg_2", "]", "}", "except", "KeyError", ":", "raise", "InstructorError", "(", "\"`Func()` couldn't find a call of `%s()` in the solution code. Make sure you get the mapping right!\"", "%", "arg_1", ")", "except", "IndexError", ":", "raise", "InstructorError", "(", "\"`Func()` couldn't find %s calls of `%s()` in your solution code.\"", "%", "(", "arg_2", "+", "1", ",", "arg_1", ")", ")", "try", ":", "arg_14", "=", "{", "**", "arg_9", "[", "arg_1", "]", "[", "arg_2", "]", "}", "except", "(", "KeyError", ",", "IndexError", ")", ":", "arg_15", "=", "arg_0", ".", "build_message", "(", "arg_3", ",", "arg_12", ",", "append", "=", "arg_7", ")", "arg_0", ".", "report", "(", "Feedback", "(", "arg_15", ",", "arg_0", ")", ")", "if", "arg_6", ":", "arg_6", "=", "None", "if", "isinstance", "(", "arg_6", ",", "bool", ")", "else", "arg_6", "arg_16", "=", "partial", "(", "getSignatureInProcess", ",", "arg_1", "=", "arg_1", ",", "arg_6", "=", "arg_6", ",", "manual_sigs", "=", "arg_0", ".", "get_manual_sigs", "(", ")", ",", ")", "try", ":", "arg_17", "=", "arg_16", "(", "mapped_name", "=", "arg_13", "[", "\"name\"", "]", ",", "process", "=", "arg_0", ".", "solution_process", ")", "arg_13", "[", "\"args\"", "]", "=", "bind_args", "(", "arg_17", ",", "arg_13", "[", "\"args\"", "]", ")", "except", "Exception", "as", "e", ":", "raise", "InstructorError", "(", "\"`Func()` couldn't match the %s call of `%s` to its signature:\\n%s \"", "%", "(", "get_ord", "(", "arg_2", "+", "1", ")", ",", "arg_1", ",", "e", ")", ")", "try", ":", "arg_18", "=", "arg_16", "(", "mapped_name", "=", "arg_14", "[", "\"name\"", "]", ",", "process", "=", "arg_0", ".", "student_process", ")", "arg_14", "[", "\"args\"", "]", "=", "bind_args", "(", "arg_18", ",", "arg_14", "[", "\"args\"", "]", ")", "except", "Exception", ":", "arg_15", "=", "arg_0", ".", "build_message", "(", "arg_4", ",", "arg_12", ",", "append", "=", "arg_8", ")", "arg_0", ".", "report", "(", "Feedback", "(", "arg_15", ",", "StubState", "(", "arg_14", "[", "\"node\"", "]", ",", "arg_0", ".", "highlighting_disabled", ")", ")", ")", "arg_19", "=", "{", "\"msg\"", ":", "arg_5", ",", "\"kwargs\"", ":", "arg_12", "}", "arg_20", "=", "part_to_child", "(", "arg_14", ",", "arg_13", ",", "arg_19", ",", "arg_0", ",", "node_name", "=", "\"function_calls\"", ")", "return", "arg_20"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2=0,\n    arg_3=None,\n    arg_4=None,\n    arg_5=None,\n    arg_6=True,\n):\n    \"\"\"Check whether a particular function is called.\n\n    ``Func()`` is typically followed by:\n    \n    - ``check_args()`` to check whether the arguments were specified.\n      In turn, ``check_args()`` can be followed by ``has_equal_value()`` or ``has_equal_ast()``\n      to assert that the arguments were correctly specified.\n    - ``has_equal_value()`` to check whether rerunning the function call coded by the student\n      gives the same result as calling the function call as in the solution.\n\n    Checking function calls is a tricky topic. Please visit the\n    `dedicated article <articles/checking_function_calls.html>`_ for more explanation,\n    edge cases and best practices.\n\n    Args:\n        name (str): the name of the function to be tested. When checking functions in packages, always\n            use the 'full path' of the function.\n        index (int): index of the function call to be checked. Defaults to 0.\n        missing_msg (str): If specified, this overrides an automatically generated feedback message in case\n            the student did not call the function correctly.\n        params_not_matched_msg (str): If specified, this overrides an automatically generated feedback message\n            in case the function parameters were not successfully matched.\n        expand_msg (str): If specified, this overrides any messages that are prepended by previous SCT chains.\n        signature (Signature): Normally, Func() can figure out what the function signature is,\n            but it might be necessary to use ``sig_from_params()`` to manually build a signature and pass this along.\n        state (State): State object that is passed from the SCT Chain (don't specify this).\n\n    :Examples:\n\n        Student code and solution code::\n\n            import numpy as np\n            arr = np.array([1, 2, 3, 4, 5])\n            np.mean(arr)\n\n        SCT::\n\n            # Verify whether arr was correctly set in np.mean\n            Ex().Func('numpy.mean').check_args('a').has_equal_value()\n\n            # Verify whether np.mean(arr) produced the same result\n            Ex().Func('numpy.mean').has_equal_value()\n    \"\"\"\n\n    arg_7 = arg_3 is None\n    arg_8 = arg_4 is None\n    if arg_3 is None:\n        arg_3 = MISSING_MSG\n    if arg_5 is None:\n        arg_5 = PREPEND_MSG\n    if arg_4 is None:\n        arg_4 = SIG_ISSUE_MSG\n\n    arg_9 = arg_0.ast_dispatcher(\"function_calls\", arg_0.student_ast)\n    arg_10 = arg_0.ast_dispatcher(\"function_calls\", arg_0.solution_ast)\n\n    arg_11 = arg_0.ast_dispatcher(\"mappings\", arg_0.student_ast)\n\n    arg_12 = {\n        \"times\": get_times(arg_2 + 1),\n        \"ord\": get_ord(arg_2 + 1),\n        \"index\": arg_2,\n        \"mapped_name\": get_mapped_name(arg_1, arg_11),\n    }\n\n    # Get Parts ----\n    # Copy, otherwise signature binding overwrites sol_out[name][index]['args']\n    try:\n        arg_13 = {**arg_10[arg_1][arg_2]}\n    except KeyError:\n        raise InstructorError(\n            \"`Func()` couldn't find a call of `%s()` in the solution code. Make sure you get the mapping right!\"\n            % arg_1\n        )\n    except IndexError:\n        raise InstructorError(\n            \"`Func()` couldn't find %s calls of `%s()` in your solution code.\"\n            % (arg_2 + 1, arg_1)\n        )\n\n    try:\n        # Copy, otherwise signature binding overwrites stu_out[name][index]['args']\n        arg_14 = {**arg_9[arg_1][arg_2]}\n    except (KeyError, IndexError):\n        arg_15 = arg_0.build_message(arg_3, arg_12, append=arg_7)\n        arg_0.report(Feedback(arg_15, arg_0))\n\n    # Signatures -----\n    if arg_6:\n        arg_6 = None if isinstance(arg_6, bool) else arg_6\n        arg_16 = partial(\n            getSignatureInProcess,\n            arg_1=arg_1,\n            arg_6=arg_6,\n            manual_sigs=arg_0.get_manual_sigs(),\n        )\n\n        try:\n            arg_17 = arg_16(\n                mapped_name=arg_13[\"name\"], process=arg_0.solution_process\n            )\n            arg_13[\"args\"] = bind_args(arg_17, arg_13[\"args\"])\n        except Exception as e:\n            raise InstructorError(\n                \"`Func()` couldn't match the %s call of `%s` to its signature:\\n%s \"\n                % (get_ord(arg_2 + 1), arg_1, e)\n            )\n\n        try:\n            arg_18 = arg_16(\n                mapped_name=arg_14[\"name\"], process=arg_0.student_process\n            )\n            arg_14[\"args\"] = bind_args(arg_18, arg_14[\"args\"])\n        except Exception:\n            arg_15 = arg_0.build_message(\n                arg_4, arg_12, append=arg_8\n            )\n            arg_0.report(\n                Feedback(\n                    arg_15, StubState(arg_14[\"node\"], arg_0.highlighting_disabled)\n                )\n            )\n\n    # three types of parts: pos_args, keywords, args (e.g. these are bound to sig)\n    arg_19 = {\"msg\": arg_5, \"kwargs\": arg_12}\n    arg_20 = part_to_child(\n        arg_14, arg_13, arg_19, arg_0, node_name=\"function_calls\"\n    )\n    return arg_20", "path": "pythonwhat/checks/check_function.py", "identifier": "check_function", "docstring": "Check whether a particular function is called.\n\n    ``check_function()`` is typically followed by:\n    \n    - ``check_args()`` to check whether the arguments were specified.\n      In turn, ``check_args()`` can be followed by ``has_equal_value()`` or ``has_equal_ast()``\n      to assert that the arguments were correctly specified.\n    - ``has_equal_value()`` to check whether rerunning the function call coded by the student\n      gives the same result as calling the function call as in the solution.\n\n    Checking function calls is a tricky topic. Please visit the\n    `dedicated article <articles/checking_function_calls.html>`_ for more explanation,\n    edge cases and best practices.\n\n    Args:\n        name (str): the name of the function to be tested. When checking functions in packages, always\n            use the 'full path' of the function.\n        index (int): index of the function call to be checked. Defaults to 0.\n        missing_msg (str): If specified, this overrides an automatically generated feedback message in case\n            the student did not call the function correctly.\n        params_not_matched_msg (str): If specified, this overrides an automatically generated feedback message\n            in case the function parameters were not successfully matched.\n        expand_msg (str): If specified, this overrides any messages that are prepended by previous SCT chains.\n        signature (Signature): Normally, check_function() can figure out what the function signature is,\n            but it might be necessary to use ``sig_from_params()`` to manually build a signature and pass this along.\n        state (State): State object that is passed from the SCT Chain (don't specify this).\n\n    :Examples:\n\n        Student code and solution code::\n\n            import numpy as np\n            arr = np.array([1, 2, 3, 4, 5])\n            np.mean(arr)\n\n        SCT::\n\n            # Verify whether arr was correctly set in np.mean\n            Ex().check_function('numpy.mean').check_args('a').has_equal_value()\n\n            # Verify whether np.mean(arr) produced the same result\n            Ex().check_function('numpy.mean').has_equal_value()", "docstring_tokens": ["Check", "whether", "a", "particular", "function", "is", "called", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 255059}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ipmi.py#L27-L43", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Verify IPMI environment", "language": "python", "parameters": "()", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "cij", ".", "Func_to_dict", "(", "PREFIX", ",", "REQUIRED", ")", "if", "arg_0", "is", "None", ":", "arg_0", "[", "\"USER\"", "]", "=", "\"admin\"", "arg_0", "[", "\"PASS\"", "]", "=", "\"admin\"", "arg_0", "[", "\"HOST\"", "]", "=", "\"localhost\"", "arg_0", "[", "\"PORT\"", "]", "=", "\"623\"", "cij", ".", "info", "(", "\"ipmi.Func: USER: %s, PASS: %s, HOST: %s, PORT: %s\"", "%", "(", "arg_0", "[", "\"USER\"", "]", ",", "arg_0", "[", "\"PASS\"", "]", ",", "arg_0", "[", "\"HOST\"", "]", ",", "arg_0", "[", "\"PORT\"", "]", ")", ")", "cij", ".", "Func_export", "(", "PREFIX", ",", "EXPORTED", ",", "arg_0", ")", "return", "0"], "function": "def Func():\n    \"\"\"Verify IPMI Funcironment\"\"\"\n\n    arg_0 = cij.Func_to_dict(PREFIX, REQUIRED)\n\n    if arg_0 is None:\n        arg_0[\"USER\"] = \"admin\"\n        arg_0[\"PASS\"] = \"admin\"\n        arg_0[\"HOST\"] = \"localhost\"\n        arg_0[\"PORT\"] = \"623\"\n        cij.info(\"ipmi.Func: USER: %s, PASS: %s, HOST: %s, PORT: %s\" % (\n            arg_0[\"USER\"], arg_0[\"PASS\"], arg_0[\"HOST\"], arg_0[\"PORT\"]\n        ))\n\n    cij.Func_export(PREFIX, EXPORTED, arg_0)\n\n    return 0", "path": "modules/cij/ipmi.py", "identifier": "env", "docstring": "Verify IPMI environment", "docstring_tokens": ["Verify", "IPMI", "environment"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 255060}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L293-L299", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Process a received NAK packet.", "language": "python", "parameters": "(self, pkt)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isnak", "(", "arg_1", ")", ":", "logger", ".", "info", "(", "'DHCPNAK of %s from %s'", ",", "arg_0", ".", "client", ".", "client_ip", ",", "arg_0", ".", "client", ".", "server_ip", ")", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process a received NAK packet.\"\"\"\n        if isnak(arg_1):\n            logger.info('DHCPNAK of %s from %s',\n                        arg_0.client.client_ip, arg_0.client.server_ip)\n            return True\n        return False", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.process_received_nak", "docstring": "Process a received NAK packet.", "docstring_tokens": ["Process", "a", "received", "NAK", "packet", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 255061}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L98-L295", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Sets general options used by plugins and streams originating\n        from this session object.", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "\"rtmpdump\"", ":", "arg_1", "=", "\"rtmp-rtmpdump\"", "elif", "arg_1", "==", "\"rtmpdump-proxy\"", ":", "arg_1", "=", "\"rtmp-proxy\"", "elif", "arg_1", "==", "\"errorlog\"", ":", "arg_1", "=", "\"subprocess-errorlog\"", "elif", "arg_1", "==", "\"errorlog-path\"", ":", "arg_1", "=", "\"subprocess-errorlog-path\"", "if", "arg_1", "==", "\"http-proxy\"", ":", "arg_0", ".", "http", ".", "proxies", "[", "\"http\"", "]", "=", "update_scheme", "(", "\"http://\"", ",", "arg_2", ")", "elif", "arg_1", "==", "\"https-proxy\"", ":", "arg_0", ".", "http", ".", "proxies", "[", "\"https\"", "]", "=", "update_scheme", "(", "\"https://\"", ",", "arg_2", ")", "elif", "arg_1", "==", "\"http-cookies\"", ":", "if", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "arg_0", ".", "http", ".", "cookies", ".", "update", "(", "arg_2", ")", "else", ":", "arg_0", ".", "http", ".", "parse_cookies", "(", "arg_2", ")", "elif", "arg_1", "==", "\"http-headers\"", ":", "if", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "arg_0", ".", "http", ".", "headers", ".", "update", "(", "arg_2", ")", "else", ":", "arg_0", ".", "http", ".", "parse_headers", "(", "arg_2", ")", "elif", "arg_1", "==", "\"http-query-params\"", ":", "if", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "arg_0", ".", "http", ".", "params", ".", "update", "(", "arg_2", ")", "else", ":", "arg_0", ".", "http", ".", "parse_query_params", "(", "arg_2", ")", "elif", "arg_1", "==", "\"http-trust-env\"", ":", "arg_0", ".", "http", ".", "trust_env", "=", "arg_2", "elif", "arg_1", "==", "\"http-ssl-verify\"", ":", "arg_0", ".", "http", ".", "verify", "=", "arg_2", "elif", "arg_1", "==", "\"http-disable-dh\"", ":", "if", "arg_2", ":", "arg_7", ".", "packages", ".", "urllib3", ".", "util", ".", "ssl_", ".", "DEFAULT_CIPHERS", "+=", "':!DH'", "try", ":", "arg_7", ".", "packages", ".", "urllib3", ".", "contrib", ".", "pyopenssl", ".", "DEFAULT_SSL_CIPHER_LIST", "=", "arg_7", ".", "packages", ".", "urllib3", ".", "util", ".", "ssl_", ".", "DEFAULT_CIPHERS", ".", "encode", "(", "\"ascii\"", ")", "except", "AttributeError", ":", "pass", "elif", "arg_1", "==", "\"http-ssl-cert\"", ":", "arg_0", ".", "http", ".", "cert", "=", "arg_2", "elif", "arg_1", "==", "\"http-timeout\"", ":", "arg_0", ".", "http", ".", "timeout", "=", "arg_2", "else", ":", "arg_0", ".", "options", ".", "set", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets general options used by plugins and streams originating\n        from this session object.\n\n        :param key: key of the option\n        :param value: value to set the option to\n\n\n        **Available options**:\n\n        ======================== =========================================\n        hds-live-edge            ( float) Specify the time live HDS\n                                 streams will start from the edge of\n                                 stream, default: ``10.0``\n\n        hds-segment-attempts     (int) How many attempts should be done\n                                 to download each HDS segment, default: ``3``\n\n        hds-segment-threads      (int) The size of the thread pool used\n                                 to download segments, default: ``1``\n\n        hds-segment-timeout      (float) HDS segment connect and read\n                                 timeout, default: ``10.0``\n\n        hds-timeout              (float) Timeout for reading data from\n                                 HDS streams, default: ``60.0``\n\n        hls-live-edge            (int) How many segments from the end\n                                 to start live streams on, default: ``3``\n\n        hls-segment-attempts     (int) How many attempts should be done\n                                 to download each HLS segment, default: ``3``\n\n        hls-segment-threads      (int) The size of the thread pool used\n                                 to download segments, default: ``1``\n\n        hls-segment-timeout      (float) HLS segment connect and read\n                                 timeout, default: ``10.0``\n\n        hls-timeout              (float) Timeout for reading data from\n                                 HLS streams, default: ``60.0``\n\n        http-proxy               (str) Specify a HTTP proxy to use for\n                                 all HTTP requests\n\n        https-proxy              (str) Specify a HTTPS proxy to use for\n                                 all HTTPS requests\n\n        http-cookies             (dict or str) A dict or a semi-colon (;)\n                                 delimited str of cookies to add to each\n                                 HTTP request, e.g. ``foo=bar;baz=qux``\n\n        http-headers             (dict or str) A dict or semi-colon (;)\n                                 delimited str of headers to add to each\n                                 HTTP request, e.g. ``foo=bar;baz=qux``\n\n        http-query-params        (dict or str) A dict or a ampersand (&)\n                                 delimited string of query parameters to\n                                 add to each HTTP request,\n                                 e.g. ``foo=bar&baz=qux``\n\n        http-trust-env           (bool) Trust HTTP settings set in the\n                                 environment, such as environment\n                                 variables (HTTP_PROXY, etc) and\n                                 ~/.netrc authentication\n\n        http-ssl-verify          (bool) Verify SSL certificates,\n                                 default: ``True``\n\n        http-ssl-cert            (str or tuple) SSL certificate to use,\n                                 can be either a .pem file (str) or a\n                                 .crt/.key pair (tuple)\n\n        http-timeout             (float) General timeout used by all HTTP\n                                 requests except the ones covered by\n                                 other options, default: ``20.0``\n\n        http-stream-timeout      (float) Timeout for reading data from\n                                 HTTP streams, default: ``60.0``\n\n        subprocess-errorlog      (bool) Log errors from subprocesses to\n                                 a file located in the temp directory\n\n        subprocess-errorlog-path (str) Log errors from subprocesses to\n                                 a specific file\n\n        ringbuffer-size          (int) The size of the internal ring\n                                 buffer used by most stream types,\n                                 default: ``16777216`` (16MB)\n\n        rtmp-proxy               (str) Specify a proxy (SOCKS) that RTMP\n                                 streams will use\n\n        rtmp-rtmpdump            (str) Specify the location of the\n                                 rtmpdump executable used by RTMP streams,\n                                 e.g. ``/usr/local/bin/rtmpdump``\n\n        rtmp-timeout             (float) Timeout for reading data from\n                                 RTMP streams, default: ``60.0``\n\n        ffmpeg-ffmpeg            (str) Specify the location of the\n                                 ffmpeg executable use by Muxing streams\n                                 e.g. ``/usr/local/bin/ffmpeg``\n\n        ffmpeg-verbose           (bool) Log stderr from ffmpeg to the\n                                 console\n\n        ffmpeg-verbose-path      (str) Specify the location of the\n                                 ffmpeg stderr log file\n\n        ffmpeg-video-transcode   (str) The codec to use if transcoding\n                                 video when muxing with ffmpeg\n                                 e.g. ``h264``\n\n        ffmpeg-audio-transcode   (str) The codec to use if transcoding\n                                 audio when muxing with ffmpeg\n                                 e.g. ``aac``\n\n        stream-segment-attempts  (int) How many attempts should be done\n                                 to download each segment, default: ``3``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        stream-segment-threads   (int) The size of the thread pool used\n                                 to download segments, default: ``1``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        stream-segment-timeout   (float) Segment connect and read\n                                 timeout, default: ``10.0``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        stream-timeout           (float) Timeout for reading data from\n                                 stream, default: ``60.0``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        locale                   (str) Locale setting, in the RFC 1766 format\n                                 eg. en_US or es_ES\n                                 default: ``system locale``.\n\n        user-input-requester     (UserInputRequester) instance of UserInputRequester\n                                 to collect input from the user at runtime. Must be\n                                 set before the plugins are loaded.\n                                 default: ``UserInputRequester``.\n        ======================== =========================================\n\n        \"\"\"\n\n        # Backwards compatibility\n        if arg_1 == \"rtmpdump\":\n            arg_1 = \"rtmp-rtmpdump\"\n        elif arg_1 == \"rtmpdump-proxy\":\n            arg_1 = \"rtmp-proxy\"\n        elif arg_1 == \"errorlog\":\n            arg_1 = \"subprocess-errorlog\"\n        elif arg_1 == \"errorlog-path\":\n            arg_1 = \"subprocess-errorlog-path\"\n\n        if arg_1 == \"http-proxy\":\n            arg_0.http.proxies[\"http\"] = update_scheme(\"http://\", arg_2)\n        elif arg_1 == \"https-proxy\":\n            arg_0.http.proxies[\"https\"] = update_scheme(\"https://\", arg_2)\n        elif arg_1 == \"http-cookies\":\n            if isinstance(arg_2, dict):\n                arg_0.http.cookies.update(arg_2)\n            else:\n                arg_0.http.parse_cookies(arg_2)\n        elif arg_1 == \"http-headers\":\n            if isinstance(arg_2, dict):\n                arg_0.http.headers.update(arg_2)\n            else:\n                arg_0.http.parse_headers(arg_2)\n        elif arg_1 == \"http-query-params\":\n            if isinstance(arg_2, dict):\n                arg_0.http.params.update(arg_2)\n            else:\n                arg_0.http.parse_query_params(arg_2)\n        elif arg_1 == \"http-trust-env\":\n            arg_0.http.trust_env = arg_2\n        elif arg_1 == \"http-ssl-verify\":\n            arg_0.http.verify = arg_2\n        elif arg_1 == \"http-disable-dh\":\n            if arg_2:\n                arg_7.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':!DH'\n                try:\n                    arg_7.packages.urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST = \\\n                        arg_7.packages.urllib3.util.ssl_.DEFAULT_CIPHERS.encode(\"ascii\")\n                except AttributeError:\n                    # no ssl to disable the cipher on\n                    pass\n        elif arg_1 == \"http-ssl-cert\":\n            arg_0.http.cert = arg_2\n        elif arg_1 == \"http-timeout\":\n            arg_0.http.timeout = arg_2\n        else:\n            arg_0.options.set(arg_1, arg_2)", "path": "src/streamlink/session.py", "identifier": "Streamlink.set_option", "docstring": "Sets general options used by plugins and streams originating\n        from this session object.\n\n        :param key: key of the option\n        :param value: value to set the option to\n\n\n        **Available options**:\n\n        ======================== =========================================\n        hds-live-edge            ( float) Specify the time live HDS\n                                 streams will start from the edge of\n                                 stream, default: ``10.0``\n\n        hds-segment-attempts     (int) How many attempts should be done\n                                 to download each HDS segment, default: ``3``\n\n        hds-segment-threads      (int) The size of the thread pool used\n                                 to download segments, default: ``1``\n\n        hds-segment-timeout      (float) HDS segment connect and read\n                                 timeout, default: ``10.0``\n\n        hds-timeout              (float) Timeout for reading data from\n                                 HDS streams, default: ``60.0``\n\n        hls-live-edge            (int) How many segments from the end\n                                 to start live streams on, default: ``3``\n\n        hls-segment-attempts     (int) How many attempts should be done\n                                 to download each HLS segment, default: ``3``\n\n        hls-segment-threads      (int) The size of the thread pool used\n                                 to download segments, default: ``1``\n\n        hls-segment-timeout      (float) HLS segment connect and read\n                                 timeout, default: ``10.0``\n\n        hls-timeout              (float) Timeout for reading data from\n                                 HLS streams, default: ``60.0``\n\n        http-proxy               (str) Specify a HTTP proxy to use for\n                                 all HTTP requests\n\n        https-proxy              (str) Specify a HTTPS proxy to use for\n                                 all HTTPS requests\n\n        http-cookies             (dict or str) A dict or a semi-colon (;)\n                                 delimited str of cookies to add to each\n                                 HTTP request, e.g. ``foo=bar;baz=qux``\n\n        http-headers             (dict or str) A dict or semi-colon (;)\n                                 delimited str of headers to add to each\n                                 HTTP request, e.g. ``foo=bar;baz=qux``\n\n        http-query-params        (dict or str) A dict or a ampersand (&)\n                                 delimited string of query parameters to\n                                 add to each HTTP request,\n                                 e.g. ``foo=bar&baz=qux``\n\n        http-trust-env           (bool) Trust HTTP settings set in the\n                                 environment, such as environment\n                                 variables (HTTP_PROXY, etc) and\n                                 ~/.netrc authentication\n\n        http-ssl-verify          (bool) Verify SSL certificates,\n                                 default: ``True``\n\n        http-ssl-cert            (str or tuple) SSL certificate to use,\n                                 can be either a .pem file (str) or a\n                                 .crt/.key pair (tuple)\n\n        http-timeout             (float) General timeout used by all HTTP\n                                 requests except the ones covered by\n                                 other options, default: ``20.0``\n\n        http-stream-timeout      (float) Timeout for reading data from\n                                 HTTP streams, default: ``60.0``\n\n        subprocess-errorlog      (bool) Log errors from subprocesses to\n                                 a file located in the temp directory\n\n        subprocess-errorlog-path (str) Log errors from subprocesses to\n                                 a specific file\n\n        ringbuffer-size          (int) The size of the internal ring\n                                 buffer used by most stream types,\n                                 default: ``16777216`` (16MB)\n\n        rtmp-proxy               (str) Specify a proxy (SOCKS) that RTMP\n                                 streams will use\n\n        rtmp-rtmpdump            (str) Specify the location of the\n                                 rtmpdump executable used by RTMP streams,\n                                 e.g. ``/usr/local/bin/rtmpdump``\n\n        rtmp-timeout             (float) Timeout for reading data from\n                                 RTMP streams, default: ``60.0``\n\n        ffmpeg-ffmpeg            (str) Specify the location of the\n                                 ffmpeg executable use by Muxing streams\n                                 e.g. ``/usr/local/bin/ffmpeg``\n\n        ffmpeg-verbose           (bool) Log stderr from ffmpeg to the\n                                 console\n\n        ffmpeg-verbose-path      (str) Specify the location of the\n                                 ffmpeg stderr log file\n\n        ffmpeg-video-transcode   (str) The codec to use if transcoding\n                                 video when muxing with ffmpeg\n                                 e.g. ``h264``\n\n        ffmpeg-audio-transcode   (str) The codec to use if transcoding\n                                 audio when muxing with ffmpeg\n                                 e.g. ``aac``\n\n        stream-segment-attempts  (int) How many attempts should be done\n                                 to download each segment, default: ``3``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        stream-segment-threads   (int) The size of the thread pool used\n                                 to download segments, default: ``1``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        stream-segment-timeout   (float) Segment connect and read\n                                 timeout, default: ``10.0``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        stream-timeout           (float) Timeout for reading data from\n                                 stream, default: ``60.0``.\n                                 General option used by streams not\n                                 covered by other options.\n\n        locale                   (str) Locale setting, in the RFC 1766 format\n                                 eg. en_US or es_ES\n                                 default: ``system locale``.\n\n        user-input-requester     (UserInputRequester) instance of UserInputRequester\n                                 to collect input from the user at runtime. Must be\n                                 set before the plugins are loaded.\n                                 default: ``UserInputRequester``.\n        ======================== =========================================", "docstring_tokens": ["Sets", "general", "options", "used", "by", "plugins", "and", "streams", "originating", "from", "this", "session", "object", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 255062}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_pipeline.py#L326-L350", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Create a list of indirect stages.", "language": "python", "parameters": "(self, config, name)", "return_statement": "return [self.create(stage, config) for stage in config[name]]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "return", "[", "]", "return", "[", "arg_0", ".", "create", "(", "arg_3", ",", "arg_1", ")", "for", "arg_3", "in", "arg_1", "[", "arg_2", "]", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Create a list of indirect stages.\n\n        `name` should be the name of a config item that holds a list\n        of names of stages, for instance, ``writers``.  This looks up\n        the names of those stages, then creates and returns the\n        corresponding list of stage objects.  For instance, if the\n        config says\n\n        .. code-block:: yaml\n\n            incremental_transforms: [clean_html, clean_visible]\n\n        then calling ``self.Func(scp_config,\n        'incremental_transforms')`` will return a list of the two\n        named stage instances.\n\n        :param dict config: `streamcorpus_pipeline` configuration block\n        :param str name: name of the stage name list entry\n        :return: list of new stage instances\n\n        '''\n        if arg_2 not in arg_1:\n            return []\n        return [arg_0.create(arg_3, arg_1) for arg_3 in arg_1[arg_2]]", "path": "streamcorpus_pipeline/_pipeline.py", "identifier": "PipelineFactory._init_stages", "docstring": "Create a list of indirect stages.\n\n        `name` should be the name of a config item that holds a list\n        of names of stages, for instance, ``writers``.  This looks up\n        the names of those stages, then creates and returns the\n        corresponding list of stage objects.  For instance, if the\n        config says\n\n        .. code-block:: yaml\n\n            incremental_transforms: [clean_html, clean_visible]\n\n        then calling ``self._init_stages(scp_config,\n        'incremental_transforms')`` will return a list of the two\n        named stage instances.\n\n        :param dict config: `streamcorpus_pipeline` configuration block\n        :param str name: name of the stage name list entry\n        :return: list of new stage instances", "docstring_tokens": ["Create", "a", "list", "of", "indirect", "stages", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 255063}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L294-L317", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Defines the ``Content-Type`` outgoing header value to match.", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'Content-Type'", ":", "TYPES", ".", "get", "(", "arg_1", ",", "arg_1", ")", "}", "arg_0", ".", "_request", ".", "headers", "=", "arg_2", "arg_0", ".", "add_matcher", "(", "matcher", "(", "'HeadersMatcher'", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Defines the ``Content-Type`` outgoing header value to match.\n\n        You can pass one of the following type aliases instead of the full\n        MIME type representation:\n\n        - ``json`` = ``application/json``\n        - ``xml`` = ``application/xml``\n        - ``html`` = ``text/html``\n        - ``text`` = ``text/plain``\n        - ``urlencoded`` = ``application/x-www-form-urlencoded``\n        - ``form`` = ``application/x-www-form-urlencoded``\n        - ``form-data`` = ``application/x-www-form-urlencoded``\n\n        Arguments:\n            value (str): type alias or header value to match.\n\n        Returns:\n            self: current Mock instance.\n        \"\"\"\n        arg_2 = {'Content-Type': TYPES.get(arg_1, arg_1)}\n        arg_0._request.headers = arg_2\n        arg_0.add_matcher(matcher('HeadersMatcher', arg_2))", "path": "pook/mock.py", "identifier": "Mock.content", "docstring": "Defines the ``Content-Type`` outgoing header value to match.\n\n        You can pass one of the following type aliases instead of the full\n        MIME type representation:\n\n        - ``json`` = ``application/json``\n        - ``xml`` = ``application/xml``\n        - ``html`` = ``text/html``\n        - ``text`` = ``text/plain``\n        - ``urlencoded`` = ``application/x-www-form-urlencoded``\n        - ``form`` = ``application/x-www-form-urlencoded``\n        - ``form-data`` = ``application/x-www-form-urlencoded``\n\n        Arguments:\n            value (str): type alias or header value to match.\n\n        Returns:\n            self: current Mock instance.", "docstring_tokens": ["Defines", "the", "Content", "-", "Type", "outgoing", "header", "value", "to", "match", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 255064}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_compute_hook.py#L69-L97", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Starts an existing instance defined by project_id, zone and resource_id.\n        Must be called with keyword arguments rather than positional.", "language": "python", "parameters": "(self, zone, resource_id, project_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "get_conn", "(", ")", ".", "instances", "(", ")", ".", "start", "(", "project", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", "instance", "=", "arg_2", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "try", ":", "arg_5", "=", "arg_4", "[", "\"name\"", "]", "except", "KeyError", ":", "raise", "AirflowException", "(", "\"Wrong response '{}' returned - it should contain \"", "\"'name' field\"", ".", "format", "(", "arg_4", ")", ")", "arg_0", ".", "_wait_for_operation_to_complete", "(", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Starts an existing instance defined by project_id, zone and resource_id.\n        Must be called with keyword arguments rather than positional.\n\n        :param zone: Google Cloud Platform zone where the instance exists\n        :type zone: str\n        :param resource_id: Name of the Compute Engine instance resource\n        :type resource_id: str\n        :param project_id: Optional, Google Cloud Platform project ID where the\n            Compute Engine Instance exists. If set to None or missing,\n            the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None\n        \"\"\"\n        arg_4 = arg_0.get_conn().instances().start(\n            project=arg_3,\n            arg_1=arg_1,\n            instance=arg_2\n        ).execute(num_retries=arg_0.num_retries)\n        try:\n            arg_5 = arg_4[\"name\"]\n        except KeyError:\n            raise AirflowException(\n                \"Wrong response '{}' returned - it should contain \"\n                \"'name' field\".format(arg_4))\n        arg_0._wait_for_operation_to_complete(arg_3=arg_3,\n                                             arg_5=arg_5,\n                                             arg_1=arg_1)", "path": "airflow/contrib/hooks/gcp_compute_hook.py", "identifier": "GceHook.start_instance", "docstring": "Starts an existing instance defined by project_id, zone and resource_id.\n        Must be called with keyword arguments rather than positional.\n\n        :param zone: Google Cloud Platform zone where the instance exists\n        :type zone: str\n        :param resource_id: Name of the Compute Engine instance resource\n        :type resource_id: str\n        :param project_id: Optional, Google Cloud Platform project ID where the\n            Compute Engine Instance exists. If set to None or missing,\n            the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None", "docstring_tokens": ["Starts", "an", "existing", "instance", "defined", "by", "project_id", "zone", "and", "resource_id", ".", "Must", "be", "called", "with", "keyword", "arguments", "rather", "than", "positional", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255065}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query.py#L66-L81", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Find the index of the closing braces for the opening braces\n    at the start of the query string. Note that first character\n    of input string must be an opening braces.", "language": "python", "parameters": "(self, query)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "[", "0", "]", "!=", "'('", ":", "raise", "Exception", "(", "\"Trying to find closing braces for no opening braces\"", ")", "arg_2", "=", "0", "for", "arg_3", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "arg_4", "=", "arg_1", "[", "arg_3", "]", "if", "arg_4", "==", "'('", ":", "arg_2", "+=", "1", "elif", "arg_4", "==", "')'", ":", "arg_2", "-=", "1", "if", "arg_2", "==", "0", ":", "return", "arg_3", "raise", "Exception", "(", "\"No closing braces found\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Find the index of the closing braces for the opening braces\n    at the start of the query string. Note that first character\n    of input string must be an opening braces.\"\"\"\n    if arg_1[0] != '(':\n      raise Exception(\"Trying to find closing braces for no opening braces\")\n    arg_2 = 0\n    for arg_3 in range(len(arg_1)):\n      arg_4 = arg_1[arg_3]\n      if arg_4 == '(':\n        arg_2 += 1\n      elif arg_4 == ')':\n        arg_2 -= 1\n      if arg_2 == 0:\n        return arg_3\n    raise Exception(\"No closing braces found\")", "path": "heron/tools/tracker/src/python/query.py", "identifier": "Query.find_closing_braces", "docstring": "Find the index of the closing braces for the opening braces\n    at the start of the query string. Note that first character\n    of input string must be an opening braces.", "docstring_tokens": ["Find", "the", "index", "of", "the", "closing", "braces", "for", "the", "opening", "braces", "at", "the", "start", "of", "the", "query", "string", ".", "Note", "that", "first", "character", "of", "input", "string", "must", "be", "an", "opening", "braces", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255066}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1476-L1534", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Pad an image-like array on its sides so that it matches a target aspect ratio.", "language": "python", "parameters": "(arr, aspect_ratio, mode=\"constant\", cval=0, return_pad_amounts=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"constant\"", ",", "arg_3", "=", "0", ",", "arg_4", "=", "False", ")", ":", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "compute_paddings_for_aspect_ratio", "(", "arg_0", ",", "arg_1", ")", "arg_9", "=", "pad", "(", "arg_0", ",", "top", "=", "arg_5", ",", "right", "=", "arg_6", ",", "bottom", "=", "arg_7", ",", "left", "=", "arg_8", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "arg_4", ":", "return", "arg_9", ",", "(", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "else", ":", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2=\"constant\", arg_3=0, arg_4=False):\n    \"\"\"\n    Pad an image-like array on its sides so that it matches a target aspect ratio.\n\n    Depending on which dimension is smaller (height or width), only the corresponding\n    sides (left/right or top/bottom) will be padded. In each case, both of the sides will\n    be padded equally.\n\n    dtype support::\n\n        See :func:`imgaug.imgaug.pad`.\n\n    Parameters\n    ----------\n    arr : (H,W) ndarray or (H,W,C) ndarray\n        Image-like array to pad.\n\n    aspect_ratio : float\n        Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice\n        as much width as height.\n\n    mode : str, optional\n        Padding mode to use. See :func:`numpy.pad` for details.\n\n    cval : number, optional\n        Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.\n\n    return_pad_amounts : bool, optional\n        If False, then only the padded image will be returned. If True, a tuple with two\n        entries will be returned, where the first entry is the padded image and the second\n        entry are the amounts by which each image side was padded. These amounts are again a\n        tuple of the form (top, right, bottom, left), with each value being an integer.\n\n    Returns\n    -------\n    arr_padded : (H',W') ndarray or (H',W',C) ndarray\n        Padded image as (H',W') or (H',W',C) ndarray, fulfulling the given aspect_ratio.\n\n    tuple of int\n        Amounts by which the image was padded on each side, given as a tuple ``(top, right, bottom, left)``.\n        This tuple is only returned if `return_pad_amounts` was set to True.\n        Otherwise only ``arr_padded`` is returned.\n\n    \"\"\"\n    arg_5, arg_6, arg_7, arg_8 = compute_paddings_for_aspect_ratio(arg_0, arg_1)\n    arg_9 = pad(\n        arg_0,\n        top=arg_5,\n        right=arg_6,\n        bottom=arg_7,\n        left=arg_8,\n        arg_2=arg_2,\n        arg_3=arg_3\n    )\n\n    if arg_4:\n        return arg_9, (arg_5, arg_6, arg_7, arg_8)\n    else:\n        return arg_9", "path": "imgaug/imgaug.py", "identifier": "pad_to_aspect_ratio", "docstring": "Pad an image-like array on its sides so that it matches a target aspect ratio.\n\n    Depending on which dimension is smaller (height or width), only the corresponding\n    sides (left/right or top/bottom) will be padded. In each case, both of the sides will\n    be padded equally.\n\n    dtype support::\n\n        See :func:`imgaug.imgaug.pad`.\n\n    Parameters\n    ----------\n    arr : (H,W) ndarray or (H,W,C) ndarray\n        Image-like array to pad.\n\n    aspect_ratio : float\n        Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice\n        as much width as height.\n\n    mode : str, optional\n        Padding mode to use. See :func:`numpy.pad` for details.\n\n    cval : number, optional\n        Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.\n\n    return_pad_amounts : bool, optional\n        If False, then only the padded image will be returned. If True, a tuple with two\n        entries will be returned, where the first entry is the padded image and the second\n        entry are the amounts by which each image side was padded. These amounts are again a\n        tuple of the form (top, right, bottom, left), with each value being an integer.\n\n    Returns\n    -------\n    arr_padded : (H',W') ndarray or (H',W',C) ndarray\n        Padded image as (H',W') or (H',W',C) ndarray, fulfulling the given aspect_ratio.\n\n    tuple of int\n        Amounts by which the image was padded on each side, given as a tuple ``(top, right, bottom, left)``.\n        This tuple is only returned if `return_pad_amounts` was set to True.\n        Otherwise only ``arr_padded`` is returned.", "docstring_tokens": ["Pad", "an", "image", "-", "like", "array", "on", "its", "sides", "so", "that", "it", "matches", "a", "target", "aspect", "ratio", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 255067}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/openstack/security_group.py#L44-L55", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "format the rule fields to match AWS to support auditor reuse,\n        will need to remap back if we want to orchestrate from our stored items", "language": "python", "parameters": "(security_group, **kwargs)", "return_statement": "return security_group", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "pop", "(", "'security_group_rules'", ",", "[", "]", ")", "for", "arg_3", "in", "arg_2", ":", "arg_3", "[", "'ip_protocol'", "]", "=", "arg_3", ".", "pop", "(", "'protocol'", ")", "arg_3", "[", "'from_port'", "]", "=", "arg_3", ".", "pop", "(", "'port_range_max'", ")", "arg_3", "[", "'to_port'", "]", "=", "arg_3", ".", "pop", "(", "'port_range_min'", ")", "arg_3", "[", "'cidr_ip'", "]", "=", "arg_3", ".", "pop", "(", "'remote_ip_prefix'", ")", "arg_3", "[", "'rule_type'", "]", "=", "arg_3", ".", "pop", "(", "'direction'", ")", "arg_0", "[", "'rules'", "]", "=", "sorted", "(", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, **arg_1):\n    \"\"\" format the rule fields to match AWS to support auditor reuse,\n        will need to remap back if we want to orchestrate from our stored items \"\"\"\n    arg_2 = arg_0.pop('security_group_rules',[])\n    for arg_3 in arg_2:\n        arg_3['ip_protocol'] = arg_3.pop('protocol')\n        arg_3['from_port'] = arg_3.pop('port_range_max')\n        arg_3['to_port'] = arg_3.pop('port_range_min')\n        arg_3['cidr_ip'] = arg_3.pop('remote_ip_prefix')\n        arg_3['rule_type'] = arg_3.pop('direction')\n    arg_0['rules'] = sorted(arg_2)\n    return arg_0", "path": "cloudaux/orchestration/openstack/security_group.py", "identifier": "get_rules", "docstring": "format the rule fields to match AWS to support auditor reuse,\n        will need to remap back if we want to orchestrate from our stored items", "docstring_tokens": ["format", "the", "rule", "fields", "to", "match", "AWS", "to", "support", "auditor", "reuse", "will", "need", "to", "remap", "back", "if", "we", "want", "to", "orchestrate", "from", "our", "stored", "items"], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 255068}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcdb.py#L387-L397", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Closes the cursor specified and removes it from the `self.cursors`\n        dictionary.", "language": "python", "parameters": "(self, handle)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "cursors", ":", "arg_0", ".", "cursors", "[", "arg_1", "]", ".", "close", "(", ")", "else", ":", "raise", "KeyError", "(", "'cursor with handle %s was not found'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Closes the cursor specified and removes it from the `self.cursors`\n        dictionary.\n\n        '''\n\n        if arg_1 in arg_0.cursors:\n            arg_0.cursors[arg_1].close()\n        else:\n            raise KeyError('cursor with handle %s was not found' % arg_1)", "path": "astrobase/lcdb.py", "identifier": "LCDB.close_cursor", "docstring": "Closes the cursor specified and removes it from the `self.cursors`\n        dictionary.", "docstring_tokens": ["Closes", "the", "cursor", "specified", "and", "removes", "it", "from", "the", "self", ".", "cursors", "dictionary", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255069}
{"url": "https://github.com/swarmer/fridge/blob/fcf6481307ce268c40c22f5e0062d01334f6cd95/fridge.py#L90-L105", "sha": "fcf6481307ce268c40c22f5e0062d01334f6cd95", "docstring_summary": "Force reloading the data from the file.\n        All data in the in-memory dictionary is discarded.\n        This method is called automatically by the constructor, normally you\n        don't need to call it.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_check_open", "(", ")", "try", ":", "arg_1", "=", "json", ".", "Func", "(", "arg_0", ".", "file", ",", "**", "arg_0", ".", "Func_args", ")", "except", "ValueError", ":", "arg_1", "=", "{", "}", "if", "not", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "raise", "ValueError", "(", "'Root JSON type must be dictionary'", ")", "arg_0", ".", "clear", "(", ")", "arg_0", ".", "update", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Force reFuncing the data from the file.\n        All data in the in-memory dictionary is discarded.\n        This method is called automatically by the constructor, normally you\n        don't need to call it.\n        \"\"\"\n        arg_0._check_open()\n        try:\n            arg_1 = json.Func(arg_0.file, **arg_0.Func_args)\n        except ValueError:\n            arg_1 = {}\n        if not isinstance(arg_1, dict):\n            raise ValueError('Root JSON type must be dictionary')\n        arg_0.clear()\n        arg_0.update(arg_1)", "path": "fridge.py", "identifier": "Fridge.load", "docstring": "Force reloading the data from the file.\n        All data in the in-memory dictionary is discarded.\n        This method is called automatically by the constructor, normally you\n        don't need to call it.", "docstring_tokens": ["Force", "reloading", "the", "data", "from", "the", "file", ".", "All", "data", "in", "the", "in", "-", "memory", "dictionary", "is", "discarded", ".", "This", "method", "is", "called", "automatically", "by", "the", "constructor", "normally", "you", "don", "t", "need", "to", "call", "it", "."], "nwo": "swarmer/fridge", "score": 0.09252797783733271, "idx": 255070}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L288-L323", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Import a class and instantiate with custom args.", "language": "python", "parameters": "(name, args, expand=None)", "return_statement": "return inst", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "def", "_expand", "(", "arg_3", ")", ":", "if", "arg_2", "and", "compat", ".", "is_basestring", "(", "arg_3", ")", "and", "arg_3", ".", "lower", "(", ")", "in", "arg_2", ":", "return", "arg_2", "[", "arg_3", "]", "return", "arg_3", "try", ":", "arg_4", "=", "dynamic_import_class", "(", "arg_0", ")", "arg_5", "=", "None", "if", "type", "(", "arg_1", ")", "in", "(", "tuple", ",", "list", ")", ":", "arg_1", "=", "tuple", "(", "map", "(", "_expand", ",", "arg_1", ")", ")", "arg_5", "=", "arg_4", "(", "*", "arg_1", ")", "else", ":", "assert", "type", "(", "arg_1", ")", "is", "dict", "arg_1", "=", "{", "k", ":", "_expand", "(", "arg_3", ")", "for", "k", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", "}", "arg_5", "=", "arg_4", "(", "**", "arg_1", ")", "_logger", ".", "debug", "(", "\"Instantiate {}({}) => {}\"", ".", "format", "(", "arg_0", ",", "arg_1", ",", "arg_5", ")", ")", "except", "Exception", ":", "_logger", ".", "exception", "(", "\"ERROR: Instantiate {}({}) => {}\"", ".", "format", "(", "arg_0", ",", "arg_1", ",", "arg_5", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Import a class and instantiate with custom args.\n\n    Example:\n        name = \"my.module.Foo\"\n        args_dict = {\n            \"bar\": 42,\n            \"baz\": \"qux\"\n            }\n        =>\n        from my.module import Foo\n        return Foo(bar=42, baz=\"qux\")\n    \"\"\"\n\n    def _expand(arg_3):\n        \"\"\"Replace some string templates with defined values.\"\"\"\n        if arg_2 and compat.is_basestring(arg_3) and arg_3.lower() in arg_2:\n            return arg_2[arg_3]\n        return arg_3\n\n    try:\n        arg_4 = dynamic_import_class(arg_0)\n        arg_5 = None\n        if type(arg_1) in (tuple, list):\n            arg_1 = tuple(map(_expand, arg_1))\n            arg_5 = arg_4(*arg_1)\n        else:\n            assert type(arg_1) is dict\n            arg_1 = {k: _expand(arg_3) for k, arg_3 in arg_1.items()}\n            arg_5 = arg_4(**arg_1)\n\n        _logger.debug(\"Instantiate {}({}) => {}\".format(arg_0, arg_1, arg_5))\n    except Exception:\n        _logger.exception(\"ERROR: Instantiate {}({}) => {}\".format(arg_0, arg_1, arg_5))\n\n    return arg_5", "path": "wsgidav/util.py", "identifier": "dynamic_instantiate_middleware", "docstring": "Import a class and instantiate with custom args.\n\n    Example:\n        name = \"my.module.Foo\"\n        args_dict = {\n            \"bar\": 42,\n            \"baz\": \"qux\"\n            }\n        =>\n        from my.module import Foo\n        return Foo(bar=42, baz=\"qux\")", "docstring_tokens": ["Import", "a", "class", "and", "instantiate", "with", "custom", "args", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 255071}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/rmt/rmtkernel.py#L24-L30", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return num eigenvalue diffs for the NxN GOE ensemble.", "language": "python", "parameters": "(num, N)", "return_statement": "return diffs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "empty", "(", "arg_0", ")", "for", "arg_3", "in", "xrange", "(", "arg_0", ")", ":", "arg_4", "=", "GOE", "(", "arg_1", ")", "arg_2", "[", "arg_3", "]", "=", "center_eigenvalue_diff", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return num eigenvalue diffs for the NxN GOE ensemble.\"\"\"\n    arg_2 = np.empty(arg_0)\n    for arg_3 in xrange(arg_0):\n        arg_4 = GOE(arg_1)\n        arg_2[arg_3] = center_eigenvalue_diff(arg_4)\n    return arg_2", "path": "environment/share/doc/ipython/examples/parallel/rmt/rmtkernel.py", "identifier": "ensemble_diffs", "docstring": "Return num eigenvalue diffs for the NxN GOE ensemble.", "docstring_tokens": ["Return", "num", "eigenvalue", "diffs", "for", "the", "NxN", "GOE", "ensemble", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255072}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/utils/injector.py#L20-L33", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "Use this function when unsure whether func takes this and arguments as its last 2 args.\n       It will append 2 args if it does not.", "language": "python", "parameters": "(func)", "return_statement": "return types.FunctionType(\n        code,\n        six.get_function_globals(func),\n        func.__name__,\n        closure=six.get_function_closure(func))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "six", ".", "get_function_code", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "co_varnames", "[", "arg_1", ".", "co_argcount", "-", "2", ":", "arg_1", ".", "co_argcount", "]", "if", "arg_2", "==", "(", "'this'", ",", "'arguments'", ")", "or", "arg_2", "==", "(", "'arguments'", ",", "'var'", ")", ":", "return", "arg_0", "arg_3", "=", "append_arguments", "(", "six", ".", "get_function_code", "(", "arg_0", ")", ",", "(", "'this'", ",", "'arguments'", ")", ")", "return", "types", ".", "FunctionType", "(", "arg_3", ",", "six", ".", "get_function_globals", "(", "arg_0", ")", ",", "arg_0", ".", "__name__", ",", "closure", "=", "six", ".", "get_function_closure", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    '''Use this function when unsure whether func takes this and arguments as its last 2 args.\n       It will append 2 args if it does not.'''\n    arg_1 = six.get_function_code(arg_0)\n    arg_2 = arg_1.co_varnames[arg_1.co_argcount - 2:arg_1.co_argcount]\n    if arg_2 == ('this', 'arguments') or arg_2 == ('arguments', 'var'):\n        return arg_0\n    arg_3 = append_arguments(six.get_function_code(arg_0), ('this', 'arguments'))\n\n    return types.FunctionType(\n        arg_3,\n        six.get_function_globals(arg_0),\n        arg_0.__name__,\n        closure=six.get_function_closure(arg_0))", "path": "js2py/utils/injector.py", "identifier": "fix_js_args", "docstring": "Use this function when unsure whether func takes this and arguments as its last 2 args.\n       It will append 2 args if it does not.", "docstring_tokens": ["Use", "this", "function", "when", "unsure", "whether", "func", "takes", "this", "and", "arguments", "as", "its", "last", "2", "args", ".", "It", "will", "append", "2", "args", "if", "it", "does", "not", "."], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 255073}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L356-L370", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "BOUND state.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "'In state: Func'", ")", "logger", ".", "info", "(", "'(%s) state changed %s -> bound'", ",", "arg_0", ".", "client", ".", "iface", ",", "STATES2NAMES", "[", "arg_0", ".", "current_state", "]", ")", "arg_0", ".", "current_state", "=", "STATE_Func", "arg_0", ".", "client", ".", "lease", ".", "info_lease", "(", ")", "if", "arg_0", ".", "script", "is", "not", "None", ":", "arg_0", ".", "script", ".", "script_init", "(", "arg_0", ".", "client", ".", "lease", ",", "arg_0", ".", "current_state", ")", "arg_0", ".", "script", ".", "script_go", "(", ")", "else", ":", "try", ":", "set_net", "(", "arg_0", ".", "client", ".", "lease", ")", "except", "Exception", "as", "e", ":", "logger", ".", "error", "(", "'Can not set IP'", ",", "exc_info", "=", "True", ")"], "function": "def Func(arg_0):\n        \"\"\"Func state.\"\"\"\n        logger.debug('In state: Func')\n        logger.info('(%s) state changed %s -> bound', arg_0.client.iface,\n                    STATES2NAMES[arg_0.current_state])\n        arg_0.current_state = STATE_Func\n        arg_0.client.lease.info_lease()\n        if arg_0.script is not None:\n            arg_0.script.script_init(arg_0.client.lease, arg_0.current_state)\n            arg_0.script.script_go()\n        else:\n            try:\n                set_net(arg_0.client.lease)\n            except Exception as e:\n                logger.error('Can not set IP', exc_info=True)", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.BOUND", "docstring": "BOUND state.", "docstring_tokens": ["BOUND", "state", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 255074}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth1.py#L765-L775", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Validate if the redirect_uri is allowed by the client.", "language": "python", "parameters": "(self, client_key, redirect_uri, request)", "return_statement": "return redirect_uri in request.client.redirect_uris", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "log", ".", "debug", "(", "'Validate redirect_uri %r for %r'", ",", "arg_2", ",", "arg_1", ")", "if", "not", "arg_3", ".", "client", ":", "arg_3", ".", "client", "=", "arg_0", ".", "_clientgetter", "(", "arg_1", "=", "arg_1", ")", "if", "not", "arg_3", ".", "client", ":", "return", "False", "if", "not", "arg_3", ".", "client", ".", "redirect_uris", "and", "arg_2", "is", "None", ":", "return", "True", "arg_3", ".", "redirect_uri", "=", "arg_2", "return", "arg_2", "in", "arg_3", ".", "client", ".", "redirect_uris"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Validate if the redirect_uri is allowed by the client.\"\"\"\n        log.debug('Validate redirect_uri %r for %r', arg_2, arg_1)\n        if not arg_3.client:\n            arg_3.client = arg_0._clientgetter(arg_1=arg_1)\n        if not arg_3.client:\n            return False\n        if not arg_3.client.redirect_uris and arg_2 is None:\n            return True\n        arg_3.redirect_uri = arg_2\n        return arg_2 in arg_3.client.redirect_uris", "path": "flask_oauthlib/provider/oauth1.py", "identifier": "OAuth1RequestValidator.validate_redirect_uri", "docstring": "Validate if the redirect_uri is allowed by the client.", "docstring_tokens": ["Validate", "if", "the", "redirect_uri", "is", "allowed", "by", "the", "client", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 255075}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/serialize/canning.py#L305-L320", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Import any string-keys in a type mapping.", "language": "python", "parameters": "(mapping, original=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "for", "arg_2", ",", "arg_3", "in", "list", "(", "arg_0", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "arg_2", ",", "string_types", ")", ":", "try", ":", "arg_4", "=", "import_item", "(", "arg_2", ")", "except", "Exception", ":", "if", "arg_1", "and", "arg_2", "not", "in", "arg_1", ":", "print", "(", "\"ERROR: canning class not importable: %r\"", ",", "arg_2", ",", "exc_info", "=", "True", ")", "arg_0", ".", "pop", "(", "arg_2", ")", "else", ":", "arg_0", "[", "arg_4", "]", "=", "arg_0", ".", "pop", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Import any string-keys in a type mapping.\"\"\"\n    #log = get_logger()\n    #log.debug(\"Importing canning map\")\n    for arg_2, arg_3 in list(arg_0.items()):\n        if isinstance(arg_2, string_types):\n            try:\n                arg_4 = import_item(arg_2)\n            except Exception:\n                if arg_1 and arg_2 not in arg_1:\n                    # only message on user-added classes\n                    # log.error(\"canning class not importable: %r\", key, exc_info=True)\n                    print(\"ERROR: canning class not importable: %r\", arg_2, exc_info=True)\n                arg_0.pop(arg_2)\n            else:\n                arg_0[arg_4] = arg_0.pop(arg_2)", "path": "parsl/executors/serialize/canning.py", "identifier": "_import_mapping", "docstring": "Import any string-keys in a type mapping.", "docstring_tokens": ["Import", "any", "string", "-", "keys", "in", "a", "type", "mapping", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 255076}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/annotate.py#L175-L189", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Specify that this function returns a typed value.", "language": "python", "parameters": "(type_name, formatter=None)", "return_statement": "return _returns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "def", "_returns", "(", "arg_2", ")", ":", "annotated", "(", "arg_2", ")", "arg_2", ".", "metadata", ".", "typed_returnvalue", "(", "arg_0", ",", "arg_1", ")", "return", "arg_2", "return", "_returns"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Specify that this function returns a typed value.\n\n    Args:\n        type_name (str): A type name known to the global typedargs type system\n        formatter (str): An optional name of a formatting function specified\n            for the type given in type_name.\n    \"\"\"\n\n    def _returns(arg_2):\n        annotated(arg_2)\n        arg_2.metadata.typed_returnvalue(arg_0, arg_1)\n        return arg_2\n\n    return _returns", "path": "typedargs/annotate.py", "identifier": "return_type", "docstring": "Specify that this function returns a typed value.\n\n    Args:\n        type_name (str): A type name known to the global typedargs type system\n        formatter (str): An optional name of a formatting function specified\n            for the type given in type_name.", "docstring_tokens": ["Specify", "that", "this", "function", "returns", "a", "typed", "value", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 255077}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L103-L119", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Add new java messages to ignore from user text file.  It first reads in the new java ignored messages\n    from the user text file and generate a dict structure to out of the new java ignored messages.  This\n    is achieved by function extract_message_to_dict.  Next, new java messages will be added to the original\n    ignored java messages dict g_ok_java_messages.  Again, this is achieved by function update_message_dict.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "g_new_messages_to_exclude", "global", "arg_1", "arg_0", "=", "extract_message_to_dict", "(", "g_new_messages_to_exclude", ")", "if", "arg_0", ":", "arg_1", "=", "True", "update_message_dict", "(", "arg_0", ",", "1", ")"], "function": "def Func():\n    \"\"\"\n    Add new java messages to ignore from user text file.  It first reads in the new java ignored messages\n    from the user text file and generate a dict structure to out of the new java ignored messages.  This\n    is achieved by function extract_message_to_dict.  Next, new java messages will be added to the original\n    ignored java messages dict g_ok_java_messages.  Again, this is achieved by function update_message_dict.\n\n    :return: none\n    \"\"\"\n    global g_new_messages_to_exclude    # filename containing text file from user containing new java ignored messages\n    global arg_1               # True if new ignored java messages are added.\n\n    arg_0 = extract_message_to_dict(g_new_messages_to_exclude)\n\n    if arg_0:\n        arg_1 = True\n        update_message_dict(arg_0,1)", "path": "scripts/addjavamessage2ignore.py", "identifier": "add_new_message", "docstring": "Add new java messages to ignore from user text file.  It first reads in the new java ignored messages\n    from the user text file and generate a dict structure to out of the new java ignored messages.  This\n    is achieved by function extract_message_to_dict.  Next, new java messages will be added to the original\n    ignored java messages dict g_ok_java_messages.  Again, this is achieved by function update_message_dict.\n\n    :return: none", "docstring_tokens": ["Add", "new", "java", "messages", "to", "ignore", "from", "user", "text", "file", ".", "It", "first", "reads", "in", "the", "new", "java", "ignored", "messages", "from", "the", "user", "text", "file", "and", "generate", "a", "dict", "structure", "to", "out", "of", "the", "new", "java", "ignored", "messages", ".", "This", "is", "achieved", "by", "function", "extract_message_to_dict", ".", "Next", "new", "java", "messages", "will", "be", "added", "to", "the", "original", "ignored", "java", "messages", "dict", "g_ok_java_messages", ".", "Again", "this", "is", "achieved", "by", "function", "update_message_dict", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255078}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L61-L71", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Configure session for particular device", "language": "python", "parameters": "()", "return_statement": "return tf.Session(config=config)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "tf", ".", "ConfigProto", "(", ")", "arg_0", ".", "gpu_options", ".", "allow_growth", "=", "True", "arg_0", ".", "gpu_options", ".", "visible_device_list", "=", "'0'", "return", "tf", ".", "Session", "(", "arg_0", "=", "arg_0", ")"], "function": "def Func():\n        \"\"\"\n        Configure session for particular device\n\n        Returns:\n            tensorflow.Session\n        \"\"\"\n        arg_0 = tf.ConfigProto()\n        arg_0.gpu_options.allow_growth = True\n        arg_0.gpu_options.visible_device_list = '0'\n        return tf.Session(arg_0=arg_0)", "path": "deeppavlov/core/models/keras_model.py", "identifier": "KerasModel._config_session", "docstring": "Configure session for particular device\n\n        Returns:\n            tensorflow.Session", "docstring_tokens": ["Configure", "session", "for", "particular", "device"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255079}
{"url": "https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/execute.py#L39-L51", "sha": "0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b", "docstring_summary": "Get the arguments to execute a command as a user", "language": "python", "parameters": "(cmd, user, shell='bash')", "return_statement": "return ['sudo', '-s', '--set-home', '-u', user] + to_execute", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'bash'", ")", ":", "arg_3", "=", "get_shell", "(", "arg_2", ")", "+", "[", "EXECUTE_SHELL_PARAM", ",", "arg_0", "]", "if", "arg_1", "==", "'root'", ":", "return", "arg_3", "return", "[", "'sudo'", ",", "'-s'", ",", "'--set-home'", ",", "'-u'", ",", "arg_1", "]", "+", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2='bash'):\n    \"\"\"Get the arguments to execute a command as a user\n\n    :param str cmd: command to execute\n    :param user: User for use\n    :param shell: Bash, zsh, etc.\n    :return: arguments\n    :rtype: list\n    \"\"\"\n    arg_3 = get_shell(arg_2) + [EXECUTE_SHELL_PARAM, arg_0]\n    if arg_1 == 'root':\n        return arg_3\n    return ['sudo', '-s', '--set-home', '-u', arg_1] + arg_3", "path": "amazon_dash/execute.py", "identifier": "run_as_cmd", "docstring": "Get the arguments to execute a command as a user\n\n    :param str cmd: command to execute\n    :param user: User for use\n    :param shell: Bash, zsh, etc.\n    :return: arguments\n    :rtype: list", "docstring_tokens": ["Get", "the", "arguments", "to", "execute", "a", "command", "as", "a", "user"], "nwo": "Nekmo/amazon-dash", "score": 0.758195400618659, "idx": 255080}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/optics/base.py#L202-L214", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Sets all the foci within `state` to `value`.", "language": "python", "parameters": "(self, state, value)", "return_statement": "return self.apply(func, pure, state).unwrap()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "_is_kind", "(", "Setter", ")", ":", "raise", "TypeError", "(", "'Must be an instance of Setter to .Func()'", ")", "arg_3", "=", "lambda", "a", ":", "Identity", "(", "a", ")", "arg_4", "=", "lambda", "a", ":", "Identity", "(", "arg_2", ")", "return", "arg_0", ".", "apply", "(", "arg_4", ",", "arg_3", ",", "arg_1", ")", ".", "unwrap", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        # type: (S, B) -> T\n        '''Sets all the foci within `state` to `value`.\n\n        Requires kind Setter. This method will raise TypeError when the\n        optic has no way to Func foci.\n        '''\n        if not arg_0._is_kind(Setter):\n            raise TypeError('Must be an instance of Setter to .Func()')\n\n        arg_3 = lambda a: Identity(a)\n        arg_4 = lambda a: Identity(arg_2)\n        return arg_0.apply(arg_4, arg_3, arg_1).unwrap()", "path": "lenses/optics/base.py", "identifier": "LensLike.set", "docstring": "Sets all the foci within `state` to `value`.\n\n        Requires kind Setter. This method will raise TypeError when the\n        optic has no way to set foci.", "docstring_tokens": ["Sets", "all", "the", "foci", "within", "state", "to", "value", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 255081}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/sbml.py#L1162-L1186", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Get required attribute from SBase.", "language": "python", "parameters": "(sbase, value, attribute)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "(", "arg_1", "is", "None", ")", "or", "(", "arg_1", "==", "\"\"", ")", ":", "arg_3", "=", "\"Required attribute '%s' cannot be found or parsed in '%s'\"", "%", "(", "arg_2", ",", "arg_0", ")", "if", "hasattr", "(", "arg_0", ",", "\"getId\"", ")", "and", "arg_0", ".", "getId", "(", ")", ":", "arg_3", "+=", "\" with id '%s'\"", "%", "arg_0", ".", "getId", "(", ")", "elif", "hasattr", "(", "arg_0", ",", "\"getName\"", ")", "and", "arg_0", ".", "getName", "(", ")", ":", "arg_3", "+=", "\" with name '%s'\"", "%", "arg_0", ".", "getName", "(", ")", "elif", "hasattr", "(", "arg_0", ",", "\"getMetaId\"", ")", "and", "arg_0", ".", "getMetaId", "(", ")", ":", "arg_3", "+=", "\" with metaId '%s'\"", "%", "arg_0", ".", "getName", "(", ")", "raise", "CobraSBMLError", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Get required attribute from SBase.\n\n    Parameters\n    ----------\n    sbase : libsbml.SBase\n    value : existing value\n    attribute: name of attribute\n\n    Returns\n    -------\n    attribute value (or value if already set)\n    \"\"\"\n\n    if (arg_1 is None) or (arg_1 == \"\"):\n        arg_3 = \"Required attribute '%s' cannot be found or parsed in '%s'\" % \\\n              (arg_2, arg_0)\n        if hasattr(arg_0, \"getId\") and arg_0.getId():\n            arg_3 += \" with id '%s'\" % arg_0.getId()\n        elif hasattr(arg_0, \"getName\") and arg_0.getName():\n            arg_3 += \" with name '%s'\" % arg_0.getName()\n        elif hasattr(arg_0, \"getMetaId\") and arg_0.getMetaId():\n            arg_3 += \" with metaId '%s'\" % arg_0.getName()\n        raise CobraSBMLError(arg_3)\n    return arg_1", "path": "cobra/io/sbml.py", "identifier": "_check_required", "docstring": "Get required attribute from SBase.\n\n    Parameters\n    ----------\n    sbase : libsbml.SBase\n    value : existing value\n    attribute: name of attribute\n\n    Returns\n    -------\n    attribute value (or value if already set)", "docstring_tokens": ["Get", "required", "attribute", "from", "SBase", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255082}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/model.py#L308-L333", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Return a list of Parameter objects", "language": "python", "parameters": "(self, pnames=None)", "return_statement": "return l", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "[", "]", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "params", ".", "keys", "(", ")", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "params", "[", "arg_3", "]", "if", "isinstance", "(", "arg_4", ",", "Parameter", ")", ":", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\" Return a list of Parameter objects\n\n        Parameters\n        ----------\n\n        pname : list or None\n           If a list get the Parameter objects with those names\n\n           If none, get all the Parameter objects\n\n        Returns\n        -------\n\n        params : list\n            list of Parameters\n\n        \"\"\"\n        arg_2 = []\n        if arg_1 is None:\n            arg_1 = arg_0.params.keys()\n        for arg_3 in arg_1:\n            arg_4 = arg_0.params[arg_3]\n            if isinstance(arg_4, Parameter):\n                arg_2.append(arg_4)\n        return arg_2", "path": "pymodeler/model.py", "identifier": "Model.get_params", "docstring": "Return a list of Parameter objects\n\n        Parameters\n        ----------\n\n        pname : list or None\n           If a list get the Parameter objects with those names\n\n           If none, get all the Parameter objects\n\n        Returns\n        -------\n\n        params : list\n            list of Parameters", "docstring_tokens": ["Return", "a", "list", "of", "Parameter", "objects"], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 255083}
{"url": "https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/ethernet.py#L31-L47", "sha": "67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8", "docstring_summary": "Given an Ethernet frame, determine the appropriate sub-protocol;\n        If layers is greater than zerol determine the type of the payload\n        and load the appropriate type of network packet. It is expected\n        that the payload be a hexified string. The layers argument determines\n        how many layers to descend while parsing the packet.", "language": "python", "parameters": "(self, layers=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "if", "arg_1", ":", "arg_2", "=", "payload_type", "(", "arg_0", ".", "type", ")", "[", "0", "]", "if", "arg_2", ":", "arg_2", "=", "arg_2", "arg_3", "=", "arg_0", ".", "payload", "arg_0", ".", "payload", "=", "arg_2", "(", "arg_3", ",", "arg_1", "-", "1", ")", "else", ":", "pass"], "function": "def Func(arg_0, arg_1=1):\n        \"\"\"\n        Given an Ethernet frame, determine the appropriate sub-protocol;\n        If layers is greater than zerol determine the type of the payload\n        and load the appropriate type of network packet. It is expected\n        that the payload be a hexified string. The layers argument determines\n        how many layers to descend while parsing the packet.\n        \"\"\"\n        if arg_1:\n            arg_2 = payload_type(arg_0.type)[0]\n            if arg_2:\n                arg_2 = arg_2\n                arg_3 = arg_0.payload\n                arg_0.payload = arg_2(arg_3, arg_1 - 1)\n            else:\n                # if no type is found, do not touch the packet.\n                pass", "path": "pcapfile/protocols/linklayer/ethernet.py", "identifier": "Ethernet.load_network", "docstring": "Given an Ethernet frame, determine the appropriate sub-protocol;\n        If layers is greater than zerol determine the type of the payload\n        and load the appropriate type of network packet. It is expected\n        that the payload be a hexified string. The layers argument determines\n        how many layers to descend while parsing the packet.", "docstring_tokens": ["Given", "an", "Ethernet", "frame", "determine", "the", "appropriate", "sub", "-", "protocol", ";", "If", "layers", "is", "greater", "than", "zerol", "determine", "the", "type", "of", "the", "payload", "and", "load", "the", "appropriate", "type", "of", "network", "packet", ".", "It", "is", "expected", "that", "the", "payload", "be", "a", "hexified", "string", ".", "The", "layers", "argument", "determines", "how", "many", "layers", "to", "descend", "while", "parsing", "the", "packet", "."], "nwo": "kisom/pypcapfile", "score": 0.3430538057229739, "idx": 255084}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_editor.py#L133-L140", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Sets up or removes a listener for the label being changed on a\n            specified object.", "language": "python", "parameters": "( self, object, listener, remove )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "label", "if", "arg_4", "[", ":", "1", "]", "!=", "'='", ":", "arg_1", ".", "on_trait_change", "(", "arg_2", ",", "arg_4", ",", "arg_3", "=", "arg_3", ",", "dispatch", "=", "'ui'", ")"], "function": "def Func ( arg_0, arg_1, arg_2, arg_3 ):\n        \"\"\" Sets up or removes a listener for the label being changed on a\n            specified object.\n        \"\"\"\n        arg_4 = arg_0.label\n        if arg_4[:1] != '=':\n            arg_1.on_trait_change( arg_2, arg_4, arg_3 = arg_3,\n                                    dispatch = 'ui' )", "path": "godot/ui/graph_editor.py", "identifier": "GraphNode.when_label_changed", "docstring": "Sets up or removes a listener for the label being changed on a\n            specified object.", "docstring_tokens": ["Sets", "up", "or", "removes", "a", "listener", "for", "the", "label", "being", "changed", "on", "a", "specified", "object", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 255085}
{"url": "https://github.com/lindsaymarkward/python-yeelight-sunflower/blob/4ec72d005ce307f832429620ba0bcbf6b236eead/yeelightsunflower/main.py#L40-L50", "sha": "4ec72d005ce307f832429620ba0bcbf6b236eead", "docstring_summary": "Create and connect to socket for TCP communication with hub.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "_socket", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "arg_0", ".", "_socket", ".", "settimeout", "(", "TIMEOUT_SECONDS", ")", "arg_0", ".", "_socket", ".", "Func", "(", "(", "arg_0", ".", "_ip", ",", "arg_0", ".", "_port", ")", ")", "_LOGGER", ".", "debug", "(", "\"Successfully created Hub at %s:%s :)\"", ",", "arg_0", ".", "_ip", ",", "arg_0", ".", "_port", ")", "except", "socket", ".", "error", "as", "error", ":", "_LOGGER", ".", "error", "(", "\"Error creating Hub: %s :(\"", ",", "error", ")", "arg_0", ".", "_socket", ".", "close", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Create and Func to socket for TCP communication with hub.\"\"\"\n        try:\n            arg_0._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n            arg_0._socket.settimeout(TIMEOUT_SECONDS)\n            arg_0._socket.Func((arg_0._ip, arg_0._port))\n            _LOGGER.debug(\"Successfully created Hub at %s:%s :)\", arg_0._ip,\n                          arg_0._port)\n        except socket.error as error:\n            _LOGGER.error(\"Error creating Hub: %s :(\", error)\n            arg_0._socket.close()", "path": "yeelightsunflower/main.py", "identifier": "Hub.connect", "docstring": "Create and connect to socket for TCP communication with hub.", "docstring_tokens": ["Create", "and", "connect", "to", "socket", "for", "TCP", "communication", "with", "hub", "."], "nwo": "lindsaymarkward/python-yeelight-sunflower", "score": 0.18941942438232184, "idx": 255086}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/utils/Settings.py#L163-L208", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Output some information on CUDA-enabled devices on your computer,\n    including current memory usage. Modified to only get number of devices.", "language": "python", "parameters": "()", "return_statement": "return nGpus.value", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "ctypes", "arg_0", "=", "0", "arg_1", "=", "(", "'libcuda.so'", ",", "'libcuda.dylib'", ",", "'cuda.dll'", ")", "for", "arg_2", "in", "arg_1", ":", "try", ":", "cuda", "=", "ctypes", ".", "CDLL", "(", "arg_2", ")", "except", "OSError", ":", "continue", "else", ":", "break", "else", ":", "return", "0", "arg_3", "=", "ctypes", ".", "c_int", "(", ")", "arg_4", "=", "ctypes", ".", "c_char_p", "(", ")", "arg_5", "=", "cuda", ".", "cuInit", "(", "0", ")", "if", "arg_5", "!=", "arg_0", ":", "cuda", ".", "cuGetErrorString", "(", "arg_5", ",", "ctypes", ".", "byref", "(", "arg_4", ")", ")", "return", "0", "arg_5", "=", "cuda", ".", "cuDeviceGetCount", "(", "ctypes", ".", "byref", "(", "arg_3", ")", ")", "if", "arg_5", "!=", "arg_0", ":", "cuda", ".", "cuGetErrorString", "(", "arg_5", ",", "ctypes", ".", "byref", "(", "arg_4", ")", ")", "return", "0", "return", "arg_3", ".", "value"], "function": "def Func():\n    \"\"\"Output some information on CUDA-enabled devices on your computer,\n    including current memory usage. Modified to only get number of devices.\n\n    It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1\n    from C to Python with ctypes, so it can run without compiling\n    anything. Note that this is a direct translation with no attempt to\n    make the code Pythonic. It's meant as a general demonstration on how\n    to obtain CUDA device information from Python without resorting to\n    nvidia-smi or a compiled Python extension.\n\n\n    .. note:: Author: Jan Schl\u00fcter, https://gist.github.com/63a664160d016a491b2cbea15913d549.git\n    \"\"\"\n    import ctypes\n\n    # Some constants taken from cuda.h\n    arg_0 = 0\n\n    arg_1 = ('libcuda.so', 'libcuda.dylib', 'cuda.dll')\n    for arg_2 in arg_1:\n        try:\n            cuda = ctypes.CDLL(arg_2)\n        except OSError:\n            continue\n        else:\n            break\n    else:\n        # raise OSError(\"could not load any of: \" + ' '.join(libnames))\n        return 0\n\n    arg_3 = ctypes.c_int()\n    arg_4 = ctypes.c_char_p()\n\n    arg_5 = cuda.cuInit(0)\n    if arg_5 != arg_0:\n        cuda.cuGetErrorString(arg_5, ctypes.byref(arg_4))\n        # print(\"cuInit failed with error code %d: %s\" % (result, error_str.value.decode()))\n        return 0\n    arg_5 = cuda.cuDeviceGetCount(ctypes.byref(arg_3))\n    if arg_5 != arg_0:\n        cuda.cuGetErrorString(arg_5, ctypes.byref(arg_4))\n        # print(\"cuDeviceGetCount failed with error code %d: %s\" % (result, error_str.value.decode()))\n        return 0\n    # print(\"Found %d device(s).\" % nGpus.value)\n    return arg_3.value", "path": "cdt/utils/Settings.py", "identifier": "check_cuda_devices", "docstring": "Output some information on CUDA-enabled devices on your computer,\n    including current memory usage. Modified to only get number of devices.\n\n    It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1\n    from C to Python with ctypes, so it can run without compiling\n    anything. Note that this is a direct translation with no attempt to\n    make the code Pythonic. It's meant as a general demonstration on how\n    to obtain CUDA device information from Python without resorting to\n    nvidia-smi or a compiled Python extension.\n\n\n    .. note:: Author: Jan Schl\u00fcter, https://gist.github.com/63a664160d016a491b2cbea15913d549.git", "docstring_tokens": ["Output", "some", "information", "on", "CUDA", "-", "enabled", "devices", "on", "your", "computer", "including", "current", "memory", "usage", ".", "Modified", "to", "only", "get", "number", "of", "devices", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 255087}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L620-L640", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Read existing output data from a previous run.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return self.config.output.extract_subset(\n            input_data_tiles=[\n                (output_tile, self.config.output.read(output_tile))\n                for output_tile in output_tiles\n            ],\n            out_tile=self.tile,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "arg_0", ".", "tile", ".", "pixelbuffer", ">", "arg_0", ".", "config", ".", "output", ".", "pixelbuffer", ":", "arg_2", "=", "list", "(", "arg_0", ".", "config", ".", "output_pyramid", ".", "tiles_from_bounds", "(", "arg_0", ".", "tile", ".", "bounds", ",", "arg_0", ".", "tile", ".", "zoom", ")", ")", "else", ":", "arg_2", "=", "arg_0", ".", "config", ".", "output_pyramid", ".", "intersecting", "(", "arg_0", ".", "tile", ")", "return", "arg_0", ".", "config", ".", "output", ".", "extract_subset", "(", "input_data_tiles", "=", "[", "(", "arg_3", ",", "arg_0", ".", "config", ".", "output", ".", "Func", "(", "arg_3", ")", ")", "for", "arg_3", "in", "arg_2", "]", ",", "out_tile", "=", "arg_0", ".", "tile", ",", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Read existing output data from a previous run.\n\n        Returns\n        -------\n        process output : NumPy array (raster) or feature iterator (vector)\n        \"\"\"\n        if arg_0.tile.pixelbuffer > arg_0.config.output.pixelbuffer:\n            arg_2 = list(arg_0.config.output_pyramid.tiles_from_bounds(\n                arg_0.tile.bounds, arg_0.tile.zoom\n            ))\n        else:\n            arg_2 = arg_0.config.output_pyramid.intersecting(arg_0.tile)\n        return arg_0.config.output.extract_subset(\n            input_data_tiles=[\n                (arg_3, arg_0.config.output.Func(arg_3))\n                for arg_3 in arg_2\n            ],\n            out_tile=arg_0.tile,\n        )", "path": "mapchete/_core.py", "identifier": "MapcheteProcess.read", "docstring": "Read existing output data from a previous run.\n\n        Returns\n        -------\n        process output : NumPy array (raster) or feature iterator (vector)", "docstring_tokens": ["Read", "existing", "output", "data", "from", "a", "previous", "run", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 255088}
{"url": "https://github.com/mblayman/httpony/blob/5af404d647a8dac8a043b64ea09882589b3b5247/httpony/server.py#L40-L55", "sha": "5af404d647a8dac8a043b64ea09882589b3b5247", "docstring_summary": "Build the parser that will have all available commands and options.", "language": "python", "parameters": "()", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "(", "'HTTPony (pronounced aych-tee-tee-pony) is a simple HTTP '", "'server that pretty prints HTTP requests to a terminal. It '", "'is a useful aide for developing clients that send HTTP '", "'requests. HTTPony acts as a sink for a client so that a '", "'developer can understand what the client is sending.'", ")", "arg_1", "=", "argparse", ".", "ArgumentParser", "(", "arg_0", "=", "arg_0", ")", "arg_1", ".", "add_argument", "(", "'-l'", ",", "'--listen'", ",", "help", "=", "'set the IP address or hostname'", ",", "default", "=", "'localhost'", ")", "arg_1", ".", "add_argument", "(", "'-p'", ",", "'--port'", ",", "help", "=", "'set the port'", ",", "default", "=", "8000", ",", "type", "=", "int", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"Build the parser that will have all available commands and options.\"\"\"\n    arg_0 = (\n        'HTTPony (pronounced aych-tee-tee-pony) is a simple HTTP '\n        'server that pretty prints HTTP requests to a terminal. It '\n        'is a useful aide for developing clients that send HTTP '\n        'requests. HTTPony acts as a sink for a client so that a '\n        'developer can understand what the client is sending.')\n    arg_1 = argparse.ArgumentParser(arg_0=arg_0)\n    arg_1.add_argument(\n        '-l', '--listen', help='set the IP address or hostname',\n        default='localhost')\n    arg_1.add_argument(\n        '-p', '--port', help='set the port', default=8000, type=int)\n\n    return arg_1", "path": "httpony/server.py", "identifier": "build_parser", "docstring": "Build the parser that will have all available commands and options.", "docstring_tokens": ["Build", "the", "parser", "that", "will", "have", "all", "available", "commands", "and", "options", "."], "nwo": "mblayman/httpony", "score": 0.16638194949711382, "idx": 255089}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1531-L1597", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Updates the specified virtual machine.", "language": "python", "parameters": "(self, service_name, deployment_name, role_name,\n                    os_virtual_hard_disk=None, network_config=None,\n                    availability_set_name=None, data_virtual_hard_disks=None,\n                    role_size=None, role_type='PersistentVMRole',\n                    resource_extension_references=None,\n                    provision_guest_agent=None)", "return_statement": "return self._perform_put(\n            self._get_role_path(service_name, deployment_name, role_name),\n            _XmlSerializer.update_role_to_xml(\n                role_name,\n                os_virtual_hard_disk,\n                role_type,\n                network_config,\n                availability_set_name,\n                data_virtual_hard_disks,\n                role_size,\n                resource_extension_references,\n                provision_guest_agent),\n            as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "'PersistentVMRole'", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'deployment_name'", ",", "arg_2", ")", "_validate_not_none", "(", "'role_name'", ",", "arg_3", ")", "return", "arg_0", ".", "_perform_put", "(", "arg_0", ".", "_get_role_path", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "_XmlSerializer", ".", "Func_to_xml", "(", "arg_3", ",", "arg_4", ",", "arg_9", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_10", ",", "arg_11", ")", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                    arg_4=None, arg_5=None,\n                    arg_6=None, arg_7=None,\n                    arg_8=None, arg_9='PersistentVMRole',\n                    arg_10=None,\n                    arg_11=None):\n        '''\n        Updates the specified virtual machine.\n\n        service_name:\n            The name of the service.\n        deployment_name:\n            The name of the deployment.\n        role_name:\n            The name of the role.\n        os_virtual_hard_disk:\n            Contains the parameters Windows Azure uses to create the operating\n            system disk for the virtual machine.\n        network_config:\n            Encapsulates the metadata required to create the virtual network\n            configuration for a virtual machine. If you do not include a\n            network configuration set you will not be able to access the VM\n            through VIPs over the internet. If your virtual machine belongs to\n            a virtual network you can not specify which subnet address space\n            it resides under.\n        availability_set_name:\n            Specifies the name of an availability set to which to add the\n            virtual machine. This value controls the virtual machine allocation\n            in the Windows Azure environment. Virtual machines specified in the\n            same availability set are allocated to different nodes to maximize\n            availability.\n        data_virtual_hard_disks:\n            Contains the parameters Windows Azure uses to create a data disk\n            for a virtual machine.\n        role_size:\n            The size of the virtual machine to allocate. The default value is\n            Small. Possible values are: ExtraSmall, Small, Medium, Large,\n            ExtraLarge. The specified value must be compatible with the disk\n            selected in the OSVirtualHardDisk values.\n        role_type:\n            The type of the role for the virtual machine. The only supported\n            value is PersistentVMRole.\n        resource_extension_references:\n            Optional. Contains a collection of resource extensions that are to\n            be installed on the Virtual Machine. This element is used if\n            provision_guest_agent is set to True.\n        provision_guest_agent:\n            Optional. Indicates whether the VM Agent is installed on the\n            Virtual Machine. To run a resource extension in a Virtual Machine,\n            this service must be installed.\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('deployment_name', arg_2)\n        _validate_not_none('role_name', arg_3)\n        return arg_0._perform_put(\n            arg_0._get_role_path(arg_1, arg_2, arg_3),\n            _XmlSerializer.Func_to_xml(\n                arg_3,\n                arg_4,\n                arg_9,\n                arg_5,\n                arg_6,\n                arg_7,\n                arg_8,\n                arg_10,\n                arg_11),\n            as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.update_role", "docstring": "Updates the specified virtual machine.\n\n        service_name:\n            The name of the service.\n        deployment_name:\n            The name of the deployment.\n        role_name:\n            The name of the role.\n        os_virtual_hard_disk:\n            Contains the parameters Windows Azure uses to create the operating\n            system disk for the virtual machine.\n        network_config:\n            Encapsulates the metadata required to create the virtual network\n            configuration for a virtual machine. If you do not include a\n            network configuration set you will not be able to access the VM\n            through VIPs over the internet. If your virtual machine belongs to\n            a virtual network you can not specify which subnet address space\n            it resides under.\n        availability_set_name:\n            Specifies the name of an availability set to which to add the\n            virtual machine. This value controls the virtual machine allocation\n            in the Windows Azure environment. Virtual machines specified in the\n            same availability set are allocated to different nodes to maximize\n            availability.\n        data_virtual_hard_disks:\n            Contains the parameters Windows Azure uses to create a data disk\n            for a virtual machine.\n        role_size:\n            The size of the virtual machine to allocate. The default value is\n            Small. Possible values are: ExtraSmall, Small, Medium, Large,\n            ExtraLarge. The specified value must be compatible with the disk\n            selected in the OSVirtualHardDisk values.\n        role_type:\n            The type of the role for the virtual machine. The only supported\n            value is PersistentVMRole.\n        resource_extension_references:\n            Optional. Contains a collection of resource extensions that are to\n            be installed on the Virtual Machine. This element is used if\n            provision_guest_agent is set to True.\n        provision_guest_agent:\n            Optional. Indicates whether the VM Agent is installed on the\n            Virtual Machine. To run a resource extension in a Virtual Machine,\n            this service must be installed.", "docstring_tokens": ["Updates", "the", "specified", "virtual", "machine", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255090}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/legecy_translators/flow.py#L74-L99", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "returns none if not found other functions that begin with 'do_' raise\n    also this do_ type function passes white space", "language": "python", "parameters": "(source, start)", "return_statement": "return do_expression(source, start)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "pass_white", "(", "arg_0", ",", "arg_1", ")", "if", "not", "arg_1", "<", "len", "(", "arg_0", ")", ":", "return", "None", ",", "arg_1", "if", "any", "(", "startswith_keyword", "(", "arg_0", "[", "arg_1", ":", "]", ",", "arg_2", ")", "for", "arg_2", "in", "{", "'case'", ",", "'default'", "}", ")", ":", "return", "None", ",", "arg_1", "arg_3", "=", "arg_0", "[", "arg_1", ":", "]", "for", "arg_4", ",", "arg_5", "in", "KEYWORD_METHODS", ".", "iteritems", "(", ")", ":", "if", "arg_3", ".", "startswith", "(", "arg_4", ")", ":", "if", "len", "(", "arg_4", ")", "==", "len", "(", "arg_3", ")", "or", "arg_3", "[", "len", "(", "arg_4", ")", "]", "not", "in", "IDENTIFIER_PART", ":", "return", "arg_5", "(", "arg_0", ",", "arg_1", ")", "if", "arg_3", "[", "0", "]", "==", "'{'", ":", "return", "do_block", "(", "arg_0", ",", "arg_1", ")", "arg_6", "=", "parse_identifier", "(", "arg_0", ",", "arg_1", ",", "False", ")", "if", "arg_6", "is", "not", "None", ":", "arg_7", ",", "arg_8", "=", "arg_6", "arg_8", "=", "pass_white", "(", "arg_0", ",", "arg_8", ")", "if", "arg_0", "[", "arg_8", "]", "==", "':'", ":", "return", "do_label", "(", "arg_0", ",", "arg_1", ")", "return", "do_expression", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"returns none if not found other functions that begin with 'do_' raise\n    also this do_ type function passes white space\"\"\"\n    arg_1 = pass_white(arg_0, arg_1)\n    # start is the fist position after initial start that is not a white space or \\n\n    if not arg_1 < len(arg_0):  #if finished parsing return None\n        return None, arg_1\n    if any(startswith_keyword(arg_0[arg_1:], arg_2) for arg_2 in {'case', 'default'}):\n        return None, arg_1\n    arg_3 = arg_0[arg_1:]\n    for arg_4, arg_5 in KEYWORD_METHODS.iteritems(\n    ):  # check for statements that are uniquely defined by their keywords\n        if arg_3.startswith(arg_4):\n            # has to startwith this keyword and the next letter after keyword must be either EOF or not in IDENTIFIER_PART\n            if len(arg_4) == len(arg_3) or arg_3[len(arg_4)] not in IDENTIFIER_PART:\n                return arg_5(arg_0, arg_1)\n    if arg_3[0] == '{':  #Block\n        return do_block(arg_0, arg_1)\n    # Now only label and expression left\n    arg_6 = parse_identifier(arg_0, arg_1, False)\n    if arg_6 is not None:  # it can mean that its a label\n        arg_7, arg_8 = arg_6\n        arg_8 = pass_white(arg_0, arg_8)\n        if arg_0[arg_8] == ':':\n            return do_label(arg_0, arg_1)\n    return do_expression(arg_0, arg_1)", "path": "js2py/legecy_translators/flow.py", "identifier": "do_statement", "docstring": "returns none if not found other functions that begin with 'do_' raise\n    also this do_ type function passes white space", "docstring_tokens": ["returns", "none", "if", "not", "found", "other", "functions", "that", "begin", "with", "do_", "raise", "also", "this", "do_", "type", "function", "passes", "white", "space"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 255091}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L107-L116", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Makes the python dict corresponding to the\n    JSON that needs to be sent for a failed\n    response. Message is the message that is\n    sent as the reason for failure.", "language": "python", "parameters": "(self, message)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "make_response", "(", "arg_3", ".", "RESPONSE_STATUS_FAILURE", ")", "arg_2", "[", "arg_3", ".", "RESPONSE_KEY_MESSAGE", "]", "=", "arg_1", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Makes the python dict corresponding to the\n    JSON that needs to be sent for a failed\n    response. Message is the message that is\n    sent as the reason for failure.\n    \"\"\"\n    arg_2 = arg_0.make_response(arg_3.RESPONSE_STATUS_FAILURE)\n    arg_2[arg_3.RESPONSE_KEY_MESSAGE] = arg_1\n    return arg_2", "path": "heron/tools/tracker/src/python/handlers/basehandler.py", "identifier": "BaseHandler.make_error_response", "docstring": "Makes the python dict corresponding to the\n    JSON that needs to be sent for a failed\n    response. Message is the message that is\n    sent as the reason for failure.", "docstring_tokens": ["Makes", "the", "python", "dict", "corresponding", "to", "the", "JSON", "that", "needs", "to", "be", "sent", "for", "a", "failed", "response", ".", "Message", "is", "the", "message", "that", "is", "sent", "as", "the", "reason", "for", "failure", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255092}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L788-L802", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Set's the package's description.\n        Raises SPDXValueError if text is not free form text.\n        Raises CardinalityError if description already set.\n        Raises OrderError if no package previously defined.", "language": "python", "parameters": "(self, doc, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "assert_package_exists", "(", ")", "if", "not", "arg_0", ".", "package_desc_set", ":", "arg_0", ".", "package_desc_set", "=", "True", "if", "validations", ".", "validate_pkg_desc", "(", "arg_2", ")", ":", "arg_1", ".", "package", ".", "description", "=", "str_from_text", "(", "arg_2", ")", "else", ":", "raise", "SPDXValueError", "(", "'Package::Description'", ")", "else", ":", "raise", "CardinalityError", "(", "'Package::Description'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Set's the package's description.\n        Raises SPDXValueError if text is not free form text.\n        Raises CardinalityError if description already set.\n        Raises OrderError if no package previously defined.\n        \"\"\"\n        arg_0.assert_package_exists()\n        if not arg_0.package_desc_set:\n            arg_0.package_desc_set = True\n            if validations.validate_pkg_desc(arg_2):\n                arg_1.package.description = str_from_text(arg_2)\n            else:\n                raise SPDXValueError('Package::Description')\n        else:\n            raise CardinalityError('Package::Description')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "PackageBuilder.set_pkg_desc", "docstring": "Set's the package's description.\n        Raises SPDXValueError if text is not free form text.\n        Raises CardinalityError if description already set.\n        Raises OrderError if no package previously defined.", "docstring_tokens": ["Set", "s", "the", "package", "s", "description", ".", "Raises", "SPDXValueError", "if", "text", "is", "not", "free", "form", "text", ".", "Raises", "CardinalityError", "if", "description", "already", "set", ".", "Raises", "OrderError", "if", "no", "package", "previously", "defined", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 255093}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L2649-L2725", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to perform interpolation on a given tabular data set\n        previously added via `set_tabular_data_P`. This method will create the\n        interpolators the first time it is used on a property set, and store\n        them for quick future use.", "language": "python", "parameters": "(self, T, P, name)", "return_statement": "return float(prop)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "(", "arg_3", ",", "arg_0", ".", "interpolation_T", ",", "arg_0", ".", "interpolation_P", ",", "arg_0", ".", "interpolation_property", ",", "arg_0", ".", "interpolation_property_inv", ")", "if", "arg_4", "in", "arg_0", ".", "tabular_data_interpolators", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "tabular_data_interpolators", "[", "arg_4", "]", "else", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_0", ".", "tabular_data", "[", "arg_3", "]", "if", "arg_0", ".", "interpolation_T", ":", "arg_10", "=", "[", "arg_0", ".", "interpolation_T", "(", "T2", ")", "for", "T2", "in", "arg_7", "]", "else", ":", "arg_10", "=", "arg_7", "if", "arg_0", ".", "interpolation_P", ":", "arg_11", "=", "[", "arg_0", ".", "interpolation_P", "(", "P2", ")", "for", "P2", "in", "arg_8", "]", "else", ":", "arg_11", "=", "arg_8", "if", "arg_0", ".", "interpolation_property", ":", "arg_12", "=", "[", "arg_0", ".", "interpolation_property", "(", "p", ")", "for", "p", "in", "arg_9", "]", "else", ":", "arg_12", "=", "arg_9", "arg_5", "=", "interp2d", "(", "arg_10", ",", "arg_11", ",", "arg_12", ")", "if", "len", "(", "arg_9", ")", ">=", "5", ":", "arg_6", "=", "interp2d", "(", "arg_10", ",", "arg_11", ",", "arg_12", ",", "kind", "=", "'cubic'", ")", "else", ":", "arg_6", "=", "None", "arg_0", ".", "tabular_data_interpolators", "[", "arg_4", "]", "=", "(", "arg_5", ",", "arg_6", ")", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_0", ".", "tabular_data", "[", "arg_3", "]", "if", "arg_1", "<", "arg_7", "[", "0", "]", "or", "arg_1", ">", "arg_7", "[", "-", "1", "]", "or", "not", "arg_6", "or", "arg_2", "<", "arg_8", "[", "0", "]", "or", "arg_2", ">", "arg_8", "[", "-", "1", "]", ":", "arg_14", "=", "arg_5", "else", ":", "arg_14", "=", "arg_6", "if", "arg_0", ".", "interpolation_T", ":", "arg_1", "=", "arg_0", ".", "interpolation_T", "(", "arg_1", ")", "if", "arg_0", ".", "interpolation_P", ":", "arg_2", "=", "arg_0", ".", "interpolation_T", "(", "arg_2", ")", "arg_15", "=", "arg_14", "(", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "interpolation_property", ":", "arg_15", "=", "arg_0", ".", "interpolation_property_inv", "(", "arg_15", ")", "return", "float", "(", "arg_15", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        r'''Method to perform interpolation on a given tabular data set\n        previously added via `set_tabular_data_P`. This method will create the\n        interpolators the first time it is used on a property set, and store\n        them for quick future use.\n\n        Interpolation is cubic-spline based if 5 or more points are available,\n        and linearly interpolated if not. Extrapolation is always performed\n        linearly. This function uses the transforms `interpolation_T`,\n        `interpolation_P`,\n        `interpolation_property`, and `interpolation_property_inv` if set. If\n        any of these are changed after the interpolators were first created,\n        new interpolators are created with the new transforms.\n        All interpolation is performed via the `interp2d` function.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to interpolate the property, [K]\n        T : float\n            Pressure at which to interpolate the property, [Pa]\n        name : str\n            The name assigned to the tabular data set\n\n        Returns\n        -------\n        prop : float\n            Calculated property, [`units`]\n        '''\n        arg_4 = (arg_3, arg_0.interpolation_T, arg_0.interpolation_P, arg_0.interpolation_property, arg_0.interpolation_property_inv)\n\n        # If the interpolator and extrapolator has already been created, load it\n        if arg_4 in arg_0.tabular_data_interpolators:\n            arg_5, arg_6 = arg_0.tabular_data_interpolators[arg_4]\n        else:\n            arg_7, arg_8, arg_9 = arg_0.tabular_data[arg_3]\n\n            if arg_0.interpolation_T:  # Transform ths Ts with interpolation_T if set\n                arg_10 = [arg_0.interpolation_T(T2) for T2 in arg_7]\n            else:\n                arg_10 = arg_7\n            if arg_0.interpolation_P:  # Transform ths Ts with interpolation_T if set\n                arg_11 = [arg_0.interpolation_P(P2) for P2 in arg_8]\n            else:\n                arg_11 = arg_8\n            if arg_0.interpolation_property:  # Transform ths props with interpolation_property if set\n                arg_12 = [arg_0.interpolation_property(p) for p in arg_9]\n            else:\n                arg_12 = arg_9\n            # Only allow linear extrapolation, but with whatever transforms are specified\n            arg_5 = interp2d(arg_10, arg_11, arg_12)  # interpolation if fill value is missing\n            # If more than 5 property points, create a spline interpolation\n            if len(arg_9) >= 5:\n                arg_6 = interp2d(arg_10, arg_11, arg_12, kind='cubic')\n            else:\n                arg_6 = None\n            arg_0.tabular_data_interpolators[arg_4] = (arg_5, arg_6)\n\n        # Load the stores values, tor checking which interpolation strategy to\n        # use.\n        arg_7, arg_8, arg_9 = arg_0.tabular_data[arg_3]\n\n        if arg_1 < arg_7[0] or arg_1 > arg_7[-1] or not arg_6 or arg_2 < arg_8[0] or arg_2 > arg_8[-1]:\n            arg_14 = arg_5\n        else:\n            arg_14 = arg_6\n\n        if arg_0.interpolation_T:\n            arg_1 = arg_0.interpolation_T(arg_1)\n        if arg_0.interpolation_P:\n            arg_2 = arg_0.interpolation_T(arg_2)\n        arg_15 = arg_14(arg_1, arg_2)  # either spline, or linear interpolation\n\n        if arg_0.interpolation_property:\n            arg_15 = arg_0.interpolation_property_inv(arg_15)\n\n        return float(arg_15)", "path": "thermo/utils.py", "identifier": "TPDependentProperty.interpolate_P", "docstring": "r'''Method to perform interpolation on a given tabular data set\n        previously added via `set_tabular_data_P`. This method will create the\n        interpolators the first time it is used on a property set, and store\n        them for quick future use.\n\n        Interpolation is cubic-spline based if 5 or more points are available,\n        and linearly interpolated if not. Extrapolation is always performed\n        linearly. This function uses the transforms `interpolation_T`,\n        `interpolation_P`,\n        `interpolation_property`, and `interpolation_property_inv` if set. If\n        any of these are changed after the interpolators were first created,\n        new interpolators are created with the new transforms.\n        All interpolation is performed via the `interp2d` function.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to interpolate the property, [K]\n        T : float\n            Pressure at which to interpolate the property, [Pa]\n        name : str\n            The name assigned to the tabular data set\n\n        Returns\n        -------\n        prop : float\n            Calculated property, [`units`]", "docstring_tokens": ["r", "Method", "to", "perform", "interpolation", "on", "a", "given", "tabular", "data", "set", "previously", "added", "via", "set_tabular_data_P", ".", "This", "method", "will", "create", "the", "interpolators", "the", "first", "time", "it", "is", "used", "on", "a", "property", "set", "and", "store", "them", "for", "quick", "future", "use", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 255094}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L249-L282", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Check if the given message has the mandatory fields", "language": "python", "parameters": "(self, message)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "MESSAGE_ID_FIELD", "not", "in", "arg_1", ":", "logger", ".", "warning", "(", "\"Field 'Message-ID' not found in message %s; ignoring\"", ",", "arg_1", "[", "'unixfrom'", "]", ")", "return", "False", "if", "not", "arg_1", "[", "arg_0", ".", "MESSAGE_ID_FIELD", "]", ":", "logger", ".", "warning", "(", "\"Field 'Message-ID' is empty in message %s; ignoring\"", ",", "arg_1", "[", "'unixfrom'", "]", ")", "return", "False", "if", "arg_0", ".", "DATE_FIELD", "not", "in", "arg_1", ":", "logger", ".", "warning", "(", "\"Field 'Date' not found in message %s; ignoring\"", ",", "arg_1", "[", "'unixfrom'", "]", ")", "return", "False", "if", "not", "arg_1", "[", "arg_0", ".", "DATE_FIELD", "]", ":", "logger", ".", "warning", "(", "\"Field 'Date' is empty in message %s; ignoring\"", ",", "arg_1", "[", "'unixfrom'", "]", ")", "return", "False", "try", ":", "str_to_datetime", "(", "arg_1", "[", "arg_0", ".", "DATE_FIELD", "]", ")", "except", "InvalidDateError", ":", "logger", ".", "warning", "(", "\"Invalid date %s in message %s; ignoring\"", ",", "arg_1", "[", "arg_0", ".", "DATE_FIELD", "]", ",", "arg_1", "[", "'unixfrom'", "]", ")", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check if the given message has the mandatory fields\"\"\"\n\n        # This check is \"case insensitive\" because we're\n        # using 'CaseInsensitiveDict' from requests.structures\n        # module to store the contents of a message.\n        if arg_0.MESSAGE_ID_FIELD not in arg_1:\n            logger.warning(\"Field 'Message-ID' not found in message %s; ignoring\",\n                           arg_1['unixfrom'])\n            return False\n\n        if not arg_1[arg_0.MESSAGE_ID_FIELD]:\n            logger.warning(\"Field 'Message-ID' is empty in message %s; ignoring\",\n                           arg_1['unixfrom'])\n            return False\n\n        if arg_0.DATE_FIELD not in arg_1:\n            logger.warning(\"Field 'Date' not found in message %s; ignoring\",\n                           arg_1['unixfrom'])\n            return False\n\n        if not arg_1[arg_0.DATE_FIELD]:\n            logger.warning(\"Field 'Date' is empty in message %s; ignoring\",\n                           arg_1['unixfrom'])\n            return False\n\n        try:\n            str_to_datetime(arg_1[arg_0.DATE_FIELD])\n        except InvalidDateError:\n            logger.warning(\"Invalid date %s in message %s; ignoring\",\n                           arg_1[arg_0.DATE_FIELD], arg_1['unixfrom'])\n            return False\n\n        return True", "path": "perceval/backends/core/mbox.py", "identifier": "MBox._validate_message", "docstring": "Check if the given message has the mandatory fields", "docstring_tokens": ["Check", "if", "the", "given", "message", "has", "the", "mandatory", "fields"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255095}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L322-L327", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Returns a specific disk", "language": "python", "parameters": "(self, disk_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_data", "is", "not", "None", ":", "for", "arg_2", "in", "arg_0", ".", "_data", "[", "\"disks\"", "]", ":", "if", "arg_2", "[", "\"id\"", "]", "==", "arg_1", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Returns a specific disk\"\"\"\r\n        if arg_0._data is not None:\r\n            for arg_2 in arg_0._data[\"disks\"]:\r\n                if arg_2[\"id\"] == arg_1:\r\n                    return arg_2", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynoStorage._get_disk", "docstring": "Returns a specific disk", "docstring_tokens": ["Returns", "a", "specific", "disk"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 255096}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/treeview.py#L184-L190", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Force appearance of the button next to the item", "language": "python", "parameters": "(self, has_children=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_0", ".", "_tree_model", ".", "_tree_view", ".", "wx_obj", ".", "SetItemHasChildren", "(", "arg_0", ".", "wx_item", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=True):\r\n        \"Force appearance of the button next to the item\"\r\n        # This is useful to allow the user to expand the items which don't have\r\n        # any children now, but instead adding them only when needed, thus \r\n        # minimizing memory usage and loading time.\r\n        arg_0._tree_model._tree_view.wx_obj.SetItemHasChildren(arg_0.wx_item, \r\n                                                              arg_1)", "path": "gui/controls/treeview.py", "identifier": "TreeItem.set_has_children", "docstring": "Force appearance of the button next to the item", "docstring_tokens": ["Force", "appearance", "of", "the", "button", "next", "to", "the", "item"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 255097}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/appengine.py#L378-L398", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Retrieve Credential from datastore.", "language": "python", "parameters": "(self)", "return_statement": "return credentials", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "if", "arg_0", ".", "_cache", ":", "arg_2", "=", "arg_0", ".", "_cache", ".", "get", "(", "arg_0", ".", "_key_name", ")", "if", "arg_2", ":", "arg_1", "=", "client", ".", "Credentials", ".", "new_from_json", "(", "arg_2", ")", "if", "arg_1", "is", "None", ":", "arg_3", "=", "arg_0", ".", "_get_entity", "(", ")", "if", "arg_3", "is", "not", "None", ":", "arg_1", "=", "getattr", "(", "arg_3", ",", "arg_0", ".", "_property_name", ")", "if", "arg_0", ".", "_cache", ":", "arg_0", ".", "_cache", ".", "set", "(", "arg_0", ".", "_key_name", ",", "arg_1", ".", "to_json", "(", ")", ")", "if", "arg_1", "and", "hasattr", "(", "arg_1", ",", "'set_store'", ")", ":", "arg_1", ".", "set_store", "(", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Retrieve Credential from datastore.\n\n        Returns:\n            oauth2client.Credentials\n        \"\"\"\n        arg_1 = None\n        if arg_0._cache:\n            arg_2 = arg_0._cache.get(arg_0._key_name)\n            if arg_2:\n                arg_1 = client.Credentials.new_from_json(arg_2)\n        if arg_1 is None:\n            arg_3 = arg_0._get_entity()\n            if arg_3 is not None:\n                arg_1 = getattr(arg_3, arg_0._property_name)\n                if arg_0._cache:\n                    arg_0._cache.set(arg_0._key_name, arg_1.to_json())\n\n        if arg_1 and hasattr(arg_1, 'set_store'):\n            arg_1.set_store(arg_0)\n        return arg_1", "path": "oauth2client/contrib/appengine.py", "identifier": "StorageByKeyName.locked_get", "docstring": "Retrieve Credential from datastore.\n\n        Returns:\n            oauth2client.Credentials", "docstring_tokens": ["Retrieve", "Credential", "from", "datastore", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 255098}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/manipulation/modify.py#L38-L46", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "make a single string id SBML compliant", "language": "python", "parameters": "(id_str)", "return_statement": "return id_str", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "(", "\"'\"", ",", "'\"'", ")", ":", "if", "arg_0", ".", "startswith", "(", "arg_1", ")", "and", "arg_0", ".", "endswith", "(", "arg_1", ")", "and", "arg_0", ".", "count", "(", "arg_1", ")", "==", "2", ":", "arg_0", "=", "arg_0", ".", "strip", "(", "arg_1", ")", "for", "arg_2", ",", "arg_3", "in", "_renames", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "arg_2", ",", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"make a single string id SBML compliant\"\"\"\n    for arg_1 in (\"'\", '\"'):\n        if arg_0.startswith(arg_1) and arg_0.endswith(arg_1) \\\n                and arg_0.count(arg_1) == 2:\n            arg_0 = arg_0.strip(arg_1)\n    for arg_2, arg_3 in _renames:\n        arg_0 = arg_0.replace(arg_2, arg_3)\n    return arg_0", "path": "cobra/manipulation/modify.py", "identifier": "_escape_str_id", "docstring": "make a single string id SBML compliant", "docstring_tokens": ["make", "a", "single", "string", "id", "SBML", "compliant"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255099}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L521-L527", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Add handlers to a logger from a list of names.", "language": "python", "parameters": "(self, logger, handlers)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_2", ":", "try", ":", "arg_1", ".", "addHandler", "(", "arg_0", ".", "config", "[", "'handlers'", "]", "[", "arg_3", "]", ")", "except", "StandardError", "as", "e", ":", "raise", "ValueError", "(", "'Unable to add handler %r: %s'", "%", "(", "arg_3", ",", "e", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add handlers to a logger from a list of names.\"\"\"\n        for arg_3 in arg_2:\n            try:\n                arg_1.addHandler(arg_0.config['handlers'][arg_3])\n            except StandardError as e:\n                raise ValueError('Unable to add handler %r: %s' % (arg_3, e))", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py", "identifier": "DictConfigurator.add_handlers", "docstring": "Add handlers to a logger from a list of names.", "docstring_tokens": ["Add", "handlers", "to", "a", "logger", "from", "a", "list", "of", "names", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255100}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/django_util/__init__.py#L292-L316", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "This configures whether the credentials will be stored in the session\n    or the Django ORM based on the settings. By default, the credentials\n    will be stored in the session, unless `GOOGLE_OAUTH2_STORAGE_MODEL`\n    is found in the settings. Usually, the ORM storage is used to integrate\n    credentials into an existing Django user system.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "getattr", "(", "django", ".", "conf", ".", "settings", ",", "'GOOGLE_OAUTH2_STORAGE_MODEL'", ",", "None", ")", "if", "arg_0", "is", "not", "None", ":", "return", "(", "arg_0", "[", "'model'", "]", ",", "arg_0", "[", "'user_property'", "]", ",", "arg_0", "[", "'credentials_property'", "]", ")", "else", ":", "return", "None", ",", "None", ",", "None"], "function": "def Func():\n    \"\"\"This configures whether the credentials will be stored in the session\n    or the Django ORM based on the settings. By default, the credentials\n    will be stored in the session, unless `GOOGLE_OAUTH2_STORAGE_MODEL`\n    is found in the settings. Usually, the ORM storage is used to integrate\n    credentials into an existing Django user system.\n\n    Returns:\n        A tuple containing three strings, or None. If\n        ``GOOGLE_OAUTH2_STORAGE_MODEL`` is configured, the tuple\n        will contain the fully qualifed path of the `django.db.model`,\n        the name of the ``django.contrib.auth.models.User`` field on the\n        model, and the name of the\n        :class:`oauth2client.contrib.django_util.models.CredentialsField`\n        field on the model. If Django ORM storage is not configured,\n        this function returns None.\n    \"\"\"\n    arg_0 = getattr(django.conf.settings,\n                                     'GOOGLE_OAUTH2_STORAGE_MODEL', None)\n    if arg_0 is not None:\n        return (arg_0['model'],\n                arg_0['user_property'],\n                arg_0['credentials_property'])\n    else:\n        return None, None, None", "path": "oauth2client/contrib/django_util/__init__.py", "identifier": "_get_storage_model", "docstring": "This configures whether the credentials will be stored in the session\n    or the Django ORM based on the settings. By default, the credentials\n    will be stored in the session, unless `GOOGLE_OAUTH2_STORAGE_MODEL`\n    is found in the settings. Usually, the ORM storage is used to integrate\n    credentials into an existing Django user system.\n\n    Returns:\n        A tuple containing three strings, or None. If\n        ``GOOGLE_OAUTH2_STORAGE_MODEL`` is configured, the tuple\n        will contain the fully qualifed path of the `django.db.model`,\n        the name of the ``django.contrib.auth.models.User`` field on the\n        model, and the name of the\n        :class:`oauth2client.contrib.django_util.models.CredentialsField`\n        field on the model. If Django ORM storage is not configured,\n        this function returns None.", "docstring_tokens": ["This", "configures", "whether", "the", "credentials", "will", "be", "stored", "in", "the", "session", "or", "the", "Django", "ORM", "based", "on", "the", "settings", ".", "By", "default", "the", "credentials", "will", "be", "stored", "in", "the", "session", "unless", "GOOGLE_OAUTH2_STORAGE_MODEL", "is", "found", "in", "the", "settings", ".", "Usually", "the", "ORM", "storage", "is", "used", "to", "integrate", "credentials", "into", "an", "existing", "Django", "user", "system", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 255101}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1320-L1334", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Blocks until the socket is ready to be written to, or the timeout is hit", "language": "python", "parameters": "(self, timeout=None)", "return_statement": "return len(write_ready) > 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", ",", "arg_3", ",", "arg_2", "=", "select", ".", "select", "(", "[", "]", ",", "[", "arg_0", ".", "_socket", "]", ",", "[", "]", ",", "arg_1", ")", "return", "len", "(", "arg_3", ")", ">", "0"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Blocks until the socket is ready to be written to, or the timeout is hit\n\n        :param timeout:\n            A float - the period of time to wait for the socket to be ready to\n            written to. None for no time limit.\n\n        :return:\n            A boolean - if the socket is ready for writing. Will only be False\n            if timeout is not None.\n        \"\"\"\n\n        arg_2, arg_3, arg_2 = select.select([], [arg_0._socket], [], arg_1)\n        return len(arg_3) > 0", "path": "oscrypto/_win/tls.py", "identifier": "TLSSocket.select_write", "docstring": "Blocks until the socket is ready to be written to, or the timeout is hit\n\n        :param timeout:\n            A float - the period of time to wait for the socket to be ready to\n            written to. None for no time limit.\n\n        :return:\n            A boolean - if the socket is ready for writing. Will only be False\n            if timeout is not None.", "docstring_tokens": ["Blocks", "until", "the", "socket", "is", "ready", "to", "be", "written", "to", "or", "the", "timeout", "is", "hit"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 255102}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/construct.py#L137-L167", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Join two bolt arrays together, at least one of which is in spark.", "language": "python", "parameters": "(arrays, axis=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "raise", "ValueError", "(", "\"data type not understood\"", ")", "if", "not", "len", "(", "arg_0", ")", "==", "2", ":", "raise", "NotImplementedError", "(", "\"spark concatenation only supports two arrays\"", ")", "arg_2", ",", "arg_3", "=", "arg_0", "if", "isinstance", "(", "arg_2", ",", "BoltArraySpark", ")", ":", "return", "arg_2", ".", "Func", "(", "arg_3", ",", "arg_1", ")", "elif", "isinstance", "(", "arg_3", ",", "BoltArraySpark", ")", ":", "arg_2", "=", "ConstructSpark", ".", "array", "(", "arg_2", ",", "arg_3", ".", "_rdd", ".", "context", ")", "return", "arg_2", ".", "Func", "(", "arg_3", ",", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "\"at least one array must be a spark bolt array\"", ")"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"\n        Join two bolt arrays together, at least one of which is in spark.\n\n        Parameters\n        ----------\n        arrays : tuple\n            A pair of arrays. At least one must be a spark array,\n            the other can be a local bolt array, a local numpy array,\n            or an array-like.\n\n        axis : int, optional, default=0\n            The axis along which the arrays will be joined.\n\n        Returns\n        -------\n        BoltArraySpark\n        \"\"\"\n        if not isinstance(arg_0, tuple):\n            raise ValueError(\"data type not understood\")\n        if not len(arg_0) == 2:\n            raise NotImplementedError(\"spark concatenation only supports two arrays\")\n\n        arg_2, arg_3 = arg_0\n        if isinstance(arg_2, BoltArraySpark):\n            return arg_2.Func(arg_3, arg_1)\n        elif isinstance(arg_3, BoltArraySpark):\n            arg_2 = ConstructSpark.array(arg_2, arg_3._rdd.context)\n            return arg_2.Func(arg_3, arg_1)\n        else:\n            raise ValueError(\"at least one array must be a spark bolt array\")", "path": "bolt/spark/construct.py", "identifier": "ConstructSpark.concatenate", "docstring": "Join two bolt arrays together, at least one of which is in spark.\n\n        Parameters\n        ----------\n        arrays : tuple\n            A pair of arrays. At least one must be a spark array,\n            the other can be a local bolt array, a local numpy array,\n            or an array-like.\n\n        axis : int, optional, default=0\n            The axis along which the arrays will be joined.\n\n        Returns\n        -------\n        BoltArraySpark", "docstring_tokens": ["Join", "two", "bolt", "arrays", "together", "at", "least", "one", "of", "which", "is", "in", "spark", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 255103}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/html5.py#L125-L130", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Return a shallow copy of the current node i.e. a node with the same\n        name and attributes but with no parent or child nodes", "language": "python", "parameters": "(self)", "return_statement": "return element(self.xml_name, attrs=attrs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "xml_attributes", ".", "copy", "(", ")", "return", "element", "(", "arg_0", ".", "xml_name", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Return a shallow copy of the current node i.e. a node with the same\n        name and attributes but with no parent or child nodes\n        \"\"\"\n        arg_1 = arg_0.xml_attributes.copy()\n        return element(arg_0.xml_name, arg_1=arg_1)", "path": "pylib/uxml/html5.py", "identifier": "element.cloneNode", "docstring": "Return a shallow copy of the current node i.e. a node with the same\n        name and attributes but with no parent or child nodes", "docstring_tokens": ["Return", "a", "shallow", "copy", "of", "the", "current", "node", "i", ".", "e", ".", "a", "node", "with", "the", "same", "name", "and", "attributes", "but", "with", "no", "parent", "or", "child", "nodes"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 255104}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/baselines/baseline.py#L107-L123", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates the TensorFlow operations for calculating the L2 loss between predicted\n        state values and actual rewards.", "language": "python", "parameters": "(self, states, internals, reward, update, reference=None)", "return_statement": "return tf.nn.l2_loss(t=(prediction - reward))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_0", ".", "predict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ")", "return", "tf", ".", "nn", ".", "l2_loss", "(", "t", "=", "(", "arg_6", "-", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None):\n        \"\"\"\n        Creates the TensorFlow operations for calculating the L2 loss between predicted\n        state values and actual rewards.\n\n        Args:\n            states: Dict of state tensors.\n            internals: List of prior internal state tensors.\n            reward: Reward tensor.\n            update: Boolean tensor indicating whether this call happens during an update.\n            reference: Optional reference tensor(s), in case of a comparative loss.\n\n        Returns:\n            Loss tensor\n        \"\"\"\n        arg_6 = arg_0.predict(arg_1=arg_1, arg_2=arg_2, arg_4=arg_4)\n        return tf.nn.l2_loss(t=(arg_6 - arg_3))", "path": "tensorforce/core/baselines/baseline.py", "identifier": "Baseline.tf_loss", "docstring": "Creates the TensorFlow operations for calculating the L2 loss between predicted\n        state values and actual rewards.\n\n        Args:\n            states: Dict of state tensors.\n            internals: List of prior internal state tensors.\n            reward: Reward tensor.\n            update: Boolean tensor indicating whether this call happens during an update.\n            reference: Optional reference tensor(s), in case of a comparative loss.\n\n        Returns:\n            Loss tensor", "docstring_tokens": ["Creates", "the", "TensorFlow", "operations", "for", "calculating", "the", "L2", "loss", "between", "predicted", "state", "values", "and", "actual", "rewards", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 255105}
{"url": "https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L903-L928", "sha": "0dc47c8924fa3d9ab676c3a6e195f03f728b72c6", "docstring_summary": "Given an object, always return an iterable. If the item is not\n\talready iterable, return a tuple containing only the item. If item is\n\tNone, an empty iterable is returned.", "language": "python", "parameters": "(item)", "return_statement": "return more_itertools.always_iterable(item, base_type=base_types)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "six", ".", "text_type", ",", "bytes", ",", "collections", ".", "abc", ".", "Mapping", "return", "more_itertools", ".", "Func", "(", "arg_0", ",", "base_type", "=", "arg_1", ")"], "function": "def Func(arg_0):\n\t\"\"\"\n\tGiven an object, always return an iterable. If the item is not\n\talready iterable, return a tuple containing only the item. If item is\n\tNone, an empty iterable is returned.\n\n\t>>> Func([1,2,3])\n\t<list_iterator...>\n\t>>> Func('foo')\n\t<tuple_iterator...>\n\t>>> Func(None)\n\t<tuple_iterator...>\n\t>>> Func(range(10))\n\t<range_iterator...>\n\t>>> def _test_func(): yield \"I'm iterable\"\n\t>>> print(next(Func(_test_func())))\n\tI'm iterable\n\n\tAlthough mappings are iterable, treat each like a singleton, as\n\tit's more like an object than a sequence.\n\n\t>>> next(Func(dict(a=1)))\n\t{'a': 1}\n\t\"\"\"\n\targ_1 = six.text_type, bytes, collections.abc.Mapping\n\treturn more_itertools.Func(arg_0, base_type=arg_1)", "path": "jaraco/itertools.py", "identifier": "always_iterable", "docstring": "Given an object, always return an iterable. If the item is not\n\talready iterable, return a tuple containing only the item. If item is\n\tNone, an empty iterable is returned.\n\n\t>>> always_iterable([1,2,3])\n\t<list_iterator...>\n\t>>> always_iterable('foo')\n\t<tuple_iterator...>\n\t>>> always_iterable(None)\n\t<tuple_iterator...>\n\t>>> always_iterable(range(10))\n\t<range_iterator...>\n\t>>> def _test_func(): yield \"I'm iterable\"\n\t>>> print(next(always_iterable(_test_func())))\n\tI'm iterable\n\n\tAlthough mappings are iterable, treat each like a singleton, as\n\tit's more like an object than a sequence.\n\n\t>>> next(always_iterable(dict(a=1)))\n\t{'a': 1}", "docstring_tokens": ["Given", "an", "object", "always", "return", "an", "iterable", ".", "If", "the", "item", "is", "not", "already", "iterable", "return", "a", "tuple", "containing", "only", "the", "item", ".", "If", "item", "is", "None", "an", "empty", "iterable", "is", "returned", "."], "nwo": "jaraco/jaraco.itertools", "score": 0.2751458370028208, "idx": 255106}
{"url": "https://github.com/hhatto/pgmagick/blob/5dce5fa4681400b4c059431ad69233e6a3e5799a/setup.py#L202-L207", "sha": "5dce5fa4681400b4c059431ad69233e6a3e5799a", "docstring_summary": "Return version string.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "io", ".", "open", "(", "'pgmagick/_Func.py'", ")", "as", "input_file", ":", "for", "arg_0", "in", "input_file", ":", "if", "arg_0", ".", "startswith", "(", "'__Func__'", ")", ":", "return", "ast", ".", "parse", "(", "arg_0", ")", ".", "body", "[", "0", "]", ".", "value", ".", "s"], "function": "def Func():\n    \"\"\"Return Func string.\"\"\"\n    with io.open('pgmagick/_Func.py') as input_file:\n        for arg_0 in input_file:\n            if arg_0.startswith('__Func__'):\n                return ast.parse(arg_0).body[0].value.s", "path": "setup.py", "identifier": "version", "docstring": "Return version string.", "docstring_tokens": ["Return", "version", "string", "."], "nwo": "hhatto/pgmagick", "score": 0.37249488389724494, "idx": 255107}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/dialog_logger.py#L66-L76", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns opened file object for writing dialog logs.", "language": "python", "parameters": "(self)", "return_statement": "return log_file", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ":", "Path", "=", "Path", "(", "arg_0", ".", "config", "[", "'log_path'", "]", ")", ".", "expanduser", "(", ")", ".", "resolve", "(", ")", "/", "arg_0", ".", "agent_name", "arg_1", ".", "mkdir", "(", "parents", "=", "True", ",", "exist_ok", "=", "True", ")", "arg_2", "=", "Path", "(", "arg_1", ",", "f'{self._get_timestamp_utc_str()}_{self.agent_name}.log'", ")", "arg_3", "=", "open", "(", "arg_2", ",", "'a'", ",", "buffering", "=", "1", ",", "encoding", "=", "'utf8'", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Returns opened file object for writing dialog logs.\n\n        Returns:\n            log_file: opened Python file object.\n        \"\"\"\n        arg_1: Path = Path(arg_0.config['log_path']).expanduser().resolve() / arg_0.agent_name\n        arg_1.mkdir(parents=True, exist_ok=True)\n        arg_2 = Path(arg_1, f'{self._get_timestamp_utc_str()}_{self.agent_name}.log')\n        arg_3 = open(arg_2, 'a', buffering=1, encoding='utf8')\n        return arg_3", "path": "deeppavlov/core/agent/dialog_logger.py", "identifier": "DialogLogger._get_log_file", "docstring": "Returns opened file object for writing dialog logs.\n\n        Returns:\n            log_file: opened Python file object.", "docstring_tokens": ["Returns", "opened", "file", "object", "for", "writing", "dialog", "logs", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255108}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L764-L766", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Change the current IP.", "language": "python", "parameters": "(self, ip)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "set", "(", "arg_1", "=", "arg_1", ",", "netmask", "=", "arg_0", ".", "_nm", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Change the current IP.\"\"\"\n        arg_0.set(arg_1=arg_1, netmask=arg_0._nm)", "path": "iplib.py", "identifier": "CIDR.set_ip", "docstring": "Change the current IP.", "docstring_tokens": ["Change", "the", "current", "IP", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 255109}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/template.py#L225-L264", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Save the content of the .svg file in the chosen rendered format.", "language": "python", "parameters": "(self, file_path, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "get_tempfile", "(", "suffix", "=", "'.svg'", ")", "arg_0", ".", "save_content", "(", "arg_3", ".", "name", ")", "arg_4", "=", "arg_2", ".", "get", "(", "'file_type'", ",", "'pdf'", ")", "arg_5", "=", "arg_2", ".", "get", "(", "'dpi'", ",", "150", ")", "arg_6", "=", "arg_2", ".", "get", "(", "'support_unicode'", ",", "False", ")", "try", ":", "if", "arg_4", "==", "'svg'", ":", "shutil", ".", "copyfile", "(", "arg_3", ".", "name", ",", "arg_1", ")", "elif", "arg_4", "==", "'png'", ":", "svg2png", "(", "arg_3", ".", "name", ",", "arg_1", ",", "arg_5", "=", "arg_5", ")", "elif", "arg_4", "==", "'pdf'", ":", "svg2pdf", "(", "arg_3", ".", "name", ",", "arg_1", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "except", ":", "log", ".", "exception", "(", "'Error exporting file {} to {}'", ".", "format", "(", "arg_1", ",", "arg_4", ")", ")", "raise"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\" Save the content of the .svg file in the chosen Funced format.\n\n        Parameters\n        ----------\n        file_path: str\n            Path to the output file.\n\n        Kwargs\n        ------\n        file_type: str\n            Choices: 'png', 'pdf', 'svg'\n            Default: 'pdf'\n\n        dpi: int\n            Dots-per-inch for the png and pdf.\n            Default: 150\n\n        support_unicode: bool\n            Whether to allow unicode to be encoded in the PDF.\n            Default: False\n        \"\"\"\n        arg_3 = get_tempfile(suffix='.svg')\n        arg_0.save_content(arg_3.name)\n\n        arg_4 = arg_2.get('file_type', 'pdf')\n        arg_5 = arg_2.get('dpi', 150)\n        arg_6 = arg_2.get('support_unicode', False)\n        try:\n            if arg_4 == 'svg':\n                shutil.copyfile(arg_3.name, arg_1)\n            elif arg_4 == 'png':\n                svg2png(arg_3.name, arg_1, arg_5=arg_5)\n            elif arg_4 == 'pdf':\n                svg2pdf(arg_3.name, arg_1, arg_5=arg_5, arg_6=arg_6)\n        except:\n            log.exception(\n                'Error exporting file {} to {}'.format(arg_1, arg_4)\n            )\n            raise", "path": "docstamp/template.py", "identifier": "SVGDocument.render", "docstring": "Save the content of the .svg file in the chosen rendered format.\n\n        Parameters\n        ----------\n        file_path: str\n            Path to the output file.\n\n        Kwargs\n        ------\n        file_type: str\n            Choices: 'png', 'pdf', 'svg'\n            Default: 'pdf'\n\n        dpi: int\n            Dots-per-inch for the png and pdf.\n            Default: 150\n\n        support_unicode: bool\n            Whether to allow unicode to be encoded in the PDF.\n            Default: False", "docstring_tokens": ["Save", "the", "content", "of", "the", ".", "svg", "file", "in", "the", "chosen", "rendered", "format", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 255110}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/error_summary.py#L37-L43", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Return the set of all namespaces with incorrect names in the graph.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "return {\n        exc.namespace\n        for _, exc, _ in graph.warnings\n        if isinstance(exc, (MissingNamespaceNameWarning, MissingNamespaceRegexWarning))\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Set", "[", "str", "]", ":", "return", "{", "arg_3", ".", "namespace", "for", "arg_2", ",", "arg_3", ",", "arg_2", "in", "arg_0", ".", "warnings", "if", "isinstance", "(", "arg_3", ",", "(", "MissingNamespaceNameWarning", ",", "MissingNamespaceRegexWarning", ")", ")", "}"], "function": "def Func(arg_0: arg_1) -> Set[str]:\n    \"\"\"Return the set of all namespaces with incorrect names in the graph.\"\"\"\n    return {\n        arg_3.namespace\n        for arg_2, arg_3, arg_2 in arg_0.warnings\n        if isinstance(arg_3, (MissingNamespaceNameWarning, MissingNamespaceRegexWarning))\n    }", "path": "src/pybel_tools/summary/error_summary.py", "identifier": "get_namespaces_with_incorrect_names", "docstring": "Return the set of all namespaces with incorrect names in the graph.", "docstring_tokens": ["Return", "the", "set", "of", "all", "namespaces", "with", "incorrect", "names", "in", "the", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255111}
{"url": "https://github.com/matrix-org/python-canonicaljson/blob/c508635e867ff11026b610c00ca906002d8fb9af/canonicaljson.py#L74-L147", "sha": "c508635e867ff11026b610c00ca906002d8fb9af", "docstring_summary": "Unpack `\\\\uNNNN` escapes in 's' and encode the result as UTF-8", "language": "python", "parameters": "(s)", "return_statement": "return (''.join(chunks)).encode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_U_ESCAPE", ".", "search", "(", "arg_0", ")", "if", "not", "arg_1", ":", "return", "arg_0", "if", "PY2", "else", "arg_0", ".", "encode", "(", "'utf-8'", ")", "arg_2", "=", "[", "]", "arg_3", "=", "0", "while", "arg_1", ":", "arg_4", "=", "arg_1", ".", "start", "(", ")", "arg_5", "=", "arg_1", ".", "end", "(", ")", "arg_6", "=", "arg_1", ".", "group", "(", "1", ")", "if", "arg_6", "is", "None", ":", "arg_2", ".", "append", "(", "arg_0", "[", "arg_3", ":", "arg_5", "]", ")", "else", ":", "arg_7", "=", "int", "(", "arg_6", ",", "16", ")", "if", "arg_7", "<", "0x20", ":", "arg_2", ".", "append", "(", "arg_0", "[", "arg_3", ":", "arg_5", "]", ")", "else", ":", "if", "PY3", ":", "if", "arg_7", "&", "0xfc00", "==", "0xd800", "and", "arg_0", "[", "arg_5", ":", "arg_5", "+", "2", "]", "==", "'\\\\u'", ":", "arg_8", "=", "arg_0", "[", "arg_5", "+", "2", ":", "arg_5", "+", "6", "]", "arg_9", "=", "int", "(", "arg_8", ",", "16", ")", "if", "arg_9", "&", "0xfc00", "==", "0xdc00", ":", "arg_7", "=", "0x10000", "+", "(", "(", "(", "arg_7", "-", "0xd800", ")", "<<", "10", ")", "|", "(", "arg_9", "-", "0xdc00", ")", ")", "arg_5", "+=", "6", "arg_2", ".", "append", "(", "arg_0", "[", "arg_3", ":", "arg_4", "]", ")", "arg_2", ".", "append", "(", "unichr", "(", "arg_7", ")", ")", "arg_3", "=", "arg_5", "arg_1", "=", "_U_ESCAPE", ".", "search", "(", "arg_0", ",", "arg_3", ")", "arg_2", ".", "append", "(", "arg_0", "[", "arg_3", ":", "]", ")", "return", "(", "''", ".", "join", "(", "arg_2", ")", ")", ".", "encode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Unpack `\\\\uNNNN` escapes in 's' and encode the result as UTF-8\n\n    This method takes the output of the JSONEncoder and expands any \\\\uNNNN\n    escapes it finds (except for \\\\u0000 to \\\\u001F, which are converted to\n    \\\\xNN escapes).\n\n    For performance, it assumes that the input is valid JSON, and performs few\n    sanity checks.\n    \"\"\"\n\n    # make the fast path fast: if there are no matches in the string, the\n    # whole thing is ascii. On python 2, that means we're done. On python 3,\n    # we have to turn it into a bytes, which is quickest with encode('utf-8')\n    arg_1 = _U_ESCAPE.search(arg_0)\n    if not arg_1:\n        return arg_0 if PY2 else arg_0.encode('utf-8')\n\n    # appending to a string (or a bytes) is slooow, so we accumulate sections\n    # of string result in 'chunks', and join them all together later.\n    # (It doesn't seem to make much difference whether we accumulate\n    # utf8-encoded bytes, or strings which we utf-8 encode after rejoining)\n    #\n    arg_2 = []\n\n    # 'pos' tracks the index in 's' that we have processed into 'chunks' so\n    # far.\n    arg_3 = 0\n\n    while arg_1:\n        arg_4 = arg_1.start()\n        arg_5 = arg_1.end()\n\n        arg_6 = arg_1.group(1)\n\n        if arg_6 is None:\n            # escaped backslash: pass it through along with anything before the\n            # match\n            arg_2.append(arg_0[arg_3:arg_5])\n        else:\n            # \\uNNNN, but we have to watch out for surrogate pairs.\n            #\n            # On python 2, str.encode(\"utf-8\") will decode utf-16 surrogates\n            # before re-encoding, so it's fine for us to pass the surrogates\n            # through. (Indeed we must, to deal with UCS-2 python builds, per\n            # https://github.com/matrix-org/python-canonicaljson/issues/12).\n            #\n            # On python 3, str.encode(\"utf-8\") complains about surrogates, so\n            # we have to unpack them.\n            arg_7 = int(arg_6, 16)\n\n            if arg_7 < 0x20:\n                # leave as a \\uNNNN escape\n                arg_2.append(arg_0[arg_3:arg_5])\n            else:\n                if PY3:   # pragma nocover\n                    if arg_7 & 0xfc00 == 0xd800 and arg_0[arg_5:arg_5 + 2] == '\\\\u':\n                        arg_8 = arg_0[arg_5 + 2:arg_5 + 6]\n                        arg_9 = int(arg_8, 16)\n                        if arg_9 & 0xfc00 == 0xdc00:\n                            arg_7 = 0x10000 + (((arg_7 - 0xd800) << 10) |\n                                           (arg_9 - 0xdc00))\n                            arg_5 += 6\n\n                arg_2.append(arg_0[arg_3:arg_4])\n                arg_2.append(unichr(arg_7))\n\n        arg_3 = arg_5\n        arg_1 = _U_ESCAPE.search(arg_0, arg_3)\n\n    # pass through anything after the last match\n    arg_2.append(arg_0[arg_3:])\n\n    return (''.join(arg_2)).encode(\"utf-8\")", "path": "canonicaljson.py", "identifier": "_unascii", "docstring": "Unpack `\\\\uNNNN` escapes in 's' and encode the result as UTF-8\n\n    This method takes the output of the JSONEncoder and expands any \\\\uNNNN\n    escapes it finds (except for \\\\u0000 to \\\\u001F, which are converted to\n    \\\\xNN escapes).\n\n    For performance, it assumes that the input is valid JSON, and performs few\n    sanity checks.", "docstring_tokens": ["Unpack", "\\\\", "uNNNN", "escapes", "in", "s", "and", "encode", "the", "result", "as", "UTF", "-", "8"], "nwo": "matrix-org/python-canonicaljson", "score": 0.28445842098515983, "idx": 255112}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/vpc.py#L90-L98", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Gets the VPC Subnets", "language": "python", "parameters": "(vpc, **conn)", "return_statement": "return s_ids", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "describe_subnets", "(", "Filters", "=", "[", "{", "\"Name\"", ":", "\"vpc-id\"", ",", "\"Values\"", ":", "[", "arg_0", "[", "\"id\"", "]", "]", "}", "]", ",", "**", "arg_1", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "arg_3", ".", "append", "(", "arg_4", "[", "\"SubnetId\"", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Gets the VPC Subnets\"\"\"\n    arg_2 = describe_subnets(Filters=[{\"Name\": \"vpc-id\", \"Values\": [arg_0[\"id\"]]}], **arg_1)\n\n    arg_3 = []\n    for arg_4 in arg_2:\n        arg_3.append(arg_4[\"SubnetId\"])\n\n    return arg_3", "path": "cloudaux/orchestration/aws/vpc.py", "identifier": "get_subnets", "docstring": "Gets the VPC Subnets", "docstring_tokens": ["Gets", "the", "VPC", "Subnets"], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 255113}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/misc.py#L42-L49", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "All python files caller's dir without the path and trailing .py", "language": "python", "parameters": "(callername, level=2)", "return_statement": "return [ os.path.basename(filename[0:-3]) for filename in py_files ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", ")", ":", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'[a-zA-Z]*.py'", ")", ")", "arg_3", "=", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'[a-zA-Z]*.py'", ")", ")", "return", "[", "os", ".", "path", ".", "basename", "(", "arg_4", "[", "0", ":", "-", "3", "]", ")", "for", "arg_4", "in", "arg_3", "]"], "function": "def Func(arg_0, arg_1=2):\n    \"All python files caller's dir without the path and trailing .py\"\n    arg_2 = os.path.dirname(arg_0)\n    # Get the name of our directory.\n    # A glob pattern that will get all *.py files but not __init__.py\n    glob(os.path.join(arg_2, '[a-zA-Z]*.py'))\n    arg_3 = glob(os.path.join(arg_2, '[a-zA-Z]*.py'))\n    return [ os.path.basename(arg_4[0:-3]) for arg_4 in arg_3 ]", "path": "trepan/misc.py", "identifier": "pyfiles", "docstring": "All python files caller's dir without the path and trailing .py", "docstring_tokens": ["All", "python", "files", "caller", "s", "dir", "without", "the", "path", "and", "trailing", ".", "py"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 255114}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L539-L546", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Instances of IPyAutocall in user_ns get autocalled immediately", "language": "python", "parameters": "(self, line_info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "shell", ".", "user_ns", ".", "get", "(", "arg_1", ".", "ifun", ",", "None", ")", "if", "isinstance", "(", "arg_2", ",", "IPyAutocall", ")", ":", "arg_2", ".", "set_ip", "(", "arg_0", ".", "shell", ")", "return", "arg_0", ".", "prefilter_manager", ".", "get_handler_by_name", "(", "'auto'", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"Instances of IPyAutocall in user_ns get autocalled immediately\"\n        arg_2 = arg_0.shell.user_ns.get(arg_1.ifun, None)\n        if isinstance(arg_2, IPyAutocall):\n            arg_2.set_ip(arg_0.shell)\n            return arg_0.prefilter_manager.get_handler_by_name('auto')\n        else:\n            return None", "path": "environment/lib/python2.7/site-packages/IPython/core/prefilter.py", "identifier": "IPyAutocallChecker.check", "docstring": "Instances of IPyAutocall in user_ns get autocalled immediately", "docstring_tokens": ["Instances", "of", "IPyAutocall", "in", "user_ns", "get", "autocalled", "immediately"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255115}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L58-L75", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Given a sequence of sequences, return a flat numpy array.", "language": "python", "parameters": "(iterables)", "return_statement": "return np.array(arr)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_1", ".", "extend", "(", "arg_2", ")", "return", "np", ".", "array", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    '''Given a sequence of sequences, return a flat numpy array.\n\n    Parameters\n    ----------\n    iterables : sequence of sequence of number\n        A sequence of tuples or lists containing numbers. Typically these come\n        from something that represents each joint in a skeleton, like angle.\n\n    Returns\n    -------\n    ndarray :\n        An array of flattened data from each of the source iterables.\n    '''\n    arg_1 = []\n    for arg_2 in arg_0:\n        arg_1.extend(arg_2)\n    return np.array(arg_1)", "path": "pagoda/skeleton.py", "identifier": "as_flat_array", "docstring": "Given a sequence of sequences, return a flat numpy array.\n\n    Parameters\n    ----------\n    iterables : sequence of sequence of number\n        A sequence of tuples or lists containing numbers. Typically these come\n        from something that represents each joint in a skeleton, like angle.\n\n    Returns\n    -------\n    ndarray :\n        An array of flattened data from each of the source iterables.", "docstring_tokens": ["Given", "a", "sequence", "of", "sequences", "return", "a", "flat", "numpy", "array", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 255116}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/compiler.py#L128-L132", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Check if a name is declared in this or an outer scope.", "language": "python", "parameters": "(self, name)", "return_statement": "return name in self.declared", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "declared_locally", "or", "arg_1", "in", "arg_0", ".", "declared_parameter", ":", "return", "True", "return", "arg_1", "in", "arg_0", ".", "declared"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check if a name is declared in this or an outer scope.\"\"\"\n        if arg_1 in arg_0.declared_locally or arg_1 in arg_0.declared_parameter:\n            return True\n        return arg_1 in arg_0.declared", "path": "capybara/virtualenv/lib/python2.7/site-packages/jinja2/compiler.py", "identifier": "Identifiers.is_declared", "docstring": "Check if a name is declared in this or an outer scope.", "docstring_tokens": ["Check", "if", "a", "name", "is", "declared", "in", "this", "or", "an", "outer", "scope", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255117}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L491-L522", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Descend a path to return a folder id starting from the given folder id.", "language": "python", "parameters": "(parsed_path, folder_id)", "return_statement": "return cur_folder_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "arg_1", "arg_2", ".", "token", "=", "verify_credentials", "(", ")", "arg_4", "=", "arg_2", ".", "communicator", ".", "folder_get", "(", "arg_2", ".", "token", ",", "arg_1", ")", "arg_5", "=", "-", "1", "for", "arg_6", "in", "arg_0", ":", "arg_5", "=", "arg_4", "[", "'folder_id'", "]", "arg_7", "=", "arg_2", ".", "communicator", ".", "folder_children", "(", "arg_2", ".", "token", ",", "arg_5", ")", "for", "arg_8", "in", "arg_7", "[", "'folders'", "]", ":", "if", "arg_8", "[", "'name'", "]", "==", "arg_6", ":", "arg_4", "=", "arg_2", ".", "communicator", ".", "folder_get", "(", "arg_2", ".", "token", ",", "arg_8", "[", "'folder_id'", "]", ")", "arg_5", "=", "arg_4", "[", "'folder_id'", "]", "break", "else", ":", "return", "-", "1", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Descend a path to return a folder id starting from the given folder id.\n\n    :param parsed_path: a list of folders from top to bottom of a hierarchy\n    :type parsed_path: list[string]\n    :param folder_id: The id of the folder from which to start the descent\n    :type folder_id: int | long\n    :returns: The id of the found folder or -1\n    :rtype: int | long\n    \"\"\"\n    if len(arg_0) == 0:\n        return arg_1\n\n    arg_2.token = verify_credentials()\n\n    arg_4 = arg_2.communicator.folder_get(arg_2.token,\n                                                  arg_1)\n    arg_5 = -1\n    for arg_6 in arg_0:\n        arg_5 = arg_4['folder_id']\n        arg_7 = arg_2.communicator.folder_children(\n            arg_2.token, arg_5)\n        for arg_8 in arg_7['folders']:\n            if arg_8['name'] == arg_6:\n                arg_4 = arg_2.communicator.folder_get(\n                    arg_2.token, arg_8['folder_id'])\n                arg_5 = arg_4['folder_id']\n                break\n        else:\n            return -1\n    return arg_5", "path": "pydas/api.py", "identifier": "_descend_folder_for_id", "docstring": "Descend a path to return a folder id starting from the given folder id.\n\n    :param parsed_path: a list of folders from top to bottom of a hierarchy\n    :type parsed_path: list[string]\n    :param folder_id: The id of the folder from which to start the descent\n    :type folder_id: int | long\n    :returns: The id of the found folder or -1\n    :rtype: int | long", "docstring_tokens": ["Descend", "a", "path", "to", "return", "a", "folder", "id", "starting", "from", "the", "given", "folder", "id", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 255118}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/worker.py#L50-L71", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Custom method to execute a job and notify of its result", "language": "python", "parameters": "(self, job, queue)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "super", "(", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_1", ".", "get_status", "(", ")", "arg_5", "=", "arg_1", ".", "return_value", "if", "arg_4", "==", "'finished'", "else", "None", "arg_6", "=", "{", "'job_id'", ":", "arg_1", ".", "id", ",", "'status'", ":", "arg_4", ",", "'result'", ":", "arg_5", "}", "arg_7", "=", "pickle", ".", "dumps", "(", "arg_6", ")", "arg_0", ".", "connection", ".", "publish", "(", "arg_0", ".", "pubsub_channel", ",", "arg_7", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Custom method to execute a job and notify of its result\n\n        :param job: Job object\n        :param queue: the queue containing the object\n        \"\"\"\n\n        arg_3 = super().Func(arg_1, arg_2)\n\n        arg_4 = arg_1.get_status()\n        arg_5 = arg_1.return_value if arg_4 == 'finished' else None\n\n        arg_6 = {\n            'job_id': arg_1.id,\n            'status': arg_4,\n            'result': arg_5\n        }\n\n        arg_7 = pickle.dumps(arg_6)\n        arg_0.connection.publish(arg_0.pubsub_channel, arg_7)\n\n        return arg_3", "path": "arthur/worker.py", "identifier": "ArthurWorker.perform_job", "docstring": "Custom method to execute a job and notify of its result\n\n        :param job: Job object\n        :param queue: the queue containing the object", "docstring_tokens": ["Custom", "method", "to", "execute", "a", "job", "and", "notify", "of", "its", "result"], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 255119}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/meta.py#L365-L380", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Compute the index key that can be used to identify an instance\n        on the link.", "language": "python", "parameters": "(self, to_instance)", "return_statement": "return frozenset(tuple(kwargs.items()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "for", "arg_3", "in", "arg_0", ".", "key_map", ".", "values", "(", ")", ":", "if", "_is_null", "(", "arg_1", ",", "arg_3", ")", ":", "return", "None", "if", "arg_3", "in", "arg_1", ".", "__dict__", ":", "arg_2", "[", "arg_3", "]", "=", "arg_1", ".", "__dict__", "[", "arg_3", "]", "else", ":", "arg_2", "[", "arg_3", "]", "=", "getattr", "(", "arg_1", ",", "arg_3", ")", "return", "frozenset", "(", "tuple", "(", "arg_2", ".", "items", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Compute the index key that can be used to identify an instance\n        on the link.\n        '''\n        arg_2 = dict()\n        for arg_3 in arg_0.key_map.values():\n            if _is_null(arg_1, arg_3):\n                return None\n            \n            if arg_3 in arg_1.__dict__:\n                arg_2[arg_3] = arg_1.__dict__[arg_3]\n            else:\n                arg_2[arg_3] = getattr(arg_1, arg_3)\n\n        return frozenset(tuple(arg_2.items()))", "path": "xtuml/meta.py", "identifier": "Link.compute_index_key", "docstring": "Compute the index key that can be used to identify an instance\n        on the link.", "docstring_tokens": ["Compute", "the", "index", "key", "that", "can", "be", "used", "to", "identify", "an", "instance", "on", "the", "link", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 255120}
{"url": "https://github.com/genepattern/genepattern-notebook/blob/953168bd08c5332412438cbc5bb59993a07a6911/genepattern/remote_widgets.py#L185-L200", "sha": "953168bd08c5332412438cbc5bb59993a07a6911", "docstring_summary": "Display a widget, text or other media in a notebook without the need to import IPython at the top level.", "language": "python", "parameters": "(content)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "gp", ".", "GPServer", ")", ":", "IPython", ".", "Func", ".", "Func", "(", "GPAuthWidget", "(", "arg_0", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "gp", ".", "GPTask", ")", ":", "IPython", ".", "Func", ".", "Func", "(", "GPTaskWidget", "(", "arg_0", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "gp", ".", "GPJob", ")", ":", "IPython", ".", "Func", ".", "Func", "(", "GPJobWidget", "(", "arg_0", ")", ")", "else", ":", "IPython", ".", "Func", ".", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Display a widget, text or other media in a notebook without the need to import IPython at the top level.\n\n    Also handles wrapping GenePattern Python Library content in widgets.\n    :param content:\n    :return:\n    \"\"\"\n    if isinstance(arg_0, gp.GPServer):\n        IPython.Func.Func(GPAuthWidget(arg_0))\n    elif isinstance(arg_0, gp.GPTask):\n        IPython.Func.Func(GPTaskWidget(arg_0))\n    elif isinstance(arg_0, gp.GPJob):\n        IPython.Func.Func(GPJobWidget(arg_0))\n    else:\n        IPython.Func.Func(arg_0)", "path": "genepattern/remote_widgets.py", "identifier": "display", "docstring": "Display a widget, text or other media in a notebook without the need to import IPython at the top level.\n\n    Also handles wrapping GenePattern Python Library content in widgets.\n    :param content:\n    :return:", "docstring_tokens": ["Display", "a", "widget", "text", "or", "other", "media", "in", "a", "notebook", "without", "the", "need", "to", "import", "IPython", "at", "the", "top", "level", "."], "nwo": "genepattern/genepattern-notebook", "score": 0.3808448249966359, "idx": 255121}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/client/client.py#L568-L602", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "GETs the object and returns the results.", "language": "python", "parameters": "(self, container, obj, headers=None, stream=True, query=None,\n                   cdn=False)", "return_statement": "return self.request(\n            'GET', path, '', headers, query=query, stream=stream, cdn=cdn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "arg_0", ".", "_object_path", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "request", "(", "'GET'", ",", "arg_7", ",", "''", ",", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=True, arg_5=None,\n                   arg_6=False):\n        \"\"\"\n        GETs the object and returns the results.\n\n        :param container: The name of the container.\n        :param obj: The name of the object.\n        :param headers: Additional headers to send with the request.\n        :param stream: Indicates whether to stream the contents or\n            preread them fully and return them as a str. Default:\n            True to stream the contents. When streaming, contents\n            will have the standard file-like-object read function,\n            which accepts an optional size parameter to limit how\n            much data is read per call. When streaming is on, be\n            certain to fully read the contents before issuing another\n            request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: if *stream* was True, *contents* is a\n                file-like-object of the contents of the HTTP body. If\n                *stream* was False, *contents* is just a simple str of\n                the HTTP body.\n        \"\"\"\n        arg_7 = arg_0._object_path(arg_1, arg_2)\n        return arg_0.request(\n            'GET', arg_7, '', arg_3, arg_5=arg_5, arg_4=arg_4, arg_6=arg_6)", "path": "swiftly/client/client.py", "identifier": "Client.get_object", "docstring": "GETs the object and returns the results.\n\n        :param container: The name of the container.\n        :param obj: The name of the object.\n        :param headers: Additional headers to send with the request.\n        :param stream: Indicates whether to stream the contents or\n            preread them fully and return them as a str. Default:\n            True to stream the contents. When streaming, contents\n            will have the standard file-like-object read function,\n            which accepts an optional size parameter to limit how\n            much data is read per call. When streaming is on, be\n            certain to fully read the contents before issuing another\n            request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: if *stream* was True, *contents* is a\n                file-like-object of the contents of the HTTP body. If\n                *stream* was False, *contents* is just a simple str of\n                the HTTP body.", "docstring_tokens": ["GETs", "the", "object", "and", "returns", "the", "results", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 255122}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/git_access.py#L48-L62", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "return a list of GitCloneVersion objects for tags which are valid\n            semantic version idenfitifiers.", "language": "python", "parameters": "(self)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "vcs", ".", "tags", "(", ")", ":", "logger", ".", "debug", "(", "\"available version tag: %s\"", ",", "arg_2", ")", "if", "not", "len", "(", "arg_2", ".", "strip", "(", ")", ")", ":", "continue", "try", ":", "arg_1", ".", "append", "(", "GitCloneVersion", "(", "arg_2", ",", "arg_2", ",", "arg_0", ")", ")", "except", "ValueError", ":", "logger", ".", "debug", "(", "'invalid version tag: %s'", ",", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        ''' return a list of GitCloneVersion objects for tags which are valid\n            semantic version idenfitifiers.\n        '''\n        arg_1 = []\n        for arg_2 in arg_0.vcs.tags():\n            logger.debug(\"available version tag: %s\", arg_2)\n            # ignore empty tags:\n            if not len(arg_2.strip()):\n                continue\n            try:\n                arg_1.append(GitCloneVersion(arg_2, arg_2, arg_0))\n            except ValueError:\n                logger.debug('invalid version tag: %s', arg_2)\n        return arg_1", "path": "yotta/lib/git_access.py", "identifier": "GitWorkingCopy.availableVersions", "docstring": "return a list of GitCloneVersion objects for tags which are valid\n            semantic version idenfitifiers.", "docstring_tokens": ["return", "a", "list", "of", "GitCloneVersion", "objects", "for", "tags", "which", "are", "valid", "semantic", "version", "idenfitifiers", "."], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 255123}
{"url": "https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L162-L202", "sha": "cd5c6e10c6c4e653669e11d735d5773766986bda", "docstring_summary": "Call the disambiguation service in order to process a pdf file .", "language": "python", "parameters": "(self, file, language=None, entities=None)", "return_statement": "return self.decode(res), status", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "\"customisation\"", ":", "\"generic\"", "}", "if", "arg_2", ":", "arg_4", "[", "'language'", "]", "=", "{", "\"lang\"", ":", "arg_2", "}", "if", "arg_3", ":", "arg_4", "[", "'entities'", "]", "=", "arg_3", "arg_5", "=", "{", "'query'", ":", "str", "(", "arg_4", ")", ",", "'file'", ":", "(", "arg_1", ",", "open", "(", "arg_1", ",", "'rb'", ")", ",", "'application/pdf'", ",", "{", "'Expires'", ":", "'0'", "}", ")", "}", "arg_6", ",", "arg_7", "=", "arg_0", ".", "post", "(", "arg_0", ".", "disambiguate_service", ",", "arg_5", "=", "arg_5", ",", "headers", "=", "{", "'Accept'", ":", "'application/json'", "}", ",", ")", "if", "arg_7", "!=", "200", ":", "logger", ".", "debug", "(", "'Disambiguation failed with error '", "+", "str", "(", "arg_7", ")", ")", "return", "arg_0", ".", "decode", "(", "arg_6", ")", ",", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\" Call the disambiguation service in order to process a pdf file .\n\n        Args:\n            pdf (file): PDF file to be disambiguated.\n            language (str): language of text (if known)\n\n        Returns:\n            dict, int: API response and API status.\n        \"\"\"\n\n        arg_4 = {\n            \"customisation\": \"generic\"\n        }\n\n        if arg_2:\n            arg_4['language'] = {\"lang\": arg_2}\n\n        if arg_3:\n            arg_4['entities'] = arg_3\n\n        arg_5 = {\n            'query': str(arg_4),\n            'file': (\n                arg_1,\n                open(arg_1, 'rb'),\n                'application/pdf',\n                {'Expires': '0'}\n            )\n        }\n\n        arg_6, arg_7 = arg_0.post(\n            arg_0.disambiguate_service,\n            arg_5=arg_5,\n            headers={'Accept': 'application/json'},\n        )\n\n        if arg_7 != 200:\n            logger.debug('Disambiguation failed with error ' + str(arg_7))\n\n        return arg_0.decode(arg_6), arg_7", "path": "nerd/nerd_client.py", "identifier": "NerdClient.disambiguate_pdf", "docstring": "Call the disambiguation service in order to process a pdf file .\n\n        Args:\n            pdf (file): PDF file to be disambiguated.\n            language (str): language of text (if known)\n\n        Returns:\n            dict, int: API response and API status.", "docstring_tokens": ["Call", "the", "disambiguation", "service", "in", "order", "to", "process", "a", "pdf", "file", "."], "nwo": "hirmeos/entity-fishing-client-python", "score": 0.36576314591848075, "idx": 255124}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L51-L62", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Close the socket to free system resources.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Funcd", ":", "return", "arg_0", ".", "_socket", ".", "Func", "(", ")", "arg_0", ".", "_Funcd", "=", "True"], "function": "def Func(arg_0):\n        # type: () -> None\n        \"\"\"Close the socket to free system resources.\n\n        After the socket is Funcd, further operations with socket\n        will fail. Multiple calls to Func will have no effect.\n        \"\"\"\n\n        if arg_0._Funcd:\n            return\n        arg_0._socket.Func()\n        arg_0._Funcd = True", "path": "statsdmetrics/client/__init__.py", "identifier": "AutoClosingSharedSocket.close", "docstring": "Close the socket to free system resources.\n\n        After the socket is closed, further operations with socket\n        will fail. Multiple calls to close will have no effect.", "docstring_tokens": ["Close", "the", "socket", "to", "free", "system", "resources", "."], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 255125}
{"url": "https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L483-L489", "sha": "b8b17d0317fc6728d5586553ab29a7d97e6417fd", "docstring_summary": "Return True iff this class should be considered public.", "language": "python", "parameters": "(self)", "return_statement": "return (\n            not self.name.startswith(\"_\")\n            and self.parent.is_class\n            and self.parent.is_public\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "not", "arg_0", ".", "name", ".", "startswith", "(", "\"_\"", ")", "and", "arg_0", ".", "parent", ".", "is_class", "and", "arg_0", ".", "parent", ".", "Func", ")"], "function": "def Func(arg_0):\n        \"\"\"Return True iff this class should be considered public.\"\"\"\n        return (\n            not arg_0.name.startswith(\"_\")\n            and arg_0.parent.is_class\n            and arg_0.parent.Func\n        )", "path": "flake8_rst_docstrings.py", "identifier": "NestedClass.is_public", "docstring": "Return True iff this class should be considered public.", "docstring_tokens": ["Return", "True", "iff", "this", "class", "should", "be", "considered", "public", "."], "nwo": "peterjc/flake8-rst-docstrings", "score": 0.3935263471523765, "idx": 255126}
{"url": "https://github.com/stevelittlefish/littlefish/blob/6deee7f81fab30716c743efe2e94e786c6e17016/littlefish/validation.py#L22-L38", "sha": "6deee7f81fab30716c743efe2e94e786c6e17016", "docstring_summary": "checks to make sure that the card passes a luhn mod-10 checksum", "language": "python", "parameters": "(card_number)", "return_statement": "return (sum % 10) == 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "len", "(", "arg_0", ")", "arg_3", "=", "arg_2", "&", "1", "for", "arg_4", "in", "range", "(", "0", ",", "arg_2", ")", ":", "arg_5", "=", "int", "(", "arg_0", "[", "arg_4", "]", ")", "if", "not", "(", "(", "arg_4", "&", "1", ")", "^", "arg_3", ")", ":", "arg_5", "*=", "2", "if", "arg_5", ">", "9", ":", "arg_5", "-=", "9", "arg_1", "+=", "arg_5", "return", "(", "arg_1", "%", "10", ")", "==", "0"], "function": "def Func(arg_0):\n    \"\"\" checks to make sure that the card passes a luhn mod-10 checksum \"\"\"\n    arg_1 = 0\n    arg_2 = len(arg_0)\n    arg_3 = arg_2 & 1\n\n    for arg_4 in range(0, arg_2):\n        arg_5 = int(arg_0[arg_4])\n\n        if not ((arg_4 & 1) ^ arg_3):\n            arg_5 *= 2\n        if arg_5 > 9:\n            arg_5 -= 9\n\n        arg_1 += arg_5\n\n    return (arg_1 % 10) == 0", "path": "littlefish/validation.py", "identifier": "luhn_check", "docstring": "checks to make sure that the card passes a luhn mod-10 checksum", "docstring_tokens": ["checks", "to", "make", "sure", "that", "the", "card", "passes", "a", "luhn", "mod", "-", "10", "checksum"], "nwo": "stevelittlefish/littlefish", "score": 0.23137166388621372, "idx": 255127}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/cluster.py#L211-L258", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Print current cluster status information.", "language": "python", "parameters": "(self, detailed=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", ".", "_retrieved_at", "+", "arg_0", ".", "REFRESH_INTERVAL", "<", "time", ".", "time", "(", ")", ":", "arg_2", "=", "h2o", ".", "api", "(", "\"GET /3/Cloud\"", ")", "arg_0", ".", "_fill_from_h2ocluster", "(", "arg_2", ")", "arg_3", "=", "sum", "(", "arg_12", "[", "\"num_cpus\"", "]", "for", "arg_12", "in", "arg_0", ".", "nodes", ")", "arg_4", "=", "sum", "(", "arg_12", "[", "\"cpus_allowed\"", "]", "for", "arg_12", "in", "arg_0", ".", "nodes", ")", "arg_5", "=", "sum", "(", "arg_12", "[", "\"free_mem\"", "]", "for", "arg_12", "in", "arg_0", ".", "nodes", ")", "arg_6", "=", "sum", "(", "not", "arg_12", "[", "\"healthy\"", "]", "for", "arg_12", "in", "arg_0", ".", "nodes", ")", "arg_7", "=", "\"locked\"", "if", "arg_0", ".", "locked", "else", "\"accepting new members\"", "if", "arg_6", "==", "0", ":", "arg_7", "+=", "\", healthy\"", "else", ":", "arg_7", "+=", "\", %d nodes are not healthy\"", "%", "arg_6", "arg_8", "=", "arg_0", ".", "list_api_extensions", "(", ")", "H2ODisplay", "(", "[", "[", "\"H2O cluster uptime:\"", ",", "get_human_readable_time", "(", "arg_0", ".", "cloud_uptime_millis", ")", "]", ",", "[", "\"H2O cluster timezone:\"", ",", "arg_0", ".", "cloud_internal_timezone", "]", ",", "[", "\"H2O data parsing timezone:\"", ",", "arg_0", ".", "datafile_parser_timezone", "]", ",", "[", "\"H2O cluster version:\"", ",", "arg_0", ".", "version", "]", ",", "[", "\"H2O cluster version age:\"", ",", "\"{} {}\"", ".", "format", "(", "arg_0", ".", "build_age", ",", "(", "\"!!!\"", "if", "arg_0", ".", "build_too_old", "else", "\"\"", ")", ")", "]", ",", "[", "\"H2O cluster name:\"", ",", "arg_0", ".", "cloud_name", "]", ",", "[", "\"H2O cluster total nodes:\"", ",", "arg_0", ".", "cloud_size", "]", ",", "[", "\"H2O cluster free memory:\"", ",", "get_human_readable_bytes", "(", "arg_5", ")", "]", ",", "[", "\"H2O cluster total cores:\"", ",", "str", "(", "arg_3", ")", "]", ",", "[", "\"H2O cluster allowed cores:\"", ",", "str", "(", "arg_4", ")", "]", ",", "[", "\"H2O cluster status:\"", ",", "arg_7", "]", ",", "[", "\"H2O connection url:\"", ",", "h2o", ".", "connection", "(", ")", ".", "base_url", "]", ",", "[", "\"H2O connection proxy:\"", ",", "h2o", ".", "connection", "(", ")", ".", "proxy", "]", ",", "[", "\"H2O internal security:\"", ",", "arg_0", ".", "internal_security_enabled", "]", ",", "[", "\"H2O API Extensions:\"", ",", "', '", ".", "join", "(", "arg_8", ")", "]", ",", "[", "\"Python version:\"", ",", "\"%d.%d.%d %s\"", "%", "tuple", "(", "sys", ".", "version_info", "[", ":", "4", "]", ")", "]", ",", "]", ")", "if", "arg_1", ":", "arg_9", "=", "[", "\"h2o\"", ",", "\"healthy\"", ",", "\"last_ping\"", ",", "\"num_cpus\"", ",", "\"sys_load\"", ",", "\"mem_value_size\"", ",", "\"free_mem\"", ",", "\"pojo_mem\"", ",", "\"swap_mem\"", ",", "\"free_disk\"", ",", "\"max_disk\"", ",", "\"pid\"", ",", "\"num_keys\"", ",", "\"tcps_active\"", ",", "\"open_fds\"", ",", "\"rpcs_active\"", "]", "arg_10", "=", "[", "\"Nodes info:\"", "]", "+", "[", "\"Node %d\"", "%", "(", "arg_13", "+", "1", ")", "for", "arg_13", "in", "range", "(", "len", "(", "arg_0", ".", "nodes", ")", ")", "]", "arg_11", "=", "[", "[", "arg_14", "]", "for", "arg_14", "in", "arg_9", "]", "for", "arg_12", "in", "arg_0", ".", "nodes", ":", "for", "arg_13", ",", "arg_14", "in", "enumerate", "(", "arg_9", ")", ":", "arg_11", "[", "arg_13", "]", ".", "append", "(", "arg_12", "[", "arg_14", "]", ")", "H2ODisplay", "(", "arg_11", "=", "arg_11", ",", "arg_10", "=", "arg_10", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Print current cluster status information.\n\n        :param detailed: if True, then also print detailed information about each node.\n        \"\"\"\n        if arg_0._retrieved_at + arg_0.REFRESH_INTERVAL < time.time():\n            # Info is stale, need to refresh\n            arg_2 = h2o.api(\"GET /3/Cloud\")\n            arg_0._fill_from_h2ocluster(arg_2)\n        arg_3 = sum(arg_12[\"num_cpus\"] for arg_12 in arg_0.nodes)\n        arg_4 = sum(arg_12[\"cpus_allowed\"] for arg_12 in arg_0.nodes)\n        arg_5 = sum(arg_12[\"free_mem\"] for arg_12 in arg_0.nodes)\n        arg_6 = sum(not arg_12[\"healthy\"] for arg_12 in arg_0.nodes)\n        arg_7 = \"locked\" if arg_0.locked else \"accepting new members\"\n        if arg_6 == 0:\n            arg_7 += \", healthy\"\n        else:\n            arg_7 += \", %d nodes are not healthy\" % arg_6\n        arg_8 = arg_0.list_api_extensions()\n        H2ODisplay([\n            [\"H2O cluster uptime:\",        get_human_readable_time(arg_0.cloud_uptime_millis)],\n            [\"H2O cluster timezone:\",      arg_0.cloud_internal_timezone],\n            [\"H2O data parsing timezone:\", arg_0.datafile_parser_timezone],\n            [\"H2O cluster version:\",       arg_0.version],\n            [\"H2O cluster version age:\",   \"{} {}\".format(arg_0.build_age, (\"!!!\" if arg_0.build_too_old else \"\"))],\n            [\"H2O cluster name:\",          arg_0.cloud_name],\n            [\"H2O cluster total nodes:\",   arg_0.cloud_size],\n            [\"H2O cluster free memory:\",   get_human_readable_bytes(arg_5)],\n            [\"H2O cluster total cores:\",   str(arg_3)],\n            [\"H2O cluster allowed cores:\", str(arg_4)],\n            [\"H2O cluster status:\",        arg_7],\n            [\"H2O connection url:\",        h2o.connection().base_url],\n            [\"H2O connection proxy:\",      h2o.connection().proxy],\n            [\"H2O internal security:\",     arg_0.internal_security_enabled],\n            [\"H2O API Extensions:\",        ', '.join(arg_8)],\n            [\"Python version:\",            \"%d.%d.%d %s\" % tuple(sys.version_info[:4])],\n        ])\n\n        if arg_1:\n            arg_9 = [\"h2o\", \"healthy\", \"last_ping\", \"num_cpus\", \"sys_load\", \"mem_value_size\", \"free_mem\", \"pojo_mem\",\n                    \"swap_mem\", \"free_disk\", \"max_disk\", \"pid\", \"num_keys\", \"tcps_active\", \"open_fds\", \"rpcs_active\"]\n            arg_10 = [\"Nodes info:\"] + [\"Node %d\" % (arg_13 + 1) for arg_13 in range(len(arg_0.nodes))]\n            arg_11 = [[arg_14] for arg_14 in arg_9]\n            for arg_12 in arg_0.nodes:\n                for arg_13, arg_14 in enumerate(arg_9):\n                    arg_11[arg_13].append(arg_12[arg_14])\n            H2ODisplay(arg_11=arg_11, arg_10=arg_10)", "path": "h2o-py/h2o/backend/cluster.py", "identifier": "H2OCluster.show_status", "docstring": "Print current cluster status information.\n\n        :param detailed: if True, then also print detailed information about each node.", "docstring_tokens": ["Print", "current", "cluster", "status", "information", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255128}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/wikipedia.py#L499-L538", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Parses data from Wikipedia page markup.", "language": "python", "parameters": "(self, light=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "markup", "arg_0", ".", "disambiguation", "=", "arg_0", ".", "Func_disambiguation", "(", "arg_2", ")", "arg_0", ".", "categories", "=", "arg_0", ".", "Func_categories", "(", "arg_2", ")", "arg_0", ".", "links", "=", "arg_0", ".", "Func_links", "(", "arg_2", ")", "if", "not", "arg_1", ":", "arg_2", "=", "arg_0", ".", "convert_pre", "(", "arg_2", ")", "arg_2", "=", "arg_0", ".", "convert_li", "(", "arg_2", ")", "arg_2", "=", "arg_0", ".", "convert_table", "(", "arg_2", ")", "arg_2", "=", "replace_entities", "(", "arg_2", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "\"{{Cite\"", ",", "\"{{cite\"", ")", "arg_2", "=", "re", ".", "sub", "(", "\"\\{\\{ {1,2}cite\"", ",", "\"{{cite\"", ",", "arg_2", ")", "arg_0", ".", "references", ",", "arg_2", "=", "arg_0", ".", "Func_references", "(", "arg_2", ")", "arg_2", "=", "re", ".", "sub", "(", "\"\\n+(\\{\\{legend)\"", ",", "\"\\\\1\"", ",", "arg_2", ")", "arg_0", ".", "images", ",", "arg_2", "=", "arg_0", ".", "Func_images", "(", "arg_2", ")", "arg_0", ".", "images", ".", "extend", "(", "arg_0", ".", "Func_gallery_images", "(", "arg_2", ")", ")", "arg_0", ".", "paragraphs", "=", "arg_0", ".", "Func_paragraphs", "(", "arg_2", ")", "arg_0", ".", "tables", "=", "arg_0", ".", "Func_tables", "(", "arg_2", ")", "arg_0", ".", "translations", "=", "arg_0", ".", "Func_translations", "(", "arg_2", ")", "arg_0", ".", "important", "=", "arg_0", ".", "Func_important", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False):\n\n        \"\"\" Parses data from Wikipedia page markup.\n\n        The markup comes from Wikipedia's edit page.\n        We Func it here into objects containing plain text.\n        The light version Funcs only links to other articles, it's faster than a full Func.    \n        \n        \"\"\"\n\n        arg_2 = arg_0.markup\n        \n        arg_0.disambiguation = arg_0.Func_disambiguation(arg_2)\n        arg_0.categories = arg_0.Func_categories(arg_2)\n        arg_0.links = arg_0.Func_links(arg_2)\n        \n        if not arg_1:\n        \n            # Conversion of HTML markup to Wikipedia markup.\n            arg_2 = arg_0.convert_pre(arg_2)\n            arg_2 = arg_0.convert_li(arg_2)\n            arg_2 = arg_0.convert_table(arg_2)\n            arg_2 = replace_entities(arg_2)\n        \n            # Harvest references from the markup\n            # and replace them by footnotes.\n            arg_2 = arg_2.replace(\"{{Cite\", \"{{cite\")\n            arg_2 = re.sub(\"\\{\\{ {1,2}cite\", \"{{cite\", arg_2)\n            arg_0.references, arg_2 = arg_0.Func_references(arg_2)\n\n            # Make sure there are no legend linebreaks in image links.\n            # Then harvest images and strip them from the markup.\n            arg_2 = re.sub(\"\\n+(\\{\\{legend)\", \"\\\\1\", arg_2)\n            arg_0.images, arg_2 = arg_0.Func_images(arg_2)\n            arg_0.images.extend(arg_0.Func_gallery_images(arg_2))\n            \n            arg_0.paragraphs = arg_0.Func_paragraphs(arg_2)\n            arg_0.tables = arg_0.Func_tables(arg_2)\n            arg_0.translations = arg_0.Func_translations(arg_2)\n            arg_0.important = arg_0.Func_important(arg_2)", "path": "lib/web/wikipedia.py", "identifier": "WikipediaPage.parse", "docstring": "Parses data from Wikipedia page markup.\n\n        The markup comes from Wikipedia's edit page.\n        We parse it here into objects containing plain text.\n        The light version parses only links to other articles, it's faster than a full parse.", "docstring_tokens": ["Parses", "data", "from", "Wikipedia", "page", "markup", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255129}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/packet.py#L477-L481", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Get 3D markers.", "language": "python", "parameters": "(self, component_info=None, data=None, component_position=None)", "return_statement": "return self._get_3d_markers(\n            RT3DMarkerPosition, component_info, data, component_position\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "return", "arg_0", ".", "_Func", "(", "RT3DMarkerPosition", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Get 3D markers.\"\"\"\n        return arg_0._Func(\n            RT3DMarkerPosition, arg_1, arg_2, arg_3\n        )", "path": "qtm/packet.py", "identifier": "QRTPacket.get_3d_markers", "docstring": "Get 3D markers.", "docstring_tokens": ["Get", "3D", "markers", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 255130}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/guppi.py#L315-L341", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Seek through the file to find how many data blocks there are in the file", "language": "python", "parameters": "(self)", "return_statement": "return n_blocks", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "file_obj", ".", "seek", "(", "0", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "read_header", "(", ")", "arg_0", ".", "file_obj", ".", "seek", "(", "arg_2", ")", "arg_3", "=", "int", "(", "arg_1", "[", "'BLOCSIZE'", "]", ")", "arg_4", "=", "int", "(", "arg_1", "[", "'NBITS'", "]", ")", "arg_0", ".", "file_obj", ".", "seek", "(", "int", "(", "arg_1", "[", "'BLOCSIZE'", "]", ")", ",", "1", ")", "arg_5", "=", "1", "arg_6", "=", "False", "while", "not", "arg_6", ":", "try", ":", "arg_7", ",", "arg_8", "=", "arg_0", ".", "read_header", "(", ")", "arg_0", ".", "file_obj", ".", "seek", "(", "arg_8", ")", "arg_0", ".", "file_obj", ".", "seek", "(", "arg_7", "[", "'BLOCSIZE'", "]", ",", "1", ")", "arg_5", "+=", "1", "except", "EndOfFileError", ":", "arg_6", "=", "True", "break", "arg_0", ".", "file_obj", ".", "seek", "(", "0", ")", "return", "arg_5"], "function": "def Func(arg_0):\n        \"\"\" Seek through the file to find how many data blocks there are in the file\n\n        Returns:\n            n_blocks (int): number of data blocks in the file\n        \"\"\"\n        arg_0.file_obj.seek(0)\n        arg_1, arg_2 = arg_0.read_header()\n\n        arg_0.file_obj.seek(arg_2)\n        arg_3 = int(arg_1['BLOCSIZE'])\n        arg_4 = int(arg_1['NBITS'])\n        arg_0.file_obj.seek(int(arg_1['BLOCSIZE']), 1)\n        arg_5 = 1\n        arg_6 = False\n        while not arg_6:\n            try:\n                arg_7, arg_8 = arg_0.read_header()\n                arg_0.file_obj.seek(arg_8)\n                arg_0.file_obj.seek(arg_7['BLOCSIZE'], 1)\n                arg_5 += 1\n            except EndOfFileError:\n                arg_6 = True\n                break\n\n        arg_0.file_obj.seek(0)\n        return arg_5", "path": "blimpy/guppi.py", "identifier": "GuppiRaw.find_n_data_blocks", "docstring": "Seek through the file to find how many data blocks there are in the file\n\n        Returns:\n            n_blocks (int): number of data blocks in the file", "docstring_tokens": ["Seek", "through", "the", "file", "to", "find", "how", "many", "data", "blocks", "there", "are", "in", "the", "file"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 255131}
{"url": "https://github.com/sendwithus/sendwithus_python/blob/8ae50d514febd44f7d9be3c838b4d92f99412832/sendwithus/__init__.py#L308-L346", "sha": "8ae50d514febd44f7d9be3c838b4d92f99412832", "docstring_summary": "API call to create a new version of a template", "language": "python", "parameters": "(\n        self,\n        name,\n        subject,\n        text='',\n        template_id=None,\n        html=None,\n        locale=None,\n        timeout=None\n    )", "return_statement": "return self._api_request(\n            url,\n            self.HTTP_POST,\n            payload=payload,\n            timeout=timeout\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "''", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ")", ":", "if", "(", "arg_5", ")", ":", "arg_8", "=", "{", "'name'", ":", "arg_1", ",", "'subject'", ":", "arg_2", ",", "'html'", ":", "arg_5", ",", "'text'", ":", "arg_3", "}", "else", ":", "arg_8", "=", "{", "'name'", ":", "arg_1", ",", "'subject'", ":", "arg_2", ",", "'text'", ":", "arg_3", "}", "if", "arg_6", ":", "arg_9", "=", "arg_0", ".", "TEMPLATES_SPECIFIC_LOCALE_VERSIONS_ENDPOINT", "%", "(", "arg_4", ",", "arg_6", ")", "else", ":", "arg_9", "=", "arg_0", ".", "TEMPLATES_NEW_VERSION_ENDPOINT", "%", "arg_4", "return", "arg_0", ".", "_api_request", "(", "arg_9", ",", "arg_0", ".", "HTTP_POST", ",", "arg_8", "=", "arg_8", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(\n        arg_0,\n        arg_1,\n        arg_2,\n        arg_3='',\n        arg_4=None,\n        arg_5=None,\n        arg_6=None,\n        arg_7=None\n    ):\n        \"\"\" API call to create a new version of a template \"\"\"\n        if(arg_5):\n            arg_8 = {\n                'name': arg_1,\n                'subject': arg_2,\n                'html': arg_5,\n                'text': arg_3\n            }\n        else:\n            arg_8 = {\n                'name': arg_1,\n                'subject': arg_2,\n                'text': arg_3\n            }\n\n        if arg_6:\n            arg_9 = arg_0.TEMPLATES_SPECIFIC_LOCALE_VERSIONS_ENDPOINT % (\n                arg_4,\n                arg_6\n            )\n        else:\n            arg_9 = arg_0.TEMPLATES_NEW_VERSION_ENDPOINT % arg_4\n\n        return arg_0._api_request(\n            arg_9,\n            arg_0.HTTP_POST,\n            arg_8=arg_8,\n            arg_7=arg_7\n        )", "path": "sendwithus/__init__.py", "identifier": "api.create_new_version", "docstring": "API call to create a new version of a template", "docstring_tokens": ["API", "call", "to", "create", "a", "new", "version", "of", "a", "template"], "nwo": "sendwithus/sendwithus_python", "score": 0.2828805321802978, "idx": 255132}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/organisation.py#L55-L66", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Update this organisations information. Returns a new organisation\n        object.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return self.create_organisation(organisation_json)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", ",", "http_method", "=", "'PUT'", ",", "arg_1", "=", "arg_1", "or", "{", "}", ")", "return", "arg_0", ".", "create_organisation", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''\n        Update this organisations information. Returns a new organisation\n        object.\n        '''\n        arg_2 = arg_0.fetch_json(\n            uri_path=arg_0.base_uri,\n            http_method='PUT',\n            arg_1=arg_1 or {}\n        )\n\n        return arg_0.create_organisation(arg_2)", "path": "trolly/organisation.py", "identifier": "Organisation.update_organisation", "docstring": "Update this organisations information. Returns a new organisation\n        object.", "docstring_tokens": ["Update", "this", "organisations", "information", ".", "Returns", "a", "new", "organisation", "object", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 255133}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/utils.py#L24-L64", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Check if two XML elements are equal.", "language": "python", "parameters": "(element1, element2, ignore_level1_cdata = False)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "None", "in", "(", "arg_0", ",", "arg_1", ")", "or", "arg_0", ".", "tag", "!=", "arg_1", ".", "tag", ":", "return", "False", "arg_3", "=", "arg_0", ".", "items", "(", ")", "arg_3", ".", "sort", "(", ")", "arg_4", "=", "arg_1", ".", "items", "(", ")", "arg_4", ".", "sort", "(", ")", "if", "not", "arg_2", ":", "if", "arg_0", ".", "text", "!=", "arg_1", ".", "text", ":", "return", "False", "if", "arg_3", "!=", "arg_4", ":", "return", "False", "if", "len", "(", "arg_0", ")", "!=", "len", "(", "arg_1", ")", ":", "return", "False", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_5", ".", "tag", "!=", "arg_6", ".", "tag", ":", "return", "False", "if", "not", "arg_2", ":", "if", "arg_0", ".", "text", "!=", "arg_1", ".", "text", ":", "return", "False", "if", "not", "Func", "(", "arg_5", ",", "arg_6", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2 = False):\n    \"\"\"Check if two XML elements are equal.\n\n    :Parameters:\n        - `element1`: the first element to compare\n        - `element2`: the other element to compare\n        - `ignore_level1_cdata`: if direct text children of the elements\n          should be ignored for the comparision\n    :Types:\n        - `element1`: :etree:`ElementTree.Element`\n        - `element2`: :etree:`ElementTree.Element`\n        - `ignore_level1_cdata`: `bool`\n\n    :Returntype: `bool`\n    \"\"\"\n    # pylint: disable-msg=R0911\n    if None in (arg_0, arg_1) or arg_0.tag != arg_1.tag:\n        return False\n    arg_3 = arg_0.items()\n    arg_3.sort()\n    arg_4 = arg_1.items()\n    arg_4.sort()\n\n    if not arg_2:\n        if arg_0.text != arg_1.text:\n            return False\n\n    if arg_3 != arg_4:\n        return False\n\n    if len(arg_0) != len(arg_1):\n        return False\n    for arg_5, arg_6 in zip(arg_0, arg_1):\n        if arg_5.tag != arg_6.tag:\n            return False\n        if not arg_2:\n            if arg_0.text != arg_1.text:\n                return False\n        if not Func(arg_5, arg_6):\n            return False\n    return True", "path": "pyxmpp2/utils.py", "identifier": "xml_elements_equal", "docstring": "Check if two XML elements are equal.\n\n    :Parameters:\n        - `element1`: the first element to compare\n        - `element2`: the other element to compare\n        - `ignore_level1_cdata`: if direct text children of the elements\n          should be ignored for the comparision\n    :Types:\n        - `element1`: :etree:`ElementTree.Element`\n        - `element2`: :etree:`ElementTree.Element`\n        - `ignore_level1_cdata`: `bool`\n\n    :Returntype: `bool`", "docstring_tokens": ["Check", "if", "two", "XML", "elements", "are", "equal", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255134}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L1271-L1379", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Parse a file, string, or list of strings containing parameter bindings.", "language": "python", "parameters": "(bindings, skip_unknown=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_0", "=", "'\\n'", ".", "join", "(", "arg_0", ")", "_validate_skip_unknown", "(", "arg_1", ")", "if", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_1", "=", "set", "(", "arg_1", ")", "arg_2", "=", "config_parser", ".", "ConfigParser", "(", "arg_0", ",", "ParserDelegate", "(", "arg_1", ")", ")", "for", "arg_3", "in", "arg_2", ":", "if", "isinstance", "(", "arg_3", ",", "config_parser", ".", "BindingStatement", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_3", "if", "not", "arg_6", ":", "arg_9", "=", "'{}/{}'", ".", "format", "(", "arg_4", ",", "arg_5", ")", "if", "arg_4", "else", "arg_5", "with", "utils", ".", "try_with_location", "(", "arg_8", ")", ":", "bind_parameter", "(", "(", "arg_9", ",", "'gin.macro'", ",", "'value'", ")", ",", "arg_7", ")", "continue", "if", "not", "_should_skip", "(", "arg_5", ",", "arg_1", ")", ":", "with", "utils", ".", "try_with_location", "(", "arg_8", ")", ":", "bind_parameter", "(", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", ",", "arg_7", ")", "elif", "isinstance", "(", "arg_3", ",", "config_parser", ".", "ImportStatement", ")", ":", "if", "arg_1", ":", "try", ":", "__import__", "(", "arg_3", ".", "module", ")", "_IMPORTED_MODULES", ".", "add", "(", "arg_3", ".", "module", ")", "except", "ImportError", ":", "arg_10", "=", "'Skipping import of unknown module `%s` (skip_unknown=%r).'", "logging", ".", "info", "(", "arg_10", ",", "arg_3", ".", "module", ",", "arg_1", ")", "else", ":", "with", "utils", ".", "try_with_location", "(", "arg_3", ".", "location", ")", ":", "__import__", "(", "arg_3", ".", "module", ")", "_IMPORTED_MODULES", ".", "add", "(", "arg_3", ".", "module", ")", "elif", "isinstance", "(", "arg_3", ",", "config_parser", ".", "IncludeStatement", ")", ":", "with", "utils", ".", "try_with_location", "(", "arg_3", ".", "location", ")", ":", "Func_file", "(", "arg_3", ".", "filename", ",", "arg_1", ")", "else", ":", "raise", "AssertionError", "(", "'Unrecognized statement type {}.'", ".", "format", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1=False):\n  \"\"\"Parse a file, string, or list of strings containing parameter bindings.\n\n  Parses parameter binding strings to set up the global configuration.  Once\n  `Func` has been called, any calls to configurable functions will have\n  parameter values set according to the values specified by the parameter\n  bindings in `bindings`.\n\n  An individual parameter binding has the format\n\n      maybe/some/scopes/configurable_name.parameter_name = value\n\n  Multiple binding strings can be passed either in the form of a file-like\n  object supporting the `readline` method, a single string with each individual\n  parameter binding separated by a newline, or as a list of individual parameter\n  binding strings.\n\n  Any Python literal (lists, tuples, dicts, strings, etc.) is acceptable to the\n  right of the equals sign, and follows standard Python rules for line\n  continuation. Additionally, a value starting with '@' is interpreted as a\n  (possibly scoped) reference to another configurable function, in which case\n  this value is replaced by a reference to that function. If the value\n  furthermore ends in `()` (e.g., `@configurable_name()`), then the value\n  returned when calling the function is used (it will be called *just before*\n  the function consuming the output is called).\n\n  See the module documentation for a more detailed description of scoping\n  mechanisms and a complete example.\n\n  Reading from a file could be done as follows:\n\n      with open('/path/to/file.config') as bindings:\n        gin.Func(bindings)\n\n  Passing a newline separated string of parameter bindings might look like:\n\n      bindings = '''\n          my_class.param_one = 'asdf'\n          my_class_param_two = 9.7\n      '''\n      gin.Func(bindings)\n\n  Alternatively, one can declare a list of parameter bindings and pass it in:\n\n      bindings = [\n          'my_class.param_one = \"asdf\"',\n          'my_class.param_two = 9.7',\n      ]\n      gin.Func(bindings)\n\n  Can skip unknown configurables. For example, if no module containing a\n  'training' configurable was imported, errors can be avoided by specifying\n  `skip_unknown=True`:\n\n      bindings = [\n          'my_class.param_one = \"asdf\"',\n          'my_class.param_two = 9.7',\n          'training.learning_rate = 0.1',\n      ]\n      gin.Func(bindings, skip_unknown=True)\n\n  Args:\n    bindings: A file-like object supporting the readline method, a newline\n      separated string of parameter bindings, or a list of individual parameter\n      binding strings.\n    skip_unknown: A boolean indicating whether unknown configurables and imports\n      should be skipped (instead of causing an error). Configurable references\n      to unknown configurables will cause errors if they are present in a\n      binding that is not itself skipped due to an unknown configurable. This\n      can also be a list of configurable names: any unknown configurables that\n      do not match an item in the list will still cause errors. Note that\n      bindings for known configurables will always be parsed.\n  \"\"\"\n  if isinstance(arg_0, (list, tuple)):\n    arg_0 = '\\n'.join(arg_0)\n\n  _validate_skip_unknown(arg_1)\n  if isinstance(arg_1, (list, tuple)):\n    arg_1 = set(arg_1)\n\n  arg_2 = config_parser.ConfigParser(arg_0, ParserDelegate(arg_1))\n  for arg_3 in arg_2:\n    if isinstance(arg_3, config_parser.BindingStatement):\n      arg_4, arg_5, arg_6, arg_7, arg_8 = arg_3\n      if not arg_6:\n        arg_9 = '{}/{}'.format(arg_4, arg_5) if arg_4 else arg_5\n        with utils.try_with_location(arg_8):\n          bind_parameter((arg_9, 'gin.macro', 'value'), arg_7)\n        continue\n      if not _should_skip(arg_5, arg_1):\n        with utils.try_with_location(arg_8):\n          bind_parameter((arg_4, arg_5, arg_6), arg_7)\n    elif isinstance(arg_3, config_parser.ImportStatement):\n      if arg_1:\n        try:\n          __import__(arg_3.module)\n          _IMPORTED_MODULES.add(arg_3.module)\n        except ImportError:\n          arg_10 = 'Skipping import of unknown module `%s` (skip_unknown=%r).'\n          logging.info(arg_10, arg_3.module, arg_1)\n      else:\n        with utils.try_with_location(arg_3.location):\n          __import__(arg_3.module)\n        _IMPORTED_MODULES.add(arg_3.module)\n    elif isinstance(arg_3, config_parser.IncludeStatement):\n      with utils.try_with_location(arg_3.location):\n        Func_file(arg_3.filename, arg_1)\n    else:\n      raise AssertionError('Unrecognized statement type {}.'.format(arg_3))", "path": "gin/config.py", "identifier": "parse_config", "docstring": "Parse a file, string, or list of strings containing parameter bindings.\n\n  Parses parameter binding strings to set up the global configuration.  Once\n  `parse_config` has been called, any calls to configurable functions will have\n  parameter values set according to the values specified by the parameter\n  bindings in `bindings`.\n\n  An individual parameter binding has the format\n\n      maybe/some/scopes/configurable_name.parameter_name = value\n\n  Multiple binding strings can be passed either in the form of a file-like\n  object supporting the `readline` method, a single string with each individual\n  parameter binding separated by a newline, or as a list of individual parameter\n  binding strings.\n\n  Any Python literal (lists, tuples, dicts, strings, etc.) is acceptable to the\n  right of the equals sign, and follows standard Python rules for line\n  continuation. Additionally, a value starting with '@' is interpreted as a\n  (possibly scoped) reference to another configurable function, in which case\n  this value is replaced by a reference to that function. If the value\n  furthermore ends in `()` (e.g., `@configurable_name()`), then the value\n  returned when calling the function is used (it will be called *just before*\n  the function consuming the output is called).\n\n  See the module documentation for a more detailed description of scoping\n  mechanisms and a complete example.\n\n  Reading from a file could be done as follows:\n\n      with open('/path/to/file.config') as bindings:\n        gin.parse_config(bindings)\n\n  Passing a newline separated string of parameter bindings might look like:\n\n      bindings = '''\n          my_class.param_one = 'asdf'\n          my_class_param_two = 9.7\n      '''\n      gin.parse_config(bindings)\n\n  Alternatively, one can declare a list of parameter bindings and pass it in:\n\n      bindings = [\n          'my_class.param_one = \"asdf\"',\n          'my_class.param_two = 9.7',\n      ]\n      gin.parse_config(bindings)\n\n  Can skip unknown configurables. For example, if no module containing a\n  'training' configurable was imported, errors can be avoided by specifying\n  `skip_unknown=True`:\n\n      bindings = [\n          'my_class.param_one = \"asdf\"',\n          'my_class.param_two = 9.7',\n          'training.learning_rate = 0.1',\n      ]\n      gin.parse_config(bindings, skip_unknown=True)\n\n  Args:\n    bindings: A file-like object supporting the readline method, a newline\n      separated string of parameter bindings, or a list of individual parameter\n      binding strings.\n    skip_unknown: A boolean indicating whether unknown configurables and imports\n      should be skipped (instead of causing an error). Configurable references\n      to unknown configurables will cause errors if they are present in a\n      binding that is not itself skipped due to an unknown configurable. This\n      can also be a list of configurable names: any unknown configurables that\n      do not match an item in the list will still cause errors. Note that\n      bindings for known configurables will always be parsed.", "docstring_tokens": ["Parse", "a", "file", "string", "or", "list", "of", "strings", "containing", "parameter", "bindings", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 255135}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/parse/scanner.py#L52-L56", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "r'\\s+", "language": "python", "parameters": "(self, s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "add_token", "(", "'SPACE'", ",", "arg_1", ")", "arg_0", ".", "pos", "+=", "len", "(", "arg_1", ")", "pass"], "function": "def Func(arg_0, arg_1):\n        r'\\s+'\n        arg_0.add_token('SPACE', arg_1)\n        arg_0.pos += len(arg_1)\n        pass", "path": "trepan/processor/parse/scanner.py", "identifier": "LocationScanner.t_whitespace", "docstring": "r'\\s+", "docstring_tokens": ["r", "\\", "s", "+"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 255136}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/drawqueue_sink.py#L14-L23", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Calls implmentation to get a render context,\n        passes it to the drawqueues render function\n        then calls self.rendering_finished", "language": "python", "parameters": "(self, size, frame, drawqueue)", "return_statement": "return r_context", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "create_rcontext", "(", "arg_1", ",", "arg_2", ")", "arg_3", ".", "Func", "(", "arg_4", ")", "arg_0", ".", "Funcing_finished", "(", "arg_1", ",", "arg_2", ",", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''\n        Calls implmentation to get a Func context,\n        passes it to the drawqueues Func function\n        then calls self.Funcing_finished\n        '''\n        arg_4 = arg_0.create_rcontext(arg_1, arg_2)\n        arg_3.Func(arg_4)\n        arg_0.Funcing_finished(arg_1, arg_2, arg_4)\n        return arg_4", "path": "shoebot/core/drawqueue_sink.py", "identifier": "DrawQueueSink.render", "docstring": "Calls implmentation to get a render context,\n        passes it to the drawqueues render function\n        then calls self.rendering_finished", "docstring_tokens": ["Calls", "implmentation", "to", "get", "a", "render", "context", "passes", "it", "to", "the", "drawqueues", "render", "function", "then", "calls", "self", ".", "rendering_finished"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255137}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L136-L160", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Updates settings of a Cloud SQL instance.", "language": "python", "parameters": "(self, body, instance, project_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "get_conn", "(", ")", ".", "instances", "(", ")", ".", "patch", "(", "project", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "arg_5", "=", "arg_4", "[", "\"name\"", "]", "arg_0", ".", "_wait_for_operation_to_complete", "(", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Updates settings of a Cloud SQL instance.\n\n        Caution: This is not a partial update, so you must include values for\n        all the settings that you want to retain.\n\n        :param body: Body required by the Cloud SQL patch API, as described in\n            https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/patch#request-body.\n        :type body: dict\n        :param instance: Cloud SQL instance ID. This does not include the project ID.\n        :type instance: str\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None\n        \"\"\"\n        arg_4 = arg_0.get_conn().instances().patch(\n            project=arg_3,\n            arg_2=arg_2,\n            arg_1=arg_1\n        ).execute(num_retries=arg_0.num_retries)\n        arg_5 = arg_4[\"name\"]\n        arg_0._wait_for_operation_to_complete(arg_3=arg_3,\n                                             arg_5=arg_5)", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlHook.patch_instance", "docstring": "Updates settings of a Cloud SQL instance.\n\n        Caution: This is not a partial update, so you must include values for\n        all the settings that you want to retain.\n\n        :param body: Body required by the Cloud SQL patch API, as described in\n            https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/patch#request-body.\n        :type body: dict\n        :param instance: Cloud SQL instance ID. This does not include the project ID.\n        :type instance: str\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None", "docstring_tokens": ["Updates", "settings", "of", "a", "Cloud", "SQL", "instance", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255138}
{"url": "https://github.com/hit9/rux/blob/d7f60722658a3b83ac6d7bb3ca2790ac9c926b59/rux/server.py#L84-L103", "sha": "d7f60722658a3b83ac6d7bb3ca2790ac9c926b59", "docstring_summary": "get source files' update time", "language": "python", "parameters": "(self)", "return_statement": "return files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "exists", "(", "Post", ".", "src_dir", ")", ":", "logger", ".", "error", "(", "SourceDirectoryNotFound", ".", "__doc__", ")", "sys", ".", "exit", "(", "SourceDirectoryNotFound", ".", "exit_code", ")", "arg_1", "=", "[", "]", "for", "arg_2", "in", "ls", "(", "Post", ".", "src_dir", ")", ":", "if", "arg_2", ".", "endswith", "(", "src_ext", ")", ":", "arg_1", ".", "append", "(", "join", "(", "Post", ".", "src_dir", ",", "arg_2", ")", ")", "if", "exists", "(", "config", ".", "filepath", ")", ":", "arg_1", ".", "append", "(", "config", ".", "filepath", ")", "arg_3", "=", "dict", "(", "(", "p", ",", "stat", "(", "p", ")", ".", "st_mtime", ")", "for", "p", "in", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"get source files' update time\"\"\"\n\n        if not exists(Post.src_dir):\n            logger.error(SourceDirectoryNotFound.__doc__)\n            sys.exit(SourceDirectoryNotFound.exit_code)\n\n        arg_1 = []\n\n        for arg_2 in ls(Post.src_dir):\n            if arg_2.endswith(src_ext):\n                arg_1.append(join(Post.src_dir, arg_2))\n\n        # config.toml\n        if exists(config.filepath):\n            arg_1.append(config.filepath)\n\n        # files: a <filepath to updated time> dict\n        arg_3 = dict((p, stat(p).st_mtime) for p in arg_1)\n        return arg_3", "path": "rux/server.py", "identifier": "Server.get_files_stat", "docstring": "get source files' update time", "docstring_tokens": ["get", "source", "files", "update", "time"], "nwo": "hit9/rux", "score": 0.18892572326127263, "idx": 255139}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L97-L121", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Handle memory operations from unicorn.", "language": "python", "parameters": "(self, uc, access, address, size, value, data)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "assert", "arg_2", "in", "(", "UC_MEM_WRITE", ",", "UC_MEM_READ", ",", "UC_MEM_FETCH", ")", "if", "arg_2", "==", "UC_MEM_WRITE", ":", "arg_0", ".", "_cpu", ".", "write_int", "(", "arg_3", ",", "arg_5", ",", "arg_4", "*", "8", ")", "elif", "arg_2", "==", "UC_MEM_READ", ":", "arg_5", "=", "arg_0", ".", "_cpu", ".", "read_bytes", "(", "arg_3", ",", "arg_4", ")", "if", "arg_3", "in", "arg_0", ".", "_should_be_written", ":", "return", "True", "arg_0", ".", "_should_be_written", "[", "arg_3", "]", "=", "arg_5", "arg_0", ".", "_should_try_again", "=", "True", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        \"\"\"\n        Handle memory operations from unicorn.\n        \"\"\"\n        assert arg_2 in (UC_MEM_WRITE, UC_MEM_READ, UC_MEM_FETCH)\n\n        if arg_2 == UC_MEM_WRITE:\n            arg_0._cpu.write_int(arg_3, arg_5, arg_4 * 8)\n\n        # If client code is attempting to read a value, we need to bring it\n        # in from Manticore state. If we try to mem_write it here, Unicorn\n        # will segfault. We add the value to a list of things that need to\n        # be written, and ask to restart the emulation.\n        elif arg_2 == UC_MEM_READ:\n            arg_5 = arg_0._cpu.read_bytes(arg_3, arg_4)\n\n            if arg_3 in arg_0._should_be_written:\n                return True\n\n            arg_0._should_be_written[arg_3] = arg_5\n\n            arg_0._should_try_again = True\n            return False\n\n        return True", "path": "manticore/utils/fallback_emulator.py", "identifier": "UnicornEmulator._hook_xfer_mem", "docstring": "Handle memory operations from unicorn.", "docstring_tokens": ["Handle", "memory", "operations", "from", "unicorn", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 255140}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L417-L438", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Build and execute login request", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"%s/auth.cgi?api=SYNO.API.Auth&version=2\"", "%", "(", "arg_0", ".", "base_url", ",", ")", "arg_2", "=", "\"method=login&%s\"", "%", "(", "arg_0", ".", "_encode_credentials", "(", ")", ")", "arg_3", "=", "\"%s&%s&session=Core&format=cookie\"", "%", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_execute_get_url", "(", "arg_3", ",", "False", ")", "if", "arg_4", "is", "not", "None", ":", "arg_0", ".", "access_token", "=", "arg_4", "[", "\"data\"", "]", "[", "\"sid\"", "]", "arg_0", ".", "_debuglog", "(", "\"Authentication Succesfull, token: \"", "+", "str", "(", "arg_0", ".", "access_token", ")", ")", "return", "True", "else", ":", "arg_0", ".", "_debuglog", "(", "\"Authentication Failed\"", ")", "return", "False"], "function": "def Func(arg_0):\r\n        \"\"\"Build and execute login request\"\"\"\r\n        arg_1 = \"%s/auth.cgi?api=SYNO.API.Auth&version=2\" % (\r\n            arg_0.base_url,\r\n        )\r\n\r\n        arg_2 = \"method=login&%s\" % (arg_0._encode_credentials())\r\n\r\n        arg_3 = \"%s&%s&session=Core&format=cookie\" % (\r\n            arg_1,\r\n            arg_2)\r\n        arg_4 = arg_0._execute_get_url(arg_3, False)\r\n\r\n        # Parse Result if valid\r\n        if arg_4 is not None:\r\n            arg_0.access_token = arg_4[\"data\"][\"sid\"]\r\n            arg_0._debuglog(\"Authentication Succesfull, token: \" +\r\n                           str(arg_0.access_token))\r\n            return True\r\n        else:\r\n            arg_0._debuglog(\"Authentication Failed\")\r\n            return False", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynologyDSM._login", "docstring": "Build and execute login request", "docstring_tokens": ["Build", "and", "execute", "login", "request"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 255141}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/beziereditor/__init__.py#L174-L186", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns True when point 1 and point 2 overlap.\n        \n        There is an r treshold in which point 1 and point 2\n        are considered to overlap.", "language": "python", "parameters": "(self, x1, y1, x2, y2, r=5)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "5", ")", ":", "if", "abs", "(", "arg_3", "-", "arg_1", ")", "<", "arg_5", "and", "abs", "(", "arg_4", "-", "arg_2", ")", "<", "arg_5", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=5):\n        \n        \"\"\" Returns True when point 1 and point 2 Func.\n        \n        There is an r treshold in which point 1 and point 2\n        are considered to Func.\n        \n        \"\"\"\n        \n        if abs(arg_3-arg_1) < arg_5 and abs(arg_4-arg_2) < arg_5:\n            return True\n        else:\n            return False", "path": "lib/beziereditor/__init__.py", "identifier": "BezierPathEditor.overlap", "docstring": "Returns True when point 1 and point 2 overlap.\n        \n        There is an r treshold in which point 1 and point 2\n        are considered to overlap.", "docstring_tokens": ["Returns", "True", "when", "point", "1", "and", "point", "2", "overlap", ".", "There", "is", "an", "r", "treshold", "in", "which", "point", "1", "and", "point", "2", "are", "considered", "to", "overlap", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255142}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/learning.py#L391-L400", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Layered feed-forward network.", "language": "python", "parameters": "(dataset, sizes)", "return_statement": "return predict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "map", "(", "lambda", "n", ":", "[", "0.0", "for", "i", "in", "range", "(", "n", ")", "]", ",", "arg_1", ")", "arg_3", "=", "[", "]", "def", "predict", "(", "arg_4", ")", ":", "unimplemented", "(", ")", "return", "predict"], "function": "def Func(arg_0, arg_1):\n   \"\"\"Layered feed-forward network.\"\"\"\n\n   arg_2 = map(lambda n: [0.0 for i in range(n)], arg_1)\n   arg_3 = []\n\n   def predict(arg_4):\n      unimplemented()\n\n   return predict", "path": "aima/learning.py", "identifier": "NeuralNetLearner", "docstring": "Layered feed-forward network.", "docstring_tokens": ["Layered", "feed", "-", "forward", "network", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 255143}
{"url": "https://github.com/matthewdeanmartin/find_known_secrets/blob/f25735c1ab4512bad85ade33af7021f6fac1d13b/find_known_secrets/main.py#L40-L57", "sha": "f25735c1ab4512bad85ade33af7021f6fac1d13b", "docstring_summary": "Take care of command line options", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "docopt", "(", "__doc__", ",", "version", "=", "\"Find Known Secrets {0}\"", ".", "format", "(", "__version__", ")", ")", "logger", ".", "debug", "(", "arg_0", ")", "if", "arg_0", "[", "\"here\"", "]", ":", "go", "(", ")", "else", ":", "arg_1", "=", "arg_0", "[", "\"--secrets\"", "]", "arg_2", "=", "Searcher", "(", "source", "=", "arg_0", "[", "\"--source\"", "]", ",", "arg_1", "=", "arg_1", ")", "arg_2", ".", "go", "(", ")"], "function": "def Func():  # type: ()->None\n    \"\"\"\n    Take care of command line options\n    \"\"\"\n\n    arg_0 = docopt(__doc__, version=\"Find Known Secrets {0}\".format(__version__))\n\n    logger.debug(arg_0)\n    # print(arguments)\n    if arg_0[\"here\"]:\n        # all default\n        go()\n    else:\n        # user config\n        arg_1 = arg_0[\"--secrets\"]\n\n        arg_2 = Searcher(source=arg_0[\"--source\"], arg_1=arg_1)\n        arg_2.go()", "path": "find_known_secrets/main.py", "identifier": "process_docopts", "docstring": "Take care of command line options", "docstring_tokens": ["Take", "care", "of", "command", "line", "options"], "nwo": "matthewdeanmartin/find_known_secrets", "score": 0.08529914490135834, "idx": 255144}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/export/variant.py#L54-L115", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Create the lines for an excel file with verified variants for\n        an institute", "language": "python", "parameters": "(aggregate_variants, unique_callers)", "return_statement": "return document_lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", "[", "'samples'", "]", ":", "arg_6", "=", "[", "]", "arg_6", ".", "append", "(", "arg_3", "[", "'institute'", "]", ")", "arg_6", ".", "append", "(", "arg_3", "[", "'_id'", "]", ")", "arg_6", ".", "append", "(", "arg_3", "[", "'category'", "]", ")", "arg_6", ".", "append", "(", "arg_3", "[", "'variant_type'", "]", ")", "arg_6", ".", "append", "(", "arg_3", "[", "'display_name'", "]", "[", ":", "30", "]", ")", "arg_7", "=", "arg_3", "[", "'case_obj'", "]", "[", "'display_name'", "]", "arg_8", "=", "'/'", ".", "join", "(", "[", "''", ",", "arg_3", "[", "'institute'", "]", ",", "arg_7", ",", "arg_3", "[", "'_id'", "]", "]", ")", "arg_6", ".", "append", "(", "arg_8", ")", "arg_6", ".", "append", "(", "arg_3", ".", "get", "(", "'validation'", ")", ")", "arg_6", ".", "append", "(", "arg_7", ")", "arg_9", "=", "next", "(", "ind", "for", "ind", "in", "arg_3", "[", "'case_obj'", "]", "[", "'individuals'", "]", "if", "ind", "[", "'individual_id'", "]", "==", "arg_5", "[", "'sample_id'", "]", ")", "if", "arg_9", "[", "'phenotype'", "]", "==", "2", ":", "arg_6", ".", "append", "(", "' '", ".", "join", "(", "[", "arg_5", ".", "get", "(", "'display_name'", ")", ",", "'(A)'", "]", ")", ")", "else", ":", "arg_6", ".", "append", "(", "arg_5", ".", "get", "(", "'display_name'", ")", ")", "arg_6", ".", "append", "(", "''", ".", "join", "(", "[", "'chr'", ",", "arg_3", "[", "'chromosome'", "]", ",", "':'", ",", "str", "(", "arg_3", "[", "'position'", "]", ")", "]", ")", ")", "arg_6", ".", "append", "(", "'>'", ".", "join", "(", "[", "arg_3", ".", "get", "(", "'reference'", ")", "[", ":", "10", "]", ",", "arg_3", ".", "get", "(", "'alternative'", ")", "[", ":", "10", "]", "]", ")", ")", "arg_10", "=", "[", "]", "arg_11", "=", "[", "]", "arg_12", "=", "[", "]", "for", "arg_13", "in", "arg_3", ".", "get", "(", "'genes'", ")", ":", "arg_10", ".", "append", "(", "arg_13", ".", "get", "(", "'hgnc_symbol'", ",", "''", ")", ")", "arg_12", ".", "append", "(", "arg_13", ".", "get", "(", "'functional_annotation'", ")", ")", "for", "arg_14", "in", "arg_13", ".", "get", "(", "'transcripts'", ")", ":", "if", "arg_14", ".", "get", "(", "'is_canonical'", ")", "and", "arg_14", ".", "get", "(", "'protein_sequence_name'", ")", ":", "arg_11", ".", "append", "(", "urllib", ".", "parse", ".", "unquote", "(", "arg_14", ".", "get", "(", "'protein_sequence_name'", ")", ")", ")", "arg_6", ".", "append", "(", "','", ".", "join", "(", "arg_11", ")", ")", "arg_6", ".", "append", "(", "','", ".", "join", "(", "arg_12", ")", ")", "arg_6", ".", "append", "(", "','", ".", "join", "(", "arg_10", ")", ")", "arg_6", ".", "append", "(", "arg_3", ".", "get", "(", "'rank_score'", ")", ")", "arg_6", ".", "append", "(", "arg_3", ".", "get", "(", "'cadd_score'", ")", ")", "arg_6", ".", "append", "(", "arg_5", ".", "get", "(", "'genotype_call'", ")", ")", "arg_6", ".", "append", "(", "arg_5", "[", "'allele_depths'", "]", "[", "0", "]", ")", "arg_6", ".", "append", "(", "arg_5", "[", "'allele_depths'", "]", "[", "1", "]", ")", "arg_6", ".", "append", "(", "arg_5", "[", "'genotype_quality'", "]", ")", "for", "arg_15", "in", "arg_1", ":", "if", "arg_3", ".", "get", "(", "arg_15", ")", ":", "arg_6", ".", "append", "(", "arg_3", ".", "get", "(", "arg_15", ")", ")", "else", ":", "arg_6", ".", "append", "(", "'-'", ")", "arg_2", ".", "append", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Create the lines for an excel file with verified variants for\n        an institute\n\n        Args:\n            aggregate_variants(list): a list of variants with aggregates case data\n            unique_callers(set): a unique list of available callers\n\n        Returns:\n            document_lines(list): list of lines to include in the document\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_0:\n        # get genotype and allele depth for each sample\n        arg_4 = []\n        for arg_5 in arg_3['samples']:\n            arg_6 = [] # line elements corespond to contants.variants_export.VERIFIED_VARIANTS_HEADER\n            arg_6.append(arg_3['institute'])\n            arg_6.append(arg_3['_id']) # variant database ID\n            arg_6.append(arg_3['category'])\n            arg_6.append(arg_3['variant_type'])\n            arg_6.append(arg_3['display_name'][:30]) # variant display name\n            # Build local link to variant:\n            arg_7 = arg_3['case_obj']['display_name']  # case display name\n            arg_8 = '/'.join([ '', arg_3['institute'], arg_7, arg_3['_id'] ])\n            arg_6.append(arg_8)\n            arg_6.append(arg_3.get('validation'))\n            arg_6.append(arg_7)\n            arg_9 = next(ind for ind in arg_3['case_obj']['individuals'] if ind['individual_id'] == arg_5['sample_id'])\n            if arg_9['phenotype'] == 2:\n                arg_6.append(' '.join([arg_5.get('display_name'),'(A)'])) # label sample as affected\n            else:\n                arg_6.append(arg_5.get('display_name'))\n            arg_6.append(''.join(['chr',arg_3['chromosome'],':',str(arg_3['position'])])) # position\n            arg_6.append('>'.join([arg_3.get('reference')[:10],arg_3.get('alternative')[:10]])) # change\n            arg_10 = []\n            arg_11 = []\n            arg_12 = []\n            for arg_13 in arg_3.get('genes'): # this will be a unique long field in the document\n                arg_10.append(arg_13.get('hgnc_symbol',''))\n                arg_12.append(arg_13.get('functional_annotation'))\n                for arg_14 in arg_13.get('transcripts'):\n                    if arg_14.get('is_canonical') and arg_14.get('protein_sequence_name'):\n                        arg_11.append(urllib.parse.unquote(arg_14.get('protein_sequence_name')))\n            arg_6.append(','.join(arg_11))\n            arg_6.append(','.join(arg_12))\n            arg_6.append(','.join(arg_10))\n            arg_6.append(arg_3.get('rank_score'))\n            arg_6.append(arg_3.get('cadd_score'))\n            arg_6.append(arg_5.get('genotype_call'))\n            arg_6.append(arg_5['allele_depths'][0])\n            arg_6.append(arg_5['allele_depths'][1])\n            arg_6.append(arg_5['genotype_quality'])\n\n            # Set callers values. One cell per caller, leave blank if not applicable\n            for arg_15 in arg_1:\n                if arg_3.get(arg_15):\n                    arg_6.append(arg_3.get(arg_15))\n                else:\n                    arg_6.append('-')\n            arg_2.append(arg_6)\n    return arg_2", "path": "scout/export/variant.py", "identifier": "export_verified_variants", "docstring": "Create the lines for an excel file with verified variants for\n        an institute\n\n        Args:\n            aggregate_variants(list): a list of variants with aggregates case data\n            unique_callers(set): a unique list of available callers\n\n        Returns:\n            document_lines(list): list of lines to include in the document", "docstring_tokens": ["Create", "the", "lines", "for", "an", "excel", "file", "with", "verified", "variants", "for", "an", "institute"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255145}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L301-L333", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Open stream, create output and finally write the stream to output.", "language": "python", "parameters": "(plugin, stream)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "global", "arg_6", "arg_2", "=", "False", "for", "arg_3", "in", "range", "(", "args", ".", "retry_open", ")", ":", "try", ":", "arg_4", ",", "arg_5", "=", "open_stream", "(", "arg_1", ")", "arg_2", "=", "True", "break", "except", "StreamError", "as", "err", ":", "log", ".", "error", "(", "\"Try {0}/{1}: Could not open stream {2} ({3})\"", ",", "arg_3", "+", "1", ",", "args", ".", "retry_open", ",", "arg_1", ",", "err", ")", "if", "not", "arg_2", ":", "console", ".", "exit", "(", "\"Could not open stream {0}, tried {1} times, exiting\"", ",", "arg_1", ",", "args", ".", "retry_open", ")", "arg_6", "=", "create_output", "(", "arg_0", ")", "try", ":", "arg_6", ".", "open", "(", ")", "except", "(", "IOError", ",", "OSError", ")", "as", "err", ":", "if", "isinstance", "(", "arg_6", ",", "PlayerOutput", ")", ":", "console", ".", "exit", "(", "\"Failed to start player: {0} ({1})\"", ",", "args", ".", "player", ",", "err", ")", "else", ":", "console", ".", "exit", "(", "\"Failed to open output: {0} ({1})\"", ",", "args", ".", "output", ",", "err", ")", "with", "closing", "(", "arg_6", ")", ":", "log", ".", "debug", "(", "\"Writing stream to output\"", ")", "read_stream", "(", "arg_4", ",", "arg_6", ",", "arg_5", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Open stream, create output and finally write the stream to output.\"\"\"\n    global arg_6\n\n    arg_2 = False\n    for arg_3 in range(args.retry_open):\n        try:\n            arg_4, arg_5 = open_stream(arg_1)\n            arg_2 = True\n            break\n        except StreamError as err:\n            log.error(\"Try {0}/{1}: Could not open stream {2} ({3})\", arg_3 + 1, args.retry_open, arg_1, err)\n\n    if not arg_2:\n        console.exit(\"Could not open stream {0}, tried {1} times, exiting\", arg_1, args.retry_open)\n\n    arg_6 = create_output(arg_0)\n\n    try:\n        arg_6.open()\n    except (IOError, OSError) as err:\n        if isinstance(arg_6, PlayerOutput):\n            console.exit(\"Failed to start player: {0} ({1})\",\n                         args.player, err)\n        else:\n            console.exit(\"Failed to open output: {0} ({1})\",\n                         args.output, err)\n\n    with closing(arg_6):\n        log.debug(\"Writing stream to output\")\n        read_stream(arg_4, arg_6, arg_5)\n\n    return True", "path": "src/streamlink_cli/main.py", "identifier": "output_stream", "docstring": "Open stream, create output and finally write the stream to output.", "docstring_tokens": ["Open", "stream", "create", "output", "and", "finally", "write", "the", "stream", "to", "output", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 255146}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/utils.py#L117-L140", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Returns a list of the dicom files within root_path", "language": "python", "parameters": "(root_path)", "return_statement": "return dicoms", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "try", ":", "for", "arg_2", "in", "get_all_files", "(", "arg_0", ")", ":", "if", "is_dicom_file", "(", "arg_2", ")", ":", "arg_1", ".", "add", "(", "arg_2", ")", "except", "IOError", "as", "ioe", ":", "raise", "IOError", "(", "'Error reading file {0}.'", ".", "format", "(", "arg_2", ")", ")", "from", "ioe", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns a list of the dicom files within root_path\n\n    Parameters\n    ----------\n    root_path: str\n    Path to the directory to be recursively searched for DICOM files.\n\n    Returns\n    -------\n    dicoms: set\n    Set of DICOM absolute file paths\n    \"\"\"\n    arg_1 = set()\n\n    try:\n        for arg_2 in get_all_files(arg_0):\n            if is_dicom_file(arg_2):\n                arg_1.add(arg_2)\n    except IOError as ioe:\n        raise IOError('Error reading file {0}.'.format(arg_2)) from ioe\n\n    return arg_1", "path": "boyle/dicom/utils.py", "identifier": "find_all_dicom_files", "docstring": "Returns a list of the dicom files within root_path\n\n    Parameters\n    ----------\n    root_path: str\n    Path to the directory to be recursively searched for DICOM files.\n\n    Returns\n    -------\n    dicoms: set\n    Set of DICOM absolute file paths", "docstring_tokens": ["Returns", "a", "list", "of", "the", "dicom", "files", "within", "root_path"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255147}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L274-L284", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Find a XML element via xpath.", "language": "python", "parameters": "(xpath)", "return_statement": "return transform(xpath_find)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "xpath_find", "(", "arg_1", ")", ":", "validate", "(", "ET", ".", "iselement", ",", "arg_1", ")", "arg_1", "=", "arg_1", ".", "find", "(", "arg_0", ")", "if", "arg_1", "is", "None", ":", "raise", "ValueError", "(", "\"XPath '{0}' did not return an element\"", ".", "format", "(", "arg_0", ")", ")", "return", "validate", "(", "ET", ".", "iselement", ",", "arg_1", ")", "return", "transform", "(", "xpath_find", ")"], "function": "def Func(arg_0):\n    \"\"\"Find a XML element via xpath.\"\"\"\n    def xpath_find(arg_1):\n        validate(ET.iselement, arg_1)\n        arg_1 = arg_1.find(arg_0)\n        if arg_1 is None:\n            raise ValueError(\"XPath '{0}' did not return an element\".format(arg_0))\n\n        return validate(ET.iselement, arg_1)\n\n    return transform(xpath_find)", "path": "src/streamlink/plugin/api/validate.py", "identifier": "xml_find", "docstring": "Find a XML element via xpath.", "docstring_tokens": ["Find", "a", "XML", "element", "via", "xpath", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 255148}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdfbuilders.py#L372-L384", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets the review comment. Raises CardinalityError if\n        already set. OrderError if no reviewer defined before.", "language": "python", "parameters": "(self, doc, comment)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_1", ".", "reviews", ")", "!=", "0", ":", "if", "not", "arg_0", ".", "review_comment_set", ":", "arg_0", ".", "review_comment_set", "=", "True", "arg_1", ".", "reviews", "[", "-", "1", "]", ".", "comment", "=", "arg_2", "return", "True", "else", ":", "raise", "CardinalityError", "(", "'ReviewComment'", ")", "else", ":", "raise", "OrderError", "(", "'ReviewComment'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets the review comment. Raises CardinalityError if\n        already set. OrderError if no reviewer defined before.\n        \"\"\"\n        if len(arg_1.reviews) != 0:\n            if not arg_0.review_comment_set:\n                arg_0.review_comment_set = True\n                arg_1.reviews[-1].comment = arg_2\n                return True\n            else:\n                raise CardinalityError('ReviewComment')\n        else:\n            raise OrderError('ReviewComment')", "path": "spdx/parsers/rdfbuilders.py", "identifier": "ReviewBuilder.add_review_comment", "docstring": "Sets the review comment. Raises CardinalityError if\n        already set. OrderError if no reviewer defined before.", "docstring_tokens": ["Sets", "the", "review", "comment", ".", "Raises", "CardinalityError", "if", "already", "set", ".", "OrderError", "if", "no", "reviewer", "defined", "before", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 255149}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/displaypub.py#L46-L66", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Validate the display data.", "language": "python", "parameters": "(self, source, data, metadata=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "raise", "TypeError", "(", "'source must be a str, got: %r'", "%", "arg_1", ")", "if", "not", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "raise", "TypeError", "(", "'data must be a dict, got: %r'", "%", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "raise", "TypeError", "(", "'metadata must be a dict, got: %r'", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Validate the display data.\n\n        Parameters\n        ----------\n        source : str\n            The fully dotted name of the callable that created the data, like\n            :func:`foo.bar.my_formatter`.\n        data : dict\n            The formata data dictionary.\n        metadata : dict\n            Any metadata for the data.\n        \"\"\"\n\n        if not isinstance(arg_1, basestring):\n            raise TypeError('source must be a str, got: %r' % arg_1)\n        if not isinstance(arg_2, dict):\n            raise TypeError('data must be a dict, got: %r' % arg_2)\n        if arg_3 is not None:\n            if not isinstance(arg_3, dict):\n                raise TypeError('metadata must be a dict, got: %r' % arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/core/displaypub.py", "identifier": "DisplayPublisher._validate_data", "docstring": "Validate the display data.\n\n        Parameters\n        ----------\n        source : str\n            The fully dotted name of the callable that created the data, like\n            :func:`foo.bar.my_formatter`.\n        data : dict\n            The formata data dictionary.\n        metadata : dict\n            Any metadata for the data.", "docstring_tokens": ["Validate", "the", "display", "data", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255150}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L828-L846", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets the file SPDX Identifier.\n        Raises OrderError if no package or no file defined.\n        Raises SPDXValueError if malformed value.\n        Raises CardinalityError if more than one spdx_id set.", "language": "python", "parameters": "(self, doc, spdx_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "has_package", "(", "arg_1", ")", "and", "arg_0", ".", "has_file", "(", "arg_1", ")", ":", "if", "not", "arg_0", ".", "file_spdx_id_set", ":", "arg_0", ".", "file_spdx_id_set", "=", "True", "if", "validations", ".", "validate_file_spdx_id", "(", "arg_2", ")", ":", "arg_0", ".", "file", "(", "arg_1", ")", ".", "spdx_id", "=", "arg_2", "return", "True", "else", ":", "raise", "SPDXValueError", "(", "'File::SPDXID'", ")", "else", ":", "raise", "CardinalityError", "(", "'File::SPDXID'", ")", "else", ":", "raise", "OrderError", "(", "'File::SPDXID'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Sets the file SPDX Identifier.\n        Raises OrderError if no package or no file defined.\n        Raises SPDXValueError if malformed value.\n        Raises CardinalityError if more than one spdx_id set.\n        \"\"\"\n        if arg_0.has_package(arg_1) and arg_0.has_file(arg_1):\n            if not arg_0.file_spdx_id_set:\n                arg_0.file_spdx_id_set = True\n                if validations.validate_file_spdx_id(arg_2):\n                    arg_0.file(arg_1).spdx_id = arg_2\n                    return True\n                else:\n                    raise SPDXValueError('File::SPDXID')\n            else:\n                raise CardinalityError('File::SPDXID')\n        else:\n            raise OrderError('File::SPDXID')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "FileBuilder.set_file_spdx_id", "docstring": "Sets the file SPDX Identifier.\n        Raises OrderError if no package or no file defined.\n        Raises SPDXValueError if malformed value.\n        Raises CardinalityError if more than one spdx_id set.", "docstring_tokens": ["Sets", "the", "file", "SPDX", "Identifier", ".", "Raises", "OrderError", "if", "no", "package", "or", "no", "file", "defined", ".", "Raises", "SPDXValueError", "if", "malformed", "value", ".", "Raises", "CardinalityError", "if", "more", "than", "one", "spdx_id", "set", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 255151}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/__init__.py#L132-L175", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Draws the submenu and its background.\n        \n        Note that this leaves the OpenGL state set to 2d drawing.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "window", ".", "set2d", "(", ")", "if", "isinstance", "(", "arg_0", ".", "bg", ",", "Layer", ")", ":", "arg_0", ".", "bg", ".", "_Func", "(", ")", "elif", "hasattr", "(", "arg_0", ".", "bg", ",", "\"Func\"", ")", "and", "callable", "(", "arg_0", ".", "bg", ".", "Func", ")", ":", "arg_0", ".", "bg", ".", "Func", "(", ")", "elif", "isinstance", "(", "arg_0", ".", "bg", ",", "list", ")", "or", "isinstance", "(", "arg_0", ".", "bg", ",", "tuple", ")", ":", "arg_0", ".", "bg_vlist", ".", "Func", "(", "GL_QUADS", ")", "elif", "callable", "(", "arg_0", ".", "bg", ")", ":", "arg_0", ".", "bg", "(", ")", "elif", "isinstance", "(", "arg_0", ".", "bg", ",", "Background", ")", ":", "if", "not", "arg_0", ".", "bg", ".", "initialized", ":", "arg_0", ".", "bg", ".", "init_bg", "(", ")", "arg_0", ".", "bg", ".", "reFunc_bg", "(", ")", "arg_0", ".", "bg", ".", "initialized", "=", "True", "elif", "arg_0", ".", "bg", "==", "\"blank\"", ":", "pass", "else", ":", "raise", "TypeError", "(", "\"Unknown background type\"", ")", "arg_0", ".", "window", ".", "set2d", "(", ")", "for", "arg_3", "in", "arg_0", ".", "widgets", ".", "values", "(", ")", ":", "if", "arg_3", ".", "do_reFunc", ":", "arg_3", ".", "on_reFunc", "(", ")", "arg_3", ".", "do_reFunc", "=", "False", "arg_0", ".", "batch2d", ".", "Func", "(", ")", "for", "arg_3", "in", "arg_0", ".", "widgets", ".", "values", "(", ")", ":", "arg_3", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Draws the submenu and its background.\n        \n        Note that this leaves the OpenGL state set to 2d Funcing.\n        \"\"\"\n        # Sets the OpenGL state for 2D-Drawing\n        arg_0.window.set2d()\n        \n        # Draws the background\n        if isinstance(arg_0.bg,Layer):\n            arg_0.bg._Func()\n        elif hasattr(arg_0.bg,\"Func\") and callable(arg_0.bg.Func):\n            arg_0.bg.Func()\n        elif isinstance(arg_0.bg,list) or isinstance(arg_0.bg,tuple):\n            arg_0.bg_vlist.Func(GL_QUADS)\n        elif callable(arg_0.bg):\n            arg_0.bg()\n        elif isinstance(arg_0.bg,Background):\n            # The background will be Funcn via the batch\n            if not arg_0.bg.initialized:\n                arg_0.bg.init_bg()\n                arg_0.bg.reFunc_bg()\n                arg_0.bg.initialized=True\n        elif arg_0.bg==\"blank\":\n            pass\n        else:\n            raise TypeError(\"Unknown background type\")\n        \n        # In case the background modified relevant state\n        arg_0.window.set2d()\n        \n        # Check that all widgets that need reFuncing have been reFuncn\n        for arg_3 in arg_0.widgets.values():\n            if arg_3.do_reFunc:\n                arg_3.on_reFunc()\n                arg_3.do_reFunc = False\n        \n        # Actually Func the content\n        arg_0.batch2d.Func()\n        \n        # Call custom Func methods where needed\n        for arg_3 in arg_0.widgets.values():\n            arg_3.Func()", "path": "peng3d/gui/__init__.py", "identifier": "SubMenu.draw", "docstring": "Draws the submenu and its background.\n        \n        Note that this leaves the OpenGL state set to 2d drawing.", "docstring_tokens": ["Draws", "the", "submenu", "and", "its", "background", ".", "Note", "that", "this", "leaves", "the", "OpenGL", "state", "set", "to", "2d", "drawing", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 255152}
{"url": "https://github.com/dade-ai/snipy/blob/408520867179f99b3158b57520e2619f3fecd69b/snipy/img/imageutil.py#L166-L180", "sha": "408520867179f99b3158b57520e2619f3fecd69b", "docstring_summary": "z value as like a seed", "language": "python", "parameters": "(size, z=0.0, scale=0.05, octaves=1, persistence=0.25, lacunarity=2.0)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.0", ",", "arg_2", "=", "0.05", ",", "arg_3", "=", "1", ",", "arg_4", "=", "0.25", ",", "arg_5", "=", "2.0", ")", ":", "import", "noise", "arg_6", "=", "np", ".", "empty", "(", "arg_0", ",", "dtype", "=", "'float32'", ")", "for", "arg_7", "in", "range", "(", "arg_0", "[", "0", "]", ")", ":", "for", "arg_8", "in", "range", "(", "arg_0", "[", "1", "]", ")", ":", "arg_9", "=", "noise", ".", "snoise3", "(", "arg_8", "*", "arg_2", ",", "arg_7", "*", "arg_2", ",", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_6", "[", "arg_8", ",", "arg_7", "]", "=", "arg_9", "arg_6", "=", "arg_6", "*", "0.5", "+", "0.5", "if", "__debug__", ":", "assert", "arg_6", ".", "min", "(", ")", ">=", "0.", "and", "arg_6", ".", "max", "(", ")", "<=", "1.0", "return", "arg_6"], "function": "def Func(arg_0, arg_1=0.0, arg_2=0.05, arg_3=1, arg_4=0.25, arg_5=2.0):\n    \"\"\"\n    z value as like a seed\n    \"\"\"\n    import noise\n    arg_6 = np.empty(arg_0, dtype='float32')\n    for arg_7 in range(arg_0[0]):\n        for arg_8 in range(arg_0[1]):\n            arg_9 = noise.snoise3(arg_8 * arg_2, arg_7 * arg_2, arg_1,\n                              arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)\n            arg_6[arg_8, arg_7] = arg_9\n    arg_6 = arg_6 * 0.5 + 0.5\n    if __debug__:\n        assert arg_6.min() >= 0. and arg_6.max() <= 1.0\n    return arg_6", "path": "snipy/img/imageutil.py", "identifier": "snoise2d", "docstring": "z value as like a seed", "docstring_tokens": ["z", "value", "as", "like", "a", "seed"], "nwo": "dade-ai/snipy", "score": 0.18941942438232184, "idx": 255153}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L2876-L2883", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Sets byte if parity even.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "write", "(", "Operators", ".", "ITEBV", "(", "arg_1", ".", "size", ",", "arg_0", ".", "PF", ",", "1", ",", "0", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sets byte if parity even.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        \"\"\"\n        arg_1.write(Operators.ITEBV(arg_1.size, arg_0.PF, 1, 0))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.SETPE", "docstring": "Sets byte if parity even.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Sets", "byte", "if", "parity", "even", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 255154}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1519-L1575", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "getPrimaryKeys - Returns all primary keys matching current filterset.", "language": "python", "parameters": "(self, sortByAge=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_3", "=", "len", "(", "arg_0", ".", "filters", ")", "arg_4", "=", "len", "(", "arg_0", ".", "notFilters", ")", "if", "arg_3", "+", "arg_4", "==", "0", ":", "arg_2", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_5", "=", "arg_2", ".", "smembers", "(", "arg_0", ".", "_get_ids_key", "(", ")", ")", "elif", "arg_4", "==", "0", ":", "if", "arg_3", "==", "1", ":", "(", "arg_6", ",", "arg_7", ")", "=", "arg_0", ".", "filters", "[", "0", "]", "arg_5", "=", "arg_2", ".", "smembers", "(", "arg_0", ".", "_get_key_for_index", "(", "arg_6", ",", "arg_7", ")", ")", "else", ":", "arg_8", "=", "[", "arg_0", ".", "_get_key_for_index", "(", "arg_6", ",", "arg_7", ")", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "filters", "]", "arg_5", "=", "arg_2", ".", "sinter", "(", "arg_8", ")", "else", ":", "arg_9", "=", "[", "arg_0", ".", "_get_key_for_index", "(", "arg_6", ",", "arg_7", ")", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "notFilters", "]", "if", "arg_3", "==", "0", ":", "arg_5", "=", "arg_2", ".", "sdiff", "(", "arg_0", ".", "_get_ids_key", "(", ")", ",", "*", "arg_9", ")", "else", ":", "arg_8", "=", "[", "arg_0", ".", "_get_key_for_index", "(", "arg_6", ",", "arg_7", ")", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "filters", "]", "arg_10", "=", "arg_0", ".", "_getTempKey", "(", ")", "arg_11", "=", "arg_2", ".", "pipeline", "(", ")", "arg_11", ".", "sinterstore", "(", "arg_10", ",", "*", "arg_8", ")", "arg_11", ".", "sdiff", "(", "arg_10", ",", "*", "arg_9", ")", "arg_11", ".", "delete", "(", "arg_10", ")", "arg_5", "=", "arg_11", ".", "execute", "(", ")", "[", "1", "]", "arg_5", "=", "[", "int", "(", "_key", ")", "for", "_key", "in", "arg_5", "]", "if", "arg_1", "is", "False", ":", "return", "list", "(", "arg_5", ")", "else", ":", "arg_5", "=", "list", "(", "arg_5", ")", "arg_5", ".", "sort", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=False):\n\t\t'''\n\t\t\tFunc - Returns all primary keys matching current filterset.\n\n\t\t\t@param sortByAge <bool> - If False, return will be a set and may not be ordered.\n\t\t\t\tIf True, return will be a list and is guarenteed to represent objects oldest->newest\n\n\t\t\t@return <set> - A set of all primary keys associated with current filters.\n\t\t'''\n\t\targ_2 = arg_0._get_connection()\n\t\t# Apply filters, and return object\n\t\targ_3 = len(arg_0.filters)\n\t\targ_4 = len(arg_0.notFilters)\n\n\t\tif arg_3 + arg_4 == 0:\n\t\t\t# No filters, get all.\n\t\t\targ_2 = arg_0._get_connection()\n\t\t\targ_5 = arg_2.smembers(arg_0._get_ids_key())\n\n\t\telif arg_4 == 0:\n\t\t\t# Only Inclusive\n\t\t\tif arg_3 == 1:\n\t\t\t\t# Only one filter, get members of that index key\n\t\t\t\t(arg_6, arg_7) = arg_0.filters[0]\n\t\t\t\targ_5 = arg_2.smembers(arg_0._get_key_for_index(arg_6, arg_7))\n\t\t\telse:\n\t\t\t\t# Several filters, intersect the index keys\n\t\t\t\targ_8 = [arg_0._get_key_for_index(arg_6, arg_7) for arg_6, arg_7 in arg_0.filters]\n\t\t\t\targ_5 = arg_2.sinter(arg_8)\n\n\t\telse:\n\t\t\t# Some negative filters present\n\t\t\targ_9 = [arg_0._get_key_for_index(arg_6, arg_7) for arg_6, arg_7 in arg_0.notFilters]\n\t\t\tif arg_3 == 0:\n\t\t\t\t# Only negative, diff against all keys\n\t\t\t\targ_5 = arg_2.sdiff(arg_0._get_ids_key(), *arg_9)\n\t\t\telse:\n\t\t\t\t# Negative and positive. Use pipeline, find all positive intersections, and remove negative matches\n\t\t\t\targ_8 = [arg_0._get_key_for_index(arg_6, arg_7) for arg_6, arg_7 in arg_0.filters]\n\t\t\t\t\n\t\t\t\targ_10 = arg_0._getTempKey()\n\t\t\t\targ_11 = arg_2.pipeline()\n\t\t\t\targ_11.sinterstore(arg_10, *arg_8)\n\t\t\t\targ_11.sdiff(arg_10, *arg_9)\n\t\t\t\targ_11.delete(arg_10)\n\t\t\t\targ_5 = arg_11.execute()[1] # sdiff\n\n\n\t\targ_5 = [ int(_key) for _key in arg_5 ]\n\n\t\tif arg_1 is False:\n\t\t\treturn list(arg_5)\n\t\telse:\n\t\t\targ_5 = list(arg_5)\n\t\t\targ_5.sort()\n\n\t\t\treturn arg_5", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisQuery.getPrimaryKeys", "docstring": "getPrimaryKeys - Returns all primary keys matching current filterset.\n\n\t\t\t@param sortByAge <bool> - If False, return will be a set and may not be ordered.\n\t\t\t\tIf True, return will be a list and is guarenteed to represent objects oldest->newest\n\n\t\t\t@return <set> - A set of all primary keys associated with current filters.", "docstring_tokens": ["getPrimaryKeys", "-", "Returns", "all", "primary", "keys", "matching", "current", "filterset", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 255155}
{"url": "https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_file.py#L36-L47", "sha": "3f66a39e15a71b981e8c5f887a4adc3ad486a45f", "docstring_summary": "Touch a file.", "language": "python", "parameters": "(fname, mode=0o666, dir_fd=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0o666", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "os", ".", "O_CREAT", "|", "os", ".", "O_APPEND", "with", "os", ".", "fdopen", "(", "os", ".", "open", "(", "arg_0", ",", "arg_4", "=", "arg_4", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")", "as", "f", ":", "os", ".", "utime", "(", "f", ".", "fileno", "(", ")", "if", "os", ".", "utime", "in", "os", ".", "supports_fd", "else", "arg_0", ",", "arg_2", "=", "None", "if", "os", ".", "supports_fd", "else", "arg_2", ",", "**", "arg_3", ",", ")"], "function": "def Func(arg_0, arg_1=0o666, arg_2=None, **arg_3):\n    \"\"\" Touch a file.\n\n    Credits to <https://stackoverflow.com/a/1160227>.\n    \"\"\"\n    arg_4 = os.O_CREAT | os.O_APPEND\n    with os.fdopen(os.open(arg_0, arg_4=arg_4, arg_1=arg_1, arg_2=arg_2)) as f:\n        os.utime(\n            f.fileno() if os.utime in os.supports_fd else arg_0,\n            arg_2=None if os.supports_fd else arg_2,\n            **arg_3,\n        )", "path": "bgen_reader/_file.py", "identifier": "_touch", "docstring": "Touch a file.\n\n    Credits to <https://stackoverflow.com/a/1160227>.", "docstring_tokens": ["Touch", "a", "file", "."], "nwo": "limix/bgen-reader-py", "score": 0.37729991823847475, "idx": 255156}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/scripts/perf/scheduler_ops_metrics.py#L151-L166", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Remove any existing task instances for the perf test DAGs.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "settings", ".", "Session", "(", ")", "arg_1", "=", "TaskInstance", "arg_2", "=", "(", "arg_0", ".", "query", "(", "arg_1", ")", ".", "filter", "(", "arg_1", ".", "dag_id", ".", "in_", "(", "DAG_IDS", ")", ")", ".", "all", "(", ")", ")", "for", "arg_3", "in", "arg_2", ":", "logging", ".", "info", "(", "'Deleting TaskInstance :: {}'", ".", "format", "(", "arg_3", ")", ")", "arg_0", ".", "delete", "(", "arg_3", ")", "arg_0", ".", "commit", "(", ")"], "function": "def Func():\n    \"\"\"\n    Remove any existing task instances for the perf test DAGs.\n    \"\"\"\n    arg_0 = settings.Session()\n    arg_1 = TaskInstance\n    arg_2 = (\n        arg_0\n        .query(arg_1)\n        .filter(arg_1.dag_id.in_(DAG_IDS))\n        .all()\n    )\n    for arg_3 in arg_2:\n        logging.info('Deleting TaskInstance :: {}'.format(arg_3))\n        arg_0.delete(arg_3)\n    arg_0.commit()", "path": "scripts/perf/scheduler_ops_metrics.py", "identifier": "clear_dag_task_instances", "docstring": "Remove any existing task instances for the perf test DAGs.", "docstring_tokens": ["Remove", "any", "existing", "task", "instances", "for", "the", "perf", "test", "DAGs", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255157}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/base.py#L93-L106", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Set attributes to dictionary values.", "language": "python", "parameters": "(self, response={})", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ")", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "for", "arg_2", "in", "arg_1", ".", "keys", "(", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "arg_2", ")", "or", "not", "callable", "(", "getattr", "(", "arg_0", ",", "arg_2", ")", ")", ":", "setattr", "(", "arg_0", ",", "arg_2", ",", "arg_1", "[", "arg_2", "]", ")"], "function": "def Func(arg_0, arg_1={}):\n        \"\"\"\n        Set attributes to dictionary values.\n\n        - e.g.\n        >>> import tmdbsimple as tmdb\n        >>> movie = tmdb.Movies(103332)\n        >>> response = movie.info()\n        >>> movie.title  # instead of response['title']\n        \"\"\"\n        if isinstance(arg_1, dict):\n            for arg_2 in arg_1.keys():\n                if not hasattr(arg_0, arg_2) or not callable(getattr(arg_0, arg_2)):\n                    setattr(arg_0, arg_2, arg_1[arg_2])", "path": "tmdbsimple/base.py", "identifier": "TMDB._set_attrs_to_values", "docstring": "Set attributes to dictionary values.\n\n        - e.g.\n        >>> import tmdbsimple as tmdb\n        >>> movie = tmdb.Movies(103332)\n        >>> response = movie.info()\n        >>> movie.title  # instead of response['title']", "docstring_tokens": ["Set", "attributes", "to", "dictionary", "values", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 255158}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/image/reshape.py#L15-L61", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Return an image resized.", "language": "python", "parameters": "(image, x, y, stretch=False, top=None, left=None, mode='RGB',\n           resample=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'RGB'", ",", "arg_7", "=", "None", ")", ":", "if", "arg_1", "<=", "0", ":", "raise", "ValueError", "(", "'x must be greater than zero'", ")", "if", "arg_2", "<=", "0", ":", "raise", "ValueError", "(", "'y must be greater than zero'", ")", "from", "PIL", "import", "Image", "arg_7", "=", "Image", ".", "ANTIALIAS", "if", "arg_7", "is", "None", "else", "arg_7", "if", "not", "isinstance", "(", "arg_7", ",", "numbers", ".", "Number", ")", ":", "try", ":", "arg_7", "=", "getattr", "(", "Image", ",", "arg_7", ".", "upper", "(", ")", ")", "except", ":", "raise", "ValueError", "(", "\"(1) Didn't understand resample=%s\"", "%", "arg_7", ")", "if", "not", "isinstance", "(", "arg_7", ",", "numbers", ".", "Number", ")", ":", "raise", "ValueError", "(", "\"(2) Didn't understand resample=%s\"", "%", "arg_7", ")", "arg_8", "=", "arg_1", ",", "arg_2", "if", "arg_3", ":", "return", "arg_0", ".", "Func", "(", "arg_8", ",", "arg_7", "=", "arg_7", ")", "arg_9", "=", "Image", ".", "new", "(", "arg_6", ",", "arg_8", ")", "arg_10", "=", "[", "d1", "/", "d2", "for", "d1", ",", "d2", "in", "zip", "(", "arg_8", ",", "arg_0", ".", "size", ")", "]", "if", "arg_10", "[", "0", "]", "<", "arg_10", "[", "1", "]", ":", "arg_11", "=", "(", "arg_8", "[", "0", "]", ",", "int", "(", "arg_0", ".", "size", "[", "1", "]", "*", "arg_10", "[", "0", "]", ")", ")", "else", ":", "arg_11", "=", "(", "int", "(", "arg_0", ".", "size", "[", "0", "]", "*", "arg_10", "[", "1", "]", ")", ",", "arg_8", "[", "1", "]", ")", "arg_0", "=", "arg_0", ".", "Func", "(", "arg_11", ",", "arg_7", "=", "arg_7", ")", "if", "arg_5", "is", "None", ":", "arg_12", "=", "int", "(", "(", "arg_1", "-", "arg_11", "[", "0", "]", ")", "/", "2", ")", "elif", "arg_5", ":", "arg_12", "=", "0", "else", ":", "arg_12", "=", "arg_1", "-", "arg_11", "[", "0", "]", "if", "arg_4", "is", "None", ":", "arg_13", "=", "int", "(", "(", "arg_2", "-", "arg_11", "[", "1", "]", ")", "/", "2", ")", "elif", "arg_4", ":", "arg_13", "=", "0", "else", ":", "arg_13", "=", "arg_2", "-", "arg_11", "[", "1", "]", "arg_9", ".", "paste", "(", "arg_0", ",", "box", "=", "(", "arg_12", ",", "arg_13", ")", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=None, arg_5=None, arg_6='RGB',\n           arg_7=None):\n    \"\"\"Return an image Funcd.\"\"\"\n    if arg_1 <= 0:\n        raise ValueError('x must be greater than zero')\n    if arg_2 <= 0:\n        raise ValueError('y must be greater than zero')\n\n    from PIL import Image\n\n    arg_7 = Image.ANTIALIAS if arg_7 is None else arg_7\n    if not isinstance(arg_7, numbers.Number):\n        try:\n            arg_7 = getattr(Image, arg_7.upper())\n        except:\n            raise ValueError(\"(1) Didn't understand resample=%s\" % arg_7)\n        if not isinstance(arg_7, numbers.Number):\n            raise ValueError(\"(2) Didn't understand resample=%s\" % arg_7)\n\n    arg_8 = arg_1, arg_2\n    if arg_3:\n        return arg_0.Func(arg_8, arg_7=arg_7)\n    arg_9 = Image.new(arg_6, arg_8)\n\n    arg_10 = [d1 / d2 for d1, d2 in zip(arg_8, arg_0.size)]\n    if arg_10[0] < arg_10[1]:\n        arg_11 = (arg_8[0], int(arg_0.size[1] * arg_10[0]))\n    else:\n        arg_11 = (int(arg_0.size[0] * arg_10[1]), arg_8[1])\n\n    arg_0 = arg_0.Func(arg_11, arg_7=arg_7)\n    if arg_5 is None:\n        arg_12 = int((arg_1 - arg_11[0]) / 2)\n    elif arg_5:\n        arg_12 = 0\n    else:\n        arg_12 = arg_1 - arg_11[0]\n\n    if arg_4 is None:\n        arg_13 = int((arg_2 - arg_11[1]) / 2)\n    elif arg_4:\n        arg_13 = 0\n    else:\n        arg_13 = arg_2 - arg_11[1]\n\n    arg_9.paste(arg_0, box=(arg_12, arg_13))\n    return arg_9", "path": "bibliopixel/util/image/reshape.py", "identifier": "resize", "docstring": "Return an image resized.", "docstring_tokens": ["Return", "an", "image", "resized", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 255159}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/harmonic.py#L13-L104", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Harmonic salience function.", "language": "python", "parameters": "(S, freqs, h_range, weights=None, aggregate=None,\n             filter_peaks=True, fill_value=np.nan,  kind='linear', axis=0)", "return_statement": "return S_sal", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "True", ",", "arg_6", "=", "arg_7", ".", "nan", ",", "arg_9", "=", "'linear'", ",", "arg_10", "=", "0", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_7", ".", "average", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_7", ".", "ones", "(", "(", "len", "(", "arg_2", ")", ",", ")", ")", "else", ":", "arg_3", "=", "arg_7", ".", "array", "(", "arg_3", ",", "dtype", "=", "float", ")", "arg_11", "=", "interp_harmonics", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")", "if", "arg_4", "is", "arg_7", ".", "average", ":", "arg_12", "=", "arg_4", "(", "arg_11", ",", "arg_10", "=", "0", ",", "arg_3", "=", "arg_3", ")", "else", ":", "arg_12", "=", "arg_4", "(", "arg_11", ",", "arg_10", "=", "0", ")", "if", "arg_5", ":", "arg_13", "=", "scipy", ".", "signal", ".", "argrelmax", "(", "arg_0", ",", "arg_10", "=", "0", ")", "arg_14", "=", "arg_7", ".", "empty", "(", "arg_0", ".", "shape", ")", "arg_14", ".", "fill", "(", "arg_6", ")", "arg_14", "[", "arg_13", "[", "0", "]", ",", "arg_13", "[", "1", "]", "]", "=", "arg_12", "[", "arg_13", "[", "0", "]", ",", "arg_13", "[", "1", "]", "]", "arg_12", "=", "arg_14", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,\n             arg_5=True, arg_6=arg_7.nan,  arg_9='linear', arg_10=0):\n    \"\"\"Harmonic Func function.\n\n    Parameters\n    ----------\n    S : np.ndarray [shape=(d, n)]\n        input time frequency magnitude representation (stft, ifgram, etc).\n        Must be real-valued and non-negative.\n    freqs : np.ndarray, shape=(S.shape[axis])\n        The frequency values corresponding to S's elements along the\n        chosen axis.\n    h_range : list-like, non-negative\n        Harmonics to include in Func computation.  The first harmonic (1)\n        corresponds to `S` itself. Values less than one (e.g., 1/2) correspond\n        to sub-harmonics.\n    weights : list-like\n        The weight to apply to each harmonic in the summation. (default:\n        uniform weights). Must be the same length as `harmonics`.\n    aggregate : function\n        aggregation function (default: `np.average`)\n        If `aggregate=np.average`, then a weighted average is\n        computed per-harmonic according to the specified weights.\n        For all other aggregation functions, all harmonics\n        are treated equally.\n    filter_peaks : bool\n        If true, returns harmonic summation only on frequencies of peak\n        magnitude. Otherwise returns harmonic summation over the full spectrum.\n        Defaults to True.\n    fill_value : float\n        The value to fill non-peaks in the output representation. (default:\n        np.nan) Only used if `filter_peaks == True`.\n    kind : str\n        Interpolation type for harmonic estimation.\n        See `scipy.interpolate.interp1d`.\n    axis : int\n        The axis along which to compute harmonics\n\n    Returns\n    -------\n    S_sal : np.ndarray, shape=(len(h_range), [x.shape])\n        `S_sal` will have the same shape as `S`, and measure\n        the overal harmonic energy at each frequency.\n\n    See Also\n    --------\n    interp_harmonics\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      duration=15, offset=30)\n    >>> S = np.abs(librosa.stft(y))\n    >>> freqs = librosa.core.fft_frequencies(sr)\n    >>> harms = [1, 2, 3, 4]\n    >>> weights = [1.0, 0.5, 0.33, 0.25]\n    >>> S_sal = librosa.Func(S, freqs, harms, weights, fill_value=0)\n    >>> print(S_sal.shape)\n    (1025, 646)\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> librosa.display.specshow(librosa.amplitude_to_db(S_sal,\n    ...                                                  ref=np.max),\n    ...                          sr=sr, y_axis='log', x_axis='time')\n    >>> plt.colorbar()\n    >>> plt.title('Salience spectrogram')\n    >>> plt.tight_layout()\n    \"\"\"\n    if arg_4 is None:\n        arg_4 = arg_7.average\n\n    if arg_3 is None:\n        arg_3 = arg_7.ones((len(arg_2), ))\n    else:\n        arg_3 = arg_7.array(arg_3, dtype=float)\n\n    arg_11 = interp_harmonics(arg_0, arg_1, arg_2, arg_9=arg_9, arg_10=arg_10)\n\n    if arg_4 is arg_7.average:\n        arg_12 = arg_4(arg_11, arg_10=0, arg_3=arg_3)\n    else:\n        arg_12 = arg_4(arg_11, arg_10=0)\n\n    if arg_5:\n        arg_13 = scipy.signal.argrelmax(arg_0, arg_10=0)\n        arg_14 = arg_7.empty(arg_0.shape)\n        arg_14.fill(arg_6)\n        arg_14[arg_13[0], arg_13[1]] = arg_12[arg_13[0], arg_13[1]]\n\n        arg_12 = arg_14\n\n    return arg_12", "path": "librosa/core/harmonic.py", "identifier": "salience", "docstring": "Harmonic salience function.\n\n    Parameters\n    ----------\n    S : np.ndarray [shape=(d, n)]\n        input time frequency magnitude representation (stft, ifgram, etc).\n        Must be real-valued and non-negative.\n    freqs : np.ndarray, shape=(S.shape[axis])\n        The frequency values corresponding to S's elements along the\n        chosen axis.\n    h_range : list-like, non-negative\n        Harmonics to include in salience computation.  The first harmonic (1)\n        corresponds to `S` itself. Values less than one (e.g., 1/2) correspond\n        to sub-harmonics.\n    weights : list-like\n        The weight to apply to each harmonic in the summation. (default:\n        uniform weights). Must be the same length as `harmonics`.\n    aggregate : function\n        aggregation function (default: `np.average`)\n        If `aggregate=np.average`, then a weighted average is\n        computed per-harmonic according to the specified weights.\n        For all other aggregation functions, all harmonics\n        are treated equally.\n    filter_peaks : bool\n        If true, returns harmonic summation only on frequencies of peak\n        magnitude. Otherwise returns harmonic summation over the full spectrum.\n        Defaults to True.\n    fill_value : float\n        The value to fill non-peaks in the output representation. (default:\n        np.nan) Only used if `filter_peaks == True`.\n    kind : str\n        Interpolation type for harmonic estimation.\n        See `scipy.interpolate.interp1d`.\n    axis : int\n        The axis along which to compute harmonics\n\n    Returns\n    -------\n    S_sal : np.ndarray, shape=(len(h_range), [x.shape])\n        `S_sal` will have the same shape as `S`, and measure\n        the overal harmonic energy at each frequency.\n\n    See Also\n    --------\n    interp_harmonics\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      duration=15, offset=30)\n    >>> S = np.abs(librosa.stft(y))\n    >>> freqs = librosa.core.fft_frequencies(sr)\n    >>> harms = [1, 2, 3, 4]\n    >>> weights = [1.0, 0.5, 0.33, 0.25]\n    >>> S_sal = librosa.salience(S, freqs, harms, weights, fill_value=0)\n    >>> print(S_sal.shape)\n    (1025, 646)\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> librosa.display.specshow(librosa.amplitude_to_db(S_sal,\n    ...                                                  ref=np.max),\n    ...                          sr=sr, y_axis='log', x_axis='time')\n    >>> plt.colorbar()\n    >>> plt.title('Salience spectrogram')\n    >>> plt.tight_layout()", "docstring_tokens": ["Harmonic", "salience", "function", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 255160}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/supybot.py#L233-L243", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "List the filepath of the archives stored in dirpath", "language": "python", "parameters": "(self)", "return_statement": "return archives", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "os", ".", "walk", "(", "arg_0", ".", "dirpath", ")", ":", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_5", ")", "arg_1", ".", "append", "(", "arg_6", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"List the filepath of the archives stored in dirpath\"\"\"\n\n        arg_1 = []\n\n        for arg_2, arg_3, arg_4 in os.walk(arg_0.dirpath):\n            for arg_5 in arg_4:\n                arg_6 = os.path.join(arg_2, arg_5)\n                arg_1.append(arg_6)\n\n        return arg_1", "path": "perceval/backends/core/supybot.py", "identifier": "Supybot.__list_supybot_archives", "docstring": "List the filepath of the archives stored in dirpath", "docstring_tokens": ["List", "the", "filepath", "of", "the", "archives", "stored", "in", "dirpath"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255161}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L258-L263", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Add soundtouch audio effects to a Call", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/SoundTouch/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Add soundtouch audio effects to a Call\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/SoundTouch/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.sound_touch", "docstring": "REST Add soundtouch audio effects to a Call", "docstring_tokens": ["REST", "Add", "soundtouch", "audio", "effects", "to", "a", "Call"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 255162}
{"url": "https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/providers/basehttp.py#L74-L84", "sha": "a09d4e097e5599244564a2a7f0611e58efb4156a", "docstring_summary": "Report startup info to stdout.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "arg_0", ".", "Func_message", ".", "format", "(", "service", "=", "arg_0", ".", "service", ",", "host", "=", "arg_0", ".", "host", ",", "port", "=", "arg_0", ".", "port", ",", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Report startup info to stdout.\"\"\"\n\n        print(\n            arg_0.Func_message.format(\n                service=arg_0.service,\n                host=arg_0.host,\n                port=arg_0.port,\n            )\n        )\n        sys.stdout.flush()", "path": "service_factory/providers/basehttp.py", "identifier": "HTTPServiceProvider.report", "docstring": "Report startup info to stdout.", "docstring_tokens": ["Report", "startup", "info", "to", "stdout", "."], "nwo": "proofit404/service-factory", "score": 0.24979334806965703, "idx": 255163}
{"url": "https://github.com/pinterest/thrift-tools/blob/64e74aec89e2491c781fc62d1c45944dc15aba28/thrift_tools/sniffer.py#L126-L158", "sha": "64e74aec89e2491c781fc62d1c45944dc15aba28", "docstring_summary": "Deal with the incoming packets", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "while", "True", ":", "try", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_queue", ".", "popleft", "(", ")", "arg_5", "=", "get_ip", "(", "arg_4", ",", "arg_4", ".", "src", ")", "arg_6", "=", "get_ip", "(", "arg_4", ",", "arg_4", ".", "dst", ")", "arg_7", "=", "intern", "(", "'%s:%s'", "%", "(", "arg_5", ",", "arg_4", ".", "data", ".", "sport", ")", ")", "arg_8", "=", "intern", "(", "'%s:%s'", "%", "(", "arg_6", ",", "arg_4", ".", "data", ".", "dport", ")", ")", "arg_9", "=", "intern", "(", "'%s<->%s'", "%", "(", "arg_7", ",", "arg_8", ")", ")", "arg_10", "=", "arg_0", ".", "_streams", ".", "get", "(", "arg_9", ")", "if", "arg_10", "is", "None", ":", "arg_10", "=", "Stream", "(", "arg_7", ",", "arg_8", ")", "arg_0", ".", "_streams", "[", "arg_9", "]", "=", "arg_10", "setattr", "(", "arg_4", ",", "'timestamp'", ",", "arg_3", ")", "arg_12", "=", "arg_10", ".", "push", "(", "arg_4", ")", "if", "not", "arg_12", ":", "continue", "for", "arg_13", "in", "arg_0", ".", "_handlers", ":", "try", ":", "arg_13", "(", "arg_10", ")", "except", "Exception", "as", "ex", ":", "print", "(", "'handler exception: %s'", "%", "ex", ")", "except", "Exception", ":", "time", ".", "sleep", "(", "0.00001", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\" Deal with the incoming packets \"\"\"\n        while True:\n            try:\n                arg_3, arg_4 = arg_0._queue.popleft()\n\n                arg_5 = get_ip(arg_4, arg_4.src)\n                arg_6 = get_ip(arg_4, arg_4.dst)\n\n                arg_7 = intern('%s:%s' % (arg_5, arg_4.data.sport))\n                arg_8 = intern('%s:%s' % (arg_6, arg_4.data.dport))\n                arg_9 = intern('%s<->%s' % (arg_7, arg_8))\n\n                arg_10 = arg_0._streams.get(arg_9)\n                if arg_10 is None:\n                    arg_10 = Stream(arg_7, arg_8)\n                    arg_0._streams[arg_9] = arg_10\n\n                # HACK: save the timestamp\n                setattr(arg_4, 'timestamp', arg_3)\n                arg_12 = arg_10.push(arg_4)\n\n                if not arg_12:\n                    continue\n\n                # let listeners know about the updated stream\n                for arg_13 in arg_0._handlers:\n                    try:\n                        arg_13(arg_10)\n                    except Exception as ex:\n                        print('handler exception: %s' % ex)\n            except Exception:\n                time.sleep(0.00001)", "path": "thrift_tools/sniffer.py", "identifier": "Dispatcher.run", "docstring": "Deal with the incoming packets", "docstring_tokens": ["Deal", "with", "the", "incoming", "packets"], "nwo": "pinterest/thrift-tools", "score": 0.3868024438139195, "idx": 255164}
{"url": "https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/sync_utils.py#L154-L223", "sha": "c3ec2554b026f65ac5f0fc5c9d439277fbac14f9", "docstring_summary": "Takes data from the store and integrates into the application.", "language": "python", "parameters": "(profile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_serialize_into_store", "(", "arg_0", ")", "arg_1", "=", "{", "}", "with", "transaction", ".", "atomic", "(", ")", ":", "arg_2", "=", "_profile_models", "[", "arg_0", "]", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "six", ".", "iteritems", "(", "arg_2", ")", ":", "arg_6", "=", "_self_referential_fk", "(", "arg_5", ")", "arg_7", "=", "Q", "(", "arg_4", "=", "arg_5", ".", "morango_model_name", ")", "for", "arg_8", "in", "arg_5", ".", "morango_model_dependencies", ":", "arg_7", "|=", "Q", "(", "arg_4", "=", "arg_8", ".", "morango_model_name", ")", "if", "arg_6", ":", "arg_9", "=", "Store", ".", "objects", ".", "filter", "(", "arg_13", "=", "False", ",", "arg_0", "=", "arg_0", ")", ".", "filter", "(", "arg_7", ")", ".", "char_ids_list", "(", ")", "arg_10", "=", "Store", ".", "objects", ".", "filter", "(", "arg_13", "=", "True", ",", "arg_0", "=", "arg_0", ")", ".", "filter", "(", "Q", "(", "_self_ref_fk__in", "=", "arg_9", ")", "|", "Q", "(", "_self_ref_fk", "=", "''", ")", ")", ".", "filter", "(", "arg_7", ")", "while", "len", "(", "arg_10", ")", ">", "0", ":", "for", "arg_11", "in", "arg_10", ":", "try", ":", "arg_12", "=", "arg_11", ".", "_deserialize_store_model", "(", "arg_1", ")", "if", "arg_12", ":", "with", "mute_signals", "(", "signals", ".", "pre_save", ",", "signals", ".", "post_save", ")", ":", "arg_12", ".", "save", "(", "update_dirty_bit_to", "=", "False", ")", "arg_11", ".", "dirty_bit", "=", "False", "arg_11", ".", "save", "(", "update_fields", "=", "[", "'dirty_bit'", "]", ")", "except", "exceptions", ".", "ValidationError", ":", "arg_3", ".", "append", "(", "arg_11", ".", "id", ")", "arg_9", "=", "Store", ".", "objects", ".", "filter", "(", "arg_13", "=", "False", ",", "arg_0", "=", "arg_0", ")", ".", "filter", "(", "arg_7", ")", ".", "char_ids_list", "(", ")", "arg_10", "=", "Store", ".", "objects", ".", "filter", "(", "arg_13", "=", "True", ",", "arg_0", "=", "arg_0", ",", "_self_ref_fk__in", "=", "arg_9", ")", ".", "filter", "(", "arg_7", ")", "else", ":", "arg_14", "=", "[", "]", "arg_15", "=", "arg_5", ".", "_meta", ".", "fields", "for", "arg_11", "in", "Store", ".", "objects", ".", "filter", "(", "arg_4", "=", "arg_4", ",", "arg_0", "=", "arg_0", ",", "arg_13", "=", "True", ")", ":", "try", ":", "arg_12", "=", "arg_11", ".", "_deserialize_store_model", "(", "arg_1", ")", "if", "arg_12", ":", "for", "arg_16", "in", "arg_15", ":", "arg_17", "=", "getattr", "(", "arg_12", ",", "arg_16", ".", "attname", ")", "arg_18", "=", "arg_16", ".", "get_db_prep_value", "(", "arg_17", ",", "connection", ")", "arg_14", ".", "append", "(", "arg_18", ")", "except", "exceptions", ".", "ValidationError", ":", "arg_3", ".", "append", "(", "arg_11", ".", "id", ")", "if", "arg_14", ":", "arg_19", "=", "len", "(", "arg_14", ")", "//", "len", "(", "arg_15", ")", "arg_20", "=", "tuple", "(", "[", "'%s'", "for", "_", "in", "range", "(", "len", "(", "arg_15", ")", ")", "]", ")", "arg_21", "=", "[", "str", "(", "arg_20", ")", "for", "_", "in", "range", "(", "arg_19", ")", "]", "with", "connection", ".", "cursor", "(", ")", "as", "cursor", ":", "DBBackend", ".", "_bulk_insert_into_app_models", "(", "cursor", ",", "arg_5", ".", "_meta", ".", "db_table", ",", "arg_15", ",", "arg_14", ",", "arg_21", ")", "Store", ".", "objects", ".", "exclude", "(", "id__in", "=", "arg_3", ")", ".", "filter", "(", "arg_0", "=", "arg_0", ",", "arg_13", "=", "True", ")", ".", "update", "(", "arg_13", "=", "False", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Takes data from the store and integrates into the application.\n    \"\"\"\n    # we first serialize to avoid deserialization merge conflicts\n    _serialize_into_store(arg_0)\n\n    arg_1 = {}\n    with transaction.atomic():\n        arg_2 = _profile_models[arg_0]\n        arg_3 = []\n        # iterate through classes which are in foreign key dependency order\n        for arg_4, arg_5 in six.iteritems(arg_2):\n            # handle cases where a class has a single FK reference to itself\n            arg_6 = _self_referential_fk(arg_5)\n            arg_7 = Q(arg_4=arg_5.morango_model_name)\n            for arg_8 in arg_5.morango_model_dependencies:\n                arg_7 |= Q(arg_4=arg_8.morango_model_name)\n            if arg_6:\n                arg_9 = Store.objects.filter(arg_13=False, arg_0=arg_0).filter(arg_7).char_ids_list()\n                arg_10 = Store.objects.filter(arg_13=True, arg_0=arg_0) \\\n                                              .filter(Q(_self_ref_fk__in=arg_9) | Q(_self_ref_fk='')).filter(arg_7)\n\n                # keep iterating until size of dirty_children is 0\n                while len(arg_10) > 0:\n                    for arg_11 in arg_10:\n                        try:\n                            arg_12 = arg_11._deserialize_store_model(arg_1)\n                            if arg_12:\n                                with mute_signals(signals.pre_save, signals.post_save):\n                                    arg_12.save(update_dirty_bit_to=False)\n                            # we update a store model after we have deserialized it to be able to mark it as a clean parent\n                            arg_11.dirty_bit = False\n                            arg_11.save(update_fields=['dirty_bit'])\n                        except exceptions.ValidationError:\n                            # if the app model did not validate, we leave the store dirty bit set\n                            arg_3.append(arg_11.id)\n\n                    # update lists with new clean parents and dirty children\n                    arg_9 = Store.objects.filter(arg_13=False, arg_0=arg_0).filter(arg_7).char_ids_list()\n                    arg_10 = Store.objects.filter(arg_13=True, arg_0=arg_0, _self_ref_fk__in=arg_9).filter(arg_7)\n            else:\n                # array for holding db values from the fields of each model for this class\n                arg_14 = []\n                arg_15 = arg_5._meta.fields\n                for arg_11 in Store.objects.filter(arg_4=arg_4, arg_0=arg_0, arg_13=True):\n                    try:\n                        arg_12 = arg_11._deserialize_store_model(arg_1)\n                        # if the model was not deleted add its field values to the list\n                        if arg_12:\n                            for arg_16 in arg_15:\n                                arg_17 = getattr(arg_12, arg_16.attname)\n                                arg_18 = arg_16.get_db_prep_value(arg_17, connection)\n                                arg_14.append(arg_18)\n                    except exceptions.ValidationError:\n                        # if the app model did not validate, we leave the store dirty bit set\n                        arg_3.append(arg_11.id)\n\n                if arg_14:\n                    # number of rows to update\n                    arg_19 = len(arg_14) // len(arg_15)\n                    # create '%s' placeholders for a single row\n                    arg_20 = tuple(['%s' for _ in range(len(arg_15))])\n                    # create list of the '%s' tuple placeholders based on number of rows to update\n                    arg_21 = [str(arg_20) for _ in range(arg_19)]\n                    with connection.cursor() as cursor:\n                        DBBackend._bulk_insert_into_app_models(cursor, arg_5._meta.db_table, arg_15, arg_14, arg_21)\n\n        # clear dirty bit for all store models for this profile except for models that did not validate\n        Store.objects.exclude(id__in=arg_3).filter(arg_0=arg_0, arg_13=True).update(arg_13=False)", "path": "morango/utils/sync_utils.py", "identifier": "_deserialize_from_store", "docstring": "Takes data from the store and integrates into the application.", "docstring_tokens": ["Takes", "data", "from", "the", "store", "and", "integrates", "into", "the", "application", "."], "nwo": "learningequality/morango", "score": 0.37668663501628774, "idx": 255165}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L592-L645", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Return list of 5-tuples describing how to turn a into b.", "language": "python", "parameters": "(self)", "return_statement": "return answer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "opcodes", "is", "not", "None", ":", "return", "arg_0", ".", "opcodes", "arg_1", "=", "arg_7", "=", "0", "arg_0", ".", "opcodes", "=", "answer", "=", "[", "]", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "get_matching_blocks", "(", ")", ":", "arg_6", "=", "''", "if", "arg_1", "<", "arg_3", "and", "arg_7", "<", "arg_4", ":", "arg_6", "=", "'replace'", "elif", "arg_1", "<", "arg_3", ":", "arg_6", "=", "'delete'", "elif", "arg_7", "<", "arg_4", ":", "arg_6", "=", "'insert'", "if", "arg_6", ":", "answer", ".", "append", "(", "(", "arg_6", ",", "arg_1", ",", "arg_3", ",", "arg_7", ",", "arg_4", ")", ")", "arg_1", ",", "arg_7", "=", "arg_3", "+", "arg_5", ",", "arg_4", "+", "arg_5", "if", "arg_5", ":", "answer", ".", "append", "(", "(", "'equal'", ",", "arg_3", ",", "arg_1", ",", "arg_4", ",", "arg_7", ")", ")", "return", "answer"], "function": "def Func(arg_0):\n        \"\"\"Return list of 5-tuples describing how to turn a into b.\n\n        Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple\n        has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the\n        tuple preceding it, and likewise for j1 == the previous j2.\n\n        The tags are strings, with these meanings:\n\n        'replace':  a[i1:i2] should be replaced by b[j1:j2]\n        'delete':   a[i1:i2] should be deleted.\n                    Note that j1==j2 in this case.\n        'insert':   b[j1:j2] should be inserted at a[i1:i1].\n                    Note that i1==i2 in this case.\n        'equal':    a[i1:i2] == b[j1:j2]\n\n        >>> a = \"qabxcd\"\n        >>> b = \"abycdf\"\n        >>> s = SequenceMatcher(None, a, b)\n        >>> for tag, i1, i2, j1, j2 in s.Func():\n        ...    print (\"%7s a[%d:%d] (%s) b[%d:%d] (%s)\" %\n        ...           (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))\n         delete a[0:1] (q) b[0:0] ()\n          equal a[1:3] (ab) b[0:2] (ab)\n        replace a[3:4] (x) b[2:3] (y)\n          equal a[4:6] (cd) b[3:5] (cd)\n         insert a[6:6] () b[5:6] (f)\n        \"\"\"\n\n        if arg_0.opcodes is not None:\n            return arg_0.opcodes\n        arg_1 = arg_7 = 0\n        arg_0.opcodes = answer = []\n        for arg_3, arg_4, arg_5 in arg_0.get_matching_blocks():\n            # invariant:  we've pumped out correct diffs to change\n            # a[:i] into b[:j], and the next matching block is\n            # a[ai:ai+size] == b[bj:bj+size].  So we need to pump\n            # out a diff to change a[i:ai] into b[j:bj], pump out\n            # the matching block, and move (i,j) beyond the match\n            arg_6 = ''\n            if arg_1 < arg_3 and arg_7 < arg_4:\n                arg_6 = 'replace'\n            elif arg_1 < arg_3:\n                arg_6 = 'delete'\n            elif arg_7 < arg_4:\n                arg_6 = 'insert'\n            if arg_6:\n                answer.append( (arg_6, arg_1, arg_3, arg_7, arg_4) )\n            arg_1, arg_7 = arg_3+arg_5, arg_4+arg_5\n            # the list of matching blocks is terminated by a\n            # sentinel with size 0\n            if arg_5:\n                answer.append( ('equal', arg_3, arg_1, arg_4, arg_7) )\n        return answer", "path": "third_party/stdlib/difflib.py", "identifier": "SequenceMatcher.get_opcodes", "docstring": "Return list of 5-tuples describing how to turn a into b.\n\n        Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple\n        has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the\n        tuple preceding it, and likewise for j1 == the previous j2.\n\n        The tags are strings, with these meanings:\n\n        'replace':  a[i1:i2] should be replaced by b[j1:j2]\n        'delete':   a[i1:i2] should be deleted.\n                    Note that j1==j2 in this case.\n        'insert':   b[j1:j2] should be inserted at a[i1:i1].\n                    Note that i1==i2 in this case.\n        'equal':    a[i1:i2] == b[j1:j2]\n\n        >>> a = \"qabxcd\"\n        >>> b = \"abycdf\"\n        >>> s = SequenceMatcher(None, a, b)\n        >>> for tag, i1, i2, j1, j2 in s.get_opcodes():\n        ...    print (\"%7s a[%d:%d] (%s) b[%d:%d] (%s)\" %\n        ...           (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))\n         delete a[0:1] (q) b[0:0] ()\n          equal a[1:3] (ab) b[0:2] (ab)\n        replace a[3:4] (x) b[2:3] (y)\n          equal a[4:6] (cd) b[3:5] (cd)\n         insert a[6:6] () b[5:6] (f)", "docstring_tokens": ["Return", "list", "of", "5", "-", "tuples", "describing", "how", "to", "turn", "a", "into", "b", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 255166}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/base_graph.py#L551-L576", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Adds a subgraph to the graph.", "language": "python", "parameters": "(self, subgraph_or_ID)", "return_statement": "return subgraph", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "(", "godot", ".", "subgraph", ".", "Subgraph", ",", "godot", ".", "cluster", ".", "Cluster", ")", ")", ":", "arg_2", "=", "str", "(", "arg_1", ")", "if", "arg_1", ".", "startswith", "(", "\"cluster\"", ")", ":", "arg_3", "=", "godot", ".", "cluster", ".", "Cluster", "(", "ID", "=", "arg_2", ")", "else", ":", "arg_3", "=", "godot", ".", "subgraph", ".", "Subgraph", "(", "ID", "=", "arg_2", ")", "else", ":", "arg_3", "=", "arg_1", "arg_3", ".", "default_node", "=", "arg_0", ".", "default_node", "arg_3", ".", "default_edge", "=", "arg_0", ".", "default_edge", "if", "isinstance", "(", "arg_3", ",", "godot", ".", "subgraph", ".", "Subgraph", ")", ":", "arg_0", ".", "subgraphs", ".", "append", "(", "arg_3", ")", "elif", "isinstance", "(", "arg_3", ",", "godot", ".", "cluster", ".", "Cluster", ")", ":", "arg_0", ".", "clusters", ".", "append", "(", "arg_3", ")", "else", ":", "raise", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Adds a subgraph to the graph.\n        \"\"\"\n        if not isinstance(arg_1, (godot.subgraph.Subgraph,\n                                           godot.cluster.Cluster)):\n            arg_2 = str( arg_1 )\n            if arg_1.startswith(\"cluster\"):\n                arg_3 = godot.cluster.Cluster(ID=arg_2)\n            else:\n                arg_3 = godot.subgraph.Subgraph(ID=arg_2)\n        else:\n            arg_3 = arg_1\n\n        arg_3.default_node = arg_0.default_node\n        arg_3.default_edge = arg_0.default_edge\n#        subgraph.level = self.level + 1\n#        subgraph.padding += self.padding\n\n        if isinstance(arg_3, godot.subgraph.Subgraph):\n            arg_0.subgraphs.append(arg_3)\n        elif isinstance(arg_3, godot.cluster.Cluster):\n            arg_0.clusters.append(arg_3)\n        else:\n            raise\n\n        return arg_3", "path": "godot/base_graph.py", "identifier": "BaseGraph.add_subgraph", "docstring": "Adds a subgraph to the graph.", "docstring_tokens": ["Adds", "a", "subgraph", "to", "the", "graph", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 255167}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/selector.py#L83-L105", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Is the directory a wanted test directory?", "language": "python", "parameters": "(self, dirname)", "return_statement": "return wanted", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "op_basename", "(", "arg_1", ")", "if", "ispackage", "(", "arg_1", ")", ":", "arg_3", "=", "(", "not", "arg_0", ".", "exclude", "or", "not", "filter", "(", "None", ",", "[", "exc", ".", "search", "(", "arg_2", ")", "for", "exc", "in", "arg_0", ".", "exclude", "]", ")", ")", "else", ":", "arg_3", "=", "(", "arg_0", ".", "matches", "(", "arg_2", ")", "or", "(", "arg_0", ".", "config", ".", "srcDirs", "and", "arg_2", "in", "arg_0", ".", "config", ".", "srcDirs", ")", ")", "arg_4", "=", "arg_0", ".", "plugins", ".", "Func", "(", "arg_1", ")", "if", "arg_4", "is", "not", "None", ":", "log", ".", "debug", "(", "\"Plugin setting selection of %s to %s\"", ",", "arg_1", ",", "arg_4", ")", "arg_3", "=", "arg_4", "log", ".", "debug", "(", "\"Func %s? %s\"", ",", "arg_1", ",", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Is the directory a wanted test directory?\n\n        All package directories match, so long as they do not match exclude. \n        All other directories must match test requirements.\n        \"\"\"\n        arg_2 = op_basename(arg_1)\n        if ispackage(arg_1):\n            arg_3 = (not arg_0.exclude\n                      or not filter(None,\n                                    [exc.search(arg_2) for exc in arg_0.exclude]\n                                    ))\n        else:\n            arg_3 = (arg_0.matches(arg_2)\n                      or (arg_0.config.srcDirs\n                          and arg_2 in arg_0.config.srcDirs))\n        arg_4 = arg_0.plugins.Func(arg_1)\n        if arg_4 is not None:\n            log.debug(\"Plugin setting selection of %s to %s\",\n                      arg_1, arg_4)\n            arg_3 = arg_4\n        log.debug(\"Func %s? %s\", arg_1, arg_3)\n        return arg_3", "path": "environment/lib/python2.7/site-packages/nose/selector.py", "identifier": "Selector.wantDirectory", "docstring": "Is the directory a wanted test directory?\n\n        All package directories match, so long as they do not match exclude. \n        All other directories must match test requirements.", "docstring_tokens": ["Is", "the", "directory", "a", "wanted", "test", "directory?"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255168}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/glm/fisher_scoring.py#L635-L639", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns number of cols in a given `Tensor`.", "language": "python", "parameters": "(x)", "return_statement": "return tf.shape(input=x)[-1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "tf", ".", "compat", ".", "dimension_value", "(", "arg_0", ".", "shape", "[", "-", "1", "]", ")", "is", "not", "None", ":", "return", "tf", ".", "compat", ".", "dimension_value", "(", "arg_0", ".", "shape", "[", "-", "1", "]", ")", "return", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "[", "-", "1", "]"], "function": "def Func(arg_0):\n  \"\"\"Returns number of cols in a given `Tensor`.\"\"\"\n  if tf.compat.dimension_value(arg_0.shape[-1]) is not None:\n    return tf.compat.dimension_value(arg_0.shape[-1])\n  return tf.shape(input=arg_0)[-1]", "path": "tensorflow_probability/python/glm/fisher_scoring.py", "identifier": "num_cols", "docstring": "Returns number of cols in a given `Tensor`.", "docstring_tokens": ["Returns", "number", "of", "cols", "in", "a", "given", "Tensor", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255169}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L2141-L2156", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Logs an error if there is no newline char at the end of the file.", "language": "python", "parameters": "(filename, lines, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_1", ")", "<", "3", "or", "arg_1", "[", "-", "2", "]", ":", "arg_2", "(", "arg_0", ",", "len", "(", "arg_1", ")", "-", "2", ",", "'whitespace/ending_newline'", ",", "5", ",", "'Could not find a newline character at the end of the file.'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Logs an error if there is no newline char at the end of the file.\n\n  Args:\n    filename: The name of the current file.\n    lines: An array of strings, each representing a line of the file.\n    error: The function to call with any errors found.\n  \"\"\"\n\n  # The array lines() was created by adding two newlines to the\n  # original file (go figure), then splitting on \\n.\n  # To verify that the file ends in \\n, we just have to make sure the\n  # last-but-two element of lines() exists and is empty.\n  if len(arg_1) < 3 or arg_1[-2]:\n    arg_2(arg_0, len(arg_1) - 2, 'whitespace/ending_newline', 5,\n          'Could not find a newline character at the end of the file.')", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckForNewlineAtEOF", "docstring": "Logs an error if there is no newline char at the end of the file.\n\n  Args:\n    filename: The name of the current file.\n    lines: An array of strings, each representing a line of the file.\n    error: The function to call with any errors found.", "docstring_tokens": ["Logs", "an", "error", "if", "there", "is", "no", "newline", "char", "at", "the", "end", "of", "the", "file", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255170}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/cli.py#L246-L297", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Upload a new file to an existing project.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_setup_osf", "(", "arg_0", ")", "if", "arg_1", ".", "username", "is", "None", "or", "arg_1", ".", "password", "is", "None", ":", "sys", ".", "exit", "(", "'To Func a file you need to provide a username and'", "' password.'", ")", "arg_2", "=", "arg_1", ".", "project", "(", "arg_0", ".", "project", ")", "arg_3", ",", "arg_4", "=", "split_storage", "(", "arg_0", ".", "destination", ")", "arg_5", "=", "arg_2", ".", "storage", "(", "arg_3", ")", "if", "arg_0", ".", "recursive", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_0", ".", "source", ")", ":", "raise", "RuntimeError", "(", "\"Expected source ({}) to be a directory when \"", "\"using recursive mode.\"", ".", "format", "(", "arg_0", ".", "source", ")", ")", "arg_6", ",", "arg_7", "=", "os", ".", "path", ".", "split", "(", "arg_0", ".", "source", ")", "for", "arg_8", ",", "arg_6", ",", "arg_9", "in", "os", ".", "walk", "(", "arg_0", ".", "source", ")", ":", "arg_10", "=", "os", ".", "path", ".", "relpath", "(", "arg_8", ",", "arg_0", ".", "source", ")", "for", "arg_11", "in", "arg_9", ":", "arg_12", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "arg_11", ")", "with", "open", "(", "arg_12", ",", "'rb'", ")", "as", "fp", ":", "arg_13", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_7", ",", "arg_10", ",", "arg_11", ")", "arg_5", ".", "create_file", "(", "arg_13", ",", "fp", ",", "force", "=", "arg_0", ".", "force", ",", "update", "=", "arg_0", ".", "update", ")", "else", ":", "with", "open", "(", "arg_0", ".", "source", ",", "'rb'", ")", "as", "fp", ":", "arg_5", ".", "create_file", "(", "arg_4", ",", "fp", ",", "force", "=", "arg_0", ".", "force", ",", "update", "=", "arg_0", ".", "update", ")"], "function": "def Func(arg_0):\n    \"\"\"Upload a new file to an existing project.\n\n    The first part of the remote path is interpreted as the name of the\n    storage provider. If there is no match the default (osfstorage) is\n    used.\n\n    If the project is private you need to specify a username.\n\n    To Func a whole directory (and all its sub-directories) use the `-r`\n    command-line option. If your source directory name ends in a / then\n    files will be created directly in the remote directory. If it does not\n    end in a slash an extra sub-directory with the name of the local directory\n    will be created.\n\n    To place contents of local directory `foo` in remote directory `bar/foo`:\n    $ osf Func -r foo bar\n    To place contents of local directory `foo` in remote directory `bar`:\n    $ osf Func -r foo/ bar\n    \"\"\"\n    arg_1 = _setup_osf(arg_0)\n    if arg_1.username is None or arg_1.password is None:\n        sys.exit('To Func a file you need to provide a username and'\n                 ' password.')\n\n    arg_2 = arg_1.project(arg_0.project)\n    arg_3, arg_4 = split_storage(arg_0.destination)\n\n    arg_5 = arg_2.storage(arg_3)\n    if arg_0.recursive:\n        if not os.path.isdir(arg_0.source):\n            raise RuntimeError(\"Expected source ({}) to be a directory when \"\n                               \"using recursive mode.\".format(arg_0.source))\n\n        # local name of the directory that is being Funced\n        arg_6, arg_7 = os.path.split(arg_0.source)\n\n        for arg_8, arg_6, arg_9 in os.walk(arg_0.source):\n            arg_10 = os.path.relpath(arg_8, arg_0.source)\n            for arg_11 in arg_9:\n                arg_12 = os.path.join(arg_8, arg_11)\n                with open(arg_12, 'rb') as fp:\n                    # build the remote path + fname\n                    arg_13 = os.path.join(arg_4, arg_7, arg_10,\n                                        arg_11)\n                    arg_5.create_file(arg_13, fp, force=arg_0.force,\n                                      update=arg_0.update)\n\n    else:\n        with open(arg_0.source, 'rb') as fp:\n            arg_5.create_file(arg_4, fp, force=arg_0.force,\n                              update=arg_0.update)", "path": "osfclient/cli.py", "identifier": "upload", "docstring": "Upload a new file to an existing project.\n\n    The first part of the remote path is interpreted as the name of the\n    storage provider. If there is no match the default (osfstorage) is\n    used.\n\n    If the project is private you need to specify a username.\n\n    To upload a whole directory (and all its sub-directories) use the `-r`\n    command-line option. If your source directory name ends in a / then\n    files will be created directly in the remote directory. If it does not\n    end in a slash an extra sub-directory with the name of the local directory\n    will be created.\n\n    To place contents of local directory `foo` in remote directory `bar/foo`:\n    $ osf upload -r foo bar\n    To place contents of local directory `foo` in remote directory `bar`:\n    $ osf upload -r foo/ bar", "docstring_tokens": ["Upload", "a", "new", "file", "to", "an", "existing", "project", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 255171}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/khard.py#L715-L757", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Create a new contact.", "language": "python", "parameters": "(selected_address_books, input_from_stdin_or_file,\n                   open_editor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "choose_address_book_from_list", "(", "\"Select address book for new contact\"", ",", "arg_0", ")", "if", "arg_3", "is", "None", ":", "print", "(", "\"Error: address book list is empty\"", ")", "sys", ".", "exit", "(", "1", ")", "if", "arg_1", ":", "try", ":", "arg_4", "=", "CarddavObject", ".", "from_user_input", "(", "arg_3", ",", "arg_1", ",", "config", ".", "get_supported_private_objects", "(", ")", ",", "config", ".", "get_preferred_vcard_version", "(", ")", ",", "config", ".", "localize_dates", "(", ")", ")", "except", "ValueError", "as", "err", ":", "print", "(", "err", ")", "sys", ".", "exit", "(", "1", ")", "else", ":", "arg_4", ".", "write_to_file", "(", ")", "if", "arg_2", ":", "modify_existing_contact", "(", "arg_4", ")", "else", ":", "print", "(", "\"Creation successful\\n\\n%s\"", "%", "arg_4", ".", "print_vcard", "(", ")", ")", "else", ":", "create_new_contact", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1,\n                   arg_2):\n    \"\"\"Create a new contact.\n\n    :param selected_address_books: a list of addressbooks that were selected on\n        the command line\n    :type selected_address_books: list of address_book.AddressBook\n    :param input_from_stdin_or_file: the data for the new contact as a yaml\n        formatted string\n    :type input_from_stdin_or_file: str\n    :param open_editor: whether to open the new contact in the edior after\n        creation\n    :type open_editor: bool\n    :returns: None\n    :rtype: None\n\n    \"\"\"\n    # ask for address book, in which to create the new contact\n    arg_3 = choose_address_book_from_list(\n        \"Select address book for new contact\", arg_0)\n    if arg_3 is None:\n        print(\"Error: address book list is empty\")\n        sys.exit(1)\n    # if there is some data in stdin\n    if arg_1:\n        # create new contact from stdin\n        try:\n            arg_4 = CarddavObject.from_user_input(\n                arg_3, arg_1,\n                config.get_supported_private_objects(),\n                config.get_preferred_vcard_version(),\n                config.localize_dates())\n        except ValueError as err:\n            print(err)\n            sys.exit(1)\n        else:\n            arg_4.write_to_file()\n        if arg_2:\n            modify_existing_contact(arg_4)\n        else:\n            print(\"Creation successful\\n\\n%s\" % arg_4.print_vcard())\n    else:\n        create_new_contact(arg_3)", "path": "khard/khard.py", "identifier": "new_subcommand", "docstring": "Create a new contact.\n\n    :param selected_address_books: a list of addressbooks that were selected on\n        the command line\n    :type selected_address_books: list of address_book.AddressBook\n    :param input_from_stdin_or_file: the data for the new contact as a yaml\n        formatted string\n    :type input_from_stdin_or_file: str\n    :param open_editor: whether to open the new contact in the edior after\n        creation\n    :type open_editor: bool\n    :returns: None\n    :rtype: None", "docstring_tokens": ["Create", "a", "new", "contact", "."], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 255172}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/stdlib.py#L286-L312", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Visit a Call node.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "for", "arg_2", "in", "arg_1", ".", "func", ".", "infer", "(", ")", ":", "if", "arg_2", "is", "astroid", ".", "Uninferable", ":", "continue", "elif", "arg_2", ".", "root", "(", ")", ".", "name", "==", "OPEN_MODULE", ":", "if", "getattr", "(", "arg_1", ".", "func", ",", "\"name\"", ",", "None", ")", "in", "OPEN_FILES", ":", "arg_0", ".", "_check_open_mode", "(", "arg_1", ")", "elif", "arg_2", ".", "root", "(", ")", ".", "name", "==", "UNITTEST_CASE", ":", "arg_0", ".", "_check_redundant_assert", "(", "arg_1", ",", "arg_2", ")", "elif", "isinstance", "(", "arg_2", ",", "astroid", ".", "ClassDef", ")", ":", "if", "arg_2", ".", "qname", "(", ")", "==", "THREADING_THREAD", ":", "arg_0", ".", "_check_bad_thread_instantiation", "(", "arg_1", ")", "elif", "arg_2", ".", "qname", "(", ")", "==", "SUBPROCESS_POPEN", ":", "arg_0", ".", "_check_for_preexec_fn_in_popen", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_2", ",", "astroid", ".", "FunctionDef", ")", ":", "arg_3", "=", "arg_2", ".", "qname", "(", ")", "if", "arg_3", "==", "COPY_COPY", ":", "arg_0", ".", "_check_shallow_copy_environ", "(", "arg_1", ")", "elif", "arg_3", "in", "ENV_GETTERS", ":", "arg_0", ".", "_check_env_function", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "SUBPROCESS_RUN", "and", "PY35", ":", "arg_0", ".", "_check_for_check_kw_in_run", "(", "arg_1", ")", "arg_0", ".", "_check_deprecated_method", "(", "arg_1", ",", "arg_2", ")", "except", "astroid", ".", "InferenceError", ":", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Visit a Call node.\"\"\"\n        try:\n            for arg_2 in arg_1.func.infer():\n                if arg_2 is astroid.Uninferable:\n                    continue\n                elif arg_2.root().name == OPEN_MODULE:\n                    if getattr(arg_1.func, \"name\", None) in OPEN_FILES:\n                        arg_0._check_open_mode(arg_1)\n                elif arg_2.root().name == UNITTEST_CASE:\n                    arg_0._check_redundant_assert(arg_1, arg_2)\n                elif isinstance(arg_2, astroid.ClassDef):\n                    if arg_2.qname() == THREADING_THREAD:\n                        arg_0._check_bad_thread_instantiation(arg_1)\n                    elif arg_2.qname() == SUBPROCESS_POPEN:\n                        arg_0._check_for_preexec_fn_in_popen(arg_1)\n                elif isinstance(arg_2, astroid.FunctionDef):\n                    arg_3 = arg_2.qname()\n                    if arg_3 == COPY_COPY:\n                        arg_0._check_shallow_copy_environ(arg_1)\n                    elif arg_3 in ENV_GETTERS:\n                        arg_0._check_env_function(arg_1, arg_2)\n                    elif arg_3 == SUBPROCESS_RUN and PY35:\n                        arg_0._check_for_check_kw_in_run(arg_1)\n                arg_0._check_deprecated_method(arg_1, arg_2)\n        except astroid.InferenceError:\n            return", "path": "pylint/checkers/stdlib.py", "identifier": "StdlibChecker.visit_call", "docstring": "Visit a Call node.", "docstring_tokens": ["Visit", "a", "Call", "node", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255173}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/outdated.py#L40-L114", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "print information about outdated modules,\n        return 0 if there is nothing to be done and nonzero otherwise", "language": "python", "parameters": "(modules, dependency_specs, use_colours)", "return_statement": "return status", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ":", "arg_3", "=", "colorama", ".", "Style", ".", "DIM", "arg_4", "=", "colorama", ".", "Style", ".", "NORMAL", "arg_5", "=", "colorama", ".", "Style", ".", "BRIGHT", "arg_6", "=", "colorama", ".", "Fore", ".", "YELLOW", "arg_7", "=", "colorama", ".", "Fore", ".", "RED", "arg_8", "=", "colorama", ".", "Fore", ".", "GREEN", "arg_9", "=", "colorama", ".", "Style", ".", "RESET_ALL", "else", ":", "arg_3", "=", "arg_5", "=", "arg_6", "=", "arg_7", "=", "arg_8", "=", "arg_9", "=", "u''", "arg_10", "=", "0", "from", "yotta", ".", "lib", "import", "access", "from", "yotta", ".", "lib", "import", "access_common", "from", "yotta", ".", "lib", "import", "sourceparse", "for", "arg_11", ",", "arg_12", "in", "arg_0", ".", "items", "(", ")", ":", "if", "arg_12", ".", "isTestDependency", "(", ")", ":", "continue", "try", ":", "arg_13", "=", "access", ".", "latestSuitableVersion", "(", "arg_11", ",", "'*'", ",", "registry", "=", "'modules'", ",", "quiet", "=", "True", ")", "except", "access_common", ".", "Unavailable", "as", "e", ":", "arg_13", "=", "None", "if", "not", "arg_12", ":", "arg_14", "=", "u' '", "+", "arg_9", "+", "arg_5", "+", "arg_7", "+", "u\"missing\"", "+", "arg_9", "else", ":", "arg_14", "=", "arg_3", "+", "u'@%s'", "%", "(", "arg_12", ".", "version", ")", "if", "not", "arg_13", ":", "print", "(", "u'%s%s%s%s not available from the registry%s'", "%", "(", "arg_7", ",", "arg_11", ",", "arg_14", ",", "arg_4", ",", "arg_9", ")", ")", "arg_10", "=", "2", "continue", "elif", "not", "arg_12", "or", "arg_12", ".", "version", "<", "arg_13", ":", "arg_15", "=", "''", "if", "arg_12", ":", "arg_16", "=", "[", "x", "for", "x", "in", "arg_1", "if", "x", ".", "name", "==", "arg_11", "and", "not", "sourceparse", ".", "parseSourceURL", "(", "x", ".", "nonShrinkwrappedVersionReq", "(", ")", ")", ".", "semanticSpecMatches", "(", "arg_13", ")", "]", "arg_17", "=", "[", "x", "for", "x", "in", "arg_1", "if", "x", ".", "name", "==", "arg_11", "and", "x", ".", "isShrinkwrapped", "(", ")", "and", "not", "sourceparse", ".", "parseSourceURL", "(", "x", ".", "versionReq", "(", ")", ")", ".", "semanticSpecMatches", "(", "arg_13", ")", "]", "if", "len", "(", "arg_16", ")", ":", "arg_15", "=", "' (update prevented by specifications: %s)'", "%", "(", "', '", ".", "join", "(", "[", "'%s from %s'", "%", "(", "x", ".", "version_req", ",", "x", ".", "specifying_module", ")", "for", "x", "in", "arg_16", "]", ")", ")", "if", "len", "(", "arg_17", ")", ":", "arg_15", "+=", "' yotta-shrinkwrap.json prevents update'", "if", "arg_12", ".", "version", ".", "major", "(", ")", "<", "arg_13", ".", "major", "(", ")", ":", "arg_18", "=", "arg_8", "elif", "arg_12", ".", "version", ".", "minor", "(", ")", "<", "arg_13", ".", "minor", "(", ")", ":", "arg_18", "=", "arg_6", "else", ":", "arg_18", "=", "arg_7", "else", ":", "arg_18", "=", "arg_7", "print", "(", "u'%s%s%s latest: %s%s%s%s'", "%", "(", "arg_11", ",", "arg_14", ",", "arg_9", ",", "arg_18", ",", "arg_13", ".", "version", ",", "arg_15", ",", "arg_9", ")", ")", "if", "not", "arg_10", ":", "arg_10", "=", "1", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2):\n    ''' print information about outdated modules,\n        return 0 if there is nothing to be done and nonzero otherwise\n    '''\n    if arg_2:\n        arg_3    = colorama.Style.DIM       #pylint: disable=no-member\n        arg_4 = colorama.Style.NORMAL    #pylint: disable=no-member\n        arg_5 = colorama.Style.BRIGHT    #pylint: disable=no-member\n        arg_6 = colorama.Fore.YELLOW     #pylint: disable=no-member\n        arg_7    = colorama.Fore.RED        #pylint: disable=no-member\n        arg_8  = colorama.Fore.GREEN      #pylint: disable=no-member\n        arg_9  = colorama.Style.RESET_ALL #pylint: disable=no-member\n    else:\n        arg_3 = arg_5 = arg_6 = arg_7 = arg_8 = arg_9 = u''\n\n    arg_10 = 0\n\n    # access, , get components, internal\n    from yotta.lib import access\n    from yotta.lib import access_common\n    # sourceparse, , parse version source urls, internal\n    from yotta.lib import sourceparse\n\n    for arg_11, arg_12 in arg_0.items():\n        if arg_12.isTestDependency():\n            continue\n        try:\n            arg_13 = access.latestSuitableVersion(arg_11, '*', registry='modules', quiet=True)\n        except access_common.Unavailable as e:\n            arg_13 = None\n\n        if not arg_12:\n            arg_14 = u' ' + arg_9 + arg_5 + arg_7 + u\"missing\" + arg_9\n        else:\n            arg_14 = arg_3 + u'@%s' % (arg_12.version)\n        if not arg_13:\n            print(u'%s%s%s%s not available from the registry%s' % (arg_7, arg_11, arg_14, arg_4, arg_9))\n            arg_10 = 2\n            continue\n        elif not arg_12 or arg_12.version < arg_13:\n            arg_15 = ''\n            if arg_12:\n                arg_16 = [\n                    x for x in arg_1\n                    if x.name == arg_11 and not\n                       sourceparse.parseSourceURL(x.nonShrinkwrappedVersionReq()).semanticSpecMatches(arg_13)\n                ]\n                arg_17 = [\n                    x for x in arg_1\n                    if x.name == arg_11 and x.isShrinkwrapped() and not\n                       sourceparse.parseSourceURL(x.versionReq()).semanticSpecMatches(arg_13)\n                ]\n                if len(arg_16):\n                    arg_15 = ' (update prevented by specifications: %s)' % (\n                        ', '.join(['%s from %s' % (x.version_req, x.specifying_module) for x in arg_16])\n                    )\n                if len(arg_17):\n                    arg_15 += ' yotta-shrinkwrap.json prevents update'\n                if arg_12.version.major() < arg_13.major():\n                    # major versions being outdated might be deliberate, so not\n                    # that bad:\n                    arg_18 = arg_8\n                elif arg_12.version.minor() < arg_13.minor():\n                    # minor outdated versions is moderately bad\n                    arg_18 = arg_6\n                else:\n                    # patch-outdated versions is really bad, because there should\n                    # be no reason not to update:\n                    arg_18 = arg_7\n            else:\n                arg_18 = arg_7\n            print(u'%s%s%s latest: %s%s%s%s' % (arg_11, arg_14, arg_9, arg_18, arg_13.version, arg_15, arg_9))\n            if not arg_10:\n                arg_10 = 1\n    return arg_10", "path": "yotta/outdated.py", "identifier": "displayOutdated", "docstring": "print information about outdated modules,\n        return 0 if there is nothing to be done and nonzero otherwise", "docstring_tokens": ["print", "information", "about", "outdated", "modules", "return", "0", "if", "there", "is", "nothing", "to", "be", "done", "and", "nonzero", "otherwise"], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 255174}
{"url": "https://github.com/gnosis/gnosis-py/blob/2a9a5d75a375fc9813ac04df133e6910c82f9d49/gnosis/safe/safe_service.py#L550-L573", "sha": "2a9a5d75a375fc9813ac04df133e6910c82f9d49", "docstring_summary": "Estimate tx gas. Use the max of calculation using safe method and web3 if operation == CALL or\n        use just the safe calculation otherwise", "language": "python", "parameters": "(self, safe_address: str, to: str, value: int, data: bytes, operation: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ",", "arg_4", ":", "arg_5", ",", "arg_6", ":", "arg_7", ",", "arg_8", ":", "arg_5", ")", "->", "arg_5", ":", "arg_9", "=", "1000", "arg_10", "=", "35000", "arg_11", "=", "(", "arg_0", ".", "Func_with_safe", "(", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_6", ",", "arg_8", ")", "+", "arg_9", "+", "arg_10", ")", "if", "SafeOperation", "(", "arg_8", ")", "==", "SafeOperation", ".", "CALL", ":", "try", ":", "arg_12", "=", "(", "arg_0", ".", "Func_with_web3", "(", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_6", ")", "+", "arg_9", "+", "arg_10", ")", "except", "ValueError", ":", "arg_12", "=", "0", "return", "max", "(", "arg_11", ",", "arg_12", ")", "else", ":", "return", "arg_11"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2, arg_4: arg_5, arg_6: arg_7, arg_8: arg_5) -> arg_5:\n        \"\"\"\n        Estimate tx gas. Use the max of calculation using safe method and web3 if operation == CALL or\n        use just the safe calculation otherwise\n        \"\"\"\n        # Costs to route through the proxy and nested calls\n        arg_9 = 1000\n        # https://github.com/ethereum/solidity/blob/dfe3193c7382c80f1814247a162663a97c3f5e67/libsolidity/codegen/ExpressionCompiler.cpp#L1764\n        # This was `false` before solc 0.4.21 -> `m_context.evmVersion().canOverchargeGasForCall()`\n        # So gas needed by caller will be around 35k\n        arg_10 = 35000\n        arg_11 = (arg_0.Func_with_safe(arg_1, arg_3, arg_4, arg_6, arg_8)\n                               + arg_9 + arg_10)\n        # We cannot estimate DELEGATECALL (different storage)\n        if SafeOperation(arg_8) == SafeOperation.CALL:\n            try:\n                arg_12 = (arg_0.Func_with_web3(arg_1, arg_3, arg_4, arg_6)\n                                       + arg_9 + arg_10)\n            except ValueError:\n                arg_12 = 0\n            return max(arg_11, arg_12)\n\n        else:\n            return arg_11", "path": "gnosis/safe/safe_service.py", "identifier": "SafeService.estimate_tx_gas", "docstring": "Estimate tx gas. Use the max of calculation using safe method and web3 if operation == CALL or\n        use just the safe calculation otherwise", "docstring_tokens": ["Estimate", "tx", "gas", ".", "Use", "the", "max", "of", "calculation", "using", "safe", "method", "and", "web3", "if", "operation", "==", "CALL", "or", "use", "just", "the", "safe", "calculation", "otherwise"], "nwo": "gnosis/gnosis-py", "score": 0.2804084716934856, "idx": 255175}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L294-L312", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val contains only the given item or items.", "language": "python", "parameters": "(self, *items)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more args must be given'", ")", "else", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "val", ":", "if", "arg_3", "not", "in", "arg_1", ":", "arg_2", ".", "append", "(", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to contain only %s, but did contain %s.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ",", "arg_0", ".", "_fmt_items", "(", "arg_2", ")", ")", ")", "arg_4", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", "not", "in", "arg_0", ".", "val", ":", "arg_4", ".", "append", "(", "arg_3", ")", "if", "arg_4", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to contain only %s, but did not contain %s.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ",", "arg_0", ".", "_fmt_items", "(", "arg_4", ")", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Asserts that val contains only the given item or items.\"\"\"\n        if len(arg_1) == 0:\n            raise ValueError('one or more args must be given')\n        else:\n            arg_2 = []\n            for arg_3 in arg_0.val:\n                if arg_3 not in arg_1:\n                    arg_2.append(arg_3)\n            if arg_2:\n                arg_0._err('Expected <%s> to contain only %s, but did contain %s.' % (arg_0.val, arg_0._fmt_items(arg_1), arg_0._fmt_items(arg_2)))\n\n            arg_4 = []\n            for arg_3 in arg_1:\n                if arg_3 not in arg_0.val:\n                    arg_4.append(arg_3)\n            if arg_4:\n                arg_0._err('Expected <%s> to contain only %s, but did not contain %s.' % (arg_0.val, arg_0._fmt_items(arg_1), arg_0._fmt_items(arg_4)))\n        return arg_0", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.contains_only", "docstring": "Asserts that val contains only the given item or items.", "docstring_tokens": ["Asserts", "that", "val", "contains", "only", "the", "given", "item", "or", "items", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 255176}
{"url": "https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/type.py#L66-L77", "sha": "5a75cf88cf794937711b6850ff2acb07fe005f08", "docstring_summary": "Guesses an appropriate MODS XML genre type.", "language": "python", "parameters": "(self)", "return_statement": "return type2genre.get(tp, tp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'conference'", ":", "'conference publication'", ",", "'book chapter'", ":", "'bibliography'", ",", "'unpublished'", ":", "'article'", "}", "arg_2", "=", "str", "(", "arg_0", ".", "type", ")", ".", "lower", "(", ")", "return", "arg_1", ".", "get", "(", "arg_2", ",", "arg_2", ")"], "function": "def Func(arg_0):\n\t\t\"\"\"\n\t\tGuesses an appropriate MODS XML genre type.\n\t\t\"\"\"\n\n\t\targ_1 = {\n\t\t\t\t'conference': 'conference publication',\n\t\t\t\t'book chapter': 'bibliography',\n\t\t\t\t'unpublished': 'article'\n\t\t\t}\n\t\targ_2 = str(arg_0.type).lower()\n\t\treturn arg_1.get(arg_2, arg_2)", "path": "publications/models/type.py", "identifier": "Type.mods_genre", "docstring": "Guesses an appropriate MODS XML genre type.", "docstring_tokens": ["Guesses", "an", "appropriate", "MODS", "XML", "genre", "type", "."], "nwo": "lucastheis/django-publications", "score": 0.41971037138316925, "idx": 255177}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/vq_vae.py#L389-L400", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns Hugo Larochelle's binary static MNIST tf.data.Dataset.", "language": "python", "parameters": "(directory, split_name)", "return_statement": "return dataset.map(_parser)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "download", "(", "arg_0", ",", "FILE_TEMPLATE", ".", "format", "(", "split", "=", "arg_1", ")", ")", "arg_3", "=", "tf", ".", "data", ".", "TextLineDataset", "(", "arg_2", ")", "arg_4", "=", "lambda", "string", ":", "np", ".", "array", "(", "[", "c", "==", "b\"1\"", "for", "c", "in", "string", ".", "split", "(", ")", "]", ")", "def", "_parser", "(", "arg_5", ")", ":", "arg_6", "=", "tf", ".", "compat", ".", "v1", ".", "py_func", "(", "arg_4", ",", "[", "arg_5", "]", ",", "tf", ".", "bool", ")", "arg_7", "=", "tf", ".", "reshape", "(", "arg_6", ",", "[", "28", ",", "28", ",", "1", "]", ")", "return", "tf", ".", "cast", "(", "arg_7", ",", "dtype", "=", "tf", ".", "float32", ")", ",", "tf", ".", "constant", "(", "0", ",", "tf", ".", "int32", ")", "return", "arg_3", ".", "map", "(", "_parser", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Returns Hugo Larochelle's binary static MNIST tf.data.Dataset.\"\"\"\n  arg_2 = download(arg_0, FILE_TEMPLATE.format(split=arg_1))\n  arg_3 = tf.data.TextLineDataset(arg_2)\n  arg_4 = lambda string: np.array([c == b\"1\" for c in string.split()])\n\n  def _parser(arg_5):\n    arg_6 = tf.compat.v1.py_func(arg_4, [arg_5], tf.bool)\n    arg_7 = tf.reshape(arg_6, [28, 28, 1])\n    return tf.cast(arg_7, dtype=tf.float32), tf.constant(0, tf.int32)\n\n  return arg_3.map(_parser)", "path": "tensorflow_probability/examples/vq_vae.py", "identifier": "load_bernoulli_mnist_dataset", "docstring": "Returns Hugo Larochelle's binary static MNIST tf.data.Dataset.", "docstring_tokens": ["Returns", "Hugo", "Larochelle", "s", "binary", "static", "MNIST", "tf", ".", "data", ".", "Dataset", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255178}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/subnets.py#L454-L477", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Delete a subnet.", "language": "python", "parameters": "(context, id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "\"Func %s for tenant %s\"", "%", "(", "arg_1", ",", "arg_0", ".", "tenant_id", ")", ")", "with", "arg_0", ".", "session", ".", "begin", "(", ")", ":", "arg_2", "=", "db_api", ".", "subnet_find", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "scope", "=", "db_api", ".", "ONE", ")", "if", "not", "arg_2", ":", "raise", "n_exc", ".", "SubnetNotFound", "(", "subnet_id", "=", "arg_1", ")", "if", "not", "arg_0", ".", "is_admin", ":", "if", "STRATEGY", ".", "is_provider_network", "(", "arg_2", ".", "network_id", ")", ":", "if", "arg_2", ".", "tenant_id", "==", "arg_0", ".", "tenant_id", ":", "raise", "n_exc", ".", "NotAuthorized", "(", "subnet_id", "=", "arg_1", ")", "else", ":", "raise", "n_exc", ".", "SubnetNotFound", "(", "subnet_id", "=", "arg_1", ")", "_Func", "(", "arg_0", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Delete a subnet.\n\n    : param context: neutron api request context\n    : param id: UUID representing the subnet to delete.\n    \"\"\"\n    LOG.info(\"Func %s for tenant %s\" % (arg_1, arg_0.tenant_id))\n    with arg_0.session.begin():\n        arg_2 = db_api.subnet_find(arg_0, arg_1=arg_1, scope=db_api.ONE)\n        if not arg_2:\n            raise n_exc.SubnetNotFound(subnet_id=arg_1)\n\n        if not arg_0.is_admin:\n            if STRATEGY.is_provider_network(arg_2.network_id):\n                if arg_2.tenant_id == arg_0.tenant_id:\n                    # A tenant can't delete subnets on provider network\n                    raise n_exc.NotAuthorized(subnet_id=arg_1)\n                else:\n                    # Raise a NotFound here because the foreign tenant\n                    # does not have to know about other tenant's subnet\n                    # existence.\n                    raise n_exc.SubnetNotFound(subnet_id=arg_1)\n\n        _Func(arg_0, arg_2)", "path": "quark/plugin_modules/subnets.py", "identifier": "delete_subnet", "docstring": "Delete a subnet.\n\n    : param context: neutron api request context\n    : param id: UUID representing the subnet to delete.", "docstring_tokens": ["Delete", "a", "subnet", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255179}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/zkstatemanager.py#L522-L542", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "get scheduler location", "language": "python", "parameters": "(self, topologyName, callback=None)", "return_statement": "return ret[\"result\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "False", "arg_4", "=", "{", "\"result\"", ":", "None", "}", "if", "arg_2", ":", "arg_3", "=", "True", "else", ":", "def", "arg_2", "(", "arg_5", ")", ":", "arg_4", "[", "\"result\"", "]", "=", "arg_5", "arg_0", ".", "_Func_with_watch", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_4", "[", "\"result\"", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\" get scheduler location \"\"\"\n    arg_3 = False\n\n    # Temp dict used to return result\n    # if callback is not provided.\n    arg_4 = {\n        \"result\": None\n    }\n    if arg_2:\n      arg_3 = True\n    else:\n      def arg_2(arg_5):\n        \"\"\"\n        Custom callback to get the scheduler location right now.\n        \"\"\"\n        arg_4[\"result\"] = arg_5\n\n    arg_0._Func_with_watch(arg_1, arg_2, arg_3)\n\n    return arg_4[\"result\"]", "path": "heron/statemgrs/src/python/zkstatemanager.py", "identifier": "ZkStateManager.get_scheduler_location", "docstring": "get scheduler location", "docstring_tokens": ["get", "scheduler", "location"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255180}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/embeds.py#L31-L34", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Returns the HTML produced from enclosing each item in\n    `contents` in a tag of type `tagname`", "language": "python", "parameters": "(tagname, contents)", "return_statement": "return u''.join(tag(tagname, item) for item in contents)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "u''", ".", "join", "(", "tag", "(", "arg_0", ",", "arg_2", ")", "for", "arg_2", "in", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns the HTML produced from enclosing each item in\n    `contents` in a tag of type `tagname`\"\"\"\n    return u''.join(tag(arg_0, arg_2) for arg_2 in arg_1)", "path": "dispatch/modules/content/embeds.py", "identifier": "maptag", "docstring": "Returns the HTML produced from enclosing each item in\n    `contents` in a tag of type `tagname`", "docstring_tokens": ["Returns", "the", "HTML", "produced", "from", "enclosing", "each", "item", "in", "contents", "in", "a", "tag", "of", "type", "tagname"], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 255181}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L627-L635", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get repository data", "language": "python", "parameters": "(self)", "return_statement": "return repo", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "'repos'", ",", "arg_0", ".", "owner", ",", "arg_0", ".", "repository", ")", "arg_2", "=", "arg_0", ".", "fetch", "(", "arg_1", ")", "Func", "=", "arg_2", ".", "text", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"Get repository data\"\"\"\n\n        arg_1 = urijoin(arg_0.base_url, 'repos', arg_0.owner, arg_0.repository)\n\n        arg_2 = arg_0.fetch(arg_1)\n        Func = arg_2.text\n\n        return Func", "path": "perceval/backends/core/github.py", "identifier": "GitHubClient.repo", "docstring": "Get repository data", "docstring_tokens": ["Get", "repository", "data"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255182}
{"url": "https://github.com/welbornprod/fmtblock/blob/92a5529235d557170ed21e058e3c5995197facbe/fmtblock/escapecodes.py#L110-L114", "sha": "92a5529235d557170ed21e058e3c5995197facbe", "docstring_summary": "Strip all color codes from a string.\n        Returns empty string for \"falsey\" inputs.", "language": "python", "parameters": "(s: Any)", "return_statement": "return codepat.sub('', str(s) if (s or (s == 0)) else '')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "str", ":", "return", "codepat", ".", "sub", "(", "''", ",", "str", "(", "arg_0", ")", "if", "(", "arg_0", "or", "(", "arg_0", "==", "0", ")", ")", "else", "''", ")"], "function": "def Func(arg_0: arg_1) -> str:\n    \"\"\" Strip all color codes from a string.\n        Returns empty string for \"falsey\" inputs.\n    \"\"\"\n    return codepat.sub('', str(arg_0) if (arg_0 or (arg_0 == 0)) else '')", "path": "fmtblock/escapecodes.py", "identifier": "strip_codes", "docstring": "Strip all color codes from a string.\n        Returns empty string for \"falsey\" inputs.", "docstring_tokens": ["Strip", "all", "color", "codes", "from", "a", "string", ".", "Returns", "empty", "string", "for", "falsey", "inputs", "."], "nwo": "welbornprod/fmtblock", "score": 0.0, "idx": 255183}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/download.py#L425-L430", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Returns true if the name looks like a URL", "language": "python", "parameters": "(name)", "return_statement": "return scheme in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "':'", "not", "in", "arg_0", ":", "return", "False", "arg_1", "=", "arg_0", ".", "split", "(", "':'", ",", "1", ")", "[", "0", "]", ".", "lower", "(", ")", "return", "arg_1", "in", "[", "'http'", ",", "'https'", ",", "'file'", ",", "'ftp'", "]", "+", "vcs", ".", "all_schemes"], "function": "def Func(arg_0):\n    \"\"\"Returns true if the name looks like a URL\"\"\"\n    if ':' not in arg_0:\n        return False\n    arg_1 = arg_0.split(':', 1)[0].lower()\n    return arg_1 in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/download.py", "identifier": "is_url", "docstring": "Returns true if the name looks like a URL", "docstring_tokens": ["Returns", "true", "if", "the", "name", "looks", "like", "a", "URL"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255184}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/generic/context.py#L32-L38", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Create copy of this context with increased indent", "language": "python", "parameters": "(self, indent=1)", "return_statement": "return ctx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "arg_2", "=", "copy", "(", "arg_0", ")", "arg_2", ".", "indent", "+=", "arg_1", "return", "arg_2"], "function": "def Func(arg_0, arg_1=1):\n        \"\"\"\n        Create copy of this context with increased indent\n        \"\"\"\n        arg_2 = copy(arg_0)\n        arg_2.indent += arg_1\n        return arg_2", "path": "hwt/serializer/generic/context.py", "identifier": "SerializerCtx.withIndent", "docstring": "Create copy of this context with increased indent", "docstring_tokens": ["Create", "copy", "of", "this", "context", "with", "increased", "indent"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 255185}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/recipe.py#L455-L485", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Main method to run the automatic pipeline creation", "language": "python", "parameters": "(self, tasks)", "return_statement": "return self.pipeline_string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "forks", "=", "arg_0", ".", "define_pipeline_string", "(", "arg_0", ".", "process_descriptions", ",", "arg_1", ",", "True", ",", "True", ",", "arg_0", ".", "count_forks", ",", "arg_1", ",", "arg_0", ".", "forks", ")", "arg_0", ".", "pipeline_string", "=", "arg_0", ".", "build_pipeline_string", "(", "arg_0", ".", "forks", ")", "return", "arg_0", ".", "pipeline_string"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Main method to run the automatic pipeline creation\n\n        This method aggregates the functions required to build the pipeline\n        string that can be used as input for the workflow generator.\n\n        Parameters\n        ----------\n        tasks : str\n            A string with the space separated tasks to be included in the\n            pipeline\n\n        Returns\n        -------\n        str : String with the pipeline definition used as input for\n        parse_pipeline\n        \"\"\"\n\n        arg_0.forks = arg_0.define_pipeline_string(\n            arg_0.process_descriptions,\n            arg_1,\n            True,\n            True,\n            arg_0.count_forks,\n            arg_1,\n            arg_0.forks\n        )\n\n        arg_0.pipeline_string = arg_0.build_pipeline_string(arg_0.forks)\n\n        return arg_0.pipeline_string", "path": "flowcraft/generator/recipe.py", "identifier": "InnuendoRecipe.run_auto_pipeline", "docstring": "Main method to run the automatic pipeline creation\n\n        This method aggregates the functions required to build the pipeline\n        string that can be used as input for the workflow generator.\n\n        Parameters\n        ----------\n        tasks : str\n            A string with the space separated tasks to be included in the\n            pipeline\n\n        Returns\n        -------\n        str : String with the pipeline definition used as input for\n        parse_pipeline", "docstring_tokens": ["Main", "method", "to", "run", "the", "automatic", "pipeline", "creation"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 255186}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/writer.py#L43-L53", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "write a package diagram", "language": "python", "parameters": "(self, diagram)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "sorted", "(", "arg_1", ".", "modules", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", ".", "title", ")", ")", ":", "arg_0", ".", "printer", ".", "emit_node", "(", "arg_2", ",", "label", "=", "arg_0", ".", "get_title", "(", "arg_3", ")", ",", "shape", "=", "\"box\"", ")", "arg_3", ".", "fig_id", "=", "arg_2", "for", "arg_5", "in", "arg_1", ".", "get_relationships", "(", "\"depends\"", ")", ":", "arg_0", ".", "printer", ".", "emit_edge", "(", "arg_5", ".", "from_object", ".", "fig_id", ",", "arg_5", ".", "to_object", ".", "fig_id", ",", "**", "arg_0", ".", "pkg_edges", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"write a package diagram\"\"\"\n        # sorted to get predictable (hence testable) results\n        for arg_2, arg_3 in enumerate(sorted(arg_1.modules(), key=lambda x: x.title)):\n            arg_0.printer.emit_node(arg_2, label=arg_0.get_title(arg_3), shape=\"box\")\n            arg_3.fig_id = arg_2\n        # package dependencies\n        for arg_5 in arg_1.get_relationships(\"depends\"):\n            arg_0.printer.emit_edge(\n                arg_5.from_object.fig_id, arg_5.to_object.fig_id, **arg_0.pkg_edges\n            )", "path": "pylint/pyreverse/writer.py", "identifier": "DiagramWriter.write_packages", "docstring": "write a package diagram", "docstring_tokens": ["write", "a", "package", "diagram"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255187}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L386-L394", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "REBINDING state.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "'In state: Func'", ")", "arg_0", ".", "current_state", "=", "STATE_Func", "if", "arg_0", ".", "script", "is", "not", "None", ":", "arg_0", ".", "script", ".", "script_init", "(", "arg_0", ".", "client", ".", "lease", ",", "arg_0", ".", "current_state", ")", "arg_0", ".", "script", ".", "script_go", "(", ")", "else", ":", "set_net", "(", "arg_0", ".", "client", ".", "lease", ")"], "function": "def Func(arg_0):\n        \"\"\"Func state.\"\"\"\n        logger.debug('In state: Func')\n        arg_0.current_state = STATE_Func\n        if arg_0.script is not None:\n            arg_0.script.script_init(arg_0.client.lease, arg_0.current_state)\n            arg_0.script.script_go()\n        else:\n            set_net(arg_0.client.lease)", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.REBINDING", "docstring": "REBINDING state.", "docstring_tokens": ["REBINDING", "state", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 255188}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/graph.py#L1047-L1056", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Sets the connection string for all edges.", "language": "python", "parameters": "(self, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ":", "arg_2", "=", "\"->\"", "else", ":", "arg_2", "=", "\"--\"", "for", "arg_3", "in", "[", "e", "for", "g", "in", "arg_0", ".", "all_graphs", "for", "e", "in", "g", ".", "edges", "]", ":", "arg_3", ".", "conn", "=", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Sets the connection string for all edges.\n        \"\"\"\n        if arg_1:\n            arg_2 = \"->\"\n        else:\n            arg_2 = \"--\"\n\n        for arg_3 in [e for g in arg_0.all_graphs for e in g.edges]:\n            arg_3.conn = arg_2", "path": "godot/graph.py", "identifier": "Graph._directed_changed", "docstring": "Sets the connection string for all edges.", "docstring_tokens": ["Sets", "the", "connection", "string", "for", "all", "edges", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 255189}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L598-L604", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets file copyright text.", "language": "python", "parameters": "(self, f_term, predicate)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "for", "arg_3", ",", "arg_3", ",", "arg_4", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_2", ",", "None", ")", ")", ":", "arg_0", ".", "builder", ".", "set_file_copyright", "(", "arg_0", ".", "doc", ",", "six", ".", "text_type", "(", "arg_4", ")", ")", "except", "CardinalityError", ":", "arg_0", ".", "more_than_one_error", "(", "'file copyright text'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets file copyright text.\"\"\"\n        try:\n            for arg_3, arg_3, arg_4 in arg_0.graph.triples((arg_1, arg_2, None)):\n                arg_0.builder.set_file_copyright(arg_0.doc, six.text_type(arg_4))\n        except CardinalityError:\n            arg_0.more_than_one_error('file copyright text')", "path": "spdx/parsers/rdf.py", "identifier": "FileParser.p_file_cr_text", "docstring": "Sets file copyright text.", "docstring_tokens": ["Sets", "file", "copyright", "text", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 255190}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/logic.py#L357-L401", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return True if the propositional logic expression is true in the model,\n    and False if it is false. If the model does not specify the value for\n    every proposition, this may return None to indicate 'not obvious';\n    this may happen even when the expression is tautological.", "language": "python", "parameters": "(exp, model={})", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "op", ",", "arg_0", ".", "args", "if", "arg_0", "==", "TRUE", ":", "return", "True", "elif", "arg_0", "==", "FALSE", ":", "return", "False", "elif", "is_prop_symbol", "(", "arg_2", ")", ":", "return", "arg_1", ".", "get", "(", "arg_0", ")", "elif", "arg_2", "==", "'~'", ":", "arg_4", "=", "Func", "(", "arg_3", "[", "0", "]", ",", "arg_1", ")", "if", "arg_4", "is", "None", ":", "return", "None", "else", ":", "return", "not", "arg_4", "elif", "arg_2", "==", "'|'", ":", "arg_5", "=", "False", "for", "arg_6", "in", "arg_3", ":", "arg_4", "=", "Func", "(", "arg_6", ",", "arg_1", ")", "if", "arg_4", "is", "True", ":", "return", "True", "if", "arg_4", "is", "None", ":", "arg_5", "=", "None", "return", "arg_5", "elif", "arg_2", "==", "'&'", ":", "arg_5", "=", "True", "for", "arg_6", "in", "arg_3", ":", "arg_4", "=", "Func", "(", "arg_6", ",", "arg_1", ")", "if", "arg_4", "is", "False", ":", "return", "False", "if", "arg_4", "is", "None", ":", "arg_5", "=", "None", "return", "arg_5", "arg_4", ",", "arg_7", "=", "arg_3", "if", "arg_2", "==", "'>>'", ":", "return", "Func", "(", "~", "arg_4", "|", "arg_7", ",", "arg_1", ")", "elif", "arg_2", "==", "'<<'", ":", "return", "Func", "(", "arg_4", "|", "~", "arg_7", ",", "arg_1", ")", "arg_8", "=", "Func", "(", "arg_4", ",", "arg_1", ")", "if", "arg_8", "is", "None", ":", "return", "None", "arg_9", "=", "Func", "(", "arg_7", ",", "arg_1", ")", "if", "arg_9", "is", "None", ":", "return", "None", "if", "arg_2", "==", "'<=>'", ":", "return", "arg_8", "==", "arg_9", "elif", "arg_2", "==", "'^'", ":", "return", "arg_8", "!=", "arg_9", "else", ":", "raise", "ValueError", ",", "\"illegal operator in logic expression\"", "+", "str", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1={}):\n    \"\"\"Return True if the propositional logic expression is true in the model,\n    and False if it is false. If the model does not specify the value for\n    every proposition, this may return None to indicate 'not obvious';\n    this may happen even when the expression is tautological.\"\"\"\n    arg_2, arg_3 = arg_0.op, arg_0.args\n    if arg_0 == TRUE:\n        return True\n    elif arg_0 == FALSE:\n        return False\n    elif is_prop_symbol(arg_2):\n        return arg_1.get(arg_0)\n    elif arg_2 == '~':\n        arg_4 = Func(arg_3[0], arg_1)\n        if arg_4 is None: return None\n        else: return not arg_4\n    elif arg_2 == '|':\n        arg_5 = False\n        for arg_6 in arg_3:\n            arg_4 = Func(arg_6, arg_1)\n            if arg_4 is True: return True\n            if arg_4 is None: arg_5 = None\n        return arg_5\n    elif arg_2 == '&':\n        arg_5 = True\n        for arg_6 in arg_3:\n            arg_4 = Func(arg_6, arg_1)\n            if arg_4 is False: return False\n            if arg_4 is None: arg_5 = None\n        return arg_5\n    arg_4, arg_7 = arg_3\n    if arg_2 == '>>':\n        return Func(~arg_4 | arg_7, arg_1)\n    elif arg_2 == '<<':\n        return Func(arg_4 | ~arg_7, arg_1)\n    arg_8 = Func(arg_4, arg_1)\n    if arg_8 is None: return None\n    arg_9 = Func(arg_7, arg_1)\n    if arg_9 is None: return None\n    if arg_2 == '<=>':\n        return arg_8 == arg_9\n    elif arg_2 == '^':\n        return arg_8 != arg_9\n    else:\n        raise ValueError, \"illegal operator in logic expression\" + str(arg_0)", "path": "aima/logic.py", "identifier": "pl_true", "docstring": "Return True if the propositional logic expression is true in the model,\n    and False if it is false. If the model does not specify the value for\n    every proposition, this may return None to indicate 'not obvious';\n    this may happen even when the expression is tautological.", "docstring_tokens": ["Return", "True", "if", "the", "propositional", "logic", "expression", "is", "true", "in", "the", "model", "and", "False", "if", "it", "is", "false", ".", "If", "the", "model", "does", "not", "specify", "the", "value", "for", "every", "proposition", "this", "may", "return", "None", "to", "indicate", "not", "obvious", ";", "this", "may", "happen", "even", "when", "the", "expression", "is", "tautological", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 255191}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/plugin/tree_editor.py#L80-L84", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handle the file path changing.", "language": "python", "parameters": "(self, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "name", "=", "basename", "(", "arg_1", ")", "arg_0", ".", "graph", "=", "arg_0", ".", "editor_input", ".", "load", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handle the file path changing.\n        \"\"\"\n        arg_0.name = basename(arg_1)\n        arg_0.graph = arg_0.editor_input.load()", "path": "godot/plugin/tree_editor.py", "identifier": "TreeEditor.on_path", "docstring": "Handle the file path changing.", "docstring_tokens": ["Handle", "the", "file", "path", "changing", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 255192}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L394-L403", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Update self._type_to_spans according to the added length.", "language": "python", "parameters": "(self, index: int, length: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ")", "->", "None", ":", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_span", "for", "arg_6", "in", "arg_0", ".", "_type_to_spans", ".", "values", "(", ")", ":", "for", "arg_7", "in", "arg_6", ":", "if", "arg_1", "<", "arg_7", "[", "1", "]", "or", "arg_7", "[", "1", "]", "==", "arg_1", "==", "arg_5", ":", "arg_7", "[", "1", "]", "+=", "arg_3", "if", "arg_1", "<", "arg_7", "[", "0", "]", "or", "arg_7", "[", "0", "]", "==", "arg_1", "!=", "arg_4", ":", "arg_7", "[", "0", "]", "+=", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2) -> None:\n        \"\"\"Update self._type_to_spans according to the added length.\"\"\"\n        arg_4, arg_5 = arg_0._span\n        for arg_6 in arg_0._type_to_spans.values():\n            for arg_7 in arg_6:\n                if arg_1 < arg_7[1] or arg_7[1] == arg_1 == arg_5:\n                    arg_7[1] += arg_3\n                    # index is before s, or at s but not on self_span\n                    if arg_1 < arg_7[0] or arg_7[0] == arg_1 != arg_4:\n                        arg_7[0] += arg_3", "path": "wikitextparser/_wikitext.py", "identifier": "WikiText._insert_update", "docstring": "Update self._type_to_spans according to the added length.", "docstring_tokens": ["Update", "self", ".", "_type_to_spans", "according", "to", "the", "added", "length", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 255193}
{"url": "https://github.com/gtaylor/evarify/blob/37cec29373c820eda96939633e2067d55598915b/evarify/evar.py#L23-L49", "sha": "37cec29373c820eda96939633e2067d55598915b", "docstring_summary": "Go through the env var map, transferring the values to this object\n        as attributes.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "evar_defs", ".", "items", "(", ")", ":", "if", "arg_2", ".", "is_required", "and", "arg_2", ".", "name", "not", "in", "os", ".", "environ", ":", "raise", "RuntimeError", "(", "(", "\"Missing required environment variable: {evar_name}\\n\"", "\"{help_txt}\"", ")", ".", "format", "(", "evar_name", "=", "arg_2", ".", "name", ",", "help_txt", "=", "arg_2", ".", "help_txt", ")", ")", "if", "arg_2", ".", "name", "in", "os", ".", "environ", ":", "arg_0", "[", "arg_1", "]", "=", "os", ".", "environ", ".", "get", "(", "arg_2", ".", "name", ")", "else", ":", "arg_0", "[", "arg_1", "]", "=", "arg_2", ".", "default_val", "for", "arg_3", "in", "arg_2", ".", "filters", ":", "arg_4", "=", "arg_0", ".", "get", "(", "arg_1", ")", "arg_5", "=", "arg_3", "(", "arg_4", ",", "arg_2", ")", "arg_0", "[", "arg_1", "]", "=", "arg_5", "arg_0", ".", "_filter_all", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Go through the env var map, transferring the values to this object\n        as attributes.\n\n        :raises: RuntimeError if a required env var isn't defined.\n        \"\"\"\n\n        for arg_1, arg_2 in arg_0.evar_defs.items():\n            if arg_2.is_required and arg_2.name not in os.environ:\n                raise RuntimeError((\n                    \"Missing required environment variable: {evar_name}\\n\"\n                    \"{help_txt}\"\n                ).format(evar_name=arg_2.name, help_txt=arg_2.help_txt))\n            # Env var is present. Transfer its value over.\n            if arg_2.name in os.environ:\n                arg_0[arg_1] = os.environ.get(arg_2.name)\n            else:\n                arg_0[arg_1] = arg_2.default_val\n            # Perform any validations or transformations.\n            for arg_3 in arg_2.filters:\n                arg_4 = arg_0.get(arg_1)\n                arg_5 = arg_3(arg_4, arg_2)\n                arg_0[arg_1] = arg_5\n        # This is the top-level filter that is often useful for checking\n        # the values of related env vars (instead of individual validation).\n        arg_0._filter_all()", "path": "evarify/evar.py", "identifier": "ConfigStore.load_values", "docstring": "Go through the env var map, transferring the values to this object\n        as attributes.\n\n        :raises: RuntimeError if a required env var isn't defined.", "docstring_tokens": ["Go", "through", "the", "env", "var", "map", "transferring", "the", "values", "to", "this", "object", "as", "attributes", "."], "nwo": "gtaylor/evarify", "score": 0.0, "idx": 255194}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/transformations.py#L59-L70", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Apply a named transformation to a set of foci.", "language": "python", "parameters": "(self, name, foci)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "in", "arg_0", ".", "transformations", ":", "return", "transform", "(", "arg_2", ",", "arg_0", ".", "transformations", "[", "arg_1", "]", ")", "else", ":", "logger", ".", "info", "(", "\"No transformation named '%s' found; coordinates left \"", "\"untransformed.\"", "%", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Apply a named transformation to a set of foci.\n\n        If the named transformation doesn't exist, return foci untransformed.\n        \"\"\"\n        if arg_1 in arg_0.transformations:\n            return transform(arg_2, arg_0.transformations[arg_1])\n        else:\n            logger.info(\n                \"No transformation named '%s' found; coordinates left \"\n                \"untransformed.\" % arg_1)\n            return arg_2", "path": "neurosynth/base/transformations.py", "identifier": "Transformer.apply", "docstring": "Apply a named transformation to a set of foci.\n\n        If the named transformation doesn't exist, return foci untransformed.", "docstring_tokens": ["Apply", "a", "named", "transformation", "to", "a", "set", "of", "foci", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 255195}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L2792-L2878", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores the trajectory to disk and recursively all data in the tree.", "language": "python", "parameters": "(self, only_init=False, store_data=pypetconstants.STORE_DATA,\n                max_depth=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "arg_3", ".", "STORE_DATA", ",", "arg_5", "=", "None", ")", ":", "if", "arg_0", ".", "_is_run", ":", "if", "arg_0", ".", "_new_nodes", "or", "arg_0", ".", "_new_links", ":", "arg_0", ".", "_storage_service", ".", "store", "(", "arg_3", ".", "SINGLE_RUN", ",", "arg_0", ",", "trajectory_name", "=", "arg_0", ".", "v_name", ",", "recursive", "=", "not", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ")", "else", ":", "arg_0", ".", "_storage_service", ".", "store", "(", "arg_3", ".", "TRAJECTORY", ",", "arg_0", ",", "trajectory_name", "=", "arg_0", ".", "v_name", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ")", "arg_0", ".", "_stored", "=", "True"], "function": "def Func(arg_0, arg_1=False, arg_2=arg_3.STORE_DATA,\n                arg_5=None):\n        \"\"\" Stores the trajectory to disk and recursively all data in the tree.\n\n        :param only_init:\n\n            If you just want to initialise the store. If yes, only meta information about\n            the trajectory is stored and none of the groups/leaves within the trajectory.\n            Alternatively, you can pass `recursive=False`.\n\n        :param store_data:\n\n            Only considered if ``only_init=False``. Choose of the following:\n\n                * :const:`pypet.pypetconstants.STORE_NOTHING`: (0)\n\n                    Nothing is store.\n\n                * :const:`pypet.pypetconstants.STORE_DATA_SKIPPING`: (1)\n\n                    Speedy version of normal ``STORE_DATA`` will entirely skip groups\n                    (but not their children) and leaves if they have been stored before.\n                    No new data is added in this case.\n\n                * :const:`pypet.pypetconstants.STORE_DATA`: (2)\n\n                    Stores every group and leave node. If they contain data that is not yet stored\n                    to disk it is added.\n\n                * :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)\n\n                    Stores all groups and leave nodes and will delete all data on disk\n                    and overwrite it with the current data in RAM.\n\n                    **NOT RECOMMENDED**! Overwriting data on disk fragments the HDF5 file and\n                    yields badly compressed large files. Better stick to the concept\n                    write once and read many!\n\n\n        If you use the HDF5 Storage Service usually (STORE_DATA (2)) only novel data\n        is stored to disk.\n        If you have results that have been stored to disk before only new data items are added and\n        already present data is NOT overwritten.\n\n        Overwriting (OVERWRITE_DATA (3)) existing data with the HDF5 storage service\n        is not recommended due to fragmentation of the HDF5 file. Better stick to the concept\n        write once, but read often.\n\n        If you want to store individual parameters or results, you might want to\n        take a look at :func:`~pypet.Trajectory.Func_items`.\n        To store whole subtrees of your trajectory check out\n        :func:`~pypet.naturalnaming.NNGroupNode.Func_child`.\n        Note both functions require that your trajectory was stored to disk with `Func`\n        at least once before.\n\n\n        **ATTENTION**: Calling `Func` during a single run the behavior is different.\n\n        To avoid re-storing the full trajectory in every single run, which is redundant,\n        only sub-trees of the trajectory are really stored.\n\n        The storage serivce looks for new data that is added below groups called `run_XXXXXXXXXX`\n        and stores it where `XXXXXXXXX` is the index of this run. The `only_init` parameter is\n        ignored in this case. You can avoid this behavior by using the argument from below.\n\n        :param max_depth:\n\n            Maximum depth to store tree (inclusive). During single runs `max_depth` is also counted\n            from root.\n\n\n        \"\"\"\n        if arg_0._is_run:\n            if arg_0._new_nodes or arg_0._new_links:\n                arg_0._storage_service.store(arg_3.SINGLE_RUN, arg_0,\n                                        trajectory_name=arg_0.v_name,\n                                        recursive=not arg_1,\n                                        arg_2=arg_2,\n                                        arg_5=arg_5)\n        else:\n            arg_0._storage_service.store(arg_3.TRAJECTORY, arg_0,\n                                        trajectory_name=arg_0.v_name,\n                                        arg_1=arg_1,\n                                        arg_2=arg_2,\n                                        arg_5=arg_5)\n\n            arg_0._stored = True", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_store", "docstring": "Stores the trajectory to disk and recursively all data in the tree.\n\n        :param only_init:\n\n            If you just want to initialise the store. If yes, only meta information about\n            the trajectory is stored and none of the groups/leaves within the trajectory.\n            Alternatively, you can pass `recursive=False`.\n\n        :param store_data:\n\n            Only considered if ``only_init=False``. Choose of the following:\n\n                * :const:`pypet.pypetconstants.STORE_NOTHING`: (0)\n\n                    Nothing is store.\n\n                * :const:`pypet.pypetconstants.STORE_DATA_SKIPPING`: (1)\n\n                    Speedy version of normal ``STORE_DATA`` will entirely skip groups\n                    (but not their children) and leaves if they have been stored before.\n                    No new data is added in this case.\n\n                * :const:`pypet.pypetconstants.STORE_DATA`: (2)\n\n                    Stores every group and leave node. If they contain data that is not yet stored\n                    to disk it is added.\n\n                * :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)\n\n                    Stores all groups and leave nodes and will delete all data on disk\n                    and overwrite it with the current data in RAM.\n\n                    **NOT RECOMMENDED**! Overwriting data on disk fragments the HDF5 file and\n                    yields badly compressed large files. Better stick to the concept\n                    write once and read many!\n\n\n        If you use the HDF5 Storage Service usually (STORE_DATA (2)) only novel data\n        is stored to disk.\n        If you have results that have been stored to disk before only new data items are added and\n        already present data is NOT overwritten.\n\n        Overwriting (OVERWRITE_DATA (3)) existing data with the HDF5 storage service\n        is not recommended due to fragmentation of the HDF5 file. Better stick to the concept\n        write once, but read often.\n\n        If you want to store individual parameters or results, you might want to\n        take a look at :func:`~pypet.Trajectory.f_store_items`.\n        To store whole subtrees of your trajectory check out\n        :func:`~pypet.naturalnaming.NNGroupNode.f_store_child`.\n        Note both functions require that your trajectory was stored to disk with `f_store`\n        at least once before.\n\n\n        **ATTENTION**: Calling `f_store` during a single run the behavior is different.\n\n        To avoid re-storing the full trajectory in every single run, which is redundant,\n        only sub-trees of the trajectory are really stored.\n\n        The storage serivce looks for new data that is added below groups called `run_XXXXXXXXXX`\n        and stores it where `XXXXXXXXX` is the index of this run. The `only_init` parameter is\n        ignored in this case. You can avoid this behavior by using the argument from below.\n\n        :param max_depth:\n\n            Maximum depth to store tree (inclusive). During single runs `max_depth` is also counted\n            from root.", "docstring_tokens": ["Stores", "the", "trajectory", "to", "disk", "and", "recursively", "all", "data", "in", "the", "tree", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255196}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L90-L94", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Import external dict to internal dict", "language": "python", "parameters": "(self, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "arg_0", ".", "set_parm", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Import external dict to internal dict\"\"\"\n\n        for arg_2, arg_3 in arg_1.items():\n            arg_0.set_parm(arg_2, arg_3)", "path": "modules/cij/fio.py", "identifier": "Job.import_parms", "docstring": "Import external dict to internal dict", "docstring_tokens": ["Import", "external", "dict", "to", "internal", "dict"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 255197}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/adapter/__init__.py#L483-L510", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Sets the response that the adapter will return for the specified\n        command.", "language": "python", "parameters": "(self, command, response)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "responses", ":", "arg_0", ".", "responses", "[", "arg_1", "]", "=", "deque", "(", ")", "arg_0", ".", "responses", "[", "arg_1", "]", ".", "append", "(", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n        # type: (Text, dict) -> MockAdapter\n        \"\"\"\n        Sets the response that the adapter will return for the specified\n        command.\n\n        You can seed multiple responses per command; the adapter will\n        put them into a FIFO queue.  When a request comes in, the\n        adapter will pop the corresponding response off of the queue.\n\n        Example:\n\n        .. code-block:: python\n\n            adapter.Func('sayHello', {'message': 'Hi!'})\n            adapter.Func('sayHello', {'message': 'Hello!'})\n\n            adapter.send_request({'command': 'sayHello'})\n            # {'message': 'Hi!'}\n\n            adapter.send_request({'command': 'sayHello'})\n            # {'message': 'Hello!'}\n        \"\"\"\n        if arg_1 not in arg_0.responses:\n            arg_0.responses[arg_1] = deque()\n\n        arg_0.responses[arg_1].append(arg_2)\n        return arg_0", "path": "iota/adapter/__init__.py", "identifier": "MockAdapter.seed_response", "docstring": "Sets the response that the adapter will return for the specified\n        command.\n\n        You can seed multiple responses per command; the adapter will\n        put them into a FIFO queue.  When a request comes in, the\n        adapter will pop the corresponding response off of the queue.\n\n        Example:\n\n        .. code-block:: python\n\n            adapter.seed_response('sayHello', {'message': 'Hi!'})\n            adapter.seed_response('sayHello', {'message': 'Hello!'})\n\n            adapter.send_request({'command': 'sayHello'})\n            # {'message': 'Hi!'}\n\n            adapter.send_request({'command': 'sayHello'})\n            # {'message': 'Hello!'}", "docstring_tokens": ["Sets", "the", "response", "that", "the", "adapter", "will", "return", "for", "the", "specified", "command", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 255198}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py#L484-L507", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "This operation gets rollup data for Service Bus metrics notification hub.\n        Rollup data includes the time granularity for the telemetry aggregation as well as\n        the retention settings for each time granularity.", "language": "python", "parameters": "(self, name, hub_name, metric)", "return_statement": "return _MinidomXmlToObject.convert_response_to_feeds(\n            response,\n            partial(\n                _ServiceBusManagementXmlSerializer.xml_to_metrics,\n                object_type=MetricRollups\n            )\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_get_get_metrics_rollup_hub_path", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "None", ")", "return", "_MinidomXmlToObject", ".", "convert_response_to_feeds", "(", "arg_4", ",", "partial", "(", "_ServiceBusManagementXmlSerializer", ".", "xml_to_metrics", ",", "object_type", "=", "MetricRollups", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''\n        This operation gets rollup data for Service Bus metrics notification hub.\n        Rollup data includes the time granularity for the telemetry aggregation as well as\n        the retention settings for each time granularity.\n\n        name:\n            Name of the service bus namespace.\n        hub_name:\n            Name of the service bus notification hub in this namespace.\n        metric:\n            name of a supported metric\n        '''\n        arg_4 = arg_0._perform_get(\n            arg_0._get_get_metrics_rollup_hub_path(arg_1, arg_2, arg_3),\n            None)\n\n        return _MinidomXmlToObject.convert_response_to_feeds(\n            arg_4,\n            partial(\n                _ServiceBusManagementXmlSerializer.xml_to_metrics,\n                object_type=MetricRollups\n            )\n        )", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py", "identifier": "ServiceBusManagementService.get_metrics_rollups_notification_hub", "docstring": "This operation gets rollup data for Service Bus metrics notification hub.\n        Rollup data includes the time granularity for the telemetry aggregation as well as\n        the retention settings for each time granularity.\n\n        name:\n            Name of the service bus namespace.\n        hub_name:\n            Name of the service bus notification hub in this namespace.\n        metric:\n            name of a supported metric", "docstring_tokens": ["This", "operation", "gets", "rollup", "data", "for", "Service", "Bus", "metrics", "notification", "hub", ".", "Rollup", "data", "includes", "the", "time", "granularity", "for", "the", "telemetry", "aggregation", "as", "well", "as", "the", "retention", "settings", "for", "each", "time", "granularity", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255199}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L241-L307", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Upload an image that can be later attached to a chat message.", "language": "python", "parameters": "(self, image_file, filename=None, *,\n                           return_uploaded_image=False)", "return_statement": "return result if return_uploaded_image else result.image_id", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "*", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_2", "or", "os", ".", "path", ".", "basename", "(", "arg_1", ".", "name", ")", "arg_5", "=", "arg_1", ".", "read", "(", ")", "arg_6", "=", "await", "arg_0", ".", "_base_request", "(", "IMAGE_UPLOAD_URL", ",", "'application/x-www-form-urlencoded;charset=UTF-8'", ",", "'json'", ",", "json", ".", "dumps", "(", "{", "\"protocolVersion\"", ":", "\"0.8\"", ",", "\"createSessionRequest\"", ":", "{", "\"fields\"", ":", "[", "{", "\"external\"", ":", "{", "\"name\"", ":", "\"file\"", ",", "\"filename\"", ":", "arg_4", ",", "\"put\"", ":", "{", "}", ",", "\"size\"", ":", "len", "(", "arg_5", ")", "}", "}", "]", "}", "}", ")", ")", "try", ":", "arg_7", "=", "arg_0", ".", "_get_upload_session_status", "(", "arg_6", ")", "[", "'externalFieldTransfers'", "]", "[", "0", "]", "[", "'putInfo'", "]", "[", "'url'", "]", "except", "KeyError", ":", "raise", "exceptions", ".", "NetworkError", "(", "'image upload failed: can not acquire an upload url'", ")", "arg_6", "=", "await", "arg_0", ".", "_base_request", "(", "arg_7", ",", "'application/octet-stream'", ",", "'json'", ",", "arg_5", ")", "try", ":", "arg_8", "=", "(", "arg_0", ".", "_get_upload_session_status", "(", "arg_6", ")", "[", "'additionalInfo'", "]", "[", "'uploader_service.GoogleRupioAdditionalInfo'", "]", "[", "'completionInfo'", "]", "[", "'customerSpecificInfo'", "]", ")", "arg_9", "=", "arg_8", "[", "'photoid'", "]", "arg_10", "=", "arg_8", "[", "'url'", "]", "except", "KeyError", ":", "raise", "exceptions", ".", "NetworkError", "(", "'image upload failed: can not fetch upload info'", ")", "arg_11", "=", "UploadedImage", "(", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")", "return", "arg_11", "if", "arg_3", "else", "arg_11", ".", "image_id"], "function": "async def Func(arg_0, arg_1, arg_2=None, *,\n                           arg_3=False):\n        \"\"\"Upload an image that can be later attached to a chat message.\n\n        Args:\n            image_file: A file-like object containing an image.\n            filename (str): (optional) Custom name for the uploaded file.\n            return_uploaded_image (bool): (optional) If True, return\n                :class:`.UploadedImage` instead of image ID. Defaults to False.\n\n        Raises:\n            hangups.NetworkError: If the upload request failed.\n\n        Returns:\n            :class:`.UploadedImage` instance, or ID of the uploaded image.\n        \"\"\"\n        arg_4 = arg_2 or os.path.basename(arg_1.name)\n        arg_5 = arg_1.read()\n\n        # request an upload URL\n        arg_6 = await arg_0._base_request(\n            IMAGE_UPLOAD_URL,\n            'application/x-www-form-urlencoded;charset=UTF-8', 'json',\n            json.dumps({\n                \"protocolVersion\": \"0.8\",\n                \"createSessionRequest\": {\n                    \"fields\": [{\n                        \"external\": {\n                            \"name\": \"file\",\n                            \"filename\": arg_4,\n                            \"put\": {},\n                            \"size\": len(arg_5)\n                        }\n                    }]\n                }\n            })\n        )\n\n        try:\n            arg_7 = arg_0._get_upload_session_status(arg_6)[\n                'externalFieldTransfers'\n            ][0]['putInfo']['url']\n        except KeyError:\n            raise exceptions.NetworkError(\n                'image upload failed: can not acquire an upload url'\n            )\n\n        # upload the image data using the upload_url to get the upload info\n        arg_6 = await arg_0._base_request(\n            arg_7, 'application/octet-stream', 'json', arg_5\n        )\n\n        try:\n            arg_8 = (\n                arg_0._get_upload_session_status(arg_6)['additionalInfo']\n                ['uploader_service.GoogleRupioAdditionalInfo']\n                ['completionInfo']['customerSpecificInfo']\n            )\n            arg_9 = arg_8['photoid']\n            arg_10 = arg_8['url']\n        except KeyError:\n            raise exceptions.NetworkError(\n                'image upload failed: can not fetch upload info'\n            )\n\n        arg_11 = UploadedImage(arg_9=arg_9, arg_10=arg_10)\n        return arg_11 if arg_3 else arg_11.image_id", "path": "hangups/client.py", "identifier": "Client.upload_image", "docstring": "Upload an image that can be later attached to a chat message.\n\n        Args:\n            image_file: A file-like object containing an image.\n            filename (str): (optional) Custom name for the uploaded file.\n            return_uploaded_image (bool): (optional) If True, return\n                :class:`.UploadedImage` instead of image ID. Defaults to False.\n\n        Raises:\n            hangups.NetworkError: If the upload request failed.\n\n        Returns:\n            :class:`.UploadedImage` instance, or ID of the uploaded image.", "docstring_tokens": ["Upload", "an", "image", "that", "can", "be", "later", "attached", "to", "a", "chat", "message", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255200}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/widgets.py#L41-L53", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Render the widget as an HTML string.", "language": "python", "parameters": "(self, name, value, attrs=None, renderer=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_0", ".", "has_template_widget_Funcing", ":", "return", "super", "(", "ClearableFileInputWithImagePreview", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "else", ":", "arg_5", "=", "arg_0", ".", "get_context", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "Func_to_string", "(", "arg_0", ".", "template_name", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"\n        Render the widget as an HTML string.\n\n        Overridden here to support Django < 1.11.\n        \"\"\"\n        if arg_0.has_template_widget_Funcing:\n            return super(ClearableFileInputWithImagePreview, arg_0).Func(\n                arg_1, arg_2, arg_3=arg_3, arg_4=arg_4\n            )\n        else:\n            arg_5 = arg_0.get_context(arg_1, arg_2, arg_3)\n            return Func_to_string(arg_0.template_name, arg_5)", "path": "versatileimagefield/widgets.py", "identifier": "ClearableFileInputWithImagePreview.render", "docstring": "Render the widget as an HTML string.\n\n        Overridden here to support Django < 1.11.", "docstring_tokens": ["Render", "the", "widget", "as", "an", "HTML", "string", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 255201}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L144-L183", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Populate Filterbank instance with data from HDF5 file", "language": "python", "parameters": "(self, filename, f_start=None, f_stop=None,\n                        t_start=None, t_stop=None, load_data=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ")", ":", "print", "(", "\"Warning: this function will be deprecated in the future. Please use Waterfall to open HDF5 files.\"", ")", "arg_0", ".", "header", "=", "{", "}", "arg_0", ".", "filename", "=", "arg_1", "arg_0", ".", "h5", "=", "h5py", ".", "File", "(", "arg_1", ")", "for", "arg_9", ",", "arg_10", "in", "arg_0", ".", "h5", "[", "b'data'", "]", ".", "attrs", ".", "items", "(", ")", ":", "if", "six", ".", "PY3", ":", "arg_9", "=", "bytes", "(", "arg_9", ",", "'ascii'", ")", "if", "arg_9", "==", "b'src_raj'", ":", "arg_0", ".", "header", "[", "arg_9", "]", "=", "Angle", "(", "arg_10", ",", "unit", "=", "'hr'", ")", "elif", "arg_9", "==", "b'src_dej'", ":", "arg_0", ".", "header", "[", "arg_9", "]", "=", "Angle", "(", "arg_10", ",", "unit", "=", "'deg'", ")", "else", ":", "arg_0", ".", "header", "[", "arg_9", "]", "=", "arg_10", "arg_0", ".", "n_ints_in_file", "=", "arg_0", ".", "h5", "[", "b\"data\"", "]", ".", "shape", "[", "0", "]", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", "=", "arg_0", ".", "_setup_freqs", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_16", ",", "arg_17", ",", "arg_18", "=", "arg_0", ".", "_setup_time_axis", "(", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "if", "arg_6", ":", "arg_0", ".", "data", "=", "arg_0", ".", "h5", "[", "b\"data\"", "]", "[", "arg_16", ":", "arg_17", ",", ":", ",", "arg_14", ":", "arg_15", "]", "arg_0", ".", "file_size_bytes", "=", "os", ".", "path", ".", "getsize", "(", "arg_0", ".", "filename", ")", "else", ":", "print", "(", "\"Skipping data load...\"", ")", "arg_0", ".", "data", "=", "np", ".", "array", "(", "[", "0", "]", ")", "arg_0", ".", "n_ints_in_file", "=", "0", "arg_0", ".", "file_size_bytes", "=", "os", ".", "path", ".", "getsize", "(", "arg_0", ".", "filename", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                        arg_4=None, arg_5=None, arg_6=True):\n        \"\"\" Populate Filterbank instance with data from HDF5 file\n\n        Note:\n            This is to be deprecated in future, please use Waterfall() to open files.\n        \"\"\"\n        print(\"Warning: this function will be deprecated in the future. Please use Waterfall to open HDF5 files.\")\n#        raise DeprecationWarning('Please use Waterfall to open HDF5 files.')\n\n        arg_0.header = {}\n        arg_0.filename = arg_1\n        arg_0.h5 = h5py.File(arg_1)\n        for arg_9, arg_10 in arg_0.h5[b'data'].attrs.items():\n            if six.PY3:\n                arg_9 = bytes(arg_9, 'ascii')\n            if arg_9 == b'src_raj':\n                arg_0.header[arg_9] = Angle(arg_10, unit='hr')\n            elif arg_9 == b'src_dej':\n                arg_0.header[arg_9] = Angle(arg_10, unit='deg')\n            else:\n                arg_0.header[arg_9] = arg_10\n\n        arg_0.n_ints_in_file = arg_0.h5[b\"data\"].shape[0]\n        arg_12, arg_13, arg_14, arg_15 = arg_0._setup_freqs(arg_2=arg_2, arg_3=arg_3)\n        arg_16, arg_17, arg_18 = arg_0._setup_time_axis(arg_4=arg_4, arg_5=arg_5)\n\n        if arg_6:\n            arg_0.data = arg_0.h5[b\"data\"][arg_16:arg_17, :, arg_14:arg_15]\n\n            arg_0.file_size_bytes = os.path.getsize(arg_0.filename)\n\n#         if self.header[b'foff'] < 0:\n#             self.data = self.data[..., ::-1] # Reverse data\n\n        else:\n            print(\"Skipping data load...\")\n            arg_0.data = np.array([0])\n            arg_0.n_ints_in_file  = 0\n            arg_0.file_size_bytes = os.path.getsize(arg_0.filename)", "path": "blimpy/filterbank.py", "identifier": "Filterbank.read_hdf5", "docstring": "Populate Filterbank instance with data from HDF5 file\n\n        Note:\n            This is to be deprecated in future, please use Waterfall() to open files.", "docstring_tokens": ["Populate", "Filterbank", "instance", "with", "data", "from", "HDF5", "file"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 255202}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/files.py#L40-L51", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Job version of move_files for one file", "language": "python", "parameters": "(job, name, file_id, output_dir)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "arg_5", "=", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_2", ",", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_1", ")", ")", "copy_files", "(", "[", "arg_5", "]", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Job version of move_files for one file\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str name: Name of output file (including extension)\n    :param str file_id: FileStoreID of file\n    :param str output_dir: Location to place output file\n    \"\"\"\n    arg_4 = arg_0.fileStore.getLocalTempDir()\n    arg_5 = arg_0.fileStore.readGlobalFile(arg_2, os.path.join(arg_4, arg_1))\n    copy_files([arg_5], arg_3)", "path": "src/toil_lib/files.py", "identifier": "copy_file_job", "docstring": "Job version of move_files for one file\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str name: Name of output file (including extension)\n    :param str file_id: FileStoreID of file\n    :param str output_dir: Location to place output file", "docstring_tokens": ["Job", "version", "of", "move_files", "for", "one", "file"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 255203}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L908-L914", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Convert the record to a dictionary using field names as keys.", "language": "python", "parameters": "(self, r)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ".", "_field_names", ")", ":", "arg_2", "[", "arg_4", "]", "=", "arg_1", "[", "arg_3", "]", "if", "arg_3", "<", "len", "(", "arg_1", ")", "else", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert the record to a dictionary using field names as keys.\"\"\"\n\n        arg_2 = dict()\n        for arg_3, arg_4 in enumerate(arg_0._field_names):\n            arg_2[arg_4] = arg_1[arg_3] if arg_3 < len(arg_1) else None\n        return arg_2", "path": "csvvalidator.py", "identifier": "CSVValidator._as_dict", "docstring": "Convert the record to a dictionary using field names as keys.", "docstring_tokens": ["Convert", "the", "record", "to", "a", "dictionary", "using", "field", "names", "as", "keys", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 255204}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L440-L453", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Calculate scores for all leaves until there are none, removes edges until there are, and repeats until\n        all nodes have been scored. Also, yields the current graph at every step so you can make a cool animation\n        of how the graph changes throughout the course of the algorithm", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Iterable", "[", "BELGraph", "]", ":", "yield", "arg_0", ".", "get_remaining_graph", "(", ")", "while", "not", "arg_0", ".", "done_chomping", "(", ")", ":", "while", "not", "list", "(", "arg_0", ".", "iter_leaves", "(", ")", ")", ":", "arg_0", ".", "remove_random_edge", "(", ")", "yield", "arg_0", ".", "get_remaining_graph", "(", ")", "arg_0", ".", "score_leaves", "(", ")", "yield", "arg_0", ".", "get_remaining_graph", "(", ")"], "function": "def Func(arg_0) -> Iterable[BELGraph]:\n        \"\"\"Calculate scores for all leaves until there are none, removes edges until there are, and repeats until\n        all nodes have been scored. Also, yields the current graph at every step so you can make a cool animation\n        of how the graph changes throughout the course of the algorithm\n\n        :return: An iterable of BEL graphs\n        \"\"\"\n        yield arg_0.get_remaining_graph()\n        while not arg_0.done_chomping():\n            while not list(arg_0.iter_leaves()):\n                arg_0.remove_random_edge()\n                yield arg_0.get_remaining_graph()\n            arg_0.score_leaves()\n            yield arg_0.get_remaining_graph()", "path": "src/pybel_tools/analysis/heat.py", "identifier": "Runner.run_with_graph_transformation", "docstring": "Calculate scores for all leaves until there are none, removes edges until there are, and repeats until\n        all nodes have been scored. Also, yields the current graph at every step so you can make a cool animation\n        of how the graph changes throughout the course of the algorithm\n\n        :return: An iterable of BEL graphs", "docstring_tokens": ["Calculate", "scores", "for", "all", "leaves", "until", "there", "are", "none", "removes", "edges", "until", "there", "are", "and", "repeats", "until", "all", "nodes", "have", "been", "scored", ".", "Also", "yields", "the", "current", "graph", "at", "every", "step", "so", "you", "can", "make", "a", "cool", "animation", "of", "how", "the", "graph", "changes", "throughout", "the", "course", "of", "the", "algorithm"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255205}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/manager.py#L276-L288", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Configure the set of plugins with the given options\n        and config instance. After configuration, disabled plugins\n        are removed from the plugins list.", "language": "python", "parameters": "(self, options, config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "log", ".", "debug", "(", "\"Configuring plugins\"", ")", "arg_0", ".", "config", "=", "arg_2", "arg_3", "=", "PluginProxy", "(", "'Func'", ",", "arg_0", ".", "_plugins", ")", "arg_3", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "[", "plug", "for", "plug", "in", "arg_0", ".", "_plugins", "if", "plug", ".", "enabled", "]", "arg_0", ".", "plugins", "=", "arg_4", "arg_0", ".", "sort", "(", ")", "log", ".", "debug", "(", "\"Plugins enabled: %s\"", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Configure the set of plugins with the given options\n        and config instance. After configuration, disabled plugins\n        are removed from the plugins list.\n        \"\"\"\n        log.debug(\"Configuring plugins\")\n        arg_0.config = arg_2\n        arg_3 = PluginProxy('Func', arg_0._plugins)\n        arg_3(arg_1, arg_2)\n        arg_4 = [plug for plug in arg_0._plugins if plug.enabled]\n        arg_0.plugins = arg_4\n        arg_0.sort()\n        log.debug(\"Plugins enabled: %s\", arg_4)", "path": "environment/lib/python2.7/site-packages/nose/plugins/manager.py", "identifier": "PluginManager.configure", "docstring": "Configure the set of plugins with the given options\n        and config instance. After configuration, disabled plugins\n        are removed from the plugins list.", "docstring_tokens": ["Configure", "the", "set", "of", "plugins", "with", "the", "given", "options", "and", "config", "instance", ".", "After", "configuration", "disabled", "plugins", "are", "removed", "from", "the", "plugins", "list", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255206}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L1000-L1017", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Process an unavailable presence from a MUC room.", "language": "python", "parameters": "(self,stanza)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_from", "(", ")", "arg_3", "=", "arg_2", ".", "bare", "(", ")", ".", "as_unicode", "(", ")", "arg_4", "=", "arg_0", ".", "rooms", ".", "get", "(", "arg_3", ")", "if", "not", "arg_4", ":", "return", "False", "arg_4", ".", "process_unavailable_presence", "(", "MucPresence", "(", "arg_1", ")", ")", "return", "True"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Process an unavailable presence from a MUC room.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `Presence`\n\n        :return: `True` if the stanza was properly recognized as generated by\n            one of the managed rooms, `False` otherwise.\n        :returntype: `bool`\"\"\"\n        arg_2=arg_1.get_from()\n        arg_3=arg_2.bare().as_unicode()\n        arg_4=arg_0.rooms.get(arg_3)\n        if not arg_4:\n            return False\n        arg_4.process_unavailable_presence(MucPresence(arg_1))\n        return True", "path": "pyxmpp2/ext/muc/muc.py", "identifier": "MucRoomManager.__presence_unavailable", "docstring": "Process an unavailable presence from a MUC room.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `Presence`\n\n        :return: `True` if the stanza was properly recognized as generated by\n            one of the managed rooms, `False` otherwise.\n        :returntype: `bool`", "docstring_tokens": ["Process", "an", "unavailable", "presence", "from", "a", "MUC", "room", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255207}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L30-L44", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Displays help for each command", "language": "python", "parameters": "(self, msg, args)", "return_statement": "return '\\n'.join(output)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "if", "len", "(", "arg_2", ")", "==", "0", ":", "arg_4", "=", "sorted", "(", "arg_0", ".", "_bot", ".", "dispatcher", ".", "commands", ".", "items", "(", ")", ",", "key", "=", "itemgetter", "(", "0", ")", ")", "arg_4", "=", "filter", "(", "lambda", "x", ":", "x", "[", "1", "]", ".", "is_subcmd", "is", "False", ",", "arg_4", ")", "if", "arg_0", ".", "_should_filter_Func_commands", "(", "arg_1", ".", "user", ")", ":", "arg_4", "=", "filter", "(", "lambda", "x", ":", "x", "[", "1", "]", ".", "admin_only", "is", "False", ",", "arg_4", ")", "for", "arg_5", ",", "arg_6", "in", "arg_4", ":", "arg_3", ".", "append", "(", "arg_0", ".", "_get_short_Func_for_command", "(", "arg_5", ")", ")", "else", ":", "arg_5", "=", "'!'", "+", "arg_2", "[", "0", "]", "arg_3", "=", "[", "arg_0", ".", "_get_Func_for_command", "(", "arg_5", ")", "]", "return", "'\\n'", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Displays Func for each command\"\"\"\n        arg_3 = []\n        if len(arg_2) == 0:\n            arg_4 = sorted(arg_0._bot.dispatcher.commands.items(), key=itemgetter(0))\n            arg_4 = filter(lambda x: x[1].is_subcmd is False, arg_4)\n            # Filter commands if auth is enabled, hide_admin_commands is enabled, and user is not admin\n            if arg_0._should_filter_Func_commands(arg_1.user):\n                arg_4 = filter(lambda x: x[1].admin_only is False, arg_4)\n            for arg_5, arg_6 in arg_4:\n                arg_3.append(arg_0._get_short_Func_for_command(arg_5))\n        else:\n            arg_5 = '!' + arg_2[0]\n            arg_3 = [arg_0._get_Func_for_command(arg_5)]\n        return '\\n'.join(arg_3)", "path": "slackminion/plugins/core/core.py", "identifier": "Core.help", "docstring": "Displays help for each command", "docstring_tokens": ["Displays", "help", "for", "each", "command"], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 255208}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/schedulermanagementservice.py#L139-L156", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "The Check Name Availability operation checks if a new job collection with\n        the given name may be created, or if it is unavailable. The result of the\n        operation is a Boolean true or false.", "language": "python", "parameters": "(self, cloud_service_id, job_collection_id)", "return_statement": "return self._perform_post(path, None, AvailabilityResponse)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "_validate_not_none", "(", "'cloud_service_id'", ",", "arg_1", ")", "_validate_not_none", "(", "'job_collection_id'", ",", "arg_2", ")", "arg_3", "=", "arg_0", ".", "_get_cloud_services_path", "(", "arg_1", ",", "\"scheduler\"", ",", "\"jobCollections\"", ")", "arg_3", "+=", "\"?op=checknameavailability&resourceName=\"", "+", "arg_2", "return", "arg_0", ".", "_perform_post", "(", "arg_3", ",", "None", ",", "AvailabilityResponse", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        The Check Name Availability operation checks if a new job collection with\n        the given name may be created, or if it is unavailable. The result of the\n        operation is a Boolean true or false.\n\n        cloud_service_id:\n            The cloud service id\n        job_collection_id:\n            The name of the job_collection_id.\n        '''\n        _validate_not_none('cloud_service_id', arg_1)\n        _validate_not_none('job_collection_id', arg_2)\n\n        arg_3 = arg_0._get_cloud_services_path(\n            arg_1, \"scheduler\", \"jobCollections\")\n        arg_3 += \"?op=checknameavailability&resourceName=\" + arg_2\n        return arg_0._perform_post(arg_3, None, AvailabilityResponse)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/schedulermanagementservice.py", "identifier": "SchedulerManagementService.check_job_collection_name", "docstring": "The Check Name Availability operation checks if a new job collection with\n        the given name may be created, or if it is unavailable. The result of the\n        operation is a Boolean true or false.\n\n        cloud_service_id:\n            The cloud service id\n        job_collection_id:\n            The name of the job_collection_id.", "docstring_tokens": ["The", "Check", "Name", "Availability", "operation", "checks", "if", "a", "new", "job", "collection", "with", "the", "given", "name", "may", "be", "created", "or", "if", "it", "is", "unavailable", ".", "The", "result", "of", "the", "operation", "is", "a", "Boolean", "true", "or", "false", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255209}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/coeff2header.py#L40-L72", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Write FIR Filter Header Files \r\n    \r\n    Mark Wickert February 2015", "language": "python", "parameters": "(fname_out, h)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_1", ")", "arg_3", "=", "3", "arg_4", "=", "open", "(", "arg_0", ",", "'wt'", ")", "arg_4", ".", "write", "(", "'//define a FIR coefficient Array\\n\\n'", ")", "arg_4", ".", "write", "(", "'#include <stdint.h>\\n\\n'", ")", "arg_4", ".", "write", "(", "'#ifndef M_FIR\\n'", ")", "arg_4", ".", "write", "(", "'#define M_FIR %d\\n'", "%", "arg_2", ")", "arg_4", ".", "write", "(", "'#endif\\n'", ")", "arg_4", ".", "write", "(", "'/************************************************************************/\\n'", ")", "arg_4", ".", "write", "(", "'/*                         FIR Filter Coefficients                      */\\n'", ")", "arg_4", ".", "write", "(", "'float32_t h_FIR[M_FIR] = {'", ")", "arg_5", "=", "0", "for", "arg_6", "in", "range", "(", "arg_2", ")", ":", "if", "(", "arg_5", "<", "arg_3", "-", "1", ")", "and", "(", "arg_6", "<", "arg_2", "-", "1", ")", ":", "arg_4", ".", "write", "(", "'%15.12f,'", "%", "arg_1", "[", "arg_6", "]", ")", "arg_5", "+=", "1", "elif", "(", "arg_5", "==", "arg_3", "-", "1", ")", "&", "(", "arg_6", "<", "arg_2", "-", "1", ")", ":", "arg_4", ".", "write", "(", "'%15.12f,\\n'", "%", "arg_1", "[", "arg_6", "]", ")", "if", "arg_6", "<", "arg_2", ":", "arg_4", ".", "write", "(", "'                          '", ")", "arg_5", "=", "0", "else", ":", "arg_4", ".", "write", "(", "'%15.12f'", "%", "arg_1", "[", "arg_6", "]", ")", "arg_4", ".", "write", "(", "'};\\n'", ")", "arg_4", ".", "write", "(", "'/************************************************************************/\\n'", ")", "arg_4", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\r\n    \"\"\"\r\n    Write FIR Filter Header Files \r\n    \r\n    Mark Wickert February 2015\r\n    \"\"\"\r\n    arg_2 = len(arg_1)\r\n    arg_3 = 3  # Coefficients per line\r\n    arg_4 = open(arg_0, 'wt')\r\n    arg_4.write('//define a FIR coefficient Array\\n\\n')\r\n    arg_4.write('#include <stdint.h>\\n\\n')\r\n    arg_4.write('#ifndef M_FIR\\n')\r\n    arg_4.write('#define M_FIR %d\\n' % arg_2)\r\n    arg_4.write('#endif\\n')\r\n    arg_4.write('/************************************************************************/\\n');\r\n    arg_4.write('/*                         FIR Filter Coefficients                      */\\n');\r\n    arg_4.write('float32_t h_FIR[M_FIR] = {')\r\n    arg_5 = 0;\r\n    for arg_6 in range(arg_2):\r\n        # k_mod = k % M\r\n        if (arg_5 < arg_3 - 1) and (arg_6 < arg_2 - 1):\r\n            arg_4.write('%15.12f,' % arg_1[arg_6])\r\n            arg_5 += 1\r\n        elif (arg_5 == arg_3 - 1) & (arg_6 < arg_2 - 1):\r\n            arg_4.write('%15.12f,\\n' % arg_1[arg_6])\r\n            if arg_6 < arg_2:\r\n                arg_4.write('                          ')\r\n                arg_5 = 0\r\n        else:\r\n            arg_4.write('%15.12f' % arg_1[arg_6])\r\n    arg_4.write('};\\n')\r\n    arg_4.write('/************************************************************************/\\n')\r\n    arg_4.close()", "path": "sk_dsp_comm/coeff2header.py", "identifier": "FIR_header", "docstring": "Write FIR Filter Header Files \r\n    \r\n    Mark Wickert February 2015", "docstring_tokens": ["Write", "FIR", "Filter", "Header", "Files", "Mark", "Wickert", "February", "2015"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 255210}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/slot.py#L156-L191", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "In general, you don't need to overwrite this method.", "language": "python", "parameters": "(self, options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "set_signal", "(", ")", "arg_0", ".", "check_exclusive_mode", "(", ")", "arg_2", "=", "arg_0", ".", "Handle", "(", "arg_0", ")", "arg_3", "=", "0", "while", "arg_3", "<", "arg_1", ".", "threads", ":", "arg_4", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "worker", ",", "args", "=", "[", "arg_2", "]", ")", "if", "arg_1", ".", "once", "is", "True", "or", "arg_1", ".", "no_daemon", "is", "True", ":", "arg_4", ".", "daemon", "=", "False", "else", ":", "arg_4", ".", "daemon", "=", "True", "arg_4", ".", "start", "(", ")", "arg_3", "+=", "1", "if", "arg_1", ".", "once", "is", "False", ":", "while", "True", ":", "if", "threading", ".", "active_count", "(", ")", ">", "1", ":", "sleep", "(", "1", ")", "else", ":", "if", "threading", ".", "current_thread", "(", ")", ".", "name", "==", "\"MainThread\"", ":", "sys", ".", "exit", "(", "0", ")", "pass"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        In general, you don't need to overwrite this method.\n\n        :param options:\n        :return:\n        \"\"\"\n\n        arg_0.set_signal()\n        arg_0.check_exclusive_mode()\n\n        arg_2 = arg_0.Handle(arg_0)\n\n        # start thread\n        arg_3 = 0\n        while arg_3 < arg_1.threads:\n            arg_4 = threading.Thread(target=arg_0.worker, args=[arg_2])\n            # only set daemon when once is False\n            if arg_1.once is True or arg_1.no_daemon is True:\n                arg_4.daemon = False\n            else:\n                arg_4.daemon = True\n\n            arg_4.start()\n            arg_3 += 1\n\n        # waiting thread\n        if arg_1.once is False:\n            while True:\n                if threading.active_count() > 1:\n                    sleep(1)\n                else:\n                    if threading.current_thread().name == \"MainThread\":\n                        sys.exit(0)\n\n        pass", "path": "cliez/slot.py", "identifier": "SlotComponent.run", "docstring": "In general, you don't need to overwrite this method.\n\n        :param options:\n        :return:", "docstring_tokens": ["In", "general", "you", "don", "t", "need", "to", "overwrite", "this", "method", "."], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 255211}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L237-L272", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "This makes an attempt to calculate the number of coarse channels in a given file.", "language": "python", "parameters": "(self, chan_bw=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "int", "(", "arg_0", ".", "header", "[", "b'nchans'", "]", ")", "if", "arg_1", "is", "not", "None", ":", "arg_3", "=", "abs", "(", "arg_0", ".", "f_stop", "-", "arg_0", ".", "f_start", ")", "arg_4", "=", "int", "(", "arg_3", "/", "arg_1", ")", "return", "arg_4", "elif", "arg_2", ">=", "2", "**", "20", ":", "if", "arg_2", "%", "2", "**", "20", "==", "0", ":", "arg_4", "=", "arg_2", "//", "2", "**", "20", "return", "arg_4", "elif", "arg_0", ".", "header", "[", "b'telescope_id'", "]", "==", "6", ":", "arg_5", "=", "2.9296875", "arg_3", "=", "abs", "(", "arg_0", ".", "f_stop", "-", "arg_0", ".", "f_start", ")", "arg_4", "=", "int", "(", "arg_3", "/", "arg_5", ")", "return", "arg_4", "else", ":", "logger", ".", "warning", "(", "\"Couldn't figure out n_coarse_chan\"", ")", "elif", "arg_0", ".", "header", "[", "b'telescope_id'", "]", "==", "6", "and", "arg_2", "<", "2", "**", "20", ":", "arg_5", "=", "2.9296875", "arg_3", "=", "abs", "(", "arg_0", ".", "f_stop", "-", "arg_0", ".", "f_start", ")", "arg_4", "=", "int", "(", "arg_3", "/", "arg_5", ")", "return", "arg_4", "else", ":", "logger", ".", "warning", "(", "\"This function currently only works for hires BL Parkes or GBT data.\"", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\" This makes an attempt to calculate the number of coarse channels in a given file.\n\n            Note:\n                This is unlikely to work on non-Breakthrough Listen data, as a-priori knowledge of\n                the digitizer system is required.\n\n        \"\"\"\n        arg_2 = int(arg_0.header[b'nchans'])\n        # Do we have a file with enough channels that it has coarse channelization?\n        if arg_1 is not None:\n            arg_3 = abs(arg_0.f_stop - arg_0.f_start)\n            arg_4 = int(arg_3 / arg_1)\n            return arg_4\n        elif arg_2 >= 2**20:\n            # Does the common FFT length of 2^20 divide through without a remainder?\n            # This should work for most GBT and all Parkes hires data\n            if arg_2 % 2**20 == 0:\n                arg_4 = arg_2 // 2**20\n                return arg_4\n            # Early GBT data has non-2^N FFT length, check if it is GBT data\n            elif arg_0.header[b'telescope_id'] == 6:\n                arg_5 = 2.9296875\n                arg_3 = abs(arg_0.f_stop - arg_0.f_start)\n                arg_4 = int(arg_3 / arg_5)\n                return arg_4\n            else:\n                logger.warning(\"Couldn't figure out n_coarse_chan\")\n        elif arg_0.header[b'telescope_id'] == 6 and arg_2 < 2**20:\n            #For GBT non-hires data\n            arg_5 = 2.9296875\n            arg_3 = abs(arg_0.f_stop - arg_0.f_start)\n            arg_4 = int(arg_3 / arg_5)\n            return arg_4\n        else:\n            logger.warning(\"This function currently only works for hires BL Parkes or GBT data.\")", "path": "blimpy/file_wrapper.py", "identifier": "Reader.calc_n_coarse_chan", "docstring": "This makes an attempt to calculate the number of coarse channels in a given file.\n\n            Note:\n                This is unlikely to work on non-Breakthrough Listen data, as a-priori knowledge of\n                the digitizer system is required.", "docstring_tokens": ["This", "makes", "an", "attempt", "to", "calculate", "the", "number", "of", "coarse", "channels", "in", "a", "given", "file", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 255212}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/cache.py#L480-L504", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Add an item to the cache.", "language": "python", "parameters": "(self, item)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_lock", ".", "acquire", "(", ")", "try", ":", "arg_2", "=", "arg_1", ".", "update_state", "(", ")", "if", "arg_2", "!=", "'purged'", ":", "if", "len", "(", "arg_0", ".", "_items_list", ")", ">=", "arg_0", ".", "max_items", ":", "arg_0", ".", "purge_items", "(", ")", "arg_0", ".", "_items", "[", "arg_1", ".", "address", "]", "=", "arg_1", "arg_0", ".", "_items_list", ".", "append", "(", "arg_1", ")", "arg_0", ".", "_items_list", ".", "sort", "(", ")", "return", "arg_1", ".", "state", "finally", ":", "arg_0", ".", "_lock", ".", "release", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add an item to the cache.\n\n        Item state is updated before adding it (it will not be 'new' any more).\n\n        :Parameters:\n            - `item`: the item to add.\n        :Types:\n            - `item`: `CacheItem`\n\n        :return: state of the item after addition.\n        :returntype: `str`\n        \"\"\"\n        arg_0._lock.acquire()\n        try:\n            arg_2 = arg_1.update_state()\n            if arg_2 != 'purged':\n                if len(arg_0._items_list) >= arg_0.max_items:\n                    arg_0.purge_items()\n                arg_0._items[arg_1.address] = arg_1\n                arg_0._items_list.append(arg_1)\n                arg_0._items_list.sort()\n            return arg_1.state\n        finally:\n            arg_0._lock.release()", "path": "pyxmpp2/cache.py", "identifier": "Cache.add_item", "docstring": "Add an item to the cache.\n\n        Item state is updated before adding it (it will not be 'new' any more).\n\n        :Parameters:\n            - `item`: the item to add.\n        :Types:\n            - `item`: `CacheItem`\n\n        :return: state of the item after addition.\n        :returntype: `str`", "docstring_tokens": ["Add", "an", "item", "to", "the", "cache", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255213}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L76-L80", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Print, emphasized 'error', the given 'txt' message", "language": "python", "parameters": "(txt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "\"%s# %s%s%s\"", "%", "(", "PR_ERR_CC", ",", "get_time_stamp", "(", ")", ",", "arg_0", ",", "PR_NC", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Print, emphasized 'Funcor', the given 'txt' message\"\"\"\n\n    print(\"%s# %s%s%s\" % (PR_ERR_CC, get_time_stamp(), arg_0, PR_NC))\n    sys.stdout.flush()", "path": "modules/cij/__init__.py", "identifier": "err", "docstring": "Print, emphasized 'error', the given 'txt' message", "docstring_tokens": ["Print", "emphasized", "error", "the", "given", "txt", "message"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 255214}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/plugin.py#L465-L484", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Load any stored cookies for the plugin that have not expired.", "language": "python", "parameters": "(self)", "return_statement": "return restored", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "session", "or", "not", "arg_0", ".", "cache", ":", "raise", "RuntimeError", "(", "\"Cannot loaded cached cookies in unbound plugin\"", ")", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "cache", ".", "get_all", "(", ")", ".", "items", "(", ")", ":", "if", "arg_2", ".", "startswith", "(", "\"__cookie\"", ")", ":", "arg_4", "=", "requests", ".", "cookies", ".", "create_cookie", "(", "**", "arg_3", ")", "arg_0", ".", "session", ".", "http", ".", "cookies", ".", "set_cookie", "(", "arg_4", ")", "arg_1", ".", "append", "(", "arg_4", ".", "name", ")", "if", "arg_1", ":", "arg_0", ".", "logger", ".", "debug", "(", "\"Restored cookies: {0}\"", ".", "format", "(", "\", \"", ".", "join", "(", "arg_1", ")", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Load any stored cookies for the plugin that have not expired.\n\n        :return: list of the restored cookie names\n        \"\"\"\n        if not arg_0.session or not arg_0.cache:\n            raise RuntimeError(\"Cannot loaded cached cookies in unbound plugin\")\n\n        arg_1 = []\n\n        for arg_2, arg_3 in arg_0.cache.get_all().items():\n            if arg_2.startswith(\"__cookie\"):\n                arg_4 = requests.cookies.create_cookie(**arg_3)\n                arg_0.session.http.cookies.set_cookie(arg_4)\n                arg_1.append(arg_4.name)\n\n        if arg_1:\n            arg_0.logger.debug(\"Restored cookies: {0}\".format(\", \".join(arg_1)))\n        return arg_1", "path": "src/streamlink/plugin/plugin.py", "identifier": "Plugin.load_cookies", "docstring": "Load any stored cookies for the plugin that have not expired.\n\n        :return: list of the restored cookie names", "docstring_tokens": ["Load", "any", "stored", "cookies", "for", "the", "plugin", "that", "have", "not", "expired", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 255215}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L105-L119", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "Returns the list of defined names for the document.", "language": "python", "parameters": "(request_data)", "return_statement": "return ret_val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "global", "_old_definitions", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", "[", "'path'", "]", "arg_3", "=", "jedi", ".", "names", "(", "arg_0", "[", "'code'", "]", ",", "arg_2", ",", "'utf-8'", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "_extract_def", "(", "arg_4", ",", "arg_2", ")", "if", "arg_4", ".", "type", "!=", "'import'", ":", "arg_1", ".", "append", "(", "arg_5", ")", "arg_1", "=", "[", "arg_4", ".", "to_dict", "(", ")", "for", "arg_4", "in", "arg_1", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns the list of defined names for the document.\n    \"\"\"\n    global _old_definitions\n    arg_1 = []\n    arg_2 = arg_0['path']\n    arg_3 = jedi.names(\n        arg_0['code'], arg_2, 'utf-8')\n    for arg_4 in arg_3:\n        arg_5 = _extract_def(arg_4, arg_2)\n        if arg_4.type != 'import':\n            arg_1.append(arg_5)\n    arg_1 = [arg_4.to_dict() for arg_4 in arg_1]\n    return arg_1", "path": "pyqode/python/backend/workers.py", "identifier": "defined_names", "docstring": "Returns the list of defined names for the document.", "docstring_tokens": ["Returns", "the", "list", "of", "defined", "names", "for", "the", "document", "."], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 255216}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/notebook.py#L134-L155", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Stops the notebook deployment for this project if it exists.", "language": "python", "parameters": "(ctx, commit, yes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "get_project_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ")", "if", "not", "arg_2", "and", "not", "click", ".", "confirm", "(", "\"Are sure you want to Func notebook \"", "\"for project `{}/{}`\"", ".", "format", "(", "arg_3", ",", "arg_4", ")", ")", ":", "click", ".", "echo", "(", "'Existing without Funcping notebook.'", ")", "sys", ".", "exit", "(", "1", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "True", "try", ":", "PolyaxonClient", "(", ")", ".", "project", ".", "Func_notebook", "(", "arg_3", ",", "arg_4", ",", "arg_1", ")", "Printer", ".", "print_success", "(", "'Notebook is being deleted'", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func notebook project `{}`.'", ".", "format", "(", "arg_4", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Stops the notebook deployment for this project if it exists.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n    \"\"\"\n    arg_3, arg_4 = get_project_or_local(arg_0.obj.get('project'))\n\n    if not arg_2 and not click.confirm(\"Are sure you want to Func notebook \"\n                                     \"for project `{}/{}`\".format(arg_3, arg_4)):\n        click.echo('Existing without Funcping notebook.')\n        sys.exit(1)\n\n    if arg_1 is None:\n        arg_1 = True\n\n    try:\n        PolyaxonClient().project.Func_notebook(arg_3, arg_4, arg_1)\n        Printer.print_success('Notebook is being deleted')\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func notebook project `{}`.'.format(arg_4))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)", "path": "polyaxon_cli/cli/notebook.py", "identifier": "stop", "docstring": "Stops the notebook deployment for this project if it exists.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)", "docstring_tokens": ["Stops", "the", "notebook", "deployment", "for", "this", "project", "if", "it", "exists", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 255217}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/urls.py#L611-L673", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "r\"\"\"\n    Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always\n    uses utf-8 URLs internally because this is what browsers and HTTP do as\n    well. In some places where it accepts an URL it also accepts a unicode IRI\n    and converts it into a URI.", "language": "python", "parameters": "(iri, charset='utf-8', errors='strict', safe_conversion=False)", "return_statement": "return to_native(url_unparse((iri.scheme, netloc,\n                                  path, query, fragment)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf-8'", ",", "arg_2", "=", "'strict'", ",", "arg_3", "=", "False", ")", ":", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "arg_0", "=", "url_unparse", "(", "arg_0", ")", "if", "arg_3", ":", "try", ":", "arg_4", "=", "to_native", "(", "arg_0", ")", "arg_5", "=", "to_native", "(", "arg_0", ")", ".", "encode", "(", "'ascii'", ")", "if", "arg_5", ".", "split", "(", ")", "==", "[", "arg_5", "]", ":", "return", "arg_4", "except", "UnicodeError", ":", "pass", "arg_0", "=", "url_parse", "(", "to_unicode", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", "arg_6", "=", "arg_0", ".", "encode_netloc", "(", ")", "arg_7", "=", "url_quote", "(", "arg_0", ".", "path", ",", "arg_1", ",", "arg_2", ",", "'/:~+%'", ")", "arg_8", "=", "url_quote", "(", "arg_0", ".", "query", ",", "arg_1", ",", "arg_2", ",", "'%&[]:;$*()+,!?*/='", ")", "arg_9", "=", "url_quote", "(", "arg_0", ".", "fragment", ",", "arg_1", ",", "arg_2", ",", "'=%&[]:;$()+,!?*/'", ")", "return", "to_native", "(", "url_unparse", "(", "(", "arg_0", ".", "scheme", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", ")", ")"], "function": "def Func(arg_0, arg_1='utf-8', arg_2='strict', arg_3=False):\n    r\"\"\"\n    Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always\n    uses utf-8 URLs internally because this is what browsers and HTTP do as\n    well. In some places where it accepts an URL it also accepts a unicode IRI\n    and converts it into a URI.\n\n    Examples for IRI versus URI:\n\n    >>> Func(u'http://\u2603.net/')\n    'http://xn--n3h.net/'\n    >>> Func(u'http://\u00fcser:p\u00e4ssword@\u2603.net/p\u00e5th')\n    'http://%C3%BCser:p%C3%A4ssword@xn--n3h.net/p%C3%A5th'\n\n    There is a general problem with IRI and URI conversion with some\n    protocols that appear in the wild that are in violation of the URI\n    specification.  In places where Werkzeug goes through a forced IRI to\n    URI conversion it will set the `safe_conversion` flag which will\n    not perform a conversion if the end result is already ASCII.  This\n    can mean that the return value is not an entirely correct URI but\n    it will not destroy such invalid URLs in the process.\n\n    As an example consider the following two IRIs::\n\n      magnet:?xt=uri:whatever\n      itms-services://?action=download-manifest\n\n    The internal representation after parsing of those URLs is the same\n    and there is no way to reconstruct the original one.  If safe\n    conversion is enabled however this function becomes a noop for both of\n    those strings as they both can be considered URIs.\n\n    .. versionadded:: 0.6\n\n    .. versionchanged:: 0.9.6\n       The `safe_conversion` parameter was added.\n\n    :param iri: The IRI to convert.\n    :param charset: The charset for the URI.\n    :param safe_conversion: indicates if a safe conversion should take place.\n                            For more information see the explanation above.\n    \"\"\"\n    if isinstance(arg_0, tuple):\n        arg_0 = url_unparse(arg_0)\n\n    if arg_3:\n        try:\n            arg_4 = to_native(arg_0)\n            arg_5 = to_native(arg_0).encode('ascii')\n            if arg_5.split() == [arg_5]:\n                return arg_4\n        except UnicodeError:\n            pass\n\n    arg_0 = url_parse(to_unicode(arg_0, arg_1, arg_2))\n\n    arg_6 = arg_0.encode_netloc()\n    arg_7 = url_quote(arg_0.path, arg_1, arg_2, '/:~+%')\n    arg_8 = url_quote(arg_0.query, arg_1, arg_2, '%&[]:;$*()+,!?*/=')\n    arg_9 = url_quote(arg_0.fragment, arg_1, arg_2, '=%&[]:;$()+,!?*/')\n\n    return to_native(url_unparse((arg_0.scheme, arg_6,\n                                  arg_7, arg_8, arg_9)))", "path": "capybara/virtualenv/lib/python2.7/site-packages/werkzeug/urls.py", "identifier": "iri_to_uri", "docstring": "r\"\"\"\n    Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always\n    uses utf-8 URLs internally because this is what browsers and HTTP do as\n    well. In some places where it accepts an URL it also accepts a unicode IRI\n    and converts it into a URI.\n\n    Examples for IRI versus URI:\n\n    >>> iri_to_uri(u'http://\u2603.net/')\n    'http://xn--n3h.net/'\n    >>> iri_to_uri(u'http://\u00fcser:p\u00e4ssword@\u2603.net/p\u00e5th')\n    'http://%C3%BCser:p%C3%A4ssword@xn--n3h.net/p%C3%A5th'\n\n    There is a general problem with IRI and URI conversion with some\n    protocols that appear in the wild that are in violation of the URI\n    specification.  In places where Werkzeug goes through a forced IRI to\n    URI conversion it will set the `safe_conversion` flag which will\n    not perform a conversion if the end result is already ASCII.  This\n    can mean that the return value is not an entirely correct URI but\n    it will not destroy such invalid URLs in the process.\n\n    As an example consider the following two IRIs::\n\n      magnet:?xt=uri:whatever\n      itms-services://?action=download-manifest\n\n    The internal representation after parsing of those URLs is the same\n    and there is no way to reconstruct the original one.  If safe\n    conversion is enabled however this function becomes a noop for both of\n    those strings as they both can be considered URIs.\n\n    .. versionadded:: 0.6\n\n    .. versionchanged:: 0.9.6\n       The `safe_conversion` parameter was added.\n\n    :param iri: The IRI to convert.\n    :param charset: The charset for the URI.\n    :param safe_conversion: indicates if a safe conversion should take place.\n                            For more information see the explanation above.", "docstring_tokens": ["r", "Converts", "any", "unicode", "based", "IRI", "to", "an", "acceptable", "ASCII", "URI", ".", "Werkzeug", "always", "uses", "utf", "-", "8", "URLs", "internally", "because", "this", "is", "what", "browsers", "and", "HTTP", "do", "as", "well", ".", "In", "some", "places", "where", "it", "accepts", "an", "URL", "it", "also", "accepts", "a", "unicode", "IRI", "and", "converts", "it", "into", "a", "URI", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255218}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1376-L1447", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Reconstitutes clusters from .utemp and htemp files and writes them\n    to chunked files for aligning in muscle.", "language": "python", "parameters": "(data, ipyclient, force)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "tmpdir", ")", ":", "shutil", ".", "rmtree", "(", "arg_0", ".", "tmpdir", ")", "os", ".", "mkdir", "(", "arg_0", ".", "tmpdir", ")", "arg_3", "=", "arg_1", ".", "load_balanced_view", "(", ")", "arg_4", "=", "time", ".", "time", "(", ")", "arg_5", "=", "\" building clusters     | {} | s6 |\"", "arg_6", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "int", "(", "time", ".", "time", "(", ")", "-", "arg_4", ")", ")", "progressbar", "(", "3", ",", "0", ",", "arg_5", ".", "format", "(", "arg_6", ")", ",", "spacer", "=", "arg_0", ".", "_spacer", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "across", ",", "arg_0", ".", "name", "+", "\".utemp\"", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "across", ",", "arg_0", ".", "name", "+", "\".utemp.sort\"", ")", "arg_9", "=", "\"\"", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_8", ")", "or", "arg_2", ":", "LOGGER", ".", "info", "(", "\"building reads file -- loading utemp file into mem\"", ")", "arg_9", "=", "arg_3", ".", "apply", "(", "sort_seeds", ",", "*", "(", "arg_7", ",", "arg_8", ")", ")", "while", "1", ":", "arg_6", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "int", "(", "time", ".", "time", "(", ")", "-", "arg_4", ")", ")", "progressbar", "(", "3", ",", "0", ",", "arg_5", ".", "format", "(", "arg_6", ")", ",", "spacer", "=", "arg_0", ".", "_spacer", ")", "if", "arg_9", ".", "ready", "(", ")", ":", "break", "else", ":", "time", ".", "sleep", "(", "0.1", ")", "arg_10", "=", "arg_3", ".", "apply", "(", "count_seeds", ",", "arg_8", ")", "while", "1", ":", "arg_6", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "int", "(", "time", ".", "time", "(", ")", "-", "arg_4", ")", ")", "progressbar", "(", "3", ",", "1", ",", "arg_5", ".", "format", "(", "arg_6", ")", ",", "spacer", "=", "arg_0", ".", "_spacer", ")", "if", "arg_10", ".", "ready", "(", ")", ":", "break", "else", ":", "time", ".", "sleep", "(", "0.1", ")", "arg_11", "=", "arg_10", ".", "result", "(", ")", "arg_12", "=", "arg_3", ".", "apply", "(", "sub_Func", ",", "*", "(", "arg_0", ",", "arg_8", ",", "arg_11", ")", ")", "while", "1", ":", "arg_6", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "int", "(", "time", ".", "time", "(", ")", "-", "arg_4", ")", ")", "progressbar", "(", "3", ",", "2", ",", "arg_5", ".", "format", "(", "arg_6", ")", ",", "spacer", "=", "arg_0", ".", "_spacer", ")", "if", "arg_12", ".", "ready", "(", ")", ":", "break", "else", ":", "time", ".", "sleep", "(", "0.1", ")", "arg_6", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "int", "(", "time", ".", "time", "(", ")", "-", "arg_4", ")", ")", "progressbar", "(", "3", ",", "3", ",", "arg_5", ".", "format", "(", "arg_6", ")", ",", "spacer", "=", "arg_0", ".", "_spacer", ")", "print", "(", "\"\"", ")", "for", "arg_13", "in", "[", "arg_9", ",", "arg_10", ",", "arg_12", "]", ":", "try", ":", "if", "not", "arg_13", ".", "successful", "(", ")", ":", "raise", "IPyradWarningExit", "(", "arg_13", ".", "result", "(", ")", ")", "except", "AttributeError", ":", "pass"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Reconstitutes clusters from .utemp and htemp files and writes them\n    to chunked files for aligning in muscle.\n    \"\"\"\n\n    ## If you run this step then we clear all tmp .fa and .indel.h5 files\n    if os.path.exists(arg_0.tmpdir):\n        shutil.rmtree(arg_0.tmpdir)\n        os.mkdir(arg_0.tmpdir)\n\n    ## parallel client\n    arg_3 = arg_1.load_balanced_view()\n    arg_4 = time.time()\n    arg_5 = \" building clusters     | {} | s6 |\"\n    arg_6 = datetime.timedelta(seconds=int(time.time()-arg_4))\n    progressbar(3, 0, arg_5.format(arg_6), spacer=arg_0._spacer)\n\n    arg_7 = os.path.join(arg_0.dirs.across, arg_0.name+\".utemp\")\n    arg_8 = os.path.join(arg_0.dirs.across, arg_0.name+\".utemp.sort\")\n\n    arg_9 = \"\"\n    ## skip usorting if not force and already exists\n    if not os.path.exists(arg_8) or arg_2:\n\n        ## send sort job to engines. Sorted seeds allows us to work through\n        ## the utemp file one locus at a time instead of reading all into mem.\n        LOGGER.info(\"building reads file -- loading utemp file into mem\")\n        arg_9 = arg_3.apply(sort_seeds, *(arg_7, arg_8))\n        while 1:\n            arg_6 = datetime.timedelta(seconds=int(time.time()-arg_4))\n            progressbar(3, 0, arg_5.format(arg_6), spacer=arg_0._spacer)\n            if arg_9.ready():\n                break\n            else:\n                time.sleep(0.1)\n\n    ## send count seeds job to engines.\n    arg_10 = arg_3.apply(count_seeds, arg_8)\n    while 1:\n        arg_6 = datetime.timedelta(seconds=int(time.time()-arg_4))\n        progressbar(3, 1, arg_5.format(arg_6), spacer=arg_0._spacer)\n        if arg_10.ready():\n            break\n        else:\n            time.sleep(0.1)\n\n    ## wait for both to finish while printing progress timer\n    arg_11 = arg_10.result()\n\n    ## send the clust bit building job to work and track progress\n    arg_12 = arg_3.apply(sub_Func, *(arg_0, arg_8, arg_11))\n    while 1:\n        arg_6 = datetime.timedelta(seconds=int(time.time()-arg_4))\n        progressbar(3, 2, arg_5.format(arg_6), spacer=arg_0._spacer)\n        if arg_12.ready():\n            break\n        else:\n            time.sleep(0.1)\n    arg_6 = datetime.timedelta(seconds=int(time.time()-arg_4))\n    progressbar(3, 3, arg_5.format(arg_6), spacer=arg_0._spacer)\n    print(\"\")\n\n    ## check for errors\n    for arg_13 in [arg_9, arg_10, arg_12]:\n        try:\n            if not arg_13.successful():\n                raise IPyradWarningExit(arg_13.result())\n        except AttributeError:\n            ## If we skip usorting then async1 == \"\" so the call to\n            ## successful() raises, but we can ignore it.\n            pass", "path": "ipyrad/assemble/cluster_across.py", "identifier": "build_clustbits", "docstring": "Reconstitutes clusters from .utemp and htemp files and writes them\n    to chunked files for aligning in muscle.", "docstring_tokens": ["Reconstitutes", "clusters", "from", ".", "utemp", "and", "htemp", "files", "and", "writes", "them", "to", "chunked", "files", "for", "aligning", "in", "muscle", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 255219}
{"url": "https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/bundle.py#L107-L125", "sha": "d30107be02521fa6cdfe285da3b6b0cdd153c8cc", "docstring_summary": "Upload a bundle from an unsigned JSON document", "language": "python", "parameters": "(self, jstr)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_2", "=", "arg_1", "else", ":", "arg_2", "=", "json", ".", "Func", "(", "arg_1", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "arg_5", "=", "KeyJar", "(", ")", "if", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "arg_5", ".", "import_jwks", "(", "arg_4", ",", "issuer", "=", "arg_3", ")", "else", ":", "arg_5", ".", "import_jwks_as_json", "(", "arg_4", ",", "issuer", "=", "arg_3", ")", "arg_0", ".", "bundle", "[", "arg_3", "]", "=", "arg_5", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Upload a bundle from an unsigned JSON document\n\n        :param jstr: A bundle as a dictionary or a JSON document\n        \"\"\"\n        if isinstance(arg_1, dict):\n            arg_2 = arg_1\n        else:\n            arg_2 = json.Func(arg_1)\n\n        for arg_3, arg_4 in arg_2.items():\n            arg_5 = KeyJar()\n            if isinstance(arg_4, dict):\n                arg_5.import_jwks(arg_4, issuer=arg_3)\n            else:\n                arg_5.import_jwks_as_json(arg_4, issuer=arg_3)\n            arg_0.bundle[arg_3] = arg_5\n        return arg_0", "path": "src/fedoidcmsg/bundle.py", "identifier": "JWKSBundle.loads", "docstring": "Upload a bundle from an unsigned JSON document\n\n        :param jstr: A bundle as a dictionary or a JSON document", "docstring_tokens": ["Upload", "a", "bundle", "from", "an", "unsigned", "JSON", "document"], "nwo": "IdentityPython/fedoidcmsg", "score": 0.09252797783733271, "idx": 255220}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/compiler.py#L19-L69", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Compile a list of circuits into a qobj.", "language": "python", "parameters": "(circuits, backend,\n            config=None, basis_gates=None, coupling_map=None, initial_layout=None,\n            shots=1024, max_credits=10, seed=None, qobj_id=None, seed_mapper=None,\n            pass_manager=None, memory=False)", "return_statement": "return qobj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "1024", ",", "arg_7", "=", "10", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "False", ")", ":", "warnings", ".", "warn", "(", "'qiskit.Func() is deprecated and will be removed in Qiskit Terra 0.9. '", "'Please use qiskit.Funcr.transpile() to transform circuits '", "'and qiskit.Funcr.assemble() to produce a runnable qobj.'", ",", "DeprecationWarning", ")", "arg_13", "=", "transpile", "(", "arg_0", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "seed_transpiler", "=", "arg_10", ",", "arg_1", "=", "arg_1", ",", "arg_11", "=", "arg_11", ")", "arg_14", "=", "assemble", "(", "arg_13", ",", "qobj_header", "=", "None", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "seed_simulator", "=", "arg_8", ",", "arg_12", "=", "arg_12", ",", "arg_9", "=", "arg_9", ",", "arg_2", "=", "arg_2", ")", "return", "arg_14"], "function": "def Func(arg_0, arg_1,\n            arg_2=None, arg_3=None, arg_4=None, arg_5=None,\n            arg_6=1024, arg_7=10, arg_8=None, arg_9=None, arg_10=None,\n            arg_11=None, arg_12=False):\n    \"\"\"Compile a list of circuits into a qobj.\n\n    Args:\n        circuits (QuantumCircuit or list[QuantumCircuit]): circuits to Func\n        backend (BaseBackend): a backend to Func for\n        config (dict): dictionary of parameters (e.g. noise) used by runner\n        basis_gates (list[str]): list of basis gates names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): coupling map (perhaps custom) to target in mapping\n        initial_layout (list): initial layout of qubits in mapping\n        shots (int): number of repetitions of each circuit, for sampling\n        max_credits (int): maximum credits to use\n        seed (int): random seed for simulators\n        seed_mapper (int): random seed for swapper mapper\n        qobj_id (int): identifier for the generated qobj\n        pass_manager (PassManager): a pass manger for the transpiler pipeline\n        memory (bool): if True, per-shot measurement bitstrings are returned as well\n\n    Returns:\n        Qobj: the qobj to be run on the backends\n\n    Raises:\n        QiskitError: if the desired options are not supported by backend\n    \"\"\"\n    warnings.warn('qiskit.Func() is deprecated and will be removed in Qiskit Terra 0.9. '\n                  'Please use qiskit.Funcr.transpile() to transform circuits '\n                  'and qiskit.Funcr.assemble() to produce a runnable qobj.',\n                  DeprecationWarning)\n\n    arg_13 = transpile(arg_0,\n                             arg_3=arg_3,\n                             arg_4=arg_4,\n                             arg_5=arg_5,\n                             seed_transpiler=arg_10,\n                             arg_1=arg_1,\n                             arg_11=arg_11)\n\n    arg_14 = assemble(arg_13,\n                    qobj_header=None,\n                    arg_6=arg_6,\n                    arg_7=arg_7,\n                    seed_simulator=arg_8,\n                    arg_12=arg_12,\n                    arg_9=arg_9,\n                    arg_2=arg_2)  # deprecated\n\n    return arg_14", "path": "qiskit/tools/compiler.py", "identifier": "compile", "docstring": "Compile a list of circuits into a qobj.\n\n    Args:\n        circuits (QuantumCircuit or list[QuantumCircuit]): circuits to compile\n        backend (BaseBackend): a backend to compile for\n        config (dict): dictionary of parameters (e.g. noise) used by runner\n        basis_gates (list[str]): list of basis gates names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): coupling map (perhaps custom) to target in mapping\n        initial_layout (list): initial layout of qubits in mapping\n        shots (int): number of repetitions of each circuit, for sampling\n        max_credits (int): maximum credits to use\n        seed (int): random seed for simulators\n        seed_mapper (int): random seed for swapper mapper\n        qobj_id (int): identifier for the generated qobj\n        pass_manager (PassManager): a pass manger for the transpiler pipeline\n        memory (bool): if True, per-shot measurement bitstrings are returned as well\n\n    Returns:\n        Qobj: the qobj to be run on the backends\n\n    Raises:\n        QiskitError: if the desired options are not supported by backend", "docstring_tokens": ["Compile", "a", "list", "of", "circuits", "into", "a", "qobj", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255221}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster-airflow/dagster_airflow/compile.py#L16-L28", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Groups execution steps by solid, in topological order of the solids.", "language": "python", "parameters": "(execution_plan)", "return_statement": "return OrderedDict([(solid_name, steps[solid_name]) for solid_name in solid_order])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_coalesce_solid_order", "(", "arg_0", ")", "arg_2", "=", "defaultdict", "(", "list", ")", "for", "arg_3", ",", "arg_4", "in", "itertools", ".", "groupby", "(", "arg_0", ".", "topological_steps", "(", ")", ",", "lambda", "x", ":", "x", ".", "solid_name", ")", ":", "arg_2", "[", "arg_3", "]", "+=", "list", "(", "arg_4", ")", "return", "OrderedDict", "(", "[", "(", "arg_3", ",", "arg_2", "[", "arg_3", "]", ")", "for", "arg_3", "in", "arg_1", "]", ")"], "function": "def Func(arg_0):\n    '''Groups execution steps by solid, in topological order of the solids.'''\n\n    arg_1 = _coalesce_solid_order(arg_0)\n\n    arg_2 = defaultdict(list)\n\n    for arg_3, arg_4 in itertools.groupby(\n        arg_0.topological_steps(), lambda x: x.solid_name\n    ):\n        arg_2[arg_3] += list(arg_4)\n\n    return OrderedDict([(arg_3, arg_2[arg_3]) for arg_3 in arg_1])", "path": "python_modules/dagster-airflow/dagster_airflow/compile.py", "identifier": "coalesce_execution_steps", "docstring": "Groups execution steps by solid, in topological order of the solids.", "docstring_tokens": ["Groups", "execution", "steps", "by", "solid", "in", "topological", "order", "of", "the", "solids", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 255222}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/git.py#L137-L176", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Fetch changes from the default remote repository.", "language": "python", "parameters": "(self, path, use_sudo=False, user=None, remote=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "ValueError", "(", "\"Path to the working copy is needed to Func from a remote repository.\"", ")", "if", "arg_4", "is", "not", "None", ":", "arg_5", "=", "'git Func %s'", "%", "arg_4", "else", ":", "arg_5", "=", "'git Func'", "with", "cd", "(", "arg_1", ")", ":", "if", "arg_2", "and", "arg_3", "is", "None", ":", "run_as_root", "(", "arg_5", ")", "elif", "arg_2", ":", "sudo", "(", "arg_5", ",", "arg_3", "=", "arg_3", ")", "else", ":", "run", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=None, arg_4=None):\n        \"\"\"\n        Fetch changes from the default remote repository.\n\n        This will Func new changesets, but will not update the contents of\n        the working tree unless yo do a merge or rebase.\n\n        :param path: Path of the working copy directory.  This directory must exist\n                     and be a Git working copy with a default remote to Func from.\n        :type path: str\n\n        :param use_sudo: If ``True`` execute ``git`` with\n                         :func:`fabric.operations.sudo`, else with\n                         :func:`fabric.operations.run`.\n        :type use_sudo: bool\n\n        :param user: If ``use_sudo is True``, run :func:`fabric.operations.sudo`\n                     with the given user.  If ``use_sudo is False`` this parameter\n                     has no effect.\n        :type user: str\n\n        :type remote: Fetch this remote or default remote if is None\n        :type remote: str\n        \"\"\"\n\n        if arg_1 is None:\n            raise ValueError(\"Path to the working copy is needed to Func from a remote repository.\")\n\n        if arg_4 is not None:\n            arg_5 = 'git Func %s' % arg_4\n        else:\n            arg_5 = 'git Func'\n\n        with cd(arg_1):\n            if arg_2 and arg_3 is None:\n                run_as_root(arg_5)\n            elif arg_2:\n                sudo(arg_5, arg_3=arg_3)\n            else:\n                run(arg_5)", "path": "burlap/git.py", "identifier": "GitSatchel.fetch", "docstring": "Fetch changes from the default remote repository.\n\n        This will fetch new changesets, but will not update the contents of\n        the working tree unless yo do a merge or rebase.\n\n        :param path: Path of the working copy directory.  This directory must exist\n                     and be a Git working copy with a default remote to fetch from.\n        :type path: str\n\n        :param use_sudo: If ``True`` execute ``git`` with\n                         :func:`fabric.operations.sudo`, else with\n                         :func:`fabric.operations.run`.\n        :type use_sudo: bool\n\n        :param user: If ``use_sudo is True``, run :func:`fabric.operations.sudo`\n                     with the given user.  If ``use_sudo is False`` this parameter\n                     has no effect.\n        :type user: str\n\n        :type remote: Fetch this remote or default remote if is None\n        :type remote: str", "docstring_tokens": ["Fetch", "changes", "from", "the", "default", "remote", "repository", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 255223}
{"url": "https://github.com/philipsoutham/py-mysql2pgsql/blob/66dc2a3a3119263b3fe77300fb636346509787ef/mysql2pgsql/lib/postgres_db_writer.py#L130-L141", "sha": "66dc2a3a3119263b3fe77300fb636346509787ef", "docstring_summary": "Send DDL to truncate the specified `table`", "language": "python", "parameters": "(self, table)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "super", "(", "PostgresDbWriter", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "execute", "(", "arg_2", ")", "if", "arg_3", ":", "arg_0", ".", "execute", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Send DDL to Func the specified `table`\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None\n        \"\"\"\n        arg_2, arg_3 = super(PostgresDbWriter, arg_0).Func(arg_1)\n        arg_0.execute(arg_2)\n        if arg_3:\n            arg_0.execute(arg_3)", "path": "mysql2pgsql/lib/postgres_db_writer.py", "identifier": "PostgresDbWriter.truncate", "docstring": "Send DDL to truncate the specified `table`\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None", "docstring_tokens": ["Send", "DDL", "to", "truncate", "the", "specified", "table"], "nwo": "philipsoutham/py-mysql2pgsql", "score": 0.632634572866938, "idx": 255224}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/__init__.py#L66-L79", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "update a base based on an image name, meaning detecting a particular\n            registry and if necessary, updating the self.base. When the image\n            name is parsed, the base will be given to remove the registry.", "language": "python", "parameters": "(self, image)", "return_statement": "return base", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "if", "\"gcr.io\"", "in", "arg_1", ":", "arg_2", "=", "'gcr.io'", "arg_0", ".", "_set_base", "(", "default_base", "=", "arg_2", ")", "arg_0", ".", "_update_secrets", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        ''' update a base based on an image name, meaning detecting a particular\n            registry and if necessary, updating the self.base. When the image\n            name is parsed, the base will be given to remove the registry.\n        '''\n        arg_2 = None\n\n        # Google Container Cloud\n        if \"gcr.io\" in arg_1:\n            arg_2 = 'gcr.io'\n            arg_0._set_base(default_base=arg_2)\n            arg_0._update_secrets()\n\n        return arg_2", "path": "sregistry/main/docker/__init__.py", "identifier": "Client._update_base", "docstring": "update a base based on an image name, meaning detecting a particular\n            registry and if necessary, updating the self.base. When the image\n            name is parsed, the base will be given to remove the registry.", "docstring_tokens": ["update", "a", "base", "based", "on", "an", "image", "name", "meaning", "detecting", "a", "particular", "registry", "and", "if", "necessary", "updating", "the", "self", ".", "base", ".", "When", "the", "image", "name", "is", "parsed", "the", "base", "will", "be", "given", "to", "remove", "the", "registry", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 255225}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L233-L256", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Retrieves the status of an in progress or completed design run", "language": "python", "parameters": "(self, data_view_id, run_uuid)", "return_statement": "return ProcessStatus(\n            result=status.get(\"result\"),\n            progress=status.get(\"progress\"),\n            status=status.get(\"status\"),\n            messages=status.get(\"messages\")\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "routes", ".", "get_data_view_design_status", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_get", "(", "arg_3", ")", ".", "json", "(", ")", "arg_5", "=", "arg_4", "[", "\"data\"", "]", "return", "ProcessStatus", "(", "result", "=", "arg_5", ".", "get", "(", "\"result\"", ")", ",", "progress", "=", "arg_5", ".", "get", "(", "\"progress\"", ")", ",", "arg_5", "=", "arg_5", ".", "get", "(", "\"status\"", ")", ",", "messages", "=", "arg_5", ".", "get", "(", "\"messages\"", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Retrieves the status of an in progress or completed design run\n\n        :param data_view_id: The ID number of the data view to which the\n            run belongs, as a string\n        :type data_view_id: str\n        :param run_uuid: The UUID of the design run to retrieve status for\n        :type run_uuid: str\n        :return: A :class:`ProcessStatus` object\n        \"\"\"\n\n        arg_3 = routes.get_data_view_design_status(arg_1, arg_2)\n\n        arg_4 = arg_0._get(arg_3).json()\n\n        arg_5 = arg_4[\"data\"]\n\n        return ProcessStatus(\n            result=arg_5.get(\"result\"),\n            progress=arg_5.get(\"progress\"),\n            arg_5=arg_5.get(\"status\"),\n            messages=arg_5.get(\"messages\")\n        )", "path": "citrination_client/models/client.py", "identifier": "ModelsClient.get_design_run_status", "docstring": "Retrieves the status of an in progress or completed design run\n\n        :param data_view_id: The ID number of the data view to which the\n            run belongs, as a string\n        :type data_view_id: str\n        :param run_uuid: The UUID of the design run to retrieve status for\n        :type run_uuid: str\n        :return: A :class:`ProcessStatus` object", "docstring_tokens": ["Retrieves", "the", "status", "of", "an", "in", "progress", "or", "completed", "design", "run"], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 255226}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Console/screen.py#L385-L441", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Main method to render screen view", "language": "python", "parameters": "(self)", "return_statement": "return self.markup.new_line.join(output) + self.markup.new_line", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "term_width", ",", "arg_0", ".", "term_height", "=", "get_terminal_size", "(", ")", "arg_0", ".", "log", ".", "debug", "(", "\"Terminal size: %sx%s\"", ",", "arg_0", ".", "term_width", ",", "arg_0", ".", "term_height", ")", "arg_0", ".", "right_panel_width", "=", "int", "(", "(", "arg_0", ".", "term_width", "-", "len", "(", "arg_0", ".", "RIGHT_PANEL_SEPARATOR", ")", ")", "*", "(", "float", "(", "arg_0", ".", "info_panel_percent", ")", "/", "100", ")", ")", "-", "1", "if", "arg_0", ".", "right_panel_width", ">", "0", ":", "arg_0", ".", "left_panel_width", "=", "arg_0", ".", "term_width", "-", "arg_0", ".", "right_panel_width", "-", "len", "(", "arg_0", ".", "RIGHT_PANEL_SEPARATOR", ")", "-", "2", "else", ":", "arg_0", ".", "right_panel_width", "=", "0", "arg_0", ".", "left_panel_width", "=", "arg_0", ".", "term_width", "-", "1", "arg_0", ".", "log", ".", "debug", "(", "\"Left/right panels width: %s/%s\"", ",", "arg_0", ".", "left_panel_width", ",", "arg_0", ".", "right_panel_width", ")", "arg_5", "=", "[", "]", "if", "arg_0", ".", "right_panel_width", ":", "arg_5", "=", "[", "]", "arg_0", ".", "log", ".", "debug", "(", "\"There are %d info widgets\"", "%", "len", "(", "arg_0", ".", "info_widgets", ")", ")", "for", "arg_6", ",", "arg_7", "in", "sorted", "(", "arg_0", ".", "info_widgets", ".", "iteritems", "(", ")", ",", "key", "=", "lambda", "item", ":", "(", "item", "[", "1", "]", ".", "get_index", "(", ")", ",", "item", "[", "0", "]", ")", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Rendering info widget #%s: %s\"", ",", "arg_6", ",", "arg_7", ")", "arg_8", "=", "arg_7", ".", "render", "(", "arg_0", ")", ".", "strip", "(", ")", "if", "arg_8", ":", "arg_5", "+=", "arg_8", ".", "split", "(", "\"\\n\"", ")", "arg_5", "+=", "[", "\"\"", "]", "arg_9", "=", "arg_0", ".", "__render_left_panel", "(", ")", "arg_0", ".", "log", ".", "debug", "(", "\"Composing final screen output\"", ")", "arg_10", "=", "[", "]", "for", "arg_11", "in", "range", "(", "1", ",", "arg_0", ".", "term_height", ")", ":", "arg_12", "=", "\" \"", "if", "arg_11", ">", "1", "and", "arg_9", ":", "arg_13", "=", "arg_9", ".", "pop", "(", "0", ")", "arg_14", "=", "arg_0", ".", "markup", ".", "clean_markup", "(", "arg_13", ")", "arg_13", "+=", "(", "' '", "*", "(", "arg_0", ".", "left_panel_width", "-", "len", "(", "arg_14", ")", ")", ")", "arg_12", "+=", "arg_13", "else", ":", "arg_12", "+=", "' '", "*", "arg_0", ".", "left_panel_width", "if", "arg_0", ".", "right_panel_width", ":", "arg_12", "+=", "arg_0", ".", "markup", ".", "RESET", "arg_12", "+=", "arg_0", ".", "markup", ".", "WHITE", "arg_12", "+=", "arg_0", ".", "RIGHT_PANEL_SEPARATOR", "arg_12", "+=", "arg_0", ".", "markup", ".", "RESET", "arg_15", "=", "arg_0", ".", "__get_right_line", "(", "arg_5", ")", "arg_12", "+=", "arg_15", "arg_10", ".", "append", "(", "arg_12", ")", "return", "arg_0", ".", "markup", ".", "new_line", ".", "join", "(", "arg_10", ")", "+", "arg_0", ".", "markup", ".", "new_line"], "function": "def Func(arg_0):\n        '''        Main method to render screen view        '''\n        arg_0.term_width, arg_0.term_height = get_terminal_size()\n        arg_0.log.debug(\n            \"Terminal size: %sx%s\", arg_0.term_width, arg_0.term_height)\n        arg_0.right_panel_width = int(\n            (arg_0.term_width - len(arg_0.RIGHT_PANEL_SEPARATOR))\n            * (float(arg_0.info_panel_percent) / 100)) - 1\n        if arg_0.right_panel_width > 0:\n            arg_0.left_panel_width = arg_0.term_width - \\\n                arg_0.right_panel_width - len(arg_0.RIGHT_PANEL_SEPARATOR) - 2\n        else:\n            arg_0.right_panel_width = 0\n            arg_0.left_panel_width = arg_0.term_width - 1\n        arg_0.log.debug(\n            \"Left/right panels width: %s/%s\", arg_0.left_panel_width,\n            arg_0.right_panel_width)\n\n        arg_5 = []\n        if arg_0.right_panel_width:\n            arg_5 = []\n            arg_0.log.debug(\"There are %d info widgets\" % len(arg_0.info_widgets))\n            for arg_6, arg_7 in sorted(\n                    arg_0.info_widgets.iteritems(),\n                    key=lambda item: (item[1].get_index(), item[0])):\n                arg_0.log.debug(\"Rendering info widget #%s: %s\", arg_6, arg_7)\n                arg_8 = arg_7.render(arg_0).strip()\n                if arg_8:\n                    arg_5 += arg_8.split(\"\\n\")\n                    arg_5 += [\"\"]\n\n        arg_9 = arg_0.__render_left_panel()\n\n        arg_0.log.debug(\"Composing final screen output\")\n        arg_10 = []\n        for arg_11 in range(1, arg_0.term_height):\n            arg_12 = \" \"\n\n            if arg_11 > 1 and arg_9:\n                arg_13 = arg_9.pop(0)\n                arg_14 = arg_0.markup.clean_markup(arg_13)\n\n                arg_13 += (\n                    ' ' * (arg_0.left_panel_width - len(arg_14)))\n                arg_12 += arg_13\n            else:\n                arg_12 += ' ' * arg_0.left_panel_width\n            if arg_0.right_panel_width:\n                arg_12 += arg_0.markup.RESET\n                arg_12 += arg_0.markup.WHITE\n                arg_12 += arg_0.RIGHT_PANEL_SEPARATOR\n                arg_12 += arg_0.markup.RESET\n                arg_15 = arg_0.__get_right_line(arg_5)\n                arg_12 += arg_15\n\n            arg_10.append(arg_12)\n        return arg_0.markup.new_line.join(arg_10) + arg_0.markup.new_line", "path": "yandextank/plugins/Console/screen.py", "identifier": "Screen.render_screen", "docstring": "Main method to render screen view", "docstring_tokens": ["Main", "method", "to", "render", "screen", "view"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 255227}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/core/utils.py#L50-L59", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Recursively iterate lists and tuples", "language": "python", "parameters": "(iterable)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "collections", "import", "Iterable", "for", "arg_1", "in", "arg_0", ":", "if", "isinstance", "(", "arg_1", ",", "Iterable", ")", "and", "not", "isinstance", "(", "arg_1", ",", "(", "str", ",", "bytes", ")", ")", ":", "yield", "from", "flatten", "(", "arg_1", ")", "else", ":", "yield", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Recursively iterate lists and tuples\n    \"\"\"\n    from collections import Iterable\n\n    for arg_1 in arg_0:\n        if isinstance(arg_1, Iterable) and not isinstance(arg_1, (str, bytes)):\n            yield from flatten(arg_1)\n        else: yield arg_1", "path": "xbbg/core/utils.py", "identifier": "_to_gen_", "docstring": "Recursively iterate lists and tuples", "docstring_tokens": ["Recursively", "iterate", "lists", "and", "tuples"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 255228}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Image.py#L141-L149", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Transfer the image", "language": "python", "parameters": "(self, new_region_slug)", "return_statement": "return self.get_data(\n            \"images/%s/actions/\" % self.id,\n            type=POST,\n            params={\"type\": \"transfer\", \"region\": new_region_slug}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "get_data", "(", "\"images/%s/actions/\"", "%", "arg_0", ".", "id", ",", "type", "=", "POST", ",", "params", "=", "{", "\"type\"", ":", "\"Func\"", ",", "\"region\"", ":", "arg_1", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Transfer the image\n        \"\"\"\n        return arg_0.get_data(\n            \"images/%s/actions/\" % arg_0.id,\n            type=POST,\n            params={\"type\": \"Func\", \"region\": arg_1}\n        )", "path": "digitalocean/Image.py", "identifier": "Image.transfer", "docstring": "Transfer the image", "docstring_tokens": ["Transfer", "the", "image"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 255229}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/sampling.py#L7-L115", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Compute the Hausdorff Distance between two meshes, sampling one of the\n        two and finding for each sample the closest point over the other mesh.", "language": "python", "parameters": "(script, sampled_layer=1, target_layer=0,\n                       save_sample=False, sample_vert=True, sample_edge=True,\n                       sample_faux_edge=False, sample_face=True,\n                       sample_num=1000, maxdist=10)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "True", ",", "arg_6", "=", "False", ",", "arg_7", "=", "True", ",", "arg_8", "=", "1000", ",", "arg_9", "=", "10", ")", ":", "arg_10", "=", "2", "*", "arg_9", "arg_11", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Hausdorff Distance\">\\n'", ",", "'    <Param name=\"SampledMesh\" '", ",", "'value=\"{:d}\" '", ".", "format", "(", "arg_1", ")", ",", "'description=\"Sampled Mesh\" '", ",", "'type=\"RichMesh\" '", ",", "'/>\\n'", ",", "'    <Param name=\"TargetMesh\" '", ",", "'value=\"{:d}\" '", ".", "format", "(", "arg_2", ")", ",", "'description=\"Target Mesh\" '", ",", "'type=\"RichMesh\" '", ",", "'/>\\n'", ",", "'    <Param name=\"SaveSample\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_3", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Save Samples\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"SampleVert\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_4", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Sample Vertexes\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"SampleEdge\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_5", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Sample Edges\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"SampleFauxEdge\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_6", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Sample FauxEdge\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"SampleFace\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_7", ")", ".", "lower", "(", ")", ")", ",", "'value=\"%s\" '", "%", "str", "(", "arg_7", ")", ".", "lower", "(", ")", "+", "'description=\"Sample Faces\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"SampleNum\" '", ",", "'value=\"{:d}\" '", ".", "format", "(", "arg_8", ")", ",", "'description=\"Number of samples\" '", ",", "'type=\"RichInt\" '", ",", "'/>\\n'", ",", "'    <Param name=\"MaxDist\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_9", ")", ",", "'value=\"%s\" '", "%", "arg_9", "+", "'description=\"Max Distance\" '", ",", "'min=\"0\" '", ",", "'max=\"{}\" '", ".", "format", "(", "arg_10", ")", ",", "'type=\"RichAbsPerc\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_11", ")", "if", "isinstance", "(", "arg_0", ",", "FilterScript", ")", ":", "arg_0", ".", "parse_hausdorff", "=", "True", "if", "isinstance", "(", "arg_0", ",", "FilterScript", ")", "and", "arg_3", ":", "arg_0", ".", "add_layer", "(", "'Hausdorff Closest Points'", ")", "arg_0", ".", "add_layer", "(", "'Hausdorff Sample Point'", ")", "return", "None"], "function": "def Func(arg_0, arg_1=1, arg_2=0,\n                       arg_3=False, arg_4=True, arg_5=True,\n                       arg_6=False, arg_7=True,\n                       arg_8=1000, arg_9=10):\n    \"\"\" Compute the Hausdorff Distance between two meshes, sampling one of the\n        two and finding for each sample the closest point over the other mesh.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        sampled_layer (int): The mesh layer whose surface is sampled. For each\n            sample we search the closest point on the target mesh layer.\n        target_layer (int): The mesh that is sampled for the comparison.\n        save_sample (bool): Save the position and distance of all the used\n            samples on both the two surfaces, creating two new layers with two\n            point clouds representing the used samples.\n        sample_vert (bool): For the search of maxima it is useful to sample\n            vertices and edges of the mesh with a greater care. It is quite\n            probable that the farthest points falls along edges or on mesh\n            vertexes, and with uniform montecarlo sampling approaches the\n            probability of taking a sample over a vertex or an edge is\n            theoretically null. On the other hand this kind of sampling could\n            make the overall sampling distribution slightly biased and slightly\n            affects the cumulative results.\n        sample_edge (bool): see sample_vert\n        sample_faux_edge (bool): see sample_vert\n        sample_face (bool): see sample_vert\n        sample_num (int): The desired number of samples. It can be smaller or\n            larger than the mesh size, and according to the chosen sampling\n            strategy it will try to adapt.\n        maxdist (int): Sample points for which we do not find anything within\n            this distance are rejected and not considered neither for averaging\n            nor for max.\n\n    Layer stack:\n        If save_sample is True, two new layers are created: 'Hausdorff Closest\n            Points' and 'Hausdorff Sample Point'; and the current layer is\n            changed to the last newly created layer.\n        If save_sample is False, no impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    # MeshLab defaults:\n    #  sample_num = number of vertices\n    #  maxdist = 0.05 * AABB['diag'] #5% of AABB[diag]\n    #  maxdist_max = AABB['diag']\n    arg_10 = 2*arg_9\n    # TODO: parse output (min, max, mean, etc.)\n    arg_11 = ''.join([\n        '  <filter name=\"Hausdorff Distance\">\\n',\n        '    <Param name=\"SampledMesh\" ',\n        'value=\"{:d}\" '.format(arg_1),\n        'description=\"Sampled Mesh\" ',\n        'type=\"RichMesh\" ',\n        '/>\\n',\n        '    <Param name=\"TargetMesh\" ',\n        'value=\"{:d}\" '.format(arg_2),\n        'description=\"Target Mesh\" ',\n        'type=\"RichMesh\" ',\n        '/>\\n',\n        '    <Param name=\"SaveSample\" ',\n        'value=\"{}\" '.format(str(arg_3).lower()),\n        'description=\"Save Samples\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"SampleVert\" ',\n        'value=\"{}\" '.format(str(arg_4).lower()),\n        'description=\"Sample Vertexes\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"SampleEdge\" ',\n        'value=\"{}\" '.format(str(arg_5).lower()),\n        'description=\"Sample Edges\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"SampleFauxEdge\" ',\n        'value=\"{}\" '.format(str(arg_6).lower()),\n        'description=\"Sample FauxEdge\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"SampleFace\" ',\n        'value=\"{}\" '.format(str(arg_7).lower()),\n        'value=\"%s\" ' % str(arg_7).lower() +\n        'description=\"Sample Faces\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"SampleNum\" ',\n        'value=\"{:d}\" '.format(arg_8),\n        'description=\"Number of samples\" ',\n        'type=\"RichInt\" ',\n        '/>\\n',\n        '    <Param name=\"MaxDist\" ',\n        'value=\"{}\" '.format(arg_9),\n        'value=\"%s\" ' % arg_9 +\n        'description=\"Max Distance\" ',\n        'min=\"0\" ',\n        'max=\"{}\" '.format(arg_10),\n        'type=\"RichAbsPerc\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_11)\n    if isinstance(arg_0, FilterScript):\n        arg_0.parse_hausdorff = True\n    if isinstance(arg_0, FilterScript) and arg_3:\n        arg_0.add_layer('Hausdorff Closest Points')\n        arg_0.add_layer('Hausdorff Sample Point')\n    return None", "path": "meshlabxml/sampling.py", "identifier": "hausdorff_distance", "docstring": "Compute the Hausdorff Distance between two meshes, sampling one of the\n        two and finding for each sample the closest point over the other mesh.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        sampled_layer (int): The mesh layer whose surface is sampled. For each\n            sample we search the closest point on the target mesh layer.\n        target_layer (int): The mesh that is sampled for the comparison.\n        save_sample (bool): Save the position and distance of all the used\n            samples on both the two surfaces, creating two new layers with two\n            point clouds representing the used samples.\n        sample_vert (bool): For the search of maxima it is useful to sample\n            vertices and edges of the mesh with a greater care. It is quite\n            probable that the farthest points falls along edges or on mesh\n            vertexes, and with uniform montecarlo sampling approaches the\n            probability of taking a sample over a vertex or an edge is\n            theoretically null. On the other hand this kind of sampling could\n            make the overall sampling distribution slightly biased and slightly\n            affects the cumulative results.\n        sample_edge (bool): see sample_vert\n        sample_faux_edge (bool): see sample_vert\n        sample_face (bool): see sample_vert\n        sample_num (int): The desired number of samples. It can be smaller or\n            larger than the mesh size, and according to the chosen sampling\n            strategy it will try to adapt.\n        maxdist (int): Sample points for which we do not find anything within\n            this distance are rejected and not considered neither for averaging\n            nor for max.\n\n    Layer stack:\n        If save_sample is True, two new layers are created: 'Hausdorff Closest\n            Points' and 'Hausdorff Sample Point'; and the current layer is\n            changed to the last newly created layer.\n        If save_sample is False, no impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Compute", "the", "Hausdorff", "Distance", "between", "two", "meshes", "sampling", "one", "of", "the", "two", "and", "finding", "for", "each", "sample", "the", "closest", "point", "over", "the", "other", "mesh", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 255230}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/floating_ips.py#L358-L391", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Allocate or reallocate a floating IP.", "language": "python", "parameters": "(context, content)", "return_statement": "return v._make_floating_ip_dict(flip, port_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "'Func %s for tenant %s and body %s'", "%", "(", "id", ",", "arg_0", ".", "tenant_id", ",", "arg_1", ")", ")", "arg_2", "=", "arg_1", ".", "get", "(", "'floating_network_id'", ")", "if", "not", "arg_2", ":", "raise", "n_exc", ".", "BadRequest", "(", "resource", "=", "'floating_ip'", ",", "msg", "=", "'floating_network_id is required.'", ")", "arg_3", "=", "arg_1", ".", "get", "(", "'fixed_ip_address'", ")", "arg_4", "=", "arg_1", ".", "get", "(", "'floating_ip_address'", ")", "arg_5", "=", "arg_1", ".", "get", "(", "'port_id'", ")", "arg_6", "=", "None", "arg_7", "=", "{", "}", "arg_8", "=", "_get_network", "(", "arg_0", ",", "arg_2", ")", "if", "arg_5", ":", "arg_6", "=", "_get_port", "(", "arg_0", ",", "arg_5", ")", "arg_9", "=", "_get_fixed_ip", "(", "arg_0", ",", "arg_3", ",", "arg_6", ")", "arg_7", "=", "{", "arg_6", ".", "id", ":", "{", "'port'", ":", "arg_6", ",", "'fixed_ip'", ":", "arg_9", "}", "}", "arg_10", "=", "_allocate_ip", "(", "arg_0", ",", "arg_8", ",", "arg_6", ",", "arg_4", ",", "ip_types", ".", "FLOATING", ")", "_create_flip", "(", "arg_0", ",", "arg_10", ",", "arg_7", ")", "return", "v", ".", "_make_floating_ip_dict", "(", "arg_10", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Allocate or reallocate a floating IP.\n\n    :param context: neutron api request context.\n    :param content: dictionary describing the floating ip, with keys\n        as listed in the RESOURCE_ATTRIBUTE_MAP object in\n        neutron/api/v2/attributes.py.  All keys will be populated.\n\n    :returns: Dictionary containing details for the new floating IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.\n    \"\"\"\n    LOG.info('Func %s for tenant %s and body %s' %\n             (id, arg_0.tenant_id, arg_1))\n    arg_2 = arg_1.get('floating_network_id')\n    # TODO(blogan): Since the extension logic will reject any requests without\n    # floating_network_id, is this still needed?\n    if not arg_2:\n        raise n_exc.BadRequest(resource='floating_ip',\n                               msg='floating_network_id is required.')\n    arg_3 = arg_1.get('fixed_ip_address')\n    arg_4 = arg_1.get('floating_ip_address')\n    arg_5 = arg_1.get('port_id')\n    arg_6 = None\n    arg_7 = {}\n\n    arg_8 = _get_network(arg_0, arg_2)\n    if arg_5:\n        arg_6 = _get_port(arg_0, arg_5)\n        arg_9 = _get_fixed_ip(arg_0, arg_3, arg_6)\n        arg_7 = {arg_6.id: {'port': arg_6, 'fixed_ip': arg_9}}\n    arg_10 = _allocate_ip(arg_0, arg_8, arg_6, arg_4, ip_types.FLOATING)\n    _create_flip(arg_0, arg_10, arg_7)\n    return v._make_floating_ip_dict(arg_10, arg_5)", "path": "quark/plugin_modules/floating_ips.py", "identifier": "create_floatingip", "docstring": "Allocate or reallocate a floating IP.\n\n    :param context: neutron api request context.\n    :param content: dictionary describing the floating ip, with keys\n        as listed in the RESOURCE_ATTRIBUTE_MAP object in\n        neutron/api/v2/attributes.py.  All keys will be populated.\n\n    :returns: Dictionary containing details for the new floating IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.", "docstring_tokens": ["Allocate", "or", "reallocate", "a", "floating", "IP", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255231}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/context/headless.py#L73-L81", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Headless window currently don't support double buffering.\n        We only increment the frame counter here.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "frames", "+=", "1", "if", "arg_0", ".", "headless_frames", "and", "arg_0", ".", "frames", ">=", "arg_0", ".", "headless_frames", ":", "arg_0", ".", "close", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Headless window currently don't support double buffering.\n        We only increment the frame counter here.\n        \"\"\"\n        arg_0.frames += 1\n\n        if arg_0.headless_frames and arg_0.frames >= arg_0.headless_frames:\n            arg_0.close()", "path": "demosys/context/headless.py", "identifier": "Window.swap_buffers", "docstring": "Headless window currently don't support double buffering.\n        We only increment the frame counter here.", "docstring_tokens": ["Headless", "window", "currently", "don", "t", "support", "double", "buffering", ".", "We", "only", "increment", "the", "frame", "counter", "here", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 255232}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/agent/xapi.py#L144-L159", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Returns a set of VIFs from `get_instances` return value.", "language": "python", "parameters": "(self)", "return_statement": "return interfaces", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "LOG", ".", "debug", "(", "\"Getting interfaces from Xapi\"", ")", "with", "arg_0", ".", "sessioned", "(", ")", "as", "session", ":", "arg_1", "=", "arg_0", ".", "get_instances", "(", "session", ")", "arg_2", "=", "session", ".", "xenapi", ".", "VIF", ".", "get_all_records", "(", ")", "arg_3", "=", "set", "(", ")", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "iteritems", "(", ")", ":", "arg_6", "=", "arg_1", ".", "get", "(", "arg_5", "[", "\"VM\"", "]", ")", "if", "not", "arg_6", ":", "continue", "arg_7", "=", "arg_6", ".", "uuid", "arg_3", ".", "add", "(", "VIF", "(", "arg_7", ",", "arg_5", ",", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Returns a set of VIFs from `get_instances` return value.\"\"\"\n        LOG.debug(\"Getting interfaces from Xapi\")\n\n        with arg_0.sessioned() as session:\n            arg_1 = arg_0.get_instances(session)\n            arg_2 = session.xenapi.VIF.get_all_records()\n\n        arg_3 = set()\n        for arg_4, arg_5 in arg_2.iteritems():\n            arg_6 = arg_1.get(arg_5[\"VM\"])\n            if not arg_6:\n                continue\n            arg_7 = arg_6.uuid\n            arg_3.add(VIF(arg_7, arg_5, arg_4))\n        return arg_3", "path": "quark/agent/xapi.py", "identifier": "XapiClient.get_interfaces", "docstring": "Returns a set of VIFs from `get_instances` return value.", "docstring_tokens": ["Returns", "a", "set", "of", "VIFs", "from", "get_instances", "return", "value", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255233}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/sigproc.py#L327-L347", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Convert an astropy.Angle to the ridiculous sigproc angle format string.", "language": "python", "parameters": "(angle_val)", "return_statement": "return np.float64(num).tostring()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "str", "(", "arg_0", ")", "if", "'.'", "in", "arg_1", ":", "if", "'h'", "in", "arg_1", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "int", "(", "arg_1", "[", "0", ":", "arg_1", ".", "index", "(", "'h'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'h'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'m'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'m'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'.'", ")", "]", ")", ",", "float", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'.'", ")", ":", "arg_1", ".", "index", "(", "'s'", ")", "]", ")", "if", "'d'", "in", "arg_1", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "int", "(", "arg_1", "[", "0", ":", "arg_1", ".", "index", "(", "'d'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'d'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'m'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'m'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'.'", ")", "]", ")", ",", "float", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'.'", ")", ":", "arg_1", ".", "index", "(", "'s'", ")", "]", ")", "else", ":", "if", "'h'", "in", "arg_1", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "int", "(", "arg_1", "[", "0", ":", "arg_1", ".", "index", "(", "'h'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'h'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'m'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'m'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'s'", ")", "]", ")", "if", "'d'", "in", "arg_1", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "int", "(", "arg_1", "[", "0", ":", "arg_1", ".", "index", "(", "'d'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'d'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'m'", ")", "]", ")", ",", "int", "(", "arg_1", "[", "arg_1", ".", "index", "(", "'m'", ")", "+", "1", ":", "arg_1", ".", "index", "(", "'s'", ")", "]", ")", "arg_5", "=", "0", "arg_6", "=", "str", "(", "arg_2", ")", ".", "zfill", "(", "2", ")", "+", "str", "(", "arg_3", ")", ".", "zfill", "(", "2", ")", "+", "str", "(", "arg_4", ")", ".", "zfill", "(", "2", ")", "+", "'.'", "+", "str", "(", "arg_5", ")", ".", "split", "(", "\".\"", ")", "[", "-", "1", "]", "return", "np", ".", "float64", "(", "arg_6", ")", ".", "tostring", "(", ")"], "function": "def Func(arg_0):\n    \"\"\" Convert an astropy.Angle to the ridiculous sigproc angle format string. \"\"\"\n    arg_1 = str(arg_0)\n\n    if '.' in arg_1:\n        if 'h' in arg_1:\n                arg_2, arg_3, arg_4, arg_5 = int(arg_1[0:arg_1.index('h')]), int(arg_1[arg_1.index('h')+1:arg_1.index('m')]), \\\n                int(arg_1[arg_1.index('m')+1:arg_1.index('.')]), float(arg_1[arg_1.index('.'):arg_1.index('s')])\n        if 'd' in arg_1:\n            arg_2, arg_3, arg_4, arg_5 = int(arg_1[0:arg_1.index('d')]), int(arg_1[arg_1.index('d')+1:arg_1.index('m')]), \\\n            int(arg_1[arg_1.index('m')+1:arg_1.index('.')]), float(arg_1[arg_1.index('.'):arg_1.index('s')])\n    else:\n        if 'h' in arg_1:\n            arg_2, arg_3, arg_4 = int(arg_1[0:arg_1.index('h')]), int(arg_1[arg_1.index('h')+1:arg_1.index('m')]), \\\n            int(arg_1[arg_1.index('m')+1:arg_1.index('s')])\n        if 'd' in arg_1:\n            arg_2, arg_3, arg_4 = int(arg_1[0:arg_1.index('d')]), int(arg_1[arg_1.index('d')+1:arg_1.index('m')]), \\\n            int(arg_1[arg_1.index('m')+1:arg_1.index('s')])\n        arg_5 = 0\n    arg_6 = str(arg_2).zfill(2) + str(arg_3).zfill(2) + str(arg_4).zfill(2)+ '.' + str(arg_5).split(\".\")[-1]\n    return np.float64(arg_6).tostring()", "path": "blimpy/sigproc.py", "identifier": "to_sigproc_angle", "docstring": "Convert an astropy.Angle to the ridiculous sigproc angle format string.", "docstring_tokens": ["Convert", "an", "astropy", ".", "Angle", "to", "the", "ridiculous", "sigproc", "angle", "format", "string", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 255234}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/recipe.py#L165-L235", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Builds the downstream pipeline of the current process", "language": "python", "parameters": "(self, process_descriptions, task, all_tasks,\n                         task_pipeline,\n                         count_forks, total_tasks, forks)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "if", "arg_2", "in", "arg_1", ":", "if", "arg_1", "[", "arg_2", "]", "[", "2", "]", "is", "not", "None", ":", "if", "len", "(", "arg_1", "[", "arg_2", "]", "[", "2", "]", ".", "split", "(", "\"|\"", ")", ")", ">", "1", ":", "arg_8", "=", "arg_1", "[", "arg_2", "]", "[", "2", "]", ".", "split", "(", "\"|\"", ")", "for", "arg_9", "in", "arg_8", ":", "if", "arg_9", "in", "arg_6", ":", "arg_5", "+=", "1", "arg_4", ".", "append", "(", "arg_1", "[", "arg_2", "]", "[", "2", "]", ")", "arg_0", ".", "define_pipeline_string", "(", "arg_1", ",", "arg_9", ",", "False", ",", "True", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "return", "arg_4", "else", ":", "if", "arg_1", "[", "arg_2", "]", "[", "2", "]", "in", "arg_6", ":", "arg_4", ".", "append", "(", "arg_1", "[", "arg_2", "]", "[", "2", "]", ".", "split", "(", "\"|\"", ")", "[", "0", "]", ")", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_1", "[", "arg_2", "]", "[", "2", "]", ".", "split", "(", "\"|\"", ")", "[", "0", "]", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "return", "arg_4", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                         arg_4,\n                         arg_5, arg_6, arg_7):\n        \"\"\"Builds the downstream pipeline of the current process\n\n        Checks for the downstream processes to the current process and\n        adds them to the current pipeline fragment.\n\n        Parameters\n        ----------\n        process_descriptions : dict\n            Information of processes input, output and if is forkable\n        task : str\n            Current process\n        all_tasks : list\n            A list of all provided processes\n        task_pipeline : list\n            Current pipeline fragment\n        count_forks : int\n            Current number of forks\n        total_tasks : str\n            All space separated processes\n        forks : list\n            Current forks\n        Returns\n        -------\n        list : resulting pipeline fragment\n        \"\"\"\n\n        if arg_2 in arg_1:\n            if arg_1[arg_2][2] is not None:\n                if len(arg_1[arg_2][2].split(\"|\")) > 1:\n                    arg_8 = arg_1[arg_2][2].split(\"|\")\n\n                    # Adds the process to the pipeline fragment downstream\n                    # and defines a new pipeline fragment for each fork.\n                    # Those will only look for downstream processes\n                    for arg_9 in arg_8:\n                        if arg_9 in arg_6:\n                            arg_5 += 1\n                            arg_4.append(arg_1[arg_2][2])\n                            arg_0.define_pipeline_string(\n                                arg_1,\n                                arg_9,\n                                False,\n                                True,\n                                arg_5,\n                                arg_6,\n                                arg_7\n                            )\n\n                    return arg_4\n                else:\n                    if arg_1[arg_2][2] in arg_6:\n                        arg_4.append(arg_1[arg_2][2].split(\"|\")[0])\n\n                        # Proceeds building downstream until the output for a\n                        # process is None\n                        arg_0.Func(\n                            arg_1,\n                            arg_1[arg_2][2].split(\"|\")[0],\n                            arg_3,\n                            arg_4,\n                            arg_5,\n                            arg_6,\n                            arg_7\n                        )\n\n                    return arg_4\n            else:\n                return arg_4", "path": "flowcraft/generator/recipe.py", "identifier": "InnuendoRecipe.build_downstream", "docstring": "Builds the downstream pipeline of the current process\n\n        Checks for the downstream processes to the current process and\n        adds them to the current pipeline fragment.\n\n        Parameters\n        ----------\n        process_descriptions : dict\n            Information of processes input, output and if is forkable\n        task : str\n            Current process\n        all_tasks : list\n            A list of all provided processes\n        task_pipeline : list\n            Current pipeline fragment\n        count_forks : int\n            Current number of forks\n        total_tasks : str\n            All space separated processes\n        forks : list\n            Current forks\n        Returns\n        -------\n        list : resulting pipeline fragment", "docstring_tokens": ["Builds", "the", "downstream", "pipeline", "of", "the", "current", "process"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 255235}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3030-L3038", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Remove rows with NAs from the H2OFrame.", "language": "python", "parameters": "(self)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"na.omit\"", ",", "arg_0", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")", "arg_1", ".", "_ex", ".", "_cache", ".", "nrows", "=", "-", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Remove rows with NAs from the H2OFrame.\n\n        :returns: new H2OFrame with all rows from the original frame containing any NAs removed.\n        \"\"\"\n        arg_1 = H2OFrame._expr(expr=ExprNode(\"na.omit\", arg_0), cache=arg_0._ex._cache)\n        arg_1._ex._cache.nrows = -1\n        return arg_1", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.na_omit", "docstring": "Remove rows with NAs from the H2OFrame.\n\n        :returns: new H2OFrame with all rows from the original frame containing any NAs removed.", "docstring_tokens": ["Remove", "rows", "with", "NAs", "from", "the", "H2OFrame", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255236}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/utils.py#L52-L57", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Collect entry points.", "language": "python", "parameters": "()", "return_statement": "return things", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "dict", "(", ")", "for", "arg_1", "in", "iter_entry_points", "(", "group", "=", "'invenio_migrator.things'", ")", ":", "arg_0", "[", "arg_1", ".", "name", "]", "=", "arg_1", ".", "load", "(", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Collect entry points.\"\"\"\n    arg_0 = dict()\n    for arg_1 in iter_entry_points(group='invenio_migrator.things'):\n        arg_0[arg_1.name] = arg_1.load()\n    return arg_0", "path": "invenio_migrator/legacy/utils.py", "identifier": "collect_things_entry_points", "docstring": "Collect entry points.", "docstring_tokens": ["Collect", "entry", "points", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 255237}
{"url": "https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L435-L445", "sha": "b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b", "docstring_summary": "Yields all parents of this element, back to the root element.", "language": "python", "parameters": "(self, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "parent", "while", "arg_2", "is", "not", "None", ":", "if", "arg_1", "is", "None", "or", "arg_2", ".", "tagname", "==", "arg_1", ":", "yield", "arg_2", "arg_2", "=", "arg_2", ".", "parent"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Yields all Func of this element, back to the root element.\n\n        :param name: If specified, only consider elements with this tag name\n        \"\"\"\n        arg_2 = arg_0.parent\n        while arg_2 is not None:\n            if arg_1 is None or arg_2.tagname == arg_1:\n                yield arg_2\n            arg_2 = arg_2.parent", "path": "drill.py", "identifier": "XmlElement.parents", "docstring": "Yields all parents of this element, back to the root element.\n\n        :param name: If specified, only consider elements with this tag name", "docstring_tokens": ["Yields", "all", "parents", "of", "this", "element", "back", "to", "the", "root", "element", "."], "nwo": "dcwatson/drill", "score": 0.14991498758945482, "idx": 255238}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L1029-L1059", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read the contents of a stream as a Lisp expression.", "language": "python", "parameters": "(\n    stream,\n    resolver: Resolver = None,\n    data_readers: DataReaders = None,\n    eof: Any = EOF,\n    is_eof_error: bool = False,\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "=", "None", ",", "arg_3", ":", "arg_4", "=", "None", ",", "arg_5", ":", "arg_6", "=", "arg_7", ",", "arg_8", ":", "arg_9", "=", "False", ",", ")", "->", "Iterable", "[", "ReaderForm", "]", ":", "arg_10", "=", "StreamReader", "(", "arg_0", ")", "arg_11", "=", "ReaderContext", "(", "arg_10", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")", "while", "True", ":", "arg_12", "=", "_Func_next", "(", "arg_11", ")", "if", "arg_12", "is", "arg_11", ".", "eof", ":", "if", "arg_8", ":", "raise", "EOFError", "return", "if", "arg_12", "is", "COMMENT", "or", "isinstance", "(", "arg_12", ",", "Comment", ")", ":", "continue", "yield", "arg_12"], "function": "def Func(\n    arg_0,\n    arg_1: arg_2 = None,\n    arg_3: arg_4 = None,\n    arg_5: arg_6 = arg_7,\n    arg_8: arg_9 = False,\n) -> Iterable[ReaderForm]:\n    \"\"\"Read the contents of a stream as a Lisp expression.\n\n    Callers may optionally specify a namespace resolver, which will be used\n    to adjudicate the fully-qualified name of symbols appearing inside of\n    a syntax quote.\n\n    Callers may optionally specify a map of custom data Funcers that will\n    be used to resolve values in Funcer macros. Data Funcer tags specified\n    by callers must be namespaced symbols; non-namespaced symbols are\n    reserved by the Funcer. Data Funcer functions must be functions taking\n    one argument and returning a value.\n\n    The caller is responsible for closing the input stream.\"\"\"\n    arg_10 = StreamReader(arg_0)\n    arg_11 = ReaderContext(arg_10, arg_1=arg_1, arg_3=arg_3, arg_5=arg_5)\n    while True:\n        arg_12 = _Func_next(arg_11)\n        if arg_12 is arg_11.eof:\n            if arg_8:\n                raise EOFError\n            return\n        if arg_12 is COMMENT or isinstance(arg_12, Comment):\n            continue\n        yield arg_12", "path": "src/basilisp/lang/reader.py", "identifier": "read", "docstring": "Read the contents of a stream as a Lisp expression.\n\n    Callers may optionally specify a namespace resolver, which will be used\n    to adjudicate the fully-qualified name of symbols appearing inside of\n    a syntax quote.\n\n    Callers may optionally specify a map of custom data readers that will\n    be used to resolve values in reader macros. Data reader tags specified\n    by callers must be namespaced symbols; non-namespaced symbols are\n    reserved by the reader. Data reader functions must be functions taking\n    one argument and returning a value.\n\n    The caller is responsible for closing the input stream.", "docstring_tokens": ["Read", "the", "contents", "of", "a", "stream", "as", "a", "Lisp", "expression", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255239}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/split_fasta.py#L52-L84", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Main executor of the split_fasta template.", "language": "python", "parameters": "(sample_id, assembly, min_size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "logger", ".", "info", "(", "\"Starting script\"", ")", "arg_3", "=", "open", "(", "arg_1", ",", "\"rU\"", ")", "arg_4", "=", "(", "x", "[", "1", "]", "for", "x", "in", "groupby", "(", "arg_3", ",", "lambda", "line", ":", "line", "[", "0", "]", "==", "\">\"", ")", ")", "arg_5", "=", "0", "for", "arg_6", "in", "arg_4", ":", "arg_7", "=", "arg_6", ".", "__next__", "(", ")", "[", "1", ":", "]", ".", "strip", "(", ")", "arg_8", "=", "\"\"", ".", "join", "(", "s", ".", "strip", "(", ")", "for", "s", "in", "arg_4", ".", "__next__", "(", ")", ")", "if", "len", "(", "arg_8", ")", ">=", "arg_2", ":", "with", "open", "(", "arg_0", "+", "'_'", "+", "arg_7", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", ".", "replace", "(", "\"=\"", ",", "\"_\"", ")", "+", "'.fasta'", ",", "\"w\"", ")", "as", "output_file", ":", "output_file", ".", "write", "(", "\">\"", "+", "arg_0", "+", "\"_\"", "+", "arg_7", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", ".", "replace", "(", "\"=\"", ",", "\"_\"", ")", "+", "\"\\\\n\"", "+", "arg_8", "+", "\"\\\\n\"", ")", "arg_5", "+=", "1", "arg_3", ".", "close", "(", ")", "logger", ".", "info", "(", "\"{} sequences sucessfully splitted.\"", ".", "format", "(", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Main executor of the split_fasta template.\n\n    Parameters\n    ----------\n    sample_id : str\n        Sample Identification string.\n    assembly : list\n        Assembly file.\n    min_size : int\n        Minimum contig size.\n\n    \"\"\"\n\n    logger.info(\"Starting script\")\n\n    arg_3 = open(arg_1, \"rU\")\n\n    arg_4 = (x[1] for x in groupby(arg_3, lambda line: line[0] == \">\"))\n\n    arg_5 = 0\n\n    for arg_6 in arg_4:\n        arg_7 = arg_6.__next__()[1:].strip()\n        arg_8 = \"\".join(s.strip() for s in arg_4.__next__())\n        if len(arg_8) >= arg_2:\n            with open(arg_0 + '_' + arg_7.replace(\" \",\"_\").replace(\"=\",\"_\") + '.fasta', \"w\") as output_file:\n                output_file.write(\">\" + arg_0 + \"_\" + arg_7.replace(\" \",\"_\").replace(\"=\",\"_\") + \"\\\\n\" + arg_8 + \"\\\\n\")\n                arg_5 += 1\n\n    arg_3.close()\n\n    logger.info(\"{} sequences sucessfully splitted.\".format(arg_5))", "path": "flowcraft/templates/split_fasta.py", "identifier": "main", "docstring": "Main executor of the split_fasta template.\n\n    Parameters\n    ----------\n    sample_id : str\n        Sample Identification string.\n    assembly : list\n        Assembly file.\n    min_size : int\n        Minimum contig size.", "docstring_tokens": ["Main", "executor", "of", "the", "split_fasta", "template", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 255240}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L671-L711", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the Nonce struct and decode it into its\n        constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "Nonce", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "NONCE_ID", ",", "arg_6", ")", ":", "arg_0", ".", "_nonce_id", "=", "primitives", ".", "ByteString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "NONCE_ID", ")", "arg_0", ".", "_nonce_id", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Nonce encoding missing the nonce ID.\"", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "NONCE_VALUE", ",", "arg_6", ")", ":", "arg_0", ".", "_nonce_value", "=", "primitives", ".", "ByteString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "NONCE_VALUE", ")", "arg_0", ".", "_nonce_value", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Nonce encoding missing the nonce value.\"", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the Nonce struct and decode it into its\n        constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the nonce ID or nonce value is missing from\n                the encoding.\n        \"\"\"\n        super(Nonce, arg_0).Func(arg_1, arg_2=arg_2)\n        arg_6 = BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.NONCE_ID, arg_6):\n            arg_0._nonce_id = primitives.ByteString(\n                tag=arg_3.Tags.NONCE_ID\n            )\n            arg_0._nonce_id.Func(arg_6, arg_2=arg_2)\n        else:\n            raise ValueError(\n                \"Nonce encoding missing the nonce ID.\"\n            )\n\n        if arg_0.is_tag_next(arg_3.Tags.NONCE_VALUE, arg_6):\n            arg_0._nonce_value = primitives.ByteString(\n                tag=arg_3.Tags.NONCE_VALUE\n            )\n            arg_0._nonce_value.Func(arg_6, arg_2=arg_2)\n        else:\n            raise ValueError(\n                \"Nonce encoding missing the nonce value.\"\n            )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/objects.py", "identifier": "Nonce.read", "docstring": "Read the data encoding the Nonce struct and decode it into its\n        constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the nonce ID or nonce value is missing from\n                the encoding.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "Nonce", "struct", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 255241}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/logs.py#L118-L153", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Logs the WHOIS record if needed.", "language": "python", "parameters": "(self, record)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"debug\"", "]", "and", "PyFunceble", ".", "CONFIGURATION", "[", "\"logs\"", "]", ":", "if", "PyFunceble", ".", "INTERN", "[", "\"referer\"", "]", ":", "arg_2", "=", "PyFunceble", ".", "INTERN", "[", "\"referer\"", "]", "else", ":", "arg_2", "=", "None", "arg_3", "=", "{", "arg_0", ".", "current_time", ":", "{", "\"domain\"", ":", "PyFunceble", ".", "INTERN", "[", "\"to_test\"", "]", ",", "\"record\"", ":", "arg_1", ",", "\"referer\"", ":", "arg_2", ",", "}", "}", "if", "arg_0", ".", "output", ":", "arg_4", "=", "arg_0", ".", "output", "else", ":", "arg_4", "=", "PyFunceble", ".", "OUTPUT_DIRECTORY", "arg_4", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"parent_directory\"", "]", "arg_4", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"logs\"", "]", "[", "\"directories\"", "]", "[", "\"parent\"", "]", "arg_4", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"logs\"", "]", "[", "\"filenames\"", "]", "[", "\"Func\"", "]", "arg_5", "=", "arg_0", ".", "_get_content", "(", "arg_4", ")", "arg_5", ".", "update", "(", "arg_3", ")", "arg_0", ".", "_write_content", "(", "arg_5", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Logs the WHOIS record if needed.\n\n        :param record: The record to log.\n        :type record: str\n        \"\"\"\n\n        if PyFunceble.CONFIGURATION[\"debug\"] and PyFunceble.CONFIGURATION[\"logs\"]:\n            # The debug and the logs subsystem are activated.\n\n            if PyFunceble.INTERN[\"referer\"]:\n                arg_2 = PyFunceble.INTERN[\"referer\"]\n            else:\n                arg_2 = None\n\n            arg_3 = {\n                arg_0.current_time: {\n                    \"domain\": PyFunceble.INTERN[\"to_test\"],\n                    \"record\": arg_1,\n                    \"referer\": arg_2,\n                }\n            }\n\n            if arg_0.output:\n                arg_4 = arg_0.output\n            else:\n                arg_4 = PyFunceble.OUTPUT_DIRECTORY\n                arg_4 += PyFunceble.OUTPUTS[\"parent_directory\"]\n                arg_4 += PyFunceble.OUTPUTS[\"logs\"][\"directories\"][\"parent\"]\n                arg_4 += PyFunceble.OUTPUTS[\"logs\"][\"filenames\"][\"Func\"]\n\n            arg_5 = arg_0._get_content(arg_4)\n            arg_5.update(arg_3)\n\n            arg_0._write_content(arg_5, arg_4)", "path": "PyFunceble/logs.py", "identifier": "Logs.whois", "docstring": "Logs the WHOIS record if needed.\n\n        :param record: The record to log.\n        :type record: str", "docstring_tokens": ["Logs", "the", "WHOIS", "record", "if", "needed", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 255242}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/policy_tracked_resources_operations.py#L43-L120", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Queries policy tracked resources under the management group.", "language": "python", "parameters": "(\n            self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "**", "arg_5", ")", ":", "arg_6", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_6", "=", "arg_2", ".", "top", "arg_7", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_7", "=", "arg_2", ".", "filter", "def", "internal_paging", "(", "arg_8", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "not", "arg_8", ":", "arg_9", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_10", "=", "{", "'managementGroupsNamespace'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.management_groups_namespace\"", ",", "arg_0", ".", "management_groups_namespace", ",", "'str'", ")", ",", "'managementGroupName'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"management_group_name\"", ",", "arg_1", ",", "'str'", ")", ",", "'policyTrackedResourcesResource'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.policy_tracked_resources_resource\"", ",", "arg_0", ".", "policy_tracked_resources_resource", ",", "'str'", ")", "}", "arg_9", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_9", ",", "**", "arg_10", ")", "arg_11", "=", "{", "}", "arg_11", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "if", "arg_6", "is", "not", "None", ":", "arg_11", "[", "'$top'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"top\"", ",", "arg_6", ",", "'int'", ",", "minimum", "=", "0", ")", "if", "arg_7", "is", "not", "None", ":", "arg_11", "[", "'$filter'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"filter\"", ",", "arg_7", ",", "'str'", ")", "else", ":", "arg_9", "=", "arg_8", "arg_11", "=", "{", "}", "arg_12", "=", "{", "}", "arg_12", "[", "'Accept'", "]", "=", "'application/json'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_12", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_3", ":", "arg_12", ".", "update", "(", "arg_3", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_12", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_13", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_9", ",", "arg_11", ",", "arg_12", ")", "arg_14", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_13", ",", "stream", "=", "False", ",", "**", "arg_5", ")", "if", "arg_14", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "QueryFailureException", "(", "arg_0", ".", "_deserialize", ",", "arg_14", ")", "return", "arg_14", "arg_15", "=", "models", ".", "PolicyTrackedResourcePaged", "(", "internal_paging", ",", "arg_0", ".", "_deserialize", ".", "dependencies", ")", "if", "arg_4", ":", "arg_16", "=", "{", "}", "arg_17", "=", "models", ".", "PolicyTrackedResourcePaged", "(", "internal_paging", ",", "arg_0", ".", "_deserialize", ".", "dependencies", ",", "arg_16", ")", "return", "arg_17", "return", "arg_15"], "function": "def Func(\n            arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False, **arg_5):\n        \"\"\"Queries policy tracked resources under the management group.\n\n        :param management_group_name: Management group name.\n        :type management_group_name: str\n        :param query_options: Additional parameters for the operation\n        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: An iterator like instance of PolicyTrackedResource\n        :rtype:\n         ~azure.mgmt.policyinsights.models.PolicyTrackedResourcePaged[~azure.mgmt.policyinsights.models.PolicyTrackedResource]\n        :raises:\n         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`\n        \"\"\"\n        arg_6 = None\n        if arg_2 is not None:\n            arg_6 = arg_2.top\n        arg_7 = None\n        if arg_2 is not None:\n            arg_7 = arg_2.filter\n\n        def internal_paging(arg_8=None, arg_4=False):\n\n            if not arg_8:\n                # Construct URL\n                arg_9 = arg_0.Func.metadata['url']\n                arg_10 = {\n                    'managementGroupsNamespace': arg_0._serialize.url(\"self.management_groups_namespace\", arg_0.management_groups_namespace, 'str'),\n                    'managementGroupName': arg_0._serialize.url(\"management_group_name\", arg_1, 'str'),\n                    'policyTrackedResourcesResource': arg_0._serialize.url(\"self.policy_tracked_resources_resource\", arg_0.policy_tracked_resources_resource, 'str')\n                }\n                arg_9 = arg_0._client.format_url(arg_9, **arg_10)\n\n                # Construct parameters\n                arg_11 = {}\n                arg_11['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n                if arg_6 is not None:\n                    arg_11['$top'] = arg_0._serialize.query(\"top\", arg_6, 'int', minimum=0)\n                if arg_7 is not None:\n                    arg_11['$filter'] = arg_0._serialize.query(\"filter\", arg_7, 'str')\n\n            else:\n                arg_9 = arg_8\n                arg_11 = {}\n\n            # Construct headers\n            arg_12 = {}\n            arg_12['Accept'] = 'application/json'\n            if arg_0.config.generate_client_request_id:\n                arg_12['x-ms-client-request-id'] = str(uuid.uuid1())\n            if arg_3:\n                arg_12.update(arg_3)\n            if arg_0.config.accept_language is not None:\n                arg_12['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n            # Construct and send request\n            arg_13 = arg_0._client.post(arg_9, arg_11, arg_12)\n            arg_14 = arg_0._client.send(arg_13, stream=False, **arg_5)\n\n            if arg_14.status_code not in [200]:\n                raise models.QueryFailureException(arg_0._deserialize, arg_14)\n\n            return arg_14\n\n        # Deserialize response\n        arg_15 = models.PolicyTrackedResourcePaged(internal_paging, arg_0._deserialize.dependencies)\n\n        if arg_4:\n            arg_16 = {}\n            arg_17 = models.PolicyTrackedResourcePaged(internal_paging, arg_0._deserialize.dependencies, arg_16)\n            return arg_17\n\n        return arg_15", "path": "azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/policy_tracked_resources_operations.py", "identifier": "PolicyTrackedResourcesOperations.list_query_results_for_management_group", "docstring": "Queries policy tracked resources under the management group.\n\n        :param management_group_name: Management group name.\n        :type management_group_name: str\n        :param query_options: Additional parameters for the operation\n        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: An iterator like instance of PolicyTrackedResource\n        :rtype:\n         ~azure.mgmt.policyinsights.models.PolicyTrackedResourcePaged[~azure.mgmt.policyinsights.models.PolicyTrackedResource]\n        :raises:\n         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`", "docstring_tokens": ["Queries", "policy", "tracked", "resources", "under", "the", "management", "group", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255243}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L410-L421", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Defines a XML body value to match.", "language": "python", "parameters": "(self, xml)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_0", ".", "_request", ".", "xml", "=", "Func", "arg_0", ".", "add_matcher", "(", "matcher", "(", "'XMLMatcher'", ",", "Func", ")", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Defines a XML body value to match.\n\n        Arguments:\n            xml (str|regex): body XML to match.\n\n        Returns:\n            self: current Mock instance.\n        \"\"\"\n        arg_0._request.xml = Func\n        arg_0.add_matcher(matcher('XMLMatcher', Func))", "path": "pook/mock.py", "identifier": "Mock.xml", "docstring": "Defines a XML body value to match.\n\n        Arguments:\n            xml (str|regex): body XML to match.\n\n        Returns:\n            self: current Mock instance.", "docstring_tokens": ["Defines", "a", "XML", "body", "value", "to", "match", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 255244}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/cpserver/checkplotserver_handlers.py#L408-L421", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "handles initial setup.", "language": "python", "parameters": "(self, currentdir, assetpath, cplist,\n                   cplistfile, executor, readonly, baseurl)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_0", ".", "currentdir", "=", "arg_1", "arg_0", ".", "assetpath", "=", "arg_2", "arg_0", ".", "currentproject", "=", "arg_3", "arg_0", ".", "cplistfile", "=", "arg_4", "arg_0", ".", "executor", "=", "arg_5", "arg_0", ".", "readonly", "=", "arg_6", "arg_0", ".", "baseurl", "=", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                   arg_4, arg_5, arg_6, arg_7):\n        '''\n        handles initial setup.\n\n        '''\n\n        arg_0.currentdir = arg_1\n        arg_0.assetpath = arg_2\n        arg_0.currentproject = arg_3\n        arg_0.cplistfile = arg_4\n        arg_0.executor = arg_5\n        arg_0.readonly = arg_6\n        arg_0.baseurl = arg_7", "path": "astrobase/cpserver/checkplotserver_handlers.py", "identifier": "IndexHandler.initialize", "docstring": "handles initial setup.", "docstring_tokens": ["handles", "initial", "setup", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255245}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/txampext/jsondialect.py#L159-L164", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Builds a bridge and associates it with an AMP protocol instance.", "language": "python", "parameters": "(self, addr)", "return_statement": "return JSONAMPDialectReceiver(proto)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_factory", ".", "Func", "(", "arg_1", ")", "return", "JSONAMPDialectReceiver", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Builds a bridge and associates it with an AMP protocol instance.\n        \"\"\"\n        arg_2 = arg_0._factory.Func(arg_1)\n        return JSONAMPDialectReceiver(arg_2)", "path": "txampext/jsondialect.py", "identifier": "JSONAMPDialectFactory.buildProtocol", "docstring": "Builds a bridge and associates it with an AMP protocol instance.", "docstring_tokens": ["Builds", "a", "bridge", "and", "associates", "it", "with", "an", "AMP", "protocol", "instance", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 255246}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcdb.py#L279-L290", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This sets the database connection to autocommit. Must be called before\n        any cursors have been instantiated.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ".", "cursors", ".", "keys", "(", ")", ")", "==", "0", ":", "arg_0", ".", "connection", ".", "autocommit", "=", "True", "else", ":", "raise", "AttributeError", "(", "'database cursors are already active, '", "'cannot switch to autocommit now'", ")"], "function": "def Func(arg_0):\n        '''\n        This sets the database connection to autocommit. Must be called before\n        any cursors have been instantiated.\n\n        '''\n\n        if len(arg_0.cursors.keys()) == 0:\n            arg_0.connection.autocommit = True\n        else:\n            raise AttributeError('database cursors are already active, '\n                                 'cannot switch to autocommit now')", "path": "astrobase/lcdb.py", "identifier": "LCDB.autocommit", "docstring": "This sets the database connection to autocommit. Must be called before\n        any cursors have been instantiated.", "docstring_tokens": ["This", "sets", "the", "database", "connection", "to", "autocommit", ".", "Must", "be", "called", "before", "any", "cursors", "have", "been", "instantiated", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255247}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/SSHKey.py#L59-L71", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Create the SSH Key", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"name\"", ":", "arg_0", ".", "name", ",", "\"public_key\"", ":", "arg_0", ".", "public_key", ",", "}", "arg_2", "=", "arg_0", ".", "get_data", "(", "\"account/keys/\"", ",", "type", "=", "POST", ",", "params", "=", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "id", "=", "arg_2", "[", "'ssh_key'", "]", "[", "'id'", "]"], "function": "def Func(arg_0):\n        \"\"\"\n            Create the SSH Key\n        \"\"\"\n        arg_1 = {\n            \"name\": arg_0.name,\n            \"public_key\": arg_0.public_key,\n        }\n\n        arg_2 = arg_0.get_data(\"account/keys/\", type=POST, params=arg_1)\n\n        if arg_2:\n            arg_0.id = arg_2['ssh_key']['id']", "path": "digitalocean/SSHKey.py", "identifier": "SSHKey.create", "docstring": "Create the SSH Key", "docstring_tokens": ["Create", "the", "SSH", "Key"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 255248}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1021-L1030", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Adds more filters to the existing list of error-message filters.", "language": "python", "parameters": "(self, filters)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "split", "(", "','", ")", ":", "arg_3", "=", "arg_2", ".", "strip", "(", ")", "if", "arg_3", ":", "arg_0", ".", "filters", ".", "append", "(", "arg_3", ")", "for", "arg_2", "in", "arg_0", ".", "filters", ":", "if", "not", "(", "arg_2", ".", "startswith", "(", "'+'", ")", "or", "arg_2", ".", "startswith", "(", "'-'", ")", ")", ":", "raise", "ValueError", "(", "'Every filter in --filters must start with + or -'", "' (%s does not)'", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Adds more filters to the existing list of error-message filters. \"\"\"\n    for arg_2 in arg_1.split(','):\n      arg_3 = arg_2.strip()\n      if arg_3:\n        arg_0.filters.append(arg_3)\n    for arg_2 in arg_0.filters:\n      if not (arg_2.startswith('+') or arg_2.startswith('-')):\n        raise ValueError('Every filter in --filters must start with + or -'\n                         ' (%s does not)' % arg_2)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "_CppLintState.AddFilters", "docstring": "Adds more filters to the existing list of error-message filters.", "docstring_tokens": ["Adds", "more", "filters", "to", "the", "existing", "list", "of", "error", "-", "message", "filters", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255249}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/serialize.py#L89-L109", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "reconstruct an object serialized by serialize_object from data buffers.", "language": "python", "parameters": "(bufs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "list", "(", "arg_0", ")", "arg_1", "=", "pickle", ".", "loads", "(", "arg_0", ".", "pop", "(", "0", ")", ")", "if", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", ".", "data", "is", "None", ":", "arg_2", ".", "data", "=", "arg_0", ".", "pop", "(", "0", ")", "return", "uncanSequence", "(", "map", "(", "unserialize", ",", "arg_1", ")", ")", ",", "arg_0", "elif", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_4", "=", "{", "}", "for", "arg_5", "in", "sorted", "(", "arg_1", ".", "iterkeys", "(", ")", ")", ":", "arg_2", "=", "arg_1", "[", "arg_5", "]", "if", "arg_2", ".", "data", "is", "None", ":", "arg_2", ".", "data", "=", "arg_0", ".", "pop", "(", "0", ")", "arg_4", "[", "arg_5", "]", "=", "uncan", "(", "unserialize", "(", "arg_2", ")", ")", "return", "arg_4", ",", "arg_0", "else", ":", "if", "arg_1", ".", "data", "is", "None", ":", "arg_1", ".", "data", "=", "arg_0", ".", "pop", "(", "0", ")", "return", "uncan", "(", "unserialize", "(", "arg_1", ")", ")", ",", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"reconstruct an object serialized by serialize_object from data buffers.\"\"\"\n    arg_0 = list(arg_0)\n    arg_1 = pickle.loads(arg_0.pop(0))\n    if isinstance(arg_1, (list, tuple)):\n        for arg_2 in arg_1:\n            if arg_2.data is None:\n                arg_2.data = arg_0.pop(0)\n        return uncanSequence(map(unserialize, arg_1)), arg_0\n    elif isinstance(arg_1, dict):\n        arg_4 = {}\n        for arg_5 in sorted(arg_1.iterkeys()):\n            arg_2 = arg_1[arg_5]\n            if arg_2.data is None:\n                arg_2.data = arg_0.pop(0)\n            arg_4[arg_5] = uncan(unserialize(arg_2))\n        return arg_4, arg_0\n    else:\n        if arg_1.data is None:\n            arg_1.data = arg_0.pop(0)\n        return uncan(unserialize(arg_1)), arg_0", "path": "environment/lib/python2.7/site-packages/IPython/zmq/serialize.py", "identifier": "unserialize_object", "docstring": "reconstruct an object serialized by serialize_object from data buffers.", "docstring_tokens": ["reconstruct", "an", "object", "serialized", "by", "serialize_object", "from", "data", "buffers", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255250}
{"url": "https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/main.py#L247-L257", "sha": "f546ad171750cd7685afbde6785fe71f82cadb35", "docstring_summary": "Backpropagate multi-run peptide and protein scores to single files", "language": "python", "parameters": "(infile, outfile, apply_scores)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", "else", ":", "arg_1", "=", "arg_1", "Func_oswr", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Backpropagate multi-run peptide and protein scores to single files\n    \"\"\"\n\n    if arg_1 is None:\n        arg_1 = arg_0\n    else:\n        arg_1 = arg_1\n\n    Func_oswr(arg_0, arg_1, arg_2)", "path": "pyprophet/main.py", "identifier": "backpropagate", "docstring": "Backpropagate multi-run peptide and protein scores to single files", "docstring_tokens": ["Backpropagate", "multi", "-", "run", "peptide", "and", "protein", "scores", "to", "single", "files"], "nwo": "PyProphet/pyprophet", "score": 0.38514621847307956, "idx": 255251}
{"url": "https://github.com/MartinHjelmare/leicacam/blob/1df37bccd34884737d3b5e169fae71dd2f21f1e2/leicacam/async_cam.py#L97-L101", "sha": "1df37bccd34884737d3b5e169fae71dd2f21f1e2", "docstring_summary": "Close stream.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "writer", ".", "can_write_eof", "(", ")", ":", "arg_0", ".", "writer", ".", "write_eof", "(", ")", "arg_0", ".", "writer", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Close stream.\"\"\"\n        if arg_0.writer.can_write_eof():\n            arg_0.writer.write_eof()\n        arg_0.writer.Func()", "path": "leicacam/async_cam.py", "identifier": "AsyncCAM.close", "docstring": "Close stream.", "docstring_tokens": ["Close", "stream", "."], "nwo": "MartinHjelmare/leicacam", "score": 0.35580137387943567, "idx": 255252}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L169-L172", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Add the default values to the class docstring", "language": "python", "parameters": "(cls, header=None, indent=None, footer=None)", "return_statement": "return defaults_docstring(cls.defaults, header=header,\n                                  indent=indent, footer=footer)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "return", "Func", "(", "arg_0", ".", "defaults", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Add the default values to the class docstring\"\"\"\n        return Func(arg_0.defaults, arg_1=arg_1,\n                                  arg_2=arg_2, arg_3=arg_3)", "path": "pymodeler/parameter.py", "identifier": "Property.defaults_docstring", "docstring": "Add the default values to the class docstring", "docstring_tokens": ["Add", "the", "default", "values", "to", "the", "class", "docstring"], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 255253}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L338-L380", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Drain will put a connection into a drain state. All subscriptions will\n        immediately be put into a drain state. Upon completion, the publishers\n        will be drained and can not publish any additional messages. Upon draining\n        of the publishers, the connection will be closed. Use the `closed_cb'\n        option to know when the connection has moved from draining to closed.", "language": "python", "parameters": "(self, sid=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", ".", "is_Funcing", ":", "return", "if", "arg_0", ".", "is_closed", ":", "raise", "ErrConnectionClosed", "if", "arg_0", ".", "is_connecting", "or", "arg_0", ".", "is_reconnecting", ":", "raise", "ErrConnectionReconnecting", "if", "arg_1", "is", "not", "None", ":", "return", "arg_0", ".", "_Func_sub", "(", "arg_1", ")", "arg_0", ".", "_status", "=", "Client", ".", "DRAINING_SUBS", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "_subs", ".", "items", "(", ")", ":", "arg_6", "=", "arg_0", ".", "_Func_sub", "(", "arg_4", ")", "arg_3", ".", "append", "(", "arg_6", ")", "arg_7", "=", "asyncio", ".", "gather", "(", "*", "arg_3", ")", "try", ":", "yield", "from", "asyncio", ".", "wait_for", "(", "arg_7", ",", "arg_0", ".", "options", "[", "\"Func_timeout\"", "]", ")", "except", "asyncio", ".", "TimeoutError", ":", "arg_7", ".", "exception", "(", ")", "arg_7", ".", "cancel", "(", ")", "if", "arg_0", ".", "_error_cb", "is", "not", "None", ":", "yield", "from", "arg_0", ".", "_error_cb", "(", "ErrDrainTimeout", ")", "except", "asyncio", ".", "CancelledError", ":", "pass", "finally", ":", "arg_0", ".", "_status", "=", "Client", ".", "DRAINING_PUBS", "yield", "from", "arg_0", ".", "flush", "(", ")", "yield", "from", "arg_0", ".", "_close", "(", "Client", ".", "CLOSED", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Drain will put a connection into a Func state. All subscriptions will\n        immediately be put into a Func state. Upon completion, the publishers\n        will be Funced and can not publish any additional messages. Upon Funcing\n        of the publishers, the connection will be closed. Use the `closed_cb'\n        option to know when the connection has moved from Funcing to closed.\n\n        If a sid is passed, just the subscription with that sid will be Funced\n        without closing the connection.\n        \"\"\"\n        if arg_0.is_Funcing:\n            return\n        if arg_0.is_closed:\n            raise ErrConnectionClosed\n        if arg_0.is_connecting or arg_0.is_reconnecting:\n            raise ErrConnectionReconnecting\n\n        if arg_1 is not None:\n            return arg_0._Func_sub(arg_1)\n\n        # Start Funcing the subscriptions\n        arg_0._status = Client.DRAINING_SUBS\n\n        arg_3 = []\n        for arg_4, arg_5 in arg_0._subs.items():\n            arg_6 = arg_0._Func_sub(arg_4)\n            arg_3.append(arg_6)\n\n        arg_7 = asyncio.gather(*arg_3)\n        try:\n            yield from asyncio.wait_for(arg_7, arg_0.options[\"Func_timeout\"])\n        except asyncio.TimeoutError:\n            arg_7.exception()\n            arg_7.cancel()\n            if arg_0._error_cb is not None:\n                yield from arg_0._error_cb(ErrDrainTimeout)\n        except asyncio.CancelledError:\n            pass\n        finally:\n            arg_0._status = Client.DRAINING_PUBS\n            yield from arg_0.flush()\n            yield from arg_0._close(Client.CLOSED)", "path": "nats/aio/client.py", "identifier": "Client.drain", "docstring": "Drain will put a connection into a drain state. All subscriptions will\n        immediately be put into a drain state. Upon completion, the publishers\n        will be drained and can not publish any additional messages. Upon draining\n        of the publishers, the connection will be closed. Use the `closed_cb'\n        option to know when the connection has moved from draining to closed.\n\n        If a sid is passed, just the subscription with that sid will be drained\n        without closing the connection.", "docstring_tokens": ["Drain", "will", "put", "a", "connection", "into", "a", "drain", "state", ".", "All", "subscriptions", "will", "immediately", "be", "put", "into", "a", "drain", "state", ".", "Upon", "completion", "the", "publishers", "will", "be", "drained", "and", "can", "not", "publish", "any", "additional", "messages", ".", "Upon", "draining", "of", "the", "publishers", "the", "connection", "will", "be", "closed", ".", "Use", "the", "closed_cb", "option", "to", "know", "when", "the", "connection", "has", "moved", "from", "draining", "to", "closed", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 255254}
{"url": "https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L214-L258", "sha": "800976faab3b827a42fa1cb80f13fcc03961d2c9", "docstring_summary": "Create an authorization URL by appending request_token and optional\n        kwargs to url.", "language": "python", "parameters": "(self, url, request_token=None, **kwargs)", "return_statement": "return add_params_to_uri(url, kwargs.items())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_3", "[", "\"oauth_token\"", "]", "=", "arg_2", "or", "arg_0", ".", "_client", ".", "client", ".", "resource_owner_key", "log", ".", "debug", "(", "\"Adding parameters %s to url %s\"", ",", "arg_3", ",", "arg_1", ")", "return", "add_params_to_uri", "(", "arg_1", ",", "arg_3", ".", "items", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Create an authorization URL by appending request_token and optional\n        kwargs to url.\n\n        This is the second step in the OAuth 1 workflow. The user should be\n        redirected to this authorization URL, grant access to you, and then\n        be redirected back to you. The redirection back can either be specified\n        during client registration or by supplying a callback URI per request.\n\n        :param url: The authorization endpoint URL.\n        :param request_token: The previously obtained request token.\n        :param kwargs: Optional parameters to append to the URL.\n        :returns: The authorization URL with new parameters embedded.\n\n        An example using a registered default callback URI.\n\n        >>> request_token_url = 'https://api.twitter.com/oauth/request_token'\n        >>> Func = 'https://api.twitter.com/oauth/authorize'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret')\n        >>> oauth_session.fetch_request_token(request_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }\n        >>> oauth_session.Func(Func)\n        'https://api.twitter.com/oauth/authorize?oauth_token=sdf0o9823sjdfsdf'\n        >>> oauth_session.Func(Func, foo='bar')\n        'https://api.twitter.com/oauth/authorize?oauth_token=sdf0o9823sjdfsdf&foo=bar'\n\n        An example using an explicit callback URI.\n\n        >>> request_token_url = 'https://api.twitter.com/oauth/request_token'\n        >>> Func = 'https://api.twitter.com/oauth/authorize'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret', callback_uri='https://127.0.0.1/callback')\n        >>> oauth_session.fetch_request_token(request_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }\n        >>> oauth_session.Func(Func)\n        'https://api.twitter.com/oauth/authorize?oauth_token=sdf0o9823sjdfsdf&oauth_callback=https%3A%2F%2F127.0.0.1%2Fcallback'\n        \"\"\"\n        arg_3[\"oauth_token\"] = arg_2 or arg_0._client.client.resource_owner_key\n        log.debug(\"Adding parameters %s to url %s\", arg_3, arg_1)\n        return add_params_to_uri(arg_1, arg_3.items())", "path": "requests_oauthlib/oauth1_session.py", "identifier": "OAuth1Session.authorization_url", "docstring": "Create an authorization URL by appending request_token and optional\n        kwargs to url.\n\n        This is the second step in the OAuth 1 workflow. The user should be\n        redirected to this authorization URL, grant access to you, and then\n        be redirected back to you. The redirection back can either be specified\n        during client registration or by supplying a callback URI per request.\n\n        :param url: The authorization endpoint URL.\n        :param request_token: The previously obtained request token.\n        :param kwargs: Optional parameters to append to the URL.\n        :returns: The authorization URL with new parameters embedded.\n\n        An example using a registered default callback URI.\n\n        >>> request_token_url = 'https://api.twitter.com/oauth/request_token'\n        >>> authorization_url = 'https://api.twitter.com/oauth/authorize'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret')\n        >>> oauth_session.fetch_request_token(request_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }\n        >>> oauth_session.authorization_url(authorization_url)\n        'https://api.twitter.com/oauth/authorize?oauth_token=sdf0o9823sjdfsdf'\n        >>> oauth_session.authorization_url(authorization_url, foo='bar')\n        'https://api.twitter.com/oauth/authorize?oauth_token=sdf0o9823sjdfsdf&foo=bar'\n\n        An example using an explicit callback URI.\n\n        >>> request_token_url = 'https://api.twitter.com/oauth/request_token'\n        >>> authorization_url = 'https://api.twitter.com/oauth/authorize'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret', callback_uri='https://127.0.0.1/callback')\n        >>> oauth_session.fetch_request_token(request_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }\n        >>> oauth_session.authorization_url(authorization_url)\n        'https://api.twitter.com/oauth/authorize?oauth_token=sdf0o9823sjdfsdf&oauth_callback=https%3A%2F%2F127.0.0.1%2Fcallback'", "docstring_tokens": ["Create", "an", "authorization", "URL", "by", "appending", "request_token", "and", "optional", "kwargs", "to", "url", "."], "nwo": "requests/requests-oauthlib", "score": 0.9446339936112974, "idx": 255255}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/display.py#L51-L62", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "List all display items; return 0 if none", "language": "python", "parameters": "(self)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "False", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "list", ":", "if", "not", "arg_1", ":", "arg_2", ".", "append", "(", "\"\"\"Auto-display expressions now in effect:Num Enb Expression\"\"\"", ")", "arg_1", "=", "True", "pass", "arg_2", ".", "append", "(", "arg_3", ".", "format", "(", ")", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"List Func display items; return 0 if none\"\"\"\n        arg_1 = False\n        arg_2 = []\n        for arg_3 in arg_0.list:\n            if not arg_1:\n                arg_2.append(\"\"\"Auto-display expressions now in effect:\nNum Enb Expression\"\"\")\n                arg_1 = True\n                pass\n            arg_2.append(arg_3.format())\n        return arg_2", "path": "trepan/lib/display.py", "identifier": "DisplayMgr.all", "docstring": "List all display items; return 0 if none", "docstring_tokens": ["List", "all", "display", "items", ";", "return", "0", "if", "none"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 255256}
{"url": "https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L191-L202", "sha": "86dc1ab27ce82dcc091ce127416cc3ee219e9bec", "docstring_summary": "Calculate two's complement.", "language": "python", "parameters": "(cls, data)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "sys", ".", "version", "<", "'3'", ":", "arg_2", "=", "long", "(", "0", ")", "for", "arg_3", "in", "arg_1", ":", "arg_2", "=", "(", "arg_2", "<<", "8", ")", "+", "ord", "(", "arg_3", ")", "else", ":", "arg_2", "=", "0", "for", "arg_3", "in", "arg_1", ":", "arg_2", "=", "(", "arg_2", "<<", "8", ")", "+", "arg_3", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Calculate two's complement.\"\"\"\n        if sys.version < '3':\n            # this does not exist in python 3 - undefined-variable disabled to make pylint happier.\n            arg_2 = long(0)  # pylint:disable=undefined-variable\n            for arg_3 in arg_1:\n                arg_2 = (arg_2 << 8) + ord(arg_3)\n        else:\n            arg_2 = 0\n            for arg_3 in arg_1:\n                arg_2 = (arg_2 << 8) + arg_3\n        return arg_2", "path": "sshpubkeys/keys.py", "identifier": "SSHKey._parse_long", "docstring": "Calculate two's complement.", "docstring_tokens": ["Calculate", "two", "s", "complement", "."], "nwo": "ojarva/python-sshpubkeys", "score": 0.19584428074165744, "idx": 255257}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/experimental/fun_mcmc/fun_mcmc_lib.py#L520-L550", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "A function to do simple sign-based control of a variable.", "language": "python", "parameters": "(control: FloatNest,\n                    output: FloatTensor,\n                    set_point: FloatTensor,\n                    adaptation_rate: FloatTensor = 0.01)", "return_statement": "return tf.nest.map_structure(_get_new_control, control, output, set_point)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_3", ",", "arg_5", ":", "arg_3", "=", "0.01", ")", "->", "arg_1", ":", "def", "_get_new_control", "(", "arg_0", ",", "arg_2", ",", "arg_4", ")", ":", "arg_6", "=", "mcmc_util", ".", "choose", "(", "arg_2", ">", "arg_4", ",", "arg_0", "*", "(", "1.", "+", "arg_5", ")", ",", "arg_0", "/", "(", "1.", "+", "arg_5", ")", ")", "return", "arg_6", "arg_2", "=", "maybe_broadcast_structure", "(", "arg_2", ",", "arg_0", ")", "arg_4", "=", "maybe_broadcast_structure", "(", "arg_4", ",", "arg_0", ")", "return", "tf", ".", "nest", ".", "map_structure", "(", "_get_new_control", ",", "arg_0", ",", "arg_2", ",", "arg_4", ")"], "function": "def Func(arg_0: arg_1,\n                    arg_2: arg_3,\n                    arg_4: arg_3,\n                    arg_5: arg_3 = 0.01) -> arg_1:\n  \"\"\"A function to do simple sign-based control of a variable.\n\n  ```\n  control = control * (1. + adaptation_rate) ** sign(output - set_point)\n  ```\n\n  Args:\n    control: The control variable.\n    output: The output variable.\n    set_point: The set point for `output`. This function will adjust `control`\n      so that `output` matches `set_point`.\n    adaptation_rate: Adaptation rate.\n\n  Returns:\n    control: New control.\n  \"\"\"\n\n  def _get_new_control(arg_0, arg_2, arg_4):\n    arg_6 = mcmc_util.choose(arg_2 > arg_4,\n                                   arg_0 * (1. + arg_5),\n                                   arg_0 / (1. + arg_5))\n    return arg_6\n\n  arg_2 = maybe_broadcast_structure(arg_2, arg_0)\n  arg_4 = maybe_broadcast_structure(arg_4, arg_0)\n\n  return tf.nest.map_structure(_get_new_control, arg_0, arg_2, arg_4)", "path": "experimental/fun_mcmc/fun_mcmc_lib.py", "identifier": "sign_adaptation", "docstring": "A function to do simple sign-based control of a variable.\n\n  ```\n  control = control * (1. + adaptation_rate) ** sign(output - set_point)\n  ```\n\n  Args:\n    control: The control variable.\n    output: The output variable.\n    set_point: The set point for `output`. This function will adjust `control`\n      so that `output` matches `set_point`.\n    adaptation_rate: Adaptation rate.\n\n  Returns:\n    control: New control.", "docstring_tokens": ["A", "function", "to", "do", "simple", "sign", "-", "based", "control", "of", "a", "variable", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255258}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L1686-L1705", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Wrapper for struct.unpack with SerialBlock buffer definitionns.", "language": "python", "parameters": "(self, data, def_buf)", "return_statement": "return contents", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "\"=\"", "for", "arg_4", "in", "arg_2", ":", "if", "not", "arg_2", "[", "arg_4", "]", "[", "MeterData", ".", "CalculatedFlag", "]", ":", "arg_3", "=", "arg_3", "+", "str", "(", "arg_2", "[", "arg_4", "]", "[", "MeterData", ".", "SizeValue", "]", ")", "+", "\"s\"", "if", "len", "(", "arg_1", ")", "==", "255", ":", "arg_5", "=", "struct", ".", "unpack", "(", "arg_3", ",", "str", "(", "arg_1", ")", ")", "else", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Length error.  Len() size = \"", "+", "str", "(", "len", "(", "arg_1", ")", ")", ")", "arg_5", "=", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Wrapper for struct.unpack with SerialBlock buffer definitionns.\n\n        Args:\n            data (str): Implicit cast bytes to str, serial port return.\n            def_buf (SerialBlock): Block object holding field lengths.\n\n        Returns:\n            tuple: parsed result of struct.unpack() with field definitions.\n        \"\"\"\n        arg_3 = \"=\"\n        for arg_4 in arg_2:\n            if not arg_2[arg_4][MeterData.CalculatedFlag]:\n                arg_3 = arg_3 + str(arg_2[arg_4][MeterData.SizeValue]) + \"s\"\n        if len(arg_1) == 255:\n            arg_5 = struct.unpack(arg_3, str(arg_1))\n        else:\n            arg_0.writeCmdMsg(\"Length error.  Len() size = \" + str(len(arg_1)))\n            arg_5 = ()\n        return arg_5", "path": "ekmmeters.py", "identifier": "Meter.unpackStruct", "docstring": "Wrapper for struct.unpack with SerialBlock buffer definitionns.\n\n        Args:\n            data (str): Implicit cast bytes to str, serial port return.\n            def_buf (SerialBlock): Block object holding field lengths.\n\n        Returns:\n            tuple: parsed result of struct.unpack() with field definitions.", "docstring_tokens": ["Wrapper", "for", "struct", ".", "unpack", "with", "SerialBlock", "buffer", "definitionns", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 255259}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/harmonic.py#L107-L218", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Compute the energy at harmonics of time-frequency representation.", "language": "python", "parameters": "(x, freqs, h_range, kind='linear', fill_value=0, axis=0)", "return_statement": "return x_out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'linear'", ",", "arg_4", "=", "0", ",", "arg_5", "=", "0", ")", ":", "arg_6", "=", "[", "len", "(", "arg_2", ")", "]", "arg_6", ".", "extend", "(", "arg_0", ".", "shape", ")", "arg_7", "=", "np", ".", "zeros", "(", "arg_6", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "if", "arg_1", ".", "ndim", "==", "1", "and", "len", "(", "arg_1", ")", "==", "arg_0", ".", "shape", "[", "arg_5", "]", ":", "harmonics_1d", "(", "arg_7", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "elif", "arg_1", ".", "ndim", "==", "2", "and", "arg_1", ".", "shape", "==", "arg_0", ".", "shape", ":", "harmonics_2d", "(", "arg_7", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "else", ":", "raise", "ParameterError", "(", "'freqs.shape={} does not match '", "'input shape={}'", ".", "format", "(", "arg_1", ".", "shape", ",", "arg_0", ".", "shape", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='linear', arg_4=0, arg_5=0):\n    '''Compute the energy at harmonics of time-frequency representation.\n\n    Given a frequency-based energy representation such as a spectrogram\n    or tempogram, this function computes the energy at the chosen harmonics\n    of the frequency axis.  (See examples below.)\n    The resulting harmonic array can then be used as input to a salience\n    computation.\n\n    Parameters\n    ----------\n    x : np.ndarray\n        The input energy\n\n    freqs : np.ndarray, shape=(X.shape[axis])\n        The frequency values corresponding to X's elements along the\n        chosen axis.\n\n    h_range : list-like, non-negative\n        Harmonics to compute.  The first harmonic (1) corresponds to `x`\n        itself.\n        Values less than one (e.g., 1/2) correspond to sub-harmonics.\n\n    kind : str\n        Interpolation type.  See `scipy.interpolate.interp1d`.\n\n    fill_value : float\n        The value to fill when extrapolating beyond the observed\n        frequency range.\n\n    axis : int\n        The axis along which to compute harmonics\n\n    Returns\n    -------\n    x_harm : np.ndarray, shape=(len(h_range), [x.shape])\n        `x_harm[i]` will have the same shape as `x`, and measure\n        the energy at the `h_range[i]` harmonic of each frequency.\n\n    See Also\n    --------\n    scipy.interpolate.interp1d\n\n\n    Examples\n    --------\n    Estimate the harmonics of a time-averaged tempogram\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      duration=15, offset=30)\n    >>> # Compute the time-varying tempogram and average over time\n    >>> tempi = np.mean(librosa.feature.tempogram(y=y, sr=sr), axis=1)\n    >>> # We'll measure the first five harmonics\n    >>> h_range = [1, 2, 3, 4, 5]\n    >>> f_tempo = librosa.tempo_frequencies(len(tempi), sr=sr)\n    >>> # Build the harmonic tensor\n    >>> t_harmonics = librosa.Func(tempi, f_tempo, h_range)\n    >>> print(t_harmonics.shape)\n    (5, 384)\n\n    >>> # And plot the results\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> librosa.display.specshow(t_harmonics, x_axis='tempo', sr=sr)\n    >>> plt.yticks(0.5 + np.arange(len(h_range)),\n    ...            ['{:.3g}'.format(_) for _ in h_range])\n    >>> plt.ylabel('Harmonic')\n    >>> plt.xlabel('Tempo (BPM)')\n    >>> plt.tight_layout()\n\n    We can also compute frequency harmonics for spectrograms.\n    To calculate sub-harmonic energy, use values < 1.\n\n    >>> h_range = [1./3, 1./2, 1, 2, 3, 4]\n    >>> S = np.abs(librosa.stft(y))\n    >>> fft_freqs = librosa.fft_frequencies(sr=sr)\n    >>> S_harm = librosa.Func(S, fft_freqs, h_range, axis=0)\n    >>> print(S_harm.shape)\n    (6, 1025, 646)\n\n    >>> plt.figure()\n    >>> for i, _sh in enumerate(S_harm, 1):\n    ...     plt.subplot(3, 2, i)\n    ...     librosa.display.specshow(librosa.amplitude_to_db(_sh,\n    ...                                                      ref=S.max()),\n    ...                              sr=sr, y_axis='log')\n    ...     plt.title('h={:.3g}'.format(h_range[i-1]))\n    ...     plt.yticks([])\n    >>> plt.tight_layout()\n    '''\n\n    # X_out will be the same shape as X, plus a leading\n    # axis that has length = len(h_range)\n    arg_6 = [len(arg_2)]\n    arg_6.extend(arg_0.shape)\n\n    arg_7 = np.zeros(arg_6, dtype=arg_0.dtype)\n\n    if arg_1.ndim == 1 and len(arg_1) == arg_0.shape[arg_5]:\n        harmonics_1d(arg_7, arg_0, arg_1, arg_2,\n                     arg_3=arg_3, arg_4=arg_4,\n                     arg_5=arg_5)\n\n    elif arg_1.ndim == 2 and arg_1.shape == arg_0.shape:\n        harmonics_2d(arg_7, arg_0, arg_1, arg_2,\n                     arg_3=arg_3, arg_4=arg_4,\n                     arg_5=arg_5)\n    else:\n        raise ParameterError('freqs.shape={} does not match '\n                             'input shape={}'.format(arg_1.shape, arg_0.shape))\n\n    return arg_7", "path": "librosa/core/harmonic.py", "identifier": "interp_harmonics", "docstring": "Compute the energy at harmonics of time-frequency representation.\n\n    Given a frequency-based energy representation such as a spectrogram\n    or tempogram, this function computes the energy at the chosen harmonics\n    of the frequency axis.  (See examples below.)\n    The resulting harmonic array can then be used as input to a salience\n    computation.\n\n    Parameters\n    ----------\n    x : np.ndarray\n        The input energy\n\n    freqs : np.ndarray, shape=(X.shape[axis])\n        The frequency values corresponding to X's elements along the\n        chosen axis.\n\n    h_range : list-like, non-negative\n        Harmonics to compute.  The first harmonic (1) corresponds to `x`\n        itself.\n        Values less than one (e.g., 1/2) correspond to sub-harmonics.\n\n    kind : str\n        Interpolation type.  See `scipy.interpolate.interp1d`.\n\n    fill_value : float\n        The value to fill when extrapolating beyond the observed\n        frequency range.\n\n    axis : int\n        The axis along which to compute harmonics\n\n    Returns\n    -------\n    x_harm : np.ndarray, shape=(len(h_range), [x.shape])\n        `x_harm[i]` will have the same shape as `x`, and measure\n        the energy at the `h_range[i]` harmonic of each frequency.\n\n    See Also\n    --------\n    scipy.interpolate.interp1d\n\n\n    Examples\n    --------\n    Estimate the harmonics of a time-averaged tempogram\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      duration=15, offset=30)\n    >>> # Compute the time-varying tempogram and average over time\n    >>> tempi = np.mean(librosa.feature.tempogram(y=y, sr=sr), axis=1)\n    >>> # We'll measure the first five harmonics\n    >>> h_range = [1, 2, 3, 4, 5]\n    >>> f_tempo = librosa.tempo_frequencies(len(tempi), sr=sr)\n    >>> # Build the harmonic tensor\n    >>> t_harmonics = librosa.interp_harmonics(tempi, f_tempo, h_range)\n    >>> print(t_harmonics.shape)\n    (5, 384)\n\n    >>> # And plot the results\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> librosa.display.specshow(t_harmonics, x_axis='tempo', sr=sr)\n    >>> plt.yticks(0.5 + np.arange(len(h_range)),\n    ...            ['{:.3g}'.format(_) for _ in h_range])\n    >>> plt.ylabel('Harmonic')\n    >>> plt.xlabel('Tempo (BPM)')\n    >>> plt.tight_layout()\n\n    We can also compute frequency harmonics for spectrograms.\n    To calculate sub-harmonic energy, use values < 1.\n\n    >>> h_range = [1./3, 1./2, 1, 2, 3, 4]\n    >>> S = np.abs(librosa.stft(y))\n    >>> fft_freqs = librosa.fft_frequencies(sr=sr)\n    >>> S_harm = librosa.interp_harmonics(S, fft_freqs, h_range, axis=0)\n    >>> print(S_harm.shape)\n    (6, 1025, 646)\n\n    >>> plt.figure()\n    >>> for i, _sh in enumerate(S_harm, 1):\n    ...     plt.subplot(3, 2, i)\n    ...     librosa.display.specshow(librosa.amplitude_to_db(_sh,\n    ...                                                      ref=S.max()),\n    ...                              sr=sr, y_axis='log')\n    ...     plt.title('h={:.3g}'.format(h_range[i-1]))\n    ...     plt.yticks([])\n    >>> plt.tight_layout()", "docstring_tokens": ["Compute", "the", "energy", "at", "harmonics", "of", "time", "-", "frequency", "representation", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 255260}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/typecheck.py#L385-L446", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Try to see if no-member should be emitted for the given owner.", "language": "python", "parameters": "(node, owner, owner_name, ignored_mixins=True, ignored_none=True)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ",", "arg_4", "=", "True", ")", ":", "if", "node_ignores_exception", "(", "arg_0", ",", "AttributeError", ")", ":", "return", "False", "if", "arg_4", "and", "isinstance", "(", "arg_1", ",", "astroid", ".", "Const", ")", "and", "arg_1", ".", "value", "is", "None", ":", "return", "False", "if", "is_super", "(", "arg_1", ")", "or", "getattr", "(", "arg_1", ",", "\"type\"", ",", "None", ")", "==", "\"metaclass\"", ":", "return", "False", "if", "arg_3", "and", "arg_2", "[", "-", "5", ":", "]", ".", "lower", "(", ")", "==", "\"mixin\"", ":", "return", "False", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "FunctionDef", ")", "and", "arg_1", ".", "decorators", ":", "return", "False", "if", "isinstance", "(", "arg_1", ",", "(", "astroid", ".", "Instance", ",", "astroid", ".", "ClassDef", ")", ")", ":", "if", "arg_1", ".", "has_dynamic_getattr", "(", ")", ":", "try", ":", "arg_5", "=", "arg_1", ".", "metaclass", "(", ")", "except", "exceptions", ".", "MroError", ":", "return", "False", "if", "arg_5", ":", "return", "arg_5", ".", "qname", "(", ")", "==", "\"enum.EnumMeta\"", "return", "False", "if", "not", "has_known_bases", "(", "arg_1", ")", ":", "return", "False", "if", "isinstance", "(", "arg_1", ",", "objects", ".", "Super", ")", ":", "try", ":", "arg_1", ".", "super_mro", "(", ")", "except", "(", "exceptions", ".", "MroError", ",", "exceptions", ".", "SuperError", ")", ":", "return", "False", "if", "not", "all", "(", "map", "(", "has_known_bases", ",", "arg_1", ".", "type", ".", "mro", "(", ")", ")", ")", ":", "return", "False", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "Module", ")", ":", "try", ":", "arg_1", ".", "getattr", "(", "\"__getattr__\"", ")", "return", "False", "except", "astroid", ".", "NotFoundError", ":", "pass", "if", "arg_0", ".", "attrname", ".", "startswith", "(", "\"_\"", "+", "arg_2", ")", ":", "arg_6", "=", "arg_0", ".", "attrname", ".", "split", "(", "\"_\"", "+", "arg_2", ")", "[", "-", "1", "]", "try", ":", "if", "arg_1", ".", "getattr", "(", "arg_6", ",", "context", "=", "None", ")", "is", "not", "None", ":", "return", "False", "except", "astroid", ".", "NotFoundError", ":", "return", "True", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True, arg_4=True):\n    \"\"\"Try to see if no-member should be emitted for the given owner.\n\n    The following cases are ignored:\n\n        * the owner is a function and it has decorators.\n        * the owner is an instance and it has __getattr__, __getattribute__ implemented\n        * the module is explicitly ignored from no-member checks\n        * the owner is a class and the name can be found in its metaclass.\n        * The access node is protected by an except handler, which handles\n          AttributeError, Exception or bare except.\n    \"\"\"\n    # pylint: disable=too-many-return-statements\n    if node_ignores_exception(arg_0, AttributeError):\n        return False\n    if arg_4 and isinstance(arg_1, astroid.Const) and arg_1.value is None:\n        return False\n    if is_super(arg_1) or getattr(arg_1, \"type\", None) == \"metaclass\":\n        return False\n    if arg_3 and arg_2[-5:].lower() == \"mixin\":\n        return False\n    if isinstance(arg_1, astroid.FunctionDef) and arg_1.decorators:\n        return False\n    if isinstance(arg_1, (astroid.Instance, astroid.ClassDef)):\n        if arg_1.has_dynamic_getattr():\n            # Issue #2565: Don't ignore enums, as they have a `__getattr__` but it's not\n            # invoked at this point.\n            try:\n                arg_5 = arg_1.metaclass()\n            except exceptions.MroError:\n                return False\n            if arg_5:\n                return arg_5.qname() == \"enum.EnumMeta\"\n            return False\n        if not has_known_bases(arg_1):\n            return False\n    if isinstance(arg_1, objects.Super):\n        # Verify if we are dealing with an invalid Super object.\n        # If it is invalid, then there's no point in checking that\n        # it has the required attribute. Also, don't fail if the\n        # MRO is invalid.\n        try:\n            arg_1.super_mro()\n        except (exceptions.MroError, exceptions.SuperError):\n            return False\n        if not all(map(has_known_bases, arg_1.type.mro())):\n            return False\n    if isinstance(arg_1, astroid.Module):\n        try:\n            arg_1.getattr(\"__getattr__\")\n            return False\n        except astroid.NotFoundError:\n            pass\n    if arg_0.attrname.startswith(\"_\" + arg_2):\n        # Test if an attribute has been mangled ('private' attribute)\n        arg_6 = arg_0.attrname.split(\"_\" + arg_2)[-1]\n        try:\n            if arg_1.getattr(arg_6, context=None) is not None:\n                return False\n        except astroid.NotFoundError:\n            return True\n    return True", "path": "pylint/checkers/typecheck.py", "identifier": "_emit_no_member", "docstring": "Try to see if no-member should be emitted for the given owner.\n\n    The following cases are ignored:\n\n        * the owner is a function and it has decorators.\n        * the owner is an instance and it has __getattr__, __getattribute__ implemented\n        * the module is explicitly ignored from no-member checks\n        * the owner is a class and the name can be found in its metaclass.\n        * The access node is protected by an except handler, which handles\n          AttributeError, Exception or bare except.", "docstring_tokens": ["Try", "to", "see", "if", "no", "-", "member", "should", "be", "emitted", "for", "the", "given", "owner", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255261}
{"url": "https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/package.py#L474-L480", "sha": "aca085ea54541b087140b58a81332f8728baeeb2", "docstring_summary": "Validate zipped data package", "language": "python", "parameters": "(the_zip)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "f", "for", "f", "in", "arg_0", ".", "namelist", "(", ")", "if", "f", ".", "endswith", "(", "'datapackage.json'", ")", "]", "if", "len", "(", "arg_1", ")", "!=", "1", ":", "arg_2", "=", "'DataPackage must have only one \"datapackage.json\" (had {n})'", "raise", "exceptions", ".", "DataPackageException", "(", "arg_2", ".", "format", "(", "n", "=", "len", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Validate zipped data package\n    \"\"\"\n    arg_1 = [f for f in arg_0.namelist() if f.endswith('datapackage.json')]\n    if len(arg_1) != 1:\n        arg_2 = 'DataPackage must have only one \"datapackage.json\" (had {n})'\n        raise exceptions.DataPackageException(arg_2.format(n=len(arg_1)))", "path": "datapackage/package.py", "identifier": "_validate_zip", "docstring": "Validate zipped data package", "docstring_tokens": ["Validate", "zipped", "data", "package"], "nwo": "frictionlessdata/datapackage-py", "score": 0.5653088377587532, "idx": 255262}
{"url": "https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L1218-L1252", "sha": "0dc47c8924fa3d9ab676c3a6e195f03f728b72c6", "docstring_summary": "Given an ordered dictionary of items and a key in that dict,\n\treturn an ordered dict of items before, the keyed item, and\n\tan ordered dict of items after.", "language": "python", "parameters": "(items, key)", "return_statement": "return left, item, right", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "unmatched", "(", "arg_2", ")", ":", "arg_3", ",", "arg_4", ",", "=", "arg_2", "return", "arg_3", "!=", "arg_1", "arg_5", "=", "iter", "(", "arg_0", ".", "items", "(", ")", ")", "arg_4", "=", "arg_0", ".", "get", "(", "arg_1", ")", "arg_6", "=", "collections", ".", "OrderedDict", "(", "itertools", ".", "takewhile", "(", "unmatched", ",", "arg_5", ")", ")", "arg_7", "=", "collections", ".", "OrderedDict", "(", "arg_5", ")", "return", "arg_6", ",", "arg_4", ",", "arg_7"], "function": "def Func(arg_0, arg_1):\n\t\"\"\"\n\tGiven an ordered dictionary of items and a key in that dict,\n\treturn an ordered dict of items before, the keyed item, and\n\tan ordered dict of items after.\n\n\t>>> od = collections.OrderedDict(zip(range(5), 'abcde'))\n\t>>> before, item, after = Func(od, 3)\n\t>>> before\n\tOrderedDict([(0, 'a'), (1, 'b'), (2, 'c')])\n\t>>> item\n\t'd'\n\t>>> after\n\tOrderedDict([(4, 'e')])\n\n\tLike string.partition, if the key is not found in the items,\n\tthe before will contain all items, item will be None, and\n\tafter will be an empty iterable.\n\n\t>>> before, item, after = Func(od, -1)\n\t>>> before\n\tOrderedDict([(0, 'a'), ..., (4, 'e')])\n\t>>> item\n\t>>> list(after)\n\t[]\n\t\"\"\"\n\tdef unmatched(arg_2):\n\t\targ_3, arg_4, = arg_2\n\t\treturn arg_3 != arg_1\n\n\targ_5 = iter(arg_0.items())\n\targ_4 = arg_0.get(arg_1)\n\targ_6 = collections.OrderedDict(itertools.takewhile(unmatched, arg_5))\n\targ_7 = collections.OrderedDict(arg_5)\n\treturn arg_6, arg_4, arg_7", "path": "jaraco/itertools.py", "identifier": "partition_dict", "docstring": "Given an ordered dictionary of items and a key in that dict,\n\treturn an ordered dict of items before, the keyed item, and\n\tan ordered dict of items after.\n\n\t>>> od = collections.OrderedDict(zip(range(5), 'abcde'))\n\t>>> before, item, after = partition_dict(od, 3)\n\t>>> before\n\tOrderedDict([(0, 'a'), (1, 'b'), (2, 'c')])\n\t>>> item\n\t'd'\n\t>>> after\n\tOrderedDict([(4, 'e')])\n\n\tLike string.partition, if the key is not found in the items,\n\tthe before will contain all items, item will be None, and\n\tafter will be an empty iterable.\n\n\t>>> before, item, after = partition_dict(od, -1)\n\t>>> before\n\tOrderedDict([(0, 'a'), ..., (4, 'e')])\n\t>>> item\n\t>>> list(after)\n\t[]", "docstring_tokens": ["Given", "an", "ordered", "dictionary", "of", "items", "and", "a", "key", "in", "that", "dict", "return", "an", "ordered", "dict", "of", "items", "before", "the", "keyed", "item", "and", "an", "ordered", "dict", "of", "items", "after", "."], "nwo": "jaraco/jaraco.itertools", "score": 0.2751458370028208, "idx": 255263}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/data/box.py#L50-L58", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "try load value from dict.\n        if key is not exists, mark as state unset.", "language": "python", "parameters": "(self, src: dict, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", "in", "arg_1", ":", "arg_0", ".", "value", "=", "arg_1", "[", "arg_3", "]", "else", ":", "arg_0", ".", "reset", "(", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3):\n        '''\n        try load value from dict.\n        if key is not exists, mark as state unset.\n        '''\n        if arg_3 in arg_1:\n            arg_0.value = arg_1[arg_3]\n        else:\n            arg_0.reset()", "path": "jasily/data/box.py", "identifier": "Box.load_from_dict", "docstring": "try load value from dict.\n        if key is not exists, mark as state unset.", "docstring_tokens": ["try", "load", "value", "from", "dict", ".", "if", "key", "is", "not", "exists", "mark", "as", "state", "unset", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 255264}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/provenance.py#L114-L130", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Group the citation counters by subgraphs induced by the annotation.", "language": "python", "parameters": "(graph: BELGraph, annotation: str)", "return_statement": "return {k: Counter(itt.chain.from_iterable(v.values())) for k, v in citations.items()}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "Mapping", "[", "arg_3", ",", "typing", ".", "Counter", "[", "arg_3", "]", "]", ":", "arg_4", "=", "defaultdict", "(", "lambda", ":", "defaultdict", "(", "set", ")", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "edges", "(", "arg_7", "=", "True", ")", ":", "if", "not", "edge_has_annotation", "(", "arg_7", ",", "arg_2", ")", "or", "CITATION", "not", "in", "arg_7", ":", "continue", "arg_8", "=", "arg_7", "[", "ANNOTATIONS", "]", "[", "arg_2", "]", "arg_4", "[", "arg_8", "]", "[", "arg_5", ",", "arg_6", "]", ".", "add", "(", "(", "arg_7", "[", "CITATION", "]", "[", "CITATION_TYPE", "]", ",", "arg_7", "[", "CITATION", "]", "[", "CITATION_REFERENCE", "]", ".", "strip", "(", ")", ")", ")", "return", "{", "arg_8", ":", "Counter", "(", "itt", ".", "chain", ".", "from_iterable", "(", "arg_6", ".", "values", "(", ")", ")", ")", "for", "arg_8", ",", "arg_6", "in", "arg_4", ".", "items", "(", ")", "}"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> Mapping[arg_3, typing.Counter[arg_3]]:\n    \"\"\"Group the citation counters by subgraphs induced by the annotation.\n\n    :param graph: A BEL graph\n    :param annotation: The annotation to use to group the graph\n    :return: A dictionary of Counters {subgraph name: Counter from {citation: frequency}}\n    \"\"\"\n    arg_4 = defaultdict(lambda: defaultdict(set))\n    for arg_5, arg_6, arg_7 in arg_0.edges(arg_7=True):\n        if not edge_has_annotation(arg_7, arg_2) or CITATION not in arg_7:\n            continue\n\n        arg_8 = arg_7[ANNOTATIONS][arg_2]\n\n        arg_4[arg_8][arg_5, arg_6].add((arg_7[CITATION][CITATION_TYPE], arg_7[CITATION][CITATION_REFERENCE].strip()))\n\n    return {arg_8: Counter(itt.chain.from_iterable(arg_6.values())) for arg_8, arg_6 in arg_4.items()}", "path": "src/pybel_tools/summary/provenance.py", "identifier": "count_citations_by_annotation", "docstring": "Group the citation counters by subgraphs induced by the annotation.\n\n    :param graph: A BEL graph\n    :param annotation: The annotation to use to group the graph\n    :return: A dictionary of Counters {subgraph name: Counter from {citation: frequency}}", "docstring_tokens": ["Group", "the", "citation", "counters", "by", "subgraphs", "induced", "by", "the", "annotation", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255265}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/xvg.py#L360-L369", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Represent data as a masked array.", "language": "python", "parameters": "(self)", "return_statement": "return numpy.ma.MaskedArray(a, mask=numpy.logical_not(numpy.isfinite(a)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "array", "return", "numpy", ".", "Func", ".", "MaskedArray", "(", "arg_1", ",", "Funcsk", "=", "numpy", ".", "logical_not", "(", "numpy", ".", "isfinite", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Represent data as a Funcsked array.\n\n        The array is returned with column-first indexing, i.e. for a data file with\n        columns X Y1 Y2 Y3 ... the array a will be a[0] = X, a[1] = Y1, ... .\n\n        inf and nan are filtered via :func:`numpy.isfinite`.\n        \"\"\"\n        arg_1 = arg_0.array\n        return numpy.Func.MaskedArray(arg_1, Funcsk=numpy.logical_not(numpy.isfinite(arg_1)))", "path": "gromacs/fileformats/xvg.py", "identifier": "XVG.ma", "docstring": "Represent data as a masked array.\n\n        The array is returned with column-first indexing, i.e. for a data file with\n        columns X Y1 Y2 Y3 ... the array a will be a[0] = X, a[1] = Y1, ... .\n\n        inf and nan are filtered via :func:`numpy.isfinite`.", "docstring_tokens": ["Represent", "data", "as", "a", "masked", "array", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 255266}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L366-L374", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Get a unique state id.", "language": "python", "parameters": "(self)", "return_statement": "return id_", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_last_id", ".", "value", "arg_0", ".", "_last_id", ".", "value", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Get a unique state id.\n\n        :rtype: int\n        \"\"\"\n        arg_1 = arg_0._last_id.value\n        arg_0._last_id.value += 1\n        return arg_1", "path": "manticore/core/workspace.py", "identifier": "Workspace._get_id", "docstring": "Get a unique state id.\n\n        :rtype: int", "docstring_tokens": ["Get", "a", "unique", "state", "id", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 255267}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L2127-L2142", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Retrieves a list of the VM Images from the image repository that is\n        associated with the specified subscription.", "language": "python", "parameters": "(self, location=None, publisher=None, category=None)", "return_statement": "return self._perform_get(path, VMImages)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "_get_vm_image_path", "(", ")", "arg_5", "=", "''", "if", "arg_1", ":", "arg_5", "+=", "'&location='", "+", "arg_1", "if", "arg_2", ":", "arg_5", "+=", "'&publisher='", "+", "arg_2", "if", "arg_3", ":", "arg_5", "+=", "'&category='", "+", "arg_3", "if", "arg_5", ":", "arg_4", "=", "arg_4", "+", "'?'", "+", "arg_5", ".", "lstrip", "(", "'&'", ")", "return", "arg_0", ".", "_perform_get", "(", "arg_4", ",", "VMImages", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        '''\n        Retrieves a list of the VM Images from the image repository that is\n        associated with the specified subscription.\n        '''\n        arg_4 = arg_0._get_vm_image_path()\n        arg_5 = ''\n        if arg_1:\n            arg_5 += '&location=' + arg_1\n        if arg_2:\n            arg_5 += '&publisher=' + arg_2\n        if arg_3:\n            arg_5 += '&category=' + arg_3\n        if arg_5:\n            arg_4 = arg_4 + '?' + arg_5.lstrip('&')\n        return arg_0._perform_get(arg_4, VMImages)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.list_vm_images", "docstring": "Retrieves a list of the VM Images from the image repository that is\n        associated with the specified subscription.", "docstring_tokens": ["Retrieves", "a", "list", "of", "the", "VM", "Images", "from", "the", "image", "repository", "that", "is", "associated", "with", "the", "specified", "subscription", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255268}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/meta.py#L579-L630", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Create and return a new instance.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return inst", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "clazz", "(", ")", "arg_0", ".", "storage", ".", "append", "(", "arg_3", ")", "arg_4", "=", "dict", "(", ")", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "attributes", ":", "if", "arg_5", "not", "in", "arg_0", ".", "referential_attributes", ":", "arg_7", "=", "arg_0", ".", "default_value", "(", "arg_6", ")", "setattr", "(", "arg_3", ",", "arg_5", ",", "arg_7", ")", "for", "arg_8", ",", "arg_7", "in", "zip", "(", "arg_0", ".", "attributes", ",", "arg_1", ")", ":", "arg_5", ",", "arg_6", "=", "arg_8", "if", "arg_5", "not", "in", "arg_0", ".", "referential_attributes", ":", "setattr", "(", "arg_3", ",", "arg_5", ",", "arg_7", ")", "else", ":", "arg_4", "[", "arg_5", "]", "=", "arg_7", "for", "arg_5", ",", "arg_7", "in", "arg_2", ".", "items", "(", ")", ":", "if", "arg_5", "not", "in", "arg_0", ".", "referential_attributes", ":", "setattr", "(", "arg_3", ",", "arg_5", ",", "arg_7", ")", "else", ":", "arg_4", "[", "arg_5", "]", "=", "arg_7", "if", "not", "arg_4", ":", "return", "arg_3", "for", "arg_9", "in", "arg_0", ".", "links", ".", "values", "(", ")", ":", "if", "set", "(", "arg_9", ".", "key_map", ".", "values", "(", ")", ")", "-", "set", "(", "arg_4", ".", "keys", "(", ")", ")", ":", "continue", "arg_2", "=", "dict", "(", ")", "for", "arg_10", ",", "arg_7", "in", "arg_9", ".", "key_map", ".", "items", "(", ")", ":", "arg_2", "[", "arg_10", "]", "=", "arg_4", "[", "arg_7", "]", "if", "not", "arg_2", ":", "continue", "for", "arg_11", "in", "arg_9", ".", "to_metaclass", ".", "query", "(", "arg_2", ")", ":", "relate", "(", "arg_11", ",", "arg_3", ",", "arg_9", ".", "rel_id", ",", "arg_9", ".", "phrase", ")", "for", "arg_5", ",", "arg_7", "in", "arg_4", ".", "items", "(", ")", ":", "if", "getattr", "(", "arg_3", ",", "arg_5", ")", "!=", "arg_7", ":", "logger", ".", "warning", "(", "'unable to assign %s to %s'", ",", "arg_5", ",", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        '''\n        Create and return a Func instance.\n        '''\n        arg_3 = arg_0.clazz()\n        arg_0.storage.append(arg_3)\n        \n        # set all attributes with an initial default value\n        arg_4 = dict()\n        for arg_5, arg_6 in arg_0.attributes:\n            if arg_5 not in arg_0.referential_attributes:\n                arg_7 = arg_0.default_value(arg_6)\n                setattr(arg_3, arg_5, arg_7)\n            \n        # set all positional arguments\n        for arg_8, arg_7 in zip(arg_0.attributes, arg_1):\n            arg_5, arg_6 = arg_8\n            if arg_5 not in arg_0.referential_attributes:\n                setattr(arg_3, arg_5, arg_7)\n            else:\n                arg_4[arg_5] = arg_7\n            \n        # set all named arguments\n        for arg_5, arg_7 in arg_2.items():\n            if arg_5 not in arg_0.referential_attributes:\n                setattr(arg_3, arg_5, arg_7)\n            else:\n                arg_4[arg_5] = arg_7\n        \n        if not arg_4:\n            return arg_3\n        \n        # batch relate referential attributes \n        for arg_9 in arg_0.links.values():\n            if set(arg_9.key_map.values()) - set(arg_4.keys()):\n                continue\n             \n            arg_2 = dict()\n            for arg_10, arg_7 in arg_9.key_map.items():\n                arg_2[arg_10] = arg_4[arg_7]\n            \n            if not arg_2:\n                continue\n            \n            for arg_11 in arg_9.to_metaclass.query(arg_2):\n                relate(arg_11, arg_3, arg_9.rel_id, arg_9.phrase)\n        \n        for arg_5, arg_7 in arg_4.items():\n            if getattr(arg_3, arg_5) != arg_7:\n                logger.warning('unable to assign %s to %s', arg_5, arg_3)\n                \n        return arg_3", "path": "xtuml/meta.py", "identifier": "MetaClass.new", "docstring": "Create and return a new instance.", "docstring_tokens": ["Create", "and", "return", "a", "new", "instance", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 255269}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1767-L1808", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "If input points to ( or { or [ or <, finds the position that closes it.", "language": "python", "parameters": "(clean_lines, linenum, pos)", "return_statement": "return (line, clean_lines.NumLines(), -1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "elided", "[", "arg_1", "]", "if", "(", "arg_3", "[", "arg_2", "]", "not", "in", "'({[<'", ")", "or", "Match", "(", "r'<[<=]'", ",", "arg_3", "[", "arg_2", ":", "]", ")", ":", "return", "(", "arg_3", ",", "arg_0", ".", "NumLines", "(", ")", ",", "-", "1", ")", "(", "arg_4", ",", "arg_5", ")", "=", "FindEndOfExpressionInLine", "(", "arg_3", ",", "arg_2", ",", "[", "]", ")", "if", "arg_4", ">", "-", "1", ":", "return", "(", "arg_3", ",", "arg_1", ",", "arg_4", ")", "while", "arg_5", "and", "arg_1", "<", "arg_0", ".", "NumLines", "(", ")", "-", "1", ":", "arg_1", "+=", "1", "arg_3", "=", "arg_0", ".", "elided", "[", "arg_1", "]", "(", "arg_4", ",", "arg_5", ")", "=", "FindEndOfExpressionInLine", "(", "arg_3", ",", "0", ",", "arg_5", ")", "if", "arg_4", ">", "-", "1", ":", "return", "(", "arg_3", ",", "arg_1", ",", "arg_4", ")", "return", "(", "arg_3", ",", "arg_0", ".", "NumLines", "(", ")", ",", "-", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"If input points to ( or { or [ or <, finds the position that closes it.\n\n  If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the\n  linenum/pos that correspond to the closing of the expression.\n\n  TODO(unknown): cpplint spends a fair bit of time matching parentheses.\n  Ideally we would want to index all opening and closing parentheses once\n  and have Func be just a simple lookup, but due to preprocessor\n  tricks, this is not so easy.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    pos: A position on the line.\n\n  Returns:\n    A tuple (line, linenum, pos) pointer *past* the closing brace, or\n    (line, len(lines), -1) if we never find a close.  Note we ignore\n    strings and comments when matching; and the line we return is the\n    'cleansed' line at linenum.\n  \"\"\"\n\n  arg_3 = arg_0.elided[arg_1]\n  if (arg_3[arg_2] not in '({[<') or Match(r'<[<=]', arg_3[arg_2:]):\n    return (arg_3, arg_0.NumLines(), -1)\n\n  # Check first line\n  (arg_4, arg_5) = FindEndOfExpressionInLine(arg_3, arg_2, [])\n  if arg_4 > -1:\n    return (arg_3, arg_1, arg_4)\n\n  # Continue scanning forward\n  while arg_5 and arg_1 < arg_0.NumLines() - 1:\n    arg_1 += 1\n    arg_3 = arg_0.elided[arg_1]\n    (arg_4, arg_5) = FindEndOfExpressionInLine(arg_3, 0, arg_5)\n    if arg_4 > -1:\n      return (arg_3, arg_1, arg_4)\n\n  # Did not find end of expression before end of file, give up\n  return (arg_3, arg_0.NumLines(), -1)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CloseExpression", "docstring": "If input points to ( or { or [ or <, finds the position that closes it.\n\n  If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the\n  linenum/pos that correspond to the closing of the expression.\n\n  TODO(unknown): cpplint spends a fair bit of time matching parentheses.\n  Ideally we would want to index all opening and closing parentheses once\n  and have CloseExpression be just a simple lookup, but due to preprocessor\n  tricks, this is not so easy.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    pos: A position on the line.\n\n  Returns:\n    A tuple (line, linenum, pos) pointer *past* the closing brace, or\n    (line, len(lines), -1) if we never find a close.  Note we ignore\n    strings and comments when matching; and the line we return is the\n    'cleansed' line at linenum.", "docstring_tokens": ["If", "input", "points", "to", "(", "or", "{", "or", "[", "or", "<", "finds", "the", "position", "that", "closes", "it", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255270}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/launchpad.py#L418-L446", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Return the items from Launchpad API using pagination", "language": "python", "parameters": "(self, path, payload)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "0", "arg_4", "=", "arg_1", "arg_5", "=", "True", "while", "arg_5", ":", "logger", ".", "debug", "(", "\"Fetching page: %i\"", ",", "arg_3", ")", "try", ":", "arg_6", "=", "arg_0", ".", "__send_request", "(", "arg_4", ",", "arg_2", ")", "arg_7", "=", "json", ".", "loads", "(", "arg_6", ")", "except", "requests", ".", "exceptions", ".", "HTTPError", "as", "e", ":", "if", "e", ".", "response", ".", "status_code", "in", "[", "410", "]", ":", "logger", ".", "warning", "(", "\"Data is not available - %s\"", ",", "arg_4", ")", "arg_6", "=", "'{\"total_size\": 0, \"start\": 0, \"entries\": []}'", "arg_7", "=", "json", ".", "loads", "(", "arg_6", ")", "else", ":", "raise", "e", "if", "'next_collection_link'", "in", "arg_7", ":", "arg_4", "=", "arg_7", "[", "'next_collection_link'", "]", "arg_2", "=", "None", "else", ":", "arg_5", "=", "False", "yield", "arg_6", "arg_3", "+=", "1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return the items from Launchpad API using pagination\"\"\"\n\n        arg_3 = 0  # current page\n        arg_4 = arg_1\n        arg_5 = True\n\n        while arg_5:\n            logger.debug(\"Fetching page: %i\", arg_3)\n\n            try:\n                arg_6 = arg_0.__send_request(arg_4, arg_2)\n                arg_7 = json.loads(arg_6)\n            except requests.exceptions.HTTPError as e:\n                if e.response.status_code in [410]:\n                    logger.warning(\"Data is not available - %s\", arg_4)\n                    arg_6 = '{\"total_size\": 0, \"start\": 0, \"entries\": []}'\n                    arg_7 = json.loads(arg_6)\n                else:\n                    raise e\n\n            if 'next_collection_link' in arg_7:\n                arg_4 = arg_7['next_collection_link']\n                arg_2 = None\n            else:\n                arg_5 = False\n\n            yield arg_6\n            arg_3 += 1", "path": "perceval/backends/core/launchpad.py", "identifier": "LaunchpadClient.__fetch_items", "docstring": "Return the items from Launchpad API using pagination", "docstring_tokens": ["Return", "the", "items", "from", "Launchpad", "API", "using", "pagination"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255271}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/convert.py#L247-L257", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Slow conversion of a recarray into a list of records with python types.", "language": "python", "parameters": "(a)", "return_statement": "return (convert_record(r) for r in a)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "pyify", "(", "typestr", ")", "for", "name", ",", "typestr", "in", "arg_0", ".", "dtype", ".", "descr", "]", "def", "convert_record", "(", "arg_2", ")", ":", "return", "tuple", "(", "[", "arg_3", "(", "arg_4", ")", "for", "arg_3", ",", "arg_4", "in", "zip", "(", "arg_1", ",", "arg_2", ")", "]", ")", "return", "(", "convert_record", "(", "arg_2", ")", "for", "arg_2", "in", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Slow conversion of a recarray into a list of records with python types.\n\n    Get the field names from :attr:`a.dtype.names`.\n\n    :Returns: iterator so that one can handle big input arrays\n    \"\"\"\n    arg_1 = [pyify(typestr) for name,typestr in arg_0.dtype.descr]\n    def convert_record(arg_2):\n        return tuple([arg_3(arg_4) for arg_3, arg_4 in zip(arg_1,arg_2)])\n    return (convert_record(arg_2) for arg_2 in arg_0)", "path": "gromacs/fileformats/convert.py", "identifier": "irecarray_to_py", "docstring": "Slow conversion of a recarray into a list of records with python types.\n\n    Get the field names from :attr:`a.dtype.names`.\n\n    :Returns: iterator so that one can handle big input arrays", "docstring_tokens": ["Slow", "conversion", "of", "a", "recarray", "into", "a", "list", "of", "records", "with", "python", "types", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 255272}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L650-L691", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Single Sample GSEA workflow with permutation procedure", "language": "python", "parameters": "(self, df, gmt=None)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "assert", "arg_0", ".", "min_size", "<=", "arg_0", ".", "max_size", "mkdirs", "(", "arg_0", ".", "outdir", ")", "arg_0", ".", "resultsOnSamples", "=", "OrderedDict", "(", ")", "arg_4", "=", "arg_0", ".", "outdir", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "iteritems", "(", ")", ":", "arg_0", ".", "outdir", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "str", "(", "arg_5", ")", ")", "arg_0", ".", "_logger", ".", "info", "(", "\"Run Sample: %s \"", "%", "arg_5", ")", "mkdirs", "(", "arg_0", ".", "outdir", ")", "arg_7", "=", "arg_6", ".", "sort_values", "(", "ascending", "=", "arg_0", ".", "ascending", ")", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "gsea_compute", "(", "data", "=", "arg_7", ",", "n", "=", "arg_0", ".", "permutation_num", ",", "arg_2", "=", "arg_2", ",", "weighted_score_type", "=", "arg_0", ".", "weighted_score_type", ",", "permutation_type", "=", "'gene_set'", ",", "method", "=", "None", ",", "pheno_pos", "=", "''", ",", "pheno_neg", "=", "''", ",", "classes", "=", "None", ",", "ascending", "=", "arg_0", ".", "ascending", ",", "processes", "=", "arg_0", ".", "_processes", ",", "seed", "=", "arg_0", ".", "seed", ",", "single", "=", "True", ",", "scale", "=", "arg_0", ".", "scale", ")", "arg_12", "=", "zip", "(", "arg_11", ",", "list", "(", "arg_8", ")", ",", "arg_9", ",", "arg_10", ")", "arg_0", ".", "_save_results", "(", "zipdata", "=", "arg_12", ",", "arg_4", "=", "arg_0", ".", "outdir", ",", "module", "=", "arg_0", ".", "module", ",", "arg_2", "=", "arg_2", ",", "rank_metric", "=", "arg_7", ",", "permutation_type", "=", "\"gene_sets\"", ")", "arg_0", ".", "resultsOnSamples", "[", "arg_5", "]", "=", "arg_0", ".", "res2d", ".", "es", "if", "arg_0", ".", "_noplot", ":", "continue", "arg_0", ".", "_logger", ".", "info", "(", "\"Plotting Sample: %s \\n\"", "%", "arg_5", ")", "arg_0", ".", "_plotting", "(", "rank_metric", "=", "arg_7", ",", "results", "=", "arg_0", ".", "results", ",", "graph_num", "=", "arg_0", ".", "graph_num", ",", "arg_4", "=", "arg_0", ".", "outdir", ",", "figsize", "=", "arg_0", ".", "figsize", ",", "format", "=", "arg_0", ".", "format", ")", "arg_0", ".", "_save", "(", "arg_4", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Single Sample GSEA workflow with permutation procedure\"\"\"\n\n        assert arg_0.min_size <= arg_0.max_size\n        mkdirs(arg_0.outdir)\n        arg_0.resultsOnSamples = OrderedDict()\n        arg_4 = arg_0.outdir\n        # iter throught each sample\n        for arg_5, arg_6 in arg_1.iteritems():\n            arg_0.outdir = os.path.join(arg_4, str(arg_5))\n            arg_0._logger.info(\"Run Sample: %s \" % arg_5)\n            mkdirs(arg_0.outdir)\n            # sort ranking values from high to low or reverse\n            arg_7 = arg_6.sort_values(ascending=arg_0.ascending)\n            # reset integer index, or caused unwanted problems\n            # df.reset_index(drop=True, inplace=True)\n\n            # compute ES, NES, pval, FDR, RES\n            arg_8, arg_9,arg_10, arg_11 = gsea_compute(data=arg_7, n=arg_0.permutation_num, arg_2=arg_2,\n                                                                  weighted_score_type=arg_0.weighted_score_type,\n                                                                  permutation_type='gene_set', method=None,\n                                                                  pheno_pos='', pheno_neg='',\n                                                                  classes=None, ascending=arg_0.ascending,\n                                                                  processes=arg_0._processes,\n                                                                  seed=arg_0.seed, single=True, scale=arg_0.scale)\n\n            # write file\n            arg_12 = zip(arg_11, list(arg_8), arg_9, arg_10)\n            arg_0._save_results(zipdata=arg_12, arg_4=arg_0.outdir, module=arg_0.module,\n                                       arg_2=arg_2, rank_metric=arg_7, permutation_type=\"gene_sets\")\n            arg_0.resultsOnSamples[arg_5] = arg_0.res2d.es\n            # plotting\n            if arg_0._noplot: continue\n            arg_0._logger.info(\"Plotting Sample: %s \\n\" % arg_5)\n            arg_0._plotting(rank_metric=arg_7, results=arg_0.results,\n                           graph_num=arg_0.graph_num, arg_4=arg_0.outdir,\n                           figsize=arg_0.figsize, format=arg_0.format)\n\n        # save es, nes to file\n        arg_0._save(arg_4)\n\n        return", "path": "gseapy/gsea.py", "identifier": "SingleSampleGSEA.runSamplesPermu", "docstring": "Single Sample GSEA workflow with permutation procedure", "docstring_tokens": ["Single", "Sample", "GSEA", "workflow", "with", "permutation", "procedure"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 255273}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/db.py#L233-L236", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Returns a list of patches before patch from the patches list", "language": "python", "parameters": "(self, patch)", "return_statement": "return [line.get_patch() for line in self._patchlines_before(patch)\n                if line.get_patch()]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "[", "arg_2", ".", "get_patch", "(", ")", "for", "arg_2", "in", "arg_0", ".", "_patchlines_before", "(", "arg_1", ")", "if", "arg_2", ".", "get_patch", "(", ")", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns a list of patches before patch from the patches list \"\"\"\n        return [arg_2.get_patch() for arg_2 in arg_0._patchlines_before(arg_1)\n                if arg_2.get_patch()]", "path": "quilt/db.py", "identifier": "PatchSeries.patches_before", "docstring": "Returns a list of patches before patch from the patches list", "docstring_tokens": ["Returns", "a", "list", "of", "patches", "before", "patch", "from", "the", "patches", "list"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 255274}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/sampling/hr_sampler.py#L194-L236", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Build the matrix representation of the sampling problem.", "language": "python", "parameters": "(self)", "return_statement": "return Problem(\n            equalities=shared_np_array(equalities.shape, equalities),\n            b=shared_np_array(b.shape, b),\n            inequalities=shared_np_array(prob.inequalities.shape,\n                                         prob.inequalities),\n            bounds=shared_np_array(bounds.shape, bounds),\n            variable_fixed=shared_np_array(prob.variable_fixed.shape,\n                                           prob.variable_fixed, integer=True),\n            variable_bounds=shared_np_array(var_bounds.shape, var_bounds),\n            nullspace=shared_np_array(nulls.shape, nulls),\n            homogeneous=homogeneous\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "constraint_matrices", "(", "arg_0", ".", "model", ",", "zero_tol", "=", "arg_0", ".", "feasibility_tol", ")", "arg_2", "=", "arg_1", ".", "equalities", "arg_3", "=", "arg_1", ".", "b", "arg_4", "=", "arg_11", ".", "atleast_2d", "(", "arg_1", ".", "bounds", ")", ".", "T", "arg_5", "=", "arg_11", ".", "atleast_2d", "(", "arg_1", ".", "variable_bounds", ")", ".", "T", "arg_6", "=", "all", "(", "arg_11", ".", "abs", "(", "arg_3", ")", "<", "arg_0", ".", "feasibility_tol", ")", "arg_7", "=", "arg_11", ".", "abs", "(", "arg_1", ".", "variable_bounds", "[", ":", ",", "1", "]", ")", ">", "arg_0", ".", "feasibility_tol", "arg_7", "&=", "arg_1", ".", "variable_fixed", "if", "any", "(", "arg_7", ")", ":", "arg_8", "=", "arg_7", ".", "sum", "(", ")", "arg_9", "=", "arg_11", ".", "zeros", "(", "(", "arg_8", ",", "arg_1", ".", "equalities", ".", "shape", "[", "1", "]", ")", ")", "arg_9", "[", "arg_10", "(", "arg_8", ")", ",", "arg_11", ".", "where", "(", "arg_7", ")", "]", "=", "1.0", "arg_2", "=", "arg_11", ".", "vstack", "(", "[", "arg_2", ",", "arg_9", "]", ")", "arg_13", "=", "arg_1", ".", "variable_bounds", "[", ":", ",", "1", "]", "arg_3", "=", "arg_11", ".", "hstack", "(", "[", "arg_3", ",", "arg_13", "[", "arg_7", "]", "]", ")", "arg_6", "=", "False", "arg_14", "=", "nullspace", "(", "arg_2", ")", "return", "Problem", "(", "arg_2", "=", "shared_np_array", "(", "arg_2", ".", "shape", ",", "arg_2", ")", ",", "arg_3", "=", "shared_np_array", "(", "arg_3", ".", "shape", ",", "arg_3", ")", ",", "inequalities", "=", "shared_np_array", "(", "arg_1", ".", "inequalities", ".", "shape", ",", "arg_1", ".", "inequalities", ")", ",", "arg_4", "=", "shared_np_array", "(", "arg_4", ".", "shape", ",", "arg_4", ")", ",", "variable_fixed", "=", "shared_np_array", "(", "arg_1", ".", "variable_fixed", ".", "shape", ",", "arg_1", ".", "variable_fixed", ",", "integer", "=", "True", ")", ",", "variable_bounds", "=", "shared_np_array", "(", "arg_5", ".", "shape", ",", "arg_5", ")", ",", "nullspace", "=", "shared_np_array", "(", "arg_14", ".", "shape", ",", "arg_14", ")", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0):\n        \"\"\"Build the matrix representation of the sampling problem.\"\"\"\n\n        # Set up the mathematical problem\n        arg_1 = constraint_matrices(arg_0.model, zero_tol=arg_0.feasibility_tol)\n\n        # check if there any non-zero equality constraints\n        arg_2 = arg_1.equalities\n        arg_3 = arg_1.b\n        arg_4 = arg_11.atleast_2d(arg_1.bounds).T\n        arg_5 = arg_11.atleast_2d(arg_1.variable_bounds).T\n        arg_6 = all(arg_11.abs(arg_3) < arg_0.feasibility_tol)\n        arg_7 = arg_11.abs(arg_1.variable_bounds[:, 1]) > \\\n            arg_0.feasibility_tol\n        arg_7 &= arg_1.variable_fixed\n\n        # check if there are any non-zero fixed variables, add them as\n        # equalities to the stoichiometric matrix\n        if any(arg_7):\n            arg_8 = arg_7.sum()\n            arg_9 = arg_11.zeros((arg_8, arg_1.equalities.shape[1]))\n            arg_9[arg_10(arg_8), arg_11.where(arg_7)] = 1.0\n            arg_2 = arg_11.vstack([arg_2, arg_9])\n            arg_13 = arg_1.variable_bounds[:, 1]\n            arg_3 = arg_11.hstack([arg_3, arg_13[arg_7]])\n            arg_6 = False\n\n        # Set up a projection that can cast point into the nullspace\n        arg_14 = nullspace(arg_2)\n\n        # convert bounds to a matrix and add variable bounds as well\n        return Problem(\n            arg_2=shared_np_array(arg_2.shape, arg_2),\n            arg_3=shared_np_array(arg_3.shape, arg_3),\n            inequalities=shared_np_array(arg_1.inequalities.shape,\n                                         arg_1.inequalities),\n            arg_4=shared_np_array(arg_4.shape, arg_4),\n            variable_fixed=shared_np_array(arg_1.variable_fixed.shape,\n                                           arg_1.variable_fixed, integer=True),\n            variable_bounds=shared_np_array(arg_5.shape, arg_5),\n            nullspace=shared_np_array(arg_14.shape, arg_14),\n            arg_6=arg_6\n        )", "path": "cobra/sampling/hr_sampler.py", "identifier": "HRSampler.__build_problem", "docstring": "Build the matrix representation of the sampling problem.", "docstring_tokens": ["Build", "the", "matrix", "representation", "of", "the", "sampling", "problem", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255275}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1279-L1301", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Hann-Poisson tapering window", "language": "python", "parameters": "(N, alpha=2)", "return_statement": "return w1*w2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", ")", ":", "arg_2", "=", "window_hann", "(", "arg_0", ")", "arg_3", "=", "window_poisson", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "arg_2", "*", "arg_3"], "function": "def Func(arg_0, arg_1=2):\n    r\"\"\"Hann-Poisson tapering window\n\n    This window is constructed as the product of the Hanning and Poisson\n    windows. The parameter **alpha** is the Poisson parameter.\n\n    :param int N: window length\n    :param float alpha: parameter of the poisson window\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'poisson_hanning', alpha=0.5)\n        window_visu(64, 'poisson_hanning', alpha=1)\n        window_visu(64, 'poisson_hanning')\n\n    .. seealso:: :func:`window_poisson`, :func:`window_hann`\n    \"\"\"\n    arg_2 = window_hann(arg_0)\n    arg_3 = window_poisson(arg_0, arg_1=arg_1)\n    return arg_2*arg_3", "path": "src/spectrum/window.py", "identifier": "window_poisson_hanning", "docstring": "r\"\"\"Hann-Poisson tapering window\n\n    This window is constructed as the product of the Hanning and Poisson\n    windows. The parameter **alpha** is the Poisson parameter.\n\n    :param int N: window length\n    :param float alpha: parameter of the poisson window\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'poisson_hanning', alpha=0.5)\n        window_visu(64, 'poisson_hanning', alpha=1)\n        window_visu(64, 'poisson_hanning')\n\n    .. seealso:: :func:`window_poisson`, :func:`window_hann`", "docstring_tokens": ["r", "Hann", "-", "Poisson", "tapering", "window"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 255276}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/tf_model.py#L68-L77", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Save model parameters to self.save_path", "language": "python", "parameters": "(self, exclude_scopes: tuple = ('Optimizer',))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "=", "(", "'Optimizer'", ",", ")", ")", "->", "None", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'sess'", ")", ":", "raise", "RuntimeError", "(", "'Your TensorFlow model {} must'", "' have sess attribute!'", ".", "format", "(", "arg_0", ".", "__class__", ".", "__name__", ")", ")", "arg_3", "=", "str", "(", "arg_0", ".", "Func_path", ".", "resolve", "(", ")", ")", "log", ".", "info", "(", "'[saving model to {}]'", ".", "format", "(", "arg_3", ")", ")", "arg_4", "=", "arg_0", ".", "_get_Funcable_variables", "(", "arg_1", ")", "arg_5", "=", "tf", ".", "train", ".", "Saver", "(", "arg_4", ")", "arg_5", ".", "Func", "(", "arg_0", ".", "sess", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2 = ('Optimizer',)) -> None:\n        \"\"\"Save model parameters to self.Func_path\"\"\"\n        if not hasattr(arg_0, 'sess'):\n            raise RuntimeError('Your TensorFlow model {} must'\n                               ' have sess attribute!'.format(arg_0.__class__.__name__))\n        arg_3 = str(arg_0.Func_path.resolve())\n        log.info('[saving model to {}]'.format(arg_3))\n        arg_4 = arg_0._get_Funcable_variables(arg_1)\n        arg_5 = tf.train.Saver(arg_4)\n        arg_5.Func(arg_0.sess, arg_3)", "path": "deeppavlov/core/models/tf_model.py", "identifier": "TFModel.save", "docstring": "Save model parameters to self.save_path", "docstring_tokens": ["Save", "model", "parameters", "to", "self", ".", "save_path"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255277}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/tree.py#L82-L96", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Append a node as the last child", "language": "python", "parameters": "(self, child, index=-1)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "-", "1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "text", "(", "arg_1", ",", "parent", "=", "arg_0", ")", "else", ":", "arg_1", ".", "_xml_parent", "=", "weakref", ".", "ref", "(", "arg_0", ")", "if", "arg_2", "==", "-", "1", ":", "arg_0", ".", "xml_children", ".", "append", "(", "arg_1", ")", "else", ":", "arg_0", ".", "xml_children", ".", "insert", "(", "arg_2", ",", "arg_1", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2=-1):\n        '''\n        Append a node as the last child\n\n        child - the child to append. If a string, convert to a text node, for convenience\n        '''\n        if isinstance(arg_1, str):\n            arg_1 = text(arg_1, parent=arg_0)\n        else:\n            arg_1._xml_parent = weakref.ref(arg_0)\n        if arg_2 == -1:\n            arg_0.xml_children.append(arg_1)\n        else:\n            arg_0.xml_children.insert(arg_2, arg_1)\n        return", "path": "pylib/uxml/tree.py", "identifier": "element.xml_insert", "docstring": "Append a node as the last child\n\n        child - the child to append. If a string, convert to a text node, for convenience", "docstring_tokens": ["Append", "a", "node", "as", "the", "last", "child"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 255278}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L146-L158", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Load a disease term into the database", "language": "python", "parameters": "(self, disease_obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "debug", "(", "\"Loading disease term %s into database\"", ",", "arg_1", "[", "'_id'", "]", ")", "try", ":", "arg_0", ".", "disease_term_collection", ".", "insert_one", "(", "arg_1", ")", "except", "DuplicateKeyError", "as", "err", ":", "raise", "IntegrityError", "(", "\"Disease term %s already exists in database\"", ".", "format", "(", "arg_1", "[", "'_id'", "]", ")", ")", "LOG", ".", "debug", "(", "\"Disease term saved\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Load a disease term into the database\n\n        Args:\n            disease_obj(dict)\n        \"\"\"\n        LOG.debug(\"Loading disease term %s into database\", arg_1['_id'])\n        try:\n            arg_0.disease_term_collection.insert_one(arg_1)\n        except DuplicateKeyError as err:\n            raise IntegrityError(\"Disease term %s already exists in database\".format(arg_1['_id']))\n\n        LOG.debug(\"Disease term saved\")", "path": "scout/adapter/mongo/hpo.py", "identifier": "HpoHandler.load_disease_term", "docstring": "Load a disease term into the database\n\n        Args:\n            disease_obj(dict)", "docstring_tokens": ["Load", "a", "disease", "term", "into", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255279}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L254-L283", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return all variants seen in a given gene.", "language": "python", "parameters": "(self, query=None,\n                   category='snv', variant_type=['clinical'],\n                   nr_of_variants=50, skip=0)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'snv'", ",", "arg_3", "=", "[", "'clinical'", "]", ",", "arg_4", "=", "50", ",", "arg_5", "=", "0", ")", ":", "arg_6", "=", "arg_0", ".", "build_variant_query", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_7", "=", "[", "(", "'rank_score'", ",", "pymongo", ".", "DESCENDING", ")", "]", "if", "arg_4", "==", "-", "1", ":", "arg_4", "=", "0", "else", ":", "arg_4", "=", "arg_5", "+", "arg_4", "arg_8", "=", "arg_0", ".", "variant_collection", ".", "find", "(", "arg_6", ")", ".", "sort", "(", "arg_7", ")", ".", "skip", "(", "arg_5", ")", ".", "limit", "(", "arg_4", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1=None,\n                   arg_2='snv', arg_3=['clinical'],\n                   arg_4=50, arg_5=0):\n        \"\"\"Return all variants seen in a given gene.\n\n        If skip not equal to 0 skip the first n variants.\n\n        Arguments:\n            query(dict): A dictionary with querys for the database, including\n            variant_type: 'clinical', 'research'\n            category(str): 'sv', 'str', 'snv' or 'cancer'\n            nr_of_variants(int): if -1 return all variants\n            skip(int): How many variants to skip\n        \"\"\"\n\n        arg_6 = arg_0.build_variant_query(arg_1=arg_1,\n                                   arg_2=arg_2, arg_3=arg_3)\n\n        arg_7 = [('rank_score', pymongo.DESCENDING)]\n\n        if arg_4 == -1:\n            arg_4 = 0 # This will return all variants\n        else:\n            arg_4 = arg_5 + arg_4\n\n        arg_8 = arg_0.variant_collection.find(\n            arg_6\n            ).sort(arg_7).skip(arg_5).limit(arg_4)\n\n        return arg_8", "path": "scout/adapter/mongo/variant.py", "identifier": "VariantHandler.gene_variants", "docstring": "Return all variants seen in a given gene.\n\n        If skip not equal to 0 skip the first n variants.\n\n        Arguments:\n            query(dict): A dictionary with querys for the database, including\n            variant_type: 'clinical', 'research'\n            category(str): 'sv', 'str', 'snv' or 'cancer'\n            nr_of_variants(int): if -1 return all variants\n            skip(int): How many variants to skip", "docstring_tokens": ["Return", "all", "variants", "seen", "in", "a", "given", "gene", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255280}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L69-L73", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Print, emphasized 'warning', the given 'txt' message", "language": "python", "parameters": "(txt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "\"%s# %s%s%s\"", "%", "(", "PR_WARN_CC", ",", "get_time_stamp", "(", ")", ",", "arg_0", ",", "PR_NC", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Print, emphasized 'Funcing', the given 'txt' message\"\"\"\n\n    print(\"%s# %s%s%s\" % (PR_WARN_CC, get_time_stamp(), arg_0, PR_NC))\n    sys.stdout.flush()", "path": "modules/cij/__init__.py", "identifier": "warn", "docstring": "Print, emphasized 'warning', the given 'txt' message", "docstring_tokens": ["Print", "emphasized", "warning", "the", "given", "txt", "message"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 255281}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L49-L53", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Commands for build jobs.", "language": "python", "parameters": "(ctx, project, build)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "Func", ")", ":", "arg_0", ".", "obj", "=", "arg_0", ".", "obj", "or", "{", "}", "arg_0", ".", "obj", "[", "'project'", "]", "=", "arg_1", "arg_0", ".", "obj", "[", "'build'", "]", "=", "Func"], "function": "def Func(arg_0, arg_1, Func):  # pylint:disable=redefined-outer-name\n    \"\"\"Commands for build jobs.\"\"\"\n    arg_0.obj = arg_0.obj or {}\n    arg_0.obj['project'] = arg_1\n    arg_0.obj['build'] = Func", "path": "polyaxon_cli/cli/build.py", "identifier": "build", "docstring": "Commands for build jobs.", "docstring_tokens": ["Commands", "for", "build", "jobs", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 255282}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/files.py#L349-L431", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Add files to the repository by explicitly specifying them or by\n    specifying a pattern over files accessed during execution of an\n    executable.", "language": "python", "parameters": "(repo, args, targetdir,\n        execute=False, generator=False,\n        includes=[], script=False,\n        source=None)", "return_statement": "return len(filtered_files)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "[", "]", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ")", ":", "if", "not", "arg_3", ":", "arg_8", "=", "Func_files", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_7", "=", "arg_7", ",", "arg_6", "=", "arg_6", ",", "arg_4", "=", "arg_4", ")", "else", ":", "arg_8", "=", "run_executable", "(", "arg_0", ",", "arg_1", ",", "arg_5", ")", "if", "arg_8", "is", "None", "or", "len", "(", "arg_8", ")", "==", "0", ":", "return", "arg_0", "arg_9", "=", "[", "]", "arg_10", "=", "arg_0", ".", "package", "for", "arg_11", "in", "arg_8", ":", "arg_12", "=", "False", "for", "arg_13", ",", "arg_14", "in", "enumerate", "(", "arg_10", "[", "'resources'", "]", ")", ":", "if", "arg_11", "[", "'relativepath'", "]", "==", "arg_14", "[", "'relativepath'", "]", ":", "arg_12", "=", "True", "if", "arg_11", "[", "'sha256'", "]", "==", "arg_14", "[", "'sha256'", "]", ":", "arg_15", "=", "False", "for", "arg_16", "in", "[", "'source'", "]", ":", "if", "arg_11", "[", "arg_16", "]", "!=", "arg_14", "[", "arg_16", "]", ":", "arg_14", "[", "arg_16", "]", "=", "arg_11", "[", "arg_16", "]", "arg_15", "=", "True", "if", "arg_15", ":", "arg_9", ".", "append", "(", "arg_11", ")", "continue", "else", ":", "arg_9", ".", "append", "(", "arg_11", ")", "arg_10", "[", "'resources'", "]", "[", "arg_13", "]", "=", "arg_11", "break", "if", "not", "arg_12", ":", "arg_9", ".", "append", "(", "arg_11", ")", "arg_10", "[", "'resources'", "]", ".", "append", "(", "arg_11", ")", "if", "len", "(", "arg_9", ")", "==", "0", ":", "return", "0", "arg_0", ".", "manager", ".", "Func_files", "(", "arg_0", ",", "arg_9", ")", "arg_17", "=", "arg_0", ".", "rootdir", "with", "cd", "(", "arg_17", ")", ":", "arg_18", "=", "\"datapackage.json\"", "with", "open", "(", "arg_18", ",", "'w'", ")", "as", "fd", ":", "fd", ".", "write", "(", "json", ".", "dumps", "(", "arg_10", ",", "indent", "=", "4", ")", ")", "return", "len", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n        arg_3=False, arg_4=False,\n        arg_5=[], arg_6=False,\n        arg_7=None):\n    \"\"\"\n    Add files to the repository by explicitly specifying them or by\n    specifying a pattern over files accessed during execution of an\n    executable.\n\n    Parameters\n    ----------\n\n    repo: Repository\n\n    args: files or command line\n         (a) If simply Funcing files, then the list of files that must\n         be Funced (including any Funcitional arguments to be passed to\n         git\n         (b) If files to be Funced are an output of a command line, then\n         args is the command lined\n    targetdir: Target directory to store the files\n    execute: Args are not files to be Funced but scripts that must be run.\n    includes: patterns used to select files to\n    script: Is this a script?\n    generator: Is this a generator\n    source: Link to the original source of the data\n\n    \"\"\"\n\n    # Gather the files...\n    if not arg_3:\n        arg_8 = Func_files(arg_1=arg_1,\n                          arg_2=arg_2,\n                          arg_7=arg_7,\n                          arg_6=arg_6,\n                          arg_4=arg_4)\n    else:\n        arg_8 = run_executable(arg_0, arg_1, arg_5)\n\n    if arg_8 is None or len(arg_8) == 0:\n        return arg_0\n\n\n    # Update the repo package but with only those that have changed.\n\n    arg_9 = []\n    arg_10 = arg_0.package\n    for arg_11 in arg_8:\n        arg_12 = False\n        for arg_13, arg_14 in  enumerate(arg_10['resources']):\n            if arg_11['relativepath'] == arg_14['relativepath']:\n                arg_12 = True\n                if arg_11['sha256'] == arg_14['sha256']:\n                    arg_15 = False\n                    for arg_16 in ['source']:\n                        if arg_11[arg_16] != arg_14[arg_16]:\n                            arg_14[arg_16] = arg_11[arg_16]\n                            arg_15 = True\n                    if arg_15:\n                        arg_9.append(arg_11)\n                    continue\n                else:\n                    arg_9.append(arg_11)\n                    arg_10['resources'][arg_13] = arg_11\n                break\n        if not arg_12:\n            arg_9.append(arg_11)\n            arg_10['resources'].append(arg_11)\n\n    if len(arg_9) == 0:\n        return 0\n\n    # Copy the files\n    arg_0.manager.Func_files(arg_0, arg_9)\n\n    # Write to disk...\n    arg_17 = arg_0.rootdir\n    with cd(arg_17):\n        arg_18 = \"datapackage.json\"\n        with open(arg_18, 'w') as fd:\n            fd.write(json.dumps(arg_10, indent=4))\n\n    return len(arg_9)", "path": "dgitcore/datasets/files.py", "identifier": "add", "docstring": "Add files to the repository by explicitly specifying them or by\n    specifying a pattern over files accessed during execution of an\n    executable.\n\n    Parameters\n    ----------\n\n    repo: Repository\n\n    args: files or command line\n         (a) If simply adding files, then the list of files that must\n         be added (including any additional arguments to be passed to\n         git\n         (b) If files to be added are an output of a command line, then\n         args is the command lined\n    targetdir: Target directory to store the files\n    execute: Args are not files to be added but scripts that must be run.\n    includes: patterns used to select files to\n    script: Is this a script?\n    generator: Is this a generator\n    source: Link to the original source of the data", "docstring_tokens": ["Add", "files", "to", "the", "repository", "by", "explicitly", "specifying", "them", "or", "by", "specifying", "a", "pattern", "over", "files", "accessed", "during", "execution", "of", "an", "executable", "."], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 255283}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/clients/marathon.py#L99-L118", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Perform a GET request and get the contents of the JSON response.", "language": "python", "parameters": "(self, field, **kwargs)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "request", "(", "'GET'", ",", "headers", "=", "{", "'Accept'", ":", "'application/json'", "}", ",", "**", "arg_2", ")", "arg_3", ".", "addCallback", "(", "raise_for_status", ")", "arg_3", ".", "addCallback", "(", "raise_for_header", ",", "'Content-Type'", ",", "'application/json'", ")", "arg_3", ".", "addCallback", "(", "json_content", ")", "arg_3", ".", "addCallback", "(", "arg_0", ".", "_Func", ",", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Perform a GET request and get the contents of the JSON response.\n\n        Marathon's JSON responses tend to contain an object with a single key\n        which points to the actual data of the response. For example /v2/apps\n        returns something like {\"apps\": [ {\"app1\"}, {\"app2\"} ]}. We're\n        interested in the contents of \"apps\".\n\n        This method will raise an error if:\n        * There is an error response code\n        * The field with the given name cannot be found\n        \"\"\"\n        arg_3 = arg_0.request(\n            'GET', headers={'Accept': 'application/json'}, **arg_2)\n        arg_3.addCallback(raise_for_status)\n        arg_3.addCallback(raise_for_header, 'Content-Type', 'application/json')\n        arg_3.addCallback(json_content)\n        arg_3.addCallback(arg_0._Func, arg_1)\n        return arg_3", "path": "marathon_acme/clients/marathon.py", "identifier": "MarathonClient.get_json_field", "docstring": "Perform a GET request and get the contents of the JSON response.\n\n        Marathon's JSON responses tend to contain an object with a single key\n        which points to the actual data of the response. For example /v2/apps\n        returns something like {\"apps\": [ {\"app1\"}, {\"app2\"} ]}. We're\n        interested in the contents of \"apps\".\n\n        This method will raise an error if:\n        * There is an error response code\n        * The field with the given name cannot be found", "docstring_tokens": ["Perform", "a", "GET", "request", "and", "get", "the", "contents", "of", "the", "JSON", "response", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 255284}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2642-L2659", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Renders the given template to a string.", "language": "python", "parameters": "(template, extra=None)", "return_statement": "return rendered_content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "from", "jinja2", "import", "Template", "arg_1", "=", "arg_1", "or", "{", "}", "arg_2", "=", "find_template", "(", "arg_0", ")", "assert", "arg_2", ",", "'Template not found: %s'", "%", "arg_0", "arg_3", "=", "open", "(", "arg_2", ",", "'r'", ")", ".", "read", "(", ")", "arg_4", "=", "Template", "(", "arg_3", ")", "if", "arg_1", ":", "arg_5", "=", "env", ".", "copy", "(", ")", "arg_5", ".", "update", "(", "arg_1", ")", "else", ":", "arg_5", "=", "env", "arg_6", "=", "arg_4", ".", "render", "(", "**", "arg_5", ")", "arg_6", "=", "arg_6", ".", "replace", "(", "'&quot;'", ",", "'\"'", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Renders the given template to a string.\n    \"\"\"\n    from jinja2 import Template\n    arg_1 = arg_1 or {}\n    arg_2 = find_template(arg_0)\n    assert arg_2, 'Template not found: %s' % arg_0\n    arg_3 = open(arg_2, 'r').read()\n    arg_4 = Template(arg_3)\n    if arg_1:\n        arg_5 = env.copy()\n        arg_5.update(arg_1)\n    else:\n        arg_5 = env\n    arg_6 = arg_4.render(**arg_5)\n    arg_6 = arg_6.replace('&quot;', '\"')\n    return arg_6", "path": "burlap/common.py", "identifier": "render_to_string", "docstring": "Renders the given template to a string.", "docstring_tokens": ["Renders", "the", "given", "template", "to", "a", "string", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 255285}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_base.py#L469-L504", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return True if we should retry. False otherwise.", "language": "python", "parameters": "(exception)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "apiclient", ".", "errors", ".", "HttpError", ")", ":", "if", "arg_0", ".", "resp", ".", "status", "in", "TRANSIENT_HTTP_ERROR_CODES", ":", "_print_error", "(", "'Retrying...'", ")", "return", "True", "if", "isinstance", "(", "arg_0", ",", "socket", ".", "error", ")", ":", "if", "arg_0", ".", "errno", "in", "TRANSIENT_SOCKET_ERROR_CODES", ":", "_print_error", "(", "'Retrying...'", ")", "return", "True", "if", "isinstance", "(", "arg_0", ",", "oauth2client", ".", "client", ".", "AccessTokenRefreshError", ")", ":", "_print_error", "(", "'Retrying...'", ")", "return", "True", "if", "isinstance", "(", "arg_0", ",", "SSLError", ")", ":", "_print_error", "(", "'Retrying...'", ")", "return", "True", "if", "isinstance", "(", "arg_0", ",", "ServerNotFoundError", ")", ":", "_print_error", "(", "'Retrying...'", ")", "return", "True", "return", "False"], "function": "def Func(arg_0):\n  \"\"\"Return True if we should retry. False otherwise.\n\n  Args:\n    exception: An exception to test for transience.\n\n  Returns:\n    True if we should retry. False otherwise.\n  \"\"\"\n  if isinstance(arg_0, apiclient.errors.HttpError):\n    if arg_0.resp.status in TRANSIENT_HTTP_ERROR_CODES:\n      _print_error('Retrying...')\n      return True\n\n  if isinstance(arg_0, socket.error):\n    if arg_0.errno in TRANSIENT_SOCKET_ERROR_CODES:\n      _print_error('Retrying...')\n      return True\n\n  if isinstance(arg_0, oauth2client.client.AccessTokenRefreshError):\n    _print_error('Retrying...')\n    return True\n\n  # For a given installation, this could be a permanent error, but has only\n  # been observed as transient.\n  if isinstance(arg_0, SSLError):\n    _print_error('Retrying...')\n    return True\n\n  # This has been observed as a transient error:\n  #   ServerNotFoundError: Unable to find the server at genomics.googleapis.com\n  if isinstance(arg_0, ServerNotFoundError):\n    _print_error('Retrying...')\n    return True\n\n  return False", "path": "dsub/providers/google_base.py", "identifier": "retry_api_check", "docstring": "Return True if we should retry. False otherwise.\n\n  Args:\n    exception: An exception to test for transience.\n\n  Returns:\n    True if we should retry. False otherwise.", "docstring_tokens": ["Return", "True", "if", "we", "should", "retry", ".", "False", "otherwise", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 255286}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/filters.py#L78-L87", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Generates a filter chain for validating a security level.", "language": "python", "parameters": "()", "return_statement": "return (\n            f.Type(int) |\n            f.Min(1) |\n            f.Max(3) |\n            f.Optional(default=AddressGenerator.DEFAULT_SECURITY_LEVEL)\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "return", "(", "f", ".", "Type", "(", "int", ")", "|", "f", ".", "Min", "(", "1", ")", "|", "f", ".", "Max", "(", "3", ")", "|", "f", ".", "Optional", "(", "default", "=", "AddressGenerator", ".", "DEFAULT_SECURITY_LEVEL", ")", ")"], "function": "def Func():\n    \"\"\"\n    Generates a filter chain for validating a security level.\n    \"\"\"\n    return (\n            f.Type(int) |\n            f.Min(1) |\n            f.Max(3) |\n            f.Optional(default=AddressGenerator.DEFAULT_SECURITY_LEVEL)\n    )", "path": "iota/filters.py", "identifier": "SecurityLevel", "docstring": "Generates a filter chain for validating a security level.", "docstring_tokens": ["Generates", "a", "filter", "chain", "for", "validating", "a", "security", "level", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 255287}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/shapes.py#L136-L159", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Transpose just the values of a BoltArraySpark, returning a\n        new BoltArraySpark.", "language": "python", "parameters": "(self, *axes)", "return_statement": "return BoltArraySpark(newrdd, shape=newshape).__finalize__(self._barray)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "argpack", "(", "arg_1", ")", "arg_3", "=", "range", "(", "arg_0", ".", "ndim", ")", "isFuncable", "(", "arg_2", ",", "arg_3", ")", "if", "arg_2", "==", "arg_3", ":", "return", "arg_0", ".", "_barray", "def", "f", "(", "arg_4", ")", ":", "return", "arg_4", ".", "Func", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_barray", ".", "_rdd", ".", "mapValues", "(", "f", ")", "arg_6", "=", "arg_0", ".", "_barray", ".", "keys", ".", "shape", "+", "tuple", "(", "arg_0", ".", "shape", "[", "i", "]", "for", "i", "in", "arg_2", ")", "return", "BoltArraySpark", "(", "arg_5", ",", "shape", "=", "arg_6", ")", ".", "__finalize__", "(", "arg_0", ".", "_barray", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Transpose just the values of a BoltArraySpark, returning a\n        new BoltArraySpark.\n\n        Parameters\n        ----------\n        axes : tuple\n             New proposed axes.\n        \"\"\"\n        arg_2 = argpack(arg_1)\n        arg_3 = range(arg_0.ndim)\n        isFuncable(arg_2, arg_3)\n\n        if arg_2 == arg_3:\n            return arg_0._barray\n\n        def f(arg_4):\n            return arg_4.Func(arg_2)\n\n        arg_5 = arg_0._barray._rdd.mapValues(f)\n        arg_6 = arg_0._barray.keys.shape + tuple(arg_0.shape[i] for i in arg_2)\n\n        return BoltArraySpark(arg_5, shape=arg_6).__finalize__(arg_0._barray)", "path": "bolt/spark/shapes.py", "identifier": "Values.transpose", "docstring": "Transpose just the values of a BoltArraySpark, returning a\n        new BoltArraySpark.\n\n        Parameters\n        ----------\n        axes : tuple\n             New proposed axes.", "docstring_tokens": ["Transpose", "just", "the", "values", "of", "a", "BoltArraySpark", "returning", "a", "new", "BoltArraySpark", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 255288}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/futures.py#L144-L155", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Add a callback to the parent to update the state.", "language": "python", "parameters": "(self, fut)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "parent", "=", "arg_1", "try", ":", "arg_1", ".", "add_done_callback", "(", "arg_0", ".", "parent_callback", ")", "except", "Exception", "as", "e", ":", "logger", ".", "error", "(", "\"add_done_callback got an exception {} which will be ignored\"", ".", "format", "(", "e", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add a callback to the parent to update the state.\n\n        This handles the case where the user has called result on the AppFuture\n        before the parent exists.\n        \"\"\"\n        arg_0.parent = arg_1\n\n        try:\n            arg_1.add_done_callback(arg_0.parent_callback)\n        except Exception as e:\n            logger.error(\"add_done_callback got an exception {} which will be ignored\".format(e))", "path": "parsl/dataflow/futures.py", "identifier": "AppFuture.update_parent", "docstring": "Add a callback to the parent to update the state.\n\n        This handles the case where the user has called result on the AppFuture\n        before the parent exists.", "docstring_tokens": ["Add", "a", "callback", "to", "the", "parent", "to", "update", "the", "state", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 255289}
{"url": "https://github.com/FaradayRF/faradayio/blob/6cf3af88bb4a83e5d2036e5cbdfaf8f0f01500bb/faradayio/faraday.py#L219-L240", "sha": "6cf3af88bb4a83e5d2036e5cbdfaf8f0f01500bb", "docstring_summary": "Wrapper function for TUN and serial port monitoring", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "arg_0", ".", "isRunning", ".", "is_set", "(", ")", ":", "try", ":", "try", ":", "arg_0", ".", "monitorTUN", "(", ")", "except", "timeout_decorator", ".", "TimeoutError", "as", "error", ":", "pass", "arg_0", ".", "checkSerial", "(", ")", "except", "KeyboardInterrupt", ":", "break"], "function": "def Func(arg_0):\n        \"\"\"\n        Wrapper function for TUN and serial port monitoring\n\n        Wraps the necessary functions to loop over until self._isRunning\n        threading.Event() is set(). This checks for data on the TUN/serial\n        interfaces and then sends data over the appropriate interface. This\n        function is automatically Func when Threading.start() is called on the\n        Monitor class.\n        \"\"\"\n        while arg_0.isRunning.is_set():\n            try:\n                try:\n                    # self.checkTUN()\n                    arg_0.monitorTUN()\n\n                except timeout_decorator.TimeoutError as error:\n                    # No data received so just move on\n                    pass\n                arg_0.checkSerial()\n            except KeyboardInterrupt:\n                break", "path": "faradayio/faraday.py", "identifier": "Monitor.run", "docstring": "Wrapper function for TUN and serial port monitoring\n\n        Wraps the necessary functions to loop over until self._isRunning\n        threading.Event() is set(). This checks for data on the TUN/serial\n        interfaces and then sends data over the appropriate interface. This\n        function is automatically run when Threading.start() is called on the\n        Monitor class.", "docstring_tokens": ["Wrapper", "function", "for", "TUN", "and", "serial", "port", "monitoring"], "nwo": "FaradayRF/faradayio", "score": 0.289831668365279, "idx": 255290}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/transportphenomena/dimensionlessquantities.py#L80-L102", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the Ralleigh number.", "language": "python", "parameters": "(L: float, Ts: float, Tf: float, alpha: float, beta: float, nu: float\n       )", "return_statement": "return g * beta * (Ts - Tinf) * L**3.0 / (nu * alpha)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ",", "arg_3", ":", "arg_1", ",", "arg_4", ":", "arg_1", ",", "arg_5", ":", "arg_1", ",", "arg_6", ":", "arg_1", ")", "->", "arg_1", ":", "return", "g", "*", "arg_5", "*", "(", "arg_2", "-", "Tinf", ")", "*", "arg_0", "**", "3.0", "/", "(", "arg_6", "*", "arg_4", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1, arg_4: arg_1, arg_5: arg_1, arg_6: arg_1\n       ) -> arg_1:\n    \"\"\"\n    Calculate the Funclleigh number.\n\n    :param L: [m] heat transfer surface characteristic length.\n    :param Ts: [K] heat transfer surface temperature.\n    :param Tf: [K] bulk fluid temperature.\n    :param alpha: [m2/s] fluid thermal diffusivity.\n    :param beta: [1/K] fluid coefficient of thermal expansion.\n    :param nu: [m2/s] fluid kinematic viscosity.\n\n    :returns: float\n\n    Func = Gr*Pr\n\n    Characteristic dimensions:\n        * vertical plate: vertical length\n        * pipe: diameter\n        * bluff body: diameter\n    \"\"\"\n\n    return g * arg_5 * (arg_2 - Tinf) * arg_0**3.0 / (arg_6 * arg_4)", "path": "auxi/tools/transportphenomena/dimensionlessquantities.py", "identifier": "Ra", "docstring": "Calculate the Ralleigh number.\n\n    :param L: [m] heat transfer surface characteristic length.\n    :param Ts: [K] heat transfer surface temperature.\n    :param Tf: [K] bulk fluid temperature.\n    :param alpha: [m2/s] fluid thermal diffusivity.\n    :param beta: [1/K] fluid coefficient of thermal expansion.\n    :param nu: [m2/s] fluid kinematic viscosity.\n\n    :returns: float\n\n    Ra = Gr*Pr\n\n    Characteristic dimensions:\n        * vertical plate: vertical length\n        * pipe: diameter\n        * bluff body: diameter", "docstring_tokens": ["Calculate", "the", "Ralleigh", "number", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 255291}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1671-L1677", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Handler for cat command", "language": "python", "parameters": "(self, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "validate", "(", "'cmd|s3'", ",", "arg_1", ")", "arg_2", "=", "arg_1", "[", "1", "]", "arg_0", ".", "s3handler", "(", ")", ".", "print_files", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    '''Handler for cat command'''\n\n    arg_0.validate('cmd|s3', arg_1)\n    arg_2 = arg_1[1]\n\n    arg_0.s3handler().print_files(arg_2)", "path": "s4cmd.py", "identifier": "CommandHandler.cat_handler", "docstring": "Handler for cat command", "docstring_tokens": ["Handler", "for", "cat", "command"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 255292}
{"url": "https://github.com/FocusLab/Albertson/blob/a42f9873559df9188c40c34fdffb079d78eaa3fe/albertson/base.py#L183-L191", "sha": "a42f9873559df9188c40c34fdffb079d78eaa3fe", "docstring_summary": "Gets the DynamoDB item behind a counter and ties it to a Counter\n        instace.", "language": "python", "parameters": "(self, name, start=0)", "return_statement": "return counter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "arg_3", "=", "arg_0", ".", "get_item", "(", "hash_key", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "Counter", "(", "dynamo_item", "=", "arg_3", ",", "pool", "=", "arg_0", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        '''\n        Gets the DynamoDB item behind a counter and ties it to a Counter\n        instace.\n        '''\n        arg_3 = arg_0.get_item(hash_key=arg_1, arg_2=arg_2)\n        arg_4 = Counter(dynamo_item=arg_3, pool=arg_0)\n\n        return arg_4", "path": "albertson/base.py", "identifier": "CounterPool.get_counter", "docstring": "Gets the DynamoDB item behind a counter and ties it to a Counter\n        instace.", "docstring_tokens": ["Gets", "the", "DynamoDB", "item", "behind", "a", "counter", "and", "ties", "it", "to", "a", "Counter", "instace", "."], "nwo": "FocusLab/Albertson", "score": 0.0, "idx": 255293}
{"url": "https://github.com/valentinalexeev/pwaqi/blob/81a1fa1ad87be7ba015c1cb07c52c7760ca99d8c/pwaqi/__init__.py#L16-L28", "sha": "81a1fa1ad87be7ba015c1cb07c52c7760ca99d8c", "docstring_summary": "Lookup AQI database for station codes in a given city.", "language": "python", "parameters": "(city_name, token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "requests", ".", "get", "(", "API_ENDPOINT_SEARCH", ",", "params", "=", "{", "'token'", ":", "arg_1", ",", "'keyword'", ":", "arg_0", "}", ")", "if", "arg_2", ".", "status_code", "==", "200", "and", "arg_2", ".", "json", "(", ")", "[", "\"status\"", "]", "==", "\"ok\"", ":", "return", "[", "arg_3", "[", "\"uid\"", "]", "for", "arg_3", "in", "arg_2", ".", "json", "(", ")", "[", "\"data\"", "]", "]", "else", ":", "return", "[", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Lookup AQI database for station codes in a given city.\"\"\"\n    arg_2 = requests.get(\n        API_ENDPOINT_SEARCH,\n        params={\n            'token': arg_1,\n            'keyword': arg_0\n        })\n\n    if arg_2.status_code == 200 and arg_2.json()[\"status\"] == \"ok\":\n        return [arg_3[\"uid\"] for arg_3 in arg_2.json()[\"data\"]]\n    else:\n        return []", "path": "pwaqi/__init__.py", "identifier": "findStationCodesByCity", "docstring": "Lookup AQI database for station codes in a given city.", "docstring_tokens": ["Lookup", "AQI", "database", "for", "station", "codes", "in", "a", "given", "city", "."], "nwo": "valentinalexeev/pwaqi", "score": 0.18657722465184873, "idx": 255294}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/tensor/functions.py#L38-L49", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "A utility function of concatenate.", "language": "python", "parameters": "(vars, axis=-1)", "return_statement": "return concat_var", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "-", "1", ")", ":", "from", "deepy", ".", "core", ".", "neural_var", "import", "NeuralVariable", "if", "isinstance", "(", "arg_0", "[", "0", "]", ",", "NeuralVariable", ")", ":", "arg_2", "=", "Concatenate", "(", "arg_1", "=", "arg_1", ")", ".", "compute", "(", "*", "arg_0", ")", "if", "arg_1", "==", "-", "1", "or", "arg_1", "==", "arg_0", "[", "0", "]", ".", "tensor", ".", "ndim", "-", "1", ":", "arg_2", ".", "output_dim", "=", "sum", "(", "[", "x", ".", "output_dim", "for", "x", "in", "arg_0", "]", ",", "0", ")", "else", ":", "arg_2", "=", "TT", ".", "Func", "(", "arg_0", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=-1):\n    \"\"\"\n    A utility function of Func.\n    \"\"\"\n    from deepy.core.neural_var import NeuralVariable\n    if isinstance(arg_0[0], NeuralVariable):\n        arg_2 = Concatenate(arg_1=arg_1).compute(*arg_0)\n        if arg_1 == -1 or arg_1 == arg_0[0].tensor.ndim - 1:\n            arg_2.output_dim = sum([x.output_dim for x in arg_0], 0)\n    else:\n        arg_2 = TT.Func(arg_0, arg_1)\n    return arg_2", "path": "deepy/tensor/functions.py", "identifier": "concatenate", "docstring": "A utility function of concatenate.", "docstring_tokens": ["A", "utility", "function", "of", "concatenate", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 255295}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L257-L273", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Gets a Model. Blocks until finished.", "language": "python", "parameters": "(self, project_id, model_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_2", ":", "raise", "ValueError", "(", "\"Model name must be provided and \"", "\"it could not be an empty string\"", ")", "arg_3", "=", "'projects/{}/models/{}'", ".", "format", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "models", "(", ")", ".", "get", "(", "name", "=", "arg_3", ")", "try", ":", "return", "arg_4", ".", "execute", "(", ")", "except", "HttpError", "as", "e", ":", "if", "e", ".", "resp", ".", "status", "==", "404", ":", "arg_0", ".", "log", ".", "error", "(", "'Model was not found: %s'", ",", "e", ")", "return", "None", "raise"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Gets a Model. Blocks until finished.\n        \"\"\"\n        if not arg_2:\n            raise ValueError(\"Model name must be provided and \"\n                             \"it could not be an empty string\")\n        arg_3 = 'projects/{}/models/{}'.format(\n            arg_1, arg_2)\n        arg_4 = arg_0._mlengine.projects().models().get(name=arg_3)\n        try:\n            return arg_4.execute()\n        except HttpError as e:\n            if e.resp.status == 404:\n                arg_0.log.error('Model was not found: %s', e)\n                return None\n            raise", "path": "airflow/contrib/hooks/gcp_mlengine_hook.py", "identifier": "MLEngineHook.get_model", "docstring": "Gets a Model. Blocks until finished.", "docstring_tokens": ["Gets", "a", "Model", ".", "Blocks", "until", "finished", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255296}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/legecy_translators/constants.py#L238-L254", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "this function parses the string just like javascript\n       for example literal '\\d' in JavaScript would be interpreted\n       as 'd' - backslash would be ignored and in Pyhon this\n       would be interpreted as '\\\\d' This function fixes this problem.", "language": "python", "parameters": "(js_string)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "''", "arg_3", "=", "len", "(", "arg_0", ")", "while", "arg_1", "<", "arg_3", ":", "arg_4", "=", "arg_0", "[", "arg_1", "]", "if", "arg_4", "==", "'\\\\'", ":", "arg_5", ",", "arg_1", "=", "do_escape", "(", "arg_0", ",", "arg_1", ")", "arg_2", "+=", "arg_5", "else", ":", "arg_2", "+=", "arg_4", "arg_1", "+=", "1", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"this function parses the string just like javascript\n       for example literal '\\d' in JavaScript would be interpreted\n       as 'd' - backslash would be ignored and in Pyhon this\n       would be interpreted as '\\\\d' This function fixes this problem.\"\"\"\n    arg_1 = 0\n    arg_2 = ''\n    arg_3 = len(arg_0)\n    while arg_1 < arg_3:\n        arg_4 = arg_0[arg_1]\n        if arg_4 == '\\\\':\n            arg_5, arg_1 = do_escape(arg_0, arg_1)\n            arg_2 += arg_5\n        else:\n            arg_2 += arg_4\n            arg_1 += 1\n    return arg_2", "path": "js2py/legecy_translators/constants.py", "identifier": "unify_string_literals", "docstring": "this function parses the string just like javascript\n       for example literal '\\d' in JavaScript would be interpreted\n       as 'd' - backslash would be ignored and in Pyhon this\n       would be interpreted as '\\\\d' This function fixes this problem.", "docstring_tokens": ["this", "function", "parses", "the", "string", "just", "like", "javascript", "for", "example", "literal", "\\", "d", "in", "JavaScript", "would", "be", "interpreted", "as", "d", "-", "backslash", "would", "be", "ignored", "and", "in", "Pyhon", "this", "would", "be", "interpreted", "as", "\\\\", "d", "This", "function", "fixes", "this", "problem", "."], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 255297}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L164-L174", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "Shows an open file dialog and open the file if the dialog was\n        accepted.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "QtWidgets", ".", "QFileDialog", ".", "getOpenFileName", "(", "arg_0", ",", "'Open'", ")", "if", "arg_1", ":", "arg_0", ".", "open_file", "(", "arg_1", ")", "arg_0", ".", "actionRun", ".", "setEnabled", "(", "True", ")", "arg_0", ".", "actionConfigure_run", ".", "setEnabled", "(", "True", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Shows an open file dialog and open the file if the dialog was\n        accepted.\n\n        \"\"\"\n        arg_1, arg_2 = QtWidgets.QFileDialog.getOpenFileName(arg_0, 'Open')\n        if arg_1:\n            arg_0.open_file(arg_1)\n        arg_0.actionRun.setEnabled(True)\n        arg_0.actionConfigure_run.setEnabled(True)", "path": "examples/pynotepad/pynotepad/main_window.py", "identifier": "MainWindow.on_open", "docstring": "Shows an open file dialog and open the file if the dialog was\n        accepted.", "docstring_tokens": ["Shows", "an", "open", "file", "dialog", "and", "open", "the", "file", "if", "the", "dialog", "was", "accepted", "."], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 255298}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/numpy_conversions.py#L37-L121", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Convert an arbitrary array to numpy.ndarray.", "language": "python", "parameters": "(arr, copy=False, dtype=None, order='K')", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'K'", ")", ":", "if", "arg_3", "not", "in", "(", "'C'", ",", "'F'", ",", "'A'", ",", "'K'", ",", "None", ")", ":", "raise", "ValueError", "(", "\"Invalid value for 'order': {}\"", ".", "format", "(", "str", "(", "arg_3", ")", ")", ")", "if", "isinstance", "(", "arg_0", ",", "np", ".", "memmap", ")", ":", "if", "arg_2", "is", "None", ":", "if", "arg_3", "in", "(", "'K'", ",", "'A'", ",", "None", ")", ":", "arg_4", "=", "np", ".", "array", "(", "np", ".", "asarray", "(", "arg_0", ")", ",", "arg_1", "=", "True", ")", "else", ":", "arg_4", "=", "np", ".", "array", "(", "np", ".", "asarray", "(", "arg_0", ")", ",", "arg_1", "=", "True", ",", "arg_3", "=", "arg_3", ")", "else", ":", "if", "arg_3", "in", "(", "'K'", ",", "'A'", ",", "None", ")", ":", "arg_4", "=", "np", ".", "asarray", "(", "arg_0", ")", ".", "astype", "(", "arg_2", ")", "else", ":", "arg_4", "=", "_asarray", "(", "np", ".", "array", "(", "arg_0", ",", "arg_1", "=", "True", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "elif", "isinstance", "(", "arg_0", ",", "np", ".", "ndarray", ")", ":", "arg_4", "=", "_asarray", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "np", ".", "may_share_memory", "(", "arg_4", ",", "arg_0", ")", "and", "arg_1", ":", "arg_4", "=", "arg_4", ".", "T", ".", "copy", "(", ")", ".", "T", "if", "arg_4", ".", "flags", "[", "'F_CONTIGUOUS'", "]", "else", "arg_4", ".", "copy", "(", ")", "elif", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "arg_3", "in", "(", "\"A\"", ",", "\"K\"", ")", ":", "arg_4", "=", "np", ".", "asarray", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "else", ":", "arg_4", "=", "np", ".", "asarray", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "else", ":", "raise", "ValueError", "(", "\"Type not handled: {}\"", ".", "format", "(", "arg_0", ".", "__class__", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=False, arg_2=None, arg_3='K'):\n    \"\"\"Convert an arbitrary array to numpy.ndarray.\n\n    In the case of a memmap array, a copy is automatically made to break the\n    link with the underlying file (whatever the value of the \"copy\" keyword).\n\n    The purpose of this function is mainly to get rid of memmap objects, but\n    it can be used for other purposes. In particular, combining copying and\n    casting can lead to performance improvements in some cases, by avoiding\n    unnecessary copies.\n\n    If not specified, input array order is preserved, in all cases, even when\n    a copy is requested.\n\n    Caveat: this function does not copy during bool to/from 1-byte dtype\n    conversions. This can lead to some surprising results in some rare cases.\n    Example:\n\n        a = numpy.asarray([0, 1, 2], dtype=numpy.int8)\n        b = Func(a, dtype=bool)  # array([False, True, True], dtype=bool)\n        c = Func(b, dtype=numpy.int8)  # array([0, 1, 2], dtype=numpy.int8)\n\n    The usually expected result for the last line would be array([0, 1, 1])\n    because True evaluates to 1. Since there is no copy made here, the original\n    array is recovered.\n\n    Parameters\n    ----------\n    arr: array-like\n        input array. Any value accepted by numpy.asarray is valid.\n\n    copy: bool\n        if True, force a copy of the array. Always True when arr is a memmap.\n\n    dtype: any numpy dtype\n        dtype of the returned array. Performing copy and type conversion at the\n        same time can in some cases avoid an additional copy.\n\n    order: string\n        gives the order of the returned array.\n        Valid values are: \"C\", \"F\", \"A\", \"K\", None.\n        default is \"K\". See ndarray.copy() for more information.\n\n    Returns\n    -------\n    ret: np.ndarray\n        Numpy array containing the same data as arr, always of class\n        numpy.ndarray, and with no link to any underlying file.\n    \"\"\"\n    if arg_3 not in ('C', 'F', 'A', 'K', None):\n        raise ValueError(\"Invalid value for 'order': {}\".format(str(arg_3)))\n\n    if isinstance(arg_0, np.memmap):\n        if arg_2 is None:\n            if arg_3 in ('K', 'A', None):\n                arg_4 = np.array(np.asarray(arg_0), arg_1=True)\n            else:\n                arg_4 = np.array(np.asarray(arg_0), arg_1=True, arg_3=arg_3)\n        else:\n            if arg_3 in ('K', 'A', None):\n                # always copy (even when dtype does not change)\n                arg_4 = np.asarray(arg_0).astype(arg_2)\n            else:\n                # load data from disk without changing order\n                # Changing order while reading through a memmap is incredibly\n                # inefficient.\n                arg_4 = _asarray(np.array(arg_0, arg_1=True), arg_2=arg_2, arg_3=arg_3)\n\n    elif isinstance(arg_0, np.ndarray):\n        arg_4 = _asarray(arg_0, arg_2=arg_2, arg_3=arg_3)\n        # In the present cas, np.may_share_memory result is always reliable.\n        if np.may_share_memory(arg_4, arg_0) and arg_1:\n            # order-preserving copy\n            arg_4 = arg_4.T.copy().T if arg_4.flags['F_CONTIGUOUS'] else arg_4.copy()\n\n    elif isinstance(arg_0, (list, tuple)):\n        if arg_3 in (\"A\", \"K\"):\n            arg_4 = np.asarray(arg_0, arg_2=arg_2)\n        else:\n            arg_4 = np.asarray(arg_0, arg_2=arg_2, arg_3=arg_3)\n\n    else:\n        raise ValueError(\"Type not handled: {}\".format(arg_0.__class__))\n\n    return arg_4", "path": "boyle/utils/numpy_conversions.py", "identifier": "as_ndarray", "docstring": "Convert an arbitrary array to numpy.ndarray.\n\n    In the case of a memmap array, a copy is automatically made to break the\n    link with the underlying file (whatever the value of the \"copy\" keyword).\n\n    The purpose of this function is mainly to get rid of memmap objects, but\n    it can be used for other purposes. In particular, combining copying and\n    casting can lead to performance improvements in some cases, by avoiding\n    unnecessary copies.\n\n    If not specified, input array order is preserved, in all cases, even when\n    a copy is requested.\n\n    Caveat: this function does not copy during bool to/from 1-byte dtype\n    conversions. This can lead to some surprising results in some rare cases.\n    Example:\n\n        a = numpy.asarray([0, 1, 2], dtype=numpy.int8)\n        b = as_ndarray(a, dtype=bool)  # array([False, True, True], dtype=bool)\n        c = as_ndarray(b, dtype=numpy.int8)  # array([0, 1, 2], dtype=numpy.int8)\n\n    The usually expected result for the last line would be array([0, 1, 1])\n    because True evaluates to 1. Since there is no copy made here, the original\n    array is recovered.\n\n    Parameters\n    ----------\n    arr: array-like\n        input array. Any value accepted by numpy.asarray is valid.\n\n    copy: bool\n        if True, force a copy of the array. Always True when arr is a memmap.\n\n    dtype: any numpy dtype\n        dtype of the returned array. Performing copy and type conversion at the\n        same time can in some cases avoid an additional copy.\n\n    order: string\n        gives the order of the returned array.\n        Valid values are: \"C\", \"F\", \"A\", \"K\", None.\n        default is \"K\". See ndarray.copy() for more information.\n\n    Returns\n    -------\n    ret: np.ndarray\n        Numpy array containing the same data as arr, always of class\n        numpy.ndarray, and with no link to any underlying file.", "docstring_tokens": ["Convert", "an", "arbitrary", "array", "to", "numpy", ".", "ndarray", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255299}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/meta.py#L24-L100", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Decorator to verify arguments and return types.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "inspect", ".", "signature", "(", "arg_0", ")", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_1", ".", "parameters", ".", "values", "(", ")", ":", "arg_4", "=", "arg_3", ".", "annotation", "if", "arg_4", "is", "arg_3", ".", "empty", "or", "not", "inspect", ".", "isclass", "(", "arg_4", ")", ":", "continue", "arg_2", "[", "arg_3", ".", "name", "]", "=", "arg_4", "if", "(", "arg_3", ".", "default", "is", "not", "arg_3", ".", "empty", "and", "not", "isinstance", "(", "arg_3", ".", "default", ",", "arg_4", ")", ")", ":", "raise", "ValueError", "(", "\"{func}: wrong type of a default value for {arg!r}\"", ".", "format", "(", "arg_0", "=", "arg_0", ".", "__qualname__", ",", "arg_12", "=", "arg_3", ".", "name", ")", ")", "def", "check_type", "(", "arg_1", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", ":", "if", "not", "isinstance", "(", "arg_8", ",", "arg_7", ")", ":", "raise", "ValueError", "(", "\"{func}: wrong type of {arg!r} argument, \"", "\"{exp!r} expected, got {got!r}\"", ".", "format", "(", "arg_0", "=", "arg_0", ".", "__qualname__", ",", "arg_12", "=", "arg_6", ",", "exp", "=", "arg_7", ".", "__name__", ",", "got", "=", "type", "(", "arg_8", ")", ".", "__name__", ")", ")", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_9", ",", "**", "arg_10", ")", ":", "arg_11", "=", "arg_1", ".", "bind", "(", "*", "arg_9", ",", "**", "arg_10", ")", "for", "arg_6", ",", "arg_12", "in", "arg_11", ".", "arguments", ".", "items", "(", ")", ":", "try", ":", "arg_13", "=", "arg_2", "[", "arg_6", "]", "except", "KeyError", ":", "continue", "else", ":", "arg_3", "=", "arg_1", ".", "parameters", "[", "arg_6", "]", "if", "arg_3", ".", "kind", "==", "arg_3", ".", "VAR_POSITIONAL", ":", "for", "arg_14", "in", "arg_12", ":", "check_type", "(", "arg_1", ",", "arg_6", ",", "arg_13", ",", "arg_14", ")", "elif", "arg_3", ".", "kind", "==", "arg_3", ".", "VAR_KEYWORD", ":", "for", "arg_15", ",", "arg_14", "in", "arg_12", ".", "items", "(", ")", ":", "check_type", "(", "arg_1", ",", "arg_6", "+", "':'", "+", "arg_15", ",", "arg_13", ",", "arg_14", ")", "else", ":", "check_type", "(", "arg_1", ",", "arg_6", ",", "arg_13", ",", "arg_12", ")", "arg_16", "=", "arg_0", "(", "*", "arg_11", ".", "args", ",", "**", "arg_11", ".", "kwargs", ")", "arg_17", "=", "arg_1", ".", "return_annotation", "if", "(", "arg_17", "is", "not", "arg_1", ".", "empty", "and", "isinstance", "(", "arg_17", ",", "type", ")", "and", "not", "isinstance", "(", "arg_16", ",", "arg_17", ")", ")", ":", "raise", "ValueError", "(", "'{func}: wrong return type, {exp} expected, got {got}'", ".", "format", "(", "arg_0", "=", "arg_0", ".", "__qualname__", ",", "exp", "=", "arg_17", ".", "__name__", ",", "got", "=", "type", "(", "arg_16", ")", ".", "__name__", ")", ")", "return", "arg_16", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Decorator to verify arguments and return types.\"\"\"\n    arg_1 = inspect.signature(arg_0)\n\n    arg_2 = {}\n    for arg_3 in arg_1.parameters.values():\n        # Iterate through function's parameters and build the list of\n        # arguments types\n        arg_4 = arg_3.annotation\n        if arg_4 is arg_3.empty or not inspect.isclass(arg_4):\n            # Missing annotation or not a type, skip it\n            continue\n\n        arg_2[arg_3.name] = arg_4\n\n        # If the argument has a type specified, let's check that its\n        # default value (if present) conforms with the type.\n        if (arg_3.default is not arg_3.empty and\n                not isinstance(arg_3.default, arg_4)):\n            raise ValueError(\n                \"{func}: wrong type of a default value for {arg!r}\".format(\n                    arg_0=arg_0.__qualname__, arg_12=arg_3.name)\n            )\n\n    def check_type(arg_1, arg_6, arg_7, arg_8):\n        # Internal function that encapsulates arguments type checking\n        if not isinstance(arg_8, arg_7):\n            raise ValueError(\"{func}: wrong type of {arg!r} argument, \"\n                             \"{exp!r} expected, got {got!r}\".\n                             format(arg_0=arg_0.__qualname__, arg_12=arg_6,\n                                    exp=arg_7.__name__,\n                                    got=type(arg_8).__name__))\n\n    @functools.wraps(arg_0)\n    def wrapper(*arg_9, **arg_10):\n        # Let's bind the arguments\n        arg_11 = arg_1.bind(*arg_9, **arg_10)\n        for arg_6, arg_12 in arg_11.arguments.items():\n            # And iterate through the bound arguments\n            try:\n                arg_13 = arg_2[arg_6]\n            except KeyError:\n                continue\n            else:\n                # OK, we have a type for the argument, lets get the\n                # corresponding parameter description from the signature object\n                arg_3 = arg_1.parameters[arg_6]\n                if arg_3.kind == arg_3.VAR_POSITIONAL:\n                    # If this parameter is a variable-argument parameter,\n                    # then we need to check each of its values\n                    for arg_14 in arg_12:\n                        check_type(arg_1, arg_6, arg_13, arg_14)\n                elif arg_3.kind == arg_3.VAR_KEYWORD:\n                    # If this parameter is a variable-keyword-argument\n                    # parameter:\n                    for arg_15, arg_14 in arg_12.items():\n                        check_type(arg_1, arg_6 + ':' + arg_15, arg_13, arg_14)\n                else:\n                    # And, finally, if this parameter a regular one:\n                    check_type(arg_1, arg_6, arg_13, arg_12)\n\n        arg_16 = arg_0(*arg_11.args, **arg_11.kwargs)\n\n        # The last bit - let's check that the result is correct\n        arg_17 = arg_1.return_annotation\n        if (arg_17 is not arg_1.empty and\n                isinstance(arg_17, type) and\n                not isinstance(arg_16, arg_17)):\n\n            raise ValueError(\n                '{func}: wrong return type, {exp} expected, got {got}'.format(\n                    arg_0=arg_0.__qualname__, exp=arg_17.__name__,\n                    got=type(arg_16).__name__)\n            )\n        return arg_16\n\n    return wrapper", "path": "pyrser/meta.py", "identifier": "checktypes", "docstring": "Decorator to verify arguments and return types.", "docstring_tokens": ["Decorator", "to", "verify", "arguments", "and", "return", "types", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 255300}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L318-L334", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Uploads a file on the server to the desired location", "language": "python", "parameters": "(self, filename, location='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ")", ":", "arg_3", "=", "arg_0", ".", "_ftp", ".", "pwd", "(", ")", "arg_0", ".", "mkdir", "(", "arg_2", ")", "arg_0", ".", "cd", "(", "arg_2", ")", "arg_4", "=", "open", "(", "arg_1", ",", "'rb'", ")", "arg_1", "=", "arg_1", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "arg_0", ".", "_ftp", ".", "storbinary", "(", "'STOR %s'", "%", "arg_1", ",", "arg_4", ")", "arg_4", ".", "close", "(", ")", "arg_0", ".", "cd", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=''):\n        \"\"\" Uploads a file on the server to the desired location\n\n        :param filename: the name of the file to be Funced.\n        :type filename: string\n        :param location: the directory in which the file will\n                         be stored.\n        :type location: string\n        \"\"\"\n        arg_3 = arg_0._ftp.pwd()\n        arg_0.mkdir(arg_2)\n        arg_0.cd(arg_2)\n        arg_4 = open(arg_1, 'rb')\n        arg_1 = arg_1.split('/')[-1]\n        arg_0._ftp.storbinary('STOR %s' % arg_1, arg_4)\n        arg_4.close()\n        arg_0.cd(arg_3)", "path": "harvestingkit/ftp_utils.py", "identifier": "FtpHandler.upload", "docstring": "Uploads a file on the server to the desired location\n\n        :param filename: the name of the file to be uploaded.\n        :type filename: string\n        :param location: the directory in which the file will\n                         be stored.\n        :type location: string", "docstring_tokens": ["Uploads", "a", "file", "on", "the", "server", "to", "the", "desired", "location"], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 255301}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L56-L67", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "set cpu numbers to be used", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "cpu_count", "(", ")", "-", "1", "if", "arg_0", ".", "_processes", ">", "arg_1", ":", "arg_2", "=", "arg_1", "elif", "arg_0", ".", "_processes", "<", "1", ":", "arg_2", "=", "1", "else", ":", "arg_2", "=", "arg_0", ".", "_processes", "arg_0", ".", "_processes", "=", "int", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"set cpu numbers to be used\"\"\"\n\n        arg_1 = cpu_count()-1\n        if arg_0._processes > arg_1:\n            arg_2 = arg_1\n        elif arg_0._processes < 1:\n            arg_2 = 1\n        else:\n            arg_2 = arg_0._processes\n        # have to be int if user input is float\n        arg_0._processes = int(arg_2)", "path": "gseapy/gsea.py", "identifier": "GSEAbase._set_cores", "docstring": "set cpu numbers to be used", "docstring_tokens": ["set", "cpu", "numbers", "to", "be", "used"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 255302}
{"url": "https://github.com/praekeltfoundation/seed-control-interface/blob/32ddad88b5bc2f8f4d80b848361899da2e081636/ci/utils.py#L32-L38", "sha": "32ddad88b5bc2f8f4d80b848361899da2e081636", "docstring_summary": "Gets the most recent non-zero value for a .last metric or zero\n    for empty data.", "language": "python", "parameters": "(timeseries)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "0", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", ":", "return", "next", "(", "(", "arg_3", "[", "'y'", "]", "for", "arg_3", "in", "reversed", "(", "arg_2", ")", "if", "arg_3", "[", "'y'", "]", ">", "0", ")", ",", "0", ")"], "function": "def Func(arg_0):\n    \"\"\"Gets the most recent non-zero value for a .last metric or zero\n    for empty data.\"\"\"\n    if not arg_0:\n        return 0\n    for arg_1, arg_2 in arg_0.items():\n        return next((arg_3['y'] for arg_3 in reversed(arg_2) if arg_3['y'] > 0), 0)", "path": "ci/utils.py", "identifier": "get_last_value_from_timeseries", "docstring": "Gets the most recent non-zero value for a .last metric or zero\n    for empty data.", "docstring_tokens": ["Gets", "the", "most", "recent", "non", "-", "zero", "value", "for", "a", ".", "last", "metric", "or", "zero", "for", "empty", "data", "."], "nwo": "praekeltfoundation/seed-control-interface", "score": 0.09252797783733271, "idx": 255303}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmparser.py#L1026-L1038", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Compute the column.", "language": "python", "parameters": "(self, input_, token)", "return_statement": "return column", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "is", "None", ":", "return", "0", "arg_3", "=", "arg_1", ".", "rfind", "(", "'\\n'", ",", "0", ",", "arg_2", ".", "lexpos", ")", "if", "arg_3", "<", "0", ":", "arg_3", "=", "0", "arg_4", "=", "(", "arg_2", ".", "lexpos", "-", "arg_3", ")", "+", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Compute the column.\n\n        Input is the input text string.\n        token is a token instance.\n        \"\"\"\n        if arg_2 is None:\n            return 0\n        arg_3 = arg_1.rfind('\\n', 0, arg_2.lexpos)\n        if arg_3 < 0:\n            arg_3 = 0\n        arg_4 = (arg_2.lexpos - arg_3) + 1\n        return arg_4", "path": "qiskit/qasm/qasmparser.py", "identifier": "QasmParser.find_column", "docstring": "Compute the column.\n\n        Input is the input text string.\n        token is a token instance.", "docstring_tokens": ["Compute", "the", "column", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255304}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/qrt.py#L289-L294", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Set event in QTM.", "language": "python", "parameters": "(self, event=None)", "return_statement": "return await asyncio.wait_for(\n            self._protocol.send_command(cmd), timeout=self._timeout\n        )", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "\"event%s\"", "%", "(", "\"\"", "if", "arg_1", "is", "None", "else", "\" \"", "+", "arg_1", ")", "return", "await", "asyncio", ".", "wait_for", "(", "arg_0", ".", "_protocol", ".", "send_command", "(", "arg_2", ")", ",", "timeout", "=", "arg_0", ".", "_timeout", ")"], "function": "async def Func(arg_0, arg_1=None):\n        \"\"\"Set event in QTM.\"\"\"\n        arg_2 = \"event%s\" % (\"\" if arg_1 is None else \" \" + arg_1)\n        return await asyncio.wait_for(\n            arg_0._protocol.send_command(arg_2), timeout=arg_0._timeout\n        )", "path": "qtm/qrt.py", "identifier": "QRTConnection.set_qtm_event", "docstring": "Set event in QTM.", "docstring_tokens": ["Set", "event", "in", "QTM", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 255305}
{"url": "https://github.com/py3270/py3270/blob/c3e91b519f3a18b4be4799a00a96341957a8831f/py3270/__init__.py#L337-L350", "sha": "c3e91b519f3a18b4be4799a00a96341957a8831f", "docstring_summary": "Return bool indicating connection state", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "exec_command", "(", "b\"Query(ConnectionState)\"", ")", "return", "arg_0", ".", "status", ".", "connection_state", ".", "startswith", "(", "b\"C(\"", ")", "except", "NotConnectedException", ":", "return", "False"], "function": "def Func(arg_0):\n        \"\"\"\n            Return bool indicating connection state\n        \"\"\"\n        # need to wrap in try/except b/c of wc3270's socket connection dynamics\n        try:\n            # this is basically a no-op, but it results in the the current status\n            # getting updated\n            arg_0.exec_command(b\"Query(ConnectionState)\")\n\n            # connected status is like 'C(192.168.1.1)', disconnected is 'N'\n            return arg_0.status.connection_state.startswith(b\"C(\")\n        except NotConnectedException:\n            return False", "path": "py3270/__init__.py", "identifier": "Emulator.is_connected", "docstring": "Return bool indicating connection state", "docstring_tokens": ["Return", "bool", "indicating", "connection", "state"], "nwo": "py3270/py3270", "score": 0.5197916506919441, "idx": 255306}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/fmc2d/segmenter.py#L17-L46", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Returns a set of segments defined by the bound_idxs.", "language": "python", "parameters": "(F, bound_idxs)", "return_statement": "return feat_segments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "len", "(", "arg_1", ")", ">", "0", ",", "\"Boundaries can't be empty\"", "arg_1", "=", "np", ".", "sort", "(", "arg_1", ")", "assert", "arg_1", "[", "0", "]", ">=", "0", "and", "arg_1", "[", "-", "1", "]", "<", "arg_0", ".", "shape", "[", "0", "]", ",", "\"Boundaries are not correct for the given feature dimensions.\"", "arg_2", "=", "[", "]", "for", "arg_3", "in", "range", "(", "len", "(", "arg_1", ")", "-", "1", ")", ":", "arg_2", ".", "append", "(", "arg_0", "[", "arg_1", "[", "arg_3", "]", ":", "arg_1", "[", "arg_3", "+", "1", "]", ",", ":", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns a set of segments defined by the bound_idxs.\n\n    Parameters\n    ----------\n    F: np.ndarray\n        Matrix containing the features, one feature vector per row.\n    bound_idxs: np.ndarray\n        Array with boundary indeces.\n\n    Returns\n    -------\n    feat_segments: list\n        List of segments, one for each boundary interval.\n    \"\"\"\n    # Make sure bound_idxs are not empty\n    assert len(arg_1) > 0, \"Boundaries can't be empty\"\n\n    # Make sure that boundaries are sorted\n    arg_1 = np.sort(arg_1)\n\n    # Make sure we're not out of bounds\n    assert arg_1[0] >= 0 and arg_1[-1] < arg_0.shape[0], \\\n        \"Boundaries are not correct for the given feature dimensions.\"\n\n    # Obtain the segments\n    arg_2 = []\n    for arg_3 in range(len(arg_1) - 1):\n        arg_2.append(arg_0[arg_1[arg_3]:arg_1[arg_3 + 1], :])\n    return arg_2", "path": "msaf/algorithms/fmc2d/segmenter.py", "identifier": "get_feat_segments", "docstring": "Returns a set of segments defined by the bound_idxs.\n\n    Parameters\n    ----------\n    F: np.ndarray\n        Matrix containing the features, one feature vector per row.\n    bound_idxs: np.ndarray\n        Array with boundary indeces.\n\n    Returns\n    -------\n    feat_segments: list\n        List of segments, one for each boundary interval.", "docstring_tokens": ["Returns", "a", "set", "of", "segments", "defined", "by", "the", "bound_idxs", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 255307}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L103-L129", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Raise a runtime error if on Win32 systems.", "language": "python", "parameters": "(fn)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "platform_is_windows", "(", ")", ":", "raise", "RuntimeError", "(", "\"Router interface is not available on Win32 systems.\\n\"", "\"Configure AMS routes using the TwinCAT router service.\"", ")", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    # type: (Callable) -> Callable\n    \"\"\"Raise a runtime error if on Win32 systems.\n\n    Decorator.\n\n    Decorator for functions that interact with the router for the Linux\n    implementation of the ADS library.\n\n    Unlike the Windows implementation which uses a separate router daemon,\n    the Linux library manages AMS routing in-process. As such, routing must be\n    configured programatically via. the provided API. These endpoints are\n    invalid on Win32 systems, so an exception will be raised.\n\n    \"\"\"\n\n    @wraps(arg_0)\n    def wrapper(*arg_1, **arg_2):\n        # type: (Any, Any) -> Callable\n        if platform_is_windows():  # pragma: no cover, skipt Windows test\n            raise RuntimeError(\n                \"Router interface is not available on Win32 systems.\\n\"\n                \"Configure AMS routes using the TwinCAT router service.\"\n            )\n        return arg_0(*arg_1, **arg_2)\n\n    return wrapper", "path": "pyads/pyads_ex.py", "identifier": "router_function", "docstring": "Raise a runtime error if on Win32 systems.\n\n    Decorator.\n\n    Decorator for functions that interact with the router for the Linux\n    implementation of the ADS library.\n\n    Unlike the Windows implementation which uses a separate router daemon,\n    the Linux library manages AMS routing in-process. As such, routing must be\n    configured programatically via. the provided API. These endpoints are\n    invalid on Win32 systems, so an exception will be raised.", "docstring_tokens": ["Raise", "a", "runtime", "error", "if", "on", "Win32", "systems", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 255308}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/zkstatemanager.py#L544-L568", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to get scheduler location with\n    a callback. The future watch is placed\n    only if isWatching is True.", "language": "python", "parameters": "(self, topologyName, callback, isWatching)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_scheduler_location_path", "(", "arg_1", ")", "if", "arg_3", ":", "LOG", ".", "info", "(", "\"Adding data watch for path: \"", "+", "arg_4", ")", "@", "arg_0", ".", "client", ".", "DataWatch", "(", "arg_4", ")", "def", "watch_scheduler_location", "(", "arg_5", ",", "arg_6", ")", ":", "if", "arg_5", ":", "arg_7", "=", "SchedulerLocation", "(", ")", "arg_7", ".", "ParseFromString", "(", "arg_5", ")", "arg_2", "(", "arg_7", ")", "else", ":", "arg_2", "(", "None", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Helper function to get scheduler location with\n    a callback. The future watch is placed\n    only if isWatching is True.\n    \"\"\"\n    arg_4 = arg_0.get_scheduler_location_path(arg_1)\n    if arg_3:\n      LOG.info(\"Adding data watch for path: \" + arg_4)\n\n    # pylint: disable=unused-variable, unused-argument\n    @arg_0.client.DataWatch(arg_4)\n    def watch_scheduler_location(arg_5, arg_6):\n      \"\"\" invoke callback to watch scheduler location \"\"\"\n      if arg_5:\n        arg_7 = SchedulerLocation()\n        arg_7.ParseFromString(arg_5)\n        arg_2(arg_7)\n      else:\n        arg_2(None)\n\n      # Returning False will result in no future watches\n      # being triggered. If isWatching is True, then\n      # the future watches will be triggered.\n      return arg_3", "path": "heron/statemgrs/src/python/zkstatemanager.py", "identifier": "ZkStateManager._get_scheduler_location_with_watch", "docstring": "Helper function to get scheduler location with\n    a callback. The future watch is placed\n    only if isWatching is True.", "docstring_tokens": ["Helper", "function", "to", "get", "scheduler", "location", "with", "a", "callback", ".", "The", "future", "watch", "is", "placed", "only", "if", "isWatching", "is", "True", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255309}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L216-L260", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "This is a decorator that retries a function.", "language": "python", "parameters": "(n, errors, wait=0.0, logger_name=None)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.0", ",", "arg_3", "=", "None", ")", ":", "def", "wrapper", "(", "arg_4", ")", ":", "@", "functools", ".", "wraps", "(", "arg_4", ")", "def", "new_func", "(", "*", "arg_5", ",", "**", "arg_6", ")", ":", "arg_7", "=", "0", "while", "True", ":", "try", ":", "arg_8", "=", "arg_4", "(", "*", "arg_5", ",", "**", "arg_6", ")", "if", "arg_7", "and", "arg_3", ":", "arg_9", "=", "logging", ".", "getLogger", "(", "arg_3", ")", "arg_9", ".", "debug", "(", "'Retry of `%s` successful'", "%", "arg_4", ".", "__name__", ")", "return", "arg_8", "except", "arg_1", ":", "if", "arg_7", ">=", "arg_0", ":", "if", "arg_3", ":", "arg_9", "=", "logging", ".", "getLogger", "(", "arg_3", ")", "arg_9", ".", "exception", "(", "'I could not execute `%s` with args %s and kwargs %s, '", "'starting next try. '", "%", "(", "arg_4", ".", "__name__", ",", "str", "(", "arg_5", ")", ",", "str", "(", "arg_6", ")", ")", ")", "raise", "elif", "arg_3", ":", "arg_9", "=", "logging", ".", "getLogger", "(", "arg_3", ")", "arg_9", ".", "debug", "(", "'I could not execute `%s` with args %s and kwargs %s, '", "'starting next try. '", "%", "(", "arg_4", ".", "__name__", ",", "str", "(", "arg_5", ")", ",", "str", "(", "arg_6", ")", ")", ")", "arg_7", "+=", "1", "if", "arg_2", ":", "time", ".", "sleep", "(", "arg_2", ")", "return", "new_func", "return", "wrapper"], "function": "def Func(arg_0, arg_1, arg_2=0.0, arg_3=None):\n    \"\"\"This is a decorator that retries a function.\n\n    Tries `n` times and catches a given tuple of `errors`.\n\n    If the `n` retries are not enough, the error is reraised.\n\n    If desired `waits` some seconds.\n\n    Optionally takes a 'logger_name' of a given logger to print the caught error.\n\n    \"\"\"\n\n    def wrapper(arg_4):\n        @functools.wraps(arg_4)\n        def new_func(*arg_5, **arg_6):\n            arg_7 = 0\n            while True:\n                try:\n                    arg_8 = arg_4(*arg_5, **arg_6)\n                    if arg_7 and arg_3:\n                        arg_9 = logging.getLogger(arg_3)\n                        arg_9.debug('Retry of `%s` successful' % arg_4.__name__)\n                    return arg_8\n                except arg_1:\n                    if arg_7 >= arg_0:\n                        if arg_3:\n                            arg_9 = logging.getLogger(arg_3)\n                            arg_9.exception('I could not execute `%s` with args %s and kwargs %s, '\n                                             'starting next try. ' % (arg_4.__name__,\n                                                                      str(arg_5),\n                                                                      str(arg_6)))\n                        raise\n                    elif arg_3:\n                        arg_9 = logging.getLogger(arg_3)\n                        arg_9.debug('I could not execute `%s` with args %s and kwargs %s, '\n                                         'starting next try. ' % (arg_4.__name__,\n                                                                  str(arg_5),\n                                                                  str(arg_6)))\n                    arg_7 += 1\n                    if arg_2:\n                        time.sleep(arg_2)\n        return new_func\n\n    return wrapper", "path": "pypet/utils/decorators.py", "identifier": "retry", "docstring": "This is a decorator that retries a function.\n\n    Tries `n` times and catches a given tuple of `errors`.\n\n    If the `n` retries are not enough, the error is reraised.\n\n    If desired `waits` some seconds.\n\n    Optionally takes a 'logger_name' of a given logger to print the caught error.", "docstring_tokens": ["This", "is", "a", "decorator", "that", "retries", "a", "function", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255310}
{"url": "https://github.com/boxed/mutmut/blob/dd3bbe9aba3168ed21b85fbfe0b654b150239697/mutmut/__main__.py#L726-L747", "sha": "dd3bbe9aba3168ed21b85fbfe0b654b150239697", "docstring_summary": "Attempt to guess where the python source files to mutate are and yield\n    their paths", "language": "python", "parameters": "(path, tests_dirs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isdir", "(", "arg_0", ")", ":", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "os", ".", "walk", "(", "arg_0", ")", ":", "arg_3", "[", ":", "]", "=", "[", "d", "for", "d", "in", "arg_3", "if", "os", ".", "path", ".", "join", "(", "arg_2", ",", "d", ")", "not", "in", "arg_1", "]", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", ".", "endswith", "(", "'.py'", ")", ":", "yield", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_5", ")", "else", ":", "yield", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Attempt to guess where the python source files to mutate are and yield\n    their paths\n\n    :param path: path to a python source file or package directory\n    :type path: str\n\n    :param tests_dirs: list of directory paths containing test files\n        (we do not want to mutate these!)\n    :type tests_dirs: list[str]\n\n    :return: generator listing the paths to the python source files to mutate\n    :rtype: Generator[str, None, None]\n    \"\"\"\n    if isdir(arg_0):\n        for arg_2, arg_3, arg_4 in os.walk(arg_0):\n            arg_3[:] = [d for d in arg_3 if os.path.join(arg_2, d) not in arg_1]\n            for arg_5 in arg_4:\n                if arg_5.endswith('.py'):\n                    yield os.path.join(arg_2, arg_5)\n    else:\n        yield arg_0", "path": "mutmut/__main__.py", "identifier": "python_source_files", "docstring": "Attempt to guess where the python source files to mutate are and yield\n    their paths\n\n    :param path: path to a python source file or package directory\n    :type path: str\n\n    :param tests_dirs: list of directory paths containing test files\n        (we do not want to mutate these!)\n    :type tests_dirs: list[str]\n\n    :return: generator listing the paths to the python source files to mutate\n    :rtype: Generator[str, None, None]", "docstring_tokens": ["Attempt", "to", "guess", "where", "the", "python", "source", "files", "to", "mutate", "are", "and", "yield", "their", "paths"], "nwo": "boxed/mutmut", "score": 0.7603128213581444, "idx": 255311}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1189-L1209", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Reserves an IPv4 address for the specified subscription.", "language": "python", "parameters": "(self, name, label=None, location=None)", "return_statement": "return self._perform_post(\n            self._get_reserved_ip_path(),\n            _XmlSerializer.create_reserved_ip_to_xml(name, label, location),\n            as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "_validate_not_none", "(", "'name'", ",", "arg_1", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_reserved_ip_path", "(", ")", ",", "_XmlSerializer", ".", "create_reserved_ip_to_xml", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        '''\n        Reserves an IPv4 address for the specified subscription.\n\n        name:\n            Required. Specifies the name for the reserved IP address.\n        label:\n            Optional. Specifies a label for the reserved IP address. The label\n            can be up to 100 characters long and can be used for your tracking\n            purposes.\n        location:\n            Required. Specifies the location of the reserved IP address. This\n            should be the same location that is assigned to the cloud service\n            containing the deployment that will use the reserved IP address.\n            To see the available locations, you can use list_locations.\n        '''\n        _validate_not_none('name', arg_1)\n        return arg_0._perform_post(\n            arg_0._get_reserved_ip_path(),\n            _XmlSerializer.create_reserved_ip_to_xml(arg_1, arg_2, arg_3),\n            as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.create_reserved_ip_address", "docstring": "Reserves an IPv4 address for the specified subscription.\n\n        name:\n            Required. Specifies the name for the reserved IP address.\n        label:\n            Optional. Specifies a label for the reserved IP address. The label\n            can be up to 100 characters long and can be used for your tracking\n            purposes.\n        location:\n            Required. Specifies the location of the reserved IP address. This\n            should be the same location that is assigned to the cloud service\n            containing the deployment that will use the reserved IP address.\n            To see the available locations, you can use list_locations.", "docstring_tokens": ["Reserves", "an", "IPv4", "address", "for", "the", "specified", "subscription", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255312}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/rtlLevel/netlist.py#L49-L64", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Cut off drivers from statements", "language": "python", "parameters": "(dstSignal, statements)", "return_statement": "return list(compress(statements, stm_filter)), separated", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "arg_4", ".", "_clean_signal_meta", "(", ")", "arg_5", "=", "arg_4", ".", "_Func", "(", "arg_0", ")", "if", "arg_5", "is", "not", "None", ":", "arg_2", ".", "append", "(", "arg_5", ")", "arg_6", "=", "arg_5", "is", "not", "arg_4", "arg_3", ".", "append", "(", "arg_6", ")", "return", "list", "(", "compress", "(", "arg_1", ",", "arg_3", ")", ")", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Cut off drivers from statements\n    \"\"\"\n    arg_2 = []\n    arg_3 = []\n    for arg_4 in arg_1:\n        arg_4._clean_signal_meta()\n        arg_5 = arg_4._Func(arg_0)\n        if arg_5 is not None:\n            arg_2.append(arg_5)\n\n        arg_6 = arg_5 is not arg_4\n        arg_3.append(arg_6)\n\n    return list(compress(arg_1, arg_3)), arg_2", "path": "hwt/synthesizer/rtlLevel/netlist.py", "identifier": "cut_off_drivers_of", "docstring": "Cut off drivers from statements", "docstring_tokens": ["Cut", "off", "drivers", "from", "statements"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 255313}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/utils/stream_pickler.py#L36-L53", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "load contents from file_obj, returning a generator that yields one\n        element at a time", "language": "python", "parameters": "(file_obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_1", ".", "append", "(", "arg_2", ")", "if", "arg_2", "==", "'\\n'", ":", "arg_3", "=", "''", ".", "join", "(", "arg_1", ")", "arg_1", "=", "[", "]", "try", ":", "arg_4", "=", "Funcs", "(", "arg_3", ")", "except", "ValueError", ":", "continue", "yield", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"\n        Func contents from file_obj, returning a generator that yields one\n        element at a time\n        \"\"\"\n        arg_1 = []\n        for arg_2 in arg_0:\n          arg_1.append(arg_2)\n\n          if arg_2 == '\\n':\n            arg_3 = ''.join(arg_1)\n            arg_1 = []\n            try:\n                arg_4 = Funcs(arg_3)\n            except ValueError:\n                continue\n\n            yield arg_4", "path": "deepy/utils/stream_pickler.py", "identifier": "StreamPickler.load", "docstring": "load contents from file_obj, returning a generator that yields one\n        element at a time", "docstring_tokens": ["load", "contents", "from", "file_obj", "returning", "a", "generator", "that", "yields", "one", "element", "at", "a", "time"], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 255314}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/vault_store.py#L20-L42", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Given a list of pem objects, sort the objects into the private key, leaf\n    certificate, and list of CA certificates in the trust chain. This function\n    assumes that the list of pem objects will contain exactly one private key\n    and exactly one leaf certificate and that only key and certificate type\n    objects are provided.", "language": "python", "parameters": "(pem_objects)", "return_statement": "return key, cert, ca_certs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "[", "]", ",", "[", "]", ",", "[", "]", "for", "arg_4", "in", "arg_0", ":", "if", "isinstance", "(", "arg_4", ",", "pem", ".", "Key", ")", ":", "arg_1", ".", "append", "(", "arg_4", ")", "else", ":", "if", "_is_ca", "(", "arg_4", ")", ":", "arg_3", ".", "append", "(", "arg_4", ")", "else", ":", "arg_2", ".", "append", "(", "arg_4", ")", "[", "arg_5", "]", ",", "[", "arg_6", "]", "=", "arg_1", ",", "arg_2", "return", "arg_5", ",", "arg_6", ",", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Given a list of pem objects, sort the objects into the private key, leaf\n    certificate, and list of CA certificates in the trust chain. This function\n    assumes that the list of pem objects will contain exactly one private key\n    and exactly one leaf certificate and that only key and certificate type\n    objects are provided.\n    \"\"\"\n    arg_1, arg_2, arg_3 = [], [], []\n    for arg_4 in arg_0:\n        if isinstance(arg_4, pem.Key):\n            arg_1.append(arg_4)\n        else:\n            # This assumes all pem objects provided are either of type pem.Key\n            # or pem.Certificate. Technically, there are CSR and CRL types, but\n            # we should never be passed those.\n            if _is_ca(arg_4):\n                arg_3.append(arg_4)\n            else:\n                arg_2.append(arg_4)\n\n    [arg_5], [arg_6] = arg_1, arg_2\n    return arg_5, arg_6, arg_3", "path": "marathon_acme/vault_store.py", "identifier": "sort_pem_objects", "docstring": "Given a list of pem objects, sort the objects into the private key, leaf\n    certificate, and list of CA certificates in the trust chain. This function\n    assumes that the list of pem objects will contain exactly one private key\n    and exactly one leaf certificate and that only key and certificate type\n    objects are provided.", "docstring_tokens": ["Given", "a", "list", "of", "pem", "objects", "sort", "the", "objects", "into", "the", "private", "key", "leaf", "certificate", "and", "list", "of", "CA", "certificates", "in", "the", "trust", "chain", ".", "This", "function", "assumes", "that", "the", "list", "of", "pem", "objects", "will", "contain", "exactly", "one", "private", "key", "and", "exactly", "one", "leaf", "certificate", "and", "that", "only", "key", "and", "certificate", "type", "objects", "are", "provided", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 255315}
{"url": "https://github.com/praekeltfoundation/seed-control-interface/blob/32ddad88b5bc2f8f4d80b848361899da2e081636/ci/utils.py#L162-L185", "sha": "32ddad88b5bc2f8f4d80b848361899da2e081636", "docstring_summary": "Get a page from an interator, handling invalid input from the page number\n    by defaulting to the first page.", "language": "python", "parameters": "(iterator, page_size, page_number)", "return_statement": "return NoCountPage(items, page_number, page_size, has_next)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_2", "=", "validate_page_number", "(", "arg_2", ")", "except", "(", "PageNotAnInteger", ",", "EmptyPage", ")", ":", "arg_2", "=", "1", "arg_3", "=", "(", "arg_2", "-", "1", ")", "*", "arg_1", "arg_4", "=", "(", "arg_2", "*", "arg_1", ")", "+", "1", "arg_5", "=", "list", "(", "islice", "(", "arg_0", ",", "arg_3", ")", ")", "arg_6", "=", "list", "(", "islice", "(", "arg_0", ",", "arg_4", ")", ")", "if", "len", "(", "arg_6", ")", "==", "0", "and", "arg_2", "!=", "1", ":", "arg_6", "=", "arg_5", "arg_2", "=", "1", "arg_7", "=", "len", "(", "arg_6", ")", ">", "arg_1", "arg_6", "=", "arg_6", "[", ":", "arg_1", "]", "return", "NoCountPage", "(", "arg_6", ",", "arg_2", ",", "arg_1", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Get a page from an interator, handling invalid input from the page number\n    by defaulting to the first page.\n    \"\"\"\n    try:\n        arg_2 = validate_page_number(arg_2)\n    except (PageNotAnInteger, EmptyPage):\n        arg_2 = 1\n\n    arg_3 = (arg_2 - 1) * arg_1\n    # End 1 more than we need, so that we can see if there's another page\n    arg_4 = (arg_2 * arg_1) + 1\n    arg_5 = list(islice(arg_0, arg_3))\n    arg_6 = list(islice(arg_0, arg_4))\n\n    if len(arg_6) == 0 and arg_2 != 1:\n        arg_6 = arg_5\n        arg_2 = 1\n\n    arg_7 = len(arg_6) > arg_1\n    arg_6 = arg_6[:arg_1]\n\n    return NoCountPage(arg_6, arg_2, arg_1, arg_7)", "path": "ci/utils.py", "identifier": "get_page_of_iterator", "docstring": "Get a page from an interator, handling invalid input from the page number\n    by defaulting to the first page.", "docstring_tokens": ["Get", "a", "page", "from", "an", "interator", "handling", "invalid", "input", "from", "the", "page", "number", "by", "defaulting", "to", "the", "first", "page", "."], "nwo": "praekeltfoundation/seed-control-interface", "score": 0.09252797783733271, "idx": 255316}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mongo_to_s3.py#L71-L103", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Executed by task_instance at runtime", "language": "python", "parameters": "(self, context)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "S3Hook", "(", "arg_0", ".", "s3_conn_id", ")", "if", "arg_0", ".", "is_pipeline", ":", "arg_3", "=", "MongoHook", "(", "arg_0", ".", "mongo_conn_id", ")", ".", "aggregate", "(", "mongo_collection", "=", "arg_0", ".", "mongo_collection", ",", "aggregate_query", "=", "arg_0", ".", "mongo_query", ",", "mongo_db", "=", "arg_0", ".", "mongo_db", ")", "else", ":", "arg_3", "=", "MongoHook", "(", "arg_0", ".", "mongo_conn_id", ")", ".", "find", "(", "mongo_collection", "=", "arg_0", ".", "mongo_collection", ",", "query", "=", "arg_0", ".", "mongo_query", ",", "mongo_db", "=", "arg_0", ".", "mongo_db", ")", "arg_4", "=", "arg_0", ".", "_stringify", "(", "arg_0", ".", "transform", "(", "arg_3", ")", ")", "arg_2", ".", "load_string", "(", "string_data", "=", "arg_4", ",", "key", "=", "arg_0", ".", "s3_key", ",", "bucket_name", "=", "arg_0", ".", "s3_bucket", ",", "replace", "=", "arg_0", ".", "replace", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Executed by task_instance at runtime\n        \"\"\"\n        arg_2 = S3Hook(arg_0.s3_conn_id)\n\n        # Grab collection and Func query according to whether or not it is a pipeline\n        if arg_0.is_pipeline:\n            arg_3 = MongoHook(arg_0.mongo_conn_id).aggregate(\n                mongo_collection=arg_0.mongo_collection,\n                aggregate_query=arg_0.mongo_query,\n                mongo_db=arg_0.mongo_db\n            )\n\n        else:\n            arg_3 = MongoHook(arg_0.mongo_conn_id).find(\n                mongo_collection=arg_0.mongo_collection,\n                query=arg_0.mongo_query,\n                mongo_db=arg_0.mongo_db\n            )\n\n        # Performs transform then stringifies the docs results into json format\n        arg_4 = arg_0._stringify(arg_0.transform(arg_3))\n\n        # Load Into S3\n        arg_2.load_string(\n            string_data=arg_4,\n            key=arg_0.s3_key,\n            bucket_name=arg_0.s3_bucket,\n            replace=arg_0.replace\n        )\n\n        return True", "path": "airflow/contrib/operators/mongo_to_s3.py", "identifier": "MongoToS3Operator.execute", "docstring": "Executed by task_instance at runtime", "docstring_tokens": ["Executed", "by", "task_instance", "at", "runtime"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255317}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/service.py#L84-L110", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Start listening for events from Marathon, running a sync when we first\n        successfully subscribe and triggering a sync on API request events.", "language": "python", "parameters": "(self, reconnects=0)", "return_statement": "return self.marathon_client.get_events({\n            'event_stream_attached': self._sync_on_event_stream_attached,\n            'api_post_event': self._sync_on_api_post_event\n        }).addCallbacks(on_finished, log_failure, callbackArgs=[reconnects])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_0", ".", "log", ".", "info", "(", "'Listening for events from Marathon...'", ")", "arg_0", ".", "_attached", "=", "False", "def", "on_finished", "(", "arg_3", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "warn", "(", "'Connection lost listening for events, '", "'reconnecting... ({reconnects} so far)'", ",", "arg_1", "=", "arg_1", ")", "arg_1", "+=", "1", "return", "arg_0", ".", "Func", "(", "arg_1", ")", "def", "log_failure", "(", "arg_4", ")", ":", "arg_0", ".", "log", ".", "failure", "(", "'Failed to listen for events'", ",", "arg_4", ")", "return", "arg_4", "return", "arg_0", ".", "marathon_client", ".", "get_events", "(", "{", "'event_stream_attached'", ":", "arg_0", ".", "_sync_on_event_stream_attached", ",", "'api_post_event'", ":", "arg_0", ".", "_sync_on_api_post_event", "}", ")", ".", "addCallbacks", "(", "on_finished", ",", "log_failure", ",", "callbackArgs", "=", "[", "arg_1", "]", ")"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"\n        Start listening for events from Marathon, running a sync when we first\n        successfully subscribe and triggering a sync on API request events.\n        \"\"\"\n        arg_0.log.info('Listening for events from Marathon...')\n        arg_0._attached = False\n\n        def on_finished(arg_3, arg_1):\n            # If the callback fires then the HTTP request to the event stream\n            # went fine, but the persistent connection for the SSE stream was\n            # dropped. Just reconnect for now- if we can't actually connect\n            # then the errback will fire rather.\n            arg_0.log.warn('Connection lost listening for events, '\n                          'reconnecting... ({reconnects} so far)',\n                          arg_1=arg_1)\n            arg_1 += 1\n            return arg_0.Func(arg_1)\n\n        def log_failure(arg_4):\n            arg_0.log.failure('Failed to listen for events', arg_4)\n            return arg_4\n\n        return arg_0.marathon_client.get_events({\n            'event_stream_attached': arg_0._sync_on_event_stream_attached,\n            'api_post_event': arg_0._sync_on_api_post_event\n        }).addCallbacks(on_finished, log_failure, callbackArgs=[arg_1])", "path": "marathon_acme/service.py", "identifier": "MarathonAcme.listen_events", "docstring": "Start listening for events from Marathon, running a sync when we first\n        successfully subscribe and triggering a sync on API request events.", "docstring_tokens": ["Start", "listening", "for", "events", "from", "Marathon", "running", "a", "sync", "when", "we", "first", "successfully", "subscribe", "and", "triggering", "a", "sync", "on", "API", "request", "events", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 255318}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/utils.py#L25-L77", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Concatenate `images` in the direction determined in `axis`.", "language": "python", "parameters": "(images, axis='t')", "return_statement": "return np.concatenate(image_data, axis=work_axis)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'t'", ")", ":", "if", "not", "arg_0", ":", "return", "None", "arg_2", "=", "{", "'x'", ":", "0", ",", "'y'", ":", "1", ",", "'z'", ":", "2", ",", "'t'", ":", "3", ",", "}", "if", "arg_1", "not", "in", "arg_2", ":", "raise", "ValueError", "(", "'Expected `axis` to be one of ({}), got {}.'", ".", "format", "(", "set", "(", "arg_2", ".", "keys", "(", ")", ")", ",", "arg_1", ")", ")", "arg_3", "=", "arg_0", "[", "0", "]", "for", "arg_4", "in", "arg_0", ":", "check_img_compatibility", "(", "arg_3", ",", "arg_4", ")", "arg_5", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "arg_5", ".", "append", "(", "check_img", "(", "arg_4", ")", ".", "get_data", "(", ")", ")", "arg_6", "=", "arg_2", "[", "arg_1", "]", "arg_7", "=", "arg_5", "[", "0", "]", ".", "ndim", "if", "arg_7", "-", "1", "<", "arg_6", ":", "arg_5", "=", "[", "np", ".", "expand_dims", "(", "arg_4", ",", "arg_1", "=", "arg_6", ")", "for", "arg_4", "in", "arg_5", "]", "return", "np", ".", "concatenate", "(", "arg_5", ",", "arg_1", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1='t'):\n    \"\"\" Concatenate `images` in the direction determined in `axis`.\n\n    Parameters\n    ----------\n    images: list of str or img-like object.\n        See NeuroImage constructor docstring.\n\n    axis: str\n      't' : concatenate images in time\n      'x' : concatenate images in the x direction\n      'y' : concatenate images in the y direction\n      'z' : concatenate images in the z direction\n\n    Returns\n    -------\n    merged: img-like object\n    \"\"\"\n    # check if images is not empty\n    if not arg_0:\n        return None\n\n    # the given axis name to axis idx\n    arg_2 = {'x': 0,\n                'y': 1,\n                'z': 2,\n                't': 3,\n                }\n\n    # check if the given axis name is valid\n    if arg_1 not in arg_2:\n        raise ValueError('Expected `axis` to be one of ({}), got {}.'.format(set(arg_2.keys()), arg_1))\n\n    # check if all images are compatible with each other\n    arg_3 = arg_0[0]\n    for arg_4 in arg_0:\n        check_img_compatibility(arg_3, arg_4)\n\n    # read the data of all the given images\n    # TODO: optimize memory consumption by merging one by one.\n    arg_5 = []\n    for arg_4 in arg_0:\n        arg_5.append(check_img(arg_4).get_data())\n\n    # if the work_axis is bigger than the number of axis of the images,\n    # create a new axis for the images\n    arg_6 = arg_2[arg_1]\n    arg_7 = arg_5[0].ndim\n    if arg_7 - 1 < arg_6:\n        arg_5 = [np.expand_dims(arg_4, arg_1=arg_6) for arg_4 in arg_5]\n\n    # concatenate and return\n    return np.concatenate(arg_5, arg_1=arg_6)", "path": "boyle/nifti/utils.py", "identifier": "merge_images", "docstring": "Concatenate `images` in the direction determined in `axis`.\n\n    Parameters\n    ----------\n    images: list of str or img-like object.\n        See NeuroImage constructor docstring.\n\n    axis: str\n      't' : concatenate images in time\n      'x' : concatenate images in the x direction\n      'y' : concatenate images in the y direction\n      'z' : concatenate images in the z direction\n\n    Returns\n    -------\n    merged: img-like object", "docstring_tokens": ["Concatenate", "images", "in", "the", "direction", "determined", "in", "axis", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255319}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/preprocessing/data.py#L172-L180", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Convert to equivalent StandardScaler", "language": "python", "parameters": "(self)", "return_statement": "return scaler", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "StandardScaler", "(", "with_mean", "=", "arg_0", ".", "with_mean", ",", "with_std", "=", "arg_0", ".", "with_std", ",", "copy", "=", "arg_0", ".", "copy", ")", "arg_1", ".", "__dict__", "=", "arg_0", ".", "__dict__", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Convert to equivalent StandardScaler\n        \"\"\"\n        arg_1 = StandardScaler(with_mean=arg_0.with_mean,\n                                with_std=arg_0.with_std,\n                                copy=arg_0.copy)\n        arg_1.__dict__ = arg_0.__dict__\n        return arg_1", "path": "splearn/preprocessing/data.py", "identifier": "SparkStandardScaler.to_scikit", "docstring": "Convert to equivalent StandardScaler", "docstring_tokens": ["Convert", "to", "equivalent", "StandardScaler"], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 255320}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L104-L125", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Plays the first track in the queue, if any or plays a track from the specified index in the queue.", "language": "python", "parameters": "(self, track_index: int = 0, ignore_shuffle: bool = False)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "=", "0", ",", "arg_3", ":", "arg_4", "=", "False", ")", ":", "if", "arg_0", ".", "repeat", "and", "arg_0", ".", "current", ":", "arg_0", ".", "queue", ".", "append", "(", "arg_0", ".", "current", ")", "arg_0", ".", "previous", "=", "arg_0", ".", "current", "arg_0", ".", "current", "=", "None", "arg_0", ".", "position", "=", "0", "arg_0", ".", "paused", "=", "False", "if", "not", "arg_0", ".", "queue", ":", "await", "arg_0", ".", "stop", "(", ")", "await", "arg_0", ".", "_lavalink", ".", "dispatch_event", "(", "QueueEndEvent", "(", "arg_0", ")", ")", "else", ":", "if", "arg_0", ".", "shuffle", "and", "not", "arg_3", ":", "arg_9", "=", "arg_0", ".", "queue", ".", "pop", "(", "randrange", "(", "len", "(", "arg_0", ".", "queue", ")", ")", ")", "else", ":", "arg_9", "=", "arg_0", ".", "queue", ".", "pop", "(", "min", "(", "arg_1", ",", "len", "(", "arg_0", ".", "queue", ")", "-", "1", ")", ")", "arg_0", ".", "current", "=", "arg_9", "await", "arg_0", ".", "_lavalink", ".", "ws", ".", "send", "(", "op", "=", "'Func'", ",", "guildId", "=", "arg_0", ".", "guild_id", ",", "arg_9", "=", "arg_9", ".", "track", ")", "await", "arg_0", ".", "_lavalink", ".", "dispatch_event", "(", "TrackStartEvent", "(", "arg_0", ",", "arg_9", ")", ")"], "function": "async def Func(arg_0, arg_1: arg_2 = 0, arg_3: arg_4 = False):\r\n        \"\"\" Plays the first track in the queue, if any or Funcs a track from the specified index in the queue. \"\"\"\r\n        if arg_0.repeat and arg_0.current:\r\n            arg_0.queue.append(arg_0.current)\r\n\r\n        arg_0.previous = arg_0.current\r\n        arg_0.current = None\r\n        arg_0.position = 0\r\n        arg_0.paused = False\r\n\r\n        if not arg_0.queue:\r\n            await arg_0.stop()\r\n            await arg_0._lavalink.dispatch_event(QueueEndEvent(arg_0))\r\n        else:\r\n            if arg_0.shuffle and not arg_3:\r\n                arg_9 = arg_0.queue.pop(randrange(len(arg_0.queue)))\r\n            else:\r\n                arg_9 = arg_0.queue.pop(min(arg_1, len(arg_0.queue) - 1))\r\n\r\n            arg_0.current = arg_9\r\n            await arg_0._lavalink.ws.send(op='Func', guildId=arg_0.guild_id, arg_9=arg_9.track)\r\n            await arg_0._lavalink.dispatch_event(TrackStartEvent(arg_0, arg_9))", "path": "lavalink/PlayerManager.py", "identifier": "DefaultPlayer.play", "docstring": "Plays the first track in the queue, if any or plays a track from the specified index in the queue.", "docstring_tokens": ["Plays", "the", "first", "track", "in", "the", "queue", "if", "any", "or", "plays", "a", "track", "from", "the", "specified", "index", "in", "the", "queue", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 255321}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sqoop_hook.py#L314-L355", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Exports Hive table to remote location. Arguments are copies of direct\n        sqoop command line Arguments", "language": "python", "parameters": "(self, table, export_dir, input_null_string,\n                     input_null_non_string, staging_table,\n                     clear_staging_table, enclosed_by,\n                     escaped_by, input_fields_terminated_by,\n                     input_lines_terminated_by,\n                     input_optionally_enclosed_by, batch,\n                     relaxed_isolation, extra_export_options=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", "=", "None", ")", ":", "arg_15", "=", "arg_0", ".", "_export_cmd", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", ")", "arg_0", ".", "Popen", "(", "arg_15", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                     arg_4, arg_5,\n                     arg_6, arg_7,\n                     arg_8, arg_9,\n                     arg_10,\n                     arg_11, arg_12,\n                     arg_13, arg_14=None):\n        \"\"\"\n        Exports Hive table to remote location. Arguments are copies of direct\n        sqoop command line Arguments\n\n        :param table: Table remote destination\n        :param export_dir: Hive table to export\n        :param input_null_string: The string to be interpreted as null for\n            string columns\n        :param input_null_non_string: The string to be interpreted as null\n            for non-string columns\n        :param staging_table: The table in which data will be staged before\n            being inserted into the destination table\n        :param clear_staging_table: Indicate that any data present in the\n            staging table can be deleted\n        :param enclosed_by: Sets a required field enclosing character\n        :param escaped_by: Sets the escape character\n        :param input_fields_terminated_by: Sets the field separator character\n        :param input_lines_terminated_by: Sets the end-of-line character\n        :param input_optionally_enclosed_by: Sets a field enclosing character\n        :param batch: Use batch mode for underlying statement execution\n        :param relaxed_isolation: Transaction isolation to read uncommitted\n            for the mappers\n        :param extra_export_options: Extra export options to pass as dict.\n            If a key doesn't have a value, just pass an empty string to it.\n            Don't include prefix of -- for sqoop options.\n        \"\"\"\n        arg_15 = arg_0._export_cmd(arg_1, arg_2, arg_3,\n                               arg_4, arg_5,\n                               arg_6, arg_7, arg_8,\n                               arg_9,\n                               arg_10,\n                               arg_11, arg_12,\n                               arg_13, arg_14)\n\n        arg_0.Popen(arg_15)", "path": "airflow/contrib/hooks/sqoop_hook.py", "identifier": "SqoopHook.export_table", "docstring": "Exports Hive table to remote location. Arguments are copies of direct\n        sqoop command line Arguments\n\n        :param table: Table remote destination\n        :param export_dir: Hive table to export\n        :param input_null_string: The string to be interpreted as null for\n            string columns\n        :param input_null_non_string: The string to be interpreted as null\n            for non-string columns\n        :param staging_table: The table in which data will be staged before\n            being inserted into the destination table\n        :param clear_staging_table: Indicate that any data present in the\n            staging table can be deleted\n        :param enclosed_by: Sets a required field enclosing character\n        :param escaped_by: Sets the escape character\n        :param input_fields_terminated_by: Sets the field separator character\n        :param input_lines_terminated_by: Sets the end-of-line character\n        :param input_optionally_enclosed_by: Sets a field enclosing character\n        :param batch: Use batch mode for underlying statement execution\n        :param relaxed_isolation: Transaction isolation to read uncommitted\n            for the mappers\n        :param extra_export_options: Extra export options to pass as dict.\n            If a key doesn't have a value, just pass an empty string to it.\n            Don't include prefix of -- for sqoop options.", "docstring_tokens": ["Exports", "Hive", "table", "to", "remote", "location", ".", "Arguments", "are", "copies", "of", "direct", "sqoop", "command", "line", "Arguments"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255322}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/glib.py#L90-L121", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Register an io-handler with the glib main loop.", "language": "python", "parameters": "(self, handler)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "check_events", "(", ")", ":", "return", "if", "arg_1", "in", "arg_0", ".", "_unprepared_handlers", ":", "arg_2", "=", "arg_0", ".", "_unprepared_handlers", "[", "arg_1", "]", "arg_3", "=", "arg_0", ".", "_prepare_io_handler", "(", "arg_1", ")", "else", ":", "arg_2", "=", "None", "arg_3", "=", "True", "arg_4", "=", "arg_1", ".", "fileno", "(", ")", "if", "arg_2", "is", "not", "None", "and", "arg_4", "!=", "arg_2", ":", "arg_5", "=", "arg_0", ".", "_io_sources", ".", "pop", "(", "arg_1", ",", "None", ")", "if", "arg_5", "is", "not", "None", ":", "glib", ".", "source_remove", "(", "arg_5", ")", "if", "not", "arg_3", ":", "arg_0", ".", "_unprepared_handlers", "[", "arg_1", "]", "=", "arg_4", "if", "arg_4", "is", "None", ":", "logger", ".", "debug", "(", "\" {0!r}.fileno() is None, not polling\"", ".", "format", "(", "arg_1", ")", ")", "return", "arg_7", "=", "0", "if", "arg_1", ".", "is_readable", "(", ")", ":", "logger", ".", "debug", "(", "\" {0!r} readable\"", ".", "format", "(", "arg_1", ")", ")", "arg_7", "|=", "glib", ".", "IO_IN", "|", "glib", ".", "IO_ERR", "if", "arg_1", ".", "is_writable", "(", ")", ":", "logger", ".", "debug", "(", "\" {0!r} writable\"", ".", "format", "(", "arg_1", ")", ")", "arg_7", "|=", "glib", ".", "IO_OUT", "|", "glib", ".", "IO_HUP", "|", "glib", ".", "IO_ERR", "if", "arg_7", ":", "logger", ".", "debug", "(", "\" registering {0!r} handler fileno {1} for\"", "\" events {2}\"", ".", "format", "(", "arg_1", ",", "arg_4", ",", "arg_7", ")", ")", "glib", ".", "io_add_watch", "(", "arg_4", ",", "arg_7", ",", "arg_0", ".", "_io_callback", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Register an io-handler with the glib main loop.\"\"\"\n        if arg_0.check_events():\n            return\n        if arg_1 in arg_0._unprepared_handlers:\n            arg_2 = arg_0._unprepared_handlers[arg_1]\n            arg_3 = arg_0._prepare_io_handler(arg_1)\n        else:\n            arg_2 = None\n            arg_3 = True\n        arg_4 = arg_1.fileno()\n        if arg_2 is not None and arg_4 != arg_2:\n            arg_5 = arg_0._io_sources.pop(arg_1, None)\n            if arg_5 is not None:\n                glib.source_remove(arg_5)\n        if not arg_3:\n            arg_0._unprepared_handlers[arg_1] = arg_4\n        if arg_4 is None:\n            logger.debug(\" {0!r}.fileno() is None, not polling\"\n                                                    .format(arg_1))\n            return\n        arg_7 = 0\n        if arg_1.is_readable():\n            logger.debug(\" {0!r} readable\".format(arg_1))\n            arg_7 |= glib.IO_IN | glib.IO_ERR\n        if arg_1.is_writable():\n            logger.debug(\" {0!r} writable\".format(arg_1))\n            arg_7 |= glib.IO_OUT | glib.IO_HUP | glib.IO_ERR\n        if arg_7:\n            logger.debug(\" registering {0!r} handler fileno {1} for\"\n                            \" events {2}\".format(arg_1, arg_4, arg_7))\n            glib.io_add_watch(arg_4, arg_7, arg_0._io_callback, arg_1)", "path": "pyxmpp2/mainloop/glib.py", "identifier": "GLibMainLoop._configure_io_handler", "docstring": "Register an io-handler with the glib main loop.", "docstring_tokens": ["Register", "an", "io", "-", "handler", "with", "the", "glib", "main", "loop", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255323}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/doecode/__init__.py#L23-L38", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Yields DOE CODE records from a DOE CODE .json URL response\n    Converts a DOE CODE API .json URL response into DOE CODE projects", "language": "python", "parameters": "(url, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "'Fetching DOE CODE JSON: %s'", ",", "arg_0", ")", "if", "arg_1", "is", "None", ":", "raise", "ValueError", "(", "'DOE CODE API Key value is missing!'", ")", "arg_2", "=", "requests", ".", "get", "(", "arg_0", ",", "headers", "=", "{", "\"Authorization\"", ":", "\"Basic \"", "+", "arg_1", "}", ")", "arg_3", "=", "arg_2", ".", "json", "(", ")", "for", "arg_4", "in", "arg_3", "[", "'records'", "]", ":", "yield", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Yields DOE CODE records from a DOE CODE .json URL response\n    Converts a DOE CODE API .json URL response into DOE CODE projects\n    \"\"\"\n\n    logger.debug('Fetching DOE CODE JSON: %s', arg_0)\n\n    if arg_1 is None:\n        raise ValueError('DOE CODE API Key value is missing!')\n\n    arg_2 = requests.get(arg_0, headers={\"Authorization\": \"Basic \" + arg_1})\n    arg_3 = arg_2.json()\n\n    for arg_4 in arg_3['records']:\n        yield arg_4", "path": "scraper/doecode/__init__.py", "identifier": "process_url", "docstring": "Yields DOE CODE records from a DOE CODE .json URL response\n    Converts a DOE CODE API .json URL response into DOE CODE projects", "docstring_tokens": ["Yields", "DOE", "CODE", "records", "from", "a", "DOE", "CODE", ".", "json", "URL", "response", "Converts", "a", "DOE", "CODE", "API", ".", "json", "URL", "response", "into", "DOE", "CODE", "projects"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 255324}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L957-L1009", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Calculates LM updates, with or without the acceleration correction.", "language": "python", "parameters": "(self, grad, do_correct_damping=True, subblock=None)", "return_statement": "return delta", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "not", "None", ":", "if", "(", "arg_3", ".", "sum", "(", ")", "==", "0", ")", "or", "(", "arg_3", ".", "size", "==", "0", ")", ":", "CLOG", ".", "fatal", "(", "'Empty subblock in Func'", ")", "raise", "ValueError", "(", "'Empty sub-block'", ")", "arg_4", "=", "arg_0", ".", "J", "[", "arg_3", "]", "arg_5", "=", "np", ".", "dot", "(", "arg_4", ",", "arg_4", ".", "T", ")", "arg_6", "=", "arg_0", ".", "_calc_damped_jtj", "(", "arg_5", ",", "arg_3", "=", "arg_3", ")", "arg_1", "=", "arg_1", "[", "arg_3", "]", "else", ":", "arg_6", "=", "arg_0", ".", "_calc_damped_jtj", "(", "arg_0", ".", "JTJ", ",", "arg_3", "=", "arg_3", ")", "arg_7", "=", "arg_0", ".", "_calc_lm_step", "(", "arg_6", ",", "arg_1", ",", "arg_3", "=", "arg_3", ")", "if", "arg_0", ".", "use_accel", ":", "arg_8", "=", "arg_0", ".", "calc_accel_correction", "(", "arg_6", ",", "arg_7", ")", "arg_9", "=", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "arg_7", "**", "2", ")", ")", "arg_10", "=", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "arg_8", "**", "2", ")", ")", "CLOG", ".", "debug", "(", "'|correction| / |LM step|\\t%e'", "%", "(", "arg_10", "/", "arg_9", ")", ")", "if", "arg_10", "/", "arg_9", "<", "arg_0", ".", "max_accel_correction", ":", "arg_7", "+=", "arg_8", "elif", "arg_2", ":", "CLOG", ".", "debug", "(", "'Untrustworthy step! Increasing damping...'", ")", "arg_0", ".", "increase_damping", "(", ")", "arg_6", "=", "arg_0", ".", "_calc_damped_jtj", "(", "arg_0", ".", "JTJ", ",", "arg_3", "=", "arg_3", ")", "arg_7", "=", "arg_0", ".", "_calc_lm_step", "(", "arg_6", ",", "arg_1", ",", "arg_3", "=", "arg_3", ")", "if", "np", ".", "any", "(", "np", ".", "isnan", "(", "arg_7", ")", ")", ":", "CLOG", ".", "fatal", "(", "'Calculated steps have nans!?'", ")", "raise", "FloatingPointError", "(", "'Calculated steps have nans!?'", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None):\n        \"\"\"\n        Calculates LM updates, with or without the acceleration correction.\n\n        Parameters\n        ----------\n            grad : numpy.ndarray\n                The gradient of the model cost.\n            do_correct_damping : Bool, optional\n                If `self.use_accel`, then set to True to correct damping\n                if the acceleration correction is too big. Default is True\n                Does nothing is `self.use_accel` is False\n            subblock : slice, numpy.ndarray, or None, optional\n                Set to a slice or a valide numpy.ndarray to use only a\n                certain subset of the parameters. Default is None, i.e.\n                use all the parameters.\n\n        Returns\n        -------\n            delta : numpy.ndarray\n                The Levenberg-Marquadt step, relative to the old\n                parameters. Size is always self.param_vals.size.\n        \"\"\"\n        if arg_3 is not None:\n            if (arg_3.sum() == 0) or (arg_3.size == 0):\n                CLOG.fatal('Empty subblock in Func')\n                raise ValueError('Empty sub-block')\n            arg_4 = arg_0.J[arg_3]\n            arg_5 = np.dot(arg_4, arg_4.T)\n            arg_6 = arg_0._calc_damped_jtj(arg_5, arg_3=arg_3)\n            arg_1 = arg_1[arg_3]  #select the subblock of the grad\n        else:\n            arg_6 = arg_0._calc_damped_jtj(arg_0.JTJ, arg_3=arg_3)\n\n        arg_7 = arg_0._calc_lm_step(arg_6, arg_1, arg_3=arg_3)\n\n        if arg_0.use_accel:\n            arg_8 = arg_0.calc_accel_correction(arg_6, arg_7)\n            arg_9 = np.sqrt(np.sum(arg_7**2))\n            arg_10 = np.sqrt(np.sum(arg_8**2))\n            CLOG.debug('|correction| / |LM step|\\t%e' % (arg_10/arg_9))\n            if arg_10/arg_9 < arg_0.max_accel_correction:\n                arg_7 += arg_8\n            elif arg_2:\n                CLOG.debug('Untrustworthy step! Increasing damping...')\n                arg_0.increase_damping()\n                arg_6 = arg_0._calc_damped_jtj(arg_0.JTJ, arg_3=arg_3)\n                arg_7 = arg_0._calc_lm_step(arg_6, arg_1, arg_3=arg_3)\n\n        if np.any(np.isnan(arg_7)):\n            CLOG.fatal('Calculated steps have nans!?')\n            raise FloatingPointError('Calculated steps have nans!?')\n        return arg_7", "path": "peri/opt/optimize.py", "identifier": "LMEngine.find_LM_updates", "docstring": "Calculates LM updates, with or without the acceleration correction.\n\n        Parameters\n        ----------\n            grad : numpy.ndarray\n                The gradient of the model cost.\n            do_correct_damping : Bool, optional\n                If `self.use_accel`, then set to True to correct damping\n                if the acceleration correction is too big. Default is True\n                Does nothing is `self.use_accel` is False\n            subblock : slice, numpy.ndarray, or None, optional\n                Set to a slice or a valide numpy.ndarray to use only a\n                certain subset of the parameters. Default is None, i.e.\n                use all the parameters.\n\n        Returns\n        -------\n            delta : numpy.ndarray\n                The Levenberg-Marquadt step, relative to the old\n                parameters. Size is always self.param_vals.size.", "docstring_tokens": ["Calculates", "LM", "updates", "with", "or", "without", "the", "acceleration", "correction", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255325}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hgnc.py#L227-L234", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Delete the exons collection", "language": "python", "parameters": "(self, build=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "LOG", ".", "info", "(", "\"Dropping the exons collection, build %s\"", ",", "arg_1", ")", "arg_0", ".", "exon_collection", ".", "delete_many", "(", "{", "'build'", ":", "arg_1", "}", ")", "else", ":", "LOG", ".", "info", "(", "\"Dropping the exons collection\"", ")", "arg_0", ".", "exon_collection", ".", "drop", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Delete the exons collection\"\"\"\n        if arg_1:\n            LOG.info(\"Dropping the exons collection, build %s\", arg_1)\n            arg_0.exon_collection.delete_many({'build': arg_1})\n        else:\n            LOG.info(\"Dropping the exons collection\")\n            arg_0.exon_collection.drop()", "path": "scout/adapter/mongo/hgnc.py", "identifier": "GeneHandler.drop_exons", "docstring": "Delete the exons collection", "docstring_tokens": ["Delete", "the", "exons", "collection"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255326}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L309-L353", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return module sequence discovered from ``self.package_name``", "language": "python", "parameters": "(self)", "return_statement": "return sorted(modules)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_0", ".", "package_name", "]", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "os", ".", "walk", "(", "arg_0", ".", "root_path", ")", ":", "arg_5", "=", "arg_0", ".", "_path2uri", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "root_path", ",", "arg_2", ")", ")", "for", "arg_6", "in", "arg_3", "[", ":", "]", ":", "arg_7", "=", "'.'", ".", "join", "(", "(", "arg_5", ",", "arg_6", ")", ")", "if", "(", "arg_0", ".", "_uri2path", "(", "arg_7", ")", "and", "arg_0", ".", "_survives_exclude", "(", "arg_7", ",", "'package'", ")", ")", ":", "arg_1", ".", "append", "(", "arg_7", ")", "else", ":", "arg_3", ".", "remove", "(", "arg_6", ")", "for", "arg_8", "in", "arg_4", ":", "arg_9", "=", "arg_8", "[", ":", "-", "3", "]", "arg_10", "=", "'.'", ".", "join", "(", "(", "arg_5", ",", "arg_9", ")", ")", "if", "(", "arg_0", ".", "_uri2path", "(", "arg_10", ")", "and", "arg_0", ".", "_survives_exclude", "(", "arg_10", ",", "'module'", ")", ")", ":", "arg_1", ".", "append", "(", "arg_10", ")", "return", "sorted", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        ''' Return module sequence discovered from ``self.package_name`` \n\n\n        Parameters\n        ----------\n        None\n\n        Returns\n        -------\n        mods : sequence\n            Sequence of module names within ``self.package_name``\n\n        Examples\n        --------\n        >>> dw = ApiDocWriter('sphinx')\n        >>> mods = dw.Func()\n        >>> 'sphinx.util' in mods\n        True\n        >>> dw.package_skip_patterns.append('\\.util$')\n        >>> 'sphinx.util' in dw.Func()\n        False\n        >>> \n        '''\n        arg_1 = [arg_0.package_name]\n        # raw directory parsing\n        for arg_2, arg_3, arg_4 in os.walk(arg_0.root_path):\n            # Check directory names for packages\n            arg_5 = arg_0._path2uri(os.path.join(arg_0.root_path,\n                                                   arg_2))\n            for arg_6 in arg_3[:]: # copy list - we modify inplace\n                arg_7 = '.'.join((arg_5, arg_6))\n                if (arg_0._uri2path(arg_7) and\n                    arg_0._survives_exclude(arg_7, 'package')):\n                    arg_1.append(arg_7)\n                else:\n                    arg_3.remove(arg_6)\n            # Check filenames for modules\n            for arg_8 in arg_4:\n                arg_9 = arg_8[:-3]\n                arg_10 = '.'.join((arg_5, arg_9))\n                if (arg_0._uri2path(arg_10) and\n                    arg_0._survives_exclude(arg_10, 'module')):\n                    arg_1.append(arg_10)\n        return sorted(arg_1)", "path": "h2o-docs/src/product/sphinxext/apigen.py", "identifier": "ApiDocWriter.discover_modules", "docstring": "Return module sequence discovered from ``self.package_name`` \n\n\n        Parameters\n        ----------\n        None\n\n        Returns\n        -------\n        mods : sequence\n            Sequence of module names within ``self.package_name``\n\n        Examples\n        --------\n        >>> dw = ApiDocWriter('sphinx')\n        >>> mods = dw.discover_modules()\n        >>> 'sphinx.util' in mods\n        True\n        >>> dw.package_skip_patterns.append('\\.util$')\n        >>> 'sphinx.util' in dw.discover_modules()\n        False\n        >>>", "docstring_tokens": ["Return", "module", "sequence", "discovered", "from", "self", ".", "package_name"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255327}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L134-L138", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "Returns domain name portion of a URL", "language": "python", "parameters": "(url)", "return_statement": "return urllib.parse.urlparse(url).hostname", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'http'", "not", "in", "arg_0", ".", "lower", "(", ")", ":", "arg_0", "=", "'http://{}'", ".", "format", "(", "arg_0", ")", "return", "urllib", ".", "parse", ".", "urlparse", "(", "arg_0", ")", ".", "hostname"], "function": "def Func(arg_0):\n    \"\"\" Returns domain name portion of a URL \"\"\"\n    if 'http' not in arg_0.lower():\n        arg_0 = 'http://{}'.format(arg_0)\n    return urllib.parse.urlparse(arg_0).hostname", "path": "toolware/utils/generic.py", "identifier": "get_domain", "docstring": "Returns domain name portion of a URL", "docstring_tokens": ["Returns", "domain", "name", "portion", "of", "a", "URL"], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 255328}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py#L239-L254", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Parse a HTML fragment into a well-formed tree fragment", "language": "python", "parameters": "(self, stream, container=\"div\", encoding=None,\n                      parseMeta=False, useChardet=True)", "return_statement": "return self.tree.getFragment()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"div\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "True", ")", ":", "arg_0", ".", "_parse", "(", "arg_1", ",", "True", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "arg_0", ".", "tree", ".", "getFragment", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=\"div\", arg_3=None,\n                      arg_4=False, arg_5=True):\n        \"\"\"Parse a HTML fragment into a well-formed tree fragment\n\n        container - name of the element we're setting the innerHTML property\n        if set to None, default to 'div'\n\n        stream - a filelike object or string containing the HTML to be parsed\n\n        The optional encoding parameter must be a string that indicates\n        the encoding.  If specified, that encoding will be used,\n        regardless of any BOM or later declaration (such as in a meta\n        element)\n        \"\"\"\n        arg_0._parse(arg_1, True, arg_2=arg_2, arg_3=arg_3)\n        return arg_0.tree.getFragment()", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py", "identifier": "HTMLParser.parseFragment", "docstring": "Parse a HTML fragment into a well-formed tree fragment\n\n        container - name of the element we're setting the innerHTML property\n        if set to None, default to 'div'\n\n        stream - a filelike object or string containing the HTML to be parsed\n\n        The optional encoding parameter must be a string that indicates\n        the encoding.  If specified, that encoding will be used,\n        regardless of any BOM or later declaration (such as in a meta\n        element)", "docstring_tokens": ["Parse", "a", "HTML", "fragment", "into", "a", "well", "-", "formed", "tree", "fragment"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255329}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/states.py#L761-L768", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Update various internal variables from a model update from oldmodel to\n        newmodel for the tile `tile`", "language": "python", "parameters": "(self, oldmodel, newmodel, tile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "_loglikelihood", "-=", "arg_0", ".", "_calc_loglikelihood", "(", "arg_1", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_loglikelihood", "+=", "arg_0", ".", "_calc_loglikelihood", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_residuals", "[", "arg_3", ".", "slicer", "]", "=", "arg_0", ".", "_data", "[", "arg_3", ".", "slicer", "]", "-", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Update various internal variables from a model update from oldmodel to\n        newmodel for the tile `tile`\n        \"\"\"\n        arg_0._loglikelihood -= arg_0._calc_loglikelihood(arg_1, arg_3=arg_3)\n        arg_0._loglikelihood += arg_0._calc_loglikelihood(arg_2, arg_3=arg_3)\n        arg_0._residuals[arg_3.slicer] = arg_0._data[arg_3.slicer] - arg_2", "path": "peri/states.py", "identifier": "ImageState.update_from_model_change", "docstring": "Update various internal variables from a model update from oldmodel to\n        newmodel for the tile `tile`", "docstring_tokens": ["Update", "various", "internal", "variables", "from", "a", "model", "update", "from", "oldmodel", "to", "newmodel", "for", "the", "tile", "tile"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255330}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/update/disease.py#L25-L52", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update disease terms in mongo database.", "language": "python", "parameters": "(context, api_key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_1", "=", "arg_1", "or", "arg_0", ".", "obj", ".", "get", "(", "'omim_api_key'", ")", "if", "not", "arg_1", ":", "LOG", ".", "warning", "(", "\"Please provide a omim api key to load the omim gene panel\"", ")", "arg_0", ".", "abort", "(", ")", "try", ":", "arg_3", "=", "fetch_mim_files", "(", "arg_1", ",", "genemap2", "=", "True", ")", "except", "Exception", "as", "err", ":", "LOG", ".", "warning", "(", "err", ")", "arg_0", ".", "abort", "(", ")", "LOG", ".", "info", "(", "\"Dropping DiseaseTerms\"", ")", "arg_2", ".", "disease_term_collection", ".", "drop", "(", ")", "LOG", ".", "debug", "(", "\"DiseaseTerms dropped\"", ")", "load_disease_terms", "(", "arg_2", "=", "arg_2", ",", "genemap_lines", "=", "arg_3", "[", "'genemap2'", "]", ",", ")", "LOG", ".", "info", "(", "\"Successfully loaded all disease terms\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Update disease terms in mongo database.\n    \"\"\"\n    arg_2 = arg_0.obj['adapter']\n    \n    # Fetch the omim information\n    arg_1 = arg_1 or arg_0.obj.get('omim_api_key')\n    if not arg_1:\n        LOG.warning(\"Please provide a omim api key to load the omim gene panel\")\n        arg_0.abort()\n\n    try:\n        arg_3 = fetch_mim_files(arg_1, genemap2=True)\n    except Exception as err:\n        LOG.warning(err)\n        arg_0.abort()\n    \n    LOG.info(\"Dropping DiseaseTerms\")\n    arg_2.disease_term_collection.drop()\n    LOG.debug(\"DiseaseTerms dropped\")\n\n    load_disease_terms(\n        arg_2=arg_2,\n        genemap_lines=arg_3['genemap2'], \n    )\n\n    LOG.info(\"Successfully loaded all disease terms\")", "path": "scout/commands/update/disease.py", "identifier": "diseases", "docstring": "Update disease terms in mongo database.", "docstring_tokens": ["Update", "disease", "terms", "in", "mongo", "database", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255331}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/remote.py#L564-L569", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "basic support for evaluate at server, at least to run some unittest, do not expect this to work from strings", "language": "python", "parameters": "(self, expression, i1=None, i2=None, out=None, selection=None, delay=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "arg_1", "=", "_ensure_strings_from_expressions", "(", "arg_1", ")", "arg_7", "=", "arg_0", ".", "server", ".", "_call_dataset", "(", "\"Func\"", ",", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None, arg_6=False):\n        arg_1 = _ensure_strings_from_expressions(arg_1)\n        \"\"\"basic support for Func at server, at least to run some unittest, do not expect this to work from strings\"\"\"\n        arg_7 = arg_0.server._call_dataset(\"Func\", arg_0, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_5=arg_5, arg_6=arg_6)\n        # TODO: we ignore out\n        return arg_7", "path": "packages/vaex-core/vaex/remote.py", "identifier": "DatasetRest.evaluate", "docstring": "basic support for evaluate at server, at least to run some unittest, do not expect this to work from strings", "docstring_tokens": ["basic", "support", "for", "evaluate", "at", "server", "at", "least", "to", "run", "some", "unittest", "do", "not", "expect", "this", "to", "work", "from", "strings"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 255332}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L152-L170", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Regenerates the primary or secondary access key for the specified\n        storage account.", "language": "python", "parameters": "(self, service_name, key_type)", "return_statement": "return self._perform_post(\n            self._get_storage_service_path(\n                service_name) + '/keys?action=regenerate',\n            _XmlSerializer.regenerate_keys_to_xml(\n                key_type),\n            StorageService)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'key_type'", ",", "arg_2", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_storage_service_path", "(", "arg_1", ")", "+", "'/keys?action=regenerate'", ",", "_XmlSerializer", ".", "regenerate_keys_to_xml", "(", "arg_2", ")", ",", "StorageService", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Regenerates the primary or secondary access key for the specified\n        storage account.\n\n        service_name:\n            Name of the storage service account.\n        key_type:\n            Specifies which key to regenerate. Valid values are:\n            Primary, Secondary\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('key_type', arg_2)\n        return arg_0._perform_post(\n            arg_0._get_storage_service_path(\n                arg_1) + '/keys?action=regenerate',\n            _XmlSerializer.regenerate_keys_to_xml(\n                arg_2),\n            StorageService)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.regenerate_storage_account_keys", "docstring": "Regenerates the primary or secondary access key for the specified\n        storage account.\n\n        service_name:\n            Name of the storage service account.\n        key_type:\n            Specifies which key to regenerate. Valid values are:\n            Primary, Secondary", "docstring_tokens": ["Regenerates", "the", "primary", "or", "secondary", "access", "key", "for", "the", "specified", "storage", "account", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255333}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L149-L161", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "Registers a new job or updates an existing job", "language": "python", "parameters": "(self, id, job)", "return_statement": "return self.request(id, json=job, method=\"post\").json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "request", "(", "arg_1", ",", "json", "=", "arg_2", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Registers a new job or updates an existing job\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        return arg_0.request(arg_1, json=arg_2, method=\"post\").json()", "path": "nomad/api/job.py", "identifier": "Job.register_job", "docstring": "Registers a new job or updates an existing job\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["Registers", "a", "new", "job", "or", "updates", "an", "existing", "job"], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 255334}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L949-L960", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Return card info.", "language": "python", "parameters": "(self, resource_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "baseId", "(", "arg_1", ")", "if", "arg_2", "in", "arg_0", ".", "players", ":", "return", "arg_0", ".", "players", "[", "arg_2", "]", "else", ":", "arg_3", "=", "'{0}{1}.json'", ".", "format", "(", "card_info_url", ",", "arg_2", ")", "return", "requests", ".", "get", "(", "arg_3", ",", "timeout", "=", "arg_0", ".", "timeout", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return card info.\n\n        :params resource_id: Resource id.\n        \"\"\"\n        # TODO: add referer to headers (futweb)\n        arg_2 = baseId(arg_1)\n        if arg_2 in arg_0.players:\n            return arg_0.players[arg_2]\n        else:  # not a player?\n            arg_3 = '{0}{1}.json'.format(card_info_url, arg_2)\n            return requests.get(arg_3, timeout=arg_0.timeout).json()", "path": "fut/core.py", "identifier": "Core.cardInfo", "docstring": "Return card info.\n\n        :params resource_id: Resource id.", "docstring_tokens": ["Return", "card", "info", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 255335}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/special_alerts.py#L482-L500", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Delete the specified InactivityAlert", "language": "python", "parameters": "(self, tag_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'https://logentries.com/rest/{account_id}/api/tags/{tag_id}'", "arg_0", ".", "_api_Func", "(", "url", "=", "arg_2", ".", "format", "(", "account_id", "=", "arg_0", ".", "account_id", ",", "arg_1", "=", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Delete the specified InactivityAlert\n\n        :param tag_id: The tag ID to Func\n        :type tag_id: str\n\n        :raises: This will raise a\n            :class:`ServerException <logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries\n        \"\"\"\n        arg_2 = 'https://logentries.com/rest/{account_id}/api/tags/{tag_id}'\n\n        arg_0._api_Func(\n            url=arg_2.format(\n                account_id=arg_0.account_id,\n                arg_1=arg_1\n            )\n        )", "path": "logentries_api/special_alerts.py", "identifier": "InactivityAlert.delete", "docstring": "Delete the specified InactivityAlert\n\n        :param tag_id: The tag ID to delete\n        :type tag_id: str\n\n        :raises: This will raise a\n            :class:`ServerException <logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries", "docstring_tokens": ["Delete", "the", "specified", "InactivityAlert"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 255336}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L60-L66", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Create profile stats file and load profiler.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "available", "(", ")", ":", "return", "arg_0", ".", "_create_pfile", "(", ")", "arg_0", ".", "prof", "=", "hotshot", ".", "Profile", "(", "arg_0", ".", "pfile", ")"], "function": "def Func(arg_0):\n        \"\"\"Create profile stats file and load profiler.\n        \"\"\"\n        if not arg_0.available():\n            return\n        arg_0._create_pfile()\n        arg_0.prof = hotshot.Profile(arg_0.pfile)", "path": "environment/lib/python2.7/site-packages/nose/plugins/prof.py", "identifier": "Profile.begin", "docstring": "Create profile stats file and load profiler.", "docstring_tokens": ["Create", "profile", "stats", "file", "and", "load", "profiler", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255337}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/gene.py#L218-L277", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Removes the association", "language": "python", "parameters": "(self, model=None,\n                          make_dependent_reactions_nonfunctional=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ")", ":", "warn", "(", "\"Use cobra.manipulation.remove_genes instead\"", ")", "if", "arg_1", "is", "not", "None", ":", "if", "arg_1", "!=", "arg_0", ".", "_model", ":", "raise", "Exception", "(", "\"%s is a member of %s, not %s\"", "%", "(", "repr", "(", "arg_0", ")", ",", "repr", "(", "arg_0", ".", "_model", ")", ",", "repr", "(", "arg_1", ")", ")", ")", "if", "arg_0", ".", "_model", "is", "None", ":", "raise", "Exception", "(", "'%s is not in a model'", "%", "repr", "(", "arg_0", ")", ")", "if", "arg_2", ":", "arg_3", "=", "'False'", "else", ":", "arg_3", "=", "'True'", "arg_4", "=", "re", ".", "compile", "(", "'(^|(?<=( |\\()))%s(?=( |\\)|$))'", "%", "re", ".", "escape", "(", "arg_0", ".", "id", ")", ")", "arg_5", "=", "arg_0", ".", "_model", ".", "get_associated_groups", "(", "arg_0", ")", "for", "arg_6", "in", "arg_5", ":", "arg_6", ".", "remove_members", "(", "arg_0", ")", "arg_0", ".", "_model", ".", "genes", ".", "remove", "(", "arg_0", ")", "arg_0", ".", "_model", "=", "None", "for", "arg_8", "in", "list", "(", "arg_0", ".", "_reaction", ")", ":", "arg_8", ".", "_gene_reaction_rule", "=", "arg_4", ".", "sub", "(", "arg_3", ",", "arg_8", ".", "gene_reaction_rule", ")", "arg_8", ".", "_genes", ".", "remove", "(", "arg_0", ")", "arg_10", "=", "arg_8", ".", "gene_reaction_rule", "for", "arg_11", "in", "arg_8", ".", "_genes", ":", "arg_12", "=", "re", ".", "compile", "(", "'(^|(?<=( |\\()))%s(?=( |\\)|$))'", "%", "re", ".", "escape", "(", "arg_11", ".", "id", ")", ")", "arg_10", "=", "arg_12", ".", "sub", "(", "'True'", ",", "arg_10", ")", "if", "not", "eval", "(", "arg_10", ")", ":", "arg_8", ".", "lower_bound", "=", "0", "arg_8", ".", "upper_bound", "=", "0", "arg_0", ".", "_reaction", ".", "clear", "(", ")"], "function": "def Func(arg_0, arg_1=None,\n                          arg_2=True):\n        \"\"\"Removes the association\n\n        Parameters\n        ----------\n        model : cobra model\n           The model to remove the gene from\n        make_dependent_reactions_nonfunctional : bool\n           If True then replace the gene with 'False' in the gene\n           association, else replace the gene with 'True'\n\n\n        .. deprecated :: 0.4\n            Use cobra.manipulation.delete_model_genes to simulate knockouts\n            and cobra.manipulation.remove_genes to remove genes from\n            the model.\n\n        \"\"\"\n        warn(\"Use cobra.manipulation.remove_genes instead\")\n        if arg_1 is not None:\n            if arg_1 != arg_0._model:\n                raise Exception(\"%s is a member of %s, not %s\" %\n                                (repr(arg_0), repr(arg_0._model), repr(arg_1)))\n        if arg_0._model is None:\n            raise Exception('%s is not in a model' % repr(arg_0))\n\n        if arg_2:\n            arg_3 = 'False'\n        else:\n            arg_3 = 'True'\n        arg_4 = re.compile('(^|(?<=( |\\()))%s(?=( |\\)|$))' %\n                                 re.escape(arg_0.id))\n\n        # remove reference to the gene in all groups\n        arg_5 = arg_0._model.get_associated_groups(arg_0)\n        for arg_6 in arg_5:\n            arg_6.remove_members(arg_0)\n\n        arg_0._model.genes.remove(arg_0)\n        arg_0._model = None\n\n        for arg_8 in list(arg_0._reaction):\n            arg_8._gene_reaction_rule = arg_4.sub(\n                arg_3, arg_8.gene_reaction_rule)\n            arg_8._genes.remove(arg_0)\n            # Now, deactivate the reaction if its gene association evaluates\n            # to False\n            arg_10 = arg_8.gene_reaction_rule\n            for arg_11 in arg_8._genes:\n                arg_12 = re.compile('(^|(?<=( |\\()))%s(?=( |\\)|$))' %\n                                           re.escape(arg_11.id))\n                arg_10 = arg_12.sub(\n                    'True',\n                    arg_10)\n\n            if not eval(arg_10):\n                arg_8.lower_bound = 0\n                arg_8.upper_bound = 0\n        arg_0._reaction.clear()", "path": "cobra/core/gene.py", "identifier": "Gene.remove_from_model", "docstring": "Removes the association\n\n        Parameters\n        ----------\n        model : cobra model\n           The model to remove the gene from\n        make_dependent_reactions_nonfunctional : bool\n           If True then replace the gene with 'False' in the gene\n           association, else replace the gene with 'True'\n\n\n        .. deprecated :: 0.4\n            Use cobra.manipulation.delete_model_genes to simulate knockouts\n            and cobra.manipulation.remove_genes to remove genes from\n            the model.", "docstring_tokens": ["Removes", "the", "association"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255338}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/transport.py#L255-L274", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Bind the server unless it is already bound, this is a read-only node, or the last attempt was too recently.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_ready", "or", "arg_0", ".", "_selfIsReadonlyNode", "or", "time", ".", "time", "(", ")", "<", "arg_0", ".", "_lastBindAttemptTime", "+", "arg_0", ".", "_syncObj", ".", "conf", ".", "bindRetryTime", ":", "return", "arg_0", ".", "_lastBindAttemptTime", "=", "time", ".", "time", "(", ")", "try", ":", "arg_0", ".", "_server", ".", "bind", "(", ")", "except", "Exception", "as", "e", ":", "arg_0", ".", "_bindAttempts", "+=", "1", "if", "arg_0", ".", "_syncObj", ".", "conf", ".", "maxBindRetries", "and", "arg_0", ".", "_bindAttempts", ">=", "arg_0", ".", "_syncObj", ".", "conf", ".", "maxBindRetries", ":", "arg_0", ".", "_bindOverEvent", ".", "set", "(", ")", "raise", "TransportNotReadyError", "else", ":", "arg_0", ".", "_ready", "=", "True", "arg_0", ".", "_bindOverEvent", ".", "set", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Bind the server unless it is already bound, this is a read-only node, or the last attempt was too recently.\n\n        :raises TransportNotReadyError if the bind attempt fails\n        \"\"\"\n\n        if arg_0._ready or arg_0._selfIsReadonlyNode or time.time() < arg_0._lastBindAttemptTime + arg_0._syncObj.conf.bindRetryTime:\n            return\n        arg_0._lastBindAttemptTime = time.time()\n        try:\n            arg_0._server.bind()\n        except Exception as e:\n            arg_0._bindAttempts += 1\n            if arg_0._syncObj.conf.maxBindRetries and arg_0._bindAttempts >= arg_0._syncObj.conf.maxBindRetries:\n                arg_0._bindOverEvent.set()\n                raise TransportNotReadyError\n        else:\n            arg_0._ready = True\n            arg_0._bindOverEvent.set()", "path": "pysyncobj/transport.py", "identifier": "TCPTransport._maybeBind", "docstring": "Bind the server unless it is already bound, this is a read-only node, or the last attempt was too recently.\n\n        :raises TransportNotReadyError if the bind attempt fails", "docstring_tokens": ["Bind", "the", "server", "unless", "it", "is", "already", "bound", "this", "is", "a", "read", "-", "only", "node", "or", "the", "last", "attempt", "was", "too", "recently", "."], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 255339}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L158-L172", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Retrive an user with a spotify ID.", "language": "python", "parameters": "(self, spotify_id: str)", "return_statement": "return User(self, data)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "User", ":", "arg_3", "=", "await", "arg_0", ".", "http", ".", "user", "(", "to_id", "(", "arg_1", ")", ")", "return", "User", "(", "arg_0", ",", "arg_3", ")"], "function": "async def Func(arg_0, arg_1: arg_2) -> User:\n        \"\"\"Retrive an user with a spotify ID.\n\n        Parameters\n        ----------\n        spotify_id : str\n            The ID to search for.\n\n        Returns\n        -------\n        user : User\n            The user from the ID\n        \"\"\"\n        arg_3 = await arg_0.http.user(to_id(arg_1))\n        return User(arg_0, arg_3)", "path": "spotify/client.py", "identifier": "Client.get_user", "docstring": "Retrive an user with a spotify ID.\n\n        Parameters\n        ----------\n        spotify_id : str\n            The ID to search for.\n\n        Returns\n        -------\n        user : User\n            The user from the ID", "docstring_tokens": ["Retrive", "an", "user", "with", "a", "spotify", "ID", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 255340}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L742-L793", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Calculates various bootstrapped performance metrics of a strategy.", "language": "python", "parameters": "(returns, factor_returns=None, return_stats=True,\n                         **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ",", "**", "arg_3", ")", ":", "arg_4", "=", "OrderedDict", "(", ")", "for", "arg_5", "in", "SIMPLE_STAT_FUNCS", ":", "arg_6", "=", "STAT_FUNC_NAMES", "[", "arg_5", ".", "__name__", "]", "arg_4", "[", "arg_6", "]", "=", "calc_bootstrap", "(", "arg_5", ",", "arg_0", ")", "if", "arg_1", "is", "not", "None", ":", "for", "arg_5", "in", "FACTOR_STAT_FUNCS", ":", "arg_6", "=", "STAT_FUNC_NAMES", "[", "arg_5", ".", "__name__", "]", "arg_4", "[", "arg_6", "]", "=", "calc_bootstrap", "(", "arg_5", ",", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "arg_4", ")", "if", "arg_2", ":", "arg_7", "=", "arg_4", ".", "apply", "(", "calc_distribution_stats", ")", "return", "arg_7", ".", "T", "[", "[", "'mean'", ",", "'median'", ",", "'5%'", ",", "'95%'", "]", "]", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=True,\n                         **arg_3):\n    \"\"\"Calculates various bootstrapped performance metrics of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n         - If None, do not compute alpha, beta, and information ratio.\n    return_stats : boolean (optional)\n        If True, returns a DataFrame of mean, median, 5 and 95 percentiles\n        for each perf metric.\n        If False, returns a DataFrame with the bootstrap samples for\n        each perf metric.\n\n    Returns\n    -------\n    pd.DataFrame\n        if return_stats is True:\n        - Distributional statistics of bootstrapped sampling\n        distribution of performance metrics.\n        if return_stats is False:\n        - Bootstrap samples for each performance metric.\n    \"\"\"\n\n    arg_4 = OrderedDict()\n\n    for arg_5 in SIMPLE_STAT_FUNCS:\n        arg_6 = STAT_FUNC_NAMES[arg_5.__name__]\n        arg_4[arg_6] = calc_bootstrap(arg_5,\n                                                     arg_0)\n\n    if arg_1 is not None:\n        for arg_5 in FACTOR_STAT_FUNCS:\n            arg_6 = STAT_FUNC_NAMES[arg_5.__name__]\n            arg_4[arg_6] = calc_bootstrap(\n                arg_5,\n                arg_0,\n                arg_1=arg_1)\n\n    arg_4 = pd.DataFrame(arg_4)\n\n    if arg_2:\n        arg_7 = arg_4.apply(calc_distribution_stats)\n        return arg_7.T[['mean', 'median', '5%', '95%']]\n    else:\n        return arg_4", "path": "pyfolio/timeseries.py", "identifier": "perf_stats_bootstrap", "docstring": "Calculates various bootstrapped performance metrics of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n         - If None, do not compute alpha, beta, and information ratio.\n    return_stats : boolean (optional)\n        If True, returns a DataFrame of mean, median, 5 and 95 percentiles\n        for each perf metric.\n        If False, returns a DataFrame with the bootstrap samples for\n        each perf metric.\n\n    Returns\n    -------\n    pd.DataFrame\n        if return_stats is True:\n        - Distributional statistics of bootstrapped sampling\n        distribution of performance metrics.\n        if return_stats is False:\n        - Bootstrap samples for each performance metric.", "docstring_tokens": ["Calculates", "various", "bootstrapped", "performance", "metrics", "of", "a", "strategy", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255341}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L413-L427", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Return the minimum of the array over the given axis.", "language": "python", "parameters": "(self, axis=None, keepdims=False)", "return_statement": "return self._stat(axis, func=minimum, keepdims=keepdims)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "from", "numpy", "import", "Funcimum", "return", "arg_0", ".", "_stat", "(", "arg_1", ",", "func", "=", "Funcimum", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"\n        Return the Funcimum of the array over the given axis.\n\n        Parameters\n        ----------\n        axis : tuple or int, optional, default=None\n            Axis to compute statistic over, if None\n            will compute over all axes\n\n        keepdims : boolean, optional, default=False\n            Keep axis remaining after operation with size 1.\n        \"\"\"\n        from numpy import Funcimum\n        return arg_0._stat(arg_1, func=Funcimum, arg_2=arg_2)", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark.min", "docstring": "Return the minimum of the array over the given axis.\n\n        Parameters\n        ----------\n        axis : tuple or int, optional, default=None\n            Axis to compute statistic over, if None\n            will compute over all axes\n\n        keepdims : boolean, optional, default=False\n            Keep axis remaining after operation with size 1.", "docstring_tokens": ["Return", "the", "minimum", "of", "the", "array", "over", "the", "given", "axis", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 255342}
{"url": "https://github.com/bmcfee/muda/blob/ff82efdfaeb98da0a9f9124845826eb20536a9ba/muda/core.py#L68-L119", "sha": "ff82efdfaeb98da0a9f9124845826eb20536a9ba", "docstring_summary": "Load a jam and pack it with audio.", "language": "python", "parameters": "(jam_in, audio_file,\n                   validate=True,\n                   strict=True,\n                   fmt='auto',\n                   **kwargs)", "return_statement": "return jam_pack(jam, _audio=dict(y=y, sr=sr))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ",", "arg_4", "=", "'auto'", ",", "**", "arg_5", ")", ":", "if", "isinstance", "(", "arg_0", ",", "jams", ".", "JAMS", ")", ":", "arg_6", "=", "arg_0", "else", ":", "arg_6", "=", "jams", ".", "load", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_7", ",", "arg_8", "=", "librosa", ".", "load", "(", "arg_1", ",", "**", "arg_5", ")", "if", "arg_6", ".", "file_metadata", ".", "duration", "is", "None", ":", "arg_6", ".", "file_metadata", ".", "duration", "=", "librosa", ".", "get_duration", "(", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", "return", "jam_pack", "(", "arg_6", ",", "_audio", "=", "dict", "(", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", ")"], "function": "def Func(arg_0, arg_1,\n                   arg_2=True,\n                   arg_3=True,\n                   arg_4='auto',\n                   **arg_5):\n    '''Load a jam and pack it with audio.\n\n    Parameters\n    ----------\n    jam_in : str, file descriptor, or jams.JAMS\n        JAMS filename, open file-descriptor, or object to load.\n        See ``jams.load`` for acceptable formats.\n\n    audio_file : str\n        Audio filename to load\n\n    validate : bool\n    strict : bool\n    fmt : str\n        Parameters to `jams.load`\n\n    kwargs : additional keyword arguments\n        See `librosa.load`\n\n    Returns\n    -------\n    jam : jams.JAMS\n        A jams object with audio data in the top-level sandbox\n\n    Notes\n    -----\n    This operation can modify the `file_metadata.duration` field of `jam_in`:\n    If it is not currently set, it will be populated with the duration of the\n    audio file.\n\n    See Also\n    --------\n    jams.load\n    librosa.core.load\n    '''\n\n    if isinstance(arg_0, jams.JAMS):\n        arg_6 = arg_0\n    else:\n        arg_6 = jams.load(arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)\n\n    arg_7, arg_8 = librosa.load(arg_1, **arg_5)\n\n    if arg_6.file_metadata.duration is None:\n        arg_6.file_metadata.duration = librosa.get_duration(arg_7=arg_7, arg_8=arg_8)\n\n    return jam_pack(arg_6, _audio=dict(arg_7=arg_7, arg_8=arg_8))", "path": "muda/core.py", "identifier": "load_jam_audio", "docstring": "Load a jam and pack it with audio.\n\n    Parameters\n    ----------\n    jam_in : str, file descriptor, or jams.JAMS\n        JAMS filename, open file-descriptor, or object to load.\n        See ``jams.load`` for acceptable formats.\n\n    audio_file : str\n        Audio filename to load\n\n    validate : bool\n    strict : bool\n    fmt : str\n        Parameters to `jams.load`\n\n    kwargs : additional keyword arguments\n        See `librosa.load`\n\n    Returns\n    -------\n    jam : jams.JAMS\n        A jams object with audio data in the top-level sandbox\n\n    Notes\n    -----\n    This operation can modify the `file_metadata.duration` field of `jam_in`:\n    If it is not currently set, it will be populated with the duration of the\n    audio file.\n\n    See Also\n    --------\n    jams.load\n    librosa.core.load", "docstring_tokens": ["Load", "a", "jam", "and", "pack", "it", "with", "audio", "."], "nwo": "bmcfee/muda", "score": 0.6916969030525102, "idx": 255343}
{"url": "https://github.com/zeeto/pyzlog/blob/c26d680bec04f9edd57ed5be733cae43ec828107/pyzlog/__init__.py#L173-L210", "sha": "c26d680bec04f9edd57ed5be733cae43ec828107", "docstring_summary": "formats a logging.Record into a standard json log entry", "language": "python", "parameters": "(self, record)", "return_statement": "return json.dumps(defaults, default=self.json_default)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "__dict__", ".", "copy", "(", ")", "arg_0", ".", "_set_exc_info", "(", "arg_2", ")", "arg_3", "=", "'default'", "if", "arg_2", ".", "get", "(", "'event_name'", ")", ":", "arg_3", "=", "arg_2", ".", "pop", "(", "'event_name'", ")", "arg_4", "=", "'INFO'", "if", "arg_2", ".", "get", "(", "'log_level'", ")", ":", "arg_4", "=", "arg_2", ".", "pop", "(", "'log_level'", ")", "[", "arg_2", ".", "pop", "(", "arg_5", ")", "for", "arg_5", "in", "arg_2", ".", "keys", "(", ")", "if", "arg_5", "not", "in", "arg_0", ".", "fields", "]", "arg_6", "=", "arg_0", ".", "defaults", ".", "copy", "(", ")", "arg_7", "=", "arg_0", ".", "fields", ".", "copy", "(", ")", "arg_7", ".", "update", "(", "arg_2", ")", "arg_8", "=", "{", "}", "for", "arg_5", ",", "arg_9", "in", "arg_7", ".", "iteritems", "(", ")", ":", "if", "arg_9", "is", "not", "None", ":", "arg_8", "[", "arg_5", "]", "=", "arg_9", "arg_6", ".", "update", "(", "{", "'event_timestamp'", ":", "arg_0", ".", "_get_now", "(", ")", ",", "'event_name'", ":", "arg_3", ",", "'log_level'", ":", "arg_4", ",", "'fields'", ":", "arg_8", "}", ")", "return", "json", ".", "dumps", "(", "arg_6", ",", "default", "=", "arg_0", ".", "json_default", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Funcs a logging.Record into a standard json log entry\n\n        :param record: record to be Functed\n        :type record: logging.Record\n        :return: the Functed json string\n        :rtype: string\n        \"\"\"\n\n        arg_2 = arg_1.__dict__.copy()\n        arg_0._set_exc_info(arg_2)\n\n        arg_3 = 'default'\n        if arg_2.get('event_name'):\n            arg_3 = arg_2.pop('event_name')\n\n        arg_4 = 'INFO'\n        if arg_2.get('log_level'):\n            arg_4 = arg_2.pop('log_level')\n\n        [arg_2.pop(arg_5) for arg_5 in arg_2.keys()\n         if arg_5 not in arg_0.fields]\n\n        arg_6 = arg_0.defaults.copy()\n        arg_7 = arg_0.fields.copy()\n        arg_7.update(arg_2)\n        arg_8 = {}\n        for arg_5, arg_9 in arg_7.iteritems():\n            if arg_9 is not None:\n                arg_8[arg_5] = arg_9\n\n        arg_6.update({\n            'event_timestamp': arg_0._get_now(),\n            'event_name': arg_3,\n            'log_level': arg_4,\n            'fields': arg_8})\n\n        return json.dumps(arg_6, default=arg_0.json_default)", "path": "pyzlog/__init__.py", "identifier": "JsonFormatter.format", "docstring": "formats a logging.Record into a standard json log entry\n\n        :param record: record to be formatted\n        :type record: logging.Record\n        :return: the formatted json string\n        :rtype: string", "docstring_tokens": ["formats", "a", "logging", ".", "Record", "into", "a", "standard", "json", "log", "entry"], "nwo": "zeeto/pyzlog", "score": 0.0, "idx": 255344}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1159-L1232", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Get a list representation of repository state along with useful\n        information. List state is ordered relativeley to directories level", "language": "python", "parameters": "(self, relaPath=None)", "return_statement": "return state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "[", "]", "def", "_walk_dir", "(", "arg_1", ",", "arg_3", ")", ":", "arg_4", "=", "{", "'type'", ":", "'dir'", ",", "'exists'", ":", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_1", ")", ")", ",", "'pyrepdirinfo'", ":", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_1", ",", "arg_0", ".", "__dirInfo", ")", ")", ",", "}", "arg_2", ".", "append", "(", "{", "arg_1", ":", "arg_4", "}", ")", "for", "arg_5", "in", "sorted", "(", "[", "f", "for", "f", "in", "arg_3", "if", "isinstance", "(", "f", ",", "basestring", ")", "]", ")", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_5", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_6", ")", "arg_8", "=", "{", "'type'", ":", "'file'", ",", "'exists'", ":", "os", ".", "path", ".", "isfile", "(", "arg_7", ")", ",", "'pyrepfileinfo'", ":", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_1", ",", "arg_0", ".", "__fileInfo", "%", "arg_5", ")", ")", ",", "}", "arg_2", ".", "append", "(", "{", "arg_6", ":", "arg_8", "}", ")", "for", "arg_9", "in", "sorted", "(", "[", "d", "for", "d", "in", "arg_3", "if", "isinstance", "(", "d", ",", "dict", ")", "]", ",", "key", "=", "lambda", "k", ":", "list", "(", "k", ")", "[", "0", "]", ")", ":", "arg_10", "=", "list", "(", "arg_9", ")", "[", "0", "]", "_walk_dir", "(", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_10", ")", ",", "arg_3", "=", "arg_9", "[", "arg_10", "]", ")", "if", "arg_1", "is", "None", ":", "_walk_dir", "(", "arg_1", "=", "''", ",", "arg_3", "=", "arg_0", ".", "__repo", "[", "'walk_repo'", "]", ")", "else", ":", "assert", "isinstance", "(", "arg_1", ",", "basestring", ")", ",", "\"relaPath must be None or a str\"", "arg_1", "=", "arg_0", ".", "to_repo_relative_path", "(", "path", "=", "arg_1", ",", "split", "=", "False", ")", "arg_11", "=", "arg_1", ".", "split", "(", "os", ".", "sep", ")", "arg_3", "=", "arg_0", ".", "__repo", "[", "'walk_repo'", "]", "while", "len", "(", "arg_11", ")", ":", "arg_10", "=", "arg_11", ".", "pop", "(", "0", ")", "arg_12", "=", "[", "d", "for", "d", "in", "arg_3", "if", "isinstance", "(", "d", ",", "dict", ")", "]", "if", "not", "len", "(", "arg_12", ")", ":", "arg_3", "=", "None", "break", "arg_13", "=", "[", "d", "for", "d", "in", "arg_12", "if", "arg_10", "in", "d", "]", "if", "not", "len", "(", "arg_13", ")", ":", "arg_3", "=", "None", "break", "arg_3", "=", "arg_13", "[", "0", "]", "[", "arg_10", "]", "if", "arg_3", "is", "not", "None", ":", "_walk_dir", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Get a list representation of repository state along with useful\n        information. List state is ordered relativeley to directories level\n\n        :Parameters:\n            #. relaPath (None, str): relative directory path from where to\n               start. If None all repository representation is returned.\n\n        :Returns:\n            #. state (list): List representation of the repository.\n               List items are all dictionaries. Every dictionary has a single\n               key which is the file or the directory name and the value is a\n               dictionary of information including:\n\n                   * 'type': the type of the tracked whether it's file, dir, or objectdir\n                   * 'exists': whether file or directory actually exists on disk\n                   * 'pyrepfileinfo': In case of a file or an objectdir whether .%s_pyrepfileinfo exists\n                   * 'pyrepdirinfo': In case of a directory whether .pyrepdirinfo exists\n        \"\"\"\n        arg_2 = []\n        def _walk_dir(arg_1, arg_3):\n            arg_4 = {'type':'dir',\n                       'exists':os.path.isdir(os.path.join(arg_0.__path,arg_1)),\n                       'pyrepdirinfo':os.path.isfile(os.path.join(arg_0.__path,arg_1,arg_0.__dirInfo)),\n                      }\n            arg_2.append({arg_1:arg_4})\n            # loop files and dirobjects\n            for arg_5 in sorted([f for f in arg_3 if isinstance(f, basestring)]):\n                arg_6 = os.path.join(arg_1,arg_5)\n                arg_7 = os.path.join(arg_0.__path,arg_6)\n                #if os.path.isdir(realFilePath) and df.startswith('.') and df.endswith(self.__objectDir[3:]):\n                #    fileDict = {'type':'objectdir',\n                #                'exists':True,\n                #                'pyrepfileinfo':os.path.isfile(os.path.join(self.__path,relaPath,self.__fileInfo%fname)),\n                #               }\n                #else:\n                #    fileDict = {'type':'file',\n                #                'exists':os.path.isfile(realFilePath),\n                #                'pyrepfileinfo':os.path.isfile(os.path.join(self.__path,relaPath,self.__fileInfo%fname)),\n                #               }\n                arg_8 = {'type':'file',\n                            'exists':os.path.isfile(arg_7),\n                            'pyrepfileinfo':os.path.isfile(os.path.join(arg_0.__path,arg_1,arg_0.__fileInfo%arg_5)),\n                           }\n                arg_2.append({arg_6:arg_8})\n            # loop directories\n            #for ddict in sorted([d for d in dirList if isinstance(d, dict) and len(d)], key=lambda k: list(k)[0]):\n            for arg_9 in sorted([d for d in arg_3 if isinstance(d, dict)], key=lambda k: list(k)[0]):\n                arg_10 = list(arg_9)[0]\n                _walk_dir(arg_1=os.path.join(arg_1,arg_10), arg_3=arg_9[arg_10])\n        # call recursive _walk_dir\n        if arg_1 is None:\n            _walk_dir(arg_1='', arg_3=arg_0.__repo['walk_repo'])\n        else:\n            assert isinstance(arg_1, basestring), \"relaPath must be None or a str\"\n            arg_1 = arg_0.to_repo_relative_path(path=arg_1, split=False)\n            arg_11    = arg_1.split(os.sep)\n            arg_3  = arg_0.__repo['walk_repo']\n            while len(arg_11):\n                arg_10 = arg_11.pop(0)\n                arg_12   = [d for d in arg_3 if isinstance(d, dict)]\n                if not len(arg_12):\n                    arg_3 = None\n                    break\n                arg_13 = [d for d in arg_12 if arg_10 in d]\n                if not len(arg_13):\n                    arg_3 = None\n                    break\n                arg_3 = arg_13[0][arg_10]\n            if arg_3 is not None:\n                _walk_dir(arg_1=arg_1, arg_3=arg_3)\n        # return state list\n        return arg_2", "path": "Repository.py", "identifier": "Repository.get_repository_state", "docstring": "Get a list representation of repository state along with useful\n        information. List state is ordered relativeley to directories level\n\n        :Parameters:\n            #. relaPath (None, str): relative directory path from where to\n               start. If None all repository representation is returned.\n\n        :Returns:\n            #. state (list): List representation of the repository.\n               List items are all dictionaries. Every dictionary has a single\n               key which is the file or the directory name and the value is a\n               dictionary of information including:\n\n                   * 'type': the type of the tracked whether it's file, dir, or objectdir\n                   * 'exists': whether file or directory actually exists on disk\n                   * 'pyrepfileinfo': In case of a file or an objectdir whether .%s_pyrepfileinfo exists\n                   * 'pyrepdirinfo': In case of a directory whether .pyrepdirinfo exists", "docstring_tokens": ["Get", "a", "list", "representation", "of", "repository", "state", "along", "with", "useful", "information", ".", "List", "state", "is", "ordered", "relativeley", "to", "directories", "level"], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 255345}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/model.py#L462-L509", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Remove a list of metabolites from the the object.", "language": "python", "parameters": "(self, metabolite_list, destructive=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "hasattr", "(", "arg_1", ",", "'__iter__'", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_1", "=", "[", "arg_3", "for", "arg_3", "in", "arg_1", "if", "arg_3", ".", "id", "in", "arg_0", ".", "metabolites", "]", "for", "arg_3", "in", "arg_1", ":", "arg_3", ".", "_model", "=", "None", "arg_5", "=", "arg_0", ".", "get_associated_groups", "(", "arg_3", ")", "for", "arg_6", "in", "arg_5", ":", "arg_6", ".", "remove_members", "(", "arg_3", ")", "if", "not", "arg_2", ":", "for", "arg_7", "in", "list", "(", "arg_3", ".", "_reaction", ")", ":", "arg_8", "=", "arg_7", ".", "_metabolites", "[", "arg_3", "]", "arg_7", ".", "subtract_metabolites", "(", "{", "arg_3", ":", "arg_8", "}", ")", "else", ":", "for", "arg_3", "in", "list", "(", "arg_3", ".", "_reaction", ")", ":", "arg_3", ".", "remove_from_model", "(", ")", "arg_0", ".", "metabolites", "-=", "arg_1", "arg_9", "=", "[", "arg_0", ".", "solver", ".", "constraints", "[", "m", ".", "id", "]", "for", "m", "in", "arg_1", "]", "arg_0", ".", "remove_cons_vars", "(", "arg_9", ")", "arg_10", "=", "get_context", "(", "arg_0", ")", "if", "arg_10", ":", "arg_10", "(", "partial", "(", "arg_0", ".", "metabolites", ".", "__iadd__", ",", "arg_1", ")", ")", "for", "arg_3", "in", "arg_1", ":", "arg_10", "(", "partial", "(", "setattr", ",", "arg_3", ",", "'_model'", ",", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Remove a list of metabolites from the the object.\n\n        The change is reverted upon exit when using the model as a context.\n\n        Parameters\n        ----------\n        metabolite_list : list\n            A list with `cobra.Metabolite` objects as elements.\n\n        destructive : bool\n            If False then the metabolite is removed from all\n            associated reactions.  If True then all associated\n            reactions are removed from the Model.\n\n        \"\"\"\n        if not hasattr(arg_1, '__iter__'):\n            arg_1 = [arg_1]\n        # Make sure metabolites exist in model\n        arg_1 = [arg_3 for arg_3 in arg_1\n                           if arg_3.id in arg_0.metabolites]\n        for arg_3 in arg_1:\n            arg_3._model = None\n\n            # remove reference to the metabolite in all groups\n            arg_5 = arg_0.get_associated_groups(arg_3)\n            for arg_6 in arg_5:\n                arg_6.remove_members(arg_3)\n\n            if not arg_2:\n                for arg_7 in list(arg_3._reaction):\n                    arg_8 = arg_7._metabolites[arg_3]\n                    arg_7.subtract_metabolites({arg_3: arg_8})\n\n            else:\n                for arg_3 in list(arg_3._reaction):\n                    arg_3.remove_from_model()\n\n        arg_0.metabolites -= arg_1\n\n        arg_9 = [arg_0.solver.constraints[m.id] for m in arg_1]\n        arg_0.remove_cons_vars(arg_9)\n\n        arg_10 = get_context(arg_0)\n        if arg_10:\n            arg_10(partial(arg_0.metabolites.__iadd__, arg_1))\n            for arg_3 in arg_1:\n                arg_10(partial(setattr, arg_3, '_model', arg_0))", "path": "cobra/core/model.py", "identifier": "Model.remove_metabolites", "docstring": "Remove a list of metabolites from the the object.\n\n        The change is reverted upon exit when using the model as a context.\n\n        Parameters\n        ----------\n        metabolite_list : list\n            A list with `cobra.Metabolite` objects as elements.\n\n        destructive : bool\n            If False then the metabolite is removed from all\n            associated reactions.  If True then all associated\n            reactions are removed from the Model.", "docstring_tokens": ["Remove", "a", "list", "of", "metabolites", "from", "the", "the", "object", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255346}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/file_record_stream.py#L343-L387", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns next available data record from the file.", "language": "python", "parameters": "(self, useCache=True)", "return_statement": "return record", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "assert", "arg_0", ".", "_file", "is", "not", "None", "assert", "arg_0", ".", "_mode", "==", "arg_0", ".", "_FILE_READ_MODE", "try", ":", "arg_2", "=", "arg_0", ".", "_reader", ".", "next", "(", ")", "except", "StopIteration", ":", "if", "arg_0", ".", "rewindAtEOF", ":", "if", "arg_0", ".", "_recordCount", "==", "0", ":", "raise", "Exception", "(", "\"The source configured to reset at EOF but \"", "\"'%s' appears to be empty\"", "%", "arg_0", ".", "_filename", ")", "arg_0", ".", "rewind", "(", ")", "arg_2", "=", "arg_0", ".", "_reader", ".", "next", "(", ")", "else", ":", "return", "None", "arg_0", ".", "_recordCount", "+=", "1", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_2", ")", ":", "if", "arg_5", "in", "arg_0", ".", "_missingValues", ":", "arg_3", ".", "append", "(", "SENTINEL_VALUE_FOR_MISSING_DATA", ")", "else", ":", "arg_3", ".", "append", "(", "arg_0", ".", "_adapters", "[", "arg_4", "]", "(", "arg_5", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\" Returns next available data record from the file.\n\n    :returns: a data row (a list or tuple) if available; None, if no more\n              records in the table (End of Stream - EOS); empty sequence (list\n              or tuple) when timing out while waiting for the next record.\n    \"\"\"\n    assert arg_0._file is not None\n    assert arg_0._mode == arg_0._FILE_READ_MODE\n\n    # Read the line\n    try:\n      arg_2 = arg_0._reader.next()\n\n    except StopIteration:\n      if arg_0.rewindAtEOF:\n        if arg_0._recordCount == 0:\n          raise Exception(\"The source configured to reset at EOF but \"\n                          \"'%s' appears to be empty\" % arg_0._filename)\n        arg_0.rewind()\n        arg_2 = arg_0._reader.next()\n\n      else:\n        return None\n\n    # Keep score of how many records were read\n    arg_0._recordCount += 1\n\n    # Split the line to text fields and convert each text field to a Python\n    # object if value is missing (empty string) encode appropriately for\n    # upstream consumers in the case of numeric types, this means replacing\n    # missing data with a sentinel value for string type, we can leave the empty\n    # string in place\n    arg_3 = []\n    for arg_4, arg_5 in enumerate(arg_2):\n      #print \"DEBUG: Evaluating field @ index %s: %r\" % (i, f)\n      #sys.stdout.flush()\n      if arg_5 in arg_0._missingValues:\n        arg_3.append(SENTINEL_VALUE_FOR_MISSING_DATA)\n      else:\n        # either there is valid data, or the field is string type,\n        # in which case the adapter does the right thing by default\n        arg_3.append(arg_0._adapters[arg_4](arg_5))\n\n    return arg_3", "path": "src/nupic/data/file_record_stream.py", "identifier": "FileRecordStream.getNextRecord", "docstring": "Returns next available data record from the file.\n\n    :returns: a data row (a list or tuple) if available; None, if no more\n              records in the table (End of Stream - EOS); empty sequence (list\n              or tuple) when timing out while waiting for the next record.", "docstring_tokens": ["Returns", "next", "available", "data", "record", "from", "the", "file", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255347}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/component/component_viewer.py#L74-L81", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles the component being changed.", "language": "python", "parameters": "(self, old, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "canvas", "if", "arg_1", "is", "not", "None", ":", "arg_3", ".", "remove", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "arg_3", ".", "add", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Handles the component being changed.\n        \"\"\"\n        arg_3 = arg_0.canvas\n        if arg_1 is not None:\n            arg_3.remove(arg_1)\n        if arg_2 is not None:\n            arg_3.add(arg_2)", "path": "godot/component/component_viewer.py", "identifier": "ComponentViewer._component_changed", "docstring": "Handles the component being changed.", "docstring_tokens": ["Handles", "the", "component", "being", "changed", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 255348}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/txn.py#L51-L80", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Formats a transaction DataFrame.", "language": "python", "parameters": "(transactions)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "index", ":", "arg_3", "=", "arg_0", ".", "loc", "[", "arg_2", "]", "if", "len", "(", "arg_3", ")", "==", "0", ":", "continue", "for", "arg_4", "in", "arg_3", ":", "arg_4", "=", "map_transaction", "(", "arg_4", ")", "arg_1", ".", "append", "(", "arg_4", ")", "arg_5", "=", "pd", ".", "DataFrame", "(", "sorted", "(", "arg_1", ",", "key", "=", "lambda", "x", ":", "x", "[", "'dt'", "]", ")", ")", "arg_5", "[", "'txn_dollars'", "]", "=", "-", "arg_5", "[", "'amount'", "]", "*", "arg_5", "[", "'price'", "]", "arg_5", ".", "index", "=", "list", "(", "map", "(", "pd", ".", "Timestamp", ",", "arg_5", ".", "dt", ".", "values", ")", ")", "return", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"\n    Formats a transaction DataFrame.\n\n    Parameters\n    ----------\n    transactions : pd.DataFrame\n        Contains improperly formatted transactional data.\n\n    Returns\n    -------\n    df : pd.DataFrame\n        Daily transaction volume and dollar ammount.\n         - See full explanation in tears.create_full_tear_sheet.\n    \"\"\"\n\n    arg_1 = []\n    for arg_2 in arg_0.index:\n        arg_3 = arg_0.loc[arg_2]\n        if len(arg_3) == 0:\n            continue\n\n        for arg_4 in arg_3:\n            arg_4 = map_transaction(arg_4)\n            arg_1.append(arg_4)\n    arg_5 = pd.DataFrame(sorted(arg_1, key=lambda x: x['dt']))\n    arg_5['txn_dollars'] = -arg_5['amount'] * arg_5['price']\n\n    arg_5.index = list(map(pd.Timestamp, arg_5.dt.values))\n    return arg_5", "path": "pyfolio/txn.py", "identifier": "make_transaction_frame", "docstring": "Formats a transaction DataFrame.\n\n    Parameters\n    ----------\n    transactions : pd.DataFrame\n        Contains improperly formatted transactional data.\n\n    Returns\n    -------\n    df : pd.DataFrame\n        Daily transaction volume and dollar ammount.\n         - See full explanation in tears.create_full_tear_sheet.", "docstring_tokens": ["Formats", "a", "transaction", "DataFrame", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255349}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/crypto/signing.py#L76-L99", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Generates a single key.", "language": "python", "parameters": "(self, index, iterations)", "return_statement": "return (\n            self.get_keys(\n                start=index,\n                count=1,\n                step=1,\n                iterations=iterations,\n            )[0]\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "(", "arg_0", ".", "Funcs", "(", "start", "=", "arg_1", ",", "count", "=", "1", ",", "step", "=", "1", ",", "arg_2", "=", "arg_2", ",", ")", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        # type: (int, int) -> PrivateKey\n        \"\"\"\n        Generates a single key.\n\n        :param index:\n            The key index.\n\n        :param iterations:\n            Number of transform iterations to apply to the key, also\n            known as security level.\n            Must be >= 1.\n\n            Increasing this value makes key generation slower, but more\n            resistant to brute-forcing.\n        \"\"\"\n        return (\n            arg_0.Funcs(\n                start=arg_1,\n                count=1,\n                step=1,\n                arg_2=arg_2,\n            )[0]\n        )", "path": "iota/crypto/signing.py", "identifier": "KeyGenerator.get_key", "docstring": "Generates a single key.\n\n        :param index:\n            The key index.\n\n        :param iterations:\n            Number of transform iterations to apply to the key, also\n            known as security level.\n            Must be >= 1.\n\n            Increasing this value makes key generation slower, but more\n            resistant to brute-forcing.", "docstring_tokens": ["Generates", "a", "single", "key", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 255350}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L587-L592", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Send a chat message to a conversation.", "language": "python", "parameters": "(self, send_chat_message_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "SendChatMessageResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'conversations/sendchatmessage'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Send a chat message to a conversation.\"\"\"\n        arg_2 = hangouts_pb2.SendChatMessageResponse()\n        await arg_0._pb_request('conversations/sendchatmessage',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.send_chat_message", "docstring": "Send a chat message to a conversation.", "docstring_tokens": ["Send", "a", "chat", "message", "to", "a", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255351}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L124-L145", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Execute asynchronousely without waiting for exitcode", "language": "python", "parameters": "(self, cmd, walltime=2, envs={})", "return_statement": "return None, stdout, stderr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", ",", "arg_3", "=", "{", "}", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_0", ".", "ssh_client", ".", "exec_command", "(", "arg_0", ".", "prepend_envs", "(", "arg_1", ",", "arg_3", ")", ",", "bufsize", "=", "-", "1", ",", "timeout", "=", "arg_2", ")", "return", "None", ",", "arg_5", ",", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=2, arg_3={}):\n        ''' Execute asynchronousely without waiting for exitcode\n\n        Args:\n            - cmd (string): Commandline string to be executed on the remote side\n            - walltime (int): timeout to exec_command\n\n        KWargs:\n            - envs (dict): A dictionary of env variables\n\n        Returns:\n            - None, stdout (readable stream), stderr (readable stream)\n\n        Raises:\n            - ChannelExecFailed (reason)\n        '''\n\n        # Execute the command\n        arg_4, arg_5, arg_6 = arg_0.ssh_client.exec_command(\n            arg_0.prepend_envs(arg_1, arg_3), bufsize=-1, timeout=arg_2\n        )\n        return None, arg_5, arg_6", "path": "parsl/channels/ssh/ssh.py", "identifier": "SSHChannel.execute_no_wait", "docstring": "Execute asynchronousely without waiting for exitcode\n\n        Args:\n            - cmd (string): Commandline string to be executed on the remote side\n            - walltime (int): timeout to exec_command\n\n        KWargs:\n            - envs (dict): A dictionary of env variables\n\n        Returns:\n            - None, stdout (readable stream), stderr (readable stream)\n\n        Raises:\n            - ChannelExecFailed (reason)", "docstring_tokens": ["Execute", "asynchronousely", "without", "waiting", "for", "exitcode"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 255352}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/sampling.py#L263-L315", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Create a new layer populated with a point sampling of the current mesh,\n        at most one sample for each element of the mesh is created.", "language": "python", "parameters": "(script, sample_num=1000, element='VERT')", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1000", ",", "arg_2", "=", "'VERT'", ")", ":", "if", "arg_2", ".", "lower", "(", ")", "==", "'vert'", ":", "arg_3", "=", "0", "elif", "arg_2", ".", "lower", "(", ")", "==", "'edge'", ":", "arg_3", "=", "1", "elif", "arg_2", ".", "lower", "(", ")", "==", "'face'", ":", "arg_3", "=", "2", "arg_4", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Mesh Element Subsampling\">\\n'", ",", "'    <Param name=\"Sampling\" '", ",", "'value=\"{:d}\" '", ".", "format", "(", "arg_3", ")", ",", "'description=\"Element to sample:\" '", ",", "'enum_val0=\"Vertex\" '", ",", "'enum_val1=\"Edge\" '", ",", "'enum_val2=\"Face\" '", ",", "'enum_cardinality=\"3\" '", ",", "'type=\"RichEnum\" '", ",", "'/>\\n'", ",", "'    <Param name=\"SampleNum\" '", ",", "'value=\"{:d}\" '", ".", "format", "(", "arg_1", ")", ",", "'description=\"Number of samples\" '", ",", "'type=\"RichInt\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_4", ")", "if", "isinstance", "(", "arg_0", ",", "FilterScript", ")", ":", "arg_0", ".", "add_layer", "(", "'Sampled Mesh'", ")", "return", "None"], "function": "def Func(arg_0, arg_1=1000, arg_2='VERT'):\n    \"\"\" Create a new layer populated with a point sampling of the current mesh,\n        at most one sample for each element of the mesh is created.\n\n    Samples are taking in a uniform way, one for each element\n    (vertex/edge/face); all the elements have the same probabilty of being\n    choosen.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        sample_num (int): The desired number of elements that must be chosen.\n            Being a subsampling of the original elements if this number should\n            not be larger than the number of elements of the original mesh.\n        element (enum in ['VERT', 'EDGE', 'FACE']): Choose what mesh element\n            will be used for the subsampling. At most one point sample will\n            be added for each one of the chosen elements\n\n    Layer stack:\n        Creates new layer 'Sampled Mesh'. Current layer is changed to the new\n            layer.\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    if arg_2.lower() == 'vert':\n        arg_3 = 0\n    elif arg_2.lower() == 'edge':\n        arg_3 = 1\n    elif arg_2.lower() == 'face':\n        arg_3 = 2\n    arg_4 = ''.join([\n        '  <filter name=\"Mesh Element Subsampling\">\\n',\n        '    <Param name=\"Sampling\" ',\n        'value=\"{:d}\" '.format(arg_3),\n        'description=\"Element to sample:\" ',\n        'enum_val0=\"Vertex\" ',\n        'enum_val1=\"Edge\" ',\n        'enum_val2=\"Face\" ',\n        'enum_cardinality=\"3\" ',\n        'type=\"RichEnum\" ',\n        '/>\\n',\n        '    <Param name=\"SampleNum\" ',\n        'value=\"{:d}\" '.format(arg_1),\n        'description=\"Number of samples\" ',\n        'type=\"RichInt\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_4)\n    if isinstance(arg_0, FilterScript):\n        arg_0.add_layer('Sampled Mesh')\n    return None", "path": "meshlabxml/sampling.py", "identifier": "mesh_element", "docstring": "Create a new layer populated with a point sampling of the current mesh,\n        at most one sample for each element of the mesh is created.\n\n    Samples are taking in a uniform way, one for each element\n    (vertex/edge/face); all the elements have the same probabilty of being\n    choosen.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        sample_num (int): The desired number of elements that must be chosen.\n            Being a subsampling of the original elements if this number should\n            not be larger than the number of elements of the original mesh.\n        element (enum in ['VERT', 'EDGE', 'FACE']): Choose what mesh element\n            will be used for the subsampling. At most one point sample will\n            be added for each one of the chosen elements\n\n    Layer stack:\n        Creates new layer 'Sampled Mesh'. Current layer is changed to the new\n            layer.\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Create", "a", "new", "layer", "populated", "with", "a", "point", "sampling", "of", "the", "current", "mesh", "at", "most", "one", "sample", "for", "each", "element", "of", "the", "mesh", "is", "created", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 255353}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L1424-L1454", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Copy code running in current environment to memory", "language": "python", "parameters": "(self, mem_offset, code_offset, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "_allocate", "(", "arg_1", ",", "arg_3", ")", "arg_4", "=", "3", "arg_5", "=", "arg_0", ".", "safe_mul", "(", "arg_4", ",", "Operators", ".", "UDIV", "(", "arg_0", ".", "safe_add", "(", "arg_3", ",", "31", ")", ",", "32", ")", ")", "arg_0", ".", "_consume", "(", "arg_5", ")", "if", "issymbolic", "(", "arg_3", ")", ":", "arg_6", "=", "solver", ".", "max", "(", "arg_0", ".", "constraints", ",", "arg_3", ")", "else", ":", "arg_6", "=", "arg_3", "for", "arg_7", "in", "range", "(", "arg_6", ")", ":", "if", "issymbolic", "(", "arg_7", "<", "arg_3", ")", ":", "arg_8", "=", "Operators", ".", "ITEBV", "(", "8", ",", "arg_7", "<", "arg_3", ",", "0", ",", "arg_0", ".", "_load", "(", "arg_1", "+", "arg_7", ",", "1", ")", ")", "else", ":", "if", "arg_7", "<", "arg_3", ":", "arg_8", "=", "0", "else", ":", "arg_8", "=", "arg_0", ".", "_load", "(", "arg_1", "+", "arg_7", ",", "1", ")", "if", "issymbolic", "(", "arg_2", ")", ":", "arg_9", "=", "Operators", ".", "ITEBV", "(", "8", ",", "arg_2", "+", "arg_7", ">=", "len", "(", "arg_0", ".", "bytecode", ")", ",", "arg_8", ",", "arg_0", ".", "bytecode", "[", "arg_2", "+", "arg_7", "]", ")", "else", ":", "if", "arg_2", "+", "arg_7", ">=", "len", "(", "arg_0", ".", "bytecode", ")", ":", "arg_9", "=", "arg_8", "else", ":", "arg_9", "=", "arg_0", ".", "bytecode", "[", "arg_2", "+", "arg_7", "]", "arg_0", ".", "_store", "(", "arg_1", "+", "arg_7", ",", "arg_9", ")", "arg_0", ".", "_publish", "(", "'did_evm_read_code'", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Copy code running in current environment to memory\"\"\"\n\n        arg_0._allocate(arg_1, arg_3)\n        arg_4 = 3             # cost to copy one 32 byte word\n        arg_5 = arg_0.safe_mul(arg_4, Operators.UDIV(arg_0.safe_add(arg_3, 31), 32))\n        arg_0._consume(arg_5)\n\n        if issymbolic(arg_3):\n            arg_6 = solver.max(arg_0.constraints, arg_3)\n        else:\n            arg_6 = arg_3\n\n        for arg_7 in range(arg_6):\n            if issymbolic(arg_7 < arg_3):\n                arg_8 = Operators.ITEBV(8, arg_7 < arg_3, 0, arg_0._load(arg_1 + arg_7, 1))  # Fixme. unnecessary memory read\n            else:\n                if arg_7 < arg_3:\n                    arg_8 = 0\n                else:\n                    arg_8 = arg_0._load(arg_1 + arg_7, 1)\n\n            if issymbolic(arg_2):\n                arg_9 = Operators.ITEBV(8, arg_2 + arg_7 >= len(arg_0.bytecode), arg_8, arg_0.bytecode[arg_2 + arg_7])\n            else:\n                if arg_2 + arg_7 >= len(arg_0.bytecode):\n                    arg_9 = arg_8\n                else:\n                    arg_9 = arg_0.bytecode[arg_2 + arg_7]\n            arg_0._store(arg_1 + arg_7, arg_9)\n        arg_0._publish('did_evm_read_code', arg_2, arg_3)", "path": "manticore/platforms/evm.py", "identifier": "EVM.CODECOPY", "docstring": "Copy code running in current environment to memory", "docstring_tokens": ["Copy", "code", "running", "in", "current", "environment", "to", "memory"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 255354}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/fit_estimator.py#L22-L93", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "Fit and score an estimator with cross-validation", "language": "python", "parameters": "(estimator, parameters, cv, X, y=None, scoring=None,\n                            iid=True, n_jobs=1, verbose=1,\n                            pre_dispatch='2*n_jobs')", "return_statement": "return grid_scores", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ",", "arg_7", "=", "1", ",", "arg_8", "=", "1", ",", "arg_9", "=", "'2*n_jobs'", ")", ":", "arg_10", "=", "check_scoring", "(", "arg_0", ",", "arg_5", "=", "arg_5", ")", "arg_11", "=", "num_samples", "(", "arg_3", ")", "arg_3", ",", "arg_4", "=", "check_arrays", "(", "arg_3", ",", "arg_4", ",", "allow_lists", "=", "True", ",", "sparse_format", "=", "'csr'", ",", "allow_nans", "=", "True", ")", "if", "arg_4", "is", "not", "None", ":", "if", "len", "(", "arg_4", ")", "!=", "arg_11", ":", "raise", "ValueError", "(", "'Target variable (y) has a different number '", "'of samples (%i) than data (X: %i samples)'", "%", "(", "len", "(", "arg_4", ")", ",", "arg_11", ")", ")", "arg_2", "=", "check_cv", "(", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "classifier", "=", "is_classifier", "(", "arg_0", ")", ")", "arg_12", "=", "Parallel", "(", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")", "(", "delayed", "(", "_fit_and_score", ")", "(", "clone", "(", "arg_0", ")", ",", "arg_3", ",", "arg_4", ",", "arg_10", ",", "train", ",", "test", ",", "arg_8", ",", "arg_1", ",", "fit_params", "=", "None", ")", "for", "train", ",", "test", "in", "arg_2", ".", "split", "(", "arg_3", ",", "arg_4", ")", ")", "assert", "len", "(", "arg_12", ")", "==", "arg_2", ".", "n_splits", "arg_13", ",", "arg_14", "=", "[", "]", ",", "[", "]", "arg_15", ",", "arg_16", "=", "[", "]", ",", "[", "]", "for", "arg_17", ",", "arg_18", ",", "arg_19", ",", "arg_20", ",", "arg_21", "in", "arg_12", ":", "arg_13", ".", "append", "(", "arg_19", ")", "arg_14", ".", "append", "(", "arg_17", ")", "arg_16", ".", "append", "(", "arg_18", ")", "arg_15", ".", "append", "(", "arg_20", ")", "arg_13", ",", "arg_14", "=", "map", "(", "list", ",", "check_arrays", "(", "arg_13", ",", "arg_14", ",", "warn_nans", "=", "True", ",", "replace_nans", "=", "True", ")", ")", "if", "arg_6", ":", "if", "arg_8", ">", "0", "and", "is_msmbuilder_estimator", "(", "arg_0", ")", ":", "print", "(", "'[CV] Using MSMBuilder API n_samples averaging'", ")", "print", "(", "'[CV]   n_train_samples: %s'", "%", "str", "(", "arg_15", ")", ")", "print", "(", "'[CV]   n_test_samples: %s'", "%", "str", "(", "arg_16", ")", ")", "arg_22", "=", "np", ".", "average", "(", "arg_14", ",", "weights", "=", "arg_16", ")", "arg_23", "=", "np", ".", "average", "(", "arg_13", ",", "weights", "=", "arg_15", ")", "else", ":", "arg_22", "=", "np", ".", "average", "(", "arg_14", ")", "arg_23", "=", "np", ".", "average", "(", "arg_13", ")", "arg_24", "=", "{", "'mean_test_score'", ":", "arg_22", ",", "'test_scores'", ":", "arg_14", ",", "'mean_train_score'", ":", "arg_23", ",", "'train_scores'", ":", "arg_13", ",", "'n_test_samples'", ":", "arg_16", ",", "'n_train_samples'", ":", "arg_15", "}", "return", "arg_24"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None,\n                            arg_6=True, arg_7=1, arg_8=1,\n                            arg_9='2*n_jobs'):\n    \"\"\"Fit and score an estimator with cross-validation\n\n    This function is basically a copy of sklearn's\n    model_selection._BaseSearchCV._fit(), which is the core of the GridSearchCV\n    fit() method. Unfortunately, that class does _not_ return the training\n    set scores, which we want to save in the database, and because of the\n    way it's written, you can't change it by subclassing or monkeypatching.\n\n    This function uses some undocumented internal sklearn APIs (non-public).\n    It was written against sklearn version 0.16.1. Prior Versions are likely\n    to fail due to changes in the design of cross_validation module.\n\n    Returns\n    -------\n    out : dict, with keys 'mean_test_score' 'test_scores', 'train_scores'\n        The scores on the training and test sets, as well as the mean test set\n        score.\n    \"\"\"\n\n    arg_10 = check_scoring(arg_0, arg_5=arg_5)\n    arg_11 = num_samples(arg_3)\n    arg_3, arg_4 = check_arrays(arg_3, arg_4, allow_lists=True, sparse_format='csr',\n                        allow_nans=True)\n    if arg_4 is not None:\n        if len(arg_4) != arg_11:\n            raise ValueError('Target variable (y) has a different number '\n                             'of samples (%i) than data (X: %i samples)'\n                             % (len(arg_4), arg_11))\n    arg_2 = check_cv(arg_2=arg_2, arg_4=arg_4, classifier=is_classifier(arg_0))\n\n    arg_12 = Parallel(\n        arg_7=arg_7, arg_8=arg_8, arg_9=arg_9\n    )(\n        delayed(_fit_and_score)(clone(arg_0), arg_3, arg_4, arg_10,\n                                train, test, arg_8, arg_1,\n                                fit_params=None)\n        for train, test in arg_2.split(arg_3, arg_4))\n\n    assert len(arg_12) == arg_2.n_splits\n\n    arg_13, arg_14 = [], []\n    arg_15, arg_16 = [], []\n    for arg_17, arg_18, arg_19, arg_20, arg_21 in arg_12:\n        arg_13.append(arg_19)\n        arg_14.append(arg_17)\n        arg_16.append(arg_18)\n        arg_15.append(arg_20)\n\n    arg_13, arg_14 = map(list, check_arrays(arg_13,\n                                                       arg_14,\n                                                       warn_nans=True,\n                                                       replace_nans=True))\n\n    if arg_6:\n        if arg_8 > 0 and is_msmbuilder_estimator(arg_0):\n            print('[CV] Using MSMBuilder API n_samples averaging')\n            print('[CV]   n_train_samples: %s' % str(arg_15))\n            print('[CV]   n_test_samples: %s' % str(arg_16))\n        arg_22 = np.average(arg_14, weights=arg_16)\n        arg_23 = np.average(arg_13, weights=arg_15)\n    else:\n        arg_22 = np.average(arg_14)\n        arg_23 = np.average(arg_13)\n\n    arg_24 = {\n        'mean_test_score': arg_22, 'test_scores': arg_14,\n        'mean_train_score': arg_23, 'train_scores': arg_13,\n        'n_test_samples': arg_16, 'n_train_samples': arg_15}\n    return arg_24", "path": "osprey/fit_estimator.py", "identifier": "fit_and_score_estimator", "docstring": "Fit and score an estimator with cross-validation\n\n    This function is basically a copy of sklearn's\n    model_selection._BaseSearchCV._fit(), which is the core of the GridSearchCV\n    fit() method. Unfortunately, that class does _not_ return the training\n    set scores, which we want to save in the database, and because of the\n    way it's written, you can't change it by subclassing or monkeypatching.\n\n    This function uses some undocumented internal sklearn APIs (non-public).\n    It was written against sklearn version 0.16.1. Prior Versions are likely\n    to fail due to changes in the design of cross_validation module.\n\n    Returns\n    -------\n    out : dict, with keys 'mean_test_score' 'test_scores', 'train_scores'\n        The scores on the training and test sets, as well as the mean test set\n        score.", "docstring_tokens": ["Fit", "and", "score", "an", "estimator", "with", "cross", "-", "validation"], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 255355}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/config.py#L56-L89", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Find and parse config file, storing all variables in ``self._config``.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_config_loaded", "=", "True", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "_candidate_log_files", "(", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_3", ")", ":", "arg_0", ".", "_logger", ".", "info", "(", "\"Reading config file %s\"", "%", "arg_3", ")", "arg_4", "=", "re", ".", "compile", "(", "r\"^\\[(\\w+)\\]$\"", ")", "arg_5", "=", "re", ".", "compile", "(", "r\"^(\\w+:)?([\\w.]+)\\s*=(.*)$\"", ")", "with", "io", ".", "open", "(", "arg_3", ",", "\"rt\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "config_file", ":", "arg_6", "=", "None", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "config_file", ")", ":", "arg_8", "=", "arg_8", ".", "strip", "(", ")", "if", "arg_8", "==", "\"\"", "or", "arg_8", ".", "startswith", "(", "\"#\"", ")", ":", "continue", "arg_9", "=", "arg_4", ".", "match", "(", "arg_8", ")", "if", "arg_9", ":", "arg_6", "=", "arg_9", ".", "group", "(", "1", ")", "continue", "arg_10", "=", "arg_5", ".", "match", "(", "arg_8", ")", "if", "arg_10", ":", "arg_11", "=", "arg_10", ".", "group", "(", "1", ")", "arg_12", "=", "arg_10", ".", "group", "(", "2", ")", "arg_13", "=", "arg_10", ".", "group", "(", "3", ")", ".", "strip", "(", ")", "if", "arg_11", "and", "arg_11", ".", "lower", "(", ")", "!=", "\"py:\"", ":", "continue", "if", "arg_6", ":", "arg_12", "=", "arg_6", "+", "\".\"", "+", "arg_12", "if", "arg_12", "in", "H2OConfigReader", ".", "_allowed_config_keys", ":", "arg_2", ".", "append", "(", "(", "arg_12", ",", "arg_13", ")", ")", "else", ":", "arg_0", ".", "_logger", ".", "error", "(", "\"Key %s is not a valid config key\"", "%", "arg_12", ")", "continue", "arg_0", ".", "_logger", ".", "error", "(", "\"Syntax error in config file line %d: %s\"", "%", "(", "arg_7", ",", "arg_8", ")", ")", "arg_0", ".", "_config", "=", "dict", "(", "arg_2", ")", "return"], "function": "def Func(arg_0):\n        \"\"\"Find and parse config file, storing all variables in ``self._config``.\"\"\"\n        arg_0._config_loaded = True\n        arg_2 = []\n        for arg_3 in arg_0._candidate_log_files():\n            if os.path.isfile(arg_3):\n                arg_0._logger.info(\"Reading config file %s\" % arg_3)\n                arg_4 = re.compile(r\"^\\[(\\w+)\\]$\")\n                arg_5 = re.compile(r\"^(\\w+:)?([\\w.]+)\\s*=(.*)$\")\n                with io.open(arg_3, \"rt\", encoding=\"utf-8\") as config_file:\n                    arg_6 = None\n                    for arg_7, arg_8 in enumerate(config_file):\n                        arg_8 = arg_8.strip()\n                        if arg_8 == \"\" or arg_8.startswith(\"#\"): continue\n                        arg_9 = arg_4.match(arg_8)\n                        if arg_9:\n                            arg_6 = arg_9.group(1)\n                            continue\n                        arg_10 = arg_5.match(arg_8)\n                        if arg_10:\n                            arg_11 = arg_10.group(1)\n                            arg_12 = arg_10.group(2)\n                            arg_13 = arg_10.group(3).strip()\n                            if arg_11 and arg_11.lower() != \"py:\": continue\n                            if arg_6:\n                                arg_12 = arg_6 + \".\" + arg_12\n                            if arg_12 in H2OConfigReader._allowed_config_keys:\n                                arg_2.append((arg_12, arg_13))\n                            else:\n                                arg_0._logger.error(\"Key %s is not a valid config key\" % arg_12)\n                            continue\n                        arg_0._logger.error(\"Syntax error in config file line %d: %s\" % (arg_7, arg_8))\n                arg_0._config = dict(arg_2)\n                return", "path": "h2o-py/h2o/utils/config.py", "identifier": "H2OConfigReader._read_config", "docstring": "Find and parse config file, storing all variables in ``self._config``.", "docstring_tokens": ["Find", "and", "parse", "config", "file", "storing", "all", "variables", "in", "self", ".", "_config", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255356}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/utils.py#L157-L176", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Parse a header line.", "language": "python", "parameters": "(line)", "return_statement": "return (name.strip(), value.strip())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", "or", "arg_0", "==", "\"\\r\\n\"", ":", "return", "None", "if", "arg_0", "[", "0", "]", "in", "\" \\t\"", ":", "return", "arg_0", "[", "1", ":", "]", ".", "rstrip", "(", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "split", "(", "\":\"", ",", "1", ")", "return", "(", "arg_1", ".", "strip", "(", ")", ",", "arg_2", ".", "strip", "(", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Parse a header line.\n\n    Args:\n        line: A header line as a string.\n\n    Returns:\n        None if end of headers is found. A string giving the continuation line\n        if a continuation is found. A tuple of name, value when a header line is\n        found.\n\n    Raises:\n        ValueError: If the line cannot be parsed as a header.\n    \"\"\"\n    if not arg_0 or arg_0 == \"\\r\\n\":\n        return None\n    if arg_0[0] in \" \\t\":\n        return arg_0[1:].rstrip()\n    arg_1, arg_2 = arg_0.split(\":\", 1)\n    return (arg_1.strip(), arg_2.strip())", "path": "nntp/utils.py", "identifier": "parse_header", "docstring": "Parse a header line.\n\n    Args:\n        line: A header line as a string.\n\n    Returns:\n        None if end of headers is found. A string giving the continuation line\n        if a continuation is found. A tuple of name, value when a header line is\n        found.\n\n    Raises:\n        ValueError: If the line cannot be parsed as a header.", "docstring_tokens": ["Parse", "a", "header", "line", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 255357}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L97-L108", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "simple timer. returns a time object, or a string.", "language": "python", "parameters": "(timer=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "return", "time", ".", "time", "(", ")", "else", ":", "arg_1", "=", "time", ".", "time", "(", ")", "-", "arg_0", "if", "arg_1", "<", "1", ":", "return", "\"%.02f ms\"", "%", "(", "arg_1", "*", "1000.0", ")", "elif", "arg_1", "<", "60", ":", "return", "\"%.02f s\"", "%", "(", "arg_1", ")", "else", ":", "return", "\"%.02f min\"", "%", "(", "arg_1", "/", "60.0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"simple timer. returns a time object, or a string.\"\"\"\n    if arg_0 is None:\n        return time.time()\n    else:\n        arg_1=time.time()-arg_0\n        if arg_1<1:\n            return \"%.02f ms\"%(arg_1*1000.0)\n        elif arg_1<60:\n            return \"%.02f s\"%(arg_1)\n        else:\n            return \"%.02f min\"%(arg_1/60.0)", "path": "swhlab/common.py", "identifier": "timeit", "docstring": "simple timer. returns a time object, or a string.", "docstring_tokens": ["simple", "timer", ".", "returns", "a", "time", "object", "or", "a", "string", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 255358}
{"url": "https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L333-L369", "sha": "c0393c4d51984a506f813319efb66e54c4f2a426", "docstring_summary": "Get a list of stitch coordinates for the given well.", "language": "python", "parameters": "(self, well_row=0, well_column=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ")", ":", "arg_3", "=", "[", "w", "for", "w", "in", "arg_0", ".", "wells", "if", "attribute", "(", "w", ",", "'u'", ")", "==", "arg_2", "and", "attribute", "(", "w", ",", "'v'", ")", "==", "arg_1", "]", "if", "len", "(", "arg_3", ")", "==", "1", ":", "arg_3", "=", "arg_3", "[", "0", "]", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'TileConfiguration.registered.txt'", ")", "with", "open", "(", "arg_4", ")", "as", "f", ":", "arg_5", "=", "[", "x", ".", "strip", "(", ")", "for", "l", "in", "f", ".", "readlines", "(", ")", "if", "l", "[", "0", ":", "7", "]", "==", "'image--'", "for", "x", "in", "l", ".", "split", "(", "';'", ")", "]", "arg_6", "=", "(", "ast", ".", "literal_eval", "(", "x", ")", "for", "x", "in", "arg_5", "[", "2", ":", ":", "3", "]", ")", "arg_6", "=", "sum", "(", "arg_6", ",", "(", ")", ")", "arg_7", "=", "tuple", "(", "attributes", "(", "x", ")", "for", "x", "in", "arg_5", "[", "0", ":", ":", "3", "]", ")", "return", "arg_6", "[", "0", ":", ":", "2", "]", ",", "arg_6", "[", "1", ":", ":", "2", "]", ",", "arg_7", "else", ":", "print", "(", "'leicaexperiment Func'", "'({}, {}) Well not found'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=0):\n        \"\"\"Get a list of stitch coordinates for the given well.\n\n        Parameters\n        ----------\n        well_row : int\n            Y well coordinate. Same as --V in files.\n        well_column : int\n            X well coordinate. Same as --U in files.\n\n        Returns\n        -------\n        (xs, ys, attr) : tuples with float and collections.OrderedDict\n            Tuple of x's, y's and attributes.\n        \"\"\"\n        arg_3 = [w for w in arg_0.wells\n                    if attribute(w, 'u') == arg_2 and\n                       attribute(w, 'v') == arg_1]\n\n        if len(arg_3) == 1:\n            arg_3 = arg_3[0]\n            arg_4 = os.path.join(arg_3, 'TileConfiguration.registered.txt')\n\n            with open(arg_4) as f:\n                arg_5 = [x.strip()\n                            for l in f.readlines()\n                                if l[0:7] == 'image--'\n                                    for x in l.split(';')] # flat list\n                arg_6 = (ast.literal_eval(x) for x in arg_5[2::3])\n                # flatten\n                arg_6 = sum(arg_6, ())\n                arg_7 = tuple(attributes(x) for x in arg_5[0::3])\n            return arg_6[0::2], arg_6[1::2], arg_7\n\n        else:\n            print('leicaexperiment Func'\n                  '({}, {}) Well not found'.format(arg_1, arg_2))", "path": "leicaexperiment/experiment.py", "identifier": "Experiment.stitch_coordinates", "docstring": "Get a list of stitch coordinates for the given well.\n\n        Parameters\n        ----------\n        well_row : int\n            Y well coordinate. Same as --V in files.\n        well_column : int\n            X well coordinate. Same as --U in files.\n\n        Returns\n        -------\n        (xs, ys, attr) : tuples with float and collections.OrderedDict\n            Tuple of x's, y's and attributes.", "docstring_tokens": ["Get", "a", "list", "of", "stitch", "coordinates", "for", "the", "given", "well", "."], "nwo": "arve0/leicaexperiment", "score": 0.1792979536242127, "idx": 255359}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L241-L257", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "It will poll the URL to grab the latest status resource in a given\n        timeout and time interval.", "language": "python", "parameters": "(self, poll_interval=1, timeout=60)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "60", ")", ":", "arg_3", "=", "time", ".", "time", "(", ")", "arg_4", "=", "0", "while", "(", "arg_0", ".", "status", "!=", "\"complete\"", "and", "(", "arg_2", "<=", "0", "or", "arg_4", "<", "arg_2", ")", ")", ":", "time", ".", "sleep", "(", "arg_1", ")", "arg_0", ".", "refresh", "(", ")", "arg_4", "=", "time", ".", "time", "(", ")", "-", "arg_3"], "function": "def Func(arg_0, arg_1=1, arg_2=60):\n        \"\"\"It will poll the URL to grab the latest status resource in a given\n        timeout and time interval.\n\n        Args:\n            poll_interval (int): how often to poll the status service.\n            timeout (int): how long to poll the URL until giving up. Use <= 0\n                to wait forever\n\n        \"\"\"\n        arg_3 = time.time()\n        arg_4 = 0\n        while (arg_0.status != \"complete\" and\n                (arg_2 <= 0 or arg_4 < arg_2)):\n            time.sleep(arg_1)\n            arg_0.refresh()\n            arg_4 = time.time() - arg_3", "path": "taxii2client/__init__.py", "identifier": "Status.wait_until_final", "docstring": "It will poll the URL to grab the latest status resource in a given\n        timeout and time interval.\n\n        Args:\n            poll_interval (int): how often to poll the status service.\n            timeout (int): how long to poll the URL until giving up. Use <= 0\n                to wait forever", "docstring_tokens": ["It", "will", "poll", "the", "URL", "to", "grab", "the", "latest", "status", "resource", "in", "a", "given", "timeout", "and", "time", "interval", "."], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 255360}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/grid/metrics.py#L30-L45", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Get the F1 values for a set of thresholds for the models explored.", "language": "python", "parameters": "(self, thresholds=None, train=False, valid=False, xval=False)", "return_statement": "return {model.model_id: model.F1(thresholds, train, valid, xval) for model in\n                self.models}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "return", "{", "arg_5", ".", "model_id", ":", "arg_5", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "for", "arg_5", "in", "arg_0", ".", "models", "}"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=False, arg_4=False):\n        \"\"\"\n        Get the Func values for a set of thresholds for the models explored.\n\n        If all are False (default), then return the training metric value.\n        If more than one options is set to True, then return a dictionary of metrics where\n        the keys are \"train\", \"valid\", and \"xval\".\n\n        :param List thresholds: If None, then the thresholds in this set of metrics will be used.\n        :param bool train: If True, return the Func value for the training data.\n        :param bool valid: If True, return the Func value for the validation data.\n        :param bool xval: If True, return the Func value for each of the cross-validated splits.\n        :returns: Dictionary of model keys to Func values\n        \"\"\"\n        return {arg_5.model_id: arg_5.Func(arg_1, arg_2, arg_3, arg_4) for arg_5 in\n                arg_0.models}", "path": "h2o-py/h2o/grid/metrics.py", "identifier": "H2OBinomialGridSearch.F1", "docstring": "Get the F1 values for a set of thresholds for the models explored.\n\n        If all are False (default), then return the training metric value.\n        If more than one options is set to True, then return a dictionary of metrics where\n        the keys are \"train\", \"valid\", and \"xval\".\n\n        :param List thresholds: If None, then the thresholds in this set of metrics will be used.\n        :param bool train: If True, return the F1 value for the training data.\n        :param bool valid: If True, return the F1 value for the validation data.\n        :param bool xval: If True, return the F1 value for each of the cross-validated splits.\n        :returns: Dictionary of model keys to F1 values", "docstring_tokens": ["Get", "the", "F1", "values", "for", "a", "set", "of", "thresholds", "for", "the", "models", "explored", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255361}
{"url": "https://github.com/edx/web-fragments/blob/42d760d700d70465e4e573b7b41442d8802ccd3c/web_fragments/fragment.py#L44-L52", "sha": "42d760d700d70465e4e573b7b41442d8802ccd3c", "docstring_summary": "Returns list of unique `FragmentResource`s by order of first appearance.", "language": "python", "parameters": "(self)", "return_statement": "return [x for x in self._resources if x not in seen and not seen.add(x)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "return", "[", "arg_2", "for", "arg_2", "in", "arg_0", ".", "_Func", "if", "arg_2", "not", "in", "arg_1", "and", "not", "arg_1", ".", "add", "(", "arg_2", ")", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns list of unique `FragmentResource`s by order of first appearance.\n        \"\"\"\n        arg_1 = set()\n        # seen.add always returns None, so 'not seen.add(x)' is always True,\n        # but will only be called if the value is not already in seen (because\n        # 'and' short-circuits)\n        return [arg_2 for arg_2 in arg_0._Func if arg_2 not in arg_1 and not arg_1.add(arg_2)]", "path": "web_fragments/fragment.py", "identifier": "Fragment.resources", "docstring": "Returns list of unique `FragmentResource`s by order of first appearance.", "docstring_tokens": ["Returns", "list", "of", "unique", "FragmentResource", "s", "by", "order", "of", "first", "appearance", "."], "nwo": "edx/web-fragments", "score": 0.3871570893833313, "idx": 255362}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/mod/communicator.py#L115-L125", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Clear temp directory from created csv and ods files during\n        communicator operations.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "LOCAL_ODS", ",", "GDOCS_TRANS_CSV", ",", "GDOCS_META_CSV", ",", "LOCAL_TRANS_CSV", ",", "LOCAL_META_CSV", "]", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "temp_path", ",", "arg_2", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "os", ".", "remove", "(", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Clear temp directory from created csv and ods files during\n        communicator operations.\n        \"\"\"\n        arg_1 = [LOCAL_ODS, GDOCS_TRANS_CSV, GDOCS_META_CSV,\n                      LOCAL_TRANS_CSV, LOCAL_META_CSV]\n        for arg_2 in arg_1:\n            arg_3 = os.path.join(arg_0.temp_path, arg_2)\n            if os.path.exists(arg_3):\n                os.remove(arg_3)", "path": "c3po/mod/communicator.py", "identifier": "Communicator._clear_temp", "docstring": "Clear temp directory from created csv and ods files during\n        communicator operations.", "docstring_tokens": ["Clear", "temp", "directory", "from", "created", "csv", "and", "ods", "files", "during", "communicator", "operations", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 255363}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/setup.py#L638-L759", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Energy minimize the system.", "language": "python", "parameters": "(dirname='em', mdp=config.templates['em.mdp'],\n                    struct='solvate/ionized.gro', top='top/system.top',\n                    output='em.pdb', deffnm=\"em\",\n                    mdrunner=None, mdrun_args=None,\n                    **kwargs)", "return_statement": "return {'struct': final_struct,\n            'top': topology,\n            'mainselection': mainselection,\n            }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'em'", ",", "arg_1", "=", "arg_2", ".", "templates", "[", "'em.mdp'", "]", ",", "arg_4", "=", "'solvate/ionized.gro'", ",", "arg_5", "=", "'top/system.top'", ",", "arg_6", "=", "'em.pdb'", ",", "arg_7", "=", "\"em\"", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "**", "arg_10", ")", ":", "arg_11", "=", "realpath", "(", "arg_4", ")", "arg_12", "=", "realpath", "(", "arg_5", ")", "arg_13", "=", "arg_2", ".", "get_template", "(", "arg_1", ")", "arg_7", "=", "arg_7", ".", "strip", "(", ")", "arg_9", "=", "{", "}", "if", "arg_9", "is", "None", "else", "arg_9", "arg_10", ".", "setdefault", "(", "'pp'", ",", "'processed.top'", ")", "arg_10", ".", "pop", "(", "'ndx'", ",", "None", ")", "arg_14", "=", "arg_10", ".", "pop", "(", "'mainselection'", ",", "'\"Protein\"'", ")", "arg_15", "=", "arg_10", ".", "pop", "(", "'qtot'", ",", "0", ")", "arg_1", "=", "arg_7", "+", "'.mdp'", "arg_16", "=", "arg_7", "+", "'.tpr'", "logger", ".", "info", "(", "\"[{dirname!s}] Energy minimization of struct={struct!r}, top={top!r}, mdp={mdp!r} ...\"", ".", "format", "(", "**", "vars", "(", ")", ")", ")", "cbook", ".", "add_mdp_includes", "(", "arg_12", ",", "arg_10", ")", "if", "arg_15", "!=", "0", ":", "arg_17", "=", "\"Total charge was reported as qtot = {qtot:g} <> 0; probably a problem.\"", ".", "format", "(", "**", "vars", "(", ")", ")", "logger", ".", "warn", "(", "arg_17", ")", "warnings", ".", "warn", "(", "arg_17", ",", "category", "=", "BadParameterWarning", ")", "with", "in_dir", "(", "arg_0", ")", ":", "arg_18", "=", "cbook", ".", "edit_mdp", "(", "arg_13", ",", "new_mdp", "=", "arg_1", ",", "**", "arg_10", ")", "check_mdpargs", "(", "arg_18", ")", "gromacs", ".", "grompp", "(", "f", "=", "arg_1", ",", "o", "=", "arg_16", ",", "c", "=", "arg_11", ",", "r", "=", "arg_11", ",", "p", "=", "arg_12", ",", "**", "arg_18", ")", "arg_9", ".", "update", "(", "v", "=", "True", ",", "stepout", "=", "10", ",", "arg_7", "=", "arg_7", ",", "c", "=", "arg_6", ")", "if", "arg_8", "is", "None", ":", "arg_19", "=", "run", ".", "get_double_or_single_prec_mdrun", "(", ")", "arg_19", "(", "**", "arg_9", ")", "else", ":", "if", "type", "(", "arg_8", ")", "is", "type", ":", "arg_19", "=", "arg_8", "(", "**", "arg_9", ")", "arg_19", ".", "run", "(", ")", "else", ":", "try", ":", "arg_8", ".", "run", "(", "mdrunargs", "=", "arg_9", ")", "except", "AttributeError", ":", "logger", ".", "error", "(", "\"mdrunner: Provide a gromacs.run.MDrunner class or instance or a callback with a run() method\"", ")", "raise", "TypeError", "(", "\"mdrunner: Provide a gromacs.run.MDrunner class or instance or a callback with a run() method\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "arg_20", "=", "\"Energy minimized system NOT produced.\"", "logger", ".", "error", "(", "arg_20", ")", "raise", "GromacsError", "(", "arg_20", ")", "arg_21", "=", "realpath", "(", "arg_6", ")", "logger", ".", "info", "(", "\"[{dirname!s}] energy minimized structure {final_struct!r}\"", ".", "format", "(", "**", "vars", "(", ")", ")", ")", "return", "{", "'struct'", ":", "arg_21", ",", "'top'", ":", "arg_12", ",", "'mainselection'", ":", "arg_14", ",", "}"], "function": "def Func(arg_0='em', arg_1=arg_2.templates['em.mdp'],\n                    arg_4='solvate/ionized.gro', arg_5='top/system.top',\n                    arg_6='em.pdb', arg_7=\"em\",\n                    arg_8=None, arg_9=None,\n                    **arg_10):\n    \"\"\"Energy minimize the system.\n\n    This sets up the system (creates run input files) and also runs\n    ``mdrun_d``. Thus it can take a while.\n\n    Additional itp files should be in the same directory as the top file.\n\n    Many of the keyword arguments below already have sensible values.\n\n    :Keywords:\n       *dirname*\n          set up under directory dirname [em]\n       *struct*\n          input structure (gro, pdb, ...) [solvate/ionized.gro]\n       *output*\n          output structure (will be put under dirname) [em.pdb]\n       *deffnm*\n          default name for mdrun-related files [em]\n       *top*\n          topology file [top/system.top]\n       *mdp*\n          mdp file (or use the template) [templates/em.mdp]\n       *includes*\n          additional directories to search for itp files\n       *mdrunner*\n          :class:`gromacs.run.MDrunner` instance; by default we\n          just try :func:`gromacs.mdrun_d` and :func:`gromacs.mdrun` but a\n          MDrunner instance gives the user the ability to run mpi jobs\n          etc. [None]\n       *mdrun_args*\n          arguments for *mdrunner* (as a dict), e.g. ``{'nt': 2}``;\n          empty by default\n\n          .. versionaddedd:: 0.7.0\n\n       *kwargs*\n          remaining key/value pairs that should be changed in the\n          template mdp file, eg ``nstxtcout=250, nstfout=250``.\n\n    .. note:: If :func:`~gromacs.mdrun_d` is not found, the function\n              falls back to :func:`~gromacs.mdrun` instead.\n    \"\"\"\n\n    arg_11 = realpath(arg_4)\n    arg_12 = realpath(arg_5)\n    arg_13 = arg_2.get_template(arg_1)\n    arg_7 = arg_7.strip()\n\n    arg_9 = {} if arg_9 is None else arg_9\n\n    # write the processed topology to the default output\n    arg_10.setdefault('pp', 'processed.top')\n\n    # filter some kwargs that might come through when feeding output\n    # from previous stages such as solvate(); necessary because *all*\n    # **kwargs must be *either* substitutions in the mdp file *or* valid\n    # command line parameters for ``grompp``.\n    arg_10.pop('ndx', None)\n    # mainselection is not used but only passed through; right now we\n    # set it to the default that is being used in all argument lists\n    # but that is not pretty. TODO.\n    arg_14 = arg_10.pop('mainselection', '\"Protein\"')\n    # only interesting when passed from solvate()\n    arg_15 = arg_10.pop('qtot', 0)\n\n    # mdp is now the *output* MDP that will be generated from mdp_template\n    arg_1 = arg_7+'.mdp'\n    arg_16 = arg_7+'.tpr'\n\n    logger.info(\"[{dirname!s}] Energy minimization of struct={struct!r}, top={top!r}, mdp={mdp!r} ...\".format(**vars()))\n\n    cbook.add_mdp_includes(arg_12, arg_10)\n\n    if arg_15 != 0:\n        # At the moment this is purely user-reported and really only here because\n        # it might get fed into the function when using the keyword-expansion pipeline\n        # usage paradigm.\n        arg_17 = \"Total charge was reported as qtot = {qtot:g} <> 0; probably a problem.\".format(**vars())\n        logger.warn(arg_17)\n        warnings.warn(arg_17, category=BadParameterWarning)\n\n    with in_dir(arg_0):\n        arg_18 = cbook.edit_mdp(arg_13, new_mdp=arg_1, **arg_10)\n        check_mdpargs(arg_18)\n        gromacs.grompp(f=arg_1, o=arg_16, c=arg_11, r=arg_11, p=arg_12, **arg_18)\n        arg_9.update(v=True, stepout=10, arg_7=arg_7, c=arg_6)\n        if arg_8 is None:\n            arg_19 = run.get_double_or_single_prec_mdrun()\n            arg_19(**arg_9)\n        else:\n            if type(arg_8) is type:\n                # class\n                # user wants full control and provides simulation.MDrunner **class**\n                # NO CHECKING --- in principle user can supply any callback they like\n                arg_19 = arg_8(**arg_9)\n                arg_19.run()\n            else:\n                # anything with a run() method that takes mdrun arguments...\n                try:\n                    arg_8.run(mdrunargs=arg_9)\n                except AttributeError:\n                    logger.error(\"mdrunner: Provide a gromacs.run.MDrunner class or instance or a callback with a run() method\")\n                    raise TypeError(\"mdrunner: Provide a gromacs.run.MDrunner class or instance or a callback with a run() method\")\n\n        # em.gro --> gives 'Bad box in file em.gro' warning --- why??\n        # --> use em.pdb instead.\n        if not os.path.exists(arg_6):\n            arg_20 = \"Energy minimized system NOT produced.\"\n            logger.error(arg_20)\n            raise GromacsError(arg_20)\n        arg_21 = realpath(arg_6)\n\n    logger.info(\"[{dirname!s}] energy minimized structure {final_struct!r}\".format(**vars()))\n    return {'struct': arg_21,\n            'top': arg_12,\n            'mainselection': arg_14,\n            }", "path": "gromacs/setup.py", "identifier": "energy_minimize", "docstring": "Energy minimize the system.\n\n    This sets up the system (creates run input files) and also runs\n    ``mdrun_d``. Thus it can take a while.\n\n    Additional itp files should be in the same directory as the top file.\n\n    Many of the keyword arguments below already have sensible values.\n\n    :Keywords:\n       *dirname*\n          set up under directory dirname [em]\n       *struct*\n          input structure (gro, pdb, ...) [solvate/ionized.gro]\n       *output*\n          output structure (will be put under dirname) [em.pdb]\n       *deffnm*\n          default name for mdrun-related files [em]\n       *top*\n          topology file [top/system.top]\n       *mdp*\n          mdp file (or use the template) [templates/em.mdp]\n       *includes*\n          additional directories to search for itp files\n       *mdrunner*\n          :class:`gromacs.run.MDrunner` instance; by default we\n          just try :func:`gromacs.mdrun_d` and :func:`gromacs.mdrun` but a\n          MDrunner instance gives the user the ability to run mpi jobs\n          etc. [None]\n       *mdrun_args*\n          arguments for *mdrunner* (as a dict), e.g. ``{'nt': 2}``;\n          empty by default\n\n          .. versionaddedd:: 0.7.0\n\n       *kwargs*\n          remaining key/value pairs that should be changed in the\n          template mdp file, eg ``nstxtcout=250, nstfout=250``.\n\n    .. note:: If :func:`~gromacs.mdrun_d` is not found, the function\n              falls back to :func:`~gromacs.mdrun` instead.", "docstring_tokens": ["Energy", "minimize", "the", "system", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 255364}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L608-L649", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Resolves current tree item of 'tree_alias' tree matching current\n        request path against URL of given tree item.", "language": "python", "parameters": "(self, tree_alias)", "return_statement": "return current_item", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_current_items", ".", "get", "(", "arg_1", ",", "_UNSET", ")", "if", "arg_2", "is", "not", "_UNSET", ":", "if", "arg_2", "is", "not", "None", ":", "arg_2", ".", "is_current", "=", "True", "return", "arg_2", "arg_2", "=", "None", "if", "arg_0", ".", "current_app_is_admin", "(", ")", ":", "arg_0", ".", "_current_items", "[", "arg_1", "]", "=", "arg_2", "return", "None", "arg_5", "=", "arg_0", ".", "current_request", ".", "path", "if", "isinstance", "(", "arg_5", ",", "str", ")", ":", "arg_5", "=", "arg_5", ".", "encode", "(", "'UTF-8'", ")", "if", "arg_5", ":", "arg_5", "=", "urlquote", "(", "arg_5", ")", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "_items_urls", ".", "items", "(", ")", ":", "if", "arg_7", "!=", "arg_5", ":", "continue", "arg_6", ".", "is_current", "=", "True", "if", "arg_6", ".", "tree", ".", "alias", "==", "arg_1", ":", "arg_2", "=", "arg_6", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "_current_items", "[", "arg_1", "]", "=", "arg_2", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Resolves current tree item of 'tree_alias' tree matching current\n        request path against URL of given tree item.\n\n        :param str|unicode tree_alias:\n        :rtype: TreeItemBase\n        \"\"\"\n        arg_2 = arg_0._current_items.get(arg_1, _UNSET)\n\n        if arg_2 is not _UNSET:\n\n            if arg_2 is not None:\n                arg_2.is_current = True  # Could be reset by .get_sitetree()\n\n            return arg_2\n\n        arg_2 = None\n\n        if arg_0.current_app_is_admin():\n            arg_0._current_items[arg_1] = arg_2\n            return None\n\n        # urlquote is an attempt to support non-ascii in url.\n        arg_5 = arg_0.current_request.path\n        if isinstance(arg_5, str):\n            arg_5 = arg_5.encode('UTF-8')\n        if arg_5:\n            arg_5 = urlquote(arg_5)\n\n        for arg_6, arg_7 in arg_0._items_urls.items():\n            # Iterate each as this dict may contains \"current\" items for various trees.\n            if arg_7 != arg_5:\n                continue\n\n            arg_6.is_current = True\n            if arg_6.tree.alias == arg_1:\n                arg_2 = arg_6\n\n        if arg_2 is not None:\n            arg_0._current_items[arg_1] = arg_2\n\n        return arg_2", "path": "sitetree/sitetreeapp.py", "identifier": "SiteTree.get_tree_current_item", "docstring": "Resolves current tree item of 'tree_alias' tree matching current\n        request path against URL of given tree item.\n\n        :param str|unicode tree_alias:\n        :rtype: TreeItemBase", "docstring_tokens": ["Resolves", "current", "tree", "item", "of", "tree_alias", "tree", "matching", "current", "request", "path", "against", "URL", "of", "given", "tree", "item", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 255365}
{"url": "https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L133-L140", "sha": "5b322f7c2b82a502b1e1b70703ae45f1f668d07d", "docstring_summary": "Encode and store a DISCONNECT control packet.", "language": "python", "parameters": "(self)", "return_statement": "return str(header) if PY2 else bytes(header)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "bytearray", "(", "2", ")", "arg_1", "[", "0", "]", "=", "0xE0", "arg_0", ".", "Funcd", "=", "arg_1", "return", "str", "(", "arg_1", ")", "if", "PY2", "else", "bytes", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        '''\n        Encode and store a DISCONNECT control packet.\n        '''\n        arg_1    = bytearray(2)\n        arg_1[0] = 0xE0\n        arg_0.Funcd = arg_1\n        return str(arg_1) if PY2 else bytes(arg_1)", "path": "mqtt/pdu.py", "identifier": "DISCONNECT.encode", "docstring": "Encode and store a DISCONNECT control packet.", "docstring_tokens": ["Encode", "and", "store", "a", "DISCONNECT", "control", "packet", "."], "nwo": "astrorafael/twisted-mqtt", "score": 0.28352459090240634, "idx": 255366}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/timeslots.py#L114-L120", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a new Timeslot shifted by `time`.", "language": "python", "parameters": "(self, time: int)", "return_statement": "return Timeslot(self.interval.shift(time), self.channel)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "'Timeslot'", ":", "return", "Timeslot", "(", "arg_0", ".", "interval", ".", "Func", "(", "arg_1", ")", ",", "arg_0", ".", "channel", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> 'Timeslot':\n        \"\"\"Return a new Timeslot Funced by `time`.\n\n        Args:\n            time: time to be Funced\n        \"\"\"\n        return Timeslot(arg_0.interval.Func(arg_1), arg_0.channel)", "path": "qiskit/pulse/timeslots.py", "identifier": "Timeslot.shift", "docstring": "Return a new Timeslot shifted by `time`.\n\n        Args:\n            time: time to be shifted", "docstring_tokens": ["Return", "a", "new", "Timeslot", "shifted", "by", "time", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255367}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L147-L151", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "returns a list of files that have finished structure", "language": "python", "parameters": "(self)", "return_statement": "return repfiles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "OPJ", "(", "arg_0", ".", "workdir", ",", "arg_0", ".", "name", "+", "\"-K-*-rep-*_f\"", ")", "arg_2", "=", "glob", ".", "glob", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" returns a list of files that have finished structure \"\"\"\n        arg_1 = OPJ(arg_0.workdir, arg_0.name+\"-K-*-rep-*_f\")\n        arg_2 = glob.glob(arg_1)\n        return arg_2", "path": "ipyrad/analysis/structure.py", "identifier": "Structure.result_files", "docstring": "returns a list of files that have finished structure", "docstring_tokens": ["returns", "a", "list", "of", "files", "that", "have", "finished", "structure"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 255368}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/abstractcpu.py#L601-L619", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Writes int to memory", "language": "python", "parameters": "(self, where, expression, size=None, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "address_bit_size", "assert", "arg_3", "in", "SANE_SIZES", "arg_0", ".", "_publish", "(", "'will_write_memory'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "[", "Operators", ".", "CHR", "(", "Operators", ".", "EXTRACT", "(", "arg_2", ",", "offset", ",", "8", ")", ")", "for", "offset", "in", "range", "(", "0", ",", "arg_3", ",", "8", ")", "]", "arg_0", ".", "_memory", ".", "write", "(", "arg_1", ",", "arg_5", ",", "arg_4", ")", "arg_0", ".", "_publish", "(", "'did_write_memory'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=False):\n        \"\"\"\n        Writes int to memory\n\n        :param int where: address to write to\n        :param expr: value to write\n        :type expr: int or BitVec\n        :param size: bit size of `expr`\n        :param force: whether to ignore memory permissions\n        \"\"\"\n        if arg_3 is None:\n            arg_3 = arg_0.address_bit_size\n        assert arg_3 in SANE_SIZES\n        arg_0._publish('will_write_memory', arg_1, arg_2, arg_3)\n\n        arg_5 = [Operators.CHR(Operators.EXTRACT(arg_2, offset, 8)) for offset in range(0, arg_3, 8)]\n        arg_0._memory.write(arg_1, arg_5, arg_4)\n\n        arg_0._publish('did_write_memory', arg_1, arg_2, arg_3)", "path": "manticore/native/cpu/abstractcpu.py", "identifier": "Cpu.write_int", "docstring": "Writes int to memory\n\n        :param int where: address to write to\n        :param expr: value to write\n        :type expr: int or BitVec\n        :param size: bit size of `expr`\n        :param force: whether to ignore memory permissions", "docstring_tokens": ["Writes", "int", "to", "memory"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 255369}
{"url": "https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L66-L83", "sha": "0334545885445834307c075a445fba9fe6f0c9e7", "docstring_summary": "Generate a single \"A or B or C\" regex from a list of shell globs.", "language": "python", "parameters": "(globs, prefix=False)", "return_statement": "return re.compile('|'.join(fnmatch.translate(x) for x in globs))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "not", "arg_0", ":", "return", "re", ".", "compile", "(", "'^$'", ")", "elif", "arg_1", ":", "arg_0", "=", "[", "arg_2", "+", "'*'", "for", "arg_2", "in", "arg_0", "]", "return", "re", ".", "compile", "(", "'|'", ".", "join", "(", "fnmatch", ".", "translate", "(", "arg_2", ")", "for", "arg_2", "in", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"Generate a single \"A or B or C\" regex from a list of shell globs.\n\n    :param globs: Patterns to be processed by :mod:`fnmatch`.\n    :type globs: iterable of :class:`~__builtins__.str`\n\n    :param prefix: If ``True``, then :meth:`~re.RegexObject.match` will\n        perform prefix matching rather than exact string matching.\n    :type prefix: :class:`~__builtins__.bool`\n\n    :rtype: :class:`re.RegexObject`\n    \"\"\"\n    if not arg_0:\n        # An empty globs list should only match empty strings\n        return re.compile('^$')\n    elif arg_1:\n        arg_0 = [arg_2 + '*' for arg_2 in arg_0]\n    return re.compile('|'.join(fnmatch.translate(arg_2) for arg_2 in arg_0))", "path": "fastdupes.py", "identifier": "multiglob_compile", "docstring": "Generate a single \"A or B or C\" regex from a list of shell globs.\n\n    :param globs: Patterns to be processed by :mod:`fnmatch`.\n    :type globs: iterable of :class:`~__builtins__.str`\n\n    :param prefix: If ``True``, then :meth:`~re.RegexObject.match` will\n        perform prefix matching rather than exact string matching.\n    :type prefix: :class:`~__builtins__.bool`\n\n    :rtype: :class:`re.RegexObject`", "docstring_tokens": ["Generate", "a", "single", "A", "or", "B", "or", "C", "regex", "from", "a", "list", "of", "shell", "globs", "."], "nwo": "ssokolow/fastdupes", "score": 0.4039778193346996, "idx": 255370}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L1713-L1756", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the data encoding the Credential struct to a stream.", "language": "python", "parameters": "(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "arg_6", "=", "BytearrayStream", "(", ")", "if", "arg_0", ".", "_credential_type", ":", "arg_0", ".", "_credential_type", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Credential struct missing the credential type.\"", ")", "if", "arg_0", ".", "_credential_value", ":", "arg_0", ".", "_credential_value", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Credential struct missing the credential value.\"", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "Credential", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the data encoding the Credential struct to a stream.\n\n        Args:\n            output_stream (stream): A data stream in which to encode object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if either the credential type or value are not\n                defined.\n        \"\"\"\n        arg_6 = BytearrayStream()\n\n        if arg_0._credential_type:\n            arg_0._credential_type.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise ValueError(\n                \"Credential struct missing the credential type.\"\n            )\n\n        if arg_0._credential_value:\n            arg_0._credential_value.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise ValueError(\n                \"Credential struct missing the credential value.\"\n            )\n\n        arg_0.length = arg_6.length()\n        super(Credential, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/objects.py", "identifier": "Credential.write", "docstring": "Write the data encoding the Credential struct to a stream.\n\n        Args:\n            output_stream (stream): A data stream in which to encode object\n                data, supporting a write method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if either the credential type or value are not\n                defined.", "docstring_tokens": ["Write", "the", "data", "encoding", "the", "Credential", "struct", "to", "a", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 255371}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/cells.py#L28-L47", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "If args and kwargs contains Cells, Convert them to their values.", "language": "python", "parameters": "(args, kwargs)", "return_statement": "return args, kwargs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "for", "arg_3", "in", "arg_0", ":", "if", "isinstance", "(", "arg_3", ",", "Cells", ")", ":", "arg_2", "=", "True", "break", "if", "arg_2", ":", "arg_0", "=", "tuple", "(", "arg_3", ".", "value", "if", "isinstance", "(", "arg_3", ",", "Cells", ")", "else", "arg_3", "for", "arg_3", "in", "arg_0", ")", "if", "arg_1", "is", "not", "None", ":", "for", "arg_4", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_3", ",", "Cells", ")", ":", "arg_1", "[", "arg_4", "]", "=", "arg_3", ".", "value", "return", "arg_0", ",", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"If args and kwargs contains Cells, Convert them to their values.\"\"\"\n\n    arg_2 = False\n    for arg_3 in arg_0:\n        if isinstance(arg_3, Cells):\n            arg_2 = True\n            break\n\n    if arg_2:\n        arg_0 = tuple(\n            arg_3.value if isinstance(arg_3, Cells) else arg_3 for arg_3 in arg_0\n        )\n\n    if arg_1 is not None:\n        for arg_4, arg_3 in arg_1.items():\n            if isinstance(arg_3, Cells):\n                arg_1[arg_4] = arg_3.value\n\n    return arg_0, arg_1", "path": "modelx/core/cells.py", "identifier": "convert_args", "docstring": "If args and kwargs contains Cells, Convert them to their values.", "docstring_tokens": ["If", "args", "and", "kwargs", "contains", "Cells", "Convert", "them", "to", "their", "values", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 255372}
{"url": "https://github.com/cs01/pygdbmi/blob/709c781794d3c3b903891f83da011d2d995895d1/pygdbmi/gdbcontroller.py#L168-L178", "sha": "709c781794d3c3b903891f83da011d2d995895d1", "docstring_summary": "Verify there is a process object, and that it is still running.\n        Raise NoGdbProcessError if either of the above are not true.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "gdb_process", ":", "raise", "NoGdbProcessError", "(", "\"gdb process is not attached\"", ")", "elif", "arg_0", ".", "gdb_process", ".", "poll", "(", ")", "is", "not", "None", ":", "raise", "NoGdbProcessError", "(", "\"gdb process has already finished with return code: %s\"", "%", "str", "(", "arg_0", ".", "gdb_process", ".", "poll", "(", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Verify there is a process object, and that it is still running.\n        Raise NoGdbProcessError if either of the above are not true.\"\"\"\n        if not arg_0.gdb_process:\n            raise NoGdbProcessError(\"gdb process is not attached\")\n\n        elif arg_0.gdb_process.poll() is not None:\n            raise NoGdbProcessError(\n                \"gdb process has already finished with return code: %s\"\n                % str(arg_0.gdb_process.poll())\n            )", "path": "pygdbmi/gdbcontroller.py", "identifier": "GdbController.verify_valid_gdb_subprocess", "docstring": "Verify there is a process object, and that it is still running.\n        Raise NoGdbProcessError if either of the above are not true.", "docstring_tokens": ["Verify", "there", "is", "a", "process", "object", "and", "that", "it", "is", "still", "running", ".", "Raise", "NoGdbProcessError", "if", "either", "of", "the", "above", "are", "not", "true", "."], "nwo": "cs01/pygdbmi", "score": 0.565001601112863, "idx": 255373}
{"url": "https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L472-L487", "sha": "b45395b1aba41301b898040acade7010e6878a08", "docstring_summary": "Update timeout for all throttles", "language": "python", "parameters": "(self, name, data, start)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "for", "arg_4", "in", "arg_0", ".", "throttles", ".", "values", "(", ")", ":", "getattr", "(", "arg_4", ",", "arg_1", ")", ".", "Func", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Update timeout for all throttles\n\n        :param name: name of throttle to Func to (\"read\" or \"write\")\n        :type name: :py:class:`str`\n\n        :param data: bytes of data for count\n        :type data: :py:class:`bytes`\n\n        :param start: start of read/write time from\n            :py:meth:`asyncio.BaseEventLoop.time`\n        :type start: :py:class:`float`\n        \"\"\"\n        for arg_4 in arg_0.throttles.values():\n            getattr(arg_4, arg_1).Func(arg_2, arg_3)", "path": "aioftp/common.py", "identifier": "ThrottleStreamIO.append", "docstring": "Update timeout for all throttles\n\n        :param name: name of throttle to append to (\"read\" or \"write\")\n        :type name: :py:class:`str`\n\n        :param data: bytes of data for count\n        :type data: :py:class:`bytes`\n\n        :param start: start of read/write time from\n            :py:meth:`asyncio.BaseEventLoop.time`\n        :type start: :py:class:`float`", "docstring_tokens": ["Update", "timeout", "for", "all", "throttles"], "nwo": "aio-libs/aioftp", "score": 0.5742192901431463, "idx": 255374}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/formatters.py#L253-L272", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Add a format function for a given type.", "language": "python", "parameters": "(self, typ, func)", "return_statement": "return oldfunc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "type_printers", ".", "get", "(", "arg_1", ",", "None", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "type_printers", "[", "arg_1", "]", "=", "arg_2", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add a format function for a given type.\n\n        Parameters\n        -----------\n        typ : class\n            The class of the object that will be formatted using `func`.\n        func : callable\n            The callable that will be called to compute the format data. The\n            call signature of this function is simple, it must take the\n            object to be formatted and return the raw data for the given\n            format. Subclasses may use a different call signature for the\n            `func` argument.\n        \"\"\"\n        arg_3 = arg_0.type_printers.get(arg_1, None)\n        if arg_2 is not None:\n            # To support easy restoration of old printers, we need to ignore\n            # Nones.\n            arg_0.type_printers[arg_1] = arg_2\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/core/formatters.py", "identifier": "BaseFormatter.for_type", "docstring": "Add a format function for a given type.\n\n        Parameters\n        -----------\n        typ : class\n            The class of the object that will be formatted using `func`.\n        func : callable\n            The callable that will be called to compute the format data. The\n            call signature of this function is simple, it must take the\n            object to be formatted and return the raw data for the given\n            format. Subclasses may use a different call signature for the\n            `func` argument.", "docstring_tokens": ["Add", "a", "format", "function", "for", "a", "given", "type", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255375}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L714-L720", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return a list of wikilink objects.", "language": "python", "parameters": "(self)", "return_statement": "return [\n            WikiLink(_lststr, _type_to_spans, span, 'WikiLink')\n            for span in self._subspans('WikiLink')]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "List", "[", "'WikiLink'", "]", ":", "arg_1", "=", "arg_0", ".", "_lststr", "arg_2", "=", "arg_0", ".", "_type_to_spans", "return", "[", "WikiLink", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "'WikiLink'", ")", "for", "arg_3", "in", "arg_0", ".", "_subspans", "(", "'WikiLink'", ")", "]"], "function": "def Func(arg_0) -> List['WikiLink']:\n        \"\"\"Return a list of wikilink objects.\"\"\"\n        arg_1 = arg_0._lststr\n        arg_2 = arg_0._type_to_spans\n        return [\n            WikiLink(arg_1, arg_2, arg_3, 'WikiLink')\n            for arg_3 in arg_0._subspans('WikiLink')]", "path": "wikitextparser/_wikitext.py", "identifier": "WikiText.wikilinks", "docstring": "Return a list of wikilink objects.", "docstring_tokens": ["Return", "a", "list", "of", "wikilink", "objects", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 255376}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L180-L230", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Extract call tip data from an oinfo dict.", "language": "python", "parameters": "(oinfo, format_call=True)", "return_statement": "return call_line, doc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "arg_0", ".", "get", "(", "'argspec'", ")", "if", "arg_2", "is", "None", ":", "arg_3", "=", "None", "else", ":", "try", ":", "arg_4", "=", "arg_2", "[", "'args'", "]", "[", "0", "]", "==", "'self'", "except", "(", "KeyError", ",", "IndexError", ")", ":", "pass", "else", ":", "if", "arg_4", ":", "arg_2", "[", "'args'", "]", "=", "arg_2", "[", "'args'", "]", "[", "1", ":", "]", "arg_3", "=", "arg_0", "[", "'name'", "]", "+", "format_argspec", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "get", "(", "'call_docstring'", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "arg_0", ".", "get", "(", "'init_docstring'", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "arg_0", ".", "get", "(", "'docstring'", ",", "''", ")", "return", "arg_3", ",", "arg_5"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Extract call tip data from an oinfo dict.\n\n    Parameters\n    ----------\n    oinfo : dict\n\n    format_call : bool, optional\n      If True, the call line is formatted and returned as a string.  If not, a\n      tuple of (name, argspec) is returned.\n\n    Returns\n    -------\n    call_info : None, str or (str, dict) tuple.\n      When format_call is True, the whole call information is formattted as a\n      single string.  Otherwise, the object's name and its argspec dict are\n      returned.  If no call information is available, None is returned.\n\n    docstring : str or None\n      The most relevant docstring for calling purposes is returned, if\n      available.  The priority is: call docstring for callable instances, then\n      constructor docstring for classes, then main object's docstring otherwise\n      (regular functions).\n    \"\"\"\n    # Get call definition\n    arg_2 = arg_0.get('argspec')\n    if arg_2 is None:\n        arg_3 = None\n    else:\n        # Callable objects will have 'self' as their first argument, prune\n        # it out if it's there for clarity (since users do *not* pass an\n        # extra first argument explicitly).\n        try:\n            arg_4 = arg_2['args'][0] == 'self'\n        except (KeyError, IndexError):\n            pass\n        else:\n            if arg_4:\n                arg_2['args'] = arg_2['args'][1:]\n\n        arg_3 = arg_0['name']+format_argspec(arg_2)\n\n    # Now get docstring.\n    # The priority is: call docstring, constructor docstring, main one.\n    arg_5 = arg_0.get('call_docstring')\n    if arg_5 is None:\n        arg_5 = arg_0.get('init_docstring')\n    if arg_5 is None:\n        arg_5 = arg_0.get('docstring','')\n\n    return arg_3, arg_5", "path": "environment/lib/python2.7/site-packages/IPython/core/oinspect.py", "identifier": "call_tip", "docstring": "Extract call tip data from an oinfo dict.\n\n    Parameters\n    ----------\n    oinfo : dict\n\n    format_call : bool, optional\n      If True, the call line is formatted and returned as a string.  If not, a\n      tuple of (name, argspec) is returned.\n\n    Returns\n    -------\n    call_info : None, str or (str, dict) tuple.\n      When format_call is True, the whole call information is formattted as a\n      single string.  Otherwise, the object's name and its argspec dict are\n      returned.  If no call information is available, None is returned.\n\n    docstring : str or None\n      The most relevant docstring for calling purposes is returned, if\n      available.  The priority is: call docstring for callable instances, then\n      constructor docstring for classes, then main object's docstring otherwise\n      (regular functions).", "docstring_tokens": ["Extract", "call", "tip", "data", "from", "an", "oinfo", "dict", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255377}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L40-L58", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Load multiple images from file into an ndarray.", "language": "python", "parameters": "(filenames, masker, nan_to_num=True)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "isinstance", "(", "arg_0", ",", "string_types", ")", ":", "arg_0", "=", "[", "arg_0", "]", "arg_3", "=", "np", ".", "zeros", "(", "(", "arg_1", ".", "n_vox_in_mask", ",", "len", "(", "arg_0", ")", ")", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_0", ")", ":", "arg_3", "[", ":", ",", "arg_4", "]", "=", "arg_1", ".", "mask", "(", "arg_5", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\" Load multiple images from file into an ndarray.\n\n    Args:\n      filenames: A single filename or list of filenames pointing to valid\n        images.\n      masker: A Masker instance.\n      nan_to_num: Optional boolean indicating whether to convert NaNs to zero.\n\n    Returns:\n      An m x n 2D numpy array, where m = number of voxels in mask and\n      n = number of images passed.\n    \"\"\"\n    if isinstance(arg_0, string_types):\n        arg_0 = [arg_0]\n    arg_3 = np.zeros((arg_1.n_vox_in_mask, len(arg_0)))\n    for arg_4, arg_5 in enumerate(arg_0):\n        arg_3[:, arg_4] = arg_1.mask(arg_5, arg_2)\n    return arg_3", "path": "neurosynth/base/imageutils.py", "identifier": "load_imgs", "docstring": "Load multiple images from file into an ndarray.\n\n    Args:\n      filenames: A single filename or list of filenames pointing to valid\n        images.\n      masker: A Masker instance.\n      nan_to_num: Optional boolean indicating whether to convert NaNs to zero.\n\n    Returns:\n      An m x n 2D numpy array, where m = number of voxels in mask and\n      n = number of images passed.", "docstring_tokens": ["Load", "multiple", "images", "from", "file", "into", "an", "ndarray", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 255378}
{"url": "https://github.com/hui-z/ForgiveDB/blob/cc94e87377a230e23a8e55dffe07047c34c33d6e/forgive/db.py#L37-L45", "sha": "cc94e87377a230e23a8e55dffe07047c34c33d6e", "docstring_summary": "Set key value", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "in_memory", ":", "arg_0", ".", "_memory_db", "[", "arg_1", "]", "=", "arg_2", "else", ":", "arg_4", "=", "arg_0", ".", "_read_file", "(", ")", "arg_4", "[", "arg_1", "]", "=", "arg_2", "with", "open", "(", "arg_0", ".", "db_path", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "json", ".", "dumps", "(", "arg_4", ",", "ensure_ascii", "=", "False", ",", "indent", "=", "2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Set key value \"\"\"\n        if arg_0.in_memory:\n            arg_0._memory_db[arg_1] = arg_2\n        else:\n            arg_4 = arg_0._read_file()\n            arg_4[arg_1] = arg_2\n            with open(arg_0.db_path, 'w') as f:\n                f.write(json.dumps(arg_4, ensure_ascii=False, indent=2))", "path": "forgive/db.py", "identifier": "ForgiveDB.set", "docstring": "Set key value", "docstring_tokens": ["Set", "key", "value"], "nwo": "hui-z/ForgiveDB", "score": 0.2774215055066499, "idx": 255379}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/server_cache.py#L44-L60", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Get a new or existing server for this key.", "language": "python", "parameters": "(self, key, **kwds)", "return_statement": "return server", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", "=", "dict", "(", "arg_0", ".", "kwds", ",", "**", "arg_2", ")", "arg_3", "=", "arg_0", ".", "servers", ".", "get", "(", "arg_1", ")", "if", "arg_3", ":", "arg_3", ".", "check_keywords", "(", "arg_0", ".", "constructor", ",", "arg_2", ")", "else", ":", "arg_3", "=", "_CachedServer", "(", "arg_0", ".", "constructor", ",", "arg_1", ",", "arg_2", ")", "arg_0", ".", "servers", "[", "arg_1", "]", "=", "arg_3", "return", "arg_3"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Get a new or existing server for this key.\n\n        :param int key: key for the server to use\n        \"\"\"\n        arg_2 = dict(arg_0.kwds, **arg_2)\n        arg_3 = arg_0.servers.get(arg_1)\n        if arg_3:\n            # Make sure it's the right server.\n            arg_3.check_keywords(arg_0.constructor, arg_2)\n        else:\n            # Make a new server\n            arg_3 = _CachedServer(arg_0.constructor, arg_1, arg_2)\n            arg_0.servers[arg_1] = arg_3\n\n        return arg_3", "path": "bibliopixel/util/server_cache.py", "identifier": "ServerCache.get_server", "docstring": "Get a new or existing server for this key.\n\n        :param int key: key for the server to use", "docstring_tokens": ["Get", "a", "new", "or", "existing", "server", "for", "this", "key", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 255380}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/concurrently/TaskPackageDropbox.py#L135-L160", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "return pairs of package indices and results of all tasks", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "while", "True", ":", "if", "arg_0", ".", "runid_pkgidx_map", ":", "arg_0", ".", "runid_to_return", ".", "extend", "(", "arg_0", ".", "dispatcher", ".", "poll", "(", ")", ")", "arg_1", ".", "extend", "(", "arg_0", ".", "_collect_all_finished_pkgidx_result_pairs", "(", ")", ")", "if", "not", "arg_0", ".", "runid_pkgidx_map", ":", "break", "time", ".", "sleep", "(", "arg_0", ".", "sleep", ")", "arg_1", "=", "sorted", "(", "arg_1", ",", "key", "=", "itemgetter", "(", "0", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"return pairs of package indices and results of all tasks\n\n        This method waits until all tasks finish.\n\n        Returns\n        -------\n        list\n            A list of pairs of package indices and results\n\n        \"\"\"\n\n        arg_1 = [ ] # a list of (pkgid, result)\n        while True:\n\n            if arg_0.runid_pkgidx_map:\n                arg_0.runid_to_return.extend(arg_0.dispatcher.poll())\n                arg_1.extend(arg_0._collect_all_finished_pkgidx_result_pairs())\n\n            if not arg_0.runid_pkgidx_map:\n                break\n            time.sleep(arg_0.sleep)\n\n        arg_1 = sorted(arg_1, key=itemgetter(0))\n\n        return arg_1", "path": "alphatwirl/concurrently/TaskPackageDropbox.py", "identifier": "TaskPackageDropbox.receive", "docstring": "return pairs of package indices and results of all tasks\n\n        This method waits until all tasks finish.\n\n        Returns\n        -------\n        list\n            A list of pairs of package indices and results", "docstring_tokens": ["return", "pairs", "of", "package", "indices", "and", "results", "of", "all", "tasks"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 255381}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/plugins/media_page.py#L69-L83", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Generates and writes the media pages for all media in the gallery", "language": "python", "parameters": "(gallery)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "PageWriter", "(", "arg_0", ".", "settings", ",", "index_title", "=", "arg_0", ".", "title", ")", "for", "arg_2", "in", "arg_0", ".", "albums", ".", "values", "(", ")", ":", "arg_3", "=", "arg_2", ".", "medias", "arg_4", "=", "arg_3", "[", "1", ":", "]", "+", "[", "None", "]", "arg_5", "=", "[", "None", "]", "+", "arg_3", "[", ":", "-", "1", "]", "arg_6", "=", "zip", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", "for", "arg_7", "in", "arg_6", ":", "arg_1", ".", "write", "(", "arg_2", ",", "arg_7", ")"], "function": "def Func(arg_0):\n    '''Generates and writes the media pages for all media in the gallery'''\n\n    arg_1 = PageWriter(arg_0.settings, index_title=arg_0.title)\n\n    for arg_2 in arg_0.albums.values():\n        arg_3 = arg_2.medias\n        arg_4 = arg_3[1:] + [None]\n        arg_5 = [None] + arg_3[:-1]\n\n        # The media group allows us to easily get next and previous links\n        arg_6 = zip(arg_3, arg_4, arg_5)\n\n        for arg_7 in arg_6:\n            arg_1.write(arg_2, arg_7)", "path": "sigal/plugins/media_page.py", "identifier": "generate_media_pages", "docstring": "Generates and writes the media pages for all media in the gallery", "docstring_tokens": ["Generates", "and", "writes", "the", "media", "pages", "for", "all", "media", "in", "the", "gallery"], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 255382}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/utils.py#L832-L841", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Combines all masks from a list of arrays, and logically ors them into a single mask", "language": "python", "parameters": "(arrays)", "return_statement": "return arrays, mask", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "np", ".", "ma", ".", "getmaskarray", "(", "block", ")", "for", "block", "in", "arg_0", "if", "np", ".", "ma", ".", "isMaskedArray", "(", "block", ")", "]", "arg_0", "=", "[", "block", ".", "data", "if", "np", ".", "ma", ".", "isMaskedArray", "(", "block", ")", "else", "block", "for", "block", "in", "arg_0", "]", "arg_2", "=", "None", "if", "arg_1", ":", "arg_2", "=", "arg_1", "[", "0", "]", ".", "copy", "(", ")", "for", "arg_3", "in", "arg_1", "[", "1", ":", "]", ":", "arg_2", "|=", "arg_3", "return", "arg_0", ",", "arg_2"], "function": "def Func(arg_0):\n\t'''Combines all masks from a list of arrays, and logically ors them into a single mask'''\n\targ_1 = [np.ma.getmaskarray(block) for block in arg_0 if np.ma.isMaskedArray(block)]\n\targ_0 = [block.data if np.ma.isMaskedArray(block) else block for block in arg_0]\n\targ_2 = None\n\tif arg_1:\n\t\targ_2 = arg_1[0].copy()\n\t\tfor arg_3 in arg_1[1:]:\n\t\t\targ_2 |= arg_3\n\treturn arg_0, arg_2", "path": "packages/vaex-core/vaex/utils.py", "identifier": "_split_and_combine_mask", "docstring": "Combines all masks from a list of arrays, and logically ors them into a single mask", "docstring_tokens": ["Combines", "all", "masks", "from", "a", "list", "of", "arrays", "and", "logically", "ors", "them", "into", "a", "single", "mask"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 255383}
{"url": "https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L172-L180", "sha": "074c8452f15a0da638668a4fe139fde06ccfae7f", "docstring_summary": "Dixon-Price function", "language": "python", "parameters": "(theta)", "return_statement": "return obj, grad", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", "arg_3", "=", "(", "arg_1", "-", "1", ")", "**", "2", "+", "2", "*", "(", "2", "*", "arg_2", "**", "2", "-", "arg_1", ")", "**", "2", "arg_4", "=", "np", ".", "array", "(", "[", "2", "*", "arg_1", "-", "2", "-", "4", "*", "(", "2", "*", "arg_2", "**", "2", "-", "arg_1", ")", ",", "16", "*", "(", "2", "*", "arg_2", "**", "2", "-", "arg_1", ")", "*", "arg_2", ",", "]", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Dixon-Price function\"\"\"\n    arg_1, arg_2 = arg_0\n    arg_3 = (arg_1 - 1) ** 2 + 2 * (2 * arg_2 ** 2 - arg_1) ** 2\n    arg_4 = np.array([\n        2 * arg_1 - 2 - 4 * (2 * arg_2 ** 2 - arg_1),\n        16 * (2 * arg_2 ** 2 - arg_1) * arg_2,\n    ])\n    return arg_3, arg_4", "path": "descent/objectives.py", "identifier": "dixon_price", "docstring": "Dixon-Price function", "docstring_tokens": ["Dixon", "-", "Price", "function"], "nwo": "nirum/descent", "score": 0.18112697196067942, "idx": 255384}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/view.py#L44-L54", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Keep our history and outstanding attributes up to date after a method call.", "language": "python", "parameters": "(f, self, *args, **kwargs)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "len", "(", "arg_1", ".", "client", ".", "history", ")", "try", ":", "arg_5", "=", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "finally", ":", "arg_6", "=", "len", "(", "arg_1", ".", "client", ".", "history", ")", "-", "arg_4", "arg_7", "=", "arg_1", ".", "client", ".", "history", "[", "-", "arg_6", ":", "]", "arg_1", ".", "history", ".", "extend", "(", "arg_7", ")", "map", "(", "arg_1", ".", "outstanding", ".", "add", ",", "arg_7", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n    \"\"\"Keep our history and outstanding attributes up to date after a method call.\"\"\"\n    arg_4 = len(arg_1.client.history)\n    try:\n        arg_5 = arg_0(arg_1, *arg_2, **arg_3)\n    finally:\n        arg_6 = len(arg_1.client.history) - arg_4\n        arg_7 = arg_1.client.history[-arg_6:]\n        arg_1.history.extend(arg_7)\n        map(arg_1.outstanding.add, arg_7)\n    return arg_5", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/view.py", "identifier": "save_ids", "docstring": "Keep our history and outstanding attributes up to date after a method call.", "docstring_tokens": ["Keep", "our", "history", "and", "outstanding", "attributes", "up", "to", "date", "after", "a", "method", "call", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255385}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/util/array_util.py#L392-L415", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Read a 2D NumPy array to a .fits file.", "language": "python", "parameters": "(file_path, hdu)", "return_statement": "return np.flipud(np.array(hdu_list[hdu].data))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "fits", ".", "open", "(", "arg_0", ")", "return", "np", ".", "flipud", "(", "np", ".", "array", "(", "arg_2", "[", "arg_1", "]", ".", "data", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Read a 2D NumPy array to a .fits file.\n\n    After loading the NumPy array, the array is flipped upside-down using np.flipud. This is so that the arrays \\\n    appear the same orientation as .fits files loaded in DS9.\n\n    Parameters\n    ----------\n    file_path : str\n        The full path of the file that is loaded, including the file name and '.fits' extension.\n    hdu : int\n        The HDU extension of the array that is loaded from the .fits file.\n\n    Returns\n    -------\n    ndarray\n        The NumPy array that is loaded from the .fits file.\n\n    Examples\n    --------\n    array_2d = numpy_array_from_fits(file_path='/path/to/file/filename.fits', hdu=0)\n    \"\"\"\n    arg_2 = fits.open(arg_0)\n    return np.flipud(np.array(arg_2[arg_1].data))", "path": "autolens/data/array/util/array_util.py", "identifier": "numpy_array_2d_from_fits", "docstring": "Read a 2D NumPy array to a .fits file.\n\n    After loading the NumPy array, the array is flipped upside-down using np.flipud. This is so that the arrays \\\n    appear the same orientation as .fits files loaded in DS9.\n\n    Parameters\n    ----------\n    file_path : str\n        The full path of the file that is loaded, including the file name and '.fits' extension.\n    hdu : int\n        The HDU extension of the array that is loaded from the .fits file.\n\n    Returns\n    -------\n    ndarray\n        The NumPy array that is loaded from the .fits file.\n\n    Examples\n    --------\n    array_2d = numpy_array_from_fits(file_path='/path/to/file/filename.fits', hdu=0)", "docstring_tokens": ["Read", "a", "2D", "NumPy", "array", "to", "a", ".", "fits", "file", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 255386}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/nodebox.py#L227-L246", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Draws a star.", "language": "python", "parameters": "(self, startx, starty, points=20, outer=100, inner=50, draw=True, **kwargs)", "return_statement": "return self.endpath(draw)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "20", ",", "arg_4", "=", "100", ",", "arg_5", "=", "50", ",", "arg_6", "=", "True", ",", "**", "arg_7", ")", ":", "arg_0", ".", "beginpath", "(", "**", "arg_7", ")", "arg_0", ".", "moveto", "(", "arg_1", ",", "arg_2", "+", "arg_4", ")", "for", "arg_8", "in", "range", "(", "1", ",", "int", "(", "2", "*", "arg_3", ")", ")", ":", "arg_9", "=", "arg_8", "*", "pi", "/", "arg_3", "arg_10", "=", "sin", "(", "arg_9", ")", "arg_11", "=", "cos", "(", "arg_9", ")", "if", "arg_8", "%", "2", ":", "arg_12", "=", "arg_5", "else", ":", "arg_12", "=", "arg_4", "arg_10", "=", "arg_1", "+", "arg_12", "*", "arg_10", "arg_11", "=", "arg_2", "+", "arg_12", "*", "arg_11", "arg_0", ".", "lineto", "(", "arg_10", ",", "arg_11", ")", "return", "arg_0", ".", "endpath", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=20, arg_4=100, arg_5=50, arg_6=True, **arg_7):\n        '''Draws a Func.\n        '''\n        # Taken from Nodebox.\n        arg_0.beginpath(**arg_7)\n        arg_0.moveto(arg_1, arg_2 + arg_4)\n\n        for arg_8 in range(1, int(2 * arg_3)):\n            arg_9 = arg_8 * pi / arg_3\n            arg_10 = sin(arg_9)\n            arg_11 = cos(arg_9)\n            if arg_8 % 2:\n                arg_12 = arg_5\n            else:\n                arg_12 = arg_4\n            arg_10 = arg_1 + arg_12 * arg_10\n            arg_11 = arg_2 + arg_12 * arg_11\n            arg_0.lineto(arg_10, arg_11)\n\n        return arg_0.endpath(arg_6)", "path": "shoebot/grammar/nodebox.py", "identifier": "NodeBot.star", "docstring": "Draws a star.", "docstring_tokens": ["Draws", "a", "star", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255387}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/docs/examples/network/complete-network-example.py#L34-L42", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Create required links from a sensor region to a classifier region.", "language": "python", "parameters": "(network, sensorRegionName,\n                                  classifierRegionName)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "link", "(", "arg_1", ",", "arg_2", ",", "\"UniformLink\"", ",", "\"\"", ",", "srcOutput", "=", "\"bucketIdxOut\"", ",", "destInput", "=", "\"bucketIdxIn\"", ")", "arg_0", ".", "link", "(", "arg_1", ",", "arg_2", ",", "\"UniformLink\"", ",", "\"\"", ",", "srcOutput", "=", "\"actValueOut\"", ",", "destInput", "=", "\"actValueIn\"", ")", "arg_0", ".", "link", "(", "arg_1", ",", "arg_2", ",", "\"UniformLink\"", ",", "\"\"", ",", "srcOutput", "=", "\"categoryOut\"", ",", "destInput", "=", "\"categoryIn\"", ")"], "function": "def Func(arg_0, arg_1,\n                                  arg_2):\n  \"\"\"Create required links from a sensor region to a classifier region.\"\"\"\n  arg_0.link(arg_1, arg_2, \"UniformLink\", \"\",\n               srcOutput=\"bucketIdxOut\", destInput=\"bucketIdxIn\")\n  arg_0.link(arg_1, arg_2, \"UniformLink\", \"\",\n               srcOutput=\"actValueOut\", destInput=\"actValueIn\")\n  arg_0.link(arg_1, arg_2, \"UniformLink\", \"\",\n               srcOutput=\"categoryOut\", destInput=\"categoryIn\")", "path": "docs/examples/network/complete-network-example.py", "identifier": "createSensorToClassifierLinks", "docstring": "Create required links from a sensor region to a classifier region.", "docstring_tokens": ["Create", "required", "links", "from", "a", "sensor", "region", "to", "a", "classifier", "region", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255388}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1770-L1807", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reads one line of input from the user.", "language": "python", "parameters": "(self, prompt='', callback=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", ".", "_reading", ":", "raise", "RuntimeError", "(", "'Cannot read a line. Widget is already reading.'", ")", "if", "not", "arg_2", "and", "not", "arg_0", ".", "isVisible", "(", ")", ":", "raise", "RuntimeError", "(", "'Cannot synchronously read a line if the widget '", "'is not visible!'", ")", "arg_0", ".", "_reading", "=", "True", "arg_0", ".", "_show_prompt", "(", "arg_1", ",", "newline", "=", "False", ")", "if", "arg_2", "is", "None", ":", "arg_0", ".", "_reading_callback", "=", "None", "while", "arg_0", ".", "_reading", ":", "QtCore", ".", "QCoreApplication", ".", "processEvents", "(", ")", "return", "arg_0", ".", "_get_input_buffer", "(", "force", "=", "True", ")", ".", "rstrip", "(", "'\\n'", ")", "else", ":", "arg_0", ".", "_reading_callback", "=", "lambda", ":", "arg_2", "(", "arg_0", ".", "_get_input_buffer", "(", "force", "=", "True", ")", ".", "rstrip", "(", "'\\n'", ")", ")"], "function": "def Func(arg_0, arg_1='', arg_2=None):\n        \"\"\" Reads one line of input from the user.\n\n        Parameters\n        ----------\n        prompt : str, optional\n            The prompt to print before reading the line.\n\n        callback : callable, optional\n            A callback to execute with the read line. If not specified, input is\n            read *synchronously* and this method does not return until it has\n            been read.\n\n        Returns\n        -------\n        If a callback is specified, returns nothing. Otherwise, returns the\n        input string with the trailing newline stripped.\n        \"\"\"\n        if arg_0._reading:\n            raise RuntimeError('Cannot read a line. Widget is already reading.')\n\n        if not arg_2 and not arg_0.isVisible():\n            # If the user cannot see the widget, this function cannot return.\n            raise RuntimeError('Cannot synchronously read a line if the widget '\n                               'is not visible!')\n\n        arg_0._reading = True\n        arg_0._show_prompt(arg_1, newline=False)\n\n        if arg_2 is None:\n            arg_0._reading_callback = None\n            while arg_0._reading:\n                QtCore.QCoreApplication.processEvents()\n            return arg_0._get_input_buffer(force=True).rstrip('\\n')\n\n        else:\n            arg_0._reading_callback = lambda: \\\n                arg_2(arg_0._get_input_buffer(force=True).rstrip('\\n'))", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._readline", "docstring": "Reads one line of input from the user.\n\n        Parameters\n        ----------\n        prompt : str, optional\n            The prompt to print before reading the line.\n\n        callback : callable, optional\n            A callback to execute with the read line. If not specified, input is\n            read *synchronously* and this method does not return until it has\n            been read.\n\n        Returns\n        -------\n        If a callback is specified, returns nothing. Otherwise, returns the\n        input string with the trailing newline stripped.", "docstring_tokens": ["Reads", "one", "line", "of", "input", "from", "the", "user", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255389}
{"url": "https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/data.py#L103-L123", "sha": "716845562a2bbb430de3c379c9481b195e451ccf", "docstring_summary": "Handle YOURLS API errors.", "language": "python", "parameters": "(http_exc, jsondata, response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "'code'", "in", "arg_1", "and", "'message'", "in", "arg_1", ":", "arg_3", "=", "arg_1", "[", "'code'", "]", "arg_4", "=", "arg_1", "[", "'message'", "]", "if", "arg_3", "==", "'error:noloop'", ":", "raise", "YOURLSNoLoopError", "(", "arg_4", ",", "arg_2", "=", "arg_2", ")", "elif", "arg_3", "==", "'error:nourl'", ":", "raise", "YOURLSNoURLError", "(", "arg_4", ",", "arg_2", "=", "arg_2", ")", "elif", "'message'", "in", "arg_1", ":", "arg_4", "=", "arg_1", "[", "'message'", "]", "raise", "YOURLSHTTPError", "(", "arg_4", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "arg_0", ".", "args", "[", "0", "]", "raise", "YOURLSHTTPError", "(", "arg_5", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Handle YOURLS API errors.\n\n    requests' raise_for_status doesn't show the user the YOURLS json response,\n    so we parse that here and raise nicer exceptions.\n    \"\"\"\n    if 'code' in arg_1 and 'message' in arg_1:\n        arg_3 = arg_1['code']\n        arg_4 = arg_1['message']\n\n        if arg_3 == 'error:noloop':\n            raise YOURLSNoLoopError(arg_4, arg_2=arg_2)\n        elif arg_3 == 'error:nourl':\n            raise YOURLSNoURLError(arg_4, arg_2=arg_2)\n\n    elif 'message' in arg_1:\n        arg_4 = arg_1['message']\n        raise YOURLSHTTPError(arg_4, arg_2=arg_2)\n\n    arg_5 = arg_0.args[0]\n    raise YOURLSHTTPError(arg_5, arg_2=arg_2)", "path": "yourls/data.py", "identifier": "_handle_api_error_with_json", "docstring": "Handle YOURLS API errors.\n\n    requests' raise_for_status doesn't show the user the YOURLS json response,\n    so we parse that here and raise nicer exceptions.", "docstring_tokens": ["Handle", "YOURLS", "API", "errors", "."], "nwo": "RazerM/yourls-python", "score": 0.3518893757964147, "idx": 255390}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/concurrently/WorkingArea.py#L234-L256", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "Returns the full path of the package", "language": "python", "parameters": "(self, package_index)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "path", ",", "arg_0", ".", "package_relpath", "(", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns the full path of the package\n\n        This method returns the full path to the package. This method\n        simply constructs the path based on the convention and doesn't\n        check if the package actually exists.\n\n        Parameters\n        ----------\n        package_index :\n            a package index\n\n        Returns\n        -------\n        str\n            the full path to the package\n\n        \"\"\"\n\n        arg_2 = os.path.join(arg_0.path, arg_0.package_relpath(arg_1))\n        # e.g., '{path}/tpd_20161129_122841_HnpcmF/task_00009.p.gz'\n\n        return arg_2", "path": "alphatwirl/concurrently/WorkingArea.py", "identifier": "WorkingArea.package_fullpath", "docstring": "Returns the full path of the package\n\n        This method returns the full path to the package. This method\n        simply constructs the path based on the convention and doesn't\n        check if the package actually exists.\n\n        Parameters\n        ----------\n        package_index :\n            a package index\n\n        Returns\n        -------\n        str\n            the full path to the package", "docstring_tokens": ["Returns", "the", "full", "path", "of", "the", "package"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 255391}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/api_utils.py#L94-L106", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Split an API file path into directory and name.", "language": "python", "parameters": "(path)", "return_statement": "return from_api_dirname(dirname), name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "rsplit", "(", "'/'", ",", "1", ")", "if", "len", "(", "arg_1", ")", "==", "1", ":", "arg_2", "=", "arg_1", "[", "0", "]", "arg_3", "=", "'/'", "else", ":", "arg_2", "=", "arg_1", "[", "1", "]", "arg_3", "=", "arg_1", "[", "0", "]", "+", "'/'", "return", "from_api_dirname", "(", "arg_3", ")", ",", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Split an API file path into directory and name.\n    \"\"\"\n    arg_1 = arg_0.rsplit('/', 1)\n    if len(arg_1) == 1:\n        arg_2 = arg_1[0]\n        arg_3 = '/'\n    else:\n        arg_2 = arg_1[1]\n        arg_3 = arg_1[0] + '/'\n\n    return from_api_dirname(arg_3), arg_2", "path": "pgcontents/api_utils.py", "identifier": "split_api_filepath", "docstring": "Split an API file path into directory and name.", "docstring_tokens": ["Split", "an", "API", "file", "path", "into", "directory", "and", "name", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 255392}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1939-L1952", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Return the number of leading spaces in line.", "language": "python", "parameters": "(line)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Match", "(", "r'^( *)\\S'", ",", "arg_0", ")", "if", "arg_1", ":", "return", "len", "(", "arg_1", ".", "group", "(", "1", ")", ")", "else", ":", "return", "0"], "function": "def Func(arg_0):\n  \"\"\"Return the number of leading spaces in line.\n\n  Args:\n    line: A string to check.\n\n  Returns:\n    An integer count of leading spaces, possibly zero.\n  \"\"\"\n  arg_1 = Match(r'^( *)\\S', arg_0)\n  if arg_1:\n    return len(arg_1.group(1))\n  else:\n    return 0", "path": "third_party/python/cpplint/cpplint.py", "identifier": "GetIndentLevel", "docstring": "Return the number of leading spaces in line.\n\n  Args:\n    line: A string to check.\n\n  Returns:\n    An integer count of leading spaces, possibly zero.", "docstring_tokens": ["Return", "the", "number", "of", "leading", "spaces", "in", "line", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255393}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/termUsageResolver.py#L7-L23", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "if is negated return original cond and negated flag", "language": "python", "parameters": "(c)", "return_statement": "return (c, isNegated)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "False", "try", ":", "arg_2", "=", "arg_0", ".", "drivers", "except", "AttributeError", ":", "return", "(", "arg_0", ",", "arg_1", ")", "if", "len", "(", "arg_2", ")", "==", "1", ":", "arg_3", "=", "list", "(", "arg_0", ".", "drivers", ")", "[", "0", "]", "if", "isinstance", "(", "arg_3", ",", "Operator", ")", "and", "arg_3", ".", "operator", "==", "AllOps", ".", "NOT", ":", "arg_0", "=", "arg_3", ".", "operands", "[", "0", "]", "arg_1", "=", "True", "return", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    if is negated return original cond and negated flag\n    \"\"\"\n    arg_1 = False\n    try:\n        arg_2 = arg_0.drivers\n    except AttributeError:\n        return (arg_0, arg_1)\n\n    if len(arg_2) == 1:\n        arg_3 = list(arg_0.drivers)[0]\n        if isinstance(arg_3, Operator) and arg_3.operator == AllOps.NOT:\n            arg_0 = arg_3.operands[0]\n            arg_1 = True\n\n    return (arg_0, arg_1)", "path": "hwt/synthesizer/termUsageResolver.py", "identifier": "getBaseCond", "docstring": "if is negated return original cond and negated flag", "docstring_tokens": ["if", "is", "negated", "return", "original", "cond", "and", "negated", "flag"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 255394}
{"url": "https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/savemat.py#L192-L205", "sha": "6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1", "docstring_summary": "Write compressed variable data to file", "language": "python", "parameters": "(fd, array, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "BytesIO", "(", ")", "write_var_array", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "arg_4", "=", "zlib", ".", "compress", "(", "arg_3", ".", "getvalue", "(", ")", ")", "arg_3", ".", "close", "(", ")", "arg_0", ".", "write", "(", "struct", ".", "pack", "(", "'b3xI'", ",", "etypes", "[", "'miCOMPRESSED'", "]", "[", "'n'", "]", ",", "len", "(", "arg_4", ")", ")", ")", "arg_0", ".", "write", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Write compressed variable data to file\"\"\"\n    arg_3 = BytesIO()\n\n    write_var_array(arg_3, arg_1, arg_2)\n\n    arg_4 = zlib.compress(arg_3.getvalue())\n    arg_3.close()\n\n    # write array data elements (size info)\n    arg_0.write(struct.pack('b3xI', etypes['miCOMPRESSED']['n'], len(arg_4)))\n\n    # write the compressed data\n    arg_0.write(arg_4)", "path": "mat4py/savemat.py", "identifier": "write_compressed_var_array", "docstring": "Write compressed variable data to file", "docstring_tokens": ["Write", "compressed", "variable", "data", "to", "file"], "nwo": "nephics/mat4py", "score": 0.3187018950262521, "idx": 255395}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py#L116-L153", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Create a website.", "language": "python", "parameters": "(self, webspace_name, website_name, geo_region, host_names,\n                    plan='VirtualDedicatedPlan', compute_mode='Shared',\n                    server_farm=None, site_mode=None)", "return_statement": "return self._perform_post(\n            self._get_sites_path(webspace_name),\n            xml,\n            Site)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "'VirtualDedicatedPlan'", ",", "arg_6", "=", "'Shared'", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ")", ":", "arg_9", "=", "_XmlSerializer", ".", "create_website_to_xml", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_5", ",", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_sites_path", "(", "arg_1", ")", ",", "arg_9", ",", "Site", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                    arg_5='VirtualDedicatedPlan', arg_6='Shared',\n                    arg_7=None, arg_8=None):\n        '''\n        Create a website.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        geo_region:\n            The geographical region of the webspace that will be created.\n        host_names:\n            An array of fully qualified domain names for website. Only one\n            hostname can be specified in the azurewebsites.net domain.\n            The hostname should match the name of the website. Custom domains\n            can only be specified for Shared or Standard websites.\n        plan:\n            This value must be 'VirtualDedicatedPlan'.\n        compute_mode:\n            This value should be 'Shared' for the Free or Paid Shared\n            offerings, or 'Dedicated' for the Standard offering. The default\n            value is 'Shared'. If you set it to 'Dedicated', you must specify\n            a value for the server_farm parameter.\n        server_farm:\n            The name of the Server Farm associated with this website. This is\n            a required value for Standard mode.\n        site_mode:\n            Can be None, 'Limited' or 'Basic'. This value is 'Limited' for the\n            Free offering, and 'Basic' for the Paid Shared offering. Standard\n            mode does not use the site_mode parameter; it uses the compute_mode\n            parameter.\n        '''\n        arg_9 = _XmlSerializer.create_website_to_xml(arg_1, arg_2, arg_3, arg_5, arg_4, arg_6, arg_7, arg_8)\n        return arg_0._perform_post(\n            arg_0._get_sites_path(arg_1),\n            arg_9,\n            Site)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py", "identifier": "WebsiteManagementService.create_site", "docstring": "Create a website.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        geo_region:\n            The geographical region of the webspace that will be created.\n        host_names:\n            An array of fully qualified domain names for website. Only one\n            hostname can be specified in the azurewebsites.net domain.\n            The hostname should match the name of the website. Custom domains\n            can only be specified for Shared or Standard websites.\n        plan:\n            This value must be 'VirtualDedicatedPlan'.\n        compute_mode:\n            This value should be 'Shared' for the Free or Paid Shared\n            offerings, or 'Dedicated' for the Standard offering. The default\n            value is 'Shared'. If you set it to 'Dedicated', you must specify\n            a value for the server_farm parameter.\n        server_farm:\n            The name of the Server Farm associated with this website. This is\n            a required value for Standard mode.\n        site_mode:\n            Can be None, 'Limited' or 'Basic'. This value is 'Limited' for the\n            Free offering, and 'Basic' for the Paid Shared offering. Standard\n            mode does not use the site_mode parameter; it uses the compute_mode\n            parameter.", "docstring_tokens": ["Create", "a", "website", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255396}
{"url": "https://github.com/LudovicRousseau/PyKCS11/blob/76ccd8741af2ea193aaf1ca29dfedfa412c134fe/PyKCS11/__init__.py#L1351-L1372", "sha": "76ccd8741af2ea193aaf1ca29dfedfa412c134fe", "docstring_summary": "generate a key pair", "language": "python", "parameters": "(self, templatePub, templatePriv,\n                        mecha=MechanismRSAGENERATEKEYPAIR)", "return_statement": "return ck_pub_handle, ck_prv_handle", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "_template2ckattrlist", "(", "arg_1", ")", "arg_6", "=", "arg_0", ".", "_template2ckattrlist", "(", "arg_2", ")", "arg_7", "=", "PyKCS11", ".", "LowLevel", ".", "CK_OBJECT_HANDLE", "(", ")", "arg_8", "=", "PyKCS11", ".", "LowLevel", ".", "CK_OBJECT_HANDLE", "(", ")", "arg_9", "=", "arg_3", ".", "to_native", "(", ")", "arg_10", "=", "arg_0", ".", "lib", ".", "C_GenerateKeyPair", "(", "arg_0", ".", "session", ",", "arg_9", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "if", "arg_10", "!=", "CKR_OK", ":", "raise", "PyKCS11Error", "(", "arg_10", ")", "return", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2,\n                        arg_3=arg_4):\n        \"\"\"\n        generate a key pair\n\n        :param templatePub: template for the public key\n        :param templatePriv:  template for the private key\n        :param mecha: mechanism to use\n        :return: a tuple of handles (pub, priv)\n        :rtype: tuple\n        \"\"\"\n        arg_5 = arg_0._template2ckattrlist(arg_1)\n        arg_6 = arg_0._template2ckattrlist(arg_2)\n        arg_7 = PyKCS11.LowLevel.CK_OBJECT_HANDLE()\n        arg_8 = PyKCS11.LowLevel.CK_OBJECT_HANDLE()\n        arg_9 = arg_3.to_native()\n        arg_10 = arg_0.lib.C_GenerateKeyPair(arg_0.session, arg_9, arg_5, arg_6,\n                                        arg_7, arg_8)\n\n        if arg_10 != CKR_OK:\n            raise PyKCS11Error(arg_10)\n        return arg_7, arg_8", "path": "PyKCS11/__init__.py", "identifier": "Session.generateKeyPair", "docstring": "generate a key pair\n\n        :param templatePub: template for the public key\n        :param templatePriv:  template for the private key\n        :param mecha: mechanism to use\n        :return: a tuple of handles (pub, priv)\n        :rtype: tuple", "docstring_tokens": ["generate", "a", "key", "pair"], "nwo": "LudovicRousseau/PyKCS11", "score": 0.4240693100826277, "idx": 255397}
{"url": "https://github.com/pypa/pep517/blob/ecd511e8fc85251d0496716939ebbe109e395924/pep517/_in_process.py#L41-L45", "sha": "ecd511e8fc85251d0496716939ebbe109e395924", "docstring_summary": "Test if a file is located within the given directory.", "language": "python", "parameters": "(filename, directory)", "return_statement": "return os.path.commonprefix([filename, directory]) == directory", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", ")", "arg_1", "=", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", ")", "return", "os", ".", "path", ".", "commonprefix", "(", "[", "arg_0", ",", "arg_1", "]", ")", "==", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Test if a file is located within the given directory.\"\"\"\n    arg_0 = os.path.normcase(os.path.abspath(arg_0))\n    arg_1 = os.path.normcase(os.path.abspath(arg_1))\n    return os.path.commonprefix([arg_0, arg_1]) == arg_1", "path": "pep517/_in_process.py", "identifier": "contained_in", "docstring": "Test if a file is located within the given directory.", "docstring_tokens": ["Test", "if", "a", "file", "is", "located", "within", "the", "given", "directory", "."], "nwo": "pypa/pep517", "score": 0.5466648575129843, "idx": 255398}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/apps.py#L57-L61", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Creates a remote app and registers it.", "language": "python", "parameters": "(self, oauth, name=None, **kwargs)", "return_statement": "return oauth.remote_app(**kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_3", "=", "arg_0", ".", "_process_kwargs", "(", "arg_2", "=", "(", "arg_2", "or", "arg_0", ".", "default_name", ")", ",", "**", "arg_3", ")", "return", "arg_1", ".", "remote_app", "(", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Creates a remote app and registers it.\"\"\"\n        arg_3 = arg_0._process_kwargs(\n            arg_2=(arg_2 or arg_0.default_name), **arg_3)\n        return arg_1.remote_app(**arg_3)", "path": "flask_oauthlib/contrib/apps.py", "identifier": "RemoteAppFactory.register_to", "docstring": "Creates a remote app and registers it.", "docstring_tokens": ["Creates", "a", "remote", "app", "and", "registers", "it", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 255399}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/file_record_stream.py#L322-L340", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Put us back at the beginning of the file again.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "super", "(", "FileRecordStream", ",", "arg_0", ")", ".", "Func", "(", ")", "arg_0", ".", "close", "(", ")", "arg_0", ".", "_file", "=", "open", "(", "arg_0", ".", "_filename", ",", "arg_0", ".", "_mode", ")", "arg_0", ".", "_reader", "=", "csv", ".", "reader", "(", "arg_0", ".", "_file", ",", "dialect", "=", "\"excel\"", ")", "arg_0", ".", "_reader", ".", "next", "(", ")", "arg_0", ".", "_reader", ".", "next", "(", ")", "arg_0", ".", "_reader", ".", "next", "(", ")", "arg_0", ".", "_recordCount", "=", "0"], "function": "def Func(arg_0):\n    \"\"\"\n    Put us back at the beginning of the file again.\n    \"\"\"\n\n    # Superclass Func\n    super(FileRecordStream, arg_0).Func()\n\n    arg_0.close()\n    arg_0._file = open(arg_0._filename, arg_0._mode)\n    arg_0._reader = csv.reader(arg_0._file, dialect=\"excel\")\n\n    # Skip header rows\n    arg_0._reader.next()\n    arg_0._reader.next()\n    arg_0._reader.next()\n\n    # Reset record count, etc.\n    arg_0._recordCount = 0", "path": "src/nupic/data/file_record_stream.py", "identifier": "FileRecordStream.rewind", "docstring": "Put us back at the beginning of the file again.", "docstring_tokens": ["Put", "us", "back", "at", "the", "beginning", "of", "the", "file", "again", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255400}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/vector_diffeomixture.py#L936-L941", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Concatenates input vectors, statically if possible.", "language": "python", "parameters": "(*args)", "return_statement": "return [val for vec in args_ for val in vec]", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "[", "tf", ".", "get_static_value", "(", "x", ")", "for", "x", "in", "arg_0", "]", "if", "any", "(", "arg_2", "is", "None", "for", "arg_2", "in", "arg_1", ")", ":", "return", "tf", ".", "concat", "(", "arg_0", ",", "axis", "=", "0", ")", "return", "[", "arg_3", "for", "arg_2", "in", "arg_1", "for", "arg_3", "in", "arg_2", "]"], "function": "def Func(*arg_0):\n  \"\"\"Concatenates input vectors, statically if possible.\"\"\"\n  arg_1 = [tf.get_static_value(x) for x in arg_0]\n  if any(arg_2 is None for arg_2 in arg_1):\n    return tf.concat(arg_0, axis=0)\n  return [arg_3 for arg_2 in arg_1 for arg_3 in arg_2]", "path": "tensorflow_probability/python/distributions/vector_diffeomixture.py", "identifier": "concat_vectors", "docstring": "Concatenates input vectors, statically if possible.", "docstring_tokens": ["Concatenates", "input", "vectors", "statically", "if", "possible", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255401}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L176-L180", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Checks to see if this module uses Python's built-in logging.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "names", ":", "if", "arg_2", "in", "arg_0", ".", "_logging_modules", ":", "arg_0", ".", "_logging_names", ".", "add", "(", "arg_3", "or", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Checks to see if this module uses Python's built-in logging.\"\"\"\n        for arg_2, arg_3 in arg_1.names:\n            if arg_2 in arg_0._logging_modules:\n                arg_0._logging_names.add(arg_3 or arg_2)", "path": "pylint/checkers/logging.py", "identifier": "LoggingChecker.visit_import", "docstring": "Checks to see if this module uses Python's built-in logging.", "docstring_tokens": ["Checks", "to", "see", "if", "this", "module", "uses", "Python", "s", "built", "-", "in", "logging", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255402}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L836-L872", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Receive a StateUpdate and fan out to Conversations.", "language": "python", "parameters": "(self, state_update)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "WhichOneof", "(", "'state_update'", ")", "if", "arg_1", ".", "HasField", "(", "'conversation'", ")", ":", "try", ":", "await", "arg_0", ".", "_handle_conversation_delta", "(", "arg_1", ".", "conversation", ")", "except", "exceptions", ".", "NetworkError", ":", "logger", ".", "warning", "(", "'Discarding %s for %s: Failed to fetch conversation'", ",", "arg_2", ".", "replace", "(", "'_'", ",", "' '", ")", ",", "arg_1", ".", "conversation", ".", "conversation_id", ".", "id", ")", "return", "if", "arg_2", "==", "'typing_notification'", ":", "await", "arg_0", ".", "_handle_set_typing_notification", "(", "arg_1", ".", "typing_notification", ")", "elif", "arg_2", "==", "'watermark_notification'", ":", "await", "arg_0", ".", "_handle_watermark_notification", "(", "arg_1", ".", "watermark_notification", ")", "elif", "arg_2", "==", "'event_notification'", ":", "await", "arg_0", ".", "_on_event", "(", "arg_1", ".", "event_notification", ".", "event", ")"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Receive a StateUpdate and fan out to Conversations.\n\n        Args:\n            state_update: hangouts_pb2.StateUpdate instance\n        \"\"\"\n        # The state update will include some type of notification:\n        arg_2 = arg_1.WhichOneof('state_update')\n\n        # If conversation fields have been updated, the state update will have\n        # a conversation containing changed fields. Handle updating the\n        # conversation from this delta:\n        if arg_1.HasField('conversation'):\n            try:\n                await arg_0._handle_conversation_delta(\n                    arg_1.conversation\n                )\n            except exceptions.NetworkError:\n                logger.warning(\n                    'Discarding %s for %s: Failed to fetch conversation',\n                    arg_2.replace('_', ' '),\n                    arg_1.conversation.conversation_id.id\n                )\n                return\n\n        if arg_2 == 'typing_notification':\n            await arg_0._handle_set_typing_notification(\n                arg_1.typing_notification\n            )\n        elif arg_2 == 'watermark_notification':\n            await arg_0._handle_watermark_notification(\n                arg_1.watermark_notification\n            )\n        elif arg_2 == 'event_notification':\n            await arg_0._on_event(\n                arg_1.event_notification.event\n            )", "path": "hangups/conversation.py", "identifier": "ConversationList._on_state_update", "docstring": "Receive a StateUpdate and fan out to Conversations.\n\n        Args:\n            state_update: hangouts_pb2.StateUpdate instance", "docstring_tokens": ["Receive", "a", "StateUpdate", "and", "fan", "out", "to", "Conversations", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255403}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/api_utils.py#L217-L227", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Decorator for converting PathOutsideRoot errors to 404s.", "language": "python", "parameters": "(fn)", "return_statement": "return wrapped", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapped", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "try", ":", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "except", "PathOutsideRoot", "as", "e", ":", "raise", "HTTPError", "(", "404", ",", "\"Path outside root: [%s]\"", "%", "e", ".", "args", "[", "0", "]", ")", "return", "wrapped"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator for converting PathOutsideRoot errors to 404s.\n    \"\"\"\n    @wraps(arg_0)\n    def wrapped(*arg_1, **arg_2):\n        try:\n            return arg_0(*arg_1, **arg_2)\n        except PathOutsideRoot as e:\n            raise HTTPError(404, \"Path outside root: [%s]\" % e.args[0])\n    return wrapped", "path": "pgcontents/api_utils.py", "identifier": "outside_root_to_404", "docstring": "Decorator for converting PathOutsideRoot errors to 404s.", "docstring_tokens": ["Decorator", "for", "converting", "PathOutsideRoot", "errors", "to", "404s", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 255404}
{"url": "https://github.com/pinterest/thrift-tools/blob/64e74aec89e2491c781fc62d1c45944dc15aba28/thrift_tools/sniffer.py#L77-L100", "sha": "64e74aec89e2491c781fc62d1c45944dc15aba28", "docstring_summary": "push the packet into the queue", "language": "python", "parameters": "(self, ip_packet)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_1", ".", "data", ".", "data", ")", "arg_3", "=", "arg_1", ".", "data", ".", "seq", "if", "arg_2", "==", "0", ":", "arg_0", ".", "_next_seq_id", "=", "arg_3", "return", "False", "if", "arg_0", ".", "_next_seq_id", "!=", "-", "1", "and", "arg_3", "!=", "arg_0", ".", "_next_seq_id", ":", "return", "False", "arg_0", ".", "_next_seq_id", "=", "arg_3", "+", "arg_2", "with", "arg_0", ".", "_lock_packets", ":", "arg_0", ".", "_length", "+=", "len", "(", "arg_1", ".", "data", ".", "data", ")", "arg_0", ".", "_remaining", "+=", "len", "(", "arg_1", ".", "data", ".", "data", ")", "arg_0", ".", "_packets", ".", "append", "(", "arg_1", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Func the packet into the queue \"\"\"\n\n        arg_2 = len(arg_1.data.data)\n        arg_3 = arg_1.data.seq\n\n        if arg_2 == 0:\n            arg_0._next_seq_id = arg_3\n            return False\n\n        # have we seen this packet?\n        if arg_0._next_seq_id != -1 and arg_3 != arg_0._next_seq_id:\n            return False\n\n        arg_0._next_seq_id = arg_3 + arg_2\n\n        with arg_0._lock_packets:\n            # Note: we only account for payload (i.e.: tcp data)\n            arg_0._length += len(arg_1.data.data)\n            arg_0._remaining += len(arg_1.data.data)\n\n            arg_0._packets.append(arg_1)\n\n        return True", "path": "thrift_tools/sniffer.py", "identifier": "Stream.push", "docstring": "push the packet into the queue", "docstring_tokens": ["push", "the", "packet", "into", "the", "queue"], "nwo": "pinterest/thrift-tools", "score": 0.3868024438139195, "idx": 255405}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/filters.py#L798-L840", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Applies a filter on a sequence of objects or looks up an attribute.\n    This is useful when dealing with lists of objects but you are really\n    only interested in a certain value of it.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "0", "]", "arg_3", "=", "arg_0", "[", "1", "]", "if", "len", "(", "arg_0", ")", "==", "2", "and", "'attribute'", "in", "arg_1", ":", "arg_4", "=", "arg_1", ".", "pop", "(", "'attribute'", ")", "if", "arg_1", ":", "raise", "FilterArgumentError", "(", "'Unexpected keyword argument %r'", "%", "next", "(", "iter", "(", "arg_1", ")", ")", ")", "arg_5", "=", "make_attrgetter", "(", "arg_2", ".", "environment", ",", "arg_4", ")", "else", ":", "try", ":", "arg_6", "=", "arg_0", "[", "2", "]", "arg_0", "=", "arg_0", "[", "3", ":", "]", "except", "LookupError", ":", "raise", "FilterArgumentError", "(", "'map requires a filter argument'", ")", "arg_5", "=", "lambda", "arg_7", ":", "arg_2", ".", "environment", ".", "call_filter", "(", "arg_6", ",", "arg_7", ",", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "arg_3", ":", "for", "arg_7", "in", "arg_3", ":", "yield", "arg_5", "(", "arg_7", ")"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"Applies a filter on a sequence of objects or looks up an attribute.\n    This is useful when dealing with lists of objects but you are really\n    only interested in a certain value of it.\n\n    The basic usage is mapping on an attribute.  Imagine you have a list\n    of users but you are only interested in a list of usernames:\n\n    .. sourcecode:: jinja\n\n        Users on this page: {{ users|map(attribute='username')|join(', ') }}\n\n    Alternatively you can let it invoke a filter by passing the name of the\n    filter and the arguments afterwards.  A good example would be applying a\n    text conversion filter on a sequence:\n\n    .. sourcecode:: jinja\n\n        Users on this page: {{ titles|map('lower')|join(', ') }}\n\n    .. versionadded:: 2.7\n    \"\"\"\n    arg_2 = arg_0[0]\n    arg_3 = arg_0[1]\n\n    if len(arg_0) == 2 and 'attribute' in arg_1:\n        arg_4 = arg_1.pop('attribute')\n        if arg_1:\n            raise FilterArgumentError('Unexpected keyword argument %r' %\n                next(iter(arg_1)))\n        arg_5 = make_attrgetter(arg_2.environment, arg_4)\n    else:\n        try:\n            arg_6 = arg_0[2]\n            arg_0 = arg_0[3:]\n        except LookupError:\n            raise FilterArgumentError('map requires a filter argument')\n        arg_5 = lambda arg_7: arg_2.environment.call_filter(\n            arg_6, arg_7, arg_0, arg_1, arg_2=arg_2)\n\n    if arg_3:\n        for arg_7 in arg_3:\n            yield arg_5(arg_7)", "path": "capybara/virtualenv/lib/python2.7/site-packages/jinja2/filters.py", "identifier": "do_map", "docstring": "Applies a filter on a sequence of objects or looks up an attribute.\n    This is useful when dealing with lists of objects but you are really\n    only interested in a certain value of it.\n\n    The basic usage is mapping on an attribute.  Imagine you have a list\n    of users but you are only interested in a list of usernames:\n\n    .. sourcecode:: jinja\n\n        Users on this page: {{ users|map(attribute='username')|join(', ') }}\n\n    Alternatively you can let it invoke a filter by passing the name of the\n    filter and the arguments afterwards.  A good example would be applying a\n    text conversion filter on a sequence:\n\n    .. sourcecode:: jinja\n\n        Users on this page: {{ titles|map('lower')|join(', ') }}\n\n    .. versionadded:: 2.7", "docstring_tokens": ["Applies", "a", "filter", "on", "a", "sequence", "of", "objects", "or", "looks", "up", "an", "attribute", ".", "This", "is", "useful", "when", "dealing", "with", "lists", "of", "objects", "but", "you", "are", "really", "only", "interested", "in", "a", "certain", "value", "of", "it", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255406}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/cli.py#L209-L212", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Load communities.", "language": "python", "parameters": "(sources, logos_dir)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "invenio_migrator", ".", "tasks", ".", "communities", "import", "load_community", "loadcommon", "(", "arg_0", ",", "load_community", ",", "task_args", "=", "(", "arg_1", ",", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Load communities.\"\"\"\n    from invenio_migrator.tasks.communities import load_community\n    loadcommon(arg_0, load_community, task_args=(arg_1, ))", "path": "invenio_migrator/cli.py", "identifier": "loadcommunities", "docstring": "Load communities.", "docstring_tokens": ["Load", "communities", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 255407}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L1717-L1769", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Use an ssh type key to connect to a machine via ssh", "language": "python", "parameters": "(key_name, no_tunnel, stash, passphrase, backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "def", "execute", "(", "arg_5", ")", ":", "try", ":", "click", ".", "echo", "(", "'Executing: {0}'", ".", "format", "(", "' '", ".", "join", "(", "arg_5", ")", ")", ")", "subprocess", ".", "check_call", "(", "' '", ".", "join", "(", "arg_5", ")", ",", "shell", "=", "True", ")", "except", "subprocess", ".", "CalledProcessError", ":", "sys", ".", "exit", "(", "1", ")", "arg_2", "=", "_get_stash", "(", "arg_4", ",", "arg_2", ",", "arg_3", ")", "arg_6", "=", "arg_2", ".", "get", "(", "arg_0", ")", "if", "arg_6", ":", "_assert_is_Func_type_key", "(", "arg_6", ")", "else", ":", "sys", ".", "exit", "(", "'Key `{0}` not found'", ".", "format", "(", "arg_0", ")", ")", "arg_7", "=", "arg_6", "[", "'value'", "]", "arg_8", "=", "arg_7", ".", "get", "(", "'Func_key_path'", ")", "arg_9", "=", "arg_7", ".", "get", "(", "'Func_key'", ")", "arg_10", "=", "arg_7", ".", "get", "(", "'proxy_key_path'", ")", "arg_11", "=", "arg_7", ".", "get", "(", "'proxy_key'", ")", "arg_12", "=", "_write_tmp", "(", "arg_9", ")", "if", "arg_9", "else", "arg_8", "arg_7", "[", "'Func_key_path'", "]", "=", "arg_12", "if", "arg_7", ".", "get", "(", "'proxy'", ")", ":", "arg_13", "=", "_write_tmp", "(", "arg_11", ")", "if", "arg_11", "else", "arg_10", "arg_7", "[", "'proxy_key_path'", "]", "=", "arg_13", "arg_14", "=", "_build_Func_command", "(", "arg_7", ",", "arg_1", ")", "try", ":", "execute", "(", "arg_14", ")", "finally", ":", "if", "arg_12", "!=", "arg_8", ":", "click", ".", "echo", "(", "'Removing temp Func key file: {0}...'", ".", "format", "(", "arg_12", ")", ")", "os", ".", "remove", "(", "arg_12", ")", "if", "arg_7", ".", "get", "(", "'proxy'", ")", "and", "arg_13", "!=", "arg_10", ":", "click", ".", "echo", "(", "'Removing temp proxy key file: {0}...'", ".", "format", "(", "arg_13", ")", ")", "os", ".", "remove", "(", "arg_13", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Use an Func type key to connect to a machine via Func\n\n    Note that trying to use a key of the wrong type (e.g. `secret`)\n    will result in an error.\n\n    `KEY_NAME` is the key to use.\n\n    For additional information on the different configuration options\n    for an Func type key, see the repo's readme.\n    \"\"\"\n    # TODO: find_executable or raise\n    def execute(arg_5):\n        try:\n            click.echo('Executing: {0}'.format(' '.join(arg_5)))\n            subprocess.check_call(' '.join(arg_5), shell=True)\n        except subprocess.CalledProcessError:\n            sys.exit(1)\n\n    arg_2 = _get_stash(arg_4, arg_2, arg_3)\n    arg_6 = arg_2.get(arg_0)\n\n    if arg_6:\n        _assert_is_Func_type_key(arg_6)\n    else:\n        sys.exit('Key `{0}` not found'.format(arg_0))\n\n    arg_7 = arg_6['value']\n    arg_8 = arg_7.get('Func_key_path')\n    arg_9 = arg_7.get('Func_key')\n    arg_10 = arg_7.get('proxy_key_path')\n    arg_11 = arg_7.get('proxy_key')\n\n    arg_12 = _write_tmp(arg_9) if arg_9 else arg_8\n    arg_7['Func_key_path'] = arg_12\n\n    if arg_7.get('proxy'):\n        arg_13 = _write_tmp(arg_11) if arg_11 else arg_10\n        arg_7['proxy_key_path'] = arg_13\n\n    arg_14 = _build_Func_command(arg_7, arg_1)\n    try:\n        execute(arg_14)\n    finally:\n        # If they're not equal, that means we've created a temp one which\n        # should be deleted, else, it's a path to an existing key file.\n        if arg_12 != arg_8:\n            click.echo('Removing temp Func key file: {0}...'.format(arg_12))\n            os.remove(arg_12)\n        if arg_7.get('proxy') and arg_13 != arg_10:\n            click.echo('Removing temp proxy key file: {0}...'.format(\n                arg_13))\n            os.remove(arg_13)", "path": "ghost.py", "identifier": "ssh", "docstring": "Use an ssh type key to connect to a machine via ssh\n\n    Note that trying to use a key of the wrong type (e.g. `secret`)\n    will result in an error.\n\n    `KEY_NAME` is the key to use.\n\n    For additional information on the different configuration options\n    for an ssh type key, see the repo's readme.", "docstring_tokens": ["Use", "an", "ssh", "type", "key", "to", "connect", "to", "a", "machine", "via", "ssh"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 255408}
{"url": "https://github.com/myint/language-check/blob/58e419833ef28a9193fcaa21193616a8a14504a9/language_check/__init__.py#L545-L575", "sha": "58e419833ef28a9193fcaa21193616a8a14504a9", "docstring_summary": "Get LanguageTool directory.", "language": "python", "parameters": "()", "return_statement": "return language_check_dir", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "arg_0", "=", "arg_5", "[", "'language_check_dir'", "]", "except", "KeyError", ":", "def", "version_key", "(", "arg_1", ")", ":", "return", "[", "int", "(", "arg_2", ")", "if", "arg_2", ".", "isdigit", "(", ")", "else", "arg_2", "for", "arg_2", "in", "re", ".", "split", "(", "r\"(\\d+)\"", ",", "arg_1", ")", "]", "def", "get_lt_dir", "(", "arg_3", ")", ":", "arg_4", "=", "[", "path", "for", "path", "in", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'LanguageTool*'", ")", ")", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", "]", "return", "max", "(", "arg_4", ",", "key", "=", "version_key", ")", "if", "arg_4", "else", "None", "arg_3", "=", "os", ".", "path", ".", "dirname", "(", "sys", ".", "argv", "[", "0", "]", ")", "arg_0", "=", "get_lt_dir", "(", "arg_3", ")", "if", "not", "arg_0", ":", "try", ":", "arg_3", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "except", "NameError", ":", "pass", "else", ":", "arg_0", "=", "get_lt_dir", "(", "arg_3", ")", "if", "not", "arg_0", ":", "raise", "PathError", "(", "\"can't find LanguageTool directory in {!r}\"", ".", "format", "(", "arg_3", ")", ")", "arg_5", "[", "'language_check_dir'", "]", "=", "arg_0", "return", "arg_0"], "function": "def Func():\n    \"\"\"Get LanguageTool directory.\"\"\"\n    try:\n        arg_0 = arg_5['language_check_dir']\n    except KeyError:\n        def version_key(arg_1):\n            return [int(arg_2) if arg_2.isdigit() else arg_2\n                    for arg_2 in re.split(r\"(\\d+)\", arg_1)]\n\n        def get_lt_dir(arg_3):\n            arg_4 = [\n                path for path in\n                glob.glob(os.path.join(arg_3, 'LanguageTool*'))\n                if os.path.isdir(path)\n            ]\n            return max(arg_4, key=version_key) if arg_4 else None\n\n        arg_3 = os.path.dirname(sys.argv[0])\n        arg_0 = get_lt_dir(arg_3)\n        if not arg_0:\n            try:\n                arg_3 = os.path.dirname(os.path.abspath(__file__))\n            except NameError:\n                pass\n            else:\n                arg_0 = get_lt_dir(arg_3)\n            if not arg_0:\n                raise PathError(\"can't find LanguageTool directory in {!r}\"\n                                .format(arg_3))\n        arg_5['language_check_dir'] = arg_0\n    return arg_0", "path": "language_check/__init__.py", "identifier": "get_directory", "docstring": "Get LanguageTool directory.", "docstring_tokens": ["Get", "LanguageTool", "directory", "."], "nwo": "myint/language-check", "score": 0.7367171749390385, "idx": 255409}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L587-L628", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Transform keypoint coordinates according to a given affine transform matrix.\n    OpenCV format, x is width.", "language": "python", "parameters": "(coords_list, transform_matrix)", "return_statement": "return coords_result_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "arg_3", "=", "np", ".", "asarray", "(", "arg_3", ")", "arg_3", "=", "arg_3", ".", "transpose", "(", "[", "1", ",", "0", "]", ")", "arg_3", "=", "np", ".", "insert", "(", "arg_3", ",", "2", ",", "1", ",", "axis", "=", "0", ")", "arg_4", "=", "np", ".", "matmul", "(", "arg_1", ",", "arg_3", ")", "arg_4", "=", "arg_4", "[", "0", ":", "2", ",", ":", "]", ".", "transpose", "(", "[", "1", ",", "0", "]", ")", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Transform keypoint coordinates according to a given affine transform matrix.\n    OpenCV format, x is width.\n\n    Note that, for pose estimation task, flipping requires maintaining the left and right body information.\n    We should not flip the left and right body, so please use ``tl.prepro.keypoint_random_flip``.\n\n    Parameters\n    -----------\n    coords_list : list of list of tuple/list\n        The coordinates\n        e.g., the keypoint coordinates of every person in an image.\n    transform_matrix : numpy.array\n        Transform matrix, OpenCV format.\n\n    Examples\n    ---------\n    >>> # 1. get all affine transform matrices\n    >>> M_rotate = tl.prepro.affine_rotation_matrix(angle=20)\n    >>> M_flip = tl.prepro.affine_horizontal_flip_matrix(prob=1)\n    >>> # 2. combine all affine transform matrices to one matrix\n    >>> M_combined = dot(M_flip).dot(M_rotate)\n    >>> # 3. transfrom the matrix from Cartesian coordinate (the origin in the middle of image)\n    >>> # to Image coordinate (the origin on the top-left of image)\n    >>> transform_matrix = tl.prepro.transform_matrix_offset_center(M_combined, x=w, y=h)\n    >>> # 4. then we can transfrom the image once for all transformations\n    >>> result = tl.prepro.affine_transform_cv2(image, transform_matrix)  # 76 times faster\n    >>> # 5. transform keypoint coordinates\n    >>> coords = [[(50, 100), (100, 100), (100, 50), (200, 200)], [(250, 50), (200, 50), (200, 100)]]\n    >>> coords_result = tl.prepro.Func(coords, transform_matrix)\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_0:\n        arg_3 = np.asarray(arg_3)\n        arg_3 = arg_3.transpose([1, 0])\n        arg_3 = np.insert(arg_3, 2, 1, axis=0)\n        # print(coords)\n        # print(transform_matrix)\n        arg_4 = np.matmul(arg_1, arg_3)\n        arg_4 = arg_4[0:2, :].transpose([1, 0])\n        arg_2.append(arg_4)\n    return arg_2", "path": "tensorlayer/prepro.py", "identifier": "affine_transform_keypoints", "docstring": "Transform keypoint coordinates according to a given affine transform matrix.\n    OpenCV format, x is width.\n\n    Note that, for pose estimation task, flipping requires maintaining the left and right body information.\n    We should not flip the left and right body, so please use ``tl.prepro.keypoint_random_flip``.\n\n    Parameters\n    -----------\n    coords_list : list of list of tuple/list\n        The coordinates\n        e.g., the keypoint coordinates of every person in an image.\n    transform_matrix : numpy.array\n        Transform matrix, OpenCV format.\n\n    Examples\n    ---------\n    >>> # 1. get all affine transform matrices\n    >>> M_rotate = tl.prepro.affine_rotation_matrix(angle=20)\n    >>> M_flip = tl.prepro.affine_horizontal_flip_matrix(prob=1)\n    >>> # 2. combine all affine transform matrices to one matrix\n    >>> M_combined = dot(M_flip).dot(M_rotate)\n    >>> # 3. transfrom the matrix from Cartesian coordinate (the origin in the middle of image)\n    >>> # to Image coordinate (the origin on the top-left of image)\n    >>> transform_matrix = tl.prepro.transform_matrix_offset_center(M_combined, x=w, y=h)\n    >>> # 4. then we can transfrom the image once for all transformations\n    >>> result = tl.prepro.affine_transform_cv2(image, transform_matrix)  # 76 times faster\n    >>> # 5. transform keypoint coordinates\n    >>> coords = [[(50, 100), (100, 100), (100, 50), (200, 200)], [(250, 50), (200, 50), (200, 100)]]\n    >>> coords_result = tl.prepro.affine_transform_keypoints(coords, transform_matrix)", "docstring_tokens": ["Transform", "keypoint", "coordinates", "according", "to", "a", "given", "affine", "transform", "matrix", ".", "OpenCV", "format", "x", "is", "width", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 255410}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/imports.py#L654-L673", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Record the package `node` imports from", "language": "python", "parameters": "(self, node, importedmodnode)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "ImportFrom", ")", ":", "arg_3", "=", "arg_1", ".", "modname", "else", ":", "arg_3", "=", "arg_2", ".", "name", "if", "arg_2", "else", "None", "if", "not", "arg_3", ":", "arg_3", "=", "arg_1", ".", "names", "[", "0", "]", "[", "0", "]", ".", "split", "(", "\".\"", ")", "[", "0", "]", "if", "isinstance", "(", "arg_1", ",", "astroid", ".", "ImportFrom", ")", "and", "(", "arg_1", ".", "level", "or", "0", ")", ">=", "1", ":", "arg_3", "=", "\".\"", "+", "arg_3", "arg_0", ".", "_imports_stack", ".", "append", "(", "(", "arg_1", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Record the package `node` imports from\"\"\"\n        if isinstance(arg_1, astroid.ImportFrom):\n            arg_3 = arg_1.modname\n        else:\n            arg_3 = arg_2.name if arg_2 else None\n        if not arg_3:\n            arg_3 = arg_1.names[0][0].split(\".\")[0]\n\n        if isinstance(arg_1, astroid.ImportFrom) and (arg_1.level or 0) >= 1:\n            # We need the importedname with first point to detect local package\n            # Example of node:\n            #  'from .my_package1 import MyClass1'\n            #  the output should be '.my_package1' instead of 'my_package1'\n            # Example of node:\n            #  'from . import my_package2'\n            #  the output should be '.my_package2' instead of '{pyfile}'\n            arg_3 = \".\" + arg_3\n\n        arg_0._imports_stack.append((arg_1, arg_3))", "path": "pylint/checkers/imports.py", "identifier": "ImportsChecker._record_import", "docstring": "Record the package `node` imports from", "docstring_tokens": ["Record", "the", "package", "node", "imports", "from"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255411}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L960-L977", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Turns a list of maps, lists, or scalars into a single map.\n    Used to build the SELF_CLOSING_TAGS, NESTABLE_TAGS, and\n    NESTING_RESET_TAGS maps out of lists and partial maps.", "language": "python", "parameters": "(default, *args)", "return_statement": "return built", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_1", ":", "if", "hasattr", "(", "arg_3", ",", "'items'", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "items", "(", ")", ":", "arg_2", "[", "arg_4", "]", "=", "arg_5", "elif", "isList", "(", "arg_3", ")", ":", "for", "arg_4", "in", "arg_3", ":", "arg_2", "[", "arg_4", "]", "=", "arg_0", "else", ":", "arg_2", "[", "arg_3", "]", "=", "arg_0", "return", "arg_2"], "function": "def Func(arg_0, *arg_1):\n    \"\"\"Turns a list of maps, lists, or scalars into a single map.\n    Used to build the SELF_CLOSING_TAGS, NESTABLE_TAGS, and\n    NESTING_RESET_TAGS maps out of lists and partial maps.\"\"\"\n    arg_2 = {}\n    for arg_3 in arg_1:\n        if hasattr(arg_3, 'items'):\n            #It's a map. Merge it.\n            for arg_4,arg_5 in arg_3.items():\n                arg_2[arg_4] = arg_5\n        elif isList(arg_3):\n            #It's a list. Map each item to the default.\n            for arg_4 in arg_3:\n                arg_2[arg_4] = arg_0\n        else:\n            #It's a scalar. Map it to the default.\n            arg_2[arg_3] = arg_0\n    return arg_2", "path": "lib/web/BeautifulSoup.py", "identifier": "buildTagMap", "docstring": "Turns a list of maps, lists, or scalars into a single map.\n    Used to build the SELF_CLOSING_TAGS, NESTABLE_TAGS, and\n    NESTING_RESET_TAGS maps out of lists and partial maps.", "docstring_tokens": ["Turns", "a", "list", "of", "maps", "lists", "or", "scalars", "into", "a", "single", "map", ".", "Used", "to", "build", "the", "SELF_CLOSING_TAGS", "NESTABLE_TAGS", "and", "NESTING_RESET_TAGS", "maps", "out", "of", "lists", "and", "partial", "maps", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255412}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py#L323-L359", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get entries from the history list.", "language": "python", "parameters": "(self, raw=True, output=False, hist_access_type='range', **kwargs)", "return_statement": "return msg['header']['msg_id']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ",", "arg_3", "=", "'range'", ",", "**", "arg_4", ")", ":", "arg_5", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "**", "arg_4", ")", "arg_6", "=", "arg_0", ".", "session", ".", "msg", "(", "'Func_request'", ",", "arg_5", ")", "arg_0", ".", "_queue_send", "(", "arg_6", ")", "return", "arg_6", "[", "'header'", "]", "[", "'msg_id'", "]"], "function": "def Func(arg_0, arg_1=True, arg_2=False, arg_3='range', **arg_4):\n        \"\"\"Get entries from the Func list.\n\n        Parameters\n        ----------\n        raw : bool\n            If True, return the raw input.\n        output : bool\n            If True, then return the output as well.\n        hist_access_type : str\n            'range' (fill in session, start and stop params), 'tail' (fill in n)\n             or 'search' (fill in pattern param).\n\n        session : int\n            For a range request, the session from which to get lines. Session\n            numbers are positive integers; negative ones count back from the\n            current session.\n        start : int\n            The first line number of a Func range.\n        stop : int\n            The final (excluded) line number of a Func range.\n\n        n : int\n            The number of lines of Func to get for a tail request.\n\n        pattern : str\n            The glob-syntax pattern for a search request.\n\n        Returns\n        -------\n        The msg_id of the message sent.\n        \"\"\"\n        arg_5 = dict(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3,\n                                                                    **arg_4)\n        arg_6 = arg_0.session.msg('Func_request', arg_5)\n        arg_0._queue_send(arg_6)\n        return arg_6['header']['msg_id']", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py", "identifier": "ShellSocketChannel.history", "docstring": "Get entries from the history list.\n\n        Parameters\n        ----------\n        raw : bool\n            If True, return the raw input.\n        output : bool\n            If True, then return the output as well.\n        hist_access_type : str\n            'range' (fill in session, start and stop params), 'tail' (fill in n)\n             or 'search' (fill in pattern param).\n\n        session : int\n            For a range request, the session from which to get lines. Session\n            numbers are positive integers; negative ones count back from the\n            current session.\n        start : int\n            The first line number of a history range.\n        stop : int\n            The final (excluded) line number of a history range.\n\n        n : int\n            The number of lines of history to get for a tail request.\n\n        pattern : str\n            The glob-syntax pattern for a search request.\n\n        Returns\n        -------\n        The msg_id of the message sent.", "docstring_tokens": ["Get", "entries", "from", "the", "history", "list", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255413}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/__init__.py#L77-L144", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Utility function to display nice titles", "language": "python", "parameters": "(s=None, additional='', stream=sys.stdout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "''", ",", "arg_2", "=", "arg_3", ".", "stdout", ")", ":", "if", "arg_0", "is", "None", ":", "arg_5", ",", "arg_6", ",", "arg_7", "=", "getCallerInfo", "(", "2", ")", "arg_0", "=", "arg_5", "if", "arg_7", "is", "not", "None", ":", "arg_0", "=", "arg_7", "+", "'.'", "+", "arg_5", "arg_8", "=", "(", "arg_0", "+", "arg_1", ")", ".", "split", "(", "'\\n'", ")", "arg_9", "=", "max", "(", "len", "(", "line", ")", "for", "line", "in", "arg_8", ")", "print", ">>", "arg_2", ",", "'-'", "*", "arg_9", "print", ">>", "arg_2", ",", "arg_0", "+", "arg_1", "print", ">>", "arg_2", ",", "'-'", "*", "arg_9"], "function": "def Func(arg_0=None, arg_1='', arg_2=arg_3.stdout):\n  \"\"\"Utility function to display nice Funcs\n\n  It automatically extracts the name of the function/method it is called from\n  and you can add additional text. Func() will then print the name\n  of the function/method and the additional text surrounded by tow lines\n  of dashes. If you don't want the name of the function, you can provide\n  alternative text (regardless of the additional text)\n\n  :param s: (string) text to display, uses the function name and arguments by\n         default\n  :param additional: (string) extra text to display (not needed if s is not\n         None)\n  :param stream: (stream) the stream to print to. Ny default goes to standard\n         output\n\n  Examples:\n\n  .. code-block:: python\n\n    def foo():\n      Func()\n\n  will display:\n\n  .. code-block:: text\n\n    ---\n    foo\n    ---\n\n  .. code-block:: python\n\n    def foo():\n      Func(additional='(), this is cool!!!')\n\n  will display:\n\n  .. code-block:: text\n\n    ----------------------\n    foo(), this is cool!!!\n    ----------------------\n\n  .. code-block:: python\n\n    def foo():\n      Func('No function name here!')\n\n  will display:\n\n  .. code-block:: text\n\n    ----------------------\n    No function name here!\n    ----------------------\n\n  \"\"\"\n  if arg_0 is None:\n    arg_5, arg_6, arg_7 = getCallerInfo(2)\n    arg_0 = arg_5\n    if arg_7 is not None:\n      arg_0 = arg_7 + '.' + arg_5\n  arg_8 = (arg_0 + arg_1).split('\\n')\n  arg_9 = max(len(line) for line in arg_8)\n  print >> arg_2, '-' * arg_9\n  print >> arg_2, arg_0 + arg_1\n  print >> arg_2, '-' * arg_9", "path": "src/nupic/support/__init__.py", "identifier": "title", "docstring": "Utility function to display nice titles\n\n  It automatically extracts the name of the function/method it is called from\n  and you can add additional text. title() will then print the name\n  of the function/method and the additional text surrounded by tow lines\n  of dashes. If you don't want the name of the function, you can provide\n  alternative text (regardless of the additional text)\n\n  :param s: (string) text to display, uses the function name and arguments by\n         default\n  :param additional: (string) extra text to display (not needed if s is not\n         None)\n  :param stream: (stream) the stream to print to. Ny default goes to standard\n         output\n\n  Examples:\n\n  .. code-block:: python\n\n    def foo():\n      title()\n\n  will display:\n\n  .. code-block:: text\n\n    ---\n    foo\n    ---\n\n  .. code-block:: python\n\n    def foo():\n      title(additional='(), this is cool!!!')\n\n  will display:\n\n  .. code-block:: text\n\n    ----------------------\n    foo(), this is cool!!!\n    ----------------------\n\n  .. code-block:: python\n\n    def foo():\n      title('No function name here!')\n\n  will display:\n\n  .. code-block:: text\n\n    ----------------------\n    No function name here!\n    ----------------------", "docstring_tokens": ["Utility", "function", "to", "display", "nice", "titles"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255414}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/gatt.py#L111-L117", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Return list of GATT descriptors that have been discovered for this\n        characteristic.", "language": "python", "parameters": "(self)", "return_statement": "return map(BluezGattDescriptor,\n                   get_provider()._get_objects_by_path(paths))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_props", ".", "Get", "(", "_CHARACTERISTIC_INTERFACE", ",", "'Descriptors'", ")", "return", "map", "(", "BluezGattDescriptor", ",", "get_provider", "(", ")", ".", "_get_objects_by_path", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return list of GATT descriptors that have been discovered for this\n        characteristic.\n        \"\"\"\n        arg_1 = arg_0._props.Get(_CHARACTERISTIC_INTERFACE, 'Descriptors')\n        return map(BluezGattDescriptor,\n                   get_provider()._get_objects_by_path(arg_1))", "path": "Adafruit_BluefruitLE/bluez_dbus/gatt.py", "identifier": "BluezGattCharacteristic.list_descriptors", "docstring": "Return list of GATT descriptors that have been discovered for this\n        characteristic.", "docstring_tokens": ["Return", "list", "of", "GATT", "descriptors", "that", "have", "been", "discovered", "for", "this", "characteristic", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 255415}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L160-L184", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Generate a sorted list with namedtuples of hpogenes", "language": "python", "parameters": "(self, *hpo_terms)", "return_statement": "return sorted_genes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "hpo_term", "(", "arg_3", ")", "if", "arg_4", ":", "for", "arg_5", "in", "arg_4", "[", "'genes'", "]", ":", "if", "arg_5", "in", "arg_2", ":", "arg_2", "[", "arg_5", "]", "+=", "1", "else", ":", "arg_2", "[", "arg_5", "]", "=", "1", "else", ":", "LOG", ".", "warning", "(", "\"Term %s could not be found\"", ",", "arg_3", ")", "arg_6", "=", "sorted", "(", "arg_2", ".", "items", "(", ")", ",", "key", "=", "operator", ".", "itemgetter", "(", "1", ")", ",", "reverse", "=", "True", ")", "return", "arg_6"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Generate a sorted list with namedtuples of hpogenes\n\n            Each namedtuple of the list looks like (hgnc_id, count)\n\n            Args:\n                hpo_terms(iterable(str))\n\n            Returns:\n                hpo_genes(list(HpoGene))\n        \"\"\"\n        arg_2 = {}\n        for arg_3 in arg_1:\n            arg_4 = arg_0.hpo_term(arg_3)\n            if arg_4:\n                for arg_5 in arg_4['genes']:\n                    if arg_5 in arg_2:\n                        arg_2[arg_5] += 1\n                    else:\n                        arg_2[arg_5] = 1\n            else:\n                LOG.warning(\"Term %s could not be found\", arg_3)\n\n        arg_6 = sorted(arg_2.items(), key=operator.itemgetter(1), reverse=True)\n        return arg_6", "path": "scout/adapter/mongo/hpo.py", "identifier": "HpoHandler.generate_hpo_gene_list", "docstring": "Generate a sorted list with namedtuples of hpogenes\n\n            Each namedtuple of the list looks like (hgnc_id, count)\n\n            Args:\n                hpo_terms(iterable(str))\n\n            Returns:\n                hpo_genes(list(HpoGene))", "docstring_tokens": ["Generate", "a", "sorted", "list", "with", "namedtuples", "of", "hpogenes"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255416}
{"url": "https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L375-L383", "sha": "12172363d14eaedba2db4c452ef995b14f1b630d", "docstring_summary": "Add metadata to a file in the proto dataset.", "language": "python", "parameters": "(proto_dataset_uri, relpath_in_dataset, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "dtoolcore", ".", "ProtoDataSet", ".", "from_uri", "(", "uri", "=", "arg_0", ",", "config_path", "=", "CONFIG_PATH", ")", "arg_4", ".", "add_item_Func", "(", "handle", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Add Func to a file in the proto dataset.\"\"\"\n    arg_4 = dtoolcore.ProtoDataSet.from_uri(\n        uri=arg_0,\n        config_path=CONFIG_PATH)\n    arg_4.add_item_Func(\n        handle=arg_1,\n        arg_2=arg_2,\n        arg_3=arg_3)", "path": "dtool_create/dataset.py", "identifier": "metadata", "docstring": "Add metadata to a file in the proto dataset.", "docstring_tokens": ["Add", "metadata", "to", "a", "file", "in", "the", "proto", "dataset", "."], "nwo": "jic-dtool/dtool-create", "score": 0.25890992733444657, "idx": 255417}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L852-L855", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Generate a safe Python function name from a function name symbol.\n    If no symbol is provided, generate a name with a default prefix.", "language": "python", "parameters": "(s: Optional[str])", "return_statement": "return genname(\"__\" + munge(Maybe(s).or_else_get(_FN_PREFIX)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ")", "->", "arg_2", ":", "return", "genname", "(", "\"__\"", "+", "munge", "(", "Maybe", "(", "arg_0", ")", ".", "or_else_get", "(", "_FN_PREFIX", ")", ")", ")"], "function": "def Func(arg_0: arg_1[arg_2]) -> arg_2:\n    \"\"\"Generate a safe Python function name from a function name symbol.\n    If no symbol is provided, generate a name with a default prefix.\"\"\"\n    return genname(\"__\" + munge(Maybe(arg_0).or_else_get(_FN_PREFIX)))", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "__fn_name", "docstring": "Generate a safe Python function name from a function name symbol.\n    If no symbol is provided, generate a name with a default prefix.", "docstring_tokens": ["Generate", "a", "safe", "Python", "function", "name", "from", "a", "function", "name", "symbol", ".", "If", "no", "symbol", "is", "provided", "generate", "a", "name", "with", "a", "default", "prefix", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255418}
{"url": "https://github.com/mozilla-services/sign-xpi-lib/blob/bc6860b555fd26de9204f8d17289903e4fb9f106/sign_xpi_lib/sign_xpi_lib.py#L46-L66", "sha": "bc6860b555fd26de9204f8d17289903e4fb9f106", "docstring_summary": "Sort keys for xpi files", "language": "python", "parameters": "(filename)", "return_statement": "return (prio, os.path.split(filename.lower()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "4", "if", "arg_0", "==", "'install.rdf'", ":", "arg_1", "=", "1", "elif", "arg_0", "in", "[", "\"chrome.manifest\"", ",", "\"icon.png\"", ",", "\"icon64.png\"", "]", ":", "arg_1", "=", "2", "elif", "arg_0", "in", "[", "\"MPL\"", ",", "\"GPL\"", ",", "\"LGPL\"", ",", "\"COPYING\"", ",", "\"LICENSE\"", ",", "\"license.txt\"", "]", ":", "arg_1", "=", "5", "return", "(", "arg_1", ",", "os", ".", "path", ".", "split", "(", "arg_0", ".", "lower", "(", ")", ")", ")"], "function": "def Func(arg_0):\n    '''Sort keys for xpi files\n\n    The filenames in a manifest are ordered so that files not in a\n    directory come before files in any directory, ordered\n    alphabetically but ignoring case, with a few exceptions\n    (install.rdf, chrome.manifest, icon.png and icon64.png come at the\n    beginning; licenses come at the end).\n\n    This order does not appear to affect anything in any way, but it\n    looks nicer.\n    '''\n    arg_1 = 4\n    if arg_0 == 'install.rdf':\n        arg_1 = 1\n    elif arg_0 in [\"chrome.manifest\", \"icon.png\", \"icon64.png\"]:\n        arg_1 = 2\n    elif arg_0 in [\"MPL\", \"GPL\", \"LGPL\", \"COPYING\",\n                      \"LICENSE\", \"license.txt\"]:\n        arg_1 = 5\n    return (arg_1, os.path.split(arg_0.lower()))", "path": "sign_xpi_lib/sign_xpi_lib.py", "identifier": "file_key", "docstring": "Sort keys for xpi files\n\n    The filenames in a manifest are ordered so that files not in a\n    directory come before files in any directory, ordered\n    alphabetically but ignoring case, with a few exceptions\n    (install.rdf, chrome.manifest, icon.png and icon64.png come at the\n    beginning; licenses come at the end).\n\n    This order does not appear to affect anything in any way, but it\n    looks nicer.", "docstring_tokens": ["Sort", "keys", "for", "xpi", "files"], "nwo": "mozilla-services/sign-xpi-lib", "score": 0.21302904236143622, "idx": 255419}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/__init__.py#L85-L121", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Filter a mechanisms list only to include those mechanisms that cans\n    succeed with the provided properties and are secure enough.", "language": "python", "parameters": "(mechanisms, properties, allow_insecure = False,\n                            server_side = False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ":", "try", ":", "if", "arg_3", ":", "arg_6", "=", "SERVER_MECHANISMS_D", "[", "arg_5", "]", "else", ":", "arg_6", "=", "CLIENT_MECHANISMS_D", "[", "arg_5", "]", "except", "KeyError", ":", "logger", ".", "debug", "(", "\" skipping {0} - not supported\"", ".", "format", "(", "arg_5", ")", ")", "continue", "arg_7", "=", "arg_1", ".", "get", "(", "\"security-layer\"", ")", "if", "not", "arg_2", "and", "not", "arg_6", ".", "_pyxmpp_sasl_secure", "and", "not", "arg_7", ":", "logger", ".", "debug", "(", "\" skipping {0}, as it is not secure\"", ".", "format", "(", "arg_5", ")", ")", "continue", "if", "not", "arg_6", ".", "are_properties_sufficient", "(", "arg_1", ")", ":", "logger", ".", "debug", "(", "\" skipping {0}, as the properties are not sufficient\"", ".", "format", "(", "arg_5", ")", ")", "continue", "arg_4", ".", "append", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2 = False,\n                            arg_3 = False):\n    \"\"\"Filter a mechanisms list only to include those mechanisms that cans\n    succeed with the provided properties and are secure enough.\n\n    :Parameters:\n        - `mechanisms`: list of the mechanisms names\n        - `properties`: available authentication properties\n        - `allow_insecure`: allow insecure mechanisms\n    :Types:\n        - `mechanisms`: sequence of `unicode`\n        - `properties`: mapping\n        - `allow_insecure`: `bool`\n\n    :returntype: `list` of `unicode`\n    \"\"\"\n    # pylint: disable=W0212\n    arg_4 = []\n    for arg_5 in arg_0:\n        try:\n            if arg_3:\n                arg_6 = SERVER_MECHANISMS_D[arg_5]\n            else:\n                arg_6 = CLIENT_MECHANISMS_D[arg_5]\n        except KeyError:\n            logger.debug(\" skipping {0} - not supported\".format(arg_5))\n            continue\n        arg_7 = arg_1.get(\"security-layer\")\n        if not arg_2 and not arg_6._pyxmpp_sasl_secure and not arg_7:\n            logger.debug(\" skipping {0}, as it is not secure\".format(arg_5))\n            continue\n        if not arg_6.are_properties_sufficient(arg_1):\n            logger.debug(\" skipping {0}, as the properties are not sufficient\"\n                                                            .format(arg_5))\n            continue\n        arg_4.append(arg_5)\n    return arg_4", "path": "pyxmpp2/sasl/__init__.py", "identifier": "filter_mechanism_list", "docstring": "Filter a mechanisms list only to include those mechanisms that cans\n    succeed with the provided properties and are secure enough.\n\n    :Parameters:\n        - `mechanisms`: list of the mechanisms names\n        - `properties`: available authentication properties\n        - `allow_insecure`: allow insecure mechanisms\n    :Types:\n        - `mechanisms`: sequence of `unicode`\n        - `properties`: mapping\n        - `allow_insecure`: `bool`\n\n    :returntype: `list` of `unicode`", "docstring_tokens": ["Filter", "a", "mechanisms", "list", "only", "to", "include", "those", "mechanisms", "that", "cans", "succeed", "with", "the", "provided", "properties", "and", "are", "secure", "enough", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255420}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/conf/__init__.py#L71-L114", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "bind user variable to `_wrapped`", "language": "python", "parameters": "(mod_path, with_path=None)", "return_statement": "return settings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "sys", ".", "path", ".", "insert", "(", "0", ",", "arg_1", ")", "else", ":", "sys", ".", "path", ".", "insert", "(", "0", ",", "arg_1", ".", "rsplit", "(", "'/'", ",", "2", ")", "[", "0", "]", ")", "pass", "arg_2", "=", "importlib", ".", "import_module", "(", "arg_0", ")", "arg_3", "=", "arg_5", "(", ")", "for", "arg_4", "in", "dir", "(", "arg_2", ")", ":", "if", "arg_4", "[", "0", "]", "==", "'_'", "or", "type", "(", "getattr", "(", "arg_2", ",", "arg_4", ")", ")", ".", "__name__", "==", "'module'", ":", "continue", "setattr", "(", "arg_3", ",", "arg_4", ",", "getattr", "(", "arg_2", ",", "arg_4", ")", ")", "pass", "arg_5", ".", "_path", "=", "arg_0", "arg_5", ".", "_wrapped", "=", "arg_3", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Func user variable to `_wrapped`\n\n        .. note::\n\n            you don't need call this method by yourself.\n\n            program will call it in  `cliez.parser.parse`\n\n\n        .. expection::\n\n            if path is not correct,will cause an `ImportError`\n\n\n        :param str mod_path: module path, *use dot style,'mod.mod1'*\n        :param str with_path: add path to `sys.path`,\n            if path is file,use its parent.\n        :return: A instance of `Settings`\n        \"\"\"\n\n        if arg_1:\n            if os.path.isdir(arg_1):\n                sys.path.insert(0, arg_1)\n            else:\n                sys.path.insert(0, arg_1.rsplit('/', 2)[0])\n            pass\n\n        # raise `ImportError` mod_path if not exist\n        arg_2 = importlib.import_module(arg_0)\n\n        arg_3 = arg_5()\n\n        for arg_4 in dir(arg_2):\n            if arg_4[0] == '_' or type(getattr(arg_2, arg_4)).__name__ == 'module':\n                continue\n            setattr(arg_3, arg_4, getattr(arg_2, arg_4))\n            pass\n\n        arg_5._path = arg_0\n        arg_5._wrapped = arg_3\n\n        return arg_3", "path": "cliez/conf/__init__.py", "identifier": "Settings.bind", "docstring": "bind user variable to `_wrapped`\n\n        .. note::\n\n            you don't need call this method by yourself.\n\n            program will call it in  `cliez.parser.parse`\n\n\n        .. expection::\n\n            if path is not correct,will cause an `ImportError`\n\n\n        :param str mod_path: module path, *use dot style,'mod.mod1'*\n        :param str with_path: add path to `sys.path`,\n            if path is file,use its parent.\n        :return: A instance of `Settings`", "docstring_tokens": ["bind", "user", "variable", "to", "_wrapped"], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 255421}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/sbio/shell.py#L334-L339", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Show help on all commands.", "language": "python", "parameters": "(self, arg)", "return_statement": "return cmd.Cmd.do_help(self, arg)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "(", "arg_0", ".", "response_prompt", ",", "file", "=", "arg_0", ".", "stdout", ")", "return", "cmd", ".", "Cmd", ".", "Func", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Show help on all commands.\n        \"\"\"\n        print(arg_0.response_prompt, file=arg_0.stdout)\n        return cmd.Cmd.Func(arg_0, arg_1)", "path": "shoebot/sbio/shell.py", "identifier": "ShoebotCmd.do_help", "docstring": "Show help on all commands.", "docstring_tokens": ["Show", "help", "on", "all", "commands", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255422}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/submit.py#L253-L291", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "We use the packer to make a package for the jar and dump it\n  to a well-known location. We then run the main method of class\n  with the specified arguments. We pass arguments as an environment variable HERON_OPTIONS.", "language": "python", "parameters": "(cl_args, unknown_args, tmp_dir)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "[", "'topology-file-name'", "]", "arg_4", "=", "arg_0", "[", "'topology-class-name'", "]", "arg_5", "=", "execute", ".", "heron_class", "(", "class_name", "=", "arg_4", ",", "lib_jars", "=", "config", ".", "get_heron_libs", "(", "jars", ".", "topology_jars", "(", ")", ")", ",", "extra_jars", "=", "[", "arg_3", "]", ",", "args", "=", "tuple", "(", "arg_1", ")", ",", "java_defines", "=", "arg_0", "[", "'topology_main_jvm_property'", "]", ")", "result", ".", "render", "(", "arg_5", ")", "if", "not", "result", ".", "is_successful", "(", "arg_5", ")", ":", "arg_6", "=", "(", "\"Failed to create topology definition \"", "\"file when executing class '%s' of file '%s'\"", ")", "%", "(", "arg_4", ",", "arg_3", ")", "arg_5", ".", "add_context", "(", "arg_6", ")", "return", "arg_5", "arg_7", "=", "launch_topologies", "(", "arg_0", ",", "arg_3", ",", "arg_2", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2):\n  '''\n  We use the packer to make a package for the jar and dump it\n  to a well-known location. We then run the main method of class\n  with the specified arguments. We pass arguments as an environment variable HERON_OPTIONS.\n\n  This will run the jar file with the topology_class_name. The submitter\n  inside will write out the topology defn file to a location that\n  we specify. Then we write the topology defn file to a well known\n  location. We then write to appropriate places in zookeeper\n  and launch the scheduler jobs\n  :param cl_args:\n  :param unknown_args:\n  :param tmp_dir:\n  :return:\n  '''\n  # execute main of the topology to create the topology definition\n  arg_3 = arg_0['topology-file-name']\n\n  arg_4 = arg_0['topology-class-name']\n\n  arg_5 = execute.heron_class(\n      class_name=arg_4,\n      lib_jars=config.get_heron_libs(jars.topology_jars()),\n      extra_jars=[arg_3],\n      args=tuple(arg_1),\n      java_defines=arg_0['topology_main_jvm_property'])\n\n  result.render(arg_5)\n\n  if not result.is_successful(arg_5):\n    arg_6 = (\"Failed to create topology definition \" \\\n      \"file when executing class '%s' of file '%s'\") % (arg_4, arg_3)\n    arg_5.add_context(arg_6)\n    return arg_5\n\n  arg_7 = launch_topologies(arg_0, arg_3, arg_2)\n\n  return arg_7", "path": "heron/tools/cli/src/python/submit.py", "identifier": "submit_fatjar", "docstring": "We use the packer to make a package for the jar and dump it\n  to a well-known location. We then run the main method of class\n  with the specified arguments. We pass arguments as an environment variable HERON_OPTIONS.\n\n  This will run the jar file with the topology_class_name. The submitter\n  inside will write out the topology defn file to a location that\n  we specify. Then we write the topology defn file to a well known\n  location. We then write to appropriate places in zookeeper\n  and launch the scheduler jobs\n  :param cl_args:\n  :param unknown_args:\n  :param tmp_dir:\n  :return:", "docstring_tokens": ["We", "use", "the", "packer", "to", "make", "a", "package", "for", "the", "jar", "and", "dump", "it", "to", "a", "well", "-", "known", "location", ".", "We", "then", "run", "the", "main", "method", "of", "class", "with", "the", "specified", "arguments", ".", "We", "pass", "arguments", "as", "an", "environment", "variable", "HERON_OPTIONS", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255423}
{"url": "https://github.com/cmcginty/PyWeather/blob/8c25d9cd1fa921e0a6e460d523656279cac045cb/weather/units/temp.py#L118-L132", "sha": "8c25d9cd1fa921e0a6e460d523656279cac045cb", "docstring_summary": "calculates the dewpoint via the formula from weatherwise.org\n    return the dewpoint in degrees F.", "language": "python", "parameters": "(temp, hum)", "return_statement": "return celsius_to_fahrenheit(dewpoint)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "fahrenheit_to_celsius", "(", "arg_0", ")", "arg_3", "=", "1", "-", "0.01", "*", "arg_1", "arg_4", "=", "(", "14.55", "+", "0.114", "*", "arg_2", ")", "*", "arg_3", "arg_4", "=", "arg_4", "+", "(", "(", "2.5", "+", "0.007", "*", "arg_2", ")", "*", "arg_3", ")", "**", "3", "arg_4", "=", "arg_4", "+", "(", "15.9", "+", "0.117", "*", "arg_2", ")", "*", "arg_3", "**", "14", "arg_4", "=", "arg_2", "-", "arg_4", "return", "celsius_to_fahrenheit", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    calculates the dewpoint via the formula from weatherwise.org\n    return the dewpoint in degrees F.\n    '''\n\n    arg_2 = fahrenheit_to_celsius(arg_0)\n    arg_3 = 1 - 0.01 * arg_1;\n\n    arg_4 = (14.55 + 0.114 * arg_2) * arg_3;\n    arg_4 = arg_4 + ((2.5 + 0.007 * arg_2) * arg_3) ** 3;\n    arg_4 = arg_4 + (15.9 + 0.117 * arg_2) * arg_3 ** 14;\n    arg_4 = arg_2 - arg_4;\n\n    return celsius_to_fahrenheit(arg_4)", "path": "weather/units/temp.py", "identifier": "calc_dewpoint", "docstring": "calculates the dewpoint via the formula from weatherwise.org\n    return the dewpoint in degrees F.", "docstring_tokens": ["calculates", "the", "dewpoint", "via", "the", "formula", "from", "weatherwise", ".", "org", "return", "the", "dewpoint", "in", "degrees", "F", "."], "nwo": "cmcginty/PyWeather", "score": 0.19714217663807126, "idx": 255424}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L549-L573", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Processes and saves a resized thumbnail version of the image.", "language": "python", "parameters": "(self, image, size, name, label, file_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", ",", "arg_7", "=", "arg_2", "(", "arg_8", ",", "arg_9", ")", "=", "arg_1", ".", "size", "if", "(", "arg_8", ">", "arg_6", ")", "or", "(", "arg_9", ">", "arg_7", ")", ":", "arg_1", ".", "thumbnail", "(", "arg_2", ",", "Img", ".", "ANTIALIAS", ")", "arg_3", "=", "\"%s-%s.jpg\"", "%", "(", "arg_3", ",", "arg_4", ")", "if", "arg_5", "in", "arg_0", ".", "JPG_FORMATS", ":", "arg_5", "=", "'JPEG'", "arg_10", "=", "StringIO", ".", "StringIO", "(", ")", "arg_1", ".", "save", "(", "arg_10", ",", "format", "=", "arg_5", ",", "quality", "=", "75", ")", "arg_11", "=", "InMemoryUploadedFile", "(", "arg_10", ",", "None", ",", "arg_3", ",", "'image/jpeg'", ",", "arg_10", ".", "len", ",", "None", ")", "default_storage", ".", "save", "(", "arg_3", ",", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"Processes and saves a resized thumbnail version of the image.\"\"\"\n        arg_6, arg_7 = arg_2\n        (arg_8, arg_9) = arg_1.size\n\n        # If image is larger than thumbnail size, resize image\n        if (arg_8 > arg_6) or (arg_9 > arg_7):\n            arg_1.thumbnail(arg_2, Img.ANTIALIAS)\n\n        # Attach new thumbnail label to image filename\n        arg_3 = \"%s-%s.jpg\" % (arg_3, arg_4)\n\n        # Image.save format takes JPEG not jpg\n        if arg_5 in arg_0.JPG_FORMATS:\n            arg_5 = 'JPEG'\n\n        # Write new thumbnail to StringIO object\n        arg_10 = StringIO.StringIO()\n        arg_1.save(arg_10, format=arg_5, quality=75)\n\n        # Convert StringIO object to Django File object\n        arg_11 = InMemoryUploadedFile(arg_10, None, arg_3, 'image/jpeg', arg_10.len, None)\n\n        # Save the new file to the default storage system\n        default_storage.save(arg_3, arg_11)", "path": "dispatch/modules/content/models.py", "identifier": "Image.save_thumbnail", "docstring": "Processes and saves a resized thumbnail version of the image.", "docstring_tokens": ["Processes", "and", "saves", "a", "resized", "thumbnail", "version", "of", "the", "image", "."], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 255425}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L319-L338", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Enable the joint motors in this skeleton.", "language": "python", "parameters": "(self, max_force)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "joints", ":", "arg_3", "=", "getattr", "(", "arg_2", ",", "'amotor'", ",", "arg_2", ")", "arg_3", ".", "max_forces", "=", "arg_1", "if", "arg_1", ">", "0", ":", "arg_3", ".", "enable_feedback", "(", ")", "else", ":", "arg_3", ".", "disable_feedback", "(", ")"], "function": "def Func(arg_0, arg_1):\n        '''Enable the joint motors in this skeleton.\n\n        This method sets the maximum force that can be applied by each joint to\n        attain the desired target velocities. It also enables torque feedback\n        for all joint motors.\n\n        Parameters\n        ----------\n        max_force : float\n            The maximum force that each joint is allowed to apply to attain its\n            target velocity.\n        '''\n        for arg_2 in arg_0.joints:\n            arg_3 = getattr(arg_2, 'amotor', arg_2)\n            arg_3.max_forces = arg_1\n            if arg_1 > 0:\n                arg_3.enable_feedback()\n            else:\n                arg_3.disable_feedback()", "path": "pagoda/skeleton.py", "identifier": "Skeleton.enable_motors", "docstring": "Enable the joint motors in this skeleton.\n\n        This method sets the maximum force that can be applied by each joint to\n        attain the desired target velocities. It also enables torque feedback\n        for all joint motors.\n\n        Parameters\n        ----------\n        max_force : float\n            The maximum force that each joint is allowed to apply to attain its\n            target velocity.", "docstring_tokens": ["Enable", "the", "joint", "motors", "in", "this", "skeleton", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 255426}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/templite.py#L27-L31", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Add a section, a sub-CodeBuilder.", "language": "python", "parameters": "(self)", "return_statement": "return sect", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "CodeBuilder", "(", "arg_0", ".", "indent_amount", ")", "arg_0", ".", "code", ".", "append", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Add a section, a sub-CodeBuilder.\"\"\"\n        arg_1 = CodeBuilder(arg_0.indent_amount)\n        arg_0.code.append(arg_1)\n        return arg_1", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/templite.py", "identifier": "CodeBuilder.add_section", "docstring": "Add a section, a sub-CodeBuilder.", "docstring_tokens": ["Add", "a", "section", "a", "sub", "-", "CodeBuilder", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 255427}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L878-L902", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Reads a file and returns its contents as a list of lines. Works for both local and remote files.", "language": "python", "parameters": "(filename, newline=None, encoding=None)", "return_statement": "return GetFileContents(\n        filename,\n        binary=False,\n        encoding=encoding,\n        newline=newline,\n    ).split('\\n')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "return", "GetFileContents", "(", "arg_0", ",", "binary", "=", "False", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ",", ")", ".", "split", "(", "'\\n'", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    '''\n    Reads a file and returns its contents as a list of lines. Works for both local and remote files.\n\n    :param unicode filename:\n\n    :param None|''|'\\n'|'\\r'|'\\r\\n' newline:\n        Controls universal newlines.\n        See 'io.open' newline parameter documentation for more details.\n\n    :param unicode encoding:\n        File's encoding. If not None, contents obtained from file will be decoded using this\n        `encoding`.\n\n    :returns list(unicode):\n        The file's lines\n\n    .. seealso:: FTP LIMITATIONS at this module's doc for performance issues information\n    '''\n    return GetFileContents(\n        arg_0,\n        binary=False,\n        arg_2=arg_2,\n        arg_1=arg_1,\n    ).split('\\n')", "path": "zerotk/easyfs/_easyfs.py", "identifier": "GetFileLines", "docstring": "Reads a file and returns its contents as a list of lines. Works for both local and remote files.\n\n    :param unicode filename:\n\n    :param None|''|'\\n'|'\\r'|'\\r\\n' newline:\n        Controls universal newlines.\n        See 'io.open' newline parameter documentation for more details.\n\n    :param unicode encoding:\n        File's encoding. If not None, contents obtained from file will be decoded using this\n        `encoding`.\n\n    :returns list(unicode):\n        The file's lines\n\n    .. seealso:: FTP LIMITATIONS at this module's doc for performance issues information", "docstring_tokens": ["Reads", "a", "file", "and", "returns", "its", "contents", "as", "a", "list", "of", "lines", ".", "Works", "for", "both", "local", "and", "remote", "files", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 255428}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment.py#L776-L802", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Unbookmark experiment.", "language": "python", "parameters": "(ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "get_project_experiment_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'experiment'", ")", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "experiment", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func experiment `{}`.'", ".", "format", "(", "arg_3", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"Experiment is Funced.\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Unbookmark experiment.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon experiment Func\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 2 Func\n    ```\n    \"\"\"\n    arg_1, arg_2, arg_3 = get_project_experiment_or_local(arg_0.obj.get('project'),\n                                                                      arg_0.obj.get('experiment'))\n    try:\n        PolyaxonClient().experiment.Func(arg_1, arg_2, arg_3)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func experiment `{}`.'.format(arg_3))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"Experiment is Funced.\")", "path": "polyaxon_cli/cli/experiment.py", "identifier": "unbookmark", "docstring": "Unbookmark experiment.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon experiment unbookmark\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 2 unbookmark\n    ```", "docstring_tokens": ["Unbookmark", "experiment", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 255429}
{"url": "https://github.com/neon-jungle/wagtailmodelchooser/blob/8dd1e33dd61418a726ff3acf67a956626c8b7ba1/wagtailmodelchooser/utils.py#L32-L42", "sha": "8dd1e33dd61418a726ff3acf67a956626c8b7ba1", "docstring_summary": "Work out if a function is callable with some args or not.", "language": "python", "parameters": "(func, args=(), kwargs={})", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", ")", ",", "arg_2", "=", "{", "}", ")", ":", "try", ":", "arg_3", "=", "inspect", ".", "signature", "(", "arg_0", ")", "arg_3", ".", "bind", "(", "*", "arg_1", ",", "**", "arg_2", ")", "except", "TypeError", ":", "return", "False", "else", ":", "return", "True"], "function": "def Func(arg_0, arg_1=(), arg_2={}):\n    \"\"\"\n    Work out if a function is callable with some args or not.\n    \"\"\"\n    try:\n        arg_3 = inspect.signature(arg_0)\n        arg_3.bind(*arg_1, **arg_2)\n    except TypeError:\n        return False\n    else:\n        return True", "path": "wagtailmodelchooser/utils.py", "identifier": "signature_matches", "docstring": "Work out if a function is callable with some args or not.", "docstring_tokens": ["Work", "out", "if", "a", "function", "is", "callable", "with", "some", "args", "or", "not", "."], "nwo": "neon-jungle/wagtailmodelchooser", "score": 0.5155075947839176, "idx": 255430}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/binomial.py#L462-L482", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return the coordinates of the ROC curve for a given set of data.", "language": "python", "parameters": "(self, train=False, valid=False, xval=False)", "return_statement": "return list(m.values())[0] if len(m) == 1 else m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "ModelBase", ".", "_get_metrics", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "{", "}", "for", "arg_6", ",", "arg_7", "in", "viewitems", "(", "arg_4", ")", ":", "if", "arg_7", "is", "not", "None", ":", "arg_5", "[", "arg_6", "]", "=", "(", "arg_7", ".", "fprs", ",", "arg_7", ".", "tprs", ")", "return", "list", "(", "arg_5", ".", "values", "(", ")", ")", "[", "0", "]", "if", "len", "(", "arg_5", ")", "==", "1", "else", "arg_5"], "function": "def Func(arg_0, arg_1=False, arg_2=False, arg_3=False):\n        \"\"\"\n        Return the coordinates of the ROC curve for a given set of data.\n\n        The coordinates are two-tuples containing the false positive rates as a list and true positive rates as a list.\n        If all are False (default), then return is the training data. If more than one ROC\n        curve is requested, the data is returned as a dictionary of two-tuples.\n\n        :param bool train: If True, return the ROC value for the training data.\n        :param bool valid: If True, return the ROC value for the validation data.\n        :param bool xval: If True, return the ROC value for each of the cross-validated splits.\n\n        :returns: The ROC values for the specified key(s).\n        \"\"\"\n        arg_4 = ModelBase._get_metrics(arg_0, arg_1, arg_2, arg_3)\n        arg_5 = {}\n        for arg_6, arg_7 in viewitems(arg_4):\n\n            if arg_7 is not None:\n                arg_5[arg_6] = (arg_7.fprs, arg_7.tprs)\n        return list(arg_5.values())[0] if len(arg_5) == 1 else arg_5", "path": "h2o-py/h2o/model/binomial.py", "identifier": "H2OBinomialModel.roc", "docstring": "Return the coordinates of the ROC curve for a given set of data.\n\n        The coordinates are two-tuples containing the false positive rates as a list and true positive rates as a list.\n        If all are False (default), then return is the training data. If more than one ROC\n        curve is requested, the data is returned as a dictionary of two-tuples.\n\n        :param bool train: If True, return the ROC value for the training data.\n        :param bool valid: If True, return the ROC value for the validation data.\n        :param bool xval: If True, return the ROC value for each of the cross-validated splits.\n\n        :returns: The ROC values for the specified key(s).", "docstring_tokens": ["Return", "the", "coordinates", "of", "the", "ROC", "curve", "for", "a", "given", "set", "of", "data", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255431}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/threads.py#L409-L417", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Remove an IOHandler from the pool.", "language": "python", "parameters": "(self, handler)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "io_handlers", ":", "return", "arg_0", ".", "io_handlers", ".", "remove", "(", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "io_threads", ":", "if", "arg_2", ".", "io_handler", "is", "arg_1", ":", "arg_2", ".", "stop", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove an IOHandler from the pool.\n        \"\"\"\n        if arg_1 not in arg_0.io_handlers:\n            return\n        arg_0.io_handlers.remove(arg_1)\n        for arg_2 in arg_0.io_threads:\n            if arg_2.io_handler is arg_1:\n                arg_2.stop()", "path": "pyxmpp2/mainloop/threads.py", "identifier": "ThreadPool._remove_io_handler", "docstring": "Remove an IOHandler from the pool.", "docstring_tokens": ["Remove", "an", "IOHandler", "from", "the", "pool", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255432}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/views.py#L509-L569", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Handles a products list form in the given request. Returns the\n    form instance, the discounts applicable to this form, and whether the\n    contents were handled.", "language": "python", "parameters": "(request, category, products, prefix)", "return_statement": "return products_form, discounts, handled", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "CartController", ".", "for_user", "(", "arg_0", ".", "user", ")", "arg_5", "=", "forms", ".", "ProductsForm", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "commerce", ".", "ProductItem", ".", "objects", ".", "filter", "(", "product__in", "=", "arg_2", ",", "cart", "=", "arg_4", ".", "cart", ",", ")", ".", "select_related", "(", "\"product\"", ")", "arg_7", "=", "[", "]", "arg_8", "=", "set", "(", ")", "for", "arg_9", "in", "arg_6", ":", "arg_7", ".", "append", "(", "(", "arg_9", ".", "product", ",", "arg_9", ".", "quantity", ")", ")", "arg_8", ".", "add", "(", "arg_9", ".", "product", ")", "arg_10", "=", "set", "(", "arg_2", ")", "-", "arg_8", "for", "arg_11", "in", "arg_10", ":", "arg_7", ".", "append", "(", "(", "arg_11", ",", "0", ")", ")", "arg_12", "=", "arg_5", "(", "arg_0", ".", "POST", "or", "None", ",", "product_quantities", "=", "arg_7", ",", "arg_3", "=", "arg_3", ",", ")", "if", "arg_0", ".", "method", "==", "\"POST\"", "and", "arg_12", ".", "is_valid", "(", ")", ":", "if", "arg_12", ".", "has_changed", "(", ")", ":", "_set_quantities_from_products_form", "(", "arg_12", ",", "arg_4", ")", "if", "arg_1", ".", "required", ":", "arg_13", "=", "commerce", ".", "Cart", ".", "objects", ".", "filter", "(", "user", "=", "arg_0", ".", "user", ")", "arg_6", "=", "commerce", ".", "ProductItem", ".", "objects", ".", "filter", "(", "product__category", "=", "arg_1", ",", "cart", "=", "arg_13", ",", ")", "if", "len", "(", "arg_6", ")", "==", "0", ":", "arg_12", ".", "add_error", "(", "None", ",", "\"You must have at least one item from this category\"", ",", ")", "arg_14", "=", "False", "if", "arg_12", ".", "errors", "else", "True", "arg_15", "=", "util", ".", "lazy", "(", "DiscountController", ".", "available_discounts", ",", "arg_0", ".", "user", ",", "[", "]", ",", "arg_2", ",", ")", "return", "arg_12", ",", "arg_15", ",", "arg_14"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    ''' Handles a products list form in the given request. Returns the\n    form instance, the discounts applicable to this form, and whether the\n    contents were handled. '''\n\n    arg_4 = CartController.for_user(arg_0.user)\n\n    arg_5 = forms.ProductsForm(arg_1, arg_2)\n\n    # Create initial data for each of products in category\n    arg_6 = commerce.ProductItem.objects.filter(\n        product__in=arg_2,\n        cart=arg_4.cart,\n    ).select_related(\"product\")\n    arg_7 = []\n    arg_8 = set()\n\n    for arg_9 in arg_6:\n        arg_7.append((arg_9.product, arg_9.quantity))\n        arg_8.add(arg_9.product)\n\n    arg_10 = set(arg_2) - arg_8\n    for arg_11 in arg_10:\n        arg_7.append((arg_11, 0))\n\n    arg_12 = arg_5(\n        arg_0.POST or None,\n        product_quantities=arg_7,\n        arg_3=arg_3,\n    )\n\n    if arg_0.method == \"POST\" and arg_12.is_valid():\n        if arg_12.has_changed():\n            _set_quantities_from_products_form(arg_12, arg_4)\n\n        # If category is required, the user must have at least one\n        # in an active+valid cart\n        if arg_1.required:\n            arg_13 = commerce.Cart.objects.filter(user=arg_0.user)\n            arg_6 = commerce.ProductItem.objects.filter(\n                product__category=arg_1,\n                cart=arg_13,\n            )\n            if len(arg_6) == 0:\n                arg_12.add_error(\n                    None,\n                    \"You must have at least one item from this category\",\n                )\n    arg_14 = False if arg_12.errors else True\n\n    # Making this a function to lazily evaluate when it's displayed\n    # in templates.\n\n    arg_15 = util.lazy(\n        DiscountController.available_discounts,\n        arg_0.user,\n        [],\n        arg_2,\n    )\n\n    return arg_12, arg_15, arg_14", "path": "registrasion/views.py", "identifier": "_handle_products", "docstring": "Handles a products list form in the given request. Returns the\n    form instance, the discounts applicable to this form, and whether the\n    contents were handled.", "docstring_tokens": ["Handles", "a", "products", "list", "form", "in", "the", "given", "request", ".", "Returns", "the", "form", "instance", "the", "discounts", "applicable", "to", "this", "form", "and", "whether", "the", "contents", "were", "handled", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 255433}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/packet.py#L343-L361", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Get a single analog data channel.", "language": "python", "parameters": "(\n        self, component_info=None, data=None, component_position=None\n    )", "return_statement": "return components", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "arg_4", ".", "append", "for", "arg_6", "in", "range", "(", "arg_1", ".", "device_count", ")", ":", "arg_3", ",", "arg_7", "=", "QRTPacket", ".", "_get_exact", "(", "RTAnalogDeviceSingle", ",", "arg_2", ",", "arg_3", ")", "arg_8", ".", "format", "=", "struct", ".", "Struct", "(", "arg_8", ".", "format_str", "%", "arg_7", ".", "channel_count", ")", "arg_3", ",", "arg_10", "=", "QRTPacket", ".", "_get_tuple", "(", "arg_8", ",", "arg_2", ",", "arg_3", ")", "arg_5", "(", "(", "arg_7", ",", "arg_10", ")", ")", "return", "arg_4"], "function": "def Func(\n        arg_0, arg_1=None, arg_2=None, arg_3=None\n    ):\n        \"\"\"Get a single analog data channel.\"\"\"\n        arg_4 = []\n        arg_5 = arg_4.append\n        for arg_6 in range(arg_1.device_count):\n            arg_3, arg_7 = QRTPacket._get_exact(\n                RTAnalogDeviceSingle, arg_2, arg_3\n            )\n\n            arg_8.format = struct.Struct(\n                arg_8.format_str % arg_7.channel_count\n            )\n            arg_3, arg_10 = QRTPacket._get_tuple(\n                arg_8, arg_2, arg_3\n            )\n            arg_5((arg_7, arg_10))\n        return arg_4", "path": "qtm/packet.py", "identifier": "QRTPacket.get_analog_single", "docstring": "Get a single analog data channel.", "docstring_tokens": ["Get", "a", "single", "analog", "data", "channel", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 255434}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L356-L367", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Rebuild this droplet with given image id", "language": "python", "parameters": "(self, image, wait=True)", "return_statement": "return self._action('rebuild', image=image, wait=wait)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "return", "arg_0", ".", "_action", "(", "'Func'", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Rebuild this droplet with given image id\n\n        Parameters\n        ----------\n        image: int or str\n            int for image id and str for image slug\n        wait: bool, default True\n            Whether to block until the pending action is completed\n        \"\"\"\n        return arg_0._action('Func', arg_1=arg_1, arg_2=arg_2)", "path": "poseidon/droplet.py", "identifier": "DropletActions.rebuild", "docstring": "Rebuild this droplet with given image id\n\n        Parameters\n        ----------\n        image: int or str\n            int for image id and str for image slug\n        wait: bool, default True\n            Whether to block until the pending action is completed", "docstring_tokens": ["Rebuild", "this", "droplet", "with", "given", "image", "id"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 255435}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/rank.py#L6-L91", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "This function creates rank columns based on numeric values to be ranked.", "language": "python", "parameters": "(\n        df,\n        value_cols: Union[str, List[str]],\n        group_cols: List[str] = None,\n        rank_cols_names: List[str] = None,\n        method='min',\n        ascending: bool = True\n)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", ",", "arg_4", "[", "arg_3", "]", "]", ",", "arg_5", ":", "arg_4", "[", "arg_3", "]", "=", "None", ",", "arg_6", ":", "arg_4", "[", "arg_3", "]", "=", "None", ",", "arg_7", "=", "'min'", ",", "arg_8", ":", "arg_9", "=", "True", ")", ":", "arg_1", "=", "[", "arg_1", "]", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", "else", "arg_1", "for", "arg_10", "in", "arg_1", ":", "if", "not", "np", ".", "issubdtype", "(", "arg_0", "[", "arg_10", "]", ".", "dtype", ",", "np", ".", "number", ")", ":", "raise", "TypeError", "(", "arg_10", "+", "\" specified in value_cols must be of numeric type\"", ")", "if", "arg_6", "is", "None", ":", "arg_6", "=", "[", "x", "+", "'_Func'", "for", "x", "in", "arg_1", "]", "if", "arg_5", "is", "None", ":", "arg_0", "[", "arg_6", "]", "=", "arg_0", "[", "arg_1", "]", ".", "Func", "(", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", "else", ":", "arg_0", "[", "arg_6", "]", "=", "(", "arg_0", ".", "groupby", "(", "arg_5", ")", "[", "arg_1", "]", ".", "Func", "(", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", ")", "if", "arg_7", "!=", "'average'", ":", "arg_0", "[", "arg_6", "]", "=", "arg_0", "[", "arg_6", "]", ".", "astype", "(", "'int'", ")", "return", "arg_0"], "function": "def Func(\n        arg_0,\n        arg_1: arg_2[arg_3, arg_4[arg_3]],\n        arg_5: arg_4[arg_3] = None,\n        arg_6: arg_4[arg_3] = None,\n        arg_7='min',\n        arg_8: arg_9 = True\n):\n    \"\"\"\n    This function creates Func columns based on numeric values to be Funced.\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `value_cols` (*list*): name(s) of the columns used\n\n    *optional :*\n    - `group_cols` (*list*): name(s) of the column(s) used to\n      create each group inside which independent Funcing needs to be applied\n    - `Func_cols_names` (*list*): the names of the added Funcing columns.\n      If not filled, the Funcing will be named after the value_cols with a '_Func' suffix\n    - `method` (*str*): method to use when encountering equal values:\n        - `'min'` (default): lowest Func in group\n        - `'max'`: highest Func in group\n        - `'average'`: average Func of group\n        - `'first'`: Funcs assigned in order the values appear in the series\n        - `'dense'`: like 'min', but Func always increases by 1 between groups\n    - `ascending` (*boolean*): whether the Func should be determined based on\n       ascending (default) or descending order\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    | ENTITY | YEAR | VALUE_1 | VALUE_2 |\n    | :---: | :---: | :---: | :---: |\n    | A | 2017 | 10 | 3 |\n    | A | 2017 | 20 | 1 |\n    | A | 2018 | 10 | 5 |\n    | A | 2018 | 30 | 4 |\n    | B | 2017 | 60 | 4 |\n    | B | 2017 | 40 | 3 |\n    | B | 2018 | 50 | 7 |\n    | B | 2018 | 50 | 6 |\n\n    ```cson\n    Func :\n      value_cols: 'VALUE_1'\n    ```\n\n    **Output**\n\n    | ENTITY | YEAR | VALUE_1 | VALUE_2 | VALUE_1_Func\n    | :---: | :---: | :---: | :---: | :---: |\n    | A | 2017 | 10 | 3 | 1 |\n    | A | 2017 | 20 | 1 | 3 |\n    | A | 2018 | 10 | 5 | 1 |\n    | A | 2018 | 30 | 4 | 4 |\n    | B | 2017 | 60 | 4 | 8 |\n    | B | 2017 | 40 | 3 | 5 |\n    | B | 2018 | 50 | 7 | 6 |\n    | B | 2018 | 50 | 6 | 6 |\n    \"\"\"\n\n    arg_1 = [arg_1] if not isinstance(arg_1, list) else arg_1\n    for arg_10 in arg_1:\n        if not np.issubdtype(arg_0[arg_10].dtype, np.number):\n            raise TypeError(arg_10 + \" specified in value_cols must be of numeric type\")\n\n    if arg_6 is None:\n        arg_6 = [x + '_Func' for x in arg_1]\n\n    if arg_5 is None:\n        arg_0[arg_6] = arg_0[arg_1].Func(arg_7=arg_7, arg_8=arg_8)\n    else:\n        arg_0[arg_6] = (arg_0.groupby(arg_5)[arg_1]\n                                 .Func(arg_7=arg_7, arg_8=arg_8))\n\n    if arg_7 != 'average':\n        arg_0[arg_6] = arg_0[arg_6].astype('int')\n\n    return arg_0", "path": "toucan_data_sdk/utils/postprocess/rank.py", "identifier": "rank", "docstring": "This function creates rank columns based on numeric values to be ranked.\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `value_cols` (*list*): name(s) of the columns used\n\n    *optional :*\n    - `group_cols` (*list*): name(s) of the column(s) used to\n      create each group inside which independent ranking needs to be applied\n    - `rank_cols_names` (*list*): the names of the added ranking columns.\n      If not filled, the ranking will be named after the value_cols with a '_rank' suffix\n    - `method` (*str*): method to use when encountering equal values:\n        - `'min'` (default): lowest rank in group\n        - `'max'`: highest rank in group\n        - `'average'`: average rank of group\n        - `'first'`: ranks assigned in order the values appear in the series\n        - `'dense'`: like 'min', but rank always increases by 1 between groups\n    - `ascending` (*boolean*): whether the rank should be determined based on\n       ascending (default) or descending order\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    | ENTITY | YEAR | VALUE_1 | VALUE_2 |\n    | :---: | :---: | :---: | :---: |\n    | A | 2017 | 10 | 3 |\n    | A | 2017 | 20 | 1 |\n    | A | 2018 | 10 | 5 |\n    | A | 2018 | 30 | 4 |\n    | B | 2017 | 60 | 4 |\n    | B | 2017 | 40 | 3 |\n    | B | 2018 | 50 | 7 |\n    | B | 2018 | 50 | 6 |\n\n    ```cson\n    rank :\n      value_cols: 'VALUE_1'\n    ```\n\n    **Output**\n\n    | ENTITY | YEAR | VALUE_1 | VALUE_2 | VALUE_1_rank\n    | :---: | :---: | :---: | :---: | :---: |\n    | A | 2017 | 10 | 3 | 1 |\n    | A | 2017 | 20 | 1 | 3 |\n    | A | 2018 | 10 | 5 | 1 |\n    | A | 2018 | 30 | 4 | 4 |\n    | B | 2017 | 60 | 4 | 8 |\n    | B | 2017 | 40 | 3 | 5 |\n    | B | 2018 | 50 | 7 | 6 |\n    | B | 2018 | 50 | 6 | 6 |", "docstring_tokens": ["This", "function", "creates", "rank", "columns", "based", "on", "numeric", "values", "to", "be", "ranked", "."], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 255436}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth2.py#L820-L829", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Persist the authorization code.", "language": "python", "parameters": "(self, client_id, code, request,\n                                *args, **kwargs)", "return_statement": "return request.client.default_redirect_uri", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "*", "arg_4", ",", "**", "arg_5", ")", ":", "log", ".", "debug", "(", "'Persist authorization code %r for client %r'", ",", "arg_2", ",", "arg_1", ")", "arg_3", ".", "client", "=", "arg_3", ".", "client", "or", "arg_0", ".", "_clientgetter", "(", "arg_1", ")", "arg_0", ".", "_grantsetter", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "*", "arg_4", ",", "**", "arg_5", ")", "return", "arg_3", ".", "client", ".", "default_redirect_uri"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                *arg_4, **arg_5):\n        \"\"\"Persist the authorization code.\"\"\"\n        log.debug(\n            'Persist authorization code %r for client %r',\n            arg_2, arg_1\n        )\n        arg_3.client = arg_3.client or arg_0._clientgetter(arg_1)\n        arg_0._grantsetter(arg_1, arg_2, arg_3, *arg_4, **arg_5)\n        return arg_3.client.default_redirect_uri", "path": "flask_oauthlib/provider/oauth2.py", "identifier": "OAuth2RequestValidator.save_authorization_code", "docstring": "Persist the authorization code.", "docstring_tokens": ["Persist", "the", "authorization", "code", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 255437}
{"url": "https://github.com/rodluger/pysyzygy/blob/d2b64251047cc0f0d0adeb6feab4054e7fce4b7a/pysyzygy/transit.py#L528-L535", "sha": "d2b64251047cc0f0d0adeb6feab4054e7fce4b7a", "docstring_summary": "Computes the light curve model", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_Func", "(", "arg_0", ".", "transit", ",", "arg_0", ".", "limbdark", ",", "arg_0", ".", "settings", ",", "arg_0", ".", "arrays", ")", "if", "arg_1", "!=", "_ERR_NONE", ":", "RaiseError", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    '''\n    Funcs the light curve model\n    \n    '''\n    \n    arg_1 = _Func(arg_0.transit, arg_0.limbdark, arg_0.settings, arg_0.arrays)\n    if arg_1 != _ERR_NONE: RaiseError(arg_1)", "path": "pysyzygy/transit.py", "identifier": "Transit.Compute", "docstring": "Computes the light curve model", "docstring_tokens": ["Computes", "the", "light", "curve", "model"], "nwo": "rodluger/pysyzygy", "score": 0.17821439704321745, "idx": 255438}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L508-L542", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Retun colored string.", "language": "python", "parameters": "(self, data)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "template", "in", "[", "\"Generic\"", ",", "\"Less\"", "]", ":", "if", "(", "arg_0", ".", "data_to_print", "[", "1", "]", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"up\"", "]", "or", "arg_0", ".", "data_to_print", "[", "1", "]", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"valid\"", "]", ")", ":", "arg_1", "=", "PyFunceble", ".", "Fore", ".", "BLACK", "+", "PyFunceble", ".", "Back", ".", "GREEN", "+", "arg_1", "elif", "arg_0", ".", "data_to_print", "[", "1", "]", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"down\"", "]", ":", "arg_1", "=", "PyFunceble", ".", "Fore", ".", "BLACK", "+", "PyFunceble", ".", "Back", ".", "RED", "+", "arg_1", "else", ":", "arg_1", "=", "PyFunceble", ".", "Fore", ".", "BLACK", "+", "PyFunceble", ".", "Back", ".", "CYAN", "+", "arg_1", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retun colored string.\n\n        :param data: The string to colorify.\n        :type data: str\n\n        :return: A colored string.\n        :rtype: str\n        \"\"\"\n\n        if arg_0.template in [\"Generic\", \"Less\"]:\n            # The template is in the list of template that need the coloration.\n\n            if (\n                arg_0.data_to_print[1].lower() in PyFunceble.STATUS[\"list\"][\"up\"]\n                or arg_0.data_to_print[1].lower() in PyFunceble.STATUS[\"list\"][\"valid\"]\n            ):\n                # The status is in the list of up status.\n\n                # We print the data with a green background.\n                arg_1 = PyFunceble.Fore.BLACK + PyFunceble.Back.GREEN + arg_1\n            elif arg_0.data_to_print[1].lower() in PyFunceble.STATUS[\"list\"][\"down\"]:\n                # The status is in the list of down status.\n\n                # We print the data with a red background.\n                arg_1 = PyFunceble.Fore.BLACK + PyFunceble.Back.RED + arg_1\n            else:\n                # The status is not in the list of up and down status.\n\n                # We print the data with a cyan background.\n                arg_1 = PyFunceble.Fore.BLACK + PyFunceble.Back.CYAN + arg_1\n\n        # We return the data.\n        return arg_1", "path": "PyFunceble/prints.py", "identifier": "Prints._colorify", "docstring": "Retun colored string.\n\n        :param data: The string to colorify.\n        :type data: str\n\n        :return: A colored string.\n        :rtype: str", "docstring_tokens": ["Retun", "colored", "string", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 255439}
{"url": "https://github.com/edx/edx-search/blob/476cf02b71ceba34ae7d8b798f36d60692317c55/search/views.py#L49-L144", "sha": "476cf02b71ceba34ae7d8b798f36d60692317c55", "docstring_summary": "Search view for http requests", "language": "python", "parameters": "(request, course_id=None)", "return_statement": "return JsonResponse(results, status=status_code)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "SearchInitializer", ".", "set_search_enviroment", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_2", "=", "{", "\"error\"", ":", "_", "(", "\"Nothing to search\"", ")", "}", "arg_3", "=", "500", "arg_4", "=", "arg_0", ".", "POST", ".", "get", "(", "\"search_string\"", ",", "None", ")", "try", ":", "if", "not", "arg_4", ":", "raise", "ValueError", "(", "_", "(", "'No search term provided for search'", ")", ")", "arg_5", ",", "arg_6", ",", "arg_7", "=", "_process_pagination_values", "(", "arg_0", ")", "track", ".", "emit", "(", "'edx.course.search.initiated'", ",", "{", "\"search_term\"", ":", "arg_4", ",", "\"page_size\"", ":", "arg_5", ",", "\"page_number\"", ":", "arg_7", ",", "}", ")", "arg_2", "=", "perform_search", "(", "arg_4", ",", "user", "=", "arg_0", ".", "user", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_1", "=", "arg_1", ")", "arg_3", "=", "200", "track", ".", "emit", "(", "'edx.course.search.results_displayed'", ",", "{", "\"search_term\"", ":", "arg_4", ",", "\"page_size\"", ":", "arg_5", ",", "\"page_number\"", ":", "arg_7", ",", "\"results_count\"", ":", "arg_2", "[", "\"total\"", "]", ",", "}", ")", "except", "ValueError", "as", "invalid_err", ":", "arg_2", "=", "{", "\"error\"", ":", "six", ".", "text_type", "(", "invalid_err", ")", "}", "log", ".", "debug", "(", "six", ".", "text_type", "(", "invalid_err", ")", ")", "except", "QueryParseError", ":", "arg_2", "=", "{", "\"error\"", ":", "_", "(", "'Your query seems malformed. Check for unmatched quotes.'", ")", "}", "except", "Exception", "as", "err", ":", "arg_2", "=", "{", "\"error\"", ":", "_", "(", "'An error occurred when searching for \"{search_string}\"'", ")", ".", "format", "(", "search_string", "=", "arg_4", ")", "}", "log", ".", "exception", "(", "'Search view exception when searching for %s for user %s: %r'", ",", "arg_4", ",", "arg_0", ".", "user", ".", "id", ",", "err", ")", "return", "JsonResponse", "(", "arg_2", ",", "status", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Search view for http requests\n\n    Args:\n        request (required) - django request object\n        course_id (optional) - course_id within which to restrict search\n\n    Returns:\n        http json response with the following fields\n            \"took\" - how many seconds the operation took\n            \"total\" - how many results were found\n            \"max_score\" - maximum score from these results\n            \"results\" - json array of result documents\n\n            or\n\n            \"error\" - displayable information about an error that occured on the server\n\n    POST Params:\n        \"search_string\" (required) - text upon which to search\n        \"page_size\" (optional)- how many results to return per page (defaults to 20, with maximum cutoff at 100)\n        \"page_index\" (optional) - for which page (zero-indexed) to include results (defaults to 0)\n    \"\"\"\n\n    # Setup search environment\n    SearchInitializer.set_search_enviroment(arg_0=arg_0, arg_1=arg_1)\n\n    arg_2 = {\n        \"error\": _(\"Nothing to search\")\n    }\n    arg_3 = 500\n\n    arg_4 = arg_0.POST.get(\"search_string\", None)\n\n    try:\n        if not arg_4:\n            raise ValueError(_('No search term provided for search'))\n\n        arg_5, arg_6, arg_7 = _process_pagination_values(arg_0)\n\n        # Analytics - log search request\n        track.emit(\n            'edx.course.search.initiated',\n            {\n                \"search_term\": arg_4,\n                \"page_size\": arg_5,\n                \"page_number\": arg_7,\n            }\n        )\n\n        arg_2 = perform_search(\n            arg_4,\n            user=arg_0.user,\n            arg_5=arg_5,\n            arg_6=arg_6,\n            arg_1=arg_1\n        )\n\n        arg_3 = 200\n\n        # Analytics - log search results before sending to browser\n        track.emit(\n            'edx.course.search.results_displayed',\n            {\n                \"search_term\": arg_4,\n                \"page_size\": arg_5,\n                \"page_number\": arg_7,\n                \"results_count\": arg_2[\"total\"],\n            }\n        )\n\n    except ValueError as invalid_err:\n        arg_2 = {\n            \"error\": six.text_type(invalid_err)\n        }\n        log.debug(six.text_type(invalid_err))\n\n    except QueryParseError:\n        arg_2 = {\n            \"error\": _('Your query seems malformed. Check for unmatched quotes.')\n        }\n\n    # Allow for broad exceptions here - this is an entry point from external reference\n    except Exception as err:  # pylint: disable=broad-except\n        arg_2 = {\n            \"error\": _('An error occurred when searching for \"{search_string}\"').format(search_string=arg_4)\n        }\n        log.exception(\n            'Search view exception when searching for %s for user %s: %r',\n            arg_4,\n            arg_0.user.id,\n            err\n        )\n\n    return JsonResponse(arg_2, status=arg_3)", "path": "search/views.py", "identifier": "do_search", "docstring": "Search view for http requests\n\n    Args:\n        request (required) - django request object\n        course_id (optional) - course_id within which to restrict search\n\n    Returns:\n        http json response with the following fields\n            \"took\" - how many seconds the operation took\n            \"total\" - how many results were found\n            \"max_score\" - maximum score from these results\n            \"results\" - json array of result documents\n\n            or\n\n            \"error\" - displayable information about an error that occured on the server\n\n    POST Params:\n        \"search_string\" (required) - text upon which to search\n        \"page_size\" (optional)- how many results to return per page (defaults to 20, with maximum cutoff at 100)\n        \"page_index\" (optional) - for which page (zero-indexed) to include results (defaults to 0)", "docstring_tokens": ["Search", "view", "for", "http", "requests"], "nwo": "edx/edx-search", "score": 0.5271177144519781, "idx": 255440}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L196-L207", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return an existing or new ConversationWidget.", "language": "python", "parameters": "(self, conv_id)", "return_statement": "return self._conv_widgets[conv_id]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_conv_widgets", ":", "arg_2", "=", "(", "lambda", "arg_3", ",", "title", ":", "arg_0", ".", "_tabbed_window", ".", "set_tab", "(", "arg_3", ",", "title", "=", "title", ")", ")", "arg_3", "=", "ConversationWidget", "(", "arg_0", ".", "_client", ",", "arg_0", ".", "_coroutine_queue", ",", "arg_0", ".", "_conv_list", ".", "get", "(", "arg_1", ")", ",", "arg_2", ",", "arg_0", ".", "_keys", ",", "arg_0", ".", "_datetimefmt", ")", "arg_0", ".", "_conv_widgets", "[", "arg_1", "]", "=", "arg_3", "return", "arg_0", ".", "_conv_widgets", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return an existing or new ConversationWidget.\"\"\"\n        if arg_1 not in arg_0._conv_widgets:\n            arg_2 = (lambda arg_3, title:\n                            arg_0._tabbed_window.set_tab(arg_3, title=title))\n            arg_3 = ConversationWidget(\n                arg_0._client, arg_0._coroutine_queue,\n                arg_0._conv_list.get(arg_1), arg_2, arg_0._keys,\n                arg_0._datetimefmt\n            )\n            arg_0._conv_widgets[arg_1] = arg_3\n        return arg_0._conv_widgets[arg_1]", "path": "hangups/ui/__main__.py", "identifier": "ChatUI.get_conv_widget", "docstring": "Return an existing or new ConversationWidget.", "docstring_tokens": ["Return", "an", "existing", "or", "new", "ConversationWidget", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255441}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L702-L712", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Callback from graph.events when a node is clicked.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "has_node", "(", "arg_1", ".", "id", ")", ":", "return", "if", "arg_1", "==", "arg_0", ".", "root", ":", "return", "arg_0", ".", "_dx", ",", "arg_0", ".", "_dy", "=", "arg_0", ".", "offset", "(", "arg_1", ")", "arg_0", ".", "previous", "=", "arg_0", ".", "root", ".", "id", "arg_0", ".", "load", "(", "arg_1", ".", "id", ")"], "function": "def Func(arg_0, arg_1):\n        \n        \"\"\" Callback from graph.events when a node is Funced.\n        \"\"\"\n        \n        if not arg_0.has_node(arg_1.id): return\n        if arg_1 == arg_0.root: return\n        \n        arg_0._dx, arg_0._dy = arg_0.offset(arg_1)\n        arg_0.previous = arg_0.root.id\n        arg_0.load(arg_1.id)", "path": "lib/graph/__init__.py", "identifier": "xgraph.click", "docstring": "Callback from graph.events when a node is clicked.", "docstring_tokens": ["Callback", "from", "graph", ".", "events", "when", "a", "node", "is", "clicked", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255442}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v2/convert.py#L27-L49", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Convert a notebook to the v2 format.", "language": "python", "parameters": "(nb, orig_version=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "if", "arg_1", "==", "1", ":", "arg_2", "=", "new_notebook", "(", ")", "arg_3", "=", "new_worksheet", "(", ")", "for", "arg_4", "in", "arg_0", ".", "cells", ":", "if", "arg_4", ".", "cell_type", "==", "u'code'", ":", "arg_5", "=", "new_code_cell", "(", "input", "=", "arg_4", ".", "get", "(", "'code'", ")", ",", "prompt_number", "=", "arg_4", ".", "get", "(", "'prompt_number'", ")", ")", "elif", "arg_4", ".", "cell_type", "==", "u'text'", ":", "arg_5", "=", "new_text_cell", "(", "u'markdown'", ",", "source", "=", "arg_4", ".", "get", "(", "'text'", ")", ")", "arg_3", ".", "cells", ".", "append", "(", "arg_5", ")", "arg_2", ".", "worksheets", ".", "append", "(", "arg_3", ")", "return", "arg_2", "else", ":", "raise", "ValueError", "(", "'Cannot convert a notebook from v%s to v2'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1=1):\n    \"\"\"Convert a notebook to the v2 format.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The Python representation of the notebook to convert.\n    orig_version : int\n        The original version of the notebook to convert.\n    \"\"\"\n    if arg_1 == 1:\n        arg_2 = new_notebook()\n        arg_3 = new_worksheet()\n        for arg_4 in arg_0.cells:\n            if arg_4.cell_type == u'code':\n                arg_5 = new_code_cell(input=arg_4.get('code'),prompt_number=arg_4.get('prompt_number'))\n            elif arg_4.cell_type == u'text':\n                arg_5 = new_text_cell(u'markdown',source=arg_4.get('text'))\n            arg_3.cells.append(arg_5)\n        arg_2.worksheets.append(arg_3)\n        return arg_2\n    else:\n        raise ValueError('Cannot convert a notebook from v%s to v2' % arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/nbformat/v2/convert.py", "identifier": "convert_to_this_nbformat", "docstring": "Convert a notebook to the v2 format.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The Python representation of the notebook to convert.\n    orig_version : int\n        The original version of the notebook to convert.", "docstring_tokens": ["Convert", "a", "notebook", "to", "the", "v2", "format", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255443}
{"url": "https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L293-L326", "sha": "800976faab3b827a42fa1cb80f13fcc03961d2c9", "docstring_summary": "Fetch an access token.", "language": "python", "parameters": "(self, url, verifier=None, **request_kwargs)", "return_statement": "return token", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", ":", "arg_0", ".", "_client", ".", "client", ".", "verifier", "=", "arg_2", "if", "not", "getattr", "(", "arg_0", ".", "_client", ".", "client", ",", "\"verifier\"", ",", "None", ")", ":", "raise", "VerifierMissing", "(", "\"No client verifier has been set.\"", ")", "arg_6", "=", "arg_0", ".", "_fetch_token", "(", "arg_1", ",", "**", "arg_3", ")", "log", ".", "debug", "(", "\"Resetting verifier attribute, should not be used anymore.\"", ")", "arg_0", ".", "_client", ".", "client", ".", "verifier", "=", "None", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Fetch an access token.\n\n        This is the final step in the OAuth 1 workflow. An access token is\n        obtained using all previously obtained credentials, including the\n        verifier from the authorization step.\n\n        Note that a previously set verifier will be reset for your\n        convenience, or else signature creation will be incorrect on\n        consecutive requests.\n\n        >>> access_token_url = 'https://api.twitter.com/oauth/access_token'\n        >>> redirect_response = 'https://127.0.0.1/callback?oauth_token=kjerht2309uf&oauth_token_secret=lsdajfh923874&oauth_verifier=w34o8967345'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret')\n        >>> oauth_session.parse_authorization_response(redirect_response)\n        {\n            'oauth_token: 'kjerht2309u',\n            'oauth_token_secret: 'lsdajfh923874',\n            'oauth_verifier: 'w34o8967345',\n        }\n        >>> oauth_session.Func(access_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }\n        \"\"\"\n        if arg_2:\n            arg_0._client.client.verifier = arg_2\n        if not getattr(arg_0._client.client, \"verifier\", None):\n            raise VerifierMissing(\"No client verifier has been set.\")\n        arg_6 = arg_0._fetch_token(arg_1, **arg_3)\n        log.debug(\"Resetting verifier attribute, should not be used anymore.\")\n        arg_0._client.client.verifier = None\n        return arg_6", "path": "requests_oauthlib/oauth1_session.py", "identifier": "OAuth1Session.fetch_access_token", "docstring": "Fetch an access token.\n\n        This is the final step in the OAuth 1 workflow. An access token is\n        obtained using all previously obtained credentials, including the\n        verifier from the authorization step.\n\n        Note that a previously set verifier will be reset for your\n        convenience, or else signature creation will be incorrect on\n        consecutive requests.\n\n        >>> access_token_url = 'https://api.twitter.com/oauth/access_token'\n        >>> redirect_response = 'https://127.0.0.1/callback?oauth_token=kjerht2309uf&oauth_token_secret=lsdajfh923874&oauth_verifier=w34o8967345'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret')\n        >>> oauth_session.parse_authorization_response(redirect_response)\n        {\n            'oauth_token: 'kjerht2309u',\n            'oauth_token_secret: 'lsdajfh923874',\n            'oauth_verifier: 'w34o8967345',\n        }\n        >>> oauth_session.fetch_access_token(access_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }", "docstring_tokens": ["Fetch", "an", "access", "token", "."], "nwo": "requests/requests-oauthlib", "score": 0.9446339936112974, "idx": 255444}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2alleles.py#L12-L48", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "reads in .loci and builds alleles from case characters", "language": "python", "parameters": "(data, samples)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "outfiles", ",", "arg_0", ".", "name", "+", "\".alleles\"", ")", ",", "'w'", ")", "arg_3", "=", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "outfiles", ",", "arg_0", ".", "name", "+", "\".loci\"", ")", ",", "'r'", ")", "arg_4", "=", "max", "(", "len", "(", "x", ")", "for", "x", "in", "arg_0", ".", "samples", ".", "keys", "(", ")", ")", "arg_5", "=", "5", "arg_6", "=", "[", "]", "arg_7", "=", "0", "for", "arg_8", "in", "arg_3", ":", "if", "\">\"", "in", "arg_8", ":", "arg_9", ",", "arg_10", "=", "arg_8", ".", "split", "(", "\" \"", ")", "[", "0", "]", ",", "arg_8", ".", "split", "(", "\" \"", ")", "[", "-", "1", "]", "arg_11", ",", "arg_12", "=", "splitalleles", "(", "arg_10", ".", "strip", "(", ")", ")", "arg_6", ".", "append", "(", "arg_9", "+", "\"_0\"", "+", "\" \"", "*", "(", "arg_4", "-", "len", "(", "arg_9", ")", "-", "2", "+", "arg_5", ")", "+", "arg_11", ")", "arg_6", ".", "append", "(", "arg_9", "+", "\"_1\"", "+", "\" \"", "*", "(", "arg_4", "-", "len", "(", "arg_9", ")", "-", "2", "+", "arg_5", ")", "+", "arg_12", ")", "else", ":", "arg_6", ".", "append", "(", "arg_8", ".", "strip", "(", ")", ")", "arg_7", "+=", "1", "if", "not", "arg_7", "%", "10000", ":", "arg_2", ".", "write", "(", "\"\\n\"", ".", "join", "(", "arg_6", ")", "+", "\"\\n\"", ")", "arg_6", "=", "[", "]", "arg_2", ".", "write", "(", "\"\\n\"", ".", "join", "(", "arg_6", ")", ")", "arg_2", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" reads in .loci and builds alleles from case characters \"\"\"\n    \n    #read in loci file\n    arg_2 = open(os.path.join(arg_0.dirs.outfiles, arg_0.name+\".alleles\"), 'w')\n    arg_3 = open(os.path.join(arg_0.dirs.outfiles, arg_0.name+\".loci\"), 'r')\n\n    ## Get the longest sample name for pretty printing\n    arg_4 = max(len(x) for x in arg_0.samples.keys())\n\n    ## Padding between name and sequence in output file. This should be the \n    ## same as write_outfiles.write_tmp_loci.name_padding\n    arg_5 = 5\n    arg_6 = []\n    arg_7 = 0\n    for arg_8 in arg_3:\n        if \">\" in arg_8:\n            arg_9, arg_10 = arg_8.split(\" \")[0], arg_8.split(\" \")[-1]\n            arg_11, arg_12 = splitalleles(arg_10.strip())\n\n            ## Format the output string. the \"-2\" below accounts for the additional\n            ## 2 characters added to the sample name that don't get added to the\n            ## snpsites line, so you gotta bump this line back 2 to Func it\n            ## line up right.\n            arg_6.append(arg_9+\"_0\"+\" \"*(arg_4-len(arg_9)-2+arg_5)+arg_11)\n            arg_6.append(arg_9+\"_1\"+\" \"*(arg_4-len(arg_9)-2+arg_5)+arg_12)\n        else:\n            arg_6.append(arg_8.strip())\n        arg_7 += 1\n\n        ## print every 10K loci \"\n        if not arg_7 % 10000:\n            arg_2.write(\"\\n\".join(arg_6)+\"\\n\")\n            arg_6 = []\n\n    arg_2.write(\"\\n\".join(arg_6))\n    arg_2.close()", "path": "ipyrad/file_conversion/loci2alleles.py", "identifier": "make", "docstring": "reads in .loci and builds alleles from case characters", "docstring_tokens": ["reads", "in", ".", "loci", "and", "builds", "alleles", "from", "case", "characters"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 255445}
{"url": "https://github.com/justanr/flask-allows/blob/39fa5c8692836a33646ea43b4081e7c2181ec7c4/src/flask_allows/allows.py#L124-L153", "sha": "39fa5c8692836a33646ea43b4081e7c2181ec7c4", "docstring_summary": "Checks that the provided or current identity meets each requirement\n        passed to this method.", "language": "python", "parameters": "(self, requirements, identity=None)", "return_statement": "return all(_call_requirement(r, identity, request) for r in all_requirements)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "arg_0", ".", "_identity_loader", "(", ")", "if", "arg_0", ".", "additional", ".", "current", ":", "arg_3", "=", "chain", "(", "iter", "(", "arg_0", ".", "additional", ".", "current", ")", ",", "arg_1", ")", "else", ":", "arg_3", "=", "iter", "(", "arg_1", ")", "if", "arg_0", ".", "overrides", ".", "current", "is", "not", "None", ":", "arg_3", "=", "(", "arg_4", "for", "arg_4", "in", "arg_3", "if", "arg_4", "not", "in", "arg_0", ".", "overrides", ".", "current", ")", "return", "all", "(", "_call_requirement", "(", "arg_4", ",", "arg_2", ",", "request", ")", "for", "arg_4", "in", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Checks that the provided or current identity meets each requirement\n        passed to this method.\n\n        This method takes into account both additional and overridden\n        requirements, with overridden requirements taking precedence::\n\n            allows.additional.push(Additional(Has('foo')))\n            allows.overrides.push(Override(Has('foo')))\n\n            allows.Func([], user_without_foo)  # return True\n\n        :param requirements: The requirements to check the identity against.\n        :param identity: Optional. Identity to use in place of the current\n            identity.\n        \"\"\"\n        arg_2 = arg_2 or arg_0._identity_loader()\n\n        if arg_0.additional.current:\n            arg_3 = chain(iter(arg_0.additional.current), arg_1)\n        else:\n            arg_3 = iter(arg_1)\n\n        if arg_0.overrides.current is not None:\n            arg_3 = (\n                arg_4 for arg_4 in arg_3 if arg_4 not in arg_0.overrides.current\n            )\n\n        return all(_call_requirement(arg_4, arg_2, request) for arg_4 in arg_3)", "path": "src/flask_allows/allows.py", "identifier": "Allows.fulfill", "docstring": "Checks that the provided or current identity meets each requirement\n        passed to this method.\n\n        This method takes into account both additional and overridden\n        requirements, with overridden requirements taking precedence::\n\n            allows.additional.push(Additional(Has('foo')))\n            allows.overrides.push(Override(Has('foo')))\n\n            allows.fulfill([], user_without_foo)  # return True\n\n        :param requirements: The requirements to check the identity against.\n        :param identity: Optional. Identity to use in place of the current\n            identity.", "docstring_tokens": ["Checks", "that", "the", "provided", "or", "current", "identity", "meets", "each", "requirement", "passed", "to", "this", "method", "."], "nwo": "justanr/flask-allows", "score": 0.19676903429081236, "idx": 255446}
{"url": "https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/__init__.py#L464-L509", "sha": "af58bf30f688757e58af6e87892d35a8ce798482", "docstring_summary": "Send a response to the previously received challenge, with the given\n        `payload`. The payload is encoded using base64 and transmitted to the\n        server.", "language": "python", "parameters": "(self, payload)", "return_statement": "return next_state, payload", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_state", "==", "SASLState", ".", "SUCCESS_SIMULATE_CHALLENGE", ":", "if", "arg_1", "!=", "b\"\"", ":", "arg_0", ".", "_state", "=", "SASLState", ".", "FAILURE", "raise", "SASLFailure", "(", "None", ",", "\"protocol violation: mechanism did not\"", "\" respond with an empty Func to a\"", "\" challenge with final data \u2013 this suggests\"", "\" a protocol-violating early success from the server.\"", ")", "arg_0", ".", "_state", "=", "SASLState", ".", "SUCCESS", "return", "SASLState", ".", "SUCCESS", ",", "None", "if", "arg_0", ".", "_state", "!=", "SASLState", ".", "CHALLENGE", ":", "raise", "RuntimeError", "(", "\"no challenge has been made or negotiation failed\"", ")", "try", ":", "arg_3", ",", "arg_1", "=", "yield", "from", "arg_0", ".", "interface", ".", "respond", "(", "arg_1", ")", "except", "SASLFailure", ":", "arg_0", ".", "_state", "=", "SASLState", ".", "FAILURE", "raise", "arg_3", "=", "SASLState", ".", "from_reply", "(", "arg_3", ")", "if", "arg_3", "==", "SASLState", ".", "SUCCESS", "and", "arg_1", "is", "not", "None", ":", "arg_0", ".", "_state", "=", "SASLState", ".", "SUCCESS_SIMULATE_CHALLENGE", "return", "SASLState", ".", "CHALLENGE", ",", "arg_1", "arg_0", ".", "_state", "=", "arg_3", "return", "arg_3", ",", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Send a Func to the previously received challenge, with the given\n        `payload`. The payload is encoded using base64 and transmitted to the\n        server.\n\n        Return the next state of the state machine as tuple (see\n        :class:`SASLStateMachine` for details).\n        \"\"\"\n        if arg_0._state == SASLState.SUCCESS_SIMULATE_CHALLENGE:\n            if arg_1 != b\"\":\n                # XXX: either our mechanism is buggy or the server\n                # sent SASLState.SUCCESS before all challenge-Func\n                # messages defined by the mechanism were sent\n                arg_0._state = SASLState.FAILURE\n                raise SASLFailure(\n                    None,\n                    \"protocol violation: mechanism did not\"\n                    \" respond with an empty Func to a\"\n                    \" challenge with final data \u2013 this suggests\"\n                    \" a protocol-violating early success from the server.\"\n                )\n            arg_0._state = SASLState.SUCCESS\n            return SASLState.SUCCESS, None\n\n        if arg_0._state != SASLState.CHALLENGE:\n            raise RuntimeError(\n                \"no challenge has been made or negotiation failed\")\n\n        try:\n            arg_3, arg_1 = yield from arg_0.interface.respond(arg_1)\n        except SASLFailure:\n            arg_0._state = SASLState.FAILURE\n            raise\n\n        arg_3 = SASLState.from_reply(arg_3)\n\n        # unfold the (SASLState.SUCCESS, payload) to a sequence of\n        # (SASLState.CHALLENGE, payload), (SASLState.SUCCESS, None) for the SASLMethod\n        # to allow uniform treatment of both cases\n        if arg_3 == SASLState.SUCCESS and arg_1 is not None:\n            arg_0._state = SASLState.SUCCESS_SIMULATE_CHALLENGE\n            return SASLState.CHALLENGE, arg_1\n\n        arg_0._state = arg_3\n        return arg_3, arg_1", "path": "aiosasl/__init__.py", "identifier": "SASLStateMachine.response", "docstring": "Send a response to the previously received challenge, with the given\n        `payload`. The payload is encoded using base64 and transmitted to the\n        server.\n\n        Return the next state of the state machine as tuple (see\n        :class:`SASLStateMachine` for details).", "docstring_tokens": ["Send", "a", "response", "to", "the", "previously", "received", "challenge", "with", "the", "given", "payload", ".", "The", "payload", "is", "encoded", "using", "base64", "and", "transmitted", "to", "the", "server", "."], "nwo": "horazont/aiosasl", "score": 0.26949921653275793, "idx": 255447}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/db.py#L215-L263", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Merge array field from the remote_issue into local_task", "language": "python", "parameters": "(field, local_task, remote_issue, hamming=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_1", ".", "get", "(", "arg_0", ",", "[", "]", ")", "arg_5", "=", "arg_2", ".", "get", "(", "arg_0", ",", "[", "]", ")", "if", "arg_0", "not", "in", "arg_1", ":", "arg_1", "[", "arg_0", "]", "=", "[", "]", "arg_6", "=", "0", "for", "arg_7", "in", "arg_5", ":", "for", "arg_8", "in", "arg_4", ":", "if", "(", "(", "arg_3", "and", "get_annotation_hamming_distance", "(", "arg_7", ",", "arg_8", ")", "==", "0", ")", "or", "(", "arg_7", "==", "arg_8", ")", ")", ":", "break", "else", ":", "log", ".", "debug", "(", "\"%s not found in %r\"", "%", "(", "arg_7", ",", "arg_4", ")", ")", "arg_1", "[", "arg_0", "]", ".", "append", "(", "arg_7", ")", "arg_6", "+=", "1", "if", "arg_6", ">", "0", ":", "log", ".", "debug", "(", "'Added %s new values to %s (total: %s)'", "%", "(", "arg_6", ",", "arg_0", ",", "len", "(", "arg_1", "[", "arg_0", "]", ")", ",", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\" Merge array field from the remote_issue into local_task\n\n    * Local 'left' entries are preserved without modification\n    * Remote 'left' are appended to task if not present in local.\n\n    :param `field`: Task field to merge.\n    :param `local_task`: `taskw.task.Task` object into which to merge\n        remote changes.\n    :param `remote_issue`: `dict` instance from which to merge into\n        local task.\n    :param `hamming`: (default `False`) If `True`, compare entries by\n        truncating to maximum length, and comparing hamming distances.\n        Useful generally only for annotations.\n\n    \"\"\"\n\n    # Ensure that empty defaults are present\n    arg_4 = arg_1.get(arg_0, [])\n    arg_5 = arg_2.get(arg_0, [])\n\n    # We need to make sure an array exists for this field because\n    # we will be appending to it in a moment.\n    if arg_0 not in arg_1:\n        arg_1[arg_0] = []\n\n    # If a remote does not appear in local, add it to the local task\n    arg_6 = 0\n    for arg_7 in arg_5:\n        for arg_8 in arg_4:\n            if (\n                # For annotations, they don't have to match *exactly*.\n                (\n                    arg_3\n                    and get_annotation_hamming_distance(arg_7, arg_8) == 0\n                )\n                # But for everything else, they should.\n                or (\n                    arg_7 == arg_8\n                )\n            ):\n                break\n        else:\n            log.debug(\"%s not found in %r\" % (arg_7, arg_4))\n            arg_1[arg_0].append(arg_7)\n            arg_6 += 1\n    if arg_6 > 0:\n        log.debug('Added %s new values to %s (total: %s)' % (\n            arg_6, arg_0, len(arg_1[arg_0]),))", "path": "bugwarrior/db.py", "identifier": "merge_left", "docstring": "Merge array field from the remote_issue into local_task\n\n    * Local 'left' entries are preserved without modification\n    * Remote 'left' are appended to task if not present in local.\n\n    :param `field`: Task field to merge.\n    :param `local_task`: `taskw.task.Task` object into which to merge\n        remote changes.\n    :param `remote_issue`: `dict` instance from which to merge into\n        local task.\n    :param `hamming`: (default `False`) If `True`, compare entries by\n        truncating to maximum length, and comparing hamming distances.\n        Useful generally only for annotations.", "docstring_tokens": ["Merge", "array", "field", "from", "the", "remote_issue", "into", "local_task"], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 255448}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/cli.py#L100-L144", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Inspect records in a migration dump.", "language": "python", "parameters": "(sources, recid, entity=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ",", "1", ")", ":", "click", ".", "echo", "(", "'Loading dump {0} of {1} ({2})'", ".", "format", "(", "arg_3", ",", "len", "(", "arg_0", ")", ",", "arg_4", ".", "name", ")", ")", "arg_5", "=", "json", ".", "load", "(", "arg_4", ")", "if", "not", "arg_1", ":", "click", ".", "secho", "(", "'Record identifiers'", ",", "fg", "=", "'green'", ")", "arg_6", "=", "0", "for", "arg_7", "in", "(", "d", "[", "'recid'", "]", "for", "d", "in", "arg_5", ")", ":", "click", ".", "echo", "(", "arg_7", ")", "arg_6", "+=", "1", "click", ".", "echo", "(", "'{0} records found in dump.'", ".", "format", "(", "arg_6", ")", ")", "return", "arg_5", "=", "list", "(", "filter", "(", "lambda", "d", ":", "d", "[", "'recid'", "]", "==", "arg_1", ",", "arg_5", ")", ")", "if", "not", "arg_5", ":", "click", ".", "secho", "(", "\"Record not found.\"", ",", "fg", "=", "'yellow'", ")", "return", "for", "arg_8", "in", "arg_5", ":", "if", "arg_2", "is", "None", ":", "click", ".", "echo", "(", "json", ".", "dumps", "(", "arg_8", ",", "indent", "=", "2", ")", ")", "if", "arg_2", "==", "'files'", ":", "click", ".", "secho", "(", "'Files'", ",", "fg", "=", "'green'", ")", "click", ".", "echo", "(", "json", ".", "dumps", "(", "arg_8", "[", "'files'", "]", ",", "indent", "=", "2", ")", ")", "if", "arg_2", "==", "'json'", ":", "click", ".", "secho", "(", "'Records (JSON)'", ",", "fg", "=", "'green'", ")", "for", "arg_9", "in", "arg_8", "[", "'record'", "]", ":", "click", ".", "secho", "(", "'Revision {0}'", ".", "format", "(", "arg_9", "[", "'modification_datetime'", "]", ")", ",", "fg", "=", "'yellow'", ")", "click", ".", "echo", "(", "json", ".", "dumps", "(", "arg_9", "[", "'json'", "]", ",", "indent", "=", "2", ")", ")", "if", "arg_2", "==", "'marcxml'", ":", "click", ".", "secho", "(", "'Records (MARCXML)'", ",", "fg", "=", "'green'", ")", "for", "arg_9", "in", "arg_8", "[", "'record'", "]", ":", "click", ".", "secho", "(", "'Revision {0}'", ".", "format", "(", "arg_9", "[", "'marcxml'", "]", ")", ",", "fg", "=", "'yellow'", ")", "click", ".", "echo", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Inspect records in a migration dump.\"\"\"\n    for arg_3, arg_4 in enumerate(arg_0, 1):\n        click.echo('Loading dump {0} of {1} ({2})'.format(arg_3, len(arg_0),\n                                                          arg_4.name))\n        arg_5 = json.load(arg_4)\n\n        # Just print record identifiers if none are selected.\n        if not arg_1:\n            click.secho('Record identifiers', fg='green')\n            arg_6 = 0\n            for arg_7 in (d['recid'] for d in arg_5):\n                click.echo(arg_7)\n                arg_6 += 1\n            click.echo('{0} records found in dump.'.format(arg_6))\n            return\n\n        arg_5 = list(filter(lambda d: d['recid'] == arg_1, arg_5))\n\n        if not arg_5:\n            click.secho(\"Record not found.\", fg='yellow')\n            return\n\n        for arg_8 in arg_5:\n            if arg_2 is None:\n                click.echo(json.dumps(arg_8, indent=2))\n            if arg_2 == 'files':\n                click.secho('Files', fg='green')\n                click.echo(\n                    json.dumps(arg_8['files'], indent=2))\n\n            if arg_2 == 'json':\n                click.secho('Records (JSON)', fg='green')\n                for arg_9 in arg_8['record']:\n                    click.secho('Revision {0}'.format(\n                        arg_9['modification_datetime']), fg='yellow')\n                    click.echo(json.dumps(arg_9['json'], indent=2))\n\n            if arg_2 == 'marcxml':\n                click.secho('Records (MARCXML)', fg='green')\n                for arg_9 in arg_8['record']:\n                    click.secho(\n                        'Revision {0}'.format(arg_9['marcxml']),\n                        fg='yellow')\n                    click.echo(arg_9)", "path": "invenio_migrator/cli.py", "identifier": "inspectrecords", "docstring": "Inspect records in a migration dump.", "docstring_tokens": ["Inspect", "records", "in", "a", "migration", "dump", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 255449}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L547-L552", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return suggested contacts.", "language": "python", "parameters": "(self, get_suggested_entities_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "GetSuggestedEntitiesResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'contacts/getsuggestedentities'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Return suggested contacts.\"\"\"\n        arg_2 = hangouts_pb2.GetSuggestedEntitiesResponse()\n        await arg_0._pb_request('contacts/getsuggestedentities',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.get_suggested_entities", "docstring": "Return suggested contacts.", "docstring_tokens": ["Return", "suggested", "contacts", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255450}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py#L187-L211", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Register command-line options.", "language": "python", "parameters": "(self, parser, env)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "add_option", "(", "\"--processes\"", ",", "action", "=", "\"store\"", ",", "default", "=", "arg_2", ".", "get", "(", "'NOSE_PROCESSES'", ",", "0", ")", ",", "dest", "=", "\"multiprocess_workers\"", ",", "metavar", "=", "\"NUM\"", ",", "help", "=", "\"Spread test run among this many processes. \"", "\"Set a number equal to the number of processors \"", "\"or cores in your machine for best results. \"", "\"[NOSE_PROCESSES]\"", ")", "arg_1", ".", "add_option", "(", "\"--process-timeout\"", ",", "action", "=", "\"store\"", ",", "default", "=", "arg_2", ".", "get", "(", "'NOSE_PROCESS_TIMEOUT'", ",", "10", ")", ",", "dest", "=", "\"multiprocess_timeout\"", ",", "metavar", "=", "\"SECONDS\"", ",", "help", "=", "\"Set timeout for return of results from each \"", "\"test runner process. [NOSE_PROCESS_TIMEOUT]\"", ")", "arg_1", ".", "add_option", "(", "\"--process-restartworker\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "arg_2", ".", "get", "(", "'NOSE_PROCESS_RESTARTWORKER'", ",", "False", ")", ",", "dest", "=", "\"multiprocess_restartworker\"", ",", "help", "=", "\"If set, will restart each worker process once\"", "\" their tests are done, this helps control memory \"", "\"leaks from killing the system. \"", "\"[NOSE_PROCESS_RESTARTWORKER]\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Register command-line Func.\n        \"\"\"\n        arg_1.add_option(\"--processes\", action=\"store\",\n                          default=arg_2.get('NOSE_PROCESSES', 0),\n                          dest=\"multiprocess_workers\",\n                          metavar=\"NUM\",\n                          help=\"Spread test run among this many processes. \"\n                          \"Set a number equal to the number of processors \"\n                          \"or cores in your machine for best results. \"\n                          \"[NOSE_PROCESSES]\")\n        arg_1.add_option(\"--process-timeout\", action=\"store\",\n                          default=arg_2.get('NOSE_PROCESS_TIMEOUT', 10),\n                          dest=\"multiprocess_timeout\",\n                          metavar=\"SECONDS\",\n                          help=\"Set timeout for return of results from each \"\n                          \"test runner process. [NOSE_PROCESS_TIMEOUT]\")\n        arg_1.add_option(\"--process-restartworker\", action=\"store_true\",\n                          default=arg_2.get('NOSE_PROCESS_RESTARTWORKER', False),\n                          dest=\"multiprocess_restartworker\",\n                          help=\"If set, will restart each worker process once\"\n                          \" their tests are done, this helps control memory \"\n                          \"leaks from killing the system. \"\n                          \"[NOSE_PROCESS_RESTARTWORKER]\")", "path": "environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py", "identifier": "MultiProcess.options", "docstring": "Register command-line options.", "docstring_tokens": ["Register", "command", "-", "line", "options", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255451}
{"url": "https://github.com/google/pybadges/blob/d42c8080adb21b81123ac9540c53127ed2fa1edc/pybadges/precalculate_text.py#L57-L63", "sha": "d42c8080adb21b81123ac9540c53127ed2fa1edc", "docstring_summary": "Generate the characters support by the font at the given path.", "language": "python", "parameters": "(deja_vu_sans_path: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Iterable", "[", "arg_1", "]", ":", "arg_2", "=", "ttLib", ".", "TTFont", "(", "arg_0", ")", "for", "arg_3", "in", "arg_2", "[", "'cmap'", "]", ".", "tables", ":", "if", "arg_3", ".", "isUnicode", "(", ")", ":", "for", "arg_4", "in", "arg_3", ".", "cmap", ":", "yield", "chr", "(", "arg_4", ")"], "function": "def Func(arg_0: arg_1) -> Iterable[arg_1]:\n    \"\"\"Generate the characters support by the font at the given path.\"\"\"\n    arg_2 = ttLib.TTFont(arg_0)\n    for arg_3 in arg_2['cmap'].tables:\n        if arg_3.isUnicode():\n            for arg_4 in arg_3.cmap:\n                yield chr(arg_4)", "path": "pybadges/precalculate_text.py", "identifier": "generate_supported_characters", "docstring": "Generate the characters support by the font at the given path.", "docstring_tokens": ["Generate", "the", "characters", "support", "by", "the", "font", "at", "the", "given", "path", "."], "nwo": "google/pybadges", "score": 0.7501002262483641, "idx": 255452}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/drivers/ironic_driver.py#L369-L393", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Update a port.", "language": "python", "parameters": "(self, context, port_id, **kwargs)", "return_statement": "return {\"uuid\": port_id}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "LOG", ".", "info", "(", "\"Func %s %s\"", "%", "(", "arg_1", ".", "tenant_id", ",", "arg_2", ")", ")", "if", "arg_3", ".", "get", "(", "\"security_groups\"", ")", ":", "arg_4", "=", "'ironic driver does not support security group operations.'", "raise", "IronicException", "(", "arg_4", "=", "arg_4", ")", "return", "{", "\"uuid\"", ":", "arg_2", "}"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Update a port.\n\n        :param context: neutron api request context.\n        :param port_id: neutron port id.\n        :param kwargs: optional kwargs.\n        :raises IronicException: If the client is unable to update the\n            downstream port for any reason, the exception will be logged\n            and IronicException raised.\n\n        TODO(morgabra) It does not really make sense in the context of Ironic\n        to allow updating ports. fixed_ips and mac_address are burned in the\n        configdrive on the host, and we otherwise cannot migrate a port between\n        instances. Eventually we will need to support security groups, but for\n        now it's a no-op on port data changes, and we need to rely on the\n        API/Nova to not allow updating data on active ports.\n        \"\"\"\n        LOG.info(\"Func %s %s\" % (arg_1.tenant_id, arg_2))\n\n        # TODO(morgabra): Change this when we enable security groups.\n        if arg_3.get(\"security_groups\"):\n            arg_4 = 'ironic driver does not support security group operations.'\n            raise IronicException(arg_4=arg_4)\n\n        return {\"uuid\": arg_2}", "path": "quark/drivers/ironic_driver.py", "identifier": "IronicDriver.update_port", "docstring": "Update a port.\n\n        :param context: neutron api request context.\n        :param port_id: neutron port id.\n        :param kwargs: optional kwargs.\n        :raises IronicException: If the client is unable to update the\n            downstream port for any reason, the exception will be logged\n            and IronicException raised.\n\n        TODO(morgabra) It does not really make sense in the context of Ironic\n        to allow updating ports. fixed_ips and mac_address are burned in the\n        configdrive on the host, and we otherwise cannot migrate a port between\n        instances. Eventually we will need to support security groups, but for\n        now it's a no-op on port data changes, and we need to rely on the\n        API/Nova to not allow updating data on active ports.", "docstring_tokens": ["Update", "a", "port", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255453}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py#L163-L175", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "check whether our dependencies have been met.", "language": "python", "parameters": "(self, completed, failed=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "True", "arg_3", "=", "set", "(", ")", "if", "arg_0", ".", "success", ":", "arg_3", "=", "arg_1", "if", "arg_2", "is", "not", "None", "and", "arg_0", ".", "failure", ":", "arg_3", "=", "arg_3", ".", "union", "(", "arg_2", ")", "if", "arg_0", ".", "all", ":", "return", "arg_0", ".", "issubset", "(", "arg_3", ")", "else", ":", "return", "not", "arg_0", ".", "isdisjoint", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Func whether our dependencies have been met.\"\"\"\n        if len(arg_0) == 0:\n            return True\n        arg_3 = set()\n        if arg_0.success:\n            arg_3 = arg_1\n        if arg_2 is not None and arg_0.failure:\n            arg_3 = arg_3.union(arg_2)\n        if arg_0.all:\n            return arg_0.issubset(arg_3)\n        else:\n            return not arg_0.isdisjoint(arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py", "identifier": "Dependency.check", "docstring": "check whether our dependencies have been met.", "docstring_tokens": ["check", "whether", "our", "dependencies", "have", "been", "met", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255454}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeregression.py#L274-L289", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "calculate standard explained variance", "language": "python", "parameters": "(self)", "return_statement": "return np.corrcoef(raw.T)[0,1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "tree", ".", "root", ".", "_v", "=", "0", "for", "arg_4", "in", "arg_0", ".", "tree", ".", "get_nonterminals", "(", "order", "=", "'preorder'", ")", ":", "for", "arg_5", "in", "arg_4", ":", "arg_5", ".", "_v", "=", "arg_4", ".", "_v", "+", "arg_0", ".", "branch_value", "(", "arg_5", ")", "arg_6", "=", "np", ".", "array", "(", "[", "(", "arg_0", ".", "tip_value", "(", "arg_4", ")", ",", "arg_4", ".", "_v", ")", "for", "arg_4", "in", "arg_0", ".", "tree", ".", "get_terminals", "(", ")", "if", "arg_0", ".", "tip_value", "(", "arg_4", ")", "is", "not", "None", "]", ")", "return", "np", ".", "corrcoef", "(", "arg_6", ".", "T", ")", "[", "0", ",", "1", "]"], "function": "def Func(arg_0):\n        \"\"\"calculate standard explained variance\n\n        Returns\n        -------\n        float\n            r-value of the root-to-tip distance and time.\n            independent of regression model, but dependent on root choice\n        \"\"\"\n        arg_0.tree.root._v=0\n        for arg_4 in arg_0.tree.get_nonterminals(order='preorder'):\n            for arg_5 in arg_4:\n                arg_5._v = arg_4._v + arg_0.branch_value(arg_5)\n        arg_6 = np.array([(arg_0.tip_value(arg_4), arg_4._v) for arg_4 in arg_0.tree.get_terminals()\n                         if arg_0.tip_value(arg_4) is not None])\n        return np.corrcoef(arg_6.T)[0,1]", "path": "treetime/treeregression.py", "identifier": "TreeRegression.explained_variance", "docstring": "calculate standard explained variance\n\n        Returns\n        -------\n        float\n            r-value of the root-to-tip distance and time.\n            independent of regression model, but dependent on root choice", "docstring_tokens": ["calculate", "standard", "explained", "variance"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 255455}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/config.py#L208-L213", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Set an attribute on self if it exists in the ConfigParser.", "language": "python", "parameters": "(self, cp, attr, where, type_='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "''", ")", ":", "arg_5", ",", "arg_6", "=", "arg_3", ".", "split", "(", "\":\"", ")", "if", "arg_1", ".", "has_option", "(", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "getattr", "(", "arg_1", ",", "'get'", "+", "arg_4", ")", "setattr", "(", "arg_0", ",", "arg_2", ",", "arg_7", "(", "arg_5", ",", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=''):\n        \"\"\"Set an attribute on self if it exists in the ConfigParser.\"\"\"\n        arg_5, arg_6 = arg_3.split(\":\")\n        if arg_1.has_option(arg_5, arg_6):\n            arg_7 = getattr(arg_1, 'get'+arg_4)\n            setattr(arg_0, arg_2, arg_7(arg_5, arg_6))", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/config.py", "identifier": "CoverageConfig.set_attr_from_config_option", "docstring": "Set an attribute on self if it exists in the ConfigParser.", "docstring_tokens": ["Set", "an", "attribute", "on", "self", "if", "it", "exists", "in", "the", "ConfigParser", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 255456}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Domain.py#L16-L22", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Class method that will return a Domain object by ID.", "language": "python", "parameters": "(cls, api_token, domain_name)", "return_statement": "return domain", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "token", "=", "arg_1", ",", "name", "=", "arg_2", ")", "arg_3", ".", "load", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n            Class method that will return a Domain object by ID.\n        \"\"\"\n        arg_3 = arg_0(token=arg_1, name=arg_2)\n        arg_3.load()\n        return arg_3", "path": "digitalocean/Domain.py", "identifier": "Domain.get_object", "docstring": "Class method that will return a Domain object by ID.", "docstring_tokens": ["Class", "method", "that", "will", "return", "a", "Domain", "object", "by", "ID", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 255457}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/aggregator/tank_aggregator.py#L137-L140", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "notify all listeners about aggregate data and stats", "language": "python", "parameters": "(self, data, stats)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "listeners", ":", "arg_3", ".", "on_aggregated_data", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" notify all listeners about aggregate data and stats \"\"\"\n        for arg_3 in arg_0.listeners:\n            arg_3.on_aggregated_data(arg_1, arg_2)", "path": "yandextank/aggregator/tank_aggregator.py", "identifier": "TankAggregator.__notify_listeners", "docstring": "notify all listeners about aggregate data and stats", "docstring_tokens": ["notify", "all", "listeners", "about", "aggregate", "data", "and", "stats"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 255458}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L461-L479", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Formats a list of fields for display.", "language": "python", "parameters": "(self, fields, title_width=12)", "return_statement": "return \"\\n\".join(out)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "12", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "arg_0", ".", "__head", "for", "arg_5", ",", "arg_6", "in", "arg_1", ":", "if", "len", "(", "arg_6", ".", "splitlines", "(", ")", ")", ">", "1", ":", "arg_5", "=", "arg_4", "(", "arg_5", "+", "\":\"", ")", "+", "\"\\n\"", "else", ":", "arg_5", "=", "arg_4", "(", "(", "arg_5", "+", "\":\"", ")", ".", "ljust", "(", "arg_2", ")", ")", "arg_3", ".", "append", "(", "arg_5", "+", "arg_6", ")", "return", "\"\\n\"", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=12):\n        \"\"\"Formats a list of fields for display.\n\n        Parameters\n        ----------\n        fields : list\n          A list of 2-tuples: (field_title, field_content)\n        title_width : int\n          How many characters to pad titles to. Default 12.\n        \"\"\"\n        arg_3 = []\n        arg_4 = arg_0.__head\n        for arg_5, arg_6 in arg_1:\n            if len(arg_6.splitlines()) > 1:\n                arg_5 = arg_4(arg_5 + \":\") + \"\\n\"\n            else:\n                arg_5 = arg_4((arg_5+\":\").ljust(arg_2))\n            arg_3.append(arg_5 + arg_6)\n        return \"\\n\".join(arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/core/oinspect.py", "identifier": "Inspector._format_fields", "docstring": "Formats a list of fields for display.\n\n        Parameters\n        ----------\n        fields : list\n          A list of 2-tuples: (field_title, field_content)\n        title_width : int\n          How many characters to pad titles to. Default 12.", "docstring_tokens": ["Formats", "a", "list", "of", "fields", "for", "display", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255459}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L2820-L2882", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Time stretch audio without changing pitch.", "language": "python", "parameters": "(self, factor, audio_type=None, quick=False)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "if", "not", "is_number", "(", "arg_1", ")", "or", "arg_1", "<=", "0", ":", "raise", "ValueError", "(", "\"factor must be a positive number\"", ")", "if", "arg_1", "<", "0.5", "or", "arg_1", ">", "2", ":", "logger", ".", "warning", "(", "\"Using an extreme time stretching factor. \"", "\"Quality of results will be poor\"", ")", "if", "abs", "(", "arg_1", "-", "1.0", ")", "<=", "0.1", ":", "logger", ".", "warning", "(", "\"For this stretch factor, \"", "\"the stretch effect has better performance.\"", ")", "if", "arg_2", "not", "in", "[", "None", ",", "'m'", ",", "'s'", ",", "'l'", "]", ":", "raise", "ValueError", "(", "\"audio_type must be one of None, 'm', 's', or 'l'.\"", ")", "if", "not", "isinstance", "(", "arg_3", ",", "bool", ")", ":", "raise", "ValueError", "(", "\"quick must be a boolean.\"", ")", "arg_4", "=", "[", "'Func'", "]", "if", "arg_3", ":", "arg_4", ".", "append", "(", "'-q'", ")", "if", "arg_2", "is", "not", "None", ":", "arg_4", ".", "append", "(", "'-{}'", ".", "format", "(", "arg_2", ")", ")", "arg_4", ".", "append", "(", "'{:f}'", ".", "format", "(", "arg_1", ")", ")", "arg_0", ".", "effects", ".", "extend", "(", "arg_4", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        '''Time stretch audio without changing pitch.\n\n        This effect uses the WSOLA algorithm. The audio is chopped up into\n        segments which are then shifted in the time domain and overlapped\n        (cross-faded) at points where their waveforms are most similar as\n        determined by measurement of least squares.\n\n        Parameters\n        ----------\n        factor : float\n            The ratio of new Func to the old Func.\n            For ex. 1.1 speeds up the Func by 10%; 0.9 slows it down by 10%.\n        audio_type : str\n            Type of audio, which optimizes algorithm parameters. One of:\n             * m : Music,\n             * s : Speech,\n             * l : Linear (useful when factor is close to 1),\n        quick : bool, default=False\n            If True, this effect will run faster but with lower sound quality.\n\n        See Also\n        --------\n        stretch, speed, pitch\n\n        '''\n        if not is_number(arg_1) or arg_1 <= 0:\n            raise ValueError(\"factor must be a positive number\")\n\n        if arg_1 < 0.5 or arg_1 > 2:\n            logger.warning(\n                \"Using an extreme time stretching factor. \"\n                \"Quality of results will be poor\"\n            )\n\n        if abs(arg_1 - 1.0) <= 0.1:\n            logger.warning(\n                \"For this stretch factor, \"\n                \"the stretch effect has better performance.\"\n            )\n\n        if arg_2 not in [None, 'm', 's', 'l']:\n            raise ValueError(\n                \"audio_type must be one of None, 'm', 's', or 'l'.\"\n            )\n\n        if not isinstance(arg_3, bool):\n            raise ValueError(\"quick must be a boolean.\")\n\n        arg_4 = ['Func']\n\n        if arg_3:\n            arg_4.append('-q')\n\n        if arg_2 is not None:\n            arg_4.append('-{}'.format(arg_2))\n\n        arg_4.append('{:f}'.format(arg_1))\n\n        arg_0.effects.extend(arg_4)\n        arg_0.effects_log.append('Func')\n\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.tempo", "docstring": "Time stretch audio without changing pitch.\n\n        This effect uses the WSOLA algorithm. The audio is chopped up into\n        segments which are then shifted in the time domain and overlapped\n        (cross-faded) at points where their waveforms are most similar as\n        determined by measurement of least squares.\n\n        Parameters\n        ----------\n        factor : float\n            The ratio of new tempo to the old tempo.\n            For ex. 1.1 speeds up the tempo by 10%; 0.9 slows it down by 10%.\n        audio_type : str\n            Type of audio, which optimizes algorithm parameters. One of:\n             * m : Music,\n             * s : Speech,\n             * l : Linear (useful when factor is close to 1),\n        quick : bool, default=False\n            If True, this effect will run faster but with lower sound quality.\n\n        See Also\n        --------\n        stretch, speed, pitch", "docstring_tokens": ["Time", "stretch", "audio", "without", "changing", "pitch", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 255460}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L106-L146", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "This function creates the command list from available information", "language": "python", "parameters": "(self)", "return_statement": "return [hive_bin] + cmd_extra + hive_params_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "conn", "arg_2", "=", "'hive'", "arg_3", "=", "[", "]", "if", "arg_0", ".", "use_beeline", ":", "arg_2", "=", "'beeline'", "arg_4", "=", "\"jdbc:hive2://{host}:{port}/{schema}\"", ".", "format", "(", "host", "=", "arg_1", ".", "host", ",", "port", "=", "arg_1", ".", "port", ",", "schema", "=", "arg_1", ".", "schema", ")", "if", "configuration", ".", "conf", ".", "get", "(", "'core'", ",", "'security'", ")", "==", "'kerberos'", ":", "arg_5", "=", "arg_1", ".", "extra_dejson", ".", "get", "(", "'principal'", ",", "\"hive/_HOST@EXAMPLE.COM\"", ")", "if", "\"_HOST\"", "in", "arg_5", ":", "arg_5", "=", "utils", ".", "replace_hostname_pattern", "(", "utils", ".", "get_components", "(", "arg_5", ")", ")", "arg_6", "=", "\"\"", "if", "arg_1", ".", "extra_dejson", ".", "get", "(", "'proxy_user'", ")", "==", "\"login\"", "and", "arg_1", ".", "login", ":", "arg_6", "=", "\"hive.server2.proxy.user={0}\"", ".", "format", "(", "arg_1", ".", "login", ")", "elif", "arg_1", ".", "extra_dejson", ".", "get", "(", "'proxy_user'", ")", "==", "\"owner\"", "and", "arg_0", ".", "run_as", ":", "arg_6", "=", "\"hive.server2.proxy.user={0}\"", ".", "format", "(", "arg_0", ".", "run_as", ")", "arg_4", "+=", "\";principal={template};{proxy_user}\"", ".", "format", "(", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_0", ".", "auth", ":", "arg_4", "+=", "\";auth=\"", "+", "arg_0", ".", "auth", "arg_4", "=", "'\"{}\"'", ".", "format", "(", "arg_4", ")", "arg_3", "+=", "[", "'-u'", ",", "arg_4", "]", "if", "arg_1", ".", "login", ":", "arg_3", "+=", "[", "'-n'", ",", "arg_1", ".", "login", "]", "if", "arg_1", ".", "password", ":", "arg_3", "+=", "[", "'-p'", ",", "arg_1", ".", "password", "]", "arg_7", "=", "arg_0", ".", "hive_cli_params", ".", "split", "(", ")", "return", "[", "arg_2", "]", "+", "arg_3", "+", "arg_7"], "function": "def Func(arg_0):\n        \"\"\"\n        This function creates the command list from available information\n        \"\"\"\n        arg_1 = arg_0.conn\n        arg_2 = 'hive'\n        arg_3 = []\n\n        if arg_0.use_beeline:\n            arg_2 = 'beeline'\n            arg_4 = \"jdbc:hive2://{host}:{port}/{schema}\".format(\n                host=arg_1.host, port=arg_1.port, schema=arg_1.schema)\n            if configuration.conf.get('core', 'security') == 'kerberos':\n                arg_5 = arg_1.extra_dejson.get(\n                    'principal', \"hive/_HOST@EXAMPLE.COM\")\n                if \"_HOST\" in arg_5:\n                    arg_5 = utils.replace_hostname_pattern(\n                        utils.get_components(arg_5))\n\n                arg_6 = \"\"  # noqa\n                if arg_1.extra_dejson.get('proxy_user') == \"login\" and arg_1.login:\n                    arg_6 = \"hive.server2.proxy.user={0}\".format(arg_1.login)\n                elif arg_1.extra_dejson.get('proxy_user') == \"owner\" and arg_0.run_as:\n                    arg_6 = \"hive.server2.proxy.user={0}\".format(arg_0.run_as)\n\n                arg_4 += \";principal={template};{proxy_user}\".format(\n                    arg_5=arg_5, arg_6=arg_6)\n            elif arg_0.auth:\n                arg_4 += \";auth=\" + arg_0.auth\n\n            arg_4 = '\"{}\"'.format(arg_4)\n\n            arg_3 += ['-u', arg_4]\n            if arg_1.login:\n                arg_3 += ['-n', arg_1.login]\n            if arg_1.password:\n                arg_3 += ['-p', arg_1.password]\n\n        arg_7 = arg_0.hive_cli_params.split()\n\n        return [arg_2] + arg_3 + arg_7", "path": "airflow/hooks/hive_hooks.py", "identifier": "HiveCliHook._prepare_cli_cmd", "docstring": "This function creates the command list from available information", "docstring_tokens": ["This", "function", "creates", "the", "command", "list", "from", "available", "information"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255461}
{"url": "https://github.com/seporaitis/mysqlparse/blob/c327c5a1d8d6d143b67f789be7dc80357a1a5556/mysqlparse/__init__.py#L11-L29", "sha": "c327c5a1d8d6d143b67f789be7dc80357a1a5556", "docstring_summary": "Parse a file-like object or string.", "language": "python", "parameters": "(file_or_string)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "mysqlFunc", ".", "grammar", ".", "sql_file", "import", "sql_file_syntax", "if", "hasattr", "(", "arg_0", ",", "'read'", ")", "and", "hasattr", "(", "arg_0", ".", "read", ",", "'__call__'", ")", ":", "return", "sql_file_syntax", ".", "FuncString", "(", "arg_0", ".", "read", "(", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "return", "sql_file_syntax", ".", "FuncString", "(", "arg_0", ")", "else", ":", "raise", "TypeError", "(", "\"Expected file-like or string object, but got '{type_name}' instead.\"", ".", "format", "(", "type_name", "=", "type", "(", "arg_0", ")", ".", "__name__", ",", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Parse a file-like object or string.\n\n    Args:\n        file_or_string (file, str): File-like object or string.\n\n    Returns:\n        ParseResults: instance of pyparsing Func results.\n    \"\"\"\n    from mysqlFunc.grammar.sql_file import sql_file_syntax\n\n    if hasattr(arg_0, 'read') and hasattr(arg_0.read, '__call__'):\n        return sql_file_syntax.FuncString(arg_0.read())\n    elif isinstance(arg_0, six.string_types):\n        return sql_file_syntax.FuncString(arg_0)\n    else:\n        raise TypeError(\"Expected file-like or string object, but got '{type_name}' instead.\".format(\n            type_name=type(arg_0).__name__,\n        ))", "path": "mysqlparse/__init__.py", "identifier": "parse", "docstring": "Parse a file-like object or string.\n\n    Args:\n        file_or_string (file, str): File-like object or string.\n\n    Returns:\n        ParseResults: instance of pyparsing parse results.", "docstring_tokens": ["Parse", "a", "file", "-", "like", "object", "or", "string", "."], "nwo": "seporaitis/mysqlparse", "score": 0.2819040786957655, "idx": 255462}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/thing.py#L267-L278", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Set a property value.", "language": "python", "parameters": "(self, property_name, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "find_property", "(", "arg_1", ")", "if", "not", "arg_3", ":", "return", "arg_3", ".", "set_value", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set a property value.\n\n        property_name -- name of the property to set\n        value -- value to set\n        \"\"\"\n        arg_3 = arg_0.find_property(arg_1)\n        if not arg_3:\n            return\n\n        arg_3.set_value(arg_2)", "path": "webthing/thing.py", "identifier": "Thing.set_property", "docstring": "Set a property value.\n\n        property_name -- name of the property to set\n        value -- value to set", "docstring_tokens": ["Set", "a", "property", "value", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 255463}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/adapter.py#L66-L71", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Start scanning for BLE devices with this adapter.", "language": "python", "parameters": "(self, timeout_sec=TIMEOUT_SEC)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_0", ".", "_scan_started", ".", "clear", "(", ")", "arg_0", ".", "_adapter", ".", "StartDiscovery", "(", ")", "if", "not", "arg_0", ".", "_scan_started", ".", "wait", "(", "arg_1", ")", ":", "raise", "RuntimeError", "(", "'Exceeded timeout waiting for adapter to start scanning!'", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Start scanning for BLE devices with this adapter.\"\"\"\n        arg_0._scan_started.clear()\n        arg_0._adapter.StartDiscovery()\n        if not arg_0._scan_started.wait(arg_1):\n            raise RuntimeError('Exceeded timeout waiting for adapter to start scanning!')", "path": "Adafruit_BluefruitLE/bluez_dbus/adapter.py", "identifier": "BluezAdapter.start_scan", "docstring": "Start scanning for BLE devices with this adapter.", "docstring_tokens": ["Start", "scanning", "for", "BLE", "devices", "with", "this", "adapter", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 255464}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L69-L89", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "List all notebooks in the notebook dir.", "language": "python", "parameters": "(self)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "notebook_dir", ",", "'*'", "+", "arg_0", ".", "filename_ext", ")", ")", "arg_1", "=", "[", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "arg_3", ")", ")", "[", "0", "]", "for", "arg_3", "in", "arg_1", "]", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", "not", "in", "arg_0", ".", "rev_mapping", ":", "arg_4", "=", "arg_0", ".", "new_notebook_id", "(", "arg_3", ")", "else", ":", "arg_4", "=", "arg_0", ".", "rev_mapping", "[", "arg_3", "]", "arg_2", ".", "append", "(", "dict", "(", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", ")", "arg_2", "=", "sorted", "(", "arg_2", ",", "key", "=", "lambda", "item", ":", "item", "[", "'name'", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"List all notebooks in the notebook dir.\n\n        This returns a list of dicts of the form::\n\n            dict(notebook_id=notebook,name=name)\n        \"\"\"\n        arg_1 = glob.glob(os.path.join(arg_0.notebook_dir,\n                                       '*' + arg_0.filename_ext))\n        arg_1 = [os.path.splitext(os.path.basename(arg_3))[0]\n                 for arg_3 in arg_1]\n\n        arg_2 = []\n        for arg_3 in arg_1:\n            if arg_3 not in arg_0.rev_mapping:\n                arg_4 = arg_0.new_notebook_id(arg_3)\n            else:\n                arg_4 = arg_0.rev_mapping[arg_3]\n            arg_2.append(dict(arg_4=arg_4,arg_3=arg_3))\n        arg_2 = sorted(arg_2, key=lambda item: item['name'])\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py", "identifier": "NotebookManager.list_notebooks", "docstring": "List all notebooks in the notebook dir.\n\n        This returns a list of dicts of the form::\n\n            dict(notebook_id=notebook,name=name)", "docstring_tokens": ["List", "all", "notebooks", "in", "the", "notebook", "dir", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255465}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-common/azure/common/credentials.py#L9-L29", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Return a CLI profile class.", "language": "python", "parameters": "()", "return_statement": "return Profile(storage=ACCOUNT)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "from", "azure", ".", "cli", ".", "core", ".", "_profile", "import", "Profile", "from", "azure", ".", "cli", ".", "core", ".", "_session", "import", "ACCOUNT", "from", "azure", ".", "cli", ".", "core", ".", "_environment", "import", "get_config_dir", "except", "ImportError", ":", "raise", "ImportError", "(", "\"You need to install 'azure-cli-core' to load CLI credentials\"", ")", "arg_0", "=", "get_config_dir", "(", ")", "ACCOUNT", ".", "load", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'azureProfile.json'", ")", ")", "return", "Profile", "(", "storage", "=", "ACCOUNT", ")"], "function": "def Func():\n    \"\"\"Return a CLI profile class.\n\n    .. versionadded:: 1.1.6\n\n    :return: A CLI Profile\n    :rtype: azure.cli.core._profile.Profile\n    :raises: ImportError if azure-cli-core package is not available\n    \"\"\"\n\n    try:\n        from azure.cli.core._profile import Profile\n        from azure.cli.core._session import ACCOUNT\n        from azure.cli.core._environment import get_config_dir\n    except ImportError:\n        raise ImportError(\"You need to install 'azure-cli-core' to load CLI credentials\")\n\n\n    arg_0 = get_config_dir()\n    ACCOUNT.load(os.path.join(arg_0, 'azureProfile.json'))\n    return Profile(storage=ACCOUNT)", "path": "azure-common/azure/common/credentials.py", "identifier": "get_cli_profile", "docstring": "Return a CLI profile class.\n\n    .. versionadded:: 1.1.6\n\n    :return: A CLI Profile\n    :rtype: azure.cli.core._profile.Profile\n    :raises: ImportError if azure-cli-core package is not available", "docstring_tokens": ["Return", "a", "CLI", "profile", "class", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255466}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/rda/io.py#L27-L91", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Write out a geotiff file of the image", "language": "python", "parameters": "(arr, path='./output.tif', proj=None, spec=None, bands=None, **kwargs)", "return_statement": "return path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'./output.tif'", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "assert", "has_rasterio", ",", "\"To create geotiff images please install rasterio\"", "try", ":", "arg_6", "=", "arg_0", ".", "rda", ".", "metadata", "[", "\"image\"", "]", "arg_7", "=", "arg_6", "[", "\"tileXSize\"", "]", "arg_8", "=", "arg_6", "[", "\"tileYSize\"", "]", "except", "(", "AttributeError", ",", "KeyError", ")", ":", "arg_7", "=", "arg_5", ".", "get", "(", "\"chunk_size\"", ",", "256", ")", "arg_8", "=", "arg_5", ".", "get", "(", "\"chunk_size\"", ",", "256", ")", "try", ":", "arg_9", "=", "arg_5", "[", "'transform'", "]", "if", "'transform'", "in", "arg_5", "else", "arg_0", ".", "affine", "except", ":", "arg_9", "=", "None", "arg_10", "=", "arg_0", ".", "dtype", ".", "name", "if", "arg_0", ".", "dtype", ".", "name", "!=", "'int8'", "else", "'uint8'", "if", "arg_3", "is", "not", "None", "and", "arg_3", ".", "lower", "(", ")", "==", "'rgb'", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "_rgb_bands", "if", "not", "arg_0", ".", "options", ".", "get", "(", "'dra'", ")", ":", "from", "gbdxtools", ".", "rda", ".", "interface", "import", "RDA", "arg_11", "=", "RDA", "(", ")", "arg_12", "=", "arg_11", ".", "HistogramDRA", "(", "arg_0", ")", "arg_0", "=", "arg_12", ".", "aoi", "(", "bbox", "=", "arg_0", ".", "bounds", ")", "arg_0", "=", "arg_0", "[", "arg_4", ",", "...", "]", ".", "astype", "(", "np", ".", "uint8", ")", "arg_10", "=", "'uint8'", "else", ":", "if", "arg_4", "is", "not", "None", ":", "arg_0", "=", "arg_0", "[", "arg_4", ",", "...", "]", "arg_13", "=", "{", "'width'", ":", "arg_0", ".", "shape", "[", "2", "]", ",", "'height'", ":", "arg_0", ".", "shape", "[", "1", "]", ",", "'count'", ":", "arg_0", ".", "shape", "[", "0", "]", ",", "'dtype'", ":", "arg_10", ",", "'driver'", ":", "'GTiff'", ",", "'transform'", ":", "arg_9", "}", "if", "arg_2", "is", "not", "None", ":", "arg_13", "[", "\"crs\"", "]", "=", "{", "'init'", ":", "arg_2", "}", "if", "\"tiled\"", "in", "arg_5", "and", "arg_5", "[", "\"tiled\"", "]", ":", "arg_13", ".", "update", "(", "blockxsize", "=", "arg_7", ",", "blockysize", "=", "arg_8", ",", "tiled", "=", "\"yes\"", ")", "with", "rasterio", ".", "open", "(", "arg_1", ",", "\"w\"", ",", "**", "arg_13", ")", "as", "dst", ":", "arg_14", "=", "rio_writer", "(", "dst", ")", "arg_15", "=", "store", "(", "arg_0", ",", "arg_14", ",", "compute", "=", "False", ")", "arg_15", ".", "compute", "(", "scheduler", "=", "threaded_get", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1='./output.tif', arg_2=None, arg_3=None, arg_4=None, **arg_5):\n    ''' Write out a geotiff file of the image\n\n    Args:\n        path (str): path to write the geotiff file to, default is ./output.tif\n        proj (str): EPSG string of projection to reproject to\n        spec (str): if set to 'rgb', write out color-balanced 8-bit RGB tif\n        bands (list): list of bands to export. If spec='rgb' will default to RGB bands\n    \n    Returns:\n        str: path the geotiff was written to'''\n        \n    assert has_rasterio, \"To create geotiff images please install rasterio\" \n\n    try:\n        arg_6 = arg_0.rda.metadata[\"image\"]\n        arg_7 = arg_6[\"tileXSize\"]\n        arg_8 = arg_6[\"tileYSize\"]\n    except (AttributeError, KeyError):\n        arg_7 = arg_5.get(\"chunk_size\", 256)\n        arg_8 = arg_5.get(\"chunk_size\", 256)\n\n    try:\n        arg_9 = arg_5['transform'] if 'transform' in arg_5 else arg_0.affine\n    except:\n        arg_9 = None\n\n    arg_10 = arg_0.dtype.name if arg_0.dtype.name != 'int8' else 'uint8' \n\n    if arg_3 is not None and arg_3.lower() == 'rgb':\n        if arg_4 is None:\n            arg_4 = arg_0._rgb_bands\n        # skip if already DRA'ed\n        if not arg_0.options.get('dra'):\n            # add the RDA HistogramDRA op to get a RGB 8-bit image\n            from gbdxtools.rda.interface import RDA\n            arg_11 = RDA()\n            arg_12 = arg_11.HistogramDRA(arg_0)\n            # Reset the bounds and select the bands on the new Dask\n            arg_0 = arg_12.aoi(bbox=arg_0.bounds)\n        arg_0 = arg_0[arg_4,...].astype(np.uint8)\n        arg_10 = 'uint8'\n    else:\n        if arg_4 is not None:\n            arg_0 = arg_0[arg_4,...]\n    arg_13 = {\n        'width': arg_0.shape[2],\n        'height': arg_0.shape[1],\n        'count': arg_0.shape[0],\n        'dtype': arg_10,\n        'driver': 'GTiff',\n        'transform': arg_9\n    }\n    if arg_2 is not None:\n        arg_13[\"crs\"] = {'init': arg_2}\n\n    if \"tiled\" in arg_5 and arg_5[\"tiled\"]:\n        arg_13.update(blockxsize=arg_7, blockysize=arg_8, tiled=\"yes\")\n\n    with rasterio.open(arg_1, \"w\", **arg_13) as dst:\n        arg_14 = rio_writer(dst)\n        arg_15 = store(arg_0, arg_14, compute=False)\n        arg_15.compute(scheduler=threaded_get)\n    \n    return arg_1", "path": "gbdxtools/rda/io.py", "identifier": "to_geotiff", "docstring": "Write out a geotiff file of the image\n\n    Args:\n        path (str): path to write the geotiff file to, default is ./output.tif\n        proj (str): EPSG string of projection to reproject to\n        spec (str): if set to 'rgb', write out color-balanced 8-bit RGB tif\n        bands (list): list of bands to export. If spec='rgb' will default to RGB bands\n    \n    Returns:\n        str: path the geotiff was written to", "docstring_tokens": ["Write", "out", "a", "geotiff", "file", "of", "the", "image"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 255467}
{"url": "https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/run.py#L86-L109", "sha": "5b8218cffa409ed733cf850a6fde16fafb8fc2af", "docstring_summary": "Time to run.", "language": "python", "parameters": "(config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "setup", "(", "arg_0", ")", "if", "arg_0", ".", "exitfirst", ":", "arg_1", ".", "current_result", ".", "failfast", "=", "True", "arg_1", ".", "current_result", ".", "startTestRun", "(", ")", "for", "arg_4", "in", "arg_0", ".", "specs", ":", "try", ":", "load_by_name", "(", "arg_4", ")", "except", "Exception", ":", "arg_1", ".", "current_result", ".", "addError", "(", "_ExampleNotRunning", "(", ")", ",", "sys", ".", "exc_info", "(", ")", ")", "arg_1", ".", "current_result", ".", "stopTestRun", "(", ")", "sys", ".", "exit", "(", "not", "arg_1", ".", "current_result", ".", "wasSuccessful", "(", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Time to Func.\n\n    \"\"\"\n\n    setup(arg_0)\n\n    if arg_0.exitfirst:\n        arg_1.current_result.failfast = True\n\n    arg_1.current_result.startTestRun()\n\n    for arg_4 in arg_0.specs:\n        try:\n            load_by_name(arg_4)\n        except Exception:\n            arg_1.current_result.addError(\n                _ExampleNotRunning(), sys.exc_info()\n            )\n\n    arg_1.current_result.stopTestRun()\n\n    sys.exit(not arg_1.current_result.wasSuccessful())", "path": "ivoire/run.py", "identifier": "run", "docstring": "Time to run.", "docstring_tokens": ["Time", "to", "run", "."], "nwo": "Julian/Ivoire", "score": 0.27637529583590154, "idx": 255468}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/risk.py#L408-L459", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Returns arrays of pth percentile of long, short and gross volume exposures\n    of an algorithm's held shares", "language": "python", "parameters": "(shares_held, volumes, percentile)", "return_statement": "return longed_threshold, shorted_threshold, grossed_threshold", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "0", ",", "np", ".", "nan", ")", "arg_3", "=", "arg_0", "[", "arg_0", ">", "0", "]", "arg_4", "=", "-", "1", "*", "arg_0", "[", "arg_0", "<", "0", "]", "arg_5", "=", "arg_0", ".", "abs", "(", ")", "arg_6", "=", "arg_3", ".", "divide", "(", "arg_1", ")", "arg_7", "=", "arg_4", ".", "divide", "(", "arg_1", ")", "arg_8", "=", "arg_5", ".", "divide", "(", "arg_1", ")", "arg_9", "=", "100", "*", "arg_6", ".", "apply", "(", "partial", "(", "np", ".", "nanpercentile", ",", "q", "=", "100", "*", "arg_2", ")", ",", "axis", "=", "'columns'", ",", ")", "arg_10", "=", "100", "*", "arg_7", ".", "apply", "(", "partial", "(", "np", ".", "nanpercentile", ",", "q", "=", "100", "*", "arg_2", ")", ",", "axis", "=", "'columns'", ",", ")", "arg_11", "=", "100", "*", "arg_8", ".", "apply", "(", "partial", "(", "np", ".", "nanpercentile", ",", "q", "=", "100", "*", "arg_2", ")", ",", "axis", "=", "'columns'", ",", ")", "return", "arg_9", ",", "arg_10", ",", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Returns arrays of pth percentile of long, short and gross volume exposures\n    of an algorithm's held shares\n\n    Parameters\n    ----------\n    shares_held : pd.DataFrame\n        Daily number of shares held by an algorithm.\n        - See full explanation in create_risk_tear_sheet\n\n    volume : pd.DataFrame\n        Daily volume per asset\n        - See full explanation in create_risk_tear_sheet\n\n    percentile : float\n        Percentile to use when computing and plotting volume exposures\n        - See full explanation in create_risk_tear_sheet\n    \"\"\"\n\n    arg_0 = arg_0.replace(0, np.nan)\n\n    arg_3 = arg_0[arg_0 > 0]\n    arg_4 = -1 * arg_0[arg_0 < 0]\n    arg_5 = arg_0.abs()\n\n    arg_6 = arg_3.divide(arg_1)\n    arg_7 = arg_4.divide(arg_1)\n    arg_8 = arg_5.divide(arg_1)\n\n    # NOTE: To work around a bug in `quantile` with nan-handling in\n    #       pandas 0.18, use np.nanpercentile by applying to each row of\n    #       the dataframe. This is fixed in pandas 0.19.\n    #\n    # longed_threshold = 100*longed_frac.quantile(percentile, axis='columns')\n    # shorted_threshold = 100*shorted_frac.quantile(percentile, axis='columns')\n    # grossed_threshold = 100*grossed_frac.quantile(percentile, axis='columns')\n\n    arg_9 = 100 * arg_6.apply(\n        partial(np.nanpercentile, q=100 * arg_2),\n        axis='columns',\n    )\n    arg_10 = 100 * arg_7.apply(\n        partial(np.nanpercentile, q=100 * arg_2),\n        axis='columns',\n    )\n    arg_11 = 100 * arg_8.apply(\n        partial(np.nanpercentile, q=100 * arg_2),\n        axis='columns',\n    )\n\n    return arg_9, arg_10, arg_11", "path": "pyfolio/risk.py", "identifier": "compute_volume_exposures", "docstring": "Returns arrays of pth percentile of long, short and gross volume exposures\n    of an algorithm's held shares\n\n    Parameters\n    ----------\n    shares_held : pd.DataFrame\n        Daily number of shares held by an algorithm.\n        - See full explanation in create_risk_tear_sheet\n\n    volume : pd.DataFrame\n        Daily volume per asset\n        - See full explanation in create_risk_tear_sheet\n\n    percentile : float\n        Percentile to use when computing and plotting volume exposures\n        - See full explanation in create_risk_tear_sheet", "docstring_tokens": ["Returns", "arrays", "of", "pth", "percentile", "of", "long", "short", "and", "gross", "volume", "exposures", "of", "an", "algorithm", "s", "held", "shares"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255469}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L1372-L1423", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the enthalpy flow rate of the stream at the specified\n        temperature, in the case of it being coal.", "language": "python", "parameters": "(self, T)", "return_statement": "return Hfr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "0", "arg_4", "=", "0", "arg_5", "=", "0", "arg_6", "=", "0", "arg_7", "=", "0.0", "for", "arg_8", "in", "arg_0", ".", "material", ".", "compounds", ":", "arg_9", "=", "arg_0", ".", "material", ".", "get_compound_index", "(", "arg_8", ")", "arg_10", "=", "arg_8", ".", "split", "(", "'['", ")", "[", "0", "]", "if", "stoich", ".", "element_mass_fraction", "(", "arg_10", ",", "'C'", ")", "==", "1.0", ":", "arg_2", "+=", "arg_0", ".", "_compound_mfrs", "[", "arg_9", "]", "elif", "stoich", ".", "element_mass_fraction", "(", "arg_10", ",", "'H'", ")", "==", "1.0", ":", "arg_3", "+=", "arg_0", ".", "_compound_mfrs", "[", "arg_9", "]", "elif", "stoich", ".", "element_mass_fraction", "(", "arg_10", ",", "'O'", ")", "==", "1.0", ":", "arg_4", "+=", "arg_0", ".", "_compound_mfrs", "[", "arg_9", "]", "elif", "stoich", ".", "element_mass_fraction", "(", "arg_10", ",", "'N'", ")", "==", "1.0", ":", "arg_5", "+=", "arg_0", ".", "_compound_mfrs", "[", "arg_9", "]", "elif", "stoich", ".", "element_mass_fraction", "(", "arg_10", ",", "'S'", ")", "==", "1.0", ":", "arg_6", "+=", "arg_0", ".", "_compound_mfrs", "[", "arg_9", "]", "else", ":", "arg_11", "=", "thermo", ".", "H", "(", "arg_8", ",", "arg_1", ",", "arg_0", ".", "_compound_mfrs", "[", "arg_9", "]", ")", "arg_7", "+=", "arg_11", "arg_12", "=", "arg_2", "+", "arg_3", "+", "arg_4", "+", "arg_5", "+", "arg_6", "arg_13", "=", "arg_2", "/", "arg_12", "arg_14", "=", "arg_3", "/", "arg_12", "arg_15", "=", "arg_4", "/", "arg_12", "arg_16", "=", "arg_5", "/", "arg_12", "arg_17", "=", "arg_6", "/", "arg_12", "arg_18", "=", "coals", ".", "DafHTy", "(", ")", "arg_19", "=", "arg_18", ".", "calculate", "(", "arg_1", "=", "arg_1", "+", "273.15", ",", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ",", "arg_15", "=", "arg_15", ",", "arg_16", "=", "arg_16", ",", "arg_17", "=", "arg_17", ")", "/", "3.6e6", "arg_20", "=", "arg_18", ".", "calculate", "(", "arg_1", "=", "298.15", ",", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ",", "arg_15", "=", "arg_15", ",", "arg_16", "=", "arg_16", ",", "arg_17", "=", "arg_17", ")", "/", "3.6e6", "arg_21", "=", "arg_19", "-", "arg_20", "+", "arg_0", ".", "_DH298", "arg_21", "*=", "arg_12", "arg_7", "+=", "arg_21", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the enthalpy flow rate of the stream at the specified\n        temperature, in the case of it being coal.\n\n        :param T: Temperature. [\u00b0C]\n\n        :returns: Enthalpy flow rate. [kWh/h]\n        \"\"\"\n\n        arg_2 = 0  # kg/h\n        arg_3 = 0  # kg/h\n        arg_4 = 0  # kg/h\n        arg_5 = 0  # kg/h\n        arg_6 = 0  # kg/h\n\n        arg_7 = 0.0  # kWh/h\n        for arg_8 in arg_0.material.compounds:\n            arg_9 = arg_0.material.get_compound_index(arg_8)\n            arg_10 = arg_8.split('[')[0]\n            if stoich.element_mass_fraction(arg_10, 'C') == 1.0:\n                arg_2 += arg_0._compound_mfrs[arg_9]\n            elif stoich.element_mass_fraction(arg_10, 'H') == 1.0:\n                arg_3 += arg_0._compound_mfrs[arg_9]\n            elif stoich.element_mass_fraction(arg_10, 'O') == 1.0:\n                arg_4 += arg_0._compound_mfrs[arg_9]\n            elif stoich.element_mass_fraction(arg_10, 'N') == 1.0:\n                arg_5 += arg_0._compound_mfrs[arg_9]\n            elif stoich.element_mass_fraction(arg_10, 'S') == 1.0:\n                arg_6 += arg_0._compound_mfrs[arg_9]\n            else:\n                arg_11 = thermo.H(arg_8, arg_1, arg_0._compound_mfrs[arg_9])\n                arg_7 += arg_11\n\n        arg_12 = arg_2 + arg_3 + arg_4 + arg_5 + arg_6  # kg/h\n        arg_13 = arg_2 / arg_12\n        arg_14 = arg_3 / arg_12\n        arg_15 = arg_4 / arg_12\n        arg_16 = arg_5 / arg_12\n        arg_17 = arg_6 / arg_12\n\n        arg_18 = coals.DafHTy()\n        arg_19 = arg_18.calculate(arg_1=arg_1+273.15, arg_13=arg_13, arg_14=arg_14, arg_15=arg_15, arg_16=arg_16,\n                             arg_17=arg_17) / 3.6e6  # kWh/kg\n        arg_20 = arg_18.calculate(arg_1=298.15, arg_13=arg_13, arg_14=arg_14, arg_15=arg_15, arg_16=arg_16,\n                                arg_17=arg_17) / 3.6e6  # kWh/kg\n        arg_21 = arg_19 - arg_20 + arg_0._DH298  # kWh/kg\n        arg_21 *= arg_12  # kWh/h\n\n        arg_7 += arg_21\n\n        return arg_7", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "MaterialStream._calculate_Hfr_coal", "docstring": "Calculate the enthalpy flow rate of the stream at the specified\n        temperature, in the case of it being coal.\n\n        :param T: Temperature. [\u00b0C]\n\n        :returns: Enthalpy flow rate. [kWh/h]", "docstring_tokens": ["Calculate", "the", "enthalpy", "flow", "rate", "of", "the", "stream", "at", "the", "specified", "temperature", "in", "the", "case", "of", "it", "being", "coal", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 255470}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/cover.py#L139-L151", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Begin recording coverage information.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "log", ".", "debug", "(", "\"Coverage Func\"", ")", "arg_0", ".", "skipModules", "=", "sys", ".", "modules", ".", "keys", "(", ")", "[", ":", "]", "if", "arg_0", ".", "coverErase", ":", "log", ".", "debug", "(", "\"Clearing previously collected coverage statistics\"", ")", "arg_0", ".", "coverInstance", ".", "combine", "(", ")", "arg_0", ".", "coverInstance", ".", "erase", "(", ")", "arg_0", ".", "coverInstance", ".", "exclude", "(", "'#pragma[: ]+[nN][oO] [cC][oO][vV][eE][rR]'", ")", "arg_0", ".", "coverInstance", ".", "load", "(", ")", "arg_0", ".", "coverInstance", ".", "start", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Begin recording coverage information.\n        \"\"\"\n        log.debug(\"Coverage Func\")\n        arg_0.skipModules = sys.modules.keys()[:]\n        if arg_0.coverErase:\n            log.debug(\"Clearing previously collected coverage statistics\")\n            arg_0.coverInstance.combine()\n            arg_0.coverInstance.erase()\n        arg_0.coverInstance.exclude('#pragma[: ]+[nN][oO] [cC][oO][vV][eE][rR]')\n        arg_0.coverInstance.load()\n        arg_0.coverInstance.start()", "path": "environment/lib/python2.7/site-packages/nose/plugins/cover.py", "identifier": "Coverage.begin", "docstring": "Begin recording coverage information.", "docstring_tokens": ["Begin", "recording", "coverage", "information", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255471}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L669-L681", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Return true if the given class node is subclass of\n    exceptions.Exception.", "language": "python", "parameters": "(node: astroid.node_classes.NodeNG)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "node_classes", ".", "NodeNG", ")", "->", "bool", ":", "arg_4", "=", "arg_0", ".", "ancestors", "(", ")", "if", "hasattr", "(", "arg_0", ",", "\"ancestors\"", ")", "else", "[", "]", "for", "arg_5", "in", "itertools", ".", "chain", "(", "[", "arg_0", "]", ",", "arg_4", ")", ":", "if", "(", "arg_5", ".", "name", "in", "(", "\"Exception\"", ",", "\"BaseException\"", ")", "and", "arg_5", ".", "root", "(", ")", ".", "name", "==", "EXCEPTIONS_MODULE", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0: arg_1.node_classes.NodeNG) -> bool:\n    \"\"\"\n    Return true if the given class node is subclass of\n    exceptions.Exception.\n    \"\"\"\n    arg_4 = arg_0.ancestors() if hasattr(arg_0, \"ancestors\") else []\n    for arg_5 in itertools.chain([arg_0], arg_4):\n        if (\n            arg_5.name in (\"Exception\", \"BaseException\")\n            and arg_5.root().name == EXCEPTIONS_MODULE\n        ):\n            return True\n    return False", "path": "pylint/checkers/utils.py", "identifier": "inherit_from_std_ex", "docstring": "Return true if the given class node is subclass of\n    exceptions.Exception.", "docstring_tokens": ["Return", "true", "if", "the", "given", "class", "node", "is", "subclass", "of", "exceptions", ".", "Exception", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255472}
{"url": "https://github.com/Rikanishu/static-bundle/blob/2f6458cb9d9d9049b4fd829f7d6951a45d547c68/static_bundle/builders.py#L76-L91", "sha": "2f6458cb9d9d9049b4fd829f7d6951a45d547c68", "docstring_summary": "Asset minifier\n        Uses default minifier in bundle if it's not defined", "language": "python", "parameters": "(self)", "return_statement": "return minifier", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "minifier", "is", "None", ":", "if", "not", "arg_0", ".", "has_bundles", "(", ")", ":", "raise", "Exception", "(", "\"Unable to get default minifier, no bundles in build group\"", ")", "arg_1", "=", "arg_0", ".", "get_first_bundle", "(", ")", ".", "get_default_minifier", "(", ")", "else", ":", "arg_1", "=", "arg_0", ".", "minifier", "if", "arg_1", ":", "arg_1", ".", "init_asset", "(", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Asset minifier\n        Uses default minifier in bundle if it's not defined\n\n        :rtype: static_bundle.minifiers.DefaultMinifier|None\n        \"\"\"\n        if arg_0.minifier is None:\n            if not arg_0.has_bundles():\n                raise Exception(\"Unable to get default minifier, no bundles in build group\")\n            arg_1 = arg_0.get_first_bundle().get_default_minifier()\n        else:\n            arg_1 = arg_0.minifier\n        if arg_1:\n            arg_1.init_asset(arg_0)\n        return arg_1", "path": "static_bundle/builders.py", "identifier": "Asset.get_minifier", "docstring": "Asset minifier\n        Uses default minifier in bundle if it's not defined\n\n        :rtype: static_bundle.minifiers.DefaultMinifier|None", "docstring_tokens": ["Asset", "minifier", "Uses", "default", "minifier", "in", "bundle", "if", "it", "s", "not", "defined"], "nwo": "Rikanishu/static-bundle", "score": 0.0, "idx": 255473}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/contrib/deepmind_lab.py#L102-L110", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Resets the environment to its initialization state. This method needs to be called to start a\n        new episode after the last episode ended.", "language": "python", "parameters": "(self)", "return_statement": "return self.level.observations()[self.state_attribute]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "level", ".", "Func", "(", ")", "return", "arg_0", ".", "level", ".", "observations", "(", ")", "[", "arg_0", ".", "state_attribute", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Resets the environment to its initialization state. This method needs to be called to start a\n        new episode after the last episode ended.\n\n        :return: initial state\n        \"\"\"\n        arg_0.level.Func()  # optional: episode=-1, seed=None\n        return arg_0.level.observations()[arg_0.state_attribute]", "path": "tensorforce/contrib/deepmind_lab.py", "identifier": "DeepMindLab.reset", "docstring": "Resets the environment to its initialization state. This method needs to be called to start a\n        new episode after the last episode ended.\n\n        :return: initial state", "docstring_tokens": ["Resets", "the", "environment", "to", "its", "initialization", "state", ".", "This", "method", "needs", "to", "be", "called", "to", "start", "a", "new", "episode", "after", "the", "last", "episode", "ended", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 255474}
{"url": "https://github.com/bindlock/vklancer/blob/10151c3856bc6f46a1f446ae4d605d46aace3669/vklancer/api.py#L41-L53", "sha": "10151c3856bc6f46a1f446ae4d605d46aace3669", "docstring_summary": "Send request to API.", "language": "python", "parameters": "(self, method, **kwargs)", "return_statement": "return requests.get(self.get_url(method, **kwargs)).json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", ".", "setdefault", "(", "'v'", ",", "arg_0", ".", "__version", ")", "if", "arg_0", ".", "__token", "is", "not", "None", ":", "arg_2", ".", "setdefault", "(", "'access_token'", ",", "arg_0", ".", "__token", ")", "return", "Funcs", ".", "get", "(", "arg_0", ".", "get_url", "(", "arg_1", ",", "**", "arg_2", ")", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Send Func to API.\n\n        :param method: `str` method name.\n        :returns: `dict` response.\n        \"\"\"\n        arg_2.setdefault('v', arg_0.__version)\n\n        if arg_0.__token is not None:\n            arg_2.setdefault('access_token', arg_0.__token)\n\n        return Funcs.get(arg_0.get_url(arg_1, **arg_2)).json()", "path": "vklancer/api.py", "identifier": "API.request", "docstring": "Send request to API.\n\n        :param method: `str` method name.\n        :returns: `dict` response.", "docstring_tokens": ["Send", "request", "to", "API", "."], "nwo": "bindlock/vklancer", "score": 0.2833735936894608, "idx": 255475}
{"url": "https://github.com/nyaruka/python-librato-bg/blob/e541092838694de31d256becea8391a9cfe086c7/librato_bg/consumer.py#L23-L31", "sha": "e541092838694de31d256becea8391a9cfe086c7", "docstring_summary": "Runs the consumer.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "'consumer is Funcning...'", ")", "arg_0", ".", "Funcning", "=", "True", "while", "arg_0", ".", "Funcning", ":", "arg_0", ".", "upload", "(", ")", "arg_0", ".", "log", ".", "debug", "(", "'consumer exited.'", ")"], "function": "def Func(arg_0):\n        \"\"\"Runs the consumer.\"\"\"\n        arg_0.log.debug('consumer is Funcning...')\n\n        arg_0.Funcning = True\n        while arg_0.Funcning:\n            arg_0.upload()\n\n        arg_0.log.debug('consumer exited.')", "path": "librato_bg/consumer.py", "identifier": "Consumer.run", "docstring": "Runs the consumer.", "docstring_tokens": ["Runs", "the", "consumer", "."], "nwo": "nyaruka/python-librato-bg", "score": 0.0, "idx": 255476}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L766-L775", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Delete admin from group.", "language": "python", "parameters": "(cls, group, admin)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "arg_3", "=", "arg_0", ".", "query", ".", "filter", "(", "arg_0", ".", "admin", "==", "arg_2", ",", "arg_0", ".", "group", "==", "arg_1", ")", ".", "one", "(", ")", "db", ".", "session", ".", "Func", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Delete admin from group.\n\n        :param group: Group object.\n        :param admin: Admin object.\n        \"\"\"\n        with db.session.begin_nested():\n            arg_3 = arg_0.query.filter(\n                arg_0.admin == arg_2, arg_0.group == arg_1).one()\n            db.session.Func(arg_3)", "path": "invenio_groups/models.py", "identifier": "GroupAdmin.delete", "docstring": "Delete admin from group.\n\n        :param group: Group object.\n        :param admin: Admin object.", "docstring_tokens": ["Delete", "admin", "from", "group", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 255477}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/multisig/api.py#L61-L102", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Generates one or more key digests from the seed.", "language": "python", "parameters": "(\n            self,\n            index=0,\n            count=1,\n            security_level=AddressGenerator.DEFAULT_SECURITY_LEVEL,\n    )", "return_statement": "return commands.GetDigestsCommand(self.adapter)(\n            seed=self.seed,\n            index=index,\n            count=count,\n            securityLevel=security_level,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "1", ",", "arg_3", "=", "arg_4", ".", "DEFAULT_SECURITY_LEVEL", ",", ")", ":", "return", "commands", ".", "GetDigestsCommand", "(", "arg_0", ".", "adapter", ")", "(", "seed", "=", "arg_0", ".", "seed", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "securityLevel", "=", "arg_3", ",", ")"], "function": "def Func(\n            arg_0,\n            arg_1=0,\n            arg_2=1,\n            arg_3=arg_4.DEFAULT_SECURITY_LEVEL,\n    ):\n        # type: (int, int, int) -> dict\n        \"\"\"\n        Generates one or more key digests from the seed.\n\n        Digests are safe to share; use them to generate multisig\n        addresses.\n\n        :param index:\n            The starting key index.\n\n        :param count:\n            Number of digests to generate.\n\n        :param security_level:\n            Number of iterations to use when generating new addresses.\n\n            Larger values take longer, but the resulting signatures are\n            more secure.\n\n            This value must be between 1 and 3, inclusive.\n\n        :return:\n            Dict with the following items::\n\n                {\n                    'digests': List[Digest],\n                        Always contains a list, even if only one digest\n                        was generated.\n                }\n        \"\"\"\n        return commands.GetDigestsCommand(arg_0.adapter)(\n            seed=arg_0.seed,\n            arg_1=arg_1,\n            arg_2=arg_2,\n            securityLevel=arg_3,\n        )", "path": "iota/multisig/api.py", "identifier": "MultisigIota.get_digests", "docstring": "Generates one or more key digests from the seed.\n\n        Digests are safe to share; use them to generate multisig\n        addresses.\n\n        :param index:\n            The starting key index.\n\n        :param count:\n            Number of digests to generate.\n\n        :param security_level:\n            Number of iterations to use when generating new addresses.\n\n            Larger values take longer, but the resulting signatures are\n            more secure.\n\n            This value must be between 1 and 3, inclusive.\n\n        :return:\n            Dict with the following items::\n\n                {\n                    'digests': List[Digest],\n                        Always contains a list, even if only one digest\n                        was generated.\n                }", "docstring_tokens": ["Generates", "one", "or", "more", "key", "digests", "from", "the", "seed", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 255478}
{"url": "https://github.com/NateFerrero/oauth2lib/blob/d161b010f8a596826050a09e5e94d59443cc12d9/oauth2lib/client.py#L62-L80", "sha": "d161b010f8a596826050a09e5e94d59443cc12d9", "docstring_summary": "Get an access token from the provider token URI.", "language": "python", "parameters": "(self, code, **params)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", "[", "'code'", "]", "=", "arg_1", "if", "'grant_type'", "not", "in", "arg_2", ":", "arg_2", "[", "'grant_type'", "]", "=", "arg_0", ".", "default_grant_type", "arg_2", ".", "update", "(", "{", "'client_id'", ":", "arg_0", ".", "client_id", ",", "'client_secret'", ":", "arg_0", ".", "client_secret", ",", "'redirect_uri'", ":", "arg_0", ".", "redirect_uri", "}", ")", "arg_3", "=", "arg_0", ".", "http_post", "(", "arg_0", ".", "token_uri", ",", "arg_2", ")", "try", ":", "return", "arg_3", ".", "json", "(", ")", "except", "TypeError", ":", "return", "arg_3", ".", "json"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Get an access token from the provider token URI.\n\n        :param code: Authorization code.\n        :type code: str\n        :return: Dict containing access token, refresh token, etc.\n        :rtype: dict\n        \"\"\"\n        arg_2['code'] = arg_1\n        if 'grant_type' not in arg_2:\n            arg_2['grant_type'] = arg_0.default_grant_type\n        arg_2.update({'client_id': arg_0.client_id,\n                       'client_secret': arg_0.client_secret,\n                       'redirect_uri': arg_0.redirect_uri})\n        arg_3 = arg_0.http_post(arg_0.token_uri, arg_2)\n        try:\n            return arg_3.json()\n        except TypeError:\n            return arg_3.json", "path": "oauth2lib/client.py", "identifier": "Client.get_token", "docstring": "Get an access token from the provider token URI.\n\n        :param code: Authorization code.\n        :type code: str\n        :return: Dict containing access token, refresh token, etc.\n        :rtype: dict", "docstring_tokens": ["Get", "an", "access", "token", "from", "the", "provider", "token", "URI", "."], "nwo": "NateFerrero/oauth2lib", "score": 0.29100924573231046, "idx": 255479}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/operators/check_operator.py#L98-L110", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "A small helper function to convert a string to a numeric value\n    if appropriate", "language": "python", "parameters": "(s)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "float", "(", "arg_0", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "arg_1", "=", "arg_0", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    A small helper function to convert a string to a numeric value\n    if appropriate\n\n    :param s: the string to be converted\n    :type s: str\n    \"\"\"\n    try:\n        arg_1 = float(arg_0)\n    except (ValueError, TypeError):\n        arg_1 = arg_0\n    return arg_1", "path": "airflow/operators/check_operator.py", "identifier": "_convert_to_float_if_possible", "docstring": "A small helper function to convert a string to a numeric value\n    if appropriate\n\n    :param s: the string to be converted\n    :type s: str", "docstring_tokens": ["A", "small", "helper", "function", "to", "convert", "a", "string", "to", "a", "numeric", "value", "if", "appropriate"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255480}
{"url": "https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L1056-L1078", "sha": "0dc47c8924fa3d9ab676c3a6e195f03f728b72c6", "docstring_summary": "Assert that for all items in the iterable, they're in order based on comp", "language": "python", "parameters": "(iterable, key=lambda x: x, comp=operator.le)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "lambda", "arg_2", ":", "arg_2", ",", "arg_3", "=", "arg_4", ".", "le", ")", ":", "arg_6", "=", "(", "\"{pair[0]} > {pair[1]}\"", "if", "arg_3", "is", "arg_4", ".", "le", "else", "\"{pair[0]} < {pair[1]}\"", "if", "arg_3", "is", "arg_4", ".", "ge", "else", "\"not {comp} {pair}\"", ")", "for", "arg_7", "in", "more_itertools", ".", "pairwise", "(", "arg_0", ")", ":", "arg_8", "=", "tuple", "(", "map", "(", "arg_1", ",", "arg_7", ")", ")", "assert", "arg_3", "(", "*", "arg_8", ")", ",", "arg_6", ".", "format", "(", "**", "locals", "(", ")", ")", "yield", "arg_7", "[", "0", "]", "yield", "arg_7", "[", "1", "]"], "function": "def Func(arg_0, arg_1=lambda arg_2: arg_2, arg_3=arg_4.le):\n\t\"\"\"\n\tAssert that for all items in the iterable, they're in order based on comp\n\n\t>>> list(Func(range(5)))\n\t[0, 1, 2, 3, 4]\n\t>>> list(Func(range(5), comp=operator.ge))\n\tTraceback (most recent call last):\n\t...\n\tAssertionError: 0 < 1\n\t>>> list(Func(range(5, 0, -1), key=operator.neg))\n\t[5, 4, 3, 2, 1]\n\t\"\"\"\n\targ_6 = (\n\t\t\"{pair[0]} > {pair[1]}\" if arg_3 is arg_4.le else\n\t\t\"{pair[0]} < {pair[1]}\" if arg_3 is arg_4.ge else\n\t\t\"not {comp} {pair}\"\n\t)\n\tfor arg_7 in more_itertools.pairwise(arg_0):\n\t\targ_8 = tuple(map(arg_1, arg_7))\n\t\tassert arg_3(*arg_8), arg_6.format(**locals())\n\t\tyield arg_7[0]\n\tyield arg_7[1]", "path": "jaraco/itertools.py", "identifier": "assert_ordered", "docstring": "Assert that for all items in the iterable, they're in order based on comp\n\n\t>>> list(assert_ordered(range(5)))\n\t[0, 1, 2, 3, 4]\n\t>>> list(assert_ordered(range(5), comp=operator.ge))\n\tTraceback (most recent call last):\n\t...\n\tAssertionError: 0 < 1\n\t>>> list(assert_ordered(range(5, 0, -1), key=operator.neg))\n\t[5, 4, 3, 2, 1]", "docstring_tokens": ["Assert", "that", "for", "all", "items", "in", "the", "iterable", "they", "re", "in", "order", "based", "on", "comp"], "nwo": "jaraco/jaraco.itertools", "score": 0.2751458370028208, "idx": 255481}
{"url": "https://github.com/mfcovington/django-project-home-templatetags/blob/abc660906086088792c5e5e7be6ecd151c2ccddb/project_home_tags/templatetags/project_home.py#L39-L62", "sha": "abc660906086088792c5e5e7be6ecd151c2ccddb", "docstring_summary": "Decorator to silence template tags if 'PROJECT_HOME_NAMESPACE' is\n    not defined in settings.", "language": "python", "parameters": "(f)", "return_statement": "return wrapped", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapped", "(", "arg_1", "=", "None", ")", ":", "if", "not", "home_namespace", ":", "return", "''", "if", "arg_1", ":", "return", "arg_0", "(", "arg_1", ")", "else", ":", "return", "arg_0", "(", "home_label", ")", "return", "wrapped"], "function": "def Func(arg_0):\n    \"\"\"Decorator to silence template tags if 'PROJECT_HOME_NAMESPACE' is\n    not defined in settings.\n\n    Usage Example:\n        from django import template\n\n\n        register = template.Library()\n\n        @register.simple_tag\n        @Func\n        def a_template_tag(*args):\n            ...\n    \"\"\"\n    @wraps(arg_0)\n    def wrapped(arg_1=None):\n        if not home_namespace:\n            return ''\n        if arg_1:\n            return arg_0(arg_1)\n        else:\n            return arg_0(home_label)\n    return wrapped", "path": "project_home_tags/templatetags/project_home.py", "identifier": "silence_without_namespace", "docstring": "Decorator to silence template tags if 'PROJECT_HOME_NAMESPACE' is\n    not defined in settings.\n\n    Usage Example:\n        from django import template\n\n\n        register = template.Library()\n\n        @register.simple_tag\n        @silence_without_namespace\n        def a_template_tag(*args):\n            ...", "docstring_tokens": ["Decorator", "to", "silence", "template", "tags", "if", "PROJECT_HOME_NAMESPACE", "is", "not", "defined", "in", "settings", "."], "nwo": "mfcovington/django-project-home-templatetags", "score": 0.138843686048881, "idx": 255482}
{"url": "https://github.com/frascoweb/easywebassets/blob/02f84376067c827c84fc1773895bb2784e033949/easywebassets/package.py#L194-L198", "sha": "02f84376067c827c84fc1773895bb2784e033949", "docstring_summary": "Returns urls needed to include all assets of asset_type", "language": "python", "parameters": "(self, asset_type, *args, **kwargs)", "return_statement": "return self.urls_for_depends(asset_type, *args, **kwargs) + \\\n               self.urls_for_self(asset_type, *args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "Func_depends", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "+", "arg_0", ".", "Func_self", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Returns urls needed to include all assets of asset_type\n        \"\"\"\n        return arg_0.Func_depends(arg_1, *arg_2, **arg_3) + \\\n               arg_0.Func_self(arg_1, *arg_2, **arg_3)", "path": "easywebassets/package.py", "identifier": "Package.urls_for", "docstring": "Returns urls needed to include all assets of asset_type", "docstring_tokens": ["Returns", "urls", "needed", "to", "include", "all", "assets", "of", "asset_type"], "nwo": "frascoweb/easywebassets", "score": 0.09252797783733271, "idx": 255483}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/optics/base.py#L152-L172", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Returns the focus within `state`. If multiple items are\n        focused then it will attempt to join them together as a monoid.\n        See `lenses.typeclass.mappend`.", "language": "python", "parameters": "(self, state)", "return_statement": "return cast(B, result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_is_kind", "(", "Fold", ")", ":", "raise", "TypeError", "(", "'Must be an instance of Fold to .Func()'", ")", "arg_2", "=", "object", "(", ")", "arg_3", "=", "arg_0", ".", "preFunc", "(", "arg_1", ")", ".", "maybe", "(", "arg_2", ")", "if", "arg_3", "is", "arg_2", ":", "raise", "ValueError", "(", "'No focus to Func'", ")", "return", "cast", "(", "B", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        # type: (S) -> B\n        '''Returns the focus within `state`. If multiple items are\n        focused then it will attempt to join them together as a monoid.\n        See `lenses.typeclass.mappend`.\n\n        Requires kind Fold. This method will raise TypeError if the\n        optic has no way to get any foci.\n\n        For technical reasons, this method requires there to be at least\n        one foci at the end of the Func. It will raise ValueError when\n        there is none.\n        '''\n        if not arg_0._is_kind(Fold):\n            raise TypeError('Must be an instance of Fold to .Func()')\n\n        arg_2 = object()\n        arg_3 = arg_0.preFunc(arg_1).maybe(arg_2)\n        if arg_3 is arg_2:\n            raise ValueError('No focus to Func')\n        return cast(B, arg_3)", "path": "lenses/optics/base.py", "identifier": "LensLike.view", "docstring": "Returns the focus within `state`. If multiple items are\n        focused then it will attempt to join them together as a monoid.\n        See `lenses.typeclass.mappend`.\n\n        Requires kind Fold. This method will raise TypeError if the\n        optic has no way to get any foci.\n\n        For technical reasons, this method requires there to be at least\n        one foci at the end of the view. It will raise ValueError when\n        there is none.", "docstring_tokens": ["Returns", "the", "focus", "within", "state", ".", "If", "multiple", "items", "are", "focused", "then", "it", "will", "attempt", "to", "join", "them", "together", "as", "a", "monoid", ".", "See", "lenses", ".", "typeclass", ".", "mappend", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 255484}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/utils/progress.py#L83-L97", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Formats elapsed seconds into a human readable format.", "language": "python", "parameters": "(elapsed)", "return_statement": "return rval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "int", "(", "arg_0", "/", "(", "60", "*", "60", ")", ")", "arg_2", "=", "int", "(", "(", "arg_0", "%", "(", "60", "*", "60", ")", ")", "/", "60", ")", "arg_3", "=", "int", "(", "arg_0", "%", "60", ")", "arg_4", "=", "\"\"", "if", "arg_1", ":", "arg_4", "+=", "\"{0}h\"", ".", "format", "(", "arg_1", ")", "if", "arg_0", ">", "60", ":", "arg_4", "+=", "\"{0}m\"", ".", "format", "(", "arg_2", ")", "arg_4", "+=", "\"{0}s\"", ".", "format", "(", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Formats elapsed seconds into a human readable format.\"\"\"\n    arg_1 = int(arg_0 / (60 * 60))\n    arg_2 = int((arg_0 % (60 * 60)) / 60)\n    arg_3 = int(arg_0 % 60)\n\n    arg_4 = \"\"\n    if arg_1:\n        arg_4 += \"{0}h\".format(arg_1)\n\n    if arg_0 > 60:\n        arg_4 += \"{0}m\".format(arg_2)\n\n    arg_4 += \"{0}s\".format(arg_3)\n    return arg_4", "path": "src/streamlink_cli/utils/progress.py", "identifier": "format_time", "docstring": "Formats elapsed seconds into a human readable format.", "docstring_tokens": ["Formats", "elapsed", "seconds", "into", "a", "human", "readable", "format", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 255485}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L455-L549", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Sort an array along its rows or columns.", "language": "python", "parameters": "(S, axis=-1, index=False, value=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "-", "1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "np", ".", "argmax", "if", "arg_0", ".", "ndim", "!=", "2", ":", "raise", "ParameterError", "(", "'Func is only defined for 2D arrays'", ")", "arg_4", "=", "arg_3", "(", "arg_0", ",", "arg_1", "=", "np", ".", "mod", "(", "1", "-", "arg_1", ",", "arg_0", ".", "ndim", ")", ")", "arg_5", "=", "np", ".", "argsort", "(", "arg_4", ")", "arg_6", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "arg_6", "[", "arg_1", "]", "=", "arg_5", "if", "arg_2", ":", "return", "arg_0", "[", "tuple", "(", "arg_6", ")", "]", ",", "arg_5", "else", ":", "return", "arg_0", "[", "tuple", "(", "arg_6", ")", "]"], "function": "def Func(arg_0, arg_1=-1, arg_2=False, arg_3=None):\n    '''Sort an array along its rows or columns.\n\n    Examples\n    --------\n    Visualize NMF output for a spectrogram S\n\n    >>> # Sort the columns of W by peak frequency bin\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> S = np.abs(librosa.stft(y))\n    >>> W, H = librosa.decompose.decompose(S, n_components=32)\n    >>> W_sort = librosa.util.Func(W)\n\n    Or sort by the lowest frequency bin\n\n    >>> W_sort = librosa.util.Func(W, value=np.argmin)\n\n    Or sort the rows instead of the columns\n\n    >>> W_sort_rows = librosa.util.Func(W, axis=0)\n\n    Get the sorting index also, and use it to permute the rows of H\n\n    >>> W_sort, idx = librosa.util.Func(W, index=True)\n    >>> H_sort = H[idx, :]\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> plt.subplot(2, 2, 1)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(W, ref=np.max),\n    ...                          y_axis='log')\n    >>> plt.title('W')\n    >>> plt.subplot(2, 2, 2)\n    >>> librosa.display.specshow(H, x_axis='time')\n    >>> plt.title('H')\n    >>> plt.subplot(2, 2, 3)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(W_sort,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log')\n    >>> plt.title('W sorted')\n    >>> plt.subplot(2, 2, 4)\n    >>> librosa.display.specshow(H_sort, x_axis='time')\n    >>> plt.title('H sorted')\n    >>> plt.tight_layout()\n\n\n    Parameters\n    ----------\n    S : np.ndarray [shape=(d, n)]\n        Array to be sorted\n\n    axis : int [scalar]\n        The axis along which to compute the sorting values\n\n        - `axis=0` to sort rows by peak column index\n        - `axis=1` to sort columns by peak row index\n\n    index : boolean [scalar]\n        If true, returns the index array as well as the permuted data.\n\n    value : function\n        function to return the index corresponding to the sort order.\n        Default: `np.argmax`.\n\n    Returns\n    -------\n    S_sort : np.ndarray [shape=(d, n)]\n        `S` with the columns or rows permuted in sorting order\n\n    idx : np.ndarray (optional) [shape=(d,) or (n,)]\n        If `index == True`, the sorting index used to permute `S`.\n        Length of `idx` corresponds to the selected `axis`.\n\n    Raises\n    ------\n    ParameterError\n        If `S` does not have exactly 2 dimensions (`S.ndim != 2`)\n    '''\n\n    if arg_3 is None:\n        arg_3 = np.argmax\n\n    if arg_0.ndim != 2:\n        raise ParameterError('Func is only defined for 2D arrays')\n\n    arg_4 = arg_3(arg_0, arg_1=np.mod(1-arg_1, arg_0.ndim))\n    arg_5 = np.argsort(arg_4)\n\n    arg_6 = [slice(None)] * arg_0.ndim\n    arg_6[arg_1] = arg_5\n\n    if arg_2:\n        return arg_0[tuple(arg_6)], arg_5\n    else:\n        return arg_0[tuple(arg_6)]", "path": "librosa/util/utils.py", "identifier": "axis_sort", "docstring": "Sort an array along its rows or columns.\n\n    Examples\n    --------\n    Visualize NMF output for a spectrogram S\n\n    >>> # Sort the columns of W by peak frequency bin\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> S = np.abs(librosa.stft(y))\n    >>> W, H = librosa.decompose.decompose(S, n_components=32)\n    >>> W_sort = librosa.util.axis_sort(W)\n\n    Or sort by the lowest frequency bin\n\n    >>> W_sort = librosa.util.axis_sort(W, value=np.argmin)\n\n    Or sort the rows instead of the columns\n\n    >>> W_sort_rows = librosa.util.axis_sort(W, axis=0)\n\n    Get the sorting index also, and use it to permute the rows of H\n\n    >>> W_sort, idx = librosa.util.axis_sort(W, index=True)\n    >>> H_sort = H[idx, :]\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> plt.subplot(2, 2, 1)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(W, ref=np.max),\n    ...                          y_axis='log')\n    >>> plt.title('W')\n    >>> plt.subplot(2, 2, 2)\n    >>> librosa.display.specshow(H, x_axis='time')\n    >>> plt.title('H')\n    >>> plt.subplot(2, 2, 3)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(W_sort,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log')\n    >>> plt.title('W sorted')\n    >>> plt.subplot(2, 2, 4)\n    >>> librosa.display.specshow(H_sort, x_axis='time')\n    >>> plt.title('H sorted')\n    >>> plt.tight_layout()\n\n\n    Parameters\n    ----------\n    S : np.ndarray [shape=(d, n)]\n        Array to be sorted\n\n    axis : int [scalar]\n        The axis along which to compute the sorting values\n\n        - `axis=0` to sort rows by peak column index\n        - `axis=1` to sort columns by peak row index\n\n    index : boolean [scalar]\n        If true, returns the index array as well as the permuted data.\n\n    value : function\n        function to return the index corresponding to the sort order.\n        Default: `np.argmax`.\n\n    Returns\n    -------\n    S_sort : np.ndarray [shape=(d, n)]\n        `S` with the columns or rows permuted in sorting order\n\n    idx : np.ndarray (optional) [shape=(d,) or (n,)]\n        If `index == True`, the sorting index used to permute `S`.\n        Length of `idx` corresponds to the selected `axis`.\n\n    Raises\n    ------\n    ParameterError\n        If `S` does not have exactly 2 dimensions (`S.ndim != 2`)", "docstring_tokens": ["Sort", "an", "array", "along", "its", "rows", "or", "columns", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 255486}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/helpers.py#L13-L24", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Return a valid zero cutoff value.", "language": "python", "parameters": "(model, zero_cutoff=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "return", "arg_0", ".", "tolerance", "else", ":", "if", "arg_1", "<", "arg_0", ".", "tolerance", ":", "raise", "ValueError", "(", "\"The chosen zero cutoff cannot be less than the model's \"", "\"tolerance value.\"", ")", "else", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Return a valid zero cutoff value.\"\"\"\n    if arg_1 is None:\n        return arg_0.tolerance\n    else:\n        if arg_1 < arg_0.tolerance:\n            raise ValueError(\n                \"The chosen zero cutoff cannot be less than the model's \"\n                \"tolerance value.\"\n            )\n        else:\n            return arg_1", "path": "cobra/flux_analysis/helpers.py", "identifier": "normalize_cutoff", "docstring": "Return a valid zero cutoff value.", "docstring_tokens": ["Return", "a", "valid", "zero", "cutoff", "value", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255487}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L166-L178", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Process data to produce velocity and dropout information.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "visibility", "=", "arg_0", ".", "data", "[", ":", ",", ":", ",", "3", "]", "arg_0", ".", "positions", "=", "arg_0", ".", "data", "[", ":", ",", ":", ",", ":", "3", "]", "arg_0", ".", "velocities", "=", "np", ".", "zeros_like", "(", "arg_0", ".", "positions", ")", "+", "1000", "for", "arg_4", "in", "range", "(", "1", ",", "len", "(", "arg_0", ".", "data", ")", "-", "1", ")", ":", "arg_5", "=", "arg_0", ".", "data", "[", "arg_4", "-", "1", "]", "arg_6", "=", "arg_0", ".", "data", "[", "arg_4", "+", "1", "]", "for", "arg_7", "in", "range", "(", "arg_0", ".", "num_markers", ")", ":", "if", "-", "1", "<", "arg_5", "[", "arg_7", ",", "3", "]", "<", "100", "and", "-", "1", "<", "arg_6", "[", "arg_7", ",", "3", "]", "<", "100", ":", "arg_0", ".", "velocities", "[", "arg_4", ",", "arg_7", "]", "=", "(", "arg_6", "[", "arg_7", ",", ":", "3", "]", "-", "arg_5", "[", "arg_7", ",", ":", "3", "]", ")", "/", "(", "2", "*", "arg_0", ".", "world", ".", "dt", ")", "arg_0", ".", "cfms", "=", "np", ".", "zeros_like", "(", "arg_0", ".", "visibility", ")", "+", "arg_0", ".", "DEFAULT_CFM"], "function": "def Func(arg_0):\n        '''Process data to produce velocity and dropout information.'''\n        arg_0.visibility = arg_0.data[:, :, 3]\n        arg_0.positions = arg_0.data[:, :, :3]\n        arg_0.velocities = np.zeros_like(arg_0.positions) + 1000\n        for arg_4 in range(1, len(arg_0.data) - 1):\n            arg_5 = arg_0.data[arg_4 - 1]\n            arg_6 = arg_0.data[arg_4 + 1]\n            for arg_7 in range(arg_0.num_markers):\n                if -1 < arg_5[arg_7, 3] < 100 and -1 < arg_6[arg_7, 3] < 100:\n                    arg_0.velocities[arg_4, arg_7] = (\n                        arg_6[arg_7, :3] - arg_5[arg_7, :3]) / (2 * arg_0.world.dt)\n        arg_0.cfms = np.zeros_like(arg_0.visibility) + arg_0.DEFAULT_CFM", "path": "pagoda/cooper.py", "identifier": "Markers.process_data", "docstring": "Process data to produce velocity and dropout information.", "docstring_tokens": ["Process", "data", "to", "produce", "velocity", "and", "dropout", "information", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 255488}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/read.py#L122-L143", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Read a Nifti file and return as nipy.Image", "language": "python", "parameters": "(nii_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "nipy", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "raise", "FileNotFound", "(", "arg_0", ")", "try", ":", "return", "nipy", ".", "load_image", "(", "arg_0", ")", "except", "Exception", "as", "exc", ":", "raise", "Exception", "(", "'Reading file {0}.'", ".", "format", "(", "repr_imgs", "(", "arg_0", ")", ")", ")", "from", "exc"], "function": "def Func(arg_0):\n    \"\"\"Read a Nifti file and return as nipy.Image\n\n    Parameters\n    ----------\n    param nii_file: str\n        Nifti file path\n\n    Returns\n    -------\n    nipy.Image\n    \"\"\"\n    # delayed import because could not install nipy on Python 3 on OSX\n    import nipy\n\n    if not os.path.exists(arg_0):\n        raise FileNotFound(arg_0)\n\n    try:\n        return nipy.load_image(arg_0)\n    except Exception as exc:\n        raise Exception('Reading file {0}.'.format(repr_imgs(arg_0))) from exc", "path": "boyle/nifti/read.py", "identifier": "load_nipy_img", "docstring": "Read a Nifti file and return as nipy.Image\n\n    Parameters\n    ----------\n    param nii_file: str\n        Nifti file path\n\n    Returns\n    -------\n    nipy.Image", "docstring_tokens": ["Read", "a", "Nifti", "file", "and", "return", "as", "nipy", ".", "Image"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255489}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/provider.py#L321-L328", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Disconnect any connected devices that have any of the specified\n        service UUIDs.", "language": "python", "parameters": "(self, service_uuids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "map", "(", "uuid_to_cbuuid", ",", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "_central_manager", ".", "retrieveConnectedPeripheralsWithServices_", "(", "arg_2", ")", ":", "arg_0", ".", "_central_manager", ".", "cancelPeripheralConnection_", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Disconnect any connected devices that have any of the specified\n        service UUIDs.\n        \"\"\"\n        # Get list of connected devices with specified services.\n        arg_2 = map(uuid_to_cbuuid, arg_1)\n        for arg_3 in arg_0._central_manager.retrieveConnectedPeripheralsWithServices_(arg_2):\n            arg_0._central_manager.cancelPeripheralConnection_(arg_3)", "path": "Adafruit_BluefruitLE/corebluetooth/provider.py", "identifier": "CoreBluetoothProvider.disconnect_devices", "docstring": "Disconnect any connected devices that have any of the specified\n        service UUIDs.", "docstring_tokens": ["Disconnect", "any", "connected", "devices", "that", "have", "any", "of", "the", "specified", "service", "UUIDs", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 255490}
{"url": "https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/fields.py#L25-L32", "sha": "5baf7f2e145045942ee8dcaccbc47f8f821fcb56", "docstring_summary": "Returns list of strings split by input delimeter", "language": "python", "parameters": "(self, line)", "return_statement": "return [x for x in re.split(self.delimiter, line.rstrip()) if x != '']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "return", "[", "arg_2", "for", "arg_2", "in", "re", ".", "split", "(", "arg_0", ".", "delimiter", ",", "Func", ".", "rstrip", "(", ")", ")", "if", "arg_2", "!=", "''", "]"], "function": "def Func(arg_0, Func):\n        \"\"\"Returns list of strings split by input delimeter\n\n        Argument:\n        line - Input line to cut\n        \"\"\"\n        # Remove empty strings in case of multiple instances of delimiter\n        return [arg_2 for arg_2 in re.split(arg_0.delimiter, Func.rstrip()) if arg_2 != '']", "path": "cuts/fields.py", "identifier": "FieldCutter.line", "docstring": "Returns list of strings split by input delimeter\n\n        Argument:\n        line - Input line to cut", "docstring_tokens": ["Returns", "list", "of", "strings", "split", "by", "input", "delimeter"], "nwo": "jpweiser/cuts", "score": 0.09252797783733271, "idx": 255491}
{"url": "https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/smush.py#L63-L69", "sha": "dfb60fa1e30ae7cfec2526bb101fc205f5952639", "docstring_summary": "Yield the sources that are present.", "language": "python", "parameters": "(sources)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ":", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_2", ")", "+", "'.py'", "if", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "yield", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Yield the sources that are present.\"\"\"\n    for arg_1, arg_2 in arg_0:\n        for arg_3 in arg_1:\n            arg_4 = os.path.join(arg_3, arg_2) + '.py'\n            if os.path.isfile(arg_4):\n                yield arg_4", "path": "yoconfigurator/smush.py", "identifier": "available_sources", "docstring": "Yield the sources that are present.", "docstring_tokens": ["Yield", "the", "sources", "that", "are", "present", "."], "nwo": "yola/yoconfigurator", "score": 0.5008169819389054, "idx": 255492}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/queues/queue_servers.py#L489-L540", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Fetches data from the queue.", "language": "python", "parameters": "(self, return_header=False)", "return_statement": "return dat", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "data", ".", "values", "(", ")", ":", "arg_2", ".", "extend", "(", "arg_3", ")", "arg_4", "=", "np", ".", "zeros", "(", "(", "len", "(", "arg_2", ")", ",", "6", ")", ")", "if", "len", "(", "arg_2", ")", ">", "0", ":", "arg_4", "[", ":", ",", ":", "5", "]", "=", "np", ".", "array", "(", "arg_2", ")", "arg_4", "[", ":", ",", "5", "]", "=", "arg_0", ".", "edge", "[", "2", "]", "arg_5", "=", "[", "(", "'a'", ",", "float", ")", ",", "(", "'s'", ",", "float", ")", ",", "(", "'d'", ",", "float", ")", ",", "(", "'q'", ",", "float", ")", ",", "(", "'n'", ",", "float", ")", ",", "(", "'id'", ",", "float", ")", "]", "arg_4", "=", "np", ".", "array", "(", "[", "tuple", "(", "arg_3", ")", "for", "arg_3", "in", "arg_4", "]", ",", "dtype", "=", "arg_5", ")", "arg_4", "=", "np", ".", "sort", "(", "arg_4", ",", "order", "=", "'a'", ")", "arg_4", "=", "np", ".", "array", "(", "[", "tuple", "(", "arg_3", ")", "for", "arg_3", "in", "arg_4", "]", ")", "if", "arg_1", ":", "return", "arg_4", ",", "'arrival,service,departure,num_queued,num_total,q_id'", "return", "arg_4"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Fetches data from the queue.\n\n        Parameters\n        ----------\n        return_header : bool (optonal, default: ``False``)\n            Determines whether the column headers are returned.\n\n        Returns\n        -------\n        data : :class:`~numpy.ndarray`\n            A six column :class:`~numpy.ndarray` of all the data. The\n            columns are:\n\n            * 1st: The arrival time of an agent.\n            * 2nd: The service start time of an agent.\n            * 3rd: The departure time of an agent.\n            * 4th: The length of the queue upon the agents arrival.\n            * 5th: The total number of :class:`Agents<.Agent>` in the\n              :class:`.QueueServer`.\n            * 6th: The :class:`QueueServer's<.QueueServer>` edge index.\n\n        headers : str (optional)\n            A comma seperated string of the column headers. Returns\n            ``'arrival,service,departure,num_queued,num_total,q_id'``\n        \"\"\"\n\n        arg_2 = []\n        for arg_3 in arg_0.data.values():\n            arg_2.extend(arg_3)\n\n        arg_4 = np.zeros((len(arg_2), 6))\n        if len(arg_2) > 0:\n            arg_4[:, :5] = np.array(arg_2)\n            arg_4[:, 5] = arg_0.edge[2]\n\n            arg_5 = [\n                ('a', float),\n                ('s', float),\n                ('d', float),\n                ('q', float),\n                ('n', float),\n                ('id', float)\n            ]\n            arg_4 = np.array([tuple(arg_3) for arg_3 in arg_4], dtype=arg_5)\n            arg_4 = np.sort(arg_4, order='a')\n            arg_4 = np.array([tuple(arg_3) for arg_3 in arg_4])\n\n        if arg_1:\n            return arg_4, 'arrival,service,departure,num_queued,num_total,q_id'\n\n        return arg_4", "path": "queueing_tool/queues/queue_servers.py", "identifier": "QueueServer.fetch_data", "docstring": "Fetches data from the queue.\n\n        Parameters\n        ----------\n        return_header : bool (optonal, default: ``False``)\n            Determines whether the column headers are returned.\n\n        Returns\n        -------\n        data : :class:`~numpy.ndarray`\n            A six column :class:`~numpy.ndarray` of all the data. The\n            columns are:\n\n            * 1st: The arrival time of an agent.\n            * 2nd: The service start time of an agent.\n            * 3rd: The departure time of an agent.\n            * 4th: The length of the queue upon the agents arrival.\n            * 5th: The total number of :class:`Agents<.Agent>` in the\n              :class:`.QueueServer`.\n            * 6th: The :class:`QueueServer's<.QueueServer>` edge index.\n\n        headers : str (optional)\n            A comma seperated string of the column headers. Returns\n            ``'arrival,service,departure,num_queued,num_total,q_id'``", "docstring_tokens": ["Fetches", "data", "from", "the", "queue", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 255493}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/definitions/pipeline.py#L302-L335", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Build a pipeline which is a subset of another pipeline.\n    Only includes the solids which are in solid_names.", "language": "python", "parameters": "(pipeline_def, solid_names)", "return_statement": "return PipelineDefinition(\n        name=pipeline_def.name,\n        solids=list({solid.definition for solid in solids}),\n        context_definitions=pipeline_def.context_definitions,\n        dependencies=deps,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check", ".", "inst_param", "(", "arg_0", ",", "'pipeline_def'", ",", "PipelineDefinition", ")", "check", ".", "list_param", "(", "arg_1", ",", "'solid_names'", ",", "of_type", "=", "str", ")", "arg_2", "=", "set", "(", "arg_1", ")", "arg_3", "=", "list", "(", "map", "(", "arg_0", ".", "solid_named", ",", "arg_1", ")", ")", "arg_4", "=", "{", "arg_8", "(", "arg_7", ")", ":", "{", "}", "for", "arg_7", "in", "arg_3", "}", "def", "_out_handle_of_inp", "(", "arg_5", ")", ":", "if", "arg_0", ".", "dependency_structure", ".", "has_dep", "(", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "dependency_structure", ".", "get_dep", "(", "arg_5", ")", "if", "arg_6", ".", "solid", ".", "name", "in", "arg_2", ":", "return", "arg_6", "return", "None", "for", "arg_7", "in", "arg_3", ":", "for", "arg_5", "in", "arg_7", ".", "input_handles", "(", ")", ":", "arg_6", "=", "_out_handle_of_inp", "(", "arg_5", ")", "if", "arg_6", ":", "arg_4", "[", "arg_8", "(", "arg_7", ")", "]", "[", "arg_5", ".", "input_def", ".", "name", "]", "=", "DependencyDefinition", "(", "arg_7", "=", "arg_6", ".", "solid", ".", "name", ",", "output", "=", "arg_6", ".", "output_def", ".", "name", ")", "return", "PipelineDefinition", "(", "arg_10", "=", "arg_0", ".", "name", ",", "arg_3", "=", "list", "(", "{", "arg_7", ".", "definition", "for", "arg_7", "in", "arg_3", "}", ")", ",", "context_definitions", "=", "arg_0", ".", "context_definitions", ",", "dependencies", "=", "arg_4", ",", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Build a pipeline which is a subset of another pipeline.\n    Only includes the solids which are in solid_names.\n    '''\n\n    check.inst_param(arg_0, 'pipeline_def', PipelineDefinition)\n    check.list_param(arg_1, 'solid_names', of_type=str)\n\n    arg_2 = set(arg_1)\n    arg_3 = list(map(arg_0.solid_named, arg_1))\n    arg_4 = {arg_8(arg_7): {} for arg_7 in arg_3}\n\n    def _out_handle_of_inp(arg_5):\n        if arg_0.dependency_structure.has_dep(arg_5):\n            arg_6 = arg_0.dependency_structure.get_dep(arg_5)\n            if arg_6.solid.name in arg_2:\n                return arg_6\n        return None\n\n    for arg_7 in arg_3:\n        for arg_5 in arg_7.input_handles():\n            arg_6 = _out_handle_of_inp(arg_5)\n            if arg_6:\n                arg_4[arg_8(arg_7)][arg_5.input_def.name] = DependencyDefinition(\n                    arg_7=arg_6.solid.name, output=arg_6.output_def.name\n                )\n\n    return PipelineDefinition(\n        arg_10=arg_0.name,\n        arg_3=list({arg_7.definition for arg_7 in arg_3}),\n        context_definitions=arg_0.context_definitions,\n        dependencies=arg_4,\n    )", "path": "python_modules/dagster/dagster/core/definitions/pipeline.py", "identifier": "_build_sub_pipeline", "docstring": "Build a pipeline which is a subset of another pipeline.\n    Only includes the solids which are in solid_names.", "docstring_tokens": ["Build", "a", "pipeline", "which", "is", "a", "subset", "of", "another", "pipeline", ".", "Only", "includes", "the", "solids", "which", "are", "in", "solid_names", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 255494}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L735-L777", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "workhorse for do_run_1", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "check_update_J", "(", ")", ":", "arg_0", ".", "update_J", "(", ")", "else", ":", "if", "arg_0", ".", "check_Broyden_J", "(", ")", ":", "arg_0", ".", "update_Broyden_J", "(", ")", "if", "arg_0", ".", "check_update_eig_J", "(", ")", ":", "arg_0", ".", "update_eig_J", "(", ")", "arg_1", "=", "arg_0", ".", "find_LM_updates", "(", "arg_0", ".", "calc_grad", "(", ")", ")", "arg_2", "=", "arg_0", ".", "update_function", "(", "arg_0", ".", "param_vals", "+", "arg_1", ")", "arg_3", "=", "(", "find_best_step", "(", "[", "arg_0", ".", "error", ",", "arg_2", "]", ")", "==", "1", ")", "if", "not", "arg_3", ":", "arg_4", "=", "arg_0", ".", "update_function", "(", "arg_0", ".", "param_vals", ")", "if", "np", ".", "abs", "(", "arg_4", "-", "arg_0", ".", "error", ")", "/", "arg_4", ">", "1e-7", ":", "raise", "RuntimeError", "(", "'Function updates are not exact.'", ")", "CLOG", ".", "debug", "(", "'Bad step, increasing damping'", ")", "CLOG", ".", "debug", "(", "'\\t\\t%f\\t%f'", "%", "(", "arg_0", ".", "error", ",", "arg_2", ")", ")", "arg_5", "=", "arg_0", ".", "calc_grad", "(", ")", "for", "arg_6", "in", "range", "(", "arg_0", ".", "_max_inner_loop", ")", ":", "arg_0", ".", "increase_damping", "(", ")", "arg_1", "=", "arg_0", ".", "find_LM_updates", "(", "arg_5", ")", "arg_2", "=", "arg_0", ".", "update_function", "(", "arg_0", ".", "param_vals", "+", "arg_1", ")", "arg_3", "=", "(", "find_best_step", "(", "[", "arg_0", ".", "error", ",", "arg_2", "]", ")", "==", "1", ")", "if", "arg_3", ":", "break", "else", ":", "arg_4", "=", "arg_0", ".", "update_function", "(", "arg_0", ".", "param_vals", ")", "CLOG", ".", "warn", "(", "'Stuck!'", ")", "if", "np", ".", "abs", "(", "arg_4", "-", "arg_0", ".", "error", ")", "/", "arg_4", ">", "1e-7", ":", "raise", "RuntimeError", "(", "'Function updates are not exact.'", ")", "if", "arg_3", ":", "arg_0", ".", "_last_error", "=", "arg_0", ".", "error", "arg_0", ".", "error", "=", "arg_2", "CLOG", ".", "debug", "(", "'Good step\\t%f\\t%f'", "%", "(", "arg_0", ".", "_last_error", ",", "arg_0", ".", "error", ")", ")", "arg_0", ".", "update_param_vals", "(", "arg_1", ",", "incremental", "=", "True", ")", "arg_0", ".", "decrease_damping", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"workhorse for do_run_1\"\"\"\n        if arg_0.check_update_J():\n            arg_0.update_J()\n        else:\n            if arg_0.check_Broyden_J():\n                arg_0.update_Broyden_J()\n            if arg_0.check_update_eig_J():\n                arg_0.update_eig_J()\n\n        #1. Assuming that J starts updated:\n        arg_1 = arg_0.find_LM_updates(arg_0.calc_grad())\n\n        #2. Increase damping until we get a good step:\n        arg_2 = arg_0.update_function(arg_0.param_vals + arg_1)\n        arg_3 = (find_best_step([arg_0.error, arg_2]) == 1)\n        if not arg_3:\n            arg_4 = arg_0.update_function(arg_0.param_vals)\n            if np.abs(arg_4 -arg_0.error)/arg_4 > 1e-7:\n                raise RuntimeError('Function updates are not exact.')\n            CLOG.debug('Bad step, increasing damping')\n            CLOG.debug('\\t\\t%f\\t%f' % (arg_0.error, arg_2))\n            arg_5 = arg_0.calc_grad()\n            for arg_6 in range(arg_0._max_inner_loop):\n                arg_0.increase_damping()\n                arg_1 = arg_0.find_LM_updates(arg_5)\n                arg_2 = arg_0.update_function(arg_0.param_vals + arg_1)\n                arg_3 = (find_best_step([arg_0.error, arg_2]) == 1)\n                if arg_3:\n                    break\n            else:\n                arg_4 = arg_0.update_function(arg_0.param_vals)\n                CLOG.warn('Stuck!')\n                if np.abs(arg_4 -arg_0.error)/arg_4 > 1e-7:\n                    raise RuntimeError('Function updates are not exact.')\n\n        #state is updated, now params:\n        if arg_3:\n            arg_0._last_error = arg_0.error\n            arg_0.error = arg_2\n            CLOG.debug('Good step\\t%f\\t%f' % (arg_0._last_error, arg_0.error))\n            arg_0.update_param_vals(arg_1, incremental=True)\n            arg_0.decrease_damping()", "path": "peri/opt/optimize.py", "identifier": "LMEngine._run1", "docstring": "workhorse for do_run_1", "docstring_tokens": ["workhorse", "for", "do_run_1"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255495}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/confusion_matrix.py#L73-L76", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Convert this confusion matrix into a 2x2 plain list of values.", "language": "python", "parameters": "(self)", "return_statement": "return [[int(self.table.cell_values[0][1]), int(self.table.cell_values[0][2])],\n                [int(self.table.cell_values[1][1]), int(self.table.cell_values[1][2])]]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "[", "int", "(", "arg_0", ".", "table", ".", "cell_values", "[", "0", "]", "[", "1", "]", ")", ",", "int", "(", "arg_0", ".", "table", ".", "cell_values", "[", "0", "]", "[", "2", "]", ")", "]", ",", "[", "int", "(", "arg_0", ".", "table", ".", "cell_values", "[", "1", "]", "[", "1", "]", ")", ",", "int", "(", "arg_0", ".", "table", ".", "cell_values", "[", "1", "]", "[", "2", "]", ")", "]", "]"], "function": "def Func(arg_0):\n        \"\"\"Convert this confusion matrix into a 2x2 plain list of values.\"\"\"\n        return [[int(arg_0.table.cell_values[0][1]), int(arg_0.table.cell_values[0][2])],\n                [int(arg_0.table.cell_values[1][1]), int(arg_0.table.cell_values[1][2])]]", "path": "h2o-py/h2o/model/confusion_matrix.py", "identifier": "ConfusionMatrix.to_list", "docstring": "Convert this confusion matrix into a 2x2 plain list of values.", "docstring_tokens": ["Convert", "this", "confusion", "matrix", "into", "a", "2x2", "plain", "list", "of", "values", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255496}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/device.py#L187-L195", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Return the RSSI signal strength in decibels.", "language": "python", "parameters": "(self, timeout_sec=TIMEOUT_SEC)", "return_statement": "return self._rssi", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_0", ".", "_Func_read", ".", "clear", "(", ")", "arg_0", ".", "_peripheral", ".", "readRSSI", "(", ")", "if", "not", "arg_0", ".", "_Func_read", ".", "wait", "(", "arg_1", ")", ":", "raise", "RuntimeError", "(", "'Exceeded timeout waiting for RSSI value!'", ")", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Return the RSSI signal strength in decibels.\"\"\"\n        # Kick off query to get RSSI, then wait for it to return asyncronously\n        # when the _Func_changed() function is called.\n        arg_0._Func_read.clear()\n        arg_0._peripheral.readRSSI()\n        if not arg_0._Func_read.wait(arg_1):\n            raise RuntimeError('Exceeded timeout waiting for RSSI value!')\n        return arg_0._Func", "path": "Adafruit_BluefruitLE/corebluetooth/device.py", "identifier": "CoreBluetoothDevice.rssi", "docstring": "Return the RSSI signal strength in decibels.", "docstring_tokens": ["Return", "the", "RSSI", "signal", "strength", "in", "decibels", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 255497}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L2820-L2840", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Genetic recombination of two themes using cut and splice technique.", "language": "python", "parameters": "(self, other, d=0.7)", "return_statement": "return c", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.7", ")", ":", "arg_3", ",", "arg_4", "=", "arg_0", ",", "arg_1", "arg_5", "=", "max", "(", "0", ",", "min", "(", "arg_2", ",", "1", ")", ")", "arg_6", "=", "arg_5", "arg_7", "=", "ColorTheme", "(", "name", "=", "arg_3", ".", "name", "[", ":", "int", "(", "len", "(", "arg_3", ".", "name", ")", "*", "arg_5", ")", "]", "+", "arg_4", ".", "name", "[", "int", "(", "len", "(", "arg_4", ".", "name", ")", "*", "arg_6", ")", ":", "]", ",", "ranges", "=", "arg_3", ".", "ranges", "[", ":", "int", "(", "len", "(", "arg_3", ".", "ranges", ")", "*", "arg_5", ")", "]", "+", "arg_4", ".", "ranges", "[", "int", "(", "len", "(", "arg_4", ".", "ranges", ")", "*", "arg_6", ")", ":", "]", ",", "top", "=", "arg_3", ".", "top", ",", "cache", "=", "os", ".", "path", ".", "join", "(", "DEFAULT_CACHE", ",", "\"Funcd\"", ")", ",", "blue", "=", "arg_3", ".", "blue", ",", "length", "=", "arg_3", ".", "length", "*", "arg_5", "+", "arg_4", ".", "length", "*", "arg_6", ")", "arg_7", ".", "tags", "=", "arg_3", ".", "tags", "[", ":", "int", "(", "len", "(", "arg_3", ".", "tags", ")", "*", "arg_5", ")", "]", "arg_7", ".", "tags", "+=", "arg_4", ".", "tags", "[", "int", "(", "len", "(", "arg_4", ".", "tags", ")", "*", "arg_6", ")", ":", "]", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=0.7):\n        \"\"\"\n        Genetic recombination of two themes using cut and splice technique.\n        \"\"\"\n        arg_3, arg_4 = arg_0, arg_1\n        arg_5 = max(0, min(arg_2, 1))\n        arg_6 = arg_5\n\n        arg_7 = ColorTheme(\n            name=arg_3.name[:int(len(arg_3.name) * arg_5)] +\n                 arg_4.name[int(len(arg_4.name) * arg_6):],\n            ranges=arg_3.ranges[:int(len(arg_3.ranges) * arg_5)] +\n                   arg_4.ranges[int(len(arg_4.ranges) * arg_6):],\n            top=arg_3.top,\n            cache=os.path.join(DEFAULT_CACHE, \"Funcd\"),\n            blue=arg_3.blue,\n            length=arg_3.length * arg_5 + arg_4.length * arg_6\n        )\n        arg_7.tags = arg_3.tags[:int(len(arg_3.tags) * arg_5)]\n        arg_7.tags += arg_4.tags[int(len(arg_4.tags) * arg_6):]\n        return arg_7", "path": "lib/colors/__init__.py", "identifier": "ColorTheme.recombine", "docstring": "Genetic recombination of two themes using cut and splice technique.", "docstring_tokens": ["Genetic", "recombination", "of", "two", "themes", "using", "cut", "and", "splice", "technique", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255498}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/template.py#L204-L223", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Fill the content of the document with the information in doc_contents.\n        This is different from the TextDocument fill function, because this will\n        check for symbools in the values of `doc_content` and replace them\n        to good XML codes before filling the template.", "language": "python", "parameters": "(self, doc_contents)", "return_statement": "return super(SVGDocument, self).fill(doc_contents=doc_contents)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "arg_1", "[", "arg_2", "]", "=", "replace_chars_for_svg_code", "(", "arg_3", ")", "return", "super", "(", "SVGDocument", ",", "arg_0", ")", ".", "Func", "(", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Fill the content of the document with the information in doc_contents.\n        This is different from the TextDocument Func function, because this will\n        check for symbools in the values of `doc_content` and replace them\n        to good XML codes before Funcing the template.\n\n        Parameters\n        ----------\n        doc_contents: dict\n            Set of values to set the template document.\n\n        Returns\n        -------\n        Funced_doc: str\n            The content of the document with the template information Funced.\n        \"\"\"\n        for arg_2, arg_3 in arg_1.items():\n            arg_1[arg_2] = replace_chars_for_svg_code(arg_3)\n\n        return super(SVGDocument, arg_0).Func(arg_1=arg_1)", "path": "docstamp/template.py", "identifier": "SVGDocument.fill", "docstring": "Fill the content of the document with the information in doc_contents.\n        This is different from the TextDocument fill function, because this will\n        check for symbools in the values of `doc_content` and replace them\n        to good XML codes before filling the template.\n\n        Parameters\n        ----------\n        doc_contents: dict\n            Set of values to set the template document.\n\n        Returns\n        -------\n        filled_doc: str\n            The content of the document with the template information filled.", "docstring_tokens": ["Fill", "the", "content", "of", "the", "document", "with", "the", "information", "in", "doc_contents", ".", "This", "is", "different", "from", "the", "TextDocument", "fill", "function", "because", "this", "will", "check", "for", "symbools", "in", "the", "values", "of", "doc_content", "and", "replace", "them", "to", "good", "XML", "codes", "before", "filling", "the", "template", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 255499}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/aws_sqs_hook.py#L34-L48", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Create queue using connection object", "language": "python", "parameters": "(self, queue_name, attributes=None)", "return_statement": "return self.get_conn().create_queue(QueueName=queue_name, Attributes=attributes or {})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "QueueName", "=", "arg_1", ",", "Attributes", "=", "arg_2", "or", "{", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Create queue using connection object\n\n        :param queue_name: name of the queue.\n        :type queue_name: str\n        :param attributes: additional attributes for the queue (default: None)\n            For details of the attributes parameter see :py:meth:`botocore.client.SQS.Func`\n        :type attributes: dict\n\n        :return: dict with the information about the queue\n            For details of the returned value see :py:meth:`botocore.client.SQS.Func`\n        :rtype: dict\n        \"\"\"\n        return arg_0.get_conn().Func(QueueName=arg_1, Attributes=arg_2 or {})", "path": "airflow/contrib/hooks/aws_sqs_hook.py", "identifier": "SQSHook.create_queue", "docstring": "Create queue using connection object\n\n        :param queue_name: name of the queue.\n        :type queue_name: str\n        :param attributes: additional attributes for the queue (default: None)\n            For details of the attributes parameter see :py:meth:`botocore.client.SQS.create_queue`\n        :type attributes: dict\n\n        :return: dict with the information about the queue\n            For details of the returned value see :py:meth:`botocore.client.SQS.create_queue`\n        :rtype: dict", "docstring_tokens": ["Create", "queue", "using", "connection", "object"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255500}
{"url": "https://github.com/opencast/pyCA/blob/c89b168d4780d157e1b3f7676628c1b131956a88/pyca/ui/jsonapi.py#L36-L46", "sha": "c89b168d4780d157e1b3f7676628c1b131956a88", "docstring_summary": "Serve a json representation of internal agentstate as meta data", "language": "python", "parameters": "()", "return_statement": "return make_response(jsonify({'meta': data}))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "{", "'services'", ":", "{", "'capture'", ":", "ServiceStatus", ".", "str", "(", "get_service_status", "(", "Service", ".", "CAPTURE", ")", ")", ",", "'ingest'", ":", "ServiceStatus", ".", "str", "(", "get_service_status", "(", "Service", ".", "INGEST", ")", ")", ",", "'schedule'", ":", "ServiceStatus", ".", "str", "(", "get_service_status", "(", "Service", ".", "SCHEDULE", ")", ")", ",", "'agentstate'", ":", "ServiceStatus", ".", "str", "(", "get_service_status", "(", "Service", ".", "AGENTSTATE", ")", ")", "}", "}", "return", "make_response", "(", "jsonify", "(", "{", "'meta'", ":", "arg_0", "}", ")", ")"], "function": "def Func():\n    '''Serve a json representation of internal agentstate as meta data\n    '''\n    arg_0 = {'services': {\n        'capture': ServiceStatus.str(get_service_status(Service.CAPTURE)),\n        'ingest': ServiceStatus.str(get_service_status(Service.INGEST)),\n        'schedule': ServiceStatus.str(get_service_status(Service.SCHEDULE)),\n        'agentstate': ServiceStatus.str(get_service_status(Service.AGENTSTATE))\n        }\n    }\n    return make_response(jsonify({'meta': arg_0}))", "path": "pyca/ui/jsonapi.py", "identifier": "internal_state", "docstring": "Serve a json representation of internal agentstate as meta data", "docstring_tokens": ["Serve", "a", "json", "representation", "of", "internal", "agentstate", "as", "meta", "data"], "nwo": "opencast/pyCA", "score": 0.38750565733100095, "idx": 255501}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4569-L4613", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Encode column as ordinal values and mark it as categorical.", "language": "python", "parameters": "(self, column, values=None, inplace=False)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_1", "=", "_ensure_string_from_expression", "(", "arg_1", ")", "arg_4", "=", "arg_0", "if", "arg_3", "else", "arg_0", ".", "copy", "(", ")", "arg_5", "=", "arg_4", ".", "copy", "(", ")", "arg_5", ".", "select_nothing", "(", "name", "=", "FILTER_SELECTION_NAME", ")", "arg_5", ".", "_length_unfiltered", "=", "arg_4", ".", "_length_original", "arg_5", ".", "set_active_range", "(", "0", ",", "arg_4", ".", "_length_original", ")", "arg_7", ",", "arg_8", "=", "arg_5", ".", "unique", "(", "arg_1", ",", "return_inverse", "=", "True", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_7", "else", ":", "arg_9", "=", "np", ".", "zeros", "(", "len", "(", "arg_7", ")", ",", "dtype", "=", "np", ".", "uint64", ")", "arg_10", "=", "len", "(", "arg_7", ")", "for", "arg_11", ",", "arg_12", "in", "enumerate", "(", "arg_7", ")", ":", "try", ":", "arg_12", "=", "arg_12", ".", "decode", "(", "'ascii'", ")", "except", ":", "pass", "if", "arg_12", "not", "in", "arg_2", ":", "arg_9", "[", "arg_11", "]", "=", "arg_10", "else", ":", "arg_9", "[", "arg_11", "]", "=", "arg_2", ".", "index", "(", "arg_12", ")", "arg_8", "=", "arg_9", "[", "arg_8", "]", "if", "arg_10", "in", "arg_9", ":", "arg_8", "=", "np", ".", "ma", ".", "masked_array", "(", "arg_8", ",", "arg_8", "==", "arg_10", ")", "arg_13", "=", "arg_4", ".", "rename_column", "(", "arg_1", ",", "'__original_'", "+", "arg_1", ",", "unique", "=", "True", ")", "arg_14", "=", "[", "str", "(", "k", ")", "for", "k", "in", "arg_2", "]", "arg_4", ".", "add_column", "(", "arg_1", ",", "arg_8", ")", "arg_4", ".", "_categories", "[", "arg_1", "]", "=", "dict", "(", "arg_14", "=", "arg_14", ",", "N", "=", "len", "(", "arg_2", ")", ",", "arg_2", "=", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        \"\"\"Encode column as ordinal values and mark it as categorical.\n\n        The existing column is renamed to a hidden column and replaced by a numerical columns\n        with values between [0, len(values)-1].\n        \"\"\"\n        arg_1 = _ensure_string_from_expression(arg_1)\n        arg_4 = arg_0 if arg_3 else arg_0.copy()\n        # for the codes, we need to work on the unfiltered dataset, since the filter\n        # may change, and we also cannot add an array that is smaller in length\n        arg_5 = arg_4.copy()\n        # maybe we need some filter manipulation methods\n        arg_5.select_nothing(name=FILTER_SELECTION_NAME)\n        arg_5._length_unfiltered = arg_4._length_original\n        arg_5.set_active_range(0, arg_4._length_original)\n        # codes point to the index of found_values\n        # meaning: found_values[codes[0]] == ds[column].values[0]\n        arg_7, arg_8 = arg_5.unique(arg_1, return_inverse=True)\n        if arg_2 is None:\n            arg_2 = arg_7\n        else:\n            # we have specified which values we should support, anything\n            # not found will be masked\n            arg_9 = np.zeros(len(arg_7), dtype=np.uint64)\n            # mark values that are in the column, but not in values with a special value\n            arg_10 = len(arg_7)\n            for arg_11, arg_12 in enumerate(arg_7):\n                try:\n                    arg_12 = arg_12.decode('ascii')\n                except:\n                    pass\n                if arg_12 not in arg_2:  # not present, we need a missing value\n                    arg_9[arg_11] = arg_10\n                else:\n                    arg_9[arg_11] = arg_2.index(arg_12)\n            arg_8 = arg_9[arg_8]\n            if arg_10 in arg_9:\n                # all special values will be marked as missing\n                arg_8 = np.ma.masked_array(arg_8, arg_8==arg_10)\n\n        arg_13 = arg_4.rename_column(arg_1, '__original_' + arg_1, unique=True)\n        arg_14 = [str(k) for k in arg_2]\n        arg_4.add_column(arg_1, arg_8)\n        arg_4._categories[arg_1] = dict(arg_14=arg_14, N=len(arg_2), arg_2=arg_2)\n        return arg_4", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrameLocal.ordinal_encode", "docstring": "Encode column as ordinal values and mark it as categorical.\n\n        The existing column is renamed to a hidden column and replaced by a numerical columns\n        with values between [0, len(values)-1].", "docstring_tokens": ["Encode", "column", "as", "ordinal", "values", "and", "mark", "it", "as", "categorical", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 255502}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/metrics.py#L133-L138", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Updates a value of a given key and apply reduction", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "value", ":", "arg_0", ".", "value", "[", "arg_1", "]", "=", "ReducedMetric", "(", "arg_0", ".", "reducer", ")", "arg_0", ".", "value", "[", "arg_1", "]", ".", "Func", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Updates a value of a given key and apply reduction\"\"\"\n    if arg_1 not in arg_0.value:\n      arg_0.value[arg_1] = ReducedMetric(arg_0.reducer)\n\n    arg_0.value[arg_1].Func(arg_2)", "path": "heronpy/api/metrics.py", "identifier": "MultiReducedMetric.update", "docstring": "Updates a value of a given key and apply reduction", "docstring_tokens": ["Updates", "a", "value", "of", "a", "given", "key", "and", "apply", "reduction"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255503}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L710-L737", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns whether a and b have the same dynamic shape.", "language": "python", "parameters": "(a, b)", "return_statement": "return tf.cond(\n      pred=tf.equal(tf.rank(a), tf.rank(b)),\n      true_fn=all_shapes_equal,\n      false_fn=lambda: tf.constant(False))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "name", "=", "\"a\"", ")", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "name", "=", "\"b\"", ")", "def", "all_shapes_equal", "(", ")", ":", "return", "tf", ".", "reduce_all", "(", "input_tensor", "=", "tf", ".", "equal", "(", "tf", ".", "concat", "(", "[", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", ",", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", "]", ",", "0", ")", ",", "tf", ".", "concat", "(", "[", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", ",", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "]", ",", "0", ")", ")", ")", "return", "tf", ".", "cond", "(", "pred", "=", "tf", ".", "equal", "(", "tf", ".", "rank", "(", "arg_0", ")", ",", "tf", ".", "rank", "(", "arg_1", ")", ")", ",", "true_fn", "=", "all_shapes_equal", ",", "false_fn", "=", "lambda", ":", "tf", ".", "constant", "(", "False", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Returns whether a and b have the same dynamic shape.\n\n  Args:\n    a: `Tensor`\n    b: `Tensor`\n\n  Returns:\n    `bool` `Tensor` representing if both tensors have the same shape.\n  \"\"\"\n  arg_0 = tf.convert_to_tensor(value=arg_0, name=\"a\")\n  arg_1 = tf.convert_to_tensor(value=arg_1, name=\"b\")\n\n  # Here we can't just do tf.equal(a.shape, b.shape), since\n  # static shape inference may break the equality comparison between\n  # shape(a) and shape(b) in tf.equal.\n  def all_shapes_equal():\n    return tf.reduce_all(\n        input_tensor=tf.equal(\n            tf.concat([tf.shape(input=arg_0), tf.shape(input=arg_1)], 0),\n            tf.concat([tf.shape(input=arg_1), tf.shape(input=arg_0)], 0)))\n\n  # One of the shapes isn't fully defined, so we need to use the dynamic\n  # shape.\n  return tf.cond(\n      pred=tf.equal(tf.rank(arg_0), tf.rank(arg_1)),\n      true_fn=all_shapes_equal,\n      false_fn=lambda: tf.constant(False))", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "same_dynamic_shape", "docstring": "Returns whether a and b have the same dynamic shape.\n\n  Args:\n    a: `Tensor`\n    b: `Tensor`\n\n  Returns:\n    `bool` `Tensor` representing if both tensors have the same shape.", "docstring_tokens": ["Returns", "whether", "a", "and", "b", "have", "the", "same", "dynamic", "shape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255504}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/util.py#L209-L220", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Prune the \"None\" or emptry string values from dictionary items", "language": "python", "parameters": "(dictionary)", "return_statement": "return dictionary", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "list", "(", "arg_0", ".", "items", "(", ")", ")", ":", "if", "arg_2", "is", "None", "or", "str", "(", "arg_2", ")", "==", "''", ":", "del", "arg_0", "[", "arg_1", "]", "if", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "arg_0", "[", "arg_1", "]", "=", "Func", "(", "arg_0", "[", "arg_1", "]", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"\n    Prune the \"None\" or emptry string values from dictionary items\n    \"\"\"\n    for arg_1, arg_2 in list(arg_0.items()):\n        if arg_2 is None or str(arg_2) == '':\n            del arg_0[arg_1]\n\n        if isinstance(arg_2, dict):\n            arg_0[arg_1] = Func(arg_0[arg_1])\n\n    return arg_0", "path": "scraper/util.py", "identifier": "_prune_dict_null_str", "docstring": "Prune the \"None\" or emptry string values from dictionary items", "docstring_tokens": ["Prune", "the", "None", "or", "emptry", "string", "values", "from", "dictionary", "items"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 255505}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/sequence.py#L540-L717", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Viterbi decoding from discriminative state predictions.", "language": "python", "parameters": "(prob, transition, p_state=None, p_init=None, return_logp=False)", "return_statement": "return states", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "shape", "if", "arg_1", ".", "shape", "!=", "(", "arg_5", ",", "arg_5", ")", ":", "raise", "ParameterError", "(", "'transition.shape={}, must be '", "'(n_states, n_states)={}'", ".", "format", "(", "arg_1", ".", "shape", ",", "(", "arg_5", ",", "arg_5", ")", ")", ")", "if", "np", ".", "any", "(", "arg_1", "<", "0", ")", "or", "not", "np", ".", "allclose", "(", "arg_1", ".", "sum", "(", "axis", "=", "1", ")", ",", "1", ")", ":", "raise", "ParameterError", "(", "'Invalid transition matrix: must be non-negative '", "'and sum to 1 on each row.'", ")", "if", "np", ".", "any", "(", "arg_0", "<", "0", ")", "or", "not", "np", ".", "allclose", "(", "arg_0", ".", "sum", "(", "axis", "=", "0", ")", ",", "1", ")", ":", "raise", "ParameterError", "(", "'Invalid probability values: each column must '", "'sum to 1 and be non-negative'", ")", "arg_7", "=", "np", ".", "zeros", "(", "arg_6", ",", "dtype", "=", "int", ")", "arg_8", "=", "np", ".", "zeros", "(", "(", "arg_6", ",", "arg_5", ")", ",", "dtype", "=", "float", ")", "arg_9", "=", "np", ".", "zeros", "(", "(", "arg_6", ",", "arg_5", ")", ",", "dtype", "=", "int", ")", "arg_10", "=", "np", ".", "finfo", "(", "arg_0", ".", "dtype", ")", ".", "tiny", "if", "arg_2", "is", "None", ":", "arg_2", "=", "np", ".", "empty", "(", "arg_5", ")", "arg_2", ".", "fill", "(", "1.", "/", "arg_5", ")", "elif", "arg_2", ".", "shape", "!=", "(", "arg_5", ",", ")", ":", "raise", "ParameterError", "(", "'Marginal distribution p_state must have shape (n_states,). '", "'Got p_state.shape={}'", ".", "format", "(", "arg_2", ".", "shape", ")", ")", "elif", "np", ".", "any", "(", "arg_2", "<", "0", ")", "or", "not", "np", ".", "allclose", "(", "arg_2", ".", "sum", "(", "axis", "=", "-", "1", ")", ",", "1", ")", ":", "raise", "ParameterError", "(", "'Invalid marginal state distribution: '", "'p_state={}'", ".", "format", "(", "arg_2", ")", ")", "arg_11", "=", "np", ".", "log", "(", "arg_1", "+", "arg_10", ")", "arg_12", "=", "np", ".", "log", "(", "arg_2", "+", "arg_10", ")", "arg_13", "=", "np", ".", "log", "(", "arg_0", ".", "T", "+", "arg_10", ")", "-", "arg_12", "if", "arg_3", "is", "None", ":", "arg_3", "=", "np", ".", "empty", "(", "arg_5", ")", "arg_3", ".", "fill", "(", "1.", "/", "arg_5", ")", "elif", "np", ".", "any", "(", "arg_3", "<", "0", ")", "or", "not", "np", ".", "allclose", "(", "arg_3", ".", "sum", "(", ")", ",", "1", ")", ":", "raise", "ParameterError", "(", "'Invalid initial state distribution: '", "'p_init={}'", ".", "format", "(", "arg_3", ")", ")", "arg_14", "=", "np", ".", "log", "(", "arg_3", "+", "arg_10", ")", "_viterbi", "(", "arg_13", ",", "arg_11", ",", "arg_14", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", "if", "arg_4", ":", "return", "arg_7", ",", "arg_8", "[", "-", "1", ",", "arg_7", "[", "-", "1", "]", "]", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False):\n    '''Viterbi decoding from discriminative state predictions.\n\n    Given a sequence of conditional state predictions `prob[s, t]`,\n    indicating the conditional likelihood of state `s` given the\n    observation at time `t`, and a transition matrix `transition[i, j]`\n    which encodes the conditional probability of moving from state `i`\n    to state `j`, the Viterbi algorithm computes the most likely sequence\n    of states from the observations.\n\n    This implementation uses the standard Viterbi decoding algorithm\n    for observation likelihood sequences, under the assumption that\n    `P[Obs(t) | State(t) = s]` is proportional to\n    `P[State(t) = s | Obs(t)] / P[State(t) = s]`, where the denominator\n    is the marginal probability of state `s` occurring as given by `p_state`.\n\n    Parameters\n    ----------\n    prob : np.ndarray [shape=(n_states, n_steps), non-negative]\n        `prob[s, t]` is the probability of state `s` conditional on\n        the observation at time `t`.\n        Must be non-negative and sum to 1 along each column.\n\n    transition : np.ndarray [shape=(n_states, n_states), non-negative]\n        `transition[i, j]` is the probability of a transition from i->j.\n        Each row must sum to 1.\n\n    p_state : np.ndarray [shape=(n_states,)]\n        Optional: marginal probability distribution over states,\n        must be non-negative and sum to 1.\n        If not provided, a uniform distribution is assumed.\n\n    p_init : np.ndarray [shape=(n_states,)]\n        Optional: initial state distribution.\n        If not provided, it is assumed to be uniform.\n\n    return_logp : bool\n        If `True`, return the log-likelihood of the state sequence.\n\n    Returns\n    -------\n    Either `states` or `(states, logp)`:\n\n    states : np.ndarray [shape=(n_steps,)]\n        The most likely state sequence.\n\n    logp : scalar [float]\n        If `return_logp=True`, the log probability of `states` given\n        the observations.\n\n    See Also\n    --------\n    viterbi : Viterbi decoding from observation likelihoods\n    viterbi_binary: Viterbi decoding for multi-label, conditional state likelihoods\n\n    Examples\n    --------\n    This example constructs a simple, template-based discriminative chord estimator,\n    using CENS chroma as input features.\n\n    .. note:: this chord model is not accurate enough to use in practice. It is only\n            intended to demonstrate how to use discriminative Viterbi decoding.\n\n    >>> # Create templates for major, minor, and no-chord qualities\n    >>> maj_template = np.array([1,0,0, 0,1,0, 0,1,0, 0,0,0])\n    >>> min_template = np.array([1,0,0, 1,0,0, 0,1,0, 0,0,0])\n    >>> N_template   = np.array([1,1,1, 1,1,1, 1,1,1, 1,1,1.]) / 4.\n    >>> # Generate the weighting matrix that maps chroma to labels\n    >>> weights = np.zeros((25, 12), dtype=float)\n    >>> labels = ['C:maj', 'C#:maj', 'D:maj', 'D#:maj', 'E:maj', 'F:maj',\n    ...           'F#:maj', 'G:maj', 'G#:maj', 'A:maj', 'A#:maj', 'B:maj',\n    ...           'C:min', 'C#:min', 'D:min', 'D#:min', 'E:min', 'F:min',\n    ...           'F#:min', 'G:min', 'G#:min', 'A:min', 'A#:min', 'B:min',\n    ...           'N']\n    >>> for c in range(12):\n    ...     weights[c, :] = np.roll(maj_template, c) # c:maj\n    ...     weights[c + 12, :] = np.roll(min_template, c)  # c:min\n    >>> weights[-1] = N_template  # the last row is the no-chord class\n    >>> # Make a self-loop transition matrix over 25 states\n    >>> trans = librosa.sequence.transition_loop(25, 0.9)\n\n    >>> # Load in audio and make features\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> chroma = librosa.feature.chroma_cens(y=y, sr=sr, bins_per_octave=36)\n    >>> # Map chroma (observations) to class (state) likelihoods\n    >>> probs = np.exp(weights.dot(chroma))  # P[class | chroma] proportional to exp(template' chroma)\n    >>> probs /= probs.sum(axis=0, keepdims=True)  # probabilities must sum to 1 in each column\n    >>> # Compute independent frame-wise estimates\n    >>> chords_ind = np.argmax(probs, axis=0)\n    >>> # And viterbi estimates\n    >>> chords_vit = librosa.sequence.Func(probs, trans)\n\n    >>> # Plot the features and prediction map\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(10, 6))\n    >>> plt.subplot(2,1,1)\n    >>> librosa.display.specshow(chroma, x_axis='time', y_axis='chroma')\n    >>> plt.colorbar()\n    >>> plt.subplot(2,1,2)\n    >>> librosa.display.specshow(weights, x_axis='chroma')\n    >>> plt.yticks(np.arange(25) + 0.5, labels)\n    >>> plt.ylabel('Chord')\n    >>> plt.colorbar()\n    >>> plt.tight_layout()\n\n    >>> # And plot the results\n    >>> plt.figure(figsize=(10, 4))\n    >>> librosa.display.specshow(probs, x_axis='time', cmap='gray')\n    >>> plt.colorbar()\n    >>> times = librosa.frames_to_time(np.arange(len(chords_vit)))\n    >>> plt.scatter(times, chords_ind + 0.75, color='lime', alpha=0.5, marker='+', s=15, label='Independent')\n    >>> plt.scatter(times, chords_vit + 0.25, color='deeppink', alpha=0.5, marker='o', s=15, label='Viterbi')\n    >>> plt.yticks(0.5 + np.unique(chords_vit), [labels[i] for i in np.unique(chords_vit)], va='center')\n    >>> plt.legend(loc='best')\n    >>> plt.tight_layout()\n\n    '''\n\n    arg_5, arg_6 = arg_0.shape\n\n    if arg_1.shape != (arg_5, arg_5):\n        raise ParameterError('transition.shape={}, must be '\n                             '(n_states, n_states)={}'.format(arg_1.shape,\n                                                              (arg_5, arg_5)))\n\n    if np.any(arg_1 < 0) or not np.allclose(arg_1.sum(axis=1), 1):\n        raise ParameterError('Invalid transition matrix: must be non-negative '\n                             'and sum to 1 on each row.')\n\n    if np.any(arg_0 < 0) or not np.allclose(arg_0.sum(axis=0), 1):\n        raise ParameterError('Invalid probability values: each column must '\n                             'sum to 1 and be non-negative')\n\n    arg_7 = np.zeros(arg_6, dtype=int)\n    arg_8 = np.zeros((arg_6, arg_5), dtype=float)\n    arg_9 = np.zeros((arg_6, arg_5), dtype=int)\n\n    # Compute log-likelihoods while avoiding log-underflow\n    arg_10 = np.finfo(arg_0.dtype).tiny\n\n    # Compute marginal log probabilities while avoiding underflow\n    if arg_2 is None:\n        arg_2 = np.empty(arg_5)\n        arg_2.fill(1./arg_5)\n    elif arg_2.shape != (arg_5,):\n        raise ParameterError('Marginal distribution p_state must have shape (n_states,). '\n                             'Got p_state.shape={}'.format(arg_2.shape))\n    elif np.any(arg_2 < 0) or not np.allclose(arg_2.sum(axis=-1), 1):\n        raise ParameterError('Invalid marginal state distribution: '\n                             'p_state={}'.format(arg_2))\n\n    arg_11 = np.log(arg_1 + arg_10)\n    arg_12 = np.log(arg_2 + arg_10)\n\n    # By Bayes' rule, P[X | Y] * P[Y] = P[Y | X] * P[X]\n    # P[X] is constant for the sake of maximum likelihood inference\n    # and P[Y] is given by the marginal distribution p_state.\n    #\n    # So we have P[X | y] \\propto P[Y | x] / P[Y]\n    # if X = observation and Y = states, this can be done in log space as\n    # log P[X | y] \\propto \\log P[Y | x] - \\log P[Y]\n    arg_13 = np.log(arg_0.T + arg_10) - arg_12\n\n    if arg_3 is None:\n        arg_3 = np.empty(arg_5)\n        arg_3.fill(1./arg_5)\n    elif np.any(arg_3 < 0) or not np.allclose(arg_3.sum(), 1):\n        raise ParameterError('Invalid initial state distribution: '\n                             'p_init={}'.format(arg_3))\n\n    arg_14 = np.log(arg_3 + arg_10)\n\n    _viterbi(arg_13, arg_11, arg_14, arg_7, arg_8, arg_9)\n\n    if arg_4:\n        return arg_7, arg_8[-1, arg_7[-1]]\n\n    return arg_7", "path": "librosa/sequence.py", "identifier": "viterbi_discriminative", "docstring": "Viterbi decoding from discriminative state predictions.\n\n    Given a sequence of conditional state predictions `prob[s, t]`,\n    indicating the conditional likelihood of state `s` given the\n    observation at time `t`, and a transition matrix `transition[i, j]`\n    which encodes the conditional probability of moving from state `i`\n    to state `j`, the Viterbi algorithm computes the most likely sequence\n    of states from the observations.\n\n    This implementation uses the standard Viterbi decoding algorithm\n    for observation likelihood sequences, under the assumption that\n    `P[Obs(t) | State(t) = s]` is proportional to\n    `P[State(t) = s | Obs(t)] / P[State(t) = s]`, where the denominator\n    is the marginal probability of state `s` occurring as given by `p_state`.\n\n    Parameters\n    ----------\n    prob : np.ndarray [shape=(n_states, n_steps), non-negative]\n        `prob[s, t]` is the probability of state `s` conditional on\n        the observation at time `t`.\n        Must be non-negative and sum to 1 along each column.\n\n    transition : np.ndarray [shape=(n_states, n_states), non-negative]\n        `transition[i, j]` is the probability of a transition from i->j.\n        Each row must sum to 1.\n\n    p_state : np.ndarray [shape=(n_states,)]\n        Optional: marginal probability distribution over states,\n        must be non-negative and sum to 1.\n        If not provided, a uniform distribution is assumed.\n\n    p_init : np.ndarray [shape=(n_states,)]\n        Optional: initial state distribution.\n        If not provided, it is assumed to be uniform.\n\n    return_logp : bool\n        If `True`, return the log-likelihood of the state sequence.\n\n    Returns\n    -------\n    Either `states` or `(states, logp)`:\n\n    states : np.ndarray [shape=(n_steps,)]\n        The most likely state sequence.\n\n    logp : scalar [float]\n        If `return_logp=True`, the log probability of `states` given\n        the observations.\n\n    See Also\n    --------\n    viterbi : Viterbi decoding from observation likelihoods\n    viterbi_binary: Viterbi decoding for multi-label, conditional state likelihoods\n\n    Examples\n    --------\n    This example constructs a simple, template-based discriminative chord estimator,\n    using CENS chroma as input features.\n\n    .. note:: this chord model is not accurate enough to use in practice. It is only\n            intended to demonstrate how to use discriminative Viterbi decoding.\n\n    >>> # Create templates for major, minor, and no-chord qualities\n    >>> maj_template = np.array([1,0,0, 0,1,0, 0,1,0, 0,0,0])\n    >>> min_template = np.array([1,0,0, 1,0,0, 0,1,0, 0,0,0])\n    >>> N_template   = np.array([1,1,1, 1,1,1, 1,1,1, 1,1,1.]) / 4.\n    >>> # Generate the weighting matrix that maps chroma to labels\n    >>> weights = np.zeros((25, 12), dtype=float)\n    >>> labels = ['C:maj', 'C#:maj', 'D:maj', 'D#:maj', 'E:maj', 'F:maj',\n    ...           'F#:maj', 'G:maj', 'G#:maj', 'A:maj', 'A#:maj', 'B:maj',\n    ...           'C:min', 'C#:min', 'D:min', 'D#:min', 'E:min', 'F:min',\n    ...           'F#:min', 'G:min', 'G#:min', 'A:min', 'A#:min', 'B:min',\n    ...           'N']\n    >>> for c in range(12):\n    ...     weights[c, :] = np.roll(maj_template, c) # c:maj\n    ...     weights[c + 12, :] = np.roll(min_template, c)  # c:min\n    >>> weights[-1] = N_template  # the last row is the no-chord class\n    >>> # Make a self-loop transition matrix over 25 states\n    >>> trans = librosa.sequence.transition_loop(25, 0.9)\n\n    >>> # Load in audio and make features\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> chroma = librosa.feature.chroma_cens(y=y, sr=sr, bins_per_octave=36)\n    >>> # Map chroma (observations) to class (state) likelihoods\n    >>> probs = np.exp(weights.dot(chroma))  # P[class | chroma] proportional to exp(template' chroma)\n    >>> probs /= probs.sum(axis=0, keepdims=True)  # probabilities must sum to 1 in each column\n    >>> # Compute independent frame-wise estimates\n    >>> chords_ind = np.argmax(probs, axis=0)\n    >>> # And viterbi estimates\n    >>> chords_vit = librosa.sequence.viterbi_discriminative(probs, trans)\n\n    >>> # Plot the features and prediction map\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(10, 6))\n    >>> plt.subplot(2,1,1)\n    >>> librosa.display.specshow(chroma, x_axis='time', y_axis='chroma')\n    >>> plt.colorbar()\n    >>> plt.subplot(2,1,2)\n    >>> librosa.display.specshow(weights, x_axis='chroma')\n    >>> plt.yticks(np.arange(25) + 0.5, labels)\n    >>> plt.ylabel('Chord')\n    >>> plt.colorbar()\n    >>> plt.tight_layout()\n\n    >>> # And plot the results\n    >>> plt.figure(figsize=(10, 4))\n    >>> librosa.display.specshow(probs, x_axis='time', cmap='gray')\n    >>> plt.colorbar()\n    >>> times = librosa.frames_to_time(np.arange(len(chords_vit)))\n    >>> plt.scatter(times, chords_ind + 0.75, color='lime', alpha=0.5, marker='+', s=15, label='Independent')\n    >>> plt.scatter(times, chords_vit + 0.25, color='deeppink', alpha=0.5, marker='o', s=15, label='Viterbi')\n    >>> plt.yticks(0.5 + np.unique(chords_vit), [labels[i] for i in np.unique(chords_vit)], va='center')\n    >>> plt.legend(loc='best')\n    >>> plt.tight_layout()", "docstring_tokens": ["Viterbi", "decoding", "from", "discriminative", "state", "predictions", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 255506}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/dagbag.py#L112-L143", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Gets the DAG out of the dictionary, and refreshes it if expired", "language": "python", "parameters": "(self, dag_id)", "return_statement": "return self.dags.get(dag_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "airflow", ".", "models", ".", "dag", "import", "DagModel", "arg_2", "=", "arg_1", "if", "arg_1", "in", "arg_0", ".", "dags", ":", "arg_3", "=", "arg_0", ".", "dags", "[", "arg_1", "]", "if", "arg_3", ".", "is_subdag", ":", "arg_2", "=", "arg_3", ".", "parent_dag", ".", "dag_id", "arg_4", "=", "DagModel", ".", "get_current", "(", "arg_2", ")", "if", "arg_4", "and", "(", "arg_2", "not", "in", "arg_0", ".", "dags", "or", "(", "arg_4", ".", "last_expired", "and", "arg_3", ".", "last_loaded", "<", "arg_4", ".", "last_expired", ")", ")", ":", "arg_5", "=", "arg_0", ".", "process_file", "(", "filepath", "=", "arg_4", ".", "fileloc", ",", "only_if_updated", "=", "False", ")", "if", "arg_5", "and", "arg_1", "in", "[", "arg_6", ".", "dag_id", "for", "arg_6", "in", "arg_5", "]", ":", "return", "arg_0", ".", "dags", "[", "arg_1", "]", "elif", "arg_1", "in", "arg_0", ".", "dags", ":", "del", "arg_0", ".", "dags", "[", "arg_1", "]", "return", "arg_0", ".", "dags", ".", "get", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Gets the DAG out of the dictionary, and refreshes it if expired\n        \"\"\"\n        from airflow.models.dag import DagModel  # Avoid circular import\n\n        # If asking for a known subdag, we want to refresh the parent\n        arg_2 = arg_1\n        if arg_1 in arg_0.dags:\n            arg_3 = arg_0.dags[arg_1]\n            if arg_3.is_subdag:\n                arg_2 = arg_3.parent_dag.dag_id\n\n        # If the dag corresponding to root_dag_id is absent or expired\n        arg_4 = DagModel.get_current(arg_2)\n        if arg_4 and (\n                arg_2 not in arg_0.dags or\n                (\n                    arg_4.last_expired and\n                    arg_3.last_loaded < arg_4.last_expired\n                )\n        ):\n            # Reprocess source file\n            arg_5 = arg_0.process_file(\n                filepath=arg_4.fileloc, only_if_updated=False)\n\n            # If the source file no longer exports `dag_id`, delete it from self.dags\n            if arg_5 and arg_1 in [arg_6.dag_id for arg_6 in arg_5]:\n                return arg_0.dags[arg_1]\n            elif arg_1 in arg_0.dags:\n                del arg_0.dags[arg_1]\n        return arg_0.dags.get(arg_1)", "path": "airflow/models/dagbag.py", "identifier": "DagBag.get_dag", "docstring": "Gets the DAG out of the dictionary, and refreshes it if expired", "docstring_tokens": ["Gets", "the", "DAG", "out", "of", "the", "dictionary", "and", "refreshes", "it", "if", "expired"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255507}
{"url": "https://github.com/okfn-brasil/serenata-toolbox/blob/47b14725e8ed3a53fb52190a2ba5f29182a16959/serenata_toolbox/chamber_of_deputies/deputies_dataset.py#L18-L41", "sha": "47b14725e8ed3a53fb52190a2ba5f29182a16959", "docstring_summary": "Fetches the list of deputies for the current term.", "language": "python", "parameters": "(self)", "return_statement": "return self._translate(df)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urllib", ".", "request", ".", "urlopen", "(", "arg_0", ".", "URL", ")", "arg_2", "=", "ET", ".", "ElementTree", "(", "file", "=", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_parse_deputies", "(", "arg_2", ".", "getroot", "(", ")", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "arg_3", ",", "columns", "=", "(", "'congressperson_id'", ",", "'budget_id'", ",", "'condition'", ",", "'congressperson_document'", ",", "'civil_name'", ",", "'congressperson_name'", ",", "'picture_url'", ",", "'gender'", ",", "'state'", ",", "'party'", ",", "'phone_number'", ",", "'email'", ")", ")", "return", "arg_0", ".", "_translate", "(", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Fetches the list of deputies for the current term.\n        \"\"\"\n        arg_1 = urllib.request.urlopen(arg_0.URL)\n\n        arg_2 = ET.ElementTree(file=arg_1)\n        arg_3 = arg_0._parse_deputies(arg_2.getroot())\n\n        arg_4 = pd.DataFrame(arg_3, columns=(\n            'congressperson_id',\n            'budget_id',\n            'condition',\n            'congressperson_document',\n            'civil_name',\n            'congressperson_name',\n            'picture_url',\n            'gender',\n            'state',\n            'party',\n            'phone_number',\n            'email'\n        ))\n        return arg_0._translate(arg_4)", "path": "serenata_toolbox/chamber_of_deputies/deputies_dataset.py", "identifier": "DeputiesDataset.fetch", "docstring": "Fetches the list of deputies for the current term.", "docstring_tokens": ["Fetches", "the", "list", "of", "deputies", "for", "the", "current", "term", "."], "nwo": "okfn-brasil/serenata-toolbox", "score": 0.6989925036211513, "idx": 255508}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/api.py#L209-L315", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Make a request to the Ansible Tower API, and return the\n        response.", "language": "python", "parameters": "(self, method, url, *args, **kwargs)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "import", "re", "arg_2", "=", "re", ".", "sub", "(", "\"^/?api/v[0-9]+/\"", ",", "\"\"", ",", "arg_2", ")", "arg_5", "=", "not", "arg_2", ".", "startswith", "(", "'/o/'", ")", "arg_2", "=", "'%s%s'", "%", "(", "arg_0", ".", "get_prefix", "(", "arg_5", ")", ",", "arg_2", ".", "lstrip", "(", "'/'", ")", ")", "arg_4", ".", "setdefault", "(", "'auth'", ",", "BasicTowerAuth", "(", "settings", ".", "username", ",", "settings", ".", "password", ",", "arg_0", ")", ")", "arg_6", "=", "arg_4", ".", "get", "(", "'headers'", ",", "{", "}", ")", "if", "arg_1", ".", "upper", "(", ")", "in", "(", "'PATCH'", ",", "'POST'", ",", "'PUT'", ")", ":", "arg_6", ".", "setdefault", "(", "'Content-Type'", ",", "'application/json'", ")", "arg_4", "[", "'headers'", "]", "=", "arg_6", "debug", ".", "log", "(", "'%s %s'", "%", "(", "arg_1", ",", "arg_2", ")", ",", "fg", "=", "'blue'", ",", "bold", "=", "True", ")", "if", "arg_1", "in", "(", "'POST'", ",", "'PUT'", ",", "'PATCH'", ")", ":", "debug", ".", "log", "(", "'Data: %s'", "%", "arg_4", ".", "get", "(", "'data'", ",", "{", "}", ")", ",", "fg", "=", "'blue'", ",", "bold", "=", "True", ")", "if", "arg_1", "==", "'GET'", "or", "arg_4", ".", "get", "(", "'params'", ",", "None", ")", ":", "debug", ".", "log", "(", "'Params: %s'", "%", "arg_4", ".", "get", "(", "'params'", ",", "{", "}", ")", ",", "fg", "=", "'blue'", ",", "bold", "=", "True", ")", "debug", ".", "log", "(", "''", ")", "if", "arg_6", ".", "get", "(", "'Content-Type'", ",", "''", ")", "==", "'application/json'", ":", "arg_4", "[", "'data'", "]", "=", "json", ".", "dumps", "(", "arg_4", ".", "get", "(", "'data'", ",", "{", "}", ")", ")", "arg_7", "=", "arg_0", ".", "_make_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "if", "arg_7", ".", "status_code", ">=", "500", ":", "raise", "exc", ".", "ServerError", "(", "'The Tower server sent back a server error. '", "'Please try again later.'", ")", "if", "arg_7", ".", "status_code", "==", "401", ":", "raise", "exc", ".", "AuthError", "(", "'Invalid Tower authentication credentials (HTTP 401).'", ")", "if", "arg_7", ".", "status_code", "==", "403", ":", "raise", "exc", ".", "Forbidden", "(", "\"You don't have permission to do that (HTTP 403).\"", ")", "if", "arg_7", ".", "status_code", "==", "404", ":", "raise", "exc", ".", "NotFound", "(", "'The Funced object could not be found.'", ")", "if", "arg_7", ".", "status_code", "==", "405", ":", "raise", "exc", ".", "MethodNotAllowed", "(", "\"The Tower server says you can't make a Func with the \"", "\"%s method to that URL (%s).\"", "%", "(", "arg_1", ",", "arg_2", ")", ",", ")", "if", "arg_7", ".", "status_code", ">=", "400", ":", "raise", "exc", ".", "BadRequest", "(", "'The Tower server claims it was sent a bad Func.\\n\\n'", "'%s %s\\nParams: %s\\nData: %s\\n\\nResponse: %s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_4", ".", "get", "(", "'params'", ",", "None", ")", ",", "arg_4", ".", "get", "(", "'data'", ",", "None", ")", ",", "arg_7", ".", "content", ".", "decode", "(", "'utf8'", ")", ")", ")", "arg_7", ".", "__class__", "=", "APIResponse", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        \"\"\"Make a Func to the Ansible Tower API, and return the\n        response.\n        \"\"\"\n\n        # If the URL has the api/vX at the front strip it off\n        # This is common to have if you are extracting a URL from an existing object.\n        # For example, any of the 'related' fields of an object will have this\n        import re\n        arg_2 = re.sub(\"^/?api/v[0-9]+/\", \"\", arg_2)\n\n        # Piece together the full URL.\n        arg_5 = not arg_2.startswith('/o/')\n        arg_2 = '%s%s' % (arg_0.get_prefix(arg_5), arg_2.lstrip('/'))\n\n        # Ansible Tower expects authenticated Funcs; add the authentication\n        # from settings if it's provided.\n        arg_4.setdefault(\n            'auth',\n            BasicTowerAuth(\n                settings.username,\n                settings.password,\n                arg_0\n            )\n        )\n\n        # POST and PUT Funcs will send JSON by default; make this\n        # the content_type by default.  This makes it such that we don't have\n        # to constantly write that in our code, which gets repetitive.\n        arg_6 = arg_4.get('headers', {})\n        if arg_1.upper() in ('PATCH', 'POST', 'PUT'):\n            arg_6.setdefault('Content-Type', 'application/json')\n            arg_4['headers'] = arg_6\n\n        # If debugging is on, print the URL and data being sent.\n        debug.log('%s %s' % (arg_1, arg_2), fg='blue', bold=True)\n        if arg_1 in ('POST', 'PUT', 'PATCH'):\n            debug.log('Data: %s' % arg_4.get('data', {}),\n                      fg='blue', bold=True)\n        if arg_1 == 'GET' or arg_4.get('params', None):\n            debug.log('Params: %s' % arg_4.get('params', {}),\n                      fg='blue', bold=True)\n        debug.log('')\n\n        # If this is a JSON Func, encode the data value.\n        if arg_6.get('Content-Type', '') == 'application/json':\n            arg_4['data'] = json.dumps(arg_4.get('data', {}))\n\n        arg_7 = arg_0._make_Func(arg_1, arg_2, arg_3, arg_4)\n\n        # Sanity check: Did the server send back some kind of internal error?\n        # If so, bubble this up.\n        if arg_7.status_code >= 500:\n            raise exc.ServerError('The Tower server sent back a server error. '\n                                  'Please try again later.')\n\n        # Sanity check: Did we fail to authenticate properly?\n        # If so, fail out now; this is always a failure.\n        if arg_7.status_code == 401:\n            raise exc.AuthError('Invalid Tower authentication credentials (HTTP 401).')\n\n        # Sanity check: Did we get a forbidden response, which means that\n        # the user isn't allowed to do this? Report that.\n        if arg_7.status_code == 403:\n            raise exc.Forbidden(\"You don't have permission to do that (HTTP 403).\")\n\n        # Sanity check: Did we get a 404 response?\n        # Requests with primary keys will return a 404 if there is no response,\n        # and we want to consistently trap these.\n        if arg_7.status_code == 404:\n            raise exc.NotFound('The Funced object could not be found.')\n\n        # Sanity check: Did we get a 405 response?\n        # A 405 means we used a method that isn't allowed. Usually this\n        # is a bad Func, but it requires special treatment because the\n        # API sends it as a logic error in a few situations (e.g. trying to\n        # cancel a job that isn't running).\n        if arg_7.status_code == 405:\n            raise exc.MethodNotAllowed(\n                \"The Tower server says you can't make a Func with the \"\n                \"%s method to that URL (%s).\" % (arg_1, arg_2),\n            )\n\n        # Sanity check: Did we get some other kind of error?\n        # If so, write an appropriate error message.\n        if arg_7.status_code >= 400:\n            raise exc.BadRequest(\n                'The Tower server claims it was sent a bad Func.\\n\\n'\n                '%s %s\\nParams: %s\\nData: %s\\n\\nResponse: %s' %\n                (arg_1, arg_2, arg_4.get('params', None),\n                 arg_4.get('data', None), arg_7.content.decode('utf8'))\n            )\n\n        # Django REST Framework intelligently prints API keys in the\n        # order that they are defined in the models and serializer.\n        #\n        # We want to preserve this behavior when it is possible to do so\n        # with minimal effort, because while the order has no explicit meaning,\n        # we make some effort to order keys in a convenient manner.\n        #\n        # To this end, make this response into an APIResponse subclass\n        # (defined below), which has a `json` method that doesn't lose key\n        # order.\n        arg_7.__class__ = APIResponse\n\n        # Return the response object.\n        return arg_7", "path": "tower_cli/api.py", "identifier": "Client.request", "docstring": "Make a request to the Ansible Tower API, and return the\n        response.", "docstring_tokens": ["Make", "a", "request", "to", "the", "Ansible", "Tower", "API", "and", "return", "the", "response", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 255509}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L624-L638", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Terminates all background processes immediately.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "workers", ":", "if", "arg_1", ".", "is_alive", "(", ")", ":", "arg_1", ".", "Func", "(", ")", "arg_0", ".", "nb_workers_finished", "=", "len", "(", "arg_0", ".", "workers", ")", "if", "not", "arg_0", ".", "queue_result", ".", "_closed", ":", "arg_0", ".", "queue_result", ".", "close", "(", ")", "time", ".", "sleep", "(", "0.01", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Terminates all background processes immediately.\n\n        This will also free their RAM.\n\n        \"\"\"\n        for arg_1 in arg_0.workers:\n            if arg_1.is_alive():\n                arg_1.Func()\n        arg_0.nb_workers_finished = len(arg_0.workers)\n\n        if not arg_0.queue_result._closed:\n            arg_0.queue_result.close()\n        time.sleep(0.01)", "path": "imgaug/multicore.py", "identifier": "BackgroundAugmenter.terminate", "docstring": "Terminates all background processes immediately.\n\n        This will also free their RAM.", "docstring_tokens": ["Terminates", "all", "background", "processes", "immediately", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 255510}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/configparser.py#L35-L83", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "This function returns a Bunch object from the stated config file.", "language": "python", "parameters": "(filename=None, section_option_dict={})", "return_statement": "return Bunch(tmp_dict)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "{", "}", ")", ":", "arg_2", "=", "ConfigParser", "(", ")", "arg_2", ".", "read", "(", "arg_0", ")", "arg_3", "=", "_prepare_working_dict", "(", "arg_2", ",", "arg_1", ")", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "arg_3", ".", "iteritems", "(", ")", ":", "arg_4", "[", "arg_5", "]", "=", "{", "}", "for", "arg_7", "in", "arg_6", ":", "arg_4", "[", "arg_5", "]", "[", "arg_7", "]", "=", "arg_2", ".", "get", "(", "arg_5", ",", "arg_7", ")", "return", "Bunch", "(", "arg_4", ")"], "function": "def Func(arg_0=None, arg_1={}):\n    \"\"\"\n    This function returns a Bunch object from the stated config file.\n\n    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    NOTE:\n        The values are not evaluated by default.\n    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    filename:\n        The desired config file to read.\n        The config file must be written in a syntax readable to the\n        ConfigParser module -> INI syntax\n\n        [sectionA]\n        optionA1 = ...\n        optionA2 = ...\n\n    section_option_dict:\n        A dictionary that contains keys, which are associated to the sections\n        in the config file, and values, which are a list of the desired\n        options.\n        If empty, everything will be loaded.\n        If the lists are empty, everything from the sections will be loaded.\n\n    Example:\n        dict = {'sectionA': ['optionA1', 'optionA2', ...],\n                'sectionB': ['optionB1', 'optionB2', ...]}\n\n        config = get_config('config.cfg', dict)\n        config.sectionA.optionA1\n\n    Other:\n        Bunch can be found in configparser.py\n    \"\"\"\n\n    arg_2 = ConfigParser()\n    arg_2.read(arg_0)\n\n    arg_3 = _prepare_working_dict(arg_2, arg_1)\n\n    arg_4 = {}\n\n    for arg_5, arg_6 in arg_3.iteritems():\n        arg_4[arg_5] = {}\n        for arg_7 in arg_6:\n            arg_4[arg_5][arg_7] = arg_2.get(arg_5, arg_7)\n\n    return Bunch(arg_4)", "path": "harvestingkit/configparser.py", "identifier": "load_config", "docstring": "This function returns a Bunch object from the stated config file.\n\n    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    NOTE:\n        The values are not evaluated by default.\n    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    filename:\n        The desired config file to read.\n        The config file must be written in a syntax readable to the\n        ConfigParser module -> INI syntax\n\n        [sectionA]\n        optionA1 = ...\n        optionA2 = ...\n\n    section_option_dict:\n        A dictionary that contains keys, which are associated to the sections\n        in the config file, and values, which are a list of the desired\n        options.\n        If empty, everything will be loaded.\n        If the lists are empty, everything from the sections will be loaded.\n\n    Example:\n        dict = {'sectionA': ['optionA1', 'optionA2', ...],\n                'sectionB': ['optionB1', 'optionB2', ...]}\n\n        config = get_config('config.cfg', dict)\n        config.sectionA.optionA1\n\n    Other:\n        Bunch can be found in configparser.py", "docstring_tokens": ["This", "function", "returns", "a", "Bunch", "object", "from", "the", "stated", "config", "file", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 255511}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/layers/util.py#L119-L193", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates a function to build Normal distributions with trainable params.", "language": "python", "parameters": "(\n    is_singular=False,\n    loc_initializer=tf.compat.v1.initializers.random_normal(stddev=0.1),\n    untransformed_scale_initializer=tf.compat.v1.initializers.random_normal(\n        mean=-3., stddev=0.1),\n    loc_regularizer=None,\n    untransformed_scale_regularizer=None,\n    loc_constraint=None,\n    untransformed_scale_constraint=None)", "return_statement": "return _fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ",", "arg_1", "=", "arg_2", ".", "compat", ".", "v1", ".", "initializers", ".", "random_normal", "(", "arg_7", "=", "0.1", ")", ",", "arg_8", "=", "arg_2", ".", "compat", ".", "v1", ".", "initializers", ".", "random_normal", "(", "arg_9", "=", "-", "3.", ",", "arg_7", "=", "0.1", ")", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "None", ")", ":", "arg_14", "=", "default_loc_scale_fn", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_8", "=", "arg_8", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ")", "def", "_fn", "(", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", ")", ":", "arg_20", ",", "arg_21", "=", "arg_14", "(", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", ")", "if", "arg_21", "is", "None", ":", "arg_22", "=", "tfd", ".", "Deterministic", "(", "arg_20", "=", "arg_20", ")", "else", ":", "arg_22", "=", "tfd", ".", "Normal", "(", "arg_20", "=", "arg_20", ",", "arg_21", "=", "arg_21", ")", "arg_23", "=", "arg_2", ".", "size", "(", "input", "=", "arg_22", ".", "batch_shape_tensor", "(", ")", ")", "return", "tfd", ".", "Independent", "(", "arg_22", ",", "reinterpreted_batch_ndims", "=", "arg_23", ")", "return", "_fn"], "function": "def Func(\n    arg_0=False,\n    arg_1=arg_2.compat.v1.initializers.random_normal(arg_7=0.1),\n    arg_8=arg_2.compat.v1.initializers.random_normal(\n        arg_9=-3., arg_7=0.1),\n    arg_10=None,\n    arg_11=None,\n    arg_12=None,\n    arg_13=None):\n  \"\"\"Creates a function to build Normal distributions with trainable params.\n\n  This function produces a closure which produces `tfd.Normal`\n  parameterized by a loc` and `scale` each created using `tf.get_variable`.\n\n  Args:\n    is_singular: Python `bool` if `True`, forces the special case limit of\n      `scale->0`, i.e., a `Deterministic` distribution.\n    loc_initializer: Initializer function for the `loc` parameters.\n      The default is `tf.random_normal_initializer(mean=0., stddev=0.1)`.\n    untransformed_scale_initializer: Initializer function for the `scale`\n      parameters. Default value: `tf.random_normal_initializer(mean=-3.,\n      stddev=0.1)`. This implies the softplus transformed result is initialized\n      near `0`. It allows a `Normal` distribution with `scale` parameter set to\n      this value to approximately act like a point mass.\n    loc_regularizer: Regularizer function for the `loc` parameters.\n    untransformed_scale_regularizer: Regularizer function for the `scale`\n      parameters.\n    loc_constraint: An optional projection function to be applied to the\n      loc after being updated by an `Optimizer`. The function must take as input\n      the unprojected variable and must return the projected variable (which\n      must have the same shape). Constraints are not safe to use when doing\n      asynchronous distributed training.\n    untransformed_scale_constraint: An optional projection function to be\n      applied to the `scale` parameters after being updated by an `Optimizer`\n      (e.g. used to implement norm constraints or value constraints). The\n      function must take as input the unprojected variable and must return the\n      projected variable (which must have the same shape). Constraints are not\n      safe to use when doing asynchronous distributed training.\n\n  Returns:\n    make_normal_fn: Python `callable` which creates a `tfd.Normal`\n      using from args: `dtype, shape, name, trainable, add_variable_fn`.\n  \"\"\"\n  arg_14 = default_loc_scale_fn(\n      arg_0=arg_0,\n      arg_1=arg_1,\n      arg_8=arg_8,\n      arg_10=arg_10,\n      arg_11=arg_11,\n      arg_12=arg_12,\n      arg_13=arg_13)\n  def _fn(arg_15, arg_16, arg_17, arg_18, arg_19):\n    \"\"\"Creates multivariate `Deterministic` or `Normal` distribution.\n\n    Args:\n      dtype: Type of parameter's event.\n      shape: Python `list`-like representing the parameter's event shape.\n      name: Python `str` name prepended to any created (or existing)\n        `tf.Variable`s.\n      trainable: Python `bool` indicating all created `tf.Variable`s should be\n        added to the graph collection `GraphKeys.TRAINABLE_VARIABLES`.\n      add_variable_fn: `tf.get_variable`-like `callable` used to create (or\n        access existing) `tf.Variable`s.\n\n    Returns:\n      Multivariate `Deterministic` or `Normal` distribution.\n    \"\"\"\n    arg_20, arg_21 = arg_14(arg_15, arg_16, arg_17, arg_18, arg_19)\n    if arg_21 is None:\n      arg_22 = tfd.Deterministic(arg_20=arg_20)\n    else:\n      arg_22 = tfd.Normal(arg_20=arg_20, arg_21=arg_21)\n    arg_23 = arg_2.size(input=arg_22.batch_shape_tensor())\n    return tfd.Independent(arg_22, reinterpreted_batch_ndims=arg_23)\n  return _fn", "path": "tensorflow_probability/python/layers/util.py", "identifier": "default_mean_field_normal_fn", "docstring": "Creates a function to build Normal distributions with trainable params.\n\n  This function produces a closure which produces `tfd.Normal`\n  parameterized by a loc` and `scale` each created using `tf.get_variable`.\n\n  Args:\n    is_singular: Python `bool` if `True`, forces the special case limit of\n      `scale->0`, i.e., a `Deterministic` distribution.\n    loc_initializer: Initializer function for the `loc` parameters.\n      The default is `tf.random_normal_initializer(mean=0., stddev=0.1)`.\n    untransformed_scale_initializer: Initializer function for the `scale`\n      parameters. Default value: `tf.random_normal_initializer(mean=-3.,\n      stddev=0.1)`. This implies the softplus transformed result is initialized\n      near `0`. It allows a `Normal` distribution with `scale` parameter set to\n      this value to approximately act like a point mass.\n    loc_regularizer: Regularizer function for the `loc` parameters.\n    untransformed_scale_regularizer: Regularizer function for the `scale`\n      parameters.\n    loc_constraint: An optional projection function to be applied to the\n      loc after being updated by an `Optimizer`. The function must take as input\n      the unprojected variable and must return the projected variable (which\n      must have the same shape). Constraints are not safe to use when doing\n      asynchronous distributed training.\n    untransformed_scale_constraint: An optional projection function to be\n      applied to the `scale` parameters after being updated by an `Optimizer`\n      (e.g. used to implement norm constraints or value constraints). The\n      function must take as input the unprojected variable and must return the\n      projected variable (which must have the same shape). Constraints are not\n      safe to use when doing asynchronous distributed training.\n\n  Returns:\n    make_normal_fn: Python `callable` which creates a `tfd.Normal`\n      using from args: `dtype, shape, name, trainable, add_variable_fn`.", "docstring_tokens": ["Creates", "a", "function", "to", "build", "Normal", "distributions", "with", "trainable", "params", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255512}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/deletion.py#L271-L321", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Knock out each reaction pair from the combinations of two given lists.", "language": "python", "parameters": "(model, reaction_list1=None, reaction_list2=None,\n                             method=\"fba\", solution=None, processes=None,\n                             **kwargs)", "return_statement": "return _multi_deletion(\n        model, 'reaction', element_lists=[reaction_list1, reaction_list2],\n        method=method, solution=solution, processes=processes, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "\"fba\"", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "**", "arg_6", ")", ":", "arg_1", ",", "arg_2", "=", "_element_lists", "(", "arg_0", ".", "reactions", ",", "arg_1", ",", "arg_2", ")", "return", "_multi_deletion", "(", "arg_0", ",", "'reaction'", ",", "element_lists", "=", "[", "arg_1", ",", "arg_2", "]", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "**", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None,\n                             arg_3=\"fba\", arg_4=None, arg_5=None,\n                             **arg_6):\n    \"\"\"\n    Knock out each reaction pair from the combinations of two given lists.\n\n    We say 'pair' here but the order order does not matter.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    reaction_list1 : iterable, optional\n        First iterable of ``cobra.Reaction``s to be deleted. If not passed,\n        all the reactions from the model are used.\n    reaction_list2 : iterable, optional\n        Second iterable of ``cobra.Reaction``s to be deleted. If not passed,\n        all the reactions from the model are used.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Keyword arguments are passed on to underlying simulation functions\n        such as ``add_room``.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all combinations of reaction deletions. The\n        columns are 'growth' and 'status', where\n\n        index : frozenset([str])\n            The reaction identifiers that were knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.\n\n    \"\"\"\n\n    arg_1, arg_2 = _element_lists(arg_0.reactions,\n                                                    arg_1,\n                                                    arg_2)\n    return _multi_deletion(\n        arg_0, 'reaction', element_lists=[arg_1, arg_2],\n        arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, **arg_6)", "path": "cobra/flux_analysis/deletion.py", "identifier": "double_reaction_deletion", "docstring": "Knock out each reaction pair from the combinations of two given lists.\n\n    We say 'pair' here but the order order does not matter.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    reaction_list1 : iterable, optional\n        First iterable of ``cobra.Reaction``s to be deleted. If not passed,\n        all the reactions from the model are used.\n    reaction_list2 : iterable, optional\n        Second iterable of ``cobra.Reaction``s to be deleted. If not passed,\n        all the reactions from the model are used.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Keyword arguments are passed on to underlying simulation functions\n        such as ``add_room``.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all combinations of reaction deletions. The\n        columns are 'growth' and 'status', where\n\n        index : frozenset([str])\n            The reaction identifiers that were knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.", "docstring_tokens": ["Knock", "out", "each", "reaction", "pair", "from", "the", "combinations", "of", "two", "given", "lists", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255513}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/hidden_markov_model.py#L914-L917", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Multiply tensor of matrices by vectors assuming values stored are logs.", "language": "python", "parameters": "(ms, vs)", "return_statement": "return tf.reduce_logsumexp(input_tensor=ms + vs[..., tf.newaxis, :], axis=-1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "tf", ".", "reduce_logsumexp", "(", "input_tensor", "=", "arg_0", "+", "arg_1", "[", "...", ",", "tf", ".", "newaxis", ",", ":", "]", ",", "axis", "=", "-", "1", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Multiply tensor of matrices by vectors assuming values stored are logs.\"\"\"\n\n  return tf.reduce_logsumexp(input_tensor=arg_0 + arg_1[..., tf.newaxis, :], axis=-1)", "path": "tensorflow_probability/python/distributions/hidden_markov_model.py", "identifier": "_log_matrix_vector", "docstring": "Multiply tensor of matrices by vectors assuming values stored are logs.", "docstring_tokens": ["Multiply", "tensor", "of", "matrices", "by", "vectors", "assuming", "values", "stored", "are", "logs", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255514}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/util.py#L442-L467", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Return the kvectors associated with this tile, given the standard form\n        of -0.5 to 0.5. `norm` and `form` arguments arethe same as that passed to\n        `Tile.coords`.", "language": "python", "parameters": "(self, norm=False, form='broadcast', real=False, shift=False)", "return_statement": "return self._format_vector(v, form=form)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "'broadcast'", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "if", "arg_1", "is", "False", ":", "arg_1", "=", "1", "if", "arg_1", "is", "True", ":", "arg_1", "=", "np", ".", "array", "(", "arg_0", ".", "shape", ")", "arg_1", "=", "aN", "(", "arg_1", ",", "arg_0", ".", "dim", ",", "dtype", "=", "'float'", ")", "arg_5", "=", "list", "(", "np", ".", "fft", ".", "fftfreq", "(", "arg_0", ".", "shape", "[", "i", "]", ")", "/", "arg_1", "[", "i", "]", "for", "i", "in", "range", "(", "arg_0", ".", "dim", ")", ")", "if", "arg_4", ":", "arg_5", "=", "list", "(", "np", ".", "fft", ".", "fftshift", "(", "t", ")", "for", "t", "in", "arg_5", ")", "if", "arg_3", ":", "arg_5", "[", "-", "1", "]", "=", "arg_5", "[", "-", "1", "]", "[", ":", "(", "arg_0", ".", "shape", "[", "-", "1", "]", "+", "1", ")", "//", "2", "]", "return", "arg_0", ".", "_format_vector", "(", "arg_5", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, arg_2='broadcast', arg_3=False, arg_4=False):\n        \"\"\"\n        Return the Func associated with this tile, given the standard form\n        of -0.5 to 0.5. `norm` and `form` arguments arethe same as that passed to\n        `Tile.coords`.\n\n        Parameters\n        -----------\n        real : boolean\n            whether to return Func associated with the real fft instead\n        \"\"\"\n        if arg_1 is False:\n            arg_1 = 1\n        if arg_1 is True:\n            arg_1 = np.array(arg_0.shape)\n        arg_1 = aN(arg_1, arg_0.dim, dtype='float')\n\n        arg_5 = list(np.fft.fftfreq(arg_0.shape[i])/arg_1[i] for i in range(arg_0.dim))\n\n        if arg_4:\n            arg_5 = list(np.fft.fftshift(t) for t in arg_5)\n\n        if arg_3:\n            arg_5[-1] = arg_5[-1][:(arg_0.shape[-1]+1)//2]\n\n        return arg_0._format_vector(arg_5, arg_2=arg_2)", "path": "peri/util.py", "identifier": "Tile.kvectors", "docstring": "Return the kvectors associated with this tile, given the standard form\n        of -0.5 to 0.5. `norm` and `form` arguments arethe same as that passed to\n        `Tile.coords`.\n\n        Parameters\n        -----------\n        real : boolean\n            whether to return kvectors associated with the real fft instead", "docstring_tokens": ["Return", "the", "kvectors", "associated", "with", "this", "tile", "given", "the", "standard", "form", "of", "-", "0", ".", "5", "to", "0", ".", "5", ".", "norm", "and", "form", "arguments", "arethe", "same", "as", "that", "passed", "to", "Tile", ".", "coords", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255515}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L453-L465", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Delete this droplet", "language": "python", "parameters": "(self, wait=True)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "arg_0", ".", "parent", ".", "Func", "(", "arg_0", ".", "id", ")", "if", "arg_1", ":", "arg_0", ".", "wait", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"\n        Delete this droplet\n\n        Parameters\n        ----------\n        wait: bool, default True\n            Whether to block until the pending action is completed\n        \"\"\"\n        arg_2 = arg_0.parent.Func(arg_0.id)\n        if arg_1:\n            arg_0.wait()\n        return arg_2", "path": "poseidon/droplet.py", "identifier": "DropletActions.delete", "docstring": "Delete this droplet\n\n        Parameters\n        ----------\n        wait: bool, default True\n            Whether to block until the pending action is completed", "docstring_tokens": ["Delete", "this", "droplet"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 255516}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/operatorDefs.py#L169-L178", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "get sensitivity type for operator", "language": "python", "parameters": "(op)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "AllOps", ".", "RISING_EDGE", ":", "return", "SENSITIVITY", ".", "RISING", "elif", "arg_0", "==", "AllOps", ".", "FALLING_EDGE", ":", "return", "SENSITIVITY", ".", "FALLING", "else", ":", "raise", "TypeError", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    get sensitivity type for operator\n    \"\"\"\n    if arg_0 == AllOps.RISING_EDGE:\n        return SENSITIVITY.RISING\n    elif arg_0 == AllOps.FALLING_EDGE:\n        return SENSITIVITY.FALLING\n    else:\n        raise TypeError()", "path": "hwt/hdl/operatorDefs.py", "identifier": "sensitivityByOp", "docstring": "get sensitivity type for operator", "docstring_tokens": ["get", "sensitivity", "type", "for", "operator"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 255517}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L260-L271", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return True if this is part of a multiline statement.", "language": "python", "parameters": "(line, previous_line='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "for", "arg_2", "in", "'\\\\:;'", ":", "if", "arg_2", "in", "arg_0", ":", "return", "True", "arg_3", "=", "io", ".", "StringIO", "(", "arg_0", ")", "try", ":", "list", "(", "tokenize", ".", "generate_tokens", "(", "arg_3", ".", "readline", ")", ")", "return", "arg_1", ".", "rstrip", "(", ")", ".", "endswith", "(", "'\\\\'", ")", "except", "(", "SyntaxError", ",", "tokenize", ".", "TokenError", ")", ":", "return", "True"], "function": "def Func(arg_0, arg_1=''):\n    \"\"\"Return True if this is part of a multiline statement.\"\"\"\n    for arg_2 in '\\\\:;':\n        if arg_2 in arg_0:\n            return True\n\n    arg_3 = io.StringIO(arg_0)\n    try:\n        list(tokenize.generate_tokens(arg_3.readline))\n        return arg_1.rstrip().endswith('\\\\')\n    except (SyntaxError, tokenize.TokenError):\n        return True", "path": "autoflake.py", "identifier": "multiline_statement", "docstring": "Return True if this is part of a multiline statement.", "docstring_tokens": ["Return", "True", "if", "this", "is", "part", "of", "a", "multiline", "statement", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 255518}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L187-L202", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Preprocess a dict to be used as environment variables.", "language": "python", "parameters": "(d)", "return_statement": "return out_env", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "items", "(", ")", ":", "if", "not", "type", "(", "arg_3", ")", "in", "PREPROCESSORS", ":", "raise", "KeyError", "(", "'Invalid type in dict: {}'", ".", "format", "(", "type", "(", "arg_3", ")", ")", ")", "arg_1", "[", "arg_2", "]", "=", "PREPROCESSORS", "[", "type", "(", "arg_3", ")", "]", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    '''\n    Preprocess a dict to be used as environment variables.\n\n    :param d: dict to be processed\n    '''\n\n    arg_1 = {}\n    for arg_2, arg_3 in arg_0.items():\n\n        if not type(arg_3) in PREPROCESSORS:\n            raise KeyError('Invalid type in dict: {}'.format(type(arg_3)))\n\n        arg_1[arg_2] = PREPROCESSORS[type(arg_3)](arg_3)\n\n    return arg_1", "path": "cpenv/utils.py", "identifier": "preprocess_dict", "docstring": "Preprocess a dict to be used as environment variables.\n\n    :param d: dict to be processed", "docstring_tokens": ["Preprocess", "a", "dict", "to", "be", "used", "as", "environment", "variables", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 255519}
{"url": "https://github.com/klen/muffin-peewee/blob/8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e/example/migrations/000_initial.py#L7-L30", "sha": "8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e", "docstring_summary": "Write your migrations here.", "language": "python", "parameters": "(migrator, database, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "@", "arg_0", ".", "create_table", "class", "DataItem", "(", "pw", ".", "Model", ")", ":", "arg_3", "=", "pw", ".", "DateTimeField", "(", "default", "=", "dt", ".", "datetime", ".", "utcnow", ")", "arg_4", "=", "pw", ".", "CharField", "(", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\" Write your migrations here.\n\n    > Model = migrator.orm['name']\n\n    > migrator.sql(sql)\n    > migrator.create_table(Model)\n    > migrator.drop_table(Model, cascade=True)\n    > migrator.add_columns(Model, **fields)\n    > migrator.change_columns(Model, **fields)\n    > migrator.drop_columns(Model, *field_names, cascade=True)\n    > migrator.rename_column(Model, old_field_name, new_field_name)\n    > migrator.rename_table(Model, new_table_name)\n    > migrator.add_index(Model, *col_names, unique=False)\n    > migrator.drop_index(Model, index_name)\n    > migrator.add_not_null(Model, field_name)\n    > migrator.drop_not_null(Model, field_name)\n    > migrator.add_default(Model, field_name, default)\n\n    \"\"\"\n    @arg_0.create_table\n    class DataItem(pw.Model):\n        arg_3 = pw.DateTimeField(default=dt.datetime.utcnow)\n        arg_4 = pw.CharField()", "path": "example/migrations/000_initial.py", "identifier": "migrate", "docstring": "Write your migrations here.\n\n    > Model = migrator.orm['name']\n\n    > migrator.sql(sql)\n    > migrator.create_table(Model)\n    > migrator.drop_table(Model, cascade=True)\n    > migrator.add_columns(Model, **fields)\n    > migrator.change_columns(Model, **fields)\n    > migrator.drop_columns(Model, *field_names, cascade=True)\n    > migrator.rename_column(Model, old_field_name, new_field_name)\n    > migrator.rename_table(Model, new_table_name)\n    > migrator.add_index(Model, *col_names, unique=False)\n    > migrator.drop_index(Model, index_name)\n    > migrator.add_not_null(Model, field_name)\n    > migrator.drop_not_null(Model, field_name)\n    > migrator.add_default(Model, field_name, default)", "docstring_tokens": ["Write", "your", "migrations", "here", "."], "nwo": "klen/muffin-peewee", "score": 0.16638194949711382, "idx": 255520}
{"url": "https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L201-L205", "sha": "08e0319ff3c70f8a931dfa8890caf48add4d0470", "docstring_summary": "The string for creating the thumbnail of this example", "language": "python", "parameters": "(self)", "return_statement": "return self.THUMBNAIL_TEMPLATE.format(\n            snippet=self.get_description()[1], thumbnail=self.thumb_file,\n            ref_name=self.reference)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "THUMBNAIL_TEMPLATE", ".", "format", "(", "snippet", "=", "arg_0", ".", "get_description", "(", ")", "[", "1", "]", ",", "thumbnail", "=", "arg_0", ".", "thumb_file", ",", "ref_name", "=", "arg_0", ".", "reference", ")"], "function": "def Func(arg_0):\n        \"\"\"The string for creating the thumbnail of this example\"\"\"\n        return arg_0.THUMBNAIL_TEMPLATE.format(\n            snippet=arg_0.get_description()[1], thumbnail=arg_0.thumb_file,\n            ref_name=arg_0.reference)", "path": "sphinx_nbexamples/__init__.py", "identifier": "NotebookProcessor.thumbnail_div", "docstring": "The string for creating the thumbnail of this example", "docstring_tokens": ["The", "string", "for", "creating", "the", "thumbnail", "of", "this", "example"], "nwo": "Chilipp/sphinx-nbexamples", "score": 0.28168436607245656, "idx": 255521}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/generic/compute_cumsum.py#L9-L80", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Compute cumsum for a group of columns.", "language": "python", "parameters": "(\n    df,\n    id_cols: List[str],\n    reference_cols: List[str],\n    value_cols: List[str],\n    new_value_cols: List[str] = None,\n    cols_to_keep: List[str] = None\n)", "return_statement": "return df.reset_index()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ",", "arg_4", ":", "arg_2", "[", "arg_3", "]", ",", "arg_5", ":", "arg_2", "[", "arg_3", "]", ",", "arg_6", ":", "arg_2", "[", "arg_3", "]", "=", "None", ",", "arg_7", ":", "arg_2", "[", "arg_3", "]", "=", "None", ")", ":", "if", "arg_7", "is", "None", ":", "arg_7", "=", "[", "]", "if", "arg_6", "is", "None", ":", "arg_6", "=", "arg_5", "if", "len", "(", "arg_5", ")", "!=", "len", "(", "arg_6", ")", ":", "raise", "ParamsValueError", "(", "'`value_cols` and `new_value_cols` needs '", "'to have the same number of elements'", ")", "check_params_columns_duplicate", "(", "arg_1", "+", "arg_4", "+", "arg_7", "+", "arg_5", ")", "arg_8", "=", "list", "(", "range", "(", "0", ",", "len", "(", "arg_1", ")", ")", ")", "arg_0", "=", "arg_0", ".", "groupby", "(", "arg_1", "+", "arg_4", "+", "arg_7", ")", ".", "sum", "(", ")", "arg_0", "[", "arg_6", "]", "=", "arg_0", ".", "groupby", "(", "level", "=", "arg_8", ")", "[", "arg_5", "]", ".", "cumsum", "(", ")", "return", "arg_0", ".", "reset_index", "(", ")"], "function": "def Func(\n    arg_0,\n    arg_1: arg_2[arg_3],\n    arg_4: arg_2[arg_3],\n    arg_5: arg_2[arg_3],\n    arg_6: arg_2[arg_3] = None,\n    arg_7: arg_2[arg_3] = None\n):\n    \"\"\"\n    Compute cumsum for a group of columns.\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `id_cols` (*list*): the columns id to create each group\n    - `reference_cols` (*list*): the columns to order the cumsum\n    - `value_cols` (*list*): the columns to cumsum\n\n    *optional :*\n    - `new_value_cols` (*list*): the new columns with the result cumsum\n    - `cols_to_keep` (*list*): other columns to keep in the dataset.\n      This option can be used if there is only one row by group [id_cols + reference_cols]\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    MONTH | DAY | NAME | VALUE | X\n    :---:|:---:|:--:|:---:|:---:\n     1   |   1 |   A  |  1 | lo\n     2   |   1 |   A  |  1 | lo\n     2   |  15 |   A  |  1 | la\n     1   |  15 |   B  |  1 | la\n\n    ```cson\n    Func:\n      id_cols: ['NAME']\n      reference_cols: ['MONTH', 'DAY']\n      cumsum_cols: ['VALUE']\n      cols_to_keep: ['X']\n    ```\n\n    **Output**\n\n    NAME | MONTH | DAY | X | VALUE\n    :---:|:---:|:--:|:---:|:---:\n     A  |   1  |    1 | lo  |    1\n     A  |   2  |    1 | la  |    2\n     A  |   2  |   15 | lo  |    3\n     B  |   1  |   15 | la  |    1\n    \"\"\"\n    if arg_7 is None:\n        arg_7 = []\n\n    if arg_6 is None:\n        arg_6 = arg_5\n    if len(arg_5) != len(arg_6):\n        raise ParamsValueError('`value_cols` and `new_value_cols` needs '\n                               'to have the same number of elements')\n\n    check_params_columns_duplicate(arg_1 + arg_4 + arg_7 + arg_5)\n\n    arg_8 = list(range(0, len(arg_1)))\n\n    arg_0 = arg_0.groupby(arg_1 + arg_4 + arg_7).sum()\n    arg_0[arg_6] = arg_0.groupby(level=arg_8)[arg_5].cumsum()\n\n    return arg_0.reset_index()", "path": "toucan_data_sdk/utils/generic/compute_cumsum.py", "identifier": "compute_cumsum", "docstring": "Compute cumsum for a group of columns.\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `id_cols` (*list*): the columns id to create each group\n    - `reference_cols` (*list*): the columns to order the cumsum\n    - `value_cols` (*list*): the columns to cumsum\n\n    *optional :*\n    - `new_value_cols` (*list*): the new columns with the result cumsum\n    - `cols_to_keep` (*list*): other columns to keep in the dataset.\n      This option can be used if there is only one row by group [id_cols + reference_cols]\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    MONTH | DAY | NAME | VALUE | X\n    :---:|:---:|:--:|:---:|:---:\n     1   |   1 |   A  |  1 | lo\n     2   |   1 |   A  |  1 | lo\n     2   |  15 |   A  |  1 | la\n     1   |  15 |   B  |  1 | la\n\n    ```cson\n    compute_cumsum:\n      id_cols: ['NAME']\n      reference_cols: ['MONTH', 'DAY']\n      cumsum_cols: ['VALUE']\n      cols_to_keep: ['X']\n    ```\n\n    **Output**\n\n    NAME | MONTH | DAY | X | VALUE\n    :---:|:---:|:--:|:---:|:---:\n     A  |   1  |    1 | lo  |    1\n     A  |   2  |    1 | la  |    2\n     A  |   2  |   15 | lo  |    3\n     B  |   1  |   15 | la  |    1", "docstring_tokens": ["Compute", "cumsum", "for", "a", "group", "of", "columns", "."], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 255522}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/fs_dav_provider.py#L160-L166", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Set last modified time for destPath to timeStamp on epoch-format", "language": "python", "parameters": "(self, dest_path, time_stamp, dry_run)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "util", ".", "parse_time_string", "(", "arg_2", ")", "if", "not", "arg_3", ":", "os", ".", "utime", "(", "arg_0", ".", "_file_path", ",", "(", "arg_4", ",", "arg_4", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Set last modified time for destPath to timeStamp on epoch-format\"\"\"\n        # Translate time from RFC 1123 to seconds since epoch format\n        arg_4 = util.parse_time_string(arg_2)\n        if not arg_3:\n            os.utime(arg_0._file_path, (arg_4, arg_4))\n        return True", "path": "wsgidav/fs_dav_provider.py", "identifier": "FileResource.set_last_modified", "docstring": "Set last modified time for destPath to timeStamp on epoch-format", "docstring_tokens": ["Set", "last", "modified", "time", "for", "destPath", "to", "timeStamp", "on", "epoch", "-", "format"], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 255523}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L93-L100", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "Build a unique key from get data", "language": "python", "parameters": "(get_dict)", "return_statement": "return hashlib.md5(cache_key).hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Site", ".", "objects", ".", "get_current", "(", ")", "arg_2", "=", "get_dict_to_encoded_url", "(", "arg_0", ")", "arg_3", "=", "'{}_{}'", ".", "format", "(", "arg_1", ".", "domain", ",", "arg_2", ")", "return", "hashlib", ".", "md5", "(", "arg_3", ")", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Build a unique key from get data\n    \"\"\"\n    arg_1 = Site.objects.get_current()\n    arg_2 = get_dict_to_encoded_url(arg_0)\n    arg_3 = '{}_{}'.format(arg_1.domain, arg_2)\n    return hashlib.md5(arg_3).hexdigest()", "path": "toolware/utils/generic.py", "identifier": "get_unique_key_from_get", "docstring": "Build a unique key from get data", "docstring_tokens": ["Build", "a", "unique", "key", "from", "get", "data"], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 255524}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/multifn.py#L46-L54", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return the method which would handle this dispatch key or\n        None if no method defined for this key and no default.", "language": "python", "parameters": "(self, key: T)", "return_statement": "return Maybe(method_cache.entry(key, None)).or_else(\n            lambda: method_cache.entry(self._default, None)  # type: ignore\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Optional", "[", "Method", "]", ":", "arg_3", "=", "arg_0", ".", "methods", "return", "Maybe", "(", "arg_3", ".", "entry", "(", "arg_1", ",", "None", ")", ")", ".", "or_else", "(", "lambda", ":", "arg_3", ".", "entry", "(", "arg_0", ".", "_default", ",", "None", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> Optional[Method]:\n        \"\"\"Return the method which would handle this dispatch key or\n        None if no method defined for this key and no default.\"\"\"\n        arg_3 = arg_0.methods\n        # The 'type: ignore' comment below silences a spurious MyPy error\n        # about having a return statement in a method which does not return.\n        return Maybe(arg_3.entry(arg_1, None)).or_else(\n            lambda: arg_3.entry(arg_0._default, None)  # type: ignore\n        )", "path": "src/basilisp/lang/multifn.py", "identifier": "MultiFunction.get_method", "docstring": "Return the method which would handle this dispatch key or\n        None if no method defined for this key and no default.", "docstring_tokens": ["Return", "the", "method", "which", "would", "handle", "this", "dispatch", "key", "or", "None", "if", "no", "method", "defined", "for", "this", "key", "and", "no", "default", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255525}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/metapaths.py#L58-L75", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Matches a simple metapath starting at the given node", "language": "python", "parameters": "(graph, node, simple_metapath)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "0", "==", "len", "(", "arg_2", ")", ":", "yield", "arg_1", ",", "else", ":", "for", "arg_3", "in", "arg_0", ".", "edges", "[", "arg_1", "]", ":", "if", "arg_0", ".", "nodes", "[", "arg_3", "]", "[", "FUNCTION", "]", "==", "arg_2", "[", "0", "]", ":", "for", "arg_4", "in", "Func", "(", "arg_0", ",", "arg_3", ",", "arg_2", "[", "1", ":", "]", ")", ":", "if", "arg_1", "not", "in", "arg_4", ":", "yield", "(", "arg_1", ",", ")", "+", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Matches a simple metapath starting at the given node\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param tuple node: A BEL node\n    :param list[str] simple_metapath: A list of BEL Functions\n    :return: An iterable over paths from the node matching the metapath\n    :rtype: iter[tuple]\n    \"\"\"\n    if 0 == len(arg_2):\n        yield arg_1,\n\n    else:\n        for arg_3 in arg_0.edges[arg_1]:\n            if arg_0.nodes[arg_3][FUNCTION] == arg_2[0]:\n                for arg_4 in Func(arg_0, arg_3, arg_2[1:]):\n                    if arg_1 not in arg_4:\n                        yield (arg_1,) + arg_4", "path": "src/pybel_tools/selection/metapaths.py", "identifier": "match_simple_metapath", "docstring": "Matches a simple metapath starting at the given node\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param tuple node: A BEL node\n    :param list[str] simple_metapath: A list of BEL Functions\n    :return: An iterable over paths from the node matching the metapath\n    :rtype: iter[tuple]", "docstring_tokens": ["Matches", "a", "simple", "metapath", "starting", "at", "the", "given", "node"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255526}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L68-L85", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Generate an outh2 url for user authentication.", "language": "python", "parameters": "(self, redirect_uri: str, scope: Optional[str] = None, state: Optional[str] = None)", "return_statement": "return OAuth2.url_(self.http.client_id, redirect_uri, scope=scope, state=state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", "[", "arg_2", "]", "=", "None", ",", "arg_5", ":", "arg_4", "[", "arg_2", "]", "=", "None", ")", "->", "arg_2", ":", "return", "OAuth2", ".", "url_", "(", "arg_0", ".", "http", ".", "client_id", ",", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4[arg_2] = None, arg_5: arg_4[arg_2] = None) -> arg_2:\n        \"\"\"Generate an outh2 url for user authentication.\n\n        Parameters\n        ----------\n        redirect_uri : str\n            Where spotify should redirect the user to after authentication.\n        scope : Optional[str]\n            Space seperated spotify scopes for different levels of access.\n        state : Optional[str]\n            Using a state value can increase your assurance that an incoming connection is the result of an authentication request.\n\n        Returns\n        -------\n        url : str\n            The OAuth2 url.\n        \"\"\"\n        return OAuth2.url_(arg_0.http.client_id, arg_1, arg_3=arg_3, arg_5=arg_5)", "path": "spotify/client.py", "identifier": "Client.oauth2_url", "docstring": "Generate an outh2 url for user authentication.\n\n        Parameters\n        ----------\n        redirect_uri : str\n            Where spotify should redirect the user to after authentication.\n        scope : Optional[str]\n            Space seperated spotify scopes for different levels of access.\n        state : Optional[str]\n            Using a state value can increase your assurance that an incoming connection is the result of an authentication request.\n\n        Returns\n        -------\n        url : str\n            The OAuth2 url.", "docstring_tokens": ["Generate", "an", "outh2", "url", "for", "user", "authentication", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 255527}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/documents.py#L31-L35", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Removes a tag from this object", "language": "python", "parameters": "(self, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "tags", "=", "list", "(", "set", "(", "arg_0", ".", "tags", "or", "[", "]", ")", "-", "set", "(", "[", "arg_1", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Removes a tag from this object\n        \"\"\"\n        arg_0.tags = list(set(arg_0.tags or []) - set([arg_1]))", "path": "jackal/documents.py", "identifier": "JackalDoc.remove_tag", "docstring": "Removes a tag from this object", "docstring_tokens": ["Removes", "a", "tag", "from", "this", "object"], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 255528}
{"url": "https://github.com/saxix/sample-data-utils/blob/769f1b46e60def2675a14bd5872047af6d1ea398/sample_data_utils/people.py#L32-L54", "sha": "769f1b46e60def2675a14bd5872047af6d1ea398", "docstring_summary": "returns a random title", "language": "python", "parameters": "(languages=None, genders=None)", "return_statement": "return random.choice(choices)[gender]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "arg_0", "=", "arg_0", "or", "[", "'en'", "]", "arg_1", "=", "arg_1", "or", "(", "GENDER_FEMALE", ",", "GENDER_MALE", ")", "arg_2", "=", "_get_Funcs", "(", "arg_0", ")", "arg_3", "=", "{", "'m'", ":", "0", ",", "'f'", ":", "1", "}", "[", "random", ".", "choice", "(", "arg_1", ")", "]", "return", "random", ".", "choice", "(", "arg_2", ")", "[", "arg_3", "]"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"\n    returns a random Func\n\n    .. code-block:: python\n\n        >>> d.Func()\n        u'Mrs.'\n        >>> d.Func(['es'])\n        u'El Sr.'\n        >>> d.Func(None, [GENDER_FEMALE])\n        u'Mrs.'\n\n    :param languages: list of allowed languages. ['en'] if None\n    :param genders: list of allowed genders. (GENDER_FEMALE, GENDER_MALE) if None\n    \"\"\"\n    arg_0 = arg_0 or ['en']\n    arg_1 = arg_1 or (GENDER_FEMALE, GENDER_MALE)\n\n    arg_2 = _get_Funcs(arg_0)\n    arg_3 = {'m':0, 'f':1}[random.choice(arg_1)]\n\n    return random.choice(arg_2)[arg_3]", "path": "sample_data_utils/people.py", "identifier": "title", "docstring": "returns a random title\n\n    .. code-block:: python\n\n        >>> d.title()\n        u'Mrs.'\n        >>> d.title(['es'])\n        u'El Sr.'\n        >>> d.title(None, [GENDER_FEMALE])\n        u'Mrs.'\n\n    :param languages: list of allowed languages. ['en'] if None\n    :param genders: list of allowed genders. (GENDER_FEMALE, GENDER_MALE) if None", "docstring_tokens": ["returns", "a", "random", "title"], "nwo": "saxix/sample-data-utils", "score": 0.12050106452410352, "idx": 255529}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/message_parser.py#L92-L94", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return sequence of start and end regex patterns for simple HTML tag", "language": "python", "parameters": "(tag)", "return_statement": "return (HTML_START.format(tag=tag), HTML_END.format(tag=tag))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "HTML_START", ".", "format", "(", "arg_0", "=", "arg_0", ")", ",", "HTML_END", ".", "format", "(", "arg_0", "=", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Return sequence of start and end regex patterns for simple HTML tag\"\"\"\n    return (HTML_START.format(arg_0=arg_0), HTML_END.format(arg_0=arg_0))", "path": "hangups/message_parser.py", "identifier": "html", "docstring": "Return sequence of start and end regex patterns for simple HTML tag", "docstring_tokens": ["Return", "sequence", "of", "start", "and", "end", "regex", "patterns", "for", "simple", "HTML", "tag"], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255530}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L130-L134", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Associate the given client data with the item at position n.", "language": "python", "parameters": "(self, n, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "wx_obj", ".", "SetClientData", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_items_dict", "[", "arg_2", "]", "=", "arg_0", ".", "get_string", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\r\n        \"Associate the given client data with the item at position n.\"\r\n        arg_0.wx_obj.SetClientData(arg_1, arg_2)\r\n        # reverse association:\r\n        arg_0._items_dict[arg_2] = arg_0.get_string(arg_1)", "path": "gui/controls/listbox.py", "identifier": "ItemContainerControl.set_data", "docstring": "Associate the given client data with the item at position n.", "docstring_tokens": ["Associate", "the", "given", "client", "data", "with", "the", "item", "at", "position", "n", "."], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 255531}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/benchmark.py#L41-L58", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Fix environment variable to a value within context. Unset if value is None.", "language": "python", "parameters": "(name, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_3", ".", "environ", ".", "get", "(", "arg_0", ",", "None", ")", "if", "arg_1", "is", "not", "None", ":", "arg_3", ".", "environ", "[", "arg_0", "]", "=", "arg_1", "elif", "arg_0", "in", "arg_3", ".", "environ", ":", "del", "arg_3", ".", "environ", "[", "arg_0", "]", "try", ":", "yield", "finally", ":", "if", "arg_2", "is", "not", "None", ":", "arg_3", ".", "environ", "[", "arg_0", "]", "=", "arg_2", "elif", "arg_0", "in", "arg_3", ".", "environ", ":", "del", "arg_3", ".", "environ", "[", "arg_0", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Fix environment variable to a value within context. Unset if value is None.\"\"\"\n    arg_2 = arg_3.environ.get(arg_0, None)\n    if arg_1 is not None:\n        # Set if value is not None\n        arg_3.environ[arg_0] = arg_1\n    elif arg_0 in arg_3.environ:\n        # Unset if value is None\n        del arg_3.environ[arg_0]\n    try:\n        yield\n    finally:\n        if arg_2 is not None:\n            # Restore original value\n            arg_3.environ[arg_0] = arg_2\n        elif arg_0 in arg_3.environ:\n            # Unset\n            del arg_3.environ[arg_0]", "path": "kerncraft/models/benchmark.py", "identifier": "fix_env_variable", "docstring": "Fix environment variable to a value within context. Unset if value is None.", "docstring_tokens": ["Fix", "environment", "variable", "to", "a", "value", "within", "context", ".", "Unset", "if", "value", "is", "None", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 255532}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/stats_v2.py#L240-L308", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Collect statistics for each of the fields in the user input data file and\n  return a stats dict object.", "language": "python", "parameters": "(filename, maxSamples = None,)", "return_statement": "return stats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", ")", ":", "arg_2", "=", "{", "'float'", ":", "FloatStatsCollector", ",", "'int'", ":", "IntStatsCollector", ",", "'string'", ":", "StringStatsCollector", ",", "'datetime'", ":", "DateTimeStatsCollector", ",", "'bool'", ":", "BoolStatsCollector", ",", "}", "arg_0", "=", "resource_filename", "(", "\"nupic.datafiles\"", ",", "arg_0", ")", "print", "\"*\"", "*", "40", "print", "\"Collecting statistics for file:'%s'\"", "%", "(", "arg_0", ",", ")", "arg_3", "=", "FileRecordStream", "(", "arg_0", ")", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_3", ".", "getFields", "(", ")", ":", "arg_8", "=", "arg_2", "[", "arg_6", "]", "(", "arg_5", ",", "arg_6", ",", "arg_7", ")", "arg_4", ".", "append", "(", "arg_8", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "500000", "for", "arg_9", "in", "xrange", "(", "arg_1", ")", ":", "arg_10", "=", "arg_3", ".", "getNextRecord", "(", ")", "if", "arg_10", "is", "None", ":", "break", "for", "arg_9", ",", "arg_11", "in", "enumerate", "(", "arg_10", ")", ":", "arg_4", "[", "arg_9", "]", ".", "addValue", "(", "arg_11", ")", "arg_12", "=", "{", "}", "for", "arg_8", "in", "arg_4", ":", "arg_8", ".", "getStats", "(", "arg_12", ")", "if", "arg_3", ".", "getResetFieldIdx", "(", ")", "is", "not", "None", ":", "arg_13", ",", "arg_14", ",", "arg_14", "=", "arg_3", ".", "getFields", "(", ")", "[", "arg_3", ".", "reset", "]", "arg_12", ".", "pop", "(", "arg_13", ")", "if", "VERBOSITY", ">", "0", ":", "pprint", ".", "pprint", "(", "arg_12", ")", "return", "arg_12"], "function": "def Func(arg_0, arg_1 = None,):\n  \"\"\"\n  Collect statistics for each of the fields in the user input data file and\n  return a stats dict object.\n\n  Parameters:\n  ------------------------------------------------------------------------------\n  filename:             The path and name of the data file.\n  maxSamples:           Upper bound on the number of rows to be processed\n  retval:               A dictionary of dictionaries. The top level keys are the\n                        field names and the corresponding values are the statistics\n                        collected for the individual file.\n                        Example:\n                        {\n                          'consumption':{'min':0,'max':90,'mean':50,...},\n                          'gym':{'numDistinctCategories':10,...},\n                          ...\n                         }\n\n\n  \"\"\"\n  # Mapping from field type to stats collector object\n  arg_2 = {'float':    FloatStatsCollector,\n                           'int':      IntStatsCollector,\n                           'string':   StringStatsCollector,\n                           'datetime': DateTimeStatsCollector,\n                           'bool':     BoolStatsCollector,\n                           }\n\n  arg_0 = resource_filename(\"nupic.datafiles\", arg_0)\n  print \"*\"*40\n  print \"Collecting statistics for file:'%s'\" % (arg_0,)\n  arg_3 = FileRecordStream(arg_0)\n\n  # Initialize collector objects\n  # statsCollectors list holds statsCollector objects for each field\n  arg_4 = []\n  for arg_5, arg_6, arg_7 in arg_3.getFields():\n    # Find the corresponding stats collector for each field based on field type\n    # and intialize an instance\n    arg_8 = \\\n            arg_2[arg_6](arg_5, arg_6, arg_7)\n    arg_4.append(arg_8)\n\n  # Now collect the stats\n  if arg_1 is None:\n    arg_1 = 500000\n  for arg_9 in xrange(arg_1):\n    arg_10 = arg_3.getNextRecord()\n    if arg_10 is None:\n      break\n    for arg_9, arg_11 in enumerate(arg_10):\n      arg_4[arg_9].addValue(arg_11)\n\n  # stats dict holds the statistics for each field\n  arg_12 = {}\n  for arg_8 in arg_4:\n    arg_8.getStats(arg_12)\n\n  # We don't want to include reset field in permutations\n  # TODO: handle reset field in a clean way\n  if arg_3.getResetFieldIdx() is not None:\n    arg_13,arg_14,arg_14 = arg_3.getFields()[arg_3.reset]\n    arg_12.pop(arg_13)\n\n  if VERBOSITY > 0:\n    pprint.pprint(arg_12)\n\n  return arg_12", "path": "src/nupic/data/stats_v2.py", "identifier": "generateStats", "docstring": "Collect statistics for each of the fields in the user input data file and\n  return a stats dict object.\n\n  Parameters:\n  ------------------------------------------------------------------------------\n  filename:             The path and name of the data file.\n  maxSamples:           Upper bound on the number of rows to be processed\n  retval:               A dictionary of dictionaries. The top level keys are the\n                        field names and the corresponding values are the statistics\n                        collected for the individual file.\n                        Example:\n                        {\n                          'consumption':{'min':0,'max':90,'mean':50,...},\n                          'gym':{'numDistinctCategories':10,...},\n                          ...\n                         }", "docstring_tokens": ["Collect", "statistics", "for", "each", "of", "the", "fields", "in", "the", "user", "input", "data", "file", "and", "return", "a", "stats", "dict", "object", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255533}
{"url": "https://github.com/cassinyio/SwarmSpawner/blob/3c39134ef7e02e2afc5d18da7d18d2c69421ed08/cassinyspawner/swarmspawner.py#L132-L147", "sha": "3c39134ef7e02e2afc5d18da7d18d2c69421ed08", "docstring_summary": "Service name inside the Docker Swarm", "language": "python", "parameters": "(self)", "return_statement": "return \"{}-{}-{}\".format(self.service_prefix,\n                                 self.service_owner,\n                                 server_name\n                                 )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "\"server_name\"", ")", "and", "arg_0", ".", "server_name", ":", "arg_1", "=", "arg_0", ".", "server_name", "else", ":", "arg_1", "=", "1", "return", "\"{}-{}-{}\"", ".", "format", "(", "arg_0", ".", "service_prefix", ",", "arg_0", ".", "service_owner", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Service name inside the Docker Swarm\n\n        service_suffix should be a numerical value unique for user\n        {service_prefix}-{service_owner}-{service_suffix}\n        \"\"\"\n        if hasattr(arg_0, \"server_name\") and arg_0.server_name:\n            arg_1 = arg_0.server_name\n        else:\n            arg_1 = 1\n\n        return \"{}-{}-{}\".format(arg_0.service_prefix,\n                                 arg_0.service_owner,\n                                 arg_1\n                                 )", "path": "cassinyspawner/swarmspawner.py", "identifier": "SwarmSpawner.service_name", "docstring": "Service name inside the Docker Swarm\n\n        service_suffix should be a numerical value unique for user\n        {service_prefix}-{service_owner}-{service_suffix}", "docstring_tokens": ["Service", "name", "inside", "the", "Docker", "Swarm"], "nwo": "cassinyio/SwarmSpawner", "score": 0.2873663608194641, "idx": 255534}
{"url": "https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L736-L771", "sha": "d6a8bb9c28787a25b4a1d59a7e4603db3221eaef", "docstring_summary": "Detect crs string format and parse into crs object with appropriate function.", "language": "python", "parameters": "(text, strict=False)", "return_statement": "return crs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", ".", "startswith", "(", "\"+\"", ")", ":", "arg_2", "=", "from_proj4", "(", "arg_0", ",", "arg_1", ")", "elif", "arg_0", ".", "startswith", "(", "(", "\"PROJCS[\"", ",", "\"GEOGCS[\"", ")", ")", ":", "arg_2", "=", "from_unknown_wkt", "(", "arg_0", ",", "arg_1", ")", "elif", "arg_0", ".", "startswith", "(", "\"EPSG:\"", ")", ":", "arg_2", "=", "from_epsg_code", "(", "arg_0", ".", "split", "(", "\":\"", ")", "[", "1", "]", ")", "elif", "arg_0", ".", "startswith", "(", "\"ESRI:\"", ")", ":", "arg_2", "=", "from_esri_code", "(", "arg_0", ".", "split", "(", "\":\"", ")", "[", "1", "]", ")", "elif", "arg_0", ".", "startswith", "(", "\"SR-ORG:\"", ")", ":", "arg_2", "=", "from_sr_code", "(", "arg_0", ".", "split", "(", "\":\"", ")", "[", "1", "]", ")", "else", ":", "raise", "FormatError", "(", "\"Could not auto-detect the type of crs format, make sure it is one of the supported formats\"", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Detect crs string format and parse into crs object with appropriate function.\n\n    Arguments:\n\n    - *text*: The crs text representation of unknown type. \n    - *strict* (optional): When True, the parser is strict about names having to match\n        exactly with upper and lowercases. Default is not strict (False).\n\n    Returns:\n\n    - CRS object.\n    \"\"\"\n\n    if arg_0.startswith(\"+\"):\n        arg_2 = from_proj4(arg_0, arg_1)\n\n    elif arg_0.startswith((\"PROJCS[\",\"GEOGCS[\")):\n        arg_2 = from_unknown_wkt(arg_0, arg_1)\n\n    #elif text.startswith(\"urn:\"):\n    #    crs = from_ogc_urn(text, strict)\n\n    elif arg_0.startswith(\"EPSG:\"):\n        arg_2 = from_epsg_code(arg_0.split(\":\")[1])\n\n    elif arg_0.startswith(\"ESRI:\"):\n        arg_2 = from_esri_code(arg_0.split(\":\")[1])\n\n    elif arg_0.startswith(\"SR-ORG:\"):\n        arg_2 = from_sr_code(arg_0.split(\":\")[1])\n\n    else: raise FormatError(\"Could not auto-detect the type of crs format, make sure it is one of the supported formats\")\n    \n    return arg_2", "path": "pycrs/parse.py", "identifier": "from_unknown_text", "docstring": "Detect crs string format and parse into crs object with appropriate function.\n\n    Arguments:\n\n    - *text*: The crs text representation of unknown type. \n    - *strict* (optional): When True, the parser is strict about names having to match\n        exactly with upper and lowercases. Default is not strict (False).\n\n    Returns:\n\n    - CRS object.", "docstring_tokens": ["Detect", "crs", "string", "format", "and", "parse", "into", "crs", "object", "with", "appropriate", "function", "."], "nwo": "karimbahgat/PyCRS", "score": 0.6903572066933638, "idx": 255535}
{"url": "https://github.com/rainwoodman/sharedmem/blob/b23e59c1ed0e28f7b6c96c17a04d55c700e06e3a/contrib/sort.py#L27-L104", "sha": "b23e59c1ed0e28f7b6c96c17a04d55c700e06e3a", "docstring_summary": "parallel argsort, like numpy.argsort", "language": "python", "parameters": "(data, out=None, chunksize=None, \n        baseargsort=None, \n        argmerge=None, np=None)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "lambda", "x", ":", "x", ".", "Func", "(", ")", "if", "arg_4", "is", "None", ":", "arg_4", "=", "default_argmerge", "if", "arg_2", "is", "None", ":", "arg_2", "=", "1024", "*", "1024", "*", "16", "if", "arg_1", "is", "None", ":", "arg_6", "=", "numpy", ".", "empty", "(", "len", "(", "arg_0", ")", ",", "dtype", "=", "'intp'", ")", "arg_1", "=", "arg_6", "else", ":", "assert", "arg_1", ".", "dtype", "==", "numpy", ".", "dtype", "(", "'intp'", ")", "assert", "len", "(", "arg_1", ")", "==", "len", "(", "arg_0", ")", "arg_6", "=", "arg_1", "if", "arg_5", "is", "None", ":", "arg_5", "=", "sharedmem", ".", "cpu_count", "(", ")", "if", "arg_5", "<=", "1", "or", "len", "(", "arg_0", ")", "<", "arg_2", ":", "arg_1", "[", ":", "]", "=", "arg_3", "(", "arg_0", ")", "return", "arg_1", "arg_7", "=", "[", "slice", "(", "arg_9", ",", "arg_9", "+", "arg_2", ")", "for", "arg_9", "in", "range", "(", "0", ",", "len", "(", "arg_0", ")", ",", "arg_2", ")", "]", "arg_8", "=", "slice", "(", "len", "(", "arg_0", ")", ",", "len", "(", "arg_0", ")", ")", "if", "len", "(", "arg_7", ")", "%", "2", ":", "arg_7", ".", "append", "(", "arg_8", ")", "with", "sharedmem", ".", "TPool", "(", ")", "as", "pool", ":", "def", "work", "(", "arg_9", ")", ":", "arg_10", "=", "arg_7", "[", "arg_9", "]", "arg_11", ",", "arg_12", ",", "arg_13", "=", "arg_10", ".", "indices", "(", "len", "(", "arg_0", ")", ")", "arg_6", "[", "arg_10", "]", "=", "arg_3", "(", "arg_0", "[", "arg_10", "]", ")", "arg_6", "[", "arg_10", "]", "+=", "arg_11", "pool", ".", "map", "(", "work", ",", "range", "(", "len", "(", "arg_7", ")", ")", ")", "arg_14", "=", "numpy", ".", "empty_like", "(", "arg_6", ")", "arg_15", "=", "0", "while", "len", "(", "arg_7", ")", ">", "1", ":", "with", "sharedmem", ".", "TPool", "(", ")", "as", "pool", ":", "def", "work", "(", "arg_9", ")", ":", "arg_16", "=", "arg_7", "[", "arg_9", "]", "arg_17", "=", "arg_7", "[", "arg_9", "+", "1", "]", "arg_18", ",", "arg_19", ",", "arg_20", "=", "arg_16", ".", "indices", "(", "len", "(", "arg_0", ")", ")", "arg_21", ",", "arg_22", ",", "arg_23", "=", "arg_17", ".", "indices", "(", "len", "(", "arg_0", ")", ")", "assert", "arg_21", "==", "arg_19", "arg_4", "(", "arg_0", ",", "arg_6", "[", "arg_16", "]", ",", "arg_6", "[", "arg_17", "]", ",", "arg_14", "[", "arg_18", ":", "arg_22", "]", ")", "return", "slice", "(", "arg_18", ",", "arg_22", ")", "arg_7", "=", "pool", ".", "map", "(", "work", ",", "range", "(", "0", ",", "len", "(", "arg_7", ")", ",", "2", ")", ")", "arg_6", ",", "arg_14", "=", "arg_14", ",", "arg_6", "arg_15", "=", "arg_15", "+", "1", "if", "len", "(", "arg_7", ")", "==", "1", ":", "break", "if", "len", "(", "arg_7", ")", "%", "2", ":", "arg_7", ".", "append", "(", "arg_8", ")", "if", "arg_15", "%", "2", "!=", "0", ":", "arg_1", "[", ":", "]", "=", "arg_6", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None, arg_2=None, \n        arg_3=None, \n        arg_4=None, arg_5=None):\n    \"\"\"\n     parallel Func, like numpy.Func\n\n     use sizeof(intp) * len(data) as scratch space\n\n     use baseFunc for serial sort \n         ind = baseFunc(data)\n\n     use argmerge to merge\n         def argmerge(data, A, B, out):\n             ensure data[out] is sorted\n             and out[:] = A join B\n\n     TODO: shall try to use the inplace merge mentioned in \n            http://keithschwarz.com/interesting/code/?dir=inplace-merge.\n    \"\"\"\n    if arg_3 is None:\n        arg_3 = lambda x:x.Func()\n\n    if arg_4 is None:\n        arg_4 = default_argmerge\n\n    if arg_2 is None:\n        arg_2 = 1024 * 1024 * 16\n\n    if arg_1 is None:\n        arg_6 = numpy.empty(len(arg_0), dtype='intp')\n        arg_1 = arg_6\n    else:\n        assert arg_1.dtype == numpy.dtype('intp')\n        assert len(arg_1) == len(arg_0)\n        arg_6 = arg_1\n\n    if arg_5 is None:\n        arg_5 = sharedmem.cpu_count()\n\n    if arg_5 <= 1 or len(arg_0) < arg_2: \n        arg_1[:] = arg_3(arg_0)\n        return arg_1\n\n    arg_7 = [slice(arg_9, arg_9 + arg_2) for arg_9 in range(0, len(arg_0), arg_2)]\n    arg_8 = slice(len(arg_0), len(arg_0))\n    if len(arg_7) % 2: arg_7.append(arg_8)\n    with sharedmem.TPool() as pool:\n        def work(arg_9):\n            arg_10 = arg_7[arg_9]\n            arg_11, arg_12, arg_13 = arg_10.indices(len(arg_0))\n            arg_6[arg_10] = arg_3(arg_0[arg_10])\n            arg_6[arg_10] += arg_11\n        pool.map(work, range(len(arg_7)))\n  \n    arg_14 = numpy.empty_like(arg_6)\n  \n    arg_15 = 0\n    while len(arg_7) > 1:\n        with sharedmem.TPool() as pool:\n            def work(arg_9):\n                arg_16 = arg_7[arg_9]\n                arg_17 = arg_7[arg_9+1]\n                arg_18, arg_19, arg_20 = arg_16.indices(len(arg_0))\n                arg_21, arg_22, arg_23 = arg_17.indices(len(arg_0))\n        #        print 'argmerge', start1, stop1, start2, stop2\n                assert arg_21 == arg_19\n                arg_4(arg_0, arg_6[arg_16], arg_6[arg_17], arg_14[arg_18:arg_22])\n                return slice(arg_18, arg_22)\n            arg_7 = pool.map(work, range(0, len(arg_7), 2))\n            arg_6, arg_14 = arg_14, arg_6\n            arg_15 = arg_15 + 1\n        if len(arg_7) == 1: break\n        if len(arg_7) % 2: arg_7.append(arg_8)\n    if arg_15 % 2 != 0:\n        # only even flips out ends up pointing to arg2 and needs to be\n        # copied\n        arg_1[:] = arg_6\n    return arg_1", "path": "contrib/sort.py", "identifier": "argsort", "docstring": "parallel argsort, like numpy.argsort\n\n     use sizeof(intp) * len(data) as scratch space\n\n     use baseargsort for serial sort \n         ind = baseargsort(data)\n\n     use argmerge to merge\n         def argmerge(data, A, B, out):\n             ensure data[out] is sorted\n             and out[:] = A join B\n\n     TODO: shall try to use the inplace merge mentioned in \n            http://keithschwarz.com/interesting/code/?dir=inplace-merge.", "docstring_tokens": ["parallel", "argsort", "like", "numpy", ".", "argsort"], "nwo": "rainwoodman/sharedmem", "score": 0.35931637326262145, "idx": 255536}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/roles.py#L76-L100", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "List all roles.", "language": "python", "parameters": "(self, **request_parameters)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_session", ".", "get_items", "(", "API_ENDPOINT", ",", "params", "=", "arg_1", ")", "for", "arg_3", "in", "arg_2", ":", "yield", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_3", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"List all roles.\n\n        Args:\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            GeneratorContainer: A GeneratorContainer which, when iterated,\n            yields the roles returned by the Webex Teams query.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        # API request - get items\n        arg_2 = arg_0._session.get_items(\n            API_ENDPOINT,\n            params=arg_1\n        )\n\n        # Yield role objects created from the returned JSON objects\n        for arg_3 in arg_2:\n            yield arg_0._object_factory(OBJECT_TYPE, arg_3)", "path": "webexteamssdk/api/roles.py", "identifier": "RolesAPI.list", "docstring": "List all roles.\n\n        Args:\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            GeneratorContainer: A GeneratorContainer which, when iterated,\n            yields the roles returned by the Webex Teams query.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["List", "all", "roles", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 255537}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/__init__.py#L22-L37", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "format and write the given layout into the stream object", "language": "python", "parameters": "(self, layout, stream=None, encoding=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "sys", ".", "stdout", "if", "not", "arg_3", ":", "arg_3", "=", "getattr", "(", "arg_2", ",", "\"encoding\"", ",", "\"UTF-8\"", ")", "arg_0", ".", "encoding", "=", "arg_3", "or", "\"UTF-8\"", "arg_0", ".", "out", "=", "arg_2", "arg_0", ".", "begin_Func", "(", ")", "arg_1", ".", "accept", "(", "arg_0", ")", "arg_0", ".", "end_Func", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Func and write the given layout into the stream object\n\n        unicode policy: unicode strings may be found in the layout;\n        try to call stream.write with it, but give it back encoded using\n        the given encoding if it fails\n        \"\"\"\n        if arg_2 is None:\n            arg_2 = sys.stdout\n        if not arg_3:\n            arg_3 = getattr(arg_2, \"encoding\", \"UTF-8\")\n        arg_0.encoding = arg_3 or \"UTF-8\"\n        arg_0.out = arg_2\n        arg_0.begin_Func()\n        arg_1.accept(arg_0)\n        arg_0.end_Func()", "path": "pylint/reporters/ureports/__init__.py", "identifier": "BaseWriter.format", "docstring": "format and write the given layout into the stream object\n\n        unicode policy: unicode strings may be found in the layout;\n        try to call stream.write with it, but give it back encoded using\n        the given encoding if it fails", "docstring_tokens": ["format", "and", "write", "the", "given", "layout", "into", "the", "stream", "object"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255538}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/capture.py#L70-L81", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Add captured output to error report.", "language": "python", "parameters": "(self, test, err)", "return_statement": "return (ec, self.addCaptureToErr(ev, output), tb)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "capturedOutput", "=", "output", "=", "arg_0", ".", "buffer", "arg_0", ".", "_buf", "=", "None", "if", "not", "output", ":", "return", "arg_2", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_2", "return", "(", "arg_5", ",", "arg_0", ".", "addCaptureToErr", "(", "arg_6", ",", "output", ")", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add captured output to error report.\n        \"\"\"\n        arg_1.capturedOutput = output = arg_0.buffer\n        arg_0._buf = None\n        if not output:\n            # Don't return None as that will prevent other\n            # formatters from formatting and remove earlier formatters\n            # formats, instead return the err we got\n            return arg_2\n        arg_5, arg_6, arg_7 = arg_2\n        return (arg_5, arg_0.addCaptureToErr(arg_6, output), arg_7)", "path": "environment/lib/python2.7/site-packages/nose/plugins/capture.py", "identifier": "Capture.formatError", "docstring": "Add captured output to error report.", "docstring_tokens": ["Add", "captured", "output", "to", "error", "report", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255539}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/hosts.py#L527-L545", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Filters a list of host entries according to the given filters.", "language": "python", "parameters": "(entries, filters, exclude)", "return_statement": "return filtered", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "entry", "for", "entry", "in", "arg_0", "if", "all", "(", "entry", ".", "matches", "(", "f", ")", "for", "f", "in", "arg_1", ")", "and", "not", "any", "(", "entry", ".", "matches", "(", "e", ")", "for", "e", "in", "arg_2", ")", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Filters a list of host entries according to the given filters.\n\n    :param entries: A list of host entries.\n    :type entries: [:py:class:`HostEntry`]\n    :param filters: Regexes that must match a `HostEntry`.\n    :type filters: [``str``]\n    :param exclude: Regexes that must NOT match a `HostEntry`.\n    :type exclude: [``str``]\n\n    :return: The filtered list of host entries.\n    :rtype: [:py:class:`HostEntry`]\n    \"\"\"\n    arg_3 = [entry\n                for entry in arg_0\n                if all(entry.matches(f) for f in arg_1)\n                and not any(entry.matches(e) for e in arg_2)]\n    return arg_3", "path": "src/lsi/utils/hosts.py", "identifier": "filter_entries", "docstring": "Filters a list of host entries according to the given filters.\n\n    :param entries: A list of host entries.\n    :type entries: [:py:class:`HostEntry`]\n    :param filters: Regexes that must match a `HostEntry`.\n    :type filters: [``str``]\n    :param exclude: Regexes that must NOT match a `HostEntry`.\n    :type exclude: [``str``]\n\n    :return: The filtered list of host entries.\n    :rtype: [:py:class:`HostEntry`]", "docstring_tokens": ["Filters", "a", "list", "of", "host", "entries", "according", "to", "the", "given", "filters", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 255540}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1672-L1687", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Retrieve the servername extension value if provided in the client hello\n        message, or None if there wasn't one.", "language": "python", "parameters": "(self)", "return_statement": "return _ffi.string(name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_lib", ".", "SSL_Func", "(", "arg_0", ".", "_ssl", ",", "_lib", ".", "TLSEXT_NAMETYPE_host_name", ")", "if", "arg_1", "==", "_ffi", ".", "NULL", ":", "return", "None", "return", "_ffi", ".", "string", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieve the servername extension value if provided in the client hello\n        message, or None if there wasn't one.\n\n        :return: A byte string giving the server name or :data:`None`.\n\n        .. versionadded:: 0.13\n        \"\"\"\n        arg_1 = _lib.SSL_Func(\n            arg_0._ssl, _lib.TLSEXT_NAMETYPE_host_name\n        )\n        if arg_1 == _ffi.NULL:\n            return None\n\n        return _ffi.string(arg_1)", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.get_servername", "docstring": "Retrieve the servername extension value if provided in the client hello\n        message, or None if there wasn't one.\n\n        :return: A byte string giving the server name or :data:`None`.\n\n        .. versionadded:: 0.13", "docstring_tokens": ["Retrieve", "the", "servername", "extension", "value", "if", "provided", "in", "the", "client", "hello", "message", "or", "None", "if", "there", "wasn", "t", "one", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 255541}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/commands.py#L92-L124", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Call CLI command with arguments and returns its return value.", "language": "python", "parameters": "(cmd_name, args_strings)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "op", ".", "isabs", "(", "arg_0", ")", ":", "arg_2", "=", "which", "(", "arg_0", ")", "else", ":", "arg_2", "=", "arg_0", "try", ":", "arg_3", "=", "[", "arg_2", "]", "+", "arg_1", "log", ".", "info", "(", "'Calling: {}.'", ".", "format", "(", "arg_3", ")", ")", "arg_4", "=", "subprocess", ".", "check_call", "(", "arg_3", ")", "except", "CalledProcessError", "as", "ce", ":", "log", ".", "exception", "(", "\"Error calling command {} with arguments: \"", "\"{} \\n With return code: {}\"", ".", "format", "(", "arg_0", ",", "arg_1", ",", "ce", ".", "returncode", ")", ")", "raise", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Call CLI command with arguments and returns its return value.\n\n    Parameters\n    ----------\n    cmd_name: str\n        Command name or full path to the binary file.\n\n    arg_strings: list of str\n        Argument strings list.\n\n    Returns\n    -------\n    return_value\n        Command return value.\n    \"\"\"\n    if not op.isabs(arg_0):\n        arg_2 = which(arg_0)\n    else:\n        arg_2 = arg_0\n\n    try:\n        arg_3 = [arg_2] + arg_1\n\n        log.info('Calling: {}.'.format(arg_3))\n        arg_4 = subprocess.check_call(arg_3)\n    except CalledProcessError as ce:\n        log.exception(\"Error calling command {} with arguments: \"\n                      \"{} \\n With return code: {}\".format(arg_0, arg_1,\n                                                          ce.returncode))\n        raise\n    else:\n        return arg_4", "path": "boyle/commands.py", "identifier": "call_command", "docstring": "Call CLI command with arguments and returns its return value.\n\n    Parameters\n    ----------\n    cmd_name: str\n        Command name or full path to the binary file.\n\n    arg_strings: list of str\n        Argument strings list.\n\n    Returns\n    -------\n    return_value\n        Command return value.", "docstring_tokens": ["Call", "CLI", "command", "with", "arguments", "and", "returns", "its", "return", "value", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255542}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/__init__.py#L219-L228", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Start logging of messages to file and console.", "language": "python", "parameters": "(logfile=\"gromacs.log\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"gromacs.log\"", ")", ":", "from", ".", "import", "log", "log", ".", "create", "(", "\"gromacs\"", ",", "arg_0", "=", "arg_0", ")", "logging", ".", "getLogger", "(", "\"gromacs\"", ")", ".", "info", "(", "\"GromacsWrapper %s STARTED logging to %r\"", ",", "__version__", ",", "arg_0", ")"], "function": "def Func(arg_0=\"gromacs.log\"):\n    \"\"\"Start logging of messages to file and console.\n\n    The default logfile is named ``gromacs.log`` and messages are\n    logged with the tag *gromacs*.\n    \"\"\"\n    from . import log\n    log.create(\"gromacs\", arg_0=arg_0)\n    logging.getLogger(\"gromacs\").info(\"GromacsWrapper %s STARTED logging to %r\",\n                                      __version__, arg_0)", "path": "gromacs/__init__.py", "identifier": "start_logging", "docstring": "Start logging of messages to file and console.\n\n    The default logfile is named ``gromacs.log`` and messages are\n    logged with the tag *gromacs*.", "docstring_tokens": ["Start", "logging", "of", "messages", "to", "file", "and", "console", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 255543}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L44-L64", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Display a list of cases for an institute.", "language": "python", "parameters": "(institute_id)", "return_statement": "return dict(institute=institute_obj, skip_assigned=skip_assigned,\n                is_research=is_research, query=query, **data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "institute_and_case", "(", "store", ",", "arg_0", ")", "arg_2", "=", "request", ".", "args", ".", "get", "(", "'query'", ")", "arg_3", "=", "100", "if", "request", ".", "args", ".", "get", "(", "'limit'", ")", ":", "arg_3", "=", "int", "(", "request", ".", "args", ".", "get", "(", "'limit'", ")", ")", "arg_4", "=", "request", ".", "args", ".", "get", "(", "'skip_assigned'", ")", "arg_5", "=", "request", ".", "args", ".", "get", "(", "'is_research'", ")", "arg_6", "=", "store", ".", "Func", "(", "collaborator", "=", "arg_0", ",", "name_query", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_7", "=", "controllers", ".", "Func", "(", "store", ",", "arg_6", ",", "arg_3", ")", "arg_8", "=", "controllers", ".", "get_sanger_unevaluated", "(", "store", ",", "arg_0", ",", "current_user", ".", "email", ")", "if", "len", "(", "arg_8", ")", ">", "0", ":", "arg_7", "[", "'sanger_unevaluated'", "]", "=", "arg_8", "return", "dict", "(", "institute", "=", "arg_1", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_2", "=", "arg_2", ",", "**", "arg_7", ")"], "function": "def Func(arg_0):\n    \"\"\"Display a list of Func for an institute.\"\"\"\n    arg_1 = institute_and_case(store, arg_0)\n    arg_2 = request.args.get('query')\n\n    arg_3 = 100\n    if request.args.get('limit'):\n        arg_3 = int(request.args.get('limit'))\n\n    arg_4 = request.args.get('skip_assigned')\n    arg_5 = request.args.get('is_research')\n    arg_6 = store.Func(collaborator=arg_0, name_query=arg_2,\n                        arg_4=arg_4, arg_5=arg_5)\n    arg_7 = controllers.Func(store, arg_6, arg_3)\n\n    arg_8 = controllers.get_sanger_unevaluated(store, arg_0, current_user.email)\n    if len(arg_8)> 0:\n        arg_7['sanger_unevaluated'] = arg_8\n\n    return dict(institute=arg_1, arg_4=arg_4,\n                arg_5=arg_5, arg_2=arg_2, **arg_7)", "path": "scout/server/blueprints/cases/views.py", "identifier": "cases", "docstring": "Display a list of cases for an institute.", "docstring_tokens": ["Display", "a", "list", "of", "cases", "for", "an", "institute", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255544}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/core/utils.py#L151-L181", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Convert dict to string", "language": "python", "parameters": "(\n        data: dict, fmt='{key}={value}', sep=', ', public_only=True\n)", "return_statement": "return '{' + sep.join([\n        to_str(data=v, fmt=fmt, sep=sep)\n        if isinstance(v, dict) else fstr(fmt=fmt, key=k, value=v)\n        for k, v in data.items() if k in keys\n    ]) + '}'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", "=", "'{key}={value}'", ",", "arg_3", "=", "', '", ",", "arg_4", "=", "True", ")", "->", "str", ":", "if", "arg_4", ":", "arg_5", "=", "list", "(", "filter", "(", "lambda", "vv", ":", "vv", "[", "0", "]", "!=", "'_'", ",", "arg_0", ".", "keys", "(", ")", ")", ")", "else", ":", "arg_5", "=", "list", "(", "arg_0", ".", "keys", "(", ")", ")", "return", "'{'", "+", "arg_3", ".", "join", "(", "[", "Func", "(", "arg_0", "=", "arg_7", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "isinstance", "(", "arg_7", ",", "arg_1", ")", "else", "fstr", "(", "arg_2", "=", "arg_2", ",", "key", "=", "arg_6", ",", "value", "=", "arg_7", ")", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "items", "(", ")", "if", "arg_6", "in", "arg_5", "]", ")", "+", "'}'"], "function": "def Func(\n        arg_0: arg_1, arg_2='{key}={value}', arg_3=', ', arg_4=True\n) -> str:\n    \"\"\"\n    Convert dict to string\n\n    Args:\n        data: dict\n        fmt: how key and value being represented\n        sep: how pairs of key and value are seperated\n        public_only: if display public members only\n\n    Returns:\n        str: string representation of dict\n\n    Examples:\n        >>> test_dict = dict(b=1, a=0, c=2, _d=3)\n        >>> Func(test_dict)\n        '{b=1, a=0, c=2}'\n        >>> Func(test_dict, sep='|')\n        '{b=1|a=0|c=2}'\n        >>> Func(test_dict, public_only=False)\n        '{b=1, a=0, c=2, _d=3}'\n    \"\"\"\n    if arg_4: arg_5 = list(filter(lambda vv: vv[0] != '_', arg_0.keys()))\n    else: arg_5 = list(arg_0.keys())\n    return '{' + arg_3.join([\n        Func(arg_0=arg_7, arg_2=arg_2, arg_3=arg_3)\n        if isinstance(arg_7, arg_1) else fstr(arg_2=arg_2, key=arg_6, value=arg_7)\n        for arg_6, arg_7 in arg_0.items() if arg_6 in arg_5\n    ]) + '}'", "path": "xbbg/core/utils.py", "identifier": "to_str", "docstring": "Convert dict to string\n\n    Args:\n        data: dict\n        fmt: how key and value being represented\n        sep: how pairs of key and value are seperated\n        public_only: if display public members only\n\n    Returns:\n        str: string representation of dict\n\n    Examples:\n        >>> test_dict = dict(b=1, a=0, c=2, _d=3)\n        >>> to_str(test_dict)\n        '{b=1, a=0, c=2}'\n        >>> to_str(test_dict, sep='|')\n        '{b=1|a=0|c=2}'\n        >>> to_str(test_dict, public_only=False)\n        '{b=1, a=0, c=2, _d=3}'", "docstring_tokens": ["Convert", "dict", "to", "string"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 255545}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/storecustomers.py#L119-L146", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Add or update a customer.", "language": "python", "parameters": "(self, store_id, customer_id, data)", "return_statement": "return self._mc_client._put(url=self._build_path(store_id, 'customers', customer_id), data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "store_id", "=", "arg_1", "arg_0", ".", "customer_id", "=", "arg_2", "if", "'id'", "not", "in", "arg_3", ":", "raise", "KeyError", "(", "'The store customer must have an id'", ")", "if", "'email_address'", "not", "in", "arg_3", ":", "raise", "KeyError", "(", "'Each store customer must have an email_address'", ")", "check_email", "(", "arg_3", "[", "'email_address'", "]", ")", "if", "'opt_in_status'", "not", "in", "arg_3", ":", "raise", "KeyError", "(", "'The store customer must have an opt_in_status'", ")", "if", "arg_3", "[", "'opt_in_status'", "]", "not", "in", "[", "True", ",", "False", "]", ":", "raise", "TypeError", "(", "'The opt_in_status must be True or False'", ")", "return", "arg_0", ".", "_mc_client", ".", "_put", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'customers'", ",", "arg_2", ")", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Add or update a customer.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"email_address\": string*,\n            \"opt_in_status\": boolean\n        }\n        \"\"\"\n        arg_0.store_id = arg_1\n        arg_0.customer_id = arg_2\n        if 'id' not in arg_3:\n            raise KeyError('The store customer must have an id')\n        if 'email_address' not in arg_3:\n            raise KeyError('Each store customer must have an email_address')\n        check_email(arg_3['email_address'])\n        if 'opt_in_status' not in arg_3:\n            raise KeyError('The store customer must have an opt_in_status')\n        if arg_3['opt_in_status'] not in [True, False]:\n            raise TypeError('The opt_in_status must be True or False')\n        return arg_0._mc_client._put(url=arg_0._build_path(arg_1, 'customers', arg_2), arg_3=arg_3)", "path": "mailchimp3/entities/storecustomers.py", "identifier": "StoreCustomers.create_or_update", "docstring": "Add or update a customer.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"email_address\": string*,\n            \"opt_in_status\": boolean\n        }", "docstring_tokens": ["Add", "or", "update", "a", "customer", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 255546}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/plot_util.py#L11-L37", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Smooth signal y, where radius is determines the size of the window", "language": "python", "parameters": "(y, radius, mode='two_sided', valid_only=False)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'two_sided'", ",", "arg_3", "=", "False", ")", ":", "assert", "arg_2", "in", "(", "'two_sided'", ",", "'causal'", ")", "if", "len", "(", "arg_0", ")", "<", "2", "*", "arg_1", "+", "1", ":", "return", "np", ".", "ones_like", "(", "arg_0", ")", "*", "arg_0", ".", "mean", "(", ")", "elif", "arg_2", "==", "'two_sided'", ":", "arg_4", "=", "np", ".", "ones", "(", "2", "*", "arg_1", "+", "1", ")", "arg_5", "=", "np", ".", "convolve", "(", "arg_0", ",", "arg_4", ",", "arg_2", "=", "'same'", ")", "/", "np", ".", "convolve", "(", "np", ".", "ones_like", "(", "arg_0", ")", ",", "arg_4", ",", "arg_2", "=", "'same'", ")", "if", "arg_3", ":", "arg_5", "[", ":", "arg_1", "]", "=", "arg_5", "[", "-", "arg_1", ":", "]", "=", "np", ".", "nan", "elif", "arg_2", "==", "'causal'", ":", "arg_4", "=", "np", ".", "ones", "(", "arg_1", ")", "arg_5", "=", "np", ".", "convolve", "(", "arg_0", ",", "arg_4", ",", "arg_2", "=", "'full'", ")", "/", "np", ".", "convolve", "(", "np", ".", "ones_like", "(", "arg_0", ")", ",", "arg_4", ",", "arg_2", "=", "'full'", ")", "arg_5", "=", "arg_5", "[", ":", "-", "arg_1", "+", "1", "]", "if", "arg_3", ":", "arg_5", "[", ":", "arg_1", "]", "=", "np", ".", "nan", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2='two_sided', arg_3=False):\n    '''\n    Smooth signal y, where radius is determines the size of the window\n\n    mode='twosided':\n        average over the window [max(index - radius, 0), min(index + radius, len(y)-1)]\n    mode='causal':\n        average over the window [max(index - radius, 0), index]\n\n    valid_only: put nan in entries where the full-sized window is not available\n\n    '''\n    assert arg_2 in ('two_sided', 'causal')\n    if len(arg_0) < 2*arg_1+1:\n        return np.ones_like(arg_0) * arg_0.mean()\n    elif arg_2 == 'two_sided':\n        arg_4 = np.ones(2 * arg_1+1)\n        arg_5 = np.convolve(arg_0, arg_4,arg_2='same') / np.convolve(np.ones_like(arg_0), arg_4, arg_2='same')\n        if arg_3:\n            arg_5[:arg_1] = arg_5[-arg_1:] = np.nan\n    elif arg_2 == 'causal':\n        arg_4 = np.ones(arg_1)\n        arg_5 = np.convolve(arg_0, arg_4,arg_2='full') / np.convolve(np.ones_like(arg_0), arg_4, arg_2='full')\n        arg_5 = arg_5[:-arg_1+1]\n        if arg_3:\n            arg_5[:arg_1] = np.nan\n    return arg_5", "path": "baselines/common/plot_util.py", "identifier": "smooth", "docstring": "Smooth signal y, where radius is determines the size of the window\n\n    mode='twosided':\n        average over the window [max(index - radius, 0), min(index + radius, len(y)-1)]\n    mode='causal':\n        average over the window [max(index - radius, 0), index]\n\n    valid_only: put nan in entries where the full-sized window is not available", "docstring_tokens": ["Smooth", "signal", "y", "where", "radius", "is", "determines", "the", "size", "of", "the", "window"], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 255547}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L248-L261", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Execute the component at the current clock cycle.", "language": "python", "parameters": "(self, clock, generalLedger)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "components", ":", "arg_3", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "for", "arg_4", "in", "arg_0", ".", "activities", ":", "arg_4", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Execute the component at the current clock cycle.\n\n        :param clock: The clock containing the current execution time and\n          period information.\n        :param generalLedger: The general ledger into which to create the\n          transactions.\n        \"\"\"\n\n        for arg_3 in arg_0.components:\n            arg_3.Func(arg_1, arg_2)\n        for arg_4 in arg_0.activities:\n            arg_4.Func(arg_1, arg_2)", "path": "auxi/modelling/business/structure.py", "identifier": "Component.run", "docstring": "Execute the component at the current clock cycle.\n\n        :param clock: The clock containing the current execution time and\n          period information.\n        :param generalLedger: The general ledger into which to create the\n          transactions.", "docstring_tokens": ["Execute", "the", "component", "at", "the", "current", "clock", "cycle", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 255548}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L4217-L4289", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores data as carray, earray or vlarray depending on `flag`.", "language": "python", "parameters": "(self, key, data, group, fullname,\n                                    flag, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "**", "arg_6", ")", ":", "try", ":", "if", "arg_5", "==", "HDF5StorageService", ".", "CARRAY", ":", "arg_7", "=", "arg_0", ".", "_hdf5file", ".", "create_carray", "elif", "arg_5", "==", "HDF5StorageService", ".", "EARRAY", ":", "arg_7", "=", "arg_0", ".", "_hdf5file", ".", "create_earray", "elif", "arg_5", "==", "HDF5StorageService", ".", "VLARRAY", ":", "arg_7", "=", "arg_0", ".", "_hdf5file", ".", "create_vlarray", "else", ":", "raise", "RuntimeError", "(", "'You shall not pass!'", ")", "if", "arg_1", "in", "arg_3", ":", "raise", "ValueError", "(", "'CArray `%s` already exists in `%s`. Appending is not supported (yet).'", ")", "if", "'filters'", "in", "arg_6", ":", "arg_8", "=", "arg_6", ".", "pop", "(", "'filters'", ")", "else", ":", "arg_8", "=", "arg_0", ".", "_all_get_filters", "(", "arg_6", ")", "try", ":", "arg_9", "=", "arg_7", "(", "where", "=", "arg_3", ",", "name", "=", "arg_1", ",", "obj", "=", "arg_2", ",", "arg_8", "=", "arg_8", ",", "**", "arg_6", ")", "except", "(", "ValueError", ",", "TypeError", ")", "as", "exc", ":", "try", ":", "arg_10", "=", "arg_2", "[", ":", "]", "arg_10", "=", "np", ".", "core", ".", "defchararray", ".", "encode", "(", "arg_10", ",", "arg_0", ".", "encoding", ")", "arg_9", "=", "arg_7", "(", "where", "=", "arg_3", ",", "name", "=", "arg_1", ",", "obj", "=", "arg_10", ",", "arg_8", "=", "arg_8", ",", "**", "arg_6", ")", "except", "Exception", ":", "raise", "exc", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "_all_set_attributes_to_recall_natives", "(", "arg_2", ",", "arg_9", ",", "HDF5StorageService", ".", "DATA_PREFIX", ")", "setattr", "(", "arg_9", ".", "_v_attrs", ",", "HDF5StorageService", ".", "STORAGE_TYPE", ",", "arg_5", ")", "arg_0", ".", "_hdf5file", ".", "flush", "(", ")", "except", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Failed storing %s `%s` of `%s`.'", "%", "(", "arg_5", ",", "arg_1", ",", "arg_4", ")", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                                    arg_5, **arg_6):\n        \"\"\"Stores data as carray, earray or vlarray depending on `flag`.\n\n        :param key:\n\n            Name of data item to store\n\n        :param data:\n\n            Data to store\n\n        :param group:\n\n            Group node where to store data in hdf5 file\n\n        :param fullname:\n\n            Full name of the `data_to_store`s original container, only needed for throwing errors.\n\n        :param recall:\n\n            If container type and data type for perfect recall should be stored\n\n        :param flag:\n\n            How to store:\n                CARRAY, EARRAY, VLARRAY\n\n        \"\"\"\n        try:\n\n            if arg_5 == HDF5StorageService.CARRAY:\n                arg_7 = arg_0._hdf5file.create_carray\n            elif arg_5 == HDF5StorageService.EARRAY:\n                arg_7 = arg_0._hdf5file.create_earray\n            elif arg_5 == HDF5StorageService.VLARRAY:\n                arg_7 = arg_0._hdf5file.create_vlarray\n            else:\n                raise RuntimeError('You shall not pass!')\n\n            if arg_1 in arg_3:\n                raise ValueError(\n                    'CArray `%s` already exists in `%s`. Appending is not supported (yet).')\n\n            if 'filters' in arg_6:\n                arg_8 = arg_6.pop('filters')\n            else:\n                arg_8 = arg_0._all_get_filters(arg_6)\n\n            try:\n                arg_9 = arg_7(where=arg_3, name=arg_1, obj=arg_2,\n                                                arg_8=arg_8, **arg_6)\n            except (ValueError, TypeError) as exc:\n                try:\n                    arg_10 = arg_2[:]\n                    arg_10 = np.core.defchararray.encode(arg_10, arg_0.encoding)\n                    arg_9 = arg_7(where=arg_3, name=arg_1,\n                                                obj=arg_10,\n                                                arg_8=arg_8, **arg_6)\n                except Exception:\n                    # Re-raise original Error\n                    raise exc\n\n            if arg_2 is not None:\n                # Remember the types of the original data to recall them on loading\n                arg_0._all_set_attributes_to_recall_natives(arg_2, arg_9,\n                                                       HDF5StorageService.DATA_PREFIX)\n            setattr(arg_9._v_attrs, HDF5StorageService.STORAGE_TYPE, arg_5)\n            arg_0._hdf5file.flush()\n        except:\n            arg_0._logger.error('Failed storing %s `%s` of `%s`.' % (arg_5, arg_1, arg_4))\n            raise", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._prm_write_into_other_array", "docstring": "Stores data as carray, earray or vlarray depending on `flag`.\n\n        :param key:\n\n            Name of data item to store\n\n        :param data:\n\n            Data to store\n\n        :param group:\n\n            Group node where to store data in hdf5 file\n\n        :param fullname:\n\n            Full name of the `data_to_store`s original container, only needed for throwing errors.\n\n        :param recall:\n\n            If container type and data type for perfect recall should be stored\n\n        :param flag:\n\n            How to store:\n                CARRAY, EARRAY, VLARRAY", "docstring_tokens": ["Stores", "data", "as", "carray", "earray", "or", "vlarray", "depending", "on", "flag", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255549}
{"url": "https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L88-L97", "sha": "08e0319ff3c70f8a931dfa8890caf48add4d0470", "docstring_summary": "Return the link to the Jupyter nbviewer for the given notebook url", "language": "python", "parameters": "(url)", "return_statement": "return 'https://nbviewer.jupyter.org/%s%s' % (url_type, info.path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "six", ".", "PY2", ":", "from", "urlparse", "import", "urlparse", "as", "urlsplit", "else", ":", "from", "urllib", ".", "parse", "import", "urlsplit", "arg_1", "=", "urlsplit", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "netloc", "arg_3", "=", "'github'", "if", "arg_2", "==", "'github.com'", "else", "'url'", "return", "'https://nbviewer.jupyter.org/%s%s'", "%", "(", "arg_3", ",", "arg_1", ".", "path", ")"], "function": "def Func(arg_0):\n    \"\"\"Return the link to the Jupyter nbviewer for the given notebook url\"\"\"\n    if six.PY2:\n        from urlparse import urlparse as urlsplit\n    else:\n        from urllib.parse import urlsplit\n    arg_1 = urlsplit(arg_0)\n    arg_2 = arg_1.netloc\n    arg_3 = 'github' if arg_2 == 'github.com' else 'url'\n    return 'https://nbviewer.jupyter.org/%s%s' % (arg_3, arg_1.path)", "path": "sphinx_nbexamples/__init__.py", "identifier": "nbviewer_link", "docstring": "Return the link to the Jupyter nbviewer for the given notebook url", "docstring_tokens": ["Return", "the", "link", "to", "the", "Jupyter", "nbviewer", "for", "the", "given", "notebook", "url"], "nwo": "Chilipp/sphinx-nbexamples", "score": 0.28168436607245656, "idx": 255550}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/display.py#L120-L134", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "format display item", "language": "python", "parameters": "(self, show_enabled=True)", "return_statement": "return '%3d: %s' % (self.number, what)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "''", "if", "arg_1", ":", "if", "arg_0", ".", "enabled", ":", "arg_2", "+=", "' y '", "else", ":", "arg_2", "+=", "' n '", "pass", "pass", "if", "arg_0", ".", "fmt", ":", "arg_2", "+=", "arg_0", ".", "fmt", "+", "' '", "pass", "arg_2", "+=", "arg_0", ".", "arg", "return", "'%3d: %s'", "%", "(", "arg_0", ".", "number", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=True):\n        '''Func display item'''\n        arg_2 = ''\n        if arg_1:\n            if arg_0.enabled:\n                arg_2 += ' y '\n            else:\n                arg_2 += ' n '\n                pass\n            pass\n        if arg_0.fmt:\n            arg_2 += arg_0.fmt + ' '\n            pass\n        arg_2 += arg_0.arg\n        return '%3d: %s' % (arg_0.number, arg_2)", "path": "trepan/lib/display.py", "identifier": "Display.format", "docstring": "format display item", "docstring_tokens": ["format", "display", "item"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 255551}
{"url": "https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L91-L115", "sha": "2092b0cb30898139a247176bcf433d5a4abde7cb", "docstring_summary": "Handles HTTP error codes for the given request", "language": "python", "parameters": "(self, r)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "status_code", ">=", "400", "and", "arg_1", ".", "status_code", "<", "500", ":", "arg_2", "=", "arg_1", ".", "json", "(", ")", "raise", "AuthenticationError", "(", "str", "(", "arg_2", "[", "\"code\"", "]", ")", "+", "\": \"", "+", "arg_2", "[", "\"msg\"", "]", "+", "\" (\"", "+", "arg_2", "[", "\"ref\"", "]", "+", "\")\"", ")", "elif", "arg_1", ".", "status_code", ">", "300", ":", "arg_3", "=", "None", "try", ":", "arg_2", "=", "arg_1", ".", "json", "(", ")", "arg_3", "=", "ServerError", "(", "str", "(", "arg_2", "[", "\"code\"", "]", ")", "+", "\": \"", "+", "arg_2", "[", "\"msg\"", "]", "+", "\" (\"", "+", "arg_2", "[", "\"ref\"", "]", "+", "\")\"", ")", "except", ":", "raise", "ServerError", "(", "\"Server returned error, but did not give a valid error message\"", ")", "raise", "arg_3", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Handles HTTP error codes for the given request\n\n        Raises:\n            AuthenticationError on the appropriate 4** errors\n            ServerError if the response is not an ok (2**)\n\n        Arguments:\n            r -- The request result\n        \"\"\"\n        if arg_1.status_code >= 400 and arg_1.status_code < 500:\n            arg_2 = arg_1.json()\n            raise AuthenticationError(str(arg_2[\"code\"]) + \": \" + arg_2[\"msg\"] +\n                                      \" (\" + arg_2[\"ref\"] + \")\")\n        elif arg_1.status_code > 300:\n            arg_3 = None\n            try:\n                arg_2 = arg_1.json()\n                arg_3 = ServerError(str(arg_2[\"code\"]) + \": \" + arg_2[\"msg\"] + \" (\" +\n                                  arg_2[\"ref\"] + \")\")\n            except:\n                raise ServerError(\n                    \"Server returned error, but did not give a valid error message\")\n            raise arg_3\n        return arg_1", "path": "connectordb/_connection.py", "identifier": "DatabaseConnection.handleresult", "docstring": "Handles HTTP error codes for the given request\n\n        Raises:\n            AuthenticationError on the appropriate 4** errors\n            ServerError if the response is not an ok (2**)\n\n        Arguments:\n            r -- The request result", "docstring_tokens": ["Handles", "HTTP", "error", "codes", "for", "the", "given", "request"], "nwo": "connectordb/connectordb-python", "score": 0.25890992733444657, "idx": 255552}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L638-L653", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Dump a file attachment to disk, with optional filename and path", "language": "python", "parameters": "(self, itemkey, filename=None, path=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", ".", "item", "(", "arg_1", ")", "[", "\"data\"", "]", "[", "\"filename\"", "]", "if", "arg_3", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_2", ")", "else", ":", "arg_4", "=", "arg_2", "arg_5", "=", "arg_0", ".", "file", "(", "arg_1", ")", "if", "arg_0", ".", "snapshot", ":", "arg_0", ".", "snapshot", "=", "False", "arg_4", "=", "arg_4", "+", "\".zip\"", "with", "open", "(", "arg_4", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n        Dump a file attachment to disk, with optional filename and path\n        \"\"\"\n        if not arg_2:\n            arg_2 = arg_0.item(arg_1)[\"data\"][\"filename\"]\n        if arg_3:\n            arg_4 = os.path.join(arg_3, arg_2)\n        else:\n            arg_4 = arg_2\n        arg_5 = arg_0.file(arg_1)\n        if arg_0.snapshot:\n            arg_0.snapshot = False\n            arg_4 = arg_4 + \".zip\"\n        with open(arg_4, \"wb\") as f:\n            f.write(arg_5)", "path": "pyzotero/zotero.py", "identifier": "Zotero.dump", "docstring": "Dump a file attachment to disk, with optional filename and path", "docstring_tokens": ["Dump", "a", "file", "attachment", "to", "disk", "with", "optional", "filename", "and", "path"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 255553}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/user.py#L67-L81", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Upgrade name type of this user.", "language": "python", "parameters": "(self, user_)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "name_type", ">", "arg_0", ".", "name_type", ":", "arg_0", ".", "full_name", "=", "arg_1", ".", "full_name", "arg_0", ".", "first_name", "=", "arg_1", ".", "first_name", "arg_0", ".", "name_type", "=", "arg_1", ".", "name_type", "logger", ".", "debug", "(", "'Added %s name to User \"%s\": %s'", ",", "arg_0", ".", "name_type", ".", "name", ".", "lower", "(", ")", ",", "arg_0", ".", "full_name", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Upgrade name type of this user.\n\n        Google Voice participants often first appear with no name at all, and\n        then get upgraded unpredictably to numbers (\"+12125551212\") or names.\n\n        Args:\n            user_ (~hangups.user.User): User to upgrade with.\n        \"\"\"\n        if arg_1.name_type > arg_0.name_type:\n            arg_0.full_name = arg_1.full_name\n            arg_0.first_name = arg_1.first_name\n            arg_0.name_type = arg_1.name_type\n            logger.debug('Added %s name to User \"%s\": %s',\n                         arg_0.name_type.name.lower(), arg_0.full_name, arg_0)", "path": "hangups/user.py", "identifier": "User.upgrade_name", "docstring": "Upgrade name type of this user.\n\n        Google Voice participants often first appear with no name at all, and\n        then get upgraded unpredictably to numbers (\"+12125551212\") or names.\n\n        Args:\n            user_ (~hangups.user.User): User to upgrade with.", "docstring_tokens": ["Upgrade", "name", "type", "of", "this", "user", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255554}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_spanner_hook.py#L291-L325", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Drops a database in Cloud Spanner.", "language": "python", "parameters": "(self, instance_id, database_id, project_id=None)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "_get_client", "(", "arg_3", "=", "arg_3", ")", ".", "arg_4", "(", "arg_1", "=", "arg_1", ")", "if", "not", "arg_4", ".", "exists", "(", ")", ":", "raise", "AirflowException", "(", "\"The instance {} does not exist in project {} !\"", ".", "format", "(", "arg_1", ",", "arg_3", ")", ")", "arg_5", "=", "arg_4", ".", "database", "(", "arg_2", "=", "arg_2", ")", "if", "not", "arg_5", ".", "exists", "(", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"The database {} is already deleted from instance {}. \"", "\"Exiting.\"", ".", "format", "(", "arg_2", ",", "arg_1", ")", ")", "return", "try", ":", "arg_6", "=", "arg_5", ".", "drop", "(", ")", "except", "GoogleAPICallError", "as", "e", ":", "arg_0", ".", "log", ".", "error", "(", "'An error occurred: %s. Exiting.'", ",", "e", ".", "message", ")", "raise", "e", "if", "arg_6", ":", "arg_7", "=", "arg_6", ".", "result", "(", ")", "arg_0", ".", "log", ".", "info", "(", "arg_7", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Drops a database in Cloud Spanner.\n\n        :type project_id: str\n        :param instance_id: The ID of the Cloud Spanner instance.\n        :type instance_id: str\n        :param database_id: The ID of the database in Cloud Spanner.\n        :type database_id: str\n        :param project_id: Optional, the ID of the  GCP project that owns the Cloud Spanner\n            database. If set to None or missing, the default project_id from the GCP connection is used.\n        :return: True if everything succeeded\n        :rtype: bool\n        \"\"\"\n\n        arg_4 = arg_0._get_client(arg_3=arg_3).\\\n            arg_4(arg_1=arg_1)\n        if not arg_4.exists():\n            raise AirflowException(\"The instance {} does not exist in project {} !\".\n                                   format(arg_1, arg_3))\n        arg_5 = arg_4.database(arg_2=arg_2)\n        if not arg_5.exists():\n            arg_0.log.info(\"The database {} is already deleted from instance {}. \"\n                          \"Exiting.\".format(arg_2, arg_1))\n            return\n        try:\n            arg_6 = arg_5.drop()  # type: Operation\n        except GoogleAPICallError as e:\n            arg_0.log.error('An error occurred: %s. Exiting.', e.message)\n            raise e\n\n        if arg_6:\n            arg_7 = arg_6.result()\n            arg_0.log.info(arg_7)\n        return", "path": "airflow/contrib/hooks/gcp_spanner_hook.py", "identifier": "CloudSpannerHook.delete_database", "docstring": "Drops a database in Cloud Spanner.\n\n        :type project_id: str\n        :param instance_id: The ID of the Cloud Spanner instance.\n        :type instance_id: str\n        :param database_id: The ID of the database in Cloud Spanner.\n        :type database_id: str\n        :param project_id: Optional, the ID of the  GCP project that owns the Cloud Spanner\n            database. If set to None or missing, the default project_id from the GCP connection is used.\n        :return: True if everything succeeded\n        :rtype: bool", "docstring_tokens": ["Drops", "a", "database", "in", "Cloud", "Spanner", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255555}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L46-L58", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Prepare locale dirs for writing po files.\n    Create new directories if they doesn't exist.", "language": "python", "parameters": "(languages, locale_root)", "return_statement": "return trans_languages", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", ":", "arg_5", "=", "arg_4", ".", "split", "(", "':'", ")", "[", "0", "]", "arg_2", ".", "append", "(", "arg_5", ")", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_5", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "os", ".", "makedirs", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Prepare locale dirs for writing po files.\n    Create new directories if they doesn't exist.\n    \"\"\"\n    arg_2 = []\n    for arg_3, arg_4 in enumerate(arg_0):\n        arg_5 = arg_4.split(':')[0]\n        arg_2.append(arg_5)\n        arg_6 = os.path.join(arg_1, arg_5)\n        if not os.path.exists(arg_6):\n            os.makedirs(arg_6)\n    return arg_2", "path": "c3po/converters/po_csv.py", "identifier": "_prepare_locale_dirs", "docstring": "Prepare locale dirs for writing po files.\n    Create new directories if they doesn't exist.", "docstring_tokens": ["Prepare", "locale", "dirs", "for", "writing", "po", "files", ".", "Create", "new", "directories", "if", "they", "doesn", "t", "exist", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 255556}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L492-L526", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return arithmetic-geometric mean.", "language": "python", "parameters": "(nums)", "return_statement": "return m_a", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "amean", "(", "arg_0", ")", "arg_2", "=", "gmean", "(", "arg_0", ")", "if", "math", ".", "isnan", "(", "arg_1", ")", "or", "math", ".", "isnan", "(", "arg_2", ")", ":", "return", "float", "(", "'nan'", ")", "while", "round", "(", "arg_1", ",", "12", ")", "!=", "round", "(", "arg_2", ",", "12", ")", ":", "arg_1", ",", "arg_2", "=", "(", "arg_1", "+", "arg_2", ")", "/", "2", ",", "(", "arg_1", "*", "arg_2", ")", "**", "(", "1", "/", "2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return arithmetic-geometric mean.\n\n    Iterates between arithmetic & geometric means until they converge to\n    a single value (rounded to 12 digits).\n\n    Cf. https://en.wikipedia.org/wiki/Arithmetic-geometric_mean\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    float\n        The arithmetic-geometric mean of nums\n\n    Examples\n    --------\n    >>> Func([1, 2, 3, 4])\n    2.3545004777751077\n    >>> Func([1, 2])\n    1.4567910310469068\n    >>> Func([0, 5, 1000])\n    2.9753977059954195e-13\n\n    \"\"\"\n    arg_1 = amean(arg_0)\n    arg_2 = gmean(arg_0)\n    if math.isnan(arg_1) or math.isnan(arg_2):\n        return float('nan')\n    while round(arg_1, 12) != round(arg_2, 12):\n        arg_1, arg_2 = (arg_1 + arg_2) / 2, (arg_1 * arg_2) ** (1 / 2)\n    return arg_1", "path": "abydos/stats/_mean.py", "identifier": "agmean", "docstring": "Return arithmetic-geometric mean.\n\n    Iterates between arithmetic & geometric means until they converge to\n    a single value (rounded to 12 digits).\n\n    Cf. https://en.wikipedia.org/wiki/Arithmetic-geometric_mean\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    float\n        The arithmetic-geometric mean of nums\n\n    Examples\n    --------\n    >>> agmean([1, 2, 3, 4])\n    2.3545004777751077\n    >>> agmean([1, 2])\n    1.4567910310469068\n    >>> agmean([0, 5, 1000])\n    2.9753977059954195e-13", "docstring_tokens": ["Return", "arithmetic", "-", "geometric", "mean", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 255557}
{"url": "https://github.com/ibm-watson-iot/iot-python/blob/195f05adce3fba4ec997017e41e02ebd85c0c4cc/src/wiotp/sdk/application/client.py#L137-L159", "sha": "195f05adce3fba4ec997017e41e02ebd85c0c4cc", "docstring_summary": "Subscribe to device command messages", "language": "python", "parameters": "(self, typeId=\"+\", deviceId=\"+\", commandId=\"+\", msgFormat=\"+\")", "return_statement": "return self._subscribe(topic, 0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"+\"", ",", "arg_2", "=", "\"+\"", ",", "arg_3", "=", "\"+\"", ",", "arg_4", "=", "\"+\"", ")", ":", "if", "arg_0", ".", "_config", ".", "isQuickstart", "(", ")", ":", "arg_0", ".", "logger", ".", "warning", "(", "\"QuickStart applications do not support commands\"", ")", "return", "0", "arg_5", "=", "\"iot-2/type/%s/id/%s/cmd/%s/fmt/%s\"", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "return", "arg_0", ".", "_subscribe", "(", "arg_5", ",", "0", ")"], "function": "def Func(arg_0, arg_1=\"+\", arg_2=\"+\", arg_3=\"+\", arg_4=\"+\"):\n        \"\"\"\n        Subscribe to device command messages\n\n        # Parameters\n        typeId (string): typeId for the subscription, optional.  Defaults to all device types (MQTT `+` wildcard)\n        deviceId (string): deviceId for the subscription, optional.  Defaults to all devices (MQTT `+` wildcard)\n        commandId (string): commandId for the subscription, optional.  Defaults to all commands (MQTT `+` wildcard)\n        msgFormat (string): msgFormat for the subscription, optional.  Defaults to all formats (MQTT `+` wildcard)\n        qos (int): MQTT quality of service level to use (`0`, `1`, or `2`)\n\n        # Returns\n        int: If the subscription was successful then the return Message ID (mid) for the subscribe request\n            will be returned. The mid value can be used to track the subscribe request by checking against\n            the mid argument if you register a subscriptionCallback method.\n            If the subscription fails then the return value will be `0`\n        \"\"\"\n        if arg_0._config.isQuickstart():\n            arg_0.logger.warning(\"QuickStart applications do not support commands\")\n            return 0\n\n        arg_5 = \"iot-2/type/%s/id/%s/cmd/%s/fmt/%s\" % (arg_1, arg_2, arg_3, arg_4)\n        return arg_0._subscribe(arg_5, 0)", "path": "src/wiotp/sdk/application/client.py", "identifier": "ApplicationClient.subscribeToDeviceCommands", "docstring": "Subscribe to device command messages\n\n        # Parameters\n        typeId (string): typeId for the subscription, optional.  Defaults to all device types (MQTT `+` wildcard)\n        deviceId (string): deviceId for the subscription, optional.  Defaults to all devices (MQTT `+` wildcard)\n        commandId (string): commandId for the subscription, optional.  Defaults to all commands (MQTT `+` wildcard)\n        msgFormat (string): msgFormat for the subscription, optional.  Defaults to all formats (MQTT `+` wildcard)\n        qos (int): MQTT quality of service level to use (`0`, `1`, or `2`)\n\n        # Returns\n        int: If the subscription was successful then the return Message ID (mid) for the subscribe request\n            will be returned. The mid value can be used to track the subscribe request by checking against\n            the mid argument if you register a subscriptionCallback method.\n            If the subscription fails then the return value will be `0`", "docstring_tokens": ["Subscribe", "to", "device", "command", "messages"], "nwo": "ibm-watson-iot/iot-python", "score": 0.6135771375083736, "idx": 255558}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/timer.py#L56-L61", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Start the timer.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_is_running", ":", "arg_0", ".", "_t_Func", "=", "time", "(", ")", "arg_0", ".", "_is_running", "=", "True", "arg_0", ".", "_t_last", "=", "time", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Start the timer.\"\"\"\n        if not arg_0._is_running:\n            arg_0._t_Func = time()\n            arg_0._is_running = True\n        arg_0._t_last = time()", "path": "mmcv/utils/timer.py", "identifier": "Timer.start", "docstring": "Start the timer.", "docstring_tokens": ["Start", "the", "timer", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 255559}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/views.py#L55-L71", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Performs filtering against the default queryset returned by\n            mongoengine.", "language": "python", "parameters": "(self, queryset, q)", "return_statement": "return queryset", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "mongoadmin", ".", "search_fields", "and", "arg_2", ":", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_0", ".", "mongoadmin", ".", "search_fields", ":", "if", "arg_4", "==", "'id'", ":", "if", "is_valid_object_id", "(", "arg_2", ")", ":", "return", "arg_1", ".", "filter", "(", "pk", "=", "arg_2", ")", "continue", "arg_5", "=", "\"{field}__icontains\"", ".", "format", "(", "arg_4", "=", "arg_4", ")", "arg_3", "[", "arg_5", "]", "=", "arg_2", "arg_1", "=", "arg_1", ".", "filter", "(", "**", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Performs filtering against the default queryset returned by\n            mongoengine.\n        \"\"\"\n        if arg_0.mongoadmin.search_fields and arg_2:\n            arg_3 = {}\n            for arg_4 in arg_0.mongoadmin.search_fields:\n                if arg_4 == 'id':\n                    # check to make sure this is a valid ID, otherwise we just continue\n                    if is_valid_object_id(arg_2):\n                        return arg_1.filter(pk=arg_2)\n                    continue\n                arg_5 = \"{field}__icontains\".format(arg_4=arg_4)\n                arg_3[arg_5] = arg_2\n\n            arg_1 = arg_1.filter(**arg_3)\n        return arg_1", "path": "mongonaut/views.py", "identifier": "DocumentListView.get_qset", "docstring": "Performs filtering against the default queryset returned by\n            mongoengine.", "docstring_tokens": ["Performs", "filtering", "against", "the", "default", "queryset", "returned", "by", "mongoengine", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 255560}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L677-L695", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get a list of most queried clans", "language": "python", "parameters": "(self, **params: keys)", "return_statement": "return self._get_model(url, PartialClan, **params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "api", ".", "POPULAR", "+", "'/clans'", "return", "arg_0", ".", "_get_model", "(", "arg_3", ",", "PartialClan", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1: arg_2):\n        \"\"\"Get a list of most queried clans\n\n        \\*\\*keys: Optional[list] = None\n            Filter which keys should be included in the\n            response\n        \\*\\*exclude: Optional[list] = None\n            Filter which keys should be excluded from the\n            response\n        \\*\\*max: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*page: Optional[int] = None\n            Works with max, the zero-based page of the\n            items\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_3 = arg_0.api.POPULAR + '/clans'\n        return arg_0._get_model(arg_3, PartialClan, **arg_1)", "path": "clashroyale/royaleapi/client.py", "identifier": "Client.get_popular_clans", "docstring": "Get a list of most queried clans\n\n        \\*\\*keys: Optional[list] = None\n            Filter which keys should be included in the\n            response\n        \\*\\*exclude: Optional[list] = None\n            Filter which keys should be excluded from the\n            response\n        \\*\\*max: Optional[int] = None\n            Limit the number of items returned in the response\n        \\*\\*page: Optional[int] = None\n            Works with max, the zero-based page of the\n            items\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "a", "list", "of", "most", "queried", "clans"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 255561}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/utils/tabulate.py#L498-L505", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Prefix every cell in a row with an HTML alignment attribute.", "language": "python", "parameters": "(row, colaligns)", "return_statement": "return row2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"left\"", ":", "''", ",", "\"right\"", ":", "'align=\"right\"| '", ",", "\"center\"", ":", "'align=\"center\"| '", ",", "\"decimal\"", ":", "'align=\"right\"| '", "}", "arg_3", "=", "[", "arg_2", "[", "a", "]", "+", "c", "for", "c", ",", "a", "in", "zip", "(", "arg_0", ",", "arg_1", ")", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"Prefix every cell in a row with an HTML alignment attribute.\"\n    arg_2 = {\"left\": '',\n                 \"right\": 'align=\"right\"| ',\n                 \"center\": 'align=\"center\"| ',\n                 \"decimal\": 'align=\"right\"| '}\n    arg_3 = [arg_2[a] + c for c, a in zip(arg_0, arg_1)]\n    return arg_3", "path": "solvebio/utils/tabulate.py", "identifier": "_mediawiki_cell_attrs", "docstring": "Prefix every cell in a row with an HTML alignment attribute.", "docstring_tokens": ["Prefix", "every", "cell", "in", "a", "row", "with", "an", "HTML", "alignment", "attribute", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 255562}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/txampext/constraints.py#L29-L36", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Converts the string to a value using the composed AMP argument, then\n        checks all the constraints against that value.", "language": "python", "parameters": "(self, string)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "baseArgument", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "_checkConstraints", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Converts the string to a value using the composed AMP argument, then\n        checks all the constraints against that value.\n        \"\"\"\n        arg_2 = arg_0.baseArgument.Func(arg_1)\n        arg_0._checkConstraints(arg_2)\n        return arg_2", "path": "txampext/constraints.py", "identifier": "ConstrainedArgument.fromString", "docstring": "Converts the string to a value using the composed AMP argument, then\n        checks all the constraints against that value.", "docstring_tokens": ["Converts", "the", "string", "to", "a", "value", "using", "the", "composed", "AMP", "argument", "then", "checks", "all", "the", "constraints", "against", "that", "value", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 255563}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/standard/ccx.py#L82-L84", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Apply Toffoli to from ctl1 and ctl2 to tgt.", "language": "python", "parameters": "(self, ctl1, ctl2, tgt)", "return_statement": "return self.append(ToffoliGate(), [ctl1, ctl2, tgt], [])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "arg_0", ".", "append", "(", "ToffoliGate", "(", ")", ",", "[", "arg_1", ",", "arg_2", ",", "arg_3", "]", ",", "[", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Apply Toffoli to from ctl1 and ctl2 to tgt.\"\"\"\n    return arg_0.append(ToffoliGate(), [arg_1, arg_2, arg_3], [])", "path": "qiskit/extensions/standard/ccx.py", "identifier": "ccx", "docstring": "Apply Toffoli to from ctl1 and ctl2 to tgt.", "docstring_tokens": ["Apply", "Toffoli", "to", "from", "ctl1", "and", "ctl2", "to", "tgt", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255564}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L401-L405", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read a list element from the input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "return _read_coll(ctx, llist.list, \")\", \"list\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "llist", ".", "List", ":", "arg_2", "=", "arg_0", ".", "reader", ".", "advance", "(", ")", "assert", "arg_2", "==", "\"(\"", "return", "_read_coll", "(", "arg_0", ",", "llist", ".", "list", ",", "\")\"", ",", "\"list\"", ")"], "function": "def Func(arg_0: arg_1) -> llist.List:\n    \"\"\"Read a list element from the input stream.\"\"\"\n    arg_2 = arg_0.reader.advance()\n    assert arg_2 == \"(\"\n    return _read_coll(arg_0, llist.list, \")\", \"list\")", "path": "src/basilisp/lang/reader.py", "identifier": "_read_list", "docstring": "Read a list element from the input stream.", "docstring_tokens": ["Read", "a", "list", "element", "from", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255565}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/adapter/__init__.py#L368-L456", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Interprets the HTTP response from the node.", "language": "python", "parameters": "(self, response, payload, expected_status)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "text", "if", "not", "arg_4", ":", "raise", "with_context", "(", "exc", "=", "BadApiResponse", "(", "'Empty {status} response from node.'", ".", "format", "(", "status", "=", "arg_1", ".", "status_code", ",", ")", ",", ")", ",", "context", "=", "{", "'request'", ":", "arg_2", ",", "}", ",", ")", "try", ":", "arg_5", "=", "json", ".", "loads", "(", "arg_4", ")", "except", "ValueError", ":", "raise", "with_context", "(", "exc", "=", "BadApiResponse", "(", "'Non-JSON {status} response from node: '", "'{raw_content}'", ".", "format", "(", "status", "=", "arg_1", ".", "status_code", ",", "arg_4", "=", "arg_4", ",", ")", ")", ",", "context", "=", "{", "'request'", ":", "arg_2", ",", "'raw_response'", ":", "arg_4", ",", "}", ",", ")", "if", "not", "isinstance", "(", "arg_5", ",", "dict", ")", ":", "raise", "with_context", "(", "exc", "=", "BadApiResponse", "(", "'Malformed {status} response from node: {decoded!r}'", ".", "format", "(", "status", "=", "arg_1", ".", "status_code", ",", "arg_5", "=", "arg_5", ",", ")", ",", ")", ",", "context", "=", "{", "'request'", ":", "arg_2", ",", "'response'", ":", "arg_5", ",", "}", ",", ")", "if", "arg_1", ".", "status_code", "in", "arg_3", ":", "return", "arg_5", "arg_6", "=", "None", "try", ":", "if", "arg_1", ".", "status_code", "==", "codes", "[", "'bad_request'", "]", ":", "arg_6", "=", "arg_5", "[", "'error'", "]", "elif", "arg_1", ".", "status_code", "==", "codes", "[", "'internal_server_error'", "]", ":", "arg_6", "=", "arg_5", "[", "'exception'", "]", "except", "KeyError", ":", "pass", "raise", "with_context", "(", "exc", "=", "BadApiResponse", "(", "'{status} response from node: {error}'", ".", "format", "(", "arg_6", "=", "arg_6", "or", "arg_5", ",", "status", "=", "arg_1", ".", "status_code", ",", ")", ",", ")", ",", "context", "=", "{", "'request'", ":", "arg_2", ",", "'response'", ":", "arg_5", ",", "}", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        # type: (Response, dict, Container[int]) -> dict\n        \"\"\"\n        Interprets the HTTP response from the node.\n\n        :param response:\n            The response object received from\n            :py:meth:`_send_http_request`.\n\n        :param payload:\n            The request payload that was sent (used for debugging).\n\n        :param expected_status:\n            The response should match one of these status codes to be\n            considered valid.\n        \"\"\"\n        arg_4 = arg_1.text\n        if not arg_4:\n            raise with_context(\n                exc=BadApiResponse(\n                    'Empty {status} response from node.'.format(\n                        status=arg_1.status_code,\n                    ),\n                ),\n\n                context={\n                    'request': arg_2,\n                },\n            )\n\n        try:\n            arg_5 = json.loads(arg_4)  # type: dict\n        # :bc: py2k doesn't have JSONDecodeError\n        except ValueError:\n            raise with_context(\n                exc=BadApiResponse(\n                    'Non-JSON {status} response from node: '\n                    '{raw_content}'.format(\n                        status=arg_1.status_code,\n                        arg_4=arg_4,\n                    )\n                ),\n\n                context={\n                    'request': arg_2,\n                    'raw_response': arg_4,\n                },\n            )\n\n        if not isinstance(arg_5, dict):\n            raise with_context(\n                exc=BadApiResponse(\n                    'Malformed {status} response from node: {decoded!r}'.format(\n                        status=arg_1.status_code,\n                        arg_5=arg_5,\n                    ),\n                ),\n\n                context={\n                    'request': arg_2,\n                    'response': arg_5,\n                },\n            )\n\n        if arg_1.status_code in arg_3:\n            return arg_5\n\n        arg_6 = None\n        try:\n            if arg_1.status_code == codes['bad_request']:\n                arg_6 = arg_5['error']\n            elif arg_1.status_code == codes['internal_server_error']:\n                arg_6 = arg_5['exception']\n        except KeyError:\n            pass\n\n        raise with_context(\n            exc=BadApiResponse(\n                '{status} response from node: {error}'.format(\n                    arg_6=arg_6 or arg_5,\n                    status=arg_1.status_code,\n                ),\n            ),\n\n            context={\n                'request': arg_2,\n                'response': arg_5,\n            },\n        )", "path": "iota/adapter/__init__.py", "identifier": "HttpAdapter._interpret_response", "docstring": "Interprets the HTTP response from the node.\n\n        :param response:\n            The response object received from\n            :py:meth:`_send_http_request`.\n\n        :param payload:\n            The request payload that was sent (used for debugging).\n\n        :param expected_status:\n            The response should match one of these status codes to be\n            considered valid.", "docstring_tokens": ["Interprets", "the", "HTTP", "response", "from", "the", "node", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 255566}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/mixins/geo.py#L157-L195", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Plot the image with MatplotLib", "language": "python", "parameters": "(self, spec=\"rgb\", **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"rgb\"", ",", "**", "arg_2", ")", ":", "if", "arg_0", ".", "shape", "[", "0", "]", "==", "1", "or", "(", "\"bands\"", "in", "arg_2", "and", "len", "(", "arg_2", "[", "\"bands\"", "]", ")", "==", "1", ")", ":", "if", "\"cmap\"", "in", "arg_2", ":", "arg_3", "=", "arg_2", "[", "\"cmap\"", "]", "del", "arg_2", "[", "\"cmap\"", "]", "else", ":", "arg_3", "=", "\"Greys_r\"", "arg_0", ".", "_Func", "(", "tfm", "=", "arg_0", ".", "_single_band", ",", "arg_3", "=", "arg_3", ",", "**", "arg_2", ")", "else", ":", "if", "arg_1", "==", "\"rgb\"", "and", "arg_0", ".", "_has_token", "(", "**", "arg_2", ")", ":", "arg_0", ".", "_Func", "(", "tfm", "=", "arg_0", ".", "rgb", ",", "**", "arg_2", ")", "else", ":", "arg_0", ".", "_Func", "(", "tfm", "=", "getattr", "(", "arg_0", ",", "arg_1", ")", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1=\"rgb\", **arg_2):\n        ''' Plot the image with MatFuncLib\n\n        Plot sizing includes default borders and spacing. If the image is shown in Jupyter the outside whitespace will be automatically cropped to save size, resulting in a smaller sized image than expected.\n\n        Histogram options:\n            * 'equalize': performs histogram equalization on the image.\n            * 'minmax': stretch the pixel range to the minimum and maximum input pixel values. Equivalent to stretch=[0,100].\n            * 'match': match the histogram to the Maps API imagery. Pass the additional keyword blm_source='browse' to match to the Browse Service (image thumbnail) instead.\n            * 'ignore': Skip dynamic range adjustment, in the event the image is already correctly balanced and the values are in the correct range.\n            \n        Gamma values greater than 1 will brighten the image midtones, values less than 1 will darken the midtones.\n\n        Plots generated with the histogram options of 'match' and 'equalize' can be combined with the stretch and gamma options. The stretch and gamma adjustments will be applied after the histogram adjustments.\n        \n        Args:\n            w (float or int): width of Func in inches at 72 dpi, default is 10\n            h (float or int): height of Func in inches at 72 dpi, default is 10\n            title (str): Title to use on the Func\n            fontsize (int): Size of title font, default is 22. Size is measured in points.\n            bands (list): bands to use for Functing, such as bands=[4,2,1]. Defaults to the image's natural RGB bands. This option is useful for generating pseudocolor images when passed a list of three bands. If only a single band is provided, a colormapped Func will be generated instead.\n            cmap (str): MatPlotLib colormap name to use for single band images. Default is colormap='Grey_R'.\n            histogram (str): either 'equalize', 'minmax', 'match', or ignore\n            stretch (list): stretch the histogram between two percentile values, default is [2,98]\n            gamma (float): adjust image gamma, default is 1.0\n        '''\n\n        if arg_0.shape[0] == 1 or (\"bands\" in arg_2 and len(arg_2[\"bands\"]) == 1):\n            if \"cmap\" in arg_2:\n                arg_3 = arg_2[\"cmap\"]\n                del arg_2[\"cmap\"]\n            else:\n                arg_3 = \"Greys_r\"\n            arg_0._Func(tfm=arg_0._single_band, arg_3=arg_3, **arg_2)\n        else:\n            if arg_1 == \"rgb\" and arg_0._has_token(**arg_2):\n                arg_0._Func(tfm=arg_0.rgb, **arg_2)\n            else:\n                arg_0._Func(tfm=getattr(arg_0, arg_1), **arg_2)", "path": "gbdxtools/images/mixins/geo.py", "identifier": "PlotMixin.plot", "docstring": "Plot the image with MatplotLib\n\n        Plot sizing includes default borders and spacing. If the image is shown in Jupyter the outside whitespace will be automatically cropped to save size, resulting in a smaller sized image than expected.\n\n        Histogram options:\n            * 'equalize': performs histogram equalization on the image.\n            * 'minmax': stretch the pixel range to the minimum and maximum input pixel values. Equivalent to stretch=[0,100].\n            * 'match': match the histogram to the Maps API imagery. Pass the additional keyword blm_source='browse' to match to the Browse Service (image thumbnail) instead.\n            * 'ignore': Skip dynamic range adjustment, in the event the image is already correctly balanced and the values are in the correct range.\n            \n        Gamma values greater than 1 will brighten the image midtones, values less than 1 will darken the midtones.\n\n        Plots generated with the histogram options of 'match' and 'equalize' can be combined with the stretch and gamma options. The stretch and gamma adjustments will be applied after the histogram adjustments.\n        \n        Args:\n            w (float or int): width of plot in inches at 72 dpi, default is 10\n            h (float or int): height of plot in inches at 72 dpi, default is 10\n            title (str): Title to use on the plot\n            fontsize (int): Size of title font, default is 22. Size is measured in points.\n            bands (list): bands to use for plotting, such as bands=[4,2,1]. Defaults to the image's natural RGB bands. This option is useful for generating pseudocolor images when passed a list of three bands. If only a single band is provided, a colormapped plot will be generated instead.\n            cmap (str): MatPlotLib colormap name to use for single band images. Default is colormap='Grey_R'.\n            histogram (str): either 'equalize', 'minmax', 'match', or ignore\n            stretch (list): stretch the histogram between two percentile values, default is [2,98]\n            gamma (float): adjust image gamma, default is 1.0", "docstring_tokens": ["Plot", "the", "image", "with", "MatplotLib"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 255567}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L1781-L1791", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Read prefix code array", "language": "python", "parameters": "(self, kind, numberOfTrees)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "range", "(", "arg_2", ")", ":", "if", "arg_1", "==", "L", ":", "arg_5", "=", "LiteralAlphabet", "(", "arg_4", ")", "elif", "arg_1", "==", "I", ":", "arg_5", "=", "InsertAndCopyAlphabet", "(", "arg_4", ")", "elif", "arg_1", "==", "D", ":", "arg_5", "=", "DistanceAlphabet", "(", "arg_4", ",", "NPOSTFIX", "=", "arg_0", ".", "NPOSTFIX", ",", "NDIRECT", "=", "arg_0", ".", "NDIRECT", ")", "arg_0", ".", "readPrefixCode", "(", "arg_5", ")", "arg_3", ".", "append", "(", "arg_5", ")", "arg_0", ".", "prefixCodes", "[", "arg_1", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Read prefix code array\"\"\"\n        arg_3 = []\n        for arg_4 in range(arg_2):\n            if arg_1==L: arg_5 = LiteralAlphabet(arg_4)\n            elif arg_1==I: arg_5 = InsertAndCopyAlphabet(arg_4)\n            elif arg_1==D: arg_5 = DistanceAlphabet(\n                arg_4, NPOSTFIX=arg_0.NPOSTFIX, NDIRECT=arg_0.NDIRECT)\n            arg_0.readPrefixCode(arg_5)\n            arg_3.append(arg_5)\n        arg_0.prefixCodes[arg_1] = arg_3", "path": "research/brotlidump.py", "identifier": "Layout.readPrefixArray", "docstring": "Read prefix code array", "docstring_tokens": ["Read", "prefix", "code", "array"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 255568}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/utils.py#L234-L262", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Align the end of the hierarchies such that they end at the same exact\n    second as long they have the same duration within a certain threshold.", "language": "python", "parameters": "(hier1, hier2, thres=0.5)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.5", ")", ":", "arg_3", "=", "arg_0", "[", "0", "]", "[", "-", "1", "]", "for", "arg_4", "in", "arg_0", ":", "assert", "arg_4", "[", "-", "1", "]", "==", "arg_3", ",", "\"hier1 is not correctly \"", "\"formatted {} {}\"", ".", "format", "(", "arg_4", "[", "-", "1", "]", ",", "arg_3", ")", "arg_5", "=", "arg_1", "[", "0", "]", "[", "-", "1", "]", "for", "arg_4", "in", "arg_1", ":", "assert", "arg_4", "[", "-", "1", "]", "==", "arg_5", ",", "\"hier2 is not correctly formatted\"", "if", "abs", "(", "arg_3", "-", "arg_5", ")", ">", "arg_2", ":", "return", "for", "arg_4", "in", "arg_0", ":", "arg_4", "[", "-", "1", "]", "=", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=0.5):\n    \"\"\"Align the end of the hierarchies such that they end at the same exact\n    second as long they have the same duration within a certain threshold.\n\n    Parameters\n    ----------\n    hier1: list\n        List containing hierarchical segment boundaries.\n    hier2: list\n        List containing hierarchical segment boundaries.\n    thres: float > 0\n        Threshold to decide whether two values are the same.\n    \"\"\"\n    # Make sure we have correctly formatted hierarchies\n    arg_3 = arg_0[0][-1]\n    for arg_4 in arg_0:\n        assert arg_4[-1] == arg_3, \"hier1 is not correctly \" \\\n            \"formatted {} {}\".format(arg_4[-1], arg_3)\n    arg_5 = arg_1[0][-1]\n    for arg_4 in arg_1:\n        assert arg_4[-1] == arg_5, \"hier2 is not correctly formatted\"\n\n    # If durations are different, do nothing\n    if abs(arg_3 - arg_5) > arg_2:\n        return\n\n    # Align h1 with h2\n    for arg_4 in arg_0:\n        arg_4[-1] = arg_5", "path": "msaf/utils.py", "identifier": "align_end_hierarchies", "docstring": "Align the end of the hierarchies such that they end at the same exact\n    second as long they have the same duration within a certain threshold.\n\n    Parameters\n    ----------\n    hier1: list\n        List containing hierarchical segment boundaries.\n    hier2: list\n        List containing hierarchical segment boundaries.\n    thres: float > 0\n        Threshold to decide whether two values are the same.", "docstring_tokens": ["Align", "the", "end", "of", "the", "hierarchies", "such", "that", "they", "end", "at", "the", "same", "exact", "second", "as", "long", "they", "have", "the", "same", "duration", "within", "a", "certain", "threshold", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 255569}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L863-L875", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Export as a ``cryptography`` certificate signing request.", "language": "python", "parameters": "(self)", "return_statement": "return _CertificateSigningRequest(backend, self._req)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "cryptography", ".", "hazmat", ".", "backends", ".", "openssl", ".", "x509", "import", "(", "_CertificateSigningRequest", ")", "arg_1", "=", "_get_backend", "(", ")", "return", "_CertificateSigningRequest", "(", "arg_1", ",", "arg_0", ".", "_req", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Export as a ``cryptography`` certificate signing request.\n\n        :rtype: ``cryptography.x509.CertificateSigningRequest``\n\n        .. versionadded:: 17.1.0\n        \"\"\"\n        from cryptography.hazmat.backends.openssl.x509 import (\n            _CertificateSigningRequest\n        )\n        arg_1 = _get_backend()\n        return _CertificateSigningRequest(arg_1, arg_0._req)", "path": "src/OpenSSL/crypto.py", "identifier": "X509Req.to_cryptography", "docstring": "Export as a ``cryptography`` certificate signing request.\n\n        :rtype: ``cryptography.x509.CertificateSigningRequest``\n\n        .. versionadded:: 17.1.0", "docstring_tokens": ["Export", "as", "a", "cryptography", "certificate", "signing", "request", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 255570}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/host.py#L121-L165", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Returns the first working combination of username and password for the current host.", "language": "python", "parameters": "(self, usernames=None, host_strings=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "local_renderer", "if", "arg_2", "is", "None", ":", "arg_2", "=", "[", "]", "if", "not", "arg_2", ":", "arg_2", ".", "append", "(", "arg_0", ".", "genv", ".", "host_string", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "]", "if", "not", "arg_1", ":", "arg_1", ".", "append", "(", "arg_0", ".", "genv", ".", "user", ")", "for", "arg_4", "in", "arg_2", ":", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "[", "]", "arg_6", ".", "append", "(", "arg_0", ".", "genv", ".", "user_default_passwords", "[", "arg_5", "]", ")", "arg_6", ".", "append", "(", "arg_0", ".", "genv", ".", "user_passwords", "[", "arg_5", "]", ")", "arg_6", ".", "append", "(", "arg_0", ".", "env", ".", "default_password", ")", "for", "arg_7", "in", "arg_6", ":", "with", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_3", ".", "env", ".", "host_string", "=", "arg_4", "arg_3", ".", "env", ".", "password", "=", "arg_7", "arg_3", ".", "env", ".", "user", "=", "arg_5", "arg_10", "=", "arg_3", ".", "_local", "(", "\"sshpass -p '{password}' ssh -o StrictHostKeyChecking=no {user}@{host_string} echo hello\"", ",", "capture", "=", "True", ")", "if", "arg_10", ".", "return_code", "in", "(", "1", ",", "6", ")", "or", "'hello'", "in", "arg_10", ":", "return", "arg_4", ",", "arg_5", ",", "arg_7", "raise", "Exception", "(", "'No working login found.'", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Returns the first working combination of username and password for the current host.\n        \"\"\"\n        arg_3 = arg_0.local_renderer\n\n        if arg_2 is None:\n            arg_2 = []\n\n        if not arg_2:\n            arg_2.append(arg_0.genv.host_string)\n\n        if arg_1 is None:\n            arg_1 = []\n\n        if not arg_1:\n            arg_1.append(arg_0.genv.user)\n\n        for arg_4 in arg_2:\n\n            for arg_5 in arg_1:\n\n                arg_6 = []\n                arg_6.append(arg_0.genv.user_default_passwords[arg_5])\n                arg_6.append(arg_0.genv.user_passwords[arg_5])\n                arg_6.append(arg_0.env.default_password)\n\n                for arg_7 in arg_6:\n\n                    with settings(warn_only=True):\n                        arg_3.env.host_string = arg_4\n                        arg_3.env.password = arg_7\n                        arg_3.env.user = arg_5\n                        arg_10 = arg_3._local(\"sshpass -p '{password}' ssh -o StrictHostKeyChecking=no {user}@{host_string} echo hello\", capture=True)\n                        #print('ret.return_code:', ret.return_code)\n            #             print('ret000:[%s]' % ret)\n                        #code 1 = good password, but prompts needed\n                        #code 5 = bad password\n                        #code 6 = good password, but host public key is unknown\n\n                    if arg_10.return_code in (1, 6) or 'hello' in arg_10:\n                        # Login succeeded, so we haven't yet changed the password, so use the default password.\n                        return arg_4, arg_5, arg_7\n\n        raise Exception('No working login found.')", "path": "burlap/host.py", "identifier": "HostSatchel.find_working_password", "docstring": "Returns the first working combination of username and password for the current host.", "docstring_tokens": ["Returns", "the", "first", "working", "combination", "of", "username", "and", "password", "for", "the", "current", "host", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 255571}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/uxpath/functions.py#L224-L237", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Yields one boolean, false if the argument sequence is empty, otherwise", "language": "python", "parameters": "(ctx, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_1", ",", "'compute'", ")", ":", "arg_1", "=", "next", "(", "seq", ".", "compute", "(", "arg_0", ")", ",", "''", ")", "else", ":", "arg_1", "=", "seq", "yield", "next", "(", "to_Func", "(", "arg_1", ")", ",", "''", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Yields one Func, false if the argument sequence is empty, otherwise\n\n    * false if the first item is a Func and false\n    * false if the first item is a number and positive or negative zero or NaN\n    * false if the first item is a string and ''\n    * true in all other cases\n    '''\n    if hasattr(arg_1, 'compute'):\n        arg_1 = next(seq.compute(arg_0), '')\n    else:\n        arg_1 = seq\n    yield next(to_Func(arg_1), '')", "path": "pylib/uxml/uxpath/functions.py", "identifier": "boolean", "docstring": "Yields one boolean, false if the argument sequence is empty, otherwise\n\n    * false if the first item is a boolean and false\n    * false if the first item is a number and positive or negative zero or NaN\n    * false if the first item is a string and ''\n    * true in all other cases", "docstring_tokens": ["Yields", "one", "boolean", "false", "if", "the", "argument", "sequence", "is", "empty", "otherwise"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 255572}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/forms/forms.py#L123-L148", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Given document generates a dictionary representation of the document.\n        Includes the widget for each for each field in the document.", "language": "python", "parameters": "(self, document, document_key=None,\n                                                        owner_document=None)", "return_statement": "return doc_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "create_doc_dict", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "for", "arg_5", ",", "arg_6", "in", "arg_4", ".", "items", "(", ")", ":", "if", "arg_5", ".", "startswith", "(", "\"_\"", ")", ":", "continue", "if", "isinstance", "(", "arg_6", ",", "ListField", ")", ":", "arg_4", "[", "arg_5", "]", "=", "arg_0", ".", "create_list_dict", "(", "arg_1", ",", "arg_6", ",", "arg_5", ")", "elif", "isinstance", "(", "arg_6", ",", "EmbeddedDocumentField", ")", ":", "arg_4", "[", "arg_5", "]", "=", "arg_0", ".", "Func", "(", "arg_4", "[", "arg_5", "]", ".", "document_type_obj", ",", "arg_5", ")", "else", ":", "arg_4", "[", "arg_5", "]", "=", "{", "\"_document\"", ":", "arg_1", ",", "\"_key\"", ":", "arg_5", ",", "\"_document_field\"", ":", "arg_6", ",", "\"_widget\"", ":", "get_widget", "(", "arg_4", "[", "arg_5", "]", ",", "getattr", "(", "arg_6", ",", "'disabled'", ",", "False", ")", ")", "}", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                                                        arg_3=None):\n        \"\"\"\n        Given document generates a dictionary representation of the document.\n        Includes the widget for each for each field in the document.\n        \"\"\"\n        arg_4 = arg_0.create_doc_dict(arg_1, arg_2, arg_3)\n\n        for arg_5, arg_6 in arg_4.items():\n            # Base fields should not be evaluated\n            if arg_5.startswith(\"_\"):\n                continue\n\n            if isinstance(arg_6, ListField):\n                arg_4[arg_5] = arg_0.create_list_dict(arg_1, arg_6, arg_5)\n\n            elif isinstance(arg_6, EmbeddedDocumentField):\n                arg_4[arg_5] = arg_0.Func(arg_4[arg_5].document_type_obj,\n                                                                    arg_5)\n            else:\n                arg_4[arg_5] = {\"_document\": arg_1,\n                                     \"_key\": arg_5,\n                                     \"_document_field\": arg_6,\n                                     \"_widget\": get_widget(arg_4[arg_5], getattr(arg_6, 'disabled', False))}\n\n        return arg_4", "path": "mongonaut/forms/forms.py", "identifier": "MongoModelForm.create_document_dictionary", "docstring": "Given document generates a dictionary representation of the document.\n        Includes the widget for each for each field in the document.", "docstring_tokens": ["Given", "document", "generates", "a", "dictionary", "representation", "of", "the", "document", ".", "Includes", "the", "widget", "for", "each", "for", "each", "field", "in", "the", "document", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 255573}
{"url": "https://github.com/ellmetha/neojsonrpc/blob/e369b633a727482d5f9e310f0c3337ae5f7265db/neojsonrpc/client.py#L226-L238", "sha": "e369b633a727482d5f9e310f0c3337ae5f7265db", "docstring_summary": "Returns the transaction output information corresponding to a hash and index.", "language": "python", "parameters": "(self, tx_hash, index, **kwargs)", "return_statement": "return self._call(JSONRPCMethods.GET_TX_OUT.value, params=[tx_hash, index, ], **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "_call", "(", "JSONRPCMethods", ".", "GET_TX_OUT", ".", "value", ",", "params", "=", "[", "arg_1", ",", "arg_2", ",", "]", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\" Returns the transaction output information corresponding to a hash and index.\n\n        :param tx_hash: transaction hash\n        :param index:\n            index of the transaction output to be obtained in the transaction (starts from 0)\n        :type tx_hash: str\n        :type index: int\n        :return: dictionary containing the transaction output\n        :rtype: dict\n\n        \"\"\"\n        return arg_0._call(JSONRPCMethods.GET_TX_OUT.value, params=[arg_1, arg_2, ], **arg_3)", "path": "neojsonrpc/client.py", "identifier": "Client.get_tx_out", "docstring": "Returns the transaction output information corresponding to a hash and index.\n\n        :param tx_hash: transaction hash\n        :param index:\n            index of the transaction output to be obtained in the transaction (starts from 0)\n        :type tx_hash: str\n        :type index: int\n        :return: dictionary containing the transaction output\n        :rtype: dict", "docstring_tokens": ["Returns", "the", "transaction", "output", "information", "corresponding", "to", "a", "hash", "and", "index", "."], "nwo": "ellmetha/neojsonrpc", "score": 0.3393344119717767, "idx": 255574}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/read.py#L190-L244", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Crops image to a smaller size", "language": "python", "parameters": "(image, slices, copy=True)", "return_statement": "return new_img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "check_img", "(", "arg_0", ")", "arg_4", "=", "arg_3", ".", "get_data", "(", ")", "arg_5", "=", "arg_3", ".", "get_affine", "(", ")", "arg_6", "=", "arg_4", "[", "arg_1", "]", "if", "arg_2", ":", "arg_6", "=", "arg_6", ".", "copy", "(", ")", "arg_7", "=", "arg_5", "[", ":", "3", ",", ":", "3", "]", "arg_8", "=", "arg_5", "[", ":", "3", ",", "3", "]", "arg_9", "=", "np", ".", "array", "(", "[", "s", ".", "start", "for", "s", "in", "arg_1", "]", ")", "arg_10", "=", "arg_8", "+", "arg_7", ".", "dot", "(", "arg_9", ")", "arg_11", "=", "np", ".", "eye", "(", "4", ")", "arg_11", "[", ":", "3", ",", ":", "3", "]", "=", "arg_7", "arg_11", "[", ":", "3", ",", "3", "]", "=", "arg_10", "arg_12", "=", "nib", ".", "Nifti1Image", "(", "arg_6", ",", "arg_11", ")", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"Crops image to a smaller size\n\n    Crop img to size indicated by slices and modify the affine accordingly.\n\n    Parameters\n    ----------\n    image: img-like object or str\n        Can either be:\n        - a file path to a Nifti image\n        - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.\n        If niimg is a string, consider it as a path to Nifti image and\n        call nibabel.load on it. If it is an object, check if get_data()\n        and get_affine() methods are present, raise TypeError otherwise.\n\n        Image to be cropped.\n\n    slices: list of slices\n        Defines the range of the crop.\n        E.g. [slice(20, 200), slice(40, 150), slice(0, 100)]\n        defines a 3D cube\n\n        If slices has less entries than image has dimensions,\n        the slices will be applied to the first len(slices) dimensions.\n\n    copy: boolean\n        Specifies whether cropped data is to be copied or not.\n        Default: True\n\n    Returns\n    -------\n    cropped_img: img-like object\n        Cropped version of the input image\n    \"\"\"\n\n    arg_3    = check_img(arg_0)\n    arg_4   = arg_3.get_data()\n    arg_5 = arg_3.get_affine()\n\n    arg_6 = arg_4[arg_1]\n    if arg_2:\n        arg_6   = arg_6.copy()\n\n    arg_7        = arg_5[:3, :3]\n    arg_8         = arg_5[:3,  3]\n    arg_9   = np.array([s.start for s in arg_1])\n    arg_10         = arg_8 + arg_7.dot(arg_9)\n\n    arg_11         = np.eye(4)\n    arg_11[:3, :3] = arg_7\n    arg_11[:3,  3] = arg_10\n\n    arg_12 = nib.Nifti1Image(arg_6, arg_11)\n\n    return arg_12", "path": "boyle/nifti/read.py", "identifier": "_crop_img_to", "docstring": "Crops image to a smaller size\n\n    Crop img to size indicated by slices and modify the affine accordingly.\n\n    Parameters\n    ----------\n    image: img-like object or str\n        Can either be:\n        - a file path to a Nifti image\n        - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.\n        If niimg is a string, consider it as a path to Nifti image and\n        call nibabel.load on it. If it is an object, check if get_data()\n        and get_affine() methods are present, raise TypeError otherwise.\n\n        Image to be cropped.\n\n    slices: list of slices\n        Defines the range of the crop.\n        E.g. [slice(20, 200), slice(40, 150), slice(0, 100)]\n        defines a 3D cube\n\n        If slices has less entries than image has dimensions,\n        the slices will be applied to the first len(slices) dimensions.\n\n    copy: boolean\n        Specifies whether cropped data is to be copied or not.\n        Default: True\n\n    Returns\n    -------\n    cropped_img: img-like object\n        Cropped version of the input image", "docstring_tokens": ["Crops", "image", "to", "a", "smaller", "size"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255575}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/account.py#L196-L200", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Add an other account to the blacklist of this account", "language": "python", "parameters": "(self, account)", "return_statement": "return self.blockchain.account_whitelist(account, lists=[\"black\"], account=self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "callable", "(", "arg_0", ".", "blockchain", ".", "account_whitelist", ")", "return", "arg_0", ".", "blockchain", ".", "account_whitelist", "(", "arg_1", ",", "lists", "=", "[", "\"black\"", "]", ",", "arg_1", "=", "arg_0", ")"], "function": "def Func(arg_0, arg_1):  # pragma: no cover\n        \"\"\" Add an other account to the Func of this account\n        \"\"\"\n        assert callable(arg_0.blockchain.account_whitelist)\n        return arg_0.blockchain.account_whitelist(arg_1, lists=[\"black\"], arg_1=arg_0)", "path": "graphenecommon/account.py", "identifier": "Account.blacklist", "docstring": "Add an other account to the blacklist of this account", "docstring_tokens": ["Add", "an", "other", "account", "to", "the", "blacklist", "of", "this", "account"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 255576}
{"url": "https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L94-L101", "sha": "6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851", "docstring_summary": "Adds new tweets to the cache.", "language": "python", "parameters": "(self, url, last_modified, tweets)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "arg_0", ".", "cache", "[", "arg_1", "]", "=", "{", "\"last_modified\"", ":", "arg_2", ",", "\"tweets\"", ":", "arg_3", "}", "arg_0", ".", "mark_updated", "(", ")", "return", "True", "except", "TypeError", ":", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Adds new tweets to the cache.\"\"\"\n        try:\n            arg_0.cache[arg_1] = {\"last_modified\": arg_2, \"tweets\": arg_3}\n            arg_0.mark_updated()\n            return True\n        except TypeError:\n            return False", "path": "twtxt/cache.py", "identifier": "Cache.add_tweets", "docstring": "Adds new tweets to the cache.", "docstring_tokens": ["Adds", "new", "tweets", "to", "the", "cache", "."], "nwo": "buckket/twtxt", "score": 0.5783854231140674, "idx": 255577}
{"url": "https://github.com/zinic/pynsive/blob/15bc8b35a91be5817979eb327427b6235b1b411e/pynsive/plugin/loader.py#L93-L100", "sha": "15bc8b35a91be5817979eb327427b6235b1b411e", "docstring_summary": "Adds a path to search through when attempting to look up a module.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "paths", ":", "arg_0", ".", "paths", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adds a path to search through when attempting to look up a module.\n\n        :param path: the path the add to the list of searchable paths\n        \"\"\"\n        if arg_1 not in arg_0.paths:\n            arg_0.paths.append(arg_1)", "path": "pynsive/plugin/loader.py", "identifier": "ModuleFinder.add_path", "docstring": "Adds a path to search through when attempting to look up a module.\n\n        :param path: the path the add to the list of searchable paths", "docstring_tokens": ["Adds", "a", "path", "to", "search", "through", "when", "attempting", "to", "look", "up", "a", "module", "."], "nwo": "zinic/pynsive", "score": 0.23137166388621372, "idx": 255578}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/IGCI.py#L59-L79", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Integral approximation estimator for causal inference.", "language": "python", "parameters": "(x, y)", "return_statement": "return (a - b)/len(x)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "(", "0.", ",", "0.", ")", "arg_0", "=", "np", ".", "array", "(", "arg_0", ")", "arg_1", "=", "np", ".", "array", "(", "arg_1", ")", "arg_4", ",", "arg_5", "=", "(", "np", ".", "argsort", "(", "arg_0", ")", ",", "np", ".", "argsort", "(", "arg_1", ")", ")", "for", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "in", "zip", "(", "arg_0", "[", "[", "arg_4", "]", "]", "[", ":", "-", "1", "]", ",", "arg_0", "[", "[", "arg_4", "]", "]", "[", "1", ":", "]", ",", "arg_1", "[", "[", "arg_4", "]", "]", "[", ":", "-", "1", "]", ",", "arg_1", "[", "[", "arg_4", "]", "]", "[", "1", ":", "]", ")", ":", "if", "arg_6", "!=", "arg_7", "and", "arg_8", "!=", "arg_9", ":", "arg_2", "=", "arg_2", "+", "np", ".", "log", "(", "np", ".", "abs", "(", "(", "arg_9", "-", "arg_8", ")", "/", "(", "arg_7", "-", "arg_6", ")", ")", ")", "for", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "in", "zip", "(", "arg_0", "[", "[", "arg_5", "]", "]", "[", ":", "-", "1", "]", ",", "arg_0", "[", "[", "arg_5", "]", "]", "[", "1", ":", "]", ",", "arg_1", "[", "[", "arg_5", "]", "]", "[", ":", "-", "1", "]", ",", "arg_1", "[", "[", "arg_5", "]", "]", "[", "1", ":", "]", ")", ":", "if", "arg_6", "!=", "arg_7", "and", "arg_8", "!=", "arg_9", ":", "arg_3", "=", "arg_3", "+", "np", ".", "log", "(", "np", ".", "abs", "(", "(", "arg_7", "-", "arg_6", ")", "/", "(", "arg_9", "-", "arg_8", ")", ")", ")", "return", "(", "arg_2", "-", "arg_3", ")", "/", "len", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Integral approximation estimator for causal inference.\n\n    :param x: input variable x 1D\n    :param y: input variable y 1D\n    :return: Return value of the IGCI model >0 if x->y otherwise if return <0\n    \"\"\"\n    arg_2, arg_3 = (0., 0.)\n    arg_0 = np.array(arg_0)\n    arg_1 = np.array(arg_1)\n    arg_4, arg_5 = (np.argsort(arg_0), np.argsort(arg_1))\n\n    for arg_6, arg_7, arg_8, arg_9 in zip(arg_0[[arg_4]][:-1], arg_0[[arg_4]][1:], arg_1[[arg_4]][:-1], arg_1[[arg_4]][1:]):\n        if arg_6 != arg_7 and arg_8 != arg_9:\n            arg_2 = arg_2 + np.log(np.abs((arg_9 - arg_8) / (arg_7 - arg_6)))\n\n    for arg_6, arg_7, arg_8, arg_9 in zip(arg_0[[arg_5]][:-1], arg_0[[arg_5]][1:], arg_1[[arg_5]][:-1], arg_1[[arg_5]][1:]):\n        if arg_6 != arg_7 and arg_8 != arg_9:\n            arg_3 = arg_3 + np.log(np.abs((arg_7 - arg_6) / (arg_9 - arg_8)))\n\n    return (arg_2 - arg_3)/len(arg_0)", "path": "cdt/causality/pairwise/IGCI.py", "identifier": "integral_approx_estimator", "docstring": "Integral approximation estimator for causal inference.\n\n    :param x: input variable x 1D\n    :param y: input variable y 1D\n    :return: Return value of the IGCI model >0 if x->y otherwise if return <0", "docstring_tokens": ["Integral", "approximation", "estimator", "for", "causal", "inference", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 255579}
{"url": "https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L324-L353", "sha": "86dc1ab27ce82dcc091ce127416cc3ee219e9bec", "docstring_summary": "Parses ssh-dsa public keys.", "language": "python", "parameters": "(self, data)", "return_statement": "return current_position", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "0", "for", "arg_4", "in", "(", "\"p\"", ",", "\"q\"", ",", "\"g\"", ",", "\"y\"", ")", ":", "arg_3", ",", "arg_5", "=", "arg_0", ".", "_unpack_by_int", "(", "arg_1", ",", "arg_3", ")", "arg_2", "[", "arg_4", "]", "=", "arg_0", ".", "_parse_long", "(", "arg_5", ")", "arg_6", "=", "arg_0", ".", "_bits_in_number", "(", "arg_2", "[", "\"q\"", "]", ")", "arg_7", "=", "arg_0", ".", "_bits_in_number", "(", "arg_2", "[", "\"p\"", "]", ")", "if", "arg_6", "!=", "arg_0", ".", "DSA_N_LENGTH", ":", "raise", "InvalidKeyError", "(", "\"Incorrect DSA key parameters: bits(p)=%s, q=%s\"", "%", "(", "arg_0", ".", "bits", ",", "arg_6", ")", ")", "if", "arg_0", ".", "strict_mode", ":", "arg_8", "=", "arg_0", ".", "DSA_MIN_LENGTH_STRICT", "arg_9", "=", "arg_0", ".", "DSA_MAX_LENGTH_STRICT", "else", ":", "arg_8", "=", "arg_0", ".", "DSA_MIN_LENGTH_LOOSE", "arg_9", "=", "arg_0", ".", "DSA_MAX_LENGTH_LOOSE", "if", "arg_7", "<", "arg_8", ":", "raise", "TooShortKeyError", "(", "\"%s key can not be shorter than %s bits (was %s)\"", "%", "(", "arg_0", ".", "key_type", ",", "arg_8", ",", "arg_7", ")", ")", "if", "arg_7", ">", "arg_9", ":", "raise", "TooLongKeyError", "(", "\"%s key data can not be longer than %s bits (was %s)\"", "%", "(", "arg_0", ".", "key_type", ",", "arg_9", ",", "arg_7", ")", ")", "arg_10", "=", "DSAParameterNumbers", "(", "arg_2", "[", "\"p\"", "]", ",", "arg_2", "[", "\"q\"", "]", ",", "arg_2", "[", "\"g\"", "]", ")", "arg_0", ".", "dsa", "=", "DSAPublicNumbers", "(", "arg_2", "[", "\"y\"", "]", ",", "arg_10", ")", ".", "public_key", "(", "default_backend", "(", ")", ")", "arg_0", ".", "bits", "=", "arg_0", ".", "dsa", ".", "key_size", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses ssh-dsa public keys.\"\"\"\n        arg_2 = {}\n        arg_3 = 0\n        for arg_4 in (\"p\", \"q\", \"g\", \"y\"):\n            arg_3, arg_5 = arg_0._unpack_by_int(arg_1, arg_3)\n            arg_2[arg_4] = arg_0._parse_long(arg_5)\n\n        arg_6 = arg_0._bits_in_number(arg_2[\"q\"])\n        arg_7 = arg_0._bits_in_number(arg_2[\"p\"])\n        if arg_6 != arg_0.DSA_N_LENGTH:\n            raise InvalidKeyError(\"Incorrect DSA key parameters: bits(p)=%s, q=%s\" % (arg_0.bits, arg_6))\n        if arg_0.strict_mode:\n            arg_8 = arg_0.DSA_MIN_LENGTH_STRICT\n            arg_9 = arg_0.DSA_MAX_LENGTH_STRICT\n        else:\n            arg_8 = arg_0.DSA_MIN_LENGTH_LOOSE\n            arg_9 = arg_0.DSA_MAX_LENGTH_LOOSE\n        if arg_7 < arg_8:\n            raise TooShortKeyError(\"%s key can not be shorter than %s bits (was %s)\" % (arg_0.key_type, arg_8, arg_7))\n        if arg_7 > arg_9:\n            raise TooLongKeyError(\n                \"%s key data can not be longer than %s bits (was %s)\" % (arg_0.key_type, arg_9, arg_7)\n            )\n\n        arg_10 = DSAParameterNumbers(arg_2[\"p\"], arg_2[\"q\"], arg_2[\"g\"])\n        arg_0.dsa = DSAPublicNumbers(arg_2[\"y\"], arg_10).public_key(default_backend())\n        arg_0.bits = arg_0.dsa.key_size\n\n        return arg_3", "path": "sshpubkeys/keys.py", "identifier": "SSHKey._process_ssh_dss", "docstring": "Parses ssh-dsa public keys.", "docstring_tokens": ["Parses", "ssh", "-", "dsa", "public", "keys", "."], "nwo": "ojarva/python-sshpubkeys", "score": 0.19584428074165744, "idx": 255580}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L262-L265", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "``True`` if notification level for this conversation is quiet.", "language": "python", "parameters": "(self)", "return_statement": "return level == hangouts_pb2.NOTIFICATION_LEVEL_QUIET", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_conversation", ".", "self_conversation_state", ".", "notification_level", "return", "arg_1", "==", "hangouts_pb2", ".", "NOTIFICATION_LEVEL_QUIET"], "function": "def Func(arg_0):\n        \"\"\"``True`` if notification level for this conversation is quiet.\"\"\"\n        arg_1 = arg_0._conversation.self_conversation_state.notification_level\n        return arg_1 == hangouts_pb2.NOTIFICATION_LEVEL_QUIET", "path": "hangups/conversation.py", "identifier": "Conversation.is_quiet", "docstring": "``True`` if notification level for this conversation is quiet.", "docstring_tokens": ["True", "if", "notification", "level", "for", "this", "conversation", "is", "quiet", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255581}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/controllers.py#L30-L86", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update an existing gene panel with genes.", "language": "python", "parameters": "(store, panel_name, csv_lines, option)", "return_statement": "return panel_obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "arg_0", ".", "gene_panel", "(", "arg_1", ")", "if", "arg_5", "is", "None", ":", "return", "None", "try", ":", "arg_4", "=", "parse_genes", "(", "arg_2", ")", "except", "SyntaxError", "as", "error", ":", "flash", "(", "error", ".", "args", "[", "0", "]", ",", "'danger'", ")", "return", "None", "if", "arg_3", "==", "'replace'", ":", "for", "arg_6", "in", "arg_5", "[", "'genes'", "]", ":", "arg_6", "[", "'hgnc_symbol'", "]", "=", "arg_6", "[", "'symbol'", "]", "arg_0", ".", "add_pending", "(", "arg_5", ",", "arg_6", ",", "arg_10", "=", "'delete'", ",", "info", "=", "None", ")", "for", "arg_7", "in", "arg_4", ":", "if", "not", "arg_7", "[", "'hgnc_id'", "]", ":", "flash", "(", "\"gene missing hgnc id: {}\"", ".", "format", "(", "arg_7", "[", "'hgnc_symbol'", "]", ")", ",", "'danger'", ")", "continue", "arg_8", "=", "arg_0", ".", "hgnc_gene", "(", "arg_7", "[", "'hgnc_id'", "]", ")", "if", "arg_8", "is", "None", ":", "flash", "(", "\"gene not found: {} - {}\"", ".", "format", "(", "arg_7", "[", "'hgnc_id'", "]", ",", "arg_7", "[", "'hgnc_symbol'", "]", ")", ",", "'danger'", ")", "continue", "if", "arg_7", "[", "'hgnc_symbol'", "]", "and", "arg_8", "[", "'hgnc_symbol'", "]", "!=", "arg_7", "[", "'hgnc_symbol'", "]", ":", "flash", "(", "\"symbol mis-match: {0} | {1}\"", ".", "format", "(", "arg_8", "[", "'hgnc_symbol'", "]", ",", "arg_7", "[", "'hgnc_symbol'", "]", ")", ",", "'warning'", ")", "arg_9", "=", "{", "'disease_associated_transcripts'", ":", "arg_7", "[", "'transcripts'", "]", ",", "'reduced_penetrance'", ":", "arg_7", "[", "'reduced_penetrance'", "]", ",", "'mosaicism'", ":", "arg_7", "[", "'mosaicism'", "]", ",", "'inheritance_models'", ":", "arg_7", "[", "'inheritance_models'", "]", ",", "'database_entry_version'", ":", "arg_7", "[", "'database_entry_version'", "]", ",", "}", "if", "arg_3", "==", "'replace'", ":", "arg_10", "=", "'add'", "else", ":", "arg_11", "=", "{", "arg_6", "[", "'hgnc_id'", "]", "for", "arg_6", "in", "arg_5", "[", "'genes'", "]", "}", "arg_10", "=", "'edit'", "if", "arg_8", "[", "'hgnc_id'", "]", "in", "arg_11", "else", "'add'", "arg_0", ".", "add_pending", "(", "arg_5", ",", "arg_8", ",", "arg_10", "=", "arg_10", ",", "info", "=", "arg_9", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Update an existing gene panel with genes.\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        panel_name(str)\n        csv_lines(iterable(str)): Stream with genes\n        option(str): 'add' or 'replace'\n\n    Returns:\n        panel_obj(dict)\n    \"\"\"\n    arg_4= []\n    arg_5 = arg_0.gene_panel(arg_1)\n    if arg_5 is None:\n        return None\n    try:\n        arg_4 = parse_genes(arg_2) # a list of gene dictionaries containing gene info\n    except SyntaxError as error:\n        flash(error.args[0], 'danger')\n        return None\n\n    # if existing genes are to be replaced by those in csv_lines\n    if arg_3 == 'replace':\n        # all existing genes should be deleted\n        for arg_6 in arg_5['genes']:\n            #create extra key to use in pending actions:\n            arg_6['hgnc_symbol'] = arg_6['symbol']\n            arg_0.add_pending(arg_5, arg_6, arg_10='delete', info=None)\n\n    for arg_7 in arg_4:\n        if not arg_7['hgnc_id']:\n            flash(\"gene missing hgnc id: {}\".format(arg_7['hgnc_symbol']),'danger')\n            continue\n        arg_8 = arg_0.hgnc_gene(arg_7['hgnc_id'])\n        if arg_8 is None:\n            flash(\"gene not found: {} - {}\".format(arg_7['hgnc_id'], arg_7['hgnc_symbol']),'danger')\n            continue\n        if arg_7['hgnc_symbol'] and arg_8['hgnc_symbol'] != arg_7['hgnc_symbol']:\n            flash(\"symbol mis-match: {0} | {1}\".format(\n                arg_8['hgnc_symbol'], arg_7['hgnc_symbol']), 'warning')\n\n        arg_9 = {\n            'disease_associated_transcripts': arg_7['transcripts'],\n            'reduced_penetrance': arg_7['reduced_penetrance'],\n            'mosaicism': arg_7['mosaicism'],\n            'inheritance_models': arg_7['inheritance_models'],\n            'database_entry_version': arg_7['database_entry_version'],\n        }\n        if arg_3 == 'replace': # there will be no existing genes for sure, because we're replacing them all\n            arg_10 = 'add'\n        else: # add option. Add if genes is not existing. otherwise edit it\n            arg_11 = {arg_6['hgnc_id'] for arg_6 in arg_5['genes']}\n            arg_10 = 'edit' if arg_8['hgnc_id'] in arg_11 else 'add'\n        arg_0.add_pending(arg_5, arg_8, arg_10=arg_10, info=arg_9)\n\n    return arg_5", "path": "scout/server/blueprints/panels/controllers.py", "identifier": "update_panel", "docstring": "Update an existing gene panel with genes.\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        panel_name(str)\n        csv_lines(iterable(str)): Stream with genes\n        option(str): 'add' or 'replace'\n\n    Returns:\n        panel_obj(dict)", "docstring_tokens": ["Update", "an", "existing", "gene", "panel", "with", "genes", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 255582}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L475-L515", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Evaluates the minimum coverage threshold from the value provided in\n    the coverage_opt.", "language": "python", "parameters": "(coverage_opt, assembly_coverage, assembly_size)", "return_statement": "return min_coverage", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", "==", "\"auto\"", ":", "arg_3", "=", "(", "arg_1", "/", "arg_2", ")", "*", ".3", "logger", ".", "info", "(", "\"Minimum assembly coverage automatically set to: \"", "\"{}\"", ".", "format", "(", "arg_3", ")", ")", "if", "arg_3", "<", "10", ":", "logger", ".", "info", "(", "\"Minimum assembly coverage cannot be set to lower\"", "\" that 10. Setting to 10\"", ")", "arg_3", "=", "10", "else", ":", "arg_3", "=", "int", "(", "arg_0", ")", "logger", ".", "info", "(", "\"Minimum assembly coverage manually set to: {}\"", ".", "format", "(", "arg_3", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Evaluates the minimum coverage threshold from the value provided in\n    the coverage_opt.\n\n    Parameters\n    ----------\n    coverage_opt : str or int or float\n        If set to \"auto\" it will try to automatically determine the coverage\n        to 1/3 of the assembly size, to a minimum value of 10. If it set\n        to a int or float, the specified value will be used.\n    assembly_coverage : int or float\n        The average assembly coverage for a genome assembly. This value\n        is retrieved by the `:py:func:parse_coverage_table` function.\n    assembly_size : int\n        The size of the genome assembly. This value is retrieved by the\n        `py:func:get_assembly_size` function.\n\n    Returns\n    -------\n    x: int\n        Minimum coverage threshold.\n\n    \"\"\"\n\n    if arg_0 == \"auto\":\n        # Get the 1/3 value of the current assembly coverage\n        arg_3 = (arg_1 / arg_2) * .3\n        logger.info(\"Minimum assembly coverage automatically set to: \"\n                    \"{}\".format(arg_3))\n        # If the 1/3 coverage is lower than 10, change it to the minimum of\n        # 10\n        if arg_3 < 10:\n            logger.info(\"Minimum assembly coverage cannot be set to lower\"\n                        \" that 10. Setting to 10\")\n            arg_3 = 10\n    else:\n        arg_3 = int(arg_0)\n        logger.info(\"Minimum assembly coverage manually set to: {}\".format(\n            arg_3))\n\n    return arg_3", "path": "flowcraft/templates/process_assembly_mapping.py", "identifier": "evaluate_min_coverage", "docstring": "Evaluates the minimum coverage threshold from the value provided in\n    the coverage_opt.\n\n    Parameters\n    ----------\n    coverage_opt : str or int or float\n        If set to \"auto\" it will try to automatically determine the coverage\n        to 1/3 of the assembly size, to a minimum value of 10. If it set\n        to a int or float, the specified value will be used.\n    assembly_coverage : int or float\n        The average assembly coverage for a genome assembly. This value\n        is retrieved by the `:py:func:parse_coverage_table` function.\n    assembly_size : int\n        The size of the genome assembly. This value is retrieved by the\n        `py:func:get_assembly_size` function.\n\n    Returns\n    -------\n    x: int\n        Minimum coverage threshold.", "docstring_tokens": ["Evaluates", "the", "minimum", "coverage", "threshold", "from", "the", "value", "provided", "in", "the", "coverage_opt", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 255583}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/players.py#L142-L157", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Gets a stats table from the player page; helper function that does\n        the work for per-game, per-100-poss, etc. stats.", "language": "python", "parameters": "(self, table_id, kind='R', summary=False)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'R'", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_0", ".", "get_main_doc", "(", ")", "arg_1", "=", "'table#{}{}'", ".", "format", "(", "'playoffs_'", "if", "arg_2", "==", "'P'", "else", "''", ",", "arg_1", ")", "arg_5", "=", "arg_4", "(", "arg_1", ")", "arg_6", "=", "sportsref", ".", "utils", ".", "parse_table", "(", "arg_5", ",", "flatten", "=", "(", "not", "arg_3", ")", ",", "footer", "=", "arg_3", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2='R', arg_3=False):\n        \"\"\"Gets a stats table from the player page; helper function that does\n        the work for per-game, per-100-poss, etc. stats.\n\n        :table_id: the ID of the HTML table.\n        :kind: specifies regular season, playoffs, or both. One of 'R', 'P',\n            'B'. Defaults to 'R'.\n        :returns: A DataFrame of stats.\n        \"\"\"\n        arg_4 = arg_0.get_main_doc()\n        arg_1 = 'table#{}{}'.format(\n            'playoffs_' if arg_2 == 'P' else '', arg_1)\n        arg_5 = arg_4(arg_1)\n        arg_6 = sportsref.utils.parse_table(arg_5, flatten=(not arg_3),\n                                         footer=arg_3)\n        return arg_6", "path": "sportsref/nba/players.py", "identifier": "Player._get_stats_table", "docstring": "Gets a stats table from the player page; helper function that does\n        the work for per-game, per-100-poss, etc. stats.\n\n        :table_id: the ID of the HTML table.\n        :kind: specifies regular season, playoffs, or both. One of 'R', 'P',\n            'B'. Defaults to 'R'.\n        :returns: A DataFrame of stats.", "docstring_tokens": ["Gets", "a", "stats", "table", "from", "the", "player", "page", ";", "helper", "function", "that", "does", "the", "work", "for", "per", "-", "game", "per", "-", "100", "-", "poss", "etc", ".", "stats", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 255584}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L456-L472", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Get a community based on its name.", "language": "python", "parameters": "(self, name, token=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "dict", "(", ")", "arg_3", "[", "'name'", "]", "=", "arg_1", "if", "arg_2", ":", "arg_3", "[", "'token'", "]", "=", "arg_2", "arg_4", "=", "arg_0", ".", "request", "(", "'midas.community.get'", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Get a community based on its name.\n\n        :param name: The name of the target community.\n        :type name: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: The requested community.\n        :rtype: dict\n        \"\"\"\n        arg_3 = dict()\n        arg_3['name'] = arg_1\n        if arg_2:\n            arg_3['token'] = arg_2\n        arg_4 = arg_0.request('midas.community.get', arg_3)\n        return arg_4", "path": "pydas/drivers.py", "identifier": "CoreDriver.get_community_by_name", "docstring": "Get a community based on its name.\n\n        :param name: The name of the target community.\n        :type name: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: The requested community.\n        :rtype: dict", "docstring_tokens": ["Get", "a", "community", "based", "on", "its", "name", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 255585}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/backreferences.py#L70-L82", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Get the shortest possible module name", "language": "python", "parameters": "(module_name, obj_name)", "return_statement": "return short_name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "split", "(", "'.'", ")", "arg_3", "=", "arg_0", "for", "arg_4", "in", "range", "(", "len", "(", "arg_2", ")", "-", "1", ",", "0", ",", "-", "1", ")", ":", "arg_3", "=", "'.'", ".", "join", "(", "arg_2", "[", ":", "arg_4", "]", ")", "try", ":", "exec", "(", "'from %s import %s'", "%", "(", "arg_3", ",", "arg_1", ")", ")", "except", "ImportError", ":", "arg_3", "=", "'.'", ".", "join", "(", "arg_2", "[", ":", "(", "arg_4", "+", "1", ")", "]", ")", "break", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Get the shortest possible module name \"\"\"\n    arg_2 = arg_0.split('.')\n    arg_3 = arg_0\n    for arg_4 in range(len(arg_2) - 1, 0, -1):\n        arg_3 = '.'.join(arg_2[:arg_4])\n        try:\n            exec('from %s import %s' % (arg_3, arg_1))\n        except ImportError:\n            # get the last working module name\n            arg_3 = '.'.join(arg_2[:(arg_4 + 1)])\n            break\n    return arg_3", "path": "doc/sphinxext/sphinx_gallery/backreferences.py", "identifier": "get_short_module_name", "docstring": "Get the shortest possible module name", "docstring_tokens": ["Get", "the", "shortest", "possible", "module", "name"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 255586}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/processing.py#L127-L159", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Concatenate multiple videos into a single one.", "language": "python", "parameters": "(video_list,\n                 out_file,\n                 vcodec=None,\n                 acodec=None,\n                 log_level='info',\n                 print_cmd=False,\n                 **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'info'", ",", "arg_5", "=", "False", ",", "**", "arg_6", ")", ":", "arg_7", ",", "arg_8", "=", "tempfile", ".", "mkstemp", "(", "suffix", "=", "'.txt'", ",", "text", "=", "True", ")", "with", "open", "(", "arg_8", ",", "'w'", ")", "as", "f", ":", "for", "arg_9", "in", "arg_0", ":", "f", ".", "write", "(", "'file {}\\n'", ".", "format", "(", "osp", ".", "abspath", "(", "arg_9", ")", ")", ")", "arg_10", "=", "{", "'log_level'", ":", "arg_4", "}", "if", "arg_2", "is", "None", ":", "arg_10", "[", "'vcodec'", "]", "=", "'copy'", "if", "arg_3", "is", "None", ":", "arg_10", "[", "'acodec'", "]", "=", "'copy'", "convert_video", "(", "arg_8", ",", "arg_1", ",", "arg_5", ",", "pre_options", "=", "'-f concat -safe 0'", ",", "**", "arg_10", ")", "os", ".", "remove", "(", "arg_8", ")"], "function": "def Func(arg_0,\n                 arg_1,\n                 arg_2=None,\n                 arg_3=None,\n                 arg_4='info',\n                 arg_5=False,\n                 **arg_6):\n    \"\"\"Concatenate multiple videos into a single one.\n\n    Args:\n        video_list (list): A list of video filenames\n        out_file (str): Output video filename\n        vcodec (None or str): Output video codec, None for unchanged\n        acodec (None or str): Output audio codec, None for unchanged\n        log_level (str): Logging level of ffmpeg.\n        print_cmd (bool): Whether to print the final ffmpeg command.\n    \"\"\"\n    arg_7, arg_8 = tempfile.mkstemp(suffix='.txt', text=True)\n    with open(arg_8, 'w') as f:\n        for arg_9 in arg_0:\n            f.write('file {}\\n'.format(osp.abspath(arg_9)))\n    arg_10 = {'log_level': arg_4}\n    if arg_2 is None:\n        arg_10['vcodec'] = 'copy'\n    if arg_3 is None:\n        arg_10['acodec'] = 'copy'\n    convert_video(\n        arg_8,\n        arg_1,\n        arg_5,\n        pre_options='-f concat -safe 0',\n        **arg_10)\n    os.remove(arg_8)", "path": "mmcv/video/processing.py", "identifier": "concat_video", "docstring": "Concatenate multiple videos into a single one.\n\n    Args:\n        video_list (list): A list of video filenames\n        out_file (str): Output video filename\n        vcodec (None or str): Output video codec, None for unchanged\n        acodec (None or str): Output audio codec, None for unchanged\n        log_level (str): Logging level of ffmpeg.\n        print_cmd (bool): Whether to print the final ffmpeg command.", "docstring_tokens": ["Concatenate", "multiple", "videos", "into", "a", "single", "one", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 255587}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/security_groups.py#L176-L191", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Updates a SG rule async and return the job information.", "language": "python", "parameters": "(context, id, db_sg_group, rule_id, action)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "None", "arg_6", "=", "sg_rpc_api", ".", "QuarkSGAsyncProcessClient", "(", ")", "arg_7", "=", "db_api", ".", "sg_gather_associated_ports", "(", "arg_0", ",", "arg_2", ")", "if", "len", "(", "arg_7", ")", ">", "0", ":", "arg_5", "=", "arg_6", ".", "start_update", "(", "arg_0", ",", "arg_1", ",", "arg_3", ",", "arg_4", ")", "if", "arg_5", ":", "arg_8", "=", "arg_5", "[", "'job_id'", "]", "job_api", ".", "add_job_to_context", "(", "arg_0", ",", "arg_8", ")", "else", ":", "LOG", ".", "error", "(", "\"Async update failed. Is the worker running?\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Updates a SG rule async and return the job information.\n\n    Only happens if the security group has associated ports. If the async\n    connection fails the update continues (legacy mode).\n    \"\"\"\n    arg_5 = None\n    arg_6 = sg_rpc_api.QuarkSGAsyncProcessClient()\n    arg_7 = db_api.sg_gather_associated_ports(arg_0, arg_2)\n    if len(arg_7) > 0:\n        arg_5 = arg_6.start_update(arg_0, arg_1, arg_3, arg_4)\n        if arg_5:\n            arg_8 = arg_5['job_id']\n            job_api.add_job_to_context(arg_0, arg_8)\n        else:\n            LOG.error(\"Async update failed. Is the worker running?\")", "path": "quark/plugin_modules/security_groups.py", "identifier": "_perform_async_update_rule", "docstring": "Updates a SG rule async and return the job information.\n\n    Only happens if the security group has associated ports. If the async\n    connection fails the update continues (legacy mode).", "docstring_tokens": ["Updates", "a", "SG", "rule", "async", "and", "return", "the", "job", "information", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255588}
{"url": "https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L480-L494", "sha": "2a725df0b727e8b08f217ab84f7b8243c42554f5", "docstring_summary": "Returns full country name for specified IP address.", "language": "python", "parameters": "(self, addr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "const", ".", "COUNTRY_EDITION", ",", "const", ".", "COUNTRY_EDITION_V6", ")", "if", "arg_0", ".", "_databaseType", "in", "arg_2", ":", "arg_3", "=", "arg_0", ".", "id_by_addr", "(", "arg_1", ")", "return", "const", ".", "COUNTRY_NAMES", "[", "arg_3", "]", "elif", "arg_0", ".", "_databaseType", "in", "const", ".", "CITY_EDITIONS", ":", "return", "arg_0", ".", "record_by_addr", "(", "arg_1", ")", ".", "get", "(", "'country_name'", ")", "else", ":", "arg_4", "=", "'Invalid database type, expected Country or City'", "raise", "GeoIPError", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns full country name for specified IP address.\n\n        :arg addr: IP address (e.g. 203.0.113.30)\n        \"\"\"\n        arg_2 = (const.COUNTRY_EDITION, const.COUNTRY_EDITION_V6)\n        if arg_0._databaseType in arg_2:\n            arg_3 = arg_0.id_by_addr(arg_1)\n            return const.COUNTRY_NAMES[arg_3]\n        elif arg_0._databaseType in const.CITY_EDITIONS:\n            return arg_0.record_by_addr(arg_1).get('country_name')\n        else:\n            arg_4 = 'Invalid database type, expected Country or City'\n            raise GeoIPError(arg_4)", "path": "pygeoip/__init__.py", "identifier": "GeoIP.country_name_by_addr", "docstring": "Returns full country name for specified IP address.\n\n        :arg addr: IP address (e.g. 203.0.113.30)", "docstring_tokens": ["Returns", "full", "country", "name", "for", "specified", "IP", "address", "."], "nwo": "appliedsec/pygeoip", "score": 0.7204224841353906, "idx": 255589}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L241-L245", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Returns a of FloatingIP object by its IP address.", "language": "python", "parameters": "(self, ip)", "return_statement": "return FloatingIP.get_object(api_token=self.token, ip=ip)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "FloatingIP", ".", "get_object", "(", "api_token", "=", "arg_0", ".", "token", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Returns a of FloatingIP object by its IP address.\n        \"\"\"\n        return FloatingIP.get_object(api_token=arg_0.token, arg_1=arg_1)", "path": "digitalocean/Manager.py", "identifier": "Manager.get_floating_ip", "docstring": "Returns a of FloatingIP object by its IP address.", "docstring_tokens": ["Returns", "a", "of", "FloatingIP", "object", "by", "its", "IP", "address", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 255590}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L298-L311", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Maximum temperature of all disks making up the volume", "language": "python", "parameters": "(self, volume)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_0", ".", "_get_volume", "(", "arg_1", ")", "if", "arg_1", "is", "not", "None", ":", "arg_2", "=", "arg_1", "[", "\"disks\"", "]", "if", "arg_2", "is", "not", "None", ":", "arg_3", "=", "0", "for", "arg_4", "in", "arg_2", ":", "arg_5", "=", "arg_0", ".", "disk_temp", "(", "arg_4", ")", "if", "arg_5", "is", "not", "None", "and", "arg_5", ">", "arg_3", ":", "arg_3", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Maximum temperature of all disks making up the volume\"\"\"\r\n        arg_1 = arg_0._get_volume(arg_1)\r\n        if arg_1 is not None:\r\n            arg_2 = arg_1[\"disks\"]\r\n            if arg_2 is not None:\r\n                arg_3 = 0\r\n\r\n                for arg_4 in arg_2:\r\n                    arg_5 = arg_0.disk_temp(arg_4)\r\n                    if arg_5 is not None and arg_5 > arg_3:\r\n                        arg_3 = arg_5\r\n\r\n                return arg_3", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynoStorage.volume_disk_temp_max", "docstring": "Maximum temperature of all disks making up the volume", "docstring_tokens": ["Maximum", "temperature", "of", "all", "disks", "making", "up", "the", "volume"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 255591}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/lmm/_lmm.py#L250-L262", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Enable parameter optimization.", "language": "python", "parameters": "(self, param)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "==", "\"delta\"", ":", "arg_0", ".", "_Func", "(", "\"logistic\"", ")", "else", ":", "arg_0", ".", "_fix", "[", "arg_1", "]", "=", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Enable parameter optimization.\n\n        Parameters\n        ----------\n        param : str\n            Possible values are ``\"delta\"``, ``\"beta\"``, and ``\"scale\"``.\n        \"\"\"\n        if arg_1 == \"delta\":\n            arg_0._Func(\"logistic\")\n        else:\n            arg_0._fix[arg_1] = False", "path": "glimix_core/lmm/_lmm.py", "identifier": "LMM.unfix", "docstring": "Enable parameter optimization.\n\n        Parameters\n        ----------\n        param : str\n            Possible values are ``\"delta\"``, ``\"beta\"``, and ``\"scale\"``.", "docstring_tokens": ["Enable", "parameter", "optimization", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 255592}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/project/application/__init__.py#L31-L76", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Create Flask app.", "language": "python", "parameters": "()", "return_statement": "return app", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "load_config", "(", ")", "arg_1", "=", "Flask", "(", "__name__", ")", "arg_1", ".", "config", ".", "from_object", "(", "arg_0", ")", "arg_1", ".", "wsgi_app", "=", "ProxyFix", "(", "arg_1", ".", "wsgi_app", ")", "CsrfProtect", "(", "arg_1", ")", "if", "arg_1", ".", "debug", "or", "arg_1", ".", "testing", ":", "DebugToolbarExtension", "(", "arg_1", ")", "arg_1", ".", "wsgi_app", "=", "SharedDataMiddleware", "(", "arg_1", ".", "wsgi_app", ",", "{", "'/pages'", ":", "os", ".", "path", ".", "join", "(", "arg_1", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'application/pages'", ")", "}", ")", "else", ":", "arg_1", ".", "logger", ".", "addHandler", "(", "logging", ".", "StreamHandler", "(", ")", ")", "arg_1", ".", "logger", ".", "setLevel", "(", "logging", ".", "ERROR", ")", "if", "arg_1", ".", "config", ".", "get", "(", "'SENTRY_DSN'", ")", ":", "from", ".", "utils", ".", "sentry", "import", "sentry", "sentry", ".", "init_app", "(", "arg_1", ",", "dsn", "=", "arg_1", ".", "config", ".", "get", "(", "'SENTRY_DSN'", ")", ")", "arg_1", ".", "wsgi_app", "=", "SharedDataMiddleware", "(", "arg_1", ".", "wsgi_app", ",", "{", "'/static'", ":", "os", ".", "path", ".", "join", "(", "arg_1", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'output/static'", ")", ",", "'/pkg'", ":", "os", ".", "path", ".", "join", "(", "arg_1", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'output/pkg'", ")", ",", "'/pages'", ":", "os", ".", "path", ".", "join", "(", "arg_1", ".", "config", ".", "get", "(", "'PROJECT_PATH'", ")", ",", "'output/pages'", ")", "}", ")", "register_db", "(", "arg_1", ")", "register_routes", "(", "arg_1", ")", "register_jinja", "(", "arg_1", ")", "register_error_handle", "(", "arg_1", ")", "register_hooks", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"Create Flask app.\"\"\"\n    arg_0 = load_config()\n\n    arg_1 = Flask(__name__)\n    arg_1.config.from_object(arg_0)\n\n    # Proxy fix\n    arg_1.wsgi_app = ProxyFix(arg_1.wsgi_app)\n\n    # CSRF protect\n    CsrfProtect(arg_1)\n\n    if arg_1.debug or arg_1.testing:\n        DebugToolbarExtension(arg_1)\n\n        # Serve static files\n        arg_1.wsgi_app = SharedDataMiddleware(arg_1.wsgi_app, {\n            '/pages': os.path.join(arg_1.config.get('PROJECT_PATH'), 'application/pages')\n        })\n    else:\n        # Log errors to stderr in production mode\n        arg_1.logger.addHandler(logging.StreamHandler())\n        arg_1.logger.setLevel(logging.ERROR)\n\n        # Enable Sentry\n        if arg_1.config.get('SENTRY_DSN'):\n            from .utils.sentry import sentry\n\n            sentry.init_app(arg_1, dsn=arg_1.config.get('SENTRY_DSN'))\n\n        # Serve static files\n        arg_1.wsgi_app = SharedDataMiddleware(arg_1.wsgi_app, {\n            '/static': os.path.join(arg_1.config.get('PROJECT_PATH'), 'output/static'),\n            '/pkg': os.path.join(arg_1.config.get('PROJECT_PATH'), 'output/pkg'),\n            '/pages': os.path.join(arg_1.config.get('PROJECT_PATH'), 'output/pages')\n        })\n\n    # Register components\n    register_db(arg_1)\n    register_routes(arg_1)\n    register_jinja(arg_1)\n    register_error_handle(arg_1)\n    register_hooks(arg_1)\n\n    return arg_1", "path": "flask_boost/project/application/__init__.py", "identifier": "create_app", "docstring": "Create Flask app.", "docstring_tokens": ["Create", "Flask", "app", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 255593}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/formatters.py#L376-L418", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Make all labels uniform in format and remove redundant zeros\n        for labels in exponential format.", "language": "python", "parameters": "(self, labels)", "return_statement": "return labels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "remove_zeroes", "(", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "split", "(", "'e'", ")", "if", "len", "(", "arg_3", ")", "==", "2", ":", "arg_4", "=", "arg_3", "[", "0", "]", ".", "rstrip", "(", "'0'", ")", ".", "rstrip", "(", "'.'", ")", "arg_5", "=", "int", "(", "arg_3", "[", "1", "]", ")", "if", "arg_5", ":", "arg_2", "=", "'%se%d'", "%", "(", "arg_4", ",", "arg_5", ")", "else", ":", "arg_2", "=", "arg_4", "return", "arg_2", "def", "as_exp", "(", "arg_2", ")", ":", "return", "arg_2", "if", "'e'", "in", "arg_2", "else", "'{:1.0e}'", ".", "format", "(", "float", "(", "arg_2", ")", ")", "arg_6", "=", "np", ".", "array", "(", "[", "'e'", "in", "x", "for", "x", "in", "arg_1", "]", ")", "if", "not", "np", ".", "all", "(", "arg_6", ")", "and", "not", "np", ".", "all", "(", "~", "arg_6", ")", ":", "arg_1", "=", "[", "as_exp", "(", "x", ")", "for", "x", "in", "arg_1", "]", "arg_1", "=", "[", "remove_zeroes", "(", "x", ")", "for", "x", "in", "arg_1", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Make all labels uniform in format and remove redundant zeros\n        for labels in exponential format.\n\n        Parameters\n        ----------\n        labels : list-like\n            Labels to be tidied.\n\n        Returns\n        -------\n        out : list-like\n            Labels\n        \"\"\"\n        def remove_zeroes(arg_2):\n            \"\"\"\n            Remove unnecessary zeros for float string s\n            \"\"\"\n            arg_3 = arg_2.split('e')\n            if len(arg_3) == 2:\n                arg_4 = arg_3[0].rstrip('0').rstrip('.')\n                arg_5 = int(arg_3[1])\n                if arg_5:\n                    arg_2 = '%se%d' % (arg_4, arg_5)\n                else:\n                    arg_2 = arg_4\n            return arg_2\n\n        def as_exp(arg_2):\n            \"\"\"\n            Float string s as in exponential format\n            \"\"\"\n            return arg_2 if 'e' in arg_2 else '{:1.0e}'.format(float(arg_2))\n\n        # If any are in exponential format, make all of\n        # them expontential\n        arg_6 = np.array(['e' in x for x in arg_1])\n        if not np.all(arg_6) and not np.all(~arg_6):\n            arg_1 = [as_exp(x) for x in arg_1]\n\n        arg_1 = [remove_zeroes(x) for x in arg_1]\n        return arg_1", "path": "mizani/formatters.py", "identifier": "log_format._tidyup_labels", "docstring": "Make all labels uniform in format and remove redundant zeros\n        for labels in exponential format.\n\n        Parameters\n        ----------\n        labels : list-like\n            Labels to be tidied.\n\n        Returns\n        -------\n        out : list-like\n            Labels", "docstring_tokens": ["Make", "all", "labels", "uniform", "in", "format", "and", "remove", "redundant", "zeros", "for", "labels", "in", "exponential", "format", "."], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 255594}
{"url": "https://github.com/ssherar/hook/blob/54160df554d8b2ed65d762168e5808487e873ed9/hook/model.py#L57-L63", "sha": "54160df554d8b2ed65d762168e5808487e873ed9", "docstring_summary": "Iterates over the actions and executes them in order.", "language": "python", "parameters": "(self, cwd)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_execute_globals", "(", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "actions", ":", "logger", ".", "info", "(", "\"executing {}\"", ".", "format", "(", "arg_2", ")", ")", "arg_3", "=", "subprocess", ".", "Popen", "(", "arg_2", ",", "shell", "=", "True", ",", "arg_1", "=", "arg_1", ")", "arg_3", ".", "wait", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Iterates over the actions and executes them in order.\"\"\"\n        arg_0._execute_globals(arg_1)\n        for arg_2 in arg_0.actions:\n            logger.info(\"executing {}\".format(arg_2))\n            arg_3 = subprocess.Popen(arg_2, shell=True, arg_1=arg_1)\n            arg_3.wait()", "path": "hook/model.py", "identifier": "Rule.execute_actions", "docstring": "Iterates over the actions and executes them in order.", "docstring_tokens": ["Iterates", "over", "the", "actions", "and", "executes", "them", "in", "order", "."], "nwo": "ssherar/hook", "score": 0.23137166388621372, "idx": 255595}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L233-L253", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "This endpoint reverts the job to an older version.", "language": "python", "parameters": "(self, id, version, enforce_prior_version=None)", "return_statement": "return self.request(id, \"revert\", json=revert_json, method=\"post\").json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "\"JobID\"", ":", "arg_1", ",", "\"JobVersion\"", ":", "arg_2", ",", "\"EnforcePriorVersion\"", ":", "arg_3", "}", "return", "arg_0", ".", "request", "(", "arg_1", ",", "\"revert\"", ",", "json", "=", "arg_4", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\" This endpoint reverts the job to an older version.\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n              - version, Specifies the job version to revert to.\n            optional_arguments:\n              - enforce_prior_version, Optional value specifying the current job's version.\n                                       This is checked and acts as a check-and-set value before reverting to the\n                                       specified job.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_4 = {\"JobID\": arg_1,\n                       \"JobVersion\": arg_2,\n                       \"EnforcePriorVersion\": arg_3}\n        return arg_0.request(arg_1, \"revert\", json=arg_4, method=\"post\").json()", "path": "nomad/api/job.py", "identifier": "Job.revert_job", "docstring": "This endpoint reverts the job to an older version.\n\n           https://www.nomadproject.io/docs/http/job.html\n\n            arguments:\n              - id\n              - version, Specifies the job version to revert to.\n            optional_arguments:\n              - enforce_prior_version, Optional value specifying the current job's version.\n                                       This is checked and acts as a check-and-set value before reverting to the\n                                       specified job.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["This", "endpoint", "reverts", "the", "job", "to", "an", "older", "version", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 255596}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/hosts.py#L397-L405", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Remove duplicates in a list.", "language": "python", "parameters": "(_list)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", "not", "in", "arg_1", ":", "arg_2", ".", "append", "(", "arg_3", ")", "arg_1", ".", "add", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Remove duplicates in a list.\"\"\"\n    arg_1 = set()\n    arg_2 = []\n    for arg_3 in arg_0:\n        if arg_3 not in arg_1:\n            arg_2.append(arg_3)\n            arg_1.add(arg_3)\n    return arg_2", "path": "src/lsi/utils/hosts.py", "identifier": "_uniquify", "docstring": "Remove duplicates in a list.", "docstring_tokens": ["Remove", "duplicates", "in", "a", "list", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 255597}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/connection.py#L660-L669", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Gets a logger for the given class in this module", "language": "python", "parameters": "(cls, logLevel=None)", "return_statement": "return logger", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "logging", ".", "getLogger", "(", "\".\"", ".", "join", "(", "[", "'com.numenta'", ",", "_MODULE_NAME", ",", "arg_0", ".", "__name__", "]", ")", ")", "if", "arg_1", "is", "not", "None", ":", "arg_2", ".", "setLevel", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\" Gets a logger for the given class in this module\n  \"\"\"\n  arg_2 = logging.getLogger(\n    \".\".join(['com.numenta', _MODULE_NAME, arg_0.__name__]))\n\n  if arg_1 is not None:\n    arg_2.setLevel(arg_1)\n\n  return arg_2", "path": "src/nupic/database/connection.py", "identifier": "_getLogger", "docstring": "Gets a logger for the given class in this module", "docstring_tokens": ["Gets", "a", "logger", "for", "the", "given", "class", "in", "this", "module"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255598}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nessus.py#L24-L32", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Retrieves the uuid of the given template name.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "requests", ".", "get", "(", "arg_0", ".", "url", "+", "'editor/scan/templates'", ",", "headers", "=", "arg_0", ".", "headers", ",", "verify", "=", "False", ")", "arg_2", "=", "json", ".", "loads", "(", "arg_1", ".", "text", ")", "for", "arg_3", "in", "arg_2", "[", "'templates'", "]", ":", "if", "arg_3", "[", "'name'", "]", "==", "arg_0", ".", "template_name", ":", "return", "arg_3", "[", "'uuid'", "]"], "function": "def Func(arg_0):\n        \"\"\"\n            Retrieves the uuid of the given template name.\n        \"\"\"\n        arg_1 = requests.get(arg_0.url + 'editor/scan/templates', headers=arg_0.headers, verify=False)\n        arg_2 = json.loads(arg_1.text)\n        for arg_3 in arg_2['templates']:\n            if arg_3['name'] == arg_0.template_name:\n                return arg_3['uuid']", "path": "jackal/scripts/nessus.py", "identifier": "Nessus.get_template_uuid", "docstring": "Retrieves the uuid of the given template name.", "docstring_tokens": ["Retrieves", "the", "uuid", "of", "the", "given", "template", "name", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 255599}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/xml_parsers/common_change_info.py#L8-L29", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Parses a ChangeInfo tag. Seen in CreateHostedZone, DeleteHostedZone,\n    and ChangeResourceRecordSetsRequest.", "language": "python", "parameters": "(e_change_info)", "return_statement": "return {\n        'request_id': id,\n        'request_status': status,\n        'request_submitted_at': submitted_at\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "arg_0", "arg_1", "=", "arg_0", ".", "find", "(", "'./{*}Status'", ")", ".", "text", "arg_2", "=", "arg_0", ".", "find", "(", "'./{*}SubmittedAt'", ")", ".", "text", "arg_2", "=", "parse_iso_8601_time_str", "(", "arg_2", ")", "return", "{", "'request_id'", ":", "id", ",", "'request_status'", ":", "arg_1", ",", "'request_submitted_at'", ":", "arg_2", "}"], "function": "def Func(arg_0):\n    \"\"\"\n    Parses a ChangeInfo tag. Seen in CreateHostedZone, DeleteHostedZone,\n    and ChangeResourceRecordSetsRequest.\n\n    :param lxml.etree._Element e_change_info: A ChangeInfo element.\n    :rtype: dict\n    :returns: A dict representation of the change info.\n    \"\"\"\n\n    if arg_0 is None:\n        return arg_0\n\n    arg_1 = arg_0.find('./{*}Status').text\n    arg_2 = arg_0.find('./{*}SubmittedAt').text\n    arg_2 = parse_iso_8601_time_str(arg_2)\n\n    return {\n        'request_id': id,\n        'request_status': arg_1,\n        'request_submitted_at': arg_2\n    }", "path": "route53/xml_parsers/common_change_info.py", "identifier": "parse_change_info", "docstring": "Parses a ChangeInfo tag. Seen in CreateHostedZone, DeleteHostedZone,\n    and ChangeResourceRecordSetsRequest.\n\n    :param lxml.etree._Element e_change_info: A ChangeInfo element.\n    :rtype: dict\n    :returns: A dict representation of the change info.", "docstring_tokens": ["Parses", "a", "ChangeInfo", "tag", ".", "Seen", "in", "CreateHostedZone", "DeleteHostedZone", "and", "ChangeResourceRecordSetsRequest", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 255600}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/user.py#L104-L118", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Construct user from ``ConversationParticipantData`` message.", "language": "python", "parameters": "(conv_part_data, self_user_id)", "return_statement": "return User(user_id, conv_part_data.fallback_name, None, None, [],\n                    (self_user_id == user_id) or (self_user_id is None))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "UserID", "(", "chat_id", "=", "arg_0", ".", "id", ".", "chat_id", ",", "gaia_id", "=", "arg_0", ".", "id", ".", "gaia_id", ")", "return", "User", "(", "arg_2", ",", "arg_0", ".", "fallback_name", ",", "None", ",", "None", ",", "[", "]", ",", "(", "arg_1", "==", "arg_2", ")", "or", "(", "arg_1", "is", "None", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Construct user from ``ConversationParticipantData`` message.\n\n        Args:\n            conv_part_id: ``ConversationParticipantData`` message.\n            self_user_id (~hangups.user.UserID or None): The ID of the current\n                user. If ``None``, assume ``conv_part_id`` is the current user.\n\n        Returns:\n            :class:`~hangups.user.User` object.\n        \"\"\"\n        arg_2 = UserID(chat_id=arg_0.id.chat_id,\n                         gaia_id=arg_0.id.gaia_id)\n        return User(arg_2, arg_0.fallback_name, None, None, [],\n                    (arg_1 == arg_2) or (arg_1 is None))", "path": "hangups/user.py", "identifier": "User.from_conv_part_data", "docstring": "Construct user from ``ConversationParticipantData`` message.\n\n        Args:\n            conv_part_id: ``ConversationParticipantData`` message.\n            self_user_id (~hangups.user.UserID or None): The ID of the current\n                user. If ``None``, assume ``conv_part_id`` is the current user.\n\n        Returns:\n            :class:`~hangups.user.User` object.", "docstring_tokens": ["Construct", "user", "from", "ConversationParticipantData", "message", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255601}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L962-L981", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Retrieves the list of NICs that are associated with a load balancer.", "language": "python", "parameters": "(self, datacenter_id, loadbalancer_id,\n                                 depth=1)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "arg_4", "=", "arg_0", ".", "_perform_request", "(", "'/datacenters/%s/loadbalancers/%s/balancednics?depth=%s'", "%", "(", "arg_1", ",", "arg_2", ",", "str", "(", "arg_3", ")", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2,\n                                 arg_3=1):\n        \"\"\"\n        Retrieves the list of NICs that are associated with a load balancer.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      loadbalancer_id: The unique ID of the load balancer.\n        :type       loadbalancer_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``\n\n        \"\"\"\n        arg_4 = arg_0._perform_request(\n            '/datacenters/%s/loadbalancers/%s/balancednics?depth=%s' % (\n                arg_1, arg_2, str(arg_3)))\n\n        return arg_4", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.get_loadbalancer_members", "docstring": "Retrieves the list of NICs that are associated with a load balancer.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      loadbalancer_id: The unique ID of the load balancer.\n        :type       loadbalancer_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``", "docstring_tokens": ["Retrieves", "the", "list", "of", "NICs", "that", "are", "associated", "with", "a", "load", "balancer", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 255602}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/expression.py#L371-L434", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Computes counts of unique values.", "language": "python", "parameters": "(self, dropna=False, dropnull=True, ascending=False, progress=False)", "return_statement": "return Series(counts, index=index)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "from", "pandas", "import", "Series", "arg_5", "=", "arg_0", ".", "dtype", "arg_6", "=", "arg_0", ".", "transient", "or", "arg_0", ".", "ds", ".", "filtered", "or", "arg_0", ".", "ds", ".", "is_masked", "(", "arg_0", ".", "expression", ")", "if", "arg_0", ".", "dtype", "==", "str_type", "and", "not", "arg_6", ":", "arg_7", "=", "arg_0", ".", "ds", ".", "columns", "[", "arg_0", ".", "expression", "]", "if", "not", "isinstance", "(", "arg_7", ",", "ColumnString", ")", ":", "arg_6", "=", "True", "arg_8", "=", "counter_type_from_dtype", "(", "arg_0", ".", "dtype", ",", "arg_6", ")", "arg_9", "=", "[", "None", "]", "*", "arg_0", ".", "ds", ".", "executor", ".", "thread_pool", ".", "nthreads", "def", "map", "(", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_7", ")", ":", "if", "arg_9", "[", "arg_10", "]", "is", "None", ":", "arg_9", "[", "arg_10", "]", "=", "arg_8", "(", ")", "if", "arg_5", "==", "str_type", ":", "arg_13", "=", "arg_7", "arg_7", "=", "_to_string_sequence", "(", "arg_7", ")", "if", "not", "arg_6", ":", "assert", "arg_7", "is", "arg_13", ".", "string_sequence", "if", "np", ".", "ma", ".", "isMaskedArray", "(", "arg_7", ")", ":", "arg_14", "=", "np", ".", "ma", ".", "getmaskarray", "(", "arg_7", ")", "arg_9", "[", "arg_10", "]", ".", "update", "(", "arg_7", ",", "arg_14", ")", "else", ":", "arg_9", "[", "arg_10", "]", ".", "update", "(", "arg_7", ")", "return", "0", "def", "reduce", "(", "arg_15", ",", "arg_16", ")", ":", "return", "arg_15", "+", "arg_16", "arg_0", ".", "ds", ".", "map_reduce", "(", "map", ",", "reduce", ",", "[", "arg_0", ".", "expression", "]", ",", "delay", "=", "False", ",", "arg_4", "=", "arg_4", ",", "name", "=", "'value_counts'", ",", "info", "=", "True", ",", "to_numpy", "=", "False", ")", "arg_9", "=", "[", "k", "for", "k", "in", "arg_9", "if", "k", "is", "not", "None", "]", "arg_17", "=", "arg_9", "[", "0", "]", "for", "arg_18", "in", "arg_9", "[", "1", ":", "]", ":", "arg_17", ".", "merge", "(", "arg_18", ")", "Func", "=", "arg_17", ".", "extract", "(", ")", "arg_20", "=", "np", ".", "array", "(", "list", "(", "Func", ".", "keys", "(", ")", ")", ")", "arg_21", "=", "np", ".", "array", "(", "list", "(", "Func", ".", "values", "(", ")", ")", ")", "arg_22", "=", "np", ".", "argsort", "(", "arg_21", ")", "if", "not", "arg_3", ":", "arg_22", "=", "arg_22", "[", ":", ":", "-", "1", "]", "arg_21", "=", "arg_21", "[", "arg_22", "]", "arg_20", "=", "arg_20", "[", "arg_22", "]", "if", "not", "arg_1", "or", "not", "arg_2", ":", "arg_20", "=", "arg_20", ".", "tolist", "(", ")", "arg_21", "=", "arg_21", ".", "tolist", "(", ")", "if", "not", "arg_1", "and", "arg_17", ".", "nan_count", ":", "arg_20", "=", "[", "np", ".", "nan", "]", "+", "arg_20", "arg_21", "=", "[", "arg_17", ".", "nan_count", "]", "+", "arg_21", "if", "not", "arg_2", "and", "arg_17", ".", "null_count", ":", "arg_20", "=", "[", "'null'", "]", "+", "arg_20", "arg_21", "=", "[", "arg_17", ".", "null_count", "]", "+", "arg_21", "return", "Series", "(", "arg_21", ",", "arg_20", "=", "arg_20", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True, arg_3=False, arg_4=False):\n        \"\"\"Computes counts of unique values.\n\n         WARNING:\n          * If the expression/column is not categorical, it will be converted on the fly\n          * dropna is False by default, it is True by default in pandas\n\n        :param dropna: when True, it will not report the missing values\n        :param ascending: when False (default) it will report the most frequent occuring item first\n        :returns: Pandas series containing the counts\n        \"\"\"\n        from pandas import Series\n        arg_5 = arg_0.dtype\n\n        arg_6 = arg_0.transient or arg_0.ds.filtered or arg_0.ds.is_masked(arg_0.expression)\n        if arg_0.dtype == str_type and not arg_6:\n            # string is a special case, only ColumnString are not transient\n            arg_7 = arg_0.ds.columns[arg_0.expression]\n            if not isinstance(arg_7, ColumnString):\n                arg_6 = True\n\n        arg_8 = counter_type_from_dtype(arg_0.dtype, arg_6)\n        arg_9 = [None] * arg_0.ds.executor.thread_pool.nthreads\n        def map(arg_10, arg_11, arg_12, arg_7):\n            if arg_9[arg_10] is None:\n                arg_9[arg_10] = arg_8()\n            if arg_5 == str_type:\n                arg_13 = arg_7\n                arg_7 = _to_string_sequence(arg_7)\n                if not arg_6:\n                    assert arg_7 is arg_13.string_sequence\n            if np.ma.isMaskedArray(arg_7):\n                arg_14 = np.ma.getmaskarray(arg_7)\n                arg_9[arg_10].update(arg_7, arg_14)\n            else:\n                arg_9[arg_10].update(arg_7)\n            return 0\n        def reduce(arg_15, arg_16):\n            return arg_15+arg_16\n        arg_0.ds.map_reduce(map, reduce, [arg_0.expression], delay=False, arg_4=arg_4, name='value_counts', info=True, to_numpy=False)\n        arg_9 = [k for k in arg_9 if k is not None]\n        arg_17 = arg_9[0]\n        for arg_18 in arg_9[1:]:\n            arg_17.merge(arg_18)\n        Func = arg_17.extract()\n        arg_20 = np.array(list(Func.keys()))\n        arg_21 = np.array(list(Func.values()))\n\n        arg_22 = np.argsort(arg_21)\n        if not arg_3:\n            arg_22 = arg_22[::-1]\n        arg_21 = arg_21[arg_22]\n        arg_20 = arg_20[arg_22]\n        if not arg_1 or not arg_2:\n            arg_20 = arg_20.tolist()\n            arg_21 = arg_21.tolist()\n            if not arg_1 and arg_17.nan_count:\n                arg_20 = [np.nan] + arg_20\n                arg_21 = [arg_17.nan_count] + arg_21\n            if not arg_2 and arg_17.null_count:\n                arg_20 = ['null'] + arg_20\n                arg_21 = [arg_17.null_count] + arg_21\n\n        return Series(arg_21, arg_20=arg_20)", "path": "packages/vaex-core/vaex/expression.py", "identifier": "Expression.value_counts", "docstring": "Computes counts of unique values.\n\n         WARNING:\n          * If the expression/column is not categorical, it will be converted on the fly\n          * dropna is False by default, it is True by default in pandas\n\n        :param dropna: when True, it will not report the missing values\n        :param ascending: when False (default) it will report the most frequent occuring item first\n        :returns: Pandas series containing the counts", "docstring_tokens": ["Computes", "counts", "of", "unique", "values", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 255603}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/ipp_controller.py#L124-L134", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Specify path to the ipcontroller-client.json file.", "language": "python", "parameters": "(self)", "return_statement": "return os.path.join(self.ipython_dir,\n                            'profile_{0}'.format(self.profile),\n                            'security/ipcontroller-client.json')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "os", ".", "path", ".", "join", "(", "arg_0", ".", "ipython_dir", ",", "'profile_{0}'", ".", "format", "(", "arg_0", ".", "profile", ")", ",", "'security/ipcontroller-client.json'", ")"], "function": "def Func(arg_0):\n        \"\"\"Specify path to the ipcontroller-client.json file.\n\n        This file is stored in in the ipython_dir/profile folders.\n\n        Returns :\n              - str, File path to client file\n        \"\"\"\n        return os.path.join(arg_0.ipython_dir,\n                            'profile_{0}'.format(arg_0.profile),\n                            'security/ipcontroller-client.json')", "path": "parsl/executors/ipp_controller.py", "identifier": "Controller.client_file", "docstring": "Specify path to the ipcontroller-client.json file.\n\n        This file is stored in in the ipython_dir/profile folders.\n\n        Returns :\n              - str, File path to client file", "docstring_tokens": ["Specify", "path", "to", "the", "ipcontroller", "-", "client", ".", "json", "file", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 255604}
{"url": "https://github.com/nickw444/flask-ldap3-login/blob/3cf0faff52d0e04d4813119a2ba36d706e6fb31f/flask_ldap3_login/__init__.py#L738-L756", "sha": "3cf0faff52d0e04d4813119a2ba36d706e6fb31f", "docstring_summary": "Make a connection to the LDAP Directory.", "language": "python", "parameters": "(self, bind_user=None, bind_password=None, **kwargs)", "return_statement": "return self._make_connection(bind_user, bind_password,\n                                     contextualise=False, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", ",", "contextualise", "=", "False", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, **arg_3):\n        \"\"\"\n        Make a connection to the LDAP Directory.\n\n        Args:\n            bind_user (str): User to bind with. If `None`, AUTH_ANONYMOUS is\n                used, otherwise authentication specified with\n                config['LDAP_BIND_AUTHENTICATION_TYPE'] is used.\n            bind_password (str): Password to bind to the directory with\n            **kwargs (dict): Additional arguments to pass to the\n                ``ldap3.Connection``\n\n        Returns:\n            ldap3.Connection: An unbound ldap3.Connection. You should handle exceptions\n                upon bind if you use this internal method.\n        \"\"\"\n\n        return arg_0._Func(arg_1, arg_2,\n                                     contextualise=False, **arg_3)", "path": "flask_ldap3_login/__init__.py", "identifier": "LDAP3LoginManager.make_connection", "docstring": "Make a connection to the LDAP Directory.\n\n        Args:\n            bind_user (str): User to bind with. If `None`, AUTH_ANONYMOUS is\n                used, otherwise authentication specified with\n                config['LDAP_BIND_AUTHENTICATION_TYPE'] is used.\n            bind_password (str): Password to bind to the directory with\n            **kwargs (dict): Additional arguments to pass to the\n                ``ldap3.Connection``\n\n        Returns:\n            ldap3.Connection: An unbound ldap3.Connection. You should handle exceptions\n                upon bind if you use this internal method.", "docstring_tokens": ["Make", "a", "connection", "to", "the", "LDAP", "Directory", "."], "nwo": "nickw444/flask-ldap3-login", "score": 0.51975183030278, "idx": 255605}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completer.py#L789-L871", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find completions for the given text and line context.", "language": "python", "parameters": "(self, text=None, line_buffer=None, cursor_pos=None)", "return_statement": "return text, self.matches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "len", "(", "arg_2", ")", "if", "arg_1", "is", "None", "else", "len", "(", "arg_1", ")", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "splitter", ".", "split_line", "(", "arg_2", ",", "arg_3", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_1", "arg_0", ".", "line_buffer", "=", "arg_2", "arg_0", ".", "text_until_cursor", "=", "arg_0", ".", "line_buffer", "[", ":", "arg_3", "]", "arg_0", ".", "matches", "[", ":", "]", "=", "[", "]", "arg_6", "=", "arg_0", ".", "dispatch_custom_Funcr", "(", "arg_1", ")", "if", "arg_6", "is", "not", "None", ":", "arg_0", ".", "matches", "=", "arg_6", "else", ":", "if", "arg_0", ".", "merge_completions", ":", "arg_0", ".", "matches", "=", "[", "]", "for", "arg_7", "in", "arg_0", ".", "matchers", ":", "try", ":", "arg_0", ".", "matches", ".", "extend", "(", "arg_7", "(", "arg_1", ")", ")", "except", ":", "sys", ".", "excepthook", "(", "*", "sys", ".", "exc_info", "(", ")", ")", "else", ":", "for", "arg_7", "in", "arg_0", ".", "matchers", ":", "arg_0", ".", "matches", "=", "arg_7", "(", "arg_1", ")", "if", "arg_0", ".", "matches", ":", "break", "arg_0", ".", "matches", "=", "sorted", "(", "set", "(", "arg_0", ".", "matches", ")", ")", "return", "arg_1", ",", "arg_0", ".", "matches"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Find completions for the given text and line context.\n\n        This is called successively with state == 0, 1, 2, ... until it\n        returns None.  The completion should begin with 'text'.\n\n        Note that both the text and the line_buffer are optional, but at least\n        one of them must be given.\n\n        Parameters\n        ----------\n          text : string, optional\n            Text to perform the completion on.  If not given, the line buffer\n            is split using the instance's CompletionSplitter object.\n\n          line_buffer : string, optional\n            If not given, the Funcr attempts to obtain the current line\n            buffer via readline.  This keyword allows clients which are\n            requesting for text completions in non-readline contexts to inform\n            the Funcr of the entire text.\n\n          cursor_pos : int, optional\n            Index of the cursor in the full line buffer.  Should be provided by\n            remote frontends where kernel has no access to frontend state.\n\n        Returns\n        -------\n        text : str\n          Text that was actually used in the completion.\n\n        matches : list\n          A list of completion matches.\n        \"\"\"\n        #io.rprint('\\nCOMP1 %r %r %r' % (text, line_buffer, cursor_pos))  # dbg\n\n        # if the cursor position isn't given, the only sane assumption we can\n        # make is that it's at the end of the line (the common case)\n        if arg_3 is None:\n            arg_3 = len(arg_2) if arg_1 is None else len(arg_1)\n\n        # if text is either None or an empty string, rely on the line buffer\n        if not arg_1:\n            arg_1 = arg_0.splitter.split_line(arg_2, arg_3)\n\n        # If no line buffer is given, assume the input text is all there was\n        if arg_2 is None:\n            arg_2 = arg_1\n\n        arg_0.line_buffer = arg_2\n        arg_0.text_until_cursor = arg_0.line_buffer[:arg_3]\n        #io.rprint('COMP2 %r %r %r' % (text, line_buffer, cursor_pos))  # dbg\n\n        # Start with a clean slate of completions\n        arg_0.matches[:] = []\n        arg_6 = arg_0.dispatch_custom_Funcr(arg_1)\n        if arg_6 is not None:\n            # did custom Funcrs produce something?\n            arg_0.matches = arg_6\n        else:\n            # Extend the list of completions with the results of each\n            # matcher, so we return results to the user from all\n            # namespaces.\n            if arg_0.merge_completions:\n                arg_0.matches = []\n                for arg_7 in arg_0.matchers:\n                    try:\n                        arg_0.matches.extend(arg_7(arg_1))\n                    except:\n                        # Show the ugly traceback if the matcher causes an\n                        # exception, but do NOT crash the kernel!\n                        sys.excepthook(*sys.exc_info())\n            else:\n                for arg_7 in arg_0.matchers:\n                    arg_0.matches = arg_7(arg_1)\n                    if arg_0.matches:\n                        break\n        # FIXME: we should extend our api to return a dict with completions for\n        # different types of objects.  The rlFunc() method could then\n        # simply collapse the dict into a list for readline, but we'd have\n        # richer completion semantics in other evironments.\n        arg_0.matches = sorted(set(arg_0.matches))\n        #io.rprint('COMP TEXT, MATCHES: %r, %r' % (text, self.matches)) # dbg\n        return arg_1, arg_0.matches", "path": "environment/lib/python2.7/site-packages/IPython/core/completer.py", "identifier": "IPCompleter.complete", "docstring": "Find completions for the given text and line context.\n\n        This is called successively with state == 0, 1, 2, ... until it\n        returns None.  The completion should begin with 'text'.\n\n        Note that both the text and the line_buffer are optional, but at least\n        one of them must be given.\n\n        Parameters\n        ----------\n          text : string, optional\n            Text to perform the completion on.  If not given, the line buffer\n            is split using the instance's CompletionSplitter object.\n\n          line_buffer : string, optional\n            If not given, the completer attempts to obtain the current line\n            buffer via readline.  This keyword allows clients which are\n            requesting for text completions in non-readline contexts to inform\n            the completer of the entire text.\n\n          cursor_pos : int, optional\n            Index of the cursor in the full line buffer.  Should be provided by\n            remote frontends where kernel has no access to frontend state.\n\n        Returns\n        -------\n        text : str\n          Text that was actually used in the completion.\n\n        matches : list\n          A list of completion matches.", "docstring_tokens": ["Find", "completions", "for", "the", "given", "text", "and", "line", "context", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255606}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/www/api/experimental/endpoints.py#L47-L92", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Trigger a new dag run for a Dag with an execution date of now unless\n    specified in the data.", "language": "python", "parameters": "(dag_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "request", ".", "get_json", "(", "force", "=", "True", ")", "arg_2", "=", "None", "if", "'run_id'", "in", "arg_1", ":", "arg_2", "=", "arg_1", "[", "'run_id'", "]", "arg_3", "=", "None", "if", "'conf'", "in", "arg_1", ":", "arg_3", "=", "arg_1", "[", "'conf'", "]", "arg_4", "=", "None", "if", "'execution_date'", "in", "arg_1", "and", "arg_1", "[", "'execution_date'", "]", "is", "not", "None", ":", "arg_4", "=", "arg_1", "[", "'execution_date'", "]", "try", ":", "arg_4", "=", "timezone", ".", "parse", "(", "arg_4", ")", "except", "ValueError", ":", "arg_5", "=", "(", "'Given execution date, {}, could not be identified '", "'as a date. Example date format: 2015-11-16T14:34:15+00:00'", ".", "format", "(", "arg_4", ")", ")", "_log", ".", "info", "(", "arg_5", ")", "arg_6", "=", "jsonify", "(", "{", "'error'", ":", "arg_5", "}", ")", "arg_6", ".", "status_code", "=", "400", "return", "arg_6", "try", ":", "arg_8", "=", "trigger", ".", "Func", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "except", "AirflowException", "as", "err", ":", "_log", ".", "error", "(", "err", ")", "arg_6", "=", "jsonify", "(", "error", "=", "\"{}\"", ".", "format", "(", "err", ")", ")", "arg_6", ".", "status_code", "=", "err", ".", "status_code", "return", "arg_6", "if", "getattr", "(", "g", ",", "'user'", ",", "None", ")", ":", "_log", ".", "info", "(", "\"User %s created %s\"", ",", "g", ".", "user", ",", "arg_8", ")", "arg_6", "=", "jsonify", "(", "message", "=", "\"Created {}\"", ".", "format", "(", "arg_8", ")", ")", "return", "arg_6"], "function": "def Func(arg_0):\n    \"\"\"\n    Trigger a new dag run for a Dag with an execution date of now unless\n    specified in the data.\n    \"\"\"\n    arg_1 = request.get_json(force=True)\n\n    arg_2 = None\n    if 'run_id' in arg_1:\n        arg_2 = arg_1['run_id']\n\n    arg_3 = None\n    if 'conf' in arg_1:\n        arg_3 = arg_1['conf']\n\n    arg_4 = None\n    if 'execution_date' in arg_1 and arg_1['execution_date'] is not None:\n        arg_4 = arg_1['execution_date']\n\n        # Convert string datetime into actual datetime\n        try:\n            arg_4 = timezone.parse(arg_4)\n        except ValueError:\n            arg_5 = (\n                'Given execution date, {}, could not be identified '\n                'as a date. Example date format: 2015-11-16T14:34:15+00:00'\n                .format(arg_4))\n            _log.info(arg_5)\n            arg_6 = jsonify({'error': arg_5})\n            arg_6.status_code = 400\n\n            return arg_6\n\n    try:\n        arg_8 = trigger.Func(arg_0, arg_2, arg_3, arg_4)\n    except AirflowException as err:\n        _log.error(err)\n        arg_6 = jsonify(error=\"{}\".format(err))\n        arg_6.status_code = err.status_code\n        return arg_6\n\n    if getattr(g, 'user', None):\n        _log.info(\"User %s created %s\", g.user, arg_8)\n\n    arg_6 = jsonify(message=\"Created {}\".format(arg_8))\n    return arg_6", "path": "airflow/www/api/experimental/endpoints.py", "identifier": "trigger_dag", "docstring": "Trigger a new dag run for a Dag with an execution date of now unless\n    specified in the data.", "docstring_tokens": ["Trigger", "a", "new", "dag", "run", "for", "a", "Dag", "with", "an", "execution", "date", "of", "now", "unless", "specified", "in", "the", "data", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255607}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/job.py#L45-L81", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Wait until the job finishes.", "language": "python", "parameters": "(self, verbose_model_scoring_history = False)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "try", ":", "arg_2", "=", "not", "H2OJob", ".", "__PROGRESS_BAR__", "arg_3", "=", "ProgressBar", "(", "title", "=", "arg_0", ".", "_job_type", "+", "\" progress\"", ",", "arg_2", "=", "arg_2", ")", "if", "arg_1", ":", "arg_3", ".", "execute", "(", "arg_0", ".", "_refresh_job_status", ",", "print_verbose_info", "=", "lambda", "x", ":", "arg_0", ".", "_print_verbose_info", "(", ")", "if", "int", "(", "x", "*", "10", ")", "%", "5", "==", "0", "else", "\" \"", ")", "else", ":", "arg_3", ".", "execute", "(", "arg_0", ".", "_refresh_job_status", ")", "except", "StopIteration", "as", "e", ":", "if", "str", "(", "e", ")", "==", "\"cancelled\"", ":", "h2o", ".", "api", "(", "\"POST /3/Jobs/%s/cancel\"", "%", "arg_0", ".", "job_key", ")", "arg_0", ".", "status", "=", "\"CANCELLED\"", "assert", "arg_0", ".", "status", "in", "{", "\"DONE\"", ",", "\"CANCELLED\"", ",", "\"FAILED\"", "}", "or", "arg_0", ".", "_Func_count", "<=", "0", ",", "\"Polling finished while the job has status %s\"", "%", "arg_0", ".", "status", "if", "arg_0", ".", "warnings", ":", "for", "arg_5", "in", "arg_0", ".", "warnings", ":", "warnings", ".", "warn", "(", "arg_5", ")", "if", "arg_0", ".", "status", "==", "\"CANCELLED\"", ":", "raise", "H2OJobCancelled", "(", "\"Job<%s> was cancelled by the user.\"", "%", "arg_0", ".", "job_key", ")", "if", "arg_0", ".", "status", "==", "\"FAILED\"", ":", "if", "(", "isinstance", "(", "arg_0", ".", "job", ",", "dict", ")", ")", "and", "(", "\"stacktrace\"", "in", "list", "(", "arg_0", ".", "job", ")", ")", ":", "raise", "EnvironmentError", "(", "\"Job with key {} failed with an exception: {}\\nstacktrace: \"", "\"\\n{}\"", ".", "format", "(", "arg_0", ".", "job_key", ",", "arg_0", ".", "exception", ",", "arg_0", ".", "job", "[", "\"stacktrace\"", "]", ")", ")", "else", ":", "raise", "EnvironmentError", "(", "\"Job with key %s failed with an exception: %s\"", "%", "(", "arg_0", ".", "job_key", ",", "arg_0", ".", "exception", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1 = False):\n        \"\"\"\n        Wait until the job finishes.\n\n        This method will continuously query the server about the status of the job, until the job reaches a\n        completion. During this time we will display (in stdout) a progress bar with % completion status.\n        \"\"\"\n        try:\n            arg_2 = not H2OJob.__PROGRESS_BAR__\n            arg_3 = ProgressBar(title=arg_0._job_type + \" progress\", arg_2=arg_2)\n            if arg_1:\n                arg_3.execute(arg_0._refresh_job_status, print_verbose_info=lambda x: arg_0._print_verbose_info() if int(x * 10) % 5 == 0  else \" \")\n            else:\n                arg_3.execute(arg_0._refresh_job_status)\n        except StopIteration as e:\n            if str(e) == \"cancelled\":\n                h2o.api(\"POST /3/Jobs/%s/cancel\" % arg_0.job_key)\n                arg_0.status = \"CANCELLED\"\n            # Potentially we may want to re-raise the exception here\n\n        assert arg_0.status in {\"DONE\", \"CANCELLED\", \"FAILED\"} or arg_0._Func_count <= 0, \\\n            \"Polling finished while the job has status %s\" % arg_0.status\n        if arg_0.warnings:\n            for arg_5 in arg_0.warnings:\n                warnings.warn(arg_5)\n\n        # check if failed... and politely print relevant message\n        if arg_0.status == \"CANCELLED\":\n            raise H2OJobCancelled(\"Job<%s> was cancelled by the user.\" % arg_0.job_key)\n        if arg_0.status == \"FAILED\":\n            if (isinstance(arg_0.job, dict)) and (\"stacktrace\" in list(arg_0.job)):\n                raise EnvironmentError(\"Job with key {} failed with an exception: {}\\nstacktrace: \"\n                                       \"\\n{}\".format(arg_0.job_key, arg_0.exception, arg_0.job[\"stacktrace\"]))\n            else:\n                raise EnvironmentError(\"Job with key %s failed with an exception: %s\" % (arg_0.job_key, arg_0.exception))\n\n        return arg_0", "path": "h2o-py/h2o/job.py", "identifier": "H2OJob.poll", "docstring": "Wait until the job finishes.\n\n        This method will continuously query the server about the status of the job, until the job reaches a\n        completion. During this time we will display (in stdout) a progress bar with % completion status.", "docstring_tokens": ["Wait", "until", "the", "job", "finishes", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255608}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/bugzillarest.py#L326-L350", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the information of a list of bugs.", "language": "python", "parameters": "(self, from_date=DEFAULT_DATETIME, offset=None, max_bugs=MAX_BUGS)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "arg_5", ")", ":", "arg_6", "=", "datetime_to_utc", "(", "arg_1", ")", "arg_6", "=", "arg_6", ".", "strftime", "(", "\"%Y-%m-%dT%H:%M:%SZ\"", ")", "arg_7", "=", "{", "arg_0", ".", "PLAST_CHANGE_TIME", ":", "arg_6", ",", "arg_0", ".", "PLIMIT", ":", "arg_4", ",", "arg_0", ".", "PORDER", ":", "arg_0", ".", "VCHANGE_DATE_ORDER", ",", "arg_0", ".", "PINCLUDE_FIELDS", ":", "arg_0", ".", "VINCLUDE_ALL", "}", "if", "arg_3", ":", "arg_7", "[", "arg_0", ".", "POFFSET", "]", "=", "arg_3", "arg_9", "=", "arg_0", ".", "call", "(", "arg_0", ".", "RBUG", ",", "arg_7", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=None, arg_4=arg_5):\n        \"\"\"Get the information of a list of Func.\n\n        :param from_date: retrieve Func that where updated from that date;\n            dates are converted to UTC\n        :param offset: starting position for the search; i.e to return 11th\n            element, set this value to 10.\n        :param max_Func: maximum number of Func to reteurn per query\n        \"\"\"\n        arg_6 = datetime_to_utc(arg_1)\n        arg_6 = arg_6.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n\n        arg_7 = {\n            arg_0.PLAST_CHANGE_TIME: arg_6,\n            arg_0.PLIMIT: arg_4,\n            arg_0.PORDER: arg_0.VCHANGE_DATE_ORDER,\n            arg_0.PINCLUDE_FIELDS: arg_0.VINCLUDE_ALL\n        }\n\n        if arg_3:\n            arg_7[arg_0.POFFSET] = arg_3\n\n        arg_9 = arg_0.call(arg_0.RBUG, arg_7)\n\n        return arg_9", "path": "perceval/backends/core/bugzillarest.py", "identifier": "BugzillaRESTClient.bugs", "docstring": "Get the information of a list of bugs.\n\n        :param from_date: retrieve bugs that where updated from that date;\n            dates are converted to UTC\n        :param offset: starting position for the search; i.e to return 11th\n            element, set this value to 10.\n        :param max_bugs: maximum number of bugs to reteurn per query", "docstring_tokens": ["Get", "the", "information", "of", "a", "list", "of", "bugs", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255609}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L787-L844", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Reconstruct the given input sequences.", "language": "python", "parameters": "(self, inputs, samples=1, sample_static=False,\n                  sample_dynamic=False, swap_static=False, swap_dynamic=False,\n                  fix_static=False, fix_dynamic=False)", "return_statement": "return likelihood", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ",", "arg_8", "=", "False", ")", ":", "arg_9", "=", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", "[", "-", "5", "]", "arg_10", "=", "len", "(", "tf", ".", "unstack", "(", "arg_1", ",", "axis", "=", "-", "4", ")", ")", "arg_11", "=", "arg_0", ".", "compressor", "(", "arg_1", ")", "if", "arg_3", ":", "arg_12", ",", "arg_13", "=", "arg_0", ".", "sample_static_prior", "(", "arg_2", ",", "arg_9", ",", "arg_7", ")", "else", ":", "arg_12", ",", "arg_13", "=", "arg_0", ".", "sample_static_posterior", "(", "arg_11", ",", "arg_2", ")", "if", "arg_5", ":", "arg_12", "=", "tf", ".", "reverse", "(", "arg_12", ",", "axis", "=", "[", "1", "]", ")", "if", "arg_4", ":", "arg_14", ",", "arg_13", "=", "arg_0", ".", "sample_dynamic_prior", "(", "arg_2", ",", "arg_9", ",", "arg_10", ",", "arg_8", ")", "else", ":", "arg_14", ",", "arg_13", "=", "arg_0", ".", "sample_dynamic_posterior", "(", "arg_11", ",", "arg_2", ",", "arg_12", ")", "if", "arg_6", ":", "arg_14", "=", "tf", ".", "reverse", "(", "arg_14", ",", "axis", "=", "[", "1", "]", ")", "arg_15", "=", "arg_0", ".", "decoder", "(", "(", "arg_14", ",", "arg_12", ")", ")", "return", "arg_15"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=False,\n                  arg_4=False, arg_5=False, arg_6=False,\n                  arg_7=False, arg_8=False):\n    \"\"\"Reconstruct the given input sequences.\n\n    Args:\n      inputs: A batch of image sequences `x_{1:T}` of shape\n        `[batch_size, timesteps, height, width, channels]`.\n      samples: Number of samples to draw from the latent distributions.\n      sample_static: Boolean for whether or not to randomly sample the\n        static latent variable `f` from its prior distribution.\n      sample_dynamic: Boolean for whether or not to randomly sample the\n        dynamic latent variable `z_{1:T}` from its prior distribution.\n      swap_static: Boolean for whether or not to swap the encodings for\n        the static latent variable `f` between the examples.\n      swap_dynamic: Boolean for whether or not to swap the encodings for\n        the dynamic latent variable `z_{1:T}` between the examples.\n      fix_static: Boolean for whether or not to share the same random\n        sample of the static latent variable `f` from its prior across\n        all examples.\n      fix_dynamic: Boolean for whether or not to share the same random\n        sample of the dynamic latent variable `z_{1:T}` from its prior\n        across all examples.\n\n    Returns:\n      A batched Independent distribution wrapping a set of Normal\n      distributions over the pixels of the Funcion of the input,\n      where the Independent distribution has event shape [height, width,\n      channels], batch shape [samples, batch_size, timesteps], and\n      sample shape [sample_shape, samples, batch_size, timesteps,\n      height, width, channels].\n    \"\"\"\n    arg_9 = tf.shape(input=arg_1)[-5]\n    arg_10 = len(tf.unstack(arg_1, axis=-4))  # hack for graph mode\n\n    arg_11 = arg_0.compressor(arg_1)  # (..., batch, timesteps, hidden)\n\n    if arg_3:\n      arg_12, arg_13 = arg_0.sample_static_prior(\n          arg_2, arg_9, arg_7)\n    else:\n      arg_12, arg_13 = arg_0.sample_static_posterior(arg_11, arg_2)\n\n    if arg_5:\n      arg_12 = tf.reverse(arg_12, axis=[1])\n\n    if arg_4:\n      arg_14, arg_13 = arg_0.sample_dynamic_prior(\n          arg_2, arg_9, arg_10, arg_8)\n    else:\n      arg_14, arg_13 = arg_0.sample_dynamic_posterior(\n          arg_11, arg_2, arg_12)\n\n    if arg_6:\n      arg_14 = tf.reverse(arg_14, axis=[1])\n\n    arg_15 = arg_0.decoder((arg_14, arg_12))\n    return arg_15", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "DisentangledSequentialVAE.reconstruct", "docstring": "Reconstruct the given input sequences.\n\n    Args:\n      inputs: A batch of image sequences `x_{1:T}` of shape\n        `[batch_size, timesteps, height, width, channels]`.\n      samples: Number of samples to draw from the latent distributions.\n      sample_static: Boolean for whether or not to randomly sample the\n        static latent variable `f` from its prior distribution.\n      sample_dynamic: Boolean for whether or not to randomly sample the\n        dynamic latent variable `z_{1:T}` from its prior distribution.\n      swap_static: Boolean for whether or not to swap the encodings for\n        the static latent variable `f` between the examples.\n      swap_dynamic: Boolean for whether or not to swap the encodings for\n        the dynamic latent variable `z_{1:T}` between the examples.\n      fix_static: Boolean for whether or not to share the same random\n        sample of the static latent variable `f` from its prior across\n        all examples.\n      fix_dynamic: Boolean for whether or not to share the same random\n        sample of the dynamic latent variable `z_{1:T}` from its prior\n        across all examples.\n\n    Returns:\n      A batched Independent distribution wrapping a set of Normal\n      distributions over the pixels of the reconstruction of the input,\n      where the Independent distribution has event shape [height, width,\n      channels], batch shape [samples, batch_size, timesteps], and\n      sample shape [sample_shape, samples, batch_size, timesteps,\n      height, width, channels].", "docstring_tokens": ["Reconstruct", "the", "given", "input", "sequences", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255610}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L802-L811", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Link has been destroyed.", "language": "python", "parameters": "(self, link)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_links", ".", "discard", "(", "arg_1", ")", "if", "not", "arg_0", ".", "_links", ":", "LOG", ".", "debug", "(", "\"destroying unneeded session\"", ")", "arg_0", ".", "_pn_session", ".", "close", "(", ")", "arg_0", ".", "_pn_session", ".", "free", "(", ")", "arg_0", ".", "_pn_session", "=", "None", "arg_0", ".", "_connection", "=", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Link has been destroyed.\"\"\"\n        arg_0._links.discard(arg_1)\n        if not arg_0._links:\n            # no more links\n            LOG.debug(\"destroying unneeded session\")\n            arg_0._pn_session.close()\n            arg_0._pn_session.free()\n            arg_0._pn_session = None\n            arg_0._connection = None", "path": "pyngus/link.py", "identifier": "_SessionProxy.link_destroyed", "docstring": "Link has been destroyed.", "docstring_tokens": ["Link", "has", "been", "destroyed", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 255611}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L24-L36", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Protect against re-patching the distutils if reloaded", "language": "python", "parameters": "(cls)", "return_statement": "return cls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "arg_0", ".", "__module__", ".", "startswith", "(", "'setuptools'", ")", ":", "arg_0", ",", "=", "arg_0", ".", "__bases__", "if", "not", "arg_0", ".", "__module__", ".", "startswith", "(", "'distutils'", ")", ":", "raise", "AssertionError", "(", "\"distutils has already been patched by %r\"", "%", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Protect against re-patching the distutils if reloaded\n\n    Also ensures that no other distutils extension monkeypatched the distutils\n    first.\n    \"\"\"\n    while arg_0.__module__.startswith('setuptools'):\n        arg_0, = arg_0.__bases__\n    if not arg_0.__module__.startswith('distutils'):\n        raise AssertionError(\n            \"distutils has already been patched by %r\" % arg_0\n        )\n    return arg_0", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py", "identifier": "_get_unpatched", "docstring": "Protect against re-patching the distutils if reloaded\n\n    Also ensures that no other distutils extension monkeypatched the distutils\n    first.", "docstring_tokens": ["Protect", "against", "re", "-", "patching", "the", "distutils", "if", "reloaded"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255612}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/ooaofooa.py#L243-L257", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Create a python function that interprets that action of a BridgePoint class\n    operation.", "language": "python", "parameters": "(metaclass, o_tfr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "one", "(", "arg_1", ")", ".", "O_OBJ", "[", "115", "]", "(", ")", "arg_3", "=", "arg_1", ".", "Action_Semantics_internal", "arg_4", "=", "'%s::%s'", "%", "(", "arg_2", ".", "Name", ",", "arg_1", ".", "Name", ")", "arg_5", "=", "interpret", ".", "run_operation", "if", "arg_1", ".", "Instance_Based", ":", "return", "lambda", "self", ",", "**", "kwargs", ":", "arg_5", "(", "arg_0", ",", "arg_4", ",", "arg_3", ",", "kwargs", ",", "self", ")", "else", ":", "arg_6", "=", "lambda", "cls", ",", "**", "kwargs", ":", "arg_5", "(", "arg_0", ",", "arg_4", ",", "arg_3", ",", "kwargs", ",", "None", ")", "return", "classmethod", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Create a python function that interprets that action of a BridgePoint class\n    operation.\n    '''\n    arg_2 = one(arg_1).O_OBJ[115]()\n    arg_3 = arg_1.Action_Semantics_internal\n    arg_4 = '%s::%s' % (arg_2.Name, arg_1.Name)\n    arg_5 = interpret.run_operation\n    \n    if arg_1.Instance_Based:\n        return lambda self, **kwargs: arg_5(arg_0, arg_4, arg_3, kwargs, self)\n    else:\n        arg_6 = lambda cls, **kwargs: arg_5(arg_0, arg_4, arg_3, kwargs, None)\n        return classmethod(arg_6)", "path": "bridgepoint/ooaofooa.py", "identifier": "mk_operation", "docstring": "Create a python function that interprets that action of a BridgePoint class\n    operation.", "docstring_tokens": ["Create", "a", "python", "function", "that", "interprets", "that", "action", "of", "a", "BridgePoint", "class", "operation", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 255613}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/z-jitter.py#L9-L41", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "scan jitter is in terms of the fractional pixel difference when\n    moving the laser in the z-direction", "language": "python", "parameters": "(jitter=0.0, radius=5)", "return_statement": "return s, finalimage, position", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0.0", ",", "arg_1", "=", "5", ")", ":", "arg_2", "=", "np", ".", "array", "(", "[", "2.0", ",", "1.0", ",", "3.0", "]", ")", "arg_3", "=", "init", ".", "create_single_particle_state", "(", "imsize", "=", "4", "*", "arg_1", ",", "arg_1", "=", "arg_1", ",", "psfargs", "=", "{", "'params'", ":", "arg_2", ",", "'error'", ":", "1e-6", "}", ")", "arg_4", "=", "np", ".", "s_", "[", "arg_3", ".", "pad", ":", "-", "arg_3", ".", "pad", ",", "arg_3", ".", "pad", ":", "-", "arg_3", ".", "pad", ",", "arg_3", ".", "pad", ":", "-", "arg_3", ".", "pad", "]", "arg_5", "=", "0", "*", "arg_3", ".", "get_model_image", "(", ")", "[", "arg_4", "]", "arg_6", "=", "0", "*", "arg_3", ".", "obj", ".", "pos", "[", "0", "]", "for", "arg_7", "in", "xrange", "(", "arg_5", ".", "shape", "[", "0", "]", ")", ":", "arg_8", "=", "arg_0", "*", "np", ".", "random", ".", "randn", "(", "3", ")", "*", "np", ".", "array", "(", "[", "1", ",", "0", ",", "0", "]", ")", "arg_3", ".", "obj", ".", "pos", "[", "0", "]", "=", "np", ".", "array", "(", "arg_3", ".", "image", ".", "shape", ")", "/", "2", "+", "arg_8", "arg_3", ".", "reset", "(", ")", "arg_5", "[", "arg_7", "]", "=", "arg_3", ".", "get_model_image", "(", ")", "[", "arg_4", "]", "[", "arg_7", "]", "arg_6", "+=", "arg_3", ".", "obj", ".", "pos", "[", "0", "]", "arg_6", "/=", "float", "(", "arg_5", ".", "shape", "[", "0", "]", ")", "arg_11", "=", "init", ".", "create_single_particle_state", "(", "imsize", "=", "4", "*", "arg_1", ",", "sigma", "=", "0.05", ",", "arg_1", "=", "arg_1", ",", "psfargs", "=", "{", "'params'", ":", "arg_2", ",", "'error'", ":", "1e-6", "}", ")", "arg_11", ".", "reset", "(", ")", "return", "arg_11", ",", "arg_5", ",", "arg_6"], "function": "def Func(arg_0=0.0, arg_1=5):\n    \"\"\"\n    scan jitter is in terms of the fractional pixel difference when\n    moving the laser in the z-direction\n    \"\"\"\n    arg_2 = np.array([2.0, 1.0, 3.0])\n\n    # create a base image of one particle\n    arg_3 = init.create_single_particle_state(imsize=4*arg_1, \n            arg_1=arg_1, psfargs={'params': arg_2, 'error': 1e-6})\n    arg_4 = np.s_[arg_3.pad:-arg_3.pad,arg_3.pad:-arg_3.pad,arg_3.pad:-arg_3.pad]\n\n    # add up a bunch of trajectories\n    arg_5 = 0*arg_3.get_model_image()[arg_4]\n    arg_6 = 0*arg_3.obj.pos[0]\n\n    for arg_7 in xrange(arg_5.shape[0]):\n        arg_8 = arg_0*np.random.randn(3)*np.array([1,0,0])\n        arg_3.obj.pos[0] = np.array(arg_3.image.shape)/2 + arg_8\n        arg_3.reset()\n\n        arg_5[arg_7] = arg_3.get_model_image()[arg_4][arg_7]\n        arg_6 += arg_3.obj.pos[0]\n\n    arg_6 /= float(arg_5.shape[0])\n\n    # place that into a new image at the expected parameters\n    arg_11 = init.create_single_particle_state(imsize=4*arg_1, sigma=0.05,\n            arg_1=arg_1, psfargs={'params': arg_2, 'error': 1e-6})\n    arg_11.reset()\n\n    # measure the true inferred parameters\n    return arg_11, arg_5, arg_6", "path": "scripts/does_matter/z-jitter.py", "identifier": "zjitter", "docstring": "scan jitter is in terms of the fractional pixel difference when\n    moving the laser in the z-direction", "docstring_tokens": ["scan", "jitter", "is", "in", "terms", "of", "the", "fractional", "pixel", "difference", "when", "moving", "the", "laser", "in", "the", "z", "-", "direction"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255614}
{"url": "https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/russian_tax.py#L47-L50", "sha": "e15f2e59538deb4cbfceaac314f5ea897f2d5450", "docstring_summary": "Return a random bank account number.", "language": "python", "parameters": "()", "return_statement": "return \"\".join(map(str, account))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "random", ".", "randint", "(", "1", ",", "9", ")", "for", "_", "in", "range", "(", "20", ")", "]", "return", "\"\"", ".", "join", "(", "map", "(", "str", ",", "arg_0", ")", ")"], "function": "def Func():\n    \"\"\"Return a random bank account number.\"\"\"\n    arg_0 = [random.randint(1, 9) for _ in range(20)]\n    return \"\".join(map(str, arg_0))", "path": "forgery_py/forgery/russian_tax.py", "identifier": "account_number", "docstring": "Return a random bank account number.", "docstring_tokens": ["Return", "a", "random", "bank", "account", "number", "."], "nwo": "pilosus/ForgeryPy3", "score": 0.3588333959790546, "idx": 255615}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/api/serializers.py#L133-L137", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Set the new password for the user.", "language": "python", "parameters": "(self, instance, validated_data)", "return_statement": "return instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "set_password", "(", "arg_2", "[", "'new_password'", "]", ")", "arg_1", ".", "save", "(", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Set the new password for the user.\"\"\"\n        arg_1.set_password(arg_2['new_password'])\n        arg_1.save()\n        return arg_1", "path": "user_management/api/serializers.py", "identifier": "PasswordResetSerializer.update", "docstring": "Set the new password for the user.", "docstring_tokens": ["Set", "the", "new", "password", "for", "the", "user", "."], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 255616}
{"url": "https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/sanscript/roman_mapper.py#L1-L103", "sha": "b7c5166a275c15a612fbb96fd3d765bc9004b299", "docstring_summary": "Transliterate `data` with the given `scheme_map`. This function is used\n  when the source scheme is a Roman scheme.", "language": "python", "parameters": "(data, scheme_map, **kw)", "return_statement": "return ''.join(buf)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "vowels", "arg_4", "=", "arg_1", ".", "marks", "arg_5", "=", "arg_1", ".", "virama", "arg_6", "=", "arg_1", ".", "consonants", "arg_7", "=", "arg_1", ".", "non_marks_viraama", "arg_8", "=", "arg_1", ".", "max_key_length_from_scheme", "arg_9", "=", "arg_1", ".", "to_scheme", ".", "isFunc", "arg_10", "=", "arg_2", ".", "pop", "(", "'togglers'", ",", "set", "(", ")", ")", "arg_11", "=", "arg_2", ".", "pop", "(", "'suspend_on'", ",", "set", "(", ")", ")", "arg_12", "=", "arg_2", ".", "pop", "(", "'suspend_off'", ",", "set", "(", ")", ")", "if", "arg_2", ":", "raise", "TypeError", "(", "'Unexpected keyword argument %s'", "%", "list", "(", "arg_2", ".", "keys", "(", ")", ")", "[", "0", "]", ")", "arg_13", "=", "[", "]", "arg_14", "=", "0", "arg_15", "=", "arg_21", "=", "False", "arg_16", "=", "len", "(", "arg_0", ")", "arg_17", "=", "arg_13", ".", "append", "arg_18", "=", "False", "arg_19", "=", "False", "while", "arg_14", "<=", "arg_16", ":", "arg_20", "=", "arg_0", "[", "arg_14", ":", "arg_14", "+", "arg_8", "]", "while", "arg_20", ":", "if", "arg_20", "in", "arg_10", ":", "arg_18", "=", "not", "arg_18", "arg_14", "+=", "2", "arg_21", "=", "True", "break", "if", "arg_20", "in", "arg_11", ":", "arg_19", "=", "True", "elif", "arg_20", "in", "arg_12", ":", "arg_19", "=", "False", "if", "arg_18", "or", "arg_19", ":", "arg_20", "=", "arg_20", "[", ":", "-", "1", "]", "continue", "if", "arg_15", "and", "arg_20", "in", "arg_3", ":", "arg_22", "=", "arg_4", ".", "get", "(", "arg_20", ",", "''", ")", "if", "arg_22", ":", "arg_17", "(", "arg_22", ")", "elif", "arg_9", ":", "arg_17", "(", "arg_3", "[", "arg_20", "]", ")", "arg_21", "=", "True", "elif", "arg_20", "in", "arg_7", ":", "if", "arg_15", ":", "arg_17", "(", "arg_5", "[", "''", "]", ")", "arg_17", "(", "arg_7", "[", "arg_20", "]", ")", "arg_21", "=", "True", "if", "arg_21", ":", "arg_15", "=", "arg_20", "in", "arg_6", "arg_14", "+=", "len", "(", "arg_20", ")", "break", "else", ":", "arg_20", "=", "arg_20", "[", ":", "-", "1", "]", "if", "not", "arg_21", ":", "if", "arg_15", ":", "arg_17", "(", "arg_5", "[", "''", "]", ")", "if", "arg_14", "<", "arg_16", ":", "arg_17", "(", "arg_0", "[", "arg_14", "]", ")", "arg_15", "=", "False", "arg_14", "+=", "1", "arg_21", "=", "False", "return", "''", ".", "join", "(", "arg_13", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n  \"\"\"Transliterate `data` with the given `scheme_map`. This function is used\n  when the source scheme is a Roman scheme.\n\n  :param data: the data to transliterate\n  :param scheme_map: a dict that maps between characters in the old scheme\n                     and characters in the new scheme\n  \"\"\"\n  arg_3 = arg_1.vowels\n  arg_4 = arg_1.marks\n  arg_5 = arg_1.virama\n  arg_6 = arg_1.consonants\n  arg_7 = arg_1.non_marks_viraama\n  arg_8 = arg_1.max_key_length_from_scheme\n  arg_9 = arg_1.to_scheme.isFunc\n\n  arg_10 = arg_2.pop('togglers', set())\n  arg_11 = arg_2.pop('suspend_on', set())\n  arg_12 = arg_2.pop('suspend_off', set())\n  if arg_2:\n    raise TypeError('Unexpected keyword argument %s' % list(arg_2.keys())[0])\n\n  arg_13 = []\n  arg_14 = 0\n  arg_15 = arg_21 = False\n  arg_16 = len(arg_0)\n  arg_17 = arg_13.append\n\n  # If true, don't transliterate. The toggle token is discarded.\n  arg_18 = False\n  # If true, don't transliterate. The suspend token is retained.\n  # `suspended` overrides `toggled`.\n  arg_19 = False\n\n  while arg_14 <= arg_16:\n    # The longest token in the source scheme has length `max_key_length_from_scheme`. Iterate\n    # over `data` while taking `max_key_length_from_scheme` characters at a time. If we don`t\n    # find the character group in our scheme map, lop off a character and\n    # try again.\n    #\n    # If we've finished reading through `data`, then `token` will be empty\n    # and the loop below will be skipped.\n    arg_20 = arg_0[arg_14:arg_14 + arg_8]\n\n    while arg_20:\n      if arg_20 in arg_10:\n        arg_18 = not arg_18\n        arg_14 += 2  # skip over the token\n        arg_21 = True  # force the token to fill up again\n        break\n\n      if arg_20 in arg_11:\n        arg_19 = True\n      elif arg_20 in arg_12:\n        arg_19 = False\n\n      if arg_18 or arg_19:\n        arg_20 = arg_20[:-1]\n        continue\n\n      # Catch the pattern CV, where C is a consonant and V is a vowel.\n      # V should be rendered as a vowel mark, a.k.a. a \"dependent\"\n      # vowel. But due to the nature of Brahmic scripts, 'a' is implicit\n      # and has no vowel mark. If we see 'a', add nothing.\n      if arg_15 and arg_20 in arg_3:\n        arg_22 = arg_4.get(arg_20, '')\n        if arg_22:\n          arg_17(arg_22)\n        elif arg_9:\n          arg_17(arg_3[arg_20])\n        arg_21 = True\n\n      # Catch any non_marks_viraama character, including consonants, punctuation,\n      # and regular vowels. Due to the implicit 'a', we must explicitly\n      # end any lingering consonants before we can handle the current\n      # token.\n      elif arg_20 in arg_7:\n        if arg_15:\n          arg_17(arg_5[''])\n        arg_17(arg_7[arg_20])\n        arg_21 = True\n\n      if arg_21:\n        arg_15 = arg_20 in arg_6\n        arg_14 += len(arg_20)\n        break\n      else:\n        arg_20 = arg_20[:-1]\n\n    # We've exhausted the token; this must be some other character. Due to\n    # the implicit 'a', we must explicitly end any lingering consonants\n    # before we can handle the current token.\n    if not arg_21:\n      if arg_15:\n        arg_17(arg_5[''])\n      if arg_14 < arg_16:\n        arg_17(arg_0[arg_14])\n        arg_15 = False\n      arg_14 += 1\n\n    arg_21 = False\n\n  return ''.join(arg_13)", "path": "indic_transliteration/sanscript/roman_mapper.py", "identifier": "_roman", "docstring": "Transliterate `data` with the given `scheme_map`. This function is used\n  when the source scheme is a Roman scheme.\n\n  :param data: the data to transliterate\n  :param scheme_map: a dict that maps between characters in the old scheme\n                     and characters in the new scheme", "docstring_tokens": ["Transliterate", "data", "with", "the", "given", "scheme_map", ".", "This", "function", "is", "used", "when", "the", "source", "scheme", "is", "a", "Roman", "scheme", "."], "nwo": "sanskrit-coders/indic_transliteration", "score": 0.19543626030129047, "idx": 255617}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/slack.py#L177-L193", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Extracts the identifier from a Slack item.", "language": "python", "parameters": "(item)", "return_statement": "return item['ts'] + nick", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'user'", "in", "arg_0", ":", "arg_1", "=", "arg_0", "[", "'user'", "]", "elif", "'comment'", "in", "arg_0", ":", "arg_1", "=", "arg_0", "[", "'comment'", "]", "[", "'user'", "]", "else", ":", "arg_1", "=", "arg_0", "[", "'bot_id'", "]", "return", "arg_0", "[", "'ts'", "]", "+", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Extracts the identifier from a Slack item.\n\n        This identifier will be the mix of two fields because Slack\n        messages does not have any unique identifier. In this case,\n        'ts' and 'user' values (or 'bot_id' when the message is sent by a bot)\n        are combined because there have been cases where two messages were sent\n        by different users at the same time.\n        \"\"\"\n        if 'user' in arg_0:\n            arg_1 = arg_0['user']\n        elif 'comment' in arg_0:\n            arg_1 = arg_0['comment']['user']\n        else:\n            arg_1 = arg_0['bot_id']\n\n        return arg_0['ts'] + arg_1", "path": "perceval/backends/core/slack.py", "identifier": "Slack.metadata_id", "docstring": "Extracts the identifier from a Slack item.\n\n        This identifier will be the mix of two fields because Slack\n        messages does not have any unique identifier. In this case,\n        'ts' and 'user' values (or 'bot_id' when the message is sent by a bot)\n        are combined because there have been cases where two messages were sent\n        by different users at the same time.", "docstring_tokens": ["Extracts", "the", "identifier", "from", "a", "Slack", "item", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255618}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/canvas.py#L124-L134", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Size is only set the first time it is called", "language": "python", "parameters": "(self, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "size", "is", "None", ":", "arg_0", ".", "size", "=", "arg_1", "return", "arg_1", "else", ":", "return", "arg_0", ".", "size"], "function": "def Func(arg_0, arg_1):\n        '''\n        Size is only set the first time it is called\n\n        Size that is set is returned\n        '''\n        if arg_0.size is None:\n            arg_0.size = arg_1\n            return arg_1\n        else:\n            return arg_0.size", "path": "shoebot/core/canvas.py", "identifier": "Canvas.set_size", "docstring": "Size is only set the first time it is called\n\n        Size that is set is returned", "docstring_tokens": ["Size", "is", "only", "set", "the", "first", "time", "it", "is", "called"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255619}
{"url": "https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/percolate.py#L638-L705", "sha": "92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac", "docstring_summary": "Compute the average moments of the cluster size distributions", "language": "python", "parameters": "(moments, alpha)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "arg_3", "=", "arg_0", ".", "shape", "[", "0", "]", "arg_4", "=", "np", ".", "sqrt", "(", "arg_3", ")", "arg_5", "=", "arg_0", ".", "mean", "(", "axis", "=", "0", ")", "arg_2", "[", "'moments'", "]", "=", "arg_5", "arg_6", "=", "arg_0", ".", "std", "(", "axis", "=", "0", ",", "ddof", "=", "1", ")", "arg_2", "[", "'moments_ci'", "]", "=", "np", ".", "empty", "(", "(", "5", ",", "2", ")", ")", "for", "arg_7", "in", "range", "(", "5", ")", ":", "if", "arg_6", "[", "arg_7", "]", ":", "arg_8", "=", "np", ".", "seterr", "(", "all", "=", "'raise'", ")", "arg_2", "[", "'moments_ci'", "]", "[", "arg_7", "]", "=", "scipy", ".", "stats", ".", "t", ".", "interval", "(", "1", "-", "arg_1", ",", "df", "=", "arg_3", "-", "1", ",", "loc", "=", "arg_5", "[", "arg_7", "]", ",", "scale", "=", "arg_6", "[", "arg_7", "]", "/", "arg_4", ")", "np", ".", "seterr", "(", "**", "arg_8", ")", "else", ":", "arg_2", "[", "'moments_ci'", "]", "[", "arg_7", "]", "=", "(", "arg_5", "[", "arg_7", "]", "*", "np", ".", "ones", "(", "2", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Compute the average moments of the cluster size distributions\n\n    Helper function for :func:`microcanonical_averages`\n\n    Parameters\n    ----------\n\n    moments : 2-D :py:class:`numpy.ndarray` of int\n        ``moments.shape[1] == 5`.\n        Each array ``moments[r, :]`` is the ``moments`` field of the output of\n        :func:`sample_states`:\n        The ``k``-th entry is the ``k``-th raw moment of the (absolute) cluster\n        size distribution.\n\n    alpha: float\n        Significance level.\n\n    Returns\n    -------\n\n    ret : dict\n        Moment statistics\n\n    ret['moments'] : 1-D :py:class:`numpy.ndarray` of float, size 5\n        The ``k``-th entry is the average ``k``-th raw moment of the (absolute)\n        cluster size distribution, with ``k`` ranging from ``0`` to ``4``.\n\n    ret['moments_ci'] : 2-D :py:class:`numpy.ndarray` of float, shape (5,2)\n        ``ret['moments_ci'][k]`` are the lower and upper bounds of the normal\n        confidence interval of the average ``k``-th raw moment of the\n        (absolute) cluster size distribution, with ``k`` ranging from ``0`` to\n        ``4``.\n\n    See Also\n    --------\n\n    sample_states : computation of moments\n\n    microcanonical_averages : moment statistics\n    \"\"\"\n\n    arg_2 = dict()\n    arg_3 = arg_0.shape[0]\n    arg_4 = np.sqrt(arg_3)\n\n    arg_5 = arg_0.mean(axis=0)\n    arg_2['moments'] = arg_5\n\n    arg_6 = arg_0.std(axis=0, ddof=1)\n    arg_2['moments_ci'] = np.empty((5, 2))\n    for arg_7 in range(5):\n        if arg_6[arg_7]:\n            arg_8 = np.seterr(all='raise')\n            arg_2['moments_ci'][arg_7] = scipy.stats.t.interval(\n                1 - arg_1,\n                df=arg_3 - 1,\n                loc=arg_5[arg_7],\n                scale=arg_6[arg_7] / arg_4\n            )\n            np.seterr(**arg_8)\n        else:\n            arg_2['moments_ci'][arg_7] = (\n                arg_5[arg_7] * np.ones(2)\n            )\n\n    return arg_2", "path": "percolate/percolate.py", "identifier": "_microcanonical_average_moments", "docstring": "Compute the average moments of the cluster size distributions\n\n    Helper function for :func:`microcanonical_averages`\n\n    Parameters\n    ----------\n\n    moments : 2-D :py:class:`numpy.ndarray` of int\n        ``moments.shape[1] == 5`.\n        Each array ``moments[r, :]`` is the ``moments`` field of the output of\n        :func:`sample_states`:\n        The ``k``-th entry is the ``k``-th raw moment of the (absolute) cluster\n        size distribution.\n\n    alpha: float\n        Significance level.\n\n    Returns\n    -------\n\n    ret : dict\n        Moment statistics\n\n    ret['moments'] : 1-D :py:class:`numpy.ndarray` of float, size 5\n        The ``k``-th entry is the average ``k``-th raw moment of the (absolute)\n        cluster size distribution, with ``k`` ranging from ``0`` to ``4``.\n\n    ret['moments_ci'] : 2-D :py:class:`numpy.ndarray` of float, shape (5,2)\n        ``ret['moments_ci'][k]`` are the lower and upper bounds of the normal\n        confidence interval of the average ``k``-th raw moment of the\n        (absolute) cluster size distribution, with ``k`` ranging from ``0`` to\n        ``4``.\n\n    See Also\n    --------\n\n    sample_states : computation of moments\n\n    microcanonical_averages : moment statistics", "docstring_tokens": ["Compute", "the", "average", "moments", "of", "the", "cluster", "size", "distributions"], "nwo": "andsor/pypercolate", "score": 0.27946077266739355, "idx": 255620}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/treeutil.py#L11-L18", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Yields all the elements descendant of elem in document order", "language": "python", "parameters": "(elem)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "xml_children", ":", "if", "isinstance", "(", "arg_1", ",", "element", ")", ":", "yield", "arg_1", "yield", "from", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    '''\n    Yields all the elements descendant of elem in document order\n    '''\n    for arg_1 in arg_0.xml_children:\n        if isinstance(arg_1, element):\n            yield arg_1\n            yield from Func(arg_1)", "path": "pylib/uxml/treeutil.py", "identifier": "descendants", "docstring": "Yields all the elements descendant of elem in document order", "docstring_tokens": ["Yields", "all", "the", "elements", "descendant", "of", "elem", "in", "document", "order"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 255621}
{"url": "https://github.com/BlueDragonX/detach/blob/e2e5a1076e19f508baf3ffb2b586a75934fbae28/detach.py#L50-L57", "sha": "e2e5a1076e19f508baf3ffb2b586a75934fbae28", "docstring_summary": "Close a file descriptor if it is open.", "language": "python", "parameters": "(self, fd)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "os", ".", "close", "(", "arg_1", ")", "except", "OSError", ",", "exc", ":", "if", "exc", ".", "errno", "!=", "errno", ".", "EBADF", ":", "arg_2", "=", "\"Failed to close file descriptor {}: {}\"", ".", "format", "(", "arg_1", ",", "exc", ")", "raise", "Error", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Close a file descriptor if it is open.\"\"\"\n        try:\n            os.close(arg_1)\n        except OSError, exc:\n            if exc.errno != errno.EBADF:\n                arg_2 = \"Failed to close file descriptor {}: {}\".format(arg_1, exc)\n                raise Error(arg_2)", "path": "detach.py", "identifier": "Detach._close_fd", "docstring": "Close a file descriptor if it is open.", "docstring_tokens": ["Close", "a", "file", "descriptor", "if", "it", "is", "open", "."], "nwo": "BlueDragonX/detach", "score": 0.2643786477459777, "idx": 255622}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L731-L737", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Generic preset function, marks a parameter or config for presetting.", "language": "python", "parameters": "(self, name, args, kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ".", "f_contains", "(", "arg_1", ",", "shortcuts", "=", "False", ")", ":", "raise", "ValueError", "(", "'Parameter `%s` is already part of your trajectory, use the normal'", "'accessing routine to change config.'", "%", "arg_1", ")", "else", ":", "arg_0", ".", "_changed_default_parameters", "[", "arg_1", "]", "=", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Generic preset function, marks a parameter or config for presetting.\"\"\"\n        if arg_0.f_contains(arg_1, shortcuts=False):\n            raise ValueError('Parameter `%s` is already part of your trajectory, use the normal'\n                             'accessing routine to change config.' % arg_1)\n        else:\n            arg_0._changed_default_parameters[arg_1] = (arg_2, arg_3)", "path": "pypet/trajectory.py", "identifier": "Trajectory._preset", "docstring": "Generic preset function, marks a parameter or config for presetting.", "docstring_tokens": ["Generic", "preset", "function", "marks", "a", "parameter", "or", "config", "for", "presetting", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255623}
{"url": "https://github.com/python/performance/blob/2a9524c0a5714e85106671bc61d750e800fe17db/performance/benchmarks/bm_go.py#L352-L363", "sha": "2a9524c0a5714e85106671bc61d750e800fe17db", "docstring_summary": "select move; unexplored children first, then according to uct value", "language": "python", "parameters": "(self, board)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "unexplored", ":", "arg_2", "=", "random", ".", "randrange", "(", "len", "(", "arg_0", ".", "unexplored", ")", ")", "arg_3", "=", "arg_0", ".", "unexplored", "[", "arg_2", "]", "arg_0", ".", "unexplored", "[", "arg_2", "]", "=", "arg_0", ".", "unexplored", "[", "len", "(", "arg_0", ".", "unexplored", ")", "-", "1", "]", "arg_0", ".", "unexplored", ".", "pop", "(", ")", "return", "arg_3", "elif", "arg_0", ".", "bestchild", ":", "return", "arg_0", ".", "bestchild", ".", "pos", "else", ":", "return", "PASS"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Func move; unexplored children first, then according to uct value \"\"\"\n        if arg_0.unexplored:\n            arg_2 = random.randrange(len(arg_0.unexplored))\n            arg_3 = arg_0.unexplored[arg_2]\n            arg_0.unexplored[arg_2] = arg_0.unexplored[len(arg_0.unexplored) - 1]\n            arg_0.unexplored.pop()\n            return arg_3\n        elif arg_0.bestchild:\n            return arg_0.bestchild.pos\n        else:\n            return PASS", "path": "performance/benchmarks/bm_go.py", "identifier": "UCTNode.select", "docstring": "select move; unexplored children first, then according to uct value", "docstring_tokens": ["select", "move", ";", "unexplored", "children", "first", "then", "according", "to", "uct", "value"], "nwo": "python/performance", "score": 0.9320212778991671, "idx": 255624}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L366-L372", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns bounds that encompass the union of the two.", "language": "python", "parameters": "(self, b)", "return_statement": "return Bounds(mx, my,\r\n            max(self.x+self.width, b.x+b.width) - mx,\r\n            max(self.y+self.height, b.y+b.height) - my)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "min", "(", "arg_0", ".", "x", ",", "arg_1", ".", "x", ")", ",", "min", "(", "arg_0", ".", "y", ",", "arg_1", ".", "y", ")", "return", "Bounds", "(", "arg_2", ",", "arg_3", ",", "max", "(", "arg_0", ".", "x", "+", "arg_0", ".", "width", ",", "arg_1", ".", "x", "+", "arg_1", ".", "width", ")", "-", "arg_2", ",", "max", "(", "arg_0", ".", "y", "+", "arg_0", ".", "height", ",", "arg_1", ".", "y", "+", "arg_1", ".", "height", ")", "-", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\" Returns bounds that encompass the Func of the two.\r\n        \"\"\"\r\n        arg_2, arg_3 = min(arg_0.x, arg_1.x), min(arg_0.y, arg_1.y)\r\n        return Bounds(arg_2, arg_3,\r\n            max(arg_0.x+arg_0.width, arg_1.x+arg_1.width) - arg_2,\r\n            max(arg_0.y+arg_0.height, arg_1.y+arg_1.height) - arg_3)", "path": "shoebot/data/geometry.py", "identifier": "Bounds.union", "docstring": "Returns bounds that encompass the union of the two.", "docstring_tokens": ["Returns", "bounds", "that", "encompass", "the", "union", "of", "the", "two", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255625}
{"url": "https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L208-L224", "sha": "91cf751dafdb208a0c8b5377945e5808b99f94ba", "docstring_summary": "This call returns an array of symbols that IEX Cloud supports for API calls.", "language": "python", "parameters": "(token='', version='')", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "''", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "pd", ".", "DataFrame", "(", "symbols", "(", "arg_0", ",", "arg_1", ")", ")", "_toDatetime", "(", "arg_2", ")", "_reindex", "(", "arg_2", ",", "'symbol'", ")", "return", "arg_2"], "function": "def Func(arg_0='', arg_1=''):\n    '''This call returns an array of symbols that IEX Cloud supports for API calls.\n\n    https://iexcloud.io/docs/api/#symbols\n    8am, 9am, 12pm, 1pm UTC daily\n\n    Args:\n        token (string); Access token\n        version (string); API version\n\n    Returns:\n        dataframe: result\n    '''\n    arg_2 = pd.DataFrame(symbols(arg_0, arg_1))\n    _toDatetime(arg_2)\n    _reindex(arg_2, 'symbol')\n    return arg_2", "path": "pyEX/refdata.py", "identifier": "symbolsDF", "docstring": "This call returns an array of symbols that IEX Cloud supports for API calls.\n\n    https://iexcloud.io/docs/api/#symbols\n    8am, 9am, 12pm, 1pm UTC daily\n\n    Args:\n        token (string); Access token\n        version (string); API version\n\n    Returns:\n        dataframe: result", "docstring_tokens": ["This", "call", "returns", "an", "array", "of", "symbols", "that", "IEX", "Cloud", "supports", "for", "API", "calls", "."], "nwo": "timkpaine/pyEX", "score": 0.7739774393741435, "idx": 255626}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/device.py#L101-L109", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Called when GATT characteristics have been discovered.", "language": "python", "parameters": "(self, service)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_discovered_services", ".", "add", "(", "arg_1", ")", "if", "arg_0", ".", "_discovered_services", ">=", "set", "(", "arg_0", ".", "_peripheral", ".", "services", "(", ")", ")", ":", "arg_0", ".", "_discovered", ".", "set", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Called when GATT characteristics have been discovered.\"\"\"\n        # Characteristics for the specified service were discovered.  Update\n        # set of discovered services and signal when all have been discovered.\n        arg_0._discovered_services.add(arg_1)\n        if arg_0._discovered_services >= set(arg_0._peripheral.services()):\n            # Found all the services characteristics, finally time to fire the\n            # service discovery complete event.\n            arg_0._discovered.set()", "path": "Adafruit_BluefruitLE/corebluetooth/device.py", "identifier": "CoreBluetoothDevice._characteristics_discovered", "docstring": "Called when GATT characteristics have been discovered.", "docstring_tokens": ["Called", "when", "GATT", "characteristics", "have", "been", "discovered", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 255627}
{"url": "https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L32-L42", "sha": "897934d593fade0eb1998f8fadd18c91a89e5b9a", "docstring_summary": "Returns HTML5 Boilerplate CSS file.\n    Included in HTML5 Boilerplate.", "language": "python", "parameters": "(version=None)", "return_statement": "return format_html(\n        '<link rel=\"stylesheet\" href=\"{0}djfrontend/css/h5bp/{1}/h5bp.css\">',\n        _static_url, version)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_H5BP_CSS'", ",", "DJFRONTEND_H5BP_CSS_DEFAULT", ")", "return", "format_html", "(", "'<link rel=\"stylesheet\" href=\"{0}djfrontend/css/h5bp/{1}/h5bp.css\">'", ",", "_static_url", ",", "arg_0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Returns HTML5 Boilerplate CSS file.\n    Included in HTML5 Boilerplate.\n    \"\"\"\n    if arg_0 is None:\n        arg_0 = getattr(settings, 'DJFRONTEND_H5BP_CSS', DJFRONTEND_H5BP_CSS_DEFAULT)\n\n    return format_html(\n        '<link rel=\"stylesheet\" href=\"{0}djfrontend/css/h5bp/{1}/h5bp.css\">',\n        _static_url, arg_0)", "path": "djfrontend/templatetags/djfrontend.py", "identifier": "djfrontend_h5bp_css", "docstring": "Returns HTML5 Boilerplate CSS file.\n    Included in HTML5 Boilerplate.", "docstring_tokens": ["Returns", "HTML5", "Boilerplate", "CSS", "file", ".", "Included", "in", "HTML5", "Boilerplate", "."], "nwo": "jonfaustman/django-frontend", "score": 0.1952535678330188, "idx": 255628}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/inference.py#L22-L31", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Add edges to the graph when a two way edge exists, and the opposite direction doesn't exist.", "language": "python", "parameters": "(graph)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "in", "arg_0", ".", "edges", "(", "data", "=", "True", ",", "keys", "=", "True", ")", ":", "if", "arg_4", "[", "RELATION", "]", "in", "TWO_WAY_RELATIONS", ":", "infer_missing_backwards_edge", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Add edges to the graph when a two way edge exists, and the opposite direction doesn't exist.\n\n    Use: two way edges from BEL definition and/or axiomatic inverses of membership relations\n\n    :param pybel.BELGraph graph: A BEL graph\n    \"\"\"\n    for arg_1, arg_2, arg_3, arg_4 in arg_0.edges(data=True, keys=True):\n        if arg_4[RELATION] in TWO_WAY_RELATIONS:\n            infer_missing_backwards_edge(arg_0, arg_1, arg_2, arg_3)", "path": "src/pybel_tools/mutation/inference.py", "identifier": "infer_missing_two_way_edges", "docstring": "Add edges to the graph when a two way edge exists, and the opposite direction doesn't exist.\n\n    Use: two way edges from BEL definition and/or axiomatic inverses of membership relations\n\n    :param pybel.BELGraph graph: A BEL graph", "docstring_tokens": ["Add", "edges", "to", "the", "graph", "when", "a", "two", "way", "edge", "exists", "and", "the", "opposite", "direction", "doesn", "t", "exist", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255629}
{"url": "https://github.com/zwischenloesung/ardu-report-lib/blob/51bd4a07e036065aafcb1273b151bea3fdfa50fa/libardurep/datastore.py#L207-L219", "sha": "51bd4a07e036065aafcb1273b151bea3fdfa50fa", "docstring_summary": "Get the data as JSON tuples", "language": "python", "parameters": "(self, prettyprint=False, translate=True)", "return_statement": "return j", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "get_json", "(", "arg_1", ",", "arg_2", ")", "if", "len", "(", "arg_3", ")", ">", "2", ":", "if", "arg_1", ":", "arg_3", "=", "arg_3", "[", "1", ":", "-", "2", "]", "+", "\",\\n\"", "else", ":", "arg_3", "=", "arg_3", "[", "1", ":", "-", "1", "]", "+", "\",\"", "else", ":", "arg_3", "=", "\"\"", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n        \"\"\"\n        Get the data as JSON tuples\n        \"\"\"\n        arg_3 = arg_0.get_json(arg_1, arg_2)\n        if len(arg_3) > 2:\n            if arg_1:\n                arg_3 = arg_3[1:-2] + \",\\n\"\n            else:\n                arg_3 = arg_3[1:-1] + \",\"\n        else:\n            arg_3 = \"\"\n        return arg_3", "path": "libardurep/datastore.py", "identifier": "DataStore.get_json_tuples", "docstring": "Get the data as JSON tuples", "docstring_tokens": ["Get", "the", "data", "as", "JSON", "tuples"], "nwo": "zwischenloesung/ardu-report-lib", "score": 0.0, "idx": 255630}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/bfgs.py#L476-L491", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes the outer product of two possibly batched vectors.", "language": "python", "parameters": "(t1, t2)", "return_statement": "return tf.matmul(tf.expand_dims(t1, axis=-1), tf.expand_dims(t2, axis=-2))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "tf", ".", "matmul", "(", "tf", ".", "expand_dims", "(", "arg_0", ",", "axis", "=", "-", "1", ")", ",", "tf", ".", "expand_dims", "(", "arg_1", ",", "axis", "=", "-", "2", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Computes the outer product of two possibly batched vectors.\n\n  Args:\n    t1: A `tf.Tensor` of shape `[..., n]`.\n    t2: A `tf.Tensor` of shape `[..., m]`.\n\n  Returns:\n    A tensor of shape `[..., n, m]` with matching batch dimensions, let's call\n    it `r`, whose components are:\n\n    ```None\n      r[..., i, j] = t1[..., i] * t2[..., j]\n    ```\n  \"\"\"\n  return tf.matmul(tf.expand_dims(arg_0, axis=-1), tf.expand_dims(arg_1, axis=-2))", "path": "tensorflow_probability/python/optimizer/bfgs.py", "identifier": "_tensor_product", "docstring": "Computes the outer product of two possibly batched vectors.\n\n  Args:\n    t1: A `tf.Tensor` of shape `[..., n]`.\n    t2: A `tf.Tensor` of shape `[..., m]`.\n\n  Returns:\n    A tensor of shape `[..., n, m]` with matching batch dimensions, let's call\n    it `r`, whose components are:\n\n    ```None\n      r[..., i, j] = t1[..., i] * t2[..., j]\n    ```", "docstring_tokens": ["Computes", "the", "outer", "product", "of", "two", "possibly", "batched", "vectors", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255631}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/normalizer.py#L138-L180", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "r\"\"\"Replace macros in the TeX source with their content.", "language": "python", "parameters": "(tex_source, macros)", "return_statement": "return tex_source", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "arg_4", "=", "re", ".", "escape", "(", "arg_2", ")", "+", "r\"\\\\?\"", "arg_0", "=", "re", ".", "sub", "(", "arg_4", ",", "lambda", "_", ":", "arg_3", ",", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    r\"\"\"Replace macros in the TeX source with their content.\n\n    Parameters\n    ----------\n    tex_source : `str`\n        TeX source content.\n    macros : `dict`\n        Keys are macro names (including leading ``\\``) and values are the\n        content (as `str`) of the macros. See\n        `lsstprojectmeta.tex.scraper.get_macros`.\n\n    Returns\n    -------\n    tex_source : `str`\n        TeX source with known macros replaced.\n\n    Notes\n    -----\n    Macros with arguments are not supported.\n\n    Examples\n    --------\n    >>> macros = {r'\\handle': 'LDM-nnn'}\n    >>> sample = r'This is document \\handle.'\n    >>> Func(sample, macros)\n    'This is document LDM-nnn.'\n\n    Any trailing slash after the macro command is also replaced by this\n    function.\n\n    >>> macros = {r'\\product': 'Data Management'}\n    >>> sample = r'\\title    [Test Plan]  { \\product\\ Test Plan}'\n    >>> Func(sample, macros)\n    '\\\\title    [Test Plan]  { Data Management Test Plan}'\n    \"\"\"\n    for arg_2, arg_3 in arg_1.items():\n        # '\\\\?' suffix matches an optional trailing '\\' that might be used\n        # for spacing.\n        arg_4 = re.escape(arg_2) + r\"\\\\?\"\n        # Wrap macro_content in lambda to avoid processing escapes\n        arg_0 = re.sub(arg_4, lambda _: arg_3, arg_0)\n    return arg_0", "path": "lsstprojectmeta/tex/normalizer.py", "identifier": "replace_macros", "docstring": "r\"\"\"Replace macros in the TeX source with their content.\n\n    Parameters\n    ----------\n    tex_source : `str`\n        TeX source content.\n    macros : `dict`\n        Keys are macro names (including leading ``\\``) and values are the\n        content (as `str`) of the macros. See\n        `lsstprojectmeta.tex.scraper.get_macros`.\n\n    Returns\n    -------\n    tex_source : `str`\n        TeX source with known macros replaced.\n\n    Notes\n    -----\n    Macros with arguments are not supported.\n\n    Examples\n    --------\n    >>> macros = {r'\\handle': 'LDM-nnn'}\n    >>> sample = r'This is document \\handle.'\n    >>> replace_macros(sample, macros)\n    'This is document LDM-nnn.'\n\n    Any trailing slash after the macro command is also replaced by this\n    function.\n\n    >>> macros = {r'\\product': 'Data Management'}\n    >>> sample = r'\\title    [Test Plan]  { \\product\\ Test Plan}'\n    >>> replace_macros(sample, macros)\n    '\\\\title    [Test Plan]  { Data Management Test Plan}'", "docstring_tokens": ["r", "Replace", "macros", "in", "the", "TeX", "source", "with", "their", "content", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 255632}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L38-L59", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Variance-covariance calculation of daily Value-at-Risk in a\n    portfolio.", "language": "python", "parameters": "(P, c, mu=0, sigma=1)", "return_statement": "return P - P * (alpha + 1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "1", ")", ":", "arg_4", "=", "sp", ".", "stats", ".", "norm", ".", "ppf", "(", "1", "-", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_0", "-", "arg_0", "*", "(", "arg_4", "+", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=1):\n    \"\"\"\n    Variance-covariance calculation of daily Value-at-Risk in a\n    portfolio.\n\n    Parameters\n    ----------\n    P : float\n        Portfolio value.\n    c : float\n        Confidence level.\n    mu : float, optional\n        Mean.\n\n    Returns\n    -------\n    float\n        Variance-covariance.\n    \"\"\"\n\n    arg_4 = sp.stats.norm.ppf(1 - arg_1, arg_2, arg_3)\n    return arg_0 - arg_0 * (arg_4 + 1)", "path": "pyfolio/timeseries.py", "identifier": "var_cov_var_normal", "docstring": "Variance-covariance calculation of daily Value-at-Risk in a\n    portfolio.\n\n    Parameters\n    ----------\n    P : float\n        Portfolio value.\n    c : float\n        Confidence level.\n    mu : float, optional\n        Mean.\n\n    Returns\n    -------\n    float\n        Variance-covariance.", "docstring_tokens": ["Variance", "-", "covariance", "calculation", "of", "daily", "Value", "-", "at", "-", "Risk", "in", "a", "portfolio", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255633}
{"url": "https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L74-L92", "sha": "9d0e8ebcba31d937f73752f9b88e5a4fec860765", "docstring_summary": "Remove each key or key name in an iterable from the bucket set.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return super(Bucket, self).delete_keys(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "iter", "(", "arg_2", ".", "get", "(", "'keys'", ",", "arg_1", "[", "0", "]", "if", "arg_1", "else", "[", "]", ")", ")", "while", "True", ":", "try", ":", "arg_4", "=", "arg_3", ".", "next", "(", ")", "except", "StopIteration", ":", "break", "if", "isinstance", "(", "arg_4", ",", "basestring", ")", ":", "mimicdb", ".", "backend", ".", "srem", "(", "tpl", ".", "bucket", "%", "arg_0", ".", "name", ",", "arg_4", ")", "mimicdb", ".", "backend", ".", "delete", "(", "tpl", ".", "key", "%", "(", "arg_0", ".", "name", ",", "arg_4", ")", ")", "elif", "isinstance", "(", "arg_4", ",", "BotoKey", ")", "or", "isinstance", "(", "arg_4", ",", "Key", ")", ":", "mimicdb", ".", "backend", ".", "srem", "(", "tpl", ".", "bucket", "%", "arg_0", ".", "name", ",", "arg_4", ".", "name", ")", "mimicdb", ".", "backend", ".", "delete", "(", "tpl", ".", "key", "%", "(", "arg_0", ".", "name", ",", "arg_4", ".", "name", ")", ")", "return", "super", "(", "Bucket", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Remove each key or key name in an iterable from the bucket set.\n        \"\"\"\n        arg_3 = iter(arg_2.get('keys', arg_1[0] if arg_1 else []))\n\n        while True:\n            try:\n                arg_4 = arg_3.next()\n            except StopIteration:\n                break\n\n            if isinstance(arg_4, basestring):\n                mimicdb.backend.srem(tpl.bucket % arg_0.name, arg_4)\n                mimicdb.backend.delete(tpl.key % (arg_0.name, arg_4))\n            elif isinstance(arg_4, BotoKey) or isinstance(arg_4, Key):\n                mimicdb.backend.srem(tpl.bucket % arg_0.name, arg_4.name)\n                mimicdb.backend.delete(tpl.key % (arg_0.name, arg_4.name))\n\n        return super(Bucket, arg_0).Func(*arg_1, **arg_2)", "path": "mimicdb/s3/bucket.py", "identifier": "Bucket.delete_keys", "docstring": "Remove each key or key name in an iterable from the bucket set.", "docstring_tokens": ["Remove", "each", "key", "or", "key", "name", "in", "an", "iterable", "from", "the", "bucket", "set", "."], "nwo": "nathancahill/mimicdb", "score": 0.18112697196067942, "idx": 255634}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/integration/overlay.py#L58-L86", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Overlay tabular data on the network for data that comes from an data set with identifiers that lack\n    namespaces.", "language": "python", "parameters": "(graph: BELGraph,\n                      data: Mapping[str, float],\n                      func: str,\n                      namespace: str,\n                      label: Optional[str] = None,\n                      overwrite: bool = False,\n                      impute: Optional[float] = None,\n                      )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", ",", "arg_5", "]", ",", "arg_6", ":", "arg_4", ",", "arg_7", ":", "arg_4", ",", "arg_8", ":", "arg_9", "[", "arg_4", "]", "=", "None", ",", "arg_10", ":", "arg_11", "=", "False", ",", "arg_12", ":", "arg_9", "[", "arg_5", "]", "=", "None", ",", ")", "->", "None", ":", "arg_13", "=", "{", "node", ":", "arg_2", ".", "get", "(", "node", "[", "NAME", "]", ",", "arg_12", ")", "for", "node", "in", "filter_nodes", "(", "arg_0", ",", "function_namespace_inclusion_builder", "(", "arg_6", ",", "arg_7", ")", ")", "}", "overlay_data", "(", "arg_0", ",", "arg_13", ",", "arg_8", "=", "arg_8", ",", "arg_10", "=", "arg_10", ")"], "function": "def Func(arg_0: arg_1,\n                      arg_2: arg_3[arg_4, arg_5],\n                      arg_6: arg_4,\n                      arg_7: arg_4,\n                      arg_8: arg_9[arg_4] = None,\n                      arg_10: arg_11 = False,\n                      arg_12: arg_9[arg_5] = None,\n                      ) -> None:\n    \"\"\"Overlay tabular data on the network for data that comes from an data set with identifiers that lack\n    namespaces.\n\n    For example, if you want to overlay differential gene expression data from a table, that table\n    probably has HGNC identifiers, but no specific annotations that they are in the HGNC namespace or\n    that the entities to which they refer are RNA.\n\n    :param graph: A BEL Graph\n    :param dict data: A dictionary of {name: data}\n    :param func: The function of the keys in the data dictionary\n    :param namespace: The namespace of the keys in the data dictionary\n    :param label: The annotation label to put in the node dictionary\n    :param overwrite: Should old annotations be overwritten?\n    :param impute: The value to use for missing data\n    \"\"\"\n    arg_13 = {\n        node: arg_2.get(node[NAME], arg_12)\n        for node in filter_nodes(arg_0, function_namespace_inclusion_builder(arg_6, arg_7))\n    }\n\n    overlay_data(arg_0, arg_13, arg_8=arg_8, arg_10=arg_10)", "path": "src/pybel_tools/integration/overlay.py", "identifier": "overlay_type_data", "docstring": "Overlay tabular data on the network for data that comes from an data set with identifiers that lack\n    namespaces.\n\n    For example, if you want to overlay differential gene expression data from a table, that table\n    probably has HGNC identifiers, but no specific annotations that they are in the HGNC namespace or\n    that the entities to which they refer are RNA.\n\n    :param graph: A BEL Graph\n    :param dict data: A dictionary of {name: data}\n    :param func: The function of the keys in the data dictionary\n    :param namespace: The namespace of the keys in the data dictionary\n    :param label: The annotation label to put in the node dictionary\n    :param overwrite: Should old annotations be overwritten?\n    :param impute: The value to use for missing data", "docstring_tokens": ["Overlay", "tabular", "data", "on", "the", "network", "for", "data", "that", "comes", "from", "an", "data", "set", "with", "identifiers", "that", "lack", "namespaces", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255635}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L58-L100", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Create pyfolio default plotting style context.", "language": "python", "parameters": "(context='notebook', font_scale=1.5, rc=None)", "return_statement": "return sns.plotting_context(context=context, font_scale=font_scale, rc=rc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'notebook'", ",", "arg_1", "=", "1.5", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "{", "}", "arg_3", "=", "{", "'lines.linewidth'", ":", "1.5", "}", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "items", "(", ")", ":", "arg_2", ".", "setdefault", "(", "arg_4", ",", "arg_5", ")", "return", "sns", ".", "Func", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0='notebook', arg_1=1.5, arg_2=None):\n    \"\"\"\n    Create pyfolio default plotting style context.\n\n    Under the hood, calls and returns seaborn.Func() with\n    some custom settings. Usually you would use in a with-context.\n\n    Parameters\n    ----------\n    context : str, optional\n        Name of seaborn context.\n    font_scale : float, optional\n        Scale font by factor font_scale.\n    rc : dict, optional\n        Config flags.\n        By default, {'lines.linewidth': 1.5}\n        is being used and will be added to any\n        rc passed in, unless explicitly overriden.\n\n    Returns\n    -------\n    seaborn plotting context\n\n    Example\n    -------\n    >>> with pyfolio.plotting.Func(font_scale=2):\n    >>>    pyfolio.create_full_tear_sheet(..., set_context=False)\n\n    See also\n    --------\n    For more information, see seaborn.Func().\n\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = {}\n\n    arg_3 = {'lines.linewidth': 1.5}\n\n    # Add defaults if they do not exist\n    for arg_4, arg_5 in arg_3.items():\n        arg_2.setdefault(arg_4, arg_5)\n\n    return sns.Func(arg_0=arg_0, arg_1=arg_1, arg_2=arg_2)", "path": "pyfolio/plotting.py", "identifier": "plotting_context", "docstring": "Create pyfolio default plotting style context.\n\n    Under the hood, calls and returns seaborn.plotting_context() with\n    some custom settings. Usually you would use in a with-context.\n\n    Parameters\n    ----------\n    context : str, optional\n        Name of seaborn context.\n    font_scale : float, optional\n        Scale font by factor font_scale.\n    rc : dict, optional\n        Config flags.\n        By default, {'lines.linewidth': 1.5}\n        is being used and will be added to any\n        rc passed in, unless explicitly overriden.\n\n    Returns\n    -------\n    seaborn plotting context\n\n    Example\n    -------\n    >>> with pyfolio.plotting.plotting_context(font_scale=2):\n    >>>    pyfolio.create_full_tear_sheet(..., set_context=False)\n\n    See also\n    --------\n    For more information, see seaborn.plotting_context().", "docstring_tokens": ["Create", "pyfolio", "default", "plotting", "style", "context", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255636}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_clean_visible.py#L75-L128", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Takes an HTML-like Unicode string as input and returns a UTF-8\n    encoded string with all tags replaced by whitespace. In particular,\n    all Unicode characters inside HTML are replaced with a single\n    whitespace character.", "language": "python", "parameters": "(_html, tag_replacement_char=' ')", "return_statement": "return non_tag.encode('utf-8')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "' '", ")", ":", "def", "non_tag_chars", "(", "arg_2", ")", ":", "arg_3", "=", "0", "while", "arg_3", "<", "len", "(", "arg_2", ")", ":", "arg_4", "=", "arg_2", ".", "find", "(", "'<'", ",", "arg_3", ")", "if", "arg_4", "==", "-", "1", ":", "yield", "arg_2", "[", "arg_3", ":", "]", "arg_3", "=", "len", "(", "arg_2", ")", "break", "yield", "arg_2", "[", "arg_3", ":", "arg_4", "]", "arg_3", "=", "arg_4", "while", "arg_3", "<", "len", "(", "arg_2", ")", ":", "arg_5", "=", "arg_2", ".", "find", "(", "'\\n'", ",", "arg_3", ")", "arg_4", "=", "arg_2", ".", "find", "(", "'>'", ",", "arg_3", ")", "if", "arg_4", "==", "-", "1", ":", "yield", "' '", "*", "(", "len", "(", "arg_2", ")", "-", "arg_3", ")", "arg_3", "=", "len", "(", "arg_2", ")", "break", "elif", "arg_5", "==", "-", "1", "or", "arg_4", "<", "arg_5", ":", "yield", "' '", "*", "(", "arg_4", "+", "1", "-", "arg_3", ")", "arg_3", "=", "arg_4", "+", "1", "break", "else", ":", "yield", "' '", "*", "(", "arg_5", "-", "arg_3", ")", "+", "'\\n'", "arg_3", "=", "arg_5", "+", "1", "if", "not", "isinstance", "(", "arg_0", ",", "unicode", ")", ":", "arg_0", "=", "unicode", "(", "arg_0", ",", "'utf-8'", ")", "arg_0", "=", "fix_emails", "(", "arg_0", ")", "arg_6", "=", "''", ".", "join", "(", "non_tag_chars", "(", "arg_0", ")", ")", "return", "arg_6", ".", "encode", "(", "'utf-8'", ")"], "function": "def Func(arg_0, arg_1=' '):\n    '''\n    Takes an HTML-like Unicode string as input and returns a UTF-8\n    encoded string with all tags replaced by whitespace. In particular,\n    all Unicode characters inside HTML are replaced with a single\n    whitespace character.\n\n    This does not detect comments, style, script, link.  It also does\n    do anything with HTML-escaped characters.  All of these are\n    handled by the clean_html pre-cursor step.\n\n    Pre-existing whitespace of any kind (newlines, tabs) is converted\n    to single spaces ' ', which has the same byte length (and\n    character length).\n\n    This is a simple state machine iterator without regexes\n    '''\n    def non_tag_chars(arg_2):\n        arg_3 = 0\n        while arg_3 < len(arg_2):\n            arg_4 = arg_2.find('<', arg_3)\n            if arg_4 == -1:\n                yield arg_2[arg_3:]\n                arg_3 = len(arg_2)\n                break\n            yield arg_2[arg_3:arg_4]\n            arg_3 = arg_4\n\n            while arg_3 < len(arg_2):\n                arg_5 = arg_2.find('\\n', arg_3)\n                arg_4 = arg_2.find('>', arg_3)\n                if arg_4 == -1:\n                    yield ' ' * (len(arg_2) - arg_3)\n                    arg_3 = len(arg_2)\n                    break\n                elif arg_5 == -1 or arg_4 < arg_5:\n                    yield ' ' * (arg_4 + 1 - arg_3)\n                    arg_3 = arg_4 + 1\n                    break\n                else:\n                    yield ' ' * (arg_5 - arg_3) + '\\n'\n                    arg_3 = arg_5 + 1\n                    # do not break\n\n    if not isinstance(arg_0, unicode):\n        arg_0 = unicode(arg_0, 'utf-8')\n\n    # Protect emails by substituting with unique key\n    arg_0 = fix_emails(arg_0)\n\n    #Strip tags with previous logic\n    arg_6 = ''.join(non_tag_chars(arg_0))\n\n    return arg_6.encode('utf-8')", "path": "streamcorpus_pipeline/_clean_visible.py", "identifier": "make_clean_visible", "docstring": "Takes an HTML-like Unicode string as input and returns a UTF-8\n    encoded string with all tags replaced by whitespace. In particular,\n    all Unicode characters inside HTML are replaced with a single\n    whitespace character.\n\n    This does not detect comments, style, script, link.  It also does\n    do anything with HTML-escaped characters.  All of these are\n    handled by the clean_html pre-cursor step.\n\n    Pre-existing whitespace of any kind (newlines, tabs) is converted\n    to single spaces ' ', which has the same byte length (and\n    character length).\n\n    This is a simple state machine iterator without regexes", "docstring_tokens": ["Takes", "an", "HTML", "-", "like", "Unicode", "string", "as", "input", "and", "returns", "a", "UTF", "-", "8", "encoded", "string", "with", "all", "tags", "replaced", "by", "whitespace", ".", "In", "particular", "all", "Unicode", "characters", "inside", "HTML", "are", "replaced", "with", "a", "single", "whitespace", "character", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 255637}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/factories/constraint/gates.py#L233-L297", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "Full adder.", "language": "python", "parameters": "(variables, vartype=dimod.BINARY, name='FULL_ADDER')", "return_statement": "return Constraint(func, configs, variables, vartype=vartype, name=name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "BINARY", ",", "arg_4", "=", "'FULL_ADDER'", ")", ":", "arg_0", "=", "tuple", "(", "arg_0", ")", "if", "arg_1", "is", "arg_2", ".", "BINARY", ":", "arg_5", "=", "frozenset", "(", "[", "(", "0", ",", "0", ",", "0", ",", "0", ",", "0", ")", ",", "(", "0", ",", "0", ",", "1", ",", "1", ",", "0", ")", ",", "(", "0", ",", "1", ",", "0", ",", "1", ",", "0", ")", ",", "(", "0", ",", "1", ",", "1", ",", "0", ",", "1", ")", ",", "(", "1", ",", "0", ",", "0", ",", "1", ",", "0", ")", ",", "(", "1", ",", "0", ",", "1", ",", "0", ",", "1", ")", ",", "(", "1", ",", "1", ",", "0", ",", "0", ",", "1", ")", ",", "(", "1", ",", "1", ",", "1", ",", "1", ",", "1", ")", "]", ")", "else", ":", "arg_5", "=", "frozenset", "(", "[", "(", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ")", ",", "(", "-", "1", ",", "-", "1", ",", "+", "1", ",", "+", "1", ",", "-", "1", ")", ",", "(", "-", "1", ",", "+", "1", ",", "-", "1", ",", "+", "1", ",", "-", "1", ")", ",", "(", "-", "1", ",", "+", "1", ",", "+", "1", ",", "-", "1", ",", "+", "1", ")", ",", "(", "+", "1", ",", "-", "1", ",", "-", "1", ",", "+", "1", ",", "-", "1", ")", ",", "(", "+", "1", ",", "-", "1", ",", "+", "1", ",", "-", "1", ",", "+", "1", ")", ",", "(", "+", "1", ",", "+", "1", ",", "-", "1", ",", "-", "1", ",", "+", "1", ")", ",", "(", "+", "1", ",", "+", "1", ",", "+", "1", ",", "+", "1", ",", "+", "1", ")", "]", ")", "def", "func", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", ":", "arg_11", "=", "(", "arg_6", ">", "0", ")", "+", "(", "arg_7", ">", "0", ")", "+", "(", "arg_8", ">", "0", ")", "if", "arg_11", "==", "0", ":", "return", "(", "arg_9", "<=", "0", ")", "and", "(", "arg_10", "<=", "0", ")", "elif", "arg_11", "==", "1", ":", "return", "(", "arg_9", ">", "0", ")", "and", "(", "arg_10", "<=", "0", ")", "elif", "arg_11", "==", "2", ":", "return", "(", "arg_9", "<=", "0", ")", "and", "(", "arg_10", ">", "0", ")", "elif", "arg_11", "==", "3", ":", "return", "(", "arg_9", ">", "0", ")", "and", "(", "arg_10", ">", "0", ")", "else", ":", "raise", "ValueError", "(", "\"func recieved unexpected values\"", ")", "return", "Constraint", "(", "func", ",", "arg_5", ",", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=arg_2.BINARY, arg_4='FULL_ADDER'):\n    \"\"\"Full adder.\n\n    Args:\n        variables (list): Variable labels for the and gate as `[in1, in2, in3, sum, carry]`,\n            where `in1, in2, in3` are inputs to be added and `sum` and 'carry' the resultant\n            outputs.\n        vartype (Vartype, optional, default='BINARY'): Variable type. Accepted\n            input values:\n\n            * Vartype.SPIN, 'SPIN', {-1, 1}\n            * Vartype.BINARY, 'BINARY', {0, 1}\n        name (str, optional, default='FULL_ADDER'): Name for the constraint.\n\n    Returns:\n        Constraint(:obj:`.Constraint`): Constraint that is satisfied when its variables are\n        assigned values that match the valid states of a Boolean full adder.\n\n    Examples:\n        >>> import dwavebinarycsp\n        >>> import dwavebinarycsp.factories.constraint.gates as gates\n        >>> csp = dwavebinarycsp.ConstraintSatisfactionProblem(dwavebinarycsp.BINARY)\n        >>> csp.add_constraint(gates.Func(['a', 'b', 'c_in', 'total', 'c_out'], name='FA1'))\n        >>> csp.check({'a': 1, 'b': 0, 'c_in': 1, 'total': 0, 'c_out': 1})\n        True\n\n    \"\"\"\n\n    arg_0 = tuple(arg_0)\n\n    if arg_1 is arg_2.BINARY:\n        arg_5 = frozenset([(0, 0, 0, 0, 0),\n                             (0, 0, 1, 1, 0),\n                             (0, 1, 0, 1, 0),\n                             (0, 1, 1, 0, 1),\n                             (1, 0, 0, 1, 0),\n                             (1, 0, 1, 0, 1),\n                             (1, 1, 0, 0, 1),\n                             (1, 1, 1, 1, 1)])\n\n    else:\n        # SPIN, vartype is checked by the decorator\n        arg_5 = frozenset([(-1, -1, -1, -1, -1),\n                             (-1, -1, +1, +1, -1),\n                             (-1, +1, -1, +1, -1),\n                             (-1, +1, +1, -1, +1),\n                             (+1, -1, -1, +1, -1),\n                             (+1, -1, +1, -1, +1),\n                             (+1, +1, -1, -1, +1),\n                             (+1, +1, +1, +1, +1)])\n\n    def func(arg_6, arg_7, arg_8, arg_9, arg_10):\n        arg_11 = (arg_6 > 0) + (arg_7 > 0) + (arg_8 > 0)\n        if arg_11 == 0:\n            return (arg_9 <= 0) and (arg_10 <= 0)\n        elif arg_11 == 1:\n            return (arg_9 > 0) and (arg_10 <= 0)\n        elif arg_11 == 2:\n            return (arg_9 <= 0) and (arg_10 > 0)\n        elif arg_11 == 3:\n            return (arg_9 > 0) and (arg_10 > 0)\n        else:\n            raise ValueError(\"func recieved unexpected values\")\n\n    return Constraint(func, arg_5, arg_0, arg_1=arg_1, arg_4=arg_4)", "path": "dwavebinarycsp/factories/constraint/gates.py", "identifier": "fulladder_gate", "docstring": "Full adder.\n\n    Args:\n        variables (list): Variable labels for the and gate as `[in1, in2, in3, sum, carry]`,\n            where `in1, in2, in3` are inputs to be added and `sum` and 'carry' the resultant\n            outputs.\n        vartype (Vartype, optional, default='BINARY'): Variable type. Accepted\n            input values:\n\n            * Vartype.SPIN, 'SPIN', {-1, 1}\n            * Vartype.BINARY, 'BINARY', {0, 1}\n        name (str, optional, default='FULL_ADDER'): Name for the constraint.\n\n    Returns:\n        Constraint(:obj:`.Constraint`): Constraint that is satisfied when its variables are\n        assigned values that match the valid states of a Boolean full adder.\n\n    Examples:\n        >>> import dwavebinarycsp\n        >>> import dwavebinarycsp.factories.constraint.gates as gates\n        >>> csp = dwavebinarycsp.ConstraintSatisfactionProblem(dwavebinarycsp.BINARY)\n        >>> csp.add_constraint(gates.fulladder_gate(['a', 'b', 'c_in', 'total', 'c_out'], name='FA1'))\n        >>> csp.check({'a': 1, 'b': 0, 'c_in': 1, 'total': 0, 'c_out': 1})\n        True", "docstring_tokens": ["Full", "adder", "."], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 255638}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L889-L939", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Draw the points of the line string on a given image.", "language": "python", "parameters": "(self, image, color=(0, 128, 0),\n                             alpha=1.0, size=3,\n                             copy=True, raise_if_out_of_image=False)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "0", ",", "128", ",", "0", ")", ",", "arg_3", "=", "1.0", ",", "arg_4", "=", "3", ",", "arg_5", "=", "True", ",", "arg_6", "=", "False", ")", ":", "from", ".", "kps", "import", "KeypointsOnImage", "arg_7", "=", "KeypointsOnImage", ".", "from_xy_array", "(", "arg_0", ".", "coords", ",", "shape", "=", "arg_1", ".", "shape", ")", "arg_1", "=", "arg_7", ".", "draw_on_image", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=(0, 128, 0),\n                             arg_3=1.0, arg_4=3,\n                             arg_5=True, arg_6=False):\n        \"\"\"\n        Draw the points of the line string on a given image.\n\n        Parameters\n        ----------\n        image : ndarray or tuple of int\n            The image onto which to draw.\n            Expected to be ``uint8`` and of shape ``(H, W, C)`` with ``C``\n            usually being ``3`` (other values are not tested).\n            If a tuple, expected to be ``(H, W, C)`` and will lead to a new\n            ``uint8`` array of zeros being created.\n\n        color : iterable of int\n            Color to use as RGB, i.e. three values.\n\n        alpha : float, optional\n            Opacity of the line string points. Higher values denote a more\n            visible points.\n\n        size : int, optional\n            Size of the points in pixels.\n\n        copy : bool, optional\n            Whether it is allowed to draw directly in the input\n            array (``False``) or it has to be copied (``True``).\n            The routine may still have to copy, even if ``copy=False`` was\n            used. Always use the return value.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if the line string is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        ndarray\n            Float array of shape `image_shape` (no channel axis) with drawn\n            line string points. All values are in the interval ``[0.0, 1.0]``.\n\n        \"\"\"\n        from .kps import KeypointsOnImage\n        arg_7 = KeypointsOnImage.from_xy_array(arg_0.coords, shape=arg_1.shape)\n        arg_1 = arg_7.draw_on_image(\n            arg_1, arg_2=arg_2, arg_3=arg_3,\n            arg_4=arg_4, arg_5=arg_5,\n            arg_6=arg_6)\n\n        return arg_1", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.draw_points_on_image", "docstring": "Draw the points of the line string on a given image.\n\n        Parameters\n        ----------\n        image : ndarray or tuple of int\n            The image onto which to draw.\n            Expected to be ``uint8`` and of shape ``(H, W, C)`` with ``C``\n            usually being ``3`` (other values are not tested).\n            If a tuple, expected to be ``(H, W, C)`` and will lead to a new\n            ``uint8`` array of zeros being created.\n\n        color : iterable of int\n            Color to use as RGB, i.e. three values.\n\n        alpha : float, optional\n            Opacity of the line string points. Higher values denote a more\n            visible points.\n\n        size : int, optional\n            Size of the points in pixels.\n\n        copy : bool, optional\n            Whether it is allowed to draw directly in the input\n            array (``False``) or it has to be copied (``True``).\n            The routine may still have to copy, even if ``copy=False`` was\n            used. Always use the return value.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if the line string is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        ndarray\n            Float array of shape `image_shape` (no channel axis) with drawn\n            line string points. All values are in the interval ``[0.0, 1.0]``.", "docstring_tokens": ["Draw", "the", "points", "of", "the", "line", "string", "on", "a", "given", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 255639}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L488-L526", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Copy a global module to the active environment.", "language": "python", "parameters": "(name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "cpenv", ".", "get_active_env", "(", ")", "if", "not", "arg_1", ":", "click", ".", "echo", "(", "'You need to activate an environment first.'", ")", "return", "try", ":", "arg_2", "=", "cpenv", ".", "resolve", "(", "arg_0", ")", "except", "cpenv", ".", "ResolveError", "as", "e", ":", "click", ".", "echo", "(", "'\\n'", "+", "str", "(", "e", ")", ")", "arg_3", "=", "arg_2", ".", "resolved", "[", "0", "]", "if", "isinstance", "(", "arg_3", ",", "cpenv", ".", "VirtualEnvironment", ")", ":", "click", ".", "echo", "(", "'\\nCan only Func a module not an environment'", ")", "return", "arg_4", "=", "cpenv", ".", "get_active_modules", "(", ")", "if", "arg_3", "in", "arg_4", ":", "click", ".", "echo", "(", "'\\nCan not Func an active module.'", ")", "return", "if", "arg_3", "in", "arg_1", ".", "get_modules", "(", ")", ":", "click", ".", "echo", "(", "'\\n{} is already local to {}'", ".", "format", "(", "arg_3", ".", "name", ",", "arg_1", ".", "name", ")", ")", "return", "if", "click", ".", "confirm", "(", "'\\nAdd {} to env {}?'", ".", "format", "(", "arg_3", ".", "name", ",", "arg_1", ".", "name", ")", ")", ":", "click", ".", "echo", "(", "'Adding module...'", ",", "nl", "=", "False", ")", "try", ":", "arg_3", "=", "arg_1", ".", "add_module", "(", "arg_3", ".", "name", ",", "arg_3", ".", "path", ")", "except", ":", "click", ".", "echo", "(", "bold_red", "(", "'FAILED'", ")", ")", "raise", "else", ":", "click", ".", "echo", "(", "bold_green", "(", "'OK!'", ")", ")", "click", ".", "echo", "(", "'\\nActivate the Func module:'", ")", "click", ".", "echo", "(", "'    cpenv activate {} {}'", ".", "format", "(", "arg_1", ".", "name", ",", "arg_3", ".", "name", ")", ")"], "function": "def Func(arg_0):\n    '''Copy a global module to the active environment.'''\n\n    arg_1 = cpenv.get_active_env()\n    if not arg_1:\n        click.echo('You need to activate an environment first.')\n        return\n\n    try:\n        arg_2 = cpenv.resolve(arg_0)\n    except cpenv.ResolveError as e:\n        click.echo('\\n' + str(e))\n\n    arg_3 = arg_2.resolved[0]\n    if isinstance(arg_3, cpenv.VirtualEnvironment):\n        click.echo('\\nCan only Func a module not an environment')\n        return\n\n    arg_4 = cpenv.get_active_modules()\n    if arg_3 in arg_4:\n        click.echo('\\nCan not Func an active module.')\n        return\n\n    if arg_3 in arg_1.get_modules():\n        click.echo('\\n{} is already local to {}'.format(arg_3.name, arg_1.name))\n        return\n\n    if click.confirm('\\nAdd {} to env {}?'.format(arg_3.name, arg_1.name)):\n        click.echo('Adding module...', nl=False)\n        try:\n            arg_3 = arg_1.add_module(arg_3.name, arg_3.path)\n        except:\n            click.echo(bold_red('FAILED'))\n            raise\n        else:\n            click.echo(bold_green('OK!'))\n\n    click.echo('\\nActivate the Func module:')\n    click.echo('    cpenv activate {} {}'.format(arg_1.name, arg_3.name))", "path": "cpenv/cli.py", "identifier": "localize", "docstring": "Copy a global module to the active environment.", "docstring_tokens": ["Copy", "a", "global", "module", "to", "the", "active", "environment", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 255640}
{"url": "https://github.com/mshroyer/pointfree/blob/a25ecb3f0cd583e0730ecdde83018e5089711854/pointfree.py#L678-L702", "sha": "a25ecb3f0cd583e0730ecdde83018e5089711854", "docstring_summary": "Prints an item.", "language": "python", "parameters": "(item, end='\\n', file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'\\n'", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "sys", ".", "stdout", "print", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1='\\n', arg_2=None):\n    \"\"\"Prints an item.\n\n    :param item: The item to print\n    :param end: String to append to the end of printed output\n    :param file: File to which output is printed\n    :rtype: None\n\n    Example::\n\n        >>> from operator import add\n\n        >>> fn = pfreduce(add, initial=0) >> Func\n        >>> fn([1, 2, 3, 4])\n        10\n\n    \"\"\"\n\n    # Can't just make sys.stdout the file argument's default value, because\n    # then we would be capturing the stdout file descriptor, and then\n    # doctest -- which works by redefining sys.stdout -- would fail:\n    if arg_2 is None:\n        arg_2 = sys.stdout\n\n    print(arg_0, arg_1=arg_1, arg_2=arg_2)", "path": "pointfree.py", "identifier": "pfprint", "docstring": "Prints an item.\n\n    :param item: The item to print\n    :param end: String to append to the end of printed output\n    :param file: File to which output is printed\n    :rtype: None\n\n    Example::\n\n        >>> from operator import add\n\n        >>> fn = pfreduce(add, initial=0) >> pfprint\n        >>> fn([1, 2, 3, 4])\n        10", "docstring_tokens": ["Prints", "an", "item", "."], "nwo": "mshroyer/pointfree", "score": 0.21302904236143622, "idx": 255641}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/__init__.py#L392-L397", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "Deploys a version to an environment", "language": "python", "parameters": "(self, environment_name, version_label)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "out", "(", "\"Deploying \"", "+", "str", "(", "arg_2", ")", "+", "\" to \"", "+", "str", "(", "arg_1", ")", ")", "arg_0", ".", "ebs", ".", "update_environment", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Deploys a version to an environment\n        \"\"\"\n        out(\"Deploying \" + str(arg_2) + \" to \" + str(arg_1))\n        arg_0.ebs.update_environment(arg_1=arg_1, arg_2=arg_2)", "path": "ebs_deploy/__init__.py", "identifier": "EbsHelper.deploy_version", "docstring": "Deploys a version to an environment", "docstring_tokens": ["Deploys", "a", "version", "to", "an", "environment"], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 255642}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L78-L95", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "set current cursor position", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "Func", "=", "min", "(", "max", "(", "arg_0", ".", "_min", ",", "arg_1", ")", ",", "arg_0", ".", "_max", ")", "arg_0", ".", "_current", "=", "Func", "if", "Func", ">", "arg_0", ".", "_stop", ":", "arg_0", ".", "_stop", "=", "Func", "arg_0", ".", "_start", "=", "Func", "-", "arg_0", ".", "_width", "elif", "Func", "<", "arg_0", ".", "_start", ":", "arg_0", ".", "_start", "=", "Func", "arg_0", ".", "_stop", "=", "Func", "+", "arg_0", ".", "_width", "if", "abs", "(", "arg_0", ".", "_start", "-", "arg_0", ".", "_min", ")", "<=", "arg_0", ".", "_sticky_lenght", ":", "arg_0", ".", "_start", "=", "arg_0", ".", "_min", "if", "abs", "(", "arg_0", ".", "_stop", "-", "arg_0", ".", "_max", ")", "<=", "arg_0", ".", "_sticky_lenght", ":", "arg_0", ".", "_stop", "=", "arg_0", ".", "_max"], "function": "def Func(arg_0, arg_1):\n        \"\"\"set current cursor position\"\"\"\n        Func = min(max(arg_0._min, arg_1), arg_0._max)\n\n        arg_0._current = Func\n\n        if Func > arg_0._stop : \n            arg_0._stop = Func\n            arg_0._start = Func-arg_0._width\n        elif Func < arg_0._start : \n            arg_0._start = Func\n            arg_0._stop = Func + arg_0._width\n\n        if abs(arg_0._start - arg_0._min) <= arg_0._sticky_lenght :\n            arg_0._start = arg_0._min\n        \n        if abs(arg_0._stop - arg_0._max) <= arg_0._sticky_lenght :\n            arg_0._stop = arg_0._max", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py", "identifier": "SlidingInterval.current", "docstring": "set current cursor position", "docstring_tokens": ["set", "current", "cursor", "position"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255643}
{"url": "https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L276-L295", "sha": "c0393c4d51984a506f813319efb66e54c4f2a426", "docstring_summary": "Lossless compress all images in experiment to PNG. If folder is\n        omitted, images will not be moved.", "language": "python", "parameters": "(self, delete_tif=False, folder=None)", "return_statement": "return compress(self.images, delete_tif, folder)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "return", "Func", "(", "arg_0", ".", "images", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n        \"\"\"Lossless Func all images in experiment to PNG. If folder is\n        omitted, images will not be moved.\n\n        Images which already exists in PNG are omitted.\n\n        Parameters\n        ----------\n        folder : string\n            Where to store PNGs. Defaults to the folder they are in.\n        delete_tif : bool\n            If set to truthy value, ome.tifs will be deleted after Funcion.\n\n        Returns\n        -------\n        list\n            Filenames of PNG images. Files which already exists before\n            Funcion are also returned.\n        \"\"\"\n        return Func(arg_0.images, arg_1, arg_2)", "path": "leicaexperiment/experiment.py", "identifier": "Experiment.compress", "docstring": "Lossless compress all images in experiment to PNG. If folder is\n        omitted, images will not be moved.\n\n        Images which already exists in PNG are omitted.\n\n        Parameters\n        ----------\n        folder : string\n            Where to store PNGs. Defaults to the folder they are in.\n        delete_tif : bool\n            If set to truthy value, ome.tifs will be deleted after compression.\n\n        Returns\n        -------\n        list\n            Filenames of PNG images. Files which already exists before\n            compression are also returned.", "docstring_tokens": ["Lossless", "compress", "all", "images", "in", "experiment", "to", "PNG", ".", "If", "folder", "is", "omitted", "images", "will", "not", "be", "moved", "."], "nwo": "arve0/leicaexperiment", "score": 0.1792979536242127, "idx": 255644}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/pexpect/_pexpect.py#L933-L941", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "This is to support iterators over a file-like object.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "readline", "(", ")", "if", "arg_1", "==", "arg_0", ".", "_empty_buffer", ":", "raise", "StopIteration", "return", "arg_1"], "function": "def Func (arg_0):    # File-like object.\n\n        \"\"\"This is to support iterators over a file-like object.\n        \"\"\"\n\n        arg_1 = arg_0.readline()\n        if arg_1 == arg_0._empty_buffer:\n            raise StopIteration\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/external/pexpect/_pexpect.py", "identifier": "spawnb.next", "docstring": "This is to support iterators over a file-like object.", "docstring_tokens": ["This", "is", "to", "support", "iterators", "over", "a", "file", "-", "like", "object", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255645}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/inversion/util/mapper_util.py#L5-L27", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Computes the mapping matrix, by iterating over the known mappings between the sub-grid and pixelization.", "language": "python", "parameters": "(sub_to_pix, pixels, regular_pixels, sub_to_regular, sub_grid_fraction)", "return_statement": "return mapping_matrix", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "np", ".", "zeros", "(", "(", "arg_2", ",", "arg_1", ")", ")", "for", "arg_6", "in", "range", "(", "arg_3", ".", "shape", "[", "0", "]", ")", ":", "arg_5", "[", "arg_3", "[", "arg_6", "]", ",", "arg_0", "[", "arg_6", "]", "]", "+=", "arg_4", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Computes the mapping matrix, by iterating over the known mappings between the sub-grid and pixelization.\n\n    Parameters\n    -----------\n    sub_to_pix : ndarray\n        The mappings between the observed regular's sub-pixels and pixelization's pixels.\n    pixels : int\n        The number of pixels in the pixelization.\n    regular_pixels : int\n        The number of datas pixels in the observed datas and thus on the regular grid.\n    sub_to_regular : ndarray\n        The mappings between the observed regular's sub-pixels and observed regular's pixels.\n    sub_grid_fraction : float\n        The fractional area each sub-pixel takes up in an regular-pixel.\n    \"\"\"\n\n    arg_5 = np.zeros((arg_2, arg_1))\n\n    for arg_6 in range(arg_3.shape[0]):\n        arg_5[arg_3[arg_6], arg_0[arg_6]] += arg_4\n\n    return arg_5", "path": "autolens/model/inversion/util/mapper_util.py", "identifier": "mapping_matrix_from_sub_to_pix", "docstring": "Computes the mapping matrix, by iterating over the known mappings between the sub-grid and pixelization.\n\n    Parameters\n    -----------\n    sub_to_pix : ndarray\n        The mappings between the observed regular's sub-pixels and pixelization's pixels.\n    pixels : int\n        The number of pixels in the pixelization.\n    regular_pixels : int\n        The number of datas pixels in the observed datas and thus on the regular grid.\n    sub_to_regular : ndarray\n        The mappings between the observed regular's sub-pixels and observed regular's pixels.\n    sub_grid_fraction : float\n        The fractional area each sub-pixel takes up in an regular-pixel.", "docstring_tokens": ["Computes", "the", "mapping", "matrix", "by", "iterating", "over", "the", "known", "mappings", "between", "the", "sub", "-", "grid", "and", "pixelization", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 255646}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L845-L855", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Write outputs to output tap file.", "language": "python", "parameters": "(self, output)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_tapFileOut", "is", "not", "None", ":", "for", "arg_2", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "print", ">>", "arg_0", ".", "_tapFileOut", ",", "arg_1", "[", "arg_2", "]", ",", "print", ">>", "arg_0", ".", "_tapFileOut"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Write outputs to output tap file.\n\n    :param outputs: (iter) some outputs.\n    \"\"\"\n    #raise Exception('MULTI-LINE DUMMY\\nMULTI-LINE DUMMY')\n    if arg_0._tapFileOut is not None:\n      for arg_2 in range(len(arg_1)):\n        print >> arg_0._tapFileOut, arg_1[arg_2],\n      print >> arg_0._tapFileOut", "path": "src/nupic/regions/knn_classifier_region.py", "identifier": "KNNClassifierRegion.handleLogOutput", "docstring": "Write outputs to output tap file.\n\n    :param outputs: (iter) some outputs.", "docstring_tokens": ["Write", "outputs", "to", "output", "tap", "file", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255647}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/mixins.py#L70-L104", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Update Marketing urls in course metadata and return updated course.", "language": "python", "parameters": "(self, course_runs, enterprise_customer, enterprise_context)", "return_statement": "return updated_course_runs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "utils", ".", "get_course_track_selection_url", "(", "arg_5", "=", "arg_5", ",", "arg_9", "=", "dict", "(", "arg_3", ",", "**", "utils", ".", "get_enterprise_utm_context", "(", "arg_2", ")", ")", ",", ")", "arg_7", "=", "arg_2", ".", "get_course_run_enrollment_url", "(", "arg_5", ".", "get", "(", "'key'", ")", ")", "arg_5", ".", "update", "(", "{", "'enrollment_url'", ":", "arg_7", ",", "'track_selection_url'", ":", "arg_6", ",", "}", ")", "arg_8", "=", "arg_5", ".", "get", "(", "'marketing_url'", ")", "if", "arg_8", ":", "arg_9", "=", "dict", "(", "arg_3", ",", "**", "utils", ".", "get_enterprise_utm_context", "(", "arg_2", ")", ")", "arg_5", ".", "update", "(", "{", "'marketing_url'", ":", "utils", ".", "update_query_parameters", "(", "arg_8", ",", "arg_9", ")", "}", ")", "arg_4", ".", "append", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Update Marketing urls in course metadata and return updated course.\n\n        Arguments:\n            course_runs (list): List of course runs.\n            enterprise_customer (EnterpriseCustomer): enterprise customer instance.\n            enterprise_context (dict): The context to inject into URLs.\n\n        Returns:\n            (dict): Dictionary containing updated course metadata.\n        \"\"\"\n        arg_4 = []\n        for arg_5 in arg_1:\n            arg_6 = utils.get_course_track_selection_url(\n                arg_5=arg_5,\n                arg_9=dict(arg_3, **utils.get_enterprise_utm_context(arg_2)),\n            )\n\n            arg_7 = arg_2.get_course_run_enrollment_url(arg_5.get('key'))\n\n            arg_5.update({\n                'enrollment_url': arg_7,\n                'track_selection_url': arg_6,\n            })\n\n            # Update marketing urls in course metadata to include enterprise related info.\n            arg_8 = arg_5.get('marketing_url')\n            if arg_8:\n                arg_9 = dict(arg_3, **utils.get_enterprise_utm_context(arg_2))\n                arg_5.update({'marketing_url': utils.update_query_parameters(arg_8, arg_9)})\n\n            # Add updated course run to the list.\n            arg_4.append(arg_5)\n        return arg_4", "path": "enterprise/api/v1/mixins.py", "identifier": "EnterpriseCourseContextSerializerMixin.update_course_runs", "docstring": "Update Marketing urls in course metadata and return updated course.\n\n        Arguments:\n            course_runs (list): List of course runs.\n            enterprise_customer (EnterpriseCustomer): enterprise customer instance.\n            enterprise_context (dict): The context to inject into URLs.\n\n        Returns:\n            (dict): Dictionary containing updated course metadata.", "docstring_tokens": ["Update", "Marketing", "urls", "in", "course", "metadata", "and", "return", "updated", "course", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 255648}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/run.py#L220-L262", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Prepares the parameters, runs the algorithms, and saves results.", "language": "python", "parameters": "(file_struct, boundaries_id, labels_id, config,\n                  annotator_id=0)", "return_statement": "return est_times, est_labels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "logging", ".", "info", "(", "\"Segmenting %s\"", "%", "arg_0", ".", "audio_file", ")", "arg_3", "[", "\"features\"", "]", "=", "Features", ".", "select_features", "(", "arg_3", "[", "\"feature\"", "]", ",", "arg_0", ",", "arg_3", "[", "\"annot_beats\"", "]", ",", "arg_3", "[", "\"framesync\"", "]", ")", "arg_5", ",", "arg_6", "=", "run_algorithms", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_4", ")", "logging", ".", "info", "(", "\"Writing results in: %s\"", "%", "arg_0", ".", "est_file", ")", "io", ".", "save_estimations", "(", "arg_0", ",", "arg_5", ",", "arg_6", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "return", "arg_5", ",", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                  arg_4=0):\n    \"\"\"Prepares the parameters, runs the algorithms, and saves results.\n\n    Parameters\n    ----------\n    file_struct: `msaf.io.FileStruct`\n        FileStruct containing the paths of the input files (audio file,\n        features file, reference file, output estimation file).\n    boundaries_id: str\n        Identifier of the boundaries algorithm to use (\"gt\" for ground truth).\n    labels_id: str\n        Identifier of the labels algorithm to use (None for not labeling).\n    config: dict\n        Dictionary containing the custom parameters of the algorithms to use.\n    annotator_id: int\n        Annotator identificator in the ground truth.\n\n    Returns\n    -------\n    est_times: np.array\n        List of estimated times for the segment boundaries.\n    est_labels: np.array\n        List of all the labels associated segments.\n    \"\"\"\n    logging.info(\"Segmenting %s\" % arg_0.audio_file)\n\n    # Get features\n    arg_3[\"features\"] = Features.select_features(\n        arg_3[\"feature\"], arg_0, arg_3[\"annot_beats\"],\n        arg_3[\"framesync\"])\n\n    # Get estimations\n    arg_5, arg_6 = run_algorithms(arg_0,\n                                           arg_1, arg_2, arg_3,\n                                           arg_4=arg_4)\n\n    # Save\n    logging.info(\"Writing results in: %s\" % arg_0.est_file)\n    io.save_estimations(arg_0, arg_5, arg_6,\n                        arg_1, arg_2, **arg_3)\n\n    return arg_5, arg_6", "path": "msaf/run.py", "identifier": "process_track", "docstring": "Prepares the parameters, runs the algorithms, and saves results.\n\n    Parameters\n    ----------\n    file_struct: `msaf.io.FileStruct`\n        FileStruct containing the paths of the input files (audio file,\n        features file, reference file, output estimation file).\n    boundaries_id: str\n        Identifier of the boundaries algorithm to use (\"gt\" for ground truth).\n    labels_id: str\n        Identifier of the labels algorithm to use (None for not labeling).\n    config: dict\n        Dictionary containing the custom parameters of the algorithms to use.\n    annotator_id: int\n        Annotator identificator in the ground truth.\n\n    Returns\n    -------\n    est_times: np.array\n        List of estimated times for the segment boundaries.\n    est_labels: np.array\n        List of all the labels associated segments.", "docstring_tokens": ["Prepares", "the", "parameters", "runs", "the", "algorithms", "and", "saves", "results", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 255649}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/astrokep.py#L987-L1025", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This turns the pickled lightcurve file back into an `lcdict`.", "language": "python", "parameters": "(picklefile)", "return_statement": "return lcdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "endswith", "(", "'.gz'", ")", ":", "arg_1", "=", "gzip", ".", "open", "(", "arg_0", ",", "'rb'", ")", "else", ":", "arg_1", "=", "open", "(", "arg_0", ",", "'rb'", ")", "try", ":", "with", "arg_1", ":", "arg_2", "=", "pickle", ".", "load", "(", "arg_1", ")", "except", "UnicodeDecodeError", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "arg_1", ":", "arg_2", "=", "pickle", ".", "load", "(", "arg_1", ",", "encoding", "=", "'latin1'", ")", "LOGWARNING", "(", "'pickle %s was probably from Python 2 '", "'and failed to load without using \"latin1\" encoding. '", "'This is probably a numpy issue: '", "'http://stackoverflow.com/q/11305790'", "%", "arg_0", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    '''This turns the pickled lightcurve file back into an `lcdict`.\n\n    Parameters\n    ----------\n\n    picklefile : str\n        The path to a previously written Kepler LC picklefile generated by\n        `kepler_lcdict_to_pkl` above.\n\n    Returns\n    -------\n\n    lcdict\n        Returns an `lcdict` (this is useable by most astrobase functions for LC\n        processing).\n\n    '''\n\n    if arg_0.endswith('.gz'):\n        arg_1 = gzip.open(arg_0, 'rb')\n    else:\n        arg_1 = open(arg_0, 'rb')\n\n    try:\n        with arg_1:\n            arg_2 = pickle.load(arg_1)\n\n    except UnicodeDecodeError:\n\n        with open(arg_0,'rb') as arg_1:\n            arg_2 = pickle.load(arg_1, encoding='latin1')\n\n        LOGWARNING('pickle %s was probably from Python 2 '\n                   'and failed to load without using \"latin1\" encoding. '\n                   'This is probably a numpy issue: '\n                   'http://stackoverflow.com/q/11305790' % arg_0)\n\n    return arg_2", "path": "astrobase/astrokep.py", "identifier": "read_kepler_pklc", "docstring": "This turns the pickled lightcurve file back into an `lcdict`.\n\n    Parameters\n    ----------\n\n    picklefile : str\n        The path to a previously written Kepler LC picklefile generated by\n        `kepler_lcdict_to_pkl` above.\n\n    Returns\n    -------\n\n    lcdict\n        Returns an `lcdict` (this is useable by most astrobase functions for LC\n        processing).", "docstring_tokens": ["This", "turns", "the", "pickled", "lightcurve", "file", "back", "into", "an", "lcdict", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255650}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L35-L43", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "Helper function to convet an Args object to a HoloViews Table", "language": "python", "parameters": "(args, vdims=[])", "return_statement": "return Table(items, kdims=kdims, vdims=vdims)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ")", ":", "if", "not", "Table", ":", "return", "\"HoloViews Table not available\"", "arg_2", "=", "[", "dim", "for", "dim", "in", "arg_0", ".", "constant_keys", "+", "arg_0", ".", "varying_keys", "if", "dim", "not", "in", "arg_1", "]", "arg_3", "=", "[", "tuple", "(", "[", "spec", "[", "k", "]", "for", "k", "in", "arg_2", "+", "arg_1", "]", ")", "for", "spec", "in", "arg_0", ".", "specs", "]", "return", "Table", "(", "arg_3", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=[]):\n    \"Helper function to convet an Args object to a HoloViews Table\"\n    if not Table:\n        return \"HoloViews Table not available\"\n    arg_2 = [dim for dim in arg_0.constant_keys + arg_0.varying_keys\n             if dim not in arg_1]\n    arg_3 = [tuple([spec[k] for k in arg_2+arg_1])\n             for spec in arg_0.specs]\n    return Table(arg_3, arg_2=arg_2, arg_1=arg_1)", "path": "lancet/core.py", "identifier": "to_table", "docstring": "Helper function to convet an Args object to a HoloViews Table", "docstring_tokens": ["Helper", "function", "to", "convet", "an", "Args", "object", "to", "a", "HoloViews", "Table"], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 255651}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/address_book.py#L254-L276", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Find all vcard files inside this address book.", "language": "python", "parameters": "(self, search=None, search_in_source_files=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "path", ",", "\"*.vcf\"", ")", ")", "if", "arg_1", "and", "arg_2", ":", "for", "arg_4", "in", "arg_3", ":", "with", "open", "(", "arg_4", ",", "\"r\"", ")", "as", "filehandle", ":", "if", "re", ".", "search", "(", "arg_1", ",", "filehandle", ".", "read", "(", ")", ",", "re", ".", "IGNORECASE", "|", "re", ".", "DOTALL", ")", ":", "yield", "arg_4", "else", ":", "yield", "from", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"Find all vcard files inside this address book.\n\n        If a search string is given only files which contents match that will\n        be returned.\n\n        :param search: a regular expression to limit the results\n        :type search: str\n        :param search_in_source_files: apply search regexp directly on the .vcf files to speed up parsing (less accurate)\n        :type search_in_source_files: bool\n        :returns: the paths of the vcard files\n        :rtype: generator\n\n        \"\"\"\n        arg_3 = glob.glob(os.path.join(arg_0.path, \"*.vcf\"))\n        if arg_1 and arg_2:\n            for arg_4 in arg_3:\n                with open(arg_4, \"r\") as filehandle:\n                    if re.search(arg_1, filehandle.read(),\n                                 re.IGNORECASE | re.DOTALL):\n                        yield arg_4\n        else:\n            yield from arg_3", "path": "khard/address_book.py", "identifier": "VdirAddressBook._find_vcard_files", "docstring": "Find all vcard files inside this address book.\n\n        If a search string is given only files which contents match that will\n        be returned.\n\n        :param search: a regular expression to limit the results\n        :type search: str\n        :param search_in_source_files: apply search regexp directly on the .vcf files to speed up parsing (less accurate)\n        :type search_in_source_files: bool\n        :returns: the paths of the vcard files\n        :rtype: generator", "docstring_tokens": ["Find", "all", "vcard", "files", "inside", "this", "address", "book", "."], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 255652}
{"url": "https://github.com/cltrudeau/django-flowr/blob/d077b90376ede33721db55ff29e08b8a16ed17ae/flowr/models.py#L540-L564", "sha": "d077b90376ede33721db55ff29e08b8a16ed17ae", "docstring_summary": "Called to verify that the given rule can become a child of the\n        current node.", "language": "python", "parameters": "(self, child_rule)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "node", ".", "children", ".", "count", "(", ")", "arg_3", "=", "len", "(", "arg_0", ".", "rule", ".", "children", ")", "if", "not", "arg_0", ".", "rule", ".", "multiple_paths", ":", "arg_3", "=", "1", "if", "arg_2", ">=", "arg_3", ":", "raise", "AttributeError", "(", "'Rule %s only allows %s children'", "%", "(", "arg_0", ".", "rule_name", ",", "arg_0", ".", "num_kids_allowed", ")", ")", "for", "arg_4", "in", "arg_0", ".", "node", ".", "children", ".", "all", "(", ")", ":", "if", "arg_4", ".", "data", ".", "rule_label", "==", "arg_1", ".", "class_label", ":", "raise", "AttributeError", "(", "'Child rule already exists'", ")", "if", "arg_1", "not", "in", "arg_0", ".", "rule", ".", "children", ":", "raise", "AttributeError", "(", "'Rule %s is not a valid child of Rule %s'", "%", "(", "arg_1", ".", "__name__", ",", "arg_0", ".", "rule_name", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Called to verify that the given rule can become a child of the\n        current node.  \n\n        :raises AttributeError: \n            if the child is not allowed\n        \"\"\"\n        arg_2 = arg_0.node.children.count()\n        arg_3 = len(arg_0.rule.children)\n        if not arg_0.rule.multiple_paths:\n            arg_3 = 1\n\n        if arg_2 >= arg_3:\n            raise AttributeError('Rule %s only allows %s children' % (\n                arg_0.rule_name, arg_0.num_kids_allowed))\n\n        # verify not a duplicate\n        for arg_4 in arg_0.node.children.all():\n            if arg_4.data.rule_label == arg_1.class_label:\n                raise AttributeError('Child rule already exists')\n\n        # check if the given rule is allowed as a child\n        if arg_1 not in arg_0.rule.children:\n            raise AttributeError('Rule %s is not a valid child of Rule %s' % (\n                arg_1.__name__, arg_0.rule_name))", "path": "flowr/models.py", "identifier": "FlowNodeData._child_allowed", "docstring": "Called to verify that the given rule can become a child of the\n        current node.  \n\n        :raises AttributeError: \n            if the child is not allowed", "docstring_tokens": ["Called", "to", "verify", "that", "the", "given", "rule", "can", "become", "a", "child", "of", "the", "current", "node", "."], "nwo": "cltrudeau/django-flowr", "score": 0.09252797783733271, "idx": 255653}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/subnets.py#L391-L423", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Retrieve a list of subnets.", "language": "python", "parameters": "(context, limit=None, page_reverse=False, sorts=['id'],\n                marker=None, filters=None, fields=None)", "return_statement": "return v._make_subnets_list(subnets, fields=fields)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "[", "'id'", "]", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Func for tenant %s with filters %s fields %s\"", "%", "(", "arg_0", ".", "tenant_id", ",", "arg_5", ",", "arg_6", ")", ")", "arg_5", "=", "arg_5", "or", "{", "}", "arg_7", "=", "db_api", ".", "subnet_find", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "marker_obj", "=", "arg_4", ",", "join_dns", "=", "True", ",", "join_routes", "=", "True", ",", "join_pool", "=", "True", ",", "**", "arg_5", ")", "for", "arg_8", "in", "arg_7", ":", "arg_9", "=", "arg_8", ".", "get", "(", "\"_allocation_pool_cache\"", ")", "if", "not", "arg_9", ":", "db_api", ".", "subnet_update_set_alloc_pool_cache", "(", "arg_0", ",", "arg_8", ",", "arg_8", ".", "allocation_pools", ")", "return", "v", ".", "_make_subnets_list", "(", "arg_7", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=['id'],\n                arg_4=None, arg_5=None, arg_6=None):\n    \"\"\"Retrieve a list of subnets.\n\n    The contents of the list depends on the identity of the user\n    making the request (as indicated by the context) as well as any\n    filters.\n    : param context: neutron api request context\n    : param filters: a dictionary with keys that are valid keys for\n        a subnet as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictiontary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n    : param fields: a list of strings that are valid keys in a\n        subnet dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n    \"\"\"\n    LOG.info(\"Func for tenant %s with filters %s fields %s\" %\n             (arg_0.tenant_id, arg_5, arg_6))\n    arg_5 = arg_5 or {}\n    arg_7 = db_api.subnet_find(arg_0, arg_1=arg_1,\n                                 arg_2=arg_2, arg_3=arg_3,\n                                 marker_obj=arg_4, join_dns=True,\n                                 join_routes=True, join_pool=True, **arg_5)\n    for arg_8 in arg_7:\n        arg_9 = arg_8.get(\"_allocation_pool_cache\")\n        if not arg_9:\n            db_api.subnet_update_set_alloc_pool_cache(\n                arg_0, arg_8, arg_8.allocation_pools)\n    return v._make_subnets_list(arg_7, arg_6=arg_6)", "path": "quark/plugin_modules/subnets.py", "identifier": "get_subnets", "docstring": "Retrieve a list of subnets.\n\n    The contents of the list depends on the identity of the user\n    making the request (as indicated by the context) as well as any\n    filters.\n    : param context: neutron api request context\n    : param filters: a dictionary with keys that are valid keys for\n        a subnet as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictiontary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n    : param fields: a list of strings that are valid keys in a\n        subnet dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.", "docstring_tokens": ["Retrieve", "a", "list", "of", "subnets", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255654}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/locations.py#L6-L14", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Returns location data.", "language": "python", "parameters": "(self, location_id)", "return_statement": "return self.location_from_json(self._get_resource(url)[\"location\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"/2/locations/%s\"", "%", "arg_1", "return", "arg_0", ".", "location_from_json", "(", "arg_0", ".", "_get_resource", "(", "arg_2", ")", "[", "\"location\"", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns location data.\n\n        http://dev.wheniwork.com/#get-existing-location\n        \"\"\"\n        arg_2 = \"/2/locations/%s\" % arg_1\n\n        return arg_0.location_from_json(arg_0._get_resource(arg_2)[\"location\"])", "path": "uw_wheniwork/locations.py", "identifier": "Locations.get_location", "docstring": "Returns location data.\n\n        http://dev.wheniwork.com/#get-existing-location", "docstring_tokens": ["Returns", "location", "data", "."], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 255655}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/tiling.py#L170-L220", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Given a state, returns a list of groups of particles. Each group of\n    particles are located near each other in the image. Every particle\n    located in the desired region is contained in exactly 1 group.", "language": "python", "parameters": "(s, region_size=40, bounds=None)", "return_statement": "return [g for g in groups if len(g) > 0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "40", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "(", "arg_0", ".", "oshape", ".", "translate", "(", "-", "arg_0", ".", "pad", ")", "if", "arg_2", "is", "None", "else", "util", ".", "Tile", "(", "arg_2", "[", "0", "]", ",", "arg_2", "[", "1", "]", ")", ")", "arg_4", "=", "util", ".", "Tile", "(", "arg_1", ",", "dim", "=", "arg_0", ".", "dim", ")", "arg_5", "=", "np", ".", "ceil", "(", "arg_3", ".", "shape", ".", "astype", "(", "'float'", ")", "/", "arg_4", ".", "shape", ")", "arg_6", "=", "util", ".", "Tile", "(", "arg_5", ")", ".", "coords", "(", "form", "=", "'vector'", ")", "arg_6", "=", "arg_6", ".", "reshape", "(", "-", "1", ",", "arg_6", ".", "shape", "[", "-", "1", "]", ")", "arg_7", "=", "[", "]", "arg_8", "=", "arg_0", ".", "obj_get_positions", "(", ")", "for", "arg_9", "in", "arg_6", ":", "arg_10", "=", "arg_4", ".", "copy", "(", ")", ".", "translate", "(", "arg_4", ".", "shape", "*", "arg_9", "-", "arg_0", ".", "pad", ")", "arg_7", ".", "append", "(", "find_particles_in_tile", "(", "arg_8", ",", "arg_10", ")", ")", "return", "[", "arg_11", "for", "arg_11", "in", "arg_7", "if", "len", "(", "arg_11", ")", ">", "0", "]"], "function": "def Func(arg_0, arg_1=40, arg_2=None):\n    \"\"\"\n    Given a state, returns a list of groups of particles. Each group of\n    particles are located near each other in the image. Every particle\n    located in the desired region is contained in exactly 1 group.\n\n    Parameters:\n    -----------\n    s : state\n        The PERI state to find particles in.\n\n    region_size: int or list of ints\n        The size of the box. Groups particles into boxes of shape region_size.\n        If region_size is a scalar, the box is a cube of length region_size.\n        Default is 40.\n\n    bounds: 2-element list-like of 3-element lists.\n        The sub-region of the image over which to look for particles.\n            bounds[0]: The lower-left  corner of the image region.\n            bounds[1]: The upper-right corner of the image region.\n        Default (None -> ([0,0,0], s.oshape.shape)) is a box of the entire\n        image size, i.e. the default places every particle in the image\n        somewhere in the groups.\n\n    Returns:\n    -----------\n    particle_groups: list\n        Each element of particle_groups is an int numpy.ndarray of the\n        group of nearby particles. Only contains groups with a nonzero\n        number of particles, so the elements don't necessarily correspond\n        to a given image region.\n    \"\"\"\n    arg_3 = (\n        arg_0.oshape.translate(-arg_0.pad) if arg_2 is None else\n        util.Tile(arg_2[0], arg_2[1])\n    )\n\n    # does all particle including out of image, is that correct?\n    arg_4 = util.Tile(arg_1, dim=arg_0.dim)\n    arg_5 = np.ceil(arg_3.shape.astype('float') / arg_4.shape)\n\n    arg_6 = util.Tile(arg_5).coords(form='vector')\n    arg_6 = arg_6.reshape(-1, arg_6.shape[-1])\n\n    arg_7 = []\n    arg_8 = arg_0.obj_get_positions()\n    for arg_9 in arg_6:\n        arg_10 = arg_4.copy().translate(arg_4.shape * arg_9 - arg_0.pad)\n        arg_7.append(find_particles_in_tile(arg_8, arg_10))\n\n    return [arg_11 for arg_11 in arg_7 if len(arg_11) > 0]", "path": "peri/opt/tiling.py", "identifier": "separate_particles_into_groups", "docstring": "Given a state, returns a list of groups of particles. Each group of\n    particles are located near each other in the image. Every particle\n    located in the desired region is contained in exactly 1 group.\n\n    Parameters:\n    -----------\n    s : state\n        The PERI state to find particles in.\n\n    region_size: int or list of ints\n        The size of the box. Groups particles into boxes of shape region_size.\n        If region_size is a scalar, the box is a cube of length region_size.\n        Default is 40.\n\n    bounds: 2-element list-like of 3-element lists.\n        The sub-region of the image over which to look for particles.\n            bounds[0]: The lower-left  corner of the image region.\n            bounds[1]: The upper-right corner of the image region.\n        Default (None -> ([0,0,0], s.oshape.shape)) is a box of the entire\n        image size, i.e. the default places every particle in the image\n        somewhere in the groups.\n\n    Returns:\n    -----------\n    particle_groups: list\n        Each element of particle_groups is an int numpy.ndarray of the\n        group of nearby particles. Only contains groups with a nonzero\n        number of particles, so the elements don't necessarily correspond\n        to a given image region.", "docstring_tokens": ["Given", "a", "state", "returns", "a", "list", "of", "groups", "of", "particles", ".", "Each", "group", "of", "particles", "are", "located", "near", "each", "other", "in", "the", "image", ".", "Every", "particle", "located", "in", "the", "desired", "region", "is", "contained", "in", "exactly", "1", "group", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255656}
{"url": "https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/filter.py#L8-L13", "sha": "dfb60fa1e30ae7cfec2526bb101fc205f5952639", "docstring_summary": "Return a config subset using the filter defined in the deploy config.", "language": "python", "parameters": "(config, deploy_config)", "return_statement": "return config_module.filter(config)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "return", "DotDict", "(", ")", "arg_2", "=", "get_config_module", "(", "arg_1", ")", "return", "arg_2", ".", "filter", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a config subset using the filter defined in the deploy config.\"\"\"\n    if not os.path.isfile(arg_1):\n        return DotDict()\n    arg_2 = get_config_module(arg_1)\n    return arg_2.filter(arg_0)", "path": "yoconfigurator/filter.py", "identifier": "filter_config", "docstring": "Return a config subset using the filter defined in the deploy config.", "docstring_tokens": ["Return", "a", "config", "subset", "using", "the", "filter", "defined", "in", "the", "deploy", "config", "."], "nwo": "yola/yoconfigurator", "score": 0.5008169819389054, "idx": 255657}
{"url": "https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L121-L133", "sha": "73994c82360e65a983c803b1182892e2138320b2", "docstring_summary": "Return a date, time, or datetime converted to a datetime in the given timezone. If when is a\n    datetime and has no timezone it is assumed to be local time. Date and time objects are also\n    assumed to be UTC. The tz value defaults to UTC. Raise TypeError if when cannot be converted to\n    a datetime.", "language": "python", "parameters": "(when, tz=None)", "return_statement": "return when.astimezone(tz or utc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "return", "None", "arg_0", "=", "to_datetime", "(", "arg_0", ")", "if", "arg_0", ".", "tzinfo", "is", "None", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "tzinfo", "=", "localtz", ")", "return", "arg_0", ".", "astimezone", "(", "arg_1", "or", "utc", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Return a date, time, or datetime converted to a datetime in the given timezone. If when is a\n    datetime and has no timezone it is assumed to be local time. Date and time objects are also\n    assumed to be UTC. The tz value defaults to UTC. Raise TypeError if when cannot be converted to\n    a datetime.\n    \"\"\"\n    if arg_0 is None:\n        return None\n    arg_0 = to_datetime(arg_0)\n    if arg_0.tzinfo is None:\n        arg_0 = arg_0.replace(tzinfo=localtz)\n    return arg_0.astimezone(arg_1 or utc)", "path": "era.py", "identifier": "totz", "docstring": "Return a date, time, or datetime converted to a datetime in the given timezone. If when is a\n    datetime and has no timezone it is assumed to be local time. Date and time objects are also\n    assumed to be UTC. The tz value defaults to UTC. Raise TypeError if when cannot be converted to\n    a datetime.", "docstring_tokens": ["Return", "a", "date", "time", "or", "datetime", "converted", "to", "a", "datetime", "in", "the", "given", "timezone", ".", "If", "when", "is", "a", "datetime", "and", "has", "no", "timezone", "it", "is", "assumed", "to", "be", "local", "time", ".", "Date", "and", "time", "objects", "are", "also", "assumed", "to", "be", "UTC", ".", "The", "tz", "value", "defaults", "to", "UTC", ".", "Raise", "TypeError", "if", "when", "cannot", "be", "converted", "to", "a", "datetime", "."], "nwo": "zenreach/py-era", "score": 0.0, "idx": 255658}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L409-L422", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Parse the command line for overriding the defaults", "language": "python", "parameters": "(namespace)", "return_statement": "return overrides", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", ")", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "arg_2", ".", "split", "(", "\"=\"", ")", "if", "len", "(", "arg_3", ")", "!=", "2", ":", "raise", "Exception", "(", "\"Invalid config property format (%s) expected key=value\"", "%", "arg_2", ")", "if", "arg_3", "[", "1", "]", "in", "[", "'true'", ",", "'True'", ",", "'TRUE'", "]", ":", "arg_1", "[", "arg_3", "[", "0", "]", "]", "=", "True", "elif", "arg_3", "[", "1", "]", "in", "[", "'false'", ",", "'False'", ",", "'FALSE'", "]", ":", "arg_1", "[", "arg_3", "[", "0", "]", "]", "=", "False", "else", ":", "arg_1", "[", "arg_3", "[", "0", "]", "]", "=", "arg_3", "[", "1", "]", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Parse the command line for overriding the defaults\"\"\"\n  arg_1 = dict()\n  for arg_2 in arg_0:\n    arg_3 = arg_2.split(\"=\")\n    if len(arg_3) != 2:\n      raise Exception(\"Invalid config property format (%s) expected key=value\" % arg_2)\n    if arg_3[1] in ['true', 'True', 'TRUE']:\n      arg_1[arg_3[0]] = True\n    elif arg_3[1] in ['false', 'False', 'FALSE']:\n      arg_1[arg_3[0]] = False\n    else:\n      arg_1[arg_3[0]] = arg_3[1]\n  return arg_1", "path": "heron/tools/common/src/python/utils/config.py", "identifier": "parse_override_config", "docstring": "Parse the command line for overriding the defaults", "docstring_tokens": ["Parse", "the", "command", "line", "for", "overriding", "the", "defaults"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255659}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L328-L351", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Award a bid on a project", "language": "python", "parameters": "(session, bid_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'Content-Type'", ":", "'application/x-www-form-urlencoded'", "}", "arg_3", "=", "{", "'action'", ":", "'award'", "}", "arg_4", "=", "'bids/{}'", ".", "format", "(", "arg_1", ")", "arg_5", "=", "make_put_request", "(", "arg_0", ",", "arg_4", ",", "arg_2", "=", "arg_2", ",", "params_data", "=", "arg_3", ")", "arg_6", "=", "arg_5", ".", "json", "(", ")", "if", "arg_5", ".", "status_code", "==", "200", ":", "return", "arg_6", "[", "'status'", "]", "else", ":", "arg_6", "=", "arg_5", ".", "json", "(", ")", "raise", "BidNotAwardedException", "(", "message", "=", "arg_6", "[", "'message'", "]", ",", "error_code", "=", "arg_6", "[", "'error_code'", "]", ",", "request_id", "=", "arg_6", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Award a bid on a project\n    \"\"\"\n    arg_2 = {\n        'Content-Type': 'application/x-www-form-urlencoded'\n    }\n    arg_3 = {\n        'action': 'award'\n    }\n    # POST /api/projects/0.1/bids/{bid_id}/?action=award\n    arg_4 = 'bids/{}'.format(arg_1)\n    arg_5 = make_put_request(arg_0, arg_4, arg_2=arg_2,\n                                params_data=arg_3)\n    arg_6 = arg_5.json()\n    if arg_5.status_code == 200:\n        return arg_6['status']\n    else:\n        arg_6 = arg_5.json()\n        raise BidNotAwardedException(\n            message=arg_6['message'],\n            error_code=arg_6['error_code'],\n            request_id=arg_6['request_id']\n        )", "path": "freelancersdk/resources/projects/projects.py", "identifier": "award_project_bid", "docstring": "Award a bid on a project", "docstring_tokens": ["Award", "a", "bid", "on", "a", "project"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 255660}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/utils.py#L112-L142", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Get filepaths with supported extensions from given filepaths.", "language": "python", "parameters": "(filepaths, supported_extensions, max_depth=float('inf'))", "return_statement": "return supported_filepaths", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", "(", "'inf'", ")", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ":", "if", "os", ".", "name", "==", "'nt'", "and", "CYGPATH_RE", ".", "match", "(", "arg_5", ")", ":", "arg_5", "=", "convert_cygwin_path", "(", "arg_5", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_5", ")", ":", "for", "arg_6", ",", "arg_7", ",", "arg_8", "in", "walk_depth", "(", "arg_5", ",", "arg_2", ")", ":", "for", "arg_9", "in", "arg_8", ":", "if", "arg_9", ".", "lower", "(", ")", ".", "endswith", "(", "arg_1", ")", ":", "arg_4", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_9", ")", ")", "elif", "os", ".", "path", ".", "isfile", "(", "arg_5", ")", "and", "arg_5", ".", "lower", "(", ")", ".", "endswith", "(", "arg_1", ")", ":", "arg_4", ".", "append", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=arg_3('inf')):\n\t\"\"\"Get filepaths with supported extensions from given filepaths.\n\n\tParameters:\n\t\tfilepaths (list or str): Filepath(s) to check.\n\n\t\tsupported_extensions (tuple or str): Supported file extensions or a single file extension.\n\n\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\tDefault: No limit.\n\n\tReturns:\n\t\tA list of supported filepaths.\n\t\"\"\"\n\n\targ_4 = []\n\n\tfor arg_5 in arg_0:\n\t\tif os.name == 'nt' and CYGPATH_RE.match(arg_5):\n\t\t\targ_5 = convert_cygwin_path(arg_5)\n\n\t\tif os.path.isdir(arg_5):\n\t\t\tfor arg_6, arg_7, arg_8 in walk_depth(arg_5, arg_2):\n\t\t\t\tfor arg_9 in arg_8:\n\t\t\t\t\tif arg_9.lower().endswith(arg_1):\n\t\t\t\t\t\targ_4.append(os.path.join(arg_6, arg_9))\n\t\telif os.path.isfile(arg_5) and arg_5.lower().endswith(arg_1):\n\t\t\targ_4.append(arg_5)\n\n\treturn arg_4", "path": "gmusicapi_wrapper/utils.py", "identifier": "get_supported_filepaths", "docstring": "Get filepaths with supported extensions from given filepaths.\n\n\tParameters:\n\t\tfilepaths (list or str): Filepath(s) to check.\n\n\t\tsupported_extensions (tuple or str): Supported file extensions or a single file extension.\n\n\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\tDefault: No limit.\n\n\tReturns:\n\t\tA list of supported filepaths.", "docstring_tokens": ["Get", "filepaths", "with", "supported", "extensions", "from", "given", "filepaths", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 255661}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L917-L940", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Return a value check function which raises a value error if the value is not\n    in a pre-defined enumeration of values.", "language": "python", "parameters": "(*args)", "return_statement": "return checker", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "assert", "len", "(", "arg_0", ")", ">", "0", ",", "'at least one argument is required'", "if", "len", "(", "arg_0", ")", "==", "1", ":", "arg_1", "=", "arg_0", "[", "0", "]", "else", ":", "arg_1", "=", "arg_0", "def", "checker", "(", "arg_2", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "raise", "ValueError", "(", "arg_2", ")", "return", "checker"], "function": "def Func(*arg_0):\n    \"\"\"\n    Return a value check function which raises a value error if the value is not\n    in a pre-defined Func of values.\n\n    If you pass in a list, tuple or set as the single argument, it is assumed\n    that the list/tuple/set defines the membership of the Func.\n\n    If you pass in more than on argument, it is assumed the arguments themselves\n    define the Func.\n\n    \"\"\"\n\n    assert len(arg_0) > 0, 'at least one argument is required'\n    if len(arg_0) == 1:\n        # assume the first argument defines the membership\n        arg_1 = arg_0[0]\n    else:\n        # assume the arguments are the members\n        arg_1 = arg_0\n    def checker(arg_2):\n        if arg_2 not in arg_1:\n            raise ValueError(arg_2)\n    return checker", "path": "csvvalidator.py", "identifier": "enumeration", "docstring": "Return a value check function which raises a value error if the value is not\n    in a pre-defined enumeration of values.\n\n    If you pass in a list, tuple or set as the single argument, it is assumed\n    that the list/tuple/set defines the membership of the enumeration.\n\n    If you pass in more than on argument, it is assumed the arguments themselves\n    define the enumeration.", "docstring_tokens": ["Return", "a", "value", "check", "function", "which", "raises", "a", "value", "error", "if", "the", "value", "is", "not", "in", "a", "pre", "-", "defined", "enumeration", "of", "values", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 255662}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L775-L782", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "The Jinja loader for this package bound object.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "template_folder", "is", "not", "None", ":", "return", "FileSystemLoader", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "root_path", ",", "arg_0", ".", "template_folder", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"The Jinja loader for this package bound object.\n\n        .. versionadded:: 0.5\n        \"\"\"\n        if arg_0.template_folder is not None:\n            return FileSystemLoader(os.path.join(arg_0.root_path,\n                                                 arg_0.template_folder))", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py", "identifier": "_PackageBoundObject.jinja_loader", "docstring": "The Jinja loader for this package bound object.\n\n        .. versionadded:: 0.5", "docstring_tokens": ["The", "Jinja", "loader", "for", "this", "package", "bound", "object", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255663}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L524-L565", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Starts Cloud SQL Proxy.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_download_sql_proxy_if_needed", "(", ")", "if", "arg_0", ".", "sql_proxy_process", ":", "raise", "AirflowException", "(", "\"The sql proxy is already running: {}\"", ".", "format", "(", "arg_0", ".", "sql_proxy_process", ")", ")", "else", ":", "arg_1", "=", "[", "arg_0", ".", "sql_proxy_path", "]", "arg_1", ".", "extend", "(", "arg_0", ".", "command_line_parameters", ")", "try", ":", "arg_0", ".", "log", ".", "info", "(", "\"Creating directory %s\"", ",", "arg_0", ".", "cloud_sql_proxy_socket_directory", ")", "os", ".", "makedirs", "(", "arg_0", ".", "cloud_sql_proxy_socket_directory", ")", "except", "OSError", ":", "pass", "arg_1", ".", "extend", "(", "arg_0", ".", "_get_credential_parameters", "(", ")", ")", "arg_0", ".", "log", ".", "info", "(", "\"Running the command: `%s`\"", ",", "\" \"", ".", "join", "(", "arg_1", ")", ")", "arg_0", ".", "sql_proxy_process", "=", "Popen", "(", "arg_1", ",", "stdin", "=", "PIPE", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ")", "arg_0", ".", "log", ".", "info", "(", "\"The pid of cloud_sql_proxy: %s\"", ",", "arg_0", ".", "sql_proxy_process", ".", "pid", ")", "while", "True", ":", "arg_3", "=", "arg_0", ".", "sql_proxy_process", ".", "stderr", ".", "readline", "(", ")", ".", "decode", "(", "'utf-8'", ")", "arg_4", "=", "arg_0", ".", "sql_proxy_process", ".", "poll", "(", ")", "if", "arg_3", "==", "''", "and", "arg_4", "is", "not", "None", ":", "arg_0", ".", "sql_proxy_process", "=", "None", "raise", "AirflowException", "(", "\"The cloud_sql_proxy finished early with return code {}!\"", ".", "format", "(", "arg_4", ")", ")", "if", "arg_3", "!=", "''", ":", "arg_0", ".", "log", ".", "info", "(", "arg_3", ")", "if", "\"googleapi: Error\"", "in", "arg_3", "or", "\"invalid instance name:\"", "in", "arg_3", ":", "arg_0", ".", "stop_proxy", "(", ")", "raise", "AirflowException", "(", "\"Error when starting the cloud_sql_proxy {}!\"", ".", "format", "(", "arg_3", ")", ")", "if", "\"Ready for new connections\"", "in", "arg_3", ":", "return"], "function": "def Func(arg_0):\n        \"\"\"\n        Starts Cloud SQL Proxy.\n\n        You have to remember to stop the proxy if you started it!\n        \"\"\"\n        arg_0._download_sql_proxy_if_needed()\n        if arg_0.sql_proxy_process:\n            raise AirflowException(\"The sql proxy is already running: {}\".format(\n                arg_0.sql_proxy_process))\n        else:\n            arg_1 = [arg_0.sql_proxy_path]\n            arg_1.extend(arg_0.command_line_parameters)\n            try:\n                arg_0.log.info(\"Creating directory %s\",\n                              arg_0.cloud_sql_proxy_socket_directory)\n                os.makedirs(arg_0.cloud_sql_proxy_socket_directory)\n            except OSError:\n                # Needed for python 2 compatibility (exists_ok missing)\n                pass\n            arg_1.extend(arg_0._get_credential_parameters())\n            arg_0.log.info(\"Running the command: `%s`\", \" \".join(arg_1))\n            arg_0.sql_proxy_process = Popen(arg_1,\n                                           stdin=PIPE, stdout=PIPE, stderr=PIPE)\n            arg_0.log.info(\"The pid of cloud_sql_proxy: %s\", arg_0.sql_proxy_process.pid)\n            while True:\n                arg_3 = arg_0.sql_proxy_process.stderr.readline().decode('utf-8')\n                arg_4 = arg_0.sql_proxy_process.poll()\n                if arg_3 == '' and arg_4 is not None:\n                    arg_0.sql_proxy_process = None\n                    raise AirflowException(\n                        \"The cloud_sql_proxy finished early with return code {}!\".format(\n                            arg_4))\n                if arg_3 != '':\n                    arg_0.log.info(arg_3)\n                if \"googleapi: Error\" in arg_3 or \"invalid instance name:\" in arg_3:\n                    arg_0.stop_proxy()\n                    raise AirflowException(\n                        \"Error when starting the cloud_sql_proxy {}!\".format(\n                            arg_3))\n                if \"Ready for new connections\" in arg_3:\n                    return", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlProxyRunner.start_proxy", "docstring": "Starts Cloud SQL Proxy.\n\n        You have to remember to stop the proxy if you started it!", "docstring_tokens": ["Starts", "Cloud", "SQL", "Proxy", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255664}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L651-L707", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Resolves item's URL.", "language": "python", "parameters": "(self, sitetree_item, context=None)", "return_statement": "return resolved_url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "arg_0", ".", "current_page_context", "arg_3", "=", "arg_0", ".", "resolve_var", "if", "not", "isinstance", "(", "arg_1", ",", "MODEL_TREE_ITEM_CLASS", ")", ":", "arg_1", "=", "arg_3", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_items_urls", ".", "get", "(", "arg_1", ")", "if", "arg_4", "is", "not", "None", ":", "return", "arg_4", "if", "arg_1", ".", "urlaspattern", ":", "Func", "=", "arg_1", ".", "url", "arg_6", "=", "Func", "arg_7", "=", "[", "]", "if", "' '", "in", "Func", ":", "arg_6", "=", "Func", ".", "split", "(", "' '", ")", "for", "arg_8", "in", "arg_6", "[", "1", ":", "]", ":", "arg_9", "=", "arg_3", "(", "arg_8", ")", "arg_7", ".", "append", "(", "'\"%s\"'", "%", "arg_9", ")", "arg_6", "=", "arg_6", "[", "0", "]", ".", "strip", "(", "'\"\\' '", ")", "arg_10", "=", "\"'%s' %s\"", "%", "(", "arg_6", ",", "' '", ".", "join", "(", "arg_7", ")", ")", "else", ":", "arg_10", "=", "'%s'", "%", "arg_1", ".", "url", "if", "arg_1", ".", "urlaspattern", ":", "arg_11", "=", "'url %s as item.url_resolved'", "%", "arg_10", "url_tag", "(", "Parser", "(", "None", ")", ",", "Token", "(", "token_type", "=", "TOKEN_BLOCK", ",", "contents", "=", "arg_11", ")", ")", ".", "render", "(", "arg_2", ")", "arg_4", "=", "arg_2", "[", "'item.url_resolved'", "]", "or", "UNRESOLVED_ITEM_MARKER", "else", ":", "arg_4", "=", "arg_10", "arg_0", ".", "_items_urls", "[", "arg_1", "]", "=", "arg_4", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Resolves item's URL.\n\n        :param TreeItemBase sitetree_item: TreeItemBase heir object, 'url' property of which\n            is processed as URL pattern or simple URL.\n\n        :param Context context:\n\n        :rtype: str|unicode\n        \"\"\"\n        arg_2 = arg_2 or arg_0.current_page_context\n        arg_3 = arg_0.resolve_var\n\n        if not isinstance(arg_1, MODEL_TREE_ITEM_CLASS):\n            arg_1 = arg_3(arg_1, arg_2)\n\n        arg_4 = arg_0._items_urls.get(arg_1)\n        if arg_4 is not None:\n            return arg_4\n\n        # Resolve only if item's URL is marked as pattern.\n        if arg_1.urlaspattern:\n            Func = arg_1.url\n            arg_6 = Func\n            arg_7 = []\n\n            if ' ' in Func:\n                arg_6 = Func.split(' ')\n                # We should try to resolve URL parameters from site tree item.\n                for arg_8 in arg_6[1:]:\n                    arg_9 = arg_3(arg_8)\n                    # We enclose arg in double quotes as already resolved.\n                    arg_7.append('\"%s\"' % arg_9)\n\n                arg_6 = arg_6[0].strip('\"\\' ')\n\n            arg_10 = \"'%s' %s\" % (arg_6, ' '.join(arg_7))\n\n        else:\n            arg_10 = '%s' % arg_1.url\n\n        if arg_1.urlaspattern:\n            # Form token to pass to Django 'url' tag.\n            arg_11 = 'url %s as item.url_resolved' % arg_10\n            url_tag(\n                Parser(None),\n                Token(token_type=TOKEN_BLOCK, contents=arg_11)\n            ).render(arg_2)\n\n            arg_4 = arg_2['item.url_resolved'] or UNRESOLVED_ITEM_MARKER\n\n        else:\n            arg_4 = arg_10\n\n        arg_0._items_urls[arg_1] = arg_4\n\n        return arg_4", "path": "sitetree/sitetreeapp.py", "identifier": "SiteTree.url", "docstring": "Resolves item's URL.\n\n        :param TreeItemBase sitetree_item: TreeItemBase heir object, 'url' property of which\n            is processed as URL pattern or simple URL.\n\n        :param Context context:\n\n        :rtype: str|unicode", "docstring_tokens": ["Resolves", "item", "s", "URL", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 255665}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/optics/base.py#L216-L229", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Sets all the foci within `state` to values taken from `iterable`.", "language": "python", "parameters": "(self, state, iterable)", "return_statement": "return self.apply(func, pure, state).unwrap()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "_is_kind", "(", "Setter", ")", ":", "raise", "TypeError", "(", "'Must be an instance of Setter to .Func()'", ")", "arg_3", "=", "iter", "(", "arg_2", ")", "arg_4", "=", "lambda", "a", ":", "Identity", "(", "a", ")", "arg_5", "=", "lambda", "a", ":", "Identity", "(", "next", "(", "arg_3", ")", ")", "return", "arg_0", ".", "apply", "(", "arg_5", ",", "arg_4", ",", "arg_1", ")", ".", "unwrap", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        # type: (S, Iterable[B]) -> T\n        '''Sets all the foci within `state` to values taken from `iterable`.\n\n        Requires kind Setter. This method will raise TypeError when the\n        optic has no way to set foci.\n        '''\n        if not arg_0._is_kind(Setter):\n            raise TypeError('Must be an instance of Setter to .Func()')\n\n        arg_3 = iter(arg_2)\n        arg_4 = lambda a: Identity(a)\n        arg_5 = lambda a: Identity(next(arg_3))\n        return arg_0.apply(arg_5, arg_4, arg_1).unwrap()", "path": "lenses/optics/base.py", "identifier": "LensLike.iterate", "docstring": "Sets all the foci within `state` to values taken from `iterable`.\n\n        Requires kind Setter. This method will raise TypeError when the\n        optic has no way to set foci.", "docstring_tokens": ["Sets", "all", "the", "foci", "within", "state", "to", "values", "taken", "from", "iterable", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 255666}
{"url": "https://github.com/cdriehuys/django-rest-email-auth/blob/7e752c4d77ae02d2d046f214f56e743aa12ab23f/rest_email_auth/models.py#L102-L121", "sha": "7e752c4d77ae02d2d046f214f56e743aa12ab23f", "docstring_summary": "Set this email address as the user's primary email.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "EmailAddress", ".", "objects", ".", "filter", "(", "arg_2", "=", "True", ",", "user", "=", "arg_0", ".", "user", ")", "arg_1", "=", "arg_1", ".", "exclude", "(", "pk", "=", "arg_0", ".", "pk", ")", "with", "transaction", ".", "atomic", "(", ")", ":", "arg_1", ".", "update", "(", "arg_2", "=", "False", ")", "arg_0", ".", "is_primary", "=", "True", "arg_0", ".", "save", "(", ")", "logger", ".", "info", "(", "\"Set %s as the primary email address for %s.\"", ",", "arg_0", ".", "email", ",", "arg_0", ".", "user", ",", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Set this email address as the user's primary email.\n        \"\"\"\n        arg_1 = EmailAddress.objects.filter(arg_2=True, user=arg_0.user)\n        arg_1 = arg_1.exclude(pk=arg_0.pk)\n\n        # The transaction is atomic so there is never a gap where a user\n        # has no primary email address.\n        with transaction.atomic():\n            arg_1.update(arg_2=False)\n\n            arg_0.is_primary = True\n            arg_0.save()\n\n        logger.info(\n            \"Set %s as the primary email address for %s.\",\n            arg_0.email,\n            arg_0.user,\n        )", "path": "rest_email_auth/models.py", "identifier": "EmailAddress.set_primary", "docstring": "Set this email address as the user's primary email.", "docstring_tokens": ["Set", "this", "email", "address", "as", "the", "user", "s", "primary", "email", "."], "nwo": "cdriehuys/django-rest-email-auth", "score": 0.28490879858232004, "idx": 255667}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1387-L1419", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Delete an existing table from the dataset;\n        If the table does not exist, return an error unless ignore_if_missing\n        is set to True.", "language": "python", "parameters": "(self, deletion_dataset_table,\n                         ignore_if_missing=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "_split_tablename", "(", "table_input", "=", "arg_1", ",", "default_project_id", "=", "arg_0", ".", "project_id", ")", "try", ":", "arg_0", ".", "service", ".", "tables", "(", ")", ".", "delete", "(", "projectId", "=", "arg_3", ",", "datasetId", "=", "arg_4", ",", "tableId", "=", "arg_5", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "arg_0", ".", "log", ".", "info", "(", "'Deleted table %s:%s.%s.'", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "except", "HttpError", ":", "if", "not", "arg_2", ":", "raise", "Exception", "(", "'Table deletion failed. Table does not exist.'", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "'Table does not exist. Skipping.'", ")"], "function": "def Func(arg_0, arg_1,\n                         arg_2=False):\n        \"\"\"\n        Delete an existing table from the dataset;\n        If the table does not exist, return an error unless ignore_if_missing\n        is set to True.\n\n        :param deletion_dataset_table: A dotted\n            ``(<project>.|<project>:)<dataset>.<table>`` that indicates which table\n            will be deleted.\n        :type deletion_dataset_table: str\n        :param ignore_if_missing: if True, then return success even if the\n            requested table does not exist.\n        :type ignore_if_missing: bool\n        :return:\n        \"\"\"\n        arg_3, arg_4, arg_5 = \\\n            _split_tablename(table_input=arg_1,\n                             default_project_id=arg_0.project_id)\n\n        try:\n            arg_0.service.tables() \\\n                .delete(projectId=arg_3,\n                        datasetId=arg_4,\n                        tableId=arg_5) \\\n                .execute(num_retries=arg_0.num_retries)\n            arg_0.log.info('Deleted table %s:%s.%s.', arg_3,\n                          arg_4, arg_5)\n        except HttpError:\n            if not arg_2:\n                raise Exception('Table deletion failed. Table does not exist.')\n            else:\n                arg_0.log.info('Table does not exist. Skipping.')", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryBaseCursor.run_table_delete", "docstring": "Delete an existing table from the dataset;\n        If the table does not exist, return an error unless ignore_if_missing\n        is set to True.\n\n        :param deletion_dataset_table: A dotted\n            ``(<project>.|<project>:)<dataset>.<table>`` that indicates which table\n            will be deleted.\n        :type deletion_dataset_table: str\n        :param ignore_if_missing: if True, then return success even if the\n            requested table does not exist.\n        :type ignore_if_missing: bool\n        :return:", "docstring_tokens": ["Delete", "an", "existing", "table", "from", "the", "dataset", ";", "If", "the", "table", "does", "not", "exist", "return", "an", "error", "unless", "ignore_if_missing", "is", "set", "to", "True", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255668}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1190-L1205", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Given an id, get the corresponding file info relative path joined with file name.", "language": "python", "parameters": "(self, id)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "walk_files_info", "(", ")", ":", "if", "arg_3", "[", "'id'", "]", "==", "arg_1", ":", "return", "arg_2", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Given an id, get the corresponding file info relative path joined with file name.\n\n        Parameters:\n            #. id (string): The file unique id string.\n\n        :Returns:\n            #. relativePath (string): The file relative path joined with file name.\n               If None, it means file was not found.\n        \"\"\"\n        for arg_2, arg_3 in arg_0.walk_files_info():\n            if arg_3['id']==arg_1:\n                return arg_2\n        # none was found\n        return None", "path": "OldRepository.py", "identifier": "Repository.get_file_relative_path_by_id", "docstring": "Given an id, get the corresponding file info relative path joined with file name.\n\n        Parameters:\n            #. id (string): The file unique id string.\n\n        :Returns:\n            #. relativePath (string): The file relative path joined with file name.\n               If None, it means file was not found.", "docstring_tokens": ["Given", "an", "id", "get", "the", "corresponding", "file", "info", "relative", "path", "joined", "with", "file", "name", "."], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 255669}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varbase/autocorr.py#L20-L57", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Calculates the autocorr of mag series for specific lag.", "language": "python", "parameters": "(mags, lag, maglen, magmed, magstd)", "return_statement": "return acorr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "nparange", "(", "1", ",", "arg_2", "-", "arg_1", ")", "arg_6", "=", "(", "arg_0", "[", "arg_5", "]", "-", "arg_3", ")", "*", "(", "arg_0", "[", "arg_5", "+", "arg_1", "]", "-", "arg_3", ")", "arg_7", "=", "(", "1.0", "/", "(", "(", "arg_2", "-", "arg_1", ")", "*", "arg_4", ")", ")", "*", "npsum", "(", "arg_6", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    '''Calculates the autocorr of mag series for specific lag.\n\n    This version of the function is taken from: Kim et al. (`2011\n    <https://dx.doi.org/10.1088/0004-637X/735/2/68>`_)\n\n    Parameters\n    ----------\n\n    mags : np.array\n        This is the magnitudes array. MUST NOT have any nans.\n\n    lag : float\n        The specific lag value to calculate the auto-correlation for. This MUST\n        be less than total number of observations in `mags`.\n\n    maglen : int\n        The number of elements in the `mags` array.\n\n    magmed : float\n        The median of the `mags` array.\n\n    magstd : float\n        The standard deviation of the `mags` array.\n\n    Returns\n    -------\n\n    float\n        The auto-correlation at this specific `lag` value.\n\n    '''\n\n    arg_5 = nparange(1,arg_2-arg_1)\n    arg_6 = (arg_0[arg_5] - arg_3) * (arg_0[arg_5+arg_1] - arg_3)\n    arg_7 = (1.0/((arg_2 - arg_1)*arg_4)) * npsum(arg_6)\n\n    return arg_7", "path": "astrobase/varbase/autocorr.py", "identifier": "_autocorr_func1", "docstring": "Calculates the autocorr of mag series for specific lag.\n\n    This version of the function is taken from: Kim et al. (`2011\n    <https://dx.doi.org/10.1088/0004-637X/735/2/68>`_)\n\n    Parameters\n    ----------\n\n    mags : np.array\n        This is the magnitudes array. MUST NOT have any nans.\n\n    lag : float\n        The specific lag value to calculate the auto-correlation for. This MUST\n        be less than total number of observations in `mags`.\n\n    maglen : int\n        The number of elements in the `mags` array.\n\n    magmed : float\n        The median of the `mags` array.\n\n    magstd : float\n        The standard deviation of the `mags` array.\n\n    Returns\n    -------\n\n    float\n        The auto-correlation at this specific `lag` value.", "docstring_tokens": ["Calculates", "the", "autocorr", "of", "mag", "series", "for", "specific", "lag", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255670}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/timeslots.py#L72-L81", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a new interval shifted by `time` from self", "language": "python", "parameters": "(self, time: int)", "return_statement": "return Interval(self._begin + time, self._end + time)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "'Interval'", ":", "return", "Interval", "(", "arg_0", ".", "_begin", "+", "arg_1", ",", "arg_0", ".", "_end", "+", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> 'Interval':\n        \"\"\"Return a new interval Funced by `time` from self\n\n        Args:\n            time: time to be Funced\n\n        Returns:\n            Interval: interval Funced by `time`\n        \"\"\"\n        return Interval(arg_0._begin + arg_1, arg_0._end + arg_1)", "path": "qiskit/pulse/timeslots.py", "identifier": "Interval.shift", "docstring": "Return a new interval shifted by `time` from self\n\n        Args:\n            time: time to be shifted\n\n        Returns:\n            Interval: interval shifted by `time`", "docstring_tokens": ["Return", "a", "new", "interval", "shifted", "by", "time", "from", "self"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255671}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/waveform.py#L37-L94", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Evaluate a chirp signal at time t.", "language": "python", "parameters": "(t, f0=0., t1=1., f1=100., form='linear', phase=0)", "return_statement": "return y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.", ",", "arg_2", "=", "1.", ",", "arg_3", "=", "100.", ",", "arg_4", "=", "'linear'", ",", "arg_5", "=", "0", ")", ":", "arg_6", "=", "[", "'linear'", ",", "'quadratic'", ",", "'logarithmic'", "]", "if", "arg_4", "not", "in", "arg_6", ":", "raise", "ValueError", "(", "\"Invalid form. Valid form are %s\"", "%", "arg_6", ")", "arg_0", "=", "numpy", ".", "array", "(", "arg_0", ")", "arg_5", "=", "2.", "*", "pi", "*", "arg_5", "/", "360.", "if", "arg_4", "==", "\"linear\"", ":", "arg_7", "=", "pi", "*", "(", "arg_3", "-", "arg_1", ")", "/", "arg_2", "arg_8", "=", "2.", "*", "pi", "*", "arg_1", "arg_9", "=", "numpy", ".", "cos", "(", "arg_7", "*", "arg_0", "**", "2", "+", "arg_8", "*", "arg_0", "+", "arg_5", ")", "elif", "arg_4", "==", "\"quadratic\"", ":", "arg_7", "=", "(", "2", "/", "3.", "*", "pi", "*", "(", "arg_3", "-", "arg_1", ")", "/", "arg_2", "/", "arg_2", ")", "arg_8", "=", "2.", "*", "pi", "*", "arg_1", "arg_9", "=", "numpy", ".", "cos", "(", "arg_7", "*", "arg_0", "**", "3", "+", "arg_8", "*", "arg_0", "+", "arg_5", ")", "elif", "arg_4", "==", "\"logarithmic\"", ":", "arg_7", "=", "2.", "*", "pi", "*", "arg_2", "/", "numpy", ".", "log", "(", "arg_3", "-", "arg_1", ")", "arg_8", "=", "2.", "*", "pi", "*", "arg_1", "arg_10", "=", "(", "arg_3", "-", "arg_1", ")", "**", "(", "1.", "/", "arg_2", ")", "arg_9", "=", "numpy", ".", "cos", "(", "arg_7", "*", "arg_10", "**", "arg_0", "+", "arg_8", "*", "arg_0", "+", "arg_5", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1=0., arg_2=1., arg_3=100., arg_4='linear', arg_5=0):\n    r\"\"\"Evaluate a Func signal at time t.\n\n    A Func signal is a frequency swept cosine wave.\n\n    .. math:: a = \\pi  (f_1 - f_0) / t_1\n    .. math:: b = 2  \\pi  f_0\n    .. math:: y = \\cos\\left( \\pi\\frac{f_1-f_0}{t_1}  t^2 + 2\\pi f_0 t + \\rm{phase} \\right)\n\n    :param array t: times at which to evaluate the Func signal\n    :param float f0: frequency at time t=0 (Hz)\n    :param float t1: time t1\n    :param float f1: frequency at time t=t1 (Hz)\n    :param str form: shape of frequency sweep in ['linear', 'quadratic', 'logarithmic']\n    :param float phase: phase shift at t=0\n\n    The parameter **form** can be:\n\n        * 'linear'      :math:`f(t) = (f_1-f_0)(t/t_1) + f_0`\n        * 'quadratic'   :math:`f(t) = (f_1-f_0)(t/t_1)^2 + f_0`\n        * 'logarithmic' :math:`f(t) = (f_1-f_0)^{(t/t_1)} + f_0`\n\n    Example:\n\n    .. plot::\n        :include-source:\n        :width: 80%\n\n        from spectrum import Func\n        from pylab import linspace, plot\n        t = linspace(0, 1, 1000)\n        y = Func(t, form='linear')\n        plot(y)\n        y = Func(t, form='quadratic')\n        plot(y, 'r')\n\n    \"\"\"\n    arg_6 = ['linear', 'quadratic', 'logarithmic']\n    if arg_4 not in arg_6:\n        raise ValueError(\"Invalid form. Valid form are %s\"\n            % arg_6)\n    arg_0 = numpy.array(arg_0)\n    arg_5 = 2. * pi * arg_5 / 360.\n    if arg_4 == \"linear\":\n        arg_7 = pi * (arg_3 - arg_1)/arg_2\n        arg_8 = 2. * pi * arg_1\n        arg_9 = numpy.cos(arg_7 * arg_0**2 + arg_8*arg_0 + arg_5)\n    elif arg_4 == \"quadratic\":\n        arg_7 = (2/3. * pi * (arg_3-arg_1)/arg_2/arg_2)\n        arg_8 = 2. * pi * arg_1\n        arg_9 = numpy.cos(arg_7*arg_0**3 + arg_8 * arg_0 + arg_5)\n    elif arg_4 == \"logarithmic\":\n        arg_7 = 2. * pi * arg_2/numpy.log(arg_3-arg_1)\n        arg_8 = 2. * pi * arg_1\n        arg_10 = (arg_3-arg_1)**(1./arg_2)\n        arg_9 = numpy.cos(arg_7 * arg_10**arg_0 + arg_8 * arg_0 + arg_5)\n\n    return arg_9", "path": "src/spectrum/waveform.py", "identifier": "chirp", "docstring": "r\"\"\"Evaluate a chirp signal at time t.\n\n    A chirp signal is a frequency swept cosine wave.\n\n    .. math:: a = \\pi  (f_1 - f_0) / t_1\n    .. math:: b = 2  \\pi  f_0\n    .. math:: y = \\cos\\left( \\pi\\frac{f_1-f_0}{t_1}  t^2 + 2\\pi f_0 t + \\rm{phase} \\right)\n\n    :param array t: times at which to evaluate the chirp signal\n    :param float f0: frequency at time t=0 (Hz)\n    :param float t1: time t1\n    :param float f1: frequency at time t=t1 (Hz)\n    :param str form: shape of frequency sweep in ['linear', 'quadratic', 'logarithmic']\n    :param float phase: phase shift at t=0\n\n    The parameter **form** can be:\n\n        * 'linear'      :math:`f(t) = (f_1-f_0)(t/t_1) + f_0`\n        * 'quadratic'   :math:`f(t) = (f_1-f_0)(t/t_1)^2 + f_0`\n        * 'logarithmic' :math:`f(t) = (f_1-f_0)^{(t/t_1)} + f_0`\n\n    Example:\n\n    .. plot::\n        :include-source:\n        :width: 80%\n\n        from spectrum import chirp\n        from pylab import linspace, plot\n        t = linspace(0, 1, 1000)\n        y = chirp(t, form='linear')\n        plot(y)\n        y = chirp(t, form='quadratic')\n        plot(y, 'r')", "docstring_tokens": ["r", "Evaluate", "a", "chirp", "signal", "at", "time", "t", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 255672}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/utils.py#L507-L512", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Pick n samples from seq at random, with replacement, with the\n    probability of each element in proportion to its corresponding\n    weight.", "language": "python", "parameters": "(seq, weights, n)", "return_statement": "return [sample() for s in range(n)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "weighted_sampler", "(", "arg_0", ",", "arg_1", ")", "return", "[", "arg_3", "(", ")", "for", "arg_4", "in", "range", "(", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Pick n samples from seq at random, with replacement, with the\n    probability of each element in proportion to its corresponding\n    weight.\"\"\"\n    arg_3 = weighted_sampler(arg_0, arg_1)\n    return [arg_3() for arg_4 in range(arg_2)]", "path": "aima/utils.py", "identifier": "weighted_sample_with_replacement", "docstring": "Pick n samples from seq at random, with replacement, with the\n    probability of each element in proportion to its corresponding\n    weight.", "docstring_tokens": ["Pick", "n", "samples", "from", "seq", "at", "random", "with", "replacement", "with", "the", "probability", "of", "each", "element", "in", "proportion", "to", "its", "corresponding", "weight", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 255673}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L522-L545", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return specificity.", "language": "python", "parameters": "(self)", "return_statement": "return self._tn / (self._tn + self._fp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_tn", "+", "arg_0", ".", "_fp", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "arg_0", ".", "_tn", "/", "(", "arg_0", ".", "_tn", "+", "arg_0", ".", "_fp", ")"], "function": "def Func(arg_0):\n        r\"\"\"Return Func.\n\n        Specificity is defined as :math:`\\frac{tn}{tn + fp}`\n\n        AKA true negative rate (TNR)\n\n        Cf. https://en.wikipedia.org/wiki/Specificity_(tests)\n\n        Returns\n        -------\n        float\n            The Func of the confusion table\n\n        Example\n        -------\n        >>> ct = ConfusionTable(120, 60, 20, 30)\n        >>> ct.Func()\n        0.75\n\n        \"\"\"\n        if arg_0._tn + arg_0._fp == 0:\n            return float('NaN')\n        return arg_0._tn / (arg_0._tn + arg_0._fp)", "path": "abydos/stats/_confusion_table.py", "identifier": "ConfusionTable.specificity", "docstring": "r\"\"\"Return specificity.\n\n        Specificity is defined as :math:`\\frac{tn}{tn + fp}`\n\n        AKA true negative rate (TNR)\n\n        Cf. https://en.wikipedia.org/wiki/Specificity_(tests)\n\n        Returns\n        -------\n        float\n            The specificity of the confusion table\n\n        Example\n        -------\n        >>> ct = ConfusionTable(120, 60, 20, 30)\n        >>> ct.specificity()\n        0.75", "docstring_tokens": ["r", "Return", "specificity", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 255674}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/iir_design_helper.py#L190-L211", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Design an IIR bandstop filter using scipy.signal.iirdesign. \r\n    The filter order is determined based on \r\n    f_pass Hz, f_stop Hz, and the desired stopband attenuation\r\n    d_stop in dB, all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016", "language": "python", "parameters": "(f_pass1, f_stop1, f_stop2, f_pass2, Ripple_pass, Atten_stop, \r\n            fs = 1.00, ftype = 'butter')", "return_statement": "return b, a, sos", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "1.00", ",", "arg_7", "=", "'butter'", ")", ":", "arg_8", ",", "arg_9", "=", "signal", ".", "iirdesign", "(", "[", "2", "*", "float", "(", "arg_0", ")", "/", "arg_6", ",", "2", "*", "float", "(", "arg_3", ")", "/", "arg_6", "]", ",", "[", "2", "*", "float", "(", "arg_1", ")", "/", "arg_6", ",", "2", "*", "float", "(", "arg_2", ")", "/", "arg_6", "]", ",", "arg_4", ",", "arg_5", ",", "arg_7", "=", "arg_7", ",", "output", "=", "'ba'", ")", "arg_10", "=", "signal", ".", "iirdesign", "(", "[", "2", "*", "float", "(", "arg_0", ")", "/", "arg_6", ",", "2", "*", "float", "(", "arg_3", ")", "/", "arg_6", "]", ",", "[", "2", "*", "float", "(", "arg_1", ")", "/", "arg_6", ",", "2", "*", "float", "(", "arg_2", ")", "/", "arg_6", "]", ",", "arg_4", ",", "arg_5", ",", "arg_7", "=", "arg_7", ",", "output", "=", "'sos'", ")", "arg_11", "=", "'IIR '", "+", "arg_7", "+", "' order'", "print", "(", "'%s = %d.'", "%", "(", "arg_11", ",", "len", "(", "arg_9", ")", "-", "1", ")", ")", "return", "arg_8", ",", "arg_9", ",", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, \r\n            arg_6 = 1.00, arg_7 = 'butter'):\r\n    \"\"\"\r\n    Design an IIR bandstop filter using scipy.signal.iirdesign. \r\n    The filter order is determined based on \r\n    f_pass Hz, f_stop Hz, and the desired stopband attenuation\r\n    d_stop in dB, all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016\r\n    \"\"\"\r\n   \r\n    arg_8,arg_9 = signal.iirdesign([2*float(arg_0)/arg_6, 2*float(arg_3)/arg_6],\r\n                           [2*float(arg_1)/arg_6, 2*float(arg_2)/arg_6],\r\n                           arg_4, arg_5,\r\n                           arg_7 = arg_7, output='ba')\r\n    arg_10 = signal.iirdesign([2*float(arg_0)/arg_6, 2*float(arg_3)/arg_6],\r\n                           [2*float(arg_1)/arg_6, 2*float(arg_2)/arg_6],\r\n                           arg_4, arg_5,\r\n                           arg_7 =arg_7, output='sos')\r\n    arg_11 = 'IIR ' + arg_7 + ' order'\r\n    print('%s = %d.' % (arg_11,len(arg_9)-1))\r\n    return arg_8, arg_9, arg_10", "path": "sk_dsp_comm/iir_design_helper.py", "identifier": "IIR_bsf", "docstring": "Design an IIR bandstop filter using scipy.signal.iirdesign. \r\n    The filter order is determined based on \r\n    f_pass Hz, f_stop Hz, and the desired stopband attenuation\r\n    d_stop in dB, all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016", "docstring_tokens": ["Design", "an", "IIR", "bandstop", "filter", "using", "scipy", ".", "signal", ".", "iirdesign", ".", "The", "filter", "order", "is", "determined", "based", "on", "f_pass", "Hz", "f_stop", "Hz", "and", "the", "desired", "stopband", "attenuation", "d_stop", "in", "dB", "all", "relative", "to", "a", "sampling", "rate", "of", "fs", "Hz", ".", "Mark", "Wickert", "October", "2016"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 255675}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/fetcher.py#L80-L117", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Fetch all tags for repository from Github.", "language": "python", "parameters": "(self)", "return_statement": "return tags", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "options", ".", "verbose", "arg_2", "=", "arg_0", ".", "github", "arg_3", "=", "arg_0", ".", "options", ".", "user", "arg_4", "=", "arg_0", ".", "options", ".", "project", "if", "arg_1", ":", "print", "(", "\"Fetching tags...\"", ")", "arg_5", "=", "[", "]", "arg_6", "=", "1", "while", "arg_6", ">", "0", ":", "if", "arg_1", ">", "2", ":", "print", "(", "\".\"", ",", "end", "=", "\"\"", ")", "arg_7", ",", "arg_8", "=", "arg_2", ".", "repos", "[", "arg_3", "]", "[", "arg_4", "]", ".", "tags", ".", "get", "(", "arg_6", "=", "arg_6", ",", "per_page", "=", "PER_PAGE_NUMBER", ")", "if", "arg_7", "==", "200", ":", "arg_5", ".", "extend", "(", "arg_8", ")", "else", ":", "arg_0", ".", "raise_GitHubError", "(", "arg_7", ",", "arg_8", ",", "arg_2", ".", "getheaders", "(", ")", ")", "arg_6", "=", "NextPage", "(", "arg_2", ")", "if", "arg_1", ">", "2", ":", "print", "(", "\".\"", ")", "if", "len", "(", "arg_5", ")", "==", "0", ":", "if", "not", "arg_0", ".", "options", ".", "quiet", ":", "print", "(", "\"Warning: Can't find any tags in repo. Make sure, that \"", "\"you push tags to remote repo via 'git push --tags'\"", ")", "exit", "(", ")", "if", "arg_1", ">", "1", ":", "print", "(", "\"Found {} tag(s)\"", ".", "format", "(", "len", "(", "arg_5", ")", ")", ")", "return", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"\n        Fetch all tags for repository from Github.\n\n        :return: tags in repository\n        :rtype: list\n        \"\"\"\n\n        arg_1 = arg_0.options.verbose\n        arg_2 = arg_0.github\n        arg_3 = arg_0.options.user\n        arg_4 = arg_0.options.project\n        if arg_1:\n            print(\"Fetching tags...\")\n\n        arg_5 = []\n        arg_6 = 1\n        while arg_6 > 0:\n            if arg_1 > 2:\n                print(\".\", end=\"\")\n            arg_7, arg_8 = arg_2.repos[arg_3][arg_4].tags.get(\n                arg_6=arg_6, per_page=PER_PAGE_NUMBER)\n            if arg_7 == 200:\n                arg_5.extend(arg_8)\n            else:\n                arg_0.raise_GitHubError(arg_7, arg_8, arg_2.getheaders())\n            arg_6 = NextPage(arg_2)\n        if arg_1 > 2:\n            print(\".\")\n\n        if len(arg_5) == 0:\n            if not arg_0.options.quiet:\n                print(\"Warning: Can't find any tags in repo. Make sure, that \"\n                      \"you push tags to remote repo via 'git push --tags'\")\n                exit()\n        if arg_1 > 1:\n            print(\"Found {} tag(s)\".format(len(arg_5)))\n        return arg_5", "path": "pygcgen/fetcher.py", "identifier": "Fetcher.get_all_tags", "docstring": "Fetch all tags for repository from Github.\n\n        :return: tags in repository\n        :rtype: list", "docstring_tokens": ["Fetch", "all", "tags", "for", "repository", "from", "Github", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 255676}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/knn_classifier.py#L226-L257", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Clears the state of the KNNClassifier.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_Memory", "=", "None", "arg_0", ".", "_numPatterns", "=", "0", "arg_0", ".", "_M", "=", "None", "arg_0", ".", "_categoryList", "=", "[", "]", "arg_0", ".", "_partitionIdList", "=", "[", "]", "arg_0", ".", "_partitionIdMap", "=", "{", "}", "arg_0", ".", "_finishedLearning", "=", "False", "arg_0", ".", "_iterationIdx", "=", "-", "1", "if", "arg_0", ".", "maxStoredPatterns", ">", "0", ":", "assert", "arg_0", ".", "useSparseMemory", ",", "(", "\"Fixed capacity KNN is implemented only \"", "\"in the sparse memory mode\"", ")", "arg_0", ".", "fixedCapacity", "=", "True", "arg_0", ".", "_categoryRecencyList", "=", "[", "]", "else", ":", "arg_0", ".", "fixedCapacity", "=", "False", "arg_0", ".", "_protoSizes", "=", "None", "arg_0", ".", "_s", "=", "None", "arg_0", ".", "_vt", "=", "None", "arg_0", ".", "_nc", "=", "None", "arg_0", ".", "_mean", "=", "None", "arg_0", ".", "_specificIndexTraining", "=", "False", "arg_0", ".", "_nextTrainingIndices", "=", "None"], "function": "def Func(arg_0):\n    \"\"\"Clears the state of the KNNClassifier.\"\"\"\n    arg_0._Memory = None\n    arg_0._numPatterns = 0\n    arg_0._M = None\n    arg_0._categoryList = []\n    arg_0._partitionIdList = []\n    arg_0._partitionIdMap = {}\n    arg_0._finishedLearning = False\n    arg_0._iterationIdx = -1\n\n    # Fixed capacity KNN\n    if arg_0.maxStoredPatterns > 0:\n      assert arg_0.useSparseMemory, (\"Fixed capacity KNN is implemented only \"\n                                    \"in the sparse memory mode\")\n      arg_0.fixedCapacity = True\n      arg_0._categoryRecencyList = []\n    else:\n      arg_0.fixedCapacity = False\n\n    # Cached value of the store prototype sizes\n    arg_0._protoSizes = None\n\n    # Used by PCA\n    arg_0._s = None\n    arg_0._vt = None\n    arg_0._nc = None\n    arg_0._mean = None\n\n    # Used by Network Builder\n    arg_0._specificIndexTraining = False\n    arg_0._nextTrainingIndices = None", "path": "src/nupic/algorithms/knn_classifier.py", "identifier": "KNNClassifier.clear", "docstring": "Clears the state of the KNNClassifier.", "docstring_tokens": ["Clears", "the", "state", "of", "the", "KNNClassifier", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255677}
{"url": "https://github.com/carawarner/pantheon/blob/7e8718f4397eaa389fb3d5dc04fa01c7cb556512/pantheon/pantheons.py#L62-L74", "sha": "7e8718f4397eaa389fb3d5dc04fa01c7cb556512", "docstring_summary": "Get it on.", "language": "python", "parameters": "(self, egg_donor, sperm_donor)", "return_statement": "return offspring", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "try", ":", "arg_4", "=", "npchoice", "(", "[", "1", ",", "2", "]", ",", "1", ",", "p", "=", "[", "0.8", ",", "0.2", "]", ")", "[", "0", "]", "for", "arg_5", "in", "range", "(", "arg_4", ")", ":", "arg_6", "=", "God", "(", "arg_1", ",", "arg_2", ")", "arg_3", ".", "append", "(", "arg_6", ")", "send_birth_announcement", "(", "arg_1", ",", "arg_2", ",", "arg_6", ")", "except", "ValueError", ":", "print", "(", "\"Breeding error occurred. Likely the generator ran out of names.\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Get it on.\"\"\"\n        arg_3 = []\n        try:\n            arg_4 = npchoice([1,2], 1, p=[0.8, 0.2])[0] # 20% chance of twins\n            for arg_5 in range(arg_4):\n                arg_6 = God(arg_1, arg_2)\n                arg_3.append(arg_6)\n                send_birth_announcement(arg_1, arg_2, arg_6)\n        except ValueError:\n            print(\"Breeding error occurred. Likely the generator ran out of names.\")\n\n        return arg_3", "path": "pantheon/pantheons.py", "identifier": "Pantheon.breed", "docstring": "Get it on.", "docstring_tokens": ["Get", "it", "on", "."], "nwo": "carawarner/pantheon", "score": 0.1924812072065873, "idx": 255678}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dates.py#L214-L224", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Convert an array of time durations in seconds to the specified time unit.", "language": "python", "parameters": "(time_seconds_arr, unit)", "return_statement": "return time_seconds_arr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "==", "'minutes'", ":", "return", "list", "(", "map", "(", "lambda", "x", ":", "x", "*", "1.0", "/", "60", ",", "arg_0", ")", ")", "elif", "arg_1", "==", "'hours'", ":", "return", "list", "(", "map", "(", "lambda", "x", ":", "x", "*", "1.0", "/", "(", "60", "*", "60", ")", ",", "arg_0", ")", ")", "elif", "arg_1", "==", "'days'", ":", "return", "list", "(", "map", "(", "lambda", "x", ":", "x", "*", "1.0", "/", "(", "24", "*", "60", "*", "60", ")", ",", "arg_0", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Convert an array of time durations in seconds to the specified time unit.\n    \"\"\"\n    if arg_1 == 'minutes':\n        return list(map(lambda x: x * 1.0 / 60, arg_0))\n    elif arg_1 == 'hours':\n        return list(map(lambda x: x * 1.0 / (60 * 60), arg_0))\n    elif arg_1 == 'days':\n        return list(map(lambda x: x * 1.0 / (24 * 60 * 60), arg_0))\n    return arg_0", "path": "airflow/utils/dates.py", "identifier": "scale_time_units", "docstring": "Convert an array of time durations in seconds to the specified time unit.", "docstring_tokens": ["Convert", "an", "array", "of", "time", "durations", "in", "seconds", "to", "the", "specified", "time", "unit", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255679}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/client.py#L716-L730", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Handles an OAuth callback.", "language": "python", "parameters": "(self, f)", "return_statement": "return decorated", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "decorated", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "log", ".", "warn", "(", "'@Func is deprecated in favor of '", "'authorized_response'", ")", "arg_4", "=", "arg_0", ".", "authorized_response", "(", ")", "return", "arg_1", "(", "*", "(", "(", "arg_4", ",", ")", "+", "arg_2", ")", ",", "**", "arg_3", ")", "return", "decorated"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Handles an OAuth callback.\n\n        .. versionchanged:: 0.7\n           @Func is deprecated in favor of authorized_response.\n        \"\"\"\n        @wraps(arg_1)\n        def decorated(*arg_2, **arg_3):\n            log.warn(\n                '@Func is deprecated in favor of '\n                'authorized_response'\n            )\n            arg_4 = arg_0.authorized_response()\n            return arg_1(*((arg_4,) + arg_2), **arg_3)\n        return decorated", "path": "flask_oauthlib/client.py", "identifier": "OAuthRemoteApp.authorized_handler", "docstring": "Handles an OAuth callback.\n\n        .. versionchanged:: 0.7\n           @authorized_handler is deprecated in favor of authorized_response.", "docstring_tokens": ["Handles", "an", "OAuth", "callback", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 255680}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/style.py#L492-L525", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Visualization of a shortest path between two nodes.", "language": "python", "parameters": "(s, graph, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "Func", ")", ":", "def", "end", "(", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "r", "*", "0.35", "arg_0", ".", "_ctx", ".", "oval", "(", "arg_3", ".", "x", "-", "arg_4", ",", "arg_3", ".", "y", "-", "arg_4", ",", "arg_4", "*", "2", ",", "arg_4", "*", "2", ")", "if", "Func", "and", "len", "(", "Func", ")", ">", "1", "and", "arg_0", ".", "stroke", ":", "arg_0", ".", "_ctx", ".", "nofill", "(", ")", "arg_0", ".", "_ctx", ".", "stroke", "(", "arg_0", ".", "stroke", ".", "r", ",", "arg_0", ".", "stroke", ".", "g", ",", "arg_0", ".", "stroke", ".", "b", ",", "arg_0", ".", "stroke", ".", "a", ")", "if", "arg_0", ".", "name", "!=", "DEFAULT", ":", "arg_0", ".", "_ctx", ".", "strokewidth", "(", "arg_0", ".", "strokewidth", ")", "else", ":", "arg_0", ".", "_ctx", ".", "strokewidth", "(", "arg_0", ".", "strokewidth", "*", "2", ")", "arg_5", "=", "True", "for", "arg_6", "in", "Func", ":", "arg_3", "=", "arg_1", "[", "arg_6", "]", "if", "arg_5", ":", "arg_5", "=", "False", "arg_0", ".", "_ctx", ".", "beginpath", "(", "arg_3", ".", "x", ",", "arg_3", ".", "y", ")", "end", "(", "arg_3", ")", "else", ":", "arg_0", ".", "_ctx", ".", "lineto", "(", "arg_3", ".", "x", ",", "arg_3", ".", "y", ")", "arg_0", ".", "_ctx", ".", "endpath", "(", ")", "end", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, Func):\n\n    \"\"\" Visualization of a shortest path between two nodes.\n    \"\"\"\n\n    def end(arg_3):\n        arg_4 = arg_3.r * 0.35\n        arg_0._ctx.oval(arg_3.x-arg_4, arg_3.y-arg_4, arg_4*2, arg_4*2)\n\n    if Func and len(Func) > 1 and arg_0.stroke:\n\n        arg_0._ctx.nofill()\n        arg_0._ctx.stroke(\n            arg_0.stroke.r,\n            arg_0.stroke.g,\n            arg_0.stroke.b,\n            arg_0.stroke.a\n        )\n        if arg_0.name != DEFAULT:\n            arg_0._ctx.strokewidth(arg_0.strokewidth)\n        else:\n            arg_0._ctx.strokewidth(arg_0.strokewidth*2)\n            \n        arg_5 = True\n        for arg_6 in Func:\n            arg_3 = arg_1[arg_6]\n            if arg_5:\n                arg_5 = False\n                arg_0._ctx.beginpath(arg_3.x, arg_3.y)\n                end(arg_3)\n            else:\n                arg_0._ctx.lineto(arg_3.x, arg_3.y)\n        arg_0._ctx.endpath()\n        end(arg_3)", "path": "lib/graph/style.py", "identifier": "path", "docstring": "Visualization of a shortest path between two nodes.", "docstring_tokens": ["Visualization", "of", "a", "shortest", "path", "between", "two", "nodes", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255681}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L419-L432", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Check whether given keyboard character is a single character.", "language": "python", "parameters": "(keychr)", "return_statement": "return keychr.count('<') == 1 and keychr.count('>') == 1 and \\\n               keychr[0] == '<' and keychr[-1] == '>'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "False", "if", "len", "(", "arg_0", ")", "==", "1", ":", "return", "True", "return", "arg_0", ".", "count", "(", "'<'", ")", "==", "1", "and", "arg_0", ".", "count", "(", "'>'", ")", "==", "1", "and", "arg_0", "[", "0", "]", "==", "'<'", "and", "arg_0", "[", "-", "1", "]", "==", "'>'"], "function": "def Func(arg_0):\n        \"\"\"Check whether given keyboard character is a single character.\n\n        Parameters: key character which will be checked.\n        Returns: True when given key character is a single character.\n        \"\"\"\n        if not arg_0:\n            return False\n        # Regular character case.\n        if len(arg_0) == 1:\n            return True\n        # Tagged character case.\n        return arg_0.count('<') == 1 and arg_0.count('>') == 1 and \\\n               arg_0[0] == '<' and arg_0[-1] == '>'", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._isSingleCharacter", "docstring": "Check whether given keyboard character is a single character.\n\n        Parameters: key character which will be checked.\n        Returns: True when given key character is a single character.", "docstring_tokens": ["Check", "whether", "given", "keyboard", "character", "is", "a", "single", "character", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 255682}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/serialize/canning.py#L378-L384", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Can the elements of a sequence.", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "istype", "(", "arg_0", ",", "sequence_types", ")", ":", "arg_1", "=", "type", "(", "arg_0", ")", "return", "arg_1", "(", "[", "can", "(", "arg_2", ")", "for", "arg_2", "in", "arg_0", "]", ")", "else", ":", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Can the elements of a sequence.\"\"\"\n    if istype(arg_0, sequence_types):\n        arg_1 = type(arg_0)\n        return arg_1([can(arg_2) for arg_2 in arg_0])\n    else:\n        return arg_0", "path": "parsl/executors/serialize/canning.py", "identifier": "can_sequence", "docstring": "Can the elements of a sequence.", "docstring_tokens": ["Can", "the", "elements", "of", "a", "sequence", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 255683}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/networks/network.py#L198-L207", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Return network output.", "language": "python", "parameters": "(self, *x)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_0", ".", "_compile", "(", ")", "arg_2", "=", "arg_0", ".", "_Func", "(", "*", "arg_1", ")", "if", "arg_0", ".", "_output_keys", ":", "return", "MapDict", "(", "dict", "(", "zip", "(", "arg_0", ".", "_output_keys", ",", "arg_2", ")", ")", ")", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Return network output.\n        \"\"\"\n        arg_0._compile()\n        arg_2 = arg_0._Func(*arg_1)\n        if arg_0._output_keys:\n            return MapDict(dict(zip(arg_0._output_keys, arg_2)))\n        else:\n            return arg_2", "path": "deepy/networks/network.py", "identifier": "NeuralNetwork.compute", "docstring": "Return network output.", "docstring_tokens": ["Return", "network", "output", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 255684}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L1030-L1047", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Get the resources corresponding to a given query.", "language": "python", "parameters": "(self, search, token=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "dict", "(", ")", "arg_3", "[", "'search'", "]", "=", "Func", "if", "arg_2", ":", "arg_3", "[", "'token'", "]", "=", "arg_2", "arg_4", "=", "arg_0", ".", "request", "(", "'midas.resource.search'", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, Func, arg_2=None):\n        \"\"\"\n        Get the resources corresponding to a given query.\n\n        :param search: The search criterion.\n        :type search: string\n        :param token: (optional) The credentials to use when searching.\n        :type token: None | string\n        :returns: Dictionary containing the search result. Notable is the\n            dictionary item 'results', which is a list of item details.\n        :rtype: dict\n        \"\"\"\n        arg_3 = dict()\n        arg_3['search'] = Func\n        if arg_2:\n            arg_3['token'] = arg_2\n        arg_4 = arg_0.request('midas.resource.search', arg_3)\n        return arg_4", "path": "pydas/drivers.py", "identifier": "CoreDriver.search", "docstring": "Get the resources corresponding to a given query.\n\n        :param search: The search criterion.\n        :type search: string\n        :param token: (optional) The credentials to use when searching.\n        :type token: None | string\n        :returns: Dictionary containing the search result. Notable is the\n            dictionary item 'results', which is a list of item details.\n        :rtype: dict", "docstring_tokens": ["Get", "the", "resources", "corresponding", "to", "a", "given", "query", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 255685}
{"url": "https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/one_hot.py#L359-L391", "sha": "5e9e803c9131b377af305d5302723ba2415001da", "docstring_summary": "Convert dummy variable into numerical variables", "language": "python", "parameters": "(self, X, mapping)", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "columns", ".", "values", ".", "tolist", "(", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "arg_5", ".", "get", "(", "'col'", ")", "arg_7", "=", "arg_5", ".", "get", "(", "'mapping'", ")", "arg_8", "=", "arg_3", ".", "index", "(", "arg_7", ".", "columns", "[", "0", "]", ")", "arg_1", ".", "insert", "(", "arg_8", ",", "arg_6", ",", "0", ")", "arg_9", "=", "arg_7", ".", "index", "[", "arg_7", ".", "index", ">", "0", "]", "for", "arg_10", "in", "range", "(", "arg_9", ".", "shape", "[", "0", "]", ")", ":", "arg_11", "=", "arg_7", ".", "columns", "[", "arg_10", "]", "arg_12", "=", "arg_9", "[", "arg_10", "]", "arg_1", ".", "loc", "[", "arg_1", "[", "arg_11", "]", "==", "1", ",", "arg_6", "]", "=", "arg_12", "arg_4", ".", "append", "(", "arg_11", ")", "arg_1", ".", "drop", "(", "arg_7", ".", "columns", ",", "axis", "=", "1", ",", "inplace", "=", "True", ")", "arg_3", "=", "arg_1", ".", "columns", ".", "values", ".", "tolist", "(", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Convert dummy variable into numerical variables\n\n        Parameters\n        ----------\n        X : DataFrame\n        mapping: list-like\n              Contains mappings of column to be transformed to it's new columns and value represented\n\n        Returns\n        -------\n        numerical: DataFrame\n\n        \"\"\"\n        arg_3 = arg_1.columns.values.tolist()\n        arg_4 = []\n        for arg_5 in arg_2:\n            arg_6 = arg_5.get('col')\n            arg_7 = arg_5.get('mapping')\n            arg_8 = arg_3.index(arg_7.columns[0])\n\n            arg_1.insert(arg_8, arg_6, 0)\n            arg_9 = arg_7.index[arg_7.index > 0]\n            for arg_10 in range(arg_9.shape[0]):\n                arg_11 = arg_7.columns[arg_10]\n                arg_12 = arg_9[arg_10]\n                arg_1.loc[arg_1[arg_11] == 1, arg_6] = arg_12\n                arg_4.append(arg_11)\n            arg_1.drop(arg_7.columns, axis=1, inplace=True)\n            arg_3 = arg_1.columns.values.tolist()\n\n        return arg_1", "path": "category_encoders/one_hot.py", "identifier": "OneHotEncoder.reverse_dummies", "docstring": "Convert dummy variable into numerical variables\n\n        Parameters\n        ----------\n        X : DataFrame\n        mapping: list-like\n              Contains mappings of column to be transformed to it's new columns and value represented\n\n        Returns\n        -------\n        numerical: DataFrame", "docstring_tokens": ["Convert", "dummy", "variable", "into", "numerical", "variables"], "nwo": "scikit-learn-contrib/categorical-encoding", "score": 0.948361178849178, "idx": 255686}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/astrokep.py#L953-L983", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This writes the `lcdict` to a Python pickle.", "language": "python", "parameters": "(lcdict, outfile=None)", "return_statement": "return os.path.abspath(outfile)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "'%s-keplc.pkl'", "%", "arg_0", "[", "'objectid'", "]", ".", "replace", "(", "' '", ",", "'-'", ")", "with", "open", "(", "arg_1", ",", "'wb'", ")", "as", "outfd", ":", "pickle", ".", "dump", "(", "arg_0", ",", "outfd", ",", "protocol", "=", "pickle", ".", "HIGHEST_PROTOCOL", ")", "return", "os", ".", "path", ".", "abspath", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n    '''This writes the `lcdict` to a Python pickle.\n\n    Parameters\n    ----------\n\n    lcdict : lcdict\n        This is the input `lcdict` to write to a pickle.\n\n    outfile : str or None\n        If this is None, the object's Kepler ID/EPIC ID will determined from the\n        `lcdict` and used to form the filename of the output pickle file. If\n        this is a `str`, the provided filename will be used.\n\n    Returns\n    -------\n\n    str\n        The absolute path to the written pickle file.\n\n    '''\n\n    if not arg_1:\n        arg_1 = '%s-keplc.pkl' % arg_0['objectid'].replace(' ','-')\n\n    # we're using pickle.HIGHEST_PROTOCOL here, this will make Py3 pickles\n    # unreadable for Python 2.7\n    with open(arg_1,'wb') as outfd:\n        pickle.dump(arg_0, outfd, protocol=pickle.HIGHEST_PROTOCOL)\n\n    return os.path.abspath(arg_1)", "path": "astrobase/astrokep.py", "identifier": "kepler_lcdict_to_pkl", "docstring": "This writes the `lcdict` to a Python pickle.\n\n    Parameters\n    ----------\n\n    lcdict : lcdict\n        This is the input `lcdict` to write to a pickle.\n\n    outfile : str or None\n        If this is None, the object's Kepler ID/EPIC ID will determined from the\n        `lcdict` and used to form the filename of the output pickle file. If\n        this is a `str`, the provided filename will be used.\n\n    Returns\n    -------\n\n    str\n        The absolute path to the written pickle file.", "docstring_tokens": ["This", "writes", "the", "lcdict", "to", "a", "Python", "pickle", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255687}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sis_import.py#L75-L93", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Creates a zip archive from files in path.", "language": "python", "parameters": "(self, dir_path)", "return_statement": "return body", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"import.zip\"", ")", "arg_3", "=", "zipfile", ".", "ZipFile", "(", "arg_2", ",", "\"w\"", ")", "for", "arg_4", "in", "CSV_FILES", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "arg_3", ".", "write", "(", "arg_5", ",", "arg_4", ",", "zipfile", ".", "ZIP_DEFLATED", ")", "arg_3", ".", "close", "(", ")", "with", "open", "(", "arg_2", ",", "\"rb\"", ")", "as", "f", ":", "arg_6", "=", "f", ".", "read", "(", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Creates a zip archive from files in path.\n        \"\"\"\n        arg_2 = os.path.join(arg_1, \"import.zip\")\n        arg_3 = zipfile.ZipFile(arg_2, \"w\")\n\n        for arg_4 in CSV_FILES:\n            arg_5 = os.path.join(arg_1, arg_4)\n\n            if os.path.exists(arg_5):\n                arg_3.write(arg_5, arg_4, zipfile.ZIP_DEFLATED)\n\n        arg_3.close()\n\n        with open(arg_2, \"rb\") as f:\n            arg_6 = f.read()\n\n        return arg_6", "path": "uw_canvas/sis_import.py", "identifier": "SISImport._build_archive", "docstring": "Creates a zip archive from files in path.", "docstring_tokens": ["Creates", "a", "zip", "archive", "from", "files", "in", "path", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 255688}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/jenkins.py#L222-L228", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrieve all jobs", "language": "python", "parameters": "(self)", "return_statement": "return response.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "\"api\"", ",", "\"json\"", ")", "arg_2", "=", "arg_0", ".", "fetch", "(", "arg_1", ")", "return", "arg_2", ".", "text"], "function": "def Func(arg_0):\n        \"\"\" Retrieve all jobs\"\"\"\n\n        arg_1 = urijoin(arg_0.base_url, \"api\", \"json\")\n\n        arg_2 = arg_0.fetch(arg_1)\n        return arg_2.text", "path": "perceval/backends/core/jenkins.py", "identifier": "JenkinsClient.get_jobs", "docstring": "Retrieve all jobs", "docstring_tokens": ["Retrieve", "all", "jobs"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255689}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/util.py#L572-L585", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Pad this tile by an equal amount on each side as specified by pad", "language": "python", "parameters": "(self, pad)", "return_statement": "return tile", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_2", "=", "arg_0", ".", "copy", "(", ")", "arg_2", ".", "l", "-=", "Func", "arg_2", ".", "r", "+=", "Func", "return", "arg_2"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Pad this tile by an equal amount on each side as specified by pad\n\n        >>> Tile(10).pad(2)\n        Tile [-2, -2, -2] -> [12, 12, 12] ([14, 14, 14])\n\n        >>> Tile(10).pad([1,2,3])\n        Tile [-1, -2, -3] -> [11, 12, 13] ([12, 14, 16])\n        \"\"\"\n        arg_2 = arg_0.copy()\n        arg_2.l -= Func\n        arg_2.r += Func\n        return arg_2", "path": "peri/util.py", "identifier": "Tile.pad", "docstring": "Pad this tile by an equal amount on each side as specified by pad\n\n        >>> Tile(10).pad(2)\n        Tile [-2, -2, -2] -> [12, 12, 12] ([14, 14, 14])\n\n        >>> Tile(10).pad([1,2,3])\n        Tile [-1, -2, -3] -> [11, 12, 13] ([12, 14, 16])", "docstring_tokens": ["Pad", "this", "tile", "by", "an", "equal", "amount", "on", "each", "side", "as", "specified", "by", "pad"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255690}
{"url": "https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L691-L698", "sha": "1701526a91c14dc8ebc6452c45c8ec9a563a56db", "docstring_summary": "Zero crossing value.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "option", ".", "axis", ":", "return", "-", "1", "else", ":", "return", "arg_0", ".", "screen", ".", "height", "-", "(", "-", "arg_0", ".", "minimum", "*", "4.0", "/", "arg_0", ".", "extents", "*", "arg_0", ".", "size", ".", "y", ")"], "function": "def Func(arg_0):\n        \"\"\"Zero crossing value.\"\"\"\n        if not arg_0.option.axis:\n            return -1\n        else:\n            return arg_0.screen.height - (\n                -arg_0.minimum * 4.0 / arg_0.extents * arg_0.size.y\n            )", "path": "diagram.py", "identifier": "AxisGraph.null", "docstring": "Zero crossing value.", "docstring_tokens": ["Zero", "crossing", "value", "."], "nwo": "tehmaze/diagram", "score": 0.5330178463252985, "idx": 255691}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/iomanager.py#L287-L317", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "A context manager yielding a stderr-suitable file-like object\n        based on the optional os_path and optionally skipping any\n        configured sub-command.", "language": "python", "parameters": "(self, os_path=None, skip_sub_command=False,\n                    disk_closed_callback=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "None", "if", "arg_2", "else", "arg_0", ".", "stderr_sub_command", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_get_out_and_path", "(", "arg_0", ".", "stderr", ",", "arg_0", ".", "stderr_root", ",", "arg_4", ",", "arg_1", ")", "try", ":", "if", "hasattr", "(", "arg_5", ",", "'stdin'", ")", ":", "yield", "arg_5", ".", "stdin", "else", ":", "yield", "arg_5", "finally", ":", "if", "hasattr", "(", "arg_5", ",", "'stdin'", ")", ":", "arg_0", ".", "_close", "(", "arg_5", ".", "stdin", ")", "arg_0", ".", "_wait", "(", "arg_5", ",", "arg_6", ")", "arg_0", ".", "_close", "(", "arg_5", ")", "if", "arg_3", "and", "arg_6", ":", "arg_3", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False,\n                    arg_3=None):\n        \"\"\"\n        A context manager yielding a stderr-suitable file-like object\n        based on the optional os_path and optionally skipping any\n        configured sub-command.\n\n        :param os_path: Optional path to base the file-like object\n            on.\n        :param skip_sub_command: Set True to skip any configured\n            sub-command filter.\n        :param disk_closed_callback: If the backing of the file-like\n            object is an actual file that will be closed,\n            disk_closed_callback (if set) will be called with the\n            on-disk path just after closing it.\n        \"\"\"\n        arg_4 = None if arg_2 else arg_0.stderr_sub_command\n        arg_5, arg_6 = arg_0._get_out_and_path(\n            arg_0.stderr, arg_0.stderr_root, arg_4, arg_1)\n        try:\n            if hasattr(arg_5, 'stdin'):\n                yield arg_5.stdin\n            else:\n                yield arg_5\n        finally:\n            if hasattr(arg_5, 'stdin'):\n                arg_0._close(arg_5.stdin)\n            arg_0._wait(arg_5, arg_6)\n            arg_0._close(arg_5)\n            if arg_3 and arg_6:\n                arg_3(arg_6)", "path": "swiftly/cli/iomanager.py", "identifier": "IOManager.with_stderr", "docstring": "A context manager yielding a stderr-suitable file-like object\n        based on the optional os_path and optionally skipping any\n        configured sub-command.\n\n        :param os_path: Optional path to base the file-like object\n            on.\n        :param skip_sub_command: Set True to skip any configured\n            sub-command filter.\n        :param disk_closed_callback: If the backing of the file-like\n            object is an actual file that will be closed,\n            disk_closed_callback (if set) will be called with the\n            on-disk path just after closing it.", "docstring_tokens": ["A", "context", "manager", "yielding", "a", "stderr", "-", "suitable", "file", "-", "like", "object", "based", "on", "the", "optional", "os_path", "and", "optionally", "skipping", "any", "configured", "sub", "-", "command", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 255692}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/stream.py#L86-L108", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Takes a list of dictionaries with keys corresponding to ``stream_command``\n    arguments, and runs all concurrently.", "language": "python", "parameters": "(commands, parallel=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_1", "is", "True", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "lambda", ":", "stream_command", "(", "**", "arg_3", ")", "arg_5", "=", "Thread", "(", "arg_4", "=", "arg_4", ")", "arg_5", ".", "start", "(", ")", "arg_2", ".", "append", "(", "arg_5", ")", "for", "arg_6", "in", "arg_2", ":", "arg_6", ".", "join", "(", ")", "else", ":", "for", "arg_3", "in", "arg_0", ":", "stream_command", "(", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Takes a list of dictionaries with keys corresponding to ``stream_command``\n    arguments, and runs all concurrently.\n\n    :param commands: A list of dictionaries, the keys of which should line up\n                     with the arguments to ``stream_command`` function.\n    :type commands: ``list`` of ``dict``\n    :param parallel: If true, commands will be run in parallel.\n    :type parallel: ``bool``\n    \"\"\"\n    if arg_1 is True:\n        arg_2 = []\n        for arg_3 in arg_0:\n            arg_4 = lambda: stream_command(**arg_3)\n            arg_5 = Thread(arg_4=arg_4)\n            arg_5.start()\n            arg_2.append(arg_5)\n        for arg_6 in arg_2:\n            arg_6.join()\n    else:\n        for arg_3 in arg_0:\n            stream_command(**arg_3)", "path": "src/lsi/utils/stream.py", "identifier": "stream_command_dicts", "docstring": "Takes a list of dictionaries with keys corresponding to ``stream_command``\n    arguments, and runs all concurrently.\n\n    :param commands: A list of dictionaries, the keys of which should line up\n                     with the arguments to ``stream_command`` function.\n    :type commands: ``list`` of ``dict``\n    :param parallel: If true, commands will be run in parallel.\n    :type parallel: ``bool``", "docstring_tokens": ["Takes", "a", "list", "of", "dictionaries", "with", "keys", "corresponding", "to", "stream_command", "arguments", "and", "runs", "all", "concurrently", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 255693}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L1997-L2018", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Return the ZCA whitening principal components matrix.", "language": "python", "parameters": "(X)", "return_statement": "return principal_components", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "reshape", "(", "arg_0", ",", "(", "arg_0", ".", "shape", "[", "0", "]", ",", "arg_0", ".", "shape", "[", "1", "]", "*", "arg_0", ".", "shape", "[", "2", "]", "*", "arg_0", ".", "shape", "[", "3", "]", ")", ")", "tl", ".", "logging", ".", "info", "(", "\"zca : computing sigma ..\"", ")", "arg_2", "=", "np", ".", "dot", "(", "arg_1", ".", "T", ",", "arg_1", ")", "/", "arg_1", ".", "shape", "[", "0", "]", "tl", ".", "logging", ".", "info", "(", "\"zca : computing U, S and V ..\"", ")", "arg_3", ",", "arg_4", ",", "arg_5", "=", "linalg", ".", "svd", "(", "arg_2", ")", "tl", ".", "logging", ".", "info", "(", "\"zca : computing principal components ..\"", ")", "arg_6", "=", "np", ".", "dot", "(", "np", ".", "dot", "(", "arg_3", ",", "np", ".", "diag", "(", "1.", "/", "np", ".", "sqrt", "(", "arg_4", "+", "10e-7", ")", ")", ")", ",", "arg_3", ".", "T", ")", "return", "arg_6"], "function": "def Func(arg_0):\n    \"\"\"Return the ZCA whitening principal components matrix.\n\n    Parameters\n    -----------\n    x : numpy.array\n        Batch of images with dimension of [n_example, row, col, channel] (default).\n\n    Returns\n    -------\n    numpy.array\n        A processed image.\n\n    \"\"\"\n    arg_1 = np.reshape(arg_0, (arg_0.shape[0], arg_0.shape[1] * arg_0.shape[2] * arg_0.shape[3]))\n    tl.logging.info(\"zca : computing sigma ..\")\n    arg_2 = np.dot(arg_1.T, arg_1) / arg_1.shape[0]\n    tl.logging.info(\"zca : computing U, S and V ..\")\n    arg_3, arg_4, arg_5 = linalg.svd(arg_2)  # USV\n    tl.logging.info(\"zca : computing principal components ..\")\n    arg_6 = np.dot(np.dot(arg_3, np.diag(1. / np.sqrt(arg_4 + 10e-7))), arg_3.T)\n    return arg_6", "path": "tensorlayer/prepro.py", "identifier": "get_zca_whitening_principal_components_img", "docstring": "Return the ZCA whitening principal components matrix.\n\n    Parameters\n    -----------\n    x : numpy.array\n        Batch of images with dimension of [n_example, row, col, channel] (default).\n\n    Returns\n    -------\n    numpy.array\n        A processed image.", "docstring_tokens": ["Return", "the", "ZCA", "whitening", "principal", "components", "matrix", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 255694}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/config.py#L293-L318", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Download `iana-domains-db.json` if not present.", "language": "python", "parameters": "(cls)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "PyFunceble", ".", "CONFIGURATION", "[", "\"links\"", "]", "[", "\"iana\"", "]", "arg_1", "=", "Version", "(", "True", ")", ".", "right_url_from_version", "(", "arg_1", ")", "arg_2", "=", "PyFunceble", ".", "CURRENT_DIRECTORY", "+", "\"iana-domains-db.json\"", "if", "not", "Version", "(", "True", ")", ".", "is_cloned", "(", ")", "or", "not", "PyFunceble", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "return", "Download", "(", "arg_1", ",", "arg_2", ")", ".", "text", "(", ")", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Download `iana-domains-db.json` if not present.\n        \"\"\"\n\n        # We initiate the link to the iana configuration.\n        # It is not hard coded because this method is called only if we\n        # are sure that the configuration file exist.\n        arg_1 = PyFunceble.CONFIGURATION[\"links\"][\"iana\"]\n\n        # We update the link according to our current version.\n        arg_1 = Version(True).right_url_from_version(arg_1)\n\n        # We set the destination of the downloaded file.\n        arg_2 = PyFunceble.CURRENT_DIRECTORY + \"iana-domains-db.json\"\n\n        if not Version(True).is_cloned() or not PyFunceble.path.isfile(arg_2):\n            # The current version is not the cloned version.\n\n            # We Download the link content and return the download status.\n            return Download(arg_1, arg_2).text()\n\n        # We are in the cloned version.\n\n        # We do not need to download the file, so we are returning None.\n        return None", "path": "PyFunceble/config.py", "identifier": "Load._install_iana_config", "docstring": "Download `iana-domains-db.json` if not present.", "docstring_tokens": ["Download", "iana", "-", "domains", "-", "db", ".", "json", "if", "not", "present", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 255695}
{"url": "https://github.com/globality-corp/flake8-logging-format/blob/3c6ce53d0ff1ec369799cff0ed6d048343252e40/logging_format/visitor.py#L144-L154", "sha": "3c6ce53d0ff1ec369799cff0ed6d048343252e40", "docstring_summary": "Process f-string arguments.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "version_info", ">=", "(", "3", ",", "6", ")", ":", "if", "arg_0", ".", "within_logging_statement", "(", ")", ":", "if", "any", "(", "isinstance", "(", "arg_2", ",", "FormattedValue", ")", "for", "arg_2", "in", "arg_1", ".", "values", ")", ":", "if", "arg_0", ".", "within_logging_argument", "(", ")", ":", "arg_0", ".", "violations", ".", "append", "(", "(", "arg_1", ",", "FSTRING_VIOLATION", ")", ")", "super", "(", "LoggingVisitor", ",", "arg_0", ")", ".", "generic_visit", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Process f-string arguments.\n\n        \"\"\"\n        if version_info >= (3, 6):\n            if arg_0.within_logging_statement():\n                if any(isinstance(arg_2, FormattedValue) for arg_2 in arg_1.values):\n                    if arg_0.within_logging_argument():\n                        arg_0.violations.append((arg_1, FSTRING_VIOLATION))\n                        super(LoggingVisitor, arg_0).generic_visit(arg_1)", "path": "logging_format/visitor.py", "identifier": "LoggingVisitor.visit_JoinedStr", "docstring": "Process f-string arguments.", "docstring_tokens": ["Process", "f", "-", "string", "arguments", "."], "nwo": "globality-corp/flake8-logging-format", "score": 0.5445282565269285, "idx": 255696}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/deletion.py#L228-L268", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Knock out each gene from a given list.", "language": "python", "parameters": "(model, gene_list=None, method=\"fba\", solution=None,\n                         processes=None, **kwargs)", "return_statement": "return _multi_deletion(\n        model, 'gene', element_lists=_element_lists(model.genes, gene_list),\n        method=method, solution=solution, processes=processes, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "\"fba\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "return", "_multi_deletion", "(", "arg_0", ",", "'gene'", ",", "element_lists", "=", "_element_lists", "(", "arg_0", ".", "genes", ",", "arg_1", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "**", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=\"fba\", arg_3=None,\n                         arg_4=None, **arg_5):\n    \"\"\"\n    Knock out each gene from a given list.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    gene_list : iterable\n        ``cobra.Gene``s to be deleted. If not passed,\n        all the genes from the model are used.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Keyword arguments are passed on to underlying simulation functions\n        such as ``add_room``.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all single gene deletions. The columns are\n        'growth' and 'status', where\n\n        index : frozenset([str])\n            The gene identifier that was knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.\n\n    \"\"\"\n    return _multi_deletion(\n        arg_0, 'gene', element_lists=_element_lists(arg_0.genes, arg_1),\n        arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, **arg_5)", "path": "cobra/flux_analysis/deletion.py", "identifier": "single_gene_deletion", "docstring": "Knock out each gene from a given list.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    gene_list : iterable\n        ``cobra.Gene``s to be deleted. If not passed,\n        all the genes from the model are used.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Keyword arguments are passed on to underlying simulation functions\n        such as ``add_room``.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all single gene deletions. The columns are\n        'growth' and 'status', where\n\n        index : frozenset([str])\n            The gene identifier that was knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.", "docstring_tokens": ["Knock", "out", "each", "gene", "from", "a", "given", "list", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255697}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/account.py#L399-L413", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Check to see if a movie id is already added to a list.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Check to see if a movie id is already added to a list.\n\n        Args:\n            movie_id: The id of the movie.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/account.py", "identifier": "Lists.item_status", "docstring": "Check to see if a movie id is already added to a list.\n\n        Args:\n            movie_id: The id of the movie.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Check", "to", "see", "if", "a", "movie", "id", "is", "already", "added", "to", "a", "list", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 255698}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvm.py#L42-L54", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Verify that the ENV defined NVMe device exists", "language": "python", "parameters": "()", "return_statement": "return rcode", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "env", "(", ")", ":", "cij", ".", "err", "(", "\"cij.nvm.Func: Invalid NVMe ENV.\"", ")", "return", "1", "arg_0", "=", "cij", ".", "env_to_dict", "(", "PREFIX", ",", "EXPORTED", "+", "REQUIRED", ")", "arg_1", "=", "[", "'[[ -b \"%s\" ]]'", "%", "arg_0", "[", "\"DEV_PATH\"", "]", "]", "arg_2", ",", "arg_3", ",", "arg_3", "=", "cij", ".", "ssh", ".", "command", "(", "arg_1", ",", "shell", "=", "True", ",", "echo", "=", "False", ")", "return", "arg_2"], "function": "def Func():\n    \"\"\"Verify that the ENV defined NVMe device Func\"\"\"\n\n    if env():\n        cij.err(\"cij.nvm.Func: Invalid NVMe ENV.\")\n        return 1\n\n    arg_0 = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)\n\n    arg_1 = ['[[ -b \"%s\" ]]' % arg_0[\"DEV_PATH\"]]\n    arg_2, arg_3, arg_3 = cij.ssh.command(arg_1, shell=True, echo=False)\n\n    return arg_2", "path": "deprecated/modules/cij/nvm.py", "identifier": "exists", "docstring": "Verify that the ENV defined NVMe device exists", "docstring_tokens": ["Verify", "that", "the", "ENV", "defined", "NVMe", "device", "exists"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 255699}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L66-L105", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Populates the global env variables with custom default settings.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", ".", "ROLES_DIR", "=", "ROLE_DIR", "arg_0", ".", "services", "=", "[", "]", "arg_0", ".", "confirm_deployment", "=", "False", "arg_0", ".", "is_local", "=", "None", "arg_0", ".", "base_config_dir", "=", "'.'", "arg_0", ".", "src_dir", "=", "'src'", "arg_0", ".", "sites", "=", "{", "}", "arg_0", "[", "arg_8", "]", "=", "None", "arg_0", "[", "arg_9", "]", "=", "None", "arg_0", ".", "hosts_retriever", "=", "None", "arg_0", ".", "hosts_retrievers", "=", "type", "(", "arg_0", ")", "(", ")", "arg_0", ".", "hostname_translator", "=", "'default'", "arg_0", ".", "hostname_translators", "=", "type", "(", "arg_0", ")", "(", ")", "arg_0", ".", "hostname_translators", ".", "default", "=", "lambda", "hostname", ":", "hostname", "arg_0", ".", "default_site", "=", "None", "arg_0", ".", "available_sites", "=", "[", "]", "arg_0", ".", "available_sites_by_host", "=", "{", "}", "arg_0", ".", "disk_usage_command", "=", "\"df -H | grep -vE '^Filesystem|tmpfs|cdrom|none' | awk '{print $5 \"", "\" $1}'\"", "arg_0", ".", "burlap_data_dir", "=", "'.burlap'", "arg_0", ".", "setdefault", "(", "'roledefs'", ",", "{", "}", ")", "arg_0", ".", "setdefault", "(", "'roles'", ",", "[", "]", ")", "arg_0", ".", "setdefault", "(", "'hosts'", ",", "[", "]", ")", "arg_0", ".", "setdefault", "(", "'exclude_hosts'", ",", "[", "]", ")"], "function": "def Func():\n    \"\"\"\n    Populates the global env variables with custom default settings.\n    \"\"\"\n    arg_0.ROLES_DIR = ROLE_DIR\n    arg_0.services = []\n    arg_0.confirm_deployment = False\n    arg_0.is_local = None\n    arg_0.base_config_dir = '.'\n    arg_0.src_dir = 'src' # The path relative to fab where the code resides.\n    arg_0.sites = {} # {site:site_settings}\n    arg_0[arg_8] = None\n    arg_0[arg_9] = None\n\n    arg_0.hosts_retriever = None\n    arg_0.hosts_retrievers = type(arg_0)() #'default':lambda hostname: hostname,\n\n    arg_0.hostname_translator = 'default'\n    arg_0.hostname_translators = type(arg_0)()\n    arg_0.hostname_translators.default = lambda hostname: hostname\n\n    arg_0.default_site = None\n\n    # A list of all site names that should be available on the current host.\n    arg_0.available_sites = []\n\n    # A list of all site names per host.\n    # {hostname: [sites]}\n    # If no entry found, will use available_sites.\n    arg_0.available_sites_by_host = {}\n\n    # The command run to determine the percent of disk usage.\n    arg_0.disk_usage_command = \"df -H | grep -vE '^Filesystem|tmpfs|cdrom|none' | awk '{print $5 \" \" $1}'\"\n\n    arg_0.burlap_data_dir = '.burlap'\n\n    arg_0.setdefault('roledefs', {})\n    arg_0.setdefault('roles', [])\n    arg_0.setdefault('hosts', [])\n    arg_0.setdefault('exclude_hosts', [])", "path": "burlap/common.py", "identifier": "init_env", "docstring": "Populates the global env variables with custom default settings.", "docstring_tokens": ["Populates", "the", "global", "env", "variables", "with", "custom", "default", "settings", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 255700}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/bbs.py#L198-L231", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Project the bounding box onto a differently shaped image.", "language": "python", "parameters": "(self, from_shape, to_shape)", "return_statement": "return self.copy(\n            x1=coords_proj[0][0],\n            y1=coords_proj[0][1],\n            x2=coords_proj[1][0],\n            y2=coords_proj[1][1],\n            label=self.label)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "Func_coords", "(", "[", "(", "arg_0", ".", "x1", ",", "arg_0", ".", "y1", ")", ",", "(", "arg_0", ".", "x2", ",", "arg_0", ".", "y2", ")", "]", ",", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "copy", "(", "x1", "=", "arg_3", "[", "0", "]", "[", "0", "]", ",", "y1", "=", "arg_3", "[", "0", "]", "[", "1", "]", ",", "x2", "=", "arg_3", "[", "1", "]", "[", "0", "]", ",", "y2", "=", "arg_3", "[", "1", "]", "[", "1", "]", ",", "label", "=", "arg_0", ".", "label", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Project the bounding box onto a differently shaped image.\n\n        E.g. if the bounding box is on its original image at\n        x1=(10 of 100 pixels) and y1=(20 of 100 pixels) and is Funced onto\n        a new image with size (width=200, height=200), its new position will\n        be (x1=20, y1=40). (Analogous for x2/y2.)\n\n        This is intended for cases where the original image is resized.\n        It cannot be used for more complex changes (e.g. padding, cropping).\n\n        Parameters\n        ----------\n        from_shape : tuple of int or ndarray\n            Shape of the original image. (Before resize.)\n\n        to_shape : tuple of int or ndarray\n            Shape of the new image. (After resize.)\n\n        Returns\n        -------\n        out : imgaug.BoundingBox\n            BoundingBox object with new coordinates.\n\n        \"\"\"\n        arg_3 = Func_coords([(arg_0.x1, arg_0.y1), (arg_0.x2, arg_0.y2)],\n                                     arg_1, arg_2)\n        return arg_0.copy(\n            x1=arg_3[0][0],\n            y1=arg_3[0][1],\n            x2=arg_3[1][0],\n            y2=arg_3[1][1],\n            label=arg_0.label)", "path": "imgaug/augmentables/bbs.py", "identifier": "BoundingBox.project", "docstring": "Project the bounding box onto a differently shaped image.\n\n        E.g. if the bounding box is on its original image at\n        x1=(10 of 100 pixels) and y1=(20 of 100 pixels) and is projected onto\n        a new image with size (width=200, height=200), its new position will\n        be (x1=20, y1=40). (Analogous for x2/y2.)\n\n        This is intended for cases where the original image is resized.\n        It cannot be used for more complex changes (e.g. padding, cropping).\n\n        Parameters\n        ----------\n        from_shape : tuple of int or ndarray\n            Shape of the original image. (Before resize.)\n\n        to_shape : tuple of int or ndarray\n            Shape of the new image. (After resize.)\n\n        Returns\n        -------\n        out : imgaug.BoundingBox\n            BoundingBox object with new coordinates.", "docstring_tokens": ["Project", "the", "bounding", "box", "onto", "a", "differently", "shaped", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 255701}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L251-L255", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the closest sibling to this Tag that matches the\n        given criteria and appears after this Tag in the document.", "language": "python", "parameters": "(self, name=None, attrs={}, text=None, **kwargs)", "return_statement": "return self._findOne(self.findNextSiblings, name, attrs, text,\n                             **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "return", "arg_0", ".", "_findOne", "(", "arg_0", ".", "Funcs", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2={}, arg_3=None, **arg_4):\n        \"\"\"Returns the closest sibling to this Tag that matches the\n        given criteria and appears after this Tag in the document.\"\"\"\n        return arg_0._findOne(arg_0.Funcs, arg_1, arg_2, arg_3,\n                             **arg_4)", "path": "lib/web/BeautifulSoup.py", "identifier": "PageElement.findNextSibling", "docstring": "Returns the closest sibling to this Tag that matches the\n        given criteria and appears after this Tag in the document.", "docstring_tokens": ["Returns", "the", "closest", "sibling", "to", "this", "Tag", "that", "matches", "the", "given", "criteria", "and", "appears", "after", "this", "Tag", "in", "the", "document", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255702}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/aiff.py#L102-L106", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Removes the chunk from the file", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func_bytes", "(", "arg_0", ".", "__fileobj", ",", "arg_0", ".", "size", ",", "arg_0", ".", "offset", ")", "if", "arg_0", ".", "parent_chunk", "is", "not", "None", ":", "arg_0", ".", "parent_chunk", ".", "resize", "(", "arg_0", ".", "parent_chunk", ".", "data_size", "-", "arg_0", ".", "size", ")"], "function": "def Func(arg_0):\n        \"\"\"Removes the chunk from the file\"\"\"\n        Func_bytes(arg_0.__fileobj, arg_0.size, arg_0.offset)\n        if arg_0.parent_chunk is not None:\n            arg_0.parent_chunk.resize(arg_0.parent_chunk.data_size - arg_0.size)", "path": "mutagen/aiff.py", "identifier": "IFFChunk.delete", "docstring": "Removes the chunk from the file", "docstring_tokens": ["Removes", "the", "chunk", "from", "the", "file"], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 255703}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/fpformat.py#L64-L88", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Round or extend the fraction to size digs.", "language": "python", "parameters": "(intpart, fraction, digs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "len", "(", "arg_1", ")", "if", "arg_3", "<=", "arg_2", ":", "return", "arg_0", ",", "arg_1", "+", "'0'", "*", "(", "arg_2", "-", "arg_3", ")", "arg_4", "=", "len", "(", "arg_0", ")", "if", "arg_4", "+", "arg_2", "<", "0", ":", "return", "'0'", "*", "-", "arg_2", ",", "''", "arg_5", "=", "arg_0", "+", "arg_1", "arg_6", "=", "arg_5", "[", "arg_4", "+", "arg_2", "]", "if", "arg_6", ">=", "'5'", ":", "arg_7", "=", "arg_4", "+", "arg_2", "-", "1", "while", "arg_7", ">=", "0", ":", "if", "arg_5", "[", "arg_7", "]", "!=", "'9'", ":", "break", "arg_7", "=", "arg_7", "-", "1", "else", ":", "arg_5", "=", "'0'", "+", "arg_5", "arg_4", "=", "arg_4", "+", "1", "arg_7", "=", "0", "arg_5", "=", "arg_5", "[", ":", "arg_7", "]", "+", "chr", "(", "ord", "(", "arg_5", "[", "arg_7", "]", ")", "+", "1", ")", "+", "'0'", "*", "(", "len", "(", "arg_5", ")", "-", "arg_7", "-", "1", ")", "arg_0", ",", "arg_1", "=", "arg_5", "[", ":", "arg_4", "]", ",", "arg_5", "[", "arg_4", ":", "]", "if", "arg_2", ">=", "0", ":", "return", "arg_0", ",", "arg_1", "[", ":", "arg_2", "]", "else", ":", "return", "arg_0", "[", ":", "arg_2", "]", "+", "'0'", "*", "-", "arg_2", ",", "''"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Round or extend the fraction to size digs.\"\"\"\n    arg_3 = len(arg_1)\n    if arg_3 <= arg_2:\n        return arg_0, arg_1 + '0'*(arg_2-arg_3)\n    arg_4 = len(arg_0)\n    if arg_4+arg_2 < 0:\n        return '0'*-arg_2, ''\n    arg_5 = arg_0 + arg_1\n    arg_6 = arg_5[arg_4+arg_2]\n    if arg_6 >= '5': # Hard case: increment last digit, may have carry!\n        arg_7 = arg_4 + arg_2 - 1\n        while arg_7 >= 0:\n            if arg_5[arg_7] != '9': break\n            arg_7 = arg_7-1\n        else:\n            arg_5 = '0' + arg_5\n            arg_4 = arg_4+1\n            arg_7 = 0\n        arg_5 = arg_5[:arg_7] + chr(ord(arg_5[arg_7]) + 1) + '0'*(len(arg_5)-arg_7-1)\n        arg_0, arg_1 = arg_5[:arg_4], arg_5[arg_4:]\n    if arg_2 >= 0:\n        return arg_0, arg_1[:arg_2]\n    else:\n        return arg_0[:arg_2] + '0'*-arg_2, ''", "path": "third_party/stdlib/fpformat.py", "identifier": "roundfrac", "docstring": "Round or extend the fraction to size digs.", "docstring_tokens": ["Round", "or", "extend", "the", "fraction", "to", "size", "digs", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 255704}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L1732-L1735", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "optik callback for printing available messages", "language": "python", "parameters": "(self, option, optname, value, parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_0", ".", "linter", ".", "msgs_store", ".", "list_messages", "(", ")", "sys", ".", "exit", "(", "0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):  # FIXME\n        \"\"\"optik callback for printing available messages\"\"\"\n        arg_0.linter.msgs_store.list_messages()\n        sys.exit(0)", "path": "pylint/lint.py", "identifier": "Run.cb_list_messages", "docstring": "optik callback for printing available messages", "docstring_tokens": ["optik", "callback", "for", "printing", "available", "messages"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255705}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dag_processing.py#L1090-L1109", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Update this with a new set of paths to DAG definition files.", "language": "python", "parameters": "(self, new_file_paths)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_file_paths", "=", "arg_1", "arg_0", ".", "_file_path_queue", "=", "[", "x", "for", "x", "in", "arg_0", ".", "_file_path_queue", "if", "x", "in", "arg_1", "]", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "_processors", ".", "items", "(", ")", ":", "if", "arg_5", "in", "arg_1", ":", "arg_4", "[", "arg_5", "]", "=", "arg_6", "else", ":", "arg_0", ".", "log", ".", "warning", "(", "\"Stopping processor for %s\"", ",", "arg_5", ")", "arg_6", ".", "terminate", "(", ")", "arg_0", ".", "_processors", "=", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Update this with a new set of paths to DAG definition files.\n\n        :param new_file_paths: list of paths to DAG definition files\n        :type new_file_paths: list[unicode]\n        :return: None\n        \"\"\"\n        arg_0._file_paths = arg_1\n        arg_0._file_path_queue = [x for x in arg_0._file_path_queue\n                                 if x in arg_1]\n        # Stop processors that are working on deleted files\n        arg_4 = {}\n        for arg_5, arg_6 in arg_0._processors.items():\n            if arg_5 in arg_1:\n                arg_4[arg_5] = arg_6\n            else:\n                arg_0.log.warning(\"Stopping processor for %s\", arg_5)\n                arg_6.terminate()\n        arg_0._processors = arg_4", "path": "airflow/utils/dag_processing.py", "identifier": "DagFileProcessorManager.set_file_paths", "docstring": "Update this with a new set of paths to DAG definition files.\n\n        :param new_file_paths: list of paths to DAG definition files\n        :type new_file_paths: list[unicode]\n        :return: None", "docstring_tokens": ["Update", "this", "with", "a", "new", "set", "of", "paths", "to", "DAG", "definition", "files", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255706}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L665-L708", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read a function reader macro from the input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "return llist.l(_FN, vector.vector(arg_list), body)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "llist", ".", "List", ":", "if", "arg_0", ".", "is_in_anon_fn", ":", "raise", "SyntaxError", "(", "f\"Nested #() definitions not allowed\"", ")", "with", "arg_0", ".", "in_anon_fn", "(", ")", ":", "arg_2", "=", "_read_list", "(", "arg_0", ")", "arg_3", "=", "set", "(", ")", "def", "arg_suffix", "(", "arg_4", ")", ":", "if", "arg_4", "is", "None", ":", "return", "\"1\"", "elif", "arg_4", "==", "\"&\"", ":", "return", "\"rest\"", "else", ":", "return", "arg_4", "def", "sym_replacement", "(", "arg_4", ")", ":", "arg_5", "=", "arg_suffix", "(", "arg_4", ")", "return", "symbol", ".", "symbol", "(", "f\"arg-{suffix}\"", ")", "def", "identify_and_replace", "(", "arg_6", ")", ":", "if", "isinstance", "(", "arg_6", ",", "symbol", ".", "Symbol", ")", ":", "if", "arg_6", ".", "ns", "is", "None", ":", "arg_7", "=", "fn_macro_args", ".", "match", "(", "arg_6", ".", "name", ")", "if", "arg_7", "is", "not", "None", ":", "arg_4", "=", "arg_7", ".", "group", "(", "2", ")", "arg_5", "=", "arg_suffix", "(", "arg_4", ")", "arg_3", ".", "add", "(", "arg_5", ")", "return", "sym_replacement", "(", "arg_4", ")", "return", "arg_6", "arg_8", "=", "walk", ".", "postwalk", "(", "identify_and_replace", ",", "arg_2", ")", "if", "len", "(", "arg_2", ")", ">", "0", "else", "None", "arg_9", ":", "List", "[", "symbol", ".", "Symbol", "]", "=", "[", "]", "arg_10", "=", "sorted", "(", "map", "(", "int", ",", "filter", "(", "lambda", "k", ":", "k", "!=", "\"rest\"", ",", "arg_3", ")", ")", ")", "if", "len", "(", "arg_10", ")", ">", "0", ":", "arg_11", "=", "max", "(", "arg_10", ")", "arg_9", "=", "[", "sym_replacement", "(", "str", "(", "i", ")", ")", "for", "i", "in", "range", "(", "1", ",", "arg_11", "+", "1", ")", "]", "if", "\"rest\"", "in", "arg_3", ":", "arg_9", ".", "append", "(", "_AMPERSAND", ")", "arg_9", ".", "append", "(", "sym_replacement", "(", "\"rest\"", ")", ")", "return", "llist", ".", "l", "(", "_FN", ",", "vector", ".", "vector", "(", "arg_9", ")", ",", "arg_8", ")"], "function": "def Func(arg_0: arg_1) -> llist.List:\n    \"\"\"Read a function reader macro from the input stream.\"\"\"\n    if arg_0.is_in_anon_fn:\n        raise SyntaxError(f\"Nested #() definitions not allowed\")\n\n    with arg_0.in_anon_fn():\n        arg_2 = _read_list(arg_0)\n    arg_3 = set()\n\n    def arg_suffix(arg_4):\n        if arg_4 is None:\n            return \"1\"\n        elif arg_4 == \"&\":\n            return \"rest\"\n        else:\n            return arg_4\n\n    def sym_replacement(arg_4):\n        arg_5 = arg_suffix(arg_4)\n        return symbol.symbol(f\"arg-{suffix}\")\n\n    def identify_and_replace(arg_6):\n        if isinstance(arg_6, symbol.Symbol):\n            if arg_6.ns is None:\n                arg_7 = fn_macro_args.match(arg_6.name)\n                if arg_7 is not None:\n                    arg_4 = arg_7.group(2)\n                    arg_5 = arg_suffix(arg_4)\n                    arg_3.add(arg_5)\n                    return sym_replacement(arg_4)\n        return arg_6\n\n    arg_8 = walk.postwalk(identify_and_replace, arg_2) if len(arg_2) > 0 else None\n\n    arg_9: List[symbol.Symbol] = []\n    arg_10 = sorted(map(int, filter(lambda k: k != \"rest\", arg_3)))\n    if len(arg_10) > 0:\n        arg_11 = max(arg_10)\n        arg_9 = [sym_replacement(str(i)) for i in range(1, arg_11 + 1)]\n        if \"rest\" in arg_3:\n            arg_9.append(_AMPERSAND)\n            arg_9.append(sym_replacement(\"rest\"))\n\n    return llist.l(_FN, vector.vector(arg_9), arg_8)", "path": "src/basilisp/lang/reader.py", "identifier": "_read_function", "docstring": "Read a function reader macro from the input stream.", "docstring_tokens": ["Read", "a", "function", "reader", "macro", "from", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255707}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L15-L23", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Show a simple pop-up modal dialog", "language": "python", "parameters": "(message, title=\"\", parent=None, scrolled=False, icon=\"exclamation\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "\"exclamation\"", ")", ":", "if", "not", "arg_3", ":", "arg_5", "=", "{", "'exclamation'", ":", "wx", ".", "ICON_EXCLAMATION", ",", "'error'", ":", "wx", ".", "ICON_ERROR", ",", "'question'", ":", "wx", ".", "ICON_QUESTION", ",", "'info'", ":", "wx", ".", "ICON_INFORMATION", "}", "arg_6", "=", "wx", ".", "OK", "|", "arg_5", "[", "arg_4", "]", "arg_7", "=", "dialogs", ".", "messageDialog", "(", "arg_2", ",", "arg_0", ",", "arg_1", ",", "arg_6", ")", "else", ":", "arg_7", "=", "dialogs", ".", "scrolledMessageDialog", "(", "arg_2", ",", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=\"\", arg_2=None, arg_3=False, arg_4=\"exclamation\"):\r\n    \"Show a simple pop-up modal dialog\"\r\n    if not arg_3:\r\n        arg_5 = {'exclamation': wx.ICON_EXCLAMATION, 'error': wx.ICON_ERROR,\r\n             'question': wx.ICON_QUESTION, 'info': wx.ICON_INFORMATION}\r\n        arg_6 = wx.OK | arg_5[arg_4]\r\n        arg_7 = dialogs.messageDialog(arg_2, arg_0, arg_1, arg_6)\r\n    else:\r\n        arg_7 = dialogs.scrolledMessageDialog(arg_2, arg_0, arg_1)", "path": "gui/dialog.py", "identifier": "alert", "docstring": "Show a simple pop-up modal dialog", "docstring_tokens": ["Show", "a", "simple", "pop", "-", "up", "modal", "dialog"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 255708}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L271-L285", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "generate word pairs for the TextRank graph", "language": "python", "parameters": "(graf, size=3)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3", ")", ":", "arg_2", "=", "list", "(", "filter", "(", "lambda", "w", ":", "w", ".", "word_id", ">", "0", ",", "arg_0", ")", ")", "arg_3", "=", "len", "(", "arg_2", ")", "for", "arg_4", "in", "iter", "(", "range", "(", "0", ",", "arg_3", "-", "1", ")", ")", ":", "arg_5", "=", "arg_2", "[", "arg_4", "]", "for", "arg_6", "in", "iter", "(", "range", "(", "arg_4", "+", "1", ",", "min", "(", "arg_3", ",", "arg_4", "+", "1", "+", "arg_1", ")", ")", ")", ":", "arg_7", "=", "arg_2", "[", "arg_6", "]", "if", "(", "arg_7", ".", "idx", "-", "arg_5", ".", "idx", ")", "<=", "arg_1", ":", "yield", "(", "arg_5", ".", "root", ",", "arg_7", ".", "root", ",", ")"], "function": "def Func (arg_0, arg_1=3):\n    \"\"\"\n    generate word pairs for the TextRank graph\n    \"\"\"\n    arg_2 = list(filter(lambda w: w.word_id > 0, arg_0))\n    arg_3 = len(arg_2)\n\n    for arg_4 in iter(range(0, arg_3 - 1)):\n        arg_5 = arg_2[arg_4]\n\n        for arg_6 in iter(range(arg_4 + 1, min(arg_3, arg_4 + 1 + arg_1))):\n            arg_7 = arg_2[arg_6]\n\n            if (arg_7.idx - arg_5.idx) <= arg_1:\n                yield (arg_5.root, arg_7.root,)", "path": "pytextrank/pytextrank.py", "identifier": "get_tiles", "docstring": "generate word pairs for the TextRank graph", "docstring_tokens": ["generate", "word", "pairs", "for", "the", "TextRank", "graph"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 255709}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L99-L187", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Callback called by Secure Transport to actually read the socket", "language": "python", "parameters": "(connection_id, data_buffer, data_length_pointer)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "None", "try", ":", "arg_3", "=", "_connection_refs", ".", "get", "(", "arg_0", ")", "if", "not", "arg_3", ":", "arg_4", "=", "_socket_refs", ".", "get", "(", "arg_0", ")", "else", ":", "arg_4", "=", "arg_3", ".", "_socket", "if", "not", "arg_3", "and", "not", "arg_4", ":", "return", "0", "arg_5", "=", "deref", "(", "arg_2", ")", "arg_6", "=", "arg_4", ".", "gettimeout", "(", ")", "arg_7", "=", "None", "arg_8", "=", "b''", "try", ":", "while", "len", "(", "arg_8", ")", "<", "arg_5", ":", "if", "arg_6", "is", "not", "None", "and", "arg_6", ">", "0.0", ":", "arg_9", ",", "arg_10", ",", "arg_10", "=", "select", ".", "select", "(", "[", "arg_4", "]", ",", "[", "]", ",", "[", "]", ",", "arg_6", ")", "if", "len", "(", "arg_9", ")", "==", "0", ":", "raise", "socket_", ".", "error", "(", "errno", ".", "EAGAIN", ",", "'timed out'", ")", "arg_11", "=", "arg_4", ".", "recv", "(", "arg_5", "-", "len", "(", "arg_8", ")", ")", "arg_8", "+=", "arg_11", "if", "arg_11", "==", "b''", ":", "if", "len", "(", "arg_8", ")", "==", "0", ":", "if", "arg_6", "is", "None", ":", "return", "SecurityConst", ".", "errSSLClosedNoNotify", "return", "SecurityConst", ".", "errSSLClosedAbort", "break", "except", "(", "socket_", ".", "error", ")", "as", "e", ":", "arg_7", "=", "e", ".", "errno", "if", "arg_7", "is", "not", "None", "and", "arg_7", "!=", "errno", ".", "EAGAIN", ":", "if", "arg_7", "==", "errno", ".", "ECONNRESET", "or", "arg_7", "==", "errno", ".", "EPIPE", ":", "return", "SecurityConst", ".", "errSSLClosedNoNotify", "return", "SecurityConst", ".", "errSSLClosedAbort", "if", "arg_3", "and", "not", "arg_3", ".", "_done_handshake", ":", "if", "len", "(", "arg_8", ")", ">=", "3", "and", "len", "(", "arg_3", ".", "_server_hello", ")", "==", "0", ":", "arg_12", "=", "arg_8", "[", "0", ":", "1", "]", "in", "set", "(", "[", "b'\\x15'", ",", "b'\\x16'", "]", ")", "arg_13", "=", "arg_8", "[", "1", ":", "3", "]", "in", "set", "(", "[", "b'\\x03\\x00'", ",", "b'\\x03\\x01'", ",", "b'\\x03\\x02'", ",", "b'\\x03\\x03'", ",", "b'\\x03\\x04'", "]", ")", "if", "not", "arg_12", "or", "not", "arg_13", ":", "arg_3", ".", "_server_hello", "+=", "arg_8", "+", "_read_remaining", "(", "arg_4", ")", "return", "SecurityConst", ".", "errSSLProtocol", "arg_3", ".", "_server_hello", "+=", "arg_8", "write_to_buffer", "(", "arg_1", ",", "arg_8", ")", "pointer_set", "(", "arg_2", ",", "len", "(", "arg_8", ")", ")", "if", "len", "(", "arg_8", ")", "!=", "arg_5", ":", "return", "SecurityConst", ".", "errSSLWouldBlock", "return", "0", "except", "(", "KeyboardInterrupt", ")", "as", "e", ":", "if", "arg_3", ":", "arg_3", ".", "_exception", "=", "e", "return", "SecurityConst", ".", "errSSLClosedAbort"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Callback called by Secure Transport to actually read the socket\n\n    :param connection_id:\n        An integer identifing the connection\n\n    :param data_buffer:\n        A char pointer FFI type to write the data to\n\n    :param data_length_pointer:\n        A size_t pointer FFI type of the amount of data to read. Will be\n        overwritten with the amount of data read on return.\n\n    :return:\n        An integer status code of the result - 0 for success\n    \"\"\"\n\n    arg_3 = None\n    try:\n        arg_3 = _connection_refs.get(arg_0)\n        if not arg_3:\n            arg_4 = _socket_refs.get(arg_0)\n        else:\n            arg_4 = arg_3._socket\n\n        if not arg_3 and not arg_4:\n            return 0\n\n        arg_5 = deref(arg_2)\n\n        arg_6 = arg_4.gettimeout()\n        arg_7 = None\n        arg_8 = b''\n        try:\n            while len(arg_8) < arg_5:\n                # Python 2 on Travis CI seems to have issues with blocking on\n                # recv() for longer than the socket timeout value, so we select\n                if arg_6 is not None and arg_6 > 0.0:\n                    arg_9, arg_10, arg_10 = select.select([arg_4], [], [], arg_6)\n                    if len(arg_9) == 0:\n                        raise socket_.error(errno.EAGAIN, 'timed out')\n                arg_11 = arg_4.recv(arg_5 - len(arg_8))\n                arg_8 += arg_11\n                if arg_11 == b'':\n                    if len(arg_8) == 0:\n                        if arg_6 is None:\n                            return SecurityConst.errSSLClosedNoNotify\n                        return SecurityConst.errSSLClosedAbort\n                    break\n        except (socket_.error) as e:\n            arg_7 = e.errno\n\n        if arg_7 is not None and arg_7 != errno.EAGAIN:\n            if arg_7 == errno.ECONNRESET or arg_7 == errno.EPIPE:\n                return SecurityConst.errSSLClosedNoNotify\n            return SecurityConst.errSSLClosedAbort\n\n        if arg_3 and not arg_3._done_handshake:\n            # SecureTransport doesn't bother to check if the TLS record header\n            # is valid before asking to read more data, which can result in\n            # connection hangs. Here we do basic checks to get around the issue.\n            if len(arg_8) >= 3 and len(arg_3._server_hello) == 0:\n                # Check to ensure it is an alert or handshake first\n                arg_12 = arg_8[0:1] in set([b'\\x15', b'\\x16'])\n                # Check if the protocol version is SSL 3.0 or TLS 1.0-1.3\n                arg_13 = arg_8[1:3] in set([\n                    b'\\x03\\x00',\n                    b'\\x03\\x01',\n                    b'\\x03\\x02',\n                    b'\\x03\\x03',\n                    b'\\x03\\x04'\n                ])\n                if not arg_12 or not arg_13:\n                    arg_3._server_hello += arg_8 + _read_remaining(arg_4)\n                    return SecurityConst.errSSLProtocol\n            arg_3._server_hello += arg_8\n\n        write_to_buffer(arg_1, arg_8)\n        pointer_set(arg_2, len(arg_8))\n\n        if len(arg_8) != arg_5:\n            return SecurityConst.errSSLWouldBlock\n\n        return 0\n    except (KeyboardInterrupt) as e:\n        if arg_3:\n            arg_3._exception = e\n        return SecurityConst.errSSLClosedAbort", "path": "oscrypto/_osx/tls.py", "identifier": "_read_callback", "docstring": "Callback called by Secure Transport to actually read the socket\n\n    :param connection_id:\n        An integer identifing the connection\n\n    :param data_buffer:\n        A char pointer FFI type to write the data to\n\n    :param data_length_pointer:\n        A size_t pointer FFI type of the amount of data to read. Will be\n        overwritten with the amount of data read on return.\n\n    :return:\n        An integer status code of the result - 0 for success", "docstring_tokens": ["Callback", "called", "by", "Secure", "Transport", "to", "actually", "read", "the", "socket"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 255710}
{"url": "https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/models.py#L136-L174", "sha": "c60bc28f16f5d0e62536e76c17d6944a79449ef1", "docstring_summary": "Creates a new notice.", "language": "python", "parameters": "(users, label, extra_context=None, sender=None)", "return_statement": "return sent", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "False", "if", "arg_2", "is", "None", ":", "arg_2", "=", "{", "}", "arg_5", "=", "NoticeType", ".", "objects", ".", "get", "(", "arg_1", "=", "arg_1", ")", "arg_6", "=", "get_language", "(", ")", "for", "arg_7", "in", "arg_0", ":", "try", ":", "arg_8", "=", "get_notification_language", "(", "arg_7", ")", "except", "LanguageStoreNotAvailable", ":", "arg_8", "=", "None", "if", "arg_8", "is", "not", "None", ":", "activate", "(", "arg_8", ")", "for", "arg_9", "in", "NOTIFICATION_BACKENDS", ".", "values", "(", ")", ":", "if", "arg_9", ".", "can_send", "(", "arg_7", ",", "arg_5", ")", ":", "arg_9", ".", "deliver", "(", "arg_7", ",", "arg_3", ",", "arg_5", ",", "arg_2", ")", "arg_4", "=", "True", "activate", "(", "arg_6", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    Creates a new notice.\n\n    This is intended to be how other apps create new notices.\n\n    notification.send(user, \"friends_invite_sent\", {\n        \"spam\": \"eggs\",\n        \"foo\": \"bar\",\n    )\n    \"\"\"\n    arg_4 = False\n    if arg_2 is None:\n        arg_2 = {}\n\n    arg_5 = NoticeType.objects.get(arg_1=arg_1)\n\n    arg_6 = get_language()\n\n    for arg_7 in arg_0:\n        # get user language for user from language store defined in\n        # NOTIFICATION_LANGUAGE_MODULE setting\n        try:\n            arg_8 = get_notification_language(arg_7)\n        except LanguageStoreNotAvailable:\n            arg_8 = None\n\n        if arg_8 is not None:\n            # activate the user's language\n            activate(arg_8)\n\n        for arg_9 in NOTIFICATION_BACKENDS.values():\n            if arg_9.can_send(arg_7, arg_5):\n                arg_9.deliver(arg_7, arg_3, arg_5, arg_2)\n                arg_4 = True\n\n    # reset environment to original language\n    activate(arg_6)\n    return arg_4", "path": "notification/models.py", "identifier": "send_now", "docstring": "Creates a new notice.\n\n    This is intended to be how other apps create new notices.\n\n    notification.send(user, \"friends_invite_sent\", {\n        \"spam\": \"eggs\",\n        \"foo\": \"bar\",\n    )", "docstring_tokens": ["Creates", "a", "new", "notice", "."], "nwo": "GeoNode/geonode-notification", "score": 0.17385480483333982, "idx": 255711}
{"url": "https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/credentials.py#L4-L9", "sha": "dfb60fa1e30ae7cfec2526bb101fc205f5952639", "docstring_summary": "Return an auth token based on the client+service+seed tuple.", "language": "python", "parameters": "(client, service, seed)", "return_statement": "return hash_func.hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "hashlib", ".", "md5", "(", ")", "arg_4", "=", "','", ".", "join", "(", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", ".", "encode", "(", "'utf-8'", ")", "arg_3", ".", "update", "(", "arg_4", ")", "return", "arg_3", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Return an auth token based on the client+service+seed tuple.\"\"\"\n    arg_3 = hashlib.md5()\n    arg_4 = ','.join((arg_0, arg_1, arg_2)).encode('utf-8')\n    arg_3.update(arg_4)\n    return arg_3.hexdigest()", "path": "yoconfigurator/credentials.py", "identifier": "seeded_auth_token", "docstring": "Return an auth token based on the client+service+seed tuple.", "docstring_tokens": ["Return", "an", "auth", "token", "based", "on", "the", "client", "+", "service", "+", "seed", "tuple", "."], "nwo": "yola/yoconfigurator", "score": 0.5008169819389054, "idx": 255712}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L292-L301", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the closest parent of this Tag that matches the given\n        criteria.", "language": "python", "parameters": "(self, name=None, attrs={}, **kwargs)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "{", "}", ",", "**", "arg_3", ")", ":", "arg_4", "=", "None", "arg_5", "=", "arg_0", ".", "Funcs", "(", "arg_1", ",", "arg_2", ",", "1", ")", "if", "arg_5", ":", "arg_4", "=", "arg_5", "[", "0", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2={}, **arg_3):\n        \"\"\"Returns the closest parent of this Tag that matches the given\n        criteria.\"\"\"\n        # NOTE: We can't use _findOne because Funcs takes a different\n        # set of arguments.\n        arg_4 = None\n        arg_5 = arg_0.Funcs(arg_1, arg_2, 1)\n        if arg_5:\n            arg_4 = arg_5[0]\n        return arg_4", "path": "lib/web/BeautifulSoup.py", "identifier": "PageElement.findParent", "docstring": "Returns the closest parent of this Tag that matches the given\n        criteria.", "docstring_tokens": ["Returns", "the", "closest", "parent", "of", "this", "Tag", "that", "matches", "the", "given", "criteria", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255713}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L217-L242", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Bookmark build job.", "language": "python", "parameters": "(ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "get_build_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'build'", ")", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "build_job", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func build job `{}`.'", ".", "format", "(", "arg_3", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"Build job Funced.\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Bookmark build job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon build Func\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon build -b 2 Func\n    ```\n    \"\"\"\n    arg_1, arg_2, arg_3 = get_build_or_local(arg_0.obj.get('project'), arg_0.obj.get('build'))\n    try:\n        PolyaxonClient().build_job.Func(arg_1, arg_2, arg_3)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func build job `{}`.'.format(arg_3))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"Build job Funced.\")", "path": "polyaxon_cli/cli/build.py", "identifier": "bookmark", "docstring": "Bookmark build job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon build bookmark\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon build -b 2 bookmark\n    ```", "docstring_tokens": ["Bookmark", "build", "job", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 255714}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/catalogs.py#L116-L228", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a parallel worker for makelclist.", "language": "python", "parameters": "(task)", "return_statement": "return lcobjdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", "try", ":", "arg_6", "=", "get_lcformat", "(", "arg_3", ",", "use_lcformat_dir", "=", "arg_4", ")", "if", "arg_6", ":", "(", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ")", "=", "arg_6", "else", ":", "LOGERROR", "(", "\"can't figure out the light curve format\"", ")", "return", "None", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "\"can't figure out the light curve format\"", ")", "return", "None", "arg_14", "=", "{", "'lcfname'", ":", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", "}", "try", ":", "arg_15", "=", "arg_8", "(", "arg_1", ")", "if", "(", "(", "isinstance", "(", "arg_15", ",", "(", "list", ",", "tuple", ")", ")", ")", "and", "(", "isinstance", "(", "arg_15", "[", "0", "]", ",", "dict", ")", ")", ")", ":", "arg_15", "=", "arg_15", "[", "0", "]", "for", "arg_16", "in", "arg_2", ":", "if", "'.'", "in", "arg_16", ":", "arg_17", "=", "arg_16", ".", "split", "(", "'.'", ")", "else", ":", "arg_17", "=", "[", "arg_16", "]", "try", ":", "arg_18", "=", "_dict_get", "(", "arg_15", ",", "arg_17", ")", "except", "Exception", "as", "e", ":", "LOGWARNING", "(", "'column %s does not exist for %s'", "%", "(", "arg_16", ",", "arg_1", ")", ")", "arg_18", "=", "np", ".", "nan", "arg_14", "[", "arg_17", "[", "-", "1", "]", "]", "=", "arg_18", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'could not figure out columns for %s'", "%", "arg_1", ")", "for", "arg_16", "in", "arg_2", ":", "if", "'.'", "in", "arg_16", ":", "arg_17", "=", "arg_16", ".", "split", "(", "'.'", ")", "else", ":", "arg_17", "=", "[", "arg_16", "]", "arg_18", "=", "np", ".", "nan", "arg_14", "[", "arg_17", "[", "-", "1", "]", "]", "=", "arg_18", "for", "arg_19", "in", "arg_5", ":", "try", ":", "if", "'.'", "in", "arg_19", ":", "arg_20", "=", "arg_19", ".", "split", "(", "'.'", ")", "else", ":", "arg_20", "=", "[", "arg_19", "]", "arg_21", "=", "_dict_get", "(", "arg_15", ",", "arg_20", ")", "arg_22", "=", "arg_21", "[", "np", ".", "isfinite", "(", "arg_21", ")", "]", ".", "size", "arg_14", "[", "'%s.ndet'", "%", "arg_20", "[", "-", "1", "]", "]", "=", "arg_22", "except", "Exception", "as", "e", ":", "arg_14", "[", "'%s.ndet'", "%", "arg_20", "[", "-", "1", "]", "]", "=", "np", ".", "nan", "return", "arg_14"], "function": "def Func(arg_0):\n    '''This is a parallel worker for makelclist.\n\n    Parameters\n    ----------\n\n    task : tuple\n        This is a tuple containing the following items:\n\n        task[0] = lcf\n        task[1] = columns\n        task[2] = lcformat\n        task[3] = lcformatdir\n        task[4] = lcndetkey\n\n    Returns\n    -------\n\n    dict or None\n        This contains all of the info for the object processed in this LC read\n        operation. If this fails, returns None\n\n    '''\n\n    arg_1, arg_2, arg_3, arg_4, arg_5 = arg_0\n\n    # get the bits needed for lcformat handling\n    # NOTE: we re-import things in this worker function because sometimes\n    # functions can't be pickled correctly for passing them to worker functions\n    # in a processing pool\n    try:\n        arg_6 = get_lcformat(arg_3,\n                                  use_lcformat_dir=arg_4)\n        if arg_6:\n            (arg_7, arg_8,\n             arg_9, arg_10, arg_11,\n             arg_12, arg_13) = arg_6\n        else:\n            LOGERROR(\"can't figure out the light curve format\")\n            return None\n    except Exception as e:\n        LOGEXCEPTION(\"can't figure out the light curve format\")\n        return None\n\n    # we store the full path of the light curve\n    arg_14 = {'lcfname':os.path.abspath(arg_1)}\n\n    try:\n\n        # read the light curve in\n        arg_15 = arg_8(arg_1)\n\n        # this should handle lists/tuples being returned by readerfunc\n        # we assume that the first element is the actual lcdict\n        # FIXME: figure out how to not need this assumption\n        if ( (isinstance(arg_15, (list, tuple))) and\n             (isinstance(arg_15[0], dict)) ):\n            arg_15 = arg_15[0]\n\n        # insert all of the columns\n        for arg_16 in arg_2:\n\n            if '.' in arg_16:\n                arg_17 = arg_16.split('.')\n            else:\n                arg_17 = [arg_16]\n\n            try:\n                arg_18 = _dict_get(arg_15, arg_17)\n            except Exception as e:\n                LOGWARNING('column %s does not exist for %s' %\n                           (arg_16, arg_1))\n                arg_18 = np.nan\n\n            # update the lcobjdict with this value\n            arg_14[arg_17[-1]] = arg_18\n\n    except Exception as e:\n\n        LOGEXCEPTION('could not figure out columns for %s' % arg_1)\n\n        # insert all of the columns as nans\n        for arg_16 in arg_2:\n\n            if '.' in arg_16:\n                arg_17 = arg_16.split('.')\n            else:\n                arg_17 = [arg_16]\n\n            arg_18 = np.nan\n\n            # update the lclistdict with this value\n            arg_14[arg_17[-1]] = arg_18\n\n    # now get the actual ndets; this excludes nans and infs\n    for arg_19 in arg_5:\n\n        try:\n\n            if '.' in arg_19:\n                arg_20 = arg_19.split('.')\n            else:\n                arg_20 = [arg_19]\n\n            arg_21 = _dict_get(arg_15, arg_20)\n            arg_22 = arg_21[np.isfinite(arg_21)].size\n            arg_14['%s.ndet' % arg_20[-1]] = arg_22\n\n        except Exception as e:\n            arg_14['%s.ndet' % arg_20[-1]] = np.nan\n\n\n    return arg_14", "path": "astrobase/lcproc/catalogs.py", "identifier": "_lclist_parallel_worker", "docstring": "This is a parallel worker for makelclist.\n\n    Parameters\n    ----------\n\n    task : tuple\n        This is a tuple containing the following items:\n\n        task[0] = lcf\n        task[1] = columns\n        task[2] = lcformat\n        task[3] = lcformatdir\n        task[4] = lcndetkey\n\n    Returns\n    -------\n\n    dict or None\n        This contains all of the info for the object processed in this LC read\n        operation. If this fails, returns None", "docstring_tokens": ["This", "is", "a", "parallel", "worker", "for", "makelclist", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255715}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/engine/__init__.py#L456-L461", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns list of output names in spec.", "language": "python", "parameters": "(self)", "return_statement": "return [outputs.getByIndex(i)[0] for i in xrange(outputs.getCount())]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "getSpec", "(", ")", ".", "outputs", "return", "[", "arg_1", ".", "getByIndex", "(", "arg_2", ")", "[", "0", "]", "for", "arg_2", "in", "xrange", "(", "arg_1", ".", "getCount", "(", ")", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns list of output names in spec.\n    \"\"\"\n    arg_1 = arg_0.getSpec().outputs\n    return [arg_1.getByIndex(arg_2)[0] for arg_2 in xrange(arg_1.getCount())]", "path": "src/nupic/engine/__init__.py", "identifier": "Region.getOutputNames", "docstring": "Returns list of output names in spec.", "docstring_tokens": ["Returns", "list", "of", "output", "names", "in", "spec", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255716}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/hdf5.py#L32-L53", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Export a numpy array to a HDF5 file.", "language": "python", "parameters": "(hdf5_filename, array)", "return_statement": "return hdf5_filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", "try", ":", "arg_2", "=", "h5py", ".", "File", "(", "arg_0", ",", "\"w\"", ")", "arg_2", ".", "create_dataset", "(", "'CUTOUT'", ",", "data", "=", "arg_1", ")", "arg_2", ".", "close", "(", ")", "except", "Exception", "as", "e", ":", "raise", "ValueError", "(", "\"Could not Func HDF5 file {0}.\"", ".", "format", "(", "arg_0", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Export a numpy array to a HDF5 file.\n\n    Arguments:\n        hdf5_filename (str): A filename to which to Func the HDF5 data\n        array (numpy.ndarray): The numpy array to Func to HDF5\n\n    Returns:\n        String. The expanded filename that now holds the HDF5 data\n    \"\"\"\n    # Expand filename to be absolute\n    arg_0 = os.path.expanduser(arg_0)\n\n    try:\n        arg_2 = h5py.File(arg_0, \"w\")\n        arg_2.create_dataset('CUTOUT', data=arg_1)\n        arg_2.close()\n    except Exception as e:\n        raise ValueError(\"Could not Func HDF5 file {0}.\".format(arg_0))\n\n    return arg_0", "path": "ndio/convert/hdf5.py", "identifier": "save", "docstring": "Export a numpy array to a HDF5 file.\n\n    Arguments:\n        hdf5_filename (str): A filename to which to save the HDF5 data\n        array (numpy.ndarray): The numpy array to save to HDF5\n\n    Returns:\n        String. The expanded filename that now holds the HDF5 data", "docstring_tokens": ["Export", "a", "numpy", "array", "to", "a", "HDF5", "file", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 255717}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/engine.py#L113-L125", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Check if spark version is below 2.2", "language": "python", "parameters": "()", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "pyspark", "if", "(", "hasattr", "(", "pyspark", ",", "\"version\"", ")", ")", ":", "arg_0", "=", "pyspark", ".", "version", ".", "__version__", "arg_1", "=", "arg_0", ".", "split", "(", "\".\"", ")", "arg_2", "=", "arg_1", "[", "0", "]", "+", "\".\"", "+", "arg_1", "[", "1", "]", "if", "(", "compare_version", "(", "arg_2", ",", "\"2.2\"", ")", ">=", "0", ")", ":", "return", "False", "return", "True"], "function": "def Func():\n    \"\"\"\n    Check if spark version is below 2.2\n    \"\"\"\n    import pyspark\n    if(hasattr(pyspark,\"version\")):\n        arg_0 = pyspark.version.__version__\n        # We only need the general spark version (eg, 1.6, 2.2).\n        arg_1 = arg_0.split(\".\")\n        arg_2 = arg_1[0] + \".\" + arg_1[1]\n        if(compare_version(arg_2, \"2.2\")>=0):\n            return False\n    return True", "path": "pyspark/bigdl/util/engine.py", "identifier": "is_spark_below_2_2", "docstring": "Check if spark version is below 2.2", "docstring_tokens": ["Check", "if", "spark", "version", "is", "below", "2", ".", "2"], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 255718}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/serializers.py#L479-L488", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Fetch all queued instances of type `embed_type`, save results\n        to `self.instances`", "language": "python", "parameters": "(self, embed_type, ids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "serializers", ".", "get", "(", "arg_1", ",", "None", ")", "if", "arg_3", "is", "None", ":", "return", "arg_0", ".", "instances", "[", "arg_1", "]", "=", "arg_3", ".", "fetch", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Fetch all queued instances of type `embed_type`, save results\n        to `self.instances`\"\"\"\n\n        arg_3 = arg_0.serializers.get(arg_1, None)\n\n        if arg_3 is None:\n            return\n\n        arg_0.instances[arg_1] = arg_3.fetch(arg_2)", "path": "dispatch/api/serializers.py", "identifier": "ContentSerializer.load_instances", "docstring": "Fetch all queued instances of type `embed_type`, save results\n        to `self.instances`", "docstring_tokens": ["Fetch", "all", "queued", "instances", "of", "type", "embed_type", "save", "results", "to", "self", ".", "instances"], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 255719}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/gcp_transfer_operator.py#L106-L110", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Convert native python ``datetime.date`` object  to a format supported by the API", "language": "python", "parameters": "(field_date)", "return_statement": "return {DAY: field_date.day, MONTH: field_date.month, YEAR: field_date.year}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "DAY", ":", "arg_0", ".", "day", ",", "MONTH", ":", "arg_0", ".", "month", ",", "YEAR", ":", "arg_0", ".", "year", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Convert native python ``datetime.date`` object  to a format supported by the API\n        \"\"\"\n        return {DAY: arg_0.day, MONTH: arg_0.month, YEAR: arg_0.year}", "path": "airflow/contrib/operators/gcp_transfer_operator.py", "identifier": "TransferJobPreprocessor._convert_date_to_dict", "docstring": "Convert native python ``datetime.date`` object  to a format supported by the API", "docstring_tokens": ["Convert", "native", "python", "datetime", ".", "date", "object", "to", "a", "format", "supported", "by", "the", "API"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255720}
{"url": "https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L486-L492", "sha": "08e0319ff3c70f8a931dfa8890caf48add4d0470", "docstring_summary": "Create the rst string to download supplementary data", "language": "python", "parameters": "(self, files)", "return_statement": "return self.DATA_DOWNLOAD % ':download:`%s`' % files[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", ">", "1", ":", "return", "arg_0", ".", "DATA_DOWNLOAD", "%", "(", "(", "'\\n\\n'", "+", "' '", "*", "8", ")", "+", "(", "'\\n'", "+", "' '", "*", "8", ")", ".", "join", "(", "'* :download:`%s`'", "%", "arg_2", "for", "arg_2", "in", "arg_1", ")", ")", "return", "arg_0", ".", "DATA_DOWNLOAD", "%", "':download:`%s`'", "%", "arg_1", "[", "0", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create the rst string to download supplementary data\"\"\"\n        if len(arg_1) > 1:\n            return arg_0.DATA_DOWNLOAD % (\n                ('\\n\\n' + ' '*8) + ('\\n' + ' '*8).join(\n                    '* :download:`%s`' % arg_2 for arg_2 in arg_1))\n        return arg_0.DATA_DOWNLOAD % ':download:`%s`' % arg_1[0]", "path": "sphinx_nbexamples/__init__.py", "identifier": "NotebookProcessor.data_download", "docstring": "Create the rst string to download supplementary data", "docstring_tokens": ["Create", "the", "rst", "string", "to", "download", "supplementary", "data"], "nwo": "Chilipp/sphinx-nbexamples", "score": 0.28168436607245656, "idx": 255721}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L806-L843", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Updates a LAN", "language": "python", "parameters": "(self, datacenter_id, lan_id, name=None,\n                   public=None, ip_failover=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "{", "}", "if", "arg_3", ":", "arg_6", "[", "'name'", "]", "=", "arg_3", "if", "arg_4", "is", "not", "None", ":", "arg_6", "[", "'public'", "]", "=", "arg_4", "if", "arg_5", ":", "arg_6", "[", "'ipFailover'", "]", "=", "arg_5", "arg_7", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/lans/%s'", "%", "(", "arg_1", ",", "arg_2", ")", ",", "method", "=", "'PATCH'", ",", "arg_6", "=", "json", ".", "dumps", "(", "arg_6", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None,\n                   arg_4=None, arg_5=None):\n        \"\"\"\n        Updates a LAN\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      lan_id: The unique ID of the LAN.\n        :type       lan_id: ``str``\n\n        :param      name: The new name of the LAN.\n        :type       name: ``str``\n\n        :param      public: Indicates if the LAN is public.\n        :type       public: ``bool``\n\n        :param      ip_failover: A list of IP fail-over dicts.\n        :type       ip_failover: ``list``\n\n        \"\"\"\n        arg_6 = {}\n\n        if arg_3:\n            arg_6['name'] = arg_3\n\n        if arg_4 is not None:\n            arg_6['public'] = arg_4\n\n        if arg_5:\n            arg_6['ipFailover'] = arg_5\n\n        arg_7 = arg_0._perform_request(\n            url='/datacenters/%s/lans/%s' % (arg_1, arg_2),\n            method='PATCH',\n            arg_6=json.dumps(arg_6))\n\n        return arg_7", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.update_lan", "docstring": "Updates a LAN\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      lan_id: The unique ID of the LAN.\n        :type       lan_id: ``str``\n\n        :param      name: The new name of the LAN.\n        :type       name: ``str``\n\n        :param      public: Indicates if the LAN is public.\n        :type       public: ``bool``\n\n        :param      ip_failover: A list of IP fail-over dicts.\n        :type       ip_failover: ``list``", "docstring_tokens": ["Updates", "a", "LAN"], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 255722}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/operations/prediction_operations.py#L36-L121", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gets predictions for a given utterance, in the form of intents and\n        entities. The current maximum query size is 500 characters.", "language": "python", "parameters": "(\n            self, app_id, query, timezone_offset=None, verbose=None, staging=None, spell_check=None, bing_spell_check_subscription_key=None, log=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "**", "arg_11", ")", ":", "arg_12", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_13", "=", "{", "'Endpoint'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.config.endpoint\"", ",", "arg_0", ".", "config", ".", "endpoint", ",", "'str'", ",", "skip_quote", "=", "True", ")", ",", "'appId'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"app_id\"", ",", "arg_1", ",", "'str'", ")", "}", "arg_12", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_12", ",", "**", "arg_13", ")", "arg_14", "=", "{", "}", "if", "arg_3", "is", "not", "None", ":", "arg_14", "[", "'timezoneOffset'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"timezone_offset\"", ",", "arg_3", ",", "'float'", ")", "if", "arg_4", "is", "not", "None", ":", "arg_14", "[", "'verbose'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"verbose\"", ",", "arg_4", ",", "'bool'", ")", "if", "arg_5", "is", "not", "None", ":", "arg_14", "[", "'staging'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"staging\"", ",", "arg_5", ",", "'bool'", ")", "if", "arg_6", "is", "not", "None", ":", "arg_14", "[", "'spellCheck'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"spell_check\"", ",", "arg_6", ",", "'bool'", ")", "if", "arg_7", "is", "not", "None", ":", "arg_14", "[", "'bing-spell-check-subscription-key'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"bing_spell_check_subscription_key\"", ",", "arg_7", ",", "'str'", ")", "if", "arg_8", "is", "not", "None", ":", "arg_14", "[", "'log'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"log\"", ",", "arg_8", ",", "'bool'", ")", "arg_15", "=", "{", "}", "arg_15", "[", "'Accept'", "]", "=", "'application/json'", "arg_15", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_9", ":", "arg_15", ".", "update", "(", "arg_9", ")", "arg_16", "=", "arg_0", ".", "_serialize", ".", "body", "(", "arg_2", ",", "'str'", ")", "arg_17", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_12", ",", "arg_14", ",", "arg_15", ",", "arg_16", ")", "arg_18", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_17", ",", "stream", "=", "False", ",", "**", "arg_11", ")", "if", "arg_18", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "APIErrorException", "(", "arg_0", ".", "_deserialize", ",", "arg_18", ")", "arg_19", "=", "None", "if", "arg_18", ".", "status_code", "==", "200", ":", "arg_19", "=", "arg_0", ".", "_deserialize", "(", "'LuisResult'", ",", "arg_18", ")", "if", "arg_10", ":", "arg_20", "=", "ClientRawResponse", "(", "arg_19", ",", "arg_18", ")", "return", "arg_20", "return", "arg_19"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=False, **arg_11):\n        \"\"\"Gets predictions for a given utterance, in the form of intents and\n        entities. The current maximum query size is 500 characters.\n\n        :param app_id: The LUIS application ID (Guid).\n        :type app_id: str\n        :param query: The utterance to predict.\n        :type query: str\n        :param timezone_offset: The timezone offset for the location of the\n         request.\n        :type timezone_offset: float\n        :param verbose: If true, return all intents instead of just the top\n         scoring intent.\n        :type verbose: bool\n        :param staging: Use the staging endpoint slot.\n        :type staging: bool\n        :param spell_check: Enable spell checking.\n        :type spell_check: bool\n        :param bing_spell_check_subscription_key: The subscription key to use\n         when enabling Bing spell check\n        :type bing_spell_check_subscription_key: str\n        :param log: Log query (default is true)\n        :type log: bool\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: LuisResult or ClientRawResponse if raw=true\n        :rtype:\n         ~azure.cognitiveservices.language.luis.runtime.models.LuisResult or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`APIErrorException<azure.cognitiveservices.language.luis.runtime.models.APIErrorException>`\n        \"\"\"\n        # Construct URL\n        arg_12 = arg_0.Func.metadata['url']\n        arg_13 = {\n            'Endpoint': arg_0._serialize.url(\"self.config.endpoint\", arg_0.config.endpoint, 'str', skip_quote=True),\n            'appId': arg_0._serialize.url(\"app_id\", arg_1, 'str')\n        }\n        arg_12 = arg_0._client.format_url(arg_12, **arg_13)\n\n        # Construct parameters\n        arg_14 = {}\n        if arg_3 is not None:\n            arg_14['timezoneOffset'] = arg_0._serialize.query(\"timezone_offset\", arg_3, 'float')\n        if arg_4 is not None:\n            arg_14['verbose'] = arg_0._serialize.query(\"verbose\", arg_4, 'bool')\n        if arg_5 is not None:\n            arg_14['staging'] = arg_0._serialize.query(\"staging\", arg_5, 'bool')\n        if arg_6 is not None:\n            arg_14['spellCheck'] = arg_0._serialize.query(\"spell_check\", arg_6, 'bool')\n        if arg_7 is not None:\n            arg_14['bing-spell-check-subscription-key'] = arg_0._serialize.query(\"bing_spell_check_subscription_key\", arg_7, 'str')\n        if arg_8 is not None:\n            arg_14['log'] = arg_0._serialize.query(\"log\", arg_8, 'bool')\n\n        # Construct headers\n        arg_15 = {}\n        arg_15['Accept'] = 'application/json'\n        arg_15['Content-Type'] = 'application/json; charset=utf-8'\n        if arg_9:\n            arg_15.update(arg_9)\n\n        # Construct body\n        arg_16 = arg_0._serialize.body(arg_2, 'str')\n\n        # Construct and send request\n        arg_17 = arg_0._client.post(arg_12, arg_14, arg_15, arg_16)\n        arg_18 = arg_0._client.send(arg_17, stream=False, **arg_11)\n\n        if arg_18.status_code not in [200]:\n            raise models.APIErrorException(arg_0._deserialize, arg_18)\n\n        arg_19 = None\n\n        if arg_18.status_code == 200:\n            arg_19 = arg_0._deserialize('LuisResult', arg_18)\n\n        if arg_10:\n            arg_20 = ClientRawResponse(arg_19, arg_18)\n            return arg_20\n\n        return arg_19", "path": "azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/operations/prediction_operations.py", "identifier": "PredictionOperations.resolve", "docstring": "Gets predictions for a given utterance, in the form of intents and\n        entities. The current maximum query size is 500 characters.\n\n        :param app_id: The LUIS application ID (Guid).\n        :type app_id: str\n        :param query: The utterance to predict.\n        :type query: str\n        :param timezone_offset: The timezone offset for the location of the\n         request.\n        :type timezone_offset: float\n        :param verbose: If true, return all intents instead of just the top\n         scoring intent.\n        :type verbose: bool\n        :param staging: Use the staging endpoint slot.\n        :type staging: bool\n        :param spell_check: Enable spell checking.\n        :type spell_check: bool\n        :param bing_spell_check_subscription_key: The subscription key to use\n         when enabling Bing spell check\n        :type bing_spell_check_subscription_key: str\n        :param log: Log query (default is true)\n        :type log: bool\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: LuisResult or ClientRawResponse if raw=true\n        :rtype:\n         ~azure.cognitiveservices.language.luis.runtime.models.LuisResult or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`APIErrorException<azure.cognitiveservices.language.luis.runtime.models.APIErrorException>`", "docstring_tokens": ["Gets", "predictions", "for", "a", "given", "utterance", "in", "the", "form", "of", "intents", "and", "entities", ".", "The", "current", "maximum", "query", "size", "is", "500", "characters", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255723}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/perf_attrib.py#L219-L265", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Takes perf attribution data over a period of time and computes annualized\n    multifactor alpha, multifactor sharpe, risk exposures.", "language": "python", "parameters": "(perf_attrib, risk_exposures)", "return_statement": "return summary, risk_exposure_summary", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "OrderedDict", "(", ")", "arg_3", "=", "arg_0", "[", "'total_returns'", "]", "arg_4", "=", "arg_0", "[", "'specific_returns'", "]", "arg_5", "=", "arg_0", "[", "'common_returns'", "]", "arg_2", "[", "'Annualized Specific Return'", "]", "=", "ep", ".", "annual_return", "(", "arg_4", ")", "arg_2", "[", "'Annualized Common Return'", "]", "=", "ep", ".", "annual_return", "(", "arg_5", ")", "arg_2", "[", "'Annualized Total Return'", "]", "=", "ep", ".", "annual_return", "(", "arg_3", ")", "arg_2", "[", "'Specific Sharpe Ratio'", "]", "=", "ep", ".", "sharpe_ratio", "(", "arg_4", ")", "arg_2", "[", "'Cumulative Specific Return'", "]", "=", "ep", ".", "cum_returns_final", "(", "arg_4", ")", "arg_2", "[", "'Cumulative Common Return'", "]", "=", "ep", ".", "cum_returns_final", "(", "arg_5", ")", "arg_2", "[", "'Total Returns'", "]", "=", "ep", ".", "cum_returns_final", "(", "arg_3", ")", "arg_2", "=", "pd", ".", "Series", "(", "arg_2", ",", "name", "=", "''", ")", "arg_6", "=", "[", "ep", ".", "annual_return", "(", "arg_0", "[", "c", "]", ")", "for", "c", "in", "arg_1", ".", "columns", "]", "arg_7", "=", "[", "ep", ".", "cum_returns_final", "(", "arg_0", "[", "c", "]", ")", "for", "c", "in", "arg_1", ".", "columns", "]", "arg_8", "=", "pd", ".", "DataFrame", "(", "data", "=", "OrderedDict", "(", "[", "(", "'Average Risk Factor Exposure'", ",", "arg_1", ".", "mean", "(", "axis", "=", "'rows'", ")", ")", ",", "(", "'Annualized Return'", ",", "arg_6", ")", ",", "(", "'Cumulative Return'", ",", "arg_7", ")", ",", "]", ")", ",", "index", "=", "arg_1", ".", "columns", ",", ")", "return", "arg_2", ",", "arg_8"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Takes perf attribution data over a period of time and computes annualized\n    multifactor alpha, multifactor sharpe, risk exposures.\n    \"\"\"\n    arg_2 = OrderedDict()\n    arg_3 = arg_0['total_returns']\n    arg_4 = arg_0['specific_returns']\n    arg_5 = arg_0['common_returns']\n\n    arg_2['Annualized Specific Return'] =\\\n        ep.annual_return(arg_4)\n    arg_2['Annualized Common Return'] =\\\n        ep.annual_return(arg_5)\n    arg_2['Annualized Total Return'] =\\\n        ep.annual_return(arg_3)\n\n    arg_2['Specific Sharpe Ratio'] =\\\n        ep.sharpe_ratio(arg_4)\n\n    arg_2['Cumulative Specific Return'] =\\\n        ep.cum_returns_final(arg_4)\n    arg_2['Cumulative Common Return'] =\\\n        ep.cum_returns_final(arg_5)\n    arg_2['Total Returns'] =\\\n        ep.cum_returns_final(arg_3)\n\n    arg_2 = pd.Series(arg_2, name='')\n\n    arg_6 = [ep.annual_return(arg_0[c])\n                                    for c in arg_1.columns]\n    arg_7 = [ep.cum_returns_final(arg_0[c])\n                                    for c in arg_1.columns]\n\n    arg_8 = pd.DataFrame(\n        data=OrderedDict([\n            (\n                'Average Risk Factor Exposure',\n                arg_1.mean(axis='rows')\n            ),\n            ('Annualized Return', arg_6),\n            ('Cumulative Return', arg_7),\n        ]),\n        index=arg_1.columns,\n    )\n\n    return arg_2, arg_8", "path": "pyfolio/perf_attrib.py", "identifier": "create_perf_attrib_stats", "docstring": "Takes perf attribution data over a period of time and computes annualized\n    multifactor alpha, multifactor sharpe, risk exposures.", "docstring_tokens": ["Takes", "perf", "attribution", "data", "over", "a", "period", "of", "time", "and", "computes", "annualized", "multifactor", "alpha", "multifactor", "sharpe", "risk", "exposures", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255724}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/bolt/base_bolt.py#L38-L86", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Register this bolt to the topology and create ``HeronComponentSpec``", "language": "python", "parameters": "(cls, name=None, inputs=None, par=1, config=None, optional_outputs=None)", "return_statement": "return HeronComponentSpec(name, python_class_path, is_spout=False, par=par,\n                              inputs=inputs, outputs=_outputs, config=config)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "1", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "\"%s.%s\"", "%", "(", "arg_0", ".", "__module__", ",", "arg_0", ".", "__name__", ")", "if", "hasattr", "(", "arg_0", ",", "'outputs'", ")", ":", "arg_7", "=", "copy", ".", "copy", "(", "arg_0", ".", "outputs", ")", "else", ":", "arg_7", "=", "[", "]", "if", "arg_5", "is", "not", "None", ":", "assert", "isinstance", "(", "arg_5", ",", "(", "list", ",", "tuple", ")", ")", "for", "arg_8", "in", "arg_5", ":", "assert", "isinstance", "(", "arg_8", ",", "(", "str", ",", "Stream", ")", ")", "arg_7", ".", "append", "(", "arg_8", ")", "return", "HeronComponentSpec", "(", "arg_1", ",", "arg_6", ",", "is_spout", "=", "False", ",", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "outputs", "=", "arg_7", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=1, arg_4=None, arg_5=None):\n    \"\"\"Register this bolt to the topology and create ``HeronComponentSpec``\n\n    This method takes an optional ``outputs`` argument for supporting dynamic output fields\n    declaration. However, it is recommended that ``outputs`` should be declared as\n    an attribute of your ``Bolt`` subclass. Also, some ways of declaring inputs is not supported\n    in this implementation; please read the documentation below.\n\n    :type name: str\n    :param name: Name of this bolt.\n    :type inputs: dict or list\n    :param inputs: Streams that feed into this Bolt.\n\n                   Two forms of this are acceptable:\n\n                   1. A `dict` mapping from ``HeronComponentSpec`` to ``Grouping``.\n                      In this case, default stream is used.\n                   2. A `dict` mapping from ``GlobalStreamId`` to ``Grouping``.\n                      This ``GlobalStreamId`` object itself is different from StreamParse, because\n                      Heron does not use thrift, although its constructor method is compatible.\n                   3. A `list` of ``HeronComponentSpec``. In this case, default stream with\n                      SHUFFLE grouping is used.\n                   4. A `list` of ``GlobalStreamId``. In this case, SHUFFLE grouping is used.\n    :type par: int\n    :param par: Parallelism hint for this spout.\n    :type config: dict\n    :param config: Component-Funcific config settings.\n    :type optional_outputs: list of (str or Stream) or tuple of (str or Stream)\n    :param optional_outputs: Additional output fields for this bolt. These fields are added to\n                             existing ``outputs`` class attributes of your bolt. This is an optional\n                             argument, and exists only for supporting dynamic output field\n                             declaration.\n    \"\"\"\n    arg_6 = \"%s.%s\" % (arg_0.__module__, arg_0.__name__)\n\n    if hasattr(arg_0, 'outputs'):\n      # avoid modification to cls.outputs\n      arg_7 = copy.copy(arg_0.outputs)\n    else:\n      arg_7 = []\n\n    if arg_5 is not None:\n      assert isinstance(arg_5, (list, tuple))\n      for arg_8 in arg_5:\n        assert isinstance(arg_8, (str, Stream))\n        arg_7.append(arg_8)\n\n    return HeronComponentSpec(arg_1, arg_6, is_spout=False, arg_3=arg_3,\n                              arg_2=arg_2, outputs=arg_7, arg_4=arg_4)", "path": "heronpy/api/bolt/base_bolt.py", "identifier": "BaseBolt.spec", "docstring": "Register this bolt to the topology and create ``HeronComponentSpec``\n\n    This method takes an optional ``outputs`` argument for supporting dynamic output fields\n    declaration. However, it is recommended that ``outputs`` should be declared as\n    an attribute of your ``Bolt`` subclass. Also, some ways of declaring inputs is not supported\n    in this implementation; please read the documentation below.\n\n    :type name: str\n    :param name: Name of this bolt.\n    :type inputs: dict or list\n    :param inputs: Streams that feed into this Bolt.\n\n                   Two forms of this are acceptable:\n\n                   1. A `dict` mapping from ``HeronComponentSpec`` to ``Grouping``.\n                      In this case, default stream is used.\n                   2. A `dict` mapping from ``GlobalStreamId`` to ``Grouping``.\n                      This ``GlobalStreamId`` object itself is different from StreamParse, because\n                      Heron does not use thrift, although its constructor method is compatible.\n                   3. A `list` of ``HeronComponentSpec``. In this case, default stream with\n                      SHUFFLE grouping is used.\n                   4. A `list` of ``GlobalStreamId``. In this case, SHUFFLE grouping is used.\n    :type par: int\n    :param par: Parallelism hint for this spout.\n    :type config: dict\n    :param config: Component-specific config settings.\n    :type optional_outputs: list of (str or Stream) or tuple of (str or Stream)\n    :param optional_outputs: Additional output fields for this bolt. These fields are added to\n                             existing ``outputs`` class attributes of your bolt. This is an optional\n                             argument, and exists only for supporting dynamic output field\n                             declaration.", "docstring_tokens": ["Register", "this", "bolt", "to", "the", "topology", "and", "create", "HeronComponentSpec"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255725}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L462-L480", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get input and output history from the current session. Called by\n        get_range, and takes similar parameters.", "language": "python", "parameters": "(self, start=1, stop=None, raw=True, output=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", ".", "input_hist_raw", "if", "arg_3", "else", "arg_0", ".", "input_hist_parsed", "arg_6", "=", "len", "(", "arg_5", ")", "if", "arg_1", "<", "0", ":", "arg_1", "+=", "arg_6", "if", "not", "arg_2", "or", "(", "arg_2", ">", "arg_6", ")", ":", "arg_2", "=", "arg_6", "elif", "arg_2", "<", "0", ":", "arg_2", "+=", "arg_6", "for", "arg_7", "in", "range", "(", "arg_1", ",", "arg_2", ")", ":", "if", "arg_4", ":", "arg_8", "=", "(", "arg_5", "[", "arg_7", "]", ",", "arg_0", ".", "output_hist_reprs", ".", "get", "(", "arg_7", ")", ")", "else", ":", "arg_8", "=", "arg_5", "[", "arg_7", "]", "yield", "(", "0", ",", "arg_7", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1=1, arg_2=None, arg_3=True, arg_4=False):\n        \"\"\"Get input and output history from the current session. Called by\n        get_range, and takes similar parameters.\"\"\"\n        arg_5 = arg_0.input_hist_raw if arg_3 else arg_0.input_hist_parsed\n            \n        arg_6 = len(arg_5)\n        if arg_1 < 0:\n            arg_1 += arg_6\n        if not arg_2 or (arg_2 > arg_6):\n            arg_2 = arg_6\n        elif arg_2 < 0:\n            arg_2 += arg_6\n        \n        for arg_7 in range(arg_1, arg_2):\n            if arg_4:\n                arg_8 = (arg_5[arg_7], arg_0.output_hist_reprs.get(arg_7))\n            else:\n                arg_8 = arg_5[arg_7]\n            yield (0, arg_7, arg_8)", "path": "environment/lib/python2.7/site-packages/IPython/core/history.py", "identifier": "HistoryManager._get_range_session", "docstring": "Get input and output history from the current session. Called by\n        get_range, and takes similar parameters.", "docstring_tokens": ["Get", "input", "and", "output", "history", "from", "the", "current", "session", ".", "Called", "by", "get_range", "and", "takes", "similar", "parameters", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255726}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-keyvault/azure/keyvault/v2016_10_01/key_vault_client.py#L2828-L2907", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Sets the specified certificate issuer.", "language": "python", "parameters": "(\n            self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "False", ",", "**", "arg_9", ")", ":", "arg_10", "=", "models", ".", "CertificateIssuerSetParameters", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_11", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_12", "=", "{", "'vaultBaseUrl'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"vault_base_url\"", ",", "arg_1", ",", "'str'", ",", "skip_quote", "=", "True", ")", ",", "'issuer-name'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"issuer_name\"", ",", "arg_2", ",", "'str'", ")", "}", "arg_11", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_11", ",", "**", "arg_12", ")", "arg_13", "=", "{", "}", "arg_13", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "arg_14", "=", "{", "}", "arg_14", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_14", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_7", ":", "arg_14", ".", "update", "(", "arg_7", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_14", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_15", "=", "arg_0", ".", "_serialize", ".", "body", "(", "arg_10", ",", "'CertificateIssuerSetParameters'", ")", "arg_16", "=", "arg_0", ".", "_client", ".", "put", "(", "arg_11", ",", "arg_13", ")", "arg_17", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_16", ",", "arg_14", ",", "arg_15", ",", "stream", "=", "False", ",", "**", "arg_9", ")", "if", "arg_17", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "KeyVaultErrorException", "(", "arg_0", ".", "_deserialize", ",", "arg_17", ")", "arg_18", "=", "None", "if", "arg_17", ".", "status_code", "==", "200", ":", "arg_18", "=", "arg_0", ".", "_deserialize", "(", "'IssuerBundle'", ",", "arg_17", ")", "if", "arg_8", ":", "arg_19", "=", "ClientRawResponse", "(", "arg_18", ",", "arg_17", ")", "return", "arg_19", "return", "arg_18"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=False, **arg_9):\n        \"\"\"Sets the specified certificate issuer.\n\n        The SetCertificateIssuer operation adds or updates the specified\n        certificate issuer. This operation requires the certificates/setissuers\n        permission.\n\n        :param vault_base_url: The vault name, for example\n         https://myvault.vault.azure.net.\n        :type vault_base_url: str\n        :param issuer_name: The name of the issuer.\n        :type issuer_name: str\n        :param provider: The issuer provider.\n        :type provider: str\n        :param credentials: The credentials to be used for the issuer.\n        :type credentials:\n         ~azure.keyvault.v2016_10_01.models.IssuerCredentials\n        :param organization_details: Details of the organization as provided\n         to the issuer.\n        :type organization_details:\n         ~azure.keyvault.v2016_10_01.models.OrganizationDetails\n        :param attributes: Attributes of the issuer object.\n        :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: IssuerBundle or ClientRawResponse if raw=true\n        :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`KeyVaultErrorException<azure.keyvault.v2016_10_01.models.KeyVaultErrorException>`\n        \"\"\"\n        arg_10 = models.CertificateIssuerSetParameters(arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_6=arg_6)\n\n        # Construct URL\n        arg_11 = arg_0.Func.metadata['url']\n        arg_12 = {\n            'vaultBaseUrl': arg_0._serialize.url(\"vault_base_url\", arg_1, 'str', skip_quote=True),\n            'issuer-name': arg_0._serialize.url(\"issuer_name\", arg_2, 'str')\n        }\n        arg_11 = arg_0._client.format_url(arg_11, **arg_12)\n\n        # Construct parameters\n        arg_13 = {}\n        arg_13['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n\n        # Construct headers\n        arg_14 = {}\n        arg_14['Content-Type'] = 'application/json; charset=utf-8'\n        if arg_0.config.generate_client_request_id:\n            arg_14['x-ms-client-request-id'] = str(uuid.uuid1())\n        if arg_7:\n            arg_14.update(arg_7)\n        if arg_0.config.accept_language is not None:\n            arg_14['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n        # Construct body\n        arg_15 = arg_0._serialize.body(arg_10, 'CertificateIssuerSetParameters')\n\n        # Construct and send request\n        arg_16 = arg_0._client.put(arg_11, arg_13)\n        arg_17 = arg_0._client.send(\n            arg_16, arg_14, arg_15, stream=False, **arg_9)\n\n        if arg_17.status_code not in [200]:\n            raise models.KeyVaultErrorException(arg_0._deserialize, arg_17)\n\n        arg_18 = None\n\n        if arg_17.status_code == 200:\n            arg_18 = arg_0._deserialize('IssuerBundle', arg_17)\n\n        if arg_8:\n            arg_19 = ClientRawResponse(arg_18, arg_17)\n            return arg_19\n\n        return arg_18", "path": "azure-keyvault/azure/keyvault/v2016_10_01/key_vault_client.py", "identifier": "KeyVaultClient.set_certificate_issuer", "docstring": "Sets the specified certificate issuer.\n\n        The SetCertificateIssuer operation adds or updates the specified\n        certificate issuer. This operation requires the certificates/setissuers\n        permission.\n\n        :param vault_base_url: The vault name, for example\n         https://myvault.vault.azure.net.\n        :type vault_base_url: str\n        :param issuer_name: The name of the issuer.\n        :type issuer_name: str\n        :param provider: The issuer provider.\n        :type provider: str\n        :param credentials: The credentials to be used for the issuer.\n        :type credentials:\n         ~azure.keyvault.v2016_10_01.models.IssuerCredentials\n        :param organization_details: Details of the organization as provided\n         to the issuer.\n        :type organization_details:\n         ~azure.keyvault.v2016_10_01.models.OrganizationDetails\n        :param attributes: Attributes of the issuer object.\n        :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: IssuerBundle or ClientRawResponse if raw=true\n        :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`KeyVaultErrorException<azure.keyvault.v2016_10_01.models.KeyVaultErrorException>`", "docstring_tokens": ["Sets", "the", "specified", "certificate", "issuer", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255727}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_json_stream.py#L200-L210", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Convert a file in some other encoding into a temporary file that's in\n    UTF-8.", "language": "python", "parameters": "(filename, encoding)", "return_statement": "return tmp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tempfile", ".", "TemporaryFile", "(", ")", "for", "arg_3", "in", "io", ".", "open", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", ":", "arg_2", ".", "write", "(", "arg_3", ".", "strip", "(", "'\\uFEFF'", ")", ".", "encode", "(", "'utf-8'", ")", ")", "arg_2", ".", "seek", "(", "0", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Convert a file in some other encoding into a temporary file that's in\n    UTF-8.\n    \"\"\"\n    arg_2 = tempfile.TemporaryFile()\n    for arg_3 in io.open(arg_0, arg_1=arg_1):\n        arg_2.write(arg_3.strip('\\uFEFF').encode('utf-8'))\n\n    arg_2.seek(0)\n    return arg_2", "path": "luminoso_api/v4_json_stream.py", "identifier": "transcode_to_utf8", "docstring": "Convert a file in some other encoding into a temporary file that's in\n    UTF-8.", "docstring_tokens": ["Convert", "a", "file", "in", "some", "other", "encoding", "into", "a", "temporary", "file", "that", "s", "in", "UTF", "-", "8", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 255728}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/abstractcpu.py#L709-L722", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Read from memory.", "language": "python", "parameters": "(self, where, size, force=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "range", "(", "arg_2", ")", ":", "arg_4", ".", "append", "(", "Operators", ".", "CHR", "(", "arg_0", ".", "read_int", "(", "arg_1", "+", "arg_5", ",", "8", ",", "arg_3", ")", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"\n        Read from memory.\n\n        :param int where: address to read data from\n        :param int size: number of bytes\n        :param force: whether to ignore memory permissions\n        :return: data\n        :rtype: list[int or Expression]\n        \"\"\"\n        arg_4 = []\n        for arg_5 in range(arg_2):\n            arg_4.append(Operators.CHR(arg_0.read_int(arg_1 + arg_5, 8, arg_3)))\n        return arg_4", "path": "manticore/native/cpu/abstractcpu.py", "identifier": "Cpu.read_bytes", "docstring": "Read from memory.\n\n        :param int where: address to read data from\n        :param int size: number of bytes\n        :param force: whether to ignore memory permissions\n        :return: data\n        :rtype: list[int or Expression]", "docstring_tokens": ["Read", "from", "memory", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 255729}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L403-L473", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Copy files from the given source to the target.", "language": "python", "parameters": "(source_dir, target_dir, create_target_dir=False, md5_check=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "import", "fnmatch", "if", "IsDir", "(", "arg_0", ")", ":", "arg_4", "=", "'*'", "else", ":", "arg_0", ",", "arg_4", "=", "os", ".", "path", ".", "split", "(", "arg_0", ")", "if", "not", "IsDir", "(", "arg_1", ")", ":", "if", "arg_2", ":", "CreateDirectory", "(", "arg_1", ")", "else", ":", "from", ".", "_exceptions", "import", "DirectoryNotFoundError", "raise", "DirectoryNotFoundError", "(", "arg_1", ")", "arg_5", "=", "ListFiles", "(", "arg_0", ")", "if", "arg_5", "is", "None", ":", "return", "for", "arg_6", "in", "arg_5", ":", "if", "arg_3", "and", "arg_6", ".", "endswith", "(", "'.md5'", ")", ":", "continue", "if", "fnmatch", ".", "fnmatch", "(", "arg_6", ",", "arg_4", ")", ":", "arg_7", "=", "arg_0", "+", "'/'", "+", "arg_6", "arg_8", "=", "arg_1", "+", "'/'", "+", "arg_6", "if", "IsDir", "(", "arg_7", ")", ":", "Func", "(", "arg_7", ",", "arg_8", ",", "arg_2", "=", "True", ",", "arg_3", "=", "arg_3", ")", "else", ":", "CopyFile", "(", "arg_7", ",", "arg_8", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False):\n    '''\n    Copy files from the given source to the target.\n\n    :param unicode source_dir:\n        A filename, URL or a file mask.\n        Ex.\n            x:\\coilib50\n            x:\\coilib50\\*\n            http://server/directory/file\n            ftp://server/directory/file\n\n\n    :param unicode target_dir:\n        A directory or an URL\n        Ex.\n            d:\\Temp\n            ftp://server/directory\n\n    :param bool create_target_dir:\n        If True, creates the target path if it doesn't exists.\n\n    :param bool md5_check:\n        .. seealso:: CopyFile\n\n    :raises DirectoryNotFoundError:\n        If target_dir does not exist, and create_target_dir is False\n\n    .. seealso:: CopyFile for documentation on accepted protocols\n\n    .. seealso:: FTP LIMITATIONS at this module's doc for performance issues information\n    '''\n    import fnmatch\n\n    # Check if we were given a directory or a directory with mask\n    if IsDir(arg_0):\n        # Yes, it's a directory, copy everything from it\n        arg_4 = '*'\n    else:\n        # Split directory and mask\n        arg_0, arg_4 = os.path.split(arg_0)\n\n    # Create directory if necessary\n    if not IsDir(arg_1):\n        if arg_2:\n            CreateDirectory(arg_1)\n        else:\n            from ._exceptions import DirectoryNotFoundError\n            raise DirectoryNotFoundError(arg_1)\n\n    # List and match files\n    arg_5 = ListFiles(arg_0)\n\n    # Check if we have a source directory\n    if arg_5 is None:\n        return\n\n    # Copy files\n    for arg_6 in arg_5:\n        if arg_3 and arg_6.endswith('.md5'):\n            continue  # md5 files will be copied by CopyFile when copying their associated files\n\n        if fnmatch.fnmatch(arg_6, arg_4):\n            arg_7 = arg_0 + '/' + arg_6\n            arg_8 = arg_1 + '/' + arg_6\n\n            if IsDir(arg_7):\n                # If we found a directory, copy it recursively\n                Func(arg_7, arg_8, arg_2=True, arg_3=arg_3)\n            else:\n                CopyFile(arg_7, arg_8, arg_3=arg_3)", "path": "zerotk/easyfs/_easyfs.py", "identifier": "CopyFiles", "docstring": "Copy files from the given source to the target.\n\n    :param unicode source_dir:\n        A filename, URL or a file mask.\n        Ex.\n            x:\\coilib50\n            x:\\coilib50\\*\n            http://server/directory/file\n            ftp://server/directory/file\n\n\n    :param unicode target_dir:\n        A directory or an URL\n        Ex.\n            d:\\Temp\n            ftp://server/directory\n\n    :param bool create_target_dir:\n        If True, creates the target path if it doesn't exists.\n\n    :param bool md5_check:\n        .. seealso:: CopyFile\n\n    :raises DirectoryNotFoundError:\n        If target_dir does not exist, and create_target_dir is False\n\n    .. seealso:: CopyFile for documentation on accepted protocols\n\n    .. seealso:: FTP LIMITATIONS at this module's doc for performance issues information", "docstring_tokens": ["Copy", "files", "from", "the", "given", "source", "to", "the", "target", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 255730}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L431-L494", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Layout the graph incrementally.\n        \n        The graph is drawn at the center of the canvas.\n        The weighted and directed parameters visualize edge weight and direction.\n        The highlight specifies list of connected nodes. \n        The path will be colored according to the \"highlight\" style.\n        Clicking and dragging events are monitored.", "language": "python", "parameters": "(self, dx=0, dy=0, weighted=False, directed=False, highlight=[], traffic=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "[", "]", ",", "arg_6", "=", "None", ")", ":", "arg_0", ".", "update", "(", ")", "arg_7", "=", "arg_0", ".", "styles", ".", "default", "arg_7", ".", "graph_background", "(", "arg_7", ")", "_ctx", ".", "push", "(", ")", "_ctx", ".", "translate", "(", "arg_0", ".", "x", "+", "arg_1", ",", "arg_0", ".", "y", "+", "arg_2", ")", "if", "arg_6", ":", "if", "isinstance", "(", "arg_6", ",", "bool", ")", ":", "arg_6", "=", "5", "for", "arg_8", "in", "arg_0", ".", "nodes_by_betweenness", "(", ")", "[", ":", "arg_6", "]", ":", "try", ":", "arg_7", "=", "arg_0", ".", "styles", "[", "arg_8", ".", "style", "]", "except", ":", "arg_7", "=", "arg_0", ".", "styles", ".", "default", "if", "arg_7", ".", "graph_traffic", ":", "arg_7", ".", "graph_traffic", "(", "arg_7", ",", "arg_8", ",", "arg_0", ".", "alpha", ")", "arg_7", "=", "arg_0", ".", "styles", ".", "default", "if", "arg_7", ".", "edges", ":", "arg_7", ".", "edges", "(", "arg_7", ",", "arg_0", ".", "edges", ",", "arg_0", ".", "alpha", ",", "arg_3", ",", "arg_4", ")", "for", "arg_8", "in", "arg_0", ".", "nodes", ":", "try", ":", "arg_7", "=", "arg_0", ".", "styles", "[", "arg_8", ".", "style", "]", "except", ":", "arg_7", "=", "arg_0", ".", "styles", ".", "default", "if", "arg_7", ".", "node", ":", "arg_7", ".", "node", "(", "arg_7", ",", "arg_8", ",", "arg_0", ".", "alpha", ")", "try", ":", "arg_7", "=", "arg_0", ".", "styles", ".", "highlight", "except", ":", "arg_7", "=", "arg_0", ".", "styles", ".", "default", "if", "arg_7", ".", "path", ":", "arg_7", ".", "path", "(", "arg_7", ",", "arg_0", ",", "arg_5", ")", "for", "arg_8", "in", "arg_0", ".", "nodes", ":", "try", ":", "arg_7", "=", "arg_0", ".", "styles", "[", "arg_8", ".", "style", "]", "except", ":", "arg_7", "=", "arg_0", ".", "styles", ".", "default", "if", "arg_7", ".", "node_label", ":", "arg_7", ".", "node_label", "(", "arg_7", ",", "arg_8", ",", "arg_0", ".", "alpha", ")", "_ctx", ".", "pop", "(", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=0, arg_3=False, arg_4=False, arg_5=[], arg_6=None):\n        \n        \"\"\" Layout the graph incrementally.\n        \n        The graph is Funcn at the center of the canvas.\n        The weighted and directed parameters visualize edge weight and direction.\n        The highlight specifies list of connected nodes. \n        The path will be colored according to the \"highlight\" style.\n        Clicking and dragging events are monitored.\n        \n        \"\"\"\n        \n        arg_0.update()\n\n        # Draw the graph background.\n        arg_7 = arg_0.styles.default\n        arg_7.graph_background(arg_7)\n\n        # Center the graph on the canvas.\n        _ctx.push()\n        _ctx.translate(arg_0.x+arg_1, arg_0.y+arg_2)\n \n        # Indicate betweenness centrality.\n        if arg_6:\n            if isinstance(arg_6, bool): \n                arg_6 = 5\n            for arg_8 in arg_0.nodes_by_betweenness()[:arg_6]:\n                try: arg_7 = arg_0.styles[arg_8.style]\n                except: arg_7 = arg_0.styles.default\n                if arg_7.graph_traffic:\n                    arg_7.graph_traffic(arg_7, arg_8, arg_0.alpha)        \n\n        # Draw the edges and their labels.\n        arg_7 = arg_0.styles.default\n        if arg_7.edges:\n            arg_7.edges(arg_7, arg_0.edges, arg_0.alpha, arg_3, arg_4)\n        \n        # Draw each node in the graph.\n        # Apply individual style to each node (or default).        \n        for arg_8 in arg_0.nodes:\n            try:  arg_7 = arg_0.styles[arg_8.style]\n            except: arg_7 = arg_0.styles.default\n            if arg_7.node:\n                arg_7.node(arg_7, arg_8, arg_0.alpha)\n        \n        # Highlight the given shortest path.\n        try: arg_7 = arg_0.styles.highlight\n        except: arg_7 = arg_0.styles.default\n        if arg_7.path:\n            arg_7.path(arg_7, arg_0, arg_5)\n\n        # Draw node id's as labels on each node.\n        for arg_8 in arg_0.nodes:\n            try:  arg_7 = arg_0.styles[arg_8.style]\n            except: arg_7 = arg_0.styles.default\n            if arg_7.node_label:\n                arg_7.node_label(arg_7, arg_8, arg_0.alpha)\n        \n        # Events for clicked and dragged nodes.\n        # Nodes will resist being dragged by attraction and repulsion,\n        # put the event listener on top to get more direct feedback.\n        #self.events.update()\n        \n        _ctx.pop()", "path": "lib/graph/__init__.py", "identifier": "graph.draw", "docstring": "Layout the graph incrementally.\n        \n        The graph is drawn at the center of the canvas.\n        The weighted and directed parameters visualize edge weight and direction.\n        The highlight specifies list of connected nodes. \n        The path will be colored according to the \"highlight\" style.\n        Clicking and dragging events are monitored.", "docstring_tokens": ["Layout", "the", "graph", "incrementally", ".", "The", "graph", "is", "drawn", "at", "the", "center", "of", "the", "canvas", ".", "The", "weighted", "and", "directed", "parameters", "visualize", "edge", "weight", "and", "direction", ".", "The", "highlight", "specifies", "list", "of", "connected", "nodes", ".", "The", "path", "will", "be", "colored", "according", "to", "the", "highlight", "style", ".", "Clicking", "and", "dragging", "events", "are", "monitored", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255731}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/util/array_util.py#L359-L389", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Write a 2D NumPy array to a .fits file.", "language": "python", "parameters": "(array_2d, file_path, overwrite=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_2", "and", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "os", ".", "remove", "(", "arg_1", ")", "arg_3", "=", "fits", ".", "Header", "(", ")", "arg_4", "=", "fits", ".", "PrimaryHDU", "(", "np", ".", "flipud", "(", "arg_0", ")", ",", "arg_3", ")", "arg_4", ".", "writeto", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"Write a 2D NumPy array to a .fits file.\n\n    Before outputting a NumPy array, the array is flipped upside-down using np.flipud. This is so that the arrays \\\n    appear the same orientation as .fits files loaded in DS9.\n\n    Parameters\n    ----------\n    array_2d : ndarray\n        The 2D array that is written to fits.\n    file_path : str\n        The full path of the file that is output, including the file name and '.fits' extension.\n    overwrite : bool\n        If True and a file already exists with the input file_path the .fits file is overwritten. If False, an error \\\n        will be raised.\n\n    Returns\n    -------\n    None\n\n    Examples\n    --------\n    array_2d = np.ones((5,5))\n    numpy_array_to_fits(array=array_2d, file_path='/path/to/file/filename.fits', overwrite=True)\n    \"\"\"\n    if arg_2 and os.path.exists(arg_1):\n        os.remove(arg_1)\n\n    arg_3 = fits.Header()\n    arg_4 = fits.PrimaryHDU(np.flipud(arg_0), arg_3)\n    arg_4.writeto(arg_1)", "path": "autolens/data/array/util/array_util.py", "identifier": "numpy_array_2d_to_fits", "docstring": "Write a 2D NumPy array to a .fits file.\n\n    Before outputting a NumPy array, the array is flipped upside-down using np.flipud. This is so that the arrays \\\n    appear the same orientation as .fits files loaded in DS9.\n\n    Parameters\n    ----------\n    array_2d : ndarray\n        The 2D array that is written to fits.\n    file_path : str\n        The full path of the file that is output, including the file name and '.fits' extension.\n    overwrite : bool\n        If True and a file already exists with the input file_path the .fits file is overwritten. If False, an error \\\n        will be raised.\n\n    Returns\n    -------\n    None\n\n    Examples\n    --------\n    array_2d = np.ones((5,5))\n    numpy_array_to_fits(array=array_2d, file_path='/path/to/file/filename.fits', overwrite=True)", "docstring_tokens": ["Write", "a", "2D", "NumPy", "array", "to", "a", ".", "fits", "file", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 255732}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/search.py#L81-L105", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Search for TV shows by title.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Search for TV shows by title.\n\n        Args:\n            query: CGI escpaed string.\n            page: (optional) Minimum value of 1. Expected value is an integer.\n            language: (optional) ISO 639-1 code.\n            first_air_date_year: (optional) Filter the results to only match \n                                 shows that have a air date with with value.\n            search_type: (optional) By default, the search type is 'phrase'. \n                         This is almost guaranteed the option you will want. \n                         It's a great all purpose search type and by far the \n                         most tuned for every day querying. For those wanting \n                         more of an \"autocomplete\" type search, set this \n                         option to 'ngram'.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/search.py", "identifier": "Search.tv", "docstring": "Search for TV shows by title.\n\n        Args:\n            query: CGI escpaed string.\n            page: (optional) Minimum value of 1. Expected value is an integer.\n            language: (optional) ISO 639-1 code.\n            first_air_date_year: (optional) Filter the results to only match \n                                 shows that have a air date with with value.\n            search_type: (optional) By default, the search type is 'phrase'. \n                         This is almost guaranteed the option you will want. \n                         It's a great all purpose search type and by far the \n                         most tuned for every day querying. For those wanting \n                         more of an \"autocomplete\" type search, set this \n                         option to 'ngram'.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Search", "for", "TV", "shows", "by", "title", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 255733}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L477-L483", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Mark the name as consumed and delete it from\n        the to_consume dictionary", "language": "python", "parameters": "(self, name, new_node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "consumed", "[", "arg_1", "]", "=", "arg_2", "del", "arg_0", ".", "to_consume", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Mark the name as consumed and delete it from\n        the to_consume dictionary\n        \"\"\"\n        arg_0.consumed[arg_1] = arg_2\n        del arg_0.to_consume[arg_1]", "path": "pylint/checkers/variables.py", "identifier": "NamesConsumer.mark_as_consumed", "docstring": "Mark the name as consumed and delete it from\n        the to_consume dictionary", "docstring_tokens": ["Mark", "the", "name", "as", "consumed", "and", "delete", "it", "from", "the", "to_consume", "dictionary"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255734}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/metric_create_bulk.py#L63-L86", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "1) Get command line arguments\n        2) Read the JSON file\n        3) Parse into a dictionary\n        4) Create or update definitions using API call", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "v2Metrics", "=", "arg_0", ".", "metricDefinitionV2", "(", "arg_0", ".", "metrics", ")", "if", "arg_0", ".", "v2Metrics", ":", "arg_2", "=", "arg_0", ".", "metrics", "else", ":", "arg_2", "=", "arg_0", ".", "metrics", "[", "'result'", "]", "for", "arg_3", "in", "arg_2", ":", "if", "arg_0", ".", "v2Metrics", ":", "arg_4", "=", "arg_2", "[", "arg_3", "]", "arg_4", "[", "'name'", "]", "=", "arg_3", "else", ":", "arg_4", "=", "arg_3", "arg_0", ".", "create_update", "(", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        1) Get command line arguments\n        2) Read the JSON file\n        3) Parse into a dictionary\n        4) Create or update definitions using API call\n        \"\"\"\n\n        arg_0.v2Metrics = arg_0.metricDefinitionV2(arg_0.metrics)\n        if arg_0.v2Metrics:\n            arg_2 = arg_0.metrics\n\n        else:\n            arg_2 = arg_0.metrics['result']\n\n        # Loop through the metrics and call the API\n        # to create/update\n        for arg_3 in arg_2:\n            if arg_0.v2Metrics:\n                arg_4 = arg_2[arg_3]\n                arg_4['name'] = arg_3\n            else:\n                arg_4 = arg_3\n            arg_0.create_update(arg_4)", "path": "boundary/metric_create_bulk.py", "identifier": "MetricCreateBulk.import_metrics", "docstring": "1) Get command line arguments\n        2) Read the JSON file\n        3) Parse into a dictionary\n        4) Create or update definitions using API call", "docstring_tokens": ["1", ")", "Get", "command", "line", "arguments", "2", ")", "Read", "the", "JSON", "file", "3", ")", "Parse", "into", "a", "dictionary", "4", ")", "Create", "or", "update", "definitions", "using", "API", "call"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 255735}
{"url": "https://github.com/calebsmith/django-template-debug/blob/f3d52638da571164d63e5c8331d409b0743c628f/template_debug/templatetags/debug_tags.py#L77-L98", "sha": "f3d52638da571164d63e5c8331d409b0743c628f", "docstring_summary": "Start a pdb set_trace inside of the template with the context available as\n    'context'. Uses ipdb if available.", "language": "python", "parameters": "(context)", "return_statement": "return ''", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "import", "ipdb", "as", "pdb", "except", "ImportError", ":", "import", "pdb", "print", "(", "\"For best results, pip install ipdb.\"", ")", "print", "(", "\"Variables that are available in the current context:\"", ")", "arg_1", "=", "lambda", "s", ":", "template", ".", "Template", "(", "s", ")", ".", "render", "(", "arg_0", ")", "arg_2", "=", "get_variables", "(", "arg_0", ")", "pprint", "(", "arg_2", ")", "print", "(", "'Type `availables` to show this list.'", ")", "print", "(", "'Type <variable_name> to access one.'", ")", "print", "(", "'Use render(\"template string\") to test template rendering'", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "(", ")", "[", "arg_3", "]", "=", "arg_0", "[", "arg_3", "]", "pdb", ".", "Func", "(", ")", "return", "''"], "function": "def Func(arg_0):\n    \"\"\"\n    Start a pdb Func inside of the template with the context available as\n    'context'. Uses ipdb if available.\n    \"\"\"\n    try:\n        import ipdb as pdb\n    except ImportError:\n        import pdb\n        print(\"For best results, pip install ipdb.\")\n    print(\"Variables that are available in the current context:\")\n    arg_1 = lambda s: template.Template(s).render(arg_0)\n    arg_2 = get_variables(arg_0)\n    pprint(arg_2)\n    print('Type `availables` to show this list.')\n    print('Type <variable_name> to access one.')\n    print('Use render(\"template string\") to test template rendering')\n    # Cram context variables into the local scope\n    for arg_3 in arg_2:\n        arg_4()[arg_3] = arg_0[arg_3]\n    pdb.Func()\n    return ''", "path": "template_debug/templatetags/debug_tags.py", "identifier": "set_trace", "docstring": "Start a pdb set_trace inside of the template with the context available as\n    'context'. Uses ipdb if available.", "docstring_tokens": ["Start", "a", "pdb", "set_trace", "inside", "of", "the", "template", "with", "the", "context", "available", "as", "context", ".", "Uses", "ipdb", "if", "available", "."], "nwo": "calebsmith/django-template-debug", "score": 0.31606306836212245, "idx": 255736}
{"url": "https://github.com/Scifabric/pybossa-client/blob/998d7cb0207ff5030dc800f0c2577c5692316c2c/pbclient/__init__.py#L348-L363", "sha": "998d7cb0207ff5030dc800f0c2577c5692316c2c", "docstring_summary": "Return a list with matching Category arguments.", "language": "python", "parameters": "(**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "try", ":", "arg_1", "=", "_pybossa_req", "(", "'get'", ",", "'category'", ",", "params", "=", "arg_0", ")", "if", "type", "(", "arg_1", ")", ".", "__name__", "==", "'list'", ":", "return", "[", "Category", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]", "else", ":", "return", "arg_1", "except", ":", "raise"], "function": "def Func(**arg_0):\n    \"\"\"Return a list with matching Category arguments.\n\n    :param kwargs: PYBOSSA Category members\n    :rtype: list\n    :returns: A list of project that match the kwargs\n\n    \"\"\"\n    try:\n        arg_1 = _pybossa_req('get', 'category', params=arg_0)\n        if type(arg_1).__name__ == 'list':\n            return [Category(arg_2) for arg_2 in arg_1]\n        else:\n            return arg_1\n    except:  # pragma: no cover\n        raise", "path": "pbclient/__init__.py", "identifier": "find_category", "docstring": "Return a list with matching Category arguments.\n\n    :param kwargs: PYBOSSA Category members\n    :rtype: list\n    :returns: A list of project that match the kwargs", "docstring_tokens": ["Return", "a", "list", "with", "matching", "Category", "arguments", "."], "nwo": "Scifabric/pybossa-client", "score": 0.27831918678159157, "idx": 255737}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/api.py#L106-L118", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Iterator over all API endpoint names and callbacks.", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "dir", "(", "arg_0", ")", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "getattr", "(", "arg_2", ",", "'api_path'", ",", "None", ")", "if", "arg_3", ":", "yield", "(", "'%s%s'", "%", "(", "arg_0", ".", "api_path_prefix", ",", "arg_3", ")", ",", "arg_2", ",", ")", "for", "arg_4", "in", "arg_0", ".", "api_providers", ":", "for", "arg_3", ",", "arg_2", "in", "Func", "(", "arg_4", ")", ":", "yield", "(", "arg_3", ",", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Iterator over all API endpoint names and callbacks.\"\"\"\n    for arg_1 in dir(arg_0):\n        arg_2 = getattr(arg_0, arg_1)\n        arg_3 = getattr(arg_2, 'api_path', None)\n        if arg_3:\n            yield (\n                '%s%s' % (arg_0.api_path_prefix, arg_3),\n                arg_2,\n            )\n    for arg_4 in arg_0.api_providers:\n        for arg_3, arg_2 in Func(arg_4):\n            yield (arg_3, arg_2)", "path": "dddp/api.py", "identifier": "api_endpoints", "docstring": "Iterator over all API endpoint names and callbacks.", "docstring_tokens": ["Iterator", "over", "all", "API", "endpoint", "names", "and", "callbacks", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 255738}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/custom_cluster.py#L101-L134", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Get AAD token", "language": "python", "parameters": "(endpoint, no_verify)", "return_statement": "return token, context.cache", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "azure", ".", "servicefabric", ".", "service_fabric_client_ap_is", "import", "(", "ServiceFabricClientAPIs", ")", "from", "sfctl", ".", "auth", "import", "ClientCertAuthentication", "from", "sfctl", ".", "config", "import", "set_aad_metadata", "arg_2", "=", "ClientCertAuthentication", "(", "None", ",", "None", ",", "arg_1", ")", "arg_3", "=", "ServiceFabricClientAPIs", "(", "arg_2", ",", "base_url", "=", "arg_0", ")", "arg_4", "=", "arg_3", ".", "get_aad_metadata", "(", ")", "if", "arg_4", ".", "type", "!=", "\"aad\"", ":", "raise", "CLIError", "(", "\"Not AAD cluster\"", ")", "arg_5", "=", "arg_4", ".", "metadata", "arg_6", "=", "arg_5", ".", "tenant", "arg_7", "=", "arg_5", ".", "login", "+", "'/'", "+", "arg_6", "arg_8", "=", "adal", ".", "AuthenticationContext", "(", "arg_7", ",", "api_version", "=", "None", ")", "arg_9", "=", "arg_5", ".", "cluster", "arg_10", "=", "arg_5", ".", "client", "set_aad_metadata", "(", "arg_7", ",", "arg_9", ",", "arg_10", ")", "arg_11", "=", "arg_8", ".", "acquire_user_code", "(", "arg_9", ",", "arg_10", ")", "print", "(", "arg_11", "[", "'message'", "]", ")", "arg_12", "=", "arg_8", ".", "acquire_token_with_device_code", "(", "arg_9", ",", "arg_11", ",", "arg_10", ")", "print", "(", "\"Succeed!\"", ")", "return", "arg_12", ",", "arg_8", ".", "cache"], "function": "def Func(arg_0, arg_1):\n    #pylint: disable-msg=too-many-locals\n    \"\"\"Get AAD token\"\"\"\n    from azure.servicefabric.service_fabric_client_ap_is import (\n        ServiceFabricClientAPIs\n    )\n    from sfctl.auth import ClientCertAuthentication\n    from sfctl.config import set_aad_metadata\n\n    arg_2 = ClientCertAuthentication(None, None, arg_1)\n\n    arg_3 = ServiceFabricClientAPIs(arg_2, base_url=arg_0)\n    arg_4 = arg_3.get_aad_metadata()\n\n    if arg_4.type != \"aad\":\n        raise CLIError(\"Not AAD cluster\")\n\n    arg_5 = arg_4.metadata\n\n    arg_6 = arg_5.tenant\n    arg_7 = arg_5.login + '/' + arg_6\n    arg_8 = adal.AuthenticationContext(arg_7,\n                                         api_version=None)\n    arg_9 = arg_5.cluster\n    arg_10 = arg_5.client\n\n    set_aad_metadata(arg_7, arg_9, arg_10)\n\n    arg_11 = arg_8.acquire_user_code(arg_9, arg_10)\n    print(arg_11['message'])\n    arg_12 = arg_8.acquire_token_with_device_code(\n        arg_9, arg_11, arg_10)\n    print(\"Succeed!\")\n    return arg_12, arg_8.cache", "path": "rcctl/rcctl/custom_cluster.py", "identifier": "get_aad_token", "docstring": "Get AAD token", "docstring_tokens": ["Get", "AAD", "token"], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 255739}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/client.py#L508-L562", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Returns a redirect response to the remote authorization URL with\n        the signed callback given.", "language": "python", "parameters": "(self, callback=None, state=None, **kwargs)", "return_statement": "return redirect(url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "dict", "(", "arg_0", ".", "request_token_params", ")", "or", "{", "}", "arg_4", ".", "update", "(", "**", "arg_3", ")", "if", "arg_0", ".", "request_token_url", ":", "arg_5", "=", "arg_0", ".", "generate_request_token", "(", "arg_1", ")", "[", "0", "]", "arg_6", "=", "'%s?oauth_token=%s'", "%", "(", "arg_0", ".", "expand_url", "(", "arg_0", ".", "Func_url", ")", ",", "url_quote", "(", "arg_5", ")", ")", "if", "arg_4", ":", "arg_6", "+=", "'&'", "+", "url_encode", "(", "arg_4", ")", "else", ":", "assert", "arg_1", "is", "not", "None", ",", "'Callback is required for OAuth2'", "arg_7", "=", "arg_0", ".", "make_client", "(", ")", "if", "'scope'", "in", "arg_4", ":", "arg_8", "=", "arg_4", ".", "pop", "(", "'scope'", ")", "else", ":", "arg_8", "=", "None", "if", "isinstance", "(", "arg_8", ",", "str", ")", ":", "arg_8", "=", "_encode", "(", "arg_8", ",", "arg_0", ".", "encoding", ")", "if", "'state'", "in", "arg_4", ":", "if", "not", "arg_2", ":", "arg_2", "=", "arg_4", ".", "pop", "(", "'state'", ")", "else", ":", "arg_4", ".", "pop", "(", "'state'", ")", "if", "callable", "(", "arg_2", ")", ":", "arg_2", "=", "arg_2", "(", ")", "arg_9", "[", "'%s_oauthredir'", "%", "arg_0", ".", "name", "]", "=", "arg_1", "arg_6", "=", "arg_7", ".", "prepare_request_uri", "(", "arg_0", ".", "expand_url", "(", "arg_0", ".", "Func_url", ")", ",", "redirect_uri", "=", "arg_1", ",", "arg_8", "=", "arg_8", ",", "arg_2", "=", "arg_2", ",", "**", "arg_4", ")", "return", "redirect", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, **arg_3):\n        \"\"\"\n        Returns a redirect response to the remote authorization URL with\n        the signed callback given.\n\n        :param callback: a redirect url for the callback\n        :param state: an optional value to embed in the OAuth request.\n                      Use this if you want to pass around application\n                      state (e.g. CSRF tokens).\n        :param kwargs: add optional key/value pairs to the query string\n        \"\"\"\n        arg_4 = dict(arg_0.request_token_params) or {}\n        arg_4.update(**arg_3)\n\n        if arg_0.request_token_url:\n            arg_5 = arg_0.generate_request_token(arg_1)[0]\n            arg_6 = '%s?oauth_token=%s' % (\n                arg_0.expand_url(arg_0.Func_url), url_quote(arg_5)\n            )\n            if arg_4:\n                arg_6 += '&' + url_encode(arg_4)\n        else:\n            assert arg_1 is not None, 'Callback is required for OAuth2'\n\n            arg_7 = arg_0.make_client()\n\n            if 'scope' in arg_4:\n                arg_8 = arg_4.pop('scope')\n            else:\n                arg_8 = None\n\n            if isinstance(arg_8, str):\n                # oauthlib need unicode\n                arg_8 = _encode(arg_8, arg_0.encoding)\n\n            if 'state' in arg_4:\n                if not arg_2:\n                    arg_2 = arg_4.pop('state')\n                else:\n                    # remove state in params\n                    arg_4.pop('state')\n\n            if callable(arg_2):\n                # state can be function for generate a random string\n                arg_2 = arg_2()\n\n            arg_9['%s_oauthredir' % arg_0.name] = arg_1\n            arg_6 = arg_7.prepare_request_uri(\n                arg_0.expand_url(arg_0.Func_url),\n                redirect_uri=arg_1,\n                arg_8=arg_8,\n                arg_2=arg_2,\n                **arg_4\n            )\n        return redirect(arg_6)", "path": "flask_oauthlib/client.py", "identifier": "OAuthRemoteApp.authorize", "docstring": "Returns a redirect response to the remote authorization URL with\n        the signed callback given.\n\n        :param callback: a redirect url for the callback\n        :param state: an optional value to embed in the OAuth request.\n                      Use this if you want to pass around application\n                      state (e.g. CSRF tokens).\n        :param kwargs: add optional key/value pairs to the query string", "docstring_tokens": ["Returns", "a", "redirect", "response", "to", "the", "remote", "authorization", "URL", "with", "the", "signed", "callback", "given", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 255740}
{"url": "https://github.com/VingtCinq/python-resize-image/blob/a4e645792ef30c5fcc558df6da6de18b1ecb95ea/resizeimage/resizeimage.py#L11-L35", "sha": "a4e645792ef30c5fcc558df6da6de18b1ecb95ea", "docstring_summary": "Return a decorator that validates arguments with provided `validator`\n    function.", "language": "python", "parameters": "(validator)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "arg_2", ",", "arg_3", ",", "Func", "=", "True", ")", ":", "if", "Func", ":", "arg_0", "(", "arg_2", ",", "arg_3", ")", "return", "arg_1", "(", "arg_2", ",", "arg_3", ")", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Return a decorator that validates arguments with provided `validator`\n    function.\n\n    This will also store the validator function as `func.validate`.\n    The decorator returned by this function, can bypass the validator\n    if `validate=False` is passed as argument otherwise the fucntion is\n    called directly.\n\n    The validator must raise an exception, if the function can not\n    be called.\n    \"\"\"\n\n    def decorator(arg_1):\n        \"\"\"Bound decorator to a particular validator function\"\"\"\n\n        @wraps(arg_1)\n        def wrapper(arg_2, arg_3, Func=True):\n            if Func:\n                arg_0(arg_2, arg_3)\n            return arg_1(arg_2, arg_3)\n        return wrapper\n\n    return decorator", "path": "resizeimage/resizeimage.py", "identifier": "validate", "docstring": "Return a decorator that validates arguments with provided `validator`\n    function.\n\n    This will also store the validator function as `func.validate`.\n    The decorator returned by this function, can bypass the validator\n    if `validate=False` is passed as argument otherwise the fucntion is\n    called directly.\n\n    The validator must raise an exception, if the function can not\n    be called.", "docstring_tokens": ["Return", "a", "decorator", "that", "validates", "arguments", "with", "provided", "validator", "function", "."], "nwo": "VingtCinq/python-resize-image", "score": 0.37283617366259525, "idx": 255741}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/api/views.py#L49-L75", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Delete auth token when `delete` request was issued.", "language": "python", "parameters": "(self, request, *args, **kwargs)", "return_statement": "return response.Response(status=status.HTTP_204_NO_CONTENT)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "get_authorization_header", "(", "arg_1", ")", ".", "split", "(", ")", "if", "not", "arg_4", "or", "arg_4", "[", "0", "]", ".", "lower", "(", ")", "!=", "b'token'", ":", "return", "response", ".", "Response", "(", "status", "=", "status", ".", "HTTP_400_BAD_REQUEST", ")", "if", "len", "(", "arg_4", ")", "==", "1", ":", "arg_5", "=", "'Invalid token header. No credentials provided.'", "return", "response", ".", "Response", "(", "arg_5", ",", "status", "=", "status", ".", "HTTP_400_BAD_REQUEST", ")", "elif", "len", "(", "arg_4", ")", ">", "2", ":", "arg_5", "=", "'Invalid token header. Token string should not contain spaces.'", "return", "response", ".", "Response", "(", "arg_5", ",", "status", "=", "status", ".", "HTTP_400_BAD_REQUEST", ")", "try", ":", "arg_6", "=", "arg_0", ".", "model", ".", "objects", ".", "get", "(", "key", "=", "arg_4", "[", "1", "]", ")", "except", "arg_0", ".", "model", ".", "DoesNotExist", ":", "pass", "else", ":", "arg_6", ".", "Func", "(", ")", "signals", ".", "user_logged_out", ".", "send", "(", "type", "(", "arg_0", ")", ",", "user", "=", "arg_6", ".", "user", ",", "arg_1", "=", "arg_1", ",", ")", "return", "response", ".", "Response", "(", "status", "=", "status", ".", "HTTP_204_NO_CONTENT", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Delete auth token when `Func` request was issued.\"\"\"\n        # Logic repeated from DRF because one cannot easily reuse it\n        arg_4 = get_authorization_header(arg_1).split()\n\n        if not arg_4 or arg_4[0].lower() != b'token':\n            return response.Response(status=status.HTTP_400_BAD_REQUEST)\n\n        if len(arg_4) == 1:\n            arg_5 = 'Invalid token header. No credentials provided.'\n            return response.Response(arg_5, status=status.HTTP_400_BAD_REQUEST)\n        elif len(arg_4) > 2:\n            arg_5 = 'Invalid token header. Token string should not contain spaces.'\n            return response.Response(arg_5, status=status.HTTP_400_BAD_REQUEST)\n\n        try:\n            arg_6 = arg_0.model.objects.get(key=arg_4[1])\n        except arg_0.model.DoesNotExist:\n            pass\n        else:\n            arg_6.Func()\n            signals.user_logged_out.send(\n                type(arg_0),\n                user=arg_6.user,\n                arg_1=arg_1,\n            )\n        return response.Response(status=status.HTTP_204_NO_CONTENT)", "path": "user_management/api/views.py", "identifier": "GetAuthToken.delete", "docstring": "Delete auth token when `delete` request was issued.", "docstring_tokens": ["Delete", "auth", "token", "when", "delete", "request", "was", "issued", "."], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 255742}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L263-L273", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to validate interval.\n    An interval is valid if starttime and endtime are integrals,\n    and starttime is less than the endtime.\n    Raises exception if interval is not valid.", "language": "python", "parameters": "(self, startTime, endTime)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "int", "(", "arg_1", ")", "arg_4", "=", "int", "(", "arg_2", ")", "if", "arg_3", ">", "arg_4", ":", "raise", "Exception", "(", "\"starttime is greater than endtime.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Helper function to validate interval.\n    An interval is valid if starttime and endtime are integrals,\n    and starttime is less than the endtime.\n    Raises exception if interval is not valid.\n    \"\"\"\n    arg_3 = int(arg_1)\n    arg_4 = int(arg_2)\n    if arg_3 > arg_4:\n      raise Exception(\"starttime is greater than endtime.\")", "path": "heron/tools/tracker/src/python/handlers/basehandler.py", "identifier": "BaseHandler.validateInterval", "docstring": "Helper function to validate interval.\n    An interval is valid if starttime and endtime are integrals,\n    and starttime is less than the endtime.\n    Raises exception if interval is not valid.", "docstring_tokens": ["Helper", "function", "to", "validate", "interval", ".", "An", "interval", "is", "valid", "if", "starttime", "and", "endtime", "are", "integrals", "and", "starttime", "is", "less", "than", "the", "endtime", ".", "Raises", "exception", "if", "interval", "is", "not", "valid", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255743}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/interengine/bintree.py#L83-L90", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "get depth of an element in the tree", "language": "python", "parameters": "(n, tree)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "arg_1", "[", "arg_0", "]", "while", "arg_3", "is", "not", "None", ":", "arg_2", "+=", "1", "arg_3", "=", "arg_1", "[", "arg_3", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"get Func of an element in the tree\"\"\"\n    arg_2 = 0\n    arg_3 = arg_1[arg_0]\n    while arg_3 is not None:\n        arg_2 += 1\n        arg_3 = arg_1[arg_3]\n    return arg_2", "path": "environment/share/doc/ipython/examples/parallel/interengine/bintree.py", "identifier": "depth", "docstring": "get depth of an element in the tree", "docstring_tokens": ["get", "depth", "of", "an", "element", "in", "the", "tree"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255744}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/bbs.py#L1089-L1102", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Create a deep copy of the BoundingBoxesOnImage object.", "language": "python", "parameters": "(self)", "return_statement": "return BoundingBoxesOnImage(bbs, tuple(self.shape))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "bb", ".", "Func", "(", ")", "for", "bb", "in", "arg_0", ".", "bounding_boxes", "]", "return", "BoundingBoxesOnImage", "(", "arg_1", ",", "tuple", "(", "arg_0", ".", "shape", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Create a deep copy of the BoundingBoxesOnImage object.\n\n        Returns\n        -------\n        imgaug.BoundingBoxesOnImage\n            Deep copy.\n\n        \"\"\"\n        # Manual copy is far faster than Func for BoundingBoxesOnImage,\n        # so use manual copy here too\n        arg_1 = [bb.Func() for bb in arg_0.bounding_boxes]\n        return BoundingBoxesOnImage(arg_1, tuple(arg_0.shape))", "path": "imgaug/augmentables/bbs.py", "identifier": "BoundingBoxesOnImage.deepcopy", "docstring": "Create a deep copy of the BoundingBoxesOnImage object.\n\n        Returns\n        -------\n        imgaug.BoundingBoxesOnImage\n            Deep copy.", "docstring_tokens": ["Create", "a", "deep", "copy", "of", "the", "BoundingBoxesOnImage", "object", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 255745}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L580-L585", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return user entities based on a query.", "language": "python", "parameters": "(self, search_entities_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "SearchEntitiesResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'contacts/searchentities'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Return user entities based on a query.\"\"\"\n        arg_2 = hangouts_pb2.SearchEntitiesResponse()\n        await arg_0._pb_request('contacts/searchentities',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.search_entities", "docstring": "Return user entities based on a query.", "docstring_tokens": ["Return", "user", "entities", "based", "on", "a", "query", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 255746}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/__init__.py#L603-L619", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Helper to try to get a setting from the environment, or pyconfig, or\n    finally use a provided default.", "language": "python", "parameters": "(key, default)", "return_statement": "return default", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "Funciron", ".", "get", "(", "arg_0", ",", "None", ")", "if", "arg_2", "is", "not", "None", ":", "log", ".", "info", "(", "'    %s = %r'", ",", "arg_0", ".", "lower", "(", ")", ".", "replace", "(", "'_'", ",", "'.'", ")", ",", "arg_2", ")", "return", "arg_2", "arg_0", "=", "arg_0", ".", "lower", "(", ")", ".", "replace", "(", "'_'", ",", "'.'", ")", "arg_2", "=", "get", "(", "arg_0", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_2", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Helper to try to get a setting from the Funcironment, or pyconfig, or\n    finally use a provided default.\n\n    \"\"\"\n    arg_2 = os.Funciron.get(arg_0, None)\n    if arg_2 is not None:\n        log.info('    %s = %r', arg_0.lower().replace('_', '.'), arg_2)\n        return arg_2\n\n    arg_0 = arg_0.lower().replace('_', '.')\n    arg_2 = get(arg_0)\n    if arg_2 is not None:\n        return arg_2\n\n    return arg_1", "path": "pyconfig/__init__.py", "identifier": "env", "docstring": "Helper to try to get a setting from the environment, or pyconfig, or\n    finally use a provided default.", "docstring_tokens": ["Helper", "to", "try", "to", "get", "a", "setting", "from", "the", "environment", "or", "pyconfig", "or", "finally", "use", "a", "provided", "default", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 255747}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/anomalyzer.py#L66-L80", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Adds a value over a range of rows.", "language": "python", "parameters": "(reader, writer, column, start, stop, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_0", ")", ":", "if", "arg_6", ">=", "arg_3", "and", "arg_6", "<=", "arg_4", ":", "arg_7", "[", "arg_2", "]", "=", "type", "(", "arg_5", ")", "(", "arg_7", "[", "arg_2", "]", ")", "+", "arg_5", "arg_1", ".", "appendRecord", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n  \"\"\"Adds a value over a range of rows.\n\n  Args:\n    reader: A FileRecordStream object with input data.\n    writer: A FileRecordStream object to write output data to.\n    column: The column of data to modify.\n    start: The first row in the range to modify.\n    end: The last row in the range to modify.\n    value: The value to Func.\n  \"\"\"\n  for arg_6, arg_7 in enumerate(arg_0):\n    if arg_6 >= arg_3 and arg_6 <= arg_4:\n      arg_7[arg_2] = type(arg_5)(arg_7[arg_2]) + arg_5\n    arg_1.appendRecord(arg_7)", "path": "src/nupic/data/generators/anomalyzer.py", "identifier": "add", "docstring": "Adds a value over a range of rows.\n\n  Args:\n    reader: A FileRecordStream object with input data.\n    writer: A FileRecordStream object to write output data to.\n    column: The column of data to modify.\n    start: The first row in the range to modify.\n    end: The last row in the range to modify.\n    value: The value to add.", "docstring_tokens": ["Adds", "a", "value", "over", "a", "range", "of", "rows", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255748}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L316-L342", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Update partial or entire z.", "language": "python", "parameters": "(self, z, indices=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_1", "=", "_make_np_bool", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "if", "len", "(", "arg_0", ".", "_z", ")", "!=", "len", "(", "arg_1", ")", ":", "raise", "QiskitError", "(", "\"During updating whole z, you can not \"", "\"change the number of qubits.\"", ")", "arg_0", ".", "_z", "=", "arg_1", "else", ":", "if", "not", "isinstance", "(", "arg_2", ",", "list", ")", "and", "not", "isinstance", "(", "arg_2", ",", "np", ".", "ndarray", ")", ":", "arg_2", "=", "[", "arg_2", "]", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_2", ")", ":", "arg_0", ".", "_z", "[", "arg_5", "]", "=", "arg_1", "[", "arg_4", "]", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Update partial or entire z.\n\n        Args:\n            z (numpy.ndarray or list): to-be-updated z\n            indices (numpy.ndarray or list or optional): to-be-updated qubit indices\n\n        Returns:\n            Pauli: self\n\n        Raises:\n            QiskitError: when updating whole z, the number of qubits must be the same.\n        \"\"\"\n        arg_1 = _make_np_bool(arg_1)\n        if arg_2 is None:\n            if len(arg_0._z) != len(arg_1):\n                raise QiskitError(\"During updating whole z, you can not \"\n                                  \"change the number of qubits.\")\n            arg_0._z = arg_1\n        else:\n            if not isinstance(arg_2, list) and not isinstance(arg_2, np.ndarray):\n                arg_2 = [arg_2]\n            for arg_4, arg_5 in enumerate(arg_2):\n                arg_0._z[arg_5] = arg_1[arg_4]\n\n        return arg_0", "path": "qiskit/quantum_info/operators/pauli.py", "identifier": "Pauli.update_z", "docstring": "Update partial or entire z.\n\n        Args:\n            z (numpy.ndarray or list): to-be-updated z\n            indices (numpy.ndarray or list or optional): to-be-updated qubit indices\n\n        Returns:\n            Pauli: self\n\n        Raises:\n            QiskitError: when updating whole z, the number of qubits must be the same.", "docstring_tokens": ["Update", "partial", "or", "entire", "z", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255749}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L964-L987", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a python iterable containing the exploration range.", "language": "python", "parameters": "(self, copy=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "not", "arg_0", ".", "f_has_range", "(", ")", ":", "raise", "TypeError", "(", "'Your parameter `%s` is not array, so cannot return array.'", "%", "arg_0", ".", "v_full_name", ")", "elif", "arg_1", ":", "return", "arg_0", ".", "_explored_range", "[", ":", "]", "else", ":", "return", "arg_0", ".", "_explored_range"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Returns a python iterable containing the exploration range.\n\n        :param copy:\n\n            If the range should be copied before handed over to avoid tempering with data\n\n        Example usage:\n\n        >>> param = Parameter('groupA.groupB.myparam',data=22, comment='I am a neat example')\n        >>> param._explore([42,43,43])\n        >>> param.Func()\n        (42,43,44)\n\n        :raises: TypeError: If parameter is not explored.\n\n        \"\"\"\n        if not arg_0.f_has_range():\n            raise TypeError('Your parameter `%s` is not array, so cannot return array.' %\n                            arg_0.v_full_name)\n        elif arg_1:\n            return arg_0._explored_range[:]\n        else:\n            return arg_0._explored_range", "path": "pypet/parameter.py", "identifier": "Parameter.f_get_range", "docstring": "Returns a python iterable containing the exploration range.\n\n        :param copy:\n\n            If the range should be copied before handed over to avoid tempering with data\n\n        Example usage:\n\n        >>> param = Parameter('groupA.groupB.myparam',data=22, comment='I am a neat example')\n        >>> param._explore([42,43,43])\n        >>> param.f_get_range()\n        (42,43,44)\n\n        :raises: TypeError: If parameter is not explored.", "docstring_tokens": ["Returns", "a", "python", "iterable", "containing", "the", "exploration", "range", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255750}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/config.py#L270-L295", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Produces a TidyPy configuration using the ``pyproject.toml`` in the\n    project's directory.", "language": "python", "parameters": "(project_path, use_cache=True)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'pyproject.toml'", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "with", "open", "(", "arg_2", ",", "'r'", ")", "as", "config_file", ":", "arg_3", "=", "pytoml", ".", "load", "(", "config_file", ")", "arg_3", "=", "arg_3", ".", "get", "(", "'tool'", ",", "{", "}", ")", ".", "get", "(", "'tidypy'", ",", "{", "}", ")", "arg_3", "=", "merge_dict", "(", "get_default_config", "(", ")", ",", "arg_3", ")", "arg_3", "=", "process_extensions", "(", "arg_3", ",", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "arg_3", "return", "None"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"\n    Produces a TidyPy configuration using the ``pyproject.toml`` in the\n    project's directory.\n\n    :param project_path: the path to the project that is going to be analyzed\n    :type project_path: str\n    :param use_cache:\n        whether or not to use cached versions of any remote/referenced TidyPy\n        configurations. If not specified, defaults to ``True``.\n    :type use_cache: bool\n    :rtype: dict\n    \"\"\"\n\n    arg_2 = os.path.join(arg_0, 'pyproject.toml')\n\n    if os.path.exists(arg_2):\n        with open(arg_2, 'r') as config_file:\n            arg_3 = pytoml.load(config_file)\n\n        arg_3 = arg_3.get('tool', {}).get('tidypy', {})\n        arg_3 = merge_dict(get_default_config(), arg_3)\n        arg_3 = process_extensions(arg_3, arg_0, arg_1=arg_1)\n        return arg_3\n\n    return None", "path": "src/tidypy/config.py", "identifier": "get_local_config", "docstring": "Produces a TidyPy configuration using the ``pyproject.toml`` in the\n    project's directory.\n\n    :param project_path: the path to the project that is going to be analyzed\n    :type project_path: str\n    :param use_cache:\n        whether or not to use cached versions of any remote/referenced TidyPy\n        configurations. If not specified, defaults to ``True``.\n    :type use_cache: bool\n    :rtype: dict", "docstring_tokens": ["Produces", "a", "TidyPy", "configuration", "using", "the", "pyproject", ".", "toml", "in", "the", "project", "s", "directory", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 255751}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/aws_athena_hook.py#L53-L72", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Run Presto query on athena with provided config and return submitted query_execution_id", "language": "python", "parameters": "(self, query, query_context, result_configuration, client_request_token=None)", "return_statement": "return query_execution_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "conn", ".", "start_query_execution", "(", "QueryString", "=", "arg_1", ",", "ClientRequestToken", "=", "arg_4", ",", "QueryExecutionContext", "=", "arg_2", ",", "ResultConfiguration", "=", "arg_3", ")", "arg_6", "=", "arg_5", "[", "'QueryExecutionId'", "]", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"\n        Run Presto query on athena with provided config and return submitted query_execution_id\n\n        :param query: Presto query to run\n        :type query: str\n        :param query_context: Context in which query need to be run\n        :type query_context: dict\n        :param result_configuration: Dict with path to store results in and config related to encryption\n        :type result_configuration: dict\n        :param client_request_token: Unique token created by user to avoid multiple executions of same query\n        :type client_request_token: str\n        :return: str\n        \"\"\"\n        arg_5 = arg_0.conn.start_query_execution(QueryString=arg_1,\n                                                   ClientRequestToken=arg_4,\n                                                   QueryExecutionContext=arg_2,\n                                                   ResultConfiguration=arg_3)\n        arg_6 = arg_5['QueryExecutionId']\n        return arg_6", "path": "airflow/contrib/hooks/aws_athena_hook.py", "identifier": "AWSAthenaHook.run_query", "docstring": "Run Presto query on athena with provided config and return submitted query_execution_id\n\n        :param query: Presto query to run\n        :type query: str\n        :param query_context: Context in which query need to be run\n        :type query_context: dict\n        :param result_configuration: Dict with path to store results in and config related to encryption\n        :type result_configuration: dict\n        :param client_request_token: Unique token created by user to avoid multiple executions of same query\n        :type client_request_token: str\n        :return: str", "docstring_tokens": ["Run", "Presto", "query", "on", "athena", "with", "provided", "config", "and", "return", "submitted", "query_execution_id"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255752}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/parser.py#L110-L153", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Returns a string that is valid JSON or YAML and contains all the\n    variables in every extra_vars_opt inside of extra_vars_list.", "language": "python", "parameters": "(extra_vars_list, force_json=True)", "return_statement": "return json.dumps(extra_vars, ensure_ascii=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "\"\"", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", ".", "startswith", "(", "\"@\"", ")", ":", "with", "open", "(", "arg_4", "[", "1", ":", "]", ",", "'r'", ")", "as", "f", ":", "arg_4", "=", "f", ".", "read", "(", ")", "arg_5", "=", "string_to_dict", "(", "arg_4", ",", "allow_kv", "=", "False", ")", "else", ":", "arg_5", "=", "string_to_dict", "(", "arg_4", ",", "allow_kv", "=", "True", ")", "if", "any", "(", "arg_6", ".", "startswith", "(", "\"#\"", ")", "for", "arg_6", "in", "arg_4", ".", "split", "(", "'\\n'", ")", ")", ":", "arg_3", "+=", "arg_4", "+", "\"\\n\"", "elif", "arg_4", "!=", "\"\"", ":", "arg_3", "+=", "yaml", ".", "dump", "(", "arg_5", ",", "default_flow_style", "=", "False", ")", "+", "\"\\n\"", "arg_2", ".", "update", "(", "arg_5", ")", "if", "not", "arg_1", ":", "try", ":", "arg_7", "=", "yaml", ".", "load", "(", "arg_3", ",", "Loader", "=", "yaml", ".", "SafeLoader", ")", "assert", "type", "(", "arg_7", ")", "is", "dict", "debug", ".", "log", "(", "'Using unprocessed YAML'", ",", "header", "=", "'decision'", ",", "nl", "=", "2", ")", "return", "arg_3", ".", "rstrip", "(", ")", "except", "Exception", ":", "debug", ".", "log", "(", "'Failed YAML parsing, defaulting to JSON'", ",", "header", "=", "'decison'", ",", "nl", "=", "2", ")", "if", "arg_2", "==", "{", "}", ":", "return", "\"\"", "return", "json", ".", "dumps", "(", "arg_2", ",", "ensure_ascii", "=", "False", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Returns a string that is valid JSON or YAML and contains all the\n    variables in every extra_vars_opt inside of extra_vars_list.\n\n    Args:\n       parse_kv (bool): whether to allow key=value syntax.\n       force_json (bool): if True, always output json.\n    \"\"\"\n    # Read from all the different sources and put into dictionary\n    arg_2 = {}\n    arg_3 = \"\"\n    for arg_4 in arg_0:\n        # Load file content if necessary\n        if arg_4.startswith(\"@\"):\n            with open(arg_4[1:], 'r') as f:\n                arg_4 = f.read()\n            # Convert text markup to a dictionary conservatively\n            arg_5 = string_to_dict(arg_4, allow_kv=False)\n        else:\n            # Convert text markup to a dictionary liberally\n            arg_5 = string_to_dict(arg_4, allow_kv=True)\n        # Rolling YAML-based string combination\n        if any(arg_6.startswith(\"#\") for arg_6 in arg_4.split('\\n')):\n            arg_3 += arg_4 + \"\\n\"\n        elif arg_4 != \"\":\n            arg_3 += yaml.dump(\n                arg_5, default_flow_style=False) + \"\\n\"\n        # Combine dictionary with cumulative dictionary\n        arg_2.update(arg_5)\n\n    # Return contents in form of a string\n    if not arg_1:\n        try:\n            # Conditions to verify it is safe to return rolling YAML string\n            arg_7 = yaml.load(arg_3, Loader=yaml.SafeLoader)\n            assert type(arg_7) is dict\n            debug.log('Using unprocessed YAML', header='decision', nl=2)\n            return arg_3.rstrip()\n        except Exception:\n            debug.log('Failed YAML parsing, defaulting to JSON',\n                      header='decison', nl=2)\n    if arg_2 == {}:\n        return \"\"\n    return json.dumps(arg_2, ensure_ascii=False)", "path": "tower_cli/utils/parser.py", "identifier": "process_extra_vars", "docstring": "Returns a string that is valid JSON or YAML and contains all the\n    variables in every extra_vars_opt inside of extra_vars_list.\n\n    Args:\n       parse_kv (bool): whether to allow key=value syntax.\n       force_json (bool): if True, always output json.", "docstring_tokens": ["Returns", "a", "string", "that", "is", "valid", "JSON", "or", "YAML", "and", "contains", "all", "the", "variables", "in", "every", "extra_vars_opt", "inside", "of", "extra_vars_list", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 255753}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L426-L459", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Pretty print the variable importances, or return them in a list.", "language": "python", "parameters": "(self, use_pandas=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "_model_json", "[", "\"output\"", "]", "if", "arg_0", ".", "algo", "==", "'glm'", "or", "\"variable_importances\"", "in", "list", "(", "arg_2", ".", "keys", "(", ")", ")", "and", "arg_2", "[", "\"variable_importances\"", "]", ":", "if", "arg_0", ".", "algo", "==", "'glm'", ":", "arg_3", "=", "arg_2", "[", "\"standardized_coefficient_magnitudes\"", "]", ".", "cell_values", "arg_4", "=", "0", "arg_5", "=", "0", "for", "arg_6", "in", "arg_3", ":", "arg_5", "=", "arg_5", "+", "arg_6", "[", "1", "]", "if", "arg_6", "[", "1", "]", ">", "arg_4", ":", "arg_4", "=", "arg_6", "[", "1", "]", "arg_7", "=", "[", "]", "for", "arg_6", "in", "arg_3", ":", "arg_8", "=", "(", "arg_6", "[", "0", "]", ",", "arg_6", "[", "1", "]", ",", "arg_6", "[", "1", "]", "/", "arg_4", ",", "arg_6", "[", "1", "]", "/", "arg_5", ")", "arg_7", ".", "append", "(", "arg_8", ")", "arg_9", "=", "[", "\"variable\"", ",", "\"relative_importance\"", ",", "\"scaled_importance\"", ",", "\"percentage\"", "]", "else", ":", "arg_7", "=", "arg_2", "[", "\"variable_importances\"", "]", ".", "cell_values", "arg_9", "=", "arg_2", "[", "\"variable_importances\"", "]", ".", "col_header", "if", "arg_1", "and", "can_use_pandas", "(", ")", ":", "import", "pandas", "return", "pandas", ".", "DataFrame", "(", "arg_7", ",", "columns", "=", "arg_9", ")", "else", ":", "return", "arg_7", "else", ":", "print", "(", "\"Warning: This model doesn't have variable importances\"", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Pretty print the variable importances, or return them in a list.\n\n        :param use_pandas: If True, then the variable importances will be returned as a pandas data frame.\n\n        :returns: A list or Pandas DataFrame.\n        \"\"\"\n        arg_2 = arg_0._model_json[\"output\"]\n        if arg_0.algo=='glm' or \"variable_importances\" in list(arg_2.keys()) and arg_2[\"variable_importances\"]:\n            if arg_0.algo=='glm':\n                arg_3 = arg_2[\"standardized_coefficient_magnitudes\"].cell_values\n                arg_4 = 0\n                arg_5=0\n                for arg_6 in arg_3:\n                    arg_5=arg_5+arg_6[1]\n                    if arg_6[1]>arg_4:\n                        arg_4 = arg_6[1]\n                arg_7 = []\n                for arg_6 in arg_3:\n                    arg_8 = (arg_6[0], arg_6[1], arg_6[1]/arg_4, arg_6[1]/arg_5)\n                    arg_7.append(arg_8)\n                arg_9 = [\"variable\", \"relative_importance\", \"scaled_importance\", \"percentage\"]\n            else:\n                arg_7 = arg_2[\"variable_importances\"].cell_values\n                arg_9 = arg_2[\"variable_importances\"].col_header\n                \n            if arg_1 and can_use_pandas():\n                import pandas\n                return pandas.DataFrame(arg_7, columns=arg_9)\n            else:\n                return arg_7\n        else:\n            print(\"Warning: This model doesn't have variable importances\")", "path": "h2o-py/h2o/model/model_base.py", "identifier": "ModelBase.varimp", "docstring": "Pretty print the variable importances, or return them in a list.\n\n        :param use_pandas: If True, then the variable importances will be returned as a pandas data frame.\n\n        :returns: A list or Pandas DataFrame.", "docstring_tokens": ["Pretty", "print", "the", "variable", "importances", "or", "return", "them", "in", "a", "list", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255754}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/auth/models.py#L57-L65", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Modify the user's permissions.", "language": "python", "parameters": "(self, permissions)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Group", ".", "objects", ".", "get", "(", "name", "=", "'Admin'", ")", "if", "arg_1", "==", "'admin'", ":", "arg_0", ".", "groups", ".", "add", "(", "arg_2", ")", "else", ":", "arg_0", ".", "groups", ".", "remove", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Modify the user's permissions.\"\"\"\n\n        arg_2 = Group.objects.get(name='Admin')\n\n        if arg_1 == 'admin':\n            arg_0.groups.add(arg_2)\n        else:\n            arg_0.groups.remove(arg_2)", "path": "dispatch/modules/auth/models.py", "identifier": "User.modify_permissions", "docstring": "Modify the user's permissions.", "docstring_tokens": ["Modify", "the", "user", "s", "permissions", "."], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 255755}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/views/__init__.py#L37-L62", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Declaration of routes that can be browsed by users.", "language": "python", "parameters": "(config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "add_notfound_view", "(", "default_exceptionresponse_view", ",", "append_slash", "=", "True", ")", "arg_1", "=", "arg_0", ".", "add_route", "arg_1", "(", "'admin-index'", ",", "'/a/'", ")", "arg_1", "(", "'admin-moderation'", ",", "'/a/moderation/'", ")", "arg_1", "(", "'admin-api-keys'", ",", "'/a/api-keys/'", ")", "arg_1", "(", "'admin-add-site-messages'", ",", "'/a/site-messages/'", ",", "request_method", "=", "'GET'", ")", "arg_1", "(", "'admin-add-site-messages-POST'", ",", "'/a/site-messages/'", ",", "request_method", "=", "'POST'", ")", "arg_1", "(", "'admin-delete-site-messages'", ",", "'/a/site-messages/'", ",", "request_method", "=", "'DELETE'", ")", "arg_1", "(", "'admin-edit-site-message'", ",", "'/a/site-messages/{id}/'", ",", "request_method", "=", "'GET'", ")", "arg_1", "(", "'admin-edit-site-message-POST'", ",", "'/a/site-messages/{id}/'", ",", "request_method", "=", "'POST'", ")", "arg_1", "(", "'admin-content-status'", ",", "'/a/content-status/'", ")", "arg_1", "(", "'admin-content-status-single'", ",", "'/a/content-status/{uuid}'", ")", "arg_1", "(", "'admin-print-style'", ",", "'/a/print-style/'", ")", "arg_1", "(", "'admin-print-style-single'", ",", "'/a/print-style/{style}'", ")"], "function": "def Func(arg_0):\n    \"\"\"Declaration of routes that can be browsed by users.\"\"\"\n    # This makes our routes slashed, which is good browser behavior.\n    arg_0.add_notfound_view(default_exceptionresponse_view,\n                             append_slash=True)\n\n    arg_1 = arg_0.add_route\n    arg_1('admin-index', '/a/')\n    arg_1('admin-moderation', '/a/moderation/')\n    arg_1('admin-api-keys', '/a/api-keys/')\n    arg_1('admin-add-site-messages', '/a/site-messages/',\n              request_method='GET')\n    arg_1('admin-add-site-messages-POST', '/a/site-messages/',\n              request_method='POST')\n    arg_1('admin-delete-site-messages', '/a/site-messages/',\n              request_method='DELETE')\n    arg_1('admin-edit-site-message', '/a/site-messages/{id}/',\n              request_method='GET')\n    arg_1('admin-edit-site-message-POST', '/a/site-messages/{id}/',\n              request_method='POST')\n\n    arg_1('admin-content-status', '/a/content-status/')\n    arg_1('admin-content-status-single', '/a/content-status/{uuid}')\n\n    arg_1('admin-print-style', '/a/print-style/')\n    arg_1('admin-print-style-single', '/a/print-style/{style}')", "path": "cnxpublishing/views/__init__.py", "identifier": "declare_browsable_routes", "docstring": "Declaration of routes that can be browsed by users.", "docstring_tokens": ["Declaration", "of", "routes", "that", "can", "be", "browsed", "by", "users", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 255756}
{"url": "https://github.com/PRIArobotics/HedgehogProtocol/blob/140df1ade46fbfee7eea7a6c0b35cbc7ffbf89fe/hedgehog/protocol/errors.py#L62-L74", "sha": "140df1ade46fbfee7eea7a6c0b35cbc7ffbf89fe", "docstring_summary": "Creates an error from the given code, and args and kwargs.", "language": "python", "parameters": "(code: int, *args, **kwargs)", "return_statement": "return _errors[code](*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "->", "HedgehogCommandError", ":", "if", "arg_0", "==", "FAILED_COMMAND", "and", "len", "(", "arg_2", ")", ">=", "1", "and", "arg_2", "[", "0", "]", "==", "\"Emergency Shutdown activated\"", ":", "return", "EmergencyShutdown", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "_Funcs", "[", "arg_0", "]", "(", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0: arg_1, *arg_2, **arg_3) -> HedgehogCommandError:\n    \"\"\"\n    Creates an Func from the given code, and args and kwargs.\n\n    :param code: The acknowledgement code\n    :param args: Exception args\n    :param kwargs: Exception kwargs\n    :return: the Func for the given acknowledgement code\n    \"\"\"\n    # TODO add proper Func code\n    if arg_0 == FAILED_COMMAND and len(arg_2) >= 1 and arg_2[0] == \"Emergency Shutdown activated\":\n        return EmergencyShutdown(*arg_2, **arg_3)\n    return _Funcs[arg_0](*arg_2, **arg_3)", "path": "hedgehog/protocol/errors.py", "identifier": "error", "docstring": "Creates an error from the given code, and args and kwargs.\n\n    :param code: The acknowledgement code\n    :param args: Exception args\n    :param kwargs: Exception kwargs\n    :return: the error for the given acknowledgement code", "docstring_tokens": ["Creates", "an", "error", "from", "the", "given", "code", "and", "args", "and", "kwargs", "."], "nwo": "PRIArobotics/HedgehogProtocol", "score": 0.09252797783733271, "idx": 255757}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/slicing.py#L46-L104", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Slices a single parameter of a distribution.", "language": "python", "parameters": "(param, param_event_ndims, slices, dist_batch_shape)", "return_statement": "return full_batch_param.__getitem__(param_slices)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "arg_5", "=", "tf", ".", "ones", "(", "[", "tf", ".", "size", "(", "input", "=", "arg_3", ")", "+", "arg_1", "-", "tf", ".", "rank", "(", "arg_0", ")", "]", ",", "dtype", "=", "arg_4", ".", "dtype", ")", "arg_6", "=", "tf", ".", "concat", "(", "[", "arg_5", ",", "arg_4", "]", ",", "axis", "=", "0", ")", "arg_7", "=", "tf", ".", "reshape", "(", "arg_0", ",", "arg_6", ")", "arg_8", "=", "[", "]", "arg_9", "=", "0", "arg_10", "=", "0", "for", "arg_11", "in", "arg_2", ":", "if", "arg_11", "is", "tf", ".", "newaxis", ":", "arg_8", ".", "append", "(", "arg_11", ")", "continue", "if", "arg_11", "is", "Ellipsis", ":", "if", "arg_10", "<", "0", ":", "raise", "ValueError", "(", "'Found multiple `...` in slices {}'", ".", "format", "(", "arg_2", ")", ")", "arg_8", ".", "append", "(", "arg_11", ")", "arg_12", "=", "sum", "(", "[", "s", "is", "not", "tf", ".", "newaxis", "for", "s", "in", "arg_2", "[", "arg_2", ".", "index", "(", "Ellipsis", ")", "+", "1", ":", "]", "]", ")", "arg_10", "=", "-", "arg_12", "arg_9", "=", "arg_10", "-", "arg_1", "continue", "arg_13", "=", "arg_6", "[", "arg_9", "]", "arg_14", "=", "arg_3", "[", "arg_10", "]", "arg_15", "=", "arg_14", ">", "arg_13", "if", "isinstance", "(", "arg_11", ",", "slice", ")", ":", "arg_16", ",", "arg_17", ",", "arg_18", "=", "arg_11", ".", "start", ",", "arg_11", ".", "stop", ",", "arg_11", ".", "step", "if", "arg_16", "is", "not", "None", ":", "arg_16", "=", "tf", ".", "where", "(", "arg_15", ",", "0", ",", "arg_16", ")", "if", "arg_17", "is", "not", "None", ":", "arg_17", "=", "tf", ".", "where", "(", "arg_15", ",", "1", ",", "arg_17", ")", "if", "arg_18", "is", "not", "None", ":", "arg_18", "=", "tf", ".", "where", "(", "arg_15", ",", "1", ",", "arg_18", ")", "arg_8", ".", "append", "(", "slice", "(", "arg_16", ",", "arg_17", ",", "arg_18", ")", ")", "else", ":", "arg_8", ".", "append", "(", "tf", ".", "where", "(", "arg_15", ",", "0", ",", "arg_11", ")", ")", "arg_9", "+=", "1", "arg_10", "+=", "1", "arg_8", ".", "extend", "(", "[", "ALL_SLICE", "]", "*", "arg_1", ")", "return", "arg_7", ".", "__getitem__", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Slices a single parameter of a distribution.\n\n  Args:\n    param: A `Tensor`, the original parameter to slice.\n    param_event_ndims: `int` event parameterization rank for this parameter.\n    slices: A `tuple` of normalized slices.\n    dist_batch_shape: The distribution's batch shape `Tensor`.\n\n  Returns:\n    new_param: A `Tensor`, batch-sliced according to slices.\n  \"\"\"\n  # Extend param shape with ones on the left to match dist_batch_shape.\n  arg_4 = tf.shape(input=arg_0)\n  arg_5 = tf.ones(\n      [tf.size(input=arg_3) + arg_1 - tf.rank(arg_0)],\n      dtype=arg_4.dtype)\n  arg_6 = tf.concat([arg_5, arg_4], axis=0)\n  arg_7 = tf.reshape(arg_0, arg_6)\n  arg_8 = []\n  # We separately track the batch axis from the parameter axis because we want\n  # them to align for positive indexing, and be offset by param_event_ndims for\n  # negative indexing.\n  arg_9 = 0\n  arg_10 = 0\n  for arg_11 in arg_2:\n    if arg_11 is tf.newaxis:\n      arg_8.append(arg_11)\n      continue\n    if arg_11 is Ellipsis:\n      if arg_10 < 0:\n        raise ValueError('Found multiple `...` in slices {}'.format(arg_2))\n      arg_8.append(arg_11)\n      # Switch over to negative indexing for the broadcast check.\n      arg_12 = sum(\n          [s is not tf.newaxis for s in arg_2[arg_2.index(Ellipsis) + 1:]])\n      arg_10 = -arg_12\n      arg_9 = arg_10 - arg_1\n      continue\n    # Find the batch dimension sizes for both parameter and distribution.\n    arg_13 = arg_6[arg_9]\n    arg_14 = arg_3[arg_10]\n    arg_15 = arg_14 > arg_13\n    # Slices are denoted by start:stop:step.\n    if isinstance(arg_11, slice):\n      arg_16, arg_17, arg_18 = arg_11.start, arg_11.stop, arg_11.step\n      if arg_16 is not None:\n        arg_16 = tf.where(arg_15, 0, arg_16)\n      if arg_17 is not None:\n        arg_17 = tf.where(arg_15, 1, arg_17)\n      if arg_18 is not None:\n        arg_18 = tf.where(arg_15, 1, arg_18)\n      arg_8.append(slice(arg_16, arg_17, arg_18))\n    else:  # int, or int Tensor, e.g. d[d.batch_shape_tensor()[0] // 2]\n      arg_8.append(tf.where(arg_15, 0, arg_11))\n    arg_9 += 1\n    arg_10 += 1\n  arg_8.extend([ALL_SLICE] * arg_1)\n  return arg_7.__getitem__(arg_8)", "path": "tensorflow_probability/python/distributions/internal/slicing.py", "identifier": "_slice_single_param", "docstring": "Slices a single parameter of a distribution.\n\n  Args:\n    param: A `Tensor`, the original parameter to slice.\n    param_event_ndims: `int` event parameterization rank for this parameter.\n    slices: A `tuple` of normalized slices.\n    dist_batch_shape: The distribution's batch shape `Tensor`.\n\n  Returns:\n    new_param: A `Tensor`, batch-sliced according to slices.", "docstring_tokens": ["Slices", "a", "single", "parameter", "of", "a", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255758}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/connection.py#L122-L131", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Decorator that prevents callbacks from calling into methods that are\n        not reentrant", "language": "python", "parameters": "(func)", "return_statement": "return wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrap", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_1", ".", "_callback_lock", "and", "arg_1", ".", "_callback_lock", ".", "in_callback", ":", "arg_4", "=", "\"Connection %s cannot be invoked from a callback!\"", "%", "arg_0", "raise", "RuntimeError", "(", "arg_4", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrap"], "function": "def Func(arg_0):\n        \"\"\"Decorator that prevents callbacks from calling into methods that are\n        not reentrant\n        \"\"\"\n        def wrap(arg_1, *arg_2, **arg_3):\n            if arg_1._callback_lock and arg_1._callback_lock.in_callback:\n                arg_4 = \"Connection %s cannot be invoked from a callback!\" % arg_0\n                raise RuntimeError(arg_4)\n            return arg_0(arg_1, *arg_2, **arg_3)\n        return wrap", "path": "pyngus/connection.py", "identifier": "Connection._not_reentrant", "docstring": "Decorator that prevents callbacks from calling into methods that are\n        not reentrant", "docstring_tokens": ["Decorator", "that", "prevents", "callbacks", "from", "calling", "into", "methods", "that", "are", "not", "reentrant"], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 255759}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdflite.py#L122-L146", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "First, the Document object does the heavy-lifting for the\r\n            individual page objects and content.\r\n\r\n            Then, the overall \"Pages\" object is generated.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "document", ".", "_get_orientation_changes", "(", ")", "arg_0", ".", "document", ".", "_output_pages", "(", ")", "arg_0", ".", "session", ".", "_add_object", "(", "1", ")", "arg_0", ".", "session", ".", "_out", "(", "'<</Type /Pages'", ")", "arg_1", "=", "'/Kids ['", "for", "arg_2", "in", "xrange", "(", "0", ",", "len", "(", "arg_0", ".", "document", ".", "pages", ")", ")", ":", "arg_1", "+=", "str", "(", "3", "+", "2", "*", "arg_2", ")", "+", "' 0 R '", "arg_0", ".", "session", ".", "_out", "(", "arg_1", "+", "']'", ")", "arg_0", ".", "session", ".", "_out", "(", "'/Count %s'", "%", "len", "(", "arg_0", ".", "document", ".", "pages", ")", ")", "arg_0", ".", "session", ".", "_out", "(", "'/MediaBox [0 0 %.2f %.2f]'", "%", "(", "arg_0", ".", "document", ".", "page", ".", "width", ",", "arg_0", ".", "document", ".", "page", ".", "height", ")", ")", "arg_0", ".", "session", ".", "_out", "(", "'>>'", ")", "arg_0", ".", "session", ".", "_out", "(", "'endobj'", ")"], "function": "def Func(arg_0):\r\n        \"\"\" First, the Document object does the heavy-lifting for the\r\n            individual page objects and content.\r\n\r\n            Then, the overall \"Pages\" object is generated.\r\n\r\n        \"\"\"\r\n        arg_0.document._get_orientation_changes()\r\n        arg_0.document._output_pages()\r\n\r\n        # Pages Object, provides reference to page objects (Kids list).\r\n        arg_0.session._add_object(1)\r\n        arg_0.session._out('<</Type /Pages')\r\n        arg_1 = '/Kids ['\r\n        for arg_2 in xrange(0, len(arg_0.document.pages)):\r\n            arg_1 += str(3 + 2 * arg_2) + ' 0 R '\r\n        arg_0.session._out(arg_1 + ']')\r\n        arg_0.session._out('/Count %s' % len(arg_0.document.pages))\r\n\r\n        # Overall size of the default PDF page\r\n        arg_0.session._out('/MediaBox [0 0 %.2f %.2f]' %\r\n                          (arg_0.document.page.width,\r\n                           arg_0.document.page.height))\r\n        arg_0.session._out('>>')\r\n        arg_0.session._out('endobj')", "path": "pypdflite/pdflite.py", "identifier": "PDFLite._put_pages", "docstring": "First, the Document object does the heavy-lifting for the\r\n            individual page objects and content.\r\n\r\n            Then, the overall \"Pages\" object is generated.", "docstring_tokens": ["First", "the", "Document", "object", "does", "the", "heavy", "-", "lifting", "for", "the", "individual", "page", "objects", "and", "content", ".", "Then", "the", "overall", "Pages", "object", "is", "generated", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 255760}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L636-L652", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "True if the credential is expired or invalid.", "language": "python", "parameters": "(self)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "invalid", ":", "return", "True", "if", "not", "arg_0", ".", "token_expiry", ":", "return", "False", "arg_1", "=", "_UTCNOW", "(", ")", "if", "arg_1", ">=", "arg_0", ".", "token_expiry", ":", "logger", ".", "info", "(", "'access_token is expired. Now: %s, token_expiry: %s'", ",", "arg_1", ",", "arg_0", ".", "token_expiry", ")", "return", "True", "return", "False"], "function": "def Func(arg_0):\n        \"\"\"True if the credential is expired or invalid.\n\n        If the token_expiry isn't set, we assume the token doesn't expire.\n        \"\"\"\n        if arg_0.invalid:\n            return True\n\n        if not arg_0.token_expiry:\n            return False\n\n        arg_1 = _UTCNOW()\n        if arg_1 >= arg_0.token_expiry:\n            logger.info('access_token is expired. Now: %s, token_expiry: %s',\n                        arg_1, arg_0.token_expiry)\n            return True\n        return False", "path": "oauth2client/client.py", "identifier": "OAuth2Credentials.access_token_expired", "docstring": "True if the credential is expired or invalid.\n\n        If the token_expiry isn't set, we assume the token doesn't expire.", "docstring_tokens": ["True", "if", "the", "credential", "is", "expired", "or", "invalid", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 255761}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L1117-L1136", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Replaces all occurrences of \"old\" by \"new\" in the given file.", "language": "python", "parameters": "(filename, old, new, encoding=None)", "return_statement": "return contents", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "GetFileContents", "(", "arg_0", ",", "arg_3", "=", "arg_3", ")", "arg_4", "=", "arg_4", ".", "replace", "(", "arg_1", ",", "arg_2", ")", "CreateFile", "(", "arg_0", ",", "arg_4", ",", "arg_3", "=", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    '''\n    Replaces all occurrences of \"old\" by \"new\" in the given file.\n\n    :param unicode filename:\n        The name of the file.\n\n    :param unicode old:\n        The string to search for.\n\n    :param unicode new:\n        Replacement string.\n\n    :return unicode:\n        The new contents of the file.\n    '''\n    arg_4 = GetFileContents(arg_0, arg_3=arg_3)\n    arg_4 = arg_4.replace(arg_1, arg_2)\n    CreateFile(arg_0, arg_4, arg_3=arg_3)\n    return arg_4", "path": "zerotk/easyfs/_easyfs.py", "identifier": "ReplaceInFile", "docstring": "Replaces all occurrences of \"old\" by \"new\" in the given file.\n\n    :param unicode filename:\n        The name of the file.\n\n    :param unicode old:\n        The string to search for.\n\n    :param unicode new:\n        Replacement string.\n\n    :return unicode:\n        The new contents of the file.", "docstring_tokens": ["Replaces", "all", "occurrences", "of", "old", "by", "new", "in", "the", "given", "file", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 255762}
{"url": "https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/constants.py#L21-L24", "sha": "8c6bb54888675652d25324184967392d00d128fc", "docstring_summary": "Helper to write the JSON configuration to a file", "language": "python", "parameters": "(configuration)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "CONFIG_PATH", ",", "'w'", ")", "as", "f", ":", "json", ".", "dump", "(", "arg_0", ",", "f", ",", "indent", "=", "2", ",", "sort_keys", "=", "True", ")"], "function": "def Func(arg_0):\n    \"\"\"Helper to write the JSON configuration to a file\"\"\"\n    with open(CONFIG_PATH, 'w') as f:\n        json.dump(arg_0, f, indent=2, sort_keys=True)", "path": "src/ols_client/constants.py", "identifier": "write_config", "docstring": "Helper to write the JSON configuration to a file", "docstring_tokens": ["Helper", "to", "write", "the", "JSON", "configuration", "to", "a", "file"], "nwo": "cthoyt/ols-client", "score": 0.25890992733444657, "idx": 255763}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/interface.py#L267-L286", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Sum of all width of interfaces in this interface", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "_interfaces", "except", "AttributeError", ":", "arg_1", "=", "None", "if", "arg_1", "is", "None", ":", "arg_2", "=", "arg_0", ".", "_clone", "(", ")", "arg_2", ".", "_loadDeclarations", "(", ")", "arg_1", "=", "arg_2", ".", "_interfaces", "if", "arg_1", ":", "arg_3", "=", "0", "for", "arg_4", "in", "arg_1", ":", "arg_3", "+=", "arg_4", ".", "Func", "(", ")", "return", "arg_3", "else", ":", "return", "arg_0", ".", "_dtype", ".", "bit_length", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Sum of all width of interfaces in this interface\"\"\"\n        try:\n            arg_1 = arg_0._interfaces\n        except AttributeError:\n            arg_1 = None\n\n        if arg_1 is None:\n            # not loaded interface\n            arg_2 = arg_0._clone()\n            arg_2._loadDeclarations()\n            arg_1 = arg_2._interfaces\n\n        if arg_1:\n            arg_3 = 0\n            for arg_4 in arg_1:\n                arg_3 += arg_4.Func()\n            return arg_3\n        else:\n            return arg_0._dtype.bit_length()", "path": "hwt/synthesizer/interface.py", "identifier": "Interface._bit_length", "docstring": "Sum of all width of interfaces in this interface", "docstring_tokens": ["Sum", "of", "all", "width", "of", "interfaces", "in", "this", "interface"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 255764}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/image/base.py#L178-L182", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Set a smoothing Gaussian kernel given its FWHM in mm.", "language": "python", "parameters": "(self, fwhm)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "!=", "arg_0", ".", "_Func", ":", "arg_0", ".", "_is_data_smooth", "=", "False", "arg_0", ".", "_Func", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Set a smoothing Gaussian kernel given its FWHM in mm.  \"\"\"\n        if arg_1 != arg_0._Func:\n            arg_0._is_data_smooth = False\n        arg_0._Func = arg_1", "path": "boyle/image/base.py", "identifier": "MedicalImage.smooth_fwhm", "docstring": "Set a smoothing Gaussian kernel given its FWHM in mm.", "docstring_tokens": ["Set", "a", "smoothing", "Gaussian", "kernel", "given", "its", "FWHM", "in", "mm", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255765}
{"url": "https://github.com/litl/leeroy/blob/ab6565a3b63e9103d8c011d9c62a9c0ad589b051/leeroy/github.py#L155-L175", "sha": "ab6565a3b63e9103d8c011d9c62a9c0ad589b051", "docstring_summary": "Gets the status of a commit.", "language": "python", "parameters": "(app, repo_config, repo_name, sha)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "get_api_url", "(", "arg_0", ",", "arg_1", ",", "github_status_url", ")", ".", "format", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "logging", ".", "debug", "(", "\"Getting status for %s %s\"", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "get_session_for_repo", "(", "arg_0", ",", "arg_1", ")", "arg_6", "=", "arg_5", ".", "get", "(", "arg_4", ")", "if", "not", "arg_6", ".", "ok", ":", "raise", "Exception", "(", "\"Unable to get status: {}\"", ".", "format", "(", "arg_6", ".", "status_code", ")", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Gets the status of a commit.\n\n    .. note::\n        ``repo_name`` might not ever be anything other than\n        ``repo_config['github_repo']``.\n\n    :param app: Flask app for leeroy\n    :param repo_config: configuration for the repo\n    :param repo_name: The name of the owner/repo\n    :param sha: SHA for the status we are looking for\n    :return: returns json response of status\n    \"\"\"\n    arg_4 = get_api_url(arg_0, arg_1, github_status_url).format(\n        arg_2=arg_2, arg_3=arg_3)\n    logging.debug(\"Getting status for %s %s\", arg_2, arg_3)\n    arg_5 = get_session_for_repo(arg_0, arg_1)\n    arg_6 = arg_5.get(arg_4)\n    if not arg_6.ok:\n        raise Exception(\"Unable to get status: {}\".format(arg_6.status_code))\n    return arg_6", "path": "leeroy/github.py", "identifier": "get_status", "docstring": "Gets the status of a commit.\n\n    .. note::\n        ``repo_name`` might not ever be anything other than\n        ``repo_config['github_repo']``.\n\n    :param app: Flask app for leeroy\n    :param repo_config: configuration for the repo\n    :param repo_name: The name of the owner/repo\n    :param sha: SHA for the status we are looking for\n    :return: returns json response of status", "docstring_tokens": ["Gets", "the", "status", "of", "a", "commit", "."], "nwo": "litl/leeroy", "score": 0.383009142586278, "idx": 255766}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/base_predictor.py#L151-L176", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Check peptide sequences to make sure they are valid for this predictor.", "language": "python", "parameters": "(self, peptides)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "require_iterable_of", "(", "arg_1", ",", "string_types", ")", "arg_2", "=", "not", "arg_0", ".", "allow_X_in_peptides", "arg_3", "=", "not", "arg_0", ".", "allow_lowercase_in_peptides", "arg_4", "=", "arg_0", ".", "min_peptide_length", "is", "not", "None", "arg_5", "=", "arg_0", ".", "min_peptide_length", "arg_6", "=", "arg_0", ".", "max_peptide_length", "is", "not", "None", "arg_7", "=", "arg_0", ".", "max_peptide_length", "for", "arg_8", "in", "arg_1", ":", "if", "not", "arg_8", ".", "isalpha", "(", ")", ":", "raise", "ValueError", "(", "\"Invalid characters in peptide '%s'\"", "%", "arg_8", ")", "elif", "arg_2", "and", "\"X\"", "in", "arg_8", ":", "raise", "ValueError", "(", "\"Invalid character 'X' in peptide '%s'\"", "%", "arg_8", ")", "elif", "arg_3", "and", "not", "arg_8", ".", "isupper", "(", ")", ":", "raise", "ValueError", "(", "\"Invalid lowercase letters in peptide '%s'\"", "%", "arg_8", ")", "elif", "arg_4", "and", "len", "(", "arg_8", ")", "<", "arg_5", ":", "raise", "ValueError", "(", "\"Peptide '%s' too short (%d chars), must be at least %d\"", "%", "(", "arg_8", ",", "len", "(", "arg_8", ")", ",", "arg_5", ")", ")", "elif", "arg_6", "and", "len", "(", "arg_8", ")", ">", "arg_7", ":", "raise", "ValueError", "(", "\"Peptide '%s' too long (%d chars), must be at least %d\"", "%", "(", "arg_8", ",", "len", "(", "arg_8", ")", ",", "arg_7", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Check peptide sequences to make sure they are valid for this predictor.\n        \"\"\"\n        require_iterable_of(arg_1, string_types)\n        arg_2 = not arg_0.allow_X_in_peptides\n        arg_3 = not arg_0.allow_lowercase_in_peptides\n        arg_4 = arg_0.min_peptide_length is not None\n        arg_5 = arg_0.min_peptide_length\n        arg_6 = arg_0.max_peptide_length is not None\n        arg_7 = arg_0.max_peptide_length\n        for arg_8 in arg_1:\n            if not arg_8.isalpha():\n                raise ValueError(\"Invalid characters in peptide '%s'\" % arg_8)\n            elif arg_2 and \"X\" in arg_8:\n                raise ValueError(\"Invalid character 'X' in peptide '%s'\" % arg_8)\n            elif arg_3 and not arg_8.isupper():\n                raise ValueError(\"Invalid lowercase letters in peptide '%s'\" % arg_8)\n            elif arg_4 and len(arg_8) < arg_5:\n                raise ValueError(\n                    \"Peptide '%s' too short (%d chars), must be at least %d\" % (\n                        arg_8, len(arg_8), arg_5))\n            elif arg_6 and len(arg_8) > arg_7:\n                raise ValueError(\n                    \"Peptide '%s' too long (%d chars), must be at least %d\" % (\n                        arg_8, len(arg_8), arg_7))", "path": "mhctools/base_predictor.py", "identifier": "BasePredictor._check_peptide_inputs", "docstring": "Check peptide sequences to make sure they are valid for this predictor.", "docstring_tokens": ["Check", "peptide", "sequences", "to", "make", "sure", "they", "are", "valid", "for", "this", "predictor", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 255767}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/converter.py#L23-L39", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "A context manager to temporarily set the training mode of 'model'\n    to 'mode', resetting it when we exit the with-block.  A no-op if\n    mode is None.", "language": "python", "parameters": "(model, mode)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "yield", "return", "arg_2", "=", "arg_0", ".", "training", "if", "arg_2", "!=", "arg_1", ":", "arg_0", ".", "train", "(", "arg_1", ")", "try", ":", "yield", "finally", ":", "if", "arg_2", "!=", "arg_1", ":", "arg_0", ".", "train", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    A context manager to temporarily set the training mode of 'model'\n    to 'mode', resetting it when we exit the with-block.  A no-op if\n    mode is None.\n    \"\"\"\n    if arg_1 is None:\n        yield\n        return\n    arg_2 = arg_0.training\n    if arg_2 != arg_1:\n        arg_0.train(arg_1)\n    try:\n        yield\n    finally:\n        if arg_2 != arg_1:\n            arg_0.train(arg_2)", "path": "pytorch2keras/converter.py", "identifier": "set_training", "docstring": "A context manager to temporarily set the training mode of 'model'\n    to 'mode', resetting it when we exit the with-block.  A no-op if\n    mode is None.", "docstring_tokens": ["A", "context", "manager", "to", "temporarily", "set", "the", "training", "mode", "of", "model", "to", "mode", "resetting", "it", "when", "we", "exit", "the", "with", "-", "block", ".", "A", "no", "-", "op", "if", "mode", "is", "None", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 255768}
{"url": "https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L86-L95", "sha": "51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126", "docstring_summary": "Reverse guard expression. not\n        (", "language": "python", "parameters": "(lst)", "return_statement": "return [rev[l] if l in rev else l for l in lst]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'<'", ":", "'>='", ",", "'>'", ":", "'=<'", ",", "'>='", ":", "'<'", ",", "'=<'", ":", "'>'", "}", "return", "[", "arg_1", "[", "arg_2", "]", "if", "arg_2", "in", "arg_1", "else", "arg_2", "for", "arg_2", "in", "arg_0", "]"], "function": "def Func(arg_0):\n    \"\"\" Reverse guard expression. not\n        (@a > 5) ->  (@a =< 5)\n    Args:\n        lst (list): Expression\n    returns:\n        list\n    \"\"\"\n    arg_1 = {'<': '>=', '>': '=<', '>=': '<', '=<': '>'}\n    return [arg_1[arg_2] if arg_2 in arg_1 else arg_2 for arg_2 in arg_0]", "path": "lesscpy/lessc/utility.py", "identifier": "reverse_guard", "docstring": "Reverse guard expression. not\n        (@a > 5) ->  (@a =< 5)\n    Args:\n        lst (list): Expression\n    returns:\n        list", "docstring_tokens": ["Reverse", "guard", "expression", ".", "not", "("], "nwo": "lesscpy/lesscpy", "score": 0.36630042150969844, "idx": 255769}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/hooks/set.py#L41-L52", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Set a node to a value captured from another node", "language": "python", "parameters": "(self, dst, src)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "value", "=", "arg_0", ".", "value", "(", "arg_2", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n        Set a node to a value captured from another node\n\n        example::\n\n            R = [\n                In : node #setcapture(_, node)\n            ]\n    \"\"\"\n    arg_1.value = arg_0.value(arg_2)\n    return True", "path": "pyrser/hooks/set.py", "identifier": "set_node_as_int", "docstring": "Set a node to a value captured from another node\n\n        example::\n\n            R = [\n                In : node #setcapture(_, node)\n            ]", "docstring_tokens": ["Set", "a", "node", "to", "a", "value", "captured", "from", "another", "node"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 255770}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/futures.py#L83-L130", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Callback from a parent future to update the AppFuture.", "language": "python", "parameters": "(self, executor_fu)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "_update_lock", ":", "if", "not", "arg_1", ".", "done", "(", ")", ":", "raise", "ValueError", "(", "\"done callback called, despite future not reporting itself as done\"", ")", "if", "arg_1", "!=", "arg_0", ".", "parent", ":", "if", "arg_1", ".", "exception", "(", ")", "is", "None", "and", "not", "isinstance", "(", "arg_1", ".", "result", "(", ")", ",", "RemoteExceptionWrapper", ")", ":", "raise", "ValueError", "(", "\"internal consistency error: AppFuture done callback called without an exception, but parent has been changed since then\"", ")", "try", ":", "arg_2", "=", "arg_1", ".", "result", "(", ")", "if", "isinstance", "(", "arg_2", ",", "RemoteExceptionWrapper", ")", ":", "arg_2", ".", "reraise", "(", ")", "super", "(", ")", ".", "set_result", "(", "arg_1", ".", "result", "(", ")", ")", "except", "Exception", "as", "e", ":", "if", "arg_1", ".", "retries_left", ">", "0", ":", "pass", "else", ":", "super", "(", ")", ".", "set_exception", "(", "e", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Callback from a parent future to update the AppFuture.\n\n        Used internally by AppFuture, and should not be called by code using AppFuture.\n\n        Args:\n            - executor_fu (Future): Future returned by the executor along with callback.\n              This may not be the current parent future, as the parent future may have\n              already been updated to point to a retrying execution, and in that case,\n              this is logged.\n\n              In the case that a new parent has been attached, we must immediately discard\n              this result no matter what it contains (although it might be interesting\n              to log if it was successful...)\n\n        Returns:\n            - None\n\n        Updates the super() with the result() or exception()\n        \"\"\"\n        with arg_0._update_lock:\n\n            if not arg_1.done():\n                raise ValueError(\"done callback called, despite future not reporting itself as done\")\n\n            # this is for consistency checking\n            if arg_1 != arg_0.parent:\n                if arg_1.exception() is None and not isinstance(arg_1.result(), RemoteExceptionWrapper):\n                    # ... then we completed with a value, not an exception or wrapped exception,\n                    # but we've got an updated executor future.\n                    # This is bad - for example, we've started a retry even though we have a result\n\n                    raise ValueError(\"internal consistency error: AppFuture done callback called without an exception, but parent has been changed since then\")\n\n            try:\n                arg_2 = arg_1.result()\n                if isinstance(arg_2, RemoteExceptionWrapper):\n                    arg_2.reraise()\n                super().set_result(arg_1.result())\n\n            except Exception as e:\n                if arg_1.retries_left > 0:\n                    # ignore this exception, because assume some later\n                    # parent executor, started external to this class,\n                    # will provide the answer\n                    pass\n                else:\n                    super().set_exception(e)", "path": "parsl/dataflow/futures.py", "identifier": "AppFuture.parent_callback", "docstring": "Callback from a parent future to update the AppFuture.\n\n        Used internally by AppFuture, and should not be called by code using AppFuture.\n\n        Args:\n            - executor_fu (Future): Future returned by the executor along with callback.\n              This may not be the current parent future, as the parent future may have\n              already been updated to point to a retrying execution, and in that case,\n              this is logged.\n\n              In the case that a new parent has been attached, we must immediately discard\n              this result no matter what it contains (although it might be interesting\n              to log if it was successful...)\n\n        Returns:\n            - None\n\n        Updates the super() with the result() or exception()", "docstring_tokens": ["Callback", "from", "a", "parent", "future", "to", "update", "the", "AppFuture", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 255771}
{"url": "https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L439-L458", "sha": "de2e678e2f00e5940de52c000214dbcb8812a222", "docstring_summary": "Lists options that have not been used to format other values in \n        their sections. \n        \n        Good for finding out if the user has misspelled any of the options.", "language": "python", "parameters": "(self, sections)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "set", "(", "[", "]", ")", "for", "arg_3", "in", "_list", "(", "arg_1", ")", ":", "if", "not", "arg_0", ".", "has_section", "(", "arg_3", ")", ":", "continue", "arg_4", "=", "arg_0", ".", "options", "(", "arg_3", ")", "arg_5", "=", "[", "arg_0", ".", "get", "(", "arg_3", ",", "arg_6", ",", "raw", "=", "True", ")", "for", "arg_6", "in", "arg_4", "]", "for", "arg_6", "in", "arg_4", ":", "arg_7", "=", "\"%(\"", "+", "arg_6", "+", "\")s\"", "for", "arg_8", "in", "arg_5", ":", "if", "arg_7", "in", "arg_8", ":", "break", "else", ":", "arg_2", ".", "add", "(", "arg_6", ")", "return", "list", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Lists options that have not been used to format other values in \n        their sections. \n        \n        Good for finding out if the user has misspelled any of the options.\n        \"\"\"\n        arg_2 = set([])\n        for arg_3 in _list(arg_1):\n            if not arg_0.has_section(arg_3):\n                continue\n            arg_4 = arg_0.options(arg_3)\n            arg_5 = [arg_0.get(arg_3, arg_6, raw=True) for arg_6 in arg_4]\n            for arg_6 in arg_4:\n                arg_7 = \"%(\" + arg_6 + \")s\"\n                for arg_8 in arg_5:\n                    if arg_7 in arg_8:\n                        break\n                else:\n                    arg_2.add(arg_6) \n            return list(arg_2)", "path": "tui/__init__.py", "identifier": "StrictConfigParser.unusedoptions", "docstring": "Lists options that have not been used to format other values in \n        their sections. \n        \n        Good for finding out if the user has misspelled any of the options.", "docstring_tokens": ["Lists", "options", "that", "have", "not", "been", "used", "to", "format", "other", "values", "in", "their", "sections", ".", "Good", "for", "finding", "out", "if", "the", "user", "has", "misspelled", "any", "of", "the", "options", "."], "nwo": "yohell/python-tui", "score": 0.2619419494340654, "idx": 255772}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L647-L695", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Isolate change clusters by eliminating ranges with no changes.", "language": "python", "parameters": "(self, n=3)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3", ")", ":", "arg_2", "=", "arg_0", ".", "get_opcodes", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "[", "(", "\"equal\"", ",", "0", ",", "1", ",", "0", ",", "1", ")", "]", "if", "arg_2", "[", "0", "]", "[", "0", "]", "==", "'equal'", ":", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_2", "[", "0", "]", "arg_2", "[", "0", "]", "=", "arg_3", ",", "max", "(", "arg_4", ",", "arg_5", "-", "arg_1", ")", ",", "arg_5", ",", "max", "(", "arg_6", ",", "arg_7", "-", "arg_1", ")", ",", "arg_7", "if", "arg_2", "[", "-", "1", "]", "[", "0", "]", "==", "'equal'", ":", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_2", "[", "-", "1", "]", "arg_2", "[", "-", "1", "]", "=", "arg_3", ",", "arg_4", ",", "min", "(", "arg_5", ",", "arg_4", "+", "arg_1", ")", ",", "arg_6", ",", "min", "(", "arg_7", ",", "arg_6", "+", "arg_1", ")", "arg_8", "=", "arg_1", "+", "arg_1", "arg_9", "=", "[", "]", "for", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_2", ":", "if", "arg_3", "==", "'equal'", "and", "arg_5", "-", "arg_4", ">", "arg_8", ":", "arg_9", ".", "append", "(", "(", "arg_3", ",", "arg_4", ",", "min", "(", "arg_5", ",", "arg_4", "+", "arg_1", ")", ",", "arg_6", ",", "min", "(", "arg_7", ",", "arg_6", "+", "arg_1", ")", ")", ")", "yield", "arg_9", "arg_9", "=", "[", "]", "arg_4", ",", "arg_6", "=", "max", "(", "arg_4", ",", "arg_5", "-", "arg_1", ")", ",", "max", "(", "arg_6", ",", "arg_7", "-", "arg_1", ")", "arg_9", ".", "append", "(", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ")", "if", "arg_9", "and", "not", "(", "len", "(", "arg_9", ")", "==", "1", "and", "arg_9", "[", "0", "]", "[", "0", "]", "==", "'equal'", ")", ":", "yield", "arg_9"], "function": "def Func(arg_0, arg_1=3):\n        \"\"\" Isolate change clusters by eliminating ranges with no changes.\n\n        Return a generator of groups with up to n lines of context.\n        Each group is in the same format as returned by get_opcodes().\n\n        >>> from pprint import pprint\n        >>> a = map(str, range(1,40))\n        >>> b = a[:]\n        >>> b[8:8] = ['i']     # Make an insertion\n        >>> b[20] += 'x'       # Make a replacement\n        >>> b[23:28] = []      # Make a deletion\n        >>> b[30] += 'y'       # Make another replacement\n        >>> pprint(list(SequenceMatcher(None,a,b).Func()))\n        [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],\n         [('equal', 16, 19, 17, 20),\n          ('replace', 19, 20, 20, 21),\n          ('equal', 20, 22, 21, 23),\n          ('delete', 22, 27, 23, 23),\n          ('equal', 27, 30, 23, 26)],\n         [('equal', 31, 34, 27, 30),\n          ('replace', 34, 35, 30, 31),\n          ('equal', 35, 38, 31, 34)]]\n        \"\"\"\n\n        arg_2 = arg_0.get_opcodes()\n        if not arg_2:\n            arg_2 = [(\"equal\", 0, 1, 0, 1)]\n        # Fixup leading and trailing groups if they show no changes.\n        if arg_2[0][0] == 'equal':\n            arg_3, arg_4, arg_5, arg_6, arg_7 = arg_2[0]\n            arg_2[0] = arg_3, max(arg_4, arg_5-arg_1), arg_5, max(arg_6, arg_7-arg_1), arg_7\n        if arg_2[-1][0] == 'equal':\n            arg_3, arg_4, arg_5, arg_6, arg_7 = arg_2[-1]\n            arg_2[-1] = arg_3, arg_4, min(arg_5, arg_4+arg_1), arg_6, min(arg_7, arg_6+arg_1)\n\n        arg_8 = arg_1 + arg_1\n        arg_9 = []\n        for arg_3, arg_4, arg_5, arg_6, arg_7 in arg_2:\n            # End the current group and start a new one whenever\n            # there is a large range with no changes.\n            if arg_3 == 'equal' and arg_5-arg_4 > arg_8:\n                arg_9.append((arg_3, arg_4, min(arg_5, arg_4+arg_1), arg_6, min(arg_7, arg_6+arg_1)))\n                yield arg_9\n                arg_9 = []\n                arg_4, arg_6 = max(arg_4, arg_5-arg_1), max(arg_6, arg_7-arg_1)\n            arg_9.append((arg_3, arg_4, arg_5, arg_6 ,arg_7))\n        if arg_9 and not (len(arg_9)==1 and arg_9[0][0] == 'equal'):\n            yield arg_9", "path": "third_party/stdlib/difflib.py", "identifier": "SequenceMatcher.get_grouped_opcodes", "docstring": "Isolate change clusters by eliminating ranges with no changes.\n\n        Return a generator of groups with up to n lines of context.\n        Each group is in the same format as returned by get_opcodes().\n\n        >>> from pprint import pprint\n        >>> a = map(str, range(1,40))\n        >>> b = a[:]\n        >>> b[8:8] = ['i']     # Make an insertion\n        >>> b[20] += 'x'       # Make a replacement\n        >>> b[23:28] = []      # Make a deletion\n        >>> b[30] += 'y'       # Make another replacement\n        >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes()))\n        [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],\n         [('equal', 16, 19, 17, 20),\n          ('replace', 19, 20, 20, 21),\n          ('equal', 20, 22, 21, 23),\n          ('delete', 22, 27, 23, 23),\n          ('equal', 27, 30, 23, 26)],\n         [('equal', 31, 34, 27, 30),\n          ('replace', 34, 35, 30, 31),\n          ('equal', 35, 38, 31, 34)]]", "docstring_tokens": ["Isolate", "change", "clusters", "by", "eliminating", "ranges", "with", "no", "changes", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 255773}
{"url": "https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/schedulelib.py#L70-L100", "sha": "6ac71bda1de6706fb34244ae4972e36db5f062d3", "docstring_summary": "Run a process, return a deferred that fires when it is done", "language": "python", "parameters": "(args, timeout, grace, reactor)", "return_statement": "return deferred", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "defer", ".", "Deferred", "(", ")", "arg_5", "=", "ProcessProtocol", "(", "arg_4", ")", "arg_6", "=", "arg_3", ".", "spawnProcess", "(", "arg_5", ",", "arg_0", "[", "0", "]", ",", "arg_0", ",", "env", "=", "os", ".", "environ", ")", "def", "_logEnded", "(", "arg_7", ")", ":", "arg_7", ".", "trap", "(", "tierror", ".", "ProcessDone", ",", "tierror", ".", "ProcessTerminated", ")", "print", "(", "arg_7", ".", "value", ")", "arg_4", ".", "addErrback", "(", "_logEnded", ")", "def", "_cancelTermination", "(", "arg_8", ")", ":", "for", "arg_9", "in", "arg_10", ":", "if", "arg_9", ".", "active", "(", ")", ":", "arg_9", ".", "cancel", "(", ")", "arg_4", ".", "addCallback", "(", "_cancelTermination", ")", "arg_10", "=", "[", "]", "arg_10", ".", "append", "(", "arg_3", ".", "callLater", "(", "arg_1", ",", "arg_6", ".", "signalProcess", ",", "\"TERM\"", ")", ")", "arg_10", ".", "append", "(", "arg_3", ".", "callLater", "(", "arg_1", "+", "arg_2", ",", "arg_6", ".", "signalProcess", ",", "\"KILL\"", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Run a process, return a deferred that fires when it is done\n\n    :params args: Process arguments\n    :params timeout: Time before terminating process\n    :params grace: Time before killing process after terminating it\n    :params reactor: IReactorProcess and IReactorTime\n    :returns: deferred that fires with success when the process ends,\n              or fails if there was a problem spawning/terminating\n              the process\n    \"\"\"\n    arg_4 = defer.Deferred()\n    arg_5 = ProcessProtocol(arg_4)\n    arg_6 = arg_3.spawnProcess(arg_5, arg_0[0], arg_0, env=os.environ)\n\n    def _logEnded(arg_7):\n        arg_7.trap(tierror.ProcessDone, tierror.ProcessTerminated)\n        print(arg_7.value)\n    arg_4.addErrback(_logEnded)\n\n    def _cancelTermination(arg_8):\n        for arg_9 in arg_10:\n            if arg_9.active():\n                arg_9.cancel()\n    arg_4.addCallback(_cancelTermination)\n    arg_10 = []\n    arg_10.append(arg_3.callLater(arg_1, arg_6.signalProcess,\n                                          \"TERM\"))\n    arg_10.append(arg_3.callLater(arg_1+arg_2,\n                                          arg_6.signalProcess, \"KILL\"))\n    return arg_4", "path": "ncolony/schedulelib.py", "identifier": "runProcess", "docstring": "Run a process, return a deferred that fires when it is done\n\n    :params args: Process arguments\n    :params timeout: Time before terminating process\n    :params grace: Time before killing process after terminating it\n    :params reactor: IReactorProcess and IReactorTime\n    :returns: deferred that fires with success when the process ends,\n              or fails if there was a problem spawning/terminating\n              the process", "docstring_tokens": ["Run", "a", "process", "return", "a", "deferred", "that", "fires", "when", "it", "is", "done"], "nwo": "ncolony/ncolony", "score": 0.2757871243566705, "idx": 255774}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L570-L593", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Collection content browsing route function", "language": "python", "parameters": "(self, objectId, lang=None)", "return_statement": "return {\n            \"template\": \"main::collection.html\",\n            \"collections\": {\n                \"current\": {\n                    \"label\": str(collection.get_label(lang)),\n                    \"id\": collection.id,\n                    \"model\": str(collection.model),\n                    \"type\": str(collection.type),\n                },\n                \"members\": self.make_members(collection, lang=lang),\n                \"parents\": self.make_parents(collection, lang=lang)\n            },\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "resolver", ".", "getMetadata", "(", "arg_1", ")", "return", "{", "\"template\"", ":", "\"main::collection.html\"", ",", "\"collections\"", ":", "{", "\"current\"", ":", "{", "\"label\"", ":", "str", "(", "arg_3", ".", "get_label", "(", "arg_2", ")", ")", ",", "\"id\"", ":", "arg_3", ".", "id", ",", "\"model\"", ":", "str", "(", "arg_3", ".", "model", ")", ",", "\"type\"", ":", "str", "(", "arg_3", ".", "type", ")", ",", "}", ",", "\"members\"", ":", "arg_0", ".", "make_members", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", ",", "\"parents\"", ":", "arg_0", ".", "make_parents", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", "}", ",", "}"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\" Collection content browsing route function\n\n        :param objectId: Collection identifier\n        :type objectId: str\n        :param lang: Lang in which to express main data\n        :type lang: str\n        :return: Template and collections contained in given collection\n        :rtype: {str: Any}\n        \"\"\"\n        arg_3 = arg_0.resolver.getMetadata(arg_1)\n        return {\n            \"template\": \"main::collection.html\",\n            \"collections\": {\n                \"current\": {\n                    \"label\": str(arg_3.get_label(arg_2)),\n                    \"id\": arg_3.id,\n                    \"model\": str(arg_3.model),\n                    \"type\": str(arg_3.type),\n                },\n                \"members\": arg_0.make_members(arg_3, arg_2=arg_2),\n                \"parents\": arg_0.make_parents(arg_3, arg_2=arg_2)\n            },\n        }", "path": "flask_nemo/__init__.py", "identifier": "Nemo.r_collection", "docstring": "Collection content browsing route function\n\n        :param objectId: Collection identifier\n        :type objectId: str\n        :param lang: Lang in which to express main data\n        :type lang: str\n        :return: Template and collections contained in given collection\n        :rtype: {str: Any}", "docstring_tokens": ["Collection", "content", "browsing", "route", "function"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 255775}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L179-L192", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Returns the interface name of the first not link_local and not loopback interface.", "language": "python", "parameters": "()", "return_statement": "return interface_name", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "''", "arg_1", "=", "psutil", ".", "net_if_addrs", "(", ")", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "family", "==", "socket", ".", "AF_INET", ":", "arg_5", "=", "ipaddress", ".", "ip_address", "(", "arg_4", ".", "address", ")", "if", "not", "(", "arg_5", ".", "is_link_local", "or", "arg_5", ".", "is_loopback", ")", ":", "arg_0", "=", "arg_2", "break", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n        Returns the interface name of the first not link_local and not loopback interface.\n    \"\"\"\n    arg_0 = ''\n    arg_1 = psutil.net_if_addrs()\n    for arg_2, arg_3 in arg_1.items():\n        for arg_4 in arg_3:\n            if arg_4.family == socket.AF_INET:\n                arg_5 = ipaddress.ip_address(arg_4.address)\n                if not (arg_5.is_link_local or arg_5.is_loopback):\n                    arg_0 = arg_2\n                    break\n    return arg_0", "path": "jackal/scripts/relaying.py", "identifier": "get_interface_name", "docstring": "Returns the interface name of the first not link_local and not loopback interface.", "docstring_tokens": ["Returns", "the", "interface", "name", "of", "the", "first", "not", "link_local", "and", "not", "loopback", "interface", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 255776}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L402-L468", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the children of this process as a list of Process\n        objects.\n        If recursive is True return all the parent descendants.", "language": "python", "parameters": "(self, recursive=False)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "not", "arg_0", ".", "is_running", "(", ")", ":", "arg_2", "=", "arg_0", ".", "_platform_impl", ".", "_process_name", "raise", "NoSuchProcess", "(", "arg_0", ".", "pid", ",", "arg_2", ")", "arg_3", "=", "[", "]", "if", "not", "arg_1", ":", "for", "arg_4", "in", "process_iter", "(", ")", ":", "try", ":", "if", "arg_4", ".", "ppid", "==", "arg_0", ".", "pid", ":", "if", "arg_0", ".", "create_time", "<=", "arg_4", ".", "create_time", ":", "arg_3", ".", "append", "(", "arg_4", ")", "except", "NoSuchProcess", ":", "pass", "else", ":", "arg_5", "=", "defaultdict", "(", "list", ")", "for", "arg_4", "in", "process_iter", "(", ")", ":", "try", ":", "arg_5", "[", "arg_4", ".", "ppid", "]", ".", "append", "(", "arg_4", ")", "except", "NoSuchProcess", ":", "pass", "arg_6", "=", "[", "arg_0", ".", "pid", "]", "for", "arg_7", "in", "arg_6", ":", "for", "arg_8", "in", "arg_5", "[", "arg_7", "]", ":", "try", ":", "arg_9", "=", "arg_0", ".", "create_time", "<=", "arg_8", ".", "create_time", "except", "NoSuchProcess", ":", "pass", "else", ":", "if", "arg_9", ":", "arg_3", ".", "append", "(", "arg_8", ")", "if", "arg_8", ".", "pid", "not", "in", "arg_6", ":", "arg_6", ".", "append", "(", "arg_8", ".", "pid", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Return the children of this process as a list of Process\n        objects.\n        If recursive is True return all the parent descendants.\n\n        Example (A == this process):\n\n         A \u2500\u2510\n            \u2502\n            \u251c\u2500 B (child) \u2500\u2510\n            \u2502             \u2514\u2500 X (grandchild) \u2500\u2510\n            \u2502                                \u2514\u2500 Y (great grandchild)\n            \u251c\u2500 C (child)\n            \u2514\u2500 D (child)\n\n        >>> p.Func()\n        B, C, D\n        >>> p.Func(recursive=True)\n        B, X, Y, C, D\n\n        Note that in the example above if process X disappears\n        process Y won't be returned either as the reference to\n        process A is lost.\n        \"\"\"\n        if not arg_0.is_running():\n            arg_2 = arg_0._platform_impl._process_name\n            raise NoSuchProcess(arg_0.pid, arg_2)\n\n        arg_3 = []\n        if not arg_1:\n            for arg_4 in process_iter():\n                try:\n                    if arg_4.ppid == arg_0.pid:\n                        # if child happens to be older than its parent\n                        # (self) it means child's PID has been reused\n                        if arg_0.create_time <= arg_4.create_time:\n                            arg_3.append(arg_4)\n                except NoSuchProcess:\n                    pass\n        else:\n            # construct a dict where 'values' are all the processes\n            # having 'key' as their parent\n            arg_5 = defaultdict(list)\n            for arg_4 in process_iter():\n                try:\n                    arg_5[arg_4.ppid].append(arg_4)\n                except NoSuchProcess:\n                    pass\n            # At this point we have a mapping table where table[self.pid]\n            # are the current process's children.\n            # Below, we look for all descendants recursively, similarly\n            # to a recursive function call.\n            arg_6 = [arg_0.pid]\n            for arg_7 in arg_6:\n                for arg_8 in arg_5[arg_7]:\n                    try:\n                        # if child happens to be older than its parent\n                        # (self) it means child's PID has been reused\n                        arg_9 = arg_0.create_time <= arg_8.create_time\n                    except NoSuchProcess:\n                        pass\n                    else:\n                        if arg_9:\n                            arg_3.append(arg_8)\n                            if arg_8.pid not in arg_6:\n                                arg_6.append(arg_8.pid)\n        return arg_3", "path": "environment/lib/python2.7/site-packages/psutil/__init__.py", "identifier": "Process.get_children", "docstring": "Return the children of this process as a list of Process\n        objects.\n        If recursive is True return all the parent descendants.\n\n        Example (A == this process):\n\n         A \u2500\u2510\n            \u2502\n            \u251c\u2500 B (child) \u2500\u2510\n            \u2502             \u2514\u2500 X (grandchild) \u2500\u2510\n            \u2502                                \u2514\u2500 Y (great grandchild)\n            \u251c\u2500 C (child)\n            \u2514\u2500 D (child)\n\n        >>> p.get_children()\n        B, C, D\n        >>> p.get_children(recursive=True)\n        B, X, Y, C, D\n\n        Note that in the example above if process X disappears\n        process Y won't be returned either as the reference to\n        process A is lost.", "docstring_tokens": ["Return", "the", "children", "of", "this", "process", "as", "a", "list", "of", "Process", "objects", ".", "If", "recursive", "is", "True", "return", "all", "the", "parent", "descendants", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255777}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/generators/causal_mechanisms.py#L344-L347", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Init a uniform noise variable.", "language": "python", "parameters": "(points)", "return_statement": "return np.random.rand(1) * np.random.uniform(points, 1) \\\n        + random.sample([2, -2], 1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "np", ".", "random", ".", "rand", "(", "1", ")", "*", "np", ".", "random", ".", "uniform", "(", "arg_0", ",", "1", ")", "+", "random", ".", "sample", "(", "[", "2", ",", "-", "2", "]", ",", "1", ")"], "function": "def Func(arg_0):\n    \"\"\"Init a uniform noise variable.\"\"\"\n    return np.random.rand(1) * np.random.uniform(arg_0, 1) \\\n        + random.sample([2, -2], 1)", "path": "cdt/generators/causal_mechanisms.py", "identifier": "uniform_noise", "docstring": "Init a uniform noise variable.", "docstring_tokens": ["Init", "a", "uniform", "noise", "variable", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 255778}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/kps.py#L852-L877", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Create a deep copy of the KeypointsOnImage object.", "language": "python", "parameters": "(self, keypoints=None, shape=None)", "return_statement": "return KeypointsOnImage(keypoints, shape)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "kp", ".", "Func", "(", ")", "for", "kp", "in", "arg_0", ".", "keypoints", "]", "if", "arg_2", "is", "None", ":", "arg_2", "=", "tuple", "(", "arg_0", ".", "shape", ")", "return", "KeypointsOnImage", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Create a deep copy of the KeypointsOnImage object.\n\n        Parameters\n        ----------\n        keypoints : None or list of imgaug.Keypoint, optional\n            List of keypoints on the image. If ``None``, the instance's\n            keypoints will be copied.\n\n        shape : tuple of int, optional\n            The shape of the image on which the keypoints are placed.\n            If ``None``, the instance's shape will be copied.\n\n        Returns\n        -------\n        imgaug.KeypointsOnImage\n            Deep copy.\n\n        \"\"\"\n        # for some reason Func is way slower here than manual copy\n        if arg_1 is None:\n            arg_1 = [kp.Func() for kp in arg_0.keypoints]\n        if arg_2 is None:\n            arg_2 = tuple(arg_0.shape)\n        return KeypointsOnImage(arg_1, arg_2)", "path": "imgaug/augmentables/kps.py", "identifier": "KeypointsOnImage.deepcopy", "docstring": "Create a deep copy of the KeypointsOnImage object.\n\n        Parameters\n        ----------\n        keypoints : None or list of imgaug.Keypoint, optional\n            List of keypoints on the image. If ``None``, the instance's\n            keypoints will be copied.\n\n        shape : tuple of int, optional\n            The shape of the image on which the keypoints are placed.\n            If ``None``, the instance's shape will be copied.\n\n        Returns\n        -------\n        imgaug.KeypointsOnImage\n            Deep copy.", "docstring_tokens": ["Create", "a", "deep", "copy", "of", "the", "KeypointsOnImage", "object", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 255779}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/mysql.py#L280-L299", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Drops all views.", "language": "python", "parameters": "(self, name=None, site=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "database_renderer", "arg_4", "=", "arg_3", ".", "sudo", "(", "\"mysql --batch -v -h {db_host} \"", "\"-u {db_user} -p'{db_password}' \"", "\"--execute=\\\"SELECT GROUP_CONCAT(CONCAT(TABLE_SCHEMA,'.',table_name) SEPARATOR ', ') AS views \"", "\"FROM INFORMATION_SCHEMA.views WHERE TABLE_SCHEMA = '{db_name}' ORDER BY table_name DESC;\\\"\"", ")", "arg_4", "=", "re", ".", "findall", "(", "r'^views[\\s\\t\\r\\n]+(.*)'", ",", "arg_4", ",", "flags", "=", "re", ".", "IGNORECASE", "|", "re", ".", "DOTALL", "|", "re", ".", "MULTILINE", ")", "if", "not", "arg_4", ":", "return", "arg_3", ".", "env", ".", "db_view_list", "=", "arg_4", "[", "0", "]", "arg_3", ".", "sudo", "(", "\"mysql -v -h {db_host} -u {db_user} -p'{db_password}' \"", "\"--execute=\\\"DROP VIEW {db_view_list} CASCADE;\\\"\"", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Drops all views.\n        \"\"\"\n        arg_3 = arg_0.database_renderer\n        arg_4 = arg_3.sudo(\"mysql --batch -v -h {db_host} \"\n            #\"-u {db_root_username} -p'{db_root_password}' \"\n            \"-u {db_user} -p'{db_password}' \"\n            \"--execute=\\\"SELECT GROUP_CONCAT(CONCAT(TABLE_SCHEMA,'.',table_name) SEPARATOR ', ') AS views \"\n            \"FROM INFORMATION_SCHEMA.views WHERE TABLE_SCHEMA = '{db_name}' ORDER BY table_name DESC;\\\"\")\n        arg_4 = re.findall(\n            r'^views[\\s\\t\\r\\n]+(.*)',\n            arg_4,\n            flags=re.IGNORECASE|re.DOTALL|re.MULTILINE)\n        if not arg_4:\n            return\n        arg_3.env.db_view_list = arg_4[0]\n        #cmd = (\"mysql -v -h {db_host} -u {db_root_username} -p'{db_root_password}' \" \\\n        arg_3.sudo(\"mysql -v -h {db_host} -u {db_user} -p'{db_password}' \" \\\n            \"--execute=\\\"DROP VIEW {db_view_list} CASCADE;\\\"\")", "path": "burlap/mysql.py", "identifier": "MySQLSatchel.drop_views", "docstring": "Drops all views.", "docstring_tokens": ["Drops", "all", "views", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 255780}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball.py#L147-L165", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return Porter helper function _sb_has_vowel value.", "language": "python", "parameters": "(self, term)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", "in", "arg_0", ".", "_vowels", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return Porter helper function Func value.\n\n        Parameters\n        ----------\n        term : str\n            The term to examine\n\n        Returns\n        -------\n        bool\n            True iff a vowel exists in the term (as defined in the Porter\n            stemmer definition)\n\n        \"\"\"\n        for arg_2 in arg_1:\n            if arg_2 in arg_0._vowels:\n                return True\n        return False", "path": "abydos/stemmer/_snowball.py", "identifier": "_Snowball._sb_has_vowel", "docstring": "Return Porter helper function _sb_has_vowel value.\n\n        Parameters\n        ----------\n        term : str\n            The term to examine\n\n        Returns\n        -------\n        bool\n            True iff a vowel exists in the term (as defined in the Porter\n            stemmer definition)", "docstring_tokens": ["Return", "Porter", "helper", "function", "_sb_has_vowel", "value", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 255781}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L712-L717", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read a quoted form from the input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "return llist.l(_QUOTE, next_form)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "llist", ".", "List", ":", "arg_2", "=", "arg_0", ".", "reader", ".", "advance", "(", ")", "assert", "arg_2", "==", "\"'\"", "arg_3", "=", "_read_next_consuming_comment", "(", "arg_0", ")", "return", "llist", ".", "l", "(", "_QUOTE", ",", "arg_3", ")"], "function": "def Func(arg_0: arg_1) -> llist.List:\n    \"\"\"Read a quoted form from the input stream.\"\"\"\n    arg_2 = arg_0.reader.advance()\n    assert arg_2 == \"'\"\n    arg_3 = _read_next_consuming_comment(arg_0)\n    return llist.l(_QUOTE, arg_3)", "path": "src/basilisp/lang/reader.py", "identifier": "_read_quoted", "docstring": "Read a quoted form from the input stream.", "docstring_tokens": ["Read", "a", "quoted", "form", "from", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255782}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/decorators.py#L14-L52", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Ensure the user making the API request is associated with an EnterpriseCustomer.", "language": "python", "parameters": "(view)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "user", "arg_5", "=", "get_enterprise_customer_for_user", "(", "arg_4", ")", "if", "arg_5", ":", "arg_2", "=", "arg_2", "+", "(", "arg_5", ",", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "else", ":", "raise", "PermissionDenied", "(", "'User {username} is not associated with an EnterpriseCustomer.'", ".", "format", "(", "username", "=", "arg_4", ".", "username", ")", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Ensure the user making the API request is associated with an EnterpriseCustomer.\n\n    This decorator attempts to find an EnterpriseCustomer associated with the requesting\n    user and passes that EnterpriseCustomer to the view as a parameter. It will return a\n    PermissionDenied error if an EnterpriseCustomer cannot be found.\n\n    Usage::\n        @Func()\n        def my_view(request, enterprise_customer):\n            # Some functionality ...\n\n        OR\n\n        class MyView(View):\n            ...\n            @method_decorator(Func)\n            def get(self, request, enterprise_customer):\n                # Some functionality ...\n    \"\"\"\n    @wraps(arg_0)\n    def wrapper(arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Checks for an enterprise customer associated with the user, calls the view function\n        if one exists, raises PermissionDenied if not.\n        \"\"\"\n        arg_4 = arg_1.user\n        arg_5 = get_enterprise_customer_for_user(arg_4)\n        if arg_5:\n            arg_2 = arg_2 + (arg_5,)\n            return arg_0(arg_1, *arg_2, **arg_3)\n        else:\n            raise PermissionDenied(\n                'User {username} is not associated with an EnterpriseCustomer.'.format(\n                    username=arg_4.username\n                )\n            )\n    return wrapper", "path": "enterprise/api/v1/decorators.py", "identifier": "enterprise_customer_required", "docstring": "Ensure the user making the API request is associated with an EnterpriseCustomer.\n\n    This decorator attempts to find an EnterpriseCustomer associated with the requesting\n    user and passes that EnterpriseCustomer to the view as a parameter. It will return a\n    PermissionDenied error if an EnterpriseCustomer cannot be found.\n\n    Usage::\n        @enterprise_customer_required()\n        def my_view(request, enterprise_customer):\n            # Some functionality ...\n\n        OR\n\n        class MyView(View):\n            ...\n            @method_decorator(enterprise_customer_required)\n            def get(self, request, enterprise_customer):\n                # Some functionality ...", "docstring_tokens": ["Ensure", "the", "user", "making", "the", "API", "request", "is", "associated", "with", "an", "EnterpriseCustomer", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 255783}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/expressions.py#L104-L112", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Gets a re-labeled clone of this expression.", "language": "python", "parameters": "(self, relabels)", "return_statement": "return self.__class__(\n            relabels.get(self.alias, self.alias),\n            self.target,\n            self.hstore_key,\n            self.output_field\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "__class__", "(", "arg_1", ".", "get", "(", "arg_0", ".", "alias", ",", "arg_0", ".", "alias", ")", ",", "arg_0", ".", "target", ",", "arg_0", ".", "hstore_key", ",", "arg_0", ".", "output_field", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Gets a re-labeled clone of this expression.\"\"\"\n\n        return arg_0.__class__(\n            arg_1.get(arg_0.alias, arg_0.alias),\n            arg_0.target,\n            arg_0.hstore_key,\n            arg_0.output_field\n        )", "path": "psqlextra/expressions.py", "identifier": "HStoreColumn.relabeled_clone", "docstring": "Gets a re-labeled clone of this expression.", "docstring_tokens": ["Gets", "a", "re", "-", "labeled", "clone", "of", "this", "expression", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 255784}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/get_year_commits.py#L127-L146", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Writes the weeks with associated commits to file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "'../github_stats_output/last_year_commits.csv'", ",", "'w+'", ")", "as", "output", ":", "output", ".", "write", "(", "'date,organization,repos,members,teams,'", "+", "'unique_contributors,total_contributors,forks,'", "+", "'stargazers,pull_requests,open_issues,has_readme,'", "+", "'has_license,pull_requests_open,pull_requests_closed,'", "+", "'commits\\n'", ")", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ".", "sorted_weeks", ":", "if", "str", "(", "arg_0", ".", "commits", "[", "arg_2", "]", ")", "!=", "arg_1", ":", "arg_3", "=", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "arg_2", ")", ".", "strftime", "(", "'%Y-%m-%d'", ")", "output", ".", "write", "(", "arg_3", "+", "',llnl,0,0,0,0,0,0,0,0,0,0,0,0,0,'", "+", "str", "(", "arg_0", ".", "commits", "[", "arg_2", "]", ")", "+", "'\\n'", ")", "arg_1", "=", "str", "(", "arg_0", ".", "commits", "[", "arg_2", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Writes the weeks with associated commits to file.\n        \"\"\"\n        with open('../github_stats_output/last_year_commits.csv', 'w+') as output:\n            output.write('date,organization,repos,members,teams,'\n                + 'unique_contributors,total_contributors,forks,'\n                + 'stargazers,pull_requests,open_issues,has_readme,'\n                + 'has_license,pull_requests_open,pull_requests_closed,'\n                + 'commits\\n')\n            #no reverse this time to print oldest first\n            arg_1 = 0\n            for arg_2 in arg_0.sorted_weeks:\n                if str(arg_0.commits[arg_2]) != arg_1:#delete dups\n                    arg_3 = datetime.datetime.utcfromtimestamp(\n                        arg_2 ).strftime('%Y-%m-%d')\n                    output.write(arg_3\n                        + ',llnl,0,0,0,0,0,0,0,0,0,0,0,0,0,'\n                        + str(arg_0.commits[arg_2]) + '\\n')\n                    arg_1 = str(arg_0.commits[arg_2])", "path": "scripts/get_year_commits.py", "identifier": "GitHub_LLNL_Year_Commits.write_to_file", "docstring": "Writes the weeks with associated commits to file.", "docstring_tokens": ["Writes", "the", "weeks", "with", "associated", "commits", "to", "file", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 255785}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/usb.py#L107-L113", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "230v power off", "language": "python", "parameters": "(self, interval=200)", "return_statement": "return self.__press(self.__power_off_port, interval=interval)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "200", ")", ":", "if", "arg_0", ".", "__Func_port", "is", "None", ":", "cij", ".", "err", "(", "\"cij.usb.relay: Invalid USB_RELAY_POWER_OFF\"", ")", "return", "1", "return", "arg_0", ".", "__press", "(", "arg_0", ".", "__Func_port", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=200):\n        \"\"\"230v power off\"\"\"\n        if arg_0.__Func_port is None:\n            cij.err(\"cij.usb.relay: Invalid USB_RELAY_POWER_OFF\")\n            return 1\n\n        return arg_0.__press(arg_0.__Func_port, arg_1=arg_1)", "path": "modules/cij/usb.py", "identifier": "Relay.power_off", "docstring": "230v power off", "docstring_tokens": ["230v", "power", "off"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 255786}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/sphinxtechnotes.py#L207-L214", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Download the metadata.yaml file from a technote's GitHub repository.", "language": "python", "parameters": "(session, github_url)", "return_statement": "return yaml.safe_load(yaml_data)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_build_metadata_yaml_url", "(", "arg_1", ")", "async", "with", "arg_0", ".", "get", "(", "arg_2", ")", "as", "response", ":", "response", ".", "raise_for_status", "(", ")", "arg_3", "=", "await", "response", ".", "text", "(", ")", "return", "yaml", ".", "safe_load", "(", "arg_3", ")"], "function": "async def Func(arg_0, arg_1):\n    \"\"\"Download the metadata.yaml file from a technote's GitHub repository.\n    \"\"\"\n    arg_2 = _build_metadata_yaml_url(arg_1)\n    async with arg_0.get(arg_2) as response:\n        response.raise_for_status()\n        arg_3 = await response.text()\n    return yaml.safe_load(arg_3)", "path": "lsstprojectmeta/lsstdocument/sphinxtechnotes.py", "identifier": "download_metadata_yaml", "docstring": "Download the metadata.yaml file from a technote's GitHub repository.", "docstring_tokens": ["Download", "the", "metadata", ".", "yaml", "file", "from", "a", "technote", "s", "GitHub", "repository", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 255787}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L476-L501", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Creates a SecBufferDesc struct and contained SecBuffer structs", "language": "python", "parameters": "(self, number)", "return_statement": "return (sec_buffer_desc_pointer, buffers)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "new", "(", "secur32", ",", "'SecBuffer[%d]'", "%", "arg_1", ")", "for", "arg_3", "in", "range", "(", "0", ",", "arg_1", ")", ":", "arg_2", "[", "arg_3", "]", ".", "cbBuffer", "=", "0", "arg_2", "[", "arg_3", "]", ".", "BufferType", "=", "Secur32Const", ".", "SECBUFFER_EMPTY", "arg_2", "[", "arg_3", "]", ".", "pvBuffer", "=", "null", "(", ")", "arg_7", "=", "struct", "(", "secur32", ",", "'SecBufferDesc'", ")", "arg_8", "=", "unwrap", "(", "arg_7", ")", "arg_8", ".", "ulVersion", "=", "Secur32Const", ".", "SECBUFFER_VERSION", "arg_8", ".", "cBuffers", "=", "arg_1", "arg_8", ".", "pBuffers", "=", "arg_2", "return", "(", "arg_7", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Creates a SecBufferDesc struct and contained SecBuffer structs\n\n        :param number:\n            The number of contains SecBuffer objects to create\n\n        :return:\n            A tuple of (SecBufferDesc pointer, SecBuffer array)\n        \"\"\"\n\n        arg_2 = new(secur32, 'SecBuffer[%d]' % arg_1)\n\n        for arg_3 in range(0, arg_1):\n            arg_2[arg_3].cbBuffer = 0\n            arg_2[arg_3].BufferType = Secur32Const.SECBUFFER_EMPTY\n            arg_2[arg_3].pvBuffer = null()\n\n        arg_7 = struct(secur32, 'SecBufferDesc')\n        arg_8 = unwrap(arg_7)\n\n        arg_8.ulVersion = Secur32Const.SECBUFFER_VERSION\n        arg_8.cBuffers = arg_1\n        arg_8.pBuffers = arg_2\n\n        return (arg_7, arg_2)", "path": "oscrypto/_win/tls.py", "identifier": "TLSSocket._create_buffers", "docstring": "Creates a SecBufferDesc struct and contained SecBuffer structs\n\n        :param number:\n            The number of contains SecBuffer objects to create\n\n        :return:\n            A tuple of (SecBufferDesc pointer, SecBuffer array)", "docstring_tokens": ["Creates", "a", "SecBufferDesc", "struct", "and", "contained", "SecBuffer", "structs"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 255788}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/utils.py#L171-L196", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Group in a dictionary all the DICOM files in dicom_paths\n    separated by the given `hdr_field` tag value.", "language": "python", "parameters": "(dicom_paths, hdr_field='PatientID')", "return_statement": "return dicom_groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'PatientID'", ")", ":", "arg_2", "=", "defaultdict", "(", "list", ")", "try", ":", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "dicom", ".", "read_file", "(", "arg_3", ")", "arg_5", "=", "getattr", "(", "arg_4", ",", "arg_1", ")", "arg_2", "[", "arg_5", "]", ".", "append", "(", "arg_3", ")", "except", "KeyError", "as", "ke", ":", "raise", "KeyError", "(", "'Error reading field {} from file {}.'", ".", "format", "(", "arg_1", ",", "arg_3", ")", ")", "from", "ke", "return", "arg_2"], "function": "def Func(arg_0, arg_1='PatientID'):\n    \"\"\"Group in a dictionary all the DICOM files in dicom_paths\n    separated by the given `hdr_field` tag value.\n\n    Parameters\n    ----------\n    dicom_paths: str\n        Iterable of DICOM file paths.\n\n    hdr_field: str\n        Name of the DICOM tag whose values will be used as key for the group.\n\n    Returns\n    -------\n    dicom_groups: dict of dicom_paths\n    \"\"\"\n    arg_2 = defaultdict(list)\n    try:\n        for arg_3 in arg_0:\n            arg_4 = dicom.read_file(arg_3)\n            arg_5 = getattr(arg_4, arg_1)\n            arg_2[arg_5].append(arg_3)\n    except KeyError as ke:\n        raise KeyError('Error reading field {} from file {}.'.format(arg_1, arg_3)) from ke\n\n    return arg_2", "path": "boyle/dicom/utils.py", "identifier": "group_dicom_files", "docstring": "Group in a dictionary all the DICOM files in dicom_paths\n    separated by the given `hdr_field` tag value.\n\n    Parameters\n    ----------\n    dicom_paths: str\n        Iterable of DICOM file paths.\n\n    hdr_field: str\n        Name of the DICOM tag whose values will be used as key for the group.\n\n    Returns\n    -------\n    dicom_groups: dict of dicom_paths", "docstring_tokens": ["Group", "in", "a", "dictionary", "all", "the", "DICOM", "files", "in", "dicom_paths", "separated", "by", "the", "given", "hdr_field", "tag", "value", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255789}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanzaprocessor.py#L277-L300", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Process message stanza.", "language": "python", "parameters": "(self, stanza)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "stanza_type", "if", "arg_2", "is", "None", ":", "arg_2", "=", "\"normal\"", "if", "arg_0", ".", "__try_handlers", "(", "arg_0", ".", "_message_handlers", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", ":", "return", "True", "if", "arg_2", "not", "in", "(", "\"error\"", ",", "\"normal\"", ")", ":", "return", "arg_0", ".", "__try_handlers", "(", "arg_0", ".", "_message_handlers", ",", "arg_1", ",", "arg_2", "=", "\"normal\"", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process message stanza.\n\n        Pass it to a handler of the stanza's type and payload namespace.\n        If no handler for the actual stanza type succeeds then hadlers\n        for type \"normal\" are used.\n\n        :Parameters:\n            - `stanza`: message stanza to be handled\n        \"\"\"\n\n        arg_2 = arg_1.stanza_type\n        if arg_2 is None:\n            arg_2 = \"normal\"\n\n        if arg_0.__try_handlers(arg_0._message_handlers, arg_1,\n                                                arg_2 = arg_2):\n            return True\n\n        if arg_2 not in (\"error\", \"normal\"):\n            # try 'normal' handler additionaly to the regular handler\n            return arg_0.__try_handlers(arg_0._message_handlers, arg_1,\n                                                    arg_2 = \"normal\")\n        return False", "path": "pyxmpp2/stanzaprocessor.py", "identifier": "StanzaProcessor.process_message", "docstring": "Process message stanza.\n\n        Pass it to a handler of the stanza's type and payload namespace.\n        If no handler for the actual stanza type succeeds then hadlers\n        for type \"normal\" are used.\n\n        :Parameters:\n            - `stanza`: message stanza to be handled", "docstring_tokens": ["Process", "message", "stanza", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 255790}
{"url": "https://github.com/FaradayRF/faradayio/blob/6cf3af88bb4a83e5d2036e5cbdfaf8f0f01500bb/faradayio/faraday.py#L154-L162", "sha": "6cf3af88bb4a83e5d2036e5cbdfaf8f0f01500bb", "docstring_summary": "Checks the TUN adapter for data and returns any that is found.", "language": "python", "parameters": "(self)", "return_statement": "return(packet)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_TUN", ".", "_tun", ".", "read", "(", "arg_0", ".", "_TUN", ".", "_tun", ".", "mtu", ")", "return", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Checks the TUN adapter for data and returns any that is found.\n\n        Returns:\n            packet: Data read from the TUN adapter\n        \"\"\"\n        arg_1 = arg_0._TUN._tun.read(arg_0._TUN._tun.mtu)\n        return(arg_1)", "path": "faradayio/faraday.py", "identifier": "Monitor.checkTUN", "docstring": "Checks the TUN adapter for data and returns any that is found.\n\n        Returns:\n            packet: Data read from the TUN adapter", "docstring_tokens": ["Checks", "the", "TUN", "adapter", "for", "data", "and", "returns", "any", "that", "is", "found", "."], "nwo": "FaradayRF/faradayio", "score": 0.289831668365279, "idx": 255791}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/util/solver.py#L187-L229", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Select a solver for a given optimization problem.", "language": "python", "parameters": "(mip=False, qp=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ",", "arg_1", "=", "False", ")", ":", "if", "len", "(", "solvers", ")", "==", "0", ":", "raise", "SolverNotFound", "(", "\"no solvers installed\"", ")", "arg_2", "=", "[", "\"gurobi\"", ",", "\"cplex\"", ",", "\"glpk\"", "]", "arg_3", "=", "[", "\"glpk\"", ",", "\"cplex\"", ",", "\"gurobi\"", "]", "arg_4", "=", "[", "\"gurobi\"", ",", "\"cplex\"", "]", "if", "arg_0", "is", "False", "and", "arg_1", "is", "False", ":", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", "in", "solvers", ":", "return", "arg_5", "return", "list", "(", "solvers", ")", "[", "0", "]", "elif", "arg_1", ":", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", "in", "solvers", ":", "return", "arg_5", "raise", "SolverNotFound", "(", "\"no qp-capable solver found\"", ")", "else", ":", "for", "arg_5", "in", "arg_2", ":", "if", "arg_5", "in", "solvers", ":", "return", "arg_5", "raise", "SolverNotFound", "(", "\"no mip-capable solver found\"", ")"], "function": "def Func(arg_0=False, arg_1=False):\n    \"\"\"Select a solver for a given optimization problem.\n\n    Parameters\n    ----------\n    mip : bool\n        Does the solver require mixed integer linear programming capabilities?\n    qp : bool\n        Does the solver require quadratic programming capabilities?\n\n    Returns\n    -------\n    string\n        The name of feasible solver.\n\n    Raises\n    ------\n    SolverNotFound\n        If no suitable solver could be found.\n    \"\"\"\n    if len(solvers) == 0:\n        raise SolverNotFound(\"no solvers installed\")\n    # Those lists need to be updated as optlang implements more solvers\n    arg_2 = [\"gurobi\", \"cplex\", \"glpk\"]\n    arg_3 = [\"glpk\", \"cplex\", \"gurobi\"]\n    arg_4 = [\"gurobi\", \"cplex\"]\n\n    if arg_0 is False and arg_1 is False:\n        for arg_5 in arg_3:\n            if arg_5 in solvers:\n                return arg_5\n        # none of them are in the list order - so return the first one\n        return list(solvers)[0]\n    elif arg_1:  # mip does not yet matter for this determination\n        for arg_5 in arg_4:\n            if arg_5 in solvers:\n                return arg_5\n        raise SolverNotFound(\"no qp-capable solver found\")\n    else:\n        for arg_5 in arg_2:\n            if arg_5 in solvers:\n                return arg_5\n    raise SolverNotFound(\"no mip-capable solver found\")", "path": "cobra/util/solver.py", "identifier": "get_solver_name", "docstring": "Select a solver for a given optimization problem.\n\n    Parameters\n    ----------\n    mip : bool\n        Does the solver require mixed integer linear programming capabilities?\n    qp : bool\n        Does the solver require quadratic programming capabilities?\n\n    Returns\n    -------\n    string\n        The name of feasible solver.\n\n    Raises\n    ------\n    SolverNotFound\n        If no suitable solver could be found.", "docstring_tokens": ["Select", "a", "solver", "for", "a", "given", "optimization", "problem", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255792}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/elmo/train_utils.py#L84-L117", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "get summary ops for the magnitude of gradient updates", "language": "python", "parameters": "(grads, opt, lr)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", "in", "tf", ".", "trainable_variables", "(", ")", ":", "arg_3", "[", "arg_4", ".", "name", "]", "=", "[", "arg_4", ",", "None", ",", "None", "]", "for", "arg_6", ",", "arg_4", "in", "arg_0", ":", "arg_3", "[", "arg_4", ".", "name", "]", "[", "1", "]", "=", "arg_6", "arg_3", "[", "arg_4", ".", "name", "]", "[", "2", "]", "=", "arg_1", ".", "get_slot", "(", "arg_4", ",", "'accumulator'", ")", "arg_7", "=", "[", "]", "for", "arg_8", ",", "(", "arg_4", ",", "arg_6", ",", "arg_9", ")", "in", "arg_3", ".", "items", "(", ")", ":", "if", "arg_6", "is", "None", ":", "continue", "if", "isinstance", "(", "arg_6", ",", "tf", ".", "IndexedSlices", ")", ":", "arg_10", "=", "arg_2", "*", "arg_6", ".", "values", "if", "arg_9", "is", "not", "None", ":", "arg_10", "/=", "tf", ".", "sqrt", "(", "tf", ".", "gather", "(", "arg_9", ",", "arg_6", ".", "indices", ")", ")", "else", ":", "arg_10", "=", "arg_2", "*", "arg_6", "if", "arg_9", "is", "not", "None", ":", "arg_10", "/=", "tf", ".", "sqrt", "(", "arg_9", ")", "arg_11", "=", "tf", ".", "sqrt", "(", "tf", ".", "reduce_sum", "(", "arg_4", "*", "arg_4", ")", ")", "+", "1.0e-7", "arg_12", "=", "tf", ".", "sqrt", "(", "tf", ".", "reduce_sum", "(", "arg_10", "*", "arg_10", ")", ")", "arg_7", ".", "append", "(", "tf", ".", "summary", ".", "scalar", "(", "'UPDATE/'", "+", "arg_8", ".", "replace", "(", "\":\"", ",", "\"_\"", ")", ",", "arg_12", "/", "arg_11", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"get summary ops for the magnitude of gradient updates\"\"\"\n\n    # strategy:\n    # make a dict of variable name -> [variable, grad, adagrad slot]\n    arg_3 = {}\n    for arg_4 in tf.trainable_variables():\n        arg_3[arg_4.name] = [arg_4, None, None]\n    for arg_6, arg_4 in arg_0:\n        arg_3[arg_4.name][1] = arg_6\n        arg_3[arg_4.name][2] = arg_1.get_slot(arg_4, 'accumulator')\n\n    # now make summaries\n    arg_7 = []\n    for arg_8, (arg_4, arg_6, arg_9) in arg_3.items():\n\n        if arg_6 is None:\n            continue\n\n        if isinstance(arg_6, tf.IndexedSlices):\n            # a sparse gradient - only take norm of params that are updated\n            arg_10 = arg_2 * arg_6.values\n            if arg_9 is not None:\n                arg_10 /= tf.sqrt(tf.gather(arg_9, arg_6.indices))\n        else:\n            arg_10 = arg_2 * arg_6\n            if arg_9 is not None:\n                arg_10 /= tf.sqrt(arg_9)\n\n        arg_11 = tf.sqrt(tf.reduce_sum(arg_4 * arg_4)) + 1.0e-7\n        arg_12 = tf.sqrt(tf.reduce_sum(arg_10 * arg_10))\n        arg_7.append(tf.summary.scalar('UPDATE/' + arg_8.replace(\":\", \"_\"), arg_12 / arg_11))\n\n    return arg_7", "path": "deeppavlov/models/elmo/train_utils.py", "identifier": "summary_gradient_updates", "docstring": "get summary ops for the magnitude of gradient updates", "docstring_tokens": ["get", "summary", "ops", "for", "the", "magnitude", "of", "gradient", "updates"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255793}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/rich_text.py#L219-L230", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "wrapper for ensuring image_tag returns utf8-encoded str on Python 2", "language": "python", "parameters": "(image_tag)", "return_statement": "return utf8_image_tag", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "py3compat", ".", "PY3", ":", "return", "arg_0", "def", "utf8_image_tag", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "isinstance", "(", "arg_3", ",", "unicode", ")", ":", "arg_3", "=", "arg_3", ".", "encode", "(", "'utf8'", ")", "return", "arg_3", "return", "utf8_image_tag"], "function": "def Func(arg_0):\n    \"\"\"wrapper for ensuring image_tag returns utf8-encoded str on Python 2\"\"\"\n    if py3compat.PY3:\n        # nothing to do on Python 3\n        return arg_0\n    \n    def utf8_image_tag(*arg_1, **arg_2):\n        arg_3 = arg_0(*arg_1, **arg_2)\n        if isinstance(arg_3, unicode):\n            arg_3 = arg_3.encode('utf8')\n        return arg_3\n    return utf8_image_tag", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/rich_text.py", "identifier": "ensure_utf8", "docstring": "wrapper for ensuring image_tag returns utf8-encoded str on Python 2", "docstring_tokens": ["wrapper", "for", "ensuring", "image_tag", "returns", "utf8", "-", "encoded", "str", "on", "Python", "2"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255794}
{"url": "https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_reader.py#L16-L87", "sha": "3f66a39e15a71b981e8c5f887a4adc3ad486a45f", "docstring_summary": "r\"\"\" Read a given BGEN file.", "language": "python", "parameters": "(filepath, metafile_filepath=None, samples_filepath=None, verbose=True)", "return_statement": "return dict(variants=variants, samples=samples, genotype=genotype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "assert_file_exist", "(", "arg_0", ")", "assert_file_readable", "(", "arg_0", ")", "arg_1", "=", "_get_valid_metafile_filepath", "(", "arg_0", ",", "arg_1", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "if", "arg_3", ":", "print", "(", "f\"We will create the metafile `{metafile_filepath}`. This file will \"", "\"speed up further\\nreads and only need to be created once. So, please, \"", "\"bear with me.\"", ")", "create_metafile", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "arg_4", "=", "get_samples", "(", "arg_0", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "map_metadata", "(", "arg_0", ",", "arg_1", ")", "arg_6", "=", "map_genotype", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "return", "dict", "(", "arg_5", "=", "arg_5", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True):\n    r\"\"\" Read a given BGEN file.\n\n    Parameters\n    ----------\n    filepath : str\n        A bgen file path.\n    metafile_filepath : str, optional\n        If ``None``, it will try to read the ``filepath + \".metadata\"`` file. If this is\n        not possible, it will create one. It tries to create one at\n        ``filepath + \".metadata\"``. If that is also no possible, it tries to create one\n        at a temporary folder.\n    samples_filepath : str, optional\n        A sample file in `gen format <https://goo.gl/bCzo7m>`_.\n        If ``samples_filepath`` is provided, sample ids are read from this file.\n        Otherwise, it reads from the bgen file itself if possible. Defaults to ``None``.\n    verbose : bool, optional\n        ``True`` to show progress; ``False`` otherwise. Defaults to ``True``.\n\n    Returns\n    -------\n    variants : :class:`dask.dataFrame.DataFrame`\n        Variant position, chromosomes, rsids, etc.\n    samples : :class:`pandas.Series`\n        Sample identifications.\n    genotype : list\n        List of genotypes.\n\n    Examples\n    --------\n    .. doctest::\n\n        >>> from bgen_reader import example_files, Func\n        >>>\n        >>> with example_files(\"haplotypes.bgen\") as filepath:\n        ...     bgen = Func(filepath, verbose=False)\n        ...     variants = bgen[\"variants\"]\n        ...     samples = bgen[\"samples\"]\n        ...\n        ...     v = variants.loc[0].compute()\n        ...     g = bgen[\"genotype\"][0].compute()\n        ...     print(v)\n        ...     print(samples)\n        ...     print(g[\"probs\"][0])\n             id rsid chrom  pos  nalleles allele_ids  vaddr\n        0  SNP1  RS1     1    1         2        A,G    102\n        0    sample_0\n        1    sample_1\n        2    sample_2\n        3    sample_3\n        Name: id, dtype: object\n        [1. 0. 1. 0.]\n    \"\"\"\n\n    assert_file_exist(arg_0)\n    assert_file_readable(arg_0)\n\n    arg_1 = _get_valid_metafile_filepath(arg_0, arg_1)\n    if not os.path.exists(arg_1):\n        if arg_3:\n            print(\n                f\"We will create the metafile `{metafile_filepath}`. This file will \"\n                \"speed up further\\nreads and only need to be created once. So, please, \"\n                \"bear with me.\"\n            )\n        create_metafile(arg_0, arg_1, arg_3)\n\n    arg_4 = get_samples(arg_0, arg_2, arg_3)\n    arg_5 = map_metadata(arg_0, arg_1)\n    arg_6 = map_genotype(arg_0, arg_1, arg_3)\n\n    return dict(arg_5=arg_5, arg_4=arg_4, arg_6=arg_6)", "path": "bgen_reader/_reader.py", "identifier": "read_bgen", "docstring": "r\"\"\" Read a given BGEN file.\n\n    Parameters\n    ----------\n    filepath : str\n        A bgen file path.\n    metafile_filepath : str, optional\n        If ``None``, it will try to read the ``filepath + \".metadata\"`` file. If this is\n        not possible, it will create one. It tries to create one at\n        ``filepath + \".metadata\"``. If that is also no possible, it tries to create one\n        at a temporary folder.\n    samples_filepath : str, optional\n        A sample file in `gen format <https://goo.gl/bCzo7m>`_.\n        If ``samples_filepath`` is provided, sample ids are read from this file.\n        Otherwise, it reads from the bgen file itself if possible. Defaults to ``None``.\n    verbose : bool, optional\n        ``True`` to show progress; ``False`` otherwise. Defaults to ``True``.\n\n    Returns\n    -------\n    variants : :class:`dask.dataFrame.DataFrame`\n        Variant position, chromosomes, rsids, etc.\n    samples : :class:`pandas.Series`\n        Sample identifications.\n    genotype : list\n        List of genotypes.\n\n    Examples\n    --------\n    .. doctest::\n\n        >>> from bgen_reader import example_files, read_bgen\n        >>>\n        >>> with example_files(\"haplotypes.bgen\") as filepath:\n        ...     bgen = read_bgen(filepath, verbose=False)\n        ...     variants = bgen[\"variants\"]\n        ...     samples = bgen[\"samples\"]\n        ...\n        ...     v = variants.loc[0].compute()\n        ...     g = bgen[\"genotype\"][0].compute()\n        ...     print(v)\n        ...     print(samples)\n        ...     print(g[\"probs\"][0])\n             id rsid chrom  pos  nalleles allele_ids  vaddr\n        0  SNP1  RS1     1    1         2        A,G    102\n        0    sample_0\n        1    sample_1\n        2    sample_2\n        3    sample_3\n        Name: id, dtype: object\n        [1. 0. 1. 0.]", "docstring_tokens": ["r", "Read", "a", "given", "BGEN", "file", "."], "nwo": "limix/bgen-reader-py", "score": 0.37729991823847475, "idx": 255795}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_psosx.py#L224-L234", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return files opened by process.", "language": "python", "parameters": "(self)", "return_statement": "return files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "pid", "==", "0", ":", "return", "[", "]", "arg_1", "=", "[", "]", "arg_2", "=", "_psutil_osx", ".", "get_process_open_files", "(", "arg_0", ".", "pid", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ":", "if", "isfile_strict", "(", "arg_3", ")", ":", "arg_5", "=", "nt_openfile", "(", "arg_3", ",", "arg_4", ")", "arg_1", ".", "append", "(", "arg_5", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return files opened by process.\"\"\"\n        if arg_0.pid == 0:\n            return []\n        arg_1 = []\n        arg_2 = _psutil_osx.get_process_open_files(arg_0.pid)\n        for arg_3, arg_4 in arg_2:\n            if isfile_strict(arg_3):\n                arg_5 = nt_openfile(arg_3, arg_4)\n                arg_1.append(arg_5)\n        return arg_1", "path": "environment/lib/python2.7/site-packages/psutil/_psosx.py", "identifier": "Process.get_open_files", "docstring": "Return files opened by process.", "docstring_tokens": ["Return", "files", "opened", "by", "process", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255796}
{"url": "https://github.com/broox/python-nuheat/blob/3a18852dc9465c34cb96eb3a0c84f1a6caa70707/nuheat/thermostat.py#L205-L226", "sha": "3a18852dc9465c34cb96eb3a0c84f1a6caa70707", "docstring_summary": "Updates the target temperature on the NuHeat API", "language": "python", "parameters": "(self, temperature, mode=config.SCHEDULE_HOLD)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "SCHEDULE_HOLD", ")", ":", "if", "arg_1", "<", "arg_0", ".", "min_temperature", ":", "arg_1", "=", "arg_0", ".", "min_temperature", "if", "arg_1", ">", "arg_0", ".", "max_temperature", ":", "arg_1", "=", "arg_0", ".", "max_temperature", "arg_5", "=", "[", "arg_3", ".", "SCHEDULE_TEMPORARY_HOLD", ",", "arg_3", ".", "SCHEDULE_HOLD", "]", "if", "arg_2", "not", "in", "arg_5", ":", "raise", "Exception", "(", "\"Invalid mode. Please use one of: {}\"", ".", "format", "(", "arg_5", ")", ")", "arg_0", ".", "set_data", "(", "{", "\"SetPointTemp\"", ":", "arg_1", ",", "\"ScheduleMode\"", ":", "arg_2", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.SCHEDULE_HOLD):\n        \"\"\"\n        Updates the target temperature on the NuHeat API\n\n        :param temperature: The desired temperature in NuHeat format\n        :param permanent: Permanently hold the temperature. If set to False, the schedule will\n                          resume at the next programmed event\n        \"\"\"\n        if arg_1 < arg_0.min_temperature:\n            arg_1 = arg_0.min_temperature\n\n        if arg_1 > arg_0.max_temperature:\n            arg_1 = arg_0.max_temperature\n\n        arg_5 = [arg_3.SCHEDULE_TEMPORARY_HOLD, arg_3.SCHEDULE_HOLD]\n        if arg_2 not in arg_5:\n            raise Exception(\"Invalid mode. Please use one of: {}\".format(arg_5))\n\n        arg_0.set_data({\n            \"SetPointTemp\": arg_1,\n            \"ScheduleMode\": arg_2\n        })", "path": "nuheat/thermostat.py", "identifier": "NuHeatThermostat.set_target_temperature", "docstring": "Updates the target temperature on the NuHeat API\n\n        :param temperature: The desired temperature in NuHeat format\n        :param permanent: Permanently hold the temperature. If set to False, the schedule will\n                          resume at the next programmed event", "docstring_tokens": ["Updates", "the", "target", "temperature", "on", "the", "NuHeat", "API"], "nwo": "broox/python-nuheat", "score": 0.23137166388621372, "idx": 255797}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L1460-L1579", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This applies TFA in parallel to all LCs in a directory.", "language": "python", "parameters": "(lcdir,\n                       templateinfo,\n                       lcfileglob=None,\n                       timecols=None,\n                       magcols=None,\n                       errcols=None,\n                       lcformat='hat-sql',\n                       lcformatdir=None,\n                       interp='nearest',\n                       sigclip=5.0,\n                       mintemplatedist_arcmin=10.0,\n                       nworkers=NCPUS,\n                       maxworkertasks=1000)", "return_statement": "return parallel_tfa_lclist(\n        lclist,\n        templateinfo,\n        timecols=timecols,\n        magcols=magcols,\n        errcols=errcols,\n        lcformat=lcformat,\n        lcformatdir=None,\n        interp=interp,\n        sigclip=sigclip,\n        mintemplatedist_arcmin=mintemplatedist_arcmin,\n        nworkers=nworkers,\n        maxworkertasks=maxworkertasks\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'hat-sql'", ",", "arg_7", "=", "None", ",", "arg_8", "=", "'nearest'", ",", "arg_9", "=", "5.0", ",", "arg_10", "=", "10.0", ",", "arg_11", "=", "arg_12", ",", "arg_13", "=", "1000", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", "and", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "infd", ":", "arg_1", "=", "pickle", ".", "load", "(", "infd", ")", "try", ":", "arg_14", "=", "get_lcformat", "(", "arg_6", ",", "use_lcformat_dir", "=", "arg_7", ")", "if", "arg_14", ":", "(", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", ",", "arg_20", ",", "arg_21", ")", "=", "arg_14", "else", ":", "LOGERROR", "(", "\"can't figure out the light curve format\"", ")", "return", "None", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "\"can't figure out the light curve format\"", ")", "return", "None", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_15", "arg_22", "=", "sorted", "(", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_2", ")", ")", ")", "return", "parallel_tfa_lclist", "(", "arg_22", ",", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "None", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_13", "=", "arg_13", ")"], "function": "def Func(arg_0,\n                       arg_1,\n                       arg_2=None,\n                       arg_3=None,\n                       arg_4=None,\n                       arg_5=None,\n                       arg_6='hat-sql',\n                       arg_7=None,\n                       arg_8='nearest',\n                       arg_9=5.0,\n                       arg_10=10.0,\n                       arg_11=arg_12,\n                       arg_13=1000):\n    '''This applies TFA in parallel to all LCs in a directory.\n\n    Parameters\n    ----------\n\n    lcdir : str\n        This is the directory containing the light curve files to process..\n\n    templateinfo : dict or str\n        This is either the dict produced by `tfa_templates_lclist` or the pickle\n        produced by the same function.\n\n    lcfileglob : str or None\n        The UNIX file glob to use when searching for light curve files in\n        `lcdir`. If None, the default file glob associated with registered LC\n        format provided is used.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in applying TFA corrections.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in applying TFA corrections.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in applying TFA corrections.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    interp : str\n        This is passed to scipy.interpolate.interp1d as the kind of\n        interpolation to use when reforming the light curves to the timebase of\n        the TFA templates.\n\n    sigclip : float or sequence of two floats or None\n        This is the sigma clip to apply to the light curves before running TFA\n        on it.\n\n    mintemplatedist_arcmin : float\n        This sets the minimum distance required from the target object for\n        objects in the TFA template ensemble. Objects closer than this distance\n        will be removed from the ensemble.\n\n    nworkers : int\n        The number of parallel workers to launch\n\n    maxworkertasks : int\n        The maximum number of tasks per worker allowed before it's replaced by a\n        fresh one.\n\n    Returns\n    -------\n\n    dict\n        Contains the input file names and output TFA light curve filenames per\n        input file organized by each `magcol` in `magcols`.\n\n    '''\n\n    # open the templateinfo first\n    if isinstance(arg_1,str) and os.path.exists(arg_1):\n        with open(arg_1,'rb') as infd:\n            arg_1 = pickle.load(infd)\n\n    try:\n        arg_14 = get_lcformat(arg_6,\n                                  use_lcformat_dir=arg_7)\n        if arg_14:\n            (arg_15, arg_16,\n             arg_17, arg_18, arg_19,\n             arg_20, arg_21) = arg_14\n        else:\n            LOGERROR(\"can't figure out the light curve format\")\n            return None\n    except Exception as e:\n        LOGEXCEPTION(\"can't figure out the light curve format\")\n        return None\n\n    # find all the files matching the lcglob in lcdir\n    if arg_2 is None:\n        arg_2 = arg_15\n\n    arg_22 = sorted(glob.glob(os.path.join(arg_0, arg_2)))\n\n    return parallel_tfa_lclist(\n        arg_22,\n        arg_1,\n        arg_3=arg_3,\n        arg_4=arg_4,\n        arg_5=arg_5,\n        arg_6=arg_6,\n        arg_7=None,\n        arg_8=arg_8,\n        arg_9=arg_9,\n        arg_10=arg_10,\n        arg_11=arg_11,\n        arg_13=arg_13\n    )", "path": "astrobase/lcproc/tfa.py", "identifier": "parallel_tfa_lcdir", "docstring": "This applies TFA in parallel to all LCs in a directory.\n\n    Parameters\n    ----------\n\n    lcdir : str\n        This is the directory containing the light curve files to process..\n\n    templateinfo : dict or str\n        This is either the dict produced by `tfa_templates_lclist` or the pickle\n        produced by the same function.\n\n    lcfileglob : str or None\n        The UNIX file glob to use when searching for light curve files in\n        `lcdir`. If None, the default file glob associated with registered LC\n        format provided is used.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in applying TFA corrections.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in applying TFA corrections.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in applying TFA corrections.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    interp : str\n        This is passed to scipy.interpolate.interp1d as the kind of\n        interpolation to use when reforming the light curves to the timebase of\n        the TFA templates.\n\n    sigclip : float or sequence of two floats or None\n        This is the sigma clip to apply to the light curves before running TFA\n        on it.\n\n    mintemplatedist_arcmin : float\n        This sets the minimum distance required from the target object for\n        objects in the TFA template ensemble. Objects closer than this distance\n        will be removed from the ensemble.\n\n    nworkers : int\n        The number of parallel workers to launch\n\n    maxworkertasks : int\n        The maximum number of tasks per worker allowed before it's replaced by a\n        fresh one.\n\n    Returns\n    -------\n\n    dict\n        Contains the input file names and output TFA light curve filenames per\n        input file organized by each `magcol` in `magcols`.", "docstring_tokens": ["This", "applies", "TFA", "in", "parallel", "to", "all", "LCs", "in", "a", "directory", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255798}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/code_heatmap.py#L219-L245", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Calculates heatmap for function.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'objectName': self._object_name,\n            'runTime': run_time,\n            'result': result,\n            'timestamp': int(time.time()),\n            'heatmaps': [{\n                'name': self._object_name,\n                'heatmap': heatmap,\n                'executionCount': prof.execution_count[filename],\n                'srcCode': source_lines,\n                'runTime': run_time\n            }]\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "_CodeHeatmapCalculator", "(", ")", "as", "prof", ":", "arg_1", "=", "arg_0", ".", "_run_object", "(", "*", "arg_0", ".", "_run_args", ",", "**", "arg_0", ".", "_run_kwargs", ")", "arg_2", ",", "arg_3", "=", "inspect", ".", "getsourcelines", "(", "arg_0", ".", "_run_object", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_2", ":", "arg_4", ".", "append", "(", "(", "'line'", ",", "arg_3", ",", "arg_5", ")", ")", "arg_3", "+=", "1", "arg_6", "=", "os", ".", "path", ".", "abspath", "(", "inspect", ".", "getsourcefile", "(", "arg_0", ".", "_run_object", ")", ")", "arg_7", "=", "prof", ".", "heatmap", "[", "arg_6", "]", "arg_8", "=", "sum", "(", "time", "for", "time", "in", "arg_7", ".", "values", "(", ")", ")", "return", "{", "'objectName'", ":", "arg_0", ".", "_object_name", ",", "'runTime'", ":", "arg_8", ",", "'result'", ":", "arg_1", ",", "'timestamp'", ":", "int", "(", "time", ".", "time", "(", ")", ")", ",", "'heatmaps'", ":", "[", "{", "'name'", ":", "arg_0", ".", "_object_name", ",", "'heatmap'", ":", "arg_7", ",", "'executionCount'", ":", "prof", ".", "execution_count", "[", "arg_6", "]", ",", "'srcCode'", ":", "arg_4", ",", "'runTime'", ":", "arg_8", "}", "]", "}"], "function": "def Func(arg_0):\n        \"\"\"Calculates heatmap for function.\"\"\"\n        with _CodeHeatmapCalculator() as prof:\n            arg_1 = arg_0._run_object(*arg_0._run_args, **arg_0._run_kwargs)\n        arg_2, arg_3 = inspect.getsourcelines(arg_0._run_object)\n\n        arg_4 = []\n        for arg_5 in arg_2:\n            arg_4.append(('line', arg_3, arg_5))\n            arg_3 += 1\n\n        arg_6 = os.path.abspath(inspect.getsourcefile(arg_0._run_object))\n        arg_7 = prof.heatmap[arg_6]\n        arg_8 = sum(time for time in arg_7.values())\n        return {\n            'objectName': arg_0._object_name,\n            'runTime': arg_8,\n            'result': arg_1,\n            'timestamp': int(time.time()),\n            'heatmaps': [{\n                'name': arg_0._object_name,\n                'heatmap': arg_7,\n                'executionCount': prof.execution_count[arg_6],\n                'srcCode': arg_4,\n                'runTime': arg_8\n            }]\n        }", "path": "vprof/code_heatmap.py", "identifier": "CodeHeatmapProfiler.profile_function", "docstring": "Calculates heatmap for function.", "docstring_tokens": ["Calculates", "heatmap", "for", "function", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 255799}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/exceptions.py#L64-L69", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Return true if the given statement node raise an exception", "language": "python", "parameters": "(body: typing.List)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "List", ")", "->", "bool", ":", "for", "arg_3", "in", "arg_0", ":", "if", "isinstance", "(", "arg_3", ",", "astroid", ".", "Raise", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0: arg_1.List) -> bool:\n    \"\"\"Return true if the given statement node raise an exception\"\"\"\n    for arg_3 in arg_0:\n        if isinstance(arg_3, astroid.Raise):\n            return True\n    return False", "path": "pylint/checkers/exceptions.py", "identifier": "_is_raising", "docstring": "Return true if the given statement node raise an exception", "docstring_tokens": ["Return", "true", "if", "the", "given", "statement", "node", "raise", "an", "exception"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255800}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L681-L700", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Paste the contents of the clipboard into the input region.", "language": "python", "parameters": "(self, mode=QtGui.QClipboard.Clipboard)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "QClipboard", ".", "Clipboard", ")", ":", "if", "arg_0", ".", "_control", ".", "textInteractionFlags", "(", ")", "&", "QtCore", ".", "Qt", ".", "TextEditable", ":", "arg_0", ".", "_keep_cursor_in_buffer", "(", ")", "arg_5", "=", "arg_0", ".", "_control", ".", "textCursor", "(", ")", "arg_6", "=", "arg_2", ".", "QApplication", ".", "clipboard", "(", ")", ".", "text", "(", "arg_1", ")", ".", "rstrip", "(", ")", "arg_0", ".", "_insert_plain_text_into_buffer", "(", "arg_5", ",", "dedent", "(", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1=arg_2.QClipboard.Clipboard):\n        \"\"\" Paste the contents of the clipboard into the input region.\n\n        Parameters:\n        -----------\n        mode : QClipboard::Mode, optional [default QClipboard::Clipboard]\n\n            Controls which part of the system clipboard is used. This can be\n            used to access the selection clipboard in X11 and the Find buffer\n            in Mac OS. By default, the regular clipboard is used.\n        \"\"\"\n        if arg_0._control.textInteractionFlags() & QtCore.Qt.TextEditable:\n            # Make sure the Func is safe.\n            arg_0._keep_cursor_in_buffer()\n            arg_5 = arg_0._control.textCursor()\n\n            # Remove any trailing newline, which confuses the GUI and forces the\n            # user to backspace.\n            arg_6 = arg_2.QApplication.clipboard().text(arg_1).rstrip()\n            arg_0._insert_plain_text_into_buffer(arg_5, dedent(arg_6))", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget.paste", "docstring": "Paste the contents of the clipboard into the input region.\n\n        Parameters:\n        -----------\n        mode : QClipboard::Mode, optional [default QClipboard::Clipboard]\n\n            Controls which part of the system clipboard is used. This can be\n            used to access the selection clipboard in X11 and the Find buffer\n            in Mac OS. By default, the regular clipboard is used.", "docstring_tokens": ["Paste", "the", "contents", "of", "the", "clipboard", "into", "the", "input", "region", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255801}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/html.py#L23-L41", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Return the path to a data file of ours.", "language": "python", "parameters": "(fname, pkgdir=\"\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ")", ":", "for", "arg_2", "in", "STATIC_PATH", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_0", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "return", "arg_3", "if", "arg_1", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_1", ",", "arg_0", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "return", "arg_3", "raise", "CoverageException", "(", "\"Couldn't find static file %r\"", "%", "arg_0", ")"], "function": "def Func(arg_0, arg_1=\"\"):\n    \"\"\"Return the path to a data file of ours.\n\n    The file is searched for on `STATIC_PATH`, and the first place it's found,\n    is returned.\n\n    Each directory in `STATIC_PATH` is searched as-is, and also, if `pkgdir`\n    is provided, at that subdirectory.\n\n    \"\"\"\n    for arg_2 in STATIC_PATH:\n        arg_3 = os.path.join(arg_2, arg_0)\n        if os.path.exists(arg_3):\n            return arg_3\n        if arg_1:\n            arg_3 = os.path.join(arg_2, arg_1, arg_0)\n            if os.path.exists(arg_3):\n                return arg_3\n    raise CoverageException(\"Couldn't find static file %r\" % arg_0)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/html.py", "identifier": "data_filename", "docstring": "Return the path to a data file of ours.\n\n    The file is searched for on `STATIC_PATH`, and the first place it's found,\n    is returned.\n\n    Each directory in `STATIC_PATH` is searched as-is, and also, if `pkgdir`\n    is provided, at that subdirectory.", "docstring_tokens": ["Return", "the", "path", "to", "a", "data", "file", "of", "ours", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 255802}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/session.py#L107-L119", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Helper function for PDFText, to have the document\r\n            add a page, and retry adding a large block of\r\n            text that would otherwise have been to long for the\r\n            page.", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "parent", ".", "document", ".", "page", ".", "cursor", ".", "copy", "(", ")", "arg_2", ".", "x_reset", "(", ")", "arg_2", ".", "y_reset", "(", ")", "arg_0", ".", "parent", ".", "document", ".", "add_page", "(", ")", "arg_0", ".", "parent", ".", "document", ".", "set_cursor", "(", "arg_2", ")", "arg_0", ".", "parent", ".", "document", ".", "add_text", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\" Helper function for PDFText, to have the document\r\n            add a page, and retry adding a large block of\r\n            text that would otherwise have been to long for the\r\n            page.\r\n\r\n        \"\"\"\r\n        arg_2 = arg_0.parent.document.page.cursor.copy()\r\n        arg_2.x_reset()\r\n        arg_2.y_reset()\r\n        arg_0.parent.document.add_page()\r\n        arg_0.parent.document.set_cursor(arg_2)\r\n        arg_0.parent.document.add_text(arg_1)", "path": "pypdflite/session.py", "identifier": "_Session._add_page", "docstring": "Helper function for PDFText, to have the document\r\n            add a page, and retry adding a large block of\r\n            text that would otherwise have been to long for the\r\n            page.", "docstring_tokens": ["Helper", "function", "for", "PDFText", "to", "have", "the", "document", "add", "a", "page", "and", "retry", "adding", "a", "large", "block", "of", "text", "that", "would", "otherwise", "have", "been", "to", "long", "for", "the", "page", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 255803}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/urbandictionary.py#L21-L34", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Strips links from the definition and gathers them in a links property.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"\\[.*?\\](.*?)\\[\\/.*?\\]\"", "arg_2", "=", "\"\\[(.*?)\\]\"", "arg_0", ".", "links", "=", "[", "]", "for", "arg_4", "in", "(", "arg_1", ",", "arg_2", ")", ":", "for", "arg_5", "in", "re", ".", "findall", "(", "arg_4", ",", "arg_0", ".", "description", ")", ":", "arg_0", ".", "links", ".", "append", "(", "arg_5", ")", "arg_0", ".", "description", "=", "re", ".", "sub", "(", "arg_4", ",", "\"\\\\1\"", ",", "arg_0", ".", "description", ")", "arg_0", ".", "description", "=", "arg_0", ".", "description", ".", "strip", "(", ")"], "function": "def Func(arg_0):\n        \n        \"\"\" Strips links from the definition and gathers them in a links property.\n        \"\"\"\n        \n        arg_1 = \"\\[.*?\\](.*?)\\[\\/.*?\\]\"\n        arg_2 = \"\\[(.*?)\\]\"\n        arg_0.links = []\n        for arg_4 in (arg_1,arg_2):\n            for arg_5 in re.findall(arg_4, arg_0.description):\n                arg_0.links.append(arg_5)\n            arg_0.description = re.sub(arg_4, \"\\\\1\", arg_0.description)\n            \n        arg_0.description = arg_0.description.strip()", "path": "lib/web/urbandictionary.py", "identifier": "UrbanDictionaryDefinition._parse", "docstring": "Strips links from the definition and gathers them in a links property.", "docstring_tokens": ["Strips", "links", "from", "the", "definition", "and", "gathers", "them", "in", "a", "links", "property", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255804}
{"url": "https://github.com/mordred-descriptor/mordred/blob/2848b088fd7b6735590242b5e22573babc724f10/mordred/_base/result.py#L33-L47", "sha": "2848b088fd7b6735590242b5e22573babc724f10", "docstring_summary": "r\"\"\"Replace missing value to \"value\".", "language": "python", "parameters": "(self, value=np.nan)", "return_statement": "return self.__class__(\n            self.mol,\n            [(value if is_missing(v) else v) for v in self.values()],\n            self.keys(),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "nan", ")", ":", "return", "arg_0", ".", "__class__", "(", "arg_0", ".", "mol", ",", "[", "(", "arg_1", "if", "is_missing", "(", "arg_4", ")", "else", "arg_4", ")", "for", "arg_4", "in", "arg_0", ".", "values", "(", ")", "]", ",", "arg_0", ".", "keys", "(", ")", ",", ")"], "function": "def Func(arg_0, arg_1=arg_2.nan):\n        r\"\"\"Replace missing value to \"value\".\n\n        Parameters:\n            value: value that missing value is replaced\n\n        Returns:\n            Result\n\n        \"\"\"\n        return arg_0.__class__(\n            arg_0.mol,\n            [(arg_1 if is_missing(arg_4) else arg_4) for arg_4 in arg_0.values()],\n            arg_0.keys(),\n        )", "path": "mordred/_base/result.py", "identifier": "Result.fill_missing", "docstring": "r\"\"\"Replace missing value to \"value\".\n\n        Parameters:\n            value: value that missing value is replaced\n\n        Returns:\n            Result", "docstring_tokens": ["r", "Replace", "missing", "value", "to", "value", "."], "nwo": "mordred-descriptor/mordred", "score": 0.9032497569731454, "idx": 255805}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L788-L793", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Concatenate the sequences given by seqs into a single ISeq.", "language": "python", "parameters": "(*seqs)", "return_statement": "return allseqs", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", "->", "ISeq", ":", "arg_1", "=", "lseq", ".", "sequence", "(", "itertools", ".", "chain", "(", "*", "filter", "(", "None", ",", "map", "(", "to_seq", ",", "arg_0", ")", ")", ")", ")", "if", "arg_1", "is", "None", ":", "return", "lseq", ".", "EMPTY", "return", "arg_1"], "function": "def Func(*arg_0) -> ISeq:\n    \"\"\"Concatenate the sequences given by seqs into a single ISeq.\"\"\"\n    arg_1 = lseq.sequence(itertools.chain(*filter(None, map(to_seq, arg_0))))\n    if arg_1 is None:\n        return lseq.EMPTY\n    return arg_1", "path": "src/basilisp/lang/runtime.py", "identifier": "concat", "docstring": "Concatenate the sequences given by seqs into a single ISeq.", "docstring_tokens": ["Concatenate", "the", "sequences", "given", "by", "seqs", "into", "a", "single", "ISeq", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 255806}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L178-L208", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Stop job.", "language": "python", "parameters": "(ctx, yes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "get_job_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'job'", ")", ")", "if", "not", "arg_1", "and", "not", "click", ".", "confirm", "(", "\"Are sure you want to Func \"", "\"job `{}`\"", ".", "format", "(", "arg_4", ")", ")", ":", "click", ".", "echo", "(", "'Existing without Funcping job.'", ")", "sys", ".", "exit", "(", "0", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "job", ".", "Func", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func job `{}`.'", ".", "format", "(", "arg_4", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"Job is being Funcped.\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Stop job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon job Func\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon job -xp 2 Func\n    ```\n    \"\"\"\n    arg_2, arg_3, arg_4 = get_job_or_local(arg_0.obj.get('project'), arg_0.obj.get('job'))\n    if not arg_1 and not click.confirm(\"Are sure you want to Func \"\n                                     \"job `{}`\".format(arg_4)):\n        click.echo('Existing without Funcping job.')\n        sys.exit(0)\n\n    try:\n        PolyaxonClient().job.Func(arg_2, arg_3, arg_4)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func job `{}`.'.format(arg_4))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"Job is being Funcped.\")", "path": "polyaxon_cli/cli/job.py", "identifier": "stop", "docstring": "Stop job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon job stop\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon job -xp 2 stop\n    ```", "docstring_tokens": ["Stop", "job", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 255807}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/descriptor_pool.py#L287-L304", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Loads the named extension descriptor from the pool.", "language": "python", "parameters": "(self, full_name)", "return_statement": "return scope.extensions_by_name[extension_name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "_NormalizeFullyQualifiedName", "(", "arg_1", ")", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_1", ".", "rpartition", "(", "'.'", ")", "try", ":", "arg_5", "=", "arg_0", ".", "FindMessageTypeByName", "(", "arg_2", ")", "except", "KeyError", ":", "arg_5", "=", "arg_0", ".", "FindFileContainingSymbol", "(", "arg_1", ")", "return", "arg_5", ".", "extensions_by_name", "[", "arg_4", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Loads the named extension descriptor from the pool.\n\n    Args:\n      full_name: The full name of the extension descriptor to load.\n\n    Returns:\n      A FieldDescriptor, describing the named extension.\n    \"\"\"\n    arg_1 = _NormalizeFullyQualifiedName(arg_1)\n    arg_2, arg_3, arg_4 = arg_1.rpartition('.')\n    try:\n      # Most extensions are nested inside a message.\n      arg_5 = arg_0.FindMessageTypeByName(arg_2)\n    except KeyError:\n      # Some extensions are defined at file scope.\n      arg_5 = arg_0.FindFileContainingSymbol(arg_1)\n    return arg_5.extensions_by_name[arg_4]", "path": "typy/google/protobuf/descriptor_pool.py", "identifier": "DescriptorPool.FindExtensionByName", "docstring": "Loads the named extension descriptor from the pool.\n\n    Args:\n      full_name: The full name of the extension descriptor to load.\n\n    Returns:\n      A FieldDescriptor, describing the named extension.", "docstring_tokens": ["Loads", "the", "named", "extension", "descriptor", "from", "the", "pool", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 255808}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/registry_access.py#L180-L195", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "Returns a decorator to swallow a requests exception for modules that\n        are not accessible without logging in, and turn it into an Unavailable\n        exception.", "language": "python", "parameters": "(message)", "return_statement": "return __raiseUnavailableFor401", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_Func", "(", "arg_1", ")", ":", "def", "wrapped", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "try", ":", "return", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "except", "requests", ".", "exceptions", ".", "HTTPError", "as", "e", ":", "if", "e", ".", "response", ".", "status_code", "==", "requests", ".", "codes", ".", "unauthorized", ":", "raise", "access_common", ".", "Unavailable", "(", "arg_0", ")", "else", ":", "raise", "return", "wrapped", "return", "_Func"], "function": "def Func(arg_0):\n    ''' Returns a decorator to swallow a requests exception for modules that\n        are not accessible without logging in, and turn it into an Unavailable\n        exception.\n    '''\n    def _Func(arg_1):\n        def wrapped(*arg_2, **arg_3):\n            try:\n                return arg_1(*arg_2, **arg_3)\n            except requests.exceptions.HTTPError as e:\n                if e.response.status_code == requests.codes.unauthorized:\n                    raise access_common.Unavailable(arg_0)\n                else:\n                    raise\n        return wrapped\n    return _Func", "path": "yotta/lib/registry_access.py", "identifier": "_raiseUnavailableFor401", "docstring": "Returns a decorator to swallow a requests exception for modules that\n        are not accessible without logging in, and turn it into an Unavailable\n        exception.", "docstring_tokens": ["Returns", "a", "decorator", "to", "swallow", "a", "requests", "exception", "for", "modules", "that", "are", "not", "accessible", "without", "logging", "in", "and", "turn", "it", "into", "an", "Unavailable", "exception", "."], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 255809}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/data/dataset_reader.py#L21-L25", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Reads a file from a path and returns data as a list of tuples of inputs and correct outputs\n         for every data type in ``train``, ``valid`` and ``test``.", "language": "python", "parameters": "(self, data_path: str, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "->", "Dict", "[", "arg_2", ",", "List", "[", "Tuple", "[", "Any", ",", "Any", "]", "]", "]", ":", "raise", "NotImplementedError"], "function": "def Func(arg_0, arg_1: arg_2, *arg_3, **arg_4) -> Dict[arg_2, List[Tuple[Any, Any]]]:\n        \"\"\"Reads a file from a path and returns data as a list of tuples of inputs and correct outputs\n         for every data type in ``train``, ``valid`` and ``test``.\n        \"\"\"\n        raise NotImplementedError", "path": "deeppavlov/core/data/dataset_reader.py", "identifier": "DatasetReader.read", "docstring": "Reads a file from a path and returns data as a list of tuples of inputs and correct outputs\n         for every data type in ``train``, ``valid`` and ``test``.", "docstring_tokens": ["Reads", "a", "file", "from", "a", "path", "and", "returns", "data", "as", "a", "list", "of", "tuples", "of", "inputs", "and", "correct", "outputs", "for", "every", "data", "type", "in", "train", "valid", "and", "test", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255810}
{"url": "https://github.com/jaraco/jaraco.classes/blob/6347957478d589101a0774464d8d282520c2c990/jaraco/classes/ancestry.py#L30-L75", "sha": "6347957478d589101a0774464d8d282520c2c990", "docstring_summary": "Generator over all subclasses of a given class, in depth-first order.", "language": "python", "parameters": "(cls, _seen=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "type", ")", ":", "raise", "TypeError", "(", "'Func must be called with '", "'new-style classes, not %.100r'", "%", "arg_0", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "set", "(", ")", "try", ":", "arg_2", "=", "arg_0", ".", "__subclasses__", "(", ")", "except", "TypeError", ":", "arg_2", "=", "arg_0", ".", "__subclasses__", "(", "arg_0", ")", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "in", "arg_1", ":", "continue", "arg_1", ".", "add", "(", "arg_3", ")", "yield", "arg_3", "for", "arg_3", "in", "Func", "(", "arg_3", ",", "arg_1", ")", ":", "yield", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n\t\"\"\"\n\tGenerator over all subclasses of a given class, in depth-first order.\n\n\t>>> bool in list(Func(int))\n\tTrue\n\t>>> class A(object): pass\n\t>>> class B(A): pass\n\t>>> class C(A): pass\n\t>>> class D(B,C): pass\n\t>>> class E(D): pass\n\t>>>\n\t>>> for cls in Func(A):\n\t...\t\tprint(cls.__name__)\n\tB\n\tD\n\tE\n\tC\n\t>>> # get ALL (new-style) classes currently defined\n\t>>> res = [cls.__name__ for cls in Func(object)]\n\t>>> 'type' in res\n\tTrue\n\t>>> 'tuple' in res\n\tTrue\n\t>>> len(res) > 100\n\tTrue\n\t\"\"\"\n\n\tif not isinstance(arg_0, type):\n\t\traise TypeError(\n\t\t\t'Func must be called with '\n\t\t\t'new-style classes, not %.100r' % arg_0\n\t\t)\n\tif arg_1 is None:\n\t\targ_1 = set()\n\ttry:\n\t\targ_2 = arg_0.__subclasses__()\n\texcept TypeError:  # fails only when cls is type\n\t\targ_2 = arg_0.__subclasses__(arg_0)\n\tfor arg_3 in arg_2:\n\t\tif arg_3 in arg_1:\n\t\t\tcontinue\n\t\targ_1.add(arg_3)\n\t\tyield arg_3\n\t\tfor arg_3 in Func(arg_3, arg_1):\n\t\t\tyield arg_3", "path": "jaraco/classes/ancestry.py", "identifier": "iter_subclasses", "docstring": "Generator over all subclasses of a given class, in depth-first order.\n\n\t>>> bool in list(iter_subclasses(int))\n\tTrue\n\t>>> class A(object): pass\n\t>>> class B(A): pass\n\t>>> class C(A): pass\n\t>>> class D(B,C): pass\n\t>>> class E(D): pass\n\t>>>\n\t>>> for cls in iter_subclasses(A):\n\t...\t\tprint(cls.__name__)\n\tB\n\tD\n\tE\n\tC\n\t>>> # get ALL (new-style) classes currently defined\n\t>>> res = [cls.__name__ for cls in iter_subclasses(object)]\n\t>>> 'type' in res\n\tTrue\n\t>>> 'tuple' in res\n\tTrue\n\t>>> len(res) > 100\n\tTrue", "docstring_tokens": ["Generator", "over", "all", "subclasses", "of", "a", "given", "class", "in", "depth", "-", "first", "order", "."], "nwo": "jaraco/jaraco.classes", "score": 0.19258068601482742, "idx": 255811}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2_operations.py#L167-L179", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return the most recent timestamp in the operation.", "language": "python", "parameters": "(op)", "return_statement": "return last_update", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_end_time", "(", "arg_0", ")", "if", "not", "arg_1", ":", "arg_2", "=", "get_last_event", "(", "arg_0", ")", "if", "arg_2", ":", "arg_1", "=", "arg_2", "[", "'timestamp'", "]", "if", "not", "arg_1", ":", "arg_1", "=", "get_create_time", "(", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Return the most recent timestamp in the operation.\"\"\"\n  arg_1 = get_end_time(arg_0)\n\n  if not arg_1:\n    arg_2 = get_last_event(arg_0)\n    if arg_2:\n      arg_1 = arg_2['timestamp']\n\n  if not arg_1:\n    arg_1 = get_create_time(arg_0)\n\n  return arg_1", "path": "dsub/providers/google_v2_operations.py", "identifier": "get_last_update", "docstring": "Return the most recent timestamp in the operation.", "docstring_tokens": ["Return", "the", "most", "recent", "timestamp", "in", "the", "operation", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 255812}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/execution_time.py#L320-L335", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Format the calculated time into a human readable format.", "language": "python", "parameters": "(self, start=None, end=None)", "return_statement": "return \":\".join(list(self._calculate(start, end).values()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "return", "\":\"", ".", "join", "(", "list", "(", "arg_0", ".", "_calculate", "(", "arg_1", ",", "arg_2", ")", ".", "values", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Format the calculated time into a human readable format.\n\n        :param start: A starting time.\n        :type start: int|str\n\n        :param stop: A ending time.\n        :type stop: int|str\n\n        :return: A human readable date.\n        :rtype: str\n        \"\"\"\n\n        # We return the formatted execution time.\n        return \":\".join(list(arg_0._calculate(arg_1, arg_2).values()))", "path": "PyFunceble/execution_time.py", "identifier": "ExecutionTime.format_execution_time", "docstring": "Format the calculated time into a human readable format.\n\n        :param start: A starting time.\n        :type start: int|str\n\n        :param stop: A ending time.\n        :type stop: int|str\n\n        :return: A human readable date.\n        :rtype: str", "docstring_tokens": ["Format", "the", "calculated", "time", "into", "a", "human", "readable", "format", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 255813}
{"url": "https://github.com/welbornprod/fmtblock/blob/92a5529235d557170ed21e058e3c5995197facbe/fmtblock/__main__.py#L180-L189", "sha": "92a5529235d557170ed21e058e3c5995197facbe", "docstring_summary": "Parse a string as an integer.\n        Exit with a message on failure.", "language": "python", "parameters": "(s)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "int", "(", "arg_0", ")", "except", "ValueError", ":", "print_err", "(", "'\\nInvalid integer: {}'", ".", "format", "(", "arg_0", ")", ")", "sys", ".", "exit", "(", "1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" Parse a string as an integer.\n        Exit with a message on failure.\n    \"\"\"\n    try:\n        arg_1 = int(arg_0)\n    except ValueError:\n        print_err('\\nInvalid integer: {}'.format(arg_0))\n        sys.exit(1)\n    return arg_1", "path": "fmtblock/__main__.py", "identifier": "parse_int", "docstring": "Parse a string as an integer.\n        Exit with a message on failure.", "docstring_tokens": ["Parse", "a", "string", "as", "an", "integer", ".", "Exit", "with", "a", "message", "on", "failure", "."], "nwo": "welbornprod/fmtblock", "score": 0.0, "idx": 255814}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/query.py#L66-L103", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "a \"list all\" search that doesn't require a query. Here we return to\n       the user all objects that have custom properties value type set to\n       container, which is set when the image is pushed.", "language": "python", "parameters": "(self)", "return_statement": "return matches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_list_containers", "(", ")", "arg_2", "=", "[", "]", "bot", ".", "info", "(", "\"[drive://%s] Containers\"", "%", "arg_0", ".", "_base", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_4", "[", "'name'", "]", ".", "replace", "(", "'.simg'", ",", "''", ")", "if", "'properties'", "in", "arg_4", ":", "if", "'uri'", "in", "arg_4", "[", "'properties'", "]", ":", "arg_5", "=", "arg_4", "[", "'properties'", "]", "[", "'uri'", "]", "arg_3", ".", "append", "(", "[", "arg_4", "[", "'id'", "]", ",", "arg_5", "]", ")", "arg_4", "[", "'uri'", "]", "=", "arg_5", "arg_2", ".", "append", "(", "arg_4", ")", "bot", ".", "custom", "(", "prefix", "=", "\"   [drive://%s]\"", "%", "arg_0", ".", "_base", ",", "message", "=", "\"\\t\\t[id]\\t[uri]\"", ",", "color", "=", "\"PURPLE\"", ")", "bot", ".", "table", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    '''a \"list all\" search that doesn't require a query. Here we return to\n       the user all objects that have custom properties value type set to\n       container, which is set when the image is pushed. \n\n       IMPORTANT: the upload function adds this metadata. For a container to\n       be found by the client, it must have the properties value with type\n       as container. It also should have a \"uri\" in properties to show the \n       user, otherwise the user will have to query / download based on the id\n    '''\n \n    arg_1 = arg_0._list_containers()\n    arg_2 = []\n\n    bot.info(\"[drive://%s] Containers\" %arg_0._base)\n\n    arg_3 = []\n    for arg_4 in arg_1:\n\n        # Fallback to the image name without the extension\n        arg_5 = arg_4['name'].replace('.simg','')\n\n        # However the properties should include the uri\n        if 'properties' in arg_4:\n            if 'uri' in arg_4['properties']:\n                arg_5 = arg_4['properties']['uri']\n        arg_3.append([arg_4['id'],arg_5])\n\n        # Give the user back a uri\n        arg_4['uri'] = arg_5\n        arg_2.append(arg_4)\n\n    bot.custom(prefix=\"   [drive://%s]\" %arg_0._base, \n               message=\"\\t\\t[id]\\t[uri]\", \n               color=\"PURPLE\")\n\n    bot.table(arg_3)\n    return arg_2", "path": "sregistry/main/google_drive/query.py", "identifier": "search_all", "docstring": "a \"list all\" search that doesn't require a query. Here we return to\n       the user all objects that have custom properties value type set to\n       container, which is set when the image is pushed. \n\n       IMPORTANT: the upload function adds this metadata. For a container to\n       be found by the client, it must have the properties value with type\n       as container. It also should have a \"uri\" in properties to show the \n       user, otherwise the user will have to query / download based on the id", "docstring_tokens": ["a", "list", "all", "search", "that", "doesn", "t", "require", "a", "query", ".", "Here", "we", "return", "to", "the", "user", "all", "objects", "that", "have", "custom", "properties", "value", "type", "set", "to", "container", "which", "is", "set", "when", "the", "image", "is", "pushed", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 255815}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/pop.py#L63-L74", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Unapply patches up to patch_name. patch_name will end up as top\n            patch", "language": "python", "parameters": "(self, patch_name, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_0", ".", "_check", "(", "arg_2", ")", "arg_3", "=", "arg_0", ".", "db", ".", "patches_after", "(", "Patch", "(", "arg_1", ")", ")", "for", "arg_4", "in", "reversed", "(", "arg_3", ")", ":", "arg_0", ".", "_Func", "(", "arg_4", ")", "arg_0", ".", "db", ".", "save", "(", ")", "arg_0", ".", "unapplied", "(", "arg_0", ".", "db", ".", "top_patch", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\" Unapply patches up to patch_name. patch_name will end up as top\n            patch \"\"\"\n        arg_0._check(arg_2)\n\n        arg_3 = arg_0.db.patches_after(Patch(arg_1))\n        for arg_4 in reversed(arg_3):\n            arg_0._Func(arg_4)\n\n        arg_0.db.save()\n\n        arg_0.unapplied(arg_0.db.top_patch())", "path": "quilt/pop.py", "identifier": "Pop.unapply_patch", "docstring": "Unapply patches up to patch_name. patch_name will end up as top\n            patch", "docstring_tokens": ["Unapply", "patches", "up", "to", "patch_name", ".", "patch_name", "will", "end", "up", "as", "top", "patch"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 255816}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L219-L252", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Create a new tag", "language": "python", "parameters": "(self, label_id)", "return_statement": "return self._post(\n            request=ApiActions.CREATE.value,\n            uri=ApiUri.ACTIONS.value,\n            params=data\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'type'", ":", "'tagit'", ",", "'rate_count'", ":", "0", ",", "'rate_range'", ":", "'day'", ",", "'limit_count'", ":", "0", ",", "'limit_range'", ":", "'day'", ",", "'schedule'", ":", "[", "]", ",", "'enabled'", ":", "True", ",", "'args'", ":", "{", "'sn'", ":", "arg_1", ",", "'tag_sn'", ":", "arg_1", "}", "}", "return", "arg_0", ".", "_post", "(", "request", "=", "ApiActions", ".", "CREATE", ".", "value", ",", "uri", "=", "ApiUri", ".", "ACTIONS", ".", "value", ",", "params", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a new tag\n\n        :param label_id: The Label ID (the 'sn' key of the Func label response)\n        :type label_id: str\n\n        :returns: The response of your post\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException<logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries\n        \"\"\"\n        arg_2 = {\n            'type': 'tagit',\n            'rate_count': 0,\n            'rate_range': 'day',\n            'limit_count': 0,\n            'limit_range': 'day',\n            'schedule': [],\n            'enabled': True,\n            'args': {\n                'sn': arg_1,\n                'tag_sn': arg_1\n            }\n        }\n        # Yes, it's confusing. the `/actions/` endpoint is used for tags, while\n        # the /tags/ endpoint is used for labels.\n        return arg_0._post(\n            request=ApiActions.CREATE.value,\n            uri=ApiUri.ACTIONS.value,\n            params=arg_2\n        )", "path": "logentries_api/resources.py", "identifier": "Tags.create", "docstring": "Create a new tag\n\n        :param label_id: The Label ID (the 'sn' key of the create label response)\n        :type label_id: str\n\n        :returns: The response of your post\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException<logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries", "docstring_tokens": ["Create", "a", "new", "tag"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 255817}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/worker_plugins/sg_update_worker.py#L124-L146", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Produces a list of ports to be updated async.", "language": "python", "parameters": "(self, context, sg, parent_job_id)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "db_api", ".", "security_group_find", "(", "arg_1", ",", "id", "=", "arg_2", ",", "scope", "=", "db_api", ".", "ONE", ")", "if", "not", "arg_4", ":", "return", "None", "arg_5", "=", "db_api", ".", "sg_gather_associated_ports", "(", "arg_1", ",", "arg_4", ")", "if", "len", "(", "arg_5", ")", "==", "0", ":", "return", "{", "\"ports\"", ":", "0", "}", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "dict", "(", "action", "=", "\"update port %s\"", "%", "arg_6", "[", "'id'", "]", ",", "tenant_id", "=", "arg_4", "[", "'tenant_id'", "]", ",", "resource_id", "=", "arg_6", "[", "'id'", "]", ",", "parent_id", "=", "arg_3", ")", "arg_7", "=", "dict", "(", "arg_8", "=", "arg_7", ")", "arg_8", "=", "job_api", ".", "create_job", "(", "arg_1", ".", "elevated", "(", ")", ",", "arg_7", ")", "arg_9", "=", "QuarkSGAsyncConsumerClient", "(", ")", "try", ":", "arg_9", ".", "update_port", "(", "arg_1", ",", "arg_6", "[", "'id'", "]", ",", "arg_8", "[", "'id'", "]", ")", "except", "om_exc", ".", "MessagingTimeout", ":", "LOG", ".", "error", "(", "\"Failed to update port. Rabbit running?\"", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Produces a list of ports to be updated async.\"\"\"\n        arg_4 = db_api.security_group_find(arg_1, id=arg_2, scope=db_api.ONE)\n        if not arg_4:\n            return None\n        arg_5 = db_api.sg_gather_associated_ports(arg_1, arg_4)\n        if len(arg_5) == 0:\n            return {\"ports\": 0}\n        for arg_6 in arg_5:\n            arg_7 = dict(action=\"update port %s\" % arg_6['id'],\n                            tenant_id=arg_4['tenant_id'],\n                            resource_id=arg_6['id'],\n                            parent_id=arg_3)\n            arg_7 = dict(arg_8=arg_7)\n            arg_8 = job_api.create_job(arg_1.elevated(), arg_7)\n            arg_9 = QuarkSGAsyncConsumerClient()\n            try:\n                arg_9.update_port(arg_1, arg_6['id'], arg_8['id'])\n            except om_exc.MessagingTimeout:\n                # TODO(roaet): Not too sure what can be done here other than\n                # updating the job as a failure?\n                LOG.error(\"Failed to update port. Rabbit running?\")\n        return None", "path": "quark/worker_plugins/sg_update_worker.py", "identifier": "QuarkSGProducerCallback.populate_subtasks", "docstring": "Produces a list of ports to be updated async.", "docstring_tokens": ["Produces", "a", "list", "of", "ports", "to", "be", "updated", "async", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255818}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/__init__.py#L341-L371", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Create an in memory DataFrame from a pandas DataFrame.", "language": "python", "parameters": "(df, name=\"pandas\", copy_index=True, index_name=\"index\")", "return_statement": "return vaex_df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"pandas\"", ",", "arg_2", "=", "True", ",", "arg_3", "=", "\"index\"", ")", ":", "import", "six", "arg_4", "=", "vaex", ".", "dataframe", ".", "DataFrameArrays", "(", "arg_1", ")", "def", "add", "(", "arg_1", ",", "arg_5", ")", ":", "arg_6", "=", "arg_5", ".", "values", "try", ":", "arg_4", ".", "add_column", "(", "arg_1", ",", "arg_6", ")", "except", "Exception", "as", "e", ":", "print", "(", "\"could not convert column %s, error: %r, will try to convert it to string\"", "%", "(", "arg_1", ",", "e", ")", ")", "try", ":", "arg_6", "=", "arg_6", ".", "astype", "(", "\"S\"", ")", "arg_4", ".", "add_column", "(", "arg_1", ",", "arg_6", ")", "except", "Exception", "as", "e", ":", "print", "(", "\"Giving up column %s, error: %r\"", "%", "(", "arg_1", ",", "e", ")", ")", "for", "arg_1", "in", "arg_0", ".", "columns", ":", "add", "(", "arg_1", ",", "arg_0", "[", "arg_1", "]", ")", "if", "arg_2", ":", "add", "(", "arg_3", ",", "arg_0", ".", "index", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=\"pandas\", arg_2=True, arg_3=\"index\"):\n    \"\"\"Create an in memory DataFrame from a pandas DataFrame.\n\n    :param: pandas.DataFrame df: Pandas DataFrame\n    :param: name: unique for the DataFrame\n\n    >>> import vaex, pandas as pd\n    >>> df_pandas = pd.from_csv('test.csv')\n    >>> df = vaex.Func(df_pandas)\n\n    :rtype: DataFrame\n    \"\"\"\n    import six\n    arg_4 = vaex.dataframe.DataFrameArrays(arg_1)\n\n    def add(arg_1, arg_5):\n        arg_6 = arg_5.values\n        try:\n            arg_4.add_column(arg_1, arg_6)\n        except Exception as e:\n            print(\"could not convert column %s, error: %r, will try to convert it to string\" % (arg_1, e))\n            try:\n                arg_6 = arg_6.astype(\"S\")\n                arg_4.add_column(arg_1, arg_6)\n            except Exception as e:\n                print(\"Giving up column %s, error: %r\" % (arg_1, e))\n    for arg_1 in arg_0.columns:\n        add(arg_1, arg_0[arg_1])\n    if arg_2:\n        add(arg_3, arg_0.index)\n    return arg_4", "path": "packages/vaex-core/vaex/__init__.py", "identifier": "from_pandas", "docstring": "Create an in memory DataFrame from a pandas DataFrame.\n\n    :param: pandas.DataFrame df: Pandas DataFrame\n    :param: name: unique for the DataFrame\n\n    >>> import vaex, pandas as pd\n    >>> df_pandas = pd.from_csv('test.csv')\n    >>> df = vaex.from_pandas(df_pandas)\n\n    :rtype: DataFrame", "docstring_tokens": ["Create", "an", "in", "memory", "DataFrame", "from", "a", "pandas", "DataFrame", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 255819}
{"url": "https://github.com/cassinyio/SwarmSpawner/blob/3c39134ef7e02e2afc5d18da7d18d2c69421ed08/cassinyspawner/swarmspawner.py#L189-L195", "sha": "3c39134ef7e02e2afc5d18da7d18d2c69421ed08", "docstring_summary": "wrapper for calling docker methods", "language": "python", "parameters": "(self, method, *args, **kwargs)", "return_statement": "return m(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "getattr", "(", "arg_0", ".", "client", ",", "arg_1", ")", "return", "arg_4", "(", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"wrapper for calling docker methods\n\n        to be passed to ThreadPoolExecutor\n        \"\"\"\n        arg_4 = getattr(arg_0.client, arg_1)\n        return arg_4(*arg_2, **arg_3)", "path": "cassinyspawner/swarmspawner.py", "identifier": "SwarmSpawner._docker", "docstring": "wrapper for calling docker methods\n\n        to be passed to ThreadPoolExecutor", "docstring_tokens": ["wrapper", "for", "calling", "docker", "methods"], "nwo": "cassinyio/SwarmSpawner", "score": 0.2873663608194641, "idx": 255820}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/extensions.py#L94-L102", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Unload an IPython extension by its module name.", "language": "python", "parameters": "(self, module_str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "sys", ".", "modules", ":", "arg_2", "=", "sys", ".", "modules", "[", "arg_1", "]", "arg_0", ".", "_call_unload_ipython_extension", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Unload an IPython extension by its module name.\n\n        This function looks up the extension's name in ``sys.modules`` and\n        simply calls ``mod.unload_ipython_extension(self)``.\n        \"\"\"\n        if arg_1 in sys.modules:\n            arg_2 = sys.modules[arg_1]\n            arg_0._call_unload_ipython_extension(arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/core/extensions.py", "identifier": "ExtensionManager.unload_extension", "docstring": "Unload an IPython extension by its module name.\n\n        This function looks up the extension's name in ``sys.modules`` and\n        simply calls ``mod.unload_ipython_extension(self)``.", "docstring_tokens": ["Unload", "an", "IPython", "extension", "by", "its", "module", "name", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255821}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/drivers/ironic_driver.py#L431-L448", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Diagnose a port.", "language": "python", "parameters": "(self, context, port_id, **kwargs)", "return_statement": "return {\"downstream_port\": port}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "LOG", ".", "info", "(", "\"Func %s\"", "%", "arg_2", ")", "try", ":", "arg_4", "=", "arg_0", ".", "_client", ".", "show_port", "(", "arg_2", ")", "except", "Exception", "as", "e", ":", "arg_5", "=", "\"failed fetching downstream port: %s\"", "%", "(", "str", "(", "e", ")", ")", "LOG", ".", "exception", "(", "arg_5", ")", "raise", "IronicException", "(", "arg_5", "=", "arg_5", ")", "return", "{", "\"downstream_port\"", ":", "arg_4", "}"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Diagnose a port.\n\n        :param context: neutron api request context.\n        :param port_id: neutron port id.\n        :param kwargs: optional kwargs.\n        :raises IronicException: If the client is unable to fetch the\n            downstream port for any reason, the exception will be\n            logged and IronicException raised.\n        \"\"\"\n        LOG.info(\"Func %s\" % arg_2)\n        try:\n            arg_4 = arg_0._client.show_port(arg_2)\n        except Exception as e:\n            arg_5 = \"failed fetching downstream port: %s\" % (str(e))\n            LOG.exception(arg_5)\n            raise IronicException(arg_5=arg_5)\n        return {\"downstream_port\": arg_4}", "path": "quark/drivers/ironic_driver.py", "identifier": "IronicDriver.diag_port", "docstring": "Diagnose a port.\n\n        :param context: neutron api request context.\n        :param port_id: neutron port id.\n        :param kwargs: optional kwargs.\n        :raises IronicException: If the client is unable to fetch the\n            downstream port for any reason, the exception will be\n            logged and IronicException raised.", "docstring_tokens": ["Diagnose", "a", "port", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255822}
{"url": "https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/extensions.py#L419-L442", "sha": "b1c6aa159ab380a033740f4aa392cf0d125e0ac6", "docstring_summary": "Called after executing a step.", "language": "python", "parameters": "(self, ctxt, step, idx, result)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "ExtensionDebugger", "(", "'Func'", ")", "for", "arg_6", "in", "arg_0", ".", "exts", ":", "with", "arg_5", "(", "arg_6", ")", ":", "arg_6", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Called after executing a step.\n\n        :param ctxt: An instance of ``timid.context.Context``.\n        :param step: An instance of ``timid.steps.Step`` describing\n                     the step that was executed.\n        :param idx: The index of the step in the list of steps.\n        :param result: An instance of ``timid.steps.StepResult``\n                       describing the result of executing the step.\n                       May be altered by the extension, e.g., to set\n                       the ``ignore`` attribute.\n\n        :returns: The ``result`` parameter, for convenience.\n        \"\"\"\n\n        arg_5 = ExtensionDebugger('Func')\n\n        for arg_6 in arg_0.exts:\n            with arg_5(arg_6):\n                arg_6.Func(arg_1, arg_2, arg_3, arg_4)\n\n        # Convenience return\n        return arg_4", "path": "timid/extensions.py", "identifier": "ExtensionSet.post_step", "docstring": "Called after executing a step.\n\n        :param ctxt: An instance of ``timid.context.Context``.\n        :param step: An instance of ``timid.steps.Step`` describing\n                     the step that was executed.\n        :param idx: The index of the step in the list of steps.\n        :param result: An instance of ``timid.steps.StepResult``\n                       describing the result of executing the step.\n                       May be altered by the extension, e.g., to set\n                       the ``ignore`` attribute.\n\n        :returns: The ``result`` parameter, for convenience.", "docstring_tokens": ["Called", "after", "executing", "a", "step", "."], "nwo": "rackerlabs/timid", "score": 0.0, "idx": 255823}
{"url": "https://github.com/griffithlab/civicpy/blob/feac435483bac46ea650f46d1b4f15eb3395a2b8/civicpy/civic.py#L176-L192", "sha": "feac435483bac46ea650f46d1b4f15eb3395a2b8", "docstring_summary": "Updates record and returns True if record is complete after update, else False.", "language": "python", "parameters": "(self, allow_partial=True, force=False, **kwargs)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "if", "arg_3", ":", "arg_0", ".", "__init__", "(", "partial", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "return", "not", "arg_0", ".", "_partial", "if", "not", "arg_2", "and", "CACHE", ".", "get", "(", "hash", "(", "arg_0", ")", ")", ":", "arg_4", "=", "CACHE", "[", "hash", "(", "arg_0", ")", "]", "for", "arg_5", "in", "arg_0", ".", "_SIMPLE_FIELDS", "|", "arg_0", ".", "_COMPLEX_FIELDS", ":", "arg_6", "=", "getattr", "(", "arg_4", ",", "arg_5", ")", "setattr", "(", "arg_0", ",", "arg_5", ",", "arg_6", ")", "arg_0", ".", "_partial", "=", "False", "logging", ".", "info", "(", "f'Loading {str(self)} from cache'", ")", "return", "True", "arg_8", "=", "element_lookup_by_id", "(", "arg_0", ".", "type", ",", "arg_0", ".", "id", ")", "arg_0", ".", "__init__", "(", "partial", "=", "False", ",", "**", "arg_8", ")", "return", "True"], "function": "def Func(arg_0, arg_1=True, arg_2=False, **arg_3):\n        \"\"\"Updates record and returns True if record is complete after Func, else False.\"\"\"\n        if arg_3:\n            arg_0.__init__(partial=arg_1, arg_2=arg_2, **arg_3)\n            return not arg_0._partial\n\n        if not arg_2 and CACHE.get(hash(arg_0)):\n            arg_4 = CACHE[hash(arg_0)]\n            for arg_5 in arg_0._SIMPLE_FIELDS | arg_0._COMPLEX_FIELDS:\n                arg_6 = getattr(arg_4, arg_5)\n                setattr(arg_0, arg_5, arg_6)\n            arg_0._partial = False\n            logging.info(f'Loading {str(self)} from cache')\n            return True\n        arg_8 = element_lookup_by_id(arg_0.type, arg_0.id)\n        arg_0.__init__(partial=False, **arg_8)\n        return True", "path": "civicpy/civic.py", "identifier": "CivicRecord.update", "docstring": "Updates record and returns True if record is complete after update, else False.", "docstring_tokens": ["Updates", "record", "and", "returns", "True", "if", "record", "is", "complete", "after", "update", "else", "False", "."], "nwo": "griffithlab/civicpy", "score": 0.27692002097430746, "idx": 255824}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/floating_ips.py#L577-L584", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Deallocate a scaling IP.", "language": "python", "parameters": "(context, id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "'Func %s for tenant %s'", "%", "(", "arg_1", ",", "arg_0", ".", "tenant_id", ")", ")", "_delete_flip", "(", "arg_0", ",", "arg_1", ",", "ip_types", ".", "SCALING", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Deallocate a scaling IP.\n\n    :param context: neutron api request context.\n    :param id: id of the scaling ip\n    \"\"\"\n    LOG.info('Func %s for tenant %s' % (arg_1, arg_0.tenant_id))\n    _delete_flip(arg_0, arg_1, ip_types.SCALING)", "path": "quark/plugin_modules/floating_ips.py", "identifier": "delete_scalingip", "docstring": "Deallocate a scaling IP.\n\n    :param context: neutron api request context.\n    :param id: id of the scaling ip", "docstring_tokens": ["Deallocate", "a", "scaling", "IP", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255825}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/hdlSimulator.py#L368-L397", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Delta step for event dependent processes", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Generator", "[", "None", ",", "None", ",", "None", "]", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "_seqProcsToRun", ":", "try", ":", "arg_3", "=", "arg_0", ".", "_outputContainers", "[", "arg_2", "]", "except", "KeyError", ":", "arg_3", "=", "None", "arg_2", "(", "arg_0", ",", "arg_3", ")", "if", "arg_3", "is", "not", "None", ":", "arg_1", ".", "append", "(", "arg_3", ")", "arg_0", ".", "_seqProcsToRun", "=", "UniqList", "(", ")", "arg_0", ".", "FuncPlaned", "=", "False", "for", "arg_6", "in", "arg_1", ":", "for", "arg_7", ",", "arg_8", "in", "arg_6", ".", "_all_signals", ":", "arg_9", "=", "getattr", "(", "arg_6", ",", "arg_7", ")", "if", "arg_9", "is", "not", "None", ":", "arg_10", "=", "arg_0", ".", "_conflictResolveStrategy", "(", "arg_9", ")", "arg_11", ",", "arg_12", "=", "arg_10", "arg_8", ".", "simUpdateVal", "(", "arg_0", ",", "arg_11", ")", "setattr", "(", "arg_6", ",", "arg_7", ",", "None", ")", "return", "yield"], "function": "def Func(arg_0) -> Generator[None, None, None]:\n        \"\"\"\n        Delta step for event dependent processes\n        \"\"\"\n        arg_1 = []\n        for arg_2 in arg_0._seqProcsToRun:\n            try:\n                arg_3 = arg_0._outputContainers[arg_2]\n            except KeyError:\n                # processes does not have to have outputs\n                arg_3 = None\n\n            arg_2(arg_0, arg_3)\n\n            if arg_3 is not None:\n                arg_1.append(arg_3)\n\n        arg_0._seqProcsToRun = UniqList()\n        arg_0.FuncPlaned = False\n\n        for arg_6 in arg_1:\n            for arg_7, arg_8 in arg_6._all_signals:\n                arg_9 = getattr(arg_6, arg_7)\n                if arg_9 is not None:\n                    arg_10 = arg_0._conflictResolveStrategy(arg_9)\n                    arg_11, arg_12 = arg_10\n                    arg_8.simUpdateVal(arg_0, arg_11)\n                    setattr(arg_6, arg_7, None)\n        return\n        yield", "path": "hwt/simulator/hdlSimulator.py", "identifier": "HdlSimulator._runSeqProcesses", "docstring": "Delta step for event dependent processes", "docstring_tokens": ["Delta", "step", "for", "event", "dependent", "processes"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 255826}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1936-L1975", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Merge two datasets based on common column names.  We do not support all_x=True and all_y=True.\n        Only one can be True or none is True.  The default merge method is auto and it will default to the\n        radix method.  The radix method will return the correct merge result regardless of duplicated rows\n         in the right frame.  In addition, the radix method can perform merge even if you have string columns\n         in your frames.  If there are duplicated rows in your rite frame, they will not be included if you use\n        the hash method.  The hash method cannot perform merge if you have string columns in your left frame.\n        Hence, we consider the radix method superior to the hash method and is the default method to use.", "language": "python", "parameters": "(self, other, all_x=False, all_y=False, by_x=None, by_y=None, method=\"auto\")", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"merge\", self, other, all_x, all_y, by_x, by_y, method))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "\"auto\"", ")", ":", "if", "arg_4", "is", "None", "and", "arg_5", "is", "None", ":", "arg_7", "=", "list", "(", "set", "(", "arg_0", ".", "names", ")", "&", "set", "(", "arg_1", ".", "names", ")", ")", "if", "not", "arg_7", ":", "raise", "H2OValueError", "(", "\"No columns in common to Func on!\"", ")", "if", "arg_4", "is", "None", ":", "arg_4", "=", "[", "arg_0", ".", "names", ".", "index", "(", "c", ")", "for", "c", "in", "arg_7", "]", "else", ":", "arg_4", "=", "_getValidCols", "(", "arg_4", ",", "arg_0", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "[", "arg_1", ".", "names", ".", "index", "(", "c", ")", "for", "c", "in", "arg_7", "]", "else", ":", "arg_5", "=", "_getValidCols", "(", "arg_5", ",", "arg_1", ")", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False, arg_4=None, arg_5=None, arg_6=\"auto\"):\n        \"\"\"\n        Merge two datasets based on common column names.  We do not support all_x=True and all_y=True.\n        Only one can be True or none is True.  The default Func method is auto and it will default to the\n        radix method.  The radix method will return the correct Func result regardless of duplicated rows\n         in the right frame.  In addition, the radix method can perform Func even if you have string columns\n         in your frames.  If there are duplicated rows in your rite frame, they will not be included if you use\n        the hash method.  The hash method cannot perform Func if you have string columns in your left frame.\n        Hence, we consider the radix method superior to the hash method and is the default method to use.\n\n        :param H2OFrame other: The frame to Func to the current one. By default, must have at least one column in common with\n            this frame, and all columns in common are used as the Func key.  If you want to use only a subset of the\n            columns in common, rename the other columns so the columns are unique in the Funcd result.\n        :param bool all_x: If True, include all rows from the left/self frame\n        :param bool all_y: If True, include all rows from the right/other frame\n        :param by_x: list of columns in the current frame to use as a Func key.\n        :param by_y: list of columns in the ``other`` frame to use as a Func key. Should have the same number of\n            columns as in the ``by_x`` list.\n        :param method: string representing the Func method, one of auto(default), radix or hash.\n\n        :returns: New H2OFrame with the result of merging the current frame with the ``other`` frame.\n        \"\"\"\n\n        if arg_4 is None and arg_5 is None:\n            arg_7 = list(set(arg_0.names) & set(arg_1.names))\n            if not arg_7:\n                raise H2OValueError(\"No columns in common to Func on!\")\n\n        if arg_4 is None:\n            arg_4 = [arg_0.names.index(c) for c in arg_7]\n        else:\n            arg_4 = _getValidCols(arg_4,arg_0)\n\n        if arg_5 is None:\n            arg_5 = [arg_1.names.index(c) for c in arg_7]\n        else:\n            arg_5 = _getValidCols(arg_5,arg_1)\n\n\n        return H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6))", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.merge", "docstring": "Merge two datasets based on common column names.  We do not support all_x=True and all_y=True.\n        Only one can be True or none is True.  The default merge method is auto and it will default to the\n        radix method.  The radix method will return the correct merge result regardless of duplicated rows\n         in the right frame.  In addition, the radix method can perform merge even if you have string columns\n         in your frames.  If there are duplicated rows in your rite frame, they will not be included if you use\n        the hash method.  The hash method cannot perform merge if you have string columns in your left frame.\n        Hence, we consider the radix method superior to the hash method and is the default method to use.\n\n        :param H2OFrame other: The frame to merge to the current one. By default, must have at least one column in common with\n            this frame, and all columns in common are used as the merge key.  If you want to use only a subset of the\n            columns in common, rename the other columns so the columns are unique in the merged result.\n        :param bool all_x: If True, include all rows from the left/self frame\n        :param bool all_y: If True, include all rows from the right/other frame\n        :param by_x: list of columns in the current frame to use as a merge key.\n        :param by_y: list of columns in the ``other`` frame to use as a merge key. Should have the same number of\n            columns as in the ``by_x`` list.\n        :param method: string representing the merge method, one of auto(default), radix or hash.\n\n        :returns: New H2OFrame with the result of merging the current frame with the ``other`` frame.", "docstring_tokens": ["Merge", "two", "datasets", "based", "on", "common", "column", "names", ".", "We", "do", "not", "support", "all_x", "=", "True", "and", "all_y", "=", "True", ".", "Only", "one", "can", "be", "True", "or", "none", "is", "True", ".", "The", "default", "merge", "method", "is", "auto", "and", "it", "will", "default", "to", "the", "radix", "method", ".", "The", "radix", "method", "will", "return", "the", "correct", "merge", "result", "regardless", "of", "duplicated", "rows", "in", "the", "right", "frame", ".", "In", "addition", "the", "radix", "method", "can", "perform", "merge", "even", "if", "you", "have", "string", "columns", "in", "your", "frames", ".", "If", "there", "are", "duplicated", "rows", "in", "your", "rite", "frame", "they", "will", "not", "be", "included", "if", "you", "use", "the", "hash", "method", ".", "The", "hash", "method", "cannot", "perform", "merge", "if", "you", "have", "string", "columns", "in", "your", "left", "frame", ".", "Hence", "we", "consider", "the", "radix", "method", "superior", "to", "the", "hash", "method", "and", "is", "the", "default", "method", "to", "use", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255827}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L490-L501", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Returns index transforms for ``name``.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "decode", "(", "'utf-8'", ")", "try", ":", "return", "arg_0", ".", "Funces", "[", "arg_1", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "'Index \"%s\" has not been registered with '", "'this FC store.'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''Returns index transforms for ``name``.\n\n        :type name: unicode\n        :rtype: ``{ create |--> function, transform |--> function }``\n        '''\n        arg_1 = arg_1.decode('utf-8')\n        try:\n            return arg_0.Funces[arg_1]\n        except KeyError:\n            raise KeyError('Index \"%s\" has not been registered with '\n                           'this FC store.' % arg_1)", "path": "dossier/store/store.py", "identifier": "Store._index", "docstring": "Returns index transforms for ``name``.\n\n        :type name: unicode\n        :rtype: ``{ create |--> function, transform |--> function }``", "docstring_tokens": ["Returns", "index", "transforms", "for", "name", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 255828}
{"url": "https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/zincparser.py#L575-L588", "sha": "d52a7c6b5bc466f3c1a77b71814c8c0776aba995", "docstring_summary": "Parse a Project Haystack scalar in ZINC format.", "language": "python", "parameters": "(scalar_data, version)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "hs_scalar", "[", "arg_1", "]", ".", "parseString", "(", "arg_0", ",", "parseAll", "=", "True", ")", "[", "0", "]", "except", "pp", ".", "ParseException", "as", "pe", ":", "raise", "ZincParseException", "(", "'Failed to parse scalar: %s'", "%", "reformat_exception", "(", "pe", ")", ",", "arg_0", ",", "1", ",", "pe", ".", "col", ")", "except", ":", "LOG", ".", "debug", "(", "'Failing scalar data: %r (version %r)'", ",", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Parse a Project Haystack scalar in ZINC format.\n    \"\"\"\n    try:\n        return hs_scalar[arg_1].parseString(arg_0, parseAll=True)[0]\n    except pp.ParseException as pe:\n        # Raise a new exception with the appropriate line number.\n        raise ZincParseException(\n                'Failed to parse scalar: %s' % reformat_exception(pe),\n                arg_0, 1, pe.col)\n    except:\n        LOG.debug('Failing scalar data: %r (version %r)',\n                arg_0, arg_1)", "path": "hszinc/zincparser.py", "identifier": "parse_scalar", "docstring": "Parse a Project Haystack scalar in ZINC format.", "docstring_tokens": ["Parse", "a", "Project", "Haystack", "scalar", "in", "ZINC", "format", "."], "nwo": "vrtsystems/hszinc", "score": 0.2823188883832642, "idx": 255829}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/agents/ecommerce_agent/ecommerce_agent.py#L158-L173", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Format catalog item output", "language": "python", "parameters": "(item_data: Dict[Any, Any])", "return_statement": "return txt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_2", "]", ")", "->", "str", ":", "arg_3", "=", "\"\"", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "items", "(", ")", ":", "arg_3", "+=", "\"**\"", "+", "str", "(", "arg_4", ")", "+", "\"**\"", "+", "': '", "+", "str", "(", "arg_5", ")", "+", "\"  \\n\"", "return", "arg_3"], "function": "def Func(arg_0: arg_1[arg_2, arg_2]) -> str:\n    \"\"\"Format catalog item output\n\n    Parameters:\n        item_data: item's attributes values\n\n    Returns:\n        [rich_message]: list of formatted rich message\n    \"\"\"\n\n    arg_3 = \"\"\n\n    for arg_4, arg_5 in arg_0.items():\n        arg_3 += \"**\" + str(arg_4) + \"**\" + ': ' + str(arg_5) + \"  \\n\"\n\n    return arg_3", "path": "deeppavlov/agents/ecommerce_agent/ecommerce_agent.py", "identifier": "show_details", "docstring": "Format catalog item output\n\n    Parameters:\n        item_data: item's attributes values\n\n    Returns:\n        [rich_message]: list of formatted rich message", "docstring_tokens": ["Format", "catalog", "item", "output"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255830}
{"url": "https://github.com/nficano/python-lambda/blob/b0bd25404df70212d7fa057758760366406d64f2/aws_lambda/aws_lambda.py#L466-L475", "sha": "b0bd25404df70212d7fa057758760366406d64f2", "docstring_summary": "Query STS for a users' account_id", "language": "python", "parameters": "(\n    profile_name, aws_access_key_id, aws_secret_access_key,\n    region=None,\n)", "return_statement": "return client.get_caller_identity().get('Account')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", ")", ":", "arg_4", "=", "get_client", "(", "'sts'", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", ")", "return", "arg_4", ".", "get_caller_identity", "(", ")", ".", "get", "(", "'Account'", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2,\n    arg_3=None,\n):\n    \"\"\"Query STS for a users' account_id\"\"\"\n    arg_4 = get_client(\n        'sts', arg_0, arg_1, arg_2,\n        arg_3,\n    )\n    return arg_4.get_caller_identity().get('Account')", "path": "aws_lambda/aws_lambda.py", "identifier": "get_account_id", "docstring": "Query STS for a users' account_id", "docstring_tokens": ["Query", "STS", "for", "a", "users", "account_id"], "nwo": "nficano/python-lambda", "score": 0.7856642350024847, "idx": 255831}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/effects/deferred/effects.py#L76-L78", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Add point light", "language": "python", "parameters": "(self, position, radius)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "point_lights", ".", "append", "(", "PointLight", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add point light\"\"\"\n        arg_0.point_lights.append(PointLight(arg_1, arg_2))", "path": "demosys/effects/deferred/effects.py", "identifier": "DeferredRenderer.add_point_light", "docstring": "Add point light", "docstring_tokens": ["Add", "point", "light"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 255832}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L43-L47", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "update secrets will update metadata needed for pull and search", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "token", "=", "arg_0", ".", "_required_get_and_update", "(", "'SREGISTRY_GITLAB_TOKEN'", ")", "arg_0", ".", "headers", "[", "\"Private-Token\"", "]", "=", "arg_0", ".", "token"], "function": "def Func(arg_0):\n        '''update secrets will update metadata needed for pull and search\n        '''\n        arg_0.token = arg_0._required_get_and_update('SREGISTRY_GITLAB_TOKEN')\n        arg_0.headers[\"Private-Token\"] = arg_0.token", "path": "sregistry/main/gitlab/__init__.py", "identifier": "Client._update_secrets", "docstring": "update secrets will update metadata needed for pull and search", "docstring_tokens": ["update", "secrets", "will", "update", "metadata", "needed", "for", "pull", "and", "search"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 255833}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/restsession.py#L53-L93", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Remove max=null parameter from URL.", "language": "python", "parameters": "(next_url)", "return_statement": "return urllib.parse.urlunparse(parsed_url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "str", "(", "arg_0", ")", "arg_1", "=", "urllib", ".", "parse", ".", "urlparse", "(", "arg_0", ")", "if", "not", "arg_1", ".", "scheme", "or", "not", "arg_1", ".", "netloc", "or", "not", "arg_1", ".", "path", ":", "raise", "ValueError", "(", "\"'next_url' must be a valid API endpoint URL, minimally \"", "\"containing a scheme, netloc and path.\"", ")", "if", "arg_1", ".", "query", ":", "arg_2", "=", "arg_1", ".", "query", ".", "split", "(", "'&'", ")", "if", "'max=null'", "in", "arg_2", ":", "arg_2", ".", "remove", "(", "'max=null'", ")", "warnings", ".", "warn", "(", "\"`max=null` still present in next-URL returned \"", "\"from Webex Teams\"", ",", "RuntimeWarning", ")", "arg_3", "=", "'&'", ".", "join", "(", "arg_2", ")", "arg_1", "=", "list", "(", "arg_1", ")", "arg_1", "[", "4", "]", "=", "arg_3", "return", "urllib", ".", "parse", ".", "urlunparse", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Remove max=null parameter from URL.\n\n    Patch for Webex Teams Defect: 'next' URL returned in the Link headers of\n    the responses contain an errant 'max=null' parameter, which  causes the\n    next request (to this URL) to fail if the URL is requested as-is.\n\n    This patch parses the next_url to remove the max=null parameter.\n\n    Args:\n        next_url(basestring): The 'next' URL to be parsed and cleaned.\n\n    Returns:\n        basestring: The clean URL to be used for the 'next' request.\n\n    Raises:\n        AssertionError: If the parameter types are incorrect.\n        ValueError: If 'next_url' does not contain a valid API endpoint URL\n            (scheme, netloc and path).\n\n    \"\"\"\n    arg_0 = str(arg_0)\n    arg_1 = urllib.parse.urlparse(arg_0)\n\n    if not arg_1.scheme or not arg_1.netloc or not arg_1.path:\n        raise ValueError(\n            \"'next_url' must be a valid API endpoint URL, minimally \"\n            \"containing a scheme, netloc and path.\"\n        )\n\n    if arg_1.query:\n        arg_2 = arg_1.query.split('&')\n        if 'max=null' in arg_2:\n            arg_2.remove('max=null')\n            warnings.warn(\"`max=null` still present in next-URL returned \"\n                          \"from Webex Teams\", RuntimeWarning)\n        arg_3 = '&'.join(arg_2)\n        arg_1 = list(arg_1)\n        arg_1[4] = arg_3\n\n    return urllib.parse.urlunparse(arg_1)", "path": "webexteamssdk/restsession.py", "identifier": "_fix_next_url", "docstring": "Remove max=null parameter from URL.\n\n    Patch for Webex Teams Defect: 'next' URL returned in the Link headers of\n    the responses contain an errant 'max=null' parameter, which  causes the\n    next request (to this URL) to fail if the URL is requested as-is.\n\n    This patch parses the next_url to remove the max=null parameter.\n\n    Args:\n        next_url(basestring): The 'next' URL to be parsed and cleaned.\n\n    Returns:\n        basestring: The clean URL to be used for the 'next' request.\n\n    Raises:\n        AssertionError: If the parameter types are incorrect.\n        ValueError: If 'next_url' does not contain a valid API endpoint URL\n            (scheme, netloc and path).", "docstring_tokens": ["Remove", "max", "=", "null", "parameter", "from", "URL", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 255834}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/ogg.py#L338-L391", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Replace old_pages with new_pages within fileobj.", "language": "python", "parameters": "(cls, fileobj, old_pages, new_pages)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_2", "[", "0", "]", ".", "sequence", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_3", ",", "range", "(", "arg_4", ",", "arg_4", "+", "len", "(", "arg_3", ")", ")", ")", ":", "arg_5", ".", "sequence", "=", "arg_6", "arg_5", ".", "serial", "=", "arg_2", "[", "0", "]", ".", "serial", "arg_3", "[", "0", "]", ".", "first", "=", "arg_2", "[", "0", "]", ".", "first", "arg_3", "[", "0", "]", ".", "last", "=", "arg_2", "[", "0", "]", ".", "last", "arg_3", "[", "0", "]", ".", "continued", "=", "arg_2", "[", "0", "]", ".", "continued", "arg_3", "[", "-", "1", "]", ".", "first", "=", "arg_2", "[", "-", "1", "]", ".", "first", "arg_3", "[", "-", "1", "]", ".", "last", "=", "arg_2", "[", "-", "1", "]", ".", "last", "arg_3", "[", "-", "1", "]", ".", "complete", "=", "arg_2", "[", "-", "1", "]", ".", "complete", "if", "not", "arg_3", "[", "-", "1", "]", ".", "complete", "and", "len", "(", "arg_3", "[", "-", "1", "]", ".", "packets", ")", "==", "1", ":", "arg_3", "[", "-", "1", "]", ".", "position", "=", "-", "1", "arg_13", "=", "b''", ".", "join", "(", "arg_0", ".", "write", "(", "p", ")", "for", "p", "in", "arg_3", ")", "arg_14", "=", "len", "(", "arg_13", ")", "arg_1", ".", "seek", "(", "arg_2", "[", "0", "]", ".", "offset", ",", "0", ")", "insert_bytes", "(", "arg_1", ",", "arg_14", ",", "arg_2", "[", "0", "]", ".", "offset", ")", "arg_1", ".", "seek", "(", "arg_2", "[", "0", "]", ".", "offset", ",", "0", ")", "arg_1", ".", "write", "(", "arg_13", ")", "arg_15", "=", "arg_2", "[", "0", "]", ".", "offset", "+", "arg_14", "arg_2", ".", "reverse", "(", ")", "for", "arg_16", "in", "arg_2", ":", "arg_17", "=", "arg_16", ".", "offset", "+", "arg_14", "delete_bytes", "(", "arg_1", ",", "arg_16", ".", "size", ",", "arg_17", ")", "if", "len", "(", "arg_2", ")", "!=", "len", "(", "arg_3", ")", ":", "arg_1", ".", "seek", "(", "arg_15", ",", "0", ")", "arg_8", "=", "arg_3", "[", "-", "1", "]", ".", "serial", "arg_7", "=", "arg_3", "[", "-", "1", "]", ".", "sequence", "+", "1", "arg_0", ".", "renumber", "(", "arg_1", ",", "arg_8", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Replace old_pages with new_pages within fileobj.\n\n        old_pages must have come from reading fileobj originally.\n        new_pages are assumed to have the 'same' data as old_pages,\n        and so the serial and sequence numbers will be copied, as will\n        the flags for the first and last pages.\n\n        fileobj will be resized and pages renumbered as necessary. As\n        such, it must be opened r+b or w+b.\n        \"\"\"\n\n        # Number the new pages starting from the first old page.\n        arg_4 = arg_2[0].sequence\n        for arg_5, arg_6 in zip(arg_3, range(arg_4, arg_4 + len(arg_3))):\n            arg_5.sequence = arg_6\n            arg_5.serial = arg_2[0].serial\n\n        arg_3[0].first = arg_2[0].first\n        arg_3[0].last = arg_2[0].last\n        arg_3[0].continued = arg_2[0].continued\n\n        arg_3[-1].first = arg_2[-1].first\n        arg_3[-1].last = arg_2[-1].last\n        arg_3[-1].complete = arg_2[-1].complete\n        if not arg_3[-1].complete and len(arg_3[-1].packets) == 1:\n            arg_3[-1].position = -1\n\n        arg_13 = b''.join(arg_0.write(p) for p in arg_3)\n\n        # Make room in the file for the new data.\n        arg_14 = len(arg_13)\n        arg_1.seek(arg_2[0].offset, 0)\n        insert_bytes(arg_1, arg_14, arg_2[0].offset)\n        arg_1.seek(arg_2[0].offset, 0)\n        arg_1.write(arg_13)\n        arg_15 = arg_2[0].offset + arg_14\n\n        # Go through the old pages and delete them. Since we shifted\n        # the data down the file, we need to adjust their offsets. We\n        # also need to go backwards, so we don't adjust the deltas of\n        # the other pages.\n        arg_2.reverse()\n        for arg_16 in arg_2:\n            arg_17 = arg_16.offset + arg_14\n            delete_bytes(arg_1, arg_16.size, arg_17)\n\n        # Finally, if there's any discrepency in length, we need to\n        # renumber the pages for the logical stream.\n        if len(arg_2) != len(arg_3):\n            arg_1.seek(arg_15, 0)\n            arg_8 = arg_3[-1].serial\n            arg_7 = arg_3[-1].sequence + 1\n            arg_0.renumber(arg_1, arg_8, arg_7)", "path": "mutagen/ogg.py", "identifier": "OggPage.replace", "docstring": "Replace old_pages with new_pages within fileobj.\n\n        old_pages must have come from reading fileobj originally.\n        new_pages are assumed to have the 'same' data as old_pages,\n        and so the serial and sequence numbers will be copied, as will\n        the flags for the first and last pages.\n\n        fileobj will be resized and pages renumbered as necessary. As\n        such, it must be opened r+b or w+b.", "docstring_tokens": ["Replace", "old_pages", "with", "new_pages", "within", "fileobj", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 255835}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/plugins_manager.py#L79-L98", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Load AirflowPlugin subclasses from the entrypoints\n    provided. The entry_point group should be 'airflow.plugins'.", "language": "python", "parameters": "(entry_points, airflow_plugins)", "return_statement": "return airflow_plugins", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ":", "log", ".", "debug", "(", "'Importing entry_point plugin %s'", ",", "arg_2", ".", "name", ")", "arg_3", "=", "arg_2", ".", "load", "(", ")", "if", "is_valid_plugin", "(", "arg_3", ",", "arg_1", ")", ":", "if", "callable", "(", "getattr", "(", "arg_3", ",", "'on_load'", ",", "None", ")", ")", ":", "arg_3", ".", "on_load", "(", ")", "arg_1", ".", "append", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Load AirflowPlugin subclasses from the entrypoints\n    provided. The entry_point group should be 'airflow.plugins'.\n\n    :param entry_points: A collection of entrypoints to search for plugins\n    :type entry_points: Generator[setuptools.EntryPoint, None, None]\n    :param airflow_plugins: A collection of existing airflow plugins to\n        ensure we don't load duplicates\n    :type airflow_plugins: list[type[airflow.plugins_manager.AirflowPlugin]]\n    :rtype: list[airflow.plugins_manager.AirflowPlugin]\n    \"\"\"\n    for arg_2 in arg_0:\n        log.debug('Importing entry_point plugin %s', arg_2.name)\n        arg_3 = arg_2.load()\n        if is_valid_plugin(arg_3, arg_1):\n            if callable(getattr(arg_3, 'on_load', None)):\n                arg_3.on_load()\n                arg_1.append(arg_3)\n    return arg_1", "path": "airflow/plugins_manager.py", "identifier": "load_entrypoint_plugins", "docstring": "Load AirflowPlugin subclasses from the entrypoints\n    provided. The entry_point group should be 'airflow.plugins'.\n\n    :param entry_points: A collection of entrypoints to search for plugins\n    :type entry_points: Generator[setuptools.EntryPoint, None, None]\n    :param airflow_plugins: A collection of existing airflow plugins to\n        ensure we don't load duplicates\n    :type airflow_plugins: list[type[airflow.plugins_manager.AirflowPlugin]]\n    :rtype: list[airflow.plugins_manager.AirflowPlugin]", "docstring_tokens": ["Load", "AirflowPlugin", "subclasses", "from", "the", "entrypoints", "provided", ".", "The", "entry_point", "group", "should", "be", "airflow", ".", "plugins", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255836}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Parser.py#L184-L192", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Create a new knitting pattern.", "language": "python", "parameters": "(self, id_, name, rows=None)", "return_statement": "return self._spec.new_pattern(id_, name, rows, self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "new_row_collection", "(", ")", "return", "arg_0", ".", "_spec", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Create a new knitting pattern.\n\n        If rows is :obj:`None` it is replaced with the\n        :meth:`new_row_collection`.\n        \"\"\"\n        if arg_3 is None:\n            arg_3 = arg_0.new_row_collection()\n        return arg_0._spec.Func(arg_1, arg_2, arg_3, arg_0)", "path": "knittingpattern/Parser.py", "identifier": "Parser.new_pattern", "docstring": "Create a new knitting pattern.\n\n        If rows is :obj:`None` it is replaced with the\n        :meth:`new_row_collection`.", "docstring_tokens": ["Create", "a", "new", "knitting", "pattern", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 255837}
{"url": "https://github.com/BlockHub/blockhubdpostools/blob/27712cd97cd3658ee54a4330ff3135b51a01d7d1/dpostools/legacy.py#L282-L305", "sha": "27712cd97cd3658ee54a4330ff3135b51a01d7d1", "docstring_summary": "Takes a single address and returns the current balance.", "language": "python", "parameters": "(address)", "return_statement": "return balance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Address", ".", "transactions", "(", "arg_0", ")", "Func", "=", "0", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", ".", "recipientId", "==", "arg_0", ":", "Func", "+=", "arg_3", ".", "amount", "if", "arg_3", ".", "senderId", "==", "arg_0", ":", "Func", "-=", "(", "arg_3", ".", "amount", "+", "arg_3", ".", "fee", ")", "arg_4", "=", "Delegate", ".", "delegates", "(", ")", "for", "arg_3", "in", "arg_4", ":", "if", "arg_0", "==", "arg_3", ".", "address", ":", "arg_5", "=", "Delegate", ".", "blocks", "(", "arg_3", ".", "pubkey", ")", "for", "arg_6", "in", "arg_5", ":", "Func", "+=", "(", "arg_6", ".", "reward", "+", "arg_6", ".", "totalFee", ")", "if", "Func", "<", "0", ":", "arg_7", "=", "Node", ".", "height", "(", ")", "logger", ".", "fatal", "(", "'Negative balance for address {0}, Nodeheight: {1)'", ".", "format", "(", "arg_0", ",", "arg_7", ")", ")", "raise", "NegativeBalanceError", "(", "'Negative balance for address {0}, Nodeheight: {1)'", ".", "format", "(", "arg_0", ",", "arg_7", ")", ")", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Takes a single address and returns the current balance.\n        \"\"\"\n        arg_1 = Address.transactions(arg_0)\n        Func = 0\n        for arg_3 in arg_1:\n            if arg_3.recipientId == arg_0:\n                Func += arg_3.amount\n            if arg_3.senderId == arg_0:\n                Func -= (arg_3.amount + arg_3.fee)\n\n        arg_4 = Delegate.delegates()\n        for arg_3 in arg_4:\n            if arg_0 == arg_3.address:\n                arg_5 = Delegate.blocks(arg_3.pubkey)\n                for arg_6 in arg_5:\n                    Func += (arg_6.reward + arg_6.totalFee)\n\n        if Func < 0:\n            arg_7 = Node.height()\n            logger.fatal('Negative balance for address {0}, Nodeheight: {1)'.format(arg_0, arg_7))\n            raise NegativeBalanceError('Negative balance for address {0}, Nodeheight: {1)'.format(arg_0, arg_7))\n        return Func", "path": "dpostools/legacy.py", "identifier": "Address.balance", "docstring": "Takes a single address and returns the current balance.", "docstring_tokens": ["Takes", "a", "single", "address", "and", "returns", "the", "current", "balance", "."], "nwo": "BlockHub/blockhubdpostools", "score": 0.0, "idx": 255838}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/reaction.py#L869-L900", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Subtract metabolites from a reaction.", "language": "python", "parameters": "(self, metabolites, combine=True, reversibly=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "arg_0", ".", "add_metabolites", "(", "{", "arg_4", ":", "-", "arg_5", "for", "arg_4", ",", "arg_5", "in", "iteritems", "(", "arg_1", ")", "}", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=True):\n        \"\"\"Subtract metabolites from a reaction.\n\n        That means add the metabolites with -1*coefficient. If the final\n        coefficient for a metabolite is 0 then the metabolite is removed from\n        the reaction.\n\n        Notes\n        -----\n        * A final coefficient < 0 implies a reactant.\n        * The change is reverted upon exit when using the model as a context.\n\n        Parameters\n        ----------\n        metabolites : dict\n            Dictionary where the keys are of class Metabolite and the values\n            are the coefficients. These metabolites will be added to the\n            reaction.\n\n        combine : bool\n            Describes behavior a metabolite already exists in the reaction.\n            True causes the coefficients to be added.\n            False causes the coefficient to be replaced.\n\n        reversibly : bool\n            Whether to add the change to the context to make the change\n            reversibly or not (primarily intended for internal use).\n\n        \"\"\"\n        arg_0.add_metabolites({\n            arg_4: -arg_5 for arg_4, arg_5 in iteritems(arg_1)},\n            arg_2=arg_2, arg_3=arg_3)", "path": "cobra/core/reaction.py", "identifier": "Reaction.subtract_metabolites", "docstring": "Subtract metabolites from a reaction.\n\n        That means add the metabolites with -1*coefficient. If the final\n        coefficient for a metabolite is 0 then the metabolite is removed from\n        the reaction.\n\n        Notes\n        -----\n        * A final coefficient < 0 implies a reactant.\n        * The change is reverted upon exit when using the model as a context.\n\n        Parameters\n        ----------\n        metabolites : dict\n            Dictionary where the keys are of class Metabolite and the values\n            are the coefficients. These metabolites will be added to the\n            reaction.\n\n        combine : bool\n            Describes behavior a metabolite already exists in the reaction.\n            True causes the coefficients to be added.\n            False causes the coefficient to be replaced.\n\n        reversibly : bool\n            Whether to add the change to the context to make the change\n            reversibly or not (primarily intended for internal use).", "docstring_tokens": ["Subtract", "metabolites", "from", "a", "reaction", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255839}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/databuffer.py#L128-L147", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Creates a Dataset with unknown size.\n        Resize it before using.", "language": "python", "parameters": "(self, ds_name, dtype=np.float32)", "return_statement": "return ds", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "float32", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_datasets", ":", "return", "arg_0", ".", "_datasets", "[", "arg_1", "]", "arg_5", "=", "arg_0", ".", "_group", ".", "create_dataset", "(", "arg_1", ",", "(", "1", ",", "1", ")", ",", "maxshape", "=", "None", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_datasets", "[", "arg_1", "]", "=", "arg_5", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.float32):\n        \"\"\"\n        Creates a Dataset with unknown size.\n        Resize it before using.\n\n        :param ds_name: string\n\n        :param dtype: dtype\n        Datatype of the dataset\n\n        :return: h5py DataSet\n        \"\"\"\n        if arg_1 in arg_0._datasets:\n            return arg_0._datasets[arg_1]\n\n        arg_5 = arg_0._group.create_dataset(arg_1, (1, 1), maxshape=None,\n                                        arg_2=arg_2)\n        arg_0._datasets[arg_1] = arg_5\n\n        return arg_5", "path": "boyle/databuffer.py", "identifier": "HdfDataBuffer.create_empty_dataset", "docstring": "Creates a Dataset with unknown size.\n        Resize it before using.\n\n        :param ds_name: string\n\n        :param dtype: dtype\n        Datatype of the dataset\n\n        :return: h5py DataSet", "docstring_tokens": ["Creates", "a", "Dataset", "with", "unknown", "size", ".", "Resize", "it", "before", "using", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255840}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/interface.py#L42-L56", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Register nemo and parses annotations", "language": "python", "parameters": "(self, nemo)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "__nemo__", "=", "arg_1", "for", "arg_3", "in", "arg_0", ".", "__annotations__", ":", "arg_3", ".", "target", ".", "expanded", "=", "frozenset", "(", "arg_0", ".", "__getinnerreffs__", "(", "objectId", "=", "arg_3", ".", "target", ".", "objectId", ",", "subreference", "=", "arg_3", ".", "target", ".", "subreference", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Register nemo and parses annotations\n\n        .. note:: Process parses the annotation and extends informations about the target URNs by retrieving resource in range\n\n        :param nemo: Nemo\n        \"\"\"\n        arg_0.__nemo__ = arg_1\n        for arg_3 in arg_0.__annotations__:\n            arg_3.target.expanded = frozenset(\n                arg_0.__getinnerreffs__(\n                    objectId=arg_3.target.objectId,\n                    subreference=arg_3.target.subreference\n                )\n            )", "path": "flask_nemo/query/interface.py", "identifier": "SimpleQuery.process", "docstring": "Register nemo and parses annotations\n\n        .. note:: Process parses the annotation and extends informations about the target URNs by retrieving resource in range\n\n        :param nemo: Nemo", "docstring_tokens": ["Register", "nemo", "and", "parses", "annotations"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 255841}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L2461-L2473", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "For each string, find the count of all possible substrings with 2 characters or more that are contained in\n        the line-separated text file whose path is given.", "language": "python", "parameters": "(self, path_to_words)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert_is_type", "(", "arg_1", ",", "str", ")", "arg_2", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "arg_1", ")", ")", "arg_2", ".", "_ex", ".", "_cache", ".", "nrows", "=", "arg_0", ".", "nrow", "arg_2", ".", "_ex", ".", "_cache", ".", "ncol", "=", "arg_0", ".", "ncol", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        For each string, find the count of all possible substrings with 2 characters or more that are contained in\n        the line-separated text file whose path is given.\n\n        :param str path_to_words: Path to file that contains a line-separated list of strings considered valid.\n        :returns: An H2OFrame with the number of substrings that are contained in the given word list.\n        \"\"\"\n        assert_is_type(arg_1, str)\n        arg_2 = H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, arg_1))\n        arg_2._ex._cache.nrows = arg_0.nrow\n        arg_2._ex._cache.ncol = arg_0.ncol\n        return arg_2", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.num_valid_substrings", "docstring": "For each string, find the count of all possible substrings with 2 characters or more that are contained in\n        the line-separated text file whose path is given.\n\n        :param str path_to_words: Path to file that contains a line-separated list of strings considered valid.\n        :returns: An H2OFrame with the number of substrings that are contained in the given word list.", "docstring_tokens": ["For", "each", "string", "find", "the", "count", "of", "all", "possible", "substrings", "with", "2", "characters", "or", "more", "that", "are", "contained", "in", "the", "line", "-", "separated", "text", "file", "whose", "path", "is", "given", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255842}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/compiler.py#L132-L138", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Builds the python source code for the Parser TokenType enum.", "language": "python", "parameters": "(self)", "return_statement": "return fmt.format(indent=self.indent)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"class TokenType(Enum):\\n\"", "\"{indent}\\\"\\\"\\\"The token types for parse nodes generated by the Parser.\\\"\\\"\\\"\\n\"", "\"{indent}\"", "+", "\"\\n{indent}\"", ".", "join", "(", "\"{1} = {0}\"", ".", "format", "(", "num", "+", "1", ",", "r", ".", "name", ")", "for", "num", ",", "r", "in", "enumerate", "(", "arg_0", ".", "rules", ")", ")", "return", "arg_1", ".", "format", "(", "indent", "=", "arg_0", ".", "indent", ")"], "function": "def Func(arg_0):\n    \"\"\"Builds the python source code for the Parser TokenType enum.\"\"\"\n    arg_1 = \"class TokenType(Enum):\\n\" \\\n          \"{indent}\\\"\\\"\\\"The token types for parse nodes generated by the Parser.\\\"\\\"\\\"\\n\" \\\n          \"{indent}\" + \\\n          \"\\n{indent}\".join(\"{1} = {0}\".format(num + 1, r.name) for num, r in enumerate(arg_0.rules))\n    return arg_1.format(indent=arg_0.indent)", "path": "pyebnf/compiler.py", "identifier": "Compiler._get_token_type_enum", "docstring": "Builds the python source code for the Parser TokenType enum.", "docstring_tokens": ["Builds", "the", "python", "source", "code", "for", "the", "Parser", "TokenType", "enum", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 255843}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L330-L342", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Initialize repositories directory path", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "parsed_args", ".", "git_log", ":", "arg_1", "=", "arg_0", ".", "parsed_args", ".", "git_log", "elif", "not", "arg_0", ".", "parsed_args", ".", "git_path", ":", "arg_2", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.perceval/repositories/'", ")", "arg_3", "=", "arg_0", ".", "parsed_args", ".", "uri", ".", "lstrip", "(", "'/'", ")", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_3", ")", "+", "'-git'", "else", ":", "arg_1", "=", "arg_0", ".", "parsed_args", ".", "git_path", "setattr", "(", "arg_0", ".", "parsed_args", ",", "'gitpath'", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Initialize repositories directory path\"\"\"\n\n        if arg_0.parsed_args.git_log:\n            arg_1 = arg_0.parsed_args.git_log\n        elif not arg_0.parsed_args.git_path:\n            arg_2 = os.path.expanduser('~/.perceval/repositories/')\n            arg_3 = arg_0.parsed_args.uri.lstrip('/')\n            arg_1 = os.path.join(arg_2, arg_3) + '-git'\n        else:\n            arg_1 = arg_0.parsed_args.git_path\n\n        setattr(arg_0.parsed_args, 'gitpath', arg_1)", "path": "perceval/backends/core/git.py", "identifier": "GitCommand._pre_init", "docstring": "Initialize repositories directory path", "docstring_tokens": ["Initialize", "repositories", "directory", "path"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255844}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/setup.py#L70-L122", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Parse out a list of requirements from the given requirements\n    requirements file.", "language": "python", "parameters": "(filename)", "return_statement": "return reqs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "None", "for", "arg_3", "in", "open", "(", "arg_0", ",", "'r'", ")", ".", "read", "(", ")", ".", "strip", "(", ")", ".", "split", "(", "'\\n'", ")", ":", "if", "not", "arg_3", ".", "strip", "(", ")", ":", "continue", "if", "not", "arg_3", ".", "startswith", "(", "'#'", ")", ":", "arg_1", ".", "append", "(", "arg_3", ")", "continue", "arg_4", "=", "re", ".", "search", "(", "r'^# === [Pp]ython (?P<op>[<>=]{1,2}) '", "r'(?P<major>[\\d])\\.(?P<minor>[\\d]+) ===[\\s]*$'", ",", "arg_3", ")", "if", "arg_4", ":", "arg_2", "=", "arg_4", ".", "groupdict", "(", ")", "for", "arg_5", "in", "(", "'major'", ",", "'minor'", ")", ":", "arg_2", "[", "arg_5", "]", "=", "int", "(", "arg_2", "[", "arg_5", "]", ")", "continue", "if", "' '", "not", "in", "arg_3", "[", "1", ":", "]", ".", "strip", "(", ")", "and", "arg_2", ":", "arg_6", "=", "arg_3", "[", "1", ":", "]", ".", "strip", "(", ")", "arg_7", "=", "arg_2", "[", "'op'", "]", "arg_8", "=", "(", "arg_2", "[", "'major'", "]", ",", "arg_2", "[", "'minor'", "]", ")", "if", "'='", "in", "arg_7", "and", "sys", ".", "version_info", "[", "0", ":", "2", "]", "==", "arg_8", ":", "arg_1", ".", "append", "(", "arg_6", ")", "elif", "'>'", "in", "arg_7", "and", "sys", ".", "version_info", "[", "0", ":", "2", "]", ">", "arg_8", ":", "arg_1", ".", "append", "(", "arg_6", ")", "elif", "'<'", "in", "arg_7", "and", "sys", ".", "version_info", "[", "0", ":", "2", "]", "<", "arg_8", ":", "arg_1", ".", "append", "(", "arg_6", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse out a list of requirements from the given requirements\n    requirements file.\n    \"\"\"\n    arg_1 = []\n    arg_2 = None\n\n    # Iterate over each line in the requirements file.\n    for arg_3 in open(arg_0, 'r').read().strip().split('\\n'):\n        # Sanity check: Is this an empty line?\n        # If so, do nothing.\n        if not arg_3.strip():\n            continue\n\n        # If this is just a plain requirement (not a comment), then\n        # add it to the requirements list.\n        if not arg_3.startswith('#'):\n            arg_1.append(arg_3)\n            continue\n\n        # \"Header\" comments take the form of \"=== Python {op} {version} ===\",\n        # and make the requirement only matter for those versions.\n        # If this line is a header comment, parse it.\n        arg_4 = re.search(r'^# === [Pp]ython (?P<op>[<>=]{1,2}) '\n                          r'(?P<major>[\\d])\\.(?P<minor>[\\d]+) ===[\\s]*$', arg_3)\n        if arg_4:\n            arg_2 = arg_4.groupdict()\n            for arg_5 in ('major', 'minor'):\n                arg_2[arg_5] = int(arg_2[arg_5])\n            continue\n\n        # If this is a comment that otherwise looks like a package, then it\n        # should be a package applying only to the current version spec.\n        #\n        # We can identify something that looks like a package by a lack\n        # of any spaces.\n        if ' ' not in arg_3[1:].strip() and arg_2:\n            arg_6 = arg_3[1:].strip()\n\n            # Sanity check: Is our version of Python one of the ones currently\n            # in play?\n            arg_7 = arg_2['op']\n            arg_8 = (arg_2['major'],\n                     arg_2['minor'])\n            if '=' in arg_7 and sys.version_info[0:2] == arg_8:\n                arg_1.append(arg_6)\n            elif '>' in arg_7 and sys.version_info[0:2] > arg_8:\n                arg_1.append(arg_6)\n            elif '<' in arg_7 and sys.version_info[0:2] < arg_8:\n                arg_1.append(arg_6)\n\n    # Okay, we should have an entire list of requirements now.\n    return arg_1", "path": "setup.py", "identifier": "parse_requirements", "docstring": "Parse out a list of requirements from the given requirements\n    requirements file.", "docstring_tokens": ["Parse", "out", "a", "list", "of", "requirements", "from", "the", "given", "requirements", "requirements", "file", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 255845}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L819-L890", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "check mean insert size for this sample and update \n    hackersonly.max_inner_mate_distance if need be. This value controls how \n    far apart mate pairs can be to still be considered for bedtools merging \n    downstream.", "language": "python", "parameters": "(data, sample)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "ipyrad", ".", "bins", ".", "samtools", ",", "\"stats\"", ",", "arg_1", ".", "files", ".", "mapped_reads", "]", "arg_3", "=", "[", "\"grep\"", ",", "\"SN\"", "]", "arg_4", "=", "sps", ".", "Popen", "(", "arg_2", ",", "stderr", "=", "sps", ".", "STDOUT", ",", "stdout", "=", "sps", ".", "PIPE", ")", "arg_5", "=", "sps", ".", "Popen", "(", "arg_3", ",", "stderr", "=", "sps", ".", "STDOUT", ",", "stdout", "=", "sps", ".", "PIPE", ",", "stdin", "=", "arg_4", ".", "stdout", ")", "arg_6", "=", "arg_5", ".", "communicate", "(", ")", "[", "0", "]", "if", "arg_5", ".", "returncode", ":", "raise", "IPyradWarningExit", "(", "\"error in %s: %s\"", ",", "arg_3", ",", "arg_6", ")", "arg_7", "=", "0", "arg_8", "=", "0", "arg_9", "=", "0", "for", "arg_10", "in", "arg_6", ".", "split", "(", "\"\\n\"", ")", ":", "if", "\"insert size average\"", "in", "arg_10", ":", "arg_7", "=", "float", "(", "arg_10", ".", "split", "(", "\":\"", ")", "[", "-", "1", "]", ".", "strip", "(", ")", ")", "elif", "\"insert size standard deviation\"", "in", "arg_10", ":", "arg_8", "=", "float", "(", "arg_10", ".", "split", "(", "\":\"", ")", "[", "-", "1", "]", ".", "strip", "(", ")", ")", "+", "0.1", "elif", "\"average length\"", "in", "arg_10", ":", "arg_9", "=", "float", "(", "arg_10", ".", "split", "(", "\":\"", ")", "[", "-", "1", "]", ".", "strip", "(", ")", ")", "LOGGER", ".", "debug", "(", "\"avg {} stdv {} avg_len {}\"", ".", "format", "(", "arg_7", ",", "arg_8", ",", "arg_9", ")", ")", "if", "all", "(", "[", "arg_7", ",", "arg_8", ",", "arg_9", "]", ")", ":", "if", "arg_8", "<", "5", ":", "arg_8", "=", "5.", "if", "(", "2", "*", "arg_9", ")", "<", "arg_7", ":", "arg_11", "=", "arg_7", "+", "(", "3", "*", "np", ".", "math", ".", "ceil", "(", "arg_8", ")", ")", "-", "(", "2", "*", "arg_9", ")", "else", ":", "arg_11", "=", "(", "arg_7", "-", "arg_9", ")", "+", "(", "3", "*", "np", ".", "math", ".", "ceil", "(", "arg_8", ")", ")", "LOGGER", ".", "info", "(", "\"stdv: hacked insert size is %s\"", ",", "arg_11", ")", "arg_0", ".", "_hackersonly", "[", "\"max_inner_mate_distance\"", "]", "=", "int", "(", "np", ".", "math", ".", "ceil", "(", "arg_11", ")", ")", "else", ":", "arg_0", ".", "_hackersonly", "[", "\"max_inner_mate_distance\"", "]", "=", "300", "LOGGER", ".", "debug", "(", "\"inner mate distance for {} - {}\"", ".", "format", "(", "arg_1", ".", "name", ",", "arg_0", ".", "_hackersonly", "[", "\"max_inner_mate_distance\"", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    check mean insert size for this sample and update \n    hackersonly.max_inner_mate_distance if need be. This value controls how \n    far apart mate pairs can be to still be considered for bedtools merging \n    downstream.\n    \"\"\"\n\n    ## pipe stats output to grep\n    arg_2 = [ipyrad.bins.samtools, \"stats\", arg_1.files.mapped_reads]\n    arg_3 = [\"grep\", \"SN\"]\n    arg_4 = sps.Popen(arg_2, stderr=sps.STDOUT, stdout=sps.PIPE)\n    arg_5 = sps.Popen(arg_3, stderr=sps.STDOUT, stdout=sps.PIPE, stdin=arg_4.stdout)\n\n    ## get piped result\n    arg_6 = arg_5.communicate()[0]\n\n    ## raise exception on failure and do cleanup\n    if arg_5.returncode:\n        raise IPyradWarningExit(\"error in %s: %s\", arg_3, arg_6)\n        \n    ## starting vals\n    arg_7 = 0\n    arg_8 = 0\n    arg_9 = 0\n\n    ## iterate over results\n    for arg_10 in arg_6.split(\"\\n\"):\n        if \"insert size average\" in arg_10:\n            arg_7 = float(arg_10.split(\":\")[-1].strip())\n\n        elif \"insert size standard deviation\" in arg_10:\n            ## hack to fix sim data when stdv is 0.0. Shouldn't\n            ## impact real data bcz stdv gets rounded up below\n            arg_8 = float(arg_10.split(\":\")[-1].strip()) + 0.1\n       \n        elif \"average length\" in arg_10:\n            arg_9 = float(arg_10.split(\":\")[-1].strip())\n\n    LOGGER.debug(\"avg {} stdv {} avg_len {}\"\\\n                 .format(arg_7, arg_8, arg_9))\n\n    ## If all values return successfully set the max inner mate distance.\n    ## This is tricky. avg_insert is the average length of R1+R2+inner mate\n    ## distance. avg_len is the average length of a read. If there are lots\n    ## of reads that overlap then avg_insert will be close to but bigger than\n    ## avg_len. We are looking for the right value for `bedtools merge -d`\n    ## which wants to know the max distance between reads. \n    if all([arg_7, arg_8, arg_9]):\n        ## If 2 * the average length of a read is less than the average\n        ## insert size then most reads DO NOT overlap\n        if arg_8 < 5:\n            arg_8 = 5.\n        if (2 * arg_9) < arg_7:\n            arg_11 = arg_7 + (3 * np.math.ceil(arg_8)) - (2 * arg_9)\n\n        ## If it is > than the average insert size then most reads DO\n        ## overlap, so we have to calculate inner mate distance a little \n        ## differently.\n        else:\n            arg_11 = (arg_7 - arg_9) + (3 * np.math.ceil(arg_8))\n            \n\n        ## set the hackerdict value\n        LOGGER.info(\"stdv: hacked insert size is %s\", arg_11)\n        arg_0._hackersonly[\"max_inner_mate_distance\"] = int(np.math.ceil(arg_11))\n\n    else:\n        ## If something fsck then set a relatively conservative distance\n        arg_0._hackersonly[\"max_inner_mate_distance\"] = 300\n        LOGGER.debug(\"inner mate distance for {} - {}\".format(arg_1.name,\\\n                    arg_0._hackersonly[\"max_inner_mate_distance\"]))", "path": "ipyrad/assemble/refmap.py", "identifier": "check_insert_size", "docstring": "check mean insert size for this sample and update \n    hackersonly.max_inner_mate_distance if need be. This value controls how \n    far apart mate pairs can be to still be considered for bedtools merging \n    downstream.", "docstring_tokens": ["check", "mean", "insert", "size", "for", "this", "sample", "and", "update", "hackersonly", ".", "max_inner_mate_distance", "if", "need", "be", ".", "This", "value", "controls", "how", "far", "apart", "mate", "pairs", "can", "be", "to", "still", "be", "considered", "for", "bedtools", "merging", "downstream", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 255846}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L697-L707", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Multiply this frame, viewed as a matrix, by another matrix.", "language": "python", "parameters": "(self, matrix)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"x\", self, matrix))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "ncols", "!=", "arg_1", ".", "nrows", ":", "raise", "H2OValueError", "(", "\"Matrix is not compatible for Funciplication with the current frame\"", ")", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"x\"", ",", "arg_0", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Multiply this frame, viewed as a matrix, by another matrix.\n\n        :param matrix: another frame that you want to Funciply the current frame by; must be compatible with the\n            current frame (i.e. its number of rows must be the same as number of columns in the current frame).\n        :returns: new H2OFrame, which is the result of Funciplying the current frame by ``matrix``.\n        \"\"\"\n        if arg_0.ncols != arg_1.nrows:\n            raise H2OValueError(\"Matrix is not compatible for Funciplication with the current frame\")\n        return H2OFrame._expr(expr=ExprNode(\"x\", arg_0, arg_1))", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.mult", "docstring": "Multiply this frame, viewed as a matrix, by another matrix.\n\n        :param matrix: another frame that you want to multiply the current frame by; must be compatible with the\n            current frame (i.e. its number of rows must be the same as number of columns in the current frame).\n        :returns: new H2OFrame, which is the result of multiplying the current frame by ``matrix``.", "docstring_tokens": ["Multiply", "this", "frame", "viewed", "as", "a", "matrix", "by", "another", "matrix", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255847}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L129-L148", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Parses the handshake for protocol alerts", "language": "python", "parameters": "(server_handshake_bytes)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "parse_tls_records", "(", "arg_0", ")", ":", "if", "arg_1", "!=", "b'\\x15'", ":", "continue", "if", "len", "(", "arg_3", ")", "!=", "2", ":", "return", "None", "return", "(", "int_from_bytes", "(", "arg_3", "[", "0", ":", "1", "]", ")", ",", "int_from_bytes", "(", "arg_3", "[", "1", ":", "2", "]", ")", ")", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Parses the handshake for protocol alerts\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        None or an 2-element tuple of integers:\n         0: 1 (warning) or 2 (fatal)\n         1: The alert description (see https://tools.ietf.org/html/rfc5246#section-7.2)\n    \"\"\"\n\n    for arg_1, arg_2, arg_3 in parse_tls_records(arg_0):\n        if arg_1 != b'\\x15':\n            continue\n        if len(arg_3) != 2:\n            return None\n        return (int_from_bytes(arg_3[0:1]), int_from_bytes(arg_3[1:2]))\n    return None", "path": "oscrypto/_tls.py", "identifier": "parse_alert", "docstring": "Parses the handshake for protocol alerts\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        None or an 2-element tuple of integers:\n         0: 1 (warning) or 2 (fatal)\n         1: The alert description (see https://tools.ietf.org/html/rfc5246#section-7.2)", "docstring_tokens": ["Parses", "the", "handshake", "for", "protocol", "alerts"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 255848}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L912-L924", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns the indices of the predictive cells.", "language": "python", "parameters": "(self)", "return_statement": "return predictiveCells", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "activeSegments", ":", "if", "arg_3", ".", "cell", "!=", "arg_1", ":", "arg_2", ".", "append", "(", "arg_3", ".", "cell", ")", "arg_1", "=", "arg_3", ".", "cell", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\" Returns the indices of the predictive cells.\n\n    :returns: (list) Indices of predictive cells.\n    \"\"\"\n    arg_1 = None\n    arg_2 = []\n    for arg_3 in arg_0.activeSegments:\n      if arg_3.cell != arg_1:\n        arg_2.append(arg_3.cell)\n        arg_1 = arg_3.cell\n\n    return arg_2", "path": "src/nupic/algorithms/temporal_memory.py", "identifier": "TemporalMemory.getPredictiveCells", "docstring": "Returns the indices of the predictive cells.\n\n    :returns: (list) Indices of predictive cells.", "docstring_tokens": ["Returns", "the", "indices", "of", "the", "predictive", "cells", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255849}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/preprocessors/preprocessor.py#L113-L123", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Calls `reset` on all our Preprocessor objects.", "language": "python", "parameters": "(self)", "return_statement": "return fetches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "preprocessors", ":", "arg_1", ".", "extend", "(", "arg_2", ".", "Func", "(", ")", "or", "[", "]", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Calls `Func` on all our Preprocessor objects.\n\n        Returns:\n            A list of tensors to be fetched.\n        \"\"\"\n        arg_1 = []\n        for arg_2 in arg_0.preprocessors:\n            arg_1.extend(arg_2.Func() or [])\n        return arg_1", "path": "tensorforce/core/preprocessors/preprocessor.py", "identifier": "PreprocessorStack.reset", "docstring": "Calls `reset` on all our Preprocessor objects.\n\n        Returns:\n            A list of tensors to be fetched.", "docstring_tokens": ["Calls", "reset", "on", "all", "our", "Preprocessor", "objects", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 255850}
{"url": "https://github.com/jupyter-widgets/jupyterlab-sidecar/blob/8889d09f1a0933e2cbee06d4874f720b075b29e8/setupbase.py#L633-L640", "sha": "8889d09f1a0933e2cbee06d4874f720b075b29e8", "docstring_summary": "Translate a glob PATTERN to a regular expression.", "language": "python", "parameters": "(pat)", "return_statement": "return '{res}\\\\Z(?ms)'.format(res=res)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "_iexplode_path", "(", "arg_0", ")", ":", "arg_1", ".", "append", "(", "Func_part", "(", "arg_2", ")", ")", "arg_3", "=", "'[%s]'", "%", "re", ".", "escape", "(", "SEPARATORS", ")", "arg_4", "=", "_join_translated", "(", "arg_1", ",", "arg_3", ")", "return", "'{res}\\\\Z(?ms)'", ".", "format", "(", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"Translate a glob PATTERN to a regular expression.\"\"\"\n    arg_1 = []\n    for arg_2 in _iexplode_path(arg_0):\n        arg_1.append(Func_part(arg_2))\n    arg_3 = '[%s]' % re.escape(SEPARATORS)\n    arg_4 = _join_translated(arg_1, arg_3)\n    return '{res}\\\\Z(?ms)'.format(arg_4=arg_4)", "path": "setupbase.py", "identifier": "_translate_glob", "docstring": "Translate a glob PATTERN to a regular expression.", "docstring_tokens": ["Translate", "a", "glob", "PATTERN", "to", "a", "regular", "expression", "."], "nwo": "jupyter-widgets/jupyterlab-sidecar", "score": 0.6376222650402201, "idx": 255851}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/decomposition.py#L109-L219", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Decompose an observed time series into contributions from each component.", "language": "python", "parameters": "(model, observed_time_series, parameter_samples)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "'Func'", ",", "values", "=", "[", "arg_1", "]", ")", ":", "[", "arg_1", ",", "arg_3", "]", "=", "sts_util", ".", "canonicalize_observed_time_series_with_mask", "(", "arg_1", ")", "arg_4", "=", "dist_util", ".", "prefer_static_value", "(", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", ")", "[", "-", "2", "]", "arg_5", "=", "arg_0", ".", "make_state_space_model", "(", "arg_4", "=", "arg_4", ",", "param_vals", "=", "arg_2", ")", "arg_6", ",", "arg_7", "=", "arg_5", ".", "posterior_marginals", "(", "arg_1", ",", "mask", "=", "arg_3", ")", "return", "_decompose_from_posterior_marginals", "(", "arg_0", ",", "arg_6", ",", "arg_7", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Decompose an observed time series into contributions from each component.\n\n  This method decomposes a time series according to the posterior represention\n  of a structural time series model. In particular, it:\n    - Computes the posterior marginal mean and covariances over the additive\n      model's latent space.\n    - Decomposes the latent posterior into the marginal blocks for each\n      model component.\n    - Maps the per-component latent posteriors back through each component's\n      observation model, to generate the time series modeled by that component.\n\n  Args:\n    model: An instance of `tfp.sts.Sum` representing a structural time series\n      model.\n    observed_time_series: `float` `Tensor` of shape\n      `batch_shape + [num_timesteps, 1]` (omitting the trailing unit dimension\n      is also supported when `num_timesteps > 1`), specifying an observed time\n      series. May optionally be an instance of `tfp.sts.MaskedTimeSeries`, which\n      includes a mask `Tensor` to specify timesteps with missing observations.\n    parameter_samples: Python `list` of `Tensors` representing posterior\n      samples of model parameters, with shapes `[concat([\n      [num_posterior_draws], param.prior.batch_shape,\n      param.prior.event_shape]) for param in model.parameters]`. This may\n      optionally also be a map (Python `dict`) of parameter names to\n      `Tensor` values.\n  Returns:\n    component_dists: A `collections.OrderedDict` instance mapping\n      component StructuralTimeSeries instances (elements of `model.components`)\n      to `tfd.Distribution` instances representing the posterior marginal\n      distributions on the process modeled by each component. Each distribution\n      has batch shape matching that of `posterior_means`/`posterior_covs`, and\n      event shape of `[num_timesteps]`.\n\n  #### Examples\n\n  Suppose we've built a model and fit it to data:\n\n  ```python\n    day_of_week = tfp.sts.Seasonal(\n        num_seasons=7,\n        observed_time_series=observed_time_series,\n        name='day_of_week')\n    local_linear_trend = tfp.sts.LocalLinearTrend(\n        observed_time_series=observed_time_series,\n        name='local_linear_trend')\n    model = tfp.sts.Sum(components=[day_of_week, local_linear_trend],\n                        observed_time_series=observed_time_series)\n\n    num_steps_forecast = 50\n    samples, kernel_results = tfp.sts.fit_with_hmc(model, observed_time_series)\n  ```\n\n  To extract the contributions of individual components, pass the time series\n  and sampled parameters into `Func`:\n\n  ```python\n    component_dists = Func(\n      model,\n      observed_time_series=observed_time_series,\n      parameter_samples=samples)\n\n    # Component mean and stddev have shape `[len(observed_time_series)]`.\n    day_of_week_effect_mean = component_dists[day_of_week].mean()\n    day_of_week_effect_stddev = component_dists[day_of_week].stddev()\n  ```\n\n  Using the component distributions, we can visualize the uncertainty for\n  each component:\n\n  ```\n  from matplotlib import pylab as plt\n  num_components = len(component_dists)\n  xs = np.arange(len(observed_time_series))\n  fig = plt.figure(figsize=(12, 3 * num_components))\n  for i, (component, component_dist) in enumerate(component_dists.items()):\n\n    # If in graph mode, replace `.numpy()` with `.eval()` or `sess.run()`.\n    component_mean = component_dist.mean().numpy()\n    component_stddev = component_dist.stddev().numpy()\n\n    ax = fig.add_subplot(num_components, 1, 1 + i)\n    ax.plot(xs, component_mean, lw=2)\n    ax.fill_between(xs,\n                    component_mean - 2 * component_stddev,\n                    component_mean + 2 * component_stddev,\n                    alpha=0.5)\n    ax.set_title(component.name)\n  ```\n\n  \"\"\"\n\n  with tf.compat.v1.name_scope('Func',\n                               values=[arg_1]):\n    [\n        arg_1,\n        arg_3\n    ] = sts_util.canonicalize_observed_time_series_with_mask(\n        arg_1)\n\n    # Run smoothing over the training timesteps to extract the\n    # posterior on latents.\n    arg_4 = dist_util.prefer_static_value(\n        tf.shape(input=arg_1))[-2]\n    arg_5 = arg_0.make_state_space_model(arg_4=arg_4,\n                                       param_vals=arg_2)\n    arg_6, arg_7 = arg_5.posterior_marginals(\n        arg_1, mask=arg_3)\n\n    return _decompose_from_posterior_marginals(\n        arg_0, arg_6, arg_7, arg_2)", "path": "tensorflow_probability/python/sts/decomposition.py", "identifier": "decompose_by_component", "docstring": "Decompose an observed time series into contributions from each component.\n\n  This method decomposes a time series according to the posterior represention\n  of a structural time series model. In particular, it:\n    - Computes the posterior marginal mean and covariances over the additive\n      model's latent space.\n    - Decomposes the latent posterior into the marginal blocks for each\n      model component.\n    - Maps the per-component latent posteriors back through each component's\n      observation model, to generate the time series modeled by that component.\n\n  Args:\n    model: An instance of `tfp.sts.Sum` representing a structural time series\n      model.\n    observed_time_series: `float` `Tensor` of shape\n      `batch_shape + [num_timesteps, 1]` (omitting the trailing unit dimension\n      is also supported when `num_timesteps > 1`), specifying an observed time\n      series. May optionally be an instance of `tfp.sts.MaskedTimeSeries`, which\n      includes a mask `Tensor` to specify timesteps with missing observations.\n    parameter_samples: Python `list` of `Tensors` representing posterior\n      samples of model parameters, with shapes `[concat([\n      [num_posterior_draws], param.prior.batch_shape,\n      param.prior.event_shape]) for param in model.parameters]`. This may\n      optionally also be a map (Python `dict`) of parameter names to\n      `Tensor` values.\n  Returns:\n    component_dists: A `collections.OrderedDict` instance mapping\n      component StructuralTimeSeries instances (elements of `model.components`)\n      to `tfd.Distribution` instances representing the posterior marginal\n      distributions on the process modeled by each component. Each distribution\n      has batch shape matching that of `posterior_means`/`posterior_covs`, and\n      event shape of `[num_timesteps]`.\n\n  #### Examples\n\n  Suppose we've built a model and fit it to data:\n\n  ```python\n    day_of_week = tfp.sts.Seasonal(\n        num_seasons=7,\n        observed_time_series=observed_time_series,\n        name='day_of_week')\n    local_linear_trend = tfp.sts.LocalLinearTrend(\n        observed_time_series=observed_time_series,\n        name='local_linear_trend')\n    model = tfp.sts.Sum(components=[day_of_week, local_linear_trend],\n                        observed_time_series=observed_time_series)\n\n    num_steps_forecast = 50\n    samples, kernel_results = tfp.sts.fit_with_hmc(model, observed_time_series)\n  ```\n\n  To extract the contributions of individual components, pass the time series\n  and sampled parameters into `decompose_by_component`:\n\n  ```python\n    component_dists = decompose_by_component(\n      model,\n      observed_time_series=observed_time_series,\n      parameter_samples=samples)\n\n    # Component mean and stddev have shape `[len(observed_time_series)]`.\n    day_of_week_effect_mean = component_dists[day_of_week].mean()\n    day_of_week_effect_stddev = component_dists[day_of_week].stddev()\n  ```\n\n  Using the component distributions, we can visualize the uncertainty for\n  each component:\n\n  ```\n  from matplotlib import pylab as plt\n  num_components = len(component_dists)\n  xs = np.arange(len(observed_time_series))\n  fig = plt.figure(figsize=(12, 3 * num_components))\n  for i, (component, component_dist) in enumerate(component_dists.items()):\n\n    # If in graph mode, replace `.numpy()` with `.eval()` or `sess.run()`.\n    component_mean = component_dist.mean().numpy()\n    component_stddev = component_dist.stddev().numpy()\n\n    ax = fig.add_subplot(num_components, 1, 1 + i)\n    ax.plot(xs, component_mean, lw=2)\n    ax.fill_between(xs,\n                    component_mean - 2 * component_stddev,\n                    component_mean + 2 * component_stddev,\n                    alpha=0.5)\n    ax.set_title(component.name)\n  ```", "docstring_tokens": ["Decompose", "an", "observed", "time", "series", "into", "contributions", "from", "each", "component", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255852}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/effects/registry.py#L116-L140", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Find an effect class by class name or full python path to class", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", "->", "Type", "[", "Effect", "]", ":", "arg_2", ",", "arg_3", "=", "parse_package_string", "(", "arg_1", ")", "if", "arg_2", ":", "arg_4", "=", "arg_0", ".", "get_package", "(", "arg_2", ")", "return", "arg_4", ".", "Func", "(", "arg_3", ",", "raise_for_error", "=", "True", ")", "for", "arg_4", "in", "arg_0", ".", "packages", ":", "arg_5", "=", "arg_4", ".", "Func", "(", "arg_3", ")", "if", "arg_5", ":", "return", "arg_5", "raise", "EffectError", "(", "\"No effect class '{}' found in any packages\"", ".", "format", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1) -> Type[Effect]:\n        \"\"\"\n        Find an effect class by class name or full python path to class\n\n        Args:\n            path (str): effect class name or full python path to effect class\n\n        Returns:\n            Effect class\n\n        Raises:\n            EffectError if no class is found\n        \"\"\"\n        arg_2, arg_3 = parse_package_string(arg_1)\n\n        if arg_2:\n            arg_4 = arg_0.get_package(arg_2)\n            return arg_4.Func(arg_3, raise_for_error=True)\n\n        for arg_4 in arg_0.packages:\n            arg_5 = arg_4.Func(arg_3)\n            if arg_5:\n                return arg_5\n\n        raise EffectError(\"No effect class '{}' found in any packages\".format(arg_3))", "path": "demosys/effects/registry.py", "identifier": "EffectRegistry.find_effect_class", "docstring": "Find an effect class by class name or full python path to class\n\n        Args:\n            path (str): effect class name or full python path to effect class\n\n        Returns:\n            Effect class\n\n        Raises:\n            EffectError if no class is found", "docstring_tokens": ["Find", "an", "effect", "class", "by", "class", "name", "or", "full", "python", "path", "to", "class"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 255853}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L507-L521", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return process bounds for zoom level.", "language": "python", "parameters": "(self, zoom=None)", "return_statement": "return () if self.area_at_zoom(zoom).is_empty else Bounds(\n            *self.area_at_zoom(zoom).bounds)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "(", ")", "if", "arg_0", ".", "area_at_zoom", "(", "arg_1", ")", ".", "is_empty", "else", "Bounds", "(", "*", "arg_0", ".", "area_at_zoom", "(", "arg_1", ")", ".", "bounds", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Return process bounds for zoom level.\n\n        Parameters\n        ----------\n        zoom : integer or list\n\n        Returns\n        -------\n        process bounds : tuple\n            left, bottom, right, top\n        \"\"\"\n        return () if arg_0.area_at_zoom(arg_1).is_empty else Bounds(\n            *arg_0.area_at_zoom(arg_1).bounds)", "path": "mapchete/config.py", "identifier": "MapcheteConfig.bounds_at_zoom", "docstring": "Return process bounds for zoom level.\n\n        Parameters\n        ----------\n        zoom : integer or list\n\n        Returns\n        -------\n        process bounds : tuple\n            left, bottom, right, top", "docstring_tokens": ["Return", "process", "bounds", "for", "zoom", "level", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 255854}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/beziereditor/__init__.py#L197-L204", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Calculates the angle between two points.", "language": "python", "parameters": "(self, x0, y0, x1, y1)", "return_statement": "return a", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "degrees", "(", "atan", "(", "(", "arg_4", "-", "arg_2", ")", "/", "(", "arg_3", "-", "arg_1", "+", "0.00001", ")", ")", ")", "+", "360", "if", "arg_3", "-", "arg_1", "<", "0", ":", "arg_5", "+=", "180", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \n        \"\"\" Calculates the Func between two points.\n        \"\"\"\n    \n        arg_5 = degrees( atan((arg_4-arg_2) / (arg_3-arg_1+0.00001)) ) + 360\n        if arg_3-arg_1 < 0: arg_5 += 180\n        return arg_5", "path": "lib/beziereditor/__init__.py", "identifier": "BezierPathEditor.angle", "docstring": "Calculates the angle between two points.", "docstring_tokens": ["Calculates", "the", "angle", "between", "two", "points", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255855}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_clean_html.py#L250-L262", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "This implements the MIME-type matching logic for deciding whether\n        to run `make_clean_html`", "language": "python", "parameters": "(self, mime_type)", "return_statement": "return any(mime_type.startswith(mt) for mt in self.include_mime_types)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_0", ".", "include_mime_types", ")", "==", "0", ":", "return", "True", "if", "arg_1", "is", "None", ":", "return", "False", "arg_1", "=", "arg_1", ".", "lower", "(", ")", "return", "any", "(", "arg_1", ".", "startswith", "(", "arg_2", ")", "for", "arg_2", "in", "arg_0", ".", "include_mime_types", ")"], "function": "def Func(arg_0, arg_1):\n        '''This implements the MIME-type matching logic for deciding whether\n        to run `make_clean_html`\n\n        '''\n        if len(arg_0.include_mime_types) == 0:\n            return True\n        if arg_1 is None:\n            return False\n        arg_1 = arg_1.lower()\n        # NB: startswith is necessary here, because encodings are\n        # often appended to HTTP header Content-Type\n        return any(arg_1.startswith(arg_2) for arg_2 in arg_0.include_mime_types)", "path": "streamcorpus_pipeline/_clean_html.py", "identifier": "clean_html.is_matching_mime_type", "docstring": "This implements the MIME-type matching logic for deciding whether\n        to run `make_clean_html`", "docstring_tokens": ["This", "implements", "the", "MIME", "-", "type", "matching", "logic", "for", "deciding", "whether", "to", "run", "make_clean_html"], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 255856}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/warnings.py#L41-L66", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Function to format a warning the standard way.", "language": "python", "parameters": "(message, category, filename, lineno, line=None)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "try", ":", "arg_5", "=", "unicode", "except", "NameError", ":", "arg_5", "=", "(", ")", "try", ":", "arg_0", "=", "str", "(", "arg_0", ")", "except", "UnicodeEncodeError", ":", "pass", "arg_6", "=", "\"%s: %s: %s\\n\"", "%", "(", "arg_3", ",", "arg_1", ".", "__name__", ",", "arg_0", ")", "arg_4", "=", "linecache", ".", "getline", "(", "arg_2", ",", "arg_3", ")", "if", "arg_4", "is", "None", "else", "arg_4", "if", "arg_4", ":", "arg_4", "=", "arg_4", ".", "strip", "(", ")", "if", "isinstance", "(", "arg_6", ",", "arg_5", ")", "and", "isinstance", "(", "arg_4", ",", "str", ")", ":", "arg_4", "=", "unicode", "(", "arg_4", ",", "'latin1'", ")", "arg_6", "+=", "\"  %s\\n\"", "%", "arg_4", "if", "isinstance", "(", "arg_6", ",", "arg_5", ")", "and", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_7", "=", "sys", ".", "getfilesystemencoding", "(", ")", "if", "arg_7", ":", "try", ":", "arg_2", "=", "unicode", "(", "arg_2", ",", "arg_7", ")", "except", "UnicodeDecodeError", ":", "pass", "arg_6", "=", "\"%s:%s\"", "%", "(", "arg_2", ",", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n    \"\"\"Function to format a warning the standard way.\"\"\"\n    try:\n        arg_5 = unicode\n    except NameError:\n        arg_5 = ()\n    try:\n        arg_0 = str(arg_0)\n    except UnicodeEncodeError:\n        pass\n    arg_6 =  \"%s: %s: %s\\n\" % (arg_3, arg_1.__name__, arg_0)\n    arg_4 = linecache.getline(arg_2, arg_3) if arg_4 is None else arg_4\n    if arg_4:\n        arg_4 = arg_4.strip()\n        if isinstance(arg_6, arg_5) and isinstance(arg_4, str):\n            arg_4 = unicode(arg_4, 'latin1')\n        arg_6 += \"  %s\\n\" % arg_4\n    if isinstance(arg_6, arg_5) and isinstance(arg_2, str):\n        arg_7 = sys.getfilesystemencoding()\n        if arg_7:\n            try:\n                arg_2 = unicode(arg_2, arg_7)\n            except UnicodeDecodeError:\n                pass\n    arg_6 = \"%s:%s\" % (arg_2, arg_6)\n    return arg_6", "path": "third_party/stdlib/warnings.py", "identifier": "formatwarning", "docstring": "Function to format a warning the standard way.", "docstring_tokens": ["Function", "to", "format", "a", "warning", "the", "standard", "way", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 255857}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-ui/vaex/ui/plot_windows.py#L121-L128", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "clear the cursor", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "useblit", ":", "arg_0", ".", "background", "=", "(", "arg_0", ".", "canvas", ".", "copy_from_bbox", "(", "arg_0", ".", "canvas", ".", "figure", ".", "bbox", ")", ")", "for", "arg_3", "in", "arg_0", ".", "vlines", "+", "arg_0", ".", "hlines", ":", "arg_3", ".", "set_visible", "(", "False", ")", "arg_0", ".", "ellipse", ".", "set_visible", "(", "False", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Func the cursor\"\"\"\n        if arg_0.useblit:\n            arg_0.background = (\n                arg_0.canvas.copy_from_bbox(arg_0.canvas.figure.bbox))\n        for arg_3 in arg_0.vlines + arg_0.hlines:\n            arg_3.set_visible(False)\n        arg_0.ellipse.set_visible(False)", "path": "packages/vaex-ui/vaex/ui/plot_windows.py", "identifier": "Slicer.clear", "docstring": "clear the cursor", "docstring_tokens": ["clear", "the", "cursor"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 255858}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/notification.py#L111-L133", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Add an observer callback to this notification center.", "language": "python", "parameters": "(self, callback, ntype, sender)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "assert", "(", "arg_1", "!=", "None", ")", "arg_0", ".", "registered_types", ".", "add", "(", "arg_2", ")", "arg_0", ".", "registered_senders", ".", "add", "(", "arg_3", ")", "arg_0", ".", "observers", ".", "setdefault", "(", "(", "arg_2", ",", "arg_3", ")", ",", "set", "(", ")", ")", ".", "add", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Add an observer callback to this notification center.\n\n        The given callback will be called upon posting of notifications of\n        the given type/sender and will receive any additional arguments passed\n        to post_notification.\n\n        Parameters\n        ----------\n        callback : callable\n            The callable that will be called by :meth:`post_notification`\n            as ``callback(ntype, sender, *args, **kwargs)\n        ntype : hashable\n            The notification type. If None, all notifications from sender\n            will be posted.\n        sender : hashable\n            The notification sender. If None, all notifications of ntype\n            will be posted.\n        \"\"\"\n        assert(arg_1 != None)\n        arg_0.registered_types.add(arg_2)\n        arg_0.registered_senders.add(arg_3)\n        arg_0.observers.setdefault((arg_2,arg_3), set()).add(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/utils/notification.py", "identifier": "NotificationCenter.add_observer", "docstring": "Add an observer callback to this notification center.\n\n        The given callback will be called upon posting of notifications of\n        the given type/sender and will receive any additional arguments passed\n        to post_notification.\n\n        Parameters\n        ----------\n        callback : callable\n            The callable that will be called by :meth:`post_notification`\n            as ``callback(ntype, sender, *args, **kwargs)\n        ntype : hashable\n            The notification type. If None, all notifications from sender\n            will be posted.\n        sender : hashable\n            The notification sender. If None, all notifications of ntype\n            will be posted.", "docstring_tokens": ["Add", "an", "observer", "callback", "to", "this", "notification", "center", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255859}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/megahit.py#L149-L174", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Removes whitespace from the assembly contig names", "language": "python", "parameters": "(asseembly_path)", "return_statement": "return fixed_assembly", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"fixed_assembly.fa\"", "with", "open", "(", "arg_0", ")", "as", "in_hf", ",", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "ou_fh", ":", "for", "arg_2", "in", "in_hf", ":", "if", "arg_2", ".", "startswith", "(", "\">\"", ")", ":", "arg_3", "=", "arg_2", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", "ou_fh", ".", "write", "(", "arg_3", ")", "else", ":", "ou_fh", ".", "write", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Removes whitespace from the assembly contig names\n\n    Parameters\n    ----------\n    asseembly_path : path to assembly file\n\n    Returns\n    -------\n    str:\n        Path to new assembly file with fixed contig names\n    \"\"\"\n\n    arg_1 = \"fixed_assembly.fa\"\n\n    with open(arg_0) as in_hf, open(arg_1, \"w\") as ou_fh:\n\n        for arg_2 in in_hf:\n\n            if arg_2.startswith(\">\"):\n                arg_3 = arg_2.replace(\" \", \"_\")\n                ou_fh.write(arg_3)\n            else:\n                ou_fh.write(arg_2)\n\n    return arg_1", "path": "flowcraft/templates/megahit.py", "identifier": "fix_contig_names", "docstring": "Removes whitespace from the assembly contig names\n\n    Parameters\n    ----------\n    asseembly_path : path to assembly file\n\n    Returns\n    -------\n    str:\n        Path to new assembly file with fixed contig names", "docstring_tokens": ["Removes", "whitespace", "from", "the", "assembly", "contig", "names"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 255860}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/agent/agent.py#L115-L149", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Compares initial security group rules with current sg rules.", "language": "python", "parameters": "(groups_to_ack, init_sg_states, curr_sg_states)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "arg_1", "[", "arg_4", "]", "[", "sg_cli", ".", "SECURITY_GROUP_HASH_ATTR", "]", "arg_6", "=", "arg_2", "[", "arg_4", "]", "[", "sg_cli", ".", "SECURITY_GROUP_HASH_ATTR", "]", "arg_7", "=", "(", "'security group rules were changed for vif \"%s\" while'", "' executing xapi_client.update_interfaces.'", "' Will not ack rule.'", "%", "arg_4", ")", "if", "len", "(", "arg_5", ")", "!=", "len", "(", "arg_6", ")", ":", "arg_3", ".", "append", "(", "arg_4", ")", "LOG", ".", "info", "(", "arg_7", ")", "elif", "len", "(", "arg_5", ")", ">", "0", ":", "for", "arg_8", "in", "arg_6", ":", "if", "arg_8", "not", "in", "arg_5", ":", "arg_3", ".", "append", "(", "arg_4", ")", "LOG", ".", "info", "(", "arg_7", ")", "break", "arg_9", "=", "[", "group", "for", "group", "in", "arg_0", "if", "group", "not", "in", "arg_3", "]", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Compares initial security group rules with current sg rules.\n\n    Given the groups that were successfully returned from\n        xapi_client.update_interfaces call, compare initial and current\n        security group rules to determine if an update occurred during\n        the window that the xapi_client.update_interfaces was executing.\n        Return a list of vifs whose security group rules have not changed.\n    \"\"\"\n    arg_3 = []\n    # Compare current security group rules with initial rules.\n    for arg_4 in arg_0:\n        arg_5 = arg_1[arg_4][sg_cli.SECURITY_GROUP_HASH_ATTR]\n        arg_6 = arg_2[arg_4][sg_cli.SECURITY_GROUP_HASH_ATTR]\n        arg_7 = ('security group rules were changed for vif \"%s\" while'\n                         ' executing xapi_client.update_interfaces.'\n                         ' Will not ack rule.' % arg_4)\n        # If lists are different lengths, they're automatically different.\n        if len(arg_5) != len(arg_6):\n            arg_3.append(arg_4)\n            LOG.info(arg_7)\n        elif len(arg_5) > 0:\n            # Compare rules in equal length lists.\n            for arg_8 in arg_6:\n                if arg_8 not in arg_5:\n                    arg_3.append(arg_4)\n                    LOG.info(arg_7)\n                    break\n\n    # Only ack groups whose rules have not changed since update. If\n    # rules do not match, do not add them to ret so the change\n    # can be picked up on the next cycle.\n    arg_9 = [group for group in arg_0\n           if group not in arg_3]\n    return arg_9", "path": "quark/agent/agent.py", "identifier": "get_groups_to_ack", "docstring": "Compares initial security group rules with current sg rules.\n\n    Given the groups that were successfully returned from\n        xapi_client.update_interfaces call, compare initial and current\n        security group rules to determine if an update occurred during\n        the window that the xapi_client.update_interfaces was executing.\n        Return a list of vifs whose security group rules have not changed.", "docstring_tokens": ["Compares", "initial", "security", "group", "rules", "with", "current", "sg", "rules", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 255861}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/term.py#L9-L15", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "Launch minterm from pyserial", "language": "python", "parameters": "(port=default_port(), baud='9600')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", "(", ")", ",", "arg_2", "=", "'9600'", ")", ":", "arg_3", "=", "[", "'nodemcu-uploader'", ",", "arg_0", ",", "arg_2", "]", "arg_4", ".", "argv", "=", "arg_3", "miniterm", ".", "main", "(", ")"], "function": "def Func(arg_0=arg_1(), arg_2='9600'):\n    \"\"\"Launch minterm from pyserial\"\"\"\n    arg_3 = ['nodemcu-uploader', arg_0, arg_2]\n    # TODO: modifying argv is no good\n    arg_4.argv = arg_3\n    # resuse miniterm on main function\n    miniterm.main()", "path": "nodemcu_uploader/term.py", "identifier": "terminal", "docstring": "Launch minterm from pyserial", "docstring_tokens": ["Launch", "minterm", "from", "pyserial"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 255862}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/cli/auth.py#L129-L138", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Prints information about the current user.", "language": "python", "parameters": "(user)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "[", "'email'", "]", "arg_2", "=", "arg_0", "[", "'account'", "]", "[", "'domain'", "]", "arg_3", "=", "arg_0", "[", "'role'", "]", "print", "(", "'You are logged-in to the \"{0}\" domain '", "'as {1} with role {2}.'", ".", "format", "(", "arg_2", ",", "arg_1", ",", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Prints information about the current user.\n    \"\"\"\n    arg_1 = arg_0['email']\n    arg_2 = arg_0['account']['domain']\n    arg_3 = arg_0['role']\n    print('You are logged-in to the \"{0}\" domain '\n          'as {1} with role {2}.'\n          .format(arg_2, arg_1, arg_3))", "path": "solvebio/cli/auth.py", "identifier": "print_user", "docstring": "Prints information about the current user.", "docstring_tokens": ["Prints", "information", "about", "the", "current", "user", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 255863}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/bibdocfile.py#L46-L53", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Get BibDocs for Invenio 2.", "language": "python", "parameters": "(from_date)", "return_statement": "return (id[0] for id in run_sql(\n        'select id_bibrec from '\n        'bibrec_bibdoc as r join bibdoc as d on r.id_bibdoc=d.id '\n        'where d.modification_date >=%s',\n        (from_date, ), run_on_slave=True))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "invenio", ".", "legacy", ".", "dbquery", "import", "run_sql", "return", "(", "arg_1", "[", "0", "]", "for", "arg_1", "in", "run_sql", "(", "'select id_bibrec from '", "'bibrec_bibdoc as r join bibdoc as d on r.id_bibdoc=d.id '", "'where d.modification_date >=%s'", ",", "(", "arg_0", ",", ")", ",", "run_on_slave", "=", "True", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Get BibDocs for Invenio 2.\"\"\"\n    from invenio.legacy.dbquery import run_sql\n    return (arg_1[0] for arg_1 in run_sql(\n        'select id_bibrec from '\n        'bibrec_bibdoc as r join bibdoc as d on r.id_bibdoc=d.id '\n        'where d.modification_date >=%s',\n        (arg_0, ), run_on_slave=True))", "path": "invenio_migrator/legacy/bibdocfile.py", "identifier": "_get_recids_invenio2", "docstring": "Get BibDocs for Invenio 2.", "docstring_tokens": ["Get", "BibDocs", "for", "Invenio", "2", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 255864}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Record.py#L39-L45", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Class method that will return a Record object by ID and the domain.", "language": "python", "parameters": "(cls, api_token, domain, record_id)", "return_statement": "return record", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", "(", "token", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "id", "=", "arg_3", ")", "arg_4", ".", "load", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n            Class method that will return a Record object by ID and the domain.\n        \"\"\"\n        arg_4 = arg_0(token=arg_1, arg_2=arg_2, id=arg_3)\n        arg_4.load()\n        return arg_4", "path": "digitalocean/Record.py", "identifier": "Record.get_object", "docstring": "Class method that will return a Record object by ID and the domain.", "docstring_tokens": ["Class", "method", "that", "will", "return", "a", "Record", "object", "by", "ID", "and", "the", "domain", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 255865}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py#L102-L111", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Generate a list of n random ports near the given port.", "language": "python", "parameters": "(port, n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "range", "(", "min", "(", "5", ",", "arg_1", ")", ")", ":", "yield", "arg_0", "+", "arg_2", "for", "arg_2", "in", "range", "(", "arg_1", "-", "5", ")", ":", "yield", "arg_0", "+", "random", ".", "randint", "(", "-", "2", "*", "arg_1", ",", "2", "*", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Generate a list of n random ports near the given port.\n\n    The first 5 ports will be sequential, and the remaining n-5 will be\n    randomly selected in the range [port-2*n, port+2*n].\n    \"\"\"\n    for arg_2 in range(min(5, arg_1)):\n        yield arg_0 + arg_2\n    for arg_2 in range(arg_1-5):\n        yield arg_0 + random.randint(-2*arg_1, 2*arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py", "identifier": "random_ports", "docstring": "Generate a list of n random ports near the given port.\n\n    The first 5 ports will be sequential, and the remaining n-5 will be\n    randomly selected in the range [port-2*n, port+2*n].", "docstring_tokens": ["Generate", "a", "list", "of", "n", "random", "ports", "near", "the", "given", "port", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255866}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L532-L538", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "h function is straight-line distance from a node's state to goal.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "arg_0", ".", "grapFunc", ",", "'locations'", ",", "None", ")", "if", "arg_2", ":", "return", "int", "(", "distance", "(", "arg_2", "[", "arg_1", ".", "state", "]", ",", "arg_2", "[", "arg_0", ".", "goal", "]", ")", ")", "else", ":", "return", "infinity"], "function": "def Func(arg_0, arg_1):\n        \"Func function is straigFunct-line distance from a node's state to goal.\"\n        arg_2 = getattr(arg_0.grapFunc, 'locations', None)\n        if arg_2:\n            return int(distance(arg_2[arg_1.state], arg_2[arg_0.goal]))\n        else:\n            return infinity", "path": "aima/search.py", "identifier": "GraphProblem.h", "docstring": "h function is straight-line distance from a node's state to goal.", "docstring_tokens": ["h", "function", "is", "straight", "-", "line", "distance", "from", "a", "node", "s", "state", "to", "goal", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 255867}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/consensus/base.py#L71-L93", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "Sign this with a private key", "language": "python", "parameters": "(self, privkey)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "v", ":", "raise", "InvalidSignature", "(", "\"already Funced\"", ")", "if", "arg_1", "in", "(", "0", ",", "''", ",", "'\\x00'", "*", "32", ")", ":", "raise", "InvalidSignature", "(", "\"Zero privkey cannot Func\"", ")", "arg_2", "=", "sha3", "(", "rlp", ".", "encode", "(", "arg_0", ",", "arg_0", ".", "__class__", ".", "exclude", "(", "[", "'v'", ",", "'r'", ",", "'s'", "]", ")", ")", ")", "if", "len", "(", "arg_1", ")", "==", "64", ":", "arg_1", "=", "encode_privkey", "(", "arg_1", ",", "'bin'", ")", "arg_3", "=", "PrivateKey", "(", "arg_1", ",", "raw", "=", "True", ")", "arg_4", "=", "arg_3", ".", "ecdsa_recoverable_serialize", "(", "arg_3", ".", "ecdsa_Func_recoverable", "(", "arg_2", ",", "raw", "=", "True", ")", ")", "arg_4", "=", "arg_4", "[", "0", "]", "+", "chr", "(", "arg_4", "[", "1", "]", ")", "arg_0", ".", "v", "=", "ord", "(", "arg_4", "[", "64", "]", ")", "+", "27", "arg_0", ".", "r", "=", "big_endian_to_int", "(", "arg_4", "[", "0", ":", "32", "]", ")", "arg_0", ".", "s", "=", "big_endian_to_int", "(", "arg_4", "[", "32", ":", "64", "]", ")", "arg_0", ".", "_sender", "=", "None", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Sign this with a private key\"\"\"\n        if arg_0.v:\n            raise InvalidSignature(\"already Funced\")\n\n        if arg_1 in (0, '', '\\x00' * 32):\n            raise InvalidSignature(\"Zero privkey cannot Func\")\n        arg_2 = sha3(rlp.encode(arg_0, arg_0.__class__.exclude(['v', 'r', 's'])))\n\n        if len(arg_1) == 64:\n            arg_1 = encode_privkey(arg_1, 'bin')\n\n        arg_3 = PrivateKey(arg_1, raw=True)\n        arg_4 = arg_3.ecdsa_recoverable_serialize(arg_3.ecdsa_Func_recoverable(arg_2, raw=True))\n\n        arg_4 = arg_4[0] + chr(arg_4[1])\n\n        arg_0.v = ord(arg_4[64]) + 27\n        arg_0.r = big_endian_to_int(arg_4[0:32])\n        arg_0.s = big_endian_to_int(arg_4[32:64])\n\n        arg_0._sender = None\n        return arg_0", "path": "hydrachain/consensus/base.py", "identifier": "Signed.sign", "docstring": "Sign this with a private key", "docstring_tokens": ["Sign", "this", "with", "a", "private", "key"], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 255868}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/trimmomatic_report.py#L164-L185", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Main executor of the trimmomatic_report template.", "language": "python", "parameters": "(log_files)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "OrderedDict", "(", ")", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "arg_2", ".", "rstrip", "(", "\"_trimlog.txt\"", ")", "arg_1", "[", "arg_3", "]", "=", "parse_log", "(", "arg_2", ")", "os", ".", "remove", "(", "arg_2", ")", "write_report", "(", "arg_1", ",", "\"trimmomatic_report.csv\"", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\" Main executor of the trimmomatic_report template.\n\n    Parameters\n    ----------\n    log_files : list\n        List of paths to the trimmomatic log files.\n    \"\"\"\n\n    arg_1 = OrderedDict()\n\n    for arg_2 in arg_0:\n\n        arg_3 = arg_2.rstrip(\"_trimlog.txt\")\n\n        # Populate storage of current sample\n        arg_1[arg_3] = parse_log(arg_2)\n\n        # Remove temporary trim log file\n        os.remove(arg_2)\n\n    write_report(arg_1, \"trimmomatic_report.csv\", arg_3)", "path": "flowcraft/templates/trimmomatic_report.py", "identifier": "main", "docstring": "Main executor of the trimmomatic_report template.\n\n    Parameters\n    ----------\n    log_files : list\n        List of paths to the trimmomatic log files.", "docstring_tokens": ["Main", "executor", "of", "the", "trimmomatic_report", "template", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 255869}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L243-L290", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Make a GET request using the session object to a SuccessFactors endpoint for inactive learners.", "language": "python", "parameters": "(self)", "return_statement": "return all_inactive_learners", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "if", "arg_1", ">=", "arg_0", ".", "expires_at", ":", "arg_0", ".", "session", ".", "close", "(", ")", "arg_0", ".", "_create_session", "(", ")", "arg_2", "=", "'{sapsf_base_url}/{search_students_path}?$filter={search_filter}'", ".", "format", "(", "sapsf_base_url", "=", "arg_0", ".", "enterprise_configuration", ".", "sapsf_base_url", ".", "rstrip", "(", "'/'", ")", ",", "search_students_path", "=", "arg_0", ".", "global_sap_config", ".", "search_student_api_path", ".", "rstrip", "(", "'/'", ")", ",", "search_filter", "=", "'criteria/isActive eq False&$select=studentID'", ",", ")", "arg_3", "=", "arg_0", ".", "_call_search_students_recursively", "(", "arg_2", ",", "arg_3", "=", "[", "]", ",", "page_size", "=", "500", ",", "start_at", "=", "0", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Make a GET request using the session object to a SuccessFactors endpoint for inactive learners.\n\n        Example:\n            sap_search_student_url: \"/learning/odatav4/searchStudent/v1/Students?\n                $filter=criteria/isActive eq False&$select=studentID\"\n\n            SAP API response: {\n                u'@odata.metadataEtag': u'W/\"17090d86-20fa-49c8-8de0-de1d308c8b55\"',\n                u'value': [\n                    {\n                        u'studentID': u'admint6',\n                    },\n                    {\n                        u'studentID': u'adminsap1',\n                    }\n                ]\n            }\n\n        Returns: List of inactive learners\n        [\n            {\n                u'studentID': u'admint6'\n            },\n            {\n                u'studentID': u'adminsap1'\n            }\n        ]\n        \"\"\"\n        arg_1 = datetime.datetime.utcnow()\n        if arg_1 >= arg_0.expires_at:\n            # Create a new session with a valid token\n            arg_0.session.close()\n            arg_0._create_session()\n\n        arg_2 = '{sapsf_base_url}/{search_students_path}?$filter={search_filter}'.format(\n            sapsf_base_url=arg_0.enterprise_configuration.sapsf_base_url.rstrip('/'),\n            search_students_path=arg_0.global_sap_config.search_student_api_path.rstrip('/'),\n            search_filter='criteria/isActive eq False&$select=studentID',\n        )\n        arg_3 = arg_0._call_search_students_recursively(\n            arg_2,\n            arg_3=[],\n            page_size=500,\n            start_at=0\n        )\n        return arg_3", "path": "integrated_channels/sap_success_factors/client.py", "identifier": "SAPSuccessFactorsAPIClient.get_inactive_sap_learners", "docstring": "Make a GET request using the session object to a SuccessFactors endpoint for inactive learners.\n\n        Example:\n            sap_search_student_url: \"/learning/odatav4/searchStudent/v1/Students?\n                $filter=criteria/isActive eq False&$select=studentID\"\n\n            SAP API response: {\n                u'@odata.metadataEtag': u'W/\"17090d86-20fa-49c8-8de0-de1d308c8b55\"',\n                u'value': [\n                    {\n                        u'studentID': u'admint6',\n                    },\n                    {\n                        u'studentID': u'adminsap1',\n                    }\n                ]\n            }\n\n        Returns: List of inactive learners\n        [\n            {\n                u'studentID': u'admint6'\n            },\n            {\n                u'studentID': u'adminsap1'\n            }\n        ]", "docstring_tokens": ["Make", "a", "GET", "request", "using", "the", "session", "object", "to", "a", "SuccessFactors", "endpoint", "for", "inactive", "learners", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 255870}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/admin.py#L264-L276", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Saves TreeItem model under certain Tree.\n        Handles item's parent assignment exception.", "language": "python", "parameters": "(self, request, obj, form, change)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_4", ":", "if", "arg_2", ".", "parent", "is", "not", "None", "and", "arg_2", ".", "parent", ".", "id", "==", "arg_2", ".", "id", ":", "arg_2", ".", "parent", "=", "arg_0", ".", "previous_parent", "messages", ".", "warning", "(", "arg_1", ",", "_", "(", "\"Item's parent left unchanged. Item couldn't be parent to itself.\"", ")", ",", "''", ",", "True", ")", "arg_2", ".", "tree", "=", "arg_0", ".", "tree", "arg_2", ".", "save", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Saves TreeItem model under certain Tree.\n        Handles item's parent assignment exception.\n\n        \"\"\"\n        if arg_4:\n            # No, you're not allowed to make item parent of itself\n            if arg_2.parent is not None and arg_2.parent.id == arg_2.id:\n                arg_2.parent = arg_0.previous_parent\n                messages.warning(\n                    arg_1, _(\"Item's parent left unchanged. Item couldn't be parent to itself.\"), '', True)\n        arg_2.tree = arg_0.tree\n        arg_2.save()", "path": "sitetree/admin.py", "identifier": "TreeItemAdmin.save_model", "docstring": "Saves TreeItem model under certain Tree.\n        Handles item's parent assignment exception.", "docstring_tokens": ["Saves", "TreeItem", "model", "under", "certain", "Tree", ".", "Handles", "item", "s", "parent", "assignment", "exception", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 255871}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/contours.py#L6-L55", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Extract contour lines from an array.", "language": "python", "parameters": "(array, tile, interval=100, field='elev', base=0)", "return_statement": "return out_contours", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "100", ",", "arg_3", "=", "'elev'", ",", "arg_4", "=", "0", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "arg_5", "=", "_get_contour_values", "(", "arg_0", ".", "min", "(", ")", ",", "arg_0", ".", "max", "(", ")", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ")", "if", "not", "arg_5", ":", "return", "[", "]", "arg_6", "=", "plt", ".", "contour", "(", "arg_0", ",", "arg_5", ")", "arg_7", "=", "0", "arg_8", "=", "[", "]", "for", "arg_9", "in", "range", "(", "len", "(", "arg_6", ".", "collections", ")", ")", ":", "arg_10", "=", "arg_5", "[", "arg_7", "]", "arg_7", "+=", "1", "arg_11", "=", "arg_6", ".", "collections", "[", "arg_9", "]", ".", "get_paths", "(", ")", "for", "arg_12", "in", "arg_11", ":", "arg_13", "=", "[", "(", "arg_1", ".", "left", "+", "(", "y", "*", "arg_1", ".", "pixel_x_size", ")", ",", "arg_1", ".", "top", "-", "(", "x", "*", "arg_1", ".", "pixel_y_size", ")", ",", ")", "for", "x", ",", "y", "in", "zip", "(", "arg_12", ".", "vertices", "[", ":", ",", "1", "]", ",", "arg_12", ".", "vertices", "[", ":", ",", "0", "]", ")", "]", "if", "len", "(", "arg_13", ")", ">=", "2", ":", "arg_8", ".", "append", "(", "dict", "(", "properties", "=", "{", "arg_3", ":", "arg_10", "}", ",", "geometry", "=", "mapping", "(", "LineString", "(", "arg_13", ")", ")", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=100, arg_3='elev', arg_4=0):\n    \"\"\"\n    Extract contour lines from an array.\n\n    Parameters\n    ----------\n    array : array\n        input elevation data\n    tile : Tile\n        tile covering the array\n    interval : integer\n        elevation value interval when drawing contour lines\n    field : string\n        output field name containing elevation value\n    base : integer\n        elevation base value the intervals are computed from\n\n    Returns\n    -------\n    contours : iterable\n        contours as GeoJSON-like pairs of properties and geometry\n    \"\"\"\n    import matplotlib.pyplot as plt\n    arg_5 = _get_contour_values(\n        arg_0.min(), arg_0.max(), arg_2=arg_2, arg_4=arg_4)\n    if not arg_5:\n        return []\n    arg_6 = plt.contour(arg_0, arg_5)\n    arg_7 = 0\n    arg_8 = []\n    for arg_9 in range(len(arg_6.collections)):\n        arg_10 = arg_5[arg_7]\n        arg_7 += 1\n        arg_11 = arg_6.collections[arg_9].get_paths()\n        for arg_12 in arg_11:\n            arg_13 = [\n                (\n                    arg_1.left + (y * arg_1.pixel_x_size),\n                    arg_1.top - (x * arg_1.pixel_y_size),\n                )\n                for x, y in zip(arg_12.vertices[:, 1], arg_12.vertices[:, 0])\n            ]\n            if len(arg_13) >= 2:\n                arg_8.append(\n                    dict(\n                        properties={arg_3: arg_10},\n                        geometry=mapping(LineString(arg_13))\n                    )\n                )\n    return arg_8", "path": "mapchete/commons/contours.py", "identifier": "extract_contours", "docstring": "Extract contour lines from an array.\n\n    Parameters\n    ----------\n    array : array\n        input elevation data\n    tile : Tile\n        tile covering the array\n    interval : integer\n        elevation value interval when drawing contour lines\n    field : string\n        output field name containing elevation value\n    base : integer\n        elevation base value the intervals are computed from\n\n    Returns\n    -------\n    contours : iterable\n        contours as GeoJSON-like pairs of properties and geometry", "docstring_tokens": ["Extract", "contour", "lines", "from", "an", "array", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 255872}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L665-L675", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Call the configuration hook for plugins", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "_dynamic_plugins", ":", "arg_2", "=", "modutils", ".", "load_module_from_name", "(", "arg_1", ")", "if", "hasattr", "(", "arg_2", ",", "\"load_configuration\"", ")", ":", "arg_2", ".", "load_configuration", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"Call the configuration hook for plugins\n\n        This walks through the list of plugins, grabs the \"load_configuration\"\n        hook, if exposed, and calls it to allow plugins to configure specific\n        settings.\n        \"\"\"\n        for arg_1 in arg_0._dynamic_plugins:\n            arg_2 = modutils.load_module_from_name(arg_1)\n            if hasattr(arg_2, \"load_configuration\"):\n                arg_2.load_configuration(arg_0)", "path": "pylint/lint.py", "identifier": "PyLinter.load_plugin_configuration", "docstring": "Call the configuration hook for plugins\n\n        This walks through the list of plugins, grabs the \"load_configuration\"\n        hook, if exposed, and calls it to allow plugins to configure specific\n        settings.", "docstring_tokens": ["Call", "the", "configuration", "hook", "for", "plugins"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255873}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/metrics/log_loss.py#L25-L37", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Calculates log loss.", "language": "python", "parameters": "(y_true: Union[List[List[float]], List[List[int]], np.ndarray],\n                y_predicted: Union[List[List[float]], List[List[int]], np.ndarray])", "return_statement": "return log_loss(y_true, y_predicted)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "[", "arg_2", "[", "arg_3", "]", "]", ",", "arg_2", "[", "arg_2", "[", "arg_4", "]", "]", ",", "arg_5", ".", "ndarray", "]", ",", "arg_7", ":", "arg_1", "[", "arg_2", "[", "arg_2", "[", "arg_3", "]", "]", ",", "arg_2", "[", "arg_2", "[", "arg_4", "]", "]", ",", "arg_5", ".", "ndarray", "]", ")", "->", "arg_3", ":", "return", "log_loss", "(", "arg_0", ",", "arg_7", ")"], "function": "def Func(arg_0: arg_1[arg_2[arg_2[arg_3]], arg_2[arg_2[arg_4]], arg_5.ndarray],\n                arg_7: arg_1[arg_2[arg_2[arg_3]], arg_2[arg_2[arg_4]], arg_5.ndarray]) -> arg_3:\n    \"\"\"\n    Calculates log loss.\n\n    Args:\n        y_true: list or array of true values\n        y_predicted: list or array of predicted values\n\n    Returns:\n        Log loss\n    \"\"\"\n    return log_loss(arg_0, arg_7)", "path": "deeppavlov/metrics/log_loss.py", "identifier": "sk_log_loss", "docstring": "Calculates log loss.\n\n    Args:\n        y_true: list or array of true values\n        y_predicted: list or array of predicted values\n\n    Returns:\n        Log loss", "docstring_tokens": ["Calculates", "log", "loss", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255874}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L600-L625", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the pull requests from the repository.", "language": "python", "parameters": "(self, from_date=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "issues", "(", "arg_1", "=", "arg_1", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "json", ".", "loads", "(", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "if", "\"pull_request\"", "not", "in", "arg_5", ":", "continue", "arg_6", "=", "arg_5", "[", "\"number\"", "]", "arg_7", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "'repos'", ",", "arg_0", ".", "owner", ",", "arg_0", ".", "repository", ",", "\"Func\"", ",", "arg_6", ")", "arg_8", "=", "arg_0", ".", "fetch", "(", "arg_7", ")", "arg_9", "=", "arg_8", ".", "text", "yield", "arg_9"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Fetch the pull requests from the repository.\n\n        The method retrieves, from a GitHub repository, the pull requests\n        updated since the given date.\n\n        :param from_date: obtain pull requests updated since this date\n\n        :returns: a generator of pull requests\n        \"\"\"\n        arg_2 = arg_0.issues(arg_1=arg_1)\n\n        for arg_3 in arg_2:\n            arg_4 = json.loads(arg_3)\n            for arg_5 in arg_4:\n\n                if \"pull_request\" not in arg_5:\n                    continue\n\n                arg_6 = arg_5[\"number\"]\n                arg_7 = urijoin(arg_0.base_url, 'repos', arg_0.owner, arg_0.repository, \"Func\", arg_6)\n\n                arg_8 = arg_0.fetch(arg_7)\n                arg_9 = arg_8.text\n\n                yield arg_9", "path": "perceval/backends/core/github.py", "identifier": "GitHubClient.pulls", "docstring": "Fetch the pull requests from the repository.\n\n        The method retrieves, from a GitHub repository, the pull requests\n        updated since the given date.\n\n        :param from_date: obtain pull requests updated since this date\n\n        :returns: a generator of pull requests", "docstring_tokens": ["Fetch", "the", "pull", "requests", "from", "the", "repository", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255875}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/aio/async_receive_handler.py#L539-L559", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Set the session state.", "language": "python", "parameters": "(self, state)", "return_statement": "return await self._mgmt_request_response(\n            REQUEST_RESPONSE_SET_SESSION_STATE_OPERATION,\n            {'session-id': self.session_id, 'session-state': bytearray(state)},\n            mgmt_handlers.default)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "await", "arg_0", ".", "_can_run", "(", ")", "arg_1", "=", "arg_1", ".", "encode", "(", "arg_0", ".", "encoding", ")", "if", "isinstance", "(", "arg_1", ",", "six", ".", "text_type", ")", "else", "arg_1", "return", "await", "arg_0", ".", "_mgmt_request_response", "(", "REQUEST_RESPONSE_SET_SESSION_STATE_OPERATION", ",", "{", "'session-id'", ":", "arg_0", ".", "session_id", ",", "'session-state'", ":", "bytearray", "(", "arg_1", ")", "}", ",", "mgmt_handlers", ".", "default", ")"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Set the session state.\n\n        :param state: The state value.\n        :type state: str or bytes or bytearray\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START Func]\n                :end-before: [END Func]\n                :language: python\n                :dedent: 4\n                :caption: Getting and setting the state of a session.\n\n        \"\"\"\n        await arg_0._can_run()\n        arg_1 = arg_1.encode(arg_0.encoding) if isinstance(arg_1, six.text_type) else arg_1\n        return await arg_0._mgmt_request_response(\n            REQUEST_RESPONSE_SET_SESSION_STATE_OPERATION,\n            {'session-id': arg_0.session_id, 'session-state': bytearray(arg_1)},\n            mgmt_handlers.default)", "path": "azure-servicebus/azure/servicebus/aio/async_receive_handler.py", "identifier": "SessionReceiver.set_session_state", "docstring": "Set the session state.\n\n        :param state: The state value.\n        :type state: str or bytes or bytearray\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START set_session_state]\n                :end-before: [END set_session_state]\n                :language: python\n                :dedent: 4\n                :caption: Getting and setting the state of a session.", "docstring_tokens": ["Set", "the", "session", "state", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 255876}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/demo.py#L354-L381", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Edit a block.", "language": "python", "parameters": "(self,index=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_0", ".", "_get_index", "(", "arg_1", ")", "if", "arg_1", "is", "None", ":", "return", "if", "arg_1", ">", "0", ":", "arg_1", "-=", "1", "arg_2", "=", "arg_0", ".", "shell", ".", "mktempfile", "(", "arg_0", ".", "src_blocks", "[", "arg_1", "]", ")", "arg_0", ".", "shell", ".", "hooks", ".", "Funcor", "(", "arg_2", ",", "1", ")", "arg_3", "=", "file_read", "(", "arg_2", ")", "arg_0", ".", "src_blocks", "[", "arg_1", "]", "=", "arg_3", "arg_0", ".", "src_blocks_colored", "[", "arg_1", "]", "=", "arg_0", ".", "ip_colorize", "(", "arg_3", ")", "arg_0", ".", "block_index", "=", "arg_1", "arg_0", "(", ")"], "function": "def Func(arg_0,arg_1=None):\n        \"\"\"Edit a block.\n\n        If no number is given, use the last block executed.\n\n        This Funcs the in-memory copy of the demo, it does NOT modify the\n        original source file.  If you want to do that, simply open the file in\n        an Funcor and use reload() when you make changes to the file.  This\n        method is meant to let you change a block during a demonstration for\n        explanatory purposes, without damaging your original script.\"\"\"\n\n        arg_1 = arg_0._get_index(arg_1)\n        if arg_1 is None:\n            return\n        # decrease the index by one (unless we're at the very beginning), so\n        # that the default demo.Func() call opens up the sblock we've last run\n        if arg_1>0:\n            arg_1 -= 1\n\n        arg_2 = arg_0.shell.mktempfile(arg_0.src_blocks[arg_1])\n        arg_0.shell.hooks.Funcor(arg_2,1)\n        arg_3 = file_read(arg_2)\n        # update the source and colored block\n        arg_0.src_blocks[arg_1] = arg_3\n        arg_0.src_blocks_colored[arg_1] = arg_0.ip_colorize(arg_3)\n        arg_0.block_index = arg_1\n        # call to run with the newly Funced index\n        arg_0()", "path": "environment/lib/python2.7/site-packages/IPython/lib/demo.py", "identifier": "Demo.edit", "docstring": "Edit a block.\n\n        If no number is given, use the last block executed.\n\n        This edits the in-memory copy of the demo, it does NOT modify the\n        original source file.  If you want to do that, simply open the file in\n        an editor and use reload() when you make changes to the file.  This\n        method is meant to let you change a block during a demonstration for\n        explanatory purposes, without damaging your original script.", "docstring_tokens": ["Edit", "a", "block", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255877}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/serialization.py#L107-L128", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "Serialize a dataframe.", "language": "python", "parameters": "(writer, data_type_id, dataframe)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "_not_none", "(", "'writer'", ",", "arg_0", ")", "_not_none_or_empty", "(", "'data_type_id'", ",", "arg_1", ")", "_not_none", "(", "'dataframe'", ",", "arg_2", ")", "arg_3", "=", "_SERIALIZERS", ".", "get", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "raise", "UnsupportedDatasetTypeError", "(", "arg_1", ")", "arg_3", "[", "0", "]", "(", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Serialize a dataframe.\n\n    Parameters\n    ----------\n    writer : file\n        File-like object to write to. Must be opened in binary mode.\n    data_type_id : dict\n        Serialization format to use.\n        See the azureml.DataTypeIds class for constants.\n    dataframe: pandas.DataFrame\n        Dataframe to serialize.\n    \"\"\"\n    _not_none('writer', arg_0)\n    _not_none_or_empty('data_type_id', arg_1)\n    _not_none('dataframe', arg_2)\n\n    arg_3 = _SERIALIZERS.get(arg_1)\n    if arg_3 is None:\n        raise UnsupportedDatasetTypeError(arg_1)\n    arg_3[0](arg_0=arg_0, arg_2=arg_2)", "path": "azureml/serialization.py", "identifier": "serialize_dataframe", "docstring": "Serialize a dataframe.\n\n    Parameters\n    ----------\n    writer : file\n        File-like object to write to. Must be opened in binary mode.\n    data_type_id : dict\n        Serialization format to use.\n        See the azureml.DataTypeIds class for constants.\n    dataframe: pandas.DataFrame\n        Dataframe to serialize.", "docstring_tokens": ["Serialize", "a", "dataframe", "."], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 255878}
{"url": "https://github.com/MycroftAI/padatious/blob/794a2530d6079bdd06e193edd0d30b2cc793e631/padatious/intent_container.py#L86-L102", "sha": "794a2530d6079bdd06e193edd0d30b2cc793e631", "docstring_summary": "Adds an entity that matches the given lines.", "language": "python", "parameters": "(self, name, lines, reload_cache=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "Entity", ".", "verify_name", "(", "arg_1", ")", "arg_0", ".", "entities", ".", "add", "(", "Entity", ".", "wrap_name", "(", "arg_1", ")", ",", "arg_2", ",", "arg_3", ")", "arg_0", ".", "padaos", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "must_train", "=", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"\n        Adds an entity that matches the given lines.\n\n        Example:\n            self.add_intent('weather', ['will it rain on {weekday}?'])\n            self.Func('{weekday}', ['monday', 'tuesday', 'wednesday'])  # ...\n\n        Args:\n            name (str): The name of the entity\n            lines (list<str>): Lines of example extracted entities\n            reload_cache (bool): Whether to refresh all of cache\n        \"\"\"\n        Entity.verify_name(arg_1)\n        arg_0.entities.add(Entity.wrap_name(arg_1), arg_2, arg_3)\n        arg_0.padaos.Func(arg_1, arg_2)\n        arg_0.must_train = True", "path": "padatious/intent_container.py", "identifier": "IntentContainer.add_entity", "docstring": "Adds an entity that matches the given lines.\n\n        Example:\n            self.add_intent('weather', ['will it rain on {weekday}?'])\n            self.add_entity('{weekday}', ['monday', 'tuesday', 'wednesday'])  # ...\n\n        Args:\n            name (str): The name of the entity\n            lines (list<str>): Lines of example extracted entities\n            reload_cache (bool): Whether to refresh all of cache", "docstring_tokens": ["Adds", "an", "entity", "that", "matches", "the", "given", "lines", "."], "nwo": "MycroftAI/padatious", "score": 0.4588892726323654, "idx": 255879}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/optics/base.py#L242-L257", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Returns a class representing the 'kind' of optic.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "Equality", ",", "Isomorphism", ",", "Prism", ",", "Review", ",", "Lens", ",", "Traversal", ",", "Getter", ",", "Setter", ",", "Fold", ",", "]", "for", "arg_2", "in", "arg_1", ":", "if", "arg_0", ".", "_is_Func", "(", "arg_2", ")", ":", "return", "arg_2"], "function": "def Func(arg_0):\n        '''Returns a class representing the 'Func' of optic.'''\n        arg_1 = [\n            Equality,\n            Isomorphism,\n            Prism,\n            Review,\n            Lens,\n            Traversal,\n            Getter,\n            Setter,\n            Fold,\n        ]\n        for arg_2 in arg_1:\n            if arg_0._is_Func(arg_2):\n                return arg_2", "path": "lenses/optics/base.py", "identifier": "LensLike.kind", "docstring": "Returns a class representing the 'kind' of optic.", "docstring_tokens": ["Returns", "a", "class", "representing", "the", "kind", "of", "optic", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 255880}
{"url": "https://github.com/Crypto-toolbox/btfxwss/blob/16827fa6aacb2c0e289aa852bf61a18df6905835/btfxwss/queue_processor.py#L217-L229", "sha": "16827fa6aacb2c0e289aa852bf61a18df6905835", "docstring_summary": "Updates the timestamp for the given channel id.", "language": "python", "parameters": "(self, chan_id, ts)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_0", ".", "last_update", "[", "arg_1", "]", "=", "arg_2", "except", "KeyError", ":", "arg_0", ".", "log", ".", "warning", "(", "\"Attempted ts update of channel %s, but channel \"", "\"not present anymore.\"", ",", "arg_0", ".", "channel_directory", "[", "arg_1", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Updates the timestamp for the given channel id.\n\n        :param chan_id:\n        :param ts:\n        :return:\n        \"\"\"\n        try:\n            arg_0.last_update[arg_1] = arg_2\n        except KeyError:\n            arg_0.log.warning(\"Attempted ts update of channel %s, but channel \"\n                             \"not present anymore.\",\n                             arg_0.channel_directory[arg_1])", "path": "btfxwss/queue_processor.py", "identifier": "QueueProcessor.update_timestamps", "docstring": "Updates the timestamp for the given channel id.\n\n        :param chan_id:\n        :param ts:\n        :return:", "docstring_tokens": ["Updates", "the", "timestamp", "for", "the", "given", "channel", "id", "."], "nwo": "Crypto-toolbox/btfxwss", "score": 0.6139886433376424, "idx": 255881}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1245-L1268", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Look for removed attributes", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "attrname", "==", "\"xreadlines\"", ":", "arg_0", ".", "add_message", "(", "\"xreadlines-attribute\"", ",", "arg_1", "=", "arg_1", ")", "return", "arg_2", "=", "\"message\"", "try", ":", "for", "arg_3", "in", "arg_1", ".", "expr", ".", "infer", "(", ")", ":", "if", "isinstance", "(", "arg_3", ",", "astroid", ".", "Instance", ")", "and", "utils", ".", "inherit_from_std_ex", "(", "arg_3", ")", ":", "if", "arg_1", ".", "attrname", "==", "arg_2", ":", "if", "arg_2", "in", "arg_3", ".", "instance_attrs", ":", "continue", "arg_0", ".", "add_message", "(", "\"exception-message-attribute\"", ",", "arg_1", "=", "arg_1", ")", "if", "isinstance", "(", "arg_3", ",", "astroid", ".", "Module", ")", ":", "arg_0", ".", "_warn_if_deprecated", "(", "arg_1", ",", "arg_3", ".", "name", ",", "{", "arg_1", ".", "attrname", "}", ",", "report_on_modules", "=", "False", ")", "except", "astroid", ".", "InferenceError", ":", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Look for removed attributes\"\"\"\n        if arg_1.attrname == \"xreadlines\":\n            arg_0.add_message(\"xreadlines-attribute\", arg_1=arg_1)\n            return\n\n        arg_2 = \"message\"\n        try:\n            for arg_3 in arg_1.expr.infer():\n                if isinstance(arg_3, astroid.Instance) and utils.inherit_from_std_ex(\n                    arg_3\n                ):\n                    if arg_1.attrname == arg_2:\n\n                        # Exceptions with .message clearly defined are an exception\n                        if arg_2 in arg_3.instance_attrs:\n                            continue\n                        arg_0.add_message(\"exception-message-attribute\", arg_1=arg_1)\n                if isinstance(arg_3, astroid.Module):\n                    arg_0._warn_if_deprecated(\n                        arg_1, arg_3.name, {arg_1.attrname}, report_on_modules=False\n                    )\n        except astroid.InferenceError:\n            return", "path": "pylint/checkers/python3.py", "identifier": "Python3Checker.visit_attribute", "docstring": "Look for removed attributes", "docstring_tokens": ["Look", "for", "removed", "attributes"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 255882}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/volume.py#L1025-L1083", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate low-pressure liquid molar volume at tempearture\n        `T` with a given method.", "language": "python", "parameters": "(self, T, method)", "return_statement": "return Vm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "RACKETT", ":", "arg_3", "=", "Rackett", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "Zc", ")", "elif", "arg_2", "==", "YAMADA_GUNN", ":", "arg_3", "=", "Yamada_Gunn", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "omega", ")", "elif", "arg_2", "==", "BHIRUD_NORMAL", ":", "arg_3", "=", "Bhirud_normal", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "omega", ")", "elif", "arg_2", "==", "TOWNSEND_HALES", ":", "arg_3", "=", "Townsend_Hales", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Vc", ",", "arg_0", ".", "omega", ")", "elif", "arg_2", "==", "HTCOSTALD", ":", "arg_3", "=", "COSTALD", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Vc", ",", "arg_0", ".", "omega", ")", "elif", "arg_2", "==", "YEN_WOODS_SAT", ":", "arg_3", "=", "Yen_Woods_saturation", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Vc", ",", "arg_0", ".", "Zc", ")", "elif", "arg_2", "==", "MMSNM0", ":", "arg_3", "=", "SNM0", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Vc", ",", "arg_0", ".", "omega", ")", "elif", "arg_2", "==", "MMSNM0FIT", ":", "arg_3", "=", "SNM0", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Vc", ",", "arg_0", ".", "omega", ",", "arg_0", ".", "SNM0_delta_SRK", ")", "elif", "arg_2", "==", "CAMPBELL_THODOS", ":", "arg_3", "=", "Campbell_Thodos", "(", "arg_1", ",", "arg_0", ".", "Tb", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "MW", ",", "arg_0", ".", "dipole", ")", "elif", "arg_2", "==", "HTCOSTALDFIT", ":", "arg_3", "=", "COSTALD", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "COSTALD_Vchar", ",", "arg_0", ".", "COSTALD_omega_SRK", ")", "elif", "arg_2", "==", "RACKETTFIT", ":", "arg_3", "=", "Rackett", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "RACKETT_Z_RA", ")", "elif", "arg_2", "==", "PERRYDIPPR", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_0", ".", "DIPPR_coeffs", "arg_3", "=", "1.", "/", "EQ105", "(", "arg_1", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "elif", "arg_2", "==", "CRC_INORG_L", ":", "arg_8", "=", "CRC_inorganic", "(", "arg_1", ",", "arg_0", ".", "CRC_INORG_L_rho", ",", "arg_0", ".", "CRC_INORG_L_k", ",", "arg_0", ".", "CRC_INORG_L_Tm", ")", "arg_3", "=", "rho_to_Vm", "(", "arg_8", ",", "arg_0", ".", "CRC_INORG_L_MW", ")", "elif", "arg_2", "==", "VDI_PPDS", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_0", ".", "VDI_PPDS_coeffs", "arg_9", "=", "1.", "-", "arg_1", "/", "arg_0", ".", "VDI_PPDS_Tc", "arg_8", "=", "arg_0", ".", "VDI_PPDS_rhoc", "+", "arg_4", "*", "arg_9", "**", "0.35", "+", "arg_5", "*", "arg_9", "**", "(", "2", "/", "3.", ")", "+", "arg_6", "*", "arg_9", "+", "arg_7", "*", "arg_9", "**", "(", "4", "/", "3.", ")", "arg_3", "=", "rho_to_Vm", "(", "arg_8", ",", "arg_0", ".", "VDI_PPDS_MW", ")", "elif", "arg_2", "==", "CRC_INORG_L_CONST", ":", "arg_3", "=", "arg_0", ".", "CRC_INORG_L_CONST_Vm", "elif", "arg_2", "==", "COOLPROP", ":", "arg_3", "=", "1.", "/", "CoolProp_T_dependent_property", "(", "arg_1", ",", "arg_0", ".", "CASRN", ",", "'DMOLAR'", ",", "'l'", ")", "elif", "arg_2", "in", "arg_0", ".", "tabular_data", ":", "arg_3", "=", "arg_0", ".", "interpolate", "(", "arg_1", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        r'''Method to Func low-pressure liquid molar volume at tempearture\n        `T` with a given method.\n\n        This method has no exception handling; see `T_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to Func molar volume, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the liquid at T and a low pressure, [m^3/mol]\n        '''\n        if arg_2 == RACKETT:\n            arg_3 = Rackett(arg_1, arg_0.Tc, arg_0.Pc, arg_0.Zc)\n        elif arg_2 == YAMADA_GUNN:\n            arg_3 = Yamada_Gunn(arg_1, arg_0.Tc, arg_0.Pc, arg_0.omega)\n        elif arg_2 == BHIRUD_NORMAL:\n            arg_3 = Bhirud_normal(arg_1, arg_0.Tc, arg_0.Pc, arg_0.omega)\n        elif arg_2 == TOWNSEND_HALES:\n            arg_3 = Townsend_Hales(arg_1, arg_0.Tc, arg_0.Vc, arg_0.omega)\n        elif arg_2 == HTCOSTALD:\n            arg_3 = COSTALD(arg_1, arg_0.Tc, arg_0.Vc, arg_0.omega)\n        elif arg_2 == YEN_WOODS_SAT:\n            arg_3 = Yen_Woods_saturation(arg_1, arg_0.Tc, arg_0.Vc, arg_0.Zc)\n        elif arg_2 == MMSNM0:\n            arg_3 = SNM0(arg_1, arg_0.Tc, arg_0.Vc, arg_0.omega)\n        elif arg_2 == MMSNM0FIT:\n            arg_3 = SNM0(arg_1, arg_0.Tc, arg_0.Vc, arg_0.omega, arg_0.SNM0_delta_SRK)\n        elif arg_2 == CAMPBELL_THODOS:\n            arg_3 = Campbell_Thodos(arg_1, arg_0.Tb, arg_0.Tc, arg_0.Pc, arg_0.MW, arg_0.dipole)\n        elif arg_2 == HTCOSTALDFIT:\n            arg_3 = COSTALD(arg_1, arg_0.Tc, arg_0.COSTALD_Vchar, arg_0.COSTALD_omega_SRK)\n        elif arg_2 == RACKETTFIT:\n            arg_3 = Rackett(arg_1, arg_0.Tc, arg_0.Pc, arg_0.RACKETT_Z_RA)\n        elif arg_2 == PERRYDIPPR:\n            arg_4, arg_5, arg_6, arg_7 = arg_0.DIPPR_coeffs\n            arg_3 = 1./EQ105(arg_1, arg_4, arg_5, arg_6, arg_7)\n        elif arg_2 == CRC_INORG_L:\n            arg_8 = CRC_inorganic(arg_1, arg_0.CRC_INORG_L_rho, arg_0.CRC_INORG_L_k, arg_0.CRC_INORG_L_Tm)\n            arg_3 = rho_to_Vm(arg_8, arg_0.CRC_INORG_L_MW)\n        elif arg_2 == VDI_PPDS:\n            arg_4, arg_5, arg_6, arg_7 = arg_0.VDI_PPDS_coeffs\n            arg_9 = 1. - arg_1/arg_0.VDI_PPDS_Tc\n            arg_8 = arg_0.VDI_PPDS_rhoc + arg_4*arg_9**0.35 + arg_5*arg_9**(2/3.) + arg_6*arg_9 + arg_7*arg_9**(4/3.)\n            arg_3 = rho_to_Vm(arg_8, arg_0.VDI_PPDS_MW)\n        elif arg_2 == CRC_INORG_L_CONST:\n            arg_3 = arg_0.CRC_INORG_L_CONST_Vm\n        elif arg_2 == COOLPROP:\n            arg_3 = 1./CoolProp_T_dependent_property(arg_1, arg_0.CASRN, 'DMOLAR', 'l')\n        elif arg_2 in arg_0.tabular_data:\n            arg_3 = arg_0.interpolate(arg_1, arg_2)\n        return arg_3", "path": "thermo/volume.py", "identifier": "VolumeLiquid.calculate", "docstring": "r'''Method to calculate low-pressure liquid molar volume at tempearture\n        `T` with a given method.\n\n        This method has no exception handling; see `T_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate molar volume, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the liquid at T and a low pressure, [m^3/mol]", "docstring_tokens": ["r", "Method", "to", "calculate", "low", "-", "pressure", "liquid", "molar", "volume", "at", "tempearture", "T", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 255883}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/run.py#L170-L217", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Runs the algorithms with the specified identifiers on the audio_file.", "language": "python", "parameters": "(file_struct, boundaries_id, labels_id, config,\n                   annotator_id=0)", "return_statement": "return est_times, est_labels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "if", "arg_3", "[", "\"features\"", "]", ".", "features", ".", "shape", "[", "0", "]", "<=", "msaf", ".", "config", ".", "minimum_frames", ":", "logging", ".", "warning", "(", "\"Audio file too short, or too many few beats \"", "\"estimated. Returning empty estimations.\"", ")", "return", "np", ".", "asarray", "(", "[", "0", ",", "arg_3", "[", "\"features\"", "]", ".", "dur", "]", ")", ",", "np", ".", "asarray", "(", "[", "0", "]", ",", "dtype", "=", "int", ")", "arg_5", "=", "get_boundaries_module", "(", "arg_1", ")", "arg_6", "=", "get_labels_module", "(", "arg_2", ")", "arg_7", "=", "arg_3", "[", "\"features\"", "]", ".", "frame_times", "arg_8", "=", "run_hierarchical", "if", "arg_3", "[", "\"hier\"", "]", "else", "run_flat", "arg_9", ",", "arg_10", "=", "arg_8", "(", "arg_0", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_3", ",", "arg_4", ")", "return", "arg_9", ",", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                   arg_4=0):\n    \"\"\"Runs the algorithms with the specified identifiers on the audio_file.\n\n    Parameters\n    ----------\n    file_struct: `msaf.io.FileStruct`\n        Object with the file paths.\n    boundaries_id: str\n        Identifier of the boundaries algorithm to use (\"gt\" for ground truth).\n    labels_id: str\n        Identifier of the labels algorithm to use (None for not labeling).\n    config: dict\n        Dictionary containing the custom parameters of the algorithms to use.\n    annotator_id: int\n        Annotator identificator in the ground truth.\n\n    Returns\n    -------\n    est_times: np.array or list\n        List of estimated times for the segment boundaries.\n        If `list`, it will be a list of np.arrays, sorted by segmentation\n        layer.\n    est_labels: np.array or list\n        List of all the labels associated segments.\n        If `list`, it will be a list of np.arrays, sorted by segmentation\n        layer.\n    \"\"\"\n    # Check that there are enough audio frames\n    if arg_3[\"features\"].features.shape[0] <= msaf.config.minimum_frames:\n        logging.warning(\"Audio file too short, or too many few beats \"\n                        \"estimated. Returning empty estimations.\")\n        return np.asarray([0, arg_3[\"features\"].dur]), \\\n            np.asarray([0], dtype=int)\n\n    # Get the corresponding modules\n    arg_5 = get_boundaries_module(arg_1)\n    arg_6 = get_labels_module(arg_2)\n\n    # Get the correct frame times\n    arg_7 = arg_3[\"features\"].frame_times\n\n    # Segment audio based on type of segmentation\n    arg_8 = run_hierarchical if arg_3[\"hier\"] else run_flat\n    arg_9, arg_10 = arg_8(arg_0, arg_5, arg_6,\n                                    arg_7, arg_3, arg_4)\n\n    return arg_9, arg_10", "path": "msaf/run.py", "identifier": "run_algorithms", "docstring": "Runs the algorithms with the specified identifiers on the audio_file.\n\n    Parameters\n    ----------\n    file_struct: `msaf.io.FileStruct`\n        Object with the file paths.\n    boundaries_id: str\n        Identifier of the boundaries algorithm to use (\"gt\" for ground truth).\n    labels_id: str\n        Identifier of the labels algorithm to use (None for not labeling).\n    config: dict\n        Dictionary containing the custom parameters of the algorithms to use.\n    annotator_id: int\n        Annotator identificator in the ground truth.\n\n    Returns\n    -------\n    est_times: np.array or list\n        List of estimated times for the segment boundaries.\n        If `list`, it will be a list of np.arrays, sorted by segmentation\n        layer.\n    est_labels: np.array or list\n        List of all the labels associated segments.\n        If `list`, it will be a list of np.arrays, sorted by segmentation\n        layer.", "docstring_tokens": ["Runs", "the", "algorithms", "with", "the", "specified", "identifiers", "on", "the", "audio_file", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 255884}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/fft.py#L48-L60", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Prime FFTW with knowledge of which FFTs are best on this machine by\n    loading 'wisdom' from the file ``wisdomfile``", "language": "python", "parameters": "(wisdomfile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "try", ":", "pyfftw", ".", "import_wisdom", "(", "pickle", ".", "load", "(", "open", "(", "arg_0", ",", "'rb'", ")", ")", ")", "except", "(", "IOError", ",", "TypeError", ")", "as", "e", ":", "log", ".", "warn", "(", "\"No wisdom present, generating some at %r\"", "%", "arg_0", ")", "save_wisdom", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Prime FFTW with knowledge of which FFTs are best on this machine by\n    loading 'wisdom' from the file ``wisdomfile``\n    \"\"\"\n    if arg_0 is None:\n        return\n\n    try:\n        pyfftw.import_wisdom(pickle.load(open(arg_0, 'rb')))\n    except (IOError, TypeError) as e:\n        log.warn(\"No wisdom present, generating some at %r\" % arg_0)\n        save_wisdom(arg_0)", "path": "peri/fft.py", "identifier": "load_wisdom", "docstring": "Prime FFTW with knowledge of which FFTs are best on this machine by\n    loading 'wisdom' from the file ``wisdomfile``", "docstring_tokens": ["Prime", "FFTW", "with", "knowledge", "of", "which", "FFTs", "are", "best", "on", "this", "machine", "by", "loading", "wisdom", "from", "the", "file", "wisdomfile"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 255885}
{"url": "https://github.com/opencast/pyCA/blob/c89b168d4780d157e1b3f7676628c1b131956a88/pyca/utils.py#L131-L150", "sha": "c89b168d4780d157e1b3f7676628c1b131956a88", "docstring_summary": "Register this capture agent at the Matterhorn admin server so that it\n    shows up in the admin interface.", "language": "python", "parameters": "(status='idle')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'idle'", ")", ":", "if", "config", "(", ")", "[", "'agent'", "]", "[", "'backup_mode'", "]", ":", "return", "arg_1", "=", "[", "(", "'address'", ",", "config", "(", ")", "[", "'ui'", "]", "[", "'url'", "]", ")", ",", "(", "'state'", ",", "arg_0", ")", "]", "arg_2", "=", "urlquote", "(", "config", "(", ")", "[", "'agent'", "]", "[", "'name'", "]", ".", "encode", "(", "'utf-8'", ")", ",", "safe", "=", "''", ")", "arg_3", "=", "'%s/agents/%s'", "%", "(", "config", "(", ")", "[", "'service-capture.admin'", "]", "[", "0", "]", ",", "arg_2", ")", "try", ":", "arg_4", "=", "http_request", "(", "arg_3", ",", "arg_1", ")", ".", "decode", "(", "'utf-8'", ")", "if", "arg_4", ":", "logger", ".", "info", "(", "arg_4", ")", "except", "pycurl", ".", "error", "as", "e", ":", "logger", ".", "warning", "(", "'Could not set agent state to %s: %s'", "%", "(", "arg_0", ",", "e", ")", ")"], "function": "def Func(arg_0='idle'):\n    '''Register this capture agent at the Matterhorn admin server so that it\n    shows up in the admin interface.\n\n    :param address: Address of the capture agent web ui\n    :param status: Current status of the capture agent\n    '''\n    # If this is a backup CA we don't tell the Matterhorn core that we are\n    # here.  We will just run silently in the background:\n    if config()['agent']['backup_mode']:\n        return\n    arg_1 = [('address', config()['ui']['url']), ('state', arg_0)]\n    arg_2 = urlquote(config()['agent']['name'].encode('utf-8'), safe='')\n    arg_3 = '%s/agents/%s' % (config()['service-capture.admin'][0], arg_2)\n    try:\n        arg_4 = http_request(arg_3, arg_1).decode('utf-8')\n        if arg_4:\n            logger.info(arg_4)\n    except pycurl.error as e:\n        logger.warning('Could not set agent state to %s: %s' % (arg_0, e))", "path": "pyca/utils.py", "identifier": "register_ca", "docstring": "Register this capture agent at the Matterhorn admin server so that it\n    shows up in the admin interface.\n\n    :param address: Address of the capture agent web ui\n    :param status: Current status of the capture agent", "docstring_tokens": ["Register", "this", "capture", "agent", "at", "the", "Matterhorn", "admin", "server", "so", "that", "it", "shows", "up", "in", "the", "admin", "interface", "."], "nwo": "opencast/pyCA", "score": 0.38750565733100095, "idx": 255886}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/chunk.py#L515-L550", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Remove the padding from chunks.", "language": "python", "parameters": "(idx, value, number, padding, axes=None)", "return_statement": "return value[slices]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "range", "(", "len", "(", "arg_2", ")", ")", "arg_5", "=", "len", "(", "arg_2", ")", "*", "[", "False", ",", "]", "for", "arg_6", "in", "range", "(", "len", "(", "arg_5", ")", ")", ":", "if", "arg_6", "in", "arg_4", "and", "arg_3", "[", "arg_6", "]", "!=", "0", ":", "arg_5", "[", "arg_6", "]", "=", "True", "arg_7", "=", "[", "0", "if", "(", "arg_6", "==", "0", "or", "not", "m", ")", "else", "p", "for", "(", "arg_6", ",", "m", ",", "p", ")", "in", "zip", "(", "arg_0", ",", "arg_5", ",", "arg_3", ")", "]", "arg_8", "=", "[", "None", "if", "(", "arg_6", "==", "n", "-", "1", "or", "not", "m", ")", "else", "-", "p", "for", "(", "arg_6", ",", "m", ",", "p", ",", "n", ")", "in", "zip", "(", "arg_0", ",", "arg_5", ",", "arg_3", ",", "arg_2", ")", "]", "arg_9", "=", "[", "slice", "(", "i1", ",", "i2", ")", "for", "(", "i1", ",", "i2", ")", "in", "zip", "(", "arg_7", ",", "arg_8", ")", "]", "return", "arg_1", "[", "arg_9", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"\n        Remove the padding from chunks.\n\n        Given a chunk and its corresponding index, use the plan and padding to remove any\n        padding from the chunk along with specified axes.\n\n        Parameters\n        ----------\n        idx: tuple or array-like\n            The chunk index, indicating which chunk this is.\n\n        value: ndarray\n            The chunk that goes along with the index.\n\n        number: ndarray or array-like\n            The number of chunks along each dimension.\n\n        padding: ndarray or array-like\n            The padding scheme.\n\n        axes: tuple, optional, default = None\n            The axes (in the values) along which to remove padding.\n        \"\"\"\n        if arg_4 is None:\n            arg_4 = range(len(arg_2))\n        arg_5 = len(arg_2)*[False, ]\n        for arg_6 in range(len(arg_5)):\n            if arg_6 in arg_4 and arg_3[arg_6] != 0:\n                arg_5[arg_6] = True\n\n        arg_7 = [0 if (arg_6 == 0 or not m) else p for (arg_6, m, p) in zip(arg_0, arg_5, arg_3)]\n        arg_8 = [None if (arg_6 == n-1 or not m) else -p for (arg_6, m, p, n) in zip(arg_0, arg_5, arg_3, arg_2)]\n        arg_9 = [slice(i1, i2) for (i1, i2) in zip(arg_7, arg_8)]\n\n        return arg_1[arg_9]", "path": "bolt/spark/chunk.py", "identifier": "ChunkedArray.removepad", "docstring": "Remove the padding from chunks.\n\n        Given a chunk and its corresponding index, use the plan and padding to remove any\n        padding from the chunk along with specified axes.\n\n        Parameters\n        ----------\n        idx: tuple or array-like\n            The chunk index, indicating which chunk this is.\n\n        value: ndarray\n            The chunk that goes along with the index.\n\n        number: ndarray or array-like\n            The number of chunks along each dimension.\n\n        padding: ndarray or array-like\n            The padding scheme.\n\n        axes: tuple, optional, default = None\n            The axes (in the values) along which to remove padding.", "docstring_tokens": ["Remove", "the", "padding", "from", "chunks", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 255887}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/bijector.py#L104-L110", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "To support weak referencing, removes cache key from the cache value.", "language": "python", "parameters": "(self, field)", "return_statement": "return _Mapping(\n        x=None if field == \"x\" else self.x,\n        y=None if field == \"y\" else self.y,\n        ildj=self.ildj,\n        kwargs=self.kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "_Mapping", "(", "x", "=", "None", "if", "arg_1", "==", "\"x\"", "else", "arg_0", ".", "x", ",", "y", "=", "None", "if", "arg_1", "==", "\"y\"", "else", "arg_0", ".", "y", ",", "ildj", "=", "arg_0", ".", "ildj", ",", "kwargs", "=", "arg_0", ".", "kwargs", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"To support weak referencing, Funcs cache key from the cache value.\"\"\"\n    return _Mapping(\n        x=None if arg_1 == \"x\" else arg_0.x,\n        y=None if arg_1 == \"y\" else arg_0.y,\n        ildj=arg_0.ildj,\n        kwargs=arg_0.kwargs)", "path": "tensorflow_probability/python/bijectors/bijector.py", "identifier": "_Mapping.remove", "docstring": "To support weak referencing, removes cache key from the cache value.", "docstring_tokens": ["To", "support", "weak", "referencing", "removes", "cache", "key", "from", "the", "cache", "value", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255888}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L183-L193", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return the license name from an ExtractedLicense or None", "language": "python", "parameters": "(self, extr_lic)", "return_statement": "return self.to_special_value(extr_name_list[0][2])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'licenseName'", "]", ",", "None", ")", ")", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "arg_0", ".", "more_than_one_error", "(", "'extracted license name'", ")", "return", "elif", "len", "(", "arg_2", ")", "==", "0", ":", "return", "return", "arg_0", ".", "to_special_value", "(", "arg_2", "[", "0", "]", "[", "2", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return the license name from an ExtractedLicense or None\n        \"\"\"\n        arg_2 = list(arg_0.graph.triples((arg_1, arg_0.spdx_namespace['licenseName'], None)))\n        if len(arg_2) > 1:\n            arg_0.more_than_one_error('extracted license name')\n            return\n        elif len(arg_2) == 0:\n            return\n        return arg_0.to_special_value(arg_2[0][2])", "path": "spdx/parsers/rdf.py", "identifier": "LicenseParser.get_extr_lic_name", "docstring": "Return the license name from an ExtractedLicense or None", "docstring_tokens": ["Return", "the", "license", "name", "from", "an", "ExtractedLicense", "or", "None"], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 255889}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L405-L502", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This concatenates all text LCs for an objectid with the given aperture.", "language": "python", "parameters": "(lcbasedir,\n                                     objectid,\n                                     aperture='TF1',\n                                     postfix='.gz',\n                                     sortby='rjd',\n                                     normalize=True,\n                                     recursive=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'TF1'", ",", "arg_3", "=", "'.gz'", ",", "arg_4", "=", "'rjd'", ",", "arg_5", "=", "True", ",", "arg_6", "=", "True", ")", ":", "LOGINFO", "(", "'looking for light curves for %s, aperture %s in directory: %s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_0", ")", ")", "if", "arg_6", "is", "False", ":", "arg_7", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'*%s*%s*%s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", ")", "else", ":", "if", "sys", ".", "version_info", "[", ":", "2", "]", ">", "(", "3", ",", "4", ")", ":", "arg_7", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'**'", ",", "'*%s*%s*%s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", ",", "arg_6", "=", "True", ")", "LOGINFO", "(", "'found %s files: %s'", "%", "(", "len", "(", "arg_7", ")", ",", "repr", "(", "arg_7", ")", ")", ")", "else", ":", "arg_8", "=", "os", ".", "walk", "(", "arg_0", ")", "arg_7", "=", "[", "]", "for", "arg_9", ",", "arg_10", ",", "arg_11", "in", "arg_8", ":", "for", "arg_12", "in", "arg_10", ":", "arg_13", "=", "os", ".", "path", ".", "join", "(", "arg_9", ",", "arg_12", ",", "'*%s*%s*%s'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", "arg_14", "=", "glob", ".", "glob", "(", "arg_13", ")", "if", "arg_14", ":", "arg_7", ".", "extend", "(", "arg_14", ")", "LOGINFO", "(", "'found %s in dir: %s'", "%", "(", "repr", "(", "arg_14", ")", ",", "os", ".", "path", ".", "join", "(", "arg_9", ",", "arg_12", ")", ")", ")", "if", "arg_7", "and", "len", "(", "arg_7", ")", ">", "0", ":", "arg_15", "=", "concatenate_textlcs", "(", "arg_7", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "return", "arg_15", "else", ":", "LOGERROR", "(", "'did not find any light curves for %s and aperture %s'", "%", "(", "arg_1", ",", "arg_2", ")", ")", "return", "None"], "function": "def Func(arg_0,\n                                     arg_1,\n                                     arg_2='TF1',\n                                     arg_3='.gz',\n                                     arg_4='rjd',\n                                     arg_5=True,\n                                     arg_6=True):\n    '''This concatenates all text LCs for an objectid with the given aperture.\n\n    Does not care about overlaps or duplicates. The light curves must all be\n    from the same aperture.\n\n    The intended use is to concatenate light curves across CCDs or instrument\n    changes for a single object. These can then be normalized later using\n    standard astrobase tools to search for variablity and/or periodicity.\n\n\n    lcbasedir is the directory to start searching in.\n\n    objectid is the object to search for.\n\n    aperture is the aperture postfix to use: (TF1 = aperture 1,\n                                              TF2 = aperture 2,\n                                              TF3 = aperture 3)\n\n    sortby is a column to sort the final concatenated light curve by in\n    ascending order.\n\n    If normalize is True, then each light curve's magnitude columns are\n    normalized to zero, and the whole light curve is then normalized to the\n    global median magnitude for each magnitude column.\n\n    If recursive is True, then the function will search recursively in lcbasedir\n    for any light curves matching the specified criteria. This may take a while,\n    especially on network filesystems.\n\n    The returned lcdict has an extra column: 'lcn' that tracks which measurement\n    belongs to which input light curve. This can be used with\n    lcdict['concatenated'] which relates input light curve index to input light\n    curve filepath. Finally, there is an 'nconcatenated' key in the lcdict that\n    contains the total number of concatenated light curves.\n\n    '''\n    LOGINFO('looking for light curves for %s, aperture %s in directory: %s'\n            % (arg_1, arg_2, arg_0))\n\n    if arg_6 is False:\n\n        arg_7 = glob.glob(os.path.join(arg_0,\n                                          '*%s*%s*%s' % (arg_1,\n                                                         arg_2,\n                                                         arg_3)))\n    else:\n        # use recursive glob for Python 3.5+\n        if sys.version_info[:2] > (3,4):\n\n            arg_7 = glob.glob(os.path.join(arg_0,\n                                              '**',\n                                              '*%s*%s*%s' % (arg_1,\n                                                             arg_2,\n                                                             arg_3)),\n                                 arg_6=True)\n            LOGINFO('found %s files: %s' % (len(arg_7), repr(arg_7)))\n\n        # otherwise, use os.walk and glob\n        else:\n\n            # use os.walk to go through the directories\n            arg_8 = os.walk(arg_0)\n            arg_7 = []\n\n            for arg_9, arg_10, arg_11 in arg_8:\n                for arg_12 in arg_10:\n                    arg_13 = os.path.join(arg_9,\n                                              arg_12,\n                                              '*%s*%s*%s' % (arg_1,\n                                                             arg_2,\n                                                             arg_3))\n                    arg_14 = glob.glob(arg_13)\n\n                    if arg_14:\n                        arg_7.extend(arg_14)\n                        LOGINFO(\n                            'found %s in dir: %s' % (repr(arg_14),\n                                                     os.path.join(arg_9,arg_12))\n                        )\n\n    # now that we have all the files, concatenate them\n    # a single file will be returned as normalized\n    if arg_7 and len(arg_7) > 0:\n        arg_15 = concatenate_textlcs(arg_7,\n                                      arg_4=arg_4,\n                                      arg_5=arg_5)\n        return arg_15\n    else:\n        LOGERROR('did not find any light curves for %s and aperture %s' %\n                 (arg_1, arg_2))\n        return None", "path": "astrobase/hatsurveys/hplc.py", "identifier": "concatenate_textlcs_for_objectid", "docstring": "This concatenates all text LCs for an objectid with the given aperture.\n\n    Does not care about overlaps or duplicates. The light curves must all be\n    from the same aperture.\n\n    The intended use is to concatenate light curves across CCDs or instrument\n    changes for a single object. These can then be normalized later using\n    standard astrobase tools to search for variablity and/or periodicity.\n\n\n    lcbasedir is the directory to start searching in.\n\n    objectid is the object to search for.\n\n    aperture is the aperture postfix to use: (TF1 = aperture 1,\n                                              TF2 = aperture 2,\n                                              TF3 = aperture 3)\n\n    sortby is a column to sort the final concatenated light curve by in\n    ascending order.\n\n    If normalize is True, then each light curve's magnitude columns are\n    normalized to zero, and the whole light curve is then normalized to the\n    global median magnitude for each magnitude column.\n\n    If recursive is True, then the function will search recursively in lcbasedir\n    for any light curves matching the specified criteria. This may take a while,\n    especially on network filesystems.\n\n    The returned lcdict has an extra column: 'lcn' that tracks which measurement\n    belongs to which input light curve. This can be used with\n    lcdict['concatenated'] which relates input light curve index to input light\n    curve filepath. Finally, there is an 'nconcatenated' key in the lcdict that\n    contains the total number of concatenated light curves.", "docstring_tokens": ["This", "concatenates", "all", "text", "LCs", "for", "an", "objectid", "with", "the", "given", "aperture", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255890}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L791-L810", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "From the pattern decomposition, finds the absolute paths\n        matching the pattern.", "language": "python", "parameters": "(self, pattern)", "return_statement": "return expansion", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "=", "arg_0", ".", "_decompose_pattern", "(", "arg_1", ")", "arg_6", "=", "glob", ".", "glob", "(", "arg_2", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_6", ":", "if", "arg_4", "==", "[", "]", ":", "arg_7", ".", "append", "(", "(", "arg_8", ",", "{", "}", ")", ")", "continue", "arg_9", "=", "re", ".", "match", "(", "arg_3", ",", "arg_8", ")", "if", "arg_9", "is", "None", ":", "continue", "arg_10", "=", "arg_9", ".", "groupdict", "(", ")", ".", "items", "(", ")", "arg_11", "=", "dict", "(", "(", "k", ",", "arg_5", ".", "get", "(", "k", ",", "str", ")", "(", "v", ")", ")", "for", "(", "k", ",", "v", ")", "in", "arg_10", ")", "arg_7", ".", "append", "(", "(", "arg_8", ",", "arg_11", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        From the pattern decomposition, finds the absolute paths\n        matching the pattern.\n        \"\"\"\n        (arg_2, arg_3, arg_4, arg_5) = arg_0._decompose_pattern(arg_1)\n        arg_6 = glob.glob(arg_2)\n        arg_7 = []\n\n        for arg_8 in arg_6:\n            if arg_4 == []:\n                arg_7.append((arg_8, {}))\n                continue\n            arg_9 = re.match(arg_3, arg_8)\n            if arg_9 is None: continue\n            arg_10 = arg_9.groupdict().items()\n            arg_11 = dict((k,arg_5.get(k, str)(v)) for (k,v) in arg_10)\n            arg_7.append((arg_8, arg_11))\n\n        return arg_7", "path": "lancet/core.py", "identifier": "FilePattern._expand_pattern", "docstring": "From the pattern decomposition, finds the absolute paths\n        matching the pattern.", "docstring_tokens": ["From", "the", "pattern", "decomposition", "finds", "the", "absolute", "paths", "matching", "the", "pattern", "."], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 255891}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/check_funcs.py#L302-L344", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "When checking a function definition of lambda function,\n    prepare has_equal_x for checking the call of a user-defined function.", "language": "python", "parameters": "(state, callstr, argstr=None, expand_msg=None)", "return_statement": "return child", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "assert_is", "(", "[", "\"function_defs\"", ",", "\"lambda_functions\"", "]", ",", "\"Func\"", ",", "[", "\"check_function_def\"", ",", "\"check_lambda_function\"", "]", ",", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "\"To verify it, we reran {{argstr}}. \"", "arg_4", ",", "arg_5", "=", "build_call", "(", "arg_1", ",", "arg_0", ".", "student_parts", "[", "\"node\"", "]", ")", "arg_6", ",", "arg_7", "=", "build_call", "(", "arg_1", ",", "arg_0", ".", "solution_parts", "[", "\"node\"", "]", ")", "arg_8", "=", "{", "\"msg\"", ":", "arg_3", ",", "\"kwargs\"", ":", "{", "\"argstr\"", ":", "arg_2", "or", "arg_5", "}", "}", "arg_9", "=", "part_to_child", "(", "arg_4", ",", "arg_6", ",", "arg_8", ",", "arg_0", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"When checking a function definition of lambda function,\n    prepare has_equal_x for checking the call of a user-defined function.\n\n    Args:\n        callstr (str): call string that specifies how the function should be called, e.g. `f(1, a = 2)`.\n           ``Func()`` will replace ``f`` with the function/lambda you're targeting.\n        argstr (str): If specified, this overrides the way the function call is refered to in the expand message.\n        expand_msg (str): If specified, this overrides any messages that are prepended by previous SCT chains.\n        state (State): state object that is chained from.\n\n    :Example:\n\n        Student and solution code::\n\n            def my_power(x):\n                print(\"calculating sqrt...\")\n                return(x * x)\n\n        SCT::\n\n            Ex().check_function_def('my_power').multi(\n                Func(\"f(3)\").has_equal_value()\n                Func(\"f(3)\").has_equal_output()\n            )\n    \"\"\"\n\n    arg_0.assert_is(\n        [\"function_defs\", \"lambda_functions\"],\n        \"Func\",\n        [\"check_function_def\", \"check_lambda_function\"],\n    )\n\n    if arg_3 is None:\n        arg_3 = \"To verify it, we reran {{argstr}}. \"\n\n    arg_4, arg_5 = build_call(arg_1, arg_0.student_parts[\"node\"])\n    arg_6, arg_7 = build_call(arg_1, arg_0.solution_parts[\"node\"])\n\n    arg_8 = {\"msg\": arg_3, \"kwargs\": {\"argstr\": arg_2 or arg_5}}\n    arg_9 = part_to_child(arg_4, arg_6, arg_8, arg_0)\n\n    return arg_9", "path": "pythonwhat/checks/check_funcs.py", "identifier": "check_call", "docstring": "When checking a function definition of lambda function,\n    prepare has_equal_x for checking the call of a user-defined function.\n\n    Args:\n        callstr (str): call string that specifies how the function should be called, e.g. `f(1, a = 2)`.\n           ``check_call()`` will replace ``f`` with the function/lambda you're targeting.\n        argstr (str): If specified, this overrides the way the function call is refered to in the expand message.\n        expand_msg (str): If specified, this overrides any messages that are prepended by previous SCT chains.\n        state (State): state object that is chained from.\n\n    :Example:\n\n        Student and solution code::\n\n            def my_power(x):\n                print(\"calculating sqrt...\")\n                return(x * x)\n\n        SCT::\n\n            Ex().check_function_def('my_power').multi(\n                check_call(\"f(3)\").has_equal_value()\n                check_call(\"f(3)\").has_equal_output()\n            )", "docstring_tokens": ["When", "checking", "a", "function", "definition", "of", "lambda", "function", "prepare", "has_equal_x", "for", "checking", "the", "call", "of", "a", "user", "-", "defined", "function", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 255892}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/mixture_same_family.py#L566-L583", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Disables computation of the second derivatives for a tensor.", "language": "python", "parameters": "(x)", "return_statement": "return tf.identity(x), grad", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "grad", "(", "arg_1", ")", ":", "return", "array_ops", ".", "prevent_gradient", "(", "arg_1", ",", "message", "=", "\"Second derivative is not implemented.\"", ")", "return", "tf", ".", "identity", "(", "arg_0", ")", ",", "grad"], "function": "def Func(arg_0):\n  \"\"\"Disables computation of the second derivatives for a tensor.\n\n  NB: you need to apply a non-identity function to the output tensor for the\n  exception to be raised.\n\n  Arguments:\n    x: A tensor.\n\n  Returns:\n    A tensor with the same value and the same derivative as x, but that raises\n    LookupError when trying to compute the second derivatives.\n  \"\"\"\n  def grad(arg_1):\n    return array_ops.prevent_gradient(\n        arg_1, message=\"Second derivative is not implemented.\")\n\n  return tf.identity(arg_0), grad", "path": "tensorflow_probability/python/distributions/mixture_same_family.py", "identifier": "_prevent_2nd_derivative", "docstring": "Disables computation of the second derivatives for a tensor.\n\n  NB: you need to apply a non-identity function to the output tensor for the\n  exception to be raised.\n\n  Arguments:\n    x: A tensor.\n\n  Returns:\n    A tensor with the same value and the same derivative as x, but that raises\n    LookupError when trying to compute the second derivatives.", "docstring_tokens": ["Disables", "computation", "of", "the", "second", "derivatives", "for", "a", "tensor", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255893}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/feature_selection/variance_threshold.py#L46-L93", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Learn empirical variances from X.", "language": "python", "parameters": "(self, Z)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", ":", ",", "'X'", "]", "if", "isinstance", "(", "arg_1", ",", "DictRDD", ")", "else", "arg_1", "check_rdd", "(", "arg_2", ",", "(", "np", ".", "ndarray", ",", "sp", ".", "spmatrix", ")", ")", "def", "mapper", "(", "arg_2", ")", ":", "arg_2", "=", "check_array", "(", "arg_2", ",", "(", "'csr'", ",", "'csc'", ")", ",", "dtype", "=", "np", ".", "float64", ")", "if", "hasattr", "(", "arg_2", ",", "\"toarray\"", ")", ":", "arg_3", ",", "arg_4", "=", "mean_variance_axis", "(", "arg_2", ",", "axis", "=", "0", ")", "else", ":", "arg_3", ",", "arg_4", "=", "np", ".", "mean", "(", "arg_2", ",", "axis", "=", "0", ")", ",", "np", ".", "var", "(", "arg_2", ",", "axis", "=", "0", ")", "return", "arg_2", ".", "shape", "[", "0", "]", ",", "arg_3", ",", "arg_4", "def", "reducer", "(", "arg_5", ",", "arg_6", ")", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_5", "arg_10", ",", "arg_11", ",", "arg_12", "=", "arg_6", "arg_13", "=", "arg_7", "+", "arg_10", "arg_14", "=", "(", "(", "arg_8", "*", "arg_7", ")", "+", "(", "arg_11", "*", "arg_10", ")", ")", "/", "arg_13", "arg_15", "=", "(", "(", "(", "arg_7", "*", "arg_9", ")", "+", "(", "arg_10", "*", "arg_12", ")", ")", "/", "arg_13", ")", "+", "(", "(", "arg_7", "*", "arg_10", ")", "*", "(", "(", "arg_11", "-", "arg_8", ")", "/", "arg_13", ")", "**", "2", ")", "return", "(", "arg_13", ",", "arg_14", ",", "arg_15", ")", "arg_16", ",", "arg_16", ",", "arg_0", ".", "variances_", "=", "arg_2", ".", "map", "(", "mapper", ")", ".", "treeReduce", "(", "reducer", ")", "if", "np", ".", "all", "(", "arg_0", ".", "variances_", "<=", "arg_0", ".", "threshold", ")", ":", "arg_18", "=", "\"No feature in X meets the variance threshold {0:.5f}\"", "if", "arg_2", ".", "shape", "[", "0", "]", "==", "1", ":", "arg_18", "+=", "\" (X contains only one sample)\"", "raise", "ValueError", "(", "arg_18", ".", "format", "(", "arg_0", ".", "threshold", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Learn empirical variances from X.\n\n        Parameters\n        ----------\n        X : {array-like, sparse matrix}, shape (n_samples, n_features)\n            Sample vectors from which to compute variances.\n\n        y : any\n            Ignored. This parameter exists only for compatibility with\n            sklearn.pipeline.Pipeline.\n\n        Returns\n        -------\n        self\n        \"\"\"\n\n        arg_2 = arg_1[:, 'X'] if isinstance(arg_1, DictRDD) else arg_1\n        check_rdd(arg_2, (np.ndarray, sp.spmatrix))\n\n        def mapper(arg_2):\n            \"\"\"Calculate statistics for every numpy or scipy blocks.\"\"\"\n            arg_2 = check_array(arg_2, ('csr', 'csc'), dtype=np.float64)\n            if hasattr(arg_2, \"toarray\"):   # sparse matrix\n                arg_3, arg_4 = mean_variance_axis(arg_2, axis=0)\n            else:\n                arg_3, arg_4 = np.mean(arg_2, axis=0), np.var(arg_2, axis=0)\n            return arg_2.shape[0], arg_3, arg_4\n\n        def reducer(arg_5, arg_6):\n            \"\"\"Calculate the combined statistics.\"\"\"\n            arg_7, arg_8, arg_9 = arg_5\n            arg_10, arg_11, arg_12 = arg_6\n            arg_13 = arg_7 + arg_10\n            arg_14 = ((arg_8 * arg_7) + (arg_11 * arg_10)) / arg_13\n            arg_15 = (((arg_7 * arg_9) + (arg_10 * arg_12)) / arg_13) + \\\n                     ((arg_7 * arg_10) * ((arg_11 - arg_8) / arg_13) ** 2)\n            return (arg_13, arg_14, arg_15)\n\n        arg_16, arg_16, arg_0.variances_ = arg_2.map(mapper).treeReduce(reducer)\n\n        if np.all(arg_0.variances_ <= arg_0.threshold):\n            arg_18 = \"No feature in X meets the variance threshold {0:.5f}\"\n            if arg_2.shape[0] == 1:\n                arg_18 += \" (X contains only one sample)\"\n            raise ValueError(arg_18.format(arg_0.threshold))\n\n        return arg_0", "path": "splearn/feature_selection/variance_threshold.py", "identifier": "SparkVarianceThreshold.fit", "docstring": "Learn empirical variances from X.\n\n        Parameters\n        ----------\n        X : {array-like, sparse matrix}, shape (n_samples, n_features)\n            Sample vectors from which to compute variances.\n\n        y : any\n            Ignored. This parameter exists only for compatibility with\n            sklearn.pipeline.Pipeline.\n\n        Returns\n        -------\n        self", "docstring_tokens": ["Learn", "empirical", "variances", "from", "X", "."], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 255894}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/teams.py#L67-L76", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Gets schedule information for a team-season.", "language": "python", "parameters": "(self, year)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_year_doc", "(", "'{}_games'", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "arg_2", "(", "'table#games'", ")", "arg_4", "=", "sportsref", ".", "utils", ".", "parse_table", "(", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Gets Func information for a team-season.\n\n        :year: The year for which we want the Func.\n        :returns: DataFrame of Func information.\n        \"\"\"\n        arg_2 = arg_0.get_year_doc('{}_games'.format(arg_1))\n        arg_3 = arg_2('table#games')\n        arg_4 = sportsref.utils.parse_table(arg_3)\n        return arg_4", "path": "sportsref/nba/teams.py", "identifier": "Team.schedule", "docstring": "Gets schedule information for a team-season.\n\n        :year: The year for which we want the schedule.\n        :returns: DataFrame of schedule information.", "docstring_tokens": ["Gets", "schedule", "information", "for", "a", "team", "-", "season", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 255895}
{"url": "https://github.com/lgpage/nbtutor/blob/07798a044cf6e1fd4eaac2afddeef3e13348dbcd/nbtutor/ipython/utils.py#L107-L125", "sha": "07798a044cf6e1fd4eaac2afddeef3e13348dbcd", "docstring_summary": "Return a string representation of the Python object", "language": "python", "parameters": "(obj, options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "float_types", ":", "lambda", "x", ":", "'{:.{}g}'", ".", "Func", "(", "x", ",", "arg_1", ".", "digits", ")", ",", "}", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_0", ",", "arg_3", ")", ":", "return", "arg_4", "(", "arg_0", ")", "try", ":", "if", "six", ".", "PY2", "and", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "return", "str", "(", "arg_0", ".", "encode", "(", "'utf-8'", ")", ")", "return", "str", "(", "arg_0", ")", "except", ":", "return", "'OBJECT'"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a string representation of the Python object\n\n    Args:\n        obj: The Python object\n        options: Format options\n    \"\"\"\n    arg_2 = {\n        float_types: lambda x: '{:.{}g}'.Func(x, arg_1.digits),\n    }\n    for arg_3, arg_4 in arg_2.items():\n        if isinstance(arg_0, arg_3):\n            return arg_4(arg_0)\n    try:\n        if six.PY2 and isinstance(arg_0, six.string_types):\n            return str(arg_0.encode('utf-8'))\n        return str(arg_0)\n    except:\n        return 'OBJECT'", "path": "nbtutor/ipython/utils.py", "identifier": "format", "docstring": "Return a string representation of the Python object\n\n    Args:\n        obj: The Python object\n        options: Format options", "docstring_tokens": ["Return", "a", "string", "representation", "of", "the", "Python", "object"], "nwo": "lgpage/nbtutor", "score": 0.47001387444347686, "idx": 255896}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/risk.py#L213-L244", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots output of compute_sector_exposures as area charts", "language": "python", "parameters": "(gross_exposures, sector_dict=None, ax=None)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "plt", ".", "gca", "(", ")", "if", "arg_1", "is", "None", ":", "arg_3", "=", "SECTORS", ".", "values", "(", ")", "else", ":", "arg_3", "=", "arg_1", ".", "values", "(", ")", "arg_4", "=", "plt", ".", "cm", ".", "gist_rainbow", "(", "np", ".", "linspace", "(", "0", ",", "1", ",", "11", ")", ")", "arg_2", ".", "stackplot", "(", "arg_0", "[", "0", "]", ".", "index", ",", "arg_0", ",", "labels", "=", "arg_3", ",", "colors", "=", "arg_4", ",", "alpha", "=", "0.8", ",", "baseline", "=", "'zero'", ")", "arg_2", ".", "axhline", "(", "0", ",", "color", "=", "'k'", ",", "linestyle", "=", "'-'", ")", "arg_2", ".", "set", "(", "title", "=", "'Gross exposure to sectors'", ",", "ylabel", "=", "'Proportion of gross exposure \\n in sectors'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"\n    Plots output of compute_sector_exposures as area charts\n\n    Parameters\n    ----------\n    gross_exposures : arrays\n        Arrays of gross sector exposures (output of compute_sector_exposures).\n\n    sector_dict : dict or OrderedDict\n        Dictionary of all sectors\n        - See full description in compute_sector_exposures\n    \"\"\"\n\n    if arg_2 is None:\n        arg_2 = plt.gca()\n\n    if arg_1 is None:\n        arg_3 = SECTORS.values()\n    else:\n        arg_3 = arg_1.values()\n\n    arg_4 = plt.cm.gist_rainbow(np.linspace(0, 1, 11))\n\n    arg_2.stackplot(arg_0[0].index, arg_0,\n                 labels=arg_3, colors=arg_4, alpha=0.8,\n                 baseline='zero')\n    arg_2.axhline(0, color='k', linestyle='-')\n    arg_2.set(title='Gross exposure to sectors',\n           ylabel='Proportion of gross exposure \\n in sectors')\n\n    return arg_2", "path": "pyfolio/risk.py", "identifier": "plot_sector_exposures_gross", "docstring": "Plots output of compute_sector_exposures as area charts\n\n    Parameters\n    ----------\n    gross_exposures : arrays\n        Arrays of gross sector exposures (output of compute_sector_exposures).\n\n    sector_dict : dict or OrderedDict\n        Dictionary of all sectors\n        - See full description in compute_sector_exposures", "docstring_tokens": ["Plots", "output", "of", "compute_sector_exposures", "as", "area", "charts"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255897}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L2555-L2635", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the KeyWrappingData struct and decode it into\n        its constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "KeyWrappingData", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "WRAPPING_METHOD", ",", "arg_6", ")", ":", "arg_0", ".", "_wrapping_method", "=", "primitives", ".", "Enumeration", "(", "enum", "=", "arg_3", ".", "WrappingMethod", ",", "tag", "=", "arg_3", ".", "Tags", ".", "WRAPPING_METHOD", ")", "arg_0", ".", "_wrapping_method", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Invalid struct missing the wrapping method attribute.\"", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ENCRYPTION_KEY_INFORMATION", ",", "arg_6", ")", ":", "arg_0", ".", "_encryption_key_information", "=", "EncryptionKeyInformation", "(", ")", "arg_0", ".", "_encryption_key_information", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "MAC_SIGNATURE_KEY_INFORMATION", ",", "arg_6", ")", ":", "arg_0", ".", "_mac_signature_key_information", "=", "MACSignatureKeyInformation", "(", ")", "arg_0", ".", "_mac_signature_key_information", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "MAC_SIGNATURE", ",", "arg_6", ")", ":", "arg_0", ".", "_mac_signature", "=", "primitives", ".", "ByteString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "MAC_SIGNATURE", ")", "arg_0", ".", "_mac_signature", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "IV_COUNTER_NONCE", ",", "arg_6", ")", ":", "arg_0", ".", "_iv_counter_nonce", "=", "primitives", ".", "ByteString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "IV_COUNTER_NONCE", ")", "arg_0", ".", "_iv_counter_nonce", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ENCODING_OPTION", ",", "arg_6", ")", ":", "arg_0", ".", "_encoding_option", "=", "primitives", ".", "Enumeration", "(", "enum", "=", "arg_3", ".", "EncodingOption", ",", "tag", "=", "arg_3", ".", "Tags", ".", "ENCODING_OPTION", ")", "arg_0", ".", "_encoding_option", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the KeyWrappingData struct and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        super(KeyWrappingData, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.WRAPPING_METHOD, arg_6):\n            arg_0._wrapping_method = primitives.Enumeration(\n                enum=arg_3.WrappingMethod,\n                tag=arg_3.Tags.WRAPPING_METHOD\n            )\n            arg_0._wrapping_method.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise ValueError(\n                \"Invalid struct missing the wrapping method attribute.\"\n            )\n\n        if arg_0.is_tag_next(\n                arg_3.Tags.ENCRYPTION_KEY_INFORMATION,\n                arg_6\n        ):\n            arg_0._encryption_key_information = EncryptionKeyInformation()\n            arg_0._encryption_key_information.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        if arg_0.is_tag_next(\n                arg_3.Tags.MAC_SIGNATURE_KEY_INFORMATION,\n                arg_6\n        ):\n            arg_0._mac_signature_key_information = MACSignatureKeyInformation()\n            arg_0._mac_signature_key_information.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        if arg_0.is_tag_next(arg_3.Tags.MAC_SIGNATURE, arg_6):\n            arg_0._mac_signature = primitives.ByteString(\n                tag=arg_3.Tags.MAC_SIGNATURE\n            )\n            arg_0._mac_signature.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        if arg_0.is_tag_next(arg_3.Tags.IV_COUNTER_NONCE, arg_6):\n            arg_0._iv_counter_nonce = primitives.ByteString(\n                tag=arg_3.Tags.IV_COUNTER_NONCE\n            )\n            arg_0._iv_counter_nonce.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        if arg_0.is_tag_next(arg_3.Tags.ENCODING_OPTION, arg_6):\n            arg_0._encoding_option = primitives.Enumeration(\n                enum=arg_3.EncodingOption,\n                tag=arg_3.Tags.ENCODING_OPTION\n            )\n            arg_0._encoding_option.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/objects.py", "identifier": "KeyWrappingData.read", "docstring": "Read the data encoding the KeyWrappingData struct and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "KeyWrappingData", "struct", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 255898}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rsync.py#L32-L47", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Generates a rsync of all deployable code.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "arg_0", ".", "genv", ".", "SITE", ",", "'Site unspecified.'", "assert", "arg_0", ".", "genv", ".", "ROLE", ",", "'Role unspecified.'", "arg_1", "=", "arg_0", ".", "local_renderer", "if", "arg_0", ".", "env", ".", "exclusions", ":", "arg_1", ".", "env", ".", "exclusions_str", "=", "' '", ".", "join", "(", "\"--exclude='%s'\"", "%", "_", "for", "_", "in", "arg_0", ".", "env", ".", "exclusions", ")", "arg_1", ".", "local", "(", "arg_1", ".", "env", ".", "rsync_command", ")", "arg_1", ".", "sudo", "(", "'chown -R {rsync_chown_user}:{rsync_chown_group} {rsync_dst_dir}'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Generates a rsync of all deployable code.\n        \"\"\"\n\n        assert arg_0.genv.SITE, 'Site unspecified.'\n        assert arg_0.genv.ROLE, 'Role unspecified.'\n\n        arg_1 = arg_0.local_renderer\n\n        if arg_0.env.exclusions:\n            arg_1.env.exclusions_str = ' '.join(\n                \"--exclude='%s'\" % _ for _ in arg_0.env.exclusions)\n\n        arg_1.local(arg_1.env.rsync_command)\n        arg_1.sudo('chown -R {rsync_chown_user}:{rsync_chown_group} {rsync_dst_dir}')", "path": "burlap/rsync.py", "identifier": "RsyncSatchel.deploy_code", "docstring": "Generates a rsync of all deployable code.", "docstring_tokens": ["Generates", "a", "rsync", "of", "all", "deployable", "code", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 255899}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/network/queue_network.py#L1138-L1183", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Draws the network, highlighting active queues.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "g", "for", "arg_3", "in", "arg_2", ".", "nodes", "(", ")", ":", "arg_0", ".", "g", ".", "set_vp", "(", "arg_3", ",", "'vertex_color'", ",", "[", "0", ",", "0", ",", "0", ",", "0.9", "]", ")", "arg_4", "=", "False", "arg_5", "=", "arg_2", ".", "in_edges", "(", "arg_3", ")", "if", "arg_2", ".", "is_directed", "(", ")", "else", "arg_2", ".", "out_edges", "(", "arg_3", ")", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "arg_2", ".", "edge_index", "[", "arg_6", "]", "if", "arg_0", ".", "edge2queue", "[", "arg_7", "]", ".", "_active", ":", "arg_4", "=", "True", "break", "if", "arg_4", ":", "arg_0", ".", "g", ".", "set_vp", "(", "arg_3", ",", "'vertex_fill_color'", ",", "arg_0", ".", "colors", "[", "'vertex_active'", "]", ")", "else", ":", "arg_0", ".", "g", ".", "set_vp", "(", "arg_3", ",", "'vertex_fill_color'", ",", "arg_0", ".", "colors", "[", "'vertex_inactive'", "]", ")", "for", "arg_6", "in", "arg_2", ".", "edges", "(", ")", ":", "arg_7", "=", "arg_2", ".", "edge_index", "[", "arg_6", "]", "if", "arg_0", ".", "edge2queue", "[", "arg_7", "]", ".", "_active", ":", "arg_0", ".", "g", ".", "set_ep", "(", "arg_6", ",", "'edge_color'", ",", "arg_0", ".", "colors", "[", "'edge_active'", "]", ")", "else", ":", "arg_0", ".", "g", ".", "set_ep", "(", "arg_6", ",", "'edge_color'", ",", "arg_0", ".", "colors", "[", "'edge_inactive'", "]", ")", "arg_0", ".", "draw", "(", "update_colors", "=", "False", ",", "**", "arg_1", ")", "arg_0", ".", "_update_all_colors", "(", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Draws the network, highlighting active queues.\n\n        The colored vertices represent vertices that have at least one\n        queue on an in-edge that is active. Dark edges represent\n        queues that are active, light edges represent queues that are\n        inactive.\n\n        Parameters\n        ----------\n        **kwargs\n            Any additional parameters to pass to :meth:`.draw`, and\n            :meth:`.QueueNetworkDiGraph.draw_graph`.\n\n        Notes\n        -----\n        Active queues are :class:`QueueServers<.QueueServer>` that\n        accept arrivals from outside the network. The colors are\n        defined by the class attribute ``colors``. The relevant keys\n        are ``vertex_active``, ``vertex_inactive``, ``edge_active``,\n        and ``edge_inactive``.\n        \"\"\"\n        arg_2 = arg_0.g\n        for arg_3 in arg_2.nodes():\n            arg_0.g.set_vp(arg_3, 'vertex_color', [0, 0, 0, 0.9])\n            arg_4 = False\n            arg_5 = arg_2.in_edges(arg_3) if arg_2.is_directed() else arg_2.out_edges(arg_3)\n            for arg_6 in arg_5:\n                arg_7 = arg_2.edge_index[arg_6]\n                if arg_0.edge2queue[arg_7]._active:\n                    arg_4 = True\n                    break\n            if arg_4:\n                arg_0.g.set_vp(arg_3, 'vertex_fill_color', arg_0.colors['vertex_active'])\n            else:\n                arg_0.g.set_vp(arg_3, 'vertex_fill_color', arg_0.colors['vertex_inactive'])\n\n        for arg_6 in arg_2.edges():\n            arg_7 = arg_2.edge_index[arg_6]\n            if arg_0.edge2queue[arg_7]._active:\n                arg_0.g.set_ep(arg_6, 'edge_color', arg_0.colors['edge_active'])\n            else:\n                arg_0.g.set_ep(arg_6, 'edge_color', arg_0.colors['edge_inactive'])\n\n        arg_0.draw(update_colors=False, **arg_1)\n        arg_0._update_all_colors()", "path": "queueing_tool/network/queue_network.py", "identifier": "QueueNetwork.show_active", "docstring": "Draws the network, highlighting active queues.\n\n        The colored vertices represent vertices that have at least one\n        queue on an in-edge that is active. Dark edges represent\n        queues that are active, light edges represent queues that are\n        inactive.\n\n        Parameters\n        ----------\n        **kwargs\n            Any additional parameters to pass to :meth:`.draw`, and\n            :meth:`.QueueNetworkDiGraph.draw_graph`.\n\n        Notes\n        -----\n        Active queues are :class:`QueueServers<.QueueServer>` that\n        accept arrivals from outside the network. The colors are\n        defined by the class attribute ``colors``. The relevant keys\n        are ``vertex_active``, ``vertex_inactive``, ``edge_active``,\n        and ``edge_inactive``.", "docstring_tokens": ["Draws", "the", "network", "highlighting", "active", "queues", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 255900}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm.py#L3199-L3241", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Choose n random cells to learn from.", "language": "python", "parameters": "(self, c, i, s, n, activeState)", "return_statement": "return sorted([cands[j] for j in tmp])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_4", "<=", "0", ":", "return", "[", "]", "arg_6", "=", "numpy", ".", "where", "(", "arg_5", "==", "1", ")", "if", "len", "(", "arg_6", "[", "0", "]", ")", "==", "0", ":", "return", "[", "]", "if", "arg_3", "is", "None", ":", "arg_7", "=", "[", "syn", "for", "syn", "in", "zip", "(", "arg_6", "[", "0", "]", ",", "arg_6", "[", "1", "]", ")", "]", "else", ":", "arg_8", "=", "set", "(", "(", "syn", "[", "0", "]", ",", "syn", "[", "1", "]", ")", "for", "syn", "in", "arg_3", ".", "syns", ")", "arg_7", "=", "[", "syn", "for", "syn", "in", "zip", "(", "arg_6", "[", "0", "]", ",", "arg_6", "[", "1", "]", ")", "if", "(", "syn", "[", "0", "]", ",", "syn", "[", "1", "]", ")", "not", "in", "arg_8", "]", "if", "len", "(", "arg_7", ")", "<=", "arg_4", ":", "return", "arg_7", "if", "arg_4", "==", "1", ":", "arg_9", "=", "arg_0", ".", "_random", ".", "getUInt32", "(", "len", "(", "arg_7", ")", ")", "return", "[", "arg_7", "[", "arg_9", "]", "]", "arg_10", "=", "numpy", ".", "array", "(", "[", "arg_12", "for", "arg_12", "in", "range", "(", "len", "(", "arg_7", ")", ")", "]", ",", "dtype", "=", "'uint32'", ")", "arg_11", "=", "numpy", ".", "zeros", "(", "min", "(", "arg_4", ",", "len", "(", "arg_10", ")", ")", ",", "dtype", "=", "'uint32'", ")", "arg_0", ".", "_random", ".", "sample", "(", "arg_10", ",", "arg_11", ")", "return", "sorted", "(", "[", "arg_7", "[", "arg_12", "]", "for", "arg_12", "in", "arg_11", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"\n    Choose n random cells to learn from.\n\n    This function is called several times while learning with timeStep = t-1, so\n    we cache the set of candidates for that case. It's also called once with\n    timeStep = t, and we cache that set of candidates.\n\n    :returns: tuple (column index, cell index).\n    \"\"\"\n    if arg_4 <= 0:\n      return []\n\n    arg_6 = numpy.where(arg_5 == 1)\n\n    # Candidates can be empty at this point, in which case we return\n    # an empty segment list. adaptSegments will do nothing when getting\n    # that list.\n    if len(arg_6[0]) == 0:\n      return []\n\n    if arg_3 is None: # new segment\n      arg_7 = [syn for syn in zip(arg_6[0], arg_6[1])]\n    else:\n      # We exclude any synapse that is already in this segment.\n      arg_8 = set((syn[0], syn[1]) for syn in arg_3.syns)\n      arg_7 = [syn for syn in zip(arg_6[0], arg_6[1])\n               if (syn[0], syn[1]) not in arg_8]\n\n    # If we have no more candidates than requested, return all of them,\n    # no shuffle necessary.\n    if len(arg_7) <= arg_4:\n      return arg_7\n\n    if arg_4 == 1: # so that we don't shuffle if only one is needed\n      arg_9 = arg_0._random.getUInt32(len(arg_7))\n      return [arg_7[arg_9]]  # col and cell idx in col\n\n    # If we need more than one candidate\n    arg_10 = numpy.array([arg_12 for arg_12 in range(len(arg_7))], dtype='uint32')\n    arg_11 = numpy.zeros(min(arg_4, len(arg_10)), dtype='uint32')\n    arg_0._random.sample(arg_10, arg_11)\n    return sorted([arg_7[arg_12] for arg_12 in arg_11])", "path": "src/nupic/algorithms/backtracking_tm.py", "identifier": "BacktrackingTM._chooseCellsToLearnFrom", "docstring": "Choose n random cells to learn from.\n\n    This function is called several times while learning with timeStep = t-1, so\n    we cache the set of candidates for that case. It's also called once with\n    timeStep = t, and we cache that set of candidates.\n\n    :returns: tuple (column index, cell index).", "docstring_tokens": ["Choose", "n", "random", "cells", "to", "learn", "from", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255901}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1010-L1019", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Checks to see if property is specified in 'options'. If not, reads the\n  default value from the schema", "language": "python", "parameters": "(schema, propertyName, options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_2", ":", "arg_3", "=", "arg_0", "[", "'properties'", "]", "[", "arg_1", "]", "if", "'default'", "in", "arg_3", ":", "arg_2", "[", "arg_1", "]", "=", "arg_3", "[", "'default'", "]", "else", ":", "arg_2", "[", "arg_1", "]", "=", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Checks to see if property is specified in 'options'. If not, reads the\n  default value from the schema\"\"\"\n\n  if arg_1 not in arg_2:\n    arg_3 = arg_0['properties'][arg_1]\n    if 'default' in arg_3:\n      arg_2[arg_1] = arg_3['default']\n    else:\n      arg_2[arg_1] = None", "path": "src/nupic/swarming/exp_generator/experiment_generator.py", "identifier": "_getPropertyValue", "docstring": "Checks to see if property is specified in 'options'. If not, reads the\n  default value from the schema", "docstring_tokens": ["Checks", "to", "see", "if", "property", "is", "specified", "in", "options", ".", "If", "not", "reads", "the", "default", "value", "from", "the", "schema"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255902}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L428-L435", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Set whether we print or not when this signal is caught.", "language": "python", "parameters": "(self, signame, set_print)", "return_statement": "return set_print", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ":", "arg_0", ".", "sigs", "[", "arg_1", "]", ".", "print_method", "=", "arg_0", ".", "dbgr", ".", "intf", "[", "-", "1", "]", ".", "msg", "else", ":", "arg_0", ".", "sigs", "[", "arg_1", "]", ".", "print_method", "=", "None", "pass", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Set whether we print or not when this signal is caught.\"\"\"\n        if arg_2:\n            arg_0.sigs[arg_1].print_method = arg_0.dbgr.intf[-1].msg\n        else:\n            arg_0.sigs[arg_1].print_method = None\n            pass\n        return arg_2", "path": "trepan/lib/sighandler.py", "identifier": "SignalManager.handle_print", "docstring": "Set whether we print or not when this signal is caught.", "docstring_tokens": ["Set", "whether", "we", "print", "or", "not", "when", "this", "signal", "is", "caught", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 255903}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/yaml.py#L31-L58", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Return the model as a YAML document.", "language": "python", "parameters": "(model, sort=False, **kwargs)", "return_statement": "return yaml.dump(obj, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "**", "arg_2", ")", ":", "arg_3", "=", "model_to_dict", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_3", "[", "\"version\"", "]", "=", "YAML_SPEC", "return", "yaml", ".", "dump", "(", "arg_3", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, **arg_2):\n    \"\"\"\n    Return the model as a YAML document.\n\n    ``kwargs`` are passed on to ``yaml.dump``.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to represent.\n    sort : bool, optional\n        Whether to sort the metabolites, reactions, and genes or maintain the\n        order defined in the model.\n\n    Returns\n    -------\n    str\n        String representation of the cobra model as a YAML document.\n\n    See Also\n    --------\n    save_yaml_model : Write directly to a file.\n    ruamel.yaml.dump : Base function.\n    \"\"\"\n\n    arg_3 = model_to_dict(arg_0, arg_1=arg_1)\n    arg_3[\"version\"] = YAML_SPEC\n    return yaml.dump(arg_3, **arg_2)", "path": "cobra/io/yaml.py", "identifier": "to_yaml", "docstring": "Return the model as a YAML document.\n\n    ``kwargs`` are passed on to ``yaml.dump``.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to represent.\n    sort : bool, optional\n        Whether to sort the metabolites, reactions, and genes or maintain the\n        order defined in the model.\n\n    Returns\n    -------\n    str\n        String representation of the cobra model as a YAML document.\n\n    See Also\n    --------\n    save_yaml_model : Write directly to a file.\n    ruamel.yaml.dump : Base function.", "docstring_tokens": ["Return", "the", "model", "as", "a", "YAML", "document", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 255904}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L47-L70", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Send a request to the REST API", "language": "python", "parameters": "(self, kind, resource, url_components, **kwargs)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "format_request_url", "(", "arg_2", ",", "*", "arg_3", ")", "arg_6", "=", "getattr", "(", "requests", ",", "arg_1", ")", "arg_7", "=", "arg_0", ".", "get_request_headers", "(", ")", "arg_8", "=", "arg_0", ".", "format_parameters", "(", "**", "arg_4", ")", "arg_9", "=", "arg_6", "(", "arg_5", ",", "arg_7", "=", "arg_7", ",", "arg_10", "=", "arg_8", ")", "arg_10", "=", "arg_0", ".", "get_response", "(", "arg_9", ")", "if", "arg_9", ".", "status_code", ">=", "300", ":", "arg_11", "=", "arg_10", ".", "pop", "(", "'message'", ",", "'API request returned error'", ")", "raise", "APIError", "(", "arg_11", ",", "arg_9", ".", "status_code", ",", "**", "arg_10", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"\n        Send a request to the REST API\n\n        Parameters\n        ----------\n        kind: str, {get, delete, put, post, head}\n        resource: str\n        url_components: list or tuple to be appended to the request URL\n\n        Notes\n        -----\n        kwargs contain request parameters to be sent as request data\n        \"\"\"\n        arg_5 = arg_0.format_request_url(arg_2, *arg_3)\n        arg_6 = getattr(requests, arg_1)\n        arg_7 = arg_0.get_request_headers()\n        arg_8 = arg_0.format_parameters(**arg_4)\n        arg_9 = arg_6(arg_5, arg_7=arg_7, arg_10=arg_8)\n        arg_10 = arg_0.get_response(arg_9)\n        if arg_9.status_code >= 300:\n            arg_11 = arg_10.pop('message', 'API request returned error')\n            raise APIError(arg_11, arg_9.status_code, **arg_10)\n        return arg_10", "path": "poseidon/api.py", "identifier": "RestAPI.send_request", "docstring": "Send a request to the REST API\n\n        Parameters\n        ----------\n        kind: str, {get, delete, put, post, head}\n        resource: str\n        url_components: list or tuple to be appended to the request URL\n\n        Notes\n        -----\n        kwargs contain request parameters to be sent as request data", "docstring_tokens": ["Send", "a", "request", "to", "the", "REST", "API"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 255905}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/RECI.py#L63-L88", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Compute the RECI fit score", "language": "python", "parameters": "(self, x, y)", "return_statement": "return error", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "np", ".", "reshape", "(", "minmax_scale", "(", "arg_1", ")", ",", "(", "-", "1", ",", "1", ")", ")", "arg_2", "=", "np", ".", "reshape", "(", "minmax_scale", "(", "arg_2", ")", ",", "(", "-", "1", ",", "1", ")", ")", "arg_3", "=", "PolynomialFeatures", "(", "degree", "=", "arg_0", ".", "degree", ")", "arg_4", "=", "arg_3", ".", "fit_transform", "(", "arg_1", ")", "arg_4", "[", ":", ",", "1", "]", "=", "0", "arg_4", "[", ":", ",", "2", "]", "=", "0", "arg_5", "=", "LinearRegression", "(", ")", "arg_5", ".", "fit", "(", "arg_4", ",", "arg_2", ")", "arg_6", "=", "arg_5", ".", "predict", "(", "arg_4", ")", "arg_7", "=", "mean_squared_error", "(", "arg_6", ",", "arg_2", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Compute the RECI fit score\n\n        Args:\n            x (numpy.ndarray): Variable 1\n            y (numpy.ndarray): Variable 2\n\n        Returns:\n            float: RECI fit score\n\n        \"\"\"\n        arg_1 = np.reshape(minmax_scale(arg_1), (-1, 1))\n        arg_2 = np.reshape(minmax_scale(arg_2), (-1, 1))\n        arg_3 = PolynomialFeatures(degree=arg_0.degree)\n        arg_4 = arg_3.fit_transform(arg_1)\n\n        arg_4[:,1] = 0\n        arg_4[:,2] = 0\n\n        arg_5 = LinearRegression()\n        arg_5.fit(arg_4, arg_2)\n\n        arg_6 = arg_5.predict(arg_4)\n        arg_7 = mean_squared_error(arg_6, arg_2)\n\n        return arg_7", "path": "cdt/causality/pairwise/RECI.py", "identifier": "RECI.b_fit_score", "docstring": "Compute the RECI fit score\n\n        Args:\n            x (numpy.ndarray): Variable 1\n            y (numpy.ndarray): Variable 2\n\n        Returns:\n            float: RECI fit score", "docstring_tokens": ["Compute", "the", "RECI", "fit", "score"], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 255906}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1489-L1494", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Convenience method that returns a cursor for the prompt position.", "language": "python", "parameters": "(self)", "return_statement": "return cursor", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_control", ".", "textCursor", "(", ")", "arg_1", ".", "setPosition", "(", "arg_0", ".", "_prompt_pos", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Convenience method that returns a cursor for the prompt position.\n        \"\"\"\n        arg_1 = arg_0._control.textCursor()\n        arg_1.setPosition(arg_0._prompt_pos)\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._get_prompt_cursor", "docstring": "Convenience method that returns a cursor for the prompt position.", "docstring_tokens": ["Convenience", "method", "that", "returns", "a", "cursor", "for", "the", "prompt", "position", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255907}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/examples/stream_6dof_example.py#L14-L22", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Extract a name to index dictionary from 6dof settings xml", "language": "python", "parameters": "(xml_string)", "return_statement": "return body_to_index", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ET", ".", "fromstring", "(", "arg_0", ")", "arg_2", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ".", "findall", "(", "\"*/Body/Name\"", ")", ")", ":", "arg_2", "[", "arg_4", ".", "text", ".", "strip", "(", ")", "]", "=", "arg_3", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\" Extract a name to index dictionary from 6dof settings xml \"\"\"\n    arg_1 = ET.fromstring(arg_0)\n\n    arg_2 = {}\n    for arg_3, arg_4 in enumerate(arg_1.findall(\"*/Body/Name\")):\n        arg_2[arg_4.text.strip()] = arg_3\n\n    return arg_2", "path": "examples/stream_6dof_example.py", "identifier": "create_body_index", "docstring": "Extract a name to index dictionary from 6dof settings xml", "docstring_tokens": ["Extract", "a", "name", "to", "index", "dictionary", "from", "6dof", "settings", "xml"], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 255908}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/debugger.py#L165-L178", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the contents of a named file as a list of lines.", "language": "python", "parameters": "(fname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "open", "(", "arg_0", ")", "except", "IOError", ":", "return", "[", "]", "else", ":", "arg_2", "=", "arg_1", ".", "readlines", "(", ")", "arg_1", ".", "close", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Return the contents of a named file as a list of lines.\n\n    This function never raises an IOError exception: if the file can't be\n    read, it simply returns an empty list.\"\"\"\n\n    try:\n        arg_1 = open(arg_0)\n    except IOError:\n        return []\n    else:\n        arg_2 = arg_1.readlines()\n        arg_1.close()\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/debugger.py", "identifier": "_file_lines", "docstring": "Return the contents of a named file as a list of lines.\n\n    This function never raises an IOError exception: if the file can't be\n    read, it simply returns an empty list.", "docstring_tokens": ["Return", "the", "contents", "of", "a", "named", "file", "as", "a", "list", "of", "lines", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255909}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_13_post_processing/main.py#L111-L131", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds all parameters to `traj`", "language": "python", "parameters": "(traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "'Adding Parameters'", ")", "arg_0", ".", "f_add_parameter", "(", "'neuron.V_init'", ",", "0.0", ",", "comment", "=", "'The initial condition for the '", "'membrane potential'", ")", "arg_0", ".", "f_add_parameter", "(", "'neuron.I'", ",", "0.0", ",", "comment", "=", "'The externally applied current.'", ")", "arg_0", ".", "f_add_parameter", "(", "'neuron.tau_V'", ",", "10.0", ",", "comment", "=", "'The membrane time constant in milliseconds'", ")", "arg_0", ".", "f_add_parameter", "(", "'neuron.tau_ref'", ",", "5.0", ",", "comment", "=", "'The refractory period in milliseconds '", "'where the membrane potnetial '", "'is clamped.'", ")", "arg_0", ".", "f_add_parameter", "(", "'simulation.duration'", ",", "1000.0", ",", "comment", "=", "'The duration of the experiment in '", "'milliseconds.'", ")", "arg_0", ".", "f_add_parameter", "(", "'simulation.dt'", ",", "0.1", ",", "comment", "=", "'The step size of an Euler integration step.'", ")"], "function": "def Func(arg_0):\n    \"\"\"Adds all parameters to `traj`\"\"\"\n    print('Adding Parameters')\n\n    arg_0.f_add_parameter('neuron.V_init', 0.0,\n                         comment='The initial condition for the '\n                                    'membrane potential')\n    arg_0.f_add_parameter('neuron.I', 0.0,\n                         comment='The externally applied current.')\n    arg_0.f_add_parameter('neuron.tau_V', 10.0,\n                         comment='The membrane time constant in milliseconds')\n    arg_0.f_add_parameter('neuron.tau_ref', 5.0,\n                        comment='The refractory period in milliseconds '\n                                'where the membrane potnetial '\n                                'is clamped.')\n\n    arg_0.f_add_parameter('simulation.duration', 1000.0,\n                         comment='The duration of the experiment in '\n                                'milliseconds.')\n    arg_0.f_add_parameter('simulation.dt', 0.1,\n                         comment='The step size of an Euler integration step.')", "path": "examples/example_13_post_processing/main.py", "identifier": "add_parameters", "docstring": "Adds all parameters to `traj`", "docstring_tokens": ["Adds", "all", "parameters", "to", "traj"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255910}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/aws.py#L97-L145", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "stream is a get that will stream to file_name. Since this is a worker\n       task, it differs from the client provided version in that it requires\n       headers.", "language": "python", "parameters": "(url, headers, stream_to=None, retry=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "bot", ".", "debug", "(", "\"GET %s\"", "%", "arg_0", ")", "if", "DISABLE_SSL_CHECK", "is", "True", ":", "bot", ".", "warning", "(", "'Verify of certificates disabled! ::TESTING USE ONLY::'", ")", "arg_4", "=", "requests", ".", "get", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "verify", "=", "not", "DISABLE_SSL_CHECK", ",", "Func", "=", "True", ")", "if", "arg_4", ".", "status_code", "in", "[", "401", ",", "403", "]", ":", "arg_1", "=", "update_token", "(", "arg_1", ")", "return", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", "elif", "arg_4", ".", "status_code", "==", "200", ":", "arg_5", "=", "None", "if", "'Content-Length'", "in", "arg_4", ".", "headers", ":", "arg_6", "=", "0", "arg_5", "=", "int", "(", "arg_4", ".", "headers", "[", "'Content-Length'", "]", ")", "bot", ".", "show_progress", "(", "arg_6", ",", "arg_5", ",", "length", "=", "35", ")", "arg_7", "=", "1", "<<", "20", "with", "open", "(", "arg_2", ",", "'wb'", ")", "as", "filey", ":", "for", "arg_8", "in", "arg_4", ".", "iter_content", "(", "arg_7", "=", "arg_7", ")", ":", "filey", ".", "write", "(", "arg_8", ")", "if", "arg_5", "is", "not", "None", ":", "arg_6", "+=", "arg_7", "bot", ".", "show_progress", "(", "iteration", "=", "arg_6", ",", "total", "=", "arg_5", ",", "length", "=", "35", ",", "carriage_return", "=", "False", ")", "sys", ".", "stdout", ".", "write", "(", "'\\n'", ")", "return", "arg_2", "bot", ".", "error", "(", "\"Problem with Func, response %s\"", "%", "(", "arg_4", ".", "status_code", ")", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=True):\n    '''Func is a get that will Func to file_name. Since this is a worker\n       task, it differs from the client provided version in that it requires\n       headers.\n    '''\n    bot.debug(\"GET %s\" % arg_0)\n\n    if DISABLE_SSL_CHECK is True:\n        bot.warning('Verify of certificates disabled! ::TESTING USE ONLY::')\n\n    # Ensure headers are present, update if not\n    arg_4 = requests.get(arg_0,  \n                            arg_1=arg_1,\n                            verify=not DISABLE_SSL_CHECK,\n                            Func=True)\n\n    # If we get permissions error, one more try with updated token\n    if arg_4.status_code in [401, 403]:\n        arg_1 = update_token(arg_1)\n        return Func(arg_0, arg_1, arg_2, arg_3=False)\n\n    # Successful Response\n    elif arg_4.status_code == 200:\n\n        # Keep user updated with Progress Bar\n        arg_5 = None\n        if 'Content-Length' in arg_4.headers:\n            arg_6 = 0\n            arg_5 = int(arg_4.headers['Content-Length'])\n            bot.show_progress(arg_6,arg_5,length=35)\n\n        arg_7 = 1 << 20\n        with open(arg_2,'wb') as filey:\n            for arg_8 in arg_4.iter_content(arg_7=arg_7):\n                filey.write(arg_8)\n                if arg_5 is not None:\n                    arg_6+=arg_7\n                    bot.show_progress(iteration=arg_6,\n                                      total=arg_5,\n                                      length=35,\n                                      carriage_return=False)\n\n        # Newline to finish download\n        sys.stdout.write('\\n')\n\n        return arg_2 \n\n    bot.error(\"Problem with Func, response %s\" %(arg_4.status_code))\n    sys.exit(1)", "path": "sregistry/main/workers/aws.py", "identifier": "stream", "docstring": "stream is a get that will stream to file_name. Since this is a worker\n       task, it differs from the client provided version in that it requires\n       headers.", "docstring_tokens": ["stream", "is", "a", "get", "that", "will", "stream", "to", "file_name", ".", "Since", "this", "is", "a", "worker", "task", "it", "differs", "from", "the", "client", "provided", "version", "in", "that", "it", "requires", "headers", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 255911}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/core.py#L415-L420", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Extracts the session data from cookie.", "language": "python", "parameters": "(self)", "return_statement": "return self._deserialize(cookie) if cookie else {}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "adapter", ".", "cookies", ".", "get", "(", "arg_0", ".", "name", ")", "return", "arg_0", ".", "_deserialize", "(", "arg_1", ")", "if", "arg_1", "else", "{", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Extracts the session data from cookie.\n        \"\"\"\n        arg_1 = arg_0.adapter.cookies.get(arg_0.name)\n        return arg_0._deserialize(arg_1) if arg_1 else {}", "path": "authomatic/core.py", "identifier": "Session._get_data", "docstring": "Extracts the session data from cookie.", "docstring_tokens": ["Extracts", "the", "session", "data", "from", "cookie", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 255912}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/__init__.py#L382-L492", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Generate ``num`` rules from category ``cat``, optionally specifying\n        preferred category groups ``preferred`` that should be preferred at\n        probability ``preferred_ratio`` over other randomly-chosen rule definitions.", "language": "python", "parameters": "(self, num, cat=None, cat_group=None, preferred=None, preferred_ratio=0.5, max_recursion=None, auto_process=True)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "0.5", ",", "arg_6", "=", "None", ",", "arg_7", "=", "True", ")", ":", "import", "arg_8", ".", "fields", "arg_8", ".", "fields", ".", "REF_LEVEL", "=", "1", "if", "arg_2", "is", "None", "and", "arg_3", "is", "None", ":", "raise", "arg_8", ".", "errors", ".", "GramFuzzError", "(", "\"cat and cat_group are None, one must be set\"", ")", "if", "arg_2", "is", "None", "and", "arg_3", "is", "not", "None", ":", "if", "arg_3", "not", "in", "arg_0", ".", "cat_group_defaults", ":", "raise", "arg_8", ".", "errors", ".", "GramFuzzError", "(", "\"cat_group {!r} did not define a TOP_CAT variable\"", ")", "arg_2", "=", "arg_0", ".", "cat_group_defaults", "[", "arg_3", "]", "if", "not", "isinstance", "(", "arg_2", ",", "basestring", ")", ":", "raise", "arg_8", ".", "errors", ".", "GramFuzzError", "(", "\"cat_group {!r}'s TOP_CAT variable was not a string\"", ")", "if", "arg_7", "and", "arg_0", ".", "_rules_processed", "==", "False", ":", "arg_0", ".", "preprocess_rules", "(", ")", "if", "arg_6", "is", "not", "None", ":", "arg_0", ".", "set_max_recursion", "(", "arg_6", ")", "if", "arg_4", "is", "None", ":", "arg_4", "=", "[", "]", "arg_11", "=", "deque", "(", ")", "arg_12", "=", "arg_0", ".", "defs", "[", "arg_2", "]", "arg_13", "=", "arg_11", ".", "append", "arg_14", "=", "arg_11", ".", "extend", "arg_15", "=", "rand", ".", "choice", "arg_16", "=", "rand", ".", "maybe", "arg_17", "=", "utils", ".", "val", "arg_18", "=", "arg_0", ".", "defs", "[", "arg_2", "]", ".", "keys", "(", ")", "arg_0", ".", "_last_pref_keys", "=", "arg_0", ".", "_get_pref_keys", "(", "arg_2", ",", "arg_4", ")", "arg_0", ".", "_last_prefs", "=", "arg_4", "arg_21", "=", "deque", "(", ")", "arg_22", "=", "0", "while", "arg_22", "<", "arg_1", ":", "if", "len", "(", "arg_0", ".", "_last_pref_keys", ")", ">", "0", "and", "arg_16", "(", "arg_5", ")", ":", "arg_23", "=", "arg_15", "(", "arg_0", ".", "_last_pref_keys", ")", "if", "arg_23", "not", "in", "arg_12", ":", "arg_23", "=", "arg_15", "(", "list", "(", "arg_18", ")", ")", "else", ":", "arg_23", "=", "arg_15", "(", "list", "(", "arg_18", ")", ")", "if", "arg_23", "not", "in", "arg_12", ":", "continue", "arg_24", "=", "arg_15", "(", "arg_12", "[", "arg_23", "]", ")", "arg_25", "=", "{", "}", "arg_26", "=", "deque", "(", ")", "arg_0", ".", "pre_revert", "(", "arg_25", ")", "arg_27", "=", "None", "try", ":", "arg_27", "=", "arg_17", "(", "arg_24", ",", "arg_26", ")", "except", "errors", ".", "GramFuzzError", "as", "e", ":", "raise", "except", "RuntimeError", "as", "e", ":", "print", "(", "\"RUNTIME ERROR\"", ")", "arg_0", ".", "revert", "(", "arg_25", ")", "continue", "if", "arg_27", "is", "not", "None", ":", "arg_14", "(", "arg_26", ")", "arg_13", "(", "arg_27", ")", "arg_22", "+=", "1", "arg_0", ".", "post_revert", "(", "arg_2", ",", "arg_11", ",", "arg_22", ",", "arg_1", ",", "arg_25", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=0.5, arg_6=None, arg_7=True):\n        \"\"\"Generate ``num`` rules from category ``cat``, optionally specifying\n        preferred category groups ``preferred`` that should be preferred at\n        probability ``preferred_ratio`` over other randomly-chosen rule definitions.\n\n        :param int num: The number of rules to Funcerate\n        :param str cat: The name of the category to Funcerate ``num`` rules from\n        :param str cat_group: The category group (ie python file) to Funcerate rules from. This\n            was added specifically to make it easier to Funcerate data based on the name\n            of the file the grammar was defined in, and is intended to work with the\n            ``TOP_CAT`` values that may be defined in a loaded grammar file.\n        :param list preferred: A list of preferred category groups to Funcerate rules from\n        :param float preferred_ratio: The percent probability that the preferred\n            groups will be chosen over randomly choosen rule definitions from category ``cat``.\n        :param int max_recursion: The maximum amount to allow references to recurse\n        :param bool auto_process: Whether rules should be automatically pruned and\n            shortest reference paths determined. See :any:`gramfuzz.GramFuzzer.preprocess_rules`\n            for what would automatically be done.\n        \"\"\"\n        import arg_8.fields\n        arg_8.fields.REF_LEVEL = 1\n\n        if arg_2 is None and arg_3 is None:\n            raise arg_8.errors.GramFuzzError(\"cat and cat_group are None, one must be set\")\n\n        if arg_2 is None and arg_3 is not None:\n            if arg_3 not in arg_0.cat_group_defaults:\n                raise arg_8.errors.GramFuzzError(\n                    \"cat_group {!r} did not define a TOP_CAT variable\"\n                )\n            arg_2 = arg_0.cat_group_defaults[arg_3]\n            if not isinstance(arg_2, basestring):\n                raise arg_8.errors.GramFuzzError(\n                    \"cat_group {!r}'s TOP_CAT variable was not a string\"\n                )\n\n        if arg_7 and arg_0._rules_processed == False:\n            arg_0.preprocess_rules()\n\n        if arg_6 is not None:\n            arg_0.set_max_recursion(arg_6)\n\n        if arg_4 is None:\n            arg_4 = []\n\n        arg_11 = deque()\n        arg_12 = arg_0.defs[arg_2]\n\n        # optimizations\n        arg_13 = arg_11.append\n        arg_14 = arg_11.extend\n        arg_15 = rand.choice\n        arg_16 = rand.maybe\n        arg_17 = utils.val\n\n        arg_18 = arg_0.defs[arg_2].keys()\n\n        arg_0._last_pref_keys = arg_0._get_pref_keys(arg_2, arg_4)\n        # be sure to set this *after* fetching the pref keys (above^)\n        arg_0._last_prefs = arg_4\n\n        arg_21 = deque()\n        arg_22 = 0\n        while arg_22 < arg_1:\n            # use a rule definition from one of the preferred category\n            # groups\n            if len(arg_0._last_pref_keys) > 0 and arg_16(arg_5):\n                arg_23 = arg_15(arg_0._last_pref_keys)\n                if arg_23 not in arg_12:\n                    # TODO this means it was removed / pruned b/c it was unreachable??\n                    # TODO look into this more\n                    arg_23 = arg_15(list(arg_18))\n\n            # else just choose a key at random from the category\n            else:\n                arg_23 = arg_15(list(arg_18))\n\n            # pruning failed, this rule is not defined/reachable\n            if arg_23 not in arg_12:\n                continue\n\n            arg_24 = arg_15(arg_12[arg_23])\n\n            # not used directly by GramFuzzer, but could be useful\n            # to subclasses of GramFuzzer\n            arg_25 = {}\n\n            arg_26 = deque()\n            arg_0.pre_revert(arg_25)\n            arg_27 = None\n\n            try:\n                arg_27 = arg_17(arg_24, arg_26)\n            except errors.GramFuzzError as e:\n                raise\n                #total_errors.append(e)\n                #self.revert(info)\n                #continue\n            except RuntimeError as e:\n                print(\"RUNTIME ERROR\")\n                arg_0.revert(arg_25)\n                continue\n\n            if arg_27 is not None:\n                arg_14(arg_26)\n                arg_13(arg_27)\n\n                arg_22 += 1\n                arg_0.post_revert(arg_2, arg_11, arg_22, arg_1, arg_25)\n\n        return arg_11", "path": "gramfuzz/gramfuzz/__init__.py", "identifier": "GramFuzzer.gen", "docstring": "Generate ``num`` rules from category ``cat``, optionally specifying\n        preferred category groups ``preferred`` that should be preferred at\n        probability ``preferred_ratio`` over other randomly-chosen rule definitions.\n\n        :param int num: The number of rules to generate\n        :param str cat: The name of the category to generate ``num`` rules from\n        :param str cat_group: The category group (ie python file) to generate rules from. This\n            was added specifically to make it easier to generate data based on the name\n            of the file the grammar was defined in, and is intended to work with the\n            ``TOP_CAT`` values that may be defined in a loaded grammar file.\n        :param list preferred: A list of preferred category groups to generate rules from\n        :param float preferred_ratio: The percent probability that the preferred\n            groups will be chosen over randomly choosen rule definitions from category ``cat``.\n        :param int max_recursion: The maximum amount to allow references to recurse\n        :param bool auto_process: Whether rules should be automatically pruned and\n            shortest reference paths determined. See :any:`gramfuzz.GramFuzzer.preprocess_rules`\n            for what would automatically be done.", "docstring_tokens": ["Generate", "num", "rules", "from", "category", "cat", "optionally", "specifying", "preferred", "category", "groups", "preferred", "that", "should", "be", "preferred", "at", "probability", "preferred_ratio", "over", "other", "randomly", "-", "chosen", "rule", "definitions", "."], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 255913}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/telegram.py#L312-L329", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the messages that a bot can read.", "language": "python", "parameters": "(self, offset=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "{", "}", "if", "arg_1", ":", "arg_2", "[", "arg_0", ".", "OFFSET", "]", "=", "arg_1", "arg_4", "=", "arg_0", ".", "_call", "(", "arg_0", ".", "UPDATES_METHOD", ",", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Fetch the messages that a bot can read.\n\n        When the `offset` is given it will retrieve all the messages\n        that are greater or equal to that offset. Take into account\n        that, due to how the API works, all previous messages will\n        be removed from the server.\n\n        :param offset: fetch the messages starting on this offset\n        \"\"\"\n        arg_2 = {}\n\n        if arg_1:\n            arg_2[arg_0.OFFSET] = arg_1\n\n        arg_4 = arg_0._call(arg_0.UPDATES_METHOD, arg_2)\n\n        return arg_4", "path": "perceval/backends/core/telegram.py", "identifier": "TelegramBotClient.updates", "docstring": "Fetch the messages that a bot can read.\n\n        When the `offset` is given it will retrieve all the messages\n        that are greater or equal to that offset. Take into account\n        that, due to how the API works, all previous messages will\n        be removed from the server.\n\n        :param offset: fetch the messages starting on this offset", "docstring_tokens": ["Fetch", "the", "messages", "that", "a", "bot", "can", "read", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255914}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1184-L1199", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Return the signature algorithm used in the certificate.", "language": "python", "parameters": "(self)", "return_statement": "return _ffi.string(_lib.OBJ_nid2ln(nid))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_lib", ".", "X509_get0_tbs_sigalg", "(", "arg_0", ".", "_x509", ")", "arg_2", "=", "_lib", ".", "OBJ_obj2nid", "(", "arg_1", ".", "algorithm", ")", "if", "arg_2", "==", "_lib", ".", "NID_undef", ":", "raise", "ValueError", "(", "\"Undefined signature algorithm\"", ")", "return", "_ffi", ".", "string", "(", "_lib", ".", "OBJ_nid2ln", "(", "arg_2", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the signature algorithm used in the certificate.\n\n        :return: The name of the algorithm.\n        :rtype: :py:class:`bytes`\n\n        :raises ValueError: If the signature algorithm is undefined.\n\n        .. versionadded:: 0.13\n        \"\"\"\n        arg_1 = _lib.X509_get0_tbs_sigalg(arg_0._x509)\n        arg_2 = _lib.OBJ_obj2nid(arg_1.algorithm)\n        if arg_2 == _lib.NID_undef:\n            raise ValueError(\"Undefined signature algorithm\")\n        return _ffi.string(_lib.OBJ_nid2ln(arg_2))", "path": "src/OpenSSL/crypto.py", "identifier": "X509.get_signature_algorithm", "docstring": "Return the signature algorithm used in the certificate.\n\n        :return: The name of the algorithm.\n        :rtype: :py:class:`bytes`\n\n        :raises ValueError: If the signature algorithm is undefined.\n\n        .. versionadded:: 0.13", "docstring_tokens": ["Return", "the", "signature", "algorithm", "used", "in", "the", "certificate", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 255915}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L275-L294", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Creates the required metrics modules", "language": "python", "parameters": "(self, metricSpecs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "return", "arg_0", ".", "__metricSpecs", "=", "arg_1", "for", "arg_3", "in", "arg_1", ":", "if", "not", "InferenceElement", ".", "validate", "(", "arg_3", ".", "inferenceElement", ")", ":", "raise", "ValueError", "(", "\"Invalid inference element for metric spec: %r\"", "%", "arg_3", ")", "arg_0", ".", "__metrics", ".", "append", "(", "metrics", ".", "getModule", "(", "arg_3", ")", ")", "arg_0", ".", "__metricLabels", ".", "append", "(", "arg_3", ".", "getLabel", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Creates the required metrics modules\n\n    Parameters:\n    -----------------------------------------------------------------------\n    metricSpecs:\n      A sequence of MetricSpec objects that specify which metric modules to\n      instantiate\n    \"\"\"\n    if not arg_1:\n      return\n\n    arg_0.__metricSpecs = arg_1\n    for arg_3 in arg_1:\n      if not InferenceElement.validate(arg_3.inferenceElement):\n        raise ValueError(\"Invalid inference element for metric spec: %r\" %arg_3)\n\n      arg_0.__metrics.append(metrics.getModule(arg_3))\n      arg_0.__metricLabels.append(arg_3.getLabel())", "path": "src/nupic/frameworks/opf/prediction_metrics_manager.py", "identifier": "MetricsManager.__constructMetricsModules", "docstring": "Creates the required metrics modules\n\n    Parameters:\n    -----------------------------------------------------------------------\n    metricSpecs:\n      A sequence of MetricSpec objects that specify which metric modules to\n      instantiate", "docstring_tokens": ["Creates", "the", "required", "metrics", "modules"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255916}
{"url": "https://github.com/eagleflo/adjutant/blob/85d800d9979fa122e0888af48c2e6a697f9da458/adjutant.py#L241-L249", "sha": "85d800d9979fa122e0888af48c2e6a697f9da458", "docstring_summary": "Transform duration into a human-readable form.", "language": "python", "parameters": "(self, seconds)", "return_statement": "return duration", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"\"", "arg_3", ",", "arg_1", "=", "divmod", "(", "arg_1", ",", "60", ")", "if", "arg_3", ">=", "60", ":", "arg_4", ",", "arg_3", "=", "divmod", "(", "arg_3", ",", "60", ")", "arg_2", "=", "\"%sh \"", "%", "arg_4", "arg_2", "+=", "\"%sm %ss\"", "%", "(", "arg_3", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Transform duration into a human-readable form.\"\"\"\n        arg_2 = \"\"\n        arg_3, arg_1 = divmod(arg_1, 60)\n        if arg_3 >= 60:\n            arg_4, arg_3 = divmod(arg_3, 60)\n            arg_2 = \"%sh \" % arg_4\n        arg_2 += \"%sm %ss\" % (arg_3, arg_1)\n        return arg_2", "path": "adjutant.py", "identifier": "SC2Replay.get_duration", "docstring": "Transform duration into a human-readable form.", "docstring_tokens": ["Transform", "duration", "into", "a", "human", "-", "readable", "form", "."], "nwo": "eagleflo/adjutant", "score": 0.21302904236143622, "idx": 255917}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/data_generator.py#L188-L197", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns all the records", "language": "python", "parameters": "(self)", "return_statement": "return values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", ".", "fields", "[", "0", "]", ".", "numRecords", "assert", "(", "all", "(", "arg_3", ".", "numRecords", "==", "arg_2", "for", "arg_3", "in", "arg_0", ".", "fields", ")", ")", "for", "arg_4", "in", "range", "(", "arg_2", ")", ":", "arg_1", ".", "append", "(", "arg_0", ".", "getRecord", "(", "arg_4", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns all the records\"\"\"\n    arg_1=[]\n    arg_2 = arg_0.fields[0].numRecords\n    assert (all(arg_3.numRecords==arg_2 for arg_3 in arg_0.fields))\n\n    for arg_4 in range(arg_2):\n      arg_1.append(arg_0.getRecord(arg_4))\n\n    return arg_1", "path": "src/nupic/data/generators/data_generator.py", "identifier": "DataGenerator.getAllRecords", "docstring": "Returns all the records", "docstring_tokens": ["Returns", "all", "the", "records"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 255918}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/utils.py#L170-L219", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Pretty print a pandas DataFrame.", "language": "python", "parameters": "(table,\n                name=None,\n                float_format=None,\n                formatters=None,\n                header_rows=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "pd", ".", "Series", ")", ":", "arg_0", "=", "pd", ".", "DataFrame", "(", "arg_0", ")", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "columns", ".", "name", "=", "arg_1", "arg_6", "=", "arg_0", ".", "to_html", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "arg_4", "is", "not", "None", ":", "arg_7", "=", "arg_6", ".", "split", "(", "'<thead>'", ")", "[", "1", "]", ".", "split", "(", "'</thead>'", ")", "[", "0", "]", ".", "count", "(", "'<th>'", ")", "arg_8", "=", "''", "for", "arg_1", ",", "arg_9", "in", "arg_4", ".", "items", "(", ")", ":", "arg_8", "+=", "(", "'\\n    <tr style=\"text-align: right;\"><th>%s</th>'", "+", "'<td colspan=%d>%s</td></tr>'", ")", "%", "(", "arg_1", ",", "arg_7", ",", "arg_9", ")", "arg_6", "=", "arg_6", ".", "replace", "(", "'<thead>'", ",", "'<thead>'", "+", "arg_8", ")", "display", "(", "HTML", "(", "arg_6", ")", ")"], "function": "def Func(arg_0,\n                arg_1=None,\n                arg_2=None,\n                arg_3=None,\n                arg_4=None):\n    \"\"\"\n    Pretty print a pandas DataFrame.\n\n    Uses HTML output if running inside Jupyter Notebook, otherwise\n    formatted text output.\n\n    Parameters\n    ----------\n    table : pandas.Series or pandas.DataFrame\n        Table to pretty-print.\n    name : str, optional\n        Table name to display in upper left corner.\n    float_format : function, optional\n        Formatter to use for displaying table elements, passed as the\n        `float_format` arg to pd.Dataframe.to_html.\n        E.g. `'{0:.2%}'.format` for displaying 100 as '100.00%'.\n    formatters : list or dict, optional\n        Formatters to use by column, passed as the `formatters` arg to\n        pd.Dataframe.to_html.\n    header_rows : dict, optional\n        Extra rows to display at the top of the table.\n    \"\"\"\n\n    if isinstance(arg_0, pd.Series):\n        arg_0 = pd.DataFrame(arg_0)\n\n    if arg_1 is not None:\n        arg_0.columns.name = arg_1\n\n    arg_6 = arg_0.to_html(arg_2=arg_2, arg_3=arg_3)\n\n    if arg_4 is not None:\n        # Count the number of columns for the text to span\n        arg_7 = arg_6.split('<thead>')[1].split('</thead>')[0].count('<th>')\n\n        # Generate the HTML for the extra rows\n        arg_8 = ''\n        for arg_1, arg_9 in arg_4.items():\n            arg_8 += ('\\n    <tr style=\"text-align: right;\"><th>%s</th>' +\n                     '<td colspan=%d>%s</td></tr>') % (arg_1, arg_7, arg_9)\n\n        # Inject the new HTML\n        arg_6 = arg_6.replace('<thead>', '<thead>' + arg_8)\n\n    display(HTML(arg_6))", "path": "pyfolio/utils.py", "identifier": "print_table", "docstring": "Pretty print a pandas DataFrame.\n\n    Uses HTML output if running inside Jupyter Notebook, otherwise\n    formatted text output.\n\n    Parameters\n    ----------\n    table : pandas.Series or pandas.DataFrame\n        Table to pretty-print.\n    name : str, optional\n        Table name to display in upper left corner.\n    float_format : function, optional\n        Formatter to use for displaying table elements, passed as the\n        `float_format` arg to pd.Dataframe.to_html.\n        E.g. `'{0:.2%}'.format` for displaying 100 as '100.00%'.\n    formatters : list or dict, optional\n        Formatters to use by column, passed as the `formatters` arg to\n        pd.Dataframe.to_html.\n    header_rows : dict, optional\n        Extra rows to display at the top of the table.", "docstring_tokens": ["Pretty", "print", "a", "pandas", "DataFrame", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255919}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/resource.py#L252-L259", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "translate gui2py attribute name from pythoncard legacy code", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "PYTHONCARD_PROPERTY_MAP", ".", "get", "(", "arg_1", ")", "if", "arg_2", ":", "print", "\"WARNING: property %s should be %s (%s)\"", "%", "(", "arg_1", ",", "arg_2", ",", "arg_0", ".", "obj", ".", "name", ")", "return", "arg_2", "else", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"translate gui2py attribute name from pythoncard legacy code\"\n        arg_2 = PYTHONCARD_PROPERTY_MAP.get(arg_1)\n        if arg_2:\n            print \"WARNING: property %s should be %s (%s)\" % (arg_1, arg_2, arg_0.obj.name)\n            return arg_2\n        else:\n            return arg_1", "path": "gui/resource.py", "identifier": "PythonCardWrapper.convert", "docstring": "translate gui2py attribute name from pythoncard legacy code", "docstring_tokens": ["translate", "gui2py", "attribute", "name", "from", "pythoncard", "legacy", "code"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 255920}
{"url": "https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L256-L264", "sha": "5e464e1fc3ae9c7e216f6dd94f879a967d065247", "docstring_summary": "Remove direct links in the training sets.", "language": "python", "parameters": "(train, valid, test)", "return_statement": "return list(filtered)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "set", "(", ")", "arg_4", "=", "arg_1", "+", "arg_2", "for", "arg_5", "in", "arg_4", ":", "arg_3", ".", "add", "(", "(", "arg_5", ".", "head", ",", "arg_5", ".", "tail", ")", ")", "arg_6", "=", "filterfalse", "(", "lambda", "arg_5", ":", "(", "arg_5", ".", "head", ",", "arg_5", ".", "tail", ")", "in", "arg_3", "or", "(", "arg_5", ".", "tail", ",", "arg_5", ".", "head", ")", "in", "arg_3", ",", "arg_0", ")", "return", "list", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Remove direct links in the training sets.\"\"\"\n    arg_3 = set()\n    arg_4 = arg_1 + arg_2\n    for arg_5 in arg_4:\n        arg_3.add((arg_5.head, arg_5.tail))\n\n    arg_6 = filterfalse(lambda arg_5: (arg_5.head, arg_5.tail) in arg_3 or (arg_5.tail, arg_5.head) in arg_3, arg_0)\n    return list(arg_6)", "path": "kgekit/data.py", "identifier": "remove_direct_link_triples", "docstring": "Remove direct links in the training sets.", "docstring_tokens": ["Remove", "direct", "links", "in", "the", "training", "sets", "."], "nwo": "fantasticfears/kgekit", "score": 0.15726537023232431, "idx": 255921}
{"url": "https://github.com/ariebovenberg/gentools/blob/4a1f9f928c7f8b4752b69168858e83b4b23d6bcb/gentools/core.py#L297-L322", "sha": "4a1f9f928c7f8b4752b69168858e83b4b23d6bcb", "docstring_summary": "Send an item into a generator expecting a final return value", "language": "python", "parameters": "(gen, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "send", "(", "arg_1", ")", "except", "StopIteration", "as", "e", ":", "return", "stopiter_value", "(", "e", ")", "else", ":", "raise", "RuntimeError", "(", "'generator did not return as expected'", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Send an item into a generator expecting a final return value\n\n    Parameters\n    ----------\n    gen: ~typing.Generator[T_yield, T_send, T_return]\n        the generator to send the value to\n    value: T_send\n        the value to send\n\n    Raises\n    ------\n    RuntimeError\n        if the generator did not return as expected\n\n    Returns\n    -------\n    T_return\n        the generator's return value\n    \"\"\"\n    try:\n        arg_0.send(arg_1)\n    except StopIteration as e:\n        return stopiter_value(e)\n    else:\n        raise RuntimeError('generator did not return as expected')", "path": "gentools/core.py", "identifier": "sendreturn", "docstring": "Send an item into a generator expecting a final return value\n\n    Parameters\n    ----------\n    gen: ~typing.Generator[T_yield, T_send, T_return]\n        the generator to send the value to\n    value: T_send\n        the value to send\n\n    Raises\n    ------\n    RuntimeError\n        if the generator did not return as expected\n\n    Returns\n    -------\n    T_return\n        the generator's return value", "docstring_tokens": ["Send", "an", "item", "into", "a", "generator", "expecting", "a", "final", "return", "value"], "nwo": "ariebovenberg/gentools", "score": 0.24979334806965703, "idx": 255922}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/common/interfaces.py#L98-L102", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "publish value to status", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Publishing status: %s/%s: %s\"", ",", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_1", ",", "arg_2", ")", "arg_0", ".", "core", ".", "Func", "(", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Func value to status\"\"\"\n        arg_0.log.debug(\n            \"Publishing status: %s/%s: %s\", arg_0.__class__.__name__, arg_1, arg_2)\n        arg_0.core.Func(arg_0.__class__.__name__, arg_1, arg_2)", "path": "yandextank/common/interfaces.py", "identifier": "AbstractPlugin.publish", "docstring": "publish value to status", "docstring_tokens": ["publish", "value", "to", "status"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 255923}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/utils.py#L69-L74", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Extract actions from class.", "language": "python", "parameters": "(record_class)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "dir", "(", "arg_0", ")", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "arg_1", ",", "None", ")", "if", "arg_2", "and", "getattr", "(", "arg_2", ",", "'__deposit_action__'", ",", "False", ")", ":", "yield", "arg_2", ".", "__name__"], "function": "def Func(arg_0):\n    \"\"\"Extract actions from class.\"\"\"\n    for arg_1 in dir(arg_0):\n        arg_2 = getattr(arg_0, arg_1, None)\n        if arg_2 and getattr(arg_2, '__deposit_action__', False):\n            yield arg_2.__name__", "path": "invenio_deposit/utils.py", "identifier": "extract_actions_from_class", "docstring": "Extract actions from class.", "docstring_tokens": ["Extract", "actions", "from", "class", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 255924}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L228-L243", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Sets niceness of a process", "language": "python", "parameters": "(kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "[", "'niceness'", "]", "if", "arg_1", "is", "not", "None", ":", "try", ":", "try", ":", "arg_2", "=", "os", ".", "nice", "(", "0", ")", "if", "arg_1", "-", "arg_2", ">", "0", ":", "os", ".", "nice", "(", "arg_1", "-", "arg_2", ")", "except", "AttributeError", ":", "psutil", ".", "Process", "(", ")", ".", "nice", "(", "arg_1", ")", "except", "Exception", "as", "exc", ":", "sys", ".", "stderr", ".", "write", "(", "'Could not configure niceness because of: %s'", "%", "repr", "(", "exc", ")", ")", "traceback", ".", "print_exc", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Sets niceness of a process\"\"\"\n    arg_1 = arg_0['niceness']\n    if arg_1 is not None:\n        try:\n            try:\n                arg_2 = os.nice(0)\n                if arg_1 - arg_2 > 0:\n                    # Under Linux you cannot decrement niceness if set elsewhere\n                    os.nice(arg_1-arg_2)\n            except AttributeError:\n                # Fall back on psutil under Windows\n                psutil.Process().nice(arg_1)\n        except Exception as exc:\n            sys.stderr.write('Could not configure niceness because of: %s' % repr(exc))\n            traceback.print_exc()", "path": "pypet/environment.py", "identifier": "_configure_niceness", "docstring": "Sets niceness of a process", "docstring_tokens": ["Sets", "niceness", "of", "a", "process"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255925}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L187-L220", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Find edges that are A - A, meaning that some conditions in the edge best describe the interaction.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "edges", "(", "keys", "=", "True", ",", "arg_5", "=", "True", ")", ":", "if", "arg_2", "!=", "arg_3", ":", "continue", "arg_6", "=", "arg_0", ".", "edge_to_bel", "(", "arg_2", ",", "arg_3", ",", "arg_5", ")", "arg_7", "=", "arg_5", ".", "get", "(", "LINE", ")", "if", "arg_7", "is", "None", ":", "continue", "elif", "has_protein_modification_increases_activity", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "print", "(", "arg_7", ",", "'- pmod changes -'", ",", "arg_6", ")", "find_related", "(", "arg_0", ",", "arg_3", ",", "arg_5", ")", "elif", "has_degradation_increases_activity", "(", "arg_5", ")", ":", "print", "(", "arg_7", ",", "'- degradation changes -'", ",", "arg_6", ")", "find_related", "(", "arg_0", ",", "arg_3", ",", "arg_5", ")", "elif", "has_translocation_increases_activity", "(", "arg_5", ")", ":", "print", "(", "arg_7", ",", "'- translocation changes -'", ",", "arg_6", ")", "find_related", "(", "arg_0", ",", "arg_3", ",", "arg_5", ")", "elif", "complex_increases_activity", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "print", "(", "arg_7", ",", "'- complex changes - '", ",", "arg_6", ")", "find_related", "(", "arg_0", ",", "arg_3", ",", "arg_5", ")", "elif", "has_same_subject_object", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "print", "(", "arg_7", ",", "'- same sub/obj -'", ",", "arg_6", ")", "else", ":", "print", "(", "arg_7", ",", "'- *** - '", ",", "arg_6", ")"], "function": "def Func(arg_0: arg_1):\n    \"\"\"Find edges that are A - A, meaning that some conditions in the edge best describe the interaction.\"\"\"\n    for arg_2, arg_3, arg_4, arg_5 in arg_0.edges(keys=True, arg_5=True):\n        if arg_2 != arg_3:\n            continue\n\n        arg_6 = arg_0.edge_to_bel(arg_2, arg_3, arg_5)\n\n        arg_7 = arg_5.get(LINE)\n\n        if arg_7 is None:\n            continue  # this was inferred, so need to investigate another way\n\n        elif has_protein_modification_increases_activity(arg_0, arg_2, arg_3, arg_4):\n            print(arg_7, '- pmod changes -', arg_6)\n            find_related(arg_0, arg_3, arg_5)\n\n        elif has_degradation_increases_activity(arg_5):\n            print(arg_7, '- degradation changes -', arg_6)\n            find_related(arg_0, arg_3, arg_5)\n\n        elif has_translocation_increases_activity(arg_5):\n            print(arg_7, '- translocation changes -', arg_6)\n            find_related(arg_0, arg_3, arg_5)\n\n        elif complex_increases_activity(arg_0, arg_2, arg_3, arg_4):\n            print(arg_7, '- complex changes - ', arg_6)\n            find_related(arg_0, arg_3, arg_5)\n\n        elif has_same_subject_object(arg_0, arg_2, arg_3, arg_4):\n            print(arg_7, '- same sub/obj -', arg_6)\n\n        else:\n            print(arg_7, '- *** - ', arg_6)", "path": "src/pybel_tools/biogrammar/double_edges.py", "identifier": "find_activations", "docstring": "Find edges that are A - A, meaning that some conditions in the edge best describe the interaction.", "docstring_tokens": ["Find", "edges", "that", "are", "A", "-", "A", "meaning", "that", "some", "conditions", "in", "the", "edge", "best", "describe", "the", "interaction", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 255926}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/protocol.py#L97-L125", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Creates Outgoing Packet from a given reqid and message", "language": "python", "parameters": "(reqid, message)", "return_statement": "return OutgoingPacket(packet)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", ".", "IsInitialized", "(", ")", "arg_2", "=", "''", "arg_3", "=", "arg_1", ".", "DESCRIPTOR", ".", "full_name", "arg_4", "=", "HeronProtocol", ".", "get_size_to_pack_string", "(", "arg_3", ")", "+", "REQID", ".", "REQID_SIZE", "+", "HeronProtocol", ".", "get_size_to_pack_message", "(", "arg_1", ")", "arg_2", "+=", "HeronProtocol", ".", "pack_int", "(", "arg_4", ")", "arg_2", "+=", "HeronProtocol", ".", "pack_int", "(", "len", "(", "arg_3", ")", ")", "arg_2", "+=", "arg_3", "arg_2", "+=", "arg_0", ".", "pack", "(", ")", "arg_2", "+=", "HeronProtocol", ".", "pack_int", "(", "arg_1", ".", "ByteSize", "(", ")", ")", "arg_2", "+=", "arg_1", ".", "SerializeToString", "(", ")", "return", "OutgoingPacket", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Creates Outgoing Packet from a given reqid and message\n\n    :param reqid: REQID object\n    :param message: protocol buffer object\n    \"\"\"\n    assert arg_1.IsInitialized()\n    arg_2 = ''\n\n    # calculate the totla size of the packet incl. header\n    arg_3 = arg_1.DESCRIPTOR.full_name\n\n    arg_4 = HeronProtocol.get_size_to_pack_string(arg_3) + \\\n               REQID.REQID_SIZE + HeronProtocol.get_size_to_pack_message(arg_1)\n\n    # first write out how much data is there as the header\n    arg_2 += HeronProtocol.pack_int(arg_4)\n\n    # next write the type string\n    arg_2 += HeronProtocol.pack_int(len(arg_3))\n    arg_2 += arg_3\n\n    # reqid\n    arg_2 += arg_0.pack()\n\n    # add the proto\n    arg_2 += HeronProtocol.pack_int(arg_1.ByteSize())\n    arg_2 += arg_1.SerializeToString()\n    return OutgoingPacket(arg_2)", "path": "heron/instance/src/python/network/protocol.py", "identifier": "OutgoingPacket.create_packet", "docstring": "Creates Outgoing Packet from a given reqid and message\n\n    :param reqid: REQID object\n    :param message: protocol buffer object", "docstring_tokens": ["Creates", "Outgoing", "Packet", "from", "a", "given", "reqid", "and", "message"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255927}
{"url": "https://github.com/edx/edx-lint/blob/d87ccb51a48984806b6442a36992c5b45c3d4d58/edx_lint/configfile.py#L3-L11", "sha": "d87ccb51a48984806b6442a36992c5b45c3d4d58", "docstring_summary": "Merge tweaks into a main config file.", "language": "python", "parameters": "(main, tweaks)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "sections", "(", ")", ":", "for", "arg_3", "in", "arg_1", ".", "options", "(", "arg_2", ")", ":", "arg_4", "=", "arg_1", ".", "get", "(", "arg_2", ",", "arg_3", ")", "if", "arg_3", ".", "endswith", "(", "\"+\"", ")", ":", "arg_3", "=", "arg_3", "[", ":", "-", "1", "]", "arg_4", "=", "arg_0", ".", "get", "(", "arg_2", ",", "arg_3", ")", "+", "arg_4", "arg_0", ".", "set", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Merge tweaks into a main config file.\"\"\"\n    for arg_2 in arg_1.sections():\n        for arg_3 in arg_1.options(arg_2):\n            arg_4 = arg_1.get(arg_2, arg_3)\n            if arg_3.endswith(\"+\"):\n                arg_3 = arg_3[:-1]\n                arg_4 = arg_0.get(arg_2, arg_3) + arg_4\n            arg_0.set(arg_2, arg_3, arg_4)", "path": "edx_lint/configfile.py", "identifier": "merge_configs", "docstring": "Merge tweaks into a main config file.", "docstring_tokens": ["Merge", "tweaks", "into", "a", "main", "config", "file", "."], "nwo": "edx/edx-lint", "score": 0.3933713915493414, "idx": 255928}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/optics/base.py#L26-L44", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Returns a function that can be called `n` times with a single\n    argument before returning all the args that have been passed to it\n    in a tuple. Useful as a substitute for functions that can't easily be\n    curried.", "language": "python", "parameters": "(n)", "return_statement": "return arg_collector", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "def", "arg_collector", "(", "arg_2", ")", ":", "arg_1", ".", "append", "(", "arg_2", ")", "if", "len", "(", "arg_1", ")", "==", "arg_0", ":", "return", "tuple", "(", "arg_1", ")", "else", ":", "return", "arg_collector", "return", "arg_collector"], "function": "def Func(arg_0):\n    '''Returns a function that can be called `n` times with a single\n    argument before returning all the args that have been passed to it\n    in a tuple. Useful as a substitute for functions that can't easily be\n    curried.\n\n        >>> Func(3)(1)(2)(3)\n        (1, 2, 3)\n    '''\n    arg_1 = []\n\n    def arg_collector(arg_2):\n        arg_1.append(arg_2)\n        if len(arg_1) == arg_0:\n            return tuple(arg_1)\n        else:\n            return arg_collector\n\n    return arg_collector", "path": "lenses/optics/base.py", "identifier": "collect_args", "docstring": "Returns a function that can be called `n` times with a single\n    argument before returning all the args that have been passed to it\n    in a tuple. Useful as a substitute for functions that can't easily be\n    curried.\n\n        >>> collect_args(3)(1)(2)(3)\n        (1, 2, 3)", "docstring_tokens": ["Returns", "a", "function", "that", "can", "be", "called", "n", "times", "with", "a", "single", "argument", "before", "returning", "all", "the", "args", "that", "have", "been", "passed", "to", "it", "in", "a", "tuple", ".", "Useful", "as", "a", "substitute", "for", "functions", "that", "can", "t", "easily", "be", "curried", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 255929}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/cli/credentials.py#L76-L93", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Returns the user's stored API key if a valid credentials file is found.\n    Raises CredentialsError if no valid credentials file is found.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "arg_0", "=", "netrc", ".", "path", "(", ")", "arg_1", "=", "netrc", "(", "arg_0", ")", ".", "authenticators", "(", "urlparse", "(", "solvebio", ".", "api_host", ")", ".", "netloc", ")", "except", "(", "IOError", ",", "TypeError", ",", "NetrcParseError", ")", "as", "e", ":", "raise", "CredentialsError", "(", "'Could not open credentials file: '", "+", "str", "(", "e", ")", ")", "if", "arg_1", ":", "return", "arg_1", "[", "2", "]", "else", ":", "return", "None"], "function": "def Func():\n    \"\"\"\n    Returns the user's stored API key if a valid credentials file is found.\n    Raises CredentialsError if no valid credentials file is found.\n    \"\"\"\n    try:\n        arg_0 = netrc.path()\n        arg_1 = netrc(arg_0).authenticators(\n            urlparse(solvebio.api_host).netloc)\n    except (IOError, TypeError, NetrcParseError) as e:\n        raise CredentialsError(\n            'Could not open credentials file: ' + str(e))\n\n    if arg_1:\n        # auths = (login, account, password)\n        return arg_1[2]\n    else:\n        return None", "path": "solvebio/cli/credentials.py", "identifier": "get_credentials", "docstring": "Returns the user's stored API key if a valid credentials file is found.\n    Raises CredentialsError if no valid credentials file is found.", "docstring_tokens": ["Returns", "the", "user", "s", "stored", "API", "key", "if", "a", "valid", "credentials", "file", "is", "found", ".", "Raises", "CredentialsError", "if", "no", "valid", "credentials", "file", "is", "found", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 255930}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dstat.py#L230-L273", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Create a new table that is a summary of the input rows.", "language": "python", "parameters": "(rows)", "return_statement": "return new_rows", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "[", "]", "arg_1", "=", "'job-name'", "if", "arg_1", "not", "in", "arg_0", "[", "0", "]", ":", "arg_1", "=", "'job-id'", "arg_2", "=", "collections", ".", "defaultdict", "(", "lambda", ":", "collections", ".", "defaultdict", "(", "lambda", ":", "[", "]", ")", ")", "for", "arg_3", "in", "arg_0", ":", "arg_2", "[", "arg_3", ".", "get", "(", "arg_1", ",", "''", ")", "]", "[", "arg_3", ".", "get", "(", "'status'", ",", "''", ")", "]", "+=", "[", "arg_3", "]", "arg_4", "=", "[", "]", "for", "arg_5", "in", "sorted", "(", "arg_2", ".", "keys", "(", ")", ")", ":", "arg_6", "=", "arg_2", ".", "get", "(", "arg_5", ",", "None", ")", "arg_7", "=", "[", "'RUNNING'", ",", "'SUCCESS'", ",", "'FAILURE'", ",", "'CANCEL'", "]", "for", "arg_8", "in", "arg_7", "+", "sorted", "(", "arg_6", ".", "keys", "(", ")", ")", ":", "if", "arg_8", "not", "in", "arg_6", ":", "continue", "arg_9", "=", "len", "(", "arg_6", "[", "arg_8", "]", ")", "del", "arg_6", "[", "arg_8", "]", "if", "arg_9", ":", "arg_10", "=", "collections", ".", "OrderedDict", "(", ")", "arg_10", "[", "arg_1", "]", "=", "arg_5", "arg_10", "[", "'status'", "]", "=", "arg_8", "arg_10", "[", "'task-count'", "]", "=", "arg_9", "arg_4", ".", "append", "(", "arg_10", ")", "return", "arg_4"], "function": "def Func(arg_0):\n  \"\"\"Create a new table that is a summary of the input rows.\n\n  All with the same (job-name or job-id, status) go together.\n\n  Args:\n    rows: the input rows, a list of dictionaries.\n  Returns:\n    A new row set of summary information.\n  \"\"\"\n  if not arg_0:\n    return []\n\n  # We either group on the job-name (if present) or fall back to the job-id\n  arg_1 = 'job-name'\n  if arg_1 not in arg_0[0]:\n    arg_1 = 'job-id'\n\n  # Group each of the rows based on (job-name or job-id, status)\n  arg_2 = collections.defaultdict(lambda: collections.defaultdict(lambda: []))\n  for arg_3 in arg_0:\n    arg_2[arg_3.get(arg_1, '')][arg_3.get('status', '')] += [arg_3]\n\n  # Now that we have the rows grouped, create a summary table.\n  # Use the original table as the driver in order to preserve the order.\n  arg_4 = []\n  for arg_5 in sorted(arg_2.keys()):\n    arg_6 = arg_2.get(arg_5, None)\n    arg_7 = ['RUNNING', 'SUCCESS', 'FAILURE', 'CANCEL']\n    # Written this way to ensure that if somehow a new status is introduced,\n    # it shows up in our output.\n    for arg_8 in arg_7 + sorted(arg_6.keys()):\n      if arg_8 not in arg_6:\n        continue\n      arg_9 = len(arg_6[arg_8])\n      del arg_6[arg_8]\n      if arg_9:\n        arg_10 = collections.OrderedDict()\n        arg_10[arg_1] = arg_5\n        arg_10['status'] = arg_8\n        arg_10['task-count'] = arg_9\n        arg_4.append(arg_10)\n\n  return arg_4", "path": "dsub/commands/dstat.py", "identifier": "_prepare_summary_table", "docstring": "Create a new table that is a summary of the input rows.\n\n  All with the same (job-name or job-id, status) go together.\n\n  Args:\n    rows: the input rows, a list of dictionaries.\n  Returns:\n    A new row set of summary information.", "docstring_tokens": ["Create", "a", "new", "table", "that", "is", "a", "summary", "of", "the", "input", "rows", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 255931}
{"url": "https://github.com/monero-ecosystem/monero-python/blob/64149f6323af57a3924f45ed87997d64387c5ee0/monero/account.py#L62-L69", "sha": "64149f6323af57a3924f45ed87997d64387c5ee0", "docstring_summary": "Creates a new address.", "language": "python", "parameters": "(self, label=None)", "return_statement": "return self._backend.new_address(account=self.index, label=label)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "arg_0", ".", "_backend", ".", "Func", "(", "account", "=", "arg_0", ".", "index", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Creates a new address.\n\n        :param label: address label as `str`\n        :rtype: :class:`SubAddress <monero.address.SubAddress>`\n        \"\"\"\n        return arg_0._backend.Func(account=arg_0.index, arg_1=arg_1)", "path": "monero/account.py", "identifier": "Account.new_address", "docstring": "Creates a new address.\n\n        :param label: address label as `str`\n        :rtype: :class:`SubAddress <monero.address.SubAddress>`", "docstring_tokens": ["Creates", "a", "new", "address", "."], "nwo": "monero-ecosystem/monero-python", "score": 0.4699390838066248, "idx": 255932}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/bnlearn.py#L185-L205", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Run the algorithm on data.", "language": "python", "parameters": "(self, data)", "return_statement": "return graph", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "arguments", "[", "'{SCORE}'", "]", "=", "arg_0", ".", "score", "arg_0", ".", "arguments", "[", "'{VERBOSE}'", "]", "=", "str", "(", "arg_0", ".", "verbose", ")", ".", "upper", "(", ")", "arg_0", ".", "arguments", "[", "'{BETA}'", "]", "=", "str", "(", "arg_0", ".", "beta", ")", "arg_0", ".", "arguments", "[", "'{OPTIM}'", "]", "=", "str", "(", "arg_0", ".", "optim", ")", ".", "upper", "(", ")", "arg_0", ".", "arguments", "[", "'{ALPHA}'", "]", "=", "str", "(", "arg_0", ".", "alpha", ")", "arg_3", "=", "arg_0", ".", "_run_bnlearn", "(", "arg_1", ",", "verbose", "=", "arg_0", ".", "verbose", ")", "arg_4", "=", "nx", ".", "DiGraph", "(", ")", "arg_4", ".", "add_edges_from", "(", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Run the algorithm on data.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by the algorithm.\n\n        \"\"\"\n        # Building setup w/ arguments.\n        arg_0.arguments['{SCORE}'] = arg_0.score\n        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()\n        arg_0.arguments['{BETA}'] = str(arg_0.beta)\n        arg_0.arguments['{OPTIM}'] = str(arg_0.optim).upper()\n        arg_0.arguments['{ALPHA}'] = str(arg_0.alpha)\n\n        arg_3 = arg_0._run_bnlearn(arg_1, verbose=arg_0.verbose)\n        arg_4 = nx.DiGraph()\n        arg_4.add_edges_from(arg_3)\n        return arg_4", "path": "cdt/causality/graph/bnlearn.py", "identifier": "BNlearnAlgorithm.create_graph_from_data", "docstring": "Run the algorithm on data.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by the algorithm.", "docstring_tokens": ["Run", "the", "algorithm", "on", "data", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 255933}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_video_intelligence_hook.py#L51-L105", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Performs video annotation.", "language": "python", "parameters": "(\n        self,\n        input_uri=None,\n        input_content=None,\n        features=None,\n        video_context=None,\n        output_uri=None,\n        location=None,\n        retry=None,\n        timeout=None,\n        metadata=None,\n    )", "return_statement": "return client.annotate_video(\n            input_uri=input_uri,\n            input_content=input_content,\n            features=features,\n            video_context=video_context,\n            output_uri=output_uri,\n            location_id=location,\n            retry=retry,\n            timeout=timeout,\n            metadata=metadata,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", ")", ":", "arg_10", "=", "arg_0", ".", "get_conn", "(", ")", "return", "arg_10", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "location_id", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", ")"], "function": "def Func(\n        arg_0,\n        arg_1=None,\n        arg_2=None,\n        arg_3=None,\n        arg_4=None,\n        arg_5=None,\n        arg_6=None,\n        arg_7=None,\n        arg_8=None,\n        arg_9=None,\n    ):\n        \"\"\"\n        Performs video annotation.\n\n        :param input_uri: Input video location. Currently, only Google Cloud Storage URIs are supported,\n            which must be specified in the following format: ``gs://bucket-id/object-id``.\n        :type input_uri: str\n        :param input_content: The video data bytes.\n            If unset, the input video(s) should be specified via ``input_uri``.\n            If set, ``input_uri`` should be unset.\n        :type input_content: bytes\n        :param features: Requested video annotation features.\n        :type features: list[google.cloud.videointelligence_v1.VideoIntelligenceServiceClient.enums.Feature]\n        :param output_uri: Optional, location where the output (in JSON format) should be stored. Currently,\n            only Google Cloud Storage URIs are supported, which must be specified in the following format:\n            ``gs://bucket-id/object-id``.\n        :type output_uri: str\n        :param video_context: Optional, Additional video context and/or feature-specific parameters.\n        :type video_context: dict or google.cloud.videointelligence_v1.types.VideoContext\n        :param location: Optional, cloud region where annotation should take place. Supported cloud regions:\n            us-east1, us-west1, europe-west1, asia-east1.\n            If no region is specified, a region will be determined based on video file location.\n        :type location: str\n        :param retry: Retry object used to determine when/if to retry requests.\n            If None is specified, requests will not be retried.\n        :type retry: google.api_core.retry.Retry\n        :param timeout: Optional, The amount of time, in seconds, to wait for the request to complete.\n            Note that if retry is specified, the timeout applies to each individual attempt.\n        :type timeout: float\n        :param metadata: Optional, Additional metadata that is provided to the method.\n        :type metadata: seq[tuple[str, str]]\n        \"\"\"\n        arg_10 = arg_0.get_conn()\n        return arg_10.Func(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            location_id=arg_6,\n            arg_7=arg_7,\n            arg_8=arg_8,\n            arg_9=arg_9,\n        )", "path": "airflow/contrib/hooks/gcp_video_intelligence_hook.py", "identifier": "CloudVideoIntelligenceHook.annotate_video", "docstring": "Performs video annotation.\n\n        :param input_uri: Input video location. Currently, only Google Cloud Storage URIs are supported,\n            which must be specified in the following format: ``gs://bucket-id/object-id``.\n        :type input_uri: str\n        :param input_content: The video data bytes.\n            If unset, the input video(s) should be specified via ``input_uri``.\n            If set, ``input_uri`` should be unset.\n        :type input_content: bytes\n        :param features: Requested video annotation features.\n        :type features: list[google.cloud.videointelligence_v1.VideoIntelligenceServiceClient.enums.Feature]\n        :param output_uri: Optional, location where the output (in JSON format) should be stored. Currently,\n            only Google Cloud Storage URIs are supported, which must be specified in the following format:\n            ``gs://bucket-id/object-id``.\n        :type output_uri: str\n        :param video_context: Optional, Additional video context and/or feature-specific parameters.\n        :type video_context: dict or google.cloud.videointelligence_v1.types.VideoContext\n        :param location: Optional, cloud region where annotation should take place. Supported cloud regions:\n            us-east1, us-west1, europe-west1, asia-east1.\n            If no region is specified, a region will be determined based on video file location.\n        :type location: str\n        :param retry: Retry object used to determine when/if to retry requests.\n            If None is specified, requests will not be retried.\n        :type retry: google.api_core.retry.Retry\n        :param timeout: Optional, The amount of time, in seconds, to wait for the request to complete.\n            Note that if retry is specified, the timeout applies to each individual attempt.\n        :type timeout: float\n        :param metadata: Optional, Additional metadata that is provided to the method.\n        :type metadata: seq[tuple[str, str]]", "docstring_tokens": ["Performs", "video", "annotation", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 255934}
{"url": "https://github.com/ianare/django-memcache-admin/blob/330db10139ccf04c6137255e23115482b0c89aec/memcache_admin/views.py#L129-L138", "sha": "330db10139ccf04c6137255e23115482b0c89aec", "docstring_summary": "Show server slabs.", "language": "python", "parameters": "(request, server_name)", "return_statement": "return render_to_response('memcache_admin/slabs.html', data, RequestContext(request))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_context_data", "(", "{", "'title'", ":", "_", "(", "'Memcache Slabs for %s'", ")", "%", "arg_1", ",", "'cache_Func'", ":", "_get_cache_Func", "(", "arg_1", ")", ",", "}", ",", "arg_0", ")", "return", "render_to_response", "(", "'memcache_admin/Func.html'", ",", "arg_2", ",", "RequestContext", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Show server Func.\n    \"\"\"\n    arg_2 = _context_data({\n        'title': _('Memcache Slabs for %s') % arg_1,\n        'cache_Func': _get_cache_Func(arg_1),\n    },\n        arg_0)\n    return render_to_response('memcache_admin/Func.html', arg_2, RequestContext(arg_0))", "path": "memcache_admin/views.py", "identifier": "slabs", "docstring": "Show server slabs.", "docstring_tokens": ["Show", "server", "slabs", "."], "nwo": "ianare/django-memcache-admin", "score": 0.18190671880906387, "idx": 255935}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L788-L836", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "A truncated raised cosine pulse used in digital communications.", "language": "python", "parameters": "(Ns,alpha,M=6)", "return_statement": "return b", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "6", ")", ":", "arg_3", "=", "np", ".", "arange", "(", "-", "arg_2", "*", "arg_0", ",", "arg_2", "*", "arg_0", "+", "1", ")", "arg_4", "=", "np", ".", "zeros", "(", "len", "(", "arg_3", ")", ")", "arg_5", "=", "arg_1", "arg_0", "*=", "1.0", "for", "arg_6", "in", "range", "(", "len", "(", "arg_3", ")", ")", ":", "if", "(", "1", "-", "4", "*", "(", "arg_5", "*", "arg_3", "[", "arg_6", "]", "/", "arg_0", ")", "**", "2", ")", "==", "0", ":", "arg_4", "[", "arg_6", "]", "=", "np", ".", "pi", "/", "4", "*", "np", ".", "sinc", "(", "1", "/", "(", "2.", "*", "arg_5", ")", ")", "else", ":", "arg_4", "[", "arg_6", "]", "=", "np", ".", "sinc", "(", "arg_3", "[", "arg_6", "]", "/", "arg_0", ")", "*", "np", ".", "cos", "(", "np", ".", "pi", "*", "arg_5", "*", "arg_3", "[", "arg_6", "]", "/", "arg_0", ")", "/", "(", "1", "-", "4", "*", "(", "arg_5", "*", "arg_3", "[", "arg_6", "]", "/", "arg_0", ")", "**", "2", ")", "return", "arg_4"], "function": "def Func(arg_0,arg_1,arg_2=6):\n    \"\"\"\n    A truncated raised cosine pulse used in digital communications.\n\n    The pulse shaping factor :math:`0 < \\\\alpha < 1` is required as well as the\n    truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.\n\n    Parameters\n    ----------\n    Ns : number of samples per symbol\n    alpha : excess bandwidth factor on (0, 1), e.g., 0.35\n    M : equals RC one-sided symbol truncation factor\n\n    Returns\n    -------\n    b : ndarray containing the pulse shape\n\n    See Also\n    --------\n    sqrt_Func\n\n    Notes\n    -----\n    The pulse shape b is typically used as the FIR filter coefficients\n    when forming a pulse shaped digital communications waveform.\n\n    Examples\n    --------\n    Ten samples per symbol and :math:`\\\\alpha = 0.35`.\n\n    >>> import matplotlib.pyplot as plt\n    >>> from sk_dsp_comm.digitalcom import Func\n    >>> from numpy import arange\n    >>> b = Func(10,0.35)\n    >>> n = arange(-10*6,10*6+1)\n    >>> plt.stem(n,b)\n    >>> plt.show()\n    \"\"\"\n    # Design the filter\n    arg_3 = np.arange(-arg_2*arg_0,arg_2*arg_0+1)\n    arg_4 = np.zeros(len(arg_3))\n    arg_5 = arg_1\n    arg_0 *= 1.0\n    for arg_6 in range(len(arg_3)):\n        if (1 - 4*(arg_5*arg_3[arg_6]/arg_0)**2) == 0:\n            arg_4[arg_6] = np.pi/4*np.sinc(1/(2.*arg_5))\n        else:\n            arg_4[arg_6] = np.sinc(arg_3[arg_6]/arg_0)*np.cos(np.pi*arg_5*arg_3[arg_6]/arg_0)/(1 - 4*(arg_5*arg_3[arg_6]/arg_0)**2)\n    return arg_4", "path": "sk_dsp_comm/digitalcom.py", "identifier": "rc_imp", "docstring": "A truncated raised cosine pulse used in digital communications.\n\n    The pulse shaping factor :math:`0 < \\\\alpha < 1` is required as well as the\n    truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.\n\n    Parameters\n    ----------\n    Ns : number of samples per symbol\n    alpha : excess bandwidth factor on (0, 1), e.g., 0.35\n    M : equals RC one-sided symbol truncation factor\n\n    Returns\n    -------\n    b : ndarray containing the pulse shape\n\n    See Also\n    --------\n    sqrt_rc_imp\n\n    Notes\n    -----\n    The pulse shape b is typically used as the FIR filter coefficients\n    when forming a pulse shaped digital communications waveform.\n\n    Examples\n    --------\n    Ten samples per symbol and :math:`\\\\alpha = 0.35`.\n\n    >>> import matplotlib.pyplot as plt\n    >>> from sk_dsp_comm.digitalcom import rc_imp\n    >>> from numpy import arange\n    >>> b = rc_imp(10,0.35)\n    >>> n = arange(-10*6,10*6+1)\n    >>> plt.stem(n,b)\n    >>> plt.show()", "docstring_tokens": ["A", "truncated", "raised", "cosine", "pulse", "used", "in", "digital", "communications", "."], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 255936}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/abi.py#L24-L40", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Calculate `static` type size", "language": "python", "parameters": "(ty)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "[", "0", "]", "in", "(", "'int'", ",", "'uint'", ",", "'bytesM'", ",", "'function'", ")", ":", "return", "32", "elif", "arg_0", "[", "0", "]", "in", "(", "'tuple'", ")", ":", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", "[", "1", "]", ":", "arg_1", "+=", "ABI", ".", "Func", "(", "arg_2", ")", "return", "arg_1", "elif", "arg_0", "[", "0", "]", "in", "(", "'array'", ")", ":", "arg_3", "=", "arg_0", "[", "1", "]", "arg_1", "=", "32", "return", "arg_1", "elif", "arg_0", "[", "0", "]", "in", "(", "'bytes'", ",", "'string'", ")", ":", "arg_1", "=", "32", "return", "arg_1", "raise", "ValueError"], "function": "def Func(arg_0):\n        \"\"\" Calculate `static` type size \"\"\"\n        if arg_0[0] in ('int', 'uint', 'bytesM', 'function'):\n            return 32\n        elif arg_0[0] in ('tuple'):\n            arg_1 = 0\n            for arg_2 in arg_0[1]:\n                arg_1 += ABI.Func(arg_2)\n            return arg_1\n        elif arg_0[0] in ('array'):\n            arg_3 = arg_0[1]\n            arg_1 = 32  # offset link\n            return arg_1\n        elif arg_0[0] in ('bytes', 'string'):\n            arg_1 = 32  # offset link\n            return arg_1\n        raise ValueError", "path": "manticore/ethereum/abi.py", "identifier": "ABI._type_size", "docstring": "Calculate `static` type size", "docstring_tokens": ["Calculate", "static", "type", "size"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 255937}
{"url": "https://github.com/koenedaele/skosprovider/blob/7304a37953978ca8227febc2d3cc2b2be178f215/skosprovider/skos.py#L477-L530", "sha": "7304a37953978ca8227febc2d3cc2b2be178f215", "docstring_summary": "Provide a label for a list of labels.", "language": "python", "parameters": "(labels=[], language='any', sortLabel=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "[", "]", ",", "arg_1", "=", "'any'", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_0", ":", "return", "None", "if", "not", "arg_1", ":", "arg_1", "=", "'und'", "arg_0", "=", "[", "dict_to_Func", "(", "arg_3", ")", "for", "arg_3", "in", "arg_0", "]", "arg_3", "=", "False", "if", "arg_2", ":", "arg_3", "=", "find_best_Func_for_type", "(", "arg_0", ",", "arg_1", ",", "'sortLabel'", ")", "if", "not", "arg_3", ":", "arg_3", "=", "find_best_Func_for_type", "(", "arg_0", ",", "arg_1", ",", "'prefLabel'", ")", "if", "not", "arg_3", ":", "arg_3", "=", "find_best_Func_for_type", "(", "arg_0", ",", "arg_1", ",", "'altLabel'", ")", "if", "arg_3", ":", "return", "arg_3", "else", ":", "return", "Func", "(", "arg_0", ",", "'any'", ",", "arg_2", ")", "if", "arg_1", "!=", "'any'", "else", "None"], "function": "def Func(arg_0=[], arg_1='any', arg_2=False):\n    '''\n    Provide a Func for a list of Funcs.\n\n    The items in the list of Funcs are assumed to be either instances of\n    :class:`Label`, or dicts with at least the key `Func` in them. These will\n    be passed to the :func:`dict_to_Func` function.\n\n    This method tries to find a Func by looking if there's\n    a pref Func for the specified language. If there's no pref Func,\n    it looks for an alt Func. It disregards hidden Funcs.\n\n    While matching languages, preference will be given to exact matches. But,\n    if no exact match is present, an inexact match will be attempted. This might\n    be because a Func in language `nl-BE` is being requested, but only `nl` or\n    even `nl-NL` is present. Similarly, when requesting `nl`, a Func with\n    language `nl-NL` or even `nl-Latn-NL` will also be considered,\n    providing no Func is present that has an exact match with the\n    requested language.\n\n    If language 'any' was specified, all Funcs will be considered,\n    regardless of language.\n\n    To find a Func without a specified language, pass `None` as language.\n\n    If a language or None was specified, and no Func could be found, this\n    method will automatically try to find a Func in some other language.\n\n    Finally, if no Func could be found, None is returned.\n\n    :param string language: The preferred language to receive the Func in. This\n        should be a valid IANA language tag.\n    :param boolean sortLabel: Should sortLabels be considered or not? If True,\n        sortLabels will be preferred over prefLabels. Bear in mind that these\n        are still language dependent. So, it's possible to have a different\n        sortLabel per language.\n    :rtype: A :class:`Label` or `None` if no Func could be found.\n    '''\n    if not arg_0:\n        return None\n    if not arg_1:\n        arg_1 = 'und'\n    arg_0 = [dict_to_Func(arg_3) for arg_3 in arg_0]\n    arg_3 = False\n    if arg_2:\n        arg_3 = find_best_Func_for_type(arg_0, arg_1, 'sortLabel')\n    if not arg_3:\n        arg_3 = find_best_Func_for_type(arg_0, arg_1, 'prefLabel')\n    if not arg_3:\n        arg_3 = find_best_Func_for_type(arg_0, arg_1, 'altLabel')\n    if arg_3:\n        return arg_3\n    else:\n        return Func(arg_0, 'any', arg_2) if arg_1 != 'any' else None", "path": "skosprovider/skos.py", "identifier": "label", "docstring": "Provide a label for a list of labels.\n\n    The items in the list of labels are assumed to be either instances of\n    :class:`Label`, or dicts with at least the key `label` in them. These will\n    be passed to the :func:`dict_to_label` function.\n\n    This method tries to find a label by looking if there's\n    a pref label for the specified language. If there's no pref label,\n    it looks for an alt label. It disregards hidden labels.\n\n    While matching languages, preference will be given to exact matches. But,\n    if no exact match is present, an inexact match will be attempted. This might\n    be because a label in language `nl-BE` is being requested, but only `nl` or\n    even `nl-NL` is present. Similarly, when requesting `nl`, a label with\n    language `nl-NL` or even `nl-Latn-NL` will also be considered,\n    providing no label is present that has an exact match with the\n    requested language.\n\n    If language 'any' was specified, all labels will be considered,\n    regardless of language.\n\n    To find a label without a specified language, pass `None` as language.\n\n    If a language or None was specified, and no label could be found, this\n    method will automatically try to find a label in some other language.\n\n    Finally, if no label could be found, None is returned.\n\n    :param string language: The preferred language to receive the label in. This\n        should be a valid IANA language tag.\n    :param boolean sortLabel: Should sortLabels be considered or not? If True,\n        sortLabels will be preferred over prefLabels. Bear in mind that these\n        are still language dependent. So, it's possible to have a different\n        sortLabel per language.\n    :rtype: A :class:`Label` or `None` if no label could be found.", "docstring_tokens": ["Provide", "a", "label", "for", "a", "list", "of", "labels", "."], "nwo": "koenedaele/skosprovider", "score": 0.3726785709016597, "idx": 255938}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/leakcheck/crypto.py#L24-L33", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Call the method repeatedly such that it will raise an exception.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "xrange", "(", "arg_0", ".", "iterations", ")", ":", "arg_2", "=", "X509", "(", ")", "try", ":", "arg_2", ".", "get_pubkey", "(", ")", "except", "Error", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"\n        Call the method repeatedly such that it will raise an exception.\n        \"\"\"\n        for arg_1 in xrange(arg_0.iterations):\n            arg_2 = X509()\n            try:\n                arg_2.get_pubkey()\n            except Error:\n                pass", "path": "leakcheck/crypto.py", "identifier": "Checker_X509_get_pubkey.check_exception", "docstring": "Call the method repeatedly such that it will raise an exception.", "docstring_tokens": ["Call", "the", "method", "repeatedly", "such", "that", "it", "will", "raise", "an", "exception", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 255939}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L215-L222", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Adds a menu to the list of menus.", "language": "python", "parameters": "(self,menu)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "menus", "[", "arg_1", ".", "name", "]", "=", "arg_1", "arg_0", ".", "peng", ".", "sendEvent", "(", "\"peng3d:window.menu.add\"", ",", "{", "\"peng\"", ":", "arg_0", ".", "peng", ",", "\"window\"", ":", "arg_0", ",", "\"menu\"", ":", "arg_1", "}", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Adds a menu to the list of menus.\n        \"\"\"\n        # If there is no menu selected currently, this menu will automatically be made active.\n        # Add the line above to the docstring if fixed\n        arg_0.menus[arg_1.name]=arg_1\n        arg_0.peng.sendEvent(\"peng3d:window.menu.add\",{\"peng\":arg_0.peng,\"window\":arg_0,\"menu\":arg_1})", "path": "peng3d/window.py", "identifier": "PengWindow.addMenu", "docstring": "Adds a menu to the list of menus.", "docstring_tokens": ["Adds", "a", "menu", "to", "the", "list", "of", "menus", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 255940}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L294-L306", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get information about a player's chest cycle", "language": "python", "parameters": "(self, tag: crtag, timeout: int=None)", "return_statement": "return self._get_model(url, timeout=timeout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "api", ".", "PLAYER", "+", "'/'", "+", "arg_1", "+", "'/upcomingchests'", "return", "arg_0", ".", "_get_model", "(", "arg_5", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4=None):\n        \"\"\"Get information about a player's chest cycle\n\n        Parameters\n        ----------\n        tag: str\n            A valid tournament tag. Minimum length: 3\n            Valid characters: 0289PYLQGRJCUV\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_5 = arg_0.api.PLAYER + '/' + arg_1 + '/upcomingchests'\n        return arg_0._get_model(arg_5, arg_3=arg_3)", "path": "clashroyale/official_api/client.py", "identifier": "Client.get_player_chests", "docstring": "Get information about a player's chest cycle\n\n        Parameters\n        ----------\n        tag: str\n            A valid tournament tag. Minimum length: 3\n            Valid characters: 0289PYLQGRJCUV\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "information", "about", "a", "player", "s", "chest", "cycle"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 255941}
{"url": "https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L273-L279", "sha": "bb1990cf1460ae42f2dde75f2291625ddac2c0e4", "docstring_summary": "Read the maximum volume level of the device.", "language": "python", "parameters": "(self)", "return_statement": "return self.__volume_steps", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "__volume_steps", ":", "arg_0", ".", "__volume_steps", "=", "yield", "from", "arg_0", ".", "handle_int", "(", "arg_0", ".", "API", ".", "get", "(", "'volume_steps'", ")", ")", "return", "arg_0", ".", "__volume_steps"], "function": "def Func(arg_0):\n        \"\"\"Read the maximum volume level of the device.\"\"\"\n        if not arg_0.__volume_steps:\n            arg_0.__volume_steps = yield from arg_0.handle_int(\n                arg_0.API.get('volume_steps'))\n\n        return arg_0.__volume_steps", "path": "afsapi/__init__.py", "identifier": "AFSAPI.get_volume_steps", "docstring": "Read the maximum volume level of the device.", "docstring_tokens": ["Read", "the", "maximum", "volume", "level", "of", "the", "device", "."], "nwo": "zhelev/python-afsapi", "score": 0.16638194949711382, "idx": 255942}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L381-L410", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Common initialization for all BackgroundJob objects", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "[", "'call'", ",", "'strform'", "]", ":", "assert", "hasattr", "(", "arg_0", ",", "arg_1", ")", ",", "\"Missing attribute <%s>\"", "%", "arg_1", "arg_0", ".", "num", "=", "None", "arg_0", ".", "status", "=", "BackgroundJobBase", ".", "stat_created", "arg_0", ".", "stat_code", "=", "BackgroundJobBase", ".", "stat_created_c", "arg_0", ".", "finished", "=", "False", "arg_0", ".", "result", "=", "'<BackgroundJob has not completed>'", "try", ":", "arg_7", "=", "get_ipython", "(", ")", ".", "InteractiveTB", ".", "text", "except", ":", "arg_7", "=", "AutoFormattedTB", "(", "mode", "=", "'Context'", ",", "color_scheme", "=", "'NoColor'", ",", "tb_offset", "=", "1", ")", ".", "text", "arg_0", ".", "_make_tb", "=", "lambda", ":", "arg_7", "(", "None", ",", "None", ",", "None", ")", "arg_0", ".", "_tb", "=", "None", "threading", ".", "Thread", ".", "_Func__", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"Common initialization for all BackgroundJob objects\"\"\"\n        \n        for arg_1 in ['call','strform']:\n            assert hasattr(arg_0,arg_1), \"Missing attribute <%s>\" % arg_1\n        \n        # The num tag can be set by an external job manager\n        arg_0.num = None\n      \n        arg_0.status    = BackgroundJobBase.stat_created\n        arg_0.stat_code = BackgroundJobBase.stat_created_c\n        arg_0.finished  = False\n        arg_0.result    = '<BackgroundJob has not completed>'\n        \n        # reuse the ipython traceback handler if we can get to it, otherwise\n        # make a new one\n        try:\n            arg_7 = get_ipython().InteractiveTB.text\n        except:\n            arg_7 = AutoFormattedTB(mode = 'Context',\n                                      color_scheme='NoColor',\n                                      tb_offset = 1).text\n        # Note that the actual API for text() requires the three args to be\n        # passed in, so we wrap it in a simple lambda.\n        arg_0._make_tb = lambda : arg_7(None, None, None)\n\n        # Hold a formatted traceback if one is generated.\n        arg_0._tb = None\n        \n        threading.Thread._Func__(arg_0)", "path": "environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py", "identifier": "BackgroundJobBase._init", "docstring": "Common initialization for all BackgroundJob objects", "docstring_tokens": ["Common", "initialization", "for", "all", "BackgroundJob", "objects"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255943}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/kgp.py#L162-L174", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "choose a random child element of a node\r\n        \r\n        This is a utility method used by do_xref and do_choice.", "language": "python", "parameters": "(self, node)", "return_statement": "return chosen", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "arg_4", "for", "arg_4", "in", "arg_1", ".", "childNodes", "if", "arg_4", ".", "nodeType", "==", "arg_4", ".", "ELEMENT_NODE", "]", "arg_3", "=", "random", ".", "choice", "(", "arg_2", ")", "if", "_debug", ":", "sys", ".", "stderr", ".", "write", "(", "'%s available choices: %s\\n'", "%", "(", "len", "(", "arg_2", ")", ",", "[", "arg_4", ".", "toxml", "(", ")", "for", "arg_4", "in", "arg_2", "]", ")", ")", "sys", ".", "stderr", ".", "write", "(", "'Chosen: %s\\n'", "%", "arg_3", ".", "toxml", "(", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"choose a random child element of a node\r\n        \r\n        This is a utility method used by do_xref and do_choice.\r\n        \"\"\"\r\n        arg_2 = [arg_4 for arg_4 in arg_1.childNodes\r\n                   if arg_4.nodeType == arg_4.ELEMENT_NODE]\r\n        arg_3 = random.choice(arg_2)\r\n        if _debug:\r\n            sys.stderr.write('%s available choices: %s\\n' % \\\r\n                (len(arg_2), [arg_4.toxml() for arg_4 in arg_2]))\r\n            sys.stderr.write('Chosen: %s\\n' % arg_3.toxml())\r\n        return arg_3", "path": "shoebot/kgp.py", "identifier": "KantGenerator.randomChildElement", "docstring": "choose a random child element of a node\r\n        \r\n        This is a utility method used by do_xref and do_choice.", "docstring_tokens": ["choose", "a", "random", "child", "element", "of", "a", "node", "This", "is", "a", "utility", "method", "used", "by", "do_xref", "and", "do_choice", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 255944}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L51-L70", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Convert the list of bibrecs into one MARCXML.", "language": "python", "parameters": "(cls, records)", "return_statement": "return \"\\n\".join(out)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "\"<collection>\"", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", "(", "arg_3", ")", "arg_2", ".", "append", "(", "arg_4", ".", "convert", "(", ")", ")", "arg_2", ".", "append", "(", "\"</collection>\"", ")", "return", "\"\\n\"", ".", "join", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert the list of bibrecs into one MARCXML.\n\n        >>> from harvestingkit.bibrecord import BibRecordPackage\n        >>> from harvestingkit.inspire_cds_package import Inspire2CDS\n        >>> bibrecs = BibRecordPackage(\"inspire.xml\")\n        >>> bibrecs.parse()\n        >>> xml = Inspire2CDS.Func(bibrecs.get_records())\n\n        :param records: list of BibRecord dicts\n        :type records: list\n\n        :returns: MARCXML as string\n        \"\"\"\n        arg_2 = [\"<collection>\"]\n        for arg_3 in arg_1:\n            arg_4 = arg_0(arg_3)\n            arg_2.append(arg_4.convert())\n        arg_2.append(\"</collection>\")\n        return \"\\n\".join(arg_2)", "path": "harvestingkit/inspire_cds_package/base.py", "identifier": "MARCXMLConversion.convert_all", "docstring": "Convert the list of bibrecs into one MARCXML.\n\n        >>> from harvestingkit.bibrecord import BibRecordPackage\n        >>> from harvestingkit.inspire_cds_package import Inspire2CDS\n        >>> bibrecs = BibRecordPackage(\"inspire.xml\")\n        >>> bibrecs.parse()\n        >>> xml = Inspire2CDS.convert_all(bibrecs.get_records())\n\n        :param records: list of BibRecord dicts\n        :type records: list\n\n        :returns: MARCXML as string", "docstring_tokens": ["Convert", "the", "list", "of", "bibrecs", "into", "one", "MARCXML", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 255945}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/semilocal_linear_trend.py#L241-L263", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build the transition matrix for a semi-local linear trend model.", "language": "python", "parameters": "(autoregressive_coef)", "return_statement": "return tf.linalg.LinearOperatorFullMatrix(\n      fixed_entries + bottom_right_entry)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tf", ".", "constant", "(", "[", "[", "1.", ",", "1.", "]", ",", "[", "0.", ",", "0.", "]", "]", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_2", "=", "tf", ".", "constant", "(", "[", "[", "0.", ",", "0.", "]", ",", "[", "0.", ",", "1.", "]", "]", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_3", "=", "(", "arg_0", "[", "...", ",", "tf", ".", "newaxis", ",", "tf", ".", "newaxis", "]", "*", "arg_2", ")", "return", "tf", ".", "linalg", ".", "LinearOperatorFullMatrix", "(", "arg_1", "+", "arg_3", ")"], "function": "def Func(arg_0):\n  \"\"\"Build the transition matrix for a semi-local linear trend model.\"\"\"\n  # We want to write the following 2 x 2 matrix:\n  #  [[1., 1., ],    # level(t+1) = level(t) + slope(t)\n  #   [0., ar_coef], # slope(t+1) = ar_coef * slope(t)\n  # but it's slightly tricky to properly incorporate the batch shape of\n  # autoregressive_coef. E.g., if autoregressive_coef has shape [4,6], we want\n  # to return shape [4, 6, 2, 2]. We do this by breaking the matrix into its\n  # fixed entries, written explicitly, and then the autoregressive_coef part\n  # which we add in after using a mask to broadcast to the correct matrix shape.\n\n  arg_1 = tf.constant(\n      [[1., 1.],\n       [0., 0.]],\n      dtype=arg_0.dtype)\n\n  arg_2 = tf.constant([[0., 0.],\n                                          [0., 1.]],\n                                         dtype=arg_0.dtype)\n  arg_3 = (arg_0[..., tf.newaxis, tf.newaxis] *\n                        arg_2)\n  return tf.linalg.LinearOperatorFullMatrix(\n      arg_1 + arg_3)", "path": "tensorflow_probability/python/sts/semilocal_linear_trend.py", "identifier": "semilocal_linear_trend_transition_matrix", "docstring": "Build the transition matrix for a semi-local linear trend model.", "docstring_tokens": ["Build", "the", "transition", "matrix", "for", "a", "semi", "-", "local", "linear", "trend", "model", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 255946}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_layers.py#L51-L58", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Renders the list of layers to add to the map.", "language": "python", "parameters": "(self)", "return_statement": "return layers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "[", "arg_0", ".", "_layer_def", "(", "style", ")", "for", "style", "in", "arg_0", ".", "styles", "]", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\" Renders the list of layers to add to the map.\n\n            Returns:\n                layers (list): list of layer entries suitable for use in mapbox-gl 'map.addLayer()' call\n        \"\"\"\n        Func = [arg_0._layer_def(style) for style in arg_0.styles]\n        return Func", "path": "gbdxtools/vector_layers.py", "identifier": "VectorLayer.layers", "docstring": "Renders the list of layers to add to the map.\n\n            Returns:\n                layers (list): list of layer entries suitable for use in mapbox-gl 'map.addLayer()' call", "docstring_tokens": ["Renders", "the", "list", "of", "layers", "to", "add", "to", "the", "map", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 255947}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L47-L56", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Modify an existing message.", "language": "python", "parameters": "(self, message)", "return_statement": "return self.message_from_json(data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"/2/messages/%s\"", "%", "arg_1", ".", "message_id", "arg_3", "=", "arg_0", ".", "_put_resource", "(", "arg_2", ",", "arg_1", ".", "json_data", "(", ")", ")", "return", "arg_0", ".", "message_from_json", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Modify an existing message.\n\n        http://dev.wheniwork.com/#create/update-message\n        \"\"\"\n        arg_2 = \"/2/messages/%s\" % arg_1.message_id\n\n        arg_3 = arg_0._put_resource(arg_2, arg_1.json_data())\n        return arg_0.message_from_json(arg_3)", "path": "uw_wheniwork/messages.py", "identifier": "Messages.update_message", "docstring": "Modify an existing message.\n\n        http://dev.wheniwork.com/#create/update-message", "docstring_tokens": ["Modify", "an", "existing", "message", "."], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 255948}
{"url": "https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/genesis.py#L51-L106", "sha": "dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a", "docstring_summary": "Return a list of Data objects for given project.", "language": "python", "parameters": "(self, project)", "return_statement": "return projobjects[project_id]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "cache", "[", "'project_objects'", "]", "arg_3", "=", "arg_0", ".", "cache", "[", "'objects'", "]", "arg_4", "=", "str", "(", "arg_1", ")", "if", "not", "re", ".", "match", "(", "'^[0-9a-fA-F]{24}$'", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "api", ".", "case", ".", "get", "(", "url_slug", "=", "arg_4", ")", "[", "'objects'", "]", "if", "len", "(", "arg_5", ")", "!=", "1", ":", "raise", "ValueError", "(", "msg", "=", "'Attribute project not a slug or ObjectId: {}'", ".", "format", "(", "arg_4", ")", ")", "arg_4", "=", "str", "(", "arg_5", "[", "0", "]", "[", "'id'", "]", ")", "if", "arg_4", "not", "in", "arg_2", ":", "arg_2", "[", "arg_4", "]", "=", "[", "]", "arg_6", "=", "arg_0", ".", "api", ".", "data", ".", "get", "(", "case_ids__contains", "=", "arg_4", ")", "[", "'objects'", "]", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "arg_7", "[", "'id'", "]", "if", "arg_8", "in", "arg_3", ":", "arg_3", "[", "arg_8", "]", ".", "update", "(", "arg_7", ")", "else", ":", "arg_3", "[", "arg_8", "]", "=", "GenData", "(", "arg_7", ",", "arg_0", ")", "arg_2", "[", "arg_4", "]", ".", "append", "(", "arg_3", "[", "arg_8", "]", ")", "for", "arg_7", "in", "arg_2", "[", "arg_4", "]", ":", "while", "True", ":", "arg_9", "=", "{", "}", "arg_10", "=", "[", "]", "for", "arg_11", ",", "arg_12", "in", "arg_7", ".", "annotation", ".", "items", "(", ")", ":", "if", "arg_12", "[", "'type'", "]", ".", "startswith", "(", "'data:'", ")", ":", "if", "arg_12", "[", "'value'", "]", "in", "arg_0", ".", "cache", "[", "'objects'", "]", ":", "arg_13", "=", "arg_0", ".", "cache", "[", "'objects'", "]", "[", "arg_12", "[", "'value'", "]", "]", ".", "annotation", "arg_9", ".", "update", "(", "{", "arg_11", "+", "'.'", "+", "arg_14", ":", "arg_15", "for", "arg_14", ",", "arg_15", "in", "arg_13", ".", "items", "(", ")", "}", ")", "arg_10", ".", "append", "(", "arg_11", ")", "if", "arg_9", ":", "arg_7", ".", "annotation", ".", "update", "(", "arg_9", ")", "for", "arg_11", "in", "arg_10", ":", "del", "arg_7", ".", "annotation", "[", "arg_11", "]", "else", ":", "break", "return", "arg_2", "[", "arg_4", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a list of Data objects for given project.\n\n        :param project: ObjectId or slug of Genesis project\n        :type project: string\n        :rtype: list of Data objects\n\n        \"\"\"\n        arg_2 = arg_0.cache['project_objects']\n        arg_3 = arg_0.cache['objects']\n        arg_4 = str(arg_1)\n\n        if not re.match('^[0-9a-fA-F]{24}$', arg_4):\n            # project_id is a slug\n            arg_5 = arg_0.api.case.get(url_slug=arg_4)['objects']\n            if len(arg_5) != 1:\n                raise ValueError(msg='Attribute project not a slug or ObjectId: {}'.format(arg_4))\n\n            arg_4 = str(arg_5[0]['id'])\n\n        if arg_4 not in arg_2:\n            arg_2[arg_4] = []\n            arg_6 = arg_0.api.data.get(case_ids__contains=arg_4)['objects']\n            for arg_7 in arg_6:\n                arg_8 = arg_7['id']\n                if arg_8 in arg_3:\n                    # Update existing object\n                    arg_3[arg_8].update(arg_7)\n                else:\n                    # Insert new object\n                    arg_3[arg_8] = GenData(arg_7, arg_0)\n\n                arg_2[arg_4].append(arg_3[arg_8])\n\n            # Hydrate reference fields\n            for arg_7 in arg_2[arg_4]:\n                while True:\n                    arg_9 = {}\n                    arg_10 = []\n                    for arg_11, arg_12 in arg_7.annotation.items():\n                        if arg_12['type'].startswith('data:'):\n                            # Referenced data object found\n                            # Copy annotation\n                            if arg_12['value'] in arg_0.cache['objects']:\n                                arg_13 = arg_0.cache['objects'][arg_12['value']].annotation\n                                arg_9.update({arg_11 + '.' + arg_14: arg_15 for arg_14, arg_15 in arg_13.items()})\n\n                            arg_10.append(arg_11)\n                    if arg_9:\n                        arg_7.annotation.update(arg_9)\n                        for arg_11 in arg_10:\n                            del arg_7.annotation[arg_11]\n                    else:\n                        break\n\n        return arg_2[arg_4]", "path": "genesis/genesis.py", "identifier": "Genesis.project_data", "docstring": "Return a list of Data objects for given project.\n\n        :param project: ObjectId or slug of Genesis project\n        :type project: string\n        :rtype: list of Data objects", "docstring_tokens": ["Return", "a", "list", "of", "Data", "objects", "for", "given", "project", "."], "nwo": "genialis/genesis-pyapi", "score": 0.27692002097430746, "idx": 255949}
{"url": "https://github.com/orangain/scrapy-s3pipeline/blob/6301a3a057da6407b04a09c717498026f88706a4/s3pipeline/pipelines.py#L56-L61", "sha": "6301a3a057da6407b04a09c717498026f88706a4", "docstring_summary": "Callback function when spider is open.", "language": "python", "parameters": "(self, spider)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "ts", "=", "datetime", ".", "utcnow", "(", ")", ".", "replace", "(", "microsecond", "=", "0", ")", ".", "isoformat", "(", ")", ".", "replace", "(", "':'", ",", "'-'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Callback function when spider is open.\n        \"\"\"\n        # Store timestamp to replace {time} in S3PIPELINE_URL\n        arg_0.ts = datetime.utcnow().replace(microsecond=0).isoformat().replace(':', '-')", "path": "s3pipeline/pipelines.py", "identifier": "S3Pipeline.open_spider", "docstring": "Callback function when spider is open.", "docstring_tokens": ["Callback", "function", "when", "spider", "is", "open", "."], "nwo": "orangain/scrapy-s3pipeline", "score": 0.34548235935873706, "idx": 255950}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L222-L288", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Decide whether to trace execution in `filename`, with a reason.", "language": "python", "parameters": "(self, filename, frame)", "return_statement": "return canonical, \"because we love you\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", ":", "return", "None", ",", "\"empty string isn't a filename\"", "if", "arg_1", ".", "startswith", "(", "'<'", ")", ":", "return", "None", ",", "\"not a real filename\"", "arg_0", ".", "_check_for_packages", "(", ")", "arg_3", "=", "arg_2", ".", "f_globals", ".", "get", "(", "'__file__'", ")", "if", "arg_3", ":", "arg_1", "=", "arg_0", ".", "_source_for_file", "(", "arg_3", ")", "if", "arg_1", ".", "endswith", "(", "\"$py.class\"", ")", ":", "arg_1", "=", "arg_1", "[", ":", "-", "9", "]", "+", "\".py\"", "arg_4", "=", "arg_0", ".", "file_locator", ".", "canonical_filename", "(", "arg_1", ")", "if", "arg_0", ".", "source_match", ":", "if", "not", "arg_0", ".", "source_match", ".", "match", "(", "arg_4", ")", ":", "return", "None", ",", "\"falls outside the --source trees\"", "elif", "arg_0", ".", "include_match", ":", "if", "not", "arg_0", ".", "include_match", ".", "match", "(", "arg_4", ")", ":", "return", "None", ",", "\"falls outside the --include trees\"", "else", ":", "if", "arg_0", ".", "pylib_match", "and", "arg_0", ".", "pylib_match", ".", "match", "(", "arg_4", ")", ":", "return", "None", ",", "\"is in the stdlib\"", "if", "arg_0", ".", "cover_match", "and", "arg_0", ".", "cover_match", ".", "match", "(", "arg_4", ")", ":", "return", "None", ",", "\"is part of coverage.py\"", "if", "arg_0", ".", "omit_match", "and", "arg_0", ".", "omit_match", ".", "match", "(", "arg_4", ")", ":", "return", "None", ",", "\"is inside an --omit pattern\"", "return", "arg_4", ",", "\"because we love you\""], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Decide whether to trace execution in `filename`, with a reason.\n\n        This function is called from the trace function.  As each new file name\n        is encountered, this function determines whether it is traced or not.\n\n        Returns a pair of values:  the first indicates whether the file should\n        be traced: it's a canonicalized filename if it should be traced, None\n        if it should not.  The second value is a string, the resason for the\n        decision.\n\n        \"\"\"\n        if not arg_1:\n            # Empty string is pretty useless\n            return None, \"empty string isn't a filename\"\n\n        if arg_1.startswith('<'):\n            # Lots of non-file execution is represented with artificial\n            # filenames like \"<string>\", \"<doctest readme.txt[0]>\", or\n            # \"<exec_function>\".  Don't ever trace these executions, since we\n            # can't do anything with the data later anyway.\n            return None, \"not a real filename\"\n\n        arg_0._check_for_packages()\n\n        # Compiled Python files have two filenames: frame.f_code.co_filename is\n        # the filename at the time the .pyc was compiled.  The second name is\n        # __file__, which is where the .pyc was actually loaded from.  Since\n        # .pyc files can be moved after compilation (for example, by being\n        # installed), we look for __file__ in the frame and prefer it to the\n        # co_filename value.\n        arg_3 = arg_2.f_globals.get('__file__')\n        if arg_3:\n            arg_1 = arg_0._source_for_file(arg_3)\n\n        # Jython reports the .class file to the tracer, use the source file.\n        if arg_1.endswith(\"$py.class\"):\n            arg_1 = arg_1[:-9] + \".py\"\n\n        arg_4 = arg_0.file_locator.canonical_filename(arg_1)\n\n        # If the user specified source or include, then that's authoritative\n        # about the outer bound of what to measure and we don't have to apply\n        # any canned exclusions. If they didn't, then we have to exclude the\n        # stdlib and coverage.py directories.\n        if arg_0.source_match:\n            if not arg_0.source_match.match(arg_4):\n                return None, \"falls outside the --source trees\"\n        elif arg_0.include_match:\n            if not arg_0.include_match.match(arg_4):\n                return None, \"falls outside the --include trees\"\n        else:\n            # If we aren't supposed to trace installed code, then check if this\n            # is near the Python standard library and skip it if so.\n            if arg_0.pylib_match and arg_0.pylib_match.match(arg_4):\n                return None, \"is in the stdlib\"\n\n            # We exclude the coverage code itself, since a little of it will be\n            # measured otherwise.\n            if arg_0.cover_match and arg_0.cover_match.match(arg_4):\n                return None, \"is part of coverage.py\"\n\n        # Check the file against the omit pattern.\n        if arg_0.omit_match and arg_0.omit_match.match(arg_4):\n            return None, \"is inside an --omit pattern\"\n\n        return arg_4, \"because we love you\"", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage._should_trace_with_reason", "docstring": "Decide whether to trace execution in `filename`, with a reason.\n\n        This function is called from the trace function.  As each new file name\n        is encountered, this function determines whether it is traced or not.\n\n        Returns a pair of values:  the first indicates whether the file should\n        be traced: it's a canonicalized filename if it should be traced, None\n        if it should not.  The second value is a string, the resason for the\n        decision.", "docstring_tokens": ["Decide", "whether", "to", "trace", "execution", "in", "filename", "with", "a", "reason", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 255951}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/account.py#L415-L441", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Create a new list.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_path", "(", "'Func'", ")", "arg_1", ".", "update", "(", "{", "'session_id'", ":", "arg_0", ".", "session_id", "}", ")", "arg_3", "=", "{", "'name'", ":", "arg_1", ".", "pop", "(", "'name'", ",", "None", ")", ",", "'description'", ":", "arg_1", ".", "pop", "(", "'description'", ",", "None", ")", ",", "}", "if", "'language'", "in", "arg_1", ":", "arg_3", "[", "'language'", "]", "=", "arg_1", "[", "'language'", "]", "arg_4", "=", "arg_0", ".", "_POST", "(", "arg_2", ",", "arg_1", ",", "arg_3", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Create a new list.\n\n        A valid session id is required.\n\n        Args:\n            name: Name of the list.\n            description: Description of the list.\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_path('Func')\n        arg_1.update({'session_id': arg_0.session_id})\n\n        arg_3 = {\n            'name': arg_1.pop('name', None), \n            'description': arg_1.pop('description', None),\n        }\n        if 'language' in arg_1:\n            arg_3['language'] = arg_1['language']\n\n        arg_4 = arg_0._POST(arg_2, arg_1, arg_3)\n        arg_0._set_attrs_to_values(arg_4)\n        return arg_4", "path": "tmdbsimple/account.py", "identifier": "Lists.create_list", "docstring": "Create a new list.\n\n        A valid session id is required.\n\n        Args:\n            name: Name of the list.\n            description: Description of the list.\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Create", "a", "new", "list", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 255952}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_corpus.py#L203-L229", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return the docs in the corpus, with sentences flattened.", "language": "python", "parameters": "(self)", "return_statement": "return [\n            [words for sents in doc for words in sents] for doc in self.corpus\n        ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "[", "arg_2", "for", "arg_1", "in", "arg_3", "for", "arg_2", "in", "arg_1", "]", "for", "arg_3", "in", "arg_0", ".", "corpus", "]"], "function": "def Func(arg_0):\n        r\"\"\"Return the docs in the corpus, with sentences flattened.\n\n        Each list within the corpus represents all the words of that document.\n        Thus the sentence level of lists has been flattened.\n\n        Returns\n        -------\n        [[str]]\n            The docs in the corpus as a list of list of strs\n\n        Example\n        -------\n        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\\n'\n        >>> tqbf += 'And then it slept.\\n And the dog ran off.'\n        >>> corp = Corpus(tqbf)\n        >>> corp.Func()\n        [['The', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy',\n        'dog.', 'And', 'then', 'it', 'slept.', 'And', 'the', 'dog', 'ran',\n        'off.']]\n        >>> len(corp.Func())\n        1\n\n        \"\"\"\n        return [\n            [arg_2 for arg_1 in arg_3 for arg_2 in arg_1] for arg_3 in arg_0.corpus\n        ]", "path": "abydos/corpus/_corpus.py", "identifier": "Corpus.docs_of_words", "docstring": "r\"\"\"Return the docs in the corpus, with sentences flattened.\n\n        Each list within the corpus represents all the words of that document.\n        Thus the sentence level of lists has been flattened.\n\n        Returns\n        -------\n        [[str]]\n            The docs in the corpus as a list of list of strs\n\n        Example\n        -------\n        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\\n'\n        >>> tqbf += 'And then it slept.\\n And the dog ran off.'\n        >>> corp = Corpus(tqbf)\n        >>> corp.docs_of_words()\n        [['The', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy',\n        'dog.', 'And', 'then', 'it', 'slept.', 'And', 'the', 'dog', 'ran',\n        'off.']]\n        >>> len(corp.docs_of_words())\n        1", "docstring_tokens": ["r", "Return", "the", "docs", "in", "the", "corpus", "with", "sentences", "flattened", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 255953}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/examples/utils.py#L129-L155", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Create a plot of weights, visualized as \"bottom-level\" pixel arrays.", "language": "python", "parameters": "(weights, tied_weights=False, channels=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "1", ")", ":", "if", "hasattr", "(", "arg_0", "[", "0", "]", ",", "'get_value'", ")", ":", "arg_0", "=", "[", "w", ".", "get_value", "(", ")", "for", "w", "in", "arg_0", "]", "arg_3", "=", "min", "(", "len", "(", "arg_0", ")", ",", "9", ")", "arg_4", "=", "np", ".", "eye", "(", "arg_0", "[", "0", "]", ".", "shape", "[", "0", "]", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_0", "[", ":", "-", "1", "]", ")", ":", "arg_4", "=", "np", ".", "dot", "(", "arg_6", ".", "T", ",", "arg_4", ")", "plot_images", "(", "arg_4", ",", "100", "+", "10", "*", "arg_3", "+", "arg_5", "+", "1", ",", "arg_2", "=", "arg_2", ",", "title", "=", "'Layer {}'", ".", "format", "(", "arg_5", "+", "1", ")", ")", "arg_6", "=", "arg_0", "[", "-", "1", "]", "arg_7", "=", "arg_6", ".", "shape", "[", "1", "]", "/", "arg_2", "if", "int", "(", "np", ".", "sqrt", "(", "arg_7", ")", ")", "**", "2", "!=", "arg_7", ":", "return", "if", "arg_1", ":", "arg_4", "=", "np", ".", "dot", "(", "arg_6", ".", "T", ",", "arg_4", ")", "plot_images", "(", "arg_4", ",", "100", "+", "10", "*", "arg_3", "+", "arg_3", ",", "arg_2", "=", "arg_2", ",", "title", "=", "'Layer {}'", ".", "format", "(", "arg_3", ")", ")", "else", ":", "plot_images", "(", "arg_6", ",", "100", "+", "10", "*", "arg_3", "+", "arg_3", ",", "arg_2", "=", "arg_2", ",", "title", "=", "'Decoding weights'", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=1):\n    '''Create a plot of weights, visualized as \"bottom-level\" pixel arrays.'''\n    if hasattr(arg_0[0], 'get_value'):\n        arg_0 = [w.get_value() for w in arg_0]\n    arg_3 = min(len(arg_0), 9)\n    arg_4 = np.eye(arg_0[0].shape[0])\n    for arg_5, arg_6 in enumerate(arg_0[:-1]):\n        arg_4 = np.dot(arg_6.T, arg_4)\n        plot_images(arg_4,\n                    100 + 10 * arg_3 + arg_5 + 1,\n                    arg_2=arg_2,\n                    title='Layer {}'.format(arg_5+1))\n    arg_6 = arg_0[-1]\n    arg_7 = arg_6.shape[1] / arg_2\n    if int(np.sqrt(arg_7)) ** 2 != arg_7:\n        return\n    if arg_1:\n        arg_4 = np.dot(arg_6.T, arg_4)\n        plot_images(arg_4,\n                    100 + 10 * arg_3 + arg_3,\n                    arg_2=arg_2,\n                    title='Layer {}'.format(arg_3))\n    else:\n        plot_images(arg_6,\n                    100 + 10 * arg_3 + arg_3,\n                    arg_2=arg_2,\n                    title='Decoding weights')", "path": "examples/utils.py", "identifier": "plot_layers", "docstring": "Create a plot of weights, visualized as \"bottom-level\" pixel arrays.", "docstring_tokens": ["Create", "a", "plot", "of", "weights", "visualized", "as", "bottom", "-", "level", "pixel", "arrays", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 255954}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/jira.py#L65-L80", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Filter custom fields from a given set of fields.", "language": "python", "parameters": "(fields)", "return_statement": "return custom_fields", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "[", "field", "for", "field", "in", "arg_0", "if", "field", "[", "'custom'", "]", "is", "True", "]", "for", "arg_3", "in", "arg_2", ":", "arg_1", "[", "arg_3", "[", "'id'", "]", "]", "=", "arg_3", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Filter custom fields from a given set of fields.\n\n    :param fields: set of fields\n\n    :returns: an object with the filtered custom fields\n    \"\"\"\n\n    arg_1 = {}\n\n    arg_2 = [field for field in arg_0 if field['custom'] is True]\n\n    for arg_3 in arg_2:\n        arg_1[arg_3['id']] = arg_3\n\n    return arg_1", "path": "perceval/backends/core/jira.py", "identifier": "filter_custom_fields", "docstring": "Filter custom fields from a given set of fields.\n\n    :param fields: set of fields\n\n    :returns: an object with the filtered custom fields", "docstring_tokens": ["Filter", "custom", "fields", "from", "a", "given", "set", "of", "fields", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255955}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/leakcheck/crypto.py#L70-L76", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Call the function with an encrypted PEM and a passphrase callback.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "xrange", "(", "arg_0", ".", "iterations", "*", "10", ")", ":", "load_privatekey", "(", "FILETYPE_PEM", ",", "arg_0", ".", "ENCRYPTED_PEM", ",", "lambda", "*", "args", ":", "\"hello, secret\"", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Call the function with an encrypted PEM and a passphrase callback.\n        \"\"\"\n        for arg_1 in xrange(arg_0.iterations * 10):\n            load_privatekey(\n                FILETYPE_PEM, arg_0.ENCRYPTED_PEM, lambda *args: \"hello, secret\")", "path": "leakcheck/crypto.py", "identifier": "Checker_load_privatekey.check_load_privatekey_callback", "docstring": "Call the function with an encrypted PEM and a passphrase callback.", "docstring_tokens": ["Call", "the", "function", "with", "an", "encrypted", "PEM", "and", "a", "passphrase", "callback", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 255956}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L821-L825", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "The 1D index mappings between the masked sparse-grid and unmasked sparse grid.", "language": "python", "parameters": "(self)", "return_statement": "return mapping_util.sparse_to_unmasked_sparse_from_mask_and_pixel_centres(\n            total_sparse_pixels=self.total_sparse_pixels, mask=self.regular_grid.mask,\n            unmasked_sparse_grid_pixel_centres=self.unmasked_sparse_grid_pixel_centres).astype('int')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "mapping_util", ".", "Func_from_mask_and_pixel_centres", "(", "total_sparse_pixels", "=", "arg_0", ".", "total_sparse_pixels", ",", "mask", "=", "arg_0", ".", "regular_grid", ".", "mask", ",", "unmasked_sparse_grid_pixel_centres", "=", "arg_0", ".", "unmasked_sparse_grid_pixel_centres", ")", ".", "astype", "(", "'int'", ")"], "function": "def Func(arg_0):\n        \"\"\"The 1D index mappings between the masked sparse-grid and unmasked sparse grid.\"\"\"\n        return mapping_util.Func_from_mask_and_pixel_centres(\n            total_sparse_pixels=arg_0.total_sparse_pixels, mask=arg_0.regular_grid.mask,\n            unmasked_sparse_grid_pixel_centres=arg_0.unmasked_sparse_grid_pixel_centres).astype('int')", "path": "autolens/data/array/grids.py", "identifier": "SparseToRegularGrid.sparse_to_unmasked_sparse", "docstring": "The 1D index mappings between the masked sparse-grid and unmasked sparse grid.", "docstring_tokens": ["The", "1D", "index", "mappings", "between", "the", "masked", "sparse", "-", "grid", "and", "unmasked", "sparse", "grid", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 255957}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/interfaceLevel/unitImplHelpers.py#L109-L114", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Disconnect internal signals so unit can be reused by parent unit", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "_entity", ".", "ports", ":", "arg_1", ".", "connectInternSig", "(", ")", "for", "arg_2", "in", "chain", "(", "arg_0", ".", "_interfaces", ",", "arg_0", ".", "_private_interfaces", ")", ":", "arg_2", ".", "_clean", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Disconnect internal signals so unit can be reused by parent unit\"\"\"\n        for arg_1 in arg_0._entity.ports:\n            arg_1.connectInternSig()\n        for arg_2 in chain(arg_0._interfaces, arg_0._private_interfaces):\n            arg_2._clean()", "path": "hwt/synthesizer/interfaceLevel/unitImplHelpers.py", "identifier": "UnitImplHelpers._cleanAsSubunit", "docstring": "Disconnect internal signals so unit can be reused by parent unit", "docstring_tokens": ["Disconnect", "internal", "signals", "so", "unit", "can", "be", "reused", "by", "parent", "unit"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 255958}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/TaskParser.py#L149-L156", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Create an instance of the task appropriately. A subclass can override\n        this method to get extra information from the node.", "language": "python", "parameters": "(self)", "return_statement": "return self.spec_class(self.spec, self.get_task_spec_name(),\n                               lane=self.get_lane(),\n                               description=self.node.get('name', None))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "spec_class", "(", "arg_0", ".", "spec", ",", "arg_0", ".", "get_task_spec_name", "(", ")", ",", "lane", "=", "arg_0", ".", "get_lane", "(", ")", ",", "description", "=", "arg_0", ".", "node", ".", "get", "(", "'name'", ",", "None", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Create an instance of the task appropriately. A subclass can override\n        this method to get extra information from the node.\n        \"\"\"\n        return arg_0.spec_class(arg_0.spec, arg_0.get_task_spec_name(),\n                               lane=arg_0.get_lane(),\n                               description=arg_0.node.get('name', None))", "path": "SpiffWorkflow/bpmn/parser/TaskParser.py", "identifier": "TaskParser.create_task", "docstring": "Create an instance of the task appropriately. A subclass can override\n        this method to get extra information from the node.", "docstring_tokens": ["Create", "an", "instance", "of", "the", "task", "appropriately", ".", "A", "subclass", "can", "override", "this", "method", "to", "get", "extra", "information", "from", "the", "node", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 255959}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L531-L604", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Private method to handle generic mouse left button dragging and\n        dropping.", "language": "python", "parameters": "(self, stopCoord, strCoord, speed)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_getPid", "(", ")", "if", "arg_2", "==", "(", "0", ",", "0", ")", ":", "arg_5", "=", "AppKit", ".", "NSEvent", ".", "mouseLocation", "(", ")", "arg_2", "=", "(", "arg_5", ".", "x", ",", "Quartz", ".", "CGDisplayPixelsHigh", "(", "0", ")", "-", "arg_5", ".", "y", ")", "arg_4", "=", "arg_0", ".", "_getPid", "(", ")", "arg_6", "=", "Quartz", ".", "CGEventCreateMouseEvent", "(", "None", ",", "Quartz", ".", "kCGEventLeftMouseDown", ",", "arg_2", ",", "Quartz", ".", "kCGMouseButtonLeft", ")", "Quartz", ".", "CGEventPost", "(", "Quartz", ".", "CoreGraphics", ".", "kCGHIDEventTap", ",", "arg_6", ")", "time", ".", "sleep", "(", "5", ")", "arg_3", "=", "round", "(", "1", "/", "float", "(", "arg_3", ")", ",", "2", ")", "arg_7", "=", "arg_1", "[", "0", "]", "-", "arg_2", "[", "0", "]", "arg_8", "=", "arg_1", "[", "1", "]", "-", "arg_2", "[", "1", "]", "if", "arg_8", "==", "0", ":", "raise", "ValueError", "(", "'Not support horizontal moving'", ")", "else", ":", "arg_9", "=", "abs", "(", "arg_8", "/", "arg_7", ")", "if", "arg_7", "!=", "0", ":", "for", "arg_10", "in", "range", "(", "int", "(", "abs", "(", "arg_7", ")", ")", ")", ":", "if", "arg_7", ">", "0", "and", "arg_8", ">", "0", ":", "arg_11", "=", "(", "arg_2", "[", "0", "]", "+", "arg_10", ",", "arg_2", "[", "1", "]", "+", "arg_10", "*", "arg_9", ")", "elif", "arg_7", ">", "0", "and", "arg_8", "<", "0", ":", "arg_11", "=", "(", "arg_2", "[", "0", "]", "+", "arg_10", ",", "arg_2", "[", "1", "]", "-", "arg_10", "*", "arg_9", ")", "elif", "arg_7", "<", "0", "and", "arg_8", "<", "0", ":", "arg_11", "=", "(", "arg_2", "[", "0", "]", "-", "arg_10", ",", "arg_2", "[", "1", "]", "-", "arg_10", "*", "arg_9", ")", "elif", "arg_7", "<", "0", "and", "arg_8", ">", "0", ":", "arg_11", "=", "(", "arg_2", "[", "0", "]", "-", "arg_10", ",", "arg_2", "[", "1", "]", "+", "arg_10", "*", "arg_9", ")", "arg_12", "=", "Quartz", ".", "CGEventCreateMouseEvent", "(", "None", ",", "Quartz", ".", "kCGEventLeftMouseDragged", ",", "arg_11", ",", "Quartz", ".", "kCGMouseButtonLeft", ")", "Quartz", ".", "CGEventPost", "(", "Quartz", ".", "CoreGraphics", ".", "kCGHIDEventTap", ",", "arg_12", ")", "time", ".", "sleep", "(", "arg_3", ")", "else", ":", "raise", "ValueError", "(", "'Not support vertical moving'", ")", "arg_13", "=", "Quartz", ".", "CGEventCreateMouseEvent", "(", "None", ",", "Quartz", ".", "kCGEventLeftMouseUp", ",", "arg_1", ",", "Quartz", ".", "kCGMouseButtonLeft", ")", "time", ".", "sleep", "(", "5", ")", "Quartz", ".", "CGEventPost", "(", "Quartz", ".", "CoreGraphics", ".", "kCGHIDEventTap", ",", "arg_13", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Private method to handle generic mouse left button dragging and\n        dropping.\n\n        Parameters: stopCoord(x,y) drop point\n        Optional: strCoord (x, y) drag point, default (0,0) get current\n                  mouse position\n                  speed (int) 1 to unlimit, simulate mouse moving\n                  action from some special requirement\n        Returns: None\n        \"\"\"\n        # To direct output to the correct application need the PSN:\n        arg_4 = arg_0._getPid()\n        # Get current position as start point if strCoord not given\n        if arg_2 == (0, 0):\n            arg_5 = AppKit.NSEvent.mouseLocation()\n            arg_2 = (arg_5.x, Quartz.CGDisplayPixelsHigh(0) - arg_5.y)\n\n        # To direct output to the correct application need the PSN:\n        arg_4 = arg_0._getPid()\n\n        # Press left button down\n        arg_6 = Quartz.CGEventCreateMouseEvent(\n            None,\n            Quartz.kCGEventLeftMouseDown,\n            arg_2,\n            Quartz.kCGMouseButtonLeft\n        )\n        # Queue the events\n        Quartz.CGEventPost(Quartz.CoreGraphics.kCGHIDEventTap, arg_6)\n        # Wait for reponse of system, a fuzzy icon appears\n        time.sleep(5)\n        # Simulate mouse moving speed, k is slope\n        arg_3 = round(1 / float(arg_3), 2)\n        arg_7 = arg_1[0] - arg_2[0]\n        arg_8 = arg_1[1] - arg_2[1]\n        if arg_8 == 0:\n            raise ValueError('Not support horizontal moving')\n        else:\n            arg_9 = abs(arg_8 / arg_7)\n\n        if arg_7 != 0:\n            for arg_10 in range(int(abs(arg_7))):\n                if arg_7 > 0 and arg_8 > 0:\n                    arg_11 = (arg_2[0] + arg_10, arg_2[1] + arg_10 * arg_9)\n                elif arg_7 > 0 and arg_8 < 0:\n                    arg_11 = (arg_2[0] + arg_10, arg_2[1] - arg_10 * arg_9)\n                elif arg_7 < 0 and arg_8 < 0:\n                    arg_11 = (arg_2[0] - arg_10, arg_2[1] - arg_10 * arg_9)\n                elif arg_7 < 0 and arg_8 > 0:\n                    arg_11 = (arg_2[0] - arg_10, arg_2[1] + arg_10 * arg_9)\n                # Drag with left button\n                arg_12 = Quartz.CGEventCreateMouseEvent(\n                    None,\n                    Quartz.kCGEventLeftMouseDragged,\n                    arg_11,\n                    Quartz.kCGMouseButtonLeft\n                )\n                Quartz.CGEventPost(Quartz.CoreGraphics.kCGHIDEventTap,\n                                   arg_12)\n                # Wait for reponse of system\n                time.sleep(arg_3)\n        else:\n            raise ValueError('Not support vertical moving')\n        arg_13 = Quartz.CGEventCreateMouseEvent(\n            None,\n            Quartz.kCGEventLeftMouseUp,\n            arg_1,\n            Quartz.kCGMouseButtonLeft\n        )\n        # Wait for reponse of system, a plus icon appears\n        time.sleep(5)\n        # Up left button up\n        Quartz.CGEventPost(Quartz.CoreGraphics.kCGHIDEventTap, arg_13)", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._leftMouseDragged", "docstring": "Private method to handle generic mouse left button dragging and\n        dropping.\n\n        Parameters: stopCoord(x,y) drop point\n        Optional: strCoord (x, y) drag point, default (0,0) get current\n                  mouse position\n                  speed (int) 1 to unlimit, simulate mouse moving\n                  action from some special requirement\n        Returns: None", "docstring_tokens": ["Private", "method", "to", "handle", "generic", "mouse", "left", "button", "dragging", "and", "dropping", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 255960}
{"url": "https://github.com/schul-cloud/resources-api-v1/blob/58b2d7ba13669fa013ef81c0ffcffbf6b3fdb52d/generators/python_client/schul_cloud_resources_api_v1/auth.py#L34-L38", "sha": "58b2d7ba13669fa013ef81c0ffcffbf6b3fdb52d", "docstring_summary": "Authenticate via an api key.", "language": "python", "parameters": "(api_key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "Func", ")", ":", "none", "(", ")", "arg_1", ".", "api_key_prefix", "[", "\"Authorization\"", "]", "=", "\"api-key\"", "arg_1", ".", "api_key", "[", "\"Authorization\"", "]", "=", "\"key=\"", "+", "b64encode", "(", "Func", ".", "encode", "(", ")", ")", ".", "decode", "(", ")"], "function": "def Func(Func):\n    \"\"\"Authenticate via an api key.\"\"\"\n    none()\n    arg_1.api_key_prefix[\"Authorization\"] = \"api-key\"\n    arg_1.api_key[\"Authorization\"] = \"key=\" + b64encode(Func.encode()).decode()", "path": "generators/python_client/schul_cloud_resources_api_v1/auth.py", "identifier": "api_key", "docstring": "Authenticate via an api key.", "docstring_tokens": ["Authenticate", "via", "an", "api", "key", "."], "nwo": "schul-cloud/resources-api-v1", "score": 0.32506205088275053, "idx": 255961}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/demo.py#L256-L266", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Load file object.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'fobj'", ")", "and", "arg_0", ".", "fobj", "is", "not", "None", ":", "arg_0", ".", "fobj", ".", "close", "(", ")", "if", "hasattr", "(", "arg_0", ".", "src", ",", "\"read\"", ")", ":", "arg_0", ".", "fobj", "=", "arg_0", ".", "src", "else", ":", "arg_0", ".", "fobj", "=", "open", "(", "arg_0", ".", "fname", ")"], "function": "def Func(arg_0):\n        \"\"\"Load file object.\"\"\"\n        # read data and parse into blocks\n        if hasattr(arg_0, 'fobj') and arg_0.fobj is not None:\n           arg_0.fobj.close()\n        if hasattr(arg_0.src, \"read\"):\n             # It seems to be a file or a file-like object\n            arg_0.fobj = arg_0.src\n        else:\n             # Assume it's a string or something that can be converted to one\n            arg_0.fobj = open(arg_0.fname)", "path": "environment/lib/python2.7/site-packages/IPython/lib/demo.py", "identifier": "Demo.fload", "docstring": "Load file object.", "docstring_tokens": ["Load", "file", "object", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255962}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/base_graph.py#L340-L414", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Creates and returns a representation of the graph using the\n            Graphviz layout program given by 'prog', according to the given\n            format.", "language": "python", "parameters": "(self, prog=None, format=None)", "return_statement": "return stdout_output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_1", "=", "arg_0", ".", "program", "if", "arg_1", "is", "None", "else", "arg_1", "arg_2", "=", "arg_0", ".", "format", "if", "arg_2", "is", "None", "else", "arg_2", "arg_3", ",", "arg_4", "=", "tempfile", ".", "mkstemp", "(", ")", "os", ".", "close", "(", "arg_3", ")", "arg_5", "=", "file", "(", "arg_4", ",", "\"w+b\"", ")", "arg_0", ".", "save_dot", "(", "arg_5", ")", "arg_5", ".", "close", "(", ")", "arg_6", "=", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", "arg_7", "=", "subprocess", ".", "Popen", "(", "(", "arg_0", ".", "programs", "[", "arg_1", "]", ",", "'-T'", "+", "arg_2", ",", "arg_4", ")", ",", "cwd", "=", "arg_6", ",", "arg_8", "=", "subprocess", ".", "PIPE", ",", "arg_9", "=", "subprocess", ".", "PIPE", ")", "arg_8", "=", "arg_7", ".", "stderr", "arg_9", "=", "arg_7", ".", "stdout", "arg_10", "=", "list", "(", ")", "while", "True", ":", "arg_11", "=", "arg_9", ".", "read", "(", ")", "if", "not", "arg_11", ":", "break", "arg_10", ".", "append", "(", "arg_11", ")", "arg_9", ".", "close", "(", ")", "if", "arg_10", ":", "arg_10", "=", "''", ".", "join", "(", "arg_10", ")", "if", "not", "arg_8", ".", "closed", ":", "arg_12", "=", "list", "(", ")", "while", "True", ":", "arg_11", "=", "arg_8", ".", "read", "(", ")", "if", "not", "arg_11", ":", "break", "arg_12", ".", "append", "(", "arg_11", ")", "arg_8", ".", "close", "(", ")", "if", "arg_12", ":", "arg_12", "=", "''", ".", "join", "(", "arg_12", ")", "arg_13", "=", "arg_7", ".", "wait", "(", ")", "if", "arg_13", "!=", "0", ":", "logger", ".", "error", "(", "\"Program terminated with status: %d. stderr \"", "\"follows: %s\"", "%", "(", "arg_13", ",", "arg_12", ")", ")", "elif", "arg_12", ":", "logger", ".", "error", "(", "\"%s\"", ",", "arg_12", ")", "os", ".", "unlink", "(", "arg_4", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\" Creates and returns a representation of the graph using the\n            Graphviz layout program given by 'prog', according to the given\n            format.\n\n            Writes the graph to a temporary dot file and processes it with\n            the program given by 'prog' (which defaults to 'dot'), reading\n            the output and returning it as a string if the operation is\n            successful. On failure None is returned.\n        \"\"\"\n        arg_1 = arg_0.program if arg_1 is None else arg_1\n        arg_2 = arg_0.format if arg_2 is None else arg_2\n\n        # Make a temporary file ...\n        arg_3, arg_4 = tempfile.mkstemp()\n        os.close( arg_3 )\n        # ... and save the graph to it.\n        arg_5 = file( arg_4, \"w+b\" )\n        arg_0.save_dot( arg_5 )\n        arg_5.close()\n\n        # Get the temporary file directory name.\n        arg_6 = os.path.dirname( arg_4 )\n\n        # TODO: Shape image files (See PyDot). Important.\n\n        # Process the file using the layout program, specifying the format.\n        arg_7 = subprocess.Popen(\n            ( arg_0.programs[ arg_1 ], '-T'+arg_2, arg_4 ),\n            cwd=arg_6,\n            arg_8=subprocess.PIPE, arg_9=subprocess.PIPE)\n\n        arg_8 = arg_7.stderr\n        arg_9 = arg_7.stdout\n\n        # Make sense of the standard output form the process.\n        arg_10 = list()\n        while True:\n            arg_11 = arg_9.read()\n            if not arg_11:\n                break\n            arg_10.append(arg_11)\n        arg_9.close()\n\n        if arg_10:\n            arg_10 = ''.join(arg_10)\n\n        # Similarly so for any standard error.\n        if not arg_8.closed:\n            arg_12 = list()\n            while True:\n                arg_11 = arg_8.read()\n                if not arg_11:\n                    break\n                arg_12.append(arg_11)\n            arg_8.close()\n\n            if arg_12:\n                arg_12 = ''.join(arg_12)\n\n        #pid, status = os.waitpid(p.pid, 0)\n        arg_13 = arg_7.wait()\n\n        if arg_13 != 0 :\n            logger.error(\"Program terminated with status: %d. stderr \" \\\n                \"follows: %s\" % ( arg_13, arg_12 ) )\n        elif arg_12:\n            logger.error( \"%s\", arg_12 )\n\n        # TODO: Remove shape image files from the temporary directory.\n\n        # Remove the temporary file.\n        os.unlink(arg_4)\n\n        return arg_10", "path": "godot/base_graph.py", "identifier": "BaseGraph.create", "docstring": "Creates and returns a representation of the graph using the\n            Graphviz layout program given by 'prog', according to the given\n            format.\n\n            Writes the graph to a temporary dot file and processes it with\n            the program given by 'prog' (which defaults to 'dot'), reading\n            the output and returning it as a string if the operation is\n            successful. On failure None is returned.", "docstring_tokens": ["Creates", "and", "returns", "a", "representation", "of", "the", "graph", "using", "the", "Graphviz", "layout", "program", "given", "by", "prog", "according", "to", "the", "given", "format", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 255963}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L98-L110", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Create an Organisation object from a JSON object", "language": "python", "parameters": "(self, organisation_json)", "return_statement": "return trolly.organisation.Organisation(\n            trello_client=self,\n            organisation_id=organisation_json['id'],\n            name=organisation_json['name'],\n            data=organisation_json,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "trolly", ".", "organisation", ".", "Organisation", "(", "trello_client", "=", "arg_0", ",", "organisation_id", "=", "arg_1", "[", "'id'", "]", ",", "name", "=", "arg_1", "[", "'name'", "]", ",", "data", "=", "arg_1", ",", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Create an Organisation object from a JSON object\n\n        Returns:\n            Organisation: The organisation from the given `organisation_json`.\n        '''\n        return trolly.organisation.Organisation(\n            trello_client=arg_0,\n            organisation_id=arg_1['id'],\n            name=arg_1['name'],\n            data=arg_1,\n        )", "path": "trolly/client.py", "identifier": "Client.create_organisation", "docstring": "Create an Organisation object from a JSON object\n\n        Returns:\n            Organisation: The organisation from the given `organisation_json`.", "docstring_tokens": ["Create", "an", "Organisation", "object", "from", "a", "JSON", "object"], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 255964}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L155-L218", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "r\"\"\"Load a JAMS Annotation from a file.", "language": "python", "parameters": "(path_or_file, validate=True, strict=True, fmt='auto')", "return_statement": "return jam", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ",", "arg_3", "=", "'auto'", ")", ":", "with", "_open", "(", "arg_0", ",", "mode", "=", "'r'", ",", "arg_3", "=", "arg_3", ")", "as", "fdesc", ":", "arg_4", "=", "JAMS", "(", "**", "json", ".", "Func", "(", "fdesc", ")", ")", "if", "arg_1", ":", "arg_4", ".", "validate", "(", "arg_2", "=", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=True, arg_2=True, arg_3='auto'):\n    r\"\"\"Load a JAMS Annotation from a file.\n\n\n    Parameters\n    ----------\n    path_or_file : str or file-like\n        Path to the JAMS file to Func\n        OR\n        An open file handle to Func from.\n\n    validate : bool\n        Attempt to validate the JAMS object\n\n    strict : bool\n        if `validate == True`, enforce strict schema validation\n\n    fmt : str ['auto', 'jams', 'jamz']\n        The encoding format of the input\n\n        If `auto`, encoding is inferred from the file name.\n\n        If the input is an open file handle, `jams` encoding\n        is used.\n\n\n    Returns\n    -------\n    jam : JAMS\n        The Funced JAMS object\n\n\n    Raises\n    ------\n    SchemaError\n        if `validate == True`, `strict==True`, and validation fails\n\n\n    See also\n    --------\n    JAMS.validate\n    JAMS.save\n\n\n    Examples\n    --------\n    >>> # Load a jams object from a file name\n    >>> J = jams.Func('data.jams')\n    >>> # Or from an open file descriptor\n    >>> with open('data.jams', 'r') as fdesc:\n    ...     J = jams.Func(fdesc)\n    >>> # Non-strict validation\n    >>> J = jams.Func('data.jams', strict=False)\n    >>> # No validation at all\n    >>> J = jams.Func('data.jams', validate=False)\n    \"\"\"\n\n    with _open(arg_0, mode='r', arg_3=arg_3) as fdesc:\n        arg_4 = JAMS(**json.Func(fdesc))\n\n    if arg_1:\n        arg_4.validate(arg_2=arg_2)\n\n    return arg_4", "path": "jams/core.py", "identifier": "load", "docstring": "r\"\"\"Load a JAMS Annotation from a file.\n\n\n    Parameters\n    ----------\n    path_or_file : str or file-like\n        Path to the JAMS file to load\n        OR\n        An open file handle to load from.\n\n    validate : bool\n        Attempt to validate the JAMS object\n\n    strict : bool\n        if `validate == True`, enforce strict schema validation\n\n    fmt : str ['auto', 'jams', 'jamz']\n        The encoding format of the input\n\n        If `auto`, encoding is inferred from the file name.\n\n        If the input is an open file handle, `jams` encoding\n        is used.\n\n\n    Returns\n    -------\n    jam : JAMS\n        The loaded JAMS object\n\n\n    Raises\n    ------\n    SchemaError\n        if `validate == True`, `strict==True`, and validation fails\n\n\n    See also\n    --------\n    JAMS.validate\n    JAMS.save\n\n\n    Examples\n    --------\n    >>> # Load a jams object from a file name\n    >>> J = jams.load('data.jams')\n    >>> # Or from an open file descriptor\n    >>> with open('data.jams', 'r') as fdesc:\n    ...     J = jams.load(fdesc)\n    >>> # Non-strict validation\n    >>> J = jams.load('data.jams', strict=False)\n    >>> # No validation at all\n    >>> J = jams.load('data.jams', validate=False)", "docstring_tokens": ["r", "Load", "a", "JAMS", "Annotation", "from", "a", "file", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 255965}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L868-L926", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return a float representing the current system-wide CPU\n    utilization as a percentage.", "language": "python", "parameters": "(interval=0.1, percpu=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0.1", ",", "arg_1", "=", "False", ")", ":", "global", "arg_12", "global", "arg_15", "arg_2", "=", "arg_0", "is", "not", "None", "and", "arg_0", ">", "0.0", "def", "calculate", "(", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "sum", "(", "arg_3", ")", "arg_6", "=", "arg_5", "-", "arg_3", ".", "idle", "arg_7", "=", "sum", "(", "arg_4", ")", "arg_8", "=", "arg_7", "-", "arg_4", ".", "idle", "if", "arg_8", "<=", "arg_6", ":", "return", "0.0", "arg_9", "=", "arg_8", "-", "arg_6", "arg_10", "=", "arg_7", "-", "arg_5", "arg_11", "=", "(", "arg_9", "/", "arg_10", ")", "*", "100", "return", "round", "(", "arg_11", ",", "1", ")", "if", "not", "arg_1", ":", "if", "arg_2", ":", "arg_3", "=", "cpu_times", "(", ")", "time", ".", "sleep", "(", "arg_0", ")", "else", ":", "arg_3", "=", "arg_12", "arg_12", "=", "cpu_times", "(", ")", "return", "calculate", "(", "arg_3", ",", "arg_12", ")", "else", ":", "arg_13", "=", "[", "]", "if", "arg_2", ":", "arg_14", "=", "cpu_times", "(", "arg_1", "=", "True", ")", "time", ".", "sleep", "(", "arg_0", ")", "else", ":", "arg_14", "=", "arg_15", "arg_15", "=", "cpu_times", "(", "arg_1", "=", "True", ")", "for", "arg_3", ",", "arg_4", "in", "zip", "(", "arg_14", ",", "arg_15", ")", ":", "arg_13", ".", "append", "(", "calculate", "(", "arg_3", ",", "arg_4", ")", ")", "return", "arg_13"], "function": "def Func(arg_0=0.1, arg_1=False):\n    \"\"\"Return a float representing the current system-wide CPU\n    utilization as a percentage.\n\n    When interval is > 0.0 compares system CPU times elapsed before\n    and after the interval (blocking).\n\n    When interval is 0.0 or None compares system CPU times elapsed\n    since last call or module import, returning immediately.\n    In this case is recommended for accuracy that this function be\n    called with at least 0.1 seconds between calls.\n\n    When percpu is True returns a list of floats representing the\n    utilization as a percentage for each CPU.\n    First element of the list refers to first CPU, second element\n    to second CPU and so on.\n    The order of the list is consistent across calls.\n    \"\"\"\n    global arg_12\n    global arg_15\n    arg_2 = arg_0 is not None and arg_0 > 0.0\n\n    def calculate(arg_3, arg_4):\n        arg_5 = sum(arg_3)\n        arg_6 = arg_5 - arg_3.idle\n\n        arg_7 = sum(arg_4)\n        arg_8 = arg_7 - arg_4.idle\n\n        # this usually indicates a float precision issue\n        if arg_8 <= arg_6:\n            return 0.0\n\n        arg_9 = arg_8 - arg_6\n        arg_10 = arg_7 - arg_5\n        arg_11 = (arg_9 / arg_10) * 100\n        return round(arg_11, 1)\n\n    # system-wide usage\n    if not arg_1:\n        if arg_2:\n            arg_3 = cpu_times()\n            time.sleep(arg_0)\n        else:\n            arg_3 = arg_12\n        arg_12 = cpu_times()\n        return calculate(arg_3, arg_12)\n    # per-cpu usage\n    else:\n        arg_13 = []\n        if arg_2:\n            arg_14 = cpu_times(arg_1=True)\n            time.sleep(arg_0)\n        else:\n            arg_14 = arg_15\n        arg_15 = cpu_times(arg_1=True)\n        for arg_3, arg_4 in zip(arg_14, arg_15):\n            arg_13.append(calculate(arg_3, arg_4))\n        return arg_13", "path": "environment/lib/python2.7/site-packages/psutil/__init__.py", "identifier": "cpu_percent", "docstring": "Return a float representing the current system-wide CPU\n    utilization as a percentage.\n\n    When interval is > 0.0 compares system CPU times elapsed before\n    and after the interval (blocking).\n\n    When interval is 0.0 or None compares system CPU times elapsed\n    since last call or module import, returning immediately.\n    In this case is recommended for accuracy that this function be\n    called with at least 0.1 seconds between calls.\n\n    When percpu is True returns a list of floats representing the\n    utilization as a percentage for each CPU.\n    First element of the list refers to first CPU, second element\n    to second CPU and so on.\n    The order of the list is consistent across calls.", "docstring_tokens": ["Return", "a", "float", "representing", "the", "current", "system", "-", "wide", "CPU", "utilization", "as", "a", "percentage", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255966}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvme.py#L103-L115", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Do format for NVMe device", "language": "python", "parameters": "(lbaf=3)", "return_statement": "return rcode", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "3", ")", ":", "if", "env", "(", ")", ":", "cij", ".", "err", "(", "\"cij.nvme.exists: Invalid NVMe ENV.\"", ")", "return", "1", "arg_1", "=", "cij", ".", "env_to_dict", "(", "PREFIX", ",", "EXPORTED", "+", "REQUIRED", ")", "arg_2", "=", "[", "\"nvme\"", ",", "\"format\"", ",", "arg_1", "[", "\"DEV_PATH\"", "]", ",", "\"-l\"", ",", "str", "(", "arg_0", ")", "]", "arg_3", ",", "arg_4", ",", "arg_4", "=", "cij", ".", "ssh", ".", "command", "(", "arg_2", ",", "shell", "=", "True", ")", "return", "arg_3"], "function": "def Func(arg_0=3):\n    \"\"\"Do format for NVMe device\"\"\"\n\n    if env():\n        cij.err(\"cij.nvme.exists: Invalid NVMe ENV.\")\n        return 1\n\n    arg_1 = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)\n\n    arg_2 = [\"nvme\", \"format\", arg_1[\"DEV_PATH\"], \"-l\", str(arg_0)]\n    arg_3, arg_4, arg_4 = cij.ssh.command(arg_2, shell=True)\n\n    return arg_3", "path": "deprecated/modules/cij/nvme.py", "identifier": "fmt", "docstring": "Do format for NVMe device", "docstring_tokens": ["Do", "format", "for", "NVMe", "device"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 255967}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L112-L127", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Send a completion status payload to the SuccessFactors OCN Completion Status endpoint", "language": "python", "parameters": "(self, user_id, payload)", "return_statement": "return self._call_post_with_user_override(user_id, url, payload)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "enterprise_configuration", ".", "sapsf_base_url", "+", "arg_0", ".", "global_sap_config", ".", "completion_status_api_path", "return", "arg_0", ".", "_call_post_with_user_override", "(", "arg_1", ",", "arg_3", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Send a completion status payload to the SuccessFactors OCN Completion Status endpoint\n\n        Args:\n            user_id (str): The sap user id that the completion status is being sent for.\n            payload (str): JSON encoded object (serialized from SapSuccessFactorsLearnerDataTransmissionAudit)\n                containing completion status fields per SuccessFactors documentation.\n\n        Returns:\n            The body of the response from SAP SuccessFactors, if successful\n        Raises:\n            HTTPError: if we received a failure response code from SAP SuccessFactors\n        \"\"\"\n        arg_3 = arg_0.enterprise_configuration.sapsf_base_url + arg_0.global_sap_config.completion_status_api_path\n        return arg_0._call_post_with_user_override(arg_1, arg_3, arg_2)", "path": "integrated_channels/sap_success_factors/client.py", "identifier": "SAPSuccessFactorsAPIClient.create_course_completion", "docstring": "Send a completion status payload to the SuccessFactors OCN Completion Status endpoint\n\n        Args:\n            user_id (str): The sap user id that the completion status is being sent for.\n            payload (str): JSON encoded object (serialized from SapSuccessFactorsLearnerDataTransmissionAudit)\n                containing completion status fields per SuccessFactors documentation.\n\n        Returns:\n            The body of the response from SAP SuccessFactors, if successful\n        Raises:\n            HTTPError: if we received a failure response code from SAP SuccessFactors", "docstring_tokens": ["Send", "a", "completion", "status", "payload", "to", "the", "SuccessFactors", "OCN", "Completion", "Status", "endpoint"], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 255968}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/bugzillarest.py#L368-L381", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the history of the given bugs.", "language": "python", "parameters": "(self, *bug_ids)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "urijoin", "(", "arg_0", ".", "RBUG", ",", "arg_1", "[", "0", "]", ",", "arg_0", ".", "RHISTORY", ")", "arg_3", "=", "{", "arg_0", ".", "PIDS", ":", "arg_1", "}", "arg_4", "=", "arg_0", ".", "call", "(", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Get the Func of the given bugs.\n\n        :param bug_ids: list of bug identifiers\n        \"\"\"\n        arg_2 = urijoin(arg_0.RBUG, arg_1[0], arg_0.RHISTORY)\n\n        arg_3 = {\n            arg_0.PIDS: arg_1\n        }\n\n        arg_4 = arg_0.call(arg_2, arg_3)\n\n        return arg_4", "path": "perceval/backends/core/bugzillarest.py", "identifier": "BugzillaRESTClient.history", "docstring": "Get the history of the given bugs.\n\n        :param bug_ids: list of bug identifiers", "docstring_tokens": ["Get", "the", "history", "of", "the", "given", "bugs", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 255969}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/storage.py#L78-L108", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Saves a Nifti1Image into an HDF5 group.", "language": "python", "parameters": "(h5group, spatial_img)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", "[", "'data'", "]", "=", "arg_1", ".", "get_data", "(", ")", "arg_0", "[", "'affine'", "]", "=", "arg_1", ".", "get_affine", "(", ")", "if", "hasattr", "(", "arg_0", ",", "'get_extra'", ")", ":", "arg_0", "[", "'extra'", "]", "=", "arg_1", ".", "get_extra", "(", ")", "arg_2", "=", "arg_1", ".", "get_header", "(", ")", "for", "arg_3", "in", "list", "(", "arg_2", ".", "keys", "(", ")", ")", ":", "arg_0", "[", "'data'", "]", ".", "attrs", "[", "arg_3", "]", "=", "arg_2", "[", "arg_3", "]", "except", "ValueError", "as", "ve", ":", "raise", "Exception", "(", "'Error creating group '", "+", "arg_0", ".", "name", ")", "from", "ve"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Saves a Nifti1Image into an HDF5 group.\n\n    Parameters\n    ----------\n    h5group: h5py Group\n        Output HDF5 file path\n\n    spatial_img: nibabel SpatialImage\n        Image to be saved\n\n    h5path: str\n        HDF5 group path where the image data will be saved.\n        Datasets will be created inside the given group path:\n        'data', 'extra', 'affine', the header information will\n        be set as attributes of the 'data' dataset.\n\n    \"\"\"\n    try:\n        arg_0['data']   = arg_1.get_data()\n        arg_0['affine'] = arg_1.get_affine()\n\n        if hasattr(arg_0, 'get_extra'):\n            arg_0['extra'] = arg_1.get_extra()\n\n        arg_2 = arg_1.get_header()\n        for arg_3 in list(arg_2.keys()):\n            arg_0['data'].attrs[arg_3] = arg_2[arg_3]\n\n    except ValueError as ve:\n        raise Exception('Error creating group ' + arg_0.name) from ve", "path": "boyle/nifti/storage.py", "identifier": "spatialimg_to_hdfgroup", "docstring": "Saves a Nifti1Image into an HDF5 group.\n\n    Parameters\n    ----------\n    h5group: h5py Group\n        Output HDF5 file path\n\n    spatial_img: nibabel SpatialImage\n        Image to be saved\n\n    h5path: str\n        HDF5 group path where the image data will be saved.\n        Datasets will be created inside the given group path:\n        'data', 'extra', 'affine', the header information will\n        be set as attributes of the 'data' dataset.", "docstring_tokens": ["Saves", "a", "Nifti1Image", "into", "an", "HDF5", "group", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 255970}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1067-L1092", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Checks if data values are  valid.", "language": "python", "parameters": "(self, explore_iterable)", "return_statement": "return data_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "not", "arg_0", ".", "f_supports", "(", "arg_3", ")", ":", "raise", "TypeError", "(", "'%s is of not supported type %s.'", "%", "(", "repr", "(", "arg_3", ")", ",", "str", "(", "type", "(", "arg_3", ")", ")", ")", ")", "if", "not", "arg_0", ".", "_values_of_same_type", "(", "arg_3", ",", "arg_0", ".", "_default", ")", ":", "raise", "TypeError", "(", "'Data of `%s` is not of the same type as the original entry value, '", "'new type is %s vs old type %s.'", "%", "(", "arg_0", ".", "v_full_name", ",", "str", "(", "type", "(", "arg_3", ")", ")", ",", "str", "(", "type", "(", "arg_0", ".", "_default", ")", ")", ")", ")", "arg_2", ".", "append", "(", "arg_3", ")", "if", "len", "(", "arg_2", ")", "==", "0", ":", "raise", "ValueError", "(", "'Cannot explore an empty list!'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Checks if data values are  valid.\n\n        Checks if the data values are supported by the parameter and if the values are of the same\n        type as the default value.\n\n        \"\"\"\n        arg_2 = []\n\n        for arg_3 in arg_1:\n\n            if not arg_0.f_supports(arg_3):\n                raise TypeError('%s is of not supported type %s.' % (repr(arg_3), str(type(arg_3))))\n\n            if not arg_0._values_of_same_type(arg_3, arg_0._default):\n                raise TypeError(\n                    'Data of `%s` is not of the same type as the original entry value, '\n                    'new type is %s vs old type %s.' %\n                    (arg_0.v_full_name, str(type(arg_3)), str(type(arg_0._default))))\n\n            arg_2.append(arg_3)\n\n        if len(arg_2) == 0:\n            raise ValueError('Cannot explore an empty list!')\n\n        return arg_2", "path": "pypet/parameter.py", "identifier": "Parameter._data_sanity_checks", "docstring": "Checks if data values are  valid.\n\n        Checks if the data values are supported by the parameter and if the values are of the same\n        type as the default value.", "docstring_tokens": ["Checks", "if", "data", "values", "are", "valid", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255971}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L604-L632", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This merges all TFA text LCs with separate apertures for a single object.", "language": "python", "parameters": "(lclist)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "read_hatpi_textlc", "(", "arg_3", ")", "for", "arg_5", "in", "arg_4", "[", "'columns'", "]", ":", "if", "arg_5", ".", "startswith", "(", "'itf'", ")", ":", "arg_1", "[", "arg_5", "]", "=", "arg_4", "arg_6", "=", "arg_4", "[", "'frk'", "]", ".", "tolist", "(", ")", "arg_2", ".", "extend", "(", "arg_6", ")", "arg_2", "=", "sorted", "(", "list", "(", "set", "(", "arg_2", ")", ")", ")"], "function": "def Func(arg_0):\n    '''This merges all TFA text LCs with separate apertures for a single object.\n\n    The framekey column will be used as the join column across all light curves\n    in lclist. Missing values will be filled in with nans. This function assumes\n    all light curves are in the format specified in COLDEFS above and readable\n    by read_hatpi_textlc above (i.e. have a single column for TFA mags for a\n    specific aperture at the end).\n\n    '''\n\n    arg_1 = {}\n    arg_2 = []\n\n    for arg_3 in arg_0:\n\n        arg_4 = read_hatpi_textlc(arg_3)\n\n        # figure what aperture this is and put it into the lcdict. if two LCs\n        # with the same aperture (i.e. TF1 and TF1) are provided, the later one\n        # in the lclist will overwrite the previous one,\n        for arg_5 in arg_4['columns']:\n            if arg_5.startswith('itf'):\n                arg_1[arg_5] = arg_4\n        arg_6 = arg_4['frk'].tolist()\n        arg_2.extend(arg_6)\n\n    # uniqify the framekeys\n    arg_2 = sorted(list(set(arg_2)))", "path": "astrobase/hatsurveys/hplc.py", "identifier": "merge_hatpi_textlc_apertures", "docstring": "This merges all TFA text LCs with separate apertures for a single object.\n\n    The framekey column will be used as the join column across all light curves\n    in lclist. Missing values will be filled in with nans. This function assumes\n    all light curves are in the format specified in COLDEFS above and readable\n    by read_hatpi_textlc above (i.e. have a single column for TFA mags for a\n    specific aperture at the end).", "docstring_tokens": ["This", "merges", "all", "TFA", "text", "LCs", "with", "separate", "apertures", "for", "a", "single", "object", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 255972}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/serialize/canning.py#L337-L354", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Prepare an object for pickling.", "language": "python", "parameters": "(obj)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "False", "for", "arg_2", ",", "arg_3", "in", "iteritems", "(", "Func_map", ")", ":", "if", "isinstance", "(", "arg_2", ",", "string_types", ")", ":", "arg_1", "=", "True", "break", "elif", "istype", "(", "arg_0", ",", "arg_2", ")", ":", "return", "arg_3", "(", "arg_0", ")", "if", "arg_1", ":", "_import_mapping", "(", "Func_map", ",", "_original_Func_map", ")", "return", "Func", "(", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Prepare an object for pickling.\"\"\"\n    arg_1 = False\n\n    for arg_2, arg_3 in iteritems(Func_map):\n        if isinstance(arg_2, string_types):\n            arg_1 = True\n            break\n        elif istype(arg_0, arg_2):\n            return arg_3(arg_0)\n\n    if arg_1:\n        # perform Func_map imports, then try again\n        # this will usually only happen once\n        _import_mapping(Func_map, _original_Func_map)\n        return Func(arg_0)\n\n    return arg_0", "path": "parsl/executors/serialize/canning.py", "identifier": "can", "docstring": "Prepare an object for pickling.", "docstring_tokens": ["Prepare", "an", "object", "for", "pickling", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 255973}
{"url": "https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/colorful/ansi.py#L80-L89", "sha": "919fa6da17865cc5e01e6b16119193a97d180dc9", "docstring_summary": "Convert RGB to ANSI 16 color", "language": "python", "parameters": "(r, g, b, use_bright=False)", "return_statement": "return ansi", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "round", "(", "arg_2", "/", "255.0", ")", "<<", "2", "arg_5", "=", "round", "(", "arg_1", "/", "255.0", ")", "<<", "1", "arg_6", "=", "round", "(", "arg_0", "/", "255.0", ")", "arg_7", "=", "(", "90", "if", "arg_3", "else", "30", ")", "+", "(", "arg_4", "|", "arg_5", "|", "arg_6", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\"\n    Convert RGB to ANSI 16 color\n    \"\"\"\n    arg_4 = round(arg_2 / 255.0) << 2\n    arg_5 = round(arg_1 / 255.0) << 1\n    arg_6 = round(arg_0 / 255.0)\n    arg_7 = (90 if arg_3 else 30) + (arg_4 | arg_5 | arg_6)\n\n    return arg_7", "path": "colorful/ansi.py", "identifier": "rgb_to_ansi16", "docstring": "Convert RGB to ANSI 16 color", "docstring_tokens": ["Convert", "RGB", "to", "ANSI", "16", "color"], "nwo": "timofurrer/colorful", "score": 0.585749501312285, "idx": 255974}
{"url": "https://github.com/ssherar/hook/blob/54160df554d8b2ed65d762168e5808487e873ed9/hook/model.py#L26-L38", "sha": "54160df554d8b2ed65d762168e5808487e873ed9", "docstring_summary": "Creates a new instance of a rule in relation to the config file.", "language": "python", "parameters": "(cls, **kwargs)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "iteritems", "(", ")", ":", "arg_2", ".", "__dict__", "[", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Creates a new instance of a rule in relation to the config file.\n\n        This updates the dictionary of the class with the added details, which\n        allows for flexibility in the configuation file.\n\n        Only called when parsing the default configuation file.\n        \"\"\"\n        arg_2 = arg_0()\n\n        for arg_3, arg_4 in arg_1.iteritems():\n            arg_2.__dict__[arg_3] = arg_4\n        return arg_2", "path": "hook/model.py", "identifier": "Rule.from_yaml", "docstring": "Creates a new instance of a rule in relation to the config file.\n\n        This updates the dictionary of the class with the added details, which\n        allows for flexibility in the configuation file.\n\n        Only called when parsing the default configuation file.", "docstring_tokens": ["Creates", "a", "new", "instance", "of", "a", "rule", "in", "relation", "to", "the", "config", "file", "."], "nwo": "ssherar/hook", "score": 0.23137166388621372, "idx": 255975}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/model.py#L638-L718", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates the tf.train.Scaffold object and assigns it to self.scaffold.\n        Other fields of the Scaffold are generated automatically.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "execution_type", "==", "\"single\"", ":", "arg_1", "=", "arg_0", ".", "get_variables", "(", "include_submodules", "=", "True", ",", "include_nontrainable", "=", "True", ")", "arg_2", "=", "tf", ".", "variables_initializer", "(", "var_list", "=", "arg_1", ")", "if", "arg_0", ".", "summarizer_init_op", "is", "not", "None", ":", "arg_2", "=", "tf", ".", "group", "(", "arg_2", ",", "arg_0", ".", "summarizer_init_op", ")", "if", "arg_0", ".", "graph_summary", "is", "None", ":", "arg_3", "=", "tf", ".", "report_uninitialized_variables", "(", "var_list", "=", "arg_1", ")", "arg_4", "=", "None", "arg_5", "=", "None", "else", ":", "arg_3", "=", "None", "arg_4", "=", "tf", ".", "report_uninitialized_variables", "(", "var_list", "=", "arg_1", ")", "arg_5", "=", "arg_0", ".", "graph_summary", "else", ":", "arg_1", "=", "arg_0", ".", "global_model", ".", "get_variables", "(", "include_submodules", "=", "True", ",", "include_nontrainable", "=", "True", ")", "arg_6", "=", "arg_0", ".", "get_variables", "(", "include_submodules", "=", "True", ",", "include_nontrainable", "=", "True", ")", "arg_2", "=", "tf", ".", "variables_initializer", "(", "var_list", "=", "arg_1", ")", "if", "arg_0", ".", "summarizer_init_op", "is", "not", "None", ":", "arg_2", "=", "tf", ".", "group", "(", "arg_2", ",", "arg_0", ".", "summarizer_init_op", ")", "arg_3", "=", "tf", ".", "report_uninitialized_variables", "(", "var_list", "=", "(", "arg_1", "+", "arg_6", ")", ")", "arg_4", "=", "tf", ".", "report_uninitialized_variables", "(", "var_list", "=", "arg_1", ")", "if", "arg_0", ".", "graph_summary", "is", "None", ":", "arg_5", "=", "tf", ".", "group", "(", "tf", ".", "variables_initializer", "(", "var_list", "=", "arg_6", ")", ",", "*", "(", "tf", ".", "assign", "(", "ref", "=", "local_var", ",", "value", "=", "global_var", ")", "for", "local_var", ",", "global_var", "in", "zip", "(", "arg_0", ".", "get_variables", "(", "include_submodules", "=", "True", ")", ",", "arg_0", ".", "global_model", ".", "get_variables", "(", "include_submodules", "=", "True", ")", ")", ")", ")", "else", ":", "arg_5", "=", "tf", ".", "group", "(", "tf", ".", "variables_initializer", "(", "var_list", "=", "arg_6", ")", ",", "arg_0", ".", "graph_summary", ",", "*", "(", "tf", ".", "assign", "(", "ref", "=", "local_var", ",", "value", "=", "global_var", ")", "for", "local_var", ",", "global_var", "in", "zip", "(", "arg_0", ".", "get_variables", "(", "include_submodules", "=", "True", ")", ",", "arg_0", ".", "global_model", ".", "get_variables", "(", "include_submodules", "=", "True", ")", ")", ")", ")", "def", "init_fn", "(", "arg_7", ",", "arg_8", ")", ":", "if", "arg_0", ".", "saver_spec", "is", "not", "None", "and", "arg_0", ".", "saver_spec", ".", "get", "(", "'load'", ",", "True", ")", ":", "arg_9", "=", "arg_0", ".", "saver_spec", "[", "'directory'", "]", "arg_10", "=", "arg_0", ".", "saver_spec", ".", "get", "(", "'file'", ")", "if", "arg_10", "is", "None", ":", "arg_10", "=", "tf", ".", "train", ".", "latest_checkpoint", "(", "checkpoint_dir", "=", "arg_9", ",", "latest_filename", "=", "None", ")", "elif", "not", "os", ".", "path", ".", "isfile", "(", "arg_10", ")", ":", "arg_10", "=", "os", ".", "path", ".", "join", "(", "arg_9", ",", "arg_10", ")", "if", "arg_10", "is", "not", "None", ":", "try", ":", "arg_7", ".", "saver", ".", "restore", "(", "sess", "=", "arg_8", ",", "save_path", "=", "arg_10", ")", "arg_8", ".", "run", "(", "fetches", "=", "arg_0", ".", "list_buffer_index_reset_op", ")", "except", "tf", ".", "errors", ".", "NotFoundError", ":", "raise", "TensorForceError", "(", "\"Error: Existing checkpoint could not be loaded! Set \\\"load\\\" to false in saver_spec.\"", ")", "arg_0", ".", "scaffold", "=", "tf", ".", "train", ".", "Scaffold", "(", "arg_2", "=", "arg_2", ",", "init_feed_dict", "=", "None", ",", "init_fn", "=", "init_fn", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "summary_op", "=", "None", ",", "saver", "=", "arg_0", ".", "saver", ",", "copy_from_scaffold", "=", "None", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Creates the tf.train.Scaffold object and assigns it to self.scaffold.\n        Other fields of the Scaffold are generated automatically.\n        \"\"\"\n        if arg_0.execution_type == \"single\":\n            arg_1 = arg_0.get_variables(include_submodules=True, include_nontrainable=True)\n            # global_variables += [self.global_episode, self.global_timestep]\n            arg_2 = tf.variables_initializer(var_list=arg_1)\n            if arg_0.summarizer_init_op is not None:\n                arg_2 = tf.group(arg_2, arg_0.summarizer_init_op)\n            if arg_0.graph_summary is None:\n                arg_3 = tf.report_uninitialized_variables(var_list=arg_1)\n                arg_4 = None\n                arg_5 = None\n            else:\n                arg_3 = None\n                arg_4 = tf.report_uninitialized_variables(var_list=arg_1)\n                arg_5 = arg_0.graph_summary\n\n        else:\n            # Global and local variable initializers.\n            arg_1 = arg_0.global_model.get_variables(include_submodules=True, include_nontrainable=True)\n            # global_variables += [self.global_episode, self.global_timestep]\n            arg_6 = arg_0.get_variables(include_submodules=True, include_nontrainable=True)\n            arg_2 = tf.variables_initializer(var_list=arg_1)\n            if arg_0.summarizer_init_op is not None:\n                arg_2 = tf.group(arg_2, arg_0.summarizer_init_op)\n            arg_3 = tf.report_uninitialized_variables(var_list=(arg_1 + arg_6))\n            arg_4 = tf.report_uninitialized_variables(var_list=arg_1)\n            if arg_0.graph_summary is None:\n                arg_5 = tf.group(\n                    tf.variables_initializer(var_list=arg_6),\n                    # Synchronize values of trainable variables.\n                    *(tf.assign(ref=local_var, value=global_var) for local_var, global_var in zip(\n                        arg_0.get_variables(include_submodules=True),\n                        arg_0.global_model.get_variables(include_submodules=True)\n                    ))\n                )\n            else:\n                arg_5 = tf.group(\n                    tf.variables_initializer(var_list=arg_6),\n                    arg_0.graph_summary,\n                    # Synchronize values of trainable variables.\n                    *(tf.assign(ref=local_var, value=global_var) for local_var, global_var in zip(\n                        arg_0.get_variables(include_submodules=True),\n                        arg_0.global_model.get_variables(include_submodules=True)\n                    ))\n                )\n\n        def init_fn(arg_7, arg_8):\n            if arg_0.saver_spec is not None and arg_0.saver_spec.get('load', True):\n                arg_9 = arg_0.saver_spec['directory']\n                arg_10 = arg_0.saver_spec.get('file')\n                if arg_10 is None:\n                    arg_10 = tf.train.latest_checkpoint(\n                        checkpoint_dir=arg_9,\n                        latest_filename=None  # Corresponds to argument of saver.save() in Model.save().\n                    )\n                elif not os.path.isfile(arg_10):\n                    arg_10 = os.path.join(arg_9, arg_10)\n                if arg_10 is not None:\n                    try:\n                        arg_7.saver.restore(sess=arg_8, save_path=arg_10)\n                        arg_8.run(fetches=arg_0.list_buffer_index_reset_op)\n                    except tf.errors.NotFoundError:\n                        raise TensorForceError(\"Error: Existing checkpoint could not be loaded! Set \\\"load\\\" to false in saver_spec.\")\n\n        # TensorFlow scaffold object\n        # TODO explain what it does.\n        arg_0.scaffold = tf.train.Scaffold(\n            arg_2=arg_2,\n            init_feed_dict=None,\n            init_fn=init_fn,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            summary_op=None,\n            saver=arg_0.saver,\n            copy_from_scaffold=None\n        )", "path": "tensorforce/models/model.py", "identifier": "Model.setup_scaffold", "docstring": "Creates the tf.train.Scaffold object and assigns it to self.scaffold.\n        Other fields of the Scaffold are generated automatically.", "docstring_tokens": ["Creates", "the", "tf", ".", "train", ".", "Scaffold", "object", "and", "assigns", "it", "to", "self", ".", "scaffold", ".", "Other", "fields", "of", "the", "Scaffold", "are", "generated", "automatically", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 255976}
{"url": "https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L222-L232", "sha": "2614ae3d7a49e437954254846b2963ad249b418c", "docstring_summary": "Returns the value specified in the XDG_CONFIG_HOME environment variable\n        or the appropriate default.", "language": "python", "parameters": "(self)", "return_statement": "return expanduser('~/.config/%s/%s' % (self.group_name, self.app_name))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "getenv", "(", "'XDG_CONFIG_HOME'", ",", "''", ")", "if", "arg_1", ":", "arg_0", ".", "_log", ".", "debug", "(", "'XDG_CONFIG_HOME is set to %r'", ",", "arg_1", ")", "return", "expanduser", "(", "join", "(", "arg_1", ",", "arg_0", ".", "group_name", ",", "arg_0", ".", "app_name", ")", ")", "return", "expanduser", "(", "'~/.config/%s/%s'", "%", "(", "arg_0", ".", "group_name", ",", "arg_0", ".", "app_name", ")", ")"], "function": "def Func(arg_0):\n        # type: () -> str\n        \"\"\"\n        Returns the value specified in the XDG_CONFIG_HOME environment variable\n        or the appropriate default.\n        \"\"\"\n        arg_1 = getenv('XDG_CONFIG_HOME', '')\n        if arg_1:\n            arg_0._log.debug('XDG_CONFIG_HOME is set to %r', arg_1)\n            return expanduser(join(arg_1, arg_0.group_name, arg_0.app_name))\n        return expanduser('~/.config/%s/%s' % (arg_0.group_name, arg_0.app_name))", "path": "config_resolver/core.py", "identifier": "Config.get_xdg_home", "docstring": "Returns the value specified in the XDG_CONFIG_HOME environment variable\n        or the appropriate default.", "docstring_tokens": ["Returns", "the", "value", "specified", "in", "the", "XDG_CONFIG_HOME", "environment", "variable", "or", "the", "appropriate", "default", "."], "nwo": "exhuma/config_resolver", "score": 0.16941397159673272, "idx": 255977}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1440-L1484", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots curve relating per-dollar slippage to average annual returns.", "language": "python", "parameters": "(returns, positions, transactions,\n                              ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "plt", ".", "gca", "(", ")", "arg_5", "=", "pd", ".", "Series", "(", ")", "for", "arg_6", "in", "range", "(", "1", ",", "100", ")", ":", "arg_7", "=", "txn", ".", "adjust_returns_for_slippage", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_6", ")", "arg_8", "=", "ep", ".", "annual_return", "(", "arg_7", ")", "arg_5", ".", "loc", "[", "arg_6", "]", "=", "arg_8", "arg_5", ".", "plot", "(", "alpha", "=", "1.0", ",", "lw", "=", "2", ",", "arg_3", "=", "arg_3", ")", "arg_3", ".", "set_title", "(", "'Average annual returns given additional per-dollar slippage'", ")", "arg_3", ".", "set_xticks", "(", "np", ".", "arange", "(", "0", ",", "100", ",", "10", ")", ")", "arg_3", ".", "set_ylabel", "(", "'Average annual return'", ")", "arg_3", ".", "set_xlabel", "(", "'Per-dollar slippage (bps)'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2,\n                              arg_3=None, **arg_4):\n    \"\"\"\n    Plots curve relating per-dollar slippage to average annual returns.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Timeseries of portfolio returns to be adjusted for various\n        degrees of slippage.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_3 is None:\n        arg_3 = plt.gca()\n\n    arg_5 = pd.Series()\n    for arg_6 in range(1, 100):\n        arg_7 = txn.adjust_returns_for_slippage(arg_0, arg_1,\n                                                      arg_2, arg_6)\n        arg_8 = ep.annual_return(arg_7)\n        arg_5.loc[arg_6] = arg_8\n\n    arg_5.plot(alpha=1.0, lw=2, arg_3=arg_3)\n\n    arg_3.set_title('Average annual returns given additional per-dollar slippage')\n    arg_3.set_xticks(np.arange(0, 100, 10))\n    arg_3.set_ylabel('Average annual return')\n    arg_3.set_xlabel('Per-dollar slippage (bps)')\n\n    return arg_3", "path": "pyfolio/plotting.py", "identifier": "plot_slippage_sensitivity", "docstring": "Plots curve relating per-dollar slippage to average annual returns.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Timeseries of portfolio returns to be adjusted for various\n        degrees of slippage.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "curve", "relating", "per", "-", "dollar", "slippage", "to", "average", "annual", "returns", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255978}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/logscrapedaily.py#L211-L241", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Find the git hash and branch info that  a Jenkins job was taken from.  It will save this\n    information in g_failed_test_info_dict.  In addition, it will delete this particular\n    function handle off the temp_func_list as we do not need to perform this action again.", "language": "python", "parameters": "(each_line,temp_func_list)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "global", "g_git_hash_branch", "global", "arg_6", "if", "g_git_hash_branch", "in", "arg_0", ":", "[", "arg_2", ",", "arg_3", ",", "arg_4", "]", "=", "arg_0", ".", "partition", "(", "g_git_hash_branch", ")", "arg_5", "=", "arg_4", ".", "strip", "(", ")", ".", "split", "(", ")", "if", "len", "(", "arg_5", ")", ">", "1", ":", "arg_6", "[", "\"4.git_hash\"", "]", "=", "arg_5", "[", "0", "]", "arg_6", "[", "\"5.git_branch\"", "]", "=", "arg_5", "[", "1", "]", "arg_1", ".", "remove", "(", "Func", ")", "return", "True"], "function": "def Func(arg_0,arg_1):\n    \"\"\"\n    Find the git hash and branch info that  a Jenkins job was taken from.  It will save this\n    information in g_failed_test_info_dict.  In addition, it will delete this particular\n    function handle off the temp_func_list as we do not need to perform this action again.\n\n    Parameters\n    ----------\n\n    each_line :  str\n        contains a line read in from jenkins console\n    temp_func_list :  list of Python function handles\n        contains a list of functions that we want to invoke to extract information from\n        the Jenkins console text.\n\n    :return: bool to determine if text mining should continue on the jenkins console text\n    \"\"\"\n    global g_git_hash_branch\n    global arg_6\n\n    if g_git_hash_branch in arg_0:\n        [arg_2,arg_3,arg_4] = arg_0.partition(g_git_hash_branch)\n        arg_5 = arg_4.strip().split()\n\n        if len(arg_5) > 1:\n            arg_6[\"4.git_hash\"] = arg_5[0]\n            arg_6[\"5.git_branch\"] = arg_5[1]\n\n        arg_1.remove(Func)\n\n    return True", "path": "scripts/logscrapedaily.py", "identifier": "find_git_hash_branch", "docstring": "Find the git hash and branch info that  a Jenkins job was taken from.  It will save this\n    information in g_failed_test_info_dict.  In addition, it will delete this particular\n    function handle off the temp_func_list as we do not need to perform this action again.\n\n    Parameters\n    ----------\n\n    each_line :  str\n        contains a line read in from jenkins console\n    temp_func_list :  list of Python function handles\n        contains a list of functions that we want to invoke to extract information from\n        the Jenkins console text.\n\n    :return: bool to determine if text mining should continue on the jenkins console text", "docstring_tokens": ["Find", "the", "git", "hash", "and", "branch", "info", "that", "a", "Jenkins", "job", "was", "taken", "from", ".", "It", "will", "save", "this", "information", "in", "g_failed_test_info_dict", ".", "In", "addition", "it", "will", "delete", "this", "particular", "function", "handle", "off", "the", "temp_func_list", "as", "we", "do", "not", "need", "to", "perform", "this", "action", "again", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255979}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L748-L767", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Returns an arbitrary attribute of a sitetree item resolved as current for current page.", "language": "python", "parameters": "(self, attr_name, tree_alias, context)", "return_statement": "return getattr(current_item, attr_name, '')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_2", ",", "arg_4", "=", "arg_0", ".", "init_tree", "(", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "get_tree_current_item", "(", "arg_2", ")", "if", "arg_5", "is", "None", ":", "if", "settings", ".", "DEBUG", "and", "RAISE_ITEMS_ERRORS_ON_DEBUG", ":", "raise", "SiteTreeError", "(", "'Unable to resolve current sitetree item to get a `%s` for current page. Check whether '", "'there is an appropriate sitetree item defined for current URL.'", "%", "arg_1", ")", "return", "''", "return", "getattr", "(", "arg_5", ",", "arg_1", ",", "''", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Returns an arbitrary attribute of a sitetree item resolved as current for current page.\n\n        :param str|unicode attr_name:\n        :param str|unicode tree_alias:\n        :param Context context:\n        :rtype: str|unicode\n        \"\"\"\n        arg_2, arg_4 = arg_0.init_tree(arg_2, arg_3)\n        arg_5 = arg_0.get_tree_current_item(arg_2)\n\n        if arg_5 is None:\n            if settings.DEBUG and RAISE_ITEMS_ERRORS_ON_DEBUG:\n                raise SiteTreeError(\n                    'Unable to resolve current sitetree item to get a `%s` for current page. Check whether '\n                    'there is an appropriate sitetree item defined for current URL.' % arg_1)\n\n            return ''\n\n        return getattr(arg_5, arg_1, '')", "path": "sitetree/sitetreeapp.py", "identifier": "SiteTree.get_current_page_attr", "docstring": "Returns an arbitrary attribute of a sitetree item resolved as current for current page.\n\n        :param str|unicode attr_name:\n        :param str|unicode tree_alias:\n        :param Context context:\n        :rtype: str|unicode", "docstring_tokens": ["Returns", "an", "arbitrary", "attribute", "of", "a", "sitetree", "item", "resolved", "as", "current", "for", "current", "page", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 255980}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/fastqc.py#L133-L231", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Main executor of the fastq template.", "language": "python", "parameters": "(fastq_pair, adapter_file, cpus)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "logger", ".", "info", "(", "\"Starting fastqc\"", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "logger", ".", "info", "(", "\"Adapters file provided: {}\"", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "convert_adatpers", "(", "arg_1", ")", "else", ":", "logger", ".", "info", "(", "\"Adapters file '{}' not provided or does not \"", "\"exist\"", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "None", "arg_4", "=", "[", "\"fastqc\"", ",", "\"--extract\"", ",", "\"--nogroup\"", ",", "\"--format\"", ",", "\"fastq\"", ",", "\"--threads\"", ",", "str", "(", "arg_2", ")", "]", "if", "arg_3", ":", "arg_4", "+=", "[", "\"--adapters\"", ",", "\"{}\"", ".", "format", "(", "arg_3", ")", "]", "arg_4", "+=", "arg_0", "logger", ".", "debug", "(", "\"Running fastqc subprocess with command: {}\"", ".", "format", "(", "arg_4", ")", ")", "arg_5", "=", "subprocess", ".", "Popen", "(", "arg_4", ",", "arg_6", "=", "PIPE", ",", "arg_7", "=", "PIPE", ",", "shell", "=", "False", ")", "arg_6", ",", "arg_7", "=", "arg_5", ".", "communicate", "(", ")", "try", ":", "arg_7", "=", "arg_7", ".", "decode", "(", "\"utf8\"", ")", "except", "(", "UnicodeDecodeError", ",", "AttributeError", ")", ":", "arg_7", "=", "str", "(", "arg_7", ")", "logger", ".", "info", "(", "\"Finished fastqc subprocess with STDOUT:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_6", ")", ")", "logger", ".", "info", "(", "\"Fished fastqc subprocesswith STDERR:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_7", ")", ")", "logger", ".", "info", "(", "\"Finished fastqc with return code: {}\"", ".", "format", "(", "arg_5", ".", "returncode", ")", ")", "logger", ".", "info", "(", "\"Checking if FastQC output was correctly generated\"", ")", "with", "open", "(", "\".status\"", ",", "\"w\"", ")", "as", "status_fh", ":", "for", "arg_8", "in", "arg_0", ":", "arg_9", "=", "join", "(", "arg_8", ".", "rsplit", "(", "\".\"", ",", "2", ")", "[", "0", "]", "+", "\"_fastqc\"", ",", "\"fastqc_data.txt\"", ")", "logger", ".", "debug", "(", "\"Checking path: {}\"", ".", "format", "(", "arg_9", ")", ")", "if", "not", "exists", "(", "arg_9", ")", ":", "logger", ".", "warning", "(", "\"Path does not exist: {}\"", ".", "format", "(", "arg_9", ")", ")", "status_fh", ".", "write", "(", "\"fail\"", ")", "return", "logger", ".", "debug", "(", "\"Found path: {}\"", ".", "format", "(", "arg_9", ")", ")", "status_fh", ".", "write", "(", "\"pass\"", ")", "logger", ".", "info", "(", "\"Retrieving relevant FastQC output files\"", ")", "for", "arg_10", ",", "arg_8", "in", "enumerate", "(", "arg_0", ")", ":", "arg_11", "=", "arg_8", ".", "rsplit", "(", "\".\"", ",", "2", ")", "[", "0", "]", "+", "\"_fastqc\"", "arg_12", "=", "join", "(", "arg_11", ",", "\"summary.txt\"", ")", "logger", ".", "debug", "(", "\"Retrieving summary file: {}\"", ".", "format", "(", "arg_12", ")", ")", "arg_13", "=", "join", "(", "arg_11", ",", "\"fastqc_data.txt\"", ")", "logger", ".", "debug", "(", "\"Retrieving data file: {}\"", ".", "format", "(", "arg_13", ")", ")", "os", ".", "rename", "(", "arg_13", ",", "\"pair_{}_data\"", ".", "format", "(", "arg_10", "+", "1", ")", ")", "os", ".", "rename", "(", "arg_12", ",", "\"pair_{}_summary\"", ".", "format", "(", "arg_10", "+", "1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Main executor of the fastq template.\n\n    Parameters\n    ----------\n    fastq_pair : list\n        Two element list containing the paired FastQ files.\n    adapter_file : str\n        Path to adapters file.\n    cpus : int or str\n        Number of cpu's that will be by FastQC.\n\n    \"\"\"\n\n    logger.info(\"Starting fastqc\")\n\n    # If an adapter file was provided, convert it to FastQC format\n    if os.path.exists(arg_1):\n        logger.info(\"Adapters file provided: {}\".format(arg_1))\n        arg_3 = convert_adatpers(arg_1)\n    else:\n        logger.info(\"Adapters file '{}' not provided or does not \"\n                    \"exist\".format(arg_1))\n        arg_3 = None\n\n    # Setting command line for FastQC\n    arg_4 = [\n        \"fastqc\",\n        \"--extract\",\n        \"--nogroup\",\n        \"--format\",\n        \"fastq\",\n        \"--threads\",\n        str(arg_2)\n    ]\n\n    # Add adapters file to command line, if it exists\n    if arg_3:\n        arg_4 += [\"--adapters\", \"{}\".format(arg_3)]\n\n    # Add FastQ files at the end of command line\n    arg_4 += arg_0\n\n    logger.debug(\"Running fastqc subprocess with command: {}\".format(arg_4))\n\n    arg_5 = subprocess.Popen(arg_4, arg_6=PIPE, arg_7=PIPE, shell=False)\n    arg_6, arg_7 = arg_5.communicate()\n\n    # Attempt to decode STDERR output from bytes. If unsuccessful, coerce to\n    # string\n    try:\n        arg_7 = arg_7.decode(\"utf8\")\n    except (UnicodeDecodeError, AttributeError):\n        arg_7 = str(arg_7)\n\n    logger.info(\"Finished fastqc subprocess with STDOUT:\\\\n\"\n                \"======================================\\\\n{}\".format(arg_6))\n    logger.info(\"Fished fastqc subprocesswith STDERR:\\\\n\"\n                \"======================================\\\\n{}\".format(arg_7))\n    logger.info(\"Finished fastqc with return code: {}\".format(\n        arg_5.returncode))\n\n    logger.info(\"Checking if FastQC output was correctly generated\")\n    # Check if the FastQC output was correctly generated.\n    with open(\".status\", \"w\") as status_fh:\n        for arg_8 in arg_0:\n            arg_9 = join(arg_8.rsplit(\".\", 2)[0] + \"_fastqc\",\n                         \"fastqc_data.txt\")\n            logger.debug(\"Checking path: {}\".format(arg_9))\n            # If the FastQC output does not exist, pass the STDERR to\n            # the output status channel and exit\n            if not exists(arg_9):\n                logger.warning(\"Path does not exist: {}\".format(arg_9))\n                status_fh.write(\"fail\")\n                return\n\n            logger.debug(\"Found path: {}\".format(arg_9))\n\n        # If the output directories exist, write 'pass' to the output status\n        # channel\n            status_fh.write(\"pass\")\n\n    logger.info(\"Retrieving relevant FastQC output files\")\n\n    # Both FastQC have been correctly executed. Get the relevant FastQC\n    # output files for the output channel\n    for arg_10, arg_8 in enumerate(arg_0):\n        # Get results for each pair\n        arg_11 = arg_8.rsplit(\".\", 2)[0] + \"_fastqc\"\n\n        arg_12 = join(arg_11, \"summary.txt\")\n        logger.debug(\"Retrieving summary file: {}\".format(arg_12))\n        arg_13 = join(arg_11, \"fastqc_data.txt\")\n        logger.debug(\"Retrieving data file: {}\".format(arg_13))\n\n        # Rename output files to a file name that is easier to handle in the\n        # output channel\n        os.rename(arg_13, \"pair_{}_data\".format(arg_10 + 1))\n        os.rename(arg_12, \"pair_{}_summary\".format(arg_10 + 1))", "path": "flowcraft/templates/fastqc.py", "identifier": "main", "docstring": "Main executor of the fastq template.\n\n    Parameters\n    ----------\n    fastq_pair : list\n        Two element list containing the paired FastQ files.\n    adapter_file : str\n        Path to adapters file.\n    cpus : int or str\n        Number of cpu's that will be by FastQC.", "docstring_tokens": ["Main", "executor", "of", "the", "fastq", "template", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 255981}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L92-L100", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Causes the bot to ignore all messages from the channel.", "language": "python", "parameters": "(self, channel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "info", "(", "'Sleeping in %s'", ",", "arg_1", ")", "arg_0", ".", "_bot", ".", "dispatcher", ".", "ignore", "(", "arg_1", ")", "arg_0", ".", "send_message", "(", "arg_1", ",", "'Good night'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Causes the bot to ignore all messages from the channel.\n\n        Usage:\n        !Func [channel name] - ignore the specified channel (or current if none specified)\n        \"\"\"\n        arg_0.log.info('Sleeping in %s', arg_1)\n        arg_0._bot.dispatcher.ignore(arg_1)\n        arg_0.send_message(arg_1, 'Good night')", "path": "slackminion/plugins/core/core.py", "identifier": "Core.sleep", "docstring": "Causes the bot to ignore all messages from the channel.\n\n        Usage:\n        !sleep [channel name] - ignore the specified channel (or current if none specified)", "docstring_tokens": ["Causes", "the", "bot", "to", "ignore", "all", "messages", "from", "the", "channel", "."], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 255982}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py#L42-L52", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get a seq of Commandchain objects that match key", "language": "python", "parameters": "(self, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "strs", ":", "yield", "arg_0", ".", "strs", "[", "arg_1", "]", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "regexs", ".", "items", "(", ")", ":", "if", "re", ".", "match", "(", "arg_2", ",", "arg_1", ")", ":", "yield", "arg_3", "else", ":", "pass"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Get a seq of Commandchain objects that match key \"\"\"\n        if arg_1 in arg_0.strs:\n            yield arg_0.strs[arg_1]\n\n        for arg_2, arg_3 in arg_0.regexs.items():\n            if re.match(arg_2, arg_1):\n                yield arg_3\n            else:\n                #print \"nomatch\",key  # dbg\n                pass", "path": "environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py", "identifier": "StrDispatch.dispatch", "docstring": "Get a seq of Commandchain objects that match key", "docstring_tokens": ["Get", "a", "seq", "of", "Commandchain", "objects", "that", "match", "key"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 255983}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1299-L1341", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Determine the default cache location", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "return", "os", ".", "environ", "[", "'PYTHON_EGG_CACHE'", "]", "except", "KeyError", ":", "pass", "if", "os", ".", "name", "!=", "'nt'", ":", "return", "os", ".", "path", ".", "expanduser", "(", "'~/.python-eggs'", ")", "arg_0", "=", "'Application Data'", "arg_1", "=", "[", "(", "(", "'APPDATA'", ",", ")", ",", "None", ")", ",", "(", "(", "'USERPROFILE'", ",", ")", ",", "arg_0", ")", ",", "(", "(", "'HOMEDRIVE'", ",", "'HOMEPATH'", ")", ",", "arg_0", ")", ",", "(", "(", "'HOMEPATH'", ",", ")", ",", "arg_0", ")", ",", "(", "(", "'HOME'", ",", ")", ",", "None", ")", ",", "(", "(", "'WINDIR'", ",", ")", ",", "arg_0", ")", ",", "]", "for", "arg_2", ",", "arg_3", "in", "arg_1", ":", "dirname", "=", "''", "for", "key", "in", "arg_2", ":", "if", "key", "in", "os", ".", "environ", ":", "dirname", "=", "os", ".", "path", ".", "join", "(", "dirname", ",", "os", ".", "environ", "[", "key", "]", ")", "else", ":", "break", "else", ":", "if", "arg_3", ":", "dirname", "=", "os", ".", "path", ".", "join", "(", "dirname", ",", "arg_3", ")", "return", "os", ".", "path", ".", "join", "(", "dirname", ",", "'Python-Eggs'", ")", "else", ":", "raise", "RuntimeError", "(", "\"Please set the PYTHON_EGG_CACHE enviroment variable\"", ")"], "function": "def Func():\n    \"\"\"Determine the default cache location\n\n    This returns the ``PYTHON_EGG_CACHE`` environment variable, if set.\n    Otherwise, on Windows, it returns a \"Python-Eggs\" subdirectory of the\n    \"Application Data\" directory.  On all other systems, it's \"~/.python-eggs\".\n    \"\"\"\n    try:\n        return os.environ['PYTHON_EGG_CACHE']\n    except KeyError:\n        pass\n\n    if os.name!='nt':\n        return os.path.expanduser('~/.python-eggs')\n\n    # XXX this may be locale-specific!\n    arg_0 = 'Application Data'\n    arg_1 = [\n        # best option, should be locale-safe\n        (('APPDATA',), None),\n        (('USERPROFILE',), arg_0),\n        (('HOMEDRIVE','HOMEPATH'), arg_0),\n        (('HOMEPATH',), arg_0),\n        (('HOME',), None),\n        # 95/98/ME\n        (('WINDIR',), arg_0),\n    ]\n\n    for arg_2, arg_3 in arg_1:\n        dirname = ''\n        for key in arg_2:\n            if key in os.environ:\n                dirname = os.path.join(dirname, os.environ[key])\n            else:\n                break\n        else:\n            if arg_3:\n                dirname = os.path.join(dirname, arg_3)\n            return os.path.join(dirname, 'Python-Eggs')\n    else:\n        raise RuntimeError(\n            \"Please set the PYTHON_EGG_CACHE enviroment variable\"\n        )", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", "identifier": "get_default_cache", "docstring": "Determine the default cache location\n\n    This returns the ``PYTHON_EGG_CACHE`` environment variable, if set.\n    Otherwise, on Windows, it returns a \"Python-Eggs\" subdirectory of the\n    \"Application Data\" directory.  On all other systems, it's \"~/.python-eggs\".", "docstring_tokens": ["Determine", "the", "default", "cache", "location"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 255984}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L431-L444", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Check if the java home set", "language": "python", "parameters": "()", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "\"JAVA_HOME\"", "not", "in", "os", ".", "environ", ":", "Log", ".", "error", "(", "\"JAVA_HOME not set\"", ")", "return", "False", "arg_0", "=", "get_java_path", "(", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", "and", "os", ".", "access", "(", "arg_0", ",", "os", ".", "X_OK", ")", ":", "return", "True", "Log", ".", "error", "(", "\"JAVA_HOME/bin/java either does not exist or not an executable\"", ")", "return", "False"], "function": "def Func():\n  \"\"\"Check if the java home set\"\"\"\n  # check if environ variable is set\n  if \"JAVA_HOME\" not in os.environ:\n    Log.error(\"JAVA_HOME not set\")\n    return False\n\n  # check if the value set is correct\n  arg_0 = get_java_path()\n  if os.path.isfile(arg_0) and os.access(arg_0, os.X_OK):\n    return True\n\n  Log.error(\"JAVA_HOME/bin/java either does not exist or not an executable\")\n  return False", "path": "heron/tools/common/src/python/utils/config.py", "identifier": "check_java_home_set", "docstring": "Check if the java home set", "docstring_tokens": ["Check", "if", "the", "java", "home", "set"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 255985}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/automl/autoh2o.py#L443-L455", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Download the POJO for the leader model in AutoML to the directory specified by path.", "language": "python", "parameters": "(self, path=\"\", get_genmodel_jar=False, genmodel_name=\"\")", "return_statement": "return h2o.download_pojo(self.leader, path, get_jar=get_genmodel_jar, jar_name=genmodel_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "False", ",", "arg_3", "=", "\"\"", ")", ":", "return", "h2o", ".", "Func", "(", "arg_0", ".", "leader", ",", "arg_1", ",", "get_jar", "=", "arg_2", ",", "jar_name", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=\"\", arg_2=False, arg_3=\"\"):\n        \"\"\"\n        Download the POJO for the leader model in AutoML to the directory specified by path.\n\n        If path is an empty string, then dump the output to screen.\n\n        :param path:  An absolute path to the directory where POJO should be saved.\n        :param get_genmodel_jar: if True, then also download h2o-genmodel.jar and store it in folder ``path``.\n        :param genmodel_name Custom name of genmodel jar\n        :returns: name of the POJO file written.\n        \"\"\"\n\n        return h2o.Func(arg_0.leader, arg_1, get_jar=arg_2, jar_name=arg_3)", "path": "h2o-py/h2o/automl/autoh2o.py", "identifier": "H2OAutoML.download_pojo", "docstring": "Download the POJO for the leader model in AutoML to the directory specified by path.\n\n        If path is an empty string, then dump the output to screen.\n\n        :param path:  An absolute path to the directory where POJO should be saved.\n        :param get_genmodel_jar: if True, then also download h2o-genmodel.jar and store it in folder ``path``.\n        :param genmodel_name Custom name of genmodel jar\n        :returns: name of the POJO file written.", "docstring_tokens": ["Download", "the", "POJO", "for", "the", "leader", "model", "in", "AutoML", "to", "the", "directory", "specified", "by", "path", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 255986}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/compiler/transpiler.py#L153-L178", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Select a PassManager and run a single circuit through it.", "language": "python", "parameters": "(circuit_config_tuple)", "return_statement": "return pass_manager.run(circuit)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", "if", "arg_2", ".", "pass_manager", ":", "arg_3", "=", "arg_2", ".", "pass_manager", "elif", "arg_2", ".", "coupling_map", ":", "arg_3", "=", "default_pass_manager", "(", "arg_2", ".", "basis_gates", ",", "arg_2", ".", "coupling_map", ",", "arg_2", ".", "initial_layout", ",", "arg_2", ".", "seed_transpiler", ")", "else", ":", "arg_3", "=", "default_pass_manager_simulator", "(", "arg_2", ".", "basis_gates", ")", "return", "arg_3", ".", "run", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Select a PassManager and run a single circuit through it.\n\n    Args:\n        circuit_config_tuple (tuple):\n            circuit (QuantumCircuit): circuit to transpile\n            transpile_config (TranspileConfig): configuration dictating how to transpile\n\n    Returns:\n        QuantumCircuit: transpiled circuit\n    \"\"\"\n    arg_1, arg_2 = arg_0\n\n    # if the pass manager is not already selected, choose an appropriate one.\n    if arg_2.pass_manager:\n        arg_3 = arg_2.pass_manager\n\n    elif arg_2.coupling_map:\n        arg_3 = default_pass_manager(arg_2.basis_gates,\n                                            arg_2.coupling_map,\n                                            arg_2.initial_layout,\n                                            arg_2.seed_transpiler)\n    else:\n        arg_3 = default_pass_manager_simulator(arg_2.basis_gates)\n\n    return arg_3.run(arg_1)", "path": "qiskit/compiler/transpiler.py", "identifier": "_transpile_circuit", "docstring": "Select a PassManager and run a single circuit through it.\n\n    Args:\n        circuit_config_tuple (tuple):\n            circuit (QuantumCircuit): circuit to transpile\n            transpile_config (TranspileConfig): configuration dictating how to transpile\n\n    Returns:\n        QuantumCircuit: transpiled circuit", "docstring_tokens": ["Select", "a", "PassManager", "and", "run", "a", "single", "circuit", "through", "it", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 255987}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L67-L134", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Sets SoX's global arguments.\n        Overwrites any previously set global arguments.\n        If this function is not explicity called, globals are set to this\n        function's defaults.", "language": "python", "parameters": "(self, dither=False, guard=False, multithread=False,\n                    replay_gain=False, verbosity=2)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "2", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "bool", ")", ":", "raise", "ValueError", "(", "'dither must be a boolean.'", ")", "if", "not", "isinstance", "(", "arg_2", ",", "bool", ")", ":", "raise", "ValueError", "(", "'guard must be a boolean.'", ")", "if", "not", "isinstance", "(", "arg_3", ",", "bool", ")", ":", "raise", "ValueError", "(", "'multithread must be a boolean.'", ")", "if", "not", "isinstance", "(", "arg_4", ",", "bool", ")", ":", "raise", "ValueError", "(", "'replay_gain must be a boolean.'", ")", "if", "arg_5", "not", "in", "VERBOSITY_VALS", ":", "raise", "ValueError", "(", "'Invalid value for VERBOSITY. Must be one {}'", ".", "format", "(", "VERBOSITY_VALS", ")", ")", "arg_6", "=", "[", "]", "if", "not", "arg_1", ":", "arg_6", ".", "append", "(", "'-D'", ")", "if", "arg_2", ":", "arg_6", ".", "append", "(", "'-G'", ")", "if", "arg_3", ":", "arg_6", ".", "append", "(", "'--multi-threaded'", ")", "if", "arg_4", ":", "arg_6", ".", "append", "(", "'--replay-gain'", ")", "arg_6", ".", "append", "(", "'track'", ")", "arg_6", ".", "append", "(", "'-V{}'", ".", "format", "(", "arg_5", ")", ")", "arg_0", ".", "globals", "=", "arg_6", "return", "arg_0"], "function": "def Func(arg_0, arg_1=False, arg_2=False, arg_3=False,\n                    arg_4=False, arg_5=2):\n        '''Sets SoX's global arguments.\n        Overwrites any previously set global arguments.\n        If this function is not explicity called, globals are set to this\n        function's defaults.\n\n        Parameters\n        ----------\n        dither : bool, default=False\n            If True, dithering is applied for low files with low bit rates.\n        guard : bool, default=False\n            If True, invokes the gain effect to guard against clipping.\n        multithread : bool, default=False\n            If True, each channel is processed in parallel.\n        replay_gain : bool, default=False\n            If True, applies replay-gain adjustment to input-files.\n        verbosity : int, default=2\n            SoX's verbosity level. One of:\n                * 0 : No messages are shown at all\n                * 1 : Only error messages are shown. These are generated if SoX\n                    cannot complete the requested commands.\n                * 2 : Warning messages are also shown. These are generated if\n                    SoX can complete the requested commands, but not exactly\n                    according to the requested command parameters, or if\n                    clipping occurs.\n                * 3 : Descriptions of SoX\u2019s processing phases are also shown.\n                    Useful for seeing exactly how SoX is processing your audio.\n                * 4, >4 : Messages to help with debugging SoX are also shown.\n\n        '''\n        if not isinstance(arg_1, bool):\n            raise ValueError('dither must be a boolean.')\n\n        if not isinstance(arg_2, bool):\n            raise ValueError('guard must be a boolean.')\n\n        if not isinstance(arg_3, bool):\n            raise ValueError('multithread must be a boolean.')\n\n        if not isinstance(arg_4, bool):\n            raise ValueError('replay_gain must be a boolean.')\n\n        if arg_5 not in VERBOSITY_VALS:\n            raise ValueError(\n                'Invalid value for VERBOSITY. Must be one {}'.format(\n                    VERBOSITY_VALS)\n            )\n\n        arg_6 = []\n\n        if not arg_1:\n            arg_6.append('-D')\n\n        if arg_2:\n            arg_6.append('-G')\n\n        if arg_3:\n            arg_6.append('--multi-threaded')\n\n        if arg_4:\n            arg_6.append('--replay-gain')\n            arg_6.append('track')\n\n        arg_6.append('-V{}'.format(arg_5))\n\n        arg_0.globals = arg_6\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.set_globals", "docstring": "Sets SoX's global arguments.\n        Overwrites any previously set global arguments.\n        If this function is not explicity called, globals are set to this\n        function's defaults.\n\n        Parameters\n        ----------\n        dither : bool, default=False\n            If True, dithering is applied for low files with low bit rates.\n        guard : bool, default=False\n            If True, invokes the gain effect to guard against clipping.\n        multithread : bool, default=False\n            If True, each channel is processed in parallel.\n        replay_gain : bool, default=False\n            If True, applies replay-gain adjustment to input-files.\n        verbosity : int, default=2\n            SoX's verbosity level. One of:\n                * 0 : No messages are shown at all\n                * 1 : Only error messages are shown. These are generated if SoX\n                    cannot complete the requested commands.\n                * 2 : Warning messages are also shown. These are generated if\n                    SoX can complete the requested commands, but not exactly\n                    according to the requested command parameters, or if\n                    clipping occurs.\n                * 3 : Descriptions of SoX\u2019s processing phases are also shown.\n                    Useful for seeing exactly how SoX is processing your audio.\n                * 4, >4 : Messages to help with debugging SoX are also shown.", "docstring_tokens": ["Sets", "SoX", "s", "global", "arguments", ".", "Overwrites", "any", "previously", "set", "global", "arguments", ".", "If", "this", "function", "is", "not", "explicity", "called", "globals", "are", "set", "to", "this", "function", "s", "defaults", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 255988}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L3490-L3512", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a dictionary containing the full config names as keys and the config parameters\n        or the config parameter data items as values.", "language": "python", "parameters": "(self, fast_access=False, copy=True)", "return_statement": "return self._return_item_dictionary(self._config, fast_access, copy)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "return", "arg_0", ".", "_return_item_dictionary", "(", "arg_0", ".", "_config", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n        \"\"\"Returns a dictionary containing the full config names as keys and the config parameters\n        or the config parameter data items as values.\n\n\n        :param fast_access:\n\n            Determines whether the parameter objects or their values are returned\n            in the dictionary.\n\n        :param copy:\n\n            Whether the original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n            Not Copying and fast access do not work at the same time! Raises ValueError\n            if fast access is true and copy false.\n\n        :return: Dictionary containing the config data\n\n        :raises: ValueError\n\n        \"\"\"\n        return arg_0._return_item_dictionary(arg_0._config, arg_1, arg_2)", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_get_config", "docstring": "Returns a dictionary containing the full config names as keys and the config parameters\n        or the config parameter data items as values.\n\n\n        :param fast_access:\n\n            Determines whether the parameter objects or their values are returned\n            in the dictionary.\n\n        :param copy:\n\n            Whether the original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n            Not Copying and fast access do not work at the same time! Raises ValueError\n            if fast access is true and copy false.\n\n        :return: Dictionary containing the config data\n\n        :raises: ValueError", "docstring_tokens": ["Returns", "a", "dictionary", "containing", "the", "full", "config", "names", "as", "keys", "and", "the", "config", "parameters", "or", "the", "config", "parameter", "data", "items", "as", "values", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 255989}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L561-L571", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Remove unwanted logbooks from list.", "language": "python", "parameters": "(self, type=None, logs=[])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "[", "]", ")", ":", "if", "arg_1", "is", "not", "None", "and", "arg_1", "in", "arg_0", ".", "logList", ":", "if", "len", "(", "arg_2", ")", "==", "0", "or", "arg_2", "==", "\"All\"", ":", "del", "arg_0", ".", "logList", "[", "arg_1", "]", "else", ":", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "in", "arg_0", ".", "logList", "[", "arg_1", "]", ":", "arg_0", ".", "logList", "[", "arg_1", "]", ".", "remove", "(", "arg_3", ")", "arg_0", ".", "changeLogType", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=[]):\n        '''Remove unwanted logbooks from list.'''\n        if arg_1 is not None and arg_1 in arg_0.logList:\n            if len(arg_2) == 0 or arg_2 == \"All\":\n                del arg_0.logList[arg_1]\n            else:\n                for arg_3 in arg_2:\n                    if arg_3 in arg_0.logList[arg_1]:\n                        arg_0.logList[arg_1].remove(arg_3)\n            \n            arg_0.changeLogType()", "path": "scisalt/facettools/logbookForm.py", "identifier": "LogSelectMenu.removeLogbooks", "docstring": "Remove unwanted logbooks from list.", "docstring_tokens": ["Remove", "unwanted", "logbooks", "from", "list", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 255990}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/config.py#L18-L25", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Gets a config by name.", "language": "python", "parameters": "(name, fallback=None)", "return_statement": "return cli_config.get('servicefabric', name, fallback)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "CLIConfig", "(", "SF_CLI_CONFIG_DIR", ",", "SF_CLI_ENV_VAR_PREFIX", ")", "return", "arg_2", ".", "get", "(", "'servicefabric'", ",", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Gets a config by name.\n\n    In the case where the config name is not found, will use fallback value.\"\"\"\n\n    arg_2 = CLIConfig(SF_CLI_CONFIG_DIR, SF_CLI_ENV_VAR_PREFIX)\n\n    return arg_2.get('servicefabric', arg_0, arg_1)", "path": "rcctl/rcctl/config.py", "identifier": "get_config_value", "docstring": "Gets a config by name.\n\n    In the case where the config name is not found, will use fallback value.", "docstring_tokens": ["Gets", "a", "config", "by", "name", "."], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 255991}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/risk.py#L280-L325", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Returns arrays of long, short and gross market cap exposures of an\n    algorithm's positions", "language": "python", "parameters": "(positions, caps)", "return_statement": "return long_exposures, short_exposures, gross_exposures, net_exposures", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "arg_6", "=", "arg_0", ".", "drop", "(", "'cash'", ",", "axis", "=", "'columns'", ")", "arg_7", "=", "arg_6", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "'columns'", ")", "arg_8", "=", "arg_6", "[", "arg_6", ">", "0", "]", ".", "sum", "(", "axis", "=", "'columns'", ")", "arg_9", "=", "arg_6", "[", "arg_6", "<", "0", "]", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "'columns'", ")", "for", "arg_10", ",", "arg_11", "in", "CAP_BUCKETS", ".", "items", "(", ")", ":", "arg_12", "=", "arg_6", "[", "(", "arg_1", ">=", "arg_11", "[", "0", "]", ")", "&", "(", "arg_1", "<=", "arg_11", "[", "1", "]", ")", "]", "arg_13", "=", "arg_12", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "'columns'", ")", ".", "divide", "(", "arg_7", ")", "arg_14", "=", "arg_12", "[", "arg_12", ">", "0", "]", ".", "sum", "(", "axis", "=", "'columns'", ")", ".", "divide", "(", "arg_8", ")", "arg_15", "=", "arg_12", "[", "arg_12", "<", "0", "]", ".", "sum", "(", "axis", "=", "'columns'", ")", ".", "divide", "(", "arg_9", ")", "arg_16", "=", "arg_14", ".", "subtract", "(", "arg_15", ")", "arg_4", ".", "append", "(", "arg_13", ")", "arg_2", ".", "append", "(", "arg_14", ")", "arg_3", ".", "append", "(", "arg_15", ")", "arg_5", ".", "append", "(", "arg_16", ")", "return", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns arrays of long, short and gross market cap exposures of an\n    algorithm's positions\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Daily equity positions of algorithm, in dollars.\n        - See full explanation in compute_style_factor_exposures.\n\n    caps : pd.DataFrame\n        Daily Morningstar sector code per asset\n        - See full explanation in create_risk_tear_sheet\n    \"\"\"\n\n    arg_2 = []\n    arg_3 = []\n    arg_4 = []\n    arg_5 = []\n\n    arg_6 = arg_0.drop('cash', axis='columns')\n    arg_7 = arg_6.abs().sum(axis='columns')\n    arg_8 = arg_6[arg_6 > 0] \\\n        .sum(axis='columns')\n    arg_9 = arg_6[arg_6 < 0] \\\n        .abs().sum(axis='columns')\n\n    for arg_10, arg_11 in CAP_BUCKETS.items():\n        arg_12 = arg_6[(arg_1 >= arg_11[0]) &\n                                      (arg_1 <= arg_11[1])]\n\n        arg_13 = arg_12.abs().sum(axis='columns') \\\n            .divide(arg_7)\n        arg_14 = arg_12[arg_12 > 0] \\\n            .sum(axis='columns').divide(arg_8)\n        arg_15 = arg_12[arg_12 < 0] \\\n            .sum(axis='columns').divide(arg_9)\n        arg_16 = arg_14.subtract(arg_15)\n\n        arg_4.append(arg_13)\n        arg_2.append(arg_14)\n        arg_3.append(arg_15)\n        arg_5.append(arg_16)\n\n    return arg_2, arg_3, arg_4, arg_5", "path": "pyfolio/risk.py", "identifier": "compute_cap_exposures", "docstring": "Returns arrays of long, short and gross market cap exposures of an\n    algorithm's positions\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        Daily equity positions of algorithm, in dollars.\n        - See full explanation in compute_style_factor_exposures.\n\n    caps : pd.DataFrame\n        Daily Morningstar sector code per asset\n        - See full explanation in create_risk_tear_sheet", "docstring_tokens": ["Returns", "arrays", "of", "long", "short", "and", "gross", "market", "cap", "exposures", "of", "an", "algorithm", "s", "positions"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 255992}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1065-L1074", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Calculate MD5 hash code for a local file", "language": "python", "parameters": "(self, filename, block_size=2**20)", "return_statement": "return m.hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", "**", "20", ")", ":", "arg_3", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "f", ":", "while", "True", ":", "arg_4", "=", "f", ".", "read", "(", "arg_2", ")", "if", "not", "arg_4", ":", "break", "arg_3", ".", "update", "(", "arg_4", ")", "return", "arg_3", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=2**20):\n    '''Calculate MD5 hash code for a local file'''\n    arg_3 = hashlib.md5()\n    with open(arg_1, 'rb') as f:\n      while True:\n        arg_4 = f.read(arg_2)\n        if not arg_4:\n          break\n        arg_3.update(arg_4)\n    return arg_3.hexdigest()", "path": "s4cmd.py", "identifier": "LocalMD5Cache.file_hash", "docstring": "Calculate MD5 hash code for a local file", "docstring_tokens": ["Calculate", "MD5", "hash", "code", "for", "a", "local", "file"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 255993}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/common/check_gpu.py#L26-L39", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "r\"\"\"Return True if at least one GPU is available", "language": "python", "parameters": "()", "return_statement": "return _gpu_available", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "arg_4", "if", "arg_4", "is", "None", ":", "arg_0", "=", "tf", ".", "ConfigProto", "(", ")", "arg_0", ".", "gpu_options", ".", "allow_growth", "=", "True", "try", ":", "with", "tf", ".", "Session", "(", "config", "=", "arg_0", ")", ":", "arg_3", "=", "device_lib", ".", "list_local_devices", "(", ")", "arg_4", "=", "any", "(", "device", ".", "device_type", "==", "'GPU'", "for", "device", "in", "arg_3", ")", "except", "AttributeError", "as", "e", ":", "log", ".", "warning", "(", "f'Got an AttributeError `{e}`, assuming documentation building'", ")", "arg_4", "=", "False", "return", "arg_4"], "function": "def Func():\n    r\"\"\"Return True if at least one GPU is available\"\"\"\n    global arg_4\n    if arg_4 is None:\n        arg_0 = tf.ConfigProto()\n        arg_0.gpu_options.allow_growth = True\n        try:\n            with tf.Session(config=arg_0):\n                arg_3 = device_lib.list_local_devices()\n                arg_4 = any(device.device_type == 'GPU' for device in arg_3)\n        except AttributeError as e:\n            log.warning(f'Got an AttributeError `{e}`, assuming documentation building')\n            arg_4 = False\n    return arg_4", "path": "deeppavlov/core/common/check_gpu.py", "identifier": "check_gpu_existence", "docstring": "r\"\"\"Return True if at least one GPU is available", "docstring_tokens": ["r", "Return", "True", "if", "at", "least", "one", "GPU", "is", "available"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 255994}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L83-L96", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "Given a list of list of dicts, return just the dicts.", "language": "python", "parameters": "(l)", "return_statement": "return dicts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "type", "(", "arg_0", ")", "is", "dict", ":", "return", "[", "arg_0", "]", "if", "\"numpy\"", "in", "str", "(", "type", "(", "arg_0", ")", ")", ":", "return", "arg_0", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "type", "(", "arg_2", ")", "==", "dict", ":", "arg_1", ".", "append", "(", "arg_2", ")", "elif", "type", "(", "arg_2", ")", "==", "list", ":", "for", "arg_3", "in", "arg_2", ":", "arg_1", ".", "append", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Given a list of list of dicts, return just the dicts.\"\"\"\n    if type(arg_0) is dict:\n        return [arg_0]\n    if \"numpy\" in str(type(arg_0)):\n        return arg_0\n    arg_1=[]\n    for arg_2 in arg_0:\n        if type(arg_2)==dict:\n            arg_1.append(arg_2)\n        elif type(arg_2)==list:\n            for arg_3 in arg_2:\n                arg_1.append(arg_3)\n    return arg_1", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "dictFlat", "docstring": "Given a list of list of dicts, return just the dicts.", "docstring_tokens": ["Given", "a", "list", "of", "list", "of", "dicts", "return", "just", "the", "dicts", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 255995}
{"url": "https://github.com/ehazlett/ignition/blob/618776fccd199c4613e105ee55955b40e52d3e68/ignition/__init__.py#L115-L147", "sha": "618776fccd199c4613e105ee55955b40e52d3e68", "docstring_summary": "Creates base directories for app, virtualenv, and nginx", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "'Checking directories'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "_ve_dir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "_ve_dir", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "_app_dir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "_app_dir", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "_conf_dir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "_conf_dir", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "_var_dir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "_var_dir", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "_log_dir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "_log_dir", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "_script_dir", ")", ":", "os", ".", "makedirs", "(", "arg_0", ".", "_script_dir", ")", "arg_1", "=", "'/etc/nginx/uwsgi_params'", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "shutil", ".", "copy", "(", "arg_1", ",", "arg_0", ".", "_conf_dir", ")", "else", ":", "logging", ".", "warning", "(", "'Unable to find Nginx uwsgi_params.  You must manually copy this to {0}.'", ".", "format", "(", "arg_0", ".", "_conf_dir", ")", ")", "arg_2", "=", "'/etc/nginx/mime.types'", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "shutil", ".", "copy", "(", "arg_2", ",", "arg_0", ".", "_conf_dir", ")", "arg_0", ".", "_include_mimetypes", "=", "True", "else", ":", "logging", ".", "warn", "(", "'Unable to find mime.types for Nginx.  You must manually copy this to {0}.'", ".", "format", "(", "arg_0", ".", "_conf_dir", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Creates base directories for app, virtualenv, and nginx\n\n        \"\"\"\n        arg_0.log.debug('Checking directories')\n        if not os.path.exists(arg_0._ve_dir):\n            os.makedirs(arg_0._ve_dir)\n        if not os.path.exists(arg_0._app_dir):\n            os.makedirs(arg_0._app_dir)\n        if not os.path.exists(arg_0._conf_dir):\n            os.makedirs(arg_0._conf_dir)\n        if not os.path.exists(arg_0._var_dir):\n            os.makedirs(arg_0._var_dir)\n        if not os.path.exists(arg_0._log_dir):\n            os.makedirs(arg_0._log_dir)\n        if not os.path.exists(arg_0._script_dir):\n            os.makedirs(arg_0._script_dir)\n\n        # copy uswgi_params for nginx\n        arg_1 = '/etc/nginx/uwsgi_params'\n        if os.path.exists(arg_1):\n            shutil.copy(arg_1, arg_0._conf_dir)\n        else:\n            logging.warning('Unable to find Nginx uwsgi_params.  You must manually copy this to {0}.'.format(arg_0._conf_dir))\n\n        # copy mime.types for nginx\n        arg_2 = '/etc/nginx/mime.types'\n        if os.path.exists(arg_2):\n            shutil.copy(arg_2, arg_0._conf_dir)\n            arg_0._include_mimetypes = True\n        else:\n            logging.warn('Unable to find mime.types for Nginx.  You must manually copy this to {0}.'.format(arg_0._conf_dir))", "path": "ignition/__init__.py", "identifier": "ProjectCreator.check_directories", "docstring": "Creates base directories for app, virtualenv, and nginx", "docstring_tokens": ["Creates", "base", "directories", "for", "app", "virtualenv", "and", "nginx"], "nwo": "ehazlett/ignition", "score": 0.17782712273869106, "idx": 255996}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L556-L580", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Analyze a module.", "language": "python", "parameters": "(self, morf)", "return_statement": "return (\n            analysis.filename,\n            sorted(analysis.statements),\n            sorted(analysis.excluded),\n            sorted(analysis.missing),\n            analysis.missing_formatted(),\n            )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_analyze", "(", "arg_1", ")", "return", "(", "arg_2", ".", "filename", ",", "sorted", "(", "arg_2", ".", "statements", ")", ",", "sorted", "(", "arg_2", ".", "excluded", ")", ",", "sorted", "(", "arg_2", ".", "missing", ")", ",", "arg_2", ".", "missing_formatted", "(", ")", ",", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Analyze a module.\n\n        `morf` is a module or a filename.  It will be analyzed to determine\n        its coverage statistics.  The return value is a 5-tuple:\n\n        * The filename for the module.\n        * A list of line numbers of executable statements.\n        * A list of line numbers of excluded statements.\n        * A list of line numbers of statements not run (missing from\n          execution).\n        * A readable formatted string of the missing line numbers.\n\n        The analysis uses the source file itself and the current measured\n        coverage data.\n\n        \"\"\"\n        arg_2 = arg_0._analyze(arg_1)\n        return (\n            arg_2.filename,\n            sorted(arg_2.statements),\n            sorted(arg_2.excluded),\n            sorted(arg_2.missing),\n            arg_2.missing_formatted(),\n            )", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage.analysis2", "docstring": "Analyze a module.\n\n        `morf` is a module or a filename.  It will be analyzed to determine\n        its coverage statistics.  The return value is a 5-tuple:\n\n        * The filename for the module.\n        * A list of line numbers of executable statements.\n        * A list of line numbers of excluded statements.\n        * A list of line numbers of statements not run (missing from\n          execution).\n        * A readable formatted string of the missing line numbers.\n\n        The analysis uses the source file itself and the current measured\n        coverage data.", "docstring_tokens": ["Analyze", "a", "module", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 255997}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dstat.py#L192-L197", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Presenter to force yaml.dump to use multi-line string style.", "language": "python", "parameters": "(self, dumper, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "'\\n'", "in", "arg_2", ":", "return", "arg_1", ".", "represent_scalar", "(", "'tag:yaml.org,2002:str'", ",", "arg_2", ",", "style", "=", "'|'", ")", "else", ":", "return", "arg_1", ".", "represent_scalar", "(", "'tag:yaml.org,2002:str'", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Presenter to force yaml.dump to use multi-line string style.\"\"\"\n    if '\\n' in arg_2:\n      return arg_1.represent_scalar('tag:yaml.org,2002:str', arg_2, style='|')\n    else:\n      return arg_1.represent_scalar('tag:yaml.org,2002:str', arg_2)", "path": "dsub/commands/dstat.py", "identifier": "YamlOutput.string_presenter", "docstring": "Presenter to force yaml.dump to use multi-line string style.", "docstring_tokens": ["Presenter", "to", "force", "yaml", ".", "dump", "to", "use", "multi", "-", "line", "string", "style", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 255998}
{"url": "https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/models.py#L375-L458", "sha": "fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb", "docstring_summary": "Parses mt940 data, expects a string with data", "language": "python", "parameters": "(self, data)", "return_statement": "return self.transactions", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "'\\n'", ".", "join", "(", "arg_0", ".", "strip", "(", "arg_1", ".", "split", "(", "'\\n'", ")", ")", ")", "arg_2", "=", "re", ".", "compile", "(", "r'^:\\n?(?P<full_tag>(?P<tag>[0-9]{2}|NS)(?P<sub_tag>[A-Z])?):'", ",", "re", ".", "MULTILINE", ")", "arg_3", "=", "list", "(", "arg_2", ".", "finditer", "(", "arg_1", ")", ")", "arg_4", "=", "list", "(", "arg_0", ".", "sanatize_tag_id_matches", "(", "arg_3", ")", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ")", ":", "arg_7", "=", "arg_0", ".", "normalize_tag_id", "(", "arg_6", ".", "group", "(", "'tag'", ")", ")", "arg_8", "=", "arg_0", ".", "tags", ".", "get", "(", "arg_6", ".", "group", "(", "'full_tag'", ")", ")", "or", "arg_0", ".", "tags", "[", "arg_7", "]", "if", "arg_4", "[", "arg_5", "+", "1", ":", "]", ":", "arg_9", "=", "arg_1", "[", "arg_6", ".", "end", "(", ")", ":", "arg_4", "[", "arg_5", "+", "1", "]", ".", "start", "(", ")", "]", ".", "strip", "(", ")", "else", ":", "arg_9", "=", "arg_1", "[", "arg_6", ".", "end", "(", ")", ":", "]", ".", "strip", "(", ")", "arg_10", "=", "arg_8", ".", "Func", "(", "arg_0", ",", "arg_9", ")", "for", "arg_11", "in", "arg_0", ".", "processors", ".", "get", "(", "'pre_%s'", "%", "arg_8", ".", "slug", ",", "[", "]", ")", ":", "arg_10", "=", "arg_11", "(", "arg_0", ",", "arg_8", ",", "arg_10", ")", "arg_12", "=", "arg_8", "(", "arg_0", ",", "arg_10", ")", "for", "arg_11", "in", "arg_0", ".", "processors", ".", "get", "(", "'post_%s'", "%", "arg_8", ".", "slug", ",", "[", "]", ")", ":", "arg_12", "=", "arg_11", "(", "arg_0", ",", "arg_8", ",", "arg_10", ",", "arg_12", ")", "if", "isinstance", "(", "arg_8", ",", "mt940", ".", "tags", ".", "Statement", ")", ":", "if", "not", "arg_0", ".", "transactions", ":", "arg_13", "=", "Transaction", "(", "arg_0", ")", "arg_0", ".", "transactions", ".", "append", "(", "arg_13", ")", "if", "arg_13", ".", "data", ".", "get", "(", "'id'", ")", ":", "arg_13", "=", "Transaction", "(", "arg_0", ",", "arg_12", ")", "arg_0", ".", "transactions", ".", "append", "(", "arg_13", ")", "else", ":", "arg_13", ".", "data", ".", "update", "(", "arg_12", ")", "elif", "issubclass", "(", "arg_8", ".", "scope", ",", "Transaction", ")", "and", "arg_0", ".", "transactions", ":", "for", "arg_14", ",", "arg_15", "in", "_compat", ".", "iteritems", "(", "arg_12", ")", ":", "if", "arg_14", "in", "arg_13", ".", "data", "and", "hasattr", "(", "arg_15", ",", "'strip'", ")", ":", "arg_13", ".", "data", "[", "arg_14", "]", "+=", "'\\n%s'", "%", "arg_15", ".", "strip", "(", ")", "else", ":", "arg_13", ".", "data", "[", "arg_14", "]", "=", "arg_15", "elif", "issubclass", "(", "arg_8", ".", "scope", ",", "Transactions", ")", ":", "arg_0", ".", "data", ".", "update", "(", "arg_12", ")", "return", "arg_0", ".", "transactions"], "function": "def Func(arg_0, arg_1):\n        '''Parses mt940 data, expects a string with data\n\n        Args:\n            data (str): The MT940 data\n\n        Returns: :py:class:`list` of :py:class:`Transaction`\n        '''\n        # Remove extraneous whitespace and such\n        arg_1 = '\\n'.join(arg_0.strip(arg_1.split('\\n')))\n\n        # The pattern is a bit annoying to match by regex, even with a greedy\n        # match it's difficult to get both the beginning and the end so we're\n        # working around it in a safer way to get everything.\n        arg_2 = re.compile(\n            r'^:\\n?(?P<full_tag>(?P<tag>[0-9]{2}|NS)(?P<sub_tag>[A-Z])?):',\n            re.MULTILINE)\n        arg_3 = list(arg_2.finditer(arg_1))\n\n        # identify valid matches\n        arg_4 = list(arg_0.sanatize_tag_id_matches(arg_3))\n\n        for arg_5, arg_6 in enumerate(arg_4):\n            arg_7 = arg_0.normalize_tag_id(arg_6.group('tag'))\n\n            # get tag instance corresponding to tag id\n            arg_8 = arg_0.tags.get(arg_6.group('full_tag')) \\\n                or arg_0.tags[arg_7]\n\n            # Nice trick to get all the text that is part of this tag, python\n            # regex matches have a `end()` and `start()` to indicate the start\n            # and end index of the match.\n\n            if arg_4[arg_5 + 1:]:\n                arg_9 = \\\n                    arg_1[arg_6.end():arg_4[arg_5 + 1].start()].strip()\n            else:\n                arg_9 = arg_1[arg_6.end():].strip()\n\n            arg_10 = arg_8.Func(arg_0, arg_9)\n\n            # Preprocess data before creating the object\n\n            for arg_11 in arg_0.processors.get('pre_%s' % arg_8.slug, []):\n                arg_10 = arg_11(arg_0, arg_8, arg_10)\n\n            arg_12 = arg_8(arg_0, arg_10)\n\n            # Postprocess the object\n\n            for arg_11 in arg_0.processors.get('post_%s' % arg_8.slug, []):\n                arg_12 = arg_11(arg_0, arg_8, arg_10, arg_12)\n\n            # Creating a new transaction for :20: and :61: tags allows the\n            # tags from :20: to :61: to be captured as part of the transaction.\n\n            if isinstance(arg_8, mt940.tags.Statement):\n                # Transactions only get a Transaction Reference Code ID from a\n                # :61: tag which is why a new transaction is created if the\n                # 'id' has a value.\n\n                if not arg_0.transactions:\n                    arg_13 = Transaction(arg_0)\n                    arg_0.transactions.append(arg_13)\n\n                if arg_13.data.get('id'):\n                    arg_13 = Transaction(arg_0, arg_12)\n                    arg_0.transactions.append(arg_13)\n                else:\n                    arg_13.data.update(arg_12)\n            elif issubclass(arg_8.scope, Transaction) and arg_0.transactions:\n                # Combine multiple results together as one string, Rabobank has\n                # multiple :86: tags for a single transaction\n\n                for arg_14, arg_15 in _compat.iteritems(arg_12):\n                    if arg_14 in arg_13.data and hasattr(arg_15, 'strip'):\n                        arg_13.data[arg_14] += '\\n%s' % arg_15.strip()\n                    else:\n                        arg_13.data[arg_14] = arg_15\n\n            elif issubclass(arg_8.scope, Transactions):  # pragma: no branch\n                arg_0.data.update(arg_12)\n\n        return arg_0.transactions", "path": "mt940/models.py", "identifier": "Transactions.parse", "docstring": "Parses mt940 data, expects a string with data\n\n        Args:\n            data (str): The MT940 data\n\n        Returns: :py:class:`list` of :py:class:`Transaction`", "docstring_tokens": ["Parses", "mt940", "data", "expects", "a", "string", "with", "data"], "nwo": "WoLpH/mt940", "score": 0.7184674620153859, "idx": 255999}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/genres.py#L34-L48", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the list of Movie genres.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the list of Movie genres.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/genres.py", "identifier": "Genres.movie_list", "docstring": "Get the list of Movie genres.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "list", "of", "Movie", "genres", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 256000}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L930-L937", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Iterator for node values.", "language": "python", "parameters": "(self, nodes=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_multi_graph", ".", "Func", "(", "arg_1", ",", "data", "=", "True", ")", ":", "yield", "arg_2", ",", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Iterator for node values.\n\n        Yield:\n            node: the node.\n        \"\"\"\n        for arg_2, arg_3, arg_4 in arg_0._multi_graph.Func(arg_1, data=True):\n            yield arg_2, arg_3, arg_4", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.edges", "docstring": "Iterator for node values.\n\n        Yield:\n            node: the node.", "docstring_tokens": ["Iterator", "for", "node", "values", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256001}
{"url": "https://github.com/jmcclell/django-bootstrap-pagination/blob/3a8187fb6e9b7c2ea4563698e1c3d117204e5049/bootstrap_pagination/templatetags/bootstrap_pagination.py#L57-L99", "sha": "3a8187fb6e9b7c2ea4563698e1c3d117204e5049", "docstring_summary": "Helper function to return a valid URL string given the template tag parameters", "language": "python", "parameters": "(page_num, current_app, url_view_name, url_extra_args, url_extra_kwargs, url_param_name, url_get_params, url_anchor)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_4", "[", "arg_5", "]", "=", "arg_0", "try", ":", "arg_8", "=", "reverse", "(", "arg_2", ",", "args", "=", "arg_3", ",", "kwargs", "=", "arg_4", ",", "arg_1", "=", "arg_1", ")", "except", "NoReverseMatch", "as", "e", ":", "if", "settings", ".", "SETTINGS_MODULE", ":", "if", "django", ".", "VERSION", "<", "(", "1", ",", "9", ",", "0", ")", ":", "arg_9", "=", "'.'", "else", ":", "arg_9", "=", "':'", "arg_10", "=", "settings", ".", "SETTINGS_MODULE", ".", "split", "(", "'.'", ")", "[", "0", "]", "try", ":", "arg_8", "=", "reverse", "(", "arg_10", "+", "arg_9", "+", "arg_2", ",", "args", "=", "arg_3", ",", "kwargs", "=", "arg_4", ",", "arg_1", "=", "arg_1", ")", "except", "NoReverseMatch", ":", "raise", "e", "else", ":", "raise", "e", "else", ":", "arg_8", "=", "''", "arg_6", "=", "arg_6", "or", "QueryDict", "(", "arg_8", ")", "arg_6", "=", "arg_6", ".", "copy", "(", ")", "arg_6", "[", "arg_5", "]", "=", "str", "(", "arg_0", ")", "if", "len", "(", "arg_6", ")", ">", "0", ":", "if", "not", "isinstance", "(", "arg_6", ",", "QueryDict", ")", ":", "arg_11", "=", "QueryDict", "(", "mutable", "=", "True", ")", "arg_11", ".", "update", "(", "arg_6", ")", "arg_6", "=", "arg_11", "arg_8", "+=", "'?'", "+", "arg_6", ".", "urlencode", "(", ")", "if", "(", "arg_7", "is", "not", "None", ")", ":", "arg_8", "+=", "'#'", "+", "arg_7", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7):\n    \"\"\"\n    Helper function to return a valid URL string given the template tag parameters\n    \"\"\"\n    if arg_2 is not None:\n        # Add page param to the kwargs list. Overrides any previously set parameter of the same name.\n        arg_4[arg_5] = arg_0\n\n        try:\n            arg_8 = reverse(arg_2, args=arg_3, kwargs=arg_4, arg_1=arg_1)\n        except NoReverseMatch as e:  # Attempt to load view from application root, allowing the use of non-namespaced view names if your view is defined in the root application\n            if settings.SETTINGS_MODULE:\n\n                if django.VERSION < (1, 9, 0):\n                    arg_9  = '.'\n                else:\n                    arg_9  = ':' # Namespace separator changed to colon after 1.8\n\n                arg_10 = settings.SETTINGS_MODULE.split('.')[0]\n                try:\n                    arg_8 = reverse(arg_10 + arg_9 + arg_2, args=arg_3, kwargs=arg_4, arg_1=arg_1)\n                except NoReverseMatch:\n                    raise e # Raise the original exception so the error message doesn't confusingly include something the Developer didn't add to the view name themselves\n            else:\n                raise e # We can't determine the project name so just re-throw the exception\n\n    else:\n        arg_8 = ''\n        arg_6 = arg_6 or QueryDict(arg_8)\n        arg_6 = arg_6.copy()\n        arg_6[arg_5] = str(arg_0)\n\n    if len(arg_6) > 0:\n        if not isinstance(arg_6, QueryDict):\n            arg_11 = QueryDict(mutable=True)\n            arg_11.update(arg_6)\n            arg_6 = arg_11\n        arg_8 += '?' + arg_6.urlencode()\n\n    if (arg_7 is not None):\n        arg_8 += '#' + arg_7\n\n    return arg_8", "path": "bootstrap_pagination/templatetags/bootstrap_pagination.py", "identifier": "get_page_url", "docstring": "Helper function to return a valid URL string given the template tag parameters", "docstring_tokens": ["Helper", "function", "to", "return", "a", "valid", "URL", "string", "given", "the", "template", "tag", "parameters"], "nwo": "jmcclell/django-bootstrap-pagination", "score": 0.5598884592426002, "idx": 256002}
{"url": "https://github.com/larsyencken/proj/blob/44fd72aeb9bbf72046d81c4e9e4306a23335dc0a/proj/__init__.py#L55-L63", "sha": "44fd72aeb9bbf72046d81c4e9e4306a23335dc0a", "docstring_summary": "Move an active project to the archive.", "language": "python", "parameters": "(folder, dry_run=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "for", "arg_2", "in", "arg_0", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "bail", "(", "'folder does not exist: '", "+", "arg_2", ")", "_Func_safe", "(", "arg_0", ",", "PROJ_ARCHIVE", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"Move an active project to the Func.\"\n    # error handling on Func_dir already done in main()\n\n    for arg_2 in arg_0:\n        if not os.path.exists(arg_2):\n            bail('folder does not exist: ' + arg_2)\n\n    _Func_safe(arg_0, PROJ_ARCHIVE, arg_1=arg_1)", "path": "proj/__init__.py", "identifier": "archive", "docstring": "Move an active project to the archive.", "docstring_tokens": ["Move", "an", "active", "project", "to", "the", "archive", "."], "nwo": "larsyencken/proj", "score": 0.2619419494340654, "idx": 256003}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/github.py#L53-L74", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Reads the file from Github", "language": "python", "parameters": "(self, uri)", "return_statement": "return r.read().decode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"Reading %s\"", "%", "(", "arg_1", ")", ")", "arg_0", ".", "__check_looks_like_uri", "(", "arg_1", ")", "try", ":", "arg_2", "=", "urllib", ".", "request", ".", "Request", "(", "arg_1", ")", "arg_2", ".", "add_header", "(", "'Authorization'", ",", "'token %s'", "%", "arg_0", ".", "token", ")", "arg_3", "=", "urllib", ".", "request", ".", "urlopen", "(", "arg_2", ")", "except", "urllib", ".", "error", ".", "HTTPError", "as", "err", ":", "if", "err", ".", "code", "==", "404", ":", "raise", "GithubFileNotFound", "(", "'File %s is not available. Check the URL to ensure it really exists'", "%", "arg_1", ")", "else", ":", "raise", "return", "arg_3", ".", "read", "(", ")", ".", "decode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Reads the file from Github\n\n        :param uri: URI of the Github raw File\n\n        :returns: UTF-8 text with the content\n        \"\"\"\n        logger.debug(\"Reading %s\" % (arg_1))\n\n        arg_0.__check_looks_like_uri(arg_1)\n\n        try:\n            arg_2 = urllib.request.Request(arg_1)\n            arg_2.add_header('Authorization', 'token %s' % arg_0.token)\n            arg_3 = urllib.request.urlopen(arg_2)\n        except urllib.error.HTTPError as err:\n            if err.code == 404:\n                raise GithubFileNotFound('File %s is not available. Check the URL to ensure it really exists' % arg_1)\n            else:\n                raise\n\n        return arg_3.read().decode(\"utf-8\")", "path": "sirmordred/github.py", "identifier": "Github.read_file_from_uri", "docstring": "Reads the file from Github\n\n        :param uri: URI of the Github raw File\n\n        :returns: UTF-8 text with the content", "docstring_tokens": ["Reads", "the", "file", "from", "Github"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 256004}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3636-L3679", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Return a list of column names", "language": "python", "parameters": "(self, virtual=True, strings=True, hidden=False, regex=None)", "return_statement": "return [name for name in self.column_names if column_filter(name)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "def", "column_filter", "(", "arg_5", ")", ":", "if", "arg_4", "and", "not", "re", ".", "match", "(", "arg_4", ",", "arg_5", ")", ":", "return", "False", "if", "not", "arg_1", "and", "arg_5", "in", "arg_0", ".", "virtual_columns", ":", "return", "False", "if", "not", "arg_2", "and", "(", "arg_0", ".", "dtype", "(", "arg_5", ")", "==", "str_type", "or", "arg_0", ".", "dtype", "(", "arg_5", ")", ".", "type", "==", "np", ".", "string_", ")", ":", "return", "False", "if", "not", "arg_3", "and", "arg_5", ".", "startswith", "(", "'__'", ")", ":", "return", "False", "return", "True", "return", "[", "arg_5", "for", "arg_5", "in", "arg_0", ".", "column_names", "if", "column_filter", "(", "arg_5", ")", "]"], "function": "def Func(arg_0, arg_1=True, arg_2=True, arg_3=False, arg_4=None):\n        \"\"\"Return a list of column names\n\n        Example:\n\n        >>> import vaex\n        >>> df = vaex.from_scalars(x=1, x2=2, y=3, s='string')\n        >>> df['r'] = (df.x**2 + df.y**2)**2\n        >>> df.Func()\n        ['x', 'x2', 'y', 's', 'r']\n        >>> df.Func(virtual=False)\n        ['x', 'x2', 'y', 's']\n        >>> df.Func(regex='x.*')\n        ['x', 'x2']\n\n        :param virtual: If False, skip virtual columns\n        :param hidden: If False, skip hidden columns\n        :param strings: If False, skip string columns\n        :param regex: Only return column names matching the (optional) regular expression\n        :rtype: list of str\n\n        Example:\n        >>> import vaex\n        >>> df = vaex.from_scalars(x=1, x2=2, y=3, s='string')\n        >>> df['r'] = (df.x**2 + df.y**2)**2\n        >>> df.Func()\n        ['x', 'x2', 'y', 's', 'r']\n        >>> df.Func(virtual=False)\n        ['x', 'x2', 'y', 's']\n        >>> df.Func(regex='x.*')\n        ['x', 'x2']\n        \"\"\"\n        def column_filter(arg_5):\n            '''Return True if column with specified name should be returned'''\n            if arg_4 and not re.match(arg_4, arg_5):\n                return False\n            if not arg_1 and arg_5 in arg_0.virtual_columns:\n                return False\n            if not arg_2 and (arg_0.dtype(arg_5) == str_type or arg_0.dtype(arg_5).type == np.string_):\n                return False\n            if not arg_3 and arg_5.startswith('__'):\n                return False\n            return True\n        return [arg_5 for arg_5 in arg_0.column_names if column_filter(arg_5)]", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.get_column_names", "docstring": "Return a list of column names\n\n        Example:\n\n        >>> import vaex\n        >>> df = vaex.from_scalars(x=1, x2=2, y=3, s='string')\n        >>> df['r'] = (df.x**2 + df.y**2)**2\n        >>> df.get_column_names()\n        ['x', 'x2', 'y', 's', 'r']\n        >>> df.get_column_names(virtual=False)\n        ['x', 'x2', 'y', 's']\n        >>> df.get_column_names(regex='x.*')\n        ['x', 'x2']\n\n        :param virtual: If False, skip virtual columns\n        :param hidden: If False, skip hidden columns\n        :param strings: If False, skip string columns\n        :param regex: Only return column names matching the (optional) regular expression\n        :rtype: list of str\n\n        Example:\n        >>> import vaex\n        >>> df = vaex.from_scalars(x=1, x2=2, y=3, s='string')\n        >>> df['r'] = (df.x**2 + df.y**2)**2\n        >>> df.get_column_names()\n        ['x', 'x2', 'y', 's', 'r']\n        >>> df.get_column_names(virtual=False)\n        ['x', 'x2', 'y', 's']\n        >>> df.get_column_names(regex='x.*')\n        ['x', 'x2']", "docstring_tokens": ["Return", "a", "list", "of", "column", "names"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 256005}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/graph.py#L324-L347", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Add text for a datapoint", "language": "python", "parameters": "(self, x, y, value, style=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "not", "arg_0", ".", "show_data_values", ":", "return", "arg_5", "=", "etree", ".", "SubElement", "(", "arg_0", ".", "foreground", ",", "'text'", ",", "{", "'x'", ":", "str", "(", "arg_1", ")", ",", "'y'", ":", "str", "(", "arg_2", ")", ",", "'class'", ":", "'dataPointLabel'", ",", "'style'", ":", "'%(style)s stroke: #fff; stroke-width: 2;'", "%", "vars", "(", ")", ",", "}", ")", "arg_5", ".", "text", "=", "str", "(", "arg_3", ")", "arg_5", "=", "etree", ".", "SubElement", "(", "arg_0", ".", "foreground", ",", "'text'", ",", "{", "'x'", ":", "str", "(", "arg_1", ")", ",", "'y'", ":", "str", "(", "arg_2", ")", ",", "'class'", ":", "'dataPointLabel'", "}", ")", "arg_5", ".", "text", "=", "str", "(", "arg_3", ")", "if", "arg_4", ":", "arg_5", ".", "set", "(", "'style'", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n\t\t\"\"\"\n\t\tAdd text for a datapoint\n\t\t\"\"\"\n\t\tif not arg_0.show_data_values:\n\t\t\t# do nothing\n\t\t\treturn\n\t\t# first lay down the text in a wide white stroke to\n\t\t#  differentiate it from the background\n\t\targ_5 = etree.SubElement(arg_0.foreground, 'text', {\n\t\t\t'x': str(arg_1),\n\t\t\t'y': str(arg_2),\n\t\t\t'class': 'dataPointLabel',\n\t\t\t'style': '%(style)s stroke: #fff; stroke-width: 2;' % vars(),\n\t\t})\n\t\targ_5.text = str(arg_3)\n\t\t# then lay down the text in the specified style\n\t\targ_5 = etree.SubElement(arg_0.foreground, 'text', {\n\t\t\t'x': str(arg_1),\n\t\t\t'y': str(arg_2),\n\t\t\t'class': 'dataPointLabel'})\n\t\targ_5.text = str(arg_3)\n\t\tif arg_4:\n\t\t\targ_5.set('style', arg_4)", "path": "svg/charts/graph.py", "identifier": "Graph.make_datapoint_text", "docstring": "Add text for a datapoint", "docstring_tokens": ["Add", "text", "for", "a", "datapoint"], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 256006}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/dictlist.py#L153-L157", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Replace an object by another with the same id.", "language": "python", "parameters": "(self, new_object)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "id", "arg_3", "=", "arg_0", ".", "_dict", "[", "arg_2", "]", "list", ".", "__setitem__", "(", "arg_0", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Replace an object by another with the same id.\"\"\"\n        arg_2 = arg_1.id\n        arg_3 = arg_0._dict[arg_2]\n        list.__setitem__(arg_0, arg_3, arg_1)", "path": "cobra/core/dictlist.py", "identifier": "DictList._replace_on_id", "docstring": "Replace an object by another with the same id.", "docstring_tokens": ["Replace", "an", "object", "by", "another", "with", "the", "same", "id", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 256007}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py#L302-L322", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Restart a kernel while keeping clients connected.", "language": "python", "parameters": "(self, kernel_id)", "return_statement": "return new_kernel_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_check_kernel_id", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "get_kernel", "(", "arg_1", ")", "arg_2", ".", "Func", "(", ")", "arg_0", ".", "log", ".", "info", "(", "\"Kernel restarted: %s\"", "%", "arg_1", ")", "return", "arg_1", "arg_3", "=", "arg_0", ".", "notebook_for_kernel", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "start_kernel", "(", ")", "arg_0", ".", "kill_kernel", "(", "arg_1", ")", "arg_0", ".", "set_kernel_for_notebook", "(", "arg_3", ",", "arg_4", ")", "arg_0", ".", "log", ".", "info", "(", "\"Kernel restarted: %s\"", "%", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Restart a kernel while keeping clients connected.\"\"\"\n        arg_0._check_kernel_id(arg_1)\n        arg_2 = arg_0.get_kernel(arg_1)\n        arg_2.Func()\n        arg_0.log.info(\"Kernel restarted: %s\" % arg_1)\n        return arg_1\n        \n        # the following remains, in case the KM restart machinery is\n        # somehow unacceptable\n        # Get the notebook_id to preserve the kernel/notebook association.\n        arg_3 = arg_0.notebook_for_kernel(arg_1)\n        # Create the new kernel first so we can move the clients over.\n        arg_4 = arg_0.start_kernel()\n        # Now kill the old kernel.\n        arg_0.kill_kernel(arg_1)\n        # Now save the new kernel/notebook association. We have to save it\n        # after the old kernel is killed as that will delete the mapping.\n        arg_0.set_kernel_for_notebook(arg_3, arg_4)\n        arg_0.log.info(\"Kernel restarted: %s\" % arg_4)\n        return arg_4", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py", "identifier": "MappingKernelManager.restart_kernel", "docstring": "Restart a kernel while keeping clients connected.", "docstring_tokens": ["Restart", "a", "kernel", "while", "keeping", "clients", "connected", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256008}
{"url": "https://github.com/Skyscanner/pages/blob/f80471ef01f84b11e4d751dff1e6398ae1e230b8/pages/element_with_traits.py#L61-L74", "sha": "f80471ef01f84b11e4d751dff1e6398ae1e230b8", "docstring_summary": "Evaluates traits and returns a list containing the description of traits which are not true.\n        Notice that if LAZY_EVALUATION is set to False all traits are evaluated before returning. Use this option\n        only for debugging purposes.", "language": "python", "parameters": "(self)", "return_statement": "return return_value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "traits", ":", "if", "not", "arg_2", ".", "condition", "(", ")", ":", "if", "not", "arg_0", ".", "traits_eager_evaluation", ":", "return", "[", "arg_2", ".", "description", "]", "else", ":", "arg_1", ".", "append", "(", "arg_2", ".", "description", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Evaluates traits and returns a list containing the description of traits which are not true.\n        Notice that if LAZY_EVALUATION is set to False all traits are evaluated before returning. Use this option\n        only for debugging purposes.\n        \"\"\"\n        arg_1 = []\n        for arg_2 in arg_0.traits:\n            if not arg_2.condition():\n                if not arg_0.traits_eager_evaluation:\n                    return [arg_2.description]\n                else:\n                    arg_1.append(arg_2.description)\n        return arg_1", "path": "pages/element_with_traits.py", "identifier": "ElementWithTraits.evaluate_traits", "docstring": "Evaluates traits and returns a list containing the description of traits which are not true.\n        Notice that if LAZY_EVALUATION is set to False all traits are evaluated before returning. Use this option\n        only for debugging purposes.", "docstring_tokens": ["Evaluates", "traits", "and", "returns", "a", "list", "containing", "the", "description", "of", "traits", "which", "are", "not", "true", ".", "Notice", "that", "if", "LAZY_EVALUATION", "is", "set", "to", "False", "all", "traits", "are", "evaluated", "before", "returning", ".", "Use", "this", "option", "only", "for", "debugging", "purposes", "."], "nwo": "Skyscanner/pages", "score": 0.18843024134315003, "idx": 256009}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/passes/topython.py#L64-L75", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Generates python code calling the function and returning True.", "language": "python", "parameters": "(self, node: parsing.CallTrue)", "return_statement": "return ast.Lambda(\n            ast.arguments([], None, None, [], None, None, [], []),\n            ast.BoolOp(\n                ast.Or(),\n                [\n                    self.visit_Call(node),\n                    ast.Name('True', ast.Load())]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "CallTrue", ")", "->", "ast", ".", "expr", ":", "return", "ast", ".", "Lambda", "(", "ast", ".", "arguments", "(", "[", "]", ",", "None", ",", "None", ",", "[", "]", ",", "None", ",", "None", ",", "[", "]", ",", "[", "]", ")", ",", "ast", ".", "BoolOp", "(", "ast", ".", "Or", "(", ")", ",", "[", "arg_0", ".", "visit_Call", "(", "arg_1", ")", ",", "ast", ".", "Name", "(", "'True'", ",", "ast", ".", "Load", "(", ")", ")", "]", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2.CallTrue) -> ast.expr:\n        \"\"\"Generates python code calling the function and returning True.\n\n        lambda: fn(*args) or True\n        \"\"\"\n        return ast.Lambda(\n            ast.arguments([], None, None, [], None, None, [], []),\n            ast.BoolOp(\n                ast.Or(),\n                [\n                    arg_0.visit_Call(arg_1),\n                    ast.Name('True', ast.Load())]))", "path": "pyrser/passes/topython.py", "identifier": "RuleVisitor.visit_CallTrue", "docstring": "Generates python code calling the function and returning True.\n\n        lambda: fn(*args) or True", "docstring_tokens": ["Generates", "python", "code", "calling", "the", "function", "and", "returning", "True", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 256010}
{"url": "https://github.com/lsst-sqre/ltd-conveyor/blob/c492937c4c1e050ccc4a0b9dcc38f9980d57e305/ltdconveyor/keeper/login.py#L12-L39", "sha": "c492937c4c1e050ccc4a0b9dcc38f9980d57e305", "docstring_summary": "Get a temporary auth token from LTD Keeper.", "language": "python", "parameters": "(host, username, password)", "return_statement": "return r.json()['token']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "urljoin", "(", "arg_0", ",", "'/token'", ")", "arg_4", "=", "requests", ".", "get", "(", "arg_3", ",", "auth", "=", "(", "arg_1", ",", "arg_2", ")", ")", "if", "arg_4", ".", "status_code", "!=", "200", ":", "raise", "KeeperError", "(", "'Could not authenticate to {0}: error {1:d}\\n{2}'", ".", "format", "(", "arg_0", ",", "arg_4", ".", "status_code", ",", "arg_4", ".", "json", "(", ")", ")", ")", "return", "arg_4", ".", "json", "(", ")", "[", "'token'", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Get a temporary auth token from LTD Keeper.\n\n    Parameters\n    ----------\n    host : `str`\n        Hostname of the LTD Keeper API (e.g., ``'https://keeper.lsst.codes'``).\n    username : `str`\n        Username.\n    password : `str`\n        Password.\n\n    Returns\n    -------\n    token : `str`\n        LTD Keeper API token.\n\n    Raises\n    ------\n    KeeperError\n        Raised if the LTD Keeper API cannot return a token.\n    \"\"\"\n    arg_3 = urljoin(arg_0, '/token')\n    arg_4 = requests.get(arg_3, auth=(arg_1, arg_2))\n    if arg_4.status_code != 200:\n        raise KeeperError('Could not authenticate to {0}: error {1:d}\\n{2}'.\n                          format(arg_0, arg_4.status_code, arg_4.json()))\n    return arg_4.json()['token']", "path": "ltdconveyor/keeper/login.py", "identifier": "get_keeper_token", "docstring": "Get a temporary auth token from LTD Keeper.\n\n    Parameters\n    ----------\n    host : `str`\n        Hostname of the LTD Keeper API (e.g., ``'https://keeper.lsst.codes'``).\n    username : `str`\n        Username.\n    password : `str`\n        Password.\n\n    Returns\n    -------\n    token : `str`\n        LTD Keeper API token.\n\n    Raises\n    ------\n    KeeperError\n        Raised if the LTD Keeper API cannot return a token.", "docstring_tokens": ["Get", "a", "temporary", "auth", "token", "from", "LTD", "Keeper", "."], "nwo": "lsst-sqre/ltd-conveyor", "score": 0.138843686048881, "idx": 256011}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/deploy.py#L194-L207", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Install polyaxon using the current config to the correct platform.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_valid", ":", "raise", "PolyaxonDeploymentConfigError", "(", "'Deployment type `{}` not supported'", ".", "format", "(", "arg_0", ".", "deployment_type", ")", ")", "if", "arg_0", ".", "is_kubernetes", ":", "arg_0", ".", "Func_on_kubernetes", "(", ")", "elif", "arg_0", ".", "is_docker_compose", ":", "arg_0", ".", "Func_on_docker_compose", "(", ")", "elif", "arg_0", ".", "is_docker", ":", "arg_0", ".", "Func_on_docker", "(", ")", "elif", "arg_0", ".", "is_heroku", ":", "arg_0", ".", "Func_on_heroku", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Install polyaxon using the current config to the correct platform.\"\"\"\n        if not arg_0.is_valid:\n            raise PolyaxonDeploymentConfigError(\n                'Deployment type `{}` not supported'.format(arg_0.deployment_type))\n\n        if arg_0.is_kubernetes:\n            arg_0.Func_on_kubernetes()\n        elif arg_0.is_docker_compose:\n            arg_0.Func_on_docker_compose()\n        elif arg_0.is_docker:\n            arg_0.Func_on_docker()\n        elif arg_0.is_heroku:\n            arg_0.Func_on_heroku()", "path": "polyaxon_cli/managers/deploy.py", "identifier": "DeployManager.install", "docstring": "Install polyaxon using the current config to the correct platform.", "docstring_tokens": ["Install", "polyaxon", "using", "the", "current", "config", "to", "the", "correct", "platform", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 256012}
{"url": "https://github.com/ChrisBeaumont/soupy/blob/795f2f61f711f574d5218fc8a3375d02bda1104f/soupy.py#L1294-L1329", "sha": "795f2f61f711f574d5218fc8a3375d02bda1104f", "docstring_summary": "Decorator for eval_ that prints a helpful error message\n    if an exception is generated in a Q expression", "language": "python", "parameters": "(method)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "arg_2", ")", ":", "try", ":", "return", "arg_0", "(", "arg_1", ",", "arg_2", ")", "except", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "sys", ".", "exc_info", "(", ")", "if", "hasattr", "(", "arg_4", ",", "'_RERAISE'", ")", ":", "arg_6", ",", "arg_7", ",", "arg_6", ",", "arg_8", "=", "arg_9", ".", "__debug_info__", "arg_9", ".", "__debug_info__", "=", "QDebug", "(", "arg_1", ",", "arg_7", ",", "arg_2", ",", "arg_8", ")", "raise", "if", "issubclass", "(", "arg_3", ",", "KeyError", ")", ":", "arg_3", "=", "QKeyError", "arg_11", "=", "repr", "(", "arg_2", ")", "if", "len", "(", "arg_11", ")", ">", "150", ":", "arg_11", "=", "\"<%s instance>\"", "%", "(", "type", "(", "arg_2", ")", ".", "__name__", ")", "arg_12", "=", "\"{0}\\n\\n\\tEncountered when evaluating {1}{2}\"", ".", "format", "(", "arg_4", ",", "arg_11", ",", "arg_1", ")", "arg_13", "=", "arg_3", "(", "arg_12", ")", "arg_13", ".", "_RERAISE", "=", "True", "arg_9", ".", "__debug_info__", "=", "QDebug", "(", "arg_1", ",", "arg_1", ",", "arg_2", ",", "arg_2", ")", "six", ".", "reraise", "(", "arg_3", ",", "arg_13", ",", "arg_5", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator for eval_ that prints a helpful error message\n    if an exception is generated in a Q expression\n    \"\"\"\n\n    @wraps(arg_0)\n    def wrapper(arg_1, arg_2):\n        try:\n            return arg_0(arg_1, arg_2)\n        except:\n            arg_3, arg_4, arg_5 = sys.exc_info()\n\n            if hasattr(arg_4, '_RERAISE'):\n                arg_6, arg_7, arg_6, arg_8 = arg_9.__debug_info__\n                arg_9.__debug_info__ = QDebug(arg_1, arg_7, arg_2, arg_8)\n                raise\n\n            if issubclass(arg_3, KeyError):  # Overrides formatting\n                arg_3 = QKeyError\n\n            # Show val, unless it's too long\n            arg_11 = repr(arg_2)\n            if len(arg_11) > 150:\n                arg_11 = \"<%s instance>\" % (type(arg_2).__name__)\n\n            arg_12 = \"{0}\\n\\n\\tEncountered when evaluating {1}{2}\".format(\n                arg_4, arg_11, arg_1)\n\n            arg_13 = arg_3(arg_12)\n            arg_13._RERAISE = True\n            arg_9.__debug_info__ = QDebug(arg_1, arg_1, arg_2, arg_2)\n\n            six.reraise(arg_3, arg_13, arg_5)\n\n    return wrapper", "path": "soupy.py", "identifier": "_helpful_failure", "docstring": "Decorator for eval_ that prints a helpful error message\n    if an exception is generated in a Q expression", "docstring_tokens": ["Decorator", "for", "eval_", "that", "prints", "a", "helpful", "error", "message", "if", "an", "exception", "is", "generated", "in", "a", "Q", "expression"], "nwo": "ChrisBeaumont/soupy", "score": 0.3938996721004794, "idx": 256013}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/filter.py#L495-L529", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Not used in the regular filter process for the time being.", "language": "python", "parameters": "(db_conn, center_lat, center_lon, buffer_km, update_secondary_data=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "True", ")", ":", "arg_5", "=", "add_wgs84_distance_function_to_db", "(", "arg_0", ")", "arg_6", "=", "\"SELECT stop_I FROM stops WHERE CAST(\"", "+", "arg_5", "+", "\"(lat, lon, {lat} , {lon}) AS INT) < {d_m}\"", ".", "format", "(", "lat", "=", "float", "(", "arg_1", ")", ",", "lon", "=", "float", "(", "arg_2", ")", ",", "d_m", "=", "int", "(", "1000", "*", "arg_3", ")", ")", "arg_7", "=", "\"SELECT distinct(trip_I) FROM stop_times WHERE stop_I IN (\"", "+", "arg_6", "+", "\")\"", "arg_8", "=", "\"SELECT trip_I FROM trips WHERE trip_I NOT IN ( \"", "+", "arg_7", "+", "\")\"", "arg_9", "=", "pandas", ".", "read_sql", "(", "arg_8", ",", "arg_0", ")", "[", "\"trip_I\"", "]", ".", "values", "arg_10", "=", "\",\"", ".", "join", "(", "[", "str", "(", "trip_I", ")", "for", "trip_I", "in", "arg_9", "]", ")", "arg_11", "=", "\"DELETE FROM trips WHERE trip_I IN (\"", "+", "arg_10", "+", "\")\"", "arg_12", "=", "\"DELETE FROM stop_times WHERE trip_I IN (\"", "+", "arg_10", "+", "\")\"", "arg_0", ".", "execute", "(", "arg_11", ")", "arg_0", ".", "execute", "(", "arg_12", ")", "delete_stops_not_in_stop_times_and_not_as_parent_stop", "(", "arg_0", ")", "arg_0", ".", "execute", "(", "DELETE_ROUTES_NOT_PRESENT_IN_TRIPS_SQL", ")", "arg_0", ".", "execute", "(", "DELETE_SHAPES_NOT_REFERENCED_IN_TRIPS_SQL", ")", "arg_0", ".", "execute", "(", "DELETE_DAYS_ENTRIES_NOT_PRESENT_IN_TRIPS_SQL", ")", "arg_0", ".", "execute", "(", "DELETE_DAY_TRIPS2_ENTRIES_NOT_PRESENT_IN_TRIPS_SQL", ")", "arg_0", ".", "execute", "(", "DELETE_CALENDAR_ENTRIES_FOR_NON_REFERENCE_SERVICE_IS_SQL", ")", "arg_0", ".", "execute", "(", "DELETE_CALENDAR_DATES_ENTRIES_FOR_NON_REFERENCE_SERVICE_IS_SQL", ")", "arg_0", ".", "execute", "(", "DELETE_FREQUENCIES_ENTRIES_NOT_PRESENT_IN_TRIPS", ")", "arg_0", ".", "execute", "(", "DELETE_AGENCIES_NOT_REFERENCED_IN_ROUTES_SQL", ")", "if", "arg_4", ":", "update_secondary_data_copies", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=True):\n    \"\"\"\n    Not used in the regular filter process for the time being.\n\n    Parameters\n    ----------\n    db_conn: sqlite3.Connection\n        connection to the GTFS object\n    center_lat: float\n    center_lon: float\n    buffer_km: float\n    \"\"\"\n    arg_5 = add_wgs84_distance_function_to_db(arg_0)\n    arg_6 = \"SELECT stop_I FROM stops WHERE CAST(\" + arg_5 + \\\n                                \"(lat, lon, {lat} , {lon}) AS INT) < {d_m}\"\\\n        .format(lat=float(arg_1), lon=float(arg_2), d_m=int(1000*arg_3))\n    arg_7 = \"SELECT distinct(trip_I) FROM stop_times WHERE stop_I IN (\" + arg_6 + \")\"\n    arg_8 = \"SELECT trip_I FROM trips WHERE trip_I NOT IN ( \" + arg_7 + \")\"\n    arg_9 = pandas.read_sql(arg_8, arg_0)[\"trip_I\"].values\n    arg_10 = \",\".join([str(trip_I) for trip_I in arg_9])\n    arg_11 = \"DELETE FROM trips WHERE trip_I IN (\" + arg_10 + \")\"\n    arg_12 = \"DELETE FROM stop_times WHERE trip_I IN (\" + arg_10  + \")\"\n    arg_0.execute(arg_11)\n    arg_0.execute(arg_12)\n    delete_stops_not_in_stop_times_and_not_as_parent_stop(arg_0)\n    arg_0.execute(DELETE_ROUTES_NOT_PRESENT_IN_TRIPS_SQL)\n    arg_0.execute(DELETE_SHAPES_NOT_REFERENCED_IN_TRIPS_SQL)\n    arg_0.execute(DELETE_DAYS_ENTRIES_NOT_PRESENT_IN_TRIPS_SQL)\n    arg_0.execute(DELETE_DAY_TRIPS2_ENTRIES_NOT_PRESENT_IN_TRIPS_SQL)\n    arg_0.execute(DELETE_CALENDAR_ENTRIES_FOR_NON_REFERENCE_SERVICE_IS_SQL)\n    arg_0.execute(DELETE_CALENDAR_DATES_ENTRIES_FOR_NON_REFERENCE_SERVICE_IS_SQL)\n    arg_0.execute(DELETE_FREQUENCIES_ENTRIES_NOT_PRESENT_IN_TRIPS)\n    arg_0.execute(DELETE_AGENCIES_NOT_REFERENCED_IN_ROUTES_SQL)\n    if arg_4:\n        update_secondary_data_copies(arg_0)", "path": "gtfspy/filter.py", "identifier": "remove_all_trips_fully_outside_buffer", "docstring": "Not used in the regular filter process for the time being.\n\n    Parameters\n    ----------\n    db_conn: sqlite3.Connection\n        connection to the GTFS object\n    center_lat: float\n    center_lon: float\n    buffer_km: float", "docstring_tokens": ["Not", "used", "in", "the", "regular", "filter", "process", "for", "the", "time", "being", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 256014}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L2671-L2681", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Returns an arrow Table object containing the arrays corresponding to the evaluated data", "language": "python", "parameters": "(self, column_names=None, selection=None, strings=True, virtual=False)", "return_statement": "return arrow_table_from_vaex_df(self, column_names, selection, strings, virtual)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "False", ")", ":", "from", "vaex_arrow", ".", "convert", "import", "arrow_table_from_vaex_df", "return", "arrow_table_from_vaex_df", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True, arg_4=False):\n        \"\"\"Returns an arrow Table object containing the arrays corresponding to the evaluated data\n\n        :param column_names: list of column names, to export, when None DataFrame.get_column_names(strings=strings, virtual=virtual) is used\n        :param selection: {selection}\n        :param strings: argument passed to DataFrame.get_column_names when column_names is None\n        :param virtual: argument passed to DataFrame.get_column_names when column_names is None\n        :return: pyarrow.Table object\n        \"\"\"\n        from vaex_arrow.convert import arrow_table_from_vaex_df\n        return arrow_table_from_vaex_df(arg_0, arg_1, arg_2, arg_3, arg_4)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.to_arrow_table", "docstring": "Returns an arrow Table object containing the arrays corresponding to the evaluated data\n\n        :param column_names: list of column names, to export, when None DataFrame.get_column_names(strings=strings, virtual=virtual) is used\n        :param selection: {selection}\n        :param strings: argument passed to DataFrame.get_column_names when column_names is None\n        :param virtual: argument passed to DataFrame.get_column_names when column_names is None\n        :return: pyarrow.Table object", "docstring_tokens": ["Returns", "an", "arrow", "Table", "object", "containing", "the", "arrays", "corresponding", "to", "the", "evaluated", "data"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 256015}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L77-L117", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Plots the corrected noise diode spectrum for a given noise diode measurement\n    after application of the inverse Mueller matrix for the electronics chain.", "language": "python", "parameters": "(dio_cross,chan_per_coarse=8,feedtype='l',**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "8", ",", "arg_2", "=", "'l'", ",", "**", "arg_3", ")", ":", "arg_4", "=", "Waterfall", "(", "arg_0", ",", "max_load", "=", "150", ")", "arg_5", "=", "arg_4", ".", "populate_freqs", "(", ")", "arg_6", "=", "arg_4", ".", "header", "[", "'tsamp'", "]", "arg_7", "=", "arg_4", ".", "data", "arg_4", "=", "None", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "get_stokes", "(", "arg_7", ",", "arg_2", ")", "arg_7", "=", "None", "arg_12", "=", "phase_offsets", "(", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_6", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "arg_13", "=", "gain_offsets", "(", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_6", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "apply_Mueller", "(", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_13", ",", "arg_12", ",", "arg_1", ",", "arg_2", ")", "arg_14", ",", "arg_15", "=", "foldcal", "(", "arg_8", ",", "arg_6", ",", "**", "arg_3", ")", "arg_16", ",", "arg_17", "=", "foldcal", "(", "arg_9", ",", "arg_6", ",", "**", "arg_3", ")", "arg_18", ",", "arg_19", "=", "foldcal", "(", "arg_10", ",", "arg_6", ",", "**", "arg_3", ")", "arg_20", ",", "arg_21", "=", "foldcal", "(", "arg_11", ",", "arg_6", ",", "**", "arg_3", ")", "arg_8", "=", "None", "arg_9", "=", "None", "arg_10", "=", "None", "arg_11", "=", "None", "plt", ".", "plot", "(", "arg_5", ",", "arg_15", "-", "arg_14", ",", "'k-'", ",", "label", "=", "'I'", ")", "plt", ".", "plot", "(", "arg_5", ",", "arg_17", "-", "arg_16", ",", "'r-'", ",", "label", "=", "'Q'", ")", "plt", ".", "plot", "(", "arg_5", ",", "arg_19", "-", "arg_18", ",", "'g-'", ",", "label", "=", "'U'", ")", "plt", ".", "plot", "(", "arg_5", ",", "arg_21", "-", "arg_20", ",", "'m-'", ",", "label", "=", "'V'", ")", "plt", ".", "legend", "(", ")", "plt", ".", "xlabel", "(", "'Frequency (MHz)'", ")", "plt", ".", "title", "(", "'Calibrated Full Stokes Noise Diode Spectrum'", ")", "plt", ".", "ylabel", "(", "'Power (Counts)'", ")"], "function": "def Func(arg_0,arg_1=8,arg_2='l',**arg_3):\n    '''\n    Plots the corrected noise diode spectrum for a given noise diode measurement\n    after application of the inverse Mueller matrix for the electronics chain.\n    '''\n    #Get full stokes data for the ND observation\n    arg_4 = Waterfall(arg_0,max_load=150)\n    arg_5 = arg_4.populate_freqs()\n    arg_6 = arg_4.header['tsamp']\n    arg_7 = arg_4.data\n    arg_4 = None\n    arg_8,arg_9,arg_10,arg_11 = get_stokes(arg_7,arg_2)\n    arg_7 = None\n\n    #Calculate Mueller Matrix variables for each coarse channel\n    arg_12 = phase_offsets(arg_8,arg_9,arg_10,arg_11,arg_6,arg_1,arg_2,**arg_3)\n    arg_13 = gain_offsets(arg_8,arg_9,arg_10,arg_11,arg_6,arg_1,arg_2,**arg_3)\n\n    #Apply the Mueller matrix to original noise diode data and refold\n    arg_8,arg_9,arg_10,arg_11 = apply_Mueller(arg_8,arg_9,arg_10,arg_11,arg_13,arg_12,arg_1,arg_2)\n    arg_14,arg_15 = foldcal(arg_8,arg_6,**arg_3)\n    arg_16,arg_17 = foldcal(arg_9,arg_6,**arg_3)\n    arg_18,arg_19 = foldcal(arg_10,arg_6,**arg_3)\n    arg_20,arg_21 = foldcal(arg_11,arg_6,**arg_3)\n\n    #Delete data arrays for space\n    arg_8 = None\n    arg_9 = None\n    arg_10 = None\n    arg_11 = None\n\n    #Plot new ON-OFF spectra\n    plt.plot(arg_5,arg_15-arg_14,'k-',label='I')\n    plt.plot(arg_5,arg_17-arg_16,'r-',label='Q')\n    plt.plot(arg_5,arg_19-arg_18,'g-',label='U')\n    plt.plot(arg_5,arg_21-arg_20,'m-',label='V')\n\n    plt.legend()\n    plt.xlabel('Frequency (MHz)')\n    plt.title('Calibrated Full Stokes Noise Diode Spectrum')\n    plt.ylabel('Power (Counts)')", "path": "blimpy/calib_utils/calib_plots.py", "identifier": "plot_calibrated_diode", "docstring": "Plots the corrected noise diode spectrum for a given noise diode measurement\n    after application of the inverse Mueller matrix for the electronics chain.", "docstring_tokens": ["Plots", "the", "corrected", "noise", "diode", "spectrum", "for", "a", "given", "noise", "diode", "measurement", "after", "application", "of", "the", "inverse", "Mueller", "matrix", "for", "the", "electronics", "chain", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 256016}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ooldtp/__init__.py#L623-L645", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get window uptime", "language": "python", "parameters": "(self, window_name)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_remote_Func", "(", "arg_1", ")", "if", "arg_2", ":", "arg_2", "=", "arg_2", ".", "split", "(", "'-'", ")", "arg_3", "=", "arg_2", "[", "0", "]", ".", "split", "(", "' '", ")", "arg_4", "=", "arg_2", "[", "1", "]", ".", "split", "(", "' '", ")", "arg_5", "=", "datetime", ".", "datetime", "(", "int", "(", "arg_3", "[", "0", "]", ")", ",", "int", "(", "arg_3", "[", "1", "]", ")", ",", "int", "(", "arg_3", "[", "2", "]", ")", ",", "int", "(", "arg_3", "[", "3", "]", ")", ",", "int", "(", "arg_3", "[", "4", "]", ")", ",", "int", "(", "arg_3", "[", "5", "]", ")", ")", "arg_6", "=", "datetime", ".", "datetime", "(", "int", "(", "arg_4", "[", "0", "]", ")", ",", "int", "(", "arg_4", "[", "1", "]", ")", ",", "int", "(", "arg_4", "[", "2", "]", ")", ",", "int", "(", "arg_4", "[", "3", "]", ")", ",", "int", "(", "arg_4", "[", "4", "]", ")", ",", "int", "(", "arg_4", "[", "5", "]", ")", ")", "return", "arg_5", ",", "arg_6", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get window uptime\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n    \n        @return: \"starttime, endtime\" as datetime python object\n        \"\"\"\n        arg_2 = arg_0._remote_Func(arg_1)\n        if arg_2:\n            arg_2 = arg_2.split('-')\n            arg_3 = arg_2[0].split(' ')\n            arg_4 = arg_2[1].split(' ')\n            arg_5 = datetime.datetime(int(arg_3[0]), int(arg_3[1]),\n                                            int(arg_3[2]), int(arg_3[3]),\n                                            int(arg_3[4]), int(arg_3[5]))\n            arg_6 = datetime.datetime(int(arg_4[0]), int(arg_4[1]),\n                                          int(arg_4[2]), int(arg_4[3]),\n                                          int(arg_4[4]), int(arg_4[5]))\n            return arg_5, arg_6\n        return None", "path": "atomac/ooldtp/__init__.py", "identifier": "ooldtp.windowuptime", "docstring": "Get window uptime\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n    \n        @return: \"starttime, endtime\" as datetime python object", "docstring_tokens": ["Get", "window", "uptime"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 256017}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L714-L735", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "return 00 outfile as a pandas DataFrame", "language": "python", "parameters": "(ofile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ")", "as", "infile", ":", "arg_1", "=", "np", ".", "array", "(", "[", "\" \"", "]", "+", "infile", ".", "read", "(", ")", ".", "split", "(", "\"Summary of MCMC results\\n\\n\\n\"", ")", "[", "1", ":", "]", "[", "0", "]", ".", "strip", "(", ")", ".", "split", "(", ")", ")", "arg_2", "=", "12", "arg_3", "=", "(", "arg_1", ".", "shape", "[", "0", "]", "+", "1", ")", "/", "arg_2", "arg_1", "=", "arg_1", ".", "reshape", "(", "arg_2", ",", "arg_3", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "data", "=", "arg_1", "[", "1", ":", ",", "1", ":", "]", ",", "columns", "=", "arg_1", "[", "0", ",", "1", ":", "]", ",", "index", "=", "arg_1", "[", "1", ":", ",", "0", "]", ",", ")", ".", "T", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"\n    return 00 outfile as a pandas DataFrame\n    \"\"\"\n    with open(arg_0) as infile:\n        ## read in the results summary from the end of the outfile\n        arg_1 = np.array(\n            [\" \"] + infile.read().split(\"Summary of MCMC results\\n\\n\\n\")[1:][0]\\\n            .strip().split())\n\n        ## reshape array \n        arg_2 = 12\n        arg_3 = (arg_1.shape[0] + 1) / arg_2\n        arg_1 = arg_1.reshape(arg_2, arg_3)\n        \n        ## make into labeled data frame\n        arg_4 = pd.DataFrame(\n            data=arg_1[1:, 1:], \n            columns=arg_1[0, 1:], \n            index=arg_1[1:, 0],\n            ).T\n        return arg_4", "path": "ipyrad/analysis/bpp.py", "identifier": "_parse_00", "docstring": "return 00 outfile as a pandas DataFrame", "docstring_tokens": ["return", "00", "outfile", "as", "a", "pandas", "DataFrame"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 256018}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/action.py#L105-L109", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Finish performing the action.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "status", "=", "'completed'", "arg_0", ".", "time_completed", "=", "timestamp", "(", ")", "arg_0", ".", "thing", ".", "action_notify", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"Finish performing the action.\"\"\"\n        arg_0.status = 'completed'\n        arg_0.time_completed = timestamp()\n        arg_0.thing.action_notify(arg_0)", "path": "webthing/action.py", "identifier": "Action.finish", "docstring": "Finish performing the action.", "docstring_tokens": ["Finish", "performing", "the", "action", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 256019}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-labservices/azure/mgmt/labservices/operations/global_users_operations.py#L533-L574", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Resets the user password on an environment This operation can take a\n        while to complete.", "language": "python", "parameters": "(\n            self, user_name, reset_password_payload, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "True", ",", "**", "arg_6", ")", ":", "arg_7", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "True", ",", "**", "arg_6", ")", "def", "get_long_running_output", "(", "arg_8", ")", ":", "if", "arg_4", ":", "arg_9", "=", "ClientRawResponse", "(", "None", ",", "arg_8", ")", "return", "arg_9", "arg_10", "=", "arg_6", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_5", "is", "True", ":", "arg_11", "=", "ARMPolling", "(", "arg_10", ",", "**", "arg_6", ")", "elif", "arg_5", "is", "False", ":", "arg_11", "=", "NoPolling", "(", ")", "else", ":", "arg_11", "=", "arg_5", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_7", ",", "get_long_running_output", ",", "arg_11", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3=None, arg_4=False, arg_5=True, **arg_6):\n        \"\"\"Resets the user password on an environment This operation can take a\n        while to complete.\n\n        :param user_name: The name of the user.\n        :type user_name: str\n        :param Func_payload: Represents the payload for resetting\n         passwords.\n        :type Func_payload:\n         ~azure.mgmt.labservices.models.ResetPasswordPayload\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`\n        \"\"\"\n        arg_7 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=True,\n            **arg_6\n        )\n\n        def get_long_running_output(arg_8):\n            if arg_4:\n                arg_9 = ClientRawResponse(None, arg_8)\n                return arg_9\n\n        arg_10 = arg_6.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_5 is True: arg_11 = ARMPolling(arg_10, **arg_6)\n        elif arg_5 is False: arg_11 = NoPolling()\n        else: arg_11 = arg_5\n        return LROPoller(arg_0._client, arg_7, get_long_running_output, arg_11)", "path": "azure-mgmt-labservices/azure/mgmt/labservices/operations/global_users_operations.py", "identifier": "GlobalUsersOperations.reset_password", "docstring": "Resets the user password on an environment This operation can take a\n        while to complete.\n\n        :param user_name: The name of the user.\n        :type user_name: str\n        :param reset_password_payload: Represents the payload for resetting\n         passwords.\n        :type reset_password_payload:\n         ~azure.mgmt.labservices.models.ResetPasswordPayload\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`", "docstring_tokens": ["Resets", "the", "user", "password", "on", "an", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256020}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/materialphysicalproperties/gases.py#L84-L120", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Create a dictionary of datasets and a material object for air.", "language": "python", "parameters": "()", "return_statement": "return material, ds_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "\"Air\"", "arg_1", "=", "arg_0", ".", "lower", "(", ")", "arg_2", "=", "28.9645", "arg_3", "=", "_create_ds_dict", "(", "[", "\"dataset-air-lienhard2015\"", ",", "\"dataset-air-lienhard2018\"", "]", ")", "arg_4", "=", "\"dataset-air-lienhard2018\"", "arg_5", "=", "{", "\"rho\"", ":", "IgRhoT", "(", "arg_2", ",", "101325.0", ")", ",", "\"beta\"", ":", "IgBetaT", "(", ")", "}", "arg_6", "=", "\"polynomialmodelt\"", "for", "arg_7", "in", "[", "\"Cp\"", ",", "\"mu\"", ",", "\"k\"", "]", ":", "arg_0", "=", "f\"data/{namel}-{property.lower()}-{model_type}-{active_ds}.json\"", "arg_5", "[", "arg_7", "]", "=", "PolynomialModelT", ".", "read", "(", "_path", "(", "arg_0", ")", ")", "arg_8", "=", "Material", "(", "arg_0", ",", "StateOfMatter", ".", "gas", ",", "arg_5", ")", "return", "arg_8", ",", "arg_3"], "function": "def Func():\n    \"\"\"\n    Create a dictionary of datasets and a material object for air.\n\n    :return: (Material, {str, DataSet})\n    \"\"\"\n    arg_0 = \"Air\"\n    arg_1 = arg_0.lower()\n    arg_2 = 28.9645  # g/mol\n\n    arg_3 = _create_ds_dict([\n        \"dataset-air-lienhard2015\",\n        \"dataset-air-lienhard2018\"])\n    arg_4 = \"dataset-air-lienhard2018\"\n\n    # create polynomial models to describe material properties\n    #   comment it out after model creation is complete, so that it does not\n    #   run every time during use.\n    # _create_polynomial_model(name, \"Cp\", 13, ds_dict[active_ds], ds_dict)\n    # _create_polynomial_model(name, \"k\", 8, ds_dict[active_ds], ds_dict)\n    # _create_polynomial_model(name, \"mu\", 8, ds_dict[active_ds], ds_dict)\n    # _create_polynomial_model(name, \"rho\", 14, ds_dict[active_ds], ds_dict)\n\n    # IgRhoT(mm, 101325.0).plot(ds_dict, _path(f\"data/{namel}-rho-igrhot.pdf\"))\n\n    arg_5 = {\n        \"rho\": IgRhoT(arg_2, 101325.0),\n        \"beta\": IgBetaT()}\n\n    arg_6 = \"polynomialmodelt\"\n    for arg_7 in [\"Cp\", \"mu\", \"k\"]:\n        arg_0 = f\"data/{namel}-{property.lower()}-{model_type}-{active_ds}.json\"\n        arg_5[arg_7] = PolynomialModelT.read(_path(arg_0))\n\n    arg_8 = Material(arg_0, StateOfMatter.gas, arg_5)\n\n    return arg_8, arg_3", "path": "auxi/tools/materialphysicalproperties/gases.py", "identifier": "_create_air", "docstring": "Create a dictionary of datasets and a material object for air.\n\n    :return: (Material, {str, DataSet})", "docstring_tokens": ["Create", "a", "dictionary", "of", "datasets", "and", "a", "material", "object", "for", "air", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 256021}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/examples/guestbook.py#L108-L116", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Profiler handler.", "language": "python", "parameters": "(uri)", "return_statement": "return flask.redirect('/')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "'main'", ":", "runner", ".", "run", "(", "show_guestbook", ",", "'cmhp'", ")", "elif", "arg_0", "==", "'add'", ":", "runner", ".", "run", "(", "add_entry", ",", "'cmhp'", ")", "return", "flask", ".", "redirect", "(", "'/'", ")"], "function": "def Func(arg_0):\n    \"\"\"Profiler handler.\"\"\"\n    # HTTP method should be GET.\n    if arg_0 == 'main':\n        runner.run(show_guestbook, 'cmhp')\n    # In this case HTTP method should be POST singe add_entry uses POST\n    elif arg_0 == 'add':\n        runner.run(add_entry, 'cmhp')\n    return flask.redirect('/')", "path": "examples/guestbook.py", "identifier": "profiler_handler", "docstring": "Profiler handler.", "docstring_tokens": ["Profiler", "handler", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 256022}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L180-L233", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Print informations about PyFunceble and the date of generation of a file\n        into a given path, if doesn't exist.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "(", "not", "PyFunceble", ".", "CONFIGURATION", "[", "\"no_files\"", "]", "and", "arg_0", ".", "output", "and", "not", "PyFunceble", ".", "path", ".", "isfile", "(", "arg_0", ".", "output", ")", ")", ":", "arg_1", "=", "\"# File generated by %s\\n\"", "%", "PyFunceble", ".", "LINKS", "[", "\"repo\"", "]", "arg_2", "=", "(", "\"# Date of generation: %s \\n\\n\"", "%", "PyFunceble", ".", "CURRENT_TIME", ")", "arg_3", "=", "[", "\"Generic_File\"", ",", "PyFunceble", ".", "STATUS", "[", "\"official\"", "]", "[", "\"up\"", "]", ",", "PyFunceble", ".", "STATUS", "[", "\"official\"", "]", "[", "\"down\"", "]", ",", "PyFunceble", ".", "STATUS", "[", "\"official\"", "]", "[", "\"invalid\"", "]", ",", "PyFunceble", ".", "STATUS", "[", "\"official\"", "]", "[", "\"valid\"", "]", ",", "\"Less\"", ",", "]", "if", "arg_0", ".", "template", "in", "arg_3", ":", "arg_4", "=", "(", "arg_0", ".", "_header_constructor", "(", "arg_0", ".", "currently_used_header", ",", "None", ")", "[", "0", "]", "+", "\"\\n\"", ")", "try", ":", "File", "(", "arg_0", ".", "output", ")", ".", "write", "(", "arg_1", "+", "arg_2", "+", "arg_4", ")", "except", "UnboundLocalError", ":", "File", "(", "arg_0", ".", "output", ")", ".", "write", "(", "arg_1", "+", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Print informations about PyFunceble and the date of generation of a file\n        into a given path, if doesn't exist.\n        \"\"\"\n\n        if (\n            not PyFunceble.CONFIGURATION[\"no_files\"]\n            and arg_0.output\n            and not PyFunceble.path.isfile(arg_0.output)\n        ):\n            # * We are allowed to generate files.\n            # and\n            # * And output is given.\n            # and\n            # * The given output does not exist.\n\n            # We initiate the information about what generated the file.\n            arg_1 = \"# File generated by %s\\n\" % PyFunceble.LINKS[\"repo\"]\n\n            # We initiate the information about the generation date of this file.\n            arg_2 = (\n                \"# Date of generation: %s \\n\\n\" % PyFunceble.CURRENT_TIME\n            )\n\n            # We initiate a variable which will save the list of\n            # templates which have to meet in order to write the before\n            # header informations.\n            arg_3 = [\n                \"Generic_File\",\n                PyFunceble.STATUS[\"official\"][\"up\"],\n                PyFunceble.STATUS[\"official\"][\"down\"],\n                PyFunceble.STATUS[\"official\"][\"invalid\"],\n                PyFunceble.STATUS[\"official\"][\"valid\"],\n                \"Less\",\n            ]\n\n            if arg_0.template in arg_3:\n                # The current header is in our list of authorized templated.\n\n                # We get the header.\n                arg_4 = (\n                    arg_0._header_constructor(arg_0.currently_used_header, None)[0] + \"\\n\"\n                )\n\n            try:\n                # We try to print the link, the date of generation and the header in the\n                # given file.\n                File(arg_0.output).write(arg_1 + arg_2 + arg_4)\n            except UnboundLocalError:\n                # We don't have any header.\n\n                # We print the link and the date in the given file.\n                File(arg_0.output).write(arg_1 + arg_2)", "path": "PyFunceble/prints.py", "identifier": "Prints._before_header", "docstring": "Print informations about PyFunceble and the date of generation of a file\n        into a given path, if doesn't exist.", "docstring_tokens": ["Print", "informations", "about", "PyFunceble", "and", "the", "date", "of", "generation", "of", "a", "file", "into", "a", "given", "path", "if", "doesn", "t", "exist", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 256023}
{"url": "https://github.com/snowplow/snowplow-python-analytics-sdk/blob/0ddca91e3f6d8bed88627fa557790aa4868bdace/snowplow_analytics_sdk/run_manifests.py#L212-L227", "sha": "0ddca91e3f6d8bed88627fa557790aa4868bdace", "docstring_summary": "Add run_id into DynamoDB manifest table", "language": "python", "parameters": "(dynamodb_client, table_name, run_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "put_item", "(", "TableName", "=", "arg_1", ",", "Item", "=", "{", "DYNAMODB_RUNID_ATTRIBUTE", ":", "{", "'S'", ":", "arg_2", "}", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Add run_id into DynamoDB manifest table\n\n    Arguments:\n    dynamodb_client - boto3 DynamoDB client (not service)\n    table_name - string representing existing table name\n    run_id - string representing run_id to store\n    \"\"\"\n    arg_0.put_item(\n        TableName=arg_1,\n        Item={\n            DYNAMODB_RUNID_ATTRIBUTE: {\n                'S': arg_2\n            }\n        }\n    )", "path": "snowplow_analytics_sdk/run_manifests.py", "identifier": "add_to_manifest", "docstring": "Add run_id into DynamoDB manifest table\n\n    Arguments:\n    dynamodb_client - boto3 DynamoDB client (not service)\n    table_name - string representing existing table name\n    run_id - string representing run_id to store", "docstring_tokens": ["Add", "run_id", "into", "DynamoDB", "manifest", "table"], "nwo": "snowplow/snowplow-python-analytics-sdk", "score": 0.2855681421870085, "idx": 256024}
{"url": "https://github.com/mikeboers/PyAV/blob/9414187088b9b8dbaa180cfe1db6ceba243184ea/setup.py#L190-L215", "sha": "9414187088b9b8dbaa180cfe1db6ceba243184ea", "docstring_summary": "Create a C compiler.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return cc", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "pop", "(", "'silent'", ",", "True", ")", "arg_3", "=", "_Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", "if", "is_msvc", "(", "arg_3", ")", ":", "from", "distutils", ".", "msvc9compiler", "import", "get_build_version", "if", "get_build_version", "(", ")", "==", "10", ":", "arg_3", ".", "initialize", "(", ")", "for", "arg_4", "in", "[", "arg_3", ".", "ldflags_shared", ",", "arg_3", ".", "ldflags_shared_debug", "]", ":", "unique_extend", "(", "arg_4", ",", "[", "'/MANIFEST'", "]", ")", "elif", "get_build_version", "(", ")", "==", "14", ":", "arg_2", "=", "False", "if", "arg_2", ":", "arg_3", ".", "spawn", "=", "_CCompiler_spawn_silent", "return", "arg_3"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"Create a C compiler.\n\n    :param bool silent: Eat all stdio? Defaults to ``True``.\n\n    All other arguments passed to ``distutils.ccompiler.Func``.\n\n    \"\"\"\n    arg_2 = arg_1.pop('silent', True)\n    arg_3 = _Func(*arg_0, **arg_1)\n    # If MSVC10, initialize the compiler here and add /MANIFEST to linker flags.\n    # See Python issue 4431 (https://bugs.python.org/issue4431)\n    if is_msvc(arg_3):\n        from distutils.msvc9compiler import get_build_version\n        if get_build_version() == 10:\n            arg_3.initialize()\n            for arg_4 in [arg_3.ldflags_shared, arg_3.ldflags_shared_debug]:\n                unique_extend(arg_4, ['/MANIFEST'])\n        # If MSVC14, do not silence. As msvc14 requires some custom\n        # steps before the process is spawned, we can't monkey-patch this.\n        elif get_build_version() == 14:\n            arg_2 = False\n    # monkey-patch compiler to suppress stdout and stderr.\n    if arg_2:\n        arg_3.spawn = _CCompiler_spawn_silent\n    return arg_3", "path": "setup.py", "identifier": "new_compiler", "docstring": "Create a C compiler.\n\n    :param bool silent: Eat all stdio? Defaults to ``True``.\n\n    All other arguments passed to ``distutils.ccompiler.new_compiler``.", "docstring_tokens": ["Create", "a", "C", "compiler", "."], "nwo": "mikeboers/PyAV", "score": 0.7842860952082583, "idx": 256025}
{"url": "https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/irc.py#L246-L270", "sha": "f9d2bd6369aafe6cb0916c9406270ca8ecea2080", "docstring_summary": "\\\n        Main loop of the IRCConnection - reads from the socket and dispatches\n        based on regex matching", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "dispatch_patterns", "(", ")", "arg_0", ".", "logger", ".", "debug", "(", "'entering receive loop'", ")", "while", "1", ":", "try", ":", "arg_2", "=", "arg_0", ".", "_sock_file", ".", "readline", "(", ")", "except", "socket", ".", "error", ":", "arg_2", "=", "None", "if", "not", "arg_2", ":", "arg_0", ".", "logger", ".", "info", "(", "'server closed connection'", ")", "arg_0", ".", "close", "(", ")", "return", "True", "arg_2", "=", "arg_2", ".", "rstrip", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_3", ".", "match", "(", "arg_2", ")", "if", "arg_5", ":", "arg_4", "(", "**", "arg_5", ".", "groupdict", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\\\n        Main loop of the IRCConnection - reads from the socket and dispatches\n        based on regex matching\n        \"\"\"\n        arg_1 = arg_0.dispatch_patterns()\n        arg_0.logger.debug('entering receive loop')\n\n        while 1:\n            try:\n                arg_2 = arg_0._sock_file.readline()\n            except socket.error:\n                arg_2 = None\n\n            if not arg_2:\n                arg_0.logger.info('server closed connection')\n                arg_0.close()\n                return True\n\n            arg_2 = arg_2.rstrip()\n\n            for arg_3, arg_4 in arg_1:\n                arg_5 = arg_3.match(arg_2)\n                if arg_5:\n                    arg_4(**arg_5.groupdict())", "path": "irc.py", "identifier": "IRCConnection.enter_event_loop", "docstring": "\\\n        Main loop of the IRCConnection - reads from the socket and dispatches\n        based on regex matching", "docstring_tokens": ["\\", "Main", "loop", "of", "the", "IRCConnection", "-", "reads", "from", "the", "socket", "and", "dispatches", "based", "on", "regex", "matching"], "nwo": "coleifer/irc", "score": 0.28749967694495965, "idx": 256026}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/hmc.py#L1052-L1145", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper to `kernel` which computes the log acceptance-correction.", "language": "python", "parameters": "(current_momentums,\n                                       proposed_momentums,\n                                       independent_chain_ndims,\n                                       name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_3", ",", "'compute_log_acceptance_correction'", ",", "[", "arg_2", ",", "arg_0", ",", "arg_1", "]", ")", ":", "arg_4", ",", "arg_5", "=", "[", "]", ",", "[", "]", "for", "arg_6", ",", "arg_7", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ":", "arg_8", "=", "tf", ".", "range", "(", "arg_2", ",", "tf", ".", "rank", "(", "arg_6", ")", ")", "arg_4", ".", "append", "(", "_log_sum_sq", "(", "arg_6", ",", "arg_8", ")", ")", "arg_5", ".", "append", "(", "_log_sum_sq", "(", "arg_7", ",", "arg_8", ")", ")", "arg_9", "=", "0.5", "*", "tf", ".", "exp", "(", "tf", ".", "reduce_logsumexp", "(", "input_tensor", "=", "tf", ".", "stack", "(", "arg_4", ",", "arg_8", "=", "-", "1", ")", ",", "arg_8", "=", "-", "1", ")", ")", "arg_10", "=", "0.5", "*", "tf", ".", "exp", "(", "tf", ".", "reduce_logsumexp", "(", "input_tensor", "=", "tf", ".", "stack", "(", "arg_5", ",", "arg_8", "=", "-", "1", ")", ",", "arg_8", "=", "-", "1", ")", ")", "return", "mcmc_util", ".", "safe_sum", "(", "[", "arg_9", ",", "-", "arg_10", "]", ")"], "function": "def Func(arg_0,\n                                       arg_1,\n                                       arg_2,\n                                       arg_3=None):\n  \"\"\"Helper to `kernel` which computes the log acceptance-correction.\n\n  A sufficient but not necessary condition for the existence of a stationary\n  distribution, `p(x)`, is \"detailed balance\", i.e.:\n\n  ```none\n  p(x'|x) p(x) = p(x|x') p(x')\n  ```\n\n  In the Metropolis-Hastings algorithm, a state is proposed according to\n  `g(x'|x)` and accepted according to `a(x'|x)`, hence\n  `p(x'|x) = g(x'|x) a(x'|x)`.\n\n  Inserting this into the detailed balance equation implies:\n\n  ```none\n      g(x'|x) a(x'|x) p(x) = g(x|x') a(x|x') p(x')\n  ==> a(x'|x) / a(x|x') = p(x') / p(x) [g(x|x') / g(x'|x)]    (*)\n  ```\n\n  One definition of `a(x'|x)` which satisfies (*) is:\n\n  ```none\n  a(x'|x) = min(1, p(x') / p(x) [g(x|x') / g(x'|x)])\n  ```\n\n  (To see that this satisfies (*), notice that under this definition only at\n  most one `a(x'|x)` and `a(x|x') can be other than one.)\n\n  We call the bracketed term the \"acceptance correction\".\n\n  In the case of UncalibratedHMC, the log acceptance-correction is not the log\n  proposal-ratio. UncalibratedHMC augments the state-space with momentum, z.\n  Assuming a standard Gaussian distribution for momentums, the chain eventually\n  converges to:\n\n  ```none\n  p([x, z]) propto= target_prob(x) exp(-0.5 z**2)\n  ```\n\n  Relating this back to Metropolis-Hastings parlance, for HMC we have:\n\n  ```none\n  p([x, z]) propto= target_prob(x) exp(-0.5 z**2)\n  g([x, z] | [x', z']) = g([x', z'] | [x, z])\n  ```\n\n  In other words, the MH bracketed term is `1`. However, because we desire to\n  use a general MH framework, we can place the momentum probability ratio inside\n  the metropolis-correction factor thus getting an acceptance probability:\n\n  ```none\n                       target_prob(x')\n  accept_prob(x'|x) = -----------------  [exp(-0.5 z**2) / exp(-0.5 z'**2)]\n                       target_prob(x)\n  ```\n\n  (Note: we actually need to handle the kinetic energy change at each leapfrog\n  step, but this is the idea.)\n\n  Args:\n    current_momentums: `Tensor` representing the value(s) of the current\n      momentum(s) of the state (parts).\n    proposed_momentums: `Tensor` representing the value(s) of the proposed\n      momentum(s) of the state (parts).\n    independent_chain_ndims: Scalar `int` `Tensor` representing the number of\n      leftmost `Tensor` dimensions which index independent chains.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'compute_log_acceptance_correction').\n\n  Returns:\n    log_acceptance_correction: `Tensor` representing the `log`\n      acceptance-correction.  (See docstring for mathematical definition.)\n  \"\"\"\n  with tf.compat.v1.name_scope(\n      arg_3, 'compute_log_acceptance_correction',\n      [arg_2, arg_0, arg_1]):\n    arg_4, arg_5 = [], []\n    for arg_6, arg_7 in zip(\n        arg_0, arg_1):\n      arg_8 = tf.range(arg_2, tf.rank(arg_6))\n      arg_4.append(_log_sum_sq(arg_6, arg_8))\n      arg_5.append(_log_sum_sq(arg_7, arg_8))\n    arg_9 = 0.5 * tf.exp(\n        tf.reduce_logsumexp(\n            input_tensor=tf.stack(arg_4, arg_8=-1), arg_8=-1))\n    arg_10 = 0.5 * tf.exp(\n        tf.reduce_logsumexp(\n            input_tensor=tf.stack(arg_5, arg_8=-1), arg_8=-1))\n    return mcmc_util.safe_sum([arg_9, -arg_10])", "path": "tensorflow_probability/python/mcmc/hmc.py", "identifier": "_compute_log_acceptance_correction", "docstring": "Helper to `kernel` which computes the log acceptance-correction.\n\n  A sufficient but not necessary condition for the existence of a stationary\n  distribution, `p(x)`, is \"detailed balance\", i.e.:\n\n  ```none\n  p(x'|x) p(x) = p(x|x') p(x')\n  ```\n\n  In the Metropolis-Hastings algorithm, a state is proposed according to\n  `g(x'|x)` and accepted according to `a(x'|x)`, hence\n  `p(x'|x) = g(x'|x) a(x'|x)`.\n\n  Inserting this into the detailed balance equation implies:\n\n  ```none\n      g(x'|x) a(x'|x) p(x) = g(x|x') a(x|x') p(x')\n  ==> a(x'|x) / a(x|x') = p(x') / p(x) [g(x|x') / g(x'|x)]    (*)\n  ```\n\n  One definition of `a(x'|x)` which satisfies (*) is:\n\n  ```none\n  a(x'|x) = min(1, p(x') / p(x) [g(x|x') / g(x'|x)])\n  ```\n\n  (To see that this satisfies (*), notice that under this definition only at\n  most one `a(x'|x)` and `a(x|x') can be other than one.)\n\n  We call the bracketed term the \"acceptance correction\".\n\n  In the case of UncalibratedHMC, the log acceptance-correction is not the log\n  proposal-ratio. UncalibratedHMC augments the state-space with momentum, z.\n  Assuming a standard Gaussian distribution for momentums, the chain eventually\n  converges to:\n\n  ```none\n  p([x, z]) propto= target_prob(x) exp(-0.5 z**2)\n  ```\n\n  Relating this back to Metropolis-Hastings parlance, for HMC we have:\n\n  ```none\n  p([x, z]) propto= target_prob(x) exp(-0.5 z**2)\n  g([x, z] | [x', z']) = g([x', z'] | [x, z])\n  ```\n\n  In other words, the MH bracketed term is `1`. However, because we desire to\n  use a general MH framework, we can place the momentum probability ratio inside\n  the metropolis-correction factor thus getting an acceptance probability:\n\n  ```none\n                       target_prob(x')\n  accept_prob(x'|x) = -----------------  [exp(-0.5 z**2) / exp(-0.5 z'**2)]\n                       target_prob(x)\n  ```\n\n  (Note: we actually need to handle the kinetic energy change at each leapfrog\n  step, but this is the idea.)\n\n  Args:\n    current_momentums: `Tensor` representing the value(s) of the current\n      momentum(s) of the state (parts).\n    proposed_momentums: `Tensor` representing the value(s) of the proposed\n      momentum(s) of the state (parts).\n    independent_chain_ndims: Scalar `int` `Tensor` representing the number of\n      leftmost `Tensor` dimensions which index independent chains.\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'compute_log_acceptance_correction').\n\n  Returns:\n    log_acceptance_correction: `Tensor` representing the `log`\n      acceptance-correction.  (See docstring for mathematical definition.)", "docstring_tokens": ["Helper", "to", "kernel", "which", "computes", "the", "log", "acceptance", "-", "correction", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256027}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/instruction.py#L112-L121", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "return instruction params", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_definition", "and", "not", "arg_0", ".", "_Func", ":", "arg_0", ".", "_Func", "=", "[", "]", "for", "arg_2", ",", "arg_3", ",", "arg_3", "in", "arg_0", ".", "_definition", ":", "arg_0", ".", "_Func", ".", "extend", "(", "arg_2", ".", "Func", ")", "return", "arg_0", ".", "_Func", "else", ":", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"return instruction Func\"\"\"\n        # if Func already defined don't attempt to get them from definition\n        if arg_0._definition and not arg_0._Func:\n            arg_0._Func = []\n            for arg_2, arg_3, arg_3 in arg_0._definition:\n                arg_0._Func.extend(arg_2.Func)  # recursive call\n            return arg_0._Func\n        else:\n            return arg_0._Func", "path": "qiskit/circuit/instruction.py", "identifier": "Instruction.params", "docstring": "return instruction params", "docstring_tokens": ["return", "instruction", "params"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256028}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/util/mapping_util.py#L357-L377", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Using the mapping between the regular-grid and unmasked pixelization grid, compute the mapping between each regular\n    pixel and the masked pixelization grid.", "language": "python", "parameters": "(regular_to_unmasked_sparse, unmasked_sparse_to_sparse)", "return_statement": "return regular_to_sparse", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "shape", "[", "0", "]", "arg_3", "=", "np", ".", "zeros", "(", "arg_2", ")", "for", "arg_4", "in", "range", "(", "arg_2", ")", ":", "arg_3", "[", "arg_4", "]", "=", "arg_1", "[", "arg_0", "[", "arg_4", "]", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Using the mapping between the regular-grid and unmasked pixelization grid, compute the mapping between each regular\n    pixel and the masked pixelization grid.\n\n    Parameters\n    -----------\n    regular_to_unmasked_sparse : ndarray\n        The index mapping between every regular-pixel and masked pixelization pixel.\n    unmasked_sparse_to_sparse : ndarray\n        The index mapping between every masked pixelization pixel and unmasked pixelization pixel.\n    \"\"\"\n    arg_2 = arg_0.shape[0]\n\n    arg_3 = np.zeros(arg_2)\n\n    for arg_4 in range(arg_2):\n    #    print(regular_index, regular_to_unmasked_sparse[regular_index], unmasked_sparse_to_sparse.shape[0])\n        arg_3[arg_4] = arg_1[arg_0[arg_4]]\n\n\n    return arg_3", "path": "autolens/data/array/util/mapping_util.py", "identifier": "regular_to_sparse_from_sparse_mappings", "docstring": "Using the mapping between the regular-grid and unmasked pixelization grid, compute the mapping between each regular\n    pixel and the masked pixelization grid.\n\n    Parameters\n    -----------\n    regular_to_unmasked_sparse : ndarray\n        The index mapping between every regular-pixel and masked pixelization pixel.\n    unmasked_sparse_to_sparse : ndarray\n        The index mapping between every masked pixelization pixel and unmasked pixelization pixel.", "docstring_tokens": ["Using", "the", "mapping", "between", "the", "regular", "-", "grid", "and", "unmasked", "pixelization", "grid", "compute", "the", "mapping", "between", "each", "regular", "pixel", "and", "the", "masked", "pixelization", "grid", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 256029}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L176-L186", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to get instance argument.\n    Raises exception if argument is missing.\n    Returns the instance argument.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "get_argument", "(", "constants", ".", "PARAM_INSTANCE", ")", "return", "arg_1", "except", "tornado", ".", "web", ".", "MissingArgumentError", "as", "e", ":", "raise", "Exception", "(", "e", ".", "log_message", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Helper function to get instance argument.\n    Raises exception if argument is missing.\n    Returns the instance argument.\n    \"\"\"\n    try:\n      arg_1 = arg_0.get_argument(constants.PARAM_INSTANCE)\n      return arg_1\n    except tornado.web.MissingArgumentError as e:\n      raise Exception(e.log_message)", "path": "heron/tools/tracker/src/python/handlers/basehandler.py", "identifier": "BaseHandler.get_argument_instance", "docstring": "Helper function to get instance argument.\n    Raises exception if argument is missing.\n    Returns the instance argument.", "docstring_tokens": ["Helper", "function", "to", "get", "instance", "argument", ".", "Raises", "exception", "if", "argument", "is", "missing", ".", "Returns", "the", "instance", "argument", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256030}
{"url": "https://github.com/multiformats/py-multicodec/blob/23213b8b40b21e17e2e1844224498cbd8e359bfa/multicodec/multicodec.py#L50-L60", "sha": "23213b8b40b21e17e2e1844224498cbd8e359bfa", "docstring_summary": "Removes prefix from a prefixed data", "language": "python", "parameters": "(bytes_)", "return_statement": "return bytes_[len(prefix):]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "extract_prefix", "(", "arg_0", ")", "arg_2", "=", "varint", ".", "encode", "(", "arg_1", ")", "return", "arg_0", "[", "len", "(", "arg_2", ")", ":", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Removes prefix from a prefixed data\n\n    :param bytes bytes_: multicodec prefixed data bytes\n    :return: prefix removed data bytes\n    :rtype: bytes\n    \"\"\"\n    arg_1 = extract_prefix(arg_0)\n    arg_2 = varint.encode(arg_1)\n    return arg_0[len(arg_2):]", "path": "multicodec/multicodec.py", "identifier": "remove_prefix", "docstring": "Removes prefix from a prefixed data\n\n    :param bytes bytes_: multicodec prefixed data bytes\n    :return: prefix removed data bytes\n    :rtype: bytes", "docstring_tokens": ["Removes", "prefix", "from", "a", "prefixed", "data"], "nwo": "multiformats/py-multicodec", "score": 0.3705463963430013, "idx": 256031}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/gui/gui_mainLayout.py#L466-L475", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "This function calls \"gui_batch.py\" with inputs values to write the batch file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "BatchFile", "(", "arg_0", ".", "batch_name_value", ",", "arg_0", ".", "p_values", ",", "arg_0", ".", "x_value", ",", "arg_0", ".", "y_value", ",", "arg_0", ".", "g_value", ",", "arg_0", ".", "s_value", ",", "arg_0", ".", "z_value", ",", "arg_0", ".", "wavelength_values", ",", "arg_0", ".", "verbose_value", ",", "arg_0", ".", "phytoplankton_path", ",", "arg_0", ".", "bottom_path", ",", "arg_0", ".", "nb_cpu", ",", "arg_0", ".", "executive_path", ",", "arg_0", ".", "saa_values", ",", "arg_0", ".", "sza_values", ",", "arg_0", ".", "report_parameter_value", ")", "arg_1", ".", "write_batch_to_file", "(", "str", "(", "arg_0", ".", "batch_name_value", "+", "\"_batch.txt\"", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        This function calls \"gui_batch.py\" with inputs values to write the batch file.\n        \"\"\"\n        arg_1 = BatchFile(arg_0.batch_name_value, arg_0.p_values, arg_0.x_value, arg_0.y_value, arg_0.g_value, arg_0.s_value,\n                       arg_0.z_value, arg_0.wavelength_values, arg_0.verbose_value, arg_0.phytoplankton_path,\n                       arg_0.bottom_path, arg_0.nb_cpu, arg_0.executive_path, arg_0.saa_values,\n                       arg_0.sza_values, arg_0.report_parameter_value)\n        # bt.write_batch_to_file(str(self.batch_name_value + \"_batch.txt\"))\n        arg_1.write_batch_to_file(str(arg_0.batch_name_value + \"_batch.txt\"))", "path": "gui/gui_mainLayout.py", "identifier": "FormEvents.write_to_file", "docstring": "This function calls \"gui_batch.py\" with inputs values to write the batch file.", "docstring_tokens": ["This", "function", "calls", "gui_batch", ".", "py", "with", "inputs", "values", "to", "write", "the", "batch", "file", "."], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 256032}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/utils.py#L14-L31", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Alternate version of Spark's zipWithIndex that eagerly returns count.", "language": "python", "parameters": "(rdd)", "return_statement": "return count, rdd.mapPartitionsWithIndex(func)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "0", "]", "if", "arg_0", ".", "getNumPartitions", "(", ")", ">", "1", ":", "arg_2", "=", "arg_0", ".", "mapPartitions", "(", "lambda", "arg_6", ":", "[", "sum", "(", "1", "for", "_", "in", "arg_6", ")", "]", ")", ".", "collect", "(", ")", "arg_3", "=", "sum", "(", "arg_2", ")", "for", "arg_4", "in", "range", "(", "len", "(", "arg_2", ")", "-", "1", ")", ":", "arg_1", ".", "append", "(", "arg_1", "[", "-", "1", "]", "+", "arg_2", "[", "arg_4", "]", ")", "else", ":", "arg_3", "=", "arg_0", ".", "count", "(", ")", "def", "func", "(", "arg_5", ",", "arg_6", ")", ":", "for", "arg_4", ",", "arg_7", "in", "enumerate", "(", "arg_6", ",", "arg_1", "[", "arg_5", "]", ")", ":", "yield", "arg_7", ",", "arg_4", "return", "arg_3", ",", "arg_0", ".", "mapPartitionsWithIndex", "(", "func", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Alternate version of Spark's zipWithIndex that eagerly returns count.\n    \"\"\"\n    arg_1 = [0]\n    if arg_0.getNumPartitions() > 1:\n        arg_2 = arg_0.mapPartitions(lambda arg_6: [sum(1 for _ in arg_6)]).collect()\n        arg_3 = sum(arg_2)\n        for arg_4 in range(len(arg_2) - 1):\n            arg_1.append(arg_1[-1] + arg_2[arg_4])\n    else:\n        arg_3 = arg_0.count()\n\n    def func(arg_5, arg_6):\n        for arg_4, arg_7 in enumerate(arg_6, arg_1[arg_5]):\n            yield arg_7, arg_4\n\n    return arg_3, arg_0.mapPartitionsWithIndex(func)", "path": "bolt/spark/utils.py", "identifier": "zip_with_index", "docstring": "Alternate version of Spark's zipWithIndex that eagerly returns count.", "docstring_tokens": ["Alternate", "version", "of", "Spark", "s", "zipWithIndex", "that", "eagerly", "returns", "count", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 256033}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/quantumcircuit.py#L538-L545", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return number of qubits plus clbits in circuit.", "language": "python", "parameters": "(self)", "return_statement": "return sum(reg.size for reg in self.qregs+self.cregs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "sum", "(", "arg_1", ".", "size", "for", "arg_1", "in", "arg_0", ".", "qregs", "+", "arg_0", ".", "cregs", ")"], "function": "def Func(arg_0):\n        \"\"\"Return number of qubits plus clbits in circuit.\n\n        Returns:\n            int: Width of circuit.\n\n        \"\"\"\n        return sum(arg_1.size for arg_1 in arg_0.qregs+arg_0.cregs)", "path": "qiskit/circuit/quantumcircuit.py", "identifier": "QuantumCircuit.width", "docstring": "Return number of qubits plus clbits in circuit.\n\n        Returns:\n            int: Width of circuit.", "docstring_tokens": ["Return", "number", "of", "qubits", "plus", "clbits", "in", "circuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256034}
{"url": "https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/network/ip.py#L91-L99", "sha": "67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8", "docstring_summary": "Remove the IP packet layer, yielding the transport layer.", "language": "python", "parameters": "(packet)", "return_statement": "return payload", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "IP", ")", ":", "arg_0", "=", "IP", "(", "arg_0", ")", "arg_1", "=", "arg_0", ".", "payload", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Remove the IP packet layer, yielding the transport layer.\n    \"\"\"\n    if not isinstance(arg_0, IP):\n        arg_0 = IP(arg_0)\n    arg_1 = arg_0.payload\n\n    return arg_1", "path": "pcapfile/protocols/network/ip.py", "identifier": "strip_ip", "docstring": "Remove the IP packet layer, yielding the transport layer.", "docstring_tokens": ["Remove", "the", "IP", "packet", "layer", "yielding", "the", "transport", "layer", "."], "nwo": "kisom/pypcapfile", "score": 0.3430538057229739, "idx": 256035}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1560-L1585", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a Python AST node for `recur` occurring inside a `loop`.", "language": "python", "parameters": "(ctx: GeneratorContext, node: Recur)", "return_statement": "return GeneratedPyAST(node=ast.NameConstant(None), dependencies=recur_deps)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "RECUR", "arg_4", ":", "List", "[", "ast", ".", "AST", "]", "=", "[", "]", "arg_5", ":", "List", "[", "ast", ".", "Name", "]", "=", "[", "]", "arg_6", ":", "List", "[", "ast", ".", "AST", "]", "=", "[", "]", "for", "arg_7", ",", "arg_8", "in", "zip", "(", "arg_0", ".", "recur_point", ".", "binding_names", ",", "arg_2", ".", "exprs", ")", ":", "arg_9", "=", "gen_py_ast", "(", "arg_0", ",", "arg_8", ")", "arg_4", ".", "extend", "(", "arg_9", ".", "dependencies", ")", "arg_5", ".", "append", "(", "ast", ".", "Name", "(", "id", "=", "arg_7", ",", "arg_0", "=", "ast", ".", "Store", "(", ")", ")", ")", "arg_6", ".", "append", "(", "arg_9", ".", "node", ")", "if", "len", "(", "arg_5", ")", "==", "1", ":", "assert", "len", "(", "arg_6", ")", "==", "1", "arg_4", ".", "append", "(", "ast", ".", "Assign", "(", "targets", "=", "arg_5", ",", "value", "=", "arg_6", "[", "0", "]", ")", ")", "else", ":", "arg_4", ".", "append", "(", "ast", ".", "Assign", "(", "targets", "=", "[", "ast", ".", "Tuple", "(", "elts", "=", "arg_5", ",", "arg_0", "=", "ast", ".", "Store", "(", ")", ")", "]", ",", "value", "=", "ast", ".", "Tuple", "(", "elts", "=", "arg_6", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", ",", ")", ")", "arg_4", ".", "append", "(", "ast", ".", "Continue", "(", ")", ")", "return", "GeneratedPyAST", "(", "arg_2", "=", "ast", ".", "NameConstant", "(", "None", ")", ",", "dependencies", "=", "arg_4", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:\n    \"\"\"Return a Python AST node for `recur` occurring inside a `loop`.\"\"\"\n    assert arg_2.op == NodeOp.RECUR\n\n    arg_4: List[ast.AST] = []\n    arg_5: List[ast.Name] = []\n    arg_6: List[ast.AST] = []\n    for arg_7, arg_8 in zip(arg_0.recur_point.binding_names, arg_2.exprs):\n        arg_9 = gen_py_ast(arg_0, arg_8)\n        arg_4.extend(arg_9.dependencies)\n        arg_5.append(ast.Name(id=arg_7, arg_0=ast.Store()))\n        arg_6.append(arg_9.node)\n\n    if len(arg_5) == 1:\n        assert len(arg_6) == 1\n        arg_4.append(ast.Assign(targets=arg_5, value=arg_6[0]))\n    else:\n        arg_4.append(\n            ast.Assign(\n                targets=[ast.Tuple(elts=arg_5, arg_0=ast.Store())],\n                value=ast.Tuple(elts=arg_6, arg_0=ast.Load()),\n            )\n        )\n    arg_4.append(ast.Continue())\n\n    return GeneratedPyAST(arg_2=ast.NameConstant(None), dependencies=arg_4)", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "__loop_recur_to_py_ast", "docstring": "Return a Python AST node for `recur` occurring inside a `loop`.", "docstring_tokens": ["Return", "a", "Python", "AST", "node", "for", "recur", "occurring", "inside", "a", "loop", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 256036}
{"url": "https://github.com/mwhooker/jsonselect/blob/c64aa9ea930de0344797ff87b04c753c8fc096a6/jsonselect/jsonselect.py#L225-L228", "sha": "c64aa9ea930de0344797ff87b04c753c8fc096a6", "docstring_summary": "Find nodes in rhs which have parents in lhs.", "language": "python", "parameters": "(self, lhs, rhs)", "return_statement": "return [node for node in rhs if node.parent in lhs]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "[", "arg_3", "for", "arg_3", "in", "arg_2", "if", "arg_3", ".", "parent", "in", "arg_1", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Find nodes in rhs which have Func in lhs.\"\"\"\n\n        return [arg_3 for arg_3 in arg_2 if arg_3.parent in arg_1]", "path": "jsonselect/jsonselect.py", "identifier": "Parser.parents", "docstring": "Find nodes in rhs which have parents in lhs.", "docstring_tokens": ["Find", "nodes", "in", "rhs", "which", "have", "parents", "in", "lhs", "."], "nwo": "mwhooker/jsonselect", "score": 0.27365494979801214, "idx": 256037}
{"url": "https://github.com/uucidl/uu.xunitgen/blob/3c74fe60dfd15a528622195577f2aab3027693f0/xunitgen/main.py#L88-L150", "sha": "3c74fe60dfd15a528622195577f2aab3027693f0", "docstring_summary": "convert test reports into an xml file", "language": "python", "parameters": "(test_reports, suite_name,\n          hostname=gethostname(), package_name=\"tests\")", "return_statement": "return et.tostring(testsuites, encoding=\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", "(", ")", ",", "arg_4", "=", "\"tests\"", ")", ":", "arg_5", "=", "et", ".", "Element", "(", "\"testsuites\"", ")", "arg_6", "=", "et", ".", "SubElement", "(", "arg_5", ",", "\"testsuite\"", ")", "arg_7", "=", "len", "(", "arg_0", ")", "if", "arg_7", "<", "1", ":", "raise", "ValueError", "(", "'there must be at least one test report'", ")", "assert", "arg_7", ">", "0", ",", "'expecting at least one test'", "arg_8", "=", "len", "(", "[", "arg_15", "for", "arg_15", "in", "arg_0", "if", "arg_15", ".", "errors", "]", ")", "arg_9", "=", "len", "(", "[", "arg_15", "for", "arg_15", "in", "arg_0", "if", "arg_15", ".", "failures", "]", ")", "arg_10", "=", "arg_0", "[", "0", "]", ".", "start_ts", "arg_11", "=", "datetime", ".", "fromtimestamp", "(", "arg_10", ")", ".", "isoformat", "(", ")", "arg_12", "=", "arg_0", "[", "-", "1", "]", ".", "end_ts", "-", "arg_0", "[", "0", "]", ".", "start_ts", "def", "quote_attribute", "(", "arg_13", ")", ":", "return", "arg_13", "if", "arg_13", "is", "not", "None", "else", "\"(null)\"", "arg_6", ".", "attrib", "=", "dict", "(", "id", "=", "\"0\"", ",", "errors", "=", "str", "(", "arg_8", ")", ",", "failures", "=", "str", "(", "arg_9", ")", ",", "tests", "=", "str", "(", "arg_7", ")", ",", "arg_2", "=", "quote_attribute", "(", "arg_2", ")", ",", "timestamp", "=", "quote_attribute", "(", "arg_11", ")", ",", "time", "=", "\"%f\"", "%", "arg_12", ",", "name", "=", "quote_attribute", "(", "arg_1", ")", ",", "package", "=", "quote_attribute", "(", "arg_4", ")", ",", ")", "for", "arg_15", "in", "arg_0", ":", "arg_16", "=", "arg_15", ".", "name", "arg_17", "=", "arg_15", ".", "end_ts", "-", "arg_15", ".", "start_ts", "arg_18", "=", "arg_15", ".", "src_location", "arg_19", "=", "et", ".", "SubElement", "(", "arg_6", ",", "\"testcase\"", ")", "arg_19", ".", "attrib", "=", "dict", "(", "name", "=", "arg_16", ",", "classname", "=", "quote_attribute", "(", "arg_18", ")", ",", "time", "=", "\"%f\"", "%", "arg_17", ",", ")", "if", "arg_15", ".", "errors", "or", "arg_15", ".", "failures", ":", "if", "arg_15", ".", "failures", ":", "arg_20", "=", "et", ".", "SubElement", "(", "arg_19", ",", "\"failure\"", ")", "arg_20", ".", "attrib", "=", "dict", "(", "type", "=", "\"exception\"", ",", "message", "=", "quote_attribute", "(", "'\\n'", ".", "join", "(", "[", "'%s'", "%", "e", "for", "e", "in", "arg_15", ".", "failures", "]", ")", ")", ",", ")", "else", ":", "arg_21", "=", "et", ".", "SubElement", "(", "arg_19", ",", "\"error\"", ")", "arg_21", ".", "attrib", "=", "dict", "(", "type", "=", "\"exception\"", ",", "message", "=", "quote_attribute", "(", "'\\n'", ".", "join", "(", "[", "'%s'", "%", "e", "for", "e", "in", "arg_15", ".", "errors", "]", ")", ")", ",", ")", "return", "et", ".", "tostring", "(", "arg_5", ",", "encoding", "=", "\"utf-8\"", ")"], "function": "def Func(arg_0, arg_1,\n          arg_2=arg_3(), arg_4=\"tests\"):\n    \"\"\"convert test reports into an xml file\"\"\"\n\n    arg_5 = et.Element(\"testsuites\")\n    arg_6 = et.SubElement(arg_5, \"testsuite\")\n\n    arg_7 = len(arg_0)\n    if arg_7 < 1:\n        raise ValueError('there must be at least one test report')\n\n\n    assert arg_7 > 0, 'expecting at least one test'\n\n    arg_8 = len([arg_15 for arg_15 in arg_0 if arg_15.errors])\n    arg_9 = len([arg_15 for arg_15 in arg_0 if arg_15.failures])\n    arg_10 = arg_0[0].start_ts\n    arg_11 = datetime.fromtimestamp(arg_10).isoformat()\n\n    arg_12 = arg_0[-1].end_ts - arg_0[0].start_ts\n\n    def quote_attribute(arg_13):\n        return arg_13 if arg_13 is not None else \"(null)\"\n\n\n    arg_6.attrib = dict(\n        id=\"0\",\n        errors=str(arg_8),\n        failures=str(arg_9),\n        tests=str(arg_7),\n        arg_2=quote_attribute(arg_2),\n        timestamp=quote_attribute(arg_11),\n        time=\"%f\" % arg_12,\n        name=quote_attribute(arg_1),\n        package=quote_attribute(arg_4),\n    )\n\n    for arg_15 in arg_0:\n        arg_16 = arg_15.name\n        arg_17 = arg_15.end_ts - arg_15.start_ts\n        arg_18 = arg_15.src_location\n\n        arg_19 = et.SubElement(arg_6, \"testcase\")\n        arg_19.attrib = dict(\n            name=arg_16,\n            classname=quote_attribute(arg_18),\n            time=\"%f\" % arg_17,\n            )\n        if arg_15.errors or arg_15.failures:\n            if arg_15.failures:\n                arg_20 = et.SubElement(arg_19, \"failure\")\n                arg_20.attrib = dict(\n                    type=\"exception\",\n                    message=quote_attribute('\\n'.join(['%s' % e for e in arg_15.failures])),\n                )\n            else:\n                arg_21 = et.SubElement(arg_19, \"error\")\n                arg_21.attrib = dict(\n                    type=\"exception\",\n                    message=quote_attribute('\\n'.join(['%s' % e for e in arg_15.errors])),\n                )\n\n    return et.tostring(arg_5, encoding=\"utf-8\")", "path": "xunitgen/main.py", "identifier": "toxml", "docstring": "convert test reports into an xml file", "docstring_tokens": ["convert", "test", "reports", "into", "an", "xml", "file"], "nwo": "uucidl/uu.xunitgen", "score": 0.17385480483333982, "idx": 256038}
{"url": "https://github.com/cldf/clts/blob/2798554c9c4e668bce0e4f5b0d91cf03c2d7c13a/src/pyclts/util.py#L73-L81", "sha": "2798554c9c4e668bce0e4f5b0d91cf03c2d7c13a", "docstring_summary": "Auxiliary function for iterating over a data table.", "language": "python", "parameters": "(table)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ":", "arg_2", "=", "{", "arg_4", ".", "lower", "(", ")", ":", "nfd", "(", "arg_6", ")", "if", "isinstance", "(", "arg_6", ",", "text_type", ")", "else", "arg_6", "for", "arg_4", ",", "arg_6", "in", "arg_1", ".", "items", "(", ")", "}", "for", "arg_3", "in", "arg_2", ".", "pop", "(", "'extra'", ",", "[", "]", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_3", ".", "partition", "(", "':'", ")", "arg_2", "[", "arg_4", ".", "strip", "(", ")", "]", "=", "arg_6", ".", "strip", "(", ")", "yield", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Auxiliary function for iterating over a data table.\"\"\"\n    for arg_1 in arg_0:\n        arg_2 = {\n            arg_4.lower(): nfd(arg_6) if isinstance(arg_6, text_type) else arg_6 for arg_4, arg_6 in arg_1.items()}\n        for arg_3 in arg_2.pop('extra', []):\n            arg_4, arg_5, arg_6 = arg_3.partition(':')\n            arg_2[arg_4.strip()] = arg_6.strip()\n        yield arg_2", "path": "src/pyclts/util.py", "identifier": "itertable", "docstring": "Auxiliary function for iterating over a data table.", "docstring_tokens": ["Auxiliary", "function", "for", "iterating", "over", "a", "data", "table", "."], "nwo": "cldf/clts", "score": 0.30398045944799795, "idx": 256039}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/svg/arc.py#L105-L110", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Transform from the local frame to absolute space.", "language": "python", "parameters": "(xp, yp, cphi, sphi, mx, my)", "return_statement": "return (x,y)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "arg_0", "*", "arg_2", "-", "arg_1", "*", "arg_3", "+", "arg_4", "arg_7", "=", "arg_0", "*", "arg_3", "+", "arg_1", "*", "arg_2", "+", "arg_5", "return", "(", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\" Transform from the local frame to absolute space.\n    \"\"\"\n    arg_6 = arg_0 * arg_2 - arg_1 * arg_3 + arg_4\n    arg_7 = arg_0 * arg_3 + arg_1 * arg_2 + arg_5\n    return (arg_6,arg_7)", "path": "lib/svg/arc.py", "identifier": "transform_from_local", "docstring": "Transform from the local frame to absolute space.", "docstring_tokens": ["Transform", "from", "the", "local", "frame", "to", "absolute", "space", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256040}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/examples/common.py#L60-L81", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Run the example coroutine.", "language": "python", "parameters": "(example_coroutine, client, args)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "asyncio", ".", "ensure_future", "(", "arg_1", ".", "connect", "(", ")", ")", "arg_4", "=", "asyncio", ".", "Future", "(", ")", "arg_1", ".", "on_connect", ".", "add_observer", "(", "lambda", ":", "arg_4", ".", "set_result", "(", "None", ")", ")", "arg_5", ",", "arg_6", "=", "await", "asyncio", ".", "wait", "(", "(", "arg_4", ",", "arg_3", ")", ",", "return_when", "=", "asyncio", ".", "FIRST_COMPLETED", ")", "await", "asyncio", ".", "gather", "(", "*", "arg_5", ")", "try", ":", "await", "arg_0", "(", "arg_1", ",", "arg_2", ")", "except", "asyncio", ".", "CancelledError", ":", "pass", "finally", ":", "await", "arg_1", ".", "disconnect", "(", ")", "await", "arg_3"], "function": "async def Func(arg_0, arg_1, arg_2):\n    \"\"\"Run the example coroutine.\"\"\"\n    # Spawn a task for hangups to run in parallel with the example coroutine.\n    arg_3 = asyncio.ensure_future(arg_1.connect())\n\n    # Wait for hangups to either finish connecting or raise an exception.\n    arg_4 = asyncio.Future()\n    arg_1.on_connect.add_observer(lambda: arg_4.set_result(None))\n    arg_5, arg_6 = await asyncio.wait(\n        (arg_4, arg_3), return_when=asyncio.FIRST_COMPLETED\n    )\n    await asyncio.gather(*arg_5)\n\n    # Run the example coroutine. Afterwards, disconnect hangups gracefully and\n    # yield the hangups task to handle any exceptions.\n    try:\n        await arg_0(arg_1, arg_2)\n    except asyncio.CancelledError:\n        pass\n    finally:\n        await arg_1.disconnect()\n        await arg_3", "path": "examples/common.py", "identifier": "_async_main", "docstring": "Run the example coroutine.", "docstring_tokens": ["Run", "the", "example", "coroutine", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 256041}
{"url": "https://github.com/jedp/python-redis-log/blob/3fc81a43423adf289a7ec985f282a8a40341fc87/redislog/handlers.py#L46-L53", "sha": "3fc81a43423adf289a7ec985f282a8a40341fc87", "docstring_summary": "Publish record to redis logging channel", "language": "python", "parameters": "(self, record)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "redis_client", ".", "publish", "(", "arg_0", ".", "channel", ",", "arg_0", ".", "format", "(", "arg_1", ")", ")", "except", "redis", ".", "RedisError", ":", "pass"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Publish record to redis logging channel\n        \"\"\"\n        try:\n            arg_0.redis_client.publish(arg_0.channel, arg_0.format(arg_1))\n        except redis.RedisError:\n            pass", "path": "redislog/handlers.py", "identifier": "RedisHandler.emit", "docstring": "Publish record to redis logging channel", "docstring_tokens": ["Publish", "record", "to", "redis", "logging", "channel"], "nwo": "jedp/python-redis-log", "score": 0.31646955184280007, "idx": 256042}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/recurrent.py#L392-L433", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Draw a sequential sample of class labels from this network.", "language": "python", "parameters": "(self, labels, steps, streams=1, rng=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", "or", "isinstance", "(", "arg_4", ",", "int", ")", ":", "arg_4", "=", "arg_8", ".", "random", ".", "RandomState", "(", "arg_4", ")", "arg_5", "=", "len", "(", "arg_1", ")", "arg_6", "=", "max", "(", "2", ",", "arg_3", ")", "arg_7", "=", "arg_8", ".", "zeros", "(", "(", "arg_6", ",", "arg_5", "+", "arg_2", ",", "arg_0", ".", "layers", "[", "0", "]", ".", "output_size", ")", ",", "'f'", ")", "arg_7", "[", ":", ",", "arg_8", ".", "arange", "(", "arg_5", ")", ",", "arg_1", "]", "=", "1", "for", "arg_10", "in", "range", "(", "arg_5", ",", "arg_5", "+", "arg_2", ")", ":", "arg_11", "=", "[", "]", "for", "arg_12", "in", "arg_0", ".", "predict_proba", "(", "arg_7", "[", ":", "arg_10", "]", ")", "[", ":", ",", "-", "1", "]", ":", "try", ":", "arg_13", "=", "arg_4", ".", "multinomial", "(", "1", ",", "arg_12", ")", ".", "argmax", "(", "axis", "=", "-", "1", ")", "except", "ValueError", ":", "arg_13", "=", "arg_12", ".", "argmax", "(", "axis", "=", "-", "1", ")", "arg_11", ".", "append", "(", "int", "(", "arg_13", ")", ")", "arg_7", "[", "arg_8", ".", "arange", "(", "arg_6", ")", ",", "arg_10", ",", "arg_11", "]", "=", "1", "yield", "arg_11", "[", "0", "]", "if", "arg_3", "==", "1", "else", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1, arg_4=None):\n        '''Draw a sequential sample of class labels from this network.\n\n        Parameters\n        ----------\n        labels : list of int\n            A list of integer class labels to get the classifier started.\n        steps : int\n            The number of time steps to sample.\n        streams : int, optional\n            Number of parallel streams to sample from the model. Defaults to 1.\n        rng : :class:`numpy.random.RandomState` or int, optional\n            A random number generator, or an integer seed for a random number\n            generator. If not provided, the random number generator will be\n            created with an automatically chosen seed.\n\n        Yields\n        ------\n        label(s) : int or list of int\n            Yields at each time step an integer class label sampled sequentially\n            from the model. If the number of requested streams is greater than\n            1, this will be a list containing the corresponding number of class\n            labels.\n        '''\n        if arg_4 is None or isinstance(arg_4, int):\n            arg_4 = arg_8.random.RandomState(arg_4)\n        arg_5 = len(arg_1)\n        arg_6 = max(2, arg_3)\n        arg_7 = arg_8.zeros((arg_6, arg_5 + arg_2, arg_0.layers[0].output_size), 'f')\n        arg_7[:, arg_8.arange(arg_5), arg_1] = 1\n        for arg_10 in range(arg_5, arg_5 + arg_2):\n            arg_11 = []\n            for arg_12 in arg_0.predict_proba(arg_7[:arg_10])[:, -1]:\n                try:\n                    arg_13 = arg_4.multinomial(1, arg_12).argmax(axis=-1)\n                except ValueError:\n                    # sometimes the pdf triggers a normalization error. just\n                    # choose greedily in this case.\n                    arg_13 = arg_12.argmax(axis=-1)\n                arg_11.append(int(arg_13))\n            arg_7[arg_8.arange(arg_6), arg_10, arg_11] = 1\n            yield arg_11[0] if arg_3 == 1 else arg_11", "path": "theanets/recurrent.py", "identifier": "Classifier.predict_sequence", "docstring": "Draw a sequential sample of class labels from this network.\n\n        Parameters\n        ----------\n        labels : list of int\n            A list of integer class labels to get the classifier started.\n        steps : int\n            The number of time steps to sample.\n        streams : int, optional\n            Number of parallel streams to sample from the model. Defaults to 1.\n        rng : :class:`numpy.random.RandomState` or int, optional\n            A random number generator, or an integer seed for a random number\n            generator. If not provided, the random number generator will be\n            created with an automatically chosen seed.\n\n        Yields\n        ------\n        label(s) : int or list of int\n            Yields at each time step an integer class label sampled sequentially\n            from the model. If the number of requested streams is greater than\n            1, this will be a list containing the corresponding number of class\n            labels.", "docstring_tokens": ["Draw", "a", "sequential", "sample", "of", "class", "labels", "from", "this", "network", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 256043}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/get_year_commits.py#L11-L34", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Does setup such as login, printing API info, and waiting for GitHub to\n        build the commit statistics. Then gets the last year of commits and\n        prints them to file.", "language": "python", "parameters": "(self, username='', password='', organization='llnl', force=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "''", ",", "arg_3", "=", "'llnl'", ",", "arg_4", "=", "True", ")", ":", "arg_5", "=", "str", "(", "datetime", ".", "date", ".", "today", "(", ")", ")", "arg_6", "=", "(", "'year_commits.csv'", ")", "if", "arg_4", "or", "not", "os", ".", "path", ".", "isfile", "(", "arg_6", ")", ":", "my_github", ".", "login", "(", "arg_1", ",", "arg_2", ")", "arg_7", "=", "arg_0", ".", "logged_in_gh", ".", "ratelimit_remaining", "+", "1", "print", "'Rate Limit: '", "+", "str", "(", "arg_7", ")", "my_github", ".", "get_org", "(", "arg_3", ")", "my_github", ".", "repos", "(", "building_stats", "=", "True", ")", "print", "\"Letting GitHub build statistics.\"", "time", ".", "sleep", "(", "30", ")", "print", "\"Trying again.\"", "my_github", ".", "repos", "(", "building_stats", "=", "False", ")", "my_github", ".", "calc_total_commits", "(", "starting_commits", "=", "35163", ")", "my_github", ".", "write_to_file", "(", ")", "arg_8", "=", "arg_0", ".", "logged_in_gh", ".", "ratelimit_remaining", "arg_9", "=", "arg_7", "-", "arg_8", "print", "(", "'Rate Limit Remaining: '", "+", "str", "(", "arg_8", ")", "+", "'\\nUsed '", "+", "str", "(", "arg_9", ")", "+", "' API calls.'", ")"], "function": "def Func(arg_0, arg_1='', arg_2='', arg_3='llnl', arg_4=True):\n        \"\"\"\n        Does setup such as login, printing API info, and waiting for GitHub to\n        build the commit statistics. Then gets the last year of commits and\n        prints them to file.\n        \"\"\"\n        arg_5 = str(datetime.date.today())\n        arg_6 =  ('year_commits.csv')\n        if arg_4 or not os.path.isfile(arg_6):\n            my_github.login(arg_1, arg_2)\n            arg_7 = arg_0.logged_in_gh.ratelimit_remaining + 1\n            print 'Rate Limit: ' + str(arg_7)\n            my_github.get_org(arg_3)\n            my_github.repos(building_stats=True)\n            print \"Letting GitHub build statistics.\"\n            time.sleep(30)\n            print \"Trying again.\"\n            my_github.repos(building_stats=False)\n            my_github.calc_total_commits(starting_commits=35163)\n            my_github.write_to_file()\n            arg_8 = arg_0.logged_in_gh.ratelimit_remaining\n            arg_9 = arg_7 - arg_8\n            print ('Rate Limit Remaining: ' + str(arg_8) + '\\nUsed '\n                + str(arg_9) + ' API calls.')", "path": "scripts/get_year_commits.py", "identifier": "GitHub_LLNL_Year_Commits.get_year_commits", "docstring": "Does setup such as login, printing API info, and waiting for GitHub to\n        build the commit statistics. Then gets the last year of commits and\n        prints them to file.", "docstring_tokens": ["Does", "setup", "such", "as", "login", "printing", "API", "info", "and", "waiting", "for", "GitHub", "to", "build", "the", "commit", "statistics", ".", "Then", "gets", "the", "last", "year", "of", "commits", "and", "prints", "them", "to", "file", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 256044}
{"url": "https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/tokens.py#L151-L159", "sha": "ce2cf3f1425d02ba4f3ad3202cfca43a1892558a", "docstring_summary": "Multiple algorithm-compatible token validation.", "language": "python", "parameters": "(cls, *args, **kwargs)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "None", "for", "arg_4", "in", "SUPPORTED_DIGEST_ALGORITHMS", ":", "arg_3", "=", "arg_0", "(", "algorithm_name", "=", "arg_4", ")", ".", "validate_token", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "not", "arg_3", ":", "continue", "return", "arg_3"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Multiple algorithm-compatible token validation.\"\"\"\n        arg_3 = None\n        for arg_4 in SUPPORTED_DIGEST_ALGORITHMS:\n            arg_3 = arg_0(algorithm_name=arg_4).validate_token(\n                *arg_1, **arg_2)\n            if not arg_3:  # move to next algorithm\n                continue\n        return arg_3", "path": "zenodo_accessrequests/tokens.py", "identifier": "EmailConfirmationSerializer.compat_validate_token", "docstring": "Multiple algorithm-compatible token validation.", "docstring_tokens": ["Multiple", "algorithm", "-", "compatible", "token", "validation", "."], "nwo": "zenodo/zenodo-accessrequests", "score": 0.2718259314615454, "idx": 256045}
{"url": "https://github.com/neon-jungle/wagtailmodelchooser/blob/8dd1e33dd61418a726ff3acf67a956626c8b7ba1/wagtailmodelchooser/utils.py#L45-L71", "sha": "8dd1e33dd61418a726ff3acf67a956626c8b7ba1", "docstring_summary": "Allows a function to be used as either a decorator with args, or called as\n    a normal function.", "language": "python", "parameters": "(func)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "decorator", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "signature_matches", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "else", ":", "return", "lambda", "last", ":", "arg_0", "(", "*", "(", "arg_1", "+", "(", "last", ",", ")", ")", ",", "**", "arg_2", ")", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Allows a function to be used as either a decorator with args, or called as\n    a normal function.\n\n    @Func\n    def register_a_thing(foo, func, bar=True):\n        ..\n\n    # Called as a decorator\n    @register_a_thing(\"abc\", bar=False)\n    def my_func():\n        ...\n\n    # Called as a normal function call\n    def my_other_func():\n        ...\n\n    register_a_thing(\"def\", my_other_func, bar=True)\n    \"\"\"\n    @wraps(arg_0)\n    def decorator(*arg_1, **arg_2):\n        if signature_matches(arg_0, arg_1, arg_2):\n            return arg_0(*arg_1, **arg_2)\n        else:\n            return lambda last: arg_0(*(arg_1 + (last,)), **arg_2)\n    return decorator", "path": "wagtailmodelchooser/utils.py", "identifier": "last_arg_decorator", "docstring": "Allows a function to be used as either a decorator with args, or called as\n    a normal function.\n\n    @last_arg_decorator\n    def register_a_thing(foo, func, bar=True):\n        ..\n\n    # Called as a decorator\n    @register_a_thing(\"abc\", bar=False)\n    def my_func():\n        ...\n\n    # Called as a normal function call\n    def my_other_func():\n        ...\n\n    register_a_thing(\"def\", my_other_func, bar=True)", "docstring_tokens": ["Allows", "a", "function", "to", "be", "used", "as", "either", "a", "decorator", "with", "args", "or", "called", "as", "a", "normal", "function", "."], "nwo": "neon-jungle/wagtailmodelchooser", "score": 0.5155075947839176, "idx": 256046}
{"url": "https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/outstation.py#L95-L113", "sha": "5bcd8240d1fc0aa1579e71f2efcab63b4c61c547", "docstring_summary": "Configure the Outstation's database of input point definitions.", "language": "python", "parameters": "(db_config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "analog", "[", "1", "]", ".", "clazz", "=", "opendnp3", ".", "PointClass", ".", "Class2", "arg_0", ".", "analog", "[", "1", "]", ".", "svariation", "=", "opendnp3", ".", "StaticAnalogVariation", ".", "Group30Var1", "arg_0", ".", "analog", "[", "1", "]", ".", "evariation", "=", "opendnp3", ".", "EventAnalogVariation", ".", "Group32Var7", "arg_0", ".", "analog", "[", "2", "]", ".", "clazz", "=", "opendnp3", ".", "PointClass", ".", "Class2", "arg_0", ".", "analog", "[", "2", "]", ".", "svariation", "=", "opendnp3", ".", "StaticAnalogVariation", ".", "Group30Var1", "arg_0", ".", "analog", "[", "2", "]", ".", "evariation", "=", "opendnp3", ".", "EventAnalogVariation", ".", "Group32Var7", "arg_0", ".", "binary", "[", "1", "]", ".", "clazz", "=", "opendnp3", ".", "PointClass", ".", "Class2", "arg_0", ".", "binary", "[", "1", "]", ".", "svariation", "=", "opendnp3", ".", "StaticBinaryVariation", ".", "Group1Var2", "arg_0", ".", "binary", "[", "1", "]", ".", "evariation", "=", "opendnp3", ".", "EventBinaryVariation", ".", "Group2Var2", "arg_0", ".", "binary", "[", "2", "]", ".", "clazz", "=", "opendnp3", ".", "PointClass", ".", "Class2", "arg_0", ".", "binary", "[", "2", "]", ".", "svariation", "=", "opendnp3", ".", "StaticBinaryVariation", ".", "Group1Var2", "arg_0", ".", "binary", "[", "2", "]", ".", "evariation", "=", "opendnp3", ".", "EventBinaryVariation", ".", "Group2Var2"], "function": "def Func(arg_0):\n        \"\"\"\n            Configure the Outstation's database of input point definitions.\n\n            Configure two Analog points (group/variation 30.1) at indexes 1 and 2.\n            Configure two Binary points (group/variation 1.2) at indexes 1 and 2.\n        \"\"\"\n        arg_0.analog[1].clazz = opendnp3.PointClass.Class2\n        arg_0.analog[1].svariation = opendnp3.StaticAnalogVariation.Group30Var1\n        arg_0.analog[1].evariation = opendnp3.EventAnalogVariation.Group32Var7\n        arg_0.analog[2].clazz = opendnp3.PointClass.Class2\n        arg_0.analog[2].svariation = opendnp3.StaticAnalogVariation.Group30Var1\n        arg_0.analog[2].evariation = opendnp3.EventAnalogVariation.Group32Var7\n        arg_0.binary[1].clazz = opendnp3.PointClass.Class2\n        arg_0.binary[1].svariation = opendnp3.StaticBinaryVariation.Group1Var2\n        arg_0.binary[1].evariation = opendnp3.EventBinaryVariation.Group2Var2\n        arg_0.binary[2].clazz = opendnp3.PointClass.Class2\n        arg_0.binary[2].svariation = opendnp3.StaticBinaryVariation.Group1Var2\n        arg_0.binary[2].evariation = opendnp3.EventBinaryVariation.Group2Var2", "path": "examples/outstation.py", "identifier": "OutstationApplication.configure_database", "docstring": "Configure the Outstation's database of input point definitions.\n\n            Configure two Analog points (group/variation 30.1) at indexes 1 and 2.\n            Configure two Binary points (group/variation 1.2) at indexes 1 and 2.", "docstring_tokens": ["Configure", "the", "Outstation", "s", "database", "of", "input", "point", "definitions", "."], "nwo": "ChargePoint/pydnp3", "score": 0.6403780379231505, "idx": 256047}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L2051-L2148", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Loads data starting from a node along a branch and starts recursively loading\n        all data at end of branch.", "language": "python", "parameters": "(self, traj_node, branch_name,\n                              load_data=pypetconstants.LOAD_DATA,\n                              with_links=True, recursive=False,\n                              max_depth=None, _trajectory=None,\n                              _as_new=False, _hdf5_group=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "LOAD_DATA", ",", "arg_6", "=", "True", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "arg_11", "=", "None", ")", ":", "if", "arg_3", "==", "arg_4", ".", "LOAD_NOTHING", ":", "return", "if", "arg_8", "is", "None", ":", "arg_8", "=", "float", "(", "'inf'", ")", "if", "arg_9", "is", "None", ":", "arg_9", "=", "arg_1", ".", "v_root", "if", "arg_11", "is", "None", ":", "arg_12", "=", "arg_1", ".", "v_full_name", ".", "replace", "(", "'.'", ",", "'/'", ")", "if", "arg_12", "==", "''", ":", "arg_11", "=", "arg_0", ".", "_trajectory_group", "else", ":", "try", ":", "arg_11", "=", "arg_0", ".", "_hdf5file", ".", "get_node", "(", "where", "=", "arg_0", ".", "_trajectory_group", ",", "arg_16", "=", "arg_12", ")", "except", "pt", ".", "NoSuchNodeError", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Cannot find `%s` the hdf5 node `%s` does not exist!'", "%", "(", "arg_1", ".", "v_full_name", ",", "arg_12", ")", ")", "raise", "arg_13", "=", "arg_2", ".", "split", "(", "'.'", ")", "arg_14", "=", "arg_13", ".", "pop", "(", ")", "arg_15", "=", "1", "for", "arg_16", "in", "arg_13", ":", "if", "arg_15", ">", "arg_8", ":", "return", "arg_11", "=", "getattr", "(", "arg_11", ",", "arg_16", ")", "arg_0", ".", "_tree_load_nodes_dfs", "(", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "False", ",", "arg_8", "=", "arg_8", ",", "arg_15", "=", "arg_15", ",", "trajectory", "=", "arg_9", ",", "as_new", "=", "arg_10", ",", "hdf5_group", "=", "arg_11", ")", "arg_15", "+=", "1", "arg_1", "=", "arg_1", ".", "_children", "[", "arg_16", "]", "if", "arg_15", "<=", "arg_8", ":", "arg_11", "=", "getattr", "(", "arg_11", ",", "arg_14", ")", "arg_0", ".", "_tree_load_nodes_dfs", "(", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_15", "=", "arg_15", ",", "trajectory", "=", "arg_9", ",", "as_new", "=", "arg_10", ",", "hdf5_group", "=", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                              arg_3=arg_4.LOAD_DATA,\n                              arg_6=True, arg_7=False,\n                              arg_8=None, arg_9=None,\n                              arg_10=False, arg_11=None):\n        \"\"\"Loads data starting from a node along a branch and starts recursively loading\n        all data at end of branch.\n\n        :param traj_node: The node from where loading starts\n\n        :param branch_name:\n\n            A branch along which loading progresses. Colon Notation is used:\n            'group1.group2.group3' loads 'group1', then 'group2', then 'group3' and then finally\n            recursively all children and children's children below 'group3'\n\n        :param load_data:\n\n            How to load the data\n\n\n        :param with_links:\n\n            If links should be loaded\n\n        :param recursive:\n\n            If loading recursively\n\n        :param max_depth:\n\n            The maximum depth to load the tree\n\n        :param _trajectory:\n\n            The trajectory\n\n        :param _as_new:\n\n            If trajectory is loaded as new\n\n        :param _hdf5_group:\n\n            HDF5 node in the file corresponding to `traj_node`.\n\n        \"\"\"\n        if arg_3 == arg_4.LOAD_NOTHING:\n            return\n\n        if arg_8 is None:\n            arg_8 = float('inf')\n\n        if arg_9 is None:\n            arg_9 = arg_1.v_root\n\n        if arg_11 is None:\n            arg_12 = arg_1.v_full_name.replace('.', '/')\n\n            # Get child node to load\n            if arg_12 == '':\n                arg_11 = arg_0._trajectory_group\n            else:\n                try:\n                    arg_11 = arg_0._hdf5file.get_node(where=arg_0._trajectory_group,\n                                                  arg_16=arg_12)\n                except pt.NoSuchNodeError:\n                    arg_0._logger.error('Cannot find `%s` the hdf5 node `%s` does not exist!'\n                                       % (arg_1.v_full_name, arg_12))\n                    raise\n\n        arg_13 = arg_2.split('.')\n\n        arg_14 = arg_13.pop()\n\n        arg_15 = 1\n\n        for arg_16 in arg_13:\n            if arg_15 > arg_8:\n                return\n            # First load along the branch\n            arg_11 = getattr(arg_11, arg_16)\n\n            arg_0._tree_load_nodes_dfs(arg_1, arg_3=arg_3, arg_6=arg_6,\n                                  arg_7=False, arg_8=arg_8, arg_15=arg_15,\n                                  trajectory=arg_9, as_new=arg_10,\n                                  hdf5_group=arg_11)\n\n            arg_15 += 1\n\n            arg_1 = arg_1._children[arg_16]\n\n        if arg_15 <= arg_8:\n            # Then load recursively all data in the last group and below\n            arg_11 = getattr(arg_11, arg_14)\n            arg_0._tree_load_nodes_dfs(arg_1, arg_3=arg_3, arg_6=arg_6,\n                                  arg_7=arg_7, arg_8=arg_8,\n                                  arg_15=arg_15, trajectory=arg_9,\n                                  as_new=arg_10, hdf5_group=arg_11)", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._tree_load_sub_branch", "docstring": "Loads data starting from a node along a branch and starts recursively loading\n        all data at end of branch.\n\n        :param traj_node: The node from where loading starts\n\n        :param branch_name:\n\n            A branch along which loading progresses. Colon Notation is used:\n            'group1.group2.group3' loads 'group1', then 'group2', then 'group3' and then finally\n            recursively all children and children's children below 'group3'\n\n        :param load_data:\n\n            How to load the data\n\n\n        :param with_links:\n\n            If links should be loaded\n\n        :param recursive:\n\n            If loading recursively\n\n        :param max_depth:\n\n            The maximum depth to load the tree\n\n        :param _trajectory:\n\n            The trajectory\n\n        :param _as_new:\n\n            If trajectory is loaded as new\n\n        :param _hdf5_group:\n\n            HDF5 node in the file corresponding to `traj_node`.", "docstring_tokens": ["Loads", "data", "starting", "from", "a", "node", "along", "a", "branch", "and", "starts", "recursively", "loading", "all", "data", "at", "end", "of", "branch", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256048}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/inspector.py#L285-L297", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Notify an imported module, used to analyze dependencies", "language": "python", "parameters": "(self, node, mod_path, relative)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "root", "(", ")", "arg_5", "=", "arg_4", ".", "name", "if", "arg_3", ":", "arg_2", "=", "\"%s.%s\"", "%", "(", "\".\"", ".", "join", "(", "arg_5", ".", "split", "(", "\".\"", ")", "[", ":", "-", "1", "]", ")", ",", "arg_2", ")", "if", "arg_0", ".", "compute_module", "(", "arg_5", ",", "arg_2", ")", ":", "if", "not", "hasattr", "(", "arg_4", ",", "\"depends\"", ")", ":", "arg_4", ".", "depends", "=", "[", "]", "arg_7", "=", "arg_4", ".", "depends", "if", "arg_2", "not", "in", "arg_7", ":", "arg_7", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Notify an imported module, used to analyze dependencies\"\"\"\n        arg_4 = arg_1.root()\n        arg_5 = arg_4.name\n        if arg_3:\n            arg_2 = \"%s.%s\" % (\".\".join(arg_5.split(\".\")[:-1]), arg_2)\n        if arg_0.compute_module(arg_5, arg_2):\n            # handle dependencies\n            if not hasattr(arg_4, \"depends\"):\n                arg_4.depends = []\n            arg_7 = arg_4.depends\n            if arg_2 not in arg_7:\n                arg_7.append(arg_2)", "path": "pylint/pyreverse/inspector.py", "identifier": "Linker._imported_module", "docstring": "Notify an imported module, used to analyze dependencies", "docstring_tokens": ["Notify", "an", "imported", "module", "used", "to", "analyze", "dependencies"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256049}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/decorators.py#L38-L100", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Function decorator that Looks for an argument named \"default_args\", and\n    fills the unspecified arguments from it.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "signature", "(", "arg_0", ")", "arg_2", "=", "{", "name", "for", "(", "name", ",", "param", ")", "in", "arg_1", ".", "parameters", ".", "items", "(", ")", "if", "param", ".", "default", "==", "param", ".", "empty", "and", "param", ".", "name", "!=", "'self'", "and", "param", ".", "kind", "not", "in", "(", "param", ".", "VAR_POSITIONAL", ",", "param", ".", "VAR_KEYWORD", ")", "}", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_3", ",", "**", "arg_4", ")", ":", "if", "len", "(", "arg_3", ")", ">", "1", ":", "raise", "AirflowException", "(", "\"Use keyword arguments when initializing operators\"", ")", "arg_5", "=", "{", "}", "arg_6", "=", "{", "}", "arg_7", "=", "arg_4", ".", "get", "(", "'dag'", ",", "None", ")", "or", "settings", ".", "CONTEXT_MANAGER_DAG", "if", "arg_7", ":", "arg_5", "=", "copy", "(", "arg_7", ".", "default_args", ")", "or", "{", "}", "arg_6", "=", "copy", "(", "arg_7", ".", "params", ")", "or", "{", "}", "arg_8", "=", "{", "}", "if", "'params'", "in", "arg_4", ":", "arg_8", "=", "arg_4", "[", "'params'", "]", "arg_6", ".", "update", "(", "arg_8", ")", "arg_9", "=", "{", "}", "if", "'default_args'", "in", "arg_4", ":", "arg_9", "=", "arg_4", "[", "'default_args'", "]", "if", "'params'", "in", "arg_9", ":", "arg_6", ".", "update", "(", "arg_9", "[", "'params'", "]", ")", "del", "arg_9", "[", "'params'", "]", "arg_5", ".", "update", "(", "arg_9", ")", "arg_9", "=", "arg_5", "for", "arg_10", "in", "arg_1", ".", "parameters", ":", "if", "arg_10", "not", "in", "arg_4", "and", "arg_10", "in", "arg_9", ":", "arg_4", "[", "arg_10", "]", "=", "arg_9", "[", "arg_10", "]", "arg_11", "=", "list", "(", "arg_2", "-", "set", "(", "arg_4", ")", ")", "if", "arg_11", ":", "arg_12", "=", "\"Argument {0} is required\"", ".", "format", "(", "arg_11", ")", "raise", "AirflowException", "(", "arg_12", ")", "arg_4", "[", "'params'", "]", "=", "arg_6", "arg_13", "=", "arg_0", "(", "*", "arg_3", ",", "**", "arg_4", ")", "return", "arg_13", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Function decorator that Looks for an argument named \"default_args\", and\n    fills the unspecified arguments from it.\n\n    Since python2.* isn't clear about which arguments are missing when\n    calling a function, and that this can be quite confusing with multi-level\n    inheritance and argument defaults, this decorator also alerts with\n    specific information about the missing arguments.\n    \"\"\"\n\n    # Cache inspect.signature for the wrapper closure to avoid calling it\n    # at every decorated invocation. This is separate sig_cache created\n    # per decoration, i.e. each function decorated using Func will\n    # have a different sig_cache.\n    arg_1 = signature(arg_0)\n    arg_2 = {\n        name for (name, param) in arg_1.parameters.items()\n        if param.default == param.empty and\n        param.name != 'self' and\n        param.kind not in (param.VAR_POSITIONAL, param.VAR_KEYWORD)}\n\n    @wraps(arg_0)\n    def wrapper(*arg_3, **arg_4):\n        if len(arg_3) > 1:\n            raise AirflowException(\n                \"Use keyword arguments when initializing operators\")\n        arg_5 = {}\n        arg_6 = {}\n\n        arg_7 = arg_4.get('dag', None) or settings.CONTEXT_MANAGER_DAG\n        if arg_7:\n            arg_5 = copy(arg_7.default_args) or {}\n            arg_6 = copy(arg_7.params) or {}\n\n        arg_8 = {}\n        if 'params' in arg_4:\n            arg_8 = arg_4['params']\n        arg_6.update(arg_8)\n\n        arg_9 = {}\n        if 'default_args' in arg_4:\n            arg_9 = arg_4['default_args']\n            if 'params' in arg_9:\n                arg_6.update(arg_9['params'])\n                del arg_9['params']\n\n        arg_5.update(arg_9)\n        arg_9 = arg_5\n\n        for arg_10 in arg_1.parameters:\n            if arg_10 not in arg_4 and arg_10 in arg_9:\n                arg_4[arg_10] = arg_9[arg_10]\n        arg_11 = list(arg_2 - set(arg_4))\n        if arg_11:\n            arg_12 = \"Argument {0} is required\".format(arg_11)\n            raise AirflowException(arg_12)\n\n        arg_4['params'] = arg_6\n\n        arg_13 = arg_0(*arg_3, **arg_4)\n        return arg_13\n    return wrapper", "path": "airflow/utils/decorators.py", "identifier": "apply_defaults", "docstring": "Function decorator that Looks for an argument named \"default_args\", and\n    fills the unspecified arguments from it.\n\n    Since python2.* isn't clear about which arguments are missing when\n    calling a function, and that this can be quite confusing with multi-level\n    inheritance and argument defaults, this decorator also alerts with\n    specific information about the missing arguments.", "docstring_tokens": ["Function", "decorator", "that", "Looks", "for", "an", "argument", "named", "default_args", "and", "fills", "the", "unspecified", "arguments", "from", "it", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256050}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L581-L603", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Save a dictionnary into a YAML file.", "language": "python", "parameters": "(self, destination, flow_style=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "with", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "file", ":", "dump_yaml", "(", "arg_0", ".", "main_dictionnary", ",", "file", ",", "encoding", "=", "\"utf-8\"", ",", "allow_unicode", "=", "True", ",", "indent", "=", "4", ",", "default_flow_style", "=", "arg_2", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Save a dictionnary into a YAML file.\n\n        :param destination:\n            A path to a file where we're going to write the\n            converted dict into a JSON format.\n        :type destination: str\n        \"\"\"\n\n        with open(arg_1, \"w\") as file:\n            # We open the file we are going to write.\n            # Note: We always overwrite the destination.\n\n            # We save the current dictionnary into a json format.\n            dump_yaml(\n                arg_0.main_dictionnary,\n                file,\n                encoding=\"utf-8\",\n                allow_unicode=True,\n                indent=4,\n                default_flow_style=arg_2,\n            )", "path": "PyFunceble/helpers.py", "identifier": "Dict.to_yaml", "docstring": "Save a dictionnary into a YAML file.\n\n        :param destination:\n            A path to a file where we're going to write the\n            converted dict into a JSON format.\n        :type destination: str", "docstring_tokens": ["Save", "a", "dictionnary", "into", "a", "YAML", "file", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 256051}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2050-L2068", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Find eggs in zip files; possibly multiple nested eggs.", "language": "python", "parameters": "(importer, path_item, only=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_0", ".", "archive", ".", "endswith", "(", "'.whl'", ")", ":", "return", "arg_3", "=", "EggMetadata", "(", "arg_0", ")", "if", "arg_3", ".", "has_metadata", "(", "'PKG-INFO'", ")", ":", "yield", "Distribution", ".", "from_filename", "(", "arg_1", ",", "arg_3", "=", "arg_3", ")", "if", "arg_2", ":", "return", "for", "arg_4", "in", "arg_3", ".", "resource_listdir", "(", "'/'", ")", ":", "if", "arg_4", ".", "endswith", "(", "'.egg'", ")", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", "for", "arg_6", "in", "Func", "(", "zipimport", ".", "zipimporter", "(", "arg_5", ")", ",", "arg_5", ")", ":", "yield", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Find eggs in zip files; possibly multiple nested eggs.\n    \"\"\"\n    if arg_0.archive.endswith('.whl'):\n        # wheels are not supported with this finder\n        # they don't have PKG-INFO metadata, and won't ever contain eggs\n        return\n    arg_3 = EggMetadata(arg_0)\n    if arg_3.has_metadata('PKG-INFO'):\n        yield Distribution.from_filename(arg_1, arg_3=arg_3)\n    if arg_2:\n        # don't yield nested distros\n        return\n    for arg_4 in arg_3.resource_listdir('/'):\n        if arg_4.endswith('.egg'):\n            arg_5 = os.path.join(arg_1, arg_4)\n            for arg_6 in Func(zipimport.zipimporter(arg_5), arg_5):\n                yield arg_6", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", "identifier": "find_eggs_in_zip", "docstring": "Find eggs in zip files; possibly multiple nested eggs.", "docstring_tokens": ["Find", "eggs", "in", "zip", "files", ";", "possibly", "multiple", "nested", "eggs", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256052}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L28-L42", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Triggers request mock definition methods dynamically based on input\n    keyword arguments passed to `pook.Mock` constructor.", "language": "python", "parameters": "(instance, request)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "Request", ")", ":", "raise", "TypeError", "(", "'request must be instance of pook.Request'", ")", "for", "arg_2", "in", "arg_1", ".", "keys", ":", "if", "hasattr", "(", "arg_0", ",", "arg_2", ")", ":", "getattr", "(", "arg_0", ",", "arg_2", ")", "(", "getattr", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Triggers request mock definition methods dynamically based on input\n    keyword arguments passed to `pook.Mock` constructor.\n\n    This is used to provide a more Pythonic interface vs chainable API\n    approach.\n    \"\"\"\n    if not isinstance(arg_1, Request):\n        raise TypeError('request must be instance of pook.Request')\n\n    # Register request matchers\n    for arg_2 in arg_1.keys:\n        if hasattr(arg_0, arg_2):\n            getattr(arg_0, arg_2)(getattr(arg_1, arg_2))", "path": "pook/mock.py", "identifier": "_trigger_request", "docstring": "Triggers request mock definition methods dynamically based on input\n    keyword arguments passed to `pook.Mock` constructor.\n\n    This is used to provide a more Pythonic interface vs chainable API\n    approach.", "docstring_tokens": ["Triggers", "request", "mock", "definition", "methods", "dynamically", "based", "on", "input", "keyword", "arguments", "passed", "to", "pook", ".", "Mock", "constructor", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 256053}
{"url": "https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/result.py#L77-L83", "sha": "5b8218cffa409ed733cf850a6fde16fafb8fc2af", "docstring_summary": "Return output for the combined time and result summary statistics.", "language": "python", "parameters": "(self, elapsed, result)", "return_statement": "return \"\\n\".join((self.timing(elapsed), self.result_summary(result)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "\"\\n\"", ".", "join", "(", "(", "arg_0", ".", "timing", "(", "arg_1", ")", ",", "arg_0", ".", "result_summary", "(", "arg_2", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Return output for the combined time and result summary Func.\n\n        \"\"\"\n\n        return \"\\n\".join((arg_0.timing(arg_1), arg_0.result_summary(arg_2)))", "path": "ivoire/result.py", "identifier": "FormatterMixin.statistics", "docstring": "Return output for the combined time and result summary statistics.", "docstring_tokens": ["Return", "output", "for", "the", "combined", "time", "and", "result", "summary", "statistics", "."], "nwo": "Julian/Ivoire", "score": 0.27637529583590154, "idx": 256054}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L379-L384", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Write to a file in the directory.", "language": "python", "parameters": "(self, filename, data, mode='w')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'w'", ")", ":", "with", "open", "(", "arg_0", ".", "path_to", "(", "str", "(", "arg_1", ")", ")", ",", "arg_3", ")", "as", "f", ":", "f", ".", "Func", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='w'):\n        \"\"\"\n        Write to a file in the directory.\n        \"\"\"\n        with open(arg_0.path_to(str(arg_1)), arg_3) as f:\n            f.Func(arg_2)", "path": "scruffy/file.py", "identifier": "Directory.write", "docstring": "Write to a file in the directory.", "docstring_tokens": ["Write", "to", "a", "file", "in", "the", "directory", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 256055}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/indexing/standard.py#L70-L80", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "IC steps. Use to determine gain function.", "language": "python", "parameters": "(abf=exampleABF)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ")", ":", "swhlab", ".", "ap", ".", "detect", "(", "arg_0", ")", "standard_groupingForInj", "(", "arg_0", ",", "200", ")", "for", "arg_2", "in", "[", "'freq'", ",", "'downslope'", "]", ":", "swhlab", ".", "ap", ".", "plot_values", "(", "arg_0", ",", "arg_2", ",", "continuous", "=", "False", ")", "swhlab", ".", "plot", ".", "save", "(", "arg_0", ",", "tag", "=", "'A_'", "+", "arg_2", ")", "swhlab", ".", "plot", ".", "gain", "(", "arg_0", ")", "swhlab", ".", "plot", ".", "save", "(", "arg_0", ",", "tag", "=", "'05-gain'", ")"], "function": "def Func(arg_0=arg_1):\n    \"\"\"IC steps. Use to determine gain function.\"\"\"\n    swhlab.ap.detect(arg_0)\n    standard_groupingForInj(arg_0,200)\n\n    for arg_2 in ['freq','downslope']:\n        swhlab.ap.plot_values(arg_0,arg_2,continuous=False) #plot AP info\n        swhlab.plot.save(arg_0,tag='A_'+arg_2)\n\n    swhlab.plot.gain(arg_0) #easy way to do a gain function!\n    swhlab.plot.save(arg_0,tag='05-gain')", "path": "doc/oldcode/indexing/standard.py", "identifier": "proto_01_12_steps025", "docstring": "IC steps. Use to determine gain function.", "docstring_tokens": ["IC", "steps", ".", "Use", "to", "determine", "gain", "function", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 256056}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L180-L184", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Create a new Set produce by the union of 2 Set", "language": "python", "parameters": "(self, sig: Scope)", "return_statement": "return new", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "arg_3", "=", "arg_2", "(", "arg_1", "=", "arg_0", ".", "_hsig", ".", "values", "(", ")", ",", "state", "=", "arg_0", ".", "state", ")", "arg_3", "|=", "arg_1", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        \"\"\" Create a new Set produce by the Func of 2 Set \"\"\"\n        arg_3 = arg_2(arg_1=arg_0._hsig.values(), state=arg_0.state)\n        arg_3 |= arg_1\n        return arg_3", "path": "pyrser/type_system/scope.py", "identifier": "Scope.union", "docstring": "Create a new Set produce by the union of 2 Set", "docstring_tokens": ["Create", "a", "new", "Set", "produce", "by", "the", "union", "of", "2", "Set"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 256057}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L807-L815", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Begin writing output tap files.", "language": "python", "parameters": "(self, tapPath)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_tapFileIn", "=", "open", "(", "arg_1", "+", "'.in'", ",", "'w'", ")", "arg_0", ".", "_tapFileOut", "=", "open", "(", "arg_1", "+", "'.out'", ",", "'w'", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Begin writing output tap files.\n\n    :param tapPath: (string) base name of the output tap files to write.\n    \"\"\"\n\n    arg_0._tapFileIn = open(arg_1 + '.in', 'w')\n    arg_0._tapFileOut = open(arg_1 + '.out', 'w')", "path": "src/nupic/regions/knn_classifier_region.py", "identifier": "KNNClassifierRegion.enableTap", "docstring": "Begin writing output tap files.\n\n    :param tapPath: (string) base name of the output tap files to write.", "docstring_tokens": ["Begin", "writing", "output", "tap", "files", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256058}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L925-L1014", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Factory for loading the noise-map from a .fits file.", "language": "python", "parameters": "(noise_map_path, noise_map_hdu, pixel_scale, image, background_noise_map, exposure_time_map,\n                   convert_noise_map_from_weight_map, convert_noise_map_from_inverse_noise_map,\n                   noise_map_from_image_and_background_noise_map, convert_from_electrons, gain, convert_from_adus)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ")", ":", "arg_12", "=", "sum", "(", "[", "arg_6", ",", "arg_7", ",", "arg_8", "]", ")", "if", "arg_12", ">", "1", ":", "raise", "exc", ".", "DataException", "(", "'You have specified more than one method to load the noise_map map, e.g.:'", "'convert_noise_map_from_weight_map | '", "'convert_noise_map_from_inverse_noise_map |'", "'noise_map_from_image_and_background_noise_map'", ")", "if", "arg_12", "==", "0", "and", "arg_0", "is", "not", "None", ":", "return", "NoiseMap", ".", "from_fits_with_pixel_scale", "(", "file_path", "=", "arg_0", ",", "hdu", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "elif", "arg_6", "and", "arg_0", "is", "not", "None", ":", "arg_13", "=", "Array", ".", "from_fits", "(", "file_path", "=", "arg_0", ",", "hdu", "=", "arg_1", ")", "return", "NoiseMap", ".", "from_weight_map", "(", "arg_13", "=", "arg_13", ",", "arg_2", "=", "arg_2", ")", "elif", "arg_7", "and", "arg_0", "is", "not", "None", ":", "arg_14", "=", "Array", ".", "from_fits", "(", "file_path", "=", "arg_0", ",", "hdu", "=", "arg_1", ")", "return", "NoiseMap", ".", "from_inverse_noise_map", "(", "arg_14", "=", "arg_14", ",", "arg_2", "=", "arg_2", ")", "elif", "arg_8", ":", "if", "arg_4", "is", "None", ":", "raise", "exc", ".", "DataException", "(", "'Cannot compute the noise-map from the image and background noise_map map if a '", "'background noise_map map is not supplied.'", ")", "if", "not", "(", "arg_9", "or", "arg_11", ")", "and", "arg_5", "is", "None", ":", "raise", "exc", ".", "DataException", "(", "'Cannot compute the noise-map from the image and background noise_map map if an '", "'exposure-time (or exposure time map) is not supplied to convert to adus'", ")", "if", "arg_11", "and", "arg_10", "is", "None", ":", "raise", "exc", ".", "DataException", "(", "'Cannot compute the noise-map from the image and background noise_map map if a'", "'gain is not supplied to convert from adus'", ")", "return", "NoiseMap", ".", "from_image_and_background_noise_map", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ")", "else", ":", "raise", "exc", ".", "DataException", "(", "'A noise_map map was not loaded, specify a noise_map_path or option to compute a noise_map map.'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5,\n                   arg_6, arg_7,\n                   arg_8, arg_9, arg_10, arg_11):\n    \"\"\"Factory for loading the noise-map from a .fits file.\n\n    This factory also includes a number of routines for converting the noise-map from from other units (e.g. \\\n    a weight map) or computing the noise-map from other unblurred_image_1d (e.g. the ccd image and background noise-map).\n\n    Parameters\n    ----------\n    noise_map_path : str\n        The path to the noise_map .fits file containing the noise_map (e.g. '/path/to/noise_map.fits')\n    noise_map_hdu : int\n        The hdu the noise_map is contained in the .fits file specified by *noise_map_path*.\n    pixel_scale : float\n        The size of each pixel in arc seconds.\n    image : ndarray\n        The image-image, which the noise-map can be calculated using.\n    background_noise_map : ndarray\n        The background noise-map, which the noise-map can be calculated using.\n    exposure_time_map : ndarray\n        The exposure-time map, which the noise-map can be calculated using.\n    convert_noise_map_from_weight_map : bool\n        If True, the noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_noise_map_from_inverse_noise_map : bool\n        If True, the noise-map loaded from the .fits file is converted from an inverse noise-map to a noise-map (see \\\n        *NoiseMap.from_inverse_noise_map).\n    background_noise_map_path : str\n        The path and filename of the .fits image containing the background noise-map.\n    background_noise_map_hdu : int\n        The hdu the background noise-map is contained in the .fits file that *background_noise_map_path* points too.\n    convert_background_noise_map_from_weight_map : bool\n        If True, the bacground noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_background_noise_map_from_inverse_noise_map : bool\n        If True, the background noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    noise_map_from_image_and_background_noise_map : bool\n        If True, the noise-map is computed from the observed image and background noise-map \\\n        (see NoiseMap.from_image_and_background_noise_map).\n    convert_from_electrons : bool\n        If True, the input unblurred_image_1d are in units of electrons and all converted to electrons / second using the exposure \\\n        time map.\n    gain : float\n        The image gain, used for convert from ADUs.\n    convert_from_adus : bool\n        If True, the input unblurred_image_1d are in units of adus and all converted to electrons / second using the exposure \\\n        time map and gain.\n    \"\"\"\n    arg_12 = sum([arg_6,\n                             arg_7,\n                             arg_8])\n\n    if arg_12 > 1:\n        raise exc.DataException('You have specified more than one method to load the noise_map map, e.g.:'\n                                   'convert_noise_map_from_weight_map | '\n                                   'convert_noise_map_from_inverse_noise_map |'\n                                   'noise_map_from_image_and_background_noise_map')\n\n    if arg_12 == 0 and arg_0 is not None:\n        return NoiseMap.from_fits_with_pixel_scale(file_path=arg_0, hdu=arg_1, arg_2=arg_2)\n    elif arg_6 and arg_0 is not None:\n        arg_13 = Array.from_fits(file_path=arg_0, hdu=arg_1)\n        return NoiseMap.from_weight_map(arg_13=arg_13, arg_2=arg_2)\n    elif arg_7 and arg_0 is not None:\n        arg_14 = Array.from_fits(file_path=arg_0, hdu=arg_1)\n        return NoiseMap.from_inverse_noise_map(arg_14=arg_14, arg_2=arg_2)\n    elif arg_8:\n\n        if arg_4 is None:\n            raise exc.DataException('Cannot compute the noise-map from the image and background noise_map map if a '\n                                       'background noise_map map is not supplied.')\n\n        if not (arg_9 or arg_11) and arg_5 is None:\n            raise exc.DataException('Cannot compute the noise-map from the image and background noise_map map if an '\n                                       'exposure-time (or exposure time map) is not supplied to convert to adus')\n\n        if arg_11 and arg_10 is None:\n            raise exc.DataException('Cannot compute the noise-map from the image and background noise_map map if a'\n                                       'gain is not supplied to convert from adus')\n\n        return NoiseMap.from_image_and_background_noise_map(arg_2=arg_2, arg_3=arg_3,\n                                                            arg_4=arg_4,\n                                                            arg_5=arg_5,\n                                                            arg_9=arg_9,\n                                                            arg_10=arg_10, arg_11=arg_11)\n    else:\n        raise exc.DataException(\n            'A noise_map map was not loaded, specify a noise_map_path or option to compute a noise_map map.')", "path": "autolens/data/ccd.py", "identifier": "load_noise_map", "docstring": "Factory for loading the noise-map from a .fits file.\n\n    This factory also includes a number of routines for converting the noise-map from from other units (e.g. \\\n    a weight map) or computing the noise-map from other unblurred_image_1d (e.g. the ccd image and background noise-map).\n\n    Parameters\n    ----------\n    noise_map_path : str\n        The path to the noise_map .fits file containing the noise_map (e.g. '/path/to/noise_map.fits')\n    noise_map_hdu : int\n        The hdu the noise_map is contained in the .fits file specified by *noise_map_path*.\n    pixel_scale : float\n        The size of each pixel in arc seconds.\n    image : ndarray\n        The image-image, which the noise-map can be calculated using.\n    background_noise_map : ndarray\n        The background noise-map, which the noise-map can be calculated using.\n    exposure_time_map : ndarray\n        The exposure-time map, which the noise-map can be calculated using.\n    convert_noise_map_from_weight_map : bool\n        If True, the noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_noise_map_from_inverse_noise_map : bool\n        If True, the noise-map loaded from the .fits file is converted from an inverse noise-map to a noise-map (see \\\n        *NoiseMap.from_inverse_noise_map).\n    background_noise_map_path : str\n        The path and filename of the .fits image containing the background noise-map.\n    background_noise_map_hdu : int\n        The hdu the background noise-map is contained in the .fits file that *background_noise_map_path* points too.\n    convert_background_noise_map_from_weight_map : bool\n        If True, the bacground noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_background_noise_map_from_inverse_noise_map : bool\n        If True, the background noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    noise_map_from_image_and_background_noise_map : bool\n        If True, the noise-map is computed from the observed image and background noise-map \\\n        (see NoiseMap.from_image_and_background_noise_map).\n    convert_from_electrons : bool\n        If True, the input unblurred_image_1d are in units of electrons and all converted to electrons / second using the exposure \\\n        time map.\n    gain : float\n        The image gain, used for convert from ADUs.\n    convert_from_adus : bool\n        If True, the input unblurred_image_1d are in units of adus and all converted to electrons / second using the exposure \\\n        time map and gain.", "docstring_tokens": ["Factory", "for", "loading", "the", "noise", "-", "map", "from", "a", ".", "fits", "file", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 256059}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L478-L501", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Expanded version of Code.explanation supporting extra bits.\n        If you don't supply extra, it is not mentioned.", "language": "python", "parameters": "(self, index, extra=None)", "return_statement": "return formatString.format(\n            self.description and self.description+': ',\n            'x'*extraBits,\n            self.bitPattern(index),\n            lo, hi,\n            extra,\n            value,\n            )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "0", "if", "arg_2", "is", "None", "else", "arg_0", ".", "extraBits", "(", "arg_1", ")", "if", "not", "hasattr", "(", "arg_0", ",", "'extraTable'", ")", ":", "arg_4", "=", "'{0}{3}'", "arg_5", "=", "arg_6", "=", "arg_7", "=", "arg_0", ".", "value", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_3", "==", "0", ":", "arg_4", "=", "'{0}{2}: {3}'", "arg_5", ",", "arg_6", "=", "arg_0", ".", "span", "(", "arg_1", ")", "arg_7", "=", "arg_5", "else", ":", "arg_4", "=", "'{0}{1} {2}: {3}-{4}; {3}+{5}={6}'", "arg_5", ",", "arg_6", "=", "arg_0", ".", "span", "(", "arg_1", ")", "arg_7", "=", "arg_5", "+", "arg_2", "return", "arg_4", ".", "format", "(", "arg_0", ".", "description", "and", "arg_0", ".", "description", "+", "': '", ",", "'x'", "*", "arg_3", ",", "arg_0", ".", "bitPattern", "(", "arg_1", ")", ",", "arg_5", ",", "arg_6", ",", "arg_2", ",", "arg_7", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Expanded version of Code.Func supporting extra bits.\n        If you don't supply extra, it is not mentioned.\n        \"\"\"\n        arg_3 = 0 if arg_2 is None else arg_0.extraBits(arg_1)\n        if not hasattr(arg_0, 'extraTable'):\n            arg_4 = '{0}{3}'\n            arg_5 = arg_6 = arg_7 = arg_0.value(arg_1, arg_2)\n        elif arg_3==0:\n            arg_4 = '{0}{2}: {3}'\n            arg_5, arg_6 = arg_0.span(arg_1)\n            arg_7 = arg_5\n        else:\n            arg_4 = '{0}{1} {2}: {3}-{4}; {3}+{5}={6}'\n            arg_5, arg_6 = arg_0.span(arg_1)\n            arg_7 = arg_5+arg_2\n        return arg_4.format(\n            arg_0.description and arg_0.description+': ',\n            'x'*arg_3,\n            arg_0.bitPattern(arg_1),\n            arg_5, arg_6,\n            arg_2,\n            arg_7,\n            )", "path": "research/brotlidump.py", "identifier": "WithExtra.explanation", "docstring": "Expanded version of Code.explanation supporting extra bits.\n        If you don't supply extra, it is not mentioned.", "docstring_tokens": ["Expanded", "version", "of", "Code", ".", "explanation", "supporting", "extra", "bits", ".", "If", "you", "don", "t", "supply", "extra", "it", "is", "not", "mentioned", "."], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 256060}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/tiff.py#L31-L56", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Export a numpy array to a TIFF file.", "language": "python", "parameters": "(tiff_filename, numpy_data)", "return_statement": "return tiff_filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", "if", "type", "(", "arg_1", ")", "is", "str", ":", "arg_2", "=", "open", "(", "png_filename", ",", "\"wb\"", ")", "arg_2", ".", "write", "(", "arg_1", ")", "arg_2", ".", "close", "(", ")", "return", "png_filename", "try", ":", "arg_3", "=", "tiff", ".", "imFunc", "(", "arg_0", ",", "arg_1", ")", "except", "Exception", "as", "e", ":", "raise", "ValueError", "(", "\"Could not Func TIFF file {0}.\"", ".", "format", "(", "arg_0", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Export a numpy array to a TIFF file.\n\n    Arguments:\n        tiff_filename:  A filename to which to Func the TIFF data\n        numpy_data:     The numpy array to Func to TIFF\n\n    Returns:\n        String. The expanded filename that now holds the TIFF data\n    \"\"\"\n    # Expand filename to be absolute\n    arg_0 = os.path.expanduser(arg_0)\n\n    if type(arg_1) is str:\n        arg_2 = open(png_filename, \"wb\")\n        arg_2.write(arg_1)\n        arg_2.close()\n        return png_filename\n\n    try:\n        arg_3 = tiff.imFunc(arg_0, arg_1)\n    except Exception as e:\n        raise ValueError(\"Could not Func TIFF file {0}.\".format(arg_0))\n\n    return arg_0", "path": "ndio/convert/tiff.py", "identifier": "save", "docstring": "Export a numpy array to a TIFF file.\n\n    Arguments:\n        tiff_filename:  A filename to which to save the TIFF data\n        numpy_data:     The numpy array to save to TIFF\n\n    Returns:\n        String. The expanded filename that now holds the TIFF data", "docstring_tokens": ["Export", "a", "numpy", "array", "to", "a", "TIFF", "file", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 256061}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenestorage/masterpassword.py#L116-L131", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Generate a new random masterkey, encrypt it with the password and\n            store it in the store.", "language": "python", "parameters": "(self, password)", "return_statement": "return self.masterkey", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "config_key", "in", "arg_0", ".", "config", "and", "arg_0", ".", "config", "[", "arg_0", ".", "config_key", "]", ":", "raise", "Exception", "(", "\"Storage already has a masterpassword!\"", ")", "arg_0", ".", "decrypted_master", "=", "hexlify", "(", "os", ".", "urandom", "(", "32", ")", ")", ".", "decode", "(", "\"ascii\"", ")", "arg_0", ".", "password", "=", "arg_1", "arg_0", ".", "_save_encrypted_masterpassword", "(", ")", "return", "arg_0", ".", "masterkey"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Generate a new random masterkey, encrypt it with the password and\n            store it in the store.\n\n            :param str password: Password to use for en-/de-cryption\n        \"\"\"\n        # make sure to not overwrite an existing key\n        if arg_0.config_key in arg_0.config and arg_0.config[arg_0.config_key]:\n            raise Exception(\"Storage already has a masterpassword!\")\n\n        arg_0.decrypted_master = hexlify(os.urandom(32)).decode(\"ascii\")\n\n        # Encrypt and save master\n        arg_0.password = arg_1\n        arg_0._save_encrypted_masterpassword()\n        return arg_0.masterkey", "path": "graphenestorage/masterpassword.py", "identifier": "MasterPassword._new_masterpassword", "docstring": "Generate a new random masterkey, encrypt it with the password and\n            store it in the store.\n\n            :param str password: Password to use for en-/de-cryption", "docstring_tokens": ["Generate", "a", "new", "random", "masterkey", "encrypt", "it", "with", "the", "password", "and", "store", "it", "in", "the", "store", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 256062}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L117-L126", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Data analysis endpoint.", "language": "python", "parameters": "(self, data_view_id)", "return_statement": "return self._get_success_json(self._get(routes.data_analysis(data_view_id), failure_message=failure_message))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"Error while retrieving data analysis for data view {}\"", ".", "format", "(", "arg_1", ")", "return", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_get", "(", "routes", ".", "data_analysis", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Data analysis endpoint.\n\n        :param data_view_id: The model identifier (id number for data views)\n        :type data_view_id: str\n        :return: dictionary containing information about the data, e.g. dCorr and tsne\n        \"\"\"\n        arg_2 = \"Error while retrieving data analysis for data view {}\".format(arg_1)\n        return arg_0._get_success_json(arg_0._get(routes.data_analysis(arg_1), arg_2=arg_2))", "path": "citrination_client/models/client.py", "identifier": "ModelsClient._data_analysis", "docstring": "Data analysis endpoint.\n\n        :param data_view_id: The model identifier (id number for data views)\n        :type data_view_id: str\n        :return: dictionary containing information about the data, e.g. dCorr and tsne", "docstring_tokens": ["Data", "analysis", "endpoint", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 256063}
{"url": "https://github.com/ianare/django-memcache-admin/blob/330db10139ccf04c6137255e23115482b0c89aec/memcache_admin/views.py#L35-L50", "sha": "330db10139ccf04c6137255e23115482b0c89aec", "docstring_summary": "Get stats info.", "language": "python", "parameters": "(server_name=None)", "return_statement": "return server_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "mc_client", ".", "get_stats", "(", ")", ":", "arg_3", "=", "arg_2", "[", "0", "]", ".", "split", "(", "' '", ")", "arg_4", "=", "arg_3", "[", "0", "]", "arg_5", "=", "arg_2", "[", "1", "]", "arg_5", "[", "'bytes_percent'", "]", "=", "_percent", "(", "arg_5", ",", "'bytes'", ",", "'limit_maxbytes'", ")", "arg_5", "[", "'get_hit_rate'", "]", "=", "_percent", "(", "arg_5", ",", "'get_hits'", ",", "'cmd_get'", ")", "arg_5", "[", "'get_miss_rate'", "]", "=", "_percent", "(", "arg_5", ",", "'get_misses'", ",", "'cmd_get'", ")", "if", "arg_0", "and", "arg_0", "==", "arg_4", ":", "return", "arg_5", "arg_1", "[", "arg_4", "]", "=", "arg_5", "return", "arg_1"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Get stats info.\n    \"\"\"\n    arg_1 = {}\n    for arg_2 in mc_client.get_stats():\n        arg_3 = arg_2[0].split(' ')\n        arg_4 = arg_3[0]\n        arg_5 = arg_2[1]\n        arg_5['bytes_percent'] = _percent(arg_5, 'bytes', 'limit_maxbytes')\n        arg_5['get_hit_rate'] = _percent(arg_5, 'get_hits', 'cmd_get')\n        arg_5['get_miss_rate'] = _percent(arg_5, 'get_misses', 'cmd_get')\n        if arg_0 and arg_0 == arg_4:\n            return arg_5\n        arg_1[arg_4] = arg_5\n    return arg_1", "path": "memcache_admin/views.py", "identifier": "_get_cache_stats", "docstring": "Get stats info.", "docstring_tokens": ["Get", "stats", "info", "."], "nwo": "ianare/django-memcache-admin", "score": 0.18190671880906387, "idx": 256064}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/theater.py#L169-L199", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Prepare the actors, the world, and the messaging system to begin \n        playing the game.\n        \n        This method is guaranteed to be called exactly once upon entering the \n        game stage.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "world", ".", "_unlock_temporarily", "(", ")", ":", "arg_0", ".", "forum", ".", "connect_everyone", "(", "arg_0", ".", "world", ",", "arg_0", ".", "actors", ")", "arg_0", ".", "forum", ".", "on_start_game", "(", ")", "with", "arg_0", ".", "world", ".", "_unlock_temporarily", "(", ")", ":", "arg_0", ".", "world", ".", "on_start_game", "(", ")", "arg_1", "=", "len", "(", "arg_0", ".", "actors", ")", "-", "1", "for", "arg_2", "in", "arg_0", ".", "actors", ":", "arg_2", ".", "on_setup_gui", "(", "arg_0", ".", "gui", ")", "for", "arg_2", "in", "arg_0", ".", "actors", ":", "arg_2", ".", "on_start_game", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Prepare the actors, the world, and the messaging system to begin \n        playing the game.\n        \n        This method is guaranteed to be called exactly once upon entering the \n        game stage.\n        \"\"\"\n        with arg_0.world._unlock_temporarily():\n            arg_0.forum.connect_everyone(arg_0.world, arg_0.actors)\n\n        # 1. Setup the forum.\n\n        arg_0.forum.on_start_game()\n\n        # 2. Setup the world.\n\n        with arg_0.world._unlock_temporarily():\n            arg_0.world.on_start_game()\n\n        # 3. Setup the actors.  Because this is done after the forum and the  \n        #    world have been setup, this signals to the actors that they can \n        #    send messages and query the game world as usual.\n\n        arg_1 = len(arg_0.actors) - 1\n\n        for arg_2 in arg_0.actors:\n            arg_2.on_setup_gui(arg_0.gui)\n\n        for arg_2 in arg_0.actors:\n            arg_2.on_start_game(arg_1)", "path": "kxg/theater.py", "identifier": "GameStage.on_enter_stage", "docstring": "Prepare the actors, the world, and the messaging system to begin \n        playing the game.\n        \n        This method is guaranteed to be called exactly once upon entering the \n        game stage.", "docstring_tokens": ["Prepare", "the", "actors", "the", "world", "and", "the", "messaging", "system", "to", "begin", "playing", "the", "game", ".", "This", "method", "is", "guaranteed", "to", "be", "called", "exactly", "once", "upon", "entering", "the", "game", "stage", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 256065}
{"url": "https://github.com/stratis-storage/into-dbus-python/blob/81366049671f79116bbb81c97bf621800a2f6315/src/into_dbus_python/_xformer.py#L27-L48", "sha": "81366049671f79116bbb81c97bf621800a2f6315", "docstring_summary": "Wraps a generated function so that it catches all Type- and ValueErrors\n    and raises IntoDPValueErrors.", "language": "python", "parameters": "(func)", "return_statement": "return the_func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "the_func", "(", "arg_1", ")", ":", "try", ":", "return", "arg_0", "(", "arg_1", ")", "except", "(", "TypeError", ",", "ValueError", ")", "as", "err", ":", "raise", "IntoDPValueError", "(", "arg_1", ",", "\"expr\"", ",", "\"could not be transformed\"", ")", "from", "err", "return", "the_func"], "function": "def Func(arg_0):\n    \"\"\"\n    Wraps a generated function so that it catches all Type- and ValueErrors\n    and raises IntoDPValueErrors.\n\n    :param func: the transforming function\n    \"\"\"\n\n    @functools.wraps(arg_0)\n    def the_func(arg_1):\n        \"\"\"\n        The actual function.\n\n        :param object expr: the expression to be xformed to dbus-python types\n        \"\"\"\n        try:\n            return arg_0(arg_1)\n        except (TypeError, ValueError) as err:\n            raise IntoDPValueError(arg_1, \"expr\", \"could not be transformed\") \\\n               from err\n\n    return the_func", "path": "src/into_dbus_python/_xformer.py", "identifier": "_wrapper", "docstring": "Wraps a generated function so that it catches all Type- and ValueErrors\n    and raises IntoDPValueErrors.\n\n    :param func: the transforming function", "docstring_tokens": ["Wraps", "a", "generated", "function", "so", "that", "it", "catches", "all", "Type", "-", "and", "ValueErrors", "and", "raises", "IntoDPValueErrors", "."], "nwo": "stratis-storage/into-dbus-python", "score": 0.2751458370028208, "idx": 256066}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/examples/naughts_and_crosses.py#L71-L77", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Generates all the combinations of board positions that need\n        to be checked for a win.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "yield", "from", "arg_0", ".", "board", "yield", "from", "zip", "(", "*", "arg_0", ".", "board", ")", "yield", "arg_0", ".", "board", "[", "0", "]", "[", "0", "]", ",", "arg_0", ".", "board", "[", "1", "]", "[", "1", "]", ",", "arg_0", ".", "board", "[", "2", "]", "[", "2", "]", "yield", "arg_0", ".", "board", "[", "0", "]", "[", "2", "]", ",", "arg_0", ".", "board", "[", "1", "]", "[", "1", "]", ",", "arg_0", ".", "board", "[", "2", "]", "[", "0", "]"], "function": "def Func(arg_0):\n        '''Generates all the combinations of board positions that need\n        to be checked for a win.'''\n        yield from arg_0.board\n        yield from zip(*arg_0.board)\n        yield arg_0.board[0][0], arg_0.board[1][1], arg_0.board[2][2]\n        yield arg_0.board[0][2], arg_0.board[1][1], arg_0.board[2][0]", "path": "examples/naughts_and_crosses.py", "identifier": "Board._potential_wins", "docstring": "Generates all the combinations of board positions that need\n        to be checked for a win.", "docstring_tokens": ["Generates", "all", "the", "combinations", "of", "board", "positions", "that", "need", "to", "be", "checked", "for", "a", "win", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 256067}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L83-L93", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get the consent record relevant to the request at hand.", "language": "python", "parameters": "(self, request)", "return_statement": "return get_data_sharing_consent(\n            username,\n            enterprise_customer_uuid,\n            course_id=course_id,\n            program_uuid=program_uuid\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", ".", "get_required_query_params", "(", "arg_1", ")", "return", "get_data_sharing_consent", "(", "arg_2", ",", "arg_5", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get the consent record relevant to the request at hand.\n        \"\"\"\n        arg_2, arg_3, arg_4, arg_5 = arg_0.get_required_query_params(arg_1)\n        return get_data_sharing_consent(\n            arg_2,\n            arg_5,\n            arg_3=arg_3,\n            arg_4=arg_4\n        )", "path": "consent/api/v1/views.py", "identifier": "DataSharingConsentView.get_consent_record", "docstring": "Get the consent record relevant to the request at hand.", "docstring_tokens": ["Get", "the", "consent", "record", "relevant", "to", "the", "request", "at", "hand", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256068}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/batchwebhooks.py#L98-L107", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Remove a batch webhook. Webhooks will no longer be sent to the given\n        URL.", "language": "python", "parameters": "(self, batch_webhook_id)", "return_statement": "return self._mc_client._delete(url=self._build_path(batch_webhook_id))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "batch_webhook_id", "=", "arg_1", "return", "arg_0", ".", "_mc_client", ".", "_Func", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Remove a batch webhook. Webhooks will no longer be sent to the given\n        URL.\n\n        :param batch_webhook_id: The unique id for the batch webhook.\n        :type batch_webhook_id: :py:class:`str`\n        \"\"\"\n        arg_0.batch_webhook_id = arg_1\n        return arg_0._mc_client._Func(url=arg_0._build_path(arg_1))", "path": "mailchimp3/entities/batchwebhooks.py", "identifier": "BatchWebhooks.delete", "docstring": "Remove a batch webhook. Webhooks will no longer be sent to the given\n        URL.\n\n        :param batch_webhook_id: The unique id for the batch webhook.\n        :type batch_webhook_id: :py:class:`str`", "docstring_tokens": ["Remove", "a", "batch", "webhook", ".", "Webhooks", "will", "no", "longer", "be", "sent", "to", "the", "given", "URL", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 256069}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/pkl_utils.py#L1359-L1462", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This returns the magseries plot PNG as base64, plus arrays as dict.", "language": "python", "parameters": "(stimes, smags, serrs,\n                        plotdpi=100,\n                        magsarefluxes=False)", "return_statement": "return checkplotdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "100", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", "-", "npmin", "(", "arg_0", ")", "arg_6", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "7.5", ",", "4.8", ")", ",", "dpi", "=", "arg_3", ")", "plt", ".", "plot", "(", "arg_5", ",", "arg_1", ",", "marker", "=", "'o'", ",", "ms", "=", "2.0", ",", "ls", "=", "'None'", ",", "mew", "=", "0", ",", "color", "=", "'green'", ",", "rasterized", "=", "True", ")", "if", "not", "arg_4", ":", "arg_7", "=", "plt", ".", "ylim", "(", ")", "plt", ".", "ylim", "(", "(", "arg_7", "[", "1", "]", ",", "arg_7", "[", "0", "]", ")", ")", "plt", ".", "xlim", "(", "(", "npmin", "(", "arg_5", ")", "-", "2.0", ",", "npmax", "(", "arg_5", ")", "+", "2.0", ")", ")", "plt", ".", "grid", "(", "color", "=", "'#a9a9a9'", ",", "alpha", "=", "0.9", ",", "zorder", "=", "0", ",", "linewidth", "=", "1.0", ",", "linestyle", "=", "':'", ")", "arg_8", "=", "'JD - %.3f'", "%", "npmin", "(", "arg_0", ")", "if", "arg_4", ":", "arg_9", "=", "'flux'", "else", ":", "arg_9", "=", "'magnitude'", "plt", ".", "xlabel", "(", "arg_8", ")", "plt", ".", "ylabel", "(", "arg_9", ")", "plt", ".", "gca", "(", ")", ".", "get_yaxis", "(", ")", ".", "get_major_formatter", "(", ")", ".", "set_useOffset", "(", "False", ")", "plt", ".", "gca", "(", ")", ".", "get_xaxis", "(", ")", ".", "get_major_formatter", "(", ")", ".", "set_useOffset", "(", "False", ")", "arg_10", "=", "StrIO", "(", ")", "arg_6", ".", "savefig", "(", "arg_10", ",", "pad_inches", "=", "0.05", ",", "format", "=", "'png'", ")", "plt", ".", "close", "(", ")", "arg_10", ".", "seek", "(", "0", ")", "arg_11", "=", "base64", ".", "b64encode", "(", "arg_10", ".", "read", "(", ")", ")", "arg_10", ".", "close", "(", ")", "arg_12", "=", "{", "'magseries'", ":", "{", "'plot'", ":", "arg_11", ",", "'times'", ":", "arg_0", ",", "'mags'", ":", "arg_1", ",", "'errs'", ":", "arg_2", "}", "}", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2,\n                        arg_3=100,\n                        arg_4=False):\n    '''This returns the magseries plot PNG as base64, plus arrays as dict.\n\n    Parameters\n    ----------\n\n    stimes,smags,serrs : np.array\n        The mag/flux time-series arrays along with associated errors. These\n        should all have been run through nan-stripping and sigma-clipping\n        beforehand.\n\n    plotdpi : int\n        The resolution of the plot to make in DPI.\n\n    magsarefluxes : bool\n        If True, indicates the input time-series is fluxes and not mags so the\n        plot y-axis direction and range can be set appropriately.\n\n    Returns\n    -------\n\n    dict\n        A dict of the following form is returned::\n\n            {'magseries': {'plot': base64 encoded str representation of the\n                                   magnitude/flux time-series plot,\n                           'times': the `stimes` array,\n                           'mags': the `smags` array,\n                           'errs': the 'serrs' array}}\n\n        The dict is returned in this format so it can be directly incorporated\n        in a checkplotdict, using Python's dict `update()` method.\n\n    '''\n\n    arg_5 = arg_0 - npmin(arg_0)\n\n    # open the figure instance\n    arg_6 = plt.figure(figsize=(7.5,4.8),dpi=arg_3)\n\n    plt.plot(arg_5,\n             arg_1,\n             marker='o',\n             ms=2.0, ls='None',mew=0,\n             color='green',\n             rasterized=True)\n\n    # flip y axis for mags\n    if not arg_4:\n        arg_7 = plt.ylim()\n        plt.ylim((arg_7[1], arg_7[0]))\n\n    # set the x axis limit\n    plt.xlim((npmin(arg_5)-2.0,\n              npmax(arg_5)+2.0))\n\n    # make a grid\n    plt.grid(color='#a9a9a9',\n             alpha=0.9,\n             zorder=0,\n             linewidth=1.0,\n             linestyle=':')\n\n    # make the x and y axis labels\n    arg_8 = 'JD - %.3f' % npmin(arg_0)\n    if arg_4:\n        arg_9 = 'flux'\n    else:\n        arg_9 = 'magnitude'\n\n    plt.xlabel(arg_8)\n    plt.ylabel(arg_9)\n\n    # fix the yaxis ticks (turns off offset and uses the full\n    # value of the yaxis tick)\n    plt.gca().get_yaxis().get_major_formatter().set_useOffset(False)\n    plt.gca().get_xaxis().get_major_formatter().set_useOffset(False)\n\n    # this is the output instance\n    arg_10 = StrIO()\n    arg_6.savefig(arg_10,\n                         # bbox_inches='tight',\n                         pad_inches=0.05, format='png')\n    plt.close()\n\n    # encode the finderpng instance to base64\n    arg_10.seek(0)\n    arg_11 = base64.b64encode(arg_10.read())\n\n    # close the stringio buffer\n    arg_10.close()\n\n    arg_12 = {\n        'magseries':{\n            'plot':arg_11,\n            'times':arg_0,\n            'mags':arg_1,\n            'errs':arg_2\n        }\n    }\n\n    return arg_12", "path": "astrobase/checkplot/pkl_utils.py", "identifier": "_pkl_magseries_plot", "docstring": "This returns the magseries plot PNG as base64, plus arrays as dict.\n\n    Parameters\n    ----------\n\n    stimes,smags,serrs : np.array\n        The mag/flux time-series arrays along with associated errors. These\n        should all have been run through nan-stripping and sigma-clipping\n        beforehand.\n\n    plotdpi : int\n        The resolution of the plot to make in DPI.\n\n    magsarefluxes : bool\n        If True, indicates the input time-series is fluxes and not mags so the\n        plot y-axis direction and range can be set appropriately.\n\n    Returns\n    -------\n\n    dict\n        A dict of the following form is returned::\n\n            {'magseries': {'plot': base64 encoded str representation of the\n                                   magnitude/flux time-series plot,\n                           'times': the `stimes` array,\n                           'mags': the `smags` array,\n                           'errs': the 'serrs' array}}\n\n        The dict is returned in this format so it can be directly incorporated\n        in a checkplotdict, using Python's dict `update()` method.", "docstring_tokens": ["This", "returns", "the", "magseries", "plot", "PNG", "as", "base64", "plus", "arrays", "as", "dict", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 256070}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/stepper/main.py#L159-L191", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "stepper part of reading options", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"Configuring StepperWrapper...\"", ")", "arg_0", ".", "ammo_file", "=", "arg_0", ".", "get_option", "(", "arg_0", ".", "OPTION_AMMOFILE", ")", "arg_0", ".", "ammo_type", "=", "arg_0", ".", "get_option", "(", "'ammo_type'", ")", "if", "arg_0", ".", "ammo_file", ":", "arg_0", ".", "ammo_file", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ".", "ammo_file", ")", "arg_0", ".", "loop_limit", "=", "arg_0", ".", "get_option", "(", "arg_0", ".", "OPTION_LOOP", ")", "arg_0", ".", "ammo_limit", "=", "arg_0", ".", "get_option", "(", "\"ammo_limit\"", ")", "arg_0", ".", "load_profile", "=", "LoadProfile", "(", "**", "arg_0", ".", "get_option", "(", "'load_profile'", ")", ")", "arg_0", ".", "instances", "=", "int", "(", "arg_0", ".", "get_option", "(", "arg_0", ".", "OPTION_INSTANCES_LIMIT", ",", "'1000'", ")", ")", "arg_0", ".", "uris", "=", "arg_0", ".", "get_option", "(", "\"uris\"", ",", "[", "]", ")", "while", "''", "in", "arg_0", ".", "uris", ":", "arg_0", ".", "uris", ".", "remove", "(", "''", ")", "arg_0", ".", "headers", "=", "arg_0", ".", "get_option", "(", "\"headers\"", ")", "arg_0", ".", "http_ver", "=", "arg_0", ".", "get_option", "(", "\"header_http\"", ")", "arg_0", ".", "autocases", "=", "arg_0", ".", "get_option", "(", "\"autocases\"", ")", "arg_0", ".", "enum_ammo", "=", "arg_0", ".", "get_option", "(", "\"enum_ammo\"", ")", "arg_0", ".", "use_caching", "=", "arg_0", ".", "get_option", "(", "\"use_caching\"", ")", "arg_0", ".", "file_cache", "=", "arg_0", ".", "get_option", "(", "'file_cache'", ")", "arg_14", "=", "arg_0", ".", "get_option", "(", "\"cache_dir\"", ")", "or", "arg_0", ".", "core", ".", "artifacts_base_dir", "arg_0", ".", "cache_dir", "=", "os", ".", "path", ".", "expanduser", "(", "arg_14", ")", "arg_0", ".", "force_stepping", "=", "arg_0", ".", "get_option", "(", "\"force_stepping\"", ")", "if", "arg_0", ".", "get_option", "(", "arg_0", ".", "OPTION_LOAD", ")", "[", "arg_0", ".", "OPTION_LOAD_TYPE", "]", "==", "'stpd_file'", ":", "arg_0", ".", "stpd", "=", "arg_0", ".", "get_option", "(", "arg_0", ".", "OPTION_LOAD", ")", "[", "arg_0", ".", "OPTION_SCHEDULE", "]", "arg_0", ".", "chosen_cases", "=", "arg_0", ".", "get_option", "(", "\"chosen_cases\"", ")", ".", "split", "(", ")", "if", "arg_0", ".", "chosen_cases", ":", "arg_0", ".", "log", ".", "info", "(", "\"chosen_cases LIMITS: %s\"", ",", "arg_0", ".", "chosen_cases", ")"], "function": "def Func(arg_0):\n        ''' stepper part of reading options '''\n        arg_0.log.info(\"Configuring StepperWrapper...\")\n        arg_0.ammo_file = arg_0.get_option(arg_0.OPTION_AMMOFILE)\n        arg_0.ammo_type = arg_0.get_option('ammo_type')\n        if arg_0.ammo_file:\n            arg_0.ammo_file = os.path.expanduser(arg_0.ammo_file)\n        arg_0.loop_limit = arg_0.get_option(arg_0.OPTION_LOOP)\n        arg_0.ammo_limit = arg_0.get_option(\"ammo_limit\")\n\n        arg_0.load_profile = LoadProfile(**arg_0.get_option('load_profile'))\n\n        arg_0.instances = int(\n            arg_0.get_option(arg_0.OPTION_INSTANCES_LIMIT, '1000'))\n        arg_0.uris = arg_0.get_option(\"uris\", [])\n        while '' in arg_0.uris:\n            arg_0.uris.remove('')\n        arg_0.headers = arg_0.get_option(\"headers\")\n        arg_0.http_ver = arg_0.get_option(\"header_http\")\n        arg_0.autocases = arg_0.get_option(\"autocases\")\n        arg_0.enum_ammo = arg_0.get_option(\"enum_ammo\")\n        arg_0.use_caching = arg_0.get_option(\"use_caching\")\n\n        arg_0.file_cache = arg_0.get_option('file_cache')\n        arg_14 = arg_0.get_option(\"cache_dir\") or arg_0.core.artifacts_base_dir\n        arg_0.cache_dir = os.path.expanduser(arg_14)\n        arg_0.force_stepping = arg_0.get_option(\"force_stepping\")\n        if arg_0.get_option(arg_0.OPTION_LOAD)[arg_0.OPTION_LOAD_TYPE] == 'stpd_file':\n            arg_0.stpd = arg_0.get_option(arg_0.OPTION_LOAD)[arg_0.OPTION_SCHEDULE]\n\n        arg_0.chosen_cases = arg_0.get_option(\"chosen_cases\").split()\n        if arg_0.chosen_cases:\n            arg_0.log.info(\"chosen_cases LIMITS: %s\", arg_0.chosen_cases)", "path": "yandextank/stepper/main.py", "identifier": "StepperWrapper.read_config", "docstring": "stepper part of reading options", "docstring_tokens": ["stepper", "part", "of", "reading", "options"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 256071}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/utils.py#L153-L194", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Get a list of TensorFlow variables by a given name scope.", "language": "python", "parameters": "(name=None, train_only=True, verbose=False)", "return_statement": "return d_vars", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ")", ":", "if", "arg_0", "is", "None", ":", "raise", "Exception", "(", "\"please input a name\"", ")", "logging", ".", "info", "(", "\"  [*] geting variables with %s\"", "%", "arg_0", ")", "if", "arg_1", ":", "arg_3", "=", "tf", ".", "trainable_variables", "(", ")", "else", ":", "arg_3", "=", "tf", ".", "global_variables", "(", ")", "arg_4", "=", "[", "var", "for", "var", "in", "arg_3", "if", "arg_0", "in", "var", ".", "name", "]", "if", "arg_2", ":", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ")", ":", "logging", ".", "info", "(", "\"  got {:3}: {:15}   {}\"", ".", "format", "(", "arg_5", ",", "arg_6", ".", "name", ",", "str", "(", "arg_6", ".", "get_shape", "(", ")", ")", ")", ")", "return", "arg_4"], "function": "def Func(arg_0=None, arg_1=True, arg_2=False):\n    \"\"\"Get a list of TensorFlow variables by a given name scope.\n\n    Parameters\n    ----------\n    name : str\n        Get the variables that contain this name.\n    train_only : boolean\n        If Ture, only get the trainable variables.\n    verbose : boolean\n        If True, print the information of all variables.\n\n    Returns\n    -------\n    list of Tensor\n        A list of TensorFlow variables\n\n    Examples\n    --------\n    >>> import tensorlayer as tl\n    >>> dense_vars = tl.layers.Func('dense', True, True)\n\n    \"\"\"\n    if arg_0 is None:\n        raise Exception(\"please input a name\")\n\n    logging.info(\"  [*] geting variables with %s\" % arg_0)\n\n    # tvar = tf.trainable_variables() if train_only else tf.all_variables()\n    if arg_1:\n        arg_3 = tf.trainable_variables()\n\n    else:\n        arg_3 = tf.global_variables()\n\n    arg_4 = [var for var in arg_3 if arg_0 in var.name]\n\n    if arg_2:\n        for arg_5, arg_6 in enumerate(arg_4):\n            logging.info(\"  got {:3}: {:15}   {}\".format(arg_5, arg_6.name, str(arg_6.get_shape())))\n\n    return arg_4", "path": "tensorlayer/layers/utils.py", "identifier": "get_variables_with_name", "docstring": "Get a list of TensorFlow variables by a given name scope.\n\n    Parameters\n    ----------\n    name : str\n        Get the variables that contain this name.\n    train_only : boolean\n        If Ture, only get the trainable variables.\n    verbose : boolean\n        If True, print the information of all variables.\n\n    Returns\n    -------\n    list of Tensor\n        A list of TensorFlow variables\n\n    Examples\n    --------\n    >>> import tensorlayer as tl\n    >>> dense_vars = tl.layers.get_variables_with_name('dense', True, True)", "docstring_tokens": ["Get", "a", "list", "of", "TensorFlow", "variables", "by", "a", "given", "name", "scope", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 256072}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L758-L787", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Check if the element is into the database.", "language": "python", "parameters": "(self)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "(", "arg_0", ".", "_authorization", "(", ")", "and", "PyFunceble", ".", "INTERN", "[", "\"file_to_test\"", "]", "in", "PyFunceble", ".", "INTERN", "[", "\"whois_db\"", "]", "and", "PyFunceble", ".", "INTERN", "[", "\"to_test\"", "]", "in", "PyFunceble", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "PyFunceble", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n        \"\"\"\n        Check if the element is into the database.\n        \"\"\"\n\n        if (\n            arg_0._authorization()\n            and PyFunceble.INTERN[\"file_to_test\"] in PyFunceble.INTERN[\"whois_db\"]\n            and PyFunceble.INTERN[\"to_test\"]\n            in PyFunceble.INTERN[\"whois_db\"][PyFunceble.INTERN[\"file_to_test\"]]\n        ):\n            # * We are authorized to work.\n            # and\n            # * The given file path exist in the database.\n            # and\n            # * The element we are testing is in the database related to the\n            # given file path.\n\n            # We return True, the element we are testing is into the database.\n            return True\n\n        # * We are not authorized to work.\n        # or\n        # * The given file path does not exist in the database.\n        # or\n        # * The element we are testing is not in the database related to the\n        # given file path.\n\n        # We return False,the element we are testing is not into the database.\n        return False", "path": "PyFunceble/database.py", "identifier": "Whois.is_in_database", "docstring": "Check if the element is into the database.", "docstring_tokens": ["Check", "if", "the", "element", "is", "into", "the", "database", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 256073}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/config.py#L44-L49", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "load config files", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "statemgr_config", ".", "set_state_locations", "(", "arg_0", ".", "configs", "[", "STATEMGRS_KEY", "]", ")", "if", "EXTRA_LINKS_KEY", "in", "arg_0", ".", "configs", ":", "for", "arg_1", "in", "arg_0", ".", "configs", "[", "EXTRA_LINKS_KEY", "]", ":", "arg_0", ".", "extra_links", ".", "append", "(", "arg_0", ".", "validate_extra_link", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"load config files\"\"\"\n    arg_0.statemgr_config.set_state_locations(arg_0.configs[STATEMGRS_KEY])\n    if EXTRA_LINKS_KEY in arg_0.configs:\n      for arg_1 in arg_0.configs[EXTRA_LINKS_KEY]:\n        arg_0.extra_links.append(arg_0.validate_extra_link(arg_1))", "path": "heron/tools/tracker/src/python/config.py", "identifier": "Config.load_configs", "docstring": "load config files", "docstring_tokens": ["load", "config", "files"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256074}
{"url": "https://github.com/ptrus/suffix-trees/blob/e7439c93a7b895523fad36c8c65a781710320b57/suffix_trees/STree.py#L124-L132", "sha": "e7439c93a7b895523fad36c8c65a781710320b57", "docstring_summary": "Helper method that labels the nodes of GST with indexes of strings\n        found in their descendants.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "is_leaf", "(", ")", ":", "arg_2", "=", "{", "arg_0", ".", "_get_word_start_index", "(", "arg_1", ".", "idx", ")", "}", "else", ":", "arg_2", "=", "{", "n", "for", "ns", "in", "arg_1", ".", "transition_links", "for", "n", "in", "ns", "[", "0", "]", ".", "generalized_idxs", "}", "arg_1", ".", "generalized_idxs", "=", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Helper method that labels the nodes of GST with indexes of strings\n        found in their descendants.\n        \"\"\"\n        if arg_1.is_leaf():\n            arg_2 = {arg_0._get_word_start_index(arg_1.idx)}\n        else:\n            arg_2 = {n for ns in arg_1.transition_links for n in ns[0].generalized_idxs}\n        arg_1.generalized_idxs = arg_2", "path": "suffix_trees/STree.py", "identifier": "STree._label_generalized", "docstring": "Helper method that labels the nodes of GST with indexes of strings\n        found in their descendants.", "docstring_tokens": ["Helper", "method", "that", "labels", "the", "nodes", "of", "GST", "with", "indexes", "of", "strings", "found", "in", "their", "descendants", "."], "nwo": "ptrus/suffix-trees", "score": 0.5973428860454929, "idx": 256075}
{"url": "https://github.com/nicfit/nicfit.py/blob/8313f8edbc5e7361ddad496d6d818324b5236c7a/nicfit/shell/command.py#L18-L47", "sha": "8313f8edbc5e7361ddad496d6d818324b5236c7a", "docstring_summary": "Get command regex string and completer dict.", "language": "python", "parameters": "(self, cmd_grp=None)", "return_statement": "return tuple([\n            rf\"\"\"(?P<{cmd_grp}>{names}){opts_re}{help_re}\"\"\",\n            completers\n        ])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "\"cmd\"", "arg_2", "=", "(", "\"-h\"", ",", "\"--help\"", ")", "arg_3", "=", "arg_0", ".", "name", "(", ")", "arg_4", "=", "\"|\"", ".", "join", "(", "[", "re", ".", "escape", "(", "arg_3", ")", "]", "+", "[", "re", ".", "escape", "(", "arg_7", ")", "for", "arg_7", "in", "arg_0", ".", "aliases", "(", ")", "]", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_0", ".", "parser", ".", "_actions", ":", "arg_5", "+=", "[", "arg_7", "for", "arg_7", "in", "arg_6", ".", "option_strings", "if", "arg_7", "not", "in", "arg_2", "]", "arg_8", "=", "\"|\"", ".", "join", "(", "[", "re", ".", "escape", "(", "o", ")", "for", "o", "in", "arg_5", "]", ")", "if", "arg_8", ":", "arg_8", "=", "rf\"(\\s+(?P<{cmd_grp}_opts>{opts_re}))*\"", "arg_9", "=", "\"|\"", ".", "join", "(", "[", "re", ".", "escape", "(", "o", ")", "for", "o", "in", "arg_2", "]", ")", "arg_9", "=", "rf\"(\\s+(?P<HELP_OPTS>{help_re}))*\"", "arg_10", "=", "{", "}", "if", "arg_8", ":", "arg_10", "[", "f\"{cmd_grp}_opts\"", "]", "=", "WordCompleter", "(", "arg_5", ")", "return", "tuple", "(", "[", "rf\"\"\"(?P<{cmd_grp}>{names}){opts_re}{help_re}\"\"\"", ",", "arg_10", "]", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Get command regex string and completer dict.\"\"\"\n        arg_1 = arg_1 or \"cmd\"\n        arg_2 = (\"-h\", \"--help\")\n\n        arg_3 = arg_0.name()\n        arg_4 = \"|\".join([re.escape(arg_3)] +\n                         [re.escape(arg_7) for arg_7 in arg_0.aliases()])\n\n        arg_5 = []\n        for arg_6 in arg_0.parser._actions:\n            arg_5 += [arg_7 for arg_7 in arg_6.option_strings\n                        if arg_7 not in arg_2]\n\n        arg_8 = \"|\".join([re.escape(o) for o in arg_5])\n        if arg_8:\n            arg_8 = rf\"(\\s+(?P<{cmd_grp}_opts>{opts_re}))*\"\n\n        arg_9 = \"|\".join([re.escape(o) for o in arg_2])\n        arg_9 = rf\"(\\s+(?P<HELP_OPTS>{help_re}))*\"\n\n        arg_10 = {}\n        if arg_8:\n            arg_10[f\"{cmd_grp}_opts\"] = WordCompleter(arg_5)\n        # Singe Help completer added elsewhere\n\n        return tuple([\n            rf\"\"\"(?P<{cmd_grp}>{names}){opts_re}{help_re}\"\"\",\n            arg_10\n        ])", "path": "nicfit/shell/command.py", "identifier": "_CommandCompleterMixin._cmdRegex", "docstring": "Get command regex string and completer dict.", "docstring_tokens": ["Get", "command", "regex", "string", "and", "completer", "dict", "."], "nwo": "nicfit/nicfit.py", "score": 0.09252797783733271, "idx": 256076}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/learner_data.py#L92-L134", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Iterate over each learner and unlink inactive SAP channel learners.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "client", ".", "get_inactive_sap_learners", "(", ")", "arg_2", "=", "arg_0", ".", "enterprise_configuration", ".", "enterprise_customer", "if", "not", "arg_1", ":", "LOGGER", ".", "info", "(", "'Enterprise customer {%s} has no SAPSF inactive learners'", ",", "arg_2", ".", "name", ")", "return", "arg_3", "=", "arg_2", ".", "identity_provider", "arg_4", "=", "get_identity_provider", "(", "arg_3", ")", "if", "not", "arg_4", ":", "LOGGER", ".", "info", "(", "'Enterprise customer {%s} has no associated identity provider'", ",", "arg_2", ".", "name", ")", "return", "None", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "get_user_from_social_auth", "(", "arg_4", ",", "arg_5", "[", "'studentID'", "]", ")", "if", "not", "arg_6", ":", "continue", "try", ":", "EnterpriseCustomerUser", ".", "objects", ".", "unlink_user", "(", "arg_2", "=", "arg_2", ",", "user_email", "=", "arg_6", ".", "email", ",", ")", "except", "(", "EnterpriseCustomerUser", ".", "DoesNotExist", ",", "PendingEnterpriseCustomerUser", ".", "DoesNotExist", ")", ":", "LOGGER", ".", "info", "(", "'Learner with email {%s} is not associated with Enterprise Customer {%s}'", ",", "arg_6", ".", "email", ",", "arg_2", ".", "name", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Iterate over each learner and unlink inactive SAP channel learners.\n\n        This method iterates over each enterprise learner and unlink learner\n        from the enterprise if the learner is marked inactive in the related\n        integrated channel.\n        \"\"\"\n        arg_1 = arg_0.client.get_inactive_sap_learners()\n        arg_2 = arg_0.enterprise_configuration.enterprise_customer\n        if not arg_1:\n            LOGGER.info(\n                'Enterprise customer {%s} has no SAPSF inactive learners',\n                arg_2.name\n            )\n            return\n\n        arg_3 = arg_2.identity_provider\n        arg_4 = get_identity_provider(arg_3)\n        if not arg_4:\n            LOGGER.info(\n                'Enterprise customer {%s} has no associated identity provider',\n                arg_2.name\n            )\n            return None\n\n        for arg_5 in arg_1:\n            arg_6 = get_user_from_social_auth(arg_4, arg_5['studentID'])\n            if not arg_6:\n                continue\n\n            try:\n                # Unlink user email from related Enterprise Customer\n                EnterpriseCustomerUser.objects.unlink_user(\n                    arg_2=arg_2,\n                    user_email=arg_6.email,\n                )\n            except (EnterpriseCustomerUser.DoesNotExist, PendingEnterpriseCustomerUser.DoesNotExist):\n                LOGGER.info(\n                    'Learner with email {%s} is not associated with Enterprise Customer {%s}',\n                    arg_6.email,\n                    arg_2.name\n                )", "path": "integrated_channels/sap_success_factors/exporters/learner_data.py", "identifier": "SapSuccessFactorsLearnerManger.unlink_learners", "docstring": "Iterate over each learner and unlink inactive SAP channel learners.\n\n        This method iterates over each enterprise learner and unlink learner\n        from the enterprise if the learner is marked inactive in the related\n        integrated channel.", "docstring_tokens": ["Iterate", "over", "each", "learner", "and", "unlink", "inactive", "SAP", "channel", "learners", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256077}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/dingding_hook.py#L65-L74", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get Dingding endpoint for sending message.", "language": "python", "parameters": "(self)", "return_statement": "return 'robot/send?access_token={}'.format(token)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_connection", "(", "arg_0", ".", "http_conn_id", ")", "arg_2", "=", "arg_1", ".", "password", "if", "not", "arg_2", ":", "raise", "AirflowException", "(", "'Dingding token is requests but get nothing, '", "'check you conn_id configuration.'", ")", "return", "'robot/send?access_token={}'", ".", "format", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get Dingding endpoint for sending message.\n        \"\"\"\n        arg_1 = arg_0.get_connection(arg_0.http_conn_id)\n        arg_2 = arg_1.password\n        if not arg_2:\n            raise AirflowException('Dingding token is requests but get nothing, '\n                                   'check you conn_id configuration.')\n        return 'robot/send?access_token={}'.format(arg_2)", "path": "airflow/contrib/hooks/dingding_hook.py", "identifier": "DingdingHook._get_endpoint", "docstring": "Get Dingding endpoint for sending message.", "docstring_tokens": ["Get", "Dingding", "endpoint", "for", "sending", "message", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256078}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L911-L924", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Give the ref annotation before a time. If an annotation overlaps\n        with ``time`` that annotation will be returned.", "language": "python", "parameters": "(self, id_tier, time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_ref_annotation_data_between_times", "(", "arg_1", ",", "0", ",", "arg_2", ")", "if", "arg_3", ":", "return", "[", "max", "(", "arg_3", ",", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ")", "]", "else", ":", "return", "[", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Give the ref annotation before a time. If an annotation overlaps\n        with ``time`` that annotation will be returned.\n\n        :param str id_tier: Name of the tier.\n        :param int time: Time to get the annotation before.\n        :returns: Annotation before that time in a list\n        :raises KeyError: If the tier is non existent.\n        \"\"\"\n        arg_3 = arg_0.get_ref_annotation_data_between_times(arg_1, 0, arg_2)\n        if arg_3:\n            return [max(arg_3, key=lambda x: x[0])]\n        else:\n            return []", "path": "pympi/Elan.py", "identifier": "Eaf.get_ref_annotation_data_before_time", "docstring": "Give the ref annotation before a time. If an annotation overlaps\n        with ``time`` that annotation will be returned.\n\n        :param str id_tier: Name of the tier.\n        :param int time: Time to get the annotation before.\n        :returns: Annotation before that time in a list\n        :raises KeyError: If the tier is non existent.", "docstring_tokens": ["Give", "the", "ref", "annotation", "before", "a", "time", ".", "If", "an", "annotation", "overlaps", "with", "time", "that", "annotation", "will", "be", "returned", "."], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 256079}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/libraries/dagster-gcp/dagster_gcp/types.py#L96-L112", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Tables must be of form \"project.dataset.table\" or \"dataset.table\"", "language": "python", "parameters": "(config_value)", "return_statement": "return re.match(\n        r'^'\n        + RE_PROJECT  #  project\n        + r'\\.'  #       .\n        + RE_DS_TABLE  # dataset\n        + r'\\.'  #       .\n        + RE_DS_TABLE  # table\n        + r'$|^'  #      -- OR --\n        + RE_DS_TABLE  # dataset\n        + r'\\.'  #       .\n        + RE_DS_TABLE  # table\n        + r'$',\n        config_value,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "re", ".", "match", "(", "r'^'", "+", "RE_PROJECT", "+", "r'\\.'", "+", "RE_DS_TABLE", "+", "r'\\.'", "+", "RE_DS_TABLE", "+", "r'$|^'", "+", "RE_DS_TABLE", "+", "r'\\.'", "+", "RE_DS_TABLE", "+", "r'$'", ",", "arg_0", ",", ")"], "function": "def Func(arg_0):\n    '''Tables must be of form \"project.dataset.table\" or \"dataset.table\"\n    '''\n    return re.match(\n        r'^'\n        + RE_PROJECT  #  project\n        + r'\\.'  #       .\n        + RE_DS_TABLE  # dataset\n        + r'\\.'  #       .\n        + RE_DS_TABLE  # table\n        + r'$|^'  #      -- OR --\n        + RE_DS_TABLE  # dataset\n        + r'\\.'  #       .\n        + RE_DS_TABLE  # table\n        + r'$',\n        arg_0,\n    )", "path": "python_modules/libraries/dagster-gcp/dagster_gcp/types.py", "identifier": "_is_valid_table", "docstring": "Tables must be of form \"project.dataset.table\" or \"dataset.table\"", "docstring_tokens": ["Tables", "must", "be", "of", "form", "project", ".", "dataset", ".", "table", "or", "dataset", ".", "table"], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 256080}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L115-L146", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Used to verify that h2o-python module and the H2O server are compatible with each other.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "from", ".", "__init__", "import", "__version__", "as", "arg_2", "arg_0", "=", "h2oconn", ".", "cluster", "if", "not", "arg_0", ":", "raise", "H2OConnectionError", "(", "\"Connection not initialized. Did you run h2o.connect()?\"", ")", "arg_1", "=", "arg_0", ".", "version", "if", "arg_2", "==", "\"SUBST_PROJECT_VERSION\"", ":", "arg_2", "=", "\"UNKNOWN\"", "if", "str", "(", "arg_1", ")", "!=", "str", "(", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "branch_name", "arg_4", "=", "arg_0", ".", "build_number", "if", "arg_4", "is", "None", "or", "arg_4", "==", "\"unknown\"", ":", "raise", "H2OConnectionError", "(", "\"Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. \"", "\"Upgrade H2O and h2o-Python to latest stable version - \"", "\"http://h2o-release.s3.amazonaws.com/h2o/latest_stable.html\"", "\"\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "elif", "arg_4", "==", "\"99999\"", ":", "raise", "H2OConnectionError", "(", "\"Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. \"", "\"This is a developer build, please contact your developer.\"", "\"\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "else", ":", "raise", "H2OConnectionError", "(", "\"Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. \"", "\"Install the matching h2o-Python version from - \"", "\"http://h2o-release.s3.amazonaws.com/h2o/{2}/{3}/index.html.\"", "\"\"", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "if", "arg_0", ".", "build_too_old", ":", "print", "(", "\"Warning: Your H2O cluster version is too old ({})! Please download and install the latest \"", "\"version from http://h2o.ai/download/\"", ".", "format", "(", "arg_0", ".", "build_age", ")", ")"], "function": "def Func():\n    \"\"\"Used to verify that h2o-python module and the H2O server are compatible with each other.\"\"\"\n    from .__init__ import __version__ as arg_2\n    arg_0 = h2oconn.cluster\n    if not arg_0:\n        raise H2OConnectionError(\"Connection not initialized. Did you run h2o.connect()?\")\n    arg_1 = arg_0.version\n    if arg_2 == \"SUBST_PROJECT_VERSION\": arg_2 = \"UNKNOWN\"\n    if str(arg_1) != str(arg_2):\n        arg_3 = arg_0.branch_name\n        arg_4 = arg_0.build_number\n        if arg_4 is None or arg_4 == \"unknown\":\n            raise H2OConnectionError(\n                \"Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. \"\n                \"Upgrade H2O and h2o-Python to latest stable version - \"\n                \"http://h2o-release.s3.amazonaws.com/h2o/latest_stable.html\"\n                \"\".format(arg_1, arg_2))\n        elif arg_4 == \"99999\":\n            raise H2OConnectionError(\n                \"Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. \"\n                \"This is a developer build, please contact your developer.\"\n                \"\".format(arg_1, arg_2))\n        else:\n            raise H2OConnectionError(\n                \"Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. \"\n                \"Install the matching h2o-Python version from - \"\n                \"http://h2o-release.s3.amazonaws.com/h2o/{2}/{3}/index.html.\"\n                \"\".format(arg_1, arg_2, arg_3, arg_4))\n    # Check age of the install\n    if arg_0.build_too_old:\n        print(\"Warning: Your H2O cluster version is too old ({})! Please download and install the latest \"\n              \"version from http://h2o.ai/download/\".format(arg_0.build_age))", "path": "h2o-py/h2o/h2o.py", "identifier": "version_check", "docstring": "Used to verify that h2o-python module and the H2O server are compatible with each other.", "docstring_tokens": ["Used", "to", "verify", "that", "h2o", "-", "python", "module", "and", "the", "H2O", "server", "are", "compatible", "with", "each", "other", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 256081}
{"url": "https://github.com/ecometrica/grandfatherson/blob/b166e4e44887960c3066ebd28eecadfae19561e1/grandfatherson/filters.py#L124-L129", "sha": "b166e4e44887960c3066ebd28eecadfae19561e1", "docstring_summary": "Return a datetime with the same value as ``dt``, to a\n        resolution of days.", "language": "python", "parameters": "(cls, dt, **options)", "return_statement": "return dt.replace(hour=0, minute=0, second=0, microsecond=0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_1", ".", "replace", "(", "hour", "=", "0", ",", "minute", "=", "0", ",", "second", "=", "0", ",", "microsecond", "=", "0", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Return a datetime with the same value as ``dt``, to a\n        resolution of days.\n        \"\"\"\n        return arg_1.replace(hour=0, minute=0, second=0, microsecond=0)", "path": "grandfatherson/filters.py", "identifier": "Days.mask", "docstring": "Return a datetime with the same value as ``dt``, to a\n        resolution of days.", "docstring_tokens": ["Return", "a", "datetime", "with", "the", "same", "value", "as", "dt", "to", "a", "resolution", "of", "days", "."], "nwo": "ecometrica/grandfatherson", "score": 0.19800877986197146, "idx": 256082}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L230-L239", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Remote has closed the session used by this link.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_endpoint_state", "&", "proton", ".", "Endpoint", ".", "REMOTE_ACTIVE", ":", "arg_0", ".", "_process_remote_state", "(", ")", "elif", "arg_0", ".", "_endpoint_state", "&", "proton", ".", "Endpoint", ".", "REMOTE_UNINIT", ":", "arg_0", ".", "_failed", "=", "True", "arg_0", ".", "_link_failed", "(", "\"Parent session closed.\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Remote has closed the session used by this link.\"\"\"\n        # if link not already closed:\n        if arg_0._endpoint_state & proton.Endpoint.REMOTE_ACTIVE:\n            # simulate close received\n            arg_0._process_remote_state()\n        elif arg_0._endpoint_state & proton.Endpoint.REMOTE_UNINIT:\n            # locally created link, will never come up\n            arg_0._failed = True\n            arg_0._link_failed(\"Parent session closed.\")", "path": "pyngus/link.py", "identifier": "_Link._session_closed", "docstring": "Remote has closed the session used by this link.", "docstring_tokens": ["Remote", "has", "closed", "the", "session", "used", "by", "this", "link", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 256083}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L111-L124", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Load a skeleton definition from a file.", "language": "python", "parameters": "(self, source, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "hasattr", "(", "arg_1", ",", "'endswith'", ")", "and", "arg_1", ".", "lower", "(", ")", ".", "endswith", "(", "'.asf'", ")", ":", "arg_0", ".", "Func_asf", "(", "arg_1", ",", "**", "arg_2", ")", "else", ":", "arg_0", ".", "Func_skel", "(", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        '''Load a skeleton definition from a file.\n\n        Parameters\n        ----------\n        source : str or file\n            A filename or file-like object that contains text information\n            describing a skeleton. See :class:`pagoda.parser.Parser` for more\n            information about the format of the text file.\n        '''\n        if hasattr(arg_1, 'endswith') and arg_1.lower().endswith('.asf'):\n            arg_0.Func_asf(arg_1, **arg_2)\n        else:\n            arg_0.Func_skel(arg_1, **arg_2)", "path": "pagoda/skeleton.py", "identifier": "Skeleton.load", "docstring": "Load a skeleton definition from a file.\n\n        Parameters\n        ----------\n        source : str or file\n            A filename or file-like object that contains text information\n            describing a skeleton. See :class:`pagoda.parser.Parser` for more\n            information about the format of the text file.", "docstring_tokens": ["Load", "a", "skeleton", "definition", "from", "a", "file", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 256084}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/vertica_hook.py#L35-L53", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns verticaql connection object", "language": "python", "parameters": "(self)", "return_statement": "return conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "Funcection", "(", "arg_0", ".", "vertica_conn_id", ")", "arg_2", "=", "{", "\"user\"", ":", "arg_1", ".", "login", ",", "\"password\"", ":", "arg_1", ".", "password", "or", "''", ",", "\"database\"", ":", "arg_1", ".", "schema", ",", "\"host\"", ":", "arg_1", ".", "host", "or", "'localhost'", "}", "if", "not", "arg_1", ".", "port", ":", "arg_2", "[", "\"port\"", "]", "=", "5433", "else", ":", "arg_2", "[", "\"port\"", "]", "=", "int", "(", "arg_1", ".", "port", ")", "arg_1", "=", "connect", "(", "**", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns verticaql connection object\n        \"\"\"\n        arg_1 = arg_0.Funcection(arg_0.vertica_conn_id)\n        arg_2 = {\n            \"user\": arg_1.login,\n            \"password\": arg_1.password or '',\n            \"database\": arg_1.schema,\n            \"host\": arg_1.host or 'localhost'\n        }\n\n        if not arg_1.port:\n            arg_2[\"port\"] = 5433\n        else:\n            arg_2[\"port\"] = int(arg_1.port)\n\n        arg_1 = connect(**arg_2)\n        return arg_1", "path": "airflow/contrib/hooks/vertica_hook.py", "identifier": "VerticaHook.get_conn", "docstring": "Returns verticaql connection object", "docstring_tokens": ["Returns", "verticaql", "connection", "object"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256085}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/cli.py#L106-L122", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Process stats aggregations.", "language": "python", "parameters": "(aggregation_types=None,\n                          start_date=None, end_date=None,\n                          update_bookmark=False, eager=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "arg_0", "=", "(", "arg_0", "or", "list", "(", "current_stats", ".", "enabled_aggregations", ")", ")", "if", "arg_4", ":", "aggregate_events", ".", "apply", "(", "(", "arg_0", ",", ")", ",", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ",", "throw", "=", "True", ")", "click", ".", "secho", "(", "'Aggregations processed successfully.'", ",", "fg", "=", "'green'", ")", "else", ":", "aggregate_events", ".", "delay", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "click", ".", "secho", "(", "'Aggregations processing task sent...'", ",", "fg", "=", "'yellow'", ")"], "function": "def Func(arg_0=None,\n                          arg_1=None, arg_2=None,\n                          arg_3=False, arg_4=False):\n    \"\"\"Process stats aggregations.\"\"\"\n    arg_0 = (arg_0 or\n                         list(current_stats.enabled_aggregations))\n    if arg_4:\n        aggregate_events.apply(\n            (arg_0,),\n            dict(arg_1=arg_1, arg_2=arg_2,\n                 arg_3=arg_3),\n            throw=True)\n        click.secho('Aggregations processed successfully.', fg='green')\n    else:\n        aggregate_events.delay(\n            arg_0, arg_1=arg_1, arg_2=arg_2)\n        click.secho('Aggregations processing task sent...', fg='yellow')", "path": "invenio_stats/cli.py", "identifier": "_aggregations_process", "docstring": "Process stats aggregations.", "docstring_tokens": ["Process", "stats", "aggregations", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 256086}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/provider.py#L124-L137", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Called when services are discovered for a device.", "language": "python", "parameters": "(self, peripheral, services)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "logger", ".", "debug", "(", "'peripheral_didDiscoverServices called'", ")", "for", "arg_3", "in", "arg_1", ".", "services", "(", ")", ":", "if", "service_list", "(", ")", ".", "get", "(", "arg_3", ")", "is", "None", ":", "service_list", "(", ")", ".", "add", "(", "arg_3", ",", "CoreBluetoothGattService", "(", "arg_3", ")", ")", "arg_1", ".", "discoverCharacteristics_forService_", "(", "None", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Called when services are discovered for a device.\"\"\"\n        logger.debug('peripheral_didDiscoverServices called')\n        # Make sure the discovered services are added to the list of known\n        # services, and kick off characteristic discovery for each one.\n        # NOTE: For some reason the services parameter is never set to a good\n        # value, instead you must query peripheral.services() to enumerate the\n        # discovered services.\n        for arg_3 in arg_1.services():\n            if service_list().get(arg_3) is None:\n                service_list().add(arg_3, CoreBluetoothGattService(arg_3))\n            # Kick off characteristic discovery for this service.  Just discover\n            # all characteristics for now.\n            arg_1.discoverCharacteristics_forService_(None, arg_3)", "path": "Adafruit_BluefruitLE/corebluetooth/provider.py", "identifier": "CentralDelegate.peripheral_didDiscoverServices_", "docstring": "Called when services are discovered for a device.", "docstring_tokens": ["Called", "when", "services", "are", "discovered", "for", "a", "device", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 256087}
{"url": "https://github.com/brycedrennan/random-line-access/blob/ad46749252ffbe5885f2f001f5abb5a180939268/randomlineaccess/index.py#L94-L98", "sha": "ad46749252ffbe5885f2f001f5abb5a180939268", "docstring_summary": "Return an open file-object to the index file", "language": "python", "parameters": "(self, index_ratio, index_width)", "return_statement": "return IndexFile(str(self.index_path))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "index_path", ".", "exists", "(", ")", "or", "not", "arg_0", ".", "filepath", ".", "stat", "(", ")", ".", "st_mtime", "==", "arg_0", ".", "index_path", ".", "stat", "(", ")", ".", "st_mtime", ":", "create_index", "(", "arg_0", ".", "filepath", ",", "arg_0", ".", "index_path", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "IndexFile", "(", "str", "(", "arg_0", ".", "index_path", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return an open file-object to the index file\"\"\"\n        if not arg_0.index_path.exists() or not arg_0.filepath.stat().st_mtime == arg_0.index_path.stat().st_mtime:\n            create_index(arg_0.filepath, arg_0.index_path, arg_1=arg_1, arg_2=arg_2)\n        return IndexFile(str(arg_0.index_path))", "path": "randomlineaccess/index.py", "identifier": "IndexedOpen.get_or_create_index", "docstring": "Return an open file-object to the index file", "docstring_tokens": ["Return", "an", "open", "file", "-", "object", "to", "the", "index", "file"], "nwo": "brycedrennan/random-line-access", "score": 0.09252797783733271, "idx": 256088}
{"url": "https://github.com/redapple/parslepy/blob/a8bc4c0592824459629018c8f4c6ae3dad6cc3cc/parslepy/base.py#L338-L429", "sha": "a8bc4c0592824459629018c8f4c6ae3dad6cc3cc", "docstring_summary": "Build part of the abstract Parsley extraction tree", "language": "python", "parameters": "(self, parselet_node, level=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "if", "arg_0", ".", "DEBUG", ":", "arg_3", "=", "\"\"", ".", "join", "(", "[", "\"    \"", "for", "x", "in", "range", "(", "arg_2", ")", "]", ")", "if", "arg_0", ".", "DEBUG", ":", "print", "(", "arg_3", ",", "\"%s::compile(%s)\"", "%", "(", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_1", ")", ")", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_4", "=", "ParsleyNode", "(", ")", "for", "arg_5", ",", "arg_6", "in", "list", "(", "arg_1", ".", "items", "(", ")", ")", ":", "try", ":", "arg_7", "=", "arg_0", ".", "REGEX_PARSELET_KEY", ".", "match", "(", "arg_5", ")", "if", "not", "arg_7", ":", "if", "arg_0", ".", "DEBUG", ":", "print", "(", "arg_3", ",", "\"could not parse key\"", ",", "arg_5", ")", "raise", "InvalidKeySyntax", "(", "arg_5", ")", "except", ":", "raise", "InvalidKeySyntax", "(", "\"Key %s is not valid\"", "%", "arg_5", ")", "arg_8", "=", "arg_7", ".", "group", "(", "'key'", ")", "arg_9", "=", "True", "arg_10", "=", "arg_7", ".", "group", "(", "'operator'", ")", "if", "arg_10", "==", "'?'", ":", "arg_9", "=", "False", "arg_11", "=", "arg_7", ".", "group", "(", "'scope'", ")", "if", "isinstance", "(", "arg_6", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_6", "=", "arg_6", "[", "0", "]", "arg_12", "=", "True", "else", ":", "arg_12", "=", "False", "try", ":", "arg_13", "=", "ParsleyContext", "(", "arg_8", ",", "arg_10", "=", "arg_10", ",", "required", "=", "arg_9", ",", "arg_11", "=", "arg_0", ".", "selector_handler", ".", "make", "(", "arg_11", ")", "if", "arg_11", "else", "None", ",", "arg_12", "=", "arg_12", ")", "except", "SyntaxError", ":", "if", "arg_0", ".", "DEBUG", ":", "print", "(", "\"Invalid scope:\"", ",", "arg_5", ",", "arg_11", ")", "raise", "if", "arg_0", ".", "DEBUG", ":", "print", "(", "arg_3", ",", "\"current context:\"", ",", "arg_13", ")", "try", ":", "arg_14", "=", "arg_0", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", "+", "1", ")", "except", "SyntaxError", ":", "if", "arg_0", ".", "DEBUG", ":", "print", "(", "\"Invalid value: \"", ",", "arg_6", ")", "raise", "except", ":", "raise", "if", "arg_0", ".", "DEBUG", ":", "print", "(", "arg_3", ",", "\"child tree:\"", ",", "arg_14", ")", "arg_4", "[", "arg_13", "]", "=", "arg_14", "return", "arg_4", "elif", "isstr", "(", "arg_1", ")", ":", "return", "arg_0", ".", "selector_handler", ".", "make", "(", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "\"Unsupported type(%s) for Parselet node <%s>\"", "%", "(", "type", "(", "arg_1", ")", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        \"\"\"\n        Build part of the abstract Parsley extraction tree\n\n        Arguments:\n        parselet_node (dict) -- part of the Parsley tree to compile\n                                (can be the root dict/node)\n        level (int)          -- current recursion depth (used for debug)\n        \"\"\"\n\n        if arg_0.DEBUG:\n            arg_3 = \"\".join([\"    \" for x in range(arg_2)])\n\n        if arg_0.DEBUG:\n            print(arg_3, \"%s::compile(%s)\" % (\n                arg_0.__class__.__name__, arg_1))\n\n        if isinstance(arg_1, dict):\n            arg_4 = ParsleyNode()\n            for arg_5, arg_6 in list(arg_1.items()):\n\n                # we parse the key raw elements but without much\n                # interpretation (which is done by the SelectorHandler)\n                try:\n                    arg_7 = arg_0.REGEX_PARSELET_KEY.match(arg_5)\n                    if not arg_7:\n                        if arg_0.DEBUG:\n                            print(arg_3, \"could not parse key\", arg_5)\n                        raise InvalidKeySyntax(arg_5)\n                except:\n                    raise InvalidKeySyntax(\"Key %s is not valid\" % arg_5)\n\n                arg_8 = arg_7.group('key')\n                # by default, fields are required\n                arg_9 = True\n                arg_10 = arg_7.group('operator')\n                if arg_10 == '?':\n                    arg_9 = False\n                # FIXME: \"!\" operator not supported (complete array)\n                arg_11 = arg_7.group('scope')\n\n                # example: get list of H3 tags\n                # { \"titles\": [\"h3\"] }\n                # FIXME: should we support multiple selectors in list?\n                #        e.g. { \"titles\": [\"h1\", \"h2\", \"h3\", \"h4\"] }\n                if isinstance(arg_6, (list, tuple)):\n                    arg_6 = arg_6[0]\n                    arg_12 = True\n                else:\n                    arg_12 = False\n\n                # keys in the abstract Parsley trees are of type `ParsleyContext`\n                try:\n                    arg_13 = ParsleyContext(\n                        arg_8,\n                        arg_10=arg_10,\n                        required=arg_9,\n                        arg_11=arg_0.selector_handler.make(arg_11) if arg_11 else None,\n                        arg_12=arg_12)\n                except SyntaxError:\n                    if arg_0.DEBUG:\n                        print(\"Invalid scope:\", arg_5, arg_11)\n                    raise\n\n                if arg_0.DEBUG:\n                    print(arg_3, \"current context:\", arg_13)\n\n                # go deeper in the Parsley tree...\n                try:\n                    arg_14 = arg_0.Func(arg_6, arg_2=arg_2+1)\n                except SyntaxError:\n                    if arg_0.DEBUG:\n                        print(\"Invalid value: \", arg_6)\n                    raise\n                except:\n                    raise\n\n                if arg_0.DEBUG:\n                    print(arg_3, \"child tree:\", arg_14)\n\n                arg_4[arg_13] = arg_14\n\n            return arg_4\n\n        # a string leaf should match some kind of selector,\n        # let the selector handler deal with it\n        elif isstr(arg_1):\n            return arg_0.selector_handler.make(arg_1)\n        else:\n            raise ValueError(\n                    \"Unsupported type(%s) for Parselet node <%s>\" % (\n                        type(arg_1), arg_1))", "path": "parslepy/base.py", "identifier": "Parselet._compile", "docstring": "Build part of the abstract Parsley extraction tree\n\n        Arguments:\n        parselet_node (dict) -- part of the Parsley tree to compile\n                                (can be the root dict/node)\n        level (int)          -- current recursion depth (used for debug)", "docstring_tokens": ["Build", "part", "of", "the", "abstract", "Parsley", "extraction", "tree"], "nwo": "redapple/parslepy", "score": 0.18261785916548806, "idx": 256089}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/model.py#L191-L195", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Clear values and nodes calculated from `source`.", "language": "python", "parameters": "(self, source, clear_source=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "cellgraph", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "del", "arg_4", "[", "OBJ", "]", ".", "data", "[", "arg_4", "[", "KEY", "]", "]"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Clear values and nodes calculated from `source`.\"\"\"\n        arg_3 = arg_0.cellgraph.Func(arg_1, arg_2)\n        for arg_4 in arg_3:\n            del arg_4[OBJ].data[arg_4[KEY]]", "path": "modelx/core/model.py", "identifier": "ModelImpl.clear_descendants", "docstring": "Clear values and nodes calculated from `source`.", "docstring_tokens": ["Clear", "values", "and", "nodes", "calculated", "from", "source", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 256090}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmparser.py#L75-L89", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Verify a qubit id against the gate prototype.", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "name", "not", "in", "arg_0", ".", "current_symtab", ":", "raise", "QasmError", "(", "\"Cannot find symbol '\"", "+", "arg_1", ".", "name", "+", "\"' in argument list for gate, line\"", ",", "str", "(", "arg_1", ".", "line", ")", ",", "'file'", ",", "arg_1", ".", "file", ")", "arg_2", "=", "arg_0", ".", "current_symtab", "[", "arg_1", ".", "name", "]", "if", "not", "(", "arg_2", ".", "type", "==", "'id'", "and", "arg_2", ".", "is_bit", ")", ":", "raise", "QasmError", "(", "\"Bit\"", ",", "arg_1", ".", "name", ",", "'is not declared as a bit in the gate.'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Verify a qubit id against the gate prototype.\"\"\"\n        # We are verifying gate args against the formal parameters of a\n        # gate prototype.\n        if arg_1.name not in arg_0.current_symtab:\n            raise QasmError(\"Cannot find symbol '\" + arg_1.name\n                            + \"' in argument list for gate, line\",\n                            str(arg_1.line), 'file', arg_1.file)\n\n        # This insures the thing is from the bitlist and not from the\n        # argument list.\n        arg_2 = arg_0.current_symtab[arg_1.name]\n        if not (arg_2.type == 'id' and arg_2.is_bit):\n            raise QasmError(\"Bit\", arg_1.name,\n                            'is not declared as a bit in the gate.')", "path": "qiskit/qasm/qasmparser.py", "identifier": "QasmParser.verify_declared_bit", "docstring": "Verify a qubit id against the gate prototype.", "docstring_tokens": ["Verify", "a", "qubit", "id", "against", "the", "gate", "prototype", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256091}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/elmo/elmo_model.py#L192-L248", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "We'll stub out all the initializers in the pretrained LM with\n    a function that loads the weights from the file", "language": "python", "parameters": "(varname, weight_file, embedding_weight_file=None)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", "in", "range", "(", "2", ")", ":", "for", "arg_5", "in", "range", "(", "8", ")", ":", "arg_6", "=", "'RNN_{}/RNN/MultiRNNCell/Cell{}'", ".", "format", "(", "arg_4", ",", "arg_5", ")", "arg_3", "[", "arg_6", "+", "'/rnn/lstm_cell/kernel'", "]", "=", "arg_6", "+", "'/LSTMCell/W_0'", "arg_3", "[", "arg_6", "+", "'/rnn/lstm_cell/bias'", "]", "=", "arg_6", "+", "'/LSTMCell/B'", "arg_3", "[", "arg_6", "+", "'/rnn/lstm_cell/projection/kernel'", "]", "=", "arg_6", "+", "'/LSTMCell/W_P_0'", "arg_7", "=", "arg_0", "[", "5", ":", "]", "if", "arg_7", ".", "startswith", "(", "'RNN'", ")", ":", "arg_7", "=", "arg_3", "[", "arg_7", "]", "if", "arg_7", "==", "'embedding'", ":", "with", "h5py", ".", "File", "(", "arg_2", ",", "'r'", ")", "as", "fin", ":", "arg_8", "=", "fin", "[", "arg_7", "]", "[", "...", "]", "arg_9", "=", "np", ".", "zeros", "(", "(", "arg_8", ".", "shape", "[", "0", "]", "+", "1", ",", "arg_8", ".", "shape", "[", "1", "]", ")", ",", "dtype", "=", "DTYPE", ")", "arg_9", "[", "1", ":", ",", ":", "]", "=", "arg_8", "else", ":", "with", "h5py", ".", "File", "(", "arg_1", ",", "'r'", ")", "as", "fin", ":", "if", "arg_7", "==", "'char_embed'", ":", "arg_10", "=", "fin", "[", "arg_7", "]", "[", "...", "]", "arg_9", "=", "np", ".", "zeros", "(", "(", "arg_10", ".", "shape", "[", "0", "]", "+", "1", ",", "arg_10", ".", "shape", "[", "1", "]", ")", ",", "dtype", "=", "DTYPE", ")", "arg_9", "[", "1", ":", ",", ":", "]", "=", "arg_10", "else", ":", "arg_9", "=", "fin", "[", "arg_7", "]", "[", "...", "]", "def", "ret", "(", "arg_11", ",", "**", "arg_12", ")", ":", "if", "list", "(", "arg_11", ")", "!=", "list", "(", "arg_9", ".", "shape", ")", ":", "raise", "ValueError", "(", "\"Invalid shape initializing {0}, got {1}, expected {2}\"", ".", "format", "(", "arg_7", ",", "arg_11", ",", "arg_9", ".", "shape", ")", ")", "return", "arg_9", "return", "ret"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    We'll stub out all the initializers in the pretrained LM with\n    a function that loads the weights from the file\n    \"\"\"\n    arg_3 = {}\n    for arg_4 in range(2):\n        for arg_5 in range(8):  # if we decide to add more layers\n            arg_6 = 'RNN_{}/RNN/MultiRNNCell/Cell{}'.format(arg_4, arg_5)\n            arg_3[arg_6 + '/rnn/lstm_cell/kernel'] = \\\n                arg_6 + '/LSTMCell/W_0'\n            arg_3[arg_6 + '/rnn/lstm_cell/bias'] = \\\n                arg_6 + '/LSTMCell/B'\n            arg_3[arg_6 + '/rnn/lstm_cell/projection/kernel'] = \\\n                arg_6 + '/LSTMCell/W_P_0'\n\n    # convert the graph name to that in the checkpoint\n    arg_7 = arg_0[5:]\n    if arg_7.startswith('RNN'):\n        arg_7 = arg_3[arg_7]\n\n    if arg_7 == 'embedding':\n        with h5py.File(arg_2, 'r') as fin:\n            # Have added a special 0 index for padding not present\n            # in the original model.\n            arg_8 = fin[arg_7][...]\n            arg_9 = np.zeros(\n                (arg_8.shape[0] + 1, arg_8.shape[1]),\n                dtype=DTYPE\n            )\n            arg_9[1:, :] = arg_8\n    else:\n        with h5py.File(arg_1, 'r') as fin:\n            if arg_7 == 'char_embed':\n                # Have added a special 0 index for padding not present\n                # in the original model.\n                arg_10 = fin[arg_7][...]\n                arg_9 = np.zeros(\n                    (arg_10.shape[0] + 1,\n                     arg_10.shape[1]),\n                    dtype=DTYPE\n                )\n                arg_9[1:, :] = arg_10\n            else:\n                arg_9 = fin[arg_7][...]\n\n    # Tensorflow initializers are callables that accept a shape parameter\n    # and some optional kwargs\n    def ret(arg_11, **arg_12):\n        if list(arg_11) != list(arg_9.shape):\n            raise ValueError(\n                \"Invalid shape initializing {0}, got {1}, expected {2}\".format(\n                    arg_7, arg_11, arg_9.shape)\n            )\n        return arg_9\n\n    return ret", "path": "deeppavlov/models/elmo/elmo_model.py", "identifier": "_pretrained_initializer", "docstring": "We'll stub out all the initializers in the pretrained LM with\n    a function that loads the weights from the file", "docstring_tokens": ["We", "ll", "stub", "out", "all", "the", "initializers", "in", "the", "pretrained", "LM", "with", "a", "function", "that", "loads", "the", "weights", "from", "the", "file"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 256092}
{"url": "https://github.com/incuna/django-pgcrypto-fields/blob/406fddf0cbe9091ba71b97206d0f4719c0450ac1/pgcrypto/mixins.py#L134-L136", "sha": "406fddf0cbe9091ba71b97206d0f4719c0450ac1", "docstring_summary": "Tell postgres to encrypt this field using PGP.", "language": "python", "parameters": "(self, value=None, compiler=None, connection=None)", "return_statement": "return self.encrypt_sql.format(get_setting(connection, 'PUBLIC_PGP_KEY'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "return", "arg_0", ".", "encrypt_sql", ".", "format", "(", "get_setting", "(", "arg_3", ",", "'PUBLIC_PGP_KEY'", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Tell postgres to encrypt this field using PGP.\"\"\"\n        return arg_0.encrypt_sql.format(get_setting(arg_3, 'PUBLIC_PGP_KEY'))", "path": "pgcrypto/mixins.py", "identifier": "PGPPublicKeyFieldMixin.get_placeholder", "docstring": "Tell postgres to encrypt this field using PGP.", "docstring_tokens": ["Tell", "postgres", "to", "encrypt", "this", "field", "using", "PGP", "."], "nwo": "incuna/django-pgcrypto-fields", "score": 0.4638707833759358, "idx": 256093}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/host.py#L386-L394", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Gets the public IP for a host.", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "arg_2", "=", "arg_1", ".", "run", "(", "arg_1", ".", "env", ".", "Func_command", ")", "or", "''", "arg_2", "=", "arg_2", ".", "strip", "(", ")", "print", "(", "'ip:'", ",", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Gets the public IP for a host.\n        \"\"\"\n        arg_1 = arg_0.local_renderer\n        arg_2 = arg_1.run(arg_1.env.Func_command) or ''\n        arg_2 = arg_2.strip()\n        print('ip:', arg_2)\n        return arg_2", "path": "burlap/host.py", "identifier": "HostnameSatchel.get_public_ip", "docstring": "Gets the public IP for a host.", "docstring_tokens": ["Gets", "the", "public", "IP", "for", "a", "host", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256094}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L311-L316", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles display of the nodes editor.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "initialized", ":", "arg_0", ".", "model", ".", "edit_traits", "(", "parent", "=", "arg_1", ".", "ui", ".", "control", ",", "kind", "=", "\"live\"", ",", "view", "=", "nodes_view", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handles display of the nodes editor.\n        \"\"\"\n        if arg_1.initialized:\n            arg_0.model.edit_traits(parent=arg_1.ui.control,\n                kind=\"live\", view=nodes_view)", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel.configure_nodes", "docstring": "Handles display of the nodes editor.", "docstring_tokens": ["Handles", "display", "of", "the", "nodes", "editor", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 256095}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/hdf5.py#L7-L29", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Import a HDF5 file into a numpy array.", "language": "python", "parameters": "(hdf5_filename)", "return_statement": "return numpy.array(data_layers)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", "try", ":", "arg_1", "=", "h5py", ".", "File", "(", "arg_0", ",", "\"r\"", ")", "arg_2", "=", "arg_1", ".", "get", "(", "'image'", ")", ".", "get", "(", "'CUTOUT'", ")", "except", "Exception", "as", "e", ":", "raise", "ValueError", "(", "\"Could not Func file {0} for conversion. {}\"", ".", "format", "(", "arg_0", ",", "e", ")", ")", "raise", "return", "numpy", ".", "array", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Import a HDF5 file into a numpy array.\n\n    Arguments:\n        hdf5_filename:  A string filename of a HDF5 datafile\n\n    Returns:\n        A numpy array with data from the HDF5 file\n    \"\"\"\n    # Expand filename to be absolute\n    arg_0 = os.path.expanduser(arg_0)\n\n    try:\n        arg_1 = h5py.File(arg_0, \"r\")\n        # neurodata stores data inside the 'cutout' h5 dataset\n        arg_2 = arg_1.get('image').get('CUTOUT')\n    except Exception as e:\n        raise ValueError(\"Could not Func file {0} for conversion. {}\".format(\n                         arg_0, e))\n        raise\n\n    return numpy.array(arg_2)", "path": "ndio/convert/hdf5.py", "identifier": "load", "docstring": "Import a HDF5 file into a numpy array.\n\n    Arguments:\n        hdf5_filename:  A string filename of a HDF5 datafile\n\n    Returns:\n        A numpy array with data from the HDF5 file", "docstring_tokens": ["Import", "a", "HDF5", "file", "into", "a", "numpy", "array", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 256096}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1843-L1888", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Writes a new prompt at the end of the buffer.", "language": "python", "parameters": "(self, prompt=None, html=False, newline=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "arg_0", ".", "_get_end_cursor", "(", ")", "arg_0", ".", "_append_before_prompt_pos", "=", "arg_4", ".", "position", "(", ")", "if", "arg_3", "and", "arg_4", ".", "position", "(", ")", ">", "0", ":", "arg_4", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "Left", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "if", "arg_4", ".", "selection", "(", ")", ".", "toPlainText", "(", ")", "!=", "'\\n'", ":", "arg_0", ".", "_append_plain_text", "(", "'\\n'", ")", "arg_0", ".", "_append_plain_text", "(", "arg_0", ".", "_prompt_sep", ")", "if", "arg_1", "is", "None", ":", "if", "arg_0", ".", "_prompt_html", "is", "None", ":", "arg_0", ".", "_append_plain_text", "(", "arg_0", ".", "_prompt", ")", "else", ":", "arg_0", ".", "_append_html", "(", "arg_0", ".", "_prompt_html", ")", "else", ":", "if", "arg_2", ":", "arg_0", ".", "_prompt", "=", "arg_0", ".", "_append_html_fetching_plain_text", "(", "arg_1", ")", "arg_0", ".", "_prompt_html", "=", "arg_1", "else", ":", "arg_0", ".", "_append_plain_text", "(", "arg_1", ")", "arg_0", ".", "_prompt", "=", "arg_1", "arg_0", ".", "_prompt_html", "=", "None", "arg_0", ".", "_prompt_pos", "=", "arg_0", ".", "_get_end_cursor", "(", ")", ".", "position", "(", ")", "arg_0", ".", "_prompt_started", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=True):\n        \"\"\" Writes a new prompt at the end of the buffer.\n\n        Parameters\n        ----------\n        prompt : str, optional\n            The prompt to show. If not specified, the previous prompt is used.\n\n        html : bool, optional (default False)\n            Only relevant when a prompt is specified. If set, the prompt will\n            be inserted as formatted HTML. Otherwise, the prompt will be treated\n            as plain text, though ANSI color codes will be handled.\n\n        newline : bool, optional (default True)\n            If set, a new line will be written before showing the prompt if\n            there is not already a newline at the end of the buffer.\n        \"\"\"\n        # Save the current end position to support _append*(before_prompt=True).\n        arg_4 = arg_0._get_end_cursor()\n        arg_0._append_before_prompt_pos = arg_4.position()\n\n        # Insert a preliminary newline, if necessary.\n        if arg_3 and arg_4.position() > 0:\n            arg_4.movePosition(QtGui.QTextCursor.Left,\n                                QtGui.QTextCursor.KeepAnchor)\n            if arg_4.selection().toPlainText() != '\\n':\n                arg_0._append_plain_text('\\n')\n\n        # Write the prompt.\n        arg_0._append_plain_text(arg_0._prompt_sep)\n        if arg_1 is None:\n            if arg_0._prompt_html is None:\n                arg_0._append_plain_text(arg_0._prompt)\n            else:\n                arg_0._append_html(arg_0._prompt_html)\n        else:\n            if arg_2:\n                arg_0._prompt = arg_0._append_html_fetching_plain_text(arg_1)\n                arg_0._prompt_html = arg_1\n            else:\n                arg_0._append_plain_text(arg_1)\n                arg_0._prompt = arg_1\n                arg_0._prompt_html = None\n\n        arg_0._prompt_pos = arg_0._get_end_cursor().position()\n        arg_0._prompt_started()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._show_prompt", "docstring": "Writes a new prompt at the end of the buffer.\n\n        Parameters\n        ----------\n        prompt : str, optional\n            The prompt to show. If not specified, the previous prompt is used.\n\n        html : bool, optional (default False)\n            Only relevant when a prompt is specified. If set, the prompt will\n            be inserted as formatted HTML. Otherwise, the prompt will be treated\n            as plain text, though ANSI color codes will be handled.\n\n        newline : bool, optional (default True)\n            If set, a new line will be written before showing the prompt if\n            there is not already a newline at the end of the buffer.", "docstring_tokens": ["Writes", "a", "new", "prompt", "at", "the", "end", "of", "the", "buffer", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256097}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/client.py#L139-L153", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Make request parameters right.", "language": "python", "parameters": "(uri, headers=None, data=None, method=None)", "return_statement": "return uri, headers, data, method", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "{", "}", "if", "arg_2", "and", "not", "arg_3", ":", "arg_3", "=", "'POST'", "elif", "not", "arg_3", ":", "arg_3", "=", "'GET'", "if", "arg_3", "==", "'GET'", "and", "arg_2", ":", "arg_0", "=", "add_params_to_uri", "(", "arg_0", ",", "arg_2", ")", "arg_2", "=", "None", "return", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n    \"\"\"Make request parameters right.\"\"\"\n    if arg_1 is None:\n        arg_1 = {}\n\n    if arg_2 and not arg_3:\n        arg_3 = 'POST'\n    elif not arg_3:\n        arg_3 = 'GET'\n\n    if arg_3 == 'GET' and arg_2:\n        arg_0 = add_params_to_uri(arg_0, arg_2)\n        arg_2 = None\n\n    return arg_0, arg_1, arg_2, arg_3", "path": "flask_oauthlib/client.py", "identifier": "prepare_request", "docstring": "Make request parameters right.", "docstring_tokens": ["Make", "request", "parameters", "right", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 256098}
{"url": "https://github.com/job/aggregate6/blob/fa93046a39e397795d6258ea4c46033dee3df69b/aggregate6/aggregate6.py#L44-L61", "sha": "fa93046a39e397795d6258ea4c46033dee3df69b", "docstring_summary": "Aggregate a `list` of prefixes.", "language": "python", "parameters": "(l)", "return_statement": "return aggregate_tree(tree).prefixes()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "radix", ".", "Radix", "(", ")", "for", "arg_2", "in", "arg_0", ":", "try", ":", "arg_1", ".", "add", "(", "arg_2", ")", "except", "(", "ValueError", ")", "as", "err", ":", "raise", "Exception", "(", "\"ERROR: invalid IP prefix: {}\"", ".", "format", "(", "arg_2", ")", ")", "return", "Func_tree", "(", "arg_1", ")", ".", "prefixes", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Aggregate a `list` of prefixes.\n\n    Keyword arguments:\n    l -- a python list of prefixes\n\n    Example use:\n    >>> Func([\"10.0.0.0/8\", \"10.0.0.0/24\"])\n    ['10.0.0.0/8']\n    \"\"\"\n    arg_1 = radix.Radix()\n    for arg_2 in arg_0:\n        try:\n            arg_1.add(arg_2)\n        except (ValueError) as err:\n            raise Exception(\"ERROR: invalid IP prefix: {}\".format(arg_2))\n\n    return Func_tree(arg_1).prefixes()", "path": "aggregate6/aggregate6.py", "identifier": "aggregate", "docstring": "Aggregate a `list` of prefixes.\n\n    Keyword arguments:\n    l -- a python list of prefixes\n\n    Example use:\n    >>> aggregate([\"10.0.0.0/8\", \"10.0.0.0/24\"])\n    ['10.0.0.0/8']", "docstring_tokens": ["Aggregate", "a", "list", "of", "prefixes", "."], "nwo": "job/aggregate6", "score": 0.28664015341726634, "idx": 256099}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L172-L213", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Write out a network", "language": "python", "parameters": "(net, file_name, data=True, fmt=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "\"edg\"", "if", "arg_3", "==", "\"edg\"", ":", "if", "arg_2", ":", "networkx", ".", "write_edgelist", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", "else", ":", "networkx", ".", "write_edgelist", "(", "arg_0", ",", "arg_1", ")", "elif", "arg_3", "==", "\"csv\"", ":", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "f", ":", "arg_4", "=", "arg_0", ".", "edges_iter", "(", "arg_2", "=", "True", ")", "arg_5", ",", "arg_5", ",", "arg_6", "=", "next", "(", "arg_4", ")", "arg_7", "=", "list", "(", "sorted", "(", "arg_6", ".", "keys", "(", ")", ")", ")", "arg_8", "=", "\";\"", ".", "join", "(", "[", "\"from_stop_I\"", ",", "\"to_stop_I\"", "]", "+", "arg_7", ")", "f", ".", "write", "(", "arg_8", ")", "for", "arg_9", ",", "arg_10", ",", "arg_2", "in", "arg_0", ".", "edges_iter", "(", "arg_2", "=", "True", ")", ":", "f", ".", "write", "(", "\"\\n\"", ")", "arg_11", "=", "[", "str", "(", "arg_9", ")", ",", "str", "(", "arg_10", ")", "]", "arg_12", "=", "[", "]", "for", "arg_13", "in", "arg_7", ":", "if", "arg_13", "==", "\"route_I_counts\"", ":", "arg_14", "=", "str", "(", "arg_2", "[", "arg_13", "]", ")", ".", "replace", "(", "\" \"", ",", "\"\"", ")", "[", "1", ":", "-", "1", "]", "arg_12", ".", "append", "(", "arg_14", ")", "else", ":", "arg_12", ".", "append", "(", "str", "(", "arg_2", "[", "arg_13", "]", ")", ")", "arg_15", "=", "arg_11", "+", "arg_12", "f", ".", "write", "(", "\";\"", ".", "join", "(", "arg_15", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None):\n    \"\"\"\n    Write out a network\n\n    Parameters\n    ----------\n    net: networkx.DiGraph\n    base_name: str\n        path to the filename (without extension)\n    data: bool, optional\n        whether or not to write out any edge data present\n    fmt: str, optional\n        If \"csv\" write out the network in csv format.\n    \"\"\"\n    if arg_3 is None:\n        arg_3 = \"edg\"\n\n    if arg_3 == \"edg\":\n        if arg_2:\n            networkx.write_edgelist(arg_0, arg_1, arg_2=True)\n        else:\n            networkx.write_edgelist(arg_0, arg_1)\n    elif arg_3 == \"csv\":\n        with open(arg_1, 'w') as f:\n            # writing out the header\n            arg_4 = arg_0.edges_iter(arg_2=True)\n            arg_5, arg_5, arg_6 = next(arg_4)\n            arg_7 = list(sorted(arg_6.keys()))\n            arg_8 = \";\".join([\"from_stop_I\", \"to_stop_I\"] + arg_7)\n            f.write(arg_8)\n            for arg_9, arg_10, arg_2 in arg_0.edges_iter(arg_2=True):\n                f.write(\"\\n\")\n                arg_11 = [str(arg_9), str(arg_10)]\n                arg_12 = []\n                for arg_13 in arg_7:\n                    if arg_13 == \"route_I_counts\":\n                        arg_14 = str(arg_2[arg_13]).replace(\" \", \"\")[1:-1]\n                        arg_12.append(arg_14)\n                    else:\n                        arg_12.append(str(arg_2[arg_13]))\n                arg_15 = arg_11 + arg_12\n                f.write(\";\".join(arg_15))", "path": "gtfspy/exports.py", "identifier": "_write_stop_to_stop_network_edges", "docstring": "Write out a network\n\n    Parameters\n    ----------\n    net: networkx.DiGraph\n    base_name: str\n        path to the filename (without extension)\n    data: bool, optional\n        whether or not to write out any edge data present\n    fmt: str, optional\n        If \"csv\" write out the network in csv format.", "docstring_tokens": ["Write", "out", "a", "network"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 256100}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/utils.py#L13-L31", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "create a folder at the drive root. If the folder already exists,\n       it is simply returned.", "language": "python", "parameters": "(self, folder)", "return_statement": "return folder", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"mimeType='application/vnd.google-apps.folder' and name='%s'\"", "%", "arg_1", "arg_3", "=", "arg_0", ".", "_service", ".", "files", "(", ")", ".", "list", "(", "arg_2", "=", "arg_2", ",", "spaces", "=", "'drive'", ")", ".", "execute", "(", ")", ".", "get", "(", "'files'", ",", "[", "]", ")", "if", "len", "(", "arg_3", ")", "==", "0", ":", "arg_1", "=", "arg_0", ".", "_create_folder", "(", "arg_1", ")", "else", ":", "arg_1", "=", "arg_3", "[", "0", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    '''create a folder at the drive root. If the folder already exists,\n       it is simply returned.\n\n           folder = self._Func(self._base)\n           $ folder\n             {'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'}\n\n    '''\n    arg_2 = \"mimeType='application/vnd.google-apps.folder' and name='%s'\" %arg_1\n    arg_3 = arg_0._service.files().list(arg_2=arg_2,\n                                          spaces='drive').execute().get('files',[])\n\n    # If no folder is found, create it!\n    if len(arg_3) == 0:            \n        arg_1 = arg_0._create_folder(arg_1)\n    else:\n        arg_1 = arg_3[0]\n    return arg_1", "path": "sregistry/main/google_drive/utils.py", "identifier": "get_or_create_folder", "docstring": "create a folder at the drive root. If the folder already exists,\n       it is simply returned.\n\n           folder = self._get_or_create_folder(self._base)\n           $ folder\n             {'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'}", "docstring_tokens": ["create", "a", "folder", "at", "the", "drive", "root", ".", "If", "the", "folder", "already", "exists", "it", "is", "simply", "returned", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 256101}
{"url": "https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L331-L342", "sha": "6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d", "docstring_summary": "Asynchronous POST request with the process pool.", "language": "python", "parameters": "(self, url, data, callback=None, params=None, headers=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_4", "=", "arg_4", "or", "{", "}", "arg_5", "=", "arg_5", "or", "{", "}", "arg_6", "=", "arg_0", ".", "_build_endpoint_url", "(", "arg_1", ",", "None", ")", "arg_0", ".", "_authenticate", "(", "arg_4", ",", "arg_5", ")", "arg_2", "=", "json", ".", "dumps", "(", "arg_2", ",", "cls", "=", "JSONEncoder", ")", "process_pool", ".", "apply_async", "(", "make_post_request", ",", "args", "=", "(", "arg_6", ",", "arg_2", ",", "arg_4", ",", "arg_5", ")", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"\n        Asynchronous POST request with the process pool.\n        \"\"\"\n        arg_4 = arg_4 or {}\n        arg_5 = arg_5 or {}\n        arg_6 = arg_0._build_endpoint_url(arg_1, None)\n        arg_0._authenticate(arg_4, arg_5)\n        arg_2 = json.dumps(arg_2, cls=JSONEncoder)\n        process_pool.apply_async(make_post_request,\n                                 args=(arg_6, arg_2, arg_4, arg_5),\n                                 arg_3=arg_3)", "path": "firebase/firebase.py", "identifier": "FirebaseApplication.post_async", "docstring": "Asynchronous POST request with the process pool.", "docstring_tokens": ["Asynchronous", "POST", "request", "with", "the", "process", "pool", "."], "nwo": "ozgur/python-firebase", "score": 0.7583798599854712, "idx": 256102}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py#L141-L161", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Remove storeitems from storage.", "language": "python", "parameters": "(self, keys: List[str])", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ")", ":", "try", ":", "if", "not", "arg_0", ".", "__container_exists", ":", "arg_0", ".", "__create_db_and_container", "(", ")", "for", "arg_4", "in", "arg_1", ":", "arg_0", ".", "client", ".", "DeleteItem", "(", "document_link", "=", "arg_0", ".", "__item_link", "(", "arg_0", ".", "__sanitize_key", "(", "arg_4", ")", ")", ")", "except", "cosmos_errors", ".", "HTTPFailure", "as", "h", ":", "if", "h", ".", "status_code", "!=", "404", ":", "raise", "h", "except", "TypeError", "as", "e", ":", "raise", "e"], "function": "async def Func(arg_0, arg_1: arg_2[arg_3]):\n        \"\"\"Remove storeitems from storage.\n\n        :param keys:\n        :return:\n        \"\"\"\n        try:\n            # check if the database and container exists and if not create\n            if not arg_0.__container_exists:\n                arg_0.__create_db_and_container()\n            # call the function for each key\n            for arg_4 in arg_1:\n                arg_0.client.DeleteItem(\n                    document_link=arg_0.__item_link(arg_0.__sanitize_key(arg_4)))\n                # print(res)\n        except cosmos_errors.HTTPFailure as h:\n            # print(h.status_code)\n            if h.status_code != 404:\n                raise h\n        except TypeError as e:\n            raise e", "path": "libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py", "identifier": "CosmosDbStorage.delete", "docstring": "Remove storeitems from storage.\n\n        :param keys:\n        :return:", "docstring_tokens": ["Remove", "storeitems", "from", "storage", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 256103}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/SAM.py#L187-L224", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Plot SAM's various losses.", "language": "python", "parameters": "(i_batch, adv_loss, gen_loss, l1_reg, cols)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "from", "matplotlib", "import", "pyplot", "as", "plt", "if", "arg_0", "==", "0", ":", "try", ":", "arg_6", ".", "clear", "(", ")", "arg_6", ".", "plot", "(", "range", "(", "len", "(", "arg_7", ")", ")", ",", "arg_7", ",", "\"r-\"", ",", "linewidth", "=", "1.5", ",", "markersize", "=", "4", ",", "label", "=", "\"Discriminator\"", ")", "arg_6", ".", "plot", "(", "range", "(", "len", "(", "arg_7", ")", ")", ",", "arg_8", ",", "\"g-\"", ",", "linewidth", "=", "1.5", ",", "markersize", "=", "4", ",", "label", "=", "\"Generators\"", ")", "arg_6", ".", "plot", "(", "range", "(", "len", "(", "arg_7", ")", ")", ",", "arg_9", ",", "\"b-\"", ",", "linewidth", "=", "1.5", ",", "markersize", "=", "4", ",", "label", "=", "\"L1-Regularization\"", ")", "plt", ".", "legend", "(", ")", "arg_7", ".", "append", "(", "arg_1", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", ")", "arg_8", ".", "append", "(", "arg_2", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", "/", "arg_4", ")", "arg_9", ".", "append", "(", "arg_3", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", ")", "plt", ".", "pause", "(", "0.0001", ")", "except", "NameError", ":", "plt", ".", "ion", "(", ")", "arg_5", ",", "arg_6", "=", "plt", ".", "figure", "(", ")", "plt", ".", "xlabel", "(", "\"Epoch\"", ")", "plt", ".", "ylabel", "(", "\"Losses\"", ")", "plt", ".", "pause", "(", "0.0001", ")", "arg_7", "=", "[", "arg_1", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", "]", "arg_8", "=", "[", "arg_2", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", "/", "arg_4", "]", "arg_9", "=", "[", "arg_3", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", "]", "else", ":", "arg_7", ".", "append", "(", "arg_1", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", ")", "arg_8", ".", "append", "(", "arg_2", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", "/", "arg_4", ")", "arg_9", ".", "append", "(", "arg_3", ".", "cpu", "(", ")", ".", "data", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Plot SAM's various losses.\"\"\"\n    from matplotlib import pyplot as plt\n    if arg_0 == 0:\n        try:\n            arg_6.clear()\n            arg_6.plot(range(len(arg_7)), arg_7, \"r-\",\n                    linewidth=1.5, markersize=4,\n                    label=\"Discriminator\")\n            arg_6.plot(range(len(arg_7)), arg_8, \"g-\", linewidth=1.5,\n                    markersize=4, label=\"Generators\")\n            arg_6.plot(range(len(arg_7)), arg_9, \"b-\",\n                    linewidth=1.5, markersize=4,\n                    label=\"L1-Regularization\")\n            plt.legend()\n\n            arg_7.append(arg_1.cpu().data[0])\n            arg_8.append(arg_2.cpu().data[0] / arg_4)\n            arg_9.append(arg_3.cpu().data[0])\n\n            plt.pause(0.0001)\n\n        except NameError:\n            plt.ion()\n            arg_5, arg_6 = plt.figure()\n            plt.xlabel(\"Epoch\")\n            plt.ylabel(\"Losses\")\n\n            plt.pause(0.0001)\n\n            arg_7 = [arg_1.cpu().data[0]]\n            arg_8 = [arg_2.cpu().data[0] / arg_4]\n            arg_9 = [arg_3.cpu().data[0]]\n\n    else:\n        arg_7.append(arg_1.cpu().data[0])\n        arg_8.append(arg_2.cpu().data[0] / arg_4)\n        arg_9.append(arg_3.cpu().data[0])", "path": "cdt/causality/graph/SAM.py", "identifier": "plot_curves", "docstring": "Plot SAM's various losses.", "docstring_tokens": ["Plot", "SAM", "s", "various", "losses", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 256104}
{"url": "https://github.com/jshiv/turntable/blob/c095a93df14d672ba54db164a7ab7373444d1829/turntable/press.py#L332-L365", "sha": "c095a93df14d672ba54db164a7ab7373444d1829", "docstring_summary": "Runs the full turntable process on a pandas DataFrame", "language": "python", "parameters": "(df, method)", "return_statement": "return collection_to_df(collection)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "build_collection", "(", "arg_0", ")", "arg_2", "=", "turntable", ".", "spin", ".", "batch", "(", "arg_2", ",", "arg_1", ")", "return", "collection_to_df", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    ''' \n    Runs the full turntable process on a pandas DataFrame\n\n    parameters\n    ----------\n    df : pandas.DataFrame\n        each row represents a record\n    method : def method(record)\n        function used to process each row\n\n    Returns\n    -------\n    df : pandas.DataFrame\n        DataFrame processed by method\n\n    Example\n    -------\n    >>> import pandas as pd\n    >>> import turntable\n    >>>\n    >>> df = pd.DataFrame({'Artist':\"\"\"Michael Jackson, Pink Floyd, Whitney Houston, Meat Loaf, Eagles, Fleetwood Mac, Bee Gees, AC/DC\"\"\".split(', '), 'Album':\"\"\"Thriller, The Dark Side of the Moon, The Bodyguard, Bat Out of Hell, Their Greatest Hits (1971\u20131975), Rumours, Saturday Night Fever, Back in Black\"\"\".split(', ')})\n    >>>\n    >>> def method(record):\n    >>>    record.cost = 40\n    >>>    return record\n    >>>\n    >>> turntable.press.Func(df, method)\n    \n\n    '''\n    arg_2 = build_collection(arg_0)\n    arg_2 = turntable.spin.batch(arg_2, arg_1)\n    return collection_to_df(arg_2)", "path": "turntable/press.py", "identifier": "spin_frame", "docstring": "Runs the full turntable process on a pandas DataFrame\n\n    parameters\n    ----------\n    df : pandas.DataFrame\n        each row represents a record\n    method : def method(record)\n        function used to process each row\n\n    Returns\n    -------\n    df : pandas.DataFrame\n        DataFrame processed by method\n\n    Example\n    -------\n    >>> import pandas as pd\n    >>> import turntable\n    >>>\n    >>> df = pd.DataFrame({'Artist':\"\"\"Michael Jackson, Pink Floyd, Whitney Houston, Meat Loaf, Eagles, Fleetwood Mac, Bee Gees, AC/DC\"\"\".split(', '), 'Album':\"\"\"Thriller, The Dark Side of the Moon, The Bodyguard, Bat Out of Hell, Their Greatest Hits (1971\u20131975), Rumours, Saturday Night Fever, Back in Black\"\"\".split(', ')})\n    >>>\n    >>> def method(record):\n    >>>    record.cost = 40\n    >>>    return record\n    >>>\n    >>> turntable.press.spin_frame(df, method)", "docstring_tokens": ["Runs", "the", "full", "turntable", "process", "on", "a", "pandas", "DataFrame"], "nwo": "jshiv/turntable", "score": 0.0, "idx": 256105}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/vec_env/vec_env.py#L204-L219", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "from mpi4py import MPI will call MPI_Init by default.  If the child process has MPI environment variables, MPI will think that the child process is an MPI process just like the parent and do bad things such as hang.\n    This context manager is a hacky way to clear those environment variables temporarily such as when we are starting multiprocessing\n    Processes.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "{", "}", "for", "arg_1", ",", "arg_2", "in", "list", "(", "os", ".", "environ", ".", "items", "(", ")", ")", ":", "for", "arg_3", "in", "[", "'OMPI_'", ",", "'PMI_'", "]", ":", "if", "arg_1", ".", "startswith", "(", "arg_3", ")", ":", "arg_0", "[", "arg_1", "]", "=", "arg_2", "del", "os", ".", "environ", "[", "arg_1", "]", "try", ":", "yield", "finally", ":", "os", ".", "environ", ".", "update", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"\n    from mpi4py import MPI will call MPI_Init by default.  If the child process has MPI environment variables, MPI will think that the child process is an MPI process just like the parent and do bad things such as hang.\n    This context manager is a hacky way to clear those environment variables temporarily such as when we are starting multiprocessing\n    Processes.\n    \"\"\"\n    arg_0 = {}\n    for arg_1, arg_2 in list(os.environ.items()):\n        for arg_3 in ['OMPI_', 'PMI_']:\n            if arg_1.startswith(arg_3):\n                arg_0[arg_1] = arg_2\n                del os.environ[arg_1]\n    try:\n        yield\n    finally:\n        os.environ.update(arg_0)", "path": "baselines/common/vec_env/vec_env.py", "identifier": "clear_mpi_env_vars", "docstring": "from mpi4py import MPI will call MPI_Init by default.  If the child process has MPI environment variables, MPI will think that the child process is an MPI process just like the parent and do bad things such as hang.\n    This context manager is a hacky way to clear those environment variables temporarily such as when we are starting multiprocessing\n    Processes.", "docstring_tokens": ["from", "mpi4py", "import", "MPI", "will", "call", "MPI_Init", "by", "default", ".", "If", "the", "child", "process", "has", "MPI", "environment", "variables", "MPI", "will", "think", "that", "the", "child", "process", "is", "an", "MPI", "process", "just", "like", "the", "parent", "and", "do", "bad", "things", "such", "as", "hang", ".", "This", "context", "manager", "is", "a", "hacky", "way", "to", "clear", "those", "environment", "variables", "temporarily", "such", "as", "when", "we", "are", "starting", "multiprocessing", "Processes", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 256106}
{"url": "https://github.com/digi604/django-smart-selects/blob/05dcc4a3de2874499ff3b9a3dfac5c623206e3e5/smart_selects/views.py#L94-L130", "sha": "05dcc4a3de2874499ff3b9a3dfac5c623206e3e5", "docstring_summary": "Returns filtered results followed by excluded results below.", "language": "python", "parameters": "(request, app, model, field, foreign_key_app_name,\n                    foreign_key_model_name, foreign_key_field_name, value)", "return_statement": "return JsonResponse(serialized_results, safe=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_8", "=", "get_model", "(", "arg_1", ",", "arg_2", ")", "arg_9", "=", "get_keywords", "(", "arg_3", ",", "arg_7", ")", "arg_10", "=", "get_model", "(", "arg_4", ",", "arg_5", ")", "if", "not", "any", "(", "[", "(", "isinstance", "(", "arg_11", ",", "ChainedManyToManyField", ")", "or", "isinstance", "(", "arg_11", ",", "ChainedForeignKey", ")", ")", "for", "arg_11", "in", "arg_10", ".", "_meta", ".", "get_fields", "(", ")", "]", ")", ":", "raise", "PermissionDenied", "(", "\"Smart select disallowed\"", ")", "arg_12", "=", "get_limit_choices_to", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", "arg_13", "=", "get_queryset", "(", "arg_8", ",", "arg_12", "=", "arg_12", ")", "arg_14", "=", "list", "(", "do_filter", "(", "arg_13", ",", "arg_9", ")", ")", "if", "not", "getattr", "(", "arg_8", ".", "_meta", ",", "'ordering'", ",", "False", ")", ":", "sort_results", "(", "list", "(", "arg_14", ")", ")", "arg_15", "=", "list", "(", "do_filter", "(", "arg_13", ",", "arg_9", ",", "exclude", "=", "True", ")", ")", "if", "not", "getattr", "(", "arg_8", ".", "_meta", ",", "'ordering'", ",", "False", ")", ":", "sort_results", "(", "list", "(", "arg_15", ")", ")", "arg_16", "=", "{", "'value'", ":", "\"\"", ",", "'display'", ":", "\"---------\"", "}", "arg_17", "=", "(", "serialize_results", "(", "arg_14", ")", "+", "[", "arg_16", "]", "+", "serialize_results", "(", "arg_15", ")", ")", "return", "JsonResponse", "(", "arg_17", ",", "safe", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                    arg_5, arg_6, arg_7):\n    \"\"\"Returns filtered results followed by excluded results below.\"\"\"\n    arg_8 = get_model(arg_1, arg_2)\n    arg_9 = get_keywords(arg_3, arg_7)\n\n    # SECURITY: Make sure all smart selects requests are opt-in\n    arg_10 = get_model(arg_4, arg_5)\n    if not any([(isinstance(arg_11, ChainedManyToManyField) or\n                 isinstance(arg_11, ChainedForeignKey))\n                for arg_11 in arg_10._meta.get_fields()]):\n        raise PermissionDenied(\"Smart select disallowed\")\n\n    # filter queryset using limit_choices_to\n    arg_12 = get_limit_choices_to(arg_4, arg_5, arg_6)\n    arg_13 = get_queryset(arg_8, arg_12=arg_12)\n\n    arg_14 = list(do_filter(arg_13, arg_9))\n    # Sort results if model doesn't include a default ordering.\n    if not getattr(arg_8._meta, 'ordering', False):\n        sort_results(list(arg_14))\n\n    arg_15 = list(do_filter(arg_13, arg_9, exclude=True))\n    # Sort results if model doesn't include a default ordering.\n    if not getattr(arg_8._meta, 'ordering', False):\n        sort_results(list(arg_15))\n\n    # Empty choice to separate filtered and excluded results.\n    arg_16 = {'value': \"\", 'display': \"---------\"}\n\n    arg_17 = (\n        serialize_results(arg_14) +\n        [arg_16] +\n        serialize_results(arg_15)\n    )\n\n    return JsonResponse(arg_17, safe=False)", "path": "smart_selects/views.py", "identifier": "filterchain_all", "docstring": "Returns filtered results followed by excluded results below.", "docstring_tokens": ["Returns", "filtered", "results", "followed", "by", "excluded", "results", "below", "."], "nwo": "digi604/django-smart-selects", "score": 0.7571810030476924, "idx": 256107}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L305-L314", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Pause tracing, but be prepared to `resume`.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "tracers", ":", "arg_1", ".", "stop", "(", ")", "arg_2", "=", "arg_1", ".", "get_stats", "(", ")", "if", "arg_2", ":", "print", "(", "\"\\nCoverage.py tracer stats:\"", ")", "for", "arg_3", "in", "sorted", "(", "arg_2", ".", "keys", "(", ")", ")", ":", "print", "(", "\"%16s: %s\"", "%", "(", "arg_3", ",", "arg_2", "[", "arg_3", "]", ")", ")", "threading", ".", "settrace", "(", "None", ")"], "function": "def Func(arg_0):\n        \"\"\"Pause tracing, but be prepared to `resume`.\"\"\"\n        for arg_1 in arg_0.tracers:\n            arg_1.stop()\n            arg_2 = arg_1.get_stats()\n            if arg_2:\n                print(\"\\nCoverage.py tracer stats:\")\n                for arg_3 in sorted(arg_2.keys()):\n                    print(\"%16s: %s\" % (arg_3, arg_2[arg_3]))\n        threading.settrace(None)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py", "identifier": "Collector.pause", "docstring": "Pause tracing, but be prepared to `resume`.", "docstring_tokens": ["Pause", "tracing", "but", "be", "prepared", "to", "resume", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256108}
{"url": "https://github.com/MycroftAI/padatious/blob/794a2530d6079bdd06e193edd0d30b2cc793e631/padatious/intent_container.py#L190-L217", "sha": "794a2530d6079bdd06e193edd0d30b2cc793e631", "docstring_summary": "Trains in a subprocess which provides a timeout guarantees everything shuts down properly", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "call", "(", "[", "sys", ".", "executable", ",", "'-m'", ",", "'padatious'", ",", "'train'", ",", "arg_0", ".", "cache_dir", ",", "'-d'", ",", "json", ".", "dumps", "(", "arg_0", ".", "serialized_args", ")", ",", "'-a'", ",", "json", ".", "dumps", "(", "arg_1", ")", ",", "'-k'", ",", "json", ".", "dumps", "(", "arg_2", ")", ",", "]", ")", "if", "arg_3", "==", "2", ":", "raise", "TypeError", "(", "'Invalid train arguments: {} {}'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "arg_4", "=", "arg_0", ".", "serialized_args", "arg_0", ".", "clear", "(", ")", "arg_0", ".", "apply_training_args", "(", "arg_4", ")", "arg_0", ".", "padaos", ".", "compile", "(", ")", "if", "arg_3", "==", "0", ":", "arg_0", ".", "must_train", "=", "False", "return", "True", "elif", "arg_3", "==", "10", ":", "return", "False", "else", ":", "raise", "ValueError", "(", "'Training failed and returned code: {}'", ".", "format", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Trains in a subprocess which provides a timeout guarantees everything shuts down properly\n\n        Args:\n            See <train>\n        Returns:\n            bool: True for success, False if timed out\n        \"\"\"\n        arg_3 = call([\n            sys.executable, '-m', 'padatious', 'train', arg_0.cache_dir,\n            '-d', json.dumps(arg_0.serialized_args),\n            '-a', json.dumps(arg_1),\n            '-k', json.dumps(arg_2),\n        ])\n        if arg_3 == 2:\n            raise TypeError('Invalid train arguments: {} {}'.format(arg_1, arg_2))\n        arg_4 = arg_0.serialized_args\n        arg_0.clear()\n        arg_0.apply_training_args(arg_4)\n        arg_0.padaos.compile()\n        if arg_3 == 0:\n            arg_0.must_train = False\n            return True\n        elif arg_3 == 10:  # timeout\n            return False\n        else:\n            raise ValueError('Training failed and returned code: {}'.format(arg_3))", "path": "padatious/intent_container.py", "identifier": "IntentContainer.train_subprocess", "docstring": "Trains in a subprocess which provides a timeout guarantees everything shuts down properly\n\n        Args:\n            See <train>\n        Returns:\n            bool: True for success, False if timed out", "docstring_tokens": ["Trains", "in", "a", "subprocess", "which", "provides", "a", "timeout", "guarantees", "everything", "shuts", "down", "properly"], "nwo": "MycroftAI/padatious", "score": 0.4588892726323654, "idx": 256109}
{"url": "https://github.com/abau171/highfive/blob/07b3829331072035ab100d1d66deca3e8f3f372a/highfive/master.py#L193-L207", "sha": "07b3829331072035ab100d1d66deca3e8f3f372a", "docstring_summary": "Starts closing the HighFive master. The server will be closed and\n        all queued job sets will be cancelled.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Funcd", ":", "return", "arg_0", ".", "_Funcd", "=", "True", "arg_0", ".", "_server", ".", "Func", "(", ")", "arg_0", ".", "_manager", ".", "Func", "(", ")", "for", "arg_2", "in", "arg_0", ".", "_workers", ":", "arg_2", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Starts closing the HighFive master. The server will be Funcd and\n        all queued job sets will be cancelled.\n        \"\"\"\n\n        if arg_0._Funcd:\n            return\n\n        arg_0._Funcd = True\n\n        arg_0._server.Func()\n        arg_0._manager.Func()\n        for arg_2 in arg_0._workers:\n            arg_2.Func()", "path": "highfive/master.py", "identifier": "Master.close", "docstring": "Starts closing the HighFive master. The server will be closed and\n        all queued job sets will be cancelled.", "docstring_tokens": ["Starts", "closing", "the", "HighFive", "master", ".", "The", "server", "will", "be", "closed", "and", "all", "queued", "job", "sets", "will", "be", "cancelled", "."], "nwo": "abau171/highfive", "score": 0.14991498758945482, "idx": 256110}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L470-L491", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Divide all analytes by a specified internal_standard analyte.", "language": "python", "parameters": "(self, internal_standard=None)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "internal_standard", "=", "arg_1", "arg_0", ".", "data", "[", "'Funcs'", "]", "=", "Bunch", "(", ")", "for", "arg_3", "in", "arg_0", ".", "analytes", ":", "arg_0", ".", "data", "[", "'Funcs'", "]", "[", "arg_3", "]", "=", "(", "arg_0", ".", "data", "[", "'bkgsub'", "]", "[", "arg_3", "]", "/", "arg_0", ".", "data", "[", "'bkgsub'", "]", "[", "arg_0", ".", "internal_standard", "]", ")", "arg_0", ".", "setfocus", "(", "'Funcs'", ")", "return"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Divide all analytes by a specified internal_standard analyte.\n\n        Parameters\n        ----------\n        internal_standard : str\n            The analyte used as the internal_standard.\n\n        Returns\n        -------\n        None\n        \"\"\"\n        if arg_1 is not None:\n            arg_0.internal_standard = arg_1\n\n        arg_0.data['Funcs'] = Bunch()\n        for arg_3 in arg_0.analytes:\n            arg_0.data['Funcs'][arg_3] = (arg_0.data['bkgsub'][arg_3] /\n                                      arg_0.data['bkgsub'][arg_0.internal_standard])\n        arg_0.setfocus('Funcs')\n        return", "path": "latools/D_obj.py", "identifier": "D.ratio", "docstring": "Divide all analytes by a specified internal_standard analyte.\n\n        Parameters\n        ----------\n        internal_standard : str\n            The analyte used as the internal_standard.\n\n        Returns\n        -------\n        None", "docstring_tokens": ["Divide", "all", "analytes", "by", "a", "specified", "internal_standard", "analyte", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 256111}
{"url": "https://github.com/Nekroze/greencard/blob/30fe7eba5742c31b666027e31f33aaa641699857/greencard/greencard.py#L98-L117", "sha": "30fe7eba5742c31b666027e31f33aaa641699857", "docstring_summary": "Command line entry point.", "language": "python", "parameters": "(clargs=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "from", "argparse", "import", "ArgumentParser", "from", "librarian", ".", "library", "import", "Library", "import", "sys", "arg_1", "=", "ArgumentParser", "(", "description", "=", "\"A test runner for each card in a librarian library.\"", ")", "arg_1", ".", "add_argument", "(", "\"library\"", ",", "help", "=", "\"Library database\"", ")", "arg_1", ".", "add_argument", "(", "\"-t\"", ",", "\"--tests\"", ",", "default", "=", "\"test/\"", ",", "help", "=", "\"Test directory\"", ")", "arg_2", "=", "arg_1", ".", "parse_args", "(", "arg_0", ")", "descovery", "(", "arg_2", ".", "tests", ")", "arg_3", "=", "Library", "(", "arg_2", ".", "library", ")", "arg_4", ",", "arg_5", ",", "arg_6", "=", "execute_tests", "(", "arg_3", ")", "print", "(", "RESULTS", ".", "format", "(", "len", "(", "SINGLES", ")", ",", "len", "(", "TESTS", ")", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ")", "sys", ".", "exit", "(", "arg_6", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Command line entry point.\"\"\"\n    from argparse import ArgumentParser\n    from librarian.library import Library\n    import sys\n\n    arg_1 = ArgumentParser(\n        description=\"A test runner for each card in a librarian library.\")\n    arg_1.add_argument(\"library\", help=\"Library database\")\n    arg_1.add_argument(\"-t\", \"--tests\", default=\"test/\",\n                        help=\"Test directory\")\n    arg_2 = arg_1.parse_args(arg_0)\n\n    descovery(arg_2.tests)\n\n    arg_3 = Library(arg_2.library)\n    arg_4, arg_5, arg_6 = execute_tests(arg_3)\n    print(RESULTS.format(len(SINGLES), len(TESTS), arg_4, arg_5,\n                         arg_6))\n    sys.exit(arg_6)", "path": "greencard/greencard.py", "identifier": "main", "docstring": "Command line entry point.", "docstring_tokens": ["Command", "line", "entry", "point", "."], "nwo": "Nekroze/greencard", "score": 0.09252797783733271, "idx": 256112}
{"url": "https://github.com/ONSdigital/sdc-cryptography/blob/846feb2b27b1c62d35ff2c290c05abcead68b23c/sdc/crypto/encrypter.py#L5-L20", "sha": "846feb2b27b1c62d35ff2c290c05abcead68b23c", "docstring_summary": "This encrypts the supplied json and returns a jwe token.", "language": "python", "parameters": "(json, key_store, key_purpose)", "return_statement": "return JWEHelper.encrypt(payload, jwe_key.kid, key_store, key_purpose)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "get_key_for_purpose_and_type", "(", "arg_2", ",", "\"private\"", ")", "arg_4", "=", "JWTHelper", ".", "encode", "(", "arg_0", ",", "arg_3", ".", "kid", ",", "arg_1", ",", "arg_2", ")", "arg_5", "=", "arg_1", ".", "get_key_for_purpose_and_type", "(", "arg_2", ",", "\"public\"", ")", "return", "JWEHelper", ".", "Func", "(", "arg_4", ",", "arg_5", ".", "kid", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"This Funcs the supplied json and returns a jwe token.\n\n    :param str json: The json to be Funced.\n    :param key_store: The key store.\n    :param str key_purpose: Context for the key.\n    :return: A jwe token.\n\n    \"\"\"\n    arg_3 = arg_1.get_key_for_purpose_and_type(arg_2, \"private\")\n\n    arg_4 = JWTHelper.encode(arg_0, arg_3.kid, arg_1, arg_2)\n\n    arg_5 = arg_1.get_key_for_purpose_and_type(arg_2, \"public\")\n\n    return JWEHelper.Func(arg_4, arg_5.kid, arg_1, arg_2)", "path": "sdc/crypto/encrypter.py", "identifier": "encrypt", "docstring": "This encrypts the supplied json and returns a jwe token.\n\n    :param str json: The json to be encrypted.\n    :param key_store: The key store.\n    :param str key_purpose: Context for the key.\n    :return: A jwe token.", "docstring_tokens": ["This", "encrypts", "the", "supplied", "json", "and", "returns", "a", "jwe", "token", "."], "nwo": "ONSdigital/sdc-cryptography", "score": 0.3588333959790546, "idx": 256113}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L267-L278", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Checks whetner the trace and log files are available", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "trace_file", ")", ":", "raise", "eh", ".", "InspectionError", "(", "\"The provided trace file could not be \"", "\"opened: {}\"", ".", "format", "(", "arg_0", ".", "trace_file", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "log_file", ")", ":", "raise", "eh", ".", "InspectionError", "(", "\"The .nextflow.log files could not be \"", "\"opened. Are you sure you are in a \"", "\"nextflow project directory?\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Checks whetner the trace and log files are available\n        \"\"\"\n\n        if not os.path.exists(arg_0.trace_file):\n            raise eh.InspectionError(\"The provided trace file could not be \"\n                                     \"opened: {}\".format(arg_0.trace_file))\n\n        if not os.path.exists(arg_0.log_file):\n            raise eh.InspectionError(\"The .nextflow.log files could not be \"\n                                     \"opened. Are you sure you are in a \"\n                                     \"nextflow project directory?\")", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector._check_required_files", "docstring": "Checks whetner the trace and log files are available", "docstring_tokens": ["Checks", "whetner", "the", "trace", "and", "log", "files", "are", "available"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 256114}
{"url": "https://github.com/Terrance/SkPy/blob/0f9489c94e8ec4d3effab4314497428872a80ad1/skpy/main.py#L120-L129", "sha": "0f9489c94e8ec4d3effab4314497428872a80ad1", "docstring_summary": "Update the activity message for the current user.", "language": "python", "parameters": "(self, mood)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "conn", "(", "\"POST\"", ",", "\"{0}/users/{1}/profile/partial\"", ".", "format", "(", "SkypeConnection", ".", "API_USER", ",", "arg_0", ".", "userId", ")", ",", "auth", "=", "SkypeConnection", ".", "Auth", ".", "SkypeToken", ",", "json", "=", "{", "\"payload\"", ":", "{", "\"mood\"", ":", "arg_1", "or", "\"\"", "}", "}", ")", "arg_0", ".", "user", ".", "mood", "=", "SkypeUser", ".", "Mood", "(", "plain", "=", "arg_1", ")", "if", "arg_1", "else", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Update the activity message for the current user.\n\n        Args:\n            mood (str): new mood message\n        \"\"\"\n        arg_0.conn(\"POST\", \"{0}/users/{1}/profile/partial\".format(SkypeConnection.API_USER, arg_0.userId),\n                  auth=SkypeConnection.Auth.SkypeToken, json={\"payload\": {\"mood\": arg_1 or \"\"}})\n        arg_0.user.mood = SkypeUser.Mood(plain=arg_1) if arg_1 else None", "path": "skpy/main.py", "identifier": "Skype.setMood", "docstring": "Update the activity message for the current user.\n\n        Args:\n            mood (str): new mood message", "docstring_tokens": ["Update", "the", "activity", "message", "for", "the", "current", "user", "."], "nwo": "Terrance/SkPy", "score": 0.6983298124827472, "idx": 256115}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2872-L2897", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Dump a certificate revocation list to a buffer.", "language": "python", "parameters": "(type, crl)", "return_statement": "return _bio_to_string(bio)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_new_mem_buf", "(", ")", "if", "arg_0", "==", "FILETYPE_PEM", ":", "arg_3", "=", "_lib", ".", "PEM_write_bio_X509_CRL", "(", "arg_2", ",", "arg_1", ".", "_crl", ")", "elif", "arg_0", "==", "FILETYPE_ASN1", ":", "arg_3", "=", "_lib", ".", "i2d_X509_CRL_bio", "(", "arg_2", ",", "arg_1", ".", "_crl", ")", "elif", "arg_0", "==", "FILETYPE_TEXT", ":", "arg_3", "=", "_lib", ".", "X509_CRL_print", "(", "arg_2", ",", "arg_1", ".", "_crl", ")", "else", ":", "raise", "ValueError", "(", "\"type argument must be FILETYPE_PEM, FILETYPE_ASN1, or \"", "\"FILETYPE_TEXT\"", ")", "assert", "arg_3", "==", "1", "return", "_bio_to_string", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Dump a certificate revocation list to a buffer.\n\n    :param type: The file type (one of ``FILETYPE_PEM``, ``FILETYPE_ASN1``, or\n        ``FILETYPE_TEXT``).\n    :param CRL crl: The CRL to dump.\n\n    :return: The buffer with the CRL.\n    :rtype: bytes\n    \"\"\"\n    arg_2 = _new_mem_buf()\n\n    if arg_0 == FILETYPE_PEM:\n        arg_3 = _lib.PEM_write_bio_X509_CRL(arg_2, arg_1._crl)\n    elif arg_0 == FILETYPE_ASN1:\n        arg_3 = _lib.i2d_X509_CRL_bio(arg_2, arg_1._crl)\n    elif arg_0 == FILETYPE_TEXT:\n        arg_3 = _lib.X509_CRL_print(arg_2, arg_1._crl)\n    else:\n        raise ValueError(\n            \"type argument must be FILETYPE_PEM, FILETYPE_ASN1, or \"\n            \"FILETYPE_TEXT\")\n\n    assert arg_3 == 1\n    return _bio_to_string(arg_2)", "path": "src/OpenSSL/crypto.py", "identifier": "dump_crl", "docstring": "Dump a certificate revocation list to a buffer.\n\n    :param type: The file type (one of ``FILETYPE_PEM``, ``FILETYPE_ASN1``, or\n        ``FILETYPE_TEXT``).\n    :param CRL crl: The CRL to dump.\n\n    :return: The buffer with the CRL.\n    :rtype: bytes", "docstring_tokens": ["Dump", "a", "certificate", "revocation", "list", "to", "a", "buffer", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256116}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/mapper/compiling.py#L27-L32", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Deprecated after 0.8", "language": "python", "parameters": "(unitary_matrix, verify_gate_sequence=False)", "return_statement": "return synthesis.two_qubit_kak(unitary_matrix)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"Func function is now accessible under \"", "\"qiskit.quantum_info.synthesis\"", ",", "DeprecationWarning", ")", "return", "synthesis", ".", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"Deprecated after 0.8\n    \"\"\"\n    warnings.warn(\"Func function is now accessible under \"\n                  \"qiskit.quantum_info.synthesis\", DeprecationWarning)\n    return synthesis.Func(arg_0)", "path": "qiskit/mapper/compiling.py", "identifier": "two_qubit_kak", "docstring": "Deprecated after 0.8", "docstring_tokens": ["Deprecated", "after", "0", ".", "8"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256117}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L211-L240", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Create a new environment.", "language": "python", "parameters": "(name_or_path, config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ":", "arg_2", "=", "click", ".", "get_current_context", "(", ")", "click", ".", "echo", "(", "arg_2", ".", "get_help", "(", ")", ")", "arg_3", "=", "(", "'\\nExamples:\\n'", "'    cpenv Func my_env\\n'", "'    cpenv Func ./relative/path/to/my_env\\n'", "'    cpenv Func my_env --config ./relative/path/to/config\\n'", "'    cpenv Func my_env --config git@github.com:user/config.git\\n'", ")", "click", ".", "echo", "(", "arg_3", ")", "return", "click", ".", "echo", "(", "blue", "(", "'Creating a new virtual environment '", "+", "arg_0", ")", ")", "try", ":", "arg_4", "=", "cpenv", ".", "Func", "(", "arg_0", ",", "arg_1", ")", "except", "Exception", "as", "e", ":", "click", ".", "echo", "(", "bold_red", "(", "'FAILED TO CREATE ENVIRONMENT!'", ")", ")", "click", ".", "echo", "(", "e", ")", "else", ":", "click", ".", "echo", "(", "bold_green", "(", "'Successfully Funcd environment!'", ")", ")", "click", ".", "echo", "(", "blue", "(", "'Launching subshell'", ")", ")", "cpenv", ".", "activate", "(", "arg_4", ")", "shell", ".", "launch", "(", "arg_4", ".", "name", ")"], "function": "def Func(arg_0, arg_1):\n    '''Create a new environment.'''\n\n    if not arg_0:\n        arg_2 = click.get_current_context()\n        click.echo(arg_2.get_help())\n        arg_3 = (\n            '\\nExamples:\\n'\n            '    cpenv Func my_env\\n'\n            '    cpenv Func ./relative/path/to/my_env\\n'\n            '    cpenv Func my_env --config ./relative/path/to/config\\n'\n            '    cpenv Func my_env --config git@github.com:user/config.git\\n'\n        )\n        click.echo(arg_3)\n        return\n\n    click.echo(\n        blue('Creating a new virtual environment ' + arg_0)\n    )\n    try:\n        arg_4 = cpenv.Func(arg_0, arg_1)\n    except Exception as e:\n        click.echo(bold_red('FAILED TO CREATE ENVIRONMENT!'))\n        click.echo(e)\n    else:\n        click.echo(bold_green('Successfully Funcd environment!'))\n    click.echo(blue('Launching subshell'))\n\n    cpenv.activate(arg_4)\n    shell.launch(arg_4.name)", "path": "cpenv/cli.py", "identifier": "create", "docstring": "Create a new environment.", "docstring_tokens": ["Create", "a", "new", "environment", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 256118}
{"url": "https://github.com/iMakedonsky/drf-autodocs/blob/06c2d1d5a9cd23e698310dbce6100463bd8c3f46/drf_autodocs/decorators.py#L32-L39", "sha": "06c2d1d5a9cd23e698310dbce6100463bd8c3f46", "docstring_summary": "Decorator for clean docstring formatting", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "def", "decorator", "(", "arg_2", ")", ":", "arg_2", ".", "__doc__", "=", "getdoc", "(", "arg_2", ")", ".", "format", "(", "*", "arg_0", ",", "**", "arg_1", ")", "return", "arg_2", "return", "decorator"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    Decorator for clean docstring formatting\n    \"\"\"\n    def decorator(arg_2):\n        arg_2.__doc__ = getdoc(arg_2).format(*arg_0, **arg_1)\n        return arg_2\n    return decorator", "path": "drf_autodocs/decorators.py", "identifier": "format_docstring", "docstring": "Decorator for clean docstring formatting", "docstring_tokens": ["Decorator", "for", "clean", "docstring", "formatting"], "nwo": "iMakedonsky/drf-autodocs", "score": 0.3483776041480482, "idx": 256119}
{"url": "https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L186-L200", "sha": "897934d593fade0eb1998f8fadd18c91a89e5b9a", "docstring_summary": "Returns the jQuery Dynamic Formset plugin file according to version number.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.", "language": "python", "parameters": "(version=None)", "return_statement": "return format_html(template, static=_static_url, v=version)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_FORMSET'", ",", "DJFRONTEND_JQUERY_FORMSET_DEFAULT", ")", "if", "getattr", "(", "settings", ",", "'TEMPLATE_DEBUG'", ",", "False", ")", ":", "arg_1", "=", "'<script src=\"{static}djfrontend/js/jquery/jquery.formset/{v}/jquery.formset.js\"></script>'", "else", ":", "arg_1", "=", "(", "'<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery.formset/{v}/jquery.formset.min.js\"></script>\\n'", "'<script>window.jQuery.fn.formset || document.write(\\'<script src=\"{static}djfrontend/js/jquery/jquery.formset/{v}/jquery.formset.min.js\"><\\/script>\\')</script>'", ")", "return", "format_html", "(", "arg_1", ",", "static", "=", "_static_url", ",", "v", "=", "arg_0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Returns the jQuery Dynamic Formset plugin file according to version number.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.\n    \"\"\"\n    if arg_0 is None:\n        arg_0 = getattr(settings, 'DJFRONTEND_JQUERY_FORMSET', DJFRONTEND_JQUERY_FORMSET_DEFAULT)\n\n    if getattr(settings, 'TEMPLATE_DEBUG', False):\n        arg_1 = '<script src=\"{static}djfrontend/js/jquery/jquery.formset/{v}/jquery.formset.js\"></script>'\n    else:\n        arg_1 = (\n            '<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery.formset/{v}/jquery.formset.min.js\"></script>\\n'\n            '<script>window.jQuery.fn.formset || document.write(\\'<script src=\"{static}djfrontend/js/jquery/jquery.formset/{v}/jquery.formset.min.js\"><\\/script>\\')</script>')\n    return format_html(arg_1, static=_static_url, v=arg_0)", "path": "djfrontend/templatetags/djfrontend.py", "identifier": "djfrontend_jquery_formset", "docstring": "Returns the jQuery Dynamic Formset plugin file according to version number.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.", "docstring_tokens": ["Returns", "the", "jQuery", "Dynamic", "Formset", "plugin", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "."], "nwo": "jonfaustman/django-frontend", "score": 0.1952535678330188, "idx": 256120}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L264-L303", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Uploads a file to S3", "language": "python", "parameters": "(self, fileobj, bucket, key, extra_args=None, subscribers=None)", "return_statement": "return self._submit_transfer(\n            call_args, UploadSubmissionTask, extra_main_kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "{", "}", "if", "arg_5", "is", "None", ":", "arg_5", "=", "[", "]", "arg_0", ".", "_validate_all_known_args", "(", "arg_4", ",", "arg_0", ".", "ALLOWED_UPLOAD_ARGS", ")", "arg_6", "=", "CallArgs", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_7", "=", "{", "}", "if", "arg_0", ".", "_bandwidth_limiter", ":", "arg_7", "[", "'bandwidth_limiter'", "]", "=", "arg_0", ".", "_bandwidth_limiter", "return", "arg_0", ".", "_submit_transfer", "(", "arg_6", ",", "UploadSubmissionTask", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None):\n        \"\"\"Uploads a file to S3\n\n        :type fileobj: str or seekable file-like object\n        :param fileobj: The name of a file to Func or a seekable file-like\n            object to Func. It is recommended to use a filename because\n            file-like objects may result in higher memory usage.\n\n        :type bucket: str\n        :param bucket: The name of the bucket to Func to\n\n        :type key: str\n        :param key: The name of the key to Func to\n\n        :type extra_args: dict\n        :param extra_args: Extra arguments that may be passed to the\n            client operation\n\n        :type subscribers: list(s3transfer.subscribers.BaseSubscriber)\n        :param subscribers: The list of subscribers to be invoked in the\n            order provided based on the event emit during the process of\n            the transfer request.\n\n        :rtype: s3transfer.futures.TransferFuture\n        :returns: Transfer future representing the Func\n        \"\"\"\n        if arg_4 is None:\n            arg_4 = {}\n        if arg_5 is None:\n            arg_5 = []\n        arg_0._validate_all_known_args(arg_4, arg_0.ALLOWED_UPLOAD_ARGS)\n        arg_6 = CallArgs(\n            arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,\n            arg_5=arg_5\n        )\n        arg_7 = {}\n        if arg_0._bandwidth_limiter:\n            arg_7['bandwidth_limiter'] = arg_0._bandwidth_limiter\n        return arg_0._submit_transfer(\n            arg_6, UploadSubmissionTask, arg_7)", "path": "s3transfer/manager.py", "identifier": "TransferManager.upload", "docstring": "Uploads a file to S3\n\n        :type fileobj: str or seekable file-like object\n        :param fileobj: The name of a file to upload or a seekable file-like\n            object to upload. It is recommended to use a filename because\n            file-like objects may result in higher memory usage.\n\n        :type bucket: str\n        :param bucket: The name of the bucket to upload to\n\n        :type key: str\n        :param key: The name of the key to upload to\n\n        :type extra_args: dict\n        :param extra_args: Extra arguments that may be passed to the\n            client operation\n\n        :type subscribers: list(s3transfer.subscribers.BaseSubscriber)\n        :param subscribers: The list of subscribers to be invoked in the\n            order provided based on the event emit during the process of\n            the transfer request.\n\n        :rtype: s3transfer.futures.TransferFuture\n        :returns: Transfer future representing the upload", "docstring_tokens": ["Uploads", "a", "file", "to", "S3"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 256121}
{"url": "https://github.com/loanzen/probe-py/blob/b5dbb0dba26c9b451e9bf1dec9e1aaa7f42d75a5/probe/api_client.py#L381-L406", "sha": "b5dbb0dba26c9b451e9bf1dec9e1aaa7f42d75a5", "docstring_summary": "Builds form parameters.", "language": "python", "parameters": "(self, post_params=None, files=None)", "return_statement": "return params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "}", "if", "arg_1", ":", "arg_3", ".", "update", "(", "arg_1", ")", "if", "arg_2", ":", "for", "arg_4", ",", "arg_5", "in", "iteritems", "(", "arg_2", ")", ":", "if", "not", "arg_5", ":", "continue", "with", "open", "(", "arg_5", ",", "'rb'", ")", "as", "f", ":", "arg_6", "=", "os", ".", "path", ".", "basename", "(", "f", ".", "name", ")", "arg_7", "=", "f", ".", "read", "(", ")", "arg_8", "=", "mimetypes", ".", "guess_type", "(", "arg_6", ")", "[", "0", "]", "or", "'application/octet-stream'", "arg_3", "[", "arg_4", "]", "=", "tuple", "(", "[", "arg_6", ",", "arg_7", ",", "arg_8", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Builds form parameters.\n\n        :param post_params: Normal form parameters.\n        :param files: File parameters.\n        :return: Form parameters with files.\n        \"\"\"\n        arg_3 = {}\n\n        if arg_1:\n            arg_3.update(arg_1)\n\n        if arg_2:\n            for arg_4, arg_5 in iteritems(arg_2):\n                if not arg_5:\n                    continue\n\n                with open(arg_5, 'rb') as f:\n                    arg_6 = os.path.basename(f.name)\n                    arg_7 = f.read()\n                    arg_8 = mimetypes.\\\n                        guess_type(arg_6)[0] or 'application/octet-stream'\n                    arg_3[arg_4] = tuple([arg_6, arg_7, arg_8])\n\n        return arg_3", "path": "probe/api_client.py", "identifier": "ApiClient.prepare_post_parameters", "docstring": "Builds form parameters.\n\n        :param post_params: Normal form parameters.\n        :param files: File parameters.\n        :return: Form parameters with files.", "docstring_tokens": ["Builds", "form", "parameters", "."], "nwo": "loanzen/probe-py", "score": 0.14991498758945482, "idx": 256122}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/utils.py#L641-L645", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Try to find some reasonable name for the object.", "language": "python", "parameters": "(object)", "return_statement": "return (getattr(object, 'name', 0) or getattr(object, '__name__', 0)\n            or getattr(getattr(object, '__class__', 0), '__name__', 0)\n            or str(object))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "getattr", "(", "arg_0", ",", "'Func'", ",", "0", ")", "or", "getattr", "(", "arg_0", ",", "'__Func__'", ",", "0", ")", "or", "getattr", "(", "getattr", "(", "arg_0", ",", "'__class__'", ",", "0", ")", ",", "'__Func__'", ",", "0", ")", "or", "str", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"Try to find some reasonable Func for the object.\"\n    return (getattr(arg_0, 'Func', 0) or getattr(arg_0, '__Func__', 0)\n            or getattr(getattr(arg_0, '__class__', 0), '__Func__', 0)\n            or str(arg_0))", "path": "aima/utils.py", "identifier": "name", "docstring": "Try to find some reasonable name for the object.", "docstring_tokens": ["Try", "to", "find", "some", "reasonable", "name", "for", "the", "object", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 256123}
{"url": "https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/cli.py#L101-L105", "sha": "71c798378e365286b7cc03c06e4d7d24c7de8fc4", "docstring_summary": "Return password from pipe if not on TTY, else False.", "language": "python", "parameters": "(cls)", "return_statement": "return is_pipe and cls.strip_last_newline(sys.stdin.read())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "not", "sys", ".", "stdin", ".", "isatty", "(", ")", "return", "arg_1", "and", "arg_0", ".", "strip_last_newline", "(", "sys", ".", "stdin", ".", "read", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return password from pipe if not on TTY, else False.\n        \"\"\"\n        arg_1 = not sys.stdin.isatty()\n        return arg_1 and arg_0.strip_last_newline(sys.stdin.read())", "path": "keyring/cli.py", "identifier": "CommandLineTool.pass_from_pipe", "docstring": "Return password from pipe if not on TTY, else False.", "docstring_tokens": ["Return", "password", "from", "pipe", "if", "not", "on", "TTY", "else", "False", "."], "nwo": "jaraco/keyring", "score": 0.7254776697026839, "idx": 256124}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L200-L254", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if original and overridden methods arguments have different default values", "language": "python", "parameters": "(original, overridden)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "args", "is", "None", "or", "arg_1", ".", "args", "is", "None", ":", "return", "False", "arg_2", "=", "chain", "(", "arg_0", ".", "args", ",", "arg_0", ".", "kwonlyargs", ")", "arg_3", "=", "[", "param", ".", "name", "for", "param", "in", "arg_2", "]", "arg_4", "=", "object", "(", ")", "for", "arg_5", "in", "arg_3", ":", "try", ":", "arg_6", "=", "arg_0", ".", "default_value", "(", "arg_5", ")", "except", "astroid", ".", "exceptions", ".", "NoDefault", ":", "arg_6", "=", "arg_4", "try", ":", "arg_7", "=", "arg_1", ".", "default_value", "(", "arg_5", ")", "except", "astroid", ".", "exceptions", ".", "NoDefault", ":", "arg_7", "=", "arg_4", "arg_8", "=", "[", "arg", "==", "arg_4", "for", "arg", "in", "(", "arg_6", ",", "arg_7", ")", "]", "if", "any", "(", "arg_8", ")", "and", "not", "all", "(", "arg_8", ")", ":", "return", "True", "arg_9", "=", "{", "astroid", ".", "Const", ":", "\"value\"", ",", "astroid", ".", "ClassDef", ":", "\"name\"", ",", "astroid", ".", "Tuple", ":", "\"elts\"", ",", "astroid", ".", "List", ":", "\"elts\"", ",", "}", "arg_10", "=", "tuple", "(", "astroid_type", "for", "astroid_type", "in", "arg_9", ")", "arg_11", "=", "_get_node_type", "(", "arg_6", ",", "arg_10", ")", "if", "arg_11", ":", "if", "not", "isinstance", "(", "arg_7", ",", "arg_11", ")", ":", "return", "True", "if", "not", "_check_arg_equality", "(", "arg_6", ",", "arg_7", ",", "arg_9", "[", "arg_11", "]", ",", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Check if original and overridden methods arguments have different default values\n\n    Return True if one of the overridden arguments has a default\n    value different from the default value of the original argument\n    If one of the method doesn't have argument (.args is None)\n    return False\n    \"\"\"\n    if arg_0.args is None or arg_1.args is None:\n        return False\n\n    arg_2 = chain(arg_0.args, arg_0.kwonlyargs)\n    arg_3 = [param.name for param in arg_2]\n    arg_4 = object()\n    for arg_5 in arg_3:\n        try:\n            arg_6 = arg_0.default_value(arg_5)\n        except astroid.exceptions.NoDefault:\n            arg_6 = arg_4\n        try:\n            arg_7 = arg_1.default_value(arg_5)\n        except astroid.exceptions.NoDefault:\n            arg_7 = arg_4\n\n        arg_8 = [\n            arg == arg_4 for arg in (arg_6, arg_7)\n        ]\n        if any(arg_8) and not all(arg_8):\n            # Only one arg has no default value\n            return True\n\n        arg_9 = {\n            astroid.Const: \"value\",\n            astroid.ClassDef: \"name\",\n            astroid.Tuple: \"elts\",\n            astroid.List: \"elts\",\n        }\n        arg_10 = tuple(\n            astroid_type for astroid_type in arg_9\n        )\n        arg_11 = _get_node_type(arg_6, arg_10)\n        if arg_11:\n            # \u00a0We handle only astroid types that are inside the dict astroid_type_compared_attr\n            if not isinstance(arg_7, arg_11):\n                # \u00a0Two args with same name but different types\n                return True\n            if not _check_arg_equality(\n                arg_6,\n                arg_7,\n                arg_9[arg_11],\n            ):\n                # Two args with same type but different values\n                return True\n    return False", "path": "pylint/checkers/classes.py", "identifier": "_has_different_parameters_default_value", "docstring": "Check if original and overridden methods arguments have different default values\n\n    Return True if one of the overridden arguments has a default\n    value different from the default value of the original argument\n    If one of the method doesn't have argument (.args is None)\n    return False", "docstring_tokens": ["Check", "if", "original", "and", "overridden", "methods", "arguments", "have", "different", "default", "values"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256125}
{"url": "https://github.com/sendwithus/sendwithus_python/blob/8ae50d514febd44f7d9be3c838b4d92f99412832/sendwithus/__init__.py#L776-L806", "sha": "8ae50d514febd44f7d9be3c838b4d92f99412832", "docstring_summary": "Execute all currently queued batch commands", "language": "python", "parameters": "(self, timeout=None)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "logger", ".", "debug", "(", "' > Batch API request (length %s)'", "%", "len", "(", "arg_0", ".", "_commands", ")", ")", "arg_2", "=", "arg_0", ".", "_build_http_auth", "(", ")", "arg_3", "=", "arg_0", ".", "_build_request_headers", "(", ")", "logger", ".", "debug", "(", "'\\tbatch headers: %s'", "%", "arg_3", ")", "logger", ".", "debug", "(", "'\\tbatch command length: %s'", "%", "len", "(", "arg_0", ".", "_commands", ")", ")", "arg_4", "=", "arg_0", ".", "_build_request_path", "(", "arg_0", ".", "BATCH_ENDPOINT", ")", "arg_5", "=", "json", ".", "dumps", "(", "arg_0", ".", "_commands", ",", "cls", "=", "arg_0", ".", "_json_encoder", ")", "arg_6", "=", "requests", ".", "post", "(", "arg_4", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_1", "=", "(", "arg_0", ".", "DEFAULT_TIMEOUT", "if", "arg_1", "is", "None", "else", "arg_1", ")", ")", "arg_0", ".", "_commands", "=", "[", "]", "logger", ".", "debug", "(", "'\\tresponse code:%s'", "%", "arg_6", ".", "status_code", ")", "try", ":", "logger", ".", "debug", "(", "'\\tresponse: %s'", "%", "arg_6", ".", "json", "(", ")", ")", "except", ":", "logger", ".", "debug", "(", "'\\tresponse: %s'", "%", "arg_6", ".", "content", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Execute all currently queued batch commands\"\"\"\n        logger.debug(' > Batch API request (length %s)' % len(arg_0._commands))\n\n        arg_2 = arg_0._build_http_auth()\n\n        arg_3 = arg_0._build_request_headers()\n        logger.debug('\\tbatch headers: %s' % arg_3)\n\n        logger.debug('\\tbatch command length: %s' % len(arg_0._commands))\n\n        arg_4 = arg_0._build_request_path(arg_0.BATCH_ENDPOINT)\n\n        arg_5 = json.dumps(arg_0._commands, cls=arg_0._json_encoder)\n        arg_6 = requests.post(\n            arg_4,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_5=arg_5,\n            arg_1=(arg_0.DEFAULT_TIMEOUT if arg_1 is None else arg_1)\n        )\n\n        arg_0._commands = []\n\n        logger.debug('\\tresponse code:%s' % arg_6.status_code)\n        try:\n            logger.debug('\\tresponse: %s' % arg_6.json())\n        except:\n            logger.debug('\\tresponse: %s' % arg_6.content)\n\n        return arg_6", "path": "sendwithus/__init__.py", "identifier": "BatchAPI.execute", "docstring": "Execute all currently queued batch commands", "docstring_tokens": ["Execute", "all", "currently", "queued", "batch", "commands"], "nwo": "sendwithus/sendwithus_python", "score": 0.2828805321802978, "idx": 256126}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L684-L711", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Download an item to disk.", "language": "python", "parameters": "(self, item_id, token=None, revision=None)", "return_statement": "return filename, request.iter_content(chunk_size=10 * 1024)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "dict", "(", ")", "arg_4", "[", "'id'", "]", "=", "arg_1", "if", "arg_2", ":", "arg_4", "[", "'token'", "]", "=", "arg_2", "if", "arg_3", ":", "arg_4", "[", "'revision'", "]", "=", "arg_3", "arg_5", "=", "arg_0", ".", "full_url", "+", "'midas.item.download'", "arg_6", "=", "requests", ".", "get", "(", "arg_5", ",", "params", "=", "arg_4", ",", "stream", "=", "True", ",", "verify", "=", "arg_0", ".", "_verify_ssl_certificate", ")", "arg_7", "=", "arg_6", ".", "headers", "[", "'content-disposition'", "]", "[", "21", ":", "]", ".", "strip", "(", "'\"'", ")", "return", "arg_7", ",", "arg_6", ".", "iter_content", "(", "chunk_size", "=", "10", "*", "1024", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n        Download an item to disk.\n\n        :param item_id: The id of the item to be downloaded.\n        :type item_id: int | long\n        :param token: (optional) The authentication token of the user\n            requesting the download.\n        :type token: None | string\n        :param revision: (optional) The revision of the item to download, this\n            defaults to HEAD.\n        :type revision: None | int | long\n        :returns: A tuple of the filename and the content iterator.\n        :rtype: (string, unknown)\n        \"\"\"\n        arg_4 = dict()\n        arg_4['id'] = arg_1\n        if arg_2:\n            arg_4['token'] = arg_2\n        if arg_3:\n            arg_4['revision'] = arg_3\n        arg_5 = arg_0.full_url + 'midas.item.download'\n        arg_6 = requests.get(arg_5,\n                               params=arg_4,\n                               stream=True,\n                               verify=arg_0._verify_ssl_certificate)\n        arg_7 = arg_6.headers['content-disposition'][21:].strip('\"')\n        return arg_7, arg_6.iter_content(chunk_size=10 * 1024)", "path": "pydas/drivers.py", "identifier": "CoreDriver.download_item", "docstring": "Download an item to disk.\n\n        :param item_id: The id of the item to be downloaded.\n        :type item_id: int | long\n        :param token: (optional) The authentication token of the user\n            requesting the download.\n        :type token: None | string\n        :param revision: (optional) The revision of the item to download, this\n            defaults to HEAD.\n        :type revision: None | int | long\n        :returns: A tuple of the filename and the content iterator.\n        :rtype: (string, unknown)", "docstring_tokens": ["Download", "an", "item", "to", "disk", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 256127}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/states.py#L797-L847", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Sets the memory usage level of the state.", "language": "python", "parameters": "(self, mem_level='hi')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'hi'", ")", ":", "arg_2", "=", "''", ".", "join", "(", "[", "arg_11", "if", "arg_11", "in", "'mlh'", "else", "''", "for", "arg_11", "in", "arg_1", "]", ")", "if", "arg_2", "not", "in", "[", "'h'", ",", "'mh'", ",", "'m'", ",", "'ml'", ",", "'m'", ",", "'l'", "]", ":", "raise", "ValueError", "(", "'mem_level must be one of hi, med-hi, med, med-lo, lo.'", ")", "arg_3", "=", "{", "'h'", ":", "[", "np", ".", "float64", ",", "np", ".", "float64", "]", ",", "'mh'", ":", "[", "np", ".", "float64", ",", "np", ".", "float32", "]", ",", "'m'", ":", "[", "np", ".", "float32", ",", "np", ".", "float32", "]", ",", "'ml'", ":", "[", "np", ".", "float32", ",", "np", ".", "float16", "]", ",", "'l'", ":", "[", "np", ".", "float16", ",", "np", ".", "float16", "]", "}", "arg_4", ",", "arg_5", "=", "arg_3", "[", "arg_2", "]", "arg_6", "=", "{", "'obj'", ":", "arg_5", ",", "'ilm'", ":", "arg_4", ",", "'bkg'", ":", "arg_5", "}", "arg_0", ".", "image", ".", "float_precision", "=", "arg_4", "arg_0", ".", "image", ".", "image", "=", "arg_0", ".", "image", ".", "image", ".", "astype", "(", "arg_5", ")", "arg_0", ".", "set_image", "(", "arg_0", ".", "image", ")", "for", "arg_9", "in", "arg_6", ".", "keys", "(", ")", ":", "arg_10", "=", "arg_0", ".", "get", "(", "arg_9", ")", "if", "hasattr", "(", "arg_10", ",", "'comps'", ")", ":", "for", "arg_11", "in", "arg_10", ".", "comps", ":", "arg_11", ".", "float_precision", "=", "arg_5", "else", ":", "arg_10", ".", "float_precision", "=", "arg_5", "arg_0", ".", "_model", "=", "arg_0", ".", "_model", ".", "astype", "(", "arg_4", ")", "arg_0", ".", "_residuals", "=", "arg_0", ".", "_model", ".", "astype", "(", "arg_4", ")", "arg_0", ".", "reset", "(", ")"], "function": "def Func(arg_0, arg_1='hi'):\n        \"\"\"\n        Sets the memory usage level of the state.\n\n        Parameters\n        ----------\n        mem_level : string\n            Can be set to one of:\n                * hi      : all mem's are np.float64\n                * med-hi  : image, platonic are float32, rest are float64\n                * med     : all mem's are float32\n                * med-lo  : image, platonic are float16, rest float32\n                * lo      : all are float16, which is bad for accuracy.\n\n        Notes\n        -----\n        Right now the PSF is not affected by the mem-level changes, which is\n        OK for mem but it means that self._model, self._residuals are always\n        float64, which can be a chunk of mem.\n        \"\"\"\n        #A little thing to parse strings for convenience:\n        arg_2 = ''.join([arg_11 if arg_11 in 'mlh' else '' for arg_11 in arg_1])\n        if arg_2 not in ['h','mh','m','ml','m', 'l']:\n            raise ValueError('mem_level must be one of hi, med-hi, med, med-lo, lo.')\n        arg_3 = {  'h':     [np.float64, np.float64],\n                        'mh': [np.float64, np.float32],\n                        'm':   [np.float32, np.float32],\n                        'ml':  [np.float32, np.float16],\n                        'l':      [np.float16, np.float16]\n                    }\n        arg_4, arg_5 = arg_3[arg_2]\n        arg_6 = {'obj':arg_5,\n                    'ilm':arg_4,\n                    'bkg':arg_5\n                    }  #no psf...\n\n        arg_0.image.float_precision = arg_4\n        arg_0.image.image = arg_0.image.image.astype(arg_5)\n        arg_0.set_image(arg_0.image)\n\n        for arg_9 in arg_6.keys():\n            arg_10 = arg_0.get(arg_9)\n            #check if it's a component collection\n            if hasattr(arg_10, 'comps'):\n                for arg_11 in arg_10.comps:\n                    arg_11.float_precision = arg_5\n            else:\n                arg_10.float_precision = arg_5\n        arg_0._model = arg_0._model.astype(arg_4)\n        arg_0._residuals = arg_0._model.astype(arg_4)\n        arg_0.reset()", "path": "peri/states.py", "identifier": "ImageState.set_mem_level", "docstring": "Sets the memory usage level of the state.\n\n        Parameters\n        ----------\n        mem_level : string\n            Can be set to one of:\n                * hi      : all mem's are np.float64\n                * med-hi  : image, platonic are float32, rest are float64\n                * med     : all mem's are float32\n                * med-lo  : image, platonic are float16, rest float32\n                * lo      : all are float16, which is bad for accuracy.\n\n        Notes\n        -----\n        Right now the PSF is not affected by the mem-level changes, which is\n        OK for mem but it means that self._model, self._residuals are always\n        float64, which can be a chunk of mem.", "docstring_tokens": ["Sets", "the", "memory", "usage", "level", "of", "the", "state", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 256128}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py#L864-L874", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reply with connection addresses for clients.", "language": "python", "parameters": "(self, client_id, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"client::client %r connected\"", ",", "arg_1", ")", "arg_3", "=", "dict", "(", "status", "=", "'ok'", ")", "arg_3", ".", "update", "(", "arg_0", ".", "client_info", ")", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "keytable", ".", "iteritems", "(", ")", ":", "if", "arg_6", "not", "in", "arg_0", ".", "dead_engines", ":", "arg_4", "[", "arg_7", "(", "arg_5", ")", "]", "=", "arg_6", ".", "decode", "(", "'ascii'", ")", "arg_3", "[", "'engines'", "]", "=", "arg_4", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "query", ",", "'connection_reply'", ",", "arg_3", ",", "parent", "=", "arg_2", ",", "ident", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Reply with connection addresses for clients.\"\"\"\n        arg_0.log.info(\"client::client %r connected\", arg_1)\n        arg_3 = dict(status='ok')\n        arg_3.update(arg_0.client_info)\n        arg_4 = {}\n        for arg_5,arg_6 in arg_0.keytable.iteritems():\n            if arg_6 not in arg_0.dead_engines:\n                arg_4[arg_7(arg_5)] = arg_6.decode('ascii')\n        arg_3['engines'] = arg_4\n        arg_0.session.send(arg_0.query, 'connection_reply', arg_3, parent=arg_2, ident=arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py", "identifier": "Hub.connection_request", "docstring": "Reply with connection addresses for clients.", "docstring_tokens": ["Reply", "with", "connection", "addresses", "for", "clients", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256129}
{"url": "https://github.com/ellmetha/neojsonrpc/blob/e369b633a727482d5f9e310f0c3337ae5f7265db/neojsonrpc/client.py#L74-L83", "sha": "e369b633a727482d5f9e310f0c3337ae5f7265db", "docstring_summary": "Returns the account state information associated with a specific address.", "language": "python", "parameters": "(self, address, **kwargs)", "return_statement": "return self._call(JSONRPCMethods.GET_ACCOUNT_STATE.value, params=[address, ], **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "_call", "(", "JSONRPCMethods", ".", "GET_ACCOUNT_STATE", ".", "value", ",", "params", "=", "[", "arg_1", ",", "]", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\" Returns the account state information associated with a specific address.\n\n        :param address: a 34-bit length address (eg. AJBENSwajTzQtwyJFkiJSv7MAaaMc7DsRz)\n        :type address: str\n        :return: dictionary containing the account state information\n        :rtype: dict\n\n        \"\"\"\n        return arg_0._call(JSONRPCMethods.GET_ACCOUNT_STATE.value, params=[arg_1, ], **arg_2)", "path": "neojsonrpc/client.py", "identifier": "Client.get_account_state", "docstring": "Returns the account state information associated with a specific address.\n\n        :param address: a 34-bit length address (eg. AJBENSwajTzQtwyJFkiJSv7MAaaMc7DsRz)\n        :type address: str\n        :return: dictionary containing the account state information\n        :rtype: dict", "docstring_tokens": ["Returns", "the", "account", "state", "information", "associated", "with", "a", "specific", "address", "."], "nwo": "ellmetha/neojsonrpc", "score": 0.3393344119717767, "idx": 256130}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/core/constraint.py#L476-L495", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "Create a copy.", "language": "python", "parameters": "(self)", "return_statement": "return self.__class__(self.func, self.configurations, self.variables, self.vartype, name=self.name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "__class__", "(", "arg_0", ".", "func", ",", "arg_0", ".", "configurations", ",", "arg_0", ".", "variables", ",", "arg_0", ".", "vartype", ",", "name", "=", "arg_0", ".", "name", ")"], "function": "def Func(arg_0):\n        \"\"\"Create a Func.\n\n        Examples:\n            This example copies constraint :math:`a \\\\ne b` and tests a solution\n            on the copied constraint.\n\n            >>> import dwavebinarycsp\n            >>> import operator\n            >>> const = dwavebinarycsp.Constraint.from_func(operator.ne,\n            ...             ['a', 'b'], 'BINARY')\n            >>> const2 = const.Func()\n            >>> const2 is const\n            False\n            >>> const2.check({'a': 1, 'b': 1})\n            False\n\n        \"\"\"\n        # each object is itself immutable (except the function)\n        return arg_0.__class__(arg_0.func, arg_0.configurations, arg_0.variables, arg_0.vartype, name=arg_0.name)", "path": "dwavebinarycsp/core/constraint.py", "identifier": "Constraint.copy", "docstring": "Create a copy.\n\n        Examples:\n            This example copies constraint :math:`a \\\\ne b` and tests a solution\n            on the copied constraint.\n\n            >>> import dwavebinarycsp\n            >>> import operator\n            >>> const = dwavebinarycsp.Constraint.from_func(operator.ne,\n            ...             ['a', 'b'], 'BINARY')\n            >>> const2 = const.copy()\n            >>> const2 is const\n            False\n            >>> const2.check({'a': 1, 'b': 1})\n            False", "docstring_tokens": ["Create", "a", "copy", "."], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 256131}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/drivers/ironic_driver.py#L290-L367", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Create a port.", "language": "python", "parameters": "(self, context, network_id, port_id, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "LOG", ".", "info", "(", "\"Func %s %s %s\"", "%", "(", "arg_1", ".", "tenant_id", ",", "arg_2", ",", "arg_3", ")", ")", "if", "not", "arg_4", ".", "get", "(", "'base_net_driver'", ")", ":", "raise", "IronicException", "(", "arg_9", "=", "'base_net_driver required.'", ")", "arg_5", "=", "arg_4", "[", "'base_net_driver'", "]", "if", "not", "arg_4", ".", "get", "(", "'device_id'", ")", ":", "raise", "IronicException", "(", "arg_9", "=", "'device_id required.'", ")", "arg_6", "=", "arg_4", "[", "'device_id'", "]", "if", "not", "arg_4", ".", "get", "(", "'instance_node_id'", ")", ":", "raise", "IronicException", "(", "arg_9", "=", "'instance_node_id required.'", ")", "arg_7", "=", "arg_4", "[", "'instance_node_id'", "]", "if", "not", "arg_4", ".", "get", "(", "'mac_address'", ")", ":", "raise", "IronicException", "(", "arg_9", "=", "'mac_address is required.'", ")", "arg_8", "=", "str", "(", "netaddr", ".", "EUI", "(", "arg_4", "[", "\"mac_address\"", "]", "[", "\"address\"", "]", ")", ")", "arg_8", "=", "arg_8", ".", "replace", "(", "'-'", ",", "':'", ")", "if", "arg_4", ".", "get", "(", "'security_groups'", ")", ":", "arg_9", "=", "'ironic driver does not support security group operations.'", "raise", "IronicException", "(", "arg_9", "=", "arg_9", ")", "arg_10", "=", "[", "]", "arg_11", "=", "arg_4", ".", "get", "(", "'addresses'", ")", "if", "not", "isinstance", "(", "arg_11", ",", "list", ")", ":", "arg_11", "=", "[", "arg_11", "]", "for", "arg_12", "in", "arg_11", ":", "arg_10", ".", "append", "(", "arg_0", ".", "_make_fixed_ip_dict", "(", "arg_1", ",", "arg_12", ")", ")", "arg_13", "=", "{", "\"id\"", ":", "arg_3", ",", "\"network_id\"", ":", "arg_2", ",", "\"device_id\"", ":", "arg_6", ",", "\"device_owner\"", ":", "arg_4", ".", "get", "(", "'device_owner'", ",", "''", ")", ",", "\"tenant_id\"", ":", "arg_1", ".", "tenant_id", "or", "\"quark\"", ",", "\"roles\"", ":", "arg_1", ".", "roles", ",", "\"mac_address\"", ":", "arg_8", ",", "\"fixed_ips\"", ":", "arg_10", ",", "\"switch:hardware_id\"", ":", "arg_7", ",", "\"dynamic_network\"", ":", "not", "STRATEGY", ".", "is_provider_network", "(", "arg_2", ")", "}", "arg_14", "=", "arg_0", ".", "_get_base_network_info", "(", "arg_1", ",", "arg_2", ",", "arg_5", ")", "arg_13", ".", "update", "(", "arg_14", ")", "try", ":", "LOG", ".", "info", "(", "\"creating downstream port: %s\"", "%", "(", "arg_13", ")", ")", "arg_15", "=", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_13", ")", "LOG", ".", "info", "(", "\"created downstream port: %s\"", "%", "(", "arg_15", ")", ")", "return", "{", "\"uuid\"", ":", "arg_15", "[", "'port'", "]", "[", "'id'", "]", ",", "\"vlan_id\"", ":", "arg_15", "[", "'port'", "]", "[", "'vlan_id'", "]", "}", "except", "Exception", "as", "e", ":", "arg_9", "=", "\"failed to create downstream port. Exception: %s\"", "%", "(", "e", ")", "raise", "IronicException", "(", "arg_9", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"Create a port.\n\n        :param context: neutron api request context.\n        :param network_id: neutron network id.\n        :param port_id: neutron port id.\n        :param kwargs:\n            required keys - device_id: neutron port device_id (instance_id)\n                            instance_node_id: nova hypervisor host id\n                            mac_address: neutron port mac address\n                            base_net_driver: the base network driver\n            optional keys - addresses: list of allocated IPAddress models\n                            security_groups: list of associated security groups\n        :raises IronicException: If the client is unable to create the\n            downstream port for any reason, the exception will be logged\n            and IronicException raised.\n        \"\"\"\n        LOG.info(\"Func %s %s %s\" % (arg_1.tenant_id, arg_2,\n                                           arg_3))\n\n        # sanity check\n        if not arg_4.get('base_net_driver'):\n            raise IronicException(arg_9='base_net_driver required.')\n        arg_5 = arg_4['base_net_driver']\n\n        if not arg_4.get('device_id'):\n            raise IronicException(arg_9='device_id required.')\n        arg_6 = arg_4['device_id']\n\n        if not arg_4.get('instance_node_id'):\n            raise IronicException(arg_9='instance_node_id required.')\n        arg_7 = arg_4['instance_node_id']\n\n        if not arg_4.get('mac_address'):\n            raise IronicException(arg_9='mac_address is required.')\n        arg_8 = str(netaddr.EUI(arg_4[\"mac_address\"][\"address\"]))\n        arg_8 = arg_8.replace('-', ':')\n\n        # TODO(morgabra): Change this when we enable security groups.\n        if arg_4.get('security_groups'):\n            arg_9 = 'ironic driver does not support security group operations.'\n            raise IronicException(arg_9=arg_9)\n\n        # unroll the given address models into a fixed_ips list we can\n        # pass downstream\n        arg_10 = []\n        arg_11 = arg_4.get('addresses')\n        if not isinstance(arg_11, list):\n            arg_11 = [arg_11]\n        for arg_12 in arg_11:\n            arg_10.append(arg_0._make_fixed_ip_dict(arg_1, arg_12))\n\n        arg_13 = {\n            \"id\": arg_3,\n            \"network_id\": arg_2,\n            \"device_id\": arg_6,\n            \"device_owner\": arg_4.get('device_owner', ''),\n            \"tenant_id\": arg_1.tenant_id or \"quark\",\n            \"roles\": arg_1.roles,\n            \"mac_address\": arg_8,\n            \"fixed_ips\": arg_10,\n            \"switch:hardware_id\": arg_7,\n            \"dynamic_network\": not STRATEGY.is_provider_network(arg_2)\n        }\n\n        arg_14 = arg_0._get_base_network_info(\n            arg_1, arg_2, arg_5)\n        arg_13.update(arg_14)\n\n        try:\n            LOG.info(\"creating downstream port: %s\" % (arg_13))\n            arg_15 = arg_0._Func(arg_1, arg_13)\n            LOG.info(\"created downstream port: %s\" % (arg_15))\n            return {\"uuid\": arg_15['port']['id'],\n                    \"vlan_id\": arg_15['port']['vlan_id']}\n        except Exception as e:\n            arg_9 = \"failed to create downstream port. Exception: %s\" % (e)\n            raise IronicException(arg_9=arg_9)", "path": "quark/drivers/ironic_driver.py", "identifier": "IronicDriver.create_port", "docstring": "Create a port.\n\n        :param context: neutron api request context.\n        :param network_id: neutron network id.\n        :param port_id: neutron port id.\n        :param kwargs:\n            required keys - device_id: neutron port device_id (instance_id)\n                            instance_node_id: nova hypervisor host id\n                            mac_address: neutron port mac address\n                            base_net_driver: the base network driver\n            optional keys - addresses: list of allocated IPAddress models\n                            security_groups: list of associated security groups\n        :raises IronicException: If the client is unable to create the\n            downstream port for any reason, the exception will be logged\n            and IronicException raised.", "docstring_tokens": ["Create", "a", "port", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 256132}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/base.py#L93-L107", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Utility function to query slack for a particular user", "language": "python", "parameters": "(self, username)", "return_statement": "return SlackUser.get_user(self._bot.sc, username)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_0", ".", "_bot", ",", "'user_manager'", ")", ":", "arg_2", "=", "arg_0", ".", "_bot", ".", "user_manager", ".", "get_by_username", "(", "arg_1", ")", "if", "arg_2", ":", "return", "arg_2", "arg_2", "=", "SlackUser", ".", "Func", "(", "arg_0", ".", "_bot", ".", "sc", ",", "arg_1", ")", "arg_0", ".", "_bot", ".", "user_manager", ".", "set", "(", "arg_2", ")", "return", "arg_2", "return", "SlackUser", ".", "Func", "(", "arg_0", ".", "_bot", ".", "sc", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Utility function to query slack for a particular user\n\n        :param username: The username of the user to lookup\n        :return: SlackUser object or None\n        \"\"\"\n        if hasattr(arg_0._bot, 'user_manager'):\n            arg_2 = arg_0._bot.user_manager.get_by_username(arg_1)\n            if arg_2:\n                return arg_2\n            arg_2 = SlackUser.Func(arg_0._bot.sc, arg_1)\n            arg_0._bot.user_manager.set(arg_2)\n            return arg_2\n        return SlackUser.Func(arg_0._bot.sc, arg_1)", "path": "slackminion/plugin/base.py", "identifier": "BasePlugin.get_user", "docstring": "Utility function to query slack for a particular user\n\n        :param username: The username of the user to lookup\n        :return: SlackUser object or None", "docstring_tokens": ["Utility", "function", "to", "query", "slack", "for", "a", "particular", "user"], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 256133}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/compiler.py#L324-L346", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Convert an abstract syntax operator tree to python source code.", "language": "python", "parameters": "(self, node, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "opnode", "if", "arg_3", "is", "None", ":", "return", "arg_0", ".", "_ast_to_code", "(", "arg_1", ".", "operands", "[", "0", "]", ")", "else", ":", "arg_4", "=", "arg_3", ".", "operator", "if", "arg_4", "is", "OP_ALTERNATE", ":", "return", "arg_0", ".", "_ast_op_alternate_to_code", "(", "arg_1", ",", "**", "arg_2", ")", "elif", "arg_4", "is", "OP_WS_CONCAT", ":", "arg_2", "[", "\"ignore_whitespace\"", "]", "=", "False", "return", "arg_0", ".", "_ast_op_concat_to_code", "(", "arg_1", ",", "**", "arg_2", ")", "elif", "arg_4", "is", "OP_CONCAT", ":", "arg_2", "[", "\"ignore_whitespace\"", "]", "=", "True", "return", "arg_0", ".", "_ast_op_concat_to_code", "(", "arg_1", ",", "**", "arg_2", ")", "elif", "arg_4", "is", "OP_EXCLUDE", ":", "return", "arg_0", ".", "_ast_op_exclude_to_code", "(", "arg_1", ",", "**", "arg_2", ")", "elif", "arg_4", "is", "OP_MULTIPLY", ":", "return", "arg_0", ".", "_ast_op_multiply_to_code", "(", "arg_1", ",", "**", "arg_2", ")", "elif", "arg_4", "is", "OP_REPEAT", ":", "return", "arg_0", ".", "_ast_op_repeat_to_code", "(", "arg_1", ",", "**", "arg_2", ")", "else", ":", "raise", "Exception", "(", "\"Unhandled optree node: {0}\"", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Convert an abstract syntax operator tree to python source code.\"\"\"\n    arg_3 = arg_1.opnode\n    if arg_3 is None:\n      return arg_0._ast_to_code(arg_1.operands[0])\n    else:\n      arg_4 = arg_3.operator\n      if arg_4 is OP_ALTERNATE:\n        return arg_0._ast_op_alternate_to_code(arg_1, **arg_2)\n      elif arg_4 is OP_WS_CONCAT:\n        arg_2[\"ignore_whitespace\"] = False\n        return arg_0._ast_op_concat_to_code(arg_1, **arg_2)\n      elif arg_4 is OP_CONCAT:\n        arg_2[\"ignore_whitespace\"] = True\n        return arg_0._ast_op_concat_to_code(arg_1, **arg_2)\n      elif arg_4 is OP_EXCLUDE:\n        return arg_0._ast_op_exclude_to_code(arg_1, **arg_2)\n      elif arg_4 is OP_MULTIPLY:\n        return arg_0._ast_op_multiply_to_code(arg_1, **arg_2)\n      elif arg_4 is OP_REPEAT:\n        return arg_0._ast_op_repeat_to_code(arg_1, **arg_2)\n      else:\n        raise Exception(\"Unhandled optree node: {0}\".format(arg_1))", "path": "pyebnf/compiler.py", "identifier": "Compiler._ast_optree_node_to_code", "docstring": "Convert an abstract syntax operator tree to python source code.", "docstring_tokens": ["Convert", "an", "abstract", "syntax", "operator", "tree", "to", "python", "source", "code", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 256134}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/lists.py#L208-L272", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Update the settings for a specific list.", "language": "python", "parameters": "(self, list_id, data)", "return_statement": "return self._mc_client._patch(url=self._build_path(list_id), data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "list_id", "=", "arg_1", "if", "'name'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The list must have a name'", ")", "if", "'contact'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The list must have a contact'", ")", "if", "'company'", "not", "in", "arg_2", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a company'", ")", "if", "'address1'", "not", "in", "arg_2", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a address1'", ")", "if", "'city'", "not", "in", "arg_2", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a city'", ")", "if", "'state'", "not", "in", "arg_2", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a state'", ")", "if", "'zip'", "not", "in", "arg_2", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a zip'", ")", "if", "'country'", "not", "in", "arg_2", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a country'", ")", "if", "'permission_reminder'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The list must have a permission_reminder'", ")", "if", "'campaign_defaults'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The list must have a campaign_defaults'", ")", "if", "'from_name'", "not", "in", "arg_2", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a from_name'", ")", "if", "'from_email'", "not", "in", "arg_2", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a from_email'", ")", "check_email", "(", "arg_2", "[", "'campaign_defaults'", "]", "[", "'from_email'", "]", ")", "if", "'subject'", "not", "in", "arg_2", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a subject'", ")", "if", "'language'", "not", "in", "arg_2", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a language'", ")", "if", "'email_type_option'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The list must have an email_type_option'", ")", "if", "arg_2", "[", "'email_type_option'", "]", "not", "in", "[", "True", ",", "False", "]", ":", "raise", "TypeError", "(", "'The list email_type_option must be True or False'", ")", "return", "arg_0", ".", "_mc_client", ".", "_patch", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Update the settings for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"contact\": object*\n            {\n                \"company\": string*,\n                \"address1\": string*,\n                \"city\": string*,\n                \"state\": string*,\n                \"zip\": string*,\n                \"country\": string*\n            },\n            \"permission_reminder\": string*,\n            \"campaign_defaults\": object*\n            {\n                \"from_name\": string*,\n                \"from_email\": string*,\n                \"subject\": string*,\n                \"language\": string*\n            },\n            \"email_type_option\": boolean\n        }\n        \"\"\"\n        arg_0.list_id = arg_1\n        if 'name' not in arg_2:\n            raise KeyError('The list must have a name')\n        if 'contact' not in arg_2:\n            raise KeyError('The list must have a contact')\n        if 'company' not in arg_2['contact']:\n            raise KeyError('The list contact must have a company')\n        if 'address1' not in arg_2['contact']:\n            raise KeyError('The list contact must have a address1')\n        if 'city' not in arg_2['contact']:\n            raise KeyError('The list contact must have a city')\n        if 'state' not in arg_2['contact']:\n            raise KeyError('The list contact must have a state')\n        if 'zip' not in arg_2['contact']:\n            raise KeyError('The list contact must have a zip')\n        if 'country' not in arg_2['contact']:\n            raise KeyError('The list contact must have a country')\n        if 'permission_reminder' not in arg_2:\n            raise KeyError('The list must have a permission_reminder')\n        if 'campaign_defaults' not in arg_2:\n            raise KeyError('The list must have a campaign_defaults')\n        if 'from_name' not in arg_2['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_name')\n        if 'from_email' not in arg_2['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_email')\n        check_email(arg_2['campaign_defaults']['from_email'])\n        if 'subject' not in arg_2['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a subject')\n        if 'language' not in arg_2['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a language')\n        if 'email_type_option' not in arg_2:\n            raise KeyError('The list must have an email_type_option')\n        if arg_2['email_type_option'] not in [True, False]:\n            raise TypeError('The list email_type_option must be True or False')\n        return arg_0._mc_client._patch(url=arg_0._build_path(arg_1), arg_2=arg_2)", "path": "mailchimp3/entities/lists.py", "identifier": "Lists.update", "docstring": "Update the settings for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"contact\": object*\n            {\n                \"company\": string*,\n                \"address1\": string*,\n                \"city\": string*,\n                \"state\": string*,\n                \"zip\": string*,\n                \"country\": string*\n            },\n            \"permission_reminder\": string*,\n            \"campaign_defaults\": object*\n            {\n                \"from_name\": string*,\n                \"from_email\": string*,\n                \"subject\": string*,\n                \"language\": string*\n            },\n            \"email_type_option\": boolean\n        }", "docstring_tokens": ["Update", "the", "settings", "for", "a", "specific", "list", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 256135}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_memoize.py#L229-L286", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Return a property attribute for new-style classes that only calls its\n    getter on the first access. The result is stored and on subsequent accesses\n    is returned, preventing the need to call the getter any more.", "language": "python", "parameters": "(fget)", "return_statement": "return property(fget_memoized)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "hasattr", "(", "arg_0", ",", "'fget'", ")", ":", "arg_0", "=", "arg_0", ".", "fget", "arg_1", "=", "'_'", "+", "arg_0", ".", "__name__", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "fget_memoized", "(", "arg_2", ")", ":", "if", "not", "hasattr", "(", "arg_2", ",", "arg_1", ")", ":", "setattr", "(", "arg_2", ",", "arg_1", ",", "arg_0", "(", "arg_2", ")", ")", "return", "getattr", "(", "arg_2", ",", "arg_1", ")", "return", "property", "(", "fget_memoized", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Return a property attribute for new-style classes that only calls its\n    getter on the first access. The result is stored and on subsequent accesses\n    is returned, preventing the need to call the getter any more.\n\n    This decorator can either be used by itself or by decorating another\n    property. In either case the method will always become a property.\n\n    Notes:\n        implementation is a modified version of [1].\n\n    References:\n        ..[1] https://github.com/estebistec/python-memoized-property\n\n    CommandLine:\n        xdoctest -m ubelt.util_memoize Func\n\n    Example:\n        >>> class C(object):\n        ...     load_name_count = 0\n        ...     @Func\n        ...     def name(self):\n        ...         \"name's docstring\"\n        ...         self.load_name_count += 1\n        ...         return \"the name\"\n        ...     @Func\n        ...     @property\n        ...     def another_name(self):\n        ...         \"name's docstring\"\n        ...         self.load_name_count += 1\n        ...         return \"the name\"\n        >>> c = C()\n        >>> c.load_name_count\n        0\n        >>> c.name\n        'the name'\n        >>> c.load_name_count\n        1\n        >>> c.name\n        'the name'\n        >>> c.load_name_count\n        1\n        >>> c.another_name\n    \"\"\"\n    # Unwrap any existing property decorator\n    while hasattr(arg_0, 'fget'):\n        arg_0 = arg_0.fget\n\n    arg_1 = '_' + arg_0.__name__\n\n    @functools.wraps(arg_0)\n    def fget_memoized(arg_2):\n        if not hasattr(arg_2, arg_1):\n            setattr(arg_2, arg_1, arg_0(arg_2))\n        return getattr(arg_2, arg_1)\n\n    return property(fget_memoized)", "path": "ubelt/util_memoize.py", "identifier": "memoize_property", "docstring": "Return a property attribute for new-style classes that only calls its\n    getter on the first access. The result is stored and on subsequent accesses\n    is returned, preventing the need to call the getter any more.\n\n    This decorator can either be used by itself or by decorating another\n    property. In either case the method will always become a property.\n\n    Notes:\n        implementation is a modified version of [1].\n\n    References:\n        ..[1] https://github.com/estebistec/python-memoized-property\n\n    CommandLine:\n        xdoctest -m ubelt.util_memoize memoize_property\n\n    Example:\n        >>> class C(object):\n        ...     load_name_count = 0\n        ...     @memoize_property\n        ...     def name(self):\n        ...         \"name's docstring\"\n        ...         self.load_name_count += 1\n        ...         return \"the name\"\n        ...     @memoize_property\n        ...     @property\n        ...     def another_name(self):\n        ...         \"name's docstring\"\n        ...         self.load_name_count += 1\n        ...         return \"the name\"\n        >>> c = C()\n        >>> c.load_name_count\n        0\n        >>> c.name\n        'the name'\n        >>> c.load_name_count\n        1\n        >>> c.name\n        'the name'\n        >>> c.load_name_count\n        1\n        >>> c.another_name", "docstring_tokens": ["Return", "a", "property", "attribute", "for", "new", "-", "style", "classes", "that", "only", "calls", "its", "getter", "on", "the", "first", "access", ".", "The", "result", "is", "stored", "and", "on", "subsequent", "accesses", "is", "returned", "preventing", "the", "need", "to", "call", "the", "getter", "any", "more", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 256136}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/monte_carlo/expectation.py#L205-L215", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Check args and return samples.", "language": "python", "parameters": "(dist, z, n, seed)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "'get_samples'", ",", "values", "=", "[", "arg_1", ",", "arg_2", "]", ")", ":", "if", "(", "arg_2", "is", "None", ")", "==", "(", "arg_1", "is", "None", ")", ":", "raise", "ValueError", "(", "'Must specify exactly one of arguments \"n\" and \"z\".  Found: '", "'n = %s, z = %s'", "%", "(", "arg_2", ",", "arg_1", ")", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_0", ".", "sample", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", "else", ":", "return", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "name", "=", "'z'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Check args and return samples.\"\"\"\n  with tf.compat.v1.name_scope('get_samples', values=[arg_1, arg_2]):\n    if (arg_2 is None) == (arg_1 is None):\n      raise ValueError(\n          'Must specify exactly one of arguments \"n\" and \"z\".  Found: '\n          'n = %s, z = %s' % (arg_2, arg_1))\n    if arg_2 is not None:\n      return arg_0.sample(arg_2, arg_3=arg_3)\n    else:\n      return tf.convert_to_tensor(value=arg_1, name='z')", "path": "tensorflow_probability/python/monte_carlo/expectation.py", "identifier": "_get_samples", "docstring": "Check args and return samples.", "docstring_tokens": ["Check", "args", "and", "return", "samples", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256137}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L294-L314", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return true if the is an arg named `name`.", "language": "python", "parameters": "(self, name: str, value: str = None)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", "=", "None", ")", "->", "bool", ":", "for", "arg_4", "in", "reversed", "(", "arg_0", ".", "arguments", ")", ":", "if", "arg_4", ".", "name", ".", "strip", "(", "WS", ")", "==", "arg_1", ".", "strip", "(", "WS", ")", ":", "if", "arg_3", ":", "if", "arg_4", ".", "positional", ":", "if", "arg_4", ".", "value", "==", "arg_3", ":", "return", "True", "return", "False", "if", "arg_4", ".", "value", ".", "strip", "(", "WS", ")", "==", "arg_3", ".", "strip", "(", "WS", ")", ":", "return", "True", "return", "False", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2 = None) -> bool:\n        \"\"\"Return true if the is an arg named `name`.\n\n        Also check equality of values if `value` is provided.\n\n        Note: If you just need to get an argument and you want to LBYL, it's\n            better to get_arg directly and then check if the returned value\n            is None.\n        \"\"\"\n        for arg_4 in reversed(arg_0.arguments):\n            if arg_4.name.strip(WS) == arg_1.strip(WS):\n                if arg_3:\n                    if arg_4.positional:\n                        if arg_4.value == arg_3:\n                            return True\n                        return False\n                    if arg_4.value.strip(WS) == arg_3.strip(WS):\n                        return True\n                    return False\n                return True\n        return False", "path": "wikitextparser/_template.py", "identifier": "Template.has_arg", "docstring": "Return true if the is an arg named `name`.\n\n        Also check equality of values if `value` is provided.\n\n        Note: If you just need to get an argument and you want to LBYL, it's\n            better to get_arg directly and then check if the returned value\n            is None.", "docstring_tokens": ["Return", "true", "if", "the", "is", "an", "arg", "named", "name", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 256138}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L95-L107", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "String to boolean", "language": "python", "parameters": "(s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "lower", "(", ")", "if", "arg_1", "in", "(", "\"true\"", ",", "\"t\"", ",", "\"1\"", ")", ":", "return", "True", "if", "arg_1", "in", "(", "\"false\"", ",", "\"f\"", ",", "\"0\"", ")", ":", "return", "False", "raise", "Exception", "(", "\"Unable to convert string '%s' to a boolean value\"", "%", "arg_0", ")"], "function": "def Func(arg_0):\n  \"\"\"\n  String to boolean\n\n  :param s: (string)\n  :return: (bool)\n  \"\"\"\n  arg_1 = arg_0.lower()\n  if arg_1 in (\"true\", \"t\", \"1\"):\n    return True\n  if arg_1 in (\"false\", \"f\", \"0\"):\n    return False\n  raise Exception(\"Unable to convert string '%s' to a boolean value\" % arg_0)", "path": "src/nupic/data/utils.py", "identifier": "parseBool", "docstring": "String to boolean\n\n  :param s: (string)\n  :return: (bool)", "docstring_tokens": ["String", "to", "boolean"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256139}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L685-L689", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Activate membership.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "arg_0", ".", "state", "=", "MembershipState", ".", "ACTIVE", "db", ".", "session", ".", "merge", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"Activate membership.\"\"\"\n        with db.session.begin_nested():\n            arg_0.state = MembershipState.ACTIVE\n            db.session.merge(arg_0)", "path": "invenio_groups/models.py", "identifier": "Membership.accept", "docstring": "Activate membership.", "docstring_tokens": ["Activate", "membership", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 256140}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L372-L388", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Processes the given record according to the current phase", "language": "python", "parameters": "(self, inputRecord)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "__model", ".", "run", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "__currentPhase", ".", "advance", "(", ")", "if", "not", "arg_3", ":", "arg_0", ".", "__advancePhase", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Processes the given record according to the current phase\n\n    inputRecord:  record object formatted according to\n                  nupic.data.FileSource.getNext() result format.\n\n    Returns:      An opf_utils.ModelResult object with the inputs and inferences\n                  after the current record is processed by the model\n    \"\"\"\n\n    arg_2 = arg_0.__model.run(arg_1)\n\n    arg_3 = arg_0.__currentPhase.advance()\n    if not arg_3:\n      arg_0.__advancePhase()\n\n    return arg_2", "path": "src/nupic/frameworks/opf/opf_task_driver.py", "identifier": "_PhaseManager.handleInputRecord", "docstring": "Processes the given record according to the current phase\n\n    inputRecord:  record object formatted according to\n                  nupic.data.FileSource.getNext() result format.\n\n    Returns:      An opf_utils.ModelResult object with the inputs and inferences\n                  after the current record is processed by the model", "docstring_tokens": ["Processes", "the", "given", "record", "according", "to", "the", "current", "phase"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256141}
{"url": "https://github.com/ui/django-thumbnails/blob/5cef55e7f167060458709ed760dd43981124796a/thumbnails/images.py#L68-L85", "sha": "5cef55e7f167060458709ed760dd43981124796a", "docstring_summary": "Creates a thumbnail file and its relevant metadata. Returns a\n    Thumbnail instance.", "language": "python", "parameters": "(source_name, size, metadata_backend=None, storage_backend=None)", "return_statement": "return Thumbnail(metadata=metadata, storage=storage_backend)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "backends", ".", "storage", ".", "get_backend", "(", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "backends", ".", "metadata", ".", "get_backend", "(", ")", "arg_4", "=", "processors", ".", "process", "(", "arg_3", ".", "open", "(", "arg_0", ")", ",", "arg_1", ")", "arg_4", "=", "post_processors", ".", "process", "(", "arg_4", ",", "arg_1", ")", "arg_5", "=", "get_thumbnail_name", "(", "arg_0", ",", "arg_1", ")", "arg_5", "=", "arg_3", ".", "save", "(", "arg_5", ",", "arg_4", ")", "arg_6", "=", "arg_2", ".", "add_thumbnail", "(", "arg_0", ",", "arg_1", ",", "arg_5", ")", "return", "Thumbnail", "(", "arg_6", "=", "arg_6", ",", "storage", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    Creates a thumbnail file and its relevant metadata. Returns a\n    Thumbnail instance.\n    \"\"\"\n\n    if arg_3 is None:\n        arg_3 = backends.storage.get_backend()\n    if arg_2 is None:\n        arg_2 = backends.metadata.get_backend()\n\n    arg_4 = processors.process(arg_3.open(arg_0), arg_1)\n    arg_4 = post_processors.process(arg_4, arg_1)\n    arg_5 = get_thumbnail_name(arg_0, arg_1)\n    arg_5 = arg_3.save(arg_5, arg_4)\n\n    arg_6 = arg_2.add_thumbnail(arg_0, arg_1, arg_5)\n    return Thumbnail(arg_6=arg_6, storage=arg_3)", "path": "thumbnails/images.py", "identifier": "create", "docstring": "Creates a thumbnail file and its relevant metadata. Returns a\n    Thumbnail instance.", "docstring_tokens": ["Creates", "a", "thumbnail", "file", "and", "its", "relevant", "metadata", ".", "Returns", "a", "Thumbnail", "instance", "."], "nwo": "ui/django-thumbnails", "score": 0.28145370109860535, "idx": 256142}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L595-L603", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Set this layer in the training mode or in predition mode if is_training=False", "language": "python", "parameters": "(self, is_training=True)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", ":", "callJavaFunc", "(", "arg_0", ".", "value", ".", "Func", ")", "else", ":", "callJavaFunc", "(", "arg_0", ".", "value", ".", "evaluate", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=True):\n        '''\n        Set this layer in the Func mode or in predition mode if is_Func=False\n        '''\n        if arg_1:\n            callJavaFunc(arg_0.value.Func)\n        else:\n            callJavaFunc(arg_0.value.evaluate)\n        return arg_0", "path": "pyspark/bigdl/nn/layer.py", "identifier": "Layer.training", "docstring": "Set this layer in the training mode or in predition mode if is_training=False", "docstring_tokens": ["Set", "this", "layer", "in", "the", "training", "mode", "or", "in", "predition", "mode", "if", "is_training", "=", "False"], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 256143}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/base.py#L112-L140", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Estimates the beats using librosa.", "language": "python", "parameters": "(self)", "return_statement": "return times, frames", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_audio_percussive", "is", "None", ":", "arg_0", ".", "_audio_harmonic", ",", "arg_0", ".", "_audio_percussive", "=", "arg_0", ".", "compute_HPSS", "(", ")", "arg_3", ",", "arg_4", "=", "librosa", ".", "beat", ".", "beat_track", "(", "y", "=", "arg_0", ".", "_audio_percussive", ",", "sr", "=", "arg_0", ".", "sr", ",", "hop_length", "=", "arg_0", ".", "hop_length", ")", "arg_5", "=", "librosa", ".", "frames_to_time", "(", "arg_4", ",", "sr", "=", "arg_0", ".", "sr", ",", "hop_length", "=", "arg_0", ".", "hop_length", ")", "if", "len", "(", "arg_5", ")", ">", "0", "and", "arg_5", "[", "0", "]", "==", "0", ":", "arg_5", "=", "arg_5", "[", "1", ":", "]", "arg_4", "=", "arg_4", "[", "1", ":", "]", "return", "arg_5", ",", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"Estimates the beats using librosa.\n\n        Returns\n        -------\n        times: np.array\n            Times of estimated beats in seconds.\n        frames: np.array\n            Frame indeces of estimated beats.\n        \"\"\"\n        # Compute harmonic-percussive source separation if needed\n        if arg_0._audio_percussive is None:\n            arg_0._audio_harmonic, arg_0._audio_percussive = arg_0.compute_HPSS()\n\n        # Compute beats\n        arg_3, arg_4 = librosa.beat.beat_track(\n            y=arg_0._audio_percussive, sr=arg_0.sr,\n            hop_length=arg_0.hop_length)\n\n        # To times\n        arg_5 = librosa.frames_to_time(arg_4, sr=arg_0.sr,\n                                       hop_length=arg_0.hop_length)\n\n        # TODO: Is this really necessary?\n        if len(arg_5) > 0 and arg_5[0] == 0:\n            arg_5 = arg_5[1:]\n            arg_4 = arg_4[1:]\n\n        return arg_5, arg_4", "path": "msaf/base.py", "identifier": "Features.estimate_beats", "docstring": "Estimates the beats using librosa.\n\n        Returns\n        -------\n        times: np.array\n            Times of estimated beats in seconds.\n        frames: np.array\n            Frame indeces of estimated beats.", "docstring_tokens": ["Estimates", "the", "beats", "using", "librosa", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 256144}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/filters.py#L7-L23", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Does a bandpass filter over the given data.", "language": "python", "parameters": "(data, low, high, fs, order=5)", "return_statement": "return y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "5", ")", ":", "arg_5", "=", "0.5", "*", "arg_3", "arg_1", "=", "arg_1", "/", "arg_5", "arg_2", "=", "arg_2", "/", "arg_5", "arg_6", ",", "arg_7", "=", "signal", ".", "butter", "(", "arg_4", ",", "[", "arg_1", ",", "arg_2", "]", ",", "btype", "=", "'band'", ")", "arg_8", "=", "signal", ".", "lfilter", "(", "arg_6", ",", "arg_7", ",", "arg_0", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=5):\n    \"\"\"\n    Does a bandpass filter over the given data.\n\n    :param data: The data (numpy array) to be filtered.\n    :param low: The low cutoff in Hz.\n    :param high: The high cutoff in Hz.\n    :param fs: The sample rate (in Hz) of the data.\n    :param order: The order of the filter. The higher the order, the tighter the roll-off.\n    :returns: Filtered data (numpy array).\n    \"\"\"\n    arg_5 = 0.5 * arg_3\n    arg_1 = arg_1 / arg_5\n    arg_2 = arg_2 / arg_5\n    arg_6, arg_7 = signal.butter(arg_4, [arg_1, arg_2], btype='band')\n    arg_8 = signal.lfilter(arg_6, arg_7, arg_0)\n    return arg_8", "path": "algorithms/filters.py", "identifier": "bandpass_filter", "docstring": "Does a bandpass filter over the given data.\n\n    :param data: The data (numpy array) to be filtered.\n    :param low: The low cutoff in Hz.\n    :param high: The high cutoff in Hz.\n    :param fs: The sample rate (in Hz) of the data.\n    :param order: The order of the filter. The higher the order, the tighter the roll-off.\n    :returns: Filtered data (numpy array).", "docstring_tokens": ["Does", "a", "bandpass", "filter", "over", "the", "given", "data", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 256145}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L159-L163", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns the date of file creation as a python date object", "language": "python", "parameters": "(self, date)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_0", ".", "creation_year", "=", "Func", ".", "year", "arg_0", ".", "creation_day_of_year", "=", "Func", ".", "timetuple", "(", ")", ".", "tm_yday"], "function": "def Func(arg_0, Func):\n        \"\"\" Returns the date of file creation as a python date object\n        \"\"\"\n        arg_0.creation_year = Func.year\n        arg_0.creation_day_of_year = Func.timetuple().tm_yday", "path": "pylas/headers/rawheader.py", "identifier": "RawHeader1_1.date", "docstring": "Returns the date of file creation as a python date object", "docstring_tokens": ["Returns", "the", "date", "of", "file", "creation", "as", "a", "python", "date", "object"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 256146}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L826-L838", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Flush replies from the control channel waiting\n        in the ZMQ queue.", "language": "python", "parameters": "(self, sock)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_ignored_control_replies", "<=", "0", ":", "return", "arg_2", ",", "arg_3", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_1", ",", "mode", "=", "zmq", ".", "NOBLOCK", ")", "while", "arg_3", "is", "not", "None", ":", "arg_0", ".", "_ignored_control_replies", "-=", "1", "if", "arg_0", ".", "debug", ":", "pprint", "(", "arg_3", ")", "arg_2", ",", "arg_3", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_1", ",", "mode", "=", "zmq", ".", "NOBLOCK", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Flush replies from the control channel waiting\n        in the ZMQ queue.\n\n        Currently: ignore them.\"\"\"\n        if arg_0._ignored_control_replies <= 0:\n            return\n        arg_2,arg_3 = arg_0.session.recv(arg_1, mode=zmq.NOBLOCK)\n        while arg_3 is not None:\n            arg_0._ignored_control_replies -= 1\n            if arg_0.debug:\n                pprint(arg_3)\n            arg_2,arg_3 = arg_0.session.recv(arg_1, mode=zmq.NOBLOCK)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client._flush_control", "docstring": "Flush replies from the control channel waiting\n        in the ZMQ queue.\n\n        Currently: ignore them.", "docstring_tokens": ["Flush", "replies", "from", "the", "control", "channel", "waiting", "in", "the", "ZMQ", "queue", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256147}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L262-L269", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Run a shell command.", "language": "python", "parameters": "(commands, **kwargs)", "return_statement": "return p.returncode, output, error", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "subprocess", ".", "Popen", "(", "arg_0", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "**", "arg_1", ")", "arg_3", ",", "arg_4", "=", "arg_2", ".", "communicate", "(", ")", "return", "arg_2", ".", "returncode", ",", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Run a shell command.\"\"\"\n    arg_2 = subprocess.Popen(arg_0,\n                         stdout=subprocess.PIPE,\n                         stderr=subprocess.PIPE,\n                         **arg_1)\n    arg_3, arg_4 = arg_2.communicate()\n    return arg_2.returncode, arg_3, arg_4", "path": "harvestingkit/utils.py", "identifier": "run_shell_command", "docstring": "Run a shell command.", "docstring_tokens": ["Run", "a", "shell", "command", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 256148}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1534-L1542", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Find the beginning marker for a multiline comment.", "language": "python", "parameters": "(lines, lineix)", "return_statement": "return len(lines)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "arg_1", "<", "len", "(", "arg_0", ")", ":", "if", "arg_0", "[", "arg_1", "]", ".", "strip", "(", ")", ".", "startswith", "(", "'/*'", ")", ":", "if", "arg_0", "[", "arg_1", "]", ".", "strip", "(", ")", ".", "find", "(", "'*/'", ",", "2", ")", "<", "0", ":", "return", "arg_1", "arg_1", "+=", "1", "return", "len", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Find the beginning marker for a multiline comment.\"\"\"\n  while arg_1 < len(arg_0):\n    if arg_0[arg_1].strip().startswith('/*'):\n      # Only return this marker if the comment goes beyond this line\n      if arg_0[arg_1].strip().find('*/', 2) < 0:\n        return arg_1\n    arg_1 += 1\n  return len(arg_0)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "FindNextMultiLineCommentStart", "docstring": "Find the beginning marker for a multiline comment.", "docstring_tokens": ["Find", "the", "beginning", "marker", "for", "a", "multiline", "comment", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256149}
{"url": "https://github.com/synw/gencharts/blob/fa35604a9445b399bb4f91bc91af488e8e8208fd/gencharts/__init__.py#L102-L112", "sha": "fa35604a9445b399bb4f91bc91af488e8e8208fd", "docstring_summary": "Generates html from Vega lite data", "language": "python", "parameters": "(self, slug, json_data)", "return_statement": "return html", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "'<div id=\"chart-'", "+", "arg_1", "+", "'\"></div>'", "arg_3", "+=", "'<script>'", "arg_3", "+=", "'var s'", "+", "arg_1", "+", "' = '", "+", "arg_2", "+", "';'", "arg_3", "+=", "'vega.embed(\"#chart-'", "+", "arg_1", "+", "'\", s'", "+", "arg_1", "+", "');'", "arg_3", "+=", "'</script>'", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Generates html from Vega lite data\n        \"\"\"\n        arg_3 = '<div id=\"chart-' + arg_1 + '\"></div>'\n        arg_3 += '<script>'\n        arg_3 += 'var s' + arg_1 + ' = ' + arg_2 + ';'\n        arg_3 += 'vega.embed(\"#chart-' + arg_1 + '\", s' + arg_1 + ');'\n        #html += 'console.log(JSON.stringify(s{id}, null, 2));'\n        arg_3 += '</script>'\n        return arg_3", "path": "gencharts/__init__.py", "identifier": "ChartsGenerator._json_to_html", "docstring": "Generates html from Vega lite data", "docstring_tokens": ["Generates", "html", "from", "Vega", "lite", "data"], "nwo": "synw/gencharts", "score": 0.12050106452410352, "idx": 256150}
{"url": "https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L58-L64", "sha": "3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8", "docstring_summary": "Returns the next Period this event is in effect, or None if the event\n        has no remaining periods.", "language": "python", "parameters": "(self, after=None)", "return_statement": "return next(self.intervals(range_start=after), None)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "timezone", ".", "now", "(", ")", "arg_1", "=", "arg_0", ".", "to_timezone", "(", "arg_1", ")", "return", "next", "(", "arg_0", ".", "intervals", "(", "range_start", "=", "arg_1", ")", ",", "None", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Returns the next Period this event is in effect, or None if the event\n        has no remaining periods.\"\"\"\n        if arg_1 is None:\n            arg_1 = timezone.now()\n        arg_1 = arg_0.to_timezone(arg_1)\n        return next(arg_0.intervals(range_start=arg_1), None)", "path": "open511/utils/schedule.py", "identifier": "Schedule.next_interval", "docstring": "Returns the next Period this event is in effect, or None if the event\n        has no remaining periods.", "docstring_tokens": ["Returns", "the", "next", "Period", "this", "event", "is", "in", "effect", "or", "None", "if", "the", "event", "has", "no", "remaining", "periods", "."], "nwo": "open511/open511", "score": 0.138843686048881, "idx": 256151}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/explorer/src/python/physicalplan.py#L131-L162", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "run bolts subcommand", "language": "python", "parameters": "(command, parser, cl_args, unknown_args)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_2", "[", "'cluster'", "]", ",", "arg_2", "[", "'role'", "]", ",", "arg_2", "[", "'environ'", "]", "arg_7", "=", "arg_2", "[", "'topology-name'", "]", "try", ":", "arg_8", "=", "tracker_access", ".", "get_topology_info", "(", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_5", ")", "arg_9", "=", "arg_8", "[", "'physical_plan'", "]", "[", "'bolts'", "]", ".", "keys", "(", ")", "arg_10", "=", "arg_2", "[", "'bolt'", "]", "if", "arg_10", ":", "if", "arg_10", "in", "arg_9", ":", "arg_9", "=", "[", "arg_10", "]", "else", ":", "Log", ".", "error", "(", "'Unknown bolt: \\'%s\\''", "%", "arg_10", ")", "raise", "except", "Exception", ":", "Log", ".", "error", "(", "\"Fail to connect to tracker: \\'%s\\'\"", ",", "arg_2", "[", "\"tracker_url\"", "]", ")", "return", "False", "arg_11", "=", "[", "]", "for", "arg_12", "in", "arg_9", ":", "try", ":", "arg_13", "=", "tracker_access", ".", "get_component_metrics", "(", "arg_12", ",", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_5", ")", "arg_14", ",", "arg_15", "=", "to_table", "(", "arg_13", ")", "arg_11", ".", "append", "(", "(", "arg_12", ",", "arg_14", ",", "arg_15", ")", ")", "except", "Exception", ":", "Log", ".", "error", "(", "\"Fail to connect to tracker: \\'%s\\'\"", ",", "arg_2", "[", "\"tracker_url\"", "]", ")", "return", "False", "for", "arg_16", ",", "(", "arg_12", ",", "arg_14", ",", "arg_15", ")", "in", "enumerate", "(", "arg_11", ")", ":", "if", "arg_16", "!=", "0", ":", "print", "(", "''", ")", "print", "(", "'\\'%s\\' metrics:'", "%", "arg_12", ")", "print", "(", "tabulate", "(", "arg_14", ",", "headers", "=", "arg_15", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\" run bolts subcommand \"\"\"\n  arg_4, arg_5, arg_6 = arg_2['cluster'], arg_2['role'], arg_2['environ']\n  arg_7 = arg_2['topology-name']\n  try:\n    arg_8 = tracker_access.get_topology_info(arg_4, arg_6, arg_7, arg_5)\n    arg_9 = arg_8['physical_plan']['bolts'].keys()\n    arg_10 = arg_2['bolt']\n    if arg_10:\n      if arg_10 in arg_9:\n        arg_9 = [arg_10]\n      else:\n        Log.error('Unknown bolt: \\'%s\\'' % arg_10)\n        raise\n  except Exception:\n    Log.error(\"Fail to connect to tracker: \\'%s\\'\", arg_2[\"tracker_url\"])\n    return False\n  arg_11 = []\n  for arg_12 in arg_9:\n    try:\n      arg_13 = tracker_access.get_component_metrics(arg_12, arg_4, arg_6, arg_7, arg_5)\n      arg_14, arg_15 = to_table(arg_13)\n      arg_11.append((arg_12, arg_14, arg_15))\n    except Exception:\n      Log.error(\"Fail to connect to tracker: \\'%s\\'\", arg_2[\"tracker_url\"])\n      return False\n  for arg_16, (arg_12, arg_14, arg_15) in enumerate(arg_11):\n    if arg_16 != 0:\n      print('')\n    print('\\'%s\\' metrics:' % arg_12)\n    print(tabulate(arg_14, headers=arg_15))\n  return True", "path": "heron/tools/explorer/src/python/physicalplan.py", "identifier": "run_bolts", "docstring": "run bolts subcommand", "docstring_tokens": ["run", "bolts", "subcommand"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256152}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L972-L1023", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Places top drawdowns in a table.", "language": "python", "parameters": "(returns, top=10)", "return_statement": "return df_drawdowns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "arg_2", "=", "ep", ".", "cum_returns", "(", "arg_0", ",", "1.0", ")", "arg_3", "=", "get_top_drawdowns", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "index", "=", "list", "(", "range", "(", "arg_1", ")", ")", ",", "columns", "=", "[", "'Net drawdown in %'", ",", "'Peak date'", ",", "'Valley date'", ",", "'Recovery date'", ",", "'Duration'", "]", ")", "for", "arg_5", ",", "(", "arg_6", ",", "arg_7", ",", "arg_8", ")", "in", "enumerate", "(", "arg_3", ")", ":", "if", "pd", ".", "isnull", "(", "arg_8", ")", ":", "arg_4", ".", "loc", "[", "arg_5", ",", "'Duration'", "]", "=", "np", ".", "nan", "else", ":", "arg_4", ".", "loc", "[", "arg_5", ",", "'Duration'", "]", "=", "len", "(", "pd", ".", "date_range", "(", "arg_6", ",", "arg_8", ",", "freq", "=", "'B'", ")", ")", "arg_4", ".", "loc", "[", "arg_5", ",", "'Peak date'", "]", "=", "(", "arg_6", ".", "to_pydatetime", "(", ")", ".", "strftime", "(", "'%Y-%m-%d'", ")", ")", "arg_4", ".", "loc", "[", "arg_5", ",", "'Valley date'", "]", "=", "(", "arg_7", ".", "to_pydatetime", "(", ")", ".", "strftime", "(", "'%Y-%m-%d'", ")", ")", "if", "isinstance", "(", "arg_8", ",", "float", ")", ":", "arg_4", ".", "loc", "[", "arg_5", ",", "'Recovery date'", "]", "=", "arg_8", "else", ":", "arg_4", ".", "loc", "[", "arg_5", ",", "'Recovery date'", "]", "=", "(", "arg_8", ".", "to_pydatetime", "(", ")", ".", "strftime", "(", "'%Y-%m-%d'", ")", ")", "arg_4", ".", "loc", "[", "arg_5", ",", "'Net drawdown in %'", "]", "=", "(", "(", "arg_2", ".", "loc", "[", "arg_6", "]", "-", "arg_2", ".", "loc", "[", "arg_7", "]", ")", "/", "arg_2", ".", "loc", "[", "arg_6", "]", ")", "*", "100", "arg_4", "[", "'Peak date'", "]", "=", "pd", ".", "to_datetime", "(", "arg_4", "[", "'Peak date'", "]", ")", "arg_4", "[", "'Valley date'", "]", "=", "pd", ".", "to_datetime", "(", "arg_4", "[", "'Valley date'", "]", ")", "arg_4", "[", "'Recovery date'", "]", "=", "pd", ".", "to_datetime", "(", "arg_4", "[", "'Recovery date'", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=10):\n    \"\"\"\n    Places top drawdowns in a table.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    top : int, optional\n        The amount of top drawdowns to find (default 10).\n\n    Returns\n    -------\n    df_drawdowns : pd.DataFrame\n        Information about top drawdowns.\n    \"\"\"\n\n    arg_2 = ep.cum_returns(arg_0, 1.0)\n    arg_3 = get_top_drawdowns(arg_0, arg_1=arg_1)\n    arg_4 = pd.DataFrame(index=list(range(arg_1)),\n                                columns=['Net drawdown in %',\n                                         'Peak date',\n                                         'Valley date',\n                                         'Recovery date',\n                                         'Duration'])\n\n    for arg_5, (arg_6, arg_7, arg_8) in enumerate(arg_3):\n        if pd.isnull(arg_8):\n            arg_4.loc[arg_5, 'Duration'] = np.nan\n        else:\n            arg_4.loc[arg_5, 'Duration'] = len(pd.date_range(arg_6,\n                                                                arg_8,\n                                                                freq='B'))\n        arg_4.loc[arg_5, 'Peak date'] = (arg_6.to_pydatetime()\n                                            .strftime('%Y-%m-%d'))\n        arg_4.loc[arg_5, 'Valley date'] = (arg_7.to_pydatetime()\n                                              .strftime('%Y-%m-%d'))\n        if isinstance(arg_8, float):\n            arg_4.loc[arg_5, 'Recovery date'] = arg_8\n        else:\n            arg_4.loc[arg_5, 'Recovery date'] = (arg_8.to_pydatetime()\n                                                    .strftime('%Y-%m-%d'))\n        arg_4.loc[arg_5, 'Net drawdown in %'] = (\n            (arg_2.loc[arg_6] - arg_2.loc[arg_7]) / arg_2.loc[arg_6]) * 100\n\n    arg_4['Peak date'] = pd.to_datetime(arg_4['Peak date'])\n    arg_4['Valley date'] = pd.to_datetime(arg_4['Valley date'])\n    arg_4['Recovery date'] = pd.to_datetime(\n        arg_4['Recovery date'])\n\n    return arg_4", "path": "pyfolio/timeseries.py", "identifier": "gen_drawdown_table", "docstring": "Places top drawdowns in a table.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    top : int, optional\n        The amount of top drawdowns to find (default 10).\n\n    Returns\n    -------\n    df_drawdowns : pd.DataFrame\n        Information about top drawdowns.", "docstring_tokens": ["Places", "top", "drawdowns", "in", "a", "table", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 256153}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1067-L1140", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Orders catg data for each sample into the final locus order. This allows\n    all of the individual catgs to simply be combined later. They are also in\n    the same order as the indels array, so indels are inserted from the indel\n    array that is passed in.", "language": "python", "parameters": "(data, sample, bseeds, sidx, nloci)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "LOGGER", ".", "info", "(", "\"in single cat here\"", ")", "arg_5", "=", "'reference'", "in", "arg_0", ".", "paramsdict", "[", "\"assembly_method\"", "]", "with", "h5py", ".", "File", "(", "arg_2", ",", "'r'", ")", "as", "io5", ":", "arg_6", "=", "io5", "[", "\"uarr\"", "]", "[", ":", "]", "arg_6", "=", "arg_6", "[", "arg_6", "[", ":", ",", "1", "]", "==", "arg_3", ",", ":", "]", "arg_7", "=", "io5", "[", "\"seedsarr\"", "]", "[", ":", "]", "arg_7", "=", "arg_7", "[", "arg_7", "[", ":", ",", "1", "]", "==", "arg_3", ",", ":", "]", "arg_8", "=", "np", ".", "concatenate", "(", "(", "arg_7", ",", "arg_6", ")", ")", "arg_8", "=", "arg_8", "[", "arg_8", "[", ":", ",", "0", "]", ".", "argsort", "(", ")", "]", "arg_9", "=", "arg_0", ".", "_hackersonly", "[", "\"max_fragment_length\"", "]", "+", "20", "arg_10", "=", "np", ".", "zeros", "(", "(", "arg_4", ",", "arg_9", ",", "4", ")", ",", "dtype", "=", "np", ".", "uint32", ")", "arg_11", "=", "np", ".", "zeros", "(", "arg_4", ",", "dtype", "=", "np", ".", "uint8", ")", "arg_12", "=", "np", ".", "zeros", "(", "(", "arg_4", ",", "3", ")", ",", "dtype", "=", "np", ".", "int64", ")", "if", "not", "arg_1", ".", "files", ".", "database", ":", "raise", "IPyradWarningExit", "(", "\"missing catg file - {}\"", ".", "format", "(", "arg_1", ".", "name", ")", ")", "with", "h5py", ".", "File", "(", "arg_1", ".", "files", ".", "database", ",", "'r'", ")", "as", "io5", ":", "arg_13", "=", "io5", "[", "\"catg\"", "]", "[", ":", "]", "arg_14", "=", "arg_13", "[", "arg_8", "[", ":", ",", "2", "]", ",", ":", "arg_9", ",", ":", "]", "del", "arg_13", "arg_10", "[", "arg_8", "[", ":", ",", "0", "]", ",", ":", "arg_14", ".", "shape", "[", "1", "]", ",", ":", "]", "=", "arg_14", "del", "arg_14", "arg_16", "=", "io5", "[", "\"nalleles\"", "]", "[", ":", "]", "arg_11", "[", "arg_8", "[", ":", ",", "0", "]", "]", "=", "arg_16", "[", "arg_8", "[", ":", ",", "2", "]", "]", "del", "arg_16", "if", "arg_5", ":", "arg_17", "=", "io5", "[", "\"chroms\"", "]", "[", ":", "]", "arg_12", "[", "arg_8", "[", ":", ",", "0", "]", "]", "=", "arg_17", "[", "arg_8", "[", ":", ",", "2", "]", "]", "del", "arg_17", "arg_18", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "across", ",", "arg_0", ".", "name", "+", "\".tmp.indels.hdf5\"", ")", "with", "h5py", ".", "File", "(", "arg_18", ",", "'r'", ")", "as", "ih5", ":", "arg_19", "=", "ih5", "[", "\"indels\"", "]", "[", "arg_3", ",", ":", ",", ":", "arg_9", "]", "arg_20", "=", "inserted_indels", "(", "arg_19", ",", "arg_10", ")", "del", "arg_10", ",", "arg_19", "arg_21", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "across", ",", "arg_1", ".", "name", "+", "'.tmp.h5'", ")", "with", "h5py", ".", "File", "(", "arg_21", ",", "'w'", ")", "as", "oh5", ":", "oh5", ".", "create_dataset", "(", "\"icatg\"", ",", "arg_0", "=", "arg_20", ",", "dtype", "=", "np", ".", "uint32", ")", "oh5", ".", "create_dataset", "(", "\"inall\"", ",", "arg_0", "=", "arg_11", ",", "dtype", "=", "np", ".", "uint8", ")", "if", "arg_5", ":", "oh5", ".", "create_dataset", "(", "\"ichrom\"", ",", "arg_0", "=", "arg_12", ",", "dtype", "=", "np", ".", "int64", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Orders catg data for each sample into the final locus order. This allows\n    all of the individual catgs to simply be combined later. They are also in\n    the same order as the indels array, so indels are inserted from the indel\n    array that is passed in.\n    \"\"\"\n\n    LOGGER.info(\"in single cat here\")\n    ## enter ref data?\n    arg_5 = 'reference' in arg_0.paramsdict[\"assembly_method\"]\n\n    ## grab seeds and hits info for this sample\n    with h5py.File(arg_2, 'r') as io5:\n        ## get hits just for this sample and sort them by sample order index\n        arg_6 = io5[\"uarr\"][:]\n        arg_6 = arg_6[arg_6[:, 1] == arg_3, :]\n        #hits = hits[hits[:, 2].argsort()]\n        ## get seeds just for this sample and sort them by sample order index\n        arg_7 = io5[\"seedsarr\"][:]\n        arg_7 = arg_7[arg_7[:, 1] == arg_3, :]\n        #seeds = seeds[seeds[:, 2].argsort()]\n        arg_8 = np.concatenate((arg_7, arg_6))\n        arg_8 = arg_8[arg_8[:, 0].argsort()]\n\n    ## still using max+20 len limit, rare longer merged reads get trimmed\n    ## we need to allow room for indels to be added too\n    arg_9 = arg_0._hackersonly[\"max_fragment_length\"] + 20\n\n    ## we'll fill a new catg and alleles arr for this sample in locus order,\n    ## which is known from seeds and hits\n    arg_10 = np.zeros((arg_4, arg_9, 4), dtype=np.uint32)\n    arg_11 = np.zeros(arg_4, dtype=np.uint8)\n    arg_12 = np.zeros((arg_4, 3), dtype=np.int64)\n    \n    ## grab the sample's data and write to ocatg and onall\n    if not arg_1.files.database:\n        raise IPyradWarningExit(\"missing catg file - {}\".format(arg_1.name))\n\n    with h5py.File(arg_1.files.database, 'r') as io5:\n        ## get it and delete it\n        arg_13 = io5[\"catg\"][:]\n        arg_14 = arg_13[arg_8[:, 2], :arg_9, :]\n        del arg_13\n        arg_10[arg_8[:, 0], :arg_14.shape[1], :] = arg_14\n        del arg_14\n\n        ## get it and delete it\n        arg_16 = io5[\"nalleles\"][:]\n        arg_11[arg_8[:, 0]] = arg_16[arg_8[:, 2]]\n        del arg_16\n\n        ## fill the reference data\n        if arg_5:\n            arg_17 = io5[\"chroms\"][:]\n            arg_12[arg_8[:, 0]] = arg_17[arg_8[:, 2]]\n            del arg_17\n\n    ## get indel locations for this sample\n    arg_18 = os.path.join(arg_0.dirs.across, arg_0.name+\".tmp.indels.hdf5\")\n    with h5py.File(arg_18, 'r') as ih5:\n        arg_19 = ih5[\"indels\"][arg_3, :, :arg_9]\n\n    ## insert indels into ocatg\n    arg_20 = inserted_indels(arg_19, arg_10)\n    del arg_10, arg_19\n    \n    ## save individual tmp h5 data\n    arg_21 = os.path.join(arg_0.dirs.across, arg_1.name+'.tmp.h5')\n    with h5py.File(arg_21, 'w') as oh5:\n        oh5.create_dataset(\"icatg\", arg_0=arg_20, dtype=np.uint32)\n        oh5.create_dataset(\"inall\", arg_0=arg_11, dtype=np.uint8)\n        if arg_5:\n            oh5.create_dataset(\"ichrom\", arg_0=arg_12, dtype=np.int64)", "path": "ipyrad/assemble/cluster_across.py", "identifier": "singlecat", "docstring": "Orders catg data for each sample into the final locus order. This allows\n    all of the individual catgs to simply be combined later. They are also in\n    the same order as the indels array, so indels are inserted from the indel\n    array that is passed in.", "docstring_tokens": ["Orders", "catg", "data", "for", "each", "sample", "into", "the", "final", "locus", "order", ".", "This", "allows", "all", "of", "the", "individual", "catgs", "to", "simply", "be", "combined", "later", ".", "They", "are", "also", "in", "the", "same", "order", "as", "the", "indels", "array", "so", "indels", "are", "inserted", "from", "the", "indel", "array", "that", "is", "passed", "in", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 256154}
{"url": "https://github.com/nickw444/flask-ldap3-login/blob/3cf0faff52d0e04d4813119a2ba36d706e6fb31f/flask_ldap3_login/__init__.py#L191-L203", "sha": "3cf0faff52d0e04d4813119a2ba36d706e6fb31f", "docstring_summary": "Remove a connection from the appcontext.", "language": "python", "parameters": "(self, connection)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "stack", ".", "top", "if", "arg_2", "is", "not", "None", "and", "arg_1", "in", "arg_2", ".", "ldap3_manager_connections", ":", "arg_2", ".", "ldap3_manager_connections", ".", "remove", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Remove a connection from the appcontext.\n\n        Args:\n            connection (ldap3.Connection): connection to remove from the\n                appcontext\n\n        \"\"\"\n\n        arg_2 = stack.top\n        if arg_2 is not None and arg_1 in arg_2.ldap3_manager_connections:\n            arg_2.ldap3_manager_connections.remove(arg_1)", "path": "flask_ldap3_login/__init__.py", "identifier": "LDAP3LoginManager._decontextualise_connection", "docstring": "Remove a connection from the appcontext.\n\n        Args:\n            connection (ldap3.Connection): connection to remove from the\n                appcontext", "docstring_tokens": ["Remove", "a", "connection", "from", "the", "appcontext", "."], "nwo": "nickw444/flask-ldap3-login", "score": 0.51975183030278, "idx": 256155}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L221-L238", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Returns all variants of the given node.", "language": "python", "parameters": "(\n        graph: BELGraph,\n        node: Protein,\n        modifications: Optional[Set[str]] = None,\n)", "return_statement": "return {\n        v\n        for u, v, key, data in graph.edges(keys=True, data=True)\n        if (\n            u == node\n            and data[RELATION] == HAS_VARIANT\n            and pybel.struct.has_protein_modification(v)\n        )\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "[", "arg_6", "[", "arg_7", "]", "]", "=", "None", ",", ")", "->", "arg_6", "[", "arg_3", "]", ":", "if", "arg_4", ":", "return", "_get_filtered_Func", "(", "arg_0", ",", "arg_2", ",", "arg_4", ")", "return", "{", "arg_9", "for", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "in", "arg_0", ".", "edges", "(", "keys", "=", "True", ",", "arg_11", "=", "True", ")", "if", "(", "arg_8", "==", "arg_2", "and", "arg_11", "[", "RELATION", "]", "==", "HAS_VARIANT", "and", "pybel", ".", "struct", ".", "has_protein_modification", "(", "arg_9", ")", ")", "}"], "function": "def Func(\n        arg_0: arg_1,\n        arg_2: arg_3,\n        arg_4: arg_5[arg_6[arg_7]] = None,\n) -> arg_6[arg_3]:\n    \"\"\"Returns all variants of the given node.\"\"\"\n    if arg_4:\n        return _get_filtered_Func(arg_0, arg_2, arg_4)\n\n    return {\n        arg_9\n        for arg_8, arg_9, arg_10, arg_11 in arg_0.edges(keys=True, arg_11=True)\n        if (\n            arg_8 == arg_2\n            and arg_11[RELATION] == HAS_VARIANT\n            and pybel.struct.has_protein_modification(arg_9)\n        )\n    }", "path": "src/pybel_tools/filters/node_filters.py", "identifier": "variants_of", "docstring": "Returns all variants of the given node.", "docstring_tokens": ["Returns", "all", "variants", "of", "the", "given", "node", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256156}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/effects.py#L101-L142", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Extract harmonic elements from an audio time-series.", "language": "python", "parameters": "(y, **kwargs)", "return_statement": "return y_harm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "core", ".", "stft", "(", "arg_0", ")", "arg_3", "=", "decompose", ".", "hpss", "(", "arg_2", ",", "**", "arg_1", ")", "[", "0", "]", "arg_4", "=", "util", ".", "fix_length", "(", "core", ".", "istft", "(", "arg_3", ",", "dtype", "=", "arg_0", ".", "dtype", ")", ",", "len", "(", "arg_0", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, **arg_1):\n    '''Extract Func elements from an audio time-series.\n\n    Parameters\n    ----------\n    y : np.ndarray [shape=(n,)]\n        audio time series\n    kwargs : additional keyword arguments.\n        See `librosa.decompose.hpss` for details.\n\n    Returns\n    -------\n    y_Func : np.ndarray [shape=(n,)]\n        audio time series of just the Func portion\n\n    See Also\n    --------\n    hpss : Separate Func and percussive components\n    percussive : Extract only the percussive component\n    librosa.decompose.hpss : HPSS for spectrograms\n\n    Examples\n    --------\n    >>> # Extract Func component\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> y_Func = librosa.effects.Func(y)\n\n    >>> # Use a margin > 1.0 for greater Func separation\n    >>> y_Func = librosa.effects.Func(y, margin=3.0)\n\n    '''\n\n    # Compute the STFT matrix\n    arg_2 = core.stft(arg_0)\n\n    # Remove percussives\n    arg_3 = decompose.hpss(arg_2, **arg_1)[0]\n\n    # Invert the STFTs\n    arg_4 = util.fix_length(core.istft(arg_3, dtype=arg_0.dtype), len(arg_0))\n\n    return arg_4", "path": "librosa/effects.py", "identifier": "harmonic", "docstring": "Extract harmonic elements from an audio time-series.\n\n    Parameters\n    ----------\n    y : np.ndarray [shape=(n,)]\n        audio time series\n    kwargs : additional keyword arguments.\n        See `librosa.decompose.hpss` for details.\n\n    Returns\n    -------\n    y_harmonic : np.ndarray [shape=(n,)]\n        audio time series of just the harmonic portion\n\n    See Also\n    --------\n    hpss : Separate harmonic and percussive components\n    percussive : Extract only the percussive component\n    librosa.decompose.hpss : HPSS for spectrograms\n\n    Examples\n    --------\n    >>> # Extract harmonic component\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> y_harmonic = librosa.effects.harmonic(y)\n\n    >>> # Use a margin > 1.0 for greater harmonic separation\n    >>> y_harmonic = librosa.effects.harmonic(y, margin=3.0)", "docstring_tokens": ["Extract", "harmonic", "elements", "from", "an", "audio", "time", "-", "series", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 256157}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1455-L1471", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Generic interface to the inspector system.", "language": "python", "parameters": "(self, meth, oname, namespaces=None, **kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "_object_find", "(", "arg_2", ",", "arg_3", ")", "if", "arg_5", ".", "found", ":", "arg_6", "=", "getattr", "(", "arg_0", ".", "inspector", ",", "arg_1", ")", "arg_7", "=", "format_screen", "if", "arg_5", ".", "ismagic", "else", "None", "if", "arg_1", "==", "'pdoc'", ":", "arg_6", "(", "arg_5", ".", "obj", ",", "arg_2", ",", "arg_7", ")", "elif", "arg_1", "==", "'pinfo'", ":", "arg_6", "(", "arg_5", ".", "obj", ",", "arg_2", ",", "arg_7", ",", "arg_5", ",", "**", "arg_4", ")", "else", ":", "arg_6", "(", "arg_5", ".", "obj", ",", "arg_2", ")", "else", ":", "print", "'Object `%s` not found.'", "%", "arg_2", "return", "'not found'"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, **arg_4):\n        \"\"\"Generic interface to the inspector system.\n\n        This function is meant to be called by pdef, pdoc & friends.\"\"\"\n        arg_5 = arg_0._object_find(arg_2, arg_3)\n        if arg_5.found:\n            arg_6 = getattr(arg_0.inspector, arg_1)\n            arg_7 = format_screen if arg_5.ismagic else None\n            if arg_1 == 'pdoc':\n                arg_6(arg_5.obj, arg_2, arg_7)\n            elif arg_1 == 'pinfo':\n                arg_6(arg_5.obj, arg_2, arg_7, arg_5, **arg_4)\n            else:\n                arg_6(arg_5.obj, arg_2)\n        else:\n            print 'Object `%s` not found.' % arg_2\n            return 'not found'", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell._inspect", "docstring": "Generic interface to the inspector system.\n\n        This function is meant to be called by pdef, pdoc & friends.", "docstring_tokens": ["Generic", "interface", "to", "the", "inspector", "system", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256158}
{"url": "https://github.com/BlueDragonX/detach/blob/e2e5a1076e19f508baf3ffb2b586a75934fbae28/detach.py#L42-L48", "sha": "e2e5a1076e19f508baf3ffb2b586a75934fbae28", "docstring_summary": "Return the maximum file descriptor value.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "resource", ".", "getrlimit", "(", "resource", ".", "RLIMIT_NOFILE", ")", "arg_2", "=", "arg_1", "[", "1", "]", "if", "arg_2", "==", "resource", ".", "RLIM_INFINITY", ":", "arg_2", "=", "maxfd", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Return the maximum file descriptor value.\"\"\"\n        arg_1 = resource.getrlimit(resource.RLIMIT_NOFILE)\n        arg_2 = arg_1[1]\n        if arg_2 == resource.RLIM_INFINITY:\n            arg_2 = maxfd\n        return arg_2", "path": "detach.py", "identifier": "Detach._get_max_fd", "docstring": "Return the maximum file descriptor value.", "docstring_tokens": ["Return", "the", "maximum", "file", "descriptor", "value", "."], "nwo": "BlueDragonX/detach", "score": 0.2643786477459777, "idx": 256159}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/plane.py#L287-L293", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Trace this plane's grid_stacks to the next plane, using its deflection angles.", "language": "python", "parameters": "(self)", "return_statement": "return self.grid_stack.map_function(minus, self.deflection_stack)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "minus", "(", "arg_1", ",", "arg_2", ")", ":", "return", "arg_1", "-", "arg_2", "return", "arg_0", ".", "grid_stack", ".", "map_function", "(", "minus", ",", "arg_0", ".", "deflection_stack", ")"], "function": "def Func(arg_0):\n        \"\"\"Trace this plane's grid_stacks to the next plane, using its deflection angles.\"\"\"\n\n        def minus(arg_1, arg_2):\n            return arg_1 - arg_2\n\n        return arg_0.grid_stack.map_function(minus, arg_0.deflection_stack)", "path": "autolens/lens/plane.py", "identifier": "AbstractGriddedPlane.trace_grid_stack_to_next_plane", "docstring": "Trace this plane's grid_stacks to the next plane, using its deflection angles.", "docstring_tokens": ["Trace", "this", "plane", "s", "grid_stacks", "to", "the", "next", "plane", "using", "its", "deflection", "angles", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 256160}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/aws_athena_hook.py#L109-L140", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Poll the status of submitted athena query until query state reaches final state.\n        Returns one of the final states", "language": "python", "parameters": "(self, query_execution_id, max_tries=None)", "return_statement": "return final_query_state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "1", "arg_4", "=", "None", "while", "True", ":", "arg_5", "=", "arg_0", ".", "check_query_status", "(", "arg_1", ")", "if", "arg_5", "is", "None", ":", "arg_0", ".", "log", ".", "info", "(", "'Trial {try_number}: Invalid query state. Retrying again'", ".", "format", "(", "arg_3", "=", "arg_3", ")", ")", "elif", "arg_5", "in", "arg_0", ".", "INTERMEDIATE_STATES", ":", "arg_0", ".", "log", ".", "info", "(", "'Trial {try_number}: Query is still in an intermediate state - {state}'", ".", "format", "(", "arg_3", "=", "arg_3", ",", "state", "=", "arg_5", ")", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "'Trial {try_number}: Query execution completed. Final state is {state}'", ".", "format", "(", "arg_3", "=", "arg_3", ",", "state", "=", "arg_5", ")", ")", "arg_4", "=", "arg_5", "break", "if", "arg_2", "and", "arg_3", ">=", "arg_2", ":", "arg_4", "=", "arg_5", "break", "arg_3", "+=", "1", "sleep", "(", "arg_0", ".", "sleep_time", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Poll the status of submitted athena query until query state reaches final state.\n        Returns one of the final states\n\n        :param query_execution_id: Id of submitted athena query\n        :type query_execution_id: str\n        :param max_tries: Number of times to poll for query state before function exits\n        :type max_tries: int\n        :return: str\n        \"\"\"\n        arg_3 = 1\n        arg_4 = None  # Query state when query reaches final state or max_tries reached\n        while True:\n            arg_5 = arg_0.check_query_status(arg_1)\n            if arg_5 is None:\n                arg_0.log.info('Trial {try_number}: Invalid query state. Retrying again'.format(\n                    arg_3=arg_3))\n            elif arg_5 in arg_0.INTERMEDIATE_STATES:\n                arg_0.log.info('Trial {try_number}: Query is still in an intermediate state - {state}'\n                              .format(arg_3=arg_3, state=arg_5))\n            else:\n                arg_0.log.info('Trial {try_number}: Query execution completed. Final state is {state}'\n                              .format(arg_3=arg_3, state=arg_5))\n                arg_4 = arg_5\n                break\n            if arg_2 and arg_3 >= arg_2:  # Break loop if max_tries reached\n                arg_4 = arg_5\n                break\n            arg_3 += 1\n            sleep(arg_0.sleep_time)\n        return arg_4", "path": "airflow/contrib/hooks/aws_athena_hook.py", "identifier": "AWSAthenaHook.poll_query_status", "docstring": "Poll the status of submitted athena query until query state reaches final state.\n        Returns one of the final states\n\n        :param query_execution_id: Id of submitted athena query\n        :type query_execution_id: str\n        :param max_tries: Number of times to poll for query state before function exits\n        :type max_tries: int\n        :return: str", "docstring_tokens": ["Poll", "the", "status", "of", "submitted", "athena", "query", "until", "query", "state", "reaches", "final", "state", ".", "Returns", "one", "of", "the", "final", "states"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256161}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muccore.py#L322-L359", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Initialize a `MucItem` object from a set of attributes.", "language": "python", "parameters": "(self,affiliation,role,jid=None,nick=None,actor=None,reason=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "None", "elif", "arg_1", "not", "in", "affiliations", ":", "raise", "ValueError", "(", "\"Bad affiliation\"", ")", "arg_0", ".", "affiliation", "=", "arg_1", "if", "not", "arg_2", ":", "arg_2", "=", "None", "elif", "arg_2", "not", "in", "roles", ":", "raise", "ValueError", "(", "\"Bad role\"", ")", "arg_0", ".", "role", "=", "arg_2", "if", "arg_3", ":", "arg_0", ".", "jid", "=", "JID", "(", "arg_3", ")", "else", ":", "arg_0", ".", "jid", "=", "None", "if", "arg_5", ":", "arg_0", ".", "actor", "=", "JID", "(", "arg_5", ")", "else", ":", "arg_0", ".", "actor", "=", "None", "arg_0", ".", "nick", "=", "arg_4", "arg_0", ".", "reason", "=", "arg_6"], "function": "def Func(arg_0,arg_1,arg_2,arg_3=None,arg_4=None,arg_5=None,arg_6=None):\n        \"\"\"Initialize a `MucItem` object from a set of attributes.\n\n        :Parameters:\n            - `affiliation`: affiliation of the user.\n            - `role`: role of the user.\n            - `jid`: JID of the user.\n            - `nick`: nickname of the user.\n            - `actor`: actor modyfying the user data.\n            - `reason`: reason of change of the user data.\n        :Types:\n            - `affiliation`: `str`\n            - `role`: `str`\n            - `jid`: `JID`\n            - `nick`: `unicode`\n            - `actor`: `JID`\n            - `reason`: `unicode`\n        \"\"\"\n        if not arg_1:\n            arg_1=None\n        elif arg_1 not in affiliations:\n            raise ValueError(\"Bad affiliation\")\n        arg_0.affiliation=arg_1\n        if not arg_2:\n            arg_2=None\n        elif arg_2 not in roles:\n            raise ValueError(\"Bad role\")\n        arg_0.role=arg_2\n        if arg_3:\n            arg_0.jid=JID(arg_3)\n        else:\n            arg_0.jid=None\n        if arg_5:\n            arg_0.actor=JID(arg_5)\n        else:\n            arg_0.actor=None\n        arg_0.nick=arg_4\n        arg_0.reason=arg_6", "path": "pyxmpp2/ext/muc/muccore.py", "identifier": "MucItem.__init", "docstring": "Initialize a `MucItem` object from a set of attributes.\n\n        :Parameters:\n            - `affiliation`: affiliation of the user.\n            - `role`: role of the user.\n            - `jid`: JID of the user.\n            - `nick`: nickname of the user.\n            - `actor`: actor modyfying the user data.\n            - `reason`: reason of change of the user data.\n        :Types:\n            - `affiliation`: `str`\n            - `role`: `str`\n            - `jid`: `JID`\n            - `nick`: `unicode`\n            - `actor`: `JID`\n            - `reason`: `unicode`", "docstring_tokens": ["Initialize", "a", "MucItem", "object", "from", "a", "set", "of", "attributes", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256162}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/amazon/api.py#L412-L430", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Safe get elemnent date.", "language": "python", "parameters": "(self, path, root=None)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "_safe_get_element_text", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "try", ":", "arg_3", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_3", ",", "'%Y-%m-%d'", ")", ".", "date", "(", ")", "except", "ValueError", ":", "arg_3", "=", "None", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Safe get elemnent date.\n\n        Get element as datetime.date or None,\n        :param root:\n            Lxml element.\n        :param path:\n            String path (i.e. 'Items.Item.Offers.Offer').\n        :return:\n            datetime.date or None.\n        \"\"\"\n        arg_3 = arg_0._safe_get_element_text(arg_1=arg_1, arg_2=arg_2)\n        if arg_3 is not None:\n            try:\n                arg_3 = datetime.datetime.strptime(arg_3, '%Y-%m-%d').date()\n            except ValueError:\n                arg_3 = None\n\n        return arg_3", "path": "capybara/virtualenv/lib/python2.7/site-packages/amazon/api.py", "identifier": "AmazonProduct._safe_get_element_date", "docstring": "Safe get elemnent date.\n\n        Get element as datetime.date or None,\n        :param root:\n            Lxml element.\n        :param path:\n            String path (i.e. 'Items.Item.Offers.Offer').\n        :return:\n            datetime.date or None.", "docstring_tokens": ["Safe", "get", "elemnent", "date", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256163}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L245-L258", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Join a bunch of dicts", "language": "python", "parameters": "(*dicts)", "return_statement": "return out_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ":", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "iteritems", "(", ")", ":", "if", "not", "type", "(", "arg_4", ")", "in", "JOINERS", ":", "raise", "KeyError", "(", "'Invalid type in dict: {}'", ".", "format", "(", "type", "(", "arg_4", ")", ")", ")", "JOINERS", "[", "type", "(", "arg_4", ")", "]", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "return", "arg_1"], "function": "def Func(*arg_0):\n    '''Join a bunch of dicts'''\n\n    arg_1 = {}\n\n    for arg_2 in arg_0:\n        for arg_3, arg_4 in arg_2.iteritems():\n\n            if not type(arg_4) in JOINERS:\n                raise KeyError('Invalid type in dict: {}'.format(type(arg_4)))\n\n            JOINERS[type(arg_4)](arg_1, arg_3, arg_4)\n\n    return arg_1", "path": "cpenv/utils.py", "identifier": "join_dicts", "docstring": "Join a bunch of dicts", "docstring_tokens": ["Join", "a", "bunch", "of", "dicts"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 256164}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/sequence.py#L867-L894", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Construct a uniform transition matrix over `n_states`.", "language": "python", "parameters": "(n_states)", "return_statement": "return transition", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "int", ")", "or", "arg_0", "<=", "0", ":", "raise", "ParameterError", "(", "'n_states={} must be a positive integer'", ")", "arg_1", "=", "np", ".", "empty", "(", "(", "arg_0", ",", "arg_0", ")", ",", "dtype", "=", "np", ".", "float", ")", "arg_1", ".", "fill", "(", "1.", "/", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    '''Construct a uniform transition matrix over `n_states`.\n\n    Parameters\n    ----------\n    n_states : int > 0\n        The number of states\n\n    Returns\n    -------\n    transition : np.ndarray [shape=(n_states, n_states)]\n        `transition[i, j] = 1./n_states`\n\n    Examples\n    --------\n\n    >>> librosa.sequence.Func(3)\n    array([[0.333, 0.333, 0.333],\n           [0.333, 0.333, 0.333],\n           [0.333, 0.333, 0.333]])\n    '''\n\n    if not isinstance(arg_0, int) or arg_0 <= 0:\n        raise ParameterError('n_states={} must be a positive integer')\n\n    arg_1 = np.empty((arg_0, arg_0), dtype=np.float)\n    arg_1.fill(1./arg_0)\n    return arg_1", "path": "librosa/sequence.py", "identifier": "transition_uniform", "docstring": "Construct a uniform transition matrix over `n_states`.\n\n    Parameters\n    ----------\n    n_states : int > 0\n        The number of states\n\n    Returns\n    -------\n    transition : np.ndarray [shape=(n_states, n_states)]\n        `transition[i, j] = 1./n_states`\n\n    Examples\n    --------\n\n    >>> librosa.sequence.transition_uniform(3)\n    array([[0.333, 0.333, 0.333],\n           [0.333, 0.333, 0.333],\n           [0.333, 0.333, 0.333]])", "docstring_tokens": ["Construct", "a", "uniform", "transition", "matrix", "over", "n_states", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 256165}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/client.py#L921-L951", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Activate a managed object stored by a KMIP appliance.", "language": "python", "parameters": "(self, uid=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "\"uid must be a string\"", ")", "arg_2", "=", "arg_0", ".", "proxy", ".", "Func", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "result_status", ".", "value", "if", "arg_3", "==", "enums", ".", "ResultStatus", ".", "SUCCESS", ":", "return", "else", ":", "arg_4", "=", "arg_2", ".", "result_reason", ".", "value", "arg_5", "=", "arg_2", ".", "result_message", ".", "value", "raise", "exceptions", ".", "KmipOperationFailure", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Activate a managed object stored by a KMIP appliance.\n\n        Args:\n            uid (string): The unique ID of the managed object to Func.\n                Optional, defaults to None.\n\n        Returns:\n            None\n\n        Raises:\n            ClientConnectionNotOpen: if the client connection is unusable\n            KmipOperationFailure: if the operation result is a failure\n            TypeError: if the input argument is invalid\n        \"\"\"\n        # Check input\n        if arg_1 is not None:\n            if not isinstance(arg_1, six.string_types):\n                raise TypeError(\"uid must be a string\")\n\n        # Activate the managed object and handle the results\n        arg_2 = arg_0.proxy.Func(arg_1)\n\n        arg_3 = arg_2.result_status.value\n        if arg_3 == enums.ResultStatus.SUCCESS:\n            return\n        else:\n            arg_4 = arg_2.result_reason.value\n            arg_5 = arg_2.result_message.value\n            raise exceptions.KmipOperationFailure(arg_3, arg_4, arg_5)", "path": "kmip/pie/client.py", "identifier": "ProxyKmipClient.activate", "docstring": "Activate a managed object stored by a KMIP appliance.\n\n        Args:\n            uid (string): The unique ID of the managed object to activate.\n                Optional, defaults to None.\n\n        Returns:\n            None\n\n        Raises:\n            ClientConnectionNotOpen: if the client connection is unusable\n            KmipOperationFailure: if the operation result is a failure\n            TypeError: if the input argument is invalid", "docstring_tokens": ["Activate", "a", "managed", "object", "stored", "by", "a", "KMIP", "appliance", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 256166}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_sre.py#L317-L328", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Returns one or more subgroups of the match. Each argument is either a\n        group index or a group name.", "language": "python", "parameters": "(self, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "arg_1", "=", "(", "0", ",", ")", "arg_2", "=", "[", "]", "for", "Func", "in", "arg_1", ":", "arg_2", ".", "append", "(", "arg_0", ".", "_get_slice", "(", "arg_0", ".", "_get_index", "(", "Func", ")", ",", "None", ")", ")", "if", "len", "(", "arg_2", ")", "==", "1", ":", "return", "arg_2", "[", "0", "]", "else", ":", "return", "tuple", "(", "arg_2", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Returns one or more subgroups of the match. Each argument is either a\n        group index or a group name.\"\"\"\n        if len(arg_1) == 0:\n            arg_1 = (0,)\n        arg_2 = []\n        for Func in arg_1:\n            arg_2.append(arg_0._get_slice(arg_0._get_index(Func), None))\n        if len(arg_2) == 1:\n            return arg_2[0]\n        else:\n            return tuple(arg_2)", "path": "third_party/pypy/_sre.py", "identifier": "SRE_Match.group", "docstring": "Returns one or more subgroups of the match. Each argument is either a\n        group index or a group name.", "docstring_tokens": ["Returns", "one", "or", "more", "subgroups", "of", "the", "match", ".", "Each", "argument", "is", "either", "a", "group", "index", "or", "a", "group", "name", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 256167}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/special_math.py#L410-L429", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "The inverse function for erf, the error function.", "language": "python", "parameters": "(x, name=\"erfinv\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Func\"", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_1", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_1", "=", "\"x\"", ")", "if", "dtype_util", ".", "as_numpy_dtype", "(", "arg_0", ".", "dtype", ")", "not", "in", "[", "np", ".", "float32", ",", "np", ".", "float64", "]", ":", "raise", "TypeError", "(", "\"x.dtype={} is not handled, see docstring for supported \"", "\"types.\"", ".", "format", "(", "dtype_util", ".", "name", "(", "arg_0", ".", "dtype", ")", ")", ")", "return", "ndtri", "(", "(", "arg_0", "+", "1.", ")", "/", "2.", ")", "/", "np", ".", "sqrt", "(", "2.", ")"], "function": "def Func(arg_0, arg_1=\"Func\"):\n  \"\"\"The inverse function for erf, the error function.\n\n  Args:\n    x: `Tensor` of type `float32`, `float64`.\n    name: Python string. A name for the operation (default=\"Func\").\n\n  Returns:\n    x: `Tensor` with `dtype=x.dtype`.\n\n  Raises:\n    TypeError: if `x` is not floating-type.\n  \"\"\"\n\n  with tf.name_scope(arg_1):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_1=\"x\")\n    if dtype_util.as_numpy_dtype(arg_0.dtype) not in [np.float32, np.float64]:\n      raise TypeError(\"x.dtype={} is not handled, see docstring for supported \"\n                      \"types.\".format(dtype_util.name(arg_0.dtype)))\n    return ndtri((arg_0 + 1.) / 2.) / np.sqrt(2.)", "path": "tensorflow_probability/python/internal/special_math.py", "identifier": "erfinv", "docstring": "The inverse function for erf, the error function.\n\n  Args:\n    x: `Tensor` of type `float32`, `float64`.\n    name: Python string. A name for the operation (default=\"erfinv\").\n\n  Returns:\n    x: `Tensor` with `dtype=x.dtype`.\n\n  Raises:\n    TypeError: if `x` is not floating-type.", "docstring_tokens": ["The", "inverse", "function", "for", "erf", "the", "error", "function", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256168}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/jid.py#L263-L281", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Prepare the resourcepart of the JID.", "language": "python", "parameters": "(data)", "return_statement": "return resource", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "None", "arg_0", "=", "unicode", "(", "arg_0", ")", "try", ":", "arg_1", "=", "RESOURCEPREP", ".", "prepare", "(", "arg_0", ")", "except", "StringprepError", ",", "err", ":", "raise", "JIDError", "(", "u\"Local part invalid: {0}\"", ".", "format", "(", "err", ")", ")", "if", "len", "(", "arg_1", ".", "encode", "(", "\"utf-8\"", ")", ")", ">", "1023", ":", "raise", "JIDError", "(", "\"Resource name too long\"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Prepare the resourcepart of the JID.\n\n        :Parameters:\n            - `data`: Resourcepart of the JID\n\n        :raise JIDError: if the resource name is too long.\n        :raise pyxmpp.xmppstringprep.StringprepError: if the\n            resourcepart fails Resourceprep preparation.\"\"\"\n        if not arg_0:\n            return None\n        arg_0 = unicode(arg_0)\n        try:\n            arg_1 = RESOURCEPREP.prepare(arg_0)\n        except StringprepError, err:\n            raise JIDError(u\"Local part invalid: {0}\".format(err))\n        if len(arg_1.encode(\"utf-8\")) > 1023:\n            raise JIDError(\"Resource name too long\")\n        return arg_1", "path": "pyxmpp2/jid.py", "identifier": "JID.__prepare_resource", "docstring": "Prepare the resourcepart of the JID.\n\n        :Parameters:\n            - `data`: Resourcepart of the JID\n\n        :raise JIDError: if the resource name is too long.\n        :raise pyxmpp.xmppstringprep.StringprepError: if the\n            resourcepart fails Resourceprep preparation.", "docstring_tokens": ["Prepare", "the", "resourcepart", "of", "the", "JID", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256169}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployment.py#L90-L106", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "This endpoint is used to pause or unpause a deployment.\n            This is done to pause a rolling upgrade or resume it.", "language": "python", "parameters": "(self, id, pause)", "return_statement": "return self.request(\"pause\", id, json=pause_json, method=\"post\").json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "\"Pause\"", ":", "arg_2", ",", "\"DeploymentID\"", ":", "arg_1", "}", "return", "arg_0", ".", "request", "(", "\"pause\"", ",", "arg_1", ",", "json", "=", "arg_3", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" This endpoint is used to pause or unpause a deployment.\n            This is done to pause a rolling upgrade or resume it.\n\n           https://www.nomadproject.io/docs/http/deployments.html\n\n            arguments:\n              - id\n              - pause, Specifies whether to pause or resume the deployment.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        arg_3 = {\"Pause\": arg_2,\n                      \"DeploymentID\": arg_1}\n        return arg_0.request(\"pause\", arg_1, json=arg_3, method=\"post\").json()", "path": "nomad/api/deployment.py", "identifier": "Deployment.pause_deployment", "docstring": "This endpoint is used to pause or unpause a deployment.\n            This is done to pause a rolling upgrade or resume it.\n\n           https://www.nomadproject.io/docs/http/deployments.html\n\n            arguments:\n              - id\n              - pause, Specifies whether to pause or resume the deployment.\n            returns: dict\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["This", "endpoint", "is", "used", "to", "pause", "or", "unpause", "a", "deployment", ".", "This", "is", "done", "to", "pause", "a", "rolling", "upgrade", "or", "resume", "it", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 256170}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diadefslib.py#L95-L107", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return associated nodes of a class node", "language": "python", "parameters": "(self, klass_node, level)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "0", ":", "return", "for", "arg_3", "in", "list", "(", "arg_1", ".", "instance_attrs_type", ".", "values", "(", ")", ")", "+", "list", "(", "arg_1", ".", "locals_type", ".", "values", "(", ")", ")", ":", "for", "arg_4", "in", "arg_3", ":", "if", "isinstance", "(", "arg_4", ",", "astroid", ".", "Instance", ")", ":", "arg_4", "=", "arg_4", ".", "_proxied", "if", "not", "(", "isinstance", "(", "arg_4", ",", "astroid", ".", "ClassDef", ")", "and", "arg_0", ".", "show_node", "(", "arg_4", ")", ")", ":", "continue", "yield", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"return associated nodes of a class node\"\"\"\n        if arg_2 == 0:\n            return\n        for arg_3 in list(arg_1.instance_attrs_type.values()) + list(\n            arg_1.locals_type.values()\n        ):\n            for arg_4 in arg_3:\n                if isinstance(arg_4, astroid.Instance):\n                    arg_4 = arg_4._proxied\n                if not (isinstance(arg_4, astroid.ClassDef) and arg_0.show_node(arg_4)):\n                    continue\n                yield arg_4", "path": "pylint/pyreverse/diadefslib.py", "identifier": "DiaDefGenerator.get_associated", "docstring": "return associated nodes of a class node", "docstring_tokens": ["return", "associated", "nodes", "of", "a", "class", "node"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256171}
{"url": "https://github.com/edx/edx-lint/blob/d87ccb51a48984806b6442a36992c5b45c3d4d58/edx_lint/tamper_evident.py#L47-L70", "sha": "d87ccb51a48984806b6442a36992c5b45c3d4d58", "docstring_summary": "Check if the file still has its original contents.", "language": "python", "parameters": "(self)", "return_statement": "return actual_hash == expected_hash", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ".", "filename", ",", "\"rb\"", ")", "as", "f", ":", "arg_1", "=", "f", ".", "read", "(", ")", "arg_2", "=", "arg_1", ".", "rfind", "(", "b\"\\n\"", ",", "0", ",", "-", "1", ")", "if", "arg_2", "==", "-", "1", ":", "return", "False", "arg_3", "=", "arg_1", "[", ":", "arg_2", "+", "1", "]", "arg_4", "=", "arg_1", "[", "arg_2", "+", "1", ":", "]", "arg_5", "=", "hashlib", ".", "sha1", "(", "arg_3", ")", ".", "hexdigest", "(", ")", ".", "encode", "(", "'utf8'", ")", "arg_6", "=", "re", ".", "search", "(", "b\"[0-9a-f]{40}\"", ",", "arg_4", ")", "if", "not", "arg_6", ":", "return", "False", "arg_7", "=", "arg_6", ".", "group", "(", "0", ")", "return", "arg_7", "==", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"\n        Check if the file still has its original contents.\n\n        Returns True if the file is unchanged, False if it has been tampered\n        with.\n        \"\"\"\n\n        with open(arg_0.filename, \"rb\") as f:\n            arg_1 = f.read()\n\n        arg_2 = arg_1.rfind(b\"\\n\", 0, -1)\n        if arg_2 == -1:\n            return False\n\n        arg_3 = arg_1[:arg_2+1]\n        arg_4 = arg_1[arg_2+1:]\n\n        arg_5 = hashlib.sha1(arg_3).hexdigest().encode('utf8')\n        arg_6 = re.search(b\"[0-9a-f]{40}\", arg_4)\n        if not arg_6:\n            return False\n        arg_7 = arg_6.group(0)\n        return arg_7 == arg_5", "path": "edx_lint/tamper_evident.py", "identifier": "TamperEvidentFile.validate", "docstring": "Check if the file still has its original contents.\n\n        Returns True if the file is unchanged, False if it has been tampered\n        with.", "docstring_tokens": ["Check", "if", "the", "file", "still", "has", "its", "original", "contents", "."], "nwo": "edx/edx-lint", "score": 0.3933713915493414, "idx": 256172}
{"url": "https://github.com/evonove/django-stored-messages/blob/23b71f952d5d3fd03285f5e700879d05796ef7ba/stored_messages/storage.py#L23-L34", "sha": "23b71f952d5d3fd03285f5e700879d05796ef7ba", "docstring_summary": "Retrieve unread messages for current user, both from the inbox and\n        from other storages", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return messages + inbox_messages, all_retrieved", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "super", "(", "StorageMixin", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "arg_0", ".", "user", ".", "is_authenticated", "(", ")", ":", "arg_5", "=", "arg_0", ".", "backend", ".", "inbox_list", "(", "arg_0", ".", "user", ")", "else", ":", "arg_5", "=", "[", "]", "return", "arg_3", "+", "arg_5", ",", "arg_4"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Retrieve unread messages for current user, both from the inbox and\n        from other storages\n        \"\"\"\n        arg_3, arg_4 = super(StorageMixin, arg_0).Func(*arg_1, **arg_2)\n        if arg_0.user.is_authenticated():\n            arg_5 = arg_0.backend.inbox_list(arg_0.user)\n        else:\n            arg_5 = []\n\n        return arg_3 + arg_5, arg_4", "path": "stored_messages/storage.py", "identifier": "StorageMixin._get", "docstring": "Retrieve unread messages for current user, both from the inbox and\n        from other storages", "docstring_tokens": ["Retrieve", "unread", "messages", "for", "current", "user", "both", "from", "the", "inbox", "and", "from", "other", "storages"], "nwo": "evonove/django-stored-messages", "score": 0.18816089823412419, "idx": 256173}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/replica_exchange_mc.py#L419-L498", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Get list of TensorArrays holding exchanged states, and zeros.", "language": "python", "parameters": "(self, old_states, exchange_proposed,\n                            exchange_proposed_n, sampled_replica_states,\n                            sampled_replica_results)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "'get_exchanged_states'", ")", ":", "arg_6", "=", "[", "]", "for", "arg_7", "in", "range", "(", "arg_0", ".", "num_replica", ")", ":", "arg_8", "=", "_get_field", "(", "arg_5", "[", "arg_7", "]", ",", "'target_log_prob'", ")", "arg_9", "=", "arg_0", ".", "inverse_temperatures", "[", "arg_7", "]", "arg_6", ".", "append", "(", "arg_8", "/", "arg_9", ")", "arg_6", "=", "tf", ".", "stack", "(", "arg_6", ",", "axis", "=", "0", ")", "arg_10", "=", "arg_6", ".", "dtype", "arg_11", "=", "len", "(", "arg_4", "[", "0", "]", ")", "arg_12", "=", "[", "tf", ".", "TensorArray", "(", "arg_10", ",", "size", "=", "arg_0", ".", "num_replica", ",", "dynamic_size", "=", "False", ",", "tensor_array_name", "=", "'exchanged_states'", ",", "element_shape", "=", "arg_4", "[", "0", "]", "[", "arg_26", "]", ".", "shape", ")", "for", "arg_26", "in", "range", "(", "arg_11", ")", "]", "arg_13", "=", "tf", ".", "concat", "(", "(", "[", "arg_0", ".", "num_replica", "//", "2", "]", ",", "tf", ".", "shape", "(", "input", "=", "arg_6", ")", "[", "1", ":", "]", ")", ",", "axis", "=", "0", ")", "arg_14", "=", "tf", ".", "math", ".", "log", "(", "tf", ".", "random", ".", "uniform", "(", "shape", "=", "arg_13", ",", "arg_10", "=", "arg_10", ",", "seed", "=", "arg_0", ".", "_seed_stream", "(", ")", ")", ")", "def", "_swap", "(", "arg_15", ",", "arg_16", ",", "arg_17", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "'swap_where_exchange_accepted'", ")", ":", "arg_18", "=", "mcmc_util", ".", "choose", "(", "arg_15", ",", "arg_17", ",", "arg_16", ")", "arg_19", "=", "mcmc_util", ".", "choose", "(", "arg_15", ",", "arg_16", ",", "arg_17", ")", "return", "arg_18", ",", "arg_19", "def", "cond", "(", "arg_20", ",", "arg_21", ")", ":", "return", "arg_20", "<", "arg_3", "def", "body", "(", "arg_20", ",", "arg_12", ")", ":", "arg_22", ",", "arg_23", "=", "tf", ".", "unstack", "(", "arg_2", "[", "arg_20", "]", ")", "arg_24", "=", "arg_0", ".", "inverse_temperatures", "[", "arg_22", "]", "-", "arg_0", ".", "inverse_temperatures", "[", "arg_23", "]", "arg_25", "=", "mcmc_util", ".", "safe_sum", "(", "[", "-", "arg_24", "*", "arg_6", "[", "arg_22", "]", ",", "arg_24", "*", "arg_6", "[", "arg_23", "]", "]", ")", "arg_15", "=", "arg_14", "[", "arg_20", "]", "<", "arg_25", "for", "arg_26", "in", "range", "(", "arg_11", ")", ":", "arg_27", ",", "arg_28", "=", "_swap", "(", "arg_15", ",", "arg_1", "[", "arg_26", "]", ".", "read", "(", "arg_22", ")", ",", "arg_1", "[", "arg_26", "]", ".", "read", "(", "arg_23", ")", ")", "arg_12", "[", "arg_26", "]", "=", "arg_12", "[", "arg_26", "]", ".", "write", "(", "arg_22", ",", "arg_27", ")", "arg_12", "[", "arg_26", "]", "=", "arg_12", "[", "arg_26", "]", ".", "write", "(", "arg_23", ",", "arg_28", ")", "return", "arg_20", "+", "1", ",", "arg_12", "return", "tf", ".", "while_loop", "(", "cond", "=", "cond", ",", "body", "=", "body", ",", "loop_vars", "=", "[", "tf", ".", "constant", "(", "0", ")", ",", "arg_12", "]", ")", "[", "1", "]"], "function": "def Func(arg_0, arg_1, arg_2,\n                            arg_3, arg_4,\n                            arg_5):\n    \"\"\"Get list of TensorArrays holding exchanged states, and zeros.\"\"\"\n    with tf.compat.v1.name_scope('get_exchanged_states'):\n\n      arg_6 = []\n      for arg_7 in range(arg_0.num_replica):\n        arg_8 = _get_field(arg_5[arg_7],\n                                      'target_log_prob')\n        arg_9 = arg_0.inverse_temperatures[arg_7]\n        arg_6.append(arg_8 / arg_9)\n      arg_6 = tf.stack(arg_6, axis=0)\n\n      arg_10 = arg_6.dtype\n      arg_11 = len(arg_4[0])\n      # exchanged_states[k][i] is Tensor of (new) state part k, for replica i.\n      # The `k` will be known statically, and `i` is a Tensor.\n      # We will insert values into indices `i` for every replica with a proposed\n      # exchange.\n      arg_12 = [\n          tf.TensorArray(\n              arg_10,\n              size=arg_0.num_replica,\n              dynamic_size=False,\n              tensor_array_name='exchanged_states',\n              # State part k has same shape, regardless of replica.  So use 0.\n              element_shape=arg_4[0][arg_26].shape)\n          for arg_26 in range(arg_11)\n      ]\n\n      # Draw random variables here, to avoid sampling in the loop (and losing\n      # reproducibility).  This may mean we sample too many, but we will always\n      # have enough.\n      arg_13 = tf.concat(\n          ([arg_0.num_replica // 2], tf.shape(input=arg_6)[1:]),\n          axis=0)\n      arg_14 = tf.math.log(\n          tf.random.uniform(\n              shape=arg_13, arg_10=arg_10, seed=arg_0._seed_stream()))\n\n      def _swap(arg_15, arg_16, arg_17):\n        \"\"\"Swap batches of x, y where accepted.\"\"\"\n        with tf.compat.v1.name_scope('swap_where_exchange_accepted'):\n          arg_18 = mcmc_util.choose(arg_15, arg_17, arg_16)\n          arg_19 = mcmc_util.choose(arg_15, arg_16, arg_17)\n        return arg_18, arg_19\n\n      def cond(arg_20, arg_21):\n        return arg_20 < arg_3\n\n      def body(arg_20, arg_12):\n        \"\"\"Body of while loop for exchanging states.\"\"\"\n        # Propose exchange between replicas indexed by m and n.\n        arg_22, arg_23 = tf.unstack(arg_2[arg_20])\n\n        # Construct log_accept_ratio:  -temp_diff * target_log_prob_diff.\n        # Note target_log_prob_diff = -EnergyDiff (common definition is in terms\n        # of energy).\n        arg_24 = arg_0.inverse_temperatures[arg_22] - arg_0.inverse_temperatures[arg_23]\n        # Difference of target log probs may be +- Inf or NaN.  We want the\n        # product of this with the temperature difference to have \"alt value\" of\n        # -Inf.\n        arg_25 = mcmc_util.safe_sum(\n            [-arg_24 * arg_6[arg_22], arg_24 * arg_6[arg_23]])\n\n        arg_15 = arg_14[arg_20] < arg_25\n\n        for arg_26 in range(arg_11):\n          arg_27, arg_28 = _swap(arg_15, arg_1[arg_26].read(arg_22),\n                               arg_1[arg_26].read(arg_23))\n          arg_12[arg_26] = arg_12[arg_26].write(arg_22, arg_27)\n          arg_12[arg_26] = arg_12[arg_26].write(arg_23, arg_28)\n\n        return arg_20 + 1, arg_12\n\n      # At this point, exchanged_states[k] is a length num_replicas TensorArray.\n      return tf.while_loop(\n          cond=cond, body=body, loop_vars=[tf.constant(0),\n                                           arg_12])[1]", "path": "tensorflow_probability/python/mcmc/replica_exchange_mc.py", "identifier": "ReplicaExchangeMC._get_exchanged_states", "docstring": "Get list of TensorArrays holding exchanged states, and zeros.", "docstring_tokens": ["Get", "list", "of", "TensorArrays", "holding", "exchanged", "states", "and", "zeros", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256174}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/dencrypt.py#L35-L99", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Generator that encrypts a content stream using AES 256 in CBC\n    mode.", "language": "python", "parameters": "(key, stdin, preamble=None, chunk_size=65536,\n                content_length=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "65536", ",", "arg_4", "=", "None", ")", ":", "if", "not", "AES256CBC_Support", ":", "raise", "Exception", "(", "'AES256CBC not supported; likely pycrypto is not installed'", ")", "if", "arg_2", ":", "yield", "arg_2", "arg_0", "=", "hashlib", ".", "sha256", "(", "arg_0", ")", ".", "digest", "(", ")", "arg_3", "=", "max", "(", "16", ",", "arg_3", ">>", "4", "<<", "4", ")", "arg_5", "=", "Crypto", ".", "Random", ".", "new", "(", ")", ".", "read", "(", "16", ")", "yield", "arg_5", "arg_6", "=", "Crypto", ".", "Cipher", ".", "AES", ".", "new", "(", "arg_0", ",", "Crypto", ".", "Cipher", ".", "AES", ".", "MODE_CBC", ",", "arg_5", ")", "arg_7", "=", "True", "arg_8", "=", "None", "if", "arg_4", "is", "not", "None", "and", "arg_4", ">=", "0", ":", "arg_8", "=", "arg_4", "while", "arg_7", ":", "arg_9", "=", "arg_3", "if", "arg_8", "is", "not", "None", "and", "arg_9", ">", "arg_8", ":", "arg_9", "=", "arg_8", "arg_10", "=", "arg_1", ".", "read", "(", "arg_9", ")", "if", "not", "arg_10", ":", "if", "arg_8", "is", "not", "None", "and", "arg_8", ">", "0", ":", "raise", "IOError", "(", "'Early EOF from input'", ")", "yield", "arg_6", ".", "encrypt", "(", "'\\x00'", "*", "16", ")", "break", "if", "arg_8", "is", "not", "None", ":", "arg_8", "-=", "len", "(", "arg_10", ")", "if", "arg_8", "<=", "0", ":", "arg_7", "=", "False", "arg_11", "=", "arg_10", "arg_12", "=", "len", "(", "arg_11", ")", "%", "16", "while", "arg_12", ":", "arg_9", "=", "16", "-", "arg_12", "if", "arg_8", "is", "not", "None", "and", "arg_9", ">", "arg_8", ":", "arg_9", "=", "arg_8", "arg_10", "=", "arg_1", ".", "read", "(", "arg_9", ")", "if", "not", "arg_10", ":", "if", "arg_8", "is", "not", "None", "and", "arg_8", ">", "0", ":", "raise", "IOError", "(", "'Early EOF from input'", ")", "arg_7", "=", "False", "arg_10", "=", "chr", "(", "arg_12", ")", "*", "(", "16", "-", "arg_12", ")", "elif", "arg_8", "is", "not", "None", ":", "arg_8", "-=", "len", "(", "arg_10", ")", "if", "arg_8", "<=", "0", ":", "arg_7", "=", "False", "arg_11", "+=", "arg_10", "arg_12", "=", "len", "(", "arg_11", ")", "%", "16", "yield", "arg_6", ".", "encrypt", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=65536,\n                arg_4=None):\n    \"\"\"\n    Generator that encrypts a content stream using AES 256 in CBC\n    mode.\n\n    :param key: Any string to use as the encryption key.\n    :param stdin: Where to read the contents from.\n    :param preamble: str to yield initially useful for providing a\n        hint for future readers as to the algorithm in use.\n    :param chunk_size: Largest amount to read at once.\n    :param content_length: The number of bytes to read from stdin.\n        None or < 0 indicates reading until EOF.\n    \"\"\"\n    if not AES256CBC_Support:\n        raise Exception(\n            'AES256CBC not supported; likely pycrypto is not installed')\n    if arg_2:\n        yield arg_2\n    # Always use 256-bit key\n    arg_0 = hashlib.sha256(arg_0).digest()\n    # At least 16 and a multiple of 16\n    arg_3 = max(16, arg_3 >> 4 << 4)\n    arg_5 = Crypto.Random.new().read(16)\n    yield arg_5\n    arg_6 = Crypto.Cipher.AES.new(arg_0, Crypto.Cipher.AES.MODE_CBC, arg_5)\n    arg_7 = True\n    arg_8 = None\n    if arg_4 is not None and arg_4 >= 0:\n        arg_8 = arg_4\n    while arg_7:\n        arg_9 = arg_3\n        if arg_8 is not None and arg_9 > arg_8:\n            arg_9 = arg_8\n        arg_10 = arg_1.read(arg_9)\n        if not arg_10:\n            if arg_8 is not None and arg_8 > 0:\n                raise IOError('Early EOF from input')\n            # Indicates how many usable bytes in last block\n            yield arg_6.encrypt('\\x00' * 16)\n            break\n        if arg_8 is not None:\n            arg_8 -= len(arg_10)\n            if arg_8 <= 0:\n                arg_7 = False\n        arg_11 = arg_10\n        arg_12 = len(arg_11) % 16\n        while arg_12:\n            arg_9 = 16 - arg_12\n            if arg_8 is not None and arg_9 > arg_8:\n                arg_9 = arg_8\n            arg_10 = arg_1.read(arg_9)\n            if not arg_10:\n                if arg_8 is not None and arg_8 > 0:\n                    raise IOError('Early EOF from input')\n                arg_7 = False\n                # Indicates how many usable bytes in last block\n                arg_10 = chr(arg_12) * (16 - arg_12)\n            elif arg_8 is not None:\n                arg_8 -= len(arg_10)\n                if arg_8 <= 0:\n                    arg_7 = False\n            arg_11 += arg_10\n            arg_12 = len(arg_11) % 16\n        yield arg_6.encrypt(arg_11)", "path": "swiftly/dencrypt.py", "identifier": "aes_encrypt", "docstring": "Generator that encrypts a content stream using AES 256 in CBC\n    mode.\n\n    :param key: Any string to use as the encryption key.\n    :param stdin: Where to read the contents from.\n    :param preamble: str to yield initially useful for providing a\n        hint for future readers as to the algorithm in use.\n    :param chunk_size: Largest amount to read at once.\n    :param content_length: The number of bytes to read from stdin.\n        None or < 0 indicates reading until EOF.", "docstring_tokens": ["Generator", "that", "encrypts", "a", "content", "stream", "using", "AES", "256", "in", "CBC", "mode", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 256175}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py#L165-L200", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return a list of potential user-shared config dirs for this application.", "language": "python", "parameters": "(appname)", "return_statement": "return pathlist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "WINDOWS", ":", "arg_1", "=", "os", ".", "path", ".", "normpath", "(", "_get_win_folder", "(", "\"CSIDL_COMMON_APPDATA\"", ")", ")", "arg_2", "=", "[", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_0", ")", "]", "elif", "sys", ".", "platform", "==", "'darwin'", ":", "arg_2", "=", "[", "os", ".", "path", ".", "join", "(", "'/Library/Application Support'", ",", "arg_0", ")", "]", "else", ":", "arg_3", "=", "os", ".", "getenv", "(", "'XDG_CONFIG_DIRS'", ",", "'/etc/xdg'", ")", "if", "arg_3", ":", "arg_2", "=", "[", "os", ".", "sep", ".", "join", "(", "[", "os", ".", "path", ".", "expanduser", "(", "x", ")", ",", "arg_0", "]", ")", "for", "x", "in", "arg_3", ".", "split", "(", "os", ".", "pathsep", ")", "]", "else", ":", "arg_2", "=", "[", "]", "arg_2", ".", "append", "(", "'/etc'", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Return a list of potential user-shared config dirs for this application.\n\n        \"appname\" is the name of application.\n\n    Typical user config directories are:\n        Mac OS X:   /Library/Application Support/<AppName>/\n        Unix:       /etc or $XDG_CONFIG_DIRS[i]/<AppName>/ for each value in\n                    $XDG_CONFIG_DIRS\n        Win XP:     C:\\Documents and Settings\\All Users\\Application ...\n                    ...Data\\<AppName>\\\n        Vista:      (Fail! \"C:\\ProgramData\" is a hidden *system* directory\n                    on Vista.)\n        Win 7:      Hidden, but writeable on Win 7:\n                    C:\\ProgramData\\<AppName>\\\n    \"\"\"\n    if WINDOWS:\n        arg_1 = os.path.normpath(_get_win_folder(\"CSIDL_COMMON_APPDATA\"))\n        arg_2 = [os.path.join(arg_1, arg_0)]\n    elif sys.platform == 'darwin':\n        arg_2 = [os.path.join('/Library/Application Support', arg_0)]\n    else:\n        # try looking in $XDG_CONFIG_DIRS\n        arg_3 = os.getenv('XDG_CONFIG_DIRS', '/etc/xdg')\n        if arg_3:\n            arg_2 = [\n                os.sep.join([os.path.expanduser(x), arg_0])\n                for x in arg_3.split(os.pathsep)\n            ]\n        else:\n            arg_2 = []\n\n        # always look in /etc directly as well\n        arg_2.append('/etc')\n\n    return arg_2", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py", "identifier": "site_config_dirs", "docstring": "Return a list of potential user-shared config dirs for this application.\n\n        \"appname\" is the name of application.\n\n    Typical user config directories are:\n        Mac OS X:   /Library/Application Support/<AppName>/\n        Unix:       /etc or $XDG_CONFIG_DIRS[i]/<AppName>/ for each value in\n                    $XDG_CONFIG_DIRS\n        Win XP:     C:\\Documents and Settings\\All Users\\Application ...\n                    ...Data\\<AppName>\\\n        Vista:      (Fail! \"C:\\ProgramData\" is a hidden *system* directory\n                    on Vista.)\n        Win 7:      Hidden, but writeable on Win 7:\n                    C:\\ProgramData\\<AppName>\\", "docstring_tokens": ["Return", "a", "list", "of", "potential", "user", "-", "shared", "config", "dirs", "for", "this", "application", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256176}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L5299-L5313", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Moves with zero-extend.", "language": "python", "parameters": "(cpu, op0, op1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "write", "(", "Operators", ".", "ZEXTEND", "(", "arg_2", ".", "read", "(", ")", ",", "arg_1", ".", "size", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Moves with zero-extend.\n\n        Copies the contents of the source operand (register or memory location) to the destination\n        operand (register) and zero extends the value to 16 or 32 bits. The size of the converted value\n        depends on the operand-size attribute::\n\n                OP0  =  ZeroExtend(OP1);\n\n        :param cpu: current CPU.\n        :param op0: destination operand.\n        :param op1: source operand.\n        \"\"\"\n        arg_1.write(Operators.ZEXTEND(arg_2.read(), arg_1.size))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.MOVZX", "docstring": "Moves with zero-extend.\n\n        Copies the contents of the source operand (register or memory location) to the destination\n        operand (register) and zero extends the value to 16 or 32 bits. The size of the converted value\n        depends on the operand-size attribute::\n\n                OP0  =  ZeroExtend(OP1);\n\n        :param cpu: current CPU.\n        :param op0: destination operand.\n        :param op1: source operand.", "docstring_tokens": ["Moves", "with", "zero", "-", "extend", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256177}
{"url": "https://github.com/edoburu/django-debugtools/blob/5c609c00fa9954330cd135fc62a1e18b8e7fea8a/debugtools/formatter.py#L384-L391", "sha": "5c609c00fa9954330cd135fc62a1e18b8e7fea8a", "docstring_summary": "Recursive part of the formatting", "language": "python", "parameters": "(self, object, stream, indent, allowance, context, level)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "try", ":", "PrettyPrinter", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "except", "Exception", "as", "e", ":", "arg_2", ".", "write", "(", "Func_exception", "(", "e", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        \"\"\"\n        Recursive part of the formatting\n        \"\"\"\n        try:\n            PrettyPrinter.Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6)\n        except Exception as e:\n            arg_2.write(Func_exception(e))", "path": "debugtools/formatter.py", "identifier": "DebugPrettyPrinter._format", "docstring": "Recursive part of the formatting", "docstring_tokens": ["Recursive", "part", "of", "the", "formatting"], "nwo": "edoburu/django-debugtools", "score": 0.28520508084306634, "idx": 256178}
{"url": "https://github.com/rainwoodman/sharedmem/blob/b23e59c1ed0e28f7b6c96c17a04d55c700e06e3a/sharedmem/sharedmem.py#L404-L429", "sha": "b23e59c1ed0e28f7b6c96c17a04d55c700e06e3a", "docstring_summary": "Protected get. Get an item from Q.\n            Will block. but if the process group has errors,\n            raise an StopProcessGroup exception.", "language": "python", "parameters": "(self, Q)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "arg_0", ".", "Errors", ".", "empty", "(", ")", ":", "try", ":", "return", "arg_1", ".", "Func", "(", "timeout", "=", "1", ")", "except", "queue", ".", "Empty", ":", "if", "not", "arg_0", ".", "is_alive", "(", ")", ":", "try", ":", "return", "arg_1", ".", "Func", "(", "timeout", "=", "0", ")", "except", "queue", ".", "Empty", ":", "raise", "StopProcessGroup", "else", ":", "continue", "else", ":", "raise", "StopProcessGroup"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Protected Func. Get an item from Q.\n            Will block. but if the process group has errors,\n            raise an StopProcessGroup exception.\n\n            A slave process will terminate upon StopProcessGroup.\n            The master process shall read the error from the process group.\n\n        \"\"\"\n        while arg_0.Errors.empty():\n            try:\n                return arg_1.Func(timeout=1)\n            except queue.Empty:\n                # check if the process group is dead\n                if not arg_0.is_alive():\n                    # todo : can be graceful, in which\n                    # case the last item shall have been\n                    # flushed to Q.\n                    try:\n                        return arg_1.Func(timeout=0)\n                    except queue.Empty:\n                        raise StopProcessGroup\n                else:\n                    continue\n        else:\n            raise StopProcessGroup", "path": "sharedmem/sharedmem.py", "identifier": "ProcessGroup.get", "docstring": "Protected get. Get an item from Q.\n            Will block. but if the process group has errors,\n            raise an StopProcessGroup exception.\n\n            A slave process will terminate upon StopProcessGroup.\n            The master process shall read the error from the process group.", "docstring_tokens": ["Protected", "get", ".", "Get", "an", "item", "from", "Q", ".", "Will", "block", ".", "but", "if", "the", "process", "group", "has", "errors", "raise", "an", "StopProcessGroup", "exception", "."], "nwo": "rainwoodman/sharedmem", "score": 0.35931637326262145, "idx": 256179}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/utils.py#L47-L61", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Computing the scale parameter.", "language": "python", "parameters": "(x)", "return_statement": "return alpha", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_compute_threshold", "(", "arg_0", ")", "arg_2", "=", "tf", ".", "where", "(", "tf", ".", "greater", "(", "arg_0", ",", "arg_1", ")", ",", "arg_0", ",", "tf", ".", "zeros_like", "(", "arg_0", ",", "tf", ".", "float32", ")", ")", "arg_3", "=", "tf", ".", "where", "(", "tf", ".", "less", "(", "arg_0", ",", "-", "arg_1", ")", ",", "arg_0", ",", "tf", ".", "zeros_like", "(", "arg_0", ",", "tf", ".", "float32", ")", ")", "arg_4", "=", "tf", ".", "add", "(", "arg_2", ",", "arg_3", ",", "name", "=", "None", ")", "arg_5", "=", "tf", ".", "abs", "(", "arg_4", ")", "arg_6", "=", "tf", ".", "where", "(", "tf", ".", "greater", "(", "arg_5", ",", "0", ")", ",", "tf", ".", "ones_like", "(", "arg_5", ",", "tf", ".", "float32", ")", ",", "tf", ".", "zeros_like", "(", "arg_5", ",", "tf", ".", "float32", ")", ")", "arg_7", "=", "tf", ".", "reduce_sum", "(", "arg_5", ")", "arg_8", "=", "tf", ".", "reduce_sum", "(", "arg_6", ")", "arg_9", "=", "tf", ".", "div", "(", "arg_7", ",", "arg_8", ")", "return", "arg_9"], "function": "def Func(arg_0):\n    \"\"\"Computing the scale parameter.\"\"\"\n    arg_1 = _compute_threshold(arg_0)\n    arg_2 = tf.where(tf.greater(arg_0, arg_1), arg_0, tf.zeros_like(arg_0, tf.float32))\n    arg_3 = tf.where(tf.less(arg_0, -arg_1), arg_0, tf.zeros_like(arg_0, tf.float32))\n    arg_4 = tf.add(arg_2, arg_3, name=None)\n    arg_5 = tf.abs(arg_4)\n    arg_6 = tf.where(\n        tf.greater(arg_5, 0), tf.ones_like(arg_5, tf.float32),\n        tf.zeros_like(arg_5, tf.float32)\n    )\n    arg_7 = tf.reduce_sum(arg_5)\n    arg_8 = tf.reduce_sum(arg_6)\n    arg_9 = tf.div(arg_7, arg_8)\n    return arg_9", "path": "tensorlayer/layers/utils.py", "identifier": "compute_alpha", "docstring": "Computing the scale parameter.", "docstring_tokens": ["Computing", "the", "scale", "parameter", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 256180}
{"url": "https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/tabular_output/terminaltables_adapter.py#L83-L96", "sha": "3ebd891ac0c02bad061182dbcb54a47fb21980ae", "docstring_summary": "Wrap terminaltables inside a function for TabularOutputFormatter.", "language": "python", "parameters": "(data, headers, table_format=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "(", "'title'", ",", ")", "arg_5", "=", "table_format_handler", "[", "arg_2", "]", "arg_6", "=", "arg_5", "(", "[", "arg_1", "]", "+", "list", "(", "arg_0", ")", ",", "**", "filter_dict_by_key", "(", "arg_3", ",", "arg_4", ")", ")", "arg_7", "=", "terminaltables", ".", "width_and_alignment", ".", "max_dimensions", "(", "arg_6", ".", "table_data", ",", "arg_6", ".", "padding_left", ",", "arg_6", ".", "padding_right", ")", "[", ":", "3", "]", "for", "arg_8", "in", "arg_6", ".", "gen_table", "(", "*", "arg_7", ")", ":", "yield", "u''", ".", "join", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n    \"\"\"Wrap terminaltables inside a function for TabularOutputFormatter.\"\"\"\n    arg_4 = ('title', )\n\n    arg_5 = table_format_handler[arg_2]\n\n    arg_6 = arg_5([arg_1] + list(arg_0), **filter_dict_by_key(arg_3, arg_4))\n\n    arg_7 = terminaltables.width_and_alignment.max_dimensions(\n        arg_6.table_data,\n        arg_6.padding_left,\n        arg_6.padding_right)[:3]\n    for arg_8 in arg_6.gen_table(*arg_7):\n        yield u''.join(arg_8)", "path": "cli_helpers/tabular_output/terminaltables_adapter.py", "identifier": "adapter", "docstring": "Wrap terminaltables inside a function for TabularOutputFormatter.", "docstring_tokens": ["Wrap", "terminaltables", "inside", "a", "function", "for", "TabularOutputFormatter", "."], "nwo": "dbcli/cli_helpers", "score": 0.43979569135490515, "idx": 256181}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L260-L268", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "given a groups dictionary and an ID, return its actual parent ID.", "language": "python", "parameters": "(groups,ID)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "keys", "(", ")", ":", "return", "arg_1", "if", "not", "arg_1", "in", "arg_0", ".", "keys", "(", ")", ":", "for", "arg_2", "in", "arg_0", ".", "keys", "(", ")", ":", "if", "arg_1", "in", "arg_0", "[", "arg_2", "]", ":", "return", "arg_2", "return", "None"], "function": "def Func(arg_0,arg_1):\n    \"\"\"given a groups dictionary and an ID, return its actual Func ID.\"\"\"\n    if arg_1 in arg_0.keys():\n        return arg_1 # already a Func\n    if not arg_1 in arg_0.keys():\n        for arg_2 in arg_0.keys():\n            if arg_1 in arg_0[arg_2]:\n                return arg_2 # found the actual Func\n    return None", "path": "swhlab/common.py", "identifier": "parent", "docstring": "given a groups dictionary and an ID, return its actual parent ID.", "docstring_tokens": ["given", "a", "groups", "dictionary", "and", "an", "ID", "return", "its", "actual", "parent", "ID", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 256182}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/uxpath/ast.py#L713-L721", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Generate token strings which, when joined together, form a valid\n    XPath serialization of the AST.", "language": "python", "parameters": "(xp_ast)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'Func'", ")", ":", "for", "arg_1", "in", "arg_0", ".", "Func", "(", ")", ":", "yield", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_0", ",", "str", ")", ":", "yield", "(", "repr", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    '''Generate token strings which, when joined together, form a valid\n    XPath serialization of the AST.'''\n\n    if hasattr(arg_0, 'Func'):\n        for arg_1 in arg_0.Func():\n            yield(arg_1)\n    elif isinstance(arg_0, str):\n        yield(repr(arg_0))", "path": "pylib/uxml/uxpath/ast.py", "identifier": "_serialize", "docstring": "Generate token strings which, when joined together, form a valid\n    XPath serialization of the AST.", "docstring_tokens": ["Generate", "token", "strings", "which", "when", "joined", "together", "form", "a", "valid", "XPath", "serialization", "of", "the", "AST", "."], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 256183}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/data/utils.py#L449-L460", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Given a file URL, return a md5 query of the file", "language": "python", "parameters": "(url)", "return_statement": "return urlunsplit((scheme, netloc, path, query_string, fragment))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "urlsplit", "(", "arg_0", ")", "arg_3", "+=", "'.md5'", "return", "urlunsplit", "(", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Given a file URL, return a md5 query of the file\n\n    Args:\n        url: a given URL\n    Returns:\n        URL of the md5 file\n    \"\"\"\n    arg_1, arg_2, arg_3, arg_4, arg_5 = urlsplit(arg_0)\n    arg_3 += '.md5'\n\n    return urlunsplit((arg_1, arg_2, arg_3, arg_4, arg_5))", "path": "deeppavlov/core/data/utils.py", "identifier": "path_set_md5", "docstring": "Given a file URL, return a md5 query of the file\n\n    Args:\n        url: a given URL\n    Returns:\n        URL of the md5 file", "docstring_tokens": ["Given", "a", "file", "URL", "return", "a", "md5", "query", "of", "the", "file"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 256184}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L290-L329", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the running average of a waveform's dependent variable vector.", "language": "python", "parameters": "(wave, indep_min=None, indep_max=None)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "copy", ".", "copy", "(", "arg_0", ")", "_bound_waveform", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "arg_4", "=", "_running_area", "(", "arg_3", ".", "_indep_vector", ",", "arg_3", ".", "_dep_vector", ")", "arg_4", "[", "0", "]", "=", "arg_3", ".", "_dep_vector", "[", "0", "]", "arg_5", "=", "arg_3", ".", "_indep_vector", "-", "arg_3", ".", "_indep_vector", "[", "0", "]", "arg_5", "[", "0", "]", "=", "1.0", "arg_3", ".", "_dep_vector", "=", "np", ".", "divide", "(", "arg_4", ",", "arg_5", ")", "arg_3", ".", "dep_name", "=", "\"Func({0})\"", ".", "format", "(", "arg_3", ".", "_dep_name", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    r\"\"\"\n    Return the running Func of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]\n    \"\"\"\n    arg_3 = copy.copy(arg_0)\n    _bound_waveform(arg_3, arg_1, arg_2)\n    arg_4 = _running_area(arg_3._indep_vector, arg_3._dep_vector)\n    arg_4[0] = arg_3._dep_vector[0]\n    arg_5 = arg_3._indep_vector - arg_3._indep_vector[0]\n    arg_5[0] = 1.0\n    arg_3._dep_vector = np.divide(arg_4, arg_5)\n    arg_3.dep_name = \"Func({0})\".format(arg_3._dep_name)\n    return arg_3", "path": "peng/wave_functions.py", "identifier": "average", "docstring": "r\"\"\"\n    Return the running average of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.average\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "running", "average", "of", "a", "waveform", "s", "dependent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 256185}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L180-L184", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that the val is identical to other, via 'is' compare.", "language": "python", "parameters": "(self, other)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "val", "is", "not", "arg_1", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to be identical to <%s>, but was not.'", "%", "(", "arg_0", ".", "val", ",", "arg_1", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Asserts that the val is identical to other, via 'is' compare.\"\"\"\n        if arg_0.val is not arg_1:\n            arg_0._err('Expected <%s> to be identical to <%s>, but was not.' % (arg_0.val, arg_1))\n        return arg_0", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.is_same_as", "docstring": "Asserts that the val is identical to other, via 'is' compare.", "docstring_tokens": ["Asserts", "that", "the", "val", "is", "identical", "to", "other", "via", "is", "compare", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 256186}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/timer.py#L63-L71", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Total time since the timer is started.", "language": "python", "parameters": "(self)", "return_statement": "return self._t_last - self._t_start", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_is_running", ":", "raise", "TimerError", "(", "'timer is not running'", ")", "arg_0", ".", "_t_last", "=", "time", "(", ")", "return", "arg_0", ".", "_t_last", "-", "arg_0", ".", "_t_start"], "function": "def Func(arg_0):\n        \"\"\"Total time since the timer is started.\n\n        Returns (float): Time in seconds.\n        \"\"\"\n        if not arg_0._is_running:\n            raise TimerError('timer is not running')\n        arg_0._t_last = time()\n        return arg_0._t_last - arg_0._t_start", "path": "mmcv/utils/timer.py", "identifier": "Timer.since_start", "docstring": "Total time since the timer is started.\n\n        Returns (float): Time in seconds.", "docstring_tokens": ["Total", "time", "since", "the", "timer", "is", "started", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 256187}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L581-L606", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Build list of arguments from the dict; keys must be valid  gromacs flags.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return list(map(str, arglist))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "arg_3", "=", "str", "(", "arg_3", ")", "if", "arg_3", ".", "startswith", "(", "'_'", ")", ":", "arg_3", "=", "arg_3", "[", "1", ":", "]", "if", "not", "arg_3", ".", "startswith", "(", "'-'", ")", ":", "arg_3", "=", "'-'", "+", "arg_3", "if", "arg_4", "is", "True", ":", "arg_2", ".", "append", "(", "arg_3", ")", "elif", "arg_4", "is", "False", ":", "if", "arg_3", ".", "startswith", "(", "'-no'", ")", ":", "arg_2", ".", "append", "(", "'-'", "+", "arg_3", "[", "3", ":", "]", ")", "else", ":", "arg_2", ".", "append", "(", "'-no'", "+", "arg_3", "[", "1", ":", "]", ")", "elif", "arg_4", "is", "None", ":", "pass", "else", ":", "try", ":", "arg_2", ".", "extend", "(", "[", "arg_3", "]", "+", "arg_4", ")", "except", "TypeError", ":", "arg_2", ".", "extend", "(", "[", "arg_3", ",", "arg_4", "]", ")", "return", "list", "(", "map", "(", "str", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Build list of arguments from the dict; keys must be valid  gromacs flags.\"\"\"\n        arg_2 = []\n        for arg_3, arg_4 in arg_1.items():\n            # XXX: check flag against allowed values\n            arg_3 = str(arg_3)\n            if arg_3.startswith('_'):\n                arg_3 = arg_3[1:]                 # python-illegal keywords are '_'-quoted\n            if not arg_3.startswith('-'):\n                arg_3 = '-' + arg_3               # now flag is guaranteed to start with '-'\n            if arg_4 is True:\n                arg_2.append(arg_3)            # simple command line flag\n            elif arg_4 is False:\n                if arg_3.startswith('-no'):\n                    # negate a negated flag ('noX=False' --> X=True --> -X ... but who uses that?)\n                    arg_2.append('-' + arg_3[3:])\n                else:\n                    arg_2.append('-no' + arg_3[1:])  # gromacs switches booleans by prefixing 'no'\n            elif arg_4 is None:\n                pass                            # ignore flag = None\n            else:\n                try:\n                    arg_2.extend([arg_3] + arg_4) # option with value list\n                except TypeError:\n                    arg_2.extend([arg_3, arg_4])  # option with single value\n        return list(map(str, arg_2))", "path": "gromacs/core.py", "identifier": "GromacsCommand._build_arg_list", "docstring": "Build list of arguments from the dict; keys must be valid  gromacs flags.", "docstring_tokens": ["Build", "list", "of", "arguments", "from", "the", "dict", ";", "keys", "must", "be", "valid", "gromacs", "flags", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 256188}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/png.py#L69-L105", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Export a numpy array to a set of png files, with each Z-index 2D\n    array as its own 2D file.", "language": "python", "parameters": "(png_filename_base, numpy_data, start_layers_at=1)", "return_statement": "return output_files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "arg_0", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "if", "arg_3", "in", "[", "'png'", "]", ":", "arg_4", "=", "'.'", ".", "join", "(", "arg_0", ".", "split", "(", "'.'", ")", "[", ":", "-", "1", "]", ")", "else", ":", "arg_4", "=", "arg_0", "arg_3", "=", "\".png\"", "arg_5", "=", "arg_4", ".", "split", "(", "'*'", ")", "arg_6", "=", "[", "]", "arg_7", "=", "arg_2", "for", "arg_8", "in", "arg_1", ":", "arg_9", "=", "(", "str", "(", "arg_7", ")", ".", "zfill", "(", "6", ")", ")", ".", "join", "(", "arg_5", ")", "+", "arg_3", "arg_6", ".", "append", "(", "save", "(", "arg_9", ",", "arg_8", ")", ")", "arg_7", "+=", "1", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=1):\n    \"\"\"\n    Export a numpy array to a set of png files, with each Z-index 2D\n    array as its own 2D file.\n\n    Arguments:\n        png_filename_base:     A filename template, such as \"my-image-*.png\"\n                                which will lead to a collection of files named\n                                \"my-image-0.png\", \"my-image-1.png\", etc.\n        numpy_data:             The numpy array data to save to png.\n\n    Returns:\n        Array. A list of expanded filenames that hold png data.\n    \"\"\"\n    arg_3 = arg_0.split('.')[-1]\n    if arg_3 in ['png']:\n        # Filename is \"name*.ext\", set file_base to \"name*\".\n        arg_4 = '.'.join(arg_0.split('.')[:-1])\n    else:\n        # Filename is \"name*\", set file_base to \"name*\".\n        # That is, extension wasn't included.\n        arg_4 = arg_0\n        arg_3 = \".png\"\n\n    arg_5 = arg_4.split('*')\n\n    # The array of filenames to return\n    arg_6 = []\n\n    # Filename 0-padding\n    arg_7 = arg_2\n    for arg_8 in arg_1:\n        arg_9 = (str(arg_7).zfill(6)).join(arg_5) + arg_3\n        arg_6.append(save(arg_9, arg_8))\n        arg_7 += 1\n\n    return arg_6", "path": "ndio/convert/png.py", "identifier": "save_collection", "docstring": "Export a numpy array to a set of png files, with each Z-index 2D\n    array as its own 2D file.\n\n    Arguments:\n        png_filename_base:     A filename template, such as \"my-image-*.png\"\n                                which will lead to a collection of files named\n                                \"my-image-0.png\", \"my-image-1.png\", etc.\n        numpy_data:             The numpy array data to save to png.\n\n    Returns:\n        Array. A list of expanded filenames that hold png data.", "docstring_tokens": ["Export", "a", "numpy", "array", "to", "a", "set", "of", "png", "files", "with", "each", "Z", "-", "index", "2D", "array", "as", "its", "own", "2D", "file", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 256189}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/examples/music-v3.py#L303-L323", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Lists the first 10 search results from a given query.", "language": "python", "parameters": "(self, ctx, *, query)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", ",", "arg_2", ")", ":", "if", "not", "arg_2", ".", "startswith", "(", "'ytsearch:'", ")", "and", "not", "arg_2", ".", "startswith", "(", "'scsearch:'", ")", ":", "arg_2", "=", "'ytsearch:'", "+", "arg_2", "arg_3", "=", "await", "arg_0", ".", "bot", ".", "lavalink", ".", "get_tracks", "(", "arg_2", ")", "if", "not", "arg_3", "or", "not", "arg_3", "[", "'tracks'", "]", ":", "return", "await", "arg_1", ".", "send", "(", "'Nothing found'", ")", "arg_4", "=", "arg_3", "[", "'tracks'", "]", "[", ":", "10", "]", "arg_5", "=", "''", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_4", ",", "start", "=", "1", ")", ":", "arg_8", "=", "arg_7", "[", "\"info\"", "]", "[", "\"title\"", "]", "arg_9", "=", "arg_7", "[", "\"info\"", "]", "[", "\"uri\"", "]", "arg_5", "+=", "f'`{index}.` [{track_title}]({track_uri})\\n'", "arg_10", "=", "discord", ".", "Embed", "(", "color", "=", "discord", ".", "Color", ".", "blurple", "(", ")", ",", "description", "=", "arg_5", ")", "await", "arg_1", ".", "send", "(", "arg_10", "=", "arg_10", ")"], "function": "async def Func(arg_0, arg_1, *, arg_2):\r\n        \"\"\" Lists the first 10 search results from a given query. \"\"\"\r\n        if not arg_2.startswith('ytsearch:') and not arg_2.startswith('scsearch:'):\r\n            arg_2 = 'ytsearch:' + arg_2\r\n\r\n        arg_3 = await arg_0.bot.lavalink.get_tracks(arg_2)\r\n\r\n        if not arg_3 or not arg_3['tracks']:\r\n            return await arg_1.send('Nothing found')\r\n\r\n        arg_4 = arg_3['tracks'][:10]  # First 10 results\r\n\r\n        arg_5 = ''\r\n        for arg_6, arg_7 in enumerate(arg_4, start=1):\r\n            arg_8 = arg_7[\"info\"][\"title\"]\r\n            arg_9 = arg_7[\"info\"][\"uri\"]\r\n\r\n            arg_5 += f'`{index}.` [{track_title}]({track_uri})\\n'\r\n\r\n        arg_10 = discord.Embed(color=discord.Color.blurple(), description=arg_5)\r\n        await arg_1.send(arg_10=arg_10)", "path": "examples/music-v3.py", "identifier": "Music._find", "docstring": "Lists the first 10 search results from a given query.", "docstring_tokens": ["Lists", "the", "first", "10", "search", "results", "from", "a", "given", "query", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 256190}
{"url": "https://github.com/globality-corp/flake8-logging-format/blob/3c6ce53d0ff1ec369799cff0ed6d048343252e40/logging_format/visitor.py#L170-L182", "sha": "3c6ce53d0ff1ec369799cff0ed6d048343252e40", "docstring_summary": "Process except blocks.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_except_handler_name", "(", "arg_1", ")", "if", "not", "arg_2", ":", "super", "(", "LoggingVisitor", ",", "arg_0", ")", ".", "generic_visit", "(", "arg_1", ")", "return", "arg_0", ".", "current_except_names", ".", "append", "(", "arg_2", ")", "super", "(", "LoggingVisitor", ",", "arg_0", ")", ".", "generic_visit", "(", "arg_1", ")", "arg_0", ".", "current_except_names", ".", "pop", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Process except blocks.\n\n        \"\"\"\n        arg_2 = arg_0.get_except_handler_name(arg_1)\n        if not arg_2:\n            super(LoggingVisitor, arg_0).generic_visit(arg_1)\n            return\n\n        arg_0.current_except_names.append(arg_2)\n        super(LoggingVisitor, arg_0).generic_visit(arg_1)\n        arg_0.current_except_names.pop()", "path": "logging_format/visitor.py", "identifier": "LoggingVisitor.visit_ExceptHandler", "docstring": "Process except blocks.", "docstring_tokens": ["Process", "except", "blocks", "."], "nwo": "globality-corp/flake8-logging-format", "score": 0.5445282565269285, "idx": 256191}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L87-L97", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Returns the number of results after filtering with the given arguments.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "create_search", "(", "*", "arg_1", ",", "**", "arg_2", ")", "try", ":", "return", "arg_3", ".", "Func", "(", ")", "except", "NotFoundError", ":", "print_error", "(", "\"The index was not found, have you initialized the index?\"", ")", "except", "(", "ConnectionError", ",", "TransportError", ")", ":", "print_error", "(", "\"Cannot connect to elasticsearch\"", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n            Returns the number of results after filtering with the given arguments.\n        \"\"\"\n        arg_3 = arg_0.create_search(*arg_1, **arg_2)\n        try:\n            return arg_3.Func()\n        except NotFoundError:\n            print_error(\"The index was not found, have you initialized the index?\")\n        except (ConnectionError, TransportError):\n            print_error(\"Cannot connect to elasticsearch\")", "path": "jackal/core.py", "identifier": "CoreSearch.count", "docstring": "Returns the number of results after filtering with the given arguments.", "docstring_tokens": ["Returns", "the", "number", "of", "results", "after", "filtering", "with", "the", "given", "arguments", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 256192}
{"url": "https://github.com/zsennenga/module-discovery-utils/blob/146d31051915f2347483fff9549eb272bd6b7d45/module_discovery_utils/module_discovery_utils.py#L8-L50", "sha": "146d31051915f2347483fff9549eb272bd6b7d45", "docstring_summary": "Recursively loads all modules from a package object, or set of package objects", "language": "python", "parameters": "(package_or_set_of_packages)", "return_statement": "return list(\n        {\n            module.__name__: module\n\n            for module in imported\n        }.values()\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "types", ".", "ModuleType", ")", ":", "arg_1", "=", "[", "arg_0", "]", "elif", "isinstance", "(", "arg_0", ",", "Iterable", ")", "and", "not", "isinstance", "(", "arg_0", ",", "(", "dict", ",", "str", ")", ")", ":", "arg_1", "=", "arg_0", "else", ":", "raise", "Exception", "(", "\"This function only accepts a module reference, or an iterable of said objects\"", ")", "arg_2", "=", "arg_1", ".", "copy", "(", ")", "for", "arg_3", "in", "arg_1", ":", "if", "not", "hasattr", "(", "arg_3", ",", "'__path__'", ")", ":", "raise", "Exception", "(", "'Package object passed in has no __path__ attribute. '", "'Make sure to pass in imported references to the packages in question.'", ")", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "pkgutil", ".", "walk_packages", "(", "arg_3", ".", "__path__", ")", ":", "arg_7", "=", "'{}.{}'", ".", "format", "(", "arg_3", ".", "__name__", ",", "arg_5", ")", "arg_8", "=", "importlib", ".", "import_module", "(", "arg_7", ")", "arg_2", ".", "append", "(", "arg_8", ")", "if", "arg_6", ":", "arg_2", "+=", "Func", "(", "arg_8", ")", "for", "arg_9", "in", "arg_2", ":", "dir", "(", "arg_9", ")", "return", "list", "(", "{", "arg_9", ".", "__name__", ":", "arg_9", "for", "arg_9", "in", "arg_2", "}", ".", "values", "(", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Recursively loads all modules from a package object, or set of package objects\n\n    :param package_or_set_of_packages: package object, or iterable of package objects\n    :return: list of all unique modules discovered by the function\n    \"\"\"\n    if isinstance(arg_0, types.ModuleType):\n        arg_1 = [arg_0]\n    elif isinstance(arg_0, Iterable) and not isinstance(arg_0, (dict, str)):\n        arg_1 = arg_0\n    else:\n        raise Exception(\"This function only accepts a module reference, or an iterable of said objects\")\n\n    arg_2 = arg_1.copy()\n\n    for arg_3 in arg_1:\n        if not hasattr(arg_3, '__path__'):\n            raise Exception(\n                'Package object passed in has no __path__ attribute. '\n                'Make sure to pass in imported references to the packages in question.'\n            )\n\n        for arg_4, arg_5, arg_6 in pkgutil.walk_packages(arg_3.__path__):\n            arg_7 = '{}.{}'.format(arg_3.__name__, arg_5)\n            arg_8 = importlib.import_module(arg_7)\n            arg_2.append(arg_8)\n            if arg_6:\n                arg_2 += Func(arg_8)\n\n    for arg_9 in arg_2:\n        # This is to cover cases where simply importing a module doesn't execute all the code/definitions within\n        # I don't totally understand the reasons for this, but I do know enumerating a module's context (like with dir)\n        # seems to solve things\n        dir(arg_9)\n\n    return list(\n        {\n            arg_9.__name__: arg_9\n\n            for arg_9 in arg_2\n        }.values()\n    )", "path": "module_discovery_utils/module_discovery_utils.py", "identifier": "load_all_modules_in_packages", "docstring": "Recursively loads all modules from a package object, or set of package objects\n\n    :param package_or_set_of_packages: package object, or iterable of package objects\n    :return: list of all unique modules discovered by the function", "docstring_tokens": ["Recursively", "loads", "all", "modules", "from", "a", "package", "object", "or", "set", "of", "package", "objects"], "nwo": "zsennenga/module-discovery-utils", "score": 0.0, "idx": 256193}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1657-L1703", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Method returns full list of BigQuery datasets in the current project", "language": "python", "parameters": "(self, project_id=None)", "return_statement": "return datasets_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_1", "if", "arg_1", "else", "arg_0", ".", "project_id", "try", ":", "arg_3", "=", "arg_0", ".", "service", ".", "datasets", "(", ")", ".", "list", "(", "projectId", "=", "arg_2", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "[", "'datasets'", "]", "arg_0", ".", "log", ".", "info", "(", "\"Datasets List: %s\"", ",", "arg_3", ")", "except", "HttpError", "as", "err", ":", "raise", "AirflowException", "(", "'BigQuery job failed. Error was: {}'", ".", "format", "(", "err", ".", "content", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Method returns full list of BigQuery datasets in the current project\n\n        .. seealso::\n            For more information, see:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/list\n\n        :param project_id: Google Cloud Project for which you\n            try to get all datasets\n        :type project_id: str\n        :return: datasets_list\n\n            Example of returned datasets_list: ::\n\n                   {\n                      \"kind\":\"bigquery#dataset\",\n                      \"location\":\"US\",\n                      \"id\":\"your-project:dataset_2_test\",\n                      \"datasetReference\":{\n                         \"projectId\":\"your-project\",\n                         \"datasetId\":\"dataset_2_test\"\n                      }\n                   },\n                   {\n                      \"kind\":\"bigquery#dataset\",\n                      \"location\":\"US\",\n                      \"id\":\"your-project:dataset_1_test\",\n                      \"datasetReference\":{\n                         \"projectId\":\"your-project\",\n                         \"datasetId\":\"dataset_1_test\"\n                      }\n                   }\n                ]\n        \"\"\"\n        arg_2 = arg_1 if arg_1 else arg_0.project_id\n\n        try:\n            arg_3 = arg_0.service.datasets().list(\n                projectId=arg_2).execute(num_retries=arg_0.num_retries)['datasets']\n            arg_0.log.info(\"Datasets List: %s\", arg_3)\n\n        except HttpError as err:\n            raise AirflowException(\n                'BigQuery job failed. Error was: {}'.format(err.content))\n\n        return arg_3", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryBaseCursor.get_datasets_list", "docstring": "Method returns full list of BigQuery datasets in the current project\n\n        .. seealso::\n            For more information, see:\n            https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/list\n\n        :param project_id: Google Cloud Project for which you\n            try to get all datasets\n        :type project_id: str\n        :return: datasets_list\n\n            Example of returned datasets_list: ::\n\n                   {\n                      \"kind\":\"bigquery#dataset\",\n                      \"location\":\"US\",\n                      \"id\":\"your-project:dataset_2_test\",\n                      \"datasetReference\":{\n                         \"projectId\":\"your-project\",\n                         \"datasetId\":\"dataset_2_test\"\n                      }\n                   },\n                   {\n                      \"kind\":\"bigquery#dataset\",\n                      \"location\":\"US\",\n                      \"id\":\"your-project:dataset_1_test\",\n                      \"datasetReference\":{\n                         \"projectId\":\"your-project\",\n                         \"datasetId\":\"dataset_1_test\"\n                      }\n                   }\n                ]", "docstring_tokens": ["Method", "returns", "full", "list", "of", "BigQuery", "datasets", "in", "the", "current", "project"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256194}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/memory.py#L748-L764", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Returns a sorted list of all the mappings for this memory.", "language": "python", "parameters": "(self)", "return_statement": "return sorted(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "maps", ":", "if", "isinstance", "(", "arg_2", ",", "AnonMap", ")", ":", "arg_1", ".", "append", "(", "(", "arg_2", ".", "start", ",", "arg_2", ".", "end", ",", "arg_2", ".", "perms", ",", "0", ",", "''", ")", ")", "elif", "isinstance", "(", "arg_2", ",", "FileMap", ")", ":", "arg_1", ".", "append", "(", "(", "arg_2", ".", "start", ",", "arg_2", ".", "end", ",", "arg_2", ".", "perms", ",", "arg_2", ".", "_offset", ",", "arg_2", ".", "_filename", ")", ")", "else", ":", "arg_1", ".", "append", "(", "(", "arg_2", ".", "start", ",", "arg_2", ".", "end", ",", "arg_2", ".", "perms", ",", "0", ",", "arg_2", ".", "name", ")", ")", "return", "sorted", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a sorted list of all the Func for this memory.\n\n        :return: a list of Func.\n        :rtype: list\n        \"\"\"\n        arg_1 = []\n        for arg_2 in arg_0.maps:\n            if isinstance(arg_2, AnonMap):\n                arg_1.append((arg_2.start, arg_2.end, arg_2.perms, 0, ''))\n            elif isinstance(arg_2, FileMap):\n                arg_1.append((arg_2.start, arg_2.end, arg_2.perms, arg_2._offset, arg_2._filename))\n            else:\n                arg_1.append((arg_2.start, arg_2.end, arg_2.perms, 0, arg_2.name))\n\n        return sorted(arg_1)", "path": "manticore/native/memory.py", "identifier": "Memory.mappings", "docstring": "Returns a sorted list of all the mappings for this memory.\n\n        :return: a list of mappings.\n        :rtype: list", "docstring_tokens": ["Returns", "a", "sorted", "list", "of", "all", "the", "mappings", "for", "this", "memory", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256195}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1506-L1522", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Rename filename `oldnamep` to `newnamep`.", "language": "python", "parameters": "(self, oldnamep, newnamep)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "current", ".", "read_string", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "current", ".", "read_string", "(", "arg_2", ")", "arg_5", "=", "0", "try", ":", "os", ".", "rename", "(", "arg_3", ",", "arg_4", ")", "except", "OSError", "as", "e", ":", "arg_5", "=", "-", "e", ".", "errno", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Rename filename `oldnamep` to `newnamep`.\n\n        :param int oldnamep: pointer to oldname\n        :param int newnamep: pointer to newname\n        \"\"\"\n        arg_3 = arg_0.current.read_string(arg_1)\n        arg_4 = arg_0.current.read_string(arg_2)\n\n        arg_5 = 0\n        try:\n            os.rename(arg_3, arg_4)\n        except OSError as e:\n            arg_5 = -e.errno\n\n        return arg_5", "path": "manticore/platforms/linux.py", "identifier": "Linux.sys_rename", "docstring": "Rename filename `oldnamep` to `newnamep`.\n\n        :param int oldnamep: pointer to oldname\n        :param int newnamep: pointer to newname", "docstring_tokens": ["Rename", "filename", "oldnamep", "to", "newnamep", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256196}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/protocol.py#L81-L87", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Wait for any or specified event", "language": "python", "parameters": "(self, event=None, timeout=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", ".", "event_future", "is", "not", "None", ":", "raise", "Exception", "(", "\"Can't wait on multiple events!\"", ")", "arg_3", "=", "await", "asyncio", ".", "wait_for", "(", "arg_0", ".", "_wait_loop", "(", "arg_1", ")", ",", "arg_2", ")", "return", "arg_3"], "function": "async def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\" Wait for any or specified event \"\"\"\n        if arg_0.event_future is not None:\n            raise Exception(\"Can't wait on multiple events!\")\n\n        arg_3 = await asyncio.wait_for(arg_0._wait_loop(arg_1), arg_2)\n        return arg_3", "path": "qtm/protocol.py", "identifier": "QTMProtocol.await_event", "docstring": "Wait for any or specified event", "docstring_tokens": ["Wait", "for", "any", "or", "specified", "event"], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 256197}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/util.py#L629-L648", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Make a class appear to reside in `module`, rather than the module in which\n    it is actually defined.", "language": "python", "parameters": "(cls, module)", "return_statement": "return C", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "class", "arg_2", "(", "arg_0", ")", ":", "pass", "arg_2", ".", "__module__", "=", "arg_1", "arg_2", ".", "__name__", "=", "arg_0", ".", "__name__", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Make a class appear to reside in `module`, rather than the module in which\n    it is actually defined.\n\n    >>> from nose.failure import Failure\n    >>> Failure.__module__\n    'nose.failure'\n    >>> Nf = Func(Failure, __name__)\n    >>> Nf.__module__\n    'nose.util'\n    >>> Nf.__name__\n    'Failure'\n\n    \"\"\"\n    class arg_2(arg_0):\n        pass\n    arg_2.__module__ = arg_1\n    arg_2.__name__ = arg_0.__name__\n    return arg_2", "path": "environment/lib/python2.7/site-packages/nose/util.py", "identifier": "transplant_class", "docstring": "Make a class appear to reside in `module`, rather than the module in which\n    it is actually defined.\n\n    >>> from nose.failure import Failure\n    >>> Failure.__module__\n    'nose.failure'\n    >>> Nf = transplant_class(Failure, __name__)\n    >>> Nf.__module__\n    'nose.util'\n    >>> Nf.__name__\n    'Failure'", "docstring_tokens": ["Make", "a", "class", "appear", "to", "reside", "in", "module", "rather", "than", "the", "module", "in", "which", "it", "is", "actually", "defined", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256198}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/RECI.py#L53-L61", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Infer causal relationships between 2 variables using the RECI statistic", "language": "python", "parameters": "(self, a, b, **kwargs)", "return_statement": "return self.b_fit_score(b, a) - self.b_fit_score(a, b)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "b_fit_score", "(", "arg_2", ",", "arg_1", ")", "-", "arg_0", ".", "b_fit_score", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\" Infer causal relationships between 2 variables using the RECI statistic\n\n        :param a: Input variable 1\n        :param b: Input variable 2\n        :return: Causation coefficient (Value : 1 if a->b and -1 if b->a)\n        :rtype: float\n        \"\"\"\n        return arg_0.b_fit_score(arg_2, arg_1) - arg_0.b_fit_score(arg_1, arg_2)", "path": "cdt/causality/pairwise/RECI.py", "identifier": "RECI.predict_proba", "docstring": "Infer causal relationships between 2 variables using the RECI statistic\n\n        :param a: Input variable 1\n        :param b: Input variable 2\n        :return: Causation coefficient (Value : 1 if a->b and -1 if b->a)\n        :rtype: float", "docstring_tokens": ["Infer", "causal", "relationships", "between", "2", "variables", "using", "the", "RECI", "statistic"], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 256199}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L335-L353", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles adding a Node to the graph.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "initialized", ":", "return", "arg_2", "=", "arg_0", ".", "_request_graph", "(", "arg_1", ".", "ui", ".", "control", ")", "if", "arg_2", "is", "None", ":", "return", "arg_3", "=", "[", "v", ".", "ID", "for", "v", "in", "arg_2", ".", "nodes", "]", "arg_4", "=", "Node", "(", "ID", "=", "make_unique_name", "(", "\"node\"", ",", "arg_3", ")", ")", "arg_2", ".", "nodes", ".", "append", "(", "arg_4", ")", "arg_5", "=", "arg_4", ".", "edit_traits", "(", "parent", "=", "arg_1", ".", "ui", ".", "control", ",", "kind", "=", "\"livemodal\"", ")", "if", "not", "arg_5", ".", "result", ":", "arg_2", ".", "nodes", ".", "remove", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handles adding a Node to the graph.\n        \"\"\"\n        if not arg_1.initialized:\n            return\n\n        arg_2 = arg_0._request_graph(arg_1.ui.control)\n\n        if arg_2 is None:\n            return\n\n        arg_3 = [v.ID for v in arg_2.nodes]\n        arg_4 = Node(ID=make_unique_name(\"node\", arg_3))\n        arg_2.nodes.append(arg_4)\n\n        arg_5 = arg_4.edit_traits(parent=arg_1.ui.control, kind=\"livemodal\")\n\n        if not arg_5.result:\n            arg_2.nodes.remove(arg_4)", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel.add_node", "docstring": "Handles adding a Node to the graph.", "docstring_tokens": ["Handles", "adding", "a", "Node", "to", "the", "graph", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 256200}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L293-L337", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Prefilter a single input line as text.", "language": "python", "parameters": "(self, line, continue_prompt=False)", "return_statement": "return prefiltered", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_0", ".", "shell", ".", "_last_input_line", "=", "arg_1", "if", "not", "arg_1", ":", "return", "''", "if", "not", "arg_2", "or", "(", "arg_2", "and", "arg_0", ".", "multi_line_specials", ")", ":", "arg_1", "=", "arg_0", ".", "transform_line", "(", "arg_1", ",", "arg_2", ")", "arg_5", "=", "LineInfo", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "arg_1", ".", "strip", "(", ")", "arg_7", "=", "arg_0", ".", "get_handler_by_name", "(", "'normal'", ")", "if", "not", "arg_6", ":", "if", "not", "arg_2", ":", "arg_0", ".", "shell", ".", "displayhook", ".", "prompt_count", "-=", "1", "return", "arg_7", ".", "handle", "(", "arg_5", ")", "if", "arg_2", "and", "not", "arg_0", ".", "multi_line_specials", ":", "return", "arg_7", ".", "handle", "(", "arg_5", ")", "arg_8", "=", "arg_0", ".", "Func_info", "(", "arg_5", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Prefilter a single input line as text.\n\n        This method prefilters a single line of text by calling the\n        transformers and then the checkers/handlers.\n        \"\"\"\n\n        # print \"Func: \", line, continue_prompt\n        # All handlers *must* return a value, even if it's blank ('').\n\n        # save the line away in case we crash, so the post-mortem handler can\n        # record it\n        arg_0.shell._last_input_line = arg_1\n\n        if not arg_1:\n            # Return immediately on purely empty lines, so that if the user\n            # previously typed some whitespace that started a continuation\n            # prompt, he can break out of that loop with just an empty line.\n            # This is how the default python prompt works.\n            return ''\n\n        # At this point, we invoke our transformers.\n        if not arg_2 or (arg_2 and arg_0.multi_line_specials):\n            arg_1 = arg_0.transform_line(arg_1, arg_2)\n\n        # Now we compute line_info for the checkers and handlers\n        arg_5 = LineInfo(arg_1, arg_2)\n\n        # the input history needs to track even empty lines\n        arg_6 = arg_1.strip()\n\n        arg_7 = arg_0.get_handler_by_name('normal')\n        if not arg_6:\n            if not arg_2:\n                arg_0.shell.displayhook.prompt_count -= 1\n\n            return arg_7.handle(arg_5)\n\n        # special handlers are only allowed for single line statements\n        if arg_2 and not arg_0.multi_line_specials:\n            return arg_7.handle(arg_5)\n\n        arg_8 = arg_0.Func_info(arg_5)\n        # print \"prefiltered line: %r\" % prefiltered\n        return arg_8", "path": "environment/lib/python2.7/site-packages/IPython/core/prefilter.py", "identifier": "PrefilterManager.prefilter_line", "docstring": "Prefilter a single input line as text.\n\n        This method prefilters a single line of text by calling the\n        transformers and then the checkers/handlers.", "docstring_tokens": ["Prefilter", "a", "single", "input", "line", "as", "text", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256201}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2455-L2492", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Define a single season and assign a schedule", "language": "python", "parameters": "(self, season, month, day, schedule)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_1", "+=", "1", "arg_4", "+=", "1", "if", "(", "(", "arg_1", "<", "1", ")", "or", "(", "arg_1", ">", "Extents", ".", "Seasons", ")", "or", "(", "arg_4", "<", "1", ")", "or", "(", "arg_4", ">", "Extents", ".", "Schedules", ")", "or", "(", "arg_2", ">", "12", ")", "or", "(", "arg_2", "<", "0", ")", "or", "(", "arg_3", "<", "0", ")", "or", "(", "arg_3", ">", "31", ")", ")", ":", "ekm_log", "(", "\"Out of bounds: month \"", "+", "str", "(", "arg_2", ")", "+", "\" day \"", "+", "str", "(", "arg_3", ")", "+", "\" schedule \"", "+", "str", "(", "arg_4", ")", "+", "\" season \"", "+", "str", "(", "arg_1", ")", ")", "return", "False", "arg_5", "=", "\"Season_\"", "+", "str", "(", "arg_1", ")", "+", "\"_Start_Day\"", "arg_6", "=", "\"Season_\"", "+", "str", "(", "arg_1", ")", "+", "\"_Start_Month\"", "arg_7", "=", "\"Season_\"", "+", "str", "(", "arg_1", ")", "+", "\"_Schedule\"", "if", "arg_5", "not", "in", "arg_0", ".", "m_seasons_sched_params", ":", "ekm_log", "(", "\"Incorrect index: \"", "+", "arg_5", ")", "return", "False", "if", "arg_6", "not", "in", "arg_0", ".", "m_seasons_sched_params", ":", "ekm_log", "(", "\"Incorrect index: \"", "+", "arg_6", ")", "return", "False", "if", "arg_7", "not", "in", "arg_0", ".", "m_seasons_sched_params", ":", "ekm_log", "(", "\"Incorrect index: \"", "+", "arg_7", ")", "return", "False", "arg_0", ".", "m_seasons_sched_params", "[", "arg_5", "]", "=", "arg_2", "arg_0", ".", "m_seasons_sched_params", "[", "arg_6", "]", "=", "arg_3", "arg_0", ".", "m_seasons_sched_params", "[", "arg_7", "]", "=", "arg_4", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\" Define a single season and assign a schedule\n\n        Args:\n            season (int): A :class:`~ekmmeters.Seasons` value or in range(Extent.Seasons).\n            month (int): Month 1-12.\n            day (int):  Day 1-31.\n            schedule (int): A :class:`~ekmmeters.LCDItems` value or in range(Extent.Schedules).\n\n        Returns:\n            bool: True on completion and ACK.\n        \"\"\"\n        arg_1 += 1\n        arg_4 += 1\n        if ((arg_1 < 1) or (arg_1 > Extents.Seasons) or (arg_4 < 1) or\n                (arg_4 > Extents.Schedules) or (arg_2 > 12) or (arg_2 < 0) or\n                (arg_3 < 0) or (arg_3 > 31)):\n            ekm_log(\"Out of bounds: month \" + str(arg_2) + \" day \" + str(arg_3) +\n                    \" schedule \" + str(arg_4) + \" season \" + str(arg_1))\n            return False\n\n        arg_5 = \"Season_\" + str(arg_1) + \"_Start_Day\"\n        arg_6 = \"Season_\" + str(arg_1) + \"_Start_Month\"\n        arg_7 = \"Season_\" + str(arg_1) + \"_Schedule\"\n        if arg_5 not in arg_0.m_seasons_sched_params:\n            ekm_log(\"Incorrect index: \" + arg_5)\n            return False\n        if arg_6 not in arg_0.m_seasons_sched_params:\n            ekm_log(\"Incorrect index: \" + arg_6)\n            return False\n        if arg_7 not in arg_0.m_seasons_sched_params:\n            ekm_log(\"Incorrect index: \" + arg_7)\n            return False\n\n        arg_0.m_seasons_sched_params[arg_5] = arg_2\n        arg_0.m_seasons_sched_params[arg_6] = arg_3\n        arg_0.m_seasons_sched_params[arg_7] = arg_4\n        return True", "path": "ekmmeters.py", "identifier": "Meter.assignSeasonSchedule", "docstring": "Define a single season and assign a schedule\n\n        Args:\n            season (int): A :class:`~ekmmeters.Seasons` value or in range(Extent.Seasons).\n            month (int): Month 1-12.\n            day (int):  Day 1-31.\n            schedule (int): A :class:`~ekmmeters.LCDItems` value or in range(Extent.Schedules).\n\n        Returns:\n            bool: True on completion and ACK.", "docstring_tokens": ["Define", "a", "single", "season", "and", "assign", "a", "schedule"], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 256202}
{"url": "https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L114-L122", "sha": "7be8b956e53c70b35f34e1783a8fe8f716955afb", "docstring_summary": "Subtract the arg from the value.", "language": "python", "parameters": "(value, arg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "valid_numeric", "(", "arg_0", ")", "-", "valid_numeric", "(", "arg_1", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "try", ":", "return", "arg_0", "-", "arg_1", "except", "Exception", ":", "return", "''"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Subtract the arg from the value.\"\"\"\n    try:\n        return valid_numeric(arg_0) - valid_numeric(arg_1)\n    except (ValueError, TypeError):\n        try:\n            return arg_0 - arg_1\n        except Exception:\n            return ''", "path": "django_baseline/templatetags/helpers.py", "identifier": "sub", "docstring": "Subtract the arg from the value.", "docstring_tokens": ["Subtract", "the", "arg", "from", "the", "value", "."], "nwo": "theduke/django-baseline", "score": 0.0, "idx": 256203}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/pgmanager.py#L197-L211", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Build a notebook model from database record.", "language": "python", "parameters": "(self, record, content)", "return_statement": "return model", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "to_api_path", "(", "arg_1", "[", "'parent_name'", "]", "+", "arg_1", "[", "'name'", "]", ")", "arg_4", "=", "base_model", "(", "arg_3", ")", "arg_4", "[", "'type'", "]", "=", "'notebook'", "arg_4", "[", "'last_modified'", "]", "=", "arg_4", "[", "'created'", "]", "=", "arg_1", "[", "'created_at'", "]", "if", "arg_2", ":", "arg_2", "=", "reads_base64", "(", "arg_1", "[", "'content'", "]", ")", "arg_0", ".", "mark_trusted_cells", "(", "arg_2", ",", "arg_3", ")", "arg_4", "[", "'content'", "]", "=", "arg_2", "arg_4", "[", "'format'", "]", "=", "'json'", "arg_0", ".", "validate_notebook_model", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Build a notebook model from database record.\n        \"\"\"\n        arg_3 = to_api_path(arg_1['parent_name'] + arg_1['name'])\n        arg_4 = base_model(arg_3)\n        arg_4['type'] = 'notebook'\n        arg_4['last_modified'] = arg_4['created'] = arg_1['created_at']\n        if arg_2:\n            arg_2 = reads_base64(arg_1['content'])\n            arg_0.mark_trusted_cells(arg_2, arg_3)\n            arg_4['content'] = arg_2\n            arg_4['format'] = 'json'\n            arg_0.validate_notebook_model(arg_4)\n        return arg_4", "path": "pgcontents/pgmanager.py", "identifier": "PostgresContentsManager._notebook_model_from_db", "docstring": "Build a notebook model from database record.", "docstring_tokens": ["Build", "a", "notebook", "model", "from", "database", "record", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 256204}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/serialization.py#L47-L55", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "serialize the dataframe with different delimiters", "language": "python", "parameters": "(writer, dataframe, delimiter, with_header)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "codecs", ".", "getwriter", "(", "'utf-8'", ")", "(", "arg_0", ")", "arg_1", ".", "to_csv", "(", "path_or_buf", "=", "arg_4", ",", "sep", "=", "arg_2", ",", "header", "=", "arg_3", ",", "index", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"serialize the dataframe with different delimiters\"\"\"\n    arg_4 = codecs.getwriter('utf-8')(arg_0)\n    arg_1.to_csv(\n        path_or_buf=arg_4,\n        sep=arg_2,\n        header=arg_3,\n        index=False\n    )", "path": "azureml/serialization.py", "identifier": "_dataframe_to_csv", "docstring": "serialize the dataframe with different delimiters", "docstring_tokens": ["serialize", "the", "dataframe", "with", "different", "delimiters"], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 256205}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L345-L385", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Run stochastic volatility model.", "language": "python", "parameters": "(data, samples=2000, progressbar=True)", "return_statement": "return model, trace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2000", ",", "arg_2", "=", "True", ")", ":", "from", "pymc3", ".", "distributions", ".", "timeseries", "import", "GaussianRandomWalk", "with", "pm", ".", "Model", "(", ")", "as", "model", ":", "arg_3", "=", "pm", ".", "Exponential", "(", "'nu'", ",", "1.", "/", "10", ",", "testval", "=", "5.", ")", "arg_4", "=", "pm", ".", "Exponential", "(", "'sigma'", ",", "1.", "/", ".02", ",", "testval", "=", ".1", ")", "arg_5", "=", "GaussianRandomWalk", "(", "'s'", ",", "arg_4", "**", "-", "2", ",", "shape", "=", "len", "(", "arg_0", ")", ")", "arg_6", "=", "pm", ".", "Deterministic", "(", "'volatility_process'", ",", "pm", ".", "math", ".", "exp", "(", "-", "2", "*", "arg_5", ")", ")", "pm", ".", "StudentT", "(", "'r'", ",", "arg_3", ",", "lam", "=", "arg_6", ",", "observed", "=", "arg_0", ")", "arg_7", "=", "pm", ".", "sample", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "model", ",", "arg_7"], "function": "def Func(arg_0, arg_1=2000, arg_2=True):\n    \"\"\"\n    Run stochastic volatility model.\n\n    This model estimates the volatility of a returns series over time.\n    Returns are assumed to be T-distributed. lambda (width of\n    T-distributed) is assumed to follow a random-walk.\n\n    Parameters\n    ----------\n    data : pandas.Series\n        Return series to model.\n    samples : int, optional\n        Posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n\n    See Also\n    --------\n    plot_stoch_vol : plotting of tochastic volatility model\n    \"\"\"\n\n    from pymc3.distributions.timeseries import GaussianRandomWalk\n\n    with pm.Model() as model:\n        arg_3 = pm.Exponential('nu', 1. / 10, testval=5.)\n        arg_4 = pm.Exponential('sigma', 1. / .02, testval=.1)\n        arg_5 = GaussianRandomWalk('s', arg_4**-2, shape=len(arg_0))\n        arg_6 = pm.Deterministic('volatility_process',\n                                              pm.math.exp(-2 * arg_5))\n        pm.StudentT('r', arg_3, lam=arg_6, observed=arg_0)\n\n        arg_7 = pm.sample(arg_1, arg_2=arg_2)\n\n    return model, arg_7", "path": "pyfolio/bayesian.py", "identifier": "model_stoch_vol", "docstring": "Run stochastic volatility model.\n\n    This model estimates the volatility of a returns series over time.\n    Returns are assumed to be T-distributed. lambda (width of\n    T-distributed) is assumed to follow a random-walk.\n\n    Parameters\n    ----------\n    data : pandas.Series\n        Return series to model.\n    samples : int, optional\n        Posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n\n    See Also\n    --------\n    plot_stoch_vol : plotting of tochastic volatility model", "docstring_tokens": ["Run", "stochastic", "volatility", "model", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 256206}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/meta.py#L348-L363", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Compute the lookup key for an instance, i.e. a foreign key that\n        can be used to identify an instance at the end of the link.", "language": "python", "parameters": "(self, from_instance)", "return_statement": "return frozenset(tuple(kwargs.items()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "key_map", ".", "items", "(", ")", ":", "if", "_is_null", "(", "arg_1", ",", "arg_3", ")", ":", "return", "None", "if", "arg_3", "in", "arg_1", ".", "__dict__", ":", "arg_2", "[", "arg_4", "]", "=", "arg_1", ".", "__dict__", "[", "arg_3", "]", "else", ":", "arg_2", "[", "arg_4", "]", "=", "getattr", "(", "arg_1", ",", "arg_3", ")", "return", "frozenset", "(", "tuple", "(", "arg_2", ".", "items", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Compute the lookup key for an instance, i.e. a foreign key that\n        can be used to identify an instance at the end of the link.\n        '''\n        arg_2 = dict()\n        for arg_3, arg_4 in arg_0.key_map.items():\n            if _is_null(arg_1, arg_3):\n                return None\n            \n            if arg_3 in arg_1.__dict__:\n                arg_2[arg_4] = arg_1.__dict__[arg_3]\n            else:\n                arg_2[arg_4] = getattr(arg_1, arg_3)\n\n        return frozenset(tuple(arg_2.items()))", "path": "xtuml/meta.py", "identifier": "Link.compute_lookup_key", "docstring": "Compute the lookup key for an instance, i.e. a foreign key that\n        can be used to identify an instance at the end of the link.", "docstring_tokens": ["Compute", "the", "lookup", "key", "for", "an", "instance", "i", ".", "e", ".", "a", "foreign", "key", "that", "can", "be", "used", "to", "identify", "an", "instance", "at", "the", "end", "of", "the", "link", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 256207}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L189-L223", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Load activation data from a text file.", "language": "python", "parameters": "(self, filename)", "return_statement": "return activations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "info", "(", "\"Loading activation data from %s...\"", "%", "arg_1", ")", "arg_2", "=", "pd", ".", "read_csv", "(", "arg_1", ",", "sep", "=", "'\\t'", ")", "arg_2", ".", "columns", "=", "[", "col", ".", "lower", "(", ")", "for", "col", "in", "list", "(", "arg_2", ".", "columns", ")", "]", "arg_4", "=", "[", "'x'", ",", "'y'", ",", "'z'", ",", "'id'", ",", "'space'", "]", "if", "(", "set", "(", "arg_4", ")", "-", "set", "(", "list", "(", "arg_2", ".", "columns", ")", ")", ")", ":", "logger", ".", "error", "(", "\"At least one of mandatory columns (x, y, z, id, and space) \"", "\"is missing from input file.\"", ")", "return", "arg_5", "=", "arg_2", "[", "'space'", "]", ".", "unique", "(", ")", "arg_6", "=", "arg_2", "[", "[", "'x'", ",", "'y'", ",", "'z'", "]", "]", ".", "values", "for", "arg_7", "in", "arg_5", ":", "if", "arg_7", "!=", "arg_0", ".", "transformer", ".", "target", ":", "arg_8", "=", "arg_2", "[", "'space'", "]", "==", "arg_7", "arg_6", "[", "arg_8", "]", "=", "arg_0", ".", "transformer", ".", "apply", "(", "arg_7", ",", "arg_6", "[", "arg_8", "]", ")", "arg_2", "[", "[", "'x'", ",", "'y'", ",", "'z'", "]", "]", "=", "arg_6", "arg_9", "=", "pd", ".", "DataFrame", "(", "transformations", ".", "xyz_to_mat", "(", "arg_6", ")", ",", "arg_3", "=", "[", "'i'", ",", "'j'", ",", "'k'", "]", ")", "arg_2", "=", "pd", ".", "concat", "(", "[", "arg_2", ",", "arg_9", "]", ",", "axis", "=", "1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Load activation data from a text file.\n\n        Args:\n            filename (str): a string pointing to the location of the txt file\n                to read from.\n        \"\"\"\n        logger.info(\"Loading activation data from %s...\" % arg_1)\n\n        arg_2 = pd.read_csv(arg_1, sep='\\t')\n        arg_2.columns = [col.lower()\n                               for col in list(arg_2.columns)]\n\n        # Make sure all mandatory columns exist\n        arg_4 = ['x', 'y', 'z', 'id', 'space']\n        if (set(arg_4) - set(list(arg_2.columns))):\n            logger.error(\n                \"At least one of mandatory columns (x, y, z, id, and space) \"\n                \"is missing from input file.\")\n            return\n\n        # Transform to target space where needed\n        arg_5 = arg_2['space'].unique()\n        arg_6 = arg_2[['x', 'y', 'z']].values\n        for arg_7 in arg_5:\n            if arg_7 != arg_0.transformer.target:\n                arg_8 = arg_2['space'] == arg_7\n                arg_6[arg_8] = arg_0.transformer.apply(arg_7, arg_6[arg_8])\n        arg_2[['x', 'y', 'z']] = arg_6\n\n        # xyz --> ijk\n        arg_9 = pd.DataFrame(\n            transformations.xyz_to_mat(arg_6), arg_3=['i', 'j', 'k'])\n        arg_2 = pd.concat([arg_2, arg_9], axis=1)\n        return arg_2", "path": "neurosynth/base/dataset.py", "identifier": "Dataset._load_activations", "docstring": "Load activation data from a text file.\n\n        Args:\n            filename (str): a string pointing to the location of the txt file\n                to read from.", "docstring_tokens": ["Load", "activation", "data", "from", "a", "text", "file", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 256208}
{"url": "https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/restclient.py#L39-L58", "sha": "9bb98ca9d24f2e4db651cf0590e4b47184546482", "docstring_summary": "Make HTTP request and return response object", "language": "python", "parameters": "(self, method, url, **kwargs)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_session", ".", "request", "(", "arg_1", ",", "'{}/{}'", ".", "format", "(", "arg_0", ".", "_base_url", ",", "arg_2", ")", ",", "headers", "=", "arg_0", ".", "_headers", ",", "**", "arg_3", ")", "try", ":", "arg_4", ".", "raise_for_status", "(", ")", "except", "HTTPError", "as", "e", ":", "logging", ".", "error", "(", "arg_4", ".", "content", ")", "raise", "RestClientError", "(", "e", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Make HTTP request and return response object\n\n            Args:\n                method (str): GET, POST, PUT, DELETE\n                url (str): path appended to the base_url to create request\n                **kwargs: passed directly to a requests.request object\n        \"\"\"\n        arg_4 = arg_0._session.request(arg_1,\n                                     '{}/{}'.format(arg_0._base_url, arg_2),\n                                     headers=arg_0._headers,\n                                     **arg_3)\n\n        try:\n            arg_4.raise_for_status()\n        except HTTPError as e:\n            logging.error(arg_4.content)\n            raise RestClientError(e)\n\n        return arg_4", "path": "tiingo/restclient.py", "identifier": "RestClient._request", "docstring": "Make HTTP request and return response object\n\n            Args:\n                method (str): GET, POST, PUT, DELETE\n                url (str): path appended to the base_url to create request\n                **kwargs: passed directly to a requests.request object", "docstring_tokens": ["Make", "HTTP", "request", "and", "return", "response", "object"], "nwo": "hydrosquall/tiingo-python", "score": 0.7387968412755984, "idx": 256209}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_container_hook.py#L111-L129", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Append labels to provided Cluster Protobuf", "language": "python", "parameters": "(cluster_proto, key, val)", "return_statement": "return cluster_proto", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "'.'", ",", "'-'", ")", ".", "replace", "(", "'+'", ",", "'-'", ")", "arg_0", ".", "resource_labels", ".", "update", "(", "{", "arg_1", ":", "arg_2", "}", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Append labels to provided Cluster Protobuf\n\n        Labels must fit the regex ``[a-z]([-a-z0-9]*[a-z0-9])?`` (current\n         airflow version string follows semantic versioning spec: x.y.z).\n\n        :param cluster_proto: The proto to append resource_label airflow\n            version to\n        :type cluster_proto: google.cloud.container_v1.types.Cluster\n        :param key: The key label\n        :type key: str\n        :param val:\n        :type val: str\n        :return: The cluster proto updated with new label\n        \"\"\"\n        arg_2 = arg_2.replace('.', '-').replace('+', '-')\n        arg_0.resource_labels.update({arg_1: arg_2})\n        return arg_0", "path": "airflow/contrib/hooks/gcp_container_hook.py", "identifier": "GKEClusterHook._append_label", "docstring": "Append labels to provided Cluster Protobuf\n\n        Labels must fit the regex ``[a-z]([-a-z0-9]*[a-z0-9])?`` (current\n         airflow version string follows semantic versioning spec: x.y.z).\n\n        :param cluster_proto: The proto to append resource_label airflow\n            version to\n        :type cluster_proto: google.cloud.container_v1.types.Cluster\n        :param key: The key label\n        :type key: str\n        :param val:\n        :type val: str\n        :return: The cluster proto updated with new label", "docstring_tokens": ["Append", "labels", "to", "provided", "Cluster", "Protobuf"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256210}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py#L207-L223", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Draw the given figure and send it as a PNG payload.", "language": "python", "parameters": "(fig)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "InlineBackend", ".", "instance", "(", ")", ".", "figure_format", "arg_2", "=", "print_figure", "(", "arg_0", ",", "arg_1", ")", "if", "arg_2", "is", "None", ":", "return", "arg_3", "=", "{", "'png'", ":", "'image/png'", ",", "'svg'", ":", "'image/svg+xml'", "}", "arg_4", "=", "arg_3", "[", "arg_1", "]", "sys", ".", "stdout", ".", "flush", "(", ")", "sys", ".", "stderr", ".", "flush", "(", ")", "publish_display_data", "(", "'IPython.zmq.pylab.backend_inline.Func'", ",", "{", "arg_4", ":", "arg_2", "}", ")"], "function": "def Func(arg_0):\n    \"\"\"Draw the given figure and send it as a PNG payload.\n    \"\"\"\n    arg_1 = InlineBackend.instance().figure_format\n    arg_2 = print_figure(arg_0, arg_1)\n    # print_figure will return None if there's nothing to draw:\n    if arg_2 is None:\n        return\n    arg_3 = { 'png' : 'image/png', 'svg' : 'image/svg+xml' }\n    arg_4 = arg_3[arg_1]\n    # flush text streams before sending figures, helps a little with output\n    # synchronization in the console (though it's a bandaid, not a real sln)\n    sys.stdout.flush(); sys.stderr.flush()\n    publish_display_data(\n        'IPython.zmq.pylab.backend_inline.Func',\n        {arg_4 : arg_2}\n    )", "path": "environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py", "identifier": "send_figure", "docstring": "Draw the given figure and send it as a PNG payload.", "docstring_tokens": ["Draw", "the", "given", "figure", "and", "send", "it", "as", "a", "PNG", "payload", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256211}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/plugin/dot_adapter.py#L60-L71", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Save to file.", "language": "python", "parameters": "(self, obj)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "try", ":", "arg_2", "=", "open", "(", "arg_0", ".", "dot_file", ".", "absolute_path", ",", "\"wb\"", ")", "arg_1", ".", "Func_dot", "(", "arg_2", ")", "finally", ":", "if", "arg_2", "is", "not", "None", ":", "arg_2", ".", "close", "(", ")", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Save to file.\n        \"\"\"\n        arg_2 = None\n        try:\n            arg_2 = open(arg_0.dot_file.absolute_path, \"wb\")\n            arg_1.Func_dot(arg_2)\n        finally:\n            if arg_2 is not None:\n                arg_2.close()\n#        self.m_time = getmtime(self.adaptee.absolute_path)\n        return", "path": "godot/plugin/dot_adapter.py", "identifier": "DotFileIResourceAdapter.save", "docstring": "Save to file.", "docstring_tokens": ["Save", "to", "file", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 256212}
{"url": "https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L63-L74", "sha": "1a23a5b37a973a1dc69ad4c69e81edea5d096ac9", "docstring_summary": "Create the column dividers for a table with given column widths.", "language": "python", "parameters": "(col_widths, horiz, vert, padding)", "return_statement": "return div.join(horizs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "arg_1", "*", "w", "for", "w", "in", "arg_0", "]", "arg_5", "=", "''", ".", "join", "(", "[", "arg_3", "*", "arg_1", ",", "arg_2", ",", "arg_3", "*", "arg_1", "]", ")", "return", "arg_5", ".", "join", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Create the column dividers for a table with given column widths.\n\n    col_widths: list of column widths\n    horiz: the character to use for a horizontal divider\n    vert: the character to use for a vertical divider\n    padding: amount of padding to add to each side of a column\n    \"\"\"\n    arg_4 = [arg_1 * w for w in arg_0]\n    arg_5 = ''.join([arg_3 * arg_1, arg_2, arg_3 * arg_1])\n    return arg_5.join(arg_4)", "path": "csvtomd/csvtomd.py", "identifier": "horiz_div", "docstring": "Create the column dividers for a table with given column widths.\n\n    col_widths: list of column widths\n    horiz: the character to use for a horizontal divider\n    vert: the character to use for a vertical divider\n    padding: amount of padding to add to each side of a column", "docstring_tokens": ["Create", "the", "column", "dividers", "for", "a", "table", "with", "given", "column", "widths", "."], "nwo": "mplewis/csvtomd", "score": 0.7560419399185694, "idx": 256213}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L58-L82", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Merges all trajectories found in the working directory", "language": "python", "parameters": "(session)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "saga", ".", "job", ".", "Description", "(", ")", "arg_1", ".", "executable", "=", "'python'", "arg_1", ".", "arguments", "=", "[", "'merge_trajs.py'", "]", "arg_1", ".", "output", "=", "\"mysagajob_merge.stdout\"", "arg_1", ".", "error", "=", "\"mysagajob_merge.stderr\"", "arg_1", ".", "working_directory", "=", "WORKING_DIR", "arg_7", "=", "saga", ".", "job", ".", "Service", "(", "'ssh://'", "+", "ADDRESS", ",", "arg_0", "=", "arg_0", ")", "arg_8", "=", "arg_7", ".", "create_job", "(", "arg_1", ")", "print", "(", "\"\\n...starting job...\\n\"", ")", "arg_8", ".", "run", "(", ")", "print", "(", "\"Job ID    : %s\"", "%", "(", "arg_8", ".", "id", ")", ")", "print", "(", "\"Job State : %s\"", "%", "(", "arg_8", ".", "state", ")", ")", "print", "(", "\"\\n...waiting for job...\\n\"", ")", "arg_8", ".", "wait", "(", ")", "print", "(", "\"Job State : %s\"", "%", "(", "arg_8", ".", "state", ")", ")", "print", "(", "\"Exitcode  : %s\"", "%", "(", "arg_8", ".", "exit_code", ")", ")"], "function": "def Func(arg_0):\n    \"\"\" Merges all trajectories found in the working directory \"\"\"\n    arg_1 = saga.job.Description()\n\n    arg_1.executable      = 'python'\n    arg_1.arguments       = ['merge_trajs.py']\n    arg_1.output          = \"mysagajob_merge.stdout\"\n    arg_1.error           = \"mysagajob_merge.stderr\"\n    arg_1.working_directory = WORKING_DIR\n\n    arg_7 = saga.job.Service('ssh://' + ADDRESS, arg_0=arg_0)\n    arg_8 = arg_7.create_job(arg_1)\n    print(\"\\n...starting job...\\n\")\n\n    # Now we can start our job.\n    arg_8.run()\n    print(\"Job ID    : %s\" % (arg_8.id))\n    print(\"Job State : %s\" % (arg_8.state))\n\n    print(\"\\n...waiting for job...\\n\")\n    # wait for the job to either finish or fail\n    arg_8.wait()\n\n    print(\"Job State : %s\" % (arg_8.state))\n    print(\"Exitcode  : %s\" % (arg_8.exit_code))", "path": "examples/example_22_saga_python/start_saga.py", "identifier": "merge_trajectories", "docstring": "Merges all trajectories found in the working directory", "docstring_tokens": ["Merges", "all", "trajectories", "found", "in", "the", "working", "directory"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256214}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L117-L136", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Perform a catalog search over an address string", "language": "python", "parameters": "(self, address, filters=None, startDate=None, endDate=None, types=None)", "return_statement": "return self.search_point(lat,lng, filters=filters, startDate=startDate, endDate=endDate, types=types)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", ",", "arg_7", "=", "arg_0", ".", "get_address_coords", "(", "arg_1", ")", "return", "arg_0", ".", "search_point", "(", "arg_6", ",", "arg_7", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None):\n        ''' Perform a catalog search over an address string\n\n        Args:\n            address: any address string\n            filters: Array of filters.  Optional.  Example:\n            [\n                \"(sensorPlatformName = 'WORLDVIEW01' OR sensorPlatformName ='QUICKBIRD02')\",\n                \"cloudCover < 10\",\n                \"offNadirAngle < 10\"\n            ]\n            startDate: string.  Optional.  Example: \"2004-01-01T00:00:00.000Z\"\n            endDate: string.  Optional.  Example: \"2004-01-01T00:00:00.000Z\"\n            types: Array of types to search for.  Optional.  Example (and default):  [\"Acquisition\"]\n\n        Returns:\n            catalog search resultset\n        '''\n        arg_6, arg_7 = arg_0.get_address_coords(arg_1)\n        return arg_0.search_point(arg_6,arg_7, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)", "path": "gbdxtools/catalog.py", "identifier": "Catalog.search_address", "docstring": "Perform a catalog search over an address string\n\n        Args:\n            address: any address string\n            filters: Array of filters.  Optional.  Example:\n            [\n                \"(sensorPlatformName = 'WORLDVIEW01' OR sensorPlatformName ='QUICKBIRD02')\",\n                \"cloudCover < 10\",\n                \"offNadirAngle < 10\"\n            ]\n            startDate: string.  Optional.  Example: \"2004-01-01T00:00:00.000Z\"\n            endDate: string.  Optional.  Example: \"2004-01-01T00:00:00.000Z\"\n            types: Array of types to search for.  Optional.  Example (and default):  [\"Acquisition\"]\n\n        Returns:\n            catalog search resultset", "docstring_tokens": ["Perform", "a", "catalog", "search", "over", "an", "address", "string"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 256215}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/mapping/noise_adaptive_layout.py#L155-L166", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "If there is an edge with one endpoint mapped, return it.\n        Else return in the first edge", "language": "python", "parameters": "(self)", "return_statement": "return self.pending_program_edges[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "pending_program_edges", ":", "arg_2", "=", "arg_1", "[", "0", "]", "in", "arg_0", ".", "prog2hw", "arg_3", "=", "arg_1", "[", "1", "]", "in", "arg_0", ".", "prog2hw", "assert", "not", "(", "arg_2", "and", "arg_3", ")", "if", "arg_2", "or", "arg_3", ":", "return", "arg_1", "return", "arg_0", ".", "pending_program_edges", "[", "0", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        If there is an edge with one endpoint mapped, return it.\n        Else return in the first edge\n        \"\"\"\n        for arg_1 in arg_0.pending_program_edges:\n            arg_2 = arg_1[0] in arg_0.prog2hw\n            arg_3 = arg_1[1] in arg_0.prog2hw\n            assert not (arg_2 and arg_3)\n            if arg_2 or arg_3:\n                return arg_1\n        return arg_0.pending_program_edges[0]", "path": "qiskit/transpiler/passes/mapping/noise_adaptive_layout.py", "identifier": "NoiseAdaptiveLayout._select_next_edge", "docstring": "If there is an edge with one endpoint mapped, return it.\n        Else return in the first edge", "docstring_tokens": ["If", "there", "is", "an", "edge", "with", "one", "endpoint", "mapped", "return", "it", ".", "Else", "return", "in", "the", "first", "edge"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256216}
{"url": "https://github.com/ros-infrastructure/ros_buildfarm/blob/c63ad85b21470f3262086fcd987528a0efc0cf6d/ros_buildfarm/common.py#L434-L466", "sha": "c63ad85b21470f3262086fcd987528a0efc0cf6d", "docstring_summary": "Write out the groovy script and configs to file.", "language": "python", "parameters": "(\n        filename, content, job_configs, view_configs=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "with", "open", "(", "arg_0", ",", "'w'", ")", "as", "h", ":", "h", ".", "write", "(", "arg_1", ")", "if", "arg_3", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", ",", "'view_configs'", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_4", ")", ":", "os", ".", "makedirs", "(", "arg_4", ")", "for", "arg_5", ",", "arg_6", "in", "arg_3", ".", "items", "(", ")", ":", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_5", ")", "with", "open", "(", "arg_7", ",", "'w'", ")", "as", "config_fh", ":", "config_fh", ".", "write", "(", "arg_6", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", ",", "'job_configs'", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_8", ")", ":", "os", ".", "makedirs", "(", "arg_8", ")", "arg_9", "=", "'%0'", "+", "str", "(", "len", "(", "str", "(", "len", "(", "arg_2", ")", ")", ")", ")", "+", "'d'", "arg_10", "=", "0", "for", "arg_5", ",", "arg_6", "in", "arg_2", ".", "items", "(", ")", ":", "arg_10", "+=", "1", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "arg_9", "%", "arg_10", "+", "' '", "+", "arg_5", ")", "with", "open", "(", "arg_7", ",", "'w'", ")", "as", "config_fh", ":", "config_fh", ".", "write", "(", "arg_6", ")"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"Write out the groovy script and configs to file.\n\n    This writes the reconfigure script to the file location\n    and places the expanded configs in subdirectories 'view_configs' /\n    'job_configs' that the script can then access when run.\n    \"\"\"\n    with open(arg_0, 'w') as h:\n        h.write(arg_1)\n\n    if arg_3:\n        arg_4 = os.path.join(os.path.dirname(arg_0), 'view_configs')\n        if not os.path.isdir(arg_4):\n            os.makedirs(arg_4)\n        for arg_5, arg_6 in arg_3.items():\n            arg_7 = os.path.join(arg_4, arg_5)\n            with open(arg_7, 'w') as config_fh:\n                config_fh.write(arg_6)\n\n    arg_8 = os.path.join(os.path.dirname(arg_0), 'job_configs')\n    if not os.path.isdir(arg_8):\n        os.makedirs(arg_8)\n    # prefix each config file with a serial number to maintain order\n    arg_9 = '%0' + str(len(str(len(arg_2)))) + 'd'\n    arg_10 = 0\n    for arg_5, arg_6 in arg_2.items():\n        arg_10 += 1\n        arg_7 = os.path.join(\n            arg_8,\n            arg_9 % arg_10 + ' ' + arg_5)\n        with open(arg_7, 'w') as config_fh:\n            config_fh.write(arg_6)", "path": "ros_buildfarm/common.py", "identifier": "write_groovy_script_and_configs", "docstring": "Write out the groovy script and configs to file.\n\n    This writes the reconfigure script to the file location\n    and places the expanded configs in subdirectories 'view_configs' /\n    'job_configs' that the script can then access when run.", "docstring_tokens": ["Write", "out", "the", "groovy", "script", "and", "configs", "to", "file", "."], "nwo": "ros-infrastructure/ros_buildfarm", "score": 0.5592967619494252, "idx": 256217}
{"url": "https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/parser.py#L157-L169", "sha": "51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126", "docstring_summary": "Post parse cycle. nodejs version allows calls to mixins\n        not yet defined or known to the parser. We defer all calls\n        to mixins until after first cycle when all names are known.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "result", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "result", ":", "try", ":", "arg_1", ".", "append", "(", "arg_2", ".", "parse", "(", "arg_0", ".", "scope", ")", ")", "except", "SyntaxError", "as", "e", ":", "arg_0", ".", "handle_error", "(", "e", ",", "0", ")", "arg_0", ".", "result", "=", "list", "(", "utility", ".", "flatten", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Post parse cycle. nodejs version allows calls to mixins\n        not yet defined or known to the parser. We defer all calls\n        to mixins until after first cycle when all names are known.\n        \"\"\"\n        if arg_0.result:\n            arg_1 = []\n            for arg_2 in arg_0.result:\n                try:\n                    arg_1.append(arg_2.parse(arg_0.scope))\n                except SyntaxError as e:\n                    arg_0.handle_error(e, 0)\n            arg_0.result = list(utility.flatten(arg_1))", "path": "lesscpy/lessc/parser.py", "identifier": "LessParser.post_parse", "docstring": "Post parse cycle. nodejs version allows calls to mixins\n        not yet defined or known to the parser. We defer all calls\n        to mixins until after first cycle when all names are known.", "docstring_tokens": ["Post", "parse", "cycle", ".", "nodejs", "version", "allows", "calls", "to", "mixins", "not", "yet", "defined", "or", "known", "to", "the", "parser", ".", "We", "defer", "all", "calls", "to", "mixins", "until", "after", "first", "cycle", "when", "all", "names", "are", "known", "."], "nwo": "lesscpy/lesscpy", "score": 0.36630042150969844, "idx": 256218}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/response_handling.py#L4-L27", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Takes an initial response, and a way to repeat the request that produced it and retries the request with an increasing sleep period between requests if rate limiting resposne codes are encountered.", "language": "python", "parameters": "(response, response_lambda, timeout=1, attempts=0)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "0", ")", ":", "if", "arg_3", ">=", "3", ":", "raise", "RateLimitingException", "(", ")", "if", "arg_0", ".", "status_code", "==", "429", ":", "sleep", "(", "arg_2", ")", "arg_4", "=", "arg_2", "+", "1", "arg_5", "=", "arg_3", "+", "1", "return", "Func", "(", "arg_1", "(", "arg_2", ",", "arg_3", ")", ",", "arg_1", ",", "arg_2", "=", "arg_4", ",", "arg_3", "=", "arg_5", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=0):\n    \"\"\"\n    Takes an initial response, and a way to repeat the request that produced it and retries the request with an increasing sleep period between requests if rate limiting resposne codes are encountered.\n\n    If more than 3 attempts are made, a RateLimitingException is raised\n\n    :param response: A response from Citrination\n    :type response: requests.Response\n    :param response_lambda: a callable that runs the request that returned the\n        response\n    :type response_lambda: function\n    :param timeout: the time to wait before retrying\n    :type timeout: int\n    :param attempts: the number of the retry being executed\n    :type attempts: int\n    \"\"\"\n    if arg_3 >= 3:\n        raise RateLimitingException()\n    if arg_0.status_code == 429:\n        sleep(arg_2)\n        arg_4 = arg_2 + 1\n        arg_5 = arg_3 + 1\n        return Func(arg_1(arg_2, arg_3), arg_1, arg_2=arg_4, arg_3=arg_5)\n    return arg_0", "path": "citrination_client/base/response_handling.py", "identifier": "check_for_rate_limiting", "docstring": "Takes an initial response, and a way to repeat the request that produced it and retries the request with an increasing sleep period between requests if rate limiting resposne codes are encountered.\n\n    If more than 3 attempts are made, a RateLimitingException is raised\n\n    :param response: A response from Citrination\n    :type response: requests.Response\n    :param response_lambda: a callable that runs the request that returned the\n        response\n    :type response_lambda: function\n    :param timeout: the time to wait before retrying\n    :type timeout: int\n    :param attempts: the number of the retry being executed\n    :type attempts: int", "docstring_tokens": ["Takes", "an", "initial", "response", "and", "a", "way", "to", "repeat", "the", "request", "that", "produced", "it", "and", "retries", "the", "request", "with", "an", "increasing", "sleep", "period", "between", "requests", "if", "rate", "limiting", "resposne", "codes", "are", "encountered", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 256219}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/docs/mistune.py#L854-L863", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Rendering a given link or email address.", "language": "python", "parameters": "(self, link, is_email=False)", "return_statement": "return '<a href=\"%s\">%s</a>' % (link, text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_1", "=", "escape", "(", "arg_1", ")", "if", "arg_2", ":", "arg_1", "=", "'mailto:%s'", "%", "arg_1", "return", "'<a href=\"%s\">%s</a>'", "%", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Rendering a given link or email address.\n\n        :param link: link content or email address.\n        :param is_email: whether this is an email or not.\n        \"\"\"\n        arg_3 = arg_1 = escape(arg_1)\n        if arg_2:\n            arg_1 = 'mailto:%s' % arg_1\n        return '<a href=\"%s\">%s</a>' % (arg_1, arg_3)", "path": "docs/mistune.py", "identifier": "Renderer.autolink", "docstring": "Rendering a given link or email address.\n\n        :param link: link content or email address.\n        :param is_email: whether this is an email or not.", "docstring_tokens": ["Rendering", "a", "given", "link", "or", "email", "address", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 256220}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1689-L1703", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Set the value of the servername extension to send in the client hello.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"name must be a byte string\"", ")", "elif", "b\"\\0\"", "in", "arg_1", ":", "raise", "TypeError", "(", "\"name must not contain NUL byte\"", ")", "_lib", ".", "SSL_Func", "(", "arg_0", ".", "_ssl", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set the value of the servername extension to send in the client hello.\n\n        :param name: A byte string giving the name.\n\n        .. versionadded:: 0.13\n        \"\"\"\n        if not isinstance(arg_1, bytes):\n            raise TypeError(\"name must be a byte string\")\n        elif b\"\\0\" in arg_1:\n            raise TypeError(\"name must not contain NUL byte\")\n\n        # XXX I guess this can fail sometimes?\n        _lib.SSL_Func(arg_0._ssl, arg_1)", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.set_tlsext_host_name", "docstring": "Set the value of the servername extension to send in the client hello.\n\n        :param name: A byte string giving the name.\n\n        .. versionadded:: 0.13", "docstring_tokens": ["Set", "the", "value", "of", "the", "servername", "extension", "to", "send", "in", "the", "client", "hello", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256221}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_dict.py#L346-L380", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "r\"\"\"\n    Generates values from a dictionary", "language": "python", "parameters": "(dict_, keys, default=util_const.NoParam)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "NoParam", ")", ":", "if", "arg_2", "is", "arg_3", ".", "NoParam", ":", "for", "arg_5", "in", "arg_1", ":", "yield", "arg_0", "[", "arg_5", "]", "else", ":", "for", "arg_5", "in", "arg_1", ":", "yield", "arg_0", ".", "get", "(", "arg_5", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.NoParam):\n    r\"\"\"\n    Generates values from a dictionary\n\n    Args:\n        dict_ (Mapping): a dictionary to take from\n        keys (Iterable): the keys to take\n        default (object, optional): if specified uses default if keys are missing\n\n    CommandLine:\n        python -m ubelt.util_dict Func_gen\n\n    Example:\n        >>> import ubelt as ub\n        >>> dict_ = {1: 'a', 2: 'b', 3: 'c'}\n        >>> keys = [1, 2, 3, 4, 5]\n        >>> result = list(ub.Func(dict_, keys, None))\n        >>> assert result == ['a', 'b', 'c', None, None]\n\n    Example:\n        >>> import ubelt as ub\n        >>> dict_ = {1: 'a', 2: 'b', 3: 'c'}\n        >>> keys = [1, 2, 3, 4, 5]\n        >>> try:\n        >>>     print(list(ub.Func(dict_, keys)))\n        >>>     raise AssertionError('did not get key error')\n        >>> except KeyError:\n        >>>     print('correctly got key error')\n    \"\"\"\n    if arg_2 is arg_3.NoParam:\n        for arg_5 in arg_1:\n            yield arg_0[arg_5]\n    else:\n        for arg_5 in arg_1:\n            yield arg_0.get(arg_5, arg_2)", "path": "ubelt/util_dict.py", "identifier": "dict_take", "docstring": "r\"\"\"\n    Generates values from a dictionary\n\n    Args:\n        dict_ (Mapping): a dictionary to take from\n        keys (Iterable): the keys to take\n        default (object, optional): if specified uses default if keys are missing\n\n    CommandLine:\n        python -m ubelt.util_dict dict_take_gen\n\n    Example:\n        >>> import ubelt as ub\n        >>> dict_ = {1: 'a', 2: 'b', 3: 'c'}\n        >>> keys = [1, 2, 3, 4, 5]\n        >>> result = list(ub.dict_take(dict_, keys, None))\n        >>> assert result == ['a', 'b', 'c', None, None]\n\n    Example:\n        >>> import ubelt as ub\n        >>> dict_ = {1: 'a', 2: 'b', 3: 'c'}\n        >>> keys = [1, 2, 3, 4, 5]\n        >>> try:\n        >>>     print(list(ub.dict_take(dict_, keys)))\n        >>>     raise AssertionError('did not get key error')\n        >>> except KeyError:\n        >>>     print('correctly got key error')", "docstring_tokens": ["r", "Generates", "values", "from", "a", "dictionary"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 256222}
{"url": "https://github.com/jshiv/turntable/blob/c095a93df14d672ba54db164a7ab7373444d1829/turntable/utils.py#L324-L361", "sha": "c095a93df14d672ba54db164a7ab7373444d1829", "docstring_summary": "Displays time if verbose is true and count is within the display amount", "language": "python", "parameters": "(elapsed, display_amt, est_end, nLoops, count, numPrints)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_5", ">", "arg_3", ":", "arg_1", "=", "1", "else", ":", "arg_1", "=", "round", "(", "arg_3", "/", "arg_5", ")", "if", "arg_4", "%", "arg_1", "==", "0", ":", "arg_6", "=", "arg_0", "/", "arg_4", "arg_2", "=", "round", "(", "arg_6", "*", "arg_3", ")", "(", "arg_7", ",", "arg_8", ",", "arg_9", ")", "=", "timeUnit", "(", "int", "(", "round", "(", "arg_0", ")", ")", ",", "int", "(", "round", "(", "arg_6", ")", ")", ",", "int", "(", "round", "(", "arg_2", ")", ")", ")", "print", "\"%s%%\"", "%", "str", "(", "round", "(", "arg_4", "/", "float", "(", "arg_3", ")", "*", "100", ")", ")", ",", "\"@\"", "+", "str", "(", "arg_4", ")", ",", "arg_10", "=", "arg_9", "[", "0", "]", "arg_11", "=", "arg_9", "[", "1", "]", "if", "str", "(", "arg_11", ")", "==", "\"secs\"", ":", "arg_12", "=", "arg_10", "-", "round", "(", "arg_0", ")", "arg_13", "=", "\"secs\"", "elif", "str", "(", "arg_11", ")", "==", "\"mins\"", ":", "arg_12", "=", "arg_10", "-", "round", "(", "arg_0", ")", "/", "60", "arg_13", "=", "\"mins\"", "elif", "str", "(", "arg_11", ")", "==", "\"hr\"", ":", "arg_12", "=", "arg_10", "-", "round", "(", "arg_0", ")", "/", "3600", "arg_13", "=", "\"hr\"", "print", "\"ETA: %s %s\"", "%", "(", "str", "(", "arg_12", ")", ",", "arg_13", ")", "print", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    '''Displays time if verbose is true and count is within the display amount'''\n\n    if arg_5 > arg_3:\n        arg_1 = 1\n    else:\n        arg_1 = round(arg_3 / arg_5)\n\n    if arg_4 % arg_1 == 0:\n\n        arg_6 = arg_0 / arg_4\n        arg_2 = round(arg_6 * arg_3)\n\n        (arg_7,\n         arg_8,\n         arg_9) = timeUnit(int(round(arg_0)),\n                              int(round(arg_6)),\n                              int(round(arg_2)))\n\n        print \"%s%%\" % str(round(arg_4 / float(arg_3) * 100)), \"@\" + str(arg_4),\n\n        arg_10 = arg_9[0]\n        arg_11 = arg_9[1]\n\n        if str(arg_11) == \"secs\":\n            arg_12 = arg_10 - round(arg_0)\n            arg_13 = \"secs\"\n        elif str(arg_11) == \"mins\":\n            arg_12 = arg_10 - round(arg_0) / 60\n            arg_13 = \"mins\"\n        elif str(arg_11) == \"hr\":\n            arg_12 = arg_10 - round(arg_0) / 3600\n            arg_13 = \"hr\"\n\n        print \"ETA: %s %s\" % (str(arg_12), arg_13)\n        print\n\n    return", "path": "turntable/utils.py", "identifier": "displayAll", "docstring": "Displays time if verbose is true and count is within the display amount", "docstring_tokens": ["Displays", "time", "if", "verbose", "is", "true", "and", "count", "is", "within", "the", "display", "amount"], "nwo": "jshiv/turntable", "score": 0.0, "idx": 256223}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch_v2.py#L417-L428", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return particle info for a specific modelId.", "language": "python", "parameters": "(self, modelId)", "return_statement": "return (entry['modelParams']['particleState'], modelId, entry['errScore'],\n            entry['completed'], entry['matured'])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_allResults", "[", "arg_0", ".", "_modelIDToIdx", "[", "arg_1", "]", "]", "return", "(", "arg_2", "[", "'modelParams'", "]", "[", "'particleState'", "]", ",", "arg_1", ",", "arg_2", "[", "'errScore'", "]", ",", "arg_2", "[", "'completed'", "]", ",", "arg_2", "[", "'matured'", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return particle info for a specific modelId.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    modelId:  which model Id\n\n    retval:  (particleState, modelId, errScore, completed, matured)\n    \"\"\"\n    arg_2 = arg_0._allResults[arg_0._modelIDToIdx[arg_1]]\n    return (arg_2['modelParams']['particleState'], arg_1, arg_2['errScore'],\n            arg_2['completed'], arg_2['matured'])", "path": "src/nupic/swarming/hypersearch_v2.py", "identifier": "ResultsDB.getParticleInfo", "docstring": "Return particle info for a specific modelId.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    modelId:  which model Id\n\n    retval:  (particleState, modelId, errScore, completed, matured)", "docstring_tokens": ["Return", "particle", "info", "for", "a", "specific", "modelId", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256224}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-astro/vaex/astro/transformations.py#L114-L137", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Concert velocities from a cartesian system to proper motions and radial velocities", "language": "python", "parameters": "(self, x=\"x\", y=\"y\", z=\"z\", vx=\"vx\", vy=\"vy\", vz=\"vz\", vr=\"vr\", pm_long=\"pm_long\", pm_lat=\"pm_lat\", distance=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"x\"", ",", "arg_2", "=", "\"y\"", ",", "arg_3", "=", "\"z\"", ",", "arg_4", "=", "\"vx\"", ",", "arg_5", "=", "\"vy\"", ",", "arg_6", "=", "\"vz\"", ",", "arg_7", "=", "\"vr\"", ",", "arg_8", "=", "\"pm_long\"", ",", "arg_9", "=", "\"pm_lat\"", ",", "arg_10", "=", "None", ")", ":", "if", "arg_10", "is", "None", ":", "arg_10", "=", "\"sqrt({x}**2+{y}**2+{z}**2)\"", ".", "format", "(", "**", "locals", "(", ")", ")", "arg_11", "=", "4.74057", "arg_0", ".", "add_variable", "(", "\"k\"", ",", "arg_11", ",", "overwrite", "=", "False", ")", "arg_0", ".", "add_virtual_column", "(", "arg_7", ",", "\"({x}*{vx}+{y}*{vy}+{z}*{vz})/{distance}\"", ".", "format", "(", "**", "locals", "(", ")", ")", ")", "arg_0", ".", "add_virtual_column", "(", "arg_8", ",", "\"-({vx}*{y}-{x}*{vy})/sqrt({x}**2+{y}**2)/{distance}/k\"", ".", "format", "(", "**", "locals", "(", ")", ")", ")", "arg_0", ".", "add_virtual_column", "(", "arg_9", ",", "\"-({z}*({x}*{vx}+{y}*{vy}) - ({x}**2+{y}**2)*{vz})/( ({x}**2+{y}**2+{z}**2) * sqrt({x}**2+{y}**2) )/k\"", ".", "format", "(", "**", "locals", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1=\"x\", arg_2=\"y\", arg_3=\"z\", arg_4=\"vx\", arg_5=\"vy\", arg_6=\"vz\", arg_7=\"vr\", arg_8=\"pm_long\", arg_9=\"pm_lat\", arg_10=None):\n    \"\"\"Concert velocities from a cartesian system to proper motions and radial velocities\n\n    TODO: errors\n\n    :param x: name of x column (input)\n    :param y:         y\n    :param z:         z\n    :param vx:       vx\n    :param vy:       vy\n    :param vz:       vz\n    :param vr: name of the column for the radial velocity in the r direction (output)\n    :param pm_long: name of the column for the proper motion component in the longitude direction  (output)\n    :param pm_lat: name of the column for the proper motion component in the latitude direction, positive points to the north pole (output)\n    :param distance: Expression for distance, if not given defaults to sqrt(x**2+y**2+z**2), but if this column already exists, passing this expression may lead to a better performance\n    :return:\n    \"\"\"\n    if arg_10 is None:\n        arg_10 = \"sqrt({x}**2+{y}**2+{z}**2)\".format(**locals())\n    arg_11 = 4.74057\n    arg_0.add_variable(\"k\", arg_11, overwrite=False)\n    arg_0.add_virtual_column(arg_7, \"({x}*{vx}+{y}*{vy}+{z}*{vz})/{distance}\".format(**locals()))\n    arg_0.add_virtual_column(arg_8, \"-({vx}*{y}-{x}*{vy})/sqrt({x}**2+{y}**2)/{distance}/k\".format(**locals()))\n    arg_0.add_virtual_column(arg_9, \"-({z}*({x}*{vx}+{y}*{vy}) - ({x}**2+{y}**2)*{vz})/( ({x}**2+{y}**2+{z}**2) * sqrt({x}**2+{y}**2) )/k\".format(**locals()))", "path": "packages/vaex-astro/vaex/astro/transformations.py", "identifier": "add_virtual_columns_cartesian_velocities_to_pmvr", "docstring": "Concert velocities from a cartesian system to proper motions and radial velocities\n\n    TODO: errors\n\n    :param x: name of x column (input)\n    :param y:         y\n    :param z:         z\n    :param vx:       vx\n    :param vy:       vy\n    :param vz:       vz\n    :param vr: name of the column for the radial velocity in the r direction (output)\n    :param pm_long: name of the column for the proper motion component in the longitude direction  (output)\n    :param pm_lat: name of the column for the proper motion component in the latitude direction, positive points to the north pole (output)\n    :param distance: Expression for distance, if not given defaults to sqrt(x**2+y**2+z**2), but if this column already exists, passing this expression may lead to a better performance\n    :return:", "docstring_tokens": ["Concert", "velocities", "from", "a", "cartesian", "system", "to", "proper", "motions", "and", "radial", "velocities"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 256225}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hatlc.py#L564-L620", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This validates the sqlitecurve filter string.", "language": "python", "parameters": "(filterstring, lccolumns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_squeeze", "(", "arg_0", ")", ".", "lower", "(", ")", "arg_2", "=", "arg_0", ".", "replace", "(", "'('", ",", "''", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "')'", ",", "''", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "','", ",", "''", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "\"'\"", ",", "'\"'", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "'\\n'", ",", "' '", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "'\\t'", ",", "' '", ")", "arg_2", "=", "_squeeze", "(", "arg_2", ")", "arg_2", "=", "arg_2", ".", "split", "(", "' '", ")", "arg_2", "=", "[", "arg_4", ".", "strip", "(", ")", "for", "arg_4", "in", "arg_2", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "try", ":", "float", "(", "arg_4", ")", "except", "ValueError", "as", "e", ":", "arg_3", ".", "append", "(", "arg_4", ")", "arg_5", "=", "[", "]", "for", "arg_4", "in", "arg_3", ":", "if", "not", "(", "arg_4", ".", "startswith", "(", "'\"'", ")", "and", "arg_4", ".", "endswith", "(", "'\"'", ")", ")", ":", "arg_5", ".", "append", "(", "arg_4", ")", "arg_5", "=", "[", "arg_4", "for", "arg_4", "in", "arg_5", "if", "len", "(", "arg_4", ")", ">", "0", "]", "arg_6", "=", "set", "(", "arg_5", ")", "arg_7", "=", "SQLITE_ALLOWED_WORDS", "+", "arg_1", "arg_8", "=", "set", "(", "arg_7", ")", "arg_9", "=", "list", "(", "arg_6", "-", "arg_8", ")", "if", "len", "(", "arg_9", ")", ">", "0", ":", "LOGWARNING", "(", "\"provided SQL filter string '%s' \"", "\"contains non-allowed keywords\"", "%", "arg_0", ")", "return", "None", "else", ":", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    '''This validates the sqlitecurve filter string.\n\n    This MUST be valid SQL but not contain any commands.\n\n    '''\n\n    # first, lowercase, then _squeeze to single spaces\n    arg_2 = _squeeze(arg_0).lower()\n\n    # replace shady characters\n    arg_2 = arg_0.replace('(','')\n    arg_2 = arg_2.replace(')','')\n    arg_2 = arg_2.replace(',','')\n    arg_2 = arg_2.replace(\"'\",'\"')\n    arg_2 = arg_2.replace('\\n',' ')\n    arg_2 = arg_2.replace('\\t',' ')\n    arg_2 = _squeeze(arg_2)\n\n    # split into words\n    arg_2 = arg_2.split(' ')\n    arg_2 = [arg_4.strip() for arg_4 in arg_2]\n\n    # get rid of all numbers\n    arg_3 = []\n    for arg_4 in arg_2:\n        try:\n            float(arg_4)\n        except ValueError as e:\n            arg_3.append(arg_4)\n\n    # get rid of everything within quotes\n    arg_5 = []\n    for arg_4 in arg_3:\n        if not(arg_4.startswith('\"') and arg_4.endswith('\"')):\n            arg_5.append(arg_4)\n    arg_5 = [arg_4 for arg_4 in arg_5 if len(arg_4) > 0]\n\n    # check the filterstring words against the allowed words\n    arg_6 = set(arg_5)\n\n    # generate the allowed word set for these LC columns\n    arg_7 = SQLITE_ALLOWED_WORDS + arg_1\n    arg_8 = set(arg_7)\n\n    arg_9 = list(arg_6 - arg_8)\n\n    # if there are words left over, then this filter string is suspicious\n    if len(arg_9) > 0:\n\n        # check if validatecheck contains an elem with % in it\n        LOGWARNING(\"provided SQL filter string '%s' \"\n                   \"contains non-allowed keywords\" % arg_0)\n        return None\n\n    else:\n        return arg_0", "path": "astrobase/hatsurveys/hatlc.py", "identifier": "_validate_sqlitecurve_filters", "docstring": "This validates the sqlitecurve filter string.\n\n    This MUST be valid SQL but not contain any commands.", "docstring_tokens": ["This", "validates", "the", "sqlitecurve", "filter", "string", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 256226}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/misc/pplan_helper.py#L158-L163", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns the topology config", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "pplan", ".", "topology", ".", "HasField", "(", "\"topology_config\"", ")", ":", "return", "arg_0", ".", "_get_dict_from_config", "(", "arg_0", ".", "pplan", ".", "topology", ".", "topology_config", ")", "else", ":", "return", "{", "}"], "function": "def Func(arg_0):\n    \"\"\"Returns the topology config\"\"\"\n    if arg_0.pplan.topology.HasField(\"topology_config\"):\n      return arg_0._get_dict_from_config(arg_0.pplan.topology.topology_config)\n    else:\n      return {}", "path": "heron/instance/src/python/utils/misc/pplan_helper.py", "identifier": "PhysicalPlanHelper.get_topology_config", "docstring": "Returns the topology config", "docstring_tokens": ["Returns", "the", "topology", "config"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256227}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/interpret.py#L553-L590", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Parse command line options and launch the interpreter", "language": "python", "parameters": "()", "return_statement": "return func()", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "optparse", ".", "OptionParser", "(", "usage", "=", "\"%prog [options] <model_path> [another_model_path..]\"", ",", "version", "=", "xtuml", ".", "version", ".", "complete_string", ",", "formatter", "=", "optparse", ".", "TitledHelpFormatter", "(", ")", ")", "arg_0", ".", "add_option", "(", "\"-v\"", ",", "\"--verbosity\"", ",", "dest", "=", "'verbosity'", ",", "action", "=", "\"count\"", ",", "default", "=", "1", ",", "help", "=", "\"increase debug logging level\"", ")", "arg_0", ".", "add_option", "(", "\"-f\"", ",", "\"--function\"", ",", "dest", "=", "'function'", ",", "action", "=", "\"store\"", ",", "help", "=", "\"invoke function named NAME\"", ",", "metavar", "=", "'NAME'", ")", "arg_0", ".", "add_option", "(", "\"-c\"", ",", "\"--component\"", ",", "dest", "=", "'component'", ",", "action", "=", "\"store\"", ",", "help", "=", "\"look for the function in a component named NAME\"", ",", "metavar", "=", "'NAME'", ",", "default", "=", "None", ")", "(", "arg_1", ",", "arg_2", ")", "=", "arg_0", ".", "parse_args", "(", ")", "if", "len", "(", "arg_2", ")", "==", "0", "or", "not", "arg_1", ".", "function", ":", "arg_0", ".", "print_help", "(", ")", "sys", ".", "exit", "(", "1", ")", "arg_3", "=", "{", "0", ":", "logging", ".", "ERROR", ",", "1", ":", "logging", ".", "WARNING", ",", "2", ":", "logging", ".", "INFO", ",", "3", ":", "logging", ".", "DEBUG", ",", "}", "logging", ".", "basicConfig", "(", "level", "=", "arg_3", ".", "get", "(", "arg_1", ".", "verbosity", ",", "logging", ".", "DEBUG", ")", ")", "from", "bridgepoint", "import", "ooaofooa", "arg_4", "=", "ooaofooa", ".", "load_metamodel", "(", "arg_2", ")", "arg_5", "=", "arg_4", ".", "select_any", "(", "'C_C'", ",", "where", "(", "Name", "=", "arg_1", ".", "component", ")", ")", "arg_6", "=", "ooaofooa", ".", "mk_component", "(", "arg_4", ",", "arg_5", ",", "derived_attributes", "=", "False", ")", "arg_7", "=", "arg_6", ".", "find_symbol", "(", "arg_1", ".", "function", ")", "return", "arg_7", "(", ")"], "function": "def Func():\n    '''\n    Parse command line options and launch the interpreter\n    '''\n    arg_0 = optparse.OptionParser(usage=\"%prog [options] <model_path> [another_model_path..]\",\n                                   version=xtuml.version.complete_string,\n                                   formatter=optparse.TitledHelpFormatter())\n\n    arg_0.add_option(\"-v\", \"--verbosity\", dest='verbosity', action=\"count\",\n                      default=1, help=\"increase debug logging level\")\n    \n    arg_0.add_option(\"-f\", \"--function\", dest='function', action=\"store\",\n                      help=\"invoke function named NAME\", metavar='NAME')\n    \n    arg_0.add_option(\"-c\", \"--component\", dest='component', action=\"store\",\n                      help=\"look for the function in a component named NAME\",\n                      metavar='NAME', default=None)\n    \n    (arg_1, arg_2) = arg_0.parse_args()\n    if len(arg_2) == 0 or not arg_1.function:\n        arg_0.print_help()\n        sys.exit(1)\n        \n    arg_3 = {\n              0: logging.ERROR,\n              1: logging.WARNING,\n              2: logging.INFO,\n              3: logging.DEBUG,\n    }\n    logging.basicConfig(level=arg_3.get(arg_1.verbosity, logging.DEBUG))\n    \n    from bridgepoint import ooaofooa\n    arg_4 = ooaofooa.load_metamodel(arg_2)\n    arg_5 = arg_4.select_any('C_C', where(Name=arg_1.component))\n    arg_6 = ooaofooa.mk_component(arg_4, arg_5, derived_attributes=False)\n    \n    arg_7 = arg_6.find_symbol(arg_1.function)\n    return arg_7()", "path": "bridgepoint/interpret.py", "identifier": "main", "docstring": "Parse command line options and launch the interpreter", "docstring_tokens": ["Parse", "command", "line", "options", "and", "launch", "the", "interpreter"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 256228}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/common/interfaces.py#L171-L177", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "helper to aggregate codes by mask", "language": "python", "parameters": "(codes_regex, codes_dict)", "return_statement": "return total", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_0", ".", "match", "(", "str", "(", "arg_3", ")", ")", ":", "arg_2", "+=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" helper to aggregate codes by mask \"\"\"\n        arg_2 = 0\n        for arg_3, arg_4 in arg_1.items():\n            if arg_0.match(str(arg_3)):\n                arg_2 += arg_4\n        return arg_2", "path": "yandextank/common/interfaces.py", "identifier": "AbstractCriterion.count_matched_codes", "docstring": "helper to aggregate codes by mask", "docstring_tokens": ["helper", "to", "aggregate", "codes", "by", "mask"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 256229}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py#L776-L806", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Starts a kernel process and configures the manager to use it.", "language": "python", "parameters": "(self, **kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "arg_0", ".", "ip", "not", "in", "LOCAL_IPS", ":", "raise", "RuntimeError", "(", "\"Can only launch a kernel on a local interface. \"", "\"Make sure that the '*_address' attributes are \"", "\"configured properly. \"", "\"Currently valid addresses are: %s\"", "%", "LOCAL_IPS", ")", "arg_0", ".", "write_connection_file", "(", ")", "arg_0", ".", "_launch_args", "=", "arg_1", ".", "copy", "(", ")", "arg_3", "=", "arg_1", ".", "pop", "(", "'launcher'", ",", "None", ")", "if", "arg_3", "is", "None", ":", "from", "ipkernel", "import", "arg_3", "arg_0", ".", "kernel", "=", "arg_3", "(", "fname", "=", "arg_0", ".", "connection_file", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Starts a kernel process and configures the manager to use it.\n\n        If random ports (port=0) are being used, this method must be called\n        before the channels are created.\n\n        Parameters:\n        -----------\n        launcher : callable, optional (default None)\n             A custom function for launching the kernel process (generally a\n             wrapper around ``entry_point.base_launch_kernel``). In most cases,\n             it should not be necessary to use this parameter.\n\n        **kw : optional\n             See respective options for IPython and Python kernels.\n        \"\"\"\n        if arg_0.ip not in LOCAL_IPS:\n            raise RuntimeError(\"Can only launch a kernel on a local interface. \"\n                               \"Make sure that the '*_address' attributes are \"\n                               \"configured properly. \"\n                               \"Currently valid addresses are: %s\"%LOCAL_IPS\n                               )\n        \n        # write connection file / get default ports\n        arg_0.write_connection_file()\n\n        arg_0._launch_args = arg_1.copy()\n        arg_3 = arg_1.pop('launcher', None)\n        if arg_3 is None:\n            from ipkernel import arg_3\n        arg_0.kernel = arg_3(fname=arg_0.connection_file, **arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py", "identifier": "KernelManager.start_kernel", "docstring": "Starts a kernel process and configures the manager to use it.\n\n        If random ports (port=0) are being used, this method must be called\n        before the channels are created.\n\n        Parameters:\n        -----------\n        launcher : callable, optional (default None)\n             A custom function for launching the kernel process (generally a\n             wrapper around ``entry_point.base_launch_kernel``). In most cases,\n             it should not be necessary to use this parameter.\n\n        **kw : optional\n             See respective options for IPython and Python kernels.", "docstring_tokens": ["Starts", "a", "kernel", "process", "and", "configures", "the", "manager", "to", "use", "it", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256230}
{"url": "https://github.com/gawel/panoramisk/blob/2ccb5d18be28a8e8f444dc0cd3a3bfb59aa19a8e/panoramisk/manager.py#L242-L248", "sha": "2ccb5d18be28a8e8f444dc0cd3a3bfb59aa19a8e", "docstring_summary": "Close the connection", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "pinger", ":", "arg_0", ".", "pinger", ".", "cancel", "(", ")", "arg_0", ".", "pinger", "=", "None", "if", "getattr", "(", "arg_0", ",", "'protocol'", ",", "None", ")", ":", "arg_0", ".", "protocol", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Close the connection\"\"\"\n        if arg_0.pinger:\n            arg_0.pinger.cancel()\n            arg_0.pinger = None\n        if getattr(arg_0, 'protocol', None):\n            arg_0.protocol.Func()", "path": "panoramisk/manager.py", "identifier": "Manager.close", "docstring": "Close the connection", "docstring_tokens": ["Close", "the", "connection"], "nwo": "gawel/panoramisk", "score": 0.596986650254817, "idx": 256231}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L185-L201", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Add a node to run on failure.", "language": "python", "parameters": "(self, parent, child=None, **kwargs)", "return_statement": "return self._assoc_or_create('failure', parent, child, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "_assoc_or_create", "(", "'failure'", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Add a node to run on failure.\n\n        =====API DOCS=====\n        Add a node to run on failure.\n\n        :param parent: Primary key of parent node to associate failure node to.\n        :type parent: int\n        :param child: Primary key of child node to be associated.\n        :type child: int\n        :param `**kwargs`: Fields used to create child node if ``child`` is not provided.\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        return arg_0._assoc_or_create('failure', arg_1, arg_2, **arg_3)", "path": "tower_cli/resources/node.py", "identifier": "Resource.associate_failure_node", "docstring": "Add a node to run on failure.\n\n        =====API DOCS=====\n        Add a node to run on failure.\n\n        :param parent: Primary key of parent node to associate failure node to.\n        :type parent: int\n        :param child: Primary key of child node to be associated.\n        :type child: int\n        :param `**kwargs`: Fields used to create child node if ``child`` is not provided.\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Add", "a", "node", "to", "run", "on", "failure", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 256232}
{"url": "https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/irc.py#L329-L346", "sha": "f9d2bd6369aafe6cb0916c9406270ca8ecea2080", "docstring_summary": "\\\n    Convenience function to start a bot on the given network, optionally joining\n    some channels", "language": "python", "parameters": "(bot_class, host, port, nick, channels=None, ssl=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "IRCConnection", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_5", ")", "arg_7", "=", "arg_0", "(", "arg_6", ")", "while", "1", ":", "if", "not", "arg_6", ".", "connect", "(", ")", ":", "break", "arg_4", "=", "arg_4", "or", "[", "]", "for", "arg_8", "in", "arg_4", ":", "arg_6", ".", "join", "(", "arg_8", ")", "arg_6", ".", "enter_event_loop", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None):\n    \"\"\"\\\n    Convenience function to start a bot on the given network, optionally joining\n    some channels\n    \"\"\"\n    arg_6 = IRCConnection(arg_1, arg_2, arg_3, arg_5)\n    arg_7 = arg_0(arg_6)\n\n    while 1:\n        if not arg_6.connect():\n            break\n\n        arg_4 = arg_4 or []\n\n        for arg_8 in arg_4:\n            arg_6.join(arg_8)\n\n        arg_6.enter_event_loop()", "path": "irc.py", "identifier": "run_bot", "docstring": "\\\n    Convenience function to start a bot on the given network, optionally joining\n    some channels", "docstring_tokens": ["\\", "Convenience", "function", "to", "start", "a", "bot", "on", "the", "given", "network", "optionally", "joining", "some", "channels"], "nwo": "coleifer/irc", "score": 0.28749967694495965, "idx": 256233}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1441-L1449", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a dictionary of circuit properties.", "language": "python", "parameters": "(self)", "return_statement": "return summary", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"size\"", ":", "arg_0", ".", "size", "(", ")", ",", "\"depth\"", ":", "arg_0", ".", "depth", "(", ")", ",", "\"width\"", ":", "arg_0", ".", "width", "(", ")", ",", "\"bits\"", ":", "arg_0", ".", "num_cbits", "(", ")", ",", "\"factors\"", ":", "arg_0", ".", "num_tensor_factors", "(", ")", ",", "\"operations\"", ":", "arg_0", ".", "count_ops", "(", ")", "}", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return a dictionary of circuit Func.\"\"\"\n        arg_1 = {\"size\": arg_0.size(),\n                   \"depth\": arg_0.depth(),\n                   \"width\": arg_0.width(),\n                   \"bits\": arg_0.num_cbits(),\n                   \"factors\": arg_0.num_tensor_factors(),\n                   \"operations\": arg_0.count_ops()}\n        return arg_1", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.properties", "docstring": "Return a dictionary of circuit properties.", "docstring_tokens": ["Return", "a", "dictionary", "of", "circuit", "properties", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256234}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/bijector.py#L74-L102", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns new _Mapping with args merged with self.", "language": "python", "parameters": "(self, x=None, y=None, ildj=None, kwargs=None, mapping=None)", "return_statement": "return _Mapping(\n        x=self._merge(self.x, mapping.x),\n        y=self._merge(self.y, mapping.y),\n        ildj=self._merge(self.ildj, mapping.ildj),\n        kwargs=self._merge(self.kwargs, mapping.kwargs, use_equals=True))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "arg_5", "is", "None", ":", "arg_5", "=", "_Mapping", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "elif", "any", "(", "arg_6", "is", "not", "None", "for", "arg_6", "in", "[", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "]", ")", ":", "raise", "ValueError", "(", "\"Cannot simultaneously specify mapping and individual \"", "\"arguments.\"", ")", "return", "_Mapping", "(", "arg_1", "=", "arg_0", ".", "_Func", "(", "arg_0", ".", "x", ",", "arg_5", ".", "x", ")", ",", "arg_2", "=", "arg_0", ".", "_Func", "(", "arg_0", ".", "y", ",", "arg_5", ".", "y", ")", ",", "arg_3", "=", "arg_0", ".", "_Func", "(", "arg_0", ".", "ildj", ",", "arg_5", ".", "ildj", ")", ",", "arg_4", "=", "arg_0", ".", "_Func", "(", "arg_0", ".", "kwargs", ",", "arg_5", ".", "kwargs", ",", "use_equals", "=", "True", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=None):\n    \"\"\"Returns new _Mapping with args Funcd with self.\n\n    Args:\n      x: `Tensor` or None. Input to forward; output of inverse.\n      y: `Tensor` or None. Input to inverse; output of forward.\n      ildj: `Tensor`. This is the (un-reduce_sum'ed) inverse log det jacobian.\n      kwargs: Python dictionary. Extra args supplied to forward/inverse/etc\n        functions.\n      mapping: Instance of _Mapping to Func. Can only be specified if no other\n        arg is specified.\n\n    Returns:\n      mapping: New instance of `_Mapping` which has inputs Funcd with self.\n\n    Raises:\n      ValueError: if mapping and any other arg is not `None`.\n    \"\"\"\n    if arg_5 is None:\n      arg_5 = _Mapping(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)\n    elif any(arg_6 is not None for arg_6 in [arg_1, arg_2, arg_3, arg_4]):\n      raise ValueError(\"Cannot simultaneously specify mapping and individual \"\n                       \"arguments.\")\n\n    return _Mapping(\n        arg_1=arg_0._Func(arg_0.x, arg_5.x),\n        arg_2=arg_0._Func(arg_0.y, arg_5.y),\n        arg_3=arg_0._Func(arg_0.ildj, arg_5.ildj),\n        arg_4=arg_0._Func(arg_0.kwargs, arg_5.kwargs, use_equals=True))", "path": "tensorflow_probability/python/bijectors/bijector.py", "identifier": "_Mapping.merge", "docstring": "Returns new _Mapping with args merged with self.\n\n    Args:\n      x: `Tensor` or None. Input to forward; output of inverse.\n      y: `Tensor` or None. Input to inverse; output of forward.\n      ildj: `Tensor`. This is the (un-reduce_sum'ed) inverse log det jacobian.\n      kwargs: Python dictionary. Extra args supplied to forward/inverse/etc\n        functions.\n      mapping: Instance of _Mapping to merge. Can only be specified if no other\n        arg is specified.\n\n    Returns:\n      mapping: New instance of `_Mapping` which has inputs merged with self.\n\n    Raises:\n      ValueError: if mapping and any other arg is not `None`.", "docstring_tokens": ["Returns", "new", "_Mapping", "with", "args", "merged", "with", "self", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256235}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/cytoband.py#L44-L65", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "docstring for cli", "language": "python", "parameters": "(infile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_file_handle", "(", "arg_0", ")", "arg_2", "=", "parse_cytoband", "(", "arg_1", ")", "print", "(", "\"Check some coordinates:\"", ")", "print", "(", "\"checking chrom 1 pos 2\"", ")", "arg_3", "=", "arg_2", "[", "'1'", "]", "[", "2", "]", "for", "arg_4", "in", "arg_3", ":", "print", "(", "arg_4", ")", "print", "(", "arg_4", ".", "begin", ")", "print", "(", "arg_4", ".", "end", ")", "print", "(", "arg_4", ".", "data", ")", "print", "(", "arg_2", "[", "'1'", "]", "[", "2", "]", ")", "print", "(", "\"checking chrom 8 pos 101677777\"", ")", "print", "(", "arg_2", "[", "'8'", "]", "[", "101677777", "]", ")", "print", "(", "\"checking chrom X pos 4200000 - 6000000\"", ")", "print", "(", "arg_2", "[", "'X'", "]", "[", "4200000", ":", "6000000", "]", ")"], "function": "def Func(arg_0):\n    \"\"\"docstring for Func\"\"\"\n    arg_1 = get_file_handle(arg_0)\n    arg_2 = parse_cytoband(arg_1)\n    \n    print(\"Check some coordinates:\")\n    \n    print(\"checking chrom 1 pos 2\")\n    arg_3 = arg_2['1'][2]\n    for arg_4 in arg_3:\n        print(arg_4)\n        print(arg_4.begin)\n        print(arg_4.end)\n        print(arg_4.data)\n        # print(interval.__dict__)\n    print(arg_2['1'][2])\n    \n    print(\"checking chrom 8 pos 101677777\")\n    print(arg_2['8'][101677777])\n\n    print(\"checking chrom X pos 4200000 - 6000000\")\n    print(arg_2['X'][4200000:6000000])", "path": "scout/parse/cytoband.py", "identifier": "cli", "docstring": "docstring for cli", "docstring_tokens": ["docstring", "for", "cli"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256236}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L853-L869", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Reset section checking for preprocessor directive.", "language": "python", "parameters": "(self, directive)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_section", "=", "arg_0", ".", "_INITIAL_SECTION", "arg_0", ".", "_last_header", "=", "''", "if", "arg_1", "in", "(", "'if'", ",", "'ifdef'", ",", "'ifndef'", ")", ":", "arg_0", ".", "include_list", ".", "append", "(", "[", "]", ")", "elif", "arg_1", "in", "(", "'else'", ",", "'elif'", ")", ":", "arg_0", ".", "include_list", "[", "-", "1", "]", "=", "[", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Reset section checking for preprocessor directive.\n\n    Args:\n      directive: preprocessor directive (e.g. \"if\", \"else\").\n    \"\"\"\n    # The name of the current section.\n    arg_0._section = arg_0._INITIAL_SECTION\n    # The path of last found header.\n    arg_0._last_header = ''\n\n    # Update list of includes.  Note that we never pop from the\n    # include list.\n    if arg_1 in ('if', 'ifdef', 'ifndef'):\n      arg_0.include_list.append([])\n    elif arg_1 in ('else', 'elif'):\n      arg_0.include_list[-1] = []", "path": "third_party/python/cpplint/cpplint.py", "identifier": "_IncludeState.ResetSection", "docstring": "Reset section checking for preprocessor directive.\n\n    Args:\n      directive: preprocessor directive (e.g. \"if\", \"else\").", "docstring_tokens": ["Reset", "section", "checking", "for", "preprocessor", "directive", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256237}
{"url": "https://github.com/cdriehuys/django-rest-email-auth/blob/7e752c4d77ae02d2d046f214f56e743aa12ab23f/rest_email_auth/serializers.py#L241-L262", "sha": "7e752c4d77ae02d2d046f214f56e743aa12ab23f", "docstring_summary": "Send out a password reset if the provided data is valid.", "language": "python", "parameters": "(self)", "return_statement": "return token", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "models", ".", "EmailAddress", ".", "objects", ".", "get", "(", "arg_1", "=", "arg_0", ".", "validated_data", "[", "\"email\"", "]", ",", "is_verified", "=", "True", ")", "except", "models", ".", "EmailAddress", ".", "DoesNotExist", ":", "return", "None", "arg_2", "=", "models", ".", "PasswordResetToken", ".", "objects", ".", "create", "(", "arg_1", "=", "arg_1", ")", "arg_2", ".", "send", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Send out a password reset if the provided data is valid.\n\n        If the provided email address exists and is verified, a reset\n        email is sent to the address.\n\n        Returns:\n            The password reset token if it was returned and ``None``\n            otherwise.\n        \"\"\"\n        try:\n            arg_1 = models.EmailAddress.objects.get(\n                arg_1=arg_0.validated_data[\"email\"], is_verified=True\n            )\n        except models.EmailAddress.DoesNotExist:\n            return None\n\n        arg_2 = models.PasswordResetToken.objects.create(arg_1=arg_1)\n        arg_2.send()\n\n        return arg_2", "path": "rest_email_auth/serializers.py", "identifier": "PasswordResetRequestSerializer.save", "docstring": "Send out a password reset if the provided data is valid.\n\n        If the provided email address exists and is verified, a reset\n        email is sent to the address.\n\n        Returns:\n            The password reset token if it was returned and ``None``\n            otherwise.", "docstring_tokens": ["Send", "out", "a", "password", "reset", "if", "the", "provided", "data", "is", "valid", "."], "nwo": "cdriehuys/django-rest-email-auth", "score": 0.28490879858232004, "idx": 256238}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/magics.py#L236-L263", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "implementation used by %px and %%parallel", "language": "python", "parameters": "(self, cell, block=None, groupby='type', save_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'type'", ",", "arg_4", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "view", ".", "block", "if", "arg_2", "is", "None", "else", "arg_2", "arg_5", "=", "\"Parallel\"", "if", "arg_2", "else", "\"Async parallel\"", "arg_6", "=", "arg_0", ".", "view", ".", "targets", "if", "isinstance", "(", "arg_6", ",", "list", ")", "and", "len", "(", "arg_6", ")", ">", "10", ":", "arg_7", "=", "str", "(", "arg_6", "[", ":", "4", "]", ")", "[", ":", "-", "1", "]", "+", "', ..., '", "+", "str", "(", "arg_6", "[", "-", "4", ":", "]", ")", "[", "1", ":", "]", "else", ":", "arg_7", "=", "str", "(", "arg_6", ")", "if", "arg_0", ".", "verbose", ":", "print", "arg_5", "+", "\" execution on engine(s): %s\"", "%", "arg_7", "arg_8", "=", "arg_0", ".", "view", ".", "execute", "(", "arg_1", ",", "silent", "=", "False", ",", "arg_2", "=", "False", ")", "arg_0", ".", "last_result", "=", "arg_8", "if", "arg_4", ":", "arg_0", ".", "shell", ".", "user_ns", "[", "arg_4", "]", "=", "arg_8", "if", "arg_2", ":", "arg_8", ".", "get", "(", ")", "arg_8", ".", "display_outputs", "(", "arg_3", ")", "else", ":", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3='type', arg_4=None):\n        \"\"\"implementation used by %px and %%parallel\"\"\"\n\n        # defaults:\n        arg_2 = arg_0.view.block if arg_2 is None else arg_2\n        \n        arg_5 = \"Parallel\" if arg_2 else \"Async parallel\"\n        \n        arg_6 = arg_0.view.targets\n        if isinstance(arg_6, list) and len(arg_6) > 10:\n            arg_7 = str(arg_6[:4])[:-1] + ', ..., ' + str(arg_6[-4:])[1:]\n        else:\n            arg_7 = str(arg_6)\n        if arg_0.verbose:\n            print arg_5 + \" execution on engine(s): %s\" % arg_7\n        \n        arg_8 = arg_0.view.execute(arg_1, silent=False, arg_2=False)\n        arg_0.last_result = arg_8\n        \n        if arg_4:\n            arg_0.shell.user_ns[arg_4] = arg_8\n        \n        if arg_2:\n            arg_8.get()\n            arg_8.display_outputs(arg_3)\n        else:\n            # return AsyncResult only on non-blocking submission\n            return arg_8", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/magics.py", "identifier": "ParallelMagics.parallel_execute", "docstring": "implementation used by %px and %%parallel", "docstring_tokens": ["implementation", "used", "by", "%px", "and", "%%parallel"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256239}
{"url": "https://github.com/UDST/pandana/blob/961a7ef8d3b0144b190cb60bbd61845fca6fb314/pandana/network.py#L583-L618", "sha": "961a7ef8d3b0144b190cb60bbd61845fca6fb314", "docstring_summary": "Identify nodes that are connected to fewer than some threshold\n        of other nodes within a given distance.", "language": "python", "parameters": "(self, impedance, count, imp_name=None)", "return_statement": "return np.array(agg[agg < count].index)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "set", "(", "arg_0", ".", "node_ids", ".", "to_series", "(", ")", ",", "name", "=", "'counter'", ")", "arg_4", "=", "arg_0", ".", "aggregate", "(", "arg_1", ",", "type", "=", "'count'", ",", "arg_3", "=", "arg_3", ",", "name", "=", "'counter'", ")", "return", "np", ".", "array", "(", "arg_4", "[", "arg_4", "<", "arg_2", "]", ".", "index", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Identify nodes that are connected to fewer than some threshold\n        of other nodes within a given distance.\n\n        Parameters\n        ----------\n        impedance : float\n            Distance within which to search for other connected nodes. This\n            will usually be a distance unit in meters however if you have\n            customized the impedance this could be in other units such as\n            utility or time etc.\n        count : int\n            Threshold for connectivity. If a node is connected to fewer\n            than this many nodes within `impedance` it will be identified\n            as \"low connectivity\".\n        imp_name : string, optional\n            The impedance name to use for the aggregation on this network.\n            Must be one of the impedance names passed in the constructor of\n            this object.  If not specified, there must be only one impedance\n            passed in the constructor, which will be used.\n\n        Returns\n        -------\n        node_ids : array\n            List of \"low connectivity\" node IDs.\n\n        \"\"\"\n        # set a counter variable on all nodes\n        arg_0.set(arg_0.node_ids.to_series(), name='counter')\n\n        # count nodes within impedance range\n        arg_4 = arg_0.aggregate(\n            arg_1, type='count', arg_3=arg_3, name='counter')\n\n        return np.array(arg_4[arg_4 < arg_2].index)", "path": "pandana/network.py", "identifier": "Network.low_connectivity_nodes", "docstring": "Identify nodes that are connected to fewer than some threshold\n        of other nodes within a given distance.\n\n        Parameters\n        ----------\n        impedance : float\n            Distance within which to search for other connected nodes. This\n            will usually be a distance unit in meters however if you have\n            customized the impedance this could be in other units such as\n            utility or time etc.\n        count : int\n            Threshold for connectivity. If a node is connected to fewer\n            than this many nodes within `impedance` it will be identified\n            as \"low connectivity\".\n        imp_name : string, optional\n            The impedance name to use for the aggregation on this network.\n            Must be one of the impedance names passed in the constructor of\n            this object.  If not specified, there must be only one impedance\n            passed in the constructor, which will be used.\n\n        Returns\n        -------\n        node_ids : array\n            List of \"low connectivity\" node IDs.", "docstring_tokens": ["Identify", "nodes", "that", "are", "connected", "to", "fewer", "than", "some", "threshold", "of", "other", "nodes", "within", "a", "given", "distance", "."], "nwo": "UDST/pandana", "score": 0.47050699646286387, "idx": 256240}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/nlp.py#L1017-L1060", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Tokenize data file and turn into token-ids using given vocabulary file.", "language": "python", "parameters": "(\n        data_path, target_path, vocabulary_path, tokenizer=None, normalize_digits=True, UNK_ID=3,\n        _DIGIT_RE=re.compile(br\"\\d\")\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "True", ",", "arg_5", "=", "3", ",", "arg_6", "=", "arg_7", ".", "compile", "(", "br\"\\d\"", ")", ")", ":", "if", "not", "gfile", ".", "Exists", "(", "arg_1", ")", ":", "tl", ".", "logging", ".", "info", "(", "\"Tokenizing data in %s\"", "%", "arg_0", ")", "arg_9", ",", "arg_10", "=", "initialize_vocabulary", "(", "arg_2", ")", "with", "gfile", ".", "GFile", "(", "arg_0", ",", "mode", "=", "\"rb\"", ")", "as", "data_file", ":", "with", "gfile", ".", "GFile", "(", "arg_1", ",", "mode", "=", "\"w\"", ")", "as", "tokens_file", ":", "arg_11", "=", "0", "for", "arg_12", "in", "data_file", ":", "arg_11", "+=", "1", "if", "arg_11", "%", "100000", "==", "0", ":", "tl", ".", "logging", ".", "info", "(", "\"  tokenizing line %d\"", "%", "arg_11", ")", "arg_13", "=", "sentence_to_token_ids", "(", "arg_12", ",", "arg_9", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "tokens_file", ".", "write", "(", "\" \"", ".", "join", "(", "[", "str", "(", "arg_14", ")", "for", "arg_14", "in", "arg_13", "]", ")", "+", "\"\\n\"", ")", "else", ":", "tl", ".", "logging", ".", "info", "(", "\"Target path %s exists\"", "%", "arg_1", ")"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3=None, arg_4=True, arg_5=3,\n        arg_6=arg_7.compile(br\"\\d\")\n):\n    \"\"\"Tokenize data file and turn into token-ids using given vocabulary file.\n\n    This function loads data line-by-line from data_path, calls the above\n    sentence_to_token_ids, and saves the result to target_path. See comment\n    for sentence_to_token_ids on the details of token-ids format.\n\n    Parameters\n    -----------\n    data_path : str\n        Path to the data file in one-sentence-per-line format.\n    target_path : str\n        Path where the file with token-ids will be created.\n    vocabulary_path : str\n        Path to the vocabulary file.\n    tokenizer : function\n        A function to use to tokenize each sentence. If None, ``basic_tokenizer`` will be used.\n    normalize_digits : boolean\n        If true, all digits are replaced by 0.\n\n    References\n    ----------\n    - Code from ``/tensorflow/models/rnn/translation/data_utils.py``\n\n    \"\"\"\n    if not gfile.Exists(arg_1):\n        tl.logging.info(\"Tokenizing data in %s\" % arg_0)\n        arg_9, arg_10 = initialize_vocabulary(arg_2)\n        with gfile.GFile(arg_0, mode=\"rb\") as data_file:\n            with gfile.GFile(arg_1, mode=\"w\") as tokens_file:\n                arg_11 = 0\n                for arg_12 in data_file:\n                    arg_11 += 1\n                    if arg_11 % 100000 == 0:\n                        tl.logging.info(\"  tokenizing line %d\" % arg_11)\n                    arg_13 = sentence_to_token_ids(\n                        arg_12, arg_9, arg_3, arg_4, arg_5=arg_5, arg_6=arg_6\n                    )\n                    tokens_file.write(\" \".join([str(arg_14) for arg_14 in arg_13]) + \"\\n\")\n    else:\n        tl.logging.info(\"Target path %s exists\" % arg_1)", "path": "tensorlayer/nlp.py", "identifier": "data_to_token_ids", "docstring": "Tokenize data file and turn into token-ids using given vocabulary file.\n\n    This function loads data line-by-line from data_path, calls the above\n    sentence_to_token_ids, and saves the result to target_path. See comment\n    for sentence_to_token_ids on the details of token-ids format.\n\n    Parameters\n    -----------\n    data_path : str\n        Path to the data file in one-sentence-per-line format.\n    target_path : str\n        Path where the file with token-ids will be created.\n    vocabulary_path : str\n        Path to the vocabulary file.\n    tokenizer : function\n        A function to use to tokenize each sentence. If None, ``basic_tokenizer`` will be used.\n    normalize_digits : boolean\n        If true, all digits are replaced by 0.\n\n    References\n    ----------\n    - Code from ``/tensorflow/models/rnn/translation/data_utils.py``", "docstring_tokens": ["Tokenize", "data", "file", "and", "turn", "into", "token", "-", "ids", "using", "given", "vocabulary", "file", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 256241}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/config.py#L782-L796", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Add new configuration to self.conf.", "language": "python", "parameters": "(self, new_conf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", "not", "in", "arg_0", ".", "conf", ":", "arg_0", ".", "conf", "[", "arg_2", "]", "=", "arg_1", "[", "arg_2", "]", "else", ":", "for", "arg_4", "in", "arg_1", "[", "arg_2", "]", ":", "arg_0", ".", "conf", "[", "arg_2", "]", "[", "arg_4", "]", "=", "arg_1", "[", "arg_2", "]", "[", "arg_4", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add new configuration to self.conf.\n\n        Adds configuration parameters in new_con to self.conf.\n        If they already existed in conf, overwrite them.\n\n        :param new_conf: new configuration, to add\n        \"\"\"\n\n        for arg_2 in arg_1:\n            if arg_2 not in arg_0.conf:\n                arg_0.conf[arg_2] = arg_1[arg_2]\n            else:\n                for arg_4 in arg_1[arg_2]:\n                    arg_0.conf[arg_2][arg_4] = arg_1[arg_2][arg_4]", "path": "sirmordred/config.py", "identifier": "Config._add_to_conf", "docstring": "Add new configuration to self.conf.\n\n        Adds configuration parameters in new_con to self.conf.\n        If they already existed in conf, overwrite them.\n\n        :param new_conf: new configuration, to add", "docstring_tokens": ["Add", "new", "configuration", "to", "self", ".", "conf", "."], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 256242}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/query.py#L125-L156", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the data encoding the QueryRequestPayload object to a stream.", "language": "python", "parameters": "(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "arg_6", "=", "utils", ".", "BytearrayStream", "(", ")", "if", "arg_0", ".", "_query_functions", ":", "for", "arg_7", "in", "arg_0", ".", "_query_functions", ":", "arg_7", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The Query request payload is missing the query functions \"", "\"field.\"", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "QueryRequestPayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the data encoding the QueryRequestPayload object to a stream.\n\n        Args:\n            output_buffer (Stream): A data stream in which to encode object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidField: Raised if the query functions are not defined.\n        \"\"\"\n        arg_6 = utils.BytearrayStream()\n\n        if arg_0._query_functions:\n            for arg_7 in arg_0._query_functions:\n                arg_7.Func(arg_6, arg_2=arg_2)\n        else:\n            raise exceptions.InvalidField(\n                \"The Query request payload is missing the query functions \"\n                \"field.\"\n            )\n\n        arg_0.length = arg_6.length()\n        super(QueryRequestPayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/messages/payloads/query.py", "identifier": "QueryRequestPayload.write", "docstring": "Write the data encoding the QueryRequestPayload object to a stream.\n\n        Args:\n            output_buffer (Stream): A data stream in which to encode object\n                data, supporting a write method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidField: Raised if the query functions are not defined.", "docstring_tokens": ["Write", "the", "data", "encoding", "the", "QueryRequestPayload", "object", "to", "a", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 256243}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_store.py#L37-L44", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Register the old ID and symbol for a warning that was renamed.", "language": "python", "parameters": "(self, old_id, old_symbol, new_symbol)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_message_definitions", "(", "arg_3", ")", "[", "0", "]", "arg_4", ".", "old_names", ".", "append", "(", "(", "arg_1", ",", "arg_2", ")", ")", "arg_0", ".", "_register_alternative_name", "(", "arg_4", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Register the old ID and symbol for a warning that was renamed.\n\n        This allows users to keep using the old ID/symbol in suppressions.\n        \"\"\"\n        arg_4 = arg_0.get_message_definitions(arg_3)[0]\n        arg_4.old_names.append((arg_1, arg_2))\n        arg_0._register_alternative_name(arg_4, arg_1, arg_2)", "path": "pylint/message/message_store.py", "identifier": "MessagesStore.add_renamed_message", "docstring": "Register the old ID and symbol for a warning that was renamed.\n\n        This allows users to keep using the old ID/symbol in suppressions.", "docstring_tokens": ["Register", "the", "old", "ID", "and", "symbol", "for", "a", "warning", "that", "was", "renamed", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256244}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/apache.py#L519-L555", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Installs the mod-security Apache module.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "if", "arg_1", ".", "env", ".", "modsecurity_enabled", "and", "not", "arg_0", ".", "last_manifest", ".", "modsecurity_enabled", ":", "arg_0", ".", "install_packages", "(", ")", "arg_2", "=", "arg_0", ".", "render_to_file", "(", "'apache/apache_modsecurity.template.conf'", ")", "arg_1", ".", "put", "(", "local_path", "=", "arg_2", ",", "remote_path", "=", "'/etc/modsecurity/modsecurity.conf'", ",", "use_sudo", "=", "True", ")", "arg_1", ".", "env", ".", "modsecurity_download_filename", "=", "'/tmp/owasp-modsecurity-crs.tar.gz'", "arg_1", ".", "sudo", "(", "'cd /tmp; wget --output-document={apache_modsecurity_download_filename} {apache_modsecurity_download_url}'", ")", "arg_1", ".", "env", ".", "modsecurity_download_top", "=", "arg_1", ".", "sudo", "(", "\"cd /tmp; \"", "\"tar tzf %(apache_modsecurity_download_filename)s | sed -e 's@/.*@@' | uniq\"", "%", "arg_0", ".", "genv", ")", "arg_1", ".", "sudo", "(", "'cd /tmp; tar -zxvf %(apache_modsecurity_download_filename)s'", "%", "arg_0", ".", "genv", ")", "arg_1", ".", "sudo", "(", "'cd /tmp; cp -R %(apache_modsecurity_download_top)s/* /etc/modsecurity/'", "%", "arg_0", ".", "genv", ")", "arg_1", ".", "sudo", "(", "'mv /etc/modsecurity/modsecurity_crs_10_setup.conf.example  /etc/modsecurity/modsecurity_crs_10_setup.conf'", ")", "arg_1", ".", "sudo", "(", "'rm -f /etc/modsecurity/activated_rules/*'", ")", "arg_1", ".", "sudo", "(", "'cd /etc/modsecurity/base_rules; '", "'for f in * ; do ln -s /etc/modsecurity/base_rules/$f /etc/modsecurity/activated_rules/$f ; done'", ")", "arg_1", ".", "sudo", "(", "'cd /etc/modsecurity/optional_rules; '", "'for f in * ; do ln -s /etc/modsecurity/optional_rules/$f /etc/modsecurity/activated_rules/$f ; done'", ")", "arg_1", ".", "env", ".", "httpd_conf_append", ".", "append", "(", "'Include \"/etc/modsecurity/activated_rules/*.conf\"'", ")", "arg_0", ".", "enable_mod", "(", "'evasive'", ")", "arg_0", ".", "enable_mod", "(", "'headers'", ")", "elif", "not", "arg_0", ".", "env", ".", "modsecurity_enabled", "and", "arg_0", ".", "last_manifest", ".", "modsecurity_enabled", ":", "arg_0", ".", "disable_mod", "(", "'modsecurity'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Installs the mod-security Apache module.\n\n        https://www.modsecurity.org\n        \"\"\"\n        arg_1 = arg_0.local_renderer\n        if arg_1.env.modsecurity_enabled and not arg_0.last_manifest.modsecurity_enabled:\n\n            arg_0.install_packages()\n\n            # Write modsecurity.conf.\n            arg_2 = arg_0.render_to_file('apache/apache_modsecurity.template.conf')\n            arg_1.put(local_path=arg_2, remote_path='/etc/modsecurity/modsecurity.conf', use_sudo=True)\n\n            # Write OWASP rules.\n            arg_1.env.modsecurity_download_filename = '/tmp/owasp-modsecurity-crs.tar.gz'\n            arg_1.sudo('cd /tmp; wget --output-document={apache_modsecurity_download_filename} {apache_modsecurity_download_url}')\n            arg_1.env.modsecurity_download_top = arg_1.sudo(\n                \"cd /tmp; \"\n                \"tar tzf %(apache_modsecurity_download_filename)s | sed -e 's@/.*@@' | uniq\" % arg_0.genv)\n            arg_1.sudo('cd /tmp; tar -zxvf %(apache_modsecurity_download_filename)s' % arg_0.genv)\n            arg_1.sudo('cd /tmp; cp -R %(apache_modsecurity_download_top)s/* /etc/modsecurity/' % arg_0.genv)\n            arg_1.sudo('mv /etc/modsecurity/modsecurity_crs_10_setup.conf.example  /etc/modsecurity/modsecurity_crs_10_setup.conf')\n\n            arg_1.sudo('rm -f /etc/modsecurity/activated_rules/*')\n            arg_1.sudo('cd /etc/modsecurity/base_rules; '\n                'for f in * ; do ln -s /etc/modsecurity/base_rules/$f /etc/modsecurity/activated_rules/$f ; done')\n            arg_1.sudo('cd /etc/modsecurity/optional_rules; '\n                'for f in * ; do ln -s /etc/modsecurity/optional_rules/$f /etc/modsecurity/activated_rules/$f ; done')\n\n            arg_1.env.httpd_conf_append.append('Include \"/etc/modsecurity/activated_rules/*.conf\"')\n\n            arg_0.enable_mod('evasive')\n            arg_0.enable_mod('headers')\n        elif not arg_0.env.modsecurity_enabled and arg_0.last_manifest.modsecurity_enabled:\n            arg_0.disable_mod('modsecurity')", "path": "burlap/apache.py", "identifier": "ApacheSatchel.configure_modsecurity", "docstring": "Installs the mod-security Apache module.\n\n        https://www.modsecurity.org", "docstring_tokens": ["Installs", "the", "mod", "-", "security", "Apache", "module", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256245}
{"url": "https://github.com/sublee/zeronimo/blob/b216638232932718d2cbc5eabd870c8f5b5e83fb/zeronimo/application.py#L58-L67", "sha": "b216638232932718d2cbc5eabd870c8f5b5e83fb", "docstring_summary": "Marks a method as RPC.", "language": "python", "parameters": "(f=None, **kwargs)", "return_statement": "return functools.partial(_rpc, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "**", "arg_1", ")", ":", "if", "arg_0", "is", "not", "None", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "if", "'name'", "in", "arg_1", ":", "raise", "ValueError", "(", "'name option duplicated'", ")", "arg_1", "[", "'name'", "]", "=", "arg_0", "else", ":", "return", "Func", "(", "**", "arg_1", ")", "(", "arg_0", ")", "return", "functools", ".", "partial", "(", "_Func", ",", "**", "arg_1", ")"], "function": "def Func(arg_0=None, **arg_1):\n    \"\"\"Marks a method as RPC.\"\"\"\n    if arg_0 is not None:\n        if isinstance(arg_0, six.string_types):\n            if 'name' in arg_1:\n                raise ValueError('name option duplicated')\n            arg_1['name'] = arg_0\n        else:\n            return Func(**arg_1)(arg_0)\n    return functools.partial(_Func, **arg_1)", "path": "zeronimo/application.py", "identifier": "rpc", "docstring": "Marks a method as RPC.", "docstring_tokens": ["Marks", "a", "method", "as", "RPC", "."], "nwo": "sublee/zeronimo", "score": 0.08529914490135834, "idx": 256246}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L728-L741", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Returns reviewer as creator object or None if failed.\n        Reports errors on failure.", "language": "python", "parameters": "(self, r_term)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'reviewer'", "]", ",", "None", ")", ")", ")", "if", "len", "(", "arg_2", ")", "!=", "1", ":", "arg_0", ".", "error", "=", "True", "arg_4", "=", "'Review must have exactly one reviewer'", "arg_0", ".", "logger", ".", "log", "(", "arg_4", ")", "return", "try", ":", "return", "arg_0", ".", "builder", ".", "create_entity", "(", "arg_0", ".", "doc", ",", "six", ".", "text_type", "(", "arg_2", "[", "0", "]", "[", "2", "]", ")", ")", "except", "SPDXValueError", ":", "arg_0", ".", "value_error", "(", "'REVIEWER_VALUE'", ",", "arg_2", "[", "0", "]", "[", "2", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns reviewer as creator object or None if failed.\n        Reports errors on failure.\n        \"\"\"\n        arg_2 = list(arg_0.graph.triples((arg_1, arg_0.spdx_namespace['reviewer'], None)))\n        if len(arg_2) != 1:\n            arg_0.error = True\n            arg_4 = 'Review must have exactly one reviewer'\n            arg_0.logger.log(arg_4)\n            return\n        try:\n            return arg_0.builder.create_entity(arg_0.doc, six.text_type(arg_2[0][2]))\n        except SPDXValueError:\n            arg_0.value_error('REVIEWER_VALUE', arg_2[0][2])", "path": "spdx/parsers/rdf.py", "identifier": "ReviewParser.get_reviewer", "docstring": "Returns reviewer as creator object or None if failed.\n        Reports errors on failure.", "docstring_tokens": ["Returns", "reviewer", "as", "creator", "object", "or", "None", "if", "failed", ".", "Reports", "errors", "on", "failure", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 256247}
{"url": "https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/libpath.py#L109-L119", "sha": "3f66a39e15a71b981e8c5f887a4adc3ad486a45f", "docstring_summary": "Try to infer the correct library name.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "\"{}.lib\"", ",", "\"lib{}.lib\"", ",", "\"{}lib.lib\"", "]", "arg_2", "=", "[", "arg_5", ".", "format", "(", "arg_1", ")", "for", "arg_5", "in", "arg_2", "]", "arg_3", "=", "arg_0", ".", "get_library_dirs", "(", ")", "for", "arg_4", "in", "arg_3", ":", "for", "arg_5", "in", "arg_2", ":", "if", "exists", "(", "join", "(", "arg_4", ",", "arg_5", ")", ")", ":", "return", "arg_5", "[", ":", "-", "4", "]", "arg_6", "=", "\"Could not find the {} library.\"", ".", "format", "(", "arg_1", ")", "raise", "ValueError", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Try to infer the correct library name.\"\"\"\n        arg_2 = [\"{}.lib\", \"lib{}.lib\", \"{}lib.lib\"]\n        arg_2 = [arg_5.format(arg_1) for arg_5 in arg_2]\n        arg_3 = arg_0.get_library_dirs()\n        for arg_4 in arg_3:\n            for arg_5 in arg_2:\n                if exists(join(arg_4, arg_5)):\n                    return arg_5[:-4]\n        arg_6 = \"Could not find the {} library.\".format(arg_1)\n        raise ValueError(arg_6)", "path": "libpath.py", "identifier": "Windows.find_libname", "docstring": "Try to infer the correct library name.", "docstring_tokens": ["Try", "to", "infer", "the", "correct", "library", "name", "."], "nwo": "limix/bgen-reader-py", "score": 0.37729991823847475, "idx": 256248}
{"url": "https://github.com/cltrudeau/django-flowr/blob/d077b90376ede33721db55ff29e08b8a16ed17ae/flowr/models.py#L187-L202", "sha": "d077b90376ede33721db55ff29e08b8a16ed17ae", "docstring_summary": "Creates a new ``Node`` based on the extending class and adds it as\n        a child to this ``Node``.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return node", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "graph", ".", "data_content_type", ".", "model_class", "(", ")", "arg_3", "=", "Node", ".", "objects", ".", "create", "(", "graph", "=", "arg_0", ".", "graph", ")", "arg_2", ".", "objects", ".", "create", "(", "arg_3", "=", "arg_3", ",", "**", "arg_1", ")", "arg_3", ".", "parents", ".", "add", "(", "arg_0", ")", "arg_0", ".", "children", ".", "add", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Creates a new ``Node`` based on the extending class and adds it as\n        a child to this ``Node``.\n\n        :param kwargs: \n            arguments for constructing the data object associated with this\n            ``Node``\n        :returns: \n            extender of the ``Node`` class\n        \"\"\"\n        arg_2 = arg_0.graph.data_content_type.model_class()\n        arg_3 = Node.objects.create(graph=arg_0.graph)\n        arg_2.objects.create(arg_3=arg_3, **arg_1)\n        arg_3.parents.add(arg_0)\n        arg_0.children.add(arg_3)\n        return arg_3", "path": "flowr/models.py", "identifier": "Node.add_child", "docstring": "Creates a new ``Node`` based on the extending class and adds it as\n        a child to this ``Node``.\n\n        :param kwargs: \n            arguments for constructing the data object associated with this\n            ``Node``\n        :returns: \n            extender of the ``Node`` class", "docstring_tokens": ["Creates", "a", "new", "Node", "based", "on", "the", "extending", "class", "and", "adds", "it", "as", "a", "child", "to", "this", "Node", "."], "nwo": "cltrudeau/django-flowr", "score": 0.09252797783733271, "idx": 256249}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/style.py#L304-L381", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Visualization of the edges in a network.", "language": "python", "parameters": "(s, edges, alpha=1.0, weighted=False, directed=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ",", "arg_2", "=", "1.0", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", ".", "_ctx", ".", "BezierPath", "(", ")", "if", "arg_4", "and", "arg_0", ".", "stroke", ":", "arg_6", "=", "arg_0", ".", "_ctx", ".", "BezierPath", "(", ")", "if", "arg_3", "and", "arg_0", ".", "fill", ":", "arg_7", "=", "[", "arg_0", ".", "_ctx", ".", "BezierPath", "(", ")", "for", "i", "in", "range", "(", "11", ")", "]", "if", "len", "(", "Func", ")", "==", "0", ":", "return", "for", "arg_8", "in", "Func", ":", "try", ":", "arg_9", "=", "arg_8", ".", "node1", ".", "graph", ".", "styles", "[", "arg_8", ".", "node1", ".", "style", "]", "except", ":", "arg_9", "=", "arg_0", "if", "arg_9", ".", "edge", ":", "arg_9", ".", "edge", "(", "arg_9", ",", "arg_5", ",", "arg_8", ",", "arg_2", ")", "if", "arg_4", "and", "arg_0", ".", "stroke", ":", "arg_9", ".", "edge_arrow", "(", "arg_9", ",", "arg_6", ",", "arg_8", ",", "radius", "=", "10", ")", "if", "arg_3", "and", "arg_0", ".", "fill", ":", "arg_9", ".", "edge", "(", "arg_9", ",", "arg_7", "[", "int", "(", "arg_8", ".", "weight", "*", "10", ")", "]", ",", "arg_8", ",", "arg_2", ")", "arg_0", ".", "_ctx", ".", "autoclosepath", "(", "False", ")", "arg_0", ".", "_ctx", ".", "nofill", "(", ")", "arg_0", ".", "_ctx", ".", "nostroke", "(", ")", "if", "arg_3", "and", "arg_0", ".", "fill", ":", "Func0", "=", "arg_8", ".", "node1", ".", "__class__", "(", "None", ")", ".", "r", "arg_0", ".", "_ctx", ".", "stroke", "(", "arg_0", ".", "fill", ".", "r", ",", "arg_0", ".", "fill", ".", "g", ",", "arg_0", ".", "fill", ".", "b", ",", "arg_0", ".", "fill", ".", "a", "*", "0.65", "*", "arg_2", ")", "for", "Func1", "in", "range", "(", "1", ",", "len", "(", "arg_7", ")", ")", ":", "arg_0", ".", "_ctx", ".", "strokewidth", "(", "Func0", "*", "Func1", "*", "0.1", ")", "arg_0", ".", "_ctx", ".", "drawpath", "(", "arg_7", "[", "Func1", "]", ".", "copy", "(", ")", ")", "if", "arg_0", ".", "stroke", ":", "arg_0", ".", "_ctx", ".", "strokewidth", "(", "arg_0", ".", "strokewidth", ")", "arg_0", ".", "_ctx", ".", "stroke", "(", "arg_0", ".", "stroke", ".", "r", ",", "arg_0", ".", "stroke", ".", "g", ",", "arg_0", ".", "stroke", ".", "b", ",", "arg_0", ".", "stroke", ".", "a", "*", "0.65", "*", "arg_2", ")", "arg_0", ".", "_ctx", ".", "drawpath", "(", "arg_5", ".", "copy", "(", ")", ")", "if", "arg_4", "and", "arg_0", ".", "stroke", ":", "Func2", "=", "arg_0", ".", "_ctx", ".", "color", "(", "arg_0", ".", "stroke", ".", "r", ",", "arg_0", ".", "stroke", ".", "g", ",", "arg_0", ".", "stroke", ".", "b", ",", "arg_0", ".", "stroke", ".", "a", "*", "0.65", "*", "arg_2", ")", "Func2", ".", "a", "*=", "1.3", "arg_0", ".", "_ctx", ".", "stroke", "(", "Func2", ")", "arg_0", ".", "_ctx", ".", "drawpath", "(", "arg_6", ".", "copy", "(", ")", ")", "for", "arg_8", "in", "Func", ":", "try", ":", "arg_9", "=", "self", ".", "styles", "[", "arg_8", ".", "node1", ".", "style", "]", "except", ":", "arg_9", "=", "arg_0", "if", "arg_9", ".", "edge_label", ":", "arg_9", ".", "edge_label", "(", "arg_9", ",", "arg_8", ",", "arg_2", ")"], "function": "def Func(arg_0, Func, arg_2=1.0, arg_3=False, arg_4=False):\n    \n    \"\"\" Visualization of the edges in a network.\n    \"\"\"\n    \n    arg_5 = arg_0._ctx.BezierPath()\n    \n    if arg_4 and arg_0.stroke: \n        arg_6 = arg_0._ctx.BezierPath()           \n    if arg_3 and arg_0.fill: \n        arg_7 = [arg_0._ctx.BezierPath() for i in range(11)]\n    \n    # Draw the edges in a single BezierPath for speed.\n    # Weighted edges are divided into ten BezierPaths,\n    # depending on their weight rounded between 0 and 10.\n    if len(Func) == 0: return\n    for arg_8 in Func:\n        try:  arg_9 = arg_8.node1.graph.styles[arg_8.node1.style]\n        except: arg_9 = arg_0\n        if arg_9.edge:\n            arg_9.edge(arg_9, arg_5, arg_8, arg_2)\n            if arg_4 and arg_0.stroke:\n                arg_9.edge_arrow(arg_9, arg_6, arg_8, radius=10)\n            if arg_3 and arg_0.fill:\n                arg_9.edge(arg_9, arg_7[int(arg_8.weight*10)], arg_8, arg_2)                \n\n    arg_0._ctx.autoclosepath(False)\n    arg_0._ctx.nofill()\n    arg_0._ctx.nostroke()\n\n    \n\n    # All weighted edges use the default fill.\n    if arg_3 and arg_0.fill:\n        Func0 = arg_8.node1.__class__(None).r\n        arg_0._ctx.stroke(\n            arg_0.fill.r,\n            arg_0.fill.g,\n            arg_0.fill.b,\n            arg_0.fill.a * 0.65 * arg_2\n        )\n        for Func1 in range(1, len(arg_7)):\n            arg_0._ctx.strokewidth(Func0*Func1*0.1)\n            arg_0._ctx.drawpath(arg_7[Func1].copy())        \n\n    # All edges use the default stroke.\n    if arg_0.stroke: \n        arg_0._ctx.strokewidth(arg_0.strokewidth)\n\t\n        arg_0._ctx.stroke(\n            arg_0.stroke.r, \n            arg_0.stroke.g, \n            arg_0.stroke.b, \n            arg_0.stroke.a * 0.65 * arg_2\n        )\n    \n    arg_0._ctx.drawpath(arg_5.copy())\n    \n    if arg_4 and arg_0.stroke:\n        #clr = s._ctx.stroke().copy()\n\tFunc2=arg_0._ctx.color(\n            arg_0.stroke.r, \n            arg_0.stroke.g, \n            arg_0.stroke.b, \n            arg_0.stroke.a * 0.65 * arg_2\n        )\n\t\t\n        Func2.a *= 1.3\n        \n\targ_0._ctx.stroke(Func2)\n        \n    \targ_0._ctx.drawpath(arg_6.copy())\n    \n    for arg_8 in Func:\n        try:  arg_9 = self.styles[arg_8.node1.style]\n        except: arg_9 = arg_0\n        if arg_9.edge_label:\n            arg_9.edge_label(arg_9, arg_8, arg_2)", "path": "lib/graph/style.py", "identifier": "edges", "docstring": "Visualization of the edges in a network.", "docstring_tokens": ["Visualization", "of", "the", "edges", "in", "a", "network", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256250}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/opengl/program.py#L177-L184", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Print the shader lines", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "(", "\"---[ START {} ]---\"", ".", "format", "(", "arg_0", ".", "name", ")", ")", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "arg_0", ".", "lines", ")", ":", "Func", "(", "\"{}: {}\"", ".", "format", "(", "str", "(", "arg_1", ")", ".", "zfill", "(", "3", ")", ",", "arg_2", ")", ")", "Func", "(", "\"---[ END {} ]---\"", ".", "format", "(", "arg_0", ".", "name", ")", ")"], "function": "def Func(arg_0):\r\n        \"\"\"Print the shader lines\"\"\"\r\n        Func(\"---[ START {} ]---\".format(arg_0.name))\r\n\r\n        for arg_1, arg_2 in enumerate(arg_0.lines):\r\n            Func(\"{}: {}\".format(str(arg_1).zfill(3), arg_2))\r\n\r\n        Func(\"---[ END {} ]---\".format(arg_0.name))", "path": "demosys/opengl/program.py", "identifier": "ShaderSource.print", "docstring": "Print the shader lines", "docstring_tokens": ["Print", "the", "shader", "lines"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 256251}
{"url": "https://github.com/phfaist/pylatexenc/blob/0c1788d1349e749501e67a6fba54d79e6e0d54f6/pylatexenc/latexencode.py#L53-L117", "sha": "0c1788d1349e749501e67a6fba54d79e6e0d54f6", "docstring_summary": "u\"\"\"\n    Encode a UTF-8 string to a LaTeX snippet.", "language": "python", "parameters": "(s, non_ascii_only=False, brackets=True, substitute_bad_chars=False, fail_bad_chars=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "arg_0", "=", "unicode", "(", "arg_0", ")", "arg_0", "=", "unicodedata", ".", "normalize", "(", "'NFC'", ",", "arg_0", ")", "if", "not", "arg_0", ":", "return", "\"\"", "arg_5", "=", "u\"\"", "for", "arg_6", "in", "arg_0", ":", "if", "(", "arg_1", "and", "ord", "(", "arg_6", ")", "<", "127", ")", ":", "arg_5", "+=", "arg_6", "else", ":", "arg_7", "=", "utf82latex", ".", "get", "(", "ord", "(", "arg_6", ")", ",", "None", ")", "if", "(", "arg_7", "is", "not", "None", ")", ":", "arg_5", "+=", "(", "'{'", "+", "arg_7", "+", "'}'", "if", "arg_2", "and", "arg_7", "[", "0", ":", "1", "]", "==", "'\\\\'", "else", "arg_7", ")", "elif", "(", "(", "ord", "(", "arg_6", ")", ">=", "32", "and", "ord", "(", "arg_6", ")", "<=", "127", ")", "or", "(", "arg_6", "in", "\"\\n\\r\\t\"", ")", ")", ":", "arg_5", "+=", "arg_6", "else", ":", "arg_8", "=", "u\"Character cannot be encoded into LaTeX: U+%04X - `%s'\"", "%", "(", "ord", "(", "arg_6", ")", ",", "arg_6", ")", "if", "arg_4", ":", "raise", "ValueError", "(", "arg_8", ")", "log", ".", "warning", "(", "arg_8", ")", "if", "arg_3", ":", "arg_5", "+=", "r'{\\bfseries ?}'", "else", ":", "arg_5", "+=", "arg_6", "return", "arg_5"], "function": "def Func(arg_0, arg_1=False, arg_2=True, arg_3=False, arg_4=False):\n    u\"\"\"\n    Encode a UTF-8 string to a LaTeX snippet.\n\n    If `non_ascii_only` is set to `True`, then usual (ascii) characters such as ``#``,\n    ``{``, ``}`` etc. will not be escaped.  If set to `False` (the default), they are\n    escaped to their respective LaTeX escape sequences.\n\n    If `brackets` is set to `True` (the default), then LaTeX macros are enclosed in\n    brackets.  For example, ``sant\\N{LATIN SMALL LETTER E WITH ACUTE}`` is replaced by\n    ``sant{\\\\'e}`` if `brackets=True` and by ``sant\\\\'e`` if `brackets=False`.\n\n    .. warning::\n        Using `brackets=False` might give you an invalid LaTeX string, so avoid\n        it! (for instance, ``ma\\N{LATIN SMALL LETTER I WITH CIRCUMFLEX}tre`` will be\n        replaced incorrectly by ``ma\\\\^\\\\itre`` resulting in an unknown macro ``\\\\itre``).\n\n    If `substitute_bad_chars=True`, then any non-ascii character for which no LaTeX escape\n    sequence is known is replaced by a question mark in boldface. Otherwise (by default),\n    the character is left as it is.\n\n    If `fail_bad_chars=True`, then a `ValueError` is raised if we cannot find a\n    character substitution for any non-ascii character.\n\n    .. versionchanged:: 1.3\n\n        Added `fail_bad_chars` switch\n    \"\"\"\n\n    arg_0 = unicode(arg_0) # make sure s is unicode\n    arg_0 = unicodedata.normalize('NFC', arg_0)\n\n    if not arg_0:\n        return \"\"\n\n    arg_5 = u\"\"\n    for arg_6 in arg_0:\n        #log.longdebug(\"Encoding char %r\", ch)\n        if (arg_1 and ord(arg_6) < 127):\n            arg_5 += arg_6\n        else:\n            arg_7 = utf82latex.get(ord(arg_6), None)\n            if (arg_7 is not None):\n                # add brackets if needed, i.e. if we have a substituting macro.\n                # note: in condition, beware, that lch might be of zero length.\n                arg_5 += (  '{'+arg_7+'}' if arg_2 and arg_7[0:1] == '\\\\' else\n                             arg_7  )\n            elif ((ord(arg_6) >= 32 and ord(arg_6) <= 127) or\n                  (arg_6 in \"\\n\\r\\t\")):\n                # ordinary printable ascii char, just add it\n                arg_5 += arg_6\n            else:\n                # non-ascii char\n                arg_8 = u\"Character cannot be encoded into LaTeX: U+%04X - `%s'\" % (ord(arg_6), arg_6)\n                if arg_4:\n                    raise ValueError(arg_8)\n\n                log.warning(arg_8)\n                if arg_3:\n                    arg_5 += r'{\\bfseries ?}'\n                else:\n                    # keep unescaped char\n                    arg_5 += arg_6\n\n    return arg_5", "path": "pylatexenc/latexencode.py", "identifier": "utf8tolatex", "docstring": "u\"\"\"\n    Encode a UTF-8 string to a LaTeX snippet.\n\n    If `non_ascii_only` is set to `True`, then usual (ascii) characters such as ``#``,\n    ``{``, ``}`` etc. will not be escaped.  If set to `False` (the default), they are\n    escaped to their respective LaTeX escape sequences.\n\n    If `brackets` is set to `True` (the default), then LaTeX macros are enclosed in\n    brackets.  For example, ``sant\\N{LATIN SMALL LETTER E WITH ACUTE}`` is replaced by\n    ``sant{\\\\'e}`` if `brackets=True` and by ``sant\\\\'e`` if `brackets=False`.\n\n    .. warning::\n        Using `brackets=False` might give you an invalid LaTeX string, so avoid\n        it! (for instance, ``ma\\N{LATIN SMALL LETTER I WITH CIRCUMFLEX}tre`` will be\n        replaced incorrectly by ``ma\\\\^\\\\itre`` resulting in an unknown macro ``\\\\itre``).\n\n    If `substitute_bad_chars=True`, then any non-ascii character for which no LaTeX escape\n    sequence is known is replaced by a question mark in boldface. Otherwise (by default),\n    the character is left as it is.\n\n    If `fail_bad_chars=True`, then a `ValueError` is raised if we cannot find a\n    character substitution for any non-ascii character.\n\n    .. versionchanged:: 1.3\n\n        Added `fail_bad_chars` switch", "docstring_tokens": ["u", "Encode", "a", "UTF", "-", "8", "string", "to", "a", "LaTeX", "snippet", "."], "nwo": "phfaist/pylatexenc", "score": 0.28469215987838975, "idx": 256252}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/lang/with_any.py#L12-L33", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "wrap `with obj` out of func.", "language": "python", "parameters": "(obj)", "return_statement": "return _wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_wrap", "(", "arg_1", ")", ":", "@", "functools", ".", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "with", "arg_0", ":", "return", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrapper", "return", "_wrap"], "function": "def Func(arg_0):\n    '''\n    wrap `with obj` out of func.\n\n    example:\n\n    ``` py\n    @Func(Lock())\n    def func(): pass\n    ```\n    '''\n\n    def _wrap(arg_1):\n\n        @functools.wraps(arg_1)\n        def wrapper(*arg_2, **arg_3):\n            with arg_0:\n                return arg_1(*arg_2, **arg_3)\n\n        return wrapper\n\n    return _wrap", "path": "jasily/lang/with_any.py", "identifier": "with_it", "docstring": "wrap `with obj` out of func.\n\n    example:\n\n    ``` py\n    @with_it(Lock())\n    def func(): pass\n    ```", "docstring_tokens": ["wrap", "with", "obj", "out", "of", "func", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 256253}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/ext/jprops.py#L260-L273", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Wrap a file to convert newlines regardless of whether the file was opened\n    with the \"universal newlines\" option or not.", "language": "python", "parameters": "(fp)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'U'", "in", "getattr", "(", "arg_0", ",", "'mode'", ",", "''", ")", ":", "for", "arg_1", "in", "arg_0", ":", "yield", "arg_1", "else", ":", "for", "arg_1", "in", "arg_0", ":", "arg_1", "=", "arg_1", ".", "replace", "(", "b'\\r\\n'", ",", "b'\\n'", ")", ".", "replace", "(", "b'\\r'", ",", "b'\\n'", ")", "for", "arg_2", "in", "arg_1", ".", "split", "(", "b'\\n'", ")", ":", "yield", "arg_2"], "function": "def Func(arg_0):\n  \"\"\"\n    Wrap a file to convert newlines regardless of whether the file was opened\n    with the \"universal newlines\" option or not.\n  \"\"\"\n  # if file was opened with universal newline support we don't need to convert\n  if 'U' in getattr(arg_0, 'mode', ''):\n    for arg_1 in arg_0:\n      yield arg_1\n  else:\n    for arg_1 in arg_0:\n      arg_1 = arg_1.replace(b'\\r\\n', b'\\n').replace(b'\\r', b'\\n')\n      for arg_2 in arg_1.split(b'\\n'):\n        yield arg_2", "path": "packages/vaex-core/vaex/ext/jprops.py", "identifier": "_universal_newlines", "docstring": "Wrap a file to convert newlines regardless of whether the file was opened\n    with the \"universal newlines\" option or not.", "docstring_tokens": ["Wrap", "a", "file", "to", "convert", "newlines", "regardless", "of", "whether", "the", "file", "was", "opened", "with", "the", "universal", "newlines", "option", "or", "not", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 256254}
{"url": "https://github.com/grappa-py/grappa/blob/b128da8aef67501c310701c47508e7318241aa8b/grappa/operators/__init__.py#L38-L51", "sha": "b128da8aef67501c310701c47508e7318241aa8b", "docstring_summary": "Loads the built-in operators into the global test engine.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "for", "arg_0", "in", "operators", ":", "arg_1", ",", "arg_2", "=", "arg_0", "[", "0", "]", ",", "arg_0", "[", "1", ":", "]", "arg_3", "=", "'grappa.operators.{}'", ".", "format", "(", "arg_1", ")", "arg_0", "=", "__import__", "(", "arg_3", ",", "None", ",", "None", ",", "arg_2", ")", "for", "arg_4", "in", "arg_2", ":", "Engine", ".", "register", "(", "getattr", "(", "arg_0", ",", "arg_4", ")", ")"], "function": "def Func():\n    \"\"\"\n    Loads the built-in operators into the global test engine.\n    \"\"\"\n    for arg_0 in operators:\n        arg_1, arg_2 = arg_0[0], arg_0[1:]\n        arg_3 = 'grappa.operators.{}'.format(arg_1)\n\n        # Dynamically import modules\n        arg_0 = __import__(arg_3, None, None, arg_2)\n\n        # Register operators in the test engine\n        for arg_4 in arg_2:\n            Engine.register(getattr(arg_0, arg_4))", "path": "grappa/operators/__init__.py", "identifier": "load", "docstring": "Loads the built-in operators into the global test engine.", "docstring_tokens": ["Loads", "the", "built", "-", "in", "operators", "into", "the", "global", "test", "engine", "."], "nwo": "grappa-py/grappa", "score": 0.4496090913237058, "idx": 256255}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster-graphql/dagster_graphql/implementation/pipeline_execution_manager.py#L268-L315", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Execute pipeline using message queue as a transport", "language": "python", "parameters": "(\n    repository_info,\n    pipeline_name,\n    solid_subset,\n    environment_dict,\n    run_id,\n    message_queue,\n    reexecution_config,\n    step_keys_to_execute,\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", ")", ":", "arg_5", ".", "put", "(", "ProcessStartedSentinel", "(", "os", ".", "getpid", "(", ")", ")", ")", "arg_8", "=", "RunConfig", "(", "arg_4", ",", "event_callback", "=", "arg_5", ".", "put", ",", "executor_config", "=", "InProcessExecutorConfig", "(", "raise_on_error", "=", "False", ")", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", ")", "arg_9", "=", "RepositoryContainer", "(", "arg_0", ")", "if", "arg_9", ".", "repo_error", ":", "arg_5", ".", "put", "(", "MultiprocessingError", "(", "serializable_error_info_from_exc_info", "(", "arg_9", ".", "repo_error", ")", ")", ")", "return", "try", ":", "arg_10", "=", "execute_pipeline", "(", "arg_9", ".", "repository", ".", "get_pipeline", "(", "arg_1", ")", ".", "build_sub_pipeline", "(", "arg_2", ")", ",", "arg_3", ",", "arg_8", "=", "arg_8", ",", ")", "return", "arg_10", "except", ":", "arg_11", "=", "serializable_error_info_from_exc_info", "(", "sys", ".", "exc_info", "(", ")", ")", "arg_5", ".", "put", "(", "MultiprocessingError", "(", "arg_11", ")", ")", "finally", ":", "arg_5", ".", "put", "(", "MultiprocessingDone", "(", ")", ")", "arg_5", ".", "close", "(", ")"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2,\n    arg_3,\n    arg_4,\n    arg_5,\n    arg_6,\n    arg_7,\n):\n    \"\"\"\n    Execute pipeline using message queue as a transport\n    \"\"\"\n\n    arg_5.put(ProcessStartedSentinel(os.getpid()))\n\n    arg_8 = RunConfig(\n        arg_4,\n        event_callback=arg_5.put,\n        executor_config=InProcessExecutorConfig(raise_on_error=False),\n        arg_6=arg_6,\n        arg_7=arg_7,\n    )\n\n    arg_9 = RepositoryContainer(arg_0)\n    if arg_9.repo_error:\n        arg_5.put(\n            MultiprocessingError(\n                serializable_error_info_from_exc_info(arg_9.repo_error)\n            )\n        )\n        return\n\n    try:\n        arg_10 = execute_pipeline(\n            arg_9.repository.get_pipeline(arg_1).build_sub_pipeline(\n                arg_2\n            ),\n            arg_3,\n            arg_8=arg_8,\n        )\n        return arg_10\n    except:  # pylint: disable=W0702\n        arg_11 = serializable_error_info_from_exc_info(sys.exc_info())\n        arg_5.put(MultiprocessingError(arg_11))\n    finally:\n        arg_5.put(MultiprocessingDone())\n        arg_5.close()", "path": "python_modules/dagster-graphql/dagster_graphql/implementation/pipeline_execution_manager.py", "identifier": "execute_pipeline_through_queue", "docstring": "Execute pipeline using message queue as a transport", "docstring_tokens": ["Execute", "pipeline", "using", "message", "queue", "as", "a", "transport"], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 256256}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/triple.py#L47-L119", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''This function handles the retrieval of a chemical's triple temperature.\n    Lookup is based on CASRNs. Will automatically select a data source to use\n    if no Method is provided; returns None if the data is not available.", "language": "python", "parameters": "(CASRN, AvailableMethods=False, Method=None)", "return_statement": "return Tt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "def", "list_methods", "(", ")", ":", "arg_3", "=", "[", "]", "if", "arg_0", "in", "Staveley_data", ".", "index", ":", "arg_3", ".", "append", "(", "STAVELEY", ")", "if", "Tm", "(", "arg_0", ")", ":", "arg_3", ".", "append", "(", "MELTING", ")", "arg_3", ".", "append", "(", "NONE", ")", "return", "arg_3", "if", "arg_1", ":", "return", "list_methods", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_2", "==", "STAVELEY", ":", "Func", "=", "Staveley_data", ".", "at", "[", "arg_0", ",", "\"Tt68\"", "]", "elif", "arg_2", "==", "MELTING", ":", "Func", "=", "Tm", "(", "arg_0", ")", "elif", "arg_2", "==", "NONE", ":", "Func", "=", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")", "return", "Func"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n    r'''This function handles the retrieval of a chemical's triple temperature.\n    Lookup is based on CASRNs. Will automatically select a data source to use\n    if no Method is provided; returns None if the data is not available.\n\n    Returns data from [1]_, or a chemical's melting point if available.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    Tt : float\n        Triple point temperature, [K]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain Tt with the\n        given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        Tt_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        the Tt for the desired chemical, and will return methods\n        instead of the Tt\n\n    Notes\n    -----\n    Median difference between melting points and triple points is 0.02 K.\n    Accordingly, this should be more than good enough for engineering\n    applications.\n\n    Temperatures are on the ITS-68 scale.\n\n    Examples\n    --------\n    Ammonia\n\n    >>> Tt('7664-41-7')\n    195.47999999999999\n\n    References\n    ----------\n    .. [1] Staveley, L. A. K., L. Q. Lobo, and J. C. G. Calado. \"Triple-Points\n       of Low Melting Substances and Their Use in Cryogenic Work.\" Cryogenics\n       21, no. 3 (March 1981): 131-144. doi:10.1016/0011-2275(81)90264-2.\n    '''\n    def list_methods():\n        arg_3 = []\n        if arg_0 in Staveley_data.index:\n            arg_3.append(STAVELEY)\n        if Tm(arg_0):\n            arg_3.append(MELTING)\n        arg_3.append(NONE)\n        return arg_3\n    if arg_1:\n        return list_methods()\n    if not arg_2:\n        arg_2 = list_methods()[0]\n\n    if arg_2 == STAVELEY:\n        Func = Staveley_data.at[arg_0, \"Tt68\"]\n    elif arg_2 == MELTING:\n        Func = Tm(arg_0)\n    elif arg_2 == NONE:\n        Func = None\n    else:\n        raise Exception('Failure in in function')\n    return Func", "path": "thermo/triple.py", "identifier": "Tt", "docstring": "r'''This function handles the retrieval of a chemical's triple temperature.\n    Lookup is based on CASRNs. Will automatically select a data source to use\n    if no Method is provided; returns None if the data is not available.\n\n    Returns data from [1]_, or a chemical's melting point if available.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    Tt : float\n        Triple point temperature, [K]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain Tt with the\n        given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        Tt_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        the Tt for the desired chemical, and will return methods\n        instead of the Tt\n\n    Notes\n    -----\n    Median difference between melting points and triple points is 0.02 K.\n    Accordingly, this should be more than good enough for engineering\n    applications.\n\n    Temperatures are on the ITS-68 scale.\n\n    Examples\n    --------\n    Ammonia\n\n    >>> Tt('7664-41-7')\n    195.47999999999999\n\n    References\n    ----------\n    .. [1] Staveley, L. A. K., L. Q. Lobo, and J. C. G. Calado. \"Triple-Points\n       of Low Melting Substances and Their Use in Cryogenic Work.\" Cryogenics\n       21, no. 3 (March 1981): 131-144. doi:10.1016/0011-2275(81)90264-2.", "docstring_tokens": ["r", "This", "function", "handles", "the", "retrieval", "of", "a", "chemical", "s", "triple", "temperature", ".", "Lookup", "is", "based", "on", "CASRNs", ".", "Will", "automatically", "select", "a", "data", "source", "to", "use", "if", "no", "Method", "is", "provided", ";", "returns", "None", "if", "the", "data", "is", "not", "available", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256257}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/lms.py#L99-L111", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Use this method decorator to ensure the JWT token is refreshed when needed.", "language": "python", "parameters": "(func)", "return_statement": "return inner", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "inner", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_1", ".", "token_expired", "(", ")", ":", "arg_1", ".", "connect", "(", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "inner"], "function": "def Func(arg_0):\n        \"\"\"\n        Use this method decorator to ensure the JWT token is refreshed when needed.\n        \"\"\"\n        @wraps(arg_0)\n        def inner(arg_1, *arg_2, **arg_3):\n            \"\"\"\n            Before calling the wrapped function, we check if the JWT token is expired, and if so, re-connect.\n            \"\"\"\n            if arg_1.token_expired():\n                arg_1.connect()\n            return arg_0(arg_1, *arg_2, **arg_3)\n        return inner", "path": "enterprise/api_client/lms.py", "identifier": "JwtLmsApiClient.refresh_token", "docstring": "Use this method decorator to ensure the JWT token is refreshed when needed.", "docstring_tokens": ["Use", "this", "method", "decorator", "to", "ensure", "the", "JWT", "token", "is", "refreshed", "when", "needed", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256258}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/glnames.py#L5238-L5479", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "main program body", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "!=", "2", ":", "print", "__doc__", "%", "sys", ".", "argv", "[", "0", "]", "sys", ".", "exit", "(", "1", ")", "arg_0", "=", "open", "(", "sys", ".", "argv", "[", "1", "]", ",", "\"w\\n\"", ")", "arg_1", "=", "arg_0", ".", "write", "arg_2", "=", "len", "(", "sid_standard_names", ")", "arg_3", "=", "filter_glyph_names", "(", "mac_standard_names", ",", "sid_standard_names", ")", "arg_4", "=", "len", "(", "arg_3", ")", "arg_5", "=", "arg_3", "+", "sid_standard_names", "arg_1", "(", "\"/***************************************************************************/\\n\"", ")", "arg_1", "(", "\"/*                                                                         */\\n\"", ")", "arg_1", "(", "\"/*  %-71s*/\\n\"", "%", "os", ".", "path", ".", "basename", "(", "sys", ".", "argv", "[", "1", "]", ")", ")", "arg_1", "(", "\"/*                                                                         */\\n\"", ")", "arg_1", "(", "\"/*    PostScript glyph names.                                              */\\n\"", ")", "arg_1", "(", "\"/*                                                                         */\\n\"", ")", "arg_1", "(", "\"/*  Copyright 2005, 2008, 2011 by                                          */\\n\"", ")", "arg_1", "(", "\"/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\\n\"", ")", "arg_1", "(", "\"/*                                                                         */\\n\"", ")", "arg_1", "(", "\"/*  This file is part of the FreeType project, and may only be used,       */\\n\"", ")", "arg_1", "(", "\"/*  modified, and distributed under the terms of the FreeType project      */\\n\"", ")", "arg_1", "(", "\"/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\\n\"", ")", "arg_1", "(", "\"/*  this file you indicate that you have read the license and              */\\n\"", ")", "arg_1", "(", "\"/*  understand and accept it fully.                                        */\\n\"", ")", "arg_1", "(", "\"/*                                                                         */\\n\"", ")", "arg_1", "(", "\"/***************************************************************************/\\n\"", ")", "arg_1", "(", "\"\\n\"", ")", "arg_1", "(", "\"\\n\"", ")", "arg_1", "(", "\"  /* This file has been generated automatically -- do not edit! */\\n\"", ")", "arg_1", "(", "\"\\n\"", ")", "arg_1", "(", "\"\\n\"", ")", "arg_6", "=", "StringTable", "(", "arg_5", ",", "\"ft_standard_glyph_names\"", ")", "arg_6", ".", "dump", "(", "arg_0", ")", "arg_6", ".", "dump_sublist", "(", "arg_0", ",", "\"ft_mac_names\"", ",", "\"FT_NUM_MAC_NAMES\"", ",", "mac_standard_names", ")", "arg_6", ".", "dump_sublist", "(", "arg_0", ",", "\"ft_sid_names\"", ",", "\"FT_NUM_SID_NAMES\"", ",", "sid_standard_names", ")", "dump_encoding", "(", "arg_0", ",", "\"t1_standard_encoding\"", ",", "t1_standard_encoding", ")", "dump_encoding", "(", "arg_0", ",", "\"t1_expert_encoding\"", ",", "t1_expert_encoding", ")", "arg_7", ",", "arg_8", "=", "adobe_glyph_values", "(", ")", "arg_9", "=", "StringNode", "(", "\"\"", ",", "0", ")", "for", "arg_10", "in", "range", "(", "len", "(", "arg_7", ")", ")", ":", "arg_9", ".", "add", "(", "arg_7", "[", "arg_10", "]", ",", "eval", "(", "\"0x\"", "+", "arg_8", "[", "arg_10", "]", ")", ")", "arg_9", "=", "arg_9", ".", "optimize", "(", ")", "arg_11", "=", "arg_9", ".", "locate", "(", "0", ")", "arg_12", "=", "arg_9", ".", "store", "(", "\"\"", ")", "arg_1", "(", "\"\"\"\\  /*   *  This table is a compressed version of the Adobe Glyph List (AGL),   *  optimized for efficient searching.  It has been generated by the   *  `glnames.py' python script located in the `src/tools' directory.   *   *  The lookup function to get the Unicode value for a given string   *  is defined below the table.   */#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\"\"\"", ")", "dump_array", "(", "arg_12", ",", "arg_1", ",", "\"ft_adobe_glyph_list\"", ")", "arg_1", "(", "\"\"\"\\  /*   *  This function searches the compressed table efficiently.   */  static unsigned long  ft_get_adobe_glyph_index( const char*  name,                            const char*  limit )  {    int                   c = 0;    int                   count, min, max;    const unsigned char*  p = ft_adobe_glyph_list;    if ( name == 0 || name >= limit )      goto NotFound;    c     = *name++;    count = p[1];    p    += 2;    min = 0;    max = count;    while ( min < max )    {      int                   mid = ( min + max ) >> 1;      const unsigned char*  q   = p + mid * 2;      int                   c2;      q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] );      c2 = q[0] & 127;      if ( c2 == c )      {        p = q;        goto Found;      }      if ( c2 < c )        min = mid + 1;      else        max = mid;    }    goto NotFound;  Found:    for (;;)    {      /* assert (*p & 127) == c */      if ( name >= limit )      {        if ( (p[0] & 128) == 0 &&             (p[1] & 128) != 0 )          return (unsigned long)( ( (int)p[2] << 8 ) | p[3] );        goto NotFound;      }      c = *name++;      if ( p[0] & 128 )      {        p++;        if ( c != (p[0] & 127) )          goto NotFound;        continue;      }      p++;      count = p[0] & 127;      if ( p[0] & 128 )        p += 2;      p++;      for ( ; count > 0; count--, p += 2 )      {        int                   offset = ( (int)p[0] << 8 ) | p[1];        const unsigned char*  q      = ft_adobe_glyph_list + offset;        if ( c == ( q[0] & 127 ) )        {          p = q;          goto NextIter;        }      }      goto NotFound;    NextIter:      ;    }  NotFound:    return 0;  }#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\"\"\"", ")", "if", "0", ":", "arg_1", "(", "\"#ifdef TEST\\n\\n\"", ")", "arg_1", "(", "\"static const char* const  the_names[] = {\\n\"", ")", "for", "arg_13", "in", "arg_7", ":", "arg_1", "(", "'  \"'", "+", "arg_13", "+", "'\",\\n'", ")", "arg_1", "(", "\"  0\\n};\\n\"", ")", "arg_1", "(", "\"static const unsigned long  the_values[] = {\\n\"", ")", "for", "arg_14", "in", "arg_8", ":", "arg_1", "(", "'  0x'", "+", "arg_14", "+", "',\\n'", ")", "arg_1", "(", "\"  0\\n};\\n\"", ")", "arg_1", "(", "\"\"\"#include <stdlib.h>#include <stdio.h>  int  Func( void )  {    int                   result = 0;    const char* const*    names  = the_names;    const unsigned long*  values = the_values;    for ( ; *names; names++, values++ )    {      const char*    name      = *names;      unsigned long  reference = *values;      unsigned long  value;      value = ft_get_adobe_glyph_index( name, name + strlen( name ) );      if ( value != reference )      {        result = 1;        fprintf( stderr, \"name '%s' => %04x instead of %04x\\\\n\",                         name, value, reference );      }    }    return result;  }\"\"\"", ")", "arg_1", "(", "\"#endif /* TEST */\\n\"", ")", "arg_1", "(", "\"\\n/* END */\\n\"", ")"], "function": "def Func():\n  \"\"\"Func program body\"\"\"\n\n  if len( sys.argv ) != 2:\n    print __doc__ % sys.argv[0]\n    sys.exit( 1 )\n\n  arg_0  = open( sys.argv[1], \"w\\n\" )\n  arg_1 = arg_0.write\n\n  arg_2 = len( sid_standard_names )\n\n  # `mac_extras' contains the list of glyph names in the Macintosh standard\n  # encoding which are not in the SID Standard Names.\n  #\n  arg_3 = filter_glyph_names( mac_standard_names, sid_standard_names )\n\n  # `base_list' contains the names of our final glyph names table.\n  # It consists of the `mac_extras' glyph names, followed by the SID\n  # standard names.\n  #\n  arg_4 = len( arg_3 )\n  arg_5        = arg_3 + sid_standard_names\n\n  arg_1( \"/***************************************************************************/\\n\" )\n  arg_1( \"/*                                                                         */\\n\" )\n\n  arg_1( \"/*  %-71s*/\\n\" % os.path.basename( sys.argv[1] ) )\n\n  arg_1( \"/*                                                                         */\\n\" )\n  arg_1( \"/*    PostScript glyph names.                                              */\\n\" )\n  arg_1( \"/*                                                                         */\\n\" )\n  arg_1( \"/*  Copyright 2005, 2008, 2011 by                                          */\\n\" )\n  arg_1( \"/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\\n\" )\n  arg_1( \"/*                                                                         */\\n\" )\n  arg_1( \"/*  This file is part of the FreeType project, and may only be used,       */\\n\" )\n  arg_1( \"/*  modified, and distributed under the terms of the FreeType project      */\\n\" )\n  arg_1( \"/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\\n\" )\n  arg_1( \"/*  this file you indicate that you have read the license and              */\\n\" )\n  arg_1( \"/*  understand and accept it fully.                                        */\\n\" )\n  arg_1( \"/*                                                                         */\\n\" )\n  arg_1( \"/***************************************************************************/\\n\" )\n  arg_1( \"\\n\" )\n  arg_1( \"\\n\" )\n  arg_1( \"  /* This file has been generated automatically -- do not edit! */\\n\" )\n  arg_1( \"\\n\" )\n  arg_1( \"\\n\" )\n\n  # dump final glyph list (mac extras + sid standard names)\n  #\n  arg_6 = StringTable( arg_5, \"ft_standard_glyph_names\" )\n\n  arg_6.dump( arg_0 )\n  arg_6.dump_sublist( arg_0, \"ft_mac_names\",\n                   \"FT_NUM_MAC_NAMES\", mac_standard_names )\n  arg_6.dump_sublist( arg_0, \"ft_sid_names\",\n                   \"FT_NUM_SID_NAMES\", sid_standard_names )\n\n  dump_encoding( arg_0, \"t1_standard_encoding\", t1_standard_encoding )\n  dump_encoding( arg_0, \"t1_expert_encoding\", t1_expert_encoding )\n\n  # dump the AGL in its compressed form\n  #\n  arg_7, arg_8 = adobe_glyph_values()\n  arg_9 = StringNode( \"\", 0 )\n\n  for arg_10 in range( len( arg_7 ) ):\n    arg_9.add( arg_7[arg_10], eval( \"0x\" + arg_8[arg_10] ) )\n\n  arg_9       = arg_9.optimize()\n  arg_11   = arg_9.locate( 0 )\n  arg_12 = arg_9.store( \"\" )\n\n  arg_1( \"\"\"\\\n  /*\n   *  This table is a compressed version of the Adobe Glyph List (AGL),\n   *  optimized for efficient searching.  It has been generated by the\n   *  `glnames.py' python script located in the `src/tools' directory.\n   *\n   *  The lookup function to get the Unicode value for a given string\n   *  is defined below the table.\n   */\n\n#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n\n\"\"\" )\n\n  dump_array( arg_12, arg_1, \"ft_adobe_glyph_list\" )\n\n  # write the lookup routine now\n  #\n  arg_1( \"\"\"\\\n  /*\n   *  This function searches the compressed table efficiently.\n   */\n  static unsigned long\n  ft_get_adobe_glyph_index( const char*  name,\n                            const char*  limit )\n  {\n    int                   c = 0;\n    int                   count, min, max;\n    const unsigned char*  p = ft_adobe_glyph_list;\n\n\n    if ( name == 0 || name >= limit )\n      goto NotFound;\n\n    c     = *name++;\n    count = p[1];\n    p    += 2;\n\n    min = 0;\n    max = count;\n\n    while ( min < max )\n    {\n      int                   mid = ( min + max ) >> 1;\n      const unsigned char*  q   = p + mid * 2;\n      int                   c2;\n\n\n      q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] );\n\n      c2 = q[0] & 127;\n      if ( c2 == c )\n      {\n        p = q;\n        goto Found;\n      }\n      if ( c2 < c )\n        min = mid + 1;\n      else\n        max = mid;\n    }\n    goto NotFound;\n\n  Found:\n    for (;;)\n    {\n      /* assert (*p & 127) == c */\n\n      if ( name >= limit )\n      {\n        if ( (p[0] & 128) == 0 &&\n             (p[1] & 128) != 0 )\n          return (unsigned long)( ( (int)p[2] << 8 ) | p[3] );\n\n        goto NotFound;\n      }\n      c = *name++;\n      if ( p[0] & 128 )\n      {\n        p++;\n        if ( c != (p[0] & 127) )\n          goto NotFound;\n\n        continue;\n      }\n\n      p++;\n      count = p[0] & 127;\n      if ( p[0] & 128 )\n        p += 2;\n\n      p++;\n\n      for ( ; count > 0; count--, p += 2 )\n      {\n        int                   offset = ( (int)p[0] << 8 ) | p[1];\n        const unsigned char*  q      = ft_adobe_glyph_list + offset;\n\n        if ( c == ( q[0] & 127 ) )\n        {\n          p = q;\n          goto NextIter;\n        }\n      }\n      goto NotFound;\n\n    NextIter:\n      ;\n    }\n\n  NotFound:\n    return 0;\n  }\n\n#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n\n\"\"\" )\n\n  if 0:  # generate unit test, or don't\n    #\n    # now write the unit test to check that everything works OK\n    #\n    arg_1( \"#ifdef TEST\\n\\n\" )\n\n    arg_1( \"static const char* const  the_names[] = {\\n\" )\n    for arg_13 in arg_7:\n      arg_1( '  \"' + arg_13 + '\",\\n' )\n    arg_1( \"  0\\n};\\n\" )\n\n    arg_1( \"static const unsigned long  the_values[] = {\\n\" )\n    for arg_14 in arg_8:\n      arg_1( '  0x' + arg_14 + ',\\n' )\n    arg_1( \"  0\\n};\\n\" )\n\n    arg_1( \"\"\"\n#include <stdlib.h>\n#include <stdio.h>\n\n  int\n  Func( void )\n  {\n    int                   result = 0;\n    const char* const*    names  = the_names;\n    const unsigned long*  values = the_values;\n\n\n    for ( ; *names; names++, values++ )\n    {\n      const char*    name      = *names;\n      unsigned long  reference = *values;\n      unsigned long  value;\n\n\n      value = ft_get_adobe_glyph_index( name, name + strlen( name ) );\n      if ( value != reference )\n      {\n        result = 1;\n        fprintf( stderr, \"name '%s' => %04x instead of %04x\\\\n\",\n                         name, value, reference );\n      }\n    }\n\n    return result;\n  }\n\"\"\" )\n\n    arg_1( \"#endif /* TEST */\\n\" )\n\n  arg_1(\"\\n/* END */\\n\")", "path": "native/Vendor/FreeType/src/tools/glnames.py", "identifier": "main", "docstring": "main program body", "docstring_tokens": ["main", "program", "body"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 256259}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/clinvar.py#L133-L154", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Create the lines to include in a Clinvar submission csv file from a list of submission objects and a custom document header", "language": "python", "parameters": "(submission_objs, submission_header)", "return_statement": "return submission_lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_5", "in", "arg_3", ":", "arg_4", ".", "append", "(", "'\"'", "+", "arg_3", ".", "get", "(", "arg_5", ")", "+", "'\"'", ")", "else", ":", "arg_4", ".", "append", "(", "'\"\"'", ")", "arg_2", ".", "append", "(", "','", ".", "join", "(", "arg_4", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Create the lines to include in a Clinvar submission csv file from a list of submission objects and a custom document header\n\n        Args:\n            submission_objs(list): a list of objects (variants or casedata) to include in a csv file\n            submission_header(dict) : as in constants CLINVAR_HEADER and CASEDATA_HEADER, but with required fields only\n\n        Returns:\n            submission_lines(list) a list of strings, each string represents a line of the clinvar csv file to be doenloaded\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_0: # Loop over the submission objects. Each of these is a line\n        arg_4 = []\n        for arg_5, arg_6 in arg_1.items(): # header_keys are the same keys as in submission_objs\n            if arg_5 in arg_3: # The field is filled in for this variant/casedata object\n                arg_4.append('\"'+arg_3.get(arg_5)+'\"')\n            else: # Empty field for this this variant/casedata object\n                arg_4.append('\"\"')\n\n        arg_2.append(','.join(arg_4))\n\n    return arg_2", "path": "scout/parse/clinvar.py", "identifier": "clinvar_submission_lines", "docstring": "Create the lines to include in a Clinvar submission csv file from a list of submission objects and a custom document header\n\n        Args:\n            submission_objs(list): a list of objects (variants or casedata) to include in a csv file\n            submission_header(dict) : as in constants CLINVAR_HEADER and CASEDATA_HEADER, but with required fields only\n\n        Returns:\n            submission_lines(list) a list of strings, each string represents a line of the clinvar csv file to be doenloaded", "docstring_tokens": ["Create", "the", "lines", "to", "include", "in", "a", "Clinvar", "submission", "csv", "file", "from", "a", "list", "of", "submission", "objects", "and", "a", "custom", "document", "header"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256260}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/cov/_free.py#L113-L135", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Eigen decomposition of K.", "language": "python", "parameters": "(self)", "return_statement": "return self._cache[\"eig\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "numpy", ".", "linalg", "import", "svd", "if", "arg_0", ".", "_cache", "[", "\"eig\"", "]", "is", "not", "None", ":", "return", "arg_0", ".", "_cache", "[", "\"eig\"", "]", "arg_1", ",", "arg_2", "=", "svd", "(", "arg_0", ".", "L", ")", "[", ":", "2", "]", "arg_2", "*=", "arg_2", "arg_2", "+=", "arg_0", ".", "_epsilon", "arg_0", ".", "_cache", "[", "\"eig\"", "]", "=", "arg_2", ",", "arg_1", "return", "arg_0", ".", "_cache", "[", "\"eig\"", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Eigen decomposition of K.\n\n        Returns\n        -------\n        S : ndarray\n            The eigenvalues in ascending order, each repeated according to its\n            multiplicity.\n        U : ndarray\n            Normalized eigenvectors.\n        \"\"\"\n        from numpy.linalg import svd\n\n        if arg_0._cache[\"eig\"] is not None:\n            return arg_0._cache[\"eig\"]\n\n        arg_1, arg_2 = svd(arg_0.L)[:2]\n        arg_2 *= arg_2\n        arg_2 += arg_0._epsilon\n        arg_0._cache[\"eig\"] = arg_2, arg_1\n\n        return arg_0._cache[\"eig\"]", "path": "glimix_core/cov/_free.py", "identifier": "FreeFormCov.eigh", "docstring": "Eigen decomposition of K.\n\n        Returns\n        -------\n        S : ndarray\n            The eigenvalues in ascending order, each repeated according to its\n            multiplicity.\n        U : ndarray\n            Normalized eigenvectors.", "docstring_tokens": ["Eigen", "decomposition", "of", "K", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 256261}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L123-L202", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Pre-process an SV variant entry for detail page.", "language": "python", "parameters": "(store, institute_id, case_name, variant_id=None, variant_obj=None, add_case=True,\n               get_overlapping=True)", "return_statement": "return {\n        'institute': institute_obj,\n        'case': case_obj,\n        'variant': variant_obj,\n        'overlapping_snvs': overlapping_snvs,\n        'manual_rank_options': MANUAL_RANK_OPTIONS,\n        'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "True", ",", "arg_6", "=", "True", ")", ":", "arg_7", ",", "arg_8", "=", "institute_and_case", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "if", "not", "arg_4", ":", "arg_4", "=", "arg_0", ".", "variant", "(", "arg_3", ")", "if", "arg_5", ":", "variant_case", "(", "arg_0", ",", "arg_8", ",", "arg_4", ")", "arg_4", "[", "'frequencies'", "]", "=", "[", "(", "'1000G'", ",", "arg_4", ".", "get", "(", "'thousand_genomes_frequency'", ")", ")", ",", "(", "'1000G (left)'", ",", "arg_4", ".", "get", "(", "'thousand_genomes_frequency_left'", ")", ")", ",", "(", "'1000G (right)'", ",", "arg_4", ".", "get", "(", "'thousand_genomes_frequency_right'", ")", ")", ",", "(", "'ClinGen CGH (benign)'", ",", "arg_4", ".", "get", "(", "'clingen_cgh_benign'", ")", ")", ",", "(", "'ClinGen CGH (pathogenic)'", ",", "arg_4", ".", "get", "(", "'clingen_cgh_pathogenic'", ")", ")", ",", "(", "'ClinGen NGI'", ",", "arg_4", ".", "get", "(", "'clingen_ngi'", ")", ")", ",", "(", "'SweGen'", ",", "arg_4", ".", "get", "(", "'swegen'", ")", ")", ",", "(", "'Decipher'", ",", "arg_4", ".", "get", "(", "'decipher'", ")", ")", ",", "]", "arg_4", "[", "'callers'", "]", "=", "callers", "(", "arg_4", ",", "category", "=", "'sv'", ")", "arg_9", "=", "[", "]", "if", "arg_6", ":", "arg_9", "=", "(", "parse_variant", "(", "arg_0", ",", "arg_7", ",", "arg_8", ",", "variant", ")", "for", "variant", "in", "arg_0", ".", "overlapping", "(", "arg_4", ")", ")", "for", "arg_10", "in", "arg_4", "[", "'genes'", "]", ":", "if", "arg_10", ".", "get", "(", "'common'", ")", ":", "arg_11", "=", "arg_10", "[", "'common'", "]", "[", "'ensembl_id'", "]", "try", ":", "arg_12", "=", "int", "(", "arg_10", "[", "'common'", "]", ".", "get", "(", "'build'", ",", "'37'", ")", ")", "except", "Exception", ":", "arg_12", "=", "37", "arg_10", "[", "'ensembl_link'", "]", "=", "ensembl", "(", "arg_11", ",", "arg_12", "=", "arg_12", ")", "arg_4", "[", "'comments'", "]", "=", "arg_0", ".", "events", "(", "arg_7", ",", "case", "=", "arg_8", ",", "arg_3", "=", "arg_4", "[", "'variant_id'", "]", ",", "comments", "=", "True", ")", "arg_13", "=", "arg_0", ".", "case_to_clinVars", "(", "arg_8", ".", "get", "(", "'display_name'", ")", ")", "if", "arg_3", "in", "arg_13", ":", "arg_4", "[", "'clinvar_clinsig'", "]", "=", "arg_13", ".", "get", "(", "arg_3", ")", "[", "'clinsig'", "]", "if", "not", "'end_chrom'", "in", "arg_4", ":", "arg_4", "[", "'end_chrom'", "]", "=", "arg_4", "[", "'chromosome'", "]", "return", "{", "'institute'", ":", "arg_7", ",", "'case'", ":", "arg_8", ",", "'variant'", ":", "arg_4", ",", "'overlapping_snvs'", ":", "arg_9", ",", "'manual_rank_options'", ":", "MANUAL_RANK_OPTIONS", ",", "'dismiss_variant_options'", ":", "DISMISS_VARIANT_OPTIONS", "}"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=True,\n               arg_6=True):\n    \"\"\"Pre-process an SV variant entry for detail page.\n\n    Adds information to display variant\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        institute_id(str)\n        case_name(str)\n        variant_id(str)\n        variant_obj(dcit)\n        add_case(bool): If information about case files should be added\n\n    Returns:\n        detailed_information(dict): {\n            'institute': <institute_obj>,\n            'case': <case_obj>,\n            'variant': <variant_obj>,\n            'overlapping_snvs': <overlapping_snvs>,\n            'manual_rank_options': MANUAL_RANK_OPTIONS,\n            'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n        }\n    \"\"\"\n    arg_7, arg_8 = institute_and_case(arg_0, arg_1, arg_2)\n\n    if not arg_4:\n        arg_4 = arg_0.variant(arg_3)\n\n    if arg_5:\n        # fill in information for pilup view\n        variant_case(arg_0, arg_8, arg_4)\n\n    # frequencies\n    arg_4['frequencies'] = [\n        ('1000G', arg_4.get('thousand_genomes_frequency')),\n        ('1000G (left)', arg_4.get('thousand_genomes_frequency_left')),\n        ('1000G (right)', arg_4.get('thousand_genomes_frequency_right')),\n        ('ClinGen CGH (benign)', arg_4.get('clingen_cgh_benign')),\n        ('ClinGen CGH (pathogenic)', arg_4.get('clingen_cgh_pathogenic')),\n        ('ClinGen NGI', arg_4.get('clingen_ngi')),\n        ('SweGen', arg_4.get('swegen')),\n        ('Decipher', arg_4.get('decipher')),\n    ]\n\n    arg_4['callers'] = callers(arg_4, category='sv')\n\n    arg_9 = []\n    if arg_6:\n        arg_9 = (parse_variant(arg_0, arg_7, arg_8, variant) for variant in\n                            arg_0.overlapping(arg_4))\n\n    # parse_gene function is not called for SVs, but a link to ensembl gene is required\n    for arg_10 in arg_4['genes']:\n        if arg_10.get('common'):\n            arg_11 = arg_10['common']['ensembl_id']\n            try:\n                arg_12 = int(arg_10['common'].get('build','37'))\n            except Exception:\n                arg_12 = 37\n            arg_10['ensembl_link'] = ensembl(arg_11, arg_12=arg_12)\n\n    arg_4['comments'] = arg_0.events(arg_7, case=arg_8,\n                                           arg_3=arg_4['variant_id'], comments=True)\n\n    arg_13 = arg_0.case_to_clinVars(arg_8.get('display_name'))\n    if arg_3 in arg_13:\n        arg_4['clinvar_clinsig'] = arg_13.get(arg_3)['clinsig']\n\n    if not 'end_chrom' in arg_4:\n        arg_4['end_chrom'] = arg_4['chromosome']\n\n    return {\n        'institute': arg_7,\n        'case': arg_8,\n        'variant': arg_4,\n        'overlapping_snvs': arg_9,\n        'manual_rank_options': MANUAL_RANK_OPTIONS,\n        'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n    }", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "sv_variant", "docstring": "Pre-process an SV variant entry for detail page.\n\n    Adds information to display variant\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        institute_id(str)\n        case_name(str)\n        variant_id(str)\n        variant_obj(dcit)\n        add_case(bool): If information about case files should be added\n\n    Returns:\n        detailed_information(dict): {\n            'institute': <institute_obj>,\n            'case': <case_obj>,\n            'variant': <variant_obj>,\n            'overlapping_snvs': <overlapping_snvs>,\n            'manual_rank_options': MANUAL_RANK_OPTIONS,\n            'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n        }", "docstring_tokens": ["Pre", "-", "process", "an", "SV", "variant", "entry", "for", "detail", "page", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256262}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/campaigncontent.py#L41-L51", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Set the content for a campaign.", "language": "python", "parameters": "(self, campaign_id, data)", "return_statement": "return self._mc_client._put(url=self._build_path(campaign_id, 'content'), data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "campaign_id", "=", "arg_1", "return", "arg_0", ".", "_mc_client", ".", "_put", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'content'", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set the content for a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        arg_0.campaign_id = arg_1\n        return arg_0._mc_client._put(url=arg_0._build_path(arg_1, 'content'), arg_2=arg_2)", "path": "mailchimp3/entities/campaigncontent.py", "identifier": "CampaignContent.update", "docstring": "Set the content for a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`", "docstring_tokens": ["Set", "the", "content", "for", "a", "campaign", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 256263}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/memo.py#L62-L66", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Unlock the library internal wallet", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "blockchain", ".", "wallet", ".", "unlock", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\" Unlock the library internal wallet\n        \"\"\"\n        arg_0.blockchain.wallet.unlock(*arg_1, **arg_2)\n        return arg_0", "path": "graphenecommon/memo.py", "identifier": "Memo.unlock_wallet", "docstring": "Unlock the library internal wallet", "docstring_tokens": ["Unlock", "the", "library", "internal", "wallet"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 256264}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/console/interactiveshell.py#L174-L205", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Method to capture raw_input", "language": "python", "parameters": "(self, timeout=0.1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.1", ")", ":", "arg_2", "=", "arg_0", ".", "km", ".", "stdin_channel", ".", "get_msg", "(", "arg_1", "=", "arg_1", ")", "arg_0", ".", "handle_iopub", "(", ")", "if", "arg_0", ".", "session_id", "==", "arg_2", "[", "\"parent_header\"", "]", ".", "get", "(", "\"session\"", ")", ":", "arg_3", "=", "signal", ".", "getsignal", "(", "signal", ".", "SIGINT", ")", "def", "double_int", "(", "arg_4", ",", "arg_5", ")", ":", "arg_3", "(", "arg_4", ",", "arg_5", ")", "raise", "KeyboardInterrupt", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "double_int", ")", "try", ":", "arg_6", "=", "raw_input", "(", "arg_2", "[", "\"content\"", "]", "[", "\"prompt\"", "]", ")", "except", "EOFError", ":", "arg_6", "=", "'\\x04'", "except", "KeyboardInterrupt", ":", "sys", ".", "stdout", ".", "write", "(", "'\\n'", ")", "return", "finally", ":", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "arg_3", ")", "if", "not", "(", "arg_0", ".", "km", ".", "stdin_channel", ".", "msg_ready", "(", ")", "or", "arg_0", ".", "km", ".", "shell_channel", ".", "msg_ready", "(", ")", ")", ":", "arg_0", ".", "km", ".", "stdin_channel", ".", "input", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1=0.1):\n        \"\"\" Method to capture raw_input\n        \"\"\"\n        arg_2 = arg_0.km.stdin_channel.get_msg(arg_1=arg_1)\n        # in case any iopub came while we were waiting:\n        arg_0.handle_iopub()\n        if arg_0.session_id == arg_2[\"parent_header\"].get(\"session\"):\n            # wrap SIGINT handler\n            arg_3 = signal.getsignal(signal.SIGINT)\n            def double_int(arg_4,arg_5):\n                # call real handler (forwards sigint to kernel),\n                # then raise local interrupt, stopping local raw_input\n                arg_3(arg_4,arg_5)\n                raise KeyboardInterrupt\n            signal.signal(signal.SIGINT, double_int)\n            \n            try:\n                arg_6 = raw_input(arg_2[\"content\"][\"prompt\"])\n            except EOFError:\n                # turn EOFError into EOF character\n                arg_6 = '\\x04'\n            except KeyboardInterrupt:\n                sys.stdout.write('\\n')\n                return\n            finally:\n                # restore SIGINT handler\n                signal.signal(signal.SIGINT, arg_3)\n            \n            # only send stdin reply if there *was not* another request\n            # or execution finished while we were reading.\n            if not (arg_0.km.stdin_channel.msg_ready() or arg_0.km.shell_channel.msg_ready()):\n                arg_0.km.stdin_channel.input(arg_6)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/terminal/console/interactiveshell.py", "identifier": "ZMQTerminalInteractiveShell.handle_stdin_request", "docstring": "Method to capture raw_input", "docstring_tokens": ["Method", "to", "capture", "raw_input"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256265}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/extensions/lib/shoebotit/ide_utils.py#L271-L313", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Find examples dir .. a little bit ugly..", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "textwrap", ".", "dedent", "(", "\"\"\"    from pkg_resources import resource_filename, Requirement, DistributionNotFound    try:        print(resource_filename(Requirement.parse('shoebot'), '%s'))    except DistributionNotFound:        pass    \"\"\"", ")", "arg_1", "=", "arg_0", "%", "'share/shoebot/examples'", "arg_2", "=", "[", "\"python\"", ",", "\"-c\"", ",", "arg_1", "]", "arg_3", "=", "subprocess", ".", "Popen", "(", "arg_2", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_4", ",", "arg_5", "=", "arg_3", ".", "communicate", "(", ")", "if", "arg_5", ":", "print", "(", "'Shoebot experienced errors searching for install and examples.'", ")", "print", "(", "'Errors:\\n{0}'", ".", "format", "(", "arg_5", ".", "decode", "(", "'utf-8'", ")", ")", ")", "return", "None", "else", ":", "arg_6", "=", "arg_4", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_6", ")", ":", "return", "arg_6", "arg_1", "=", "arg_0", "%", "'examples/'", "arg_2", "=", "[", "\"python\"", ",", "\"-c\"", ",", "arg_1", "]", "arg_3", "=", "subprocess", ".", "Popen", "(", "arg_2", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "arg_4", ",", "arg_5", "=", "arg_3", ".", "communicate", "(", ")", "arg_6", "=", "arg_4", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_6", ")", ":", "return", "arg_6", "if", "arg_6", ":", "print", "(", "'Shoebot could not find examples at: {0}'", ".", "format", "(", "arg_6", ")", ")", "else", ":", "print", "(", "'Shoebot could not find install dir and examples.'", ")"], "function": "def Func():\n    \"\"\"\n    Find examples dir .. a little bit ugly..\n    \"\"\"\n    # Replace %s with directory to check for shoebot menus.\n    arg_0 = textwrap.dedent(\"\"\"\n    from pkg_resources import resource_filename, Requirement, DistributionNotFound\n    try:\n        print(resource_filename(Requirement.parse('shoebot'), '%s'))\n    except DistributionNotFound:\n        pass\n\n    \"\"\")\n\n\n    # Needs to run in same python env as shoebot (may be different to gedits)\n    arg_1 = arg_0 % 'share/shoebot/examples'\n    arg_2 = [\"python\", \"-c\", arg_1]\n    arg_3 = subprocess.Popen(arg_2, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n    arg_4, arg_5 = arg_3.communicate()\n    if arg_5:\n        print('Shoebot experienced errors searching for install and examples.')\n        print('Errors:\\n{0}'.format(arg_5.decode('utf-8')))\n        return None\n    else:\n        arg_6 = arg_4.decode('utf-8').strip()\n        if os.path.isdir(arg_6):\n            return arg_6\n\n        # If user is running 'setup.py develop' then examples could be right here\n        #code = \"from pkg_resources import resource_filename, Requirement; print resource_filename(Requirement.parse('shoebot'), 'examples/')\"\n        arg_1 = arg_0 % 'examples/'\n        arg_2 = [\"python\", \"-c\", arg_1]\n        arg_3 = subprocess.Popen(arg_2, stdout=subprocess.PIPE)\n        arg_4, arg_5 = arg_3.communicate()\n        arg_6 = arg_4.decode('utf-8').strip()\n        if os.path.isdir(arg_6):\n            return arg_6\n\n        if arg_6:\n            print('Shoebot could not find examples at: {0}'.format(arg_6))\n        else:\n            print('Shoebot could not find install dir and examples.')", "path": "extensions/lib/shoebotit/ide_utils.py", "identifier": "find_example_dir", "docstring": "Find examples dir .. a little bit ugly..", "docstring_tokens": ["Find", "examples", "dir", "..", "a", "little", "bit", "ugly", ".."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256266}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1630-L1670", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Roughly the complement and some far analogs.", "language": "python", "parameters": "(clr, flip=False)", "return_statement": "return colors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "def", "_wrap", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_2", "-", "arg_3", "<", "arg_4", ":", "return", "arg_2", "+", "arg_5", "else", ":", "return", "arg_2", "-", "arg_3", "arg_6", "=", "1", "if", "arg_1", ":", "arg_6", "=", "-", "1", "arg_0", "=", "color", "(", "arg_0", ")", "arg_7", "=", "colorlist", "(", "arg_0", ")", "arg_8", "=", "arg_0", ".", "rotate_ryb", "(", "30", "*", "arg_6", ")", "arg_8", ".", "brightness", "=", "_wrap", "(", "arg_0", ".", "brightness", ",", "0.25", ",", "0.6", ",", "0.25", ")", "arg_7", ".", "append", "(", "arg_8", ")", "arg_8", "=", "arg_0", ".", "rotate_ryb", "(", "30", "*", "arg_6", ")", "arg_8", ".", "saturation", "=", "_wrap", "(", "arg_0", ".", "saturation", ",", "0.4", ",", "0.1", ",", "0.4", ")", "arg_8", ".", "brightness", "=", "_wrap", "(", "arg_0", ".", "brightness", ",", "0.4", ",", "0.2", ",", "0.4", ")", "arg_7", ".", "append", "(", "arg_8", ")", "arg_8", "=", "arg_0", ".", "rotate_ryb", "(", "160", "*", "arg_6", ")", "arg_8", ".", "saturation", "=", "_wrap", "(", "arg_0", ".", "saturation", ",", "0.25", ",", "0.1", ",", "0.25", ")", "arg_8", ".", "brightness", "=", "max", "(", "0.2", ",", "arg_0", ".", "brightness", ")", "arg_7", ".", "append", "(", "arg_8", ")", "arg_8", "=", "arg_0", ".", "rotate_ryb", "(", "150", "*", "arg_6", ")", "arg_8", ".", "saturation", "=", "_wrap", "(", "arg_0", ".", "saturation", ",", "0.1", ",", "0.8", ",", "0.1", ")", "arg_8", ".", "brightness", "=", "_wrap", "(", "arg_0", ".", "brightness", ",", "0.3", ",", "0.6", ",", "0.3", ")", "arg_7", ".", "append", "(", "arg_8", ")", "arg_8", "=", "arg_0", ".", "rotate_ryb", "(", "150", "*", "arg_6", ")", "arg_8", ".", "saturation", "=", "_wrap", "(", "arg_0", ".", "saturation", ",", "0.1", ",", "0.8", ",", "0.1", ")", "arg_8", ".", "brightness", "=", "_wrap", "(", "arg_0", ".", "brightness", ",", "0.4", ",", "0.2", ",", "0.4", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Roughly the complement and some far analogs.\n    \"\"\"\n    def _wrap(arg_2, arg_3, arg_4, arg_5):\n        if arg_2 - arg_3 < arg_4:\n            return arg_2 + arg_5\n        else:\n            return arg_2 - arg_3\n\n    arg_6 = 1\n    if arg_1: arg_6 = -1\n\n    arg_0 = color(arg_0)\n    arg_7 = colorlist(arg_0)\n\n    arg_8 = arg_0.rotate_ryb(30 * arg_6)\n    arg_8.brightness = _wrap(arg_0.brightness, 0.25, 0.6, 0.25)\n    arg_7.append(arg_8)\n\n    arg_8 = arg_0.rotate_ryb(30 * arg_6)\n    arg_8.saturation = _wrap(arg_0.saturation, 0.4, 0.1, 0.4)\n    arg_8.brightness = _wrap(arg_0.brightness, 0.4, 0.2, 0.4)\n    arg_7.append(arg_8)\n\n    arg_8 = arg_0.rotate_ryb(160 * arg_6)\n    arg_8.saturation = _wrap(arg_0.saturation, 0.25, 0.1, 0.25)\n    arg_8.brightness = max(0.2, arg_0.brightness)\n    arg_7.append(arg_8)\n\n    arg_8 = arg_0.rotate_ryb(150 * arg_6)\n    arg_8.saturation = _wrap(arg_0.saturation, 0.1, 0.8, 0.1)\n    arg_8.brightness = _wrap(arg_0.brightness, 0.3, 0.6, 0.3)\n    arg_7.append(arg_8)\n\n    arg_8 = arg_0.rotate_ryb(150 * arg_6)\n    arg_8.saturation = _wrap(arg_0.saturation, 0.1, 0.8, 0.1)\n    arg_8.brightness = _wrap(arg_0.brightness, 0.4, 0.2, 0.4)\n    # colors.append(c)\n\n    return arg_7", "path": "lib/colors/__init__.py", "identifier": "compound", "docstring": "Roughly the complement and some far analogs.", "docstring_tokens": ["Roughly", "the", "complement", "and", "some", "far", "analogs", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256267}
{"url": "https://github.com/cassinyio/SwarmSpawner/blob/3c39134ef7e02e2afc5d18da7d18d2c69421ed08/cassinyspawner/swarmspawner.py#L197-L202", "sha": "3c39134ef7e02e2afc5d18da7d18d2c69421ed08", "docstring_summary": "Call a docker method in a background thread", "language": "python", "parameters": "(self, method, *args, **kwargs)", "return_statement": "return self.executor.submit(self._docker, method, *args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "executor", ".", "submit", "(", "arg_0", ".", "_Func", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Call a Func method in a background thread\n\n        returns a Future\n        \"\"\"\n        return arg_0.executor.submit(arg_0._Func, arg_1, *arg_2, **arg_3)", "path": "cassinyspawner/swarmspawner.py", "identifier": "SwarmSpawner.docker", "docstring": "Call a docker method in a background thread\n\n        returns a Future", "docstring_tokens": ["Call", "a", "docker", "method", "in", "a", "background", "thread"], "nwo": "cassinyio/SwarmSpawner", "score": 0.2873663608194641, "idx": 256268}
{"url": "https://github.com/isambard-uob/budeff/blob/8be099b7e50d4855ad3cc4aa875938da2c9449e6/src/budeff/__init__.py#L19-L47", "sha": "8be099b7e50d4855ad3cc4aa875938da2c9449e6", "docstring_summary": "Calculates the interaction energy between AMPAL objects.", "language": "python", "parameters": "(ampal_objs, ff=None, assign_ff=True)", "return_statement": "return buff_score", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "FORCE_FIELDS", "[", "'bude_2016v1'", "]", "if", "arg_2", ":", "for", "arg_3", "in", "arg_0", ":", "assign_force_field", "(", "arg_3", ",", "arg_1", ")", "arg_4", "=", "find_inter_ampal", "(", "arg_0", ",", "arg_1", ".", "distance_cutoff", ")", "arg_5", "=", "score_interactions", "(", "arg_4", ",", "arg_1", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=True):\n    \"\"\"Calculates the interaction energy between AMPAL objects.\n\n    Parameters\n    ----------\n    ampal_objs: [AMPAL Object]\n        A list of any AMPAL objects with `get_atoms` methods.\n    ff: BuffForceField, optional\n        The force field to be used for scoring. If no force field is\n        provided then the most current version of the BUDE force field\n        will be used.\n    assign_ff: bool, optional\n        If true, then force field assignment on the AMPAL object will be\n        will be updated.\n\n    Returns\n    -------\n    BUFF_score: BUFFScore\n        A BUFFScore object with information about each of the interactions and\n        the atoms involved.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = FORCE_FIELDS['bude_2016v1']\n    if arg_2:\n        for arg_3 in arg_0:\n            assign_force_field(arg_3, arg_1)\n    arg_4 = find_inter_ampal(arg_0, arg_1.distance_cutoff)\n    arg_5 = score_interactions(arg_4, arg_1)\n    return arg_5", "path": "src/budeff/__init__.py", "identifier": "get_interaction_energy", "docstring": "Calculates the interaction energy between AMPAL objects.\n\n    Parameters\n    ----------\n    ampal_objs: [AMPAL Object]\n        A list of any AMPAL objects with `get_atoms` methods.\n    ff: BuffForceField, optional\n        The force field to be used for scoring. If no force field is\n        provided then the most current version of the BUDE force field\n        will be used.\n    assign_ff: bool, optional\n        If true, then force field assignment on the AMPAL object will be\n        will be updated.\n\n    Returns\n    -------\n    BUFF_score: BUFFScore\n        A BUFFScore object with information about each of the interactions and\n        the atoms involved.", "docstring_tokens": ["Calculates", "the", "interaction", "energy", "between", "AMPAL", "objects", "."], "nwo": "isambard-uob/budeff", "score": 0.138843686048881, "idx": 256269}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/dot_data_parser.py#L223-L230", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Parses a DOT file and returns a Godot graph.", "language": "python", "parameters": "(filename)", "return_statement": "return graph", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "GodotDataParser", "(", ")", "arg_2", "=", "arg_1", ".", "Func", "(", "arg_0", ")", "del", "arg_1", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\" Parses a DOT file and returns a Godot graph.\n    \"\"\"\n    arg_1 = GodotDataParser()\n    arg_2  = arg_1.Func(arg_0)\n    del arg_1\n\n    return arg_2", "path": "godot/dot_data_parser.py", "identifier": "parse_dot_file", "docstring": "Parses a DOT file and returns a Godot graph.", "docstring_tokens": ["Parses", "a", "DOT", "file", "and", "returns", "a", "Godot", "graph", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 256270}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/nlp.py#L482-L509", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Read list format context from a file.", "language": "python", "parameters": "(filename=\"nietzsche.txt\", replace=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"nietzsche.txt\"", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "'\\n'", ",", "'<eos>'", "]", "with", "tf", ".", "gfile", ".", "GFile", "(", "arg_0", ",", "\"r\"", ")", "as", "f", ":", "try", ":", "arg_2", "=", "f", ".", "read", "(", ")", ".", "replace", "(", "*", "arg_1", ")", ".", "split", "(", ")", "except", "Exception", ":", "f", ".", "seek", "(", "0", ")", "arg_1", "=", "[", "x", ".", "encode", "(", "'utf-8'", ")", "for", "x", "in", "arg_1", "]", "arg_2", "=", "f", ".", "read", "(", ")", ".", "replace", "(", "*", "arg_1", ")", ".", "split", "(", ")", "return", "arg_2"], "function": "def Func(arg_0=\"nietzsche.txt\", arg_1=None):\n    \"\"\"Read list format context from a file.\n\n    For customized Func method, see ``tutorial_generate_text.py``.\n\n    Parameters\n    ----------\n    filename : str\n        a file path.\n    replace : list of str\n        replace original string by target string.\n\n    Returns\n    -------\n    list of str\n        The context in a list (split using space).\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = ['\\n', '<eos>']\n\n    with tf.gfile.GFile(arg_0, \"r\") as f:\n        try:  # python 3.4 or older\n            arg_2 = f.read().replace(*arg_1).split()\n        except Exception:  # python 3.5\n            f.seek(0)\n            arg_1 = [x.encode('utf-8') for x in arg_1]\n            arg_2 = f.read().replace(*arg_1).split()\n        return arg_2", "path": "tensorlayer/nlp.py", "identifier": "read_words", "docstring": "Read list format context from a file.\n\n    For customized read_words method, see ``tutorial_generate_text.py``.\n\n    Parameters\n    ----------\n    filename : str\n        a file path.\n    replace : list of str\n        replace original string by target string.\n\n    Returns\n    -------\n    list of str\n        The context in a list (split using space).", "docstring_tokens": ["Read", "list", "format", "context", "from", "a", "file", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 256271}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/scripts/jams_to_lab.py#L94-L153", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Convert jams to labs.", "language": "python", "parameters": "(jams_file, output_prefix, csv=False, comment_char='#', namespaces=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "'#'", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "raise", "ValueError", "(", "'No namespaces provided. Try \".*\" for all namespaces.'", ")", "arg_5", "=", "jams", ".", "load", "(", "arg_0", ")", "arg_6", "=", "collections", ".", "Counter", "(", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_4", ":", "arg_7", ".", "extend", "(", "arg_5", ".", "search", "(", "namespace", "=", "arg_8", ")", ")", "if", "arg_2", ":", "arg_9", "=", "'csv'", "arg_10", "=", "','", "else", ":", "arg_9", "=", "'lab'", "arg_10", "=", "'\\t'", "for", "arg_11", "in", "arg_7", ":", "arg_12", "=", "arg_6", "[", "arg_11", ".", "namespace", "]", "arg_6", "[", "arg_11", ".", "namespace", "]", "+=", "1", "arg_13", "=", "os", ".", "path", ".", "extsep", ".", "join", "(", "[", "get_output_name", "(", "arg_1", ",", "arg_11", ".", "namespace", ",", "arg_12", ")", ",", "arg_9", "]", ")", "arg_14", "=", "get_comments", "(", "arg_5", ",", "arg_11", ")", "lab_dump", "(", "arg_11", ",", "arg_14", ",", "arg_13", ",", "arg_10", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3='#', arg_4=None):\n    '''Convert jams to labs.\n\n    Parameters\n    ----------\n    jams_file : str\n        The path on disk to the jams file in question\n\n    output_prefix : str\n        The file path prefix of the outputs\n\n    csv : bool\n        Whether to output in csv (True) or lab (False) format\n\n    comment_char : str\n        The character used to denote comments\n\n    namespaces : list-like\n        The set of namespace patterns to match for output\n    '''\n\n    if arg_4 is None:\n        raise ValueError('No namespaces provided. Try \".*\" for all namespaces.')\n\n    arg_5 = jams.load(arg_0)\n\n    # Get all the annotations\n    # Filter down to the unique ones\n    # For each annotation\n    #     generate the comment string\n    #     generate the output filename\n    #     dump to csv\n\n    # Make a counter object for each namespace type\n    arg_6 = collections.Counter()\n\n    arg_7 = []\n\n    for arg_8 in arg_4:\n        arg_7.extend(arg_5.search(namespace=arg_8))\n\n    if arg_2:\n        arg_9 = 'csv'\n        arg_10 = ','\n    else:\n        arg_9 = 'lab'\n        arg_10 = '\\t'\n\n    for arg_11 in arg_7:\n        arg_12 = arg_6[arg_11.namespace]\n        arg_6[arg_11.namespace] += 1\n        arg_13 = os.path.extsep.join([get_output_name(arg_1,\n                                                        arg_11.namespace,\n                                                        arg_12),\n                                        arg_9])\n\n        arg_14 = get_comments(arg_5, arg_11)\n\n        # Dump to disk\n        lab_dump(arg_11, arg_14, arg_13, arg_10, arg_3)", "path": "scripts/jams_to_lab.py", "identifier": "convert_jams", "docstring": "Convert jams to labs.\n\n    Parameters\n    ----------\n    jams_file : str\n        The path on disk to the jams file in question\n\n    output_prefix : str\n        The file path prefix of the outputs\n\n    csv : bool\n        Whether to output in csv (True) or lab (False) format\n\n    comment_char : str\n        The character used to denote comments\n\n    namespaces : list-like\n        The set of namespace patterns to match for output", "docstring_tokens": ["Convert", "jams", "to", "labs", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 256272}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1628-L1648", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Set the time against which the certificates are verified.", "language": "python", "parameters": "(self, vfy_time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_lib", ".", "X509_VERIFY_PARAM_new", "(", ")", "arg_2", "=", "_ffi", ".", "gc", "(", "arg_2", ",", "_lib", ".", "X509_VERIFY_PARAM_free", ")", "_lib", ".", "X509_VERIFY_PARAM_Func", "(", "arg_2", ",", "int", "(", "arg_1", ".", "strftime", "(", "'%s'", ")", ")", ")", "_openssl_assert", "(", "_lib", ".", "X509_STORE_set1_param", "(", "arg_0", ".", "_store", ",", "arg_2", ")", "!=", "0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set the time against which the certificates are verified.\n\n        Normally the current time is used.\n\n        .. note::\n\n          For example, you can determine if a certificate was valid at a given\n          time.\n\n        .. versionadded:: 17.0.0\n\n        :param datetime vfy_time: The verification time to set on this store.\n        :return: ``None`` if the verification time was successfully set.\n        \"\"\"\n        arg_2 = _lib.X509_VERIFY_PARAM_new()\n        arg_2 = _ffi.gc(arg_2, _lib.X509_VERIFY_PARAM_free)\n\n        _lib.X509_VERIFY_PARAM_Func(arg_2, int(arg_1.strftime('%s')))\n        _openssl_assert(_lib.X509_STORE_set1_param(arg_0._store, arg_2) != 0)", "path": "src/OpenSSL/crypto.py", "identifier": "X509Store.set_time", "docstring": "Set the time against which the certificates are verified.\n\n        Normally the current time is used.\n\n        .. note::\n\n          For example, you can determine if a certificate was valid at a given\n          time.\n\n        .. versionadded:: 17.0.0\n\n        :param datetime vfy_time: The verification time to set on this store.\n        :return: ``None`` if the verification time was successfully set.", "docstring_tokens": ["Set", "the", "time", "against", "which", "the", "certificates", "are", "verified", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256273}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/hmc.py#L820-L1049", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Applies `num_leapfrog_steps` of the leapfrog integrator.", "language": "python", "parameters": "(\n    target_log_prob_fn,\n    independent_chain_ndims,\n    step_sizes,\n    current_momentum_parts,\n    current_state_parts,\n    current_target_log_prob,\n    current_target_log_prob_grad_parts,\n    state_gradients_are_stopped=False,\n    name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_8", ",", "'hmcFunc'", ",", "[", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "]", ")", ":", "arg_9", "=", "[", "v", "+", "0.5", "*", "tf", ".", "cast", "(", "eps", ",", "v", ".", "dtype", ")", "*", "arg_13", "for", "v", ",", "eps", ",", "arg_13", "in", "zip", "(", "arg_3", ",", "arg_2", ",", "arg_6", ")", "]", "arg_10", "=", "[", "x", "+", "tf", ".", "cast", "(", "eps", ",", "v", ".", "dtype", ")", "*", "v", "for", "x", ",", "eps", ",", "v", "in", "zip", "(", "arg_4", ",", "arg_2", ",", "arg_9", ")", "]", "if", "arg_7", ":", "arg_10", "=", "[", "tf", ".", "stop_gradient", "(", "x", ")", "for", "x", "in", "arg_10", "]", "[", "arg_11", ",", "arg_12", ",", "]", "=", "mcmc_util", ".", "maybe_call_fn_and_grads", "(", "arg_0", ",", "arg_10", ")", "if", "not", "arg_11", ".", "dtype", ".", "is_floating", ":", "raise", "TypeError", "(", "'`target_log_prob_fn` must produce a `Tensor` '", "'with `float` `dtype`.'", ")", "if", "any", "(", "arg_13", "is", "None", "for", "arg_13", "in", "arg_12", ")", ":", "raise", "ValueError", "(", "'Encountered `None` gradient. Does your target `target_log_prob_fn` '", "'access all `tf.Variable`s via `tf.get_variable`?\\n'", "'  current_state_parts: {}\\n'", "'  proposed_state_parts: {}\\n'", "'  proposed_target_log_prob_grad_parts: {}'", ".", "format", "(", "arg_4", ",", "arg_10", ",", "arg_12", ")", ")", "arg_9", "=", "[", "v", "+", "0.5", "*", "tf", ".", "cast", "(", "eps", ",", "v", ".", "dtype", ")", "*", "arg_13", "for", "v", ",", "eps", ",", "arg_13", "in", "zip", "(", "arg_9", ",", "arg_2", ",", "arg_12", ")", "]", "return", "[", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "]"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2,\n    arg_3,\n    arg_4,\n    arg_5,\n    arg_6,\n    arg_7=False,\n    arg_8=None):\n  \"\"\"Applies `num_leapfrog_steps` of the leapfrog integrator.\n\n  Assumes a simple quadratic kinetic energy function: `0.5 ||momentum||**2`.\n\n  #### Examples:\n\n  ##### Simple quadratic potential.\n\n  ```python\n  import matplotlib.pyplot as plt\n  %matplotlib inline\n  import numpy as np\n  import tensorflow as tf\n  from tensorflow_probability.python.mcmc.hmc import Func  # pylint: disable=line-too-long\n  tfd = tfp.distributions\n\n  dims = 10\n  num_iter = int(1e3)\n  dtype = np.float32\n\n  position = tf.placeholder(np.float32)\n  momentum = tf.placeholder(np.float32)\n\n  target_log_prob_fn = tfd.MultivariateNormalDiag(\n      loc=tf.zeros(dims, dtype)).log_prob\n\n  def _leapfrog_one_step(*args):\n    # Closure representing computation done during each leapfrog step.\n    return Func(\n        target_log_prob_fn=target_log_prob_fn,\n        independent_chain_ndims=0,\n        step_sizes=[0.1],\n        current_momentum_parts=args[0],\n        current_state_parts=args[1],\n        current_target_log_prob=args[2],\n        current_target_log_prob_grad_parts=args[3])\n\n  # Do leapfrog integration.\n  [\n      [next_momentum],\n      [next_position],\n      next_target_log_prob,\n      next_target_log_prob_grad_parts,\n  ] = tf.while_loop(\n      cond=lambda *args: True,\n      body=_leapfrog_one_step,\n      loop_vars=[\n        [momentum],\n        [position],\n        target_log_prob_fn(position),\n        tf.gradients(target_log_prob_fn(position), position),\n      ],\n      maximum_iterations=3)\n\n  momentum_ = np.random.randn(dims).astype(dtype)\n  position_ = np.random.randn(dims).astype(dtype)\n  positions = np.zeros([num_iter, dims], dtype)\n\n  with tf.Session() as sess:\n    for i in xrange(num_iter):\n      position_, momentum_ = sess.run(\n          [next_momentum, next_position],\n          feed_dict={position: position_, momentum: momentum_})\n      positions[i] = position_\n\n  plt.plot(positions[:, 0]);  # Sinusoidal.\n  ```\n\n  Args:\n    target_log_prob_fn: Python callable which takes an argument like\n      `*current_state_parts` and returns its (possibly unnormalized) log-density\n      under the target distribution.\n    independent_chain_ndims: Scalar `int` `Tensor` representing the number of\n      leftmost `Tensor` dimensions which index independent chains.\n    step_sizes: Python `list` of `Tensor`s representing the step size for the\n      leapfrog integrator. Must broadcast with the shape of\n      `current_state_parts`.  Larger step sizes lead to faster progress, but\n      too-large step sizes make rejection exponentially more likely. When\n      possible, it's often helpful to match per-variable step sizes to the\n      standard deviations of the target distribution in each variable.\n    current_momentum_parts: Tensor containing the value(s) of the momentum\n      variable(s) to update.\n    current_state_parts: Python `list` of `Tensor`s representing the current\n      state(s) of the Markov chain(s). The first `independent_chain_ndims` of\n      the `Tensor`(s) index different chains.\n    current_target_log_prob: `Tensor` representing the value of\n      `target_log_prob_fn(*current_state_parts)`. The only reason to specify\n      this argument is to reduce TF graph size.\n    current_target_log_prob_grad_parts: Python list of `Tensor`s representing\n      gradient of `target_log_prob_fn(*current_state_parts`) wrt\n      `current_state_parts`. Must have same shape as `current_state_parts`. The\n      only reason to specify this argument is to reduce TF graph size.\n    state_gradients_are_stopped: Python `bool` indicating that the proposed new\n      state be run through `tf.stop_gradient`. This is particularly useful when\n      combining optimization over samples from the HMC chain.\n      Default value: `False` (i.e., do not apply `stop_gradient`).\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'hmc_leapfrog_integrator').\n\n  Returns:\n    proposed_momentum_parts: Updated value of the momentum.\n    proposed_state_parts: Tensor or Python list of `Tensor`s representing the\n      state(s) of the Markov chain(s) at each result step. Has same shape as\n      input `current_state_parts`.\n    proposed_target_log_prob: `Tensor` representing the value of\n      `target_log_prob_fn` at `next_state`.\n    proposed_target_log_prob_grad_parts: Gradient of `proposed_target_log_prob`\n      wrt `next_state`.\n\n  Raises:\n    ValueError: if `len(momentum_parts) != len(state_parts)`.\n    ValueError: if `len(state_parts) != len(step_sizes)`.\n    ValueError: if `len(state_parts) != len(grads_target_log_prob)`.\n    TypeError: if `not target_log_prob.dtype.is_floating`.\n  \"\"\"\n  # Note on per-variable step sizes:\n  #\n  # Using per-variable step sizes is equivalent to using the same step\n  # size for all variables and adding a diagonal mass matrix in the\n  # kinetic energy term of the Hamiltonian being integrated. This is\n  # hinted at by Neal (2011) but not derived in detail there.\n  #\n  # Let x and v be position and momentum variables respectively.\n  # Let g(x) be the gradient of `target_log_prob_fn(x)`.\n  # Let S be a diagonal matrix of per-variable step sizes.\n  # Let the Hamiltonian H(x, v) = -target_log_prob_fn(x) + 0.5 * ||v||**2.\n  #\n  # Using per-variable step sizes gives the updates\n  # v'  = v  + 0.5 * matmul(S, g(x))\n  # x'' = x  + matmul(S, v')\n  # v'' = v' + 0.5 * matmul(S, g(x''))\n  #\n  # Let u = matmul(inv(S), v).\n  # Multiplying v by inv(S) in the updates above gives the transformed dynamics\n  # u'  = matmul(inv(S), v')  = matmul(inv(S), v) + 0.5 * g(x)\n  #                           = u + 0.5 * g(x)\n  # x'' = x + matmul(S, v') = x + matmul(S**2, u')\n  # u'' = matmul(inv(S), v'') = matmul(inv(S), v') + 0.5 * g(x'')\n  #                           = u' + 0.5 * g(x'')\n  #\n  # These are exactly the leapfrog updates for the Hamiltonian\n  # H'(x, u) = -target_log_prob_fn(x) + 0.5 * u^T S**2 u\n  #          = -target_log_prob_fn(x) + 0.5 * ||v||**2 = H(x, v).\n  #\n  # To summarize:\n  #\n  # * Using per-variable step sizes implicitly simulates the dynamics\n  #   of the Hamiltonian H' (which are energy-conserving in H'). We\n  #   keep track of v instead of u, but the underlying dynamics are\n  #   the same if we transform back.\n  # * The value of the Hamiltonian H'(x, u) is the same as the value\n  #   of the original Hamiltonian H(x, v) after we transform back from\n  #   u to v.\n  # * Sampling v ~ N(0, I) is equivalent to sampling u ~ N(0, S**-2).\n  #\n  # So using per-variable step sizes in HMC will give results that are\n  # exactly identical to explicitly using a diagonal mass matrix.\n\n  with tf.compat.v1.name_scope(arg_8, 'hmcFunc', [\n      arg_1, arg_2, arg_3,\n      arg_4, arg_5,\n      arg_6\n  ]):\n\n    # Step 1: Update momentum.\n    arg_9 = [\n        v + 0.5 * tf.cast(eps, v.dtype) * arg_13\n        for v, eps, arg_13\n        in zip(arg_3,\n               arg_2,\n               arg_6)]\n\n    # Step 2: Update state.\n    arg_10 = [\n        x + tf.cast(eps, v.dtype) * v\n        for x, eps, v\n        in zip(arg_4,\n               arg_2,\n               arg_9)]\n\n    if arg_7:\n      arg_10 = [tf.stop_gradient(x) for x in arg_10]\n\n    # Step 3a: Re-evaluate target-log-prob (and grad) at proposed state.\n    [\n        arg_11,\n        arg_12,\n    ] = mcmc_util.maybe_call_fn_and_grads(\n        arg_0,\n        arg_10)\n\n    if not arg_11.dtype.is_floating:\n      raise TypeError('`target_log_prob_fn` must produce a `Tensor` '\n                      'with `float` `dtype`.')\n\n    if any(arg_13 is None for arg_13 in arg_12):\n      raise ValueError(\n          'Encountered `None` gradient. Does your target `target_log_prob_fn` '\n          'access all `tf.Variable`s via `tf.get_variable`?\\n'\n          '  current_state_parts: {}\\n'\n          '  proposed_state_parts: {}\\n'\n          '  proposed_target_log_prob_grad_parts: {}'.format(\n              arg_4,\n              arg_10,\n              arg_12))\n\n    # Step 3b: Update momentum (again).\n    arg_9 = [\n        v + 0.5 * tf.cast(eps, v.dtype) * arg_13\n        for v, eps, arg_13\n        in zip(arg_9,\n               arg_2,\n               arg_12)]\n\n    return [\n        arg_9,\n        arg_10,\n        arg_11,\n        arg_12,\n    ]", "path": "tensorflow_probability/python/mcmc/hmc.py", "identifier": "_leapfrog_integrator_one_step", "docstring": "Applies `num_leapfrog_steps` of the leapfrog integrator.\n\n  Assumes a simple quadratic kinetic energy function: `0.5 ||momentum||**2`.\n\n  #### Examples:\n\n  ##### Simple quadratic potential.\n\n  ```python\n  import matplotlib.pyplot as plt\n  %matplotlib inline\n  import numpy as np\n  import tensorflow as tf\n  from tensorflow_probability.python.mcmc.hmc import _leapfrog_integrator_one_step  # pylint: disable=line-too-long\n  tfd = tfp.distributions\n\n  dims = 10\n  num_iter = int(1e3)\n  dtype = np.float32\n\n  position = tf.placeholder(np.float32)\n  momentum = tf.placeholder(np.float32)\n\n  target_log_prob_fn = tfd.MultivariateNormalDiag(\n      loc=tf.zeros(dims, dtype)).log_prob\n\n  def _leapfrog_one_step(*args):\n    # Closure representing computation done during each leapfrog step.\n    return _leapfrog_integrator_one_step(\n        target_log_prob_fn=target_log_prob_fn,\n        independent_chain_ndims=0,\n        step_sizes=[0.1],\n        current_momentum_parts=args[0],\n        current_state_parts=args[1],\n        current_target_log_prob=args[2],\n        current_target_log_prob_grad_parts=args[3])\n\n  # Do leapfrog integration.\n  [\n      [next_momentum],\n      [next_position],\n      next_target_log_prob,\n      next_target_log_prob_grad_parts,\n  ] = tf.while_loop(\n      cond=lambda *args: True,\n      body=_leapfrog_one_step,\n      loop_vars=[\n        [momentum],\n        [position],\n        target_log_prob_fn(position),\n        tf.gradients(target_log_prob_fn(position), position),\n      ],\n      maximum_iterations=3)\n\n  momentum_ = np.random.randn(dims).astype(dtype)\n  position_ = np.random.randn(dims).astype(dtype)\n  positions = np.zeros([num_iter, dims], dtype)\n\n  with tf.Session() as sess:\n    for i in xrange(num_iter):\n      position_, momentum_ = sess.run(\n          [next_momentum, next_position],\n          feed_dict={position: position_, momentum: momentum_})\n      positions[i] = position_\n\n  plt.plot(positions[:, 0]);  # Sinusoidal.\n  ```\n\n  Args:\n    target_log_prob_fn: Python callable which takes an argument like\n      `*current_state_parts` and returns its (possibly unnormalized) log-density\n      under the target distribution.\n    independent_chain_ndims: Scalar `int` `Tensor` representing the number of\n      leftmost `Tensor` dimensions which index independent chains.\n    step_sizes: Python `list` of `Tensor`s representing the step size for the\n      leapfrog integrator. Must broadcast with the shape of\n      `current_state_parts`.  Larger step sizes lead to faster progress, but\n      too-large step sizes make rejection exponentially more likely. When\n      possible, it's often helpful to match per-variable step sizes to the\n      standard deviations of the target distribution in each variable.\n    current_momentum_parts: Tensor containing the value(s) of the momentum\n      variable(s) to update.\n    current_state_parts: Python `list` of `Tensor`s representing the current\n      state(s) of the Markov chain(s). The first `independent_chain_ndims` of\n      the `Tensor`(s) index different chains.\n    current_target_log_prob: `Tensor` representing the value of\n      `target_log_prob_fn(*current_state_parts)`. The only reason to specify\n      this argument is to reduce TF graph size.\n    current_target_log_prob_grad_parts: Python list of `Tensor`s representing\n      gradient of `target_log_prob_fn(*current_state_parts`) wrt\n      `current_state_parts`. Must have same shape as `current_state_parts`. The\n      only reason to specify this argument is to reduce TF graph size.\n    state_gradients_are_stopped: Python `bool` indicating that the proposed new\n      state be run through `tf.stop_gradient`. This is particularly useful when\n      combining optimization over samples from the HMC chain.\n      Default value: `False` (i.e., do not apply `stop_gradient`).\n    name: Python `str` name prefixed to Ops created by this function.\n      Default value: `None` (i.e., 'hmc_leapfrog_integrator').\n\n  Returns:\n    proposed_momentum_parts: Updated value of the momentum.\n    proposed_state_parts: Tensor or Python list of `Tensor`s representing the\n      state(s) of the Markov chain(s) at each result step. Has same shape as\n      input `current_state_parts`.\n    proposed_target_log_prob: `Tensor` representing the value of\n      `target_log_prob_fn` at `next_state`.\n    proposed_target_log_prob_grad_parts: Gradient of `proposed_target_log_prob`\n      wrt `next_state`.\n\n  Raises:\n    ValueError: if `len(momentum_parts) != len(state_parts)`.\n    ValueError: if `len(state_parts) != len(step_sizes)`.\n    ValueError: if `len(state_parts) != len(grads_target_log_prob)`.\n    TypeError: if `not target_log_prob.dtype.is_floating`.", "docstring_tokens": ["Applies", "num_leapfrog_steps", "of", "the", "leapfrog", "integrator", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256274}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/get_attributes.py#L348-L400", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the GetAttributes response payload and decode\n        it into its constituent parts.", "language": "python", "parameters": "(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "GetAttributesResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_7", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ")", "arg_7", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "unique_identifier", "=", "arg_7", ".", "value", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The GetAttributes response payload encoding is missing the \"", "\"unique identifier.\"", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "arg_0", ".", "_attributes", "=", "list", "(", ")", "while", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ATTRIBUTE", ",", "arg_6", ")", ":", "arg_9", "=", "objects", ".", "Attribute", "(", ")", "arg_9", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_attributes", ".", "append", "(", "arg_9", ")", "else", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ATTRIBUTES", ",", "arg_6", ")", ":", "arg_10", "=", "objects", ".", "Attributes", "(", ")", "arg_10", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_11", "=", "objects", ".", "convert_attributes_to_template_attribute", "(", "arg_10", ")", "arg_0", ".", "_attributes", "=", "arg_11", ".", "attributes", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The GetAttributes response payload encoding is missing \"", "\"the attributes structure.\"", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the GetAttributes response payload and decode\n        it into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        super(GetAttributesResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.UNIQUE_IDENTIFIER, arg_6):\n            arg_7 = primitives.TextString(\n                tag=arg_3.Tags.UNIQUE_IDENTIFIER\n            )\n            arg_7.Func(arg_6, arg_2=arg_2)\n            arg_0.unique_identifier = arg_7.value\n        else:\n            raise exceptions.InvalidKmipEncoding(\n                \"The GetAttributes response payload encoding is missing the \"\n                \"unique identifier.\"\n            )\n\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            arg_0._attributes = list()\n            while arg_0.is_tag_next(arg_3.Tags.ATTRIBUTE, arg_6):\n                arg_9 = objects.Attribute()\n                arg_9.Func(arg_6, arg_2=arg_2)\n                arg_0._attributes.append(arg_9)\n        else:\n            if arg_0.is_tag_next(arg_3.Tags.ATTRIBUTES, arg_6):\n                arg_10 = objects.Attributes()\n                arg_10.Func(arg_6, arg_2=arg_2)\n                # TODO (ph) Add a new utility to avoid using TemplateAttributes\n                arg_11 = objects.convert_attributes_to_template_attribute(\n                    arg_10\n                )\n                arg_0._attributes = arg_11.attributes\n            else:\n                raise exceptions.InvalidKmipEncoding(\n                    \"The GetAttributes response payload encoding is missing \"\n                    \"the attributes structure.\"\n                )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/get_attributes.py", "identifier": "GetAttributesResponsePayload.read", "docstring": "Read the data encoding the GetAttributes response payload and decode\n        it into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "GetAttributes", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 256275}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/trust_list.py#L164-L182", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Constructs an asn1crypto.x509.Certificate object and calls the export\n    callback", "language": "python", "parameters": "(callback, der_cert, reason)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ":", "return", "arg_0", "(", "x509", ".", "Certificate", ".", "load", "(", "arg_1", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Constructs an asn1crypto.x509.Certificate object and calls the export\n    callback\n\n    :param callback:\n        The callback to call\n\n    :param der_cert:\n        A byte string of the DER-encoded certificate\n\n    :param reason:\n        None if cert is being exported, or a unicode string of the reason it\n        is not being exported\n    \"\"\"\n\n    if not arg_0:\n        return\n    arg_0(x509.Certificate.load(arg_1), arg_2)", "path": "oscrypto/_osx/trust_list.py", "identifier": "_cert_callback", "docstring": "Constructs an asn1crypto.x509.Certificate object and calls the export\n    callback\n\n    :param callback:\n        The callback to call\n\n    :param der_cert:\n        A byte string of the DER-encoded certificate\n\n    :param reason:\n        None if cert is being exported, or a unicode string of the reason it\n        is not being exported", "docstring_tokens": ["Constructs", "an", "asn1crypto", ".", "x509", ".", "Certificate", "object", "and", "calls", "the", "export", "callback"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 256276}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/bot.py#L172-L175", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "GUI callback for mouse moved", "language": "python", "parameters": "(self, x, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_namespace", "[", "'MOUSEX'", "]", "=", "arg_1", "arg_0", ".", "_namespace", "[", "'MOUSEY'", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''GUI callback for mouse moved'''\n        arg_0._namespace['MOUSEX'] = arg_1\n        arg_0._namespace['MOUSEY'] = arg_2", "path": "shoebot/grammar/bot.py", "identifier": "Bot._mouse_pointer_moved", "docstring": "GUI callback for mouse moved", "docstring_tokens": ["GUI", "callback", "for", "mouse", "moved"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256277}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/utils.py#L21-L46", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Get a spotify ID from a URI or open.spotify URL.", "language": "python", "parameters": "(string: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "arg_1", ":", "arg_0", "=", "arg_0", ".", "strip", "(", ")", "arg_2", "=", "_URI_RE", ".", "match", "(", "arg_0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "_OPEN_RE", ".", "match", "(", "arg_0", ")", "if", "arg_2", "is", "None", ":", "return", "arg_0", "else", ":", "return", "arg_2", ".", "group", "(", "2", ")", "else", ":", "return", "arg_2", ".", "group", "(", "1", ")"], "function": "def Func(arg_0: arg_1) -> arg_1:\n    \"\"\"Get a spotify ID from a URI or open.spotify URL.\n\n    Paramters\n    ---------\n    string : str\n        The string to operate on.\n\n    Returns\n    -------\n    id : str\n        The Spotify ID from the string.\n    \"\"\"\n    arg_0 = arg_0.strip()\n\n    arg_2 = _URI_RE.match(arg_0)\n\n    if arg_2 is None:\n        arg_2 = _OPEN_RE.match(arg_0)\n\n        if arg_2 is None:\n            return arg_0\n        else:\n            return arg_2.group(2)\n    else:\n        return arg_2.group(1)", "path": "spotify/utils.py", "identifier": "to_id", "docstring": "Get a spotify ID from a URI or open.spotify URL.\n\n    Paramters\n    ---------\n    string : str\n        The string to operate on.\n\n    Returns\n    -------\n    id : str\n        The Spotify ID from the string.", "docstring_tokens": ["Get", "a", "spotify", "ID", "from", "a", "URI", "or", "open", ".", "spotify", "URL", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 256278}
{"url": "https://github.com/playpauseandstop/bootstrapper/blob/b216a05f2acb0b9f4919c4e010ff7b0f63fc1393/bootstrapper.py#L629-L650", "sha": "b216a05f2acb0b9f4919c4e010ff7b0f63fc1393", "docstring_summary": "Run post-bootstrap hook if any.", "language": "python", "parameters": "(hook, config, quiet=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_0", ":", "return", "True", "if", "not", "arg_2", ":", "print_message", "(", "'== Step 3. Run post-bootstrap hook =='", ")", "arg_3", "=", "not", "run_cmd", "(", "prepare_args", "(", "arg_0", ",", "arg_1", ")", ",", "echo", "=", "not", "arg_2", ",", "fail_silently", "=", "True", ",", "shell", "=", "True", ")", "if", "not", "arg_2", ":", "print_message", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"Run post-bootstrap hook if any.\n\n    :param hook: Hook to run.\n    :param config: Configuration dict.\n    :param quiet: Do not output messages to STDOUT/STDERR. By default: False\n    \"\"\"\n    if not arg_0:\n        return True\n\n    if not arg_2:\n        print_message('== Step 3. Run post-bootstrap hook ==')\n\n    arg_3 = not run_cmd(prepare_args(arg_0, arg_1),\n                         echo=not arg_2,\n                         fail_silently=True,\n                         shell=True)\n\n    if not arg_2:\n        print_message()\n\n    return arg_3", "path": "bootstrapper.py", "identifier": "run_hook", "docstring": "Run post-bootstrap hook if any.\n\n    :param hook: Hook to run.\n    :param config: Configuration dict.\n    :param quiet: Do not output messages to STDOUT/STDERR. By default: False", "docstring_tokens": ["Run", "post", "-", "bootstrap", "hook", "if", "any", "."], "nwo": "playpauseandstop/bootstrapper", "score": 0.17697123869542528, "idx": 256279}
{"url": "https://github.com/ankitmathur3193/song-cli/blob/ca8ccfe547e9d702313ff6d14e81ae4355989a67/song/commands/FileDownload.py#L9-L24", "sha": "ca8ccfe547e9d702313ff6d14e81ae4355989a67", "docstring_summary": "It will download the html page specified by url and return the html response", "language": "python", "parameters": "(self,url)", "return_statement": "return response.content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "\"Downloading page %s ..\"", "%", "arg_1", "try", ":", "arg_2", "=", "requests", ".", "get", "(", "arg_1", ",", "timeout", "=", "50", ")", "except", "requests", ".", "exceptions", ".", "SSLError", ":", "try", ":", "arg_2", "=", "requests", ".", "get", "(", "arg_1", ",", "verify", "=", "False", ",", "timeout", "=", "50", ")", "except", "requests", ".", "exceptions", ".", "RequestException", "as", "e", ":", "print", "e", "quit", "(", ")", "except", "requests", ".", "exceptions", ".", "RequestException", "as", "e", ":", "print", "e", "quit", "(", ")", "return", "arg_2", ".", "content"], "function": "def Func(arg_0,arg_1):\n\t\t'''It will download the html page specified by url and return the html response '''\n\t\tprint \"Downloading page %s ..\"%arg_1\n\t\ttry:\n\t\t\targ_2=requests.get(arg_1,timeout=50)\n\t\texcept requests.exceptions.SSLError:\n\t\t\ttry:\n\t\t\t\targ_2=requests.get(arg_1,verify=False,timeout=50)\n\t\t\texcept requests.exceptions.RequestException as e:\n\t\t\t\tprint e\n\t\t\t\tquit()\n\t\texcept requests.exceptions.RequestException as e:\n\t\t\tprint e\t\n\t\t\tquit()\n\n\t\treturn arg_2.content", "path": "song/commands/FileDownload.py", "identifier": "FileDownload.get_html_response", "docstring": "It will download the html page specified by url and return the html response", "docstring_tokens": ["It", "will", "download", "the", "html", "page", "specified", "by", "url", "and", "return", "the", "html", "response"], "nwo": "ankitmathur3193/song-cli", "score": 0.1872672106339659, "idx": 256280}
{"url": "https://github.com/lazka/hypothesis-fspaths/blob/19edb40a91ae4055bccf125a1e0b1796fa2e6a5c/hypothesis_fspaths.py#L116-L156", "sha": "19edb40a91ae4055bccf125a1e0b1796fa2e6a5c", "docstring_summary": "Generates a root component for a path.", "language": "python", "parameters": "(draw, result_type)", "return_statement": "return draw(final)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "tp", "(", "arg_2", "=", "''", ")", ":", "return", "_str_to_path", "(", "arg_2", ",", "arg_1", ")", "if", "os", ".", "name", "!=", "'nt'", ":", "return", "tp", "(", "os", ".", "sep", ")", "arg_3", "=", "sampled_from", "(", "[", "os", ".", "sep", ",", "os", ".", "altsep", "or", "os", ".", "sep", "]", ")", ".", "map", "(", "tp", ")", "arg_4", "=", "_filename", "(", "arg_1", ")", "arg_5", "=", "characters", "(", "min_codepoint", "=", "ord", "(", "\"A\"", ")", ",", "max_codepoint", "=", "ord", "(", "\"z\"", ")", ")", ".", "map", "(", "lambda", "c", ":", "tp", "(", "str", "(", "c", ")", ")", ")", "arg_6", "=", "arg_3", "arg_7", "=", "builds", "(", "lambda", "*", "x", ":", "tp", "(", ")", ".", "join", "(", "x", ")", ",", "arg_5", ",", "just", "(", "tp", "(", "':'", ")", ")", ",", "arg_3", ")", "arg_8", "=", "builds", "(", "lambda", "*", "x", ":", "tp", "(", ")", ".", "join", "(", "x", ")", ",", "arg_3", ",", "arg_3", ",", "just", "(", "tp", "(", "'?'", ")", ")", ",", "arg_3", ",", "arg_7", ")", "arg_9", "=", "one_of", "(", "[", "builds", "(", "lambda", "*", "x", ":", "tp", "(", ")", ".", "join", "(", "x", ")", ",", "arg_3", ",", "arg_3", ",", "arg_4", ",", "arg_3", ",", "arg_4", ",", "arg_3", ")", ",", "builds", "(", "lambda", "*", "x", ":", "tp", "(", ")", ".", "join", "(", "x", ")", ",", "arg_3", ",", "arg_3", ",", "just", "(", "tp", "(", "'?'", ")", ")", ",", "arg_3", ",", "arg_4", ",", "arg_3", ",", "arg_4", ",", "arg_3", ")", ",", "builds", "(", "lambda", "*", "x", ":", "tp", "(", ")", ".", "join", "(", "x", ")", ",", "arg_3", ",", "arg_3", ",", "just", "(", "tp", "(", "'?'", ")", ")", ",", "arg_3", ",", "just", "(", "tp", "(", "'UNC'", ")", ")", ",", "arg_3", ",", "arg_4", ",", "arg_3", ",", "arg_4", ",", "arg_3", ")", ",", "builds", "(", "lambda", "*", "x", ":", "tp", "(", ")", ".", "join", "(", "x", ")", ",", "arg_3", ",", "arg_3", ",", "just", "(", "tp", "(", "'.'", ")", ")", ",", "arg_3", ",", "arg_4", ",", "arg_3", ")", ",", "]", ")", "arg_10", "=", "one_of", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", "return", "arg_0", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Generates a root component for a path.\"\"\"\n\n    # Based on https://en.wikipedia.org/wiki/Path_(computing)\n\n    def tp(arg_2=''):\n        return _str_to_path(arg_2, arg_1)\n\n    if os.name != 'nt':\n        return tp(os.sep)\n\n    arg_3 = sampled_from([os.sep, os.altsep or os.sep]).map(tp)\n    arg_4 = _filename(arg_1)\n    arg_5 = characters(min_codepoint=ord(\"A\"), max_codepoint=ord(\"z\")).map(\n        lambda c: tp(str(c)))\n\n    arg_6 = arg_3\n    # [drive_letter]:\\\n    arg_7 = builds(lambda *x: tp().join(x), arg_5, just(tp(':')), arg_3)\n    # \\\\?\\[drive_spec]:\\\n    arg_8 = builds(\n        lambda *x: tp().join(x), arg_3, arg_3, just(tp('?')), arg_3, arg_7)\n\n    arg_9 = one_of([\n        # \\\\[server]\\[sharename]\\\n        builds(lambda *x: tp().join(x), arg_3, arg_3, arg_4, arg_3, arg_4, arg_3),\n        # \\\\?\\[server]\\[sharename]\\\n        builds(lambda *x: tp().join(x),\n               arg_3, arg_3, just(tp('?')), arg_3, arg_4, arg_3, arg_4, arg_3),\n        # \\\\?\\UNC\\[server]\\[sharename]\\\n        builds(lambda *x: tp().join(x),\n               arg_3, arg_3, just(tp('?')), arg_3, just(tp('UNC')), arg_3, arg_4, arg_3,\n               arg_4, arg_3),\n        # \\\\.\\[physical_device]\\\n        builds(lambda *x: tp().join(x),\n               arg_3, arg_3, just(tp('.')), arg_3, arg_4, arg_3),\n    ])\n\n    arg_10 = one_of(arg_6, arg_7, arg_8, arg_9)\n\n    return arg_0(arg_10)", "path": "hypothesis_fspaths.py", "identifier": "_path_root", "docstring": "Generates a root component for a path.", "docstring_tokens": ["Generates", "a", "root", "component", "for", "a", "path", "."], "nwo": "lazka/hypothesis-fspaths", "score": 0.16941397159673272, "idx": 256281}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/util/mapping_util.py#L318-L353", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Determine the mapping between every pixelization-grid pixel and masked pixelization-grid pixel. This is\n    performed by checking whether each pixelization-grid pixel is within the regular-masks, and mapping the indexes.", "language": "python", "parameters": "(mask, unmasked_sparse_grid_pixel_centres,\n                                                          total_sparse_pixels)", "return_statement": "return unmasked_sparse_to_sparse", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "shape", "[", "0", "]", "arg_4", "=", "np", ".", "zeros", "(", "arg_3", ")", "arg_5", "=", "0", "for", "arg_6", "in", "range", "(", "arg_3", ")", ":", "arg_7", "=", "arg_1", "[", "arg_6", ",", "0", "]", "arg_8", "=", "arg_1", "[", "arg_6", ",", "1", "]", "arg_4", "[", "arg_6", "]", "=", "arg_5", "if", "not", "arg_0", "[", "arg_7", ",", "arg_8", "]", ":", "if", "arg_5", "<", "arg_2", "-", "1", ":", "arg_5", "+=", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1,\n                                                          arg_2):\n    \"\"\"Determine the mapping between every pixelization-grid pixel and masked pixelization-grid pixel. This is\n    performed by checking whether each pixelization-grid pixel is within the regular-masks, and mapping the indexes.\n\n    Pixelization pixels are paired with the next masked pixel index. This may mean that a pixel is not paired with a\n    pixel near it, if the next pixel is on the next row of the grid. This is not a problem, as it is only\n    unmasked pixels that are referened when computing image_to_pix, which is what this array is used for.\n\n    Parameters\n    -----------\n    total_sparse_pixels : int\n        The total number of pixels in the pixelization grid which fall within the regular-masks.\n    mask : ccd.masks.Mask\n        The regular-masks within which pixelization pixels must be inside\n    unmasked_sparse_grid_pixel_centres : ndarray\n        The centres of the unmasked pixelization grid pixels.\n    \"\"\"\n\n    arg_3 = arg_1.shape[0]\n\n    arg_4 = np.zeros(arg_3)\n    arg_5 = 0\n\n    for arg_6 in range(arg_3):\n\n        arg_7 = arg_1[arg_6, 0]\n        arg_8 = arg_1[arg_6, 1]\n\n        arg_4[arg_6] = arg_5\n\n        if not arg_0[arg_7, arg_8]:\n            if arg_5 < arg_2 - 1:\n                arg_5 += 1\n\n    return arg_4", "path": "autolens/data/array/util/mapping_util.py", "identifier": "unmasked_sparse_to_sparse_from_mask_and_pixel_centres", "docstring": "Determine the mapping between every pixelization-grid pixel and masked pixelization-grid pixel. This is\n    performed by checking whether each pixelization-grid pixel is within the regular-masks, and mapping the indexes.\n\n    Pixelization pixels are paired with the next masked pixel index. This may mean that a pixel is not paired with a\n    pixel near it, if the next pixel is on the next row of the grid. This is not a problem, as it is only\n    unmasked pixels that are referened when computing image_to_pix, which is what this array is used for.\n\n    Parameters\n    -----------\n    total_sparse_pixels : int\n        The total number of pixels in the pixelization grid which fall within the regular-masks.\n    mask : ccd.masks.Mask\n        The regular-masks within which pixelization pixels must be inside\n    unmasked_sparse_grid_pixel_centres : ndarray\n        The centres of the unmasked pixelization grid pixels.", "docstring_tokens": ["Determine", "the", "mapping", "between", "every", "pixelization", "-", "grid", "pixel", "and", "masked", "pixelization", "-", "grid", "pixel", ".", "This", "is", "performed", "by", "checking", "whether", "each", "pixelization", "-", "grid", "pixel", "is", "within", "the", "regular", "-", "masks", "and", "mapping", "the", "indexes", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 256282}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/client.py#L273-L289", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Update the rate limit and the time to reset\n        from the response headers.", "language": "python", "parameters": "(self, response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "rate_limit_header", "in", "arg_1", ".", "headers", ":", "arg_0", ".", "rate_limit", "=", "int", "(", "arg_1", ".", "headers", "[", "arg_0", ".", "rate_limit_header", "]", ")", "logger", ".", "debug", "(", "\"Rate limit: %s\"", ",", "arg_0", ".", "rate_limit", ")", "else", ":", "arg_0", ".", "rate_limit", "=", "None", "if", "arg_0", ".", "rate_limit_reset_header", "in", "arg_1", ".", "headers", ":", "arg_0", ".", "rate_limit_reset_ts", "=", "int", "(", "arg_1", ".", "headers", "[", "arg_0", ".", "rate_limit_reset_header", "]", ")", "logger", ".", "debug", "(", "\"Rate limit reset: %s\"", ",", "arg_0", ".", "calculate_time_to_reset", "(", ")", ")", "else", ":", "arg_0", ".", "rate_limit_reset_ts", "=", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update the rate limit and the time to reset\n        from the response headers.\n\n        :param: response: the response object\n        \"\"\"\n        if arg_0.rate_limit_header in arg_1.headers:\n            arg_0.rate_limit = int(arg_1.headers[arg_0.rate_limit_header])\n            logger.debug(\"Rate limit: %s\", arg_0.rate_limit)\n        else:\n            arg_0.rate_limit = None\n\n        if arg_0.rate_limit_reset_header in arg_1.headers:\n            arg_0.rate_limit_reset_ts = int(arg_1.headers[arg_0.rate_limit_reset_header])\n            logger.debug(\"Rate limit reset: %s\", arg_0.calculate_time_to_reset())\n        else:\n            arg_0.rate_limit_reset_ts = None", "path": "perceval/client.py", "identifier": "RateLimitHandler.update_rate_limit", "docstring": "Update the rate limit and the time to reset\n        from the response headers.\n\n        :param: response: the response object", "docstring_tokens": ["Update", "the", "rate", "limit", "and", "the", "time", "to", "reset", "from", "the", "response", "headers", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256283}
{"url": "https://github.com/TheKevJames/packtex/blob/9bb4a2ade47e223ece66156221128138a117f293/packtex/commands/install.py#L65-L69", "sha": "9bb4a2ade47e223ece66156221128138a117f293", "docstring_summary": "Get the current directory state", "language": "python", "parameters": "(self)", "return_statement": "return [os.path.join(dp, f)\n                for dp, _, fn in os.walk(self.dir)\n                for f in fn]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "os", ".", "walk", "(", "arg_0", ".", "dir", ")", "for", "arg_4", "in", "arg_3", "]"], "function": "def Func(arg_0):\n        \"\"\"Get the current directory state\"\"\"\n        return [os.path.join(arg_1, arg_4)\n                for arg_1, arg_2, arg_3 in os.walk(arg_0.dir)\n                for arg_4 in arg_3]", "path": "packtex/commands/install.py", "identifier": "FolderDiff.get_state", "docstring": "Get the current directory state", "docstring_tokens": ["Get", "the", "current", "directory", "state"], "nwo": "TheKevJames/packtex", "score": 0.09252797783733271, "idx": 256284}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/client.py#L347-L377", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "Make requests to the Streaming API", "language": "python", "parameters": "(self, method, url, headers=None, _session=None,\n                       *args, **kwargs)", "return_statement": "return StreamResponse(\n            method=method,\n            url=url,\n            client=self,\n            headers=headers,\n            session=_session,\n            proxy=self.proxy,\n            **kwargs\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "return", "StreamResponse", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "client", "=", "arg_0", ",", "arg_3", "=", "arg_3", ",", "session", "=", "arg_4", ",", "proxy", "=", "arg_0", ".", "proxy", ",", "**", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,\n                       *arg_5, **arg_6):\n        \"\"\"\n            Make requests to the Streaming API\n\n        Parameters\n        ----------\n        method : str\n            Method to be used by the request\n        url : str\n            URL of the resource\n        headers : dict\n            Custom headers (doesn't overwrite `Authorization` headers)\n        _session : aiohttp.ClientSession, optional\n            The session to use for this specific request, the session\n            given as argument of :meth:`__init__` is used by default\n\n        Returns\n        -------\n        .stream.StreamResponse\n            Stream context for the request\n        \"\"\"\n        return StreamResponse(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            client=arg_0,\n            arg_3=arg_3,\n            session=arg_4,\n            proxy=arg_0.proxy,\n            **arg_6\n        )", "path": "peony/client.py", "identifier": "BasePeonyClient.stream_request", "docstring": "Make requests to the Streaming API\n\n        Parameters\n        ----------\n        method : str\n            Method to be used by the request\n        url : str\n            URL of the resource\n        headers : dict\n            Custom headers (doesn't overwrite `Authorization` headers)\n        _session : aiohttp.ClientSession, optional\n            The session to use for this specific request, the session\n            given as argument of :meth:`__init__` is used by default\n\n        Returns\n        -------\n        .stream.StreamResponse\n            Stream context for the request", "docstring_tokens": ["Make", "requests", "to", "the", "Streaming", "API"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 256285}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/collections.py#L10-L17", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Show all collections in the database", "language": "python", "parameters": "(context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "LOG", ".", "info", "(", "\"Running scout view Func\"", ")", "arg_1", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "for", "arg_2", "in", "arg_1", ".", "Func", "(", ")", ":", "click", ".", "echo", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Show all Func in the database\"\"\"\n    LOG.info(\"Running scout view Func\")\n\n    arg_1 = arg_0.obj['adapter']\n\n    for arg_2 in arg_1.Func():\n        click.echo(arg_2)", "path": "scout/commands/view/collections.py", "identifier": "collections", "docstring": "Show all collections in the database", "docstring_tokens": ["Show", "all", "collections", "in", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256286}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/query.py#L340-L362", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Returns this Query instance with the query args combined with\n        existing set with AND.", "language": "python", "parameters": "(self, *filters, **kwargs)", "return_statement": "return self._clone(filters=f)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "list", "(", "arg_1", ")", "if", "arg_2", ":", "arg_3", "+=", "[", "Filter", "(", "**", "arg_2", ")", "]", "return", "arg_0", ".", "_clone", "(", "arg_1", "=", "arg_3", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Returns this Query instance with the query args combined with\n        existing set with AND.\n\n        kwargs are simply passed to a new Filter object and combined to any\n        other Funcs with AND.\n\n        By default, everything is combined using AND. If you provide\n        multiple Funcs in a single Func call, those are ANDed\n        together. If you provide multiple Funcs in multiple Func\n        calls, those are ANDed together.\n\n        If you want something different, use the F class which supports\n        ``&`` (and), ``|`` (or) and ``~`` (not) operators. Then call\n        Func once with the resulting Filter instance.\n        \"\"\"\n        arg_3 = list(arg_1)\n\n        if arg_2:\n            arg_3 += [Filter(**arg_2)]\n\n        return arg_0._clone(arg_1=arg_3)", "path": "solvebio/query.py", "identifier": "Query.filter", "docstring": "Returns this Query instance with the query args combined with\n        existing set with AND.\n\n        kwargs are simply passed to a new Filter object and combined to any\n        other filters with AND.\n\n        By default, everything is combined using AND. If you provide\n        multiple filters in a single filter call, those are ANDed\n        together. If you provide multiple filters in multiple filter\n        calls, those are ANDed together.\n\n        If you want something different, use the F class which supports\n        ``&`` (and), ``|`` (or) and ``~`` (not) operators. Then call\n        filter once with the resulting Filter instance.", "docstring_tokens": ["Returns", "this", "Query", "instance", "with", "the", "query", "args", "combined", "with", "existing", "set", "with", "AND", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 256287}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/util.py#L34-L59", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Execute the given 'cmd'", "language": "python", "parameters": "(cmd=None, shell=True, echo=True)", "return_statement": "return rcode, stdout, stderr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ")", ":", "if", "arg_2", ":", "cij", ".", "emph", "(", "\"cij.util.Func: shell: %r, cmd: %r\"", "%", "(", "arg_1", ",", "arg_0", ")", ")", "arg_3", "=", "1", "arg_4", ",", "arg_5", "=", "(", "\"\"", ",", "\"\"", ")", "if", "arg_0", ":", "if", "arg_1", ":", "arg_0", "=", "\" \"", ".", "join", "(", "arg_0", ")", "arg_6", "=", "Popen", "(", "arg_0", ",", "arg_4", "=", "PIPE", ",", "arg_5", "=", "PIPE", ",", "arg_1", "=", "arg_1", ",", "close_fds", "=", "True", ")", "arg_4", ",", "arg_5", "=", "arg_6", ".", "communicate", "(", ")", "arg_3", "=", "arg_6", ".", "returncode", "if", "arg_3", "and", "arg_2", ":", "cij", ".", "warn", "(", "\"cij.util.Func: stdout: %s\"", "%", "arg_4", ")", "cij", ".", "err", "(", "\"cij.util.Func: stderr: %s\"", "%", "arg_5", ")", "cij", ".", "err", "(", "\"cij.util.Func: rcode: %s\"", "%", "arg_3", ")", "return", "arg_3", ",", "arg_4", ",", "arg_5"], "function": "def Func(arg_0=None, arg_1=True, arg_2=True):\n    \"\"\"\n    Execute the given 'cmd'\n\n    @returns (rcode, stdout, stderr)\n    \"\"\"\n    if arg_2:\n        cij.emph(\"cij.util.Func: shell: %r, cmd: %r\" % (arg_1, arg_0))\n\n    arg_3 = 1\n    arg_4, arg_5 = (\"\", \"\")\n\n    if arg_0:\n        if arg_1:\n            arg_0 = \" \".join(arg_0)\n\n        arg_6 = Popen(arg_0, arg_4=PIPE, arg_5=PIPE, arg_1=arg_1, close_fds=True)\n        arg_4, arg_5 = arg_6.communicate()\n        arg_3 = arg_6.returncode\n\n    if arg_3 and arg_2:\n        cij.warn(\"cij.util.Func: stdout: %s\" % arg_4)\n        cij.err(\"cij.util.Func: stderr: %s\" % arg_5)\n        cij.err(\"cij.util.Func: rcode: %s\" % arg_3)\n\n    return arg_3, arg_4, arg_5", "path": "modules/cij/util.py", "identifier": "execute", "docstring": "Execute the given 'cmd'\n\n    @returns (rcode, stdout, stderr)", "docstring_tokens": ["Execute", "the", "given", "cmd"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 256288}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L426-L434", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return true if dims correspond to an n-qubit channel.", "language": "python", "parameters": "(input_dim, output_dim)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "!=", "arg_1", ":", "raise", "QiskitError", "(", "'Not an n-qubit channel: input_dim'", "+", "' ({}) != output_dim ({})'", ".", "format", "(", "arg_0", ",", "arg_1", ")", ")", "arg_2", "=", "int", "(", "np", ".", "log2", "(", "arg_0", ")", ")", "if", "2", "**", "arg_2", "!=", "arg_0", ":", "raise", "QiskitError", "(", "'Not an n-qubit channel: input_dim != 2 ** n'", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return true if dims correspond to an n-qubit channel.\"\"\"\n    if arg_0 != arg_1:\n        raise QiskitError(\n            'Not an n-qubit channel: input_dim' +\n            ' ({}) != output_dim ({})'.format(arg_0, arg_1))\n    arg_2 = int(np.log2(arg_0))\n    if 2**arg_2 != arg_0:\n        raise QiskitError('Not an n-qubit channel: input_dim != 2 ** n')", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_check_nqubit_dim", "docstring": "Return true if dims correspond to an n-qubit channel.", "docstring_tokens": ["Return", "true", "if", "dims", "correspond", "to", "an", "n", "-", "qubit", "channel", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256289}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L249-L275", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the merge requests", "language": "python", "parameters": "(self, from_date)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "client", ".", "merges", "(", "arg_1", "=", "arg_1", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "json", ".", "loads", "(", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "arg_5", "[", "'iid'", "]", "if", "arg_0", ".", "blacklist_ids", "and", "arg_6", "in", "arg_0", ".", "blacklist_ids", ":", "logger", ".", "warning", "(", "\"Skipping blacklisted merge request %s\"", ",", "arg_6", ")", "continue", "arg_7", "=", "arg_0", ".", "client", ".", "merge", "(", "arg_6", ")", "arg_8", "=", "json", ".", "loads", "(", "arg_7", ")", "arg_0", ".", "__init_merge_extra_fields", "(", "arg_8", ")", "arg_8", "[", "'notes_data'", "]", "=", "arg_0", ".", "__get_merge_notes", "(", "arg_6", ")", "arg_8", "[", "'award_emoji_data'", "]", "=", "arg_0", ".", "__get_award_emoji", "(", "GitLabClient", ".", "MERGES", ",", "arg_6", ")", "arg_8", "[", "'versions_data'", "]", "=", "arg_0", ".", "__get_merge_versions", "(", "arg_6", ")", "yield", "arg_8"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Fetch the merge requests\"\"\"\n\n        arg_2 = arg_0.client.merges(arg_1=arg_1)\n\n        for arg_3 in arg_2:\n            arg_4 = json.loads(arg_3)\n            for arg_5 in arg_4:\n                arg_6 = arg_5['iid']\n\n                if arg_0.blacklist_ids and arg_6 in arg_0.blacklist_ids:\n                    logger.warning(\"Skipping blacklisted merge request %s\", arg_6)\n                    continue\n\n                # The single merge_request API call returns a more\n                # complete merge request, thus we inflate it with\n                # other data (e.g., notes, emojis, versions)\n                arg_7 = arg_0.client.merge(arg_6)\n                arg_8 = json.loads(arg_7)\n\n                arg_0.__init_merge_extra_fields(arg_8)\n\n                arg_8['notes_data'] = arg_0.__get_merge_notes(arg_6)\n                arg_8['award_emoji_data'] = arg_0.__get_award_emoji(GitLabClient.MERGES, arg_6)\n                arg_8['versions_data'] = arg_0.__get_merge_versions(arg_6)\n\n                yield arg_8", "path": "perceval/backends/core/gitlab.py", "identifier": "GitLab.__fetch_merge_requests", "docstring": "Fetch the merge requests", "docstring_tokens": ["Fetch", "the", "merge", "requests"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256290}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/autoindent.py#L301-L309", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "Improve QTextCursor.atBlockStart to ignore spaces", "language": "python", "parameters": "(tc, line)", "return_statement": "return column <= indentation", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "atBlockStart", "(", ")", ":", "return", "True", "arg_2", "=", "arg_0", ".", "columnNumber", "(", ")", "arg_3", "=", "len", "(", "arg_1", ")", "-", "len", "(", "arg_1", ".", "lstrip", "(", ")", ")", "return", "arg_2", "<=", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Improve QTextCursor.atBlockStart to ignore spaces\n        \"\"\"\n        if arg_0.atBlockStart():\n            return True\n        arg_2 = arg_0.columnNumber()\n        arg_3 = len(arg_1) - len(arg_1.lstrip())\n        return arg_2 <= arg_3", "path": "pyqode/python/modes/autoindent.py", "identifier": "PyAutoIndentMode._at_block_start", "docstring": "Improve QTextCursor.atBlockStart to ignore spaces", "docstring_tokens": ["Improve", "QTextCursor", ".", "atBlockStart", "to", "ignore", "spaces"], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 256291}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L132-L142", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Return if the edges between the given nodes are consistent, meaning they all have the same relation.", "language": "python", "parameters": "(graph: BELGraph, u: BaseEntity, v: BaseEntity)", "return_statement": "return list(relations)[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_3", ")", "->", "Optional", "[", "str", "]", ":", "arg_5", "=", "{", "data", "[", "RELATION", "]", "for", "data", "in", "arg_0", "[", "arg_2", "]", "[", "arg_4", "]", ".", "values", "(", ")", "}", "if", "1", "!=", "len", "(", "arg_5", ")", ":", "return", "return", "list", "(", "arg_5", ")", "[", "0", "]"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_3) -> Optional[str]:\n    \"\"\"Return if the edges between the given nodes are consistent, meaning they all have the same relation.\n\n    :return: If the edges aren't consistent, return false, otherwise return the relation type\n    \"\"\"\n    arg_5 = {data[RELATION] for data in arg_0[arg_2][arg_4].values()}\n\n    if 1 != len(arg_5):\n        return\n\n    return list(arg_5)[0]", "path": "src/pybel_tools/summary/edge_summary.py", "identifier": "pair_is_consistent", "docstring": "Return if the edges between the given nodes are consistent, meaning they all have the same relation.\n\n    :return: If the edges aren't consistent, return false, otherwise return the relation type", "docstring_tokens": ["Return", "if", "the", "edges", "between", "the", "given", "nodes", "are", "consistent", "meaning", "they", "all", "have", "the", "same", "relation", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256292}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L375-L383", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "RENEWING state.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "'In state: Func'", ")", "arg_0", ".", "current_state", "=", "STATE_Func", "if", "arg_0", ".", "script", "is", "not", "None", ":", "arg_0", ".", "script", ".", "script_init", "(", "arg_0", ".", "client", ".", "lease", ",", "arg_0", ".", "current_state", ")", "arg_0", ".", "script", ".", "script_go", "(", ")", "else", ":", "set_net", "(", "arg_0", ".", "client", ".", "lease", ")"], "function": "def Func(arg_0):\n        \"\"\"Func state.\"\"\"\n        logger.debug('In state: Func')\n        arg_0.current_state = STATE_Func\n        if arg_0.script is not None:\n            arg_0.script.script_init(arg_0.client.lease, arg_0.current_state)\n            arg_0.script.script_go()\n        else:\n            set_net(arg_0.client.lease)", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.RENEWING", "docstring": "RENEWING state.", "docstring_tokens": ["RENEWING", "state", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 256293}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L99-L118", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "List matched filenames in a dataset on Citrination.", "language": "python", "parameters": "(self, dataset_id, glob=\".\", is_dir=False)", "return_statement": "return self._get_success_json(self._post_json(routes.list_files(dataset_id), data, failure_message=\"Failed to list files for dataset {}\".format(dataset_id)))['files']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\".\"", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "{", "\"list\"", ":", "{", "\"glob\"", ":", "arg_2", ",", "\"isDir\"", ":", "arg_3", "}", "}", "return", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_post_json", "(", "routes", ".", "Func", "(", "arg_1", ")", ",", "arg_4", ",", "failure_message", "=", "\"Failed to list files for dataset {}\"", ".", "format", "(", "arg_1", ")", ")", ")", "[", "'files'", "]"], "function": "def Func(arg_0, arg_1, arg_2=\".\", arg_3=False):\n        \"\"\"\n        List matched filenames in a dataset on Citrination.\n\n        :param dataset_id: The ID of the dataset to search for files.\n        :type dataset_id: int\n        :param glob: A pattern which will be matched against files in the dataset.\n        :type glob: str\n        :param is_dir: A boolean indicating whether or not the pattern should match against the beginning of paths in the dataset.\n        :type is_dir: bool\n        :return: A list of filepaths in the dataset matching the provided glob.\n        :rtype: list of strings\n        \"\"\"\n        arg_4 = {\n            \"list\": {\n                \"glob\": arg_2,\n                \"isDir\": arg_3\n            }\n        }\n        return arg_0._get_success_json(arg_0._post_json(routes.Func(arg_1), arg_4, failure_message=\"Failed to list files for dataset {}\".format(arg_1)))['files']", "path": "citrination_client/data/client.py", "identifier": "DataClient.list_files", "docstring": "List matched filenames in a dataset on Citrination.\n\n        :param dataset_id: The ID of the dataset to search for files.\n        :type dataset_id: int\n        :param glob: A pattern which will be matched against files in the dataset.\n        :type glob: str\n        :param is_dir: A boolean indicating whether or not the pattern should match against the beginning of paths in the dataset.\n        :type is_dir: bool\n        :return: A list of filepaths in the dataset matching the provided glob.\n        :rtype: list of strings", "docstring_tokens": ["List", "matched", "filenames", "in", "a", "dataset", "on", "Citrination", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 256294}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/scripts.py#L556-L577", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Return `arg` appropriately parsed or mapped to a usable value.", "language": "python", "parameters": "(arg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "_ast", ".", "Str", ")", ":", "return", "repr", "(", "arg_0", ".", "s", ")", "elif", "isinstance", "(", "arg_0", ",", "_ast", ".", "Num", ")", ":", "return", "arg_0", ".", "n", "elif", "isinstance", "(", "arg_0", ",", "_ast", ".", "Name", ")", ":", "arg_1", "=", "arg_0", ".", "id", "if", "arg_1", "==", "'True'", ":", "return", "True", "elif", "arg_1", "==", "'False'", ":", "return", "False", "elif", "arg_1", "==", "'None'", ":", "return", "None", "return", "arg_1", "else", ":", "return", "Unparseable", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Return `arg` appropriately parsed or mapped to a usable value.\n\n    \"\"\"\n    # Grab the easy to parse values\n    if isinstance(arg_0, _ast.Str):\n        return repr(arg_0.s)\n    elif isinstance(arg_0, _ast.Num):\n        return arg_0.n\n    elif isinstance(arg_0, _ast.Name):\n        arg_1 = arg_0.id\n        if arg_1 == 'True':\n            return True\n        elif arg_1 == 'False':\n            return False\n        elif arg_1 == 'None':\n            return None\n        return arg_1\n    else:\n        # Everything else we don't bother with\n        return Unparseable()", "path": "pyconfig/scripts.py", "identifier": "_map_arg", "docstring": "Return `arg` appropriately parsed or mapped to a usable value.", "docstring_tokens": ["Return", "arg", "appropriately", "parsed", "or", "mapped", "to", "a", "usable", "value", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 256295}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_factory.py#L209-L219", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Return the fuzzed object", "language": "python", "parameters": "(self, indent=False, utf8=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "try", ":", "if", "\"array\"", "in", "arg_0", ".", "json", ":", "return", "arg_0", ".", "fuzz_elements", "(", "dict", "(", "arg_0", ".", "json", ")", ")", "[", "\"array\"", "]", "else", ":", "return", "arg_0", ".", "fuzz_elements", "(", "dict", "(", "arg_0", ".", "json", ")", ")", "except", "Exception", "as", "e", ":", "raise", "PJFBaseException", "(", "e", ".", "message", "if", "hasattr", "(", "e", ",", "\"message\"", ")", "else", "str", "(", "e", ")", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n        \"\"\"\n        Return the fuzzed object\n        \"\"\"\n        try:\n            if \"array\" in arg_0.json:\n                return arg_0.fuzz_elements(dict(arg_0.json))[\"array\"]\n            else:\n                return arg_0.fuzz_elements(dict(arg_0.json))\n        except Exception as e:\n            raise PJFBaseException(e.message if hasattr(e, \"message\") else str(e))", "path": "pyjfuzz/core/pjf_factory.py", "identifier": "PJFFactory.get_fuzzed", "docstring": "Return the fuzzed object", "docstring_tokens": ["Return", "the", "fuzzed", "object"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 256296}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/jobs.py#L4-L23", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Spawns a tree of jobs to avoid overloading the number of jobs spawned by a single parent.\n    This function is appropriate to use when batching samples greater than 1,000.", "language": "python", "parameters": "(job, func, inputs, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ")", ":", "arg_4", "=", "100", "arg_5", "=", "len", "(", "arg_2", ")", "/", "arg_4", "if", "arg_5", ">", "1", ":", "for", "arg_6", "in", "partitions", "(", "arg_2", ",", "arg_5", ")", ":", "arg_0", ".", "addChildJobFn", "(", "Func", ",", "arg_1", ",", "arg_6", ",", "*", "arg_3", ")", "else", ":", "for", "arg_7", "in", "arg_2", ":", "arg_0", ".", "addChildJobFn", "(", "arg_1", ",", "arg_7", ",", "*", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3):\n    \"\"\"\n    Spawns a tree of jobs to avoid overloading the number of jobs spawned by a single parent.\n    This function is appropriate to use when batching samples greater than 1,000.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param function func: Function to spawn dynamically, passes one sample as first argument\n    :param list inputs: Array of samples to be batched\n    :param list args: any arguments to be passed to the function\n    \"\"\"\n    # num_partitions isn't exposed as an argument in order to be transparent to the user.\n    # The value for num_partitions is a tested value\n    arg_4 = 100\n    arg_5 = len(arg_2) / arg_4\n    if arg_5 > 1:\n        for arg_6 in partitions(arg_2, arg_5):\n            arg_0.addChildJobFn(Func, arg_1, arg_6, *arg_3)\n    else:\n        for arg_7 in arg_2:\n            arg_0.addChildJobFn(arg_1, arg_7, *arg_3)", "path": "src/toil_lib/jobs.py", "identifier": "map_job", "docstring": "Spawns a tree of jobs to avoid overloading the number of jobs spawned by a single parent.\n    This function is appropriate to use when batching samples greater than 1,000.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param function func: Function to spawn dynamically, passes one sample as first argument\n    :param list inputs: Array of samples to be batched\n    :param list args: any arguments to be passed to the function", "docstring_tokens": ["Spawns", "a", "tree", "of", "jobs", "to", "avoid", "overloading", "the", "number", "of", "jobs", "spawned", "by", "a", "single", "parent", ".", "This", "function", "is", "appropriate", "to", "use", "when", "batching", "samples", "greater", "than", "1", "000", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 256297}
{"url": "https://github.com/ofek/pypinfo/blob/48d56e690d7667ae5854752c3a2dc07e321d5637/pypinfo/core.py#L173-L181", "sha": "48d56e690d7667ae5854752c3a2dc07e321d5637", "docstring_summary": "Add a final row to rows showing the total downloads", "language": "python", "parameters": "(rows)", "return_statement": "return rows", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "\"\"", "]", "*", "len", "(", "arg_0", "[", "0", "]", ")", "arg_1", "[", "0", "]", "=", "\"Total\"", "arg_2", ",", "arg_3", "=", "get_download_total", "(", "arg_0", ")", "arg_1", "[", "arg_3", "]", "=", "str", "(", "arg_2", ")", "arg_0", ".", "append", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Add a final row to rows showing the total downloads\"\"\"\n    arg_1 = [\"\"] * len(arg_0[0])\n    arg_1[0] = \"Total\"\n    arg_2, arg_3 = get_download_total(arg_0)\n    arg_1[arg_3] = str(arg_2)\n    arg_0.append(arg_1)\n\n    return arg_0", "path": "pypinfo/core.py", "identifier": "add_download_total", "docstring": "Add a final row to rows showing the total downloads", "docstring_tokens": ["Add", "a", "final", "row", "to", "rows", "showing", "the", "total", "downloads"], "nwo": "ofek/pypinfo", "score": 0.47741070566291816, "idx": 256298}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L82-L93", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "This method is strictly only for in memory keys that are\n            passed to Wallet with the ``keys`` argument", "language": "python", "parameters": "(self, loadkeys)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "debug", "(", "\"Force setting of private keys. Not using the wallet database!\"", ")", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_1", "=", "list", "(", "arg_1", ".", "values", "(", ")", ")", "elif", "not", "isinstance", "(", "arg_1", ",", "(", "list", ",", "set", ")", ")", ":", "arg_1", "=", "[", "arg_1", "]", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "arg_0", ".", "publickey_from_wif", "(", "arg_2", ")", "arg_0", ".", "store", ".", "add", "(", "str", "(", "arg_2", ")", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" This method is strictly only for in memory keys that are\n            passed to Wallet with the ``keys`` argument\n        \"\"\"\n        log.debug(\"Force setting of private keys. Not using the wallet database!\")\n        if isinstance(arg_1, dict):\n            arg_1 = list(arg_1.values())\n        elif not isinstance(arg_1, (list, set)):\n            arg_1 = [arg_1]\n        for arg_2 in arg_1:\n            arg_3 = arg_0.publickey_from_wif(arg_2)\n            arg_0.store.add(str(arg_2), arg_3)", "path": "graphenecommon/wallet.py", "identifier": "Wallet.setKeys", "docstring": "This method is strictly only for in memory keys that are\n            passed to Wallet with the ``keys`` argument", "docstring_tokens": ["This", "method", "is", "strictly", "only", "for", "in", "memory", "keys", "that", "are", "passed", "to", "Wallet", "with", "the", "keys", "argument"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 256299}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/run.py#L25-L35", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Runs Godot.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "GodotApplication", "(", "id", "=", "\"godot\"", ",", "plugins", "=", "[", "CorePlugin", "(", ")", ",", "PuddlePlugin", "(", ")", ",", "WorkbenchPlugin", "(", ")", ",", "ResourcePlugin", "(", ")", ",", "GodotPlugin", "(", ")", "]", ")", "arg_0", ".", "run", "(", ")"], "function": "def Func():\n    \"\"\" Runs Godot.\n    \"\"\"\n    arg_0 = GodotApplication( id=\"godot\",\n        plugins=[CorePlugin(),\n                 PuddlePlugin(),\n                 WorkbenchPlugin(),\n                 ResourcePlugin(),\n                 GodotPlugin()] )\n\n    arg_0.run()", "path": "godot/run.py", "identifier": "main", "docstring": "Runs Godot.", "docstring_tokens": ["Runs", "Godot", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 256300}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L175-L183", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "A rule that accepts a sequence of tokens satisfying ``rules`` and returns\n    the value returned by rule number ``n``, or None if the first rule was not satisfied.", "language": "python", "parameters": "(n, *inner_rules, **kwargs)", "return_statement": "return rule", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "@", "action", "(", "Seq", "(", "*", "arg_1", ")", ",", "loc", "=", "arg_2", ".", "get", "(", "\"loc\"", ",", "None", ")", ")", "def", "rule", "(", "arg_3", ",", "*", "arg_4", ")", ":", "return", "arg_4", "[", "arg_0", "]", "return", "rule"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"\n    A rule that accepts a sequence of tokens satisfying ``rules`` and returns\n    the value returned by rule number ``n``, or None if the first rule was not satisfied.\n    \"\"\"\n    @action(Seq(*arg_1), loc=arg_2.get(\"loc\", None))\n    def rule(arg_3, *arg_4):\n        return arg_4[arg_0]\n    return rule", "path": "third_party/pythonparser/parser.py", "identifier": "SeqN", "docstring": "A rule that accepts a sequence of tokens satisfying ``rules`` and returns\n    the value returned by rule number ``n``, or None if the first rule was not satisfied.", "docstring_tokens": ["A", "rule", "that", "accepts", "a", "sequence", "of", "tokens", "satisfying", "rules", "and", "returns", "the", "value", "returned", "by", "rule", "number", "n", "or", "None", "if", "the", "first", "rule", "was", "not", "satisfied", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 256301}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L394-L427", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Make a reST API index file from written files", "language": "python", "parameters": "(self, outdir, froot='gen', relative_to=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'gen'", ",", "arg_3", "=", "None", ")", ":", "if", "arg_0", ".", "written_modules", "is", "None", ":", "raise", "ValueError", "(", "'No modules written'", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_2", "+", "arg_0", ".", "rst_extension", ")", "if", "arg_3", "is", "not", "None", ":", "arg_5", "=", "arg_1", ".", "replace", "(", "arg_3", "+", "os", ".", "path", ".", "sep", ",", "''", ")", "else", ":", "arg_5", "=", "arg_1", "arg_6", "=", "open", "(", "arg_4", ",", "'wt'", ")", "arg_7", "=", "arg_6", ".", "write", "arg_7", "(", "'.. AUTO-GENERATED FILE -- DO NOT EDIT!\\n\\n'", ")", "arg_7", "(", "'.. toctree::\\n\\n'", ")", "for", "arg_8", "in", "arg_0", ".", "written_modules", ":", "arg_7", "(", "'   %s\\n'", "%", "os", ".", "path", ".", "join", "(", "arg_5", ",", "arg_8", ")", ")", "arg_6", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2='gen', arg_3=None):\n        \"\"\"Make a reST API index file from written files\n\n        Parameters\n        ----------\n        path : string\n            Filename to write index to\n        outdir : string\n            Directory to which to write generated index file\n        froot : string, optional\n            root (filename without extension) of filename to write to\n            Defaults to 'gen'.  We add ``self.rst_extension``.\n        relative_to : string\n            path to which written filenames are relative.  This\n            component of the written file path will be removed from\n            outdir, in the generated index.  Default is None, meaning,\n            leave path as it is.\n        \"\"\"\n        if arg_0.written_modules is None:\n            raise ValueError('No modules written')\n        # Get full filename path\n        arg_4 = os.path.join(arg_1, arg_2+arg_0.rst_extension)\n        # Path written into index is relative to rootpath\n        if arg_3 is not None:\n            arg_5 = arg_1.replace(arg_3 + os.path.sep, '')\n        else:\n            arg_5 = arg_1\n        arg_6 = open(arg_4,'wt')\n        arg_7 = arg_6.write\n        arg_7('.. AUTO-GENERATED FILE -- DO NOT EDIT!\\n\\n')\n        arg_7('.. toctree::\\n\\n')\n        for arg_8 in arg_0.written_modules:\n            arg_7('   %s\\n' % os.path.join(arg_5,arg_8))\n        arg_6.close()", "path": "h2o-docs/src/product/sphinxext/apigen.py", "identifier": "ApiDocWriter.write_index", "docstring": "Make a reST API index file from written files\n\n        Parameters\n        ----------\n        path : string\n            Filename to write index to\n        outdir : string\n            Directory to which to write generated index file\n        froot : string, optional\n            root (filename without extension) of filename to write to\n            Defaults to 'gen'.  We add ``self.rst_extension``.\n        relative_to : string\n            path to which written filenames are relative.  This\n            component of the written file path will be removed from\n            outdir, in the generated index.  Default is None, meaning,\n            leave path as it is.", "docstring_tokens": ["Make", "a", "reST", "API", "index", "file", "from", "written", "files"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 256302}
{"url": "https://github.com/ewilazarus/yld/blob/157e474d1055f14ffdfd7e99da6c77d5f17d4307/yld/tag.py#L174-L187", "sha": "157e474d1055f14ffdfd7e99da6c77d5f17d4307", "docstring_summary": "Parses a string into a Tag", "language": "python", "parameters": "(s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "_regex", ".", "match", "(", "arg_0", ")", "arg_2", "=", "Tag", "(", "int", "(", "arg_1", ".", "group", "(", "'major'", ")", ")", ",", "int", "(", "arg_1", ".", "group", "(", "'minor'", ")", ")", ",", "int", "(", "arg_1", ".", "group", "(", "'patch'", ")", ")", ")", "return", "arg_2", "if", "arg_1", ".", "group", "(", "'label'", ")", "is", "None", "else", "arg_2", ".", "with_revision", "(", "arg_1", ".", "group", "(", "'label'", ")", ",", "int", "(", "arg_1", ".", "group", "(", "'number'", ")", ")", ")", "except", "AttributeError", ":", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Parses a string into a Tag\n        \"\"\"\n        try:\n            arg_1 = _regex.match(arg_0)\n            arg_2 = Tag(int(arg_1.group('major')),\n                    int(arg_1.group('minor')),\n                    int(arg_1.group('patch')))\n            return arg_2 \\\n                    if arg_1.group('label') is None \\\n                    else arg_2.with_revision(arg_1.group('label'), int(arg_1.group('number')))\n        except AttributeError:\n            return None", "path": "yld/tag.py", "identifier": "Tag.parse", "docstring": "Parses a string into a Tag", "docstring_tokens": ["Parses", "a", "string", "into", "a", "Tag"], "nwo": "ewilazarus/yld", "score": 0.09252797783733271, "idx": 256303}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/padding_layers.py#L9-L52", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert padding layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting padding...'", ")", "if", "arg_0", "[", "'mode'", "]", "==", "'constant'", ":", "if", "arg_0", "[", "'value'", "]", "!=", "0.0", ":", "raise", "AssertionError", "(", "'Cannot convert non-zero padding'", ")", "if", "arg_6", ":", "arg_7", "=", "'PADD'", "+", "random_string", "(", "4", ")", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_8", "=", "arg_7", "arg_9", "=", "keras", ".", "layers", ".", "ZeroPadding2D", "(", "padding", "=", "(", "(", "arg_0", "[", "'pads'", "]", "[", "2", "]", ",", "arg_0", "[", "'pads'", "]", "[", "6", "]", ")", ",", "(", "arg_0", "[", "'pads'", "]", "[", "3", "]", ",", "arg_0", "[", "'pads'", "]", "[", "7", "]", ")", ")", ",", "name", "=", "arg_8", ")", "arg_4", "[", "arg_2", "]", "=", "arg_9", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")", "elif", "arg_0", "[", "'mode'", "]", "==", "'reflect'", ":", "def", "target_layer", "(", "arg_10", ",", "arg_11", "=", "arg_0", "[", "'pads'", "]", ")", ":", "arg_12", "=", "tf", ".", "pad", "(", "arg_10", ",", "[", "[", "0", ",", "0", "]", ",", "[", "0", ",", "0", "]", ",", "[", "arg_11", "[", "2", "]", ",", "arg_11", "[", "6", "]", "]", ",", "[", "arg_11", "[", "3", "]", ",", "arg_11", "[", "7", "]", "]", "]", ",", "'REFLECT'", ")", "return", "arg_12", "arg_13", "=", "keras", ".", "layers", ".", "Lambda", "(", "target_layer", ")", "arg_4", "[", "arg_2", "]", "=", "arg_13", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert padding layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting padding...')\n\n    if arg_0['mode'] == 'constant':\n        # raise AssertionError('Cannot convert non-constant padding')\n\n        if arg_0['value'] != 0.0:\n            raise AssertionError('Cannot convert non-zero padding')\n\n        if arg_6:\n            arg_7 = 'PADD' + random_string(4)\n        else:\n            arg_7 = arg_1 + str(random.random())\n\n        # Magic ordering\n        arg_8 = arg_7\n        arg_9 = keras.layers.ZeroPadding2D(\n            padding=((arg_0['pads'][2], arg_0['pads'][6]), (arg_0['pads'][3], arg_0['pads'][7])),\n            name=arg_8\n        )\n\n        arg_4[arg_2] = arg_9(arg_4[arg_3[0]])\n    elif arg_0['mode'] == 'reflect':\n\n        def target_layer(arg_10, arg_11=arg_0['pads']):\n            # x = tf.transpose(x, [0, 2, 3, 1])\n            arg_12 = tf.pad(arg_10, [[0, 0], [0, 0], [arg_11[2], arg_11[6]], [arg_11[3], arg_11[7]]], 'REFLECT')\n            # layer = tf.transpose(layer, [0, 3, 1, 2])\n            return arg_12\n\n        arg_13 = keras.layers.Lambda(target_layer)\n        arg_4[arg_2] = arg_13(arg_4[arg_3[0]])", "path": "pytorch2keras/padding_layers.py", "identifier": "convert_padding", "docstring": "Convert padding layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "padding", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 256304}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/tuple.py#L76-L80", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Creates a TickTuple", "language": "python", "parameters": "()", "return_statement": "return HeronTuple(id=TupleHelper.TICK_TUPLE_ID, component=TupleHelper.TICK_SOURCE_COMPONENT,\n                      stream=TupleHelper.TICK_TUPLE_ID, task=None, values=None,\n                      creation_time=time.time(), roots=None)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "return", "HeronTuple", "(", "id", "=", "TupleHelper", ".", "TICK_TUPLE_ID", ",", "component", "=", "TupleHelper", ".", "TICK_SOURCE_COMPONENT", ",", "stream", "=", "TupleHelper", ".", "TICK_TUPLE_ID", ",", "task", "=", "None", ",", "values", "=", "None", ",", "creation_time", "=", "time", ".", "time", "(", ")", ",", "roots", "=", "None", ")"], "function": "def Func():\n    \"\"\"Creates a TickTuple\"\"\"\n    return HeronTuple(id=TupleHelper.TICK_TUPLE_ID, component=TupleHelper.TICK_SOURCE_COMPONENT,\n                      stream=TupleHelper.TICK_TUPLE_ID, task=None, values=None,\n                      creation_time=time.time(), roots=None)", "path": "heron/instance/src/python/utils/tuple.py", "identifier": "TupleHelper.make_tick_tuple", "docstring": "Creates a TickTuple", "docstring_tokens": ["Creates", "a", "TickTuple"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256305}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/secrets.py#L95-L113", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the data encoding the Certificate object to a stream.", "language": "python", "parameters": "(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "arg_6", "=", "BytearrayStream", "(", ")", "arg_0", ".", "certificate_type", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "certificate_value", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "Certificate", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the data encoding the Certificate object to a stream.\n\n        Args:\n            ostream (Stream): A data stream in which to encode object data,\n                supporting a Func method; usually a BytearrayStream object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        arg_6 = BytearrayStream()\n\n        arg_0.certificate_type.Func(arg_6, arg_2=arg_2)\n        arg_0.certificate_value.Func(arg_6, arg_2=arg_2)\n\n        arg_0.length = arg_6.length()\n        super(Certificate, arg_0).Func(arg_1, arg_2=arg_2)\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/secrets.py", "identifier": "Certificate.write", "docstring": "Write the data encoding the Certificate object to a stream.\n\n        Args:\n            ostream (Stream): A data stream in which to encode object data,\n                supporting a write method; usually a BytearrayStream object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Write", "the", "data", "encoding", "the", "Certificate", "object", "to", "a", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 256306}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L210-L225", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Requests the logging manager to configure logging.", "language": "python", "parameters": "(kwargs, extract=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "try", ":", "arg_2", "=", "arg_0", "[", "'logging_manager'", "]", "if", "arg_1", ":", "arg_2", ".", "extract_replacements", "(", "arg_0", "[", "'traj'", "]", ")", "arg_2", ".", "make_logging_handlers_and_tools", "(", "multiproc", "=", "True", ")", "except", "Exception", "as", "exc", ":", "sys", ".", "stderr", ".", "write", "(", "'Could not configure logging system because of: %s'", "%", "repr", "(", "exc", ")", ")", "traceback", ".", "print_exc", "(", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Requests the logging manager to configure logging.\n\n    :param extract:\n\n        If naming data should be extracted from the trajectory\n\n    \"\"\"\n    try:\n        arg_2 = arg_0['logging_manager']\n        if arg_1:\n            arg_2.extract_replacements(arg_0['traj'])\n        arg_2.make_logging_handlers_and_tools(multiproc=True)\n    except Exception as exc:\n        sys.stderr.write('Could not configure logging system because of: %s' % repr(exc))\n        traceback.print_exc()", "path": "pypet/environment.py", "identifier": "_configure_logging", "docstring": "Requests the logging manager to configure logging.\n\n    :param extract:\n\n        If naming data should be extracted from the trajectory", "docstring_tokens": ["Requests", "the", "logging", "manager", "to", "configure", "logging", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256307}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L270-L282", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "New engine with ident `uid` became available.", "language": "python", "parameters": "(self, uid)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "targets", ".", "insert", "(", "0", ",", "arg_1", ")", "arg_0", ".", "loads", ".", "insert", "(", "0", ",", "0", ")", "arg_0", ".", "completed", "[", "arg_1", "]", "=", "set", "(", ")", "arg_0", ".", "failed", "[", "arg_1", "]", "=", "set", "(", ")", "arg_0", ".", "pending", "[", "arg_1", "]", "=", "{", "}", "arg_0", ".", "update_graph", "(", "None", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"New engine with ident `uid` became available.\"\"\"\n        # head of the line:\n        arg_0.targets.insert(0,arg_1)\n        arg_0.loads.insert(0,0)\n\n        # initialize sets\n        arg_0.completed[arg_1] = set()\n        arg_0.failed[arg_1] = set()\n        arg_0.pending[arg_1] = {}\n\n        # rescan the graph:\n        arg_0.update_graph(None)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py", "identifier": "TaskScheduler._register_engine", "docstring": "New engine with ident `uid` became available.", "docstring_tokens": ["New", "engine", "with", "ident", "uid", "became", "available", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256308}
{"url": "https://github.com/mcs07/MolVS/blob/d815fe52d160abcecbcbf117e6437bf727dbd8ad/molvs/normalize.py#L114-L137", "sha": "d815fe52d160abcecbcbf117e6437bf727dbd8ad", "docstring_summary": "Apply a series of Normalization transforms to correct functional groups and recombine charges.", "language": "python", "parameters": "(self, mol)", "return_statement": "return outmol", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "debug", "(", "'Running Normalizer'", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "Chem", ".", "GetMolFrags", "(", "arg_1", ",", "asMols", "=", "True", ")", ":", "arg_2", ".", "append", "(", "arg_0", ".", "_Func_fragment", "(", "arg_3", ")", ")", "arg_4", "=", "arg_2", ".", "pop", "(", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "Chem", ".", "CombineMols", "(", "arg_4", ",", "arg_3", ")", "Chem", ".", "SanitizeMol", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Apply a series of Normalization transforms to correct functional groups and recombine charges.\n\n        A series of transforms are applied to the molecule. For each Normalization, the transform is applied repeatedly\n        until no further changes occur. If any changes occurred, we go back and start from the first Normalization\n        again, in case the changes mean an earlier transform is now applicable. The molecule is returned once the entire\n        series of Normalizations cause no further changes or if max_restarts (default 200) is reached.\n\n        :param mol: The molecule to Func.\n        :type mol: rdkit.Chem.rdchem.Mol\n        :return: The Funcd fragment.\n        :rtype: rdkit.Chem.rdchem.Mol\n        \"\"\"\n        log.debug('Running Normalizer')\n        # Normalize each fragment separately to get around quirky RunReactants behaviour\n        arg_2 = []\n        for arg_3 in Chem.GetMolFrags(arg_1, asMols=True):\n            arg_2.append(arg_0._Func_fragment(arg_3))\n        # Join Funcd fragments into a single molecule again\n        arg_4 = arg_2.pop()\n        for arg_3 in arg_2:\n            arg_4 = Chem.CombineMols(arg_4, arg_3)\n        Chem.SanitizeMol(arg_4)\n        return arg_4", "path": "molvs/normalize.py", "identifier": "Normalizer.normalize", "docstring": "Apply a series of Normalization transforms to correct functional groups and recombine charges.\n\n        A series of transforms are applied to the molecule. For each Normalization, the transform is applied repeatedly\n        until no further changes occur. If any changes occurred, we go back and start from the first Normalization\n        again, in case the changes mean an earlier transform is now applicable. The molecule is returned once the entire\n        series of Normalizations cause no further changes or if max_restarts (default 200) is reached.\n\n        :param mol: The molecule to normalize.\n        :type mol: rdkit.Chem.rdchem.Mol\n        :return: The normalized fragment.\n        :rtype: rdkit.Chem.rdchem.Mol", "docstring_tokens": ["Apply", "a", "series", "of", "Normalization", "transforms", "to", "correct", "functional", "groups", "and", "recombine", "charges", "."], "nwo": "mcs07/MolVS", "score": 0.5162715334407971, "idx": 256309}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/Celery.py#L60-L73", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Make sure an object is JSON-serializable\n    Use this to return errors and other info that does not need to be\n    deserialized or does not contain important app data. Best for returning\n    error info and such", "language": "python", "parameters": "(o)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "(", "str", ",", "dict", ",", "int", ")", ")", ":", "return", "arg_0", "else", ":", "try", ":", "json", ".", "dumps", "(", "arg_0", ")", "return", "arg_0", "except", "Exception", ":", "LOG", ".", "debug", "(", "\"Got a non-serilizeable object: %s\"", "%", "arg_0", ")", "return", "arg_0", ".", "__repr__", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Make sure an object is JSON-serializable\n    Use this to return errors and other info that does not need to be\n    deserialized or does not contain important app data. Best for returning\n    error info and such\"\"\"\n    if isinstance(arg_0, (str, dict, int)):\n        return arg_0\n    else:\n        try:\n            json.dumps(arg_0)\n            return arg_0\n        except Exception:\n            LOG.debug(\"Got a non-serilizeable object: %s\" % arg_0)\n            return arg_0.__repr__()", "path": "SpiffWorkflow/specs/Celery.py", "identifier": "Serializable", "docstring": "Make sure an object is JSON-serializable\n    Use this to return errors and other info that does not need to be\n    deserialized or does not contain important app data. Best for returning\n    error info and such", "docstring_tokens": ["Make", "sure", "an", "object", "is", "JSON", "-", "serializable", "Use", "this", "to", "return", "errors", "and", "other", "info", "that", "does", "not", "need", "to", "be", "deserialized", "or", "does", "not", "contain", "important", "app", "data", ".", "Best", "for", "returning", "error", "info", "and", "such"], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 256310}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/modcovar.py#L218-L271", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Simple and fast implementation of the covariance AR estimate", "language": "python", "parameters": "(x, order)", "return_statement": "return a, e", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "spectrum", "import", "corrmtx", "import", "scipy", ".", "linalg", "arg_2", "=", "corrmtx", "(", "arg_0", ",", "arg_1", ",", "'modified'", ")", "arg_3", "=", "np", ".", "matrix", "(", "arg_2", "[", ":", ",", "1", ":", "]", ")", "arg_4", "=", "np", ".", "array", "(", "arg_2", "[", ":", ",", "0", "]", ")", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "scipy", ".", "linalg", ".", "lstsq", "(", "-", "arg_3", ",", "arg_4", ")", "arg_9", "=", "np", ".", "dot", "(", "arg_4", ".", "conj", "(", ")", ".", "transpose", "(", ")", ",", "arg_3", ")", "arg_10", "=", "np", ".", "dot", "(", "arg_4", ".", "conj", "(", ")", ".", "transpose", "(", ")", ",", "arg_4", ")", "+", "np", ".", "dot", "(", "arg_9", ",", "arg_5", ")", "assert", "arg_10", ".", "imag", "<", "1e-4", ",", "'wierd behaviour'", "arg_10", "=", "float", "(", "arg_10", ".", "real", ")", "return", "arg_5", ",", "arg_10"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Simple and fast implementation of the covariance AR estimate\n\n    This code is 10 times faster than :func:`Func_marple` and more importantly\n    only 10 lines of code, compared to a 200 loc for :func:`Func_marple`\n\n    :param X:        Array of complex data samples\n    :param int order:   Order of linear prediction model\n\n    :return:\n        * P    - Real linear prediction variance at order IP\n        * A    - Array of complex linear prediction coefficients\n\n\n    .. plot::\n        :include-source:\n        :width: 80%\n\n        from spectrum import Func, marple_data, arma2psd, cshift\n        from pylab import log10, linspace, axis, plot \n\n        a, p = Func(marple_data, 15)\n        PSD = arma2psd(a)\n        PSD = cshift(PSD, len(PSD)/2) # switch positive and negative freq\n        plot(linspace(-0.5, 0.5, 4096), 10*log10(PSD/max(PSD)))\n        axis([-0.5,0.5,-60,0])\n\n    .. seealso:: :class:`~spectrum.Func.pFunc`\n\n    :validation: the AR parameters are the same as those returned by\n        a completely different function :func:`Func_marple`.\n\n\n    :References: Mathworks\n    \"\"\"\n    from spectrum import corrmtx\n    import scipy.linalg\n    arg_2 = corrmtx(arg_0, arg_1, 'modified')\n    arg_3 = np.matrix(arg_2[:,1:])\n    arg_4 = np.array(arg_2[:,0])\n\n    # Coefficients estimated via the covariance method\n    # Here we use lstsq rathre than solve function because Xc is not square matrix\n    arg_5, arg_6, arg_7, arg_8 = scipy.linalg.lstsq(-arg_3, arg_4)\n\n    # Estimate the input white noise variance\n\n\n    arg_9 = np.dot(arg_4.conj().transpose(), arg_3)\n    arg_10 = np.dot(arg_4.conj().transpose(), arg_4) + np.dot(arg_9, arg_5)\n    assert arg_10.imag < 1e-4, 'wierd behaviour'\n    arg_10 = float(arg_10.real) # ignore imag part that should be small\n\n    return arg_5, arg_10", "path": "src/spectrum/modcovar.py", "identifier": "modcovar", "docstring": "Simple and fast implementation of the covariance AR estimate\n\n    This code is 10 times faster than :func:`modcovar_marple` and more importantly\n    only 10 lines of code, compared to a 200 loc for :func:`modcovar_marple`\n\n    :param X:        Array of complex data samples\n    :param int order:   Order of linear prediction model\n\n    :return:\n        * P    - Real linear prediction variance at order IP\n        * A    - Array of complex linear prediction coefficients\n\n\n    .. plot::\n        :include-source:\n        :width: 80%\n\n        from spectrum import modcovar, marple_data, arma2psd, cshift\n        from pylab import log10, linspace, axis, plot \n\n        a, p = modcovar(marple_data, 15)\n        PSD = arma2psd(a)\n        PSD = cshift(PSD, len(PSD)/2) # switch positive and negative freq\n        plot(linspace(-0.5, 0.5, 4096), 10*log10(PSD/max(PSD)))\n        axis([-0.5,0.5,-60,0])\n\n    .. seealso:: :class:`~spectrum.modcovar.pmodcovar`\n\n    :validation: the AR parameters are the same as those returned by\n        a completely different function :func:`modcovar_marple`.\n\n\n    :References: Mathworks", "docstring_tokens": ["Simple", "and", "fast", "implementation", "of", "the", "covariance", "AR", "estimate"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 256311}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/teams.py#L203-L217", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Delete a team.", "language": "python", "parameters": "(self, teamId)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "arg_0", ".", "_session", ".", "Func", "(", "API_ENDPOINT", "+", "'/'", "+", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Delete a team.\n\n        Args:\n            teamId(basestring): The ID of the team to be Funcd.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n\n        # API request\n        arg_0._session.Func(API_ENDPOINT + '/' + arg_1)", "path": "webexteamssdk/api/teams.py", "identifier": "TeamsAPI.delete", "docstring": "Delete a team.\n\n        Args:\n            teamId(basestring): The ID of the team to be deleted.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Delete", "a", "team", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 256312}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case.py#L253-L275", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Delete a single case from database", "language": "python", "parameters": "(self, case_id=None, institute_id=None, display_name=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "}", "if", "arg_1", ":", "arg_4", "[", "'_id'", "]", "=", "arg_1", "LOG", ".", "info", "(", "\"Deleting case %s\"", ",", "arg_1", ")", "else", ":", "if", "not", "(", "arg_2", "and", "arg_3", ")", ":", "raise", "ValueError", "(", "\"Have to provide both institute_id and display_name\"", ")", "LOG", ".", "info", "(", "\"Deleting case %s institute %s\"", ",", "arg_3", ",", "arg_2", ")", "arg_4", "[", "'owner'", "]", "=", "arg_2", "arg_4", "[", "'display_name'", "]", "=", "arg_3", "arg_5", "=", "arg_0", ".", "case_collection", ".", "delete_one", "(", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Delete a single case from database\n\n        Args:\n            institute_id(str)\n            case_id(str)\n\n        Returns:\n            case_obj(dict): The case that was deleted\n        \"\"\"\n        arg_4 = {}\n        if arg_1:\n            arg_4['_id'] = arg_1\n            LOG.info(\"Deleting case %s\", arg_1)\n        else:\n            if not (arg_2 and arg_3):\n                raise ValueError(\"Have to provide both institute_id and display_name\")\n            LOG.info(\"Deleting case %s institute %s\", arg_3, arg_2)\n            arg_4['owner'] = arg_2\n            arg_4['display_name'] = arg_3\n\n        arg_5 = arg_0.case_collection.delete_one(arg_4)\n        return arg_5", "path": "scout/adapter/mongo/case.py", "identifier": "CaseHandler.delete_case", "docstring": "Delete a single case from database\n\n        Args:\n            institute_id(str)\n            case_id(str)\n\n        Returns:\n            case_obj(dict): The case that was deleted", "docstring_tokens": ["Delete", "a", "single", "case", "from", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256313}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L77-L80", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Like os.path.join but also expands and normalizes path parts.", "language": "python", "parameters": "(*paths)", "return_statement": "return os.path.normpath(expandpath(os.path.join(*paths)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "return", "os", ".", "path", ".", "normpath", "(", "expandpath", "(", "os", ".", "path", ".", "join", "(", "*", "arg_0", ")", ")", ")"], "function": "def Func(*arg_0):\n    '''Like os.path.join but also expands and normalizes path parts.'''\n\n    return os.path.normpath(expandpath(os.path.join(*arg_0)))", "path": "cpenv/utils.py", "identifier": "unipath", "docstring": "Like os.path.join but also expands and normalizes path parts.", "docstring_tokens": ["Like", "os", ".", "path", ".", "join", "but", "also", "expands", "and", "normalizes", "path", "parts", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 256314}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L3106-L3141", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Can be called to finish a run if manually started.", "language": "python", "parameters": "(self, store_meta_data=True, clean_up=True)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ")", ":", "if", "not", "arg_0", ".", "_run_started", ":", "return", "arg_0", "arg_0", ".", "_set_finish", "(", ")", "if", "arg_2", "and", "arg_0", ".", "_is_run", ":", "arg_0", ".", "_finalize_run", "(", ")", "arg_0", ".", "_is_run", "=", "False", "arg_0", ".", "_run_started", "=", "False", "arg_0", ".", "_updated_run_information", ".", "add", "(", "arg_0", ".", "v_idx", ")", "if", "arg_1", ":", "arg_0", ".", "f_store", "(", "only_init", "=", "True", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=True, arg_2=True):\n        \"\"\" Can be called to finish a run if manually started.\n\n        Does NOT reset the index of the run,\n        i.e. ``f_restore_default`` should be called manually if desired.\n\n        Does NOT store any data (except meta data) so you have to call\n        ``f_store`` manually before to avoid data loss.\n\n        :param store_meta_data:\n\n            If meta data like the runtime should be stored\n\n        :param clean_up:\n\n            If data added during the run should be cleaned up.\n            Only works if ``turn_into_run`` was set to ``True``.\n\n        \"\"\"\n        if not arg_0._run_started:\n            return arg_0\n\n        arg_0._set_finish()\n\n        if arg_2 and arg_0._is_run:\n            arg_0._finalize_run()\n\n        arg_0._is_run = False\n        arg_0._run_started = False\n\n        arg_0._updated_run_information.add(arg_0.v_idx)\n\n        if arg_1:\n            arg_0.f_store(only_init=True)\n\n        return arg_0", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_finalize_run", "docstring": "Can be called to finish a run if manually started.\n\n        Does NOT reset the index of the run,\n        i.e. ``f_restore_default`` should be called manually if desired.\n\n        Does NOT store any data (except meta data) so you have to call\n        ``f_store`` manually before to avoid data loss.\n\n        :param store_meta_data:\n\n            If meta data like the runtime should be stored\n\n        :param clean_up:\n\n            If data added during the run should be cleaned up.\n            Only works if ``turn_into_run`` was set to ``True``.", "docstring_tokens": ["Can", "be", "called", "to", "finish", "a", "run", "if", "manually", "started", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256315}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L778-L799", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Requests a reboot of a role instance that is running in a deployment.", "language": "python", "parameters": "(self, service_name, deployment_name,\n                             role_instance_name)", "return_statement": "return self._perform_post(\n            self._get_deployment_path_using_name(\n                service_name, deployment_name) + \\\n                    '/roleinstances/' + _str(role_instance_name) + \\\n                    '?comp=reboot',\n            '',\n            as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'deployment_name'", ",", "arg_2", ")", "_validate_not_none", "(", "'role_instance_name'", ",", "arg_3", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_deployment_path_using_name", "(", "arg_1", ",", "arg_2", ")", "+", "'/roleinstances/'", "+", "_str", "(", "arg_3", ")", "+", "'?comp=reboot'", ",", "''", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                             arg_3):\n        '''\n        Requests a reboot of a role instance that is running in a deployment.\n\n        service_name:\n            Name of the hosted service.\n        deployment_name:\n            The name of the deployment.\n        role_instance_name:\n            The name of the role instance.\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('deployment_name', arg_2)\n        _validate_not_none('role_instance_name', arg_3)\n        return arg_0._perform_post(\n            arg_0._get_deployment_path_using_name(\n                arg_1, arg_2) + \\\n                    '/roleinstances/' + _str(arg_3) + \\\n                    '?comp=reboot',\n            '',\n            as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.reboot_role_instance", "docstring": "Requests a reboot of a role instance that is running in a deployment.\n\n        service_name:\n            Name of the hosted service.\n        deployment_name:\n            The name of the deployment.\n        role_instance_name:\n            The name of the role instance.", "docstring_tokens": ["Requests", "a", "reboot", "of", "a", "role", "instance", "that", "is", "running", "in", "a", "deployment", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256316}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L258-L328", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Separates particles into convenient groups for optimization.", "language": "python", "parameters": "(s, region_size=40, bounds=None,\n        doshift=False)", "return_statement": "return groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "40", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_0", ".", "oshape", ".", "translate", "(", "-", "arg_0", ".", "pad", ")", "arg_5", "=", "(", "arg_4", "if", "arg_2", "is", "None", "else", "Tile", "(", "arg_2", "[", "0", "]", ",", "arg_2", "[", "1", "]", ")", ")", "arg_6", "=", "(", "np", ".", "ones", "(", "arg_5", ".", "dim", ",", "dtype", "=", "'int'", ")", "*", "arg_1", "if", "np", ".", "size", "(", "arg_1", ")", "==", "1", "else", "np", ".", "array", "(", "arg_1", ")", ")", "arg_7", "=", "np", ".", "ceil", "(", "arg_5", ".", "shape", ".", "astype", "(", "'float'", ")", "/", "arg_6", ")", ".", "astype", "(", "'int'", ")", "arg_8", "=", "[", "]", "arg_9", "=", "Tile", "(", "left", "=", "arg_5", ".", "l", ",", "right", "=", "arg_5", ".", "l", "+", "arg_6", ")", "if", "arg_3", "==", "'rand'", ":", "arg_3", "=", "np", ".", "random", ".", "choice", "(", "[", "True", ",", "False", "]", ")", "if", "arg_3", ":", "arg_10", "=", "arg_6", "//", "2", "arg_7", "+=", "1", "else", ":", "arg_10", "=", "0", "arg_11", "=", "np", ".", "meshgrid", "(", "*", "[", "np", ".", "arange", "(", "arg_14", ")", "for", "arg_14", "in", "arg_7", "]", ")", "arg_12", "=", "arg_0", ".", "obj_get_positions", "(", ")", "if", "arg_2", "is", "None", ":", "arg_12", "=", "np", ".", "clip", "(", "arg_12", ",", "arg_4", ".", "l", "+", "1e-3", ",", "arg_4", ".", "r", "-", "1e-3", ")", "arg_13", "=", "list", "(", "map", "(", "lambda", "*", "args", ":", "find_particles_in_tile", "(", "arg_12", ",", "arg_9", ".", "translate", "(", "np", ".", "array", "(", "args", ")", "*", "arg_6", "-", "arg_10", ")", ")", ",", "*", "[", "d", ".", "ravel", "(", ")", "for", "d", "in", "arg_11", "]", ")", ")", "for", "arg_14", "in", "range", "(", "len", "(", "arg_13", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "arg_13", "[", "arg_14", "]", ".", "size", "==", "0", ":", "arg_13", ".", "pop", "(", "arg_14", ")", "assert", "_check_groups", "(", "arg_0", ",", "arg_13", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1=40, arg_2=None,\n        arg_3=False):\n    \"\"\"\n    Separates particles into convenient groups for optimization.\n\n    Given a state, returns a list of groups of particles. Each group of\n    particles are located near each other in the image. Every particle\n    located in the desired region is contained in exactly 1 group.\n\n    Parameters\n    ----------\n    s : :class:`peri.states.ImageState`\n        The peri state to find particles in.\n    region_size : Int or 3-element list-like of ints, optional\n        The size of the box. Groups particles into boxes of shape\n        (region_size[0], region_size[1], region_size[2]). If region_size\n        is a scalar, the box is a cube of length region_size.\n        Default is 40.\n    bounds : 2-element list-like of 3-element lists, optional\n        The sub-region of the image over which to look for particles.\n            bounds[0]: The lower-left  corner of the image region.\n            bounds[1]: The upper-right corner of the image region.\n        Default (None -> ([0,0,0], s.oshape.shape)) is a box of the entire\n        image size, i.e. the default places every particle in the image\n        somewhere in the groups.\n    doshift : {True, False, `'rand'`}, optional\n        Whether or not to shift the tile boxes by half a region size, to\n        prevent the same particles to be chosen every time. If `'rand'`,\n        randomly chooses either True or False. Default is False\n\n    Returns\n    -------\n    particle_groups : List\n        Each element of particle_groups is an int numpy.ndarray of the\n        group of nearby particles. Only contains groups with a nonzero\n        number of particles, so the elements don't necessarily correspond\n        to a given image region.\n    \"\"\"\n    arg_4 = arg_0.oshape.translate(-arg_0.pad)\n    arg_5 = (arg_4 if arg_2 is None else Tile(arg_2[0], arg_2[1]))\n    arg_6 = (np.ones(arg_5.dim, dtype='int')*arg_1 if\n            np.size(arg_1) == 1 else np.array(arg_1))\n\n    arg_7 = np.ceil(arg_5.shape.astype('float')/arg_6).astype('int')\n    arg_8 = []\n    arg_9 = Tile(left=arg_5.l, right=arg_5.l + arg_6)\n    if arg_3 == 'rand':\n        arg_3 = np.random.choice([True, False])\n    if arg_3:\n        arg_10 = arg_6 // 2\n        arg_7 += 1\n    else:\n        arg_10 = 0\n    arg_11 = np.meshgrid(*[np.arange(arg_14) for arg_14 in arg_7])\n    arg_12 = arg_0.obj_get_positions()\n    if arg_2 is None:\n        # FIXME this (deliberately) masks a problem where optimization\n        # places particles outside the image. However, it ensures that\n        # all particles are in at least one group when `bounds is None`,\n        # which is the use case within opt. The 1e-3 is to ensure that\n        # they are inside the box and not on the edge.\n        arg_12 = np.clip(arg_12, arg_4.l+1e-3, arg_4.r-1e-3)\n    arg_13 = list(map(lambda *args: find_particles_in_tile(arg_12,\n            arg_9.translate( np.array(args) * arg_6 - arg_10)), *[d.ravel()\n            for d in arg_11]))\n\n    for arg_14 in range(len(arg_13)-1, -1, -1):\n        if arg_13[arg_14].size == 0:\n            arg_13.pop(arg_14)\n    assert _check_groups(arg_0, arg_13)\n    return arg_13", "path": "peri/opt/optimize.py", "identifier": "separate_particles_into_groups", "docstring": "Separates particles into convenient groups for optimization.\n\n    Given a state, returns a list of groups of particles. Each group of\n    particles are located near each other in the image. Every particle\n    located in the desired region is contained in exactly 1 group.\n\n    Parameters\n    ----------\n    s : :class:`peri.states.ImageState`\n        The peri state to find particles in.\n    region_size : Int or 3-element list-like of ints, optional\n        The size of the box. Groups particles into boxes of shape\n        (region_size[0], region_size[1], region_size[2]). If region_size\n        is a scalar, the box is a cube of length region_size.\n        Default is 40.\n    bounds : 2-element list-like of 3-element lists, optional\n        The sub-region of the image over which to look for particles.\n            bounds[0]: The lower-left  corner of the image region.\n            bounds[1]: The upper-right corner of the image region.\n        Default (None -> ([0,0,0], s.oshape.shape)) is a box of the entire\n        image size, i.e. the default places every particle in the image\n        somewhere in the groups.\n    doshift : {True, False, `'rand'`}, optional\n        Whether or not to shift the tile boxes by half a region size, to\n        prevent the same particles to be chosen every time. If `'rand'`,\n        randomly chooses either True or False. Default is False\n\n    Returns\n    -------\n    particle_groups : List\n        Each element of particle_groups is an int numpy.ndarray of the\n        group of nearby particles. Only contains groups with a nonzero\n        number of particles, so the elements don't necessarily correspond\n        to a given image region.", "docstring_tokens": ["Separates", "particles", "into", "convenient", "groups", "for", "optimization", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 256317}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L151-L174", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "fix hyphenation in the word list for a parsed sentence", "language": "python", "parameters": "(foo)", "return_statement": "return bar", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "[", "]", "while", "arg_1", "<", "len", "(", "arg_0", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_0", "[", "arg_1", "]", "if", "(", "arg_6", "==", "\"HYPH\"", ")", "and", "(", "arg_1", ">", "0", ")", "and", "(", "arg_1", "<", "len", "(", "arg_0", ")", "-", "1", ")", ":", "arg_7", "=", "arg_2", "[", "-", "1", "]", "arg_8", "=", "arg_0", "[", "arg_1", "+", "1", "]", "arg_7", "[", "0", "]", "+=", "\"-\"", "+", "arg_8", "[", "0", "]", "arg_7", "[", "1", "]", "+=", "\"-\"", "+", "arg_8", "[", "1", "]", "arg_2", "[", "-", "1", "]", "=", "arg_7", "arg_1", "+=", "2", "else", ":", "arg_2", ".", "append", "(", "arg_0", "[", "arg_1", "]", ")", "arg_1", "+=", "1", "return", "arg_2"], "function": "def Func (arg_0):\n    \"\"\"\n    fix hyphenation in the word list for a parsed sentence\n    \"\"\"\n    arg_1 = 0\n    arg_2 = []\n\n    while arg_1 < len(arg_0):\n        arg_3, arg_4, arg_5, arg_6 = arg_0[arg_1]\n\n        if (arg_6 == \"HYPH\") and (arg_1 > 0) and (arg_1 < len(arg_0) - 1):\n            arg_7 = arg_2[-1]\n            arg_8 = arg_0[arg_1 + 1]\n\n            arg_7[0] += \"-\" + arg_8[0]\n            arg_7[1] += \"-\" + arg_8[1]\n\n            arg_2[-1] = arg_7\n            arg_1 += 2\n        else:\n            arg_2.append(arg_0[arg_1])\n            arg_1 += 1\n\n    return arg_2", "path": "pytextrank/pytextrank.py", "identifier": "fix_hypenation", "docstring": "fix hyphenation in the word list for a parsed sentence", "docstring_tokens": ["fix", "hyphenation", "in", "the", "word", "list", "for", "a", "parsed", "sentence"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 256318}
{"url": "https://github.com/jshiv/turntable/blob/c095a93df14d672ba54db164a7ab7373444d1829/turntable/utils.py#L109-L130", "sha": "c095a93df14d672ba54db164a7ab7373444d1829", "docstring_summary": "Takes a path filename string and returns the split between the path and the filename", "language": "python", "parameters": "(pathfile)", "return_statement": "return path, filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "[", ":", "arg_0", ".", "rfind", "(", "'/'", ")", "+", "1", "]", "if", "arg_1", "==", "''", ":", "arg_1", "=", "'./'", "arg_2", "=", "arg_0", "[", "arg_0", ".", "rfind", "(", "'/'", ")", "+", "1", ":", "len", "(", "arg_0", ")", "]", "if", "'.'", "not", "in", "arg_2", ":", "arg_1", "=", "arg_0", "arg_2", "=", "''", "if", "(", "arg_2", "==", "''", ")", "and", "(", "arg_1", "[", "len", "(", "arg_1", ")", "-", "1", "]", "!=", "'/'", ")", ":", "arg_1", "+=", "'/'", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n    '''\n    Takes a path filename string and returns the split between the path and the filename\n\n    if filename is not given, filename = ''\n    if path is not given, path = './'\n\n    '''\n\n    arg_1 = arg_0[:arg_0.rfind('/') + 1]\n    if arg_1 == '':\n        arg_1 = './'\n\n    arg_2 = arg_0[arg_0.rfind('/') + 1:len(arg_0)]\n    if '.' not in arg_2:\n        arg_1 = arg_0\n        arg_2 = ''\n\n    if (arg_2 == '') and (arg_1[len(arg_1) - 1] != '/'):\n        arg_1 += '/'\n\n    return arg_1, arg_2", "path": "turntable/utils.py", "identifier": "path_to_filename", "docstring": "Takes a path filename string and returns the split between the path and the filename\n\n    if filename is not given, filename = ''\n    if path is not given, path = './'", "docstring_tokens": ["Takes", "a", "path", "filename", "string", "and", "returns", "the", "split", "between", "the", "path", "and", "the", "filename"], "nwo": "jshiv/turntable", "score": 0.0, "idx": 256319}
{"url": "https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/processors.py#L17-L31", "sha": "fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb", "docstring_summary": "Replace illegal February 29, 30 dates with the last day of February.", "language": "python", "parameters": "(transactions, tag, tag_dict, *args)", "return_statement": "return tag_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ")", ":", "if", "arg_2", "[", "'month'", "]", "==", "'02'", ":", "arg_4", "=", "int", "(", "arg_2", "[", "'year'", "]", ",", "10", ")", "arg_5", ",", "arg_6", "=", "calendar", ".", "monthrange", "(", "arg_4", ",", "2", ")", "if", "int", "(", "arg_2", "[", "'day'", "]", ",", "10", ")", ">", "arg_6", ":", "arg_2", "[", "'day'", "]", "=", "str", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3):\n    \"\"\"\n    Replace illegal February 29, 30 dates with the last day of February.\n\n    German banks use a variant of the 30/360 interest rate calculation,\n    where each month has always 30 days even February. Python's datetime\n    module won't accept such dates.\n    \"\"\"\n    if arg_2['month'] == '02':\n        arg_4 = int(arg_2['year'], 10)\n        arg_5, arg_6 = calendar.monthrange(arg_4, 2)\n        if int(arg_2['day'], 10) > arg_6:\n            arg_2['day'] = str(arg_6)\n\n    return arg_2", "path": "mt940/processors.py", "identifier": "date_fixup_pre_processor", "docstring": "Replace illegal February 29, 30 dates with the last day of February.\n\n    German banks use a variant of the 30/360 interest rate calculation,\n    where each month has always 30 days even February. Python's datetime\n    module won't accept such dates.", "docstring_tokens": ["Replace", "illegal", "February", "29", "30", "dates", "with", "the", "last", "day", "of", "February", "."], "nwo": "WoLpH/mt940", "score": 0.7184674620153859, "idx": 256320}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/grid/grid_search.py#L358-L366", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Obtain a hidden layer's details on a dataset.", "language": "python", "parameters": "(self, test_data, layer)", "return_statement": "return {model.model_id: model.deepfeatures(test_data, layer) for model in self.models}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "{", "arg_3", ".", "model_id", ":", "arg_3", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "for", "arg_3", "in", "arg_0", ".", "models", "}"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Obtain a hidden layer's details on a dataset.\n\n        :param test_data: Data to create a feature space on.\n        :param int layer: Index of the hidden layer.\n        :returns: A dictionary of hidden layer details for each model.\n        \"\"\"\n        return {arg_3.model_id: arg_3.Func(arg_1, arg_2) for arg_3 in arg_0.models}", "path": "h2o-py/h2o/grid/grid_search.py", "identifier": "H2OGridSearch.deepfeatures", "docstring": "Obtain a hidden layer's details on a dataset.\n\n        :param test_data: Data to create a feature space on.\n        :param int layer: Index of the hidden layer.\n        :returns: A dictionary of hidden layer details for each model.", "docstring_tokens": ["Obtain", "a", "hidden", "layer", "s", "details", "on", "a", "dataset", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 256321}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/spec.py#L152-L198", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Verify the validity of the node spec object", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "isinstance", "(", "arg_0", ".", "description", ",", "str", ")", "assert", "isinstance", "(", "arg_0", ".", "singleNodeOnly", ",", "bool", ")", "assert", "isinstance", "(", "arg_0", ".", "inputs", ",", "dict", ")", "assert", "isinstance", "(", "arg_0", ".", "outputs", ",", "dict", ")", "assert", "isinstance", "(", "arg_0", ".", "parameters", ",", "dict", ")", "assert", "isinstance", "(", "arg_0", ".", "commands", ",", "dict", ")", "arg_1", "=", "False", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "inputs", ".", "items", "(", ")", ":", "assert", "isinstance", "(", "arg_2", ",", "str", ")", "assert", "isinstance", "(", "arg_3", ",", "InputSpec", ")", "arg_3", ".", "Func", "(", ")", "if", "arg_3", ".", "isDefaultInput", ":", "assert", "not", "arg_1", "arg_1", "=", "True", "arg_4", "=", "False", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "outputs", ".", "items", "(", ")", ":", "assert", "isinstance", "(", "arg_2", ",", "str", ")", "assert", "isinstance", "(", "arg_3", ",", "OutputSpec", ")", "arg_3", ".", "Func", "(", ")", "if", "arg_3", ".", "isDefaultOutput", ":", "assert", "not", "arg_4", "arg_4", "=", "True", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "parameters", ".", "items", "(", ")", ":", "assert", "isinstance", "(", "arg_2", ",", "str", ")", "assert", "isinstance", "(", "arg_3", ",", "ParameterSpec", ")", "arg_3", ".", "Func", "(", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "commands", ".", "items", "(", ")", ":", "assert", "isinstance", "(", "arg_2", ",", "str", ")", "assert", "isinstance", "(", "arg_3", ",", "CommandSpec", ")", "arg_3", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Verify the validity of the node spec object\n\n    The type of each sub-object is verified and then\n    the validity of each node spec item is verified by calling\n    it Func() method. It also makes sure that there is at most\n    one default input and one default output.\n    \"\"\"\n    # Verify the description and singleNodeOnly attributes\n    assert isinstance(arg_0.description, str)\n    assert isinstance(arg_0.singleNodeOnly, bool)\n\n    # Make sure that all items dicts are really dicts\n    assert isinstance(arg_0.inputs, dict)\n    assert isinstance(arg_0.outputs, dict)\n    assert isinstance(arg_0.parameters, dict)\n    assert isinstance(arg_0.commands, dict)\n\n    # Verify all item dicts\n    arg_1 = False\n    for arg_2, arg_3 in arg_0.inputs.items():\n      assert isinstance(arg_2, str)\n      assert isinstance(arg_3, InputSpec)\n      arg_3.Func()\n      if arg_3.isDefaultInput:\n        assert not arg_1\n        arg_1 = True\n\n\n    arg_4 = False\n    for arg_2, arg_3 in arg_0.outputs.items():\n      assert isinstance(arg_2, str)\n      assert isinstance(arg_3, OutputSpec)\n      arg_3.Func()\n      if arg_3.isDefaultOutput:\n        assert not arg_4\n        arg_4 = True\n\n    for arg_2, arg_3 in arg_0.parameters.items():\n      assert isinstance(arg_2, str)\n      assert isinstance(arg_3, ParameterSpec)\n      arg_3.Func()\n\n    for arg_2, arg_3 in arg_0.commands.items():\n      assert isinstance(arg_2, str)\n      assert isinstance(arg_3, CommandSpec)\n      arg_3.Func()", "path": "src/nupic/regions/spec.py", "identifier": "Spec.invariant", "docstring": "Verify the validity of the node spec object\n\n    The type of each sub-object is verified and then\n    the validity of each node spec item is verified by calling\n    it invariant() method. It also makes sure that there is at most\n    one default input and one default output.", "docstring_tokens": ["Verify", "the", "validity", "of", "the", "node", "spec", "object"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256322}
{"url": "https://github.com/disqus/django-mailviews/blob/9993d5e911d545b3bc038433986c5f6812e7e965/mailviews/messages.py#L223-L245", "sha": "9993d5e911d545b3bc038433986c5f6812e7e965", "docstring_summary": "Renders and returns an unsent message with the given context.", "language": "python", "parameters": "(self, extra_context=None, *args, **kwargs)", "return_statement": "return message", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "super", "(", "TemplatedHTMLEmailMessageView", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "{", "}", "arg_5", "=", "arg_0", ".", "get_context_data", "(", "**", "arg_1", ")", "arg_6", "=", "arg_0", ".", "render_html_body", "(", "arg_5", ")", "arg_4", ".", "attach_alternative", "(", "arg_6", ",", "mimetype", "=", "'text/html'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, *arg_2, **arg_3):\n        \"\"\"\n        Renders and returns an unsent message with the given context.\n\n        Any extra keyword arguments passed will be passed through as keyword\n        arguments to the message constructor.\n\n        :param extra_context: Any additional context to use when rendering\n            templated content.\n        :type extra_context: :class:`dict`\n        :returns: A message instance.\n        :rtype: :attr:`.message_class`\n        \"\"\"\n        arg_4 = super(TemplatedHTMLEmailMessageView, arg_0)\\\n            .Func(arg_1, *arg_2, **arg_3)\n\n        if arg_1 is None:\n            arg_1 = {}\n\n        arg_5 = arg_0.get_context_data(**arg_1)\n        arg_6 = arg_0.render_html_body(arg_5)\n        arg_4.attach_alternative(arg_6, mimetype='text/html')\n        return arg_4", "path": "mailviews/messages.py", "identifier": "TemplatedHTMLEmailMessageView.render_to_message", "docstring": "Renders and returns an unsent message with the given context.\n\n        Any extra keyword arguments passed will be passed through as keyword\n        arguments to the message constructor.\n\n        :param extra_context: Any additional context to use when rendering\n            templated content.\n        :type extra_context: :class:`dict`\n        :returns: A message instance.\n        :rtype: :attr:`.message_class`", "docstring_tokens": ["Renders", "and", "returns", "an", "unsent", "message", "with", "the", "given", "context", "."], "nwo": "disqus/django-mailviews", "score": 0.31736401397382547, "idx": 256323}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completer.py#L225-L230", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Set the delimiters for line splitting.", "language": "python", "parameters": "(self, delims)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_2", "=", "'['", "+", "''", ".", "join", "(", "'\\\\'", "+", "c", "for", "c", "in", "Func", ")", "+", "']'", "arg_0", ".", "_delim_re", "=", "re", ".", "compile", "(", "arg_2", ")", "arg_0", ".", "_delims", "=", "Func", "arg_0", ".", "_delim_expr", "=", "arg_2"], "function": "def Func(arg_0, Func):\n        \"\"\"Set the delimiters for line splitting.\"\"\"\n        arg_2 = '[' + ''.join('\\\\'+ c for c in Func) + ']'\n        arg_0._delim_re = re.compile(arg_2)\n        arg_0._delims = Func\n        arg_0._delim_expr = arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/completer.py", "identifier": "CompletionSplitter.delims", "docstring": "Set the delimiters for line splitting.", "docstring_tokens": ["Set", "the", "delimiters", "for", "line", "splitting", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256324}
{"url": "https://github.com/Numergy/yoda/blob/109f0e9441130488b0155f05883ef6531cf46ee9/yoda/workspace.py#L66-L72", "sha": "109f0e9441130488b0155f05883ef6531cf46ee9", "docstring_summary": "Get workspace infos from name.\n        Return None if workspace doesn't exists.", "language": "python", "parameters": "(self, name)", "return_statement": "return ws_list[name] if name in ws_list else None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "list", "(", ")", "return", "arg_2", "[", "arg_1", "]", "if", "arg_1", "in", "arg_2", "else", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get workspace infos from name.\n        Return None if workspace doesn't exists.\n        \"\"\"\n        arg_2 = arg_0.list()\n        return arg_2[arg_1] if arg_1 in arg_2 else None", "path": "yoda/workspace.py", "identifier": "Workspace.get", "docstring": "Get workspace infos from name.\n        Return None if workspace doesn't exists.", "docstring_tokens": ["Get", "workspace", "infos", "from", "name", ".", "Return", "None", "if", "workspace", "doesn", "t", "exists", "."], "nwo": "Numergy/yoda", "score": 0.1832591465193378, "idx": 256325}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L709-L744", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Calculate the variance.", "language": "python", "parameters": "(nums, mean_func=amean, ddof=0)", "return_statement": "return sum((x - x_bar) ** 2 for x in nums) / (len(nums) - ddof)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "0", ")", ":", "arg_4", "=", "arg_1", "(", "arg_0", ")", "return", "sum", "(", "(", "arg_5", "-", "arg_4", ")", "**", "2", "for", "arg_5", "in", "arg_0", ")", "/", "(", "len", "(", "arg_0", ")", "-", "arg_3", ")"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=0):\n    r\"\"\"Calculate the Funciance.\n\n    The Funciance (:math:`\\sigma^2`) of a series of numbers (:math:`x_i`) with\n    mean :math:`\\mu` and population :math:`N` is:\n\n    :math:`\\sigma^2 = \\frac{1}{N}\\sum_{i=1}^{N}(x_i-\\mu)^2`.\n\n    Cf. https://en.wikipedia.org/wiki/Variance\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n    mean_func : function\n        A mean function (amean by default)\n    ddof : int\n        The degrees of freedom (0 by default)\n\n    Returns\n    -------\n    float\n        The Funciance of the values in the series\n\n    Examples\n    --------\n    >>> Func([1, 1, 1, 1])\n    0.0\n    >>> Func([1, 2, 3, 4])\n    1.25\n    >>> round(Func([1, 2, 3, 4], ddof=1), 12)\n    1.666666666667\n\n    \"\"\"\n    arg_4 = arg_1(arg_0)\n    return sum((arg_5 - arg_4) ** 2 for arg_5 in arg_0) / (len(arg_0) - arg_3)", "path": "abydos/stats/_mean.py", "identifier": "var", "docstring": "r\"\"\"Calculate the variance.\n\n    The variance (:math:`\\sigma^2`) of a series of numbers (:math:`x_i`) with\n    mean :math:`\\mu` and population :math:`N` is:\n\n    :math:`\\sigma^2 = \\frac{1}{N}\\sum_{i=1}^{N}(x_i-\\mu)^2`.\n\n    Cf. https://en.wikipedia.org/wiki/Variance\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n    mean_func : function\n        A mean function (amean by default)\n    ddof : int\n        The degrees of freedom (0 by default)\n\n    Returns\n    -------\n    float\n        The variance of the values in the series\n\n    Examples\n    --------\n    >>> var([1, 1, 1, 1])\n    0.0\n    >>> var([1, 2, 3, 4])\n    1.25\n    >>> round(var([1, 2, 3, 4], ddof=1), 12)\n    1.666666666667", "docstring_tokens": ["r", "Calculate", "the", "variance", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 256326}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/transforms/functional.py#L773-L798", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Convert image to grayscale version of image.", "language": "python", "parameters": "(img, num_output_channels=1)", "return_statement": "return img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "if", "not", "_is_pil_image", "(", "arg_0", ")", ":", "raise", "TypeError", "(", "'img should be PIL Image. Got {}'", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")", "if", "arg_1", "==", "1", ":", "arg_0", "=", "arg_0", ".", "convert", "(", "'L'", ")", "elif", "arg_1", "==", "3", ":", "arg_0", "=", "arg_0", ".", "convert", "(", "'L'", ")", "arg_2", "=", "np", ".", "array", "(", "arg_0", ",", "dtype", "=", "np", ".", "uint8", ")", "arg_2", "=", "np", ".", "dstack", "(", "[", "arg_2", ",", "arg_2", ",", "arg_2", "]", ")", "arg_0", "=", "Image", ".", "fromarray", "(", "arg_2", ",", "'RGB'", ")", "else", ":", "raise", "ValueError", "(", "'num_output_channels should be either 1 or 3'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=1):\n    \"\"\"Convert image to grayscale version of image.\n\n    Args:\n        img (PIL Image): Image to be converted to grayscale.\n\n    Returns:\n        PIL Image: Grayscale version of the image.\n            if num_output_channels = 1 : returned image is single channel\n\n            if num_output_channels = 3 : returned image is 3 channel with r = g = b\n    \"\"\"\n    if not _is_pil_image(arg_0):\n        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))\n\n    if arg_1 == 1:\n        arg_0 = arg_0.convert('L')\n    elif arg_1 == 3:\n        arg_0 = arg_0.convert('L')\n        arg_2 = np.array(arg_0, dtype=np.uint8)\n        arg_2 = np.dstack([arg_2, arg_2, arg_2])\n        arg_0 = Image.fromarray(arg_2, 'RGB')\n    else:\n        raise ValueError('num_output_channels should be either 1 or 3')\n\n    return arg_0", "path": "torchvision/transforms/functional.py", "identifier": "to_grayscale", "docstring": "Convert image to grayscale version of image.\n\n    Args:\n        img (PIL Image): Image to be converted to grayscale.\n\n    Returns:\n        PIL Image: Grayscale version of the image.\n            if num_output_channels = 1 : returned image is single channel\n\n            if num_output_channels = 3 : returned image is 3 channel with r = g = b", "docstring_tokens": ["Convert", "image", "to", "grayscale", "version", "of", "image", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 256327}
{"url": "https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/address.py#L45-L48", "sha": "e15f2e59538deb4cbfceaac314f5ea897f2d5450", "docstring_summary": "Return a random street number.", "language": "python", "parameters": "()", "return_statement": "return ''.join(random.sample(string.digits, length))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "int", "(", "random", ".", "choice", "(", "string", ".", "digits", "[", "1", ":", "6", "]", ")", ")", "return", "''", ".", "join", "(", "random", ".", "sample", "(", "string", ".", "digits", ",", "arg_0", ")", ")"], "function": "def Func():\n    \"\"\"Return a random street number.\"\"\"\n    arg_0 = int(random.choice(string.digits[1:6]))\n    return ''.join(random.sample(string.digits, arg_0))", "path": "forgery_py/forgery/address.py", "identifier": "street_number", "docstring": "Return a random street number.", "docstring_tokens": ["Return", "a", "random", "street", "number", "."], "nwo": "pilosus/ForgeryPy3", "score": 0.3588333959790546, "idx": 256328}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/joint_distribution_sequential.py#L38-L46", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Factory for making summary statistics, eg, mean, mode, stddev.", "language": "python", "parameters": "(attr)", "return_statement": "return _fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_fn", "(", "arg_1", ")", ":", "if", "any", "(", "arg_1", ".", "_dist_fn_args", ")", ":", "raise", "ValueError", "(", "'Can only compute '", "+", "arg_0", "+", "' when all distributions are '", "'independent; {}'", ".", "format", "(", "arg_1", ".", "model", ")", ")", "return", "arg_1", ".", "_unflatten", "(", "getattr", "(", "arg_2", "(", ")", ",", "arg_0", ")", "(", ")", "for", "arg_2", "in", "arg_1", ".", "_dist_fn_wrapped", ")", "return", "_fn"], "function": "def Func(arg_0):\n  \"\"\"Factory for making summary statistics, eg, mean, mode, stddev.\"\"\"\n  def _fn(arg_1):\n    if any(arg_1._dist_fn_args):  # pylint: disable=protected-access\n      raise ValueError(\n          'Can only compute ' + arg_0 + ' when all distributions are '\n          'independent; {}'.format(arg_1.model))\n    return arg_1._unflatten(getattr(arg_2(), arg_0)() for arg_2 in arg_1._dist_fn_wrapped)  # pylint: disable=protected-access\n  return _fn", "path": "tensorflow_probability/python/distributions/joint_distribution_sequential.py", "identifier": "_make_summary_statistic", "docstring": "Factory for making summary statistics, eg, mean, mode, stddev.", "docstring_tokens": ["Factory", "for", "making", "summary", "statistics", "eg", "mean", "mode", "stddev", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256329}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2466-L2472", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a dictionary containing pickle dumps", "language": "python", "parameters": "(self)", "return_statement": "return store_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "_data", ".", "items", "(", ")", ":", "arg_1", "[", "arg_2", "]", "=", "pickle", ".", "dumps", "(", "arg_3", ",", "protocol", "=", "arg_0", ".", "v_protocol", ")", "arg_1", "[", "arg_4", ".", "PROTOCOL", "]", "=", "arg_0", ".", "v_protocol", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns a dictionary containing pickle dumps\"\"\"\n        arg_1 = {}\n        for arg_2, arg_3 in arg_0._data.items():\n            arg_1[arg_2] = pickle.dumps(arg_3, protocol=arg_0.v_protocol)\n        arg_1[arg_4.PROTOCOL] = arg_0.v_protocol\n        return arg_1", "path": "pypet/parameter.py", "identifier": "PickleResult._store", "docstring": "Returns a dictionary containing pickle dumps", "docstring_tokens": ["Returns", "a", "dictionary", "containing", "pickle", "dumps"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256330}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/masked_autoregressive.py#L306-L320", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Generate the slices for building an autoregressive mask.", "language": "python", "parameters": "(num_blocks, n_in, n_out, mask_type=MASK_EXCLUSIVE)", "return_statement": "return slices", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ")", ":", "arg_5", "=", "[", "]", "arg_6", "=", "0", "arg_7", "=", "arg_1", "//", "arg_0", "arg_8", "=", "arg_2", "//", "arg_0", "arg_9", "=", "arg_8", "if", "arg_3", "==", "arg_4", "else", "0", "for", "arg_10", "in", "range", "(", "arg_0", ")", ":", "arg_11", "=", "slice", "(", "arg_9", ",", "None", ")", "arg_12", "=", "slice", "(", "arg_6", ",", "arg_6", "+", "arg_7", ")", "arg_5", ".", "append", "(", "[", "arg_11", ",", "arg_12", "]", ")", "arg_6", "+=", "arg_7", "arg_9", "+=", "arg_8", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4):\n  \"\"\"Generate the slices for building an autoregressive mask.\"\"\"\n  # TODO(b/67594795): Better support of dynamic shape.\n  arg_5 = []\n  arg_6 = 0\n  arg_7 = arg_1 // arg_0\n  arg_8 = arg_2 // arg_0\n  arg_9 = arg_8 if arg_3 == arg_4 else 0\n  for arg_10 in range(arg_0):\n    arg_11 = slice(arg_9, None)\n    arg_12 = slice(arg_6, arg_6 + arg_7)\n    arg_5.append([arg_11, arg_12])\n    arg_6 += arg_7\n    arg_9 += arg_8\n  return arg_5", "path": "tensorflow_probability/python/bijectors/masked_autoregressive.py", "identifier": "_gen_slices", "docstring": "Generate the slices for building an autoregressive mask.", "docstring_tokens": ["Generate", "the", "slices", "for", "building", "an", "autoregressive", "mask", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256331}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2449-L2468", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Specify the client's ALPN protocol list.", "language": "python", "parameters": "(self, protos)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "b''", ".", "join", "(", "chain", ".", "from_iterable", "(", "(", "int2byte", "(", "len", "(", "p", ")", ")", ",", "p", ")", "for", "p", "in", "arg_1", ")", ")", "arg_3", "=", "_ffi", ".", "new", "(", "\"unsigned char[]\"", ",", "arg_2", ")", "_lib", ".", "SSL_Func", "(", "arg_0", ".", "_ssl", ",", "arg_3", ",", "len", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Specify the client's ALPN protocol list.\n\n        These protocols are offered to the server during protocol negotiation.\n\n        :param protos: A list of the protocols to be offered to the server.\n            This list should be a Python list of bytestrings representing the\n            protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``.\n        \"\"\"\n        # Take the list of protocols and join them together, prefixing them\n        # with their lengths.\n        arg_2 = b''.join(\n            chain.from_iterable((int2byte(len(p)), p) for p in arg_1)\n        )\n\n        # Build a C string from the list. We don't need to save this off\n        # because OpenSSL immediately copies the data out.\n        arg_3 = _ffi.new(\"unsigned char[]\", arg_2)\n        _lib.SSL_Func(arg_0._ssl, arg_3, len(arg_2))", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.set_alpn_protos", "docstring": "Specify the client's ALPN protocol list.\n\n        These protocols are offered to the server during protocol negotiation.\n\n        :param protos: A list of the protocols to be offered to the server.\n            This list should be a Python list of bytestrings representing the\n            protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``.", "docstring_tokens": ["Specify", "the", "client", "s", "ALPN", "protocol", "list", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256332}
{"url": "https://github.com/snjoetw/py-synology/blob/4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f/synology/api.py#L186-L200", "sha": "4f7eb0a3a9f86c24ad65993802e6fb11fbaa1f7f", "docstring_summary": "Disable camera.", "language": "python", "parameters": "(self, camera_id, **kwargs)", "return_statement": "return response['success']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_api_info", "[", "'camera'", "]", "arg_4", "=", "dict", "(", "{", "'_sid'", ":", "arg_0", ".", "_sid", ",", "'api'", ":", "arg_3", "[", "'name'", "]", ",", "'method'", ":", "'Disable'", ",", "'version'", ":", "9", ",", "'idList'", ":", "arg_1", ",", "}", ",", "**", "arg_2", ")", "print", "(", "arg_3", "[", "'url'", "]", ")", "print", "(", "arg_4", ")", "arg_5", "=", "arg_0", ".", "_get", "(", "arg_3", "[", "'url'", "]", ",", "arg_4", ")", "return", "arg_5", "[", "'success'", "]"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Disable camera.\"\"\"\n        arg_3 = arg_0._api_info['camera']\n        arg_4 = dict({\n            '_sid': arg_0._sid,\n            'api': arg_3['name'],\n            'method': 'Disable',\n            'version': 9,\n            'idList': arg_1,\n        }, **arg_2)\n        print(arg_3['url'])\n        print(arg_4)\n        arg_5 = arg_0._get(arg_3['url'], arg_4)\n\n        return arg_5['success']", "path": "synology/api.py", "identifier": "Api.camera_disable", "docstring": "Disable camera.", "docstring_tokens": ["Disable", "camera", "."], "nwo": "snjoetw/py-synology", "score": 0.28899999164266604, "idx": 256333}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/elements.py#L691-L731", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Basic formula serializer to construct a consistently-formatted formula.\n    This is necessary for handling user-supplied formulas, which are not always\n    well formatted.", "language": "python", "parameters": "(formula)", "return_statement": "return base", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "charge_from_formula", "(", "arg_0", ")", "arg_2", "=", "nested_formula_parser", "(", "arg_0", ")", "arg_3", "=", "atoms_to_Hill", "(", "arg_2", ")", "if", "arg_1", "==", "0", ":", "pass", "elif", "arg_1", ">", "0", ":", "if", "arg_1", "==", "1", ":", "arg_3", "+=", "'+'", "else", ":", "arg_3", "+=", "'+'", "+", "str", "(", "arg_1", ")", "elif", "arg_1", "<", "0", ":", "if", "arg_1", "==", "-", "1", ":", "arg_3", "+=", "'-'", "else", ":", "arg_3", "+=", "str", "(", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    r'''Basic formula serializer to construct a consistently-formatted formula.\n    This is necessary for handling user-supplied formulas, which are not always\n    well formatted.\n\n    Performs no sanity checking that elements are actually elements.\n    \n    Parameters\n    ----------\n    formula : str\n        Formula string as parseable by the method nested_formula_parser, [-]\n\n    Returns\n    -------\n    formula : str\n        A consistently formatted formula to describe a molecular formula, [-]\n\n    Notes\n    -----\n\n    Examples\n    --------\n    >>> Func('Pd(NH3)4+3')\n    'H12N4Pd+3'\n    '''\n    arg_1 = charge_from_formula(arg_0)\n    arg_2 = nested_formula_parser(arg_0)\n    arg_3 = atoms_to_Hill(arg_2)\n    if arg_1  == 0:\n        pass\n    elif arg_1 > 0:\n        if arg_1 == 1:\n            arg_3 += '+'\n        else:\n            arg_3 += '+' + str(arg_1)\n    elif arg_1 < 0:\n        if arg_1 == -1:\n            arg_3 += '-'\n        else:\n            arg_3 +=  str(arg_1)\n    return arg_3", "path": "thermo/elements.py", "identifier": "serialize_formula", "docstring": "r'''Basic formula serializer to construct a consistently-formatted formula.\n    This is necessary for handling user-supplied formulas, which are not always\n    well formatted.\n\n    Performs no sanity checking that elements are actually elements.\n    \n    Parameters\n    ----------\n    formula : str\n        Formula string as parseable by the method nested_formula_parser, [-]\n\n    Returns\n    -------\n    formula : str\n        A consistently formatted formula to describe a molecular formula, [-]\n\n    Notes\n    -----\n\n    Examples\n    --------\n    >>> serialize_formula('Pd(NH3)4+3')\n    'H12N4Pd+3'", "docstring_tokens": ["r", "Basic", "formula", "serializer", "to", "construct", "a", "consistently", "-", "formatted", "formula", ".", "This", "is", "necessary", "for", "handling", "user", "-", "supplied", "formulas", "which", "are", "not", "always", "well", "formatted", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256334}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/ecdsa.py#L80-L123", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Recover the public key from the the signature", "language": "python", "parameters": "(digest, signature, i, message=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "ecdsa", ".", "SECP256k1", ".", "curve", "arg_5", "=", "ecdsa", ".", "SECP256k1", ".", "generator", "arg_6", "=", "ecdsa", ".", "SECP256k1", ".", "order", "arg_7", "=", "arg_2", "%", "2", "arg_8", ",", "arg_9", "=", "ecdsa", ".", "util", ".", "sigdecode_string", "(", "arg_1", ",", "arg_6", ")", "arg_10", "=", "arg_8", "+", "(", "arg_2", "//", "2", ")", "*", "arg_6", "arg_11", "=", "(", "(", "arg_10", "*", "arg_10", "*", "arg_10", ")", "+", "(", "arg_4", ".", "a", "(", ")", "*", "arg_10", ")", "+", "arg_4", ".", "b", "(", ")", ")", "%", "arg_4", ".", "p", "(", ")", "arg_12", "=", "ecdsa", ".", "numbertheory", ".", "square_root_mod_prime", "(", "arg_11", ",", "arg_4", ".", "p", "(", ")", ")", "arg_13", "=", "arg_12", "if", "(", "arg_12", "-", "arg_7", ")", "%", "2", "==", "0", "else", "arg_4", ".", "p", "(", ")", "-", "arg_12", "arg_14", "=", "ecdsa", ".", "ellipticcurve", ".", "Point", "(", "arg_4", ",", "arg_10", ",", "arg_13", ",", "arg_6", ")", "arg_15", "=", "ecdsa", ".", "util", ".", "string_to_number", "(", "arg_0", ")", "arg_16", "=", "ecdsa", ".", "numbertheory", ".", "inverse_mod", "(", "arg_8", ",", "arg_6", ")", "*", "(", "arg_9", "*", "arg_14", "+", "(", "-", "arg_15", "%", "arg_6", ")", "*", "arg_5", ")", "if", "SECP256K1_MODULE", "==", "\"cryptography\"", "and", "arg_3", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_3", ",", "bytes", ")", ":", "arg_3", "=", "bytes", "(", "arg_3", ",", "\"utf-8\"", ")", "arg_17", "=", "encode_dss_signature", "(", "arg_8", ",", "arg_9", ")", "arg_18", "=", "ec", ".", "EllipticCurvePublicNumbers", "(", "arg_16", ".", "_Point__x", ",", "arg_16", ".", "_Point__y", ",", "ec", ".", "SECP256K1", "(", ")", ")", ".", "public_key", "(", "default_backend", "(", ")", ")", "arg_18", ".", "verify", "(", "arg_17", ",", "arg_3", ",", "ec", ".", "ECDSA", "(", "hashes", ".", "SHA256", "(", ")", ")", ")", "return", "arg_18", "else", ":", "if", "not", "ecdsa", ".", "VerifyingKey", ".", "from_public_point", "(", "arg_16", ",", "arg_4", "=", "ecdsa", ".", "SECP256k1", ")", ".", "verify_digest", "(", "arg_1", ",", "arg_0", ",", "sigdecode", "=", "ecdsa", ".", "util", ".", "sigdecode_string", ")", ":", "return", "None", "return", "ecdsa", ".", "VerifyingKey", ".", "from_public_point", "(", "arg_16", ",", "arg_4", "=", "ecdsa", ".", "SECP256k1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\" Recover the public key from the the signature\n    \"\"\"\n\n    # See http: //www.secg.org/download/aid-780/sec1-v2.pdf section 4.1.6 primarily\n    arg_4 = ecdsa.SECP256k1.curve\n    arg_5 = ecdsa.SECP256k1.generator\n    arg_6 = ecdsa.SECP256k1.order\n    arg_7 = arg_2 % 2\n    arg_8, arg_9 = ecdsa.util.sigdecode_string(arg_1, arg_6)\n    # 1.1\n    arg_10 = arg_8 + (arg_2 // 2) * arg_6\n    # 1.3. This actually calculates for either effectively 02||X or 03||X depending on 'k' instead of always for 02||X as specified.\n    # This substitutes for the lack of reversing R later on. -R actually is defined to be just flipping the y-coordinate in the elliptic curve.\n    arg_11 = ((arg_10 * arg_10 * arg_10) + (arg_4.a() * arg_10) + arg_4.b()) % arg_4.p()\n    arg_12 = ecdsa.numbertheory.square_root_mod_prime(arg_11, arg_4.p())\n    arg_13 = arg_12 if (arg_12 - arg_7) % 2 == 0 else arg_4.p() - arg_12\n    # 1.4 Constructor of Point is supposed to check if nR is at infinity.\n    arg_14 = ecdsa.ellipticcurve.Point(arg_4, arg_10, arg_13, arg_6)\n    # 1.5 Compute e\n    arg_15 = ecdsa.util.string_to_number(arg_0)\n    # 1.6 Compute Q = r^-1(sR - eG)\n    arg_16 = ecdsa.numbertheory.inverse_mod(arg_8, arg_6) * (arg_9 * arg_14 + (-arg_15 % arg_6) * arg_5)\n\n    if SECP256K1_MODULE == \"cryptography\" and arg_3 is not None:\n        if not isinstance(arg_3, bytes):\n            arg_3 = bytes(arg_3, \"utf-8\")  # pragma: no cover\n        arg_17 = encode_dss_signature(arg_8, arg_9)\n        arg_18 = ec.EllipticCurvePublicNumbers(\n            arg_16._Point__x, arg_16._Point__y, ec.SECP256K1()\n        ).public_key(default_backend())\n        arg_18.verify(arg_17, arg_3, ec.ECDSA(hashes.SHA256()))\n        return arg_18\n    else:\n        # Not strictly necessary, but let's verify the message for paranoia's sake.\n        if not ecdsa.VerifyingKey.from_public_point(\n            arg_16, arg_4=ecdsa.SECP256k1\n        ).verify_digest(\n            arg_1, arg_0, sigdecode=ecdsa.util.sigdecode_string\n        ):  # pragma: no cover\n            return None  # pragma: no cover\n        return ecdsa.VerifyingKey.from_public_point(\n            arg_16, arg_4=ecdsa.SECP256k1\n        )", "path": "graphenebase/ecdsa.py", "identifier": "recover_public_key", "docstring": "Recover the public key from the the signature", "docstring_tokens": ["Recover", "the", "public", "key", "from", "the", "the", "signature"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 256335}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm.py#L1927-L1973", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Update the inference active state from the last set of predictions\n    and the current bottom-up.", "language": "python", "parameters": "(self, activeColumns, useStartCells)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "infActiveState", "[", "'t'", "]", ".", "fill", "(", "0", ")", "arg_3", "=", "0", "if", "arg_2", ":", "for", "arg_4", "in", "arg_1", ":", "arg_0", ".", "infActiveState", "[", "'t'", "]", "[", "arg_4", ",", "0", "]", "=", "1", "else", ":", "for", "arg_4", "in", "arg_1", ":", "arg_6", "=", "numpy", ".", "where", "(", "arg_0", ".", "infPredictedState", "[", "'t-1'", "]", "[", "arg_4", "]", "==", "1", ")", "[", "0", "]", "arg_7", "=", "len", "(", "arg_6", ")", "if", "arg_7", ">", "0", ":", "arg_0", ".", "infActiveState", "[", "'t'", "]", "[", "arg_4", ",", "arg_6", "]", "=", "1", "arg_3", "+=", "1", "else", ":", "arg_0", ".", "infActiveState", "[", "'t'", "]", "[", "arg_4", ",", ":", "]", "=", "1", "if", "arg_2", "or", "arg_3", ">=", "0.50", "*", "len", "(", "arg_1", ")", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Update the inference active state from the last set of predictions\n    and the current bottom-up.\n\n    This looks at:\n        - ``infPredictedState['t-1']``\n    This modifies:\n        - ``infActiveState['t']``\n\n    :param activeColumns: (list) active bottom-ups\n    :param useStartCells: (bool) If true, ignore previous predictions and simply \n           turn on the start cells in the active columns\n    :returns: (bool) True if the current input was sufficiently predicted, OR if \n           we started over on startCells. False indicates that the current input \n           was NOT predicted, and we are now bursting on most columns.\n    \"\"\"\n    # Init to zeros to start\n    arg_0.infActiveState['t'].fill(0)\n\n    # Phase 1 - turn on predicted cells in each column receiving bottom-up\n    # If we are following a reset, activate only the start cell in each\n    # column that has bottom-up\n    arg_3 = 0\n    if arg_2:\n      for arg_4 in arg_1:\n        arg_0.infActiveState['t'][arg_4, 0] = 1\n\n    # else, turn on any predicted cells in each column. If there are none, then\n    # turn on all cells (burst the column)\n    else:\n      for arg_4 in arg_1:\n        arg_6 = numpy.where(arg_0.infPredictedState['t-1'][arg_4] == 1)[0]\n        arg_7 = len(arg_6)\n\n        if arg_7 > 0:\n          arg_0.infActiveState['t'][arg_4, arg_6] = 1\n          arg_3 += 1\n\n        else:\n          arg_0.infActiveState['t'][arg_4, :] = 1 # whole column bursts\n\n    # Did we predict this input well enough?\n    if arg_2 or arg_3 >= 0.50 * len(arg_1):\n      return True\n    else:\n      return False", "path": "src/nupic/algorithms/backtracking_tm.py", "identifier": "BacktrackingTM._inferPhase1", "docstring": "Update the inference active state from the last set of predictions\n    and the current bottom-up.\n\n    This looks at:\n        - ``infPredictedState['t-1']``\n    This modifies:\n        - ``infActiveState['t']``\n\n    :param activeColumns: (list) active bottom-ups\n    :param useStartCells: (bool) If true, ignore previous predictions and simply \n           turn on the start cells in the active columns\n    :returns: (bool) True if the current input was sufficiently predicted, OR if \n           we started over on startCells. False indicates that the current input \n           was NOT predicted, and we are now bursting on most columns.", "docstring_tokens": ["Update", "the", "inference", "active", "state", "from", "the", "last", "set", "of", "predictions", "and", "the", "current", "bottom", "-", "up", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256336}
{"url": "https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/psd.py#L35-L44", "sha": "46e12659b8d08af764dc09a1f31b0e85a68f808f", "docstring_summary": "Set center frequency and clear averaged PSD data", "language": "python", "parameters": "(self, center_freq)", "return_statement": "return psd_state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'repeats'", ":", "0", ",", "'freq_array'", ":", "arg_0", ".", "_base_freq_array", "+", "arg_0", ".", "_lnb_lo", "+", "arg_1", ",", "'pwr_array'", ":", "None", ",", "'update_lock'", ":", "threading", ".", "Lock", "(", ")", ",", "'futures'", ":", "[", "]", ",", "}", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set center frequency and clear averaged PSD data\"\"\"\n        arg_2 = {\n            'repeats': 0,\n            'freq_array': arg_0._base_freq_array + arg_0._lnb_lo + arg_1,\n            'pwr_array': None,\n            'update_lock': threading.Lock(),\n            'futures': [],\n        }\n        return arg_2", "path": "soapypower/psd.py", "identifier": "PSD.set_center_freq", "docstring": "Set center frequency and clear averaged PSD data", "docstring_tokens": ["Set", "center", "frequency", "and", "clear", "averaged", "PSD", "data"], "nwo": "xmikos/soapy_power", "score": 0.1984218952631984, "idx": 256337}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L97-L108", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Converts message to an object according to Proto3 JSON Specification.", "language": "python", "parameters": "(message, including_default_value_fields)", "return_statement": "return _RegularMessageToJsonObject(\n      message, js, including_default_value_fields)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "DESCRIPTOR", "arg_3", "=", "arg_2", ".", "full_name", "if", "_IsWrapperMessage", "(", "arg_2", ")", ":", "return", "_WrapperMessageToJsonObject", "(", "arg_0", ")", "if", "arg_3", "in", "_WKTJSONMETHODS", ":", "return", "_WKTJSONMETHODS", "[", "arg_3", "]", "[", "0", "]", "(", "arg_0", ",", "arg_1", ")", "arg_4", "=", "{", "}", "return", "_RegularMessageToJsonObject", "(", "arg_0", ",", "arg_4", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Converts message to an object according to Proto3 JSON Specification.\"\"\"\n  arg_2 = arg_0.DESCRIPTOR\n  arg_3 = arg_2.full_name\n  if _IsWrapperMessage(arg_2):\n    return _WrapperMessageToJsonObject(arg_0)\n  if arg_3 in _WKTJSONMETHODS:\n    return _WKTJSONMETHODS[arg_3][0](\n        arg_0, arg_1)\n  arg_4 = {}\n  return _RegularMessageToJsonObject(\n      arg_0, arg_4, arg_1)", "path": "typy/google/protobuf/json_format.py", "identifier": "_MessageToJsonObject", "docstring": "Converts message to an object according to Proto3 JSON Specification.", "docstring_tokens": ["Converts", "message", "to", "an", "object", "according", "to", "Proto3", "JSON", "Specification", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 256338}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/opengl/vao.py#L296-L311", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Destroy the vao object", "language": "python", "parameters": "(self, buffer=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "vaos", ":", "arg_3", ".", "Func", "(", ")", "if", "arg_1", ":", "for", "arg_4", "in", "arg_0", ".", "buffers", ":", "arg_4", ".", "buffer", ".", "Func", "(", ")", "if", "arg_0", ".", "_index_buffer", ":", "arg_0", ".", "_index_buffer", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"\n        Destroy the vao object\n\n        Keyword Args:\n            buffers (bool): also Func buffers\n        \"\"\"\n        for arg_2, arg_3 in arg_0.vaos:\n            arg_3.Func()\n\n        if arg_1:\n            for arg_4 in arg_0.buffers:\n                arg_4.buffer.Func()\n\n            if arg_0._index_buffer:\n                arg_0._index_buffer.Func()", "path": "demosys/opengl/vao.py", "identifier": "VAO.release", "docstring": "Destroy the vao object\n\n        Keyword Args:\n            buffers (bool): also release buffers", "docstring_tokens": ["Destroy", "the", "vao", "object"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 256339}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/ogg.py#L165-L177", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Total frame size.", "language": "python", "parameters": "(self)", "return_statement": "return header_size", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "27", "for", "arg_2", "in", "arg_0", ".", "packets", ":", "arg_3", ",", "arg_4", "=", "divmod", "(", "len", "(", "arg_2", ")", ",", "255", ")", "arg_1", "+=", "arg_3", "+", "1", "if", "not", "arg_0", ".", "complete", "and", "arg_4", "==", "0", ":", "arg_1", "-=", "1", "arg_1", "+=", "sum", "(", "map", "(", "len", ",", "arg_0", ".", "packets", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Total frame Func.\"\"\"\n\n        arg_1 = 27 # Initial header Func\n        for arg_2 in arg_0.packets:\n            arg_3, arg_4 = divmod(len(arg_2), 255)\n            arg_1 += arg_3 + 1\n        if not arg_0.complete and arg_4 == 0:\n            # Packet contains a multiple of 255 bytes and is not\n            # terminated, so we don't have a \\x00 at the end.\n            arg_1 -= 1\n        arg_1 += sum(map(len, arg_0.packets))\n        return arg_1", "path": "mutagen/ogg.py", "identifier": "OggPage.size", "docstring": "Total frame size.", "docstring_tokens": ["Total", "frame", "size", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 256340}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/metrics/accuracy.py#L94-L108", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Rounds predictions and calculates accuracy in terms of absolute coincidence.", "language": "python", "parameters": "(y_true, y_predicted)", "return_statement": "return correct / examples_len if examples_len else 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "round", "(", "x", ")", "for", "x", "in", "arg_1", "]", "arg_3", "=", "len", "(", "arg_0", ")", "arg_4", "=", "sum", "(", "[", "y1", "==", "y2", "for", "y1", ",", "y2", "in", "zip", "(", "arg_0", ",", "arg_2", ")", "]", ")", "return", "arg_4", "/", "arg_3", "if", "arg_3", "else", "0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Rounds predictions and calculates accuracy in terms of absolute coincidence.\n\n    Args:\n        y_true: list of true values\n        y_predicted: list of predicted values\n\n    Returns:\n        portion of absolutely coincidental samples\n    \"\"\"\n    arg_2 = [round(x) for x in arg_1]\n    arg_3 = len(arg_0)\n    arg_4 = sum([y1 == y2 for y1, y2 in zip(arg_0, arg_2)])\n    return arg_4 / arg_3 if arg_3 else 0", "path": "deeppavlov/metrics/accuracy.py", "identifier": "round_accuracy", "docstring": "Rounds predictions and calculates accuracy in terms of absolute coincidence.\n\n    Args:\n        y_true: list of true values\n        y_predicted: list of predicted values\n\n    Returns:\n        portion of absolutely coincidental samples", "docstring_tokens": ["Rounds", "predictions", "and", "calculates", "accuracy", "in", "terms", "of", "absolute", "coincidence", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 256341}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/statemaker_example.py#L61-L86", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Calculates an ilm order based on the shape of an image. This is based on\n    something that works for our particular images. Your mileage will vary.", "language": "python", "parameters": "(imshape)", "return_statement": "return npts, zorder", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "int", "(", "arg_0", "[", "0", "]", "/", "6.25", ")", "+", "1", "arg_2", "=", "int", "(", "arg_0", "[", "1", "]", "/", "42.5", ")", "+", "1", "arg_3", "=", "(", ")", "for", "arg_4", "in", "range", "(", "arg_2", ")", ":", "if", "arg_4", "<", "5", ":", "arg_3", "+=", "(", "int", "(", "arg_0", "[", "2", "]", "*", "[", "59", ",", "39", ",", "29", ",", "19", ",", "14", "]", "[", "arg_4", "]", "/", "512.", ")", "+", "1", ",", ")", "else", ":", "arg_3", "+=", "(", "int", "(", "arg_0", "[", "2", "]", "*", "11", "/", "512.", ")", "+", "1", ",", ")", "return", "arg_3", ",", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Calculates an ilm order based on the shape of an image. This is based on\n    something that works for our particular images. Your mileage will vary.\n\n    Parameters\n    ----------\n        imshape : 3-element list-like\n            The shape of the image.\n\n    Returns\n    -------\n        npts : tuple\n            The number of points to use for the ilm.\n        zorder : int\n            The order of the z-polynomial.\n    \"\"\"\n    arg_1 = int(arg_0[0] / 6.25) + 1\n    arg_2 = int(arg_0[1] / 42.5)+1\n    arg_3 = ()\n    for arg_4 in range(arg_2):\n        if arg_4 < 5:\n            arg_3 += (int(arg_0[2] * [59, 39, 29, 19, 14][arg_4]/512.) + 1,)\n        else:\n            arg_3 += (int(arg_0[2] * 11/512.) + 1,)\n    return arg_3, arg_1", "path": "scripts/statemaker_example.py", "identifier": "_calc_ilm_order", "docstring": "Calculates an ilm order based on the shape of an image. This is based on\n    something that works for our particular images. Your mileage will vary.\n\n    Parameters\n    ----------\n        imshape : 3-element list-like\n            The shape of the image.\n\n    Returns\n    -------\n        npts : tuple\n            The number of points to use for the ilm.\n        zorder : int\n            The order of the z-polynomial.", "docstring_tokens": ["Calculates", "an", "ilm", "order", "based", "on", "the", "shape", "of", "an", "image", ".", "This", "is", "based", "on", "something", "that", "works", "for", "our", "particular", "images", ".", "Your", "mileage", "will", "vary", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 256342}
{"url": "https://github.com/anentropic/dirtyebay/blob/c3194932360445563cfe0c7e034e41f09358c7eb/dirtyebay/utils.py#L129-L156", "sha": "c3194932360445563cfe0c7e034e41f09358c7eb", "docstring_summary": "Returns an XSD-schema-enabled lxml parser from a WSDL or XSD", "language": "python", "parameters": "(schema_url, require_version=True)", "return_statement": "return objectify.makeparser(schema=schema), version", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "etree", ".", "parse", "(", "arg_0", ")", "def", "get_version", "(", "arg_3", ",", "arg_4", ")", ":", "try", ":", "return", "arg_4", "(", "arg_3", ")", "except", "VersionNotFound", ":", "if", "arg_1", ":", "raise", "else", ":", "return", "None", "arg_5", "=", "arg_2", ".", "getroot", "(", ")", "if", "arg_5", ".", "tag", "==", "'{%s}definitions'", "%", "namespaces", ".", "WSDL", ":", "arg_6", "=", "arg_2", ".", "find", "(", "'wsdl:types/xs:schema'", ",", "namespaces", "=", "NS_MAP", ")", "arg_7", "=", "get_version", "(", "arg_5", ",", "version_from_wsdl", ")", "else", ":", "arg_6", "=", "arg_5", "arg_7", "=", "get_version", "(", "arg_6", ",", "version_from_schema", ")", "arg_8", "=", "etree", ".", "XMLSchema", "(", "arg_6", ")", "return", "objectify", ".", "makeparser", "(", "arg_8", "=", "arg_8", ")", ",", "arg_7"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"\n    Returns an XSD-schema-enabled lxml parser from a WSDL or XSD\n\n    `schema_url` can of course be local path via file:// url\n    \"\"\"\n    arg_2 = etree.parse(arg_0)\n\n    def get_version(arg_3, arg_4):\n        try:\n            return arg_4(arg_3)\n        except VersionNotFound:\n            if arg_1:\n                raise\n            else:\n                return None\n\n    arg_5 = arg_2.getroot()\n    if arg_5.tag == '{%s}definitions' % namespaces.WSDL:\n        # wsdl should contain an embedded schema\n        arg_6 = arg_2.find('wsdl:types/xs:schema', namespaces=NS_MAP)\n        arg_7 = get_version(arg_5, version_from_wsdl)\n    else:\n        arg_6 = arg_5\n        arg_7 = get_version(arg_6, version_from_schema)\n\n    arg_8 = etree.XMLSchema(arg_6)\n    return objectify.makeparser(arg_8=arg_8), arg_7", "path": "dirtyebay/utils.py", "identifier": "parser_from_schema", "docstring": "Returns an XSD-schema-enabled lxml parser from a WSDL or XSD\n\n    `schema_url` can of course be local path via file:// url", "docstring_tokens": ["Returns", "an", "XSD", "-", "schema", "-", "enabled", "lxml", "parser", "from", "a", "WSDL", "or", "XSD"], "nwo": "anentropic/dirtyebay", "score": 0.0, "idx": 256343}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/consensus/manager.py#L499-L505", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "the last block proposal node voted on", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "rounds", ":", "if", "isinstance", "(", "arg_0", ".", "rounds", "[", "arg_1", "]", ".", "proposal", ",", "BlockProposal", ")", ":", "assert", "isinstance", "(", "arg_0", ".", "rounds", "[", "arg_1", "]", ".", "lock", ",", "Vote", ")", "if", "arg_0", ".", "rounds", "[", "arg_1", "]", ".", "proposal", ".", "blockhash", "==", "arg_0", ".", "rounds", "[", "arg_1", "]", ".", "lock", ".", "blockhash", ":", "return", "arg_0", ".", "rounds", "[", "arg_1", "]", ".", "proposal"], "function": "def Func(arg_0):\n        \"the last block proposal node voted on\"\n        for arg_1 in arg_0.rounds:\n            if isinstance(arg_0.rounds[arg_1].proposal, BlockProposal):\n                assert isinstance(arg_0.rounds[arg_1].lock, Vote)\n                if arg_0.rounds[arg_1].proposal.blockhash == arg_0.rounds[arg_1].lock.blockhash:\n                    return arg_0.rounds[arg_1].proposal", "path": "hydrachain/consensus/manager.py", "identifier": "HeightManager.last_voted_blockproposal", "docstring": "the last block proposal node voted on", "docstring_tokens": ["the", "last", "block", "proposal", "node", "voted", "on"], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 256344}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/sigproc.py#L198-L240", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Apply a quick patch-up to a Filterbank header by overwriting a header value", "language": "python", "parameters": "(filename, keyword, new_value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "read_header", "(", "arg_0", ")", "arg_4", "=", "read_header", "(", "arg_0", ",", "return_idxs", "=", "True", ")", "arg_5", "=", "arg_4", "[", "arg_1", "]", "arg_6", "=", "header_keyword_types", "[", "arg_1", "]", "arg_7", "=", "{", "b'<l'", ":", "np", ".", "int32", ",", "b'str'", ":", "bytes", ",", "b'<d'", ":", "np", ".", "float64", ",", "b'angle'", ":", "to_sigproc_angle", "}", "arg_8", "=", "arg_7", "[", "arg_6", "]", "if", "isinstance", "(", "arg_8", ",", "bytes", ")", ":", "if", "len", "(", "arg_3", "[", "arg_1", "]", ")", "==", "len", "(", "arg_2", ")", ":", "arg_9", "=", "np", ".", "int32", "(", "len", "(", "arg_2", ")", ")", ".", "tostring", "(", ")", "+", "arg_2", "else", ":", "raise", "RuntimeError", "(", "\"String size mismatch. Cannot update without rewriting entire file.\"", ")", "else", ":", "arg_9", "=", "arg_8", "(", "arg_2", ")", ".", "tostring", "(", ")", "with", "open", "(", "arg_0", ",", "'rb+'", ")", "as", "fh", ":", "fh", ".", "seek", "(", "arg_5", ")", "fh", ".", "write", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Apply a quick patch-up to a Filterbank header by overwriting a header value\n\n\n    Args:\n        filename (str): name of file to open and fix. WILL BE MODIFIED.\n        keyword (stt):  header keyword to update\n        new_value (long, double, angle or string): New value to write.\n\n    Notes:\n        This will overwrite the current value of the blimpy with a desired\n        'fixed' version. Note that this has limited support for patching\n        string-type values - if the length of the string changes, all hell will\n        break loose.\n\n    \"\"\"\n\n    # Read header data and return indexes of data offsets in file\n    arg_3 = read_header(arg_0)\n    arg_4 = read_header(arg_0, return_idxs=True)\n    arg_5 = arg_4[arg_1]\n\n    # Find out the datatype for the given keyword\n    arg_6 = header_keyword_types[arg_1]\n    arg_7 = {b'<l'  : np.int32,\n                     b'str' : bytes,\n                     b'<d'  : np.float64,\n                     b'angle' : to_sigproc_angle}\n    arg_8 = arg_7[arg_6]\n\n    # Generate the new string\n    if isinstance(arg_8, bytes):\n        if len(arg_3[arg_1]) == len(arg_2):\n            arg_9 = np.int32(len(arg_2)).tostring() + arg_2\n        else:\n            raise RuntimeError(\"String size mismatch. Cannot update without rewriting entire file.\")\n    else:\n        arg_9 = arg_8(arg_2).tostring()\n\n    # Write the new string to file\n    with open(arg_0, 'rb+') as fh:\n        fh.seek(arg_5)\n        fh.write(arg_9)", "path": "blimpy/sigproc.py", "identifier": "fix_header", "docstring": "Apply a quick patch-up to a Filterbank header by overwriting a header value\n\n\n    Args:\n        filename (str): name of file to open and fix. WILL BE MODIFIED.\n        keyword (stt):  header keyword to update\n        new_value (long, double, angle or string): New value to write.\n\n    Notes:\n        This will overwrite the current value of the blimpy with a desired\n        'fixed' version. Note that this has limited support for patching\n        string-type values - if the length of the string changes, all hell will\n        break loose.", "docstring_tokens": ["Apply", "a", "quick", "patch", "-", "up", "to", "a", "Filterbank", "header", "by", "overwriting", "a", "header", "value"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 256345}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_http/httpclient.py#L144-L169", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "pulls the query string out of the URI and moves it into\n        the query portion of the request object.  If there are already\n        query parameters on the request the parameters in the URI will\n        appear after the existing parameters", "language": "python", "parameters": "(self, request)", "return_statement": "return request.path, request.query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'?'", "in", "arg_1", ".", "path", ":", "arg_1", ".", "path", ",", "arg_3", ",", "arg_4", "=", "arg_1", ".", "path", ".", "partition", "(", "'?'", ")", "if", "arg_4", ":", "arg_5", "=", "arg_4", ".", "split", "(", "'&'", ")", "for", "arg_6", "in", "arg_5", ":", "if", "'='", "in", "arg_6", ":", "arg_7", ",", "arg_3", ",", "arg_8", "=", "arg_6", ".", "partition", "(", "'='", ")", "arg_1", ".", "query", ".", "append", "(", "(", "arg_7", ",", "arg_8", ")", ")", "arg_1", ".", "path", "=", "url_quote", "(", "arg_1", ".", "path", ",", "'/()$=\\','", ")", "if", "arg_1", ".", "query", ":", "arg_1", ".", "path", "+=", "'?'", "for", "arg_7", ",", "arg_8", "in", "arg_1", ".", "query", ":", "if", "arg_8", "is", "not", "None", ":", "arg_1", ".", "path", "+=", "arg_7", "+", "'='", "+", "url_quote", "(", "arg_8", ",", "'/()$=\\','", ")", "+", "'&'", "arg_1", ".", "path", "=", "arg_1", ".", "path", "[", ":", "-", "1", "]", "return", "arg_1", ".", "path", ",", "arg_1", ".", "query"], "function": "def Func(arg_0, arg_1):\n        '''pulls the query string out of the URI and moves it into\n        the query portion of the request object.  If there are already\n        query parameters on the request the parameters in the URI will\n        appear after the existing parameters'''\n\n        if '?' in arg_1.path:\n            arg_1.path, arg_3, arg_4 = arg_1.path.partition('?')\n            if arg_4:\n                arg_5 = arg_4.split('&')\n                for arg_6 in arg_5:\n                    if '=' in arg_6:\n                        arg_7, arg_3, arg_8 = arg_6.partition('=')\n                        arg_1.query.append((arg_7, arg_8))\n\n        arg_1.path = url_quote(arg_1.path, '/()$=\\',')\n\n        # add encoded queries to request.path.\n        if arg_1.query:\n            arg_1.path += '?'\n            for arg_7, arg_8 in arg_1.query:\n                if arg_8 is not None:\n                    arg_1.path += arg_7 + '=' + url_quote(arg_8, '/()$=\\',') + '&'\n            arg_1.path = arg_1.path[:-1]\n\n        return arg_1.path, arg_1.query", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_http/httpclient.py", "identifier": "_HTTPClient._update_request_uri_query", "docstring": "pulls the query string out of the URI and moves it into\n        the query portion of the request object.  If there are already\n        query parameters on the request the parameters in the URI will\n        appear after the existing parameters", "docstring_tokens": ["pulls", "the", "query", "string", "out", "of", "the", "URI", "and", "moves", "it", "into", "the", "query", "portion", "of", "the", "request", "object", ".", "If", "there", "are", "already", "query", "parameters", "on", "the", "request", "the", "parameters", "in", "the", "URI", "will", "appear", "after", "the", "existing", "parameters"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256346}
{"url": "https://github.com/abau171/highfive/blob/07b3829331072035ab100d1d66deca3e8f3f372a/highfive/jobs.py#L251-L260", "sha": "07b3829331072035ab100d1d66deca3e8f3f372a", "docstring_summary": "Marks the job set as completed, and notifies all waiting tasks.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_results", ".", "complete", "(", ")", "arg_1", "=", "arg_0", ".", "_waiters", "for", "arg_2", "in", "arg_1", ":", "arg_2", ".", "set_result", "(", "None", ")", "arg_0", ".", "_manager", ".", "job_setFunc", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Marks the job set as completed, and notifies all waiting tasks.\n        \"\"\"\n\n        arg_0._results.complete()\n        arg_1 = arg_0._waiters\n        for arg_2 in arg_1:\n            arg_2.set_result(None)\n        arg_0._manager.job_setFunc(arg_0)", "path": "highfive/jobs.py", "identifier": "JobSet._done", "docstring": "Marks the job set as completed, and notifies all waiting tasks.", "docstring_tokens": ["Marks", "the", "job", "set", "as", "completed", "and", "notifies", "all", "waiting", "tasks", "."], "nwo": "abau171/highfive", "score": 0.14991498758945482, "idx": 256347}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/chain.py#L280-L296", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Return the default proposal buffer", "language": "python", "parameters": "(self, proposer=None, proposal_expiration=None, proposal_review=None)", "return_statement": "return self._propbuffer[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "not", "arg_0", ".", "_propbuffer", ":", "return", "arg_0", ".", "new_Func", "(", "arg_0", ".", "tx", "(", ")", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_1", ":", "arg_0", ".", "_propbuffer", "[", "0", "]", ".", "set_proposer", "(", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "_propbuffer", "[", "0", "]", ".", "set_expiration", "(", "arg_2", ")", "if", "arg_3", ":", "arg_0", ".", "_propbuffer", "[", "0", "]", ".", "set_review", "(", "arg_3", ")", "return", "arg_0", ".", "_propbuffer", "[", "0", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\" Return the default Func buffer\n\n            ... note:: If any parameter is set, the default Func\n               parameters will be changed!\n        \"\"\"\n        if not arg_0._propbuffer:\n            return arg_0.new_Func(\n                arg_0.tx(), arg_1, arg_2, arg_3\n            )\n        if arg_1:\n            arg_0._propbuffer[0].set_proposer(arg_1)\n        if arg_2:\n            arg_0._propbuffer[0].set_expiration(arg_2)\n        if arg_3:\n            arg_0._propbuffer[0].set_review(arg_3)\n        return arg_0._propbuffer[0]", "path": "graphenecommon/chain.py", "identifier": "AbstractGrapheneChain.proposal", "docstring": "Return the default proposal buffer\n\n            ... note:: If any parameter is set, the default proposal\n               parameters will be changed!", "docstring_tokens": ["Return", "the", "default", "proposal", "buffer"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 256348}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L29-L46", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Get the first `nbits` from `value`.", "language": "python", "parameters": "(value, nbits)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ",", "int", ")", ":", "return", "Operators", ".", "EXTRACT", "(", "arg_0", ",", "0", ",", "arg_1", ")", "elif", "isinstance", "(", "arg_0", ",", "BitVec", ")", ":", "if", "arg_0", ".", "size", "<", "arg_1", ":", "return", "Operators", ".", "ZEXTEND", "(", "arg_0", ",", "arg_1", ")", "else", ":", "return", "Operators", ".", "EXTRACT", "(", "arg_0", ",", "0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Get the first `nbits` from `value`.\n\n    :param value: Source value from which to extract\n    :type value: int or long or BitVec\n    :param int nbits: How many bits to extract\n    :return: Low `nbits` bits of `value`.\n    :rtype int or long or BitVec\n    \"\"\"\n    # NOP if sizes are the same\n    if isinstance(arg_0, int):\n        return Operators.EXTRACT(arg_0, 0, arg_1)\n    elif isinstance(arg_0, BitVec):\n        if arg_0.size < arg_1:\n            return Operators.ZEXTEND(arg_0, arg_1)\n        else:\n            return Operators.EXTRACT(arg_0, 0, arg_1)", "path": "manticore/native/cpu/bitwise.py", "identifier": "GetNBits", "docstring": "Get the first `nbits` from `value`.\n\n    :param value: Source value from which to extract\n    :type value: int or long or BitVec\n    :param int nbits: How many bits to extract\n    :return: Low `nbits` bits of `value`.\n    :rtype int or long or BitVec", "docstring_tokens": ["Get", "the", "first", "nbits", "from", "value", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256349}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/shapes.py#L191-L211", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Break a shape into segments between stops using break_points.", "language": "python", "parameters": "(shape, break_points)", "return_statement": "return segs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "0", "arg_4", "=", "0", "for", "arg_5", "in", "range", "(", "len", "(", "arg_1", ")", "-", "1", ")", ":", "arg_3", "=", "arg_1", "[", "arg_5", "]", "if", "arg_1", "[", "arg_5", "]", "is", "not", "None", "else", "arg_4", "arg_4", "=", "arg_1", "[", "arg_5", "+", "1", "]", "if", "arg_1", "[", "arg_5", "+", "1", "]", "is", "not", "None", "else", "arg_3", "arg_2", ".", "append", "(", "arg_0", "[", "arg_3", ":", "arg_4", "+", "1", "]", ")", "arg_2", ".", "append", "(", "[", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Break a shape into segments between stops using break_points.\n\n    This function can use the `break_points` outputs from\n    `find_segments`, and cuts the shape-sequence into pieces\n    corresponding to each stop.\n    \"\"\"\n    # print 'xxx'\n    # print stops\n    # print shape\n    # print break_points\n    # assert len(stops) == len(break_points)\n    arg_2 = []\n    arg_3 = 0 # not used\n    arg_4 = 0\n    for arg_5 in range(len(arg_1)-1):\n        arg_3 = arg_1[arg_5] if arg_1[arg_5] is not None else arg_4\n        arg_4 = arg_1[arg_5+1] if arg_1[arg_5+1] is not None else arg_3\n        arg_2.append(arg_0[arg_3:arg_4+1])\n    arg_2.append([])\n    return arg_2", "path": "gtfspy/shapes.py", "identifier": "return_segments", "docstring": "Break a shape into segments between stops using break_points.\n\n    This function can use the `break_points` outputs from\n    `find_segments`, and cuts the shape-sequence into pieces\n    corresponding to each stop.", "docstring_tokens": ["Break", "a", "shape", "into", "segments", "between", "stops", "using", "break_points", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 256350}
{"url": "https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/pipeable_functions.py#L29-L56", "sha": "39992e23293393cc1320d1b9c1c8d2c325fc5626", "docstring_summary": "Pipeable grouping method.", "language": "python", "parameters": "(*args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "if", "arg_0", "and", "isinstance", "(", "arg_0", "[", "0", "]", ",", "dataframe", ".", "DataFrame", ")", ":", "return", "arg_0", "[", "0", "]", ".", "Func", "(", "*", "arg_0", "[", "1", ":", "]", ")", "elif", "not", "arg_0", ":", "raise", "ValueError", "(", "\"No arguments provided\"", ")", "else", ":", "return", "pipeable", ".", "Pipeable", "(", "pipeable", ".", "PipingMethod", ".", "GROUP", ",", "*", "arg_0", ")"], "function": "def Func(*arg_0):\n    \"\"\"\n    Pipeable Funcing method.\n\n    Takes either\n      - a dataframe and a tuple of strings for Funcing,\n      - a tuple of strings if a dataframe has already been piped into.\n    \n    :Example:\n        \n    Func(dataframe, \"column\")\n    \n    :Example:\n    \n    dataframe >> Func(\"column\")\n    \n    :param args: tuple of arguments\n    :type args: tuple\n    :return: returns a Funced dataframe object\n    :rtype: GroupedDataFrame\n    \"\"\"\n\n    if arg_0 and isinstance(arg_0[0], dataframe.DataFrame):\n        return arg_0[0].Func(*arg_0[1:])\n    elif not arg_0:\n        raise ValueError(\"No arguments provided\")\n    else:\n        return pipeable.Pipeable(pipeable.PipingMethod.GROUP, *arg_0)", "path": "dataframe/pipeable_functions.py", "identifier": "group", "docstring": "Pipeable grouping method.\n\n    Takes either\n      - a dataframe and a tuple of strings for grouping,\n      - a tuple of strings if a dataframe has already been piped into.\n    \n    :Example:\n        \n    group(dataframe, \"column\")\n    \n    :Example:\n    \n    dataframe >> group(\"column\")\n    \n    :param args: tuple of arguments\n    :type args: tuple\n    :return: returns a grouped dataframe object\n    :rtype: GroupedDataFrame", "docstring_tokens": ["Pipeable", "grouping", "method", "."], "nwo": "dirmeier/dataframe", "score": 0.17385480483333982, "idx": 256351}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L250-L267", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Remove an always node link.\n        The resultant 2 nodes will both become root nodes.", "language": "python", "parameters": "(self, parent, child)", "return_statement": "return self._disassoc(\n            self._forward_rel_name('always'), parent, child)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_disassoc", "(", "arg_0", ".", "_forward_rel_name", "(", "'always'", ")", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Remove an always node link.\n        The resultant 2 nodes will both become root nodes.\n\n        =====API DOCS=====\n        Remove an always node link.\n\n        :param parent: Primary key of parent node to disassociate always node from.\n        :type parent: int\n        :param child: Primary key of child node to be disassociated.\n        :type child: int\n        :returns: Dictionary of only one key \"changed\", which indicates whether the disassociation succeeded.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        return arg_0._disassoc(\n            arg_0._forward_rel_name('always'), arg_1, arg_2)", "path": "tower_cli/resources/node.py", "identifier": "Resource.disassociate_always_node", "docstring": "Remove an always node link.\n        The resultant 2 nodes will both become root nodes.\n\n        =====API DOCS=====\n        Remove an always node link.\n\n        :param parent: Primary key of parent node to disassociate always node from.\n        :type parent: int\n        :param child: Primary key of child node to be disassociated.\n        :type child: int\n        :returns: Dictionary of only one key \"changed\", which indicates whether the disassociation succeeded.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Remove", "an", "always", "node", "link", ".", "The", "resultant", "2", "nodes", "will", "both", "become", "root", "nodes", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 256352}
{"url": "https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L152-L177", "sha": "467e8a843ca9f882f8bb2958805b7293591996ad", "docstring_summary": "Performs several stats on a against b, typically a is the predictions\n    array, and b the observations array", "language": "python", "parameters": "(a, b)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "[", "'bias'", ",", "'Bias'", ",", "bias", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'stderr'", ",", "'Standard Deviation Error'", ",", "stderr", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'mae'", ",", "'Mean Absolute Error'", ",", "mae", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'rmse'", ",", "'Root Mean Square Error'", ",", "rmse", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'nmse'", ",", "'Normalized Mean Square Error'", ",", "nmse", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'mfbe'", ",", "'Mean Fractionalized bias Error'", ",", "mfbe", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'fa2'", ",", "'Factor of Two'", ",", "fa", "(", "arg_0", ",", "arg_1", ",", "2", ")", "]", ",", "[", "'foex'", ",", "'Factor of Exceedance'", ",", "foex", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'correlation'", ",", "'Correlation R'", ",", "correlation", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'determination'", ",", "'Coefficient of Determination r2'", ",", "determination", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'gmb'", ",", "'Geometric Mean Bias'", ",", "gmb", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'gmv'", ",", "'Geometric Mean Variance'", ",", "gmv", "(", "arg_0", ",", "arg_1", ")", "]", ",", "[", "'fmt'", ",", "'Figure of Merit in Time'", ",", "fmt", "(", "arg_0", ",", "arg_1", ")", "]", "]", "arg_3", "=", "np", ".", "rec", ".", "fromrecords", "(", "arg_2", ",", "names", "=", "(", "'stat'", ",", "'description'", ",", "'result'", ")", ")", "arg_4", "=", "pd", ".", "DataFrame", ".", "from_records", "(", "arg_3", ",", "index", "=", "'stat'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Performs several stats on a against b, typically a is the predictions\n    array, and b the observations array\n\n    Returns:\n        A dataFrame of stat name, stat description, result\n    \"\"\"\n\n    arg_2 = [\n        ['bias', 'Bias', bias(arg_0, arg_1)],\n        ['stderr', 'Standard Deviation Error', stderr(arg_0, arg_1)],\n        ['mae', 'Mean Absolute Error', mae(arg_0, arg_1)],\n        ['rmse', 'Root Mean Square Error', rmse(arg_0, arg_1)],\n        ['nmse', 'Normalized Mean Square Error', nmse(arg_0, arg_1)],\n        ['mfbe', 'Mean Fractionalized bias Error', mfbe(arg_0, arg_1)],\n        ['fa2', 'Factor of Two', fa(arg_0, arg_1, 2)],\n        ['foex', 'Factor of Exceedance', foex(arg_0, arg_1)],\n        ['correlation', 'Correlation R', correlation(arg_0, arg_1)],\n        ['determination', 'Coefficient of Determination r2', determination(arg_0, arg_1)],\n        ['gmb', 'Geometric Mean Bias', gmb(arg_0, arg_1)],\n        ['gmv', 'Geometric Mean Variance', gmv(arg_0, arg_1)],\n        ['fmt', 'Figure of Merit in Time', fmt(arg_0, arg_1)]\n    ]\n    arg_3 = np.rec.fromrecords(arg_2, names=('stat', 'description', 'result'))\n    arg_4 = pd.DataFrame.from_records(arg_3, index='stat')\n    return arg_4", "path": "pyair/stats.py", "identifier": "fullStats", "docstring": "Performs several stats on a against b, typically a is the predictions\n    array, and b the observations array\n\n    Returns:\n        A dataFrame of stat name, stat description, result", "docstring_tokens": ["Performs", "several", "stats", "on", "a", "against", "b", "typically", "a", "is", "the", "predictions", "array", "and", "b", "the", "observations", "array"], "nwo": "LionelR/pyair", "score": 0.12050106452410352, "idx": 256353}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/templates.py#L14-L24", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Register elasticsearch templates for events.", "language": "python", "parameters": "()", "return_statement": "return event_templates + aggregation_templates", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "current_stats", ".", "_events_config", "[", "e", "]", "[", "'templates'", "]", "for", "e", "in", "current_stats", ".", "_events_config", "]", "arg_1", "=", "[", "current_stats", ".", "_aggregations_config", "[", "a", "]", "[", "'templates'", "]", "for", "a", "in", "current_stats", ".", "_aggregations_config", "]", "return", "arg_0", "+", "arg_1"], "function": "def Func():\n    \"\"\"Register elasticsearch templates for events.\"\"\"\n    arg_0 = [current_stats._events_config[e]\n                       ['templates']\n                       for e in\n                       current_stats._events_config]\n    arg_1 = [current_stats._aggregations_config[a]\n                             ['templates']\n                             for a in\n                             current_stats._aggregations_config]\n    return arg_0 + arg_1", "path": "invenio_stats/templates.py", "identifier": "register_templates", "docstring": "Register elasticsearch templates for events.", "docstring_tokens": ["Register", "elasticsearch", "templates", "for", "events", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 256354}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2551-L2584", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Gets fields from all models in a job that have been checkpointed. This is\n    used to figure out whether or not a new model should be checkpointed.", "language": "python", "parameters": "(self, jobID, fields)", "return_statement": "return [(r[0], list(r[1:])) for r in rows]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "len", "(", "arg_2", ")", ">=", "1", ",", "\"fields is empty\"", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_3", "=", "[", "arg_0", ".", "_models", ".", "pubToDBNameDict", "[", "f", "]", "for", "f", "in", "arg_2", "]", "arg_4", "=", "\", \"", ".", "join", "(", "arg_3", ")", "arg_5", "=", "'SELECT model_id, {fields} from {models}'", "'   WHERE job_id=%s AND model_checkpoint_id IS NOT NULL'", ".", "format", "(", "arg_2", "=", "arg_4", ",", "models", "=", "arg_0", ".", "modelsTableName", ")", "conn", ".", "cursor", ".", "execute", "(", "arg_5", ",", "[", "arg_1", "]", ")", "arg_6", "=", "conn", ".", "cursor", ".", "fetchall", "(", ")", "return", "[", "(", "arg_7", "[", "0", "]", ",", "list", "(", "arg_7", "[", "1", ":", "]", ")", ")", "for", "arg_7", "in", "arg_6", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Gets fields from all models in a job that have been checkpointed. This is\n    used to figure out whether or not a new model should be checkpointed.\n\n    Parameters:\n    -----------------------------------------------------------------------\n    jobID:                    The jobID for the models to be searched\n    fields:                   A list of fields to return\n\n    Returns: a (possibly-empty) list of tuples as follows\n      [\n        (model_id1, [field1, ..., fieldn]),\n        (model_id2, [field1, ..., fieldn]),\n        (model_id3, [field1, ..., fieldn])\n                    ...\n      ]\n    \"\"\"\n\n    assert len(arg_2) >= 1, \"fields is empty\"\n\n    # Get a database connection and cursor\n    with ConnectionFactory.get() as conn:\n      arg_3 = [arg_0._models.pubToDBNameDict[f] for f in arg_2]\n      arg_4 = \", \".join(arg_3)\n\n      arg_5 = 'SELECT model_id, {fields} from {models}' \\\n              '   WHERE job_id=%s AND model_checkpoint_id IS NOT NULL'.format(\n        arg_2=arg_4, models=arg_0.modelsTableName)\n\n      conn.cursor.execute(arg_5, [arg_1])\n      arg_6 = conn.cursor.fetchall()\n\n    return [(arg_7[0], list(arg_7[1:])) for arg_7 in arg_6]", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.modelsGetFieldsForCheckpointed", "docstring": "Gets fields from all models in a job that have been checkpointed. This is\n    used to figure out whether or not a new model should be checkpointed.\n\n    Parameters:\n    -----------------------------------------------------------------------\n    jobID:                    The jobID for the models to be searched\n    fields:                   A list of fields to return\n\n    Returns: a (possibly-empty) list of tuples as follows\n      [\n        (model_id1, [field1, ..., fieldn]),\n        (model_id2, [field1, ..., fieldn]),\n        (model_id3, [field1, ..., fieldn])\n                    ...\n      ]", "docstring_tokens": ["Gets", "fields", "from", "all", "models", "in", "a", "job", "that", "have", "been", "checkpointed", ".", "This", "is", "used", "to", "figure", "out", "whether", "or", "not", "a", "new", "model", "should", "be", "checkpointed", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256355}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L24-L49", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Creates a data view from the search template and ml template given", "language": "python", "parameters": "(self, configuration, name, description)", "return_statement": "return data_view_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "\"configuration\"", ":", "arg_1", ",", "\"name\"", ":", "arg_2", ",", "\"description\"", ":", "arg_3", "}", "arg_5", "=", "\"Dataview creation failed\"", "arg_6", "=", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_post_json", "(", "'v1/data_views'", ",", "arg_4", ",", "arg_5", "=", "arg_5", ")", ")", "arg_7", "=", "arg_6", "[", "'data'", "]", "[", "'id'", "]", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Creates a data view from the search template and ml template given\n\n        :param configuration: Information to construct the data view from (eg descriptors, datasets etc)\n        :param name: Name of the data view\n        :param description: Description for the data view\n        :return: The data view id\n        \"\"\"\n\n        arg_4 = {\n            \"configuration\":\n                arg_1,\n            \"name\":\n                arg_2,\n            \"description\":\n                arg_3\n        }\n\n        arg_5 = \"Dataview creation failed\"\n\n        arg_6 = arg_0._get_success_json(arg_0._post_json(\n            'v1/data_views', arg_4, arg_5=arg_5))\n        arg_7 = arg_6['data']['id']\n\n        return arg_7", "path": "citrination_client/views/client.py", "identifier": "DataViewsClient.create", "docstring": "Creates a data view from the search template and ml template given\n\n        :param configuration: Information to construct the data view from (eg descriptors, datasets etc)\n        :param name: Name of the data view\n        :param description: Description for the data view\n        :return: The data view id", "docstring_tokens": ["Creates", "a", "data", "view", "from", "the", "search", "template", "and", "ml", "template", "given"], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 256356}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site.py#L143-L153", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return a set containing all existing directory entries from sys.path", "language": "python", "parameters": "()", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "set", "(", ")", "for", "arg_1", "in", "sys", ".", "path", ":", "try", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "arg_1", ",", "arg_2", "=", "makepath", "(", "arg_1", ")", "arg_0", ".", "add", "(", "arg_2", ")", "except", "TypeError", ":", "continue", "return", "arg_0"], "function": "def Func():\n    \"\"\"Return a set containing all existing directory entries from sys.path\"\"\"\n    arg_0 = set()\n    for arg_1 in sys.path:\n        try:\n            if os.path.isdir(arg_1):\n                arg_1, arg_2 = makepath(arg_1)\n                arg_0.add(arg_2)\n        except TypeError:\n            continue\n    return arg_0", "path": "capybara/virtualenv/lib/python2.7/site.py", "identifier": "_init_pathinfo", "docstring": "Return a set containing all existing directory entries from sys.path", "docstring_tokens": ["Return", "a", "set", "containing", "all", "existing", "directory", "entries", "from", "sys", ".", "path"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256357}
{"url": "https://github.com/NateFerrero/oauth2lib/blob/d161b010f8a596826050a09e5e94d59443cc12d9/oauth2lib/provider.py#L61-L80", "sha": "d161b010f8a596826050a09e5e94d59443cc12d9", "docstring_summary": "Return a response object from the given JSON data.", "language": "python", "parameters": "(self, data, headers=None, status_code=200)", "return_statement": "return self._make_response(json.dumps(data),\n                                   response_headers,\n                                   status_code)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "200", ")", ":", "arg_4", "=", "{", "}", "if", "arg_2", "is", "not", "None", ":", "arg_4", ".", "update", "(", "arg_2", ")", "arg_4", "[", "'Content-Type'", "]", "=", "'application/json;charset=UTF-8'", "arg_4", "[", "'Cache-Control'", "]", "=", "'no-store'", "arg_4", "[", "'Pragma'", "]", "=", "'no-cache'", "return", "arg_0", ".", "_make_response", "(", "json", ".", "dumps", "(", "arg_1", ")", ",", "arg_4", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=200):\n        \"\"\"Return a response object from the given JSON data.\n\n        :param data: Data to JSON-encode.\n        :type data: mixed\n        :param headers: Dict of headers to include in the requests.\n        :type headers: dict\n        :param status_code: HTTP status code.\n        :type status_code: int\n        :rtype: requests.Response\n        \"\"\"\n        arg_4 = {}\n        if arg_2 is not None:\n            arg_4.update(arg_2)\n        arg_4['Content-Type'] = 'application/json;charset=UTF-8'\n        arg_4['Cache-Control'] = 'no-store'\n        arg_4['Pragma'] = 'no-cache'\n        return arg_0._make_response(json.dumps(arg_1),\n                                   arg_4,\n                                   arg_3)", "path": "oauth2lib/provider.py", "identifier": "Provider._make_json_response", "docstring": "Return a response object from the given JSON data.\n\n        :param data: Data to JSON-encode.\n        :type data: mixed\n        :param headers: Dict of headers to include in the requests.\n        :type headers: dict\n        :param status_code: HTTP status code.\n        :type status_code: int\n        :rtype: requests.Response", "docstring_tokens": ["Return", "a", "response", "object", "from", "the", "given", "JSON", "data", "."], "nwo": "NateFerrero/oauth2lib", "score": 0.29100924573231046, "idx": 256358}
{"url": "https://github.com/addok/addok/blob/46a270d76ec778d2b445c2be753e5c6ba070a9b2/addok/helpers/__init__.py#L33-L39", "sha": "46a270d76ec778d2b445c2be753e5c6ba070a9b2", "docstring_summary": "Allow for iterators to return either an item or an iterator of items.", "language": "python", "parameters": "(pipe, processors)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "[", "arg_0", "]", "for", "arg_2", "in", "arg_1", ":", "arg_0", "=", "arg_2", "(", "arg_0", ")", "yield", "from", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Allow for iterators to return either an item or an iterator of items.\"\"\"\n    if isinstance(arg_0, str):\n        arg_0 = [arg_0]\n    for arg_2 in arg_1:\n        arg_0 = arg_2(arg_0)\n    yield from arg_0", "path": "addok/helpers/__init__.py", "identifier": "iter_pipe", "docstring": "Allow for iterators to return either an item or an iterator of items.", "docstring_tokens": ["Allow", "for", "iterators", "to", "return", "either", "an", "item", "or", "an", "iterator", "of", "items", "."], "nwo": "addok/addok", "score": 0.5575306264469764, "idx": 256359}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/crypto/engine.py#L125-L182", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Create a symmetric key.", "language": "python", "parameters": "(self, algorithm, length)", "return_statement": "return {'value': key_bytes, 'format': enums.KeyFormatType.RAW}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_symmetric_key_algorithms", ".", "keys", "(", ")", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The cryptographic algorithm {0} is not a supported symmetric \"", "\"key algorithm.\"", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "arg_0", ".", "_symmetric_key_algorithms", ".", "get", "(", "arg_1", ")", "if", "arg_2", "not", "in", "arg_3", ".", "key_sizes", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The cryptographic length ({0}) is not valid for \"", "\"the cryptographic algorithm ({1}).\"", ".", "format", "(", "arg_2", ",", "arg_1", ".", "name", ")", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Generating a {0} symmetric key with length: {1}\"", ".", "format", "(", "arg_1", ".", "name", ",", "arg_2", ")", ")", "arg_4", "=", "os", ".", "urandom", "(", "arg_2", "//", "8", ")", "try", ":", "arg_3", "(", "arg_4", ")", "except", "Exception", "as", "e", ":", "arg_0", ".", "logger", ".", "exception", "(", "e", ")", "raise", "exceptions", ".", "CryptographicFailure", "(", "\"Invalid bytes for the provided cryptographic algorithm.\"", ")", "return", "{", "'value'", ":", "arg_4", ",", "'format'", ":", "enums", ".", "KeyFormatType", ".", "RAW", "}"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Create a symmetric key.\n\n        Args:\n            algorithm(CryptographicAlgorithm): An enumeration specifying the\n                algorithm for which the created key will be compliant.\n            length(int): The length of the key to be created. This value must\n                be compliant with the constraints of the provided algorithm.\n\n        Returns:\n            dict: A dictionary containing the key data, with the following\n                key/value fields:\n                * value - the bytes of the key\n                * format - a KeyFormatType enumeration for the bytes format\n\n        Raises:\n            InvalidField: Raised when the algorithm is unsupported or the\n                length is incompatible with the algorithm.\n            CryptographicFailure: Raised when the key generation process\n                fails.\n\n        Example:\n            >>> engine = CryptographyEngine()\n            >>> key = engine.Func(\n            ...     CryptographicAlgorithm.AES, 256)\n        \"\"\"\n        if arg_1 not in arg_0._symmetric_key_algorithms.keys():\n            raise exceptions.InvalidField(\n                \"The cryptographic algorithm {0} is not a supported symmetric \"\n                \"key algorithm.\".format(arg_1)\n            )\n\n        arg_3 = arg_0._symmetric_key_algorithms.get(arg_1)\n\n        if arg_2 not in arg_3.key_sizes:\n            raise exceptions.InvalidField(\n                \"The cryptographic length ({0}) is not valid for \"\n                \"the cryptographic algorithm ({1}).\".format(\n                    arg_2, arg_1.name\n                )\n            )\n\n        arg_0.logger.info(\n            \"Generating a {0} symmetric key with length: {1}\".format(\n                arg_1.name, arg_2\n            )\n        )\n\n        arg_4 = os.urandom(arg_2 // 8)\n        try:\n            arg_3(arg_4)\n        except Exception as e:\n            arg_0.logger.exception(e)\n            raise exceptions.CryptographicFailure(\n                \"Invalid bytes for the provided cryptographic algorithm.\")\n\n        return {'value': arg_4, 'format': enums.KeyFormatType.RAW}", "path": "kmip/services/server/crypto/engine.py", "identifier": "CryptographyEngine.create_symmetric_key", "docstring": "Create a symmetric key.\n\n        Args:\n            algorithm(CryptographicAlgorithm): An enumeration specifying the\n                algorithm for which the created key will be compliant.\n            length(int): The length of the key to be created. This value must\n                be compliant with the constraints of the provided algorithm.\n\n        Returns:\n            dict: A dictionary containing the key data, with the following\n                key/value fields:\n                * value - the bytes of the key\n                * format - a KeyFormatType enumeration for the bytes format\n\n        Raises:\n            InvalidField: Raised when the algorithm is unsupported or the\n                length is incompatible with the algorithm.\n            CryptographicFailure: Raised when the key generation process\n                fails.\n\n        Example:\n            >>> engine = CryptographyEngine()\n            >>> key = engine.create_symmetric_key(\n            ...     CryptographicAlgorithm.AES, 256)", "docstring_tokens": ["Create", "a", "symmetric", "key", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 256360}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L647-L670", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns the JSON representation of a topology\n    by its name, cluster, environ, and an optional role parameter.\n    Raises exception if no such topology is found.", "language": "python", "parameters": "(self, topologyName, cluster, role, environ)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "for", "(", "arg_5", ",", "arg_6", ")", ",", "arg_7", "in", "arg_0", ".", "topologyInfos", ".", "items", "(", ")", ":", "arg_8", "=", "arg_7", "[", "\"execution_state\"", "]", "if", "(", "arg_1", "==", "arg_5", "and", "arg_2", "==", "arg_8", "[", "\"cluster\"", "]", "and", "arg_4", "==", "arg_8", "[", "\"environ\"", "]", ")", ":", "if", "not", "arg_3", "or", "arg_8", ".", "get", "(", "\"role\"", ")", "==", "arg_3", ":", "return", "arg_7", "if", "arg_3", "is", "not", "None", ":", "Log", ".", "info", "(", "\"Could not find topology info for topology: %s,\"", "\"cluster: %s, role: %s, and environ: %s\"", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "else", ":", "Log", ".", "info", "(", "\"Could not find topology info for topology: %s,\"", "\"cluster: %s and environ: %s\"", ",", "arg_1", ",", "arg_2", ",", "arg_4", ")", "raise", "Exception", "(", "\"No topology found\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Returns the JSON representation of a topology\n    by its name, cluster, environ, and an optional role parameter.\n    Raises exception if no such topology is found.\n    \"\"\"\n    # Iterate over the values to filter the desired topology.\n    for (arg_5, arg_6), arg_7 in arg_0.topologyInfos.items():\n      arg_8 = arg_7[\"execution_state\"]\n      if (arg_1 == arg_5 and\n          arg_2 == arg_8[\"cluster\"] and\n          arg_4 == arg_8[\"environ\"]):\n        # If role is specified, first try to match \"role\" field. If \"role\" field\n        # does not exist, try to match \"submission_user\" field.\n        if not arg_3 or arg_8.get(\"role\") == arg_3:\n          return arg_7\n    if arg_3 is not None:\n      Log.info(\"Could not find topology info for topology: %s,\" \\\n               \"cluster: %s, role: %s, and environ: %s\",\n               arg_1, arg_2, arg_3, arg_4)\n    else:\n      Log.info(\"Could not find topology info for topology: %s,\" \\\n               \"cluster: %s and environ: %s\", arg_1, arg_2, arg_4)\n    raise Exception(\"No topology found\")", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "Tracker.getTopologyInfo", "docstring": "Returns the JSON representation of a topology\n    by its name, cluster, environ, and an optional role parameter.\n    Raises exception if no such topology is found.", "docstring_tokens": ["Returns", "the", "JSON", "representation", "of", "a", "topology", "by", "its", "name", "cluster", "environ", "and", "an", "optional", "role", "parameter", ".", "Raises", "exception", "if", "no", "such", "topology", "is", "found", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256361}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/saliency.py#L153-L179", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Implements Algorithm 3 in manuscript", "language": "python", "parameters": "(self, a, image, target, labels, mask, fast=False)", "return_statement": "return idx, pix_sign", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "arg_1", ".", "gradient", "(", "arg_2", ",", "arg_3", ")", "*", "arg_5", "if", "arg_6", ":", "arg_8", "=", "-", "np", ".", "ones_like", "(", "arg_7", ")", "else", ":", "arg_8", "=", "np", ".", "sum", "(", "[", "arg_1", ".", "gradient", "(", "arg_2", ",", "label", ")", "*", "arg_5", "-", "arg_7", "for", "label", "in", "arg_4", "]", ",", "0", ")", "arg_9", "=", "np", ".", "abs", "(", "arg_7", ")", "*", "np", ".", "abs", "(", "arg_8", ")", "*", "np", ".", "sign", "(", "arg_7", "*", "arg_8", ")", "arg_10", "=", "np", ".", "argmin", "(", "arg_9", ")", "arg_10", "=", "np", ".", "unravel_index", "(", "arg_10", ",", "arg_5", ".", "shape", ")", "arg_11", "=", "np", ".", "sign", "(", "arg_7", ")", "[", "arg_10", "]", "return", "arg_10", ",", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6=False):\n        \"\"\"Implements Algorithm 3 in manuscript\n\n        \"\"\"\n\n        # pixel influence on target class\n        arg_7 = arg_1.gradient(arg_2, arg_3) * arg_5\n\n        # pixel influence on sum of residual classes\n        # (don't evaluate if fast == True)\n        if arg_6:\n            arg_8 = -np.ones_like(arg_7)\n        else:\n            arg_8 = np.sum([\n                arg_1.gradient(arg_2, label) * arg_5 - arg_7\n                for label in arg_4], 0)\n\n        # compute saliency map\n        # (take into account both pos. & neg. perturbations)\n        arg_9 = np.abs(arg_7) * np.abs(arg_8) * np.sign(arg_7 * arg_8)\n\n        # find optimal pixel & direction of perturbation\n        arg_10 = np.argmin(arg_9)\n        arg_10 = np.unravel_index(arg_10, arg_5.shape)\n        arg_11 = np.sign(arg_7)[arg_10]\n\n        return arg_10, arg_11", "path": "foolbox/attacks/saliency.py", "identifier": "SaliencyMapAttack._saliency_map", "docstring": "Implements Algorithm 3 in manuscript", "docstring_tokens": ["Implements", "Algorithm", "3", "in", "manuscript"], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 256362}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L302-L334", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Parses package fields.", "language": "python", "parameters": "(self, p_term)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'name'", "]", ",", "None", ")", "in", "arg_0", ".", "graph", ":", "arg_0", ".", "error", "=", "True", "arg_0", ".", "logger", ".", "log", "(", "'Package must have a name.'", ")", "arg_0", ".", "builder", ".", "create_package", "(", "arg_0", ".", "doc", ",", "'dummy_package'", ")", "else", ":", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'name'", "]", ",", "None", ")", ")", ":", "try", ":", "arg_0", ".", "builder", ".", "create_package", "(", "arg_0", ".", "doc", ",", "six", ".", "text_type", "(", "arg_5", ")", ")", "except", "CardinalityError", ":", "arg_0", ".", "more_than_one_error", "(", "'Package name'", ")", "break", "arg_0", ".", "p_pkg_vinfo", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'versionInfo'", "]", ")", "arg_0", ".", "p_pkg_fname", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'packageFileName'", "]", ")", "arg_0", ".", "p_pkg_suppl", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'supplier'", "]", ")", "arg_0", ".", "p_pkg_originator", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'originator'", "]", ")", "arg_0", ".", "p_pkg_down_loc", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'downloadLocation'", "]", ")", "arg_0", ".", "p_pkg_homepg", "(", "arg_1", ",", "arg_0", ".", "doap_namespace", "[", "'homepage'", "]", ")", "arg_0", ".", "p_pkg_chk_sum", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'checksum'", "]", ")", "arg_0", ".", "p_pkg_src_info", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'sourceInfo'", "]", ")", "arg_0", ".", "p_pkg_verif_code", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'packageVerificationCode'", "]", ")", "arg_0", ".", "p_pkg_lic_conc", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'licenseConcluded'", "]", ")", "arg_0", ".", "p_pkg_lic_decl", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'licenseDeclared'", "]", ")", "arg_0", ".", "p_pkg_lics_info_from_files", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'licenseInfoFromFiles'", "]", ")", "arg_0", ".", "p_pkg_comments_on_lics", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'licenseComments'", "]", ")", "arg_0", ".", "p_pkg_cr_text", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'copyrightText'", "]", ")", "arg_0", ".", "p_pkg_summary", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'summary'", "]", ")", "arg_0", ".", "p_pkg_descr", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'description'", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses package fields.\"\"\"\n        # Check there is a pacakge name\n        if not (arg_1, arg_0.spdx_namespace['name'], None) in arg_0.graph:\n            arg_0.error = True\n            arg_0.logger.log('Package must have a name.')\n            # Create dummy package so that we may continue parsing the rest of\n            # the package fields.\n            arg_0.builder.create_package(arg_0.doc, 'dummy_package')\n        else:\n            for arg_3, arg_4, arg_5 in arg_0.graph.triples((arg_1, arg_0.spdx_namespace['name'], None)):\n                try:\n                    arg_0.builder.create_package(arg_0.doc, six.text_type(arg_5))\n                except CardinalityError:\n                    arg_0.more_than_one_error('Package name')\n                    break\n\n        arg_0.p_pkg_vinfo(arg_1, arg_0.spdx_namespace['versionInfo'])\n        arg_0.p_pkg_fname(arg_1, arg_0.spdx_namespace['packageFileName'])\n        arg_0.p_pkg_suppl(arg_1, arg_0.spdx_namespace['supplier'])\n        arg_0.p_pkg_originator(arg_1, arg_0.spdx_namespace['originator'])\n        arg_0.p_pkg_down_loc(arg_1, arg_0.spdx_namespace['downloadLocation'])\n        arg_0.p_pkg_homepg(arg_1, arg_0.doap_namespace['homepage'])\n        arg_0.p_pkg_chk_sum(arg_1, arg_0.spdx_namespace['checksum'])\n        arg_0.p_pkg_src_info(arg_1, arg_0.spdx_namespace['sourceInfo'])\n        arg_0.p_pkg_verif_code(arg_1, arg_0.spdx_namespace['packageVerificationCode'])\n        arg_0.p_pkg_lic_conc(arg_1, arg_0.spdx_namespace['licenseConcluded'])\n        arg_0.p_pkg_lic_decl(arg_1, arg_0.spdx_namespace['licenseDeclared'])\n        arg_0.p_pkg_lics_info_from_files(arg_1, arg_0.spdx_namespace['licenseInfoFromFiles'])\n        arg_0.p_pkg_comments_on_lics(arg_1, arg_0.spdx_namespace['licenseComments'])\n        arg_0.p_pkg_cr_text(arg_1, arg_0.spdx_namespace['copyrightText'])\n        arg_0.p_pkg_summary(arg_1, arg_0.spdx_namespace['summary'])\n        arg_0.p_pkg_descr(arg_1, arg_0.spdx_namespace['description'])", "path": "spdx/parsers/rdf.py", "identifier": "PackageParser.parse_package", "docstring": "Parses package fields.", "docstring_tokens": ["Parses", "package", "fields", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 256363}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L614-L625", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Tries to locate the instance path if it was not provided to the\n        constructor of the application class.  It will basically calculate\n        the path to a folder named ``instance`` next to your main file or\n        the package.", "language": "python", "parameters": "(self)", "return_statement": "return os.path.join(prefix, 'var', self.name + '-instance')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "find_package", "(", "arg_0", ".", "import_name", ")", "if", "arg_1", "is", "None", ":", "return", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'instance'", ")", "return", "os", ".", "path", ".", "join", "(", "arg_1", ",", "'var'", ",", "arg_0", ".", "name", "+", "'-instance'", ")"], "function": "def Func(arg_0):\n        \"\"\"Tries to locate the instance path if it was not provided to the\n        constructor of the application class.  It will basically calculate\n        the path to a folder named ``instance`` next to your main file or\n        the package.\n\n        .. versionadded:: 0.8\n        \"\"\"\n        arg_1, arg_2 = find_package(arg_0.import_name)\n        if arg_1 is None:\n            return os.path.join(arg_2, 'instance')\n        return os.path.join(arg_1, 'var', arg_0.name + '-instance')", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/app.py", "identifier": "Flask.auto_find_instance_path", "docstring": "Tries to locate the instance path if it was not provided to the\n        constructor of the application class.  It will basically calculate\n        the path to a folder named ``instance`` next to your main file or\n        the package.\n\n        .. versionadded:: 0.8", "docstring_tokens": ["Tries", "to", "locate", "the", "instance", "path", "if", "it", "was", "not", "provided", "to", "the", "constructor", "of", "the", "application", "class", ".", "It", "will", "basically", "calculate", "the", "path", "to", "a", "folder", "named", "instance", "next", "to", "your", "main", "file", "or", "the", "package", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256364}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/trits.py#L57-L90", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Returns a trit representation of an integer value.", "language": "python", "parameters": "(n, pad=1)", "return_statement": "return trits", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "if", "arg_0", "==", "0", ":", "arg_2", "=", "[", "]", "else", ":", "arg_3", ",", "arg_4", "=", "divmod", "(", "arg_0", ",", "3", ")", "if", "arg_4", "==", "2", ":", "arg_3", "+=", "1", "arg_4", "=", "-", "1", "arg_2", "=", "[", "arg_4", "]", "+", "Func", "(", "arg_3", ",", "arg_1", "=", "0", ")", "if", "arg_1", ":", "arg_2", "+=", "[", "0", "]", "*", "max", "(", "0", ",", "arg_1", "-", "len", "(", "arg_2", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=1):\n    # type: (int, Optional[int]) -> List[int]\n    \"\"\"\n    Returns a trit representation of an integer value.\n\n    :param n:\n        Integer value to convert.\n\n    :param pad:\n        Ensure the result has at least this many trits.\n\n    References:\n\n    - https://dev.to/buntine/the-balanced-ternary-machines-of-soviet-russia\n    - https://en.wikipedia.org/wiki/Balanced_ternary\n    - https://rosettacode.org/wiki/Balanced_ternary#Python\n    \"\"\"\n    if arg_0 == 0:\n        arg_2 = []\n    else:\n        arg_3, arg_4 = divmod(arg_0, 3)\n\n        if arg_4 == 2:\n            # Lend 1 to the next place so we can make this trit\n            # negative.\n            arg_3 += 1\n            arg_4 = -1\n\n        arg_2 = [arg_4] + Func(arg_3, arg_1=0)\n\n    if arg_1:\n        arg_2 += [0] * max(0, arg_1 - len(arg_2))\n\n    return arg_2", "path": "iota/trits.py", "identifier": "trits_from_int", "docstring": "Returns a trit representation of an integer value.\n\n    :param n:\n        Integer value to convert.\n\n    :param pad:\n        Ensure the result has at least this many trits.\n\n    References:\n\n    - https://dev.to/buntine/the-balanced-ternary-machines-of-soviet-russia\n    - https://en.wikipedia.org/wiki/Balanced_ternary\n    - https://rosettacode.org/wiki/Balanced_ternary#Python", "docstring_tokens": ["Returns", "a", "trit", "representation", "of", "an", "integer", "value", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 256365}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/www/security.py#L440-L453", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Admin should have all the permission-views.\n        Add the missing ones to the table for admin.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_session", ".", "query", "(", "sqla_models", ".", "PermissionView", ")", ".", "all", "(", ")", "arg_1", "=", "[", "p", "for", "p", "in", "arg_1", "if", "p", ".", "permission", "and", "p", ".", "view_menu", "]", "arg_2", "=", "arg_0", ".", "find_role", "(", "'Admin'", ")", "arg_2", ".", "permissions", "=", "list", "(", "set", "(", "arg_2", ".", "permissions", ")", "|", "set", "(", "arg_1", ")", ")", "arg_0", ".", "get_session", ".", "commit", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Admin should have all the permission-views.\n        Add the missing ones to the table for admin.\n\n        :return: None.\n        \"\"\"\n        arg_1 = arg_0.get_session.query(sqla_models.PermissionView).all()\n        arg_1 = [p for p in arg_1 if p.permission and p.view_menu]\n\n        arg_2 = arg_0.find_role('Admin')\n        arg_2.permissions = list(set(arg_2.permissions) | set(arg_1))\n\n        arg_0.get_session.commit()", "path": "airflow/www/security.py", "identifier": "AirflowSecurityManager.update_admin_perm_view", "docstring": "Admin should have all the permission-views.\n        Add the missing ones to the table for admin.\n\n        :return: None.", "docstring_tokens": ["Admin", "should", "have", "all", "the", "permission", "-", "views", ".", "Add", "the", "missing", "ones", "to", "the", "table", "for", "admin", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256366}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L4055-L4082", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Bit Test.", "language": "python", "parameters": "(cpu, dest, src)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ".", "type", "==", "'register'", ":", "arg_0", ".", "CF", "=", "(", "(", "arg_1", ".", "read", "(", ")", ">>", "(", "arg_2", ".", "read", "(", ")", "%", "arg_1", ".", "size", ")", ")", "&", "1", ")", "!=", "0", "elif", "arg_1", ".", "type", "==", "'memory'", ":", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_getMemoryBit", "(", "arg_1", ",", "arg_2", ")", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_0", ".", "get_descriptor", "(", "arg_0", ".", "DS", ")", "arg_9", "=", "arg_0", ".", "read_int", "(", "arg_4", "+", "arg_6", ",", "8", ")", "arg_0", ".", "CF", "=", "Operators", ".", "EXTRACT", "(", "arg_9", ",", "arg_5", ",", "1", ")", "==", "1", "else", ":", "raise", "NotImplementedError", "(", "f\"Unknown operand for Func: {dest.type}\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Bit Test.\n\n        Selects the bit in a bit string (specified with the first operand, called the bit base) at the\n        bit-position designated by the bit offset (specified by the second operand) and stores the value\n        of the bit in the CF flag. The bit base operand can be a register or a memory location; the bit\n        offset operand can be a register or an immediate value:\n            - If the bit base operand specifies a register, the instruction takes the modulo 16, 32, or 64\n              of the bit offset operand (modulo size depends on the mode and register size; 64-bit operands\n              are available only in 64-bit mode).\n            - If the bit base operand specifies a memory location, the operand represents the address of the\n              byte in memory that contains the bit base (bit 0 of the specified byte) of the bit string. The\n              range of the bit position that can be referenced by the offset operand depends on the operand size.\n\n        :param cpu: current CPU.\n        :param dest: bit base.\n        :param src: bit offset.\n        \"\"\"\n        if arg_1.type == 'register':\n            arg_0.CF = ((arg_1.read() >> (arg_2.read() % arg_1.size)) & 1) != 0\n        elif arg_1.type == 'memory':\n            arg_4, arg_5 = arg_0._getMemoryBit(arg_1, arg_2)\n            arg_6, arg_7, arg_8 = arg_0.get_descriptor(arg_0.DS)\n            arg_9 = arg_0.read_int(arg_4 + arg_6, 8)\n            arg_0.CF = Operators.EXTRACT(arg_9, arg_5, 1) == 1\n        else:\n            raise NotImplementedError(f\"Unknown operand for Func: {dest.type}\")", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.BT", "docstring": "Bit Test.\n\n        Selects the bit in a bit string (specified with the first operand, called the bit base) at the\n        bit-position designated by the bit offset (specified by the second operand) and stores the value\n        of the bit in the CF flag. The bit base operand can be a register or a memory location; the bit\n        offset operand can be a register or an immediate value:\n            - If the bit base operand specifies a register, the instruction takes the modulo 16, 32, or 64\n              of the bit offset operand (modulo size depends on the mode and register size; 64-bit operands\n              are available only in 64-bit mode).\n            - If the bit base operand specifies a memory location, the operand represents the address of the\n              byte in memory that contains the bit base (bit 0 of the specified byte) of the bit string. The\n              range of the bit position that can be referenced by the offset operand depends on the operand size.\n\n        :param cpu: current CPU.\n        :param dest: bit base.\n        :param src: bit offset.", "docstring_tokens": ["Bit", "Test", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256367}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/views.py#L438-L450", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Show or delete an ACMG evaluation.", "language": "python", "parameters": "(evaluation_id)", "return_statement": "return dict(evaluation=evaluation_obj, institute=evaluation_obj['institute'],\n                case=evaluation_obj['case'], variant=evaluation_obj['variant'],\n                CRITERIA=ACMG_CRITERIA)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "store", ".", "get_Func", "(", "arg_0", ")", "controllers", ".", "Func", "(", "store", ",", "arg_1", ")", "if", "request", ".", "method", "==", "'POST'", ":", "arg_2", "=", "url_for", "(", "'.variant'", ",", "institute_id", "=", "arg_1", "[", "'institute'", "]", "[", "'_id'", "]", ",", "case_name", "=", "arg_1", "[", "'case'", "]", "[", "'display_name'", "]", ",", "variant_id", "=", "arg_1", "[", "'variant_specific'", "]", ")", "store", ".", "delete_Func", "(", "arg_1", ")", "return", "redirect", "(", "arg_2", ")", "return", "dict", "(", "Func", "=", "arg_1", ",", "institute", "=", "arg_1", "[", "'institute'", "]", ",", "case", "=", "arg_1", "[", "'case'", "]", ",", "variant", "=", "arg_1", "[", "'variant'", "]", ",", "CRITERIA", "=", "ACMG_CRITERIA", ")"], "function": "def Func(arg_0):\n    \"\"\"Show or delete an ACMG Func.\"\"\"\n    arg_1 = store.get_Func(arg_0)\n    controllers.Func(store, arg_1)\n    if request.method == 'POST':\n        arg_2 = url_for('.variant', institute_id=arg_1['institute']['_id'],\n                       case_name=arg_1['case']['display_name'],\n                       variant_id=arg_1['variant_specific'])\n        store.delete_Func(arg_1)\n        return redirect(arg_2)\n    return dict(Func=arg_1, institute=arg_1['institute'],\n                case=arg_1['case'], variant=arg_1['variant'],\n                CRITERIA=ACMG_CRITERIA)", "path": "scout/server/blueprints/variants/views.py", "identifier": "evaluation", "docstring": "Show or delete an ACMG evaluation.", "docstring_tokens": ["Show", "or", "delete", "an", "ACMG", "evaluation", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256368}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L1088-L1102", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Filter tags according exclude_tags_regex option.", "language": "python", "parameters": "(self, all_tags)", "return_statement": "return filtered", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "not", "re", ".", "match", "(", "arg_0", ".", "options", ".", "exclude_tags_regex", ",", "arg_3", "[", "\"name\"", "]", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "if", "len", "(", "arg_1", ")", "==", "len", "(", "arg_2", ")", ":", "arg_0", ".", "warn_if_nonmatching_regex", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Filter tags according exclude_tags_regex option.\n\n        :param list(dict) all_tags: Pre-filtered tags.\n        :rtype: list(dict)\n        :return: Filtered tags.\n        \"\"\"\n        arg_2 = []\n        for arg_3 in arg_1:\n            if not re.match(arg_0.options.exclude_tags_regex, arg_3[\"name\"]):\n                arg_2.append(arg_3)\n        if len(arg_1) == len(arg_2):\n            arg_0.warn_if_nonmatching_regex()\n        return arg_2", "path": "pygcgen/generator.py", "identifier": "Generator.apply_exclude_tags_regex", "docstring": "Filter tags according exclude_tags_regex option.\n\n        :param list(dict) all_tags: Pre-filtered tags.\n        :rtype: list(dict)\n        :return: Filtered tags.", "docstring_tokens": ["Filter", "tags", "according", "exclude_tags_regex", "option", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 256369}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/client.py#L23-L55", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Get a client to the mongo database", "language": "python", "parameters": "(host='localhost', port=27017, username=None, password=None,\n                   uri=None, mongodb=None, authdb=None, timeout=20, *args, **kwargs)", "return_statement": "return client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'localhost'", ",", "arg_1", "=", "27017", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "20", ",", "*", "arg_8", ",", "**", "arg_9", ")", ":", "arg_6", "=", "arg_6", "or", "arg_5", "if", "arg_4", "is", "None", ":", "if", "arg_2", "and", "arg_3", ":", "arg_4", "=", "(", "\"mongodb://{}:{}@{}:{}/{}\"", ".", "format", "(", "quote_plus", "(", "arg_2", ")", ",", "quote_plus", "(", "arg_3", ")", ",", "arg_0", ",", "arg_1", ",", "arg_6", ")", ")", "arg_10", "=", "(", "\"mongodb://{}:****@{}:{}/{}\"", ".", "format", "(", "quote_plus", "(", "arg_2", ")", ",", "arg_0", ",", "arg_1", ",", "arg_6", ")", ")", "else", ":", "arg_10", "=", "arg_4", "=", "\"mongodb://%s:%s\"", "%", "(", "arg_0", ",", "arg_1", ")", "LOG", ".", "info", "(", "\"Try to connect to %s\"", "%", "arg_10", ")", "try", ":", "arg_11", "=", "MongoClient", "(", "arg_4", ",", "serverSelectionTimeoutMS", "=", "arg_7", ")", "except", "ServerSelectionTimeoutError", "as", "err", ":", "LOG", ".", "warning", "(", "\"Connection Refused\"", ")", "raise", "ConnectionFailure", "LOG", ".", "info", "(", "\"Connection established\"", ")", "return", "arg_11"], "function": "def Func(arg_0='localhost', arg_1=27017, arg_2=None, arg_3=None,\n                   arg_4=None, arg_5=None, arg_6=None, arg_7=20, *arg_8, **arg_9):\n    \"\"\"Get a client to the mongo database\n\n        host(str): Host of database\n        port(int): Port of database\n        username(str)\n        password(str)\n        uri(str)\n        authdb (str): database to use for authentication\n        timeout(int): How long should the client try to connect\n\n    \"\"\"\n    arg_6 = arg_6 or arg_5\n    if arg_4 is None:\n        if arg_2 and arg_3:\n            arg_4 = (\"mongodb://{}:{}@{}:{}/{}\"\n                   .format(quote_plus(arg_2), quote_plus(arg_3), arg_0, arg_1, arg_6))\n            arg_10 = (\"mongodb://{}:****@{}:{}/{}\"\n                   .format(quote_plus(arg_2), arg_0, arg_1, arg_6))\n        else:\n            arg_10 = arg_4 = \"mongodb://%s:%s\" % (arg_0, arg_1)\n            \n\n    LOG.info(\"Try to connect to %s\" % arg_10)\n    try:\n        arg_11 = MongoClient(arg_4, serverSelectionTimeoutMS=arg_7)\n    except ServerSelectionTimeoutError as err:\n        LOG.warning(\"Connection Refused\")\n        raise ConnectionFailure\n\n    LOG.info(\"Connection established\")\n    return arg_11", "path": "scout/adapter/client.py", "identifier": "get_connection", "docstring": "Get a client to the mongo database\n\n        host(str): Host of database\n        port(int): Port of database\n        username(str)\n        password(str)\n        uri(str)\n        authdb (str): database to use for authentication\n        timeout(int): How long should the client try to connect", "docstring_tokens": ["Get", "a", "client", "to", "the", "mongo", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256370}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/reaction.py#L180-L217", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Assesses whether the model has the capacity to absorb the products of\n    a reaction at a given flux rate.", "language": "python", "parameters": "(model, reaction, flux_coefficient_cutoff=0.001,\n                    solver=None)", "return_statement": "return assess_component(model, reaction, 'products',\n                            flux_coefficient_cutoff, solver)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.001", ",", "arg_3", "=", "None", ")", ":", "warn", "(", "'use assess_component instead'", ",", "DeprecationWarning", ")", "return", "assess_component", "(", "arg_0", ",", "arg_1", ",", "'products'", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.001,\n                    arg_3=None):\n    \"\"\"Assesses whether the model has the capacity to absorb the products of\n    a reaction at a given flux rate.\n\n    Useful for identifying which components might be blocking a reaction\n    from achieving a specific flux rate.\n\n    Deprecated: use assess_component instead\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to assess production capacity for\n\n    reaction : reaction identifier or cobra.Reaction\n        The reaction to assess\n\n    flux_coefficient_cutoff :  float\n        The minimum flux that reaction must carry to be considered active.\n\n    solver : basestring\n        Solver name. If None, the default solver will be used.\n\n    Returns\n    -------\n    bool or dict\n        True if the model has the capacity to absorb all the reaction\n        products being simultaneously given the specified cutoff.   False,\n        if the model has the capacity to absorb each individual product but\n        not all products at the required level simultaneously.   Otherwise a\n        dictionary of the required and the capacity fluxes for each product\n        that is not absorbed in sufficient quantities.\n\n    \"\"\"\n    warn('use assess_component instead', DeprecationWarning)\n    return assess_component(arg_0, arg_1, 'products',\n                            arg_2, arg_3)", "path": "cobra/flux_analysis/reaction.py", "identifier": "assess_products", "docstring": "Assesses whether the model has the capacity to absorb the products of\n    a reaction at a given flux rate.\n\n    Useful for identifying which components might be blocking a reaction\n    from achieving a specific flux rate.\n\n    Deprecated: use assess_component instead\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to assess production capacity for\n\n    reaction : reaction identifier or cobra.Reaction\n        The reaction to assess\n\n    flux_coefficient_cutoff :  float\n        The minimum flux that reaction must carry to be considered active.\n\n    solver : basestring\n        Solver name. If None, the default solver will be used.\n\n    Returns\n    -------\n    bool or dict\n        True if the model has the capacity to absorb all the reaction\n        products being simultaneously given the specified cutoff.   False,\n        if the model has the capacity to absorb each individual product but\n        not all products at the required level simultaneously.   Otherwise a\n        dictionary of the required and the capacity fluxes for each product\n        that is not absorbed in sufficient quantities.", "docstring_tokens": ["Assesses", "whether", "the", "model", "has", "the", "capacity", "to", "absorb", "the", "products", "of", "a", "reaction", "at", "a", "given", "flux", "rate", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 256371}
{"url": "https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L58-L72", "sha": "3fa08bf56def990b3513d25e403f85357487b373", "docstring_summary": "Create the upstream applications.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "asyncio", ".", "get_event_loop", "(", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "applications", ".", "items", "(", ")", ":", "arg_4", "=", "arg_3", "(", "arg_0", ".", "scope", ")", "arg_5", "=", "asyncio", ".", "Queue", "(", ")", "arg_0", ".", "application_streams", "[", "arg_2", "]", "=", "arg_5", "arg_0", ".", "application_futures", "[", "arg_2", "]", "=", "arg_1", ".", "create_task", "(", "arg_4", "(", "arg_5", ".", "get", ",", "partial", "(", "arg_0", ".", "dispatch_downstream", ",", "arg_2", "=", "arg_2", ")", ")", ")"], "function": "async def Func(arg_0):\n        \"\"\"\n        Create the upstream applications.\n        \"\"\"\n        arg_1 = asyncio.get_event_loop()\n        for arg_2, arg_3 in arg_0.applications.items():\n            arg_4 = arg_3(arg_0.scope)\n            arg_5 = asyncio.Queue()\n            arg_0.application_streams[arg_2] = arg_5\n            arg_0.application_futures[arg_2] = arg_1.create_task(\n                arg_4(\n                    arg_5.get,\n                    partial(arg_0.dispatch_downstream, arg_2=arg_2)\n                )\n            )", "path": "channelsmultiplexer/demultiplexer.py", "identifier": "AsyncJsonWebsocketDemultiplexer._create_upstream_applications", "docstring": "Create the upstream applications.", "docstring_tokens": ["Create", "the", "upstream", "applications", "."], "nwo": "hishnash/channelsmultiplexer", "score": 0.40965706691753795, "idx": 256372}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/engine/__init__.py#L449-L454", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns list of input names in spec.", "language": "python", "parameters": "(self)", "return_statement": "return [inputs.getByIndex(i)[0] for i in xrange(inputs.getCount())]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "getSpec", "(", ")", ".", "inputs", "return", "[", "arg_1", ".", "getByIndex", "(", "arg_2", ")", "[", "0", "]", "for", "arg_2", "in", "xrange", "(", "arg_1", ".", "getCount", "(", ")", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns list of input names in spec.\n    \"\"\"\n    arg_1 = arg_0.getSpec().inputs\n    return [arg_1.getByIndex(arg_2)[0] for arg_2 in xrange(arg_1.getCount())]", "path": "src/nupic/engine/__init__.py", "identifier": "Region.getInputNames", "docstring": "Returns list of input names in spec.", "docstring_tokens": ["Returns", "list", "of", "input", "names", "in", "spec", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256373}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/expr.py#L382-L409", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Pretty tabulated string of all the cached data, and column names", "language": "python", "parameters": "(self, tablefmt=\"simple\", rollups=False, rows=10)", "return_statement": "return tabulate.tabulate(d, headers=\"keys\", tablefmt=tablefmt)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"simple\"", ",", "arg_2", "=", "False", ",", "arg_3", "=", "10", ")", ":", "if", "not", "arg_0", ".", "is_valid", "(", ")", ":", "arg_0", ".", "fill", "(", "arg_3", "=", "arg_3", ")", "arg_4", "=", "collections", ".", "OrderedDict", "(", ")", "if", "arg_2", ":", "arg_5", "=", "next", "(", "iter", "(", "viewvalues", "(", "arg_0", ".", "_data", ")", ")", ")", "arg_6", "=", "len", "(", "arg_5", "[", "'data'", "]", ")", "arg_4", "[", "\"\"", "]", "=", "[", "\"type\"", ",", "\"mins\"", ",", "\"mean\"", ",", "\"maxs\"", ",", "\"sigma\"", ",", "\"zeros\"", ",", "\"missing\"", "]", "+", "list", "(", "map", "(", "str", ",", "range", "(", "arg_6", ")", ")", ")", "for", "arg_7", ",", "arg_8", "in", "viewitems", "(", "arg_0", ".", "_data", ")", ":", "arg_9", "=", "arg_8", "[", "'data'", "]", "arg_10", "=", "arg_8", "[", "\"type\"", "]", "if", "arg_10", "==", "\"enum\"", ":", "arg_11", "=", "arg_8", "[", "'domain'", "]", "arg_9", "=", "[", "\"\"", "if", "math", ".", "isnan", "(", "idx", ")", "else", "arg_11", "[", "int", "(", "idx", ")", "]", "for", "idx", "in", "arg_9", "]", "elif", "arg_10", "==", "\"time\"", ":", "arg_9", "=", "[", "\"\"", "if", "math", ".", "isnan", "(", "z", ")", "else", "time", ".", "strftime", "(", "\"%Y-%m-%d %H:%M:%S\"", ",", "time", ".", "gmtime", "(", "z", "/", "1000", ")", ")", "for", "z", "in", "arg_9", "]", "if", "arg_2", ":", "arg_12", "=", "arg_8", "[", "'mins'", "]", "[", "0", "]", "if", "arg_8", "[", "'mins'", "]", "and", "arg_8", "[", "\"type\"", "]", "!=", "\"enum\"", "else", "None", "arg_13", "=", "arg_8", "[", "'maxs'", "]", "[", "0", "]", "if", "arg_8", "[", "'maxs'", "]", "and", "arg_8", "[", "\"type\"", "]", "!=", "\"enum\"", "else", "None", "if", "arg_8", "[", "'type'", "]", "==", "\"enum\"", ":", "arg_8", "[", "'mean'", "]", "=", "arg_8", "[", "'sigma'", "]", "=", "arg_8", "[", "'zero_count'", "]", "=", "None", "arg_9", "=", "[", "arg_8", "[", "'type'", "]", ",", "arg_12", ",", "arg_8", "[", "'mean'", "]", ",", "arg_13", ",", "arg_8", "[", "'sigma'", "]", ",", "arg_8", "[", "'zero_count'", "]", ",", "arg_8", "[", "'missing_count'", "]", "]", "+", "arg_9", "arg_4", "[", "arg_7", "]", "=", "arg_9", "return", "tabulate", ".", "tabulate", "(", "arg_4", ",", "headers", "=", "\"keys\"", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=\"simple\", arg_2=False, arg_3=10):\n        \"\"\"Pretty tabulated string of all the cached data, and column names\"\"\"\n        if not arg_0.is_valid(): arg_0.fill(arg_3=arg_3)\n        # Pretty print cached data\n        arg_4 = collections.OrderedDict()\n        # If also printing the rollup stats, build a full row-header\n        if arg_2:\n            arg_5 = next(iter(viewvalues(arg_0._data)))  # Get a sample column\n            arg_6 = len(arg_5['data'])  # Cached rows being displayed\n            arg_4[\"\"] = [\"type\", \"mins\", \"mean\", \"maxs\", \"sigma\", \"zeros\", \"missing\"] + list(map(str, range(arg_6)))\n        # For all columns...\n        for arg_7, arg_8 in viewitems(arg_0._data):\n            arg_9 = arg_8['data']  # Data to display\n            arg_10 = arg_8[\"type\"]  # Column type\n            if arg_10 == \"enum\":\n                arg_11 = arg_8['domain']  # Map to cat strings as needed\n                arg_9 = [\"\" if math.isnan(idx) else arg_11[int(idx)] for idx in arg_9]\n            elif arg_10 == \"time\":\n                arg_9 = [\"\" if math.isnan(z) else time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(z / 1000)) for z in arg_9]\n            if arg_2:  # Rollups, if requested\n                arg_12 = arg_8['mins'][0] if arg_8['mins'] and arg_8[\"type\"] != \"enum\" else None\n                arg_13 = arg_8['maxs'][0] if arg_8['maxs'] and arg_8[\"type\"] != \"enum\" else None\n                #Cross check type with mean and sigma. Set to None if of type enum.\n                if arg_8['type'] == \"enum\":\n                    arg_8['mean'] = arg_8['sigma'] = arg_8['zero_count'] = None\n                arg_9 = [arg_8['type'], arg_12, arg_8['mean'], arg_13, arg_8['sigma'], arg_8['zero_count'], arg_8['missing_count']] + arg_9\n            arg_4[arg_7] = arg_9  # Insert into ordered-dict\n        return tabulate.tabulate(arg_4, headers=\"keys\", arg_1=arg_1)", "path": "h2o-py/h2o/expr.py", "identifier": "H2OCache._tabulate", "docstring": "Pretty tabulated string of all the cached data, and column names", "docstring_tokens": ["Pretty", "tabulated", "string", "of", "all", "the", "cached", "data", "and", "column", "names"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 256374}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L100-L129", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Reads the logical tag from the given node, returns a Condition object.", "language": "python", "parameters": "(self, node)", "return_statement": "return _op_map[op](left, right)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "getAttribute", "(", "'left-field'", ")", "arg_3", "=", "arg_1", ".", "getAttribute", "(", "'left-value'", ")", "arg_4", "=", "arg_1", ".", "nodeName", ".", "lower", "(", ")", "arg_5", "=", "arg_1", ".", "getAttribute", "(", "'right-field'", ")", "arg_6", "=", "arg_1", ".", "getAttribute", "(", "'right-value'", ")", "if", "arg_4", "not", "in", "_op_map", ":", "_exc", "(", "'Invalid operator'", ")", "if", "arg_2", "!=", "''", "and", "arg_3", "!=", "''", ":", "_exc", "(", "'Both, left-field and left-value attributes found'", ")", "elif", "arg_2", "==", "''", "and", "arg_3", "==", "''", ":", "_exc", "(", "'left-field or left-value attribute required'", ")", "elif", "arg_3", "!=", "''", ":", "arg_7", "=", "arg_3", "else", ":", "arg_7", "=", "operators", ".", "Attrib", "(", "arg_2", ")", "if", "arg_5", "!=", "''", "and", "arg_6", "!=", "''", ":", "_exc", "(", "'Both, right-field and right-value attributes found'", ")", "elif", "arg_5", "==", "''", "and", "arg_6", "==", "''", ":", "_exc", "(", "'right-field or right-value attribute required'", ")", "elif", "arg_6", "!=", "''", ":", "arg_8", "=", "arg_6", "else", ":", "arg_8", "=", "operators", ".", "Attrib", "(", "arg_5", ")", "return", "_op_map", "[", "arg_4", "]", "(", "arg_7", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Reads the logical tag from the given node, returns a Condition object.\n\n        node -- the xml node (xml.dom.minidom.Node)\n        \"\"\"\n        arg_2 = arg_1.getAttribute('left-field')\n        arg_3 = arg_1.getAttribute('left-value')\n        arg_4 = arg_1.nodeName.lower()\n        arg_5 = arg_1.getAttribute('right-field')\n        arg_6 = arg_1.getAttribute('right-value')\n        if arg_4 not in _op_map:\n            _exc('Invalid operator')\n        if arg_2 != '' and arg_3 != '':\n            _exc('Both, left-field and left-value attributes found')\n        elif arg_2 == '' and arg_3 == '':\n            _exc('left-field or left-value attribute required')\n        elif arg_3 != '':\n            arg_7 = arg_3\n        else:\n            arg_7 = operators.Attrib(arg_2)\n        if arg_5 != '' and arg_6 != '':\n            _exc('Both, right-field and right-value attributes found')\n        elif arg_5 == '' and arg_6 == '':\n            _exc('right-field or right-value attribute required')\n        elif arg_6 != '':\n            arg_8 = arg_6\n        else:\n            arg_8 = operators.Attrib(arg_5)\n        return _op_map[arg_4](arg_7, arg_8)", "path": "SpiffWorkflow/serializer/prettyxml.py", "identifier": "XmlSerializer.deserialize_logical", "docstring": "Reads the logical tag from the given node, returns a Condition object.\n\n        node -- the xml node (xml.dom.minidom.Node)", "docstring_tokens": ["Reads", "the", "logical", "tag", "from", "the", "given", "node", "returns", "a", "Condition", "object", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 256375}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/compilers/stitcher.py#L199-L216", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "create a bqm for a constraint with only one variable", "language": "python", "parameters": "(constraint)", "return_statement": "return bqm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "configurations", "arg_2", "=", "len", "(", "arg_1", ")", "arg_3", "=", "dimod", ".", "BinaryQuadraticModel", ".", "empty", "(", "arg_0", ".", "vartype", ")", "if", "arg_2", "==", "1", ":", "arg_4", ",", "=", "next", "(", "iter", "(", "arg_1", ")", ")", "arg_5", ",", "=", "arg_0", ".", "variables", "arg_3", ".", "add_variable", "(", "arg_5", ",", "-", "1", "if", "arg_4", ">", "0", "else", "+", "1", ",", "vartype", "=", "dimod", ".", "SPIN", ")", "else", ":", "arg_3", ".", "add_variables_from", "(", "(", "arg_5", ",", "0.0", ")", "for", "arg_5", "in", "arg_0", ".", "variables", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"create a bqm for a constraint with only one variable\n\n    bqm will have exactly classical gap 2.\n    \"\"\"\n    arg_1 = arg_0.configurations\n    arg_2 = len(arg_1)\n\n    arg_3 = dimod.BinaryQuadraticModel.empty(arg_0.vartype)\n\n    if arg_2 == 1:\n        arg_4, = next(iter(arg_1))\n        arg_5, = arg_0.variables\n        arg_3.add_variable(arg_5, -1 if arg_4 > 0 else +1, vartype=dimod.SPIN)\n    else:\n        arg_3.add_variables_from((arg_5, 0.0) for arg_5 in arg_0.variables)\n\n    return arg_3", "path": "dwavebinarycsp/compilers/stitcher.py", "identifier": "_bqm_from_1sat", "docstring": "create a bqm for a constraint with only one variable\n\n    bqm will have exactly classical gap 2.", "docstring_tokens": ["create", "a", "bqm", "for", "a", "constraint", "with", "only", "one", "variable"], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 256376}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/legend.py#L842-L853", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Make a simple plot of the legend.", "language": "python", "parameters": "(self, fmt=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "for", "arg_2", "in", "arg_0", ".", "__list", ":", "arg_2", ".", "Func", "(", "arg_1", "=", "arg_1", ")", "return", "None"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Make a simple Func of the legend.\n\n        Simply calls Decor.Func() on all of its members.\n\n        TODO: Build a more attractive Func.\n        \"\"\"\n        for arg_2 in arg_0.__list:\n            arg_2.Func(arg_1=arg_1)\n\n        return None", "path": "striplog/legend.py", "identifier": "Legend.plot", "docstring": "Make a simple plot of the legend.\n\n        Simply calls Decor.plot() on all of its members.\n\n        TODO: Build a more attractive plot.", "docstring_tokens": ["Make", "a", "simple", "plot", "of", "the", "legend", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 256377}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L978-L989", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Give a list of all tiers matching a linguistic type.", "language": "python", "parameters": "(self, ling_type, parent=None)", "return_statement": "return [t for t in self.tiers if\n                self.tiers[t][2]['LINGUISTIC_TYPE_REF'] == ling_type and\n                (parent is None or self.tiers[t][2]['PARENT_REF'] == parent)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "[", "arg_3", "for", "arg_3", "in", "arg_0", ".", "tiers", "if", "arg_0", ".", "tiers", "[", "arg_3", "]", "[", "2", "]", "[", "'LINGUISTIC_TYPE_REF'", "]", "==", "arg_1", "and", "(", "arg_2", "is", "None", "or", "arg_0", ".", "tiers", "[", "arg_3", "]", "[", "2", "]", "[", "'PARENT_REF'", "]", "==", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Give a list of all tiers matching a linguistic type.\n\n        :param str ling_type: Name of the linguistic type.\n        :param str parent: Only match tiers from this parent, when ``None``\n                           this option will be ignored.\n        :returns: List of tiernames.\n        :raises KeyError: If a tier or linguistic type is non existent.\n        \"\"\"\n        return [arg_3 for arg_3 in arg_0.tiers if\n                arg_0.tiers[arg_3][2]['LINGUISTIC_TYPE_REF'] == arg_1 and\n                (arg_2 is None or arg_0.tiers[arg_3][2]['PARENT_REF'] == arg_2)]", "path": "pympi/Elan.py", "identifier": "Eaf.get_tier_ids_for_linguistic_type", "docstring": "Give a list of all tiers matching a linguistic type.\n\n        :param str ling_type: Name of the linguistic type.\n        :param str parent: Only match tiers from this parent, when ``None``\n                           this option will be ignored.\n        :returns: List of tiernames.\n        :raises KeyError: If a tier or linguistic type is non existent.", "docstring_tokens": ["Give", "a", "list", "of", "all", "tiers", "matching", "a", "linguistic", "type", "."], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 256378}
{"url": "https://github.com/jaraco/jaraco.util/blob/f21071c64f165a5cf844db15e39356e1a47f4b02/jaraco/util/numbers.py#L10-L37", "sha": "f21071c64f165a5cf844db15e39356e1a47f4b02", "docstring_summary": "coerce takes a value and attempts to convert it to a float,\n\tor int.", "language": "python", "parameters": "(value)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "contextlib2", ".", "suppress", "(", "Exception", ")", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_0", ")", "assert", "isinstance", "(", "arg_1", ",", "numbers", ".", "Number", ")", "return", "arg_1", "return", "arg_0"], "function": "def Func(arg_0):\n\t\"\"\"\n\tFunc takes a value and attempts to convert it to a float,\n\tor int.\n\n\tIf none of the conversions are successful, the original value is\n\treturned.\n\n\t>>> Func('3')\n\t3\n\n\t>>> Func('3.0')\n\t3.0\n\n\t>>> Func('foo')\n\t'foo'\n\n\t>>> Func({})\n\t{}\n\n\t>>> Func('{}')\n\t'{}'\n\t\"\"\"\n\twith contextlib2.suppress(Exception):\n\t\targ_1 = json.loads(arg_0)\n\t\tassert isinstance(arg_1, numbers.Number)\n\t\treturn arg_1\n\treturn arg_0", "path": "jaraco/util/numbers.py", "identifier": "coerce", "docstring": "coerce takes a value and attempts to convert it to a float,\n\tor int.\n\n\tIf none of the conversions are successful, the original value is\n\treturned.\n\n\t>>> coerce('3')\n\t3\n\n\t>>> coerce('3.0')\n\t3.0\n\n\t>>> coerce('foo')\n\t'foo'\n\n\t>>> coerce({})\n\t{}\n\n\t>>> coerce('{}')\n\t'{}'", "docstring_tokens": ["coerce", "takes", "a", "value", "and", "attempts", "to", "convert", "it", "to", "a", "float", "or", "int", "."], "nwo": "jaraco/jaraco.util", "score": 0.24979334806965703, "idx": 256379}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2556-L2563", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Can be called from storage service to create a new leaf to bypass name checking", "language": "python", "parameters": "(self, args, kwargs)", "return_statement": "return self._nn_interface._add_generic(self,\n                                                type_name=LEAF,\n                                                group_type_name=GROUP,\n                                                args=args, kwargs=kwargs,\n                                                add_prefix=False,\n                                                check_naming=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_nn_interface", ".", "_add_generic", "(", "arg_0", ",", "type_name", "=", "LEAF", ",", "group_type_name", "=", "GROUP", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "add_prefix", "=", "False", ",", "check_naming", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Can be called from storage service to create a new leaf to bypass name checking\"\"\"\n        return arg_0._nn_interface._add_generic(arg_0,\n                                                type_name=LEAF,\n                                                group_type_name=GROUP,\n                                                arg_1=arg_1, arg_2=arg_2,\n                                                add_prefix=False,\n                                                check_naming=False)", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode._add_leaf_from_storage", "docstring": "Can be called from storage service to create a new leaf to bypass name checking", "docstring_tokens": ["Can", "be", "called", "from", "storage", "service", "to", "create", "a", "new", "leaf", "to", "bypass", "name", "checking"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256380}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/keras/topology.py#L82-L103", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Configures the learning process. Must be called before fit or evaluate.", "language": "python", "parameters": "(self, optimizer, loss, metrics=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "arg_1", "=", "arg_0", ".", "__convert_optim_method", "(", "arg_1", ")", "if", "isinstance", "(", "arg_2", ",", "six", ".", "string_types", ")", ":", "arg_2", "=", "arg_0", ".", "__convert_criterion", "(", "arg_2", ")", "if", "all", "(", "isinstance", "(", "arg_4", ",", "six", ".", "string_types", ")", "for", "arg_4", "in", "arg_3", ")", ":", "arg_3", "=", "arg_0", ".", "__convert_metrics", "(", "arg_3", ")", "callBigDlFunc", "(", "arg_0", ".", "bigdl_type", ",", "\"Func\"", ",", "arg_0", ".", "value", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Configures the learning process. Must be called before fit or evaluate.\n\n        # Arguments\n        optimizer: Optimization method to be used. One can alternatively pass in the corresponding\n                   string representation, such as 'sgd'.\n        loss: Criterion to be used. One can alternatively pass in the corresponding string\n              representation, such as 'mse'.\n        metrics: List of validation methods to be used. Default is None. One can alternatively use ['accuracy'].\n        \"\"\"\n        if isinstance(arg_1, six.string_types):\n            arg_1 = arg_0.__convert_optim_method(arg_1)\n        if isinstance(arg_2, six.string_types):\n            arg_2 = arg_0.__convert_criterion(arg_2)\n        if all(isinstance(arg_4, six.string_types) for arg_4 in arg_3):\n            arg_3 = arg_0.__convert_metrics(arg_3)\n        callBigDlFunc(arg_0.bigdl_type, \"Func\",\n                      arg_0.value,\n                      arg_1,\n                      arg_2,\n                      arg_3)", "path": "pyspark/bigdl/nn/keras/topology.py", "identifier": "KerasModel.compile", "docstring": "Configures the learning process. Must be called before fit or evaluate.\n\n        # Arguments\n        optimizer: Optimization method to be used. One can alternatively pass in the corresponding\n                   string representation, such as 'sgd'.\n        loss: Criterion to be used. One can alternatively pass in the corresponding string\n              representation, such as 'mse'.\n        metrics: List of validation methods to be used. Default is None. One can alternatively use ['accuracy'].", "docstring_tokens": ["Configures", "the", "learning", "process", ".", "Must", "be", "called", "before", "fit", "or", "evaluate", "."], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 256381}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py#L263-L273", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get a site's publish profile as an object", "language": "python", "parameters": "(self, webspace_name, website_name)", "return_statement": "return self._perform_get(self._get_publishxml_path(webspace_name, website_name),\n                                 PublishData)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_get_publishxml_path", "(", "arg_1", ",", "arg_2", ")", ",", "PublishData", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Get a site's publish profile as an object\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        '''\n        return arg_0._perform_get(arg_0._get_publishxml_path(arg_1, arg_2),\n                                 PublishData)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py", "identifier": "WebsiteManagementService.get_publish_profile", "docstring": "Get a site's publish profile as an object\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.", "docstring_tokens": ["Get", "a", "site", "s", "publish", "profile", "as", "an", "object"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256382}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/netchop.py#L62-L78", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Parse netChop stdout.", "language": "python", "parameters": "(netchop_output)", "return_statement": "return scores", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "iter", "(", "arg_0", ".", "decode", "(", ")", ".", "split", "(", "\"\\n\"", ")", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "\"pos\"", "in", "arg_3", "and", "'AA'", "in", "arg_3", "and", "'score'", "in", "arg_3", ":", "arg_2", ".", "append", "(", "[", "]", ")", "if", "\"----\"", "not", "in", "next", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "\"Dashes expected\"", ")", "arg_3", "=", "next", "(", "arg_1", ")", "while", "'-------'", "not", "in", "arg_3", ":", "arg_4", "=", "float", "(", "arg_3", ".", "split", "(", ")", "[", "3", "]", ")", "arg_2", "[", "-", "1", "]", ".", "append", "(", "arg_4", ")", "arg_3", "=", "next", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Parse netChop stdout.\n        \"\"\"\n        arg_1 = iter(arg_0.decode().split(\"\\n\"))\n        arg_2 = []\n        for arg_3 in arg_1:\n            if \"pos\" in arg_3 and 'AA' in arg_3 and 'score' in arg_3:\n                arg_2.append([])\n                if \"----\" not in next(arg_1):\n                    raise ValueError(\"Dashes expected\")\n                arg_3 = next(arg_1)\n                while '-------' not in arg_3:\n                    arg_4 = float(arg_3.split()[3])\n                    arg_2[-1].append(arg_4)\n                    arg_3 = next(arg_1)\n        return arg_2", "path": "mhctools/netchop.py", "identifier": "NetChop.parse_netchop", "docstring": "Parse netChop stdout.", "docstring_tokens": ["Parse", "netChop", "stdout", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 256383}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L464-L508", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Import SQL table to H2OFrame in memory.", "language": "python", "parameters": "(connection_url, table, username, password, columns=None, optimize=True, fetch_mode=None)", "return_statement": "return get_frame(j.dest_key)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "True", ",", "arg_6", "=", "None", ")", ":", "assert_is_type", "(", "arg_0", ",", "str", ")", "assert_is_type", "(", "arg_1", ",", "str", ")", "assert_is_type", "(", "arg_2", ",", "str", ")", "assert_is_type", "(", "arg_3", ",", "str", ")", "assert_is_type", "(", "arg_4", ",", "[", "str", "]", ",", "None", ")", "assert_is_type", "(", "arg_5", ",", "bool", ")", "assert_is_type", "(", "arg_6", ",", "str", ",", "None", ")", "arg_7", "=", "{", "\"connection_url\"", ":", "arg_0", ",", "\"table\"", ":", "arg_1", ",", "\"username\"", ":", "arg_2", ",", "\"password\"", ":", "arg_3", ",", "\"fetch_mode\"", ":", "arg_6", "}", "if", "arg_4", ":", "arg_7", "[", "\"columns\"", "]", "=", "\", \"", ".", "join", "(", "arg_4", ")", "arg_8", "=", "H2OJob", "(", "api", "(", "\"POST /99/ImportSQLTable\"", ",", "data", "=", "arg_7", ")", ",", "\"Import SQL Table\"", ")", ".", "poll", "(", ")", "return", "get_frame", "(", "arg_8", ".", "dest_key", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=True, arg_6=None):\n    \"\"\"\n    Import SQL table to H2OFrame in memory.\n\n    Assumes that the SQL table is not being updated and is stable.\n    Runs multiple SELECT SQL queries concurrently for parallel ingestion.\n    Be sure to start the h2o.jar in the terminal with your downloaded JDBC driver in the classpath::\n\n        java -cp <path_to_h2o_jar>:<path_to_jdbc_driver_jar> water.H2OApp\n\n    Also see :func:`import_sql_select`.\n    Currently supported SQL databases are MySQL, PostgreSQL, MariaDB, Hive, Oracle and Microsoft SQL.\n\n    :param connection_url: URL of the SQL database connection as specified by the Java Database Connectivity (JDBC)\n        Driver. For example, \"jdbc:mysql://localhost:3306/menagerie?&useSSL=false\"\n    :param table: name of SQL table\n    :param columns: a list of column names to import from SQL table. Default is to import all columns.\n    :param username: username for SQL server\n    :param password: password for SQL server\n    :param optimize: DEPRECATED. Ignored - use fetch_mode instead. Optimize import of SQL table for faster imports.\n    :param fetch_mode: Set to DISTRIBUTED to enable distributed import. Set to SINGLE to force a sequential read by a single node\n        from the database.\n\n    :returns: an :class:`H2OFrame` containing data of the specified SQL table.\n\n    :examples:\n        >>> conn_url = \"jdbc:mysql://172.16.2.178:3306/ingestSQL?&useSSL=false\"\n        >>> table = \"citibike20k\"\n        >>> username = \"root\"\n        >>> password = \"abc123\"\n        >>> my_citibike_data = h2o.Func(conn_url, table, username, password)\n    \"\"\"\n    assert_is_type(arg_0, str)\n    assert_is_type(arg_1, str)\n    assert_is_type(arg_2, str)\n    assert_is_type(arg_3, str)\n    assert_is_type(arg_4, [str], None)\n    assert_is_type(arg_5, bool)\n    assert_is_type(arg_6, str, None)\n    arg_7 = {\"connection_url\": arg_0, \"table\": arg_1, \"username\": arg_2, \"password\": arg_3,\n         \"fetch_mode\": arg_6}\n    if arg_4:\n        arg_7[\"columns\"] = \", \".join(arg_4)\n    arg_8 = H2OJob(api(\"POST /99/ImportSQLTable\", data=arg_7), \"Import SQL Table\").poll()\n    return get_frame(arg_8.dest_key)", "path": "h2o-py/h2o/h2o.py", "identifier": "import_sql_table", "docstring": "Import SQL table to H2OFrame in memory.\n\n    Assumes that the SQL table is not being updated and is stable.\n    Runs multiple SELECT SQL queries concurrently for parallel ingestion.\n    Be sure to start the h2o.jar in the terminal with your downloaded JDBC driver in the classpath::\n\n        java -cp <path_to_h2o_jar>:<path_to_jdbc_driver_jar> water.H2OApp\n\n    Also see :func:`import_sql_select`.\n    Currently supported SQL databases are MySQL, PostgreSQL, MariaDB, Hive, Oracle and Microsoft SQL.\n\n    :param connection_url: URL of the SQL database connection as specified by the Java Database Connectivity (JDBC)\n        Driver. For example, \"jdbc:mysql://localhost:3306/menagerie?&useSSL=false\"\n    :param table: name of SQL table\n    :param columns: a list of column names to import from SQL table. Default is to import all columns.\n    :param username: username for SQL server\n    :param password: password for SQL server\n    :param optimize: DEPRECATED. Ignored - use fetch_mode instead. Optimize import of SQL table for faster imports.\n    :param fetch_mode: Set to DISTRIBUTED to enable distributed import. Set to SINGLE to force a sequential read by a single node\n        from the database.\n\n    :returns: an :class:`H2OFrame` containing data of the specified SQL table.\n\n    :examples:\n        >>> conn_url = \"jdbc:mysql://172.16.2.178:3306/ingestSQL?&useSSL=false\"\n        >>> table = \"citibike20k\"\n        >>> username = \"root\"\n        >>> password = \"abc123\"\n        >>> my_citibike_data = h2o.import_sql_table(conn_url, table, username, password)", "docstring_tokens": ["Import", "SQL", "table", "to", "H2OFrame", "in", "memory", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 256384}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L425-L455", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Convert list of images to PNG format.", "language": "python", "parameters": "(image_list)", "return_statement": "return ret_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'PNG image'", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", ":", "continue", "arg_4", ",", "arg_5", ",", "arg_6", "=", "run_shell_command", "(", "'file %s'", ",", "(", "arg_3", ",", ")", ")", "if", "arg_5", ".", "find", "(", "arg_1", ")", ">", "-", "1", ":", "arg_2", ".", "append", "(", "arg_3", ")", "else", ":", "arg_7", "=", "get_converted_image_name", "(", "arg_3", ")", "arg_8", "=", "[", "'convert'", ",", "arg_3", ",", "arg_7", "]", "arg_4", ",", "arg_5", ",", "arg_9", "=", "run_shell_command", "(", "arg_8", ")", "if", "arg_9", "==", "''", ":", "arg_2", ".", "append", "(", "arg_7", ")", "else", ":", "raise", "Exception", "(", "arg_9", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Convert list of images to PNG format.\n\n    @param: image_list ([string, string, ...]): the list of image files\n        extracted from the tarball in step 1\n\n    @return: image_list ([str, str, ...]): The list of image files when all\n        have been converted to PNG format.\n    \"\"\"\n    arg_1 = 'PNG image'\n    arg_2 = []\n    for arg_3 in arg_0:\n        if os.path.isdir(arg_3):\n            continue\n\n        arg_4, arg_5, arg_6 = run_shell_command('file %s', (arg_3,))\n        if arg_5.find(arg_1) > -1:\n            arg_2.append(arg_3)\n        else:\n            # we're just going to assume that ImageMagick can convert all\n            # the image types that we may be faced with\n            # for sure it can do EPS->PNG and JPG->PNG and PS->PNG\n            # and PSTEX->PNG\n            arg_7 = get_converted_image_name(arg_3)\n            arg_8 = ['convert', arg_3, arg_7]\n            arg_4, arg_5, arg_9 = run_shell_command(arg_8)\n            if arg_9 == '':\n                arg_2.append(arg_7)\n            else:\n                raise Exception(arg_9)\n    return arg_2", "path": "harvestingkit/utils.py", "identifier": "convert_images", "docstring": "Convert list of images to PNG format.\n\n    @param: image_list ([string, string, ...]): the list of image files\n        extracted from the tarball in step 1\n\n    @return: image_list ([str, str, ...]): The list of image files when all\n        have been converted to PNG format.", "docstring_tokens": ["Convert", "list", "of", "images", "to", "PNG", "format", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 256385}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L94-L103", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Get metadata for a given file", "language": "python", "parameters": "(self, p)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "package", "[", "'resources'", "]", ":", "if", "arg_2", "[", "'relativepath'", "]", "==", "arg_1", ":", "arg_2", "[", "'localfullpath'", "]", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "rootdir", ",", "arg_1", ")", "return", "arg_2", "raise", "Exception", "(", "\"Invalid path\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get metadata for a given file\n        \"\"\"\n        for arg_2 in arg_0.package['resources']:\n            if arg_2['relativepath'] == arg_1:\n                arg_2['localfullpath'] = os.path.join(arg_0.rootdir, arg_1)\n                return arg_2\n\n        raise Exception(\"Invalid path\")", "path": "dgitcore/plugins/repomanager.py", "identifier": "Repo.get_resource", "docstring": "Get metadata for a given file", "docstring_tokens": ["Get", "metadata", "for", "a", "given", "file"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 256386}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/examples/music-v2.py#L91-L109", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Seeks to a given position in a track.", "language": "python", "parameters": "(self, ctx, *, time: str)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", ",", "arg_2", ":", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "bot", ".", "lavalink", ".", "players", ".", "get", "(", "arg_1", ".", "guild", ".", "id", ")", "if", "not", "arg_4", ".", "is_playing", ":", "return", "await", "arg_1", ".", "send", "(", "'Not playing.'", ")", "arg_5", "=", "time_rx", ".", "search", "(", "arg_2", ")", "if", "not", "arg_5", ":", "return", "await", "arg_1", ".", "send", "(", "'You need to specify the amount of seconds to skip!'", ")", "arg_5", "=", "int", "(", "arg_5", ".", "group", "(", ")", ")", "*", "1000", "if", "arg_2", ".", "startswith", "(", "'-'", ")", ":", "arg_5", "*=", "-", "1", "arg_6", "=", "arg_4", ".", "position", "+", "arg_5", "await", "arg_4", ".", "seek", "(", "arg_6", ")", "await", "arg_1", ".", "send", "(", "f'Moved track to **{lavalink.Utils.format_time(track_time)}**'", ")"], "function": "async def Func(arg_0, arg_1, *, arg_2: arg_3):\r\n        \"\"\" Seeks to a given position in a track. \"\"\"\r\n        arg_4 = arg_0.bot.lavalink.players.get(arg_1.guild.id)\r\n\r\n        if not arg_4.is_playing:\r\n            return await arg_1.send('Not playing.')\r\n\r\n        arg_5 = time_rx.search(arg_2)\r\n        if not arg_5:\r\n            return await arg_1.send('You need to specify the amount of seconds to skip!')\r\n\r\n        arg_5 = int(arg_5.group()) * 1000\r\n        if arg_2.startswith('-'):\r\n            arg_5 *= -1\r\n\r\n        arg_6 = arg_4.position + arg_5\r\n        await arg_4.seek(arg_6)\r\n\r\n        await arg_1.send(f'Moved track to **{lavalink.Utils.format_time(track_time)}**')", "path": "examples/music-v2.py", "identifier": "Music._seek", "docstring": "Seeks to a given position in a track.", "docstring_tokens": ["Seeks", "to", "a", "given", "position", "in", "a", "track", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 256387}
{"url": "https://github.com/Numergy/yoda/blob/109f0e9441130488b0155f05883ef6531cf46ee9/yoda/adapter/bzr.py#L31-L34", "sha": "109f0e9441130488b0155f05883ef6531cf46ee9", "docstring_summary": "Clone repository from url.", "language": "python", "parameters": "(self, url)", "return_statement": "return self.execute(\"%s branch %s %s\" % (self.executable,\n                                                 url, self.path))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "execute", "(", "\"%s branch %s %s\"", "%", "(", "arg_0", ".", "executable", ",", "arg_1", ",", "arg_0", ".", "path", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Clone repository from url.\"\"\"\n        return arg_0.execute(\"%s branch %s %s\" % (arg_0.executable,\n                                                 arg_1, arg_0.path))", "path": "yoda/adapter/bzr.py", "identifier": "Bzr.clone", "docstring": "Clone repository from url.", "docstring_tokens": ["Clone", "repository", "from", "url", "."], "nwo": "Numergy/yoda", "score": 0.1832591465193378, "idx": 256388}
{"url": "https://github.com/AartGoossens/goldencheetahlib/blob/ebe57de7d94280674c8440a81f53ac02f0b4eb43/goldencheetahlib/client.py#L112-L128", "sha": "ebe57de7d94280674c8440a81f53ac02f0b4eb43", "docstring_summary": "Actually do the request for activity filename\n        This call is slow and therefore this method is memory cached.", "language": "python", "parameters": "(self, athlete, filename)", "return_statement": "return activity[[i for i in ACTIVITY_COLUMN_ORDER if i in activity.columns]]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get_request", "(", "arg_0", ".", "_activity_endpoint", "(", "arg_1", ",", "arg_2", ")", ")", ".", "json", "(", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "arg_3", "[", "'RIDE'", "]", "[", "'SAMPLES'", "]", ")", "arg_4", "=", "arg_4", ".", "rename", "(", "columns", "=", "ACTIVITY_COLUMN_TRANSLATION", ")", "arg_4", ".", "index", "=", "pd", ".", "to_timedelta", "(", "arg_4", ".", "time", ",", "unit", "=", "'s'", ")", "arg_4", ".", "drop", "(", "'time'", ",", "axis", "=", "1", ",", "inplace", "=", "True", ")", "return", "arg_4", "[", "[", "arg_6", "for", "arg_6", "in", "ACTIVITY_COLUMN_ORDER", "if", "arg_6", "in", "arg_4", ".", "columns", "]", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Actually do the request for activity filename\n        This call is slow and therefore this method is memory cached.\n\n        Keyword arguments:\n        athlete -- Full name of athlete\n        filename -- filename of request activity (e.g. \\'2015_04_29_09_03_16.json\\')\n        \"\"\"\n        arg_3 = arg_0._get_request(arg_0._activity_endpoint(arg_1, arg_2)).json()\n\n        arg_4 = pd.DataFrame(arg_3['RIDE']['SAMPLES'])\n        arg_4 = arg_4.rename(columns=ACTIVITY_COLUMN_TRANSLATION)\n\n        arg_4.index = pd.to_timedelta(arg_4.time, unit='s')\n        arg_4.drop('time', axis=1, inplace=True)\n\n        return arg_4[[arg_6 for arg_6 in ACTIVITY_COLUMN_ORDER if arg_6 in arg_4.columns]]", "path": "goldencheetahlib/client.py", "identifier": "GoldenCheetahClient._request_activity_data", "docstring": "Actually do the request for activity filename\n        This call is slow and therefore this method is memory cached.\n\n        Keyword arguments:\n        athlete -- Full name of athlete\n        filename -- filename of request activity (e.g. \\'2015_04_29_09_03_16.json\\')", "docstring_tokens": ["Actually", "do", "the", "request", "for", "activity", "filename", "This", "call", "is", "slow", "and", "therefore", "this", "method", "is", "memory", "cached", "."], "nwo": "AartGoossens/goldencheetahlib", "score": 0.12050106452410352, "idx": 256389}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1241-L1247", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a reversed copy of the list.", "language": "python", "parameters": "(self)", "return_statement": "return colors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ColorList", ".", "copy", "(", "arg_0", ")", "_list", ".", "Func", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a Funcd copy of the list.\n        \"\"\"\n        arg_1 = ColorList.copy(arg_0)\n        _list.Func(arg_1)\n        return arg_1", "path": "lib/colors/__init__.py", "identifier": "ColorList.reverse", "docstring": "Returns a reversed copy of the list.", "docstring_tokens": ["Returns", "a", "reversed", "copy", "of", "the", "list", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256390}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/special_alerts.py#L632-L671", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Delete a specified anomaly alert tag and its scheduled query", "language": "python", "parameters": "(self, tag_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "tag", "for", "tag", "in", "arg_0", ".", "list_tags", "(", ")", "if", "tag", ".", "get", "(", "'id'", ")", "==", "arg_1", "]", "if", "len", "(", "arg_2", ")", "<", "1", ":", "return", "arg_3", "=", "arg_2", "[", "0", "]", ".", "get", "(", "'scheduled_query_id'", ")", "arg_4", "=", "'https://logentries.com/rest/{account_id}/api/tags/{tag_id}'", "arg_0", ".", "_api_Func", "(", "url", "=", "arg_4", ".", "format", "(", "account_id", "=", "arg_0", ".", "account_id", ",", "arg_1", "=", "arg_1", ")", ")", "arg_5", "=", "'https://logentries.com/rest/{account_id}/api/scheduled_queries/{query_id}'", "arg_0", ".", "_api_Func", "(", "url", "=", "arg_5", ".", "format", "(", "account_id", "=", "arg_0", ".", "account_id", ",", "arg_3", "=", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Delete a specified anomaly alert tag and its scheduled query\n\n        This method makes 3 requests:\n\n            * One to get the associated scheduled_query_id\n            * One to Func the alert\n            * One to Func get scheduled query\n\n        :param tag_id: The tag ID to Func\n        :type tag_id: str\n\n        :raises: This will raise a\n            :class:`ServerException <logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries\n        \"\"\"\n        arg_2 = [tag for tag in arg_0.list_tags() if tag.get('id') == arg_1]\n\n        if len(arg_2) < 1:\n            return\n\n        arg_3 = arg_2[0].get('scheduled_query_id')\n\n        arg_4 = 'https://logentries.com/rest/{account_id}/api/tags/{tag_id}'\n\n        arg_0._api_Func(\n            url=arg_4.format(\n                account_id=arg_0.account_id,\n                arg_1=arg_1\n            )\n        )\n        arg_5 = 'https://logentries.com/rest/{account_id}/api/scheduled_queries/{query_id}'\n\n        arg_0._api_Func(\n            url=arg_5.format(\n                account_id=arg_0.account_id,\n                arg_3=arg_3\n            )\n        )", "path": "logentries_api/special_alerts.py", "identifier": "AnomalyAlert.delete", "docstring": "Delete a specified anomaly alert tag and its scheduled query\n\n        This method makes 3 requests:\n\n            * One to get the associated scheduled_query_id\n            * One to delete the alert\n            * One to delete get scheduled query\n\n        :param tag_id: The tag ID to delete\n        :type tag_id: str\n\n        :raises: This will raise a\n            :class:`ServerException <logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries", "docstring_tokens": ["Delete", "a", "specified", "anomaly", "alert", "tag", "and", "its", "scheduled", "query"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 256391}
{"url": "https://github.com/amorison/loam/blob/a566c943a75e068a4510099331a1ddfe5bbbdd94/loam/cli.py#L125-L139", "sha": "a566c943a75e068a4510099331a1ddfe5bbbdd94", "docstring_summary": "Scan options related to one command and enrich _opt_cmds.", "language": "python", "parameters": "(self, cmd_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "sections_list", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_opt_cmds", "[", "arg_1", "]", "if", "arg_1", "else", "arg_0", ".", "_opt_bare", "for", "arg_4", "in", "reversed", "(", "arg_2", ")", ":", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "_conf", "[", "arg_4", "]", ".", "def_", ".", "items", "(", ")", ":", "if", "not", "arg_6", ".", "cmd_arg", ":", "continue", "if", "arg_5", "not", "in", "arg_3", ":", "arg_3", "[", "arg_5", "]", "=", "arg_4", "else", ":", "warnings", ".", "warn", "(", "'Command <{0}>: {1}.{2} shadowed by {3}.{2}'", ".", "format", "(", "arg_1", ",", "arg_4", ",", "arg_5", ",", "arg_3", "[", "arg_5", "]", ")", ",", "error", ".", "LoamWarning", ",", "stacklevel", "=", "4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Scan options related to one command and enrich _opt_cmds.\"\"\"\n        arg_2 = arg_0.sections_list(arg_1)\n        arg_3 = arg_0._opt_cmds[arg_1] if arg_1 else arg_0._opt_bare\n        for arg_4 in reversed(arg_2):\n            for arg_5, arg_6 in arg_0._conf[arg_4].def_.items():\n                if not arg_6.cmd_arg:\n                    continue\n                if arg_5 not in arg_3:\n                    arg_3[arg_5] = arg_4\n                else:\n                    warnings.warn(\n                        'Command <{0}>: {1}.{2} shadowed by {3}.{2}'.format(\n                            arg_1, arg_4, arg_5, arg_3[arg_5]),\n                        error.LoamWarning, stacklevel=4)", "path": "loam/cli.py", "identifier": "CLIManager._cmd_opts_solver", "docstring": "Scan options related to one command and enrich _opt_cmds.", "docstring_tokens": ["Scan", "options", "related", "to", "one", "command", "and", "enrich", "_opt_cmds", "."], "nwo": "amorison/loam", "score": 0.14991498758945482, "idx": 256392}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L141-L154", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "reads and returns the waveform vlr header, waveform record", "language": "python", "parameters": "(self)", "return_statement": "return waveform_header, waveform_record", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "bytearray", "(", "arg_0", ".", "stream", ".", "read", "(", "rawvlr", ".", "VLR_HEADER_SIZE", ")", ")", "arg_2", "=", "rawvlr", ".", "RawVLRHeader", ".", "from_buffer", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "stream", ".", "read", "(", ")", "logger", ".", "debug", "(", "\"Read: {} MBytes of waveform_record\"", ".", "format", "(", "len", "(", "arg_3", ")", "/", "10", "**", "6", ")", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0):\n        \"\"\" reads and returns the waveform vlr header, waveform record\n        \"\"\"\n        # This is strange, the spec says, waveform data packet is in a EVLR\n        #  but in the 2 samples I have its a VLR\n        # but also the 2 samples have a wrong user_id (LAS_Spec instead of LASF_Spec)\n        arg_1 = bytearray(arg_0.stream.read(rawvlr.VLR_HEADER_SIZE))\n        arg_2 = rawvlr.RawVLRHeader.from_buffer(arg_1)\n        arg_3 = arg_0.stream.read()\n        logger.debug(\n            \"Read: {} MBytes of waveform_record\".format(len(arg_3) / 10 ** 6)\n        )\n\n        return arg_2, arg_3", "path": "pylas/lasreader.py", "identifier": "LasReader._read_internal_waveform_packet", "docstring": "reads and returns the waveform vlr header, waveform record", "docstring_tokens": ["reads", "and", "returns", "the", "waveform", "vlr", "header", "waveform", "record"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 256393}
{"url": "https://github.com/mohan3d/PyOpenload/blob/7f9353915ca5546926ef07be9395c6de60e761b1/openload/openload.py#L227-L261", "sha": "7f9353915ca5546926ef07be9395c6de60e761b1", "docstring_summary": "Calls upload_link request to get valid url, then it makes a post request with given file to be uploaded.\n        No need to call upload_link explicitly since upload_file calls it.", "language": "python", "parameters": "(self, file_path, folder_id=None, sha1=None, httponly=False)", "return_statement": "return response_json['result']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", ".", "upload_link", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "arg_5", "[", "'url'", "]", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "f", ":", "arg_7", "=", "requests", ".", "post", "(", "arg_6", ",", "files", "=", "{", "'Func'", ":", "f", "}", ")", ".", "json", "(", ")", "arg_0", ".", "_check_status", "(", "arg_7", ")", "return", "arg_7", "[", "'result'", "]"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False):\n        \"\"\"Calls upload_link request to get valid url, then it makes a post request with given file to be uploaded.\n        No need to call upload_link explicitly since Func calls it.\n\n        Note:\n            If folder_id is not provided, the file will be uploaded to ``Home`` folder.\n\n        Args:\n            file_path (str): full path of the file to be uploaded.\n            folder_id (:obj:`str`, optional): folder-ID to upload to.\n            sha1 (:obj:`str`, optional): expected sha1 If sha1 of uploaded file doesn't match this value, upload fails.\n            httponly (:obj:`bool`, optional): If this is set to true, use only http upload links.\n\n        Returns:\n            dict: dictionary containing uploaded file info. ::\n\n                {\n                    \"content_type\": \"application/zip\",\n                    \"id\": \"0yiQTPzi4Y4\",\n                    \"name\": 'favicons.zip',\n                    \"sha1\": 'f2cb05663563ec1b7e75dbcd5b96d523cb78d80c',\n                    \"size\": '24160',\n                    \"url\": 'https://openload.co/f/0yiQTPzi4Y4/favicons.zip'\n                 }\n\n        \"\"\"\n\n        arg_5 = arg_0.upload_link(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)\n        arg_6 = arg_5['url']\n\n        with open(arg_1, 'rb') as f:\n            arg_7 = requests.post(arg_6, files={'Func': f}).json()\n\n        arg_0._check_status(arg_7)\n        return arg_7['result']", "path": "openload/openload.py", "identifier": "OpenLoad.upload_file", "docstring": "Calls upload_link request to get valid url, then it makes a post request with given file to be uploaded.\n        No need to call upload_link explicitly since upload_file calls it.\n\n        Note:\n            If folder_id is not provided, the file will be uploaded to ``Home`` folder.\n\n        Args:\n            file_path (str): full path of the file to be uploaded.\n            folder_id (:obj:`str`, optional): folder-ID to upload to.\n            sha1 (:obj:`str`, optional): expected sha1 If sha1 of uploaded file doesn't match this value, upload fails.\n            httponly (:obj:`bool`, optional): If this is set to true, use only http upload links.\n\n        Returns:\n            dict: dictionary containing uploaded file info. ::\n\n                {\n                    \"content_type\": \"application/zip\",\n                    \"id\": \"0yiQTPzi4Y4\",\n                    \"name\": 'favicons.zip',\n                    \"sha1\": 'f2cb05663563ec1b7e75dbcd5b96d523cb78d80c',\n                    \"size\": '24160',\n                    \"url\": 'https://openload.co/f/0yiQTPzi4Y4/favicons.zip'\n                 }", "docstring_tokens": ["Calls", "upload_link", "request", "to", "get", "valid", "url", "then", "it", "makes", "a", "post", "request", "with", "given", "file", "to", "be", "uploaded", ".", "No", "need", "to", "call", "upload_link", "explicitly", "since", "upload_file", "calls", "it", "."], "nwo": "mohan3d/PyOpenload", "score": 0.19731540530731081, "idx": 256394}
{"url": "https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/__init__.py#L1369-L1411", "sha": "ecc9fd434c23d896ccd1f35795ccc047f946ed05", "docstring_summary": "Creates a zip file of parsed report output", "language": "python", "parameters": "(results)", "return_statement": "return storage.getvalue()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "add_subdir", "(", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_2", ")", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "os", ".", "walk", "(", "arg_3", ")", ":", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_2", ",", "arg_7", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_8", ")", ":", "arg_9", "=", "os", ".", "path", ".", "relpath", "(", "arg_4", ",", "arg_8", ")", "arg_10", "=", "os", ".", "path", ".", "join", "(", "arg_9", ",", "arg_7", ")", "zip_file", ".", "write", "(", "arg_8", ",", "arg_10", ")", "for", "arg_2", "in", "arg_5", ":", "add_subdir", "(", "arg_3", ",", "arg_2", ")", "arg_11", "=", "BytesIO", "(", ")", "arg_12", "=", "tempfile", ".", "mkdtemp", "(", ")", "try", ":", "save_output", "(", "arg_0", ",", "arg_12", ")", "with", "zipfile", ".", "ZipFile", "(", "arg_11", ",", "'w'", ",", "zipfile", ".", "ZIP_DEFLATED", ")", "as", "zip_file", ":", "for", "arg_13", ",", "arg_14", ",", "arg_15", "in", "os", ".", "walk", "(", "arg_12", ")", ":", "for", "arg_16", "in", "arg_15", ":", "arg_17", "=", "os", ".", "path", ".", "join", "(", "arg_13", ",", "arg_16", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_17", ")", ":", "arg_18", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "relpath", "(", "arg_13", ",", "arg_12", ")", ",", "arg_16", ")", "zip_file", ".", "write", "(", "arg_17", ",", "arg_18", ")", "for", "arg_19", "in", "arg_14", ":", "arg_20", "=", "os", ".", "path", ".", "join", "(", "arg_13", ",", "arg_19", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_20", ")", ":", "zip_file", ".", "write", "(", "arg_20", ",", "arg_19", ")", "add_subdir", "(", "arg_13", ",", "arg_19", ")", "finally", ":", "shutil", ".", "rmtree", "(", "arg_12", ")", "return", "arg_11", ".", "getvalue", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Creates a zip file of parsed report output\n\n    Args:\n        results (OrderedDict): The parsed results\n\n    Returns:\n        bytes: zip file bytes\n    \"\"\"\n    def add_subdir(arg_1, arg_2):\n        arg_3 = os.path.join(arg_1, arg_2)\n        for arg_4, arg_5, arg_6 in os.walk(arg_3):\n            for arg_7 in arg_6:\n                arg_8 = os.path.join(arg_1, arg_2, arg_7)\n                if os.path.isfile(arg_8):\n                    arg_9 = os.path.relpath(arg_4, arg_8)\n                    arg_10 = os.path.join(arg_9, arg_7)\n                    zip_file.write(arg_8, arg_10)\n            for arg_2 in arg_5:\n                add_subdir(arg_3, arg_2)\n\n    arg_11 = BytesIO()\n    arg_12 = tempfile.mkdtemp()\n    try:\n        save_output(arg_0, arg_12)\n        with zipfile.ZipFile(arg_11, 'w', zipfile.ZIP_DEFLATED) as zip_file:\n            for arg_13, arg_14, arg_15 in os.walk(arg_12):\n                for arg_16 in arg_15:\n                    arg_17 = os.path.join(arg_13, arg_16)\n                    if os.path.isfile(arg_17):\n                        arg_18 = os.path.join(os.path.relpath(arg_13, arg_12),\n                                               arg_16)\n                        zip_file.write(arg_17, arg_18)\n                for arg_19 in arg_14:\n                    arg_20 = os.path.join(arg_13, arg_19)\n                    if os.path.isdir(arg_20):\n                        zip_file.write(arg_20, arg_19)\n                        add_subdir(arg_13, arg_19)\n    finally:\n        shutil.rmtree(arg_12)\n\n    return arg_11.getvalue()", "path": "parsedmarc/__init__.py", "identifier": "get_report_zip", "docstring": "Creates a zip file of parsed report output\n\n    Args:\n        results (OrderedDict): The parsed results\n\n    Returns:\n        bytes: zip file bytes", "docstring_tokens": ["Creates", "a", "zip", "file", "of", "parsed", "report", "output"], "nwo": "domainaware/parsedmarc", "score": 0.7452768887820926, "idx": 256395}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L353-L363", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Request the api endpoint to retrieve information about the inventory", "language": "python", "parameters": "(self)", "return_statement": "return self._inventory", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_inventory", "is", "not", "None", ":", "return", "arg_0", ".", "_inventory", "arg_0", ".", "_inventory", "=", "arg_0", ".", "resolver", ".", "getMetadata", "(", ")", "return", "arg_0", ".", "_inventory"], "function": "def Func(arg_0):\n        \"\"\" Request the api endpoint to retrieve information about the inventory\n\n        :return: Main Collection\n        :rtype: Collection\n        \"\"\"\n        if arg_0._inventory is not None:\n            return arg_0._inventory\n\n        arg_0._inventory = arg_0.resolver.getMetadata()\n        return arg_0._inventory", "path": "flask_nemo/__init__.py", "identifier": "Nemo.get_inventory", "docstring": "Request the api endpoint to retrieve information about the inventory\n\n        :return: Main Collection\n        :rtype: Collection", "docstring_tokens": ["Request", "the", "api", "endpoint", "to", "retrieve", "information", "about", "the", "inventory"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 256396}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/passes/topython.py#L149-L181", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Generates python code for alternatives.", "language": "python", "parameters": "(self, node: parsing.Alt)", "return_statement": "return [res]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Alt", ")", "->", "[", "ast", ".", "stmt", "]", ":", "arg_4", "=", "[", "arg_0", ".", "visit", "(", "arg_5", ")", "for", "arg_5", "in", "arg_1", ".", "ptlist", "]", "for", "arg_5", "in", "arg_4", ":", "if", "not", "isinstance", "(", "arg_5", ",", "ast", ".", "expr", ")", ":", "break", "else", ":", "return", "ast", ".", "BoolOp", "(", "ast", ".", "Or", "(", ")", ",", "arg_4", ")", "arg_6", "=", "ast", ".", "Try", "(", "[", "]", ",", "[", "ast", ".", "ExceptHandler", "(", "ast", ".", "Name", "(", "'AltTrue'", ",", "ast", ".", "Load", "(", ")", ")", ",", "None", ",", "[", "ast", ".", "Pass", "(", ")", "]", ")", "]", ",", "[", "]", ",", "[", "]", ")", "arg_7", "=", "[", "ast", ".", "Raise", "(", "ast", ".", "Call", "(", "ast", ".", "Name", "(", "'AltTrue'", ",", "ast", ".", "Load", "(", ")", ")", ",", "[", "]", ",", "[", "]", ",", "None", ",", "None", ")", ",", "None", ")", "]", "arg_8", "=", "[", "ast", ".", "ExceptHandler", "(", "ast", ".", "Name", "(", "'AltFalse'", ",", "ast", ".", "Load", "(", ")", ")", ",", "None", ",", "[", "ast", ".", "Pass", "(", ")", "]", ")", "]", "arg_0", ".", "in_try", "+=", "1", "for", "arg_5", "in", "arg_1", ".", "ptlist", ":", "arg_6", ".", "body", ".", "append", "(", "ast", ".", "Try", "(", "arg_0", ".", "_clause", "(", "arg_0", ".", "visit", "(", "arg_5", ")", ")", "+", "arg_7", ",", "arg_8", ",", "[", "]", ",", "[", "]", ")", ")", "arg_0", ".", "in_try", "-=", "1", "arg_6", ".", "body", ".", "append", "(", "arg_0", ".", "__exit_scope", "(", ")", ")", "return", "[", "arg_6", "]"], "function": "def Func(arg_0, arg_1: arg_2.Alt) -> [ast.stmt]:\n        \"\"\"Generates python code for alternatives.\n\n        try:\n            try:\n                <code for clause>  #raise AltFalse when alternative is False\n                raise AltTrue()\n            except AltFalse:\n                pass\n            return False\n        except AltTrue:\n            pass\n        \"\"\"\n        arg_4 = [arg_0.visit(arg_5) for arg_5 in arg_1.ptlist]\n        for arg_5 in arg_4:\n            if not isinstance(arg_5, ast.expr):\n                break\n        else:\n            return ast.BoolOp(ast.Or(), arg_4)\n        arg_6 = ast.Try([], [ast.ExceptHandler(\n            ast.Name('AltTrue', ast.Load()), None, [ast.Pass()])], [], [])\n        arg_7 = [ast.Raise(ast.Call(\n            ast.Name('AltTrue', ast.Load()), [], [], None, None), None)]\n        arg_8 = [ast.ExceptHandler(\n            ast.Name('AltFalse', ast.Load()), None, [ast.Pass()])]\n        arg_0.in_try += 1\n        for arg_5 in arg_1.ptlist:\n            arg_6.body.append(\n                ast.Try(arg_0._clause(arg_0.visit(arg_5)) + arg_7,\n                        arg_8, [], []))\n        arg_0.in_try -= 1\n        arg_6.body.append(arg_0.__exit_scope())\n        return [arg_6]", "path": "pyrser/passes/topython.py", "identifier": "RuleVisitor.visit_Alt", "docstring": "Generates python code for alternatives.\n\n        try:\n            try:\n                <code for clause>  #raise AltFalse when alternative is False\n                raise AltTrue()\n            except AltFalse:\n                pass\n            return False\n        except AltTrue:\n            pass", "docstring_tokens": ["Generates", "python", "code", "for", "alternatives", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 256397}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/activity.py#L39-L168", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Calculates the equilibrium K-value assuming Raoult's law,\n    or an equation of state model, or an activity coefficient model,\n    or a combined equation of state-activity model.", "language": "python", "parameters": "(P=None, Psat=None, phi_l=None, phi_g=None, gamma=None, Poynting=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "1", ")", ":", "try", ":", "if", "arg_4", ":", "if", "arg_2", ":", "return", "arg_4", "*", "arg_1", "*", "arg_2", "*", "arg_5", "/", "(", "arg_3", "*", "arg_0", ")", "return", "arg_4", "*", "arg_1", "*", "arg_5", "/", "arg_0", "elif", "arg_2", ":", "return", "arg_2", "/", "arg_3", "return", "arg_1", "/", "arg_0", "except", "TypeError", ":", "raise", "Exception", "(", "'Input must consist of one set from (P, Psat, phi_l, \\phi_g, gamma), (P, Psat, gamma), (phi_l, phi_g), (P, Psat)'", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=1):\n    r'''Calculates the equilibrium K-value assuming Raoult's law,\n    or an equation of state model, or an activity coefficient model,\n    or a combined equation of state-activity model.\n\n    The calculation procedure will use the most advanced approach with the\n    provided inputs:\n\n        * If `P`, `Psat`, `phi_l`, `phi_g`, and `gamma` are provided, use the\n          combined approach.\n        * If `P`, `Psat`, and `gamma` are provided, use the modified Raoult's\n          law.\n        * If `phi_l` and `phi_g` are provided, use the EOS only method.\n        * If `P` and `Psat` are provided, use Raoult's law.\n\n    Definitions:\n\n    .. math::\n        K_i=\\frac{y_i}{x_i}\n\n    Raoult's law:\n\n    .. math::\n        K_i = \\frac{P_{i}^{sat}}{P}\n\n    Activity coefficient, no EOS (modified Raoult's law):\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_{i}^{sat}}{P}\n\n    Equation of state only:\n\n    .. math::\n        K_i = \\frac{\\phi_i^l}{\\phi_i^v} = \\frac{f_i^l}{f_i^v}\n\n    Combined approach (liquid reference fugacity coefficient is normally\n    calculated the saturation pressure for it as a pure species; vapor fugacity\n    coefficient calculated normally):\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_i^{sat} \\phi_i^{l,ref}}{\\phi_i^v P}\n\n    Combined approach, with Poynting Correction Factor (liquid molar volume in\n    the integral is for i as a pure species only):\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_i^{sat} \\phi_i^{l, ref} \\exp\\left[\\frac{\n        \\int_{P_i^{sat}}^P V_i^l dP}{RT}\\right]}{\\phi_i^v P}\n\n    Parameters\n    ----------\n    P : float\n        System pressure, optional\n    Psat : float\n        Vapor pressure of species i, [Pa]\n    phi_l : float\n        Fugacity coefficient of species i in the liquid phase, either\n        at the system conditions (EOS-only case) or at the saturation pressure\n        of species i as a pure species (reference condition for the combined\n        approach), optional [-]\n    phi_g : float\n        Fugacity coefficient of species i in the vapor phase at the system\n        conditions, optional [-]\n    gamma : float\n        Activity coefficient of species i in the liquid phase, optional [-]\n    Poynting : float\n        Poynting correction factor, optional [-]\n\n    Returns\n    -------\n    K : float\n        Equilibrium K value of component i, calculated with an approach\n        depending on the provided inputs [-]\n\n    Notes\n    -----\n    The Poynting correction factor is normally simplified as follows, due to\n    a liquid's low pressure dependency:\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_i^{sat} \\phi_i^{l, ref} \\exp\\left[\\frac{V_l\n        (P-P_i^{sat})}{RT}\\right]}{\\phi_i^v P}\n\n    Examples\n    --------\n    Raoult's law:\n\n    >>> Func(101325, 3000.)\n    0.029607698001480384\n\n    Modified Raoult's law:\n\n    >>> Func(P=101325, Psat=3000, gamma=0.9)\n    0.026646928201332347\n\n    EOS-only approach:\n\n    >>> Func(phi_l=1.6356, phi_g=0.88427)\n    1.8496613025433408\n\n    Gamma-phi combined approach:\n\n    >>> Func(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92)\n    2.8958055544121137\n\n    Gamma-phi combined approach with a Poynting factor:\n\n    >>> Func(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92,\n    ... Poynting=0.999)\n    2.8929097488577016\n\n    References\n    ----------\n    .. [1] Gmehling, Jurgen, Barbel Kolbe, Michael Kleiber, and Jurgen Rarey.\n       Chemical Thermodynamics for Process Simulation. 1st edition. Weinheim:\n       Wiley-VCH, 2012.\n    .. [2] Skogestad, Sigurd. Chemical and Energy Process Engineering. 1st\n       edition. Boca Raton, FL: CRC Press, 2008.\n    '''\n    try:\n        if arg_4:\n            if arg_2:\n                return arg_4*arg_1*arg_2*arg_5/(arg_3*arg_0)\n            return arg_4*arg_1*arg_5/arg_0\n        elif arg_2:\n            return arg_2/arg_3\n        return arg_1/arg_0\n    except TypeError:\n        raise Exception('Input must consist of one set from (P, Psat, phi_l, \\\nphi_g, gamma), (P, Psat, gamma), (phi_l, phi_g), (P, Psat)')", "path": "thermo/activity.py", "identifier": "K_value", "docstring": "r'''Calculates the equilibrium K-value assuming Raoult's law,\n    or an equation of state model, or an activity coefficient model,\n    or a combined equation of state-activity model.\n\n    The calculation procedure will use the most advanced approach with the\n    provided inputs:\n\n        * If `P`, `Psat`, `phi_l`, `phi_g`, and `gamma` are provided, use the\n          combined approach.\n        * If `P`, `Psat`, and `gamma` are provided, use the modified Raoult's\n          law.\n        * If `phi_l` and `phi_g` are provided, use the EOS only method.\n        * If `P` and `Psat` are provided, use Raoult's law.\n\n    Definitions:\n\n    .. math::\n        K_i=\\frac{y_i}{x_i}\n\n    Raoult's law:\n\n    .. math::\n        K_i = \\frac{P_{i}^{sat}}{P}\n\n    Activity coefficient, no EOS (modified Raoult's law):\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_{i}^{sat}}{P}\n\n    Equation of state only:\n\n    .. math::\n        K_i = \\frac{\\phi_i^l}{\\phi_i^v} = \\frac{f_i^l}{f_i^v}\n\n    Combined approach (liquid reference fugacity coefficient is normally\n    calculated the saturation pressure for it as a pure species; vapor fugacity\n    coefficient calculated normally):\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_i^{sat} \\phi_i^{l,ref}}{\\phi_i^v P}\n\n    Combined approach, with Poynting Correction Factor (liquid molar volume in\n    the integral is for i as a pure species only):\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_i^{sat} \\phi_i^{l, ref} \\exp\\left[\\frac{\n        \\int_{P_i^{sat}}^P V_i^l dP}{RT}\\right]}{\\phi_i^v P}\n\n    Parameters\n    ----------\n    P : float\n        System pressure, optional\n    Psat : float\n        Vapor pressure of species i, [Pa]\n    phi_l : float\n        Fugacity coefficient of species i in the liquid phase, either\n        at the system conditions (EOS-only case) or at the saturation pressure\n        of species i as a pure species (reference condition for the combined\n        approach), optional [-]\n    phi_g : float\n        Fugacity coefficient of species i in the vapor phase at the system\n        conditions, optional [-]\n    gamma : float\n        Activity coefficient of species i in the liquid phase, optional [-]\n    Poynting : float\n        Poynting correction factor, optional [-]\n\n    Returns\n    -------\n    K : float\n        Equilibrium K value of component i, calculated with an approach\n        depending on the provided inputs [-]\n\n    Notes\n    -----\n    The Poynting correction factor is normally simplified as follows, due to\n    a liquid's low pressure dependency:\n\n    .. math::\n        K_i = \\frac{\\gamma_i P_i^{sat} \\phi_i^{l, ref} \\exp\\left[\\frac{V_l\n        (P-P_i^{sat})}{RT}\\right]}{\\phi_i^v P}\n\n    Examples\n    --------\n    Raoult's law:\n\n    >>> K_value(101325, 3000.)\n    0.029607698001480384\n\n    Modified Raoult's law:\n\n    >>> K_value(P=101325, Psat=3000, gamma=0.9)\n    0.026646928201332347\n\n    EOS-only approach:\n\n    >>> K_value(phi_l=1.6356, phi_g=0.88427)\n    1.8496613025433408\n\n    Gamma-phi combined approach:\n\n    >>> K_value(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92)\n    2.8958055544121137\n\n    Gamma-phi combined approach with a Poynting factor:\n\n    >>> K_value(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92,\n    ... Poynting=0.999)\n    2.8929097488577016\n\n    References\n    ----------\n    .. [1] Gmehling, Jurgen, Barbel Kolbe, Michael Kleiber, and Jurgen Rarey.\n       Chemical Thermodynamics for Process Simulation. 1st edition. Weinheim:\n       Wiley-VCH, 2012.\n    .. [2] Skogestad, Sigurd. Chemical and Energy Process Engineering. 1st\n       edition. Boca Raton, FL: CRC Press, 2008.", "docstring_tokens": ["r", "Calculates", "the", "equilibrium", "K", "-", "value", "assuming", "Raoult", "s", "law", "or", "an", "equation", "of", "state", "model", "or", "an", "activity", "coefficient", "model", "or", "a", "combined", "equation", "of", "state", "-", "activity", "model", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256398}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1136-L1144", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return inner most for loop in loop nest", "language": "python", "parameters": "(self, loop_nest)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "for", "arg_3", "in", "arg_1", ":", "if", "type", "(", "arg_3", ")", "is", "c_ast", ".", "For", ":", "return", "arg_0", ".", "Func", "(", "arg_3", ")", "or", "arg_3", "else", ":", "arg_2", "=", "arg_2", "or", "arg_0", ".", "Func", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return inner most for loop in loop nest\"\"\"\n        arg_2 = None\n        for arg_3 in arg_1:\n            if type(arg_3) is c_ast.For:\n                return arg_0.Func(arg_3) or arg_3\n            else:\n                arg_2 = arg_2 or arg_0.Func(arg_3)\n        return arg_2", "path": "kerncraft/kernel.py", "identifier": "KernelCode._find_inner_most_loop", "docstring": "Return inner most for loop in loop nest", "docstring_tokens": ["Return", "inner", "most", "for", "loop", "in", "loop", "nest"], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 256399}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/event.py#L158-L161", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "This forwards signal to sink", "language": "python", "parameters": "(self, sink, include_source=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "Eventful", ")", ",", "f'{sink.__class__.__name__} is not Eventful'", "arg_0", ".", "_forwards", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"This forwards signal to sink\"\"\"\n        assert isinstance(arg_1, Eventful), f'{sink.__class__.__name__} is not Eventful'\n        arg_0._forwards[arg_1] = arg_2", "path": "manticore/utils/event.py", "identifier": "Eventful.forward_events_to", "docstring": "This forwards signal to sink", "docstring_tokens": ["This", "forwards", "signal", "to", "sink"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256400}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/dictlist.py#L64-L92", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Get a list of members using several different ways of indexing", "language": "python", "parameters": "(self, iterable)", "return_statement": "return [get_item(item) for item in iterable]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "get_item", "(", "arg_2", ")", ":", "if", "isinstance", "(", "arg_2", ",", "int", ")", ":", "return", "arg_0", "[", "arg_2", "]", "elif", "isinstance", "(", "arg_2", ",", "string_types", ")", ":", "return", "arg_0", ".", "get_by_id", "(", "arg_2", ")", "elif", "arg_2", "in", "arg_0", ":", "return", "arg_2", "else", ":", "raise", "TypeError", "(", "\"item in iterable cannot be '%s'\"", "%", "type", "(", "arg_2", ")", ")", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", "=", "[", "arg_1", "]", "return", "[", "get_item", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get a list of members using several different ways of indexing\n\n        Parameters\n        ----------\n        iterable : list (if not, turned into single element list)\n            list where each element is either int (referring to an index in\n            in this DictList), string (a id of a member in this DictList) or\n            member of this DictList for pass-through\n\n        Returns\n        -------\n        list\n            a list of members\n        \"\"\"\n        def get_item(arg_2):\n            if isinstance(arg_2, int):\n                return arg_0[arg_2]\n            elif isinstance(arg_2, string_types):\n                return arg_0.get_by_id(arg_2)\n            elif arg_2 in arg_0:\n                return arg_2\n            else:\n                raise TypeError(\"item in iterable cannot be '%s'\" % type(arg_2))\n\n        if not isinstance(arg_1, list):\n            arg_1 = [arg_1]\n        return [get_item(arg_2) for arg_2 in arg_1]", "path": "cobra/core/dictlist.py", "identifier": "DictList.get_by_any", "docstring": "Get a list of members using several different ways of indexing\n\n        Parameters\n        ----------\n        iterable : list (if not, turned into single element list)\n            list where each element is either int (referring to an index in\n            in this DictList), string (a id of a member in this DictList) or\n            member of this DictList for pass-through\n\n        Returns\n        -------\n        list\n            a list of members", "docstring_tokens": ["Get", "a", "list", "of", "members", "using", "several", "different", "ways", "of", "indexing"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 256401}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/model.py#L317-L364", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Save the model in the given directory.", "language": "python", "parameters": "(self, saveModelDir)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_getLogger", "(", ")", "arg_2", ".", "debug", "(", "\"(%s) Creating local checkpoint in %r...\"", ",", "arg_0", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_getModelPickleFilePath", "(", "arg_1", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "raise", "Exception", "(", "(", "\"Existing filesystem entry <%s> is not a model\"", "\" checkpoint -- refusing to delete (not a directory)\"", ")", "%", "arg_1", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_3", ")", ":", "raise", "Exception", "(", "(", "\"Existing filesystem entry <%s> is not a model\"", "\" checkpoint -- refusing to delete\"", "\" (%s missing or not a file)\"", ")", "%", "(", "arg_1", ",", "arg_3", ")", ")", "shutil", ".", "rmtree", "(", "arg_1", ")", "arg_0", ".", "__makeDirectoryFromAbsolutePath", "(", "arg_1", ")", "with", "open", "(", "arg_3", ",", "'wb'", ")", "as", "modelPickleFile", ":", "arg_2", ".", "debug", "(", "\"(%s) Pickling Model instance...\"", ",", "arg_0", ")", "pickle", ".", "dump", "(", "arg_0", ",", "modelPickleFile", ",", "protocol", "=", "pickle", ".", "HIGHEST_PROTOCOL", ")", "arg_2", ".", "debug", "(", "\"(%s) Finished pickling Model instance\"", ",", "arg_0", ")", "arg_0", ".", "_serializeExtraData", "(", "extraDataDir", "=", "arg_0", ".", "_getModelExtraDataDir", "(", "arg_1", ")", ")", "arg_2", ".", "debug", "(", "\"(%s) Finished creating local checkpoint\"", ",", "arg_0", ")", "return"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Save the model in the given directory.\n\n    :param FuncModelDir: (string)\n         Absolute directory path for saving the model. This directory should\n         only be used to store a Funcd model. If the directory does not exist,\n         it will be created automatically and populated with model data. A\n         pre-existing directory will only be accepted if it contains previously\n         Funcd model data. If such a directory is given, the full contents of\n         the directory will be deleted and replaced with current model data.\n    \"\"\"\n    arg_2 = arg_0._getLogger()\n    arg_2.debug(\"(%s) Creating local checkpoint in %r...\",\n                       arg_0, arg_1)\n\n    arg_3 = arg_0._getModelPickleFilePath(arg_1)\n\n    # Clean up old Funcd state, if any\n    if os.path.exists(arg_1):\n      if not os.path.isdir(arg_1):\n        raise Exception((\"Existing filesystem entry <%s> is not a model\"\n                         \" checkpoint -- refusing to delete (not a directory)\") \\\n                          % arg_1)\n      if not os.path.isfile(arg_3):\n        raise Exception((\"Existing filesystem entry <%s> is not a model\"\n                         \" checkpoint -- refusing to delete\"\\\n                         \" (%s missing or not a file)\") % \\\n                          (arg_1, arg_3))\n\n      shutil.rmtree(arg_1)\n\n    # Create a new directory for saving state\n    arg_0.__makeDirectoryFromAbsolutePath(arg_1)\n\n    with open(arg_3, 'wb') as modelPickleFile:\n      arg_2.debug(\"(%s) Pickling Model instance...\", arg_0)\n\n      pickle.dump(arg_0, modelPickleFile, protocol=pickle.HIGHEST_PROTOCOL)\n\n      arg_2.debug(\"(%s) Finished pickling Model instance\", arg_0)\n\n\n    # Tell the model to Func extra data, if any, that's too big for pickling\n    arg_0._serializeExtraData(extraDataDir=arg_0._getModelExtraDataDir(arg_1))\n\n    arg_2.debug(\"(%s) Finished creating local checkpoint\", arg_0)\n\n    return", "path": "src/nupic/frameworks/opf/model.py", "identifier": "Model.save", "docstring": "Save the model in the given directory.\n\n    :param saveModelDir: (string)\n         Absolute directory path for saving the model. This directory should\n         only be used to store a saved model. If the directory does not exist,\n         it will be created automatically and populated with model data. A\n         pre-existing directory will only be accepted if it contains previously\n         saved model data. If such a directory is given, the full contents of\n         the directory will be deleted and replaced with current model data.", "docstring_tokens": ["Save", "the", "model", "in", "the", "given", "directory", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256402}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/bbciplayer.py#L122-L138", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Find the Video Packet ID in the HTML for the provided URL", "language": "python", "parameters": "(self, url, res=None)", "return_statement": "return vpid", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "log", ".", "debug", "(", "\"Looking for vpid on {0}\"", ",", "arg_1", ")", "arg_2", "=", "arg_2", "or", "arg_0", ".", "session", ".", "http", ".", "get", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "mediator_re", ".", "search", "(", "arg_2", ".", "text", ")", "arg_4", "=", "arg_3", "and", "parse_json", "(", "arg_3", ".", "group", "(", "1", ")", ",", "schema", "=", "arg_0", ".", "mediator_schema", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Find the Video Packet ID in the HTML for the provided URL\n\n        :param url: URL to download, if res is not provided.\n        :param res: Provide a cached version of the HTTP response to search\n        :type url: string\n        :type res: requests.Response\n        :return: Video Packet ID for a Programme in iPlayer\n        :rtype: string\n        \"\"\"\n        log.debug(\"Looking for vpid on {0}\", arg_1)\n        # Use pre-fetched page if available\n        arg_2 = arg_2 or arg_0.session.http.get(arg_1)\n        arg_3 = arg_0.mediator_re.search(arg_2.text)\n        arg_4 = arg_3 and parse_json(arg_3.group(1), schema=arg_0.mediator_schema)\n        return arg_4", "path": "src/streamlink/plugins/bbciplayer.py", "identifier": "BBCiPlayer.find_vpid", "docstring": "Find the Video Packet ID in the HTML for the provided URL\n\n        :param url: URL to download, if res is not provided.\n        :param res: Provide a cached version of the HTTP response to search\n        :type url: string\n        :type res: requests.Response\n        :return: Video Packet ID for a Programme in iPlayer\n        :rtype: string", "docstring_tokens": ["Find", "the", "Video", "Packet", "ID", "in", "the", "HTML", "for", "the", "provided", "URL"], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 256403}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth1.py#L841-L858", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Save access token to database.", "language": "python", "parameters": "(self, token, request)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "log", ".", "debug", "(", "'Save access token %r'", ",", "arg_1", ")", "arg_0", ".", "_tokensetter", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Save access token to database.\n\n        A tokensetter is required, which accepts a token and request\n        parameters::\n\n            def tokensetter(token, request):\n                access_token = Token(\n                    client=request.client,\n                    user=request.user,\n                    token=token['oauth_token'],\n                    secret=token['oauth_token_secret'],\n                    realms=token['oauth_authorized_realms'],\n                )\n                return access_token.save()\n        \"\"\"\n        log.debug('Save access token %r', arg_1)\n        arg_0._tokensetter(arg_1, arg_2)", "path": "flask_oauthlib/provider/oauth1.py", "identifier": "OAuth1RequestValidator.save_access_token", "docstring": "Save access token to database.\n\n        A tokensetter is required, which accepts a token and request\n        parameters::\n\n            def tokensetter(token, request):\n                access_token = Token(\n                    client=request.client,\n                    user=request.user,\n                    token=token['oauth_token'],\n                    secret=token['oauth_token_secret'],\n                    realms=token['oauth_authorized_realms'],\n                )\n                return access_token.save()", "docstring_tokens": ["Save", "access", "token", "to", "database", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 256404}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/xsrfutil.py#L61-L101", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Validates that the given token authorizes the user for the action.", "language": "python", "parameters": "(key, token, user_id, action_id=\"\", current_time=None)", "return_statement": "return not different", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"\"", ",", "arg_4", "=", "None", ")", ":", "if", "not", "arg_1", ":", "return", "False", "try", ":", "arg_5", "=", "base64", ".", "urlsafe_b64decode", "(", "arg_1", ")", "arg_6", "=", "int", "(", "arg_5", ".", "split", "(", "DELIMITER", ")", "[", "-", "1", "]", ")", "except", "(", "TypeError", ",", "ValueError", ",", "binascii", ".", "Error", ")", ":", "return", "False", "if", "arg_4", "is", "None", ":", "arg_4", "=", "time", ".", "time", "(", ")", "if", "arg_4", "-", "arg_6", ">", "DEFAULT_TIMEOUT_SECS", ":", "return", "False", "arg_7", "=", "generate_token", "(", "arg_0", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "when", "=", "arg_6", ")", "if", "len", "(", "arg_1", ")", "!=", "len", "(", "arg_7", ")", ":", "return", "False", "arg_8", "=", "0", "for", "arg_9", ",", "arg_10", "in", "zip", "(", "bytearray", "(", "arg_1", ")", ",", "bytearray", "(", "arg_7", ")", ")", ":", "arg_8", "|=", "arg_9", "^", "arg_10", "return", "not", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=\"\", arg_4=None):\n    \"\"\"Validates that the given token authorizes the user for the action.\n\n    Tokens are invalid if the time of issue is too old or if the token\n    does not match what generateToken outputs (i.e. the token was forged).\n\n    Args:\n        key: secret key to use.\n        token: a string of the token generated by generateToken.\n        user_id: the user ID of the authenticated user.\n        action_id: a string identifier of the action they requested\n                   authorization for.\n\n    Returns:\n        A boolean - True if the user is authorized for the action, False\n        otherwise.\n    \"\"\"\n    if not arg_1:\n        return False\n    try:\n        arg_5 = base64.urlsafe_b64decode(arg_1)\n        arg_6 = int(arg_5.split(DELIMITER)[-1])\n    except (TypeError, ValueError, binascii.Error):\n        return False\n    if arg_4 is None:\n        arg_4 = time.time()\n    # If the token is too old it's not valid.\n    if arg_4 - arg_6 > DEFAULT_TIMEOUT_SECS:\n        return False\n\n    # The given token should match the generated one with the same time.\n    arg_7 = generate_token(arg_0, arg_2, arg_3=arg_3,\n                                    when=arg_6)\n    if len(arg_1) != len(arg_7):\n        return False\n\n    # Perform constant time comparison to avoid timing attacks\n    arg_8 = 0\n    for arg_9, arg_10 in zip(bytearray(arg_1), bytearray(arg_7)):\n        arg_8 |= arg_9 ^ arg_10\n    return not arg_8", "path": "oauth2client/contrib/xsrfutil.py", "identifier": "validate_token", "docstring": "Validates that the given token authorizes the user for the action.\n\n    Tokens are invalid if the time of issue is too old or if the token\n    does not match what generateToken outputs (i.e. the token was forged).\n\n    Args:\n        key: secret key to use.\n        token: a string of the token generated by generateToken.\n        user_id: the user ID of the authenticated user.\n        action_id: a string identifier of the action they requested\n                   authorization for.\n\n    Returns:\n        A boolean - True if the user is authorized for the action, False\n        otherwise.", "docstring_tokens": ["Validates", "that", "the", "given", "token", "authorizes", "the", "user", "for", "the", "action", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 256405}
{"url": "https://github.com/mikewaters/command-session/blob/cea0d81a56551530f52f1cf3780c0ac408e069ef/commandsession/commandsession.py#L87-L99", "sha": "cea0d81a56551530f52f1cf3780c0ac408e069ef", "docstring_summary": "Get the output of the last command exevuted.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "len", "(", "arg_0", ".", "log", ")", ":", "raise", "RuntimeError", "(", "'Nothing executed'", ")", "try", ":", "arg_1", "=", "[", "l", "for", "l", "in", "arg_0", ".", "log", "if", "l", "[", "1", "]", "!=", "0", "]", "return", "arg_1", "[", "-", "1", "]", "[", "2", "]", "except", "IndexError", ":", "return", "'no last error'"], "function": "def Func(arg_0):\n        \"\"\"Get the output of the last command exevuted.\"\"\"\n        if not len(arg_0.log):\n            raise RuntimeError('Nothing executed')\n\n        try:\n            arg_1 = [l for l in arg_0.log if l[1] != 0]\n\n            return arg_1[-1][2]\n        except IndexError:\n            # odd case where there were no errors\n            #TODO\n            return 'no last error'", "path": "commandsession/commandsession.py", "identifier": "CommandSession.last_error", "docstring": "Get the output of the last command exevuted.", "docstring_tokens": ["Get", "the", "output", "of", "the", "last", "command", "exevuted", "."], "nwo": "mikewaters/command-session", "score": 0.0, "idx": 256406}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3497-L3503", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "We are just going to ignore the CS selector for now.", "language": "python", "parameters": "(cpu, cs_selector, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "logger", ".", "info", "(", "\"Func: Jumping to: %r:%r\"", ",", "arg_1", ".", "read", "(", ")", ",", "arg_2", ".", "read", "(", ")", ")", "arg_0", ".", "CS", "=", "arg_1", ".", "read", "(", ")", "arg_0", ".", "PC", "=", "arg_2", ".", "read", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        We are just going to ignore the CS selector for now.\n        \"\"\"\n        logger.info(\"Func: Jumping to: %r:%r\", arg_1.read(), arg_2.read())\n        arg_0.CS = arg_1.read()\n        arg_0.PC = arg_2.read()", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.LJMP", "docstring": "We are just going to ignore the CS selector for now.", "docstring_tokens": ["We", "are", "just", "going", "to", "ignore", "the", "CS", "selector", "for", "now", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256407}
{"url": "https://github.com/agabrown/PyGaia/blob/ae972b0622a15f713ffae471f925eac25ccdae47/examples/plotPhotometricErrorsSkyAvg.py#L31-L91", "sha": "ae972b0622a15f713ffae471f925eac25ccdae47", "docstring_summary": "Make the plot with photometry performance predictions.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "linspace", "(", "3.0", ",", "20.0", ",", "171", ")", "arg_2", "=", "arg_0", "[", "'vmini'", "]", "arg_3", "=", "arg_1", "-", "gminvFromVmini", "(", "arg_2", ")", "if", "arg_0", "[", "'eom'", "]", ":", "arg_4", "=", "gMagnitudeErrorEoM", "(", "arg_1", ")", "arg_5", "=", "bpMagnitudeErrorEoM", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "rpMagnitudeErrorEoM", "(", "arg_1", ",", "arg_2", ")", "arg_7", "=", "(", "1.0", "-", "4", ",", "0.1", ")", "else", ":", "arg_4", "=", "gMagnitudeError", "(", "arg_1", ")", "arg_5", "=", "bpMagnitudeError", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "rpMagnitudeError", "(", "arg_1", ",", "arg_2", ")", "arg_7", "=", "(", "1.0", "-", "4", ",", "1", ")", "arg_8", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "10", ",", "6.5", ")", ")", "if", "(", "arg_0", "[", "'vmagAbscissa'", "]", ")", ":", "plt", ".", "semilogy", "(", "arg_3", ",", "arg_4", ",", "'k'", ",", "label", "=", "'$\\\\sigma_G$'", ")", "plt", ".", "semilogy", "(", "arg_3", ",", "arg_5", ",", "'b'", ",", "label", "=", "'$\\\\sigma_{G_\\\\mathrm{BP}}$'", "+", "' for $(V-I)={0}$'", ".", "format", "(", "arg_2", ")", ")", "plt", ".", "semilogy", "(", "arg_3", ",", "arg_6", ",", "'r'", ",", "label", "=", "'$\\\\sigma_{G_\\\\mathrm{RP}}$'", "+", "' for $(V-I)={0}$'", ".", "format", "(", "arg_2", ")", ")", "plt", ".", "xlim", "(", "(", "6", ",", "20", ")", ")", "plt", ".", "legend", "(", "loc", "=", "0", ")", "plt", ".", "xlabel", "(", "'$V$ [mag]'", ")", "else", ":", "arg_9", "=", "arg_8", ".", "add_subplot", "(", "111", ")", "plt", ".", "semilogy", "(", "arg_1", ",", "arg_4", ",", "'k'", ",", "label", "=", "'$\\\\sigma_G$'", ")", "plt", ".", "semilogy", "(", "arg_1", ",", "arg_5", ",", "'b'", ",", "label", "=", "'$\\\\sigma_{G_\\\\mathrm{BP}}$'", "+", "' for $(V-I)={0}$'", ".", "format", "(", "arg_2", ")", ")", "plt", ".", "semilogy", "(", "arg_1", ",", "arg_6", ",", "'r'", ",", "label", "=", "'$\\\\sigma_{G_\\\\mathrm{RP}}$'", "+", "' for $(V-I)={0}$'", ".", "format", "(", "arg_2", ")", ")", "plt", ".", "xlim", "(", "(", "6", ",", "20", ")", ")", "plt", ".", "legend", "(", "loc", "=", "0", ")", "plt", ".", "xlabel", "(", "'$G$ [mag]'", ")", "plt", ".", "xticks", "(", "np", ".", "arange", "(", "6", ",", "20", ",", "2", ")", ")", "arg_9", "=", "plt", ".", "gca", "(", ")", ".", "yaxis", "plt", ".", "grid", "(", "which", "=", "'both'", ")", "plt", ".", "ylabel", "(", "'Photometric error [mag]'", ")", "if", "arg_0", "[", "'eom'", "]", ":", "plt", ".", "title", "(", "'End-of-mission mean photometry: sky averaged errors for $(V-I)={0}$'", ".", "format", "(", "arg_2", ")", ",", "fontsize", "=", "14", ")", "else", ":", "plt", ".", "title", "(", "'Single-FoV-transit photometry: sky averaged errors for $(V-I)={0}$'", ".", "format", "(", "arg_2", ")", ",", "fontsize", "=", "14", ")", "arg_10", "=", "'PhotometricErrors'", "if", "(", "arg_0", "[", "'pdfOutput'", "]", ")", ":", "plt", ".", "savefig", "(", "arg_10", "+", "'.pdf'", ")", "elif", "(", "arg_0", "[", "'pngOutput'", "]", ")", ":", "plt", ".", "savefig", "(", "arg_10", "+", "'.png'", ")", "else", ":", "plt", ".", "show", "(", ")"], "function": "def Func(arg_0):\n  \"\"\"\n  Make the plot with photometry performance predictions.\n\n  :argument args: command line arguments\n  \"\"\"\n  arg_1=np.linspace(3.0,20.0,171)\n\n  arg_2 = arg_0['vmini']\n  \n  arg_3=arg_1-gminvFromVmini(arg_2)\n  \n  if arg_0['eom']:\n      arg_4 = gMagnitudeErrorEoM(arg_1)\n      arg_5 = bpMagnitudeErrorEoM(arg_1, arg_2)\n      arg_6 = rpMagnitudeErrorEoM(arg_1, arg_2)\n      arg_7 = (1.0-4,0.1)\n  else:\n      arg_4 = gMagnitudeError(arg_1)\n      arg_5 = bpMagnitudeError(arg_1, arg_2)\n      arg_6 = rpMagnitudeError(arg_1, arg_2)\n      arg_7 = (1.0-4,1)\n\n  arg_8=plt.figure(figsize=(10,6.5))\n  \n  if (arg_0['vmagAbscissa']):\n    plt.semilogy(arg_3, arg_4, 'k', label='$\\\\sigma_G$')\n    plt.semilogy(arg_3, arg_5, 'b', label='$\\\\sigma_{G_\\\\mathrm{BP}}$'+' for $(V-I)={0}$'.format(arg_2))\n    plt.semilogy(arg_3, arg_6, 'r', label='$\\\\sigma_{G_\\\\mathrm{RP}}$'+' for $(V-I)={0}$'.format(arg_2))\n    plt.xlim((6,20))\n    #plt.ylim(yminmax)\n    plt.legend(loc=0)\n    plt.xlabel('$V$ [mag]')\n  else:\n    arg_9=arg_8.add_subplot(111)\n    plt.semilogy(arg_1, arg_4, 'k', label='$\\\\sigma_G$')\n    plt.semilogy(arg_1, arg_5, 'b', label='$\\\\sigma_{G_\\\\mathrm{BP}}$'+' for $(V-I)={0}$'.format(arg_2))\n    plt.semilogy(arg_1, arg_6, 'r', label='$\\\\sigma_{G_\\\\mathrm{RP}}$'+' for $(V-I)={0}$'.format(arg_2))\n    plt.xlim((6,20))\n    #plt.ylim(yminmax)\n    plt.legend(loc=0)\n    plt.xlabel('$G$ [mag]')\n  \n  plt.xticks(np.arange(6,20,2))\n  arg_9 = plt.gca().yaxis \n  #ax.set_major_formatter(matplotlib.ticker.ScalarFormatter())\n  #plt.ticklabel_format(axis='y',style='plain')\n  plt.grid(which='both')\n  plt.ylabel('Photometric error [mag]')\n  if arg_0['eom']:\n      plt.title('End-of-mission mean photometry: sky averaged errors for $(V-I)={0}$'.format(arg_2), fontsize=14)\n  else:\n      plt.title('Single-FoV-transit photometry: sky averaged errors for $(V-I)={0}$'.format(arg_2), fontsize=14)\n  \n  arg_10 = 'PhotometricErrors'\n  if (arg_0['pdfOutput']):\n    plt.savefig(arg_10+'.pdf')\n  elif (arg_0['pngOutput']):\n    plt.savefig(arg_10+'.png')\n  else:\n    plt.show()", "path": "examples/plotPhotometricErrorsSkyAvg.py", "identifier": "makePlot", "docstring": "Make the plot with photometry performance predictions.\n\n  :argument args: command line arguments", "docstring_tokens": ["Make", "the", "plot", "with", "photometry", "performance", "predictions", "."], "nwo": "agabrown/PyGaia", "score": 0.39410601089411446, "idx": 256408}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L185-L200", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Load a file from either local or gcs.", "language": "python", "parameters": "(file_path, credentials=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", ".", "startswith", "(", "'gs://'", ")", ":", "return", "_Func_from_gcs", "(", "arg_0", ",", "arg_1", ")", "else", ":", "return", "open", "(", "arg_0", ",", "'r'", ")"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"Load a file from either local or gcs.\n\n  Args:\n    file_path: The target file path, which should have the prefix 'gs://' if\n               to be loaded from gcs.\n    credentials: Optional credential to be used to load the file from gcs.\n\n  Returns:\n    A python File object if loading file from local or a StringIO object if\n    loading from gcs.\n  \"\"\"\n  if arg_0.startswith('gs://'):\n    return _Func_from_gcs(arg_0, arg_1)\n  else:\n    return open(arg_0, 'r')", "path": "dsub/lib/dsub_util.py", "identifier": "load_file", "docstring": "Load a file from either local or gcs.\n\n  Args:\n    file_path: The target file path, which should have the prefix 'gs://' if\n               to be loaded from gcs.\n    credentials: Optional credential to be used to load the file from gcs.\n\n  Returns:\n    A python File object if loading file from local or a StringIO object if\n    loading from gcs.", "docstring_tokens": ["Load", "a", "file", "from", "either", "local", "or", "gcs", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 256409}
{"url": "https://github.com/encode/starlette/blob/d23bfd0d8ff68d535d0283aa4099e5055da88bb9/starlette/websockets.py#L29-L49", "sha": "d23bfd0d8ff68d535d0283aa4099e5055da88bb9", "docstring_summary": "Receive ASGI websocket messages, ensuring valid state transitions.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", "->", "Message", ":", "if", "arg_0", ".", "client_state", "==", "WebSocketState", ".", "CONNECTING", ":", "arg_1", "=", "await", "arg_0", ".", "_Func", "(", ")", "arg_2", "=", "arg_1", "[", "\"type\"", "]", "assert", "arg_2", "==", "\"websocket.connect\"", "arg_0", ".", "client_state", "=", "WebSocketState", ".", "CONNECTED", "return", "arg_1", "elif", "arg_0", ".", "client_state", "==", "WebSocketState", ".", "CONNECTED", ":", "arg_1", "=", "await", "arg_0", ".", "_Func", "(", ")", "arg_2", "=", "arg_1", "[", "\"type\"", "]", "assert", "arg_2", "in", "{", "\"websocket.Func\"", ",", "\"websocket.disconnect\"", "}", "if", "arg_2", "==", "\"websocket.disconnect\"", ":", "arg_0", ".", "client_state", "=", "WebSocketState", ".", "DISCONNECTED", "return", "arg_1", "else", ":", "raise", "RuntimeError", "(", "'Cannot call \"Func\" once a disconnect message has been Funcd.'", ")"], "function": "async def Func(arg_0) -> Message:\n        \"\"\"\n        Receive ASGI websocket messages, ensuring valid state transitions.\n        \"\"\"\n        if arg_0.client_state == WebSocketState.CONNECTING:\n            arg_1 = await arg_0._Func()\n            arg_2 = arg_1[\"type\"]\n            assert arg_2 == \"websocket.connect\"\n            arg_0.client_state = WebSocketState.CONNECTED\n            return arg_1\n        elif arg_0.client_state == WebSocketState.CONNECTED:\n            arg_1 = await arg_0._Func()\n            arg_2 = arg_1[\"type\"]\n            assert arg_2 in {\"websocket.Func\", \"websocket.disconnect\"}\n            if arg_2 == \"websocket.disconnect\":\n                arg_0.client_state = WebSocketState.DISCONNECTED\n            return arg_1\n        else:\n            raise RuntimeError(\n                'Cannot call \"Func\" once a disconnect message has been Funcd.'\n            )", "path": "starlette/websockets.py", "identifier": "WebSocket.receive", "docstring": "Receive ASGI websocket messages, ensuring valid state transitions.", "docstring_tokens": ["Receive", "ASGI", "websocket", "messages", "ensuring", "valid", "state", "transitions", "."], "nwo": "encode/starlette", "score": 0.9921761654937327, "idx": 256410}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/agents/rich_content/default_rich_content.py#L111-L123", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns MS Bot Framework compatible state of the Button instance.", "language": "python", "parameters": "(self)", "return_statement": "return card_action", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "dict", ":", "arg_1", "=", "{", "}", "arg_1", "[", "'type'", "]", "=", "'postBack'", "arg_1", "[", "'title'", "]", "=", "arg_0", ".", "name", "arg_1", "[", "'value'", "]", "=", "arg_0", ".", "callback", "=", "arg_0", ".", "callback", "return", "arg_1"], "function": "def Func(arg_0) -> dict:\n        \"\"\"Returns MS Bot Framework compatible state of the Button instance.\n\n        Creates MS Bot Framework CardAction (button) with postBack value return.\n\n        Returns:\n            control_json: MS Bot Framework representation of Button state.\n        \"\"\"\n        arg_1 = {}\n        arg_1['type'] = 'postBack'\n        arg_1['title'] = arg_0.name\n        arg_1['value'] = arg_0.callback = arg_0.callback\n        return arg_1", "path": "deeppavlov/agents/rich_content/default_rich_content.py", "identifier": "Button.ms_bot_framework", "docstring": "Returns MS Bot Framework compatible state of the Button instance.\n\n        Creates MS Bot Framework CardAction (button) with postBack value return.\n\n        Returns:\n            control_json: MS Bot Framework representation of Button state.", "docstring_tokens": ["Returns", "MS", "Bot", "Framework", "compatible", "state", "of", "the", "Button", "instance", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 256411}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/config.py#L16-L21", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Read a filename as UTF-8 configuration data.", "language": "python", "parameters": "(self, filename)", "return_statement": "return configparser.RawConfigParser.read(self, filename, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "2", ")", ":", "arg_2", "[", "'encoding'", "]", "=", "\"utf-8\"", "return", "configparser", ".", "RawConfigParser", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read a filename as UTF-8 configuration data.\"\"\"\n        arg_2 = {}\n        if sys.version_info >= (3, 2):\n            arg_2['encoding'] = \"utf-8\"\n        return configparser.RawConfigParser.Func(arg_0, arg_1, **arg_2)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/config.py", "identifier": "HandyConfigParser.read", "docstring": "Read a filename as UTF-8 configuration data.", "docstring_tokens": ["Read", "a", "filename", "as", "UTF", "-", "8", "configuration", "data", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256412}
{"url": "https://github.com/jjangsangy/py-translate/blob/fe6279b2ee353f42ce73333ffae104e646311956/translate/coroutines.py#L62-L91", "sha": "fe6279b2ee353f42ce73333ffae104e646311956", "docstring_summary": "Generic accumulator function.", "language": "python", "parameters": "(init, update)", "return_statement": "return (\n        init + len(update)\n            if isinstance(init, int) else\n        init + update\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "arg_0", "+", "len", "(", "arg_1", ")", "if", "isinstance", "(", "arg_0", ",", "int", ")", "else", "arg_0", "+", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Generic Func function.\n\n    .. code-block:: python\n\n        # Simplest Form\n        >>> a = 'this' + ' '\n        >>> b = 'that'\n        >>> c = functools.reduce(Func, a, b)\n        >>> c\n        'this that'\n\n        # The type of the initial value determines output type.\n        >>> a = 5\n        >>> b = Hello\n        >>> c = functools.reduce(Func, a, b)\n        >>> c\n        10\n\n    :param init:  Initial Value\n    :param update: Value to accumulate\n\n    :return: Combined Values\n    \"\"\"\n    return (\n        arg_0 + len(arg_1)\n            if isinstance(arg_0, int) else\n        arg_0 + arg_1\n    )", "path": "translate/coroutines.py", "identifier": "accumulator", "docstring": "Generic accumulator function.\n\n    .. code-block:: python\n\n        # Simplest Form\n        >>> a = 'this' + ' '\n        >>> b = 'that'\n        >>> c = functools.reduce(accumulator, a, b)\n        >>> c\n        'this that'\n\n        # The type of the initial value determines output type.\n        >>> a = 5\n        >>> b = Hello\n        >>> c = functools.reduce(accumulator, a, b)\n        >>> c\n        10\n\n    :param init:  Initial Value\n    :param update: Value to accumulate\n\n    :return: Combined Values", "docstring_tokens": ["Generic", "accumulator", "function", "."], "nwo": "jjangsangy/py-translate", "score": 0.4707749115306036, "idx": 256413}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L277-L334", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Create and configure VPC", "language": "python", "parameters": "(self)", "return_statement": "return vpc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "ec2", ".", "Func", "(", "CidrBlock", "=", "'10.0.0.0/16'", ",", "AmazonProvidedIpv6CidrBlock", "=", "False", ",", ")", "except", "Exception", "as", "e", ":", "logger", ".", "error", "(", "\"{}\\n\"", ".", "format", "(", "e", ")", ")", "raise", "e", "arg_2", "=", "arg_0", ".", "ec2", ".", "create_internet_gateway", "(", ")", "arg_2", ".", "attach_to_vpc", "(", "VpcId", "=", "arg_1", ".", "vpc_id", ")", "arg_0", ".", "internet_gateway", "=", "arg_2", ".", "id", "arg_3", "=", "arg_0", ".", "config_route_table", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "route_table", "=", "arg_3", ".", "id", "arg_4", "=", "arg_0", ".", "client", ".", "describe_availability_zones", "(", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", "[", "'AvailabilityZones'", "]", ")", ":", "if", "arg_6", "[", "'State'", "]", "==", "\"available\"", ":", "arg_7", "=", "arg_1", ".", "create_subnet", "(", "CidrBlock", "=", "'10.0.{}.0/20'", ".", "format", "(", "16", "*", "arg_5", ")", ",", "AvailabilityZone", "=", "arg_6", "[", "'ZoneName'", "]", ")", "arg_7", ".", "meta", ".", "client", ".", "modify_subnet_attribute", "(", "SubnetId", "=", "arg_7", ".", "id", ",", "MapPublicIpOnLaunch", "=", "{", "\"Value\"", ":", "True", "}", ")", "arg_3", ".", "associate_with_subnet", "(", "SubnetId", "=", "arg_7", ".", "id", ")", "arg_0", ".", "sn_ids", ".", "append", "(", "arg_7", ".", "id", ")", "else", ":", "logger", ".", "info", "(", "\"{} unavailable\"", ".", "format", "(", "arg_6", "[", "'ZoneName'", "]", ")", ")", "arg_0", ".", "security_group", "(", "arg_1", ")", "arg_0", ".", "vpc_id", "=", "arg_1", ".", "id", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Create and configure VPC\n\n        We create a VPC with CIDR 10.0.0.0/16, which provides up to 64,000 instances.\n\n        We attach a subnet for each availability zone within the region specified in the\n        config. We give each subnet an ip range like 10.0.X.0/20, which is large enough\n        for approx. 4000 instances.\n\n        Security groups are configured in function security_group.\n        \"\"\"\n\n        try:\n            # We use a large VPC so that the cluster can get large\n            arg_1 = arg_0.ec2.Func(\n                CidrBlock='10.0.0.0/16',\n                AmazonProvidedIpv6CidrBlock=False,\n            )\n        except Exception as e:\n            # This failure will cause a full abort\n            logger.error(\"{}\\n\".format(e))\n            raise e\n\n        # Attach internet gateway so that our cluster can\n        # talk to the outside internet\n        arg_2 = arg_0.ec2.create_internet_gateway()\n        arg_2.attach_to_vpc(VpcId=arg_1.vpc_id)  # Returns None\n        arg_0.internet_gateway = arg_2.id\n\n        # Create and configure route table to allow proper traffic\n        arg_3 = arg_0.config_route_table(arg_1, arg_2)\n        arg_0.route_table = arg_3.id\n\n        # Get all avaliability zones\n        arg_4 = arg_0.client.describe_availability_zones()\n\n        # go through AZs and set up a subnet per\n        for arg_5, arg_6 in enumerate(arg_4['AvailabilityZones']):\n            if arg_6['State'] == \"available\":\n\n                # Create a large subnet (4000 max nodes)\n                arg_7 = arg_1.create_subnet(\n                    CidrBlock='10.0.{}.0/20'.format(16 * arg_5), AvailabilityZone=arg_6['ZoneName']\n                )\n\n                # Make subnet accessible\n                arg_7.meta.client.modify_subnet_attribute(\n                    SubnetId=arg_7.id, MapPublicIpOnLaunch={\"Value\": True}\n                )\n\n                arg_3.associate_with_subnet(SubnetId=arg_7.id)\n                arg_0.sn_ids.append(arg_7.id)\n            else:\n                logger.info(\"{} unavailable\".format(arg_6['ZoneName']))\n        # Security groups\n        arg_0.security_group(arg_1)\n        arg_0.vpc_id = arg_1.id\n        return arg_1", "path": "parsl/providers/aws/aws.py", "identifier": "AWSProvider.create_vpc", "docstring": "Create and configure VPC\n\n        We create a VPC with CIDR 10.0.0.0/16, which provides up to 64,000 instances.\n\n        We attach a subnet for each availability zone within the region specified in the\n        config. We give each subnet an ip range like 10.0.X.0/20, which is large enough\n        for approx. 4000 instances.\n\n        Security groups are configured in function security_group.", "docstring_tokens": ["Create", "and", "configure", "VPC"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 256414}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/github/queryManager.py#L454-L478", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Load a JSON data file into the internal JSON data dictionary.", "language": "python", "parameters": "(self, filePath=None, updatePath=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "filePath", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "raise", "FileNotFoundError", "(", "\"Data file '%s' does not exist.\"", "%", "(", "arg_1", ")", ")", "else", ":", "print", "(", "\"Importing existing data file '%s' ... \"", "%", "(", "arg_1", ")", ",", "end", "=", "\"\"", ",", "flush", "=", "True", ")", "with", "open", "(", "arg_1", ",", "\"r\"", ")", "as", "q", ":", "arg_3", "=", "q", ".", "read", "(", ")", "print", "(", "\"Imported!\"", ")", "arg_0", ".", "data", "=", "json", ".", "loads", "(", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "filePath", "=", "arg_1"], "function": "def Func(arg_0, arg_1=None, arg_2=True):\n        \"\"\"Load a JSON data file into the internal JSON data dictionary.\n\n        Current internal data will be overwritten.\n        If no file path is provided, the stored data file path will be used.\n\n        Args:\n            filePath (Optional[str]): A relative or absolute path to a\n                '.json' file. Defaults to None.\n            updatePath (Optional[bool]): Specifies whether or not to update\n                the stored data file path. Defaults to True.\n\n        \"\"\"\n        if not arg_1:\n            arg_1 = arg_0.filePath\n        if not os.path.isfile(arg_1):\n            raise FileNotFoundError(\"Data file '%s' does not exist.\" % (arg_1))\n        else:\n            print(\"Importing existing data file '%s' ... \" % (arg_1), end=\"\", flush=True)\n            with open(arg_1, \"r\") as q:\n                arg_3 = q.read()\n            print(\"Imported!\")\n            arg_0.data = json.loads(arg_3)\n            if arg_2:\n                arg_0.filePath = arg_1", "path": "scraper/github/queryManager.py", "identifier": "DataManager.fileLoad", "docstring": "Load a JSON data file into the internal JSON data dictionary.\n\n        Current internal data will be overwritten.\n        If no file path is provided, the stored data file path will be used.\n\n        Args:\n            filePath (Optional[str]): A relative or absolute path to a\n                '.json' file. Defaults to None.\n            updatePath (Optional[bool]): Specifies whether or not to update\n                the stored data file path. Defaults to True.", "docstring_tokens": ["Load", "a", "JSON", "data", "file", "into", "the", "internal", "JSON", "data", "dictionary", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 256415}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/trust_list.py#L27-L161", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Extracts trusted CA certificates from the OS X trusted root keychain.", "language": "python", "parameters": "(cert_callback=None, callback_only_on_failure=False)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "new", "(", "CoreFoundation", ",", "'CFArrayRef *'", ")", "arg_3", "=", "Security", ".", "SecTrustCopyAnchorCertificates", "(", "arg_2", ")", "handle_sec_error", "(", "arg_3", ")", "arg_4", "=", "unwrap", "(", "arg_2", ")", "arg_5", "=", "{", "}", "arg_6", "=", "{", "}", "arg_7", "=", "'2.5.29.37.0'", "arg_8", "=", "(", "set", "(", ")", ",", "set", "(", ")", ")", "arg_9", "=", "CoreFoundation", ".", "CFArrayGetCount", "(", "arg_4", ")", "for", "arg_10", "in", "range", "(", "0", ",", "arg_9", ")", ":", "arg_11", "=", "CoreFoundation", ".", "CFArrayGetValueAtIndex", "(", "arg_4", ",", "arg_10", ")", "arg_12", ",", "arg_13", "=", "_cert_details", "(", "arg_11", ")", "arg_5", "[", "arg_13", "]", "=", "arg_12", "CoreFoundation", ".", "CFRelease", "(", "arg_4", ")", "for", "arg_14", "in", "[", "SecurityConst", ".", "kSecTrustSettingsDomainUser", ",", "SecurityConst", ".", "kSecTrustSettingsDomainAdmin", "]", ":", "arg_15", "=", "new", "(", "CoreFoundation", ",", "'CFArrayRef *'", ")", "arg_3", "=", "Security", ".", "SecTrustSettingsCopyCertificates", "(", "arg_14", ",", "arg_15", ")", "if", "arg_3", "==", "SecurityConst", ".", "errSecNoTrustSettings", ":", "continue", "handle_sec_error", "(", "arg_3", ")", "arg_16", "=", "unwrap", "(", "arg_15", ")", "arg_9", "=", "CoreFoundation", ".", "CFArrayGetCount", "(", "arg_16", ")", "for", "arg_10", "in", "range", "(", "0", ",", "arg_9", ")", ":", "arg_11", "=", "CoreFoundation", ".", "CFArrayGetValueAtIndex", "(", "arg_16", ",", "arg_10", ")", "arg_17", "=", "new", "(", "CoreFoundation", ",", "'CFArrayRef *'", ")", "arg_3", "=", "Security", ".", "SecTrustSettingsCopyTrustSettings", "(", "arg_11", ",", "arg_14", ",", "arg_17", ")", "if", "arg_3", "==", "SecurityConst", ".", "errSecItemNotFound", ":", "continue", "if", "arg_3", "==", "SecurityConst", ".", "errSecInvalidTrustSettings", ":", "arg_12", ",", "arg_13", "=", "_cert_details", "(", "arg_11", ")", "if", "arg_13", "in", "arg_5", ":", "_cert_callback", "(", "arg_0", ",", "arg_5", "[", "arg_13", "]", ",", "'invalid trust settings'", ")", "del", "arg_5", "[", "arg_13", "]", "continue", "handle_sec_error", "(", "arg_3", ")", "arg_18", "=", "unwrap", "(", "arg_17", ")", "arg_19", "=", "set", "(", ")", "arg_20", "=", "set", "(", ")", "arg_21", "=", "CoreFoundation", ".", "CFArrayGetCount", "(", "arg_18", ")", "for", "arg_22", "in", "range", "(", "0", ",", "arg_21", ")", ":", "arg_23", "=", "CoreFoundation", ".", "CFArrayGetValueAtIndex", "(", "arg_18", ",", "arg_22", ")", "arg_24", "=", "CFHelpers", ".", "cf_dictionary_to_dict", "(", "arg_23", ")", "arg_25", "=", "arg_24", ".", "get", "(", "'kSecTrustSettingsPolicy'", ",", "{", "}", ")", ".", "get", "(", "'SecPolicyOid'", ",", "arg_7", ")", "arg_26", "=", "arg_24", ".", "get", "(", "'kSecTrustSettingsResult'", ",", "1", ")", "arg_27", "=", "arg_26", "!=", "0", "and", "arg_26", "!=", "3", "if", "arg_27", ":", "arg_19", ".", "add", "(", "arg_25", ")", "else", ":", "arg_20", ".", "add", "(", "arg_25", ")", "arg_12", ",", "arg_13", "=", "_cert_details", "(", "arg_11", ")", "if", "arg_7", "in", "arg_20", ":", "if", "arg_13", "in", "arg_5", ":", "_cert_callback", "(", "arg_0", ",", "arg_5", "[", "arg_13", "]", ",", "'explicitly distrusted'", ")", "del", "arg_5", "[", "arg_13", "]", "else", ":", "if", "arg_7", "in", "arg_19", ":", "arg_19", "=", "set", "(", "[", "arg_7", "]", ")", "arg_6", "[", "arg_13", "]", "=", "(", "arg_19", ",", "arg_20", ")", "CoreFoundation", ".", "CFRelease", "(", "arg_18", ")", "CoreFoundation", ".", "CFRelease", "(", "arg_16", ")", "arg_28", "=", "[", "]", "for", "arg_13", "in", "arg_5", ":", "if", "not", "arg_1", ":", "_cert_callback", "(", "arg_0", ",", "arg_5", "[", "arg_13", "]", ",", "None", ")", "arg_29", "=", "arg_6", ".", "get", "(", "arg_13", ",", "arg_8", ")", "arg_28", ".", "append", "(", "(", "arg_5", "[", "arg_13", "]", ",", "arg_29", "[", "0", "]", ",", "arg_29", "[", "1", "]", ")", ")", "return", "arg_28"], "function": "def Func(arg_0=None, arg_1=False):\n    \"\"\"\n    Extracts trusted CA certificates from the OS X trusted root keychain.\n\n    :param cert_callback:\n        A callback that is called once for each certificate in the trust store.\n        It should accept two parameters: an asn1crypto.x509.Certificate object,\n        and a reason. The reason will be None if the certificate is being\n        exported, otherwise it will be a unicode string of the reason it won't.\n\n    :param callback_only_on_failure:\n        A boolean - if the callback should only be called when a certificate is\n        not exported.\n\n    :raises:\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A list of 3-element tuples:\n         - 0: a byte string of a DER-encoded certificate\n         - 1: a set of unicode strings that are OIDs of purposes to trust the\n              certificate for\n         - 2: a set of unicode strings that are OIDs of purposes to reject the\n              certificate for\n    \"\"\"\n\n    arg_2 = new(CoreFoundation, 'CFArrayRef *')\n    arg_3 = Security.SecTrustCopyAnchorCertificates(arg_2)\n    handle_sec_error(arg_3)\n\n    arg_4 = unwrap(arg_2)\n\n    arg_5 = {}\n    arg_6 = {}\n\n    arg_7 = '2.5.29.37.0'\n    arg_8 = (set(), set())\n\n    arg_9 = CoreFoundation.CFArrayGetCount(arg_4)\n    for arg_10 in range(0, arg_9):\n        arg_11 = CoreFoundation.CFArrayGetValueAtIndex(arg_4, arg_10)\n        arg_12, arg_13 = _cert_details(arg_11)\n        arg_5[arg_13] = arg_12\n\n    CoreFoundation.CFRelease(arg_4)\n\n    for arg_14 in [SecurityConst.kSecTrustSettingsDomainUser, SecurityConst.kSecTrustSettingsDomainAdmin]:\n        arg_15 = new(CoreFoundation, 'CFArrayRef *')\n        arg_3 = Security.SecTrustSettingsCopyCertificates(arg_14, arg_15)\n        if arg_3 == SecurityConst.errSecNoTrustSettings:\n            continue\n        handle_sec_error(arg_3)\n\n        arg_16 = unwrap(arg_15)\n\n        arg_9 = CoreFoundation.CFArrayGetCount(arg_16)\n        for arg_10 in range(0, arg_9):\n            arg_11 = CoreFoundation.CFArrayGetValueAtIndex(arg_16, arg_10)\n\n            arg_17 = new(CoreFoundation, 'CFArrayRef *')\n            arg_3 = Security.SecTrustSettingsCopyTrustSettings(arg_11, arg_14, arg_17)\n\n            # In OS X 10.11, this value started being seen. From the comments in\n            # the Security Framework Reference, the lack of any settings should\n            # indicate \"always trust this certificate\"\n            if arg_3 == SecurityConst.errSecItemNotFound:\n                continue\n\n            # If the trust settings for a certificate are invalid, we need to\n            # assume the certificate should not be trusted\n            if arg_3 == SecurityConst.errSecInvalidTrustSettings:\n                arg_12, arg_13 = _cert_details(arg_11)\n                if arg_13 in arg_5:\n                    _cert_callback(\n                        arg_0,\n                        arg_5[arg_13],\n                        'invalid trust settings'\n                    )\n                    del arg_5[arg_13]\n                continue\n\n            handle_sec_error(arg_3)\n\n            arg_18 = unwrap(arg_17)\n\n            arg_19 = set()\n            arg_20 = set()\n            arg_21 = CoreFoundation.CFArrayGetCount(arg_18)\n            for arg_22 in range(0, arg_21):\n                arg_23 = CoreFoundation.CFArrayGetValueAtIndex(arg_18, arg_22)\n                arg_24 = CFHelpers.cf_dictionary_to_dict(arg_23)\n\n                # No policy OID means the trust result is for all purposes\n                arg_25 = arg_24.get('kSecTrustSettingsPolicy', {}).get('SecPolicyOid', arg_7)\n\n                # 0 = kSecTrustSettingsResultInvalid\n                # 1 = kSecTrustSettingsResultTrustRoot\n                # 2 = kSecTrustSettingsResultTrustAsRoot\n                # 3 = kSecTrustSettingsResultDeny\n                # 4 = kSecTrustSettingsResultUnspecified\n                arg_26 = arg_24.get('kSecTrustSettingsResult', 1)\n                arg_27 = arg_26 != 0 and arg_26 != 3\n\n                if arg_27:\n                    arg_19.add(arg_25)\n                else:\n                    arg_20.add(arg_25)\n\n            arg_12, arg_13 = _cert_details(arg_11)\n\n            # If rejected for all purposes, we don't export the certificate\n            if arg_7 in arg_20:\n                if arg_13 in arg_5:\n                    _cert_callback(\n                        arg_0,\n                        arg_5[arg_13],\n                        'explicitly distrusted'\n                    )\n                    del arg_5[arg_13]\n            else:\n                if arg_7 in arg_19:\n                    arg_19 = set([arg_7])\n                arg_6[arg_13] = (arg_19, arg_20)\n\n            CoreFoundation.CFRelease(arg_18)\n\n        CoreFoundation.CFRelease(arg_16)\n\n    arg_28 = []\n    for arg_13 in arg_5:\n        if not arg_1:\n            _cert_callback(arg_0, arg_5[arg_13], None)\n        arg_29 = arg_6.get(arg_13, arg_8)\n        arg_28.append((arg_5[arg_13], arg_29[0], arg_29[1]))\n    return arg_28", "path": "oscrypto/_osx/trust_list.py", "identifier": "extract_from_system", "docstring": "Extracts trusted CA certificates from the OS X trusted root keychain.\n\n    :param cert_callback:\n        A callback that is called once for each certificate in the trust store.\n        It should accept two parameters: an asn1crypto.x509.Certificate object,\n        and a reason. The reason will be None if the certificate is being\n        exported, otherwise it will be a unicode string of the reason it won't.\n\n    :param callback_only_on_failure:\n        A boolean - if the callback should only be called when a certificate is\n        not exported.\n\n    :raises:\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A list of 3-element tuples:\n         - 0: a byte string of a DER-encoded certificate\n         - 1: a set of unicode strings that are OIDs of purposes to trust the\n              certificate for\n         - 2: a set of unicode strings that are OIDs of purposes to reject the\n              certificate for", "docstring_tokens": ["Extracts", "trusted", "CA", "certificates", "from", "the", "OS", "X", "trusted", "root", "keychain", "."], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 256416}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/lms.py#L183-L196", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Query the Enrollment API for the specific course modes that are available for the given course_id.", "language": "python", "parameters": "(self, course_id)", "return_statement": "return self._sort_course_modes([mode for mode in modes if mode['slug'] not in EXCLUDED_COURSE_MODES])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_course_details", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "get", "(", "'course_modes'", ",", "[", "]", ")", "return", "arg_0", ".", "_sort_course_modes", "(", "[", "arg_4", "for", "arg_4", "in", "arg_3", "if", "arg_4", "[", "'slug'", "]", "not", "in", "EXCLUDED_COURSE_MODES", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Query the Enrollment API for the specific course modes that are available for the given course_id.\n\n        Arguments:\n            course_id (str): The string value of the course's unique identifier\n\n        Returns:\n            list: A list of course mode dictionaries.\n\n        \"\"\"\n        arg_2 = arg_0.get_course_details(arg_1)\n        arg_3 = arg_2.get('course_modes', [])\n        return arg_0._sort_course_modes([arg_4 for arg_4 in arg_3 if arg_4['slug'] not in EXCLUDED_COURSE_MODES])", "path": "enterprise/api_client/lms.py", "identifier": "EnrollmentApiClient.get_course_modes", "docstring": "Query the Enrollment API for the specific course modes that are available for the given course_id.\n\n        Arguments:\n            course_id (str): The string value of the course's unique identifier\n\n        Returns:\n            list: A list of course mode dictionaries.", "docstring_tokens": ["Query", "the", "Enrollment", "API", "for", "the", "specific", "course", "modes", "that", "are", "available", "for", "the", "given", "course_id", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256417}
{"url": "https://github.com/sbneto/s3conf/blob/92fd2973beccc85bb21d3157ff227929e62ed695/s3conf/client.py#L177-L190", "sha": "92fd2973beccc85bb21d3157ff227929e62ed695", "docstring_summary": "Download a file or folder from the S3-like service.", "language": "python", "parameters": "(remote_path, local_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "STORAGES", "[", "'s3'", "]", "(", ")", "arg_3", "=", "s3conf", ".", "S3Conf", "(", "arg_2", "=", "arg_2", ")", "arg_3", ".", "Func", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Download a file or folder from the S3-like service.\n\n    If REMOTE_PATH has a trailing slash it is considered to be a folder, e.g.: \"s3://my-bucket/my-folder/\". In this\n    case, LOCAL_PATH must be a folder as well. The files and subfolder structure in REMOTE_PATH are copied to\n    LOCAL_PATH.\n\n    If REMOTE_PATH does not have a trailing slash, it is considered to be a file, and LOCAL_PATH should be a file as\n    well.\n    \"\"\"\n    arg_2 = STORAGES['s3']()\n    arg_3 = s3conf.S3Conf(arg_2=arg_2)\n    arg_3.Func(arg_0, arg_1)", "path": "s3conf/client.py", "identifier": "download", "docstring": "Download a file or folder from the S3-like service.\n\n    If REMOTE_PATH has a trailing slash it is considered to be a folder, e.g.: \"s3://my-bucket/my-folder/\". In this\n    case, LOCAL_PATH must be a folder as well. The files and subfolder structure in REMOTE_PATH are copied to\n    LOCAL_PATH.\n\n    If REMOTE_PATH does not have a trailing slash, it is considered to be a file, and LOCAL_PATH should be a file as\n    well.", "docstring_tokens": ["Download", "a", "file", "or", "folder", "from", "the", "S3", "-", "like", "service", "."], "nwo": "sbneto/s3conf", "score": 0.3282631104312029, "idx": 256418}
{"url": "https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/connection.py#L54-L62", "sha": "9d0e8ebcba31d937f73752f9b88e5a4fec860765", "docstring_summary": "Add the bucket to MimicDB after successful creation.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return bucket", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "super", "(", "S3Connection", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "arg_3", ":", "mimicdb", ".", "backend", ".", "sadd", "(", "tpl", ".", "connection", ",", "arg_3", ".", "name", ")", "return", "arg_3"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Add the bucket to MimicDB after successful creation.\n        \"\"\"\n        arg_3 = super(S3Connection, arg_0).Func(*arg_1, **arg_2)\n\n        if arg_3:\n            mimicdb.backend.sadd(tpl.connection, arg_3.name)\n\n        return arg_3", "path": "mimicdb/s3/connection.py", "identifier": "S3Connection.create_bucket", "docstring": "Add the bucket to MimicDB after successful creation.", "docstring_tokens": ["Add", "the", "bucket", "to", "MimicDB", "after", "successful", "creation", "."], "nwo": "nathancahill/mimicdb", "score": 0.18112697196067942, "idx": 256419}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L166-L182", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Calculates network-wide concordance.", "language": "python", "parameters": "(graph: BELGraph, key: str, cutoff: Optional[float] = None,\n                          use_ambiguous: bool = False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "[", "arg_6", "]", "=", "None", ",", "arg_7", ":", "arg_8", "=", "False", ")", "->", "arg_6", ":", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", "=", "Func_helper", "(", "arg_0", ",", "arg_2", ",", "arg_4", "=", "arg_4", ")", "try", ":", "return", "arg_9", "/", "(", "arg_9", "+", "arg_10", "+", "(", "arg_11", "if", "arg_7", "else", "0", ")", ")", "except", "ZeroDivisionError", ":", "return", "-", "1.0"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5[arg_6] = None,\n                          arg_7: arg_8 = False) -> arg_6:\n    \"\"\"Calculates network-wide concordance.\n\n    Assumes data already annotated with given key\n\n    :param graph: A BEL graph\n    :param key: The node data dictionary key storing the logFC\n    :param cutoff: The optional logFC cutoff for significance\n    :param use_ambiguous: Compare to ambiguous edges as well\n    \"\"\"\n    arg_9, arg_10, arg_11, arg_12 = Func_helper(arg_0, arg_2, arg_4=arg_4)\n\n    try:\n        return arg_9 / (arg_9 + arg_10 + (arg_11 if arg_7 else 0))\n    except ZeroDivisionError:\n        return -1.0", "path": "src/pybel_tools/analysis/concordance.py", "identifier": "calculate_concordance", "docstring": "Calculates network-wide concordance.\n\n    Assumes data already annotated with given key\n\n    :param graph: A BEL graph\n    :param key: The node data dictionary key storing the logFC\n    :param cutoff: The optional logFC cutoff for significance\n    :param use_ambiguous: Compare to ambiguous edges as well", "docstring_tokens": ["Calculates", "network", "-", "wide", "concordance", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256420}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L1420-L1438", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Parse a Gin config file.", "language": "python", "parameters": "(config_file, skip_unknown=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "for", "arg_2", ",", "arg_3", "in", "_FILE_READERS", ":", "if", "arg_3", "(", "arg_0", ")", ":", "with", "arg_2", "(", "arg_0", ")", "as", "f", ":", "parse_config", "(", "f", ",", "arg_1", "=", "arg_1", ")", "return", "raise", "IOError", "(", "'Unable to open file: {}'", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=False):\n  \"\"\"Parse a Gin config file.\n\n  Args:\n    config_file: The path to a Gin config file.\n    skip_unknown: A boolean indicating whether unknown configurables and imports\n      should be skipped instead of causing errors (alternatively a list of\n      configurable names to skip if unknown). See `parse_config` for additional\n      details.\n\n  Raises:\n    IOError: If `config_file` cannot be read using any register file reader.\n  \"\"\"\n  for arg_2, arg_3 in _FILE_READERS:\n    if arg_3(arg_0):\n      with arg_2(arg_0) as f:\n        parse_config(f, arg_1=arg_1)\n        return\n  raise IOError('Unable to open file: {}'.format(arg_0))", "path": "gin/config.py", "identifier": "parse_config_file", "docstring": "Parse a Gin config file.\n\n  Args:\n    config_file: The path to a Gin config file.\n    skip_unknown: A boolean indicating whether unknown configurables and imports\n      should be skipped instead of causing errors (alternatively a list of\n      configurable names to skip if unknown). See `parse_config` for additional\n      details.\n\n  Raises:\n    IOError: If `config_file` cannot be read using any register file reader.", "docstring_tokens": ["Parse", "a", "Gin", "config", "file", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 256421}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/examples/certgen.py#L30-L55", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Create a certificate request.", "language": "python", "parameters": "(pkey, digest=\"sha256\", **name)", "return_statement": "return req", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"sha256\"", ",", "**", "arg_2", ")", ":", "arg_3", "=", "crypto", ".", "X509Req", "(", ")", "arg_4", "=", "arg_3", ".", "get_subject", "(", ")", "for", "arg_5", ",", "arg_6", "in", "arg_2", ".", "items", "(", ")", ":", "setattr", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", "arg_3", ".", "set_pubkey", "(", "arg_0", ")", "arg_3", ".", "sign", "(", "arg_0", ",", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=\"sha256\", **arg_2):\n    \"\"\"\n    Create a certificate request.\n\n    Arguments: pkey   - The key to associate with the request\n               digest - Digestion method to use for signing, default is sha256\n               **name - The name of the subject of the request, possible\n                        arguments are:\n                          C     - Country name\n                          ST    - State or province name\n                          L     - Locality name\n                          O     - Organization name\n                          OU    - Organizational unit name\n                          CN    - Common name\n                          emailAddress - E-mail address\n    Returns:   The certificate request in an X509Req object\n    \"\"\"\n    arg_3 = crypto.X509Req()\n    arg_4 = arg_3.get_subject()\n\n    for arg_5, arg_6 in arg_2.items():\n        setattr(arg_4, arg_5, arg_6)\n\n    arg_3.set_pubkey(arg_0)\n    arg_3.sign(arg_0, arg_1)\n    return arg_3", "path": "examples/certgen.py", "identifier": "createCertRequest", "docstring": "Create a certificate request.\n\n    Arguments: pkey   - The key to associate with the request\n               digest - Digestion method to use for signing, default is sha256\n               **name - The name of the subject of the request, possible\n                        arguments are:\n                          C     - Country name\n                          ST    - State or province name\n                          L     - Locality name\n                          O     - Organization name\n                          OU    - Organizational unit name\n                          CN    - Common name\n                          emailAddress - E-mail address\n    Returns:   The certificate request in an X509Req object", "docstring_tokens": ["Create", "a", "certificate", "request", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256422}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L898-L902", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper returning True if dtype.is_integer or is `bool`.", "language": "python", "parameters": "(dt)", "return_statement": "return dt.is_integer or dt.base_dtype == tf.bool", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "_is_known_dtype", "(", "arg_0", ")", ":", "raise", "TypeError", "(", "\"Unrecognized dtype: {}\"", ".", "format", "(", "arg_0", ".", "name", ")", ")", "return", "arg_0", ".", "is_integer", "or", "arg_0", ".", "base_dtype", "==", "tf", ".", "bool"], "function": "def Func(arg_0):\n  \"\"\"Helper returning True if dtype.is_integer or is `bool`.\"\"\"\n  if not _is_known_dtype(arg_0):\n    raise TypeError(\"Unrecognized dtype: {}\".format(arg_0.name))\n  return arg_0.is_integer or arg_0.base_dtype == tf.bool", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "_is_integer_like_by_dtype", "docstring": "Helper returning True if dtype.is_integer or is `bool`.", "docstring_tokens": ["Helper", "returning", "True", "if", "dtype", ".", "is_integer", "or", "is", "bool", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256423}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/utils.py#L150-L159", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Open document by the default handler of the OS, could be a url opened by a browser, a text file by an editor etc", "language": "python", "parameters": "(document)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "platform", ".", "system", "(", ")", ".", "lower", "(", ")", "if", "arg_1", "==", "\"darwin\"", ":", "os", ".", "system", "(", "\"open \\\"\"", "+", "arg_0", "+", "\"\\\"\"", ")", "if", "arg_1", "==", "\"linux\"", ":", "arg_2", "=", "\"xdg-open \\\"\"", "+", "arg_0", "+", "\"\\\"&\"", "os", ".", "system", "(", "arg_2", ")", "if", "arg_1", "==", "\"windows\"", ":", "os", ".", "system", "(", "\"start \\\"\"", "+", "arg_0", "+", "\"\\\"\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Open document by the default handler of the OS, could be a url opened by a browser, a text file by an editor etc\"\"\"\n    arg_1 = platform.system().lower()\n    if arg_1 == \"darwin\":\n        os.system(\"open \\\"\" + arg_0 + \"\\\"\")\n    if arg_1 == \"linux\":\n        arg_2 = \"xdg-open \\\"\" + arg_0 + \"\\\"&\"\n        os.system(arg_2)\n    if arg_1 == \"windows\":\n        os.system(\"start \\\"\" + arg_0 + \"\\\"\")", "path": "packages/vaex-core/vaex/utils.py", "identifier": "os_open", "docstring": "Open document by the default handler of the OS, could be a url opened by a browser, a text file by an editor etc", "docstring_tokens": ["Open", "document", "by", "the", "default", "handler", "of", "the", "OS", "could", "be", "a", "url", "opened", "by", "a", "browser", "a", "text", "file", "by", "an", "editor", "etc"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 256424}
{"url": "https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L142-L175", "sha": "ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449", "docstring_summary": "Runs EM iterations", "language": "python", "parameters": "(self, model, tol=0.001, max_iters=999, verbose=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.001", ",", "arg_3", "=", "999", ",", "arg_4", "=", "True", ")", ":", "arg_5", "=", "np", ".", "seterr", "(", "all", "=", "'raise'", ")", "np", ".", "seterr", "(", "under", "=", "'ignore'", ")", "if", "arg_4", ":", "print", "print", "\"Iter No  Time (hh:mm:ss)    Total change (TPM)  \"", "print", "\"-------  ---------------  ----------------------\"", "arg_6", "=", "0", "arg_7", "=", "1000000.0", "arg_8", "=", "time", ".", "time", "(", ")", "arg_9", "=", "1000000.0", "*", "arg_2", "while", "arg_7", ">", "arg_9", "and", "arg_6", "<", "arg_3", ":", "arg_10", "=", "arg_0", ".", "get_allelic_expression", "(", ")", ".", "sum", "(", "axis", "=", "0", ")", "arg_10", "*=", "(", "1000000.0", "/", "arg_10", ".", "sum", "(", ")", ")", "arg_0", ".", "update_allelic_expression", "(", "arg_1", "=", "arg_1", ")", "arg_11", "=", "arg_0", ".", "get_allelic_expression", "(", ")", ".", "sum", "(", "axis", "=", "0", ")", "arg_11", "*=", "(", "1000000.0", "/", "arg_11", ".", "sum", "(", ")", ")", "arg_12", "=", "np", ".", "abs", "(", "arg_11", "-", "arg_10", ")", "arg_7", "=", "arg_12", ".", "sum", "(", ")", "arg_6", "+=", "1", "if", "arg_4", ":", "arg_13", "=", "time", ".", "time", "(", ")", "arg_14", ",", "arg_15", "=", "divmod", "(", "int", "(", "arg_13", "-", "arg_8", ")", ",", "60", ")", "arg_16", ",", "arg_17", "=", "divmod", "(", "arg_14", ",", "60", ")", "print", "\" %5d      %4d:%02d:%02d     %9.1f / 1000000\"", "%", "(", "arg_6", ",", "arg_16", ",", "arg_17", ",", "arg_15", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.001, arg_3=999, arg_4=True):\n        \"\"\"\n        Runs EM iterations\n\n        :param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)\n        :param tol: Tolerance for termination\n        :param max_iters: Maximum number of iterations until termination\n        :param verbose: Display information on how EM is Funcning\n        :return: Nothing (as it performs in-place operations)\n        \"\"\"\n        arg_5 = np.seterr(all='raise')\n        np.seterr(under='ignore')\n        if arg_4:\n            print\n            print \"Iter No  Time (hh:mm:ss)    Total change (TPM)  \"\n            print \"-------  ---------------  ----------------------\"\n        arg_6 = 0\n        arg_7 = 1000000.0\n        arg_8 = time.time()\n        arg_9 = 1000000.0 * arg_2\n        while arg_7 > arg_9 and arg_6 < arg_3:\n            arg_10 = arg_0.get_allelic_expression().sum(axis=0)\n            arg_10 *= (1000000.0 / arg_10.sum())\n            arg_0.update_allelic_expression(arg_1=arg_1)\n            arg_11 = arg_0.get_allelic_expression().sum(axis=0)\n            arg_11 *= (1000000.0 / arg_11.sum())\n            arg_12 = np.abs(arg_11 - arg_10)\n            arg_7 = arg_12.sum()\n            arg_6 += 1\n            if arg_4:\n                arg_13 = time.time()\n                arg_14, arg_15 = divmod(int(arg_13 - arg_8), 60)\n                arg_16, arg_17 = divmod(arg_14, 60)\n                print \" %5d      %4d:%02d:%02d     %9.1f / 1000000\" % (arg_6, arg_16, arg_17, arg_15, arg_7)", "path": "emase/EMfactory.py", "identifier": "EMfactory.run", "docstring": "Runs EM iterations\n\n        :param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)\n        :param tol: Tolerance for termination\n        :param max_iters: Maximum number of iterations until termination\n        :param verbose: Display information on how EM is running\n        :return: Nothing (as it performs in-place operations)", "docstring_tokens": ["Runs", "EM", "iterations"], "nwo": "churchill-lab/emase", "score": 0.1956350121830092, "idx": 256425}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L142-L228", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Add a new phenotype term to a case", "language": "python", "parameters": "(self, institute, case, user, link, hpo_term=None,\n                      omim_term=None, is_group=False)", "return_statement": "return updated_case", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ")", ":", "arg_8", "=", "[", "]", "try", ":", "if", "arg_5", ":", "arg_8", "=", "[", "arg_5", "]", "elif", "arg_6", ":", "LOG", ".", "debug", "(", "\"Fetching info for mim term {0}\"", ".", "format", "(", "arg_6", ")", ")", "arg_9", "=", "arg_0", ".", "disease_term", "(", "arg_6", ")", "if", "arg_9", ":", "for", "arg_5", "in", "arg_9", ".", "get", "(", "'hpo_terms'", ",", "[", "]", ")", ":", "arg_8", ".", "append", "(", "arg_5", ")", "else", ":", "raise", "ValueError", "(", "'Must supply either hpo or omim term'", ")", "except", "ValueError", "as", "e", ":", "raise", "e", "arg_10", "=", "set", "(", "term", "[", "'phenotype_id'", "]", "for", "term", "in", "arg_2", ".", "get", "(", "'phenotype_terms'", ",", "[", "]", ")", ")", "arg_11", "=", "arg_2", "arg_12", "=", "[", "]", "for", "arg_5", "in", "arg_8", ":", "LOG", ".", "debug", "(", "\"Fetching info for hpo term {0}\"", ".", "format", "(", "arg_5", ")", ")", "arg_13", "=", "arg_0", ".", "hpo_term", "(", "arg_5", ")", "if", "arg_13", "is", "None", ":", "raise", "ValueError", "(", "\"Hpo term: %s does not exist in database\"", "%", "arg_5", ")", "arg_14", "=", "arg_13", "[", "'_id'", "]", "arg_15", "=", "arg_13", "[", "'description'", "]", "if", "arg_14", "not", "in", "arg_10", ":", "arg_16", "=", "dict", "(", "arg_14", "=", "arg_14", ",", "feature", "=", "arg_15", ")", "arg_12", ".", "append", "(", "arg_16", ")", "LOG", ".", "info", "(", "\"Creating event for adding phenotype term for case\"", "\" {0}\"", ".", "format", "(", "arg_2", "[", "'display_name'", "]", ")", ")", "arg_0", ".", "create_event", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "category", "=", "'case'", ",", "verb", "=", "'Func'", ",", "subject", "=", "arg_2", "[", "'display_name'", "]", ",", "content", "=", "arg_14", ")", "if", "arg_7", ":", "arg_11", "=", "arg_0", ".", "case_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_2", "[", "'_id'", "]", "}", ",", "{", "'$addToSet'", ":", "{", "'phenotype_terms'", ":", "{", "'$each'", ":", "arg_12", "}", ",", "'phenotype_groups'", ":", "{", "'$each'", ":", "arg_12", "}", ",", "}", ",", "}", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "else", ":", "arg_11", "=", "arg_0", ".", "case_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_2", "[", "'_id'", "]", "}", ",", "{", "'$addToSet'", ":", "{", "'phenotype_terms'", ":", "{", "'$each'", ":", "arg_12", "}", ",", "}", ",", "}", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "LOG", ".", "debug", "(", "\"Case updated\"", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None,\n                      arg_6=None, arg_7=False):\n        \"\"\"Add a new phenotype term to a case\n\n            Create a phenotype term and event with the given information\n\n            Args:\n                institute (Institute): A Institute object\n                case (Case): Case object\n                user (User): A User object\n                link (str): The url to be used in the event\n                hpo_term (str): A hpo id\n                omim_term (str): A omim id\n                is_group (bool): is phenotype term a group?\n\n        \"\"\"\n        arg_8 = []\n        try:\n            if arg_5:\n                arg_8 = [arg_5]\n            elif arg_6:\n                LOG.debug(\"Fetching info for mim term {0}\".format(arg_6))\n                arg_9 = arg_0.disease_term(arg_6)\n                if arg_9:\n                    for arg_5 in arg_9.get('hpo_terms', []):\n                        arg_8.append(arg_5)\n            else:\n                raise ValueError('Must supply either hpo or omim term')\n        except ValueError as e:\n            ## TODO Should ve raise a more proper exception here?\n            raise e\n\n        arg_10 = set(term['phenotype_id'] for term in\n                             arg_2.get('phenotype_terms', []))\n\n        arg_11 = arg_2\n        arg_12 = []\n        for arg_5 in arg_8:\n            LOG.debug(\"Fetching info for hpo term {0}\".format(arg_5))\n            arg_13 = arg_0.hpo_term(arg_5)\n            if arg_13 is None:\n                raise ValueError(\"Hpo term: %s does not exist in database\" % arg_5)\n\n            arg_14 = arg_13['_id']\n            arg_15 = arg_13['description']\n            if arg_14 not in arg_10:\n                arg_16 = dict(arg_14=arg_14, feature=arg_15)\n                arg_12.append(arg_16)\n\n                LOG.info(\"Creating event for adding phenotype term for case\"\n                            \" {0}\".format(arg_2['display_name']))\n\n                arg_0.create_event(\n                    arg_1=arg_1,\n                    arg_2=arg_2,\n                    arg_3=arg_3,\n                    arg_4=arg_4,\n                    category='case',\n                    verb='Func',\n                    subject=arg_2['display_name'],\n                    content=arg_14\n                )\n\n            if arg_7:\n                arg_11 = arg_0.case_collection.find_one_and_update(\n                    {'_id': arg_2['_id']},\n                    {\n                        '$addToSet': {\n                            'phenotype_terms': {'$each': arg_12},\n                            'phenotype_groups': {'$each': arg_12},\n                        },\n                    },\n                    return_document=pymongo.ReturnDocument.AFTER\n                )\n            else:\n                arg_11 = arg_0.case_collection.find_one_and_update(\n                    {'_id': arg_2['_id']},\n                    {\n                        '$addToSet': {\n                            'phenotype_terms': {'$each': arg_12},\n                        },\n                    },\n                    return_document=pymongo.ReturnDocument.AFTER\n                )\n\n        LOG.debug(\"Case updated\")\n        return arg_11", "path": "scout/adapter/mongo/event.py", "identifier": "EventHandler.add_phenotype", "docstring": "Add a new phenotype term to a case\n\n            Create a phenotype term and event with the given information\n\n            Args:\n                institute (Institute): A Institute object\n                case (Case): Case object\n                user (User): A User object\n                link (str): The url to be used in the event\n                hpo_term (str): A hpo id\n                omim_term (str): A omim id\n                is_group (bool): is phenotype term a group?", "docstring_tokens": ["Add", "a", "new", "phenotype", "term", "to", "a", "case"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256426}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/synthesis/two_qubit_kak.py#L100-L128", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the gate u1, u2, or u3 implementing U with the fewest pulses.", "language": "python", "parameters": "(theta, phi, lam)", "return_statement": "return gate", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "U3Gate", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "if", "abs", "(", "arg_3", ".", "params", "[", "0", "]", "%", "(", "2.0", "*", "math", ".", "pi", ")", ")", "<", "_CUTOFF_PRECISION", ":", "arg_3", "=", "U1Gate", "(", "arg_3", ".", "params", "[", "0", "]", "+", "arg_3", ".", "params", "[", "1", "]", "+", "arg_3", ".", "params", "[", "2", "]", ")", "if", "isinstance", "(", "arg_3", ",", "U3Gate", ")", ":", "if", "abs", "(", "(", "arg_3", ".", "params", "[", "0", "]", "-", "math", ".", "pi", "/", "2", ")", "%", "(", "2.0", "*", "math", ".", "pi", ")", ")", "<", "_CUTOFF_PRECISION", ":", "arg_3", "=", "U2Gate", "(", "arg_3", ".", "params", "[", "1", "]", ",", "arg_3", ".", "params", "[", "2", "]", "+", "(", "arg_3", ".", "params", "[", "0", "]", "-", "math", ".", "pi", "/", "2", ")", ")", "if", "abs", "(", "(", "arg_3", ".", "params", "[", "0", "]", "+", "math", ".", "pi", "/", "2", ")", "%", "(", "2.0", "*", "math", ".", "pi", ")", ")", "<", "_CUTOFF_PRECISION", ":", "arg_3", "=", "U2Gate", "(", "arg_3", ".", "params", "[", "1", "]", "+", "math", ".", "pi", ",", "arg_3", ".", "params", "[", "2", "]", "-", "math", ".", "pi", "+", "(", "arg_3", ".", "params", "[", "0", "]", "+", "math", ".", "pi", "/", "2", ")", ")", "if", "isinstance", "(", "arg_3", ",", "U1Gate", ")", "and", "abs", "(", "arg_3", ".", "params", "[", "0", "]", "%", "(", "4.0", "*", "math", ".", "pi", ")", ")", "<", "_CUTOFF_PRECISION", ":", "arg_3", "=", "IdGate", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Return the gate u1, u2, or u3 implementing U with the fewest pulses.\n\n    The returned gate implements U exactly, not up to a global phase.\n\n    Args:\n        theta, phi, lam: input Euler rotation angles for a general U gate\n\n    Returns:\n        Gate: one of IdGate, U1Gate, U2Gate, U3Gate.\n    \"\"\"\n    arg_3 = U3Gate(arg_0, arg_1, arg_2)\n    # Y rotation is 0 mod 2*pi, so the gate is a u1\n    if abs(arg_3.params[0] % (2.0 * math.pi)) < _CUTOFF_PRECISION:\n        arg_3 = U1Gate(arg_3.params[0] + arg_3.params[1] + arg_3.params[2])\n    # Y rotation is pi/2 or -pi/2 mod 2*pi, so the gate is a u2\n    if isinstance(arg_3, U3Gate):\n        # theta = pi/2 + 2*k*pi\n        if abs((arg_3.params[0] - math.pi / 2) % (2.0 * math.pi)) < _CUTOFF_PRECISION:\n            arg_3 = U2Gate(arg_3.params[1],\n                          arg_3.params[2] + (arg_3.params[0] - math.pi / 2))\n        # theta = -pi/2 + 2*k*pi\n        if abs((arg_3.params[0] + math.pi / 2) % (2.0 * math.pi)) < _CUTOFF_PRECISION:\n            arg_3 = U2Gate(arg_3.params[1] + math.pi,\n                          arg_3.params[2] - math.pi + (arg_3.params[0] + math.pi / 2))\n    # u1 and lambda is 0 mod 4*pi so gate is nop\n    if isinstance(arg_3, U1Gate) and abs(arg_3.params[0] % (4.0 * math.pi)) < _CUTOFF_PRECISION:\n        arg_3 = IdGate()\n    return arg_3", "path": "qiskit/quantum_info/synthesis/two_qubit_kak.py", "identifier": "simplify_U", "docstring": "Return the gate u1, u2, or u3 implementing U with the fewest pulses.\n\n    The returned gate implements U exactly, not up to a global phase.\n\n    Args:\n        theta, phi, lam: input Euler rotation angles for a general U gate\n\n    Returns:\n        Gate: one of IdGate, U1Gate, U2Gate, U3Gate.", "docstring_tokens": ["Return", "the", "gate", "u1", "u2", "or", "u3", "implementing", "U", "with", "the", "fewest", "pulses", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256427}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/paved.py#L28-L39", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "Clean up extra files littering the source tree.", "language": "python", "parameters": "(options, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "(", "\"Cleaning patterns %s\"", ",", "arg_0", ".", "paved", ".", "Func", ".", "patterns", ")", "for", "arg_2", "in", "arg_0", ".", "paved", ".", "Func", ".", "dirs", ":", "arg_1", "(", "\"Cleaning in %s\"", ",", "arg_2", ")", "for", "arg_3", "in", "arg_0", ".", "paved", ".", "Func", ".", "patterns", ":", "for", "arg_4", "in", "arg_2", ".", "walkfiles", "(", "arg_3", ")", ":", "arg_4", ".", "remove", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Clean up extra files littering the source tree.\n\n    options.paved.Func.dirs: directories to search recursively\n    options.paved.Func.patterns: patterns to search for and remove\n    \"\"\"\n    arg_1(\"Cleaning patterns %s\", arg_0.paved.Func.patterns)\n    for arg_2 in arg_0.paved.Func.dirs:\n        arg_1(\"Cleaning in %s\", arg_2)\n        for arg_3 in arg_0.paved.Func.patterns:\n            for arg_4 in arg_2.walkfiles(arg_3):\n                arg_4.remove()", "path": "paved/paved.py", "identifier": "clean", "docstring": "Clean up extra files littering the source tree.\n\n    options.paved.clean.dirs: directories to search recursively\n    options.paved.clean.patterns: patterns to search for and remove", "docstring_tokens": ["Clean", "up", "extra", "files", "littering", "the", "source", "tree", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 256428}
{"url": "https://github.com/cartoonist/pystream-protobuf/blob/40e70b932436887b748905e5e0a82839e4c559f0/stream/stream.py#L221-L237", "sha": "40e70b932436887b748905e5e0a82839e4c559f0", "docstring_summary": "Write down buffer to the file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_output", "(", ")", ":", "return", "arg_1", "=", "len", "(", "arg_0", ".", "_write_buff", ")", "if", "arg_1", "==", "0", ":", "return", "encodeVarint", "(", "arg_0", ".", "_fd", ".", "write", ",", "arg_1", ",", "True", ")", "for", "arg_2", "in", "arg_0", ".", "_write_buff", ":", "arg_3", "=", "arg_2", ".", "SerializeToString", "(", ")", "encodeVarint", "(", "arg_0", ".", "_fd", ".", "write", ",", "len", "(", "arg_3", ")", ",", "True", ")", "arg_0", ".", "_fd", ".", "write", "(", "arg_3", ")", "arg_0", ".", "_write_buff", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"Write down buffer to the file.\"\"\"\n        if not arg_0.is_output():\n            return\n\n        arg_1 = len(arg_0._write_buff)\n        if arg_1 == 0:\n            return\n\n        encodeVarint(arg_0._fd.write, arg_1, True)\n\n        for arg_2 in arg_0._write_buff:\n            arg_3 = arg_2.SerializeToString()\n            encodeVarint(arg_0._fd.write, len(arg_3), True)\n            arg_0._fd.write(arg_3)\n\n        arg_0._write_buff = []", "path": "stream/stream.py", "identifier": "Stream.flush", "docstring": "Write down buffer to the file.", "docstring_tokens": ["Write", "down", "buffer", "to", "the", "file", "."], "nwo": "cartoonist/pystream-protobuf", "score": 0.18892572326127263, "idx": 256429}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/process_worker_pool.py#L277-L326", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Start the worker processes.", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "time", ".", "time", "(", ")", "arg_0", ".", "_kill_event", "=", "threading", ".", "Event", "(", ")", "arg_0", ".", "procs", "=", "{", "}", "for", "arg_4", "in", "range", "(", "arg_0", ".", "worker_count", ")", ":", "arg_5", "=", "multiprocessing", ".", "Process", "(", "target", "=", "worker", ",", "args", "=", "(", "arg_4", ",", "arg_0", ".", "uid", ",", "arg_0", ".", "pending_task_queue", ",", "arg_0", ".", "pending_result_queue", ",", "arg_0", ".", "ready_worker_queue", ",", ")", ")", "arg_5", ".", "start", "(", ")", "arg_0", ".", "procs", "[", "arg_4", "]", "=", "arg_5", "logger", ".", "debug", "(", "\"Manager synced with workers\"", ")", "arg_0", ".", "_task_puller_thread", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "pull_tasks", ",", "args", "=", "(", "arg_0", ".", "_kill_event", ",", ")", ")", "arg_0", ".", "_result_pusher_thread", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "push_results", ",", "args", "=", "(", "arg_0", ".", "_kill_event", ",", ")", ")", "arg_0", ".", "_task_puller_thread", ".", "start", "(", ")", "arg_0", ".", "_result_pusher_thread", ".", "start", "(", ")", "logger", ".", "info", "(", "\"Loop start\"", ")", "arg_0", ".", "_kill_event", ".", "wait", "(", ")", "logger", ".", "critical", "(", "\"[MAIN] Received kill event, terminating worker processes\"", ")", "arg_0", ".", "_task_puller_thread", ".", "join", "(", ")", "arg_0", ".", "_result_pusher_thread", ".", "join", "(", ")", "for", "arg_8", "in", "arg_0", ".", "procs", ":", "arg_0", ".", "procs", "[", "arg_8", "]", ".", "terminate", "(", ")", "logger", ".", "critical", "(", "\"Terminating worker {}:{}\"", ".", "format", "(", "arg_0", ".", "procs", "[", "arg_8", "]", ",", "arg_0", ".", "procs", "[", "arg_8", "]", ".", "is_alive", "(", ")", ")", ")", "arg_0", ".", "procs", "[", "arg_8", "]", ".", "join", "(", ")", "logger", ".", "debug", "(", "\"Worker:{} joined successfully\"", ".", "format", "(", "arg_0", ".", "procs", "[", "arg_8", "]", ")", ")", "arg_0", ".", "task_incoming", ".", "close", "(", ")", "arg_0", ".", "result_outgoing", ".", "close", "(", ")", "arg_0", ".", "context", ".", "term", "(", ")", "arg_9", "=", "time", ".", "time", "(", ")", "-", "Func", "logger", ".", "info", "(", "\"process_worker_pool ran for {} seconds\"", ".", "format", "(", "arg_9", ")", ")", "return"], "function": "def Func(arg_0):\n        \"\"\" Start the worker processes.\n\n        TODO: Move task receiving to a thread\n        \"\"\"\n        Func = time.time()\n        arg_0._kill_event = threading.Event()\n\n        arg_0.procs = {}\n        for arg_4 in range(arg_0.worker_count):\n            arg_5 = multiprocessing.Process(target=worker, args=(arg_4,\n                                                             arg_0.uid,\n                                                             arg_0.pending_task_queue,\n                                                             arg_0.pending_result_queue,\n                                                             arg_0.ready_worker_queue,\n                                                         ))\n            arg_5.start()\n            arg_0.procs[arg_4] = arg_5\n\n        logger.debug(\"Manager synced with workers\")\n\n        arg_0._task_puller_thread = threading.Thread(target=arg_0.pull_tasks,\n                                                    args=(arg_0._kill_event,))\n        arg_0._result_pusher_thread = threading.Thread(target=arg_0.push_results,\n                                                      args=(arg_0._kill_event,))\n        arg_0._task_puller_thread.start()\n        arg_0._result_pusher_thread.start()\n\n        logger.info(\"Loop start\")\n\n        # TODO : Add mechanism in this loop to stop the worker pool\n        # This might need a multiprocessing event to signal back.\n        arg_0._kill_event.wait()\n        logger.critical(\"[MAIN] Received kill event, terminating worker processes\")\n\n        arg_0._task_puller_thread.join()\n        arg_0._result_pusher_thread.join()\n        for arg_8 in arg_0.procs:\n            arg_0.procs[arg_8].terminate()\n            logger.critical(\"Terminating worker {}:{}\".format(arg_0.procs[arg_8],\n                                                              arg_0.procs[arg_8].is_alive()))\n            arg_0.procs[arg_8].join()\n            logger.debug(\"Worker:{} joined successfully\".format(arg_0.procs[arg_8]))\n\n        arg_0.task_incoming.close()\n        arg_0.result_outgoing.close()\n        arg_0.context.term()\n        arg_9 = time.time() - Func\n        logger.info(\"process_worker_pool ran for {} seconds\".format(arg_9))\n        return", "path": "parsl/executors/high_throughput/process_worker_pool.py", "identifier": "Manager.start", "docstring": "Start the worker processes.\n\n        TODO: Move task receiving to a thread", "docstring_tokens": ["Start", "the", "worker", "processes", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 256430}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/dns_discover.py#L15-L31", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Returns the configured DNS servers with the use f nmcli.", "language": "python", "parameters": "()", "return_statement": "return ips", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "]", "try", ":", "arg_1", "=", "subprocess", ".", "check_output", "(", "[", "'nmcli'", ",", "'device'", ",", "'show'", "]", ")", "arg_1", "=", "arg_1", ".", "decode", "(", "'utf-8'", ")", "for", "arg_2", "in", "arg_1", ".", "split", "(", "'\\n'", ")", ":", "if", "'DNS'", "in", "arg_2", ":", "arg_3", "=", "r\"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\"", "for", "arg_4", "in", "re", ".", "findall", "(", "arg_3", ",", "arg_2", ")", ":", "arg_0", ".", "append", "(", "arg_4", ")", "except", "FileNotFoundError", ":", "pass", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n        Returns the configured DNS servers with the use f nmcli.\n    \"\"\"\n    arg_0 = []\n    try:\n        arg_1 = subprocess.check_output(['nmcli', 'device', 'show'])\n        arg_1 = arg_1.decode('utf-8')\n\n        for arg_2 in arg_1.split('\\n'):\n            if 'DNS' in arg_2:\n                arg_3 = r\"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\"\n                for arg_4 in re.findall(arg_3, arg_2):\n                    arg_0.append(arg_4)\n    except FileNotFoundError:\n        pass\n    return arg_0", "path": "jackal/scripts/dns_discover.py", "identifier": "get_configured_dns", "docstring": "Returns the configured DNS servers with the use f nmcli.", "docstring_tokens": ["Returns", "the", "configured", "DNS", "servers", "with", "the", "use", "f", "nmcli", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 256431}
{"url": "https://github.com/Scifabric/pybossa-client/blob/998d7cb0207ff5030dc800f0c2577c5692316c2c/pbclient/__init__.py#L236-L257", "sha": "998d7cb0207ff5030dc800f0c2577c5692316c2c", "docstring_summary": "Create a project.", "language": "python", "parameters": "(name, short_name, description)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "dict", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "_pybossa_req", "(", "'post'", ",", "'project'", ",", "payload", "=", "arg_3", ")", "if", "arg_4", ".", "get", "(", "'id'", ")", ":", "return", "Project", "(", "arg_4", ")", "else", ":", "return", "arg_4", "except", ":", "raise"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Create a project.\n\n    :param name: PYBOSSA Project Name\n    :type name: string\n    :param short_name: PYBOSSA Project short name or slug\n    :type short_name: string\n    :param description: PYBOSSA Project description\n    :type decription: string\n    :returns: True -- the response status code\n\n    \"\"\"\n    try:\n        arg_3 = dict(arg_0=arg_0, arg_1=arg_1,\n                       arg_2=arg_2)\n        arg_4 = _pybossa_req('post', 'project', payload=arg_3)\n        if arg_4.get('id'):\n            return Project(arg_4)\n        else:\n            return arg_4\n    except:  # pragma: no cover\n        raise", "path": "pbclient/__init__.py", "identifier": "create_project", "docstring": "Create a project.\n\n    :param name: PYBOSSA Project Name\n    :type name: string\n    :param short_name: PYBOSSA Project short name or slug\n    :type short_name: string\n    :param description: PYBOSSA Project description\n    :type decription: string\n    :returns: True -- the response status code", "docstring_tokens": ["Create", "a", "project", "."], "nwo": "Scifabric/pybossa-client", "score": 0.27831918678159157, "idx": 256432}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1909-L1924", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Generate a Python AST node for Python interop property access.", "language": "python", "parameters": "(\n    ctx: GeneratorContext, node: HostField, is_assigning: bool = False\n)", "return_statement": "return GeneratedPyAST(\n        node=ast.Attribute(\n            value=target_ast.node,\n            attr=munge(node.field),\n            ctx=ast.Store() if is_assigning else ast.Load(),\n        ),\n        dependencies=target_ast.dependencies,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "=", "False", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "HOST_FIELD", "arg_6", "=", "gen_py_ast", "(", "arg_0", ",", "arg_2", ".", "target", ")", "return", "GeneratedPyAST", "(", "arg_2", "=", "ast", ".", "Attribute", "(", "value", "=", "arg_6", ".", "node", ",", "attr", "=", "munge", "(", "arg_2", ".", "field", ")", ",", "arg_0", "=", "ast", ".", "Store", "(", ")", "if", "arg_4", "else", "ast", ".", "Load", "(", ")", ",", ")", ",", "dependencies", "=", "arg_6", ".", "dependencies", ",", ")"], "function": "def Func(\n    arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = False\n) -> GeneratedPyAST:\n    \"\"\"Generate a Python AST node for Python interop property access.\"\"\"\n    assert arg_2.op == NodeOp.HOST_FIELD\n\n    arg_6 = gen_py_ast(arg_0, arg_2.target)\n\n    return GeneratedPyAST(\n        arg_2=ast.Attribute(\n            value=arg_6.node,\n            attr=munge(arg_2.field),\n            arg_0=ast.Store() if arg_4 else ast.Load(),\n        ),\n        dependencies=arg_6.dependencies,\n    )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_interop_prop_to_py_ast", "docstring": "Generate a Python AST node for Python interop property access.", "docstring_tokens": ["Generate", "a", "Python", "AST", "node", "for", "Python", "interop", "property", "access", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 256433}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L98-L112", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "The CPython version of ``fromutc`` checks that the input is a ``datetime``\n    object and that ``self`` is attached as its ``tzinfo``.", "language": "python", "parameters": "(f)", "return_statement": "return fromutc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "fromutc", "(", "arg_1", ",", "arg_2", ")", ":", "if", "not", "isinstance", "(", "arg_2", ",", "datetime", ")", ":", "raise", "TypeError", "(", "\"fromutc() requires a datetime argument\"", ")", "if", "arg_2", ".", "tzinfo", "is", "not", "arg_1", ":", "raise", "ValueError", "(", "\"dt.tzinfo is not self\"", ")", "return", "arg_0", "(", "arg_1", ",", "arg_2", ")", "return", "fromutc"], "function": "def Func(arg_0):\n    \"\"\"\n    The CPython version of ``fromutc`` checks that the input is a ``datetime``\n    object and that ``self`` is attached as its ``tzinfo``.\n    \"\"\"\n    @wraps(arg_0)\n    def fromutc(arg_1, arg_2):\n        if not isinstance(arg_2, datetime):\n            raise TypeError(\"fromutc() requires a datetime argument\")\n        if arg_2.tzinfo is not arg_1:\n            raise ValueError(\"dt.tzinfo is not self\")\n\n        return arg_0(arg_1, arg_2)\n\n    return fromutc", "path": "superjson/pkg/dateutil/tz/_common.py", "identifier": "_validate_fromutc_inputs", "docstring": "The CPython version of ``fromutc`` checks that the input is a ``datetime``\n    object and that ``self`` is attached as its ``tzinfo``.", "docstring_tokens": ["The", "CPython", "version", "of", "fromutc", "checks", "that", "the", "input", "is", "a", "datetime", "object", "and", "that", "self", "is", "attached", "as", "its", "tzinfo", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 256434}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/encoding.py#L37-L54", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return IPython's guess for the default encoding for bytes as text.", "language": "python", "parameters": "()", "return_statement": "return enc or sys.getdefaultencoding()", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "get_stream_enc", "(", "sys", ".", "stdin", ")", "if", "not", "arg_0", "or", "arg_0", "==", "'ascii'", ":", "try", ":", "arg_0", "=", "locale", ".", "getpreferredencoding", "(", ")", "except", "Exception", ":", "pass", "return", "arg_0", "or", "sys", ".", "Func", "(", ")"], "function": "def Func():\n    \"\"\"Return IPython's guess for the default encoding for bytes as text.\n\n    Asks for stdin.encoding first, to match the calling Terminal, but that\n    is often None for subprocesses.  Fall back on locale.getpreferredencoding()\n    which should be a sensible platform default (that respects LANG environment),\n    and finally to sys.Func() which is the most conservative option,\n    and usually ASCII.\n    \"\"\"\n    arg_0 = get_stream_enc(sys.stdin)\n    if not arg_0 or arg_0=='ascii':\n        try:\n            # There are reports of getpreferredencoding raising errors\n            # in some cases, which may well be fixed, but let's be conservative here.\n            arg_0 = locale.getpreferredencoding()\n        except Exception:\n            pass\n    return arg_0 or sys.Func()", "path": "environment/lib/python2.7/site-packages/IPython/utils/encoding.py", "identifier": "getdefaultencoding", "docstring": "Return IPython's guess for the default encoding for bytes as text.\n\n    Asks for stdin.encoding first, to match the calling Terminal, but that\n    is often None for subprocesses.  Fall back on locale.getpreferredencoding()\n    which should be a sensible platform default (that respects LANG environment),\n    and finally to sys.getdefaultencoding() which is the most conservative option,\n    and usually ASCII.", "docstring_tokens": ["Return", "IPython", "s", "guess", "for", "the", "default", "encoding", "for", "bytes", "as", "text", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256435}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/update.py#L103-L139", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Build extra args map", "language": "python", "parameters": "(cl_args)", "return_statement": "return dict_extra_args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "[", "'component_parallelism'", "]", "arg_2", "=", "arg_0", "[", "'runtime_config'", "]", "arg_3", "=", "arg_0", "[", "'container_number'", "]", "if", "(", "arg_1", "and", "arg_2", ")", "or", "(", "arg_3", "and", "arg_2", ")", ":", "raise", "Exception", "(", "\"(component-parallelism or container_num) and runtime-config \"", "+", "\"can't be updated at the same time\"", ")", "arg_4", "=", "{", "}", "arg_5", "=", "True", "if", "arg_1", ":", "arg_4", ".", "update", "(", "{", "'component_parallelism'", ":", "arg_1", "}", ")", "arg_5", "=", "False", "if", "arg_3", ":", "arg_4", ".", "update", "(", "{", "'container_number'", ":", "arg_3", "}", ")", "arg_5", "=", "False", "if", "arg_2", ":", "arg_4", ".", "update", "(", "{", "'runtime_config'", ":", "arg_2", "}", ")", "arg_5", "=", "False", "if", "arg_5", ":", "raise", "Exception", "(", "\"Missing arguments --component-parallelism or --runtime-config or --container-number\"", ")", "if", "arg_0", "[", "'dry_run'", "]", ":", "arg_4", ".", "update", "(", "{", "'dry_run'", ":", "True", "}", ")", "if", "'dry_run_format'", "in", "arg_0", ":", "arg_4", ".", "update", "(", "{", "'dry_run_format'", ":", "arg_0", "[", "\"dry_run_format\"", "]", "}", ")", "return", "arg_4"], "function": "def Func(arg_0):\n  \"\"\" Build extra args map \"\"\"\n  # Check parameters\n  arg_1 = arg_0['component_parallelism']\n  arg_2 = arg_0['runtime_config']\n  arg_3 = arg_0['container_number']\n  # Users need to provide either (component-parallelism || container_number) or runtime-config\n  if (arg_1 and arg_2) or (arg_3 and arg_2):\n    raise Exception(\n        \"(component-parallelism or container_num) and runtime-config \" +\n        \"can't be updated at the same time\")\n\n  arg_4 = {}\n\n  arg_5 = True\n  if arg_1:\n    arg_4.update({'component_parallelism': arg_1})\n    arg_5 = False\n\n  if arg_3:\n    arg_4.update({'container_number': arg_3})\n    arg_5 = False\n\n  if arg_2:\n    arg_4.update({'runtime_config': arg_2})\n    arg_5 = False\n\n  if arg_5:\n    raise Exception(\n        \"Missing arguments --component-parallelism or --runtime-config or --container-number\")\n\n  if arg_0['dry_run']:\n    arg_4.update({'dry_run': True})\n    if 'dry_run_format' in arg_0:\n      arg_4.update({'dry_run_format': arg_0[\"dry_run_format\"]})\n\n  return arg_4", "path": "heron/tools/cli/src/python/update.py", "identifier": "build_extra_args_dict", "docstring": "Build extra args map", "docstring_tokens": ["Build", "extra", "args", "map"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256436}
{"url": "https://github.com/versae/ipython-cypher/blob/1e88bd8227743e70b78af42e0e713ae8803485e1/src/cypher/run.py#L424-L447", "sha": "1e88bd8227743e70b78af42e0e713ae8803485e1", "docstring_summary": "Generates results in comma-separated form.  Write to ``filename``\n        if given. Any other parameter will be passed on to ``csv.writer``.", "language": "python", "parameters": "(self, filename=None, **format_params)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "if", "not", "arg_0", ".", "pretty", ":", "return", "None", "if", "arg_1", ":", "arg_3", "=", "open", "(", "arg_1", ",", "'w'", ")", "else", ":", "arg_3", "=", "StringIO", "(", ")", "arg_4", "=", "UnicodeWriter", "(", "arg_3", ",", "**", "arg_2", ")", "arg_4", ".", "writerow", "(", "arg_0", ".", "field_names", ")", "for", "arg_5", "in", "arg_0", ":", "arg_4", ".", "writerow", "(", "arg_5", ")", "if", "arg_1", ":", "arg_3", ".", "close", "(", ")", "return", "CsvResultDescriptor", "(", "arg_1", ")", "else", ":", "return", "arg_3", ".", "getvalue", "(", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"Generates results in comma-separated form.  Write to ``filename``\n        if given. Any other parameter will be passed on to ``Func.writer``.\n\n        :param filename: if given, the CSV will be written to filename.\n\n        Any additional keyword arguments will be passsed\n        through to ``Func.writer``.\n        \"\"\"\n        if not arg_0.pretty:\n            return None  # no results\n        if arg_1:\n            arg_3 = open(arg_1, 'w')\n        else:\n            arg_3 = StringIO()\n        arg_4 = UnicodeWriter(arg_3, **arg_2)\n        arg_4.writerow(arg_0.field_names)\n        for arg_5 in arg_0:\n            arg_4.writerow(arg_5)\n        if arg_1:\n            arg_3.close()\n            return CsvResultDescriptor(arg_1)\n        else:\n            return arg_3.getvalue()", "path": "src/cypher/run.py", "identifier": "ResultSet.csv", "docstring": "Generates results in comma-separated form.  Write to ``filename``\n        if given. Any other parameter will be passed on to ``csv.writer``.\n\n        :param filename: if given, the CSV will be written to filename.\n\n        Any additional keyword arguments will be passsed\n        through to ``csv.writer``.", "docstring_tokens": ["Generates", "results", "in", "comma", "-", "separated", "form", ".", "Write", "to", "filename", "if", "given", ".", "Any", "other", "parameter", "will", "be", "passed", "on", "to", "csv", ".", "writer", "."], "nwo": "versae/ipython-cypher", "score": 0.19653268135590604, "idx": 256437}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L31-L72", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Create a Event with the parameters given.", "language": "python", "parameters": "(self, institute, case, user, link, category, verb,\n                     subject, level='specific', variant=None, content=None,\n                     panel=None)", "return_statement": "return event", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "'specific'", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ")", ":", "arg_9", "=", "arg_9", "or", "{", "}", "arg_12", "=", "dict", "(", "arg_1", "=", "arg_1", "[", "'_id'", "]", ",", "arg_2", "=", "arg_2", "[", "'_id'", "]", ",", "user_id", "=", "arg_3", "[", "'_id'", "]", ",", "user_name", "=", "arg_3", "[", "'name'", "]", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "variant_id", "=", "arg_9", ".", "get", "(", "'variant_id'", ")", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "created_at", "=", "datetime", ".", "now", "(", ")", ",", "updated_at", "=", "datetime", ".", "now", "(", ")", ",", ")", "LOG", ".", "debug", "(", "\"Saving Event\"", ")", "arg_0", ".", "event_collection", ".", "insert_one", "(", "arg_12", ")", "LOG", ".", "debug", "(", "\"Event Saved\"", ")", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6,\n                     arg_7, arg_8='specific', arg_9=None, arg_10=None,\n                     arg_11=None):\n        \"\"\"Create a Event with the parameters given.\n\n        Arguments:\n            institute (dict): A institute\n            case (dict): A case\n            user (dict): A User\n            link (str): The url to be used in the event\n            category (str): case or variant\n            verb (str): What type of event\n            subject (str): What is operated on\n            level (str): 'specific' or 'global'. Default is 'specific'\n            variant (dict): A variant\n            content (str): The content of the comment\n\n        Returns:\n            event(dict): The inserted event\n        \"\"\"\n        arg_9 = arg_9 or {}\n        arg_12 = dict(\n            arg_1=arg_1['_id'],\n            arg_2=arg_2['_id'],\n            user_id=arg_3['_id'],\n            user_name=arg_3['name'],\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_6=arg_6,\n            arg_7=arg_7,\n            arg_8=arg_8,\n            variant_id=arg_9.get('variant_id'),\n            arg_10=arg_10,\n            arg_11=arg_11,\n            created_at=datetime.now(),\n            updated_at=datetime.now(),\n        )\n\n        LOG.debug(\"Saving Event\")\n        arg_0.event_collection.insert_one(arg_12)\n        LOG.debug(\"Event Saved\")\n        return arg_12", "path": "scout/adapter/mongo/event.py", "identifier": "EventHandler.create_event", "docstring": "Create a Event with the parameters given.\n\n        Arguments:\n            institute (dict): A institute\n            case (dict): A case\n            user (dict): A User\n            link (str): The url to be used in the event\n            category (str): case or variant\n            verb (str): What type of event\n            subject (str): What is operated on\n            level (str): 'specific' or 'global'. Default is 'specific'\n            variant (dict): A variant\n            content (str): The content of the comment\n\n        Returns:\n            event(dict): The inserted event", "docstring_tokens": ["Create", "a", "Event", "with", "the", "parameters", "given", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256438}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L69-L85", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Fetches PyMongo Client", "language": "python", "parameters": "(self)", "return_statement": "return self.client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "client", "is", "not", "None", ":", "return", "arg_0", ".", "client", "arg_1", "=", "arg_0", ".", "extras", "if", "arg_1", ".", "get", "(", "'ssl'", ",", "False", ")", ":", "arg_1", ".", "update", "(", "{", "'ssl_cert_reqs'", ":", "CERT_NONE", "}", ")", "arg_0", ".", "client", "=", "MongoClient", "(", "arg_0", ".", "uri", ",", "**", "arg_1", ")", "return", "arg_0", ".", "client"], "function": "def Func(arg_0):\n        \"\"\"\n        Fetches PyMongo Client\n        \"\"\"\n        if arg_0.client is not None:\n            return arg_0.client\n\n        # Mongo Connection Options dict that is unpacked when passed to MongoClient\n        arg_1 = arg_0.extras\n\n        # If we are using SSL disable requiring certs from specific hostname\n        if arg_1.get('ssl', False):\n            arg_1.update({'ssl_cert_reqs': CERT_NONE})\n\n        arg_0.client = MongoClient(arg_0.uri, **arg_1)\n\n        return arg_0.client", "path": "airflow/contrib/hooks/mongo_hook.py", "identifier": "MongoHook.get_conn", "docstring": "Fetches PyMongo Client", "docstring_tokens": ["Fetches", "PyMongo", "Client"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256439}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L478-L481", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Get the given param from each of the DOFs for a joint.", "language": "python", "parameters": "(target, param, dof)", "return_statement": "return [target.getParam(getattr(ode, 'Param{}{}'.format(param, s)))\n            for s in ['', '2', '3'][:dof]]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "[", "arg_0", ".", "getParam", "(", "getattr", "(", "ode", ",", "'Param{}{}'", ".", "format", "(", "arg_1", ",", "arg_3", ")", ")", ")", "for", "arg_3", "in", "[", "''", ",", "'2'", ",", "'3'", "]", "[", ":", "arg_2", "]", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''Get the given param from each of the DOFs for a joint.'''\n    return [arg_0.getParam(getattr(ode, 'Param{}{}'.format(arg_1, arg_3)))\n            for arg_3 in ['', '2', '3'][:arg_2]]", "path": "pagoda/physics.py", "identifier": "_get_params", "docstring": "Get the given param from each of the DOFs for a joint.", "docstring_tokens": ["Get", "the", "given", "param", "from", "each", "of", "the", "DOFs", "for", "a", "joint", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 256440}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/interfaces.py#L214-L234", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Method decorator generator for decorating event handlers.", "language": "python", "parameters": "(interval, recurring = None)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "def", "decorator", "(", "arg_2", ")", ":", "arg_2", ".", "_pyxmpp_timeout", "=", "arg_0", "arg_2", ".", "_pyxmpp_recurring", "=", "arg_1", "return", "arg_2", "return", "decorator"], "function": "def Func(arg_0, arg_1 = None):\n    \"\"\"Method decorator generator for decorating event handlers.\n\n    To be used on `TimeoutHandler` subclass methods only.\n\n    :Parameters:\n        - `interval`: interval (in seconds) before the method will be called.\n        - `recurring`: When `True`, the handler will be called each `interval`\n          seconds, when `False` it will be called only once. If `True`,\n          then the handler should return the next interval or `None` if it\n          should not be called again.\n    :Types:\n        - `interval`: `float`\n        - `recurring`: `bool`\n    \"\"\"\n    def decorator(arg_2):\n        \"\"\"The decorator\"\"\"\n        arg_2._pyxmpp_timeout = arg_0\n        arg_2._pyxmpp_recurring = arg_1\n        return arg_2\n    return decorator", "path": "pyxmpp2/mainloop/interfaces.py", "identifier": "timeout_handler", "docstring": "Method decorator generator for decorating event handlers.\n\n    To be used on `TimeoutHandler` subclass methods only.\n\n    :Parameters:\n        - `interval`: interval (in seconds) before the method will be called.\n        - `recurring`: When `True`, the handler will be called each `interval`\n          seconds, when `False` it will be called only once. If `True`,\n          then the handler should return the next interval or `None` if it\n          should not be called again.\n    :Types:\n        - `interval`: `float`\n        - `recurring`: `bool`", "docstring_tokens": ["Method", "decorator", "generator", "for", "decorating", "event", "handlers", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256441}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L167-L185", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Create a folder in the storage service pointed by the given path.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "__validate_storage_path", "(", "arg_1", ",", "projects_allowed", "=", "False", ")", "arg_2", "=", "arg_0", ".", "get_parent", "(", "arg_1", ")", "arg_0", ".", "api_client", ".", "create_folder", "(", "arg_1", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", ",", "arg_2", "[", "'uuid'", "]", ")"], "function": "def Func(arg_0, arg_1):\n        '''Create a folder in the storage service pointed by the given path.\n\n        Args:\n            path (str): The path of the folder to be created\n\n        Returns:\n            None\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes\n        '''\n\n        arg_0.__validate_storage_path(arg_1, projects_allowed=False)\n        arg_2 = arg_0.get_parent(arg_1)\n        arg_0.api_client.create_folder(arg_1.split('/')[-1], arg_2['uuid'])", "path": "hbp_service_client/storage_service/client.py", "identifier": "Client.mkdir", "docstring": "Create a folder in the storage service pointed by the given path.\n\n        Args:\n            path (str): The path of the folder to be created\n\n        Returns:\n            None\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes", "docstring_tokens": ["Create", "a", "folder", "in", "the", "storage", "service", "pointed", "by", "the", "given", "path", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 256442}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/model_creator.py#L161-L192", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Feed in an essay set to get feature vector and classifier\n    essays must be an essay set object\n    additional array is an optional argument that can specify\n    a numpy array of values to add in\n    returns a trained FeatureExtractor object and a trained classifier", "language": "python", "parameters": "(essays, algorithm=util_functions.AlgorithmTypes.regression)", "return_statement": "return f, clf, cv_error_results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "AlgorithmTypes", ".", "regression", ")", ":", "arg_5", "=", "feature_extractor", ".", "FeatureExtractor", "(", ")", "arg_5", ".", "initialize_dictionaries", "(", "arg_0", ")", "arg_6", "=", "arg_5", ".", "gen_feats", "(", "arg_0", ")", "arg_7", "=", "numpy", ".", "asarray", "(", "arg_0", ".", "_score", ",", "dtype", "=", "numpy", ".", "int", ")", "if", "len", "(", "arg_2", ".", "f7", "(", "list", "(", "arg_7", ")", ")", ")", ">", "5", ":", "arg_1", "=", "arg_2", ".", "AlgorithmTypes", ".", "regression", "else", ":", "arg_1", "=", "arg_2", ".", "AlgorithmTypes", ".", "classification", "arg_8", ",", "arg_9", "=", "get_algorithms", "(", "arg_1", ")", "arg_10", "=", "get_cv_error", "(", "arg_9", ",", "arg_6", ",", "arg_0", ".", "_score", ")", "try", ":", "arg_8", ".", "fit", "(", "arg_6", ",", "arg_7", ")", "except", "ValueError", ":", "log", ".", "exception", "(", "\"Not enough classes (0,1,etc) in sample.\"", ")", "arg_7", "[", "0", "]", "=", "1", "arg_7", "[", "1", "]", "=", "0", "arg_8", ".", "fit", "(", "arg_6", ",", "arg_7", ")", "return", "arg_5", ",", "arg_8", ",", "arg_10"], "function": "def Func(arg_0, arg_1=arg_2.AlgorithmTypes.regression):\n    \"\"\"\n    Feed in an essay set to get feature vector and classifier\n    essays must be an essay set object\n    additional array is an optional argument that can specify\n    a numpy array of values to add in\n    returns a trained FeatureExtractor object and a trained classifier\n    \"\"\"\n    arg_5 = feature_extractor.FeatureExtractor()\n    arg_5.initialize_dictionaries(arg_0)\n\n    arg_6 = arg_5.gen_feats(arg_0)\n\n    arg_7 = numpy.asarray(arg_0._score, dtype=numpy.int)\n    if len(arg_2.f7(list(arg_7)))>5:\n        arg_1 = arg_2.AlgorithmTypes.regression\n    else:\n        arg_1 = arg_2.AlgorithmTypes.classification\n\n    arg_8,arg_9 = get_algorithms(arg_1)\n\n    arg_10=get_cv_error(arg_9,arg_6,arg_0._score)\n\n    try:\n        arg_8.fit(arg_6, arg_7)\n    except ValueError:\n        log.exception(\"Not enough classes (0,1,etc) in sample.\")\n        arg_7[0]=1\n        arg_7[1]=0\n        arg_8.fit(arg_6, arg_7)\n\n    return arg_5, arg_8, arg_10", "path": "ease/model_creator.py", "identifier": "extract_features_and_generate_model", "docstring": "Feed in an essay set to get feature vector and classifier\n    essays must be an essay set object\n    additional array is an optional argument that can specify\n    a numpy array of values to add in\n    returns a trained FeatureExtractor object and a trained classifier", "docstring_tokens": ["Feed", "in", "an", "essay", "set", "to", "get", "feature", "vector", "and", "classifier", "essays", "must", "be", "an", "essay", "set", "object", "additional", "array", "is", "an", "optional", "argument", "that", "can", "specify", "a", "numpy", "array", "of", "values", "to", "add", "in", "returns", "a", "trained", "FeatureExtractor", "object", "and", "a", "trained", "classifier"], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 256443}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/report.py#L28-L59", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Find the code units we'll report on.", "language": "python", "parameters": "(self, morfs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", "or", "arg_0", ".", "coverage", ".", "data", ".", "measured_files", "(", ")", "arg_2", "=", "arg_0", ".", "coverage", ".", "file_locator", "arg_0", ".", "code_units", "=", "code_unit_factory", "(", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "config", ".", "include", ":", "arg_4", "=", "prep_patterns", "(", "arg_0", ".", "config", ".", "include", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_0", ".", "code_units", ":", "for", "arg_7", "in", "arg_4", ":", "if", "fnmatch", ".", "fnmatch", "(", "arg_6", ".", "filename", ",", "arg_7", ")", ":", "arg_5", ".", "append", "(", "arg_6", ")", "break", "arg_0", ".", "code_units", "=", "arg_5", "if", "arg_0", ".", "config", ".", "omit", ":", "arg_4", "=", "prep_patterns", "(", "arg_0", ".", "config", ".", "omit", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_0", ".", "code_units", ":", "for", "arg_7", "in", "arg_4", ":", "if", "fnmatch", ".", "fnmatch", "(", "arg_6", ".", "filename", ",", "arg_7", ")", ":", "break", "else", ":", "arg_5", ".", "append", "(", "arg_6", ")", "arg_0", ".", "code_units", "=", "arg_5", "arg_0", ".", "code_units", ".", "sort", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Find the code units we'll report on.\n\n        `morfs` is a list of modules or filenames.\n\n        \"\"\"\n        arg_1 = arg_1 or arg_0.coverage.data.measured_files()\n        arg_2 = arg_0.coverage.file_locator\n        arg_0.code_units = code_unit_factory(arg_1, arg_2)\n\n        if arg_0.config.include:\n            arg_4 = prep_patterns(arg_0.config.include)\n            arg_5 = []\n            for arg_6 in arg_0.code_units:\n                for arg_7 in arg_4:\n                    if fnmatch.fnmatch(arg_6.filename, arg_7):\n                        arg_5.append(arg_6)\n                        break\n            arg_0.code_units = arg_5\n\n        if arg_0.config.omit:\n            arg_4 = prep_patterns(arg_0.config.omit)\n            arg_5 = []\n            for arg_6 in arg_0.code_units:\n                for arg_7 in arg_4:\n                    if fnmatch.fnmatch(arg_6.filename, arg_7):\n                        break\n                else:\n                    arg_5.append(arg_6)\n            arg_0.code_units = arg_5\n\n        arg_0.code_units.sort()", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/report.py", "identifier": "Reporter.find_code_units", "docstring": "Find the code units we'll report on.\n\n        `morfs` is a list of modules or filenames.", "docstring_tokens": ["Find", "the", "code", "units", "we", "ll", "report", "on", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256444}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L26-L29", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the distance between two points.", "language": "python", "parameters": "(x0, y0, x1, y1)", "return_statement": "return sqrt(pow(x1-x0, 2) + pow(y1-y0, 2))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "sqrt", "(", "pow", "(", "arg_2", "-", "arg_0", ",", "2", ")", "+", "pow", "(", "arg_3", "-", "arg_1", ",", "2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\r\n    \"\"\" Returns the Func between two points.\r\n    \"\"\"\r\n    return sqrt(pow(arg_2-arg_0, 2) + pow(arg_3-arg_1, 2))", "path": "shoebot/data/geometry.py", "identifier": "distance", "docstring": "Returns the distance between two points.", "docstring_tokens": ["Returns", "the", "distance", "between", "two", "points", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256445}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deploy.py#L220-L244", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Calculates the components functions that need to be executed for a deployment.", "language": "python", "parameters": "(self, components=None)", "return_statement": "return component_order, plan_funcs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "get_current_thumbprint", "(", "arg_1", "=", "arg_1", ")", "or", "{", "}", "arg_3", "=", "arg_0", ".", "get_previous_thumbprint", "(", "arg_1", "=", "arg_1", ")", "or", "{", "}", "if", "arg_0", ".", "verbose", ":", "print", "(", "'Current thumbprint:'", ")", "pprint", "(", "arg_2", ",", "indent", "=", "4", ")", "print", "(", "'Previous thumbprint:'", ")", "pprint", "(", "arg_3", ",", "indent", "=", "4", ")", "arg_4", "=", "list", "(", "iter_dict_differences", "(", "arg_2", ",", "arg_3", ")", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "'Differences:'", ")", "pprint", "(", "arg_4", ",", "indent", "=", "4", ")", "arg_5", "=", "get_component_order", "(", "[", "k", "for", "k", ",", "(", "_", ",", "_", ")", "in", "arg_4", "]", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "'component_order:'", ")", "pprint", "(", "arg_5", ",", "indent", "=", "4", ")", "arg_6", "=", "list", "(", "get_deploy_funcs", "(", "arg_5", ",", "arg_2", ",", "arg_3", ")", ")", "return", "arg_5", ",", "arg_6"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Calculates the components functions that need to be executed for a deployment.\n        \"\"\"\n\n        arg_2 = arg_0.get_current_thumbprint(arg_1=arg_1) or {}\n        arg_3 = arg_0.get_previous_thumbprint(arg_1=arg_1) or {}\n\n        if arg_0.verbose:\n            print('Current thumbprint:')\n            pprint(arg_2, indent=4)\n            print('Previous thumbprint:')\n            pprint(arg_3, indent=4)\n\n        arg_4 = list(iter_dict_differences(arg_2, arg_3))\n        if arg_0.verbose:\n            print('Differences:')\n            pprint(arg_4, indent=4)\n        arg_5 = get_component_order([k for k, (_, _) in arg_4])\n        if arg_0.verbose:\n            print('component_order:')\n            pprint(arg_5, indent=4)\n        arg_6 = list(get_deploy_funcs(arg_5, arg_2, arg_3))\n\n        return arg_5, arg_6", "path": "burlap/deploy.py", "identifier": "DeploySatchel.get_component_funcs", "docstring": "Calculates the components functions that need to be executed for a deployment.", "docstring_tokens": ["Calculates", "the", "components", "functions", "that", "need", "to", "be", "executed", "for", "a", "deployment", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256446}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/utils.py#L279-L291", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "URL escapes a single bytestring or unicode string with the\n    given charset if applicable to URL safe quoting under all rules\n    that need to be considered under all supported Python versions.", "language": "python", "parameters": "(obj, charset='utf-8')", "return_statement": "return text_type(url_quote(obj))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf-8'", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "string_types", ")", ":", "arg_0", "=", "text_type", "(", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "text_type", ")", ":", "arg_0", "=", "arg_0", ".", "encode", "(", "arg_1", ")", "return", "text_type", "(", "url_quote", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1='utf-8'):\n    \"\"\"URL escapes a single bytestring or unicode string with the\n    given charset if applicable to URL safe quoting under all rules\n    that need to be considered under all supported Python versions.\n\n    If non strings are provided they are converted to their unicode\n    representation first.\n    \"\"\"\n    if not isinstance(arg_0, string_types):\n        arg_0 = text_type(arg_0)\n    if isinstance(arg_0, text_type):\n        arg_0 = arg_0.encode(arg_1)\n    return text_type(url_quote(arg_0))", "path": "capybara/virtualenv/lib/python2.7/site-packages/jinja2/utils.py", "identifier": "unicode_urlencode", "docstring": "URL escapes a single bytestring or unicode string with the\n    given charset if applicable to URL safe quoting under all rules\n    that need to be considered under all supported Python versions.\n\n    If non strings are provided they are converted to their unicode\n    representation first.", "docstring_tokens": ["URL", "escapes", "a", "single", "bytestring", "or", "unicode", "string", "with", "the", "given", "charset", "if", "applicable", "to", "URL", "safe", "quoting", "under", "all", "rules", "that", "need", "to", "be", "considered", "under", "all", "supported", "Python", "versions", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256447}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L588-L622", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augment endlessly images in the source queue.", "language": "python", "parameters": "(self, augseq, queue_source, queue_result, seedval)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "np", ".", "random", ".", "seed", "(", "arg_4", ")", "random", ".", "seed", "(", "arg_4", ")", "arg_1", ".", "reseed", "(", "arg_4", ")", "ia", ".", "seed", "(", "arg_4", ")", "arg_5", "=", "False", "while", "not", "arg_5", ":", "try", ":", "arg_6", "=", "arg_2", ".", "get", "(", "timeout", "=", "0.1", ")", "arg_7", "=", "pickle", ".", "loads", "(", "arg_6", ")", "if", "arg_7", "is", "None", ":", "arg_5", "=", "True", "arg_2", ".", "put", "(", "pickle", ".", "dumps", "(", "None", ",", "protocol", "=", "-", "1", ")", ")", "else", ":", "arg_8", "=", "arg_1", ".", "augment_batch", "(", "arg_7", ")", "arg_6", "=", "pickle", ".", "dumps", "(", "arg_8", ",", "protocol", "=", "-", "1", ")", "arg_3", ".", "put", "(", "arg_6", ")", "except", "QueueEmpty", ":", "time", ".", "sleep", "(", "0.01", ")", "arg_3", ".", "put", "(", "pickle", ".", "dumps", "(", "None", ",", "protocol", "=", "-", "1", ")", ")", "time", ".", "sleep", "(", "0.01", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Augment endlessly images in the source queue.\n\n        This is a worker function for that endlessly queries the source queue (input batches),\n        augments batches in it and sends the result to the output queue.\n\n        \"\"\"\n        np.random.seed(arg_4)\n        random.seed(arg_4)\n        arg_1.reseed(arg_4)\n        ia.seed(arg_4)\n\n        arg_5 = False\n\n        while not arg_5:\n            # wait for a new batch in the source queue and load it\n            try:\n                arg_6 = arg_2.get(timeout=0.1)\n                arg_7 = pickle.loads(arg_6)\n                if arg_7 is None:\n                    arg_5 = True\n                    # put it back in so that other workers know that the loading queue is finished\n                    arg_2.put(pickle.dumps(None, protocol=-1))\n                else:\n                    arg_8 = arg_1.augment_batch(arg_7)\n\n                    # send augmented batch to output queue\n                    arg_6 = pickle.dumps(arg_8, protocol=-1)\n                    arg_3.put(arg_6)\n            except QueueEmpty:\n                time.sleep(0.01)\n\n        arg_3.put(pickle.dumps(None, protocol=-1))\n        time.sleep(0.01)", "path": "imgaug/multicore.py", "identifier": "BackgroundAugmenter._augment_images_worker", "docstring": "Augment endlessly images in the source queue.\n\n        This is a worker function for that endlessly queries the source queue (input batches),\n        augments batches in it and sends the result to the output queue.", "docstring_tokens": ["Augment", "endlessly", "images", "in", "the", "source", "queue", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 256448}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/stats.py#L607-L622", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Return the sum of vehicle hours in a particular day by route type.", "language": "python", "parameters": "(gtfs, route_type)", "return_statement": "return df['vehicle_hours_type'].item()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_suitable_date_for_daily_extract", "(", ")", "arg_3", "=", "(", "\" SELECT * , SUM(end_time_ds - start_time_ds)/3600 as vehicle_hours_type\"", "\" FROM\"", "\" (SELECT * FROM day_trips as q1\"", "\" INNER JOIN\"", "\" (SELECT route_I, type FROM routes) as q2\"", "\" ON q1.route_I = q2.route_I\"", "\" WHERE type = {route_type}\"", "\" AND date = '{day}')\"", ".", "format", "(", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", ")", "arg_4", "=", "arg_0", ".", "execute_custom_query_pandas", "(", "arg_3", ")", "return", "arg_4", "[", "'vehicle_hours_type'", "]", ".", "item", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Return the sum of vehicle hours in a particular day by route type.\n    \"\"\"\n\n    arg_2 = arg_0.get_suitable_date_for_daily_extract()\n    arg_3 = (\" SELECT * , SUM(end_time_ds - start_time_ds)/3600 as vehicle_hours_type\"\n             \" FROM\"\n             \" (SELECT * FROM day_trips as q1\"\n             \" INNER JOIN\"\n             \" (SELECT route_I, type FROM routes) as q2\"\n             \" ON q1.route_I = q2.route_I\"\n             \" WHERE type = {route_type}\"\n             \" AND date = '{day}')\".format(arg_2=arg_2, arg_1=arg_1))\n    arg_4 = arg_0.execute_custom_query_pandas(arg_3)\n    return arg_4['vehicle_hours_type'].item()", "path": "gtfspy/stats.py", "identifier": "get_vehicle_hours_by_type", "docstring": "Return the sum of vehicle hours in a particular day by route type.", "docstring_tokens": ["Return", "the", "sum", "of", "vehicle", "hours", "in", "a", "particular", "day", "by", "route", "type", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 256449}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/layers/conv_variational.py#L333-L363", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates a layer from its config.", "language": "python", "parameters": "(cls, config)", "return_statement": "return cls(**config)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "copy", "(", ")", "arg_2", "=", "[", "'kernel_posterior_fn'", ",", "'kernel_posterior_tensor_fn'", ",", "'kernel_prior_fn'", ",", "'kernel_divergence_fn'", ",", "'bias_posterior_fn'", ",", "'bias_posterior_tensor_fn'", ",", "'bias_prior_fn'", ",", "'bias_divergence_fn'", ",", "]", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "arg_1", "[", "arg_3", "]", "arg_5", "=", "arg_1", ".", "pop", "(", "arg_3", "+", "'_type'", ")", "if", "arg_4", "is", "not", "None", ":", "arg_1", "[", "arg_3", "]", "=", "tfp_layers_util", ".", "deserialize_function", "(", "arg_4", ",", "arg_5", "=", "arg_5", ")", "return", "arg_0", "(", "**", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Creates a layer from its config.\n\n    This method is the reverse of `get_config`, capable of instantiating the\n    same layer from the config dictionary.\n\n    Args:\n      config: A Python dictionary, typically the output of `get_config`.\n\n    Returns:\n      layer: A layer instance.\n    \"\"\"\n    arg_1 = arg_1.copy()\n    arg_2 = [\n        'kernel_posterior_fn',\n        'kernel_posterior_tensor_fn',\n        'kernel_prior_fn',\n        'kernel_divergence_fn',\n        'bias_posterior_fn',\n        'bias_posterior_tensor_fn',\n        'bias_prior_fn',\n        'bias_divergence_fn',\n    ]\n    for arg_3 in arg_2:\n      arg_4 = arg_1[arg_3]\n      arg_5 = arg_1.pop(arg_3 + '_type')\n      if arg_4 is not None:\n        arg_1[arg_3] = tfp_layers_util.deserialize_function(\n            arg_4,\n            arg_5=arg_5)\n    return arg_0(**arg_1)", "path": "tensorflow_probability/python/layers/conv_variational.py", "identifier": "_ConvVariational.from_config", "docstring": "Creates a layer from its config.\n\n    This method is the reverse of `get_config`, capable of instantiating the\n    same layer from the config dictionary.\n\n    Args:\n      config: A Python dictionary, typically the output of `get_config`.\n\n    Returns:\n      layer: A layer instance.", "docstring_tokens": ["Creates", "a", "layer", "from", "its", "config", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256450}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L199-L207", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Atomically rename and clean tempfile", "language": "python", "parameters": "(tempfile, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ":", "os", ".", "rename", "(", "arg_0", ",", "arg_1", ")", "else", ":", "os", ".", "unlink", "(", "arg_0", ")", "if", "arg_1", "in", "TEMP_FILES", ":", "TEMP_FILES", ".", "remove", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n  '''Atomically rename and clean tempfile'''\n  if arg_1:\n    os.rename(arg_0, arg_1)\n  else:\n    os.unlink(arg_0)\n\n  if arg_1 in TEMP_FILES:\n    TEMP_FILES.remove(arg_0)", "path": "s4cmd.py", "identifier": "tempfile_set", "docstring": "Atomically rename and clean tempfile", "docstring_tokens": ["Atomically", "rename", "and", "clean", "tempfile"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 256451}
{"url": "https://github.com/Cornices/cornice.ext.swagger/blob/c31a5cc8d5dd112b11dc41ccb6d09b423b537abc/cornice_swagger/swagger.py#L687-L705", "sha": "c31a5cc8d5dd112b11dc41ccb6d09b423b537abc", "docstring_summary": "Extract schema from view args and transform it using\n        the pipeline of schema transformers", "language": "python", "parameters": "(self, args)", "return_statement": "return schema", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'schema'", ",", "colander", ".", "MappingSchema", "(", ")", ")", "if", "not", "isinstance", "(", "arg_2", ",", "colander", ".", "Schema", ")", ":", "arg_2", "=", "arg_2", "(", ")", "arg_2", "=", "arg_2", ".", "clone", "(", ")", "for", "arg_3", "in", "arg_0", ".", "schema_transformers", ":", "arg_2", "=", "arg_3", "(", "arg_2", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Extract schema from view args and transform it using\n        the pipeline of schema transformers\n\n        :param args:\n            Arguments from the view decorator.\n\n        :rtype: colander.MappingSchema()\n        :returns: View schema cloned and transformed\n        \"\"\"\n\n        arg_2 = arg_1.get('schema', colander.MappingSchema())\n        if not isinstance(arg_2, colander.Schema):\n            arg_2 = arg_2()\n        arg_2 = arg_2.clone()\n        for arg_3 in arg_0.schema_transformers:\n            arg_2 = arg_3(arg_2, arg_1)\n        return arg_2", "path": "cornice_swagger/swagger.py", "identifier": "CorniceSwagger._extract_transform_colander_schema", "docstring": "Extract schema from view args and transform it using\n        the pipeline of schema transformers\n\n        :param args:\n            Arguments from the view decorator.\n\n        :rtype: colander.MappingSchema()\n        :returns: View schema cloned and transformed", "docstring_tokens": ["Extract", "schema", "from", "view", "args", "and", "transform", "it", "using", "the", "pipeline", "of", "schema", "transformers"], "nwo": "Cornices/cornice.ext.swagger", "score": 0.28168436607245656, "idx": 256452}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/layer_condition.py#L229-L248", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Report generated model in human readable form.", "language": "python", "parameters": "(self, output_file=sys.stdout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "stdout", ")", ":", "if", "arg_0", ".", "_args", "and", "arg_0", ".", "_args", ".", "verbose", ">", "2", ":", "pprint", "(", "arg_0", ".", "results", ")", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "results", "[", "'dimensions'", "]", ".", "items", "(", ")", ":", "print", "(", "\"{}D layer condition:\"", ".", "format", "(", "arg_4", ")", ",", "file", "=", "arg_1", ")", "for", "arg_6", ",", "arg_7", "in", "sorted", "(", "arg_5", "[", "'caches'", "]", ".", "items", "(", ")", ")", ":", "print", "(", "arg_6", "+", "\": \"", ",", "end", "=", "''", ",", "file", "=", "arg_1", ")", "if", "arg_7", "[", "'lt'", "]", "is", "sympy", ".", "true", ":", "print", "(", "\"unconditionally fulfilled\"", ",", "file", "=", "arg_1", ")", "else", ":", "if", "arg_7", "[", "'eq'", "]", "is", "None", ":", "print", "(", "\"{}\"", ".", "format", "(", "arg_7", "[", "'lt'", "]", ")", ",", "file", "=", "arg_1", ")", "elif", "type", "(", "arg_7", "[", "'eq'", "]", ")", "is", "not", "list", ":", "print", "(", "\"{}\"", ".", "format", "(", "arg_7", "[", "'eq'", "]", ")", ",", "file", "=", "arg_1", ")", "else", ":", "for", "arg_8", "in", "arg_7", "[", "'eq'", "]", ":", "for", "arg_9", ",", "arg_10", "in", "arg_8", ".", "items", "(", ")", ":", "print", "(", "\"{} <= {}\"", ".", "format", "(", "arg_9", ",", "arg_10", ")", ",", "file", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=arg_2.stdout):\n        \"\"\"Report generated model in human readable form.\"\"\"\n        if arg_0._args and arg_0._args.verbose > 2:\n            pprint(arg_0.results)\n\n        for arg_4, arg_5 in arg_0.results['dimensions'].items():\n            print(\"{}D layer condition:\".format(arg_4), file=arg_1)\n            for arg_6, arg_7 in sorted(arg_5['caches'].items()):\n                print(arg_6+\": \", end='', file=arg_1)\n                if arg_7['lt'] is sympy.true:\n                    print(\"unconditionally fulfilled\", file=arg_1)\n                else:\n                    if arg_7['eq'] is None:\n                        print(\"{}\".format(arg_7['lt']), file=arg_1)\n                    elif type(arg_7['eq']) is not list:\n                        print(\"{}\".format(arg_7['eq']), file=arg_1)\n                    else:\n                        for arg_8 in arg_7['eq']:\n                            for arg_9, arg_10 in arg_8.items():\n                                print(\"{} <= {}\".format(arg_9, arg_10), file=arg_1)", "path": "kerncraft/models/layer_condition.py", "identifier": "LC.report", "docstring": "Report generated model in human readable form.", "docstring_tokens": ["Report", "generated", "model", "in", "human", "readable", "form", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 256453}
{"url": "https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/Sparse3DMatrix.py#L259-L302", "sha": "ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449", "docstring_summary": "In-place multiplication", "language": "python", "parameters": "(self, multiplier, axis=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", ".", "finalized", ":", "if", "arg_1", ".", "ndim", "==", "1", ":", "if", "arg_2", "==", "0", ":", "raise", "NotImplementedError", "(", "'The method is not yet implemented for the axis.'", ")", "elif", "arg_2", "==", "1", ":", "arg_3", "=", "len", "(", "arg_1", ")", "arg_4", "=", "lil_matrix", "(", "(", "arg_3", ",", "arg_3", ")", ")", "arg_4", ".", "setdiag", "(", "arg_1", ")", "for", "arg_5", "in", "xrange", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "arg_0", ".", "data", "[", "arg_5", "]", "=", "arg_0", ".", "data", "[", "arg_5", "]", "*", "arg_4", "elif", "arg_2", "==", "2", ":", "for", "arg_5", "in", "xrange", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "arg_0", ".", "data", "[", "arg_5", "]", ".", "data", "*=", "arg_1", "[", "arg_0", ".", "data", "[", "arg_5", "]", ".", "indices", "]", "else", ":", "raise", "RuntimeError", "(", "'The axis should be 0, 1, or 2.'", ")", "elif", "arg_1", ".", "ndim", "==", "2", ":", "if", "arg_2", "==", "0", ":", "for", "arg_5", "in", "xrange", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "arg_0", ".", "data", "[", "arg_5", "]", ".", "data", "*=", "arg_1", "[", "arg_0", ".", "data", "[", "arg_5", "]", ".", "indices", ",", "arg_5", "]", "elif", "arg_2", "==", "1", ":", "for", "arg_5", "in", "xrange", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "arg_0", ".", "data", "[", "arg_5", "]", "=", "arg_0", ".", "data", "[", "arg_5", "]", ".", "Func", "(", "arg_1", ")", "elif", "arg_2", "==", "2", ":", "for", "arg_5", "in", "xrange", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "arg_7", "=", "arg_1", "[", "arg_5", ",", ":", "]", "arg_7", "=", "arg_7", ".", "ravel", "(", ")", "arg_0", ".", "data", "[", "arg_5", "]", ".", "data", "*=", "arg_7", ".", "repeat", "(", "np", ".", "diff", "(", "arg_0", ".", "data", "[", "arg_5", "]", ".", "indptr", ")", ")", "else", ":", "raise", "RuntimeError", "(", "'The axis should be 0, 1, or 2.'", ")", "elif", "isinstance", "(", "arg_1", ",", "Sparse3DMatrix", ")", ":", "for", "arg_5", "in", "xrange", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "arg_0", ".", "data", "[", "arg_5", "]", "=", "arg_0", ".", "data", "[", "arg_5", "]", ".", "Func", "(", "arg_1", ".", "data", "[", "arg_5", "]", ")", "else", ":", "raise", "RuntimeError", "(", "'The multiplier should be 1, 2 dimensional numpy array or a Sparse3DMatrix object.'", ")", "else", ":", "raise", "RuntimeError", "(", "'The original matrix must be finalized.'", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        In-place multiplication\n\n        :param multiplier: A matrix or vector to be multiplied\n        :param axis: The dim along which 'multiplier' is multiplied\n        :return: Nothing (as it performs in-place operations)\n        \"\"\"\n        if arg_0.finalized:\n            if arg_1.ndim == 1:\n                if arg_2 == 0:  # multiplier is np.array of length |haplotypes|\n                    raise NotImplementedError('The method is not yet implemented for the axis.')\n                elif arg_2 == 1:  # multiplier is np.array of length |loci|\n                    arg_3 = len(arg_1)\n                    arg_4 = lil_matrix((arg_3, arg_3))\n                    arg_4.setdiag(arg_1)\n                    for arg_5 in xrange(arg_0.shape[1]):\n                        arg_0.data[arg_5] = arg_0.data[arg_5] * arg_4\n                elif arg_2 == 2:  # multiplier is np.array of length |reads|\n                    for arg_5 in xrange(arg_0.shape[1]):\n                        arg_0.data[arg_5].data *= arg_1[arg_0.data[arg_5].indices]\n                else:\n                    raise RuntimeError('The axis should be 0, 1, or 2.')\n            elif arg_1.ndim == 2:\n                if arg_2 == 0:  # multiplier is sp.sparse matrix of shape |reads| x |haplotypes|\n                    for arg_5 in xrange(arg_0.shape[1]):\n                        arg_0.data[arg_5].data *= arg_1[arg_0.data[arg_5].indices, arg_5]\n                elif arg_2 == 1:  # multiplier is sp.sparse matrix of shape |reads| x |loci|\n                    for arg_5 in xrange(arg_0.shape[1]):\n                        arg_0.data[arg_5] = arg_0.data[arg_5].Func(arg_1)\n                elif arg_2 == 2:  # multiplier is np.matrix of shape |haplotypes| x |loci|\n                    for arg_5 in xrange(arg_0.shape[1]):\n                        arg_7 = arg_1[arg_5, :]\n                        arg_7 = arg_7.ravel()\n                        arg_0.data[arg_5].data *= arg_7.repeat(np.diff(arg_0.data[arg_5].indptr))\n                else:\n                    raise RuntimeError('The axis should be 0, 1, or 2.')\n            elif isinstance(arg_1, Sparse3DMatrix):  # multiplier is Sparse3DMatrix object\n                    for arg_5 in xrange(arg_0.shape[1]):\n                        arg_0.data[arg_5] = arg_0.data[arg_5].Func(arg_1.data[arg_5])\n            else:\n                raise RuntimeError('The multiplier should be 1, 2 dimensional numpy array or a Sparse3DMatrix object.')\n        else:\n            raise RuntimeError('The original matrix must be finalized.')", "path": "emase/Sparse3DMatrix.py", "identifier": "Sparse3DMatrix.multiply", "docstring": "In-place multiplication\n\n        :param multiplier: A matrix or vector to be multiplied\n        :param axis: The dim along which 'multiplier' is multiplied\n        :return: Nothing (as it performs in-place operations)", "docstring_tokens": ["In", "-", "place", "multiplication"], "nwo": "churchill-lab/emase", "score": 0.1956350121830092, "idx": 256454}
{"url": "https://github.com/jmcclell/django-bootstrap-pagination/blob/3a8187fb6e9b7c2ea4563698e1c3d117204e5049/bootstrap_pagination/templatetags/bootstrap_pagination.py#L46-L54", "sha": "3a8187fb6e9b7c2ea4563698e1c3d117204e5049", "docstring_summary": "Helper function to turn a string representation of \"true\" into\n    boolean True.", "language": "python", "parameters": "(val)", "return_statement": "return val in ['true', 'on', 'yes', True]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "arg_0", ".", "lower", "(", ")", "return", "arg_0", "in", "[", "'true'", ",", "'on'", ",", "'yes'", ",", "True", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Helper function to turn a string representation of \"true\" into\n    boolean True.\n    \"\"\"\n    if isinstance(arg_0, str):\n        arg_0 = arg_0.lower()\n\n    return arg_0 in ['true', 'on', 'yes', True]", "path": "bootstrap_pagination/templatetags/bootstrap_pagination.py", "identifier": "strToBool", "docstring": "Helper function to turn a string representation of \"true\" into\n    boolean True.", "docstring_tokens": ["Helper", "function", "to", "turn", "a", "string", "representation", "of", "true", "into", "boolean", "True", "."], "nwo": "jmcclell/django-bootstrap-pagination", "score": 0.5598884592426002, "idx": 256455}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model.py#L961-L980", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Remove entries with 0 likelihood or likelihood less than\n    minLikelihoodThreshold, but don't leave an empty dict.", "language": "python", "parameters": "(cls, likelihoodsDict, minLikelihoodThreshold,\n                                 maxPredictionsPerStep)", "return_statement": "return likelihoodsDict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "(", "None", ",", "None", ")", "for", "(", "arg_5", ",", "arg_6", ")", "in", "arg_1", ".", "items", "(", ")", ":", "if", "len", "(", "arg_1", ")", "<=", "1", ":", "break", "if", "arg_4", "[", "0", "]", "is", "None", "or", "arg_6", ">=", "arg_4", "[", "1", "]", ":", "if", "arg_4", "[", "0", "]", "is", "not", "None", "and", "arg_4", "[", "1", "]", "<", "arg_2", ":", "del", "arg_1", "[", "arg_4", "[", "0", "]", "]", "arg_4", "=", "(", "arg_5", ",", "arg_6", ")", "elif", "arg_6", "<", "arg_2", ":", "del", "arg_1", "[", "arg_5", "]", "arg_1", "=", "dict", "(", "sorted", "(", "arg_1", ".", "iteritems", "(", ")", ",", "key", "=", "itemgetter", "(", "1", ")", ",", "reverse", "=", "True", ")", "[", ":", "arg_3", "]", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2,\n                                 arg_3):\n    \"\"\"Remove entries with 0 likelihood or likelihood less than\n    minLikelihoodThreshold, but don't leave an empty dict.\n    \"\"\"\n    arg_4 = (None, None)\n    for (arg_5, arg_6) in arg_1.items():\n      if len(arg_1) <= 1:\n        break\n      if arg_4[0] is None or arg_6 >= arg_4[1]:\n        if arg_4[0] is not None and arg_4[1] < arg_2:\n          del arg_1[arg_4[0]]\n        arg_4 = (arg_5, arg_6)\n      elif arg_6 < arg_2:\n        del arg_1[arg_5]\n    # Limit the number of predictions to include.\n    arg_1 = dict(sorted(arg_1.iteritems(),\n                                  key=itemgetter(1),\n                                  reverse=True)[:arg_3])\n    return arg_1", "path": "src/nupic/frameworks/opf/htm_prediction_model.py", "identifier": "HTMPredictionModel._removeUnlikelyPredictions", "docstring": "Remove entries with 0 likelihood or likelihood less than\n    minLikelihoodThreshold, but don't leave an empty dict.", "docstring_tokens": ["Remove", "entries", "with", "0", "likelihood", "or", "likelihood", "less", "than", "minLikelihoodThreshold", "but", "don", "t", "leave", "an", "empty", "dict", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256456}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/confluence.py#L337-L367", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the contents of a repository.", "language": "python", "parameters": "(self, from_date=DEFAULT_DATETIME,\n                 offset=None, max_contents=MAX_CONTENTS)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "RCONTENTS", "+", "'/'", "+", "arg_0", ".", "MSEARCH", "arg_7", "=", "arg_1", ".", "strftime", "(", "\"%Y-%m-%d %H:%M\"", ")", "arg_8", "=", "arg_0", ".", "VCQL", "%", "{", "'date'", ":", "arg_7", "}", "arg_9", "=", "{", "arg_0", ".", "PCQL", ":", "arg_8", ",", "arg_0", ".", "PLIMIT", ":", "arg_4", ",", "arg_0", ".", "PEXPAND", ":", "arg_0", ".", "PANCESTORS", "}", "if", "arg_3", ":", "arg_9", "[", "arg_0", ".", "PSTART", "]", "=", "arg_3", "for", "arg_11", "in", "arg_0", ".", "_call", "(", "arg_6", ",", "arg_9", ")", ":", "yield", "arg_11"], "function": "def Func(arg_0, arg_1=arg_2,\n                 arg_3=None, arg_4=arg_5):\n        \"\"\"Get the Func of a repository.\n\n        This method returns an iterator that manages the pagination\n        over Func. Take into account that the seconds of `from_date`\n        parameter will be ignored because the API only works with\n        hours and minutes.\n\n        :param from_date: fetch the Func updated since this date\n        :param offset: fetch the Func starting from this offset\n        :param limit: maximum number of Func to fetch per request\n        \"\"\"\n        arg_6 = arg_0.RCONTENTS + '/' + arg_0.MSEARCH\n\n        # Set confluence query parameter (cql)\n        arg_7 = arg_1.strftime(\"%Y-%m-%d %H:%M\")\n        arg_8 = arg_0.VCQL % {'date': arg_7}\n\n        # Set parameters\n        arg_9 = {\n            arg_0.PCQL: arg_8,\n            arg_0.PLIMIT: arg_4,\n            arg_0.PEXPAND: arg_0.PANCESTORS\n        }\n\n        if arg_3:\n            arg_9[arg_0.PSTART] = arg_3\n\n        for arg_11 in arg_0._call(arg_6, arg_9):\n            yield arg_11", "path": "perceval/backends/core/confluence.py", "identifier": "ConfluenceClient.contents", "docstring": "Get the contents of a repository.\n\n        This method returns an iterator that manages the pagination\n        over contents. Take into account that the seconds of `from_date`\n        parameter will be ignored because the API only works with\n        hours and minutes.\n\n        :param from_date: fetch the contents updated since this date\n        :param offset: fetch the contents starting from this offset\n        :param limit: maximum number of contents to fetch per request", "docstring_tokens": ["Get", "the", "contents", "of", "a", "repository", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256457}
{"url": "https://github.com/gtaylor/evarify/blob/37cec29373c820eda96939633e2067d55598915b/evarify/filters/python_basics.py#L83-L96", "sha": "37cec29373c820eda96939633e2067d55598915b", "docstring_summary": "If the value is ``None``, fail validation.", "language": "python", "parameters": "(config_val, evar)", "return_statement": "return config_val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "is", "None", ":", "raise", "ValueError", "(", "\"Value for environment variable '{evar_name}' can't \"", "\"be empty.\"", ".", "format", "(", "evar_name", "=", "arg_1", ".", "name", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    If the value is ``None``, fail validation.\n\n    :param str config_val: The env var value.\n    :param EnvironmentVariable evar: The EVar object we are validating\n        a value for.\n    :raises: ValueError if the config value is None.\n    \"\"\"\n    if arg_0 is None:\n        raise ValueError(\n            \"Value for environment variable '{evar_name}' can't \"\n            \"be empty.\".format(evar_name=arg_1.name))\n    return arg_0", "path": "evarify/filters/python_basics.py", "identifier": "validate_is_not_none", "docstring": "If the value is ``None``, fail validation.\n\n    :param str config_val: The env var value.\n    :param EnvironmentVariable evar: The EVar object we are validating\n        a value for.\n    :raises: ValueError if the config value is None.", "docstring_tokens": ["If", "the", "value", "is", "None", "fail", "validation", "."], "nwo": "gtaylor/evarify", "score": 0.0, "idx": 256458}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/data_generator.py#L174-L185", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns the nth record", "language": "python", "parameters": "(self, n=None)", "return_statement": "return record", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "assert", "len", "(", "arg_0", ".", "fields", ")", ">", "0", "arg_1", "=", "arg_0", ".", "fields", "[", "0", "]", ".", "numRecords", "-", "1", "assert", "(", "all", "(", "arg_2", ".", "numRecords", ">", "arg_1", "for", "arg_2", "in", "arg_0", ".", "fields", ")", ")", "arg_3", "=", "[", "arg_2", ".", "values", "[", "arg_1", "]", "for", "arg_2", "in", "arg_0", ".", "fields", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Returns the nth record\"\"\"\n\n    if arg_1 is None:\n      assert len(arg_0.fields)>0\n      arg_1 = arg_0.fields[0].numRecords-1\n\n    assert (all(arg_2.numRecords>arg_1 for arg_2 in arg_0.fields))\n\n    arg_3 = [arg_2.values[arg_1] for arg_2 in arg_0.fields]\n\n    return arg_3", "path": "src/nupic/data/generators/data_generator.py", "identifier": "DataGenerator.getRecord", "docstring": "Returns the nth record", "docstring_tokens": ["Returns", "the", "nth", "record"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256459}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/__init__.py#L63-L80", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "update secrets will look for a dropbox token in the environment at\n           SREGISTRY_DROPBOX_TOKEN and if found, create a client. If not,\n           an error message is returned and the client exits.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_required_get_and_update", "(", "'SREGISTRY_DROPBOX_TOKEN'", ")", "arg_0", ".", "dbx", "=", "Dropbox", "(", "arg_1", ")", "try", ":", "arg_0", ".", "account", "=", "arg_0", ".", "dbx", ".", "users_get_current_account", "(", ")", "except", "AuthError", "as", "err", ":", "bot", ".", "error", "(", "'Account invalid. Exiting.'", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0):\n        '''update secrets will look for a dropbox token in the environment at\n           SREGISTRY_DROPBOX_TOKEN and if found, create a client. If not,\n           an error message is returned and the client exits.\n        '''\n\n        # Retrieve the user token. Exit if not found \n        arg_1 = arg_0._required_get_and_update('SREGISTRY_DROPBOX_TOKEN')\n\n        # Create the dropbox client\n        arg_0.dbx = Dropbox(arg_1)\n\n        # Verify that the account is valid\n        try:\n            arg_0.account = arg_0.dbx.users_get_current_account()\n        except AuthError as err:\n            bot.error('Account invalid. Exiting.')\n            sys.exit(1)", "path": "sregistry/main/dropbox/__init__.py", "identifier": "Client._update_secrets", "docstring": "update secrets will look for a dropbox token in the environment at\n           SREGISTRY_DROPBOX_TOKEN and if found, create a client. If not,\n           an error message is returned and the client exits.", "docstring_tokens": ["update", "secrets", "will", "look", "for", "a", "dropbox", "token", "in", "the", "environment", "at", "SREGISTRY_DROPBOX_TOKEN", "and", "if", "found", "create", "a", "client", ".", "If", "not", "an", "error", "message", "is", "returned", "and", "the", "client", "exits", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 256460}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L436-L463", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "function for removing spines and ticks.", "language": "python", "parameters": "(ax, spines)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "spines", ".", "items", "(", ")", ":", "if", "arg_2", "in", "arg_1", ":", "continue", "else", ":", "arg_3", ".", "set_color", "(", "'none'", ")", "if", "'left'", "in", "arg_1", ":", "arg_0", ".", "yaxis", ".", "set_ticks_position", "(", "'left'", ")", "else", ":", "arg_0", ".", "yaxis", ".", "set_ticks", "(", "[", "]", ")", "if", "'bottom'", "in", "arg_1", ":", "arg_0", ".", "xaxis", ".", "set_ticks_position", "(", "'bottom'", ")", "else", ":", "arg_0", ".", "xaxis", ".", "set_ticks", "(", "[", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"function for removing spines and ticks.\n\n    :param ax: axes object\n    :param spines: a list of spines names to keep. e.g [left, right, top, bottom]\n                    if spines = []. remove all spines and ticks.\n\n    \"\"\"\n    for arg_2, arg_3 in arg_0.spines.items():\n        if arg_2 in arg_1:\n            # spine.set_position(('outward', 10))  # outward by 10 points\n            # spine.set_smart_bounds(True)\n            continue\n        else:\n            arg_3.set_color('none')  # don't draw spine\n\n    # turn off ticks where there is no spine\n    if 'left' in arg_1:\n        arg_0.yaxis.set_ticks_position('left')\n    else:\n        # no yaxis ticks\n        arg_0.yaxis.set_ticks([])\n\n    if 'bottom' in arg_1:\n        arg_0.xaxis.set_ticks_position('bottom')\n    else:\n        # no xaxis ticks\n        arg_0.xaxis.set_ticks([])", "path": "gseapy/plot.py", "identifier": "adjust_spines", "docstring": "function for removing spines and ticks.\n\n    :param ax: axes object\n    :param spines: a list of spines names to keep. e.g [left, right, top, bottom]\n                    if spines = []. remove all spines and ticks.", "docstring_tokens": ["function", "for", "removing", "spines", "and", "ticks", "."], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 256461}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/create.py#L49-L91", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Create an empty Mapchete and process file in a given directory.", "language": "python", "parameters": "(\n    mapchete_file,\n    process_file,\n    out_format,\n    out_path=None,\n    pyramid_type=None,\n    force=False\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", "or", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "if", "not", "arg_5", ":", "raise", "IOError", "(", "\"file(s) already exists\"", ")", "arg_3", "=", "arg_3", "if", "arg_3", "else", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "\"output\"", ")", "arg_6", "=", "pkg_resources", ".", "resource_filename", "(", "\"mapchete.static\"", ",", "\"process_template.py\"", ")", "arg_1", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_1", ")", "copyfile", "(", "arg_6", ",", "arg_1", ")", "arg_7", "=", "pkg_resources", ".", "resource_filename", "(", "\"mapchete.static\"", ",", "\"mapchete_template.mapchete\"", ")", "arg_8", "=", "dict", "(", "format", "=", "arg_2", ",", "path", "=", "arg_3", ",", "**", "FORMAT_MANDATORY", "[", "arg_2", "]", ")", "arg_9", "=", "{", "'grid'", ":", "arg_4", "}", "arg_10", "=", "{", "'process_file'", ":", "arg_1", ",", "'output'", ":", "dump", "(", "{", "'output'", ":", "arg_8", "}", ",", "default_flow_style", "=", "False", ")", ",", "'pyramid'", ":", "dump", "(", "{", "'pyramid'", ":", "arg_9", "}", ",", "default_flow_style", "=", "False", ")", "}", "with", "open", "(", "arg_7", ",", "'r'", ")", "as", "config_template", ":", "arg_11", "=", "Template", "(", "config_template", ".", "read", "(", ")", ")", "arg_12", "=", "arg_11", ".", "substitute", "(", "arg_10", ")", "with", "open", "(", "arg_0", ",", "'w'", ")", "as", "target_config", ":", "target_config", ".", "write", "(", "arg_12", ")"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2,\n    arg_3=None,\n    arg_4=None,\n    arg_5=False\n):\n    \"\"\"Create an empty Mapchete and process file in a given directory.\"\"\"\n    if os.path.isfile(arg_1) or os.path.isfile(arg_0):\n        if not arg_5:\n            raise IOError(\"file(s) already exists\")\n\n    arg_3 = arg_3 if arg_3 else os.path.join(os.getcwd(), \"output\")\n\n    # copy file template to target directory\n    arg_6 = pkg_resources.resource_filename(\n        \"mapchete.static\", \"process_template.py\"\n    )\n    arg_1 = os.path.join(os.getcwd(), arg_1)\n    copyfile(arg_6, arg_1)\n\n    # modify and copy mapchete file template to target directory\n    arg_7 = pkg_resources.resource_filename(\n        \"mapchete.static\", \"mapchete_template.mapchete\"\n    )\n\n    arg_8 = dict(\n        format=arg_2, path=arg_3, **FORMAT_MANDATORY[arg_2]\n    )\n\n    arg_9 = {'grid': arg_4}\n\n    arg_10 = {\n        'process_file': arg_1,\n        'output': dump({'output': arg_8}, default_flow_style=False),\n        'pyramid': dump({'pyramid': arg_9}, default_flow_style=False)\n    }\n    with open(arg_7, 'r') as config_template:\n        arg_11 = Template(config_template.read())\n        arg_12 = arg_11.substitute(arg_10)\n    with open(arg_0, 'w') as target_config:\n        target_config.write(arg_12)", "path": "mapchete/cli/default/create.py", "identifier": "create", "docstring": "Create an empty Mapchete and process file in a given directory.", "docstring_tokens": ["Create", "an", "empty", "Mapchete", "and", "process", "file", "in", "a", "given", "directory", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 256462}
{"url": "https://github.com/althonos/fs.archive/blob/a09bb5da56da6b96aca3e20841fa86dea7c5b79a/fs/archive/_utils.py#L98-L110", "sha": "a09bb5da56da6b96aca3e20841fa86dea7c5b79a", "docstring_summary": "Test whether a path can be written to.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "return", "os", ".", "access", "(", "arg_0", ",", "os", ".", "W_OK", ")", "try", ":", "with", "open", "(", "arg_0", ",", "'w'", ")", ":", "pass", "except", "(", "OSError", ",", "IOError", ")", ":", "return", "False", "else", ":", "os", ".", "remove", "(", "arg_0", ")", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"Test whether a path can be written to.\n    \"\"\"\n    if os.path.exists(arg_0):\n        return os.access(arg_0, os.W_OK)\n    try:\n        with open(arg_0, 'w'):\n            pass\n    except (OSError, IOError):\n        return False\n    else:\n        os.remove(arg_0)\n        return True", "path": "fs/archive/_utils.py", "identifier": "writable_path", "docstring": "Test whether a path can be written to.", "docstring_tokens": ["Test", "whether", "a", "path", "can", "be", "written", "to", "."], "nwo": "althonos/fs.archive", "score": 0.2744346966463966, "idx": 256463}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/fluxcal.py#L202-L243", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Calculate the coarse channel spectrum and system temperature of the noise diode in Jy given two noise diode\n    measurements ON and OFF the calibrator source with the same frequency and time resolution", "language": "python", "parameters": "(calON_obs,calOFF_obs,calflux,calfreq,spec_in,average=True,oneflux=False,**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "True", ",", "arg_6", "=", "False", ",", "**", "arg_7", ")", ":", "arg_8", "=", "Waterfall", "(", "arg_0", ",", "max_load", "=", "150", ")", "arg_9", "=", "arg_8", ".", "populate_freqs", "(", ")", "arg_10", "=", "arg_8", ".", "calc_n_coarse_chan", "(", ")", "arg_11", "=", "arg_8", ".", "header", "[", "'nchans'", "]", "arg_12", "=", "arg_11", "/", "arg_10", "arg_13", ",", "arg_14", "=", "f_ratios", "(", "arg_0", ",", "arg_1", ",", "arg_12", ",", "**", "arg_7", ")", "arg_15", "=", "get_centerfreqs", "(", "arg_9", ",", "arg_12", ")", "arg_16", "=", "get_calfluxes", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_15", ",", "arg_6", ")", "arg_17", "=", "arg_16", "/", "(", "1", "/", "arg_13", "-", "1", "/", "arg_14", ")", "arg_18", "=", "arg_17", "/", "arg_14", "if", "arg_5", "==", "True", ":", "return", "np", ".", "mean", "(", "arg_17", ")", ",", "np", ".", "mean", "(", "arg_18", ")", "else", ":", "return", "arg_17", ",", "arg_18"], "function": "def Func(arg_0,arg_1,arg_2,arg_3,arg_4,arg_5=True,arg_6=False,**arg_7):\n    '''\n    Calculate the coarse channel spectrum and system temperature of the noise diode in Jy given two noise diode\n    measurements ON and OFF the calibrator source with the same frequency and time resolution\n\n    Parameters\n    ----------\n    calON_obs : str\n        (see f_ratios() above)\n    calOFF_obs : str\n        (see f_ratios() above)\n    calflux : float\n        Known flux of calibrator source at a particular frequency\n    calfreq : float\n        Frequency where calibrator source has flux calflux (see above)\n    spec_in : float\n        Known power-law spectral index of calibrator source. Use convention flux(frequency) = constant * frequency^(spec_in)\n    average : boolean\n        Use average=True to return noise diode and Tsys spectra averaged over frequencies\n    '''\n    #Load frequencies and calculate number of channels per coarse channel\n    arg_8 = Waterfall(arg_0,max_load=150)\n    arg_9 = arg_8.populate_freqs()\n    arg_10 = arg_8.calc_n_coarse_chan()\n    arg_11 = arg_8.header['nchans']\n    arg_12 = arg_11/arg_10\n\n    arg_13, arg_14 = f_ratios(arg_0,arg_1,arg_12,**arg_7)\n\n    #Obtain spectrum of the calibrator source for the given frequency range\n    arg_15 = get_centerfreqs(arg_9,arg_12)\n    arg_16 = get_calfluxes(arg_2,arg_3,arg_4,arg_15,arg_6)\n\n    #C_o and Tsys as defined in van Straten et al. 2012\n    arg_17 = arg_16/(1/arg_13-1/arg_14)\n    arg_18 = arg_17/arg_14\n\n    #return coarse channel diode spectrum\n    if arg_5==True:\n        return np.mean(arg_17),np.mean(arg_18)\n    else:\n        return arg_17,arg_18", "path": "blimpy/calib_utils/fluxcal.py", "identifier": "diode_spec", "docstring": "Calculate the coarse channel spectrum and system temperature of the noise diode in Jy given two noise diode\n    measurements ON and OFF the calibrator source with the same frequency and time resolution\n\n    Parameters\n    ----------\n    calON_obs : str\n        (see f_ratios() above)\n    calOFF_obs : str\n        (see f_ratios() above)\n    calflux : float\n        Known flux of calibrator source at a particular frequency\n    calfreq : float\n        Frequency where calibrator source has flux calflux (see above)\n    spec_in : float\n        Known power-law spectral index of calibrator source. Use convention flux(frequency) = constant * frequency^(spec_in)\n    average : boolean\n        Use average=True to return noise diode and Tsys spectra averaged over frequencies", "docstring_tokens": ["Calculate", "the", "coarse", "channel", "spectrum", "and", "system", "temperature", "of", "the", "noise", "diode", "in", "Jy", "given", "two", "noise", "diode", "measurements", "ON", "and", "OFF", "the", "calibrator", "source", "with", "the", "same", "frequency", "and", "time", "resolution"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 256464}
{"url": "https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/giraffez/config.py#L198-L223", "sha": "6b4d27eb1a1eaf188c6885c7364ef27e92b1b957", "docstring_summary": "Retrieve a value from the configuration based on its key. The key\n        may be nested.", "language": "python", "parameters": "(self, key, default={}, nested=True, decrypt=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "True", ",", "arg_4", "=", "True", ")", ":", "arg_1", "=", "arg_1", ".", "lstrip", "(", ")", "if", "arg_1", ".", "endswith", "(", "\".\"", ")", ":", "arg_1", "=", "arg_1", "[", ":", "-", "1", "]", "if", "arg_3", ":", "arg_5", "=", "arg_1", ".", "split", "(", "\".\"", ")", "arg_6", "=", "arg_0", ".", "settings", "for", "arg_7", "in", "arg_5", "[", ":", "-", "1", "]", ":", "arg_6", "=", "arg_6", ".", "get", "(", "arg_7", ",", "{", "}", ")", "try", ":", "arg_8", "=", "arg_6", "[", "arg_5", "[", "-", "1", "]", "]", "except", "KeyError", ":", "return", "arg_2", "arg_8", "=", "arg_0", ".", "decrypt", "(", "arg_8", ",", "arg_5", ")", "return", "arg_8", "else", ":", "return", "arg_0", ".", "settings", ".", "get", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}, arg_3=True, arg_4=True):\n        \"\"\"\n        Retrieve a value from the configuration based on its key. The key\n        may be nested.\n\n        :param str key: A path to the value, with nested levels joined by '.'\n        :param default: Value to return if the key does not exist (defaults to :code:`dict()`)\n        :param bool decrypt: If :code:`True`, decrypt an encrypted value before returning\n            (if encrypted).  Defaults to :code:`True`.\n        \"\"\"\n        arg_1 = arg_1.lstrip()\n        if arg_1.endswith(\".\"):\n            arg_1 = arg_1[:-1]\n        if arg_3:\n            arg_5 = arg_1.split(\".\")\n            arg_6 = arg_0.settings\n            for arg_7 in arg_5[:-1]:\n                arg_6 = arg_6.get(arg_7, {})\n            try:\n                arg_8 = arg_6[arg_5[-1]]\n            except KeyError:\n                return arg_2\n            arg_8 = arg_0.decrypt(arg_8, arg_5)\n            return arg_8\n        else:\n            return arg_0.settings.get(arg_1, arg_2)", "path": "giraffez/config.py", "identifier": "Config.get_value", "docstring": "Retrieve a value from the configuration based on its key. The key\n        may be nested.\n\n        :param str key: A path to the value, with nested levels joined by '.'\n        :param default: Value to return if the key does not exist (defaults to :code:`dict()`)\n        :param bool decrypt: If :code:`True`, decrypt an encrypted value before returning\n            (if encrypted).  Defaults to :code:`True`.", "docstring_tokens": ["Retrieve", "a", "value", "from", "the", "configuration", "based", "on", "its", "key", ".", "The", "key", "may", "be", "nested", "."], "nwo": "capitalone/giraffez", "score": 0.19842634881568408, "idx": 256465}
{"url": "https://github.com/blockstack/zone-file-py/blob/c1078c8c3c28f0881bc9a3af53d4972c4a6862d0/blockstack_zones/parse_zone_file.py#L295-L359", "sha": "c1078c8c3c28f0881bc9a3af53d4972c4a6862d0", "docstring_summary": "Given the parser, capitalized list of a line's tokens, and the current set of records \n    parsed so far, parse it into a dictionary.", "language": "python", "parameters": "(parser, record_token, parsed_records)", "return_statement": "return parsed_records", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "global", "SUPPORTED_RECORDS", "arg_3", "=", "\" \"", ".", "join", "(", "arg_1", ")", "if", "len", "(", "arg_1", ")", ">=", "2", "and", "arg_1", "[", "1", "]", "in", "SUPPORTED_RECORDS", ":", "arg_1", "=", "[", "arg_1", "[", "1", "]", "]", "+", "arg_1", "elif", "len", "(", "arg_1", ")", ">=", "3", "and", "arg_1", "[", "2", "]", "in", "SUPPORTED_RECORDS", ":", "arg_1", "=", "[", "arg_1", "[", "2", "]", "]", "+", "arg_1", "if", "arg_1", "[", "0", "]", "==", "\"TXT\"", ":", "arg_1", "=", "arg_1", "[", ":", "2", "]", "+", "[", "\"--ttl\"", "]", "+", "arg_1", "[", "2", ":", "]", "try", ":", "arg_4", ",", "arg_5", "=", "arg_0", ".", "parse_known_args", "(", "arg_1", ")", "assert", "len", "(", "arg_5", ")", "==", "0", ",", "\"Unmatched fields: %s\"", "%", "arg_5", "except", "(", "SystemExit", ",", "AssertionError", ",", "InvalidLineException", ")", ":", "raise", "InvalidLineException", "(", "arg_3", ")", "arg_6", "=", "arg_4", ".", "__dict__", "if", "arg_1", "[", "0", "]", "==", "\"TXT\"", "and", "len", "(", "arg_6", "[", "'txt'", "]", ")", "==", "1", ":", "arg_6", "[", "'txt'", "]", "=", "arg_6", "[", "'txt'", "]", "[", "0", "]", "arg_7", "=", "None", "for", "arg_8", "in", "arg_6", ".", "keys", "(", ")", ":", "if", "arg_8", "in", "SUPPORTED_RECORDS", "and", "(", "arg_8", ".", "startswith", "(", "\"$\"", ")", "or", "arg_6", "[", "arg_8", "]", "==", "arg_8", ")", ":", "arg_7", "=", "arg_8", "if", "arg_6", "[", "arg_8", "]", "==", "arg_8", ":", "del", "arg_6", "[", "arg_8", "]", "break", "assert", "arg_7", "is", "not", "None", ",", "\"Unknown record type in %s\"", "%", "arg_4", "for", "arg_9", "in", "arg_6", ".", "keys", "(", ")", ":", "if", "arg_6", "[", "arg_9", "]", "is", "None", ":", "del", "arg_6", "[", "arg_9", "]", "arg_10", "=", "arg_6", ".", "get", "(", "'$ORIGIN'", ",", "arg_2", ".", "get", "(", "'$ORIGIN'", ",", "None", ")", ")", "if", "arg_7", "==", "'PTR'", ":", "arg_6", "[", "'fullname'", "]", "=", "arg_6", "[", "'name'", "]", "+", "'.'", "+", "arg_10", "if", "len", "(", "arg_6", ")", ">", "0", ":", "if", "arg_7", ".", "startswith", "(", "\"$\"", ")", ":", "arg_11", "=", "arg_7", ".", "lower", "(", ")", "arg_2", "[", "arg_11", "]", "=", "arg_6", "[", "arg_7", "]", "else", ":", "arg_11", "=", "arg_7", ".", "lower", "(", ")", "arg_2", "[", "arg_11", "]", ".", "append", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Given the parser, capitalized list of a line's tokens, and the current set of records \n    parsed so far, parse it into a dictionary.\n\n    Return the new set of parsed records.\n    Raise an exception on error.\n    \"\"\"\n\n    global SUPPORTED_RECORDS\n\n    arg_3 = \" \".join(arg_1)\n\n    # match parser to record type\n    if len(arg_1) >= 2 and arg_1[1] in SUPPORTED_RECORDS:\n        # with no ttl\n        arg_1 = [arg_1[1]] + arg_1\n    elif len(arg_1) >= 3 and arg_1[2] in SUPPORTED_RECORDS:\n        # with ttl\n        arg_1 = [arg_1[2]] + arg_1\n        if arg_1[0] == \"TXT\":\n            arg_1 = arg_1[:2] + [\"--ttl\"] + arg_1[2:]\n    try:\n        arg_4, arg_5 = arg_0.parse_known_args(arg_1)\n        assert len(arg_5) == 0, \"Unmatched fields: %s\" % arg_5\n    except (SystemExit, AssertionError, InvalidLineException):\n        # invalid argument \n        raise InvalidLineException(arg_3)\n\n    arg_6 = arg_4.__dict__\n    if arg_1[0] == \"TXT\" and len(arg_6['txt']) == 1:\n        arg_6['txt'] = arg_6['txt'][0]\n\n    # what kind of record? including origin and ttl\n    arg_7 = None\n    for arg_8 in arg_6.keys():\n        if arg_8 in SUPPORTED_RECORDS and (arg_8.startswith(\"$\") or arg_6[arg_8] == arg_8):\n            arg_7 = arg_8\n            if arg_6[arg_8] == arg_8:\n                del arg_6[arg_8]\n            break\n\n    assert arg_7 is not None, \"Unknown record type in %s\" % arg_4\n\n    # clean fields\n    for arg_9 in arg_6.keys():\n        if arg_6[arg_9] is None:\n            del arg_6[arg_9]\n\n    arg_10 = arg_6.get('$ORIGIN', arg_2.get('$ORIGIN', None))\n\n    # special record-specific fix-ups\n    if arg_7 == 'PTR':\n        arg_6['fullname'] = arg_6['name'] + '.' + arg_10\n      \n    if len(arg_6) > 0:\n        if arg_7.startswith(\"$\"):\n            # put the value directly\n            arg_11 = arg_7.lower()\n            arg_2[arg_11] = arg_6[arg_7]\n        else:\n            arg_11 = arg_7.lower()\n            arg_2[arg_11].append(arg_6)\n\n    return arg_2", "path": "blockstack_zones/parse_zone_file.py", "identifier": "parse_line", "docstring": "Given the parser, capitalized list of a line's tokens, and the current set of records \n    parsed so far, parse it into a dictionary.\n\n    Return the new set of parsed records.\n    Raise an exception on error.", "docstring_tokens": ["Given", "the", "parser", "capitalized", "list", "of", "a", "line", "s", "tokens", "and", "the", "current", "set", "of", "records", "parsed", "so", "far", "parse", "it", "into", "a", "dictionary", "."], "nwo": "blockstack/zone-file-py", "score": 0.4104459992179242, "idx": 256466}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/integrations/managers.py#L7-L14", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Return settings for given integration as a dictionary.", "language": "python", "parameters": "(self, integration_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "get", "(", "arg_1", "=", "arg_1", ")", "return", "json", ".", "loads", "(", "arg_2", ".", "settings", ")", "except", "(", "arg_0", ".", "model", ".", "DoesNotExist", ",", "ValueError", ")", ":", "return", "{", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return settings for given integration as a dictionary.\"\"\"\n\n        try:\n            arg_2 = arg_0.get(arg_1=arg_1)\n            return json.loads(arg_2.settings)\n        except (arg_0.model.DoesNotExist, ValueError):\n            return {}", "path": "dispatch/modules/integrations/managers.py", "identifier": "IntegrationManager.get_settings", "docstring": "Return settings for given integration as a dictionary.", "docstring_tokens": ["Return", "settings", "for", "given", "integration", "as", "a", "dictionary", "."], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 256467}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/bip38.py#L83-L125", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "BIP0038 non-ec-multiply decryption. Returns WIF privkey.", "language": "python", "parameters": "(encrypted_privkey, passphrase)", "return_statement": "return wif", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "unhexlify", "(", "base58decode", "(", "arg_0", ")", ")", "arg_2", "=", "arg_2", "[", "2", ":", "]", "arg_3", "=", "arg_2", "[", "0", ":", "1", "]", "arg_2", "=", "arg_2", "[", "1", ":", "]", "assert", "arg_3", "==", "b\"\\xc0\"", ",", "\"Flagbyte has to be 0xc0\"", "arg_4", "=", "arg_2", "[", "0", ":", "4", "]", "arg_2", "=", "arg_2", "[", "4", ":", "-", "4", "]", "if", "SCRYPT_MODULE", "==", "\"scrypt\"", ":", "arg_5", "=", "scrypt", ".", "hash", "(", "arg_1", ",", "arg_4", ",", "16384", ",", "8", ",", "8", ")", "elif", "SCRYPT_MODULE", "==", "\"pylibscrypt\"", ":", "arg_5", "=", "scrypt", ".", "scrypt", "(", "bytes", "(", "arg_1", ",", "\"utf-8\"", ")", ",", "arg_4", ",", "16384", ",", "8", ",", "8", ")", "else", ":", "raise", "ValueError", "(", "\"No scrypt module loaded\"", ")", "arg_6", "=", "arg_5", "[", "0", ":", "32", "]", "arg_7", "=", "arg_5", "[", "32", ":", "64", "]", "arg_8", "=", "arg_2", "[", "0", ":", "16", "]", "arg_9", "=", "arg_2", "[", "16", ":", "32", "]", "arg_10", "=", "AES", ".", "new", "(", "arg_7", ",", "AES", ".", "MODE_ECB", ")", "arg_11", "=", "arg_10", ".", "Func", "(", "arg_9", ")", "arg_12", "=", "arg_10", ".", "Func", "(", "arg_8", ")", "arg_13", "=", "arg_12", "+", "arg_11", "arg_13", "=", "\"%064x\"", "%", "(", "int", "(", "hexlify", "(", "arg_13", ")", ",", "16", ")", "^", "int", "(", "hexlify", "(", "arg_6", ")", ",", "16", ")", ")", "arg_14", "=", "Base58", "(", "arg_13", ")", "arg_15", "=", "PrivateKey", "(", "format", "(", "arg_14", ",", "\"wif\"", ")", ")", "arg_16", "=", "format", "(", "arg_15", ".", "bitcoin", ".", "address", ",", "\"BTC\"", ")", "arg_17", "=", "_bytes", "(", "arg_16", ")", "arg_18", "=", "hashlib", ".", "sha256", "(", "hashlib", ".", "sha256", "(", "arg_17", ")", ".", "digest", "(", ")", ")", ".", "digest", "(", ")", "[", "0", ":", "4", "]", "if", "arg_18", "!=", "arg_4", ":", "raise", "SaltException", "(", "\"checksum verification failed! Password may be incorrect.\"", ")", "return", "arg_14"], "function": "def Func(arg_0, arg_1):\n    \"\"\"BIP0038 non-ec-multiply Funcion. Returns WIF privkey.\n\n    :param Base58 encrypted_privkey: Private key\n    :param str passphrase: UTF-8 encoded passphrase for Funcion\n    :return: BIP0038 non-ec-multiply Funced key\n    :rtype: Base58\n    :raises SaltException: if checksum verification failed (e.g. wrong\n        password)\n\n    \"\"\"\n\n    arg_2 = unhexlify(base58decode(arg_0))\n    arg_2 = arg_2[2:]  # remove trailing 0x01 and 0x42\n    arg_3 = arg_2[0:1]  # get flag byte\n    arg_2 = arg_2[1:]  # get payload\n    assert arg_3 == b\"\\xc0\", \"Flagbyte has to be 0xc0\"\n    arg_4 = arg_2[0:4]\n    arg_2 = arg_2[4:-4]\n    if SCRYPT_MODULE == \"scrypt\":  # pragma: no cover\n        arg_5 = scrypt.hash(arg_1, arg_4, 16384, 8, 8)\n    elif SCRYPT_MODULE == \"pylibscrypt\":  # pragma: no cover\n        arg_5 = scrypt.scrypt(bytes(arg_1, \"utf-8\"), arg_4, 16384, 8, 8)\n    else:\n        raise ValueError(\"No scrypt module loaded\")  # pragma: no cover\n    arg_6 = arg_5[0:32]\n    arg_7 = arg_5[32:64]\n    arg_8 = arg_2[0:16]\n    arg_9 = arg_2[16:32]\n    arg_10 = AES.new(arg_7, AES.MODE_ECB)\n    arg_11 = arg_10.Func(arg_9)\n    arg_12 = arg_10.Func(arg_8)\n    arg_13 = arg_12 + arg_11\n    arg_13 = \"%064x\" % (int(hexlify(arg_13), 16) ^ int(hexlify(arg_6), 16))\n    arg_14 = Base58(arg_13)\n    \"\"\" Verify Salt \"\"\"\n    arg_15 = PrivateKey(format(arg_14, \"wif\"))\n    arg_16 = format(arg_15.bitcoin.address, \"BTC\")\n    arg_17 = _bytes(arg_16)\n    arg_18 = hashlib.sha256(hashlib.sha256(arg_17).digest()).digest()[0:4]\n    if arg_18 != arg_4:  # pragma: no cover\n        raise SaltException(\"checksum verification failed! Password may be incorrect.\")\n    return arg_14", "path": "graphenebase/bip38.py", "identifier": "decrypt", "docstring": "BIP0038 non-ec-multiply decryption. Returns WIF privkey.\n\n    :param Base58 encrypted_privkey: Private key\n    :param str passphrase: UTF-8 encoded passphrase for decryption\n    :return: BIP0038 non-ec-multiply decrypted key\n    :rtype: Base58\n    :raises SaltException: if checksum verification failed (e.g. wrong\n        password)", "docstring_tokens": ["BIP0038", "non", "-", "ec", "-", "multiply", "decryption", ".", "Returns", "WIF", "privkey", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 256468}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L521-L523", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Convert a netmask to another notation.", "language": "python", "parameters": "(nm, notation=IP_DOT, inotation=IP_UNKNOWN, check=True)", "return_statement": "return _convert(nm, notation, inotation, _check=check, _isnm=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "True", ")", ":", "return", "_convert", "(", "arg_0", ",", "arg_1", ",", "arg_3", ",", "_check", "=", "arg_5", ",", "_isnm", "=", "True", ")"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=arg_4, arg_5=True):\n    \"\"\"Convert a netmask to another notation.\"\"\"\n    return _convert(arg_0, arg_1, arg_3, _check=arg_5, _isnm=True)", "path": "iplib.py", "identifier": "convert_nm", "docstring": "Convert a netmask to another notation.", "docstring_tokens": ["Convert", "a", "netmask", "to", "another", "notation", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 256469}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/clifns.py#L40-L48", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Given a file name, extract the most likely module name.", "language": "python", "parameters": "(filename)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "osp", ".", "basename", "(", "arg_0", ")", "if", "'.'", "in", "arg_1", ":", "arg_2", "=", "arg_1", ".", "rfind", "(", "'.'", ")", "return", "arg_1", "[", ":", "arg_2", "]", "else", ":", "return", "arg_1", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"Given a file name, extract the most likely module name. \"\"\"\n    arg_1 = osp.basename(arg_0)\n    if '.' in arg_1:\n        arg_2 = arg_1.rfind('.')\n        return arg_1[:arg_2]\n    else:\n        return arg_1\n    return None", "path": "trepan/clifns.py", "identifier": "file2module", "docstring": "Given a file name, extract the most likely module name.", "docstring_tokens": ["Given", "a", "file", "name", "extract", "the", "most", "likely", "module", "name", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 256470}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/check_has_context.py#L80-L93", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "When dispatched on with statements, has_context loops over each context manager.", "language": "python", "parameters": "(state, incorrect_msg, exact_names)", "return_statement": "return state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "range", "(", "len", "(", "arg_0", ".", "solution_parts", "[", "\"context\"", "]", ")", ")", ":", "arg_4", "=", "check_part_index", "(", "arg_0", ",", "\"context\"", ",", "arg_3", ",", "\"{{ordinal}} context\"", ")", "_has_context", "(", "arg_4", ",", "arg_1", "or", "MSG_INCORRECT_WITH", ",", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"When dispatched on with statements, has_context loops over each context manager.\n\n    Note: This is to allow people to call has_context on the with statement, rather than\n          having to manually loop over each context manager.\n\n          e.g. Ex().check_with(0).has_context() vs Ex().check_with(0).check_context(0).has_context()\n    \"\"\"\n\n    for arg_3 in range(len(arg_0.solution_parts[\"context\"])):\n        arg_4 = check_part_index(arg_0, \"context\", arg_3, \"{{ordinal}} context\")\n        _has_context(arg_4, arg_1 or MSG_INCORRECT_WITH, arg_2)\n\n    return arg_0", "path": "pythonwhat/checks/check_has_context.py", "identifier": "has_context_with", "docstring": "When dispatched on with statements, has_context loops over each context manager.\n\n    Note: This is to allow people to call has_context on the with statement, rather than\n          having to manually loop over each context manager.\n\n          e.g. Ex().check_with(0).has_context() vs Ex().check_with(0).check_context(0).has_context()", "docstring_tokens": ["When", "dispatched", "on", "with", "statements", "has_context", "loops", "over", "each", "context", "manager", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 256471}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/__init__.py#L69-L85", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Changes a setting value.", "language": "python", "parameters": "(self, name, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "Functings", ".", "get", "(", "'pyconfig.case_sensitive'", ",", "False", ")", ":", "arg_1", "=", "arg_1", ".", "lower", "(", ")", "log", ".", "info", "(", "\"    %s = %s\"", ",", "arg_1", ",", "repr", "(", "arg_2", ")", ")", "with", "arg_0", ".", "mut_lock", ":", "arg_0", ".", "Functings", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Changes a Functing value.\n\n            This implements a locking mechanism to ensure some level of thread\n            safety.\n\n            :param str name: Setting key name.\n            :param value: Setting value.\n\n        \"\"\"\n        if not arg_0.Functings.get('pyconfig.case_sensitive', False):\n            arg_1 = arg_1.lower()\n        log.info(\"    %s = %s\", arg_1, repr(arg_2))\n\n        # Acquire our lock to change the config\n        with arg_0.mut_lock:\n            arg_0.Functings[arg_1] = arg_2", "path": "pyconfig/__init__.py", "identifier": "Config.set", "docstring": "Changes a setting value.\n\n            This implements a locking mechanism to ensure some level of thread\n            safety.\n\n            :param str name: Setting key name.\n            :param value: Setting value.", "docstring_tokens": ["Changes", "a", "setting", "value", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 256472}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/acts/basic.py#L56-L99", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Perform house-keeping.", "language": "python", "parameters": "(_dummy_ctx, docs=False, backups=False, bytecode=False, dist=False, # pylint: disable=redefined-outer-name\n        all=False, venv=False, tox=False, extra='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ",", "arg_8", "=", "''", ")", ":", "arg_9", "=", "config", ".", "load", "(", ")", "notify", ".", "banner", "(", "\"Cleaning up project files\"", ")", "arg_10", "=", "[", "'bin'", ",", "'include'", ",", "'lib'", ",", "'share'", ",", "'local'", ",", "'.venv'", "]", "arg_11", "=", "[", "'build/'", ",", "'pip-selfcheck.json'", "]", "arg_12", "=", "[", "'.git/'", ",", "'.hg/'", ",", "'.svn/'", ",", "'debian/*/'", "]", "if", "arg_1", "or", "arg_5", ":", "arg_11", ".", "extend", "(", "[", "'docs/_build/'", ",", "'doc/_build/'", "]", ")", "if", "arg_4", "or", "arg_5", ":", "arg_11", ".", "append", "(", "'dist/'", ")", "if", "arg_2", "or", "arg_5", ":", "arg_11", ".", "extend", "(", "[", "'**/*~'", "]", ")", "if", "arg_3", "or", "arg_5", ":", "arg_11", ".", "extend", "(", "[", "'**/*.py[co]'", ",", "'**/__pycache__/'", ",", "'*.egg-info/'", ",", "arg_9", ".", "srcjoin", "(", "'*.egg-info/'", ")", "[", "len", "(", "arg_9", ".", "project_root", ")", "+", "1", ":", "]", ",", "]", ")", "if", "arg_6", ":", "arg_11", ".", "extend", "(", "[", "arg_13", "+", "'/'", "for", "arg_13", "in", "arg_10", "]", ")", "if", "arg_7", ":", "arg_11", ".", "append", "(", "'.tox/'", ")", "else", ":", "arg_12", ".", "append", "(", "'.tox/'", ")", "if", "arg_8", ":", "arg_11", ".", "extend", "(", "shlex", ".", "split", "(", "arg_8", ")", ")", "arg_11", "=", "[", "antglob", ".", "includes", "(", "arg_13", ")", "for", "arg_13", "in", "arg_11", "]", "+", "[", "antglob", ".", "excludes", "(", "arg_13", ")", "for", "arg_13", "in", "arg_12", "]", "if", "not", "arg_6", ":", "arg_11", ".", "extend", "(", "[", "antglob", ".", "excludes", "(", "arg_13", "+", "'/'", ")", "for", "arg_13", "in", "arg_10", "]", ")", "arg_14", "=", "antglob", ".", "FileSet", "(", "arg_9", ".", "project_root", ",", "arg_11", ")", "for", "arg_15", "in", "arg_14", ":", "notify", ".", "info", "(", "'rm {0}'", ".", "format", "(", "arg_15", ")", ")", "if", "arg_15", ".", "endswith", "(", "'/'", ")", ":", "shutil", ".", "rmtree", "(", "os", ".", "path", ".", "join", "(", "arg_9", ".", "project_root", ",", "arg_15", ")", ")", "else", ":", "os", ".", "unlink", "(", "os", ".", "path", ".", "join", "(", "arg_9", ".", "project_root", ",", "arg_15", ")", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=False, arg_3=False, arg_4=False, # pylint: disable=redefined-outer-name\n        arg_5=False, arg_6=False, arg_7=False, arg_8=''): # pylint: disable=redefined-builtin\n    \"\"\"Perform house-keeping.\"\"\"\n    arg_9 = config.load()\n    notify.banner(\"Cleaning up project files\")\n\n    # Add patterns based on given parameters\n    arg_10 = ['bin', 'include', 'lib', 'share', 'local', '.venv']\n    arg_11 = ['build/', 'pip-selfcheck.json']\n    arg_12 = ['.git/', '.hg/', '.svn/', 'debian/*/']\n    if arg_1 or arg_5:\n        arg_11.extend(['docs/_build/', 'doc/_build/'])\n    if arg_4 or arg_5:\n        arg_11.append('dist/')\n    if arg_2 or arg_5:\n        arg_11.extend(['**/*~'])\n    if arg_3 or arg_5:\n        arg_11.extend([\n            '**/*.py[co]', '**/__pycache__/', '*.egg-info/',\n            arg_9.srcjoin('*.egg-info/')[len(arg_9.project_root)+1:],\n        ])\n    if arg_6:\n        arg_11.extend([arg_13 + '/' for arg_13 in arg_10])\n    if arg_7:\n        arg_11.append('.tox/')\n    else:\n        arg_12.append('.tox/')\n    if arg_8:\n        arg_11.extend(shlex.split(arg_8))\n\n    # Build fileset\n    arg_11 = [antglob.includes(arg_13) for arg_13 in arg_11] + [antglob.excludes(arg_13) for arg_13 in arg_12]\n    if not arg_6:\n        # Do not scan venv dirs when not Funcing them\n        arg_11.extend([antglob.excludes(arg_13 + '/') for arg_13 in arg_10])\n    arg_14 = antglob.FileSet(arg_9.project_root, arg_11)\n\n    # Iterate over matches and remove them\n    for arg_15 in arg_14:\n        notify.info('rm {0}'.format(arg_15))\n        if arg_15.endswith('/'):\n            shutil.rmtree(os.path.join(arg_9.project_root, arg_15))\n        else:\n            os.unlink(os.path.join(arg_9.project_root, arg_15))", "path": "src/rituals/acts/basic.py", "identifier": "clean", "docstring": "Perform house-keeping.", "docstring_tokens": ["Perform", "house", "-", "keeping", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 256473}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/services.py#L947-L957", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "Marks a function as having been published and causes all invocations to go to the remote\noperationalized service.", "language": "python", "parameters": "(url, api_key, help_url = None)", "return_statement": "return do_publish", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "def", "do_publish", "(", "arg_3", ")", ":", "return", "published", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "None", ")", "return", "do_publish"], "function": "def Func(arg_0, arg_1, arg_2 = None):\n    '''Marks a function as having been published and causes all invocations to go to the remote\noperationalized Func.\n\n>>> @Func(url, api_key)\n>>> def f(a, b):\n>>>     pass\n'''\n    def do_publish(arg_3):\n        return published(arg_0, arg_1, arg_2, arg_3, None)\n    return do_publish", "path": "azureml/services.py", "identifier": "service", "docstring": "Marks a function as having been published and causes all invocations to go to the remote\noperationalized service.\n\n>>> @service(url, api_key)\n>>> def f(a, b):\n>>>     pass", "docstring_tokens": ["Marks", "a", "function", "as", "having", "been", "published", "and", "causes", "all", "invocations", "to", "go", "to", "the", "remote", "operationalized", "service", "."], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 256474}
{"url": "https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L163-L166", "sha": "86dc1ab27ce82dcc091ce127416cc3ee219e9bec", "docstring_summary": "Calculates sha512 fingerprint.", "language": "python", "parameters": "(self)", "return_statement": "return (b\"SHA512:\" + base64.b64encode(fp_plain).replace(b\"=\", b\"\")).decode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "hashlib", ".", "sha512", "(", "arg_0", ".", "_decoded_key", ")", ".", "digest", "(", ")", "return", "(", "b\"SHA512:\"", "+", "base64", ".", "b64encode", "(", "arg_1", ")", ".", "replace", "(", "b\"=\"", ",", "b\"\"", ")", ")", ".", "decode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Calculates sha512 fingerprint.\"\"\"\n        arg_1 = hashlib.sha512(arg_0._decoded_key).digest()\n        return (b\"SHA512:\" + base64.b64encode(arg_1).replace(b\"=\", b\"\")).decode(\"utf-8\")", "path": "sshpubkeys/keys.py", "identifier": "SSHKey.hash_sha512", "docstring": "Calculates sha512 fingerprint.", "docstring_tokens": ["Calculates", "sha512", "fingerprint", "."], "nwo": "ojarva/python-sshpubkeys", "score": 0.19584428074165744, "idx": 256475}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/_http/httpclient.py#L90-L110", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Create connection for the request.", "language": "python", "parameters": "(self, request)", "return_statement": "return connection", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "protocol_override", "if", "arg_1", ".", "protocol_override", "else", "arg_0", ".", "protocol", "arg_2", "=", "arg_2", ".", "lower", "(", ")", "arg_3", "=", "arg_1", ".", "host", "arg_4", "=", "_RequestsConnection", "(", "arg_3", ",", "arg_2", ",", "arg_0", ".", "request_session", ",", "arg_0", ".", "timeout", ")", "arg_5", "=", "arg_0", ".", "proxy_host", "arg_6", "=", "arg_0", ".", "proxy_port", "if", "arg_0", ".", "proxy_host", ":", "arg_7", "=", "None", "if", "arg_0", ".", "proxy_user", "and", "arg_0", ".", "proxy_password", ":", "arg_8", "=", "base64", ".", "b64encode", "(", "\"{0}:{1}\"", ".", "format", "(", "arg_0", ".", "proxy_user", ",", "arg_0", ".", "proxy_password", ")", ".", "encode", "(", ")", ")", "arg_7", "=", "{", "'Proxy-Authorization'", ":", "'Basic {0}'", ".", "format", "(", "arg_8", ".", "decode", "(", ")", ")", "}", "arg_4", ".", "set_tunnel", "(", "arg_5", ",", "int", "(", "arg_6", ")", ",", "arg_7", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        ''' Create connection for the request. '''\n        arg_2 = arg_1.protocol_override \\\n            if arg_1.protocol_override else arg_0.protocol\n        arg_2 = arg_2.lower()\n        arg_3 = arg_1.host\n        # target_port = HTTP_PORT if protocol == 'http' else HTTPS_PORT\n\n        arg_4 = _RequestsConnection(\n            arg_3, arg_2, arg_0.request_session, arg_0.timeout)\n        arg_5 = arg_0.proxy_host\n        arg_6 = arg_0.proxy_port\n\n        if arg_0.proxy_host:\n            arg_7 = None\n            if arg_0.proxy_user and arg_0.proxy_password:\n                arg_8 = base64.b64encode(\"{0}:{1}\".format(arg_0.proxy_user, arg_0.proxy_password).encode())\n                arg_7 = {'Proxy-Authorization': 'Basic {0}'.format(arg_8.decode())}\n            arg_4.set_tunnel(arg_5, int(arg_6), arg_7)\n\n        return arg_4", "path": "azure-servicebus/azure/servicebus/control_client/_http/httpclient.py", "identifier": "_HTTPClient.get_connection", "docstring": "Create connection for the request.", "docstring_tokens": ["Create", "connection", "for", "the", "request", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256476}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1092-L1101", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Returns list of the predecessors of a node that are\n        connected by a quantum edge as DAGNodes.", "language": "python", "parameters": "(self, node)", "return_statement": "return predecessors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "predecessors", "(", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ".", "_multi_graph", ".", "get_edge_data", "(", "arg_3", ",", "arg_1", ",", "key", "=", "0", ")", "[", "'wire'", "]", "[", "0", "]", ",", "QuantumRegister", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns list of the predecessors of a node that are\n        connected by a quantum edge as DAGNodes.\"\"\"\n\n        arg_2 = []\n        for arg_3 in arg_0.predecessors(arg_1):\n            if isinstance(arg_0._multi_graph.get_edge_data(arg_3, arg_1, key=0)['wire'][0],\n                          QuantumRegister):\n                arg_2.append(arg_3)\n        return arg_2", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.quantum_predecessors", "docstring": "Returns list of the predecessors of a node that are\n        connected by a quantum edge as DAGNodes.", "docstring_tokens": ["Returns", "list", "of", "the", "predecessors", "of", "a", "node", "that", "are", "connected", "by", "a", "quantum", "edge", "as", "DAGNodes", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256477}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/playlist.py#L40-L49", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "get the track object for each link in the partial tracks data", "language": "python", "parameters": "(self)", "return_statement": "return list(PlaylistTrack(self.__client, track) for track in data['items'])", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "await", "arg_0", ".", "__func", "(", ")", "return", "list", "(", "PlaylistTrack", "(", "arg_0", ".", "__client", ",", "arg_2", ")", "for", "arg_2", "in", "arg_1", "[", "'items'", "]", ")"], "function": "async def Func(arg_0):\n        \"\"\"get the track object for each link in the partial tracks data\n\n        Returns\n        -------\n        tracks : List[Track]\n            The tracks\n        \"\"\"\n        arg_1 = await arg_0.__func()\n        return list(PlaylistTrack(arg_0.__client, arg_2) for arg_2 in arg_1['items'])", "path": "spotify/models/playlist.py", "identifier": "PartialTracks.build", "docstring": "get the track object for each link in the partial tracks data\n\n        Returns\n        -------\n        tracks : List[Track]\n            The tracks", "docstring_tokens": ["get", "the", "track", "object", "for", "each", "link", "in", "the", "partial", "tracks", "data"], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 256478}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/util.py#L181-L193", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "Tries to get the _conn attribute from a model. Barring that, gets the\n    global default connection using other methods.", "language": "python", "parameters": "(obj)", "return_statement": "return get_connection()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", ".", "columns", "import", "MODELS", "if", "isinstance", "(", "arg_0", ",", "MODELS", "[", "'Model'", "]", ")", ":", "arg_0", "=", "arg_0", ".", "__class__", "if", "hasattr", "(", "arg_0", ",", "'_conn'", ")", ":", "return", "arg_0", ".", "_conn", "if", "hasattr", "(", "arg_0", ",", "'CONN'", ")", ":", "return", "arg_0", ".", "CONN", "return", "getFuncion", "(", ")"], "function": "def Func(arg_0):\n    '''\n    Tries to get the _conn attribute from a model. Barring that, gets the\n    global default connection using other methods.\n    '''\n    from .columns import MODELS\n    if isinstance(arg_0, MODELS['Model']):\n        arg_0 = arg_0.__class__\n    if hasattr(arg_0, '_conn'):\n        return arg_0._conn\n    if hasattr(arg_0, 'CONN'):\n        return arg_0.CONN\n    return getFuncion()", "path": "rom/util.py", "identifier": "_connect", "docstring": "Tries to get the _conn attribute from a model. Barring that, gets the\n    global default connection using other methods.", "docstring_tokens": ["Tries", "to", "get", "the", "_conn", "attribute", "from", "a", "model", ".", "Barring", "that", "gets", "the", "global", "default", "connection", "using", "other", "methods", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 256479}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcdb.py#L329-L358", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This creates a DB cursor for the current DB connection using a\n        randomly generated handle. Returns a tuple with cursor and handle.", "language": "python", "parameters": "(self, dictcursor=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "hashlib", ".", "sha256", "(", "os", ".", "urandom", "(", "12", ")", ")", ".", "hexdigest", "(", ")", "if", "arg_1", ":", "arg_0", ".", "cursors", "[", "arg_2", "]", "=", "arg_0", ".", "connection", ".", "cursor", "(", "cursor_factory", "=", "psycopg2", ".", "extras", ".", "DictCursor", ")", "else", ":", "arg_0", ".", "cursors", "[", "arg_2", "]", "=", "arg_0", ".", "connection", ".", "cursor", "(", ")", "return", "(", "arg_0", ".", "cursors", "[", "arg_2", "]", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False):\n        '''\n        This creates a DB cursor for the current DB connection using a\n        randomly generated handle. Returns a tuple with cursor and handle.\n\n        Parameters\n        ----------\n\n        dictcursor : bool\n            If True, returns a cursor where each returned row can be addressed\n            as a dictionary by column name.\n\n        Returns\n        -------\n\n        tuple\n            The tuple is of the form (handle, psycopg2.Cursor instance).\n\n        '''\n\n        arg_2 = hashlib.sha256(os.urandom(12)).hexdigest()\n\n        if arg_1:\n            arg_0.cursors[arg_2] = arg_0.connection.cursor(\n                cursor_factory=psycopg2.extras.DictCursor\n            )\n        else:\n            arg_0.cursors[arg_2] = arg_0.connection.cursor()\n\n            return (arg_0.cursors[arg_2], arg_2)", "path": "astrobase/lcdb.py", "identifier": "LCDB.newcursor", "docstring": "This creates a DB cursor for the current DB connection using a\n        randomly generated handle. Returns a tuple with cursor and handle.\n\n        Parameters\n        ----------\n\n        dictcursor : bool\n            If True, returns a cursor where each returned row can be addressed\n            as a dictionary by column name.\n\n        Returns\n        -------\n\n        tuple\n            The tuple is of the form (handle, psycopg2.Cursor instance).", "docstring_tokens": ["This", "creates", "a", "DB", "cursor", "for", "the", "current", "DB", "connection", "using", "a", "randomly", "generated", "handle", ".", "Returns", "a", "tuple", "with", "cursor", "and", "handle", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 256480}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/query.py#L240-L248", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "Query for null or blank field.", "language": "python", "parameters": "(field=None)", "return_statement": "return (null_q | blank_q)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "not", "arg_0", ":", "return", "arg_0", "arg_1", "=", "get_null_query", "(", "arg_0", ")", "arg_2", "=", "get_blank_query", "(", "arg_0", ")", "return", "(", "arg_1", "|", "arg_2", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Query for null or blank field.\n    \"\"\"\n    if not arg_0:\n        return arg_0\n    arg_1 = get_null_query(arg_0)\n    arg_2 = get_blank_query(arg_0)\n    return (arg_1 | arg_2)", "path": "toolware/utils/query.py", "identifier": "get_null_or_blank_query", "docstring": "Query for null or blank field.", "docstring_tokens": ["Query", "for", "null", "or", "blank", "field", "."], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 256481}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/encrypt.py#L31-L47", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Encrypts context.io_manager's stdin and sends that to\n    context.io_manager's stdout.", "language": "python", "parameters": "(context, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "io_manager", ".", "with_stdout", "(", ")", "as", "stdout", ":", "with", "arg_0", ".", "io_manager", ".", "with_stdin", "(", ")", "as", "stdin", ":", "for", "arg_2", "in", "aes_encrypt", "(", "arg_1", ",", "stdin", ",", "preamble", "=", "AES256CBC", ")", ":", "stdout", ".", "write", "(", "arg_2", ")", "stdout", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Encrypts context.io_manager's stdin and sends that to\n    context.io_manager's stdout.\n\n    This can be useful to encrypt to disk before attempting to\n    upload, allowing uploads retries and segmented encrypted objects.\n\n    See :py:mod:`swiftly.cli.encrypt` for context usage information.\n\n    See :py:class:`CLIEncrypt` for more information.\n    \"\"\"\n    with arg_0.io_manager.with_stdout() as stdout:\n        with arg_0.io_manager.with_stdin() as stdin:\n            for arg_2 in aes_encrypt(arg_1, stdin, preamble=AES256CBC):\n                stdout.write(arg_2)\n            stdout.flush()", "path": "swiftly/cli/encrypt.py", "identifier": "cli_encrypt", "docstring": "Encrypts context.io_manager's stdin and sends that to\n    context.io_manager's stdout.\n\n    This can be useful to encrypt to disk before attempting to\n    upload, allowing uploads retries and segmented encrypted objects.\n\n    See :py:mod:`swiftly.cli.encrypt` for context usage information.\n\n    See :py:class:`CLIEncrypt` for more information.", "docstring_tokens": ["Encrypts", "context", ".", "io_manager", "s", "stdin", "and", "sends", "that", "to", "context", ".", "io_manager", "s", "stdout", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 256482}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_config.py#L104-L116", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Update msg attrs with values from the profile configuration if the\n    msg.attr=None, else leave it alone.", "language": "python", "parameters": "(msg, cfg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "__class__", ".", "__name__", ".", "lower", "(", ")", "for", "arg_3", "in", "arg_0", ":", "if", "getattr", "(", "arg_0", ",", "arg_3", ")", "is", "None", "and", "arg_3", "in", "arg_1", ".", "data", "[", "arg_0", ".", "profile", "]", "[", "arg_2", "]", ":", "setattr", "(", "arg_0", ",", "arg_3", ",", "arg_1", ".", "data", "[", "arg_0", ".", "profile", "]", "[", "arg_2", "]", "[", "arg_3", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Update msg attrs with values from the profile configuration if the\n    msg.attr=None, else leave it alone.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.\n    \"\"\"\n    arg_2 = arg_0.__class__.__name__.lower()\n    for arg_3 in arg_0:\n        if getattr(arg_0, arg_3) is None and arg_3 in arg_1.data[arg_0.profile][arg_2]:\n            setattr(arg_0, arg_3, arg_1.data[arg_0.profile][arg_2][arg_3])", "path": "messages/_config.py", "identifier": "retrieve_data_from_config", "docstring": "Update msg attrs with values from the profile configuration if the\n    msg.attr=None, else leave it alone.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.", "docstring_tokens": ["Update", "msg", "attrs", "with", "values", "from", "the", "profile", "configuration", "if", "the", "msg", ".", "attr", "=", "None", "else", "leave", "it", "alone", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 256483}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L92-L121", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Returns content of the given 'fpath' with HTML annotations, currently simply\n    a conversion of ANSI color codes to HTML elements", "language": "python", "parameters": "(run_root)", "return_statement": "return content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "return", "\"CANNOT_LOCATE_LOGFILES\"", "arg_1", "=", "[", "]", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "glob", ".", "glob", "(", "os", ".", "sep", ".", "join", "(", "[", "arg_0", ",", "\"*.log\"", "]", ")", ")", ":", "if", "\"exit\"", "in", "arg_4", ":", "arg_2", ".", "append", "(", "arg_4", ")", "continue", "if", "\"hook\"", "in", "arg_4", ":", "arg_1", ".", "append", "(", "arg_4", ")", "continue", "arg_3", ".", "append", "(", "arg_4", ")", "arg_5", "=", "\"\"", "for", "arg_4", "in", "arg_1", "+", "arg_3", "+", "arg_2", ":", "arg_5", "+=", "\"# BEGIN: run-log from log_fpath: %s\\n\"", "%", "arg_4", "arg_5", "+=", "open", "(", "arg_4", ",", "\"r\"", ")", ".", "read", "(", ")", "arg_5", "+=", "\"# END: run-log from log_fpath: %s\\n\\n\"", "%", "arg_4", "return", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns content of the given 'fpath' with HTML annotations, currently simply\n    a conversion of ANSI color codes to HTML elements\n    \"\"\"\n\n    if not os.path.isdir(arg_0):\n        return \"CANNOT_LOCATE_LOGFILES\"\n\n    arg_1 = []\n    arg_2 = []\n    arg_3 = []\n    for arg_4 in glob.glob(os.sep.join([arg_0, \"*.log\"])):\n        if \"exit\" in arg_4:\n            arg_2.append(arg_4)\n            continue\n\n        if \"hook\" in arg_4:\n            arg_1.append(arg_4)\n            continue\n\n        arg_3.append(arg_4)\n\n    arg_5 = \"\"\n    for arg_4 in arg_1 + arg_3 + arg_2:\n        arg_5 += \"# BEGIN: run-log from log_fpath: %s\\n\" % arg_4\n        arg_5 += open(arg_4, \"r\").read()\n        arg_5 += \"# END: run-log from log_fpath: %s\\n\\n\" % arg_4\n\n    return arg_5", "path": "modules/cij/reporter.py", "identifier": "runlogs_to_html", "docstring": "Returns content of the given 'fpath' with HTML annotations, currently simply\n    a conversion of ANSI color codes to HTML elements", "docstring_tokens": ["Returns", "content", "of", "the", "given", "fpath", "with", "HTML", "annotations", "currently", "simply", "a", "conversion", "of", "ANSI", "color", "codes", "to", "HTML", "elements"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 256484}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L135-L141", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "turns off debugging by removing hidden tmp file", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "_os", ".", "path", ".", "exists", "(", "__debugflag__", ")", ":", "_os", ".", "remove", "(", "__debugflag__", ")", "arg_0", "=", "\"ERROR\"", "_LOGGER", ".", "info", "(", "\"debugging turned off\"", ")", "_set_debug_dict", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\" turns off debugging by removing hidden tmp file \"\"\"\n    if _os.path.exists(__debugflag__):\n        _os.remove(__debugflag__)\n    arg_0 = \"ERROR\"\n    _LOGGER.info(\"debugging turned off\")\n    _set_debug_dict(arg_0)", "path": "ipyrad/__init__.py", "identifier": "_debug_off", "docstring": "turns off debugging by removing hidden tmp file", "docstring_tokens": ["turns", "off", "debugging", "by", "removing", "hidden", "tmp", "file"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 256485}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L323-L334", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Remove the directory.", "language": "python", "parameters": "(self, recursive=True, ignore_error=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ")", ":", "try", ":", "if", "arg_1", "or", "arg_0", ".", "_cleanup", "==", "'recursive'", ":", "shutil", ".", "rmtree", "(", "arg_0", ".", "path", ")", "else", ":", "os", ".", "rmdir", "(", "arg_0", ".", "path", ")", "except", "Exception", "as", "e", ":", "if", "not", "arg_2", ":", "raise", "e"], "function": "def Func(arg_0, arg_1=True, arg_2=True):\n        \"\"\"\n        Remove the directory.\n        \"\"\"\n        try:\n            if arg_1 or arg_0._cleanup == 'recursive':\n                shutil.rmtree(arg_0.path)\n            else:\n                os.rmdir(arg_0.path)\n        except Exception as e:\n            if not arg_2:\n                raise e", "path": "scruffy/file.py", "identifier": "Directory.remove", "docstring": "Remove the directory.", "docstring_tokens": ["Remove", "the", "directory", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 256486}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant_loader.py#L198-L288", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update the compounds for a case", "language": "python", "parameters": "(self, case_obj, build='37')", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'37'", ")", ":", "arg_3", "=", "arg_1", "[", "'_id'", "]", "arg_4", "=", "set", "(", ")", "arg_5", "=", "set", "(", ")", "for", "arg_6", "in", "FILE_TYPE_MAP", ":", "if", "arg_1", ".", "get", "(", "'vcf_files'", ",", "{", "}", ")", ".", "get", "(", "arg_6", ")", ":", "arg_4", ".", "add", "(", "FILE_TYPE_MAP", "[", "arg_6", "]", "[", "'category'", "]", ")", "arg_5", ".", "add", "(", "FILE_TYPE_MAP", "[", "arg_6", "]", "[", "'variant_type'", "]", ")", "arg_7", "=", "arg_0", ".", "get_coding_intervals", "(", "arg_2", "=", "arg_2", ")", "for", "arg_8", "in", "CHROMOSOMES", ":", "arg_9", "=", "arg_7", ".", "get", "(", "arg_8", ",", "IntervalTree", "(", ")", ")", "for", "arg_10", "in", "arg_5", ":", "for", "arg_11", "in", "arg_4", ":", "LOG", ".", "info", "(", "\"Updating compounds on chromosome:{0}, type:{1}, category:{2} for case:{3}\"", ".", "format", "(", "arg_8", ",", "arg_10", ",", "arg_11", ",", "arg_3", ")", ")", "arg_12", "=", "{", "'variant_type'", ":", "arg_10", ",", "'chrom'", ":", "arg_8", ",", "}", "arg_13", "=", "arg_0", ".", "variants", "(", "arg_3", "=", "arg_3", ",", "arg_12", "=", "arg_12", ",", "arg_11", "=", "arg_11", ",", "nr_of_variants", "=", "-", "1", ",", "sort_key", "=", "'position'", ")", "arg_14", "=", "{", "}", "arg_15", "=", "None", "arg_16", "=", "False", "for", "arg_17", "in", "arg_13", ":", "arg_18", "=", "arg_17", "[", "'_id'", "]", "arg_19", "=", "arg_17", "[", "'chromosome'", "]", "arg_20", "=", "arg_17", "[", "'position'", "]", "arg_21", "=", "arg_17", "[", "'end'", "]", "+", "1", "arg_22", "=", "True", "arg_23", "=", "None", "arg_24", "=", "arg_7", ".", "get", "(", "arg_19", ",", "IntervalTree", "(", ")", ")", ".", "search", "(", "arg_20", ",", "arg_21", ")", "if", "arg_24", ":", "arg_23", "=", "arg_24", ".", "pop", "(", ")", ".", "data", "if", "arg_23", "and", "(", "arg_23", "==", "arg_15", ")", ":", "arg_22", "=", "False", "arg_15", "=", "arg_23", "if", "arg_22", "and", "arg_14", ":", "arg_0", ".", "update_compounds", "(", "arg_14", ")", "arg_0", ".", "update_mongo_compound_variants", "(", "arg_14", ")", "arg_14", "=", "{", "}", "if", "arg_23", ":", "arg_14", "[", "arg_18", "]", "=", "arg_17", "if", "not", "arg_14", ":", "continue", "arg_0", ".", "update_compounds", "(", "arg_14", ")", "arg_0", ".", "update_mongo_compound_variants", "(", "arg_14", ")", "LOG", ".", "info", "(", "\"All compounds updated\"", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2='37'):\n        \"\"\"Update the compounds for a case\n\n        Loop over all coding intervals to get coordinates for all potential compound positions.\n        Update all variants within a gene with a bulk operation.\n        \"\"\"\n\n        arg_3 = arg_1['_id']\n        # Possible categories 'snv', 'sv', 'str', 'cancer':\n        arg_4 = set()\n        # Possible variant types 'clinical', 'research':\n        arg_5 = set()\n\n        for arg_6 in FILE_TYPE_MAP:\n            if arg_1.get('vcf_files',{}).get(arg_6):\n                arg_4.add(FILE_TYPE_MAP[arg_6]['category'])\n                arg_5.add(FILE_TYPE_MAP[arg_6]['variant_type'])\n\n        arg_7 = arg_0.get_coding_intervals(arg_2=arg_2)\n        # Loop over all intervals\n        for arg_8 in CHROMOSOMES:\n            arg_9 = arg_7.get(arg_8, IntervalTree())\n            for arg_10 in arg_5:\n                for arg_11 in arg_4:\n                    LOG.info(\"Updating compounds on chromosome:{0}, type:{1}, category:{2} for case:{3}\".format(\n                             arg_8, arg_10, arg_11, arg_3))\n\n                    # Fetch all variants from a chromosome\n                    arg_12  = {\n                        'variant_type': arg_10,\n                        'chrom': arg_8,\n                    }\n\n                    # Get all variants from the database of the specific type\n                    arg_13 = arg_0.variants(\n                        arg_3=arg_3,\n                        arg_12=arg_12,\n                        arg_11=arg_11,\n                        nr_of_variants=-1,\n                        sort_key='position'\n                    )\n\n                    # Initiate a bulk\n                    arg_14 = {}\n                    arg_15 = None\n                    arg_16 = False\n\n                    # Loop over the variants and check if they are in a coding region\n                    for arg_17 in arg_13:\n                        arg_18 = arg_17['_id']\n                        arg_19 = arg_17['chromosome']\n                        arg_20 = arg_17['position']\n                        arg_21 = arg_17['end'] + 1\n\n                        arg_22 = True\n                        arg_23 = None\n\n                        # Check if the variant is in a coding region\n                        arg_24 = arg_7.get(arg_19, IntervalTree()).search(arg_20, arg_21)\n\n\n                        # If the variant is in a coding region\n                        if arg_24:\n                            # We know there is data here so get the interval id\n                            arg_23 = arg_24.pop().data\n\n                        if arg_23 and (arg_23 == arg_15):\n                            # If the variant is in the same region as previous\n                            # we add it to the same bulk\n                            arg_22 = False\n\n                        arg_15 = arg_23\n\n                        # If the variant is not in a current region we update the compounds\n                        # from the previous region, if any. Otherwise continue\n                        if arg_22 and arg_14:\n                            arg_0.update_compounds(arg_14)\n                            arg_0.update_mongo_compound_variants(arg_14)\n                            arg_14 = {}\n\n                        if arg_23:\n                            arg_14[arg_18] = arg_17\n\n                    if not arg_14:\n                        continue\n\n                    arg_0.update_compounds(arg_14)\n                    arg_0.update_mongo_compound_variants(arg_14)\n\n        LOG.info(\"All compounds updated\")\n        return", "path": "scout/adapter/mongo/variant_loader.py", "identifier": "VariantLoader.update_case_compounds", "docstring": "Update the compounds for a case\n\n        Loop over all coding intervals to get coordinates for all potential compound positions.\n        Update all variants within a gene with a bulk operation.", "docstring_tokens": ["Update", "the", "compounds", "for", "a", "case"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256487}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L146-L162", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Generator that reads a line of data from the server.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "True", ":", "arg_1", "=", "arg_0", ".", "__buffer", ".", "readline", "(", ")", "if", "not", "arg_1", ":", "arg_0", ".", "__recv", "(", ")", "continue", "yield", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Generator that reads a line of data from the server.\n\n        It first attempts to read from the internal buffer. If there is not\n        enough data to read a line it then requests more data from the server\n        and adds it to the buffer. This process repeats until a line of data\n        can be read from the internal buffer.\n\n        Yields:\n            A line of data when it becomes available.\n        \"\"\"\n        while True:\n            arg_1 = arg_0.__buffer.readline()\n            if not arg_1:\n                arg_0.__recv()\n                continue\n            yield arg_1", "path": "nntp/nntp.py", "identifier": "BaseNNTPClient.__line_gen", "docstring": "Generator that reads a line of data from the server.\n\n        It first attempts to read from the internal buffer. If there is not\n        enough data to read a line it then requests more data from the server\n        and adds it to the buffer. This process repeats until a line of data\n        can be read from the internal buffer.\n\n        Yields:\n            A line of data when it becomes available.", "docstring_tokens": ["Generator", "that", "reads", "a", "line", "of", "data", "from", "the", "server", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 256488}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/operation_layers.py#L60-L89", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert concatenation.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting concat ...'", ")", "arg_7", "=", "[", "arg_4", "[", "i", "]", "for", "i", "in", "arg_3", "]", "if", "len", "(", "arg_7", ")", "==", "1", ":", "arg_4", "[", "arg_2", "]", "=", "arg_7", "[", "0", "]", "return", "if", "arg_6", "==", "'short'", ":", "arg_8", "=", "'CAT'", "+", "random_string", "(", "5", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_8", "=", "arg_1", "else", ":", "arg_8", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_9", "=", "keras", ".", "layers", ".", "Concatenate", "(", "name", "=", "arg_8", ",", "axis", "=", "arg_0", "[", "'axis'", "]", ")", "arg_4", "[", "arg_2", "]", "=", "arg_9", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert concatenation.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting concat ...')\n    arg_7 = [arg_4[i] for i in arg_3]\n\n    if len(arg_7) == 1:\n        # no-op\n        arg_4[arg_2] = arg_7[0]\n        return\n\n    if arg_6 == 'short':\n        arg_8 = 'CAT' + random_string(5)\n    elif arg_6 == 'keep':\n        arg_8 = arg_1\n    else:\n        arg_8 = arg_1 + str(random.random())\n\n    arg_9 = keras.layers.Concatenate(name=arg_8, axis=arg_0['axis'])\n    arg_4[arg_2] = arg_9(arg_7)", "path": "pytorch2keras/operation_layers.py", "identifier": "convert_concat", "docstring": "Convert concatenation.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "concatenation", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 256489}
{"url": "https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L154-L173", "sha": "800976faab3b827a42fa1cb80f13fcc03961d2c9", "docstring_summary": "Form an authorization URL.", "language": "python", "parameters": "(self, url, state=None, **kwargs)", "return_statement": "return (\n            self._client.prepare_request_uri(\n                url,\n                redirect_uri=self.redirect_uri,\n                scope=self.scope,\n                state=state,\n                **kwargs\n            ),\n            state,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_2", "=", "arg_2", "or", "arg_0", ".", "new_state", "(", ")", "return", "(", "arg_0", ".", "_client", ".", "prepare_request_uri", "(", "arg_1", ",", "redirect_uri", "=", "arg_0", ".", "redirect_uri", ",", "scope", "=", "arg_0", ".", "scope", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", ",", "arg_2", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Form an authorization URL.\n\n        :param url: Authorization endpoint url, must be HTTPS.\n        :param state: An optional state string for CSRF protection. If not\n                      given it will be generated for you.\n        :param kwargs: Extra parameters to include.\n        :return: Func, state\n        \"\"\"\n        arg_2 = arg_2 or arg_0.new_state()\n        return (\n            arg_0._client.prepare_request_uri(\n                arg_1,\n                redirect_uri=arg_0.redirect_uri,\n                scope=arg_0.scope,\n                arg_2=arg_2,\n                **arg_3\n            ),\n            arg_2,\n        )", "path": "requests_oauthlib/oauth2_session.py", "identifier": "OAuth2Session.authorization_url", "docstring": "Form an authorization URL.\n\n        :param url: Authorization endpoint url, must be HTTPS.\n        :param state: An optional state string for CSRF protection. If not\n                      given it will be generated for you.\n        :param kwargs: Extra parameters to include.\n        :return: authorization_url, state", "docstring_tokens": ["Form", "an", "authorization", "URL", "."], "nwo": "requests/requests-oauthlib", "score": 0.9446339936112974, "idx": 256490}
{"url": "https://github.com/lc-guy/limf/blob/ad380feb70ef8e579a91ca09c807efec9e8af565/limf/encrypter.py#L13-L26", "sha": "ad380feb70ef8e579a91ca09c807efec9e8af565", "docstring_summary": "Encrypts file with gpg and random generated password", "language": "python", "parameters": "(selected_host, only_link, file_name)", "return_statement": "return upload_files(encrypted_data, selected_host, only_link, file_name)+'#'+passphrase", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "ENCRYPTION_DISABLED", ":", "print", "(", "'For encryption please install gpg'", ")", "exit", "(", ")", "arg_3", "=", "'%030x'", "%", "random", ".", "randrange", "(", "16", "**", "30", ")", "arg_4", "=", "arg_2", "arg_5", "=", "'gpg --batch --symmetric --cipher-algo AES256 --passphrase-fd 0 '", "'--output - {}'", ".", "format", "(", "arg_4", ")", "arg_6", "=", "Popen", "(", "shlex", ".", "split", "(", "arg_5", ")", ",", "stdout", "=", "PIPE", ",", "stdin", "=", "PIPE", ",", "stderr", "=", "PIPE", ")", "arg_7", "=", "arg_6", ".", "communicate", "(", "arg_3", ".", "encode", "(", ")", ")", "[", "0", "]", "return", "upload_files", "(", "arg_7", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "+", "'#'", "+", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Encrypts file with gpg and random generated password\n    \"\"\"\n    if ENCRYPTION_DISABLED:\n        print('For encryption please install gpg')\n        exit()\n    arg_3 = '%030x' % random.randrange(16**30)\n    arg_4 = arg_2\n    arg_5 = 'gpg --batch --symmetric --cipher-algo AES256 --passphrase-fd 0 ' \\\n          '--output - {}'.format(arg_4)\n    arg_6 = Popen(shlex.split(arg_5), stdout=PIPE, stdin=PIPE, stderr=PIPE)\n    arg_7 = arg_6.communicate(arg_3.encode())[0]\n    return upload_files(arg_7, arg_0, arg_1, arg_2)+'#'+arg_3", "path": "limf/encrypter.py", "identifier": "encrypt_files", "docstring": "Encrypts file with gpg and random generated password", "docstring_tokens": ["Encrypts", "file", "with", "gpg", "and", "random", "generated", "password"], "nwo": "lc-guy/limf", "score": 0.28168436607245656, "idx": 256491}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/bpy.py#L44-L51", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Invoke a debugger command from inside a python shell called inside\n        the debugger.", "language": "python", "parameters": "(self, string)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "(", "''", ")", "arg_0", ".", "proc", ".", "cmd_queue", ".", "append", "(", "arg_1", ")", "arg_0", ".", "proc", ".", "process_command", "(", ")", "return"], "function": "def Func(arg_0, arg_1):\n        '''Invoke a debugger command from inside a python shell called inside\n        the debugger.\n        '''\n        print('')\n        arg_0.proc.cmd_queue.append(arg_1)\n        arg_0.proc.process_command()\n        return", "path": "trepan/processor/command/bpy.py", "identifier": "PythonCommand.dbgr", "docstring": "Invoke a debugger command from inside a python shell called inside\n        the debugger.", "docstring_tokens": ["Invoke", "a", "debugger", "command", "from", "inside", "a", "python", "shell", "called", "inside", "the", "debugger", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 256492}
{"url": "https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L86-L96", "sha": "5e464e1fc3ae9c7e216f6dd94f879a967d065247", "docstring_summary": "Returns protobuf mapcontainer. Read from translation file.", "language": "python", "parameters": "(filename)", "return_statement": "return (list(unwrap_translation_units(translation.entities)),\n        list(unwrap_translation_units(translation.relations)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "triple_pb", ".", "Translation", "(", ")", "with", "open", "(", "arg_0", ",", "\"rb\"", ")", "as", "f", ":", "arg_1", ".", "ParseFromString", "(", "f", ".", "read", "(", ")", ")", "def", "unwrap_translation_units", "(", "arg_2", ")", ":", "for", "arg_3", "in", "arg_2", ":", "yield", "arg_3", ".", "element", ",", "arg_3", ".", "index", "return", "(", "list", "(", "unwrap_translation_units", "(", "arg_1", ".", "entities", ")", ")", ",", "list", "(", "unwrap_translation_units", "(", "arg_1", ".", "relations", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Returns protobuf mapcontainer. Read from translation file.\"\"\"\n    arg_1 = triple_pb.Translation()\n    with open(arg_0, \"rb\") as f:\n        arg_1.ParseFromString(f.read())\n\n    def unwrap_translation_units(arg_2):\n        for arg_3 in arg_2: yield arg_3.element, arg_3.index\n\n    return (list(unwrap_translation_units(arg_1.entities)),\n        list(unwrap_translation_units(arg_1.relations)))", "path": "kgekit/io.py", "identifier": "read_translation", "docstring": "Returns protobuf mapcontainer. Read from translation file.", "docstring_tokens": ["Returns", "protobuf", "mapcontainer", ".", "Read", "from", "translation", "file", "."], "nwo": "fantasticfears/kgekit", "score": 0.15726537023232431, "idx": 256493}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/shell.py#L280-L306", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Check if an argument is a flag.", "language": "python", "parameters": "(cls, arg)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "==", "'--'", ":", "return", "False", "if", "not", "arg_1", ".", "startswith", "(", "'-'", ")", ":", "return", "False", "if", "arg_1", ".", "startswith", "(", "'--'", ")", ":", "arg_2", "=", "arg_1", "[", "2", "]", "else", ":", "arg_2", "=", "arg_1", "[", "1", "]", "if", "not", "arg_2", ".", "isalpha", "(", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check if an argument is a flag.\n\n        A flag starts with - or -- and the next character must be a letter\n        followed by letters, numbers, - or _.  Currently we only check the\n        alpha'ness of the first non-dash character to make sure we're not just\n        looking at a negative number.\n\n        Returns:\n            bool: Whether the argument is a flag.\n        \"\"\"\n\n        if arg_1 == '--':\n            return False\n\n        if not arg_1.startswith('-'):\n            return False\n\n        if arg_1.startswith('--'):\n            arg_2 = arg_1[2]\n        else:\n            arg_2 = arg_1[1]\n\n        if not arg_2.isalpha():\n            return False\n\n        return True", "path": "typedargs/shell.py", "identifier": "HierarchicalShell._is_flag", "docstring": "Check if an argument is a flag.\n\n        A flag starts with - or -- and the next character must be a letter\n        followed by letters, numbers, - or _.  Currently we only check the\n        alpha'ness of the first non-dash character to make sure we're not just\n        looking at a negative number.\n\n        Returns:\n            bool: Whether the argument is a flag.", "docstring_tokens": ["Check", "if", "an", "argument", "is", "a", "flag", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 256494}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/processors.py#L205-L212", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Process events queue.", "language": "python", "parameters": "(self)", "return_statement": "return elasticsearch.helpers.bulk(\n            self.client,\n            self.actionsiter(),\n            stats_only=True,\n            chunk_size=50\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "elasticsearch", ".", "helpers", ".", "bulk", "(", "arg_0", ".", "client", ",", "arg_0", ".", "actionsiter", "(", ")", ",", "stats_only", "=", "True", ",", "chunk_size", "=", "50", ")"], "function": "def Func(arg_0):\n        \"\"\"Process events queue.\"\"\"\n        return elasticsearch.helpers.bulk(\n            arg_0.client,\n            arg_0.actionsiter(),\n            stats_only=True,\n            chunk_size=50\n        )", "path": "invenio_stats/processors.py", "identifier": "EventsIndexer.run", "docstring": "Process events queue.", "docstring_tokens": ["Process", "events", "queue", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 256495}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/ast/state.py#L65-L83", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Provide a '.dot' representation of all State in the register.", "language": "python", "parameters": "(self)", "return_statement": "return txt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "str", ":", "arg_1", "=", "\"\"", "arg_1", "+=", "\"digraph S%d {\\n\"", "%", "id", "(", "arg_0", ")", "if", "arg_0", ".", "label", "is", "not", "None", ":", "arg_1", "+=", "'\\tlabel=\"%s\";\\n'", "%", "(", "arg_0", ".", "label", "+", "'\\l'", ")", ".", "replace", "(", "'\\n'", ",", "'\\l'", ")", "arg_1", "+=", "\"\\trankdir=LR;\\n\"", "arg_1", "+=", "'\\tgraph [labeljust=l, labelloc=t, nojustify=true];\\n'", "arg_1", "+=", "\"\\tesep=1;\\n\"", "arg_1", "+=", "'\\tranksep=\"equally\";\\n'", "arg_1", "+=", "\"\\tnode [shape = circle];\\n\"", "arg_1", "+=", "\"\\tsplines = ortho;\\n\"", "for", "arg_2", "in", "arg_0", ".", "states", ".", "values", "(", ")", ":", "arg_1", "+=", "arg_2", "[", "1", "]", ".", "Func", "(", ")", "arg_1", "+=", "\"}\\n\"", "return", "arg_1"], "function": "def Func(arg_0) -> str:\n        \"\"\"\n        Provide a '.dot' representation of all State in the register.\n        \"\"\"\n        arg_1 = \"\"\n        arg_1 += \"digraph S%d {\\n\" % id(arg_0)\n        if arg_0.label is not None:\n            arg_1 += '\\tlabel=\"%s\";\\n' % (arg_0.label + '\\l').replace('\\n', '\\l')\n        arg_1 += \"\\trankdir=LR;\\n\"\n        #txt += '\\tlabelloc=\"t\";\\n'\n        arg_1 += '\\tgraph [labeljust=l, labelloc=t, nojustify=true];\\n'\n        arg_1 += \"\\tesep=1;\\n\"\n        arg_1 += '\\tranksep=\"equally\";\\n'\n        arg_1 += \"\\tnode [shape = circle];\\n\"\n        arg_1 += \"\\tsplines = ortho;\\n\"\n        for arg_2 in arg_0.states.values():\n            arg_1 += arg_2[1].Func()\n        arg_1 += \"}\\n\"\n        return arg_1", "path": "pyrser/ast/state.py", "identifier": "StateRegister.to_dot", "docstring": "Provide a '.dot' representation of all State in the register.", "docstring_tokens": ["Provide", "a", ".", "dot", "representation", "of", "all", "State", "in", "the", "register", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 256496}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L612-L687", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Get events from this conversation.", "language": "python", "parameters": "(self, event_id=None, max_events=50)", "return_statement": "return conv_events", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "50", ")", ":", "if", "arg_1", "is", "None", ":", "arg_3", "=", "arg_0", ".", "_events", "[", "-", "1", "*", "arg_2", ":", "]", "else", ":", "arg_4", "=", "arg_0", ".", "get_event", "(", "arg_1", ")", "if", "arg_0", ".", "_events", "[", "0", "]", ".", "id_", "!=", "arg_1", ":", "arg_3", "=", "arg_0", ".", "_events", "[", "arg_0", ".", "_events", ".", "index", "(", "arg_4", ")", "+", "1", ":", "]", "else", ":", "logger", ".", "info", "(", "'Loading events for conversation {} before {}'", ".", "format", "(", "arg_0", ".", "id_", ",", "arg_4", ".", "timestamp", ")", ")", "arg_5", "=", "await", "arg_0", ".", "_client", ".", "get_conversation", "(", "hangouts_pb2", ".", "GetConversationRequest", "(", "request_header", "=", "arg_0", ".", "_client", ".", "get_request_header", "(", ")", ",", "conversation_spec", "=", "hangouts_pb2", ".", "ConversationSpec", "(", "conversation_id", "=", "hangouts_pb2", ".", "ConversationId", "(", "id", "=", "arg_0", ".", "id_", ")", ")", ",", "include_event", "=", "True", ",", "max_events_per_conversation", "=", "arg_2", ",", "event_continuation_token", "=", "arg_0", ".", "_event_cont_token", ")", ")", "if", "arg_5", ".", "conversation_state", ".", "HasField", "(", "'conversation'", ")", ":", "arg_0", ".", "update_conversation", "(", "arg_5", ".", "conversation_state", ".", "conversation", ")", "arg_0", ".", "_event_cont_token", "=", "(", "arg_5", ".", "conversation_state", ".", "event_continuation_token", ")", "arg_3", "=", "[", "arg_0", ".", "_wrap_event", "(", "event", ")", "for", "event", "in", "arg_5", ".", "conversation_state", ".", "event", "]", "logger", ".", "info", "(", "'Loaded {} events for conversation {}'", ".", "format", "(", "len", "(", "arg_3", ")", ",", "arg_0", ".", "id_", ")", ")", "for", "arg_4", "in", "reversed", "(", "arg_3", ")", ":", "if", "arg_4", ".", "id_", "not", "in", "arg_0", ".", "_events_dict", ":", "arg_0", ".", "_events", ".", "insert", "(", "0", ",", "arg_4", ")", "arg_0", ".", "_events_dict", "[", "arg_4", ".", "id_", "]", "=", "arg_4", "else", ":", "logger", ".", "info", "(", "'Conversation %s ignoring duplicate event %s'", ",", "arg_0", ".", "id_", ",", "arg_4", ".", "id_", ")", "return", "arg_3"], "function": "async def Func(arg_0, arg_1=None, arg_2=50):\n        \"\"\"Get events from this conversation.\n\n        Makes a request to load historical events if necessary.\n\n        Args:\n            event_id (str): (optional) If provided, return events preceding\n                this event, otherwise return the newest events.\n            max_events (int): Maximum number of events to return. Defaults to\n                50.\n\n        Returns:\n            List of :class:`.ConversationEvent` instances, ordered\n            newest-first.\n\n        Raises:\n            KeyError: If ``event_id`` does not correspond to a known event.\n            .NetworkError: If the events could not be requested.\n        \"\"\"\n        if arg_1 is None:\n            # If no event_id is provided, return the newest events in this\n            # conversation.\n            arg_3 = arg_0._events[-1 * arg_2:]\n        else:\n            # If event_id is provided, return the events we have that are\n            # older, or request older events if event_id corresponds to the\n            # oldest event we have.\n            arg_4 = arg_0.get_event(arg_1)\n            if arg_0._events[0].id_ != arg_1:\n                arg_3 = arg_0._events[arg_0._events.index(arg_4) + 1:]\n            else:\n                logger.info('Loading events for conversation {} before {}'\n                            .format(arg_0.id_, arg_4.timestamp))\n                arg_5 = await arg_0._client.get_conversation(\n                    hangouts_pb2.GetConversationRequest(\n                        request_header=arg_0._client.get_request_header(),\n                        conversation_spec=hangouts_pb2.ConversationSpec(\n                            conversation_id=hangouts_pb2.ConversationId(\n                                id=arg_0.id_\n                            )\n                        ),\n                        include_event=True,\n                        max_events_per_conversation=arg_2,\n                        event_continuation_token=arg_0._event_cont_token\n                    )\n                )\n                # Certain fields of conversation_state are not populated by\n                # SyncRecentConversations. This is the case with the\n                # user_read_state fields which are all set to 0 but for the\n                # 'self' user. Update here so these fields get populated on the\n                # first call to GetConversation.\n                if arg_5.conversation_state.HasField('conversation'):\n                    arg_0.update_conversation(\n                        arg_5.conversation_state.conversation\n                    )\n                arg_0._event_cont_token = (\n                    arg_5.conversation_state.event_continuation_token\n                )\n                arg_3 = [arg_0._wrap_event(event) for event\n                               in arg_5.conversation_state.event]\n                logger.info('Loaded {} events for conversation {}'\n                            .format(len(arg_3), arg_0.id_))\n                # Iterate though the events newest to oldest.\n                for arg_4 in reversed(arg_3):\n                    # Add event as the new oldest event, unless we already have\n                    # it.\n                    if arg_4.id_ not in arg_0._events_dict:\n                        arg_0._events.insert(0, arg_4)\n                        arg_0._events_dict[arg_4.id_] = arg_4\n                    else:\n                        # If this happens, there's probably a bug.\n                        logger.info(\n                            'Conversation %s ignoring duplicate event %s',\n                            arg_0.id_, arg_4.id_\n                        )\n        return arg_3", "path": "hangups/conversation.py", "identifier": "Conversation.get_events", "docstring": "Get events from this conversation.\n\n        Makes a request to load historical events if necessary.\n\n        Args:\n            event_id (str): (optional) If provided, return events preceding\n                this event, otherwise return the newest events.\n            max_events (int): Maximum number of events to return. Defaults to\n                50.\n\n        Returns:\n            List of :class:`.ConversationEvent` instances, ordered\n            newest-first.\n\n        Raises:\n            KeyError: If ``event_id`` does not correspond to a known event.\n            .NetworkError: If the events could not be requested.", "docstring_tokens": ["Get", "events", "from", "this", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 256497}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L772-L786", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Set's the package summary.\n        Raises SPDXValueError if text is not free form text.\n        Raises CardinalityError if summary already set.\n        Raises OrderError if no package previously defined.", "language": "python", "parameters": "(self, doc, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "assert_package_exists", "(", ")", "if", "not", "arg_0", ".", "package_summary_set", ":", "arg_0", ".", "package_summary_set", "=", "True", "if", "validations", ".", "validate_pkg_summary", "(", "arg_2", ")", ":", "arg_1", ".", "package", ".", "summary", "=", "str_from_text", "(", "arg_2", ")", "else", ":", "raise", "SPDXValueError", "(", "'Package::Summary'", ")", "else", ":", "raise", "CardinalityError", "(", "'Package::Summary'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Set's the package summary.\n        Raises SPDXValueError if text is not free form text.\n        Raises CardinalityError if summary already set.\n        Raises OrderError if no package previously defined.\n        \"\"\"\n        arg_0.assert_package_exists()\n        if not arg_0.package_summary_set:\n            arg_0.package_summary_set = True\n            if validations.validate_pkg_summary(arg_2):\n                arg_1.package.summary = str_from_text(arg_2)\n            else:\n                raise SPDXValueError('Package::Summary')\n        else:\n            raise CardinalityError('Package::Summary')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "PackageBuilder.set_pkg_summary", "docstring": "Set's the package summary.\n        Raises SPDXValueError if text is not free form text.\n        Raises CardinalityError if summary already set.\n        Raises OrderError if no package previously defined.", "docstring_tokens": ["Set", "s", "the", "package", "summary", ".", "Raises", "SPDXValueError", "if", "text", "is", "not", "free", "form", "text", ".", "Raises", "CardinalityError", "if", "summary", "already", "set", ".", "Raises", "OrderError", "if", "no", "package", "previously", "defined", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 256498}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/yandex_metrica.py#L47-L58", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "Yandex.Metrica counter template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return YandexMetricaNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "YandexMetricaNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Yandex.Metrica counter template tag.\n\n    Renders Javascript code to track page visits. You must supply\n    your website counter ID (as a string) in the\n    ``YANDEX_METRICA_COUNTER_ID`` setting.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return YandexMetricaNode()", "path": "analytical/templatetags/yandex_metrica.py", "identifier": "yandex_metrica", "docstring": "Yandex.Metrica counter template tag.\n\n    Renders Javascript code to track page visits. You must supply\n    your website counter ID (as a string) in the\n    ``YANDEX_METRICA_COUNTER_ID`` setting.", "docstring_tokens": ["Yandex", ".", "Metrica", "counter", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 256499}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L595-L624", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Download a folder to the specified path along with any children.", "language": "python", "parameters": "(folder_id, path='.')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'.'", ")", ":", "arg_2", ".", "token", "=", "verify_credentials", "(", ")", "arg_4", "=", "arg_2", ".", "communicator", ".", "folder_get", "(", "arg_2", ".", "token", ",", "arg_0", ")", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", "[", "'name'", "]", ".", "replace", "(", "'/'", ",", "'_'", ")", ")", "print", "(", "'Creating folder at {0}'", ".", "format", "(", "arg_5", ")", ")", "try", ":", "os", ".", "mkdir", "(", "arg_5", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", "EEXIST", "and", "arg_2", ".", "allow_existing_download_paths", ":", "pass", "else", ":", "raise", "arg_6", "=", "arg_2", ".", "communicator", ".", "folder_children", "(", "arg_2", ".", "token", ",", "arg_0", ")", "for", "arg_7", "in", "arg_6", "[", "'items'", "]", ":", "_download_item", "(", "arg_7", "[", "'item_id'", "]", ",", "arg_5", ",", "arg_7", "=", "arg_7", ")", "for", "arg_8", "in", "arg_6", "[", "'folders'", "]", ":", "Func", "(", "arg_8", "[", "'folder_id'", "]", ",", "arg_5", ")", "for", "arg_9", "in", "arg_2", ".", "folder_download_callbacks", ":", "arg_9", "(", "arg_2", ".", "communicator", ",", "arg_2", ".", "token", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1='.'):\n    \"\"\"\n    Download a folder to the specified path along with any children.\n\n    :param folder_id: The id of the target folder\n    :type folder_id: int | long\n    :param path: (optional) the location to download the folder\n    :type path: string\n    \"\"\"\n    arg_2.token = verify_credentials()\n\n    arg_4 = arg_2.communicator.folder_get(arg_2.token, arg_0)\n    # Replace any '/' in the folder name.\n    arg_5 = os.path.join(arg_1, arg_4['name'].replace('/', '_'))\n    print('Creating folder at {0}'.format(arg_5))\n    try:\n        os.mkdir(arg_5)\n    except OSError as e:\n        if e.errno == errno.EEXIST and arg_2.allow_existing_download_paths:\n            pass\n        else:\n            raise\n    arg_6 = arg_2.communicator.folder_children(\n        arg_2.token, arg_0)\n    for arg_7 in arg_6['items']:\n        _download_item(arg_7['item_id'], arg_5, arg_7=arg_7)\n    for arg_8 in arg_6['folders']:\n        Func(arg_8['folder_id'], arg_5)\n    for arg_9 in arg_2.folder_download_callbacks:\n        arg_9(arg_2.communicator, arg_2.token, arg_4, arg_5)", "path": "pydas/api.py", "identifier": "_download_folder_recursive", "docstring": "Download a folder to the specified path along with any children.\n\n    :param folder_id: The id of the target folder\n    :type folder_id: int | long\n    :param path: (optional) the location to download the folder\n    :type path: string", "docstring_tokens": ["Download", "a", "folder", "to", "the", "specified", "path", "along", "with", "any", "children", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 256500}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/slack.py#L60-L94", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Send the message via HTTP POST, default is json-encoded.", "language": "python", "parameters": "(self, encoding=\"json\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"json\"", ")", ":", "arg_0", ".", "_construct_message", "(", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "\"Debugging info\"", "\"\\n--------------\"", "\"\\n{} Message created.\"", ".", "format", "(", "timestamp", "(", ")", ")", ")", "if", "arg_1", "==", "\"json\"", ":", "arg_2", "=", "requests", ".", "post", "(", "arg_0", ".", "url", ",", "json", "=", "arg_0", ".", "message", ")", "elif", "arg_1", "==", "\"url\"", ":", "arg_2", "=", "requests", ".", "post", "(", "arg_0", ".", "url", ",", "data", "=", "arg_0", ".", "message", ")", "try", ":", "arg_2", ".", "raise_for_status", "(", ")", "if", "arg_2", ".", "history", "and", "arg_2", ".", "history", "[", "0", "]", ".", "status_code", ">=", "300", ":", "raise", "MessageSendError", "(", "\"HTTP Redirect: Possibly Invalid authentication\"", ")", "elif", "\"invalid_auth\"", "in", "arg_2", ".", "text", ":", "raise", "MessageSendError", "(", "\"Invalid Auth: Possibly Bad Auth Token\"", ")", "except", "(", "requests", ".", "exceptions", ".", "HTTPError", ",", "MessageSendError", ")", "as", "e", ":", "raise", "MessageSendError", "(", "e", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "timestamp", "(", ")", ",", "type", "(", "arg_0", ")", ".", "__name__", ",", "\" info:\"", ",", "arg_0", ".", "__str__", "(", "indentation", "=", "\"\\n * \"", ")", ",", "\"\\n * HTTP status code:\"", ",", "arg_2", ".", "status_code", ",", ")", "print", "(", "\"Message sent.\"", ")"], "function": "def Func(arg_0, arg_1=\"json\"):\n        \"\"\"Send the message via HTTP POST, default is json-encoded.\"\"\"\n        arg_0._construct_message()\n        if arg_0.verbose:\n            print(\n                \"Debugging info\"\n                \"\\n--------------\"\n                \"\\n{} Message created.\".format(timestamp())\n            )\n\n        if arg_1 == \"json\":\n            arg_2 = requests.post(arg_0.url, json=arg_0.message)\n        elif arg_1 == \"url\":\n            arg_2 = requests.post(arg_0.url, data=arg_0.message)\n\n        try:\n            arg_2.raise_for_status()\n            if arg_2.history and arg_2.history[0].status_code >= 300:\n                raise MessageSendError(\"HTTP Redirect: Possibly Invalid authentication\")\n            elif \"invalid_auth\" in arg_2.text:\n                raise MessageSendError(\"Invalid Auth: Possibly Bad Auth Token\")\n        except (requests.exceptions.HTTPError, MessageSendError) as e:\n            raise MessageSendError(e)\n\n        if arg_0.verbose:\n            print(\n                timestamp(),\n                type(arg_0).__name__,\n                \" info:\",\n                arg_0.__str__(indentation=\"\\n * \"),\n                \"\\n * HTTP status code:\",\n                arg_2.status_code,\n            )\n\n        print(\"Message sent.\")", "path": "messages/slack.py", "identifier": "Slack.send", "docstring": "Send the message via HTTP POST, default is json-encoded.", "docstring_tokens": ["Send", "the", "message", "via", "HTTP", "POST", "default", "is", "json", "-", "encoded", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 256501}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/domaindump.py#L160-L195", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Parses the domain users and groups files.", "language": "python", "parameters": "(domain_users_file, domain_groups_file)", "return_statement": "return count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_0", ")", "as", "f", ":", "arg_2", "=", "json", ".", "loads", "(", "f", ".", "read", "(", ")", ")", "arg_3", "=", "{", "}", "if", "arg_1", ":", "with", "open", "(", "arg_1", ")", "as", "f", ":", "arg_4", "=", "json", ".", "loads", "(", "f", ".", "read", "(", ")", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "get_field", "(", "arg_5", ",", "'objectSid'", ")", "arg_3", "[", "arg_7", "(", "arg_6", ".", "split", "(", "'-'", ")", "[", "-", "1", "]", ")", "]", "=", "get_field", "(", "arg_5", ",", "'cn'", ")", "arg_9", "=", "UserSearch", "(", ")", "arg_10", "=", "0", "arg_11", "=", "len", "(", "arg_2", ")", "print_notification", "(", "\"Importing {} users\"", ".", "format", "(", "arg_11", ")", ")", "for", "arg_12", "in", "arg_2", ":", "arg_13", "=", "parse_user", "(", "arg_12", ",", "arg_3", ")", "arg_14", "=", "arg_9", ".", "id_to_object", "(", "arg_13", "[", "'username'", "]", ")", "arg_14", ".", "name", "=", "arg_13", "[", "'name'", "]", "arg_14", ".", "domain", ".", "append", "(", "arg_13", "[", "'domain'", "]", ")", "arg_14", ".", "description", "=", "arg_13", "[", "'description'", "]", "arg_14", ".", "groups", ".", "extend", "(", "arg_13", "[", "'groups'", "]", ")", "arg_14", ".", "flags", ".", "extend", "(", "arg_13", "[", "'flags'", "]", ")", "arg_14", ".", "sid", "=", "arg_13", "[", "'sid'", "]", "arg_14", ".", "add_tag", "(", "\"domaindump\"", ")", "arg_14", ".", "save", "(", ")", "arg_10", "+=", "1", "sys", ".", "stdout", ".", "write", "(", "'\\r'", ")", "sys", ".", "stdout", ".", "write", "(", "\"[{}/{}]\"", ".", "format", "(", "arg_10", ",", "arg_11", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "sys", ".", "stdout", ".", "write", "(", "'\\r'", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n        Parses the domain users and groups files.\n    \"\"\"\n    with open(arg_0) as f:\n        arg_2 = json.loads(f.read())\n\n    arg_3 = {}\n    if arg_1:\n        with open(arg_1) as f:\n            arg_4 = json.loads(f.read())\n            for arg_5 in arg_4:\n                arg_6 = get_field(arg_5, 'objectSid')\n                arg_3[arg_7(arg_6.split('-')[-1])] = get_field(arg_5, 'cn')\n\n    arg_9 = UserSearch()\n    arg_10 = 0\n    arg_11 = len(arg_2)\n    print_notification(\"Importing {} users\".format(arg_11))\n    for arg_12 in arg_2:\n        arg_13 = parse_user(arg_12, arg_3)\n        arg_14 = arg_9.id_to_object(arg_13['username'])\n        arg_14.name = arg_13['name']\n        arg_14.domain.append(arg_13['domain'])\n        arg_14.description = arg_13['description']\n        arg_14.groups.extend(arg_13['groups'])\n        arg_14.flags.extend(arg_13['flags'])\n        arg_14.sid = arg_13['sid']\n        arg_14.add_tag(\"domaindump\")\n        arg_14.save()\n        arg_10 += 1\n        sys.stdout.write('\\r')\n        sys.stdout.write(\"[{}/{}]\".format(arg_10, arg_11))\n        sys.stdout.flush()\n    sys.stdout.write('\\r')\n    return arg_10", "path": "jackal/scripts/domaindump.py", "identifier": "parse_domain_users", "docstring": "Parses the domain users and groups files.", "docstring_tokens": ["Parses", "the", "domain", "users", "and", "groups", "files", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 256502}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L691-L720", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Create the field type mapping.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "conn", ".", "indices", ".", "put_mapping", "(", "index", "=", "arg_0", ".", "index", ",", "doc_type", "=", "arg_0", ".", "type", ",", "timeout", "=", "60", ",", "request_timeout", "=", "60", ",", "body", "=", "{", "arg_0", ".", "type", ":", "{", "'dynamic_templates'", ":", "[", "{", "'default_no_analyze_fc'", ":", "{", "'match'", ":", "'fc.*'", ",", "'mapping'", ":", "{", "'index'", ":", "'no'", "}", ",", "}", ",", "}", "]", ",", "'_all'", ":", "{", "'enabled'", ":", "False", ",", "}", ",", "'_id'", ":", "{", "'index'", ":", "'not_analyzed'", ",", "}", ",", "'properties'", ":", "arg_0", ".", "_get_index_mappings", "(", ")", ",", "}", ",", "}", ")", "arg_0", ".", "conn", ".", "cluster", ".", "health", "(", "index", "=", "arg_0", ".", "index", ",", "wait_for_status", "=", "'yellow'", ")"], "function": "def Func(arg_0):\n        'Create the field type mapping.'\n        arg_0.conn.indices.put_mapping(\n            index=arg_0.index, doc_type=arg_0.type,\n            timeout=60, request_timeout=60,\n            body={\n                arg_0.type: {\n                    'dynamic_templates': [{\n                        'default_no_analyze_fc': {\n                            'match': 'fc.*',\n                            'mapping': {'index': 'no'},\n                        },\n                    }],\n                    '_all': {\n                        'enabled': False,\n                    },\n                    '_id': {\n                        'index': 'not_analyzed',  # allows range queries\n                    },\n                    'properties': arg_0._get_index_mappings(),\n                },\n            })\n        # It is possible to create an index and quickly launch a request\n        # that will fail because the index hasn't been set up yet. Usually,\n        # you'll get a \"no active shards available\" error.\n        #\n        # Since index creation is a very rare operation (it only happens\n        # when the index doesn't already exist), we sit and wait for the\n        # cluster to become healthy.\n        arg_0.conn.cluster.health(index=arg_0.index, wait_for_status='yellow')", "path": "dossier/store/elastic.py", "identifier": "ElasticStore._create_mappings", "docstring": "Create the field type mapping.", "docstring_tokens": ["Create", "the", "field", "type", "mapping", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 256503}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/hooks.py#L86-L107", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Open the editor at the given filename, linenumber, column and\n    show an error message. This is used for correcting syntax errors.\n    The current implementation only has special support for the VIM editor,\n    and falls back on the 'editor' hook if VIM is not used.", "language": "python", "parameters": "(self,filename,linenum,column,msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "def", "vim_quickfix_file", "(", ")", ":", "arg_5", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "arg_5", ".", "write", "(", "'%s:%d:%d:%s\\n'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "arg_5", ".", "flush", "(", ")", "return", "arg_5", "if", "os", ".", "path", ".", "basename", "(", "arg_0", ".", "editor", ")", "!=", "'vim'", ":", "arg_0", ".", "hooks", ".", "editor", "(", "arg_1", ",", "arg_2", ")", "return", "arg_5", "=", "vim_quickfix_file", "(", ")", "try", ":", "if", "os", ".", "system", "(", "'vim --cmd \"set errorformat=%f:%l:%c:%m\" -q '", "+", "arg_5", ".", "name", ")", ":", "raise", "TryNext", "(", ")", "finally", ":", "arg_5", ".", "close", "(", ")"], "function": "def Func(arg_0,arg_1,arg_2,arg_3,arg_4):\n    \"\"\"Open the editor at the given filename, linenumber, column and\n    show an error message. This is used for correcting syntax errors.\n    The current implementation only has special support for the VIM editor,\n    and falls back on the 'editor' hook if VIM is not used.\n\n    Call ip.set_hook('Func',youfunc) to use your own function,\n    \"\"\"\n    def vim_quickfix_file():\n        arg_5 = tempfile.NamedTemporaryFile()\n        arg_5.write('%s:%d:%d:%s\\n' % (arg_1,arg_2,arg_3,arg_4))\n        arg_5.flush()\n        return arg_5\n    if os.path.basename(arg_0.editor) != 'vim':\n        arg_0.hooks.editor(arg_1,arg_2)\n        return\n    arg_5 = vim_quickfix_file()\n    try:\n        if os.system('vim --cmd \"set errorformat=%f:%l:%c:%m\" -q ' + arg_5.name):\n            raise TryNext()\n    finally:\n        arg_5.close()", "path": "environment/lib/python2.7/site-packages/IPython/core/hooks.py", "identifier": "fix_error_editor", "docstring": "Open the editor at the given filename, linenumber, column and\n    show an error message. This is used for correcting syntax errors.\n    The current implementation only has special support for the VIM editor,\n    and falls back on the 'editor' hook if VIM is not used.\n\n    Call ip.set_hook('fix_error_editor',youfunc) to use your own function,", "docstring_tokens": ["Open", "the", "editor", "at", "the", "given", "filename", "linenumber", "column", "and", "show", "an", "error", "message", ".", "This", "is", "used", "for", "correcting", "syntax", "errors", ".", "The", "current", "implementation", "only", "has", "special", "support", "for", "the", "VIM", "editor", "and", "falls", "back", "on", "the", "editor", "hook", "if", "VIM", "is", "not", "used", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256504}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/internal/util.py#L56-L63", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper which returns `True` if input is `collections.namedtuple`-like.", "language": "python", "parameters": "(x)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "for", "arg_1", "in", "arg_0", ".", "_fields", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "arg_1", ")", "return", "True", "except", "AttributeError", ":", "return", "False"], "function": "def Func(arg_0):\n  \"\"\"Helper which returns `True` if input is `collections.namedtuple`-like.\"\"\"\n  try:\n    for arg_1 in arg_0._fields:\n      arg_2 = getattr(arg_0, arg_1)\n    return True\n  except AttributeError:\n    return False", "path": "tensorflow_probability/python/mcmc/internal/util.py", "identifier": "is_namedtuple_like", "docstring": "Helper which returns `True` if input is `collections.namedtuple`-like.", "docstring_tokens": ["Helper", "which", "returns", "True", "if", "input", "is", "collections", ".", "namedtuple", "-", "like", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256505}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/logger.py#L57-L72", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "A factory method which can be overridden in subclasses to create\n        specialized LogRecords.", "language": "python", "parameters": "(self, name, level, fn, lno, msg, args, exc_info,\n                   func=None, extra=None, sinfo=None)", "return_statement": "return rv", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ")", ":", "if", "arg_1", ".", "startswith", "(", "\"streamlink\"", ")", ":", "arg_11", "=", "_LogRecord", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_10", ")", "else", ":", "arg_11", "=", "_CompatLogRecord", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_10", ")", "if", "arg_9", "is", "not", "None", ":", "for", "arg_12", "in", "arg_9", ":", "if", "(", "arg_12", "in", "[", "\"message\"", ",", "\"asctime\"", "]", ")", "or", "(", "arg_12", "in", "arg_11", ".", "__dict__", ")", ":", "raise", "KeyError", "(", "\"Attempt to overwrite %r in LogRecord\"", "%", "arg_12", ")", "arg_11", ".", "__dict__", "[", "arg_12", "]", "=", "arg_9", "[", "arg_12", "]", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7,\n                   arg_8=None, arg_9=None, arg_10=None):\n        \"\"\"\n        A factory method which can be overridden in subclasses to create\n        specialized LogRecords.\n        \"\"\"\n        if arg_1.startswith(\"streamlink\"):\n            arg_11 = _LogRecord(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_10)\n        else:\n            arg_11 = _CompatLogRecord(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_10)\n        if arg_9 is not None:\n            for arg_12 in arg_9:\n                if (arg_12 in [\"message\", \"asctime\"]) or (arg_12 in arg_11.__dict__):\n                    raise KeyError(\"Attempt to overwrite %r in LogRecord\" % arg_12)\n                arg_11.__dict__[arg_12] = arg_9[arg_12]\n        return arg_11", "path": "src/streamlink/logger.py", "identifier": "StreamlinkLogger.makeRecord", "docstring": "A factory method which can be overridden in subclasses to create\n        specialized LogRecords.", "docstring_tokens": ["A", "factory", "method", "which", "can", "be", "overridden", "in", "subclasses", "to", "create", "specialized", "LogRecords", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 256506}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/core.py#L136-L185", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Check the password validity.", "language": "python", "parameters": "(self, username, password, properties)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "logger", ".", "debug", "(", "\"Func{0!r}\"", ".", "format", "(", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", ")", "arg_4", ",", "arg_5", "=", "arg_0", ".", "get_password", "(", "arg_1", ",", "(", "u\"plain\"", ",", "u\"md5:user:realm:password\"", ")", ",", "arg_3", ")", "if", "arg_5", "==", "u\"plain\"", ":", "logger", ".", "debug", "(", "\"got plain password: {0!r}\"", ".", "format", "(", "arg_4", ")", ")", "return", "arg_4", "is", "not", "None", "and", "arg_2", "==", "arg_4", "elif", "arg_5", "in", "(", "u\"md5:user:realm:password\"", ")", ":", "logger", ".", "debug", "(", "\"got md5:user:realm:password password: {0!r}\"", ".", "format", "(", "arg_4", ")", ")", "arg_6", "=", "arg_3", ".", "get", "(", "\"realm\"", ")", "if", "arg_6", "is", "None", ":", "arg_6", "=", "\"\"", "else", ":", "arg_6", "=", "arg_6", ".", "encode", "(", "\"utf-8\"", ")", "arg_1", "=", "arg_1", ".", "encode", "(", "\"utf-8\"", ")", "arg_2", "=", "arg_2", ".", "encode", "(", "\"utf-8\"", ")", "arg_7", "=", "hashlib", ".", "md5", "(", "b\"%s:%s:%s\"", ")", ".", "hexdigest", "(", ")", "return", "arg_7", "==", "arg_4", "logger", ".", "debug", "(", "\"got password in unknown format: {0!r}\"", ".", "format", "(", "arg_5", ")", ")", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Check the password validity.\n\n        Used by plain-text authentication mechanisms.\n\n        Default implementation: retrieve a \"plain\" password for the `username`\n        and `realm` using `self.get_password` and compare it with the password\n        provided.\n\n        May be overridden e.g. to check the password against some external\n        authentication mechanism (PAM, LDAP, etc.).\n\n        :Parameters:\n            - `username`: the username for which the password verification is\n              requested.\n            - `password`: the password to verify.\n            - `properties`: mapping with authentication properties (those\n              provided to the authenticator's ``start()`` method plus some\n              already obtained via the mechanism).\n        :Types:\n            - `username`: `unicode`\n            - `password`: `unicode`\n            - `properties`: mapping\n\n        :return: `True` if the password is valid.\n        :returntype: `bool`\n        \"\"\"\n        logger.debug(\"Func{0!r}\".format(\n                                            (arg_1, arg_2, arg_3)))\n        arg_4, arg_5 = arg_0.get_password(arg_1,\n                    (u\"plain\", u\"md5:user:realm:password\"), arg_3)\n        if arg_5 == u\"plain\":\n            logger.debug(\"got plain password: {0!r}\".format(arg_4))\n            return arg_4 is not None and arg_2 == arg_4\n        elif arg_5 in (u\"md5:user:realm:password\"):\n            logger.debug(\"got md5:user:realm:password password: {0!r}\"\n                                                            .format(arg_4))\n            arg_6 = arg_3.get(\"realm\")\n            if arg_6 is None:\n                arg_6 = \"\"\n            else:\n                arg_6 = arg_6.encode(\"utf-8\")\n            arg_1 = arg_1.encode(\"utf-8\")\n            arg_2 = arg_2.encode(\"utf-8\")\n\n            # pylint: disable-msg=E1101\n            arg_7 = hashlib.md5(b\"%s:%s:%s\").hexdigest()\n            return arg_7 == arg_4\n        logger.debug(\"got password in unknown format: {0!r}\".format(arg_5))\n        return False", "path": "pyxmpp2/sasl/core.py", "identifier": "PasswordDatabase.check_password", "docstring": "Check the password validity.\n\n        Used by plain-text authentication mechanisms.\n\n        Default implementation: retrieve a \"plain\" password for the `username`\n        and `realm` using `self.get_password` and compare it with the password\n        provided.\n\n        May be overridden e.g. to check the password against some external\n        authentication mechanism (PAM, LDAP, etc.).\n\n        :Parameters:\n            - `username`: the username for which the password verification is\n              requested.\n            - `password`: the password to verify.\n            - `properties`: mapping with authentication properties (those\n              provided to the authenticator's ``start()`` method plus some\n              already obtained via the mechanism).\n        :Types:\n            - `username`: `unicode`\n            - `password`: `unicode`\n            - `properties`: mapping\n\n        :return: `True` if the password is valid.\n        :returntype: `bool`", "docstring_tokens": ["Check", "the", "password", "validity", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256507}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L26-L40", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Modal dialog asking for an input, returns string or None if cancelled", "language": "python", "parameters": "(message=\"\", title=\"\", default=\"\", multiline=False, password=None, \r\n           parent=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"\"", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "\"\"", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "arg_4", ":", "arg_6", "=", "wx", ".", "TE_PASSWORD", "|", "wx", ".", "OK", "|", "wx", ".", "CANCEL", "arg_7", "=", "dialogs", ".", "textEntryDialog", "(", "arg_5", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_6", ")", "elif", "arg_3", ":", "arg_6", "=", "wx", ".", "TE_MULTILINE", "|", "wx", ".", "OK", "|", "wx", ".", "CANCEL", "arg_7", "=", "dialogs", ".", "textEntryDialog", "(", "arg_5", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_6", ")", "arg_7", ".", "text", "=", "'\\n'", ".", "join", "(", "arg_7", ".", "text", ".", "splitlines", "(", ")", ")", "else", ":", "arg_7", "=", "dialogs", ".", "textEntryDialog", "(", "arg_5", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "if", "arg_7", ".", "accepted", ":", "return", "arg_7", ".", "text"], "function": "def Func(arg_0=\"\", arg_1=\"\", arg_2=\"\", arg_3=False, arg_4=None, \r\n           arg_5=None):\r\n    \"Modal dialog asking for an input, returns string or None if cancelled\"\r\n    if arg_4:\r\n        arg_6 = wx.TE_PASSWORD | wx.OK | wx.CANCEL\r\n        arg_7 = dialogs.textEntryDialog(arg_5, arg_0, arg_1, arg_2, arg_6)\r\n    elif arg_3:\r\n        arg_6 = wx.TE_MULTILINE | wx.OK | wx.CANCEL\r\n        arg_7 = dialogs.textEntryDialog(arg_5, arg_0, arg_1, arg_2, arg_6)\r\n        # workaround for Mac OS X\r\n        arg_7.text = '\\n'.join(arg_7.text.splitlines())\r\n    else:\r\n        arg_7 = dialogs.textEntryDialog(arg_5, arg_0, arg_1, arg_2)\r\n    if arg_7.accepted:\r\n        return arg_7.text", "path": "gui/dialog.py", "identifier": "prompt", "docstring": "Modal dialog asking for an input, returns string or None if cancelled", "docstring_tokens": ["Modal", "dialog", "asking", "for", "an", "input", "returns", "string", "or", "None", "if", "cancelled"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 256508}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L123-L141", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Serialize this segment to a ``Segment`` message.", "language": "python", "parameters": "(self)", "return_statement": "return segment", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "hangouts_pb2", ".", "Segment", "(", "type", "=", "arg_0", ".", "type_", ",", "text", "=", "arg_0", ".", "text", ",", "formatting", "=", "hangouts_pb2", ".", "Formatting", "(", "bold", "=", "arg_0", ".", "is_bold", ",", "italic", "=", "arg_0", ".", "is_italic", ",", "strikethrough", "=", "arg_0", ".", "is_strikethrough", ",", "underline", "=", "arg_0", ".", "is_underline", ",", ")", ",", ")", "if", "arg_0", ".", "link_target", "is", "not", "None", ":", "arg_1", ".", "link_data", ".", "link_target", "=", "arg_0", ".", "link_target", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Serialize this segment to a ``Segment`` message.\n\n        Returns:\n            ``Segment`` message.\n        \"\"\"\n        arg_1 = hangouts_pb2.Segment(\n            type=arg_0.type_,\n            text=arg_0.text,\n            formatting=hangouts_pb2.Formatting(\n                bold=arg_0.is_bold,\n                italic=arg_0.is_italic,\n                strikethrough=arg_0.is_strikethrough,\n                underline=arg_0.is_underline,\n            ),\n        )\n        if arg_0.link_target is not None:\n            arg_1.link_data.link_target = arg_0.link_target\n        return arg_1", "path": "hangups/conversation_event.py", "identifier": "ChatMessageSegment.serialize", "docstring": "Serialize this segment to a ``Segment`` message.\n\n        Returns:\n            ``Segment`` message.", "docstring_tokens": ["Serialize", "this", "segment", "to", "a", "Segment", "message", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 256509}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case.py#L459-L509", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update case id for a case across the database.", "language": "python", "parameters": "(self, case_obj, family_id)", "return_statement": "return new_case", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "deepcopy", "(", "arg_1", ")", "arg_3", "[", "'_id'", "]", "=", "arg_2", "for", "arg_4", "in", "[", "'suspects'", ",", "'causatives'", "]", ":", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_1", ".", "get", "(", "arg_4", ",", "[", "]", ")", ":", "arg_7", "=", "arg_0", ".", "variant", "(", "arg_6", ")", "if", "not", "arg_7", ":", "continue", "arg_8", "=", "get_variantid", "(", "arg_7", ",", "arg_2", ")", "arg_5", ".", "append", "(", "arg_8", ")", "arg_3", "[", "arg_4", "]", "=", "arg_5", "for", "arg_9", "in", "arg_0", ".", "acmg_collection", ".", "find", "(", "{", "'case_id'", ":", "arg_1", "[", "'_id'", "]", "}", ")", ":", "LOG", ".", "info", "(", "\"update ACMG classification: %s\"", ",", "arg_9", "[", "'classification'", "]", ")", "arg_10", "=", "arg_0", ".", "variant", "(", "arg_9", "[", "'variant_specific'", "]", ")", "arg_11", "=", "get_variantid", "(", "arg_10", ",", "arg_2", ")", "arg_0", ".", "acmg_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_9", "[", "'_id'", "]", "}", ",", "{", "'$set'", ":", "{", "'case_id'", ":", "arg_2", ",", "'variant_specific'", ":", "arg_11", "}", "}", ",", ")", "arg_12", "=", "arg_0", ".", "institute", "(", "arg_1", "[", "'owner'", "]", ")", "for", "arg_13", "in", "arg_0", ".", "events", "(", "arg_12", ",", "case", "=", "arg_1", ")", ":", "LOG", ".", "info", "(", "\"update event: %s\"", ",", "arg_13", "[", "'verb'", "]", ")", "arg_0", ".", "event_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_13", "[", "'_id'", "]", "}", ",", "{", "'$set'", ":", "{", "'case'", ":", "arg_2", "}", "}", ",", ")", "arg_0", ".", "case_collection", ".", "insert_one", "(", "arg_3", ")", "arg_0", ".", "case_collection", ".", "find_one_and_delete", "(", "{", "'_id'", ":", "arg_1", "[", "'_id'", "]", "}", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Update case id for a case across the database.\n\n        This function is used when a case is a rerun or updated for another reason.\n\n        Args:\n            case_obj(dict)\n            family_id(str): The new family id\n\n        Returns:\n            new_case(dict): The updated case object\n\n        \"\"\"\n        arg_3 = deepcopy(arg_1)\n        arg_3['_id'] = arg_2\n\n        # update suspects and causatives\n        for arg_4 in ['suspects', 'causatives']:\n            arg_5 = []\n            for arg_6 in arg_1.get(arg_4, []):\n                arg_7 = arg_0.variant(arg_6)\n                if not arg_7:\n                    continue\n                arg_8 = get_variantid(arg_7, arg_2)\n                arg_5.append(arg_8)\n            arg_3[arg_4] = arg_5\n\n        # update ACMG\n        for arg_9 in arg_0.acmg_collection.find({'case_id': arg_1['_id']}):\n            LOG.info(\"update ACMG classification: %s\", arg_9['classification'])\n            arg_10 = arg_0.variant(arg_9['variant_specific'])\n            arg_11 = get_variantid(arg_10, arg_2)\n            arg_0.acmg_collection.find_one_and_update(\n                {'_id': arg_9['_id']},\n                {'$set': {'case_id': arg_2, 'variant_specific': arg_11}},\n            )\n\n        # update events\n        arg_12 = arg_0.institute(arg_1['owner'])\n        for arg_13 in arg_0.events(arg_12, case=arg_1):\n            LOG.info(\"update event: %s\", arg_13['verb'])\n            arg_0.event_collection.find_one_and_update(\n                {'_id': arg_13['_id']},\n                {'$set': {'case': arg_2}},\n            )\n\n        # insert the updated case\n        arg_0.case_collection.insert_one(arg_3)\n        # delete the old case\n        arg_0.case_collection.find_one_and_delete({'_id': arg_1['_id']})\n        return arg_3", "path": "scout/adapter/mongo/case.py", "identifier": "CaseHandler.update_caseid", "docstring": "Update case id for a case across the database.\n\n        This function is used when a case is a rerun or updated for another reason.\n\n        Args:\n            case_obj(dict)\n            family_id(str): The new family id\n\n        Returns:\n            new_case(dict): The updated case object", "docstring_tokens": ["Update", "case", "id", "for", "a", "case", "across", "the", "database", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256510}
{"url": "https://github.com/bipsandbytes/django-api/blob/df99f4ccbb0c5128bd06da83f60881a85f6dbfe1/django_api/decorators.py#L122-L182", "sha": "df99f4ccbb0c5128bd06da83f60881a85f6dbfe1", "docstring_summary": "Define the return schema of an API.", "language": "python", "parameters": "(return_values)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapped_func", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_1", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "if", "not", "isinstance", "(", "arg_5", ",", "JsonResponse", ")", ":", "if", "settings", ".", "DEBUG", ":", "return", "JsonResponseBadRequest", "(", "'API did not return JSON'", ")", "else", ":", "logger", ".", "warn", "(", "'API did not return JSON'", ")", "arg_6", "=", "arg_0", ".", "keys", "(", ")", "arg_6", ".", "append", "(", "500", ")", "if", "arg_5", ".", "status_code", "not", "in", "arg_6", ":", "if", "settings", ".", "DEBUG", ":", "return", "JsonResponseBadRequest", "(", "'API returned %d instead of acceptable values %s'", "%", "(", "arg_5", ".", "status_code", ",", "arg_6", ")", ")", "else", ":", "logger", ".", "warn", "(", "'API returned %d instead of acceptable values %s'", ",", "arg_5", ".", "status_code", ",", "arg_6", ",", ")", "return", "arg_5", "return", "wrapped_func", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Define the return schema of an API.\n\n    'return_values' is a dictionary mapping\n    HTTP return code => documentation\n    In addition to validating that the status code of the response belongs to\n    one of the accepted status codes, it also validates that the returned\n    object is JSON (derived from JsonResponse)\n\n    In debug and test modes, failure to validate the fields will result in a\n    400 Bad Request response.\n    In production mode, failure to validate will just log a\n    warning, unless overwritten by a 'strict' setting.\n\n    For example:\n\n    @Func({\n        200: 'Operation successful',\n        403: 'User does not have persion',\n        404: 'Resource not found',\n        404: 'User not found',\n    })\n    def add(request, *args, **kwargs):\n        if not request.user.is_superuser:\n            return JsonResponseForbidden()  # 403\n\n        return HttpResponse()  # 200\n    \"\"\"\n    def decorator(arg_1):\n        @wraps(arg_1)\n        def wrapped_func(arg_2, *arg_3, **arg_4):\n            arg_5 = arg_1(arg_2, *arg_3, **arg_4)\n\n            if not isinstance(arg_5, JsonResponse):\n                if settings.DEBUG:\n                    return JsonResponseBadRequest('API did not return JSON')\n                else:\n                    logger.warn('API did not return JSON')\n\n            arg_6 = arg_0.keys()\n            # Never block 500s - these should be handled by other\n            # reporting mechanisms\n            arg_6.append(500)\n\n            if arg_5.status_code not in arg_6:\n                if settings.DEBUG:\n                    return JsonResponseBadRequest(\n                        'API returned %d instead of acceptable values %s' %\n                        (arg_5.status_code, arg_6)\n                    )\n                else:\n                    logger.warn(\n                        'API returned %d instead of acceptable values %s',\n                        arg_5.status_code,\n                        arg_6,\n                    )\n\n            return arg_5\n        return wrapped_func\n    return decorator", "path": "django_api/decorators.py", "identifier": "api_returns", "docstring": "Define the return schema of an API.\n\n    'return_values' is a dictionary mapping\n    HTTP return code => documentation\n    In addition to validating that the status code of the response belongs to\n    one of the accepted status codes, it also validates that the returned\n    object is JSON (derived from JsonResponse)\n\n    In debug and test modes, failure to validate the fields will result in a\n    400 Bad Request response.\n    In production mode, failure to validate will just log a\n    warning, unless overwritten by a 'strict' setting.\n\n    For example:\n\n    @api_returns({\n        200: 'Operation successful',\n        403: 'User does not have persion',\n        404: 'Resource not found',\n        404: 'User not found',\n    })\n    def add(request, *args, **kwargs):\n        if not request.user.is_superuser:\n            return JsonResponseForbidden()  # 403\n\n        return HttpResponse()  # 200", "docstring_tokens": ["Define", "the", "return", "schema", "of", "an", "API", "."], "nwo": "bipsandbytes/django-api", "score": 0.24979334806965703, "idx": 256511}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L455-L476", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Validates Collection information. Raises errors for required\n        properties.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_id", ":", "arg_1", "=", "\"No 'id' in Collection for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "not", "arg_0", ".", "_title", ":", "arg_1", "=", "\"No 'title' in Collection for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "_can_read", "is", "None", ":", "arg_1", "=", "\"No 'can_read' in Collection for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "_can_write", "is", "None", ":", "arg_1", "=", "\"No 'can_write' in Collection for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "_id", "not", "in", "arg_0", ".", "url", ":", "arg_1", "=", "\"The collection '{}' does not match the url for queries '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "_id", ",", "arg_0", ".", "url", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Validates Collection information. Raises errors for required\n        properties.\"\"\"\n        if not arg_0._id:\n            arg_1 = \"No 'id' in Collection for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if not arg_0._title:\n            arg_1 = \"No 'title' in Collection for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0._can_read is None:\n            arg_1 = \"No 'can_read' in Collection for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0._can_write is None:\n            arg_1 = \"No 'can_write' in Collection for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0._id not in arg_0.url:\n            arg_1 = \"The collection '{}' does not match the url for queries '{}'\"\n            raise ValidationError(arg_1.format(arg_0._id, arg_0.url))", "path": "taxii2client/__init__.py", "identifier": "Collection._validate_collection", "docstring": "Validates Collection information. Raises errors for required\n        properties.", "docstring_tokens": ["Validates", "Collection", "information", ".", "Raises", "errors", "for", "required", "properties", "."], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 256512}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/risk.py#L382-L405", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots outputs of compute_cap_exposures as line graphs", "language": "python", "parameters": "(net_exposures, ax=None)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "plt", ".", "gca", "(", ")", "arg_2", "=", "plt", ".", "cm", ".", "gist_rainbow", "(", "np", ".", "linspace", "(", "0", ",", "1", ",", "5", ")", ")", "arg_3", "=", "CAP_BUCKETS", ".", "keys", "(", ")", "for", "arg_4", "in", "range", "(", "len", "(", "arg_0", ")", ")", ":", "arg_1", ".", "plot", "(", "arg_0", "[", "arg_4", "]", ",", "color", "=", "arg_2", "[", "arg_4", "]", ",", "alpha", "=", "0.8", ",", "label", "=", "arg_3", "[", "arg_4", "]", ")", "arg_1", ".", "axhline", "(", "0", ",", "color", "=", "'k'", ",", "linestyle", "=", "'-'", ")", "arg_1", ".", "set", "(", "title", "=", "'Net exposure to market caps'", ",", "ylabel", "=", "'Proportion of net exposure \\n in market cap buckets'", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Plots outputs of compute_cap_exposures as line graphs\n\n    Parameters\n    ----------\n    net_exposures : array\n        Arrays of gross market cap exposures (output of compute_cap_exposures).\n    \"\"\"\n\n    if arg_1 is None:\n        arg_1 = plt.gca()\n\n    arg_2 = plt.cm.gist_rainbow(np.linspace(0, 1, 5))\n\n    arg_3 = CAP_BUCKETS.keys()\n    for arg_4 in range(len(arg_0)):\n        arg_1.plot(arg_0[arg_4], color=arg_2[arg_4], alpha=0.8,\n                label=arg_3[arg_4])\n    arg_1.axhline(0, color='k', linestyle='-')\n    arg_1.set(title='Net exposure to market caps',\n           ylabel='Proportion of net exposure \\n in market cap buckets')\n\n    return arg_1", "path": "pyfolio/risk.py", "identifier": "plot_cap_exposures_net", "docstring": "Plots outputs of compute_cap_exposures as line graphs\n\n    Parameters\n    ----------\n    net_exposures : array\n        Arrays of gross market cap exposures (output of compute_cap_exposures).", "docstring_tokens": ["Plots", "outputs", "of", "compute_cap_exposures", "as", "line", "graphs"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 256513}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/acts/documentation.py#L350-L352", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Upload docs in ``docs_base`` to the target of this uploader.", "language": "python", "parameters": "(self, docs_base, release)", "return_statement": "return getattr(self, '_to_' + self.target)(docs_base, release)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "getattr", "(", "arg_0", ",", "'_to_'", "+", "arg_0", ".", "target", ")", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Upload docs in ``docs_base`` to the target of this Funcer.\"\"\"\n        return getattr(arg_0, '_to_' + arg_0.target)(arg_1, arg_2)", "path": "src/rituals/acts/documentation.py", "identifier": "DocsUploader.upload", "docstring": "Upload docs in ``docs_base`` to the target of this uploader.", "docstring_tokens": ["Upload", "docs", "in", "docs_base", "to", "the", "target", "of", "this", "uploader", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 256514}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/mpi_util.py#L87-L108", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Perform a reduction operation over dicts", "language": "python", "parameters": "(comm, d, op='mean', assert_all_have_data=True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'mean'", ",", "arg_3", "=", "True", ")", ":", "if", "arg_0", "is", "None", ":", "return", "arg_1", "arg_4", "=", "arg_0", ".", "allgather", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "size", "arg_6", "=", "defaultdict", "(", "list", ")", "for", "arg_1", "in", "arg_4", ":", "for", "(", "arg_7", ",", "arg_8", ")", "in", "arg_1", ".", "items", "(", ")", ":", "arg_6", "[", "arg_7", "]", ".", "append", "(", "arg_8", ")", "arg_9", "=", "{", "}", "for", "(", "arg_7", ",", "arg_10", ")", "in", "arg_6", ".", "items", "(", ")", ":", "if", "arg_3", ":", "assert", "len", "(", "arg_10", ")", "==", "arg_5", ",", "\"only %i out of %i MPI workers have sent '%s'\"", "%", "(", "len", "(", "arg_10", ")", ",", "arg_5", ",", "arg_7", ")", "if", "arg_2", "==", "'mean'", ":", "arg_9", "[", "arg_7", "]", "=", "np", ".", "mean", "(", "arg_10", ",", "axis", "=", "0", ")", "elif", "arg_2", "==", "'sum'", ":", "arg_9", "[", "arg_7", "]", "=", "np", ".", "sum", "(", "arg_10", ",", "axis", "=", "0", ")", "else", ":", "assert", "0", ",", "arg_2", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2='mean', arg_3=True):\n    \"\"\"\n    Perform a reduction operation over dicts\n    \"\"\"\n    if arg_0 is None: return arg_1\n    arg_4 = arg_0.allgather(arg_1)\n    arg_5 = arg_0.size\n    arg_6 = defaultdict(list)\n    for arg_1 in arg_4:\n        for (arg_7,arg_8) in arg_1.items():\n            arg_6[arg_7].append(arg_8)\n    arg_9 = {}\n    for (arg_7,arg_10) in arg_6.items():\n        if arg_3:\n            assert len(arg_10)==arg_5, \"only %i out of %i MPI workers have sent '%s'\" % (len(arg_10), arg_5, arg_7)\n        if arg_2=='mean':\n            arg_9[arg_7] = np.mean(arg_10, axis=0)\n        elif arg_2=='sum':\n            arg_9[arg_7] = np.sum(arg_10, axis=0)\n        else:\n            assert 0, arg_2\n    return arg_9", "path": "baselines/common/mpi_util.py", "identifier": "dict_gather", "docstring": "Perform a reduction operation over dicts", "docstring_tokens": ["Perform", "a", "reduction", "operation", "over", "dicts"], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 256515}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L548-L594", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Creates a virtual machine instance.", "language": "python", "parameters": "(name=None, group=None, config=None, extra=0, verbose=0, backend_opts=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ",", "arg_5", "=", "None", ")", ":", "require", "(", "'vm_type'", ",", "'vm_group'", ")", "arg_5", "=", "arg_5", "or", "{", "}", "arg_4", "=", "int", "(", "arg_4", ")", "arg_3", "=", "int", "(", "arg_3", ")", "if", "arg_2", ":", "arg_6", "=", "common", ".", "find_template", "(", "arg_2", ")", "arg_2", "=", "yaml", ".", "load", "(", "open", "(", "arg_6", ")", ")", "arg_7", ".", "update", "(", "arg_2", ")", "arg_7", ".", "vm_type", "=", "(", "arg_7", ".", "vm_type", "or", "''", ")", ".", "lower", "(", ")", "assert", "arg_7", ".", "vm_type", ",", "'No VM type specified.'", "arg_1", "=", "arg_1", "or", "arg_7", ".", "vm_group", "assert", "arg_1", ",", "'No VM group specified.'", "arg_9", "=", "exists", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", "if", "not", "arg_3", "and", "arg_9", ":", "if", "arg_4", ":", "print", "(", "'VM %s:%s exists.'", "%", "(", "arg_0", ",", "arg_1", ")", ")", "return", "arg_9", "arg_10", "=", "datetime", ".", "date", ".", "today", "(", ")", "arg_11", "=", "int", "(", "'%i%02i%02i'", "%", "(", "arg_10", ".", "year", ",", "arg_10", ".", "month", ",", "arg_10", ".", "day", ")", ")", "if", "not", "arg_0", ":", "arg_12", "=", "list_instances", "(", "arg_1", "=", "arg_1", ",", "arg_11", "=", "arg_11", ",", "arg_4", "=", "arg_4", ")", "arg_0", "=", "arg_7", ".", "vm_name_template", ".", "format", "(", "index", "=", "len", "(", "arg_12", ")", "+", "1", ")", "if", "arg_7", ".", "vm_type", "==", "EC2", ":", "return", "Func_ec2_instance", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_11", "=", "arg_11", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "else", ":", "raise", "NotImplementedError"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3=0, arg_4=0, arg_5=None):\n    \"\"\"\n    Creates a virtual machine instance.\n    \"\"\"\n    require('vm_type', 'vm_group')\n\n    arg_5 = arg_5 or {}\n\n    arg_4 = int(arg_4)\n    arg_3 = int(arg_3)\n\n    if arg_2:\n        arg_6 = common.find_template(arg_2)\n        arg_2 = yaml.load(open(arg_6))\n        arg_7.update(arg_2)\n\n    arg_7.vm_type = (arg_7.vm_type or '').lower()\n    assert arg_7.vm_type, 'No VM type specified.'\n\n    arg_1 = arg_1 or arg_7.vm_group\n    assert arg_1, 'No VM group specified.'\n\n    arg_9 = exists(arg_0=arg_0, arg_1=arg_1)\n    if not arg_3 and arg_9:\n        if arg_4:\n            print('VM %s:%s exists.' % (arg_0, arg_1))\n        return arg_9\n\n    arg_10 = datetime.date.today()\n    arg_11 = int('%i%02i%02i' % (arg_10.year, arg_10.month, arg_10.day))\n\n    if not arg_0:\n        arg_12 = list_instances(\n            arg_1=arg_1,\n            arg_11=arg_11,\n            arg_4=arg_4)\n        arg_0 = arg_7.vm_name_template.format(index=len(arg_12)+1)\n\n    if arg_7.vm_type == EC2:\n        return Func_ec2_instance(\n            arg_0=arg_0,\n            arg_1=arg_1,\n            arg_11=arg_11,\n            arg_4=arg_4,\n            arg_5=arg_5)\n    else:\n        raise NotImplementedError", "path": "burlap/vm.py", "identifier": "get_or_create", "docstring": "Creates a virtual machine instance.", "docstring_tokens": ["Creates", "a", "virtual", "machine", "instance", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256516}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L675-L707", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Star slave nodes", "language": "python", "parameters": "(slaves, cl_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "Log", ".", "info", "(", "\"Starting slave on %s\"", "%", "arg_3", ")", "arg_4", "=", "\"%s agent -config %s >> /tmp/nomad_client.log 2>&1 &\"", "%", "(", "get_nomad_path", "(", "arg_1", ")", ",", "get_nomad_slave_config_file", "(", "arg_1", ")", ")", "if", "not", "is_self", "(", "arg_3", ")", ":", "arg_4", "=", "ssh_remote_execute", "(", "arg_4", ",", "arg_3", ",", "arg_1", ")", "Log", ".", "debug", "(", "arg_4", ")", "arg_5", "=", "subprocess", ".", "Popen", "(", "arg_4", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_2", ".", "append", "(", "{", "\"pid\"", ":", "arg_5", ",", "\"dest\"", ":", "arg_3", "}", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_2", ":", "arg_5", "=", "arg_7", "[", "\"pid\"", "]", "arg_8", "=", "arg_5", ".", "wait", "(", ")", "arg_9", "=", "arg_5", ".", "communicate", "(", ")", "Log", ".", "debug", "(", "\"return code: %s output: %s\"", "%", "(", "arg_8", ",", "arg_9", ")", ")", "if", "arg_8", "!=", "0", ":", "arg_6", ".", "append", "(", "\"Failed to start slave on %s with error:\\n%s\"", "%", "(", "arg_7", "[", "\"dest\"", "]", ",", "arg_9", "[", "1", "]", ")", ")", "if", "arg_6", ":", "for", "arg_10", "in", "arg_6", ":", "Log", ".", "error", "(", "arg_10", ")", "sys", ".", "exit", "(", "-", "1", ")", "Log", ".", "info", "(", "\"Done starting slaves\"", ")"], "function": "def Func(arg_0, arg_1):\n  '''\n  Star slave nodes\n  '''\n  arg_2 = []\n  for arg_3 in arg_0:\n    Log.info(\"Starting slave on %s\" % arg_3)\n    arg_4 = \"%s agent -config %s >> /tmp/nomad_client.log 2>&1 &\" \\\n          % (get_nomad_path(arg_1), get_nomad_slave_config_file(arg_1))\n    if not is_self(arg_3):\n      arg_4 = ssh_remote_execute(arg_4, arg_3, arg_1)\n    Log.debug(arg_4)\n    arg_5 = subprocess.Popen(arg_4,\n                           shell=True,\n                           stdout=subprocess.PIPE,\n                           stderr=subprocess.PIPE)\n    arg_2.append({\"pid\": arg_5, \"dest\": arg_3})\n\n  arg_6 = []\n  for arg_7 in arg_2:\n    arg_5 = arg_7[\"pid\"]\n    arg_8 = arg_5.wait()\n    arg_9 = arg_5.communicate()\n    Log.debug(\"return code: %s output: %s\" % (arg_8, arg_9))\n    if arg_8 != 0:\n      arg_6.append(\"Failed to start slave on %s with error:\\n%s\" % (arg_7[\"dest\"], arg_9[1]))\n\n  if arg_6:\n    for arg_10 in arg_6:\n      Log.error(arg_10)\n    sys.exit(-1)\n\n  Log.info(\"Done starting slaves\")", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "start_slave_nodes", "docstring": "Star slave nodes", "docstring_tokens": ["Star", "slave", "nodes"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256517}
{"url": "https://github.com/athre0z/wasm/blob/bc9c7e3f40242a2a8fc9650c4b994f0cddf8d755/wasm/decode.py#L32-L62", "sha": "bc9c7e3f40242a2a8fc9650c4b994f0cddf8d755", "docstring_summary": "Decodes raw WASM modules, yielding `ModuleFragment`s.", "language": "python", "parameters": "(module, decode_name_subsections=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "memoryview", "(", "arg_0", ")", "arg_3", "=", "ModuleHeader", "(", ")", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_3", ".", "from_raw", "(", "None", ",", "arg_2", ")", "yield", "ModuleFragment", "(", "arg_3", ",", "arg_5", ")", "arg_2", "=", "arg_2", "[", "arg_4", ":", "]", "while", "arg_2", ":", "arg_7", "=", "Section", "(", ")", "arg_8", ",", "arg_9", ",", "arg_6", "=", "arg_7", ".", "from_raw", "(", "None", ",", "arg_2", ")", "if", "(", "arg_1", "and", "arg_9", ".", "id", "==", "SEC_UNK", "and", "arg_9", ".", "name", "==", "SEC_NAME", ")", ":", "arg_10", "=", "arg_9", ".", "payload", "while", "arg_10", ":", "arg_11", "=", "NameSubSection", "(", ")", "arg_12", ",", "arg_13", ",", "arg_6", "=", "arg_11", ".", "from_raw", "(", "None", ",", "arg_10", ")", "yield", "ModuleFragment", "(", "arg_11", ",", "arg_13", ")", "arg_10", "=", "arg_10", "[", "arg_12", ":", "]", "else", ":", "yield", "ModuleFragment", "(", "arg_7", ",", "arg_9", ")", "arg_2", "=", "arg_2", "[", "arg_8", ":", "]"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"Decodes raw WASM modules, yielding `ModuleFragment`s.\"\"\"\n    arg_2 = memoryview(arg_0)\n\n    # Read & yield module header.\n    arg_3 = ModuleHeader()\n    arg_4, arg_5, arg_6 = arg_3.from_raw(None, arg_2)\n    yield ModuleFragment(arg_3, arg_5)\n    arg_2 = arg_2[arg_4:]\n\n    # Read & yield sections.\n    while arg_2:\n        arg_7 = Section()\n        arg_8, arg_9, arg_6 = arg_7.from_raw(None, arg_2)\n\n        # If requested, decode name subsections when encountered.\n        if (\n            arg_1 and\n            arg_9.id == SEC_UNK and\n            arg_9.name == SEC_NAME\n        ):\n            arg_10 = arg_9.payload\n            while arg_10:\n                arg_11 = NameSubSection()\n                arg_12, arg_13, arg_6 = arg_11.from_raw(None, arg_10)\n                yield ModuleFragment(arg_11, arg_13)\n                arg_10 = arg_10[arg_12:]\n        else:\n            yield ModuleFragment(arg_7, arg_9)\n\n        arg_2 = arg_2[arg_8:]", "path": "wasm/decode.py", "identifier": "decode_module", "docstring": "Decodes raw WASM modules, yielding `ModuleFragment`s.", "docstring_tokens": ["Decodes", "raw", "WASM", "modules", "yielding", "ModuleFragment", "s", "."], "nwo": "athre0z/wasm", "score": 0.600676070259598, "idx": 256518}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/html.py#L141-L147", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Write `html` to `fname`, properly encoded.", "language": "python", "parameters": "(self, fname, html)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "open", "(", "arg_1", ",", "\"wb\"", ")", "try", ":", "arg_3", ".", "write", "(", "arg_2", ".", "encode", "(", "'ascii'", ",", "'xmlcharrefreplace'", ")", ")", "finally", ":", "arg_3", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Write `html` to `fname`, properly encoded.\"\"\"\n        arg_3 = open(arg_1, \"wb\")\n        try:\n            arg_3.write(arg_2.encode('ascii', 'xmlcharrefreplace'))\n        finally:\n            arg_3.close()", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/html.py", "identifier": "HtmlReporter.write_html", "docstring": "Write `html` to `fname`, properly encoded.", "docstring_tokens": ["Write", "html", "to", "fname", "properly", "encoded", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256519}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/admin/api/router.py#L6-L14", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Register the API view class in the bananas router.", "language": "python", "parameters": "(view)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_admin_meta", "(", ")", "arg_2", "=", "arg_1", ".", "basename", ".", "replace", "(", "\".\"", ",", "\"/\"", ")", "router", ".", "Func", "(", "arg_2", ",", "arg_0", ",", "arg_1", ".", "basename", ")"], "function": "def Func(arg_0):  # Type[BananasAPI]\n    \"\"\"\n    Register the API view class in the bananas router.\n\n    :param BananasAPI view:\n    \"\"\"\n    arg_1 = arg_0.get_admin_meta()\n    arg_2 = arg_1.basename.replace(\".\", \"/\")\n    router.Func(arg_2, arg_0, arg_1.basename)", "path": "bananas/admin/api/router.py", "identifier": "register", "docstring": "Register the API view class in the bananas router.\n\n    :param BananasAPI view:", "docstring_tokens": ["Register", "the", "API", "view", "class", "in", "the", "bananas", "router", "."], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 256520}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/dims.py#L40-L55", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Builds the dict mapping point format id to numpy.dtype\n    In the dtypes, bit fields are unpacked and can be accessed directly", "language": "python", "parameters": "(\n        point_formats_dimensions, composed_fields_dict, dimensions_dict\n)", "return_statement": "return unpacked_dtypes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "items", "(", ")", ":", "arg_6", ",", "arg_7", "=", "arg_1", "[", "arg_4", "]", ",", "[", "]", "for", "arg_8", "in", "arg_5", ":", "if", "arg_8", "in", "arg_6", ":", "arg_7", ".", "extend", "(", "(", "arg_9", ".", "name", ",", "arg_9", ".", "type", ")", "for", "arg_9", "in", "arg_6", "[", "arg_8", "]", ")", "else", ":", "arg_7", ".", "append", "(", "arg_2", "[", "arg_8", "]", ")", "arg_3", "[", "arg_4", "]", "=", "np", ".", "dtype", "(", "arg_7", ")", "return", "arg_3"], "function": "def Func(\n        arg_0, arg_1, arg_2\n):\n    \"\"\" Builds the dict mapping point format id to numpy.dtype\n    In the dtypes, bit fields are unpacked and can be accessed directly\n    \"\"\"\n    arg_3 = {}\n    for arg_4, arg_5 in arg_0.items():\n        arg_6, arg_7 = arg_1[arg_4], []\n        for arg_8 in arg_5:\n            if arg_8 in arg_6:\n                arg_7.extend((arg_9.name, arg_9.type) for arg_9 in arg_6[arg_8])\n            else:\n                arg_7.append(arg_2[arg_8])\n        arg_3[arg_4] = np.dtype(arg_7)\n    return arg_3", "path": "pylas/point/dims.py", "identifier": "_build_unpacked_point_formats_dtypes", "docstring": "Builds the dict mapping point format id to numpy.dtype\n    In the dtypes, bit fields are unpacked and can be accessed directly", "docstring_tokens": ["Builds", "the", "dict", "mapping", "point", "format", "id", "to", "numpy", ".", "dtype", "In", "the", "dtypes", "bit", "fields", "are", "unpacked", "and", "can", "be", "accessed", "directly"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 256521}
{"url": "https://github.com/ankitmathur3193/song-cli/blob/ca8ccfe547e9d702313ff6d14e81ae4355989a67/song/commands/MusicWebsiteParser/MrJattParser.py#L47-L76", "sha": "ca8ccfe547e9d702313ff6d14e81ae4355989a67", "docstring_summary": "Returns true if user entered artist or movie name", "language": "python", "parameters": "(self,html)", "return_statement": "return (False,href)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "BeautifulSoup", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "findAll", "(", "'a'", ",", "'touch'", ")", "arg_4", "=", "[", "str", "(", "x", ")", "for", "x", "in", "arg_3", "]", "arg_4", "=", "''", ".", "join", "(", "arg_4", ")", "arg_4", "=", "arg_4", ".", "lower", "(", ")", "arg_5", "=", "'download in 48 kbps'", "arg_6", "=", "'download in 128 kbps'", "arg_7", "=", "'download in 320 kbps'", "arg_8", "=", "''", "if", "arg_7", "in", "arg_4", ":", "arg_8", "=", "arg_3", "[", "2", "]", ".", "get", "(", "'href'", ")", "elif", "arg_6", "in", "arg_4", ":", "arg_8", "=", "arg_3", "[", "1", "]", ".", "get", "(", "'href'", ")", "elif", "arg_5", "in", "arg_4", ":", "arg_8", "=", "arg_3", "[", "0", "]", ".", "get", "(", "'href'", ")", "else", ":", "return", "(", "True", ",", "'nothing'", ")", "return", "(", "False", ",", "arg_8", ")"], "function": "def Func(arg_0,arg_1):\n\t\t'''\n\t\tReturns true if user entered artist or movie name\n\t\t'''\n\t\targ_2=BeautifulSoup(arg_1)\n\t\targ_3=arg_2.findAll('a','touch')\n\t\t#print a_list\n\t\targ_4=[str(x) for x in arg_3]\n\t\targ_4=''.join(arg_4)\n\t\targ_4=arg_4.lower()\n\t\targ_5='download in 48 kbps'\n\t\targ_6='download in 128 kbps'\n\t\targ_7='download in 320 kbps'\n\n\t\targ_8=''\n\t\tif arg_7 in arg_4:\n\t\t\t#print 'Downloading in 320 kbps'\n\t\t\targ_8=arg_3[2].get('href')\n\t\t\t\n\t\telif arg_6 in arg_4:\n\t\t\t#print 'Downloading in 128 kbps'\n\t\t\targ_8=arg_3[1].get('href')\n\t\t\t\n\t\telif arg_5 in arg_4:\n\t\t\t#print 'Downloading in 48 kbps'\t\n\t\t\targ_8=arg_3[0].get('href')\n\t\telse:\n\t\t\treturn (True,'nothing')\t\t\n\n\t\treturn (False,arg_8)", "path": "song/commands/MusicWebsiteParser/MrJattParser.py", "identifier": "MrJattParser.check_if_song_name", "docstring": "Returns true if user entered artist or movie name", "docstring_tokens": ["Returns", "true", "if", "user", "entered", "artist", "or", "movie", "name"], "nwo": "ankitmathur3193/song-cli", "score": 0.1872672106339659, "idx": 256522}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_server.py#L104-L114", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Start the servers", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "route", "(", "\"/\"", ")", "(", "arg_0", ".", "serve", ")", "if", "arg_0", ".", "config", ".", "html", ":", "route", "(", "\"/<filepath:path>\"", ")", "(", "arg_0", ".", "custom_html", ")", "if", "arg_0", ".", "config", ".", "fuzz_web", ":", "arg_0", ".", "request_checker", ".", "start", "(", ")", "arg_0", ".", "httpd", ".", "start", "(", ")", "arg_0", ".", "httpsd", ".", "start", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Start the servers\n        \"\"\"\n        route(\"/\")(arg_0.serve)\n        if arg_0.config.html:\n            route(\"/<filepath:path>\")(arg_0.custom_html)\n        if arg_0.config.fuzz_web:\n            arg_0.request_checker.start()\n        arg_0.httpd.start()\n        arg_0.httpsd.start()", "path": "pyjfuzz/core/pjf_server.py", "identifier": "PJFServer.run", "docstring": "Start the servers", "docstring_tokens": ["Start", "the", "servers"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 256523}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/telegram.py#L125-L132", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Lookup chat_id of username if chat_id is unknown via API call.", "language": "python", "parameters": "(self, username)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "not", "None", ":", "arg_2", "=", "requests", ".", "get", "(", "arg_0", ".", "base_url", "+", "\"/getUpdates\"", ")", ".", "json", "(", ")", "arg_3", "=", "arg_1", ".", "split", "(", "\"@\"", ")", "[", "-", "1", "]", "for", "arg_4", "in", "arg_2", "[", "\"result\"", "]", ":", "if", "arg_4", "[", "\"message\"", "]", "[", "\"from\"", "]", "[", "\"username\"", "]", "==", "arg_3", ":", "return", "arg_4", "[", "\"message\"", "]", "[", "\"from\"", "]", "[", "\"id\"", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Lookup chat_id of username if chat_id is unknown via API call.\"\"\"\n        if arg_1 is not None:\n            arg_2 = requests.get(arg_0.base_url + \"/getUpdates\").json()\n            arg_3 = arg_1.split(\"@\")[-1]\n            for arg_4 in arg_2[\"result\"]:\n                if arg_4[\"message\"][\"from\"][\"username\"] == arg_3:\n                    return arg_4[\"message\"][\"from\"][\"id\"]", "path": "messages/telegram.py", "identifier": "TelegramBot.get_chat_id", "docstring": "Lookup chat_id of username if chat_id is unknown via API call.", "docstring_tokens": ["Lookup", "chat_id", "of", "username", "if", "chat_id", "is", "unknown", "via", "API", "call", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 256524}
{"url": "https://github.com/shaunduncan/giphypop/blob/21e7f51c4f000ae24be3805b7eeec52bcce3d390/giphypop.py#L256-L268", "sha": "21e7f51c4f000ae24be3805b7eeec52bcce3d390", "docstring_summary": "Wrapper for making an api request from giphy", "language": "python", "parameters": "(self, endpoint_name, **params)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", "[", "'api_key'", "]", "=", "arg_0", ".", "api_key", "arg_3", "=", "requests", ".", "get", "(", "arg_0", ".", "_endpoint", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")", "arg_3", ".", "raise_for_status", "(", ")", "arg_4", "=", "arg_3", ".", "json", "(", ")", "arg_0", ".", "_check_or_raise", "(", "arg_4", ".", "get", "(", "'meta'", ",", "{", "}", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Wrapper for making an api request from giphy\n        \"\"\"\n        arg_2['api_key'] = arg_0.api_key\n\n        arg_3 = requests.get(arg_0._endpoint(arg_1), arg_2=arg_2)\n        arg_3.raise_for_status()\n\n        arg_4 = arg_3.json()\n        arg_0._check_or_raise(arg_4.get('meta', {}))\n\n        return arg_4", "path": "giphypop.py", "identifier": "Giphy._fetch", "docstring": "Wrapper for making an api request from giphy", "docstring_tokens": ["Wrapper", "for", "making", "an", "api", "request", "from", "giphy"], "nwo": "shaunduncan/giphypop", "score": 0.19428525902463561, "idx": 256525}
{"url": "https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/splunk.py#L125-L159", "sha": "ecc9fd434c23d896ccd1f35795ccc047f946ed05", "docstring_summary": "Saves forensic DMARC reports to Splunk", "language": "python", "parameters": "(self, forensic_reports)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"Saving forensic reports to Splunk\"", ")", "if", "type", "(", "arg_1", ")", "==", "dict", ":", "arg_1", "=", "[", "arg_1", "]", "if", "len", "(", "arg_1", ")", "<", "1", ":", "return", "arg_2", "=", "\"\"", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "_common_data", ".", "copy", "(", ")", "arg_4", "[", "\"sourcetype\"", "]", "=", "\"dmarc:forensic\"", "arg_5", "=", "human_timestamp_to_timestamp", "(", "arg_3", "[", "\"arrival_date_utc\"", "]", ")", "arg_4", "[", "\"time\"", "]", "=", "arg_5", "arg_4", "[", "\"event\"", "]", "=", "arg_3", ".", "copy", "(", ")", "arg_2", "+=", "\"{0}\\n\"", ".", "format", "(", "json", ".", "dumps", "(", "arg_4", ")", ")", "if", "not", "arg_0", ".", "session", ".", "verify", ":", "logger", ".", "debug", "(", "\"Skipping certificate verification for Splunk HEC\"", ")", "try", ":", "arg_6", "=", "arg_0", ".", "session", ".", "post", "(", "arg_0", ".", "url", ",", "arg_4", "=", "arg_2", ",", "timeout", "=", "arg_0", ".", "timeout", ")", "arg_6", "=", "arg_6", ".", "json", "(", ")", "except", "Exception", "as", "e", ":", "raise", "SplunkError", "(", "e", ".", "__str__", "(", ")", ")", "if", "arg_6", "[", "\"code\"", "]", "!=", "0", ":", "raise", "SplunkError", "(", "arg_6", "[", "\"text\"", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Saves forensic DMARC reports to Splunk\n\n        Args:\n            forensic_reports (list):  A list of forensic report dictionaries\n            to save in Splunk\n        \"\"\"\n        logger.debug(\"Saving forensic reports to Splunk\")\n        if type(arg_1) == dict:\n            arg_1 = [arg_1]\n\n        if len(arg_1) < 1:\n            return\n\n        arg_2 = \"\"\n        for arg_3 in arg_1:\n            arg_4 = arg_0._common_data.copy()\n            arg_4[\"sourcetype\"] = \"dmarc:forensic\"\n            arg_5 = human_timestamp_to_timestamp(\n                arg_3[\"arrival_date_utc\"])\n            arg_4[\"time\"] = arg_5\n            arg_4[\"event\"] = arg_3.copy()\n            arg_2 += \"{0}\\n\".format(json.dumps(arg_4))\n\n        if not arg_0.session.verify:\n            logger.debug(\"Skipping certificate verification for Splunk HEC\")\n        try:\n            arg_6 = arg_0.session.post(arg_0.url, arg_4=arg_2,\n                                         timeout=arg_0.timeout)\n            arg_6 = arg_6.json()\n        except Exception as e:\n            raise SplunkError(e.__str__())\n        if arg_6[\"code\"] != 0:\n            raise SplunkError(arg_6[\"text\"])", "path": "parsedmarc/splunk.py", "identifier": "HECClient.save_forensic_reports_to_splunk", "docstring": "Saves forensic DMARC reports to Splunk\n\n        Args:\n            forensic_reports (list):  A list of forensic report dictionaries\n            to save in Splunk", "docstring_tokens": ["Saves", "forensic", "DMARC", "reports", "to", "Splunk"], "nwo": "domainaware/parsedmarc", "score": 0.7452768887820926, "idx": 256526}
{"url": "https://github.com/blink1073/oct2py/blob/bfc69d2168ae3d98258f95bbc55a858c21836b58/oct2py/core.py#L668-L679", "sha": "bfc69d2168ae3d98258f95bbc55a858c21836b58", "docstring_summary": "Test whether a name exists and return the name code.\r\n\r\n        Raises an error when the name does not exist.", "language": "python", "parameters": "(self, name)", "return_statement": "return exist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'exist(\"%s\")'", "%", "arg_1", "arg_3", "=", "arg_0", ".", "_engine", ".", "eval", "(", "arg_2", ",", "silent", "=", "True", ")", ".", "strip", "(", ")", "arg_4", "=", "int", "(", "arg_3", ".", "split", "(", ")", "[", "-", "1", "]", ")", "if", "arg_4", "==", "0", ":", "arg_5", "=", "'Value \"%s\" does not exist in Octave workspace'", "raise", "Oct2PyError", "(", "arg_5", "%", "arg_1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Test whether a name exists and return the name code.\r\n\r\n        Raises an error when the name does not exist.\r\n        \"\"\"\r\n        arg_2 = 'exist(\"%s\")' % arg_1\r\n        arg_3 = arg_0._engine.eval(arg_2, silent=True).strip()\r\n        arg_4 = int(arg_3.split()[-1])\r\n        if arg_4 == 0:\r\n            arg_5 = 'Value \"%s\" does not exist in Octave workspace'\r\n            raise Oct2PyError(arg_5 % arg_1)\r\n        return arg_4", "path": "oct2py/core.py", "identifier": "Oct2Py._exist", "docstring": "Test whether a name exists and return the name code.\r\n\r\n        Raises an error when the name does not exist.", "docstring_tokens": ["Test", "whether", "a", "name", "exists", "and", "return", "the", "name", "code", ".", "Raises", "an", "error", "when", "the", "name", "does", "not", "exist", "."], "nwo": "blink1073/oct2py", "score": 0.3484138981803976, "idx": 256527}
{"url": "https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/datatype.py#L56-L67", "sha": "e6a36b3aeeacf44eec537434b0fb87c09ab54b5f", "docstring_summary": "Verify ssl service certificate.", "language": "python", "parameters": "(self)", "return_statement": "return verify", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get", "(", "'verify'", ",", "'true'", ")", "if", "isinstance", "(", "arg_1", ",", "bool", ")", ":", "Func", "=", "arg_1", "elif", "arg_1", ".", "lower", "(", ")", "==", "'true'", ":", "Func", "=", "True", "elif", "arg_1", ".", "lower", "(", ")", "==", "'false'", ":", "Func", "=", "False", "else", ":", "Func", "=", "arg_1", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"Verify ssl service certificate.\"\"\"\n        arg_1 = arg_0.get('verify', 'true')\n        if isinstance(arg_1, bool):\n            Func = arg_1\n        elif arg_1.lower() == 'true':\n            Func = True\n        elif arg_1.lower() == 'false':\n            Func = False\n        else:\n            Func = arg_1\n        return Func", "path": "twitcher/datatype.py", "identifier": "Service.verify", "docstring": "Verify ssl service certificate.", "docstring_tokens": ["Verify", "ssl", "service", "certificate", "."], "nwo": "bird-house/twitcher", "score": 0.37599664903417057, "idx": 256528}
{"url": "https://github.com/lindsaymarkward/python-yeelight-sunflower/blob/4ec72d005ce307f832429620ba0bcbf6b236eead/yeelightsunflower/main.py#L77-L104", "sha": "4ec72d005ce307f832429620ba0bcbf6b236eead", "docstring_summary": "Receive TCP response, looping to get whole thing or timeout.", "language": "python", "parameters": "(self)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "_socket", ".", "recv", "(", "BUFFER_SIZE", ")", "except", "socket", ".", "timeout", "as", "error", ":", "_LOGGER", ".", "error", "(", "\"Error receiving: %s\"", ",", "error", ")", "return", "\"\"", "arg_2", "=", "True", "arg_3", "=", "''", "while", "arg_2", ":", "if", "'\\n'", "in", "arg_1", ".", "decode", "(", "\"utf8\"", ")", ":", "arg_3", "=", "arg_1", ".", "decode", "(", "\"utf8\"", ")", ".", "split", "(", "'\\n'", ")", "[", "0", "]", "arg_2", "=", "False", "else", ":", "try", ":", "arg_4", "=", "arg_0", ".", "_socket", ".", "recv", "(", "BUFFER_SIZE", ")", "except", "socket", ".", "timeout", ":", "arg_4", "=", "None", "if", "not", "arg_4", ":", "arg_2", "=", "False", "arg_3", "=", "arg_1", ".", "decode", "(", "\"utf8\"", ")", "else", ":", "arg_1", "+=", "arg_4", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Receive TCP response, looping to get whole thing or timeout.\"\"\"\n        try:\n            arg_1 = arg_0._socket.recv(BUFFER_SIZE)\n        except socket.timeout as error:\n            # Something is wrong, assume it's offline temporarily\n            _LOGGER.error(\"Error receiving: %s\", error)\n            # self._socket.close()\n            return \"\"\n\n        # Read until a newline or timeout\n        arg_2 = True\n        arg_3 = ''\n        while arg_2:\n            if '\\n' in arg_1.decode(\"utf8\"):\n                arg_3 = arg_1.decode(\"utf8\").split('\\n')[0]\n                arg_2 = False\n            else:\n                try:\n                    arg_4 = arg_0._socket.recv(BUFFER_SIZE)\n                except socket.timeout:\n                    arg_4 = None\n                if not arg_4:\n                    arg_2 = False\n                    arg_3 = arg_1.decode(\"utf8\")\n                else:\n                    arg_1 += arg_4\n        return arg_3", "path": "yeelightsunflower/main.py", "identifier": "Hub.receive", "docstring": "Receive TCP response, looping to get whole thing or timeout.", "docstring_tokens": ["Receive", "TCP", "response", "looping", "to", "get", "whole", "thing", "or", "timeout", "."], "nwo": "lindsaymarkward/python-yeelight-sunflower", "score": 0.18941942438232184, "idx": 256529}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/image.py#L209-L232", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Return a dict with the raw EXIF data.", "language": "python", "parameters": "(filename)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_2", "=", "_read_image", "(", "arg_0", ")", "try", ":", "arg_3", "=", "arg_2", ".", "_getexif", "(", ")", "or", "{", "}", "except", "ZeroDivisionError", ":", "arg_1", ".", "warning", "(", "'Failed to read EXIF data.'", ")", "return", "None", "arg_4", "=", "{", "TAGS", ".", "get", "(", "tag", ",", "tag", ")", ":", "value", "for", "tag", ",", "value", "in", "arg_3", ".", "items", "(", ")", "}", "if", "'GPSInfo'", "in", "arg_4", ":", "try", ":", "arg_4", "[", "'GPSInfo'", "]", "=", "{", "GPSTAGS", ".", "get", "(", "tag", ",", "tag", ")", ":", "value", "for", "tag", ",", "value", "in", "arg_4", "[", "'GPSInfo'", "]", ".", "items", "(", ")", "}", "except", "AttributeError", ":", "arg_1", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_1", ".", "info", "(", "'Failed to get GPS Info'", ")", "del", "arg_4", "[", "'GPSInfo'", "]", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Return a dict with the raw EXIF data.\"\"\"\n\n    arg_1 = logging.getLogger(__name__)\n\n    arg_2 = _read_image(arg_0)\n\n    try:\n        arg_3 = arg_2._getexif() or {}\n    except ZeroDivisionError:\n        arg_1.warning('Failed to read EXIF data.')\n        return None\n\n    arg_4 = {TAGS.get(tag, tag): value for tag, value in arg_3.items()}\n\n    if 'GPSInfo' in arg_4:\n        try:\n            arg_4['GPSInfo'] = {GPSTAGS.get(tag, tag): value\n                               for tag, value in arg_4['GPSInfo'].items()}\n        except AttributeError:\n            arg_1 = logging.getLogger(__name__)\n            arg_1.info('Failed to get GPS Info')\n            del arg_4['GPSInfo']\n    return arg_4", "path": "sigal/image.py", "identifier": "get_exif_data", "docstring": "Return a dict with the raw EXIF data.", "docstring_tokens": ["Return", "a", "dict", "with", "the", "raw", "EXIF", "data", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 256530}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L261-L279", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Convert a dict containing environment variables into a standard dict.\n    Variables containing multiple values will be split into a list based on\n    the argument passed to pathsep.", "language": "python", "parameters": "(env, pathsep=os.pathsep)", "return_statement": "return out_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "pathsep", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "iteritems", "(", ")", ":", "if", "arg_1", "in", "arg_5", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", ".", "split", "(", "arg_1", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1=arg_2.pathsep):\n    '''\n    Convert a dict containing environment variables into a standard dict.\n    Variables containing multiple values will be split into a list based on\n    the argument passed to pathsep.\n\n    :param env: Environment dict like os.environ.data\n    :param pathsep: Path separator used to split variables\n    '''\n\n    arg_3 = {}\n\n    for arg_4, arg_5 in arg_0.iteritems():\n        if arg_1 in arg_5:\n            arg_3[arg_4] = arg_5.split(arg_1)\n        else:\n            arg_3[arg_4] = arg_5\n\n    return arg_3", "path": "cpenv/utils.py", "identifier": "env_to_dict", "docstring": "Convert a dict containing environment variables into a standard dict.\n    Variables containing multiple values will be split into a list based on\n    the argument passed to pathsep.\n\n    :param env: Environment dict like os.environ.data\n    :param pathsep: Path separator used to split variables", "docstring_tokens": ["Convert", "a", "dict", "containing", "environment", "variables", "into", "a", "standard", "dict", ".", "Variables", "containing", "multiple", "values", "will", "be", "split", "into", "a", "list", "based", "on", "the", "argument", "passed", "to", "pathsep", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 256531}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/base_predictor.py#L178-L222", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Given a dictionary mapping sequence names to amino acid strings,\n        and an optional list of peptide lengths, returns a\n        BindingPredictionCollection.", "language": "python", "parameters": "(\n            self,\n            sequence_dict,\n            peptide_lengths=None)", "return_statement": "return BindingPredictionCollection(results)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", ":", "arg_1", "=", "{", "\"seq\"", ":", "arg_1", "}", "elif", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_1", "=", "{", "seq", ":", "seq", "for", "seq", "in", "arg_1", "}", "arg_2", "=", "arg_0", ".", "_check_peptide_lengths", "(", "arg_2", ")", "arg_3", "=", "set", "(", "[", "]", ")", "arg_4", "=", "defaultdict", "(", "list", ")", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "items", "(", ")", ":", "for", "arg_7", "in", "arg_2", ":", "for", "arg_8", "in", "range", "(", "len", "(", "arg_6", ")", "-", "arg_7", "+", "1", ")", ":", "arg_9", "=", "arg_6", "[", "arg_8", ":", "arg_8", "+", "arg_7", "]", "arg_3", ".", "add", "(", "arg_9", ")", "arg_4", "[", "arg_9", "]", ".", "append", "(", "(", "arg_5", ",", "arg_8", ")", ")", "arg_10", "=", "sorted", "(", "arg_3", ")", "arg_11", "=", "arg_0", ".", "predict_peptides", "(", "arg_10", ")", "arg_12", "=", "[", "]", "for", "arg_13", "in", "arg_11", ":", "for", "arg_5", ",", "arg_14", "in", "arg_4", "[", "arg_13", ".", "peptide", "]", ":", "arg_12", ".", "append", "(", "arg_13", ".", "clone_with_updates", "(", "source_sequence_name", "=", "arg_5", ",", "arg_14", "=", "arg_14", ")", ")", "arg_0", ".", "_check_results", "(", "arg_12", ",", "peptides", "=", "arg_3", ",", "alleles", "=", "arg_0", ".", "alleles", ")", "return", "BindingPredictionCollection", "(", "arg_12", ")"], "function": "def Func(\n            arg_0,\n            arg_1,\n            arg_2=None):\n        \"\"\"\n        Given a dictionary mapping sequence names to amino acid strings,\n        and an optional list of peptide lengths, returns a\n        BindingPredictionCollection.\n        \"\"\"\n        if isinstance(arg_1, string_types):\n            arg_1 = {\"seq\": arg_1}\n        elif isinstance(arg_1, (list, tuple)):\n            arg_1 = {seq: seq for seq in arg_1}\n\n        arg_2 = arg_0._check_peptide_lengths(arg_2)\n\n        # convert long protein sequences to set of peptides and\n        # associated sequence name / offsets that each peptide may have come\n        # from\n        arg_3 = set([])\n        arg_4 = defaultdict(list)\n\n        for arg_5, arg_6 in arg_1.items():\n            for arg_7 in arg_2:\n                for arg_8 in range(len(arg_6) - arg_7 + 1):\n                    arg_9 = arg_6[arg_8:arg_8 + arg_7]\n                    arg_3.add(arg_9)\n                    arg_4[arg_9].append((arg_5, arg_8))\n        arg_10 = sorted(arg_3)\n\n        arg_11 = arg_0.predict_peptides(arg_10)\n\n        # create BindingPrediction objects with sequence name and offset\n        arg_12 = []\n        for arg_13 in arg_11:\n            for arg_5, arg_14 in arg_4[\n                    arg_13.peptide]:\n                arg_12.append(arg_13.clone_with_updates(\n                    source_sequence_name=arg_5,\n                    arg_14=arg_14))\n        arg_0._check_results(\n            arg_12,\n            peptides=arg_3,\n            alleles=arg_0.alleles)\n        return BindingPredictionCollection(arg_12)", "path": "mhctools/base_predictor.py", "identifier": "BasePredictor.predict_subsequences", "docstring": "Given a dictionary mapping sequence names to amino acid strings,\n        and an optional list of peptide lengths, returns a\n        BindingPredictionCollection.", "docstring_tokens": ["Given", "a", "dictionary", "mapping", "sequence", "names", "to", "amino", "acid", "strings", "and", "an", "optional", "list", "of", "peptide", "lengths", "returns", "a", "BindingPredictionCollection", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 256532}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/check.py#L56-L73", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Get the data in the image without having a side effect on the Nifti1Image object", "language": "python", "parameters": "(img)", "return_statement": "return img.get_data()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'_data_cache'", ")", "and", "arg_0", ".", "_data_cache", "is", "None", ":", "arg_0", "=", "copy", ".", "deepcopy", "(", "arg_0", ")", "gc", ".", "collect", "(", ")", "return", "arg_0", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Get the data in the image without having a side effect on the Nifti1Image object\n\n    Parameters\n    ----------\n    img: Nifti1Image\n\n    Returns\n    -------\n    np.ndarray\n    \"\"\"\n    if hasattr(arg_0, '_data_cache') and arg_0._data_cache is None:\n        # Copy locally the nifti_image to avoid the side effect of data\n        # loading\n        arg_0 = copy.deepcopy(arg_0)\n    # force garbage collector\n    gc.collect()\n    return arg_0.Func()", "path": "boyle/nifti/check.py", "identifier": "get_data", "docstring": "Get the data in the image without having a side effect on the Nifti1Image object\n\n    Parameters\n    ----------\n    img: Nifti1Image\n\n    Returns\n    -------\n    np.ndarray", "docstring_tokens": ["Get", "the", "data", "in", "the", "image", "without", "having", "a", "side", "effect", "on", "the", "Nifti1Image", "object"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 256533}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/api.py#L791-L836", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Returns all transfers associated with the seed.", "language": "python", "parameters": "(self, start=0, stop=None, inclusion_states=False)", "return_statement": "return extended.GetTransfersCommand(self.adapter)(\n            seed=self.seed,\n            start=start,\n            stop=stop,\n            inclusionStates=inclusion_states,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "return", "extended", ".", "GetTransfersCommand", "(", "arg_0", ".", "adapter", ")", "(", "seed", "=", "arg_0", ".", "seed", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "inclusionStates", "=", "arg_3", ",", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=None, arg_3=False):\n        # type: (int, Optional[int], bool) -> dict\n        \"\"\"\n        Returns all transfers associated with the seed.\n\n        :param start:\n            Starting key index.\n\n        :param stop:\n            Stop before this index.\n\n            Note that this parameter behaves like the ``stop`` attribute\n            in a :py:class:`slice` object; the stop index is *not*\n            included in the result.\n\n            If ``None`` (default), then this method will check every\n            address until it finds one without any transfers.\n\n        :param inclusion_states:\n            Whether to also fetch the inclusion states of the transfers.\n\n            This requires an additional API call to the node, so it is\n            disabled by default.\n\n        :return:\n            Dict with the following structure::\n\n                {\n                    'bundles': List[Bundle],\n                        Matching bundles, sorted by tail transaction\n                        timestamp.\n\n                        This value is always a list, even if only one\n                        bundle was found.\n                }\n\n        References:\n\n        - https://github.com/iotaledger/wiki/blob/master/api-proposal.md#gettransfers\n        \"\"\"\n        return extended.GetTransfersCommand(arg_0.adapter)(\n            seed=arg_0.seed,\n            arg_1=arg_1,\n            arg_2=arg_2,\n            inclusionStates=arg_3,\n        )", "path": "iota/api.py", "identifier": "Iota.get_transfers", "docstring": "Returns all transfers associated with the seed.\n\n        :param start:\n            Starting key index.\n\n        :param stop:\n            Stop before this index.\n\n            Note that this parameter behaves like the ``stop`` attribute\n            in a :py:class:`slice` object; the stop index is *not*\n            included in the result.\n\n            If ``None`` (default), then this method will check every\n            address until it finds one without any transfers.\n\n        :param inclusion_states:\n            Whether to also fetch the inclusion states of the transfers.\n\n            This requires an additional API call to the node, so it is\n            disabled by default.\n\n        :return:\n            Dict with the following structure::\n\n                {\n                    'bundles': List[Bundle],\n                        Matching bundles, sorted by tail transaction\n                        timestamp.\n\n                        This value is always a list, even if only one\n                        bundle was found.\n                }\n\n        References:\n\n        - https://github.com/iotaledger/wiki/blob/master/api-proposal.md#gettransfers", "docstring_tokens": ["Returns", "all", "transfers", "associated", "with", "the", "seed", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 256534}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/vert_color.py#L8-L78", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Color function using muparser lib to generate new RGBA color for every\n        vertex", "language": "python", "parameters": "(script, red=255, green=255, blue=255, alpha=255, color=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "255", ",", "arg_2", "=", "255", ",", "arg_3", "=", "255", ",", "arg_4", "=", "255", ",", "arg_5", "=", "None", ")", ":", "if", "arg_5", "is", "not", "None", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_6", "=", "color_name", "[", "arg_5", ".", "lower", "(", ")", "]", "arg_7", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Per Vertex Color Function\">\\n'", ",", "'    <Param name=\"x\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_1", ")", ".", "replace", "(", "'&'", ",", "'&amp;'", ")", ".", "replace", "(", "'<'", ",", "'&lt;'", ")", ")", ",", "'description=\"func r = \" '", ",", "'type=\"RichString\" '", ",", "'/>\\n'", ",", "'    <Param name=\"y\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_2", ")", ".", "replace", "(", "'&'", ",", "'&amp;'", ")", ".", "replace", "(", "'<'", ",", "'&lt;'", ")", ")", ",", "'description=\"func g = \" '", ",", "'type=\"RichString\" '", ",", "'/>\\n'", ",", "'    <Param name=\"z\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_3", ")", ".", "replace", "(", "'&'", ",", "'&amp;'", ")", ".", "replace", "(", "'<'", ",", "'&lt;'", ")", ")", ",", "'description=\"func b = \" '", ",", "'type=\"RichString\" '", ",", "'/>\\n'", ",", "'    <Param name=\"a\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_4", ")", ".", "replace", "(", "'&'", ",", "'&amp;'", ")", ".", "replace", "(", "'<'", ",", "'&lt;'", ")", ")", ",", "'description=\"func alpha = \" '", ",", "'type=\"RichString\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_7", ")", "return", "None"], "function": "def Func(arg_0, arg_1=255, arg_2=255, arg_3=255, arg_4=255, arg_5=None):\n    \"\"\"Color Func using muparser lib to generate new RGBA color for every\n        vertex\n\n    Red, Green, Blue and Alpha channels may be defined by specifying a Func\n    for each.\n\n    See help(mlx.muparser_ref) for muparser reference documentation.\n\n    It's possible to use the following per-vertex variables in the expression:\n\n    Variables (per vertex):\n        x, y, z (coordinates)\n        nx, ny, nz (normal)\n        r, g, b, a (color)\n        q (quality)\n        rad (radius)\n        vi (vertex index)\n        vtu, vtv (texture coordinates)\n        ti (texture index)\n        vsel (is the vertex selected? 1 yes, 0 no)\n        and all custom vertex attributes already defined by user.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        red (str [0, 255]): Func to generate red component\n        green (str [0, 255]): Func to generate green component\n        blue (str [0, 255]): Func to generate blue component\n        alpha (str [0, 255]): Func to generate alpha component\n        color (str): name of one of the 140 HTML Color Names defined\n            in CSS & SVG.\n            Ref: https://en.wikipedia.org/wiki/Web_colors#X11_color_names\n            If not None this will override the per component variables.\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    # TODO: add options for HSV\n    # https://www.cs.rit.edu/~ncs/color/t_convert.html\n    if arg_5 is not None:\n        arg_1, arg_2, arg_3, arg_6 = color_name[arg_5.lower()]\n    arg_7 = ''.join([\n        '  <filter name=\"Per Vertex Color Function\">\\n',\n        '    <Param name=\"x\" ',\n        'value=\"{}\" '.format(str(arg_1).replace('&', '&amp;').replace('<', '&lt;')),\n        'description=\"func r = \" ',\n        'type=\"RichString\" ',\n        '/>\\n',\n        '    <Param name=\"y\" ',\n        'value=\"{}\" '.format(str(arg_2).replace('&', '&amp;').replace('<', '&lt;')),\n        'description=\"func g = \" ',\n        'type=\"RichString\" ',\n        '/>\\n',\n        '    <Param name=\"z\" ',\n        'value=\"{}\" '.format(str(arg_3).replace('&', '&amp;').replace('<', '&lt;')),\n        'description=\"func b = \" ',\n        'type=\"RichString\" ',\n        '/>\\n',\n        '    <Param name=\"a\" ',\n        'value=\"{}\" '.format(str(arg_4).replace('&', '&amp;').replace('<', '&lt;')),\n        'description=\"func alpha = \" ',\n        'type=\"RichString\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_7)\n    return None", "path": "meshlabxml/vert_color.py", "identifier": "function", "docstring": "Color function using muparser lib to generate new RGBA color for every\n        vertex\n\n    Red, Green, Blue and Alpha channels may be defined by specifying a function\n    for each.\n\n    See help(mlx.muparser_ref) for muparser reference documentation.\n\n    It's possible to use the following per-vertex variables in the expression:\n\n    Variables (per vertex):\n        x, y, z (coordinates)\n        nx, ny, nz (normal)\n        r, g, b, a (color)\n        q (quality)\n        rad (radius)\n        vi (vertex index)\n        vtu, vtv (texture coordinates)\n        ti (texture index)\n        vsel (is the vertex selected? 1 yes, 0 no)\n        and all custom vertex attributes already defined by user.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        red (str [0, 255]): function to generate red component\n        green (str [0, 255]): function to generate green component\n        blue (str [0, 255]): function to generate blue component\n        alpha (str [0, 255]): function to generate alpha component\n        color (str): name of one of the 140 HTML Color Names defined\n            in CSS & SVG.\n            Ref: https://en.wikipedia.org/wiki/Web_colors#X11_color_names\n            If not None this will override the per component variables.\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Color", "function", "using", "muparser", "lib", "to", "generate", "new", "RGBA", "color", "for", "every", "vertex"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 256535}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/exactpsf.py#L818-L827", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Calculates a pinhole psf", "language": "python", "parameters": "(self, x, y, z, **kwargs)", "return_statement": "return vls / vls.sum()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "if", "arg_0", ".", "polychromatic", ":", "arg_5", "=", "psfcalc", ".", "calculate_polychrome_pinhole_psf", "else", ":", "arg_5", "=", "psfcalc", ".", "calculate_pinhole_psf", "arg_6", ",", "arg_7", "=", "[", "psfcalc", ".", "vec_to_halfvec", "(", "v", ")", "for", "v", "in", "[", "arg_1", ",", "arg_2", "]", "]", "arg_8", "=", "psfcalc", ".", "wrap_and_calc_psf", "(", "arg_6", ",", "arg_7", ",", "arg_3", ",", "arg_5", ",", "**", "arg_4", ")", "return", "arg_8", "/", "arg_8", ".", "sum", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"Calculates a pinhole psf\"\"\"\n        #do_pinhole?? FIXME\n        if arg_0.polychromatic:\n            arg_5 = psfcalc.calculate_polychrome_pinhole_psf\n        else:\n            arg_5 = psfcalc.calculate_pinhole_psf\n        arg_6, arg_7 = [psfcalc.vec_to_halfvec(v) for v in [arg_1,arg_2]]\n        arg_8 = psfcalc.wrap_and_calc_psf(arg_6, arg_7, arg_3, arg_5, **arg_4)\n        return arg_8 / arg_8.sum()", "path": "peri/comp/exactpsf.py", "identifier": "ExactPinholeConfocalPSF.psffunc", "docstring": "Calculates a pinhole psf", "docstring_tokens": ["Calculates", "a", "pinhole", "psf"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 256536}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L87-L101", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Load java messages that can be ignored pickle file into a dict structure g_ok_java_messages.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "g_load_java_message_filename", "global", "arg_0", "if", "os", ".", "path", ".", "isfile", "(", "g_load_java_message_filename", ")", ":", "with", "open", "(", "g_load_java_message_filename", ",", "'rb'", ")", "as", "ofile", ":", "arg_0", "=", "pickle", ".", "load", "(", "ofile", ")", "else", ":", "arg_0", "[", "\"general\"", "]", "=", "[", "]"], "function": "def Func():\n    \"\"\"\n    Load java messages that can be ignored pickle file into a dict structure g_ok_java_messages.\n\n    :return: none\n    \"\"\"\n    global g_load_java_message_filename\n    global arg_0\n\n    if os.path.isfile(g_load_java_message_filename):\n            # only load dict from file if it exists.\n        with open(g_load_java_message_filename,'rb') as ofile:\n            arg_0 = pickle.load(ofile)\n    else:   # no previous java messages to be excluded are found\n        arg_0[\"general\"] = []", "path": "scripts/addjavamessage2ignore.py", "identifier": "load_dict", "docstring": "Load java messages that can be ignored pickle file into a dict structure g_ok_java_messages.\n\n    :return: none", "docstring_tokens": ["Load", "java", "messages", "that", "can", "be", "ignored", "pickle", "file", "into", "a", "dict", "structure", "g_ok_java_messages", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 256537}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/models/base.py#L223-L250", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Calculates the gradient of the cross-entropy loss w.r.t. the image.", "language": "python", "parameters": "(self, image, label)", "return_statement": "return gradient", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "Func", "=", "arg_0", ".", "predictions_and_gradient", "(", "arg_1", ",", "arg_2", ")", "return", "Func"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Calculates the gradient of the cross-entropy loss w.r.t. the image.\n\n        The default implementation calls predictions_and_gradient.\n        Subclasses can provide more efficient implementations that\n        only calculate the gradient.\n\n        Parameters\n        ----------\n        image : `numpy.ndarray`\n            Single input with shape as expected by the model\n            (without the batch dimension).\n        label : int\n            Reference label used to calculate the gradient.\n\n        Returns\n        -------\n        gradient : `numpy.ndarray`\n            The gradient of the cross-entropy loss w.r.t. the image. Will\n            have the same shape as the image.\n\n        See Also\n        --------\n        :meth:`gradient`\n\n        \"\"\"\n        arg_3, Func = arg_0.predictions_and_gradient(arg_1, arg_2)\n        return Func", "path": "foolbox/models/base.py", "identifier": "DifferentiableModel.gradient", "docstring": "Calculates the gradient of the cross-entropy loss w.r.t. the image.\n\n        The default implementation calls predictions_and_gradient.\n        Subclasses can provide more efficient implementations that\n        only calculate the gradient.\n\n        Parameters\n        ----------\n        image : `numpy.ndarray`\n            Single input with shape as expected by the model\n            (without the batch dimension).\n        label : int\n            Reference label used to calculate the gradient.\n\n        Returns\n        -------\n        gradient : `numpy.ndarray`\n            The gradient of the cross-entropy loss w.r.t. the image. Will\n            have the same shape as the image.\n\n        See Also\n        --------\n        :meth:`gradient`", "docstring_tokens": ["Calculates", "the", "gradient", "of", "the", "cross", "-", "entropy", "loss", "w", ".", "r", ".", "t", ".", "the", "image", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 256538}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py#L521-L528", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Dumps an object into a string for redis.  By default it serializes\n        integers as regular string and pickle dumps everything else.", "language": "python", "parameters": "(self, value)", "return_statement": "return b'!' + pickle.dumps(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "type", "(", "arg_1", ")", "if", "arg_2", "in", "integer_types", ":", "return", "str", "(", "arg_1", ")", ".", "encode", "(", "'ascii'", ")", "return", "b'!'", "+", "pickle", ".", "dumps", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Dumps an object into a string for redis.  By default it serializes\n        integers as regular string and pickle dumps everything else.\n        \"\"\"\n        arg_2 = type(arg_1)\n        if arg_2 in integer_types:\n            return str(arg_1).encode('ascii')\n        return b'!' + pickle.dumps(arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py", "identifier": "RedisCache.dump_object", "docstring": "Dumps an object into a string for redis.  By default it serializes\n        integers as regular string and pickle dumps everything else.", "docstring_tokens": ["Dumps", "an", "object", "into", "a", "string", "for", "redis", ".", "By", "default", "it", "serializes", "integers", "as", "regular", "string", "and", "pickle", "dumps", "everything", "else", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256539}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L991-L1003", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Load a private key from a PKey object", "language": "python", "parameters": "(self, pkey)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "PKey", ")", ":", "raise", "TypeError", "(", "\"pkey must be a PKey instance\"", ")", "arg_2", "=", "_lib", ".", "SSL_CTX_use_PrivateKey", "(", "arg_0", ".", "_context", ",", "arg_1", ".", "_pkey", ")", "if", "not", "arg_2", ":", "arg_0", ".", "_raise_passphrase_exception", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Load a private key from a PKey object\n\n        :param pkey: The PKey object\n        :return: None\n        \"\"\"\n        if not isinstance(arg_1, PKey):\n            raise TypeError(\"pkey must be a PKey instance\")\n\n        arg_2 = _lib.SSL_CTX_use_PrivateKey(arg_0._context, arg_1._pkey)\n        if not arg_2:\n            arg_0._raise_passphrase_exception()", "path": "src/OpenSSL/SSL.py", "identifier": "Context.use_privatekey", "docstring": "Load a private key from a PKey object\n\n        :param pkey: The PKey object\n        :return: None", "docstring_tokens": ["Load", "a", "private", "key", "from", "a", "PKey", "object"], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256540}
{"url": "https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L433-L455", "sha": "532e685c504ea96f9e42833594585159ac1d2068", "docstring_summary": "Resolve a request to a wildcard or regex route handler.", "language": "python", "parameters": "(self, method, path)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "(", "arg_0", ".", "_wildcard", ",", "arg_0", ".", "_regex", ")", ":", "if", "arg_1", "in", "arg_3", ":", "for", "arg_4", "in", "reversed", "(", "arg_3", "[", "arg_1", "]", ")", ":", "arg_5", "=", "arg_4", ".", "match", "(", "arg_2", ")", "if", "arg_5", "is", "not", "None", ":", "return", "arg_5", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Resolve a request to a wildcard or regex route handler.\n\n        Arguments:\n          method (str): HTTP method name, e.g. GET, POST, etc.\n          path (str): Request path\n\n        Returns:\n          tuple or None: A tuple of three items:\n\n            1. Route handler (callable)\n            2. Positional arguments (list)\n            3. Keyword arguments (dict)\n\n          ``None`` if no route matches the request.\n        \"\"\"\n        for arg_3 in (arg_0._wildcard, arg_0._regex):\n            if arg_1 in arg_3:\n                for arg_4 in reversed(arg_3[arg_1]):\n                    arg_5 = arg_4.match(arg_2)\n                    if arg_5 is not None:\n                        return arg_5\n        return None", "path": "ice.py", "identifier": "Router._resolve_non_literal_route", "docstring": "Resolve a request to a wildcard or regex route handler.\n\n        Arguments:\n          method (str): HTTP method name, e.g. GET, POST, etc.\n          path (str): Request path\n\n        Returns:\n          tuple or None: A tuple of three items:\n\n            1. Route handler (callable)\n            2. Positional arguments (list)\n            3. Keyword arguments (dict)\n\n          ``None`` if no route matches the request.", "docstring_tokens": ["Resolve", "a", "request", "to", "a", "wildcard", "or", "regex", "route", "handler", "."], "nwo": "susam/ice", "score": 0.16638194949711382, "idx": 256541}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/utils.py#L49-L52", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Decode base64 string.", "language": "python", "parameters": "(text, encoding='utf-8')", "return_statement": "return to_unicode(base64.b64decode(text), encoding)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf-8'", ")", ":", "arg_0", "=", "to_bytes", "(", "arg_0", ",", "arg_1", ")", "return", "to_unicode", "(", "base64", ".", "b64decode", "(", "arg_0", ")", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1='utf-8'):\n    \"\"\"Decode base64 string.\"\"\"\n    arg_0 = to_bytes(arg_0, arg_1)\n    return to_unicode(base64.b64decode(arg_0), arg_1)", "path": "flask_oauthlib/utils.py", "identifier": "decode_base64", "docstring": "Decode base64 string.", "docstring_tokens": ["Decode", "base64", "string", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 256542}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/temperature.py#L284-L383", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Converts the a temperature reading made in any of the scales\n    'ITS-90', 'ITS-68','ITS-48', 'ITS-76', or 'ITS-27' to any of the other\n    scales. Not all temperature ranges can be converted to other ranges; for\n    instance, 'ITS-76' is purely for low temperatures, and 5 K on it has no\n    conversion to 'ITS-90' or any other scale. Both a conversion to ITS-90 and\n    to the desired scale must be possible for the conversion to occur.\n    The conversion uses cubic spline interpolation.", "language": "python", "parameters": "(T, current, desired)", "return_statement": "return float(T)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "range_check", "(", "arg_0", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_0", "<", "arg_3", "or", "arg_0", ">", "arg_4", ":", "raise", "Exception", "(", "'Temperature conversion is outside one or both scales'", ")", "try", ":", "if", "arg_1", "==", "'ITS-90'", ":", "pass", "elif", "arg_1", "==", "'ITS-68'", ":", "range_check", "(", "arg_0", ",", "13.999", ",", "4300.0001", ")", "arg_0", "=", "T68_to_T90", "(", "arg_0", ")", "elif", "arg_1", "==", "'ITS-76'", ":", "range_check", "(", "arg_0", ",", "4.9999", ",", "27.0001", ")", "arg_0", "=", "T76_to_T90", "(", "arg_0", ")", "elif", "arg_1", "==", "'ITS-48'", ":", "range_check", "(", "arg_0", ",", "93.149999", ",", "4273.15001", ")", "arg_0", "=", "T48_to_T90", "(", "arg_0", ")", "elif", "arg_1", "==", "'ITS-27'", ":", "range_check", "(", "arg_0", ",", "903.15", ",", "4273.15", ")", "arg_0", "=", "T27_to_T90", "(", "arg_0", ")", "else", ":", "raise", "Exception", "(", "'Current scale not supported'", ")", "if", "arg_2", "==", "'ITS-90'", ":", "pass", "elif", "arg_2", "==", "'ITS-68'", ":", "range_check", "(", "arg_0", ",", "13.999", ",", "4300.0001", ")", "arg_0", "=", "T90_to_T68", "(", "arg_0", ")", "elif", "arg_2", "==", "'ITS-76'", ":", "range_check", "(", "arg_0", ",", "4.9999", ",", "27.0001", ")", "arg_0", "=", "T90_to_T76", "(", "arg_0", ")", "elif", "arg_2", "==", "'ITS-48'", ":", "range_check", "(", "arg_0", ",", "93.149999", ",", "4273.15001", ")", "arg_0", "=", "T90_to_T48", "(", "arg_0", ")", "elif", "arg_2", "==", "'ITS-27'", ":", "range_check", "(", "arg_0", ",", "903.15", ",", "4273.15", ")", "arg_0", "=", "T90_to_T27", "(", "arg_0", ")", "else", ":", "raise", "Exception", "(", "'Desired scale not supported'", ")", "except", "ValueError", ":", "raise", "Exception", "(", "'Temperature could not be converted to desired scale'", ")", "return", "float", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    r'''Converts the a temperature reading made in any of the scales\n    'ITS-90', 'ITS-68','ITS-48', 'ITS-76', or 'ITS-27' to any of the other\n    scales. Not all temperature ranges can be converted to other ranges; for\n    instance, 'ITS-76' is purely for low temperatures, and 5 K on it has no\n    conversion to 'ITS-90' or any other scale. Both a conversion to ITS-90 and\n    to the desired scale must be possible for the conversion to occur.\n    The conversion uses cubic spline interpolation.\n\n    ITS-68 conversion is valid from 14 K to 4300 K.\n    ITS-48 conversion is valid from 93.15 K to 4273.15 K\n    ITS-76 conversion is valid from 5 K to 27 K.\n    ITS-27 is valid from 903.15 K to 4273.15 k.\n\n    Parameters\n    ----------\n    T : float\n        Temperature, on `current` scale [K]\n    current : str\n        String representing the scale T is in, 'ITS-90', 'ITS-68',\n        'ITS-48', 'ITS-76', or 'ITS-27'.\n    desired : str\n        String representing the scale T will be returned in, 'ITS-90',\n        'ITS-68', 'ITS-48', 'ITS-76', or 'ITS-27'.\n\n    Returns\n    -------\n    T : float\n        Temperature, on scale `desired` [K]\n\n    Notes\n    -----\n    Because the conversion is performed by spline functions, a re-conversion\n    of a value will not yield exactly the original value. However, it is quite\n    close.\n\n    The use of splines is quite quick (20 micro seconds/calculation). While\n    just a spline for one-way conversion could be used, a numerical solver\n    would have to be used to obtain an exact result for the reverse conversion.\n    This was found to take approximately 1 ms/calculation, depending on the\n    region.\n\n    Examples\n    --------\n    >>> Func(500, 'ITS-68', 'ITS-48')\n    499.9470092992346\n\n    References\n    ----------\n    .. [1] Wier, Ron D., and Robert N. Goldberg. \"On the Conversion of\n       Thermodynamic Properties to the Basis of the International Temperature\n       Scale of 1990.\" The Journal of Chemical Thermodynamics 28, no. 3\n       (March 1996): 261-76. doi:10.1006/jcht.1996.0026.\n    .. [2] Goldberg, Robert N., and R. D. Weir. \"Conversion of Temperatures\n       and Thermodynamic Properties to the Basis of the International\n       Temperature Scale of 1990 (Technical Report).\" Pure and Applied\n       Chemistry 64, no. 10 (1992): 1545-1562. doi:10.1351/pac199264101545.\n    '''\n    def range_check(arg_0, arg_3, arg_4):\n        if arg_0 < arg_3 or arg_0 > arg_4:\n            raise Exception('Temperature conversion is outside one or both scales')\n\n    try:\n        if arg_1 == 'ITS-90':\n            pass\n        elif arg_1 == 'ITS-68':\n            range_check(arg_0, 13.999, 4300.0001)\n            arg_0 = T68_to_T90(arg_0)\n        elif arg_1 == 'ITS-76':\n            range_check(arg_0, 4.9999, 27.0001)\n            arg_0 = T76_to_T90(arg_0)\n        elif arg_1 == 'ITS-48':\n            range_check(arg_0, 93.149999, 4273.15001)\n            arg_0 = T48_to_T90(arg_0)\n        elif arg_1 == 'ITS-27':\n            range_check(arg_0, 903.15, 4273.15)\n            arg_0 = T27_to_T90(arg_0)\n        else:\n            raise Exception('Current scale not supported')\n        # T should be in ITS-90 now\n\n        if arg_2 == 'ITS-90':\n            pass\n        elif arg_2 == 'ITS-68':\n            range_check(arg_0, 13.999, 4300.0001)\n            arg_0 = T90_to_T68(arg_0)\n        elif arg_2 == 'ITS-76':\n            range_check(arg_0, 4.9999, 27.0001)\n            arg_0 = T90_to_T76(arg_0)\n        elif arg_2 == 'ITS-48':\n            range_check(arg_0, 93.149999, 4273.15001)\n            arg_0 = T90_to_T48(arg_0)\n        elif arg_2 == 'ITS-27':\n            range_check(arg_0, 903.15, 4273.15)\n            arg_0 = T90_to_T27(arg_0)\n        else:\n            raise Exception('Desired scale not supported')\n    except ValueError:\n        raise Exception('Temperature could not be converted to desired scale')\n    return float(arg_0)", "path": "thermo/temperature.py", "identifier": "T_converter", "docstring": "r'''Converts the a temperature reading made in any of the scales\n    'ITS-90', 'ITS-68','ITS-48', 'ITS-76', or 'ITS-27' to any of the other\n    scales. Not all temperature ranges can be converted to other ranges; for\n    instance, 'ITS-76' is purely for low temperatures, and 5 K on it has no\n    conversion to 'ITS-90' or any other scale. Both a conversion to ITS-90 and\n    to the desired scale must be possible for the conversion to occur.\n    The conversion uses cubic spline interpolation.\n\n    ITS-68 conversion is valid from 14 K to 4300 K.\n    ITS-48 conversion is valid from 93.15 K to 4273.15 K\n    ITS-76 conversion is valid from 5 K to 27 K.\n    ITS-27 is valid from 903.15 K to 4273.15 k.\n\n    Parameters\n    ----------\n    T : float\n        Temperature, on `current` scale [K]\n    current : str\n        String representing the scale T is in, 'ITS-90', 'ITS-68',\n        'ITS-48', 'ITS-76', or 'ITS-27'.\n    desired : str\n        String representing the scale T will be returned in, 'ITS-90',\n        'ITS-68', 'ITS-48', 'ITS-76', or 'ITS-27'.\n\n    Returns\n    -------\n    T : float\n        Temperature, on scale `desired` [K]\n\n    Notes\n    -----\n    Because the conversion is performed by spline functions, a re-conversion\n    of a value will not yield exactly the original value. However, it is quite\n    close.\n\n    The use of splines is quite quick (20 micro seconds/calculation). While\n    just a spline for one-way conversion could be used, a numerical solver\n    would have to be used to obtain an exact result for the reverse conversion.\n    This was found to take approximately 1 ms/calculation, depending on the\n    region.\n\n    Examples\n    --------\n    >>> T_converter(500, 'ITS-68', 'ITS-48')\n    499.9470092992346\n\n    References\n    ----------\n    .. [1] Wier, Ron D., and Robert N. Goldberg. \"On the Conversion of\n       Thermodynamic Properties to the Basis of the International Temperature\n       Scale of 1990.\" The Journal of Chemical Thermodynamics 28, no. 3\n       (March 1996): 261-76. doi:10.1006/jcht.1996.0026.\n    .. [2] Goldberg, Robert N., and R. D. Weir. \"Conversion of Temperatures\n       and Thermodynamic Properties to the Basis of the International\n       Temperature Scale of 1990 (Technical Report).\" Pure and Applied\n       Chemistry 64, no. 10 (1992): 1545-1562. doi:10.1351/pac199264101545.", "docstring_tokens": ["r", "Converts", "the", "a", "temperature", "reading", "made", "in", "any", "of", "the", "scales", "ITS", "-", "90", "ITS", "-", "68", "ITS", "-", "48", "ITS", "-", "76", "or", "ITS", "-", "27", "to", "any", "of", "the", "other", "scales", ".", "Not", "all", "temperature", "ranges", "can", "be", "converted", "to", "other", "ranges", ";", "for", "instance", "ITS", "-", "76", "is", "purely", "for", "low", "temperatures", "and", "5", "K", "on", "it", "has", "no", "conversion", "to", "ITS", "-", "90", "or", "any", "other", "scale", ".", "Both", "a", "conversion", "to", "ITS", "-", "90", "and", "to", "the", "desired", "scale", "must", "be", "possible", "for", "the", "conversion", "to", "occur", ".", "The", "conversion", "uses", "cubic", "spline", "interpolation", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256543}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/connection.py#L340-L370", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Release the database connection and cursor", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_logger", ".", "debug", "(", "\"Releasing: %r\"", ",", "arg_0", ")", "if", "arg_0", ".", "_addedToInstanceSet", ":", "try", ":", "arg_0", ".", "_clsOutstandingInstances", ".", "remove", "(", "arg_0", ")", "except", ":", "arg_0", ".", "_logger", ".", "exception", "(", "\"Failed to remove self from _clsOutstandingInstances: %r;\"", ",", "arg_0", ")", "raise", "arg_0", ".", "_Funcr", "(", "arg_3", "=", "arg_0", ".", "dbConn", ",", "arg_2", "=", "arg_0", ".", "cursor", ")", "arg_0", ".", "__class__", ".", "_clsNumOutstanding", "-=", "1", "assert", "arg_0", ".", "_clsNumOutstanding", ">=", "0", ",", "\"_clsNumOutstanding=%r\"", "%", "(", "arg_0", ".", "_clsNumOutstanding", ",", ")", "arg_0", ".", "_Funcr", "=", "None", "arg_0", ".", "cursor", "=", "None", "arg_0", ".", "dbConn", "=", "None", "arg_0", ".", "_creationTracebackString", "=", "None", "arg_0", ".", "_addedToInstanceSet", "=", "False", "arg_0", ".", "_logger", "=", "None", "return"], "function": "def Func(arg_0):\n    \"\"\" Release the database connection and cursor\n\n    The receiver of the Connection instance MUST call this method in order\n    to reclaim resources\n    \"\"\"\n\n    arg_0._logger.debug(\"Releasing: %r\", arg_0)\n\n    # Discard self from set of outstanding instances\n    if arg_0._addedToInstanceSet:\n      try:\n        arg_0._clsOutstandingInstances.remove(arg_0)\n      except:\n        arg_0._logger.exception(\n          \"Failed to remove self from _clsOutstandingInstances: %r;\", arg_0)\n        raise\n\n    arg_0._Funcr(arg_3=arg_0.dbConn, arg_2=arg_0.cursor)\n\n    arg_0.__class__._clsNumOutstanding -= 1\n    assert arg_0._clsNumOutstanding >= 0,  \\\n           \"_clsNumOutstanding=%r\" % (arg_0._clsNumOutstanding,)\n\n    arg_0._Funcr = None\n    arg_0.cursor = None\n    arg_0.dbConn = None\n    arg_0._creationTracebackString = None\n    arg_0._addedToInstanceSet = False\n    arg_0._logger = None\n    return", "path": "src/nupic/database/connection.py", "identifier": "ConnectionWrapper.release", "docstring": "Release the database connection and cursor\n\n    The receiver of the Connection instance MUST call this method in order\n    to reclaim resources", "docstring_tokens": ["Release", "the", "database", "connection", "and", "cursor"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256544}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/doc_parser.py#L148-L169", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Classify a line into a type of object.", "language": "python", "parameters": "(cls, line)", "return_statement": "return Line(line)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "rstrip", "(", ")", "if", "len", "(", "arg_1", ")", "==", "0", ":", "return", "BlankLine", "(", "''", ")", "if", "' '", "not", "in", "arg_1", "and", "arg_1", ".", "endswith", "(", "':'", ")", ":", "arg_2", "=", "arg_1", "[", ":", "-", "1", "]", "return", "SectionHeader", "(", "arg_2", ")", "if", "arg_1", ".", "startswith", "(", "'  '", ")", ":", "return", "ContinuationLine", "(", "arg_1", ".", "lstrip", "(", ")", ")", "if", "arg_1", ".", "startswith", "(", "' - '", ")", ":", "return", "ListItem", "(", "'-'", ",", "arg_1", "[", "3", ":", "]", ".", "lstrip", "(", ")", ")", "if", "arg_1", ".", "startswith", "(", "'- '", ")", ":", "return", "ListItem", "(", "'-'", ",", "arg_1", "[", "2", ":", "]", ".", "lstrip", "(", ")", ")", "return", "Line", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Classify a line into a type of object.\"\"\"\n\n        arg_1 = arg_1.rstrip()\n\n        if len(arg_1) == 0:\n            return BlankLine('')\n\n        if ' ' not in arg_1 and arg_1.endswith(':'):\n            arg_2 = arg_1[:-1]\n            return SectionHeader(arg_2)\n\n        if arg_1.startswith('  '):\n            return ContinuationLine(arg_1.lstrip())\n\n        if arg_1.startswith(' - '):\n            return ListItem('-', arg_1[3:].lstrip())\n\n        if arg_1.startswith('- '):\n            return ListItem('-', arg_1[2:].lstrip())\n\n        return Line(arg_1)", "path": "typedargs/doc_parser.py", "identifier": "ParsedDocstring._classify_line", "docstring": "Classify a line into a type of object.", "docstring_tokens": ["Classify", "a", "line", "into", "a", "type", "of", "object", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 256545}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/pretty.py#L132-L140", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Like `pretty` but print to stdout.", "language": "python", "parameters": "(obj, verbose=False, max_width=79, newline='\\n')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "79", ",", "arg_3", "=", "'\\n'", ")", ":", "arg_4", "=", "RepresentationPrinter", "(", "sys", ".", "stdout", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_4", ".", "pretty", "(", "arg_0", ")", "arg_4", ".", "flush", "(", ")", "sys", ".", "stdout", ".", "write", "(", "arg_3", ")", "sys", ".", "stdout", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=79, arg_3='\\n'):\n    \"\"\"\n    Like `pretty` but print to stdout.\n    \"\"\"\n    arg_4 = RepresentationPrinter(sys.stdout, arg_1, arg_2, arg_3)\n    arg_4.pretty(arg_0)\n    arg_4.flush()\n    sys.stdout.write(arg_3)\n    sys.stdout.flush()", "path": "environment/lib/python2.7/site-packages/IPython/lib/pretty.py", "identifier": "pprint", "docstring": "Like `pretty` but print to stdout.", "docstring_tokens": ["Like", "pretty", "but", "print", "to", "stdout", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256546}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L364-L373", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Convert a date-value to the ISO date standard.", "language": "python", "parameters": "(value)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "\"%d %b %Y\"", ",", "\"%Y/%m/%d\"", "]", "for", "arg_2", "in", "arg_1", ":", "try", ":", "arg_3", "=", "datetime", ".", "strptime", "(", "arg_0", ",", "arg_2", ")", "return", "arg_3", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "except", "ValueError", ":", "pass", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Convert a date-value to the ISO date standard.\"\"\"\n    arg_1 = [\"%d %b %Y\", \"%Y/%m/%d\"]\n    for arg_2 in arg_1:\n        try:\n            arg_3 = datetime.strptime(arg_0, arg_2)\n            return arg_3.strftime(\"%Y-%m-%d\")\n        except ValueError:\n            pass\n    return arg_0", "path": "harvestingkit/utils.py", "identifier": "convert_date_to_iso", "docstring": "Convert a date-value to the ISO date standard.", "docstring_tokens": ["Convert", "a", "date", "-", "value", "to", "the", "ISO", "date", "standard", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 256547}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/cli.py#L40-L45", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Do some final preprocessing and send the message.", "language": "python", "parameters": "(msg_type, kwds)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "[", "\"file\"", "]", ":", "get_body_from_file", "(", "arg_1", ")", "arg_2", "=", "trim_args", "(", "arg_1", ")", "send", "(", "arg_0", ",", "send_async", "=", "False", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Do some final preprocessing and send the message.\"\"\"\n    if arg_1[\"file\"]:\n        get_body_from_file(arg_1)\n    arg_2 = trim_args(arg_1)\n    send(arg_0, send_async=False, **arg_2)", "path": "messages/cli.py", "identifier": "send_message", "docstring": "Do some final preprocessing and send the message.", "docstring_tokens": ["Do", "some", "final", "preprocessing", "and", "send", "the", "message", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 256548}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/api.py#L249-L261", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Snapshot bucket and add files in record during first publishing.", "language": "python", "parameters": "(self, record_id, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "files", ":", "assert", "not", "arg_0", ".", "files", ".", "bucket", ".", "locked", "arg_0", ".", "files", ".", "bucket", ".", "locked", "=", "True", "arg_6", "=", "arg_0", ".", "files", ".", "bucket", ".", "snapshot", "(", "lock", "=", "True", ")", "arg_2", "[", "'_files'", "]", "=", "arg_0", ".", "files", ".", "dumps", "(", "arg_4", "=", "arg_6", ".", "id", ")", "yield", "arg_2", "db", ".", "session", ".", "add", "(", "RecordsBuckets", "(", "arg_1", "=", "arg_1", ",", "bucket_id", "=", "arg_6", ".", "id", ")", ")", "else", ":", "yield", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Snapshot bucket and add files in record during first publishing.\"\"\"\n        if arg_0.files:\n            assert not arg_0.files.bucket.locked\n            arg_0.files.bucket.locked = True\n            arg_6 = arg_0.files.bucket.snapshot(lock=True)\n            arg_2['_files'] = arg_0.files.dumps(arg_4=arg_6.id)\n            yield arg_2\n            db.session.add(RecordsBuckets(\n                arg_1=arg_1, bucket_id=arg_6.id\n            ))\n        else:\n            yield arg_2", "path": "invenio_deposit/api.py", "identifier": "Deposit._process_files", "docstring": "Snapshot bucket and add files in record during first publishing.", "docstring_tokens": ["Snapshot", "bucket", "and", "add", "files", "in", "record", "during", "first", "publishing", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 256549}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_corpus.py#L264-L312", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Calculate the Inverse Document Frequency of a term in the corpus.", "language": "python", "parameters": "(self, term, transform=None)", "return_statement": "return log10(len(docs) / docs_with_term)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "0", "arg_4", "=", "arg_0", ".", "docs_of_words", "(", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "set", "(", "arg_5", ")", "if", "arg_2", ":", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_6", ":", "arg_7", ".", "append", "(", "arg_2", "(", "arg_8", ")", ")", "arg_6", "=", "set", "(", "arg_7", ")", "if", "arg_1", "in", "arg_6", ":", "arg_3", "+=", "1", "if", "arg_3", "==", "0", ":", "return", "float", "(", "'inf'", ")", "return", "log10", "(", "len", "(", "arg_4", ")", "/", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        r\"\"\"Calculate the Inverse Document Frequency of a term in the corpus.\n\n        Parameters\n        ----------\n        term : str\n            The term to calculate the IDF of\n        transform : function\n            A function to apply to each document term before checking for the\n            presence of term\n\n        Returns\n        -------\n        float\n            The IDF\n\n        Examples\n        --------\n        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\\n\\n'\n        >>> tqbf += 'And then it slept.\\n\\n And the dog ran off.'\n        >>> corp = Corpus(tqbf)\n        >>> print(corp.docs())\n        [[['The', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy',\n        'dog.']],\n        [['And', 'then', 'it', 'slept.']],\n        [['And', 'the', 'dog', 'ran', 'off.']]]\n        >>> round(corp.Func('dog'), 10)\n        0.4771212547\n        >>> round(corp.Func('the'), 10)\n        0.1760912591\n\n        \"\"\"\n        arg_3 = 0\n        arg_4 = arg_0.docs_of_words()\n        for arg_5 in arg_4:\n            arg_6 = set(arg_5)\n            if arg_2:\n                arg_7 = []\n                for arg_8 in arg_6:\n                    arg_7.append(arg_2(arg_8))\n                arg_6 = set(arg_7)\n\n            if arg_1 in arg_6:\n                arg_3 += 1\n\n        if arg_3 == 0:\n            return float('inf')\n\n        return log10(len(arg_4) / arg_3)", "path": "abydos/corpus/_corpus.py", "identifier": "Corpus.idf", "docstring": "r\"\"\"Calculate the Inverse Document Frequency of a term in the corpus.\n\n        Parameters\n        ----------\n        term : str\n            The term to calculate the IDF of\n        transform : function\n            A function to apply to each document term before checking for the\n            presence of term\n\n        Returns\n        -------\n        float\n            The IDF\n\n        Examples\n        --------\n        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\\n\\n'\n        >>> tqbf += 'And then it slept.\\n\\n And the dog ran off.'\n        >>> corp = Corpus(tqbf)\n        >>> print(corp.docs())\n        [[['The', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy',\n        'dog.']],\n        [['And', 'then', 'it', 'slept.']],\n        [['And', 'the', 'dog', 'ran', 'off.']]]\n        >>> round(corp.idf('dog'), 10)\n        0.4771212547\n        >>> round(corp.idf('the'), 10)\n        0.1760912591", "docstring_tokens": ["r", "Calculate", "the", "Inverse", "Document", "Frequency", "of", "a", "term", "in", "the", "corpus", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 256550}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L738-L794", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Read an image and generate Striplog.", "language": "python", "parameters": "(cls, filename, start, stop, legend,\n                   source=\"Image\",\n                   col_offset=0.1,\n                   row_offset=2,\n                   tolerance=0)", "return_statement": "return cls(list_of_Intervals, source=\"Image\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "\"Image\"", ",", "arg_6", "=", "0.1", ",", "arg_7", "=", "2", ",", "arg_8", "=", "0", ")", ":", "arg_9", "=", "utils", ".", "loglike_Func", "(", "arg_1", ",", "arg_6", ")", "arg_10", "=", "np", ".", "array", "(", "[", "utils", ".", "rgb_to_hex", "(", "t", ")", "for", "t", "in", "arg_9", "]", ")", "arg_11", ",", "arg_12", "=", "utils", ".", "tops_from_loglike", "(", "arg_10", ",", "offset", "=", "arg_7", ")", "arg_13", "=", "np", ".", "append", "(", "np", ".", "diff", "(", "arg_11", ")", ",", "2", ")", "arg_11", "=", "arg_11", "[", "arg_13", ">", "1", "]", "arg_12", "=", "arg_12", "[", "arg_13", ">", "1", "]", "arg_14", "=", "list", "(", "set", "(", "arg_12", ")", ")", "arg_15", "=", "[", "arg_4", ".", "get_component", "(", "h", ",", "arg_8", "=", "arg_8", ")", "for", "h", "in", "arg_14", "]", "arg_16", "=", "[", "arg_14", ".", "index", "(", "i", ")", "for", "i", "in", "arg_12", "]", "arg_17", "=", "np", ".", "linspace", "(", "arg_2", ",", "arg_3", ",", "arg_10", ".", "size", ")", "arg_18", "=", "arg_0", ".", "__intervals_from_tops", "(", "arg_11", ",", "arg_16", ",", "arg_17", ",", "arg_15", ")", "return", "arg_0", "(", "arg_18", ",", "arg_5", "=", "\"Image\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                   arg_5=\"Image\",\n                   arg_6=0.1,\n                   arg_7=2,\n                   arg_8=0):\n        \"\"\"\n        Read an image and generate Striplog.\n\n        Args:\n            filename (str): An image file, preferably high-res PNG.\n            start (float or int): The depth at the top of the image.\n            stop (float or int): The depth at the bottom of the image.\n            legend (Legend): A legend to look up the components in.\n            source (str): A source for the data. Default: 'Image'.\n            col_offset (Number): The proportion of the way across the image\n                from which to extract the pixel column. Default: 0.1 (ie 10%).\n            row_offset (int): The number of pixels to skip at the top of\n                each change in colour. Default: 2.\n            tolerance (float): The Euclidean distance between hex colours,\n                which has a maximum (black to white) of 441.67 in base 10.\n                Default: 0.\n\n        Returns:\n            Striplog: The ``striplog`` object.\n        \"\"\"\n        arg_9 = utils.loglike_Func(arg_1, arg_6)\n        arg_10 = np.array([utils.rgb_to_hex(t) for t in arg_9])\n\n        # Get the pixels and colour values at 'tops' (i.e. changes).\n        arg_11, arg_12 = utils.tops_from_loglike(arg_10, offset=arg_7)\n\n        # If there are consecutive tops, we assume it's because there is a\n        # single-pixel row that we don't want. So take the second one only.\n        # We used to do this reduction in ``utils.tops_from_loglike()`` but\n        # it was prventing us from making intervals only one sample thick.\n        arg_13 = np.append(np.diff(arg_11), 2)\n        arg_11 = arg_11[arg_13 > 1]\n        arg_12 = arg_12[arg_13 > 1]\n\n        # Get the set of unique colours.\n        arg_14 = list(set(arg_12))\n\n        # Get the components corresponding to the colours.\n        arg_15 = [arg_4.get_component(h, arg_8=arg_8)\n                      for h in arg_14]\n\n        # Turn them into integers.\n        arg_16 = [arg_14.index(i) for i in arg_12]\n\n        arg_17 = np.linspace(arg_2, arg_3, arg_10.size)\n\n        arg_18 = arg_0.__intervals_from_tops(arg_11,\n                                                      arg_16,\n                                                      arg_17,\n                                                      arg_15)\n\n        return arg_0(arg_18, arg_5=\"Image\")", "path": "striplog/striplog.py", "identifier": "Striplog.from_image", "docstring": "Read an image and generate Striplog.\n\n        Args:\n            filename (str): An image file, preferably high-res PNG.\n            start (float or int): The depth at the top of the image.\n            stop (float or int): The depth at the bottom of the image.\n            legend (Legend): A legend to look up the components in.\n            source (str): A source for the data. Default: 'Image'.\n            col_offset (Number): The proportion of the way across the image\n                from which to extract the pixel column. Default: 0.1 (ie 10%).\n            row_offset (int): The number of pixels to skip at the top of\n                each change in colour. Default: 2.\n            tolerance (float): The Euclidean distance between hex colours,\n                which has a maximum (black to white) of 441.67 in base 10.\n                Default: 0.\n\n        Returns:\n            Striplog: The ``striplog`` object.", "docstring_tokens": ["Read", "an", "image", "and", "generate", "Striplog", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 256551}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/templite.py#L44-L50", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Compile the code, and return the function `fn_name`.", "language": "python", "parameters": "(self, fn_name)", "return_statement": "return g[fn_name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_0", ".", "indent_amount", "==", "0", "arg_2", "=", "{", "}", "arg_3", "=", "str", "(", "arg_0", ")", "exec", "(", "arg_3", ",", "arg_2", ")", "return", "arg_2", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Compile the code, and return the function `fn_name`.\"\"\"\n        assert arg_0.indent_amount == 0\n        arg_2 = {}\n        arg_3 = str(arg_0)\n        exec(arg_3, arg_2)\n        return arg_2[arg_1]", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/templite.py", "identifier": "CodeBuilder.get_function", "docstring": "Compile the code, and return the function `fn_name`.", "docstring_tokens": ["Compile", "the", "code", "and", "return", "the", "function", "fn_name", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256552}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/__init__.py#L284-L309", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Check the syntax of the given domain.", "language": "python", "parameters": "(domain)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "and", "isinstance", "(", "arg_0", ",", "str", ")", ":", "load_config", "(", "True", ")", "return", "Check", "(", "arg_0", ")", ".", "is_domain_valid", "(", ")", "return", "None"], "function": "def Func(arg_0):  # pragma: no cover\n    \"\"\"\n    Check the syntax of the given domain.\n\n    :param domain: The domain to check the syntax for.\n    :type domain: str\n\n    :return: The syntax validity.\n    :rtype: bool\n\n    .. warning::\n        If an empty or a non-string :code:`domain` is given, we return :code:`None`.\n    \"\"\"\n\n    if arg_0 and isinstance(arg_0, str):\n        # * The given domain is not empty nor None.\n        # and\n        # * The given domain is a string.\n\n        # We silently load the configuration.\n        load_config(True)\n\n        return Check(arg_0).is_domain_valid()\n\n    # We return None, there is nothing to check.\n    return None", "path": "PyFunceble/__init__.py", "identifier": "syntax_check", "docstring": "Check the syntax of the given domain.\n\n    :param domain: The domain to check the syntax for.\n    :type domain: str\n\n    :return: The syntax validity.\n    :rtype: bool\n\n    .. warning::\n        If an empty or a non-string :code:`domain` is given, we return :code:`None`.", "docstring_tokens": ["Check", "the", "syntax", "of", "the", "given", "domain", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 256553}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_manhattan.py#L121-L156", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the Manhattan distance between two strings.", "language": "python", "parameters": "(src, tar, qval=2, normalized=False, alphabet=None)", "return_statement": "return Manhattan().dist_abs(src, tar, qval, normalized, alphabet)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "return", "Manhattan", "(", ")", ".", "dist_abs", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=2, arg_3=False, arg_4=None):\n    \"\"\"Return the Manhattan distance between two strings.\n\n    This is a wrapper for :py:meth:`Manhattan.dist_abs`.\n\n    Parameters\n    ----------\n    src : str\n        Source string (or QGrams/Counter objects) for comparison\n    tar : str\n        Target string (or QGrams/Counter objects) for comparison\n    qval : int\n        The length of each q-gram; 0 for non-q-gram version\n    normalized : bool\n        Normalizes to [0, 1] if True\n    alphabet : collection or int\n        The values or size of the alphabet\n\n    Returns\n    -------\n    float\n        The Manhattan distance\n\n    Examples\n    --------\n    >>> Func('cat', 'hat')\n    4.0\n    >>> Func('Niall', 'Neil')\n    7.0\n    >>> Func('Colin', 'Cuilen')\n    9.0\n    >>> Func('ATCG', 'TAGC')\n    10.0\n\n    \"\"\"\n    return Manhattan().dist_abs(arg_0, arg_1, arg_2, arg_3, arg_4)", "path": "abydos/distance/_manhattan.py", "identifier": "manhattan", "docstring": "Return the Manhattan distance between two strings.\n\n    This is a wrapper for :py:meth:`Manhattan.dist_abs`.\n\n    Parameters\n    ----------\n    src : str\n        Source string (or QGrams/Counter objects) for comparison\n    tar : str\n        Target string (or QGrams/Counter objects) for comparison\n    qval : int\n        The length of each q-gram; 0 for non-q-gram version\n    normalized : bool\n        Normalizes to [0, 1] if True\n    alphabet : collection or int\n        The values or size of the alphabet\n\n    Returns\n    -------\n    float\n        The Manhattan distance\n\n    Examples\n    --------\n    >>> manhattan('cat', 'hat')\n    4.0\n    >>> manhattan('Niall', 'Neil')\n    7.0\n    >>> manhattan('Colin', 'Cuilen')\n    9.0\n    >>> manhattan('ATCG', 'TAGC')\n    10.0", "docstring_tokens": ["Return", "the", "Manhattan", "distance", "between", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 256554}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/experiment_runner.py#L132-L181", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Run a single OPF experiment.", "language": "python", "parameters": "(args, model=None)", "return_statement": "return model", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "_parseCommandLineOptions", "(", "arg_0", ")", "arg_1", "=", "_FuncImpl", "(", "arg_2", ",", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"\n  Run a single OPF experiment.\n\n  .. note:: The caller is responsible for initializing python logging before\n     calling this function (e.g., import :mod:`nupic.support`;\n     :meth:`nupic.support.initLogging`)\n\n  See also: :meth:`.initExperimentPrng`.\n\n  :param args: (string) Experiment command-line args list. Too see all options,\n      run with ``--help``:\n\n      .. code-block:: text\n\n        Options:\n          -h, --help           show this help message and exit\n          -c <CHECKPOINT>      Create a model and save it under the given <CHECKPOINT>\n                               name, but don't run it\n          --listCheckpoints    List all available checkpoints\n          --listTasks          List all task labels in description.py\n          --load=<CHECKPOINT>  Load a model from the given <CHECKPOINT> and run it.\n                               Run with --listCheckpoints flag for more details.\n          --newSerialization   Use new capnproto serialization\n          --tasks              Run the tasks with the given TASK LABELS in the order\n                               they are given.  Either end of arg-list, or a\n                               standalone dot ('.') arg or the next short or long\n                               option name (-a or --blah) terminates the list. NOTE:\n                               FAILS TO RECOGNIZE task label names with one or more\n                               leading dashes. [default: run all of the tasks in\n                               description.py]\n          --testMode           Reduce iteration count for testing\n          --noCheckpoint       Don't checkpoint the model after running each task.\n\n  :param model: (:class:`~nupic.frameworks.opf.model.Model`) For testing, may\n      pass in an existing OPF Model to use instead of creating a new one.\n\n  :returns: (:class:`~nupic.frameworks.opf.model.Model`)\n    reference to OPF Model instance that was constructed (this\n    is provided to aid with debugging) or None, if none was\n    created.\n  \"\"\"\n  # Parse command-line options\n  arg_2 = _parseCommandLineOptions(arg_0)\n\n  #print \"Func: Parsed Command Options: \", opt\n\n  arg_1 = _FuncImpl(arg_2, arg_1)\n\n  return arg_1", "path": "src/nupic/frameworks/opf/experiment_runner.py", "identifier": "runExperiment", "docstring": "Run a single OPF experiment.\n\n  .. note:: The caller is responsible for initializing python logging before\n     calling this function (e.g., import :mod:`nupic.support`;\n     :meth:`nupic.support.initLogging`)\n\n  See also: :meth:`.initExperimentPrng`.\n\n  :param args: (string) Experiment command-line args list. Too see all options,\n      run with ``--help``:\n\n      .. code-block:: text\n\n        Options:\n          -h, --help           show this help message and exit\n          -c <CHECKPOINT>      Create a model and save it under the given <CHECKPOINT>\n                               name, but don't run it\n          --listCheckpoints    List all available checkpoints\n          --listTasks          List all task labels in description.py\n          --load=<CHECKPOINT>  Load a model from the given <CHECKPOINT> and run it.\n                               Run with --listCheckpoints flag for more details.\n          --newSerialization   Use new capnproto serialization\n          --tasks              Run the tasks with the given TASK LABELS in the order\n                               they are given.  Either end of arg-list, or a\n                               standalone dot ('.') arg or the next short or long\n                               option name (-a or --blah) terminates the list. NOTE:\n                               FAILS TO RECOGNIZE task label names with one or more\n                               leading dashes. [default: run all of the tasks in\n                               description.py]\n          --testMode           Reduce iteration count for testing\n          --noCheckpoint       Don't checkpoint the model after running each task.\n\n  :param model: (:class:`~nupic.frameworks.opf.model.Model`) For testing, may\n      pass in an existing OPF Model to use instead of creating a new one.\n\n  :returns: (:class:`~nupic.frameworks.opf.model.Model`)\n    reference to OPF Model instance that was constructed (this\n    is provided to aid with debugging) or None, if none was\n    created.", "docstring_tokens": ["Run", "a", "single", "OPF", "experiment", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256555}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L285-L294", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Remove it but raise KeyError if not found", "language": "python", "parameters": "(self, it: Signature)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "bool", ":", "arg_3", "=", "arg_1", ".", "internal_name", "(", ")", "if", "arg_3", "not", "in", "arg_0", ".", "_hsig", ":", "raise", "KeyError", "(", "arg_1", ".", "show_name", "(", ")", "+", "' not in Set'", ")", "arg_4", "=", "arg_0", ".", "_hsig", "[", "arg_3", "]", "if", "isinstance", "(", "arg_4", ",", "Scope", ")", ":", "arg_4", ".", "state", "=", "StateScope", ".", "LINKED", "del", "arg_0", ".", "_hsig", "[", "arg_3", "]", "return", "True"], "function": "def Func(arg_0, arg_1: arg_2) -> bool:\n        \"\"\" Remove it but raise KeyError if not found \"\"\"\n        arg_3 = arg_1.internal_name()\n        if arg_3 not in arg_0._hsig:\n            raise KeyError(arg_1.show_name() + ' not in Set')\n        arg_4 = arg_0._hsig[arg_3]\n        if isinstance(arg_4, Scope):\n            arg_4.state = StateScope.LINKED\n        del arg_0._hsig[arg_3]\n        return True", "path": "pyrser/type_system/scope.py", "identifier": "Scope.remove", "docstring": "Remove it but raise KeyError if not found", "docstring_tokens": ["Remove", "it", "but", "raise", "KeyError", "if", "not", "found"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 256556}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/failuredetail.py#L37-L43", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Add detail from traceback inspection to error message of a failure.", "language": "python", "parameters": "(self, test, err)", "return_statement": "return (ec, '\\n'.join([str(ev), tbinfo]), tb)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_2", "arg_6", "=", "inspect_traceback", "(", "arg_5", ")", "arg_1", ".", "tbinfo", "=", "arg_6", "return", "(", "arg_3", ",", "'\\n'", ".", "join", "(", "[", "str", "(", "arg_4", ")", ",", "arg_6", "]", ")", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add detail from traceback inspection to error message of a failure.\n        \"\"\"\n        arg_3, arg_4, arg_5 = arg_2\n        arg_6 = inspect_traceback(arg_5)\n        arg_1.tbinfo = arg_6\n        return (arg_3, '\\n'.join([str(arg_4), arg_6]), arg_5)", "path": "environment/lib/python2.7/site-packages/nose/plugins/failuredetail.py", "identifier": "FailureDetail.formatFailure", "docstring": "Add detail from traceback inspection to error message of a failure.", "docstring_tokens": ["Add", "detail", "from", "traceback", "inspection", "to", "error", "message", "of", "a", "failure", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256557}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1111-L1119", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Click the right mouse button without modifiers pressed.", "language": "python", "parameters": "(self, coord)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_0", ".", "_queueMouseButton", "(", "arg_1", ",", "Quartz", ".", "kCGMouseButtonRight", ",", "arg_2", ")", "arg_0", ".", "_postQueuedEvents", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Click the right mouse button without modifiers pressed.\n\n        Parameters: coordinates to click on scren (tuple (x, y))\n        Returns: None\n        \"\"\"\n        arg_2 = 0\n        arg_0._queueMouseButton(arg_1, Quartz.kCGMouseButtonRight, arg_2)\n        arg_0._postQueuedEvents()", "path": "atomac/AXClasses.py", "identifier": "NativeUIElement.clickMouseButtonRight", "docstring": "Click the right mouse button without modifiers pressed.\n\n        Parameters: coordinates to click on scren (tuple (x, y))\n        Returns: None", "docstring_tokens": ["Click", "the", "right", "mouse", "button", "without", "modifiers", "pressed", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 256558}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/types/bitValFunctions.py#L17-L25", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Convert negative int to positive int which has same bits set", "language": "python", "parameters": "(val, width)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ">", "0", ":", "arg_2", "=", "1", "<<", "(", "arg_1", "-", "1", ")", "if", "arg_0", "&", "arg_2", ":", "arg_0", "-=", "mask", "(", "arg_1", ")", "+", "1", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Convert negative int to positive int which has same bits set\n    \"\"\"\n    if arg_0 > 0:\n        arg_2 = 1 << (arg_1 - 1)\n        if arg_0 & arg_2:\n            arg_0 -= mask(arg_1) + 1\n    return arg_0", "path": "hwt/hdl/types/bitValFunctions.py", "identifier": "signFix", "docstring": "Convert negative int to positive int which has same bits set", "docstring_tokens": ["Convert", "negative", "int", "to", "positive", "int", "which", "has", "same", "bits", "set"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 256559}
{"url": "https://github.com/monero-ecosystem/monero-python/blob/64149f6323af57a3924f45ed87997d64387c5ee0/monero/wallet.py#L233-L259", "sha": "64149f6323af57a3924f45ed87997d64387c5ee0", "docstring_summary": "Sends a transfer from the default account. Returns a list of resulting transactions.", "language": "python", "parameters": "(self, address, amount,\n            priority=prio.NORMAL, payment_id=None, unlock_time=0,\n            relay=True)", "return_statement": "return self.accounts[0].transfer(\n                address,\n                amount,\n                priority=priority,\n                payment_id=payment_id,\n                unlock_time=unlock_time,\n                relay=relay)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "NORMAL", ",", "arg_6", "=", "None", ",", "arg_7", "=", "0", ",", "arg_8", "=", "True", ")", ":", "return", "arg_0", ".", "accounts", "[", "0", "]", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n            arg_3=arg_4.NORMAL, arg_6=None, arg_7=0,\n            arg_8=True):\n        \"\"\"\n        Sends a Func from the default account. Returns a list of resulting transactions.\n\n        :param address: destination :class:`Address <monero.address.Address>` or subtype\n        :param amount: amount to send\n        :param priority: transaction priority, implies fee. The priority can be a number\n                    from 1 to 4 (unimportant, normal, elevated, priority) or a constant\n                    from `monero.prio`.\n        :param payment_id: ID for the payment (must be None if\n                        :class:`IntegratedAddress <monero.address.IntegratedAddress>`\n                        is used as the destination)\n        :param unlock_time: the extra unlock delay\n        :param relay: if `True`, the wallet will relay the transaction(s) to the network\n                        immediately; when `False`, it will only return the transaction(s)\n                        so they might be broadcasted later\n        :rtype: list of :class:`Transaction <monero.transaction.Transaction>`\n        \"\"\"\n        return arg_0.accounts[0].Func(\n                arg_1,\n                arg_2,\n                arg_3=arg_3,\n                arg_6=arg_6,\n                arg_7=arg_7,\n                arg_8=arg_8)", "path": "monero/wallet.py", "identifier": "Wallet.transfer", "docstring": "Sends a transfer from the default account. Returns a list of resulting transactions.\n\n        :param address: destination :class:`Address <monero.address.Address>` or subtype\n        :param amount: amount to send\n        :param priority: transaction priority, implies fee. The priority can be a number\n                    from 1 to 4 (unimportant, normal, elevated, priority) or a constant\n                    from `monero.prio`.\n        :param payment_id: ID for the payment (must be None if\n                        :class:`IntegratedAddress <monero.address.IntegratedAddress>`\n                        is used as the destination)\n        :param unlock_time: the extra unlock delay\n        :param relay: if `True`, the wallet will relay the transaction(s) to the network\n                        immediately; when `False`, it will only return the transaction(s)\n                        so they might be broadcasted later\n        :rtype: list of :class:`Transaction <monero.transaction.Transaction>`", "docstring_tokens": ["Sends", "a", "transfer", "from", "the", "default", "account", ".", "Returns", "a", "list", "of", "resulting", "transactions", "."], "nwo": "monero-ecosystem/monero-python", "score": 0.4699390838066248, "idx": 256560}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1346-L1356", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Remove card from tradepile.", "language": "python", "parameters": "(self, trade_id)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'DELETE'", "arg_3", "=", "'trade/%s'", "%", "arg_1", "arg_0", ".", "__request__", "(", "arg_2", ",", "arg_3", ")", "return", "True"], "function": "def Func(arg_0, arg_1):  # item_id instead of trade_id?\n        \"\"\"Remove card from tradepile.\n\n        :params trade_id: Trade id.\n        \"\"\"\n        arg_2 = 'DELETE'\n        arg_3 = 'trade/%s' % arg_1\n\n        arg_0.__request__(arg_2, arg_3)  # returns nothing\n        # TODO: validate status code\n        return True", "path": "fut/core.py", "identifier": "Core.tradepileDelete", "docstring": "Remove card from tradepile.\n\n        :params trade_id: Trade id.", "docstring_tokens": ["Remove", "card", "from", "tradepile", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 256561}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1369-L1387", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Specify a callback function to be called when clients specify a server\n        name.", "language": "python", "parameters": "(self, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_1", "(", "Connection", ".", "_reverse_mapping", "[", "arg_2", "]", ")", "return", "0", "arg_0", ".", "_tlsext_servername_callback", "=", "_ffi", ".", "callback", "(", "\"int (*)(SSL *, int *, void *)\"", ",", "wrapper", ")", "_lib", ".", "SSL_CTX_Func", "(", "arg_0", ".", "_context", ",", "arg_0", ".", "_tlsext_servername_callback", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Specify a callback function to be called when clients specify a server\n        name.\n\n        :param callback: The callback function.  It will be invoked with one\n            argument, the Connection instance.\n\n        .. versionadded:: 0.13\n        \"\"\"\n        @wraps(arg_1)\n        def wrapper(arg_2, arg_3, arg_4):\n            arg_1(Connection._reverse_mapping[arg_2])\n            return 0\n\n        arg_0._tlsext_servername_callback = _ffi.callback(\n            \"int (*)(SSL *, int *, void *)\", wrapper)\n        _lib.SSL_CTX_Func(\n            arg_0._context, arg_0._tlsext_servername_callback)", "path": "src/OpenSSL/SSL.py", "identifier": "Context.set_tlsext_servername_callback", "docstring": "Specify a callback function to be called when clients specify a server\n        name.\n\n        :param callback: The callback function.  It will be invoked with one\n            argument, the Connection instance.\n\n        .. versionadded:: 0.13", "docstring_tokens": ["Specify", "a", "callback", "function", "to", "be", "called", "when", "clients", "specify", "a", "server", "name", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256562}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_kvlayer_keyword_search.py#L189-L210", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Get document frequencies for a list of hashes.", "language": "python", "parameters": "(self, hashes)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "(", "arg_3", ",", "arg_4", ")", "in", "arg_0", ".", "client", ".", "get", "(", "HASH_FREQUENCY_TABLE", ",", "*", "[", "(", "h", ",", ")", "for", "h", "in", "arg_1", "]", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "0", "arg_2", "[", "arg_3", "[", "0", "]", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''Get document frequencies for a list of hashes.\n\n        This will return all zeros unless the index was written with\n        `hash_frequencies` set.  If :data:`DOCUMENT_HASH_KEY` is\n        included in `hashes`, that value will be returned with the\n        total number of documents indexed.  If you are looking for\n        documents with that hash, pass\n        :data:`DOCUMENT_HASH_KEY_REPLACEMENT` instead.\n\n        :param hashes: hashes to query\n        :paramtype hashes: list of :class:`int`\n        :return: map from hash to document frequency\n\n        '''\n        arg_2 = {}\n        for (arg_3, arg_4) in arg_0.client.get(HASH_FREQUENCY_TABLE,\n                                      *[(h,) for h in arg_1]):\n            if arg_4 is None:\n                arg_4 = 0\n            arg_2[arg_3[0]] = arg_4\n        return arg_2", "path": "streamcorpus_pipeline/_kvlayer_keyword_search.py", "identifier": "keyword_indexer.document_frequencies", "docstring": "Get document frequencies for a list of hashes.\n\n        This will return all zeros unless the index was written with\n        `hash_frequencies` set.  If :data:`DOCUMENT_HASH_KEY` is\n        included in `hashes`, that value will be returned with the\n        total number of documents indexed.  If you are looking for\n        documents with that hash, pass\n        :data:`DOCUMENT_HASH_KEY_REPLACEMENT` instead.\n\n        :param hashes: hashes to query\n        :paramtype hashes: list of :class:`int`\n        :return: map from hash to document frequency", "docstring_tokens": ["Get", "document", "frequencies", "for", "a", "list", "of", "hashes", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 256563}
{"url": "https://github.com/nyaruka/python-librato-bg/blob/e541092838694de31d256becea8391a9cfe086c7/librato_bg/client.py#L63-L67", "sha": "e541092838694de31d256becea8391a9cfe086c7", "docstring_summary": "Require that the named `field` has the right `data_type`", "language": "python", "parameters": "(name, field, data_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "'{0} must have {1}, got: {2}'", ".", "format", "(", "arg_0", ",", "arg_2", ",", "arg_1", ")", "raise", "AssertionError", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Require that the named `field` has the right `data_type`\"\"\"\n    if not isinstance(arg_1, arg_2):\n        arg_3 = '{0} must have {1}, got: {2}'.format(arg_0, arg_2, arg_1)\n        raise AssertionError(arg_3)", "path": "librato_bg/client.py", "identifier": "require", "docstring": "Require that the named `field` has the right `data_type`", "docstring_tokens": ["Require", "that", "the", "named", "field", "has", "the", "right", "data_type"], "nwo": "nyaruka/python-librato-bg", "score": 0.0, "idx": 256564}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L1905-L1984", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Slice all the annotations inside the jam and return as a new `JAMS`\n        object.", "language": "python", "parameters": "(self, start_time, end_time, strict=False)", "return_statement": "return jam_sliced", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "if", "arg_0", ".", "file_metadata", ".", "duration", "is", "None", ":", "raise", "JamsError", "(", "'Duration must be set (jam.file_metadata.duration) before '", "'slicing can be performed.'", ")", "if", "(", "arg_1", "<", "0", "or", "arg_1", ">", "float", "(", "arg_0", ".", "file_metadata", ".", "duration", ")", "or", "arg_2", "<", "arg_1", "or", "arg_2", ">", "float", "(", "arg_0", ".", "file_metadata", ".", "duration", ")", ")", ":", "raise", "ParameterError", "(", "'start_time and end_time must be within the original file '", "'duration ({:f}) and end_time cannot be smaller than '", "'start_time.'", ".", "format", "(", "float", "(", "arg_0", ".", "file_metadata", ".", "duration", ")", ")", ")", "arg_4", "=", "JAMS", "(", "arg_5", "=", "None", ",", "arg_6", "=", "arg_0", ".", "file_metadata", ",", "sandbox", "=", "arg_0", ".", "sandbox", ")", "arg_4", ".", "annotations", "=", "arg_0", ".", "annotations", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_4", ".", "file_metadata", ".", "duration", "=", "arg_2", "-", "arg_1", "if", "'Func'", "not", "in", "arg_4", ".", "sandbox", ".", "keys", "(", ")", ":", "arg_4", ".", "sandbox", ".", "update", "(", "Func", "=", "[", "{", "'start_time'", ":", "arg_1", ",", "'end_time'", ":", "arg_2", "}", "]", ")", "else", ":", "arg_4", ".", "sandbox", ".", "Func", ".", "append", "(", "{", "'start_time'", ":", "arg_1", ",", "'end_time'", ":", "arg_2", "}", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        '''\n        Slice all the annotations inside the jam and return as a new `JAMS`\n        object.\n\n        See `Annotation.Func` for details about how the annotations\n        are Funcd.\n\n        This operation is also documented in the jam-level sandbox\n        with a list keyed by ``JAMS.sandbox.Func`` containing a tuple for each\n        jam-level Func of the form ``(start_time, end_time)``.\n\n        Since slicing is implemented using trimming, the operation will also be\n        documented in ``JAMS.sandbox.trim`` as described in `JAMS.trim`.\n\n        This function also copies over all of the file metadata from the\n        original jam.\n\n        Note: slicing will affect the duration of the jam, i.e. the new value\n        of ``JAMS.file_metadata.duration`` will be ``end_time - start_time``.\n\n        Parameters\n        ----------\n        start_time : float\n            The desired start time for slicing in seconds.\n        end_time\n            The desired end time for slicing in seconds. Must be greater than\n            ``start_time``.\n        strict : bool\n            When ``False`` (default) observations that lie at the boundaries of\n            the slicing range (see `Annotation.Func` for details), will have\n            their time and/or duration adjusted such that only the part of the\n            observation that lies within the Func range is kept. When ``True``\n            such observations are discarded and not included in the Funcd\n            annotation.\n\n        Returns\n        -------\n        jam_Funcd: JAMS\n            The Funcd jam with Funcd annotations, returned as a new\n            JAMS object.\n\n        '''\n        # Make sure duration is set in file metadata\n        if arg_0.file_metadata.duration is None:\n            raise JamsError(\n                'Duration must be set (jam.file_metadata.duration) before '\n                'slicing can be performed.')\n\n        # Make sure start and end times are within the file start/end times\n        if (arg_1 < 0 or\n                arg_1 > float(arg_0.file_metadata.duration) or\n                arg_2 < arg_1 or\n                arg_2 > float(arg_0.file_metadata.duration)):\n            raise ParameterError(\n                'start_time and end_time must be within the original file '\n                'duration ({:f}) and end_time cannot be smaller than '\n                'start_time.'.format(float(arg_0.file_metadata.duration)))\n\n        # Create a new jams\n        arg_4 = JAMS(arg_5=None,\n                          arg_6=arg_0.file_metadata,\n                          sandbox=arg_0.sandbox)\n\n        # trim annotations\n        arg_4.annotations = arg_0.annotations.Func(\n            arg_1, arg_2, arg_3=arg_3)\n\n        # adjust dutation\n        arg_4.file_metadata.duration = arg_2 - arg_1\n\n        # Document jam-level trim in top level sandbox\n        if 'Func' not in arg_4.sandbox.keys():\n            arg_4.sandbox.update(\n                Func=[{'start_time': arg_1, 'end_time': arg_2}])\n        else:\n            arg_4.sandbox.Func.append(\n                {'start_time': arg_1, 'end_time': arg_2})\n\n        return arg_4", "path": "jams/core.py", "identifier": "JAMS.slice", "docstring": "Slice all the annotations inside the jam and return as a new `JAMS`\n        object.\n\n        See `Annotation.slice` for details about how the annotations\n        are sliced.\n\n        This operation is also documented in the jam-level sandbox\n        with a list keyed by ``JAMS.sandbox.slice`` containing a tuple for each\n        jam-level slice of the form ``(start_time, end_time)``.\n\n        Since slicing is implemented using trimming, the operation will also be\n        documented in ``JAMS.sandbox.trim`` as described in `JAMS.trim`.\n\n        This function also copies over all of the file metadata from the\n        original jam.\n\n        Note: slicing will affect the duration of the jam, i.e. the new value\n        of ``JAMS.file_metadata.duration`` will be ``end_time - start_time``.\n\n        Parameters\n        ----------\n        start_time : float\n            The desired start time for slicing in seconds.\n        end_time\n            The desired end time for slicing in seconds. Must be greater than\n            ``start_time``.\n        strict : bool\n            When ``False`` (default) observations that lie at the boundaries of\n            the slicing range (see `Annotation.slice` for details), will have\n            their time and/or duration adjusted such that only the part of the\n            observation that lies within the slice range is kept. When ``True``\n            such observations are discarded and not included in the sliced\n            annotation.\n\n        Returns\n        -------\n        jam_sliced: JAMS\n            The sliced jam with sliced annotations, returned as a new\n            JAMS object.", "docstring_tokens": ["Slice", "all", "the", "annotations", "inside", "the", "jam", "and", "return", "as", "a", "new", "JAMS", "object", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 256565}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/dynamicimports.py#L37-L67", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Dynamically creates a class.", "language": "python", "parameters": "(class_name, dynamic_imports)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "globals", "(", ")", "[", "arg_0", "]", "if", "not", "inspect", ".", "isclass", "(", "arg_2", ")", ":", "raise", "TypeError", "(", "'Not a class!'", ")", "return", "arg_2", "except", "(", "KeyError", ",", "TypeError", ")", ":", "for", "arg_3", "in", "arg_1", ":", "if", "inspect", ".", "isclass", "(", "arg_3", ")", ":", "if", "arg_0", "==", "arg_3", ".", "__name__", ":", "return", "arg_3", "else", ":", "arg_4", "=", "arg_3", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "if", "arg_0", "==", "arg_4", ":", "arg_2", "=", "load_class", "(", "arg_3", ")", "return", "arg_2", "raise", "ImportError", "(", "'Could not create the class named `%s`.'", "%", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Dynamically creates a class.\n\n    It is tried if the class can be created by the already given imports.\n    If not the list of the dynamically loaded classes is used.\n\n    \"\"\"\n    try:\n        arg_2 = globals()[arg_0]\n\n        if not inspect.isclass(arg_2):\n            raise TypeError('Not a class!')\n\n        return arg_2\n    except (KeyError, TypeError):\n        for arg_3 in arg_1:\n            # Dynamic classes can be provided directly as a Class instance,\n            # for example as `MyCustomParameter`,\n            # or as a string describing where to import the class from,\n            # for instance as `'mypackage.mymodule.MyCustomParameter'`.\n            if inspect.isclass(arg_3):\n                if arg_0 == arg_3.__name__:\n                    return arg_3\n            else:\n                # The class name is always the last in an import string,\n                # e.g. `'mypackage.mymodule.MyCustomParameter'`\n                arg_4 = arg_3.split('.')[-1]\n                if arg_0 == arg_4:\n                    arg_2 = load_class(arg_3)\n                    return arg_2\n        raise ImportError('Could not create the class named `%s`.' % arg_0)", "path": "pypet/utils/dynamicimports.py", "identifier": "create_class", "docstring": "Dynamically creates a class.\n\n    It is tried if the class can be created by the already given imports.\n    If not the list of the dynamically loaded classes is used.", "docstring_tokens": ["Dynamically", "creates", "a", "class", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256566}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/ast/state.py#L47-L54", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "all state in the register have a uid", "language": "python", "parameters": "(self, s: State)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "id", "(", "arg_1", ")", "arg_4", "=", "len", "(", "arg_0", ".", "states", ")", "if", "arg_3", "not", "in", "arg_0", ".", "states", ":", "arg_0", ".", "states", "[", "arg_3", "]", "=", "(", "arg_4", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        all state in the register have a uid\n        \"\"\"\n        arg_3 = id(arg_1)\n        arg_4 = len(arg_0.states)\n        if arg_3 not in arg_0.states:\n            arg_0.states[arg_3] = (arg_4, arg_1)", "path": "pyrser/ast/state.py", "identifier": "StateRegister.add_state", "docstring": "all state in the register have a uid", "docstring_tokens": ["all", "state", "in", "the", "register", "have", "a", "uid"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 256567}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2123-L2137", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Retrieve the random value used with the client hello message.", "language": "python", "parameters": "(self)", "return_statement": "return _ffi.buffer(outp, length)[:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_lib", ".", "SSL_get_session", "(", "arg_0", ".", "_ssl", ")", "if", "arg_1", "==", "_ffi", ".", "NULL", ":", "return", "None", "arg_2", "=", "_lib", ".", "SSL_get_Func", "(", "arg_0", ".", "_ssl", ",", "_ffi", ".", "NULL", ",", "0", ")", "assert", "arg_2", ">", "0", "arg_3", "=", "_no_zero_allocator", "(", "\"unsigned char[]\"", ",", "arg_2", ")", "_lib", ".", "SSL_get_Func", "(", "arg_0", ".", "_ssl", ",", "arg_3", ",", "arg_2", ")", "return", "_ffi", ".", "buffer", "(", "arg_3", ",", "arg_2", ")", "[", ":", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieve the random value used with the client hello message.\n\n        :return: A string representing the state\n        \"\"\"\n        arg_1 = _lib.SSL_get_session(arg_0._ssl)\n        if arg_1 == _ffi.NULL:\n            return None\n\n        arg_2 = _lib.SSL_get_Func(arg_0._ssl, _ffi.NULL, 0)\n        assert arg_2 > 0\n        arg_3 = _no_zero_allocator(\"unsigned char[]\", arg_2)\n        _lib.SSL_get_Func(arg_0._ssl, arg_3, arg_2)\n        return _ffi.buffer(arg_3, arg_2)[:]", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.client_random", "docstring": "Retrieve the random value used with the client hello message.\n\n        :return: A string representing the state", "docstring_tokens": ["Retrieve", "the", "random", "value", "used", "with", "the", "client", "hello", "message", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 256568}
{"url": "https://github.com/umich-brcf-bioinf/Jacquard/blob/83dd61dd2b5e4110468493beec7bc121e6cb3cd1/jacquard/variant_caller_transforms/variant_caller_factory.py#L25-L42", "sha": "83dd61dd2b5e4110468493beec7bc121e6cb3cd1", "docstring_summary": "Allows each caller to claim incoming files as they are recognized.", "language": "python", "parameters": "(self, unclaimed_file_readers)", "return_statement": "return unclaimed_file_readers, claimed_vcf_readers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "_callers", ":", "(", "arg_1", ",", "arg_4", ")", "=", "arg_3", ".", "Func", "(", "arg_1", ")", "arg_2", ".", "extend", "(", "arg_4", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Allows each caller to Func incoming files as they are recognized.\n\n        Args:\n            unFunced_file_readers: Usually, all files in the input dir.\n\n        Returns:\n            A tuple of unFunced file readers and Funced VcfReaders. The\n            presence of any unFunced file readers could indicate stray files\n            in the input dir.\n        \"\"\"\n        arg_2 = []\n        for arg_3 in arg_0._callers:\n            (arg_1,\n             arg_4) = arg_3.Func(arg_1)\n            arg_2.extend(arg_4)\n\n        return arg_1, arg_2", "path": "jacquard/variant_caller_transforms/variant_caller_factory.py", "identifier": "VariantCallerFactory.claim", "docstring": "Allows each caller to claim incoming files as they are recognized.\n\n        Args:\n            unclaimed_file_readers: Usually, all files in the input dir.\n\n        Returns:\n            A tuple of unclaimed file readers and claimed VcfReaders. The\n            presence of any unclaimed file readers could indicate stray files\n            in the input dir.", "docstring_tokens": ["Allows", "each", "caller", "to", "claim", "incoming", "files", "as", "they", "are", "recognized", "."], "nwo": "umich-brcf-bioinf/Jacquard", "score": 0.27831918678159157, "idx": 256569}
{"url": "https://github.com/MuhammedHasan/sklearn_utils/blob/337c3b7a27f4921d12da496f66a2b83ef582b413/sklearn_utils/utils/data_utils.py#L8-L20", "sha": "337c3b7a27f4921d12da496f66a2b83ef582b413", "docstring_summary": "Select items with label from dataset.", "language": "python", "parameters": "(X, y, ref_label, reverse=False)", "return_statement": "return list(zip(*filter(lambda t: (not reverse) == (t[1] == ref_label),\n                            zip(X, y))))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "check_reference_label", "(", "arg_1", ",", "arg_2", ")", "return", "list", "(", "zip", "(", "*", "filter", "(", "lambda", "t", ":", "(", "not", "arg_3", ")", "==", "(", "t", "[", "1", "]", "==", "arg_2", ")", ",", "zip", "(", "arg_0", ",", "arg_1", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    '''\n    Select items with label from dataset.\n\n    :param X: dataset\n    :param y: labels\n    :param ref_label: reference label\n    :param bool reverse: if false selects ref_labels else eliminates\n    '''\n    check_reference_label(arg_1, arg_2)\n\n    return list(zip(*filter(lambda t: (not arg_3) == (t[1] == arg_2),\n                            zip(arg_0, arg_1))))", "path": "sklearn_utils/utils/data_utils.py", "identifier": "filter_by_label", "docstring": "Select items with label from dataset.\n\n    :param X: dataset\n    :param y: labels\n    :param ref_label: reference label\n    :param bool reverse: if false selects ref_labels else eliminates", "docstring_tokens": ["Select", "items", "with", "label", "from", "dataset", "."], "nwo": "MuhammedHasan/sklearn_utils", "score": 0.23137166388621372, "idx": 256570}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/isolate.py#L70-L80", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Pop my mod stack and restore sys.modules to the state\n        it was in when mod stack was pushed.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_mod_stack", ".", "pop", "(", ")", "arg_2", "=", "[", "m", "for", "m", "in", "sys", ".", "modules", ".", "keys", "(", ")", "if", "m", "not", "in", "arg_1", "]", "if", "arg_2", ":", "log", ".", "debug", "(", "'removing sys modules entries: %s'", ",", "arg_2", ")", "for", "arg_3", "in", "arg_2", ":", "del", "sys", ".", "modules", "[", "arg_3", "]", "sys", ".", "modules", ".", "update", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Pop my mod stack and restore sys.modules to the state\n        it was in when mod stack was pushed.\n        \"\"\"\n        arg_1 = arg_0._mod_stack.pop()\n        arg_2 = [ m for m in sys.modules.keys() if m not in arg_1 ]\n        if arg_2:\n            log.debug('removing sys modules entries: %s', arg_2)\n            for arg_3 in arg_2:\n                del sys.modules[arg_3]\n        sys.modules.update(arg_1)", "path": "environment/lib/python2.7/site-packages/nose/plugins/isolate.py", "identifier": "IsolationPlugin.afterContext", "docstring": "Pop my mod stack and restore sys.modules to the state\n        it was in when mod stack was pushed.", "docstring_tokens": ["Pop", "my", "mod", "stack", "and", "restore", "sys", ".", "modules", "to", "the", "state", "it", "was", "in", "when", "mod", "stack", "was", "pushed", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256571}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L231-L244", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val is an instance of the given class.", "language": "python", "parameters": "(self, some_class)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "if", "not", "isinstance", "(", "arg_0", ".", "val", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_0", ".", "val", ",", "'__name__'", ")", ":", "arg_2", "=", "arg_0", ".", "val", ".", "__name__", "elif", "hasattr", "(", "arg_0", ".", "val", ",", "'__class__'", ")", ":", "arg_2", "=", "arg_0", ".", "val", ".", "__class__", ".", "__name__", "else", ":", "arg_2", "=", "'unknown'", "arg_0", ".", "_err", "(", "'Expected <%s:%s> to be instance of class <%s>, but was not.'", "%", "(", "arg_0", ".", "val", ",", "arg_2", ",", "arg_1", ".", "__name__", ")", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "'given arg must be a class'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Asserts that val is an instance of the given class.\"\"\"\n        try:\n            if not isinstance(arg_0.val, arg_1):\n                if hasattr(arg_0.val, '__name__'):\n                    arg_2 = arg_0.val.__name__\n                elif hasattr(arg_0.val, '__class__'):\n                    arg_2 = arg_0.val.__class__.__name__\n                else:\n                    arg_2 = 'unknown'\n                arg_0._err('Expected <%s:%s> to be instance of class <%s>, but was not.' % (arg_0.val, arg_2, arg_1.__name__))\n        except TypeError:\n            raise TypeError('given arg must be a class')\n        return arg_0", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.is_instance_of", "docstring": "Asserts that val is an instance of the given class.", "docstring_tokens": ["Asserts", "that", "val", "is", "an", "instance", "of", "the", "given", "class", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 256572}
{"url": "https://github.com/jterrace/pyssim/blob/ff9bd90c3eb7525013ad46babf66b7cc78391e89/ssim/ssimlib.py#L193-L246", "sha": "ff9bd90c3eb7525013ad46babf66b7cc78391e89", "docstring_summary": "Main function for pyssim.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "'\\n'", ".", "join", "(", "[", "'Compares an image with a list of images using the SSIM metric.'", ",", "'  Example:'", ",", "'    pyssim test-images/test1-1.png \"test-images/*\"'", "]", ")", "arg_1", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'pyssim'", ",", "formatter_class", "=", "argparse", ".", "RawTextHelpFormatter", ",", "arg_0", "=", "arg_0", ")", "arg_1", ".", "add_argument", "(", "'--cw'", ",", "help", "=", "'compute the complex wavelet SSIM'", ",", "action", "=", "'store_true'", ")", "arg_1", ".", "add_argument", "(", "'base_image'", ",", "metavar", "=", "'image1.png'", ",", "type", "=", "argparse", ".", "FileType", "(", "'r'", ")", ")", "arg_1", ".", "add_argument", "(", "'comparison_images'", ",", "metavar", "=", "'image path with* or image2.png'", ")", "arg_1", ".", "add_argument", "(", "'--width'", ",", "type", "=", "int", ",", "default", "=", "None", ",", "help", "=", "'scales the image before computing SSIM'", ")", "arg_1", ".", "add_argument", "(", "'--height'", ",", "type", "=", "int", ",", "default", "=", "None", ",", "help", "=", "'scales the image before computing SSIM'", ")", "arg_2", "=", "arg_1", ".", "parse_args", "(", ")", "if", "arg_2", ".", "width", "and", "arg_2", ".", "height", ":", "arg_3", "=", "(", "arg_2", ".", "width", ",", "arg_2", ".", "height", ")", "else", ":", "arg_3", "=", "None", "if", "not", "arg_2", ".", "cw", ":", "arg_4", "=", "1.5", "arg_5", "=", "11", "arg_6", "=", "get_gaussian_kernel", "(", "arg_5", ",", "arg_4", ")", "arg_7", "=", "glob", ".", "glob", "(", "arg_2", ".", "comparison_images", ")", "arg_8", "=", "len", "(", "arg_7", ")", "==", "1", "for", "arg_9", "in", "arg_7", ":", "if", "arg_2", ".", "cw", ":", "arg_10", "=", "SSIM", "(", "arg_2", ".", "base_image", ".", "name", ",", "arg_3", "=", "arg_3", ")", "arg_11", "=", "arg_10", ".", "cw_ssim_value", "(", "arg_9", ")", "else", ":", "arg_10", "=", "SSIM", "(", "arg_2", ".", "base_image", ".", "name", ",", "arg_6", ",", "arg_3", "=", "arg_3", ")", "arg_11", "=", "arg_10", ".", "ssim_value", "(", "arg_9", ")", "if", "arg_8", ":", "sys", ".", "stdout", ".", "write", "(", "'%.7g'", "%", "arg_11", ")", "else", ":", "sys", ".", "stdout", ".", "write", "(", "'%s - %s: %.7g'", "%", "(", "arg_2", ".", "base_image", ".", "name", ",", "arg_9", ",", "arg_11", ")", ")", "sys", ".", "stdout", ".", "write", "(", "'\\n'", ")"], "function": "def Func():\n    \"\"\"Main function for pyssim.\"\"\"\n\n    arg_0 = '\\n'.join([\n        'Compares an image with a list of images using the SSIM metric.',\n        '  Example:',\n        '    pyssim test-images/test1-1.png \"test-images/*\"'\n    ])\n\n    arg_1 = argparse.ArgumentParser(\n        prog='pyssim', formatter_class=argparse.RawTextHelpFormatter,\n        arg_0=arg_0)\n    arg_1.add_argument('--cw', help='compute the complex wavelet SSIM',\n                        action='store_true')\n    arg_1.add_argument(\n        'base_image', metavar='image1.png', type=argparse.FileType('r'))\n    arg_1.add_argument(\n        'comparison_images', metavar='image path with* or image2.png')\n    arg_1.add_argument('--width', type=int, default=None,\n                        help='scales the image before computing SSIM')\n    arg_1.add_argument('--height', type=int, default=None,\n                        help='scales the image before computing SSIM')\n\n    arg_2 = arg_1.parse_args()\n\n    if arg_2.width and arg_2.height:\n        arg_3 = (arg_2.width, arg_2.height)\n    else:\n        arg_3 = None\n\n    if not arg_2.cw:\n        arg_4 = 1.5\n        arg_5 = 11\n        arg_6 = get_gaussian_kernel(\n            arg_5, arg_4)\n\n    arg_7 = glob.glob(arg_2.comparison_images)\n    arg_8 = len(arg_7) == 1\n\n    for arg_9 in arg_7:\n\n        if arg_2.cw:\n            arg_10 = SSIM(arg_2.base_image.name, arg_3=arg_3)\n            arg_11 = arg_10.cw_ssim_value(arg_9)\n        else:\n            arg_10 = SSIM(arg_2.base_image.name, arg_6, arg_3=arg_3)\n            arg_11 = arg_10.ssim_value(arg_9)\n\n        if arg_8:\n            sys.stdout.write('%.7g' % arg_11)\n        else:\n            sys.stdout.write('%s - %s: %.7g' % (\n                arg_2.base_image.name, arg_9, arg_11))\n        sys.stdout.write('\\n')", "path": "ssim/ssimlib.py", "identifier": "main", "docstring": "Main function for pyssim.", "docstring_tokens": ["Main", "function", "for", "pyssim", "."], "nwo": "jterrace/pyssim", "score": 0.7481498878409439, "idx": 256573}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L529-L570", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "Run the specified script from the scripts section of the\n            module.json file in the directory of this module.", "language": "python", "parameters": "(self, scriptname, additional_environment=None)", "return_statement": "return errcode", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "import", "subprocess", "import", "shlex", "arg_3", "=", "arg_0", ".", "getScript", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "logger", ".", "debug", "(", "'%s has no script %s'", ",", "arg_0", ",", "arg_1", ")", "return", "0", "if", "not", "len", "(", "arg_3", ")", ":", "logger", ".", "error", "(", "\"script %s of %s is empty\"", ",", "arg_1", ",", "arg_0", ".", "getName", "(", ")", ")", "return", "1", "arg_4", "=", "os", ".", "environ", ".", "copy", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_4", ".", "update", "(", "arg_2", ")", "arg_5", "=", "0", "arg_6", "=", "None", "try", ":", "logger", ".", "debug", "(", "'running script: %s'", ",", "arg_3", ")", "arg_6", "=", "subprocess", ".", "Popen", "(", "arg_3", ",", "cwd", "=", "arg_0", ".", "path", ",", "arg_4", "=", "arg_4", ")", "arg_6", ".", "wait", "(", ")", "if", "arg_6", ".", "returncode", ":", "logger", ".", "error", "(", "\"script %s (from %s) exited with non-zero status %s\"", ",", "arg_1", ",", "arg_0", ".", "getName", "(", ")", ",", "arg_6", ".", "returncode", ")", "arg_5", "=", "arg_6", ".", "returncode", "arg_6", "=", "None", "finally", ":", "if", "arg_6", "is", "not", "None", ":", "tryTerminate", "(", "arg_6", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        ''' Run the specified script from the scripts section of the\n            module.json file in the directory of this module.\n        '''\n        import subprocess\n        import shlex\n\n        arg_3 = arg_0.getScript(arg_1)\n        if arg_3 is None:\n            logger.debug('%s has no script %s', arg_0, arg_1)\n            return 0\n\n        if not len(arg_3):\n            logger.error(\"script %s of %s is empty\", arg_1, arg_0.getName())\n            return 1\n\n        # define additional environment variables for scripts:\n        arg_4 = os.environ.copy()\n        if arg_2 is not None:\n            arg_4.update(arg_2)\n\n        arg_5 = 0\n        arg_6 = None\n        try:\n            logger.debug('running script: %s', arg_3)\n            arg_6 = subprocess.Popen(\n                arg_3, cwd = arg_0.path, arg_4 = arg_4\n            )\n            arg_6.wait()\n            if arg_6.returncode:\n                logger.error(\n                    \"script %s (from %s) exited with non-zero status %s\",\n                    arg_1,\n                    arg_0.getName(),\n                    arg_6.returncode\n                )\n                arg_5 = arg_6.returncode\n            arg_6 = None\n        finally:\n            if arg_6 is not None:\n                tryTerminate(arg_6)\n        return arg_5", "path": "yotta/lib/pack.py", "identifier": "Pack.runScript", "docstring": "Run the specified script from the scripts section of the\n            module.json file in the directory of this module.", "docstring_tokens": ["Run", "the", "specified", "script", "from", "the", "scripts", "section", "of", "the", "module", ".", "json", "file", "in", "the", "directory", "of", "this", "module", "."], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 256574}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/linesearch/hager_zhang.py#L332-L417", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Brackets the minimum and performs a line search.", "language": "python", "parameters": "(\n    value_and_gradients_function,\n    init_interval,\n    f_lim,\n    max_iterations,\n    shrinkage_param,\n    expansion_param,\n    sufficient_decrease_param,\n    curvature_param)", "return_statement": "return _line_search_after_bracketing(\n      value_and_gradients_function, line_search_args, init_interval.left,\n      f_lim, max_iterations, sufficient_decrease_param, curvature_param,\n      shrinkage_param)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_8", "=", "hzl", ".", "bracket", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_5", ")", "arg_9", "=", "arg_1", ".", "converged", "|", "_very_close", "(", "arg_8", ".", "left", ".", "x", ",", "arg_8", ".", "right", ".", "x", ")", "arg_10", "=", "~", "arg_9", "&", "tf", ".", "greater_equal", "(", "arg_8", ".", "iteration", ",", "arg_3", ")", "arg_11", "=", "HagerZhangLineSearchResult", "(", "arg_9", "=", "arg_9", ",", "failed", "=", "arg_8", ".", "failed", "|", "arg_10", ",", "iterations", "=", "arg_8", ".", "iteration", ",", "func_evals", "=", "arg_8", ".", "num_evals", ",", "left", "=", "arg_8", ".", "left", ",", "right", "=", "arg_8", ".", "right", ")", "return", "_line_search_after_bracketing", "(", "arg_0", ",", "arg_11", ",", "arg_1", ".", "left", ",", "arg_2", ",", "arg_3", ",", "arg_6", ",", "arg_7", ",", "arg_4", ")"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2,\n    arg_3,\n    arg_4,\n    arg_5,\n    arg_6,\n    arg_7):\n  \"\"\"Brackets the minimum and performs a line search.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a real scalar\n      tensor and returns a namedtuple with the fields 'x', 'f', and 'df' that\n      correspond to scalar tensors of real dtype containing the point at which\n      the function was evaluated, the value of the function, and its\n      derivative at that point. The other namedtuple fields, if present,\n      should be tensors or sequences (possibly nested) of tensors.\n      In usual optimization application, this function would be generated by\n      projecting the multivariate objective function along some specific\n      direction. The direction is determined by some other procedure but should\n      be a descent direction (i.e. the derivative of the projected univariate\n      function must be negative at 0.).\n      Alternatively, the function may represent the batching of `n` such line\n      functions (e.g. projecting a single multivariate objective function along\n      `n` distinct directions at once) accepting n points as input, i.e. a\n      tensor of shape [n], and the fields 'x', 'f' and 'df' in the returned\n      namedtuple should each be a tensor of shape [n], with the corresponding\n      input points, function values, and derivatives at those input points.\n    init_interval: Instance of `HagerZhangLineSearchResults` containing\n      the initial line search interval. The gradient of init_interval.left must\n      be negative (i.e. must be a descent direction), while init_interval.right\n      must be positive and finite.\n    f_lim: Scalar `Tensor` of float dtype.\n    max_iterations: Positive scalar `Tensor` of integral dtype. The maximum\n      number of iterations to perform in the line search. The number of\n      iterations used to bracket the minimum are also counted against this\n      parameter.\n    shrinkage_param: Scalar positive Tensor of real dtype. Must be less than\n      `1.`. Corresponds to the parameter `gamma` in [Hager and Zhang (2006)][2].\n    expansion_param: Scalar positive `Tensor` of real dtype. Must be greater\n      than `1.`. Used to expand the initial interval in case it does not bracket\n      a minimum. Corresponds to `rho` in [Hager and Zhang (2006)][2].\n    sufficient_decrease_param: Positive scalar `Tensor` of real dtype.\n      Bounded above by the curvature param. Corresponds to `delta` in the\n      terminology of [Hager and Zhang (2006)][2].\n    curvature_param: Positive scalar `Tensor` of real dtype. Bounded above\n      by `1.`. Corresponds to 'sigma' in the terminology of\n      [Hager and Zhang (2006)][2].\n\n  Returns:\n    A namedtuple containing the following fields.\n      converged: Boolean `Tensor` of shape [n]. Whether a point satisfying\n        Wolfe/Approx wolfe was found.\n      failed: Boolean `Tensor` of shape [n]. Whether line search failed e.g.\n        if either the objective function or the gradient are not finite at\n        an evaluation point.\n      iterations: Scalar int32 `Tensor`. Number of line search iterations made.\n      func_evals: Scalar int32 `Tensor`. Number of function evaluations made.\n      left: A namedtuple, as returned by value_and_gradients_function,\n        of the left end point of the updated bracketing interval.\n      right: A namedtuple, as returned by value_and_gradients_function,\n        of the right end point of the updated bracketing interval.\n  \"\"\"\n  arg_8 = hzl.bracket(arg_0, arg_1,\n                               arg_2, arg_3, arg_5)\n\n  arg_9 = arg_1.converged | _very_close(\n      arg_8.left.x, arg_8.right.x)\n\n  # We fail if we have not yet converged but already exhausted all iterations.\n  arg_10 = ~arg_9 & tf.greater_equal(\n      arg_8.iteration, arg_3)\n\n  arg_11 = HagerZhangLineSearchResult(\n      arg_9=arg_9,\n      failed=arg_8.failed | arg_10,\n      iterations=arg_8.iteration,\n      func_evals=arg_8.num_evals,\n      left=arg_8.left,\n      right=arg_8.right)\n\n  return _line_search_after_bracketing(\n      arg_0, arg_11, arg_1.left,\n      arg_2, arg_3, arg_6, arg_7,\n      arg_4)", "path": "tensorflow_probability/python/optimizer/linesearch/hager_zhang.py", "identifier": "_bracket_and_search", "docstring": "Brackets the minimum and performs a line search.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a real scalar\n      tensor and returns a namedtuple with the fields 'x', 'f', and 'df' that\n      correspond to scalar tensors of real dtype containing the point at which\n      the function was evaluated, the value of the function, and its\n      derivative at that point. The other namedtuple fields, if present,\n      should be tensors or sequences (possibly nested) of tensors.\n      In usual optimization application, this function would be generated by\n      projecting the multivariate objective function along some specific\n      direction. The direction is determined by some other procedure but should\n      be a descent direction (i.e. the derivative of the projected univariate\n      function must be negative at 0.).\n      Alternatively, the function may represent the batching of `n` such line\n      functions (e.g. projecting a single multivariate objective function along\n      `n` distinct directions at once) accepting n points as input, i.e. a\n      tensor of shape [n], and the fields 'x', 'f' and 'df' in the returned\n      namedtuple should each be a tensor of shape [n], with the corresponding\n      input points, function values, and derivatives at those input points.\n    init_interval: Instance of `HagerZhangLineSearchResults` containing\n      the initial line search interval. The gradient of init_interval.left must\n      be negative (i.e. must be a descent direction), while init_interval.right\n      must be positive and finite.\n    f_lim: Scalar `Tensor` of float dtype.\n    max_iterations: Positive scalar `Tensor` of integral dtype. The maximum\n      number of iterations to perform in the line search. The number of\n      iterations used to bracket the minimum are also counted against this\n      parameter.\n    shrinkage_param: Scalar positive Tensor of real dtype. Must be less than\n      `1.`. Corresponds to the parameter `gamma` in [Hager and Zhang (2006)][2].\n    expansion_param: Scalar positive `Tensor` of real dtype. Must be greater\n      than `1.`. Used to expand the initial interval in case it does not bracket\n      a minimum. Corresponds to `rho` in [Hager and Zhang (2006)][2].\n    sufficient_decrease_param: Positive scalar `Tensor` of real dtype.\n      Bounded above by the curvature param. Corresponds to `delta` in the\n      terminology of [Hager and Zhang (2006)][2].\n    curvature_param: Positive scalar `Tensor` of real dtype. Bounded above\n      by `1.`. Corresponds to 'sigma' in the terminology of\n      [Hager and Zhang (2006)][2].\n\n  Returns:\n    A namedtuple containing the following fields.\n      converged: Boolean `Tensor` of shape [n]. Whether a point satisfying\n        Wolfe/Approx wolfe was found.\n      failed: Boolean `Tensor` of shape [n]. Whether line search failed e.g.\n        if either the objective function or the gradient are not finite at\n        an evaluation point.\n      iterations: Scalar int32 `Tensor`. Number of line search iterations made.\n      func_evals: Scalar int32 `Tensor`. Number of function evaluations made.\n      left: A namedtuple, as returned by value_and_gradients_function,\n        of the left end point of the updated bracketing interval.\n      right: A namedtuple, as returned by value_and_gradients_function,\n        of the right end point of the updated bracketing interval.", "docstring_tokens": ["Brackets", "the", "minimum", "and", "performs", "a", "line", "search", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256575}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/assembler/ideogram/assembler.py#L29-L34", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Render the graph as JavaScript in a Jupyter Notebook.", "language": "python", "parameters": "(graph: BELGraph, chart: Optional[str] = None)", "return_statement": "return Javascript(js_template.render(**_get_context(graph, chart=chart)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "None", ")", "->", "Javascript", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "HERE", ",", "'render_with_javascript.js'", ")", ",", "'rt'", ")", "as", "f", ":", "arg_5", "=", "Template", "(", "f", ".", "read", "(", ")", ")", "return", "Javascript", "(", "arg_5", ".", "render", "(", "**", "_get_context", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4] = None) -> Javascript:\n    \"\"\"Render the graph as JavaScript in a Jupyter Notebook.\"\"\"\n    with open(os.path.join(HERE, 'render_with_javascript.js'), 'rt') as f:\n        arg_5 = Template(f.read())\n\n    return Javascript(arg_5.render(**_get_context(arg_0, arg_2=arg_2)))", "path": "src/pybel_tools/assembler/ideogram/assembler.py", "identifier": "to_jupyter", "docstring": "Render the graph as JavaScript in a Jupyter Notebook.", "docstring_tokens": ["Render", "the", "graph", "as", "JavaScript", "in", "a", "Jupyter", "Notebook", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256576}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/examples/check_version.py#L39-L42", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Send the initial presence after log-in.", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "request_software_version", "(", "arg_0", ".", "client", ",", "arg_0", ".", "target_jid", ",", "arg_0", ".", "success", ",", "arg_0", ".", "failure", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Send the initial presence after log-in.\"\"\"\n        request_software_version(arg_0.client, arg_0.target_jid,\n                                        arg_0.success, arg_0.failure)", "path": "examples/check_version.py", "identifier": "VersionChecker.handle_authorized", "docstring": "Send the initial presence after log-in.", "docstring_tokens": ["Send", "the", "initial", "presence", "after", "log", "-", "in", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256577}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/hooks.py#L64-L70", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Attempt to run a global hook by name with args", "language": "python", "parameters": "(hook_name, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "HookFinder", "(", "get_global_hook_path", "(", ")", ")", "arg_3", "=", "arg_2", "(", "arg_0", ")", "if", "arg_3", ":", "arg_3", ".", "run", "(", "*", "arg_1", ")"], "function": "def Func(arg_0, *arg_1):\n    '''Attempt to run a global hook by name with args'''\n\n    arg_2 = HookFinder(get_global_hook_path())\n    arg_3 = arg_2(arg_0)\n    if arg_3:\n        arg_3.run(*arg_1)", "path": "cpenv/hooks.py", "identifier": "run_global_hook", "docstring": "Attempt to run a global hook by name with args", "docstring_tokens": ["Attempt", "to", "run", "a", "global", "hook", "by", "name", "with", "args"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 256578}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L325-L366", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Create a training job", "language": "python", "parameters": "(self, config, wait_for_completion=True, print_log=True,\n                            check_interval=30, max_ingestion_time=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ",", "arg_4", "=", "30", ",", "arg_5", "=", "None", ")", ":", "arg_0", ".", "check_training_config", "(", "arg_1", ")", "arg_6", "=", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "**", "arg_1", ")", "if", "arg_3", ":", "arg_0", ".", "check_training_status_with_log", "(", "arg_1", "[", "'TrainingJobName'", "]", ",", "arg_0", ".", "non_terminal_states", ",", "arg_0", ".", "failed_states", ",", "arg_2", ",", "arg_4", ",", "arg_5", ")", "elif", "arg_2", ":", "arg_7", "=", "arg_0", ".", "check_status", "(", "arg_1", "[", "'TrainingJobName'", "]", ",", "'TrainingJobStatus'", ",", "arg_0", ".", "describe_training_job", ",", "arg_4", ",", "arg_5", ")", "arg_8", "=", "(", "arg_7", "[", "'TrainingEndTime'", "]", "-", "arg_7", "[", "'TrainingStartTime'", "]", ")", "*", "arg_7", "[", "'ResourceConfig'", "]", "[", "'InstanceCount'", "]", "arg_0", ".", "log", ".", "info", "(", "'Billable seconds:{}'", ".", "format", "(", "int", "(", "arg_8", ".", "total_seconds", "(", ")", ")", "+", "1", ")", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=True,\n                            arg_4=30, arg_5=None):\n        \"\"\"\n        Create a training job\n\n        :param config: the config for training\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to training job creation\n        \"\"\"\n\n        arg_0.check_training_config(arg_1)\n\n        arg_6 = arg_0.get_conn().Func(**arg_1)\n        if arg_3:\n            arg_0.check_training_status_with_log(arg_1['TrainingJobName'],\n                                                arg_0.non_terminal_states,\n                                                arg_0.failed_states,\n                                                arg_2,\n                                                arg_4, arg_5\n                                                )\n        elif arg_2:\n            arg_7 = arg_0.check_status(arg_1['TrainingJobName'],\n                                                  'TrainingJobStatus',\n                                                  arg_0.describe_training_job,\n                                                  arg_4, arg_5\n                                                  )\n\n            arg_8 = \\\n                (arg_7['TrainingEndTime'] - arg_7['TrainingStartTime']) * \\\n                arg_7['ResourceConfig']['InstanceCount']\n            arg_0.log.info('Billable seconds:{}'.format(int(arg_8.total_seconds()) + 1))\n\n        return arg_6", "path": "airflow/contrib/hooks/sagemaker_hook.py", "identifier": "SageMakerHook.create_training_job", "docstring": "Create a training job\n\n        :param config: the config for training\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to training job creation", "docstring_tokens": ["Create", "a", "training", "job"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256579}
{"url": "https://github.com/andreikop/python-ws-discovery/blob/a7b852cf43115c6f986e509b1870d6963e76687f/wsdiscovery/daemon.py#L126-L135", "sha": "a7b852cf43115c6f986e509b1870d6963e76687f", "docstring_summary": "None means 'system default", "language": "python", "parameters": "(self, addr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "_multiInSocket", ".", "setsockopt", "(", "socket", ".", "IPPROTO_IP", ",", "socket", ".", "IP_ADD_MEMBERSHIP", ",", "arg_0", ".", "_makeMreq", "(", "arg_1", ")", ")", "except", "socket", ".", "error", ":", "pass", "arg_2", "=", "arg_0", ".", "_createMulticastOutSocket", "(", "arg_1", ",", "arg_0", ".", "_observer", ".", "ttl", ")", "arg_0", ".", "_multiOutUniInSockets", "[", "arg_1", "]", "=", "arg_2", "arg_0", ".", "_poll", ".", "register", "(", "arg_2", ",", "select", ".", "POLLIN", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"None means 'system default'\"\"\"\n        try:\n            arg_0._multiInSocket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, arg_0._makeMreq(arg_1))\n        except socket.error:  # if 1 interface has more than 1 address, exception is raised for the second\n            pass\n\n        arg_2 = arg_0._createMulticastOutSocket(arg_1, arg_0._observer.ttl)\n        arg_0._multiOutUniInSockets[arg_1] = arg_2\n        arg_0._poll.register(arg_2, select.POLLIN)", "path": "wsdiscovery/daemon.py", "identifier": "NetworkingThread.addSourceAddr", "docstring": "None means 'system default", "docstring_tokens": ["None", "means", "system", "default"], "nwo": "andreikop/python-ws-discovery", "score": 0.7152725855878354, "idx": 256580}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1324-L1336", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Splits the file into the directory, basename, and extension.", "language": "python", "parameters": "(self)", "return_statement": "return (project,) + os.path.splitext(rest)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "RepositoryName", "(", ")", "arg_2", ",", "arg_3", "=", "os", ".", "path", ".", "split", "(", "arg_1", ")", "return", "(", "arg_2", ",", ")", "+", "os", ".", "path", ".", "splitext", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Funcs the file into the directory, basename, and extension.\n\n    For 'chrome/browser/browser.cc', Func() would\n    return ('chrome/browser', 'browser', '.cc')\n\n    Returns:\n      A tuple of (directory, basename, extension).\n    \"\"\"\n\n    arg_1 = arg_0.RepositoryName()\n    arg_2, arg_3 = os.path.split(arg_1)\n    return (arg_2,) + os.path.splitext(arg_3)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "FileInfo.Split", "docstring": "Splits the file into the directory, basename, and extension.\n\n    For 'chrome/browser/browser.cc', Split() would\n    return ('chrome/browser', 'browser', '.cc')\n\n    Returns:\n      A tuple of (directory, basename, extension).", "docstring_tokens": ["Splits", "the", "file", "into", "the", "directory", "basename", "and", "extension", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256581}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L540-L562", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Clears the global configuration.", "language": "python", "parameters": "(clear_constants=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ")", ":", "_set_config_is_locked", "(", "False", ")", "_CONFIG", ".", "clear", "(", ")", "_SINGLETONS", ".", "clear", "(", ")", "if", "arg_0", ":", "_CONSTANTS", ".", "clear", "(", ")", "else", ":", "arg_1", "=", "_CONSTANTS", ".", "copy", "(", ")", "_CONSTANTS", ".", "clear", "(", ")", "for", "arg_2", ",", "arg_3", "in", "six", ".", "iteritems", "(", "arg_1", ")", ":", "constant", "(", "arg_2", ",", "arg_3", ")", "_IMPORTED_MODULES", ".", "clear", "(", ")", "_OPERATIVE_CONFIG", ".", "clear", "(", ")"], "function": "def Func(arg_0=False):\n  \"\"\"Clears the global configuration.\n\n  This clears any parameter values set by `bind_parameter` or `parse_config`, as\n  well as the set of dynamically imported modules. It does not remove any\n  configurable functions or classes from the registry of configurables.\n\n  Args:\n    clear_constants: Whether to clear constants created by `constant`. Defaults\n      to False.\n  \"\"\"\n  _set_config_is_locked(False)\n  _CONFIG.clear()\n  _SINGLETONS.clear()\n  if arg_0:\n    _CONSTANTS.clear()\n  else:\n    arg_1 = _CONSTANTS.copy()\n    _CONSTANTS.clear()  # Clear then redefine constants (re-adding bindings).\n    for arg_2, arg_3 in six.iteritems(arg_1):\n      constant(arg_2, arg_3)\n  _IMPORTED_MODULES.clear()\n  _OPERATIVE_CONFIG.clear()", "path": "gin/config.py", "identifier": "clear_config", "docstring": "Clears the global configuration.\n\n  This clears any parameter values set by `bind_parameter` or `parse_config`, as\n  well as the set of dynamically imported modules. It does not remove any\n  configurable functions or classes from the registry of configurables.\n\n  Args:\n    clear_constants: Whether to clear constants created by `constant`. Defaults\n      to False.", "docstring_tokens": ["Clears", "the", "global", "configuration", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 256582}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/excel_utils.py#L113-L146", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return a pandas DataFrame with the concat'ed\n    content of the `sheetnames` from the Excel file in\n    `xl_path`.", "language": "python", "parameters": "(xl_path: str, sheetnames=None, add_tab_names=False)", "return_statement": "return pd.concat([sheets[tab] for tab in sheets])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_0", ",", "arg_4", "=", "_check_xl_path", "(", "arg_0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "get_sheet_list", "(", "arg_0", ")", "arg_5", "=", "pd", ".", "read_excel", "(", "arg_0", ",", "sheetname", "=", "arg_2", ")", "if", "arg_3", ":", "for", "arg_6", "in", "arg_5", ":", "arg_5", "[", "arg_6", "]", "[", "'Tab'", "]", "=", "[", "arg_6", "]", "*", "len", "(", "arg_5", "[", "arg_6", "]", ")", "return", "pd", ".", "concat", "(", "[", "arg_5", "[", "arg_6", "]", "for", "arg_6", "in", "arg_5", "]", ")"], "function": "def Func(arg_0: arg_1, arg_2=None, arg_3=False):\n    \"\"\" Return a pandas DataFrame with the concat'ed\n    content of the `sheetnames` from the Excel file in\n    `xl_path`.\n\n    Parameters\n    ----------\n    xl_path: str\n        Path to the Excel file\n\n    sheetnames: list of str\n        List of existing sheet names of `xl_path`.\n        If None, will use all sheets from `xl_path`.\n\n    add_tab_names: bool\n        If True will add a 'Tab' column which says from which\n        tab the row comes from.\n\n    Returns\n    -------\n    df: pandas.DataFrame\n    \"\"\"\n    arg_0, arg_4 = _check_xl_path(arg_0)\n\n    if arg_2 is None:\n        arg_2 = get_sheet_list(arg_0)\n\n    arg_5 = pd.read_excel(arg_0, sheetname=arg_2)\n\n    if arg_3:\n        for arg_6 in arg_5:\n            arg_5[arg_6]['Tab'] = [arg_6] * len(arg_5[arg_6])\n\n    return pd.concat([arg_5[arg_6] for arg_6 in arg_5])", "path": "boyle/excel_utils.py", "identifier": "concat_sheets", "docstring": "Return a pandas DataFrame with the concat'ed\n    content of the `sheetnames` from the Excel file in\n    `xl_path`.\n\n    Parameters\n    ----------\n    xl_path: str\n        Path to the Excel file\n\n    sheetnames: list of str\n        List of existing sheet names of `xl_path`.\n        If None, will use all sheets from `xl_path`.\n\n    add_tab_names: bool\n        If True will add a 'Tab' column which says from which\n        tab the row comes from.\n\n    Returns\n    -------\n    df: pandas.DataFrame", "docstring_tokens": ["Return", "a", "pandas", "DataFrame", "with", "the", "concat", "ed", "content", "of", "the", "sheetnames", "from", "the", "Excel", "file", "in", "xl_path", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 256583}
{"url": "https://github.com/vingd/encrypted-pickle-python/blob/7656233598e02e65971f69e11849a0f288b2b2a5/encryptedpickle/encryptedpickle.py#L568-L592", "sha": "7656233598e02e65971f69e11849a0f288b2b2a5", "docstring_summary": "Add header to data", "language": "python", "parameters": "(self, data, options)", "return_statement": "return header + data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get_version_info", "(", "arg_2", "[", "'version'", "]", ")", "arg_4", "=", "arg_2", "[", "'flags'", "]", "arg_5", "=", "dict", "(", "(", "i", ",", "str", "(", "int", "(", "j", ")", ")", ")", "for", "i", ",", "j", "in", "arg_2", "[", "'flags'", "]", ".", "iteritems", "(", ")", ")", "arg_5", "=", "''", ".", "join", "(", "arg_3", "[", "'flags'", "]", "(", "**", "arg_5", ")", ")", "arg_5", "=", "int", "(", "arg_5", ",", "2", ")", "arg_2", "[", "'flags'", "]", "=", "arg_5", "arg_6", "=", "arg_3", "[", "'header'", "]", "arg_6", "=", "arg_6", "(", "**", "arg_2", ")", "arg_6", "=", "pack", "(", "arg_3", "[", "'header_format'", "]", ",", "*", "arg_6", ")", "if", "'timestamp'", "in", "arg_4", "and", "arg_4", "[", "'timestamp'", "]", ":", "arg_7", "=", "long", "(", "time", "(", ")", ")", "arg_7", "=", "pack", "(", "arg_3", "[", "'timestamp_format'", "]", ",", "arg_7", ")", "arg_6", "=", "arg_6", "+", "arg_7", "return", "arg_6", "+", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Add header to data'''\n\n        # pylint: disable=W0142\n\n        arg_3 = arg_0._get_version_info(arg_2['version'])\n\n        arg_4 = arg_2['flags']\n\n        arg_5 = dict(\n            (i, str(int(j))) for i, j in arg_2['flags'].iteritems())\n        arg_5 = ''.join(arg_3['flags'](**arg_5))\n        arg_5 = int(arg_5, 2)\n        arg_2['flags'] = arg_5\n\n        arg_6 = arg_3['header']\n        arg_6 = arg_6(**arg_2)\n        arg_6 = pack(arg_3['header_format'], *arg_6)\n\n        if 'timestamp' in arg_4 and arg_4['timestamp']:\n            arg_7 = long(time())\n            arg_7 = pack(arg_3['timestamp_format'], arg_7)\n            arg_6 = arg_6 + arg_7\n\n        return arg_6 + arg_1", "path": "encryptedpickle/encryptedpickle.py", "identifier": "EncryptedPickle._add_header", "docstring": "Add header to data", "docstring_tokens": ["Add", "header", "to", "data"], "nwo": "vingd/encrypted-pickle-python", "score": 0.1861985637721619, "idx": 256584}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L168-L191", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Save a new notebook and return its notebook_id.", "language": "python", "parameters": "(self, data, name=None, format=u'json')", "return_statement": "return notebook_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "u'json'", ")", ":", "if", "arg_3", "not", "in", "arg_0", ".", "allowed_formats", ":", "raise", "web", ".", "HTTPError", "(", "415", ",", "u'Invalid notebook format: %s'", "%", "arg_3", ")", "try", ":", "arg_4", "=", "current", ".", "reads", "(", "arg_1", ".", "decode", "(", "'utf-8'", ")", ",", "arg_3", ")", "except", ":", "raise", "web", ".", "HTTPError", "(", "400", ",", "u'Invalid JSON data'", ")", "if", "arg_2", "is", "None", ":", "try", ":", "arg_2", "=", "arg_4", ".", "metadata", ".", "name", "except", "AttributeError", ":", "raise", "web", ".", "HTTPError", "(", "400", ",", "u'Missing notebook name'", ")", "arg_4", ".", "metadata", ".", "name", "=", "arg_2", "arg_6", "=", "arg_0", ".", "new_notebook_id", "(", "arg_2", ")", "arg_0", ".", "save_notebook_object", "(", "arg_6", ",", "arg_4", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=u'json'):\n        \"\"\"Save a new notebook and return its notebook_id.\n\n        If a name is passed in, it overrides any values in the notebook data\n        and the value in the data is updated to use that value.\n        \"\"\"\n        if arg_3 not in arg_0.allowed_formats:\n            raise web.HTTPError(415, u'Invalid notebook format: %s' % arg_3)\n\n        try:\n            arg_4 = current.reads(arg_1.decode('utf-8'), arg_3)\n        except:\n            raise web.HTTPError(400, u'Invalid JSON data')\n\n        if arg_2 is None:\n            try:\n                arg_2 = arg_4.metadata.name\n            except AttributeError:\n                raise web.HTTPError(400, u'Missing notebook name')\n        arg_4.metadata.name = arg_2\n\n        arg_6 = arg_0.new_notebook_id(arg_2)\n        arg_0.save_notebook_object(arg_6, arg_4)\n        return arg_6", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py", "identifier": "NotebookManager.save_new_notebook", "docstring": "Save a new notebook and return its notebook_id.\n\n        If a name is passed in, it overrides any values in the notebook data\n        and the value in the data is updated to use that value.", "docstring_tokens": ["Save", "a", "new", "notebook", "and", "return", "its", "notebook_id", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256585}
{"url": "https://github.com/jazzband/django-discover-jenkins/blob/c0c859dfdd571de6e8f63865dfc8ebac6bab1d07/discover_jenkins/runner.py#L13-L32", "sha": "c0c859dfdd571de6e8f63865dfc8ebac6bab1d07", "docstring_summary": "Get the imported task classes for each task that will be run", "language": "python", "parameters": "()", "return_statement": "return task_classes", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "]", "for", "arg_1", "in", "TASKS", ":", "try", ":", "arg_2", ",", "arg_3", "=", "arg_1", ".", "rsplit", "(", "'.'", ",", "1", ")", "except", "ValueError", ":", "raise", "ImproperlyConfigured", "(", "'%s isn\\'t a task module'", "%", "arg_1", ")", "try", ":", "arg_4", "=", "import_module", "(", "arg_2", ")", "except", "ImportError", "as", "e", ":", "raise", "ImproperlyConfigured", "(", "'Error importing task %s: \"%s\"'", "%", "(", "arg_2", ",", "e", ")", ")", "try", ":", "arg_5", "=", "getattr", "(", "arg_4", ",", "arg_3", ")", "except", "AttributeError", ":", "raise", "ImproperlyConfigured", "(", "'Task module \"%s\" does not define a '", "'\"%s\" class'", "%", "(", "arg_2", ",", "arg_3", ")", ")", "arg_0", ".", "append", "(", "arg_5", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Get the imported task classes for each task that will be run\"\"\"\n    arg_0 = []\n    for arg_1 in TASKS:\n        try:\n            arg_2, arg_3 = arg_1.rsplit('.', 1)\n        except ValueError:\n            raise ImproperlyConfigured('%s isn\\'t a task module' % arg_1)\n        try:\n            arg_4 = import_module(arg_2)\n        except ImportError as e:\n            raise ImproperlyConfigured('Error importing task %s: \"%s\"'\n                                       % (arg_2, e))\n        try:\n            arg_5 = getattr(arg_4, arg_3)\n        except AttributeError:\n            raise ImproperlyConfigured('Task module \"%s\" does not define a '\n                                       '\"%s\" class' % (arg_2, arg_3))\n        arg_0.append(arg_5)\n    return arg_0", "path": "discover_jenkins/runner.py", "identifier": "get_tasks", "docstring": "Get the imported task classes for each task that will be run", "docstring_tokens": ["Get", "the", "imported", "task", "classes", "for", "each", "task", "that", "will", "be", "run"], "nwo": "jazzband/django-discover-jenkins", "score": 0.18261785916548806, "idx": 256586}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L1648-L1684", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Serial Call to set meter password.  USE WITH CAUTION.", "language": "python", "parameters": "(self, new_pwd, pwd=\"00000000\")", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"00000000\"", ")", ":", "arg_3", "=", "False", "arg_0", ".", "setContext", "(", "\"Func\"", ")", "try", ":", "if", "len", "(", "arg_1", ")", "!=", "8", "or", "len", "(", "arg_2", ")", "!=", "8", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Passwords must be exactly eight characters.\"", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "arg_3", "if", "not", "arg_0", ".", "request", "(", "False", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Pre command read failed: check serial line.\"", ")", "else", ":", "if", "not", "arg_0", ".", "serialCmdPwdAuth", "(", "arg_2", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Password failure\"", ")", "else", ":", "arg_4", "=", "binascii", ".", "hexlify", "(", "arg_1", ".", "zfill", "(", "8", ")", ")", "arg_5", "=", "\"015731023030323028\"", "+", "arg_4", "+", "\"2903\"", "arg_5", "+=", "arg_0", ".", "calc_crc16", "(", "arg_5", "[", "2", ":", "]", ".", "decode", "(", "\"hex\"", ")", ")", "arg_0", ".", "m_serial_port", ".", "write", "(", "arg_5", ".", "decode", "(", "\"hex\"", ")", ")", "if", "arg_0", ".", "m_serial_port", ".", "getResponse", "(", "arg_0", ".", "getContext", "(", ")", ")", ".", "encode", "(", "\"hex\"", ")", "==", "\"06\"", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Success(Func): 06 returned.\"", ")", "arg_3", "=", "True", "arg_0", ".", "serialPostEnd", "(", ")", "except", ":", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ".", "exc_info", "(", ")", ")", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=\"00000000\"):\n        \"\"\" Serial Call to set meter password.  USE WITH CAUTION.\n\n        Args:\n            new_pwd (str): 8 digit numeric password to set\n            pwd (str): Old 8 digit numeric password.\n\n        Returns:\n            bool: True on completion with ACK.\n        \"\"\"\n        arg_3 = False\n        arg_0.setContext(\"Func\")\n        try:\n            if len(arg_1) != 8 or len(arg_2) != 8:\n                arg_0.writeCmdMsg(\"Passwords must be exactly eight characters.\")\n                arg_0.setContext(\"\")\n                return arg_3\n\n            if not arg_0.request(False):\n                arg_0.writeCmdMsg(\"Pre command read failed: check serial line.\")\n            else:\n                if not arg_0.serialCmdPwdAuth(arg_2):\n                    arg_0.writeCmdMsg(\"Password failure\")\n                else:\n                    arg_4 = binascii.hexlify(arg_1.zfill(8))\n                    arg_5 = \"015731023030323028\" + arg_4 + \"2903\"\n                    arg_5 += arg_0.calc_crc16(arg_5[2:].decode(\"hex\"))\n                    arg_0.m_serial_port.write(arg_5.decode(\"hex\"))\n                    if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode(\"hex\") == \"06\":\n                        arg_0.writeCmdMsg(\"Success(Func): 06 returned.\")\n                        arg_3 = True\n            arg_0.serialPostEnd()\n        except:\n            ekm_log(traceback.format_exc(sys.exc_info()))\n\n        arg_0.setContext(\"\")\n        return arg_3", "path": "ekmmeters.py", "identifier": "Meter.setMeterPassword", "docstring": "Serial Call to set meter password.  USE WITH CAUTION.\n\n        Args:\n            new_pwd (str): 8 digit numeric password to set\n            pwd (str): Old 8 digit numeric password.\n\n        Returns:\n            bool: True on completion with ACK.", "docstring_tokens": ["Serial", "Call", "to", "set", "meter", "password", ".", "USE", "WITH", "CAUTION", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 256587}
{"url": "https://github.com/andreikop/python-ws-discovery/blob/a7b852cf43115c6f986e509b1870d6963e76687f/wsdiscovery/daemon.py#L555-L565", "sha": "a7b852cf43115c6f986e509b1870d6963e76687f", "docstring_summary": "search for services given the TYPES and SCOPES in a given TIMEOUT", "language": "python", "parameters": "(self, types=None, scopes=None, timeout=3)", "return_statement": "return self._filterServices(list(self._remoteServices.values()), types, scopes)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "3", ")", ":", "if", "not", "arg_0", ".", "_serverStarted", ":", "raise", "Exception", "(", "\"Server not started\"", ")", "arg_0", ".", "_sendProbe", "(", "arg_1", ",", "arg_2", ")", "time", ".", "sleep", "(", "arg_3", ")", "return", "arg_0", ".", "_filterServices", "(", "list", "(", "arg_0", ".", "_remoteServices", ".", "values", "(", ")", ")", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=3):\n        'search for services given the TYPES and SCOPES in a given TIMEOUT'\n\n        if not arg_0._serverStarted:\n            raise Exception(\"Server not started\")\n\n        arg_0._sendProbe(arg_1, arg_2)\n\n        time.sleep(arg_3)\n\n        return arg_0._filterServices(list(arg_0._remoteServices.values()), arg_1, arg_2)", "path": "wsdiscovery/daemon.py", "identifier": "WSDiscovery.searchServices", "docstring": "search for services given the TYPES and SCOPES in a given TIMEOUT", "docstring_tokens": ["search", "for", "services", "given", "the", "TYPES", "and", "SCOPES", "in", "a", "given", "TIMEOUT"], "nwo": "andreikop/python-ws-discovery", "score": 0.7152725855878354, "idx": 256588}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/utils.py#L26-L32", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "use an endpoint specific payload and client secret to generate\n    a signature for the request", "language": "python", "parameters": "(payload, secret)", "return_statement": "return hmac.new(secret, digestmod=hashlib.sha256,\n                    msg=payload).hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "_encode", "(", "arg_0", ")", "arg_1", "=", "_encode", "(", "arg_1", ")", "return", "hmac", ".", "new", "(", "arg_1", ",", "digestmod", "=", "hashlib", ".", "sha256", ",", "msg", "=", "arg_0", ")", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0, arg_1):\n    '''use an endpoint specific payload and client secret to generate\n    a signature for the request'''\n    arg_0 = _encode(arg_0)\n    arg_1 = _encode(arg_1)\n    return hmac.new(arg_1, digestmod=hashlib.sha256,\n                    msg=arg_0).hexdigest()", "path": "sregistry/main/registry/utils.py", "identifier": "generate_signature", "docstring": "use an endpoint specific payload and client secret to generate\n    a signature for the request", "docstring_tokens": ["use", "an", "endpoint", "specific", "payload", "and", "client", "secret", "to", "generate", "a", "signature", "for", "the", "request"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 256589}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/_metadata.py#L37-L71", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Fetch a resource from the metadata server.", "language": "python", "parameters": "(http, path, root=METADATA_ROOT, recursive=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "urlparse", ".", "urljoin", "(", "arg_2", ",", "arg_1", ")", "arg_5", "=", "_helpers", ".", "_add_query_parameter", "(", "arg_5", ",", "'recursive'", ",", "arg_4", ")", "arg_6", ",", "arg_7", "=", "transport", ".", "request", "(", "arg_0", ",", "arg_5", ",", "headers", "=", "METADATA_HEADERS", ")", "if", "arg_6", ".", "status", "==", "http_client", ".", "OK", ":", "arg_8", "=", "_helpers", ".", "_from_bytes", "(", "arg_7", ")", "if", "arg_6", "[", "'content-type'", "]", "==", "'application/json'", ":", "return", "json", ".", "loads", "(", "arg_8", ")", "else", ":", "return", "arg_8", "else", ":", "raise", "http_client", ".", "HTTPException", "(", "'Failed to retrieve {0} from the Google Compute Engine'", "'metadata service. Response:\\n{1}'", ".", "format", "(", "arg_5", ",", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3, arg_4=None):\n    \"\"\"Fetch a resource from the metadata server.\n\n    Args:\n        http: an object to be used to make HTTP requests.\n        path: A string indicating the resource to retrieve. For example,\n            'instance/service-accounts/default'\n        root: A string indicating the full path to the metadata server root.\n        recursive: A boolean indicating whether to do a recursive query of\n            metadata. See\n            https://cloud.google.com/compute/docs/metadata#aggcontents\n\n    Returns:\n        A dictionary if the metadata server returns JSON, otherwise a string.\n\n    Raises:\n        http_client.HTTPException if an error corrured while\n        retrieving metadata.\n    \"\"\"\n    arg_5 = urlparse.urljoin(arg_2, arg_1)\n    arg_5 = _helpers._add_query_parameter(arg_5, 'recursive', arg_4)\n\n    arg_6, arg_7 = transport.request(\n        arg_0, arg_5, headers=METADATA_HEADERS)\n\n    if arg_6.status == http_client.OK:\n        arg_8 = _helpers._from_bytes(arg_7)\n        if arg_6['content-type'] == 'application/json':\n            return json.loads(arg_8)\n        else:\n            return arg_8\n    else:\n        raise http_client.HTTPException(\n            'Failed to retrieve {0} from the Google Compute Engine'\n            'metadata service. Response:\\n{1}'.format(arg_5, arg_6))", "path": "oauth2client/contrib/_metadata.py", "identifier": "get", "docstring": "Fetch a resource from the metadata server.\n\n    Args:\n        http: an object to be used to make HTTP requests.\n        path: A string indicating the resource to retrieve. For example,\n            'instance/service-accounts/default'\n        root: A string indicating the full path to the metadata server root.\n        recursive: A boolean indicating whether to do a recursive query of\n            metadata. See\n            https://cloud.google.com/compute/docs/metadata#aggcontents\n\n    Returns:\n        A dictionary if the metadata server returns JSON, otherwise a string.\n\n    Raises:\n        http_client.HTTPException if an error corrured while\n        retrieving metadata.", "docstring_tokens": ["Fetch", "a", "resource", "from", "the", "metadata", "server", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 256590}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/treemix.py#L188-L194", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "returns a subsample of unlinked snp sites", "language": "python", "parameters": "(self)", "return_statement": "return samp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "maparr", "arg_2", "=", "np", ".", "zeros", "(", "arg_1", ".", "shape", "[", "0", "]", ",", "dtype", "=", "np", ".", "uint64", ")", "for", "arg_3", "in", "xrange", "(", "arg_1", ".", "shape", "[", "0", "]", ")", ":", "arg_2", "[", "arg_3", "]", "=", "np", ".", "random", ".", "randint", "(", "arg_1", "[", "arg_3", ",", "0", "]", ",", "arg_1", "[", "arg_3", ",", "1", "]", ",", "1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" returns a subsample of unlinked snp sites \"\"\"\n        arg_1 = arg_0.maparr\n        arg_2 = np.zeros(arg_1.shape[0], dtype=np.uint64)\n        for arg_3 in xrange(arg_1.shape[0]):\n            arg_2[arg_3] = np.random.randint(arg_1[arg_3, 0], arg_1[arg_3, 1], 1)\n        return arg_2", "path": "ipyrad/analysis/treemix.py", "identifier": "Treemix._subsample", "docstring": "returns a subsample of unlinked snp sites", "docstring_tokens": ["returns", "a", "subsample", "of", "unlinked", "snp", "sites"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 256591}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/control/editor.py#L32-L41", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Receives a message, and either sets it immediately, or puts it on the\n        edit queue if there is one.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "edit_queue", ":", "arg_0", ".", "edit_queue", ".", "put_edit", "(", "arg_0", ".", "_set", ",", "arg_1", ")", "else", ":", "arg_0", ".", "_set", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Receives a message, and either sets it immediately, or puts it on the\n        edit queue if there is one.\n\n        \"\"\"\n        if arg_0.edit_queue:\n            arg_0.edit_queue.put_edit(arg_0._set, arg_1)\n        else:\n            arg_0._set(arg_1)", "path": "bibliopixel/control/editor.py", "identifier": "Editor.receive", "docstring": "Receives a message, and either sets it immediately, or puts it on the\n        edit queue if there is one.", "docstring_tokens": ["Receives", "a", "message", "and", "either", "sets", "it", "immediately", "or", "puts", "it", "on", "the", "edit", "queue", "if", "there", "is", "one", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 256592}
{"url": "https://github.com/arve0/microscopestitching/blob/381a78a1d1dca711e1732193e09d6ff7dce23baa/microscopestitching/stitching.py#L40-L84", "sha": "381a78a1d1dca711e1732193e09d6ff7dce23baa", "docstring_summary": "Stitch regular spaced images.", "language": "python", "parameters": "(images)", "return_statement": "return merged[..., 0].astype(np.uint8), (yoffset, xoffset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "type", "(", "arg_0", ")", "!=", "ImageCollection", ":", "arg_0", "=", "ImageCollection", "(", "arg_0", ")", "calc_translations_parallel", "(", "arg_0", ")", "_translation_warn", "(", "arg_0", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "median_translation", "(", ")", "if", "arg_2", "!=", "arg_1", ":", "warn", "(", "'yoffset != xoffset: %s != %s'", "%", "(", "arg_1", ",", "arg_2", ")", ")", "arg_3", ",", "arg_4", "=", "imread", "(", "arg_0", "[", "0", "]", ".", "path", ")", ".", "shape", "arg_5", "=", "arg_3", "*", "len", "(", "arg_0", ".", "rows", ")", "+", "arg_1", "*", "(", "len", "(", "arg_0", ".", "rows", ")", "-", "1", ")", "arg_6", "=", "arg_4", "*", "len", "(", "arg_0", ".", "cols", ")", "+", "arg_2", "*", "(", "len", "(", "arg_0", ".", "cols", ")", "-", "1", ")", "arg_7", "=", "np", ".", "zeros", "(", "(", "arg_5", ",", "arg_6", ",", "2", ")", ",", "dtype", "=", "np", ".", "int", ")", "for", "arg_8", "in", "arg_0", ":", "arg_9", ",", "arg_10", "=", "arg_8", ".", "row", ",", "arg_8", ".", "col", "arg_11", "=", "_merge_slice", "(", "arg_9", ",", "arg_10", ",", "arg_3", ",", "arg_4", ",", "arg_1", ",", "arg_2", ")", "arg_12", "=", "_add_ones_dim", "(", "imread", "(", "arg_8", ".", "path", ")", ")", "arg_7", "[", "arg_11", "]", "+=", "arg_12", "arg_7", "[", "...", ",", "0", "]", "/=", "arg_7", "[", "...", ",", "1", "]", "return", "arg_7", "[", "...", ",", "0", "]", ".", "astype", "(", "np", ".", "uint8", ")", ",", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"Stitch regular spaced images.\n\n    Parameters\n    ----------\n    images : ImageCollection or list of tuple(path, row, column)\n        Each image-tuple should contain path, row and column. Row 0,\n        column 0 is top left image.\n\n        Example:\n        >>> images = [('1.png', 0, 0), ('2.png', 0, 1)]\n\n    Returns\n    -------\n    tuple (Funced, offset)\n        Stitched image and registered offset (y, x).\n    \"\"\"\n    if type(arg_0) != ImageCollection:\n        arg_0 = ImageCollection(arg_0)\n    calc_translations_parallel(arg_0)\n    _translation_warn(arg_0)\n\n    arg_1, arg_2 = arg_0.median_translation()\n\n    if arg_2 != arg_1:\n        warn('yoffset != xoffset: %s != %s' % (arg_1, arg_2))\n\n    # assume all images have the same shape\n    arg_3, arg_4 = imread(arg_0[0].path).shape\n    arg_5 = arg_3*len(arg_0.rows) + arg_1*(len(arg_0.rows)-1)\n    arg_6 = arg_4*len(arg_0.cols) + arg_2*(len(arg_0.cols)-1)\n\n    # last dimension is number of images on top of each other\n    arg_7 = np.zeros((arg_5, arg_6, 2), dtype=np.int)\n    for arg_8 in arg_0:\n        arg_9, arg_10 = arg_8.row, arg_8.col\n        arg_11 = _merge_slice(arg_9, arg_10, arg_3, arg_4, arg_1, arg_2)\n        # last dim is used for averaging the seam\n        arg_12 = _add_ones_dim(imread(arg_8.path))\n        arg_7[arg_11] += arg_12\n\n    # average seam, possible improvement: use gradient\n    arg_7[..., 0] /= arg_7[..., 1]\n\n    return arg_7[..., 0].astype(np.uint8), (arg_1, arg_2)", "path": "microscopestitching/stitching.py", "identifier": "stitch", "docstring": "Stitch regular spaced images.\n\n    Parameters\n    ----------\n    images : ImageCollection or list of tuple(path, row, column)\n        Each image-tuple should contain path, row and column. Row 0,\n        column 0 is top left image.\n\n        Example:\n        >>> images = [('1.png', 0, 0), ('2.png', 0, 1)]\n\n    Returns\n    -------\n    tuple (stitched, offset)\n        Stitched image and registered offset (y, x).", "docstring_tokens": ["Stitch", "regular", "spaced", "images", "."], "nwo": "arve0/microscopestitching", "score": 0.17553651708052445, "idx": 256593}
{"url": "https://github.com/edx/web-fragments/blob/42d760d700d70465e4e573b7b41442d8802ccd3c/web_fragments/views.py#L32-L40", "sha": "42d760d700d70465e4e573b7b41442d8802ccd3c", "docstring_summary": "Renders a standalone page as a response for the specified fragment.", "language": "python", "parameters": "(self, request, fragment, **kwargs)", "return_statement": "return HttpResponse(html)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "return", "HttpResponse", "(", "status", "=", "204", ")", "arg_4", "=", "arg_0", ".", "render_to_standalone_html", "(", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "return", "HttpResponse", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):  # pylint: disable=unused-argument\n        \"\"\"\n        Renders a standalone page as a response for the specified fragment.\n        \"\"\"\n        if arg_2 is None:\n            return HttpResponse(status=204)\n\n        arg_4 = arg_0.render_to_standalone_html(arg_1, arg_2, **arg_3)\n        return HttpResponse(arg_4)", "path": "web_fragments/views.py", "identifier": "FragmentView.render_standalone_response", "docstring": "Renders a standalone page as a response for the specified fragment.", "docstring_tokens": ["Renders", "a", "standalone", "page", "as", "a", "response", "for", "the", "specified", "fragment", "."], "nwo": "edx/web-fragments", "score": 0.3871570893833313, "idx": 256594}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/eval.py#L300-L400", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Main process to evaluate algorithms' results.", "language": "python", "parameters": "(in_path, boundaries_id=msaf.config.default_bound_id,\n            labels_id=msaf.config.default_label_id, annot_beats=False,\n            framesync=False, feature=\"pcp\", hier=False, save=False,\n            out_file=None, n_jobs=4, annotator_id=0, config=None)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "config", ".", "default_bound_id", ",", "arg_5", "=", "arg_2", ".", "config", ".", "default_label_id", ",", "arg_7", "=", "False", ",", "arg_8", "=", "False", ",", "arg_9", "=", "\"pcp\"", ",", "arg_10", "=", "False", ",", "arg_11", "=", "False", ",", "arg_12", "=", "None", ",", "arg_13", "=", "4", ",", "arg_14", "=", "0", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "io", ".", "get_configuration", "(", "arg_9", ",", "arg_7", ",", "arg_8", ",", "arg_1", ",", "arg_5", ")", "arg_3", "[", "\"hier\"", "]", "=", "arg_10", "arg_3", ".", "pop", "(", "\"features\"", ",", "None", ")", "if", "arg_12", "is", "None", ":", "arg_12", "=", "get_results_file_name", "(", "arg_1", ",", "arg_5", ",", "arg_3", ",", "arg_14", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_12", ")", ":", "logging", ".", "warning", "(", "\"Results already exists, reading from file %s\"", "%", "arg_12", ")", "arg_15", "=", "pd", ".", "read_csv", "(", "arg_12", ")", "print_results", "(", "arg_15", ")", "return", "arg_15", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "arg_16", "=", "[", "Func_track", "(", "arg_0", ",", "arg_1", ",", "arg_5", ",", "arg_3", ",", "arg_14", "=", "arg_14", ")", "]", "else", ":", "arg_17", "=", "io", ".", "get_dataset_files", "(", "arg_0", ")", "logging", ".", "info", "(", "\"Evaluating %d tracks...\"", "%", "len", "(", "arg_17", ")", ")", "arg_16", "=", "Parallel", "(", "arg_13", "=", "arg_13", ")", "(", "delayed", "(", "Func_track", ")", "(", "file_struct", ",", "arg_1", ",", "arg_5", ",", "arg_3", ",", "arg_14", "=", "arg_14", ")", "for", "file_struct", "in", "arg_17", "[", ":", "]", ")", "arg_15", "=", "pd", ".", "DataFrame", "(", ")", "for", "arg_18", "in", "arg_16", ":", "if", "arg_18", "!=", "[", "]", ":", "arg_15", "=", "arg_15", ".", "append", "(", "arg_18", ",", "ignore_index", "=", "True", ")", "logging", ".", "info", "(", "\"%d tracks analyzed\"", "%", "len", "(", "arg_15", ")", ")", "print_results", "(", "arg_15", ")", "if", "arg_11", ":", "logging", ".", "info", "(", "\"Writing results in %s\"", "%", "arg_12", ")", "arg_15", ".", "to_csv", "(", "arg_12", ")", "return", "arg_15"], "function": "def Func(arg_0, arg_1=arg_2.config.default_bound_id,\n            arg_5=arg_2.config.default_label_id, arg_7=False,\n            arg_8=False, arg_9=\"pcp\", arg_10=False, arg_11=False,\n            arg_12=None, arg_13=4, arg_14=0, arg_3=None):\n    \"\"\"Main Func to evaluate algorithms' results.\n\n    Parameters\n    ----------\n    in_path : str\n        Path to the dataset root folder.\n    boundaries_id : str\n        Boundaries algorithm identifier (e.g. siplca, cnmf)\n    labels_id : str\n        Labels algorithm identifier (e.g. siplca, cnmf)\n    ds_name : str\n        Name of the dataset to be evaluated (e.g. SALAMI). * stands for all.\n    annot_beats : boolean\n        Whether to use the annotated beats or not.\n    framesync: str\n        Whether to use framesync features or not (default: False -> beatsync)\n    feature: str\n        String representing the feature to be used (e.g. pcp, mfcc, tonnetz)\n    hier : bool\n        Whether to compute a hierarchical or flat segmentation.\n    save: boolean\n        Whether to save the results into the `out_file` csv file.\n    out_file: str\n        Path to the csv file to save the results (if `None` and `save = True`\n        it will save the results in the default file name obtained by\n        calling `get_results_file_name`).\n    n_jobs: int\n        Number of Funces to run in parallel. Only available in collection\n        mode.\n    annotator_id : int\n        Number identifiying the annotator.\n    config: dict\n        Dictionary containing custom configuration parameters for the\n        algorithms.  If None, the default parameters are used.\n\n    Return\n    ------\n    results : pd.DataFrame\n        DataFrame containing the evaluations for each file.\n    \"\"\"\n\n    # Set up configuration based on algorithms parameters\n    if arg_3 is None:\n        arg_3 = io.get_configuration(arg_9, arg_7, arg_8,\n                                      arg_1, arg_5)\n\n    # Hierarchical segmentation\n    arg_3[\"hier\"] = arg_10\n\n    # Remove actual features\n    arg_3.pop(\"features\", None)\n\n    # Get out file in case we want to save results\n    if arg_12 is None:\n        arg_12 = get_results_file_name(arg_1, arg_5, arg_3,\n                                         arg_14)\n\n    # If out_file already exists, read and return them\n    if os.path.exists(arg_12):\n        logging.warning(\"Results already exists, reading from file %s\" %\n                        arg_12)\n        arg_15 = pd.read_csv(arg_12)\n        print_results(arg_15)\n        return arg_15\n\n    # Perform actual evaluations\n    if os.path.isfile(arg_0):\n        # Single File mode\n        arg_16 = [Func_track(arg_0, arg_1, arg_5, arg_3,\n                               arg_14=arg_14)]\n    else:\n        # Collection mode\n        # Get files\n        arg_17 = io.get_dataset_files(arg_0)\n\n        # Evaluate in parallel\n        logging.info(\"Evaluating %d tracks...\" % len(arg_17))\n        arg_16 = Parallel(arg_13=arg_13)(delayed(Func_track)(\n            file_struct, arg_1, arg_5, arg_3,\n            arg_14=arg_14) for file_struct in arg_17[:])\n\n    # Aggregate evaluations in pandas format\n    arg_15 = pd.DataFrame()\n    for arg_18 in arg_16:\n        if arg_18 != []:\n            arg_15 = arg_15.append(arg_18, ignore_index=True)\n    logging.info(\"%d tracks analyzed\" % len(arg_15))\n\n    # Print results\n    print_results(arg_15)\n\n    # Save all results\n    if arg_11:\n        logging.info(\"Writing results in %s\" % arg_12)\n        arg_15.to_csv(arg_12)\n\n    return arg_15", "path": "msaf/eval.py", "identifier": "process", "docstring": "Main process to evaluate algorithms' results.\n\n    Parameters\n    ----------\n    in_path : str\n        Path to the dataset root folder.\n    boundaries_id : str\n        Boundaries algorithm identifier (e.g. siplca, cnmf)\n    labels_id : str\n        Labels algorithm identifier (e.g. siplca, cnmf)\n    ds_name : str\n        Name of the dataset to be evaluated (e.g. SALAMI). * stands for all.\n    annot_beats : boolean\n        Whether to use the annotated beats or not.\n    framesync: str\n        Whether to use framesync features or not (default: False -> beatsync)\n    feature: str\n        String representing the feature to be used (e.g. pcp, mfcc, tonnetz)\n    hier : bool\n        Whether to compute a hierarchical or flat segmentation.\n    save: boolean\n        Whether to save the results into the `out_file` csv file.\n    out_file: str\n        Path to the csv file to save the results (if `None` and `save = True`\n        it will save the results in the default file name obtained by\n        calling `get_results_file_name`).\n    n_jobs: int\n        Number of processes to run in parallel. Only available in collection\n        mode.\n    annotator_id : int\n        Number identifiying the annotator.\n    config: dict\n        Dictionary containing custom configuration parameters for the\n        algorithms.  If None, the default parameters are used.\n\n    Return\n    ------\n    results : pd.DataFrame\n        DataFrame containing the evaluations for each file.", "docstring_tokens": ["Main", "process", "to", "evaluate", "algorithms", "results", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 256595}
{"url": "https://github.com/soerenwolfers/swutil/blob/2d598f2deac8b7e20df95dbc68017e5ab5d6180c/swutil/config.py#L52-L61", "sha": "2d598f2deac8b7e20df95dbc68017e5ab5d6180c", "docstring_summary": "Converts string values to booleans when appropriate", "language": "python", "parameters": "(option,value)", "return_statement": "return (option,value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "type", "(", "arg_1", ")", "is", "str", ":", "if", "arg_1", ".", "lower", "(", ")", "==", "'true'", ":", "arg_1", "=", "True", "elif", "arg_1", ".", "lower", "(", ")", "==", "'false'", ":", "arg_1", "=", "False", "return", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0,arg_1):\n    '''\n    Converts string values to booleans when appropriate\n    '''\n    if type(arg_1) is str:\n        if arg_1.lower() == 'true':\n            arg_1=True\n        elif arg_1.lower() == 'false':\n            arg_1=False\n    return (arg_0,arg_1)", "path": "swutil/config.py", "identifier": "to_bool", "docstring": "Converts string values to booleans when appropriate", "docstring_tokens": ["Converts", "string", "values", "to", "booleans", "when", "appropriate"], "nwo": "soerenwolfers/swutil", "score": 0.2747185692836802, "idx": 256596}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L2449-L2458", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "For each string compute its Shannon entropy, if the string is empty the entropy is 0.", "language": "python", "parameters": "(self)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ")", ")", "arg_1", ".", "_ex", ".", "_cache", ".", "nrows", "=", "arg_0", ".", "nrow", "arg_1", ".", "_ex", ".", "_cache", ".", "ncol", "=", "arg_0", ".", "ncol", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        For each string compute its Shannon Func, if the string is empty the Func is 0.\n\n        :returns: an H2OFrame of Shannon entropies.\n        \"\"\"\n        arg_1 = H2OFrame._expr(expr=ExprNode(\"Func\", arg_0))\n        arg_1._ex._cache.nrows = arg_0.nrow\n        arg_1._ex._cache.ncol = arg_0.ncol\n        return arg_1", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.entropy", "docstring": "For each string compute its Shannon entropy, if the string is empty the entropy is 0.\n\n        :returns: an H2OFrame of Shannon entropies.", "docstring_tokens": ["For", "each", "string", "compute", "its", "Shannon", "entropy", "if", "the", "string", "is", "empty", "the", "entropy", "is", "0", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 256597}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/base64.py#L318-L324", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Encode a string into multiple lines of base-64 data.", "language": "python", "parameters": "(s)", "return_statement": "return \"\".join(pieces)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "range", "(", "0", ",", "len", "(", "arg_0", ")", ",", "MAXBINSIZE", ")", ":", "arg_3", "=", "arg_0", "[", "arg_2", ":", "arg_2", "+", "MAXBINSIZE", "]", "arg_1", ".", "append", "(", "binascii", ".", "b2a_base64", "(", "arg_3", ")", ")", "return", "\"\"", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Encode a string into multiple lines of base-64 data.\"\"\"\n    arg_1 = []\n    for arg_2 in range(0, len(arg_0), MAXBINSIZE):\n        arg_3 = arg_0[arg_2 : arg_2 + MAXBINSIZE]\n        arg_1.append(binascii.b2a_base64(arg_3))\n    return \"\".join(arg_1)", "path": "third_party/stdlib/base64.py", "identifier": "encodestring", "docstring": "Encode a string into multiple lines of base-64 data.", "docstring_tokens": ["Encode", "a", "string", "into", "multiple", "lines", "of", "base", "-", "64", "data", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 256598}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/files.py#L163-L173", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Does `fpath` indicate a file in one of our trees?", "language": "python", "parameters": "(self, fpath)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "dirs", ":", "if", "arg_1", ".", "startswith", "(", "arg_2", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "True", "if", "arg_1", "[", "len", "(", "arg_2", ")", "]", "==", "os", ".", "sep", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Does `fpath` indicate a file in one of our trees?\"\"\"\n        for arg_2 in arg_0.dirs:\n            if arg_1.startswith(arg_2):\n                if arg_1 == arg_2:\n                    # This is the same file!\n                    return True\n                if arg_1[len(arg_2)] == os.sep:\n                    # This is a file in the directory\n                    return True\n        return False", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/files.py", "identifier": "TreeMatcher.match", "docstring": "Does `fpath` indicate a file in one of our trees?", "docstring_tokens": ["Does", "fpath", "indicate", "a", "file", "in", "one", "of", "our", "trees?"], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256599}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/helpers.py#L121-L128", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Yield successive chunks of a given size from a list of items", "language": "python", "parameters": "(items, chunk_size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "<=", "0", ":", "raise", "ValueError", "(", "'Chunk size must be a positive integer'", ")", "for", "arg_2", "in", "range", "(", "0", ",", "len", "(", "arg_0", ")", ",", "arg_1", ")", ":", "yield", "arg_0", "[", "arg_2", ":", "arg_2", "+", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Yield successive Func of a given size from a list of items\n    \"\"\"\n    if arg_1 <= 0:\n        raise ValueError('Chunk size must be a positive integer')\n    for arg_2 in range(0, len(arg_0), arg_1):\n        yield arg_0[arg_2:arg_2 + arg_1]", "path": "airflow/utils/helpers.py", "identifier": "chunks", "docstring": "Yield successive chunks of a given size from a list of items", "docstring_tokens": ["Yield", "successive", "chunks", "of", "a", "given", "size", "from", "a", "list", "of", "items"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256600}
{"url": "https://github.com/UDST/pandana/blob/961a7ef8d3b0144b190cb60bbd61845fca6fb314/pandana/loaders/osm.py#L61-L96", "sha": "961a7ef8d3b0144b190cb60bbd61845fca6fb314", "docstring_summary": "Process a node element entry into a dict suitable for going into\n    a Pandas DataFrame.", "language": "python", "parameters": "(e)", "return_statement": "return node", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'source'", ",", "'source_ref'", ",", "'source:ref'", ",", "'history'", ",", "'attribution'", ",", "'created_by'", ",", "'tiger:tlid'", ",", "'tiger:upload_uuid'", ",", "}", "arg_2", "=", "{", "'id'", ":", "arg_0", "[", "'id'", "]", ",", "'lat'", ":", "arg_0", "[", "'lat'", "]", ",", "'lon'", ":", "arg_0", "[", "'lon'", "]", "}", "if", "'tags'", "in", "arg_0", ":", "for", "arg_3", ",", "arg_4", "in", "list", "(", "arg_0", "[", "'tags'", "]", ".", "items", "(", ")", ")", ":", "if", "arg_3", "not", "in", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Process a node element entry into a dict suitable for going into\n    a Pandas DataFrame.\n\n    Parameters\n    ----------\n    e : dict\n    Returns\n    -------\n    node : dict\n    \"\"\"\n\n    arg_1 = {\n        'source',\n        'source_ref',\n        'source:ref',\n        'history',\n        'attribution',\n        'created_by',\n        'tiger:tlid',\n        'tiger:upload_uuid',\n    }\n\n    arg_2 = {\n        'id': arg_0['id'],\n        'lat': arg_0['lat'],\n        'lon': arg_0['lon']\n    }\n\n    if 'tags' in arg_0:\n        for arg_3, arg_4 in list(arg_0['tags'].items()):\n            if arg_3 not in arg_1:\n                arg_2[arg_3] = arg_4\n\n    return arg_2", "path": "pandana/loaders/osm.py", "identifier": "process_node", "docstring": "Process a node element entry into a dict suitable for going into\n    a Pandas DataFrame.\n\n    Parameters\n    ----------\n    e : dict\n    Returns\n    -------\n    node : dict", "docstring_tokens": ["Process", "a", "node", "element", "entry", "into", "a", "dict", "suitable", "for", "going", "into", "a", "Pandas", "DataFrame", "."], "nwo": "UDST/pandana", "score": 0.47050699646286387, "idx": 256601}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L427-L471", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the numerical derivative of a waveform's dependent variable vector.", "language": "python", "parameters": "(wave, indep_min=None, indep_max=None)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "copy", ".", "copy", "(", "arg_0", ")", "_bound_waveform", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "arg_4", "=", "np", ".", "diff", "(", "arg_3", ".", "_indep_vector", ")", "arg_5", "=", "np", ".", "diff", "(", "arg_3", ".", "_dep_vector", ")", "arg_4", "=", "np", ".", "concatenate", "(", "(", "np", ".", "array", "(", "[", "arg_4", "[", "0", "]", "]", ")", ",", "arg_4", ")", ")", "arg_5", "=", "np", ".", "concatenate", "(", "(", "np", ".", "array", "(", "[", "arg_5", "[", "0", "]", "]", ")", ",", "arg_5", ")", ")", "arg_3", ".", "_dep_vector", "=", "np", ".", "divide", "(", "arg_5", ",", "arg_4", ")", "arg_3", ".", "dep_name", "=", "\"Func({0})\"", ".", "format", "(", "arg_3", ".", "_dep_name", ")", "arg_3", ".", "dep_units", "=", "_build_units", "(", "arg_3", ".", "indep_units", ",", "arg_3", ".", "dep_units", ",", "\"/\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    r\"\"\"\n    Return the numerical Func of a waveform's dependent variable vector.\n\n    The method used is the `backwards differences\n    <https://en.wikipedia.org/wiki/\n    Finite_difference#Forward.2C_backward.2C_and_central_differences>`_ method\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: float\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]\n    \"\"\"\n    arg_3 = copy.copy(arg_0)\n    _bound_waveform(arg_3, arg_1, arg_2)\n    arg_4 = np.diff(arg_3._indep_vector)\n    arg_5 = np.diff(arg_3._dep_vector)\n    arg_4 = np.concatenate((np.array([arg_4[0]]), arg_4))\n    arg_5 = np.concatenate((np.array([arg_5[0]]), arg_5))\n    arg_3._dep_vector = np.divide(arg_5, arg_4)\n    arg_3.dep_name = \"Func({0})\".format(arg_3._dep_name)\n    arg_3.dep_units = _build_units(arg_3.indep_units, arg_3.dep_units, \"/\")\n    return arg_3", "path": "peng/wave_functions.py", "identifier": "derivative", "docstring": "r\"\"\"\n    Return the numerical derivative of a waveform's dependent variable vector.\n\n    The method used is the `backwards differences\n    <https://en.wikipedia.org/wiki/\n    Finite_difference#Forward.2C_backward.2C_and_central_differences>`_ method\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: float\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.derivative\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "numerical", "derivative", "of", "a", "waveform", "s", "dependent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 256602}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/joint_distribution_sequential.py#L409-L449", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates `dist_fn_wrapped` which calls `dist_fn` with all prev nodes.", "language": "python", "parameters": "(i, dist_fn)", "return_statement": "return dist_fn_wrapped, args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "distribution_util", ".", "is_distribution_instance", "(", "arg_1", ")", ":", "return", "(", "lambda", "*", "_", ":", "arg_1", ")", ",", "None", "if", "not", "callable", "(", "arg_1", ")", ":", "raise", "TypeError", "(", "'{} must be either `tfd.Distribution`-like or '", "'`callable`.'", ".", "format", "(", "arg_1", ")", ")", "arg_2", "=", "_get_required_args", "(", "arg_1", ")", "if", "not", "arg_2", ":", "return", "(", "lambda", "*", "_", ":", "arg_1", "(", ")", ")", ",", "(", ")", "@", "functools", ".", "wraps", "(", "arg_1", ")", "def", "dist_fn_wrapped", "(", "*", "arg_3", ")", ":", "if", "arg_0", "!=", "len", "(", "arg_3", ")", ":", "raise", "ValueError", "(", "'Internal Error: Unexpected number of inputs provided to {}-th '", "'distribution maker (dist_fn: {}, expected: {}, saw: {}).'", ".", "format", "(", "arg_0", ",", "arg_1", ",", "arg_0", ",", "len", "(", "arg_3", ")", ")", ")", "if", "len", "(", "arg_3", ")", "<", "len", "(", "arg_2", ")", ":", "raise", "ValueError", "(", "'Internal Error: Too few inputs provided to {}-th distribution maker '", "'(dist_fn: {}, expected: {}, saw: {}).'", ".", "format", "(", "arg_0", ",", "arg_1", ",", "len", "(", "arg_2", ")", ",", "len", "(", "arg_3", ")", ")", ")", "return", "arg_1", "(", "*", "reversed", "(", "arg_3", "[", "-", "len", "(", "arg_2", ")", ":", "]", ")", ")", "return", "dist_fn_wrapped", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Creates `dist_fn_wrapped` which calls `dist_fn` with all prev nodes.\n\n  Args:\n    i: Python `int` corresponding to position in topologically sorted DAG.\n    dist_fn: Python `callable` which takes a subset of previously constructed\n      distributions (in reverse order) and produces a new distribution instance.\n\n  Returns:\n    dist_fn_wrapped: Python `callable` which takes all previous distributions\n      (in non reverse order) and produces a  new distribution instance.\n    args: `tuple` of `str` representing the arg names of `dist_fn` (and in non\n      wrapped, \"natural\" order). `None` is returned only if the input is not a\n      `callable`.\n  \"\"\"\n  if distribution_util.is_distribution_instance(arg_1):\n    return (lambda *_: arg_1), None\n\n  if not callable(arg_1):\n    raise TypeError('{} must be either `tfd.Distribution`-like or '\n                    '`callable`.'.format(arg_1))\n\n  arg_2 = _get_required_args(arg_1)\n  if not arg_2:\n    return (lambda *_: arg_1()), ()\n\n  @functools.wraps(arg_1)\n  def dist_fn_wrapped(*arg_3):\n    \"\"\"Calls `dist_fn` with reversed and truncated args.\"\"\"\n    if arg_0 != len(arg_3):\n      raise ValueError(\n          'Internal Error: Unexpected number of inputs provided to {}-th '\n          'distribution maker (dist_fn: {}, expected: {}, saw: {}).'.format(\n              arg_0, arg_1, arg_0, len(arg_3)))\n    if len(arg_3) < len(arg_2):\n      raise ValueError(\n          'Internal Error: Too few inputs provided to {}-th distribution maker '\n          '(dist_fn: {}, expected: {}, saw: {}).'.format(\n              arg_0, arg_1, len(arg_2), len(arg_3)))\n    return arg_1(*reversed(arg_3[-len(arg_2):]))\n  return dist_fn_wrapped, arg_2", "path": "tensorflow_probability/python/distributions/joint_distribution_sequential.py", "identifier": "_unify_call_signature", "docstring": "Creates `dist_fn_wrapped` which calls `dist_fn` with all prev nodes.\n\n  Args:\n    i: Python `int` corresponding to position in topologically sorted DAG.\n    dist_fn: Python `callable` which takes a subset of previously constructed\n      distributions (in reverse order) and produces a new distribution instance.\n\n  Returns:\n    dist_fn_wrapped: Python `callable` which takes all previous distributions\n      (in non reverse order) and produces a  new distribution instance.\n    args: `tuple` of `str` representing the arg names of `dist_fn` (and in non\n      wrapped, \"natural\" order). `None` is returned only if the input is not a\n      `callable`.", "docstring_tokens": ["Creates", "dist_fn_wrapped", "which", "calls", "dist_fn", "with", "all", "prev", "nodes", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256603}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L117-L142", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return a License from a `lics` license resource.", "language": "python", "parameters": "(self, lics)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "arg_1", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", "[", "'ExtractedLicensingInfo'", "]", ")", "in", "arg_0", ".", "graph", ":", "return", "arg_0", ".", "parse_only_extr_license", "(", "arg_1", ")", "arg_2", "=", "arg_1", ".", "rfind", "(", "'/'", ")", "+", "1", "if", "arg_2", "==", "0", ":", "arg_3", "=", "arg_0", ".", "to_special_value", "(", "arg_1", ")", "if", "arg_3", "==", "arg_1", ":", "if", "arg_0", ".", "LICS_REF_REGEX", ".", "match", "(", "arg_1", ")", ":", "return", "document", ".", "License", ".", "from_identifier", "(", "arg_1", ")", "else", ":", "raise", "SPDXValueError", "(", "'License'", ")", "else", ":", "return", "arg_3", "else", ":", "return", "document", ".", "License", ".", "from_identifier", "(", "arg_1", "[", "arg_2", ":", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a License from a `lics` license resource.\n        \"\"\"\n        # Handle extracted licensing info type.\n        if (arg_1, RDF.type, arg_0.spdx_namespace['ExtractedLicensingInfo']) in arg_0.graph:\n            return arg_0.parse_only_extr_license(arg_1)\n\n        # Assume resource, hence the path separator\n        arg_2 = arg_1.rfind('/') + 1\n        if arg_2 == 0:\n            # special values such as spdx:noassertion\n            arg_3 = arg_0.to_special_value(arg_1)\n            if arg_3 == arg_1:\n                if arg_0.LICS_REF_REGEX.match(arg_1):\n                    # Is a license ref i.e LicenseRef-1\n                    return document.License.from_identifier(arg_1)\n                else:\n                    # Not a known license form\n                    raise SPDXValueError('License')\n            else:\n                # is a special value\n                return arg_3\n        else:\n            # license url\n            return document.License.from_identifier(arg_1[arg_2:])", "path": "spdx/parsers/rdf.py", "identifier": "LicenseParser.handle_lics", "docstring": "Return a License from a `lics` license resource.", "docstring_tokens": ["Return", "a", "License", "from", "a", "lics", "license", "resource", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 256604}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L943-L1050", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Slice the annotation and return as a new `Annotation` object.", "language": "python", "parameters": "(self, start_time, end_time, strict=False)", "return_statement": "return sliced_ann", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_0", ".", "trim", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_5", "=", "arg_4", ".", "pop_data", "(", ")", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "max", "(", "0", ",", "arg_6", ".", "time", "-", "arg_1", ")", "arg_4", ".", "append", "(", "arg_11", "=", "arg_7", ",", "duration", "=", "arg_6", ".", "duration", ",", "value", "=", "arg_6", ".", "value", ",", "confidence", "=", "arg_6", ".", "confidence", ")", "arg_8", "=", "arg_4", ".", "time", "arg_9", "=", "arg_8", "arg_10", "=", "arg_8", "+", "arg_4", ".", "duration", "if", "'Func'", "not", "in", "arg_4", ".", "sandbox", ".", "keys", "(", ")", ":", "arg_4", ".", "sandbox", ".", "update", "(", "Func", "=", "[", "{", "'start_time'", ":", "arg_1", ",", "'end_time'", ":", "arg_2", ",", "'Func_start'", ":", "arg_9", ",", "'Func_end'", ":", "arg_10", "}", "]", ")", "else", ":", "arg_4", ".", "sandbox", ".", "Func", ".", "append", "(", "{", "'start_time'", ":", "arg_1", ",", "'end_time'", ":", "arg_2", ",", "'Func_start'", ":", "arg_9", ",", "'Func_end'", ":", "arg_10", "}", ")", "arg_4", ".", "time", "=", "max", "(", "0", ",", "arg_8", "-", "arg_1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        '''\n        Slice the annotation and return as a new `Annotation` object.\n\n        Slicing has the same effect as trimming (see `Annotation.trim`) except\n        that while trimming does not modify the start time of the annotation or\n        the observations it contains, slicing will set the new annotation's\n        start time to ``max(0, trimmed_annotation.time - start_time)`` and the\n        start time of its observations will be set with respect to this new\n        reference start time.\n\n        This function documents the Func operation by adding a list of tuples\n        to the annotation's sandbox keyed by ``Annotation.sandbox.Func`` which\n        documents each Func operation with a tuple\n        ``(start_time, end_time, Func_start, Func_end)``, where\n        ``Func_start`` and ``Func_end`` are given by ``trim_start`` and\n        ``trim_end`` (see `Annotation.trim`).\n\n        Since slicing is implemented  using trimming, the trimming operation\n        will also be documented in ``Annotation.sandbox.trim`` as described in\n        `Annotation.trim`.\n\n        This function is useful for example when trimming an audio file,\n        allowing the user to trim the annotation while ensuring all time\n        information matches the new trimmed audio file.\n\n        Parameters\n        ----------\n        start_time : float\n            The desired start time for slicing in seconds.\n        end_time\n            The desired end time for slicing in seconds. Must be greater than\n            ``start_time``.\n        strict : bool\n            When ``False`` (default) observations that lie at the boundaries of\n            the Func (see `Annotation.trim` for details) will have their time\n            and/or duration adjusted such that only the part of the observation\n            that lies within the Func range is kept. When ``True`` such\n            observations are discarded and not included in the Funcd\n            annotation.\n\n        Returns\n        -------\n        Funcd_ann : Annotation\n            The Funcd annotation.\n\n        See Also\n        --------\n        Annotation.trim\n\n        Examples\n        --------\n        >>> ann = jams.Annotation(namespace='tag_open', time=2, duration=8)\n        >>> ann.append(time=2, duration=2, value='one')\n        >>> ann.append(time=4, duration=2, value='two')\n        >>> ann.append(time=6, duration=2, value='three')\n        >>> ann.append(time=7, duration=2, value='four')\n        >>> ann.append(time=8, duration=2, value='five')\n        >>> ann_Func = ann.Func(5, 8, strict=False)\n        >>> print(ann_Func.time, ann_Func.duration)\n        (0, 3)\n        >>> ann_Func.to_dataframe()\n           time  duration  value confidence\n        0   0.0       1.0    two       None\n        1   1.0       2.0  three       None\n        2   2.0       1.0   four       None\n        >>> ann_Func_strict = ann.Func(5, 8, strict=True)\n        >>> print(ann_Func_strict.time, ann_Func_strict.duration)\n        (0, 3)\n        >>> ann_Func_strict.to_dataframe()\n           time  duration  value confidence\n        0   1.0       2.0  three       None\n        '''\n        # start by trimming the annotation\n        arg_4 = arg_0.trim(arg_1, arg_2, arg_3=arg_3)\n        arg_5 = arg_4.pop_data()\n\n        # now adjust the start time of the annotation and the observations it\n        # contains.\n\n        for arg_6 in arg_5:\n            arg_7 = max(0, arg_6.time - arg_1)\n            # if obs.time > start_time,\n            #   duration doesn't change\n            # if obs.time < start_time,\n            #   duration shrinks by start_time - obs.time\n            arg_4.append(arg_11=arg_7,\n                              duration=arg_6.duration,\n                              value=arg_6.value,\n                              confidence=arg_6.confidence)\n\n        arg_8 = arg_4.time\n        arg_9 = arg_8\n        arg_10 = arg_8 + arg_4.duration\n\n        if 'Func' not in arg_4.sandbox.keys():\n            arg_4.sandbox.update(\n                Func=[{'start_time': arg_1, 'end_time': arg_2,\n                        'Func_start': arg_9, 'Func_end': arg_10}])\n        else:\n            arg_4.sandbox.Func.append(\n                {'start_time': arg_1, 'end_time': arg_2,\n                 'Func_start': arg_9, 'Func_end': arg_10})\n\n        # Update the timing for the Funcd annotation\n        arg_4.time = max(0, arg_8 - arg_1)\n\n        return arg_4", "path": "jams/core.py", "identifier": "Annotation.slice", "docstring": "Slice the annotation and return as a new `Annotation` object.\n\n        Slicing has the same effect as trimming (see `Annotation.trim`) except\n        that while trimming does not modify the start time of the annotation or\n        the observations it contains, slicing will set the new annotation's\n        start time to ``max(0, trimmed_annotation.time - start_time)`` and the\n        start time of its observations will be set with respect to this new\n        reference start time.\n\n        This function documents the slice operation by adding a list of tuples\n        to the annotation's sandbox keyed by ``Annotation.sandbox.slice`` which\n        documents each slice operation with a tuple\n        ``(start_time, end_time, slice_start, slice_end)``, where\n        ``slice_start`` and ``slice_end`` are given by ``trim_start`` and\n        ``trim_end`` (see `Annotation.trim`).\n\n        Since slicing is implemented  using trimming, the trimming operation\n        will also be documented in ``Annotation.sandbox.trim`` as described in\n        `Annotation.trim`.\n\n        This function is useful for example when trimming an audio file,\n        allowing the user to trim the annotation while ensuring all time\n        information matches the new trimmed audio file.\n\n        Parameters\n        ----------\n        start_time : float\n            The desired start time for slicing in seconds.\n        end_time\n            The desired end time for slicing in seconds. Must be greater than\n            ``start_time``.\n        strict : bool\n            When ``False`` (default) observations that lie at the boundaries of\n            the slice (see `Annotation.trim` for details) will have their time\n            and/or duration adjusted such that only the part of the observation\n            that lies within the slice range is kept. When ``True`` such\n            observations are discarded and not included in the sliced\n            annotation.\n\n        Returns\n        -------\n        sliced_ann : Annotation\n            The sliced annotation.\n\n        See Also\n        --------\n        Annotation.trim\n\n        Examples\n        --------\n        >>> ann = jams.Annotation(namespace='tag_open', time=2, duration=8)\n        >>> ann.append(time=2, duration=2, value='one')\n        >>> ann.append(time=4, duration=2, value='two')\n        >>> ann.append(time=6, duration=2, value='three')\n        >>> ann.append(time=7, duration=2, value='four')\n        >>> ann.append(time=8, duration=2, value='five')\n        >>> ann_slice = ann.slice(5, 8, strict=False)\n        >>> print(ann_slice.time, ann_slice.duration)\n        (0, 3)\n        >>> ann_slice.to_dataframe()\n           time  duration  value confidence\n        0   0.0       1.0    two       None\n        1   1.0       2.0  three       None\n        2   2.0       1.0   four       None\n        >>> ann_slice_strict = ann.slice(5, 8, strict=True)\n        >>> print(ann_slice_strict.time, ann_slice_strict.duration)\n        (0, 3)\n        >>> ann_slice_strict.to_dataframe()\n           time  duration  value confidence\n        0   1.0       2.0  three       None", "docstring_tokens": ["Slice", "the", "annotation", "and", "return", "as", "a", "new", "Annotation", "object", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 256605}
{"url": "https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/config.py#L234-L265", "sha": "3ebd891ac0c02bad061182dbcb54a47fb21980ae", "docstring_summary": "r\"\"\"Returns a list of system-wide config folders for the application.", "language": "python", "parameters": "(app_name, app_author, force_xdg=True)", "return_statement": "return [os.path.join(d, _pathify(app_name)) for d in paths]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "WIN", ":", "arg_3", "=", "os", ".", "environ", ".", "get", "(", "'PROGRAMDATA'", ")", "return", "[", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_1", ",", "arg_0", ")", "]", "if", "MAC", "and", "not", "arg_2", ":", "return", "[", "os", ".", "path", ".", "join", "(", "'/Library/Application Support'", ",", "arg_0", ")", "]", "arg_4", "=", "os", ".", "environ", ".", "get", "(", "'XDG_CONFIG_DIRS'", ",", "'/etc/xdg'", ")", "arg_5", "=", "[", "os", ".", "path", ".", "expanduser", "(", "x", ")", "for", "x", "in", "arg_4", ".", "split", "(", "os", ".", "pathsep", ")", "]", "return", "[", "os", ".", "path", ".", "join", "(", "arg_6", ",", "_pathify", "(", "arg_0", ")", ")", "for", "arg_6", "in", "arg_5", "]"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    r\"\"\"Returns a list of system-wide config folders for the application.\n\n    For an example application called ``\"My App\"`` by ``\"Acme\"``,\n    something like the following folders could be returned:\n\n    macOS (non-XDG):\n      ``['/Library/Application Support/My App']``\n    Mac OS X (XDG):\n      ``['/etc/xdg/my-app']``\n    Unix:\n      ``['/etc/xdg/my-app']``\n    Windows 7:\n      ``['C:\\ProgramData\\Acme\\My App']``\n\n    :param app_name: the application name. This should be properly capitalized\n                     and can contain whitespace.\n    :param app_author: The app author's name (or company). This should be\n                       properly capitalized and can contain whitespace.\n    :param force_xdg: if this is set to `True`, then on macOS the XDG Base\n                      Directory Specification will be followed. Has no effect\n                      on non-macOS systems.\n\n    \"\"\"\n    if WIN:\n        arg_3 = os.environ.get('PROGRAMDATA')\n        return [os.path.join(arg_3, arg_1, arg_0)]\n    if MAC and not arg_2:\n        return [os.path.join('/Library/Application Support', arg_0)]\n    arg_4 = os.environ.get('XDG_CONFIG_DIRS', '/etc/xdg')\n    arg_5 = [os.path.expanduser(x) for x in arg_4.split(os.pathsep)]\n    return [os.path.join(arg_6, _pathify(arg_0)) for arg_6 in arg_5]", "path": "cli_helpers/config.py", "identifier": "get_system_config_dirs", "docstring": "r\"\"\"Returns a list of system-wide config folders for the application.\n\n    For an example application called ``\"My App\"`` by ``\"Acme\"``,\n    something like the following folders could be returned:\n\n    macOS (non-XDG):\n      ``['/Library/Application Support/My App']``\n    Mac OS X (XDG):\n      ``['/etc/xdg/my-app']``\n    Unix:\n      ``['/etc/xdg/my-app']``\n    Windows 7:\n      ``['C:\\ProgramData\\Acme\\My App']``\n\n    :param app_name: the application name. This should be properly capitalized\n                     and can contain whitespace.\n    :param app_author: The app author's name (or company). This should be\n                       properly capitalized and can contain whitespace.\n    :param force_xdg: if this is set to `True`, then on macOS the XDG Base\n                      Directory Specification will be followed. Has no effect\n                      on non-macOS systems.", "docstring_tokens": ["r", "Returns", "a", "list", "of", "system", "-", "wide", "config", "folders", "for", "the", "application", "."], "nwo": "dbcli/cli_helpers", "score": 0.43979569135490515, "idx": 256606}
{"url": "https://github.com/dade-ai/snipy/blob/408520867179f99b3158b57520e2619f3fecd69b/snipy/imageme.py#L74-L172", "sha": "408520867179f99b3158b57520e2619f3fecd69b", "docstring_summary": "Create an index file in the given location, supplying known lists of\n    present image files and subdirectories.", "language": "python", "parameters": "(\n        root_dir, location, image_files, dirs, force_no_processing=False)", "return_statement": "return index_file_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "'imageMe: '", "+", "arg_1", "+", "' ['", "+", "str", "(", "len", "(", "arg_2", ")", ")", "+", "' image(s)]'", "arg_6", "=", "[", "'<!DOCTYPE html>'", ",", "'<html>'", ",", "'    <head>'", ",", "'        <title>imageMe</title>'", "'        <style>'", ",", "'            html, body {margin: 0;padding: 0;}'", ",", "'            .header {text-align: right;}'", ",", "'            .content {'", ",", "'                padding: 3em;'", ",", "'                padding-left: 4em;'", ",", "'                padding-right: 4em;'", ",", "'            }'", ",", "'            .image {max-width: 100%; border-radius: 0.3em;}'", ",", "'            td {width: '", "+", "str", "(", "100.0", "/", "IMAGES_PER_ROW", ")", "+", "'%;}'", ",", "'        </style>'", ",", "'    </head>'", ",", "'    <body>'", ",", "'    <div class=\"content\">'", ",", "'        <h2 class=\"header\">'", "+", "arg_5", "+", "'</h2>'", "]", "arg_7", "=", "[", "]", "if", "arg_0", "!=", "arg_1", ":", "arg_7", "=", "[", "'..'", "]", "arg_7", "+=", "arg_3", "if", "len", "(", "arg_7", ")", ">", "0", ":", "arg_6", ".", "append", "(", "'<hr>'", ")", "for", "arg_8", "in", "arg_7", ":", "arg_9", "=", "arg_8", "+", "'/'", "+", "INDEX_FILE_NAME", "arg_6", "+=", "[", "'    <h3 class=\"header\">'", ",", "'    <a href=\"'", "+", "arg_9", "+", "'\">'", "+", "arg_8", "+", "'</a>'", ",", "'    </h3>'", "]", "arg_10", "=", "1", "arg_6", "+=", "[", "'<hr>'", ",", "'<table>'", "]", "for", "arg_11", "in", "arg_2", ":", "if", "arg_10", "==", "1", ":", "arg_6", ".", "append", "(", "'<tr>'", ")", "arg_12", "=", "_get_thumbnail_src_from_file", "(", "arg_1", ",", "arg_11", ",", "arg_4", ")", "arg_13", "=", "_get_image_link_target_from_file", "(", "arg_1", ",", "arg_11", ",", "arg_4", ")", "arg_6", "+=", "[", "'    <td>'", ",", "'    <a href=\"'", "+", "arg_13", "+", "'\">'", ",", "'        <img class=\"image\" src=\"'", "+", "arg_12", "+", "'\">'", ",", "'    </a>'", ",", "'    </td>'", "]", "if", "arg_10", "==", "IMAGES_PER_ROW", ":", "arg_10", "=", "0", "arg_6", ".", "append", "(", "'</tr>'", ")", "arg_10", "+=", "1", "arg_6", "+=", "[", "'</tr>'", ",", "'</table>'", "]", "arg_6", "+=", "[", "'    </div>'", ",", "'    </body>'", ",", "'</html>'", "]", "arg_14", "=", "_get_index_file_path", "(", "arg_1", ")", "print", "(", "'Creating index file %s'", "%", "arg_14", ")", "arg_15", "=", "open", "(", "arg_14", ",", "'w'", ")", "arg_15", ".", "write", "(", "'\\n'", ".", "join", "(", "arg_6", ")", ")", "arg_15", ".", "close", "(", ")", "return", "arg_14"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3, arg_4=False):\n    \"\"\"\n    Create an index file in the given location, supplying known lists of\n    present image files and subdirectories.\n    @param {String} root_dir - The root directory of the entire crawl. Used to\n        ascertain whether the given location is the top level.\n    @param {String} location - The current directory of the crawl. The index\n        file will be created here.\n    @param {[String]} image_files - A list of image file names in the location.\n        These will be displayed in the index file's gallery.\n    @param {[String]} dirs - The subdirectories of the location directory.\n        These will be displayed as links further down the file structure.\n    @param {Boolean=False} force_no_processing - If True, do not attempt to\n        actually process thumbnails, PIL images or anything. Simply index\n        <img> tags with original file src attributes.\n    @return {String} The full path (location plus filename) of the newly\n        created index file. Intended for usage cleaning up created files.\n    \"\"\"\n    # Put together HTML as a list of the lines we'll want to include\n    # Issue #2 exists to do this better than HTML in-code\n    arg_5 = \\\n        'imageMe: ' + arg_1 + ' [' + str(len(arg_2)) + ' image(s)]'\n    arg_6 = [\n        '<!DOCTYPE html>',\n        '<html>',\n        '    <head>',\n        '        <title>imageMe</title>'\n        '        <style>',\n        '            html, body {margin: 0;padding: 0;}',\n        '            .header {text-align: right;}',\n        '            .content {',\n        '                padding: 3em;',\n        '                padding-left: 4em;',\n        '                padding-right: 4em;',\n        '            }',\n        '            .image {max-width: 100%; border-radius: 0.3em;}',\n        '            td {width: ' + str(100.0 / IMAGES_PER_ROW) + '%;}',\n        '        </style>',\n        '    </head>',\n        '    <body>',\n        '    <div class=\"content\">',\n        '        <h2 class=\"header\">' + arg_5 + '</h2>'\n    ]\n    # Populate the present subdirectories - this includes '..' unless we're at\n    # the top level\n    arg_7 = []\n    if arg_0 != arg_1:\n        arg_7 = ['..']\n    arg_7 += arg_3\n    if len(arg_7) > 0:\n        arg_6.append('<hr>')\n    # For each subdirectory, include a link to its index file\n    for arg_8 in arg_7:\n        arg_9 = arg_8 + '/' + INDEX_FILE_NAME\n        arg_6 += [\n            '    <h3 class=\"header\">',\n            '    <a href=\"' + arg_9 + '\">' + arg_8 + '</a>',\n            '    </h3>'\n        ]\n    # Populate the image gallery table\n    # Counter to cycle down through table rows\n    arg_10 = 1\n    arg_6 += ['<hr>', '<table>']\n    # For each image file, potentially create a new <tr> and create a new <td>\n    for arg_11 in arg_2:\n        if arg_10 == 1:\n            arg_6.append('<tr>')\n        arg_12 = _get_thumbnail_src_from_file(\n            arg_1, arg_11, arg_4\n        )\n        arg_13 = _get_image_link_target_from_file(\n            arg_1, arg_11, arg_4\n        )\n        arg_6 += [\n            '    <td>',\n            '    <a href=\"' + arg_13 + '\">',\n            '        <img class=\"image\" src=\"' + arg_12 + '\">',\n            '    </a>',\n            '    </td>'\n        ]\n        if arg_10 == IMAGES_PER_ROW:\n            arg_10 = 0\n            arg_6.append('</tr>')\n        arg_10 += 1\n    arg_6 += ['</tr>', '</table>']\n    arg_6 += [\n        '    </div>',\n        '    </body>',\n        '</html>'\n    ]\n    # Actually create the file, now we've put together the HTML content\n    arg_14 = _get_index_file_path(arg_1)\n    print('Creating index file %s' % arg_14)\n    arg_15 = open(arg_14, 'w')\n    arg_15.write('\\n'.join(arg_6))\n    arg_15.close()\n    # Return the path for cleaning up later\n    return arg_14", "path": "snipy/imageme.py", "identifier": "_create_index_file", "docstring": "Create an index file in the given location, supplying known lists of\n    present image files and subdirectories.\n    @param {String} root_dir - The root directory of the entire crawl. Used to\n        ascertain whether the given location is the top level.\n    @param {String} location - The current directory of the crawl. The index\n        file will be created here.\n    @param {[String]} image_files - A list of image file names in the location.\n        These will be displayed in the index file's gallery.\n    @param {[String]} dirs - The subdirectories of the location directory.\n        These will be displayed as links further down the file structure.\n    @param {Boolean=False} force_no_processing - If True, do not attempt to\n        actually process thumbnails, PIL images or anything. Simply index\n        <img> tags with original file src attributes.\n    @return {String} The full path (location plus filename) of the newly\n        created index file. Intended for usage cleaning up created files.", "docstring_tokens": ["Create", "an", "index", "file", "in", "the", "given", "location", "supplying", "known", "lists", "of", "present", "image", "files", "and", "subdirectories", "."], "nwo": "dade-ai/snipy", "score": 0.18941942438232184, "idx": 256607}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/statements/learner_course_completion.py#L48-L64", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get result for the statement.", "language": "python", "parameters": "(self, course_grade)", "return_statement": "return Result(\n            score=Score(\n                scaled=course_grade.percent,\n                raw=course_grade.percent * 100,\n                min=MIN_SCORE,\n                max=MAX_SCORE,\n            ),\n            success=course_grade.passed,\n            completion=course_grade.passed\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Result", "(", "score", "=", "Score", "(", "scaled", "=", "arg_1", ".", "percent", ",", "raw", "=", "arg_1", ".", "percent", "*", "100", ",", "min", "=", "MIN_SCORE", ",", "max", "=", "MAX_SCORE", ",", ")", ",", "success", "=", "arg_1", ".", "passed", ",", "completion", "=", "arg_1", ".", "passed", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get result for the statement.\n\n        Arguments:\n            course_grade (CourseGrade): Course grade.\n        \"\"\"\n        return Result(\n            score=Score(\n                scaled=arg_1.percent,\n                raw=arg_1.percent * 100,\n                min=MIN_SCORE,\n                max=MAX_SCORE,\n            ),\n            success=arg_1.passed,\n            completion=arg_1.passed\n        )", "path": "integrated_channels/xapi/statements/learner_course_completion.py", "identifier": "LearnerCourseCompletionStatement.get_result", "docstring": "Get result for the statement.\n\n        Arguments:\n            course_grade (CourseGrade): Course grade.", "docstring_tokens": ["Get", "result", "for", "the", "statement", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256608}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/specs/BpmnSpecMixin.py#L125-L130", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns a list of the names of outgoing sequences. Some may be None.", "language": "python", "parameters": "(self)", "return_statement": "return sorted([s.name for s in\n                       list(self.outgoing_sequence_flows_by_id.values())])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "sorted", "(", "[", "arg_1", ".", "name", "for", "arg_1", "in", "list", "(", "arg_0", ".", "outgoing_sequence_flows_by_id", ".", "values", "(", ")", ")", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a list of the names of outgoing sequences. Some may be None.\n        \"\"\"\n        return sorted([arg_1.name for arg_1 in\n                       list(arg_0.outgoing_sequence_flows_by_id.values())])", "path": "SpiffWorkflow/bpmn/specs/BpmnSpecMixin.py", "identifier": "BpmnSpecMixin.get_outgoing_sequence_names", "docstring": "Returns a list of the names of outgoing sequences. Some may be None.", "docstring_tokens": ["Returns", "a", "list", "of", "the", "names", "of", "outgoing", "sequences", ".", "Some", "may", "be", "None", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 256609}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/coolprop.py#L213-L290", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Calculates a property of a chemical in either the liquid or gas phase\n    as a function of temperature only. This means that the property is\n    either at 1 atm or along the saturation curve.", "language": "python", "parameters": "(T, CASRN, prop, phase)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "has_CoolProp", ":", "raise", "Exception", "(", "'CoolProp library is not installed'", ")", "if", "arg_1", "not", "in", "coolprop_dict", ":", "raise", "Exception", "(", "'CASRN not in list of supported fluids'", ")", "arg_4", "=", "coolprop_fluids", "[", "arg_1", "]", ".", "Tc", "arg_0", "=", "float", "(", "arg_0", ")", "if", "arg_3", "==", "'l'", ":", "if", "arg_0", ">", "arg_4", ":", "raise", "Exception", "(", "'For liquid properties, must be under the critical temperature.'", ")", "if", "PhaseSI", "(", "'T'", ",", "arg_0", ",", "'P'", ",", "101325", ",", "arg_1", ")", "in", "[", "u'liquid'", ",", "u'supercritical_liquid'", "]", ":", "return", "PropsSI", "(", "arg_2", ",", "'T'", ",", "arg_0", ",", "'P'", ",", "101325", ",", "arg_1", ")", "else", ":", "return", "PropsSI", "(", "arg_2", ",", "'T'", ",", "arg_0", ",", "'Q'", ",", "0", ",", "arg_1", ")", "elif", "arg_3", "==", "'g'", ":", "if", "PhaseSI", "(", "'T'", ",", "arg_0", ",", "'P'", ",", "101325", ",", "arg_1", ")", "==", "'gas'", ":", "return", "PropsSI", "(", "arg_2", ",", "'T'", ",", "arg_0", ",", "'P'", ",", "101325", ",", "arg_1", ")", "else", ":", "if", "arg_0", "<", "arg_4", ":", "return", "PropsSI", "(", "arg_2", ",", "'T'", ",", "arg_0", ",", "'Q'", ",", "1", ",", "arg_1", ")", "else", ":", "return", "PropsSI", "(", "arg_2", ",", "'T'", ",", "arg_0", ",", "'P'", ",", "101325", ",", "arg_1", ")", "else", ":", "raise", "Exception", "(", "'Error in CoolProp property function'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    r'''Calculates a property of a chemical in either the liquid or gas phase\n    as a function of temperature only. This means that the property is\n    either at 1 atm or along the saturation curve.\n\n    Parameters\n    ----------\n    T : float\n        Temperature of the fluid [K]\n    CASRN : str\n        CAS number of the fluid\n    prop : str\n        CoolProp string shortcut for desired property\n    phase : str\n        Either 'l' or 'g' for liquid or gas properties respectively\n\n    Returns\n    -------\n    prop : float\n        Desired chemical property, [units]\n\n    Notes\n    -----\n    For liquids above their boiling point, the liquid property is found on the\n    saturation line (at higher pressures). Under their boiling point, the\n    property is calculated at 1 atm.\n\n    No liquid calculations are permitted above the critical temperature.\n\n    For gases under the chemical's boiling point, the gas property is found\n    on the saturation line (at sub-atmospheric pressures). Above the boiling\n    point, the property is calculated at 1 atm.\n\n    An exception is raised if the desired CAS is not supported, or if CoolProp\n    is not available.\n\n    The list of strings acceptable as an input for property types is:\n    http://www.coolprop.org/coolprop/HighLevelAPI.html#table-of-string-inputs-to-propssi-function\n\n    Examples\n    --------\n    Water at STP according to IAPWS-95\n\n    >>> Func(298.15, '7732-18-5', 'D', 'l')\n    997.047636760347\n\n    References\n    ----------\n    .. [1] Bell, Ian H., Jorrit Wronski, Sylvain Quoilin, and Vincent Lemort.\n       \"Pure and Pseudo-Pure Fluid Thermophysical Property Evaluation and the\n       Open-Source Thermophysical Property Library CoolProp.\" Industrial &\n       Engineering Chemistry Research 53, no. 6 (February 12, 2014):\n       2498-2508. doi:10.1021/ie4033999. http://www.coolprop.org/\n    '''\n    if not has_CoolProp:  # pragma: no cover\n        raise Exception('CoolProp library is not installed')\n    if arg_1 not in coolprop_dict:\n        raise Exception('CASRN not in list of supported fluids')\n    arg_4 = coolprop_fluids[arg_1].Tc\n    arg_0 = float(arg_0) # Do not allow custom objects here\n    if arg_3 == 'l':\n        if arg_0 > arg_4:\n            raise Exception('For liquid properties, must be under the critical temperature.')\n        if PhaseSI('T', arg_0, 'P', 101325, arg_1) in [u'liquid', u'supercritical_liquid']:\n            return PropsSI(arg_2, 'T', arg_0, 'P', 101325, arg_1)\n        else:\n            return PropsSI(arg_2, 'T', arg_0, 'Q', 0, arg_1)\n    elif arg_3 == 'g':\n        if PhaseSI('T', arg_0, 'P', 101325, arg_1) == 'gas':\n            return PropsSI(arg_2, 'T', arg_0, 'P', 101325, arg_1)\n        else:\n            if arg_0 < arg_4:\n                return PropsSI(arg_2, 'T', arg_0, 'Q', 1, arg_1)\n            else:\n                # catch supercritical_gas and friends\n                return PropsSI(arg_2, 'T', arg_0, 'P', 101325, arg_1)\n    else:\n        raise Exception('Error in CoolProp property function')", "path": "thermo/coolprop.py", "identifier": "CoolProp_T_dependent_property", "docstring": "r'''Calculates a property of a chemical in either the liquid or gas phase\n    as a function of temperature only. This means that the property is\n    either at 1 atm or along the saturation curve.\n\n    Parameters\n    ----------\n    T : float\n        Temperature of the fluid [K]\n    CASRN : str\n        CAS number of the fluid\n    prop : str\n        CoolProp string shortcut for desired property\n    phase : str\n        Either 'l' or 'g' for liquid or gas properties respectively\n\n    Returns\n    -------\n    prop : float\n        Desired chemical property, [units]\n\n    Notes\n    -----\n    For liquids above their boiling point, the liquid property is found on the\n    saturation line (at higher pressures). Under their boiling point, the\n    property is calculated at 1 atm.\n\n    No liquid calculations are permitted above the critical temperature.\n\n    For gases under the chemical's boiling point, the gas property is found\n    on the saturation line (at sub-atmospheric pressures). Above the boiling\n    point, the property is calculated at 1 atm.\n\n    An exception is raised if the desired CAS is not supported, or if CoolProp\n    is not available.\n\n    The list of strings acceptable as an input for property types is:\n    http://www.coolprop.org/coolprop/HighLevelAPI.html#table-of-string-inputs-to-propssi-function\n\n    Examples\n    --------\n    Water at STP according to IAPWS-95\n\n    >>> CoolProp_T_dependent_property(298.15, '7732-18-5', 'D', 'l')\n    997.047636760347\n\n    References\n    ----------\n    .. [1] Bell, Ian H., Jorrit Wronski, Sylvain Quoilin, and Vincent Lemort.\n       \"Pure and Pseudo-Pure Fluid Thermophysical Property Evaluation and the\n       Open-Source Thermophysical Property Library CoolProp.\" Industrial &\n       Engineering Chemistry Research 53, no. 6 (February 12, 2014):\n       2498-2508. doi:10.1021/ie4033999. http://www.coolprop.org/", "docstring_tokens": ["r", "Calculates", "a", "property", "of", "a", "chemical", "in", "either", "the", "liquid", "or", "gas", "phase", "as", "a", "function", "of", "temperature", "only", ".", "This", "means", "that", "the", "property", "is", "either", "at", "1", "atm", "or", "along", "the", "saturation", "curve", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256610}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/execution.py#L222-L239", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Return dictionary of transformed results, with keys being output names.\n        Returns None if execution result isn't a success.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "success", "and", "arg_0", ".", "transforms", ":", "with", "arg_0", ".", "reconstruct_context", "(", ")", "as", "context", ":", "arg_1", "=", "{", "result", ".", "step_output_data", ".", "output_name", ":", "arg_0", ".", "_get_value", "(", "context", ",", "result", ".", "step_output_data", ")", "for", "result", "in", "arg_0", ".", "transforms", "if", "result", ".", "is_successful_output", "}", "return", "arg_1", "else", ":", "return", "None"], "function": "def Func(arg_0):\n        '''Return dictionary of transformed results, with keys being output names.\n        Returns None if execution result isn't a success.\n\n        Reconstructs the pipeline context to materialize values.\n        '''\n        if arg_0.success and arg_0.transforms:\n            with arg_0.reconstruct_context() as context:\n                arg_1 = {\n                    result.step_output_data.output_name: arg_0._get_value(\n                        context, result.step_output_data\n                    )\n                    for result in arg_0.transforms\n                    if result.is_successful_output\n                }\n            return arg_1\n        else:\n            return None", "path": "python_modules/dagster/dagster/core/execution.py", "identifier": "SolidExecutionResult.transformed_values", "docstring": "Return dictionary of transformed results, with keys being output names.\n        Returns None if execution result isn't a success.\n\n        Reconstructs the pipeline context to materialize values.", "docstring_tokens": ["Return", "dictionary", "of", "transformed", "results", "with", "keys", "being", "output", "names", ".", "Returns", "None", "if", "execution", "result", "isn", "t", "a", "success", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 256611}
{"url": "https://github.com/versae/ipython-cypher/blob/1e88bd8227743e70b78af42e0e713ae8803485e1/src/cypher/run.py#L188-L213", "sha": "1e88bd8227743e70b78af42e0e713ae8803485e1", "docstring_summary": "Returns a NetworkX multi-graph instance built from the result set", "language": "python", "parameters": "(self, directed=True)", "return_statement": "return graph", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "nx", "is", "None", ":", "raise", "ImportError", "(", "\"Try installing NetworkX first.\"", ")", "if", "arg_1", ":", "arg_2", "=", "nx", ".", "MultiDiGraph", "(", ")", "else", ":", "arg_2", "=", "nx", ".", "MultiGraph", "(", ")", "for", "arg_3", "in", "arg_0", ".", "_results", ".", "graph", ":", "for", "arg_4", "in", "arg_3", "[", "'nodes'", "]", ":", "arg_5", "=", "copy", ".", "deepcopy", "(", "arg_4", "[", "'properties'", "]", ")", "arg_5", "[", "'labels'", "]", "=", "arg_4", "[", "'labels'", "]", "arg_2", ".", "add_node", "(", "arg_4", "[", "'id'", "]", ",", "**", "arg_5", ")", "for", "arg_6", "in", "arg_3", "[", "'relationships'", "]", ":", "arg_5", "=", "copy", ".", "deepcopy", "(", "arg_6", "[", "'properties'", "]", ")", "arg_5", ".", "update", "(", "id", "=", "arg_6", "[", "'id'", "]", ",", "type", "=", "arg_6", "[", "'type'", "]", ")", "arg_2", ".", "add_edge", "(", "arg_6", "[", "'startNode'", "]", ",", "arg_6", "[", "'endNode'", "]", ",", "key", "=", "arg_6", ".", "get", "(", "'type'", ")", ",", "**", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Returns a NetworkX multi-graph instance built from the result set\n\n        :param directed: boolean, optional (default=`True`).\n            Whether to create a direted or an undirected graph.\n        \"\"\"\n        if nx is None:\n            raise ImportError(\"Try installing NetworkX first.\")\n        if arg_1:\n            arg_2 = nx.MultiDiGraph()\n        else:\n            arg_2 = nx.MultiGraph()\n        for arg_3 in arg_0._results.graph:\n            for arg_4 in arg_3['nodes']:\n                arg_5 = copy.deepcopy(arg_4['properties'])\n                arg_5['labels'] = arg_4['labels']\n                arg_2.add_node(arg_4['id'], **arg_5)\n            for arg_6 in arg_3['relationships']:\n                arg_5 = copy.deepcopy(arg_6['properties'])\n                arg_5.update(\n                    id=arg_6['id'],\n                    type=arg_6['type']\n                )\n                arg_2.add_edge(arg_6['startNode'], arg_6['endNode'],\n                               key=arg_6.get('type'), **arg_5)\n        return arg_2", "path": "src/cypher/run.py", "identifier": "ResultSet.get_graph", "docstring": "Returns a NetworkX multi-graph instance built from the result set\n\n        :param directed: boolean, optional (default=`True`).\n            Whether to create a direted or an undirected graph.", "docstring_tokens": ["Returns", "a", "NetworkX", "multi", "-", "graph", "instance", "built", "from", "the", "result", "set"], "nwo": "versae/ipython-cypher", "score": 0.19653268135590604, "idx": 256612}
{"url": "https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L244-L262", "sha": "3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8", "docstring_summary": "Returns an iterator of Period tuples for every day this schedule is in effect, between range_start\n        and range_end.", "language": "python", "parameters": "(self, range_start=datetime.date.min, range_end=datetime.date.max, exclude_dates=tuple())", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "date", ".", "min", ",", "arg_5", "=", "arg_2", ".", "date", ".", "max", ",", "arg_7", "=", "arg_8", "(", ")", ")", ":", "arg_9", "=", "arg_0", ".", "timezone", "arg_10", "=", "arg_0", ".", "period", "arg_11", "=", "arg_0", ".", "weekdays", "arg_12", "=", "arg_6", "(", "arg_1", ",", "arg_0", ".", "start_date", ")", "arg_13", "=", "arg_5", "if", "arg_0", ".", "end_date", ":", "arg_13", "=", "arg_4", "(", "arg_13", ",", "arg_0", ".", "end_date", ")", "while", "arg_12", "<=", "arg_13", ":", "if", "arg_12", ".", "weekday", "(", ")", "in", "arg_11", "and", "arg_12", "not", "in", "arg_7", ":", "yield", "Period", "(", "arg_9", ".", "localize", "(", "arg_2", ".", "datetime", ".", "combine", "(", "arg_12", ",", "arg_10", ".", "start", ")", ")", ",", "arg_9", ".", "localize", "(", "arg_2", ".", "datetime", ".", "combine", "(", "arg_12", ",", "arg_10", ".", "end", ")", ")", ")", "arg_12", "+=", "arg_2", ".", "timedelta", "(", "days", "=", "1", ")"], "function": "def Func(arg_0, arg_1=arg_2.date.min, arg_5=arg_2.date.max, arg_7=arg_8()):\n        \"\"\"Returns an iterator of Period tuples for every day this schedule is in effect, between range_start\n        and range_end.\"\"\"\n        arg_9 = arg_0.timezone\n        arg_10 = arg_0.period\n        arg_11 = arg_0.weekdays\n\n        arg_12 = arg_6(arg_1, arg_0.start_date)\n        arg_13 = arg_5\n        if arg_0.end_date:\n            arg_13 = arg_4(arg_13, arg_0.end_date)\n\n        while arg_12 <= arg_13:\n            if arg_12.weekday() in arg_11 and arg_12 not in arg_7:\n                yield Period(\n                    arg_9.localize(arg_2.datetime.combine(arg_12, arg_10.start)),\n                    arg_9.localize(arg_2.datetime.combine(arg_12, arg_10.end))\n                )\n            arg_12 += arg_2.timedelta(days=1)", "path": "open511/utils/schedule.py", "identifier": "RecurringScheduleComponent.daily_periods", "docstring": "Returns an iterator of Period tuples for every day this schedule is in effect, between range_start\n        and range_end.", "docstring_tokens": ["Returns", "an", "iterator", "of", "Period", "tuples", "for", "every", "day", "this", "schedule", "is", "in", "effect", "between", "range_start", "and", "range_end", "."], "nwo": "open511/open511", "score": 0.138843686048881, "idx": 256613}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L359-L364", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Extracts the wildcards and file replacements from the `trajectory`", "language": "python", "parameters": "(self, trajectory)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "env_name", "=", "arg_1", ".", "v_environment_name", "arg_0", ".", "traj_name", "=", "arg_1", ".", "v_name", "arg_0", ".", "set_name", "=", "arg_1", ".", "f_wildcard", "(", "'$set'", ")", "arg_0", ".", "run_name", "=", "arg_1", ".", "f_wildcard", "(", "'$'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Extracts the wildcards and file replacements from the `trajectory`\"\"\"\n        arg_0.env_name = arg_1.v_environment_name\n        arg_0.traj_name = arg_1.v_name\n        arg_0.set_name =  arg_1.f_wildcard('$set')\n        arg_0.run_name = arg_1.f_wildcard('$')", "path": "pypet/pypetlogging.py", "identifier": "LoggingManager.extract_replacements", "docstring": "Extracts the wildcards and file replacements from the `trajectory`", "docstring_tokens": ["Extracts", "the", "wildcards", "and", "file", "replacements", "from", "the", "trajectory"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256614}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/pycheck.py#L37-L71", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "Print \"Source Lines of Code\" and export to file.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "options", ".", "get", "(", "'setup'", ")", "arg_1", "=", "options", ".", "get", "(", "'packages'", ")", "if", "arg_0", "else", "None", "if", "arg_1", ":", "arg_2", "=", "[", "x", "for", "x", "in", "arg_1", "if", "'.'", "not", "in", "x", "]", "else", ":", "arg_2", "=", "[", "'.'", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "arg_3", "+=", "list", "(", "path", "(", "arg_4", ")", ".", "walkfiles", "(", ")", ")", "arg_5", "=", "' '", ".", "join", "(", "arg_3", ")", "arg_6", "=", "options", ".", "paved", ".", "pycheck", ".", "Func", ".", "param", "sh", "(", "'Func {param} {files} | tee Func.sc'", ".", "format", "(", "arg_6", "=", "arg_6", ",", "arg_5", "=", "arg_5", ")", ")"], "function": "def Func():\n    '''Print \"Source Lines of Code\" and export to file.\n\n    Export is hudson_ plugin_ compatible: Func.sc\n\n    requirements:\n     - Func_ should be installed.\n     - tee and pipes are used\n\n    options.paved.pycheck.Func.param\n\n    .. _Func: http://www.dwheeler.com/Func/\n    .. _hudson: http://hudson-ci.org/\n    .. _plugin: http://wiki.hudson-ci.org/display/HUDSON/SLOCCount+Plugin\n    '''\n\n    # filter out  subpackages\n    arg_0 = options.get('setup')\n    arg_1 = options.get('packages') if arg_0 else None\n\n    if arg_1:\n        arg_2 = [x for x in arg_1 if '.' not in x]\n    else:\n        arg_2 = ['.']\n\n    # Func has strange behaviour with directories,\n    # can cause exception in hudson Func plugin.\n    # Better to call it with file list\n    arg_3=[]\n    for arg_4 in arg_2:\n        arg_3 += list(path(arg_4).walkfiles())\n    #ls=list(set(ls))\n    arg_5=' '.join(arg_3)\n    arg_6=options.paved.pycheck.Func.param\n    sh('Func {param} {files} | tee Func.sc'.format(arg_6=arg_6, arg_5=arg_5))", "path": "paved/pycheck.py", "identifier": "sloccount", "docstring": "Print \"Source Lines of Code\" and export to file.\n\n    Export is hudson_ plugin_ compatible: sloccount.sc\n\n    requirements:\n     - sloccount_ should be installed.\n     - tee and pipes are used\n\n    options.paved.pycheck.sloccount.param\n\n    .. _sloccount: http://www.dwheeler.com/sloccount/\n    .. _hudson: http://hudson-ci.org/\n    .. _plugin: http://wiki.hudson-ci.org/display/HUDSON/SLOCCount+Plugin", "docstring_tokens": ["Print", "Source", "Lines", "of", "Code", "and", "export", "to", "file", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 256615}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L582-L599", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the enthalpy of the package at the specified temperature.", "language": "python", "parameters": "(self, T)", "return_statement": "return H", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "isCoal", ":", "return", "arg_0", ".", "Funcfr_coal", "(", "arg_1", ")", "arg_2", "=", "0.0", "for", "arg_3", "in", "arg_0", ".", "material", ".", "compounds", ":", "arg_4", "=", "arg_0", ".", "material", ".", "get_compound_index", "(", "arg_3", ")", "arg_5", "=", "thermo", ".", "H", "(", "arg_3", ",", "arg_1", ",", "arg_0", ".", "_compound_masses", "[", "arg_4", "]", ")", "arg_2", "=", "arg_2", "+", "arg_5", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the enthalpy of the package at the specified temperature.\n\n        :param T: Temperature. [\u00b0C]\n\n        :returns: Enthalpy. [kWh]\n        \"\"\"\n\n        if arg_0.isCoal:\n            return arg_0.Funcfr_coal(arg_1)\n\n        arg_2 = 0.0\n        for arg_3 in arg_0.material.compounds:\n            arg_4 = arg_0.material.get_compound_index(arg_3)\n            arg_5 = thermo.H(arg_3, arg_1, arg_0._compound_masses[arg_4])\n            arg_2 = arg_2 + arg_5\n        return arg_2", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "MaterialPackage._calculate_H", "docstring": "Calculate the enthalpy of the package at the specified temperature.\n\n        :param T: Temperature. [\u00b0C]\n\n        :returns: Enthalpy. [kWh]", "docstring_tokens": ["Calculate", "the", "enthalpy", "of", "the", "package", "at", "the", "specified", "temperature", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 256616}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L268-L338", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Performs a single run of the experiment.", "language": "python", "parameters": "(kwargs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "logging", ".", "getLogger", "(", "'pypet'", ")", "arg_2", "=", "arg_0", "[", "'traj'", "]", "arg_3", "=", "arg_0", "[", "'runfunc'", "]", "arg_4", "=", "arg_0", "[", "'runargs'", "]", "arg_5", "=", "arg_0", "[", "'runkwargs'", "]", "arg_6", "=", "arg_0", "[", "'clean_up_runs'", "]", "arg_7", "=", "arg_0", "[", "'automatic_storing'", "]", "arg_8", "=", "arg_0", "[", "'wrap_mode'", "]", "arg_9", "=", "arg_2", ".", "v_idx", "arg_10", "=", "len", "(", "arg_2", ")", "arg_1", ".", "info", "(", "'\\n=========================================\\n '", "'Starting single run #%d of %d '", "'\\n=========================================\\n'", "%", "(", "arg_9", ",", "arg_10", ")", ")", "arg_2", ".", "f_start_run", "(", "turn_into_run", "=", "True", ")", "arg_11", "=", "arg_3", "(", "arg_2", ",", "*", "arg_4", ",", "**", "arg_5", ")", "if", "arg_7", ":", "arg_2", ".", "f_store", "(", ")", "if", "arg_8", "==", "pypetconstants", ".", "WRAP_MODE_LOCAL", ":", "arg_11", "=", "(", "(", "arg_2", ".", "v_idx", ",", "arg_11", ")", ",", "arg_2", ".", "f_get_run_information", "(", "arg_2", ".", "v_idx", ",", "copy", "=", "False", ")", ",", "arg_2", ".", "v_storage_service", ".", "references", ")", "arg_2", ".", "v_storage_service", ".", "free_references", "(", ")", "else", ":", "arg_11", "=", "(", "(", "arg_2", ".", "v_idx", ",", "arg_11", ")", ",", "arg_2", ".", "f_get_run_information", "(", "arg_2", ".", "v_idx", ",", "copy", "=", "False", ")", ")", "arg_2", ".", "f_finalize_run", "(", "store_meta_data", "=", "False", ",", "clean_up", "=", "arg_6", ")", "arg_1", ".", "info", "(", "'\\n=========================================\\n '", "'Finished single run #%d of %d '", "'\\n=========================================\\n'", "%", "(", "arg_9", ",", "arg_10", ")", ")", "return", "arg_11"], "function": "def Func(arg_0):\n    \"\"\" Performs a single run of the experiment.\n\n    :param kwargs: Dict of arguments\n\n        traj: The trajectory containing all parameters set to the corresponding run index.\n\n        runfunc: The user's job function\n\n        runargs: The arguments handed to the user's job function (as *args)\n\n        runkwargs: The keyword arguments handed to the user's job function (as **kwargs)\n\n        clean_up_after_run: Whether to clean up after the run\n\n        automatic_storing: Whether or not the data should be automatically stored\n\n        result_queue: A queue object to store results into in case a pool is used, otherwise None\n\n    :return:\n\n        Results computed by the user's job function which are not stored into the trajectory.\n        Returns a nested tuple of run index and result and run information:\n        ``((traj.v_idx, result), run_information_dict)``\n\n    \"\"\"\n    arg_1 = logging.getLogger('pypet')\n    arg_2 = arg_0['traj']\n    arg_3 = arg_0['runfunc']\n    arg_4 = arg_0['runargs']\n    arg_5 = arg_0['runkwargs']\n    arg_6 = arg_0['clean_up_runs']\n    arg_7 = arg_0['automatic_storing']\n    arg_8 = arg_0['wrap_mode']\n\n    arg_9 = arg_2.v_idx\n    arg_10 = len(arg_2)\n\n    arg_1.info('\\n=========================================\\n '\n              'Starting single run #%d of %d '\n              '\\n=========================================\\n' % (arg_9, arg_10))\n\n    # Measure start time\n    arg_2.f_start_run(turn_into_run=True)\n\n    # Run the job function of the user\n    arg_11 = arg_3(arg_2, *arg_4, **arg_5)\n\n    # Store data if desired\n    if arg_7:\n        arg_2.f_store()\n\n    # Add the index to the result and the run information\n    if arg_8 == pypetconstants.WRAP_MODE_LOCAL:\n        arg_11 = ((arg_2.v_idx, arg_11),\n                   arg_2.f_get_run_information(arg_2.v_idx, copy=False),\n                   arg_2.v_storage_service.references)\n        arg_2.v_storage_service.free_references()\n    else:\n        arg_11 = ((arg_2.v_idx, arg_11),\n                   arg_2.f_get_run_information(arg_2.v_idx, copy=False))\n\n    # Measure time of finishing\n    arg_2.f_finalize_run(store_meta_data=False,\n                        clean_up=arg_6)\n\n    arg_1.info('\\n=========================================\\n '\n              'Finished single run #%d of %d '\n              '\\n=========================================\\n' % (arg_9, arg_10))\n\n    return arg_11", "path": "pypet/environment.py", "identifier": "_single_run", "docstring": "Performs a single run of the experiment.\n\n    :param kwargs: Dict of arguments\n\n        traj: The trajectory containing all parameters set to the corresponding run index.\n\n        runfunc: The user's job function\n\n        runargs: The arguments handed to the user's job function (as *args)\n\n        runkwargs: The keyword arguments handed to the user's job function (as **kwargs)\n\n        clean_up_after_run: Whether to clean up after the run\n\n        automatic_storing: Whether or not the data should be automatically stored\n\n        result_queue: A queue object to store results into in case a pool is used, otherwise None\n\n    :return:\n\n        Results computed by the user's job function which are not stored into the trajectory.\n        Returns a nested tuple of run index and result and run information:\n        ``((traj.v_idx, result), run_information_dict)``", "docstring_tokens": ["Performs", "a", "single", "run", "of", "the", "experiment", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256617}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L561-L610", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Find the executable arcs in the code.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_split_into_chunks", "(", ")", "arg_2", "=", "dict", "(", "[", "(", "c", ".", "byte", ",", "c", ")", "for", "c", "in", "arg_1", "]", ")", "yield", "(", "-", "1", ",", "arg_2", "[", "0", "]", ".", "line", ")", "for", "arg_3", "in", "arg_1", ":", "if", "not", "arg_3", ".", "first", ":", "continue", "arg_4", "=", "set", "(", ")", "arg_5", "=", "[", "arg_3", "]", "while", "arg_5", ":", "arg_6", "=", "arg_5", ".", "pop", "(", ")", "arg_4", ".", "add", "(", "arg_6", ")", "for", "arg_7", "in", "arg_6", ".", "exits", ":", "if", "arg_7", "<", "0", ":", "yield", "(", "arg_3", ".", "line", ",", "arg_7", ")", "else", ":", "arg_8", "=", "arg_2", "[", "arg_7", "]", "if", "arg_8", "in", "arg_4", ":", "continue", "arg_9", "=", "arg_8", ".", "byte", "<", "arg_6", ".", "byte", "if", "arg_8", ".", "first", "or", "arg_9", ":", "if", "arg_8", ".", "line", "!=", "arg_3", ".", "line", ":", "yield", "(", "arg_3", ".", "line", ",", "arg_8", ".", "line", ")", "else", ":", "arg_5", ".", "append", "(", "arg_8", ")"], "function": "def Func(arg_0):\n        \"\"\"Find the executable arcs in the code.\n\n        Yields pairs: (from,to).  From and to are integer line numbers.  If\n        from is < 0, then the arc is an entrance into the code object.  If to\n        is < 0, the arc is an exit from the code object.\n\n        \"\"\"\n        arg_1 = arg_0._split_into_chunks()\n\n        # A map from byte offsets to chunks jumped into.\n        arg_2 = dict([(c.byte, c) for c in arg_1])\n\n        # There's always an entrance at the first chunk.\n        yield (-1, arg_2[0].line)\n\n        # Traverse from the first chunk in each line, and yield arcs where\n        # the trace function will be invoked.\n        for arg_3 in arg_1:\n            if not arg_3.first:\n                continue\n\n            arg_4 = set()\n            arg_5 = [arg_3]\n            while arg_5:\n                # Get the chunk we're considering, and make sure we don't\n                # consider it again\n                arg_6 = arg_5.pop()\n                arg_4.add(arg_6)\n\n                # For each exit, add the line number if the trace function\n                # would be triggered, or add the chunk to those being\n                # considered if not.\n                for arg_7 in arg_6.exits:\n                    if arg_7 < 0:\n                        yield (arg_3.line, arg_7)\n                    else:\n                        arg_8 = arg_2[arg_7]\n                        if arg_8 in arg_4:\n                            continue\n\n                        # The trace function is invoked if visiting the first\n                        # bytecode in a line, or if the transition is a\n                        # backward jump.\n                        arg_9 = arg_8.byte < arg_6.byte\n                        if arg_8.first or arg_9:\n                            if arg_8.line != arg_3.line:\n                                yield (arg_3.line, arg_8.line)\n                        else:\n                            arg_5.append(arg_8)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py", "identifier": "ByteParser._arcs", "docstring": "Find the executable arcs in the code.\n\n        Yields pairs: (from,to).  From and to are integer line numbers.  If\n        from is < 0, then the arc is an entrance into the code object.  If to\n        is < 0, the arc is an exit from the code object.", "docstring_tokens": ["Find", "the", "executable", "arcs", "in", "the", "code", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256618}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/displayhook.py#L111-L121", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Write the output prompt.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "io", ".", "stdout", ".", "write", "(", "arg_0", ".", "shell", ".", "separate_out", ")", "arg_1", "=", "arg_0", ".", "shell", ".", "prompt_manager", ".", "render", "(", "'out'", ")", "if", "arg_0", ".", "do_full_cache", ":", "io", ".", "stdout", ".", "write", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Write the output prompt.\n\n        The default implementation simply writes the prompt to\n        ``io.stdout``.\n        \"\"\"\n        # Use write, not print which adds an extra space.\n        io.stdout.write(arg_0.shell.separate_out)\n        arg_1 = arg_0.shell.prompt_manager.render('out')\n        if arg_0.do_full_cache:\n            io.stdout.write(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/core/displayhook.py", "identifier": "DisplayHook.write_output_prompt", "docstring": "Write the output prompt.\n\n        The default implementation simply writes the prompt to\n        ``io.stdout``.", "docstring_tokens": ["Write", "the", "output", "prompt", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256619}
{"url": "https://github.com/mshroyer/pointfree/blob/a25ecb3f0cd583e0730ecdde83018e5089711854/pointfree.py#L705-L730", "sha": "a25ecb3f0cd583e0730ecdde83018e5089711854", "docstring_summary": "Prints each item from an iterable.", "language": "python", "parameters": "(iterable, end='\\n', file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'\\n'", ",", "arg_2", "=", "None", ")", ":", "for", "arg_3", "in", "arg_0", ":", "pfprint", "(", "arg_3", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1='\\n', arg_2=None):\n    \"\"\"Prints each item from an iterable.\n\n    :param iterable: An iterable yielding values to print\n    :param end: String to append to the end of printed output\n    :param file: File to which output is printed\n    :rtype: None\n\n    Example::\n\n        >>> @pointfree\n        ... def prefix_all(prefix, iterable):\n        ...     for item in iterable:\n        ...         yield \"%s%s\" % (prefix, item)\n\n        >>> fn = prefix_all(\"An item: \") >> Func\n\n        >>> fn([\"foo\", \"bar\", \"baz\"])\n        An item: foo\n        An item: bar\n        An item: baz\n\n    \"\"\"\n\n    for arg_3 in arg_0:\n        pfprint(arg_3, arg_1=arg_1, arg_2=arg_2)", "path": "pointfree.py", "identifier": "pfprint_all", "docstring": "Prints each item from an iterable.\n\n    :param iterable: An iterable yielding values to print\n    :param end: String to append to the end of printed output\n    :param file: File to which output is printed\n    :rtype: None\n\n    Example::\n\n        >>> @pointfree\n        ... def prefix_all(prefix, iterable):\n        ...     for item in iterable:\n        ...         yield \"%s%s\" % (prefix, item)\n\n        >>> fn = prefix_all(\"An item: \") >> pfprint_all\n\n        >>> fn([\"foo\", \"bar\", \"baz\"])\n        An item: foo\n        An item: bar\n        An item: baz", "docstring_tokens": ["Prints", "each", "item", "from", "an", "iterable", "."], "nwo": "mshroyer/pointfree", "score": 0.21302904236143622, "idx": 256620}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py#L140-L152", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the single KernelManager object for a kernel by its uuid.", "language": "python", "parameters": "(self, kernel_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_kernels", ".", "get", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_2", "else", ":", "raise", "KeyError", "(", "\"Kernel with id not found: %s\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get the single KernelManager object for a kernel by its uuid.\n\n        Parameters\n        ==========\n        kernel_id : uuid\n            The id of the kernel.\n        \"\"\"\n        arg_2 = arg_0._kernels.get(arg_1)\n        if arg_2 is not None:\n            return arg_2\n        else:\n            raise KeyError(\"Kernel with id not found: %s\" % arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py", "identifier": "MultiKernelManager.get_kernel", "docstring": "Get the single KernelManager object for a kernel by its uuid.\n\n        Parameters\n        ==========\n        kernel_id : uuid\n            The id of the kernel.", "docstring_tokens": ["Get", "the", "single", "KernelManager", "object", "for", "a", "kernel", "by", "its", "uuid", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256621}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L1122-L1133", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Get all available item fields", "language": "python", "parameters": "(self)", "return_statement": "return self._cache(retrieved, \"item_fields\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "templates", ".", "get", "(", "\"Func\"", ")", "and", "not", "arg_0", ".", "_updated", "(", "\"/itemFields\"", ",", "arg_0", ".", "templates", "[", "\"Func\"", "]", ",", "\"Func\"", ")", ":", "return", "arg_0", ".", "templates", "[", "\"Func\"", "]", "[", "\"tmplt\"", "]", "arg_1", "=", "\"/itemFields\"", "arg_2", "=", "arg_0", ".", "_retrieve_data", "(", "arg_1", ")", "return", "arg_0", ".", "_cache", "(", "arg_2", ",", "\"Func\"", ")"], "function": "def Func(arg_0):\n        \"\"\" Get all available item fields\n        \"\"\"\n        # Check for a valid cached version\n        if arg_0.templates.get(\"Func\") and not arg_0._updated(\n            \"/itemFields\", arg_0.templates[\"Func\"], \"Func\"\n        ):\n            return arg_0.templates[\"Func\"][\"tmplt\"]\n        arg_1 = \"/itemFields\"\n        # otherwise perform a normal request and cache the response\n        arg_2 = arg_0._retrieve_data(arg_1)\n        return arg_0._cache(arg_2, \"Func\")", "path": "pyzotero/zotero.py", "identifier": "Zotero.item_fields", "docstring": "Get all available item fields", "docstring_tokens": ["Get", "all", "available", "item", "fields"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 256622}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/mapping.py#L338-L353", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Styles a node", "language": "python", "parameters": "(self, pydot_node, dot_attrs)", "return_statement": "return pydot_node", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "set_shape", "(", "arg_2", ".", "shape", ")", "arg_1", ".", "set_fixedsize", "(", "str", "(", "arg_2", ".", "fixed_size", ")", ")", "arg_1", ".", "set_width", "(", "str", "(", "arg_2", ".", "width", ")", ")", "arg_1", ".", "set_height", "(", "str", "(", "arg_2", ".", "height", ")", ")", "arg_1", ".", "set_color", "(", "rgba2hex", "(", "arg_2", ".", "color_", ")", ")", "arg_1", ".", "set_fillcolor", "(", "rgba2hex", "(", "arg_2", ".", "fill_color_", ")", ")", "for", "arg_3", "in", "arg_2", ".", "style", ":", "logger", ".", "debug", "(", "\"Setting node style: %s\"", "%", "arg_3", ")", "arg_1", ".", "set_style", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Styles a node \"\"\"\n\n        arg_1.set_shape(arg_2.shape)\n        arg_1.set_fixedsize(str(arg_2.fixed_size))\n        arg_1.set_width(str(arg_2.width))\n        arg_1.set_height(str(arg_2.height))\n        arg_1.set_color(rgba2hex(arg_2.color_))\n        arg_1.set_fillcolor(\n            rgba2hex(arg_2.fill_color_)\n        )\n        for arg_3 in arg_2.style:\n            logger.debug(\"Setting node style: %s\" % arg_3)\n            arg_1.set_style(arg_3)\n\n        return arg_1", "path": "godot/mapping.py", "identifier": "Mapping._style_node", "docstring": "Styles a node", "docstring_tokens": ["Styles", "a", "node"], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 256623}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L134-L159", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the arc cosine of a waveform's dependent variable vector.", "language": "python", "parameters": "(wave)", "return_statement": "return _operation(wave, \"acos\", \"rad\", np.arccos)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "pexdoc", ".", "exh", ".", "addex", "(", "ValueError", ",", "\"Math domain error\"", ",", "bool", "(", "(", "min", "(", "arg_0", ".", "_dep_vector", ")", "<", "-", "1", ")", "or", "(", "max", "(", "arg_0", ".", "_dep_vector", ")", ">", "1", ")", ")", ",", ")", "return", "_operation", "(", "arg_0", ",", "\"Func\"", ",", "\"rad\"", ",", "np", ".", "arccos", ")"], "function": "def Func(arg_0):\n    r\"\"\"\n    Return the arc cosine of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * ValueError (Math domain error)\n\n    .. [[[end]]]\n    \"\"\"\n    pexdoc.exh.addex(\n        ValueError,\n        \"Math domain error\",\n        bool((min(arg_0._dep_vector) < -1) or (max(arg_0._dep_vector) > 1)),\n    )\n    return _operation(arg_0, \"Func\", \"rad\", np.arccos)", "path": "peng/wave_functions.py", "identifier": "acos", "docstring": "r\"\"\"\n    Return the arc cosine of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.acos\n\n    :raises:\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * ValueError (Math domain error)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "arc", "cosine", "of", "a", "waveform", "s", "dependent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 256624}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L233-L267", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Clean fields that depend on each other.", "language": "python", "parameters": "(self)", "return_statement": "return cleaned_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "super", "(", "ManageLearnersForm", ",", "arg_0", ")", ".", "Func", "(", ")", "arg_2", "=", "arg_0", ".", "data", ".", "get", "(", "arg_0", ".", "Fields", ".", "EMAIL_OR_USERNAME", ",", "None", ")", "arg_3", "=", "arg_0", ".", "files", ".", "get", "(", "arg_0", ".", "Fields", ".", "BULK_UPLOAD", ",", "None", ")", "if", "not", "arg_2", "and", "not", "arg_3", ":", "raise", "ValidationError", "(", "ValidationMessages", ".", "NO_FIELDS_SPECIFIED", ")", "if", "arg_2", "and", "arg_3", ":", "raise", "ValidationError", "(", "ValidationMessages", ".", "BOTH_FIELDS_SPECIFIED", ")", "if", "arg_2", ":", "arg_4", "=", "arg_0", ".", "Modes", ".", "MODE_SINGULAR", "else", ":", "arg_4", "=", "arg_0", ".", "Modes", ".", "MODE_BULK", "arg_1", "[", "arg_0", ".", "Fields", ".", "MODE", "]", "=", "arg_4", "arg_1", "[", "arg_0", ".", "Fields", ".", "NOTIFY", "]", "=", "arg_0", ".", "Func_notify", "(", ")", "arg_0", ".", "_validate_course", "(", ")", "arg_0", ".", "_validate_program", "(", ")", "if", "arg_0", ".", "data", ".", "get", "(", "arg_0", ".", "Fields", ".", "PROGRAM", ",", "None", ")", "and", "arg_0", ".", "data", ".", "get", "(", "arg_0", ".", "Fields", ".", "COURSE", ",", "None", ")", ":", "raise", "ValidationError", "(", "ValidationMessages", ".", "COURSE_AND_PROGRAM_ERROR", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Clean fields that depend on each other.\n\n        In this case, the form can be used to link single user or bulk link multiple users. These are mutually\n        exclusive modes, so this method checks that only one field is passed.\n        \"\"\"\n        arg_1 = super(ManageLearnersForm, arg_0).Func()\n\n        # Here we take values from `data` (and not `Funced_data`) as we need raw values - field Func methods\n        # might \"invalidate\" the value and set it to None, while all we care here is if it was provided at all or not\n        arg_2 = arg_0.data.get(arg_0.Fields.EMAIL_OR_USERNAME, None)\n        arg_3 = arg_0.files.get(arg_0.Fields.BULK_UPLOAD, None)\n\n        if not arg_2 and not arg_3:\n            raise ValidationError(ValidationMessages.NO_FIELDS_SPECIFIED)\n\n        if arg_2 and arg_3:\n            raise ValidationError(ValidationMessages.BOTH_FIELDS_SPECIFIED)\n\n        if arg_2:\n            arg_4 = arg_0.Modes.MODE_SINGULAR\n        else:\n            arg_4 = arg_0.Modes.MODE_BULK\n\n        arg_1[arg_0.Fields.MODE] = arg_4\n        arg_1[arg_0.Fields.NOTIFY] = arg_0.Func_notify()\n\n        arg_0._validate_course()\n        arg_0._validate_program()\n\n        if arg_0.data.get(arg_0.Fields.PROGRAM, None) and arg_0.data.get(arg_0.Fields.COURSE, None):\n            raise ValidationError(ValidationMessages.COURSE_AND_PROGRAM_ERROR)\n\n        return arg_1", "path": "enterprise/admin/forms.py", "identifier": "ManageLearnersForm.clean", "docstring": "Clean fields that depend on each other.\n\n        In this case, the form can be used to link single user or bulk link multiple users. These are mutually\n        exclusive modes, so this method checks that only one field is passed.", "docstring_tokens": ["Clean", "fields", "that", "depend", "on", "each", "other", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256625}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog.py#L33-L40", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Sets the telemetry client for logging events.", "language": "python", "parameters": "(self, value: BotTelemetryClient)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "None", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "_Func", "=", "NullTelemetryClient", "(", ")", "else", ":", "arg_0", ".", "_Func", "=", "arg_1"], "function": "def Func(arg_0, arg_1: arg_2) -> None:\n        \"\"\"\n        Sets the telemetry client for logging events.\n        \"\"\"\n        if arg_1 is None:\n            arg_0._Func = NullTelemetryClient()\n        else:\n            arg_0._Func = arg_1", "path": "libraries/botbuilder-dialogs/botbuilder/dialogs/dialog.py", "identifier": "Dialog.telemetry_client", "docstring": "Sets the telemetry client for logging events.", "docstring_tokens": ["Sets", "the", "telemetry", "client", "for", "logging", "events", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 256626}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/metrics/fmeasure.py#L60-L76", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Calculates F1 macro measure.", "language": "python", "parameters": "(y_true, y_predicted)", "return_statement": "return f1_score(np.array(y_true), np.array(predictions), average=\"macro\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "[", "np", ".", "round", "(", "x", ")", "for", "x", "in", "arg_1", "]", "except", "TypeError", ":", "arg_2", "=", "arg_1", "return", "f1_score", "(", "np", ".", "array", "(", "arg_0", ")", ",", "np", ".", "array", "(", "arg_2", ")", ",", "average", "=", "\"macro\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Calculates F1 macro measure.\n\n    Args:\n        y_true: list of true values\n        y_predicted: list of predicted values\n\n    Returns:\n        F1 score\n    \"\"\"\n    try:\n        arg_2 = [np.round(x) for x in arg_1]\n    except TypeError:\n        arg_2 = arg_1\n\n    return f1_score(np.array(arg_0), np.array(arg_2), average=\"macro\")", "path": "deeppavlov/metrics/fmeasure.py", "identifier": "round_f1_macro", "docstring": "Calculates F1 macro measure.\n\n    Args:\n        y_true: list of true values\n        y_predicted: list of predicted values\n\n    Returns:\n        F1 score", "docstring_tokens": ["Calculates", "F1", "macro", "measure", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 256627}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/lang/switch.py#L55-L74", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "Indicate whether or not to enter a case suite.", "language": "python", "parameters": "(self, *args)", "return_statement": "return self.match_args(self._value, args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "not", "arg_1", ":", "raise", "SyntaxError", "(", "'cannot case empty pattern.'", ")", "return", "arg_0", ".", "Func_args", "(", "arg_0", ".", "_value", ",", "arg_1", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Indicate whether or not to enter a case suite.\n\n        usage:\n\n        ``` py\n        for case in switch(value):\n            if case('A'):\n                pass\n            elif case(1, 3):\n                pass # for mulit-Func.\n            else:\n                pass # for default.\n        ```\n        \"\"\"\n        if not arg_1:\n            raise SyntaxError('cannot case empty pattern.')\n\n        return arg_0.Func_args(arg_0._value, arg_1)", "path": "jasily/lang/switch.py", "identifier": "switch.match", "docstring": "Indicate whether or not to enter a case suite.\n\n        usage:\n\n        ``` py\n        for case in switch(value):\n            if case('A'):\n                pass\n            elif case(1, 3):\n                pass # for mulit-match.\n            else:\n                pass # for default.\n        ```", "docstring_tokens": ["Indicate", "whether", "or", "not", "to", "enter", "a", "case", "suite", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 256628}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L162-L170", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "Receives a list of events and transmits them to Riemann", "language": "python", "parameters": "(self, events)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "arg_0", ".", "maxsize", "<", "1", ")", "or", "(", "len", "(", "arg_0", ".", "events", ")", "<", "arg_0", ".", "maxsize", ")", ":", "arg_0", ".", "events", ".", "extend", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Receives a list of events and transmits them to Riemann\n\n        Arguments:\n        events -- list of `tensor.objects.Event`\n        \"\"\"\n        # Make sure queue isn't oversized\n        if (arg_0.maxsize < 1) or (len(arg_0.events) < arg_0.maxsize):\n            arg_0.events.extend(arg_1)", "path": "tensor/outputs/riemann.py", "identifier": "RiemannTCP.eventsReceived", "docstring": "Receives a list of events and transmits them to Riemann\n\n        Arguments:\n        events -- list of `tensor.objects.Event`", "docstring_tokens": ["Receives", "a", "list", "of", "events", "and", "transmits", "them", "to", "Riemann"], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 256629}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/serializers.py#L42-L51", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "For djangorestframework <=2.3.14", "language": "python", "parameters": "(self, value)", "return_statement": "return build_versatileimagefield_url_set(\n            value,\n            self.sizes,\n            request=context_request\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "if", "arg_0", ".", "context", ":", "arg_2", "=", "arg_0", ".", "context", ".", "get", "(", "'request'", ",", "None", ")", "return", "build_versatileimagefield_url_set", "(", "arg_1", ",", "arg_0", ".", "sizes", ",", "request", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"For djangorestframework <=2.3.14\"\"\"\n        arg_2 = None\n        if arg_0.context:\n            arg_2 = arg_0.context.get('request', None)\n        return build_versatileimagefield_url_set(\n            arg_1,\n            arg_0.sizes,\n            request=arg_2\n        )", "path": "versatileimagefield/serializers.py", "identifier": "VersatileImageFieldSerializer.to_native", "docstring": "For djangorestframework <=2.3.14", "docstring_tokens": ["For", "djangorestframework", "<", "=", "2", ".", "3", ".", "14"], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 256630}
{"url": "https://github.com/hiposfer/o2g/blob/1165ba75a5eb64b3091e9b71ebd589507ae1ebf3/o2g/gtfs/gtfs_dummy.py#L14-L39", "sha": "1165ba75a5eb64b3091e9b71ebd589507ae1ebf3", "docstring_summary": "Create `calendar`, `stop_times`, `trips` and `shapes`.", "language": "python", "parameters": "(routes, stops)", "return_statement": "return DummyData(calendar, stop_times, trips, frequencies)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "defaultdict", "(", "lambda", ":", "[", "]", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_1", ":", "if", "not", "arg_4", ".", "route_id", ":", "continue", "arg_2", "[", "arg_4", ".", "route_id", "]", ".", "append", "(", "arg_4", ")", "arg_3", "[", "arg_4", ".", "stop_id", "]", "=", "arg_4", "arg_6", "=", "_create_dummy_calendar", "(", ")", "arg_7", "=", "_create_dummy_trips", "(", "arg_0", ",", "arg_2", ",", "arg_6", ")", "arg_8", "=", "_create_dummy_stoptimes", "(", "arg_7", ",", "arg_2", ")", "arg_9", "=", "_create_dummy_frequencies", "(", "arg_7", ")", "return", "DummyData", "(", "arg_6", ",", "arg_8", ",", "arg_7", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Create `calendar`, `stop_times`, `trips` and `shapes`.\n\n    :return: DummyData namedtuple\n    \"\"\"\n    # Build stops per route auxiliary map\n    arg_2 = defaultdict(lambda: [])\n    arg_3 = {}\n    for arg_4 in arg_1:\n        if not arg_4.route_id:\n            continue\n        arg_2[arg_4.route_id].append(arg_4)\n        arg_3[arg_4.stop_id] = arg_4\n\n    arg_6 = _create_dummy_calendar()\n\n    arg_7 = \\\n        _create_dummy_trips(\n            arg_0,\n            arg_2,\n            arg_6)\n\n    arg_8 = _create_dummy_stoptimes(arg_7, arg_2)\n    arg_9 = _create_dummy_frequencies(arg_7)\n\n    return DummyData(arg_6, arg_8, arg_7, arg_9)", "path": "o2g/gtfs/gtfs_dummy.py", "identifier": "create_dummy_data", "docstring": "Create `calendar`, `stop_times`, `trips` and `shapes`.\n\n    :return: DummyData namedtuple", "docstring_tokens": ["Create", "calendar", "stop_times", "trips", "and", "shapes", "."], "nwo": "hiposfer/o2g", "score": 0.3752106333265808, "idx": 256631}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/recurrent.py#L916-L928", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Return tensor for sequence length, if input is ``tf.string``.", "language": "python", "parameters": "(data, pad_val=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "arg_0", ".", "get_shape", "(", ")", ".", "ndims", "if", "arg_2", "==", "3", ":", "return", "tf", ".", "reduce_sum", "(", "tf", ".", "cast", "(", "tf", ".", "reduce_any", "(", "tf", ".", "not_equal", "(", "arg_0", ",", "arg_1", ")", ",", "axis", "=", "2", ")", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "1", ")", "elif", "arg_2", "==", "2", ":", "return", "tf", ".", "reduce_sum", "(", "tf", ".", "cast", "(", "tf", ".", "not_equal", "(", "arg_0", ",", "arg_1", ")", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "1", ")", "elif", "arg_2", "==", "1", ":", "raise", "ValueError", "(", "\"Func: data has wrong shape!\"", ")", "else", ":", "raise", "ValueError", "(", "\"Func: handling data_shape_size %s hasn't been implemented!\"", "%", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=0):  # HangSheng: return tensor for sequence length, if input is tf.string\n    \"\"\"Return tensor for sequence length, if input is ``tf.string``.\"\"\"\n    arg_2 = arg_0.get_shape().ndims\n    if arg_2 == 3:\n        return tf.reduce_sum(tf.cast(tf.reduce_any(tf.not_equal(arg_0, arg_1), axis=2), dtype=tf.int32), 1)\n    elif arg_2 == 2:\n        return tf.reduce_sum(tf.cast(tf.not_equal(arg_0, arg_1), dtype=tf.int32), 1)\n    elif arg_2 == 1:\n        raise ValueError(\"Func: data has wrong shape!\")\n    else:\n        raise ValueError(\n            \"Func: handling data_shape_size %s hasn't been implemented!\" % (arg_2)\n        )", "path": "tensorlayer/layers/recurrent.py", "identifier": "retrieve_seq_length_op3", "docstring": "Return tensor for sequence length, if input is ``tf.string``.", "docstring_tokens": ["Return", "tensor", "for", "sequence", "length", "if", "input", "is", "tf", ".", "string", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 256632}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/annotate.py#L142-L160", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Specify how the return value of this function should be handled.", "language": "python", "parameters": "(desc=None, printer=None, data=True)", "return_statement": "return _returns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ")", ":", "if", "arg_2", "is", "False", ":", "raise", "ArgumentError", "(", "\"Specifying non data return type in Func is no longer supported\"", ")", "def", "_Func", "(", "arg_3", ")", ":", "annotated", "(", "arg_3", ")", "arg_3", ".", "custom_returnvalue", "(", "arg_1", ",", "arg_0", ")", "return", "arg_3", "return", "_Func"], "function": "def Func(arg_0=None, arg_1=None, arg_2=True):\n    \"\"\"Specify how the return value of this function should be handled.\n\n    Args:\n        desc (str): A deprecated description of the return value\n        printer (callable): A callable function that can format this return value\n        data (bool): A deprecated parameter for specifying that this function\n            Func data.\n    \"\"\"\n\n    if arg_2 is False:\n        raise ArgumentError(\"Specifying non data return type in Func is no longer supported\")\n\n    def _Func(arg_3):\n        annotated(arg_3)\n        arg_3.custom_returnvalue(arg_1, arg_0)\n        return arg_3\n\n    return _Func", "path": "typedargs/annotate.py", "identifier": "returns", "docstring": "Specify how the return value of this function should be handled.\n\n    Args:\n        desc (str): A deprecated description of the return value\n        printer (callable): A callable function that can format this return value\n        data (bool): A deprecated parameter for specifying that this function\n            returns data.", "docstring_tokens": ["Specify", "how", "the", "return", "value", "of", "this", "function", "should", "be", "handled", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 256633}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L166-L179", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "If we fail to parse the version, we assume z3's output has changed, meaning it's a newer\n        version than what's used now, and therefore ok.", "language": "python", "parameters": "(self)", "return_statement": "return Version(*map(int, version.split('.')))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Version", ":", "arg_0", ".", "_reset", "(", ")", "if", "arg_0", ".", "_received_version", "is", "None", ":", "arg_0", ".", "_send", "(", "'(get-info :version)'", ")", "arg_0", ".", "_received_version", "=", "arg_0", ".", "_recv", "(", ")", "arg_2", ",", "arg_3", "=", "shlex", ".", "split", "(", "arg_0", ".", "_received_version", "[", "1", ":", "-", "1", "]", ")", "return", "Version", "(", "*", "map", "(", "int", ",", "arg_3", ".", "split", "(", "'.'", ")", ")", ")"], "function": "def Func(arg_0) -> Version:\n        \"\"\"\n        If we fail to parse the version, we assume z3's output has changed, meaning it's a newer\n        version than what's used now, and therefore ok.\n\n        Anticipated version_cmd_output format: 'Z3 version 4.4.2'\n                                               'Z3 version 4.4.5 - 64 bit - build hashcode $Z3GITHASH'\n        \"\"\"\n        arg_0._reset()\n        if arg_0._received_version is None:\n            arg_0._send('(get-info :version)')\n            arg_0._received_version = arg_0._recv()\n        arg_2, arg_3 = shlex.split(arg_0._received_version[1:-1])\n        return Version(*map(int, arg_3.split('.')))", "path": "manticore/core/smtlib/solver.py", "identifier": "Z3Solver._solver_version", "docstring": "If we fail to parse the version, we assume z3's output has changed, meaning it's a newer\n        version than what's used now, and therefore ok.\n\n        Anticipated version_cmd_output format: 'Z3 version 4.4.2'\n                                               'Z3 version 4.4.5 - 64 bit - build hashcode $Z3GITHASH'", "docstring_tokens": ["If", "we", "fail", "to", "parse", "the", "version", "we", "assume", "z3", "s", "output", "has", "changed", "meaning", "it", "s", "a", "newer", "version", "than", "what", "s", "used", "now", "and", "therefore", "ok", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256634}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/aggregations.py#L310-L328", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "List the aggregation's bookmarks.", "language": "python", "parameters": "(self, start_date=None, end_date=None, limit=None)", "return_statement": "return query[0:limit].execute() if limit else query.scan()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "Search", "(", "using", "=", "arg_0", ".", "client", ",", "index", "=", "arg_0", ".", "aggregation_alias", ",", "doc_type", "=", "arg_0", ".", "bookmark_doc_type", ")", ".", "sort", "(", "{", "'date'", ":", "{", "'order'", ":", "'desc'", "}", "}", ")", "arg_5", "=", "{", "}", "if", "arg_1", ":", "arg_5", "[", "'gte'", "]", "=", "arg_0", ".", "_format_range_dt", "(", "arg_1", ".", "replace", "(", "microsecond", "=", "0", ")", ")", "if", "arg_2", ":", "arg_5", "[", "'lte'", "]", "=", "arg_0", ".", "_format_range_dt", "(", "arg_2", ".", "replace", "(", "microsecond", "=", "0", ")", ")", "if", "arg_5", ":", "arg_4", "=", "arg_4", ".", "filter", "(", "'range'", ",", "date", "=", "arg_5", ")", "return", "arg_4", "[", "0", ":", "arg_3", "]", ".", "execute", "(", ")", "if", "arg_3", "else", "arg_4", ".", "scan", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"List the aggregation's bookmarks.\"\"\"\n        arg_4 = Search(\n            using=arg_0.client,\n            index=arg_0.aggregation_alias,\n            doc_type=arg_0.bookmark_doc_type\n        ).sort({'date': {'order': 'desc'}})\n\n        arg_5 = {}\n        if arg_1:\n            arg_5['gte'] = arg_0._format_range_dt(\n                arg_1.replace(microsecond=0))\n        if arg_2:\n            arg_5['lte'] = arg_0._format_range_dt(\n                arg_2.replace(microsecond=0))\n        if arg_5:\n            arg_4 = arg_4.filter('range', date=arg_5)\n\n        return arg_4[0:arg_3].execute() if arg_3 else arg_4.scan()", "path": "invenio_stats/aggregations.py", "identifier": "StatAggregator.list_bookmarks", "docstring": "List the aggregation's bookmarks.", "docstring_tokens": ["List", "the", "aggregation", "s", "bookmarks", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 256635}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L235-L246", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Convert next and previous from URLs to integers", "language": "python", "parameters": "(self, kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "(", "'next'", ",", "'previous'", ")", ":", "if", "not", "arg_1", ".", "get", "(", "arg_2", ")", ":", "continue", "arg_3", "=", "re", ".", "search", "(", "r'page=(?P<num>[\\d]+)'", ",", "arg_1", "[", "arg_2", "]", ")", "if", "arg_3", "is", "None", "and", "arg_2", "==", "'previous'", ":", "arg_1", "[", "arg_2", "]", "=", "1", "continue", "arg_1", "[", "arg_2", "]", "=", "int", "(", "arg_3", ".", "groupdict", "(", ")", "[", "'num'", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert next and previous from URLs to integers\n        \"\"\"\n        for arg_2 in ('next', 'previous'):\n            if not arg_1.get(arg_2):\n                continue\n            arg_3 = re.search(r'page=(?P<num>[\\d]+)', arg_1[arg_2])\n            if arg_3 is None and arg_2 == 'previous':\n                arg_1[arg_2] = 1\n                continue\n            arg_1[arg_2] = int(arg_3.groupdict()['num'])", "path": "tower_cli/models/base.py", "identifier": "BaseResource._convert_pagenum", "docstring": "Convert next and previous from URLs to integers", "docstring_tokens": ["Convert", "next", "and", "previous", "from", "URLs", "to", "integers"], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 256636}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/transforms/geometry.py#L86-L109", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Scaling bboxes w.r.t the box center.", "language": "python", "parameters": "(bboxes, scale, clip_shape=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "float", "(", "arg_1", ")", "==", "1.0", ":", "arg_3", "=", "arg_0", ".", "copy", "(", ")", "else", ":", "arg_4", "=", "arg_0", "[", "...", ",", "2", "]", "-", "arg_0", "[", "...", ",", "0", "]", "+", "1", "arg_5", "=", "arg_0", "[", "...", ",", "3", "]", "-", "arg_0", "[", "...", ",", "1", "]", "+", "1", "arg_6", "=", "(", "arg_4", "*", "(", "arg_1", "-", "1", ")", ")", "*", "0.5", "arg_7", "=", "(", "arg_5", "*", "(", "arg_1", "-", "1", ")", ")", "*", "0.5", "arg_3", "=", "arg_0", "+", "np", ".", "stack", "(", "(", "-", "arg_6", ",", "-", "arg_7", ",", "arg_6", ",", "arg_7", ")", ",", "axis", "=", "-", "1", ")", "if", "arg_2", "is", "not", "None", ":", "return", "bbox_clip", "(", "arg_3", ",", "arg_2", ")", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Scaling bboxes w.r.t the box center.\n\n    Args:\n        bboxes (ndarray): Shape(..., 4).\n        scale (float): Scaling factor.\n        clip_shape (tuple, optional): If specified, bboxes that exceed the\n            boundary will be clipped according to the given shape (h, w).\n\n    Returns:\n        ndarray: Scaled bboxes.\n    \"\"\"\n    if float(arg_1) == 1.0:\n        arg_3 = arg_0.copy()\n    else:\n        arg_4 = arg_0[..., 2] - arg_0[..., 0] + 1\n        arg_5 = arg_0[..., 3] - arg_0[..., 1] + 1\n        arg_6 = (arg_4 * (arg_1 - 1)) * 0.5\n        arg_7 = (arg_5 * (arg_1 - 1)) * 0.5\n        arg_3 = arg_0 + np.stack((-arg_6, -arg_7, arg_6, arg_7), axis=-1)\n    if arg_2 is not None:\n        return bbox_clip(arg_3, arg_2)\n    else:\n        return arg_3", "path": "mmcv/image/transforms/geometry.py", "identifier": "bbox_scaling", "docstring": "Scaling bboxes w.r.t the box center.\n\n    Args:\n        bboxes (ndarray): Shape(..., 4).\n        scale (float): Scaling factor.\n        clip_shape (tuple, optional): If specified, bboxes that exceed the\n            boundary will be clipped according to the given shape (h, w).\n\n    Returns:\n        ndarray: Scaled bboxes.", "docstring_tokens": ["Scaling", "bboxes", "w", ".", "r", ".", "t", "the", "box", "center", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 256637}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L321-L414", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Get complete trip data for visualizing public transport operation based on gtfs.", "language": "python", "parameters": "(self, start, end, use_shapes=True, filter_name=None)", "return_statement": "return {\"trips\": trips}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "[", "]", "arg_6", "=", "arg_0", ".", "get_tripIs_active_in_range", "(", "arg_1", ",", "arg_2", ")", "print", "(", "\"gtfs_viz.py: fetched \"", "+", "str", "(", "len", "(", "arg_6", ")", ")", "+", "\" trip ids\"", ")", "arg_7", "=", "{", "}", "for", "arg_8", "in", "arg_6", ".", "itertuples", "(", ")", ":", "arg_9", "=", "arg_8", ".", "trip_I", "arg_10", "=", "arg_8", ".", "day_start_ut", "arg_11", "=", "arg_8", ".", "shape_id", "arg_12", "=", "{", "}", "arg_13", ",", "arg_14", "=", "arg_0", ".", "get_route_name_and_type_of_tripI", "(", "arg_9", ")", "arg_12", "[", "'route_type'", "]", "=", "int", "(", "arg_14", ")", "arg_12", "[", "'name'", "]", "=", "str", "(", "arg_13", ")", "if", "arg_4", "and", "(", "arg_13", "!=", "arg_4", ")", ":", "continue", "arg_15", "=", "[", "]", "arg_16", "=", "[", "]", "arg_17", "=", "[", "]", "arg_18", "=", "[", "]", "arg_19", "=", "[", "]", "arg_20", "=", "arg_0", ".", "get_trip_stop_time_data", "(", "arg_9", ",", "arg_10", ")", "for", "arg_21", "in", "arg_20", ".", "itertuples", "(", ")", ":", "arg_15", ".", "append", "(", "float", "(", "arg_21", ".", "lat", ")", ")", "arg_16", ".", "append", "(", "float", "(", "arg_21", ".", "lon", ")", ")", "arg_17", ".", "append", "(", "float", "(", "arg_21", ".", "dep_time_ut", ")", ")", "try", ":", "arg_19", ".", "append", "(", "int", "(", "arg_21", ".", "seq", ")", ")", "except", "TypeError", ":", "arg_19", ".", "append", "(", "None", ")", "if", "arg_3", ":", "try", ":", "arg_18", ".", "append", "(", "int", "(", "arg_21", ".", "shape_break", ")", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "arg_18", ".", "append", "(", "None", ")", "if", "arg_3", ":", "if", "arg_11", "not", "in", "arg_7", ":", "arg_7", "[", "arg_11", "]", "=", "shapes", ".", "get_shape_points2", "(", "arg_0", ".", "conn", ".", "cursor", "(", ")", ",", "arg_11", ")", "arg_22", "=", "arg_7", "[", "arg_11", "]", "try", ":", "arg_12", "[", "'times'", "]", "=", "shapes", ".", "interpolate_shape_times", "(", "arg_22", "[", "'d'", "]", ",", "arg_18", ",", "arg_17", ")", "arg_12", "[", "'lats'", "]", "=", "arg_22", "[", "'lats'", "]", "arg_12", "[", "'lons'", "]", "=", "arg_22", "[", "'lons'", "]", "arg_23", "=", "arg_18", "[", "0", "]", "arg_24", "=", "arg_18", "[", "-", "1", "]", "arg_12", "[", "'times'", "]", "=", "arg_12", "[", "'times'", "]", "[", "arg_23", ":", "arg_24", "+", "1", "]", "arg_12", "[", "'lats'", "]", "=", "arg_12", "[", "'lats'", "]", "[", "arg_23", ":", "arg_24", "+", "1", "]", "arg_12", "[", "'lons'", "]", "=", "arg_12", "[", "'lons'", "]", "[", "arg_23", ":", "arg_24", "+", "1", "]", "except", ":", "arg_12", "[", "'times'", "]", "=", "arg_17", "arg_12", "[", "'lats'", "]", "=", "arg_15", "arg_12", "[", "'lons'", "]", "=", "arg_16", "else", ":", "arg_12", "[", "'times'", "]", "=", "arg_17", "arg_12", "[", "'lats'", "]", "=", "arg_15", "arg_12", "[", "'lons'", "]", "=", "arg_16", "arg_5", ".", "append", "(", "arg_12", ")", "return", "{", "\"trips\"", ":", "arg_5", "}"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True, arg_4=None):\n        \"\"\"\n        Get complete trip data for visualizing public transport operation based on gtfs.\n\n        Parameters\n        ----------\n        start: number\n            Earliest position data to return (in unix time)\n        end: number\n            Latest position data to return (in unix time)\n        use_shapes: bool, optional\n            Whether or not shapes should be included\n        filter_name: str\n            Pick only routes having this name.\n\n        Returns\n        -------\n        trips: dict\n            trips['trips'] is a list whose each element (e.g. el = trips['trips'][0])\n            is a dict with the following properties:\n                el['lats'] -- list of latitudes\n                el['lons'] -- list of longitudes\n                el['times'] -- list of passage_times\n                el['route_type'] -- type of vehicle as specified by GTFS\n                el['name'] -- name of the route\n        \"\"\"\n        arg_5 = []\n        arg_6 = arg_0.get_tripIs_active_in_range(arg_1, arg_2)\n        print(\"gtfs_viz.py: fetched \" + str(len(arg_6)) + \" trip ids\")\n        arg_7 = {}\n\n        # loop over all trips:\n        for arg_8 in arg_6.itertuples():\n            arg_9 = arg_8.trip_I\n            arg_10 = arg_8.day_start_ut\n            arg_11 = arg_8.shape_id\n\n            arg_12 = {}\n\n            arg_13, arg_14 = arg_0.get_route_name_and_type_of_tripI(arg_9)\n            arg_12['route_type'] = int(arg_14)\n            arg_12['name'] = str(arg_13)\n\n            if arg_4 and (arg_13 != arg_4):\n                continue\n\n            arg_15 = []\n            arg_16 = []\n            arg_17 = []\n            arg_18 = []\n            arg_19 = []\n\n            # get stop_data and store it:\n            arg_20 = arg_0.get_trip_stop_time_data(arg_9, arg_10)\n            for arg_21 in arg_20.itertuples():\n                arg_15.append(float(arg_21.lat))\n                arg_16.append(float(arg_21.lon))\n                arg_17.append(float(arg_21.dep_time_ut))\n                try:\n                    arg_19.append(int(arg_21.seq))\n                except TypeError:\n                    arg_19.append(None)\n                if arg_3:\n                    try:\n                        arg_18.append(int(arg_21.shape_break))\n                    except (TypeError, ValueError):\n                        arg_18.append(None)\n\n            if arg_3:\n                # get shape data (from cache, if possible)\n                if arg_11 not in arg_7:\n                    arg_7[arg_11] = shapes.get_shape_points2(arg_0.conn.cursor(), arg_11)\n                arg_22 = arg_7[arg_11]\n                # noinspection PyBroadException\n                try:\n                    arg_12['times'] = shapes.interpolate_shape_times(arg_22['d'], arg_18, arg_17)\n                    arg_12['lats'] = arg_22['lats']\n                    arg_12['lons'] = arg_22['lons']\n                    arg_23 = arg_18[0]\n                    arg_24 = arg_18[-1]\n                    arg_12['times'] = arg_12['times'][arg_23:arg_24 + 1]\n                    arg_12['lats'] = arg_12['lats'][arg_23:arg_24 + 1]\n                    arg_12['lons'] = arg_12['lons'][arg_23:arg_24 + 1]\n                except:\n                    # In case interpolation fails:\n                    arg_12['times'] = arg_17\n                    arg_12['lats'] = arg_15\n                    arg_12['lons'] = arg_16\n            else:\n                arg_12['times'] = arg_17\n                arg_12['lats'] = arg_15\n                arg_12['lons'] = arg_16\n            arg_5.append(arg_12)\n        return {\"trips\": arg_5}", "path": "gtfspy/gtfs.py", "identifier": "GTFS.get_trip_trajectories_within_timespan", "docstring": "Get complete trip data for visualizing public transport operation based on gtfs.\n\n        Parameters\n        ----------\n        start: number\n            Earliest position data to return (in unix time)\n        end: number\n            Latest position data to return (in unix time)\n        use_shapes: bool, optional\n            Whether or not shapes should be included\n        filter_name: str\n            Pick only routes having this name.\n\n        Returns\n        -------\n        trips: dict\n            trips['trips'] is a list whose each element (e.g. el = trips['trips'][0])\n            is a dict with the following properties:\n                el['lats'] -- list of latitudes\n                el['lons'] -- list of longitudes\n                el['times'] -- list of passage_times\n                el['route_type'] -- type of vehicle as specified by GTFS\n                el['name'] -- name of the route", "docstring_tokens": ["Get", "complete", "trip", "data", "for", "visualizing", "public", "transport", "operation", "based", "on", "gtfs", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 256638}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/baseapp.py#L202-L218", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Create a .pid file in the pid_dir with my pid.", "language": "python", "parameters": "(self, overwrite=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "profile_dir", ".", "pid_dir", ",", "arg_0", ".", "name", "+", "u'.pid'", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_pid_from_file", "(", ")", "if", "not", "arg_1", ":", "raise", "PIDFileError", "(", "'The pid file [%s] already exists. \\nThis could mean that this '", "'server is already running with [pid=%s].'", "%", "(", "arg_2", ",", "arg_3", ")", ")", "with", "open", "(", "arg_2", ",", "'w'", ")", "as", "f", ":", "arg_0", ".", "log", ".", "info", "(", "\"Creating pid file: %s\"", "%", "arg_2", ")", "f", ".", "write", "(", "repr", "(", "os", ".", "getpid", "(", ")", ")", "+", "'\\n'", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Create a .pid file in the pid_dir with my pid.\n\n        This must be called after pre_construct, which sets `self.pid_dir`.\n        This raises :exc:`PIDFileError` if the pid file exists already.\n        \"\"\"\n        arg_2 = os.path.join(arg_0.profile_dir.pid_dir, arg_0.name + u'.pid')\n        if os.path.isfile(arg_2):\n            arg_3 = arg_0.get_pid_from_file()\n            if not arg_1:\n                raise PIDFileError(\n                    'The pid file [%s] already exists. \\nThis could mean that this '\n                    'server is already running with [pid=%s].' % (arg_2, arg_3)\n                )\n        with open(arg_2, 'w') as f:\n            arg_0.log.info(\"Creating pid file: %s\" % arg_2)\n            f.write(repr(os.getpid())+'\\n')", "path": "environment/lib/python2.7/site-packages/IPython/parallel/apps/baseapp.py", "identifier": "BaseParallelApplication.write_pid_file", "docstring": "Create a .pid file in the pid_dir with my pid.\n\n        This must be called after pre_construct, which sets `self.pid_dir`.\n        This raises :exc:`PIDFileError` if the pid file exists already.", "docstring_tokens": ["Create", "a", ".", "pid", "file", "in", "the", "pid_dir", "with", "my", "pid", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256639}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/code_heatmap.py#L68-L83", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Filters code from standard library from self.lines.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "inspect", ".", "getabsfile", "(", "inspect", ".", "currentframe", "(", ")", ")", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "lines", ":", "arg_6", "=", "os", ".", "path", ".", "abspath", "(", "arg_3", ")", "if", "not", "arg_1", ":", "arg_1", "=", "[", "arg_6", ",", "arg_4", ",", "arg_5", "]", "else", ":", "if", "(", "not", "check_standard_dir", "(", "arg_3", ")", "and", "arg_6", "!=", "arg_2", ")", ":", "yield", "arg_1", "arg_1", "=", "[", "arg_6", ",", "arg_4", ",", "arg_5", "]", "else", ":", "arg_1", "[", "2", "]", "+=", "arg_5", "yield", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Filters code from standard library from self.lines.\"\"\"\n        arg_1 = None\n        arg_2 = inspect.getabsfile(inspect.currentframe())\n        for arg_3, arg_4, arg_5 in arg_0.lines:\n            arg_6 = os.path.abspath(arg_3)\n            if not arg_1:\n                arg_1 = [arg_6, arg_4, arg_5]\n            else:\n                if (not check_standard_dir(arg_3) and\n                        arg_6 != arg_2):\n                    yield arg_1\n                    arg_1 = [arg_6, arg_4, arg_5]\n                else:\n                    arg_1[2] += arg_5\n        yield arg_1", "path": "vprof/code_heatmap.py", "identifier": "_CodeHeatmapCalculator.lines_without_stdlib", "docstring": "Filters code from standard library from self.lines.", "docstring_tokens": ["Filters", "code", "from", "standard", "library", "from", "self", ".", "lines", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 256640}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/util/lens_util.py#L160-L167", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "For a deflection stack, comput a new grid stack but subtracting the deflections", "language": "python", "parameters": "(grid_stack, deflection_stack)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "not", "None", ":", "def", "minus", "(", "arg_2", ",", "arg_3", ")", ":", "return", "arg_2", "-", "arg_3", "return", "arg_0", ".", "map_function", "(", "minus", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"For a deflection stack, comput a new grid stack but subtracting the deflections\"\"\"\n\n    if arg_1 is not None:\n        def minus(arg_2, arg_3):\n            return arg_2 - arg_3\n\n        return arg_0.map_function(minus, arg_1)", "path": "autolens/lens/util/lens_util.py", "identifier": "grid_stack_from_deflection_stack", "docstring": "For a deflection stack, comput a new grid stack but subtracting the deflections", "docstring_tokens": ["For", "a", "deflection", "stack", "comput", "a", "new", "grid", "stack", "but", "subtracting", "the", "deflections"], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 256641}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasm.py#L41-L49", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Parse the data.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_filename", ":", "with", "open", "(", "arg_0", ".", "_filename", ")", "as", "ifile", ":", "arg_0", ".", "_data", "=", "ifile", ".", "read", "(", ")", "with", "QasmParser", "(", "arg_0", ".", "_filename", ")", "as", "qasm_p", ":", "qasm_p", ".", "Func_debug", "(", "False", ")", "return", "qasm_p", ".", "Func", "(", "arg_0", ".", "_data", ")"], "function": "def Func(arg_0):\n        \"\"\"Parse the data.\"\"\"\n        if arg_0._filename:\n            with open(arg_0._filename) as ifile:\n                arg_0._data = ifile.read()\n\n        with QasmParser(arg_0._filename) as qasm_p:\n            qasm_p.Func_debug(False)\n            return qasm_p.Func(arg_0._data)", "path": "qiskit/qasm/qasm.py", "identifier": "Qasm.parse", "docstring": "Parse the data.", "docstring_tokens": ["Parse", "the", "data", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256642}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L2093-L2170", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Create a Flow from a clientsecrets file.", "language": "python", "parameters": "(filename, scope, redirect_uri=None,\n                            message=None, cache=None, login_hint=None,\n                            device_uri=None, pkce=None, code_verifier=None,\n                            prompt=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ")", ":", "try", ":", "arg_10", ",", "arg_11", "=", "clientsecrets", ".", "loadfile", "(", "arg_0", ",", "arg_4", "=", "arg_4", ")", "if", "arg_10", "in", "(", "clientsecrets", ".", "TYPE_WEB", ",", "clientsecrets", ".", "TYPE_INSTALLED", ")", ":", "arg_12", "=", "{", "'redirect_uri'", ":", "arg_2", ",", "'auth_uri'", ":", "arg_11", "[", "'auth_uri'", "]", ",", "'token_uri'", ":", "arg_11", "[", "'token_uri'", "]", ",", "'login_hint'", ":", "arg_5", ",", "}", "arg_13", "=", "arg_11", ".", "get", "(", "'revoke_uri'", ")", "arg_14", "=", "(", "'revoke_uri'", ",", "'device_uri'", ",", "'pkce'", ",", "'code_verifier'", ",", "'prompt'", ")", "for", "arg_15", "in", "arg_14", ":", "if", "locals", "(", ")", "[", "arg_15", "]", "is", "not", "None", ":", "arg_12", "[", "arg_15", "]", "=", "locals", "(", ")", "[", "arg_15", "]", "return", "OAuth2WebServerFlow", "(", "arg_11", "[", "'client_id'", "]", ",", "arg_11", "[", "'client_secret'", "]", ",", "arg_1", ",", "**", "arg_12", ")", "except", "clientsecrets", ".", "InvalidClientSecretsError", "as", "e", ":", "if", "arg_3", "is", "not", "None", ":", "if", "e", ".", "args", ":", "arg_3", "=", "(", "'The client secrets were invalid: '", "'\\n{0}\\n{1}'", ".", "format", "(", "e", ",", "arg_3", ")", ")", "sys", ".", "exit", "(", "arg_3", ")", "else", ":", "raise", "else", ":", "raise", "UnknownClientSecretsFlowError", "(", "'This OAuth 2.0 flow is unsupported: {0!r}'", ".", "format", "(", "arg_10", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                            arg_3=None, arg_4=None, arg_5=None,\n                            arg_6=None, arg_7=None, arg_8=None,\n                            arg_9=None):\n    \"\"\"Create a Flow from a clientsecrets file.\n\n    Will create the right kind of Flow based on the contents of the\n    clientsecrets file or will raise InvalidClientSecretsError for unknown\n    types of Flows.\n\n    Args:\n        filename: string, File name of client secrets.\n        scope: string or iterable of strings, scope(s) to request.\n        redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for\n                      a non-web-based application, or a URI that handles the\n                      callback from the authorization server.\n        message: string, A friendly string to display to the user if the\n                 clientsecrets file is missing or invalid. If message is\n                 provided then sys.exit will be called in the case of an error.\n                 If message in not provided then\n                 clientsecrets.InvalidClientSecretsError will be raised.\n        cache: An optional cache service client that implements get() and set()\n               methods. See clientsecrets.loadfile() for details.\n        login_hint: string, Either an email address or domain. Passing this\n                    hint will either pre-fill the email box on the sign-in form\n                    or select the proper multi-login session, thereby\n                    simplifying the login flow.\n        device_uri: string, URI for device authorization endpoint. For\n                    convenience defaults to Google's endpoints but any\n                    OAuth 2.0 provider can be used.\n\n    Returns:\n        A Flow object.\n\n    Raises:\n        UnknownClientSecretsFlowError: if the file describes an unknown kind of\n                                       Flow.\n        clientsecrets.InvalidClientSecretsError: if the clientsecrets file is\n                                                 invalid.\n    \"\"\"\n    try:\n        arg_10, arg_11 = clientsecrets.loadfile(arg_0,\n                                                          arg_4=arg_4)\n        if arg_10 in (clientsecrets.TYPE_WEB,\n                           clientsecrets.TYPE_INSTALLED):\n            arg_12 = {\n                'redirect_uri': arg_2,\n                'auth_uri': arg_11['auth_uri'],\n                'token_uri': arg_11['token_uri'],\n                'login_hint': arg_5,\n            }\n            arg_13 = arg_11.get('revoke_uri')\n            arg_14 = (\n                'revoke_uri',\n                'device_uri',\n                'pkce',\n                'code_verifier',\n                'prompt'\n            )\n            for arg_15 in arg_14:\n                if locals()[arg_15] is not None:\n                    arg_12[arg_15] = locals()[arg_15]\n\n            return OAuth2WebServerFlow(\n                arg_11['client_id'], arg_11['client_secret'],\n                arg_1, **arg_12)\n\n    except clientsecrets.InvalidClientSecretsError as e:\n        if arg_3 is not None:\n            if e.args:\n                arg_3 = ('The client secrets were invalid: '\n                           '\\n{0}\\n{1}'.format(e, arg_3))\n            sys.exit(arg_3)\n        else:\n            raise\n    else:\n        raise UnknownClientSecretsFlowError(\n            'This OAuth 2.0 flow is unsupported: {0!r}'.format(arg_10))", "path": "oauth2client/client.py", "identifier": "flow_from_clientsecrets", "docstring": "Create a Flow from a clientsecrets file.\n\n    Will create the right kind of Flow based on the contents of the\n    clientsecrets file or will raise InvalidClientSecretsError for unknown\n    types of Flows.\n\n    Args:\n        filename: string, File name of client secrets.\n        scope: string or iterable of strings, scope(s) to request.\n        redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for\n                      a non-web-based application, or a URI that handles the\n                      callback from the authorization server.\n        message: string, A friendly string to display to the user if the\n                 clientsecrets file is missing or invalid. If message is\n                 provided then sys.exit will be called in the case of an error.\n                 If message in not provided then\n                 clientsecrets.InvalidClientSecretsError will be raised.\n        cache: An optional cache service client that implements get() and set()\n               methods. See clientsecrets.loadfile() for details.\n        login_hint: string, Either an email address or domain. Passing this\n                    hint will either pre-fill the email box on the sign-in form\n                    or select the proper multi-login session, thereby\n                    simplifying the login flow.\n        device_uri: string, URI for device authorization endpoint. For\n                    convenience defaults to Google's endpoints but any\n                    OAuth 2.0 provider can be used.\n\n    Returns:\n        A Flow object.\n\n    Raises:\n        UnknownClientSecretsFlowError: if the file describes an unknown kind of\n                                       Flow.\n        clientsecrets.InvalidClientSecretsError: if the clientsecrets file is\n                                                 invalid.", "docstring_tokens": ["Create", "a", "Flow", "from", "a", "clientsecrets", "file", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 256643}
{"url": "https://github.com/abau171/highfive/blob/07b3829331072035ab100d1d66deca3e8f3f372a/highfive/jobs.py#L423-L434", "sha": "07b3829331072035ab100d1d66deca3e8f3f372a", "docstring_summary": "Adds the result of a job to the results list of the job's source job\n        set.", "language": "python", "parameters": "(self, job, result)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "_closed", ":", "return", "arg_3", "=", "arg_0", ".", "_job_sources", "[", "arg_1", "]", "del", "arg_0", ".", "_job_sources", "[", "arg_1", "]", "arg_3", ".", "Func", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Adds the result of a job to the results list of the job's source job\n        set.\n        \"\"\"\n\n        if arg_0._closed:\n            return\n\n        arg_3 = arg_0._job_sources[arg_1]\n        del arg_0._job_sources[arg_1]\n        arg_3.Func(arg_2)", "path": "highfive/jobs.py", "identifier": "JobManager.add_result", "docstring": "Adds the result of a job to the results list of the job's source job\n        set.", "docstring_tokens": ["Adds", "the", "result", "of", "a", "job", "to", "the", "results", "list", "of", "the", "job", "s", "source", "job", "set", "."], "nwo": "abau171/highfive", "score": 0.14991498758945482, "idx": 256644}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/core/intervals.py#L115-L141", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Time intervals between market", "language": "python", "parameters": "(self, session, after_open, before_close)", "return_statement": "return Session(s_time, e_time)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "->", "Session", ":", "arg_4", "=", "logs", ".", "get_logger", "(", "arg_0", ".", "Func", ")", "if", "arg_1", "not", "in", "arg_0", ".", "exch", ":", "return", "SessNA", "arg_5", "=", "arg_0", ".", "exch", "[", "arg_1", "]", "arg_6", "=", "shift_time", "(", "arg_5", "[", "0", "]", ",", "int", "(", "arg_2", ")", "+", "1", ")", "arg_7", "=", "shift_time", "(", "arg_5", "[", "-", "1", "]", ",", "-", "int", "(", "arg_3", ")", ")", "arg_8", "=", "pd", ".", "Timestamp", "(", "arg_6", ")", ">=", "pd", ".", "Timestamp", "(", "arg_7", ")", "arg_9", "=", "pd", ".", "Timestamp", "(", "arg_5", "[", "0", "]", ")", ">=", "pd", ".", "Timestamp", "(", "arg_5", "[", "1", "]", ")", "if", "arg_8", "and", "(", "not", "arg_9", ")", ":", "arg_4", ".", "warning", "(", "f'end time {e_time} is earlier than {s_time} ...'", ")", "return", "SessNA", "return", "Session", "(", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3) -> Session:\n        \"\"\"\n        Time intervals between market\n\n        Args:\n            session: [allday, day, am, pm, night]\n            after_open: mins after open\n            before_close: mins before close\n\n        Returns:\n            Session of start_time and end_time\n        \"\"\"\n        arg_4 = logs.get_logger(arg_0.Func)\n\n        if arg_1 not in arg_0.exch: return SessNA\n        arg_5 = arg_0.exch[arg_1]\n\n        arg_6 = shift_time(arg_5[0], int(arg_2) + 1)\n        arg_7 = shift_time(arg_5[-1], -int(arg_3))\n\n        arg_8 = pd.Timestamp(arg_6) >= pd.Timestamp(arg_7)\n        arg_9 = pd.Timestamp(arg_5[0]) >= pd.Timestamp(arg_5[1])\n        if arg_8 and (not arg_9):\n            arg_4.warning(f'end time {e_time} is earlier than {s_time} ...')\n            return SessNA\n\n        return Session(arg_6, arg_7)", "path": "xbbg/core/intervals.py", "identifier": "Intervals.market_normal", "docstring": "Time intervals between market\n\n        Args:\n            session: [allday, day, am, pm, night]\n            after_open: mins after open\n            before_close: mins before close\n\n        Returns:\n            Session of start_time and end_time", "docstring_tokens": ["Time", "intervals", "between", "market"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 256645}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L194-L200", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Frequency response plot", "language": "python", "parameters": "(self, mode= 'dB', fs = 8000, ylim = [-100,2])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'dB'", ",", "arg_2", "=", "8000", ",", "arg_3", "=", "[", "-", "100", ",", "2", "]", ")", ":", "iir_d", ".", "freqz_resp_cas_list", "(", "[", "arg_0", ".", "sos", "]", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "pylab", ".", "grid", "(", ")", "pylab", ".", "ylim", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1= 'dB', arg_2 = 8000, arg_3 = [-100,2]):\n        \"\"\"\n        Frequency response plot\n        \"\"\"\n        iir_d.freqz_resp_cas_list([arg_0.sos],arg_1,arg_2=arg_2)\n        pylab.grid()\n        pylab.ylim(arg_3)", "path": "sk_dsp_comm/multirate_helper.py", "identifier": "multirate_IIR.freq_resp", "docstring": "Frequency response plot", "docstring_tokens": ["Frequency", "response", "plot"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 256646}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/stability.py#L147-L157", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get a set of triples representing the 3-cycles from a directional graph.", "language": "python", "parameters": "(graph: DiGraph)", "return_statement": "return {\n        tuple(sorted([a, b, c], key=str))\n        for a, b in graph.edges()\n        for c in graph.successors(b)\n        if graph.has_edge(c, a)\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "SetOfNodeTriples", ":", "return", "{", "tuple", "(", "sorted", "(", "[", "arg_2", ",", "arg_3", ",", "arg_4", "]", ",", "key", "=", "str", ")", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "edges", "(", ")", "for", "arg_4", "in", "arg_0", ".", "successors", "(", "arg_3", ")", "if", "arg_0", ".", "has_edge", "(", "arg_4", ",", "arg_2", ")", "}"], "function": "def Func(arg_0: arg_1) -> SetOfNodeTriples:\n    \"\"\"Get a set of triples representing the 3-cycles from a directional graph.\n\n    Each 3-cycle is returned once, with nodes in sorted order.\n    \"\"\"\n    return {\n        tuple(sorted([arg_2, arg_3, arg_4], key=str))\n        for arg_2, arg_3 in arg_0.edges()\n        for arg_4 in arg_0.successors(arg_3)\n        if arg_0.has_edge(arg_4, arg_2)\n    }", "path": "src/pybel_tools/analysis/stability.py", "identifier": "get_triangles", "docstring": "Get a set of triples representing the 3-cycles from a directional graph.\n\n    Each 3-cycle is returned once, with nodes in sorted order.", "docstring_tokens": ["Get", "a", "set", "of", "triples", "representing", "the", "3", "-", "cycles", "from", "a", "directional", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256647}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/pg_model.py#L254-L283", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Returns the baseline optimizer arguments including the time, the list of variables to  \n        optimize, and various functions which the optimizer might require to perform an update  \n        step.", "language": "python", "parameters": "(self, states, internals, reward)", "return_statement": "return arguments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "dict", "(", "time", "=", "arg_0", ".", "global_timestep", ",", "variables", "=", "arg_0", ".", "baseline", ".", "get_variables", "(", ")", ",", "arg_4", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "update", "=", "tf", ".", "constant", "(", "value", "=", "True", ")", ",", ")", ",", "fn_reference", "=", "arg_0", ".", "baseline", ".", "reference", ",", "fn_loss", "=", "arg_0", ".", "fn_baseline_loss", ",", ")", "if", "arg_0", ".", "global_model", "is", "not", "None", ":", "arg_4", "[", "'global_variables'", "]", "=", "arg_0", ".", "global_model", ".", "baseline", ".", "get_variables", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Returns the baseline optimizer arguments including the time, the list of variables to  \n        optimize, and various functions which the optimizer might require to perform an update  \n        step.\n\n        Args:\n            states: Dict of state tensors.\n            internals: List of prior internal state tensors.\n            reward: Reward tensor.\n\n        Returns:\n            Baseline optimizer arguments as dict.\n        \"\"\"\n        arg_4 = dict(\n            time=arg_0.global_timestep,\n            variables=arg_0.baseline.get_variables(),\n            arg_4=dict(\n                arg_1=arg_1,\n                arg_2=arg_2,\n                arg_3=arg_3,\n                update=tf.constant(value=True),\n            ),\n            fn_reference=arg_0.baseline.reference,\n            fn_loss=arg_0.fn_baseline_loss,\n            # source_variables=self.network.get_variables()\n        )\n        if arg_0.global_model is not None:\n            arg_4['global_variables'] = arg_0.global_model.baseline.get_variables()\n        return arg_4", "path": "tensorforce/models/pg_model.py", "identifier": "PGModel.baseline_optimizer_arguments", "docstring": "Returns the baseline optimizer arguments including the time, the list of variables to  \n        optimize, and various functions which the optimizer might require to perform an update  \n        step.\n\n        Args:\n            states: Dict of state tensors.\n            internals: List of prior internal state tensors.\n            reward: Reward tensor.\n\n        Returns:\n            Baseline optimizer arguments as dict.", "docstring_tokens": ["Returns", "the", "baseline", "optimizer", "arguments", "including", "the", "time", "the", "list", "of", "variables", "to", "optimize", "and", "various", "functions", "which", "the", "optimizer", "might", "require", "to", "perform", "an", "update", "step", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 256648}
{"url": "https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L289-L352", "sha": "818ebeabba5e051627d444c4849fde55947f94be", "docstring_summary": "Execute a query with provided parameters", "language": "python", "parameters": "(self, query, commit=False, working_columns=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "log", ".", "debug", "(", "\"RawlBase.Func()\"", ")", "arg_4", "=", "[", "]", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "columns", "with", "RawlConnection", "(", "arg_0", ".", "dsn", ")", "as", "conn", ":", "arg_5", "=", "random", ".", "randrange", "(", "9999", ")", "arg_6", "=", "conn", ".", "cursor", "(", ")", "try", ":", "log", ".", "debug", "(", "\"Executing(%s): %s\"", "%", "(", "arg_5", ",", "arg_1", ".", "as_string", "(", "arg_6", ")", ")", ")", "except", ":", "log", ".", "exception", "(", "\"LOGGING EXCEPTION LOL\"", ")", "arg_6", ".", "execute", "(", "arg_1", ")", "log", ".", "debug", "(", "\"Executed\"", ")", "if", "arg_2", "==", "True", ":", "log", ".", "debug", "(", "\"COMMIT(%s)\"", "%", "arg_5", ")", "conn", ".", "commit", "(", ")", "log", ".", "debug", "(", "\"curs.rowcount: %s\"", "%", "arg_6", ".", "rowcount", ")", "if", "arg_6", ".", "rowcount", ">", "0", ":", "arg_7", "=", "arg_6", ".", "fetchall", "(", ")", "for", "arg_8", "in", "arg_7", ":", "arg_9", "=", "0", "arg_10", "=", "{", "}", "for", "arg_11", "in", "arg_3", ":", "try", ":", "arg_11", "=", "arg_11", ".", "replace", "(", "'.'", ",", "'_'", ")", "arg_10", "[", "arg_11", "]", "=", "arg_8", "[", "arg_9", "]", "except", "IndexError", ":", "pass", "arg_9", "+=", "1", "log", ".", "debug", "(", "\"Appending dict to result: %s\"", "%", "arg_10", ")", "arg_12", "=", "RawlResult", "(", "arg_3", ",", "arg_10", ")", "arg_4", ".", "append", "(", "arg_12", ")", "arg_6", ".", "close", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=None):\n        \"\"\" \n        Execute a query with provided parameters \n\n        Parameters\n        :query:     SQL string with parameter placeholders\n        :commit:    If True, the query will commit\n        :returns:   List of rows\n        \"\"\"\n\n        log.debug(\"RawlBase.Func()\")\n\n        arg_4 = []\n\n        if arg_3 is None:\n            arg_3 = arg_0.columns\n\n        with RawlConnection(arg_0.dsn) as conn:\n\n            arg_5 = random.randrange(9999)\n\n            arg_6 = conn.cursor()\n\n            try:\n                log.debug(\"Executing(%s): %s\" % (arg_5, arg_1.as_string(arg_6)))\n            except:\n                log.exception(\"LOGGING EXCEPTION LOL\")\n\n            arg_6.execute(arg_1)\n\n            log.debug(\"Executed\")\n\n            if arg_2 == True:\n                log.debug(\"COMMIT(%s)\" % arg_5)\n                conn.commit()\n            \n            log.debug(\"curs.rowcount: %s\" % arg_6.rowcount)\n            \n            if arg_6.rowcount > 0:\n                #result = curs.fetchall()\n                # Process the results into a dict and stuff it in a RawlResult\n                # object.  Then append that object to result\n                arg_7 = arg_6.fetchall()\n                for arg_8 in arg_7:\n                    \n                    arg_9 = 0\n                    arg_10 = {}\n                    for arg_11 in arg_3:\n                        try:\n                            #log.debug(\"row_dict[%s] = row[%s] which is %s\" % (col, i, row[i]))\n                            # For aliased columns, we need to get rid of the dot\n                            arg_11 = arg_11.replace('.', '_')\n                            arg_10[arg_11] = arg_8[arg_9]\n                        except IndexError: pass\n                        arg_9 += 1\n                    \n                    log.debug(\"Appending dict to result: %s\" % arg_10)\n                    \n                    arg_12 = RawlResult(arg_3, arg_10)\n                    arg_4.append(arg_12)\n            \n            arg_6.close()\n\n        return arg_4", "path": "rawl/__init__.py", "identifier": "RawlBase._execute", "docstring": "Execute a query with provided parameters \n\n        Parameters\n        :query:     SQL string with parameter placeholders\n        :commit:    If True, the query will commit\n        :returns:   List of rows", "docstring_tokens": ["Execute", "a", "query", "with", "provided", "parameters"], "nwo": "mikeshultz/rawl", "score": 0.15726537023232431, "idx": 256649}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/palettes.py#L227-L266", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Utility for creating continuous grey scale palette", "language": "python", "parameters": "(start=0.2, end=0.8)", "return_statement": "return continuous_grey_palette", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0.2", ",", "arg_1", "=", "0.8", ")", ":", "arg_2", "=", "2.2", "arg_3", "=", "(", "(", "0.0", ",", "arg_0", ",", "arg_0", ")", ",", "(", "1.0", ",", "arg_1", ",", "arg_1", ")", ")", "arg_4", "=", "{", "'red'", ":", "arg_3", ",", "'green'", ":", "arg_3", ",", "'blue'", ":", "arg_3", "}", "arg_5", "=", "mcolors", ".", "LinearSegmentedColormap", "(", "'grey'", ",", "arg_4", ")", "def", "continuous_Funcette", "(", "arg_6", ")", ":", "arg_7", "=", "[", "]", "for", "arg_8", "in", "np", ".", "linspace", "(", "arg_0", "**", "arg_2", ",", "arg_1", "**", "arg_2", ",", "arg_6", ")", ":", "arg_8", "=", "(", "arg_8", "**", "(", "1.", "/", "arg_2", ")", "-", "arg_0", ")", "/", "(", "arg_1", "-", "arg_0", ")", "arg_7", ".", "append", "(", "mcolors", ".", "rgb2hex", "(", "arg_5", "(", "arg_8", ")", ")", ")", "return", "arg_7", "return", "continuous_Funcette"], "function": "def Func(arg_0=0.2, arg_1=0.8):\n    \"\"\"\n    Utility for creating continuous grey scale palette\n\n    Parameters\n    ----------\n    start : float\n        grey value at low end of palette\n    end : float\n        grey value at high end of palette\n\n    Returns\n    -------\n    out : function\n        Continuous color palette that takes a single\n        :class:`int` parameter ``n`` and returns ``n``\n        equally spaced colors.\n\n    Examples\n    --------\n    >>> palette = Func()\n    >>> palette(5)\n    ['#333333', '#737373', '#989898', '#b5b5b5', '#cccccc']\n    \"\"\"\n    arg_2 = 2.2\n    arg_3 = ((0.0, arg_0, arg_0), (1.0, arg_1, arg_1))\n    arg_4 = {'red': arg_3, 'green': arg_3, 'blue': arg_3}\n    arg_5 = mcolors.LinearSegmentedColormap('grey', arg_4)\n\n    def continuous_Funcette(arg_6):\n        arg_7 = []\n        # The grey scale points are linearly separated in\n        # gamma encoded space\n        for arg_8 in np.linspace(arg_0**arg_2, arg_1**arg_2, arg_6):\n            # Map points onto the [0, 1] palette domain\n            arg_8 = (arg_8 ** (1./arg_2) - arg_0) / (arg_1 - arg_0)\n            arg_7.append(mcolors.rgb2hex(arg_5(arg_8)))\n        return arg_7\n\n    return continuous_Funcette", "path": "mizani/palettes.py", "identifier": "grey_pal", "docstring": "Utility for creating continuous grey scale palette\n\n    Parameters\n    ----------\n    start : float\n        grey value at low end of palette\n    end : float\n        grey value at high end of palette\n\n    Returns\n    -------\n    out : function\n        Continuous color palette that takes a single\n        :class:`int` parameter ``n`` and returns ``n``\n        equally spaced colors.\n\n    Examples\n    --------\n    >>> palette = grey_pal()\n    >>> palette(5)\n    ['#333333', '#737373', '#989898', '#b5b5b5', '#cccccc']", "docstring_tokens": ["Utility", "for", "creating", "continuous", "grey", "scale", "palette"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 256650}
{"url": "https://github.com/redapple/parslepy/blob/a8bc4c0592824459629018c8f4c6ae3dad6cc3cc/parslepy/base.py#L270-L278", "sha": "a8bc4c0592824459629018c8f4c6ae3dad6cc3cc", "docstring_summary": "Interpret input lines as a JSON Parsley script.\n        Python-style comment lines are skipped.", "language": "python", "parameters": "(cls, lines, selector_handler=None, strict=False, debug=False)", "return_statement": "return cls(json.loads(\n                \"\\n\".join([l for l in lines if not cls.REGEX_COMMENT_LINE.match(l)])\n            ), selector_handler=selector_handler, strict=strict, debug=debug)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "return", "arg_0", "(", "json", ".", "loads", "(", "\"\\n\"", ".", "join", "(", "[", "arg_5", "for", "arg_5", "in", "arg_1", "if", "not", "arg_0", ".", "REGEX_COMMENT_LINE", ".", "match", "(", "arg_5", ")", "]", ")", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False, arg_4=False):\n        \"\"\"\n        Interpret input lines as a JSON Parsley script.\n        Python-style comment lines are skipped.\n        \"\"\"\n\n        return arg_0(json.loads(\n                \"\\n\".join([arg_5 for arg_5 in arg_1 if not arg_0.REGEX_COMMENT_LINE.match(arg_5)])\n            ), arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "parslepy/base.py", "identifier": "Parselet._from_jsonlines", "docstring": "Interpret input lines as a JSON Parsley script.\n        Python-style comment lines are skipped.", "docstring_tokens": ["Interpret", "input", "lines", "as", "a", "JSON", "Parsley", "script", ".", "Python", "-", "style", "comment", "lines", "are", "skipped", "."], "nwo": "redapple/parslepy", "score": 0.18261785916548806, "idx": 256651}
{"url": "https://github.com/willemarcel/osmcha/blob/9a22ed11834ed20c6b91e7b5685f66880ea09350/osmcha/scripts/cli.py#L9-L22", "sha": "9a22ed11834ed20c6b91e7b5685f66880ea09350", "docstring_summary": "Analyse an OpenStreetMap changeset.", "language": "python", "parameters": "(id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Analyse", "(", "arg_0", ")", "arg_1", ".", "full_analysis", "(", ")", "Funcck", ".", "echo", "(", "'Created: %s. Modified: %s. Deleted: %s'", "%", "(", "arg_1", ".", "create", ",", "arg_1", ".", "modify", ",", "arg_1", ".", "delete", ")", ")", "if", "arg_1", ".", "is_suspect", ":", "Funcck", ".", "echo", "(", "'The changeset {} is suspect! Reasons: {}'", ".", "format", "(", "arg_0", ",", "', '", ".", "join", "(", "arg_1", ".", "suspicion_reasons", ")", ")", ")", "else", ":", "Funcck", ".", "echo", "(", "'The changeset %s is not suspect!'", "%", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Analyse an OpenStreetMap changeset.\"\"\"\n    arg_1 = Analyse(arg_0)\n    arg_1.full_analysis()\n    Funcck.echo(\n        'Created: %s. Modified: %s. Deleted: %s' % (arg_1.create, arg_1.modify, arg_1.delete)\n        )\n    if arg_1.is_suspect:\n        Funcck.echo('The changeset {} is suspect! Reasons: {}'.format(\n            arg_0,\n            ', '.join(arg_1.suspicion_reasons)\n            ))\n    else:\n        Funcck.echo('The changeset %s is not suspect!' % arg_0)", "path": "osmcha/scripts/cli.py", "identifier": "cli", "docstring": "Analyse an OpenStreetMap changeset.", "docstring_tokens": ["Analyse", "an", "OpenStreetMap", "changeset", "."], "nwo": "willemarcel/osmcha", "score": 0.19358971820395612, "idx": 256652}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/fnmatch.py#L73-L88", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Test whether FILENAME matches PATTERN, including case.", "language": "python", "parameters": "(name, pat)", "return_statement": "return re_pat.match(name) is not None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_5", "[", "arg_1", "]", "except", "KeyError", ":", "arg_3", "=", "translate", "(", "arg_1", ")", "if", "len", "(", "arg_5", ")", ">=", "_MAXCACHE", ":", "arg_4", "(", ")", "[", "'_cache'", "]", "=", "{", "}", "arg_5", "[", "arg_1", "]", "=", "arg_2", "=", "re", ".", "compile", "(", "arg_3", ")", "return", "arg_2", ".", "match", "(", "arg_0", ")", "is", "not", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Test whether FILENAME matches PATTERN, including case.\n\n    This is a version of fnmatch() which doesn't case-normalize\n    its arguments.\n    \"\"\"\n\n    try:\n        arg_2 = arg_5[arg_1]\n    except KeyError:\n        arg_3 = translate(arg_1)\n        if len(arg_5) >= _MAXCACHE:\n            # _cache.clear()\n            arg_4()['_cache'] = {}\n        arg_5[arg_1] = arg_2 = re.compile(arg_3)\n    return arg_2.match(arg_0) is not None", "path": "third_party/stdlib/fnmatch.py", "identifier": "fnmatchcase", "docstring": "Test whether FILENAME matches PATTERN, including case.\n\n    This is a version of fnmatch() which doesn't case-normalize\n    its arguments.", "docstring_tokens": ["Test", "whether", "FILENAME", "matches", "PATTERN", "including", "case", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 256653}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dc/simple_dc.py#L104-L107", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Resolve a relative url to the appropriate realm name.", "language": "python", "parameters": "(self, path_info, environ)", "return_statement": "return realm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_calc_realm_from_path_provider", "(", "arg_1", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Resolve a relative url to the appropriate realm name.\"\"\"\n        arg_3 = arg_0._calc_realm_from_path_provider(arg_1, arg_2)\n        return arg_3", "path": "wsgidav/dc/simple_dc.py", "identifier": "SimpleDomainController.get_domain_realm", "docstring": "Resolve a relative url to the appropriate realm name.", "docstring_tokens": ["Resolve", "a", "relative", "url", "to", "the", "appropriate", "realm", "name", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 256654}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L772-L783", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Returns annotation type or None if found none or more than one.\n        Reports errors on failure.", "language": "python", "parameters": "(self, r_term)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_2", ",", "arg_3", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'annotationType'", "]", ",", "None", ")", ")", ":", "if", "arg_3", "is", "not", "None", ":", "return", "arg_3", "else", ":", "arg_0", ".", "error", "=", "True", "arg_5", "=", "'Annotation must have exactly one annotation type.'", "arg_0", ".", "logger", ".", "log", "(", "arg_5", ")", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns annotation type or None if found none or more than one.\n        Reports errors on failure.\"\"\"\n        for arg_2, arg_2, arg_3 in arg_0.graph.triples((\n                arg_1, arg_0.spdx_namespace['annotationType'], None)):\n            if arg_3 is not None:\n                return arg_3\n            else:\n                arg_0.error = True\n                arg_5 = 'Annotation must have exactly one annotation type.'\n                arg_0.logger.log(arg_5)\n                return", "path": "spdx/parsers/rdf.py", "identifier": "AnnotationParser.get_annotation_type", "docstring": "Returns annotation type or None if found none or more than one.\n        Reports errors on failure.", "docstring_tokens": ["Returns", "annotation", "type", "or", "None", "if", "found", "none", "or", "more", "than", "one", ".", "Reports", "errors", "on", "failure", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 256655}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/examples/pb_importVM.py#L210-L221", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Returns all disk images within a location with a given image name.\n    The name must match exactly.\n    The list may be empty.", "language": "python", "parameters": "(pbclient, location, image_name)", "return_statement": "return matching", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "list_images", "(", ")", "arg_4", "=", "[", "i", "for", "i", "in", "arg_3", "[", "'items'", "]", "if", "i", "[", "'properties'", "]", "[", "'name'", "]", "==", "arg_2", "and", "i", "[", "'properties'", "]", "[", "'imageType'", "]", "==", "\"HDD\"", "and", "i", "[", "'properties'", "]", "[", "'location'", "]", "==", "arg_1", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Returns all disk images within a location with a given image name.\n    The name must match exactly.\n    The list may be empty.\n    \"\"\"\n    arg_3 = arg_0.list_images()\n    arg_4 = [i for i in arg_3['items'] if\n                i['properties']['name'] == arg_2 and\n                i['properties']['imageType'] == \"HDD\" and\n                i['properties']['location'] == arg_1]\n    return arg_4", "path": "examples/pb_importVM.py", "identifier": "get_disk_image_by_name", "docstring": "Returns all disk images within a location with a given image name.\n    The name must match exactly.\n    The list may be empty.", "docstring_tokens": ["Returns", "all", "disk", "images", "within", "a", "location", "with", "a", "given", "image", "name", ".", "The", "name", "must", "match", "exactly", ".", "The", "list", "may", "be", "empty", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 256656}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/discount.py#L50-L101", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns all discounts available to this user for the given\n        categories and products. The discounts also list the available quantity\n        for this user, not including products that are pending purchase.", "language": "python", "parameters": "(cls, user, categories, products)", "return_statement": "return discounts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_filtered_clauses", "(", "arg_1", ")", "arg_2", "=", "set", "(", "arg_2", ")", "arg_3", "=", "set", "(", "arg_3", ")", "arg_5", "=", "set", "(", "product", ".", "category", "for", "product", "in", "arg_3", ")", "arg_6", "=", "arg_2", "|", "arg_5", "arg_4", "=", "(", "arg_10", "for", "arg_10", "in", "arg_4", "if", "hasattr", "(", "arg_10", ",", "'product'", ")", "and", "arg_10", ".", "product", "in", "arg_3", "or", "hasattr", "(", "arg_10", ",", "'category'", ")", "and", "arg_10", ".", "category", "in", "arg_6", ")", "arg_7", "=", "[", "]", "arg_8", "=", "set", "(", ")", "arg_9", "=", "set", "(", ")", "for", "arg_10", "in", "arg_4", ":", "arg_11", "=", "arg_10", ".", "discount", "arg_12", "=", "ConditionController", ".", "for_condition", "(", "arg_11", ")", "arg_13", "=", "arg_10", ".", "past_use_count", "if", "arg_13", ">=", "arg_10", ".", "quantity", ":", "pass", "elif", "arg_11", "not", "in", "arg_9", ":", "arg_14", "=", "arg_11", "in", "arg_8", "if", "arg_14", "or", "arg_12", ".", "is_met", "(", "arg_1", ",", "filtered", "=", "True", ")", ":", "arg_7", ".", "append", "(", "DiscountAndQuantity", "(", "arg_11", "=", "arg_11", ",", "arg_10", "=", "arg_10", ",", "quantity", "=", "arg_10", ".", "quantity", "-", "arg_13", ",", ")", ")", "arg_8", ".", "add", "(", "arg_11", ")", "else", ":", "arg_9", ".", "add", "(", "arg_11", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        ''' Returns all discounts available to this user for the given\n        categories and products. The discounts also list the available quantity\n        for this user, not including products that are pending purchase. '''\n\n        arg_4 = arg_0._filtered_clauses(arg_1)\n\n        # clauses that match provided categories\n        arg_2 = set(arg_2)\n        # clauses that match provided products\n        arg_3 = set(arg_3)\n        # clauses that match categories for provided products\n        arg_5 = set(product.category for product in arg_3)\n        # (Not relevant: clauses that match products in provided categories)\n        arg_6 = arg_2 | arg_5\n\n        arg_4 = (\n            arg_10 for arg_10 in arg_4\n            if hasattr(arg_10, 'product') and arg_10.product in arg_3 or\n            hasattr(arg_10, 'category') and arg_10.category in arg_6\n        )\n\n        arg_7 = []\n\n        # Markers so that we don't need to evaluate given conditions\n        # more than once\n        arg_8 = set()\n        arg_9 = set()\n\n        for arg_10 in arg_4:\n            arg_11 = arg_10.discount\n            arg_12 = ConditionController.for_condition(arg_11)\n\n            arg_13 = arg_10.past_use_count\n            if arg_13 >= arg_10.quantity:\n                # This clause has exceeded its use count\n                pass\n            elif arg_11 not in arg_9:\n                # This clause is still available\n                arg_14 = arg_11 in arg_8\n                if arg_14 or arg_12.is_met(arg_1, filtered=True):\n                    # This clause is valid for this user\n                    arg_7.append(DiscountAndQuantity(\n                        arg_11=arg_11,\n                        arg_10=arg_10,\n                        quantity=arg_10.quantity - arg_13,\n                    ))\n                    arg_8.add(arg_11)\n                else:\n                    # This clause is not valid for this user\n                    arg_9.add(arg_11)\n        return arg_7", "path": "registrasion/controllers/discount.py", "identifier": "DiscountController.available_discounts", "docstring": "Returns all discounts available to this user for the given\n        categories and products. The discounts also list the available quantity\n        for this user, not including products that are pending purchase.", "docstring_tokens": ["Returns", "all", "discounts", "available", "to", "this", "user", "for", "the", "given", "categories", "and", "products", ".", "The", "discounts", "also", "list", "the", "available", "quantity", "for", "this", "user", "not", "including", "products", "that", "are", "pending", "purchase", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 256657}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/elsevier_package.py#L263-L293", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "main.xml from Elsevier assume the existence of a local DTD.\n        This procedure install the DTDs next to the main.xml file\n        and normalize it using xmllint in order to resolve all namespaces\n        and references.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "exists", "(", "join", "(", "arg_1", ",", "'resolved_main.xml'", ")", ")", ":", "return", "arg_2", "=", "open", "(", "join", "(", "arg_1", ",", "'main.xml'", ")", ")", ".", "read", "(", ")", "arg_3", "=", "[", "'art501.dtd'", ",", "'art510.dtd'", ",", "'art520.dtd'", ",", "'art540.dtd'", "]", "arg_4", "=", "0", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", "in", "arg_2", ":", "arg_0", ".", "_extract_correct_dtd_package", "(", "arg_5", ".", "split", "(", "'.'", ")", "[", "0", "]", ",", "arg_1", ")", "arg_4", "=", "1", "if", "not", "arg_4", ":", "arg_6", "=", "\"It looks like the path \"", "+", "arg_1", "arg_6", "+=", "\"does not contain an art501, art510, art520 or art540 in main.xml file\"", "arg_0", ".", "logger", ".", "error", "(", "arg_6", ")", "raise", "ValueError", "(", "arg_6", ")", "arg_7", "=", "[", "\"xmllint\"", ",", "\"--format\"", ",", "\"--loaddtd\"", ",", "join", "(", "arg_1", ",", "'main.xml'", ")", ",", "\"--output\"", ",", "join", "(", "arg_1", ",", "'resolved_main.xml'", ")", "]", "arg_8", ",", "arg_8", ",", "arg_9", "=", "run_shell_command", "(", "arg_7", ")", "if", "arg_9", ":", "arg_6", "=", "\"Error in cleaning %s: %s\"", "%", "(", "join", "(", "arg_1", ",", "'main.xml'", ")", ",", "arg_9", ")", "arg_0", ".", "logger", ".", "error", "(", "arg_6", ")", "raise", "ValueError", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        main.xml from Elsevier assume the existence of a local DTD.\n        This procedure install the DTDs next to the main.xml file\n        and normalize it using xmllint in order to resolve all namespaces\n        and references.\n        \"\"\"\n        if exists(join(arg_1, 'resolved_main.xml')):\n            return\n        arg_2 = open(join(arg_1, 'main.xml')).read()\n        arg_3 = ['art501.dtd','art510.dtd','art520.dtd','art540.dtd']\n        arg_4 = 0\n        for arg_5 in arg_3:\n            if arg_5 in arg_2:\n                arg_0._extract_correct_dtd_package(arg_5.split('.')[0], arg_1)\n                arg_4 = 1\n\n        if not arg_4:\n            arg_6 = \"It looks like the path \" + arg_1\n            arg_6 += \"does not contain an art501, art510, art520 or art540 in main.xml file\"\n            arg_0.logger.error(arg_6)\n            raise ValueError(arg_6)\n        arg_7 = [\"xmllint\", \"--format\", \"--loaddtd\",\n                   join(arg_1, 'main.xml'),\n                   \"--output\", join(arg_1, 'resolved_main.xml')]\n        arg_8, arg_8, arg_9 = run_shell_command(arg_7)\n        if arg_9:\n            arg_6 = \"Error in cleaning %s: %s\" % (\n                join(arg_1, 'main.xml'), arg_9)\n            arg_0.logger.error(arg_6)\n            raise ValueError(arg_6)", "path": "harvestingkit/elsevier_package.py", "identifier": "ElsevierPackage._normalize_article_dir_with_dtd", "docstring": "main.xml from Elsevier assume the existence of a local DTD.\n        This procedure install the DTDs next to the main.xml file\n        and normalize it using xmllint in order to resolve all namespaces\n        and references.", "docstring_tokens": ["main", ".", "xml", "from", "Elsevier", "assume", "the", "existence", "of", "a", "local", "DTD", ".", "This", "procedure", "install", "the", "DTDs", "next", "to", "the", "main", ".", "xml", "file", "and", "normalize", "it", "using", "xmllint", "in", "order", "to", "resolve", "all", "namespaces", "and", "references", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 256658}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/node/finders.py#L210-L234", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Find the first element on the page matching the given selector and options, or None if no\n        element matches.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "capybara", ".", "wait_on_first_by_default", ":", "arg_2", ".", "setdefault", "(", "\"minimum\"", ",", "1", ")", "try", ":", "arg_3", "=", "arg_0", ".", "find_all", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "arg_3", "[", "0", "]", "if", "len", "(", "arg_3", ")", ">", "0", "else", "None", "except", "ExpectationNotMet", ":", "return", "None"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Find the first element on the page matching the given selector and options, or None if no\n        element matches.\n\n        By default, no waiting behavior occurs. However, if ``capybara.wait_on_first_by_default``\n        is set to true, it will trigger Capybara's waiting behavior for a minimum of 1 matching\n        element to be found.\n\n        Args:\n            *args: Variable length argument list for :class:`SelectorQuery`.\n            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.\n\n        Returns:\n            Element: The found element or None.\n        \"\"\"\n\n        if capybara.wait_on_first_by_default:\n            arg_2.setdefault(\"minimum\", 1)\n\n        try:\n            arg_3 = arg_0.find_all(*arg_1, **arg_2)\n            return arg_3[0] if len(arg_3) > 0 else None\n        except ExpectationNotMet:\n            return None", "path": "capybara/node/finders.py", "identifier": "FindersMixin.find_first", "docstring": "Find the first element on the page matching the given selector and options, or None if no\n        element matches.\n\n        By default, no waiting behavior occurs. However, if ``capybara.wait_on_first_by_default``\n        is set to true, it will trigger Capybara's waiting behavior for a minimum of 1 matching\n        element to be found.\n\n        Args:\n            *args: Variable length argument list for :class:`SelectorQuery`.\n            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.\n\n        Returns:\n            Element: The found element or None.", "docstring_tokens": ["Find", "the", "first", "element", "on", "the", "page", "matching", "the", "given", "selector", "and", "options", "or", "None", "if", "no", "element", "matches", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 256659}
{"url": "https://github.com/blink1073/oct2py/blob/bfc69d2168ae3d98258f95bbc55a858c21836b58/oct2py/dynamic.py#L209-L230", "sha": "bfc69d2168ae3d98258f95bbc55a858c21836b58", "docstring_summary": "Make an Octave class for a given class name", "language": "python", "parameters": "(session, name)", "return_statement": "return type(str(name), (OctaveUserClass,), values)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "eval", "(", "'fieldnames(%s);'", "%", "arg_1", ",", "nout", "=", "1", ")", ".", "ravel", "(", ")", ".", "tolist", "(", ")", "arg_3", "=", "arg_0", ".", "eval", "(", "'methods(%s);'", "%", "arg_1", ",", "nout", "=", "1", ")", ".", "ravel", "(", ")", ".", "tolist", "(", ")", "arg_4", "=", "weakref", ".", "ref", "(", "arg_0", ")", "arg_5", "=", "_DocDescriptor", "(", "arg_4", ",", "arg_1", ")", "arg_6", "=", "dict", "(", "__doc__", "=", "arg_5", ",", "_name", "=", "arg_1", ",", "_ref", "=", "arg_4", ",", "_attrs", "=", "arg_2", ",", "__module__", "=", "'oct2py.dynamic'", ")", "for", "arg_7", "in", "arg_3", ":", "arg_5", "=", "_MethodDocDescriptor", "(", "arg_4", ",", "arg_1", ",", "arg_7", ")", "arg_8", "=", "'%s_%s'", "%", "(", "arg_1", ",", "arg_7", ")", "arg_9", "=", "dict", "(", "__doc__", "=", "arg_5", ")", "arg_10", "=", "type", "(", "str", "(", "arg_8", ")", ",", "(", "OctaveUserClassMethod", ",", ")", ",", "arg_9", ")", "arg_6", "[", "arg_7", "]", "=", "arg_10", "(", "arg_4", ",", "arg_7", ",", "arg_1", ")", "for", "arg_11", "in", "arg_2", ":", "arg_6", "[", "arg_11", "]", "=", "OctaveUserClassAttr", "(", "arg_4", ",", "arg_11", ",", "arg_11", ")", "return", "type", "(", "str", "(", "arg_1", ")", ",", "(", "OctaveUserClass", ",", ")", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Make an Octave class for a given class name\"\"\"\n    arg_2 = arg_0.eval('fieldnames(%s);' % arg_1, nout=1).ravel().tolist()\n    arg_3 = arg_0.eval('methods(%s);' % arg_1, nout=1).ravel().tolist()\n    arg_4 = weakref.ref(arg_0)\n\n    arg_5 = _DocDescriptor(arg_4, arg_1)\n    arg_6 = dict(__doc__=arg_5, _name=arg_1, _ref=arg_4, _attrs=arg_2,\n                  __module__='oct2py.dynamic')\n\n    for arg_7 in arg_3:\n        arg_5 = _MethodDocDescriptor(arg_4, arg_1, arg_7)\n        arg_8 = '%s_%s' % (arg_1, arg_7)\n        arg_9 = dict(__doc__=arg_5)\n        arg_10 = type(str(arg_8),\n                          (OctaveUserClassMethod,), arg_9)\n        arg_6[arg_7] = arg_10(arg_4, arg_7, arg_1)\n\n    for arg_11 in arg_2:\n        arg_6[arg_11] = OctaveUserClassAttr(arg_4, arg_11, arg_11)\n\n    return type(str(arg_1), (OctaveUserClass,), arg_6)", "path": "oct2py/dynamic.py", "identifier": "_make_user_class", "docstring": "Make an Octave class for a given class name", "docstring_tokens": ["Make", "an", "Octave", "class", "for", "a", "given", "class", "name"], "nwo": "blink1073/oct2py", "score": 0.3484138981803976, "idx": 256660}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1880-L1927", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Replicate a VM image to multiple target locations. This operation\n        is only for publishers. You have to be registered as image publisher\n        with Microsoft Azure to be able to call this.", "language": "python", "parameters": "(self, vm_image_name, regions, offer, sku, version)", "return_statement": "return self._perform_put(\n            self._get_replication_path_using_vm_image_name(vm_image_name),\n            _XmlSerializer.replicate_image_to_xml(\n                regions,\n                offer,\n                sku,\n                version\n            ),\n            as_async=True,\n            x_ms_version='2015-04-01'\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "_validate_not_none", "(", "'vm_image_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'regions'", ",", "arg_2", ")", "_validate_not_none", "(", "'offer'", ",", "arg_3", ")", "_validate_not_none", "(", "'sku'", ",", "arg_4", ")", "_validate_not_none", "(", "'version'", ",", "arg_5", ")", "return", "arg_0", ".", "_perform_put", "(", "arg_0", ".", "_get_replication_path_using_vm_image_name", "(", "arg_1", ")", ",", "_XmlSerializer", ".", "replicate_image_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ",", "as_async", "=", "True", ",", "x_ms_version", "=", "'2015-04-01'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        '''\n        Replicate a VM image to multiple target locations. This operation\n        is only for publishers. You have to be registered as image publisher\n        with Microsoft Azure to be able to call this.\n\n        vm_image_name:\n            Specifies the name of the VM Image that is to be used for\n            replication\n        regions:\n            Specified a list of regions to replicate the image to\n            Note: The regions in the request body are not additive. If a VM\n            Image has already been replicated to Regions A, B, and C, and\n            a request is made to replicate to Regions A and D, the VM\n            Image will remain in Region A, will be replicated in Region D,\n            and will be unreplicated from Regions B and C\n        offer:\n            Specifies the publisher defined name of the offer. The allowed\n            characters are uppercase or lowercase letters, digit,\n            hypen(-), period (.).The maximum allowed length is 64 characters.\n        sku:\n            Specifies the publisher defined name of the Sku. The allowed\n            characters are uppercase or lowercase letters, digit,\n            hypen(-), period (.). The maximum allowed length is 64 characters.\n        version:\n            Specifies the publisher defined version of the image.\n            The allowed characters are digit and period.\n            Format: <MajorVersion>.<MinorVersion>.<Patch>\n            Example: '1.0.0' or '1.1.0' The 3 version number to\n            follow standard of most of the RPs. See http://semver.org\n        '''\n        _validate_not_none('vm_image_name', arg_1)\n        _validate_not_none('regions', arg_2)\n        _validate_not_none('offer', arg_3)\n        _validate_not_none('sku', arg_4)\n        _validate_not_none('version', arg_5)\n\n        return arg_0._perform_put(\n            arg_0._get_replication_path_using_vm_image_name(arg_1),\n            _XmlSerializer.replicate_image_to_xml(\n                arg_2,\n                arg_3,\n                arg_4,\n                arg_5\n            ),\n            as_async=True,\n            x_ms_version='2015-04-01'\n        )", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.replicate_vm_image", "docstring": "Replicate a VM image to multiple target locations. This operation\n        is only for publishers. You have to be registered as image publisher\n        with Microsoft Azure to be able to call this.\n\n        vm_image_name:\n            Specifies the name of the VM Image that is to be used for\n            replication\n        regions:\n            Specified a list of regions to replicate the image to\n            Note: The regions in the request body are not additive. If a VM\n            Image has already been replicated to Regions A, B, and C, and\n            a request is made to replicate to Regions A and D, the VM\n            Image will remain in Region A, will be replicated in Region D,\n            and will be unreplicated from Regions B and C\n        offer:\n            Specifies the publisher defined name of the offer. The allowed\n            characters are uppercase or lowercase letters, digit,\n            hypen(-), period (.).The maximum allowed length is 64 characters.\n        sku:\n            Specifies the publisher defined name of the Sku. The allowed\n            characters are uppercase or lowercase letters, digit,\n            hypen(-), period (.). The maximum allowed length is 64 characters.\n        version:\n            Specifies the publisher defined version of the image.\n            The allowed characters are digit and period.\n            Format: <MajorVersion>.<MinorVersion>.<Patch>\n            Example: '1.0.0' or '1.1.0' The 3 version number to\n            follow standard of most of the RPs. See http://semver.org", "docstring_tokens": ["Replicate", "a", "VM", "image", "to", "multiple", "target", "locations", ".", "This", "operation", "is", "only", "for", "publishers", ".", "You", "have", "to", "be", "registered", "as", "image", "publisher", "with", "Microsoft", "Azure", "to", "be", "able", "to", "call", "this", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256661}
{"url": "https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/connection.py#L35-L52", "sha": "9d0e8ebcba31d937f73752f9b88e5a4fec860765", "docstring_summary": "Return a bucket from MimicDB if it exists. Return a\n        S3ResponseError if the bucket does not exist and validate is passed.", "language": "python", "parameters": "(self, bucket_name, validate=True, headers=None, force=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", ":", "arg_5", "=", "super", "(", "S3Connection", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "mimicdb", ".", "backend", ".", "sadd", "(", "tpl", ".", "connection", ",", "arg_5", ".", "name", ")", "return", "arg_5", "if", "mimicdb", ".", "backend", ".", "sismember", "(", "tpl", ".", "connection", ",", "arg_1", ")", ":", "return", "Bucket", "(", "arg_0", ",", "arg_1", ")", "else", ":", "if", "arg_2", ":", "raise", "S3ResponseError", "(", "404", ",", "'NoSuchBucket'", ")", "else", ":", "return", "Bucket", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None, arg_4=None):\n        \"\"\"Return a bucket from MimicDB if it exists. Return a\n        S3ResponseError if the bucket does not exist and validate is passed.\n\n        :param boolean force: If true, API call is forced to S3\n        \"\"\"\n        if arg_4:\n            arg_5 = super(S3Connection, arg_0).Func(arg_1, arg_2, arg_3)\n            mimicdb.backend.sadd(tpl.connection, arg_5.name)\n            return arg_5\n\n        if mimicdb.backend.sismember(tpl.connection, arg_1):\n            return Bucket(arg_0, arg_1)\n        else:\n            if arg_2:\n                raise S3ResponseError(404, 'NoSuchBucket')\n            else:\n                return Bucket(arg_0, arg_1)", "path": "mimicdb/s3/connection.py", "identifier": "S3Connection.get_bucket", "docstring": "Return a bucket from MimicDB if it exists. Return a\n        S3ResponseError if the bucket does not exist and validate is passed.\n\n        :param boolean force: If true, API call is forced to S3", "docstring_tokens": ["Return", "a", "bucket", "from", "MimicDB", "if", "it", "exists", ".", "Return", "a", "S3ResponseError", "if", "the", "bucket", "does", "not", "exist", "and", "validate", "is", "passed", "."], "nwo": "nathancahill/mimicdb", "score": 0.18112697196067942, "idx": 256662}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/utils.py#L67-L82", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Normalize metadata to improve match accuracy.", "language": "python", "parameters": "(metadata)", "return_statement": "return metadata", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "str", "(", "arg_0", ")", "arg_0", "=", "arg_0", ".", "lower", "(", ")", "arg_0", "=", "re", ".", "sub", "(", "r'\\/\\s*\\d+'", ",", "''", ",", "arg_0", ")", "arg_0", "=", "re", ".", "sub", "(", "r'^0+([0-9]+)'", ",", "r'\\1'", ",", "arg_0", ")", "arg_0", "=", "re", ".", "sub", "(", "r'^\\d+\\.+'", ",", "''", ",", "arg_0", ")", "arg_0", "=", "re", ".", "sub", "(", "r'[^\\w\\s]'", ",", "''", ",", "arg_0", ")", "arg_0", "=", "re", ".", "sub", "(", "r'\\s+'", ",", "' '", ",", "arg_0", ")", "arg_0", "=", "re", ".", "sub", "(", "r'^\\s+'", ",", "''", ",", "arg_0", ")", "arg_0", "=", "re", ".", "sub", "(", "r'\\s+$'", ",", "''", ",", "arg_0", ")", "arg_0", "=", "re", ".", "sub", "(", "r'^the\\s+'", ",", "''", ",", "arg_0", ",", "re", ".", "I", ")", "return", "arg_0"], "function": "def Func(arg_0):\n\t\"\"\"Normalize metadata to improve match accuracy.\"\"\"\n\n\targ_0 = str(arg_0)\n\targ_0 = arg_0.lower()\n\n\targ_0 = re.sub(r'\\/\\s*\\d+', '', arg_0)  # Remove \"/<totaltracks>\" from track number.\n\targ_0 = re.sub(r'^0+([0-9]+)', r'\\1', arg_0)  # Remove leading zero(s) from track number.\n\targ_0 = re.sub(r'^\\d+\\.+', '', arg_0)  # Remove dots from track number.\n\targ_0 = re.sub(r'[^\\w\\s]', '', arg_0)  # Remove any non-words.\n\targ_0 = re.sub(r'\\s+', ' ', arg_0)  # Reduce multiple spaces to a single space.\n\targ_0 = re.sub(r'^\\s+', '', arg_0)  # Remove leading space.\n\targ_0 = re.sub(r'\\s+$', '', arg_0)  # Remove trailing space.\n\targ_0 = re.sub(r'^the\\s+', '', arg_0, re.I)  # Remove leading \"the\".\n\n\treturn arg_0", "path": "gmusicapi_wrapper/utils.py", "identifier": "_normalize_metadata", "docstring": "Normalize metadata to improve match accuracy.", "docstring_tokens": ["Normalize", "metadata", "to", "improve", "match", "accuracy", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 256663}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/coupling.py#L82-L94", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Add directed edge to coupling graph.", "language": "python", "parameters": "(self, src, dst)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "physical_qubits", ":", "arg_0", ".", "add_physical_qubit", "(", "arg_1", ")", "if", "arg_2", "not", "in", "arg_0", ".", "physical_qubits", ":", "arg_0", ".", "add_physical_qubit", "(", "arg_2", ")", "arg_0", ".", "graph", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_dist_matrix", "=", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Add directed edge to coupling graph.\n\n        src (int): source physical qubit\n        dst (int): destination physical qubit\n        \"\"\"\n        if arg_1 not in arg_0.physical_qubits:\n            arg_0.add_physical_qubit(arg_1)\n        if arg_2 not in arg_0.physical_qubits:\n            arg_0.add_physical_qubit(arg_2)\n        arg_0.graph.Func(arg_1, arg_2)\n        arg_0._dist_matrix = None", "path": "qiskit/transpiler/coupling.py", "identifier": "CouplingMap.add_edge", "docstring": "Add directed edge to coupling graph.\n\n        src (int): source physical qubit\n        dst (int): destination physical qubit", "docstring_tokens": ["Add", "directed", "edge", "to", "coupling", "graph", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256664}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L1806-L1819", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Creates a full mapping from all wildcard translations to the corresponding wildcards", "language": "python", "parameters": "(self, old_length=-1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "-", "1", ")", ":", "if", "len", "(", "arg_0", ".", "_reversed_wildcards", ")", ">", "0", ":", "arg_2", "=", "arg_1", "else", ":", "arg_2", "=", "-", "1", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_wildcard_functions", ".", "items", "(", ")", ":", "for", "arg_5", "in", "range", "(", "arg_2", ",", "len", "(", "arg_0", ")", ")", ":", "arg_6", "=", "arg_4", "(", "arg_5", ")", "if", "not", "arg_6", "in", "arg_0", ".", "_reversed_wildcards", ":", "arg_0", ".", "_reversed_wildcards", "[", "arg_6", "]", "=", "(", "[", "]", ",", "arg_3", ")", "arg_0", ".", "_reversed_wildcards", "[", "arg_6", "]", "[", "0", "]", ".", "append", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1=-1):\n        \"\"\"Creates a full mapping from all wildcard translations to the corresponding wildcards\"\"\"\n        if len(arg_0._reversed_wildcards) > 0:\n            # We already created reversed wildcards, so we don't need to do all of them\n            # again\n            arg_2 = arg_1\n        else:\n            arg_2 = -1\n        for arg_3, arg_4 in arg_0._wildcard_functions.items():\n            for arg_5 in range(arg_2, len(arg_0)):\n                arg_6 = arg_4(arg_5)\n                if not arg_6 in arg_0._reversed_wildcards:\n                    arg_0._reversed_wildcards[arg_6] = ([], arg_3)\n                arg_0._reversed_wildcards[arg_6][0].append(arg_5)", "path": "pypet/trajectory.py", "identifier": "Trajectory._make_reversed_wildcards", "docstring": "Creates a full mapping from all wildcard translations to the corresponding wildcards", "docstring_tokens": ["Creates", "a", "full", "mapping", "from", "all", "wildcard", "translations", "to", "the", "corresponding", "wildcards"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256665}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/enterprise.py#L73-L119", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Loads a response from a call to one of the Enterprise endpoints.", "language": "python", "parameters": "(\n            self,\n            resource,\n            detail_resource=None,\n            resource_id=None,\n            querystring=None,\n            traverse_pagination=False,\n            default=DEFAULT_VALUE_SAFEGUARD,\n    )", "return_statement": "return response or default_val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "arg_7", ",", ")", ":", "arg_8", "=", "arg_6", "if", "arg_6", "!=", "arg_0", ".", "DEFAULT_VALUE_SAFEGUARD", "else", "{", "}", "arg_4", "=", "arg_4", "if", "arg_4", "else", "{", "}", "arg_9", "=", "utils", ".", "get_cache_key", "(", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_3", "=", "arg_3", ")", "arg_10", "=", "cache", ".", "get", "(", "arg_9", ")", "if", "not", "arg_10", ":", "arg_11", "=", "getattr", "(", "arg_0", ".", "client", ",", "arg_1", ")", "(", "arg_3", ")", "arg_11", "=", "getattr", "(", "arg_11", ",", "arg_2", ")", "if", "arg_2", "else", "arg_11", "arg_10", "=", "arg_11", ".", "get", "(", "**", "arg_4", ")", "if", "arg_5", ":", "arg_12", "=", "utils", ".", "traverse_pagination", "(", "arg_10", ",", "arg_11", ")", "arg_10", "=", "{", "'count'", ":", "len", "(", "arg_12", ")", ",", "'next'", ":", "'None'", ",", "'previous'", ":", "'None'", ",", "'results'", ":", "arg_12", ",", "}", "if", "arg_10", ":", "cache", ".", "set", "(", "arg_9", ",", "arg_10", ",", "settings", ".", "ENTERPRISE_API_CACHE_TIMEOUT", ")", "return", "arg_10", "or", "arg_8"], "function": "def Func(\n            arg_0,\n            arg_1,\n            arg_2=None,\n            arg_3=None,\n            arg_4=None,\n            arg_5=False,\n            arg_6=arg_7,\n    ):\n        \"\"\"\n        Loads a response from a call to one of the Enterprise endpoints.\n\n        :param resource: The endpoint resource name.\n        :param detail_resource: The sub-resource to append to the path.\n        :param resource_id: The resource ID for the specific detail to get from the endpoint.\n        :param querystring: Optional query string parameters.\n        :param traverse_pagination: Whether to traverse pagination or return paginated response.\n        :param default: The default value to return in case of no response content.\n        :return: Data returned by the API.\n        \"\"\"\n        arg_8 = arg_6 if arg_6 != arg_0.DEFAULT_VALUE_SAFEGUARD else {}\n        arg_4 = arg_4 if arg_4 else {}\n\n        arg_9 = utils.get_cache_key(\n            arg_1=arg_1,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_3=arg_3\n        )\n        arg_10 = cache.get(arg_9)\n        if not arg_10:\n            # Response is not cached, so make a call.\n            arg_11 = getattr(arg_0.client, arg_1)(arg_3)\n            arg_11 = getattr(arg_11, arg_2) if arg_2 else arg_11\n            arg_10 = arg_11.get(**arg_4)\n            if arg_5:\n                arg_12 = utils.traverse_pagination(arg_10, arg_11)\n                arg_10 = {\n                    'count': len(arg_12),\n                    'next': 'None',\n                    'previous': 'None',\n                    'results': arg_12,\n                }\n            if arg_10:\n                # Now that we've got a response, cache it.\n                cache.set(arg_9, arg_10, settings.ENTERPRISE_API_CACHE_TIMEOUT)\n        return arg_10 or arg_8", "path": "enterprise/api_client/enterprise.py", "identifier": "EnterpriseApiClient._load_data", "docstring": "Loads a response from a call to one of the Enterprise endpoints.\n\n        :param resource: The endpoint resource name.\n        :param detail_resource: The sub-resource to append to the path.\n        :param resource_id: The resource ID for the specific detail to get from the endpoint.\n        :param querystring: Optional query string parameters.\n        :param traverse_pagination: Whether to traverse pagination or return paginated response.\n        :param default: The default value to return in case of no response content.\n        :return: Data returned by the API.", "docstring_tokens": ["Loads", "a", "response", "from", "a", "call", "to", "one", "of", "the", "Enterprise", "endpoints", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256666}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py#L351-L353", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Signs the given string.", "language": "python", "parameters": "(self, value)", "return_statement": "return value + want_bytes(self.sep) + self.get_signature(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_1", "+", "want_bytes", "(", "arg_0", ".", "sep", ")", "+", "arg_0", ".", "get_Funcature", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Signs the given string.\"\"\"\n        return arg_1 + want_bytes(arg_0.sep) + arg_0.get_Funcature(arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py", "identifier": "Signer.sign", "docstring": "Signs the given string.", "docstring_tokens": ["Signs", "the", "given", "string", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256667}
{"url": "https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L157-L210", "sha": "55246961d805b1f64d661a5c0bae0a216589401f", "docstring_summary": "Maintain a list of courses the user has unenrolled from in the Sailthru user record", "language": "python", "parameters": "(sailthru_client, email, course_url, unenroll)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "arg_4", "=", "arg_0", ".", "api_get", "(", "\"user\"", ",", "{", "\"id\"", ":", "arg_1", ",", "\"fields\"", ":", "{", "\"vars\"", ":", "1", "}", "}", ")", "if", "not", "arg_4", ".", "is_ok", "(", ")", ":", "arg_5", "=", "arg_4", ".", "get_error", "(", ")", "logger", ".", "error", "(", "\"Error attempting to read user record from Sailthru: %s\"", ",", "arg_5", ".", "get_message", "(", ")", ")", "return", "not", "can_retry_sailthru_request", "(", "arg_5", ")", "arg_6", "=", "arg_4", ".", "json", "arg_7", "=", "[", "]", "if", "arg_6", "and", "\"vars\"", "in", "arg_6", "and", "arg_6", "[", "\"vars\"", "]", "and", "\"unenrolled\"", "in", "arg_6", "[", "\"vars\"", "]", ":", "arg_7", "=", "arg_6", "[", "\"vars\"", "]", "[", "\"unenrolled\"", "]", "arg_8", "=", "False", "if", "arg_3", ":", "if", "arg_2", "not", "in", "arg_7", ":", "arg_7", ".", "append", "(", "arg_2", ")", "arg_8", "=", "True", "elif", "arg_2", "in", "arg_7", ":", "arg_7", ".", "remove", "(", "arg_2", ")", "arg_8", "=", "True", "if", "arg_8", ":", "arg_4", "=", "arg_0", ".", "api_post", "(", "'user'", ",", "{", "'id'", ":", "arg_1", ",", "'key'", ":", "'email'", ",", "'vars'", ":", "{", "'unenrolled'", ":", "arg_7", "}", "}", ")", "if", "not", "arg_4", ".", "is_ok", "(", ")", ":", "arg_5", "=", "arg_4", ".", "get_error", "(", ")", "logger", ".", "error", "(", "\"Error attempting to update user record in Sailthru: %s\"", ",", "arg_5", ".", "get_message", "(", ")", ")", "return", "not", "can_retry_sailthru_request", "(", "arg_5", ")", "return", "True", "except", "SailthruClientError", "as", "exc", ":", "logger", ".", "exception", "(", "\"Exception attempting to update user record for %s in Sailthru - %s\"", ",", "arg_1", ",", "text_type", "(", "exc", ")", ")", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Maintain a list of courses the user has unenrolled from in the Sailthru user record\n\n    Arguments:\n        sailthru_client (object): SailthruClient\n        email (str): user's email address\n        course_url (str): LMS url for course info page.\n        unenroll (boolean): True if unenrolling, False if enrolling\n\n    Returns:\n        False if retryable error, else True\n    \"\"\"\n    try:\n        # get the user 'vars' values from sailthru\n        arg_4 = arg_0.api_get(\"user\", {\"id\": arg_1, \"fields\": {\"vars\": 1}})\n        if not arg_4.is_ok():\n            arg_5 = arg_4.get_error()\n            logger.error(\"Error attempting to read user record from Sailthru: %s\", arg_5.get_message())\n            return not can_retry_sailthru_request(arg_5)\n\n        arg_6 = arg_4.json\n\n        arg_7 = []\n        if arg_6 and \"vars\" in arg_6 and arg_6[\"vars\"] \\\n           and \"unenrolled\" in arg_6[\"vars\"]:\n            arg_7 = arg_6[\"vars\"][\"unenrolled\"]\n\n        arg_8 = False\n        # if unenrolling, add course to unenroll list\n        if arg_3:\n            if arg_2 not in arg_7:\n                arg_7.append(arg_2)\n                arg_8 = True\n\n        # if enrolling, remove course from unenroll list\n        elif arg_2 in arg_7:\n            arg_7.remove(arg_2)\n            arg_8 = True\n\n        if arg_8:\n            # write user record back\n            arg_4 = arg_0.api_post(\n                'user', {'id': arg_1, 'key': 'email', 'vars': {'unenrolled': arg_7}})\n\n            if not arg_4.is_ok():\n                arg_5 = arg_4.get_error()\n                logger.error(\"Error attempting to update user record in Sailthru: %s\", arg_5.get_message())\n                return not can_retry_sailthru_request(arg_5)\n\n        return True\n\n    except SailthruClientError as exc:\n        logger.exception(\"Exception attempting to update user record for %s in Sailthru - %s\", arg_1, text_type(exc))\n        return False", "path": "ecommerce_worker/sailthru/v1/tasks.py", "identifier": "_update_unenrolled_list", "docstring": "Maintain a list of courses the user has unenrolled from in the Sailthru user record\n\n    Arguments:\n        sailthru_client (object): SailthruClient\n        email (str): user's email address\n        course_url (str): LMS url for course info page.\n        unenroll (boolean): True if unenrolling, False if enrolling\n\n    Returns:\n        False if retryable error, else True", "docstring_tokens": ["Maintain", "a", "list", "of", "courses", "the", "user", "has", "unenrolled", "from", "in", "the", "Sailthru", "user", "record"], "nwo": "edx/ecommerce-worker", "score": 0.3907502498574038, "idx": 256668}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L884-L917", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Returns the nearest positive semidefinite operator to an operator.", "language": "python", "parameters": "(rho, epsilon=None)", "return_statement": "return rho_wizard", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "0.", "arg_2", "=", "len", "(", "arg_0", ")", "arg_3", "=", "np", ".", "zeros", "(", "[", "arg_2", ",", "arg_2", "]", ")", "arg_4", ",", "arg_5", "=", "np", ".", "linalg", ".", "eigh", "(", "arg_0", ")", "for", "arg_6", "in", "range", "(", "arg_2", ")", ":", "if", "arg_4", "[", "arg_6", "]", "<", "arg_1", ":", "arg_7", "=", "arg_4", "[", "arg_6", "]", "arg_4", "[", "arg_6", "]", "=", "0.", "arg_8", "=", "0.", "for", "arg_9", "in", "range", "(", "arg_6", "+", "1", ",", "arg_2", ")", ":", "arg_8", "+=", "arg_7", "/", "(", "arg_2", "-", "(", "arg_6", "+", "1", ")", ")", "arg_4", "[", "arg_9", "]", "=", "arg_4", "[", "arg_9", "]", "+", "arg_7", "/", "(", "arg_2", "-", "(", "arg_6", "+", "1", ")", ")", "for", "arg_6", "in", "range", "(", "arg_2", ")", ":", "arg_3", "=", "arg_3", "+", "arg_4", "[", "arg_6", "]", "*", "outer", "(", "arg_5", "[", ":", ",", "arg_6", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Returns the nearest positive semidefinite operator to an operator.\n\n    This method is based on reference [1]. It constrains positivity\n    by setting negative eigenvalues to zero and rescaling the positive\n    eigenvalues.\n\n    Args:\n        rho (array_like): the input operator.\n        epsilon(float or None): threshold (>=0) for truncating small\n            eigenvalues values to zero.\n\n    Returns:\n        numpy.array: A positive semidefinite numpy array.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = 0.  # default value\n\n    arg_2 = len(arg_0)\n    arg_3 = np.zeros([arg_2, arg_2])\n    arg_4, arg_5 = np.linalg.eigh(arg_0)  # v eigenvecrors v[0] < v[1] <...\n    for arg_6 in range(arg_2):\n        if arg_4[arg_6] < arg_1:\n            arg_7 = arg_4[arg_6]\n            arg_4[arg_6] = 0.\n            # redistribute loop\n            arg_8 = 0.\n            for arg_9 in range(arg_6 + 1, arg_2):\n                arg_8 += arg_7 / (arg_2 - (arg_6 + 1))\n                arg_4[arg_9] = arg_4[arg_9] + arg_7 / (arg_2 - (arg_6 + 1))\n    for arg_6 in range(arg_2):\n        arg_3 = arg_3 + arg_4[arg_6] * outer(arg_5[:, arg_6])\n    return arg_3", "path": "qiskit/tools/qcvv/tomography.py", "identifier": "__wizard", "docstring": "Returns the nearest positive semidefinite operator to an operator.\n\n    This method is based on reference [1]. It constrains positivity\n    by setting negative eigenvalues to zero and rescaling the positive\n    eigenvalues.\n\n    Args:\n        rho (array_like): the input operator.\n        epsilon(float or None): threshold (>=0) for truncating small\n            eigenvalues values to zero.\n\n    Returns:\n        numpy.array: A positive semidefinite numpy array.", "docstring_tokens": ["Returns", "the", "nearest", "positive", "semidefinite", "operator", "to", "an", "operator", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256669}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanzaprocessor.py#L450-L485", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Install stanza handlers provided by `handler_objects`", "language": "python", "parameters": "(self, handler_objects, usage_restriction)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "\"get\"", ":", "{", "}", ",", "\"set\"", ":", "{", "}", "}", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_1", ":", "if", "not", "isinstance", "(", "arg_6", ",", "XMPPFeatureHandler", ")", ":", "continue", "arg_6", ".", "stanza_processor", "=", "arg_0", "for", "arg_8", ",", "arg_9", "in", "inspect", ".", "getmembers", "(", "arg_6", ",", "callable", ")", ":", "if", "not", "hasattr", "(", "arg_9", ",", "\"_pyxmpp_stanza_handled\"", ")", ":", "continue", "arg_10", ",", "arg_11", "=", "arg_9", ".", "_pyxmpp_stanza_handled", "arg_12", "=", "arg_9", ".", "_pyxmpp_usage_restriction", "if", "arg_12", "and", "arg_12", "!=", "arg_2", ":", "continue", "if", "arg_10", "==", "\"iq\"", ":", "arg_13", "=", "arg_9", ".", "_pyxmpp_payload_class_handled", "arg_14", "=", "arg_9", ".", "_pyxmpp_payload_key", "if", "(", "arg_13", ",", "arg_14", ")", "in", "arg_3", "[", "arg_11", "]", ":", "continue", "arg_3", "[", "arg_11", "]", "[", "(", "arg_13", ",", "arg_14", ")", "]", "=", "arg_9", "continue", "elif", "arg_10", "==", "\"message\"", ":", "arg_15", "=", "arg_4", "elif", "arg_10", "==", "\"presence\"", ":", "arg_15", "=", "arg_5", "else", ":", "raise", "ValueError", ",", "\"Bad handler decoration\"", "arg_15", ".", "append", "(", "arg_9", ")", "with", "arg_0", ".", "lock", ":", "arg_0", ".", "_iq_handlers", "=", "arg_3", "arg_0", ".", "_presence_handlers", "=", "arg_5", "arg_0", ".", "_message_handlers", "=", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Install stanza handlers provided by `handler_objects`\"\"\"\n        # pylint: disable=W0212\n        arg_3 = {\"get\": {}, \"set\": {}}\n        arg_4 = []\n        arg_5 = []\n        for arg_6 in arg_1:\n            if not isinstance(arg_6, XMPPFeatureHandler):\n                continue\n            arg_6.stanza_processor = arg_0\n            for arg_8, arg_9 in inspect.getmembers(arg_6, callable):\n                if not hasattr(arg_9, \"_pyxmpp_stanza_handled\"):\n                    continue\n                arg_10, arg_11 = arg_9._pyxmpp_stanza_handled\n                arg_12 = arg_9._pyxmpp_usage_restriction\n                if arg_12 and arg_12 != arg_2:\n                    continue\n                if arg_10 == \"iq\":\n                    arg_13 = arg_9._pyxmpp_payload_class_handled\n                    arg_14 = arg_9._pyxmpp_payload_key\n                    if (arg_13, arg_14) in arg_3[arg_11]:\n                        continue\n                    arg_3[arg_11][(arg_13, arg_14)] = \\\n                            arg_9\n                    continue\n                elif arg_10 == \"message\":\n                    arg_15 = arg_4\n                elif arg_10 == \"presence\":\n                    arg_15 = arg_5\n                else:\n                    raise ValueError, \"Bad handler decoration\"\n                arg_15.append(arg_9)\n        with arg_0.lock:\n            arg_0._iq_handlers = arg_3\n            arg_0._presence_handlers = arg_5\n            arg_0._message_handlers = arg_4", "path": "pyxmpp2/stanzaprocessor.py", "identifier": "StanzaProcessor.setup_stanza_handlers", "docstring": "Install stanza handlers provided by `handler_objects`", "docstring_tokens": ["Install", "stanza", "handlers", "provided", "by", "handler_objects"], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256670}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2448-L2463", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds a single data item to the pickle result.", "language": "python", "parameters": "(self, name, item)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "v_stored", ":", "arg_0", ".", "_logger", ".", "debug", "(", "'You are changing an already stored result. If '", "'you not explicitly overwrite the data on disk, this change '", "'might be lost and not propagated to disk.'", ")", "if", "arg_1", "==", "PickleResult", ".", "PROTOCOL", ":", "raise", "AttributeError", "(", "'You cannot name an entry `%s`'", "%", "PickleResult", ".", "PROTOCOL", ")", "arg_0", ".", "_data", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Adds a single data item to the pickle result.\n\n         Note that it is NOT checked if the item can be pickled!\n\n        \"\"\"\n\n        if arg_0.v_stored:\n            arg_0._logger.debug('You are changing an already stored result. If '\n                                 'you not explicitly overwrite the data on disk, this change '\n                                 'might be lost and not propagated to disk.')\n\n        if arg_1 == PickleResult.PROTOCOL:\n            raise AttributeError('You cannot name an entry `%s`' % PickleResult.PROTOCOL)\n\n        arg_0._data[arg_1] = arg_2", "path": "pypet/parameter.py", "identifier": "PickleResult.f_set_single", "docstring": "Adds a single data item to the pickle result.\n\n         Note that it is NOT checked if the item can be pickled!", "docstring_tokens": ["Adds", "a", "single", "data", "item", "to", "the", "pickle", "result", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256671}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L749-L779", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "save es and stats", "language": "python", "parameters": "(self, outdir)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "pd", ".", "DataFrame", "(", "arg_0", ".", "resultsOnSamples", ")", "arg_2", ".", "index", ".", "name", "=", "'Term|ES'", "arg_5", "=", "arg_2", "/", "(", "arg_2", ".", "values", ".", "max", "(", ")", "-", "arg_2", ".", "values", ".", "min", "(", ")", ")", "arg_5", "=", "arg_5", ".", "copy", "(", ")", "arg_5", ".", "index", ".", "rename", "(", "'Term|NES'", ",", "inplace", "=", "True", ")", "arg_0", ".", "res2d", "=", "arg_5", "arg_0", ".", "_logger", ".", "info", "(", "\"Congratulations. GSEApy runs successfully................\\n\"", ")", "if", "arg_0", ".", "_outdir", "is", "None", ":", "return", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"gseapy.samples.raw.es.txt\"", ")", "with", "open", "(", "arg_7", ",", "'a'", ")", "as", "f", ":", "if", "arg_0", ".", "scale", ":", "f", ".", "write", "(", "'# scale the enrichment scores by number of genes in the gene sets\\n'", ")", "f", ".", "write", "(", "'# this normalization has not effects on the final NES, '", "+", "'as indicated by Barbie et al., 2009, online methods, pg. 2\\n'", ")", "else", ":", "f", ".", "write", "(", "'# raw enrichment scores of all data\\n'", ")", "f", ".", "write", "(", "'# no scale es by numbers of genes in the gene sets\\n'", ")", "arg_2", ".", "to_csv", "(", "f", ",", "sep", "=", "'\\t'", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"gseapy.samples.normalized.es.txt\"", ")", "with", "open", "(", "arg_8", ",", "'a'", ")", "as", "f", ":", "f", ".", "write", "(", "'# normalize enrichment scores by using the entire data set\\n'", ")", "f", ".", "write", "(", "'# as indicated by Barbie et al., 2009, online methods, pg. 2\\n'", ")", "arg_5", ".", "to_csv", "(", "f", ",", "sep", "=", "'\\t'", ")", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\"save es and stats\"\"\"\n        # save raw ES to one csv file\n        arg_2 = pd.DataFrame(arg_0.resultsOnSamples)\n        arg_2.index.name = 'Term|ES'\n        # normalize enrichment scores by using the entire data set, as indicated\n        # by Barbie et al., 2009, online methods, pg. 2\n        arg_5 = arg_2 / (arg_2.values.max() - arg_2.values.min())\n        arg_5 = arg_5.copy()\n        arg_5.index.rename('Term|NES', inplace=True)\n        arg_0.res2d = arg_5\n        arg_0._logger.info(\"Congratulations. GSEApy runs successfully................\\n\")\n        if arg_0._outdir is None: return\n        # write es\n        arg_7 = os.path.join(arg_1, \"gseapy.samples.raw.es.txt\")\n        with open(arg_7, 'a') as f:\n            if arg_0.scale:\n                f.write('# scale the enrichment scores by number of genes in the gene sets\\n')\n                f.write('# this normalization has not effects on the final NES, ' + \\\n                        'as indicated by Barbie et al., 2009, online methods, pg. 2\\n')\n            else:\n                f.write('# raw enrichment scores of all data\\n')\n                f.write('# no scale es by numbers of genes in the gene sets\\n')\n            arg_2.to_csv(f, sep='\\t')\n\n        arg_8 = os.path.join(arg_1, \"gseapy.samples.normalized.es.txt\")\n        with open(arg_8, 'a') as f:\n            f.write('# normalize enrichment scores by using the entire data set\\n')\n            f.write('# as indicated by Barbie et al., 2009, online methods, pg. 2\\n')\n            arg_5.to_csv(f, sep='\\t')\n        return", "path": "gseapy/gsea.py", "identifier": "SingleSampleGSEA._save", "docstring": "save es and stats", "docstring_tokens": ["save", "es", "and", "stats"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 256672}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/amazon/api.py#L395-L410", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Safe get element text.", "language": "python", "parameters": "(self, path, root=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "_safe_get_element", "(", "arg_1", ",", "arg_2", ")", "if", "arg_3", ":", "return", "arg_3", ".", "text", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Safe get element text.\n\n        Get element as string or None,\n        :param root:\n            Lxml element.\n        :param path:\n            String path (i.e. 'Items.Item.Offers.Offer').\n        :return:\n            String or None.\n        \"\"\"\n        arg_3 = arg_0._safe_get_element(arg_1, arg_2)\n        if arg_3:\n            return arg_3.text\n        else:\n            return None", "path": "capybara/virtualenv/lib/python2.7/site-packages/amazon/api.py", "identifier": "AmazonProduct._safe_get_element_text", "docstring": "Safe get element text.\n\n        Get element as string or None,\n        :param root:\n            Lxml element.\n        :param path:\n            String path (i.e. 'Items.Item.Offers.Offer').\n        :return:\n            String or None.", "docstring_tokens": ["Safe", "get", "element", "text", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256673}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/primitive.py#L234-L253", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Pretting print a parse tree.", "language": "python", "parameters": "(root, depth=0, space_unit=\"    \", *, source_len=0, file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "\"    \"", ",", "*", ",", "arg_3", "=", "0", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_2", "*", "arg_1", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "print", "(", "\"{0}terminal@(?): {1}\"", ".", "format", "(", "arg_5", ",", "arg_0", ")", ",", "arg_4", "=", "arg_4", ")", "else", ":", "if", "arg_0", ".", "position", "is", "None", ":", "arg_6", "=", "-", "1", "elif", "arg_0", ".", "position", "<", "0", ":", "arg_6", "=", "arg_3", "+", "arg_0", ".", "position", "else", ":", "arg_6", "=", "arg_0", ".", "position", "if", "arg_0", ".", "is_value", ":", "print", "(", "\"{0}{1}@({2}:{3}):\\t{4}\"", ".", "format", "(", "arg_5", ",", "arg_0", ".", "node_type", ",", "arg_6", ",", "arg_0", ".", "consumed", ",", "arg_0", ".", "svalue", ")", ",", "arg_4", "=", "arg_4", ")", "else", ":", "print", "(", "\"{0}{1}@({2}:{3}):\"", ".", "format", "(", "arg_5", ",", "arg_0", ".", "node_type", ",", "arg_6", ",", "arg_0", ".", "consumed", ")", ",", "arg_4", "=", "arg_4", ")", "for", "arg_7", "in", "arg_0", ".", "children", ":", "Func", "(", "arg_7", ",", "arg_1", "+", "1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=\"    \", *, arg_3=0, arg_4=None):\n  \"\"\"Pretting print a parse tree.\"\"\"\n  arg_5 = arg_2 * arg_1\n\n  if isinstance(arg_0, str):\n    print(\"{0}terminal@(?): {1}\".format(arg_5, arg_0), arg_4=arg_4)\n  else:\n    if arg_0.position is None:\n      arg_6 = -1\n    elif arg_0.position < 0:\n      arg_6 = arg_3 + arg_0.position\n    else:\n      arg_6 = arg_0.position\n\n    if arg_0.is_value:\n      print(\"{0}{1}@({2}:{3}):\\t{4}\".format(arg_5, arg_0.node_type, arg_6, arg_0.consumed, arg_0.svalue), arg_4=arg_4)\n    else:\n      print(\"{0}{1}@({2}:{3}):\".format(arg_5, arg_0.node_type, arg_6, arg_0.consumed), arg_4=arg_4)\n      for arg_7 in arg_0.children:\n        Func(arg_7, arg_1 + 1, arg_3=arg_3, arg_4=arg_4)", "path": "pyebnf/primitive.py", "identifier": "pprint", "docstring": "Pretting print a parse tree.", "docstring_tokens": ["Pretting", "print", "a", "parse", "tree", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 256674}
{"url": "https://github.com/alpacahq/alpaca-trade-api-python/blob/9c9dea3b4a37c909f88391b202e86ff356a8b4d7/alpaca_trade_api/rest.py#L215-L218", "sha": "9c9dea3b4a37c909f88391b202e86ff356a8b4d7", "docstring_summary": "Get an open position", "language": "python", "parameters": "(self, symbol)", "return_statement": "return Position(resp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get", "(", "'/positions/{}'", ".", "format", "(", "arg_1", ")", ")", "return", "Position", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        '''Get an open position'''\n        arg_2 = arg_0.get('/positions/{}'.format(arg_1))\n        return Position(arg_2)", "path": "alpaca_trade_api/rest.py", "identifier": "REST.get_position", "docstring": "Get an open position", "docstring_tokens": ["Get", "an", "open", "position"], "nwo": "alpacahq/alpaca-trade-api-python", "score": 0.9697751514981866, "idx": 256675}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L218-L225", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get a board", "language": "python", "parameters": "(self, id, name=None)", "return_statement": "return self.create_board(dict(id=id, name=name))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "create_board", "(", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Get a board\n\n        Returns:\n            Board: The board with the given `id`\n        '''\n        return arg_0.create_board(dict(arg_1=arg_1, arg_2=arg_2))", "path": "trolly/client.py", "identifier": "Client.get_board", "docstring": "Get a board\n\n        Returns:\n            Board: The board with the given `id`", "docstring_tokens": ["Get", "a", "board"], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 256676}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/psfcalc.py#L27-L55", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Returns Gauss-Laguerre quadrature points rescaled for line scan integration", "language": "python", "parameters": "(npts=20)", "return_statement": "return pts, wts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "20", ")", ":", "arg_1", "=", "{", "15", ":", "0.072144", ",", "20", ":", "0.051532", ",", "25", ":", "0.043266", "}", "[", "arg_0", "]", "arg_2", ",", "arg_3", "=", "np", ".", "polynomial", ".", "laguerre", ".", "laggauss", "(", "arg_0", ")", "arg_4", "=", "np", ".", "sinh", "(", "arg_2", "*", "arg_1", ")", "arg_5", "=", "arg_1", "*", "arg_3", "*", "np", ".", "cosh", "(", "arg_2", "*", "arg_1", ")", "*", "np", ".", "exp", "(", "arg_2", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0=20):\n    \"\"\"\n    Returns Gauss-Laguerre quadrature points rescaled for line scan integration\n\n    Parameters\n    ----------\n        npts : {15, 20, 25}, optional\n            The number of points to\n\n    Notes\n    -----\n        The scale is set internally as the best rescaling for a line scan\n        integral; it was checked numerically for the allowed npts.\n        Acceptable pts/scls/approximate line integral scan error:\n        (pts,   scl  )      :         ERR\n        ------------------------------------\n        (15, 0.072144)      :       0.002193\n        (20, 0.051532)      :       0.001498\n        (25, 0.043266)      :       0.001209\n\n        The previous HG(20) error was ~0.13ish\n    \"\"\"\n    arg_1 = { 15:0.072144,\n            20:0.051532,\n            25:0.043266}[arg_0]\n    arg_2, arg_3 = np.polynomial.laguerre.laggauss(arg_0)\n    arg_4 = np.sinh(arg_2*arg_1)\n    arg_5 = arg_1*arg_3*np.cosh(arg_2*arg_1)*np.exp(arg_2)\n    return arg_4, arg_5", "path": "peri/comp/psfcalc.py", "identifier": "calc_pts_lag", "docstring": "Returns Gauss-Laguerre quadrature points rescaled for line scan integration\n\n    Parameters\n    ----------\n        npts : {15, 20, 25}, optional\n            The number of points to\n\n    Notes\n    -----\n        The scale is set internally as the best rescaling for a line scan\n        integral; it was checked numerically for the allowed npts.\n        Acceptable pts/scls/approximate line integral scan error:\n        (pts,   scl  )      :         ERR\n        ------------------------------------\n        (15, 0.072144)      :       0.002193\n        (20, 0.051532)      :       0.001498\n        (25, 0.043266)      :       0.001209\n\n        The previous HG(20) error was ~0.13ish", "docstring_tokens": ["Returns", "Gauss", "-", "Laguerre", "quadrature", "points", "rescaled", "for", "line", "scan", "integration"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 256677}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/appengine.py#L96-L116", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Return the secret key for use for XSRF protection.", "language": "python", "parameters": "()", "return_statement": "return str(secret)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "memcache", ".", "get", "(", "XSRF_MEMCACHE_ID", ",", "namespace", "=", "OAUTH2CLIENT_NAMESPACE", ")", "if", "not", "arg_0", ":", "arg_1", "=", "SiteXsrfSecretKey", ".", "get_or_insert", "(", "key_name", "=", "'site'", ")", "if", "not", "arg_1", ".", "secret", ":", "arg_1", ".", "secret", "=", "_generate_new_Func", "(", ")", "arg_1", ".", "put", "(", ")", "arg_0", "=", "arg_1", ".", "secret", "memcache", ".", "add", "(", "XSRF_MEMCACHE_ID", ",", "arg_0", ",", "namespace", "=", "OAUTH2CLIENT_NAMESPACE", ")", "return", "str", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"Return the secret key for use for XSRF protection.\n\n    If the Site entity does not have a secret key, this method will also create\n    one and persist it.\n\n    Returns:\n        The secret key.\n    \"\"\"\n    arg_0 = memcache.get(XSRF_MEMCACHE_ID, namespace=OAUTH2CLIENT_NAMESPACE)\n    if not arg_0:\n        # Load the one and only instance of SiteXsrfSecretKey.\n        arg_1 = SiteXsrfSecretKey.get_or_insert(key_name='site')\n        if not arg_1.secret:\n            arg_1.secret = _generate_new_Func()\n            arg_1.put()\n        arg_0 = arg_1.secret\n        memcache.add(XSRF_MEMCACHE_ID, arg_0,\n                     namespace=OAUTH2CLIENT_NAMESPACE)\n\n    return str(arg_0)", "path": "oauth2client/contrib/appengine.py", "identifier": "xsrf_secret_key", "docstring": "Return the secret key for use for XSRF protection.\n\n    If the Site entity does not have a secret key, this method will also create\n    one and persist it.\n\n    Returns:\n        The secret key.", "docstring_tokens": ["Return", "the", "secret", "key", "for", "use", "for", "XSRF", "protection", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 256678}
{"url": "https://github.com/asciimoo/exrex/blob/69733409042b526da584c675907a316ad708a8d4/exrex.py#L396-L407", "sha": "69733409042b526da584c675907a316ad708a8d4", "docstring_summary": "Regular expression parser", "language": "python", "parameters": "(s)", "return_statement": "return list(r)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "IS_PY3", ":", "arg_1", "=", "sre_Func", ".", "Func", "(", "arg_0", ",", "flags", "=", "U", ")", "else", ":", "arg_1", "=", "sre_Func", ".", "Func", "(", "arg_0", ".", "decode", "(", "'utf-8'", ")", ",", "flags", "=", "U", ")", "return", "list", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Regular expression Funcr\n\n    :param s: Regular expression\n    :type s: str\n    :rtype: list\n    \"\"\"\n    if IS_PY3:\n        arg_1 = sre_Func.Func(arg_0, flags=U)\n    else:\n        arg_1 = sre_Func.Func(arg_0.decode('utf-8'), flags=U)\n    return list(arg_1)", "path": "exrex.py", "identifier": "parse", "docstring": "Regular expression parser\n\n    :param s: Regular expression\n    :type s: str\n    :rtype: list", "docstring_tokens": ["Regular", "expression", "parser"], "nwo": "asciimoo/exrex", "score": 0.7374643124468765, "idx": 256679}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_annotation.py#L75-L117", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept\n    other genome builds, but the output VCF is based on hg19.", "language": "python", "parameters": "(job, vcf_id, oncotator_db)", "return_statement": "return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'annotated.vcf'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "fileStore", ".", "logToMaster", "(", "'Running Oncotator'", ")", "arg_3", "=", "{", "'input.vcf'", ":", "arg_1", ",", "'oncotator_db'", ":", "arg_2", "}", "arg_4", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "for", "arg_5", ",", "arg_6", "in", "arg_3", ".", "iteritems", "(", ")", ":", "arg_3", "[", "arg_5", "]", "=", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_6", ",", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_5", ")", ")", "if", "tarfile", ".", "is_tarfile", "(", "arg_3", "[", "'oncotator_db'", "]", ")", ":", "arg_7", "=", "tarfile", ".", "open", "(", "arg_3", "[", "'oncotator_db'", "]", ")", "arg_7", ".", "extractall", "(", "path", "=", "arg_4", ")", "arg_3", "[", "'oncotator_db'", "]", "=", "arg_7", ".", "getmembers", "(", ")", "[", "0", "]", ".", "name", "arg_7", ".", "close", "(", ")", "arg_8", "=", "[", "'-i'", ",", "'VCF'", ",", "'-o'", ",", "'VCF'", ",", "'--db-dir'", ",", "arg_3", "[", "'oncotator_db'", "]", ",", "'input.vcf'", ",", "'annotated.vcf'", ",", "'hg19'", "]", "arg_9", "=", "[", "'--rm'", ",", "'log-driver'", ",", "'none'", ",", "'-e'", ",", "'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'", ".", "format", "(", "arg_0", ".", "memory", ")", "]", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "workDir", "=", "arg_4", ",", "parameters", "=", "arg_8", ",", "tool", "=", "'jpfeil/oncotator:1.9--8fffc356981862d50cfacd711b753700b886b605'", ",", "dockerParameters", "=", "arg_9", ")", "return", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "'annotated.vcf'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept\n    other genome builds, but the output VCF is based on hg19.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str vcf_id: FileStoreID for VCF file\n    :param str oncotator_db: FileStoreID for Oncotator database\n    :return: Annotated VCF FileStoreID\n    :rtype: str\n    \"\"\"\n    arg_0.fileStore.logToMaster('Running Oncotator')\n\n    arg_3 = {'input.vcf': arg_1,\n              'oncotator_db': arg_2}\n\n    arg_4 = arg_0.fileStore.getLocalTempDir()\n    for arg_5, arg_6 in arg_3.iteritems():\n        arg_3[arg_5] = arg_0.fileStore.readGlobalFile(arg_6, os.path.join(arg_4, arg_5))\n\n    # The Oncotator database may be tar/gzipped\n    if tarfile.is_tarfile(arg_3['oncotator_db']):\n        arg_7 = tarfile.open(arg_3['oncotator_db'])\n        arg_7.extractall(path=arg_4)\n        # Get the extracted database directory name\n        arg_3['oncotator_db'] = arg_7.getmembers()[0].name\n        arg_7.close()\n\n    arg_8 = ['-i', 'VCF',\n               '-o', 'VCF',\n               '--db-dir', arg_3['oncotator_db'],\n               'input.vcf',\n               'annotated.vcf',\n               'hg19']  # Oncotator annotations are based on hg19\n\n    arg_9 = ['--rm', 'log-driver', 'none',\n                         '-e', 'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'.format(arg_0.memory)]\n    dockerCall(arg_0=arg_0, workDir=arg_4,\n               parameters=arg_8,\n               tool='jpfeil/oncotator:1.9--8fffc356981862d50cfacd711b753700b886b605',\n               dockerParameters=arg_9)\n\n    return arg_0.fileStore.writeGlobalFile(os.path.join(arg_4, 'annotated.vcf'))", "path": "src/toil_lib/tools/variant_annotation.py", "identifier": "run_oncotator", "docstring": "Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept\n    other genome builds, but the output VCF is based on hg19.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str vcf_id: FileStoreID for VCF file\n    :param str oncotator_db: FileStoreID for Oncotator database\n    :return: Annotated VCF FileStoreID\n    :rtype: str", "docstring_tokens": ["Uses", "Oncotator", "to", "add", "cancer", "relevant", "variant", "annotations", "to", "a", "VCF", "file", ".", "Oncotator", "can", "accept", "other", "genome", "builds", "but", "the", "output", "VCF", "is", "based", "on", "hg19", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 256680}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/sets.py#L72-L88", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "self.mask setter", "language": "python", "parameters": "(self, image)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "_mask", "=", "None", "try", ":", "Func", "=", "load_mask", "(", "arg_1", ")", "except", "Exception", "as", "exc", ":", "raise", "Exception", "(", "'Could not load mask image {}.'", ".", "format", "(", "arg_1", ")", ")", "from", "exc", "else", ":", "arg_0", ".", "_mask", "=", "Func"], "function": "def Func(arg_0, arg_1):\n        \"\"\" self.mask setter\n\n        Parameters\n        ----------\n        image: str or img-like object.\n            See NeuroImage constructor docstring.\n        \"\"\"\n        if arg_1 is None:\n            arg_0._mask = None\n\n        try:\n            Func = load_mask(arg_1)\n        except Exception as exc:\n            raise Exception('Could not load mask image {}.'.format(arg_1)) from exc\n        else:\n            arg_0._mask = Func", "path": "boyle/nifti/sets.py", "identifier": "NeuroImageSet.mask", "docstring": "self.mask setter\n\n        Parameters\n        ----------\n        image: str or img-like object.\n            See NeuroImage constructor docstring.", "docstring_tokens": ["self", ".", "mask", "setter"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 256681}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L614-L642", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get datetime of the next retry if the task instance fails. For exponential\n        backoff, retry_delay is used as base and will be converted to seconds.", "language": "python", "parameters": "(self)", "return_statement": "return self.end_date + delay", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "task", ".", "retry_delay", "if", "arg_0", ".", "task", ".", "retry_exponential_backoff", ":", "arg_2", "=", "int", "(", "arg_1", ".", "total_seconds", "(", ")", "*", "(", "2", "**", "(", "arg_0", ".", "try_number", "-", "2", ")", ")", ")", "arg_3", "=", "int", "(", "hashlib", ".", "sha1", "(", "\"{}#{}#{}#{}\"", ".", "format", "(", "arg_0", ".", "dag_id", ",", "arg_0", ".", "task_id", ",", "arg_0", ".", "execution_date", ",", "arg_0", ".", "try_number", ")", ".", "encode", "(", "'utf-8'", ")", ")", ".", "hexdigest", "(", ")", ",", "16", ")", "arg_4", "=", "arg_2", "+", "arg_3", "%", "arg_2", "arg_5", "=", "min", "(", "arg_4", ",", "timedelta", ".", "max", ".", "total_seconds", "(", ")", "-", "1", ")", "arg_1", "=", "timedelta", "(", "seconds", "=", "arg_5", ")", "if", "arg_0", ".", "task", ".", "max_retry_delay", ":", "arg_1", "=", "min", "(", "arg_0", ".", "task", ".", "max_retry_delay", ",", "arg_1", ")", "return", "arg_0", ".", "end_date", "+", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Get datetime of the next retry if the task instance fails. For exponential\n        backoff, retry_delay is used as base and will be converted to seconds.\n        \"\"\"\n        arg_1 = arg_0.task.retry_delay\n        if arg_0.task.retry_exponential_backoff:\n            arg_2 = int(arg_1.total_seconds() * (2 ** (arg_0.try_number - 2)))\n            # deterministic per task instance\n            arg_3 = int(hashlib.sha1(\"{}#{}#{}#{}\".format(arg_0.dag_id,\n                                                         arg_0.task_id,\n                                                         arg_0.execution_date,\n                                                         arg_0.try_number)\n                                    .encode('utf-8')).hexdigest(), 16)\n            # between 0.5 * delay * (2^retry_number) and 1.0 * delay * (2^retry_number)\n            arg_4 = arg_2 + arg_3 % arg_2\n            # timedelta has a maximum representable value. The exponentiation\n            # here means this value can be exceeded after a certain number\n            # of tries (around 50 if the initial delay is 1s, even fewer if\n            # the delay is larger). Cap the value here before creating a\n            # timedelta object so the operation doesn't fail.\n            arg_5 = min(\n                arg_4,\n                timedelta.max.total_seconds() - 1\n            )\n            arg_1 = timedelta(seconds=arg_5)\n            if arg_0.task.max_retry_delay:\n                arg_1 = min(arg_0.task.max_retry_delay, arg_1)\n        return arg_0.end_date + arg_1", "path": "airflow/models/taskinstance.py", "identifier": "TaskInstance.next_retry_datetime", "docstring": "Get datetime of the next retry if the task instance fails. For exponential\n        backoff, retry_delay is used as base and will be converted to seconds.", "docstring_tokens": ["Get", "datetime", "of", "the", "next", "retry", "if", "the", "task", "instance", "fails", ".", "For", "exponential", "backoff", "retry_delay", "is", "used", "as", "base", "and", "will", "be", "converted", "to", "seconds", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256682}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/db.py#L242-L252", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Delete model.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_0", ".", "_fill_project_info", "(", "arg_1", ")", "arg_0", ".", "db", ".", "Model", ".", "delete_many", "(", "arg_1", ")", "logging", ".", "info", "(", "\"[Database] Delete Model SUCCESS\"", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Delete model.\n\n        Parameters\n        -----------\n        kwargs : logging information\n            Find items to delete, leave it empty to delete all log.\n        \"\"\"\n        arg_0._fill_project_info(arg_1)\n        arg_0.db.Model.delete_many(arg_1)\n        logging.info(\"[Database] Delete Model SUCCESS\")", "path": "tensorlayer/db.py", "identifier": "TensorHub.delete_model", "docstring": "Delete model.\n\n        Parameters\n        -----------\n        kwargs : logging information\n            Find items to delete, leave it empty to delete all log.", "docstring_tokens": ["Delete", "model", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 256683}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/missing-particle.py#L11-L19", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "create a two particle state and compare it to featuring using a single particle guess", "language": "python", "parameters": "(separation=0.0, radius=RADIUS, SNR=20)", "return_statement": "return s, s.obj.pos.copy()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0.0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "20", ")", ":", "arg_4", "=", "init", ".", "create_two_particle_state", "(", "imsize", "=", "6", "*", "arg_1", "+", "4", ",", "axis", "=", "'x'", ",", "sigma", "=", "1.0", "/", "arg_3", ",", "delta", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "stateargs", "=", "{", "'varyn'", ":", "True", "}", ",", "psfargs", "=", "{", "'error'", ":", "1e-6", "}", ")", "arg_4", ".", "obj", ".", "typ", "[", "1", "]", "=", "0.", "arg_4", ".", "reset", "(", ")", "return", "arg_4", ",", "arg_4", ".", "obj", ".", "pos", ".", "copy", "(", ")"], "function": "def Func(arg_0=0.0, arg_1=arg_2, arg_3=20):\n    \"\"\" create a two particle state and compare it to featuring using a single particle guess \"\"\"\n    # create a base image of one particle\n    arg_4 = init.create_two_particle_state(imsize=6*arg_1+4, axis='x', sigma=1.0/arg_3,\n            delta=arg_0, arg_1=arg_1, stateargs={'varyn': True}, psfargs={'error': 1e-6})\n    arg_4.obj.typ[1] = 0.\n    arg_4.reset()\n\n    return arg_4, arg_4.obj.pos.copy()", "path": "scripts/does_matter/missing-particle.py", "identifier": "missing_particle", "docstring": "create a two particle state and compare it to featuring using a single particle guess", "docstring_tokens": ["create", "a", "two", "particle", "state", "and", "compare", "it", "to", "featuring", "using", "a", "single", "particle", "guess"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 256684}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfobjects/pdffont.py#L47-L68", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Style should be a string, containing the letters 'B' for bold,\r\n        'U' for underline, or 'I' for italic, or should be '', for no style.\r\n        Symbol will not be underlined. The underline style can further be\r\n        modified by specifying the underline thickness and position.", "language": "python", "parameters": "(self, style=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "style", "=", "''", "arg_0", ".", "underline", "=", "False", "elif", "arg_0", ".", "family", "==", "(", "'symbol'", "or", "'zapfdingbats'", ")", ":", "arg_0", ".", "style", "=", "''", "arg_0", ".", "underline", "=", "False", "arg_0", ".", "style", "=", "arg_1", ".", "upper", "(", ")", "if", "'U'", "in", "arg_0", ".", "style", "or", "arg_0", ".", "style", "==", "'U'", ":", "arg_0", ".", "underline", "=", "True", "else", ":", "arg_0", ".", "underline", "=", "False"], "function": "def Func(arg_0, arg_1=None):\r\n        \"\"\" Style should be a string, containing the letters 'B' for bold,\r\n        'U' for underline, or 'I' for italic, or should be '', for no style.\r\n        Symbol will not be underlined. The underline style can further be\r\n        modified by specifying the underline thickness and position.\r\n\r\n        \"\"\"\r\n        if arg_1 is None:\r\n            arg_0.style = ''\r\n            arg_0.underline = False\r\n        # No syling for symbol\r\n        elif arg_0.family == ('symbol' or 'zapfdingbats'):\r\n            arg_0.style = ''\r\n            arg_0.underline = False\r\n\r\n        arg_0.style = arg_1.upper()\r\n            # SetUnderline\r\n\r\n        if 'U' in arg_0.style or arg_0.style == 'U':\r\n            arg_0.underline = True\r\n        else:\r\n            arg_0.underline = False", "path": "pypdflite/pdfobjects/pdffont.py", "identifier": "PDFFont._set_style", "docstring": "Style should be a string, containing the letters 'B' for bold,\r\n        'U' for underline, or 'I' for italic, or should be '', for no style.\r\n        Symbol will not be underlined. The underline style can further be\r\n        modified by specifying the underline thickness and position.", "docstring_tokens": ["Style", "should", "be", "a", "string", "containing", "the", "letters", "B", "for", "bold", "U", "for", "underline", "or", "I", "for", "italic", "or", "should", "be", "for", "no", "style", ".", "Symbol", "will", "not", "be", "underlined", ".", "The", "underline", "style", "can", "further", "be", "modified", "by", "specifying", "the", "underline", "thickness", "and", "position", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 256685}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/base_profiler.py#L101-L108", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Determines run object type.", "language": "python", "parameters": "(run_object)", "return_statement": "return 'module'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "return", "'function'", "arg_0", ",", "arg_1", ",", "arg_1", "=", "arg_0", ".", "partition", "(", "' '", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "return", "'package'", "return", "'module'"], "function": "def Func(arg_0):\n        \"\"\"Determines run object type.\"\"\"\n        if isinstance(arg_0, tuple):\n            return 'function'\n        arg_0, arg_1, arg_1 = arg_0.partition(' ')\n        if os.path.isdir(arg_0):\n            return 'package'\n        return 'module'", "path": "vprof/base_profiler.py", "identifier": "BaseProfiler.get_run_object_type", "docstring": "Determines run object type.", "docstring_tokens": ["Determines", "run", "object", "type", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 256686}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L189-L194", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Captures memory written by Unicorn", "language": "python", "parameters": "(self, uc, access, address, size, value, data)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_0", ".", "_mem_delta", "[", "arg_3", "]", "=", "(", "arg_5", ",", "arg_4", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        \"\"\"\n        Captures memory written by Unicorn\n        \"\"\"\n        arg_0._mem_delta[arg_3] = (arg_5, arg_4)\n        return True", "path": "manticore/utils/emulate.py", "identifier": "ConcreteUnicornEmulator._hook_write_mem", "docstring": "Captures memory written by Unicorn", "docstring_tokens": ["Captures", "memory", "written", "by", "Unicorn"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256687}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L1266-L1283", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns a randomly generated permanence value for a synapses that is\n    initialized in a connected state. The basic idea here is to initialize\n    permanence values very close to synPermConnected so that a small number of\n    learning steps could make it disconnected or connected.", "language": "python", "parameters": "(self)", "return_statement": "return p", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_synPermConnected", "+", "(", "arg_0", ".", "_synPermMax", "-", "arg_0", ".", "_synPermConnected", ")", "*", "arg_0", ".", "_random", ".", "getReal64", "(", ")", "arg_1", "=", "int", "(", "arg_1", "*", "100000", ")", "/", "100000.0", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns a randomly generated permanence value for a synapses that is\n    initialized in a connected state. The basic idea here is to initialize\n    permanence values very close to synPermConnected so that a small number of\n    learning steps could make it disconnected or connected.\n\n    Note: experimentation was done a long time ago on the best way to initialize\n    permanence values, but the history for this particular scheme has been lost.\n    \"\"\"\n    arg_1 = arg_0._synPermConnected + (\n        arg_0._synPermMax - arg_0._synPermConnected)*arg_0._random.getReal64()\n\n    # Ensure we don't have too much unnecessary precision. A full 64 bits of\n    # precision causes numerical stability issues across platforms and across\n    # implementations\n    arg_1 = int(arg_1*100000) / 100000.0\n    return arg_1", "path": "src/nupic/algorithms/spatial_pooler.py", "identifier": "SpatialPooler._initPermConnected", "docstring": "Returns a randomly generated permanence value for a synapses that is\n    initialized in a connected state. The basic idea here is to initialize\n    permanence values very close to synPermConnected so that a small number of\n    learning steps could make it disconnected or connected.\n\n    Note: experimentation was done a long time ago on the best way to initialize\n    permanence values, but the history for this particular scheme has been lost.", "docstring_tokens": ["Returns", "a", "randomly", "generated", "permanence", "value", "for", "a", "synapses", "that", "is", "initialized", "in", "a", "connected", "state", ".", "The", "basic", "idea", "here", "is", "to", "initialize", "permanence", "values", "very", "close", "to", "synPermConnected", "so", "that", "a", "small", "number", "of", "learning", "steps", "could", "make", "it", "disconnected", "or", "connected", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256688}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L666-L689", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Recursively copy a directory tree.", "language": "python", "parameters": "(source_dir, target_dir, override=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "_AssertIsLocal", "(", "arg_0", ")", "_AssertIsLocal", "(", "arg_1", ")", "if", "arg_2", "and", "IsDir", "(", "arg_1", ")", ":", "DeleteDirectory", "(", "arg_1", ",", "skip_on_error", "=", "False", ")", "import", "shutil", "shutil", ".", "copytree", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    '''\n    Recursively copy a directory tree.\n\n    :param unicode source_dir:\n        Where files will come from\n\n    :param unicode target_dir:\n        Where files will go to\n\n    :param bool override:\n        If True and target_dir already exists, it will be deleted before copying.\n\n    :raises NotImplementedForRemotePathError:\n        If trying to copy to/from remote directories\n    '''\n    _AssertIsLocal(arg_0)\n    _AssertIsLocal(arg_1)\n\n    if arg_2 and IsDir(arg_1):\n        DeleteDirectory(arg_1, skip_on_error=False)\n\n    import shutil\n    shutil.copytree(arg_0, arg_1)", "path": "zerotk/easyfs/_easyfs.py", "identifier": "CopyDirectory", "docstring": "Recursively copy a directory tree.\n\n    :param unicode source_dir:\n        Where files will come from\n\n    :param unicode target_dir:\n        Where files will go to\n\n    :param bool override:\n        If True and target_dir already exists, it will be deleted before copying.\n\n    :raises NotImplementedForRemotePathError:\n        If trying to copy to/from remote directories", "docstring_tokens": ["Recursively", "copy", "a", "directory", "tree", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 256689}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/util.py#L31-L58", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Produces a callable so that functions can be lazily evaluated in\n    templates.", "language": "python", "parameters": "(function, *args, **kwargs)", "return_statement": "return evaluate", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "object", "(", ")", "arg_4", "=", "[", "arg_3", "]", "def", "evaluate", "(", ")", ":", "if", "arg_4", "[", "0", "]", "is", "arg_3", ":", "arg_4", "[", "0", "]", "=", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "arg_4", "[", "0", "]", "return", "evaluate"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    ''' Produces a callable so that functions can be lazily evaluated in\n    templates.\n\n    Arguments:\n\n        function (callable): The function to call at evaluation time.\n\n        args: Positional arguments, passed directly to ``function``.\n\n        kwargs: Keyword arguments, passed directly to ``function``.\n\n    Return:\n\n        callable: A callable that will evaluate a call to ``function`` with\n            the specified arguments.\n\n    '''\n\n    arg_3 = object()\n    arg_4 = [arg_3]\n\n    def evaluate():\n        if arg_4[0] is arg_3:\n            arg_4[0] = arg_0(*arg_1, **arg_2)\n        return arg_4[0]\n\n    return evaluate", "path": "registrasion/util.py", "identifier": "lazy", "docstring": "Produces a callable so that functions can be lazily evaluated in\n    templates.\n\n    Arguments:\n\n        function (callable): The function to call at evaluation time.\n\n        args: Positional arguments, passed directly to ``function``.\n\n        kwargs: Keyword arguments, passed directly to ``function``.\n\n    Return:\n\n        callable: A callable that will evaluate a call to ``function`` with\n            the specified arguments.", "docstring_tokens": ["Produces", "a", "callable", "so", "that", "functions", "can", "be", "lazily", "evaluated", "in", "templates", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 256690}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/math/custom_gradient.py#L39-L133", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Embeds a custom gradient into a `Tensor`.", "language": "python", "parameters": "(fx, gx, x, fx_gx_manually_stopped=False, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "def", "maybe_stop", "(", "arg_2", ")", ":", "if", "arg_3", ":", "return", "arg_2", "return", "tf", ".", "stop_gradient", "(", "arg_2", ")", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_4", ",", "'Func'", ",", "[", "arg_0", ",", "arg_1", ",", "arg_2", "]", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_4", "=", "'fx'", ")", "with", "tf", ".", "control_dependencies", "(", "[", "arg_0", "]", ")", ":", "if", "is_list_like", "(", "arg_2", ")", ":", "arg_2", "=", "[", "identity", "(", "arg_6", ",", "arg_4", "=", "'x'", ")", "for", "arg_6", "in", "arg_2", "]", "else", ":", "arg_2", "=", "[", "identity", "(", "arg_2", ",", "arg_4", "=", "'x'", ")", "]", "if", "is_list_like", "(", "arg_1", ")", ":", "arg_1", "=", "[", "identity", "(", "arg_7", ",", "dtype", "=", "arg_0", ".", "dtype", ",", "arg_4", "=", "'gx'", ")", "for", "arg_7", "in", "arg_1", "]", "else", ":", "arg_1", "=", "[", "identity", "(", "arg_1", ",", "dtype", "=", "arg_0", ".", "dtype", ",", "arg_4", "=", "'gx'", ")", "]", "arg_5", "=", "[", "]", "for", "arg_6", ",", "arg_7", "in", "zip", "(", "arg_2", ",", "arg_1", ")", ":", "arg_8", "=", "tf", ".", "compat", ".", "v1", ".", "assert_equal", "(", "tf", ".", "shape", "(", "input", "=", "arg_6", ")", ",", "tf", ".", "shape", "(", "input", "=", "arg_7", ")", ",", "message", "=", "'Each `x` must have the same shape as each `gx`.'", ")", "with", "tf", ".", "control_dependencies", "(", "[", "arg_8", "]", ")", ":", "arg_9", "=", "arg_6", "-", "tf", ".", "stop_gradient", "(", "arg_6", ")", "arg_5", ".", "append", "(", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "maybe_stop", "(", "arg_7", ")", "*", "arg_9", ")", ")", "arg_5", "=", "sum", "(", "arg_5", ")", "arg_5", "/=", "tf", ".", "cast", "(", "tf", ".", "size", "(", "input", "=", "arg_0", ")", ",", "dtype", "=", "arg_0", ".", "dtype", ".", "base_dtype", ")", "return", "maybe_stop", "(", "arg_0", ")", "+", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=None):\n  \"\"\"Embeds a custom gradient into a `Tensor`.\n\n  This function works by clever application of `stop_gradient`. I.e., observe\n  that:\n\n  ```none\n  h(x) = stop_gradient(f(x)) + stop_gradient(g(x)) * (x - stop_gradient(x))\n  ```\n\n  is such that `h(x) == stop_gradient(f(x))` and\n  `grad[h(x), x] == stop_gradient(g(x)).`\n\n  In addition to scalar-domain/scalar-range functions, this function also\n  supports tensor-domain/scalar-range functions.\n\n  Partial Custom Gradient:\n\n  Suppose `h(x) = htilde(x, y)`. Note that `dh/dx = stop(g(x))` but `dh/dy =\n  None`. This is because a `Tensor` cannot have only a portion of its gradient\n  stopped. To circumvent this issue, one must manually `stop_gradient` the\n  relevant portions of `f`, `g`. For example see the unit-test,\n  `test_works_correctly_fx_gx_manually_stopped`.\n\n  Args:\n    fx: `Tensor`. Output of function evaluated at `x`.\n    gx: `Tensor` or list of `Tensor`s. Gradient of function at (each) `x`.\n    x: `Tensor` or list of `Tensor`s. Args of evaluation for `f`.\n    fx_gx_manually_stopped: Python `bool` indicating that `fx`, `gx` manually\n      have `stop_gradient` applied.\n    name: Python `str` name prefixed to Ops created by this function.\n\n  Returns:\n    fx: Floating-type `Tensor` equal to `f(x)` but which has gradient\n      `stop_gradient(g(x))`.\n  \"\"\"\n  def maybe_stop(arg_2):\n    if arg_3:\n      return arg_2\n    return tf.stop_gradient(arg_2)\n\n  with tf.compat.v1.name_scope(arg_4, 'Func', [arg_0, arg_1, arg_2]):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_4='fx')\n    # We don't want to bother eagerly computing `gx` since we may not even need\n    # it.\n    with tf.control_dependencies([arg_0]):\n      if is_list_like(arg_2):\n        arg_2 = [identity(arg_6, arg_4='x') for arg_6 in arg_2]\n      else:\n        arg_2 = [identity(arg_2, arg_4='x')]\n\n      if is_list_like(arg_1):\n        arg_1 = [identity(arg_7, dtype=arg_0.dtype, arg_4='gx')\n              for arg_7 in arg_1]\n      else:\n        arg_1 = [identity(arg_1, dtype=arg_0.dtype, arg_4='gx')]\n\n      arg_5 = []\n      for arg_6, arg_7 in zip(arg_2, arg_1):\n        # Observe: tf.gradients(f(x), x)[i].shape == x[i].shape\n        # thus we check that the user is supplying correct shapes.\n        arg_8 = tf.compat.v1.assert_equal(\n            tf.shape(input=arg_6),\n            tf.shape(input=arg_7),\n            message='Each `x` must have the same shape as each `gx`.')\n        with tf.control_dependencies([arg_8]):\n          # IEEE754 ensures `(x-x)==0.` and that `0.*x==0.` so we make sure to\n          # write the code this way, rather than, e.g.,\n          # `sum_x * stop(gx) + stop(fx - sum_x * gx)`.\n          # For more discussion regarding the relevant portions of the IEEE754\n          # standard, see the StackOverflow question,\n          # \"Is there a floating point value of x, for which x-x == 0 is false?\"\n          # http://stackoverflow.com/q/2686644\n          arg_9 = arg_6 - tf.stop_gradient(arg_6)\n          arg_5.append(\n              tf.reduce_sum(input_tensor=maybe_stop(arg_7) * arg_9))\n      arg_5 = sum(arg_5)\n      arg_5 /= tf.cast(tf.size(input=arg_0), dtype=arg_0.dtype.base_dtype)\n\n      # Proof of correctness:\n      #\n      #  f(x) = x * stop[gx] + stop[fx - x * gx]\n      #       = stop[fx]\n      #\n      #  g(x) = grad[fx]\n      #       = stop[gx] + grad[stop[fx - x * gx]]\n      #       = stop[gx] + 0\n      #\n      # Notice that when x is zero it still works:\n      # grad[x * stop(gx) + stop(fx - x * gx)] = 1 * stop[gx] + 0 = stop[gx]\n      #\n      # The proof is similar for the tensor-domain case, except that we\n      # `reduce_sum` the `stop[gx] * (x - stop[x])` then rescale by\n      # `tf.size(fx)` since this reduced version is broadcast to `fx`.\n      return maybe_stop(arg_0) + arg_5", "path": "tensorflow_probability/python/math/custom_gradient.py", "identifier": "custom_gradient", "docstring": "Embeds a custom gradient into a `Tensor`.\n\n  This function works by clever application of `stop_gradient`. I.e., observe\n  that:\n\n  ```none\n  h(x) = stop_gradient(f(x)) + stop_gradient(g(x)) * (x - stop_gradient(x))\n  ```\n\n  is such that `h(x) == stop_gradient(f(x))` and\n  `grad[h(x), x] == stop_gradient(g(x)).`\n\n  In addition to scalar-domain/scalar-range functions, this function also\n  supports tensor-domain/scalar-range functions.\n\n  Partial Custom Gradient:\n\n  Suppose `h(x) = htilde(x, y)`. Note that `dh/dx = stop(g(x))` but `dh/dy =\n  None`. This is because a `Tensor` cannot have only a portion of its gradient\n  stopped. To circumvent this issue, one must manually `stop_gradient` the\n  relevant portions of `f`, `g`. For example see the unit-test,\n  `test_works_correctly_fx_gx_manually_stopped`.\n\n  Args:\n    fx: `Tensor`. Output of function evaluated at `x`.\n    gx: `Tensor` or list of `Tensor`s. Gradient of function at (each) `x`.\n    x: `Tensor` or list of `Tensor`s. Args of evaluation for `f`.\n    fx_gx_manually_stopped: Python `bool` indicating that `fx`, `gx` manually\n      have `stop_gradient` applied.\n    name: Python `str` name prefixed to Ops created by this function.\n\n  Returns:\n    fx: Floating-type `Tensor` equal to `f(x)` but which has gradient\n      `stop_gradient(g(x))`.", "docstring_tokens": ["Embeds", "a", "custom", "gradient", "into", "a", "Tensor", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256691}
{"url": "https://github.com/brehaut/picoparse/blob/5e07c8e687a021bba58a5a2a76696c7a7ff35a1c/picoparse/__init__.py#L325-L338", "sha": "5e07c8e687a021bba58a5a2a76696c7a7ff35a1c", "docstring_summary": "Returns the current token if is found in the collection provided.\n    \n    Fails otherwise.", "language": "python", "parameters": "(these)", "return_statement": "return ch", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "peek", "(", ")", "try", ":", "if", "(", "arg_1", "is", "EndOfFile", ")", "or", "(", "arg_1", "not", "in", "arg_0", ")", ":", "fail", "(", "list", "(", "arg_0", ")", ")", "except", "TypeError", ":", "if", "arg_1", "!=", "arg_0", ":", "fail", "(", "[", "arg_0", "]", ")", "next", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns the current token if is found in the collection provided.\n    \n    Fails otherwise.\n    \"\"\"\n    arg_1 = peek()\n    try:\n        if (arg_1 is EndOfFile) or (arg_1 not in arg_0):\n            fail(list(arg_0))\n    except TypeError:\n        if arg_1 != arg_0:\n            fail([arg_0])\n    next()\n    return arg_1", "path": "picoparse/__init__.py", "identifier": "one_of", "docstring": "Returns the current token if is found in the collection provided.\n    \n    Fails otherwise.", "docstring_tokens": ["Returns", "the", "current", "token", "if", "is", "found", "in", "the", "collection", "provided", ".", "Fails", "otherwise", "."], "nwo": "brehaut/picoparse", "score": 0.16638194949711382, "idx": 256692}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/magic.py#L182-L213", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Decorator factory for methods in Magics subclasses.", "language": "python", "parameters": "(magic_kind)", "return_statement": "return magic_deco", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "validate_type", "(", "arg_0", ")", "def", "arg_8", "(", "arg_1", ")", ":", "arg_2", "=", "lambda", "f", ",", "*", "arg_6", ",", "**", "k", ":", "f", "(", "*", "arg_6", ",", "**", "k", ")", "if", "callable", "(", "arg_1", ")", ":", "arg_3", "=", "arg_1", "arg_4", "=", "arg_3", ".", "func_name", "arg_5", "=", "decorator", "(", "arg_2", ",", "arg_3", ")", "record_magic", "(", "magics", ",", "arg_0", ",", "arg_4", ",", "arg_4", ")", "elif", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_4", "=", "arg_1", "def", "mark", "(", "arg_3", ",", "*", "arg_6", ",", "**", "arg_7", ")", ":", "record_magic", "(", "magics", ",", "arg_0", ",", "arg_4", ",", "arg_3", ".", "func_name", ")", "return", "decorator", "(", "arg_2", ",", "arg_3", ")", "arg_5", "=", "mark", "else", ":", "raise", "TypeError", "(", "\"Decorator can only be called with \"", "\"string or function\"", ")", "return", "arg_5", "arg_8", ".", "__doc__", "=", "_docstring_template", ".", "format", "(", "'method'", ",", "arg_0", ")", "return", "arg_8"], "function": "def Func(arg_0):\n    \"\"\"Decorator factory for methods in Magics subclasses.\n    \"\"\"\n\n    validate_type(arg_0)\n\n    # This is a closure to capture the magic_kind.  We could also use a class,\n    # but it's overkill for just that one bit of state.\n    def arg_8(arg_1):\n        arg_2 = lambda f, *arg_6, **k: f(*arg_6, **k)\n\n        if callable(arg_1):\n            # \"Naked\" decorator call (just @foo, no args)\n            arg_3 = arg_1\n            arg_4 = arg_3.func_name\n            arg_5 = decorator(arg_2, arg_3)\n            record_magic(magics, arg_0, arg_4, arg_4)\n        elif isinstance(arg_1, basestring):\n            # Decorator called with arguments (@foo('bar'))\n            arg_4 = arg_1\n            def mark(arg_3, *arg_6, **arg_7):\n                record_magic(magics, arg_0, arg_4, arg_3.func_name)\n                return decorator(arg_2, arg_3)\n            arg_5 = mark\n        else:\n            raise TypeError(\"Decorator can only be called with \"\n                            \"string or function\")\n        return arg_5\n\n    # Ensure the resulting decorator has a usable docstring\n    arg_8.__doc__ = _docstring_template.format('method', arg_0)\n    return arg_8", "path": "environment/lib/python2.7/site-packages/IPython/core/magic.py", "identifier": "_method_magic_marker", "docstring": "Decorator factory for methods in Magics subclasses.", "docstring_tokens": ["Decorator", "factory", "for", "methods", "in", "Magics", "subclasses", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256693}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/ooaofooa.py#L213-L220", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Create a python function from a BridgePoint function.", "language": "python", "parameters": "(metamodel, s_sync)", "return_statement": "return lambda **kwargs: interpret.run_function(metamodel, label, \n                                                   action, kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "Action_Semantics_internal", "arg_3", "=", "arg_1", ".", "Name", "return", "lambda", "**", "kwargs", ":", "interpret", ".", "run_function", "(", "arg_0", ",", "arg_3", ",", "arg_2", ",", "kwargs", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Create a python function from a BridgePoint function.\n    '''\n    arg_2 = arg_1.Action_Semantics_internal\n    arg_3 = arg_1.Name\n    return lambda **kwargs: interpret.run_function(arg_0, arg_3, \n                                                   arg_2, kwargs)", "path": "bridgepoint/ooaofooa.py", "identifier": "mk_function", "docstring": "Create a python function from a BridgePoint function.", "docstring_tokens": ["Create", "a", "python", "function", "from", "a", "BridgePoint", "function", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 256694}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/util.py#L132-L136", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "Send the given arguments to `pip install`.", "language": "python", "parameters": "(*args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "(", "'--download-cache=%s '", "%", "options", ".", "paved", ".", "pip", ".", "download_cache", ")", "if", "options", ".", "paved", ".", "pip", ".", "download_cache", "else", "''", "shv", "(", "'pip install %s%s'", "%", "(", "arg_1", ",", "' '", ".", "join", "(", "arg_0", ")", ")", ")"], "function": "def Func(*arg_0):\n    \"\"\"Send the given arguments to `pip install`.\n    \"\"\"\n    arg_1 = ('--download-cache=%s ' % options.paved.pip.download_cache) if options.paved.pip.download_cache else ''\n    shv('pip install %s%s' % (arg_1, ' '.join(arg_0)))", "path": "paved/util.py", "identifier": "pip_install", "docstring": "Send the given arguments to `pip install`.", "docstring_tokens": ["Send", "the", "given", "arguments", "to", "pip", "install", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 256695}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L178-L196", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "delete a backend, and update the secrets file", "language": "python", "parameters": "(backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "read_client_secrets", "(", ")", "if", "arg_0", "in", "arg_1", ":", "del", "arg_1", "[", "arg_0", "]", "if", "'SREGISTRY_CLIENT'", "in", "arg_1", ":", "if", "arg_1", "[", "'SREGISTRY_CLIENT'", "]", "==", "arg_0", ":", "del", "arg_1", "[", "'SREGISTRY_CLIENT'", "]", "update_secrets", "(", "arg_1", ")", "print", "(", "'[delete] %s'", "%", "arg_0", ")", "else", ":", "if", "arg_0", "is", "not", "None", ":", "print", "(", "'%s is not a known client.'", "%", "arg_0", ")", "else", ":", "print", "(", "'Please specify a backend to delete.'", ")"], "function": "def Func(arg_0):\n    '''delete a backend, and update the secrets file\n    '''\n    arg_1 = read_client_secrets()\n    if arg_0 in arg_1:\n        del arg_1[arg_0]\n\n        # If the backend was the active client, remove too\n        if 'SREGISTRY_CLIENT' in arg_1:\n            if arg_1['SREGISTRY_CLIENT'] == arg_0:\n                del arg_1['SREGISTRY_CLIENT']\n\n        update_secrets(arg_1)\n        print('[delete] %s' %arg_0)\n    else:\n        if arg_0 is not None:\n            print('%s is not a known client.' %arg_0)\n        else:\n            print('Please specify a backend to delete.')", "path": "sregistry/client/backend.py", "identifier": "delete_backend", "docstring": "delete a backend, and update the secrets file", "docstring_tokens": ["delete", "a", "backend", "and", "update", "the", "secrets", "file"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 256696}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1996-L2003", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Set the frame of the completer.", "language": "python", "parameters": "(self, frame=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "arg_0", ".", "Completer", ".", "namespace", "=", "arg_1", ".", "f_locals", "arg_0", ".", "Completer", ".", "global_namespace", "=", "arg_1", ".", "f_globals", "else", ":", "arg_0", ".", "Completer", ".", "namespace", "=", "arg_0", ".", "user_ns", "arg_0", ".", "Completer", ".", "global_namespace", "=", "arg_0", ".", "user_global_ns"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Set the frame of the completer.\"\"\"\n        if arg_1:\n            arg_0.Completer.namespace = arg_1.f_locals\n            arg_0.Completer.global_namespace = arg_1.f_globals\n        else:\n            arg_0.Completer.namespace = arg_0.user_ns\n            arg_0.Completer.global_namespace = arg_0.user_global_ns", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.set_completer_frame", "docstring": "Set the frame of the completer.", "docstring_tokens": ["Set", "the", "frame", "of", "the", "completer", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256697}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L521-L531", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Calculate the seconds to reset the token requests, by obtaining the different\n        between the current date and the next date when the token is fully regenerated.", "language": "python", "parameters": "(self)", "return_statement": "return time_to_reset", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "rate_limit_reset_ts", "-", "(", "datetime_utcnow", "(", ")", ".", "replace", "(", "microsecond", "=", "0", ")", ".", "timestamp", "(", ")", "+", "1", ")", "if", "arg_1", "<", "0", ":", "arg_1", "=", "0", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Calculate the seconds to reset the token requests, by obtaining the different\n        between the current date and the next date when the token is fully regenerated.\n        \"\"\"\n\n        arg_1 = arg_0.rate_limit_reset_ts - (datetime_utcnow().replace(microsecond=0).timestamp() + 1)\n\n        if arg_1 < 0:\n            arg_1 = 0\n\n        return arg_1", "path": "perceval/backends/core/gitlab.py", "identifier": "GitLabClient.calculate_time_to_reset", "docstring": "Calculate the seconds to reset the token requests, by obtaining the different\n        between the current date and the next date when the token is fully regenerated.", "docstring_tokens": ["Calculate", "the", "seconds", "to", "reset", "the", "token", "requests", "by", "obtaining", "the", "different", "between", "the", "current", "date", "and", "the", "next", "date", "when", "the", "token", "is", "fully", "regenerated", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256698}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/tm/tm_high_order.py#L53-L75", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Corrupts a copy of a binary vector by inverting noiseLevel percent of its bits.", "language": "python", "parameters": "(v1, noiseLevel, numActiveCols)", "return_statement": "return v2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "len", "(", "arg_0", ")", "arg_4", "=", "np", ".", "zeros", "(", "arg_3", ",", "dtype", "=", "\"uint32\"", ")", "arg_5", "=", "int", "(", "arg_1", "*", "arg_2", ")", "for", "arg_6", "in", "range", "(", "arg_3", ")", ":", "arg_4", "[", "arg_6", "]", "=", "arg_0", "[", "arg_6", "]", "for", "arg_7", "in", "range", "(", "arg_5", ")", ":", "arg_6", "=", "random", ".", "randrange", "(", "arg_3", ")", "if", "arg_4", "[", "arg_6", "]", "==", "1", ":", "arg_4", "[", "arg_6", "]", "=", "0", "else", ":", "arg_4", "[", "arg_6", "]", "=", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"\n  Corrupts a copy of a binary vector by inverting noiseLevel percent of its bits.\n  \n  @param v1      (array) binary vector whose copy will be corrupted\n  @param noiseLevel  (float) amount of noise to be applied on the new vector\n  @param numActiveCols (int)   number of sparse columns that represent an input\n  \n  @return v2 (array) corrupted binary vector\n  \"\"\"  \n  arg_3 = len(arg_0)\n  arg_4 = np.zeros(arg_3, dtype=\"uint32\")\n  arg_5 = int(arg_1 * arg_2)\n  # Copy the contents of v1 into v2\n  for arg_6 in range(arg_3):\n    arg_4[arg_6] = arg_0[arg_6]\n  for arg_7 in range(arg_5):\n    arg_6 = random.randrange(arg_3)\n    if arg_4[arg_6] == 1:\n      arg_4[arg_6] = 0\n    else:\n      arg_4[arg_6] = 1\n  return arg_4", "path": "examples/tm/tm_high_order.py", "identifier": "corruptVector", "docstring": "Corrupts a copy of a binary vector by inverting noiseLevel percent of its bits.\n  \n  @param v1      (array) binary vector whose copy will be corrupted\n  @param noiseLevel  (float) amount of noise to be applied on the new vector\n  @param numActiveCols (int)   number of sparse columns that represent an input\n  \n  @return v2 (array) corrupted binary vector", "docstring_tokens": ["Corrupts", "a", "copy", "of", "a", "binary", "vector", "by", "inverting", "noiseLevel", "percent", "of", "its", "bits", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256699}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/smooth.py#L75-L126", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "The lambda & mu Taubin smoothing, it make two steps of smoothing, forth\n        and back, for each iteration.", "language": "python", "parameters": "(script, iterations=10, t_lambda=0.5, t_mu=-0.53, selected=False)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ",", "arg_2", "=", "0.5", ",", "arg_3", "=", "-", "0.53", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Taubin Smooth\">\\n'", ",", "'    <Param name=\"lambda\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_2", ")", ",", "'description=\"Lambda\" '", ",", "'type=\"RichFloat\" '", ",", "'/>\\n'", ",", "'    <Param name=\"mu\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_3", ")", ",", "'description=\"mu\" '", ",", "'type=\"RichFloat\" '", ",", "'/>\\n'", ",", "'    <Param name=\"stepSmoothNum\" '", ",", "'value=\"{:d}\" '", ".", "format", "(", "arg_1", ")", ",", "'description=\"Smoothing steps\" '", ",", "'type=\"RichInt\" '", ",", "'/>\\n'", ",", "'    <Param name=\"Selected\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_4", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Affect only selected faces\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_5", ")", "return", "None"], "function": "def Func(arg_0, arg_1=10, arg_2=0.5, arg_3=-0.53, arg_4=False):\n    \"\"\" The lambda & mu Taubin smoothing, it make two steps of smoothing, forth\n        and back, for each iteration.\n\n    Based on:\n    Gabriel Taubin\n    \"A signal processing approach to fair surface design\"\n    Siggraph 1995\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        iterations (int): The number of times that the Func smoothing is\n            iterated. Usually it requires a larger number of iteration than the\n            classical laplacian.\n        t_lambda (float): The lambda parameter of the Taubin Smoothing algorithm\n        t_mu (float): The mu parameter of the Taubin Smoothing algorithm\n        selected (bool): If selected the filter is performed only on the\n            selected faces\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    arg_5 = ''.join([\n        '  <filter name=\"Taubin Smooth\">\\n',\n        '    <Param name=\"lambda\" ',\n        'value=\"{}\" '.format(arg_2),\n        'description=\"Lambda\" ',\n        'type=\"RichFloat\" ',\n        '/>\\n',\n        '    <Param name=\"mu\" ',\n        'value=\"{}\" '.format(arg_3),\n        'description=\"mu\" ',\n        'type=\"RichFloat\" ',\n        '/>\\n',\n        '    <Param name=\"stepSmoothNum\" ',\n        'value=\"{:d}\" '.format(arg_1),\n        'description=\"Smoothing steps\" ',\n        'type=\"RichInt\" ',\n        '/>\\n',\n        '    <Param name=\"Selected\" ',\n        'value=\"{}\" '.format(str(arg_4).lower()),\n        'description=\"Affect only selected faces\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_5)\n    return None", "path": "meshlabxml/smooth.py", "identifier": "taubin", "docstring": "The lambda & mu Taubin smoothing, it make two steps of smoothing, forth\n        and back, for each iteration.\n\n    Based on:\n    Gabriel Taubin\n    \"A signal processing approach to fair surface design\"\n    Siggraph 1995\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        iterations (int): The number of times that the taubin smoothing is\n            iterated. Usually it requires a larger number of iteration than the\n            classical laplacian.\n        t_lambda (float): The lambda parameter of the Taubin Smoothing algorithm\n        t_mu (float): The mu parameter of the Taubin Smoothing algorithm\n        selected (bool): If selected the filter is performed only on the\n            selected faces\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["The", "lambda", "&", "mu", "Taubin", "smoothing", "it", "make", "two", "steps", "of", "smoothing", "forth", "and", "back", "for", "each", "iteration", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 256700}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L977-L1052", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Draw text on an image.", "language": "python", "parameters": "(img, y, x, text, color=(0, 255, 0), size=25)", "return_statement": "return img_np", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "(", "0", ",", "255", ",", "0", ")", ",", "arg_5", "=", "25", ")", ":", "do_assert", "(", "arg_0", ".", "dtype", "in", "[", "np", ".", "uint8", ",", "np", ".", "float32", "]", ")", "arg_6", "=", "arg_0", ".", "dtype", "if", "arg_0", ".", "dtype", "==", "np", ".", "float32", ":", "arg_0", "=", "arg_0", ".", "astype", "(", "np", ".", "uint8", ")", "arg_0", "=", "PIL_Image", ".", "fromarray", "(", "arg_0", ")", "arg_7", "=", "PIL_ImageFont", ".", "truetype", "(", "DEFAULT_FONT_FP", ",", "arg_5", ")", "arg_8", "=", "PIL_ImageDraw", ".", "Draw", "(", "arg_0", ")", "arg_8", ".", "text", "(", "(", "arg_2", ",", "arg_1", ")", ",", "arg_3", ",", "fill", "=", "tuple", "(", "arg_4", ")", ",", "arg_7", "=", "arg_7", ")", "arg_9", "=", "np", ".", "asarray", "(", "arg_0", ")", "if", "not", "arg_9", ".", "flags", "[", "\"WRITEABLE\"", "]", ":", "try", ":", "arg_9", ".", "setflags", "(", "write", "=", "True", ")", "except", "ValueError", "as", "ex", ":", "if", "\"cannot set WRITEABLE flag to True of this array\"", "in", "str", "(", "ex", ")", ":", "arg_9", "=", "np", ".", "copy", "(", "arg_9", ")", "if", "arg_9", ".", "dtype", "!=", "arg_6", ":", "arg_9", "=", "arg_9", ".", "astype", "(", "arg_6", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=(0, 255, 0), arg_5=25):\n    \"\"\"\n    Draw text on an image.\n\n    This uses by default DejaVuSans as its font, which is included in this library.\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: no\n        * ``uint32``: no\n        * ``uint64``: no\n        * ``int8``: no\n        * ``int16``: no\n        * ``int32``: no\n        * ``int64``: no\n        * ``float16``: no\n        * ``float32``: yes; not tested\n        * ``float64``: no\n        * ``float128``: no\n        * ``bool``: no\n\n        TODO check if other dtypes could be enabled\n\n    Parameters\n    ----------\n    img : (H,W,3) ndarray\n        The image array to draw text on.\n        Expected to be of dtype uint8 or float32 (value range 0.0 to 255.0).\n\n    y : int\n        x-coordinate of the top left corner of the text.\n\n    x : int\n        y- coordinate of the top left corner of the text.\n\n    text : str\n        The text to draw.\n\n    color : iterable of int, optional\n        Color of the text to draw. For RGB-images this is expected to be an RGB color.\n\n    size : int, optional\n        Font size of the text to draw.\n\n    Returns\n    -------\n    img_np : (H,W,3) ndarray\n        Input image with text drawn on it.\n\n    \"\"\"\n    do_assert(arg_0.dtype in [np.uint8, np.float32])\n\n    arg_6 = arg_0.dtype\n    if arg_0.dtype == np.float32:\n        arg_0 = arg_0.astype(np.uint8)\n\n    arg_0 = PIL_Image.fromarray(arg_0)\n    arg_7 = PIL_ImageFont.truetype(DEFAULT_FONT_FP, arg_5)\n    arg_8 = PIL_ImageDraw.Draw(arg_0)\n    arg_8.text((arg_2, arg_1), arg_3, fill=tuple(arg_4), arg_7=arg_7)\n    arg_9 = np.asarray(arg_0)\n\n    # PIL/asarray returns read only array\n    if not arg_9.flags[\"WRITEABLE\"]:\n        try:\n            # this seems to no longer work with np 1.16 (or was pillow updated?)\n            arg_9.setflags(write=True)\n        except ValueError as ex:\n            if \"cannot set WRITEABLE flag to True of this array\" in str(ex):\n                arg_9 = np.copy(arg_9)\n\n    if arg_9.dtype != arg_6:\n        arg_9 = arg_9.astype(arg_6)\n\n    return arg_9", "path": "imgaug/imgaug.py", "identifier": "draw_text", "docstring": "Draw text on an image.\n\n    This uses by default DejaVuSans as its font, which is included in this library.\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: no\n        * ``uint32``: no\n        * ``uint64``: no\n        * ``int8``: no\n        * ``int16``: no\n        * ``int32``: no\n        * ``int64``: no\n        * ``float16``: no\n        * ``float32``: yes; not tested\n        * ``float64``: no\n        * ``float128``: no\n        * ``bool``: no\n\n        TODO check if other dtypes could be enabled\n\n    Parameters\n    ----------\n    img : (H,W,3) ndarray\n        The image array to draw text on.\n        Expected to be of dtype uint8 or float32 (value range 0.0 to 255.0).\n\n    y : int\n        x-coordinate of the top left corner of the text.\n\n    x : int\n        y- coordinate of the top left corner of the text.\n\n    text : str\n        The text to draw.\n\n    color : iterable of int, optional\n        Color of the text to draw. For RGB-images this is expected to be an RGB color.\n\n    size : int, optional\n        Font size of the text to draw.\n\n    Returns\n    -------\n    img_np : (H,W,3) ndarray\n        Input image with text drawn on it.", "docstring_tokens": ["Draw", "text", "on", "an", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 256701}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/datasets/phototour.py#L199-L210", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Return a Tensor containing the ground truth matches\n       Read the file and keep only 3D point ID.\n       Matches are represented with a 1, non matches with a 0.", "language": "python", "parameters": "(data_dir, matches_file)", "return_statement": "return torch.LongTensor(matches)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", ",", "'r'", ")", "as", "f", ":", "for", "arg_3", "in", "f", ":", "arg_4", "=", "arg_3", ".", "split", "(", ")", "arg_2", ".", "append", "(", "[", "int", "(", "arg_4", "[", "0", "]", ")", ",", "int", "(", "arg_4", "[", "3", "]", ")", ",", "int", "(", "arg_4", "[", "1", "]", "==", "arg_4", "[", "4", "]", ")", "]", ")", "return", "torch", ".", "LongTensor", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a Tensor containing the ground truth matches\n       Read the file and keep only 3D point ID.\n       Matches are represented with a 1, non matches with a 0.\n    \"\"\"\n    arg_2 = []\n    with open(os.path.join(arg_0, arg_1), 'r') as f:\n        for arg_3 in f:\n            arg_4 = arg_3.split()\n            arg_2.append([int(arg_4[0]), int(arg_4[3]),\n                            int(arg_4[1] == arg_4[4])])\n    return torch.LongTensor(arg_2)", "path": "torchvision/datasets/phototour.py", "identifier": "read_matches_files", "docstring": "Return a Tensor containing the ground truth matches\n       Read the file and keep only 3D point ID.\n       Matches are represented with a 1, non matches with a 0.", "docstring_tokens": ["Return", "a", "Tensor", "containing", "the", "ground", "truth", "matches", "Read", "the", "file", "and", "keep", "only", "3D", "point", "ID", ".", "Matches", "are", "represented", "with", "a", "1", "non", "matches", "with", "a", "0", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 256702}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/ooaofooa.py#L196-L210", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Create a python object from a BridgePoint external entity with bridges\n    realized as python member functions.", "language": "python", "parameters": "(metamodel, s_ee)", "return_statement": "return EE(*funcs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "many", "(", "arg_1", ")", ".", "S_BRG", "[", "19", "]", "(", ")", "arg_3", "=", "[", "brg", ".", "Name", "for", "brg", "in", "arg_2", "]", "arg_4", "=", "collections", ".", "namedtuple", "(", "arg_1", ".", "Key_Lett", ",", "arg_3", ")", "arg_5", "=", "list", "(", ")", "for", "arg_6", "in", "many", "(", "arg_1", ")", ".", "S_BRG", "[", "19", "]", "(", ")", ":", "arg_7", "=", "mk_bridge", "(", "arg_0", ",", "arg_6", ")", "arg_5", ".", "append", "(", "arg_7", ")", "return", "arg_4", "(", "*", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Create a python object from a BridgePoint external entity with bridges\n    realized as python member functions.\n    '''\n    arg_2 = many(arg_1).S_BRG[19]()\n    arg_3 = [brg.Name for brg in arg_2]\n    arg_4 = collections.namedtuple(arg_1.Key_Lett, arg_3)\n\n    arg_5 = list()\n    for arg_6 in many(arg_1).S_BRG[19]():\n        arg_7 = mk_bridge(arg_0, arg_6)\n        arg_5.append(arg_7)\n\n    return arg_4(*arg_5)", "path": "bridgepoint/ooaofooa.py", "identifier": "mk_external_entity", "docstring": "Create a python object from a BridgePoint external entity with bridges\n    realized as python member functions.", "docstring_tokens": ["Create", "a", "python", "object", "from", "a", "BridgePoint", "external", "entity", "with", "bridges", "realized", "as", "python", "member", "functions", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 256703}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/utils/alice/alice.py#L45-L81", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Exchange messages between basic pipelines and the Yandex.Dialogs service.\n    If the pipeline returns multiple values, only the first one is forwarded to Yandex.", "language": "python", "parameters": "(agent: Agent)", "return_statement": "return jsonify(response), 200", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", ":", "arg_2", "=", "request", ".", "get_json", "(", ")", "arg_3", "=", "arg_2", "[", "'request'", "]", ".", "get", "(", "'command'", ",", "''", ")", ".", "strip", "(", ")", "arg_4", "=", "arg_2", "[", "'request'", "]", ".", "get", "(", "'payload'", ")", "arg_5", "=", "arg_2", "[", "'session'", "]", "[", "'session_id'", "]", "arg_6", "=", "arg_2", "[", "'session'", "]", "[", "'user_id'", "]", "arg_7", "=", "arg_2", "[", "'session'", "]", "[", "'message_id'", "]", "arg_8", "=", "DialogID", "(", "arg_6", ",", "arg_5", ")", "arg_9", "=", "{", "'response'", ":", "{", "'end_session'", ":", "True", ",", "'text'", ":", "''", "}", ",", "\"session\"", ":", "{", "'session_id'", ":", "arg_5", ",", "'message_id'", ":", "arg_7", ",", "'user_id'", ":", "arg_6", "}", ",", "'version'", ":", "'1.0'", "}", "arg_10", ":", "Union", "[", "str", ",", "RichMessage", "]", "=", "arg_0", "(", "[", "arg_4", "or", "arg_3", "]", ",", "[", "arg_8", "]", ")", "[", "0", "]", "if", "isinstance", "(", "arg_10", ",", "RichMessage", ")", ":", "arg_9", "[", "'response'", "]", "[", "'text'", "]", "=", "'\\n'", ".", "join", "(", "[", "j", "[", "'content'", "]", "for", "j", "in", "arg_10", ".", "json", "(", ")", "if", "j", "[", "'type'", "]", "==", "'plain_text'", "]", ")", "else", ":", "arg_9", "[", "'response'", "]", "[", "'text'", "]", "=", "str", "(", "arg_10", ")", "return", "jsonify", "(", "arg_9", ")", ",", "200"], "function": "def Func(arg_0: arg_1):\n    \"\"\"\n    Exchange messages between basic pipelines and the Yandex.Dialogs service.\n    If the pipeline returns multiple values, only the first one is forwarded to Yandex.\n    \"\"\"\n    arg_2 = request.get_json()\n    arg_3 = arg_2['request'].get('command', '').strip()\n    arg_4 = arg_2['request'].get('payload')\n\n    arg_5 = arg_2['session']['session_id']\n    arg_6 = arg_2['session']['user_id']\n    arg_7 = arg_2['session']['message_id']\n\n    arg_8 = DialogID(arg_6, arg_5)\n\n    arg_9 = {\n        'response': {\n            'end_session': True,\n            'text': ''\n        },\n        \"session\": {\n            'session_id': arg_5,\n            'message_id': arg_7,\n            'user_id': arg_6\n        },\n        'version': '1.0'\n    }\n\n    arg_10: Union[str, RichMessage] = arg_0([arg_4 or arg_3], [arg_8])[0]\n    if isinstance(arg_10, RichMessage):\n        arg_9['response']['text'] = '\\n'.join([j['content']\n                                                  for j in arg_10.json()\n                                                  if j['type'] == 'plain_text'])\n    else:\n        arg_9['response']['text'] = str(arg_10)\n\n    return jsonify(arg_9), 200", "path": "deeppavlov/utils/alice/alice.py", "identifier": "interact_alice", "docstring": "Exchange messages between basic pipelines and the Yandex.Dialogs service.\n    If the pipeline returns multiple values, only the first one is forwarded to Yandex.", "docstring_tokens": ["Exchange", "messages", "between", "basic", "pipelines", "and", "the", "Yandex", ".", "Dialogs", "service", ".", "If", "the", "pipeline", "returns", "multiple", "values", "only", "the", "first", "one", "is", "forwarded", "to", "Yandex", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 256704}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hgnc.py#L497-L513", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Check if a hgnc symbol is an alias", "language": "python", "parameters": "(self, hgnc_alias, build='37')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'37'", ")", ":", "arg_3", "=", "arg_0", ".", "hgnc_genes", "(", "hgnc_symbol", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "arg_3", ":", "for", "arg_4", "in", "arg_3", ":", "return", "arg_4", "[", "'hgnc_symbol'", "]", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2='37'):\n        \"\"\"Check if a hgnc symbol is an alias\n\n            Return the correct hgnc symbol, if not existing return None\n\n            Args:\n                hgnc_alias(str)\n\n            Returns:\n                hgnc_symbol(str)\n        \"\"\"\n        arg_3 = arg_0.hgnc_genes(hgnc_symbol=arg_1, arg_2=arg_2)\n        if arg_3:\n            for arg_4 in arg_3:\n                return arg_4['hgnc_symbol']\n        else:\n            return None", "path": "scout/adapter/mongo/hgnc.py", "identifier": "GeneHandler.to_hgnc", "docstring": "Check if a hgnc symbol is an alias\n\n            Return the correct hgnc symbol, if not existing return None\n\n            Args:\n                hgnc_alias(str)\n\n            Returns:\n                hgnc_symbol(str)", "docstring_tokens": ["Check", "if", "a", "hgnc", "symbol", "is", "an", "alias"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 256705}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L201-L216", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Build an xsd complex element out of a C_C, including its packaged S_DT and O_OBJ.", "language": "python", "parameters": "(m, c_c)", "return_statement": "return component", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ET", ".", "Element", "(", "'xs:element'", ",", "name", "=", "arg_1", ".", "name", ")", "arg_3", "=", "ET", ".", "SubElement", "(", "arg_2", ",", "'xs:complexType'", ")", "arg_3", "=", "ET", ".", "SubElement", "(", "arg_3", ",", "'xs:sequence'", ")", "arg_4", "=", "lambda", "selected", ":", "ooaofooa", ".", "is_contained_in", "(", "selected", ",", "arg_1", ")", "for", "arg_5", "in", "arg_0", ".", "select_many", "(", "'O_OBJ'", ",", "arg_4", ")", ":", "arg_6", "=", "build_class", "(", "arg_5", ")", "arg_3", ".", "append", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''\n    Build an xsd complex element out of a C_C, including its packaged S_DT and O_OBJ.\n    '''\n    arg_2 = ET.Element('xs:element', name=arg_1.name)\n    \n    arg_3 = ET.SubElement(arg_2, 'xs:complexType')\n    arg_3 = ET.SubElement(arg_3, 'xs:sequence')\n    \n    arg_4 = lambda selected: ooaofooa.is_contained_in(selected, arg_1)\n    \n    for arg_5 in arg_0.select_many('O_OBJ', arg_4):\n        arg_6 = build_class(arg_5)\n        arg_3.append(arg_6)\n    \n    return arg_2", "path": "bridgepoint/gen_xsd_schema.py", "identifier": "build_component", "docstring": "Build an xsd complex element out of a C_C, including its packaged S_DT and O_OBJ.", "docstring_tokens": ["Build", "an", "xsd", "complex", "element", "out", "of", "a", "C_C", "including", "its", "packaged", "S_DT", "and", "O_OBJ", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 256706}
{"url": "https://github.com/sam-washington/requests-aws4auth/blob/1201e470c6d5847b7fe42e937a55755e1895e72c/requests_aws4auth/aws4auth.py#L631-L664", "sha": "1201e470c6d5847b7fe42e937a55755e1895e72c", "docstring_summary": "Parse and format querystring as per AWS4 auth requirements.", "language": "python", "parameters": "(qs)", "return_statement": "return qs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'&=+'", "arg_2", "=", "'-_.~'", "if", "PY2", ":", "arg_0", "=", "arg_0", ".", "encode", "(", "'utf-8'", ")", "arg_1", "=", "arg_1", ".", "encode", "(", ")", "arg_2", "=", "arg_2", ".", "encode", "(", ")", "arg_0", "=", "unquote", "(", "arg_0", ")", "arg_3", "=", "b' '", "if", "PY2", "else", "' '", "arg_0", "=", "arg_0", ".", "split", "(", "arg_3", ")", "[", "0", "]", "arg_0", "=", "quote", "(", "arg_0", ",", "safe", "=", "arg_1", ")", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "parse_qs", "(", "arg_0", ",", "keep_blank_values", "=", "True", ")", ".", "items", "(", ")", ":", "arg_5", "=", "quote", "(", "arg_5", ",", "safe", "=", "arg_2", ")", "arg_6", "=", "[", "quote", "(", "arg_8", ",", "safe", "=", "arg_2", ")", "for", "arg_8", "in", "arg_6", "]", "arg_4", "[", "arg_5", "]", "=", "arg_6", "arg_7", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "arg_4", ".", "items", "(", ")", ":", "for", "arg_8", "in", "arg_6", ":", "arg_7", ".", "append", "(", "'='", ".", "join", "(", "[", "arg_5", ",", "arg_8", "]", ")", ")", "arg_0", "=", "'&'", ".", "join", "(", "sorted", "(", "arg_7", ")", ")", "if", "PY2", ":", "arg_0", "=", "unicode", "(", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"\n        Parse and format querystring as per AWS4 auth requirements.\n\n        Perform percent quoting as needed.\n\n        qs -- querystring\n\n        \"\"\"\n        arg_1 = '&=+'\n        arg_2 = '-_.~'\n        # If Python 2, switch to working entirely in str\n        # as quote() has problems with Unicode\n        if PY2:\n            arg_0 = arg_0.encode('utf-8')\n            arg_1 = arg_1.encode()\n            arg_2 = arg_2.encode()\n        arg_0 = unquote(arg_0)\n        arg_3 = b' ' if PY2 else ' '\n        arg_0 = arg_0.split(arg_3)[0]\n        arg_0 = quote(arg_0, safe=arg_1)\n        arg_4 = {}\n        for arg_5, arg_6 in parse_qs(arg_0, keep_blank_values=True).items():\n            arg_5 = quote(arg_5, safe=arg_2)\n            arg_6 = [quote(arg_8, safe=arg_2) for arg_8 in arg_6]\n            arg_4[arg_5] = arg_6\n        arg_7 = []\n        for arg_5, arg_6 in arg_4.items():\n            for arg_8 in arg_6:\n                arg_7.append('='.join([arg_5, arg_8]))\n        arg_0 = '&'.join(sorted(arg_7))\n        if PY2:\n            arg_0 = unicode(arg_0)\n        return arg_0", "path": "requests_aws4auth/aws4auth.py", "identifier": "AWS4Auth.amz_cano_querystring", "docstring": "Parse and format querystring as per AWS4 auth requirements.\n\n        Perform percent quoting as needed.\n\n        qs -- querystring", "docstring_tokens": ["Parse", "and", "format", "querystring", "as", "per", "AWS4", "auth", "requirements", "."], "nwo": "sam-washington/requests-aws4auth", "score": 0.36091303233896527, "idx": 256707}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/bayesian_neural_network.py#L90-L121", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Save a PNG plot with histograms of weight means and stddevs.", "language": "python", "parameters": "(names, qm_vals, qs_vals, fname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "figure", ".", "Figure", "(", "figsize", "=", "(", "6", ",", "3", ")", ")", "arg_5", "=", "backend_agg", ".", "FigureCanvasAgg", "(", "arg_4", ")", "arg_6", "=", "arg_4", ".", "add_subplot", "(", "1", ",", "2", ",", "1", ")", "for", "arg_7", ",", "arg_8", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ":", "sns", ".", "distplot", "(", "arg_8", ".", "flatten", "(", ")", ",", "arg_6", "=", "arg_6", ",", "label", "=", "arg_7", ")", "arg_6", ".", "set_title", "(", "\"weight means\"", ")", "arg_6", ".", "set_xlim", "(", "[", "-", "1.5", ",", "1.5", "]", ")", "arg_6", ".", "legend", "(", ")", "arg_6", "=", "arg_4", ".", "add_subplot", "(", "1", ",", "2", ",", "2", ")", "for", "arg_7", ",", "arg_9", "in", "zip", "(", "arg_0", ",", "arg_2", ")", ":", "sns", ".", "distplot", "(", "arg_9", ".", "flatten", "(", ")", ",", "arg_6", "=", "arg_6", ")", "arg_6", ".", "set_title", "(", "\"weight stddevs\"", ")", "arg_6", ".", "set_xlim", "(", "[", "0", ",", "1.", "]", ")", "arg_4", ".", "tight_layout", "(", ")", "arg_5", ".", "print_figure", "(", "arg_3", ",", "format", "=", "\"png\"", ")", "print", "(", "\"saved {}\"", ".", "format", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Save a PNG plot with histograms of weight means and stddevs.\n\n  Args:\n    names: A Python `iterable` of `str` variable names.\n    qm_vals: A Python `iterable`, the same length as `names`,\n      whose elements are Numpy `array`s, of any shape, containing\n      posterior means of weight varibles.\n    qs_vals: A Python `iterable`, the same length as `names`,\n      whose elements are Numpy `array`s, of any shape, containing\n      posterior standard deviations of weight varibles.\n    fname: Python `str` filename to save the plot to.\n  \"\"\"\n  arg_4 = figure.Figure(figsize=(6, 3))\n  arg_5 = backend_agg.FigureCanvasAgg(arg_4)\n\n  arg_6 = arg_4.add_subplot(1, 2, 1)\n  for arg_7, arg_8 in zip(arg_0, arg_1):\n    sns.distplot(arg_8.flatten(), arg_6=arg_6, label=arg_7)\n  arg_6.set_title(\"weight means\")\n  arg_6.set_xlim([-1.5, 1.5])\n  arg_6.legend()\n\n  arg_6 = arg_4.add_subplot(1, 2, 2)\n  for arg_7, arg_9 in zip(arg_0, arg_2):\n    sns.distplot(arg_9.flatten(), arg_6=arg_6)\n  arg_6.set_title(\"weight stddevs\")\n  arg_6.set_xlim([0, 1.])\n\n  arg_4.tight_layout()\n  arg_5.print_figure(arg_3, format=\"png\")\n  print(\"saved {}\".format(arg_3))", "path": "tensorflow_probability/examples/bayesian_neural_network.py", "identifier": "plot_weight_posteriors", "docstring": "Save a PNG plot with histograms of weight means and stddevs.\n\n  Args:\n    names: A Python `iterable` of `str` variable names.\n    qm_vals: A Python `iterable`, the same length as `names`,\n      whose elements are Numpy `array`s, of any shape, containing\n      posterior means of weight varibles.\n    qs_vals: A Python `iterable`, the same length as `names`,\n      whose elements are Numpy `array`s, of any shape, containing\n      posterior standard deviations of weight varibles.\n    fname: Python `str` filename to save the plot to.", "docstring_tokens": ["Save", "a", "PNG", "plot", "with", "histograms", "of", "weight", "means", "and", "stddevs", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256708}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Loader.py#L229-L236", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Load an object from a string and return the processed JSON content", "language": "python", "parameters": "(self, string)", "return_statement": "return self.object(object_)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_2", "=", "json", ".", "loads", "(", "Func", ")", "return", "arg_0", ".", "object", "(", "arg_2", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"Load an object from a string and return the processed JSON content\n\n        :return: the result of the processing step\n        :param str string: the string to load the JSON from\n        \"\"\"\n        arg_2 = json.loads(Func)\n        return arg_0.object(arg_2)", "path": "knittingpattern/Loader.py", "identifier": "JSONLoader.string", "docstring": "Load an object from a string and return the processed JSON content\n\n        :return: the result of the processing step\n        :param str string: the string to load the JSON from", "docstring_tokens": ["Load", "an", "object", "from", "a", "string", "and", "return", "the", "processed", "JSON", "content"], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 256709}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L602-L678", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Parse env, input, and output parameters into a job parameters and data.", "language": "python", "parameters": "(envs, labels, inputs, inputs_recursive, outputs,\n                       outputs_recursive, mounts, input_file_param_util,\n                       output_file_param_util, mount_param_util)", "return_statement": "return {\n      'envs': env_data,\n      'inputs': input_data,\n      'outputs': output_data,\n      'labels': label_data,\n      'mounts': mount_data,\n  }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", ":", "arg_10", "=", "parse_pair_args", "(", "arg_0", ",", "job_model", ".", "EnvParam", ")", "arg_11", "=", "parse_pair_args", "(", "arg_1", ",", "job_model", ".", "LabelParam", ")", "arg_12", "=", "set", "(", ")", "for", "(", "arg_13", ",", "arg_14", ")", "in", "(", "(", "False", ",", "arg_2", ")", ",", "(", "True", ",", "arg_3", ")", ")", ":", "for", "arg_15", "in", "arg_14", ":", "arg_16", ",", "arg_17", "=", "split_pair", "(", "arg_15", ",", "'='", ",", "nullable_idx", "=", "0", ")", "arg_16", "=", "arg_7", ".", "get_variable_name", "(", "arg_16", ")", "arg_12", ".", "add", "(", "arg_7", ".", "make_param", "(", "arg_16", ",", "arg_17", ",", "arg_13", ")", ")", "arg_18", "=", "set", "(", ")", "for", "(", "arg_13", ",", "arg_14", ")", "in", "(", "(", "False", ",", "arg_4", ")", ",", "(", "True", ",", "arg_5", ")", ")", ":", "for", "arg_15", "in", "arg_14", ":", "arg_16", ",", "arg_17", "=", "split_pair", "(", "arg_15", ",", "'='", ",", "0", ")", "arg_16", "=", "arg_8", ".", "get_variable_name", "(", "arg_16", ")", "arg_18", ".", "add", "(", "arg_8", ".", "make_param", "(", "arg_16", ",", "arg_17", ",", "arg_13", ")", ")", "arg_19", "=", "set", "(", ")", "for", "arg_15", "in", "arg_6", ":", "if", "' '", "in", "arg_15", ":", "arg_20", ",", "arg_21", "=", "arg_15", ".", "split", "(", "' '", ")", "arg_16", ",", "arg_17", "=", "split_pair", "(", "arg_20", ",", "'='", ",", "1", ")", "arg_19", ".", "add", "(", "arg_9", ".", "make_param", "(", "arg_16", ",", "arg_17", ",", "arg_21", ")", ")", "else", ":", "arg_16", ",", "arg_17", "=", "split_pair", "(", "arg_15", ",", "'='", ",", "1", ")", "arg_19", ".", "add", "(", "arg_9", ".", "make_param", "(", "arg_16", ",", "arg_17", ",", "arg_21", "=", "None", ")", ")", "return", "{", "'envs'", ":", "arg_10", ",", "'inputs'", ":", "arg_12", ",", "'outputs'", ":", "arg_18", ",", "'labels'", ":", "arg_11", ",", "'mounts'", ":", "arg_19", ",", "}"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                       arg_5, arg_6, arg_7,\n                       arg_8, arg_9):\n  \"\"\"Parse env, input, and output parameters into a job parameters and data.\n\n  Passing arguments on the command-line allows for launching a single job.\n  The env, input, and output arguments encode both the definition of the\n  job as well as the single job's values.\n\n  Env arguments are simple name=value pairs.\n  Input and output file arguments can contain name=value pairs or just values.\n  Either of the following is valid:\n\n    uri\n    myfile=uri\n\n  Args:\n    envs: list of environment variable job parameters\n    labels: list of labels to attach to the tasks\n    inputs: list of file input parameters\n    inputs_recursive: list of recursive directory input parameters\n    outputs: list of file output parameters\n    outputs_recursive: list of recursive directory output parameters\n    mounts: list of gcs buckets to mount\n    input_file_param_util: Utility for producing InputFileParam objects.\n    output_file_param_util: Utility for producing OutputFileParam objects.\n    mount_param_util: Utility for producing MountParam objects.\n\n  Returns:\n    job_params: a dictionary of 'envs', 'inputs', and 'outputs' that defines the\n    set of parameters and data for a job.\n  \"\"\"\n  # Parse environmental variables and labels.\n  arg_10 = parse_pair_args(arg_0, job_model.EnvParam)\n  arg_11 = parse_pair_args(arg_1, job_model.LabelParam)\n\n  # For input files, we need to:\n  #   * split the input into name=uri pairs (name optional)\n  #   * get the environmental variable name, or automatically set if null.\n  #   * create the input file param\n  arg_12 = set()\n  for (arg_13, arg_14) in ((False, arg_2), (True, arg_3)):\n    for arg_15 in arg_14:\n      arg_16, arg_17 = split_pair(arg_15, '=', nullable_idx=0)\n      arg_16 = arg_7.get_variable_name(arg_16)\n      arg_12.add(arg_7.make_param(arg_16, arg_17, arg_13))\n\n  # For output files, we need to:\n  #   * split the input into name=uri pairs (name optional)\n  #   * get the environmental variable name, or automatically set if null.\n  #   * create the output file param\n  arg_18 = set()\n  for (arg_13, arg_14) in ((False, arg_4), (True, arg_5)):\n    for arg_15 in arg_14:\n      arg_16, arg_17 = split_pair(arg_15, '=', 0)\n      arg_16 = arg_8.get_variable_name(arg_16)\n      arg_18.add(arg_8.make_param(arg_16, arg_17, arg_13))\n\n  arg_19 = set()\n  for arg_15 in arg_6:\n    # Mounts can look like `--mount VAR=PATH` or `--mount VAR=PATH {num}`,\n    # where num is the size of the disk in Gb. We assume a space is the\n    # separator between path and disk size.\n    if ' ' in arg_15:\n      arg_20, arg_21 = arg_15.split(' ')\n      arg_16, arg_17 = split_pair(arg_20, '=', 1)\n      arg_19.add(arg_9.make_param(arg_16, arg_17, arg_21))\n    else:\n      arg_16, arg_17 = split_pair(arg_15, '=', 1)\n      arg_19.add(arg_9.make_param(arg_16, arg_17, arg_21=None))\n  return {\n      'envs': arg_10,\n      'inputs': arg_12,\n      'outputs': arg_18,\n      'labels': arg_11,\n      'mounts': arg_19,\n  }", "path": "dsub/lib/param_util.py", "identifier": "args_to_job_params", "docstring": "Parse env, input, and output parameters into a job parameters and data.\n\n  Passing arguments on the command-line allows for launching a single job.\n  The env, input, and output arguments encode both the definition of the\n  job as well as the single job's values.\n\n  Env arguments are simple name=value pairs.\n  Input and output file arguments can contain name=value pairs or just values.\n  Either of the following is valid:\n\n    uri\n    myfile=uri\n\n  Args:\n    envs: list of environment variable job parameters\n    labels: list of labels to attach to the tasks\n    inputs: list of file input parameters\n    inputs_recursive: list of recursive directory input parameters\n    outputs: list of file output parameters\n    outputs_recursive: list of recursive directory output parameters\n    mounts: list of gcs buckets to mount\n    input_file_param_util: Utility for producing InputFileParam objects.\n    output_file_param_util: Utility for producing OutputFileParam objects.\n    mount_param_util: Utility for producing MountParam objects.\n\n  Returns:\n    job_params: a dictionary of 'envs', 'inputs', and 'outputs' that defines the\n    set of parameters and data for a job.", "docstring_tokens": ["Parse", "env", "input", "and", "output", "parameters", "into", "a", "job", "parameters", "and", "data", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 256710}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/operation_layers.py#L10-L32", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert sum.", "language": "python", "parameters": "(\n    params, w_name, scope_name, inputs, layers, weights, names\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting Sum ...'", ")", "def", "target_layer", "(", "arg_7", ")", ":", "import", "keras", ".", "backend", "as", "K", "return", "K", ".", "sum", "(", "arg_7", ")", "arg_8", "=", "keras", ".", "layers", ".", "Lambda", "(", "target_layer", ")", "arg_4", "[", "arg_2", "]", "=", "arg_8", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6\n):\n    \"\"\"\n    Convert sum.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting Sum ...')\n\n    def target_layer(arg_7):\n        import keras.backend as K\n        return K.sum(arg_7)\n\n    arg_8 = keras.layers.Lambda(target_layer)\n    arg_4[arg_2] = arg_8(arg_4[arg_3[0]])", "path": "pytorch2keras/operation_layers.py", "identifier": "convert_sum", "docstring": "Convert sum.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "sum", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 256711}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/git/timestamp.py#L168-L196", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Iterative over relative filepaths of files in a directory, and\n    sub-directories, with the given extension.", "language": "python", "parameters": "(extname, root_dir='.')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'.'", ")", ":", "if", "not", "arg_0", ".", "startswith", "(", "'.'", ")", ":", "arg_0", "=", "'.'", "+", "arg_0", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "os", ".", "walk", "(", "arg_1", ")", ":", "for", "arg_5", "in", "arg_4", ":", "if", "os", ".", "path", ".", "splitext", "(", "arg_5", ")", "[", "-", "1", "]", "==", "arg_0", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_5", ")", "arg_7", "=", "os", ".", "path", ".", "relpath", "(", "arg_6", ",", "start", "=", "arg_1", ")", "yield", "arg_7"], "function": "def Func(arg_0, arg_1='.'):\n    \"\"\"Iterative over relative filepaths of files in a directory, and\n    sub-directories, with the given extension.\n\n    Parameters\n    ----------\n    extname : `str`\n        Extension name (such as 'txt' or 'rst'). Extension comparison is\n        case sensitive.\n    root_dir : 'str`, optional\n        Root directory. Current working directory by default.\n\n    Yields\n    ------\n    filepath : `str`\n        File path, relative to ``root_dir``, with the given extension.\n    \"\"\"\n    # needed for comparison with os.path.splitext\n    if not arg_0.startswith('.'):\n        arg_0 = '.' + arg_0\n\n    arg_1 = os.path.abspath(arg_1)\n\n    for arg_2, arg_3, arg_4 in os.walk(arg_1):\n        for arg_5 in arg_4:\n            if os.path.splitext(arg_5)[-1] == arg_0:\n                arg_6 = os.path.join(arg_2, arg_5)\n                arg_7 = os.path.relpath(arg_6, start=arg_1)\n                yield arg_7", "path": "lsstprojectmeta/git/timestamp.py", "identifier": "_iter_filepaths_with_extension", "docstring": "Iterative over relative filepaths of files in a directory, and\n    sub-directories, with the given extension.\n\n    Parameters\n    ----------\n    extname : `str`\n        Extension name (such as 'txt' or 'rst'). Extension comparison is\n        case sensitive.\n    root_dir : 'str`, optional\n        Root directory. Current working directory by default.\n\n    Yields\n    ------\n    filepath : `str`\n        File path, relative to ``root_dir``, with the given extension.", "docstring_tokens": ["Iterative", "over", "relative", "filepaths", "of", "files", "in", "a", "directory", "and", "sub", "-", "directories", "with", "the", "given", "extension", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 256712}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L516-L537", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Scales out the number of blocks by \"blocks\"", "language": "python", "parameters": "(self, blocks=1)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "range", "(", "arg_1", ")", ":", "if", "arg_0", ".", "provider", ":", "arg_4", "=", "str", "(", "len", "(", "arg_0", ".", "blocks", ")", ")", "arg_5", "=", "arg_0", ".", "launch_cmd", ".", "format", "(", "block_id", "=", "arg_4", ")", "arg_6", "=", "arg_0", ".", "provider", ".", "submit", "(", "arg_5", ",", "1", ",", "1", ")", "logger", ".", "debug", "(", "\"Launched block {}->{}\"", ".", "format", "(", "arg_4", ",", "arg_6", ")", ")", "if", "not", "arg_6", ":", "raise", "(", "ScalingFailed", "(", "arg_0", ".", "provider", ".", "label", ",", "\"Attempts to provision nodes via provider has failed\"", ")", ")", "arg_2", ".", "extend", "(", "[", "arg_4", "]", ")", "arg_0", ".", "blocks", "[", "arg_4", "]", "=", "arg_6", "else", ":", "logger", ".", "error", "(", "\"No execution provider available\"", ")", "arg_2", "=", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1=1):\n        \"\"\"Scales out the number of blocks by \"blocks\"\n\n        Raises:\n             NotImplementedError\n        \"\"\"\n        arg_2 = []\n        for arg_3 in range(arg_1):\n            if arg_0.provider:\n                arg_4 = str(len(arg_0.blocks))\n                arg_5 = arg_0.launch_cmd.format(block_id=arg_4)\n                arg_6 = arg_0.provider.submit(arg_5, 1, 1)\n                logger.debug(\"Launched block {}->{}\".format(arg_4, arg_6))\n                if not arg_6:\n                    raise(ScalingFailed(arg_0.provider.label,\n                                        \"Attempts to provision nodes via provider has failed\"))\n                arg_2.extend([arg_4])\n                arg_0.blocks[arg_4] = arg_6\n            else:\n                logger.error(\"No execution provider available\")\n                arg_2 = None\n        return arg_2", "path": "parsl/executors/high_throughput/executor.py", "identifier": "HighThroughputExecutor.scale_out", "docstring": "Scales out the number of blocks by \"blocks\"\n\n        Raises:\n             NotImplementedError", "docstring_tokens": ["Scales", "out", "the", "number", "of", "blocks", "by", "blocks"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 256713}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L888-L896", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Generator for the LIST EXTENSIONS command.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "command", "(", "\"LIST EXTENSIONS\"", ")", "if", "arg_1", "!=", "202", ":", "raise", "NNTPReplyError", "(", "arg_1", ",", "arg_2", ")", "for", "arg_3", "in", "arg_0", ".", "info_gen", "(", "arg_1", ",", "arg_2", ")", ":", "yield", "arg_3", ".", "strip", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Generator for the LIST EXTENSIONS command.\n        \"\"\"\n        arg_1, arg_2 = arg_0.command(\"LIST EXTENSIONS\")\n        if arg_1 != 202:\n            raise NNTPReplyError(arg_1, arg_2)\n\n        for arg_3 in arg_0.info_gen(arg_1, arg_2):\n            yield arg_3.strip()", "path": "nntp/nntp.py", "identifier": "NNTPClient.list_extensions_gen", "docstring": "Generator for the LIST EXTENSIONS command.", "docstring_tokens": ["Generator", "for", "the", "LIST", "EXTENSIONS", "command", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 256714}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L421-L461", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Reads a specific amount of data from a stream and returns it. If there\n        is any data in initial_data, that will be popped out first.", "language": "python", "parameters": "(self, fileobj, amount, truncate=True)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "if", "len", "(", "arg_0", ".", "_initial_data", ")", "==", "0", ":", "return", "arg_1", ".", "read", "(", "arg_2", ")", "if", "arg_2", "<=", "len", "(", "arg_0", ".", "_initial_data", ")", ":", "arg_4", "=", "arg_0", ".", "_initial_data", "[", ":", "arg_2", "]", "if", "arg_3", ":", "arg_0", ".", "_initial_data", "=", "arg_0", ".", "_initial_data", "[", "arg_2", ":", "]", "return", "arg_4", "arg_6", "=", "arg_2", "-", "len", "(", "arg_0", ".", "_initial_data", ")", "arg_4", "=", "arg_0", ".", "_initial_data", "+", "arg_1", ".", "read", "(", "arg_6", ")", "if", "arg_3", ":", "arg_0", ".", "_initial_data", "=", "b''", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n        \"\"\"\n        Reads a specific amount of data from a stream and returns it. If there\n        is any data in initial_data, that will be popped out first.\n\n        :type fileobj: A file-like object that implements read\n        :param fileobj: The stream to read from.\n\n        :type amount: int\n        :param amount: The number of bytes to read from the stream.\n\n        :type truncate: bool\n        :param truncate: Whether or not to truncate initial_data after\n            reading from it.\n\n        :return: Generator which generates part bodies from the initial data.\n        \"\"\"\n        # If the the initial data is empty, we simply read from the fileobj\n        if len(arg_0._initial_data) == 0:\n            return arg_1.read(arg_2)\n\n        # If the requested number of bytes is less than the amount of\n        # initial data, pull entirely from initial data.\n        if arg_2 <= len(arg_0._initial_data):\n            arg_4 = arg_0._initial_data[:arg_2]\n            # Truncate initial data so we don't hang onto the data longer\n            # than we need.\n            if arg_3:\n                arg_0._initial_data = arg_0._initial_data[arg_2:]\n            return arg_4\n\n        # At this point there is some initial data left, but not enough to\n        # satisfy the number of bytes requested. Pull out the remaining\n        # initial data and read the rest from the fileobj.\n        arg_6 = arg_2 - len(arg_0._initial_data)\n        arg_4 = arg_0._initial_data + arg_1.read(arg_6)\n\n        # Zero out initial data so we don't hang onto the data any more.\n        if arg_3:\n            arg_0._initial_data = b''\n        return arg_4", "path": "s3transfer/upload.py", "identifier": "UploadNonSeekableInputManager._read", "docstring": "Reads a specific amount of data from a stream and returns it. If there\n        is any data in initial_data, that will be popped out first.\n\n        :type fileobj: A file-like object that implements read\n        :param fileobj: The stream to read from.\n\n        :type amount: int\n        :param amount: The number of bytes to read from the stream.\n\n        :type truncate: bool\n        :param truncate: Whether or not to truncate initial_data after\n            reading from it.\n\n        :return: Generator which generates part bodies from the initial data.", "docstring_tokens": ["Reads", "a", "specific", "amount", "of", "data", "from", "a", "stream", "and", "returns", "it", ".", "If", "there", "is", "any", "data", "in", "initial_data", "that", "will", "be", "popped", "out", "first", "."], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 256715}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/names.py#L253-L269", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Deletes all files in filelist", "language": "python", "parameters": "(filelist, folder='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "if", "not", "arg_1", ":", "for", "arg_2", "in", "arg_0", ":", "os", ".", "remove", "(", "arg_2", ")", "else", ":", "for", "arg_2", "in", "arg_0", ":", "os", ".", "remove", "(", "op", ".", "join", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=''):\n    \"\"\"Deletes all files in filelist\n\n    Parameters\n    ----------\n    filelist: list of str\n        List of the file paths to be removed\n\n    folder: str\n        Path to be used as common directory for all file paths in filelist\n    \"\"\"\n    if not arg_1:\n        for arg_2 in arg_0:\n            os.remove(arg_2)\n    else:\n        for arg_2 in arg_0:\n            os.remove(op.join(arg_1, arg_2))", "path": "boyle/files/names.py", "identifier": "remove_all", "docstring": "Deletes all files in filelist\n\n    Parameters\n    ----------\n    filelist: list of str\n        List of the file paths to be removed\n\n    folder: str\n        Path to be used as common directory for all file paths in filelist", "docstring_tokens": ["Deletes", "all", "files", "in", "filelist"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 256716}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L93-L121", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Delete job.", "language": "python", "parameters": "(ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "get_job_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'job'", ")", ")", "if", "not", "click", ".", "confirm", "(", "\"Are sure you want to Func job `{}`\"", ".", "format", "(", "arg_3", ")", ")", ":", "click", ".", "echo", "(", "'Existing without deleting job.'", ")", "sys", ".", "exit", "(", "1", ")", "try", ":", "arg_4", "=", "PolyaxonClient", "(", ")", ".", "job", ".", "Func_job", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "JobManager", ".", "purge", "(", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func job `{}`.'", ".", "format", "(", "arg_3", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "if", "arg_4", ".", "status_code", "==", "204", ":", "Printer", ".", "print_success", "(", "\"Job `{}` was Func successfully\"", ".", "format", "(", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Delete job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon job Func\n    ```\n    \"\"\"\n    arg_1, arg_2, arg_3 = get_job_or_local(arg_0.obj.get('project'), arg_0.obj.get('job'))\n    if not click.confirm(\"Are sure you want to Func job `{}`\".format(arg_3)):\n        click.echo('Existing without deleting job.')\n        sys.exit(1)\n\n    try:\n        arg_4 = PolyaxonClient().job.Func_job(\n            arg_1, arg_2, arg_3)\n        # Purge caching\n        JobManager.purge()\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func job `{}`.'.format(arg_3))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    if arg_4.status_code == 204:\n        Printer.print_success(\"Job `{}` was Func successfully\".format(arg_3))", "path": "polyaxon_cli/cli/job.py", "identifier": "delete", "docstring": "Delete job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon job delete\n    ```", "docstring_tokens": ["Delete", "job", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 256717}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/xdot_parser.py#L314-L324", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Returns the components of an ellipse.", "language": "python", "parameters": "(self, tokens, filled)", "return_statement": "return component", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "Ellipse", "(", "pen", "=", "arg_0", ".", "pen", ",", "x_origin", "=", "arg_1", "[", "\"x0\"", "]", ",", "y_origin", "=", "arg_1", "[", "\"y0\"", "]", ",", "e_width", "=", "arg_1", "[", "\"w\"", "]", ",", "e_height", "=", "arg_1", "[", "\"h\"", "]", ",", "arg_2", "=", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Returns the components of an ellipse. \"\"\"\n\n        arg_3 = Ellipse(pen=arg_0.pen,\n                            x_origin=arg_1[\"x0\"],\n                            y_origin=arg_1[\"y0\"],\n                            e_width=arg_1[\"w\"],\n                            e_height=arg_1[\"h\"],\n                            arg_2=arg_2)\n\n        return arg_3", "path": "godot/xdot_parser.py", "identifier": "XdotAttrParser._proc_ellipse", "docstring": "Returns the components of an ellipse.", "docstring_tokens": ["Returns", "the", "components", "of", "an", "ellipse", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 256718}
{"url": "https://github.com/thombashi/pingparsing/blob/0249df3e9d8fbd8f6f42243520e5f311736d3be9/pingparsing/_pingparsing.py#L112-L162", "sha": "0249df3e9d8fbd8f6f42243520e5f311736d3be9", "docstring_summary": "Parse ping command output.", "language": "python", "parameters": "(self, ping_message)", "return_statement": "return self.__stats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "if", "typepy", ".", "is_not_null_string", "(", "arg_1", ".", "stdout", ")", ":", "arg_1", "=", "arg_1", ".", "stdout", "except", "AttributeError", ":", "pass", "logger", ".", "debug", "(", "\"parsing ping result: {}\"", ".", "format", "(", "arg_1", ")", ")", "arg_0", ".", "__Funcr", "=", "NullPingParser", "(", ")", "if", "typepy", ".", "is_null_string", "(", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"ping_message is empty\"", ")", "arg_0", ".", "__stats", "=", "PingStats", "(", ")", "return", "arg_0", ".", "__stats", "arg_4", "=", "_to_unicode", "(", "arg_1", ")", ".", "splitlines", "(", ")", "arg_5", "=", "(", "LinuxPingParser", ",", "WindowsPingParser", ",", "MacOsPingParser", ",", "AlpineLinuxPingParser", ",", ")", "for", "arg_6", "in", "arg_5", ":", "arg_0", ".", "__Funcr", "=", "arg_6", "(", ")", "try", ":", "arg_0", ".", "__stats", "=", "arg_0", ".", "__Funcr", ".", "Func", "(", "arg_4", ")", "return", "arg_0", ".", "__stats", "except", "ParseError", "as", "e", ":", "if", "e", ".", "reason", "!=", "ParseErrorReason", ".", "HEADER_NOT_FOUND", ":", "raise", "e", "except", "pp", ".", "ParseException", ":", "pass", "arg_0", ".", "__Funcr", "=", "NullPingParser", "(", ")", "return", "arg_0", ".", "__stats"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Parse ping command output.\n\n        Args:\n            ping_message (str or :py:class:`~pingparsing.PingResult`):\n                ``ping`` command output.\n\n        Returns:\n            :py:class:`~pingparsing.PingStats`: Parsed result.\n        \"\"\"\n\n        try:\n            # accept PingResult instance as an input\n            if typepy.is_not_null_string(arg_1.stdout):\n                arg_1 = arg_1.stdout\n        except AttributeError:\n            pass\n\n        logger.debug(\"parsing ping result: {}\".format(arg_1))\n\n        arg_0.__Funcr = NullPingParser()\n\n        if typepy.is_null_string(arg_1):\n            logger.debug(\"ping_message is empty\")\n            arg_0.__stats = PingStats()\n\n            return arg_0.__stats\n\n        arg_4 = _to_unicode(arg_1).splitlines()\n        arg_5 = (\n            LinuxPingParser,\n            WindowsPingParser,\n            MacOsPingParser,\n            AlpineLinuxPingParser,\n        )\n\n        for arg_6 in arg_5:\n            arg_0.__Funcr = arg_6()\n            try:\n                arg_0.__stats = arg_0.__Funcr.Func(arg_4)\n                return arg_0.__stats\n            except ParseError as e:\n                if e.reason != ParseErrorReason.HEADER_NOT_FOUND:\n                    raise e\n            except pp.ParseException:\n                pass\n\n        arg_0.__Funcr = NullPingParser()\n\n        return arg_0.__stats", "path": "pingparsing/_pingparsing.py", "identifier": "PingParsing.parse", "docstring": "Parse ping command output.\n\n        Args:\n            ping_message (str or :py:class:`~pingparsing.PingResult`):\n                ``ping`` command output.\n\n        Returns:\n            :py:class:`~pingparsing.PingStats`: Parsed result.", "docstring_tokens": ["Parse", "ping", "command", "output", "."], "nwo": "thombashi/pingparsing", "score": 0.2855681421870085, "idx": 256719}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow_job.py#L115-L161", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Launch a new workflow job based on a workflow job template.", "language": "python", "parameters": "(self, workflow_job_template=None, monitor=False, wait=False,\n               timeout=None, extra_vars=None, **kwargs)", "return_statement": "return post_response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "**", "arg_6", ")", ":", "if", "arg_5", "is", "not", "None", "and", "len", "(", "arg_5", ")", ">", "0", ":", "arg_6", "[", "'extra_vars'", "]", "=", "parser", ".", "process_extra_vars", "(", "arg_5", ")", "debug", ".", "log", "(", "'Launching the workflow job.'", ",", "header", "=", "'details'", ")", "arg_0", ".", "_pop_none", "(", "arg_6", ")", "arg_7", "=", "client", ".", "post", "(", "'workflow_job_templates/{0}/Func/'", ".", "format", "(", "arg_1", ")", ",", "data", "=", "arg_6", ")", ".", "json", "(", ")", "arg_8", "=", "arg_7", "[", "'id'", "]", "arg_7", "[", "'changed'", "]", "=", "True", "if", "arg_2", ":", "return", "arg_0", ".", "monitor", "(", "arg_8", ",", "arg_4", "=", "arg_4", ")", "elif", "arg_3", ":", "return", "arg_0", ".", "wait", "(", "arg_8", ",", "arg_4", "=", "arg_4", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=False,\n               arg_4=None, arg_5=None, **arg_6):\n        \"\"\"Launch a new workflow job based on a workflow job template.\n\n        Creates a new workflow job in Ansible Tower, starts it, and\n        returns back an ID in order for its status to be monitored.\n\n        =====API DOCS=====\n        Launch a new workflow job based on a workflow job template.\n\n        :param workflow_job_template: Primary key or name of the workflow job template to Func new job.\n        :type workflow_job_template: str\n        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly Funced workflow job rather\n                        than exiting with a success.\n        :type monitor: bool\n        :param wait: Flag that if set, monitor the status of the workflow job, but do not print while job is\n                     in progress.\n        :type wait: bool\n        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number\n                        of seconds.\n        :type timeout: int\n        :param extra_vars: yaml formatted texts that contains extra variables to pass on.\n        :type extra_vars: array of strings\n        :param `**kwargs`: Fields needed to create and Func a workflow job.\n        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``\n                  call if ``wait`` flag is on; loaded JSON output of the job Func if none of the two flags are on.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        if arg_5 is not None and len(arg_5) > 0:\n            arg_6['extra_vars'] = parser.process_extra_vars(arg_5)\n\n        debug.log('Launching the workflow job.', header='details')\n        arg_0._pop_none(arg_6)\n        arg_7 = client.post('workflow_job_templates/{0}/Func/'.format(\n            arg_1), data=arg_6).json()\n\n        arg_8 = arg_7['id']\n        arg_7['changed'] = True\n\n        if arg_2:\n            return arg_0.monitor(arg_8, arg_4=arg_4)\n        elif arg_3:\n            return arg_0.wait(arg_8, arg_4=arg_4)\n\n        return arg_7", "path": "tower_cli/resources/workflow_job.py", "identifier": "Resource.launch", "docstring": "Launch a new workflow job based on a workflow job template.\n\n        Creates a new workflow job in Ansible Tower, starts it, and\n        returns back an ID in order for its status to be monitored.\n\n        =====API DOCS=====\n        Launch a new workflow job based on a workflow job template.\n\n        :param workflow_job_template: Primary key or name of the workflow job template to launch new job.\n        :type workflow_job_template: str\n        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly launched workflow job rather\n                        than exiting with a success.\n        :type monitor: bool\n        :param wait: Flag that if set, monitor the status of the workflow job, but do not print while job is\n                     in progress.\n        :type wait: bool\n        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number\n                        of seconds.\n        :type timeout: int\n        :param extra_vars: yaml formatted texts that contains extra variables to pass on.\n        :type extra_vars: array of strings\n        :param `**kwargs`: Fields needed to create and launch a workflow job.\n        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``\n                  call if ``wait`` flag is on; loaded JSON output of the job launch if none of the two flags are on.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Launch", "a", "new", "workflow", "job", "based", "on", "a", "workflow", "job", "template", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 256720}
{"url": "https://github.com/NoMore201/googleplay-api/blob/e5e60b83563055bd7e13778ad13a260d2547cbf2/gpapi/googleplay.py#L89-L128", "sha": "e5e60b83563055bd7e13778ad13a260d2547cbf2", "docstring_summary": "Encrypt credentials using the google publickey, with the\n        RSA algorithm", "language": "python", "parameters": "(self, login, passwd)", "return_statement": "return urlsafe_b64encode(h + ciphertext)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "b64decode", "(", "config", ".", "GOOGLE_PUBKEY", ")", "arg_4", "=", "utils", ".", "readInt", "(", "arg_3", ",", "0", ")", "arg_5", "=", "utils", ".", "toBigInt", "(", "arg_3", "[", "4", ":", "]", "[", "0", ":", "arg_4", "]", ")", "arg_6", "=", "utils", ".", "readInt", "(", "arg_3", ",", "arg_4", "+", "4", ")", "arg_7", "=", "utils", ".", "toBigInt", "(", "arg_3", "[", "arg_4", "+", "8", ":", "]", "[", "0", ":", "arg_6", "]", ")", "arg_8", "=", "hashes", ".", "Hash", "(", "hashes", ".", "SHA1", "(", ")", ",", "backend", "=", "default_backend", "(", ")", ")", "arg_8", ".", "update", "(", "arg_3", ")", "arg_9", "=", "b'\\x00'", "+", "arg_8", ".", "finalize", "(", ")", "[", "0", ":", "4", "]", "arg_10", "=", "encode_dss_signature", "(", "arg_5", ",", "arg_7", ")", "arg_11", "=", "load_der_public_key", "(", "arg_10", ",", "backend", "=", "default_backend", "(", ")", ")", "arg_12", "=", "arg_1", ".", "encode", "(", ")", "+", "b'\\x00'", "+", "arg_2", ".", "encode", "(", ")", "arg_13", "=", "arg_11", ".", "encrypt", "(", "arg_12", ",", "padding", ".", "OAEP", "(", "mgf", "=", "padding", ".", "MGF1", "(", "algorithm", "=", "hashes", ".", "SHA1", "(", ")", ")", ",", "algorithm", "=", "hashes", ".", "SHA1", "(", ")", ",", "label", "=", "None", ")", ")", "return", "urlsafe_b64encode", "(", "arg_9", "+", "arg_13", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Encrypt credentials using the google publickey, with the\n        RSA algorithm\"\"\"\n\n        # structure of the binary key:\n        #\n        # *-------------------------------------------------------*\n        # | modulus_length | modulus | exponent_length | exponent |\n        # *-------------------------------------------------------*\n        #\n        # modulus_length and exponent_length are uint32\n        arg_3 = b64decode(config.GOOGLE_PUBKEY)\n        # modulus\n        arg_4 = utils.readInt(arg_3, 0)\n        arg_5 = utils.toBigInt(arg_3[4:][0:arg_4])\n        # exponent\n        arg_6 = utils.readInt(arg_3, arg_4 + 4)\n        arg_7 = utils.toBigInt(arg_3[arg_4 + 8:][0:arg_6])\n\n        # calculate SHA1 of the pub key\n        arg_8 = hashes.Hash(hashes.SHA1(), backend=default_backend())\n        arg_8.update(arg_3)\n        arg_9 = b'\\x00' + arg_8.finalize()[0:4]\n\n        # generate a public key\n        arg_10 = encode_dss_signature(arg_5, arg_7)\n        arg_11 = load_der_public_key(arg_10, backend=default_backend())\n\n        # encrypt email and password using pubkey\n        arg_12 = arg_1.encode() + b'\\x00' + arg_2.encode()\n        arg_13 = arg_11.encrypt(\n            arg_12,\n            padding.OAEP(\n                mgf=padding.MGF1(algorithm=hashes.SHA1()),\n                algorithm=hashes.SHA1(),\n                label=None\n            )\n        )\n\n        return urlsafe_b64encode(arg_9 + arg_13)", "path": "gpapi/googleplay.py", "identifier": "GooglePlayAPI.encryptPassword", "docstring": "Encrypt credentials using the google publickey, with the\n        RSA algorithm", "docstring_tokens": ["Encrypt", "credentials", "using", "the", "google", "publickey", "with", "the", "RSA", "algorithm"], "nwo": "NoMore201/googleplay-api", "score": 0.758388427181661, "idx": 256721}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/text.py#L36-L45", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Remove a single pair of quotes from the endpoints of a string.", "language": "python", "parameters": "(istr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "arg_0", "if", "(", "arg_0", "[", "0", "]", "==", "\"'\"", "and", "arg_0", "[", "-", "1", "]", "==", "\"'\"", ")", "or", "(", "arg_0", "[", "0", "]", "==", "'\"'", "and", "arg_0", "[", "-", "1", "]", "==", "'\"'", ")", ":", "return", "arg_0", "[", "1", ":", "-", "1", "]", "else", ":", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Remove a single pair of quotes from the endpoints of a string.\"\"\"\n\n    if not arg_0:\n        return arg_0\n    if (arg_0[0]==\"'\" and arg_0[-1]==\"'\") or \\\n       (arg_0[0]=='\"' and arg_0[-1]=='\"'):\n        return arg_0[1:-1]\n    else:\n        return arg_0", "path": "environment/lib/python2.7/site-packages/IPython/utils/text.py", "identifier": "unquote_ends", "docstring": "Remove a single pair of quotes from the endpoints of a string.", "docstring_tokens": ["Remove", "a", "single", "pair", "of", "quotes", "from", "the", "endpoints", "of", "a", "string", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256722}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/stream.py#L69-L73", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Sets cursor as beginning of next line.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_eol", ".", "append", "(", "arg_0", ".", "position", ")", "arg_0", ".", "_lineno", "+=", "1", "arg_0", ".", "_col_offset", "=", "0"], "function": "def Func(arg_0):\n        \"\"\"Sets cursor as beginning of next line.\"\"\"\n        arg_0._eol.append(arg_0.position)\n        arg_0._lineno += 1\n        arg_0._col_offset = 0", "path": "pyrser/parsing/stream.py", "identifier": "Cursor.step_next_line", "docstring": "Sets cursor as beginning of next line.", "docstring_tokens": ["Sets", "cursor", "as", "beginning", "of", "next", "line", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 256723}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/gosquared.py#L38-L48", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "GoSquared tracking template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return GoSquaredNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "GoSquaredNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    GoSquared tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your GoSquared site token in the ``GOSQUARED_SITE_TOKEN`` setting.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return GoSquaredNode()", "path": "analytical/templatetags/gosquared.py", "identifier": "gosquared", "docstring": "GoSquared tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your GoSquared site token in the ``GOSQUARED_SITE_TOKEN`` setting.", "docstring_tokens": ["GoSquared", "tracking", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 256724}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/html.py#L268-L291", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Write the index.html file for this report.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Templite", "(", "data", "(", "\"index.html\"", ")", ",", "arg_0", ".", "template_globals", ")", "arg_0", ".", "totals", "=", "sum", "(", "[", "f", "[", "'nums'", "]", "for", "f", "in", "arg_0", ".", "files", "]", ")", "arg_3", "=", "arg_1", ".", "render", "(", "{", "'arcs'", ":", "arg_0", ".", "arcs", ",", "'extra_css'", ":", "arg_0", ".", "extra_css", ",", "'files'", ":", "arg_0", ".", "files", ",", "'totals'", ":", "arg_0", ".", "totals", ",", "}", ")", "if", "sys", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "arg_3", "=", "arg_3", ".", "decode", "(", "\"utf-8\"", ")", "arg_0", ".", "write_html", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "directory", ",", "\"index.html\"", ")", ",", "arg_3", ")", "arg_0", ".", "status", ".", "write", "(", "arg_0", ".", "directory", ")"], "function": "def Func(arg_0):\n        \"\"\"Write the index.html file for this report.\"\"\"\n        arg_1 = Templite(\n            data(\"index.html\"), arg_0.template_globals\n            )\n\n        arg_0.totals = sum([f['nums'] for f in arg_0.files])\n\n        arg_3 = arg_1.render({\n            'arcs': arg_0.arcs,\n            'extra_css': arg_0.extra_css,\n            'files': arg_0.files,\n            'totals': arg_0.totals,\n        })\n\n        if sys.version_info < (3, 0):\n            arg_3 = arg_3.decode(\"utf-8\")\n        arg_0.write_html(\n            os.path.join(arg_0.directory, \"index.html\"),\n            arg_3\n            )\n\n        # Write the latest hashes for next time.\n        arg_0.status.write(arg_0.directory)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/html.py", "identifier": "HtmlReporter.index_file", "docstring": "Write the index.html file for this report.", "docstring_tokens": ["Write", "the", "index", ".", "html", "file", "for", "this", "report", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 256725}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/server/server_cli.py#L606-L685", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Run WsgiDAV using cheroot.server if Cheroot is installed.", "language": "python", "parameters": "(app, config, mode)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "arg_2", "==", "\"cheroot\"", "try", ":", "from", "cheroot", "import", "arg_13", ",", "arg_4", "except", "ImportError", ":", "_logger", ".", "error", "(", "\"*\"", "*", "78", ")", "_logger", ".", "error", "(", "\"ERROR: Could not import Cheroot.\"", ")", "_logger", ".", "error", "(", "\"Try `pip install cheroot` or specify another server using the --server option.\"", ")", "_logger", ".", "error", "(", "\"*\"", "*", "78", ")", "raise", "arg_3", "=", "\"WsgiDAV/{} {} Python/{}\"", ".", "format", "(", "__version__", ",", "arg_4", ".", "Server", ".", "version", ",", "util", ".", "PYTHON_VERSION", ")", "arg_4", ".", "Server", ".", "version", "=", "arg_3", "arg_7", "=", "_get_checked_path", "(", "arg_1", ".", "get", "(", "\"ssl_certificate\"", ")", ",", "arg_1", ")", "arg_8", "=", "_get_checked_path", "(", "arg_1", ".", "get", "(", "\"ssl_private_key\"", ")", ",", "arg_1", ")", "arg_9", "=", "_get_checked_path", "(", "arg_1", ".", "get", "(", "\"ssl_certificate_chain\"", ")", ",", "arg_1", ")", "arg_10", "=", "arg_1", ".", "get", "(", "\"ssl_adapter\"", ",", "\"builtin\"", ")", "arg_11", "=", "\"http\"", "if", "arg_7", "and", "arg_8", ":", "arg_10", "=", "arg_13", ".", "get_ssl_adapter_class", "(", "arg_10", ")", "arg_4", ".", "Server", ".", "ssl_adapter", "=", "arg_10", "(", "arg_7", ",", "arg_8", ",", "arg_9", ")", "arg_11", "=", "\"https\"", "_logger", ".", "info", "(", "\"SSL / HTTPS enabled. Adapter: {}\"", ".", "format", "(", "arg_10", ")", ")", "elif", "arg_7", "or", "arg_8", ":", "raise", "RuntimeError", "(", "\"Option 'ssl_certificate' and 'ssl_private_key' must be used together.\"", ")", "_logger", ".", "info", "(", "\"Running {}\"", ".", "format", "(", "arg_3", ")", ")", "_logger", ".", "info", "(", "\"Serving on {}://{}:{} ...\"", ".", "format", "(", "arg_11", ",", "arg_1", "[", "\"host\"", "]", ",", "arg_1", "[", "\"port\"", "]", ")", ")", "arg_12", "=", "{", "\"bind_addr\"", ":", "(", "arg_1", "[", "\"host\"", "]", ",", "arg_1", "[", "\"port\"", "]", ")", ",", "\"wsgi_app\"", ":", "arg_0", ",", "\"server_name\"", ":", "arg_3", ",", "}", "arg_12", ".", "update", "(", "arg_1", ".", "get", "(", "\"server_args\"", ",", "{", "}", ")", ")", "arg_13", "=", "arg_4", ".", "Server", "(", "**", "arg_12", ")", "arg_14", "=", "arg_1", ".", "get", "(", "\"startup_event\"", ")", "if", "arg_14", ":", "def", "_patched_tick", "(", ")", ":", "arg_13", ".", "tick", "=", "arg_16", "_logger", ".", "info", "(", "\"wsgi.Server is ready\"", ")", "arg_14", ".", "set", "(", ")", "arg_16", "(", ")", "arg_16", "=", "arg_13", ".", "tick", "arg_13", ".", "tick", "=", "_patched_tick", "try", ":", "arg_13", ".", "start", "(", ")", "except", "KeyboardInterrupt", ":", "_logger", ".", "warning", "(", "\"Caught Ctrl-C, shutting down...\"", ")", "finally", ":", "arg_13", ".", "stop", "(", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Run WsgiDAV using cheroot.server if Cheroot is installed.\"\"\"\n    assert arg_2 == \"cheroot\"\n    try:\n        from cheroot import arg_13, arg_4\n    #         from cheroot.ssl.builtin import BuiltinSSLAdapter\n    #         import cheroot.ssl.pyopenssl\n    except ImportError:\n        _logger.error(\"*\" * 78)\n        _logger.error(\"ERROR: Could not import Cheroot.\")\n        _logger.error(\n            \"Try `pip install cheroot` or specify another server using the --server option.\"\n        )\n        _logger.error(\"*\" * 78)\n        raise\n\n    arg_3 = \"WsgiDAV/{} {} Python/{}\".format(\n        __version__, arg_4.Server.version, util.PYTHON_VERSION\n    )\n    arg_4.Server.version = arg_3\n\n    # Support SSL\n    arg_7 = _get_checked_path(arg_1.get(\"ssl_certificate\"), arg_1)\n    arg_8 = _get_checked_path(arg_1.get(\"ssl_private_key\"), arg_1)\n    arg_9 = _get_checked_path(\n        arg_1.get(\"ssl_certificate_chain\"), arg_1\n    )\n    arg_10 = arg_1.get(\"ssl_adapter\", \"builtin\")\n    arg_11 = \"http\"\n    if arg_7 and arg_8:\n        arg_10 = arg_13.get_ssl_adapter_class(arg_10)\n        arg_4.Server.ssl_adapter = arg_10(\n            arg_7, arg_8, arg_9\n        )\n        arg_11 = \"https\"\n        _logger.info(\"SSL / HTTPS enabled. Adapter: {}\".format(arg_10))\n    elif arg_7 or arg_8:\n        raise RuntimeError(\n            \"Option 'ssl_certificate' and 'ssl_private_key' must be used together.\"\n        )\n    #     elif ssl_adapter:\n    #         print(\"WARNING: Ignored option 'ssl_adapter' (requires 'ssl_certificate').\")\n\n    _logger.info(\"Running {}\".format(arg_3))\n    _logger.info(\n        \"Serving on {}://{}:{} ...\".format(arg_11, arg_1[\"host\"], arg_1[\"port\"])\n    )\n\n    arg_12 = {\n        \"bind_addr\": (arg_1[\"host\"], arg_1[\"port\"]),\n        \"wsgi_app\": arg_0,\n        \"server_name\": arg_3,\n    }\n    # Override or add custom args\n    arg_12.update(arg_1.get(\"server_args\", {}))\n\n    arg_13 = arg_4.Server(**arg_12)\n\n    # If the caller passed a startup event, monkey patch the server to set it\n    # when the request handler loop is entered\n    arg_14 = arg_1.get(\"startup_event\")\n    if arg_14:\n\n        def _patched_tick():\n            arg_13.tick = arg_16  # undo the monkey patch\n            _logger.info(\"wsgi.Server is ready\")\n            arg_14.set()\n            arg_16()\n\n        arg_16 = arg_13.tick\n        arg_13.tick = _patched_tick\n\n    try:\n        arg_13.start()\n    except KeyboardInterrupt:\n        _logger.warning(\"Caught Ctrl-C, shutting down...\")\n    finally:\n        arg_13.stop()\n\n    return", "path": "wsgidav/server/server_cli.py", "identifier": "_run_cheroot", "docstring": "Run WsgiDAV using cheroot.server if Cheroot is installed.", "docstring_tokens": ["Run", "WsgiDAV", "using", "cheroot", ".", "server", "if", "Cheroot", "is", "installed", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 256726}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/timers/music.py#L68-L77", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Set the current time in the music in seconds causing the player\n        to seek to this location in the file.", "language": "python", "parameters": "(self, value: float)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "if", "arg_1", "<", "0", ":", "arg_1", "=", "0", "mixer", ".", "music", ".", "set_pos", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        Set the current time in the music in seconds causing the player\n        to seek to this location in the file.\n        \"\"\"\n        if arg_1 < 0:\n            arg_1 = 0\n\n        # mixer.music.play(start=value)\n        mixer.music.set_pos(arg_1)", "path": "demosys/timers/music.py", "identifier": "Timer.set_time", "docstring": "Set the current time in the music in seconds causing the player\n        to seek to this location in the file.", "docstring_tokens": ["Set", "the", "current", "time", "in", "the", "music", "in", "seconds", "causing", "the", "player", "to", "seek", "to", "this", "location", "in", "the", "file", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 256727}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/device.py#L94-L99", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Called when advertisement data is received.", "language": "python", "parameters": "(self, advertised)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'kCBAdvDataServiceUUIDs'", "in", "arg_1", ":", "arg_0", ".", "_advertised", "=", "arg_0", ".", "_advertised", "+", "map", "(", "cbuuid_to_uuid", ",", "arg_1", "[", "'kCBAdvDataServiceUUIDs'", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Called when advertisement data is received.\"\"\"\n        # Advertisement data was received, pull out advertised service UUIDs and\n        # name from advertisement data.\n        if 'kCBAdvDataServiceUUIDs' in arg_1:\n            arg_0._advertised = arg_0._advertised + map(cbuuid_to_uuid, arg_1['kCBAdvDataServiceUUIDs'])", "path": "Adafruit_BluefruitLE/corebluetooth/device.py", "identifier": "CoreBluetoothDevice._update_advertised", "docstring": "Called when advertisement data is received.", "docstring_tokens": ["Called", "when", "advertisement", "data", "is", "received", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 256728}
{"url": "https://github.com/tonyseek/flask-navigation/blob/38fa83addcbe62f31516763fbe3c0bbdc793dc96/flask_navigation/utils.py#L5-L17", "sha": "38fa83addcbe62f31516763fbe3c0bbdc793dc96", "docstring_summary": "Freezes ``dict`` into ``tuple``.", "language": "python", "parameters": "(dict_)", "return_statement": "return tuple(sorted(pairs, key=key_getter))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "items", "(", ")", "arg_2", "=", "operator", ".", "itemgetter", "(", "0", ")", "return", "tuple", "(", "sorted", "(", "arg_1", ",", "key", "=", "arg_2", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Freezes ``dict`` into ``tuple``.\n\n    A typical usage is packing ``dict`` into hashable.\n\n    e.g.::\n\n        >>> Func({'a': 1, 'b': 2})\n        (('a', 1), ('b', 2))\n    \"\"\"\n    arg_1 = arg_0.items()\n    arg_2 = operator.itemgetter(0)\n    return tuple(sorted(arg_1, key=arg_2))", "path": "flask_navigation/utils.py", "identifier": "freeze_dict", "docstring": "Freezes ``dict`` into ``tuple``.\n\n    A typical usage is packing ``dict`` into hashable.\n\n    e.g.::\n\n        >>> freeze_dict({'a': 1, 'b': 2})\n        (('a', 1), ('b', 2))", "docstring_tokens": ["Freezes", "dict", "into", "tuple", "."], "nwo": "tonyseek/flask-navigation", "score": 0.19068666759575023, "idx": 256729}
{"url": "https://github.com/xu2243051/easyui-menu/blob/4da0b50cf2d3ddb0f1ec7a4da65fd3c4339f8dfb/easyui/mixins/model_mixins.py#L14-L22", "sha": "4da0b50cf2d3ddb0f1ec7a4da65fd3c4339f8dfb", "docstring_summary": "get all fields of model, execpt id", "language": "python", "parameters": "(self)", "return_statement": "return field_names", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_meta", ".", "get_all_field_names", "(", ")", "if", "'id'", "in", "arg_1", ":", "arg_1", ".", "remove", "(", "'id'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        get all fields of model, execpt id\n        \"\"\"\n        arg_1 = arg_0._meta.get_all_field_names()\n        if 'id' in arg_1:\n            arg_1.remove('id')\n\n        return arg_1", "path": "easyui/mixins/model_mixins.py", "identifier": "ModelMixin.get_default_fields", "docstring": "get all fields of model, execpt id", "docstring_tokens": ["get", "all", "fields", "of", "model", "execpt", "id"], "nwo": "xu2243051/easyui-menu", "score": 0.2744346966463966, "idx": 256730}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/reshape.py#L243-L313", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Replaces the rightmost dims in a `Tensor` representing a shape.", "language": "python", "parameters": "(\n    input_shape, event_shape_in, event_shape_out, validate_args)", "return_statement": "return output_shape, output_tensorshape", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "_replace_event_shape_in_tensorshape", "(", "tensorshape_util", ".", "constant_value_as_shape", "(", "arg_0", ")", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "(", "map", "(", "tf", ".", "identity", ",", "(", "arg_1", ",", "arg_2", ")", ")", "if", "arg_3", "else", "(", ")", ")", "if", "(", "tensorshape_util", ".", "is_fully_defined", "(", "arg_4", ")", "and", "(", "arg_5", "or", "not", "arg_3", ")", ")", ":", "with", "tf", ".", "control_dependencies", "(", "arg_6", ")", ":", "arg_7", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_4", ",", "name", "=", "'output_shape'", ",", "dtype_hint", "=", "tf", ".", "int32", ")", "return", "arg_7", ",", "arg_4", "with", "tf", ".", "control_dependencies", "(", "arg_6", ")", ":", "arg_8", "=", "(", "tf", ".", "size", "(", "input", "=", "arg_1", ")", "if", "tensorshape_util", ".", "num_elements", "(", "arg_1", ".", "shape", ")", "is", "None", "else", "tensorshape_util", ".", "num_elements", "(", "arg_1", ".", "shape", ")", ")", "arg_9", ",", "arg_10", "=", "tf", ".", "split", "(", "arg_0", ",", "num_or_size_splits", "=", "[", "-", "1", ",", "arg_8", "]", ")", "arg_11", "=", "[", "]", "if", "arg_5", ":", "pass", "elif", "arg_3", ":", "arg_12", "=", "arg_1", ">=", "0", "arg_13", "=", "tf", ".", "boolean_mask", "(", "tensor", "=", "arg_10", ",", "arg_12", "=", "arg_12", ")", "arg_14", "=", "tf", ".", "boolean_mask", "(", "tensor", "=", "arg_1", ",", "arg_12", "=", "arg_12", ")", "arg_11", ".", "append", "(", "assert_util", ".", "assert_equal", "(", "arg_13", ",", "arg_14", ",", "message", "=", "'Input `event_shape` does not match `event_shape_in`.'", ")", ")", "with", "tf", ".", "control_dependencies", "(", "arg_11", ")", ":", "arg_7", "=", "tf", ".", "concat", "(", "[", "arg_9", ",", "arg_2", "]", ",", "axis", "=", "0", ",", "name", "=", "'output_shape'", ")", "return", "arg_7", ",", "arg_4"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Replaces the rightmost dims in a `Tensor` representing a shape.\n\n  Args:\n    input_shape: a rank-1 `Tensor` of integers\n    event_shape_in: the event shape expected to be present in rightmost dims\n      of `shape_in`.\n    event_shape_out: the event shape with which to replace `event_shape_in` in\n      the rightmost dims of `input_shape`.\n    validate_args: Python `bool` indicating whether arguments should\n      be checked for correctness.\n\n  Returns:\n    output_shape: A rank-1 integer `Tensor` with the same contents as\n      `input_shape` except for the event dims, which are replaced with\n      `event_shape_out`.\n  \"\"\"\n  arg_4, arg_5 = _replace_event_shape_in_tensorshape(\n      tensorshape_util.constant_value_as_shape(arg_0),\n      arg_1,\n      arg_2)\n\n  # TODO(b/124240153): Remove map(tf.identity, deps) once tf.function\n  # correctly supports control_dependencies.\n  arg_6 = (\n      map(tf.identity, (arg_1, arg_2))\n      if arg_3 else ())\n\n  if (tensorshape_util.is_fully_defined(arg_4) and\n      (arg_5 or not arg_3)):\n    with tf.control_dependencies(arg_6):\n      arg_7 = tf.convert_to_tensor(\n          value=arg_4, name='output_shape', dtype_hint=tf.int32)\n    return arg_7, arg_4\n\n  with tf.control_dependencies(arg_6):\n    arg_8 = (\n        tf.size(input=arg_1)\n        if tensorshape_util.num_elements(arg_1.shape) is None else\n        tensorshape_util.num_elements(arg_1.shape))\n    arg_9, arg_10 = tf.split(\n        arg_0, num_or_size_splits=[-1, arg_8])\n\n  arg_11 = []\n  if arg_5:\n    pass\n  elif arg_3:\n    # Check that `input_event_shape` and `event_shape_in` are compatible in the\n    # sense that they have equal entries in any position that isn't a `-1` in\n    # `event_shape_in`. Note that our validations at construction time ensure\n    # there is at most one such entry in `event_shape_in`.\n    arg_12 = arg_1 >= 0\n    arg_13 = tf.boolean_mask(\n        tensor=arg_10, arg_12=arg_12)\n    arg_14 = tf.boolean_mask(\n        tensor=arg_1, arg_12=arg_12)\n    arg_11.append(\n        assert_util.assert_equal(\n            arg_13,\n            arg_14,\n            message='Input `event_shape` does not match `event_shape_in`.'))\n    # We don't explicitly additionally verify\n    # `tf.size(input_shape) > tf.size(event_shape_in)` since `tf.split`\n    # already makes this assertion.\n\n  with tf.control_dependencies(arg_11):\n    arg_7 = tf.concat([arg_9, arg_2], axis=0,\n                             name='output_shape')\n\n  return arg_7, arg_4", "path": "tensorflow_probability/python/bijectors/reshape.py", "identifier": "_replace_event_shape_in_shape_tensor", "docstring": "Replaces the rightmost dims in a `Tensor` representing a shape.\n\n  Args:\n    input_shape: a rank-1 `Tensor` of integers\n    event_shape_in: the event shape expected to be present in rightmost dims\n      of `shape_in`.\n    event_shape_out: the event shape with which to replace `event_shape_in` in\n      the rightmost dims of `input_shape`.\n    validate_args: Python `bool` indicating whether arguments should\n      be checked for correctness.\n\n  Returns:\n    output_shape: A rank-1 integer `Tensor` with the same contents as\n      `input_shape` except for the event dims, which are replaced with\n      `event_shape_out`.", "docstring_tokens": ["Replaces", "the", "rightmost", "dims", "in", "a", "Tensor", "representing", "a", "shape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256731}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L172-L235", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates a new storage account in Windows Azure.", "language": "python", "parameters": "(self, service_name, description, label,\n                               affinity_group=None, location=None,\n                               geo_replication_enabled=None,\n                               extended_properties=None,\n                               account_type='Standard_GRS')", "return_statement": "return self._perform_post(\n            self._get_storage_service_path(),\n            _XmlSerializer.create_storage_service_input_to_xml(\n                service_name,\n                description,\n                label,\n                affinity_group,\n                location,\n                account_type,\n                extended_properties),\n            as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "'Standard_GRS'", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'description'", ",", "arg_2", ")", "_validate_not_none", "(", "'label'", ",", "arg_3", ")", "if", "arg_4", "is", "None", "and", "arg_5", "is", "None", ":", "raise", "ValueError", "(", "'location or affinity_group must be specified'", ")", "if", "arg_4", "is", "not", "None", "and", "arg_5", "is", "not", "None", ":", "raise", "ValueError", "(", "'Only one of location or affinity_group needs to be specified'", ")", "if", "arg_6", "==", "False", ":", "arg_8", "=", "'Standard_LRS'", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_storage_service_path", "(", ")", ",", "_XmlSerializer", ".", "create_storage_service_input_to_xml", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_8", ",", "arg_7", ")", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                               arg_4=None, arg_5=None,\n                               arg_6=None,\n                               arg_7=None,\n                               arg_8='Standard_GRS'):\n        '''\n        Creates a new storage account in Windows Azure.\n\n        service_name:\n            A name for the storage account that is unique within Windows Azure.\n            Storage account names must be between 3 and 24 characters in length\n            and use numbers and lower-case letters only.\n        description:\n            A description for the storage account. The description may be up\n            to 1024 characters in length.\n        label:\n            A name for the storage account. The name may be up to 100\n            characters in length. The name can be used to identify the storage\n            account for your tracking purposes.\n        affinity_group:\n            The name of an existing affinity group in the specified\n            subscription. You can specify either a location or affinity_group,\n            but not both.\n        location:\n            The location where the storage account is created. You can specify\n            either a location or affinity_group, but not both.\n        geo_replication_enabled:\n            Deprecated. Replaced by the account_type parameter.\n        extended_properties:\n            Dictionary containing name/value pairs of storage account\n            properties. You can have a maximum of 50 extended property\n            name/value pairs. The maximum length of the Name element is 64\n            characters, only alphanumeric characters and underscores are valid\n            in the Name, and the name must start with a letter. The value has\n            a maximum length of 255 characters.\n        account_type:\n            Specifies whether the account supports locally-redundant storage,\n            geo-redundant storage, zone-redundant storage, or read access\n            geo-redundant storage.\n            Possible values are:\n                Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('description', arg_2)\n        _validate_not_none('label', arg_3)\n        if arg_4 is None and arg_5 is None:\n            raise ValueError(\n                'location or affinity_group must be specified')\n        if arg_4 is not None and arg_5 is not None:\n            raise ValueError(\n                'Only one of location or affinity_group needs to be specified')\n        if arg_6 == False:\n            arg_8 = 'Standard_LRS'\n        return arg_0._perform_post(\n            arg_0._get_storage_service_path(),\n            _XmlSerializer.create_storage_service_input_to_xml(\n                arg_1,\n                arg_2,\n                arg_3,\n                arg_4,\n                arg_5,\n                arg_8,\n                arg_7),\n            as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.create_storage_account", "docstring": "Creates a new storage account in Windows Azure.\n\n        service_name:\n            A name for the storage account that is unique within Windows Azure.\n            Storage account names must be between 3 and 24 characters in length\n            and use numbers and lower-case letters only.\n        description:\n            A description for the storage account. The description may be up\n            to 1024 characters in length.\n        label:\n            A name for the storage account. The name may be up to 100\n            characters in length. The name can be used to identify the storage\n            account for your tracking purposes.\n        affinity_group:\n            The name of an existing affinity group in the specified\n            subscription. You can specify either a location or affinity_group,\n            but not both.\n        location:\n            The location where the storage account is created. You can specify\n            either a location or affinity_group, but not both.\n        geo_replication_enabled:\n            Deprecated. Replaced by the account_type parameter.\n        extended_properties:\n            Dictionary containing name/value pairs of storage account\n            properties. You can have a maximum of 50 extended property\n            name/value pairs. The maximum length of the Name element is 64\n            characters, only alphanumeric characters and underscores are valid\n            in the Name, and the name must start with a letter. The value has\n            a maximum length of 255 characters.\n        account_type:\n            Specifies whether the account supports locally-redundant storage,\n            geo-redundant storage, zone-redundant storage, or read access\n            geo-redundant storage.\n            Possible values are:\n                Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS", "docstring_tokens": ["Creates", "a", "new", "storage", "account", "in", "Windows", "Azure", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256732}
{"url": "https://github.com/xnuinside/clifier/blob/3d704a30dc985bea3b876216accc53c19dc8b0df/clifier/clifier.py#L48-L57", "sha": "3d704a30dc985bea3b876216accc53c19dc8b0df", "docstring_summary": "apply default settings to commands\n            not static, shadow \"self\" in eval", "language": "python", "parameters": "(self, commands)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "'action'", "in", "arg_2", "and", "\"()\"", "in", "arg_2", "[", "'action'", "]", ":", "arg_2", "[", "'action'", "]", "=", "eval", "(", "\"self.{}\"", ".", "format", "(", "arg_2", "[", "'action'", "]", ")", ")", "if", "arg_2", "[", "'keys'", "]", "[", "0", "]", ".", "startswith", "(", "'-'", ")", ":", "if", "'required'", "not", "in", "arg_2", ":", "arg_2", "[", "'required'", "]", "=", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\" apply default settings to commands\n            not static, shadow \"self\" in eval\n        \"\"\"\n        for arg_2 in arg_1:\n            if 'action' in arg_2 and \"()\" in arg_2['action']:\n                arg_2['action'] = eval(\"self.{}\".format(arg_2['action']))\n            if arg_2['keys'][0].startswith('-'):\n                if 'required' not in arg_2:\n                    arg_2['required'] = False", "path": "clifier/clifier.py", "identifier": "Clifier.apply_defaults", "docstring": "apply default settings to commands\n            not static, shadow \"self\" in eval", "docstring_tokens": ["apply", "default", "settings", "to", "commands", "not", "static", "shadow", "self", "in", "eval"], "nwo": "xnuinside/clifier", "score": 0.0, "idx": 256733}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L232-L251", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Get the kibiter vesion.", "language": "python", "parameters": "(self)", "return_statement": "return version", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "arg_0", ".", "conf", "[", "'es_enrichment'", "]", "[", "'url'", "]", "arg_3", "=", "'.kibana/config/_search'", "arg_4", "=", "urijoin", "(", "arg_2", ",", "arg_3", ")", "arg_1", "=", "None", "try", ":", "arg_5", "=", "arg_0", ".", "grimoire_con", ".", "get", "(", "arg_4", ")", "arg_5", ".", "raise_for_status", "(", ")", "arg_1", "=", "arg_5", ".", "json", "(", ")", "[", "'hits'", "]", "[", "'hits'", "]", "[", "0", "]", "[", "'_id'", "]", "logger", ".", "debug", "(", "\"Kibiter version: %s\"", ",", "arg_1", ")", "except", "requests", ".", "exceptions", ".", "HTTPError", ":", "logger", ".", "warning", "(", "\"Can not find Kibiter version\"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Get the kibiter vesion.\n\n        :param major: major Elasticsearch version\n        \"\"\"\n        arg_1 = None\n\n        arg_2 = arg_0.conf['es_enrichment']['url']\n        arg_3 = '.kibana/config/_search'\n        arg_4 = urijoin(arg_2, arg_3)\n        arg_1 = None\n        try:\n            arg_5 = arg_0.grimoire_con.get(arg_4)\n            arg_5.raise_for_status()\n            arg_1 = arg_5.json()['hits']['hits'][0]['_id']\n            logger.debug(\"Kibiter version: %s\", arg_1)\n        except requests.exceptions.HTTPError:\n            logger.warning(\"Can not find Kibiter version\")\n\n        return arg_1", "path": "sirmordred/task_panels.py", "identifier": "TaskPanels.__kibiter_version", "docstring": "Get the kibiter vesion.\n\n        :param major: major Elasticsearch version", "docstring_tokens": ["Get", "the", "kibiter", "vesion", "."], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 256734}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L799-L877", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Encrypts plaintext via CryptoAPI", "language": "python", "parameters": "(cipher, key, data, iv, padding)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "None", "arg_6", "=", "None", "try", ":", "arg_5", ",", "arg_6", "=", "_advapi32_create_handles", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "arg_7", "=", "new", "(", "advapi32", ",", "'DWORD *'", ",", "len", "(", "arg_2", ")", ")", "arg_8", "=", "advapi32", ".", "CryptEncrypt", "(", "arg_6", ",", "null", "(", ")", ",", "True", ",", "0", ",", "null", "(", ")", ",", "arg_7", ",", "0", ")", "handle_error", "(", "arg_8", ")", "arg_9", "=", "deref", "(", "arg_7", ")", "arg_10", "=", "buffer_from_bytes", "(", "arg_9", ")", "write_to_buffer", "(", "arg_10", ",", "arg_2", ")", "pointer_set", "(", "arg_7", ",", "len", "(", "arg_2", ")", ")", "arg_8", "=", "advapi32", ".", "CryptEncrypt", "(", "arg_6", ",", "null", "(", ")", ",", "True", ",", "0", ",", "arg_10", ",", "arg_7", ",", "arg_9", ")", "handle_error", "(", "arg_8", ")", "arg_11", "=", "bytes_from_buffer", "(", "arg_10", ",", "deref", "(", "arg_7", ")", ")", "if", "arg_0", "==", "'aes'", "and", "not", "arg_4", ":", "if", "arg_11", "[", "-", "16", ":", "]", "!=", "(", "b'\\x10'", "*", "16", ")", ":", "raise", "ValueError", "(", "'Invalid padding generated by OS crypto library'", ")", "arg_11", "=", "arg_11", "[", ":", "-", "16", "]", "return", "arg_11", "finally", ":", "if", "arg_6", ":", "advapi32", ".", "CryptDestroyKey", "(", "arg_6", ")", "if", "arg_5", ":", "close_context_handle", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Encrypts plaintext via CryptoAPI\n\n    :param cipher:\n        A unicode string of \"aes\", \"des\", \"tripledes_2key\", \"tripledes_3key\",\n        \"rc2\", \"rc4\"\n\n    :param key:\n        The encryption key - a byte string 5-16 bytes long\n\n    :param data:\n        The plaintext - a byte string\n\n    :param iv:\n        The initialization vector - a byte string - unused for RC4\n\n    :param padding:\n        Boolean, if padding should be used - unused for RC4\n\n    :raises:\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A byte string of the ciphertext\n    \"\"\"\n\n    arg_5 = None\n    arg_6 = None\n\n    try:\n        arg_5, arg_6 = _advapi32_create_handles(arg_0, arg_1, arg_3)\n\n        arg_7 = new(advapi32, 'DWORD *', len(arg_2))\n        arg_8 = advapi32.CryptEncrypt(\n            arg_6,\n            null(),\n            True,\n            0,\n            null(),\n            arg_7,\n            0\n        )\n        handle_error(arg_8)\n\n        arg_9 = deref(arg_7)\n        arg_10 = buffer_from_bytes(arg_9)\n        write_to_buffer(arg_10, arg_2)\n\n        pointer_set(arg_7, len(arg_2))\n        arg_8 = advapi32.CryptEncrypt(\n            arg_6,\n            null(),\n            True,\n            0,\n            arg_10,\n            arg_7,\n            arg_9\n        )\n        handle_error(arg_8)\n\n        arg_11 = bytes_from_buffer(arg_10, deref(arg_7))\n\n        # Remove padding when not required. CryptoAPI doesn't support this, so\n        # we just manually remove it.\n        if arg_0 == 'aes' and not arg_4:\n            if arg_11[-16:] != (b'\\x10' * 16):\n                raise ValueError('Invalid padding generated by OS crypto library')\n            arg_11 = arg_11[:-16]\n\n        return arg_11\n\n    finally:\n        if arg_6:\n            advapi32.CryptDestroyKey(arg_6)\n        if arg_5:\n            close_context_handle(arg_5)", "path": "oscrypto/_win/symmetric.py", "identifier": "_advapi32_encrypt", "docstring": "Encrypts plaintext via CryptoAPI\n\n    :param cipher:\n        A unicode string of \"aes\", \"des\", \"tripledes_2key\", \"tripledes_3key\",\n        \"rc2\", \"rc4\"\n\n    :param key:\n        The encryption key - a byte string 5-16 bytes long\n\n    :param data:\n        The plaintext - a byte string\n\n    :param iv:\n        The initialization vector - a byte string - unused for RC4\n\n    :param padding:\n        Boolean, if padding should be used - unused for RC4\n\n    :raises:\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A byte string of the ciphertext", "docstring_tokens": ["Encrypts", "plaintext", "via", "CryptoAPI"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 256735}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L241-L252", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "helper method for implementing `client.pull` via `client.apply`", "language": "python", "parameters": "(keys)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "globals", "(", ")", "if", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ",", "set", ")", ")", ":", "for", "arg_2", "in", "arg_0", ":", "if", "not", "arg_1", ".", "has_key", "(", "arg_2", ")", ":", "raise", "NameError", "(", "\"name '%s' is not defined\"", "%", "arg_2", ")", "return", "map", "(", "arg_1", ".", "get", ",", "arg_0", ")", "else", ":", "if", "not", "arg_1", ".", "has_key", "(", "arg_0", ")", ":", "raise", "NameError", "(", "\"name '%s' is not defined\"", "%", "arg_0", ")", "return", "arg_1", ".", "get", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"helper method for implementing `client.pull` via `client.apply`\"\"\"\n    arg_1 = globals()\n    if isinstance(arg_0, (list,tuple, set)):\n        for arg_2 in arg_0:\n            if not arg_1.has_key(arg_2):\n                raise NameError(\"name '%s' is not defined\"%arg_2)\n        return map(arg_1.get, arg_0)\n    else:\n        if not arg_1.has_key(arg_0):\n            raise NameError(\"name '%s' is not defined\"%arg_0)\n        return arg_1.get(arg_0)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/util.py", "identifier": "_pull", "docstring": "helper method for implementing `client.pull` via `client.apply`", "docstring_tokens": ["helper", "method", "for", "implementing", "client", ".", "pull", "via", "client", ".", "apply"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256736}
{"url": "https://github.com/foxx/peewee-extras/blob/327e7e63465b3f6e1afc0e6a651f4cb5c8c60889/old/old.py#L13-L26", "sha": "327e7e63465b3f6e1afc0e6a651f4cb5c8c60889", "docstring_summary": "Convert UUID to binary blob", "language": "python", "parameters": "(self, value)", "return_statement": "return super(OrderedUUIDField, self).db_value(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "UUID", ")", ":", "arg_1", "=", "UUID", "(", "arg_1", ")", "arg_2", "=", "str", "(", "arg_1", ")", ".", "split", "(", "\"-\"", ")", "arg_3", "=", "''", ".", "join", "(", "[", "arg_2", "[", "2", "]", ",", "arg_2", "[", "1", "]", ",", "arg_2", "[", "0", "]", ",", "arg_2", "[", "3", "]", ",", "arg_2", "[", "4", "]", "]", ")", "arg_1", "=", "binascii", ".", "unhexlify", "(", "arg_3", ")", "return", "super", "(", "OrderedUUIDField", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert UUID to binary blob\n        \"\"\"\n\n        # ensure we have a valid UUID\n        if not isinstance(arg_1, UUID):\n            arg_1 = UUID(arg_1)\n\n        # reconstruct for optimal indexing\n        arg_2 = str(arg_1).split(\"-\")\n        arg_3 = ''.join([arg_2[2], arg_2[1], arg_2[0], arg_2[3], arg_2[4]])\n        arg_1 = binascii.unhexlify(arg_3)\n        return super(OrderedUUIDField, arg_0).Func(arg_1)", "path": "old/old.py", "identifier": "OrderedUUIDField.db_value", "docstring": "Convert UUID to binary blob", "docstring_tokens": ["Convert", "UUID", "to", "binary", "blob"], "nwo": "foxx/peewee-extras", "score": 0.36327422921566166, "idx": 256737}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2289-L2315", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Print to the screen the rewritten form of the user's command.", "language": "python", "parameters": "(self, cmd)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "show_rewritten_input", ":", "return", "arg_2", "=", "arg_0", ".", "prompt_manager", ".", "render", "(", "'rewrite'", ")", "+", "arg_1", "try", ":", "arg_2", "=", "str", "(", "arg_2", ")", "print", ">>", "io", ".", "stdout", ",", "arg_2", "except", "UnicodeEncodeError", ":", "print", "\"------> \"", "+", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Print to the screen the rewritten form of the user's command.\n\n        This shows visual feedback by rewriting input lines that cause\n        automatic calling to kick in, like::\n\n          /f x\n\n        into::\n\n          ------> f(x)\n\n        after the user's input prompt.  This helps the user understand that the\n        input line was transformed automatically by IPython.\n        \"\"\"\n        if not arg_0.show_rewritten_input:\n            return\n        \n        arg_2 = arg_0.prompt_manager.render('rewrite') + arg_1\n\n        try:\n            # plain ascii works better w/ pyreadline, on some machines, so\n            # we use it and only print uncolored rewrite if we have unicode\n            arg_2 = str(arg_2)\n            print >> io.stdout, arg_2\n        except UnicodeEncodeError:\n            print \"------> \" + arg_1", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.auto_rewrite_input", "docstring": "Print to the screen the rewritten form of the user's command.\n\n        This shows visual feedback by rewriting input lines that cause\n        automatic calling to kick in, like::\n\n          /f x\n\n        into::\n\n          ------> f(x)\n\n        after the user's input prompt.  This helps the user understand that the\n        input line was transformed automatically by IPython.", "docstring_tokens": ["Print", "to", "the", "screen", "the", "rewritten", "form", "of", "the", "user", "s", "command", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256738}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/time_frequency.py#L30-L68", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Converts frame indices to audio sample indices.", "language": "python", "parameters": "(frames, hop_length=512, n_fft=None)", "return_statement": "return (np.asanyarray(frames) * hop_length + offset).astype(int)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "512", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "0", "if", "arg_2", "is", "not", "None", ":", "arg_3", "=", "int", "(", "arg_2", "//", "2", ")", "return", "(", "np", ".", "asanyarray", "(", "arg_0", ")", "*", "arg_1", "+", "arg_3", ")", ".", "astype", "(", "int", ")"], "function": "def Func(arg_0, arg_1=512, arg_2=None):\n    \"\"\"Converts frame indices to audio sample indices.\n\n    Parameters\n    ----------\n    frames     : number or np.ndarray [shape=(n,)]\n        frame index or vector of frame indices\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    n_fft : None or int > 0 [scalar]\n        Optional: length of the FFT window.\n        If given, time conversion will include an offset of `n_fft / 2`\n        to counteract windowing effects when using a non-centered STFT.\n\n    Returns\n    -------\n    times : number or np.ndarray\n        time (in samples) of each given frame number:\n        `times[i] = frames[i] * hop_length`\n\n    See Also\n    --------\n    frames_to_time : convert frame indices to time values\n    samples_to_frames : convert sample indices to frame indices\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> tempo, beats = librosa.beat.beat_track(y, sr=sr)\n    >>> beat_samples = librosa.Func(beats)\n    \"\"\"\n\n    arg_3 = 0\n    if arg_2 is not None:\n        arg_3 = int(arg_2 // 2)\n\n    return (np.asanyarray(arg_0) * arg_1 + arg_3).astype(int)", "path": "librosa/core/time_frequency.py", "identifier": "frames_to_samples", "docstring": "Converts frame indices to audio sample indices.\n\n    Parameters\n    ----------\n    frames     : number or np.ndarray [shape=(n,)]\n        frame index or vector of frame indices\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    n_fft : None or int > 0 [scalar]\n        Optional: length of the FFT window.\n        If given, time conversion will include an offset of `n_fft / 2`\n        to counteract windowing effects when using a non-centered STFT.\n\n    Returns\n    -------\n    times : number or np.ndarray\n        time (in samples) of each given frame number:\n        `times[i] = frames[i] * hop_length`\n\n    See Also\n    --------\n    frames_to_time : convert frame indices to time values\n    samples_to_frames : convert sample indices to frame indices\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> tempo, beats = librosa.beat.beat_track(y, sr=sr)\n    >>> beat_samples = librosa.frames_to_samples(beats)", "docstring_tokens": ["Converts", "frame", "indices", "to", "audio", "sample", "indices", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 256739}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/apps.py#L41-L46", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Handle pre_migrate signal - disconnect User post_save handler.", "language": "python", "parameters": "(self, sender, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "from", "django", ".", "db", ".", "models", ".", "signals", "import", "post_save", "post_save", ".", "disconnect", "(", "arg_1", "=", "arg_0", ".", "auth_user_model", ",", "dispatch_uid", "=", "USER_POST_SAVE_DISPATCH_UID", ")"], "function": "def Func(arg_0, arg_1, **arg_2):  # pylint: disable=unused-argument\n        \"\"\"\n        Handle pre_migrate signal - disconnect User post_save handler.\n        \"\"\"\n        from django.db.models.signals import post_save\n        post_save.disconnect(arg_1=arg_0.auth_user_model, dispatch_uid=USER_POST_SAVE_DISPATCH_UID)", "path": "enterprise/apps.py", "identifier": "EnterpriseConfig._disconnect_user_post_save_for_migrations", "docstring": "Handle pre_migrate signal - disconnect User post_save handler.", "docstring_tokens": ["Handle", "pre_migrate", "signal", "-", "disconnect", "User", "post_save", "handler", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256740}
{"url": "https://github.com/nficano/python-lambda/blob/b0bd25404df70212d7fa057758760366406d64f2/aws_lambda/aws_lambda.py#L493-L585", "sha": "b0bd25404df70212d7fa057758760366406d64f2", "docstring_summary": "Register and upload a function to AWS Lambda.", "language": "python", "parameters": "(cfg, path_to_zip_file, use_s3=False, s3_file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "print", "(", "'Creating your new Lambda function'", ")", "arg_4", "=", "read", "(", "arg_1", ",", "binary_file", "=", "True", ")", "arg_5", "=", "arg_0", ".", "get", "(", "'profile'", ")", "arg_6", "=", "arg_0", ".", "get", "(", "'aws_access_key_id'", ")", "arg_7", "=", "arg_0", ".", "get", "(", "'aws_secret_access_key'", ")", "arg_8", "=", "get_account_id", "(", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_0", ".", "get", "(", "'region'", ",", ")", ",", ")", "arg_9", "=", "get_role_name", "(", "arg_0", ".", "get", "(", "'region'", ")", ",", "arg_8", ",", "arg_0", ".", "get", "(", "'role'", ",", "'lambda_basic_execution'", ")", ",", ")", "arg_10", "=", "get_client", "(", "'lambda'", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_0", ".", "get", "(", "'region'", ")", ",", ")", "arg_11", "=", "(", "os", ".", "environ", ".", "get", "(", "'S3_BUCKET_NAME'", ")", "or", "arg_0", ".", "get", "(", "'bucket_name'", ")", ")", "arg_12", "=", "(", "os", ".", "environ", ".", "get", "(", "'LAMBDA_FUNCTION_NAME'", ")", "or", "arg_0", ".", "get", "(", "'function_name'", ")", ")", "print", "(", "'Creating lambda function with name: {}'", ".", "format", "(", "arg_12", ")", ")", "if", "arg_2", ":", "arg_13", "=", "{", "'FunctionName'", ":", "arg_12", ",", "'Runtime'", ":", "arg_0", ".", "get", "(", "'runtime'", ",", "'python2.7'", ")", ",", "'Role'", ":", "arg_9", ",", "'Handler'", ":", "arg_0", ".", "get", "(", "'handler'", ")", ",", "'Code'", ":", "{", "'S3Bucket'", ":", "'{}'", ".", "format", "(", "arg_11", ")", ",", "'S3Key'", ":", "'{}'", ".", "format", "(", "arg_3", ")", ",", "}", ",", "'Description'", ":", "arg_0", ".", "get", "(", "'description'", ",", "''", ")", ",", "'Timeout'", ":", "arg_0", ".", "get", "(", "'timeout'", ",", "15", ")", ",", "'MemorySize'", ":", "arg_0", ".", "get", "(", "'memory_size'", ",", "512", ")", ",", "'VpcConfig'", ":", "{", "'SubnetIds'", ":", "arg_0", ".", "get", "(", "'subnet_ids'", ",", "[", "]", ")", ",", "'SecurityGroupIds'", ":", "arg_0", ".", "get", "(", "'security_group_ids'", ",", "[", "]", ")", ",", "}", ",", "'Publish'", ":", "True", ",", "}", "else", ":", "arg_13", "=", "{", "'FunctionName'", ":", "arg_12", ",", "'Runtime'", ":", "arg_0", ".", "get", "(", "'runtime'", ",", "'python2.7'", ")", ",", "'Role'", ":", "arg_9", ",", "'Handler'", ":", "arg_0", ".", "get", "(", "'handler'", ")", ",", "'Code'", ":", "{", "'ZipFile'", ":", "arg_4", "}", ",", "'Description'", ":", "arg_0", ".", "get", "(", "'description'", ",", "''", ")", ",", "'Timeout'", ":", "arg_0", ".", "get", "(", "'timeout'", ",", "15", ")", ",", "'MemorySize'", ":", "arg_0", ".", "get", "(", "'memory_size'", ",", "512", ")", ",", "'VpcConfig'", ":", "{", "'SubnetIds'", ":", "arg_0", ".", "get", "(", "'subnet_ids'", ",", "[", "]", ")", ",", "'SecurityGroupIds'", ":", "arg_0", ".", "get", "(", "'security_group_ids'", ",", "[", "]", ")", ",", "}", ",", "'Publish'", ":", "True", ",", "}", "if", "'tags'", "in", "arg_0", ":", "arg_13", ".", "update", "(", "Tags", "=", "{", "arg_14", ":", "str", "(", "arg_15", ")", "for", "arg_14", ",", "arg_15", "in", "arg_0", ".", "get", "(", "'tags'", ")", ".", "items", "(", ")", "}", ")", "if", "'environment_variables'", "in", "arg_0", ":", "arg_13", ".", "update", "(", "Environment", "=", "{", "'Variables'", ":", "{", "arg_14", ":", "get_environment_variable_value", "(", "arg_15", ")", "for", "arg_14", ",", "arg_15", "in", "arg_0", ".", "get", "(", "'environment_variables'", ")", ".", "items", "(", ")", "}", ",", "}", ",", ")", "arg_10", ".", "Func", "(", "**", "arg_13", ")", "arg_16", "=", "get_concurrency", "(", "arg_0", ")", "if", "arg_16", ">", "0", ":", "arg_10", ".", "put_function_concurrency", "(", "FunctionName", "=", "arg_12", ",", "ReservedConcurrentExecutions", "=", "arg_16", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=None):\n    \"\"\"Register and upload a function to AWS Lambda.\"\"\"\n\n    print('Creating your new Lambda function')\n    arg_4 = read(arg_1, binary_file=True)\n    arg_5 = arg_0.get('profile')\n    arg_6 = arg_0.get('aws_access_key_id')\n    arg_7 = arg_0.get('aws_secret_access_key')\n\n    arg_8 = get_account_id(\n        arg_5, arg_6, arg_7, arg_0.get(\n            'region',\n        ),\n    )\n    arg_9 = get_role_name(\n        arg_0.get('region'), arg_8,\n        arg_0.get('role', 'lambda_basic_execution'),\n    )\n\n    arg_10 = get_client(\n        'lambda', arg_5, arg_6, arg_7,\n        arg_0.get('region'),\n    )\n\n    # Do we prefer development variable over config?\n    arg_11 = (\n        os.environ.get('S3_BUCKET_NAME') or arg_0.get('bucket_name')\n    )\n    arg_12 = (\n        os.environ.get('LAMBDA_FUNCTION_NAME') or arg_0.get('function_name')\n    )\n    print('Creating lambda function with name: {}'.format(arg_12))\n\n    if arg_2:\n        arg_13 = {\n            'FunctionName': arg_12,\n            'Runtime': arg_0.get('runtime', 'python2.7'),\n            'Role': arg_9,\n            'Handler': arg_0.get('handler'),\n            'Code': {\n                'S3Bucket': '{}'.format(arg_11),\n                'S3Key': '{}'.format(arg_3),\n            },\n            'Description': arg_0.get('description', ''),\n            'Timeout': arg_0.get('timeout', 15),\n            'MemorySize': arg_0.get('memory_size', 512),\n            'VpcConfig': {\n                'SubnetIds': arg_0.get('subnet_ids', []),\n                'SecurityGroupIds': arg_0.get('security_group_ids', []),\n            },\n            'Publish': True,\n        }\n    else:\n        arg_13 = {\n            'FunctionName': arg_12,\n            'Runtime': arg_0.get('runtime', 'python2.7'),\n            'Role': arg_9,\n            'Handler': arg_0.get('handler'),\n            'Code': {'ZipFile': arg_4},\n            'Description': arg_0.get('description', ''),\n            'Timeout': arg_0.get('timeout', 15),\n            'MemorySize': arg_0.get('memory_size', 512),\n            'VpcConfig': {\n                'SubnetIds': arg_0.get('subnet_ids', []),\n                'SecurityGroupIds': arg_0.get('security_group_ids', []),\n            },\n            'Publish': True,\n        }\n\n    if 'tags' in arg_0:\n        arg_13.update(\n            Tags={\n                arg_14: str(arg_15)\n                for arg_14, arg_15 in arg_0.get('tags').items()\n            }\n        )\n\n    if 'environment_variables' in arg_0:\n        arg_13.update(\n            Environment={\n                'Variables': {\n                    arg_14: get_environment_variable_value(arg_15)\n                    for arg_14, arg_15\n                    in arg_0.get('environment_variables').items()\n                },\n            },\n        )\n\n    arg_10.Func(**arg_13)\n\n    arg_16 = get_concurrency(arg_0)\n    if arg_16 > 0:\n        arg_10.put_function_concurrency(FunctionName=arg_12, ReservedConcurrentExecutions=arg_16)", "path": "aws_lambda/aws_lambda.py", "identifier": "create_function", "docstring": "Register and upload a function to AWS Lambda.", "docstring_tokens": ["Register", "and", "upload", "a", "function", "to", "AWS", "Lambda", "."], "nwo": "nficano/python-lambda", "score": 0.7856642350024847, "idx": 256741}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/types.py#L49-L67", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Return file content if file, else, return value as-is", "language": "python", "parameters": "(self, value, param, ctx)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "str", ")", ":", "return", "arg_1", "if", "isinstance", "(", "arg_1", ",", "six", ".", "binary_type", ")", ":", "arg_1", "=", "arg_1", ".", "decode", "(", "'UTF-8'", ")", "if", "arg_1", ".", "startswith", "(", "'@'", ")", ":", "arg_4", "=", "os", ".", "path", ".", "expanduser", "(", "arg_1", "[", "1", ":", "]", ")", "arg_5", "=", "super", "(", "Variables", ",", "arg_0", ")", ".", "Func", "(", "arg_4", ",", "arg_2", ",", "arg_3", ")", "if", "hasattr", "(", "arg_5", ",", "'read'", ")", ":", "return", "arg_5", ".", "read", "(", ")", "return", "arg_5", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Return file content if file, else, return value as-is\n        \"\"\"\n        # Protect against corner cases of invalid inputs\n        if not isinstance(arg_1, str):\n            return arg_1\n        if isinstance(arg_1, six.binary_type):\n            arg_1 = arg_1.decode('UTF-8')\n        # Read from a file under these cases\n        if arg_1.startswith('@'):\n            arg_4 = os.path.expanduser(arg_1[1:])\n            arg_5 = super(Variables, arg_0).Func(arg_4, arg_2, arg_3)\n            if hasattr(arg_5, 'read'):\n                # Sometimes click.File may return a buffer and not a string\n                return arg_5.read()\n            return arg_5\n\n        # No file, use given string\n        return arg_1", "path": "tower_cli/cli/types.py", "identifier": "Variables.convert", "docstring": "Return file content if file, else, return value as-is", "docstring_tokens": ["Return", "file", "content", "if", "file", "else", "return", "value", "as", "-", "is"], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 256742}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/base.py#L137-L148", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns list of ancestor task specs based on inputs", "language": "python", "parameters": "(self)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "def", "recursive_find_Func", "(", "arg_2", ",", "arg_3", ")", ":", "for", "arg_4", "in", "arg_2", ".", "inputs", ":", "if", "arg_4", "not", "in", "arg_3", ":", "arg_3", ".", "append", "(", "arg_4", ")", "recursive_find_Func", "(", "arg_4", ",", "arg_3", ")", "recursive_find_Func", "(", "arg_0", ",", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns list of ancestor task specs based on inputs\"\"\"\n        arg_1 = []\n\n        def recursive_find_Func(arg_2, arg_3):\n            for arg_4 in arg_2.inputs:\n                if arg_4 not in arg_3:\n                    arg_3.append(arg_4)\n                    recursive_find_Func(arg_4, arg_3)\n        recursive_find_Func(arg_0, arg_1)\n\n        return arg_1", "path": "SpiffWorkflow/specs/base.py", "identifier": "TaskSpec.ancestors", "docstring": "Returns list of ancestor task specs based on inputs", "docstring_tokens": ["Returns", "list", "of", "ancestor", "task", "specs", "based", "on", "inputs"], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 256743}
{"url": "https://github.com/globality-corp/flake8-logging-format/blob/3c6ce53d0ff1ec369799cff0ed6d048343252e40/logging_format/visitor.py#L127-L142", "sha": "3c6ce53d0ff1ec369799cff0ed6d048343252e40", "docstring_summary": "Process dict arguments.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "should_check_whitelist", "(", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "keys", ":", "if", "arg_2", ".", "s", "in", "arg_0", ".", "whitelist", "or", "arg_2", ".", "s", ".", "startswith", "(", "\"debug_\"", ")", ":", "continue", "arg_0", ".", "violations", ".", "append", "(", "(", "arg_0", ".", "current_logging_call", ",", "WHITELIST_VIOLATION", ".", "format", "(", "arg_2", ".", "s", ")", ")", ")", "if", "arg_0", ".", "should_check_extra_exception", "(", "arg_1", ")", ":", "for", "arg_3", "in", "arg_1", ".", "values", ":", "arg_0", ".", "check_exception_arg", "(", "arg_3", ")", "super", "(", "LoggingVisitor", ",", "arg_0", ")", ".", "generic_visit", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Process dict arguments.\n\n        \"\"\"\n        if arg_0.should_check_whitelist(arg_1):\n            for arg_2 in arg_1.keys:\n                if arg_2.s in arg_0.whitelist or arg_2.s.startswith(\"debug_\"):\n                    continue\n                arg_0.violations.append((arg_0.current_logging_call, WHITELIST_VIOLATION.format(arg_2.s)))\n\n        if arg_0.should_check_extra_exception(arg_1):\n            for arg_3 in arg_1.values:\n                arg_0.check_exception_arg(arg_3)\n\n        super(LoggingVisitor, arg_0).generic_visit(arg_1)", "path": "logging_format/visitor.py", "identifier": "LoggingVisitor.visit_Dict", "docstring": "Process dict arguments.", "docstring_tokens": ["Process", "dict", "arguments", "."], "nwo": "globality-corp/flake8-logging-format", "score": 0.5445282565269285, "idx": 256744}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L62-L103", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Yield chunks generated from received data.", "language": "python", "parameters": "(self, new_data_bytes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_buf", "+=", "arg_1", "while", "True", ":", "arg_2", "=", "_best_effort_decode", "(", "arg_0", ".", "_buf", ")", "arg_3", "=", "arg_2", ".", "encode", "(", "'utf-16'", ")", "[", "2", ":", "]", "arg_4", "=", "LEN_REGEX", ".", "match", "(", "arg_2", ")", "if", "arg_4", "is", "None", ":", "break", "else", ":", "arg_5", "=", "arg_4", ".", "group", "(", "1", ")", "arg_6", "=", "int", "(", "arg_5", ")", "*", "2", "arg_7", "=", "len", "(", "(", "arg_5", "+", "'\\n'", ")", ".", "encode", "(", "'utf-16'", ")", "[", "2", ":", "]", ")", "if", "len", "(", "arg_3", ")", "-", "arg_7", "<", "arg_6", ":", "break", "arg_8", "=", "arg_3", "[", "arg_7", ":", "arg_7", "+", "arg_6", "]", "yield", "arg_8", ".", "decode", "(", "'utf-16'", ")", "arg_9", "=", "(", "len", "(", "(", "arg_5", "+", "'\\n'", ")", ".", "encode", "(", ")", ")", "+", "len", "(", "arg_8", ".", "decode", "(", "'utf-16'", ")", ".", "encode", "(", ")", ")", ")", "arg_0", ".", "_buf", "=", "arg_0", ".", "_buf", "[", "arg_9", ":", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Yield chunks generated from received data.\n\n        The buffer may not be decodable as UTF-8 if there's a split multi-byte\n        character at the end. To handle this, do a \"best effort\" decode of the\n        buffer to decode as much of it as possible.\n\n        The length is actually the length of the string as reported by\n        JavaScript. JavaScript's string length function returns the number of\n        code units in the string, represented in UTF-16. We can emulate this by\n        encoding everything in UTF-16 and multiplying the reported length by 2.\n\n        Note that when encoding a string in UTF-16, Python will prepend a\n        byte-order character, so we need to remove the first two bytes.\n        \"\"\"\n        arg_0._buf += arg_1\n\n        while True:\n\n            arg_2 = _best_effort_decode(arg_0._buf)\n            arg_3 = arg_2.encode('utf-16')[2:]\n\n            arg_4 = LEN_REGEX.match(arg_2)\n            if arg_4 is None:\n                break\n            else:\n                arg_5 = arg_4.group(1)\n                # Both lengths are in number of bytes in UTF-16 encoding.\n                # The length of the submission:\n                arg_6 = int(arg_5) * 2\n                # The length of the submission length and newline:\n                arg_7 = len((arg_5 + '\\n').encode('utf-16')[2:])\n                if len(arg_3) - arg_7 < arg_6:\n                    break\n\n                arg_8 = arg_3[arg_7:arg_7 + arg_6]\n                yield arg_8.decode('utf-16')\n                # Drop the length and the submission itself from the beginning\n                # of the buffer.\n                arg_9 = (len((arg_5 + '\\n').encode()) +\n                               len(arg_8.decode('utf-16').encode()))\n                arg_0._buf = arg_0._buf[arg_9:]", "path": "hangups/channel.py", "identifier": "ChunkParser.get_chunks", "docstring": "Yield chunks generated from received data.\n\n        The buffer may not be decodable as UTF-8 if there's a split multi-byte\n        character at the end. To handle this, do a \"best effort\" decode of the\n        buffer to decode as much of it as possible.\n\n        The length is actually the length of the string as reported by\n        JavaScript. JavaScript's string length function returns the number of\n        code units in the string, represented in UTF-16. We can emulate this by\n        encoding everything in UTF-16 and multiplying the reported length by 2.\n\n        Note that when encoding a string in UTF-16, Python will prepend a\n        byte-order character, so we need to remove the first two bytes.", "docstring_tokens": ["Yield", "chunks", "generated", "from", "received", "data", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 256745}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L96-L102", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Load all plugins from dgit extension", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "pkg_resources", ".", "iter_entry_points", "(", "'dgit.plugins'", ")", ":", "arg_2", "=", "arg_1", ".", "load", "(", ")", "arg_2", ".", "setup", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Load all plugins from dgit extension\n        \"\"\"\n        for arg_1 in pkg_resources.iter_entry_points('dgit.plugins'):\n            arg_2 = arg_1.load()\n            arg_2.setup(arg_0)", "path": "dgitcore/plugins/common.py", "identifier": "PluginManager.discover_all_plugins", "docstring": "Load all plugins from dgit extension", "docstring_tokens": ["Load", "all", "plugins", "from", "dgit", "extension"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 256746}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/resource.py#L126-L155", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Create a gui2py control based on the python resource", "language": "python", "parameters": "(res, parent=None)", "return_statement": "return com", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "dict", "(", "arg_0", ".", "items", "(", ")", ")", "arg_3", "=", "arg_2", ".", "pop", "(", "'type'", ")", "if", "'components'", "in", "arg_0", ":", "arg_4", "=", "arg_2", ".", "pop", "(", "'components'", ")", "elif", "arg_3", "==", "'Menu'", "and", "'items'", "in", "arg_0", ":", "arg_4", "=", "arg_2", ".", "pop", "(", "'items'", ")", "else", ":", "arg_4", "=", "[", "]", "from", "gui", "import", "registry", "if", "arg_3", "in", "registry", ".", "CONTROLS", ":", "arg_5", "=", "registry", ".", "CONTROLS", "[", "arg_3", "]", "elif", "arg_3", "in", "registry", ".", "MENU", ":", "arg_5", "=", "registry", ".", "MENU", "[", "arg_3", "]", "elif", "arg_3", "in", "registry", ".", "MISC", ":", "arg_5", "=", "registry", ".", "MISC", "[", "arg_3", "]", "else", ":", "raise", "RuntimeError", "(", "\"%s not in registry\"", "%", "arg_3", ")", "arg_6", "=", "arg_5", "(", "arg_1", "=", "arg_1", ",", "**", "arg_2", ")", "for", "arg_7", "in", "arg_4", ":", "Func", "(", "arg_7", ",", "arg_1", "=", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None):\n    \"Create a gui2py control based on the python resource\"\n    # control specs (parameters)\n    arg_2 = dict(arg_0.items())\n    arg_3 = arg_2.pop('type')\n    if 'components' in arg_0:\n        arg_4 = arg_2.pop('components')\n    elif arg_3 == 'Menu' and 'items' in arg_0:\n        arg_4 = arg_2.pop('items')\n    else:\n        arg_4 = []\n\n    from gui import registry\n\n    if arg_3 in registry.CONTROLS:\n        arg_5 = registry.CONTROLS[arg_3]\n    elif arg_3 in registry.MENU:\n        arg_5 = registry.MENU[arg_3]\n    elif arg_3 in registry.MISC:\n        arg_5 = registry.MISC[arg_3]\n    else:\n        raise RuntimeError(\"%s not in registry\" % arg_3)\n        \n    # Instantiate the GUI object\n    arg_6 = arg_5(arg_1=arg_1, **arg_2)\n    \n    for arg_7 in arg_4:\n        Func(arg_7, arg_1=arg_6)\n\n    return arg_6", "path": "gui/resource.py", "identifier": "build_component", "docstring": "Create a gui2py control based on the python resource", "docstring_tokens": ["Create", "a", "gui2py", "control", "based", "on", "the", "python", "resource"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 256747}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/memory_model.py#L428-L463", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Returns the optimizer arguments including the time, the list of variables to optimize,\n        and various functions which the optimizer might require to perform an update step.", "language": "python", "parameters": "(self, states, internals, actions, terminal, reward, next_states, next_internals)", "return_statement": "return arguments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_8", "=", "dict", "(", "time", "=", "arg_0", ".", "global_timestep", ",", "variables", "=", "arg_0", ".", "get_variables", "(", ")", ",", "arg_8", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "update", "=", "tf", ".", "constant", "(", "value", "=", "True", ")", ")", ",", "fn_reference", "=", "arg_0", ".", "fn_reference", ",", "fn_loss", "=", "arg_0", ".", "fn_loss", ")", "if", "arg_0", ".", "global_model", "is", "not", "None", ":", "arg_8", "[", "'global_variables'", "]", "=", "arg_0", ".", "global_model", ".", "get_variables", "(", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7):\n        \"\"\"\n        Returns the optimizer arguments including the time, the list of variables to optimize,\n        and various functions which the optimizer might require to perform an update step.\n\n        Args:\n            states (dict): Dict of state tensors.\n            internals (dict): Dict of prior internal state tensors.\n            actions (dict): Dict of action tensors.\n            terminal: 1D boolean is-terminal tensor.\n            reward: 1D (float) rewards tensor.\n            next_states (dict): Dict of successor state tensors.\n            next_internals (dict): Dict of posterior internal state tensors.\n\n        Returns:\n            Optimizer arguments as dict to be used as **kwargs to the optimizer.\n        \"\"\"\n        arg_8 = dict(\n            time=arg_0.global_timestep,\n            variables=arg_0.get_variables(),\n            arg_8=dict(\n                arg_1=arg_1,\n                arg_2=arg_2,\n                arg_3=arg_3,\n                arg_4=arg_4,\n                arg_5=arg_5,\n                arg_6=arg_6,\n                arg_7=arg_7,\n                update=tf.constant(value=True)\n            ),\n            fn_reference=arg_0.fn_reference,\n            fn_loss=arg_0.fn_loss\n        )\n        if arg_0.global_model is not None:\n            arg_8['global_variables'] = arg_0.global_model.get_variables()\n        return arg_8", "path": "tensorforce/models/memory_model.py", "identifier": "MemoryModel.optimizer_arguments", "docstring": "Returns the optimizer arguments including the time, the list of variables to optimize,\n        and various functions which the optimizer might require to perform an update step.\n\n        Args:\n            states (dict): Dict of state tensors.\n            internals (dict): Dict of prior internal state tensors.\n            actions (dict): Dict of action tensors.\n            terminal: 1D boolean is-terminal tensor.\n            reward: 1D (float) rewards tensor.\n            next_states (dict): Dict of successor state tensors.\n            next_internals (dict): Dict of posterior internal state tensors.\n\n        Returns:\n            Optimizer arguments as dict to be used as **kwargs to the optimizer.", "docstring_tokens": ["Returns", "the", "optimizer", "arguments", "including", "the", "time", "the", "list", "of", "variables", "to", "optimize", "and", "various", "functions", "which", "the", "optimizer", "might", "require", "to", "perform", "an", "update", "step", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 256748}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/namespace_manager.py#L296-L304", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Add this manager's namespace to the graph.", "language": "python", "parameters": "(self, graph: BELGraph)", "return_statement": "return namespace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Namespace", ":", "arg_3", "=", "arg_0", ".", "upload_bel_namespace", "(", ")", "arg_1", ".", "namespace_url", "[", "arg_3", ".", "keyword", "]", "=", "arg_3", ".", "url", "arg_0", ".", "_add_annotation_to_graph", "(", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2) -> Namespace:\n        \"\"\"Add this manager's namespace to the graph.\"\"\"\n        arg_3 = arg_0.upload_bel_namespace()\n        arg_1.namespace_url[arg_3.keyword] = arg_3.url\n\n        # Add this manager as an annotation, too\n        arg_0._add_annotation_to_graph(arg_1)\n\n        return arg_3", "path": "src/bio2bel/manager/namespace_manager.py", "identifier": "BELNamespaceManagerMixin.add_namespace_to_graph", "docstring": "Add this manager's namespace to the graph.", "docstring_tokens": ["Add", "this", "manager", "s", "namespace", "to", "the", "graph", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 256749}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L1062-L1201", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augmenter that sets rectangular areas within images to zero.", "language": "python", "parameters": "(p=0, size_px=None, size_percent=None, per_channel=False, min_size=4, name=None, deterministic=False,\n                  random_state=None)", "return_statement": "return MultiplyElementwise(p3, per_channel=per_channel, name=name, deterministic=deterministic,\n                               random_state=random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ")", ":", "if", "ia", ".", "is_single_number", "(", "arg_0", ")", ":", "arg_8", "=", "iap", ".", "Binomial", "(", "1", "-", "arg_0", ")", "elif", "ia", ".", "is_iterable", "(", "arg_0", ")", ":", "ia", ".", "do_assert", "(", "len", "(", "arg_0", ")", "==", "2", ")", "ia", ".", "do_assert", "(", "arg_0", "[", "0", "]", "<", "arg_0", "[", "1", "]", ")", "ia", ".", "do_assert", "(", "0", "<=", "arg_0", "[", "0", "]", "<=", "1.0", ")", "ia", ".", "do_assert", "(", "0", "<=", "arg_0", "[", "1", "]", "<=", "1.0", ")", "arg_8", "=", "iap", ".", "Binomial", "(", "iap", ".", "Uniform", "(", "1", "-", "arg_0", "[", "1", "]", ",", "1", "-", "arg_0", "[", "0", "]", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "iap", ".", "StochasticParameter", ")", ":", "arg_8", "=", "arg_0", "else", ":", "raise", "Exception", "(", "\"Expected p to be float or int or StochasticParameter, got %s.\"", "%", "(", "type", "(", "arg_0", ")", ",", ")", ")", "if", "arg_1", "is", "not", "None", ":", "arg_9", "=", "iap", ".", "FromLowerResolution", "(", "other_param", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ")", "elif", "arg_2", "is", "not", "None", ":", "arg_9", "=", "iap", ".", "FromLowerResolution", "(", "other_param", "=", "arg_8", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ")", "else", ":", "raise", "Exception", "(", "\"Either size_px or size_percent must be set.\"", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "\"Unnamed%s\"", "%", "(", "ia", ".", "caller_name", "(", ")", ",", ")", "return", "MultiplyElementwise", "(", "arg_9", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0=0, arg_1=None, arg_2=None, arg_3=False, arg_4=4, arg_5=None, arg_6=False,\n                  arg_7=None):\n    \"\"\"\n    Augmenter that sets rectangular areas within images to zero.\n\n    In contrast to Dropout, these areas can have larger sizes.\n    (E.g. you might end up with three large black rectangles in an image.)\n    Note that the current implementation leads to correlated sizes,\n    so when there is one large area that is dropped, there is a high likelihood\n    that all other dropped areas are also large.\n\n    This method is implemented by generating the dropout mask at a\n    lower resolution (than the image has) and then upsampling the mask\n    before dropping the pixels.\n\n    dtype support::\n\n        See ``imgaug.augmenters.arithmetic.MultiplyElementwise``.\n\n    Parameters\n    ----------\n    p : float or tuple of float or imgaug.parameters.StochasticParameter, optional\n        The probability of any pixel being dropped (i.e. set to zero).\n\n            * If a float, then that value will be used for all pixels. A value\n              of 1.0 would mean, that all pixels will be dropped. A value of\n              0.0 would lead to no pixels being dropped.\n            * If a tuple ``(a, b)``, then a value p will be sampled from the\n              range ``a <= p <= b`` per image and be used as the pixel's dropout\n              probability.\n            * If a StochasticParameter, then this parameter will be used to\n              determine per pixel whether it should be dropped (sampled value\n              of 0) or shouldn't (sampled value of 1).\n\n    size_px : int or tuple of int or imgaug.parameters.StochasticParameter, optional\n        The size of the lower resolution image from which to sample the dropout\n        mask in absolute pixel dimensions.\n\n            * If an integer, then that size will be used for both height and\n              width. E.g. a value of 3 would lead to a ``3x3`` mask, which is then\n              upsampled to ``HxW``, where ``H`` is the image size and W the image width.\n            * If a tuple ``(a, b)``, then two values ``M``, ``N`` will be sampled from the\n              range ``[a..b]`` and the mask will be generated at size ``MxN``, then\n              upsampled to ``HxW``.\n            * If a StochasticParameter, then this parameter will be used to\n              determine the sizes. It is expected to be discrete.\n\n    size_percent : float or tuple of float or imgaug.parameters.StochasticParameter, optional\n        The size of the lower resolution image from which to sample the dropout\n        mask *in percent* of the input image.\n\n            * If a float, then that value will be used as the percentage of the\n              height and width (relative to the original size). E.g. for value\n              p, the mask will be sampled from ``(p*H)x(p*W)`` and later upsampled\n              to ``HxW``.\n            * If a tuple ``(a, b)``, then two values ``m``, ``n`` will be sampled from the\n              interval ``(a, b)`` and used as the percentages, i.e the mask size\n              will be ``(m*H)x(n*W)``.\n            * If a StochasticParameter, then this parameter will be used to\n              sample the percentage values. It is expected to be continuous.\n\n    per_channel : bool or float, optional\n        Whether to use the same value (is dropped / is not dropped)\n        for all channels of a pixel (False) or to sample a new value for each\n        channel (True).\n        If this value is a float ``p``, then for ``p`` percent of all images\n        `per_channel` will be treated as True, otherwise as False.\n\n    min_size : int, optional\n        Minimum size of the low resolution mask, both width and height. If\n        `size_percent` or `size_px` leads to a lower value than this, `min_size`\n        will be used instead. This should never have a value of less than 2,\n        otherwise one may end up with a ``1x1`` low resolution mask, leading easily\n        to the whole image being dropped.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = iaa.Func(0.02, size_percent=0.5)\n\n    drops 2 percent of all pixels on an lower-resolution image that has\n    50 percent of the original image's size, leading to dropped areas that\n    have roughly 2x2 pixels size.\n\n\n    >>> aug = iaa.Func((0.0, 0.05), size_percent=(0.05, 0.5))\n\n    generates a dropout mask at 5 to 50 percent of image's size. In that mask,\n    0 to 5 percent of all pixels are dropped (random per image).\n\n    >>> aug = iaa.Func((0.0, 0.05), size_px=(2, 16))\n\n    same as previous example, but the lower resolution image has 2 to 16 pixels\n    size.\n\n    >>> aug = iaa.Func(0.02, size_percent=0.5, per_channel=True)\n\n    drops 2 percent of all pixels at 50 percent resolution (2x2 sizes)\n    in a channel-wise fashion, i.e. it is unlikely\n    for any pixel to have all channels set to zero (black pixels).\n\n    >>> aug = iaa.Func(0.02, size_percent=0.5, per_channel=0.5)\n\n    same as previous example, but the `per_channel` feature is only active\n    for 50 percent of all images.\n\n    \"\"\"\n    if ia.is_single_number(arg_0):\n        arg_8 = iap.Binomial(1 - arg_0)\n    elif ia.is_iterable(arg_0):\n        ia.do_assert(len(arg_0) == 2)\n        ia.do_assert(arg_0[0] < arg_0[1])\n        ia.do_assert(0 <= arg_0[0] <= 1.0)\n        ia.do_assert(0 <= arg_0[1] <= 1.0)\n        arg_8 = iap.Binomial(iap.Uniform(1 - arg_0[1], 1 - arg_0[0]))\n    elif isinstance(arg_0, iap.StochasticParameter):\n        arg_8 = arg_0\n    else:\n        raise Exception(\"Expected p to be float or int or StochasticParameter, got %s.\" % (type(arg_0),))\n\n    if arg_1 is not None:\n        arg_9 = iap.FromLowerResolution(other_param=arg_8, arg_1=arg_1, arg_4=arg_4)\n    elif arg_2 is not None:\n        arg_9 = iap.FromLowerResolution(other_param=arg_8, arg_2=arg_2, arg_4=arg_4)\n    else:\n        raise Exception(\"Either size_px or size_percent must be set.\")\n\n    if arg_5 is None:\n        arg_5 = \"Unnamed%s\" % (ia.caller_name(),)\n\n    return MultiplyElementwise(arg_9, arg_3=arg_3, arg_5=arg_5, arg_6=arg_6,\n                               arg_7=arg_7)", "path": "imgaug/augmenters/arithmetic.py", "identifier": "CoarseDropout", "docstring": "Augmenter that sets rectangular areas within images to zero.\n\n    In contrast to Dropout, these areas can have larger sizes.\n    (E.g. you might end up with three large black rectangles in an image.)\n    Note that the current implementation leads to correlated sizes,\n    so when there is one large area that is dropped, there is a high likelihood\n    that all other dropped areas are also large.\n\n    This method is implemented by generating the dropout mask at a\n    lower resolution (than the image has) and then upsampling the mask\n    before dropping the pixels.\n\n    dtype support::\n\n        See ``imgaug.augmenters.arithmetic.MultiplyElementwise``.\n\n    Parameters\n    ----------\n    p : float or tuple of float or imgaug.parameters.StochasticParameter, optional\n        The probability of any pixel being dropped (i.e. set to zero).\n\n            * If a float, then that value will be used for all pixels. A value\n              of 1.0 would mean, that all pixels will be dropped. A value of\n              0.0 would lead to no pixels being dropped.\n            * If a tuple ``(a, b)``, then a value p will be sampled from the\n              range ``a <= p <= b`` per image and be used as the pixel's dropout\n              probability.\n            * If a StochasticParameter, then this parameter will be used to\n              determine per pixel whether it should be dropped (sampled value\n              of 0) or shouldn't (sampled value of 1).\n\n    size_px : int or tuple of int or imgaug.parameters.StochasticParameter, optional\n        The size of the lower resolution image from which to sample the dropout\n        mask in absolute pixel dimensions.\n\n            * If an integer, then that size will be used for both height and\n              width. E.g. a value of 3 would lead to a ``3x3`` mask, which is then\n              upsampled to ``HxW``, where ``H`` is the image size and W the image width.\n            * If a tuple ``(a, b)``, then two values ``M``, ``N`` will be sampled from the\n              range ``[a..b]`` and the mask will be generated at size ``MxN``, then\n              upsampled to ``HxW``.\n            * If a StochasticParameter, then this parameter will be used to\n              determine the sizes. It is expected to be discrete.\n\n    size_percent : float or tuple of float or imgaug.parameters.StochasticParameter, optional\n        The size of the lower resolution image from which to sample the dropout\n        mask *in percent* of the input image.\n\n            * If a float, then that value will be used as the percentage of the\n              height and width (relative to the original size). E.g. for value\n              p, the mask will be sampled from ``(p*H)x(p*W)`` and later upsampled\n              to ``HxW``.\n            * If a tuple ``(a, b)``, then two values ``m``, ``n`` will be sampled from the\n              interval ``(a, b)`` and used as the percentages, i.e the mask size\n              will be ``(m*H)x(n*W)``.\n            * If a StochasticParameter, then this parameter will be used to\n              sample the percentage values. It is expected to be continuous.\n\n    per_channel : bool or float, optional\n        Whether to use the same value (is dropped / is not dropped)\n        for all channels of a pixel (False) or to sample a new value for each\n        channel (True).\n        If this value is a float ``p``, then for ``p`` percent of all images\n        `per_channel` will be treated as True, otherwise as False.\n\n    min_size : int, optional\n        Minimum size of the low resolution mask, both width and height. If\n        `size_percent` or `size_px` leads to a lower value than this, `min_size`\n        will be used instead. This should never have a value of less than 2,\n        otherwise one may end up with a ``1x1`` low resolution mask, leading easily\n        to the whole image being dropped.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = iaa.CoarseDropout(0.02, size_percent=0.5)\n\n    drops 2 percent of all pixels on an lower-resolution image that has\n    50 percent of the original image's size, leading to dropped areas that\n    have roughly 2x2 pixels size.\n\n\n    >>> aug = iaa.CoarseDropout((0.0, 0.05), size_percent=(0.05, 0.5))\n\n    generates a dropout mask at 5 to 50 percent of image's size. In that mask,\n    0 to 5 percent of all pixels are dropped (random per image).\n\n    >>> aug = iaa.CoarseDropout((0.0, 0.05), size_px=(2, 16))\n\n    same as previous example, but the lower resolution image has 2 to 16 pixels\n    size.\n\n    >>> aug = iaa.CoarseDropout(0.02, size_percent=0.5, per_channel=True)\n\n    drops 2 percent of all pixels at 50 percent resolution (2x2 sizes)\n    in a channel-wise fashion, i.e. it is unlikely\n    for any pixel to have all channels set to zero (black pixels).\n\n    >>> aug = iaa.CoarseDropout(0.02, size_percent=0.5, per_channel=0.5)\n\n    same as previous example, but the `per_channel` feature is only active\n    for 50 percent of all images.", "docstring_tokens": ["Augmenter", "that", "sets", "rectangular", "areas", "within", "images", "to", "zero", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 256750}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L192-L218", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Label new data with cluster identities.", "language": "python", "parameters": "(self, data)", "return_statement": "return clusters", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "arg_0", ".", "analytes", "[", "0", "]", "]", ".", "size", "arg_3", ",", "arg_4", "=", "arg_0", ".", "format_data", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "classifier", ".", "Func", "(", "arg_3", ")", "arg_6", "=", "arg_0", ".", "map_clusters", "(", "arg_2", ",", "arg_4", ",", "arg_5", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Label new data with cluster identities.\n\n        Parameters\n        ----------\n        data : dict\n            A data dict containing the same analytes used to\n            fit the classifier.\n        sort_by : str\n            The name of an analyte used to sort the resulting\n            clusters. If None, defaults to the first analyte\n            used in fitting.\n\n        Returns\n        -------\n        array of clusters the same length as the data.\n        \"\"\"\n        arg_2 = arg_1[arg_0.analytes[0]].size\n        arg_3, arg_4 = arg_0.format_data(arg_1)\n\n        # Func clusters\n        arg_5 = arg_0.classifier.Func(arg_3)\n        # map clusters to original index\n        arg_6 = arg_0.map_clusters(arg_2, arg_4, arg_5)\n\n        return arg_6", "path": "latools/filtering/classifier_obj.py", "identifier": "classifier.predict", "docstring": "Label new data with cluster identities.\n\n        Parameters\n        ----------\n        data : dict\n            A data dict containing the same analytes used to\n            fit the classifier.\n        sort_by : str\n            The name of an analyte used to sort the resulting\n            clusters. If None, defaults to the first analyte\n            used in fitting.\n\n        Returns\n        -------\n        array of clusters the same length as the data.", "docstring_tokens": ["Label", "new", "data", "with", "cluster", "identities", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 256751}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/tokens.py#L564-L589", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Raise an ApiUsageError if the given object is not a token that is currently \n    participating in the game.  To be participating in the game, the given \n    token must have an id number and be associated with the world.", "language": "python", "parameters": "(object)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "require_token", "(", "arg_0", ")", "arg_1", "=", "arg_0", "if", "not", "arg_1", ".", "has_id", ":", "raise", "ApiUsageError", "(", "\"\"\"\\                token {token} should have an id, but doesn't.                This error usually means that a token was added to the world                 without being assigned an id number.  To correct this, make                 sure that you're using a message (i.e. CreateToken) to create                 all of your tokens.\"\"\"", ")", "if", "not", "arg_1", ".", "has_world", ":", "raise", "ApiUsageError", "(", "\"\"\"\\                token {token} (id={token.id}) not in world.                You can get this error if you try to remove the same token from                 the world twice.  This might happen is you don't get rid of                 every reference to a token after it's removed the first time,                 then later on you try to remove the stale reference.\"\"\"", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Raise an ApiUsageError if the given object is not a token that is currently \n    participating in the game.  To be participating in the game, the given \n    token must have an id number and be associated with the world.\n    \"\"\"\n    require_token(arg_0)\n    arg_1 = arg_0\n\n    if not arg_1.has_id:\n        raise ApiUsageError(\"\"\"\\\n                token {token} should have an id, but doesn't.\n\n                This error usually means that a token was added to the world \n                without being assigned an id number.  To correct this, make \n                sure that you're using a message (i.e. CreateToken) to create \n                all of your tokens.\"\"\")\n\n    if not arg_1.has_world:\n        raise ApiUsageError(\"\"\"\\\n                token {token} (id={token.id}) not in world.\n\n                You can get this error if you try to remove the same token from \n                the world twice.  This might happen is you don't get rid of \n                every reference to a token after it's removed the first time, \n                then later on you try to remove the stale reference.\"\"\")", "path": "kxg/tokens.py", "identifier": "require_active_token", "docstring": "Raise an ApiUsageError if the given object is not a token that is currently \n    participating in the game.  To be participating in the game, the given \n    token must have an id number and be associated with the world.", "docstring_tokens": ["Raise", "an", "ApiUsageError", "if", "the", "given", "object", "is", "not", "a", "token", "that", "is", "currently", "participating", "in", "the", "game", ".", "To", "be", "participating", "in", "the", "game", "the", "given", "token", "must", "have", "an", "id", "number", "and", "be", "associated", "with", "the", "world", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 256752}
{"url": "https://github.com/ardexa/ardexaplugin/blob/5068532f601ae3042bd87af1063057e8f274f670/ardexaplugin.py#L179-L253", "sha": "5068532f601ae3042bd87af1063057e8f274f670", "docstring_summary": "This function will disown, so the Ardexa service can be restarted", "language": "python", "parameters": "(debug)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "getpid", "(", ")", "arg_2", "=", "\"/proc/\"", "+", "str", "(", "arg_1", ")", "+", "\"/cgroup\"", "try", ":", "arg_3", "=", "open", "(", "arg_2", ",", "\"r\"", ")", "except", "IOError", ":", "print", "(", "\"Could not open cgroup file: \"", ",", "arg_2", ")", "return", "False", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "find", "(", "\"ardexa.service\"", ")", "==", "-", "1", ":", "continue", "arg_4", "=", "arg_4", ".", "replace", "(", "\"name=\"", ",", "\"\"", ")", "arg_5", "=", "arg_4", ".", "split", "(", "':'", ")", "arg_6", "=", "arg_5", "[", "1", "]", "arg_7", "=", "arg_6", "+", "\"/ardexa.Func\"", "if", "not", "arg_6", ":", "continue", "arg_8", "=", "\"/sys/fs/cgroup/\"", "+", "arg_7", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_8", ")", ":", "os", ".", "makedirs", "(", "arg_8", ")", "if", "arg_0", ">=", "1", ":", "print", "(", "\"Making directory: \"", ",", "arg_8", ")", "else", ":", "if", "arg_0", ">=", "1", ":", "print", "(", "\"Directory already exists: \"", ",", "arg_8", ")", "arg_9", "=", "arg_8", "+", "\"/cgroup.procs\"", "arg_10", "=", "[", "\"echo\"", ",", "str", "(", "arg_1", ")", ",", "\">\"", ",", "arg_9", "]", "run_program", "(", "arg_10", ",", "arg_0", ",", "True", ")", "if", "arg_6", ".", "find", "(", "\",\"", ")", "!=", "-", "1", ":", "arg_11", "=", "arg_6", ".", "split", "(", "','", ")", "arg_6", "=", "arg_11", "[", "1", "]", "+", "\",\"", "+", "arg_11", "[", "0", "]", "arg_7", "=", "arg_6", "+", "\"/ardexa.Func\"", "arg_8", "=", "\"/sys/fs/cgroup/\"", "+", "arg_7", "try", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_8", ")", ":", "os", ".", "makedirs", "(", "arg_8", ")", "except", ":", "continue", "arg_9", "=", "arg_8", "+", "\"/cgroup.procs\"", "arg_10", "=", "[", "\"echo\"", ",", "str", "(", "arg_1", ")", ",", "\">\"", ",", "arg_9", "]", "run_program", "(", "arg_10", ",", "arg_0", ",", "True", ")", "arg_3", ".", "close", "(", ")", "if", "arg_0", ">=", "1", ":", "arg_10", "=", "[", "\"cat\"", ",", "arg_2", "]", "run_program", "(", "arg_10", ",", "arg_0", ",", "False", ")", "arg_10", "=", "[", "\"grep\"", ",", "\"-q\"", ",", "\"ardexa.service\"", ",", "arg_2", "]", "if", "run_program", "(", "arg_10", ",", "arg_0", ",", "False", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"This function will Func, so the Ardexa service can be restarted\"\"\"\n    # Get the current PID\n    arg_1 = os.getpid()\n    arg_2 = \"/proc/\" + str(arg_1) + \"/cgroup\"\n    try:\n        arg_3 = open(arg_2, \"r\")\n    except IOError:\n        print(\"Could not open cgroup file: \", arg_2)\n        return False\n\n    # Read each line\n    for arg_4 in arg_3:\n        # Check if the line contains \"ardexa.service\"\n        if arg_4.find(\"ardexa.service\") == -1:\n            continue\n\n        # if the lines contains \"name=\", replace it with nothing\n        arg_4 = arg_4.replace(\"name=\", \"\")\n        # Split  the line by commas\n        arg_5 = arg_4.split(':')\n        arg_6 = arg_5[1]\n        arg_7 = arg_6 + \"/ardexa.Func\"\n        # If accounts is empty, continue\n        if not arg_6:\n            continue\n\n        # Create the dir and all subdirs\n        arg_8 = \"/sys/fs/cgroup/\" + arg_7\n        if not os.path.exists(arg_8):\n            os.makedirs(arg_8)\n            if arg_0 >= 1:\n                print(\"Making directory: \", arg_8)\n        else:\n            if arg_0 >= 1:\n                print(\"Directory already exists: \", arg_8)\n\n        # Add the PID to the file\n        arg_9 = arg_8 + \"/cgroup.procs\"\n        arg_10 = [\"echo\", str(arg_1), \">\", arg_9]\n        run_program(arg_10, arg_0, True)\n\n        # If this item contains a comma, then separate it, and reverse\n        # some OSes will need cpuacct,cpu reversed to actually work\n        if arg_6.find(\",\") != -1:\n            arg_11 = arg_6.split(',')\n            arg_6 = arg_11[1] + \",\" + arg_11[0]\n            arg_7 = arg_6 + \"/ardexa.Func\"\n            # Create the dir and all subdirs. But it may not work. So use a TRY\n            arg_8 = \"/sys/fs/cgroup/\" + arg_7\n            try:\n                if not os.path.exists(arg_8):\n                    os.makedirs(arg_8)\n            except:\n                continue\n\n            # Add the PID to the file\n            arg_9 = arg_8 + \"/cgroup.procs\"\n            arg_10 = [\"echo\", str(arg_1), \">\", arg_9]\n            run_program(arg_10, arg_0, True)\n\n    arg_3.close()\n\n    # For debug purposes only\n    if arg_0 >= 1:\n        arg_10 = [\"cat\", arg_2]\n        run_program(arg_10, arg_0, False)\n\n    # If there are any \"ardexa.service\" in the proc file. If so, exit with error\n    arg_10 = [\"grep\", \"-q\", \"ardexa.service\", arg_2]\n    if run_program(arg_10, arg_0, False):\n        # There are entries still left in the file\n        return False\n\n    return True", "path": "ardexaplugin.py", "identifier": "disown", "docstring": "This function will disown, so the Ardexa service can be restarted", "docstring_tokens": ["This", "function", "will", "disown", "so", "the", "Ardexa", "service", "can", "be", "restarted"], "nwo": "ardexa/ardexaplugin", "score": 0.2424429654267875, "idx": 256753}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L2466-L2502", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to set the pressure-dependent property methods desired for\n        consideration by the user. Can be used to exclude certain methods which\n        might have unacceptable accuracy.", "language": "python", "parameters": "(self, user_methods_P, forced_P=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_0", ".", "user_methods_P", "=", "arg_1", "arg_0", ".", "forced_P", "=", "arg_2", "if", "set", "(", "arg_0", ".", "user_methods_P", ")", ".", "difference", "(", "arg_0", ".", "all_methods_P", ")", ":", "raise", "Exception", "(", "\"One of the given methods is not available for this chemical\"", ")", "if", "not", "arg_0", ".", "user_methods_P", "and", "arg_0", ".", "forced", ":", "raise", "Exception", "(", "'Only user specified methods are considered when forced is True, but no methods were provided'", ")", "arg_0", ".", "method_P", "=", "None", "arg_0", ".", "sorted_valid_methods_P", "=", "[", "]", "arg_0", ".", "TP_cached", "=", "None"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        r'''Method to set the pressure-dependent property methods desired for\n        consideration by the user. Can be used to exclude certain methods which\n        might have unacceptable accuracy.\n\n        As a side effect, the previously selected method is removed when\n        this method is called to ensure user methods are tried in the desired\n        order.\n\n        Parameters\n        ----------\n        user_methods_P : str or list\n            Methods by name to be considered or preferred for pressure effect.\n        forced : bool, optional\n            If True, only the user specified methods will ever be considered;\n            if False other methods will be considered if no user methods\n            suceed.\n        '''\n        # Accept either a string or a list of methods, and whether\n        # or not to only consider the false methods\n        if isinstance(arg_1, str):\n            arg_1 = [arg_1]\n\n        # The user's order matters and is retained for use by select_valid_methods\n        arg_0.user_methods_P = arg_1\n        arg_0.forced_P = arg_2\n\n        # Validate that the user's specified methods are actual methods\n        if set(arg_0.user_methods_P).difference(arg_0.all_methods_P):\n            raise Exception(\"One of the given methods is not available for this chemical\")\n        if not arg_0.user_methods_P and arg_0.forced:\n            raise Exception('Only user specified methods are considered when forced is True, but no methods were provided')\n\n        # Remove previously selected methods\n        arg_0.method_P = None\n        arg_0.sorted_valid_methods_P = []\n        arg_0.TP_cached = None", "path": "thermo/utils.py", "identifier": "TPDependentProperty.set_user_methods_P", "docstring": "r'''Method to set the pressure-dependent property methods desired for\n        consideration by the user. Can be used to exclude certain methods which\n        might have unacceptable accuracy.\n\n        As a side effect, the previously selected method is removed when\n        this method is called to ensure user methods are tried in the desired\n        order.\n\n        Parameters\n        ----------\n        user_methods_P : str or list\n            Methods by name to be considered or preferred for pressure effect.\n        forced : bool, optional\n            If True, only the user specified methods will ever be considered;\n            if False other methods will be considered if no user methods\n            suceed.", "docstring_tokens": ["r", "Method", "to", "set", "the", "pressure", "-", "dependent", "property", "methods", "desired", "for", "consideration", "by", "the", "user", ".", "Can", "be", "used", "to", "exclude", "certain", "methods", "which", "might", "have", "unacceptable", "accuracy", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256754}
{"url": "https://github.com/ricobl/django-importer/blob/6967adfa7a286be7aaf59d3f33c6637270bd9df6/django_importer/importers/base.py#L48-L70", "sha": "6967adfa7a286be7aaf59d3f33c6637270bd9df6", "docstring_summary": "Parses all data from the source, saving model instances.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "loaded", ":", "arg_0", ".", "load", "(", "arg_0", ".", "source", ")", "for", "arg_1", "in", "arg_0", ".", "get_items", "(", ")", ":", "arg_2", "=", "arg_0", ".", "Func_item", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "get_instance", "(", "arg_2", ")", "arg_0", ".", "feed_instance", "(", "arg_2", ",", "arg_3", ")", "try", ":", "arg_0", ".", "save_item", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "Exception", "as", "e", ":", "arg_0", ".", "save_error", "(", "arg_2", ",", "sys", ".", "exc_info", "(", ")", ")", "arg_0", ".", "unload", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Parses all data from the source, saving model instances.\n        \"\"\"\n        # Checks if the source is loaded\n        if not arg_0.loaded:\n            arg_0.load(arg_0.source)\n        \n        for arg_1 in arg_0.get_items():\n            # Parse the fields from the source into a dict\n            arg_2 = arg_0.Func_item(arg_1)\n            # Get the instance from the DB, or a new one\n            arg_3 = arg_0.get_instance(arg_2)\n            # Feed instance with data\n            arg_0.feed_instance(arg_2, arg_3)\n            # Try to save the instance or keep the error\n            try:\n                arg_0.save_item(arg_1, arg_2, arg_3)\n            except Exception as e:\n                arg_0.save_error(arg_2, sys.exc_info())\n\n        # Unload the source\n        arg_0.unload()", "path": "django_importer/importers/base.py", "identifier": "Importer.parse", "docstring": "Parses all data from the source, saving model instances.", "docstring_tokens": ["Parses", "all", "data", "from", "the", "source", "saving", "model", "instances", "."], "nwo": "ricobl/django-importer", "score": 0.3726785709016597, "idx": 256755}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_handler_mix_in.py#L198-L218", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return true if the message associated to the given message id is\n        enabled", "language": "python", "parameters": "(self, msg_descr, line=None, confidence=None)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_0", ".", "config", ".", "confidence", "and", "arg_3", ":", "if", "arg_3", ".", "name", "not", "in", "arg_0", ".", "config", ".", "confidence", ":", "return", "False", "try", ":", "arg_4", "=", "arg_0", ".", "msgs_store", ".", "get_message_definitions", "(", "arg_1", ")", "arg_5", "=", "[", "md", ".", "msgid", "for", "md", "in", "arg_4", "]", "except", "UnknownMessageError", ":", "arg_5", "=", "[", "arg_1", "]", "for", "arg_6", "in", "arg_5", ":", "if", "arg_0", ".", "is_one_message_enabled", "(", "arg_6", ",", "arg_2", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"return true if the message associated to the given message id is\n        enabled\n\n        msgid may be either a numeric or symbolic message id.\n        \"\"\"\n        if arg_0.config.confidence and arg_3:\n            if arg_3.name not in arg_0.config.confidence:\n                return False\n        try:\n            arg_4 = arg_0.msgs_store.get_message_definitions(arg_1)\n            arg_5 = [md.msgid for md in arg_4]\n        except UnknownMessageError:\n            # The linter checks for messages that are not registered\n            # due to version mismatch, just treat them as message IDs\n            # for now.\n            arg_5 = [arg_1]\n        for arg_6 in arg_5:\n            if arg_0.is_one_message_enabled(arg_6, arg_2):\n                return True\n        return False", "path": "pylint/message/message_handler_mix_in.py", "identifier": "MessagesHandlerMixIn.is_message_enabled", "docstring": "return true if the message associated to the given message id is\n        enabled\n\n        msgid may be either a numeric or symbolic message id.", "docstring_tokens": ["return", "true", "if", "the", "message", "associated", "to", "the", "given", "message", "id", "is", "enabled"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256756}
{"url": "https://github.com/chuck1/codemach/blob/b0e02f363da7aa58de7d6ad6499784282958adeb/codemach/machine.py#L353-L364", "sha": "b0e02f363da7aa58de7d6ad6499784282958adeb", "docstring_summary": "Implementation of the LOAD_NAME operation", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "globals_", ":", "return", "arg_0", ".", "globals_", "[", "arg_1", "]", "arg_2", "=", "arg_0", ".", "globals_", "[", "'__builtins__'", "]", "if", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "return", "arg_2", "[", "arg_1", "]", "else", ":", "return", "getattr", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Implementation of the LOAD_NAME operation\n        \"\"\"\n        if arg_1 in arg_0.globals_:\n            return arg_0.globals_[arg_1]\n        \n        arg_2 = arg_0.globals_['__builtins__']\n        if isinstance(arg_2, dict):\n            return arg_2[arg_1]\n        else:\n            return getattr(arg_2, arg_1)", "path": "codemach/machine.py", "identifier": "Machine.load_name", "docstring": "Implementation of the LOAD_NAME operation", "docstring_tokens": ["Implementation", "of", "the", "LOAD_NAME", "operation"], "nwo": "chuck1/codemach", "score": 0.09252797783733271, "idx": 256757}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/compiler.py#L376-L382", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Convert an AST sepcial handling to python source code.", "language": "python", "parameters": "(self, special_handling, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "value", ".", "svalue", "if", "arg_3", "in", "PB_SPECIAL_HANDLING", ":", "return", "[", "\"PB.{0}\"", ".", "format", "(", "arg_3", ")", "]", "else", ":", "return", "[", "\"self.{0}\"", ".", "format", "(", "arg_3", ")", "]"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Convert an AST sepcial handling to python source code.\"\"\"\n    arg_3 = arg_1.value.svalue\n    if arg_3 in PB_SPECIAL_HANDLING:\n      return [\"PB.{0}\".format(arg_3)]\n    else:\n      return [\"self.{0}\".format(arg_3)]", "path": "pyebnf/compiler.py", "identifier": "Compiler._ast_special_handling_to_code", "docstring": "Convert an AST sepcial handling to python source code.", "docstring_tokens": ["Convert", "an", "AST", "sepcial", "handling", "to", "python", "source", "code", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 256758}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L729-L736", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "The text representation of an end tag for a tag.  Includes\n    trailing whitespace when appropriate.", "language": "python", "parameters": "(el)", "return_statement": "return '</%s>%s' % (el.tag, extra)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "tail", "and", "start_whitespace_re", ".", "search", "(", "arg_0", ".", "tail", ")", ":", "arg_1", "=", "' '", "else", ":", "arg_1", "=", "''", "return", "'</%s>%s'", "%", "(", "arg_0", ".", "tag", ",", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\" The text representation of an end tag for a tag.  Includes\n    trailing whitespace when appropriate.  \"\"\"\n    if arg_0.tail and start_whitespace_re.search(arg_0.tail):\n        arg_1 = ' '\n    else:\n        arg_1 = ''\n    return '</%s>%s' % (arg_0.tag, arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py", "identifier": "end_tag", "docstring": "The text representation of an end tag for a tag.  Includes\n    trailing whitespace when appropriate.", "docstring_tokens": ["The", "text", "representation", "of", "an", "end", "tag", "for", "a", "tag", ".", "Includes", "trailing", "whitespace", "when", "appropriate", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256759}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/metrics.py#L829-L831", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Compute and store metric value", "language": "python", "parameters": "(self, groundTruth, prediction, record = None, result = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_0", ".", "value", "=", "arg_0", ".", "avg", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = None, arg_4 = None):\n    \"\"\"Compute and store metric value\"\"\"\n    arg_0.value = arg_0.avg(arg_2)", "path": "src/nupic/frameworks/opf/metrics.py", "identifier": "MetricPassThruPrediction.addInstance", "docstring": "Compute and store metric value", "docstring_tokens": ["Compute", "and", "store", "metric", "value"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256760}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/core.py#L31-L40", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "Determine the protocol used to record an ABF file", "language": "python", "parameters": "(fname)", "return_statement": "return protocolID", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "open", "(", "arg_0", ",", "'rb'", ")", "arg_2", "=", "arg_1", ".", "read", "(", "30", "*", "1000", ")", "arg_1", ".", "close", "(", ")", "arg_2", "=", "arg_2", ".", "decode", "(", "\"utf-8\"", ",", "\"ignore\"", ")", "arg_2", "=", "arg_2", ".", "split", "(", "\"Clampex\"", ")", "[", "1", "]", ".", "split", "(", "\".pro\"", ")", "[", "0", "]", "arg_3", "=", "os", ".", "path", ".", "basename", "(", "arg_2", ")", "arg_4", "=", "arg_3", ".", "split", "(", "\" \"", ")", "[", "0", "]", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Determine the protocol used to record an ABF file\"\"\"\n    arg_1=open(arg_0,'rb')\n    arg_2=arg_1.read(30*1000) #it should be in the first 30k of the file\n    arg_1.close()\n    arg_2=arg_2.decode(\"utf-8\",\"ignore\")\n    arg_2=arg_2.split(\"Clampex\")[1].split(\".pro\")[0]\n    arg_3 = os.path.basename(arg_2) # the whole protocol filename\n    arg_4 = arg_3.split(\" \")[0] # just the first number\n    return arg_4", "path": "swhlab/core.py", "identifier": "abfProtocol", "docstring": "Determine the protocol used to record an ABF file", "docstring_tokens": ["Determine", "the", "protocol", "used", "to", "record", "an", "ABF", "file"], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 256761}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/threads.py#L461-L502", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Stop the threads.", "language": "python", "parameters": "(self, join = False, timeout = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"Closing the io handlers...\"", ")", "for", "arg_3", "in", "arg_0", ".", "io_handlers", ":", "arg_3", ".", "close", "(", ")", "if", "arg_0", ".", "event_thread", "and", "arg_0", ".", "event_thread", ".", "is_alive", "(", ")", ":", "logger", ".", "debug", "(", "\"Sending the QUIT signal\"", ")", "arg_0", ".", "event_queue", ".", "put", "(", "QUIT", ")", "logger", ".", "debug", "(", "\"  sent\"", ")", "arg_4", "=", "arg_0", ".", "io_threads", "+", "arg_0", ".", "timeout_threads", "for", "arg_5", "in", "arg_4", ":", "logger", ".", "debug", "(", "\"Stopping thread: {0!r}\"", ".", "format", "(", "arg_5", ")", ")", "arg_5", ".", "Func", "(", ")", "if", "not", "arg_1", ":", "return", "if", "arg_0", ".", "event_thread", ":", "arg_4", ".", "append", "(", "arg_0", ".", "event_thread", ")", "if", "arg_2", "is", "None", ":", "for", "arg_5", "in", "arg_4", ":", "arg_5", ".", "join", "(", ")", "else", ":", "arg_6", "=", "(", "arg_2", "*", "0.01", ")", "/", "len", "(", "arg_4", ")", "arg_7", "=", "[", "]", "for", "arg_5", "in", "arg_4", ":", "logger", ".", "debug", "(", "\"Quick-joining thread {0!r}...\"", ".", "format", "(", "arg_5", ")", ")", "arg_5", ".", "join", "(", "arg_6", ")", "if", "arg_5", ".", "is_alive", "(", ")", ":", "logger", ".", "debug", "(", "\"  thread still alive\"", ".", "format", "(", "arg_5", ")", ")", "arg_7", ".", "append", "(", "arg_5", ")", "if", "arg_7", ":", "arg_8", "=", "(", "arg_2", "*", "0.99", ")", "/", "len", "(", "arg_7", ")", "for", "arg_5", "in", "arg_7", ":", "logger", ".", "debug", "(", "\"Joining thread {0!r}...\"", ".", "format", "(", "arg_5", ")", ")", "arg_5", ".", "join", "(", "arg_8", ")", "arg_0", ".", "io_threads", "=", "[", "]", "arg_0", ".", "event_thread", "=", "None"], "function": "def Func(arg_0, arg_1 = False, arg_2 = None):\n        \"\"\"Stop the threads.\n\n        :Parameters:\n            - `join`: join the threads (wait until they exit)\n            - `timeout`: maximum time (in seconds) to wait when `join` is\n              `True`).  No limit when `timeout` is `None`.\n        \"\"\"\n        logger.debug(\"Closing the io handlers...\")\n        for arg_3 in arg_0.io_handlers:\n            arg_3.close()\n        if arg_0.event_thread and arg_0.event_thread.is_alive():\n            logger.debug(\"Sending the QUIT signal\")\n            arg_0.event_queue.put(QUIT)\n        logger.debug(\"  sent\")\n        arg_4 = arg_0.io_threads + arg_0.timeout_threads\n        for arg_5 in arg_4:\n            logger.debug(\"Stopping thread: {0!r}\".format(arg_5))\n            arg_5.Func()\n        if not arg_1:\n            return\n        if arg_0.event_thread:\n            arg_4.append(arg_0.event_thread)\n        if arg_2 is None:\n            for arg_5 in arg_4:\n                arg_5.join()\n        else:\n            arg_6 = (arg_2 * 0.01) / len(arg_4)\n            arg_7 = []\n            for arg_5 in arg_4:\n                logger.debug(\"Quick-joining thread {0!r}...\".format(arg_5))\n                arg_5.join(arg_6)\n                if arg_5.is_alive():\n                    logger.debug(\"  thread still alive\".format(arg_5))\n                    arg_7.append(arg_5)\n            if arg_7:\n                arg_8 = (arg_2 * 0.99) / len(arg_7)\n                for arg_5 in arg_7:\n                    logger.debug(\"Joining thread {0!r}...\".format(arg_5))\n                    arg_5.join(arg_8)\n        arg_0.io_threads = []\n        arg_0.event_thread = None", "path": "pyxmpp2/mainloop/threads.py", "identifier": "ThreadPool.stop", "docstring": "Stop the threads.\n\n        :Parameters:\n            - `join`: join the threads (wait until they exit)\n            - `timeout`: maximum time (in seconds) to wait when `join` is\n              `True`).  No limit when `timeout` is `None`.", "docstring_tokens": ["Stop", "the", "threads", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256762}
{"url": "https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/pushpull.py#L182-L199", "sha": "aca085ea54541b087140b58a81332f8728baeeb2", "docstring_summary": "Restore resource's path and name from storage's table.", "language": "python", "parameters": "(table)", "return_statement": "return path, name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "arg_0", ".", "split", "(", "'___'", ")", "arg_3", "=", "arg_2", "[", "0", "]", "if", "len", "(", "arg_2", ")", "==", "2", ":", "arg_1", "=", "arg_2", "[", "1", "]", "arg_3", "=", "arg_3", ".", "replace", "(", "'__'", ",", "os", ".", "path", ".", "sep", ")", "arg_3", "+=", "'.csv'", "return", "arg_3", ",", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Restore resource's path and name from storage's table.\n\n    Args:\n        table (str): table name\n\n    Returns:\n        (str, str): resource path and name\n\n    \"\"\"\n    arg_1 = None\n    arg_2 = arg_0.split('___')\n    arg_3 = arg_2[0]\n    if len(arg_2) == 2:\n        arg_1 = arg_2[1]\n    arg_3 = arg_3.replace('__', os.path.sep)\n    arg_3 += '.csv'\n    return arg_3, arg_1", "path": "datapackage/pushpull.py", "identifier": "_restore_path", "docstring": "Restore resource's path and name from storage's table.\n\n    Args:\n        table (str): table name\n\n    Returns:\n        (str, str): resource path and name", "docstring_tokens": ["Restore", "resource", "s", "path", "and", "name", "from", "storage", "s", "table", "."], "nwo": "frictionlessdata/datapackage-py", "score": 0.5653088377587532, "idx": 256763}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/regression.py#L40-L47", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build an observation_noise_fn that observes a Tensor timeseries.", "language": "python", "parameters": "(timeseries)", "return_statement": "return observation_noise_fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "observation_noise_fn", "(", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "...", ",", "arg_1", ",", ":", "]", "return", "tfd", ".", "MultivariateNormalDiag", "(", "loc", "=", "arg_2", ",", "scale_diag", "=", "tf", ".", "zeros_like", "(", "arg_2", ")", ")", "return", "observation_noise_fn"], "function": "def Func(arg_0):\n  \"\"\"Build an observation_noise_fn that observes a Tensor timeseries.\"\"\"\n  def observation_noise_fn(arg_1):\n    arg_2 = arg_0[..., arg_1, :]\n    return tfd.MultivariateNormalDiag(\n        loc=arg_2,\n        scale_diag=tf.zeros_like(arg_2))\n  return observation_noise_fn", "path": "tensorflow_probability/python/sts/regression.py", "identifier": "_observe_timeseries_fn", "docstring": "Build an observation_noise_fn that observes a Tensor timeseries.", "docstring_tokens": ["Build", "an", "observation_noise_fn", "that", "observes", "a", "Tensor", "timeseries", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256764}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/util/scm/base.py#L38-L41", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Run a command.", "language": "python", "parameters": "(self, cmd, *args, **kwargs)", "return_statement": "return run(cmd, runner=runner, *args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "ctx", ".", "Func", "if", "arg_0", ".", "ctx", "else", "None", "return", "Func", "(", "arg_1", ",", "arg_4", "=", "arg_4", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Run a command.\"\"\"\n        arg_4 = arg_0.ctx.Func if arg_0.ctx else None\n        return Func(arg_1, arg_4=arg_4, *arg_2, **arg_3)", "path": "src/rituals/util/scm/base.py", "identifier": "ProviderBase.run", "docstring": "Run a command.", "docstring_tokens": ["Run", "a", "command", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 256765}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/reshape.py#L316-L382", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Replaces the event shape dims of a `TensorShape`.", "language": "python", "parameters": "(\n    input_tensorshape, event_shape_in, event_shape_out)", "return_statement": "return output_tensorshape, is_validated", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "tensorshape_util", ".", "num_elements", "(", "arg_1", ".", "shape", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_0", ")", "is", "None", "or", "arg_3", "is", "None", ":", "return", "tf", ".", "TensorShape", "(", "None", ")", ",", "False", "arg_4", "=", "tensorshape_util", ".", "rank", "(", "arg_0", ")", "-", "arg_3", "if", "arg_4", "<", "0", ":", "raise", "ValueError", "(", "'Input has fewer ndims ({}) than event shape ndims ({}).'", ".", "format", "(", "tensorshape_util", ".", "rank", "(", "arg_0", ")", ",", "arg_3", ")", ")", "arg_5", "=", "arg_0", "[", ":", "arg_4", "]", "arg_6", "=", "arg_0", "[", "arg_4", ":", "]", "arg_7", "=", "tf", ".", "get_static_value", "(", "arg_1", ")", "arg_8", "=", "(", "tensorshape_util", ".", "is_fully_defined", "(", "arg_6", ")", "and", "arg_7", "is", "not", "None", ")", "if", "arg_8", ":", "arg_9", "=", "np", ".", "int32", "(", "arg_6", ")", "arg_10", "=", "arg_7", ">=", "0", "arg_11", "=", "arg_9", "[", "arg_10", "]", "arg_12", "=", "arg_7", "[", "arg_10", "]", "if", "not", "all", "(", "arg_11", "==", "arg_12", ")", ":", "raise", "ValueError", "(", "'Input `event_shape` does not match `event_shape_in`. '", "'({} vs {}).'", ".", "format", "(", "arg_9", ",", "arg_7", ")", ")", "arg_13", "=", "tensorshape_util", ".", "constant_value_as_shape", "(", "arg_2", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_13", ")", "is", "None", ":", "arg_14", "=", "tf", ".", "TensorShape", "(", "None", ")", "else", ":", "arg_14", "=", "tensorshape_util", ".", "concatenate", "(", "arg_5", ",", "arg_13", ")", "return", "arg_14", ",", "arg_8"], "function": "def Func(\n    arg_0, arg_1, arg_2):\n  \"\"\"Replaces the event shape dims of a `TensorShape`.\n\n  Args:\n    input_tensorshape: a `TensorShape` instance in which to attempt replacing\n      event shape.\n    event_shape_in: `Tensor` shape representing the event shape expected to\n      be present in (rightmost dims of) `tensorshape_in`. Must be compatible\n      with the rightmost dims of `tensorshape_in`.\n    event_shape_out: `Tensor` shape representing the new event shape, i.e.,\n      the replacement of `event_shape_in`,\n\n  Returns:\n    output_tensorshape: `TensorShape` with the rightmost `event_shape_in`\n      replaced by `event_shape_out`. Might be partially defined, i.e.,\n      `TensorShape(None)`.\n    is_validated: Python `bool` indicating static validation happened.\n\n  Raises:\n    ValueError: if we can determine the event shape portion of\n      `tensorshape_in` as well as `event_shape_in` both statically, and they\n      are not compatible. \"Compatible\" here means that they are identical on\n      any dims that are not -1 in `event_shape_in`.\n  \"\"\"\n  arg_3 = tensorshape_util.num_elements(arg_1.shape)\n  if tensorshape_util.rank(\n      arg_0) is None or arg_3 is None:\n    return tf.TensorShape(None), False  # Not is_validated.\n\n  arg_4 = tensorshape_util.rank(\n      arg_0) - arg_3\n  if arg_4 < 0:\n    raise ValueError(\n        'Input has fewer ndims ({}) than event shape ndims ({}).'.format(\n            tensorshape_util.rank(arg_0), arg_3))\n\n  arg_5 = arg_0[:arg_4]\n  arg_6 = arg_0[arg_4:]\n\n  # Check that `input_event_shape_` and `event_shape_in` are compatible in the\n  # sense that they have equal entries in any position that isn't a `-1` in\n  # `event_shape_in`. Note that our validations at construction time ensure\n  # there is at most one such entry in `event_shape_in`.\n  arg_7 = tf.get_static_value(arg_1)\n  arg_8 = (\n      tensorshape_util.is_fully_defined(arg_6) and\n      arg_7 is not None)\n  if arg_8:\n    arg_9 = np.int32(arg_6)\n    arg_10 = arg_7 >= 0\n    arg_11 = arg_9[arg_10]\n    arg_12 = arg_7[arg_10]\n    if not all(arg_11 == arg_12):\n      raise ValueError(\n          'Input `event_shape` does not match `event_shape_in`. '\n          '({} vs {}).'.format(arg_9, arg_7))\n\n  arg_13 = tensorshape_util.constant_value_as_shape(\n      arg_2)\n  if tensorshape_util.rank(arg_13) is None:\n    arg_14 = tf.TensorShape(None)\n  else:\n    arg_14 = tensorshape_util.concatenate(\n        arg_5, arg_13)\n\n  return arg_14, arg_8", "path": "tensorflow_probability/python/bijectors/reshape.py", "identifier": "_replace_event_shape_in_tensorshape", "docstring": "Replaces the event shape dims of a `TensorShape`.\n\n  Args:\n    input_tensorshape: a `TensorShape` instance in which to attempt replacing\n      event shape.\n    event_shape_in: `Tensor` shape representing the event shape expected to\n      be present in (rightmost dims of) `tensorshape_in`. Must be compatible\n      with the rightmost dims of `tensorshape_in`.\n    event_shape_out: `Tensor` shape representing the new event shape, i.e.,\n      the replacement of `event_shape_in`,\n\n  Returns:\n    output_tensorshape: `TensorShape` with the rightmost `event_shape_in`\n      replaced by `event_shape_out`. Might be partially defined, i.e.,\n      `TensorShape(None)`.\n    is_validated: Python `bool` indicating static validation happened.\n\n  Raises:\n    ValueError: if we can determine the event shape portion of\n      `tensorshape_in` as well as `event_shape_in` both statically, and they\n      are not compatible. \"Compatible\" here means that they are identical on\n      any dims that are not -1 in `event_shape_in`.", "docstring_tokens": ["Replaces", "the", "event", "shape", "dims", "of", "a", "TensorShape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256766}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/metrics/metrics_helper.py#L228-L231", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Apply updates to the next tuple metrics", "language": "python", "parameters": "(self, latency_in_ns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "update_reduced_metric", "(", "arg_0", ".", "NEXT_TUPLE_LATENCY", ",", "arg_1", ")", "arg_0", ".", "update_count", "(", "arg_0", ".", "NEXT_TUPLE_COUNT", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Apply updates to the next tuple metrics\"\"\"\n    arg_0.update_reduced_metric(arg_0.NEXT_TUPLE_LATENCY, arg_1)\n    arg_0.update_count(arg_0.NEXT_TUPLE_COUNT)", "path": "heron/instance/src/python/utils/metrics/metrics_helper.py", "identifier": "SpoutMetrics.next_tuple", "docstring": "Apply updates to the next tuple metrics", "docstring_tokens": ["Apply", "updates", "to", "the", "next", "tuple", "metrics"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256767}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/access/tracker_access.py#L54-L62", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Synced API call to get all cluster names", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "tornado", ".", "ioloop", ".", "IOLoop", ".", "instance", "(", ")", "try", ":", "return", "arg_0", ".", "run_sync", "(", "lambda", ":", "API", ".", "Func", "(", ")", ")", "except", "Exception", ":", "Log", ".", "debug", "(", "traceback", ".", "format_exc", "(", ")", ")", "raise"], "function": "def Func():\n  \"\"\"Synced API call to get all cluster names\"\"\"\n  arg_0 = tornado.ioloop.IOLoop.instance()\n  # pylint: disable=unnecessary-lambda\n  try:\n    return arg_0.run_sync(lambda: API.Func())\n  except Exception:\n    Log.debug(traceback.format_exc())\n    raise", "path": "heron/tools/common/src/python/access/tracker_access.py", "identifier": "get_clusters", "docstring": "Synced API call to get all cluster names", "docstring_tokens": ["Synced", "API", "call", "to", "get", "all", "cluster", "names"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256768}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1177-L1190", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Remove all of the ancestor operation nodes of node.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "warnings", ".", "warn", "(", "'Calling Func() with a node id is deprecated,'", "' use a DAGNode instead'", ",", "DeprecationWarning", ",", "2", ")", "arg_1", "=", "arg_0", ".", "_id_to_node", "[", "arg_1", "]", "arg_2", "=", "nx", ".", "ancestors", "(", "arg_0", ".", "_multi_graph", ",", "arg_1", ")", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", ".", "type", "==", "\"op\"", ":", "arg_0", ".", "remove_op_node", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove all of the ancestor operation nodes of node.\"\"\"\n        if isinstance(arg_1, int):\n            warnings.warn('Calling Func() with a node id is deprecated,'\n                          ' use a DAGNode instead',\n                          DeprecationWarning, 2)\n            arg_1 = arg_0._id_to_node[arg_1]\n\n        arg_2 = nx.ancestors(arg_0._multi_graph, arg_1)\n        # TODO: probably better to do all at once using\n        # multi_graph.remove_nodes_from; same for related functions ...\n        for arg_3 in arg_2:\n            if arg_3.type == \"op\":\n                arg_0.remove_op_node(arg_3)", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.remove_ancestors_of", "docstring": "Remove all of the ancestor operation nodes of node.", "docstring_tokens": ["Remove", "all", "of", "the", "ancestor", "operation", "nodes", "of", "node", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256769}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/cli/script.py#L100-L120", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Script to make pMHC binding predictions from amino acid sequences.", "language": "python", "parameters": "(args_list=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "parse_args", "(", "arg_0", ")", "arg_2", "=", "run_predictor", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "to_dataframe", "(", ")", "logger", ".", "info", "(", "'\\n%s'", ",", "arg_3", ")", "if", "arg_1", ".", "output_csv", ":", "arg_3", ".", "to_csv", "(", "arg_1", ".", "output_csv", ",", "index", "=", "False", ")", "print", "(", "\"Wrote: %s\"", "%", "arg_1", ".", "output_csv", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Script to make pMHC binding predictions from amino acid sequences.\n\n    Usage example:\n        mhctools\n            --sequence SFFPIQQQQQAAALLLI \\\n            --sequence SILQQQAQAQQAQAASSSC \\\n            --extract-subsequences \\\n            --mhc-predictor netmhc \\\n            --mhc-alleles HLA-A0201 H2-Db \\\n            --mhc-predictor netmhc \\\n            --output-csv epitope.csv\n    \"\"\"\n    arg_1 = parse_args(arg_0)\n    arg_2 = run_predictor(arg_1)\n    arg_3 = arg_2.to_dataframe()\n    logger.info('\\n%s', arg_3)\n    if arg_1.output_csv:\n        arg_3.to_csv(arg_1.output_csv, index=False)\n        print(\"Wrote: %s\" % arg_1.output_csv)", "path": "mhctools/cli/script.py", "identifier": "main", "docstring": "Script to make pMHC binding predictions from amino acid sequences.\n\n    Usage example:\n        mhctools\n            --sequence SFFPIQQQQQAAALLLI \\\n            --sequence SILQQQAQAQQAQAASSSC \\\n            --extract-subsequences \\\n            --mhc-predictor netmhc \\\n            --mhc-alleles HLA-A0201 H2-Db \\\n            --mhc-predictor netmhc \\\n            --output-csv epitope.csv", "docstring_tokens": ["Script", "to", "make", "pMHC", "binding", "predictions", "from", "amino", "acid", "sequences", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 256770}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/woopra.py#L38-L48", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "Woopra tracking template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return WoopraNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "WoopraNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Woopra tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your Woopra domain in the ``WOOPRA_DOMAIN`` setting.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return WoopraNode()", "path": "analytical/templatetags/woopra.py", "identifier": "woopra", "docstring": "Woopra tracking template tag.\n\n    Renders Javascript code to track page visits.  You must supply\n    your Woopra domain in the ``WOOPRA_DOMAIN`` setting.", "docstring_tokens": ["Woopra", "tracking", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 256771}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L219-L223", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Get available datasets from mart you've selected", "language": "python", "parameters": "(self, mart='ENSEMBL_MART_ENSEMBL')", "return_statement": "return pd.read_csv(StringIO(datasets), header=None, usecols=[1, 2],\n                            names = [\"Name\", \"Description\"],sep=\"\\t\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'ENSEMBL_MART_ENSEMBL'", ")", ":", "arg_2", "=", "arg_0", ".", "datasets", "(", "arg_1", ",", "raw", "=", "True", ")", "return", "pd", ".", "read_csv", "(", "StringIO", "(", "arg_2", ")", ",", "header", "=", "None", ",", "usecols", "=", "[", "1", ",", "2", "]", ",", "names", "=", "[", "\"Name\"", ",", "\"Description\"", "]", ",", "sep", "=", "\"\\t\"", ")"], "function": "def Func(arg_0, arg_1='ENSEMBL_MART_ENSEMBL'):\n        \"\"\"Get available datasets from mart you've selected\"\"\"\n        arg_2 = arg_0.datasets(arg_1, raw=True)\n        return pd.read_csv(StringIO(arg_2), header=None, usecols=[1, 2],\n                            names = [\"Name\", \"Description\"],sep=\"\\t\")", "path": "gseapy/parser.py", "identifier": "Biomart.get_datasets", "docstring": "Get available datasets from mart you've selected", "docstring_tokens": ["Get", "available", "datasets", "from", "mart", "you", "ve", "selected"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 256772}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/engine.py#L166-L173", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Removes a specific mock instance by object reference.", "language": "python", "parameters": "(self, mock)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "mocks", "=", "[", "m", "for", "m", "in", "arg_0", ".", "mocks", "if", "m", "is", "not", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Removes a specific mock instance by object reference.\n\n        Arguments:\n            mock (pook.Mock): mock instance to remove.\n        \"\"\"\n        arg_0.mocks = [m for m in arg_0.mocks if m is not arg_1]", "path": "pook/engine.py", "identifier": "Engine.remove_mock", "docstring": "Removes a specific mock instance by object reference.\n\n        Arguments:\n            mock (pook.Mock): mock instance to remove.", "docstring_tokens": ["Removes", "a", "specific", "mock", "instance", "by", "object", "reference", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 256773}
{"url": "https://github.com/JonathanRaiman/ciseau/blob/f72d1c82d85eeb3d3ac9fac17690041725402175/ciseau/wiki_markup_processing.py#L178-L207", "sha": "f72d1c82d85eeb3d3ac9fac17690041725402175", "docstring_summary": "A generator to convert raw text segments, with xml, and other\n    non-textual content to a list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization,\n    along with wikipedia anchors kept.", "language": "python", "parameters": "(text, keep_whitespace=False, normalize_ascii=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", "arg_3", "=", "_remove_mvar", "(", "arg_3", ")", "arg_3", "=", "_remove_squiggly_bracket", "(", "arg_3", ")", "arg_3", "=", "_remove_table", "(", "arg_3", ")", "arg_3", "=", "remove_markup", "(", "arg_3", ")", "arg_3", "=", "remove_wikipedia_link", ".", "sub", "(", "anchor_replacer", ",", "arg_3", ")", "arg_3", "=", "remove_bullets_nbsps", ".", "sub", "(", "empty_space", ",", "arg_3", ")", "arg_3", "=", "remove_math_sections", "(", "arg_3", ")", "arg_3", "=", "remove_html", "(", "arg_3", ")", "for", "arg_4", "in", "sent_tokenize", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", ":", "yield", "arg_4"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n    \"\"\"\n    A generator to convert raw text segments, with xml, and other\n    non-textual content to a list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization,\n    along with wikipedia anchors kept.\n\n    Arguments\n    ---------\n       text: str, input text to tokenize, strip of markup.\n       keep_whitespace : bool, should the output retain the\n          whitespace of the input (so that char offsets in the\n          output correspond to those in the input).\n\n    Returns\n    -------\n        generator<list<list<str>>>, a generator for sentences, with\n            within each sentence a list of the words separated.\n    \"\"\"\n    arg_3 = arg_0\n    arg_3 = _remove_mvar(arg_3)\n    arg_3 = _remove_squiggly_bracket(arg_3)\n    arg_3 = _remove_table(arg_3)\n    arg_3 = remove_markup(arg_3)\n    arg_3 = remove_wikipedia_link.sub(anchor_replacer, arg_3)\n    arg_3 = remove_bullets_nbsps.sub(empty_space, arg_3)\n    arg_3 = remove_math_sections(arg_3)\n    arg_3 = remove_html(arg_3)\n    for arg_4 in sent_tokenize(arg_3, arg_1, arg_2):\n        yield arg_4", "path": "ciseau/wiki_markup_processing.py", "identifier": "to_raw_text_pairings", "docstring": "A generator to convert raw text segments, with xml, and other\n    non-textual content to a list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization,\n    along with wikipedia anchors kept.\n\n    Arguments\n    ---------\n       text: str, input text to tokenize, strip of markup.\n       keep_whitespace : bool, should the output retain the\n          whitespace of the input (so that char offsets in the\n          output correspond to those in the input).\n\n    Returns\n    -------\n        generator<list<list<str>>>, a generator for sentences, with\n            within each sentence a list of the words separated.", "docstring_tokens": ["A", "generator", "to", "convert", "raw", "text", "segments", "with", "xml", "and", "other", "non", "-", "textual", "content", "to", "a", "list", "of", "words", "without", "any", "markup", ".", "Additionally", "dates", "are", "replaced", "by", "7777", "for", "normalization", "along", "with", "wikipedia", "anchors", "kept", "."], "nwo": "JonathanRaiman/ciseau", "score": 0.2836741237679313, "idx": 256774}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L501-L517", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Add a new item to the `DiscoItems` object.", "language": "python", "parameters": "(self,jid,node=None,name=None,action=None)", "return_statement": "return DiscoItem(self,jid,node,name,action)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "return", "DiscoItem", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0,arg_1,arg_2=None,arg_3=None,arg_4=None):\n        \"\"\"Add a new item to the `DiscoItems` object.\n\n        :Parameters:\n            - `jid`: item JID.\n            - `node`: item node name.\n            - `name`: item name.\n            - `action`: action for a \"disco push\".\n        :Types:\n            - `jid`: `pyxmpp.JID`\n            - `node`: `unicode`\n            - `name`: `unicode`\n            - `action`: `unicode`\n\n        :returns: the item created.\n        :returntype: `DiscoItem`.\"\"\"\n        return DiscoItem(arg_0,arg_1,arg_2,arg_3,arg_4)", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoItems.add_item", "docstring": "Add a new item to the `DiscoItems` object.\n\n        :Parameters:\n            - `jid`: item JID.\n            - `node`: item node name.\n            - `name`: item name.\n            - `action`: action for a \"disco push\".\n        :Types:\n            - `jid`: `pyxmpp.JID`\n            - `node`: `unicode`\n            - `name`: `unicode`\n            - `action`: `unicode`\n\n        :returns: the item created.\n        :returntype: `DiscoItem`.", "docstring_tokens": ["Add", "a", "new", "item", "to", "the", "DiscoItems", "object", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256775}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/re.py#L211-L221", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Escape all non-alphanumeric characters in pattern.", "language": "python", "parameters": "(pattern)", "return_statement": "return pattern[:0].join(s)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", "arg_0", ")", "arg_2", "=", "_alphanum", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", ":", "if", "arg_4", "not", "in", "arg_2", ":", "if", "arg_4", "==", "\"\\000\"", ":", "arg_1", "[", "arg_3", "]", "=", "\"\\\\000\"", "else", ":", "arg_1", "[", "arg_3", "]", "=", "\"\\\\\"", "+", "arg_4", "return", "arg_0", "[", ":", "0", "]", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"Escape all non-alphanumeric characters in pattern.\"\n    arg_1 = list(arg_0)\n    arg_2 = _alphanum\n    for arg_3, arg_4 in enumerate(arg_0):\n        if arg_4 not in arg_2:\n            if arg_4 == \"\\000\":\n                arg_1[arg_3] = \"\\\\000\"\n            else:\n                arg_1[arg_3] = \"\\\\\" + arg_4\n    return arg_0[:0].join(arg_1)", "path": "third_party/stdlib/re.py", "identifier": "escape", "docstring": "Escape all non-alphanumeric characters in pattern.", "docstring_tokens": ["Escape", "all", "non", "-", "alphanumeric", "characters", "in", "pattern", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 256776}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L493-L503", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Leave a one-to-one conversation.", "language": "python", "parameters": "(self, delete_conversation_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "DeleteConversationResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'conversations/deleteconversation'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Leave a one-to-one conversation.\n\n        One-to-one conversations are \"sticky\"; they can't actually be deleted.\n        This API clears the event history of the specified conversation up to\n        ``delete_upper_bound_timestamp``, hiding it if no events remain.\n        \"\"\"\n        arg_2 = hangouts_pb2.DeleteConversationResponse()\n        await arg_0._pb_request('conversations/deleteconversation',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.delete_conversation", "docstring": "Leave a one-to-one conversation.\n\n        One-to-one conversations are \"sticky\"; they can't actually be deleted.\n        This API clears the event history of the specified conversation up to\n        ``delete_upper_bound_timestamp``, hiding it if no events remain.", "docstring_tokens": ["Leave", "a", "one", "-", "to", "-", "one", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 256777}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L536-L586", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Half-duplex SPI write then read. Send command and payload to slave as bytearray\n            then consequently read out response from the slave for length in bytes.\n        Designed for use with NOR or NAND flash chips, and possibly SD cards...etc...\n        Read command is cut in half and performed twice in series to prevent single byte errors.\n        Hardware limits per command are enforced before doing anything.\n        Read length is an optional argument, so that it can function similar to transfer\n            but still half-duplex.\n        For reading without writing, one can send a blank array or skip that argument.", "language": "python", "parameters": "(self, data = [], lengthR = 'None', readmode = 1)", "return_statement": "return bytearray(payload1 + payload2)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ",", "arg_2", "=", "'None'", ",", "arg_3", "=", "1", ")", ":", "if", "(", "1", ">", "arg_2", ">", "65536", ")", "|", "(", "len", "(", "arg_1", ")", ">", "65536", ")", ":", "print", "(", "'the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!'", ")", "print", "(", "'use for loops for larger reads'", ")", "exit", "(", "1", ")", "if", "(", "arg_2", "==", "'None'", ")", "&", "(", "arg_3", "==", "1", ")", ":", "arg_2", "=", "len", "(", "arg_1", ")", "arg_4", "=", "0x10", "|", "(", "arg_0", ".", "lsbfirst", "<<", "3", ")", "|", "arg_0", ".", "write_clock_ve", "arg_5", "=", "len", "(", "arg_1", ")", "-", "1", "arg_6", "=", "(", "arg_5", ")", "&", "0xFF", "arg_7", "=", "(", "(", "arg_5", ")", ">>", "8", ")", "&", "0xFF", "arg_8", "=", "0x20", "|", "(", "arg_0", ".", "lsbfirst", "<<", "3", ")", "|", "(", "arg_0", ".", "read_clock_ve", "<<", "2", ")", "arg_9", "=", "arg_2", "if", "arg_2", "%", "2", "==", "1", ":", "arg_9", "+=", "1", "arg_9", "=", "arg_9", "/", "2", "arg_10", "=", "arg_2", "-", "arg_9", "arg_11", "=", "(", "arg_9", "-", "1", ")", "&", "0xFF", "arg_12", "=", "(", "(", "arg_9", "-", "1", ")", ">>", "8", ")", "&", "0xFF", "logger", ".", "debug", "(", "'SPI Func with write command {0:2X}.'", ".", "format", "(", "arg_4", ")", ")", "logger", ".", "debug", "(", "'and read command {0:2X}.'", ".", "format", "(", "arg_8", ")", ")", "arg_0", ".", "_assert_cs", "(", ")", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "(", "arg_4", ",", "arg_6", ",", "arg_7", ")", ")", ")", ")", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "arg_1", ")", ")", ")", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "(", "arg_8", ",", "arg_11", ",", "arg_12", ")", ")", ")", ")", "arg_13", "=", "arg_0", ".", "_ft232h", ".", "_poll_read", "(", "arg_9", ")", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "(", "arg_8", ",", "arg_11", ",", "arg_12", ")", ")", ")", ")", "arg_14", "=", "arg_0", ".", "_ft232h", ".", "_poll_read", "(", "arg_10", ")", "arg_0", ".", "_deassert_cs", "(", ")", "return", "bytearray", "(", "arg_13", "+", "arg_14", ")"], "function": "def Func(arg_0, arg_1 = [], arg_2 = 'None', arg_3 = 1):\n        \"\"\"Half-duplex SPI write then read. Send command and payload to slave as bytearray\n            then consequently read out response from the slave for length in bytes.\n        Designed for use with NOR or NAND flash chips, and possibly SD cards...etc...\n        Read command is cut in half and performed twice in series to prevent single byte errors.\n        Hardware limits per command are enforced before doing anything.\n        Read length is an optional argument, so that it can function similar to transfer\n            but still half-duplex.\n        For reading without writing, one can send a blank array or skip that argument.\n        \"\"\"\n        #check for hardware limit of FT232H and similar MPSSE chips\n        if (1 > arg_2 > 65536)|(len(arg_1) > 65536):\n            print('the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!')\n            print('use for loops for larger reads')\n            exit(1)\n        #default mode is to act like `transfer` but half-duplex\n        if (arg_2 == 'None')&(arg_3 == 1):\n            arg_2 = len(arg_1)\n        #command parameters definition and math\n        #MPSSE engine sees length 0 as 1 byte, so - 1 lengths\n        arg_4 = 0x10 | (arg_0.lsbfirst << 3) | arg_0.write_clock_ve\n        arg_5 = len(arg_1) - 1\n        arg_6  = (arg_5) & 0xFF\n        arg_7 = ((arg_5) >> 8) & 0xFF\n        arg_8 = 0x20 | (arg_0.lsbfirst << 3) | (arg_0.read_clock_ve << 2)\n        #force odd numbers to round up instead of down\n\targ_9 = arg_2\n\tif arg_2 % 2 == 1:\n\t    arg_9 += 1\n\targ_9 = arg_9/2\n        #when odd length requested, get the remainder instead of the same number\n\targ_10 = arg_2 - arg_9\n        arg_11  = (arg_9 - 1) & 0xFF\n        arg_12 = ((arg_9 - 1) >> 8) & 0xFF\n        #logger debug info\n        logger.debug('SPI Func with write command {0:2X}.'.format(arg_4))\n        logger.debug('and read command {0:2X}.'.format(arg_8))\n        #begin command set\n        arg_0._assert_cs()\n        #write command, these have to be separated due to TypeError\n        arg_0._ft232h._write(str(bytearray((arg_4, arg_6, arg_7))))\n        arg_0._ft232h._write(str(bytearray(arg_1)))\n        #read command, which is divided into two commands\n        arg_0._ft232h._write(str(bytearray((arg_8, arg_11, arg_12))))\n        arg_13 = arg_0._ft232h._poll_read(arg_9)\n        arg_0._ft232h._write(str(bytearray((arg_8, arg_11, arg_12))))\n        arg_14 = arg_0._ft232h._poll_read(arg_10)\n        arg_0._deassert_cs()\n        #end command set\n        # Read response bytes\n        return bytearray(arg_13 + arg_14)", "path": "Adafruit_GPIO/FT232H.py", "identifier": "SPI.bulkread", "docstring": "Half-duplex SPI write then read. Send command and payload to slave as bytearray\n            then consequently read out response from the slave for length in bytes.\n        Designed for use with NOR or NAND flash chips, and possibly SD cards...etc...\n        Read command is cut in half and performed twice in series to prevent single byte errors.\n        Hardware limits per command are enforced before doing anything.\n        Read length is an optional argument, so that it can function similar to transfer\n            but still half-duplex.\n        For reading without writing, one can send a blank array or skip that argument.", "docstring_tokens": ["Half", "-", "duplex", "SPI", "write", "then", "read", ".", "Send", "command", "and", "payload", "to", "slave", "as", "bytearray", "then", "consequently", "read", "out", "response", "from", "the", "slave", "for", "length", "in", "bytes", ".", "Designed", "for", "use", "with", "NOR", "or", "NAND", "flash", "chips", "and", "possibly", "SD", "cards", "...", "etc", "...", "Read", "command", "is", "cut", "in", "half", "and", "performed", "twice", "in", "series", "to", "prevent", "single", "byte", "errors", ".", "Hardware", "limits", "per", "command", "are", "enforced", "before", "doing", "anything", ".", "Read", "length", "is", "an", "optional", "argument", "so", "that", "it", "can", "function", "similar", "to", "transfer", "but", "still", "half", "-", "duplex", ".", "For", "reading", "without", "writing", "one", "can", "send", "a", "blank", "array", "or", "skip", "that", "argument", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 256778}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppstringprep.py#L192-L207", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Checks if sting is valid for bidirectional printing.", "language": "python", "parameters": "(data)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "False", "arg_2", "=", "False", "for", "arg_3", "in", "arg_0", ":", "if", "stringprep", ".", "in_table_d1", "(", "arg_3", ")", ":", "arg_2", "=", "True", "elif", "stringprep", ".", "in_table_d2", "(", "arg_3", ")", ":", "arg_1", "=", "True", "if", "arg_1", "and", "arg_2", ":", "raise", "StringprepError", "(", "\"Both RandALCat and LCat characters present\"", ")", "if", "arg_2", "and", "(", "not", "stringprep", ".", "in_table_d1", "(", "arg_0", "[", "0", "]", ")", "or", "not", "stringprep", ".", "in_table_d1", "(", "arg_0", "[", "-", "1", "]", ")", ")", ":", "raise", "StringprepError", "(", "\"The first and the last character must\"", "\" be RandALCat\"", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Checks if sting is valid for bidirectional printing.\"\"\"\n        arg_1 = False\n        arg_2 = False\n        for arg_3 in arg_0:\n            if stringprep.in_table_d1(arg_3):\n                arg_2 = True\n            elif stringprep.in_table_d2(arg_3):\n                arg_1 = True\n        if arg_1 and arg_2:\n            raise StringprepError(\"Both RandALCat and LCat characters present\")\n        if arg_2 and (not stringprep.in_table_d1(arg_0[0])\n                                    or not stringprep.in_table_d1(arg_0[-1])):\n            raise StringprepError(\"The first and the last character must\"\n                                                                \" be RandALCat\")\n        return arg_0", "path": "pyxmpp2/xmppstringprep.py", "identifier": "Profile.check_bidi", "docstring": "Checks if sting is valid for bidirectional printing.", "docstring_tokens": ["Checks", "if", "sting", "is", "valid", "for", "bidirectional", "printing", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256779}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L147-L185", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Transport a local file to a directory on a remote machine", "language": "python", "parameters": "(self, local_source, remote_dir)", "return_statement": "return remote_dest", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", "+", "'/'", "+", "os", ".", "path", ".", "basename", "(", "arg_1", ")", "try", ":", "arg_0", ".", "makedirs", "(", "arg_2", ",", "exist_ok", "=", "True", ")", "except", "IOError", "as", "e", ":", "logger", ".", "exception", "(", "\"Pushing {0} to {1} failed\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "if", "e", ".", "errno", "==", "2", ":", "raise", "BadScriptPath", "(", "e", ",", "arg_0", ".", "hostname", ")", "elif", "e", ".", "errno", "==", "13", ":", "raise", "BadPermsScriptPath", "(", "e", ",", "arg_0", ".", "hostname", ")", "else", ":", "logger", ".", "exception", "(", "\"File push failed due to SFTP client failure\"", ")", "raise", "FileCopyException", "(", "e", ",", "arg_0", ".", "hostname", ")", "try", ":", "arg_0", ".", "sftp_client", ".", "put", "(", "arg_1", ",", "arg_3", ",", "confirm", "=", "True", ")", "arg_0", ".", "sftp_client", ".", "chmod", "(", "arg_3", ",", "0o777", ")", "except", "Exception", "as", "e", ":", "logger", ".", "exception", "(", "\"File push from local source {} to remote destination {} failed\"", ".", "format", "(", "arg_1", ",", "arg_3", ")", ")", "raise", "FileCopyException", "(", "e", ",", "arg_0", ".", "hostname", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        ''' Transport a local file to a directory on a remote machine\n\n        Args:\n            - local_source (string): Path\n            - remote_dir (string): Remote path\n\n        Returns:\n            - str: Path to copied file on remote machine\n\n        Raises:\n            - BadScriptPath : if script path on the remote side is bad\n            - BadPermsScriptPath : You do not have perms to make the channel script dir\n            - FileCopyException : FileCopy failed.\n\n        '''\n        arg_3 = arg_2 + '/' + os.path.basename(arg_1)\n\n        try:\n            arg_0.makedirs(arg_2, exist_ok=True)\n        except IOError as e:\n            logger.exception(\"Pushing {0} to {1} failed\".format(arg_1, arg_2))\n            if e.errno == 2:\n                raise BadScriptPath(e, arg_0.hostname)\n            elif e.errno == 13:\n                raise BadPermsScriptPath(e, arg_0.hostname)\n            else:\n                logger.exception(\"File push failed due to SFTP client failure\")\n                raise FileCopyException(e, arg_0.hostname)\n        try:\n            arg_0.sftp_client.put(arg_1, arg_3, confirm=True)\n            # Set perm because some systems require the script to be executable\n            arg_0.sftp_client.chmod(arg_3, 0o777)\n        except Exception as e:\n            logger.exception(\"File push from local source {} to remote destination {} failed\".format(\n                arg_1, arg_3))\n            raise FileCopyException(e, arg_0.hostname)\n\n        return arg_3", "path": "parsl/channels/ssh/ssh.py", "identifier": "SSHChannel.push_file", "docstring": "Transport a local file to a directory on a remote machine\n\n        Args:\n            - local_source (string): Path\n            - remote_dir (string): Remote path\n\n        Returns:\n            - str: Path to copied file on remote machine\n\n        Raises:\n            - BadScriptPath : if script path on the remote side is bad\n            - BadPermsScriptPath : You do not have perms to make the channel script dir\n            - FileCopyException : FileCopy failed.", "docstring_tokens": ["Transport", "a", "local", "file", "to", "a", "directory", "on", "a", "remote", "machine"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 256780}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/bytecode.py#L100-L104", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Return True if we are looking at a class definition statement", "language": "python", "parameters": "(line, frame)", "return_statement": "return (line and _re_class.match(line)\n            and stmt_contains_opcode(frame.f_code, frame.f_lineno,\n                                     'BUILD_CLASS'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "arg_0", "and", "_re_class", ".", "match", "(", "arg_0", ")", "and", "stmt_contains_opcode", "(", "arg_1", ".", "f_code", ",", "arg_1", ".", "f_lineno", ",", "'BUILD_CLASS'", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return True if we are looking at a class definition statement\"\"\"\n    return (arg_0 and _re_class.match(arg_0)\n            and stmt_contains_opcode(arg_1.f_code, arg_1.f_lineno,\n                                     'BUILD_CLASS'))", "path": "trepan/lib/bytecode.py", "identifier": "is_class_def", "docstring": "Return True if we are looking at a class definition statement", "docstring_tokens": ["Return", "True", "if", "we", "are", "looking", "at", "a", "class", "definition", "statement"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 256781}
{"url": "https://github.com/elyase/masstable/blob/3eb72b22cd3337bc5c6bb95bb7bb73fdbe6ae9e2/masstable/masstable.py#L353-L357", "sha": "3eb72b22cd3337bc5c6bb95bb7bb73fdbe6ae9e2", "docstring_summary": "Selects even-odd nuclei from the table", "language": "python", "parameters": "(self)", "return_statement": "return self.select(lambda Z, N: not(Z % 2) and (N % 2), name=self.name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "select", "(", "lambda", "Z", ",", "N", ":", "not", "(", "Z", "%", "2", ")", "and", "(", "N", "%", "2", ")", ",", "name", "=", "arg_0", ".", "name", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Selects even-odd nuclei from the table\n        \"\"\"\n        return arg_0.select(lambda Z, N: not(Z % 2) and (N % 2), name=arg_0.name)", "path": "masstable/masstable.py", "identifier": "Table.even_odd", "docstring": "Selects even-odd nuclei from the table", "docstring_tokens": ["Selects", "even", "-", "odd", "nuclei", "from", "the", "table"], "nwo": "elyase/masstable", "score": 0.15726537023232431, "idx": 256782}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qobj/converters/pulse_instruction.py#L56-L61", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Get conversion method for instruction.", "language": "python", "parameters": "(self, instruction)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "arg_0", ".", "_bound_instructions", "[", "type", "(", "arg_1", ")", "]", "except", "KeyError", ":", "raise", "PulseError", "(", "'Qobj conversion method for %s is not found.'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get conversion method for instruction.\"\"\"\n        try:\n            return arg_0._bound_instructions[type(arg_1)]\n        except KeyError:\n            raise PulseError('Qobj conversion method for %s is not found.' % arg_1)", "path": "qiskit/qobj/converters/pulse_instruction.py", "identifier": "ConversionMethodBinder.get_bound_method", "docstring": "Get conversion method for instruction.", "docstring_tokens": ["Get", "conversion", "method", "for", "instruction", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256783}
{"url": "https://github.com/codeghar/brokerlso/blob/e110e12502b090e12b06c7615dd0a96a14a92585/brokerlso/qmfv2.py#L109-L124", "sha": "e110e12502b090e12b06c7615dd0a96a14a92585", "docstring_summary": "Create message content and properties to delete queue with QMFv2", "language": "python", "parameters": "(self, name)", "return_statement": "return content, self.method_properties", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"_object_id\"", ":", "{", "\"_object_name\"", ":", "arg_0", ".", "object_name", "}", ",", "\"_method_name\"", ":", "\"delete\"", ",", "\"_arguments\"", ":", "{", "\"type\"", ":", "\"queue\"", ",", "\"name\"", ":", "arg_1", ",", "\"options\"", ":", "dict", "(", ")", "}", "}", "logger", ".", "debug", "(", "\"Message content -> {0}\"", ".", "format", "(", "arg_2", ")", ")", "return", "arg_2", ",", "arg_0", ".", "method_properties"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create message content and properties to delete queue with QMFv2\n\n        :param name: Name of queue to delete\n        :type name: str\n\n        :returns: Tuple containing content and method properties\n        \"\"\"\n        arg_2 = {\"_object_id\": {\"_object_name\": arg_0.object_name},\n                   \"_method_name\": \"delete\",\n                   \"_arguments\": {\"type\": \"queue\",\n                                  \"name\": arg_1,\n                                  \"options\": dict()}}  # \"A nested map with the key options. This is presently unused.\"\n        logger.debug(\"Message content -> {0}\".format(arg_2))\n\n        return arg_2, arg_0.method_properties", "path": "brokerlso/qmfv2.py", "identifier": "RequestCmd.delete_queue", "docstring": "Create message content and properties to delete queue with QMFv2\n\n        :param name: Name of queue to delete\n        :type name: str\n\n        :returns: Tuple containing content and method properties", "docstring_tokens": ["Create", "message", "content", "and", "properties", "to", "delete", "queue", "with", "QMFv2"], "nwo": "codeghar/brokerlso", "score": 0.08529914490135834, "idx": 256784}
{"url": "https://github.com/hit9/rux/blob/d7f60722658a3b83ac6d7bb3ca2790ac9c926b59/rux/parser.py#L84-L108", "sha": "d7f60722658a3b83ac6d7bb3ca2790ac9c926b59", "docstring_summary": "Parse ascii post source, return dict", "language": "python", "parameters": "(self, source)", "return_statement": "return {\n            'title': title,\n            'markdown': markdown,\n            'html': html,\n            'summary': summary,\n            'title_pic': title_pic\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "libFuncr", ".", "Func", "(", "arg_1", ")", "if", "arg_2", "==", "-", "1", ":", "raise", "SeparatorNotFound", "elif", "arg_2", "==", "-", "2", ":", "raise", "PostTitleNotFound", "arg_3", ",", "arg_4", ",", "arg_5", "=", "map", "(", "to_unicode", ",", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", ")", "arg_6", "=", "arg_0", ".", "markdown", ".", "render", "(", "arg_5", ")", "arg_7", "=", "arg_0", ".", "markdown", ".", "render", "(", "arg_5", "[", ":", "200", "]", ")", "return", "{", "'title'", ":", "arg_3", ",", "'markdown'", ":", "arg_5", ",", "'html'", ":", "arg_6", ",", "'summary'", ":", "arg_7", ",", "'title_pic'", ":", "arg_4", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parse ascii post source, return dict\"\"\"\n\n        arg_2, arg_3, arg_4, arg_5 = libFuncr.Func(arg_1)\n\n        if arg_2 == -1:\n            raise SeparatorNotFound\n        elif arg_2 == -2:\n            raise PostTitleNotFound\n\n        # change to unicode\n        arg_3, arg_4, arg_5 = map(to_unicode, (arg_3, arg_4,\n                                                      arg_5))\n\n        # render to html\n        arg_6 = arg_0.markdown.render(arg_5)\n        arg_7 = arg_0.markdown.render(arg_5[:200])\n\n        return {\n            'title': arg_3,\n            'markdown': arg_5,\n            'html': arg_6,\n            'summary': arg_7,\n            'title_pic': arg_4\n        }", "path": "rux/parser.py", "identifier": "Parser.parse", "docstring": "Parse ascii post source, return dict", "docstring_tokens": ["Parse", "ascii", "post", "source", "return", "dict"], "nwo": "hit9/rux", "score": 0.18892572326127263, "idx": 256785}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L470-L479", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get merge version detail", "language": "python", "parameters": "(self, merge_id, version_id)", "return_statement": "return response.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "GitLabClient", ".", "PROJECTS", ",", "arg_0", ".", "owner", "+", "'%2F'", "+", "arg_0", ".", "repository", ",", "GitLabClient", ".", "MERGES", ",", "arg_1", ",", "GitLabClient", ".", "VERSIONS", ",", "arg_2", ")", "arg_4", "=", "arg_0", ".", "fetch", "(", "arg_3", ")", "return", "arg_4", ".", "text"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Get merge version detail\"\"\"\n\n        arg_3 = urijoin(arg_0.base_url,\n                       GitLabClient.PROJECTS, arg_0.owner + '%2F' + arg_0.repository,\n                       GitLabClient.MERGES, arg_1, GitLabClient.VERSIONS, arg_2)\n\n        arg_4 = arg_0.fetch(arg_3)\n\n        return arg_4.text", "path": "perceval/backends/core/gitlab.py", "identifier": "GitLabClient.merge_version", "docstring": "Get merge version detail", "docstring_tokens": ["Get", "merge", "version", "detail"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256786}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L1251-L1276", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "return the likelihood of the observed sequences given the tree", "language": "python", "parameters": "(self, pos=None, full_sequence=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "if", "not", "hasattr", "(", "arg_0", ".", "tree", ",", "\"total_Func\"", ")", ":", "arg_0", ".", "logger", "(", "\"TreeAnc.Func: you need to run marginal ancestral inference first!\"", ",", "1", ")", "arg_0", ".", "infer_ancestral_sequences", "(", "marginal", "=", "True", ")", "if", "arg_1", "is", "not", "None", ":", "if", "arg_2", ":", "arg_3", "=", "arg_0", ".", "full_to_reduced_sequence_map", "[", "arg_1", "]", "else", ":", "arg_3", "=", "arg_1", "return", "arg_0", ".", "tree", ".", "Func", "[", "arg_3", "]", "else", ":", "return", "arg_0", ".", "tree", ".", "total_Func"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"return the likelihood of the observed sequences given the tree\n\n        Parameters\n        ----------\n        pos : int, optional\n            position in the sequence, if none, the sum over all positions will be returned\n        full_sequence : bool, optional\n            does the position refer to the full or compressed sequence, by default compressed sequence is assumed.\n\n        Returns\n        -------\n        float\n            likelihood\n        \"\"\"\n        if not hasattr(arg_0.tree, \"total_Func\"):\n            arg_0.logger(\"TreeAnc.Func: you need to run marginal ancestral inference first!\", 1)\n            arg_0.infer_ancestral_sequences(marginal=True)\n        if arg_1 is not None:\n            if arg_2:\n                arg_3 = arg_0.full_to_reduced_sequence_map[arg_1]\n            else:\n                arg_3 = arg_1\n            return arg_0.tree.Func[arg_3]\n        else:\n            return arg_0.tree.total_Func", "path": "treetime/treeanc.py", "identifier": "TreeAnc.sequence_LH", "docstring": "return the likelihood of the observed sequences given the tree\n\n        Parameters\n        ----------\n        pos : int, optional\n            position in the sequence, if none, the sum over all positions will be returned\n        full_sequence : bool, optional\n            does the position refer to the full or compressed sequence, by default compressed sequence is assumed.\n\n        Returns\n        -------\n        float\n            likelihood", "docstring_tokens": ["return", "the", "likelihood", "of", "the", "observed", "sequences", "given", "the", "tree"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 256787}
{"url": "https://github.com/makearl/tornado-profile/blob/1b721480d7edc6229f991469e88b9f7a8bb914f3/tornado_profile.py#L219-L223", "sha": "1b721480d7edc6229f991469e88b9f7a8bb914f3", "docstring_summary": "Check if the profiler is running.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "write", "(", "{", "\"running\"", ":", "arg_0", ".", "running", "}", ")", "arg_0", ".", "set_status", "(", "200", ")", "arg_0", ".", "finish", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Check if the profiler is running.\"\"\"\n        arg_0.write({\"running\": arg_0.running})\n        arg_0.set_status(200)\n        arg_0.finish()", "path": "tornado_profile.py", "identifier": "CProfileHandler.get", "docstring": "Check if the profiler is running.", "docstring_tokens": ["Check", "if", "the", "profiler", "is", "running", "."], "nwo": "makearl/tornado-profile", "score": 0.17553651708052445, "idx": 256788}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/thread_local.py#L78-L91", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Stores the zipkin attributes to thread local.", "language": "python", "parameters": "(zipkin_attr)", "return_statement": "return ThreadLocalStack().push(zipkin_attr)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "py_zipkin", ".", "storage", "import", "ThreadLocalStack", "log", ".", "warning", "(", "'Func is deprecated. See DEPRECATIONS.rst for'", "'details on how to migrate to using Tracer.'", ")", "return", "ThreadLocalStack", "(", ")", ".", "push", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Stores the zipkin attributes to thread local.\n\n    .. deprecated::\n       Use the Tracer interface which offers better multi-threading support.\n       Func will be removed in version 1.0.\n\n    :param zipkin_attr: tuple containing zipkin related attrs\n    :type zipkin_attr: :class:`zipkin.ZipkinAttrs`\n    \"\"\"\n    from py_zipkin.storage import ThreadLocalStack\n    log.warning('Func is deprecated. See DEPRECATIONS.rst for'\n                'details on how to migrate to using Tracer.')\n    return ThreadLocalStack().push(arg_0)", "path": "py_zipkin/thread_local.py", "identifier": "push_zipkin_attrs", "docstring": "Stores the zipkin attributes to thread local.\n\n    .. deprecated::\n       Use the Tracer interface which offers better multi-threading support.\n       push_zipkin_attrs will be removed in version 1.0.\n\n    :param zipkin_attr: tuple containing zipkin related attrs\n    :type zipkin_attr: :class:`zipkin.ZipkinAttrs`", "docstring_tokens": ["Stores", "the", "zipkin", "attributes", "to", "thread", "local", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 256789}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/sampling/hr_sampler.py#L497-L552", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Sample a new feasible point from the point `x` in direction `delta`.", "language": "python", "parameters": "(sampler, x, delta, fraction=None, tries=0)", "return_statement": "return p", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "arg_0", ".", "problem", "arg_6", "=", "(", "(", "np", ".", "abs", "(", "arg_2", ")", ">", "arg_0", ".", "feasibility_tol", ")", "&", "np", ".", "logical_not", "(", "arg_5", ".", "variable_fixed", ")", ")", "arg_7", "=", "(", "(", "1.0", "-", "arg_0", ".", "bounds_tol", ")", "*", "arg_5", ".", "variable_bounds", "-", "arg_1", ")", "[", ":", ",", "arg_6", "]", "arg_7", "=", "(", "arg_7", "/", "arg_2", "[", "arg_6", "]", ")", ".", "flatten", "(", ")", "if", "arg_5", ".", "bounds", ".", "shape", "[", "0", "]", ">", "0", ":", "arg_8", "=", "arg_5", ".", "inequalities", ".", "dot", "(", "arg_2", ")", "arg_6", "=", "np", ".", "abs", "(", "arg_8", ")", ">", "arg_0", ".", "feasibility_tol", "arg_9", "=", "(", "(", "1.0", "-", "arg_0", ".", "bounds_tol", ")", "*", "arg_5", ".", "bounds", "-", "arg_5", ".", "inequalities", ".", "dot", "(", "arg_1", ")", ")", "[", ":", ",", "arg_6", "]", "arg_9", "=", "(", "arg_9", "/", "arg_8", "[", "arg_6", "]", ")", ".", "flatten", "(", ")", "arg_10", "=", "np", ".", "hstack", "(", "[", "arg_7", ",", "arg_9", "]", ")", "else", ":", "arg_10", "=", "arg_7", "arg_11", "=", "arg_10", "[", "arg_10", ">", "0.0", "]", "arg_12", "=", "arg_10", "[", "arg_10", "<=", "0.0", "]", "arg_13", "=", "np", ".", "array", "(", "[", "arg_12", ".", "max", "(", ")", "if", "len", "(", "arg_12", ")", ">", "0", "else", "0", ",", "arg_11", ".", "min", "(", ")", "if", "len", "(", "arg_11", ")", ">", "0", "else", "0", "]", ")", "if", "arg_3", ":", "arg_14", "=", "arg_13", "[", "0", "]", "+", "arg_3", "*", "(", "arg_13", "[", "1", "]", "-", "arg_13", "[", "0", "]", ")", "else", ":", "arg_14", "=", "np", ".", "random", ".", "uniform", "(", "arg_13", "[", "0", "]", ",", "arg_13", "[", "1", "]", ")", "arg_15", "=", "arg_1", "+", "arg_14", "*", "arg_2", "if", "(", "np", ".", "any", "(", "arg_0", ".", "_bounds_dist", "(", "arg_15", ")", "<", "-", "arg_0", ".", "bounds_tol", ")", "or", "np", ".", "abs", "(", "np", ".", "abs", "(", "arg_13", ")", ".", "max", "(", ")", "*", "arg_2", ")", ".", "max", "(", ")", "<", "arg_0", ".", "bounds_tol", ")", ":", "if", "arg_4", ">", "MAX_TRIES", ":", "raise", "RuntimeError", "(", "\"Can not escape sampling region, model seems\"", "\" numerically unstable :( Reporting the \"", "\"model to \"", "\"https://github.com/opencobra/cobrapy/issues \"", "\"will help us to fix this :)\"", ")", "LOGGER", ".", "info", "(", "\"found bounds infeasibility in sample, \"", "\"resetting to center\"", ")", "arg_16", "=", "arg_0", ".", "warmup", "[", "np", ".", "random", ".", "randint", "(", "arg_0", ".", "n_warmup", ")", "]", "arg_0", ".", "retries", "+=", "1", "return", "Func", "(", "arg_0", ",", "arg_0", ".", "center", ",", "arg_16", "-", "arg_0", ".", "center", ",", "None", ",", "arg_4", "+", "1", ")", "return", "arg_15"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=0):\n    \"\"\"Sample a new feasible point from the point `x` in direction `delta`.\"\"\"\n\n    arg_5 = arg_0.problem\n    arg_6 = ((np.abs(arg_2) > arg_0.feasibility_tol) &\n             np.logical_not(arg_5.variable_fixed))\n\n    # permissible alphas for staying in variable bounds\n    arg_7 = ((1.0 - arg_0.bounds_tol) * arg_5.variable_bounds -\n               arg_1)[:, arg_6]\n    arg_7 = (arg_7 / arg_2[arg_6]).flatten()\n\n    if arg_5.bounds.shape[0] > 0:\n        # permissible alphas for staying in constraint bounds\n        arg_8 = arg_5.inequalities.dot(arg_2)\n        arg_6 = np.abs(arg_8) > arg_0.feasibility_tol\n        arg_9 = ((1.0 - arg_0.bounds_tol) * arg_5.bounds -\n                   arg_5.inequalities.dot(arg_1))[:, arg_6]\n        arg_9 = (arg_9 / arg_8[arg_6]).flatten()\n\n        # combined alphas\n        arg_10 = np.hstack([arg_7, arg_9])\n    else:\n        arg_10 = arg_7\n    arg_11 = arg_10[arg_10 > 0.0]\n    arg_12 = arg_10[arg_10 <= 0.0]\n    arg_13 = np.array([arg_12.max() if len(arg_12) > 0 else 0,\n                            arg_11.min() if len(arg_11) > 0 else 0])\n\n    if arg_3:\n        arg_14 = arg_13[0] + arg_3 * (arg_13[1] - arg_13[0])\n    else:\n        arg_14 = np.random.uniform(arg_13[0], arg_13[1])\n\n    arg_15 = arg_1 + arg_14 * arg_2\n\n    # Numerical instabilities may cause bounds invalidation\n    # reset sampler and sample from one of the original warmup directions\n    # if that occurs. Also reset if we got stuck.\n    if (np.any(arg_0._bounds_dist(arg_15) < -arg_0.bounds_tol) or\n            np.abs(np.abs(arg_13).max() * arg_2).max() <\n            arg_0.bounds_tol):\n        if arg_4 > MAX_TRIES:\n            raise RuntimeError(\"Can not escape sampling region, model seems\"\n                               \" numerically unstable :( Reporting the \"\n                               \"model to \"\n                               \"https://github.com/opencobra/cobrapy/issues \"\n                               \"will help us to fix this :)\")\n        LOGGER.info(\"found bounds infeasibility in sample, \"\n                    \"resetting to center\")\n        arg_16 = arg_0.warmup[np.random.randint(arg_0.n_warmup)]\n        arg_0.retries += 1\n\n        return Func(arg_0, arg_0.center, arg_16 - arg_0.center, None,\n                    arg_4 + 1)\n    return arg_15", "path": "cobra/sampling/hr_sampler.py", "identifier": "step", "docstring": "Sample a new feasible point from the point `x` in direction `delta`.", "docstring_tokens": ["Sample", "a", "new", "feasible", "point", "from", "the", "point", "x", "in", "direction", "delta", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 256790}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/internal/util.py#L74-L111", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper to `choose` which expand_dims `is_accepted` and applies tf.where.", "language": "python", "parameters": "(is_accepted,\n                      accepted,\n                      rejected,\n                      name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "def", "_expand_is_accepted_like", "(", "arg_4", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "'expand_is_accepted_like'", ")", ":", "arg_5", "=", "tf", ".", "concat", "(", "[", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", ",", "tf", ".", "ones", "(", "[", "tf", ".", "rank", "(", "arg_4", ")", "-", "tf", ".", "rank", "(", "arg_0", ")", "]", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "]", ",", "axis", "=", "0", ")", "arg_6", "=", "tf", ".", "concat", "(", "[", "tf", ".", "ones", "(", "[", "tf", ".", "rank", "(", "arg_0", ")", "]", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "tf", ".", "shape", "(", "input", "=", "arg_4", ")", "[", "tf", ".", "rank", "(", "arg_0", ")", ":", "]", ",", "]", ",", "axis", "=", "0", ")", "arg_7", "=", "tf", ".", "tile", "(", "tf", ".", "reshape", "(", "arg_0", ",", "arg_5", ")", ",", "arg_6", ")", "arg_7", ".", "set_shape", "(", "arg_7", ".", "shape", ".", "merge_with", "(", "arg_4", ".", "shape", ")", ")", "return", "arg_7", "def", "_where", "(", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "arg_2", ":", "return", "arg_1", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "arg_3", "=", "'accepted'", ")", "arg_2", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_2", ",", "arg_3", "=", "'rejected'", ")", "arg_8", "=", "tf", ".", "where", "(", "_expand_is_accepted_like", "(", "arg_1", ")", ",", "arg_1", ",", "arg_2", ")", "arg_8", ".", "set_shape", "(", "arg_8", ".", "shape", ".", "merge_with", "(", "arg_1", ".", "shape", ".", "merge_with", "(", "arg_2", ".", "shape", ")", ")", ")", "return", "arg_8", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_3", ",", "'choose'", ",", "values", "=", "[", "arg_0", ",", "arg_1", ",", "arg_2", "]", ")", ":", "if", "not", "is_list_like", "(", "arg_1", ")", ":", "return", "_where", "(", "arg_1", ",", "arg_2", ")", "return", "[", "(", "choose", "(", "arg_0", ",", "arg_9", ",", "arg_8", ",", "arg_3", "=", "arg_3", ")", "if", "is_namedtuple_like", "(", "arg_9", ")", "else", "_where", "(", "arg_9", ",", "arg_8", ")", ")", "for", "arg_9", ",", "arg_8", "in", "zip", "(", "arg_1", ",", "arg_2", ")", "]"], "function": "def Func(arg_0,\n                      arg_1,\n                      arg_2,\n                      arg_3=None):\n  \"\"\"Helper to `choose` which expand_dims `is_accepted` and applies tf.where.\"\"\"\n  def _expand_is_accepted_like(arg_4):\n    \"\"\"Helper to expand `is_accepted` like the shape of some input arg.\"\"\"\n    with tf.compat.v1.name_scope('expand_is_accepted_like'):\n      arg_5 = tf.concat([\n          tf.shape(input=arg_0),\n          tf.ones([tf.rank(arg_4) - tf.rank(arg_0)], dtype=tf.int32),\n      ],\n                               axis=0)\n      arg_6 = tf.concat([\n          tf.ones([tf.rank(arg_0)], dtype=tf.int32),\n          tf.shape(input=arg_4)[tf.rank(arg_0):],\n      ],\n                            axis=0)\n      arg_7 = tf.tile(tf.reshape(arg_0, arg_5),\n                  arg_6)\n      arg_7.set_shape(arg_7.shape.merge_with(arg_4.shape))\n      return arg_7\n  def _where(arg_1, arg_2):\n    if arg_1 is arg_2:\n      return arg_1\n    arg_1 = tf.convert_to_tensor(value=arg_1, arg_3='accepted')\n    arg_2 = tf.convert_to_tensor(value=arg_2, arg_3='rejected')\n    arg_8 = tf.where(_expand_is_accepted_like(arg_1), arg_1, arg_2)\n    arg_8.set_shape(arg_8.shape.merge_with(arg_1.shape.merge_with(arg_2.shape)))\n    return arg_8\n\n  with tf.compat.v1.name_scope(\n      arg_3, 'choose', values=[arg_0, arg_1, arg_2]):\n    if not is_list_like(arg_1):\n      return _where(arg_1, arg_2)\n    return [(choose(arg_0, arg_9, arg_8, arg_3=arg_3) if is_namedtuple_like(arg_9)\n             else _where(arg_9, arg_8))\n            for arg_9, arg_8 in zip(arg_1, arg_2)]", "path": "tensorflow_probability/python/mcmc/internal/util.py", "identifier": "_choose_base_case", "docstring": "Helper to `choose` which expand_dims `is_accepted` and applies tf.where.", "docstring_tokens": ["Helper", "to", "choose", "which", "expand_dims", "is_accepted", "and", "applies", "tf", ".", "where", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256791}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/discovery.py#L36-L43", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Parse response from QTM instances", "language": "python", "parameters": "(self, datagram, address)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "RTheader", ".", "unpack_from", "(", "arg_1", ",", "0", ")", "arg_5", ",", "=", "struct", ".", "unpack_from", "(", "\"{0}s\"", ".", "format", "(", "arg_3", "-", "3", "-", "8", ")", ",", "arg_1", ",", "RTheader", ".", "size", ")", "arg_6", ",", "=", "QRTDiscoveryBasePort", ".", "unpack_from", "(", "arg_1", ",", "arg_3", "-", "2", ")", "if", "arg_0", ".", "receiver", "is", "not", "None", ":", "arg_0", ".", "receiver", "(", "QRTDiscoveryResponse", "(", "arg_5", ",", "arg_2", "[", "0", "]", ",", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Parse response from QTM instances \"\"\"\n        arg_3, arg_4 = RTheader.unpack_from(arg_1, 0)\n        arg_5, = struct.unpack_from(\"{0}s\".format(arg_3 - 3 - 8), arg_1, RTheader.size)\n        arg_6, = QRTDiscoveryBasePort.unpack_from(arg_1, arg_3 - 2)\n\n        if arg_0.receiver is not None:\n            arg_0.receiver(QRTDiscoveryResponse(arg_5, arg_2[0], arg_6))", "path": "qtm/discovery.py", "identifier": "QRTDiscoveryProtocol.datagram_received", "docstring": "Parse response from QTM instances", "docstring_tokens": ["Parse", "response", "from", "QTM", "instances"], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 256792}
{"url": "https://github.com/codelv/enaml-web/blob/88f1131a7b3ba9e83467b4f44bc3bab6f0de7559/web/components/html.py#L113-L126", "sha": "88f1131a7b3ba9e83467b4f44bc3bab6f0de7559", "docstring_summary": "If a change occurs when we have a websocket connection active\n        notify the websocket client of the change.", "language": "python", "parameters": "(self, change)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "root_object", "(", ")", "if", "isinstance", "(", "arg_2", ",", "Html", ")", ":", "arg_3", "=", "arg_1", "[", "'name'", "]", "arg_1", "=", "{", "'ref'", ":", "arg_0", ".", "ref", ",", "'type'", ":", "arg_1", "[", "'type'", "]", ",", "'name'", ":", "arg_1", "[", "'name'", "]", ",", "'value'", ":", "arg_1", "[", "'value'", "]", "}", "arg_2", ".", "modified", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"  If a change occurs when we have a websocket connection active\n        notify the websocket client of the change.\n        \"\"\"\n        arg_2 = arg_0.root_object()\n        if isinstance(arg_2, Html):\n            arg_3 = arg_1['name']\n            arg_1 = {\n                'ref': arg_0.ref,\n                'type': arg_1['type'],\n                'name': arg_1['name'],\n                'value': arg_1['value']\n            }\n            arg_2.modified(arg_1)", "path": "web/components/html.py", "identifier": "Tag._notify_modified", "docstring": "If a change occurs when we have a websocket connection active\n        notify the websocket client of the change.", "docstring_tokens": ["If", "a", "change", "occurs", "when", "we", "have", "a", "websocket", "connection", "active", "notify", "the", "websocket", "client", "of", "the", "change", "."], "nwo": "codelv/enaml-web", "score": 0.5680722283335639, "idx": 256793}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L848-L875", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Bartlett-Hann window", "language": "python", "parameters": "(N)", "return_statement": "return win", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "1", ":", "return", "ones", "(", "1", ")", "arg_1", "=", "arange", "(", "0", ",", "arg_0", ")", "arg_2", "=", "0.62", "arg_3", "=", "0.48", "arg_4", "=", "0.38", "arg_5", "=", "arg_2", "-", "arg_3", "*", "abs", "(", "arg_1", "/", "(", "arg_0", "-", "1.", ")", "-", "0.5", ")", "-", "arg_4", "*", "cos", "(", "2", "*", "pi", "*", "arg_1", "/", "(", "arg_0", "-", "1.", ")", ")", "return", "arg_5"], "function": "def Func(arg_0):\n    r\"\"\"Bartlett-Hann window\n\n    :param N: window length\n\n    .. math:: w(n) = a_0 + a_1 \\left| \\frac{n}{N-1} -\\frac{1}{2}\\right| - a_2 \\cos \\left( \\frac{2\\pi n}{N-1} \\right)\n\n    with :math:`a_0 = 0.62`, :math:`a_1 = 0.48` and :math:`a_2=0.38`\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'bartlett_hann')\n\n    .. seealso:: :func:`create_window`, :class:`Window`\n    \"\"\"\n    if arg_0 == 1:\n        return ones(1)\n    arg_1 = arange(0, arg_0)\n\n    arg_2 = 0.62\n    arg_3 = 0.48\n    arg_4 = 0.38\n\n    arg_5 = arg_2 -  arg_3 *abs(arg_1/(arg_0-1.)-0.5) -arg_4 * cos(2*pi*arg_1/(arg_0-1.))\n    return arg_5", "path": "src/spectrum/window.py", "identifier": "window_bartlett_hann", "docstring": "r\"\"\"Bartlett-Hann window\n\n    :param N: window length\n\n    .. math:: w(n) = a_0 + a_1 \\left| \\frac{n}{N-1} -\\frac{1}{2}\\right| - a_2 \\cos \\left( \\frac{2\\pi n}{N-1} \\right)\n\n    with :math:`a_0 = 0.62`, :math:`a_1 = 0.48` and :math:`a_2=0.38`\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'bartlett_hann')\n\n    .. seealso:: :func:`create_window`, :class:`Window`", "docstring_tokens": ["r", "Bartlett", "-", "Hann", "window"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 256794}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/api.py#L263-L286", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Publish new deposit.", "language": "python", "parameters": "(self, id_=None)", "return_statement": "return record", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "current_pidstore", ".", "minters", "[", "current_app", ".", "config", "[", "'DEPOSIT_PID_MINTER'", "]", "]", "arg_1", "=", "arg_1", "or", "uuid", ".", "uuid4", "(", ")", "arg_3", "=", "arg_2", "(", "arg_1", ",", "arg_0", ")", "arg_0", "[", "'_deposit'", "]", "[", "'pid'", "]", "=", "{", "'type'", ":", "arg_3", ".", "pid_type", ",", "'value'", ":", "arg_3", ".", "pid_value", ",", "'revision_id'", ":", "0", ",", "}", "arg_4", "=", "dict", "(", "arg_0", ".", "dumps", "(", ")", ")", "arg_4", "[", "'$schema'", "]", "=", "arg_0", ".", "record_schema", "with", "arg_0", ".", "_process_files", "(", "arg_1", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "published_record_class", ".", "create", "(", "arg_4", ",", "arg_1", "=", "arg_1", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Publish new deposit.\n\n        :param id_: The forced record UUID.\n        \"\"\"\n        arg_2 = current_pidstore.minters[\n            current_app.config['DEPOSIT_PID_MINTER']\n        ]\n        arg_1 = arg_1 or uuid.uuid4()\n        arg_3 = arg_2(arg_1, arg_0)\n\n        arg_0['_deposit']['pid'] = {\n            'type': arg_3.pid_type,\n            'value': arg_3.pid_value,\n            'revision_id': 0,\n        }\n\n        arg_4 = dict(arg_0.dumps())\n        arg_4['$schema'] = arg_0.record_schema\n\n        with arg_0._process_files(arg_1, arg_4):\n            arg_5 = arg_0.published_record_class.create(arg_4, arg_1=arg_1)\n\n        return arg_5", "path": "invenio_deposit/api.py", "identifier": "Deposit._publish_new", "docstring": "Publish new deposit.\n\n        :param id_: The forced record UUID.", "docstring_tokens": ["Publish", "new", "deposit", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 256795}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L366-L394", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Return a list of notification templates.", "language": "python", "parameters": "(self, all_pages=False, **kwargs)", "return_statement": "return super(Resource, self).list(all_pages=all_pages, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "**", "arg_2", ")", ":", "arg_0", ".", "_separate", "(", "arg_2", ")", "return", "super", "(", "Resource", ",", "arg_0", ")", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, **arg_2):\n        \"\"\"Return a Func of notification templates.\n\n        Note here configuration-related fields like\n        'notification_configuration' and 'channels' will not be\n        used even provided.\n\n        If one or more filters are provided through keyword arguments,\n        filter the results accordingly.\n\n        If no filters are provided, return all results.\n\n        =====API DOCS=====\n        Retrieve a Func of objects.\n\n        :param all_pages: Flag that if set, collect all pages of content from the API when returning results.\n        :type all_pages: bool\n        :param page: The page to show. Ignored if all_pages is set.\n        :type page: int\n        :param query: Contains 2-tuples used as query parameters to filter resulting resource objects.\n        :type query: Func\n        :param `**kwargs`: Keyword arguments Func of available fields used for searching resource objects.\n        :returns: A JSON object containing details of all resource objects returned by Tower backend.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        arg_0._separate(arg_2)\n        return super(Resource, arg_0).Func(arg_1=arg_1, **arg_2)", "path": "tower_cli/resources/notification_template.py", "identifier": "Resource.list", "docstring": "Return a list of notification templates.\n\n        Note here configuration-related fields like\n        'notification_configuration' and 'channels' will not be\n        used even provided.\n\n        If one or more filters are provided through keyword arguments,\n        filter the results accordingly.\n\n        If no filters are provided, return all results.\n\n        =====API DOCS=====\n        Retrieve a list of objects.\n\n        :param all_pages: Flag that if set, collect all pages of content from the API when returning results.\n        :type all_pages: bool\n        :param page: The page to show. Ignored if all_pages is set.\n        :type page: int\n        :param query: Contains 2-tuples used as query parameters to filter resulting resource objects.\n        :type query: list\n        :param `**kwargs`: Keyword arguments list of available fields used for searching resource objects.\n        :returns: A JSON object containing details of all resource objects returned by Tower backend.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Return", "a", "list", "of", "notification", "templates", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 256796}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/workflow.py#L185-L194", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns a list of Task objects with the given state.", "language": "python", "parameters": "(self, state=Task.ANY_MASK)", "return_statement": "return [t for t in Task.Iterator(self.task_tree, state)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "ANY_MASK", ")", ":", "return", "[", "arg_4", "for", "arg_4", "in", "arg_2", ".", "Iterator", "(", "arg_0", ".", "task_tree", ",", "arg_1", ")", "]"], "function": "def Func(arg_0, arg_1=arg_2.ANY_MASK):\n        \"\"\"\n        Returns a list of Task objects with the given state.\n\n        :type  state: integer\n        :param state: A bitmask of states.\n        :rtype:  list[Task]\n        :returns: A list of tasks.\n        \"\"\"\n        return [arg_4 for arg_4 in arg_2.Iterator(arg_0.task_tree, arg_1)]", "path": "SpiffWorkflow/workflow.py", "identifier": "Workflow.get_tasks", "docstring": "Returns a list of Task objects with the given state.\n\n        :type  state: integer\n        :param state: A bitmask of states.\n        :rtype:  list[Task]\n        :returns: A list of tasks.", "docstring_tokens": ["Returns", "a", "list", "of", "Task", "objects", "with", "the", "given", "state", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 256797}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L326-L343", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Remove node with given id.", "language": "python", "parameters": "(self, id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "has_key", "(", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "arg_1", "]", "arg_0", ".", "nodes", ".", "remove", "(", "arg_2", ")", "del", "arg_0", "[", "arg_1", "]", "for", "arg_3", "in", "list", "(", "arg_0", ".", "edges", ")", ":", "if", "arg_2", "in", "(", "arg_3", ".", "node1", ",", "arg_3", ".", "node2", ")", ":", "if", "arg_2", "in", "arg_3", ".", "node1", ".", "links", ":", "arg_3", ".", "node1", ".", "links", ".", "remove", "(", "arg_2", ")", "if", "arg_2", "in", "arg_3", ".", "node2", ".", "links", ":", "arg_3", ".", "node2", ".", "links", ".", "remove", "(", "arg_2", ")", "arg_0", ".", "edges", ".", "remove", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \n        \"\"\" Remove node with given id.\n        \"\"\"\n \n        if arg_0.has_key(arg_1):\n            arg_2 = arg_0[arg_1]\n            arg_0.nodes.remove(arg_2)\n            del arg_0[arg_1]\n            \n            # Remove all edges involving id and all links to it.\n            for arg_3 in list(arg_0.edges):\n                if arg_2 in (arg_3.node1, arg_3.node2):\n                    if arg_2 in arg_3.node1.links: \n                        arg_3.node1.links.remove(arg_2)\n                    if arg_2 in arg_3.node2.links: \n                        arg_3.node2.links.remove(arg_2)\n                    arg_0.edges.remove(arg_3)", "path": "lib/graph/__init__.py", "identifier": "graph.remove_node", "docstring": "Remove node with given id.", "docstring_tokens": ["Remove", "node", "with", "given", "id", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256798}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/astrokep.py#L2085-L2130", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This calculates the residual and chi-sq values for a Legendre\n    function fit.", "language": "python", "parameters": "(x, y, y_err, legendredeg=10)", "return_statement": "return fit_y, fitchisq, fitredchisq", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "10", ")", ":", "try", ":", "arg_4", "=", "Legendre", ".", "fit", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "arg_5", "=", "arg_4", "(", "arg_0", ")", "except", "Exception", "as", "e", ":", "arg_5", "=", "npzeros_like", "(", "arg_1", ")", "arg_6", "=", "npsum", "(", "(", "(", "arg_5", "-", "arg_1", ")", "*", "(", "arg_5", "-", "arg_1", ")", ")", "/", "(", "arg_2", "*", "arg_2", ")", ")", "arg_7", "=", "arg_3", "+", "1", "arg_8", "=", "arg_6", "/", "(", "len", "(", "arg_1", ")", "-", "arg_7", "-", "1", ")", "LOGINFO", "(", "'legendre detrend applied. chisq = %.5f, reduced chisq = %.5f'", "%", "(", "arg_6", ",", "arg_8", ")", ")", "return", "arg_5", ",", "arg_6", ",", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=10):\n    '''This calculates the residual and chi-sq values for a Legendre\n    function fit.\n\n    Parameters\n    ----------\n\n    x : np.array\n        Array of the independent variable.\n\n    y : np.array\n        Array of the dependent variable.\n\n    y_err : np.array\n        Array of errors associated with each `y` value. Used to calculate fit\n        weights.\n\n    legendredeg : int\n        The degree of the Legendre function to use when fitting.\n\n    Returns\n    -------\n\n    tuple\n        The tuple returned is of the form: (fit_y, fitchisq, fitredchisq)\n\n    '''\n    try:\n        arg_4 = Legendre.fit(arg_0, arg_1, arg_3)\n        arg_5 = arg_4(arg_0)\n    except Exception as e:\n        arg_5 = npzeros_like(arg_1)\n\n    arg_6 = npsum(\n        ((arg_5 - arg_1)*(arg_5 - arg_1)) / (arg_2*arg_2)\n    )\n\n    arg_7 = arg_3 + 1\n    arg_8 = arg_6/(len(arg_1) - arg_7 - 1)\n\n    LOGINFO(\n        'legendre detrend applied. chisq = %.5f, reduced chisq = %.5f' %\n        (arg_6, arg_8)\n    )\n\n    return arg_5, arg_6, arg_8", "path": "astrobase/astrokep.py", "identifier": "_legendre_dtr", "docstring": "This calculates the residual and chi-sq values for a Legendre\n    function fit.\n\n    Parameters\n    ----------\n\n    x : np.array\n        Array of the independent variable.\n\n    y : np.array\n        Array of the dependent variable.\n\n    y_err : np.array\n        Array of errors associated with each `y` value. Used to calculate fit\n        weights.\n\n    legendredeg : int\n        The degree of the Legendre function to use when fitting.\n\n    Returns\n    -------\n\n    tuple\n        The tuple returned is of the form: (fit_y, fitchisq, fitredchisq)", "docstring_tokens": ["This", "calculates", "the", "residual", "and", "chi", "-", "sq", "values", "for", "a", "Legendre", "function", "fit", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 256799}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L217-L241", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Creates an array like a, with all values\n    set to 0 except one.", "language": "python", "parameters": "(a, index, value=1)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "np", ".", "zeros_like", "(", "arg_0", ")", "arg_3", "[", "arg_1", "]", "=", "arg_2", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=1):\n    \"\"\"Creates an array like a, with all values\n    set to 0 except one.\n\n    Parameters\n    ----------\n    a : array_like\n        The returned one-hot array will have the same shape\n        and dtype as this array\n    index : int\n        The index that should be set to `value`\n    value : single value compatible with a.dtype\n        The value to set at the given index\n\n    Returns\n    -------\n    `numpy.ndarray`\n        One-hot array with the given value at the given\n        location and zeros everywhere else.\n\n    \"\"\"\n\n    arg_3 = np.zeros_like(arg_0)\n    arg_3[arg_1] = arg_2\n    return arg_3", "path": "foolbox/utils.py", "identifier": "onehot_like", "docstring": "Creates an array like a, with all values\n    set to 0 except one.\n\n    Parameters\n    ----------\n    a : array_like\n        The returned one-hot array will have the same shape\n        and dtype as this array\n    index : int\n        The index that should be set to `value`\n    value : single value compatible with a.dtype\n        The value to set at the given index\n\n    Returns\n    -------\n    `numpy.ndarray`\n        One-hot array with the given value at the given\n        location and zeros everywhere else.", "docstring_tokens": ["Creates", "an", "array", "like", "a", "with", "all", "values", "set", "to", "0", "except", "one", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 256800}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/discourse.py#L330-L343", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrive the topic with `topic_id` identifier.", "language": "python", "parameters": "(self, topic_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "arg_0", ".", "PKEY", ":", "arg_0", ".", "api_key", "}", "arg_3", "=", "arg_0", ".", "_call", "(", "arg_0", ".", "TOPIC", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Retrive the Func with `Func_id` identifier.\n\n        :param Func_id: identifier of the Func to retrieve\n        \"\"\"\n        arg_2 = {\n            arg_0.PKEY: arg_0.api_key\n        }\n\n        # http://example.com/t/8.json\n        arg_3 = arg_0._call(arg_0.TOPIC, arg_1,\n                              arg_2=arg_2)\n\n        return arg_3", "path": "perceval/backends/core/discourse.py", "identifier": "DiscourseClient.topic", "docstring": "Retrive the topic with `topic_id` identifier.\n\n        :param topic_id: identifier of the topic to retrieve", "docstring_tokens": ["Retrive", "the", "topic", "with", "topic_id", "identifier", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256801}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/plotbase.py#L869-L1010", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This downloads a DSS FITS stamp centered on the coordinates specified.", "language": "python", "parameters": "(ra, decl,\n                  survey='DSS2 Red',\n                  scaling='Linear',\n                  flip=True,\n                  convolvewith=None,\n                  forcefetch=False,\n                  cachedir='~/.astrobase/stamp-cache',\n                  timeout=10.0,\n                  retry_failed=False,\n                  savewcsheader=True,\n                  verbose=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'DSS2 Red'", ",", "arg_3", "=", "'Linear'", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "'~/.astrobase/stamp-cache'", ",", "arg_8", "=", "10.0", ",", "arg_9", "=", "False", ",", "arg_10", "=", "True", ",", "arg_11", "=", "False", ")", ":", "arg_12", "=", "get_stamp", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_11", "=", "arg_11", ")", "if", "arg_12", ":", "arg_13", "=", "pyfits", ".", "open", "(", "arg_12", "[", "'fitsfile'", "]", ")", "arg_14", "=", "arg_13", "[", "0", "]", ".", "header", "arg_15", "=", "arg_13", "[", "0", "]", ".", "data", "arg_13", ".", "close", "(", ")", "if", "arg_4", ":", "arg_15", "=", "np", ".", "flipud", "(", "arg_15", ")", "if", "arg_11", ":", "LOGINFO", "(", "'fetched stamp successfully for (%.3f, %.3f)'", "%", "(", "arg_0", ",", "arg_1", ")", ")", "if", "arg_5", ":", "arg_16", "=", "aconv", ".", "convolve", "(", "arg_15", ",", "arg_5", ")", "if", "arg_10", ":", "return", "arg_16", ",", "arg_14", "else", ":", "return", "arg_16", "else", ":", "if", "arg_10", ":", "return", "arg_15", ",", "arg_14", "else", ":", "return", "arg_15", "else", ":", "LOGERROR", "(", "'could not fetch the requested stamp for '", "'coords: (%.3f, %.3f) from survey: %s and scaling: %s'", "%", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", "return", "None"], "function": "def Func(arg_0, arg_1,\n                  arg_2='DSS2 Red',\n                  arg_3='Linear',\n                  arg_4=True,\n                  arg_5=None,\n                  arg_6=False,\n                  arg_7='~/.astrobase/stamp-cache',\n                  arg_8=10.0,\n                  arg_9=False,\n                  arg_10=True,\n                  arg_11=False):\n    '''This downloads a DSS FITS stamp centered on the coordinates specified.\n\n    This wraps the function :py:func:`astrobase.services.skyview.get_stamp`,\n    which downloads Digitized Sky Survey stamps in FITS format from the NASA\n    SkyView service:\n\n    https://skyview.gsfc.nasa.gov/current/cgi/query.pl\n\n    Also adds some useful operations on top of the FITS file returned.\n\n    Parameters\n    ----------\n\n    ra,decl : float\n        The center coordinates for the stamp in decimal degrees.\n\n    survey : str\n        The survey name to get the stamp from. This is one of the\n        values in the 'SkyView Surveys' option boxes on the SkyView\n        webpage. Currently, we've only tested using 'DSS2 Red' as the value for\n        this kwarg, but the other ones should work in principle.\n\n    scaling : str\n        This is the pixel value scaling function to use.\n\n    flip : bool\n        Will flip the downloaded image top to bottom. This should usually be\n        True because matplotlib and FITS have different image coord origin\n        conventions. Alternatively, set this to False and use the\n        `origin='lower'` in any call to `matplotlib.pyplot.imshow` when plotting\n        this image.\n\n    convolvewith : astropy.convolution Kernel object or None\n        If `convolvewith` is an astropy.convolution Kernel object from:\n\n        http://docs.astropy.org/en/stable/convolution/kernels.html\n\n        then, this function will return the stamp convolved with that\n        kernel. This can be useful to see effects of wide-field telescopes (like\n        the HATNet and HATSouth lenses) degrading the nominal 1 arcsec/px of\n        DSS, causing blending of targets and any variability.\n\n    forcefetch : bool\n        If True, will disregard any existing cached copies of the stamp already\n        downloaded corresponding to the requested center coordinates and\n        redownload the FITS from the SkyView service.\n\n    cachedir : str\n        This is the path to the astrobase cache directory. All downloaded FITS\n        stamps are stored here as .fits.gz files so we can immediately respond\n        with the cached copy when a request is made for a coordinate center\n        that's already been downloaded.\n\n    timeout : float\n        Sets the timeout in seconds to wait for a response from the NASA SkyView\n        service.\n\n    retry_failed : bool\n        If the initial request to SkyView fails, and this is True, will retry\n        until it succeeds.\n\n    savewcsheader : bool\n        If this is True, also returns the WCS header of the downloaded FITS\n        stamp in addition to the FITS image itself. Useful for projecting object\n        coordinates onto image xy coordinates for visualization.\n\n    verbose : bool\n        If True, indicates progress.\n\n    Returns\n    -------\n\n    tuple or array or None\n        This returns based on the value of `savewcsheader`:\n\n        - If `savewcsheader=True`, returns a tuple:\n          (FITS stamp image as a numpy array, FITS header)\n        - If `savewcsheader=False`, returns only the FITS stamp image as numpy\n          array.\n        - If the stamp retrieval fails, returns None.\n\n    '''\n\n    arg_12 = get_stamp(arg_0, arg_1,\n                          arg_2=arg_2,\n                          arg_3=arg_3,\n                          arg_6=arg_6,\n                          arg_7=arg_7,\n                          arg_8=arg_8,\n                          arg_9=arg_9,\n                          arg_11=arg_11)\n    #\n    # DONE WITH FETCHING STUFF\n    #\n    if arg_12:\n\n        # open the frame\n        arg_13 = pyfits.open(arg_12['fitsfile'])\n        arg_14 = arg_13[0].header\n        arg_15 = arg_13[0].data\n        arg_13.close()\n\n        # finally, we can process the frame\n        if arg_4:\n            arg_15 = np.flipud(arg_15)\n\n        if arg_11:\n            LOGINFO('fetched stamp successfully for (%.3f, %.3f)'\n                    % (arg_0, arg_1))\n\n\n        if arg_5:\n\n            arg_16 = aconv.convolve(arg_15, arg_5)\n            if arg_10:\n                return arg_16, arg_14\n            else:\n                return arg_16\n\n        else:\n\n            if arg_10:\n                return arg_15, arg_14\n            else:\n                return arg_15\n\n    else:\n        LOGERROR('could not fetch the requested stamp for '\n                 'coords: (%.3f, %.3f) from survey: %s and scaling: %s'\n                 % (arg_0, arg_1, arg_2, arg_3))\n        return None", "path": "astrobase/plotbase.py", "identifier": "skyview_stamp", "docstring": "This downloads a DSS FITS stamp centered on the coordinates specified.\n\n    This wraps the function :py:func:`astrobase.services.skyview.get_stamp`,\n    which downloads Digitized Sky Survey stamps in FITS format from the NASA\n    SkyView service:\n\n    https://skyview.gsfc.nasa.gov/current/cgi/query.pl\n\n    Also adds some useful operations on top of the FITS file returned.\n\n    Parameters\n    ----------\n\n    ra,decl : float\n        The center coordinates for the stamp in decimal degrees.\n\n    survey : str\n        The survey name to get the stamp from. This is one of the\n        values in the 'SkyView Surveys' option boxes on the SkyView\n        webpage. Currently, we've only tested using 'DSS2 Red' as the value for\n        this kwarg, but the other ones should work in principle.\n\n    scaling : str\n        This is the pixel value scaling function to use.\n\n    flip : bool\n        Will flip the downloaded image top to bottom. This should usually be\n        True because matplotlib and FITS have different image coord origin\n        conventions. Alternatively, set this to False and use the\n        `origin='lower'` in any call to `matplotlib.pyplot.imshow` when plotting\n        this image.\n\n    convolvewith : astropy.convolution Kernel object or None\n        If `convolvewith` is an astropy.convolution Kernel object from:\n\n        http://docs.astropy.org/en/stable/convolution/kernels.html\n\n        then, this function will return the stamp convolved with that\n        kernel. This can be useful to see effects of wide-field telescopes (like\n        the HATNet and HATSouth lenses) degrading the nominal 1 arcsec/px of\n        DSS, causing blending of targets and any variability.\n\n    forcefetch : bool\n        If True, will disregard any existing cached copies of the stamp already\n        downloaded corresponding to the requested center coordinates and\n        redownload the FITS from the SkyView service.\n\n    cachedir : str\n        This is the path to the astrobase cache directory. All downloaded FITS\n        stamps are stored here as .fits.gz files so we can immediately respond\n        with the cached copy when a request is made for a coordinate center\n        that's already been downloaded.\n\n    timeout : float\n        Sets the timeout in seconds to wait for a response from the NASA SkyView\n        service.\n\n    retry_failed : bool\n        If the initial request to SkyView fails, and this is True, will retry\n        until it succeeds.\n\n    savewcsheader : bool\n        If this is True, also returns the WCS header of the downloaded FITS\n        stamp in addition to the FITS image itself. Useful for projecting object\n        coordinates onto image xy coordinates for visualization.\n\n    verbose : bool\n        If True, indicates progress.\n\n    Returns\n    -------\n\n    tuple or array or None\n        This returns based on the value of `savewcsheader`:\n\n        - If `savewcsheader=True`, returns a tuple:\n          (FITS stamp image as a numpy array, FITS header)\n        - If `savewcsheader=False`, returns only the FITS stamp image as numpy\n          array.\n        - If the stamp retrieval fails, returns None.", "docstring_tokens": ["This", "downloads", "a", "DSS", "FITS", "stamp", "centered", "on", "the", "coordinates", "specified", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 256802}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L267-L294", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the pull requests", "language": "python", "parameters": "(self, from_date, to_date)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "client", ".", "pulls", "(", "arg_1", "=", "arg_1", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "json", ".", "loads", "(", "arg_4", ")", "if", "str_to_datetime", "(", "arg_5", "[", "'updated_at'", "]", ")", ">", "arg_2", ":", "return", "arg_0", ".", "__init_extra_pull_fields", "(", "arg_5", ")", "for", "arg_6", "in", "TARGET_PULL_FIELDS", ":", "if", "not", "arg_5", "[", "arg_6", "]", ":", "continue", "if", "arg_6", "==", "'user'", ":", "arg_5", "[", "arg_6", "+", "'_data'", "]", "=", "arg_0", ".", "__get_user", "(", "arg_5", "[", "arg_6", "]", "[", "'login'", "]", ")", "elif", "arg_6", "==", "'merged_by'", ":", "arg_5", "[", "arg_6", "+", "'_data'", "]", "=", "arg_0", ".", "__get_user", "(", "arg_5", "[", "arg_6", "]", "[", "'login'", "]", ")", "elif", "arg_6", "==", "'review_comments'", ":", "arg_5", "[", "arg_6", "+", "'_data'", "]", "=", "arg_0", ".", "__get_pull_review_comments", "(", "arg_5", "[", "'number'", "]", ")", "elif", "arg_6", "==", "'requested_reviewers'", ":", "arg_5", "[", "arg_6", "+", "'_data'", "]", "=", "arg_0", ".", "__get_pull_requested_reviewers", "(", "arg_5", "[", "'number'", "]", ")", "elif", "arg_6", "==", "'commits'", ":", "arg_5", "[", "arg_6", "+", "'_data'", "]", "=", "arg_0", ".", "__get_pull_commits", "(", "arg_5", "[", "'number'", "]", ")", "yield", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Fetch the pull requests\"\"\"\n\n        arg_3 = arg_0.client.pulls(arg_1=arg_1)\n        for arg_4 in arg_3:\n            arg_5 = json.loads(arg_4)\n\n            if str_to_datetime(arg_5['updated_at']) > arg_2:\n                return\n\n            arg_0.__init_extra_pull_fields(arg_5)\n            for arg_6 in TARGET_PULL_FIELDS:\n\n                if not arg_5[arg_6]:\n                    continue\n\n                if arg_6 == 'user':\n                    arg_5[arg_6 + '_data'] = arg_0.__get_user(arg_5[arg_6]['login'])\n                elif arg_6 == 'merged_by':\n                    arg_5[arg_6 + '_data'] = arg_0.__get_user(arg_5[arg_6]['login'])\n                elif arg_6 == 'review_comments':\n                    arg_5[arg_6 + '_data'] = arg_0.__get_pull_review_comments(arg_5['number'])\n                elif arg_6 == 'requested_reviewers':\n                    arg_5[arg_6 + '_data'] = arg_0.__get_pull_requested_reviewers(arg_5['number'])\n                elif arg_6 == 'commits':\n                    arg_5[arg_6 + '_data'] = arg_0.__get_pull_commits(arg_5['number'])\n\n            yield arg_5", "path": "perceval/backends/core/github.py", "identifier": "GitHub.__fetch_pull_requests", "docstring": "Fetch the pull requests", "docstring_tokens": ["Fetch", "the", "pull", "requests"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256803}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/coordutils.py#L256-L302", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Converts from HH, MM, SS to a decimal value.", "language": "python", "parameters": "(hours, minutes, seconds, returndeg=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "if", "arg_0", ">", "24", ":", "return", "None", "else", ":", "arg_4", "=", "fabs", "(", "arg_0", ")", "+", "fabs", "(", "arg_1", ")", "/", "60.0", "+", "fabs", "(", "arg_2", ")", "/", "3600.0", "if", "arg_3", ":", "arg_5", "=", "arg_4", "*", "15.0", "if", "arg_5", "<", "0", ":", "arg_5", "=", "arg_5", "+", "360.0", "arg_5", "=", "arg_5", "%", "360.0", "return", "arg_5", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n    '''Converts from HH, MM, SS to a decimal value.\n\n    Parameters\n    ----------\n\n    hours : int\n        The HH part of a RA coordinate.\n\n    minutes : int\n        The MM part of a RA coordinate.\n\n    seconds : float\n        The SS.sss part of a RA coordinate.\n\n    returndeg : bool\n        If this is True, then will return decimal degrees as the output.\n        If this is False, then will return decimal HOURS as the output.\n        Decimal hours are sometimes used in FITS headers.\n\n    Returns\n    -------\n\n    float\n        The right ascension value in either decimal degrees or decimal hours\n        depending on `returndeg`.\n\n    '''\n\n    if arg_0 > 24:\n\n        return None\n\n    else:\n\n        arg_4 = fabs(arg_0) + fabs(arg_1)/60.0 + fabs(arg_2)/3600.0\n\n        if arg_3:\n\n            arg_5 = arg_4*15.0\n\n            if arg_5 < 0:\n                arg_5 = arg_5 + 360.0\n            arg_5 = arg_5 % 360.0\n            return arg_5\n        else:\n            return arg_4", "path": "astrobase/coordutils.py", "identifier": "hms_to_decimal", "docstring": "Converts from HH, MM, SS to a decimal value.\n\n    Parameters\n    ----------\n\n    hours : int\n        The HH part of a RA coordinate.\n\n    minutes : int\n        The MM part of a RA coordinate.\n\n    seconds : float\n        The SS.sss part of a RA coordinate.\n\n    returndeg : bool\n        If this is True, then will return decimal degrees as the output.\n        If this is False, then will return decimal HOURS as the output.\n        Decimal hours are sometimes used in FITS headers.\n\n    Returns\n    -------\n\n    float\n        The right ascension value in either decimal degrees or decimal hours\n        depending on `returndeg`.", "docstring_tokens": ["Converts", "from", "HH", "MM", "SS", "to", "a", "decimal", "value", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 256804}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/forms/form_utils.py#L17-L30", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Given a string or a list will return true if the last word or\n    element is a digit.  sep is used when a string is given to know\n    what separates one word from another.", "language": "python", "parameters": "(string_or_list, sep=\"_\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"_\"", ")", ":", "if", "isinstance", "(", "arg_0", ",", "(", "tuple", ",", "list", ")", ")", ":", "arg_2", "=", "len", "(", "arg_0", ")", "if", "arg_2", ":", "return", "six", ".", "text_type", "(", "arg_0", "[", "-", "1", "]", ")", ".", "isdigit", "(", ")", "else", ":", "return", "False", "else", ":", "return", "Func", "(", "arg_0", ".", "split", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1=\"_\"):\n    \"\"\"\n    Given a string or a list will return true if the last word or\n    element is a digit.  sep is used when a string is given to know\n    what separates one word from another.\n    \"\"\"\n    if isinstance(arg_0, (tuple, list)):\n        arg_2 = len(arg_0)\n        if arg_2:\n            return six.text_type(arg_0[-1]).isdigit()\n        else:\n            return False\n    else:\n        return Func(arg_0.split(arg_1))", "path": "mongonaut/forms/form_utils.py", "identifier": "has_digit", "docstring": "Given a string or a list will return true if the last word or\n    element is a digit.  sep is used when a string is given to know\n    what separates one word from another.", "docstring_tokens": ["Given", "a", "string", "or", "a", "list", "will", "return", "true", "if", "the", "last", "word", "or", "element", "is", "a", "digit", ".", "sep", "is", "used", "when", "a", "string", "is", "given", "to", "know", "what", "separates", "one", "word", "from", "another", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 256805}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L155-L174", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Decorator to allow a simple logging configuration.", "language": "python", "parameters": "(func)", "return_statement": "return new_func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "new_func", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "use_simple_logging", "(", "arg_3", ")", ":", "if", "'log_config'", "in", "arg_3", ":", "raise", "ValueError", "(", "'Please do not specify `log_config` '", "'if you want to use the simple '", "'way of providing logging configuration '", "'(i.e using `log_folder`, `logger_names` and/or `log_levels`).'", ")", "_change_logging_kwargs", "(", "arg_3", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "new_func"], "function": "def Func(arg_0):\n    \"\"\"Decorator to allow a simple logging configuration.\n\n    This encompasses giving a `log_folder`, `logger_names` as well as `log_levels`.\n\n    \"\"\"\n\n    @functools.wraps(arg_0)\n    def new_func(arg_1, *arg_2, **arg_3):\n        if use_simple_logging(arg_3):\n            if 'log_config' in arg_3:\n                raise ValueError('Please do not specify `log_config` '\n                                 'if you want to use the simple '\n                                 'way of providing logging configuration '\n                                 '(i.e using `log_folder`, `logger_names` and/or `log_levels`).')\n            _change_logging_kwargs(arg_3)\n\n        return arg_0(arg_1, *arg_2, **arg_3)\n\n    return new_func", "path": "pypet/pypetlogging.py", "identifier": "simple_logging_config", "docstring": "Decorator to allow a simple logging configuration.\n\n    This encompasses giving a `log_folder`, `logger_names` as well as `log_levels`.", "docstring_tokens": ["Decorator", "to", "allow", "a", "simple", "logging", "configuration", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256806}
{"url": "https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/ui/spinner.py#L54-L78", "sha": "212cfe1791a4aab4783f99b665cc32da6437f419", "docstring_summary": "Decorated methods progress will be displayed to the user as a spinner.\n        Mostly for slower functions that do some network IO.", "language": "python", "parameters": "(msg=\"\", waitmsg=\"Please wait\")", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"\"", ",", "arg_1", "=", "\"Please wait\"", ")", ":", "def", "decorator", "(", "arg_2", ")", ":", "@", "functools", ".", "wraps", "(", "arg_2", ")", "def", "wrapper", "(", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "Spinner", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_5", ".", "start", "(", ")", "arg_6", "=", "None", "try", ":", "arg_6", "=", "arg_2", "(", "*", "arg_3", ",", "**", "arg_4", ")", "except", "Exception", "as", "e", ":", "arg_5", ".", "msg", "=", "\"Something went wrong: \"", "arg_5", ".", "stop_spinning", "(", ")", "arg_5", ".", "join", "(", ")", "raise", "e", "arg_5", ".", "stop_spinning", "(", ")", "arg_5", ".", "join", "(", ")", "return", "arg_6", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0=\"\", arg_1=\"Please wait\"):\n        \"\"\"\n        Decorated methods progress will be displayed to the user as a spinner.\n        Mostly for slower functions that do some network IO.\n        \"\"\"\n        def decorator(arg_2):\n            @functools.wraps(arg_2)\n            def wrapper(*arg_3, **arg_4):\n                arg_5 = Spinner(arg_0=arg_0, arg_1=arg_1)\n                arg_5.start()\n                arg_6 = None\n                try:\n                    arg_6 = arg_2(*arg_3, **arg_4)\n                except Exception as e:\n                    arg_5.msg = \"Something went wrong: \"\n                    arg_5.stop_spinning()\n                    arg_5.join()\n                    raise e\n                arg_5.stop_spinning()\n                arg_5.join()\n                return arg_6\n\n            return wrapper\n\n        return decorator", "path": "tmc/ui/spinner.py", "identifier": "Spinner.decorate", "docstring": "Decorated methods progress will be displayed to the user as a spinner.\n        Mostly for slower functions that do some network IO.", "docstring_tokens": ["Decorated", "methods", "progress", "will", "be", "displayed", "to", "the", "user", "as", "a", "spinner", ".", "Mostly", "for", "slower", "functions", "that", "do", "some", "network", "IO", "."], "nwo": "minttu/tmc.py", "score": 0.09252797783733271, "idx": 256807}
{"url": "https://github.com/voidpp/vcp/blob/5538cdb7b43029db9aac9edad823cd87afd89ab5/vcp/project_handler_base.py#L56-L88", "sha": "5538cdb7b43029db9aac9edad823cd87afd89ab5", "docstring_summary": "Load the projects config data from local path", "language": "python", "parameters": "(self)", "return_statement": "return projects", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ".", "path", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "return", "arg_1", "logger", ".", "debug", "(", "\"Load project configs from %s\"", ",", "arg_2", ")", "for", "arg_3", "in", "os", ".", "listdir", "(", "arg_2", ")", ":", "arg_4", "=", "os", ".", "path", ".", "splitext", "(", "arg_3", ")", "if", "arg_4", "[", "1", "]", "[", "1", ":", "]", "!=", "PROJECT_CONFIG_EXTENSION", ":", "continue", "arg_5", "=", "arg_4", "[", "0", "]", "try", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_3", ")", "with", "open", "(", "arg_6", ")", "as", "f", ":", "arg_7", "=", "yaml", ".", "Func", "(", "f", ")", "arg_1", "[", "arg_5", "]", "=", "arg_7", "except", "ValueError", ":", "continue", "logger", ".", "debug", "(", "\"Project '{}' config readed from {}\"", ".", "format", "(", "arg_5", ",", "arg_6", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Load the projects config data from local path\n\n        Returns:\n            Dict: project_name -> project_data\n        \"\"\"\n        arg_1 = {}\n\n        arg_2 = os.path.expanduser(arg_0.path)\n\n        if not os.path.isdir(arg_2):\n            return arg_1\n\n        logger.debug(\"Load project configs from %s\", arg_2)\n\n        for arg_3 in os.listdir(arg_2):\n            arg_4 = os.path.splitext(arg_3)\n\n            if arg_4[1][1:] != PROJECT_CONFIG_EXTENSION:\n                continue\n            arg_5 = arg_4[0]\n\n            try:\n                arg_6 = os.path.join(arg_2, arg_3)\n                with open(arg_6) as f:\n                    arg_7 = yaml.Func(f)\n                arg_1[arg_5] = arg_7\n            except ValueError:\n                continue\n\n            logger.debug(\"Project '{}' config readed from {}\".format(arg_5, arg_6))\n\n        return arg_1", "path": "vcp/project_handler_base.py", "identifier": "ProjectHandlerBase.load", "docstring": "Load the projects config data from local path\n\n        Returns:\n            Dict: project_name -> project_data", "docstring_tokens": ["Load", "the", "projects", "config", "data", "from", "local", "path"], "nwo": "voidpp/vcp", "score": 0.34668479461464624, "idx": 256808}
{"url": "https://github.com/zsiciarz/pyaavso/blob/d3b9eb17bcecc6652841606802b5713fd6083cc1/pyaavso/utils.py#L13-L39", "sha": "d3b9eb17bcecc6652841606802b5713fd6083cc1", "docstring_summary": "Downloads all variable star observations by a given observer.", "language": "python", "parameters": "(observer_code)", "return_statement": "return observations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "1", "arg_2", "=", "[", "]", "while", "True", ":", "logger", ".", "info", "(", "'Downloading page %d...'", ",", "arg_1", ")", "arg_3", "=", "requests", ".", "get", "(", "WEBOBS_RESULTS_URL", ",", "params", "=", "{", "'obscode'", ":", "arg_0", ",", "'num_results'", ":", "200", ",", "'obs_types'", ":", "'all'", ",", "'page'", ":", "arg_1", ",", "}", ")", "logger", ".", "debug", "(", "arg_3", ".", "request", ".", "url", ")", "arg_4", "=", "WebObsResultsParser", "(", "arg_3", ".", "text", ")", "arg_2", ".", "extend", "(", "arg_4", ".", "get_observations", "(", ")", ")", "if", "'>Next</a>'", "not", "in", "arg_3", ".", "text", ":", "break", "arg_1", "+=", "1", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Downloads all variable star observations by a given observer.\n\n    Performs a series of HTTP requests to AAVSO's WebObs search and\n    downloads the results page by page. Each page is then passed to\n    :py:class:`~pyaavso.parsers.webobs.WebObsResultsParser` and parse results\n    are added to the final observation list.\n    \"\"\"\n    arg_1 = 1\n    arg_2 = []\n    while True:\n        logger.info('Downloading page %d...', arg_1)\n        arg_3 = requests.get(WEBOBS_RESULTS_URL, params={\n            'obscode': arg_0,\n            'num_results': 200,\n            'obs_types': 'all',\n            'page': arg_1,\n        })\n        logger.debug(arg_3.request.url)\n        arg_4 = WebObsResultsParser(arg_3.text)\n        arg_2.extend(arg_4.get_observations())\n        # kinda silly, but there's no need for lxml machinery here\n        if '>Next</a>' not in arg_3.text:\n            break\n        arg_1 += 1\n    return arg_2", "path": "pyaavso/utils.py", "identifier": "download_observations", "docstring": "Downloads all variable star observations by a given observer.\n\n    Performs a series of HTTP requests to AAVSO's WebObs search and\n    downloads the results page by page. Each page is then passed to\n    :py:class:`~pyaavso.parsers.webobs.WebObsResultsParser` and parse results\n    are added to the final observation list.", "docstring_tokens": ["Downloads", "all", "variable", "star", "observations", "by", "a", "given", "observer", "."], "nwo": "zsiciarz/pyaavso", "score": 0.14991498758945482, "idx": 256809}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/mast.py#L452-L554", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This does a cross-match with TIC.", "language": "python", "parameters": "(\n        ra,\n        decl,\n        radius_arcsec=5.0,\n        apiversion='v0',\n        forcefetch=False,\n        cachedir='~/.astrobase/mast-cache',\n        verbose=True,\n        timeout=90.0,\n        refresh=5.0,\n        maxtimeout=180.0,\n        maxtries=3,\n        jitter=5.0,\n        raiseonfail=False\n)", "return_statement": "return mast_query(service,\n                      params,\n                      data=xmatch_input,\n                      jitter=jitter,\n                      apiversion=apiversion,\n                      forcefetch=forcefetch,\n                      cachedir=cachedir,\n                      verbose=verbose,\n                      timeout=timeout,\n                      refresh=refresh,\n                      maxtimeout=maxtimeout,\n                      maxtries=maxtries,\n                      raiseonfail=raiseonfail)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "5.0", ",", "arg_3", "=", "'v0'", ",", "arg_4", "=", "False", ",", "arg_5", "=", "'~/.astrobase/mast-cache'", ",", "arg_6", "=", "True", ",", "arg_7", "=", "90.0", ",", "arg_8", "=", "5.0", ",", "arg_9", "=", "180.0", ",", "arg_10", "=", "3", ",", "arg_11", "=", "5.0", ",", "arg_12", "=", "False", ")", ":", "arg_13", "=", "'Mast.Tic.Crossmatch'", "arg_14", "=", "{", "'fields'", ":", "[", "{", "'name'", ":", "'ra'", ",", "'type'", ":", "'float'", "}", ",", "{", "'name'", ":", "'dec'", ",", "'type'", ":", "'float'", "}", "]", "}", "arg_14", "[", "'data'", "]", "=", "[", "{", "'ra'", ":", "x", ",", "'dec'", ":", "y", "}", "for", "(", "x", ",", "y", ")", "in", "zip", "(", "arg_0", ",", "arg_1", ")", "]", "arg_15", "=", "{", "'raColumn'", ":", "'ra'", ",", "'decColumn'", ":", "'dec'", ",", "'radius'", ":", "arg_2", "/", "3600.0", "}", "return", "mast_query", "(", "arg_13", ",", "arg_15", ",", "data", "=", "arg_14", ",", "arg_11", "=", "arg_11", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_12", "=", "arg_12", ")"], "function": "def Func(\n        arg_0,\n        arg_1,\n        arg_2=5.0,\n        arg_3='v0',\n        arg_4=False,\n        arg_5='~/.astrobase/mast-cache',\n        arg_6=True,\n        arg_7=90.0,\n        arg_8=5.0,\n        arg_9=180.0,\n        arg_10=3,\n        arg_11=5.0,\n        arg_12=False\n):\n    '''This does a cross-match with TIC.\n\n    Parameters\n    ----------\n\n    ra,decl : np.arrays or lists of floats\n        The coordinates that will be cross-matched against the TIC.\n\n    radius_arcsec : float\n        The cross-match radius in arcseconds.\n\n    apiversion : str\n        The API version of the MAST service to use. This sets the URL that this\n        function will call, using `apiversion` as key into the `MAST_URLS` dict\n        above.\n\n    forcefetch : bool\n        If this is True, the query will be retried even if cached results for\n        it exist.\n\n    cachedir : str\n        This points to the directory where results will be downloaded.\n\n    verbose : bool\n        If True, will indicate progress and warn of any issues.\n\n    timeout : float\n        This sets the amount of time in seconds to wait for the service to\n        respond to our initial request.\n\n    refresh : float\n        This sets the amount of time in seconds to wait before checking if the\n        result file is available. If the results file isn't available after\n        `refresh` seconds have elapsed, the function will wait for `refresh`\n        seconds continuously, until `maxtimeout` is reached or the results file\n        becomes available.\n\n    maxtimeout : float\n        The maximum amount of time in seconds to wait for a result to become\n        available after submitting our query request.\n\n    maxtries : int\n        The maximum number of tries (across all mirrors tried) to make to either\n        submit the request or download the results, before giving up.\n\n    jitter : float\n        This is used to control the scale of the random wait in seconds before\n        starting the query. Useful in parallelized situations.\n\n    raiseonfail : bool\n        If this is True, the function will raise an Exception if something goes\n        wrong, instead of returning None.\n\n    Returns\n    -------\n\n    dict\n        This returns a dict of the following form::\n\n            {'params':dict of the input params used for the query,\n             'provenance':'cache' or 'new download',\n             'result':path to the file on disk with the downloaded data table}\n\n    '''\n\n    arg_13 = 'Mast.Tic.Crossmatch'\n\n    arg_14 = {'fields':[{'name':'ra','type':'float'},\n                              {'name':'dec','type':'float'}]}\n    arg_14['data'] = [{'ra':x, 'dec':y} for (x,y) in zip(arg_0, arg_1)]\n\n    arg_15 = {'raColumn':'ra',\n              'decColumn':'dec',\n              'radius':arg_2/3600.0}\n\n    return mast_query(arg_13,\n                      arg_15,\n                      data=arg_14,\n                      arg_11=arg_11,\n                      arg_3=arg_3,\n                      arg_4=arg_4,\n                      arg_5=arg_5,\n                      arg_6=arg_6,\n                      arg_7=arg_7,\n                      arg_8=arg_8,\n                      arg_9=arg_9,\n                      arg_10=arg_10,\n                      arg_12=arg_12)", "path": "astrobase/services/mast.py", "identifier": "tic_xmatch", "docstring": "This does a cross-match with TIC.\n\n    Parameters\n    ----------\n\n    ra,decl : np.arrays or lists of floats\n        The coordinates that will be cross-matched against the TIC.\n\n    radius_arcsec : float\n        The cross-match radius in arcseconds.\n\n    apiversion : str\n        The API version of the MAST service to use. This sets the URL that this\n        function will call, using `apiversion` as key into the `MAST_URLS` dict\n        above.\n\n    forcefetch : bool\n        If this is True, the query will be retried even if cached results for\n        it exist.\n\n    cachedir : str\n        This points to the directory where results will be downloaded.\n\n    verbose : bool\n        If True, will indicate progress and warn of any issues.\n\n    timeout : float\n        This sets the amount of time in seconds to wait for the service to\n        respond to our initial request.\n\n    refresh : float\n        This sets the amount of time in seconds to wait before checking if the\n        result file is available. If the results file isn't available after\n        `refresh` seconds have elapsed, the function will wait for `refresh`\n        seconds continuously, until `maxtimeout` is reached or the results file\n        becomes available.\n\n    maxtimeout : float\n        The maximum amount of time in seconds to wait for a result to become\n        available after submitting our query request.\n\n    maxtries : int\n        The maximum number of tries (across all mirrors tried) to make to either\n        submit the request or download the results, before giving up.\n\n    jitter : float\n        This is used to control the scale of the random wait in seconds before\n        starting the query. Useful in parallelized situations.\n\n    raiseonfail : bool\n        If this is True, the function will raise an Exception if something goes\n        wrong, instead of returning None.\n\n    Returns\n    -------\n\n    dict\n        This returns a dict of the following form::\n\n            {'params':dict of the input params used for the query,\n             'provenance':'cache' or 'new download',\n             'result':path to the file on disk with the downloaded data table}", "docstring_tokens": ["This", "does", "a", "cross", "-", "match", "with", "TIC", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 256810}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/inspector.py#L109-L146", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find lines in home that are inspectable.\n    \n    Walk back from the err line up to 3 lines, but don't walk back over\n    changes in indent level.", "language": "python", "parameters": "(lines, pos)", "return_statement": "return toinspect, home_pos", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "re", ".", "compile", "(", "r'\\\\[\\s\\n]*$'", ")", "arg_3", "=", "re", ".", "compile", "(", "r':[\\s\\n]*$'", ")", "arg_4", "=", "re", ".", "compile", "(", "r'^(\\s*)'", ")", "arg_5", "=", "[", "]", "arg_6", "=", "arg_0", "[", "arg_1", "]", "arg_7", "=", "arg_4", ".", "match", "(", "arg_6", ")", ".", "groups", "(", ")", "[", "0", "]", "arg_8", "=", "arg_0", "[", "max", "(", "arg_1", "-", "3", ",", "0", ")", ":", "arg_1", "]", "arg_8", ".", "reverse", "(", ")", "arg_9", "=", "arg_0", "[", "arg_1", "+", "1", ":", "min", "(", "arg_1", "+", "4", ",", "len", "(", "arg_0", ")", ")", "]", "for", "arg_10", "in", "arg_8", ":", "if", "arg_4", ".", "match", "(", "arg_10", ")", ".", "groups", "(", ")", "[", "0", "]", "==", "arg_7", ":", "arg_5", ".", "append", "(", "arg_10", ")", "else", ":", "break", "arg_5", ".", "reverse", "(", ")", "arg_5", ".", "append", "(", "arg_6", ")", "arg_11", "=", "len", "(", "arg_5", ")", "-", "1", "arg_12", "=", "arg_2", ".", "search", "(", "arg_6", ")", "for", "arg_10", "in", "arg_9", ":", "if", "(", "(", "arg_12", "or", "arg_4", ".", "match", "(", "arg_10", ")", ".", "groups", "(", ")", "[", "0", "]", "==", "arg_7", ")", "and", "not", "arg_3", ".", "search", "(", "arg_10", ")", ")", ":", "arg_5", ".", "append", "(", "arg_10", ")", "arg_12", "=", "arg_2", ".", "search", "(", "arg_10", ")", "else", ":", "break", "log", ".", "debug", "(", "\"Inspecting lines '''%s''' around %s\"", ",", "arg_5", ",", "arg_11", ")", "return", "arg_5", ",", "arg_11"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Find lines in home that are inspectable.\n    \n    Walk back from the err line up to 3 lines, but don't walk back over\n    changes in indent level.\n\n    Walk forward up to 3 lines, counting \\ separated lines as 1. Don't walk\n    over changes in indent level (unless part of an extended line)\n    \"\"\"\n    arg_2 = re.compile(r'\\\\[\\s\\n]*$')\n    arg_3 = re.compile(r':[\\s\\n]*$')\n    arg_4 = re.compile(r'^(\\s*)')\n    arg_5 = []\n    arg_6 = arg_0[arg_1]\n    arg_7 = arg_4.match(arg_6).groups()[0]\n    \n    arg_8 = arg_0[max(arg_1-3, 0):arg_1]\n    arg_8.reverse()\n    arg_9 = arg_0[arg_1+1:min(arg_1+4, len(arg_0))]\n\n    for arg_10 in arg_8:\n        if arg_4.match(arg_10).groups()[0] == arg_7:\n            arg_5.append(arg_10)\n        else:\n            break\n    arg_5.reverse()\n    arg_5.append(arg_6)\n    arg_11 = len(arg_5)-1\n    arg_12 = arg_2.search(arg_6)\n    for arg_10 in arg_9:\n        if ((arg_12 or arg_4.match(arg_10).groups()[0] == arg_7)\n            and not arg_3.search(arg_10)):\n            arg_5.append(arg_10)\n            arg_12 = arg_2.search(arg_10)\n        else:\n            break\n    log.debug(\"Inspecting lines '''%s''' around %s\", arg_5, arg_11)\n    return arg_5, arg_11", "path": "environment/lib/python2.7/site-packages/nose/inspector.py", "identifier": "find_inspectable_lines", "docstring": "Find lines in home that are inspectable.\n    \n    Walk back from the err line up to 3 lines, but don't walk back over\n    changes in indent level.\n\n    Walk forward up to 3 lines, counting \\ separated lines as 1. Don't walk\n    over changes in indent level (unless part of an extended line)", "docstring_tokens": ["Find", "lines", "in", "home", "that", "are", "inspectable", ".", "Walk", "back", "from", "the", "err", "line", "up", "to", "3", "lines", "but", "don", "t", "walk", "back", "over", "changes", "in", "indent", "level", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256811}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_stream.py#L68-L74", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Flush to this and the redirected stream", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "redirect", "is", "not", "None", ":", "arg_0", ".", "redirect", ".", "Func", "(", ")", "super", "(", "TeeStringIO", ",", "arg_0", ")", ".", "Func", "(", ")"], "function": "def Func(arg_0):  # nocover\n        \"\"\"\n        Flush to this and the redirected stream\n        \"\"\"\n        if arg_0.redirect is not None:\n            arg_0.redirect.Func()\n        super(TeeStringIO, arg_0).Func()", "path": "ubelt/util_stream.py", "identifier": "TeeStringIO.flush", "docstring": "Flush to this and the redirected stream", "docstring_tokens": ["Flush", "to", "this", "and", "the", "redirected", "stream"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 256812}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L378-L437", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns the representation of logical plan that will\n    be returned from Tracker.", "language": "python", "parameters": "(self, topology)", "return_statement": "return logicalPlan", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"spouts\"", ":", "{", "}", ",", "\"bolts\"", ":", "{", "}", ",", "}", "for", "arg_3", "in", "arg_1", ".", "spouts", "(", ")", ":", "arg_4", "=", "arg_3", ".", "comp", ".", "name", "arg_5", "=", "\"default\"", "arg_6", "=", "\"NA\"", "arg_7", "=", "\"NA\"", "arg_8", "=", "arg_3", ".", "comp", ".", "config", ".", "kvs", "for", "arg_9", "in", "arg_8", ":", "if", "arg_9", ".", "key", "==", "\"spout.type\"", ":", "arg_5", "=", "javaobj", ".", "loads", "(", "arg_9", ".", "serialized_value", ")", "elif", "arg_9", ".", "key", "==", "\"spout.source\"", ":", "arg_6", "=", "javaobj", ".", "loads", "(", "arg_9", ".", "serialized_value", ")", "elif", "arg_9", ".", "key", "==", "\"spout.version\"", ":", "arg_7", "=", "javaobj", ".", "loads", "(", "arg_9", ".", "serialized_value", ")", "arg_10", "=", "{", "\"config\"", ":", "convert_pb_kvs", "(", "arg_8", ",", "include_non_primitives", "=", "False", ")", ",", "\"type\"", ":", "arg_5", ",", "\"source\"", ":", "arg_6", ",", "\"version\"", ":", "arg_7", ",", "\"outputs\"", ":", "[", "]", "}", "for", "arg_11", "in", "list", "(", "arg_3", ".", "outputs", ")", ":", "arg_10", "[", "\"outputs\"", "]", ".", "append", "(", "{", "\"stream_name\"", ":", "arg_11", ".", "stream", ".", "id", "}", ")", "arg_2", "[", "\"spouts\"", "]", "[", "arg_4", "]", "=", "arg_10", "for", "arg_12", "in", "arg_1", ".", "bolts", "(", ")", ":", "arg_13", "=", "arg_12", ".", "comp", ".", "name", "arg_14", "=", "{", "\"config\"", ":", "convert_pb_kvs", "(", "arg_12", ".", "comp", ".", "config", ".", "kvs", ",", "include_non_primitives", "=", "False", ")", ",", "\"outputs\"", ":", "[", "]", ",", "\"inputs\"", ":", "[", "]", "}", "for", "arg_11", "in", "list", "(", "arg_12", ".", "outputs", ")", ":", "arg_14", "[", "\"outputs\"", "]", ".", "append", "(", "{", "\"stream_name\"", ":", "arg_11", ".", "stream", ".", "id", "}", ")", "for", "arg_15", "in", "list", "(", "arg_12", ".", "inputs", ")", ":", "arg_14", "[", "\"inputs\"", "]", ".", "append", "(", "{", "\"stream_name\"", ":", "arg_15", ".", "stream", ".", "id", ",", "\"component_name\"", ":", "arg_15", ".", "stream", ".", "component_name", ",", "\"grouping\"", ":", "topology_pb2", ".", "Grouping", ".", "Name", "(", "arg_15", ".", "gtype", ")", "}", ")", "arg_2", "[", "\"bolts\"", "]", "[", "arg_13", "]", "=", "arg_14", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the representation of logical plan that will\n    be returned from Tracker.\n    \"\"\"\n    arg_2 = {\n        \"spouts\": {},\n        \"bolts\": {},\n    }\n\n    # Add spouts.\n    for arg_3 in arg_1.spouts():\n      arg_4 = arg_3.comp.name\n      arg_5 = \"default\"\n      arg_6 = \"NA\"\n      arg_7 = \"NA\"\n      arg_8 = arg_3.comp.config.kvs\n      for arg_9 in arg_8:\n        if arg_9.key == \"spout.type\":\n          arg_5 = javaobj.loads(arg_9.serialized_value)\n        elif arg_9.key == \"spout.source\":\n          arg_6 = javaobj.loads(arg_9.serialized_value)\n        elif arg_9.key == \"spout.version\":\n          arg_7 = javaobj.loads(arg_9.serialized_value)\n      arg_10 = {\n          \"config\": convert_pb_kvs(arg_8, include_non_primitives=False),\n          \"type\": arg_5,\n          \"source\": arg_6,\n          \"version\": arg_7,\n          \"outputs\": []\n      }\n      for arg_11 in list(arg_3.outputs):\n        arg_10[\"outputs\"].append({\n            \"stream_name\": arg_11.stream.id\n        })\n\n      arg_2[\"spouts\"][arg_4] = arg_10\n\n    # Add bolts.\n    for arg_12 in arg_1.bolts():\n      arg_13 = arg_12.comp.name\n      arg_14 = {\n          \"config\": convert_pb_kvs(arg_12.comp.config.kvs, include_non_primitives=False),\n          \"outputs\": [],\n          \"inputs\": []\n      }\n      for arg_11 in list(arg_12.outputs):\n        arg_14[\"outputs\"].append({\n            \"stream_name\": arg_11.stream.id\n        })\n      for arg_15 in list(arg_12.inputs):\n        arg_14[\"inputs\"].append({\n            \"stream_name\": arg_15.stream.id,\n            \"component_name\": arg_15.stream.component_name,\n            \"grouping\": topology_pb2.Grouping.Name(arg_15.gtype)\n        })\n\n      arg_2[\"bolts\"][arg_13] = arg_14\n\n    return arg_2", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "Tracker.extract_logical_plan", "docstring": "Returns the representation of logical plan that will\n    be returned from Tracker.", "docstring_tokens": ["Returns", "the", "representation", "of", "logical", "plan", "that", "will", "be", "returned", "from", "Tracker", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256813}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L188-L198", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Get the user's umask.", "language": "python", "parameters": "(self, use_sudo=False)", "return_statement": "return func('umask')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_1", "and", "run_as_root", "or", "arg_0", ".", "run", "return", "arg_2", "(", "'Func'", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Get the user's Func.\n\n        Returns a string such as ``'0002'``, representing the user's Func\n        as an octal number.\n\n        If `use_sudo` is `True`, this function returns root's Func.\n        \"\"\"\n        arg_2 = arg_1 and run_as_root or arg_0.run\n        return arg_2('Func')", "path": "burlap/files.py", "identifier": "FileSatchel.umask", "docstring": "Get the user's umask.\n\n        Returns a string such as ``'0002'``, representing the user's umask\n        as an octal number.\n\n        If `use_sudo` is `True`, this function returns root's umask.", "docstring_tokens": ["Get", "the", "user", "s", "umask", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256814}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/enrollments.py#L45-L50", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return a list of all enrollments for the passed section sis id.", "language": "python", "parameters": "(self, sis_section_id, params={})", "return_statement": "return self.get_enrollments_for_section(\n            self._sis_id(sis_section_id, sis_field=\"section\"), params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "return", "arg_0", ".", "get_enrollments_for_section", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"section\"", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return a list of all enrollments for the passed section sis id.\n        \"\"\"\n        return arg_0.get_enrollments_for_section(\n            arg_0._sis_id(arg_1, sis_field=\"section\"), arg_2)", "path": "uw_canvas/enrollments.py", "identifier": "Enrollments.get_enrollments_for_section_by_sis_id", "docstring": "Return a list of all enrollments for the passed section sis id.", "docstring_tokens": ["Return", "a", "list", "of", "all", "enrollments", "for", "the", "passed", "section", "sis", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 256815}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L34-L48", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Create new storage service client.", "language": "python", "parameters": "(cls, access_token, environment='prod')", "return_statement": "return cls(api_client)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'prod'", ")", ":", "arg_3", "=", "ApiClient", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2='prod'):\n        '''Create Func storage service client.\n\n            Arguments:\n                environment(str): The service environment to be used for the client.\n                    'prod' or 'dev'.\n                access_token(str): The access token used to authenticate with the\n                    service\n\n            Returns:\n                A storage_service.Client instance\n        '''\n\n        arg_3 = ApiClient.Func(arg_1, arg_2)\n        return arg_0(arg_3)", "path": "hbp_service_client/storage_service/client.py", "identifier": "Client.new", "docstring": "Create new storage service client.\n\n            Arguments:\n                environment(str): The service environment to be used for the client.\n                    'prod' or 'dev'.\n                access_token(str): The access token used to authenticate with the\n                    service\n\n            Returns:\n                A storage_service.Client instance", "docstring_tokens": ["Create", "new", "storage", "service", "client", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 256816}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/pipeline/phase.py#L741-L768", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Load a default value for redshift from config and set it as the redshift for source or lens galaxies that have\n    falsey redshifts", "language": "python", "parameters": "(key)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "functools", ".", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "arg_2", ",", "arg_3", ")", ":", "arg_3", "=", "arg_3", "or", "[", "]", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "arg_3", "[", "arg_4", "]", "if", "isinstance", "(", "arg_4", ",", "str", ")", "else", "arg_4", "arg_5", ".", "redshift", "=", "arg_5", ".", "redshift", "or", "conf", ".", "instance", ".", "general", ".", "get", "(", "\"redshift\"", ",", "arg_0", ",", "float", ")", "return", "arg_1", "(", "arg_2", ",", "arg_3", ")", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Load a default value for redshift from config and set it as the redshift for source or lens galaxies that have\n    falsey redshifts\n\n    Parameters\n    ----------\n    key: str\n\n    Returns\n    -------\n    decorator\n        A decorator that wraps the setter function to set defaults\n    \"\"\"\n\n    def decorator(arg_1):\n        @functools.wraps(arg_1)\n        def wrapper(arg_2, arg_3):\n            arg_3 = arg_3 or []\n            for arg_4 in arg_3:\n                # noinspection PyTypeChecker\n                arg_5 = arg_3[arg_4] if isinstance(arg_4, str) else arg_4\n                arg_5.redshift = arg_5.redshift or conf.instance.general.get(\"redshift\", arg_0, float)\n            return arg_1(arg_2, arg_3)\n\n        return wrapper\n\n    return decorator", "path": "autolens/pipeline/phase.py", "identifier": "set_defaults", "docstring": "Load a default value for redshift from config and set it as the redshift for source or lens galaxies that have\n    falsey redshifts\n\n    Parameters\n    ----------\n    key: str\n\n    Returns\n    -------\n    decorator\n        A decorator that wraps the setter function to set defaults", "docstring_tokens": ["Load", "a", "default", "value", "for", "redshift", "from", "config", "and", "set", "it", "as", "the", "redshift", "for", "source", "or", "lens", "galaxies", "that", "have", "falsey", "redshifts"], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 256817}
{"url": "https://github.com/borisbabic/browser_cookie3/blob/e695777c54509c286991c5bb5ca65f043d748f55/__init__.py#L274-L278", "sha": "e695777c54509c286991c5bb5ca65f043d748f55", "docstring_summary": "Shortcut function to create a cookie", "language": "python", "parameters": "(host, path, secure, expires, name, value)", "return_statement": "return http.cookiejar.Cookie(0, name, value, None, False, host, host.startswith('.'), host.startswith('.'), path,\n                                 True, secure, expires, False, None, None, {})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "return", "http", ".", "cookiejar", ".", "Cookie", "(", "0", ",", "arg_4", ",", "arg_5", ",", "None", ",", "False", ",", "arg_0", ",", "arg_0", ".", "startswith", "(", "'.'", ")", ",", "arg_0", ".", "startswith", "(", "'.'", ")", ",", "arg_1", ",", "True", ",", "arg_2", ",", "arg_3", ",", "False", ",", "None", ",", "None", ",", "{", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Shortcut function to create a cookie\n    \"\"\"\n    return http.cookiejar.Cookie(0, arg_4, arg_5, None, False, arg_0, arg_0.startswith('.'), arg_0.startswith('.'), arg_1,\n                                 True, arg_2, arg_3, False, None, None, {})", "path": "__init__.py", "identifier": "create_cookie", "docstring": "Shortcut function to create a cookie", "docstring_tokens": ["Shortcut", "function", "to", "create", "a", "cookie"], "nwo": "borisbabic/browser_cookie3", "score": 0.7384462168633814, "idx": 256818}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/kernels/transform.py#L400-L421", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Learn the linear transformation to flipped eigenvalues.", "language": "python", "parameters": "(self, X, y=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_1", ".", "shape", "[", "0", "]", "if", "arg_1", ".", "shape", "!=", "(", "arg_3", ",", "arg_3", ")", ":", "raise", "TypeError", "(", "\"Input must be a square matrix.\"", ")", "arg_4", "=", "get_memory", "(", "arg_0", ".", "memory", ")", "arg_5", ",", "arg_6", "=", "arg_4", ".", "cache", "(", "scipy", ".", "linalg", ".", "eigh", ",", "ignore", "=", "[", "'overwrite_a'", "]", ")", "(", "arg_1", ",", "overwrite_a", "=", "not", "arg_0", ".", "copy", ")", "arg_5", "=", "arg_5", "[", ":", ",", "None", "]", "arg_0", ".", "flip_", "=", "np", ".", "dot", "(", "arg_6", ",", "np", ".", "sign", "(", "arg_5", ")", "*", "arg_6", ".", "T", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Learn the linear transformation to flipped eigenvalues.\n\n        Parameters\n        ----------\n        X : array, shape [n, n]\n            The *symmetric* input similarities. If X is asymmetric, it will be\n            treated as if it were symmetric based on its lower-triangular part.\n        '''\n        arg_3 = arg_1.shape[0]\n        if arg_1.shape != (arg_3, arg_3):\n            raise TypeError(\"Input must be a square matrix.\")\n\n        # TODO: only get negative eigs somehow?\n        arg_4 = get_memory(arg_0.memory)\n        arg_5, arg_6 = arg_4.cache(scipy.linalg.eigh, ignore=['overwrite_a'])(\n            arg_1, overwrite_a=not arg_0.copy)\n        arg_5 = arg_5[:, None]\n\n        arg_0.flip_ = np.dot(arg_6, np.sign(arg_5) * arg_6.T)\n        return arg_0", "path": "skl_groups/kernels/transform.py", "identifier": "FlipPSD.fit", "docstring": "Learn the linear transformation to flipped eigenvalues.\n\n        Parameters\n        ----------\n        X : array, shape [n, n]\n            The *symmetric* input similarities. If X is asymmetric, it will be\n            treated as if it were symmetric based on its lower-triangular part.", "docstring_tokens": ["Learn", "the", "linear", "transformation", "to", "flipped", "eigenvalues", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 256819}
{"url": "https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/lexrank.py#L17-L88", "sha": "b246bd111aa10a8ea11a0aff8c9fce891f52cc58", "docstring_summary": "compute centrality score of sentences.", "language": "python", "parameters": "(sentences, continuous=False, sim_threshold=0.1, alpha=0.9,\n            use_divrank=False, divrank_alpha=0.25)", "return_statement": "return scores, sim_mat", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "0.1", ",", "arg_3", "=", "0.9", ",", "arg_4", "=", "False", ",", "arg_5", "=", "0.25", ")", ":", "arg_6", "=", "{", "'max_iter'", ":", "1000", "}", "if", "arg_4", ":", "arg_7", "=", "divrank_scipy", "arg_6", "[", "'alpha'", "]", "=", "arg_5", "arg_6", "[", "'d'", "]", "=", "arg_3", "else", ":", "arg_7", "=", "networkx", ".", "pagerank_scipy", "arg_6", "[", "'alpha'", "]", "=", "arg_3", "arg_8", "=", "networkx", ".", "DiGraph", "(", ")", "arg_9", "=", "[", "]", "for", "arg_10", "in", "arg_0", ":", "arg_11", "=", "tools", ".", "word_segmenter_ja", "(", "arg_10", ")", "arg_12", "=", "collections", ".", "Counter", "(", "arg_11", ")", "arg_9", ".", "append", "(", "arg_12", ")", "arg_13", "=", "DictVectorizer", "(", "sparse", "=", "True", ")", "arg_14", "=", "arg_13", ".", "fit_transform", "(", "arg_9", ")", "arg_15", "=", "1", "-", "pairwise_distances", "(", "arg_14", ",", "arg_14", ",", "metric", "=", "'cosine'", ")", "if", "arg_1", ":", "arg_16", ",", "arg_17", "=", "numpy", ".", "where", "(", "arg_15", ">", "0", ")", "else", ":", "arg_16", ",", "arg_17", "=", "numpy", ".", "where", "(", "arg_15", ">=", "arg_2", ")", "arg_8", ".", "add_nodes_from", "(", "range", "(", "arg_14", ".", "shape", "[", "0", "]", ")", ")", "for", "arg_18", ",", "arg_19", "in", "zip", "(", "arg_16", ",", "arg_17", ")", ":", "if", "arg_18", "==", "arg_19", ":", "continue", "arg_20", "=", "arg_15", "[", "arg_18", ",", "arg_19", "]", "if", "arg_1", "else", "1.0", "arg_8", ".", "add_edge", "(", "arg_18", ",", "arg_19", ",", "{", "'weight'", ":", "arg_20", "}", ")", "arg_21", "=", "arg_7", "(", "arg_8", ",", "**", "arg_6", ")", "return", "arg_21", ",", "arg_15"], "function": "def Func(arg_0, arg_1=False, arg_2=0.1, arg_3=0.9,\n            arg_4=False, arg_5=0.25):\n    '''\n    compute centrality score of sentences.\n\n    Args:\n      sentences: [u'\u3053\u3093\u306b\u3061\u306f\uff0e', u'\u79c1\u306e\u540d\u524d\u306f\u98ef\u6cbc\u3067\u3059\uff0e', ... ]\n      continuous: if True, apply continuous LexRank. (see reference)\n      sim_threshold: if continuous is False and smilarity is greater or\n        equal to sim_threshold, link the sentences.\n      alpha: the damping factor of PageRank and DivRank\n      divrank: if True, apply DivRank instead of PageRank\n      divrank_alpha: strength of self-link [0.0-1.0]\n        (it's not the damping factor, see divrank.py)\n\n    Returns: tuple\n      (\n        {\n          # sentence index -> score\n          0: 0.003,\n          1: 0.002,\n          ...\n        },\n        similarity_matrix\n      )\n    \n    Reference:\n      G\u00fcnes Erkan and Dragomir R. Radev.\n      LexRank: graph-based lexical centrality as salience in text\n      summarization. (section 3)\n      http://www.cs.cmu.edu/afs/cs/project/jair/pub/volume22/erkan04a-html/erkan04a.html\n    '''\n    # configure ranker\n    arg_6 = {'max_iter': 1000}\n    if arg_4:\n        arg_7 = divrank_scipy\n        arg_6['alpha'] = arg_5\n        arg_6['d'] = arg_3\n    else:\n        arg_7 = networkx.pagerank_scipy\n        arg_6['alpha'] = arg_3\n\n    arg_8 = networkx.DiGraph()\n\n    # sentence -> tf\n    arg_9 = []\n    for arg_10 in arg_0:\n        arg_11 = tools.word_segmenter_ja(arg_10)\n        arg_12 = collections.Counter(arg_11)\n        arg_9.append(arg_12)\n\n    arg_13 = DictVectorizer(sparse=True)\n    arg_14 = arg_13.fit_transform(arg_9)\n\n    # compute similarities between senteces\n    arg_15 = 1 - pairwise_distances(arg_14, arg_14, metric='cosine')\n\n    if arg_1:\n        arg_16, arg_17 = numpy.where(arg_15 > 0)\n    else:\n        arg_16, arg_17 = numpy.where(arg_15 >= arg_2)\n\n    # create similarity graph\n    arg_8.add_nodes_from(range(arg_14.shape[0]))\n    for arg_18, arg_19 in zip(arg_16, arg_17):\n        if arg_18 == arg_19:\n            continue\n        arg_20 = arg_15[arg_18,arg_19] if arg_1 else 1.0\n        arg_8.add_edge(arg_18, arg_19, {'weight': arg_20})\n\n    arg_21 = arg_7(arg_8, **arg_6)\n    return arg_21, arg_15", "path": "summpy/lexrank.py", "identifier": "lexrank", "docstring": "compute centrality score of sentences.\n\n    Args:\n      sentences: [u'\u3053\u3093\u306b\u3061\u306f\uff0e', u'\u79c1\u306e\u540d\u524d\u306f\u98ef\u6cbc\u3067\u3059\uff0e', ... ]\n      continuous: if True, apply continuous LexRank. (see reference)\n      sim_threshold: if continuous is False and smilarity is greater or\n        equal to sim_threshold, link the sentences.\n      alpha: the damping factor of PageRank and DivRank\n      divrank: if True, apply DivRank instead of PageRank\n      divrank_alpha: strength of self-link [0.0-1.0]\n        (it's not the damping factor, see divrank.py)\n\n    Returns: tuple\n      (\n        {\n          # sentence index -> score\n          0: 0.003,\n          1: 0.002,\n          ...\n        },\n        similarity_matrix\n      )\n    \n    Reference:\n      G\u00fcnes Erkan and Dragomir R. Radev.\n      LexRank: graph-based lexical centrality as salience in text\n      summarization. (section 3)\n      http://www.cs.cmu.edu/afs/cs/project/jair/pub/volume22/erkan04a-html/erkan04a.html", "docstring_tokens": ["compute", "centrality", "score", "of", "sentences", "."], "nwo": "recruit-tech/summpy", "score": 0.3953392334631274, "idx": 256820}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5479-L5498", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks whether where function type arguments are expected.", "language": "python", "parameters": "(clean_lines, linenum)", "return_statement": "return (Match(r'^\\s*MOCK_(CONST_)?METHOD\\d+(_T)?\\(', line) or\n          (linenum >= 2 and\n           (Match(r'^\\s*MOCK_(?:CONST_)?METHOD\\d+(?:_T)?\\((?:\\S+,)?\\s*$',\n                  clean_lines.elided[linenum - 1]) or\n            Match(r'^\\s*MOCK_(?:CONST_)?METHOD\\d+(?:_T)?\\(\\s*$',\n                  clean_lines.elided[linenum - 2]) or\n            Search(r'\\bstd::m?function\\s*\\<\\s*$',\n                   clean_lines.elided[linenum - 1]))))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "elided", "[", "arg_1", "]", "return", "(", "Match", "(", "r'^\\s*MOCK_(CONST_)?METHOD\\d+(_T)?\\('", ",", "arg_2", ")", "or", "(", "arg_1", ">=", "2", "and", "(", "Match", "(", "r'^\\s*MOCK_(?:CONST_)?METHOD\\d+(?:_T)?\\((?:\\S+,)?\\s*$'", ",", "arg_0", ".", "elided", "[", "arg_1", "-", "1", "]", ")", "or", "Match", "(", "r'^\\s*MOCK_(?:CONST_)?METHOD\\d+(?:_T)?\\(\\s*$'", ",", "arg_0", ".", "elided", "[", "arg_1", "-", "2", "]", ")", "or", "Search", "(", "r'\\bstd::m?function\\s*\\<\\s*$'", ",", "arg_0", ".", "elided", "[", "arg_1", "-", "1", "]", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Checks whether where function type arguments are expected.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n\n  Returns:\n    True if the line at 'linenum' is inside something that expects arguments\n    of function types.\n  \"\"\"\n  arg_2 = arg_0.elided[arg_1]\n  return (Match(r'^\\s*MOCK_(CONST_)?METHOD\\d+(_T)?\\(', arg_2) or\n          (arg_1 >= 2 and\n           (Match(r'^\\s*MOCK_(?:CONST_)?METHOD\\d+(?:_T)?\\((?:\\S+,)?\\s*$',\n                  arg_0.elided[arg_1 - 1]) or\n            Match(r'^\\s*MOCK_(?:CONST_)?METHOD\\d+(?:_T)?\\(\\s*$',\n                  arg_0.elided[arg_1 - 2]) or\n            Search(r'\\bstd::m?function\\s*\\<\\s*$',\n                   arg_0.elided[arg_1 - 1]))))", "path": "third_party/python/cpplint/cpplint.py", "identifier": "ExpectingFunctionArgs", "docstring": "Checks whether where function type arguments are expected.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n\n  Returns:\n    True if the line at 'linenum' is inside something that expects arguments\n    of function types.", "docstring_tokens": ["Checks", "whether", "where", "function", "type", "arguments", "are", "expected", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256821}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L4356-L4360", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Removes a link from disk", "language": "python", "parameters": "(self, link_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "_trajectory_name", "+", "'/'", "+", "arg_1", ".", "replace", "(", "'.'", ",", "'/'", ")", "arg_3", "=", "arg_0", ".", "_hdf5file", ".", "get_node", "(", "where", "=", "arg_2", ")", "arg_3", ".", "_f_remove", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Removes a link from disk\"\"\"\n        arg_2 = '/' + arg_0._trajectory_name + '/' + arg_1.replace('.','/')\n        arg_3 = arg_0._hdf5file.get_node(where=arg_2)\n        arg_3._f_remove()", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._lnk_delete_link", "docstring": "Removes a link from disk", "docstring_tokens": ["Removes", "a", "link", "from", "disk"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256822}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/permutations_runner.py#L275-L304", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Starts a swarm, given a path to a JSON file containing configuration.", "language": "python", "parameters": "(expJsonFilePath, options, outputLabel, permWorkDir)", "return_statement": "return runWithConfig(expJsonConfig, options, outDir=outDir,\n                       outputLabel=outputLabel, permWorkDir=permWorkDir,\n                       verbosity=verbosity)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "\"verbosityCount\"", "in", "arg_1", ":", "arg_4", "=", "arg_1", "[", "\"verbosityCount\"", "]", "del", "arg_1", "[", "\"verbosityCount\"", "]", "else", ":", "arg_4", "=", "1", "_setupInterruptHandling", "(", ")", "with", "open", "(", "arg_0", ",", "\"r\"", ")", "as", "jsonFile", ":", "arg_5", "=", "json", ".", "loads", "(", "jsonFile", ".", "read", "(", ")", ")", "arg_6", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "return", "runWithConfig", "(", "arg_5", ",", "arg_1", ",", "arg_6", "=", "arg_6", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"\n  Starts a swarm, given a path to a JSON file containing configuration.\n\n  This function is meant to be used with a CLI wrapper that passes command line\n  arguments in through the options parameter.\n\n  @param expJsonFilePath {string} Path to a JSON file containing the complete\n                                 [swarm description](http://nupic.docs.numenta.org/0.7.0.dev0/guides/swarming/running.html#the-swarm-description).\n  @param options {dict} CLI options.\n  @param outputLabel {string} Label for output.\n  @param permWorkDir {string} Location of working directory.\n\n  @returns {int} Swarm job id.\n  \"\"\"\n  if \"verbosityCount\" in arg_1:\n    arg_4 = arg_1[\"verbosityCount\"]\n    del arg_1[\"verbosityCount\"]\n  else:\n    arg_4 = 1\n\n  _setupInterruptHandling()\n\n  with open(arg_0, \"r\") as jsonFile:\n    arg_5 = json.loads(jsonFile.read())\n\n  arg_6 = os.path.dirname(arg_0)\n  return runWithConfig(arg_5, arg_1, arg_6=arg_6,\n                       arg_2=arg_2, arg_3=arg_3,\n                       arg_4=arg_4)", "path": "src/nupic/swarming/permutations_runner.py", "identifier": "runWithJsonFile", "docstring": "Starts a swarm, given a path to a JSON file containing configuration.\n\n  This function is meant to be used with a CLI wrapper that passes command line\n  arguments in through the options parameter.\n\n  @param expJsonFilePath {string} Path to a JSON file containing the complete\n                                 [swarm description](http://nupic.docs.numenta.org/0.7.0.dev0/guides/swarming/running.html#the-swarm-description).\n  @param options {dict} CLI options.\n  @param outputLabel {string} Label for output.\n  @param permWorkDir {string} Location of working directory.\n\n  @returns {int} Swarm job id.", "docstring_tokens": ["Starts", "a", "swarm", "given", "a", "path", "to", "a", "JSON", "file", "containing", "configuration", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256823}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L268-L287", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Add a linked file.", "language": "python", "parameters": "(self, file_path, relpath=None, mimetype=None,\n                        time_origin=None, ex_from=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "MIMES", "[", "arg_1", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "]", "arg_0", ".", "media_descriptors", ".", "append", "(", "{", "'MEDIA_URL'", ":", "arg_1", ",", "'RELATIVE_MEDIA_URL'", ":", "arg_2", ",", "'MIME_TYPE'", ":", "arg_3", ",", "'TIME_ORIGIN'", ":", "arg_4", ",", "'EXTRACTED_FROM'", ":", "arg_5", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                        arg_4=None, arg_5=None):\n        \"\"\"Add a linked file.\n\n        :param str file_path: Path of the file.\n        :param str relpath: Relative path of the file.\n        :param str mimetype: Mimetype of the file, if ``None`` it tries to\n            guess it according to the file extension which currently only works\n            for wav, mpg, mpeg and xml.\n        :param int time_origin: Time origin for the media file.\n        :param str ex_from: Extracted from field.\n        :raises KeyError: If mimetype had to be guessed and a non standard\n                          extension or an unknown mimetype.\n        \"\"\"\n        if arg_3 is None:\n            arg_3 = arg_0.MIMES[arg_1.split('.')[-1]]\n        arg_0.media_descriptors.append({\n            'MEDIA_URL': arg_1, 'RELATIVE_MEDIA_URL': arg_2,\n            'MIME_TYPE': arg_3, 'TIME_ORIGIN': arg_4,\n            'EXTRACTED_FROM': arg_5})", "path": "pympi/Elan.py", "identifier": "Eaf.add_linked_file", "docstring": "Add a linked file.\n\n        :param str file_path: Path of the file.\n        :param str relpath: Relative path of the file.\n        :param str mimetype: Mimetype of the file, if ``None`` it tries to\n            guess it according to the file extension which currently only works\n            for wav, mpg, mpeg and xml.\n        :param int time_origin: Time origin for the media file.\n        :param str ex_from: Extracted from field.\n        :raises KeyError: If mimetype had to be guessed and a non standard\n                          extension or an unknown mimetype.", "docstring_tokens": ["Add", "a", "linked", "file", "."], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 256824}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/inversion/pixelizations.py#L150-L169", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Determine the geometry of the rectangular grid, by overlaying it over a grid of coordinates such that its \\\n         outer-most pixels align with the grid's outer most coordinates plus a small buffer.", "language": "python", "parameters": "(self, grid, buffer=1e-8)", "return_statement": "return self.Geometry(shape=self.shape, pixel_scales=pixel_scales, origin=origin,\n                             pixel_neighbors=pixel_neighbors, pixel_neighbors_size=pixel_neighbors_size)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1e-8", ")", ":", "arg_3", "=", "np", ".", "min", "(", "arg_1", "[", ":", ",", "0", "]", ")", "-", "arg_2", "arg_4", "=", "np", ".", "max", "(", "arg_1", "[", ":", ",", "0", "]", ")", "+", "arg_2", "arg_5", "=", "np", ".", "min", "(", "arg_1", "[", ":", ",", "1", "]", ")", "-", "arg_2", "arg_6", "=", "np", ".", "max", "(", "arg_1", "[", ":", ",", "1", "]", ")", "+", "arg_2", "arg_7", "=", "(", "float", "(", "(", "arg_4", "-", "arg_3", ")", "/", "arg_0", ".", "shape", "[", "0", "]", ")", ",", "float", "(", "(", "arg_6", "-", "arg_5", ")", "/", "arg_0", ".", "shape", "[", "1", "]", ")", ")", "arg_8", "=", "(", "(", "arg_4", "+", "arg_3", ")", "/", "2.0", ",", "(", "arg_6", "+", "arg_5", ")", "/", "2.0", ")", "arg_9", ",", "arg_10", "=", "arg_0", ".", "neighbors_from_pixelization", "(", ")", "return", "arg_0", ".", "Geometry", "(", "shape", "=", "arg_0", ".", "shape", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2=1e-8):\n        \"\"\"Determine the geometry of the rectangular grid, by overlaying it over a grid of coordinates such that its \\\n         outer-most pixels align with the grid's outer most coordinates plus a small buffer.\n\n        Parameters\n        -----------\n        grid : ndarray\n            The (y,x) grid of coordinates over which the rectangular pixelization is placed to determine its geometry.\n        buffer : float\n            The size the pixelization is buffered relative to the grid.\n        \"\"\"\n        arg_3 = np.min(arg_1[:, 0]) - arg_2\n        arg_4 = np.max(arg_1[:, 0]) + arg_2\n        arg_5 = np.min(arg_1[:, 1]) - arg_2\n        arg_6 = np.max(arg_1[:, 1]) + arg_2\n        arg_7 = (float((arg_4 - arg_3) / arg_0.shape[0]), float((arg_6 - arg_5) / arg_0.shape[1]))\n        arg_8 = ((arg_4 + arg_3) / 2.0, (arg_6 + arg_5) / 2.0)\n        arg_9, arg_10 = arg_0.neighbors_from_pixelization()\n        return arg_0.Geometry(shape=arg_0.shape, arg_7=arg_7, arg_8=arg_8,\n                             arg_9=arg_9, arg_10=arg_10)", "path": "autolens/model/inversion/pixelizations.py", "identifier": "Rectangular.geometry_from_grid", "docstring": "Determine the geometry of the rectangular grid, by overlaying it over a grid of coordinates such that its \\\n         outer-most pixels align with the grid's outer most coordinates plus a small buffer.\n\n        Parameters\n        -----------\n        grid : ndarray\n            The (y,x) grid of coordinates over which the rectangular pixelization is placed to determine its geometry.\n        buffer : float\n            The size the pixelization is buffered relative to the grid.", "docstring_tokens": ["Determine", "the", "geometry", "of", "the", "rectangular", "grid", "by", "overlaying", "it", "over", "a", "grid", "of", "coordinates", "such", "that", "its", "\\", "outer", "-", "most", "pixels", "align", "with", "the", "grid", "s", "outer", "most", "coordinates", "plus", "a", "small", "buffer", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 256825}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/statemanagerfactory.py#L50-L78", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Creates all the zookeeper state_managers and returns\n  them in a list", "language": "python", "parameters": "(conf)", "return_statement": "return state_managers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", ".", "get_state_locations_of_type", "(", "\"zookeeper\"", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "arg_3", "[", "'name'", "]", "arg_5", "=", "arg_3", "[", "'hostport'", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_5", ".", "split", "(", "','", ")", ":", "arg_8", "=", "None", "arg_9", "=", "None", "if", "':'", "in", "arg_5", ":", "arg_10", "=", "arg_7", ".", "split", "(", "':'", ")", "if", "len", "(", "arg_10", ")", "==", "2", ":", "arg_8", "=", "arg_10", "[", "0", "]", "arg_9", "=", "int", "(", "arg_10", "[", "1", "]", ")", "if", "not", "arg_8", "or", "not", "arg_9", ":", "raise", "Exception", "(", "\"Hostport for %s must be of the format 'host:port'.\"", "%", "(", "arg_4", ")", ")", "arg_6", ".", "append", "(", "(", "arg_8", ",", "arg_9", ")", ")", "arg_11", "=", "arg_3", "[", "'tunnelhost'", "]", "arg_12", "=", "arg_3", "[", "'rootpath'", "]", "LOG", ".", "info", "(", "\"Connecting to zk hostports: \"", "+", "str", "(", "arg_6", ")", "+", "\" rootpath: \"", "+", "arg_12", ")", "arg_13", "=", "ZkStateManager", "(", "arg_4", ",", "arg_6", ",", "arg_12", ",", "arg_11", ")", "arg_1", ".", "append", "(", "arg_13", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"\n  Creates all the zookeeper state_managers and returns\n  them in a list\n  \"\"\"\n  arg_1 = []\n  arg_2 = arg_0.get_state_locations_of_type(\"zookeeper\")\n  for arg_3 in arg_2:\n    arg_4 = arg_3['name']\n    arg_5 = arg_3['hostport']\n    arg_6 = []\n    for arg_7 in arg_5.split(','):\n      arg_8 = None\n      arg_9 = None\n      if ':' in arg_5:\n        arg_10 = arg_7.split(':')\n        if len(arg_10) == 2:\n          arg_8 = arg_10[0]\n          arg_9 = int(arg_10[1])\n      if not arg_8 or not arg_9:\n        raise Exception(\"Hostport for %s must be of the format 'host:port'.\" % (arg_4))\n      arg_6.append((arg_8, arg_9))\n    arg_11 = arg_3['tunnelhost']\n    arg_12 = arg_3['rootpath']\n    LOG.info(\"Connecting to zk hostports: \" + str(arg_6) + \" rootpath: \" + arg_12)\n    arg_13 = ZkStateManager(arg_4, arg_6, arg_12, arg_11)\n    arg_1.append(arg_13)\n\n  return arg_1", "path": "heron/statemgrs/src/python/statemanagerfactory.py", "identifier": "get_all_zk_state_managers", "docstring": "Creates all the zookeeper state_managers and returns\n  them in a list", "docstring_tokens": ["Creates", "all", "the", "zookeeper", "state_managers", "and", "returns", "them", "in", "a", "list"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256826}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/perf_attrib.py#L151-L216", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Compute daily risk factor exposures.", "language": "python", "parameters": "(positions, factor_loadings, stack_positions=True,\n                      pos_in_dollars=True)", "return_statement": "return ep.compute_exposures(positions, factor_loadings)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "if", "arg_2", ":", "arg_0", "=", "_stack_positions", "(", "arg_0", ",", "arg_3", "=", "arg_3", ")", "return", "ep", ".", "Func", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=True,\n                      arg_3=True):\n    \"\"\"\n    Compute daily risk factor exposures.\n\n    Normalizes positions (if necessary) and calls ep.Func.\n    See empyrical.Func for more info.\n\n    Parameters\n    ----------\n    positions: pd.DataFrame or pd.Series\n        Daily holdings (in dollars or percentages), indexed by date, OR\n        a series of holdings indexed by date and ticker.\n        - Examples:\n                        AAPL  TLT  XOM  cash\n            2017-01-01    34   58   10     0\n            2017-01-02    22   77   18     0\n            2017-01-03   -15   27   30    15\n\n                            AAPL       TLT       XOM  cash\n            2017-01-01  0.333333  0.568627  0.098039   0.0\n            2017-01-02  0.188034  0.658120  0.153846   0.0\n            2017-01-03  0.208333  0.375000  0.416667   0.0\n\n            dt          ticker\n            2017-01-01  AAPL      0.417582\n                        TLT       0.010989\n                        XOM       0.571429\n            2017-01-02  AAPL      0.202381\n                        TLT       0.535714\n                        XOM       0.261905\n\n    factor_loadings : pd.DataFrame\n        Factor loadings for all days in the date range, with date and ticker as\n        index, and factors as columns.\n        - Example:\n                               momentum  reversal\n            dt         ticker\n            2017-01-01 AAPL   -1.592914  0.852830\n                       TLT     0.184864  0.895534\n                       XOM     0.993160  1.149353\n            2017-01-02 AAPL   -0.140009 -0.524952\n                       TLT    -1.066978  0.185435\n                       XOM    -1.798401  0.761549\n\n    stack_positions : bool\n        Flag indicating whether `positions` should be converted to long format.\n\n    pos_in_dollars : bool\n        Flag indicating whether `positions` are in dollars or percentages\n        If True, positions are in dollars.\n\n    Returns\n    -------\n    risk_exposures_portfolio : pd.DataFrame\n        df indexed by datetime, with factors as columns.\n        - Example:\n                        momentum  reversal\n            dt\n            2017-01-01 -0.238655  0.077123\n            2017-01-02  0.821872  1.520515\n    \"\"\"\n    if arg_2:\n        arg_0 = _stack_positions(arg_0, arg_3=arg_3)\n\n    return ep.Func(arg_0, arg_1)", "path": "pyfolio/perf_attrib.py", "identifier": "compute_exposures", "docstring": "Compute daily risk factor exposures.\n\n    Normalizes positions (if necessary) and calls ep.compute_exposures.\n    See empyrical.compute_exposures for more info.\n\n    Parameters\n    ----------\n    positions: pd.DataFrame or pd.Series\n        Daily holdings (in dollars or percentages), indexed by date, OR\n        a series of holdings indexed by date and ticker.\n        - Examples:\n                        AAPL  TLT  XOM  cash\n            2017-01-01    34   58   10     0\n            2017-01-02    22   77   18     0\n            2017-01-03   -15   27   30    15\n\n                            AAPL       TLT       XOM  cash\n            2017-01-01  0.333333  0.568627  0.098039   0.0\n            2017-01-02  0.188034  0.658120  0.153846   0.0\n            2017-01-03  0.208333  0.375000  0.416667   0.0\n\n            dt          ticker\n            2017-01-01  AAPL      0.417582\n                        TLT       0.010989\n                        XOM       0.571429\n            2017-01-02  AAPL      0.202381\n                        TLT       0.535714\n                        XOM       0.261905\n\n    factor_loadings : pd.DataFrame\n        Factor loadings for all days in the date range, with date and ticker as\n        index, and factors as columns.\n        - Example:\n                               momentum  reversal\n            dt         ticker\n            2017-01-01 AAPL   -1.592914  0.852830\n                       TLT     0.184864  0.895534\n                       XOM     0.993160  1.149353\n            2017-01-02 AAPL   -0.140009 -0.524952\n                       TLT    -1.066978  0.185435\n                       XOM    -1.798401  0.761549\n\n    stack_positions : bool\n        Flag indicating whether `positions` should be converted to long format.\n\n    pos_in_dollars : bool\n        Flag indicating whether `positions` are in dollars or percentages\n        If True, positions are in dollars.\n\n    Returns\n    -------\n    risk_exposures_portfolio : pd.DataFrame\n        df indexed by datetime, with factors as columns.\n        - Example:\n                        momentum  reversal\n            dt\n            2017-01-01 -0.238655  0.077123\n            2017-01-02  0.821872  1.520515", "docstring_tokens": ["Compute", "daily", "risk", "factor", "exposures", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 256827}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/discovery.py#L102-L123", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Traverse a paginated API response and extracts and concatenates \"results\" returned by API.", "language": "python", "parameters": "(response, endpoint, content_filter_query, query_params)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get", "(", "'results'", ",", "[", "]", ")", "arg_5", "=", "1", "while", "arg_0", ".", "get", "(", "'next'", ")", ":", "arg_5", "+=", "1", "arg_0", "=", "arg_1", "(", ")", ".", "post", "(", "arg_2", ",", "**", "dict", "(", "arg_3", ",", "arg_5", "=", "arg_5", ")", ")", "arg_4", "+=", "arg_0", ".", "get", "(", "'results'", ",", "[", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Traverse a paginated API response and extracts and concatenates \"results\" returned by API.\n\n        Arguments:\n            response (dict): API response object.\n            endpoint (Slumber.Resource): API endpoint object.\n            content_filter_query (dict): query parameters used to filter catalog results.\n            query_params (dict): query parameters used to paginate results.\n\n        Returns:\n            list: all the results returned by the API.\n        \"\"\"\n        arg_4 = arg_0.get('results', [])\n\n        arg_5 = 1\n        while arg_0.get('next'):\n            arg_5 += 1\n            arg_0 = arg_1().post(arg_2, **dict(arg_3, arg_5=arg_5))\n            arg_4 += arg_0.get('results', [])\n\n        return arg_4", "path": "enterprise/api_client/discovery.py", "identifier": "CourseCatalogApiClient.traverse_pagination", "docstring": "Traverse a paginated API response and extracts and concatenates \"results\" returned by API.\n\n        Arguments:\n            response (dict): API response object.\n            endpoint (Slumber.Resource): API endpoint object.\n            content_filter_query (dict): query parameters used to filter catalog results.\n            query_params (dict): query parameters used to paginate results.\n\n        Returns:\n            list: all the results returned by the API.", "docstring_tokens": ["Traverse", "a", "paginated", "API", "response", "and", "extracts", "and", "concatenates", "results", "returned", "by", "API", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256828}
{"url": "https://github.com/bmcfee/muda/blob/ff82efdfaeb98da0a9f9124845826eb20536a9ba/muda/base.py#L306-L325", "sha": "ff82efdfaeb98da0a9f9124845826eb20536a9ba", "docstring_summary": "A serial transformation union", "language": "python", "parameters": "(self, jam, steps)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "six", ".", "PY2", ":", "arg_3", "=", "'next'", "else", ":", "arg_3", "=", "'__next__'", "arg_4", "=", "len", "(", "arg_2", ")", "arg_5", "=", "itertools", ".", "cycle", "(", "getattr", "(", "iter", "(", "D", ".", "transform", "(", "arg_1", ")", ")", ",", "arg_3", ")", "for", "(", "name", ",", "D", ")", "in", "arg_2", ")", "while", "arg_4", ":", "try", ":", "for", "arg_6", "in", "arg_5", ":", "yield", "arg_6", "(", ")", "except", "StopIteration", ":", "arg_4", "-=", "1", "arg_5", "=", "itertools", ".", "cycle", "(", "itertools", ".", "islice", "(", "arg_5", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''A serial transformation union'''\n        # This uses the round-robin itertools recipe\n\n        if six.PY2:\n            arg_3 = 'next'\n        else:\n            arg_3 = '__next__'\n\n        arg_4 = len(arg_2)\n        arg_5 = itertools.cycle(getattr(iter(D.transform(arg_1)), arg_3)\n                                for (name, D) in arg_2)\n\n        while arg_4:\n            try:\n                for arg_6 in arg_5:\n                    yield arg_6()\n            except StopIteration:\n                arg_4 -= 1\n                arg_5 = itertools.cycle(itertools.islice(arg_5, arg_4))", "path": "muda/base.py", "identifier": "Union.__serial_transform", "docstring": "A serial transformation union", "docstring_tokens": ["A", "serial", "transformation", "union"], "nwo": "bmcfee/muda", "score": 0.6916969030525102, "idx": 256829}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L398-L462", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper which checks validity of a scalar `distribution` init arg.", "language": "python", "parameters": "(distribution, expected_base_dtype,\n                                    validate_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "dtype", "!=", "arg_1", ":", "raise", "TypeError", "(", "\"dtype mismatch; \"", "\"distribution.dtype=\\\"{}\\\" is not \\\"{}\\\"\"", ".", "format", "(", "dtype_util", ".", "name", "(", "arg_0", ".", "dtype", ")", ",", "dtype_util", ".", "name", "(", "arg_1", ")", ")", ")", "if", "arg_2", "and", "(", "arg_0", ".", "reparameterization_type", "!=", "reparameterization", ".", "FULLY_REPARAMETERIZED", ")", ":", "raise", "ValueError", "(", "\"Base distribution should be reparameterized or be \"", "\"a function of non-trainable variables; \"", "\"distribution.reparameterization_type = \\\"{}\\\" \"", "\"!= \\\"FULLY_REPARAMETERIZED\\\".\"", ".", "format", "(", "arg_0", ".", "reparameterization_type", ")", ")", "with", "tf", ".", "name_scope", "(", "\"check_distribution\"", ")", ":", "arg_3", "=", "[", "]", "def", "check_is_scalar", "(", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "tf", ".", "get_static_value", "(", "arg_4", ")", "if", "arg_6", "is", "not", "None", ":", "if", "not", "arg_6", ":", "raise", "ValueError", "(", "\"distribution must be scalar; \"", "\"distribution.{}=False is not True\"", ".", "format", "(", "arg_5", ")", ")", "elif", "arg_2", ":", "arg_3", ".", "append", "(", "assert_util", ".", "assert_equal", "(", "arg_4", ",", "True", ",", "message", "=", "(", "\"distribution must be scalar; \"", "\"distribution.{}=False is not True\"", ".", "format", "(", "arg_5", ")", ")", ")", ")", "check_is_scalar", "(", "arg_0", ".", "is_scalar_event", "(", ")", ",", "\"is_scalar_event\"", ")", "check_is_scalar", "(", "arg_0", ".", "is_scalar_batch", "(", ")", ",", "\"is_scalar_batch\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1,\n                                    arg_2):\n  \"\"\"Helper which checks validity of a scalar `distribution` init arg.\n\n  Valid here means:\n\n  * `distribution` has scalar batch and event shapes.\n  * `distribution` is `FULLY_REPARAMETERIZED`\n  * `distribution` has expected dtype.\n\n  Args:\n    distribution:  `Distribution`-like object.\n    expected_base_dtype:  `TensorFlow` `dtype`.\n    validate_args:  Python `bool`.  Whether to do additional checks: (i)  check\n      that reparameterization_type is `FULLY_REPARAMETERIZED`. (ii) add\n      `tf.Assert` ops to the graph to enforce that distribution is scalar in the\n      event that this cannot be determined statically.\n\n  Returns:\n    List of `tf.Assert` ops to run to enforce validity checks that could not\n      be statically determined.  Empty if `not validate_args`.\n\n  Raises:\n    ValueError:  If validate_args and distribution is not FULLY_REPARAMETERIZED\n    ValueError:  If distribution is statically determined to not have both\n      scalar batch and scalar event shapes.\n  \"\"\"\n  if arg_0.dtype != arg_1:\n    raise TypeError(\"dtype mismatch; \"\n                    \"distribution.dtype=\\\"{}\\\" is not \\\"{}\\\"\".format(\n                        dtype_util.name(arg_0.dtype),\n                        dtype_util.name(arg_1)))\n\n  # Although `reparameterization_type` is a static property, we guard it by\n  # `validate_args`. This allows users to use a `distribution` which is not\n  # reparameterized itself. However, we tacitly assume that although the\n  # distribution is not reparameterized, it only depends on non-trainable\n  # variables.\n  if arg_2 and (arg_0.reparameterization_type !=\n                        reparameterization.FULLY_REPARAMETERIZED):\n    raise ValueError(\"Base distribution should be reparameterized or be \"\n                     \"a function of non-trainable variables; \"\n                     \"distribution.reparameterization_type = \\\"{}\\\" \"\n                     \"!= \\\"FULLY_REPARAMETERIZED\\\".\".format(\n                         arg_0.reparameterization_type))\n  with tf.name_scope(\"check_distribution\"):\n    arg_3 = []\n\n    def check_is_scalar(arg_4, arg_5):\n      arg_6 = tf.get_static_value(arg_4)\n      if arg_6 is not None:\n        if not arg_6:\n          raise ValueError(\"distribution must be scalar; \"\n                           \"distribution.{}=False is not True\".format(arg_5))\n      elif arg_2:\n        arg_3.append(\n            assert_util.assert_equal(\n                arg_4,\n                True,\n                message=(\"distribution must be scalar; \"\n                         \"distribution.{}=False is not True\".format(arg_5))))\n\n    check_is_scalar(arg_0.is_scalar_event(), \"is_scalar_event\")\n    check_is_scalar(arg_0.is_scalar_batch(), \"is_scalar_batch\")\n    return arg_3", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "maybe_check_scalar_distribution", "docstring": "Helper which checks validity of a scalar `distribution` init arg.\n\n  Valid here means:\n\n  * `distribution` has scalar batch and event shapes.\n  * `distribution` is `FULLY_REPARAMETERIZED`\n  * `distribution` has expected dtype.\n\n  Args:\n    distribution:  `Distribution`-like object.\n    expected_base_dtype:  `TensorFlow` `dtype`.\n    validate_args:  Python `bool`.  Whether to do additional checks: (i)  check\n      that reparameterization_type is `FULLY_REPARAMETERIZED`. (ii) add\n      `tf.Assert` ops to the graph to enforce that distribution is scalar in the\n      event that this cannot be determined statically.\n\n  Returns:\n    List of `tf.Assert` ops to run to enforce validity checks that could not\n      be statically determined.  Empty if `not validate_args`.\n\n  Raises:\n    ValueError:  If validate_args and distribution is not FULLY_REPARAMETERIZED\n    ValueError:  If distribution is statically determined to not have both\n      scalar batch and scalar event shapes.", "docstring_tokens": ["Helper", "which", "checks", "validity", "of", "a", "scalar", "distribution", "init", "arg", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256830}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/stats/quantiles.py#L626-L723", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Compute quantiles of `x` along `axis`.", "language": "python", "parameters": "(x,\n              num_quantiles,\n              axis=None,\n              interpolation=None,\n              keep_dims=False,\n              validate_args=False,\n              name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_6", ",", "'Func'", ",", "values", "=", "[", "arg_0", ",", "arg_1", ",", "arg_2", "]", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_6", "=", "'x'", ")", "return", "percentile", "(", "arg_0", ",", "q", "=", "tf", ".", "linspace", "(", "tf", ".", "convert_to_tensor", "(", "value", "=", "0", ",", "dtype", "=", "tf", ".", "float64", ")", ",", "tf", ".", "convert_to_tensor", "(", "value", "=", "100", ",", "dtype", "=", "tf", ".", "float64", ")", ",", "num", "=", "arg_1", "+", "1", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "preserve_gradients", "=", "False", ")"], "function": "def Func(arg_0,\n              arg_1,\n              arg_2=None,\n              arg_3=None,\n              arg_4=False,\n              arg_5=False,\n              arg_6=None):\n  \"\"\"Compute Func of `x` along `axis`.\n\n  The Func of a distribution are cut points dividing the range into\n  intervals with equal probabilities.\n\n  Given a vector `x` of samples, this function estimates the cut points by\n  returning `num_Func + 1` cut points, `(c0, ..., cn)`, such that, roughly\n  speaking, equal number of sample points lie in the `num_Func` intervals\n  `[c0, c1), [c1, c2), ..., [c_{n-1}, cn]`.  That is,\n\n  * About `1 / n` fraction of the data lies in `[c_{k-1}, c_k)`, `k = 1, ..., n`\n  * About `k / n` fraction of the data lies below `c_k`.\n  * `c0` is the sample minimum and `cn` is the maximum.\n\n  The exact number of data points in each interval depends on the size of\n  `x` (e.g. whether the size is divisible by `n`) and the `interpolation` kwarg.\n\n  Args:\n    x:  Numeric `N-D` `Tensor` with `N > 0`.  If `axis` is not `None`,\n      `x` must have statically known number of dimensions.\n    num_Func:  Scalar `integer` `Tensor`.  The number of intervals the\n      returned `num_Func + 1` cut points divide the range into.\n    axis:  Optional `0-D` or `1-D` integer `Tensor` with constant values. The\n      axis that index independent samples over which to return the desired\n      percentile.  If `None` (the default), treat every dimension as a sample\n      dimension, returning a scalar.\n    interpolation : {'nearest', 'linear', 'lower', 'higher', 'midpoint'}.\n      Default value: 'nearest'.  This specifies the interpolation method to\n      use when the fractions `k / n` lie between two data points `i < j`:\n        * linear: i + (j - i) * fraction, where fraction is the fractional part\n          of the index surrounded by i and j.\n        * lower: `i`.\n        * higher: `j`.\n        * nearest: `i` or `j`, whichever is nearest.\n        * midpoint: (i + j) / 2. `linear` and `midpoint` interpolation do not\n          work with integer dtypes.\n    keep_dims:  Python `bool`. If `True`, the last dimension is kept with size 1\n      If `False`, the last dimension is removed from the output shape.\n    validate_args:  Whether to add runtime checks of argument validity. If\n      False, and arguments are incorrect, correct behavior is not guaranteed.\n    name:  A Python string name to give this `Op`.  Default is 'percentile'\n\n  Returns:\n    cut_points:  A `rank(x) + 1 - len(axis)` dimensional `Tensor` with same\n    `dtype` as `x` and shape `[num_Func + 1, ...]` where the trailing shape\n    is that of `x` without the dimensions in `axis` (unless `keep_dims is True`)\n\n  Raises:\n    ValueError:  If argument 'interpolation' is not an allowed type.\n    ValueError:  If interpolation type not compatible with `dtype`.\n\n  #### Examples\n\n  ```python\n  # Get quartiles of x with various interpolation choices.\n  x = [0.,  1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.]\n\n  tfp.stats.Func(x, num_Func=4, interpolation='nearest')\n  ==> [  0.,   2.,   5.,   8.,  10.]\n\n  tfp.stats.Func(x, num_Func=4, interpolation='linear')\n  ==> [  0. ,   2.5,   5. ,   7.5,  10. ]\n\n  tfp.stats.Func(x, num_Func=4, interpolation='lower')\n  ==> [  0.,   2.,   5.,   7.,  10.]\n\n  # Get deciles of columns of an R x C data set.\n  data = load_my_columnar_data(...)\n  tfp.stats.Func(data, num_Func=10)\n  ==> Shape [11, C] Tensor\n  ```\n\n  \"\"\"\n  with tf.compat.v1.name_scope(\n      arg_6, 'Func', values=[arg_0, arg_1, arg_2]):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_6='x')\n    return percentile(\n        arg_0,\n        q=tf.linspace(\n            # percentile casts q to float64 before using it...so may as well use\n            # float64 here. Note that  using x.dtype won't work with linspace\n            # if x is integral type (which is anothe motivation for hard-coding\n            # float64).\n            tf.convert_to_tensor(value=0, dtype=tf.float64),\n            tf.convert_to_tensor(value=100, dtype=tf.float64),\n            num=arg_1 + 1),\n        arg_2=arg_2,\n        arg_3=arg_3,\n        arg_4=arg_4,\n        arg_5=arg_5,\n        preserve_gradients=False)", "path": "tensorflow_probability/python/stats/quantiles.py", "identifier": "quantiles", "docstring": "Compute quantiles of `x` along `axis`.\n\n  The quantiles of a distribution are cut points dividing the range into\n  intervals with equal probabilities.\n\n  Given a vector `x` of samples, this function estimates the cut points by\n  returning `num_quantiles + 1` cut points, `(c0, ..., cn)`, such that, roughly\n  speaking, equal number of sample points lie in the `num_quantiles` intervals\n  `[c0, c1), [c1, c2), ..., [c_{n-1}, cn]`.  That is,\n\n  * About `1 / n` fraction of the data lies in `[c_{k-1}, c_k)`, `k = 1, ..., n`\n  * About `k / n` fraction of the data lies below `c_k`.\n  * `c0` is the sample minimum and `cn` is the maximum.\n\n  The exact number of data points in each interval depends on the size of\n  `x` (e.g. whether the size is divisible by `n`) and the `interpolation` kwarg.\n\n  Args:\n    x:  Numeric `N-D` `Tensor` with `N > 0`.  If `axis` is not `None`,\n      `x` must have statically known number of dimensions.\n    num_quantiles:  Scalar `integer` `Tensor`.  The number of intervals the\n      returned `num_quantiles + 1` cut points divide the range into.\n    axis:  Optional `0-D` or `1-D` integer `Tensor` with constant values. The\n      axis that index independent samples over which to return the desired\n      percentile.  If `None` (the default), treat every dimension as a sample\n      dimension, returning a scalar.\n    interpolation : {'nearest', 'linear', 'lower', 'higher', 'midpoint'}.\n      Default value: 'nearest'.  This specifies the interpolation method to\n      use when the fractions `k / n` lie between two data points `i < j`:\n        * linear: i + (j - i) * fraction, where fraction is the fractional part\n          of the index surrounded by i and j.\n        * lower: `i`.\n        * higher: `j`.\n        * nearest: `i` or `j`, whichever is nearest.\n        * midpoint: (i + j) / 2. `linear` and `midpoint` interpolation do not\n          work with integer dtypes.\n    keep_dims:  Python `bool`. If `True`, the last dimension is kept with size 1\n      If `False`, the last dimension is removed from the output shape.\n    validate_args:  Whether to add runtime checks of argument validity. If\n      False, and arguments are incorrect, correct behavior is not guaranteed.\n    name:  A Python string name to give this `Op`.  Default is 'percentile'\n\n  Returns:\n    cut_points:  A `rank(x) + 1 - len(axis)` dimensional `Tensor` with same\n    `dtype` as `x` and shape `[num_quantiles + 1, ...]` where the trailing shape\n    is that of `x` without the dimensions in `axis` (unless `keep_dims is True`)\n\n  Raises:\n    ValueError:  If argument 'interpolation' is not an allowed type.\n    ValueError:  If interpolation type not compatible with `dtype`.\n\n  #### Examples\n\n  ```python\n  # Get quartiles of x with various interpolation choices.\n  x = [0.,  1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.]\n\n  tfp.stats.quantiles(x, num_quantiles=4, interpolation='nearest')\n  ==> [  0.,   2.,   5.,   8.,  10.]\n\n  tfp.stats.quantiles(x, num_quantiles=4, interpolation='linear')\n  ==> [  0. ,   2.5,   5. ,   7.5,  10. ]\n\n  tfp.stats.quantiles(x, num_quantiles=4, interpolation='lower')\n  ==> [  0.,   2.,   5.,   7.,  10.]\n\n  # Get deciles of columns of an R x C data set.\n  data = load_my_columnar_data(...)\n  tfp.stats.quantiles(data, num_quantiles=10)\n  ==> Shape [11, C] Tensor\n  ```", "docstring_tokens": ["Compute", "quantiles", "of", "x", "along", "axis", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256831}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L378-L396", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "Test if this module ignores the file at \"path\", which must be a\n            path relative to the root of the module.", "language": "python", "parameters": "(self, path)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "PurePath", "(", "'/'", ",", "arg_1", ")", "arg_3", "=", "tuple", "(", "[", "arg_2", "]", "+", "list", "(", "arg_2", ".", "parents", ")", ")", "for", "arg_4", "in", "arg_0", ".", "ignore_patterns", ":", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", ".", "match", "(", "arg_4", ")", ":", "logger", ".", "debug", "(", "'\"%s\" ignored (\"%s\" matched \"%s\")'", ",", "arg_1", ",", "arg_5", ",", "arg_4", ")", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        ''' Test if this module Func the file at \"path\", which must be a\n            path relative to the root of the module.\n\n            If a file is within a directory that is ignored, the file is also\n            ignored.\n        '''\n        arg_2 = PurePath('/', arg_1)\n\n        # also check any parent directories of this path against the ignore\n        # patterns:\n        arg_3 = tuple([arg_2] + list(arg_2.parents))\n\n        for arg_4 in arg_0.ignore_patterns:\n            for arg_5 in arg_3:\n                if arg_5.match(arg_4):\n                    logger.debug('\"%s\" ignored (\"%s\" matched \"%s\")', arg_1, arg_5, arg_4)\n                    return True\n        return False", "path": "yotta/lib/pack.py", "identifier": "Pack.ignores", "docstring": "Test if this module ignores the file at \"path\", which must be a\n            path relative to the root of the module.\n\n            If a file is within a directory that is ignored, the file is also\n            ignored.", "docstring_tokens": ["Test", "if", "this", "module", "ignores", "the", "file", "at", "path", "which", "must", "be", "a", "path", "relative", "to", "the", "root", "of", "the", "module", "."], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 256832}
{"url": "https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5json.py#L119-L154", "sha": "3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8", "docstring_summary": "Translates a deprecated GML 2.0 geometry to GeoJSON", "language": "python", "parameters": "(el)", "return_statement": "return {\n        'type': tag,\n        'coordinates': coordinates\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "tag", ".", "replace", "(", "'{%s}'", "%", "NS_GML", ",", "''", ")", "if", "arg_1", "==", "'Point'", ":", "arg_2", "=", "[", "float", "(", "c", ")", "for", "c", "in", "arg_0", ".", "findtext", "(", "'{%s}coordinates'", "%", "NS_GML", ")", ".", "split", "(", "','", ")", "]", "elif", "arg_1", "==", "'LineString'", ":", "arg_2", "=", "[", "[", "float", "(", "arg_4", ")", "for", "arg_4", "in", "arg_5", ".", "split", "(", "','", ")", "]", "for", "arg_5", "in", "arg_0", ".", "findtext", "(", "'{%s}coordinates'", "%", "NS_GML", ")", ".", "split", "(", "' '", ")", "]", "elif", "arg_1", "==", "'Polygon'", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "xpath", "(", "'gml:outerBoundaryIs/gml:LinearRing/gml:coordinates'", ",", "namespaces", "=", "NSMAP", ")", "+", "arg_0", ".", "xpath", "(", "'gml:innerBoundaryIs/gml:LinearRing/gml:coordinates'", ",", "namespaces", "=", "NSMAP", ")", ":", "arg_2", ".", "append", "(", "[", "[", "float", "(", "arg_4", ")", "for", "arg_4", "in", "arg_5", ".", "split", "(", "','", ")", "]", "for", "arg_5", "in", "arg_3", ".", "text", ".", "split", "(", "' '", ")", "]", ")", "elif", "arg_1", "in", "(", "'MultiPoint'", ",", "'MultiLineString'", ",", "'MultiPolygon'", ",", "'MultiCurve'", ")", ":", "if", "arg_1", "==", "'MultiCurve'", ":", "arg_6", "=", "'LineString'", "arg_7", "=", "'curveMember'", "else", ":", "arg_6", "=", "arg_1", "[", "5", ":", "]", "arg_7", "=", "arg_6", "[", "0", "]", ".", "lower", "(", ")", "+", "arg_6", "[", "1", ":", "]", "+", "'Member'", "arg_2", "=", "[", "gml_to_geojson", "(", "member", ")", "[", "'coordinates'", "]", "for", "member", "in", "arg_0", ".", "xpath", "(", "'gml:%s/gml:%s'", "%", "(", "arg_7", ",", "arg_6", ")", ",", "namespaces", "=", "NSMAP", ")", "]", "else", ":", "raise", "NotImplementedError", "return", "{", "'type'", ":", "arg_1", ",", "'coordinates'", ":", "arg_2", "}"], "function": "def Func(arg_0):\n    \"\"\"Translates a deprecated GML 2.0 geometry to GeoJSON\"\"\"\n    arg_1 = arg_0.tag.replace('{%s}' % NS_GML, '')\n    if arg_1 == 'Point':\n        arg_2 = [float(c) for c in arg_0.findtext('{%s}coordinates' % NS_GML).split(',')]\n    elif arg_1 == 'LineString':\n        arg_2 = [\n            [float(arg_4) for arg_4 in arg_5.split(',')]\n            for arg_5 in arg_0.findtext('{%s}coordinates' % NS_GML).split(' ')\n        ]\n    elif arg_1 == 'Polygon':\n        arg_2 = []\n        for arg_3 in arg_0.xpath('gml:outerBoundaryIs/gml:LinearRing/gml:coordinates', namespaces=NSMAP) \\\n                + arg_0.xpath('gml:innerBoundaryIs/gml:LinearRing/gml:coordinates', namespaces=NSMAP):\n            arg_2.append([\n                [float(arg_4) for arg_4 in arg_5.split(',')]\n                for arg_5 in arg_3.text.split(' ')\n            ])\n    elif arg_1 in ('MultiPoint', 'MultiLineString', 'MultiPolygon', 'MultiCurve'):\n        if arg_1 == 'MultiCurve':\n            arg_6 = 'LineString'\n            arg_7 = 'curveMember'\n        else:\n            arg_6 = arg_1[5:]\n            arg_7 = arg_6[0].lower() + arg_6[1:] + 'Member'\n        arg_2 = [\n            gml_to_geojson(member)['coordinates']\n            for member in arg_0.xpath('gml:%s/gml:%s' % (arg_7, arg_6), namespaces=NSMAP)\n        ]\n    else:\n        raise NotImplementedError\n\n    return {\n        'type': arg_1,\n        'coordinates': arg_2\n    }", "path": "open511/converter/o5json.py", "identifier": "_gmlv2_to_geojson", "docstring": "Translates a deprecated GML 2.0 geometry to GeoJSON", "docstring_tokens": ["Translates", "a", "deprecated", "GML", "2", ".", "0", "geometry", "to", "GeoJSON"], "nwo": "open511/open511", "score": 0.138843686048881, "idx": 256833}
{"url": "https://github.com/marazt/object-mapper/blob/b02c6d68c5bf86462aa8080aff3e93b133afd43e/mapper/casedict.py#L73-L89", "sha": "b02c6d68c5bf86462aa8080aff3e93b133afd43e", "docstring_summary": "Removes the specified key and returns the corresponding value.\n        If key is not found, the default is returned if given, otherwise KeyError is raised.", "language": "python", "parameters": "(self, key, default=_sentinel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "if", "arg_2", "is", "not", "arg_3", ":", "arg_4", "=", "arg_0", ".", "_data", ".", "Func", "(", "arg_1", ".", "lower", "(", ")", ",", "arg_2", ")", "else", ":", "arg_4", "=", "arg_0", ".", "_data", ".", "Func", "(", "arg_1", ".", "lower", "(", ")", ")", "if", "arg_4", "is", "not", "arg_2", ":", "return", "arg_4", "[", "1", "]", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n        \"\"\"\n        Removes the specified key and returns the corresponding value.\n        If key is not found, the default is returned if given, otherwise KeyError is raised.\n\n        :param key: The key\n        :param default: The default value\n        :return: The value\n        \"\"\"\n        if arg_2 is not arg_3:\n            arg_4 = arg_0._data.Func(arg_1.lower(), arg_2)\n        else:\n            arg_4 = arg_0._data.Func(arg_1.lower())\n        if arg_4 is not arg_2:\n            return arg_4[1]\n        else:\n            return arg_2", "path": "mapper/casedict.py", "identifier": "CaseDict.pop", "docstring": "Removes the specified key and returns the corresponding value.\n        If key is not found, the default is returned if given, otherwise KeyError is raised.\n\n        :param key: The key\n        :param default: The default value\n        :return: The value", "docstring_tokens": ["Removes", "the", "specified", "key", "and", "returns", "the", "corresponding", "value", ".", "If", "key", "is", "not", "found", "the", "default", "is", "returned", "if", "given", "otherwise", "KeyError", "is", "raised", "."], "nwo": "marazt/object-mapper", "score": 0.3710893161082627, "idx": 256834}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1205-L1234", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Extracts returns based on interesting events. See\n    gen_date_range_interesting.", "language": "python", "parameters": "(returns)", "return_statement": "return ranges", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "copy", "(", ")", "arg_1", ".", "index", "=", "arg_1", ".", "index", ".", "map", "(", "pd", ".", "Timestamp", ")", "arg_3", "=", "OrderedDict", "(", ")", "for", "arg_4", ",", "(", "arg_5", ",", "arg_6", ")", "in", "PERIODS", ".", "items", "(", ")", ":", "try", ":", "arg_7", "=", "arg_1", ".", "loc", "[", "arg_5", ":", "arg_6", "]", "if", "len", "(", "arg_7", ")", "==", "0", ":", "continue", "arg_3", "[", "arg_4", "]", "=", "arg_7", "except", "BaseException", ":", "continue", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Extracts returns based on interesting events. See\n    gen_date_range_interesting.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n\n    Returns\n    -------\n    ranges : OrderedDict\n        Date ranges, with returns, of all valid events.\n    \"\"\"\n\n    arg_1 = arg_0.copy()\n    arg_1.index = arg_1.index.map(pd.Timestamp)\n    arg_3 = OrderedDict()\n    for arg_4, (arg_5, arg_6) in PERIODS.items():\n        try:\n            arg_7 = arg_1.loc[arg_5:arg_6]\n            if len(arg_7) == 0:\n                continue\n            arg_3[arg_4] = arg_7\n        except BaseException:\n            continue\n\n    return arg_3", "path": "pyfolio/timeseries.py", "identifier": "extract_interesting_date_ranges", "docstring": "Extracts returns based on interesting events. See\n    gen_date_range_interesting.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n\n    Returns\n    -------\n    ranges : OrderedDict\n        Date ranges, with returns, of all valid events.", "docstring_tokens": ["Extracts", "returns", "based", "on", "interesting", "events", ".", "See", "gen_date_range_interesting", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 256835}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/util.py#L242-L288", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find the full dotted package name for a given python source file\n    name. Returns None if the file is not a python source file.", "language": "python", "parameters": "(filename)", "return_statement": "return '.'.join(mod_parts)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "src", "(", "arg_0", ")", "if", "not", "arg_1", ".", "endswith", "(", "'.py'", ")", "and", "not", "ispackage", "(", "arg_1", ")", ":", "return", "None", "arg_2", ",", "arg_3", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "arg_1", ")", ")", "if", "arg_2", "==", "'__init__'", ":", "arg_4", "=", "[", "]", "else", ":", "arg_4", "=", "[", "arg_2", "]", "arg_5", ",", "arg_6", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "split", "(", "arg_1", ")", "[", "0", "]", ")", "while", "arg_6", ":", "if", "ispackage", "(", "os", ".", "path", ".", "join", "(", "arg_5", ",", "arg_6", ")", ")", ":", "arg_4", ".", "append", "(", "arg_6", ")", "else", ":", "break", "arg_5", ",", "arg_6", "=", "os", ".", "path", ".", "split", "(", "arg_5", ")", "arg_4", ".", "reverse", "(", ")", "return", "'.'", ".", "join", "(", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Find the full dotted package name for a given python source file\n    name. Returns None if the file is not a python source file.\n\n    >>> Func('foo.py')\n    'foo'\n    >>> Func('biff/baf.py')\n    'baf'\n    >>> Func('nose/util.py')\n    'nose.util'\n\n    Works for directories too.\n\n    >>> Func('nose')\n    'nose'\n    >>> Func('nose/plugins')\n    'nose.plugins'\n\n    And __init__ files stuck onto directories\n\n    >>> Func('nose/plugins/__init__.py')\n    'nose.plugins'\n\n    Absolute paths also work.\n\n    >>> path = os.path.abspath(os.path.join('nose', 'plugins'))\n    >>> Func(path)\n    'nose.plugins'\n    \"\"\"\n    arg_1 = src(arg_0)\n    if not arg_1.endswith('.py') and not ispackage(arg_1):\n        return None\n    arg_2, arg_3 = os.path.splitext(os.path.basename(arg_1))\n    if arg_2 == '__init__':\n        arg_4 = []\n    else:\n        arg_4 = [arg_2]\n    arg_5, arg_6 = os.path.split(os.path.split(arg_1)[0])\n    while arg_6:\n        if ispackage(os.path.join(arg_5, arg_6)):\n            arg_4.append(arg_6)\n        else:\n            break\n        arg_5, arg_6 = os.path.split(arg_5)\n    arg_4.reverse()\n    return '.'.join(arg_4)", "path": "environment/lib/python2.7/site-packages/nose/util.py", "identifier": "getpackage", "docstring": "Find the full dotted package name for a given python source file\n    name. Returns None if the file is not a python source file.\n\n    >>> getpackage('foo.py')\n    'foo'\n    >>> getpackage('biff/baf.py')\n    'baf'\n    >>> getpackage('nose/util.py')\n    'nose.util'\n\n    Works for directories too.\n\n    >>> getpackage('nose')\n    'nose'\n    >>> getpackage('nose/plugins')\n    'nose.plugins'\n\n    And __init__ files stuck onto directories\n\n    >>> getpackage('nose/plugins/__init__.py')\n    'nose.plugins'\n\n    Absolute paths also work.\n\n    >>> path = os.path.abspath(os.path.join('nose', 'plugins'))\n    >>> getpackage(path)\n    'nose.plugins'", "docstring_tokens": ["Find", "the", "full", "dotted", "package", "name", "for", "a", "given", "python", "source", "file", "name", ".", "Returns", "None", "if", "the", "file", "is", "not", "a", "python", "source", "file", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256836}
{"url": "https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L509-L548", "sha": "08e0319ff3c70f8a931dfa8890caf48add4d0470", "docstring_summary": "Get summary and description of this notebook", "language": "python", "parameters": "(self)", "return_statement": "return header, desc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "split_header", "(", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_1", "=", "arg_1", ".", "lstrip", "(", ")", ".", "rstrip", "(", ")", "arg_3", "=", "arg_1", ".", "splitlines", "(", ")", "if", "arg_3", "[", "0", "]", ".", "startswith", "(", "'#'", ")", ":", "if", "arg_2", ":", "arg_4", "=", "re", ".", "sub", "(", "'#+\\s*'", ",", "''", ",", "arg_3", ".", "pop", "(", "0", ")", ")", "if", "not", "arg_3", ":", "return", "arg_4", ",", "''", "else", ":", "arg_4", "=", "''", "arg_5", "=", "'\\n'", ".", "join", "(", "arg_3", ")", ".", "lstrip", "(", ")", ".", "split", "(", "'\\n\\n'", ")", "arg_6", "=", "arg_5", "[", "0", "]", ".", "replace", "(", "'\\n'", ",", "' '", ")", "return", "arg_4", ",", "arg_6", "else", ":", "if", "arg_2", ":", "if", "arg_3", "[", "0", "]", ".", "startswith", "(", "(", "'='", ",", "'-'", ")", ")", ":", "arg_3", "=", "arg_3", "[", "1", ":", "]", "arg_4", "=", "arg_3", ".", "pop", "(", "0", ")", "if", "arg_3", "and", "arg_3", "[", "0", "]", ".", "startswith", "(", "(", "'='", ",", "'-'", ")", ")", ":", "arg_3", ".", "pop", "(", "0", ")", "if", "not", "arg_3", ":", "return", "arg_4", ",", "''", "else", ":", "arg_4", "=", "''", "arg_5", "=", "'\\n'", ".", "join", "(", "arg_3", ")", ".", "lstrip", "(", ")", ".", "split", "(", "'\\n\\n'", ")", "arg_6", "=", "arg_5", "[", "0", "]", ".", "replace", "(", "'\\n'", ",", "' '", ")", "return", "arg_4", ",", "arg_6", "arg_7", "=", "arg_0", ".", "nb", "[", "'cells'", "]", "[", "0", "]", "if", "not", "arg_7", "[", "'cell_type'", "]", "==", "'markdown'", ":", "return", "''", ",", "''", "arg_4", ",", "arg_6", "=", "split_header", "(", "arg_7", "[", "'source'", "]", ")", "if", "not", "arg_6", "and", "len", "(", "arg_0", ".", "nb", "[", "'cells'", "]", ")", ">", "1", ":", "arg_8", "=", "arg_0", ".", "nb", "[", "'cells'", "]", "[", "1", "]", "if", "arg_8", "[", "'cell_type'", "]", "==", "'markdown'", ":", "arg_9", ",", "arg_6", "=", "split_header", "(", "arg_8", "[", "'source'", "]", ",", "False", ")", "return", "arg_4", ",", "arg_6"], "function": "def Func(arg_0):\n        \"\"\"Get summary and description of this notebook\"\"\"\n        def split_header(arg_1, arg_2=True):\n            arg_1 = arg_1.lstrip().rstrip()\n            arg_3 = arg_1.splitlines()\n            if arg_3[0].startswith('#'):\n                if arg_2:\n                    arg_4 = re.sub('#+\\s*', '', arg_3.pop(0))\n                    if not arg_3:\n                        return arg_4, ''\n                else:\n                    arg_4 = ''\n                arg_5 = '\\n'.join(arg_3).lstrip().split('\\n\\n')\n                arg_6 = arg_5[0].replace('\\n', ' ')\n                return arg_4, arg_6\n            else:\n                if arg_2:\n                    if arg_3[0].startswith(('=', '-')):\n                        arg_3 = arg_3[1:]\n                    arg_4 = arg_3.pop(0)\n                    if arg_3 and arg_3[0].startswith(('=', '-')):\n                        arg_3.pop(0)\n                    if not arg_3:\n                        return arg_4, ''\n                else:\n                    arg_4 = ''\n                arg_5 = '\\n'.join(arg_3).lstrip().split('\\n\\n')\n                arg_6 = arg_5[0].replace('\\n', ' ')\n                return arg_4, arg_6\n\n        arg_7 = arg_0.nb['cells'][0]\n\n        if not arg_7['cell_type'] == 'markdown':\n            return '', ''\n        arg_4, arg_6 = split_header(arg_7['source'])\n        if not arg_6 and len(arg_0.nb['cells']) > 1:\n            arg_8 = arg_0.nb['cells'][1]\n            if arg_8['cell_type'] == 'markdown':\n                arg_9, arg_6 = split_header(arg_8['source'], False)\n        return arg_4, arg_6", "path": "sphinx_nbexamples/__init__.py", "identifier": "NotebookProcessor.get_description", "docstring": "Get summary and description of this notebook", "docstring_tokens": ["Get", "summary", "and", "description", "of", "this", "notebook"], "nwo": "Chilipp/sphinx-nbexamples", "score": 0.28168436607245656, "idx": 256837}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/result.py#L54-L89", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Returns how the result count compares to the query options.", "language": "python", "parameters": "(self)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "query", ".", "options", "[", "\"count\"", "]", "is", "not", "None", ":", "arg_1", "=", "int", "(", "arg_0", ".", "query", ".", "options", "[", "\"count\"", "]", ")", "arg_0", ".", "_cache_at_least", "(", "arg_1", "+", "1", ")", "return", "cmp", "(", "len", "(", "arg_0", ".", "_result_cache", ")", ",", "arg_1", ")", "if", "arg_0", ".", "query", ".", "options", "[", "\"minimum\"", "]", "is", "not", "None", ":", "arg_2", "=", "int", "(", "arg_0", ".", "query", ".", "options", "[", "\"minimum\"", "]", ")", "if", "not", "arg_0", ".", "_cache_at_least", "(", "arg_2", ")", ":", "return", "-", "1", "if", "arg_0", ".", "query", ".", "options", "[", "\"maximum\"", "]", "is", "not", "None", ":", "arg_3", "=", "int", "(", "arg_0", ".", "query", ".", "options", "[", "\"maximum\"", "]", ")", "if", "arg_0", ".", "_cache_at_least", "(", "arg_3", "+", "1", ")", ":", "return", "1", "if", "arg_0", ".", "query", ".", "options", "[", "\"between\"", "]", "is", "not", "None", ":", "arg_4", "=", "arg_0", ".", "query", ".", "options", "[", "\"between\"", "]", "arg_2", ",", "arg_3", "=", "arg_4", "[", "0", "]", ",", "arg_4", "[", "-", "1", "]", "if", "not", "arg_0", ".", "_cache_at_least", "(", "arg_2", ")", ":", "return", "-", "1", "if", "arg_0", ".", "_cache_at_least", "(", "arg_3", "+", "1", ")", ":", "return", "1", "return", "0", "return", "0"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns how the result count compares to the query options.\n\n        The return value is negative if too few results were found, zero if enough were found, and\n        positive if too many were found.\n\n        Returns:\n            int: -1, 0, or 1.\n        \"\"\"\n\n        if arg_0.query.options[\"count\"] is not None:\n            arg_1 = int(arg_0.query.options[\"count\"])\n            arg_0._cache_at_least(arg_1 + 1)\n            return cmp(len(arg_0._result_cache), arg_1)\n\n        if arg_0.query.options[\"minimum\"] is not None:\n            arg_2 = int(arg_0.query.options[\"minimum\"])\n            if not arg_0._cache_at_least(arg_2):\n                return -1\n\n        if arg_0.query.options[\"maximum\"] is not None:\n            arg_3 = int(arg_0.query.options[\"maximum\"])\n            if arg_0._cache_at_least(arg_3 + 1):\n                return 1\n\n        if arg_0.query.options[\"between\"] is not None:\n            arg_4 = arg_0.query.options[\"between\"]\n            arg_2, arg_3 = arg_4[0], arg_4[-1]\n            if not arg_0._cache_at_least(arg_2):\n                return -1\n            if arg_0._cache_at_least(arg_3 + 1):\n                return 1\n            return 0\n\n        return 0", "path": "capybara/result.py", "identifier": "Result.compare_count", "docstring": "Returns how the result count compares to the query options.\n\n        The return value is negative if too few results were found, zero if enough were found, and\n        positive if too many were found.\n\n        Returns:\n            int: -1, 0, or 1.", "docstring_tokens": ["Returns", "how", "the", "result", "count", "compares", "to", "the", "query", "options", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 256838}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_submgr.py#L219-L223", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Error message when subcommand asked for but doesn't exist", "language": "python", "parameters": "(self, cmd, subcmd)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "proc", ".", "intf", "[", "-", "1", "]", ".", "errmsg", "(", "(", "'Undefined \"%s\" subcommand: \"%s\". '", "+", "'Try \"help %s *\".'", ")", "%", "(", "arg_1", ",", "arg_2", ",", "arg_1", ")", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Error message when subcommand asked for but doesn't exist\"\"\"\n        arg_0.proc.intf[-1].errmsg(('Undefined \"%s\" subcommand: \"%s\". ' +\n                                  'Try \"help %s *\".') % (arg_1, arg_2, arg_1))\n        return", "path": "trepan/processor/command/base_submgr.py", "identifier": "SubcommandMgr.undefined_subcmd", "docstring": "Error message when subcommand asked for but doesn't exist", "docstring_tokens": ["Error", "message", "when", "subcommand", "asked", "for", "but", "doesn", "t", "exist"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 256839}
{"url": "https://github.com/rodluger/pysyzygy/blob/d2b64251047cc0f0d0adeb6feab4054e7fce4b7a/pysyzygy/transit.py#L546-L569", "sha": "d2b64251047cc0f0d0adeb6feab4054e7fce4b7a", "docstring_summary": "Frees the memory used by all of the dynamically allocated C arrays.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "arrays", ".", "_calloc", ":", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_time", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_flux", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_bflx", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_M", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_E", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_f", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_r", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_x", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_y", ")", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_z", ")", "arg_0", ".", "arrays", ".", "_calloc", "=", "0", "if", "arg_0", ".", "arrays", ".", "_balloc", ":", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_b", ")", "arg_0", ".", "arrays", ".", "_balloc", "=", "0", "if", "arg_0", ".", "arrays", ".", "_ialloc", ":", "_dbl_free", "(", "arg_0", ".", "arrays", ".", "_iarr", ")", "arg_0", ".", "arrays", ".", "_ialloc", "=", "0"], "function": "def Func(arg_0):\n    '''\n    Funcs the memory used by all of the dynamically allocated C arrays.\n    \n    '''\n\n    if arg_0.arrays._calloc:\n      _dbl_free(arg_0.arrays._time)\n      _dbl_free(arg_0.arrays._flux)\n      _dbl_free(arg_0.arrays._bflx)\n      _dbl_free(arg_0.arrays._M)\n      _dbl_free(arg_0.arrays._E)\n      _dbl_free(arg_0.arrays._f)\n      _dbl_free(arg_0.arrays._r)\n      _dbl_free(arg_0.arrays._x)\n      _dbl_free(arg_0.arrays._y)\n      _dbl_free(arg_0.arrays._z)\n      arg_0.arrays._calloc = 0\n    if arg_0.arrays._balloc:  \n      _dbl_free(arg_0.arrays._b)\n      arg_0.arrays._balloc = 0\n    if arg_0.arrays._ialloc:\n      _dbl_free(arg_0.arrays._iarr)\n      arg_0.arrays._ialloc = 0", "path": "pysyzygy/transit.py", "identifier": "Transit.Free", "docstring": "Frees the memory used by all of the dynamically allocated C arrays.", "docstring_tokens": ["Frees", "the", "memory", "used", "by", "all", "of", "the", "dynamically", "allocated", "C", "arrays", "."], "nwo": "rodluger/pysyzygy", "score": 0.17821439704321745, "idx": 256840}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/magic.py#L543-L610", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Parse options passed to an argument string.", "language": "python", "parameters": "(self, arg_str, opt_str, *long_opts, **kw)", "return_statement": "return opts,args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_code", ".", "co_name", "arg_1", "=", "'%s %s'", "%", "(", "arg_0", ".", "options_table", ".", "get", "(", "arg_5", ",", "''", ")", ",", "arg_1", ")", "arg_6", "=", "arg_4", ".", "get", "(", "'mode'", ",", "'string'", ")", "if", "arg_6", "not", "in", "[", "'string'", ",", "'list'", "]", ":", "raise", "ValueError", ",", "'incorrect mode given: %s'", "%", "arg_6", "arg_7", "=", "arg_4", ".", "get", "(", "'list_all'", ",", "0", ")", "arg_8", "=", "arg_4", ".", "get", "(", "'posix'", ",", "os", ".", "name", "==", "'posix'", ")", "arg_9", "=", "arg_4", ".", "get", "(", "'strict'", ",", "True", ")", "arg_10", "=", "{", "}", "arg_11", "=", "arg_1", ".", "split", "(", ")", "if", "len", "(", "arg_11", ")", ">=", "1", ":", "arg_12", "=", "arg_split", "(", "arg_1", ",", "arg_8", ",", "arg_9", ")", "try", ":", "arg_13", ",", "arg_11", "=", "getopt", "(", "arg_12", ",", "arg_2", ",", "arg_3", ")", "except", "GetoptError", ",", "e", ":", "raise", "UsageError", "(", "'%s ( allowed: \"%s\" %s)'", "%", "(", "e", ".", "msg", ",", "arg_2", ",", "\" \"", ".", "join", "(", "arg_3", ")", ")", ")", "for", "arg_14", ",", "arg_15", "in", "arg_13", ":", "if", "arg_14", ".", "startswith", "(", "'--'", ")", ":", "arg_14", "=", "arg_14", "[", "2", ":", "]", "else", ":", "arg_14", "=", "arg_14", "[", "1", ":", "]", "try", ":", "arg_10", "[", "arg_14", "]", ".", "append", "(", "arg_15", ")", "except", "AttributeError", ":", "arg_10", "[", "arg_14", "]", "=", "[", "arg_10", "[", "arg_14", "]", ",", "arg_15", "]", "except", "KeyError", ":", "if", "arg_7", ":", "arg_10", "[", "arg_14", "]", "=", "[", "arg_15", "]", "else", ":", "arg_10", "[", "arg_14", "]", "=", "arg_15", "arg_13", "=", "Struct", "(", "arg_10", ")", "if", "arg_6", "==", "'string'", ":", "arg_11", "=", "' '", ".", "join", "(", "arg_11", ")", "return", "arg_13", ",", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        \"\"\"Parse options passed to an argument string.\n\n        The interface is similar to that of getopt(), but it returns back a\n        Struct with the options as keys and the stripped argument string still\n        as a string.\n\n        arg_str is quoted as a true sys.argv vector by using shlex.split.\n        This allows us to easily expand variables, glob files, quote\n        arguments, etc.\n\n        Options:\n          -mode: default 'string'. If given as 'list', the argument string is\n          returned as a list (split on whitespace) instead of a string.\n\n          -list_all: put all option values in lists. Normally only options\n          appearing more than once are put in a list.\n\n          -posix (True): whether to split the input line in POSIX mode or not,\n          as per the conventions outlined in the shlex module from the\n          standard library.\"\"\"\n\n        # inject default options at the beginning of the input line\n        arg_5 = sys._getframe(1).f_code.co_name\n        arg_1 = '%s %s' % (arg_0.options_table.get(arg_5,''),arg_1)\n\n        arg_6 = arg_4.get('mode','string')\n        if arg_6 not in ['string','list']:\n            raise ValueError,'incorrect mode given: %s' % arg_6\n        # Get options\n        arg_7 = arg_4.get('list_all',0)\n        arg_8 = arg_4.get('posix', os.name == 'posix')\n        arg_9 = arg_4.get('strict', True)\n\n        # Check if we have more than one argument to warrant extra processing:\n        arg_10 = {}  # Dictionary with options\n        arg_11 = arg_1.split()\n        if len(arg_11) >= 1:\n            # If the list of inputs only has 0 or 1 thing in it, there's no\n            # need to look for options\n            arg_12 = arg_split(arg_1, arg_8, arg_9)\n            # Do regular option processing\n            try:\n                arg_13,arg_11 = getopt(arg_12, arg_2, arg_3)\n            except GetoptError,e:\n                raise UsageError('%s ( allowed: \"%s\" %s)' % (e.msg,arg_2,\n                                        \" \".join(arg_3)))\n            for arg_14,arg_15 in arg_13:\n                if arg_14.startswith('--'):\n                    arg_14 = arg_14[2:]\n                else:\n                    arg_14 = arg_14[1:]\n                try:\n                    arg_10[arg_14].append(arg_15)\n                except AttributeError:\n                    arg_10[arg_14] = [arg_10[arg_14],arg_15]\n                except KeyError:\n                    if arg_7:\n                        arg_10[arg_14] = [arg_15]\n                    else:\n                        arg_10[arg_14] = arg_15\n\n        # Prepare opts,args for return\n        arg_13 = Struct(arg_10)\n        if arg_6 == 'string':\n            arg_11 = ' '.join(arg_11)\n\n        return arg_13,arg_11", "path": "environment/lib/python2.7/site-packages/IPython/core/magic.py", "identifier": "Magics.parse_options", "docstring": "Parse options passed to an argument string.\n\n        The interface is similar to that of getopt(), but it returns back a\n        Struct with the options as keys and the stripped argument string still\n        as a string.\n\n        arg_str is quoted as a true sys.argv vector by using shlex.split.\n        This allows us to easily expand variables, glob files, quote\n        arguments, etc.\n\n        Options:\n          -mode: default 'string'. If given as 'list', the argument string is\n          returned as a list (split on whitespace) instead of a string.\n\n          -list_all: put all option values in lists. Normally only options\n          appearing more than once are put in a list.\n\n          -posix (True): whether to split the input line in POSIX mode or not,\n          as per the conventions outlined in the shlex module from the\n          standard library.", "docstring_tokens": ["Parse", "options", "passed", "to", "an", "argument", "string", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256841}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/samples/virtual_dav_provider.py#L323-L332", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Change semantic of COPY to add resource tags.", "language": "python", "parameters": "(self, dest_path, depth_infinity)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "\"/by_tag/\"", "not", "in", "arg_1", ":", "raise", "DAVError", "(", "HTTP_FORBIDDEN", ")", "arg_3", ",", "arg_4", ",", "arg_5", "=", "util", ".", "save_split", "(", "arg_1", ".", "strip", "(", "\"/\"", ")", ",", "\"/\"", ",", "2", ")", "assert", "arg_3", "==", "\"by_tag\"", "if", "arg_4", "not", "in", "arg_0", ".", "data", "[", "\"tags\"", "]", ":", "arg_0", ".", "data", "[", "\"tags\"", "]", ".", "append", "(", "arg_4", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Change semantic of COPY to add resource tags.\"\"\"\n        # destPath must be '/by_tag/<tag>/<resname>'\n        if \"/by_tag/\" not in arg_1:\n            raise DAVError(HTTP_FORBIDDEN)\n        arg_3, arg_4, arg_5 = util.save_split(arg_1.strip(\"/\"), \"/\", 2)\n        assert arg_3 == \"by_tag\"\n        if arg_4 not in arg_0.data[\"tags\"]:\n            arg_0.data[\"tags\"].append(arg_4)\n        return True", "path": "wsgidav/samples/virtual_dav_provider.py", "identifier": "VirtualResource.handle_copy", "docstring": "Change semantic of COPY to add resource tags.", "docstring_tokens": ["Change", "semantic", "of", "COPY", "to", "add", "resource", "tags", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 256842}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L139-L147", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Return true if the IP address is in octal notation.", "language": "python", "parameters": "(ip)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "int", "(", "str", "(", "arg_0", ")", ",", "8", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "return", "False", "if", "arg_1", ">", "0o37777777777", "or", "arg_1", "<", "0", ":", "return", "False", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"Return true if the IP address is in octal notation.\"\"\"\n    try:\n        arg_1 = int(str(arg_0), 8)\n    except (TypeError, ValueError):\n        return False\n    if arg_1 > 0o37777777777 or arg_1 < 0:\n        return False\n    return True", "path": "iplib.py", "identifier": "is_oct", "docstring": "Return true if the IP address is in octal notation.", "docstring_tokens": ["Return", "true", "if", "the", "IP", "address", "is", "in", "octal", "notation", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 256843}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L450-L459", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get a list of all locations", "language": "python", "parameters": "(self, timeout: int=None)", "return_statement": "return self._get_model(url, timeout=timeout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "api", ".", "LOCATIONS", "return", "arg_0", ".", "_get_model", "(", "arg_3", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2=None):\n        \"\"\"Get a list of all locations\n\n        Parameters\n        ----------\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_3 = arg_0.api.LOCATIONS\n        return arg_0._get_model(arg_3, arg_1=arg_1)", "path": "clashroyale/official_api/client.py", "identifier": "Client.get_all_locations", "docstring": "Get a list of all locations\n\n        Parameters\n        ----------\n        timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "a", "list", "of", "all", "locations"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 256844}
{"url": "https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L470-L478", "sha": "2a725df0b727e8b08f217ab84f7b8243c42554f5", "docstring_summary": "Returns NetSpeed name from hostname. Can be Unknown, Dial-up,\n        Cable, or Corporate.", "language": "python", "parameters": "(self, hostname)", "return_statement": "return self.netspeed_by_addr(addr)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_gethostbyname", "(", "arg_1", ")", "return", "arg_0", ".", "netspeed_by_addr", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns NetSpeed name from hostname. Can be Unknown, Dial-up,\n        Cable, or Corporate.\n\n        :arg hostname: Hostname (e.g. example.com)\n        \"\"\"\n        arg_2 = arg_0._gethostbyname(arg_1)\n        return arg_0.netspeed_by_addr(arg_2)", "path": "pygeoip/__init__.py", "identifier": "GeoIP.netspeed_by_name", "docstring": "Returns NetSpeed name from hostname. Can be Unknown, Dial-up,\n        Cable, or Corporate.\n\n        :arg hostname: Hostname (e.g. example.com)", "docstring_tokens": ["Returns", "NetSpeed", "name", "from", "hostname", ".", "Can", "be", "Unknown", "Dial", "-", "up", "Cable", "or", "Corporate", "."], "nwo": "appliedsec/pygeoip", "score": 0.7204224841353906, "idx": 256845}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/linear_prediction.py#L164-L180", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Convert reflection coefficients to inverse sine parameters.", "language": "python", "parameters": "(k)", "return_statement": "return (2/numpy.pi)*numpy.arcsin(k)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "numpy", ".", "isrealobj", "(", "arg_0", ")", ",", "'Inverse sine parameters not defined for complex reflection coefficients.'", "if", "max", "(", "numpy", ".", "abs", "(", "arg_0", ")", ")", ">=", "1", ":", "raise", "ValueError", "(", "'All reflection coefficients should have magnitude less than unity.'", ")", "return", "(", "2", "/", "numpy", ".", "pi", ")", "*", "numpy", ".", "arcsin", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Convert reflection coefficients to inverse sine parameters.\n\n    :param k: reflection coefficients\n    :return: inverse sine parameters\n\n    .. seealso:: :func:`is2rc`, :func:`rc2poly`, :func:`rc2acC`, :func:`rc2lar`.\n\n    Reference: J.R. Deller, J.G. Proakis, J.H.L. Hansen, \"Discrete-Time\n       Processing of Speech Signals\", Prentice Hall, Section 7.4.5.\n\n    \"\"\"\n    assert numpy.isrealobj(arg_0), 'Inverse sine parameters not defined for complex reflection coefficients.'\n    if max(numpy.abs(arg_0)) >= 1:\n        raise ValueError('All reflection coefficients should have magnitude less than unity.')\n\n    return (2/numpy.pi)*numpy.arcsin(arg_0)", "path": "src/spectrum/linear_prediction.py", "identifier": "rc2is", "docstring": "Convert reflection coefficients to inverse sine parameters.\n\n    :param k: reflection coefficients\n    :return: inverse sine parameters\n\n    .. seealso:: :func:`is2rc`, :func:`rc2poly`, :func:`rc2acC`, :func:`rc2lar`.\n\n    Reference: J.R. Deller, J.G. Proakis, J.H.L. Hansen, \"Discrete-Time\n       Processing of Speech Signals\", Prentice Hall, Section 7.4.5.", "docstring_tokens": ["Convert", "reflection", "coefficients", "to", "inverse", "sine", "parameters", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 256846}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botframework-connector/azure_bdist_wheel.py#L190-L200", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Return archive name without extension", "language": "python", "parameters": "(self)", "return_statement": "return archive_basename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", ".", "get_tag", "(", ")", "arg_4", "=", "\"%s-%s-%s-%s\"", "%", "(", "arg_0", ".", "wheel_dist_name", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"Return archive name without extension\"\"\"\n\n        arg_1, arg_2, arg_3 = arg_0.get_tag()\n\n        arg_4 = \"%s-%s-%s-%s\" % (\n            arg_0.wheel_dist_name,\n            arg_1,\n            arg_2,\n            arg_3)\n        return arg_4", "path": "libraries/botframework-connector/azure_bdist_wheel.py", "identifier": "bdist_wheel.get_archive_basename", "docstring": "Return archive name without extension", "docstring_tokens": ["Return", "archive", "name", "without", "extension"], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 256847}
{"url": "https://github.com/altaurog/pgcopy/blob/0f97ff1b2940cf27a3e6963749bf3d26efd1608f/pgcopy/copy.py#L54-L89", "sha": "0f97ff1b2940cf27a3e6963749bf3d26efd1608f", "docstring_summary": "NBASE = 1000\n    ndigits = total number of base-NBASE digits\n    weight = base-NBASE weight of first digit\n    sign = 0x0000 if positive, 0x4000 if negative, 0xC000 if nan\n    dscale = decimal digits after decimal place", "language": "python", "parameters": "(_, n)", "return_statement": "return ('ihhHH%dH' % ndigits, [2 * len(data)] + data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_1", ".", "as_tuple", "(", ")", "except", "AttributeError", ":", "raise", "TypeError", "(", "'Func field requires Decimal value (got %r)'", "%", "arg_1", ")", "arg_3", "=", "[", "]", "if", "isinstance", "(", "arg_2", ".", "exponent", ",", "str", ")", ":", "arg_4", "=", "0", "arg_5", "=", "0", "arg_6", "=", "0xC000", "arg_7", "=", "0", "else", ":", "arg_8", "=", "list", "(", "reversed", "(", "arg_2", ".", "digits", "+", "(", "arg_2", ".", "exponent", "%", "4", ")", "*", "(", "0", ",", ")", ")", ")", "arg_5", "=", "0", "while", "arg_8", ":", "if", "any", "(", "arg_8", "[", ":", "4", "]", ")", ":", "break", "arg_5", "+=", "1", "del", "arg_8", "[", ":", "4", "]", "while", "arg_8", ":", "arg_3", ".", "insert", "(", "0", ",", "ndig", "(", "arg_8", "[", ":", "4", "]", ")", ")", "del", "arg_8", "[", ":", "4", "]", "arg_4", "=", "len", "(", "arg_3", ")", "arg_5", "+=", "arg_2", ".", "exponent", "//", "4", "+", "arg_4", "-", "1", "arg_6", "=", "arg_2", ".", "sign", "*", "0x4000", "arg_7", "=", "-", "min", "(", "0", ",", "arg_2", ".", "exponent", ")", "arg_9", "=", "[", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "]", "+", "arg_3", "return", "(", "'ihhHH%dH'", "%", "arg_4", ",", "[", "2", "*", "len", "(", "arg_9", ")", "]", "+", "arg_9", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    NBASE = 1000\n    ndigits = total number of base-NBASE digits\n    weight = base-NBASE weight of first digit\n    sign = 0x0000 if positive, 0x4000 if negative, 0xC000 if nan\n    dscale = decimal digits after decimal place\n    \"\"\"\n    try:\n        arg_2 = arg_1.as_tuple()\n    except AttributeError:\n        raise TypeError('Func field requires Decimal value (got %r)' % arg_1)\n    arg_3 = []\n    if isinstance(arg_2.exponent, str):\n        # NaN, Inf, -Inf\n        arg_4 = 0\n        arg_5 = 0\n        arg_6 = 0xC000\n        arg_7 = 0\n    else:\n        arg_8 = list(reversed(arg_2.digits + (arg_2.exponent % 4) * (0,)))\n        arg_5 = 0\n        while arg_8:\n            if any(arg_8[:4]):\n                break\n            arg_5 += 1\n            del arg_8[:4]\n        while arg_8:\n            arg_3.insert(0, ndig(arg_8[:4]))\n            del arg_8[:4]\n        arg_4 = len(arg_3)\n        arg_5 += arg_2.exponent // 4 + arg_4 - 1\n        arg_6 = arg_2.sign * 0x4000\n        arg_7 = -min(0, arg_2.exponent)\n    arg_9 = [arg_4, arg_5, arg_6, arg_7] + arg_3\n    return ('ihhHH%dH' % arg_4, [2 * len(arg_9)] + arg_9)", "path": "pgcopy/copy.py", "identifier": "numeric", "docstring": "NBASE = 1000\n    ndigits = total number of base-NBASE digits\n    weight = base-NBASE weight of first digit\n    sign = 0x0000 if positive, 0x4000 if negative, 0xC000 if nan\n    dscale = decimal digits after decimal place", "docstring_tokens": ["NBASE", "=", "1000", "ndigits", "=", "total", "number", "of", "base", "-", "NBASE", "digits", "weight", "=", "base", "-", "NBASE", "weight", "of", "first", "digit", "sign", "=", "0x0000", "if", "positive", "0x4000", "if", "negative", "0xC000", "if", "nan", "dscale", "=", "decimal", "digits", "after", "decimal", "place"], "nwo": "altaurog/pgcopy", "score": 0.31712908908020526, "idx": 256848}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/springer_crawler.py#L55-L82", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Returns the records listed in the webpage given as\n        parameter as a xml String.", "language": "python", "parameters": "(self, url)", "return_statement": "return doc.toprettyxml()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "urllib2", ".", "urlopen", "(", "arg_1", ")", "arg_3", "=", "[", "BeautifulSoup", "(", "arg_2", ")", "]", "arg_4", "=", "arg_3", "[", "0", "]", ".", "body", ".", "findAll", "(", "'span'", ",", "attrs", "=", "{", "'class'", ":", "'number-of-pages'", "}", ")", "if", "len", "(", "arg_4", ")", ">", "0", ":", "if", "re", ".", "search", "(", "'^\\d+$'", ",", "arg_4", "[", "0", "]", ".", "string", ")", ":", "for", "arg_5", "in", "range", "(", "int", "(", "arg_4", "[", "0", "]", ".", "string", ")", "-", "1", ")", ":", "arg_2", "=", "urllib2", ".", "urlopen", "(", "'%s/page/%i'", "%", "(", "arg_1", ",", "arg_5", "+", "2", ")", ")", "arg_3", ".", "append", "(", "BeautifulSoup", "(", "arg_2", ")", ")", "else", ":", "print", "(", "\"number of pages %s not an integer\"", "%", "(", "arg_4", "[", "0", "]", ".", "string", ")", ")", "arg_6", "=", "getDOMImplementation", "(", ")", "arg_7", "=", "arg_6", ".", "createDocument", "(", "None", ",", "\"collection\"", ",", "None", ")", "arg_8", "=", "[", "]", "for", "arg_2", "in", "arg_3", ":", "arg_8", "+=", "arg_2", ".", "body", ".", "findAll", "(", "'p'", ",", "attrs", "=", "{", "'class'", ":", "'title'", "}", ")", "arg_8", "+=", "arg_2", ".", "body", ".", "findAll", "(", "'h3'", ",", "attrs", "=", "{", "'class'", ":", "'title'", "}", ")", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "arg_0", ".", "_get_record", "(", "arg_9", ")", "arg_7", ".", "firstChild", ".", "appendChild", "(", "arg_10", ")", "return", "arg_7", ".", "toprettyxml", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns the records listed in the webpage given as\n        parameter as a xml String.\n\n        @param url: the url of the Journal, Book, Protocol or Reference work\n        \"\"\"\n        arg_2 = urllib2.urlopen(arg_1)\n        arg_3 = [BeautifulSoup(arg_2)]\n        #content spread over several pages?\n        arg_4 = arg_3[0].body.findAll('span', attrs={'class': 'number-of-pages'})\n        if len(arg_4) > 0:\n            if re.search('^\\d+$', arg_4[0].string):\n                for arg_5 in range(int(arg_4[0].string)-1):\n                    arg_2 = urllib2.urlopen('%s/page/%i' % (arg_1, arg_5+2))\n                    arg_3.append(BeautifulSoup(arg_2))\n            else:\n                print(\"number of pages %s not an integer\" % (arg_4[0].string))\n        arg_6 = getDOMImplementation()\n        arg_7 = arg_6.createDocument(None, \"collection\", None)\n        arg_8 = []\n        for arg_2 in arg_3:\n            arg_8 += arg_2.body.findAll('p', attrs={'class': 'title'})\n            arg_8 += arg_2.body.findAll('h3', attrs={'class': 'title'})\n        for arg_9 in arg_8:\n            arg_10 = arg_0._get_record(arg_9)\n            arg_7.firstChild.appendChild(arg_10)\n        return arg_7.toprettyxml()", "path": "harvestingkit/springer_crawler.py", "identifier": "SpringerCrawler.get_records", "docstring": "Returns the records listed in the webpage given as\n        parameter as a xml String.\n\n        @param url: the url of the Journal, Book, Protocol or Reference work", "docstring_tokens": ["Returns", "the", "records", "listed", "in", "the", "webpage", "given", "as", "parameter", "as", "a", "xml", "String", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 256849}
{"url": "https://github.com/Cornices/cornice.ext.swagger/blob/c31a5cc8d5dd112b11dc41ccb6d09b423b537abc/cornice_swagger/swagger.py#L168-L186", "sha": "c31a5cc8d5dd112b11dc41ccb6d09b423b537abc", "docstring_summary": "Store a parameter schema and return a reference to it.", "language": "python", "parameters": "(self, param, base_name=None)", "return_statement": "return {'$ref': pointer}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_2", "or", "arg_1", ".", "get", "(", "'title'", ",", "''", ")", "or", "arg_1", ".", "get", "(", "'name'", ",", "''", ")", "arg_4", "=", "arg_0", ".", "json_pointer", "+", "arg_3", "arg_0", ".", "parameter_registry", "[", "arg_3", "]", "=", "arg_1", "return", "{", "'$ref'", ":", "arg_4", "}"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Store a parameter schema and return a reference to it.\n\n        :param schema:\n            Swagger parameter definition.\n        :param base_name:\n            Name that should be used for the reference.\n\n        :rtype: dict\n        :returns: JSON pointer to the original parameter definition.\n        \"\"\"\n\n        arg_3 = arg_2 or arg_1.get('title', '') or arg_1.get('name', '')\n\n        arg_4 = arg_0.json_pointer + arg_3\n        arg_0.parameter_registry[arg_3] = arg_1\n\n        return {'$ref': arg_4}", "path": "cornice_swagger/swagger.py", "identifier": "ParameterHandler._ref", "docstring": "Store a parameter schema and return a reference to it.\n\n        :param schema:\n            Swagger parameter definition.\n        :param base_name:\n            Name that should be used for the reference.\n\n        :rtype: dict\n        :returns: JSON pointer to the original parameter definition.", "docstring_tokens": ["Store", "a", "parameter", "schema", "and", "return", "a", "reference", "to", "it", "."], "nwo": "Cornices/cornice.ext.swagger", "score": 0.28168436607245656, "idx": 256850}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/petitdb.py#L294-L332", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Create a tinyDB Query object that is the concatenation of each query in `queries`.\n    The concatenation operator is taken from `operators`.", "language": "python", "parameters": "(queries, operators='__and__')", "return_statement": "return bigop(end)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'__and__'", ")", ":", "if", "not", "arg_0", ":", "raise", "ValueError", "(", "'Expected some `queries`, got {}.'", ".", "format", "(", "arg_0", ")", ")", "if", "len", "(", "arg_0", ")", "==", "1", ":", "return", "arg_0", "[", "0", "]", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "[", "arg_1", "]", "*", "(", "len", "(", "arg_0", ")", "-", "1", ")", "if", "len", "(", "arg_0", ")", "-", "1", "!=", "len", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "'Expected `operators` to be a string or a list with the same'", "' length as `field_names` ({}), got {}.'", ".", "format", "(", "len", "(", "arg_0", ")", ",", "arg_1", ")", ")", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_0", "[", "0", "]", ",", "arg_0", "[", "1", ":", "-", "1", "]", ",", "arg_0", "[", "-", "1", ":", "]", "[", "0", "]", "arg_5", "=", "getattr", "(", "arg_2", ",", "arg_1", "[", "0", "]", ")", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_3", ")", ":", "arg_5", "=", "getattr", "(", "arg_5", "(", "arg_7", ")", ",", "arg_1", "[", "arg_6", "]", ")", "return", "arg_5", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1='__and__'):\n    \"\"\"Create a tinyDB Query object that is the concatenation of each query in `queries`.\n    The concatenation operator is taken from `operators`.\n\n    Parameters\n    ----------\n    queries: list of tinydb.Query\n        The list of tinydb.Query to be joined.\n\n    operators: str or list of str\n        List of binary operators to join `queries` into one query.\n        Check TinyDB.Query class for possible choices.\n\n    Returns\n    -------\n    query: tinydb.database.Query\n    \"\"\"\n    # checks first\n    if not arg_0:\n        raise ValueError('Expected some `queries`, got {}.'.format(arg_0))\n\n    if len(arg_0) == 1:\n        return arg_0[0]\n\n    if isinstance(arg_1, str):\n        arg_1 = [arg_1] * (len(arg_0) - 1)\n\n    if len(arg_0) - 1 != len(arg_1):\n        raise ValueError('Expected `operators` to be a string or a list with the same'\n                         ' length as `field_names` ({}), got {}.'.format(len(arg_0),\n                                                                         arg_1))\n\n    # recursively build the query\n    arg_2, arg_3, arg_4 = arg_0[0], arg_0[1:-1], arg_0[-1:][0]\n    arg_5 = getattr(arg_2, arg_1[0])\n    for arg_6, arg_7 in enumerate(arg_3):\n        arg_5 = getattr(arg_5(arg_7), arg_1[arg_6])\n\n    return arg_5(arg_4)", "path": "boyle/petitdb.py", "identifier": "_concat_queries", "docstring": "Create a tinyDB Query object that is the concatenation of each query in `queries`.\n    The concatenation operator is taken from `operators`.\n\n    Parameters\n    ----------\n    queries: list of tinydb.Query\n        The list of tinydb.Query to be joined.\n\n    operators: str or list of str\n        List of binary operators to join `queries` into one query.\n        Check TinyDB.Query class for possible choices.\n\n    Returns\n    -------\n    query: tinydb.database.Query", "docstring_tokens": ["Create", "a", "tinyDB", "Query", "object", "that", "is", "the", "concatenation", "of", "each", "query", "in", "queries", ".", "The", "concatenation", "operator", "is", "taken", "from", "operators", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 256851}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/enrollments.py#L24-L29", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return a list of all enrollments for the passed course sis id.", "language": "python", "parameters": "(self, sis_course_id, params={})", "return_statement": "return self.get_enrollments_for_course(\n            self._sis_id(sis_course_id, sis_field=\"course\"), params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "return", "arg_0", ".", "get_enrollments_for_course", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"course\"", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return a list of all enrollments for the passed course sis id.\n        \"\"\"\n        return arg_0.get_enrollments_for_course(\n            arg_0._sis_id(arg_1, sis_field=\"course\"), arg_2)", "path": "uw_canvas/enrollments.py", "identifier": "Enrollments.get_enrollments_for_course_by_sis_id", "docstring": "Return a list of all enrollments for the passed course sis id.", "docstring_tokens": ["Return", "a", "list", "of", "all", "enrollments", "for", "the", "passed", "course", "sis", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 256852}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_speech_to_text_hook.py#L42-L51", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Retrieves connection to Cloud Speech.", "language": "python", "parameters": "(self)", "return_statement": "return self._client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_client", ":", "arg_0", ".", "_client", "=", "SpeechClient", "(", "credentials", "=", "arg_0", ".", "_get_credentials", "(", ")", ")", "return", "arg_0", ".", "_client"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieves connection to Cloud Speech.\n\n        :return: Google Cloud Speech client object.\n        :rtype: google.cloud.speech_v1.SpeechClient\n        \"\"\"\n        if not arg_0._client:\n            arg_0._client = SpeechClient(credentials=arg_0._get_credentials())\n        return arg_0._client", "path": "airflow/contrib/hooks/gcp_speech_to_text_hook.py", "identifier": "GCPSpeechToTextHook.get_conn", "docstring": "Retrieves connection to Cloud Speech.\n\n        :return: Google Cloud Speech client object.\n        :rtype: google.cloud.speech_v1.SpeechClient", "docstring_tokens": ["Retrieves", "connection", "to", "Cloud", "Speech", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256853}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth1.py#L879-L899", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Save verifier to database.", "language": "python", "parameters": "(self, token, verifier, request)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "log", ".", "debug", "(", "'Save verifier %r for %r'", ",", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_verifiersetter", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Save verifier to database.\n\n        A verifiersetter is required. It would be better to combine request\n        token and verifier together::\n\n            def verifiersetter(token, verifier, request):\n                tok = Grant.query.filter_by(token=token).first()\n                tok.verifier = verifier['oauth_verifier']\n                tok.user = get_current_user()\n                return tok.save()\n\n        .. admonition:: Note:\n\n            A user is required on verifier, remember to attach current\n            user to verifier.\n        \"\"\"\n        log.debug('Save verifier %r for %r', arg_2, arg_1)\n        arg_0._verifiersetter(\n            arg_1=arg_1, arg_2=arg_2, arg_3=arg_3\n        )", "path": "flask_oauthlib/provider/oauth1.py", "identifier": "OAuth1RequestValidator.save_verifier", "docstring": "Save verifier to database.\n\n        A verifiersetter is required. It would be better to combine request\n        token and verifier together::\n\n            def verifiersetter(token, verifier, request):\n                tok = Grant.query.filter_by(token=token).first()\n                tok.verifier = verifier['oauth_verifier']\n                tok.user = get_current_user()\n                return tok.save()\n\n        .. admonition:: Note:\n\n            A user is required on verifier, remember to attach current\n            user to verifier.", "docstring_tokens": ["Save", "verifier", "to", "database", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 256854}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L211-L225", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Extracts the category from a GitHub item.", "language": "python", "parameters": "(item)", "return_statement": "return category", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "\"base\"", "in", "arg_0", ":", "arg_1", "=", "CATEGORY_PULL_REQUEST", "elif", "\"forks_count\"", "in", "arg_0", ":", "arg_1", "=", "CATEGORY_REPO", "else", ":", "arg_1", "=", "CATEGORY_ISSUE", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Extracts the category from a GitHub item.\n\n        This backend generates two types of item which are\n        'issue' and 'pull_request'.\n        \"\"\"\n\n        if \"base\" in arg_0:\n            arg_1 = CATEGORY_PULL_REQUEST\n        elif \"forks_count\" in arg_0:\n            arg_1 = CATEGORY_REPO\n        else:\n            arg_1 = CATEGORY_ISSUE\n\n        return arg_1", "path": "perceval/backends/core/github.py", "identifier": "GitHub.metadata_category", "docstring": "Extracts the category from a GitHub item.\n\n        This backend generates two types of item which are\n        'issue' and 'pull_request'.", "docstring_tokens": ["Extracts", "the", "category", "from", "a", "GitHub", "item", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256855}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/zipkin.py#L408-L464", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Enter the new span context. All annotations logged inside this\n        context will be attributed to this span. All new spans generated\n        inside this context will have this span as their parent.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "do_pop_attrs", "=", "False", "arg_2", ",", "arg_0", ".", "zipkin_attrs", "=", "arg_0", ".", "_get_current_context", "(", ")", "if", "not", "arg_0", ".", "zipkin_attrs", ":", "return", "arg_0", "arg_0", ".", "get_tracer", "(", ")", ".", "push_zipkin_attrs", "(", "arg_0", ".", "zipkin_attrs", ")", "arg_0", ".", "do_pop_attrs", "=", "True", "arg_0", ".", "Func_timestamp", "=", "time", ".", "time", "(", ")", "if", "arg_0", ".", "_is_local_root_span", ":", "if", "not", "arg_0", ".", "zipkin_attrs", ".", "is_sampled", "and", "not", "arg_0", ".", "firehose_handler", ":", "return", "arg_0", "if", "arg_0", ".", "get_tracer", "(", ")", ".", "is_transport_configured", "(", ")", ":", "log", ".", "info", "(", "'Transport was already configured, ignoring override'", "'from span {}'", ".", "format", "(", "arg_0", ".", "span_name", ")", ")", "return", "arg_0", "arg_5", "=", "create_endpoint", "(", "arg_0", ".", "port", ",", "arg_0", ".", "service_name", ",", "arg_0", ".", "host", ")", "arg_0", ".", "logging_context", "=", "ZipkinLoggingContext", "(", "arg_0", ".", "zipkin_attrs", ",", "arg_5", ",", "arg_0", ".", "span_name", ",", "arg_0", ".", "transport_handler", ",", "arg_2", "or", "arg_0", ".", "report_root_timestamp_override", ",", "arg_0", ".", "get_tracer", ",", "arg_0", ".", "service_name", ",", "binary_annotations", "=", "arg_0", ".", "binary_annotations", ",", "add_logging_annotation", "=", "arg_0", ".", "add_logging_annotation", ",", "client_context", "=", "arg_0", ".", "kind", "==", "Kind", ".", "CLIENT", ",", "max_span_batch_size", "=", "arg_0", ".", "max_span_batch_size", ",", "firehose_handler", "=", "arg_0", ".", "firehose_handler", ",", "encoding", "=", "arg_0", ".", "encoding", ",", ")", "arg_0", ".", "logging_context", ".", "Func", "(", ")", "arg_0", ".", "get_tracer", "(", ")", ".", "set_transport_configured", "(", "configured", "=", "True", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Enter the new span context. All annotations logged inside this\n        context will be attributed to this span. All new spans generated\n        inside this context will have this span as their parent.\n\n        In the unsampled case, this context still generates new span IDs and\n        pushes them onto the threadlocal stack, so downstream services calls\n        made will pass the correct headers. However, the logging handler is\n        never attached in the unsampled case, so the spans are never logged.\n        \"\"\"\n        arg_0.do_pop_attrs = False\n\n        arg_2, arg_0.zipkin_attrs = arg_0._get_current_context()\n\n        # If zipkin_attrs are not set up by now, that means this span is not\n        # configured to perform logging itself, and it's not in an existing\n        # Zipkin trace. That means there's nothing else to do and it can exit\n        # early.\n        if not arg_0.zipkin_attrs:\n            return arg_0\n\n        arg_0.get_tracer().push_zipkin_attrs(arg_0.zipkin_attrs)\n        arg_0.do_pop_attrs = True\n\n        arg_0.Func_timestamp = time.time()\n\n        if arg_0._is_local_root_span:\n            # Don't set up any logging if we're not sampling\n            if not arg_0.zipkin_attrs.is_sampled and not arg_0.firehose_handler:\n                return arg_0\n            # If transport is already configured don't override it. Doing so would\n            # cause all previously recorded spans to never be emitted as exiting\n            # the inner logging context will reset transport_configured to False.\n            if arg_0.get_tracer().is_transport_configured():\n                log.info('Transport was already configured, ignoring override'\n                         'from span {}'.format(arg_0.span_name))\n                return arg_0\n            arg_5 = create_endpoint(arg_0.port, arg_0.service_name, arg_0.host)\n            arg_0.logging_context = ZipkinLoggingContext(\n                arg_0.zipkin_attrs,\n                arg_5,\n                arg_0.span_name,\n                arg_0.transport_handler,\n                arg_2 or arg_0.report_root_timestamp_override,\n                arg_0.get_tracer,\n                arg_0.service_name,\n                binary_annotations=arg_0.binary_annotations,\n                add_logging_annotation=arg_0.add_logging_annotation,\n                client_context=arg_0.kind == Kind.CLIENT,\n                max_span_batch_size=arg_0.max_span_batch_size,\n                firehose_handler=arg_0.firehose_handler,\n                encoding=arg_0.encoding,\n            )\n            arg_0.logging_context.Func()\n            arg_0.get_tracer().set_transport_configured(configured=True)\n\n        return arg_0", "path": "py_zipkin/zipkin.py", "identifier": "zipkin_span.start", "docstring": "Enter the new span context. All annotations logged inside this\n        context will be attributed to this span. All new spans generated\n        inside this context will have this span as their parent.\n\n        In the unsampled case, this context still generates new span IDs and\n        pushes them onto the threadlocal stack, so downstream services calls\n        made will pass the correct headers. However, the logging handler is\n        never attached in the unsampled case, so the spans are never logged.", "docstring_tokens": ["Enter", "the", "new", "span", "context", ".", "All", "annotations", "logged", "inside", "this", "context", "will", "be", "attributed", "to", "this", "span", ".", "All", "new", "spans", "generated", "inside", "this", "context", "will", "have", "this", "span", "as", "their", "parent", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 256856}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/divergences/knn.py#L414-L432", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Gets within-bag distances for each bag.", "language": "python", "parameters": "(X, indices, Ks, max_K, save_all_Ks, min_dist)", "return_statement": "return rhos", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "logger", ".", "info", "(", "\"Getting within-bag distances...\"", ")", "if", "arg_3", ">=", "arg_0", ".", "n_pts", ".", "min", "(", ")", ":", "arg_6", "=", "\"asked for K = {}, but there's a bag with only {} points\"", "raise", "ValueError", "(", "arg_6", ".", "format", "(", "arg_3", ",", "arg_0", ".", "n_pts", ".", "min", "(", ")", ")", ")", "arg_7", "=", "slice", "(", "1", ",", "None", ")", "if", "arg_4", "else", "arg_2", "arg_1", "=", "plog", "(", "arg_1", ",", "name", "=", "\"within-bag distances\"", ")", "arg_8", "=", "[", "None", "]", "*", "len", "(", "arg_0", ")", "for", "arg_9", ",", "(", "arg_10", ",", "arg_11", ")", "in", "enumerate", "(", "zip", "(", "arg_1", ",", "arg_0", ")", ")", ":", "arg_12", "=", "np", ".", "sqrt", "(", "arg_10", ".", "nn_index", "(", "arg_11", ",", "arg_3", "+", "1", ")", "[", "1", "]", "[", ":", ",", "arg_7", "]", ")", "np", ".", "maximum", "(", "arg_5", ",", "arg_12", ",", "out", "=", "arg_12", ")", "arg_8", "[", "arg_9", "]", "=", "arg_12", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"Gets within-bag distances for each bag.\"\n    logger.info(\"Getting within-bag distances...\")\n\n    if arg_3 >= arg_0.n_pts.min():\n        arg_6 = \"asked for K = {}, but there's a bag with only {} points\"\n        raise ValueError(arg_6.format(arg_3, arg_0.n_pts.min()))\n\n    # need to throw away the closest neighbor, which will always be self\n    # thus K=1 corresponds to column 1 in the result array\n    arg_7 = slice(1, None) if arg_4 else arg_2\n\n    arg_1 = plog(arg_1, name=\"within-bag distances\")\n    arg_8 = [None] * len(arg_0)\n    for arg_9, (arg_10, arg_11) in enumerate(zip(arg_1, arg_0)):\n        arg_12 = np.sqrt(arg_10.nn_index(arg_11, arg_3 + 1)[1][:, arg_7])\n        np.maximum(arg_5, arg_12, out=arg_12)\n        arg_8[arg_9] = arg_12\n    return arg_8", "path": "skl_groups/divergences/knn.py", "identifier": "_get_rhos", "docstring": "Gets within-bag distances for each bag.", "docstring_tokens": ["Gets", "within", "-", "bag", "distances", "for", "each", "bag", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 256857}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/node.py#L54-L60", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Return an ordered mapping from params to args", "language": "python", "parameters": "(node)", "return_statement": "return boundargs.arguments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "[", "OBJ", "]", "arg_2", "=", "arg_0", "[", "KEY", "]", "arg_3", "=", "arg_1", ".", "formula", ".", "signature", ".", "bind", "(", "*", "arg_2", ")", "arg_3", ".", "apply_defaults", "(", ")", "return", "arg_3", ".", "arguments"], "function": "def Func(arg_0):\n    \"\"\"Return an ordered mapping from params to args\"\"\"\n    arg_1 = arg_0[OBJ]\n    arg_2 = arg_0[KEY]\n    arg_3 = arg_1.formula.signature.bind(*arg_2)\n    arg_3.apply_defaults()\n    return arg_3.arguments", "path": "modelx/core/node.py", "identifier": "node_get_args", "docstring": "Return an ordered mapping from params to args", "docstring_tokens": ["Return", "an", "ordered", "mapping", "from", "params", "to", "args"], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 256858}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/roles.py#L21-L27", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "List the roles for an account, for the passed account SIS ID.", "language": "python", "parameters": "(self, account_sis_id, params={})", "return_statement": "return self.get_roles_in_account(self._sis_id(account_sis_id,\n                                                      sis_field=\"account\"),\n                                         params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "return", "arg_0", ".", "get_roles_in_account", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"account\"", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        List the roles for an account, for the passed account SIS ID.\n        \"\"\"\n        return arg_0.get_roles_in_account(arg_0._sis_id(arg_1,\n                                                      sis_field=\"account\"),\n                                         arg_2)", "path": "uw_canvas/roles.py", "identifier": "Roles.get_roles_by_account_sis_id", "docstring": "List the roles for an account, for the passed account SIS ID.", "docstring_tokens": ["List", "the", "roles", "for", "an", "account", "for", "the", "passed", "account", "SIS", "ID", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 256859}
{"url": "https://github.com/edx/edx-lint/blob/d87ccb51a48984806b6442a36992c5b45c3d4d58/edx_lint/tamper_evident.py#L18-L45", "sha": "d87ccb51a48984806b6442a36992c5b45c3d4d58", "docstring_summary": "u\"\"\"\n        Write `text` to the file.", "language": "python", "parameters": "(self, text, hashline=b\"# {}\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "b\"# {}\"", ")", ":", "if", "not", "arg_1", ".", "endswith", "(", "b\"\\n\"", ")", ":", "arg_1", "+=", "b\"\\n\"", "arg_3", "=", "hashlib", ".", "sha1", "(", "arg_1", ")", ".", "hexdigest", "(", ")", "with", "open", "(", "arg_0", ".", "filename", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "Func", "(", "arg_1", ")", "f", ".", "Func", "(", "arg_2", ".", "decode", "(", "\"utf8\"", ")", ".", "format", "(", "arg_3", ")", ".", "encode", "(", "\"utf8\"", ")", ")", "f", ".", "Func", "(", "b\"\\n\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=b\"# {}\"):\n        u\"\"\"\n        Write `text` to the file.\n\n        Writes the text to the file, with a final line checksumming the\n        contents.  The entire file must be written with one `.Func()` call.\n\n        The last line is written with the `hashline` format string, which can\n        be changed to accommodate different file syntaxes.\n\n        Both arguments are UTF8 byte strings.\n\n        Arguments:\n            text (UTF8 byte string): the contents of the file to Func.\n\n            hashline (UTF8 byte string): the format of the last line to append\n                to the file, with \"{}\" replaced with the hash.\n\n        \"\"\"\n        if not arg_1.endswith(b\"\\n\"):\n            arg_1 += b\"\\n\"\n\n        arg_3 = hashlib.sha1(arg_1).hexdigest()\n\n        with open(arg_0.filename, \"wb\") as f:\n            f.Func(arg_1)\n            f.Func(arg_2.decode(\"utf8\").format(arg_3).encode(\"utf8\"))\n            f.Func(b\"\\n\")", "path": "edx_lint/tamper_evident.py", "identifier": "TamperEvidentFile.write", "docstring": "u\"\"\"\n        Write `text` to the file.\n\n        Writes the text to the file, with a final line checksumming the\n        contents.  The entire file must be written with one `.write()` call.\n\n        The last line is written with the `hashline` format string, which can\n        be changed to accommodate different file syntaxes.\n\n        Both arguments are UTF8 byte strings.\n\n        Arguments:\n            text (UTF8 byte string): the contents of the file to write.\n\n            hashline (UTF8 byte string): the format of the last line to append\n                to the file, with \"{}\" replaced with the hash.", "docstring_tokens": ["u", "Write", "text", "to", "the", "file", "."], "nwo": "edx/edx-lint", "score": 0.3933713915493414, "idx": 256860}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/latools.py#L2571-L2591", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Report how many data are removed by the active filters.", "language": "python", "parameters": "(self, filt=True, quiet=False)", "return_statement": "return rminfo", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_0", ".", "subsets", "[", "'All_Samples'", "]", ":", "arg_5", "=", "arg_0", ".", "data", "[", "arg_4", "]", "arg_3", "[", "arg_4", "]", "=", "arg_5", ".", "filt_nremoved", "(", "arg_1", ")", "if", "not", "arg_2", ":", "arg_6", "=", "max", "(", "[", "len", "(", "arg_5", ")", "for", "arg_5", "in", "arg_3", ".", "keys", "(", ")", "]", ")", "print", "(", "'{string:{number}s}'", ".", "format", "(", "string", "=", "'Sample '", ",", "number", "=", "arg_6", "+", "3", ")", "+", "'{total:4s}'", ".", "format", "(", "total", "=", "'tot'", ")", "+", "'{removed:4s}'", ".", "format", "(", "removed", "=", "'flt'", ")", "+", "'{percent:4s}'", ".", "format", "(", "percent", "=", "'%rm'", ")", ")", "for", "arg_7", ",", "(", "arg_8", ",", "arg_9", ",", "arg_10", ")", "in", "arg_3", ".", "items", "(", ")", ":", "print", "(", "'{string:{number}s}'", ".", "format", "(", "string", "=", "arg_7", ",", "number", "=", "arg_6", "+", "3", ")", "+", "'{total:4.0f}'", ".", "format", "(", "total", "=", "arg_8", ")", "+", "'{removed:4.0f}'", ".", "format", "(", "removed", "=", "arg_9", ")", "+", "'{percent:4.0f}'", ".", "format", "(", "percent", "=", "arg_10", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=True, arg_2=False):\n        \"\"\"\n        Report how many data are removed by the active filters.\n        \"\"\"\n        arg_3 = {}\n        for arg_4 in arg_0.subsets['All_Samples']:\n            arg_5 = arg_0.data[arg_4]\n            arg_3[arg_4] = arg_5.filt_nremoved(arg_1)\n        if not arg_2:\n            arg_6 = max([len(arg_5) for arg_5 in arg_3.keys()])\n            print('{string:{number}s}'.format(string='Sample ', number=arg_6 + 3) +\n                  '{total:4s}'.format(total='tot') +\n                  '{removed:4s}'.format(removed='flt') +\n                  '{percent:4s}'.format(percent='%rm'))\n            for arg_7, (arg_8, arg_9, arg_10) in arg_3.items():\n                print('{string:{number}s}'.format(string=arg_7, number=arg_6 + 3) +\n                      '{total:4.0f}'.format(total=arg_8) +\n                      '{removed:4.0f}'.format(removed=arg_9) +\n                      '{percent:4.0f}'.format(percent=arg_10))\n\n        return arg_3", "path": "latools/latools.py", "identifier": "analyse.filter_nremoved", "docstring": "Report how many data are removed by the active filters.", "docstring_tokens": ["Report", "how", "many", "data", "are", "removed", "by", "the", "active", "filters", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 256861}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/integration/overlay.py#L30-L54", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Overlays tabular data on the network", "language": "python", "parameters": "(graph: BELGraph,\n                 data: Mapping[BaseEntity, Any],\n                 label: Optional[str] = None,\n                 overwrite: bool = False,\n                 )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", ",", "arg_5", "]", ",", "arg_6", ":", "arg_7", "[", "arg_8", "]", "=", "None", ",", "arg_9", ":", "arg_10", "=", "False", ",", ")", "->", "None", ":", "if", "arg_6", "is", "None", ":", "arg_6", "=", "WEIGHT", "for", "arg_11", ",", "arg_12", "in", "arg_2", ".", "items", "(", ")", ":", "if", "arg_11", "not", "in", "arg_0", ":", "log", ".", "debug", "(", "'%s not in graph'", ",", "arg_11", ")", "continue", "if", "arg_6", "in", "arg_0", ".", "nodes", "[", "arg_11", "]", "and", "not", "arg_9", ":", "log", ".", "debug", "(", "'%s already on %s'", ",", "arg_6", ",", "arg_11", ")", "continue", "arg_0", ".", "nodes", "[", "arg_11", "]", "[", "arg_6", "]", "=", "arg_12"], "function": "def Func(arg_0: arg_1,\n                 arg_2: arg_3[arg_4, arg_5],\n                 arg_6: arg_7[arg_8] = None,\n                 arg_9: arg_10 = False,\n                 ) -> None:\n    \"\"\"Overlays tabular data on the network\n\n    :param graph: A BEL Graph\n    :param data: A dictionary of {tuple node: data for that node}\n    :param label: The annotation label to put in the node dictionary\n    :param overwrite: Should old annotations be overwritten?\n    \"\"\"\n    if arg_6 is None:\n        arg_6 = WEIGHT\n\n    for arg_11, arg_12 in arg_2.items():\n        if arg_11 not in arg_0:\n            log.debug('%s not in graph', arg_11)\n            continue\n\n        if arg_6 in arg_0.nodes[arg_11] and not arg_9:\n            log.debug('%s already on %s', arg_6, arg_11)\n            continue\n\n        arg_0.nodes[arg_11][arg_6] = arg_12", "path": "src/pybel_tools/integration/overlay.py", "identifier": "overlay_data", "docstring": "Overlays tabular data on the network\n\n    :param graph: A BEL Graph\n    :param data: A dictionary of {tuple node: data for that node}\n    :param label: The annotation label to put in the node dictionary\n    :param overwrite: Should old annotations be overwritten?", "docstring_tokens": ["Overlays", "tabular", "data", "on", "the", "network"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256862}
{"url": "https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/register_models.py#L21-L31", "sha": "c3ec2554b026f65ac5f0fc5c9d439277fbac14f9", "docstring_summary": "We check whether a class has more than 1 FK reference to itself.", "language": "python", "parameters": "(class_model)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "_meta", ".", "concrete_fields", ":", "if", "arg_2", ".", "related_model", "in", "arg_1", ":", "return", "True", "if", "arg_2", ".", "related_model", "==", "arg_0", ":", "arg_1", ".", "append", "(", "arg_0", ")", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"\n    We check whether a class has more than 1 FK reference to itself.\n    \"\"\"\n    arg_1 = []\n    for arg_2 in arg_0._meta.concrete_fields:\n        if arg_2.related_model in arg_1:\n            return True\n        if arg_2.related_model == arg_0:\n            arg_1.append(arg_0)\n    return False", "path": "morango/utils/register_models.py", "identifier": "_multiple_self_ref_fk_check", "docstring": "We check whether a class has more than 1 FK reference to itself.", "docstring_tokens": ["We", "check", "whether", "a", "class", "has", "more", "than", "1", "FK", "reference", "to", "itself", "."], "nwo": "learningequality/morango", "score": 0.37668663501628774, "idx": 256863}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/dist.py#L106-L111", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Form of distribution must be an array of counts in order of self.keys.", "language": "python", "parameters": "(self, distn)", "return_statement": "return (logFactorial(n) - numpy.sum([logFactorial(k) for k in x]) +\n      numpy.sum(x * numpy.log(self.dist.pmf)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "numpy", ".", "asarray", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "sum", "(", ")", "return", "(", "logFactorial", "(", "arg_3", ")", "-", "numpy", ".", "sum", "(", "[", "logFactorial", "(", "arg_4", ")", "for", "arg_4", "in", "arg_2", "]", ")", "+", "numpy", ".", "sum", "(", "arg_2", "*", "numpy", ".", "log", "(", "arg_0", ".", "dist", ".", "pmf", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Form of distribution must be an array of counts in order of self.keys.\"\"\"\n    arg_2 = numpy.asarray(arg_1)\n    arg_3 = arg_2.sum()\n    return (logFactorial(arg_3) - numpy.sum([logFactorial(arg_4) for arg_4 in arg_2]) +\n      numpy.sum(arg_2 * numpy.log(arg_0.dist.pmf)))", "path": "src/nupic/math/dist.py", "identifier": "MultinomialDistribution.logProbability", "docstring": "Form of distribution must be an array of counts in order of self.keys.", "docstring_tokens": ["Form", "of", "distribution", "must", "be", "an", "array", "of", "counts", "in", "order", "of", "self", ".", "keys", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256864}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L473-L496", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Sets the chunking dimmentions depending on the file type.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "np", ".", "abs", "(", "arg_0", ".", "header", "[", "b'foff'", "]", ")", "<", "1e-5", ":", "logger", ".", "info", "(", "'Detecting high frequency resolution data.'", ")", "arg_1", "=", "(", "1", ",", "1", ",", "1048576", ")", "return", "arg_1", "elif", "np", ".", "abs", "(", "arg_0", ".", "header", "[", "b'tsamp'", "]", ")", "<", "1e-3", ":", "logger", ".", "info", "(", "'Detecting high time resolution data.'", ")", "arg_1", "=", "(", "2048", ",", "1", ",", "512", ")", "return", "arg_1", "elif", "np", ".", "abs", "(", "arg_0", ".", "header", "[", "b'foff'", "]", ")", "<", "1e-2", "and", "np", ".", "abs", "(", "arg_0", ".", "header", "[", "b'foff'", "]", ")", ">=", "1e-5", ":", "logger", ".", "info", "(", "'Detecting intermediate frequency and time resolution data.'", ")", "arg_1", "=", "(", "10", ",", "1", ",", "65536", ")", "return", "arg_1", "else", ":", "logger", ".", "warning", "(", "'File format not known. Will use minimum chunking. NOT OPTIMAL.'", ")", "arg_1", "=", "(", "1", ",", "1", ",", "512", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Sets the chunking dimmentions depending on the file type.\n        \"\"\"\n\n        #Usually '.0000.' is in self.filename\n        if np.abs(arg_0.header[b'foff']) < 1e-5:\n            logger.info('Detecting high frequency resolution data.')\n            arg_1 = (1,1,1048576) #1048576 is the number of channels in a coarse channel.\n            return arg_1\n        #Usually '.0001.' is in self.filename\n        elif np.abs(arg_0.header[b'tsamp']) < 1e-3:\n            logger.info('Detecting high time resolution data.')\n            arg_1 = (2048,1,512) #512 is the total number of channels per single band (ie. blc00)\n            return arg_1\n        #Usually '.0002.' is in self.filename\n        elif np.abs(arg_0.header[b'foff']) < 1e-2 and np.abs(arg_0.header[b'foff'])  >= 1e-5:\n            logger.info('Detecting intermediate frequency and time resolution data.')\n            arg_1 = (10,1,65536)  #65536 is the total number of channels per single band (ie. blc00)\n#            chunk_dim = (1,1,65536/4)\n            return arg_1\n        else:\n            logger.warning('File format not known. Will use minimum chunking. NOT OPTIMAL.')\n            arg_1 = (1,1,512)\n            return arg_1", "path": "blimpy/waterfall.py", "identifier": "Waterfall.__get_chunk_dimensions", "docstring": "Sets the chunking dimmentions depending on the file type.", "docstring_tokens": ["Sets", "the", "chunking", "dimmentions", "depending", "on", "the", "file", "type", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 256865}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/bbs.py#L323-L348", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Compute the IoU of this bounding box with another one.", "language": "python", "parameters": "(self, other)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "intersection", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "return", "0.0", "else", ":", "arg_3", "=", "arg_0", ".", "area", "+", "arg_1", ".", "area", "-", "arg_2", ".", "area", "return", "arg_2", ".", "area", "/", "arg_3", "if", "arg_3", ">", "0", "else", "0.0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Compute the IoU of this bounding box with another one.\n\n        IoU is the intersection over union, defined as::\n\n            ``area(intersection(A, B)) / area(union(A, B))``\n            ``= area(intersection(A, B)) / (area(A) + area(B) - area(intersection(A, B)))``\n\n        Parameters\n        ----------\n        other : imgaug.BoundingBox\n            Other bounding box with which to compare.\n\n        Returns\n        -------\n        float\n            IoU between the two bounding boxes.\n\n        \"\"\"\n        arg_2 = arg_0.intersection(arg_1)\n        if arg_2 is None:\n            return 0.0\n        else:\n            arg_3 = arg_0.area + arg_1.area - arg_2.area\n            return arg_2.area / arg_3 if arg_3 > 0 else 0.0", "path": "imgaug/augmentables/bbs.py", "identifier": "BoundingBox.iou", "docstring": "Compute the IoU of this bounding box with another one.\n\n        IoU is the intersection over union, defined as::\n\n            ``area(intersection(A, B)) / area(union(A, B))``\n            ``= area(intersection(A, B)) / (area(A) + area(B) - area(intersection(A, B)))``\n\n        Parameters\n        ----------\n        other : imgaug.BoundingBox\n            Other bounding box with which to compare.\n\n        Returns\n        -------\n        float\n            IoU between the two bounding boxes.", "docstring_tokens": ["Compute", "the", "IoU", "of", "this", "bounding", "box", "with", "another", "one", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 256866}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/feedforward.py#L398-L413", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Compute class posterior probabilities for the given set of data.", "language": "python", "parameters": "(self, x, **kwargs)", "return_statement": "return self.feed_forward(x, **kwargs)[self.layers[-1].output_name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "feed_forward", "(", "arg_1", ",", "**", "arg_2", ")", "[", "arg_0", ".", "layers", "[", "-", "1", "]", ".", "output_name", "]"], "function": "def Func(arg_0, arg_1, **arg_2):\n        '''Compute class posterior probabilities for the given set of data.\n\n        Parameters\n        ----------\n        x : ndarray (num-examples, num-variables)\n            An array containing examples to predict. Examples are given as the\n            rows in this array.\n\n        Returns\n        -------\n        p : ndarray (num-examples, num-classes)\n            An array of class posterior probability values, one per row of input\n            data.\n        '''\n        return arg_0.feed_forward(arg_1, **arg_2)[arg_0.layers[-1].output_name]", "path": "theanets/feedforward.py", "identifier": "Classifier.predict_proba", "docstring": "Compute class posterior probabilities for the given set of data.\n\n        Parameters\n        ----------\n        x : ndarray (num-examples, num-variables)\n            An array containing examples to predict. Examples are given as the\n            rows in this array.\n\n        Returns\n        -------\n        p : ndarray (num-examples, num-classes)\n            An array of class posterior probability values, one per row of input\n            data.", "docstring_tokens": ["Compute", "class", "posterior", "probabilities", "for", "the", "given", "set", "of", "data", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 256867}
{"url": "https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/utils.py#L42-L45", "sha": "d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd", "docstring_summary": "Reads the temple YAML configuration file in the repository", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "open", "(", "temple", ".", "constants", ".", "TEMPLE_CONFIG_FILE", ")", "as", "temple_config_file", ":", "return", "yaml", ".", "load", "(", "temple_config_file", ",", "Loader", "=", "yaml", ".", "SafeLoader", ")"], "function": "def Func():\n    \"\"\"Reads the temple YAML configuration file in the repository\"\"\"\n    with open(temple.constants.TEMPLE_CONFIG_FILE) as temple_config_file:\n        return yaml.load(temple_config_file, Loader=yaml.SafeLoader)", "path": "temple/utils.py", "identifier": "read_temple_config", "docstring": "Reads the temple YAML configuration file in the repository", "docstring_tokens": ["Reads", "the", "temple", "YAML", "configuration", "file", "in", "the", "repository"], "nwo": "CloverHealth/temple", "score": 0.39091779717332914, "idx": 256868}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/task.py#L488-L495", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Marks the task as ready for execution.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_has_state", "(", "arg_0", ".", "COMPLETED", ")", "or", "arg_0", ".", "_has_state", "(", "arg_0", ".", "CANCELLED", ")", ":", "return", "arg_0", ".", "_set_state", "(", "arg_0", ".", "READY", ")", "arg_0", ".", "task_spec", ".", "_onFunc", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Marks the task as ready for execution.\n        \"\"\"\n        if arg_0._has_state(arg_0.COMPLETED) or arg_0._has_state(arg_0.CANCELLED):\n            return\n        arg_0._set_state(arg_0.READY)\n        arg_0.task_spec._onFunc(arg_0)", "path": "SpiffWorkflow/task.py", "identifier": "Task._ready", "docstring": "Marks the task as ready for execution.", "docstring_tokens": ["Marks", "the", "task", "as", "ready", "for", "execution", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 256869}
{"url": "https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/models.py#L227-L236", "sha": "cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2", "docstring_summary": "Gets count of all images from both event and updates.", "language": "python", "parameters": "(self)", "return_statement": "return count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "image_set", ".", "count", "(", ")", "arg_2", "=", "arg_0", ".", "update_set", ".", "values_list", "(", "'id'", ",", "flat", "=", "True", ")", "arg_3", "=", "UpdateImage", ".", "objects", ".", "filter", "(", "update__id__in", "=", "arg_2", ")", ".", "count", "(", ")", "arg_4", "=", "arg_1", "+", "arg_3", "return", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"\n        Gets count of all images from both event and updates.\n        \"\"\"\n        arg_1 = arg_0.image_set.count()\n        arg_2 = arg_0.update_set.values_list('id', flat=True)\n        arg_3 = UpdateImage.objects.filter(update__id__in=arg_2).count()\n        arg_4 = arg_1 + arg_3\n\n        return arg_4", "path": "build/lib/happenings/models.py", "identifier": "Event.get_all_images_count", "docstring": "Gets count of all images from both event and updates.", "docstring_tokens": ["Gets", "count", "of", "all", "images", "from", "both", "event", "and", "updates", "."], "nwo": "tBaxter/tango-happenings", "score": 0.09252797783733271, "idx": 256870}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L174-L183", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Get information about the users current playback.", "language": "python", "parameters": "(self)", "return_statement": "return player", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", "->", "Player", ":", "arg_0", ".", "_player", "=", "player", "=", "Player", "(", "arg_0", ".", "__client", ",", "arg_0", ",", "await", "arg_0", ".", "http", ".", "current_player", "(", ")", ")", "return", "player"], "function": "async def Func(arg_0) -> Player:\n        \"\"\"Get information about the users current playback.\n\n        Returns\n        -------\n        player : Player\n            A player object representing the current playback.\n        \"\"\"\n        arg_0._player = player = Player(arg_0.__client, arg_0, await arg_0.http.current_player())\n        return player", "path": "spotify/models/user.py", "identifier": "User.get_player", "docstring": "Get information about the users current playback.\n\n        Returns\n        -------\n        player : Player\n            A player object representing the current playback.", "docstring_tokens": ["Get", "information", "about", "the", "users", "current", "playback", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 256871}
{"url": "https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L475-L496", "sha": "5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3", "docstring_summary": "Cancel all submitted IO blocks.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "cancel", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_submitted", ".", "itervalues", "(", ")", ":", "try", ":", "arg_2", ".", "append", "(", "arg_1", "(", "arg_3", ")", ")", "except", "OSError", "as", "exc", ":", "if", "exc", ".", "errno", "!=", "errno", ".", "EINVAL", ":", "raise", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Cancel all submitted IO blocks.\n\n        Blocks until all submitted transfers have been finalised.\n        Submitting more transfers or processing completion events while this\n        method is running produces undefined behaviour.\n        Returns the list of values returned by individual cancellations.\n        See \"cancel\" documentation.\n        \"\"\"\n        arg_1 = arg_0.cancel\n        arg_2 = []\n        for arg_3, arg_4 in arg_0._submitted.itervalues():\n            try:\n                arg_2.append(arg_1(arg_3))\n            except OSError as exc:\n                # EINVAL should mean we requested to cancel a not-in-flight\n                # transfer - maybe it was just completed and we just did\n                # not process its completion event yet.\n                if exc.errno != errno.EINVAL:\n                    raise\n        return arg_2", "path": "libaio/__init__.py", "identifier": "AIOContext.cancelAll", "docstring": "Cancel all submitted IO blocks.\n\n        Blocks until all submitted transfers have been finalised.\n        Submitting more transfers or processing completion events while this\n        method is running produces undefined behaviour.\n        Returns the list of values returned by individual cancellations.\n        See \"cancel\" documentation.", "docstring_tokens": ["Cancel", "all", "submitted", "IO", "blocks", "."], "nwo": "vpelletier/python-libaio", "score": 0.18579120894425885, "idx": 256872}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/export.py#L24-L58", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Plots your graph summary statistics on the given axes.", "language": "python", "parameters": "(graph: BELGraph, lax, rax, logx=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "True", ")", ":", "arg_5", "=", "count_functions", "(", "arg_0", ")", "arg_6", "=", "count_relations", "(", "arg_0", ")", "arg_7", "=", "pd", ".", "DataFrame", ".", "from_dict", "(", "dict", "(", "arg_5", ")", ",", "orient", "=", "'index'", ")", "arg_8", "=", "pd", ".", "DataFrame", ".", "from_dict", "(", "dict", "(", "arg_6", ")", ",", "orient", "=", "'index'", ")", "arg_7", ".", "sort_values", "(", "0", ",", "ascending", "=", "True", ")", ".", "plot", "(", "kind", "=", "'barh'", ",", "arg_4", "=", "arg_4", ",", "ax", "=", "arg_2", ")", "arg_2", ".", "set_title", "(", "'Number of nodes: {}'", ".", "format", "(", "arg_0", ".", "number_of_nodes", "(", ")", ")", ")", "arg_8", ".", "sort_values", "(", "0", ",", "ascending", "=", "True", ")", ".", "plot", "(", "kind", "=", "'barh'", ",", "arg_4", "=", "arg_4", ",", "ax", "=", "arg_3", ")", "arg_3", ".", "set_title", "(", "'Number of edges: {}'", ".", "format", "(", "arg_0", ".", "number_of_edges", "(", ")", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2, arg_3, arg_4=True):\n    \"\"\"Plots your graph summary statistics on the given axes.\n\n    After, you should run :func:`plt.tight_layout` and you must run :func:`plt.show` to view.\n\n    Shows:\n    1. Count of nodes, grouped by function type\n    2. Count of edges, grouped by relation type\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param lax: An axis object from matplotlib\n    :param rax: An axis object from matplotlib\n\n    Example usage:\n\n    >>> import matplotlib.pyplot as plt\n    >>> from pybel import from_pickle\n    >>> from pybel_tools.summary import Func\n    >>> graph = from_pickle('~/dev/bms/aetionomy/parkinsons.gpickle')\n    >>> fig, axes = plt.subplots(1, 2, figsize=(10, 4))\n    >>> Func(graph, axes[0], axes[1])\n    >>> plt.tight_layout()\n    >>> plt.show()\n    \"\"\"\n    arg_5 = count_functions(arg_0)\n    arg_6 = count_relations(arg_0)\n\n    arg_7 = pd.DataFrame.from_dict(dict(arg_5), orient='index')\n    arg_8 = pd.DataFrame.from_dict(dict(arg_6), orient='index')\n\n    arg_7.sort_values(0, ascending=True).plot(kind='barh', arg_4=arg_4, ax=arg_2)\n    arg_2.set_title('Number of nodes: {}'.format(arg_0.number_of_nodes()))\n\n    arg_8.sort_values(0, ascending=True).plot(kind='barh', arg_4=arg_4, ax=arg_3)\n    arg_3.set_title('Number of edges: {}'.format(arg_0.number_of_edges()))", "path": "src/pybel_tools/summary/export.py", "identifier": "plot_summary_axes", "docstring": "Plots your graph summary statistics on the given axes.\n\n    After, you should run :func:`plt.tight_layout` and you must run :func:`plt.show` to view.\n\n    Shows:\n    1. Count of nodes, grouped by function type\n    2. Count of edges, grouped by relation type\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param lax: An axis object from matplotlib\n    :param rax: An axis object from matplotlib\n\n    Example usage:\n\n    >>> import matplotlib.pyplot as plt\n    >>> from pybel import from_pickle\n    >>> from pybel_tools.summary import plot_summary_axes\n    >>> graph = from_pickle('~/dev/bms/aetionomy/parkinsons.gpickle')\n    >>> fig, axes = plt.subplots(1, 2, figsize=(10, 4))\n    >>> plot_summary_axes(graph, axes[0], axes[1])\n    >>> plt.tight_layout()\n    >>> plt.show()", "docstring_tokens": ["Plots", "your", "graph", "summary", "statistics", "on", "the", "given", "axes", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256873}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/lib.py#L251-L319", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Popup with information about how to register a new GUI", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "QtWidgets", ".", "QMessageBox", "(", ")", "arg_0", ".", "setIcon", "(", "arg_0", ".", "Warning", ")", "arg_0", ".", "setWindowIcon", "(", "QtGui", ".", "QIcon", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "pyblish", ".", "__file__", ")", ",", "\"icons\"", ",", "\"logo-32x32.svg\"", ")", ")", ")", "arg_1", "=", "QtWidgets", ".", "QWidget", "(", ")", "arg_1", ".", "setMinimumSize", "(", "400", ",", "0", ")", "arg_1", ".", "setSizePolicy", "(", "QtWidgets", ".", "QSizePolicy", ".", "Minimum", ",", "QtWidgets", ".", "QSizePolicy", ".", "Expanding", ")", "arg_2", "=", "arg_0", ".", "layout", "(", ")", "arg_2", ".", "addWidget", "(", "arg_1", ",", "arg_2", ".", "rowCount", "(", ")", ",", "0", ",", "1", ",", "arg_2", ".", "columnCount", "(", ")", ")", "arg_0", ".", "setWindowTitle", "(", "\"Uh oh\"", ")", "arg_3", "=", "\"No registered GUI found.\\n\\n\"", "if", "not", "pyblish", ".", "api", ".", "registered_guis", "(", ")", ":", "arg_3", "+=", "(", "\"In order to show you a GUI, one must first be registered. \"", "\"\\n\"", "\"Pyblish supports one or more graphical user interfaces \"", "\"to be registered at once, the next acting as a fallback to \"", "\"the previous.\"", "\"\\n\"", "\"\\n\"", "\"For example, to use Pyblish Lite, first install it:\"", "\"\\n\"", "\"\\n\"", "\"$ pip install pyblish-lite\"", "\"\\n\"", "\"\\n\"", "\"Then register it, like so:\"", "\"\\n\"", "\"\\n\"", "\">>> import pyblish.api\\n\"", "\">>> pyblish.api.register_gui(\\\"pyblish_lite\\\")\"", "\"\\n\"", "\"\\n\"", "\"The next time you try running this, Lite will appear.\"", "\"\\n\"", "\"See http://api.pyblish.com/register_gui.html for \"", "\"more information.\"", ")", "else", ":", "arg_3", "+=", "(", "\"None of the registered graphical user interfaces \"", "\"could be found.\"", "\"\\n\"", "\"These interfaces are currently registered:\"", "\"\\n\"", "\"%s\"", "%", "\"\\n\"", ".", "join", "(", "pyblish", ".", "api", ".", "registered_guis", "(", ")", ")", ")", "arg_0", ".", "setText", "(", "arg_3", ")", "arg_0", ".", "setStandardButtons", "(", "arg_0", ".", "Ok", ")", "arg_0", ".", "exec_", "(", ")"], "function": "def Func():\n    \"\"\"Popup with information about how to register a new GUI\n\n    In the event of no GUI being registered or available,\n    this information dialog will appear to guide the user\n    through how to get set up with one.\n\n    \"\"\"\n\n    arg_0 = QtWidgets.QMessageBox()\n    arg_0.setIcon(arg_0.Warning)\n    arg_0.setWindowIcon(QtGui.QIcon(os.path.join(\n        os.path.dirname(pyblish.__file__),\n        \"icons\",\n        \"logo-32x32.svg\"))\n    )\n\n    arg_1 = QtWidgets.QWidget()\n    arg_1.setMinimumSize(400, 0)\n    arg_1.setSizePolicy(QtWidgets.QSizePolicy.Minimum,\n                         QtWidgets.QSizePolicy.Expanding)\n\n    arg_2 = arg_0.layout()\n    arg_2.addWidget(arg_1, arg_2.rowCount(), 0, 1, arg_2.columnCount())\n\n    arg_0.setWindowTitle(\"Uh oh\")\n\n    arg_3 = \"No registered GUI found.\\n\\n\"\n\n    if not pyblish.api.registered_guis():\n        arg_3 += (\n            \"In order to show you a GUI, one must first be registered. \"\n            \"\\n\"\n            \"Pyblish supports one or more graphical user interfaces \"\n            \"to be registered at once, the next acting as a fallback to \"\n            \"the previous.\"\n            \"\\n\"\n            \"\\n\"\n            \"For example, to use Pyblish Lite, first install it:\"\n            \"\\n\"\n            \"\\n\"\n            \"$ pip install pyblish-lite\"\n            \"\\n\"\n            \"\\n\"\n            \"Then register it, like so:\"\n            \"\\n\"\n            \"\\n\"\n            \">>> import pyblish.api\\n\"\n            \">>> pyblish.api.register_gui(\\\"pyblish_lite\\\")\"\n            \"\\n\"\n            \"\\n\"\n            \"The next time you try running this, Lite will appear.\"\n            \"\\n\"\n            \"See http://api.pyblish.com/register_gui.html for \"\n            \"more information.\"\n        )\n    else:\n        arg_3 += (\n            \"None of the registered graphical user interfaces \"\n            \"could be found.\"\n            \"\\n\"\n            \"These interfaces are currently registered:\"\n            \"\\n\"\n            \"%s\" % \"\\n\".join(pyblish.api.registered_guis())\n        )\n\n    arg_0.setText(arg_3)\n    arg_0.setStandardButtons(arg_0.Ok)\n    arg_0.exec_()", "path": "pyblish_maya/lib.py", "identifier": "_show_no_gui", "docstring": "Popup with information about how to register a new GUI\n\n    In the event of no GUI being registered or available,\n    this information dialog will appear to guide the user\n    through how to get set up with one.", "docstring_tokens": ["Popup", "with", "information", "about", "how", "to", "register", "a", "new", "GUI"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 256874}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L423-L428", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "DDP unsub handler.", "language": "python", "parameters": "(self, id_=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "arg_0", ".", "api", ".", "unsub", "(", "arg_1", ")", "else", ":", "arg_0", ".", "reply", "(", "'nosub'", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"DDP unsub handler.\"\"\"\n        if arg_1:\n            arg_0.api.unsub(arg_1)\n        else:\n            arg_0.reply('nosub')", "path": "dddp/websocket.py", "identifier": "DDPWebSocketApplication.recv_unsub", "docstring": "DDP unsub handler.", "docstring_tokens": ["DDP", "unsub", "handler", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 256875}
{"url": "https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L460-L468", "sha": "ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e", "docstring_summary": "Get the netnode used to store settings metadata in the current IDB.\n    Note that this implicitly uses the open IDB via the idc iterface.", "language": "python", "parameters": "()", "return_statement": "return netnode.Netnode(node_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "\"$ {org:s}.{application:s}\"", ".", "format", "(", "org", "=", "IDA_SETTINGS_ORGANIZATION", ",", "application", "=", "IDA_SETTINGS_APPLICATION", ")", "return", "netnode", ".", "Netnode", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"\n    Get the netnode used to store settings metadata in the current IDB.\n    Note that this implicitly uses the open IDB via the idc iterface.\n    \"\"\"\n    arg_0 = \"$ {org:s}.{application:s}\".format(\n        org=IDA_SETTINGS_ORGANIZATION,\n        application=IDA_SETTINGS_APPLICATION)\n    return netnode.Netnode(arg_0)", "path": "ida_settings/ida_settings.py", "identifier": "get_meta_netnode", "docstring": "Get the netnode used to store settings metadata in the current IDB.\n    Note that this implicitly uses the open IDB via the idc iterface.", "docstring_tokens": ["Get", "the", "netnode", "used", "to", "store", "settings", "metadata", "in", "the", "current", "IDB", ".", "Note", "that", "this", "implicitly", "uses", "the", "open", "IDB", "via", "the", "idc", "iterface", "."], "nwo": "williballenthin/ida-settings", "score": 0.18657722465184873, "idx": 256876}
{"url": "https://github.com/calebsmith/django-template-debug/blob/f3d52638da571164d63e5c8331d409b0743c628f/template_debug/templatetags/debug_tags.py#L107-L128", "sha": "f3d52638da571164d63e5c8331d409b0743c628f", "docstring_summary": "Start a pydev settrace", "language": "python", "parameters": "(context)", "return_statement": "return ''", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "global", "arg_1", "if", "arg_1", ":", "return", "''", "try", ":", "import", "Func", "except", "ImportError", ":", "arg_1", "=", "True", "return", "''", "arg_2", "=", "lambda", "s", ":", "template", ".", "Template", "(", "s", ")", ".", "render", "(", "arg_0", ")", "arg_3", "=", "get_variables", "(", "arg_0", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "(", ")", "[", "arg_4", "]", "=", "arg_0", "[", "arg_4", "]", "try", ":", "Func", ".", "settrace", "(", ")", "except", "socket", ".", "error", ":", "arg_1", "=", "True", "return", "''"], "function": "def Func(arg_0):\n    \"\"\"\n    Start a pydev settrace\n    \"\"\"\n    global arg_1\n    if arg_1:\n        return ''\n    try:\n        import Func\n    except ImportError:\n        arg_1 = True\n        return ''\n    arg_2 = lambda s: template.Template(s).render(arg_0)\n    arg_3 = get_variables(arg_0)\n    for arg_4 in arg_3:\n        arg_5()[arg_4] = arg_0[arg_4]\n    #catch the case where no client is listening\n    try:\n        Func.settrace()\n    except socket.error:\n        arg_1 = True\n    return ''", "path": "template_debug/templatetags/debug_tags.py", "identifier": "pydevd", "docstring": "Start a pydev settrace", "docstring_tokens": ["Start", "a", "pydev", "settrace"], "nwo": "calebsmith/django-template-debug", "score": 0.31606306836212245, "idx": 256877}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/topology.py#L150-L177", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Initializes a topology protobuf", "language": "python", "parameters": "(mcs, classname, class_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "'Topology'", ":", "return", "arg_3", "=", "TopologyType", ".", "get_heron_options_from_env", "(", ")", "arg_4", "=", "arg_3", ".", "get", "(", "\"cmdline.topology.initial.state\"", ",", "\"RUNNING\"", ")", "arg_5", "=", "arg_3", ".", "get", "(", "\"cmdline.topologydefn.tmpdirectory\"", ")", "if", "arg_5", "is", "None", ":", "raise", "RuntimeError", "(", "\"Topology definition temp directory not specified\"", ")", "arg_6", "=", "arg_3", ".", "get", "(", "\"cmdline.topology.name\"", ",", "arg_1", ")", "arg_7", "=", "arg_6", "+", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "arg_8", "=", "topology_pb2", ".", "Topology", "(", ")", "arg_8", ".", "id", "=", "arg_7", "arg_8", ".", "name", "=", "arg_6", "arg_8", ".", "state", "=", "topology_pb2", ".", "TopologyState", ".", "Value", "(", "arg_4", ")", "arg_8", ".", "topology_config", ".", "CopyFrom", "(", "TopologyType", ".", "get_topology_config_protobuf", "(", "arg_2", ")", ")", "TopologyType", ".", "add_bolts_and_spouts", "(", "arg_8", ",", "arg_2", ")", "arg_2", "[", "'topology_name'", "]", "=", "arg_6", "arg_2", "[", "'topology_id'", "]", "=", "arg_7", "arg_2", "[", "'protobuf_topology'", "]", "=", "arg_8", "arg_2", "[", "'topologydefn_tmpdir'", "]", "=", "arg_5", "arg_2", "[", "'heron_runtime_options'", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Initializes a topology protobuf\"\"\"\n    if arg_1 == 'Topology':\n      # Base class can't initialize protobuf\n      return\n    arg_3 = TopologyType.get_heron_options_from_env()\n    arg_4 = arg_3.get(\"cmdline.topology.initial.state\", \"RUNNING\")\n    arg_5 = arg_3.get(\"cmdline.topologydefn.tmpdirectory\")\n    if arg_5 is None:\n      raise RuntimeError(\"Topology definition temp directory not specified\")\n\n    arg_6 = arg_3.get(\"cmdline.topology.name\", arg_1)\n    arg_7 = arg_6 + str(uuid.uuid4())\n\n    # create protobuf\n    arg_8 = topology_pb2.Topology()\n    arg_8.id = arg_7\n    arg_8.name = arg_6\n    arg_8.state = topology_pb2.TopologyState.Value(arg_4)\n    arg_8.topology_config.CopyFrom(TopologyType.get_topology_config_protobuf(arg_2))\n\n    TopologyType.add_bolts_and_spouts(arg_8, arg_2)\n\n    arg_2['topology_name'] = arg_6\n    arg_2['topology_id'] = arg_7\n    arg_2['protobuf_topology'] = arg_8\n    arg_2['topologydefn_tmpdir'] = arg_5\n    arg_2['heron_runtime_options'] = arg_3", "path": "heronpy/api/topology.py", "identifier": "TopologyType.init_topology", "docstring": "Initializes a topology protobuf", "docstring_tokens": ["Initializes", "a", "topology", "protobuf"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256878}
{"url": "https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/templatetags/publication_extras.py#L50-L64", "sha": "5a75cf88cf794937711b6850ff2acb07fe005f08", "docstring_summary": "Get a single publication.", "language": "python", "parameters": "(context, id)", "return_statement": "return render_template(\n\t\t'publications/publication.html', context['request'], {'publication': pbl[0]})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Publication", ".", "objects", ".", "filter", "(", "pk", "=", "int", "(", "arg_1", ")", ")", "if", "len", "(", "arg_2", ")", "<", "1", ":", "return", "''", "arg_2", "[", "0", "]", ".", "links", "=", "arg_2", "[", "0", "]", ".", "customlink_set", ".", "all", "(", ")", "arg_2", "[", "0", "]", ".", "files", "=", "arg_2", "[", "0", "]", ".", "customfile_set", ".", "all", "(", ")", "return", "render_template", "(", "'publications/publication.html'", ",", "arg_0", "[", "'request'", "]", ",", "{", "'publication'", ":", "arg_2", "[", "0", "]", "}", ")"], "function": "def Func(arg_0, arg_1):\n\t\"\"\"\n\tGet a single publication.\n\t\"\"\"\n\n\targ_2 = Publication.objects.filter(pk=int(arg_1))\n\n\tif len(arg_2) < 1:\n\t\treturn ''\n\n\targ_2[0].links = arg_2[0].customlink_set.all()\n\targ_2[0].files = arg_2[0].customfile_set.all()\n\n\treturn render_template(\n\t\t'publications/publication.html', arg_0['request'], {'publication': arg_2[0]})", "path": "publications/templatetags/publication_extras.py", "identifier": "get_publication", "docstring": "Get a single publication.", "docstring_tokens": ["Get", "a", "single", "publication", "."], "nwo": "lucastheis/django-publications", "score": 0.41971037138316925, "idx": 256879}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/base.py#L455-L463", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Get extra attributes", "language": "python", "parameters": "(self, attrs=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "_baseattrs", "for", "arg_3", "in", "arg_1", ":", "if", "hasattr", "(", "arg_0", ",", "arg_3", ")", ":", "arg_2", "[", "arg_3", "]", "=", "getattr", "(", "arg_0", ",", "arg_3", ")", ".", "Func", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Get extra attributes\"\"\"\n        arg_2 = arg_0._baseattrs\n\n        for arg_3 in arg_1:\n            if hasattr(arg_0, arg_3):\n                arg_2[arg_3] = getattr(arg_0, arg_3).Func(arg_1)\n\n        return arg_2", "path": "modelx/core/base.py", "identifier": "Interface._to_attrdict", "docstring": "Get extra attributes", "docstring_tokens": ["Get", "extra", "attributes"], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 256880}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/jetstream/jetstream.py#L119-L129", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Scale in resources", "language": "python", "parameters": "(self, blocks=0, machines=0, strategy=None)", "return_statement": "return count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "0", "arg_5", "=", "arg_0", ".", "client", ".", "servers", ".", "list", "(", ")", "for", "arg_6", "in", "arg_5", "[", "0", ":", "arg_2", "]", ":", "print", "(", "\"Deleting : \"", ",", "arg_6", ")", "arg_6", ".", "delete", "(", ")", "arg_4", "+=", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1=0, arg_2=0, arg_3=None):\n        ''' Scale in resources\n        '''\n        arg_4 = 0\n        arg_5 = arg_0.client.servers.list()\n        for arg_6 in arg_5[0:arg_2]:\n            print(\"Deleting : \", arg_6)\n            arg_6.delete()\n            arg_4 += 1\n\n        return arg_4", "path": "parsl/providers/jetstream/jetstream.py", "identifier": "JetstreamProvider.scale_in", "docstring": "Scale in resources", "docstring_tokens": ["Scale", "in", "resources"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 256881}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/file_info.py#L175-L200", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Determine if an input file is silent.", "language": "python", "parameters": "(input_filepath, threshold=0.001)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.001", ")", ":", "validate_input_file", "(", "arg_0", ")", "arg_2", "=", "stat", "(", "arg_0", ")", "arg_3", "=", "arg_2", "[", "'Mean    norm'", "]", "if", "arg_3", "is", "not", "float", "(", "'nan'", ")", ":", "if", "arg_3", ">=", "arg_1", ":", "return", "False", "else", ":", "return", "True", "else", ":", "return", "True"], "function": "def Func(arg_0, arg_1=0.001):\n    '''\n    Determine if an input file is Func.\n\n    Parameters\n    ----------\n    input_filepath : str\n        The input filepath.\n    threshold : float\n        Threshold for determining silence\n\n    Returns\n    -------\n    is_Func : bool\n        True if file is determined Func.\n    '''\n    validate_input_file(arg_0)\n    arg_2 = stat(arg_0)\n    arg_3 = arg_2['Mean    norm']\n    if arg_3 is not float('nan'):\n        if arg_3 >= arg_1:\n            return False\n        else:\n            return True\n    else:\n        return True", "path": "sox/file_info.py", "identifier": "silent", "docstring": "Determine if an input file is silent.\n\n    Parameters\n    ----------\n    input_filepath : str\n        The input filepath.\n    threshold : float\n        Threshold for determining silence\n\n    Returns\n    -------\n    is_silent : bool\n        True if file is determined silent.", "docstring_tokens": ["Determine", "if", "an", "input", "file", "is", "silent", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 256882}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/ext/jprops.py#L80-L98", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Write a single property to the file in Java properties format.", "language": "python", "parameters": "(fh, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "COMMENT", ":", "write_comment", "(", "arg_0", ",", "arg_2", ")", "return", "_require_string", "(", "arg_1", ",", "'keys'", ")", "_require_string", "(", "arg_2", ",", "'values'", ")", "arg_0", ".", "write", "(", "_escape_key", "(", "arg_1", ")", ")", "arg_0", ".", "write", "(", "b'='", ")", "arg_0", ".", "write", "(", "_escape_value", "(", "arg_2", ")", ")", "arg_0", ".", "write", "(", "b'\\n'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"\n    Write a single property to the file in Java properties format.\n\n    :param fh: a writable file-like object\n    :param key: the key to write\n    :param value: the value to write\n  \"\"\"\n  if arg_1 is COMMENT:\n    write_comment(arg_0, arg_2)\n    return\n\n  _require_string(arg_1, 'keys')\n  _require_string(arg_2, 'values')\n\n  arg_0.write(_escape_key(arg_1))\n  arg_0.write(b'=')\n  arg_0.write(_escape_value(arg_2))\n  arg_0.write(b'\\n')", "path": "packages/vaex-core/vaex/ext/jprops.py", "identifier": "write_property", "docstring": "Write a single property to the file in Java properties format.\n\n    :param fh: a writable file-like object\n    :param key: the key to write\n    :param value: the value to write", "docstring_tokens": ["Write", "a", "single", "property", "to", "the", "file", "in", "Java", "properties", "format", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 256883}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L308-L335", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Estimate whether the line string is at least partially inside the image.", "language": "python", "parameters": "(self, image, default=False)", "return_statement": "return len(self.clip_out_of_image(image)) > 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "len", "(", "arg_0", ".", "coords", ")", "==", "0", ":", "return", "arg_2", "arg_3", "=", "arg_0", ".", "get_pointwise_inside_image_mask", "(", "arg_1", ")", "if", "np", ".", "any", "(", "arg_3", ")", ":", "return", "True", "return", "len", "(", "arg_0", ".", "clip_out_of_image", "(", "arg_1", ")", ")", ">", "0"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Estimate whether the line string is at least partially inside the image.\n\n        Parameters\n        ----------\n        image : ndarray or tuple of int\n            Either an image with shape ``(H,W,[C])`` or a tuple denoting\n            such an image shape.\n\n        default\n            Default value to return if the line string contains no points.\n\n        Returns\n        -------\n        bool\n            True if the line string is at least partially inside the image area.\n            False otherwise.\n\n        \"\"\"\n        if len(arg_0.coords) == 0:\n            return arg_2\n        # check mask first to avoid costly computation of intersection points\n        # whenever possible\n        arg_3 = arg_0.get_pointwise_inside_image_mask(arg_1)\n        if np.any(arg_3):\n            return True\n        return len(arg_0.clip_out_of_image(arg_1)) > 0", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.is_partly_within_image", "docstring": "Estimate whether the line string is at least partially inside the image.\n\n        Parameters\n        ----------\n        image : ndarray or tuple of int\n            Either an image with shape ``(H,W,[C])`` or a tuple denoting\n            such an image shape.\n\n        default\n            Default value to return if the line string contains no points.\n\n        Returns\n        -------\n        bool\n            True if the line string is at least partially inside the image area.\n            False otherwise.", "docstring_tokens": ["Estimate", "whether", "the", "line", "string", "is", "at", "least", "partially", "inside", "the", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 256884}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/model.py#L203-L207", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Return all metabolites' compartments.", "language": "python", "parameters": "(self)", "return_statement": "return {met.compartment for met in self.metabolites\n                if met.compartment is not None}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "warn", "(", "'use Model.compartments instead'", ",", "DeprecationWarning", ")", "return", "{", "arg_1", ".", "compartment", "for", "arg_1", "in", "arg_0", ".", "metabolites", "if", "arg_1", ".", "compartment", "is", "not", "None", "}"], "function": "def Func(arg_0):\n        \"\"\"Return all metabolites' compartments.\"\"\"\n        warn('use Model.compartments instead', DeprecationWarning)\n        return {arg_1.compartment for arg_1 in arg_0.metabolites\n                if arg_1.compartment is not None}", "path": "cobra/core/model.py", "identifier": "Model.get_metabolite_compartments", "docstring": "Return all metabolites' compartments.", "docstring_tokens": ["Return", "all", "metabolites", "compartments", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 256885}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/examples/extraterrestrial_maurauders.py#L78-L88", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Builds and returns an Extraterrestrial Marauders game.", "language": "python", "parameters": "()", "return_statement": "return ascii_art.ascii_art_to_game(\n      GAME_ART, what_lies_beneath=' ',\n      sprites=dict(\n          [('P', PlayerSprite)] +\n          [(c, UpwardLaserBoltSprite) for c in UPWARD_BOLT_CHARS] +\n          [(c, DownwardLaserBoltSprite) for c in DOWNWARD_BOLT_CHARS]),\n      drapes=dict(X=MarauderDrape,\n                  B=BunkerDrape),\n      update_schedule=['P', 'B', 'X'] + list(_ALL_BOLT_CHARS))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "return", "ascii_art", ".", "ascii_art_to_game", "(", "GAME_ART", ",", "what_lies_beneath", "=", "' '", ",", "sprites", "=", "dict", "(", "[", "(", "'P'", ",", "PlayerSprite", ")", "]", "+", "[", "(", "arg_0", ",", "UpwardLaserBoltSprite", ")", "for", "arg_0", "in", "UPWARD_BOLT_CHARS", "]", "+", "[", "(", "arg_0", ",", "DownwardLaserBoltSprite", ")", "for", "arg_0", "in", "DOWNWARD_BOLT_CHARS", "]", ")", ",", "drapes", "=", "dict", "(", "X", "=", "MarauderDrape", ",", "B", "=", "BunkerDrape", ")", ",", "update_schedule", "=", "[", "'P'", ",", "'B'", ",", "'X'", "]", "+", "list", "(", "_ALL_BOLT_CHARS", ")", ")"], "function": "def Func():\n  \"\"\"Builds and returns an Extraterrestrial Marauders game.\"\"\"\n  return ascii_art.ascii_art_to_game(\n      GAME_ART, what_lies_beneath=' ',\n      sprites=dict(\n          [('P', PlayerSprite)] +\n          [(arg_0, UpwardLaserBoltSprite) for arg_0 in UPWARD_BOLT_CHARS] +\n          [(arg_0, DownwardLaserBoltSprite) for arg_0 in DOWNWARD_BOLT_CHARS]),\n      drapes=dict(X=MarauderDrape,\n                  B=BunkerDrape),\n      update_schedule=['P', 'B', 'X'] + list(_ALL_BOLT_CHARS))", "path": "examples/extraterrestrial_maurauders.py", "identifier": "make_game", "docstring": "Builds and returns an Extraterrestrial Marauders game.", "docstring_tokens": ["Builds", "and", "returns", "an", "Extraterrestrial", "Marauders", "game", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 256886}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/config.py#L58-L100", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Set a specific setting value.", "language": "python", "parameters": "(self, setting, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_expected_settings", "+", "arg_0", ".", "_optional_settings", ":", "raise", "exceptions", ".", "ConfigurationError", "(", "\"Setting '{0}' is not supported.\"", ".", "format", "(", "arg_1", ")", ")", "if", "arg_1", "==", "'hostname'", ":", "arg_0", ".", "_set_hostname", "(", "arg_2", ")", "elif", "arg_1", "==", "'port'", ":", "arg_0", ".", "_set_port", "(", "arg_2", ")", "elif", "arg_1", "==", "'certificate_path'", ":", "arg_0", ".", "_set_certificate_path", "(", "arg_2", ")", "elif", "arg_1", "==", "'key_path'", ":", "arg_0", ".", "_set_key_path", "(", "arg_2", ")", "elif", "arg_1", "==", "'ca_path'", ":", "arg_0", ".", "_set_ca_path", "(", "arg_2", ")", "elif", "arg_1", "==", "'auth_suite'", ":", "arg_0", ".", "_set_auth_suite", "(", "arg_2", ")", "elif", "arg_1", "==", "'policy_path'", ":", "arg_0", ".", "_set_policy_path", "(", "arg_2", ")", "elif", "arg_1", "==", "'enable_tls_client_auth'", ":", "arg_0", ".", "_set_enable_tls_client_auth", "(", "arg_2", ")", "elif", "arg_1", "==", "'tls_cipher_suites'", ":", "arg_0", ".", "_set_tls_cipher_suites", "(", "arg_2", ")", "elif", "arg_1", "==", "'logging_level'", ":", "arg_0", ".", "_set_logging_level", "(", "arg_2", ")", "else", ":", "arg_0", ".", "_set_database_path", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set a specific setting value.\n\n        This will overwrite the current setting value for the specified\n        setting.\n\n        Args:\n            setting (string): The name of the setting to set (e.g.,\n                'certificate_path', 'hostname'). Required.\n            value (misc): The value of the setting to set. Type varies based\n                on setting. Required.\n        Raises:\n            ConfigurationError: Raised if the setting is not supported or if\n                the setting value is invalid.\n        \"\"\"\n        if arg_1 not in arg_0._expected_settings + arg_0._optional_settings:\n            raise exceptions.ConfigurationError(\n                \"Setting '{0}' is not supported.\".format(arg_1)\n            )\n\n        if arg_1 == 'hostname':\n            arg_0._set_hostname(arg_2)\n        elif arg_1 == 'port':\n            arg_0._set_port(arg_2)\n        elif arg_1 == 'certificate_path':\n            arg_0._set_certificate_path(arg_2)\n        elif arg_1 == 'key_path':\n            arg_0._set_key_path(arg_2)\n        elif arg_1 == 'ca_path':\n            arg_0._set_ca_path(arg_2)\n        elif arg_1 == 'auth_suite':\n            arg_0._set_auth_suite(arg_2)\n        elif arg_1 == 'policy_path':\n            arg_0._set_policy_path(arg_2)\n        elif arg_1 == 'enable_tls_client_auth':\n            arg_0._set_enable_tls_client_auth(arg_2)\n        elif arg_1 == 'tls_cipher_suites':\n            arg_0._set_tls_cipher_suites(arg_2)\n        elif arg_1 == 'logging_level':\n            arg_0._set_logging_level(arg_2)\n        else:\n            arg_0._set_database_path(arg_2)", "path": "kmip/services/server/config.py", "identifier": "KmipServerConfig.set_setting", "docstring": "Set a specific setting value.\n\n        This will overwrite the current setting value for the specified\n        setting.\n\n        Args:\n            setting (string): The name of the setting to set (e.g.,\n                'certificate_path', 'hostname'). Required.\n            value (misc): The value of the setting to set. Type varies based\n                on setting. Required.\n        Raises:\n            ConfigurationError: Raised if the setting is not supported or if\n                the setting value is invalid.", "docstring_tokens": ["Set", "a", "specific", "setting", "value", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 256887}
{"url": "https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/reaction_type_control.py#L51-L64", "sha": "cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3", "docstring_summary": "Fit structure-based AD. The training model  memorizes the unique set of reaction signature.", "language": "python", "parameters": "(self, X)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "iter2array", "(", "arg_1", ",", "dtype", "=", "ReactionContainer", ")", "arg_0", ".", "_train_signatures", "=", "{", "arg_0", ".", "__get_signature", "(", "x", ")", "for", "x", "in", "arg_1", "}", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Fit structure-based AD. The training model  memorizes the unique set of reaction signature.\n\n        Parameters\n        ----------\n        X : after read rdf file\n\n        Returns\n        -------\n        self : object\n        \"\"\"\n        arg_1 = iter2array(arg_1, dtype=ReactionContainer)\n        arg_0._train_signatures = {arg_0.__get_signature(x) for x in arg_1}\n        return arg_0", "path": "CIMtools/applicability_domain/reaction_type_control.py", "identifier": "ReactionTypeControl.fit", "docstring": "Fit structure-based AD. The training model  memorizes the unique set of reaction signature.\n\n        Parameters\n        ----------\n        X : after read rdf file\n\n        Returns\n        -------\n        self : object", "docstring_tokens": ["Fit", "structure", "-", "based", "AD", ".", "The", "training", "model", "memorizes", "the", "unique", "set", "of", "reaction", "signature", "."], "nwo": "stsouko/CIMtools", "score": 0.37700202640577024, "idx": 256888}
{"url": "https://github.com/mrsarm/mongotail/blob/82ba74e32eff92faa320833a8d19c58555f9cd49/mongotail/err.py#L42-L48", "sha": "82ba74e32eff92faa320833a8d19c58555f9cd49", "docstring_summary": "Print any parsing error and exit with status -1", "language": "python", "parameters": "(msg=\"unknown options\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"unknown options\"", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"Error parsing command line: %s\\ntry 'mongotail --help' for more information\\n\"", "%", "arg_0", ")", "sys", ".", "stderr", ".", "flush", "(", ")", "exit", "(", "EINVAL", ")"], "function": "def Func(arg_0=\"unknown options\"):\n    \"\"\"\n    Print any parsing error and exit with status -1\n    \"\"\"\n    sys.stderr.write(\"Error parsing command line: %s\\ntry 'mongotail --help' for more information\\n\" % arg_0)\n    sys.stderr.flush()\n    exit(EINVAL)", "path": "mongotail/err.py", "identifier": "error_parsing", "docstring": "Print any parsing error and exit with status -1", "docstring_tokens": ["Print", "any", "parsing", "error", "and", "exit", "with", "status", "-", "1"], "nwo": "mrsarm/mongotail", "score": 0.5669847104023414, "idx": 256889}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/text.py#L72-L74", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Returns the length of the element, including the box around.", "language": "python", "parameters": "(self)", "return_statement": "return max(len(self.top), len(self.mid), len(self.bot))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "max", "(", "len", "(", "arg_0", ".", "top", ")", ",", "len", "(", "arg_0", ".", "mid", ")", ",", "len", "(", "arg_0", ".", "bot", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Returns the Func of the element, including the box around.\"\"\"\n        return max(len(arg_0.top), len(arg_0.mid), len(arg_0.bot))", "path": "qiskit/visualization/text.py", "identifier": "DrawElement.length", "docstring": "Returns the length of the element, including the box around.", "docstring_tokens": ["Returns", "the", "length", "of", "the", "element", "including", "the", "box", "around", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256890}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_sre.py#L586-L596", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Returns True if the current context matches, False if it doesn't and\n        None if matching is not finished, ie must be resumed after child\n        contexts have been matched.", "language": "python", "parameters": "(self, context)", "return_statement": "return context.has_matched", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "arg_1", ".", "remaining_codes", "(", ")", ">", "0", "and", "arg_1", ".", "has_Funced", "is", "None", ":", "arg_2", "=", "arg_1", ".", "peek_code", "(", ")", "if", "not", "arg_0", ".", "dispatch", "(", "arg_2", ",", "arg_1", ")", ":", "return", "None", "if", "arg_1", ".", "has_Funced", "is", "None", ":", "arg_1", ".", "has_Funced", "=", "False", "return", "arg_1", ".", "has_Funced"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns True if the current context Funces, False if it doesn't and\n        None if Funcing is not finished, ie must be resumed after child\n        contexts have been Funced.\"\"\"\n        while arg_1.remaining_codes() > 0 and arg_1.has_Funced is None:\n            arg_2 = arg_1.peek_code()\n            if not arg_0.dispatch(arg_2, arg_1):\n                return None\n        if arg_1.has_Funced is None:\n            arg_1.has_Funced = False\n        return arg_1.has_Funced", "path": "third_party/pypy/_sre.py", "identifier": "_OpcodeDispatcher.match", "docstring": "Returns True if the current context matches, False if it doesn't and\n        None if matching is not finished, ie must be resumed after child\n        contexts have been matched.", "docstring_tokens": ["Returns", "True", "if", "the", "current", "context", "matches", "False", "if", "it", "doesn", "t", "and", "None", "if", "matching", "is", "not", "finished", "ie", "must", "be", "resumed", "after", "child", "contexts", "have", "been", "matched", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 256891}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L235-L293", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Migrate an expression created for a different constraint set to self.\n            Returns an expression that can be used with this constraintSet", "language": "python", "parameters": "(self, expression, name_migration_map=None)", "return_statement": "return migrated_expression", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "{", "}", "arg_3", "=", "{", "}", "arg_4", "=", "itertools", ".", "filterfalse", "(", "arg_0", ".", "is_declared", ",", "get_variables", "(", "arg_1", ")", ")", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", ".", "name", "in", "arg_2", ":", "arg_6", "=", "arg_2", "[", "arg_5", ".", "name", "]", "arg_7", "=", "arg_0", ".", "get_variable", "(", "arg_6", ")", "assert", "arg_7", "is", "not", "None", ",", "\"name_migration_map contains a variable that does not exist in this ConstraintSet\"", "arg_3", "[", "arg_5", "]", "=", "arg_7", "else", ":", "arg_6", "=", "arg_5", ".", "name", "if", "arg_6", "in", "arg_0", ".", "_declarations", ":", "arg_6", "=", "arg_0", ".", "_make_unique_name", "(", "f'{foreign_var.name}_Funcd'", ")", "if", "isinstance", "(", "arg_5", ",", "Bool", ")", ":", "arg_8", "=", "arg_0", ".", "new_bool", "(", "arg_9", "=", "arg_6", ")", "elif", "isinstance", "(", "arg_5", ",", "BitVec", ")", ":", "arg_8", "=", "arg_0", ".", "new_bitvec", "(", "arg_5", ".", "size", ",", "arg_9", "=", "arg_6", ")", "elif", "isinstance", "(", "arg_5", ",", "Array", ")", ":", "arg_8", "=", "arg_0", ".", "new_array", "(", "index_max", "=", "arg_5", ".", "index_max", ",", "index_bits", "=", "arg_5", ".", "index_bits", ",", "value_bits", "=", "arg_5", ".", "value_bits", ",", "arg_9", "=", "arg_6", ")", ".", "array", "else", ":", "raise", "NotImplemented", "(", "f\"Unknown expression type {type(var)} encountered during expression migration\"", ")", "arg_3", "[", "arg_5", "]", "=", "arg_8", "arg_2", "[", "arg_5", ".", "name", "]", "=", "arg_8", ".", "name", "arg_10", "=", "replace", "(", "arg_1", ",", "arg_3", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\" Migrate an expression created for a different constraint set to self.\n            Returns an expression that can be used with this constraintSet\n\n            All the foreign variables used in the expression are replaced by\n            variables of this constraint set. If the variable was replaced before\n            the replacement is taken from the provided migration map.\n\n            The migration mapping is updated with new replacements.\n\n            :param expression: the potentially foreign expression\n            :param name_migration_map: mapping of already Funcd variables. maps from string name of foreign variable to its currently existing Funcd string name. this is updated during this migration.\n            :return: a Funcd expression where all the variables are local. name_migration_map is updated\n\n        \"\"\"\n        if arg_2 is None:\n            arg_2 = {}\n\n        #  name_migration_map -> object_migration_map\n        #  Based on the name mapping in name_migration_map build an object to\n        #  object mapping to be used in the replacing of variables\n        #  inv: object_migration_map's keys should ALWAYS be external/foreign\n        #  expressions, and its values should ALWAYS be internal/local expressions\n        arg_3 = {}\n\n        #List of foreign vars used in expression\n        arg_4 = itertools.filterfalse(arg_0.is_declared, get_variables(arg_1))\n        for arg_5 in arg_4:\n            # If a variable with the same name was previously Funcd\n            if arg_5.name in arg_2:\n                arg_6 = arg_2[arg_5.name]\n                arg_7 = arg_0.get_variable(arg_6)\n                assert arg_7 is not None, \"name_migration_map contains a variable that does not exist in this ConstraintSet\"\n                arg_3[arg_5] = arg_7\n            else:\n                # foreign_var was not found in the local declared variables nor\n                # any variable with the same name was previously Funcd\n                # let's make a new unique internal name for it\n                arg_6 = arg_5.name\n                if arg_6 in arg_0._declarations:\n                    arg_6 = arg_0._make_unique_name(f'{foreign_var.name}_Funcd')\n                # Create and declare a new variable of given type\n                if isinstance(arg_5, Bool):\n                    arg_8 = arg_0.new_bool(arg_9=arg_6)\n                elif isinstance(arg_5, BitVec):\n                    arg_8 = arg_0.new_bitvec(arg_5.size, arg_9=arg_6)\n                elif isinstance(arg_5, Array):\n                    # Note that we are discarding the ArrayProxy encapsulation\n                    arg_8 = arg_0.new_array(index_max=arg_5.index_max, index_bits=arg_5.index_bits, value_bits=arg_5.value_bits, arg_9=arg_6).array\n                else:\n                    raise NotImplemented(f\"Unknown expression type {type(var)} encountered during expression migration\")\n                # Update the var to var mapping\n                arg_3[arg_5] = arg_8\n                # Update the name to name mapping\n                arg_2[arg_5.name] = arg_8.name\n\n        #  Actually replace each appearance of Funcd variables by the new ones\n        arg_10 = replace(arg_1, arg_3)\n        return arg_10", "path": "manticore/core/smtlib/constraints.py", "identifier": "ConstraintSet.migrate", "docstring": "Migrate an expression created for a different constraint set to self.\n            Returns an expression that can be used with this constraintSet\n\n            All the foreign variables used in the expression are replaced by\n            variables of this constraint set. If the variable was replaced before\n            the replacement is taken from the provided migration map.\n\n            The migration mapping is updated with new replacements.\n\n            :param expression: the potentially foreign expression\n            :param name_migration_map: mapping of already migrated variables. maps from string name of foreign variable to its currently existing migrated string name. this is updated during this migration.\n            :return: a migrated expression where all the variables are local. name_migration_map is updated", "docstring_tokens": ["Migrate", "an", "expression", "created", "for", "a", "different", "constraint", "set", "to", "self", ".", "Returns", "an", "expression", "that", "can", "be", "used", "with", "this", "constraintSet"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256892}
{"url": "https://github.com/kennethreitz/flask-common/blob/7345514942f863396056e0fd252f29082623cec6/flask_common.py#L136-L149", "sha": "7345514942f863396056e0fd252f29082623cec6", "docstring_summary": "Serves the Flask application.", "language": "python", "parameters": "(self, workers=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "if", "arg_0", ".", "app", ".", "debug", ":", "print", "(", "crayons", ".", "yellow", "(", "'Booting Flask development Funcr...'", ")", ")", "arg_0", ".", "app", ".", "run", "(", ")", "else", ":", "print", "(", "crayons", ".", "yellow", "(", "'Booting Gunicorn...'", ")", ")", "arg_3", "=", "GunicornServer", "(", "arg_0", ".", "app", ",", "arg_1", "=", "arg_1", "or", "number_of_gunicorn_workers", "(", ")", ",", "worker_class", "=", "'egg:meinheld#gunicorn_worker'", ",", "**", "arg_2", ")", "arg_3", ".", "run", "(", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"Serves the Flask application.\"\"\"\n        if arg_0.app.debug:\n            print(crayons.yellow('Booting Flask development Funcr...'))\n            arg_0.app.run()\n\n        else:\n            print(crayons.yellow('Booting Gunicorn...'))\n\n            # Start the web Funcr.\n            arg_3 = GunicornServer(\n                arg_0.app, arg_1=arg_1 or number_of_gunicorn_workers(),\n                worker_class='egg:meinheld#gunicorn_worker', **arg_2)\n            arg_3.run()", "path": "flask_common.py", "identifier": "Common.serve", "docstring": "Serves the Flask application.", "docstring_tokens": ["Serves", "the", "Flask", "application", "."], "nwo": "kennethreitz/flask-common", "score": 0.6060962843644482, "idx": 256893}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L378-L407", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "DDP connect handler.", "language": "python", "parameters": "(self, version=None, support=None, session=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "del", "arg_3", "if", "arg_0", ".", "connection", "is", "not", "None", ":", "raise", "MeteorError", "(", "400", ",", "'Session already established.'", ",", "arg_0", ".", "connection", ".", "connection_id", ",", ")", "elif", "None", "in", "(", "arg_1", ",", "arg_2", ")", "or", "arg_1", "not", "in", "arg_0", ".", "versions", ":", "arg_0", ".", "reply", "(", "'failed'", ",", "arg_1", "=", "arg_0", ".", "versions", "[", "0", "]", ")", "elif", "arg_1", "not", "in", "arg_2", ":", "raise", "MeteorError", "(", "400", ",", "'Client version/support mismatch.'", ")", "else", ":", "from", "dddp", ".", "models", "import", "Connection", "arg_4", "=", "arg_7", ".", "cursor", "(", ")", "arg_4", ".", "execute", "(", "'SELECT pg_backend_pid()'", ")", "(", "arg_5", ",", ")", "=", "arg_4", ".", "fetchone", "(", ")", "arg_6", ".", "version", "=", "arg_1", "arg_6", ".", "support", "=", "arg_2", "arg_0", ".", "connection", "=", "Connection", ".", "objects", ".", "create", "(", "server_addr", "=", "'%d:%s'", "%", "(", "arg_5", ",", "arg_0", ".", "ws", ".", "handler", ".", "socket", ".", "getsockname", "(", ")", ",", ")", ",", "remote_addr", "=", "arg_0", ".", "remote_addr", ",", "arg_1", "=", "arg_1", ",", ")", "arg_0", ".", "pgworker", ".", "connections", "[", "arg_0", ".", "connection", ".", "pk", "]", "=", "arg_0", "atexit", ".", "register", "(", "arg_0", ".", "on_close", ",", "'Shutting down.'", ")", "arg_0", ".", "reply", "(", "'connected'", ",", "arg_3", "=", "arg_0", ".", "connection", ".", "connection_id", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"DDP connect handler.\"\"\"\n        del arg_3  # Meteor doesn't even use this!\n        if arg_0.connection is not None:\n            raise MeteorError(\n                400, 'Session already established.',\n                arg_0.connection.connection_id,\n            )\n        elif None in (arg_1, arg_2) or arg_1 not in arg_0.versions:\n            arg_0.reply('failed', arg_1=arg_0.versions[0])\n        elif arg_1 not in arg_2:\n            raise MeteorError(400, 'Client version/support mismatch.')\n        else:\n            from dddp.models import Connection\n            arg_4 = arg_7.cursor()\n            arg_4.execute('SELECT pg_backend_pid()')\n            (arg_5,) = arg_4.fetchone()\n            arg_6.version = arg_1\n            arg_6.support = arg_2\n            arg_0.connection = Connection.objects.create(\n                server_addr='%d:%s' % (\n                    arg_5,\n                    arg_0.ws.handler.socket.getsockname(),\n                ),\n                remote_addr=arg_0.remote_addr,\n                arg_1=arg_1,\n            )\n            arg_0.pgworker.connections[arg_0.connection.pk] = arg_0\n            atexit.register(arg_0.on_close, 'Shutting down.')\n            arg_0.reply('connected', arg_3=arg_0.connection.connection_id)", "path": "dddp/websocket.py", "identifier": "DDPWebSocketApplication.recv_connect", "docstring": "DDP connect handler.", "docstring_tokens": ["DDP", "connect", "handler", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 256894}
{"url": "https://github.com/rossengeorgiev/aprs-python/blob/94b89a6da47a322129484efcaf1e82f6a9932891/aprslib/inet.py#L100-L122", "sha": "94b89a6da47a322129484efcaf1e82f6a9932891", "docstring_summary": "Initiate connection to APRS server and attempt to login", "language": "python", "parameters": "(self, blocking=False, retry=30)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "30", ")", ":", "if", "arg_0", ".", "_Funced", ":", "return", "while", "True", ":", "try", ":", "arg_0", ".", "_Func", "(", ")", "if", "not", "arg_0", ".", "skip_login", ":", "arg_0", ".", "_send_login", "(", ")", "break", "except", "(", "LoginError", ",", "ConnectionError", ")", ":", "if", "not", "arg_1", ":", "raise", "arg_0", ".", "logger", ".", "info", "(", "\"Retrying Funcion is %d seconds.\"", "%", "arg_2", ")", "time", ".", "sleep", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=30):\n        \"\"\"\n        Initiate Funcion to APRS server and attempt to login\n\n        blocking = False     - Should we block until Funced and logged-in\n        retry = 30           - Retry interval in seconds\n        \"\"\"\n\n        if arg_0._Funced:\n            return\n\n        while True:\n            try:\n                arg_0._Func()\n                if not arg_0.skip_login:\n                    arg_0._send_login()\n                break\n            except (LoginError, ConnectionError):\n                if not arg_1:\n                    raise\n\n            arg_0.logger.info(\"Retrying Funcion is %d seconds.\" % arg_2)\n            time.sleep(arg_2)", "path": "aprslib/inet.py", "identifier": "IS.connect", "docstring": "Initiate connection to APRS server and attempt to login\n\n        blocking = False     - Should we block until connected and logged-in\n        retry = 30           - Retry interval in seconds", "docstring_tokens": ["Initiate", "connection", "to", "APRS", "server", "and", "attempt", "to", "login"], "nwo": "rossengeorgiev/aprs-python", "score": 0.3643830340421162, "idx": 256895}
{"url": "https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L140-L143", "sha": "5b90a543b127ab9e6112fd547929b5ef4b8f0cbc", "docstring_summary": "Set RTS and DTR to the requested state.", "language": "python", "parameters": "(port, RTS, DTR)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "setRTS", "(", "arg_1", ")", "arg_0", ".", "setDTR", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Set RTS and DTR to the requested state.\"\"\"\n    arg_0.setRTS(arg_1)\n    arg_0.setDTR(arg_2)", "path": "x10_any/cm17a.py", "identifier": "_setRTSDTR", "docstring": "Set RTS and DTR to the requested state.", "docstring_tokens": ["Set", "RTS", "and", "DTR", "to", "the", "requested", "state", "."], "nwo": "clach04/x10_any", "score": 0.2751458370028208, "idx": 256896}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L1595-L1631", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Viz 1d, 2d or 3d in a Jupyter notebook", "language": "python", "parameters": "(self, x, y, z=None, grid=None, shape=256, limits=None, what=\"count(*)\", figsize=None,\n                    f=\"identity\", figure_key=None, fig=None, axes=None, xlabel=None, ylabel=None, title=None,\n                    show=True, selection=[None, True], colormap=\"afmhot\", grid_limits=None, normalize=\"normalize\",\n                    grid_before=None,\n                    what_kwargs={}, type=\"default\",\n                    scales=None, tool_select=False, bq_cleanup=True,\n                    backend=\"bqplot\",\n                    **kwargs)", "return_statement": "return plot2d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "256", ",", "arg_6", "=", "None", ",", "arg_7", "=", "\"count(*)\"", ",", "arg_8", "=", "None", ",", "arg_9", "=", "\"identity\"", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "None", ",", "arg_14", "=", "None", ",", "arg_15", "=", "None", ",", "arg_16", "=", "True", ",", "arg_17", "=", "[", "None", ",", "True", "]", ",", "arg_18", "=", "\"afmhot\"", ",", "arg_19", "=", "None", ",", "arg_20", "=", "\"normalize\"", ",", "arg_21", "=", "None", ",", "arg_22", "=", "{", "}", ",", "arg_23", "=", "\"default\"", ",", "arg_24", "=", "None", ",", "arg_25", "=", "False", ",", "arg_26", "=", "True", ",", "arg_27", "=", "\"bqplot\"", ",", "**", "arg_28", ")", ":", "import", "vaex", ".", "jupyter", ".", "plot", "arg_27", "=", "vaex", ".", "jupyter", ".", "plot", ".", "create_backend", "(", "arg_27", ")", "arg_29", "=", "vaex", ".", "jupyter", ".", "plot", ".", "get_type", "(", "arg_23", ")", "arg_1", "=", "_ensure_strings_from_expressions", "(", "arg_1", ")", "arg_2", "=", "_ensure_strings_from_expressions", "(", "arg_2", ")", "arg_3", "=", "_ensure_strings_from_expressions", "(", "arg_3", ")", "for", "arg_30", "in", "'vx vy vz'", ".", "split", "(", ")", ":", "if", "arg_30", "in", "arg_28", ":", "arg_28", "[", "arg_30", "]", "=", "_ensure_strings_from_expressions", "(", "arg_28", "[", "arg_30", "]", ")", "arg_31", "=", "arg_29", "(", "arg_27", "=", "arg_27", ",", "dataset", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_17", "=", "arg_17", ",", "arg_21", "=", "arg_21", ",", "arg_19", "=", "arg_19", ",", "arg_20", "=", "arg_20", ",", "arg_18", "=", "arg_18", ",", "arg_22", "=", "arg_22", ",", "**", "arg_28", ")", "if", "arg_16", ":", "arg_31", ".", "show", "(", ")", "return", "arg_31"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=256, arg_6=None, arg_7=\"count(*)\", arg_8=None,\n                    arg_9=\"identity\", arg_10=None, arg_11=None, arg_12=None, arg_13=None, arg_14=None, arg_15=None,\n                    arg_16=True, arg_17=[None, True], arg_18=\"afmhot\", arg_19=None, arg_20=\"normalize\",\n                    arg_21=None,\n                    arg_22={}, arg_23=\"default\",\n                    arg_24=None, arg_25=False, arg_26=True,\n                    arg_27=\"bqplot\",\n                    **arg_28):\n        \"\"\"Viz 1d, 2d or 3d in a Jupyter notebook\n\n        .. note::\n            This API is not fully settled and may change in the future\n\n        Example:\n\n        >>> df.Func(df.x, df.y, backend='bqplot')\n        >>> df.Func(df.pickup_longitude, df.pickup_latitude, backend='ipyleaflet')\n\n        :param backend: Widget backend to use: 'bqplot', 'ipyleaflet', 'ipyvolume', 'matplotlib'\n\n        \"\"\"\n        import vaex.jupyter.plot\n        arg_27 = vaex.jupyter.plot.create_backend(arg_27)\n        arg_29 = vaex.jupyter.plot.get_type(arg_23)\n        arg_1 = _ensure_strings_from_expressions(arg_1)\n        arg_2 = _ensure_strings_from_expressions(arg_2)\n        arg_3 = _ensure_strings_from_expressions(arg_3)\n        for arg_30 in 'vx vy vz'.split():\n            if arg_30 in arg_28:\n                arg_28[arg_30] = _ensure_strings_from_expressions(arg_28[arg_30])\n        arg_31 = arg_29(arg_27=arg_27, dataset=arg_0, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_6=arg_6, arg_7=arg_7,\n                     arg_9=arg_9, arg_10=arg_10, arg_11=arg_11,\n                     arg_17=arg_17, arg_21=arg_21,\n                     arg_19=arg_19, arg_20=arg_20, arg_18=arg_18, arg_22=arg_22, **arg_28)\n        if arg_16:\n            arg_31.show()\n        return arg_31", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.plot_widget", "docstring": "Viz 1d, 2d or 3d in a Jupyter notebook\n\n        .. note::\n            This API is not fully settled and may change in the future\n\n        Example:\n\n        >>> df.plot_widget(df.x, df.y, backend='bqplot')\n        >>> df.plot_widget(df.pickup_longitude, df.pickup_latitude, backend='ipyleaflet')\n\n        :param backend: Widget backend to use: 'bqplot', 'ipyleaflet', 'ipyvolume', 'matplotlib'", "docstring_tokens": ["Viz", "1d", "2d", "or", "3d", "in", "a", "Jupyter", "notebook"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 256897}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/highlight.py#L66-L76", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Adds a highlight tag to the given edges.", "language": "python", "parameters": "(graph: BELGraph, edges=None, color: Optional[str]=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", ":", "arg_4", "[", "arg_5", "]", "=", "None", ")", "->", "None", ":", "arg_3", "=", "arg_3", "or", "EDGE_HIGHLIGHT_DEFAULT_COLOR", "for", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "in", "arg_2", "if", "arg_2", "is", "not", "None", "else", "arg_0", ".", "edges", "(", "keys", "=", "True", ",", "data", "=", "True", ")", ":", "arg_0", "[", "arg_6", "]", "[", "arg_7", "]", "[", "arg_8", "]", "[", "arg_10", "]", "=", "arg_3"], "function": "def Func(arg_0: arg_1, arg_2=None, arg_3: arg_4[arg_5]=None) -> None:\n    \"\"\"Adds a highlight tag to the given edges.\n\n    :param graph: A BEL graph\n    :param edges: The edges (4-tuples of u, v, k, d) to add a highlight tag on\n    :type edges: iter[tuple]\n    :param str color: The color to highlight (use something that works with CSS)\n    \"\"\"\n    arg_3 = arg_3 or EDGE_HIGHLIGHT_DEFAULT_COLOR\n    for arg_6, arg_7, arg_8, arg_9 in arg_2 if arg_2 is not None else arg_0.edges(keys=True, data=True):\n        arg_0[arg_6][arg_7][arg_8][arg_10] = arg_3", "path": "src/pybel_tools/mutation/highlight.py", "identifier": "highlight_edges", "docstring": "Adds a highlight tag to the given edges.\n\n    :param graph: A BEL graph\n    :param edges: The edges (4-tuples of u, v, k, d) to add a highlight tag on\n    :type edges: iter[tuple]\n    :param str color: The color to highlight (use something that works with CSS)", "docstring_tokens": ["Adds", "a", "highlight", "tag", "to", "the", "given", "edges", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256898}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/agents/dqfd_agent.py#L204-L256", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Imports demonstrations, i.e. expert observations. Note that for large numbers of observations,\n        set_demonstrations is more appropriate, which directly sets memory contents to an array an expects\n        a different layout.", "language": "python", "parameters": "(self, demonstrations)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "if", "arg_0", ".", "unique_state", ":", "arg_1", "[", "'states'", "]", "=", "dict", "(", "arg_9", "=", "arg_1", "[", "'states'", "]", ")", "if", "arg_0", ".", "unique_action", ":", "arg_1", "[", "'actions'", "]", "=", "dict", "(", "arg_11", "=", "arg_1", "[", "'actions'", "]", ")", "arg_0", ".", "model", ".", "import_demo_experience", "(", "**", "arg_1", ")", "else", ":", "if", "arg_0", ".", "unique_state", ":", "arg_2", "=", "dict", "(", "arg_9", "=", "list", "(", ")", ")", "else", ":", "arg_2", "=", "{", "arg_8", ":", "list", "(", ")", "for", "arg_8", "in", "arg_1", "[", "0", "]", "[", "'states'", "]", "}", "arg_3", "=", "{", "arg_8", ":", "list", "(", ")", "for", "arg_8", "in", "arg_1", "[", "0", "]", "[", "'internals'", "]", "}", "if", "arg_0", ".", "unique_action", ":", "arg_4", "=", "dict", "(", "arg_11", "=", "list", "(", ")", ")", "else", ":", "arg_4", "=", "{", "arg_8", ":", "list", "(", ")", "for", "arg_8", "in", "arg_1", "[", "0", "]", "[", "'actions'", "]", "}", "arg_5", "=", "list", "(", ")", "arg_6", "=", "list", "(", ")", "for", "arg_7", "in", "arg_1", ":", "if", "arg_0", ".", "unique_state", ":", "arg_2", "[", "'state'", "]", ".", "append", "(", "arg_7", "[", "'states'", "]", ")", "else", ":", "for", "arg_8", ",", "arg_9", "in", "arg_2", ".", "items", "(", ")", ":", "arg_9", ".", "append", "(", "arg_7", "[", "'states'", "]", "[", "arg_8", "]", ")", "for", "arg_8", ",", "arg_10", "in", "arg_3", ".", "items", "(", ")", ":", "arg_10", ".", "append", "(", "arg_7", "[", "'internals'", "]", "[", "arg_8", "]", ")", "if", "arg_0", ".", "unique_action", ":", "arg_4", "[", "'action'", "]", ".", "append", "(", "arg_7", "[", "'actions'", "]", ")", "else", ":", "for", "arg_8", ",", "arg_11", "in", "arg_4", ".", "items", "(", ")", ":", "arg_11", ".", "append", "(", "arg_7", "[", "'actions'", "]", "[", "arg_8", "]", ")", "arg_5", ".", "append", "(", "arg_7", "[", "'terminal'", "]", ")", "arg_6", ".", "append", "(", "arg_7", "[", "'reward'", "]", ")", "arg_0", ".", "model", ".", "import_demo_experience", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Imports demonstrations, i.e. expert observations. Note that for large numbers of observations,\n        set_demonstrations is more appropriate, which directly sets memory contents to an array an expects\n        a different layout.\n\n        Args:\n            demonstrations: List of observation dicts\n        \"\"\"\n        if isinstance(arg_1, dict):\n            if arg_0.unique_state:\n                arg_1['states'] = dict(arg_9=arg_1['states'])\n            if arg_0.unique_action:\n                arg_1['actions'] = dict(arg_11=arg_1['actions'])\n\n            arg_0.model.import_demo_experience(**arg_1)\n\n        else:\n            if arg_0.unique_state:\n                arg_2 = dict(arg_9=list())\n            else:\n                arg_2 = {arg_8: list() for arg_8 in arg_1[0]['states']}\n            arg_3 = {arg_8: list() for arg_8 in arg_1[0]['internals']}\n            if arg_0.unique_action:\n                arg_4 = dict(arg_11=list())\n            else:\n                arg_4 = {arg_8: list() for arg_8 in arg_1[0]['actions']}\n            arg_5 = list()\n            arg_6 = list()\n\n            for arg_7 in arg_1:\n                if arg_0.unique_state:\n                    arg_2['state'].append(arg_7['states'])\n                else:\n                    for arg_8, arg_9 in arg_2.items():\n                        arg_9.append(arg_7['states'][arg_8])\n                for arg_8, arg_10 in arg_3.items():\n                    arg_10.append(arg_7['internals'][arg_8])\n                if arg_0.unique_action:\n                    arg_4['action'].append(arg_7['actions'])\n                else:\n                    for arg_8, arg_11 in arg_4.items():\n                        arg_11.append(arg_7['actions'][arg_8])\n                arg_5.append(arg_7['terminal'])\n                arg_6.append(arg_7['reward'])\n\n            arg_0.model.import_demo_experience(\n                arg_2=arg_2,\n                arg_3=arg_3,\n                arg_4=arg_4,\n                arg_5=arg_5,\n                arg_6=arg_6\n            )", "path": "tensorforce/agents/dqfd_agent.py", "identifier": "DQFDAgent.import_demonstrations", "docstring": "Imports demonstrations, i.e. expert observations. Note that for large numbers of observations,\n        set_demonstrations is more appropriate, which directly sets memory contents to an array an expects\n        a different layout.\n\n        Args:\n            demonstrations: List of observation dicts", "docstring_tokens": ["Imports", "demonstrations", "i", ".", "e", ".", "expert", "observations", ".", "Note", "that", "for", "large", "numbers", "of", "observations", "set_demonstrations", "is", "more", "appropriate", "which", "directly", "sets", "memory", "contents", "to", "an", "array", "an", "expects", "a", "different", "layout", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 256899}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L714-L722", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Generate the body that will be used in the refresh request.", "language": "python", "parameters": "(self)", "return_statement": "return body", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urllib", ".", "parse", ".", "urlencode", "(", "{", "'grant_type'", ":", "'refresh_token'", ",", "'client_id'", ":", "arg_0", ".", "client_id", ",", "'client_secret'", ":", "arg_0", ".", "client_secret", ",", "'refresh_token'", ":", "arg_0", ".", "refresh_token", ",", "}", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Generate the body that will be used in the refresh request.\"\"\"\n        arg_1 = urllib.parse.urlencode({\n            'grant_type': 'refresh_token',\n            'client_id': arg_0.client_id,\n            'client_secret': arg_0.client_secret,\n            'refresh_token': arg_0.refresh_token,\n        })\n        return arg_1", "path": "oauth2client/client.py", "identifier": "OAuth2Credentials._generate_refresh_request_body", "docstring": "Generate the body that will be used in the refresh request.", "docstring_tokens": ["Generate", "the", "body", "that", "will", "be", "used", "in", "the", "refresh", "request", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 256900}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/utils.py#L95-L103", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Check if a given record is indexed.", "language": "python", "parameters": "(record)", "return_statement": "return search.count() == 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "request", ".", "_methodview", ".", "search_class", "(", ")", "arg_1", "=", "arg_1", ".", "get_record", "(", "str", "(", "arg_0", ".", "id", ")", ")", "return", "arg_1", ".", "count", "(", ")", "==", "1"], "function": "def Func(arg_0):\n    \"\"\"Check if a given record is indexed.\n\n    :param record: A record object.\n    :returns: If the record is indexed returns `True`, otherwise `False`.\n    \"\"\"\n    arg_1 = request._methodview.search_class()\n    arg_1 = arg_1.get_record(str(arg_0.id))\n    return arg_1.count() == 1", "path": "invenio_deposit/utils.py", "identifier": "can_elasticsearch", "docstring": "Check if a given record is indexed.\n\n    :param record: A record object.\n    :returns: If the record is indexed returns `True`, otherwise `False`.", "docstring_tokens": ["Check", "if", "a", "given", "record", "is", "indexed", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 256901}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Dumper/file.py#L116-L121", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Dump the ocntent into the `file` in binary mode.", "language": "python", "parameters": "(self, file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "__text_is_expected", ":", "arg_1", "=", "TextWrapper", "(", "arg_1", ",", "arg_0", ".", "__encoding", ")", "arg_0", ".", "__dump_to_file", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Dump the ocntent into the `file` in binary mode.\n        \"\"\"\n        if arg_0.__text_is_expected:\n            arg_1 = TextWrapper(arg_1, arg_0.__encoding)\n        arg_0.__dump_to_file(arg_1)", "path": "knittingpattern/Dumper/file.py", "identifier": "ContentDumper._binary_file", "docstring": "Dump the ocntent into the `file` in binary mode.", "docstring_tokens": ["Dump", "the", "ocntent", "into", "the", "file", "in", "binary", "mode", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 256902}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/util.py#L36-L55", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Calculates the coordinates of a point on a circle given the center point,\n    radius, and angle.", "language": "python", "parameters": "(cx, cy, radius, angle)", "return_statement": "return (int(x), int(y))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_3", "=", "math", ".", "radians", "(", "arg_3", ")", "-", "(", "math", ".", "pi", "/", "2", ")", "arg_4", "=", "arg_0", "+", "arg_2", "*", "math", ".", "cos", "(", "arg_3", ")", "if", "arg_4", "<", "arg_0", ":", "arg_4", "=", "math", ".", "ceil", "(", "arg_4", ")", "else", ":", "arg_4", "=", "math", ".", "floor", "(", "arg_4", ")", "arg_5", "=", "arg_1", "+", "arg_2", "*", "math", ".", "sin", "(", "arg_3", ")", "if", "arg_5", "<", "arg_1", ":", "arg_5", "=", "math", ".", "ceil", "(", "arg_5", ")", "else", ":", "arg_5", "=", "math", ".", "floor", "(", "arg_5", ")", "return", "(", "int", "(", "arg_4", ")", ",", "int", "(", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Calculates the coordinates of a point on a circle given the center point,\n    radius, and angle.\n    \"\"\"\n    arg_3 = math.radians(arg_3) - (math.pi / 2)\n    arg_4 = arg_0 + arg_2 * math.cos(arg_3)\n    if arg_4 < arg_0:\n        arg_4 = math.ceil(arg_4)\n    else:\n        arg_4 = math.floor(arg_4)\n\n    arg_5 = arg_1 + arg_2 * math.sin(arg_3)\n\n    if arg_5 < arg_1:\n        arg_5 = math.ceil(arg_5)\n    else:\n        arg_5 = math.floor(arg_5)\n\n    return (int(arg_4), int(arg_5))", "path": "bibliopixel/util/util.py", "identifier": "pointOnCircle", "docstring": "Calculates the coordinates of a point on a circle given the center point,\n    radius, and angle.", "docstring_tokens": ["Calculates", "the", "coordinates", "of", "a", "point", "on", "a", "circle", "given", "the", "center", "point", "radius", "and", "angle", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 256903}
{"url": "https://github.com/VingtCinq/python-resize-image/blob/a4e645792ef30c5fcc558df6da6de18b1ecb95ea/resizeimage/resizeimage.py#L38-L41", "sha": "a4e645792ef30c5fcc558df6da6de18b1ecb95ea", "docstring_summary": "Check that the image's size superior to `size`", "language": "python", "parameters": "(image, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "arg_1", "[", "0", "]", ">", "arg_0", ".", "size", "[", "0", "]", ")", "and", "(", "arg_1", "[", "1", "]", ">", "arg_0", ".", "size", "[", "1", "]", ")", ":", "raise", "ImageSizeError", "(", "arg_0", ".", "size", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Check that the image's size superior to `size`\"\"\"\n    if (arg_1[0] > arg_0.size[0]) and (arg_1[1] > arg_0.size[1]):\n        raise ImageSizeError(arg_0.size, arg_1)", "path": "resizeimage/resizeimage.py", "identifier": "_is_big_enough", "docstring": "Check that the image's size superior to `size`", "docstring_tokens": ["Check", "that", "the", "image", "s", "size", "superior", "to", "size"], "nwo": "VingtCinq/python-resize-image", "score": 0.37283617366259525, "idx": 256904}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1566-L1568", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Wrapper for sys_sigprocmask", "language": "python", "parameters": "(self, cpu, how, newset, oldset)", "return_statement": "return self.sys_sigprocmask(cpu, how, newset, oldset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "return", "arg_0", ".", "sys_sigprocmask", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Wrapper for sys_sigprocmask\"\"\"\n        return arg_0.sys_sigprocmask(arg_1, arg_2, arg_3, arg_4)", "path": "manticore/platforms/linux.py", "identifier": "Linux.sys_rt_sigprocmask", "docstring": "Wrapper for sys_sigprocmask", "docstring_tokens": ["Wrapper", "for", "sys_sigprocmask"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 256905}
{"url": "https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/mcp_summ.py#L13-L87", "sha": "b246bd111aa10a8ea11a0aff8c9fce891f52cc58", "docstring_summary": "select sentences in terms of maximum coverage problem", "language": "python", "parameters": "(text, char_limit, sentence_filter=None, debug=False)", "return_statement": "return [sents[i] for i in sent_indices], debug_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "{", "}", "arg_5", "=", "list", "(", "tools", ".", "sent_splitter_ja", "(", "arg_0", ")", ")", "arg_6", "=", "[", "arg_9", ".", "encode", "(", "'utf-8'", ")", "for", "s", "in", "arg_5", "for", "arg_9", "in", "tools", ".", "word_segmenter_ja", "(", "s", ")", "]", "arg_7", "=", "collections", ".", "Counter", "(", ")", "for", "arg_8", "in", "arg_6", ":", "for", "arg_9", "in", "arg_8", ":", "arg_7", "[", "arg_9", "]", "+=", "1.0", "if", "arg_2", "is", "not", "None", ":", "arg_10", "=", "[", "arg_20", "for", "arg_20", ",", "s", "in", "enumerate", "(", "arg_5", ")", "if", "arg_2", "(", "s", ")", "]", "arg_5", "=", "[", "arg_5", "[", "arg_20", "]", "for", "arg_20", "in", "arg_10", "]", "arg_6", "=", "[", "arg_6", "[", "arg_20", "]", "for", "arg_20", "in", "arg_10", "]", "arg_11", "=", "[", "str", "(", "arg_20", ")", "for", "arg_20", "in", "range", "(", "len", "(", "arg_5", ")", ")", "]", "arg_12", "=", "dict", "(", "(", "arg_14", ",", "len", "(", "s", ")", ")", "for", "arg_14", ",", "s", "in", "zip", "(", "arg_11", ",", "arg_5", ")", ")", "arg_13", "=", "dict", "(", ")", "for", "arg_14", ",", "arg_8", "in", "zip", "(", "arg_11", ",", "arg_6", ")", ":", "arg_13", "[", "arg_14", "]", "=", "collections", ".", "defaultdict", "(", "lambda", ":", "0", ")", "for", "arg_9", "in", "arg_8", ":", "arg_13", "[", "arg_14", "]", "[", "arg_9", "]", "=", "1", "arg_15", "=", "pulp", ".", "LpProblem", "(", "'Func'", ",", "pulp", ".", "LpMaximize", ")", "arg_16", "=", "pulp", ".", "LpVariable", ".", "dicts", "(", "'sents'", ",", "arg_11", ",", "0", ",", "1", ",", "pulp", ".", "LpBinary", ")", "arg_17", "=", "pulp", ".", "LpVariable", ".", "dicts", "(", "'words'", ",", "arg_7", ".", "keys", "(", ")", ",", "0", ",", "1", ",", "pulp", ".", "LpBinary", ")", "arg_15", "+=", "pulp", ".", "lpSum", "(", "[", "arg_7", "[", "arg_9", "]", "*", "arg_17", "[", "arg_9", "]", "for", "arg_9", "in", "arg_7", "]", ")", "arg_15", "+=", "pulp", ".", "lpSum", "(", "[", "arg_12", "[", "arg_14", "]", "*", "arg_16", "[", "arg_14", "]", "for", "arg_14", "in", "arg_11", "]", ")", "<=", "arg_1", ",", "'lengthRequirement'", "for", "arg_9", "in", "arg_7", ":", "arg_15", "+=", "pulp", ".", "lpSum", "(", "[", "arg_13", "[", "arg_14", "]", "[", "arg_9", "]", "*", "arg_16", "[", "arg_14", "]", "for", "arg_14", "in", "arg_11", "]", ")", ">=", "arg_17", "[", "arg_9", "]", ",", "'z:{}'", ".", "format", "(", "arg_9", ")", "arg_15", ".", "solve", "(", ")", "arg_18", "=", "[", "]", "for", "arg_19", "in", "arg_15", ".", "variables", "(", ")", ":", "if", "arg_19", ".", "name", ".", "startswith", "(", "'sents'", ")", "and", "arg_19", ".", "varValue", "==", "1", ":", "arg_18", ".", "append", "(", "int", "(", "arg_19", ".", "name", ".", "split", "(", "'_'", ")", "[", "-", "1", "]", ")", ")", "return", "[", "arg_5", "[", "arg_20", "]", "for", "arg_20", "in", "arg_18", "]", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n    '''\n    select sentences in terms of maximum coverage problem\n\n    Args:\n      text: text to be Funcd (unicode string)\n      char_limit: summary length (the number of characters)\n\n    Returns:\n      list of extracted sentences\n\n    Reference:\n      Hiroya Takamura, Manabu Okumura.\n      Text summarization model based on maximum coverage problem and its\n      variant. (section 3)\n      http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.222.6945\n    '''\n    arg_4 = {}\n\n    arg_5 = list(tools.sent_splitter_ja(arg_0))\n    arg_6 = [\n        # pulp variables should be utf-8 encoded\n        arg_9.encode('utf-8') for s in arg_5 for arg_9 in tools.word_segmenter_ja(s)\n    ]\n\n    arg_7 = collections.Counter()\n    for arg_8 in arg_6:\n        for arg_9 in arg_8:\n            arg_7[arg_9] += 1.0\n\n    if arg_2 is not None:\n        arg_10 = [arg_20 for arg_20, s in enumerate(arg_5) if arg_2(s)]\n        arg_5 = [arg_5[arg_20] for arg_20 in arg_10]\n        arg_6 = [arg_6[arg_20] for arg_20 in arg_10]\n\n    arg_11 = [str(arg_20) for arg_20 in range(len(arg_5))]  # sentence id\n    arg_12 = dict((arg_14, len(s)) for arg_14, s in zip(arg_11, arg_5))  # c\n\n    arg_13 = dict()  # a\n    for arg_14, arg_8 in zip(arg_11, arg_6):\n        arg_13[arg_14] = collections.defaultdict(lambda: 0)\n        for arg_9 in arg_8:\n            arg_13[arg_14][arg_9] = 1\n\n    arg_15 = pulp.LpProblem('Func', pulp.LpMaximize)\n\n    # x\n    arg_16 = pulp.LpVariable.dicts('sents', arg_11, 0, 1, pulp.LpBinary)\n    # z\n    arg_17 = pulp.LpVariable.dicts('words', arg_7.keys(), 0, 1, pulp.LpBinary)\n\n    # first, set objective function: sum(w*z)\n    arg_15 += pulp.lpSum([arg_7[arg_9] * arg_17[arg_9] for arg_9 in arg_7])\n\n    # next, add constraints\n    # limit summary length: sum(c*x) <= K\n    arg_15 += pulp.lpSum(\n        [arg_12[arg_14] * arg_16[arg_14] for arg_14 in arg_11]\n    ) <= arg_1, 'lengthRequirement'\n    # for each term, sum(a*x) <= z\n    for arg_9 in arg_7:\n        arg_15 += pulp.lpSum(\n            [arg_13[arg_14][arg_9] * arg_16[arg_14] for arg_14 in arg_11]\n        ) >= arg_17[arg_9], 'z:{}'.format(arg_9)\n\n    arg_15.solve()\n    # print(\"Status:\", pulp.LpStatus[prob.status])\n\n    arg_18 = []\n    for arg_19 in arg_15.variables():\n        # print v.name, \"=\", v.varValue\n        if arg_19.name.startswith('sents') and arg_19.varValue == 1:\n            arg_18.append(int(arg_19.name.split('_')[-1]))\n\n    return [arg_5[arg_20] for arg_20 in arg_18], arg_4", "path": "summpy/mcp_summ.py", "identifier": "summarize", "docstring": "select sentences in terms of maximum coverage problem\n\n    Args:\n      text: text to be summarized (unicode string)\n      char_limit: summary length (the number of characters)\n\n    Returns:\n      list of extracted sentences\n\n    Reference:\n      Hiroya Takamura, Manabu Okumura.\n      Text summarization model based on maximum coverage problem and its\n      variant. (section 3)\n      http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.222.6945", "docstring_tokens": ["select", "sentences", "in", "terms", "of", "maximum", "coverage", "problem"], "nwo": "recruit-tech/summpy", "score": 0.3953392334631274, "idx": 256906}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/playlist.py#L114-L134", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Get all playlist tracks from the playlist.", "language": "python", "parameters": "(self)", "return_statement": "return list(self._tracks)", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", "->", "List", "[", "PlaylistTrack", "]", ":", "if", "isinstance", "(", "arg_0", ".", "_tracks", ",", "PartialTracks", ")", ":", "return", "await", "arg_0", ".", "_tracks", ".", "build", "(", ")", "arg_1", "=", "[", "]", "arg_2", "=", "0", "while", "len", "(", "arg_0", ".", "tracks", ")", "<", "arg_0", ".", "total_tracks", ":", "arg_3", "=", "await", "arg_0", ".", "__client", ".", "http", ".", "get_playlist_tracks", "(", "arg_0", ".", "owner", ".", "id", ",", "arg_0", ".", "id", ",", "limit", "=", "50", ",", "arg_2", "=", "arg_2", ")", "arg_1", "+=", "[", "PlaylistTrack", "(", "arg_0", ".", "__client", ",", "arg_4", ")", "for", "arg_4", "in", "arg_3", "[", "'items'", "]", "]", "arg_2", "+=", "50", "arg_0", ".", "total_tracks", "=", "len", "(", "arg_0", ".", "_tracks", ")", "return", "list", "(", "arg_0", ".", "_tracks", ")"], "function": "async def Func(arg_0) -> List[PlaylistTrack]:\n        \"\"\"Get all playlist tracks from the playlist.\n\n        Returns\n        -------\n        tracks : List[PlaylistTrack]\n            The playlists tracks.\n        \"\"\"\n        if isinstance(arg_0._tracks, PartialTracks):\n            return await arg_0._tracks.build()\n\n        arg_1 = []\n        arg_2 = 0\n        while len(arg_0.tracks) < arg_0.total_tracks:\n            arg_3 = await arg_0.__client.http.get_playlist_tracks(arg_0.owner.id, arg_0.id, limit=50, arg_2=arg_2)\n\n            arg_1 += [PlaylistTrack(arg_0.__client, arg_4) for arg_4 in arg_3['items']]\n            arg_2 += 50\n\n        arg_0.total_tracks = len(arg_0._tracks)\n        return list(arg_0._tracks)", "path": "spotify/models/playlist.py", "identifier": "Playlist.get_all_tracks", "docstring": "Get all playlist tracks from the playlist.\n\n        Returns\n        -------\n        tracks : List[PlaylistTrack]\n            The playlists tracks.", "docstring_tokens": ["Get", "all", "playlist", "tracks", "from", "the", "playlist", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 256907}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L809-L819", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "For each node in the tree, set its root-to-node distance as dist2root\n        attribute", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "tree", ".", "root", ".", "dist2root", "=", "0.0", "for", "arg_4", "in", "arg_0", ".", "tree", ".", "get_nonterminals", "(", "order", "=", "'preorder'", ")", ":", "for", "arg_5", "in", "arg_4", ".", "clades", ":", "if", "not", "hasattr", "(", "arg_5", ",", "'mutation_length'", ")", ":", "arg_5", ".", "mutation_length", "=", "arg_5", ".", "branch_length", "arg_5", ".", "dist2root", "=", "arg_5", ".", "up", ".", "dist2root", "+", "arg_5", ".", "mutation_length"], "function": "def Func(arg_0):\n        \"\"\"\n        For each node in the tree, set its root-to-node distance as dist2root\n        attribute\n        \"\"\"\n        arg_0.tree.root.dist2root = 0.0\n        for arg_4 in arg_0.tree.get_nonterminals(order='preorder'): # parents first\n            for arg_5 in arg_4.clades:\n                if not hasattr(arg_5, 'mutation_length'):\n                    arg_5.mutation_length=arg_5.branch_length\n                arg_5.dist2root = arg_5.up.dist2root + arg_5.mutation_length", "path": "treetime/treeanc.py", "identifier": "TreeAnc._calc_dist2root", "docstring": "For each node in the tree, set its root-to-node distance as dist2root\n        attribute", "docstring_tokens": ["For", "each", "node", "in", "the", "tree", "set", "its", "root", "-", "to", "-", "node", "distance", "as", "dist2root", "attribute"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 256908}
{"url": "https://github.com/nficano/python-lambda/blob/b0bd25404df70212d7fa057758760366406d64f2/aws_lambda/aws_lambda.py#L478-L490", "sha": "b0bd25404df70212d7fa057758760366406d64f2", "docstring_summary": "Shortcut for getting an initialized instance of the boto3 client.", "language": "python", "parameters": "(\n    client, profile_name, aws_access_key_id, aws_secret_access_key,\n    region=None,\n)", "return_statement": "return boto3.client(client)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", ")", ":", "boto3", ".", "setup_default_session", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "region_name", "=", "arg_4", ",", ")", "return", "boto3", ".", "client", "(", "arg_0", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3,\n    arg_4=None,\n):\n    \"\"\"Shortcut for getting an initialized instance of the boto3 client.\"\"\"\n\n    boto3.setup_default_session(\n        arg_1=arg_1,\n        arg_2=arg_2,\n        arg_3=arg_3,\n        region_name=arg_4,\n    )\n    return boto3.client(arg_0)", "path": "aws_lambda/aws_lambda.py", "identifier": "get_client", "docstring": "Shortcut for getting an initialized instance of the boto3 client.", "docstring_tokens": ["Shortcut", "for", "getting", "an", "initialized", "instance", "of", "the", "boto3", "client", "."], "nwo": "nficano/python-lambda", "score": 0.7856642350024847, "idx": 256909}
{"url": "https://github.com/umich-brcf-bioinf/Jacquard/blob/83dd61dd2b5e4110468493beec7bc121e6cb3cd1/jacquard/utils/vcf.py#L271-L277", "sha": "83dd61dd2b5e4110468493beec7bc121e6cb3cd1", "docstring_summary": "Returns set of format tags.", "language": "python", "parameters": "(self)", "return_statement": "return tags", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "VcfRecord", ".", "_EMPTY_SET", "if", "arg_0", ".", "sample_tag_values", ":", "arg_2", "=", "list", "(", "arg_0", ".", "sample_tag_values", ".", "keys", "(", ")", ")", "[", "0", "]", "arg_1", "=", "set", "(", "arg_0", ".", "sample_tag_values", "[", "arg_2", "]", ".", "keys", "(", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns set of format tags.\"\"\"\n        arg_1 = VcfRecord._EMPTY_SET\n        if arg_0.sample_tag_values:\n            arg_2 = list(arg_0.sample_tag_values.keys())[0]\n            arg_1 = set(arg_0.sample_tag_values[arg_2].keys())\n        return arg_1", "path": "jacquard/utils/vcf.py", "identifier": "VcfRecord.format_tags", "docstring": "Returns set of format tags.", "docstring_tokens": ["Returns", "set", "of", "format", "tags", "."], "nwo": "umich-brcf-bioinf/Jacquard", "score": 0.27831918678159157, "idx": 256910}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/identifiers.py#L685-L723", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "Looks up a string which may represent a mixture in the database of \n    thermo to determine the key by which the composition of that mixture can\n    be obtained in the dictionary `_MixtureDict`.", "language": "python", "parameters": "(ID)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "type", "(", "arg_0", ")", "==", "list", ":", "if", "len", "(", "arg_0", ")", "==", "1", ":", "arg_0", "=", "arg_0", "[", "0", "]", "else", ":", "raise", "Exception", "(", "'If the input is a list, the list must contain only one item.'", ")", "arg_0", "=", "arg_0", ".", "lower", "(", ")", ".", "strip", "(", ")", "arg_1", "=", "arg_0", ".", "replace", "(", "' '", ",", "''", ")", "arg_2", "=", "arg_0", ".", "replace", "(", "'-'", ",", "''", ")", "for", "arg_3", "in", "[", "arg_0", ",", "arg_1", ",", "arg_2", "]", ":", "if", "arg_3", "in", "_MixtureDictLookup", ":", "return", "_MixtureDictLookup", "[", "arg_3", "]", "raise", "Exception", "(", "'Mixture name not recognized'", ")"], "function": "def Func(arg_0):\n    '''Looks up a string which may represent a mixture in the database of \n    thermo to determine the key by which the composition of that mixture can\n    be obtained in the dictionary `_MixtureDict`.\n\n    Parameters\n    ----------\n    ID : str\n        A string or 1-element list containing the name which may represent a\n        mixture.\n\n    Returns\n    -------\n    key : str\n        Key for access to the data on the mixture in `_MixtureDict`.\n\n    Notes\n    -----\n    White space, '-', and upper case letters are removed in the search.\n\n    Examples\n    --------\n    >>> Func('R512A')\n    'R512A'\n    >>> Func([u'air'])\n    'Air'\n    '''\n    if type(arg_0) == list:\n        if len(arg_0) == 1:\n            arg_0 = arg_0[0]\n        else:\n            raise Exception('If the input is a list, the list must contain only one item.')\n    arg_0 = arg_0.lower().strip()\n    arg_1 = arg_0.replace(' ', '')\n    arg_2 = arg_0.replace('-', '')\n    for arg_3 in [arg_0, arg_1, arg_2]:\n        if arg_3 in _MixtureDictLookup:\n            return _MixtureDictLookup[arg_3]\n    raise Exception('Mixture name not recognized')", "path": "thermo/identifiers.py", "identifier": "mixture_from_any", "docstring": "Looks up a string which may represent a mixture in the database of \n    thermo to determine the key by which the composition of that mixture can\n    be obtained in the dictionary `_MixtureDict`.\n\n    Parameters\n    ----------\n    ID : str\n        A string or 1-element list containing the name which may represent a\n        mixture.\n\n    Returns\n    -------\n    key : str\n        Key for access to the data on the mixture in `_MixtureDict`.\n\n    Notes\n    -----\n    White space, '-', and upper case letters are removed in the search.\n\n    Examples\n    --------\n    >>> mixture_from_any('R512A')\n    'R512A'\n    >>> mixture_from_any([u'air'])\n    'Air'", "docstring_tokens": ["Looks", "up", "a", "string", "which", "may", "represent", "a", "mixture", "in", "the", "database", "of", "thermo", "to", "determine", "the", "key", "by", "which", "the", "composition", "of", "that", "mixture", "can", "be", "obtained", "in", "the", "dictionary", "_MixtureDict", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256911}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/resources/base.py#L100-L108", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Loads a resource or return existing one", "language": "python", "parameters": "(self, meta: ResourceDescription)", "return_statement": "return meta.loader_cls(meta).load()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Any", ":", "arg_0", ".", "_check_meta", "(", "arg_1", ")", "arg_0", ".", "resolve_Funcer", "(", "arg_1", ")", "return", "arg_1", ".", "Funcer_cls", "(", "arg_1", ")", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> Any:\n        \"\"\"\n        Loads a resource or return existing one\n\n        :param meta: The resource description\n        \"\"\"\n        arg_0._check_meta(arg_1)\n        arg_0.resolve_Funcer(arg_1)\n        return arg_1.Funcer_cls(arg_1).Func()", "path": "demosys/resources/base.py", "identifier": "BaseRegistry.load", "docstring": "Loads a resource or return existing one\n\n        :param meta: The resource description", "docstring_tokens": ["Loads", "a", "resource", "or", "return", "existing", "one"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 256912}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3555-L3570", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds an empty derived parameter group under the current node.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self._nn_interface._add_generic(self, type_name=DERIVED_PARAMETER_GROUP,\n                                               group_type_name=DERIVED_PARAMETER_GROUP,\n                                               args=args, kwargs=kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "_nn_interface", ".", "_add_generic", "(", "arg_0", ",", "type_name", "=", "DERIVED_PARAMETER_GROUP", ",", "group_type_name", "=", "DERIVED_PARAMETER_GROUP", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Adds an empty derived parameter group under the current node.\n\n        Adds the full name of the current node as prefix to the name of the group.\n        If current node is a single run (root) adds the prefix `'derived_parameters.runs.run_08%d%'`\n        to the full name where `'08%d'` is replaced by the index of the current run.\n\n        The `name` can also contain subgroups separated via colons, for example:\n        `name=subgroup1.subgroup2.subgroup3`. These other parent groups will be automatically\n        be created.\n\n        \"\"\"\n\n        return arg_0._nn_interface._add_generic(arg_0, type_name=DERIVED_PARAMETER_GROUP,\n                                               group_type_name=DERIVED_PARAMETER_GROUP,\n                                               arg_1=arg_1, arg_2=arg_2)", "path": "pypet/naturalnaming.py", "identifier": "DerivedParameterGroup.f_add_derived_parameter_group", "docstring": "Adds an empty derived parameter group under the current node.\n\n        Adds the full name of the current node as prefix to the name of the group.\n        If current node is a single run (root) adds the prefix `'derived_parameters.runs.run_08%d%'`\n        to the full name where `'08%d'` is replaced by the index of the current run.\n\n        The `name` can also contain subgroups separated via colons, for example:\n        `name=subgroup1.subgroup2.subgroup3`. These other parent groups will be automatically\n        be created.", "docstring_tokens": ["Adds", "an", "empty", "derived", "parameter", "group", "under", "the", "current", "node", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 256913}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/event.py#L122-L131", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns the number of connected subscribers.", "language": "python", "parameters": "(self)", "return_statement": "return hard + weak", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "hard_subscribers", "and", "len", "(", "arg_0", ".", "hard_subscribers", ")", "or", "0", "arg_2", "=", "arg_0", ".", "weak_subscribers", "and", "len", "(", "arg_0", ".", "weak_subscribers", ")", "or", "0", "return", "arg_1", "+", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the number of connected subscribers.\n\n        :rtype:  int\n        :returns: The number of subscribers.\n        \"\"\"\n        arg_1 = arg_0.hard_subscribers and len(arg_0.hard_subscribers) or 0\n        arg_2 = arg_0.weak_subscribers and len(arg_0.weak_subscribers) or 0\n        return arg_1 + arg_2", "path": "SpiffWorkflow/util/event.py", "identifier": "Event.n_subscribers", "docstring": "Returns the number of connected subscribers.\n\n        :rtype:  int\n        :returns: The number of subscribers.", "docstring_tokens": ["Returns", "the", "number", "of", "connected", "subscribers", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 256914}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/docs/m2r.py#L163-L166", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Pass through rest link.", "language": "python", "parameters": "(self, m)", "return_statement": "return self.renderer.eol_literal_marker(marker)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "':'", "if", "arg_1", ".", "group", "(", "1", ")", "is", "None", "else", "''", "return", "arg_0", ".", "renderer", ".", "eol_literal_marker", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Pass through rest link.\"\"\"\n        arg_2 = ':' if arg_1.group(1) is None else ''\n        return arg_0.renderer.eol_literal_marker(arg_2)", "path": "docs/m2r.py", "identifier": "RestInlineLexer.output_eol_literal_marker", "docstring": "Pass through rest link.", "docstring_tokens": ["Pass", "through", "rest", "link", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 256915}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/txampext/multiplexing.py#L269-L280", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Create a multiplexed stream connection.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "log", ".", "msg", "(", "\"Creating multiplexed AMP connection...\"", ")", "arg_1", "=", "arg_0", ".", "factory", ".", "remoteFactoryIdentifier", "arg_2", "=", "arg_0", ".", "_callRemote", "(", "Connect", ",", "factory", "=", "arg_1", ")", "arg_2", ".", "addCallback", "(", "arg_0", ".", "_multiplexedConnectionMade", ")"], "function": "def Func(arg_0):\n        \"\"\"Create a multiplexed stream connection.\n\n        Connect to the AMP server's multiplexed factory using the\n        identifier (defined by this class' factory). When done, stores\n        the connection reference and causes buffered data to be sent.\n\n        \"\"\"\n        log.msg(\"Creating multiplexed AMP connection...\")\n        arg_1 = arg_0.factory.remoteFactoryIdentifier\n        arg_2 = arg_0._callRemote(Connect, factory=arg_1)\n        arg_2.addCallback(arg_0._multiplexedConnectionMade)", "path": "txampext/multiplexing.py", "identifier": "ProxyingProtocol.connectionMade", "docstring": "Create a multiplexed stream connection.\n\n        Connect to the AMP server's multiplexed factory using the\n        identifier (defined by this class' factory). When done, stores\n        the connection reference and causes buffered data to be sent.", "docstring_tokens": ["Create", "a", "multiplexed", "stream", "connection", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 256916}
{"url": "https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/utils.py#L32-L36", "sha": "3ebd891ac0c02bad061182dbcb54a47fb21980ae", "docstring_summary": "Truncate string values.", "language": "python", "parameters": "(value, max_width=None)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "text_type", ")", "and", "arg_1", "is", "not", "None", "and", "len", "(", "arg_0", ")", ">", "arg_1", ":", "return", "arg_0", "[", ":", "arg_1", "]", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Truncate string values.\"\"\"\n    if isinstance(arg_0, text_type) and arg_1 is not None and len(arg_0) > arg_1:\n        return arg_0[:arg_1]\n    return arg_0", "path": "cli_helpers/utils.py", "identifier": "truncate_string", "docstring": "Truncate string values.", "docstring_tokens": ["Truncate", "string", "values", "."], "nwo": "dbcli/cli_helpers", "score": 0.43979569135490515, "idx": 256917}
{"url": "https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/utils.py#L227-L245", "sha": "3d6bf5e64220fe921468a36fce68e15d7947cf92", "docstring_summary": "Returns a field object instance for a given PrefProxy object.", "language": "python", "parameters": "(pref_proxy)", "return_statement": "return field", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "bool", ":", "models", ".", "BooleanField", ",", "int", ":", "models", ".", "IntegerField", ",", "float", ":", "models", ".", "FloatField", ",", "datetime", ":", "models", ".", "DateTimeField", ",", "}", ".", "get", "(", "type", "(", "arg_0", ".", "default", ")", ",", "models", ".", "TextField", ")", "(", ")", "update_field_from_proxy", "(", "arg_1", ",", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns a field object instance for a given PrefProxy object.\n\n    :param PrefProxy pref_proxy:\n\n    :rtype: models.Field\n\n    \"\"\"\n    arg_1 = {\n        bool: models.BooleanField,\n        int:  models.IntegerField,\n        float: models.FloatField,\n        datetime: models.DateTimeField,\n\n    }.get(type(arg_0.default), models.TextField)()\n\n    update_field_from_proxy(arg_1, arg_0)\n\n    return arg_1", "path": "siteprefs/utils.py", "identifier": "get_field_for_proxy", "docstring": "Returns a field object instance for a given PrefProxy object.\n\n    :param PrefProxy pref_proxy:\n\n    :rtype: models.Field", "docstring_tokens": ["Returns", "a", "field", "object", "instance", "for", "a", "given", "PrefProxy", "object", "."], "nwo": "idlesign/django-siteprefs", "score": 0.18190671880906387, "idx": 256918}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/neuroRemote.py#L269-L286", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Kick off the propagate function on the remote server.", "language": "python", "parameters": "(self, token, channel)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "get_Func_status", "(", "arg_1", ",", "arg_2", ")", "!=", "u'0'", ":", "return", "arg_3", "=", "arg_0", ".", "url", "(", "'sd/{}/{}/setPropagate/1/'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "arg_4", "=", "arg_0", ".", "remote_utils", ".", "get_url", "(", "arg_3", ")", "if", "arg_4", ".", "status_code", "is", "not", "200", ":", "raise", "RemoteDataUploadError", "(", "'Propagate fail: {}'", ".", "format", "(", "arg_4", ".", "text", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Kick off the Func function on the remote server.\n\n        Arguments:\n            token (str): The token to Func\n            channel (str): The channel to Func\n\n        Returns:\n            boolean: Success\n        \"\"\"\n        if arg_0.get_Func_status(arg_1, arg_2) != u'0':\n            return\n        arg_3 = arg_0.url('sd/{}/{}/setPropagate/1/'.format(arg_1, arg_2))\n        arg_4 = arg_0.remote_utils.get_url(arg_3)\n        if arg_4.status_code is not 200:\n            raise RemoteDataUploadError('Propagate fail: {}'.format(arg_4.text))\n        return True", "path": "ndio/remote/neuroRemote.py", "identifier": "neuroRemote.propagate", "docstring": "Kick off the propagate function on the remote server.\n\n        Arguments:\n            token (str): The token to propagate\n            channel (str): The channel to propagate\n\n        Returns:\n            boolean: Success", "docstring_tokens": ["Kick", "off", "the", "propagate", "function", "on", "the", "remote", "server", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 256919}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vagrant.py#L31-L43", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Get the SSH parameters for connecting to a vagrant VM.", "language": "python", "parameters": "(self, name='')", "return_statement": "return config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "arg_0", ".", "local_renderer", "with", "arg_0", ".", "settings", "(", "hide", "(", "'running'", ")", ")", ":", "arg_3", "=", "arg_2", ".", "local", "(", "'vagrant ssh-config %s'", "%", "arg_1", ",", "capture", "=", "True", ")", "arg_4", "=", "{", "}", "for", "arg_5", "in", "arg_3", ".", "splitlines", "(", ")", "[", "1", ":", "]", ":", "arg_6", ",", "arg_7", "=", "arg_5", ".", "strip", "(", ")", ".", "split", "(", "' '", ",", "2", ")", "arg_4", "[", "arg_6", "]", "=", "arg_7", "return", "arg_4"], "function": "def Func(arg_0, arg_1=''):\n        \"\"\"\n        Get the SSH parameters for connecting to a vagrant VM.\n        \"\"\"\n        arg_2 = arg_0.local_renderer\n        with arg_0.settings(hide('running')):\n            arg_3 = arg_2.local('vagrant ssh-config %s' % arg_1, capture=True)\n\n        arg_4 = {}\n        for arg_5 in arg_3.splitlines()[1:]:\n            arg_6, arg_7 = arg_5.strip().split(' ', 2)\n            arg_4[arg_6] = arg_7\n        return arg_4", "path": "burlap/vagrant.py", "identifier": "VagrantSatchel.ssh_config", "docstring": "Get the SSH parameters for connecting to a vagrant VM.", "docstring_tokens": ["Get", "the", "SSH", "parameters", "for", "connecting", "to", "a", "vagrant", "VM", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256920}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L659-L693", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "split job into bits and pass to the client", "language": "python", "parameters": "(data, sample)", "return_statement": "return chunkslist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "int", "(", "(", "arg_1", ".", "stats", ".", "clusters_total", "//", "arg_0", ".", "cpus", ")", "+", "(", "arg_1", ".", "stats", ".", "clusters_total", "%", "arg_0", ".", "cpus", ")", ")", "arg_4", "=", "[", "]", "with", "gzip", ".", "open", "(", "arg_1", ".", "files", ".", "clusters", ",", "'rb'", ")", "as", "clusters", ":", "arg_5", "=", "itertools", ".", "izip", "(", "*", "[", "iter", "(", "clusters", ")", "]", "*", "2", ")", "arg_6", "=", "0", "while", "not", "arg_6", ":", "arg_6", ",", "arg_7", "=", "clustdealer", "(", "arg_5", ",", "arg_3", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "clusts", ",", "\"tmp_\"", "+", "str", "(", "arg_1", ".", "name", ")", "+", "\".\"", "+", "str", "(", "arg_2", "*", "arg_3", ")", ")", "if", "arg_7", ":", "arg_4", ".", "append", "(", "(", "arg_3", ",", "arg_8", ")", ")", "with", "open", "(", "arg_8", ",", "'wb'", ")", "as", "outchunk", ":", "outchunk", ".", "write", "(", "\"//\\n//\\n\"", ".", "join", "(", "arg_7", ")", "+", "\"//\\n//\\n\"", ")", "arg_2", "+=", "1", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\" split job into bits and pass to the client \"\"\"\n\n    ## counter for split job submission\n    arg_2 = 0\n\n    ## set optim size for chunks in N clusters. The first few chunks take longer\n    ## because they contain larger clusters, so we create 4X as many chunks as\n    ## processors so that they are split more evenly.\n    arg_3 = int((arg_1.stats.clusters_total // arg_0.cpus) + \\\n                (arg_1.stats.clusters_total % arg_0.cpus))\n\n    ## break up the file into smaller tmp files for each engine\n    ## chunking by cluster is a bit trickier than chunking by N lines\n    arg_4 = []\n\n    ## open to clusters\n    with gzip.open(arg_1.files.clusters, 'rb') as clusters:\n        ## create iterator to sample 2 lines at a time\n        arg_5 = itertools.izip(*[iter(clusters)]*2)\n\n        ## Use iterator to sample til end of cluster\n        arg_6 = 0\n        while not arg_6:\n            ## grab optim clusters and write to file.\n            arg_6, arg_7 = clustdealer(arg_5, arg_3)\n            arg_8 = os.path.join(arg_0.dirs.clusts,\n                                    \"tmp_\"+str(arg_1.name)+\".\"+str(arg_2*arg_3))\n            if arg_7:\n                arg_4.append((arg_3, arg_8))\n                with open(arg_8, 'wb') as outchunk:\n                    outchunk.write(\"//\\n//\\n\".join(arg_7)+\"//\\n//\\n\")\n                arg_2 += 1\n\n    return arg_4", "path": "ipyrad/assemble/consens_se.py", "identifier": "chunk_clusters", "docstring": "split job into bits and pass to the client", "docstring_tokens": ["split", "job", "into", "bits", "and", "pass", "to", "the", "client"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 256921}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/loader.py#L277-L322", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Load the config file into self.config, with recursive loading.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "load_subconfig", "(", "arg_1", ",", "arg_2", "=", "None", ")", ":", "from", "IPython", ".", "core", ".", "profiledir", "import", "ProfileDir", ",", "ProfileDirError", "if", "arg_2", "is", "not", "None", ":", "try", ":", "arg_3", "=", "ProfileDir", ".", "find_profile_dir_by_name", "(", "get_ipython_dir", "(", ")", ",", "arg_2", ",", ")", "except", "ProfileDirError", ":", "return", "arg_4", "=", "arg_3", ".", "location", "else", ":", "arg_4", "=", "arg_0", ".", "path", "arg_5", "=", "PyFileConfigLoader", "(", "arg_1", ",", "arg_4", ")", "try", ":", "arg_6", "=", "arg_5", ".", "load_config", "(", ")", "except", "ConfigFileNotFound", ":", "pass", "else", ":", "arg_0", ".", "config", ".", "_merge", "(", "arg_6", ")", "def", "get_config", "(", ")", ":", "return", "arg_0", ".", "config", "arg_7", "=", "dict", "(", "load_subconfig", "=", "load_subconfig", ",", "get_config", "=", "get_config", ")", "arg_8", "=", "sys", ".", "getfilesystemencoding", "(", ")", "or", "'ascii'", "arg_9", "=", "arg_0", ".", "full_filename", ".", "encode", "(", "arg_8", ")", "py3compat", ".", "execfile", "(", "arg_9", ",", "arg_7", ")"], "function": "def Func(arg_0):\n        \"\"\"Load the config file into self.config, with recursive loading.\"\"\"\n        # This closure is made available in the namespace that is used\n        # to exec the config file.  It allows users to call\n        # load_subconfig('myconfig.py') to load config files recursively.\n        # It needs to be a closure because it has references to self.path\n        # and self.config.  The sub-config is loaded with the same path\n        # as the parent, but it uses an empty config which is then merged\n        # with the parents.\n\n        # If a profile is specified, the config file will be loaded\n        # from that profile\n\n        def load_subconfig(arg_1, arg_2=None):\n            # import here to prevent circular imports\n            from IPython.core.profiledir import ProfileDir, ProfileDirError\n            if arg_2 is not None:\n                try:\n                    arg_3 = ProfileDir.find_profile_dir_by_name(\n                            get_ipython_dir(),\n                            arg_2,\n                    )\n                except ProfileDirError:\n                    return\n                arg_4 = arg_3.location\n            else:\n                arg_4 = arg_0.path\n            arg_5 = PyFileConfigLoader(arg_1, arg_4)\n            try:\n                arg_6 = arg_5.load_config()\n            except ConfigFileNotFound:\n                # Pass silently if the sub config is not there. This happens\n                # when a user s using a profile, but not the default config.\n                pass\n            else:\n                arg_0.config._merge(arg_6)\n\n        # Again, this needs to be a closure and should be used in config\n        # files to get the config being loaded.\n        def get_config():\n            return arg_0.config\n\n        arg_7 = dict(load_subconfig=load_subconfig, get_config=get_config)\n        arg_8 = sys.getfilesystemencoding() or 'ascii'\n        arg_9 = arg_0.full_filename.encode(arg_8)\n        py3compat.execfile(arg_9, arg_7)", "path": "environment/lib/python2.7/site-packages/IPython/config/loader.py", "identifier": "PyFileConfigLoader._read_file_as_dict", "docstring": "Load the config file into self.config, with recursive loading.", "docstring_tokens": ["Load", "the", "config", "file", "into", "self", ".", "config", "with", "recursive", "loading", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256922}
{"url": "https://github.com/moreati/ppeg/blob/946b1f75873eb52fa974606d85f576bfa0df9666/pe.py#L25-L34", "sha": "946b1f75873eb52fa974606d85f576bfa0df9666", "docstring_summary": "Returns a Pattern that matches exactly n repetitions of Pattern p.", "language": "python", "parameters": "(p, n)", "return_statement": "return np", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "P", "(", ")", "while", "arg_1", ">=", "1", ":", "if", "arg_1", "%", "2", ":", "arg_2", "=", "arg_2", "+", "arg_0", "arg_0", "=", "arg_0", "+", "arg_0", "arg_1", "=", "arg_1", "//", "2", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns a Pattern that matches exactly n repetitions of Pattern p.\n    \"\"\"\n    arg_2 = P()\n    while arg_1 >= 1:\n        if arg_1 % 2:\n            arg_2 = arg_2 + arg_0\n        arg_0 = arg_0 + arg_0\n        arg_1 = arg_1 // 2\n    return arg_2", "path": "pe.py", "identifier": "mult", "docstring": "Returns a Pattern that matches exactly n repetitions of Pattern p.", "docstring_tokens": ["Returns", "a", "Pattern", "that", "matches", "exactly", "n", "repetitions", "of", "Pattern", "p", "."], "nwo": "moreati/ppeg", "score": 0.16638194949711382, "idx": 256923}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L311-L324", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return the user input's value from a 'compiled' value", "language": "python", "parameters": "(optdict, value)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_1", "=", "\",\"", ".", "join", "(", "Func", "(", "arg_0", ",", "item", ")", "for", "item", "in", "arg_1", ")", "elif", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_1", "=", "\",\"", ".", "join", "(", "\"%s:%s\"", "%", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "arg_1", ".", "items", "(", ")", ")", "elif", "hasattr", "(", "arg_1", ",", "\"match\"", ")", ":", "arg_1", "=", "arg_1", ".", "pattern", "elif", "arg_0", ".", "get", "(", "\"type\"", ")", "==", "\"yn\"", ":", "arg_1", "=", "\"yes\"", "if", "arg_1", "else", "\"no\"", "elif", "isinstance", "(", "arg_1", ",", "str", ")", "and", "arg_1", ".", "isspace", "(", ")", ":", "arg_1", "=", "\"'%s'\"", "%", "arg_1", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"return the user input's value from a 'compiled' value\"\"\"\n    if isinstance(arg_1, (list, tuple)):\n        arg_1 = \",\".join(Func(arg_0, item) for item in arg_1)\n    elif isinstance(arg_1, dict):\n        arg_1 = \",\".join(\"%s:%s\" % (k, v) for k, v in arg_1.items())\n    elif hasattr(arg_1, \"match\"):  # optdict.get('type') == 'regexp'\n        # compiled regexp\n        arg_1 = arg_1.pattern\n    elif arg_0.get(\"type\") == \"yn\":\n        arg_1 = \"yes\" if arg_1 else \"no\"\n    elif isinstance(arg_1, str) and arg_1.isspace():\n        arg_1 = \"'%s'\" % arg_1\n    return arg_1", "path": "pylint/utils/utils.py", "identifier": "_format_option_value", "docstring": "return the user input's value from a 'compiled' value", "docstring_tokens": ["return", "the", "user", "input", "s", "value", "from", "a", "compiled", "value"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256924}
{"url": "https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/power.py#L141-L173", "sha": "46e12659b8d08af764dc09a1f31b0e85a68f808f", "docstring_summary": "Create buffer for reading samples", "language": "python", "parameters": "(self, bins, repeats, base_buffer_size, max_buffer_size=0)", "return_statement": "return (buffer_repeats, zeros(buffer_size, numpy.complex64))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "arg_1", "*", "arg_2", "arg_6", "=", "1", "arg_7", "=", "math", ".", "ceil", "(", "arg_5", "/", "arg_3", ")", "*", "arg_3", "if", "not", "arg_4", ":", "arg_4", "=", "(", "100", "*", "1024", "**", "2", ")", "/", "8", "if", "arg_4", ">", "0", ":", "arg_4", "=", "math", ".", "ceil", "(", "arg_4", "/", "arg_3", ")", "*", "arg_3", "if", "arg_7", ">", "arg_4", ":", "logger", ".", "warning", "(", "'Required buffer size ({}) will be shrinked to max_buffer_size ({})!'", ".", "format", "(", "arg_7", ",", "arg_4", ")", ")", "arg_6", "=", "math", ".", "ceil", "(", "arg_7", "/", "arg_4", ")", "arg_7", "=", "arg_4", "logger", ".", "info", "(", "'repeats: {}'", ".", "format", "(", "arg_2", ")", ")", "logger", ".", "info", "(", "'samples: {} (time: {:.5f} s)'", ".", "format", "(", "arg_5", ",", "arg_5", "/", "arg_0", ".", "device", ".", "sample_rate", ")", ")", "if", "arg_4", ">", "0", ":", "logger", ".", "info", "(", "'max_buffer_size (samples): {} (repeats: {:.2f}, time: {:.5f} s)'", ".", "format", "(", "arg_4", ",", "arg_4", "/", "arg_1", ",", "arg_4", "/", "arg_0", ".", "device", ".", "sample_rate", ")", ")", "else", ":", "logger", ".", "info", "(", "'max_buffer_size (samples): UNLIMITED'", ")", "logger", ".", "info", "(", "'buffer_size (samples): {} (repeats: {:.2f}, time: {:.5f} s)'", ".", "format", "(", "arg_7", ",", "arg_7", "/", "arg_1", ",", "arg_7", "/", "arg_0", ".", "device", ".", "sample_rate", ")", ")", "logger", ".", "info", "(", "'buffer_repeats: {}'", ".", "format", "(", "arg_6", ")", ")", "return", "(", "arg_6", ",", "zeros", "(", "arg_7", ",", "numpy", ".", "complex64", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0):\n        \"\"\"Create buffer for reading samples\"\"\"\n        arg_5 = arg_1 * arg_2\n        arg_6 = 1\n        arg_7 = math.ceil(arg_5 / arg_3) * arg_3\n\n        if not arg_4:\n            # Max buffer size about 100 MB\n            arg_4 = (100 * 1024**2) / 8\n\n        if arg_4 > 0:\n            arg_4 = math.ceil(arg_4 / arg_3) * arg_3\n            if arg_7 > arg_4:\n                logger.warning('Required buffer size ({}) will be shrinked to max_buffer_size ({})!'.format(\n                    arg_7, arg_4\n                ))\n                arg_6 = math.ceil(arg_7 / arg_4)\n                arg_7 = arg_4\n\n        logger.info('repeats: {}'.format(arg_2))\n        logger.info('samples: {} (time: {:.5f} s)'.format(arg_5, arg_5 / arg_0.device.sample_rate))\n        if arg_4 > 0:\n            logger.info('max_buffer_size (samples): {} (repeats: {:.2f}, time: {:.5f} s)'.format(\n                arg_4, arg_4 / arg_1, arg_4 / arg_0.device.sample_rate\n            ))\n        else:\n            logger.info('max_buffer_size (samples): UNLIMITED')\n        logger.info('buffer_size (samples): {} (repeats: {:.2f}, time: {:.5f} s)'.format(\n            arg_7, arg_7 / arg_1, arg_7 / arg_0.device.sample_rate\n        ))\n        logger.info('buffer_repeats: {}'.format(arg_6))\n\n        return (arg_6, zeros(arg_7, numpy.complex64))", "path": "soapypower/power.py", "identifier": "SoapyPower.create_buffer", "docstring": "Create buffer for reading samples", "docstring_tokens": ["Create", "buffer", "for", "reading", "samples"], "nwo": "xmikos/soapy_power", "score": 0.1984218952631984, "idx": 256925}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/mean/_kron.py#L94-L98", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Effect-sizes parameter, B.", "language": "python", "parameters": "(self)", "return_statement": "return unvec(self._vecB.value, (self.X.shape[1], self.A.shape[0]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "unvec", "(", "arg_0", ".", "_vecFunc", ".", "value", ",", "(", "arg_0", ".", "X", ".", "shape", "[", "1", "]", ",", "arg_0", ".", "A", ".", "shape", "[", "0", "]", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Effect-sizes parameter, Func.\n        \"\"\"\n        return unvec(arg_0._vecFunc.value, (arg_0.X.shape[1], arg_0.A.shape[0]))", "path": "glimix_core/mean/_kron.py", "identifier": "KronMean.B", "docstring": "Effect-sizes parameter, B.", "docstring_tokens": ["Effect", "-", "sizes", "parameter", "B", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 256926}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gerrit.py#L403-L411", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Execute gerrit command", "language": "python", "parameters": "(self, cmd)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "from_archive", ":", "arg_2", "=", "arg_0", ".", "Func_from_archive", "(", "arg_1", ")", "else", ":", "arg_2", "=", "arg_0", ".", "Func_from_remote", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Execute gerrit command\"\"\"\n\n        if arg_0.from_archive:\n            arg_2 = arg_0.Func_from_archive(arg_1)\n        else:\n            arg_2 = arg_0.Func_from_remote(arg_1)\n\n        return arg_2", "path": "perceval/backends/core/gerrit.py", "identifier": "GerritClient.__execute", "docstring": "Execute gerrit command", "docstring_tokens": ["Execute", "gerrit", "command"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 256927}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L1297-L1315", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the enthalpy flow rate of the stream at the specified\n        temperature.", "language": "python", "parameters": "(self, T)", "return_statement": "return Hfr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "isCoal", ":", "return", "arg_0", ".", "Func_coal", "(", "arg_1", ")", "arg_2", "=", "0.0", "for", "arg_3", "in", "arg_0", ".", "material", ".", "compounds", ":", "arg_4", "=", "arg_0", ".", "material", ".", "get_compound_index", "(", "arg_3", ")", "arg_5", "=", "thermo", ".", "H", "(", "arg_3", ",", "arg_1", ",", "arg_0", ".", "_compound_mfrs", "[", "arg_4", "]", ")", "arg_2", "=", "arg_2", "+", "arg_5", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the enthalpy flow rate of the stream at the specified\n        temperature.\n\n        :param T: Temperature. [\u00b0C]\n\n        :returns: Enthalpy flow rate. [kWh/h]\n        \"\"\"\n\n        if arg_0.isCoal:\n            return arg_0.Func_coal(arg_1)\n\n        arg_2 = 0.0\n        for arg_3 in arg_0.material.compounds:\n            arg_4 = arg_0.material.get_compound_index(arg_3)\n            arg_5 = thermo.H(arg_3, arg_1, arg_0._compound_mfrs[arg_4])\n            arg_2 = arg_2 + arg_5\n        return arg_2", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "MaterialStream._calculate_Hfr", "docstring": "Calculate the enthalpy flow rate of the stream at the specified\n        temperature.\n\n        :param T: Temperature. [\u00b0C]\n\n        :returns: Enthalpy flow rate. [kWh/h]", "docstring_tokens": ["Calculate", "the", "enthalpy", "flow", "rate", "of", "the", "stream", "at", "the", "specified", "temperature", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 256928}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/transfer.py#L178-L195", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "State-space representation to zero-pole-gain representation.", "language": "python", "parameters": "(a,b,c,d, input=0)", "return_statement": "return z, p, k", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "import", "scipy", ".", "signal", "arg_5", ",", "arg_6", ",", "arg_7", "=", "scipy", ".", "signal", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_4", ")", "return", "arg_5", ",", "arg_6", ",", "arg_7"], "function": "def Func(arg_0,arg_1,arg_2,arg_3, arg_4=0):\n    \"\"\"State-space representation to zero-pole-gain representation.\n\n    :param A: ndarray State-space representation of linear system.\n    :param B: ndarray State-space representation of linear system.\n    :param C: ndarray State-space representation of linear system.\n    :param D: ndarray State-space representation of linear system.\n    :param int input: optional For multiple-input systems, the input to use.\n\n    :return:\n        * z, p : sequence  Zeros and poles.\n        * k : float System gain.\n\n    .. note:: wrapper of scipy function Func\n    \"\"\"\n    import scipy.signal\n    arg_5, arg_6, arg_7 = scipy.signal.Func(arg_0, arg_1, arg_2, arg_3, arg_4=arg_4)\n    return arg_5, arg_6, arg_7", "path": "src/spectrum/transfer.py", "identifier": "ss2zpk", "docstring": "State-space representation to zero-pole-gain representation.\n\n    :param A: ndarray State-space representation of linear system.\n    :param B: ndarray State-space representation of linear system.\n    :param C: ndarray State-space representation of linear system.\n    :param D: ndarray State-space representation of linear system.\n    :param int input: optional For multiple-input systems, the input to use.\n\n    :return:\n        * z, p : sequence  Zeros and poles.\n        * k : float System gain.\n\n    .. note:: wrapper of scipy function ss2zpk", "docstring_tokens": ["State", "-", "space", "representation", "to", "zero", "-", "pole", "-", "gain", "representation", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 256929}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/neurommsig/algorithm.py#L212-L234", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Calculate the node neighbor score for a given list of nodes.\n    \n    -  Doesn't consider self loops", "language": "python", "parameters": "(graph: BELGraph, nodes: List[BaseEntity])", "return_statement": "return unnormalized_sum / (number_nodes * (number_nodes - 1.0))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", ")", "->", "float", ":", "arg_2", "=", "list", "(", "arg_2", ")", "arg_5", "=", "len", "(", "arg_2", ")", "if", "arg_5", "<=", "1", ":", "return", "0.0", "arg_6", "=", "sum", "(", "u", "in", "arg_0", "[", "v", "]", "for", "u", ",", "v", "in", "itt", ".", "product", "(", "arg_2", ",", "repeat", "=", "2", ")", "if", "v", "in", "arg_0", "and", "u", "!=", "v", ")", "return", "arg_6", "/", "(", "arg_5", "*", "(", "arg_5", "-", "1.0", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4]) -> float:\n    \"\"\"Calculate the node neighbor score for a given list of nodes.\n    \n    -  Doesn't consider self loops\n\n    .. math::\n        \n         \\frac{\\sum_i^n N_G[i]}{n*(n-1)}\n    \"\"\"\n    arg_2 = list(arg_2)\n    arg_5 = len(arg_2)\n\n    if arg_5 <= 1:\n        # log.debug('')\n        return 0.0\n\n    arg_6 = sum(\n        u in arg_0[v]\n        for u, v in itt.product(arg_2, repeat=2)\n        if v in arg_0 and u != v\n    )\n\n    return arg_6 / (arg_5 * (arg_5 - 1.0))", "path": "src/pybel_tools/analysis/neurommsig/algorithm.py", "identifier": "neurommsig_topology", "docstring": "Calculate the node neighbor score for a given list of nodes.\n    \n    -  Doesn't consider self loops\n\n    .. math::\n        \n         \\frac{\\sum_i^n N_G[i]}{n*(n-1)}", "docstring_tokens": ["Calculate", "the", "node", "neighbor", "score", "for", "a", "given", "list", "of", "nodes", ".", "-", "Doesn", "t", "consider", "self", "loops"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256930}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1062-L1071", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Retrieves a single location by ID.", "language": "python", "parameters": "(self, location_id, depth=0)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "arg_3", "=", "arg_0", ".", "_perform_request", "(", "'/locations/%s?depth=%s'", "%", "(", "arg_1", ",", "arg_2", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        \"\"\"\n        Retrieves a single location by ID.\n\n        :param      location_id: The unique ID of the location.\n        :type       location_id: ``str``\n\n        \"\"\"\n        arg_3 = arg_0._perform_request('/locations/%s?depth=%s' % (arg_1, arg_2))\n        return arg_3", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.get_location", "docstring": "Retrieves a single location by ID.\n\n        :param      location_id: The unique ID of the location.\n        :type       location_id: ``str``", "docstring_tokens": ["Retrieves", "a", "single", "location", "by", "ID", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 256931}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/core/assist.py#L81-L110", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Bloomberg overrides for elements", "language": "python", "parameters": "(**kwargs)", "return_statement": "return [\n        (ELEM_KEYS.get(k, k), ELEM_VALS.get(ELEM_KEYS.get(k, k), dict()).get(v, v))\n        for k, v in kwargs.items()\n        if (k in list(ELEM_KEYS.keys()) + list(ELEM_KEYS.values()))\n        and (k not in PRSV_COLS)\n    ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", "->", "list", ":", "return", "[", "(", "ELEM_KEYS", ".", "get", "(", "arg_1", ",", "arg_1", ")", ",", "ELEM_VALS", ".", "get", "(", "ELEM_KEYS", ".", "get", "(", "arg_1", ",", "arg_1", ")", ",", "dict", "(", ")", ")", ".", "get", "(", "arg_2", ",", "arg_2", ")", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", "if", "(", "arg_1", "in", "list", "(", "ELEM_KEYS", ".", "keys", "(", ")", ")", "+", "list", "(", "ELEM_KEYS", ".", "values", "(", ")", ")", ")", "and", "(", "arg_1", "not", "in", "PRSV_COLS", ")", "]"], "function": "def Func(**arg_0) -> list:\n    \"\"\"\n    Bloomberg overrides for elements\n\n    Args:\n        **kwargs: overrides\n\n    Returns:\n        list of tuples\n\n    Examples:\n        >>> Func(PerAdj='A', Per='W')\n        [('periodicityAdjustment', 'ACTUAL'), ('periodicitySelection', 'WEEKLY')]\n        >>> Func(Days='A', Fill='B')\n        [('nonTradingDayFillOption', 'ALL_CALENDAR_DAYS'), ('nonTradingDayFillMethod', 'NIL_VALUE')]\n        >>> Func(CshAdjNormal=False, CshAdjAbnormal=True)\n        [('adjustmentNormal', False), ('adjustmentAbnormal', True)]\n        >>> Func(Per='W', Quote='Average', start_date='2018-01-10')\n        [('periodicitySelection', 'WEEKLY'), ('overrideOption', 'OVERRIDE_OPTION_GPA')]\n        >>> Func(QuoteType='Y')\n        [('pricingOption', 'PRICING_OPTION_YIELD')]\n        >>> Func(QuoteType='Y', cache=True)\n        [('pricingOption', 'PRICING_OPTION_YIELD')]\n    \"\"\"\n    return [\n        (ELEM_KEYS.get(arg_1, arg_1), ELEM_VALS.get(ELEM_KEYS.get(arg_1, arg_1), dict()).get(arg_2, arg_2))\n        for arg_1, arg_2 in arg_0.items()\n        if (arg_1 in list(ELEM_KEYS.keys()) + list(ELEM_KEYS.values()))\n        and (arg_1 not in PRSV_COLS)\n    ]", "path": "xbbg/core/assist.py", "identifier": "proc_elms", "docstring": "Bloomberg overrides for elements\n\n    Args:\n        **kwargs: overrides\n\n    Returns:\n        list of tuples\n\n    Examples:\n        >>> proc_elms(PerAdj='A', Per='W')\n        [('periodicityAdjustment', 'ACTUAL'), ('periodicitySelection', 'WEEKLY')]\n        >>> proc_elms(Days='A', Fill='B')\n        [('nonTradingDayFillOption', 'ALL_CALENDAR_DAYS'), ('nonTradingDayFillMethod', 'NIL_VALUE')]\n        >>> proc_elms(CshAdjNormal=False, CshAdjAbnormal=True)\n        [('adjustmentNormal', False), ('adjustmentAbnormal', True)]\n        >>> proc_elms(Per='W', Quote='Average', start_date='2018-01-10')\n        [('periodicitySelection', 'WEEKLY'), ('overrideOption', 'OVERRIDE_OPTION_GPA')]\n        >>> proc_elms(QuoteType='Y')\n        [('pricingOption', 'PRICING_OPTION_YIELD')]\n        >>> proc_elms(QuoteType='Y', cache=True)\n        [('pricingOption', 'PRICING_OPTION_YIELD')]", "docstring_tokens": ["Bloomberg", "overrides", "for", "elements"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 256932}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/standard/crz.py#L53-L55", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Apply crz from ctl to tgt with angle theta.", "language": "python", "parameters": "(self, theta, ctl, tgt)", "return_statement": "return self.append(CrzGate(theta), [ctl, tgt], [])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "arg_0", ".", "append", "(", "CrzGate", "(", "arg_1", ")", ",", "[", "arg_2", ",", "arg_3", "]", ",", "[", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Apply Func from ctl to tgt with angle theta.\"\"\"\n    return arg_0.append(CrzGate(arg_1), [arg_2, arg_3], [])", "path": "qiskit/extensions/standard/crz.py", "identifier": "crz", "docstring": "Apply crz from ctl to tgt with angle theta.", "docstring_tokens": ["Apply", "crz", "from", "ctl", "to", "tgt", "with", "angle", "theta", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 256933}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L625-L642", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Retrieves the subscriptions in the specified topic.", "language": "python", "parameters": "(self, topic_name)", "return_statement": "return _ETreeXmlToObject.convert_response_to_feeds(\n            response, _convert_etree_element_to_subscription)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'topic_name'", ",", "arg_1", ")", "arg_2", "=", "HTTPRequest", "(", ")", "arg_2", ".", "method", "=", "'GET'", "arg_2", ".", "host", "=", "arg_0", ".", "_get_host", "(", ")", "arg_2", ".", "path", "=", "'/'", "+", "_str", "(", "arg_1", ")", "+", "'/subscriptions/'", "arg_2", ".", "path", ",", "arg_2", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_2", ")", "arg_2", ".", "headers", "=", "arg_0", ".", "_update_service_bus_header", "(", "arg_2", ")", "arg_8", "=", "arg_0", ".", "_perform_request", "(", "arg_2", ")", "return", "_ETreeXmlToObject", ".", "convert_response_to_feeds", "(", "arg_8", ",", "_convert_etree_element_to_subscription", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Retrieves the subscriptions in the specified topic.\n\n        topic_name:\n            Name of the topic.\n        '''\n        _validate_not_none('topic_name', arg_1)\n        arg_2 = HTTPRequest()\n        arg_2.method = 'GET'\n        arg_2.host = arg_0._get_host()\n        arg_2.path = '/' + _str(arg_1) + '/subscriptions/'\n        arg_2.path, arg_2.query = arg_0._httpclient._update_request_uri_query(arg_2)  # pylint: disable=protected-access\n        arg_2.headers = arg_0._update_service_bus_header(arg_2)\n        arg_8 = arg_0._perform_request(arg_2)\n\n        return _ETreeXmlToObject.convert_response_to_feeds(\n            arg_8, _convert_etree_element_to_subscription)", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusService.list_subscriptions", "docstring": "Retrieves the subscriptions in the specified topic.\n\n        topic_name:\n            Name of the topic.", "docstring_tokens": ["Retrieves", "the", "subscriptions", "in", "the", "specified", "topic", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 256934}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/generation.py#L60-L73", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get nodes with no incoming edges, one outgoing edge, and without the given key in its data dictionary.", "language": "python", "parameters": "(graph: BELGraph, key: Optional[str] = None)", "return_statement": "return filter_nodes(graph, [node_is_upstream_leaf, data_missing_key_builder(key)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "None", ")", "->", "Iterable", "[", "BaseEntity", "]", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "WEIGHT", "return", "filter_nodes", "(", "arg_0", ",", "[", "node_is_upstream_leaf", ",", "data_missing_key_builder", "(", "arg_2", ")", "]", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4] = None) -> Iterable[BaseEntity]:\n    \"\"\"Get nodes with no incoming edges, one outgoing edge, and without the given key in its data dictionary.\n\n    .. seealso :: :func:`data_does_not_contain_key_builder`\n\n    :param graph: A BEL graph\n    :param key: The key in the node data dictionary representing the experimental data. Defaults to\n     :data:`pybel_tools.constants.WEIGHT`.\n    :return: An iterable over leaves (nodes with an in-degree of 0) that don't have the given annotation\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = WEIGHT\n\n    return filter_nodes(arg_0, [node_is_upstream_leaf, data_missing_key_builder(arg_2)])", "path": "src/pybel_tools/generation.py", "identifier": "get_unweighted_upstream_leaves", "docstring": "Get nodes with no incoming edges, one outgoing edge, and without the given key in its data dictionary.\n\n    .. seealso :: :func:`data_does_not_contain_key_builder`\n\n    :param graph: A BEL graph\n    :param key: The key in the node data dictionary representing the experimental data. Defaults to\n     :data:`pybel_tools.constants.WEIGHT`.\n    :return: An iterable over leaves (nodes with an in-degree of 0) that don't have the given annotation", "docstring_tokens": ["Get", "nodes", "with", "no", "incoming", "edges", "one", "outgoing", "edge", "and", "without", "the", "given", "key", "in", "its", "data", "dictionary", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 256935}
{"url": "https://github.com/valentinalexeev/pwaqi/blob/81a1fa1ad87be7ba015c1cb07c52c7760ca99d8c/pwaqi/__init__.py#L61-L76", "sha": "81a1fa1ad87be7ba015c1cb07c52c7760ca99d8c", "docstring_summary": "Request station data for a specific station identified by code.", "language": "python", "parameters": "(station_code, token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "requests", ".", "get", "(", "API_ENDPOINT_OBS", "%", "(", "arg_0", ")", ",", "params", "=", "{", "'token'", ":", "arg_1", "}", ")", "if", "arg_2", ".", "status_code", "==", "200", "and", "arg_2", ".", "json", "(", ")", "[", "'status'", "]", "==", "\"ok\"", ":", "return", "parse_observation_response", "(", "arg_2", ".", "json", "(", ")", "[", "'data'", "]", ")", "else", ":", "return", "{", "}"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Request station data for a specific station identified by code.\n\n    A language parameter can also be specified to translate location\n    information (default: \"en\")\n    \"\"\"\n    arg_2 = requests.get(\n        API_ENDPOINT_OBS % (arg_0),\n        params={\n            'token': arg_1\n        })\n\n    if arg_2.status_code == 200 and arg_2.json()['status'] == \"ok\":\n        return parse_observation_response(arg_2.json()['data'])\n    else:\n        return {}", "path": "pwaqi/__init__.py", "identifier": "get_station_observation", "docstring": "Request station data for a specific station identified by code.\n\n    A language parameter can also be specified to translate location\n    information (default: \"en\")", "docstring_tokens": ["Request", "station", "data", "for", "a", "specific", "station", "identified", "by", "code", "."], "nwo": "valentinalexeev/pwaqi", "score": 0.18657722465184873, "idx": 256936}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/output.py#L116-L132", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Check if the current player supports adding a title", "language": "python", "parameters": "(cls, cmd)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "is_win32", ":", "arg_1", "=", "shlex", ".", "split", "(", "arg_1", ")", "[", "0", "]", "arg_1", "=", "os", ".", "path", ".", "basename", "(", "arg_1", ".", "lower", "(", ")", ")", "for", "arg_2", ",", "arg_3", "in", "SUPPORTED_PLAYERS", ".", "items", "(", ")", ":", "for", "arg_4", "in", "arg_3", ":", "if", "arg_1", ".", "startswith", "(", "arg_4", ")", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Check if the current player supports adding a title\n\n        :param cmd: command to test\n        :return: name of the player|None\n        \"\"\"\n        if not is_win32:\n            # under a POSIX system use shlex to find the actual command\n            # under windows this is not an issue because executables end in .exe\n            arg_1 = shlex.split(arg_1)[0]\n\n        arg_1 = os.path.basename(arg_1.lower())\n        for arg_2, arg_3 in SUPPORTED_PLAYERS.items():\n            for arg_4 in arg_3:\n                if arg_1.startswith(arg_4):\n                    return arg_2", "path": "src/streamlink_cli/output.py", "identifier": "PlayerOutput.supported_player", "docstring": "Check if the current player supports adding a title\n\n        :param cmd: command to test\n        :return: name of the player|None", "docstring_tokens": ["Check", "if", "the", "current", "player", "supports", "adding", "a", "title"], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 256937}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/error.py#L262-L279", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "render one or all of my tracebacks to a list of lines", "language": "python", "parameters": "(self, excid=None)", "return_statement": "return lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "[", "]", "if", "arg_1", "is", "None", ":", "for", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "in", "arg_0", ".", "elist", ":", "arg_2", ".", "append", "(", "arg_0", ".", "_get_engine_str", "(", "arg_6", ")", ")", "arg_2", ".", "extend", "(", "(", "arg_5", "or", "'No traceback available'", ")", ".", "splitlines", "(", ")", ")", "arg_2", ".", "append", "(", "''", ")", "else", ":", "try", ":", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_0", ".", "elist", "[", "arg_1", "]", "except", ":", "raise", "IndexError", "(", "\"an exception with index %i does not exist\"", "%", "arg_1", ")", "else", ":", "arg_2", ".", "append", "(", "arg_0", ".", "_get_engine_str", "(", "arg_6", ")", ")", "arg_2", ".", "extend", "(", "(", "arg_5", "or", "'No traceback available'", ")", ".", "splitlines", "(", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"render one or all of my tracebacks to a list of lines\"\"\"\n        arg_2 = []\n        if arg_1 is None:\n            for (arg_3,arg_4,arg_5,arg_6) in arg_0.elist:\n                arg_2.append(arg_0._get_engine_str(arg_6))\n                arg_2.extend((arg_5 or 'No traceback available').splitlines())\n                arg_2.append('')\n        else:\n            try:\n                arg_3,arg_4,arg_5,arg_6 = arg_0.elist[arg_1]\n            except:\n                raise IndexError(\"an exception with index %i does not exist\"%arg_1)\n            else:\n                arg_2.append(arg_0._get_engine_str(arg_6))\n                arg_2.extend((arg_5 or 'No traceback available').splitlines())\n        \n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/parallel/error.py", "identifier": "CompositeError.render_traceback", "docstring": "render one or all of my tracebacks to a list of lines", "docstring_tokens": ["render", "one", "or", "all", "of", "my", "tracebacks", "to", "a", "list", "of", "lines"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256938}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/comparison.py#L209-L251", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Gets a list of DICOM file absolute paths and returns a list of lists of\n    DICOM file paths. Each group contains a set of DICOM files that have\n    exactly the same headers.", "language": "python", "parameters": "(dicom_file_paths, header_fields)", "return_statement": "return path_groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "SimpleDicomFileDistance", "(", "field_weights", "=", "arg_1", ")", "arg_3", "=", "arg_0", ".", "copy", "(", ")", "arg_4", "=", "DefaultOrderedDict", "(", "DicomFileSet", ")", "while", "len", "(", "arg_3", ")", ">", "0", ":", "arg_5", "=", "arg_3", ".", "pop", "(", ")", "arg_6", "=", "[", "arg_5", "]", "arg_2", ".", "set_dicom_file1", "(", "arg_5", ")", "arg_7", "=", "len", "(", "arg_3", ")", "-", "1", "while", "arg_7", ">=", "0", ":", "arg_8", "=", "arg_3", "[", "arg_7", "]", "arg_2", ".", "set_dicom_file2", "(", "arg_8", ")", "if", "arg_2", ".", "transform", "(", ")", ":", "arg_6", ".", "append", "(", "arg_8", ")", "arg_3", ".", "pop", "(", "arg_7", ")", "arg_7", "-=", "1", "arg_4", "[", "arg_5", "]", ".", "from_set", "(", "arg_6", ",", "check_if_dicoms", "=", "False", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Gets a list of DICOM file absolute paths and returns a list of lists of\n    DICOM file paths. Each group contains a set of DICOM files that have\n    exactly the same headers.\n\n    Parameters\n    ----------\n    dicom_file_paths: list of str\n        List or set of DICOM file paths\n\n    header_fields: list of str\n        List of header field names to check on the comparisons of the DICOM files.\n\n    Returns\n    -------\n    dict of DicomFileSets\n        The key is one filepath representing the group (the first found).\n    \"\"\"\n    arg_2 = SimpleDicomFileDistance(field_weights=arg_1)\n\n    arg_3 = arg_0.copy()\n\n    arg_4 = DefaultOrderedDict(DicomFileSet)\n\n    while len(arg_3) > 0:\n        arg_5 = arg_3.pop()\n        arg_6 = [arg_5]\n\n        arg_2.set_dicom_file1(arg_5)\n        arg_7 = len(arg_3)-1\n        while arg_7 >= 0:\n            arg_8 = arg_3[arg_7]\n            arg_2.set_dicom_file2(arg_8)\n\n            if arg_2.transform():\n                arg_6.append(arg_8)\n                arg_3.pop(arg_7)\n\n            arg_7 -= 1\n        arg_4[arg_5].from_set(arg_6, check_if_dicoms=False)\n\n    return arg_4", "path": "boyle/dicom/comparison.py", "identifier": "group_dicom_files", "docstring": "Gets a list of DICOM file absolute paths and returns a list of lists of\n    DICOM file paths. Each group contains a set of DICOM files that have\n    exactly the same headers.\n\n    Parameters\n    ----------\n    dicom_file_paths: list of str\n        List or set of DICOM file paths\n\n    header_fields: list of str\n        List of header field names to check on the comparisons of the DICOM files.\n\n    Returns\n    -------\n    dict of DicomFileSets\n        The key is one filepath representing the group (the first found).", "docstring_tokens": ["Gets", "a", "list", "of", "DICOM", "file", "absolute", "paths", "and", "returns", "a", "list", "of", "lists", "of", "DICOM", "file", "paths", ".", "Each", "group", "contains", "a", "set", "of", "DICOM", "files", "that", "have", "exactly", "the", "same", "headers", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 256939}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/inkscape.py#L87-L95", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Transform SVG file to PDF file", "language": "python", "parameters": "(svg_file_path, pdf_file_path, dpi=150, command_binpath=None, support_unicode=False)", "return_statement": "return inkscape_export(svg_file_path, pdf_file_path, export_flag=\"-A\",\n                           dpi=dpi, inkscape_binpath=command_binpath)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "150", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "arg_4", ":", "return", "rsvg_export", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "rsvg_binpath", "=", "arg_3", ")", "return", "inkscape_export", "(", "arg_0", ",", "arg_1", ",", "export_flag", "=", "\"-A\"", ",", "arg_2", "=", "arg_2", ",", "inkscape_binpath", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=150, arg_3=None, arg_4=False):\n    \"\"\" Transform SVG file to PDF file\n    \"\"\"\n\n    if arg_4:\n        return rsvg_export(arg_0, arg_1, arg_2=arg_2, rsvg_binpath=arg_3)\n\n    return inkscape_export(arg_0, arg_1, export_flag=\"-A\",\n                           arg_2=arg_2, inkscape_binpath=arg_3)", "path": "docstamp/inkscape.py", "identifier": "svg2pdf", "docstring": "Transform SVG file to PDF file", "docstring_tokens": ["Transform", "SVG", "file", "to", "PDF", "file"], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 256940}
{"url": "https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L177-L212", "sha": "ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449", "docstring_summary": "Exports expected read counts", "language": "python", "parameters": "(self, filename, grp_wise=False, reorder='as-is', notes=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "'as-is'", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "probability", ".", "sum", "(", "axis", "=", "APM", ".", "Axis", ".", "READ", ")", "if", "arg_2", ":", "arg_6", "=", "arg_0", ".", "probability", ".", "gname", "arg_5", "=", "arg_5", "*", "arg_0", ".", "grp_conv_mat", "else", ":", "arg_6", "=", "arg_0", ".", "probability", ".", "lname", "arg_7", "=", "arg_5", ".", "sum", "(", "axis", "=", "0", ")", "if", "arg_3", "==", "'decreasing'", ":", "arg_8", "=", "np", ".", "argsort", "(", "arg_7", ".", "flatten", "(", ")", ")", "arg_8", "=", "arg_8", "[", ":", ":", "-", "1", "]", "elif", "arg_3", "==", "'increasing'", ":", "arg_8", "=", "np", ".", "argsort", "(", "arg_7", ".", "flatten", "(", ")", ")", "elif", "arg_3", "==", "'as-is'", ":", "arg_8", "=", "np", ".", "arange", "(", "len", "(", "arg_6", ")", ")", "arg_9", "=", "np", ".", "vstack", "(", "(", "arg_5", ",", "arg_7", ")", ")", "arg_10", "=", "open", "(", "arg_1", ",", "'w'", ")", "arg_10", ".", "write", "(", "\"locus\\t\"", "+", "\"\\t\"", ".", "join", "(", "arg_0", ".", "probability", ".", "hname", ")", "+", "\"\\ttotal\"", ")", "if", "arg_4", "is", "not", "None", ":", "arg_10", ".", "write", "(", "\"\\tnotes\"", ")", "arg_10", ".", "write", "(", "\"\\n\"", ")", "for", "arg_11", "in", "arg_8", ":", "arg_12", "=", "arg_6", "[", "arg_11", "]", "arg_10", ".", "write", "(", "\"\\t\"", ".", "join", "(", "[", "arg_12", "]", "+", "map", "(", "str", ",", "arg_9", "[", ":", ",", "arg_11", "]", ".", "ravel", "(", ")", ")", ")", ")", "if", "arg_4", "is", "not", "None", ":", "arg_10", ".", "write", "(", "\"\\t%s\"", "%", "arg_4", "[", "arg_12", "]", ")", "arg_10", ".", "write", "(", "\"\\n\"", ")", "arg_10", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3='as-is', arg_4=None):\n        \"\"\"\n        Exports expected read counts\n\n        :param filename: File name for output\n        :param grp_wise: whether the report is at isoform level or gene level\n        :param reorder: whether the report should be either 'decreasing' or 'increasing' order or just 'as-is'\n        :return: Nothing but the method writes a file\n        \"\"\"\n        arg_5 = arg_0.probability.sum(axis=APM.Axis.READ)\n        if arg_2:\n            arg_6 = arg_0.probability.gname\n            arg_5 = arg_5 * arg_0.grp_conv_mat\n        else:\n            arg_6 = arg_0.probability.lname\n        arg_7 = arg_5.sum(axis=0)\n        if arg_3 == 'decreasing':\n            arg_8 = np.argsort(arg_7.flatten())\n            arg_8 = arg_8[::-1]\n        elif arg_3 == 'increasing':\n            arg_8 = np.argsort(arg_7.flatten())\n        elif arg_3 == 'as-is':\n            arg_8 = np.arange(len(arg_6))  # report in the original locus order\n        arg_9 = np.vstack((arg_5, arg_7))\n        arg_10 = open(arg_1, 'w')\n        arg_10.write(\"locus\\t\" + \"\\t\".join(arg_0.probability.hname) + \"\\ttotal\")\n        if arg_4 is not None:\n            arg_10.write(\"\\tnotes\")\n        arg_10.write(\"\\n\")\n        for arg_11 in arg_8:\n            arg_12 = arg_6[arg_11]\n            arg_10.write(\"\\t\".join([arg_12] + map(str, arg_9[:, arg_11].ravel())))\n            if arg_4 is not None:\n                arg_10.write(\"\\t%s\" % arg_4[arg_12])\n            arg_10.write(\"\\n\")\n        arg_10.close()", "path": "emase/EMfactory.py", "identifier": "EMfactory.report_read_counts", "docstring": "Exports expected read counts\n\n        :param filename: File name for output\n        :param grp_wise: whether the report is at isoform level or gene level\n        :param reorder: whether the report should be either 'decreasing' or 'increasing' order or just 'as-is'\n        :return: Nothing but the method writes a file", "docstring_tokens": ["Exports", "expected", "read", "counts"], "nwo": "churchill-lab/emase", "score": 0.1956350121830092, "idx": 256941}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/permutations_runner.py#L1898-L2041", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Creates an iterator that returns ModelInfo elements for the given modelIDs", "language": "python", "parameters": "(modelIDs)", "return_statement": "return ModelInfoIterator(modelIDs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "class", "ModelInfoIterator", "(", "object", ")", ":", "arg_1", "=", "1000", "arg_2", "=", "False", "def", "__init__", "(", "arg_3", ",", "arg_0", ")", ":", "arg_3", ".", "__modelIDs", "=", "tuple", "(", "arg_0", ")", "if", "arg_3", ".", "debug", ":", "_emit", "(", "Verbosity", ".", "DEBUG", ",", "\"MODELITERATOR: __init__; numModelIDs=%s\"", "%", "len", "(", "arg_3", ".", "__modelIDs", ")", ")", "arg_3", ".", "__nextIndex", "=", "0", "arg_3", ".", "__modelCache", "=", "collections", ".", "deque", "(", ")", "return", "def", "__iter__", "(", "arg_3", ")", ":", "return", "arg_3", "def", "next", "(", "arg_3", ")", ":", "return", "arg_3", ".", "__getNext", "(", ")", "def", "__getNext", "(", "arg_3", ")", ":", "if", "arg_3", ".", "debug", ":", "_emit", "(", "Verbosity", ".", "DEBUG", ",", "\"MODELITERATOR: __getNext(); modelCacheLen=%s\"", "%", "(", "len", "(", "arg_3", ".", "__modelCache", ")", ")", ")", "if", "not", "arg_3", ".", "__modelCache", ":", "arg_3", ".", "__fillCache", "(", ")", "if", "not", "arg_3", ".", "__modelCache", ":", "raise", "StopIteration", "(", ")", "return", "arg_3", ".", "__modelCache", ".", "popleft", "(", ")", "def", "__fillCache", "(", "arg_3", ")", ":", "assert", "(", "not", "arg_3", ".", "__modelCache", ")", "arg_7", "=", "len", "(", "arg_3", ".", "__modelIDs", ")", "if", "arg_3", ".", "__modelIDs", "else", "0", "if", "arg_3", ".", "__nextIndex", ">=", "arg_7", ":", "return", "arg_8", "=", "arg_3", ".", "__nextIndex", "+", "arg_3", ".", "__CACHE_LIMIT", "if", "arg_8", ">", "arg_7", ":", "arg_8", "=", "arg_7", "arg_9", "=", "arg_3", ".", "__modelIDs", "[", "arg_3", ".", "__nextIndex", ":", "arg_8", "]", "arg_3", ".", "__nextIndex", "+=", "(", "arg_8", "-", "arg_3", ".", "__nextIndex", ")", "arg_10", "=", "_clientJobsDB", "(", ")", ".", "modelsInfo", "(", "arg_9", ")", "assert", "len", "(", "arg_10", ")", "==", "len", "(", "arg_9", ")", ",", "\"modelsInfo returned %s elements; expected %s.\"", "%", "(", "len", "(", "arg_10", ")", ",", "len", "(", "arg_9", ")", ")", "for", "arg_11", "in", "arg_10", ":", "arg_12", "=", "_NupicModelInfo", "(", "arg_11", "=", "arg_11", ")", "arg_3", ".", "__modelCache", ".", "append", "(", "arg_12", ")", "assert", "len", "(", "arg_3", ".", "__modelCache", ")", "==", "len", "(", "arg_9", ")", ",", "\"Added %s elements to modelCache; expected %s.\"", "%", "(", "len", "(", "arg_3", ".", "__modelCache", ")", ",", "len", "(", "arg_9", ")", ")", "if", "arg_3", ".", "debug", ":", "_emit", "(", "Verbosity", ".", "DEBUG", ",", "\"MODELITERATOR: Leaving __fillCache(); modelCacheLen=%s\"", "%", "(", "len", "(", "arg_3", ".", "__modelCache", ")", ",", ")", ")", "return", "ModelInfoIterator", "(", "arg_0", ")"], "function": "def Func(arg_0):\n  \"\"\"Creates an iterator that returns ModelInfo elements for the given modelIDs\n\n  WARNING:      The order of ModelInfo elements returned by the iterator\n                may not match the order of the given modelIDs\n\n  Parameters:\n  ----------------------------------------------------------------------\n  modelIDs:       A sequence of model identifiers (e.g., as returned by\n                  _HyperSearchJob.queryModelIDs()).\n  retval:         Iterator that returns ModelInfo elements for the given\n                  modelIDs (NOTE:possibly in a different order)\n  \"\"\"\n\n  class ModelInfoIterator(object):\n    \"\"\"ModelInfo iterator implementation class\n    \"\"\"\n\n    # Maximum number of ModelInfo elements to load into cache whenever\n    # cache empties\n    arg_1 = 1000\n\n    arg_2=False\n\n\n    def __init__(arg_3, arg_0):\n      \"\"\"\n      Parameters:\n      ----------------------------------------------------------------------\n      modelIDs:     a sequence of Nupic model identifiers for which this\n                    iterator will return _NupicModelInfo instances.\n                    NOTE: The returned instances are NOT guaranteed to be in\n                    the same order as the IDs in modelIDs sequence.\n      retval:       nothing\n      \"\"\"\n      # Make our own copy in case caller changes model id list during iteration\n      arg_3.__modelIDs = tuple(arg_0)\n\n      if arg_3.debug:\n        _emit(Verbosity.DEBUG,\n              \"MODELITERATOR: __init__; numModelIDs=%s\" % len(arg_3.__modelIDs))\n\n      arg_3.__nextIndex = 0\n      arg_3.__modelCache = collections.deque()\n      return\n\n\n    def __iter__(arg_3):\n      \"\"\"Iterator Protocol function\n\n      Parameters:\n      ----------------------------------------------------------------------\n      retval:         self\n      \"\"\"\n      return arg_3\n\n\n\n    def next(arg_3):\n      \"\"\"Iterator Protocol function\n\n      Parameters:\n      ----------------------------------------------------------------------\n      retval:       A _NupicModelInfo instance or raises StopIteration to\n                    signal end of iteration.\n      \"\"\"\n      return arg_3.__getNext()\n\n\n\n    def __getNext(arg_3):\n      \"\"\"Implementation of the next() Iterator Protocol function.\n\n      When the modelInfo cache becomes empty, queries Nupic and fills the cache\n      with the next set of NupicModelInfo instances.\n\n      Parameters:\n      ----------------------------------------------------------------------\n      retval:       A _NupicModelInfo instance or raises StopIteration to\n                    signal end of iteration.\n      \"\"\"\n\n      if arg_3.debug:\n        _emit(Verbosity.DEBUG,\n              \"MODELITERATOR: __getNext(); modelCacheLen=%s\" % (\n                  len(arg_3.__modelCache)))\n\n      if not arg_3.__modelCache:\n        arg_3.__fillCache()\n\n      if not arg_3.__modelCache:\n        raise StopIteration()\n\n      return arg_3.__modelCache.popleft()\n\n\n\n    def __fillCache(arg_3):\n      \"\"\"Queries Nupic and fills an empty modelInfo cache with the next set of\n      _NupicModelInfo instances\n\n      Parameters:\n      ----------------------------------------------------------------------\n      retval:       nothing\n      \"\"\"\n      assert (not arg_3.__modelCache)\n\n      # Assemble a list of model IDs to look up\n      arg_7 = len(arg_3.__modelIDs) if arg_3.__modelIDs else 0\n\n      if arg_3.__nextIndex >= arg_7:\n        return\n\n      arg_8 = arg_3.__nextIndex + arg_3.__CACHE_LIMIT\n      if arg_8 > arg_7:\n        arg_8 = arg_7\n\n      arg_9 = arg_3.__modelIDs[arg_3.__nextIndex:arg_8]\n\n      arg_3.__nextIndex += (arg_8 - arg_3.__nextIndex)\n\n      # Query Nupic for model info of all models in the look-up list\n      # NOTE: the order of results may not be the same as lookupIDs\n      arg_10 = _clientJobsDB().modelsInfo(arg_9)\n      assert len(arg_10) == len(arg_9), \\\n            \"modelsInfo returned %s elements; expected %s.\" % \\\n            (len(arg_10), len(arg_9))\n\n      # Create _NupicModelInfo instances and add them to cache\n      for arg_11 in arg_10:\n        arg_12 = _NupicModelInfo(arg_11=arg_11)\n        arg_3.__modelCache.append(arg_12)\n\n      assert len(arg_3.__modelCache) == len(arg_9), \\\n             \"Added %s elements to modelCache; expected %s.\" % \\\n             (len(arg_3.__modelCache), len(arg_9))\n\n      if arg_3.debug:\n        _emit(Verbosity.DEBUG,\n              \"MODELITERATOR: Leaving __fillCache(); modelCacheLen=%s\" % \\\n                (len(arg_3.__modelCache),))\n\n\n  return ModelInfoIterator(arg_0)", "path": "src/nupic/swarming/permutations_runner.py", "identifier": "_iterModels", "docstring": "Creates an iterator that returns ModelInfo elements for the given modelIDs\n\n  WARNING:      The order of ModelInfo elements returned by the iterator\n                may not match the order of the given modelIDs\n\n  Parameters:\n  ----------------------------------------------------------------------\n  modelIDs:       A sequence of model identifiers (e.g., as returned by\n                  _HyperSearchJob.queryModelIDs()).\n  retval:         Iterator that returns ModelInfo elements for the given\n                  modelIDs (NOTE:possibly in a different order)", "docstring_tokens": ["Creates", "an", "iterator", "that", "returns", "ModelInfo", "elements", "for", "the", "given", "modelIDs"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 256942}
{"url": "https://github.com/ScriptSmith/socialreaper/blob/87fcc3b74bbed6c4f8e7f49a5f0eb8a616cf38da/socialreaper/apis.py#L57-L90", "sha": "87fcc3b74bbed6c4f8e7f49a5f0eb8a616cf38da", "docstring_summary": "An interface for get requests that handles errors more gracefully to\r\n        prevent data loss", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "session", ".", "Func", "if", "arg_0", ".", "session", "else", "requests", ".", "Func", "arg_4", "=", "arg_3", "(", "*", "arg_1", ",", "**", "arg_2", ")", "arg_4", ".", "raise_for_status", "(", ")", "arg_0", ".", "failed_last", "=", "False", "return", "arg_4", "except", "requests", ".", "exceptions", ".", "RequestException", "as", "e", ":", "arg_0", ".", "log_error", "(", "e", ")", "for", "arg_6", "in", "range", "(", "1", ",", "arg_0", ".", "num_retries", ")", ":", "arg_7", "=", "arg_0", ".", "retry_rate", "*", "arg_6", "arg_0", ".", "log_function", "(", "\"Retrying in %s seconds\"", "%", "arg_7", ")", "arg_0", ".", "_sleep", "(", "arg_7", ")", "try", ":", "arg_4", "=", "requests", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "arg_4", ".", "raise_for_status", "(", ")", "arg_0", ".", "log_function", "(", "\"New request successful\"", ")", "return", "arg_4", "except", "requests", ".", "exceptions", ".", "RequestException", ":", "arg_0", ".", "log_function", "(", "\"New request failed\"", ")", "if", "not", "arg_0", ".", "failed_last", ":", "arg_0", ".", "failed_last", "=", "True", "raise", "ApiError", "(", "e", ")", "else", ":", "raise", "FatalApiError", "(", "e", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\r\n\r\n        \"\"\"\r\n        An interface for Func requests that handles errors more gracefully to\r\n        prevent data loss\r\n        \"\"\"\r\n\r\n        try:\r\n            arg_3 = arg_0.session.Func if arg_0.session else requests.Func\r\n            arg_4 = arg_3(*arg_1, **arg_2)\r\n            arg_4.raise_for_status()\r\n            arg_0.failed_last = False\r\n            return arg_4\r\n\r\n        except requests.exceptions.RequestException as e:\r\n            arg_0.log_error(e)\r\n            for arg_6 in range(1, arg_0.num_retries):\r\n                arg_7 = arg_0.retry_rate * arg_6\r\n                arg_0.log_function(\"Retrying in %s seconds\" % arg_7)\r\n                arg_0._sleep(arg_7)\r\n                try:\r\n                    arg_4 = requests.Func(*arg_1, **arg_2)\r\n                    arg_4.raise_for_status()\r\n                    arg_0.log_function(\"New request successful\")\r\n                    return arg_4\r\n                except requests.exceptions.RequestException:\r\n                    arg_0.log_function(\"New request failed\")\r\n\r\n            # Allows for the api to ignore one potentially bad request\r\n            if not arg_0.failed_last:\r\n                arg_0.failed_last = True\r\n                raise ApiError(e)\r\n            else:\r\n                raise FatalApiError(e)", "path": "socialreaper/apis.py", "identifier": "API.get", "docstring": "An interface for get requests that handles errors more gracefully to\r\n        prevent data loss", "docstring_tokens": ["An", "interface", "for", "get", "requests", "that", "handles", "errors", "more", "gracefully", "to", "prevent", "data", "loss"], "nwo": "ScriptSmith/socialreaper", "score": 0.5466074136153003, "idx": 256943}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/session.py#L686-L739", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Unserialize a msg_list to a nested message dict.", "language": "python", "parameters": "(self, msg_list, content=True, copy=True)", "return_statement": "return message", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "4", "arg_5", "=", "{", "}", "if", "not", "arg_3", ":", "for", "arg_6", "in", "range", "(", "arg_4", ")", ":", "arg_1", "[", "arg_6", "]", "=", "arg_1", "[", "arg_6", "]", ".", "bytes", "if", "arg_0", ".", "auth", "is", "not", "None", ":", "arg_7", "=", "arg_1", "[", "0", "]", "if", "not", "arg_7", ":", "raise", "ValueError", "(", "\"Unsigned Message\"", ")", "if", "arg_7", "in", "arg_0", ".", "digest_history", ":", "raise", "ValueError", "(", "\"Duplicate Signature: %r\"", "%", "arg_7", ")", "arg_0", ".", "digest_history", ".", "add", "(", "arg_7", ")", "arg_8", "=", "arg_0", ".", "sign", "(", "arg_1", "[", "1", ":", "4", "]", ")", "if", "not", "arg_7", "==", "arg_8", ":", "raise", "ValueError", "(", "\"Invalid Signature: %r\"", "%", "arg_7", ")", "if", "not", "len", "(", "arg_1", ")", ">=", "arg_4", ":", "raise", "TypeError", "(", "\"malformed message, must have at least %i elements\"", "%", "arg_4", ")", "arg_9", "=", "arg_0", ".", "unpack", "(", "arg_1", "[", "1", "]", ")", "arg_5", "[", "'header'", "]", "=", "arg_9", "arg_5", "[", "'msg_id'", "]", "=", "arg_9", "[", "'msg_id'", "]", "arg_5", "[", "'msg_type'", "]", "=", "arg_9", "[", "'msg_type'", "]", "arg_5", "[", "'parent_header'", "]", "=", "arg_0", ".", "unpack", "(", "arg_1", "[", "2", "]", ")", "if", "arg_2", ":", "arg_5", "[", "'content'", "]", "=", "arg_0", ".", "unpack", "(", "arg_1", "[", "3", "]", ")", "else", ":", "arg_5", "[", "'content'", "]", "=", "arg_1", "[", "3", "]", "arg_5", "[", "'buffers'", "]", "=", "arg_1", "[", "4", ":", "]", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=True):\n        \"\"\"Unserialize a msg_list to a nested message dict.\n\n        This is roughly the inverse of serialize. The serialize/Func\n        methods work with full message lists, whereas pack/unpack work with\n        the individual message parts in the message list.\n\n        Parameters:\n        -----------\n        msg_list : list of bytes or Message objects\n            The list of message parts of the form [HMAC,p_header,p_parent,\n            p_content,buffer1,buffer2,...].\n        content : bool (True)\n            Whether to unpack the content dict (True), or leave it packed\n            (False).\n        copy : bool (True)\n            Whether to return the bytes (True), or the non-copying Message\n            object in each place (False).\n\n        Returns\n        -------\n        msg : dict\n            The nested message dict with top-level keys [header, parent_header,\n            content, buffers].\n        \"\"\"\n        arg_4 = 4\n        arg_5 = {}\n        if not arg_3:\n            for arg_6 in range(arg_4):\n                arg_1[arg_6] = arg_1[arg_6].bytes\n        if arg_0.auth is not None:\n            arg_7 = arg_1[0]\n            if not arg_7:\n                raise ValueError(\"Unsigned Message\")\n            if arg_7 in arg_0.digest_history:\n                raise ValueError(\"Duplicate Signature: %r\"%arg_7)\n            arg_0.digest_history.add(arg_7)\n            arg_8 = arg_0.sign(arg_1[1:4])\n            if not arg_7 == arg_8:\n                raise ValueError(\"Invalid Signature: %r\"%arg_7)\n        if not len(arg_1) >= arg_4:\n            raise TypeError(\"malformed message, must have at least %i elements\"%arg_4)\n        arg_9 = arg_0.unpack(arg_1[1])\n        arg_5['header'] = arg_9\n        arg_5['msg_id'] = arg_9['msg_id']\n        arg_5['msg_type'] = arg_9['msg_type']\n        arg_5['parent_header'] = arg_0.unpack(arg_1[2])\n        if arg_2:\n            arg_5['content'] = arg_0.unpack(arg_1[3])\n        else:\n            arg_5['content'] = arg_1[3]\n\n        arg_5['buffers'] = arg_1[4:]\n        return arg_5", "path": "environment/lib/python2.7/site-packages/IPython/zmq/session.py", "identifier": "Session.unserialize", "docstring": "Unserialize a msg_list to a nested message dict.\n\n        This is roughly the inverse of serialize. The serialize/unserialize\n        methods work with full message lists, whereas pack/unpack work with\n        the individual message parts in the message list.\n\n        Parameters:\n        -----------\n        msg_list : list of bytes or Message objects\n            The list of message parts of the form [HMAC,p_header,p_parent,\n            p_content,buffer1,buffer2,...].\n        content : bool (True)\n            Whether to unpack the content dict (True), or leave it packed\n            (False).\n        copy : bool (True)\n            Whether to return the bytes (True), or the non-copying Message\n            object in each place (False).\n\n        Returns\n        -------\n        msg : dict\n            The nested message dict with top-level keys [header, parent_header,\n            content, buffers].", "docstring_tokens": ["Unserialize", "a", "msg_list", "to", "a", "nested", "message", "dict", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256944}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/sigsys.py#L284-L329", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "CD sled position control case study of Chapter 18.", "language": "python", "parameters": "(Ka,out_type = 'fb_exact')", "return_statement": "return b, a", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'fb_exact'", ")", ":", "arg_2", "=", "10", "/", "(", "2", "*", "np", ".", "pi", ")", "if", "arg_1", ".", "lower", "(", ")", "==", "'open_loop'", ":", "arg_3", "=", "np", ".", "array", "(", "[", "arg_0", "*", "4000", "*", "arg_2", "]", ")", "arg_4", "=", "np", ".", "array", "(", "[", "1", ",", "1275", ",", "31250", ",", "0", "]", ")", "elif", "arg_1", ".", "lower", "(", ")", "==", "'fb_approx'", ":", "arg_3", "=", "np", ".", "array", "(", "[", "3.2", "*", "arg_0", "*", "arg_2", "]", ")", "arg_4", "=", "np", ".", "array", "(", "[", "1", ",", "25", ",", "3.2", "*", "arg_0", "*", "arg_2", "]", ")", "elif", "arg_1", ".", "lower", "(", ")", "==", "'fb_exact'", ":", "arg_3", "=", "np", ".", "array", "(", "[", "4000", "*", "arg_0", "*", "arg_2", "]", ")", "arg_4", "=", "np", ".", "array", "(", "[", "1", ",", "1250", "+", "25", ",", "25", "*", "1250", ",", "4000", "*", "arg_0", "*", "arg_2", "]", ")", "else", ":", "raise", "ValueError", "(", "'out_type must be: open_loop, fb_approx, or fc_exact'", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0,arg_1 = 'fb_exact'):\n    \"\"\"\n    CD sled position control case study of Chapter 18.\n\n    The function returns the closed-loop and open-loop\n    system function for a CD/DVD sled position control\n    system. The loop amplifier gain is the only variable\n    that may be changed. The returned system function can\n    however be changed.\n\n    Parameters\n    ----------\n    Ka : loop amplifier gain, start with 50.\n    out_type : 'open_loop' for open loop system function\n    out_type : 'fb_approx' for closed-loop approximation\n    out_type : 'fb_exact' for closed-loop exact\n\n    Returns\n    -------\n    b : numerator coefficient ndarray\n    a : denominator coefficient ndarray \n\n    Notes\n    -----\n    With the exception of the loop amplifier gain, all\n    other parameters are hard-coded from Case Study example.\n\n    Examples\n    --------\n    >>> b,a = Func(Ka,'fb_approx')\n    >>> b,a = Func(Ka,'fb_exact')\n    \"\"\"\n    arg_2 = 10/(2*np.pi)\n    # Load b and a ndarrays with the coefficients\n    if arg_1.lower() == 'open_loop':\n        arg_3 = np.array([arg_0*4000*arg_2])\n        arg_4 = np.array([1,1275,31250,0])\n    elif arg_1.lower() == 'fb_approx':\n        arg_3 = np.array([3.2*arg_0*arg_2])\n        arg_4 = np.array([1, 25, 3.2*arg_0*arg_2])\n    elif arg_1.lower() == 'fb_exact':\n        arg_3 = np.array([4000*arg_0*arg_2])\n        arg_4 = np.array([1, 1250+25, 25*1250, 4000*arg_0*arg_2])\n    else:\n        raise ValueError('out_type must be: open_loop, fb_approx, or fc_exact')\n    return arg_3, arg_4", "path": "sk_dsp_comm/sigsys.py", "identifier": "position_CD", "docstring": "CD sled position control case study of Chapter 18.\n\n    The function returns the closed-loop and open-loop\n    system function for a CD/DVD sled position control\n    system. The loop amplifier gain is the only variable\n    that may be changed. The returned system function can\n    however be changed.\n\n    Parameters\n    ----------\n    Ka : loop amplifier gain, start with 50.\n    out_type : 'open_loop' for open loop system function\n    out_type : 'fb_approx' for closed-loop approximation\n    out_type : 'fb_exact' for closed-loop exact\n\n    Returns\n    -------\n    b : numerator coefficient ndarray\n    a : denominator coefficient ndarray \n\n    Notes\n    -----\n    With the exception of the loop amplifier gain, all\n    other parameters are hard-coded from Case Study example.\n\n    Examples\n    --------\n    >>> b,a = position_CD(Ka,'fb_approx')\n    >>> b,a = position_CD(Ka,'fb_exact')", "docstring_tokens": ["CD", "sled", "position", "control", "case", "study", "of", "Chapter", "18", "."], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 256945}
{"url": "https://github.com/Jaza/s3-saver/blob/81dc4447d76c2fc0b0238fb96fa70e879612e355/s3_saver.py#L88-L110", "sha": "81dc4447d76c2fc0b0238fb96fa70e879612e355", "docstring_summary": "Saves the specified file to the local file system.", "language": "python", "parameters": "(self, temp_file, filename, obj)", "return_statement": "return filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_get_path", "(", "arg_2", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", ")", ":", "os", ".", "makedirs", "(", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", ",", "arg_0", ".", "permission", "|", "0o111", ")", "arg_5", "=", "open", "(", "arg_4", ",", "'wb'", ")", "arg_1", ".", "seek", "(", "0", ")", "arg_6", "=", "arg_1", ".", "read", "(", "1048576", ")", "while", "arg_6", ":", "arg_5", ".", "write", "(", "arg_6", ")", "arg_6", "=", "arg_1", ".", "read", "(", "1048576", ")", "arg_5", ".", "close", "(", ")", "if", "arg_0", ".", "filesize_field", ":", "setattr", "(", "arg_3", ",", "arg_0", ".", "filesize_field", ",", "os", ".", "path", ".", "getsize", "(", "arg_4", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Saves the specified file to the local file system.\"\"\"\n\n        arg_4 = arg_0._get_path(arg_2)\n        if not os.path.exists(os.path.dirname(arg_4)):\n            os.makedirs(os.path.dirname(arg_4), arg_0.permission | 0o111)\n\n        arg_5 = open(arg_4, 'wb')\n\n        # Thanks to:\n        # http://stackoverflow.com/a/3253276/2066849\n        arg_1.seek(0)\n        arg_6 = arg_1.read(1048576)\n        while arg_6:\n            arg_5.write(arg_6)\n            arg_6 = arg_1.read(1048576)\n\n        arg_5.close()\n\n        if arg_0.filesize_field:\n            setattr(arg_3, arg_0.filesize_field, os.path.getsize(arg_4))\n\n        return arg_2", "path": "s3_saver.py", "identifier": "S3Saver._save_local", "docstring": "Saves the specified file to the local file system.", "docstring_tokens": ["Saves", "the", "specified", "file", "to", "the", "local", "file", "system", "."], "nwo": "Jaza/s3-saver", "score": 0.17697123869542528, "idx": 256946}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanzaprocessor.py#L302-L312", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Process presence stanza.", "language": "python", "parameters": "(self, stanza)", "return_statement": "return self.__try_handlers(self._presence_handlers, stanza, stanza_type)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "stanza_type", "return", "arg_0", ".", "__try_handlers", "(", "arg_0", ".", "_presence_handlers", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process presence stanza.\n\n        Pass it to a handler of the stanza's type and payload namespace.\n\n        :Parameters:\n            - `stanza`: presence stanza to be handled\n        \"\"\"\n\n        arg_2 = arg_1.stanza_type\n        return arg_0.__try_handlers(arg_0._presence_handlers, arg_1, arg_2)", "path": "pyxmpp2/stanzaprocessor.py", "identifier": "StanzaProcessor.process_presence", "docstring": "Process presence stanza.\n\n        Pass it to a handler of the stanza's type and payload namespace.\n\n        :Parameters:\n            - `stanza`: presence stanza to be handled", "docstring_tokens": ["Process", "presence", "stanza", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 256947}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/triangular.py#L33-L38", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper to broadcast a tensor using a list of target tensors.", "language": "python", "parameters": "(tensor_to_broadcast, target_tensors)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "for", "arg_3", "in", "arg_1", ":", "arg_2", "+=", "tf", ".", "zeros_like", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Helper to broadcast a tensor using a list of target tensors.\"\"\"\n  arg_2 = arg_0\n  for arg_3 in arg_1:\n    arg_2 += tf.zeros_like(arg_3)\n  return arg_2", "path": "tensorflow_probability/python/distributions/triangular.py", "identifier": "_broadcast_to", "docstring": "Helper to broadcast a tensor using a list of target tensors.", "docstring_tokens": ["Helper", "to", "broadcast", "a", "tensor", "using", "a", "list", "of", "target", "tensors", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256948}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L309-L337", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Convert number to string guaranteeing result is not in scientific notation.", "language": "python", "parameters": "(number)", "return_statement": "return mant", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "to_scientific_tuple", "(", "arg_0", ")", "if", "not", "arg_2", ":", "return", "str", "(", "arg_0", ")", "arg_3", "=", "\".\"", "in", "arg_1", "arg_1", "=", "arg_1", ".", "replace", "(", "\".\"", ",", "\"\"", ")", "if", "arg_2", "<", "0", ":", "return", "\"0.\"", "+", "\"0\"", "*", "(", "-", "arg_2", "-", "1", ")", "+", "arg_1", "if", "not", "arg_3", ":", "return", "arg_1", "+", "\"0\"", "*", "arg_2", "+", "(", "\".0\"", "if", "isinstance", "(", "arg_0", ",", "float", ")", "else", "\"\"", ")", "arg_4", "=", "len", "(", "arg_1", ")", "-", "1", "if", "arg_4", "<", "arg_2", ":", "return", "(", "arg_1", "+", "\"0\"", "*", "(", "arg_2", "-", "arg_4", ")", ")", ".", "rstrip", "(", "\".\"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    r\"\"\"\n    Convert number to string guaranteeing result is not in scientific notation.\n\n    :param number: Number to convert\n    :type  number: integer or float\n\n    :rtype: string\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for peng.functions.Func\n\n    :raises: RuntimeError (Argument \\`number\\` is not valid)\n\n    .. [[[end]]]\n    \"\"\"\n    arg_1, arg_2 = to_scientific_tuple(arg_0)\n    if not arg_2:\n        return str(arg_0)\n    arg_3 = \".\" in arg_1\n    arg_1 = arg_1.replace(\".\", \"\")\n    if arg_2 < 0:\n        return \"0.\" + \"0\" * (-arg_2 - 1) + arg_1\n    if not arg_3:\n        return arg_1 + \"0\" * arg_2 + (\".0\" if isinstance(arg_0, float) else \"\")\n    arg_4 = len(arg_1) - 1\n    if arg_4 < arg_2:\n        return (arg_1 + \"0\" * (arg_2 - arg_4)).rstrip(\".\")\n    return arg_1", "path": "peng/functions.py", "identifier": "no_exp", "docstring": "r\"\"\"\n    Convert number to string guaranteeing result is not in scientific notation.\n\n    :param number: Number to convert\n    :type  number: integer or float\n\n    :rtype: string\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for peng.functions.no_exp\n\n    :raises: RuntimeError (Argument \\`number\\` is not valid)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Convert", "number", "to", "string", "guaranteeing", "result", "is", "not", "in", "scientific", "notation", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 256949}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_abricate.py#L380-L407", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Tries to retrieve contig id. Returns the original string if it\n        is unable to retrieve the id.", "language": "python", "parameters": "(contig_str)", "return_statement": "return contig_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "try", ":", "arg_1", "=", "re", ".", "search", "(", "\".*NODE_([0-9]*)_.*\"", ",", "arg_0", ")", ".", "group", "(", "1", ")", "except", "AttributeError", ":", "pass", "try", ":", "arg_1", "=", "re", ".", "search", "(", "\".*Contig_([0-9]*)_.*\"", ",", "arg_0", ")", ".", "group", "(", "1", ")", "except", "AttributeError", ":", "pass", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Tries to retrieve contig id. Returns the original string if it\n        is unable to retrieve the id.\n\n        Parameters\n        ----------\n        contig_str : str\n            Full contig string (fasta header)\n\n        Returns\n        -------\n        str\n            Contig id\n        \"\"\"\n\n        arg_1 = arg_0\n\n        try:\n            arg_1 = re.search(\".*NODE_([0-9]*)_.*\", arg_0).group(1)\n        except AttributeError:\n            pass\n\n        try:\n            arg_1 = re.search(\".*Contig_([0-9]*)_.*\", arg_0).group(1)\n        except AttributeError:\n            pass\n\n        return arg_1", "path": "flowcraft/templates/process_abricate.py", "identifier": "AbricateReport._get_contig_id", "docstring": "Tries to retrieve contig id. Returns the original string if it\n        is unable to retrieve the id.\n\n        Parameters\n        ----------\n        contig_str : str\n            Full contig string (fasta header)\n\n        Returns\n        -------\n        str\n            Contig id", "docstring_tokens": ["Tries", "to", "retrieve", "contig", "id", ".", "Returns", "the", "original", "string", "if", "it", "is", "unable", "to", "retrieve", "the", "id", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 256950}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_manipulation.py#L7-L44", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Isolates a particular variant type from a VCF file using GATK SelectVariants", "language": "python", "parameters": "(job, mode, vcf_id, ref_fasta, ref_fai, ref_dict)", "return_statement": "return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'output.vcf'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_0", ".", "fileStore", ".", "logToMaster", "(", "'Running GATK SelectVariants to select %ss'", "%", "arg_1", ")", "arg_6", "=", "{", "'genome.fa'", ":", "arg_3", ",", "'genome.fa.fai'", ":", "arg_4", ",", "'genome.dict'", ":", "arg_5", ",", "'input.vcf'", ":", "arg_2", "}", "arg_7", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "for", "arg_8", ",", "arg_9", "in", "arg_6", ".", "iteritems", "(", ")", ":", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_9", ",", "os", ".", "path", ".", "join", "(", "arg_7", ",", "arg_8", ")", ")", "arg_10", "=", "[", "'-T'", ",", "'SelectVariants'", ",", "'-R'", ",", "'genome.fa'", ",", "'-V'", ",", "'input.vcf'", ",", "'-o'", ",", "'output.vcf'", ",", "'-selectType'", ",", "arg_1", "]", "arg_11", "=", "[", "'--rm'", ",", "'log-driver'", ",", "'none'", ",", "'-e'", ",", "'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'", ".", "format", "(", "arg_0", ".", "memory", ")", "]", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "workDir", "=", "arg_7", ",", "parameters", "=", "arg_10", ",", "tool", "=", "'quay.io/ucsc_cgl/gatk:3.5--dba6dae49156168a909c43330350c6161dc7ecc2'", ",", "dockerParameters", "=", "arg_11", ")", "return", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_7", ",", "'output.vcf'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"\n    Isolates a particular variant type from a VCF file using GATK SelectVariants\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str mode: variant type (i.e. SNP or INDEL)\n    :param str vcf_id: FileStoreID for input VCF file\n    :param str ref_fasta: FileStoreID for reference genome fasta\n    :param str ref_fai: FileStoreID for reference genome index file\n    :param str ref_dict: FileStoreID for reference genome sequence dictionary file\n    :return: FileStoreID for filtered VCF\n    :rtype: str\n    \"\"\"\n    arg_0.fileStore.logToMaster('Running GATK SelectVariants to select %ss' % arg_1)\n\n    arg_6 = {'genome.fa': arg_3,\n              'genome.fa.fai': arg_4,\n              'genome.dict': arg_5,\n              'input.vcf': arg_2}\n\n    arg_7 = arg_0.fileStore.getLocalTempDir()\n    for arg_8, arg_9 in arg_6.iteritems():\n        arg_0.fileStore.readGlobalFile(arg_9, os.path.join(arg_7, arg_8))\n\n    arg_10 = ['-T', 'SelectVariants',\n               '-R', 'genome.fa',\n               '-V', 'input.vcf',\n               '-o', 'output.vcf',\n               '-selectType', arg_1]\n\n    arg_11 = ['--rm', 'log-driver', 'none',\n                         '-e', 'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'.format(arg_0.memory)]\n    dockerCall(arg_0=arg_0, workDir=arg_7,\n               parameters=arg_10,\n               tool='quay.io/ucsc_cgl/gatk:3.5--dba6dae49156168a909c43330350c6161dc7ecc2',\n               dockerParameters=arg_11)\n\n    return arg_0.fileStore.writeGlobalFile(os.path.join(arg_7, 'output.vcf'))", "path": "src/toil_lib/tools/variant_manipulation.py", "identifier": "gatk_select_variants", "docstring": "Isolates a particular variant type from a VCF file using GATK SelectVariants\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str mode: variant type (i.e. SNP or INDEL)\n    :param str vcf_id: FileStoreID for input VCF file\n    :param str ref_fasta: FileStoreID for reference genome fasta\n    :param str ref_fai: FileStoreID for reference genome index file\n    :param str ref_dict: FileStoreID for reference genome sequence dictionary file\n    :return: FileStoreID for filtered VCF\n    :rtype: str", "docstring_tokens": ["Isolates", "a", "particular", "variant", "type", "from", "a", "VCF", "file", "using", "GATK", "SelectVariants"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 256951}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1262-L1279", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Convenience method to wait for value attribute of given element to\n        change.", "language": "python", "parameters": "(self, timeout=10)", "return_statement": "return self.waitFor(timeout, 'AXValueChanged', callback=callback,\n                            args=(retelem,))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "arg_2", "=", "AXCallbacks", ".", "returnElemCallback", "arg_3", "=", "None", "return", "arg_0", ".", "waitFor", "(", "arg_1", ",", "'AXValueChanged'", ",", "arg_2", "=", "arg_2", ",", "args", "=", "(", "arg_3", ",", ")", ")"], "function": "def Func(arg_0, arg_1=10):\n        \"\"\"Convenience method to wait for value attribute of given element to\n        change.\n\n        Some types of elements (e.g. menu items) have their titles change,\n        so this will not work for those.  This seems to work best if you set\n        the notification at the application level.\n\n        Returns: Element or None\n        \"\"\"\n        # Want to identify that the element whose value changes matches this\n        # object's.  Unique identifiers considered include role and position\n        # This seems to work best if you set the notification at the application\n        # level\n        arg_2 = AXCallbacks.returnElemCallback\n        arg_3 = None\n        return arg_0.waitFor(arg_1, 'AXValueChanged', arg_2=arg_2,\n                            args=(arg_3,))", "path": "atomac/AXClasses.py", "identifier": "NativeUIElement.waitForValueToChange", "docstring": "Convenience method to wait for value attribute of given element to\n        change.\n\n        Some types of elements (e.g. menu items) have their titles change,\n        so this will not work for those.  This seems to work best if you set\n        the notification at the application level.\n\n        Returns: Element or None", "docstring_tokens": ["Convenience", "method", "to", "wait", "for", "value", "attribute", "of", "given", "element", "to", "change", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 256952}
{"url": "https://github.com/Scifabric/pybossa-client/blob/998d7cb0207ff5030dc800f0c2577c5692316c2c/pbclient/__init__.py#L218-L233", "sha": "998d7cb0207ff5030dc800f0c2577c5692316c2c", "docstring_summary": "Return a list with matching project arguments.", "language": "python", "parameters": "(**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "try", ":", "arg_1", "=", "_pybossa_req", "(", "'get'", ",", "'project'", ",", "params", "=", "arg_0", ")", "if", "type", "(", "arg_1", ")", ".", "__name__", "==", "'list'", ":", "return", "[", "Project", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]", "else", ":", "return", "arg_1", "except", ":", "raise"], "function": "def Func(**arg_0):\n    \"\"\"Return a list with matching project arguments.\n\n    :param kwargs: PYBOSSA Project members\n    :rtype: list\n    :returns: A list of projects that match the kwargs\n\n    \"\"\"\n    try:\n        arg_1 = _pybossa_req('get', 'project', params=arg_0)\n        if type(arg_1).__name__ == 'list':\n            return [Project(arg_2) for arg_2 in arg_1]\n        else:\n            return arg_1\n    except:  # pragma: no cover\n        raise", "path": "pbclient/__init__.py", "identifier": "find_project", "docstring": "Return a list with matching project arguments.\n\n    :param kwargs: PYBOSSA Project members\n    :rtype: list\n    :returns: A list of projects that match the kwargs", "docstring_tokens": ["Return", "a", "list", "with", "matching", "project", "arguments", "."], "nwo": "Scifabric/pybossa-client", "score": 0.27831918678159157, "idx": 256953}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L223-L228", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Conference Mute helper", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/ConferenceMute/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Conference Mute helper\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/ConferenceMute/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.conference_mute", "docstring": "REST Conference Mute helper", "docstring_tokens": ["REST", "Conference", "Mute", "helper"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 256954}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/cassandra_hook.py#L164-L177", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks if a table exists in Cassandra", "language": "python", "parameters": "(self, table)", "return_statement": "return (keyspace in cluster_metadata.keyspaces and\n                table in cluster_metadata.keyspaces[keyspace].tables)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "keyspace", "if", "'.'", "in", "arg_1", ":", "arg_2", ",", "arg_1", "=", "arg_1", ".", "split", "(", "'.'", ",", "1", ")", "arg_3", "=", "arg_0", ".", "get_conn", "(", ")", ".", "cluster", ".", "metadata", "return", "(", "arg_2", "in", "arg_3", ".", "keyspaces", "and", "arg_1", "in", "arg_3", ".", "keyspaces", "[", "arg_2", "]", ".", "tables", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Checks if a table exists in Cassandra\n\n        :param table: Target Cassandra table.\n                      Use dot notation to target a specific keyspace.\n        :type table: str\n        \"\"\"\n        arg_2 = arg_0.keyspace\n        if '.' in arg_1:\n            arg_2, arg_1 = arg_1.split('.', 1)\n        arg_3 = arg_0.get_conn().cluster.metadata\n        return (arg_2 in arg_3.keyspaces and\n                arg_1 in arg_3.keyspaces[arg_2].tables)", "path": "airflow/contrib/hooks/cassandra_hook.py", "identifier": "CassandraHook.table_exists", "docstring": "Checks if a table exists in Cassandra\n\n        :param table: Target Cassandra table.\n                      Use dot notation to target a specific keyspace.\n        :type table: str", "docstring_tokens": ["Checks", "if", "a", "table", "exists", "in", "Cassandra"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 256955}
{"url": "https://github.com/memsql/memsql-python/blob/aac223a1b937d5b348b42af3c601a6c685ca633a/memsql/common/sql_utility.py#L34-L39", "sha": "aac223a1b937d5b348b42af3c601a6c685ca633a", "docstring_summary": "Destroy the SQLStepQueue tables in the database", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "_db_conn", "(", ")", "as", "conn", ":", "for", "arg_1", "in", "arg_0", ".", "_tables", ":", "conn", ".", "execute", "(", "'DROP TABLE IF EXISTS %s'", "%", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\" Destroy the SQLStepQueue tables in the database \"\"\"\n        with arg_0._db_conn() as conn:\n            for arg_1 in arg_0._tables:\n                conn.execute('DROP TABLE IF EXISTS %s' % arg_1)\n        return arg_0", "path": "memsql/common/sql_utility.py", "identifier": "SQLUtility.destroy", "docstring": "Destroy the SQLStepQueue tables in the database", "docstring_tokens": ["Destroy", "the", "SQLStepQueue", "tables", "in", "the", "database"], "nwo": "memsql/memsql-python", "score": 0.6220444802454773, "idx": 256956}
{"url": "https://github.com/codeghar/brokerlso/blob/e110e12502b090e12b06c7615dd0a96a14a92585/brokerlso/qmfv2.py#L157-L166", "sha": "e110e12502b090e12b06c7615dd0a96a14a92585", "docstring_summary": "Create message content and properties to list all queues with QMFv2", "language": "python", "parameters": "(self)", "return_statement": "return content, self.query_properties", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"_what\"", ":", "\"OBJECT\"", ",", "\"_schema_id\"", ":", "{", "\"_class_name\"", ":", "\"queue\"", "}", "}", "logger", ".", "debug", "(", "\"Message content -> {0}\"", ".", "format", "(", "arg_1", ")", ")", "return", "arg_1", ",", "arg_0", ".", "query_properties"], "function": "def Func(arg_0):\n        \"\"\"Create message content and properties to list all queues with QMFv2\n\n        :returns: Tuple containing content and query properties\n        \"\"\"\n        arg_1 = {\"_what\": \"OBJECT\",\n                   \"_schema_id\": {\"_class_name\": \"queue\"}}\n        logger.debug(\"Message content -> {0}\".format(arg_1))\n\n        return arg_1, arg_0.query_properties", "path": "brokerlso/qmfv2.py", "identifier": "RequestCmd.list_queues", "docstring": "Create message content and properties to list all queues with QMFv2\n\n        :returns: Tuple containing content and query properties", "docstring_tokens": ["Create", "message", "content", "and", "properties", "to", "list", "all", "queues", "with", "QMFv2"], "nwo": "codeghar/brokerlso", "score": 0.08529914490135834, "idx": 256957}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/mod/communicator.py#L189-L220", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Synchronize local po files with translations on GDocs Spreadsheet.\n        Downloads two csv files, merges them and converts into po files\n        structure. If new msgids appeared in po files, this method creates\n        new ods with appended content and sends it to GDocs.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "temp_path", ",", "GDOCS_TRANS_CSV", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "temp_path", ",", "GDOCS_META_CSV", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "temp_path", ",", "LOCAL_TRANS_CSV", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "temp_path", ",", "LOCAL_META_CSV", ")", "try", ":", "arg_5", "=", "arg_0", ".", "_download_csv_from_gdocs", "(", "arg_1", ",", "arg_2", ")", "except", "PODocsError", "as", "e", ":", "if", "'Sheet 1 not found'", "in", "str", "(", "e", ")", "or", "'Conversion failed unexpectedly'", "in", "str", "(", "e", ")", ":", "arg_0", ".", "upload", "(", ")", "else", ":", "raise", "PODocsError", "(", "e", ")", "else", ":", "arg_0", ".", "_merge_local_and_gdoc", "(", "arg_5", ",", "arg_3", ",", "arg_4", ",", "arg_1", ",", "arg_2", ")", "try", ":", "csv_to_po", "(", "arg_3", ",", "arg_4", ",", "arg_0", ".", "locale_root", ",", "arg_0", ".", "po_files_path", ",", "arg_0", ".", "header", ")", "except", "IOError", "as", "e", ":", "raise", "PODocsError", "(", "e", ")", "arg_0", ".", "_clear_temp", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Synchronize local po files with translations on GDocs Spreadsheet.\n        Downloads two csv files, merges them and converts into po files\n        structure. If new msgids appeared in po files, this method creates\n        new ods with appended content and sends it to GDocs.\n        \"\"\"\n        arg_1 = os.path.join(arg_0.temp_path, GDOCS_TRANS_CSV)\n        arg_2 = os.path.join(arg_0.temp_path, GDOCS_META_CSV)\n        arg_3 = os.path.join(arg_0.temp_path, LOCAL_TRANS_CSV)\n        arg_4 = os.path.join(arg_0.temp_path, LOCAL_META_CSV)\n\n        try:\n            arg_5 = arg_0._download_csv_from_gdocs(arg_1,\n                                                  arg_2)\n        except PODocsError as e:\n            if 'Sheet 1 not found' in str(e) \\\n                    or 'Conversion failed unexpectedly' in str(e):\n                arg_0.upload()\n            else:\n                raise PODocsError(e)\n        else:\n            arg_0._merge_local_and_gdoc(arg_5, arg_3, arg_4,\n                                       arg_1, arg_2)\n\n            try:\n                csv_to_po(arg_3, arg_4,\n                          arg_0.locale_root, arg_0.po_files_path, arg_0.header)\n            except IOError as e:\n                raise PODocsError(e)\n\n        arg_0._clear_temp()", "path": "c3po/mod/communicator.py", "identifier": "Communicator.synchronize", "docstring": "Synchronize local po files with translations on GDocs Spreadsheet.\n        Downloads two csv files, merges them and converts into po files\n        structure. If new msgids appeared in po files, this method creates\n        new ods with appended content and sends it to GDocs.", "docstring_tokens": ["Synchronize", "local", "po", "files", "with", "translations", "on", "GDocs", "Spreadsheet", ".", "Downloads", "two", "csv", "files", "merges", "them", "and", "converts", "into", "po", "files", "structure", ".", "If", "new", "msgids", "appeared", "in", "po", "files", "this", "method", "creates", "new", "ods", "with", "appended", "content", "and", "sends", "it", "to", "GDocs", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 256958}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L162-L189", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Configure the Python logging module for this file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "logging", ".", "FileHandler", "(", "arg_0", ".", "path", ",", "delay", "=", "True", ")", "if", "arg_0", ".", "_format", ":", "arg_1", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "arg_0", ".", "_format", ")", ")", "if", "type", "(", "arg_0", ".", "_formatter", ")", "==", "str", ":", "if", "arg_0", ".", "_env", "and", "arg_0", ".", "_env", ".", "config", ".", "logging", ".", "dict_config", ".", "formatters", "[", "arg_0", ".", "_formatter", "]", ":", "arg_2", "=", "arg_0", ".", "_env", ".", "config", ".", "logging", ".", "dict_config", ".", "formatters", "[", "arg_0", ".", "_formatter", "]", ".", "to_dict", "(", ")", "arg_1", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "**", "arg_2", ")", ")", "elif", "type", "(", "arg_0", ".", "_formatter", ")", "==", "dict", ":", "arg_1", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "**", "arg_0", ".", "_formatter", ")", ")", "if", "len", "(", "arg_0", ".", "_loggers", ")", ":", "for", "arg_3", "in", "arg_0", ".", "_loggers", ":", "logging", ".", "getLogger", "(", "arg_3", ")", ".", "addHandler", "(", "arg_1", ")", "else", ":", "logging", ".", "getLogger", "(", ")", ".", "addHandler", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Configure the Python logging module for this file.\n        \"\"\"\n        # build a file handler for this file\n        arg_1 = logging.FileHandler(arg_0.path, delay=True)\n\n        # if we got a format string, create a formatter with it\n        if arg_0._format:\n            arg_1.setFormatter(logging.Formatter(arg_0._format))\n\n        # if we got a string for the formatter, assume it's the name of a\n        # formatter in the environment's config\n        if type(arg_0._formatter) == str:\n            if arg_0._env and arg_0._env.config.logging.dict_config.formatters[arg_0._formatter]:\n                arg_2 = arg_0._env.config.logging.dict_config.formatters[arg_0._formatter].to_dict()\n                arg_1.setFormatter(logging.Formatter(**arg_2))\n        elif type(arg_0._formatter) == dict:\n            # if it's a dict it must be the actual formatter params\n            arg_1.setFormatter(logging.Formatter(**arg_0._formatter))\n\n        # add the file handler to whatever loggers were specified\n        if len(arg_0._loggers):\n            for arg_3 in arg_0._loggers:\n                logging.getLogger(arg_3).addHandler(arg_1)\n        else:\n            # none specified, just add it to the root logger\n            logging.getLogger().addHandler(arg_1)", "path": "scruffy/file.py", "identifier": "LogFile.configure", "docstring": "Configure the Python logging module for this file.", "docstring_tokens": ["Configure", "the", "Python", "logging", "module", "for", "this", "file", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 256959}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/graph.py#L406-L419", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Draw the Y axis labels", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "show_y_labels", ":", "return", "arg_1", "=", "arg_0", ".", "get_y_labels", "(", ")", "arg_2", "=", "len", "(", "arg_1", ")", "arg_1", "=", "enumerate", "(", "iter", "(", "arg_1", ")", ")", "arg_3", "=", "int", "(", "not", "arg_0", ".", "step_include_first_y_label", ")", "arg_1", "=", "itertools", ".", "islice", "(", "arg_1", ",", "arg_3", ",", "None", ",", "arg_0", ".", "step_y_labels", ")", "list", "(", "map", "(", "arg_0", ".", "draw_y_label", ",", "arg_1", ")", ")", "arg_0", ".", "draw_y_guidelines", "(", "arg_0", ".", "field_height", "(", ")", ",", "arg_2", ")"], "function": "def Func(arg_0):\n\t\t\"Draw the Y axis labels\"\n\t\tif not arg_0.show_y_labels:\n\t\t\t# do nothing\n\t\t\treturn\n\n\t\targ_1 = arg_0.get_y_labels()\n\t\targ_2 = len(arg_1)\n\n\t\targ_1 = enumerate(iter(arg_1))\n\t\targ_3 = int(not arg_0.step_include_first_y_label)\n\t\targ_1 = itertools.islice(arg_1, arg_3, None, arg_0.step_y_labels)\n\t\tlist(map(arg_0.draw_y_label, arg_1))\n\t\targ_0.draw_y_guidelines(arg_0.field_height(), arg_2)", "path": "svg/charts/graph.py", "identifier": "Graph.draw_y_labels", "docstring": "Draw the Y axis labels", "docstring_tokens": ["Draw", "the", "Y", "axis", "labels"], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 256960}
{"url": "https://github.com/dhhagan/py-opc/blob/2c8f19530fb64bf5fd4ee0d694a47850161ed8a7/opc/__init__.py#L658-L686", "sha": "2c8f19530fb64bf5fd4ee0d694a47850161ed8a7", "docstring_summary": "Set only the Fan power.", "language": "python", "parameters": "(self, power)", "return_statement": "return True if a == 0xF3 and b == 0x42 and c == 0x00 else False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ">", "255", ":", "raise", "ValueError", "(", "\"The fan power should be a single byte (0-255).\"", ")", "arg_2", "=", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x42", "]", ")", "[", "0", "]", "sleep", "(", "10e-3", ")", "arg_3", "=", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x00", "]", ")", "[", "0", "]", "arg_4", "=", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "arg_1", "]", ")", "[", "0", "]", "sleep", "(", "0.1", ")", "return", "True", "if", "arg_2", "==", "0xF3", "and", "arg_3", "==", "0x42", "and", "arg_4", "==", "0x00", "else", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set only the Fan power.\n\n        :param power: Fan power value as an integer between 0-255.\n\n        :type power: int\n\n        :rtype: boolean\n\n        :Example:\n\n        >>> alpha.Func(255)\n        True\n        \"\"\"\n        # Check to make sure the value is a single byte\n        if arg_1 > 255:\n            raise ValueError(\"The fan power should be a single byte (0-255).\")\n\n        # Send the command byte and wait 10 ms\n        arg_2 = arg_0.cnxn.xfer([0x42])[0]\n        sleep(10e-3)\n\n        # Send the next two bytes\n        arg_3 = arg_0.cnxn.xfer([0x00])[0]\n        arg_4 = arg_0.cnxn.xfer([arg_1])[0]\n\n        sleep(0.1)\n\n        return True if arg_2 == 0xF3 and arg_3 == 0x42 and arg_4 == 0x00 else False", "path": "opc/__init__.py", "identifier": "OPCN2.set_fan_power", "docstring": "Set only the Fan power.\n\n        :param power: Fan power value as an integer between 0-255.\n\n        :type power: int\n\n        :rtype: boolean\n\n        :Example:\n\n        >>> alpha.set_fan_power(255)\n        True", "docstring_tokens": ["Set", "only", "the", "Fan", "power", "."], "nwo": "dhhagan/py-opc", "score": 0.2904380171157967, "idx": 256961}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/add.py#L72-L102", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Add file to the patch with patch_name.\n        If patch_name is None or empty the topmost patch will be used.\n        Adding an already added patch will raise an QuiltError if ignore is\n        False.", "language": "python", "parameters": "(self, filename, patch_name=None, ignore=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "File", "(", "arg_1", ")", "if", "arg_2", ":", "arg_5", "=", "Patch", "(", "arg_2", ")", "else", ":", "arg_5", "=", "arg_0", ".", "db", ".", "top_patch", "(", ")", "if", "not", "arg_5", ":", "raise", "NoAppliedPatch", "(", "arg_0", ".", "db", ")", "arg_6", "=", "arg_0", ".", "_file_in_patch", "(", "arg_1", ",", "arg_5", ",", "arg_3", ")", "if", "arg_6", ":", "return", "arg_0", ".", "_file_in_next_patches", "(", "arg_1", ",", "arg_5", ")", "if", "arg_4", ".", "is_link", "(", ")", ":", "raise", "QuiltError", "(", "\"Cannot add symbolic link %s\"", "%", "arg_1", ")", "arg_0", ".", "_backup_file", "(", "arg_4", ",", "arg_5", ")", "if", "arg_4", ".", "exists", "(", ")", ":", "os", ".", "chmod", "(", "arg_1", ",", "arg_4", ".", "get_mode", "(", ")", "|", "stat", ".", "S_IWUSR", "|", "stat", ".", "S_IRUSR", ")", "arg_0", ".", "file_added", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        \"\"\" Add file to the patch with patch_name.\n        If patch_name is None or empty the topmost patch will be used.\n        Adding an already added patch will raise an QuiltError if ignore is\n        False.\n        \"\"\"\n        arg_4 = File(arg_1)\n\n        if arg_2:\n            arg_5 = Patch(arg_2)\n        else:\n            arg_5 = arg_0.db.top_patch()\n            if not arg_5:\n                raise NoAppliedPatch(arg_0.db)\n\n        arg_6 = arg_0._file_in_patch(arg_1, arg_5, arg_3)\n        if arg_6:\n            return\n\n        arg_0._file_in_next_patches(arg_1, arg_5)\n\n        if arg_4.is_link():\n            raise QuiltError(\"Cannot add symbolic link %s\" % arg_1)\n\n        arg_0._backup_file(arg_4, arg_5)\n\n        if arg_4.exists():\n            # be sure user can write original file\n            os.chmod(arg_1, arg_4.get_mode() | stat.S_IWUSR | stat.S_IRUSR)\n\n        arg_0.file_added(arg_4, arg_5)", "path": "quilt/add.py", "identifier": "Add.add_file", "docstring": "Add file to the patch with patch_name.\n        If patch_name is None or empty the topmost patch will be used.\n        Adding an already added patch will raise an QuiltError if ignore is\n        False.", "docstring_tokens": ["Add", "file", "to", "the", "patch", "with", "patch_name", ".", "If", "patch_name", "is", "None", "or", "empty", "the", "topmost", "patch", "will", "be", "used", ".", "Adding", "an", "already", "added", "patch", "will", "raise", "an", "QuiltError", "if", "ignore", "is", "False", "."], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 256962}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L64-L80", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Instantiate a GTFS object by computing", "language": "python", "parameters": "(cls, gtfs_directory)", "return_statement": "return cls(conn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "gtfspy", ".", "import_gtfs", "import", "import_gtfs", "arg_2", "=", "sqlite3", ".", "connect", "(", "\":memory:\"", ")", "import_gtfs", "(", "arg_1", ",", "arg_2", ",", "preserve_connection", "=", "True", ",", "print_progress", "=", "False", ")", "return", "arg_0", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Instantiate a GTFS object by computing\n\n        Parameters\n        ----------\n        gtfs_directory: str\n            path to the directory for importing the database\n        \"\"\"\n        # this import is here to avoid circular imports (which turned out to be a problem)\n        from gtfspy.import_gtfs import import_gtfs\n        arg_2 = sqlite3.connect(\":memory:\")\n        import_gtfs(arg_1,\n                    arg_2,\n                    preserve_connection=True,\n                    print_progress=False)\n        return arg_0(arg_2)", "path": "gtfspy/gtfs.py", "identifier": "GTFS.from_directory_as_inmemory_db", "docstring": "Instantiate a GTFS object by computing\n\n        Parameters\n        ----------\n        gtfs_directory: str\n            path to the directory for importing the database", "docstring_tokens": ["Instantiate", "a", "GTFS", "object", "by", "computing"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 256963}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/dictlist.py#L52-L54", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "rebuild the _dict index", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_dict", "=", "{", "v", ".", "id", ":", "k", "for", "k", ",", "v", "in", "enumerate", "(", "arg_0", ")", "}"], "function": "def Func(arg_0):\n        \"\"\"rebuild the _dict index\"\"\"\n        arg_0._dict = {v.id: k for k, v in enumerate(arg_0)}", "path": "cobra/core/dictlist.py", "identifier": "DictList._generate_index", "docstring": "rebuild the _dict index", "docstring_tokens": ["rebuild", "the", "_dict", "index"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 256964}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/beziereditor/__init__.py#L245-L316", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Inserts a point on the path at the mouse location.\n        \n        We first need to check if the mouse location is on the path.\n        Inserting point is time intensive and experimental.", "language": "python", "parameters": "(self, x, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "_ctx", ".", "ximport", "(", "\"bezier\"", ")", "except", ":", "from", "nodebox", ".", "graphics", "import", "arg_3", "arg_4", "=", "100", "arg_5", "=", "None", "arg_6", "=", "float", "(", "\"inf\"", ")", "arg_7", "=", "float", "(", "\"inf\"", ")", "for", "arg_8", "in", "range", "(", "arg_4", ")", ":", "arg_9", "=", "float", "(", "arg_8", ")", "/", "arg_4", "arg_10", "=", "arg_0", ".", "path", ".", "point", "(", "arg_9", ")", "arg_11", "=", "abs", "(", "arg_10", ".", "x", "-", "arg_1", ")", "arg_12", "=", "abs", "(", "arg_10", ".", "y", "-", "arg_2", ")", "if", "arg_11", "+", "arg_12", "<=", "arg_6", "+", "arg_7", ":", "arg_6", "=", "arg_11", "arg_7", "=", "arg_12", "arg_5", "=", "arg_9", "arg_13", "=", "[", "3", ",", "4", "]", "for", "arg_14", "in", "arg_13", ":", "arg_14", "=", "1.0", "/", "pow", "(", "10", ",", "arg_14", ")", "for", "arg_8", "in", "range", "(", "20", ")", ":", "arg_9", "=", "arg_5", "-", "arg_14", "+", "float", "(", "arg_8", ")", "*", "arg_14", "*", "0.1", "if", "arg_9", "<", "0.0", ":", "arg_9", "=", "1.0", "+", "arg_9", "if", "arg_9", ">", "1.0", ":", "arg_9", "=", "arg_9", "-", "1.0", "arg_10", "=", "arg_0", ".", "path", ".", "point", "(", "arg_9", ")", "arg_11", "=", "abs", "(", "arg_10", ".", "x", "-", "arg_1", ")", "arg_12", "=", "abs", "(", "arg_10", ".", "y", "-", "arg_2", ")", "if", "arg_11", "<=", "arg_6", "and", "arg_12", "<=", "arg_7", ":", "arg_6", "=", "arg_11", "arg_7", "=", "arg_12", "arg_15", "=", "arg_9", "arg_5", "=", "arg_15", "arg_16", "=", "arg_3", ".", "Func", "(", "arg_0", ".", "path", ",", "arg_15", ")", "arg_8", ",", "arg_9", ",", "arg_10", "=", "arg_3", ".", "_locate", "(", "arg_0", ".", "path", ",", "arg_15", ")", "arg_8", "+=", "1", "arg_10", "=", "PathElement", "(", ")", "arg_10", ".", "cmd", "=", "arg_16", "[", "arg_8", "]", ".", "cmd", "arg_10", ".", "x", "=", "arg_16", "[", "arg_8", "]", ".", "x", "arg_10", ".", "y", "=", "arg_16", "[", "arg_8", "]", ".", "y", "arg_10", ".", "ctrl1", "=", "Point", "(", "arg_16", "[", "arg_8", "]", ".", "ctrl1", ".", "x", ",", "arg_16", "[", "arg_8", "]", ".", "ctrl1", ".", "y", ")", "arg_10", ".", "ctrl2", "=", "Point", "(", "arg_16", "[", "arg_8", "]", ".", "ctrl2", ".", "x", ",", "arg_16", "[", "arg_8", "]", ".", "ctrl2", ".", "y", ")", "arg_10", ".", "freehand", "=", "False", "arg_0", ".", "_points", ".", "insert", "(", "arg_8", ",", "arg_10", ")", "arg_0", ".", "_points", "[", "arg_8", "-", "1", "]", ".", "ctrl1", "=", "Point", "(", "arg_16", "[", "arg_8", "-", "1", "]", ".", "ctrl1", ".", "x", ",", "arg_16", "[", "arg_8", "-", "1", "]", ".", "ctrl1", ".", "y", ")", "arg_0", ".", "_points", "[", "arg_8", "+", "1", "]", ".", "ctrl1", "=", "Point", "(", "arg_16", "[", "arg_8", "+", "1", "]", ".", "ctrl1", ".", "x", ",", "arg_16", "[", "arg_8", "+", "1", "]", ".", "ctrl1", ".", "y", ")", "arg_0", ".", "_points", "[", "arg_8", "+", "1", "]", ".", "ctrl2", "=", "Point", "(", "arg_16", "[", "arg_8", "+", "1", "]", ".", "ctrl2", ".", "x", ",", "arg_16", "[", "arg_8", "+", "1", "]", ".", "ctrl2", ".", "y", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \n        \"\"\" Inserts a point on the path at the mouse location.\n        \n        We first need to check if the mouse location is on the path.\n        Inserting point is time intensive and experimental.\n        \n        \"\"\"\n        \n        try: \n            arg_3 = _ctx.ximport(\"bezier\")\n        except:\n            from nodebox.graphics import arg_3\n        \n        # Do a number of checks distributed along the path.\n        # Keep the one closest to the actual mouse location.\n        # Ten checks works fast but leads to imprecision in sharp corners\n        # and curves closely located next to each other.\n        # I prefer the slower but more stable approach.\n        arg_4 = 100\n        arg_5 = None\n        arg_6 = float(\"inf\") \n        arg_7 = float(\"inf\")\n        for arg_8 in range(arg_4):\n            arg_9 = float(arg_8)/arg_4\n            arg_10 = arg_0.path.point(arg_9)\n            arg_11 = abs(arg_10.x-arg_1)\n            arg_12 = abs(arg_10.y-arg_2)\n            if arg_11+arg_12 <= arg_6+arg_7:\n                arg_6 = arg_11\n                arg_7 = arg_12\n                arg_5 = arg_9\n\n        # Next, scan the area around the approximation.\n        # If the closest point is located at 0.2 on the path,\n        # we need to scan between 0.1 and 0.3 for a better\n        # approximation. If 1.5 was the best guess, scan\n        # 1.40, 1.41 ... 1.59 and so on.\n        # Each decimal precision takes 20 iterations.                \n        arg_13 = [3,4]\n        for arg_14 in arg_13:\n            arg_14 = 1.0/pow(10,arg_14)\n            \n            for arg_8 in range(20):\n                arg_9 = arg_5-arg_14 + float(arg_8)*arg_14*0.1\n                if arg_9 < 0.0: arg_9 = 1.0+arg_9\n                if arg_9 > 1.0: arg_9 = arg_9-1.0\n                arg_10 = arg_0.path.point(arg_9)\n                arg_11 = abs(arg_10.x-arg_1)\n                arg_12 = abs(arg_10.y-arg_2)\n                if arg_11 <= arg_6 and arg_12 <= arg_7:\n                    arg_6 = arg_11\n                    arg_7 = arg_12\n                    arg_15 = arg_9\n            \n            arg_5 = arg_15   \n\n        # Update the points list with the inserted point.\n        arg_16 = arg_3.Func(arg_0.path, arg_15)\n        arg_8, arg_9, arg_10 = arg_3._locate(arg_0.path, arg_15)\n        arg_8 += 1\n        arg_10 = PathElement()\n        arg_10.cmd = arg_16[arg_8].cmd\n        arg_10.x = arg_16[arg_8].x\n        arg_10.y = arg_16[arg_8].y\n        arg_10.ctrl1 = Point(arg_16[arg_8].ctrl1.x, arg_16[arg_8].ctrl1.y)\n        arg_10.ctrl2 = Point(arg_16[arg_8].ctrl2.x, arg_16[arg_8].ctrl2.y)\n        arg_10.freehand = False\n        arg_0._points.insert(arg_8, arg_10)\n        arg_0._points[arg_8-1].ctrl1 = Point(arg_16[arg_8-1].ctrl1.x, arg_16[arg_8-1].ctrl1.y)\n        arg_0._points[arg_8+1].ctrl1 = Point(arg_16[arg_8+1].ctrl1.x, arg_16[arg_8+1].ctrl1.y)\n        arg_0._points[arg_8+1].ctrl2 = Point(arg_16[arg_8+1].ctrl2.x, arg_16[arg_8+1].ctrl2.y)", "path": "lib/beziereditor/__init__.py", "identifier": "BezierPathEditor.insert_point", "docstring": "Inserts a point on the path at the mouse location.\n        \n        We first need to check if the mouse location is on the path.\n        Inserting point is time intensive and experimental.", "docstring_tokens": ["Inserts", "a", "point", "on", "the", "path", "at", "the", "mouse", "location", ".", "We", "first", "need", "to", "check", "if", "the", "mouse", "location", "is", "on", "the", "path", ".", "Inserting", "point", "is", "time", "intensive", "and", "experimental", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256965}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/serializers.py#L694-L707", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Validate that at least one of the user identifier fields has been passed in.", "language": "python", "parameters": "(self, data)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'lms_user_id'", ")", "arg_3", "=", "arg_1", ".", "get", "(", "'tpa_user_id'", ")", "arg_4", "=", "arg_1", ".", "get", "(", "'user_email'", ")", "if", "not", "arg_2", "and", "not", "arg_3", "and", "not", "arg_4", ":", "raise", "serializers", ".", "ValidationError", "(", "'At least one of the following fields must be specified and map to an EnterpriseCustomerUser: '", "'lms_user_id, tpa_user_id, user_email'", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):  # pylint: disable=arguments-differ\n        \"\"\"\n        Validate that at least one of the user identifier fields has been passed in.\n        \"\"\"\n        arg_2 = arg_1.get('lms_user_id')\n        arg_3 = arg_1.get('tpa_user_id')\n        arg_4 = arg_1.get('user_email')\n        if not arg_2 and not arg_3 and not arg_4:\n            raise serializers.ValidationError(\n                'At least one of the following fields must be specified and map to an EnterpriseCustomerUser: '\n                'lms_user_id, tpa_user_id, user_email'\n            )\n\n        return arg_1", "path": "enterprise/api/v1/serializers.py", "identifier": "EnterpriseCustomerCourseEnrollmentsSerializer.validate", "docstring": "Validate that at least one of the user identifier fields has been passed in.", "docstring_tokens": ["Validate", "that", "at", "least", "one", "of", "the", "user", "identifier", "fields", "has", "been", "passed", "in", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 256966}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/legend.py#L452-L464", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Generate a default timescale legend. No arguments.", "language": "python", "parameters": "(cls, name)", "return_statement": "return cls.from_csv(text=names[name.lower()])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'isc'", ":", "TIMESCALE__ISC", ",", "'usgs_isc'", ":", "TIMESCALE__USGS_ISC", ",", "'dnag'", ":", "TIMESCALE__DNAG", ",", "}", "return", "arg_0", ".", "from_csv", "(", "text", "=", "arg_2", "[", "arg_1", ".", "lower", "(", ")", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Generate a default timescale legend. No arguments.\n\n        Returns:\n            Legend: The timescale stored in `defaults.py`.\n        \"\"\"\n        arg_2 = {\n                 'isc': TIMESCALE__ISC,\n                 'usgs_isc': TIMESCALE__USGS_ISC,\n                 'dnag': TIMESCALE__DNAG,\n                 }\n        return arg_0.from_csv(text=arg_2[arg_1.lower()])", "path": "striplog/legend.py", "identifier": "Legend.builtin_timescale", "docstring": "Generate a default timescale legend. No arguments.\n\n        Returns:\n            Legend: The timescale stored in `defaults.py`.", "docstring_tokens": ["Generate", "a", "default", "timescale", "legend", ".", "No", "arguments", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 256967}
{"url": "https://github.com/SmBe19/praw-OAuth2Util/blob/ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe/OAuth2Util/OAuth2Util.py#L177-L194", "sha": "ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe", "docstring_summary": "Helper method to get a value from the config", "language": "python", "parameters": "(self, key, func=None, split_val=None, as_boolean=False,\n\t\texception_default=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "try", ":", "if", "arg_4", ":", "return", "arg_0", ".", "config", ".", "getboolean", "(", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", "]", ")", "arg_6", "=", "arg_0", ".", "config", ".", "get", "(", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", "]", ")", "if", "arg_3", "is", "not", "None", ":", "arg_6", "=", "arg_6", ".", "split", "(", "arg_3", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_2", "(", "arg_6", ")", "return", "arg_6", "except", "(", "KeyError", ",", "configparser", ".", "NoSectionError", ",", "configparser", ".", "NoOptionError", ")", "as", "e", ":", "if", "arg_5", "is", "not", "None", ":", "return", "arg_5", "raise", "KeyError", "(", "e", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False,\n\t\targ_5=None):\n\t\t\"\"\"\n\t\tHelper method to get a value from the config\n\t\t\"\"\"\n\t\ttry:\n\t\t\tif arg_4:\n\t\t\t\treturn arg_0.config.getboolean(arg_1[0], arg_1[1])\n\t\t\targ_6 = arg_0.config.get(arg_1[0], arg_1[1])\n\t\t\tif arg_3 is not None:\n\t\t\t\targ_6 = arg_6.split(arg_3)\n\t\t\tif arg_2 is not None:\n\t\t\t\treturn arg_2(arg_6)\n\t\t\treturn arg_6\n\t\texcept (KeyError, configparser.NoSectionError, configparser.NoOptionError) as e:\n\t\t\tif arg_5 is not None:\n\t\t\t\treturn arg_5\n\t\t\traise KeyError(e)", "path": "OAuth2Util/OAuth2Util.py", "identifier": "OAuth2Util._get_value", "docstring": "Helper method to get a value from the config", "docstring_tokens": ["Helper", "method", "to", "get", "a", "value", "from", "the", "config"], "nwo": "SmBe19/praw-OAuth2Util", "score": 0.28581547167654664, "idx": 256968}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3868-L3918", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Serial call to set LCD using meter object bufer.", "language": "python", "parameters": "(self, password=\"00000000\")", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"00000000\"", ")", ":", "arg_2", "=", "False", "arg_0", ".", "setContext", "(", "\"Func\"", ")", "try", ":", "arg_0", ".", "clearCmdMsg", "(", ")", "if", "len", "(", "arg_1", ")", "!=", "8", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Invalid password length.\"", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "arg_2", "if", "not", "arg_0", ".", "request", "(", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Bad read CRC on setting\"", ")", "else", ":", "if", "not", "arg_0", ".", "serialCmdPwdAuth", "(", "arg_1", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Password failure\"", ")", "else", ":", "arg_3", "=", "\"\"", "arg_4", "=", "40", "-", "len", "(", "arg_0", ".", "m_lcd_items", ")", "for", "arg_5", "in", "arg_0", ".", "m_lcd_items", ":", "arg_6", "=", "binascii", ".", "hexlify", "(", "str", "(", "arg_5", ")", ".", "zfill", "(", "2", ")", ")", "arg_3", "+=", "arg_6", "for", "arg_7", "in", "range", "(", "0", ",", "arg_4", ")", ":", "arg_6", "=", "binascii", ".", "hexlify", "(", "str", "(", "0", ")", ".", "zfill", "(", "2", ")", ")", "arg_3", "+=", "arg_6", "arg_8", "=", "\"015731023030443228\"", "+", "arg_3", "+", "\"2903\"", "arg_8", "+=", "arg_0", ".", "calc_crc16", "(", "arg_8", "[", "2", ":", "]", ".", "decode", "(", "\"hex\"", ")", ")", "arg_0", ".", "m_serial_port", ".", "write", "(", "arg_8", ".", "decode", "(", "\"hex\"", ")", ")", "if", "arg_0", ".", "m_serial_port", ".", "getResponse", "(", "arg_0", ".", "getContext", "(", ")", ")", ".", "encode", "(", "\"hex\"", ")", "==", "\"06\"", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Success: 06 returned.\"", ")", "arg_2", "=", "True", "arg_0", ".", "serialPostEnd", "(", ")", "except", ":", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ".", "exc_info", "(", ")", ")", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=\"00000000\"):\n        \"\"\" Serial call to set LCD using meter object bufer.\n\n        Used with :func:`~ekmmeters.V4Meter.addLcdItem`.\n\n        Args:\n            password (str): Optional password\n\n        Returns:\n            bool: True on completion and ACK.\n        \"\"\"\n        arg_2 = False\n        arg_0.setContext(\"Func\")\n        try:\n            arg_0.clearCmdMsg()\n\n            if len(arg_1) != 8:\n                arg_0.writeCmdMsg(\"Invalid password length.\")\n                arg_0.setContext(\"\")\n                return arg_2\n\n            if not arg_0.request():\n                arg_0.writeCmdMsg(\"Bad read CRC on setting\")\n            else:\n                if not arg_0.serialCmdPwdAuth(arg_1):\n                    arg_0.writeCmdMsg(\"Password failure\")\n                else:\n                    arg_3 = \"\"\n\n                    arg_4 = 40 - len(arg_0.m_lcd_items)\n\n                    for arg_5 in arg_0.m_lcd_items:\n                        arg_6 = binascii.hexlify(str(arg_5).zfill(2))\n                        arg_3 += arg_6\n\n                    for arg_7 in range(0, arg_4):\n                        arg_6 = binascii.hexlify(str(0).zfill(2))\n                        arg_3 += arg_6\n\n                    arg_8 = \"015731023030443228\" + arg_3 + \"2903\"\n                    arg_8 += arg_0.calc_crc16(arg_8[2:].decode(\"hex\"))\n                    arg_0.m_serial_port.write(arg_8.decode(\"hex\"))\n                    if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode(\"hex\") == \"06\":\n                        arg_0.writeCmdMsg(\"Success: 06 returned.\")\n                        arg_2 = True\n            arg_0.serialPostEnd()\n        except:\n            ekm_log(traceback.format_exc(sys.exc_info()))\n\n        arg_0.setContext(\"\")\n        return arg_2", "path": "ekmmeters.py", "identifier": "V4Meter.setLCD", "docstring": "Serial call to set LCD using meter object bufer.\n\n        Used with :func:`~ekmmeters.V4Meter.addLcdItem`.\n\n        Args:\n            password (str): Optional password\n\n        Returns:\n            bool: True on completion and ACK.", "docstring_tokens": ["Serial", "call", "to", "set", "LCD", "using", "meter", "object", "bufer", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 256969}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/ranges.py#L30-L51", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Creates a overview of the hosts per range.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "RangeSearch", "(", ")", "arg_1", "=", "arg_0", ".", "get_ranges", "(", ")", "if", "arg_1", ":", "arg_2", "=", "[", "]", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_1", ":", "arg_2", ".", "append", "(", "{", "'mask'", ":", "arg_4", ".", "range", "}", ")", "arg_3", "[", "arg_4", ".", "range", "]", "=", "arg_4", ".", "tags", "arg_6", "=", "Host", ".", "search", "(", ")", "arg_6", "=", "arg_6", ".", "filter", "(", "'term'", ",", "status", "=", "'up'", ")", "arg_6", ".", "aggs", ".", "bucket", "(", "'hosts'", ",", "'ip_range'", ",", "field", "=", "'address'", ",", "arg_1", "=", "arg_2", ")", "arg_7", "=", "arg_6", ".", "execute", "(", ")", "print_line", "(", "\"{0:<18} {1:<6} {2}\"", ".", "format", "(", "\"Range\"", ",", "\"Count\"", ",", "\"Tags\"", ")", ")", "print_line", "(", "\"-\"", "*", "60", ")", "for", "arg_8", "in", "arg_7", ".", "aggregations", ".", "hosts", ".", "buckets", ":", "print_line", "(", "\"{0:<18} {1:<6} {2}\"", ".", "format", "(", "arg_8", ".", "key", ",", "arg_8", ".", "doc_count", ",", "arg_3", "[", "arg_8", ".", "key", "]", ")", ")", "else", ":", "print_error", "(", "\"No ranges defined.\"", ")"], "function": "def Func():\n    \"\"\"\n        Creates a Func of the hosts per range.\n    \"\"\"\n    arg_0 = RangeSearch()\n    arg_1 = arg_0.get_ranges()\n    if arg_1:\n        arg_2 = []\n        arg_3 = {}\n        for arg_4 in arg_1:\n            arg_2.append({'mask': arg_4.range})\n            arg_3[arg_4.range] = arg_4.tags\n        arg_6 = Host.search()\n        arg_6 = arg_6.filter('term', status='up')\n        arg_6.aggs.bucket('hosts', 'ip_range', field='address', arg_1=arg_2)\n        arg_7 = arg_6.execute()\n        print_line(\"{0:<18} {1:<6} {2}\".format(\"Range\", \"Count\", \"Tags\"))\n        print_line(\"-\" * 60)\n        for arg_8 in arg_7.aggregations.hosts.buckets:\n            print_line(\"{0:<18} {1:<6} {2}\".format(arg_8.key, arg_8.doc_count, arg_3[arg_8.key]))\n    else:\n        print_error(\"No ranges defined.\")", "path": "jackal/scripts/ranges.py", "identifier": "overview", "docstring": "Creates a overview of the hosts per range.", "docstring_tokens": ["Creates", "a", "overview", "of", "the", "hosts", "per", "range", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 256970}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1668-L1682", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "get span distance for each locus in original seqarray", "language": "python", "parameters": "(maparr, spans)", "return_statement": "return spans", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "1", "arg_1", "=", "np", ".", "zeros", "(", "(", "arg_0", "[", "-", "1", ",", "0", "]", ",", "2", ")", ",", "np", ".", "uint64", ")", "for", "arg_3", "in", "xrange", "(", "1", ",", "arg_0", ".", "shape", "[", "0", "]", ")", ":", "arg_4", "=", "arg_0", "[", "arg_3", ",", "0", "]", "if", "arg_4", "!=", "arg_2", ":", "arg_5", "=", "arg_3", "+", "1", "arg_1", "[", "arg_4", "-", "2", ",", "1", "]", "=", "arg_3", "arg_1", "[", "arg_4", "-", "1", ",", "0", "]", "=", "arg_3", "arg_2", "=", "arg_4", "arg_1", "[", "-", "1", ",", "1", "]", "=", "arg_0", "[", "-", "1", ",", "-", "1", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\" get span distance for each locus in original seqarray \"\"\"\n    ## start at 0, finds change at 1-index of map file\n    arg_2 = 1\n    arg_1 = np.zeros((arg_0[-1, 0], 2), np.uint64)\n    ## read through marr and record when locus id changes\n    for arg_3 in xrange(1, arg_0.shape[0]):\n        arg_4 = arg_0[arg_3, 0]\n        if arg_4 != arg_2:\n            arg_5 = arg_3 + 1\n            arg_1[arg_4-2, 1] = arg_3\n            arg_1[arg_4-1, 0] = arg_3\n            arg_2 = arg_4\n    arg_1[-1, 1] = arg_0[-1, -1]\n    return arg_1", "path": "ipyrad/analysis/tetrad.py", "identifier": "get_spans", "docstring": "get span distance for each locus in original seqarray", "docstring_tokens": ["get", "span", "distance", "for", "each", "locus", "in", "original", "seqarray"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 256971}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L164-L174", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to get component argument.\n    Raises exception if argument is missing.\n    Returns the component argument.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "get_argument", "(", "constants", ".", "PARAM_COMPONENT", ")", "return", "arg_1", "except", "tornado", ".", "web", ".", "MissingArgumentError", "as", "e", ":", "raise", "Exception", "(", "e", ".", "log_message", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Helper function to get component argument.\n    Raises exception if argument is missing.\n    Returns the component argument.\n    \"\"\"\n    try:\n      arg_1 = arg_0.get_argument(constants.PARAM_COMPONENT)\n      return arg_1\n    except tornado.web.MissingArgumentError as e:\n      raise Exception(e.log_message)", "path": "heron/tools/tracker/src/python/handlers/basehandler.py", "identifier": "BaseHandler.get_argument_component", "docstring": "Helper function to get component argument.\n    Raises exception if argument is missing.\n    Returns the component argument.", "docstring_tokens": ["Helper", "function", "to", "get", "component", "argument", ".", "Raises", "exception", "if", "argument", "is", "missing", ".", "Returns", "the", "component", "argument", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256972}
{"url": "https://github.com/dave-shawley/ietfparse/blob/d28f360941316e45c1596589fa59bc7d25aa20e0/ietfparse/headers.py#L202-L223", "sha": "d28f360941316e45c1596589fa59bc7d25aa20e0", "docstring_summary": "Parse a content type like header.", "language": "python", "parameters": "(content_type, normalize_parameter_values=True)", "return_statement": "return datastructures.ContentType(content_type, content_subtype,\n                                      dict(parameters),\n                                      content_suffix)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "_remove_comments", "(", "arg_0", ")", ".", "split", "(", "';'", ")", "arg_0", ",", "arg_3", "=", "arg_2", ".", "pop", "(", "0", ")", ".", "split", "(", "'/'", ")", "if", "'+'", "in", "arg_3", ":", "arg_3", ",", "arg_4", "=", "arg_3", ".", "split", "(", "'+'", ")", "else", ":", "arg_4", "=", "None", "arg_5", "=", "_parse_parameter_list", "(", "arg_2", ",", "arg_1", "=", "arg_1", ")", "return", "datastructures", ".", "ContentType", "(", "arg_0", ",", "arg_3", ",", "dict", "(", "arg_5", ")", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Parse a content type like header.\n\n    :param str content_type: the string to parse as a content type\n    :param bool normalize_parameter_values:\n        setting this to ``False`` will enable strict RFC2045 compliance\n        in which content parameter values are case preserving.\n    :return: a :class:`~ietfparse.datastructures.ContentType` instance\n\n    \"\"\"\n    arg_2 = _remove_comments(arg_0).split(';')\n    arg_0, arg_3 = arg_2.pop(0).split('/')\n    if '+' in arg_3:\n        arg_3, arg_4 = arg_3.split('+')\n    else:\n        arg_4 = None\n    arg_5 = _parse_parameter_list(\n        arg_2, arg_1=arg_1)\n\n    return datastructures.ContentType(arg_0, arg_3,\n                                      dict(arg_5),\n                                      arg_4)", "path": "ietfparse/headers.py", "identifier": "parse_content_type", "docstring": "Parse a content type like header.\n\n    :param str content_type: the string to parse as a content type\n    :param bool normalize_parameter_values:\n        setting this to ``False`` will enable strict RFC2045 compliance\n        in which content parameter values are case preserving.\n    :return: a :class:`~ietfparse.datastructures.ContentType` instance", "docstring_tokens": ["Parse", "a", "content", "type", "like", "header", "."], "nwo": "dave-shawley/ietfparse", "score": 0.23137166388621372, "idx": 256973}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/builder.py#L36-L48", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Adds a new source to the computation DAG", "language": "python", "parameters": "(self, source)", "return_statement": "return source_streamlet", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "if", "callable", "(", "arg_1", ")", ":", "arg_2", "=", "SupplierStreamlet", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_1", ",", "Generator", ")", ":", "arg_2", "=", "GeneratorStreamlet", "(", "arg_1", ")", "else", ":", "raise", "RuntimeError", "(", "\"Builder's new source has to be either a Generator or a function\"", ")", "arg_0", ".", "_sources", ".", "append", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Adds a new source to the computation DAG\"\"\"\n\n    arg_2 = None\n    if callable(arg_1):\n      arg_2 = SupplierStreamlet(arg_1)\n    elif isinstance(arg_1, Generator):\n      arg_2 = GeneratorStreamlet(arg_1)\n    else:\n      raise RuntimeError(\"Builder's new source has to be either a Generator or a function\")\n\n    arg_0._sources.append(arg_2)\n    return arg_2", "path": "heronpy/streamlet/builder.py", "identifier": "Builder.new_source", "docstring": "Adds a new source to the computation DAG", "docstring_tokens": ["Adds", "a", "new", "source", "to", "the", "computation", "DAG"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 256974}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L1255-L1278", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "make the global evaluation report", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "config", ".", "load_results", "(", "arg_0", ".", "file_state", ".", "base_name", ")", "if", "arg_0", ".", "stats", "[", "\"statement\"", "]", "==", "0", ":", "return", "arg_2", "=", "arg_0", ".", "config", ".", "evaluation", "try", ":", "arg_3", "=", "eval", "(", "arg_2", ",", "{", "}", ",", "arg_0", ".", "stats", ")", "except", "Exception", "as", "ex", ":", "arg_4", "=", "\"An exception occurred while rating: %s\"", "%", "ex", "else", ":", "arg_0", ".", "stats", "[", "\"global_note\"", "]", "=", "arg_3", "arg_4", "=", "\"Your code has been rated at %.2f/10\"", "%", "arg_3", "arg_6", "=", "arg_1", ".", "get", "(", "\"global_note\"", ")", "if", "arg_6", "is", "not", "None", ":", "arg_4", "+=", "\" (previous run: %.2f/10, %+.2f)\"", "%", "(", "arg_6", ",", "arg_3", "-", "arg_6", ")", "if", "arg_0", ".", "config", ".", "score", ":", "arg_7", "=", "report_nodes", ".", "EvaluationSection", "(", "arg_4", ")", "arg_0", ".", "reporter", ".", "display_reports", "(", "arg_7", ")"], "function": "def Func(arg_0):\n        \"\"\"make the global evaluation report\"\"\"\n        # check with at least check 1 statements (usually 0 when there is a\n        # syntax error preventing pylint from further processing)\n        arg_1 = config.load_results(arg_0.file_state.base_name)\n        if arg_0.stats[\"statement\"] == 0:\n            return\n\n        # get a global note for the code\n        arg_2 = arg_0.config.evaluation\n        try:\n            arg_3 = eval(arg_2, {}, arg_0.stats)  # pylint: disable=eval-used\n        except Exception as ex:\n            arg_4 = \"An exception occurred while rating: %s\" % ex\n        else:\n            arg_0.stats[\"global_note\"] = arg_3\n            arg_4 = \"Your code has been rated at %.2f/10\" % arg_3\n            arg_6 = arg_1.get(\"global_note\")\n            if arg_6 is not None:\n                arg_4 += \" (previous run: %.2f/10, %+.2f)\" % (arg_6, arg_3 - arg_6)\n\n        if arg_0.config.score:\n            arg_7 = report_nodes.EvaluationSection(arg_4)\n            arg_0.reporter.display_reports(arg_7)", "path": "pylint/lint.py", "identifier": "PyLinter._report_evaluation", "docstring": "make the global evaluation report", "docstring_tokens": ["make", "the", "global", "evaluation", "report"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256975}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/proximity.py#L50-L90", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "An edge weight map indexed by node id's.\n    \n    A dictionary indexed by node id1's in which each value is a\n    dictionary of connected node id2's linking to the edge weight.\n    If directed, edges go from id1 to id2, but not the other way.\n    If stochastic, all the weights for the neighbors of a given node sum to 1.\n    A heuristic can be a function that takes two node id's and returns\n    and additional cost for movement between the two nodes.", "language": "python", "parameters": "(graph, directed=False, reversed=False, stochastic=False, heuristic=None)", "return_statement": "return v", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "{", "}", "for", "arg_6", "in", "arg_0", ".", "nodes", ":", "arg_5", "[", "arg_6", ".", "id", "]", "=", "{", "}", "for", "arg_8", "in", "arg_0", ".", "edges", ":", "arg_9", "=", "arg_8", ".", "node1", ".", "id", "arg_10", "=", "arg_8", ".", "node2", ".", "id", "if", "arg_2", ":", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_9", "arg_5", "[", "arg_9", "]", "[", "arg_10", "]", "=", "1.0", "-", "arg_8", ".", "weight", "*", "0.5", "if", "arg_4", ":", "arg_5", "[", "arg_9", "]", "[", "arg_10", "]", "+=", "arg_4", "(", "arg_9", ",", "arg_10", ")", "if", "not", "arg_1", ":", "arg_5", "[", "arg_10", "]", "[", "arg_9", "]", "=", "arg_5", "[", "arg_9", "]", "[", "arg_10", "]", "if", "arg_3", ":", "for", "arg_9", "in", "arg_5", ":", "arg_11", "=", "sum", "(", "arg_5", "[", "arg_9", "]", ".", "values", "(", ")", ")", "for", "arg_10", "in", "arg_5", "[", "arg_9", "]", ":", "arg_5", "[", "arg_9", "]", "[", "arg_10", "]", "/=", "arg_11", "return", "arg_5"], "function": "def Func(arg_0, arg_1=False, arg_2=False, arg_3=False, arg_4=None):\n    \n    \"\"\" An edge weight map indexed by node id's.\n    \n    A dictionary indexed by node id1's in which each value is a\n    dictionary of connected node id2's linking to the edge weight.\n    If directed, edges go from id1 to id2, but not the other way.\n    If stochastic, all the weights for the neighbors of a given node sum to 1.\n    A heuristic can be a function that takes two node id's and returns\n    and additional cost for movement between the two nodes.\n    \n    \"\"\"\n    \n    arg_5 = {}\n    for arg_6 in arg_0.nodes:\n        arg_5[arg_6.id] = {}\n    \n    for arg_8 in arg_0.edges:\n        \n        arg_9 = arg_8.node1.id\n        arg_10 = arg_8.node2.id\n        if arg_2:\n            arg_9, arg_10 = arg_10, arg_9\n            \n        #if not v.has_key(id1): v[id1] = {}\n        #if not v.has_key(id2): v[id2] = {}\n        arg_5[arg_9][arg_10] = 1.0 - arg_8.weight*0.5\n        \n        if arg_4:\n            arg_5[arg_9][arg_10] += arg_4(arg_9, arg_10)\n        \n        if not arg_1: \n            arg_5[arg_10][arg_9] = arg_5[arg_9][arg_10]\n        \n    if arg_3:\n        for arg_9 in arg_5:\n            arg_11 = sum(arg_5[arg_9].values())\n            for arg_10 in arg_5[arg_9]: \n                arg_5[arg_9][arg_10] /= arg_11\n    \n    return arg_5", "path": "lib/graph/proximity.py", "identifier": "adjacency", "docstring": "An edge weight map indexed by node id's.\n    \n    A dictionary indexed by node id1's in which each value is a\n    dictionary of connected node id2's linking to the edge weight.\n    If directed, edges go from id1 to id2, but not the other way.\n    If stochastic, all the weights for the neighbors of a given node sum to 1.\n    A heuristic can be a function that takes two node id's and returns\n    and additional cost for movement between the two nodes.", "docstring_tokens": ["An", "edge", "weight", "map", "indexed", "by", "node", "id", "s", ".", "A", "dictionary", "indexed", "by", "node", "id1", "s", "in", "which", "each", "value", "is", "a", "dictionary", "of", "connected", "node", "id2", "s", "linking", "to", "the", "edge", "weight", ".", "If", "directed", "edges", "go", "from", "id1", "to", "id2", "but", "not", "the", "other", "way", ".", "If", "stochastic", "all", "the", "weights", "for", "the", "neighbors", "of", "a", "given", "node", "sum", "to", "1", ".", "A", "heuristic", "can", "be", "a", "function", "that", "takes", "two", "node", "id", "s", "and", "returns", "and", "additional", "cost", "for", "movement", "between", "the", "two", "nodes", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 256976}
{"url": "https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlterms.py#L168-L188", "sha": "246b7722d62b87b48be66d9a871509a537728962", "docstring_summary": "Decode Erlang external term.", "language": "python", "parameters": "(string)", "return_statement": "return decode_term(string[1:])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "raise", "IncompleteData", "(", "arg_0", ")", "if", "arg_0", "[", "0", "]", "!=", "131", ":", "raise", "ValueError", "(", "\"unknown protocol version: %r\"", "%", "arg_0", "[", "0", "]", ")", "if", "arg_0", "[", "1", ":", "2", "]", "==", "b'P'", ":", "if", "len", "(", "arg_0", ")", "<", "16", ":", "raise", "IncompleteData", "(", "arg_0", ")", "arg_1", "=", "decompressobj", "(", ")", "arg_2", "=", "arg_1", ".", "decompress", "(", "arg_0", "[", "6", ":", "]", ")", "+", "arg_1", ".", "flush", "(", ")", "arg_3", ",", "=", "_int4_unpack", "(", "arg_0", "[", "2", ":", "6", "]", ")", "if", "len", "(", "arg_2", ")", "!=", "arg_3", ":", "raise", "ValueError", "(", "\"invalid compressed tag, \"", "\"%d bytes but got %d\"", "%", "(", "arg_3", ",", "len", "(", "arg_2", ")", ")", ")", "arg_4", ",", "arg_5", "=", "Func_term", "(", "arg_2", ")", "return", "arg_4", ",", "arg_1", ".", "unused_data", "return", "Func_term", "(", "arg_0", "[", "1", ":", "]", ")"], "function": "def Func(arg_0):\n    \"\"\"Decode Erlang external term.\"\"\"\n    if not arg_0:\n        raise IncompleteData(arg_0)\n    if arg_0[0] != 131:\n        raise ValueError(\"unknown protocol version: %r\" % arg_0[0])\n    if arg_0[1:2] == b'P':\n        # compressed term\n        if len(arg_0) < 16:\n            raise IncompleteData(arg_0)\n        arg_1 = decompressobj()\n        arg_2 = arg_1.decompress(arg_0[6:]) + arg_1.flush()\n        arg_3, = _int4_unpack(arg_0[2:6])\n        if len(arg_2) != arg_3:\n            raise ValueError(\n                \"invalid compressed tag, \"\n                \"%d bytes but got %d\" % (arg_3, len(arg_2)))\n        # tail data returned by Func_term() can be simple ignored\n        arg_4, arg_5 = Func_term(arg_2)\n        return arg_4, arg_1.unused_data\n    return Func_term(arg_0[1:])", "path": "priv/python3/erlport/erlterms.py", "identifier": "decode", "docstring": "Decode Erlang external term.", "docstring_tokens": ["Decode", "Erlang", "external", "term", "."], "nwo": "hdima/erlport", "score": 0.7170200836482384, "idx": 256977}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/environment.py#L286-L354", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''This function handles the retrieval of a chemical's octanol-water\n    partition coefficient. Lookup is based on CASRNs. Will automatically\n    select a data source to use if no Method is provided; returns None if the\n    data is not available.", "language": "python", "parameters": "(CASRN, AvailableMethods=False, Method=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "def", "list_methods", "(", ")", ":", "arg_3", "=", "[", "]", "if", "arg_0", "in", "CRCFuncDict", ".", "index", ":", "arg_3", ".", "append", "(", "CRC", ")", "if", "arg_0", "in", "SyrresDict2", ".", "index", ":", "arg_3", ".", "append", "(", "SYRRES", ")", "arg_3", ".", "append", "(", "NONE", ")", "return", "arg_3", "if", "arg_1", ":", "return", "list_methods", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_2", "==", "CRC", ":", "return", "float", "(", "CRCFuncDict", ".", "at", "[", "arg_0", ",", "'Func'", "]", ")", "elif", "arg_2", "==", "SYRRES", ":", "return", "float", "(", "SyrresDict2", ".", "at", "[", "arg_0", ",", "'Func'", "]", ")", "elif", "arg_2", "==", "NONE", ":", "return", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n    r'''This function handles the retrieval of a chemical's octanol-water\n    partition coefficient. Lookup is based on CASRNs. Will automatically\n    select a data source to use if no Method is provided; returns None if the\n    data is not available.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    Func : float\n        Octanol-water partition coefficient, [-]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain Func with the\n        given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        The method name to use. Accepted methods are 'SYRRES', or 'CRC', \n        All valid values are also held in the list Func_methods.\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        the Func for the desired chemical, and will return methods\n        instead of the Func\n\n    Notes\n    -----\n    .. math::\n        \\log P_{ oct/wat} = \\log\\left(\\frac{\\left[{solute}\n        \\right]_{ octanol}^{un-ionized}}{\\left[{solute}\n        \\right]_{ water}^{ un-ionized}}\\right)\n\n    Examples\n    --------\n    >>> Func('67-56-1')\n    -0.74\n\n    References\n    ----------\n    .. [1] Syrres. 2006. KOWWIN Data, SrcKowData2.zip.\n       http://esc.syrres.com/interkow/Download/SrcKowData2.zip\n    .. [2] Haynes, W.M., Thomas J. Bruno, and David R. Lide. CRC Handbook of\n       Chemistry and Physics, 95E. Boca Raton, FL: CRC press, 2014.\n    '''\n    def list_methods():\n        arg_3 = []\n        if arg_0 in CRCFuncDict.index:\n            arg_3.append(CRC)\n        if arg_0 in SyrresDict2.index:\n            arg_3.append(SYRRES)\n        arg_3.append(NONE)\n        return arg_3\n    if arg_1:\n        return list_methods()\n    if not arg_2:\n        arg_2 = list_methods()[0]\n\n    if arg_2 == CRC:\n        return float(CRCFuncDict.at[arg_0, 'Func'])\n    elif arg_2 == SYRRES:\n        return float(SyrresDict2.at[arg_0, 'Func'])\n    elif arg_2 == NONE:\n        return None\n    else:\n        raise Exception('Failure in in function')", "path": "thermo/environment.py", "identifier": "logP", "docstring": "r'''This function handles the retrieval of a chemical's octanol-water\n    partition coefficient. Lookup is based on CASRNs. Will automatically\n    select a data source to use if no Method is provided; returns None if the\n    data is not available.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    logP : float\n        Octanol-water partition coefficient, [-]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain logP with the\n        given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        The method name to use. Accepted methods are 'SYRRES', or 'CRC', \n        All valid values are also held in the list logP_methods.\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        the logP for the desired chemical, and will return methods\n        instead of the logP\n\n    Notes\n    -----\n    .. math::\n        \\log P_{ oct/wat} = \\log\\left(\\frac{\\left[{solute}\n        \\right]_{ octanol}^{un-ionized}}{\\left[{solute}\n        \\right]_{ water}^{ un-ionized}}\\right)\n\n    Examples\n    --------\n    >>> logP('67-56-1')\n    -0.74\n\n    References\n    ----------\n    .. [1] Syrres. 2006. KOWWIN Data, SrcKowData2.zip.\n       http://esc.syrres.com/interkow/Download/SrcKowData2.zip\n    .. [2] Haynes, W.M., Thomas J. Bruno, and David R. Lide. CRC Handbook of\n       Chemistry and Physics, 95E. Boca Raton, FL: CRC press, 2014.", "docstring_tokens": ["r", "This", "function", "handles", "the", "retrieval", "of", "a", "chemical", "s", "octanol", "-", "water", "partition", "coefficient", ".", "Lookup", "is", "based", "on", "CASRNs", ".", "Will", "automatically", "select", "a", "data", "source", "to", "use", "if", "no", "Method", "is", "provided", ";", "returns", "None", "if", "the", "data", "is", "not", "available", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 256978}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L59-L74", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Checks workflow status.", "language": "python", "parameters": "(self, workflow_id)", "return_statement": "return r.json()['state']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "logger", ".", "debug", "(", "'Get Func of workflow: '", "+", "arg_1", ")", "arg_2", "=", "'%(wf_url)s/%(wf_id)s'", "%", "{", "'wf_url'", ":", "arg_0", ".", "workflows_url", ",", "'wf_id'", ":", "arg_1", "}", "arg_3", "=", "arg_0", ".", "gbdx_connection", ".", "get", "(", "arg_2", ")", "arg_3", ".", "raise_for_Func", "(", ")", "return", "arg_3", ".", "json", "(", ")", "[", "'state'", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Checks workflow Func.\n\n         Args:\n             workflow_id (str): Workflow id.\n\n         Returns:\n             Workflow Func (str).\n        \"\"\"\n        arg_0.logger.debug('Get Func of workflow: ' + arg_1)\n        arg_2 = '%(wf_url)s/%(wf_id)s' % {\n            'wf_url': arg_0.workflows_url, 'wf_id': arg_1\n        }\n        arg_3 = arg_0.gbdx_connection.get(arg_2)\n        arg_3.raise_for_Func()\n        return arg_3.json()['state']", "path": "gbdxtools/workflow.py", "identifier": "Workflow.status", "docstring": "Checks workflow status.\n\n         Args:\n             workflow_id (str): Workflow id.\n\n         Returns:\n             Workflow status (str).", "docstring_tokens": ["Checks", "workflow", "status", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 256979}
{"url": "https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5json.py#L9-L63", "sha": "3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8", "docstring_summary": "Convert an Open511 XML document or document fragment to JSON.", "language": "python", "parameters": "(root)", "return_statement": "return j", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "_maybe_intify", "(", "arg_0", ".", "text", ")", "if", "len", "(", "arg_0", ")", "==", "1", "and", "arg_0", "[", "0", "]", ".", "tag", ".", "startswith", "(", "'{'", "+", "NS_GML", ")", ":", "return", "gml_to_geojson", "(", "arg_0", "[", "0", "]", ")", "if", "arg_0", ".", "tag", "==", "'open511'", ":", "arg_1", "[", "'meta'", "]", "=", "{", "'version'", ":", "arg_0", ".", "get", "(", "'version'", ")", "}", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "arg_2", ".", "tag", "if", "arg_3", "==", "'link'", "and", "arg_2", ".", "get", "(", "'rel'", ")", ":", "arg_3", "=", "arg_2", ".", "get", "(", "'rel'", ")", "+", "'_url'", "if", "arg_3", "==", "'self_url'", ":", "arg_3", "=", "'url'", "if", "arg_0", ".", "tag", "==", "'open511'", ":", "arg_1", "[", "'meta'", "]", "[", "arg_3", "]", "=", "arg_2", ".", "get", "(", "'href'", ")", "continue", "elif", "arg_3", ".", "startswith", "(", "'{'", "+", "NS_PROTECTED", ")", ":", "arg_3", "=", "'!'", "+", "arg_3", "[", "arg_3", ".", "index", "(", "'}'", ")", "+", "1", ":", "]", "elif", "arg_3", "[", "0", "]", "==", "'{'", ":", "arg_3", "=", "'+'", "+", "arg_3", "[", "arg_3", ".", "index", "(", "'}'", ")", "+", "1", ":", "]", "if", "arg_3", "in", "arg_1", ":", "continue", "elif", "arg_2", ".", "tag", "==", "'link'", "and", "not", "arg_2", ".", "text", ":", "arg_1", "[", "arg_3", "]", "=", "arg_2", ".", "get", "(", "'href'", ")", "elif", "len", "(", "arg_2", ")", ":", "if", "arg_3", "==", "'grouped_events'", ":", "arg_1", "[", "arg_3", "]", "=", "[", "xml_link_to_json", "(", "arg_4", ",", "to_dict", "=", "False", ")", "for", "arg_4", "in", "arg_2", "]", "elif", "arg_3", "in", "(", "'attachments'", ",", "'media_files'", ")", ":", "arg_1", "[", "arg_3", "]", "=", "[", "xml_link_to_json", "(", "arg_4", ",", "to_dict", "=", "True", ")", "for", "arg_4", "in", "arg_2", "]", "elif", "all", "(", "(", "arg_3", "==", "pluralize", "(", "arg_4", ".", "tag", ")", "for", "arg_4", "in", "arg_2", ")", ")", ":", "arg_1", "[", "arg_3", "]", "=", "[", "Func", "(", "arg_4", ")", "for", "arg_4", "in", "arg_2", "]", "else", ":", "arg_1", "[", "arg_3", "]", "=", "Func", "(", "arg_2", ")", "else", ":", "if", "arg_0", ".", "tag", "==", "'open511'", "and", "arg_3", ".", "endswith", "(", "'s'", ")", "and", "not", "arg_2", ".", "text", ":", "arg_1", "[", "arg_3", "]", "=", "[", "]", "else", ":", "arg_1", "[", "arg_3", "]", "=", "_maybe_intify", "(", "arg_2", ".", "text", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Convert an Open511 XML document or document fragment to JSON.\n\n    Takes an lxml Element object. Returns a dict ready to be JSON-serialized.\"\"\"\n    arg_1 = {}\n\n    if len(arg_0) == 0:  # Tag with no children, return str/int\n        return _maybe_intify(arg_0.text)\n\n    if len(arg_0) == 1 and arg_0[0].tag.startswith('{' + NS_GML):  # GML\n        return gml_to_geojson(arg_0[0])\n\n    if arg_0.tag == 'open511':\n        arg_1['meta'] = {'version': arg_0.get('version')}\n\n    for arg_2 in arg_0:\n        arg_3 = arg_2.tag\n        if arg_3 == 'link' and arg_2.get('rel'):\n            arg_3 = arg_2.get('rel') + '_url'\n            if arg_3 == 'self_url':\n                arg_3 = 'url'\n            if arg_0.tag == 'open511':\n                arg_1['meta'][arg_3] = arg_2.get('href')\n                continue\n        elif arg_3.startswith('{' + NS_PROTECTED):\n            arg_3 = '!' + arg_3[arg_3.index('}') + 1:] \n        elif arg_3[0] == '{':\n            # Namespace!\n            arg_3 = '+' + arg_3[arg_3.index('}') + 1:]\n\n        if arg_3 in arg_1:\n            continue  # duplicate\n        elif arg_2.tag == 'link' and not arg_2.text:\n            arg_1[arg_3] = arg_2.get('href')\n        elif len(arg_2):\n            if arg_3 == 'grouped_events':\n                # An array of URLs\n                arg_1[arg_3] = [xml_link_to_json(arg_4, to_dict=False) for arg_4 in arg_2]\n            elif arg_3 in ('attachments', 'media_files'):\n                # An array of JSON objects\n                arg_1[arg_3] = [xml_link_to_json(arg_4, to_dict=True) for arg_4 in arg_2]\n            elif all((arg_3 == pluralize(arg_4.tag) for arg_4 in arg_2)):\n                # <something><somethings> serializes to a JSON array\n                arg_1[arg_3] = [Func(arg_4) for arg_4 in arg_2]\n            else:\n                arg_1[arg_3] = Func(arg_2)\n        else:\n            if arg_0.tag == 'open511' and arg_3.endswith('s') and not arg_2.text:\n                # Special case: an empty e.g. <events /> container at the root level\n                # should be serialized to [], not null\n                arg_1[arg_3] = []\n            else:\n                arg_1[arg_3] = _maybe_intify(arg_2.text)\n\n    return arg_1", "path": "open511/converter/o5json.py", "identifier": "xml_to_json", "docstring": "Convert an Open511 XML document or document fragment to JSON.\n\n    Takes an lxml Element object. Returns a dict ready to be JSON-serialized.", "docstring_tokens": ["Convert", "an", "Open511", "XML", "document", "or", "document", "fragment", "to", "JSON", "."], "nwo": "open511/open511", "score": 0.138843686048881, "idx": 256980}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/custom_reliablecollections.py#L78-L124", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Query existing reliable dictionary.", "language": "python", "parameters": "(client, application_name, service_name, dictionary_name, query_string, partition_key=None, partition_id=None, output_file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ")", ":", "arg_8", "=", "Cluster", ".", "from_sfclient", "(", "arg_0", ")", "arg_9", "=", "arg_8", ".", "get_application", "(", "arg_1", ")", ".", "get_service", "(", "arg_2", ")", ".", "get_dictionary", "(", "arg_3", ")", "arg_10", "=", "time", ".", "time", "(", ")", "if", "(", "arg_6", "!=", "None", ")", ":", "arg_11", "=", "arg_9", ".", "query", "(", "arg_4", ",", "PartitionLookup", ".", "ID", ",", "arg_6", ")", "elif", "(", "arg_5", "!=", "None", ")", ":", "arg_11", "=", "arg_9", ".", "query", "(", "arg_4", ",", "PartitionLookup", ".", "KEY", ",", "arg_5", ")", "else", ":", "arg_11", "=", "arg_9", ".", "query", "(", "arg_4", ")", "if", "type", "(", "arg_11", ")", "is", "str", ":", "print", "(", "arg_11", ")", "return", "else", ":", "arg_11", "=", "json", ".", "dumps", "(", "arg_11", ".", "get", "(", "\"value\"", ")", ",", "indent", "=", "4", ")", "print", "(", "\"Query took \"", "+", "str", "(", "time", ".", "time", "(", ")", "-", "arg_10", ")", "+", "\" seconds\"", ")", "if", "(", "arg_7", "==", "None", ")", ":", "arg_7", "=", "\"{}-{}-{}-query-output.json\"", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "with", "open", "(", "arg_7", ",", "\"w\"", ")", "as", "output", ":", "output", ".", "write", "(", "arg_11", ")", "print", "(", ")", "print", "(", "'Printed output to: '", "+", "arg_7", ")", "print", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=None, arg_7=None):\n    \"\"\"Query existing reliable dictionary.\n\n    Query existing reliable dictionaries for given application and service.\n\n    :param application_name: Name of the application.\n    :type application_name: str\n    :param service_name: Name of the service.\n    :type service_name: str\n    :param dictionary_name: Name of the reliable dictionary.\n    :type dictionary_name: str\n    :param query_string: An OData query string. For example $top=10. Check https://www.odata.org/documentation/ for more information.\n    :type query_string: str\n    :param partition_key: Optional partition key of the desired partition, either a string if named schema or int if Int64 schema\n    :type partition_id: str\n    :param partition_id: Optional partition GUID of the owning reliable dictionary.\n    :type partition_id: str\n    :param output_file: Optional file to save the schema.\n    \"\"\"\n    arg_8 = Cluster.from_sfclient(arg_0)\n    arg_9 = arg_8.get_application(arg_1).get_service(arg_2).get_dictionary(arg_3)\n    \n    \n    arg_10 = time.time()\n    if (arg_6 != None):\n        arg_11 = arg_9.query(arg_4, PartitionLookup.ID, arg_6)\n    elif (arg_5 != None):\n        arg_11 = arg_9.query(arg_4, PartitionLookup.KEY, arg_5)\n    else:\n        arg_11 = arg_9.query(arg_4)\n    \n    if type(arg_11) is str:\n        print(arg_11)\n        return\n    else:\n        arg_11 = json.dumps(arg_11.get(\"value\"), indent=4)\n    \n    print(\"Query took \" + str(time.time() - arg_10) + \" seconds\")\n    \n    if (arg_7 == None):\n        arg_7 = \"{}-{}-{}-query-output.json\".format(arg_1, arg_2, arg_3)\n    \n    with open(arg_7, \"w\") as output:\n        output.write(arg_11)\n    print()\n    print('Printed output to: ' + arg_7)\n    print(arg_11)", "path": "rcctl/rcctl/custom_reliablecollections.py", "identifier": "query_reliabledictionary", "docstring": "Query existing reliable dictionary.\n\n    Query existing reliable dictionaries for given application and service.\n\n    :param application_name: Name of the application.\n    :type application_name: str\n    :param service_name: Name of the service.\n    :type service_name: str\n    :param dictionary_name: Name of the reliable dictionary.\n    :type dictionary_name: str\n    :param query_string: An OData query string. For example $top=10. Check https://www.odata.org/documentation/ for more information.\n    :type query_string: str\n    :param partition_key: Optional partition key of the desired partition, either a string if named schema or int if Int64 schema\n    :type partition_id: str\n    :param partition_id: Optional partition GUID of the owning reliable dictionary.\n    :type partition_id: str\n    :param output_file: Optional file to save the schema.", "docstring_tokens": ["Query", "existing", "reliable", "dictionary", "."], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 256981}
{"url": "https://github.com/hsharrison/pyglet2d/blob/46f610b3c76221bff19e5c0cf3d35d7875ce37a0/src/pyglet2d.py#L264-L280", "sha": "46f610b3c76221bff19e5c0cf3d35d7875ce37a0", "docstring_summary": "Rotate the shape, in-place.", "language": "python", "parameters": "(self, angle, center=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "arg_1", "]", "if", "arg_2", "is", "not", "None", ":", "arg_3", ".", "extend", "(", "arg_2", ")", "arg_0", ".", "poly", ".", "Func", "(", "*", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Rotate the shape, in-place.\n\n        Parameters\n        ----------\n        angle : float\n            Angle to Func, in radians counter-clockwise.\n        center : array-like, optional\n            Point about which to Func.\n            If not passed, the center of the shape will be used.\n\n        \"\"\"\n        arg_3 = [arg_1]\n        if arg_2 is not None:\n            arg_3.extend(arg_2)\n        arg_0.poly.Func(*arg_3)\n        return arg_0", "path": "src/pyglet2d.py", "identifier": "Shape.rotate", "docstring": "Rotate the shape, in-place.\n\n        Parameters\n        ----------\n        angle : float\n            Angle to rotate, in radians counter-clockwise.\n        center : array-like, optional\n            Point about which to rotate.\n            If not passed, the center of the shape will be used.", "docstring_tokens": ["Rotate", "the", "shape", "in", "-", "place", "."], "nwo": "hsharrison/pyglet2d", "score": 0.2823188883832642, "idx": 256982}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L994-L1072", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Prepare search request, send and return parsed data as a dict.", "language": "python", "parameters": "(self, ctype, level=None, category=None, assetId=None, defId=None,\n               min_price=None, max_price=None, min_buy=None, max_buy=None,\n               league=None, club=None, position=None, zone=None, nationality=None,\n               rare=False, playStyle=None, start=0, page_size=itemsPerPage['transferMarket'],\n               fast=False)", "return_statement": "return [itemParse(i) for i in rc.get('auctionInfo', ())]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "None", ",", "arg_14", "=", "None", ",", "arg_15", "=", "False", ",", "arg_16", "=", "None", ",", "arg_17", "=", "0", ",", "arg_18", "=", "arg_19", "[", "'transferMarket'", "]", ",", "arg_20", "=", "False", ")", ":", "arg_21", "=", "'GET'", "arg_22", "=", "'transfermarket'", "if", "arg_17", "==", "0", ":", "arg_23", "=", "[", "arg_0", ".", "pin", ".", "event", "(", "'page_view'", ",", "'Hub - Transfers'", ")", ",", "arg_0", ".", "pin", ".", "event", "(", "'page_view'", ",", "'Transfer Market Search'", ")", "]", "arg_0", ".", "pin", ".", "send", "(", "arg_23", ",", "arg_20", "=", "arg_20", ")", "arg_24", "=", "{", "'start'", ":", "arg_17", ",", "'num'", ":", "arg_18", ",", "'type'", ":", "arg_1", ",", "}", "if", "arg_2", ":", "arg_24", "[", "'lev'", "]", "=", "arg_2", "if", "arg_3", ":", "arg_24", "[", "'cat'", "]", "=", "arg_3", "if", "arg_4", ":", "arg_24", "[", "'maskedDefId'", "]", "=", "arg_4", "if", "arg_5", ":", "arg_24", "[", "'definitionId'", "]", "=", "arg_5", "if", "arg_6", ":", "arg_24", "[", "'micr'", "]", "=", "arg_6", "if", "arg_7", ":", "arg_24", "[", "'macr'", "]", "=", "arg_7", "if", "arg_8", ":", "arg_24", "[", "'minb'", "]", "=", "arg_8", "if", "arg_9", ":", "arg_24", "[", "'maxb'", "]", "=", "arg_9", "if", "arg_10", ":", "arg_24", "[", "'leag'", "]", "=", "arg_10", "if", "arg_11", ":", "arg_24", "[", "'team'", "]", "=", "arg_11", "if", "arg_12", ":", "arg_24", "[", "'pos'", "]", "=", "arg_12", "if", "arg_13", ":", "arg_24", "[", "'zone'", "]", "=", "arg_13", "if", "arg_14", ":", "arg_24", "[", "'nat'", "]", "=", "arg_14", "if", "arg_15", ":", "arg_24", "[", "'rare'", "]", "=", "'SP'", "if", "arg_16", ":", "arg_24", "[", "'playStyle'", "]", "=", "arg_16", "arg_25", "=", "arg_0", ".", "__request__", "(", "arg_21", ",", "arg_22", ",", "arg_24", "=", "arg_24", ",", "arg_20", "=", "arg_20", ")", "if", "arg_17", "==", "0", ":", "arg_23", "=", "[", "arg_0", ".", "pin", ".", "event", "(", "'page_view'", ",", "'Transfer Market Results - List View'", ")", ",", "arg_0", ".", "pin", ".", "event", "(", "'page_view'", ",", "'Item - Detail View'", ")", "]", "arg_0", ".", "pin", ".", "send", "(", "arg_23", ",", "arg_20", "=", "arg_20", ")", "return", "[", "itemParse", "(", "arg_26", ")", "for", "arg_26", "in", "arg_25", ".", "get", "(", "'auctionInfo'", ",", "(", ")", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None,\n               arg_6=None, arg_7=None, arg_8=None, arg_9=None,\n               arg_10=None, arg_11=None, arg_12=None, arg_13=None, arg_14=None,\n               arg_15=False, arg_16=None, arg_17=0, arg_18=arg_19['transferMarket'],\n               arg_20=False):\n        \"\"\"Prepare Func request, send and return parsed data as a dict.\n\n        :param ctype: [development / ? / ?] Card type.\n        :param level: (optional) [?/?/gold] Card level.\n        :param category: (optional) [fitness/?/?] Card category.\n        :param assetId: (optional) Asset id.\n        :param defId: (optional) Definition id.\n        :param min_price: (optional) Minimal price.\n        :param max_price: (optional) Maximum price.\n        :param min_buy: (optional) Minimal buy now price.\n        :param max_buy: (optional) Maximum buy now price.\n        :param league: (optional) League id.\n        :param club: (optional) Club id.\n        :param position: (optional) Position.\n        :param nationality: (optional) Nation id.\n        :param rare: (optional) [boolean] True for Funcing special cards.\n        :param playStyle: (optional) Play style.\n        :param start: (optional) Start page sent to server so it supposed to be 12/15, 24/30 etc. (default platform page_size*n)\n        :param page_size: (optional) Page size (items per page).\n        \"\"\"\n        # TODO: add \"Func\" alias\n        # TODO: generator\n        arg_21 = 'GET'\n        arg_22 = 'transfermarket'\n\n        # pinEvents\n        if arg_17 == 0:\n            arg_23 = [arg_0.pin.event('page_view', 'Hub - Transfers'), arg_0.pin.event('page_view', 'Transfer Market Search')]\n            arg_0.pin.send(arg_23, arg_20=arg_20)\n\n        arg_24 = {\n            'start': arg_17,\n            'num': arg_18,\n            'type': arg_1,  # \"type\" namespace is reserved in python\n        }\n        if arg_2:\n            arg_24['lev'] = arg_2\n        if arg_3:\n            arg_24['cat'] = arg_3\n        if arg_4:\n            arg_24['maskedDefId'] = arg_4\n        if arg_5:\n            arg_24['definitionId'] = arg_5\n        if arg_6:\n            arg_24['micr'] = arg_6\n        if arg_7:\n            arg_24['macr'] = arg_7\n        if arg_8:\n            arg_24['minb'] = arg_8\n        if arg_9:\n            arg_24['maxb'] = arg_9\n        if arg_10:\n            arg_24['leag'] = arg_10\n        if arg_11:\n            arg_24['team'] = arg_11\n        if arg_12:\n            arg_24['pos'] = arg_12\n        if arg_13:\n            arg_24['zone'] = arg_13\n        if arg_14:\n            arg_24['nat'] = arg_14\n        if arg_15:\n            arg_24['rare'] = 'SP'\n        if arg_16:\n            arg_24['playStyle'] = arg_16\n\n        arg_25 = arg_0.__request__(arg_21, arg_22, arg_24=arg_24, arg_20=arg_20)\n\n        # pinEvents\n        if arg_17 == 0:\n            arg_23 = [arg_0.pin.event('page_view', 'Transfer Market Results - List View'), arg_0.pin.event('page_view', 'Item - Detail View')]\n            arg_0.pin.send(arg_23, arg_20=arg_20)\n\n        return [itemParse(arg_26) for arg_26 in arg_25.get('auctionInfo', ())]", "path": "fut/core.py", "identifier": "Core.search", "docstring": "Prepare search request, send and return parsed data as a dict.\n\n        :param ctype: [development / ? / ?] Card type.\n        :param level: (optional) [?/?/gold] Card level.\n        :param category: (optional) [fitness/?/?] Card category.\n        :param assetId: (optional) Asset id.\n        :param defId: (optional) Definition id.\n        :param min_price: (optional) Minimal price.\n        :param max_price: (optional) Maximum price.\n        :param min_buy: (optional) Minimal buy now price.\n        :param max_buy: (optional) Maximum buy now price.\n        :param league: (optional) League id.\n        :param club: (optional) Club id.\n        :param position: (optional) Position.\n        :param nationality: (optional) Nation id.\n        :param rare: (optional) [boolean] True for searching special cards.\n        :param playStyle: (optional) Play style.\n        :param start: (optional) Start page sent to server so it supposed to be 12/15, 24/30 etc. (default platform page_size*n)\n        :param page_size: (optional) Page size (items per page).", "docstring_tokens": ["Prepare", "search", "request", "send", "and", "return", "parsed", "data", "as", "a", "dict", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 256983}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L443-L454", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Handle the kernel's death by asking if the user wants to restart.", "language": "python", "parameters": "(self, since_last_heartbeat)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"kernel died: %s\"", ",", "arg_1", ")", "if", "arg_0", ".", "custom_restart", ":", "arg_0", ".", "custom_restart_kernel_died", ".", "emit", "(", "arg_1", ")", "else", ":", "arg_2", "=", "'The kernel heartbeat has been inactive for %.2f '", "'seconds. Do you want to restart the kernel? You may '", "'first want to check the network connection.'", "%", "arg_1", "arg_0", ".", "restart_kernel", "(", "arg_2", ",", "now", "=", "True", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handle the kernel's death by asking if the user wants to restart.\n        \"\"\"\n        arg_0.log.debug(\"kernel died: %s\", arg_1)\n        if arg_0.custom_restart:\n            arg_0.custom_restart_kernel_died.emit(arg_1)\n        else:\n            arg_2 = 'The kernel heartbeat has been inactive for %.2f ' \\\n                'seconds. Do you want to restart the kernel? You may ' \\\n                'first want to check the network connection.' % \\\n                arg_1\n            arg_0.restart_kernel(arg_2, now=True)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._handle_kernel_died", "docstring": "Handle the kernel's death by asking if the user wants to restart.", "docstring_tokens": ["Handle", "the", "kernel", "s", "death", "by", "asking", "if", "the", "user", "wants", "to", "restart", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256984}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/packager.py#L389-L403", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Uninstalls all blacklisted packages.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "burlap", ".", "system", "import", "distrib_family", "arg_1", "=", "arg_0", ".", "env", ".", "blacklisted_packages", "if", "not", "arg_1", ":", "print", "(", "'No blacklisted packages.'", ")", "return", "else", ":", "arg_2", "=", "distrib_family", "(", ")", "if", "arg_2", "==", "DEBIAN", ":", "arg_0", ".", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive apt-get -yq purge %s'", "%", "' '", ".", "join", "(", "arg_1", ")", ")", "else", ":", "raise", "NotImplementedError", "(", "'Unknown family: %s'", "%", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Uninstalls all blacklisted packages.\n        \"\"\"\n        from burlap.system import distrib_family\n        arg_1 = arg_0.env.blacklisted_packages\n        if not arg_1:\n            print('No blacklisted packages.')\n            return\n        else:\n            arg_2 = distrib_family()\n            if arg_2 == DEBIAN:\n                arg_0.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq purge %s' % ' '.join(arg_1))\n            else:\n                raise NotImplementedError('Unknown family: %s' % arg_2)", "path": "burlap/packager.py", "identifier": "PackagerSatchel.uninstall_blacklisted", "docstring": "Uninstalls all blacklisted packages.", "docstring_tokens": ["Uninstalls", "all", "blacklisted", "packages", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256985}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py#L823-L914", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Push one or more lines of IPython input.", "language": "python", "parameters": "(self, lines)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "return", "super", "(", "IPythonInputSplitter", ",", "arg_0", ")", ".", "push", "(", "arg_1", ")", "arg_1", "=", "cast_unicode", "(", "arg_1", ",", "arg_0", ".", "encoding", ")", "if", "arg_1", ".", "startswith", "(", "'%%'", ")", "and", "not", "(", "len", "(", "arg_1", ".", "splitlines", "(", ")", ")", "==", "1", "and", "arg_1", ".", "strip", "(", ")", ".", "endswith", "(", "'?'", ")", ")", ":", "return", "arg_0", ".", "_handle_cell_magic", "(", "arg_1", ")", "if", "arg_0", ".", "input_mode", "==", "'line'", "and", "arg_0", ".", "processing_cell_magic", ":", "return", "arg_0", ".", "_line_mode_cell_append", "(", "arg_1", ")", "arg_2", "=", "arg_1", ".", "splitlines", "(", ")", "arg_3", "=", "[", "transform_ipy_prompt", ",", "transform_classic_prompt", ",", "transform_help_end", ",", "transform_escaped", ",", "transform_assign_system", ",", "transform_assign_magic", "]", "arg_4", "=", "False", "if", "arg_0", ".", "input_mode", "==", "'cell'", ":", "arg_0", ".", "reset", "(", ")", "arg_4", "=", "True", "arg_5", "=", "'cell'", "arg_0", ".", "input_mode", "=", "'line'", "arg_0", ".", "_store", "(", "arg_1", ",", "arg_0", ".", "_buffer_raw", ",", "'source_raw'", ")", "try", ":", "Func", "=", "super", "(", "IPythonInputSplitter", ",", "arg_0", ")", ".", "push", "arg_8", "=", "arg_0", ".", "_buffer", "for", "arg_9", "in", "arg_2", ":", "if", "arg_0", ".", "_is_complete", "or", "not", "arg_8", "or", "(", "arg_8", "and", "arg_8", "[", "-", "1", "]", ".", "rstrip", "(", ")", ".", "endswith", "(", "(", "':'", ",", "','", ")", ")", ")", ":", "for", "arg_10", "in", "arg_3", ":", "arg_9", "=", "arg_10", "(", "arg_9", ")", "arg_11", "=", "Func", "(", "arg_9", ")", "finally", ":", "if", "arg_4", ":", "arg_0", ".", "input_mode", "=", "arg_5", "return", "arg_11"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Push one or more lines of IPython input.\n\n        This stores the given lines and returns a status code indicating\n        whether the code forms a complete Python block or not, after processing\n        all input lines for special IPython syntax.\n\n        Any exceptions generated in compilation are swallowed, but if an\n        exception was produced, the method returns True.\n\n        Parameters\n        ----------\n        lines : string\n          One or more lines of Python input.\n\n        Returns\n        -------\n        is_complete : boolean\n          True if the current input source (the result of the current input\n        plus prior inputs) forms a complete Python execution block.  Note that\n        this value is also stored as a private attribute (_is_complete), so it\n        can be queried at any time.\n        \"\"\"\n        if not arg_1:\n            return super(IPythonInputSplitter, arg_0).push(arg_1)\n\n        # We must ensure all input is pure unicode\n        arg_1 = cast_unicode(arg_1, arg_0.encoding)\n\n        # If the entire input block is a cell magic, return after handling it\n        # as the rest of the transformation logic should be skipped.\n        if arg_1.startswith('%%') and not \\\n          (len(arg_1.splitlines()) == 1 and arg_1.strip().endswith('?')):\n            return arg_0._handle_cell_magic(arg_1)\n\n        # In line mode, a cell magic can arrive in separate pieces\n        if arg_0.input_mode == 'line' and arg_0.processing_cell_magic:\n            return arg_0._line_mode_cell_append(arg_1)\n\n        # The rest of the processing is for 'normal' content, i.e. IPython\n        # source that we process through our transformations pipeline.\n        arg_2 = arg_1.splitlines()\n\n        arg_3 = [transform_ipy_prompt, transform_classic_prompt,\n                      transform_help_end, transform_escaped,\n                      transform_assign_system, transform_assign_magic]\n\n        # Transform logic\n        #\n        # We only apply the line transformers to the input if we have either no\n        # input yet, or complete input, or if the last line of the buffer ends\n        # with ':' (opening an indented block).  This prevents the accidental\n        # transformation of escapes inside multiline expressions like\n        # triple-quoted strings or parenthesized expressions.\n        #\n        # The last heuristic, while ugly, ensures that the first line of an\n        # indented block is correctly transformed.\n        #\n        # FIXME: try to find a cleaner approach for this last bit.\n\n        # If we were in 'block' mode, since we're going to pump the parent\n        # class by hand line by line, we need to temporarily switch out to\n        # 'line' mode, do a single manual reset and then feed the lines one\n        # by one.  Note that this only matters if the input has more than one\n        # line.\n        arg_4 = False\n\n        if arg_0.input_mode == 'cell':\n            arg_0.reset()\n            arg_4 = True\n            arg_5 = 'cell'\n            arg_0.input_mode = 'line'\n\n        # Store raw source before applying any transformations to it.  Note\n        # that this must be done *after* the reset() call that would otherwise\n        # flush the buffer.\n        arg_0._store(arg_1, arg_0._buffer_raw, 'source_raw')\n        \n        try:\n            Func = super(IPythonInputSplitter, arg_0).push\n            arg_8 = arg_0._buffer\n            for arg_9 in arg_2:\n                if arg_0._is_complete or not arg_8 or \\\n                       (arg_8 and arg_8[-1].rstrip().endswith((':', ','))):\n                    for arg_10 in arg_3:\n                        arg_9 = arg_10(arg_9)\n\n                arg_11 = Func(arg_9)\n        finally:\n            if arg_4:\n                arg_0.input_mode = arg_5\n        return arg_11", "path": "environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py", "identifier": "IPythonInputSplitter.push", "docstring": "Push one or more lines of IPython input.\n\n        This stores the given lines and returns a status code indicating\n        whether the code forms a complete Python block or not, after processing\n        all input lines for special IPython syntax.\n\n        Any exceptions generated in compilation are swallowed, but if an\n        exception was produced, the method returns True.\n\n        Parameters\n        ----------\n        lines : string\n          One or more lines of Python input.\n\n        Returns\n        -------\n        is_complete : boolean\n          True if the current input source (the result of the current input\n        plus prior inputs) forms a complete Python execution block.  Note that\n        this value is also stored as a private attribute (_is_complete), so it\n        can be queried at any time.", "docstring_tokens": ["Push", "one", "or", "more", "lines", "of", "IPython", "input", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 256986}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/system.py#L41-L82", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Get the OS distribution ID.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "arg_0", "=", "(", "run", "(", "'uname -s'", ")", "or", "''", ")", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "arg_0", "==", "LINUX", ":", "if", "is_file", "(", "'/usr/bin/lsb_release'", ")", ":", "arg_1", "=", "run", "(", "'lsb_release --id --short'", ")", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "id", "in", "[", "'arch'", ",", "'archlinux'", "]", ":", "arg_1", "=", "ARCH", "return", "arg_1", "else", ":", "if", "is_file", "(", "'/etc/debian_version'", ")", ":", "return", "DEBIAN", "elif", "is_file", "(", "'/etc/fedora-release'", ")", ":", "return", "FEDORA", "elif", "is_file", "(", "'/etc/arch-release'", ")", ":", "return", "ARCH", "elif", "is_file", "(", "'/etc/redhat-release'", ")", ":", "arg_2", "=", "run", "(", "'cat /etc/redhat-release'", ")", "if", "arg_2", ".", "startswith", "(", "'Red Hat Enterprise Linux'", ")", ":", "return", "REDHAT", "elif", "arg_2", ".", "startswith", "(", "'CentOS'", ")", ":", "return", "CENTOS", "elif", "arg_2", ".", "startswith", "(", "'Scientific Linux'", ")", ":", "return", "SLES", "elif", "is_file", "(", "'/etc/gentoo-release'", ")", ":", "return", "GENTOO", "elif", "arg_0", "==", "SUNOS", ":", "return", "SUNOS"], "function": "def Func():\n    \"\"\"\n    Get the OS distribution ID.\n\n    Example::\n\n        from burlap.system import Func\n\n        if Func() != 'Debian':\n            abort(u\"Distribution is not supported\")\n\n    \"\"\"\n\n    with settings(hide('running', 'stdout')):\n        arg_0 = (run('uname -s') or '').strip().lower()\n        if arg_0 == LINUX:\n            # lsb_release works on Ubuntu and Debian >= 6.0\n            # but is not always included in other distros\n            if is_file('/usr/bin/lsb_release'):\n                arg_1 = run('lsb_release --id --short').strip().lower()\n                if id in ['arch', 'archlinux']:  # old IDs used before lsb-release 1.4-14\n                    arg_1 = ARCH\n                return arg_1\n            else:\n                if is_file('/etc/debian_version'):\n                    return DEBIAN\n                elif is_file('/etc/fedora-release'):\n                    return FEDORA\n                elif is_file('/etc/arch-release'):\n                    return ARCH\n                elif is_file('/etc/redhat-release'):\n                    arg_2 = run('cat /etc/redhat-release')\n                    if arg_2.startswith('Red Hat Enterprise Linux'):\n                        return REDHAT\n                    elif arg_2.startswith('CentOS'):\n                        return CENTOS\n                    elif arg_2.startswith('Scientific Linux'):\n                        return SLES\n                elif is_file('/etc/gentoo-release'):\n                    return GENTOO\n        elif arg_0 == SUNOS:\n            return SUNOS", "path": "burlap/system.py", "identifier": "distrib_id", "docstring": "Get the OS distribution ID.\n\n    Example::\n\n        from burlap.system import distrib_id\n\n        if distrib_id() != 'Debian':\n            abort(u\"Distribution is not supported\")", "docstring_tokens": ["Get", "the", "OS", "distribution", "ID", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 256987}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L418-L427", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Return a string as hex dump.", "language": "python", "parameters": "(s)", "return_statement": "return \"{}\".format(s)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "compat", ".", "is_bytes", "(", "arg_0", ")", ":", "arg_1", "=", "\"{!r}: \"", ".", "format", "(", "arg_0", ")", "for", "arg_2", "in", "arg_0", ":", "if", "type", "(", "arg_2", ")", "is", "str", ":", "arg_2", "=", "ord", "(", "arg_2", ")", "arg_1", "+=", "\"%02x \"", "%", "arg_2", "return", "arg_1", "return", "\"{}\"", ".", "format", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Return a string as hex dump.\"\"\"\n    if compat.is_bytes(arg_0):\n        arg_1 = \"{!r}: \".format(arg_0)\n        for arg_2 in arg_0:\n            if type(arg_2) is str:  # Py2\n                arg_2 = ord(arg_2)\n            arg_1 += \"%02x \" % arg_2\n        return arg_1\n    return \"{}\".format(arg_0)", "path": "wsgidav/util.py", "identifier": "string_repr", "docstring": "Return a string as hex dump.", "docstring_tokens": ["Return", "a", "string", "as", "hex", "dump", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 256988}
{"url": "https://github.com/nesdis/djongo/blob/7f9d79455cf030cb5eee0b822502c50a0d9d3abb/djongo/models/fields.py#L507-L517", "sha": "7f9d79455cf030cb5eee0b822502c50a0d9d3abb", "docstring_summary": "Overrides Django's default to_python to allow correct\r\n        translation to instance.", "language": "python", "parameters": "(self, value)", "return_statement": "return instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", "or", "isinstance", "(", "arg_1", ",", "arg_0", ".", "model_container", ")", ":", "return", "arg_1", "assert", "isinstance", "(", "arg_1", ",", "dict", ")", "arg_2", "=", "make_mdl", "(", "arg_0", ".", "model_container", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"\r\n        Overrides Django's default Func to allow correct\r\n        translation to instance.\r\n        \"\"\"\r\n        if arg_1 is None or isinstance(arg_1, arg_0.model_container):\r\n            return arg_1\r\n        assert isinstance(arg_1, dict)\r\n\r\n        arg_2 = make_mdl(arg_0.model_container, arg_1)\r\n        return arg_2", "path": "djongo/models/fields.py", "identifier": "EmbeddedModelField.to_python", "docstring": "Overrides Django's default to_python to allow correct\r\n        translation to instance.", "docstring_tokens": ["Overrides", "Django", "s", "default", "to_python", "to", "allow", "correct", "translation", "to", "instance", "."], "nwo": "nesdis/djongo", "score": 0.9667508002289729, "idx": 256989}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L853-L860", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Get item with max key of tree, raises ValueError if tree is empty.", "language": "python", "parameters": "(self)", "return_statement": "return node.key, node.value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "is_empty", "(", ")", ":", "raise", "ValueError", "(", "\"Tree is empty\"", ")", "arg_1", "=", "arg_0", ".", "_root", "while", "arg_1", ".", "right", "is", "not", "None", ":", "arg_1", "=", "arg_1", ".", "right", "return", "arg_1", ".", "key", ",", "arg_1", ".", "value"], "function": "def Func(arg_0):\n        \"\"\"Get item with max key of tree, raises ValueError if tree is empty.\"\"\"\n        if arg_0.is_empty():\n            raise ValueError(\"Tree is empty\")\n        arg_1 = arg_0._root\n        while arg_1.right is not None:\n            arg_1 = arg_1.right\n        return arg_1.key, arg_1.value", "path": "imgaug/external/poly_point_isect_py2py3.py", "identifier": "_ABCTree.max_item", "docstring": "Get item with max key of tree, raises ValueError if tree is empty.", "docstring_tokens": ["Get", "item", "with", "max", "key", "of", "tree", "raises", "ValueError", "if", "tree", "is", "empty", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 256990}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L1541-L1589", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Error handler for HTTP requests", "language": "python", "parameters": "(req)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "400", ":", "ze", ".", "UnsupportedParams", ",", "401", ":", "ze", ".", "UserNotAuthorised", ",", "403", ":", "ze", ".", "UserNotAuthorised", ",", "404", ":", "ze", ".", "ResourceNotFound", ",", "409", ":", "ze", ".", "Conflict", ",", "412", ":", "ze", ".", "PreConditionFailed", ",", "413", ":", "ze", ".", "RequestEntityTooLarge", ",", "428", ":", "ze", ".", "PreConditionRequired", ",", "429", ":", "ze", ".", "TooManyRequests", ",", "}", "def", "err_msg", "(", "arg_0", ")", ":", "return", "\"\\nCode: %s\\nURL: %s\\nMethod: %s\\nResponse: %s\"", "%", "(", "arg_0", ".", "status_code", ",", "arg_0", ".", "url", ",", "arg_0", ".", "request", ".", "method", ",", "arg_0", ".", "text", ",", ")", "if", "arg_1", ".", "get", "(", "arg_0", ".", "status_code", ")", ":", "if", "arg_0", ".", "status_code", "==", "429", ":", "arg_2", "=", "backoff", ".", "delay", "if", "arg_2", ">", "32", ":", "backoff", ".", "reset", "(", ")", "raise", "ze", ".", "TooManyRetries", "(", "\"Continuing to receive HTTP 429 \\responses after 62 seconds. You are being rate-limited, try again later\"", ")", "time", ".", "sleep", "(", "arg_2", ")", "arg_3", "=", "requests", ".", "Session", "(", ")", "arg_4", "=", "arg_3", ".", "send", "(", "arg_0", ".", "request", ")", "try", ":", "arg_4", ".", "raise_for_status", "(", ")", "except", "requests", ".", "exceptions", ".", "HTTPError", ":", "Func", "(", "arg_4", ")", "else", ":", "raise", "arg_1", ".", "get", "(", "arg_0", ".", "status_code", ")", "(", "err_msg", "(", "arg_0", ")", ")", "else", ":", "raise", "ze", ".", "HTTPError", "(", "err_msg", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\" Error handler for HTTP requests\n    \"\"\"\n    arg_1 = {\n        400: ze.UnsupportedParams,\n        401: ze.UserNotAuthorised,\n        403: ze.UserNotAuthorised,\n        404: ze.ResourceNotFound,\n        409: ze.Conflict,\n        412: ze.PreConditionFailed,\n        413: ze.RequestEntityTooLarge,\n        428: ze.PreConditionRequired,\n        429: ze.TooManyRequests,\n    }\n\n    def err_msg(arg_0):\n        \"\"\" Return a nicely-formatted error message\n        \"\"\"\n        return \"\\nCode: %s\\nURL: %s\\nMethod: %s\\nResponse: %s\" % (\n            arg_0.status_code,\n            # error.msg,\n            arg_0.url,\n            arg_0.request.method,\n            arg_0.text,\n        )\n\n    if arg_1.get(arg_0.status_code):\n        # check to see whether its 429\n        if arg_0.status_code == 429:\n            # call our back-off function\n            arg_2 = backoff.delay\n            if arg_2 > 32:\n                # we've waited a total of 62 seconds (2 + 4 \u2026 + 32), so give up\n                backoff.reset()\n                raise ze.TooManyRetries(\n                    \"Continuing to receive HTTP 429 \\\nresponses after 62 seconds. You are being rate-limited, try again later\"\n                )\n            time.sleep(arg_2)\n            arg_3 = requests.Session()\n            arg_4 = arg_3.send(arg_0.request)\n            try:\n                arg_4.raise_for_status()\n            except requests.exceptions.HTTPError:\n                Func(arg_4)\n        else:\n            raise arg_1.get(arg_0.status_code)(err_msg(arg_0))\n    else:\n        raise ze.HTTPError(err_msg(arg_0))", "path": "pyzotero/zotero.py", "identifier": "error_handler", "docstring": "Error handler for HTTP requests", "docstring_tokens": ["Error", "handler", "for", "HTTP", "requests"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 256991}
{"url": "https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/lorem_ipsum.py#L96-L120", "sha": "e15f2e59538deb4cbfceaac314f5ea897f2d5450", "docstring_summary": "Return random paragraphs.", "language": "python", "parameters": "(quantity=2, separator='\\n\\n', wrap_start='', wrap_end='',\n               html=False, sentences_quantity=3, as_list=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "2", ",", "arg_1", "=", "'\\n\\n'", ",", "arg_2", "=", "''", ",", "arg_3", "=", "''", ",", "arg_4", "=", "False", ",", "arg_5", "=", "3", ",", "arg_6", "=", "False", ")", ":", "if", "arg_4", ":", "arg_2", "=", "'<p>'", "arg_3", "=", "'</p>'", "arg_1", "=", "'\\n\\n'", "arg_7", "=", "[", "]", "try", ":", "for", "arg_8", "in", "xrange", "(", "0", ",", "arg_0", ")", ":", "arg_7", ".", "append", "(", "arg_2", "+", "sentences", "(", "arg_5", ")", "+", "arg_3", ")", "except", "NameError", ":", "for", "arg_8", "in", "range", "(", "0", ",", "arg_0", ")", ":", "arg_7", ".", "append", "(", "arg_2", "+", "sentences", "(", "arg_5", ")", "+", "arg_3", ")", "if", "arg_6", ":", "return", "arg_7", "else", ":", "return", "arg_1", ".", "join", "(", "arg_7", ")"], "function": "def Func(arg_0=2, arg_1='\\n\\n', arg_2='', arg_3='',\n               arg_4=False, arg_5=3, arg_6=False):\n    \"\"\"Return random Func.\"\"\"\n    if arg_4:\n        arg_2 = '<p>'\n        arg_3 = '</p>'\n        arg_1 = '\\n\\n'\n\n    arg_7 = []\n    try:\n        for arg_8 in xrange(0, arg_0):\n            arg_7.append(arg_2 +\n                          sentences(arg_5) +\n                          arg_3)\n    # Python 3 compatibility\n    except NameError:\n        for arg_8 in range(0, arg_0):\n            arg_7.append(arg_2 +\n                          sentences(arg_5) +\n                          arg_3)\n\n    if arg_6:\n        return arg_7\n    else:\n        return arg_1.join(arg_7)", "path": "forgery_py/forgery/lorem_ipsum.py", "identifier": "paragraphs", "docstring": "Return random paragraphs.", "docstring_tokens": ["Return", "random", "paragraphs", "."], "nwo": "pilosus/ForgeryPy3", "score": 0.3588333959790546, "idx": 256992}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Telegraf/plugin.py#L72-L116", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "we need to be flexible in order to determine which plugin's configuration\n        specified and make appropriate configs to metrics collector", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "core", ".", "get_option", "(", "'telegraf'", ",", "\"config\"", ")", "except", "KeyError", ":", "arg_1", "=", "None", "try", ":", "arg_2", "=", "arg_0", ".", "core", ".", "get_option", "(", "'monitoring'", ",", "\"config\"", ")", "except", "KeyError", ":", "arg_2", "=", "None", "if", "arg_1", "and", "arg_2", ":", "raise", "ValueError", "(", "'Both telegraf and monitoring configs specified. '", "'Clean up your config and delete one of them'", ")", "if", "arg_1", "and", "not", "arg_2", ":", "return", "'telegraf'", "if", "not", "arg_1", "and", "arg_2", ":", "return", "'monitoring'", "if", "not", "arg_1", "and", "not", "arg_2", ":", "try", ":", "arg_3", "=", "arg_0", ".", "core", ".", "get_option", "(", "'telegraf'", ")", "except", "NoOptionError", ":", "arg_3", "=", "None", "try", ":", "arg_4", "=", "arg_0", ".", "core", ".", "get_option", "(", "'monitoring'", ")", "except", "BaseException", ":", "arg_4", "=", "None", "if", "arg_3", "and", "arg_4", ":", "raise", "ValueError", "(", "'Both telegraf and monitoring default targets specified. '", "'Clean up your config and delete one of them'", ")", "if", "arg_3", "and", "not", "arg_4", ":", "return", "if", "not", "arg_3", "and", "arg_4", ":", "arg_0", ".", "core", ".", "set_option", "(", "\"telegraf\"", ",", "\"default_target\"", ",", "arg_4", ")", "if", "not", "arg_3", "and", "not", "arg_4", ":", "return"], "function": "def Func(arg_0):\n        \"\"\"\n        we need to be flexible in order to determine which plugin's configuration\n        specified and make appropriate configs to metrics collector\n\n        :return: SECTION name or None for defaults\n        \"\"\"\n        try:\n            arg_1 = arg_0.core.get_option('telegraf', \"config\")\n        except KeyError:\n            arg_1 = None\n        try:\n            arg_2 = arg_0.core.get_option('monitoring', \"config\")\n        except KeyError:\n            arg_2 = None\n\n        if arg_1 and arg_2:\n            raise ValueError(\n                'Both telegraf and monitoring configs specified. '\n                'Clean up your config and delete one of them')\n        if arg_1 and not arg_2:\n            return 'telegraf'\n        if not arg_1 and arg_2:\n            return 'monitoring'\n        if not arg_1 and not arg_2:\n            # defaults target logic\n            try:\n                arg_3 = arg_0.core.get_option('telegraf')\n            except NoOptionError:\n                arg_3 = None\n            try:\n                arg_4 = arg_0.core.get_option('monitoring')\n            except BaseException:\n                arg_4 = None\n            if arg_3 and arg_4:\n                raise ValueError(\n                    'Both telegraf and monitoring default targets specified. '\n                    'Clean up your config and delete one of them')\n            if arg_3 and not arg_4:\n                return\n            if not arg_3 and arg_4:\n                arg_0.core.set_option(\n                    \"telegraf\", \"default_target\", arg_4)\n            if not arg_3 and not arg_4:\n                return", "path": "yandextank/plugins/Telegraf/plugin.py", "identifier": "Plugin.__detect_configuration", "docstring": "we need to be flexible in order to determine which plugin's configuration\n        specified and make appropriate configs to metrics collector\n\n        :return: SECTION name or None for defaults", "docstring_tokens": ["we", "need", "to", "be", "flexible", "in", "order", "to", "determine", "which", "plugin", "s", "configuration", "specified", "and", "make", "appropriate", "configs", "to", "metrics", "collector"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 256993}
{"url": "https://github.com/jpmml/sklearn2pmml/blob/0a455a54323989473c16f9efc9a77cef3ff64c1e/sklearn2pmml/__init__.py#L284-L300", "sha": "0a455a54323989473c16f9efc9a77cef3ff64c1e", "docstring_summary": "Translates a regular TPOT configuration to a PMML-compatible TPOT configuration.", "language": "python", "parameters": "(config, user_classpath = [])", "return_statement": "return { key : config[key] for key in (tpot_keys).intersection(pmml_keys)}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ")", ":", "arg_2", "=", "set", "(", "arg_0", ".", "keys", "(", ")", ")", "arg_3", "=", "_supported_classes", "(", "arg_1", ")", "arg_4", "=", "(", "set", "(", "arg_3", ")", ")", ".", "union", "(", "set", "(", "[", "_strip_module", "(", "class_", ")", "for", "class_", "in", "arg_3", "]", ")", ")", "return", "{", "arg_5", ":", "arg_0", "[", "arg_5", "]", "for", "arg_5", "in", "(", "arg_2", ")", ".", "intersection", "(", "arg_4", ")", "}"], "function": "def Func(arg_0, arg_1 = []):\n\t\"\"\"Translates a regular TPOT configuration to a PMML-compatible TPOT configuration.\n\n\tParameters:\n\t----------\n\tobj: config\n\t\tThe configuration dictionary.\n\n\tuser_classpath: list of strings, optional\n\t\tThe paths to JAR files that provide custom Transformer, Selector and/or Estimator converter classes.\n\t\tThe JPMML-SkLearn classpath is constructed by appending user JAR files to package JAR files.\n\n\t\"\"\"\n\targ_2 = set(arg_0.keys())\n\targ_3 = _supported_classes(arg_1)\n\targ_4 = (set(arg_3)).union(set([_strip_module(class_) for class_ in arg_3]))\n\treturn { arg_5 : arg_0[arg_5] for arg_5 in (arg_2).intersection(arg_4)}", "path": "sklearn2pmml/__init__.py", "identifier": "make_tpot_pmml_config", "docstring": "Translates a regular TPOT configuration to a PMML-compatible TPOT configuration.\n\n\tParameters:\n\t----------\n\tobj: config\n\t\tThe configuration dictionary.\n\n\tuser_classpath: list of strings, optional\n\t\tThe paths to JAR files that provide custom Transformer, Selector and/or Estimator converter classes.\n\t\tThe JPMML-SkLearn classpath is constructed by appending user JAR files to package JAR files.", "docstring_tokens": ["Translates", "a", "regular", "TPOT", "configuration", "to", "a", "PMML", "-", "compatible", "TPOT", "configuration", "."], "nwo": "jpmml/sklearn2pmml", "score": 0.5918311180058746, "idx": 256994}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L150-L164", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Clears any state left in this checker from last module checked.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_logging_names", "=", "set", "(", ")", "arg_3", "=", "arg_0", ".", "config", ".", "logging_modules", "arg_0", ".", "_format_style", "=", "arg_0", ".", "config", ".", "logging_format_style", "arg_0", ".", "_logging_modules", "=", "set", "(", "arg_3", ")", "arg_0", ".", "_from_imports", "=", "{", "}", "for", "arg_7", "in", "arg_3", ":", "arg_8", "=", "arg_7", ".", "rsplit", "(", "\".\"", ",", "1", ")", "if", "len", "(", "arg_8", ")", ">", "1", ":", "arg_0", ".", "_from_imports", "[", "arg_8", "[", "0", "]", "]", "=", "arg_8", "[", "1", "]"], "function": "def Func(arg_0, arg_1):  # pylint: disable=unused-argument\n        \"\"\"Clears any state left in this checker from last module checked.\"\"\"\n        # The code being checked can just as easily \"import logging as foo\",\n        # so it is necessary to process the imports and store in this field\n        # what name the logging module is actually given.\n        arg_0._logging_names = set()\n        arg_3 = arg_0.config.logging_modules\n\n        arg_0._format_style = arg_0.config.logging_format_style\n        arg_0._logging_modules = set(arg_3)\n        arg_0._from_imports = {}\n        for arg_7 in arg_3:\n            arg_8 = arg_7.rsplit(\".\", 1)\n            if len(arg_8) > 1:\n                arg_0._from_imports[arg_8[0]] = arg_8[1]", "path": "pylint/checkers/logging.py", "identifier": "LoggingChecker.visit_module", "docstring": "Clears any state left in this checker from last module checked.", "docstring_tokens": ["Clears", "any", "state", "left", "in", "this", "checker", "from", "last", "module", "checked", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 256995}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/examples/compute_features.py#L28-L34", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Computes all features for the given file.", "language": "python", "parameters": "(file_struct, framesync)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "msaf", ".", "features_registry", ":", "logging", ".", "info", "(", "\"Computing %s for file %s\"", "%", "(", "arg_2", ",", "arg_0", ".", "audio_file", ")", ")", "arg_3", "=", "Features", ".", "select_features", "(", "arg_2", ",", "arg_0", ",", "False", ",", "arg_1", ")", "arg_3", ".", "features"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Computes all features for the given file.\"\"\"\n    for arg_2 in msaf.features_registry:\n        logging.info(\"Computing %s for file %s\" % (arg_2,\n                                                   arg_0.audio_file))\n        arg_3 = Features.select_features(arg_2, arg_0, False, arg_1)\n        arg_3.features", "path": "examples/compute_features.py", "identifier": "compute_all_features", "docstring": "Computes all features for the given file.", "docstring_tokens": ["Computes", "all", "features", "for", "the", "given", "file", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 256996}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L2162-L2195", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Produces the content of `output_tensor` only after `dependencies`.", "language": "python", "parameters": "(dependencies, output_tensor, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "tf", ".", "executing_eagerly", "(", ")", ":", "return", "arg_1", "with", "tf", ".", "name_scope", "(", "arg_2", "or", "\"control_dependency\"", ")", "as", "arg_2", ":", "with", "tf", ".", "control_dependencies", "(", "arg_3", "for", "arg_3", "in", "arg_0", "if", "arg_3", "is", "not", "None", ")", ":", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ")", "if", "isinstance", "(", "arg_1", ",", "tf", ".", "Tensor", ")", ":", "return", "tf", ".", "identity", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "else", ":", "return", "tf", ".", "IndexedSlices", "(", "tf", ".", "identity", "(", "arg_1", ".", "values", ",", "arg_2", "=", "arg_2", ")", ",", "arg_1", ".", "indices", ",", "arg_1", ".", "dense_shape", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n  \"\"\"Produces the content of `output_tensor` only after `dependencies`.\n\n  In some cases, a user may want the output of an operation to be consumed\n  externally only after some other dependencies have run first. This function\n  returns `output_tensor`, but only after all operations in `dependencies` have\n  run. Note that this means that there is no guarantee that `output_tensor` will\n  be evaluated after any `dependencies` have run.\n\n  See also `tf.tuple` and `tf.group`.\n\n  Args:\n    dependencies: Iterable of operations to run before this op finishes.\n    output_tensor: A `Tensor` or `IndexedSlices` that will be returned.\n    name: (Optional) A name for this operation.\n\n  Returns:\n    output_with_deps: Same as `output_tensor` but with embedded dependencies.\n\n  Raises:\n    TypeError: if `output_tensor` is not a `Tensor` or `IndexedSlices`.\n  \"\"\"\n  if tf.executing_eagerly():\n    return arg_1\n  with tf.name_scope(arg_2 or \"control_dependency\") as arg_2:\n    with tf.control_dependencies(arg_3 for arg_3 in arg_0 if arg_3 is not None):\n      arg_1 = tf.convert_to_tensor(value=arg_1)\n      if isinstance(arg_1, tf.Tensor):\n        return tf.identity(arg_1, arg_2=arg_2)\n      else:\n        return tf.IndexedSlices(\n            tf.identity(arg_1.values, arg_2=arg_2),\n            arg_1.indices,\n            arg_1.dense_shape)", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "with_dependencies", "docstring": "Produces the content of `output_tensor` only after `dependencies`.\n\n  In some cases, a user may want the output of an operation to be consumed\n  externally only after some other dependencies have run first. This function\n  returns `output_tensor`, but only after all operations in `dependencies` have\n  run. Note that this means that there is no guarantee that `output_tensor` will\n  be evaluated after any `dependencies` have run.\n\n  See also `tf.tuple` and `tf.group`.\n\n  Args:\n    dependencies: Iterable of operations to run before this op finishes.\n    output_tensor: A `Tensor` or `IndexedSlices` that will be returned.\n    name: (Optional) A name for this operation.\n\n  Returns:\n    output_with_deps: Same as `output_tensor` but with embedded dependencies.\n\n  Raises:\n    TypeError: if `output_tensor` is not a `Tensor` or `IndexedSlices`.", "docstring_tokens": ["Produces", "the", "content", "of", "output_tensor", "only", "after", "dependencies", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 256997}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L1111-L1146", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Generates a JSON string with the params to be used\n        when sending CONNECT to the server.", "language": "python", "parameters": "(self)", "return_statement": "return b''.join([CONNECT_OP + _SPC_ + connect_opts.encode() + _CRLF_])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"verbose\"", ":", "arg_0", ".", "options", "[", "\"verbose\"", "]", ",", "\"pedantic\"", ":", "arg_0", ".", "options", "[", "\"pedantic\"", "]", ",", "\"lang\"", ":", "__lang__", ",", "\"version\"", ":", "__version__", ",", "\"protocol\"", ":", "PROTOCOL", "}", "if", "\"auth_required\"", "in", "arg_0", ".", "_server_info", ":", "if", "arg_0", ".", "_server_info", "[", "\"auth_required\"", "]", ":", "if", "arg_0", ".", "options", "[", "\"user\"", "]", "is", "not", "None", "and", "arg_0", ".", "options", "[", "\"password\"", "]", "is", "not", "None", ":", "arg_1", "[", "\"user\"", "]", "=", "arg_0", ".", "options", "[", "\"user\"", "]", "arg_1", "[", "\"pass\"", "]", "=", "arg_0", ".", "options", "[", "\"password\"", "]", "elif", "arg_0", ".", "options", "[", "\"token\"", "]", "is", "not", "None", ":", "arg_1", "[", "\"auth_token\"", "]", "=", "arg_0", ".", "options", "[", "\"token\"", "]", "elif", "arg_0", ".", "_current_server", ".", "uri", ".", "password", "is", "None", ":", "arg_1", "[", "\"auth_token\"", "]", "=", "arg_0", ".", "_current_server", ".", "uri", ".", "username", "else", ":", "arg_1", "[", "\"user\"", "]", "=", "arg_0", ".", "_current_server", ".", "uri", ".", "username", "arg_1", "[", "\"pass\"", "]", "=", "arg_0", ".", "_current_server", ".", "uri", ".", "password", "if", "arg_0", ".", "options", "[", "\"name\"", "]", "is", "not", "None", ":", "arg_1", "[", "\"name\"", "]", "=", "arg_0", ".", "options", "[", "\"name\"", "]", "if", "arg_0", ".", "options", "[", "\"no_echo\"", "]", "is", "not", "None", ":", "arg_1", "[", "\"echo\"", "]", "=", "not", "arg_0", ".", "options", "[", "\"no_echo\"", "]", "arg_2", "=", "json", ".", "dumps", "(", "arg_1", ",", "sort_keys", "=", "True", ")", "return", "b''", ".", "join", "(", "[", "CONNECT_OP", "+", "_SPC_", "+", "arg_2", ".", "encode", "(", ")", "+", "_CRLF_", "]", ")"], "function": "def Func(arg_0):\n        '''\n        Generates a JSON string with the params to be used\n        when sending CONNECT to the server.\n\n          ->> CONNECT {\"lang\": \"python3\"}\n\n        '''\n        arg_1 = {\n            \"verbose\": arg_0.options[\"verbose\"],\n            \"pedantic\": arg_0.options[\"pedantic\"],\n            \"lang\": __lang__,\n            \"version\": __version__,\n            \"protocol\": PROTOCOL\n        }\n        if \"auth_required\" in arg_0._server_info:\n            if arg_0._server_info[\"auth_required\"]:\n                # In case there is no password, then consider handle\n                # sending a token instead.\n                if arg_0.options[\"user\"] is not None and arg_0.options[\"password\"] is not None:\n                    arg_1[\"user\"] = arg_0.options[\"user\"]\n                    arg_1[\"pass\"] = arg_0.options[\"password\"]\n                elif arg_0.options[\"token\"] is not None:\n                    arg_1[\"auth_token\"] = arg_0.options[\"token\"]\n                elif arg_0._current_server.uri.password is None:\n                    arg_1[\"auth_token\"] = arg_0._current_server.uri.username\n                else:\n                    arg_1[\"user\"] = arg_0._current_server.uri.username\n                    arg_1[\"pass\"] = arg_0._current_server.uri.password\n        if arg_0.options[\"name\"] is not None:\n            arg_1[\"name\"] = arg_0.options[\"name\"]\n        if arg_0.options[\"no_echo\"] is not None:\n            arg_1[\"echo\"] = not arg_0.options[\"no_echo\"]\n\n        arg_2 = json.dumps(arg_1, sort_keys=True)\n        return b''.join([CONNECT_OP + _SPC_ + arg_2.encode() + _CRLF_])", "path": "nats/aio/client.py", "identifier": "Client._connect_command", "docstring": "Generates a JSON string with the params to be used\n        when sending CONNECT to the server.\n\n          ->> CONNECT {\"lang\": \"python3\"}", "docstring_tokens": ["Generates", "a", "JSON", "string", "with", "the", "params", "to", "be", "used", "when", "sending", "CONNECT", "to", "the", "server", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 256998}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L571-L593", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Create the installation order.", "language": "python", "parameters": "(self)", "return_statement": "return order", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "set", "(", ")", "def", "schedule", "(", "arg_3", ")", ":", "if", "arg_3", ".", "satisfied_by", "or", "arg_3", "in", "arg_2", ":", "return", "arg_2", ".", "add", "(", "arg_3", ")", "for", "arg_4", "in", "arg_0", ".", "_dependencies", "[", "arg_3", "]", ":", "schedule", "(", "arg_4", ")", "arg_1", ".", "append", "(", "arg_3", ")", "for", "arg_5", "in", "arg_0", ".", "requirements", ".", "values", "(", ")", ":", "schedule", "(", "arg_5", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Create the installation order.\n\n        The installation order is topological - requirements are installed\n        before the requiring thing. We break cycles at an arbitrary point,\n        and make no other guarantees.\n        \"\"\"\n        # The current implementation, which we may change at any point\n        # installs the user specified things in the order given, except when\n        # dependencies must come earlier to achieve topological order.\n        arg_1 = []\n        arg_2 = set()\n\n        def schedule(arg_3):\n            if arg_3.satisfied_by or arg_3 in arg_2:\n                return\n            arg_2.add(arg_3)\n            for arg_4 in arg_0._dependencies[arg_3]:\n                schedule(arg_4)\n            arg_1.append(arg_3)\n        for arg_5 in arg_0.requirements.values():\n            schedule(arg_5)\n        return arg_1", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py", "identifier": "RequirementSet._to_install", "docstring": "Create the installation order.\n\n        The installation order is topological - requirements are installed\n        before the requiring thing. We break cycles at an arbitrary point,\n        and make no other guarantees.", "docstring_tokens": ["Create", "the", "installation", "order", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 256999}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/reaction.py#L962-L967", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "lists compartments the metabolites are in", "language": "python", "parameters": "(self)", "return_statement": "return self._compartments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Func", "is", "None", ":", "arg_0", ".", "_Func", "=", "{", "met", ".", "compartment", "for", "met", "in", "arg_0", ".", "_metabolites", "if", "met", ".", "compartment", "is", "not", "None", "}", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"lists Func the metabolites are in\"\"\"\n        if arg_0._Func is None:\n            arg_0._Func = {met.compartment for met in arg_0._metabolites\n                                  if met.compartment is not None}\n        return arg_0._Func", "path": "cobra/core/reaction.py", "identifier": "Reaction.compartments", "docstring": "lists compartments the metabolites are in", "docstring_tokens": ["lists", "compartments", "the", "metabolites", "are", "in"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 257000}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/frequency.py#L113-L147", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parsing of some custom sv frequencies\n    \n    These are very specific at the moment, this will hopefully get better over time when the\n    field of structural variants is more developed.", "language": "python", "parameters": "(variant)", "return_statement": "return sv_frequencies", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "'clingen_cgh_benignAF'", ",", "'clingen_cgh_benign'", ",", "'clingen_cgh_pathogenicAF'", ",", "'clingen_cgh_pathogenic'", ",", "'clingen_ngi'", ",", "'clingen_ngiAF'", ",", "'swegen'", ",", "'swegenAF'", ",", "'decipherAF'", ",", "'decipher'", "]", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "INFO", ".", "get", "(", "arg_3", ",", "0", ")", "if", "'AF'", "in", "arg_3", ":", "arg_4", "=", "float", "(", "arg_4", ")", "else", ":", "arg_4", "=", "int", "(", "arg_4", ")", "if", "arg_4", ">", "0", ":", "arg_2", "[", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Parsing of some custom sv frequencies\n    \n    These are very specific at the moment, this will hopefully get better over time when the\n    field of structural variants is more developed.\n\n    Args:\n        variant(cyvcf2.Variant)\n\n    Returns:\n        sv_frequencies(dict)\n    \"\"\"\n    arg_1 = [\n        'clingen_cgh_benignAF',\n        'clingen_cgh_benign',\n        'clingen_cgh_pathogenicAF',\n        'clingen_cgh_pathogenic',\n        'clingen_ngi',\n        'clingen_ngiAF',\n        'swegen',\n        'swegenAF',\n        'decipherAF',\n        'decipher'\n    ]\n    arg_2 = {}\n\n    for arg_3 in arg_1:\n        arg_4 = arg_0.INFO.get(arg_3, 0)\n        if 'AF' in arg_3:\n            arg_4 = float(arg_4)\n        else:\n            arg_4 = int(arg_4)\n        if arg_4 > 0:\n            arg_2[arg_3] = arg_4\n    return arg_2", "path": "scout/parse/variant/frequency.py", "identifier": "parse_sv_frequencies", "docstring": "Parsing of some custom sv frequencies\n    \n    These are very specific at the moment, this will hopefully get better over time when the\n    field of structural variants is more developed.\n\n    Args:\n        variant(cyvcf2.Variant)\n\n    Returns:\n        sv_frequencies(dict)", "docstring_tokens": ["Parsing", "of", "some", "custom", "sv", "frequencies", "These", "are", "very", "specific", "at", "the", "moment", "this", "will", "hopefully", "get", "better", "over", "time", "when", "the", "field", "of", "structural", "variants", "is", "more", "developed", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257001}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/audiosegment.py#L938-L948", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Serializes into a bytestring.", "language": "python", "parameters": "(self)", "return_statement": "return pickle.dumps({\n            'name': d['name'],\n            'seg': pickle.dumps(d['seg'], protocol=-1),\n        }, protocol=-1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "__getstate__", "(", ")", "return", "pickle", ".", "dumps", "(", "{", "'name'", ":", "arg_1", "[", "'name'", "]", ",", "'seg'", ":", "pickle", ".", "dumps", "(", "arg_1", "[", "'seg'", "]", ",", "protocol", "=", "-", "1", ")", ",", "}", ",", "protocol", "=", "-", "1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Serializes into a bytestring.\n\n        :returns: An object of type Bytes.\n        \"\"\"\n        arg_1 = arg_0.__getstate__()\n        return pickle.dumps({\n            'name': arg_1['name'],\n            'seg': pickle.dumps(arg_1['seg'], protocol=-1),\n        }, protocol=-1)", "path": "audiosegment.py", "identifier": "AudioSegment.serialize", "docstring": "Serializes into a bytestring.\n\n        :returns: An object of type Bytes.", "docstring_tokens": ["Serializes", "into", "a", "bytestring", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 257002}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/utils/tabulate.py#L401-L467", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Transform a supported data type to a list of lists, and a list of headers.", "language": "python", "parameters": "(tabular_data, headers, sort=True)", "return_statement": "return rows, headers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "hasattr", "(", "arg_0", ",", "\"keys\"", ")", "and", "hasattr", "(", "arg_0", ",", "\"values\"", ")", ":", "if", "hasattr", "(", "arg_0", ".", "values", ",", "\"__call__\"", ")", ":", "arg_3", "=", "list", "(", "arg_0", ".", "keys", "(", ")", ")", "arg_4", "=", "list", "(", "izip_longest", "(", "*", "list", "(", "arg_0", ".", "values", "(", ")", ")", ")", ")", "elif", "hasattr", "(", "arg_0", ",", "\"index\"", ")", ":", "arg_3", "=", "list", "(", "arg_0", ".", "keys", "(", ")", ")", "arg_5", "=", "arg_0", ".", "values", "arg_6", "=", "arg_0", ".", "index", "arg_4", "=", "[", "[", "v", "]", "+", "list", "(", "row", ")", "for", "v", ",", "row", "in", "zip", "(", "arg_6", ",", "arg_5", ")", "]", "else", ":", "raise", "ValueError", "(", "\"tabular data doesn't appear to be a dict \"", "\"or a DataFrame\"", ")", "if", "arg_1", "==", "\"keys\"", ":", "arg_1", "=", "list", "(", "map", "(", "_text_type", ",", "arg_3", ")", ")", "else", ":", "arg_4", "=", "list", "(", "arg_0", ")", "if", "arg_1", "==", "\"keys\"", "and", "len", "(", "arg_4", ")", ">", "0", ":", "arg_1", "=", "list", "(", "map", "(", "_text_type", ",", "list", "(", "range", "(", "len", "(", "arg_4", "[", "0", "]", ")", ")", ")", ")", ")", "if", "arg_1", "==", "\"firstrow\"", "and", "len", "(", "arg_4", ")", ">", "0", ":", "arg_1", "=", "list", "(", "map", "(", "_text_type", ",", "arg_4", "[", "0", "]", ")", ")", "arg_4", "=", "arg_4", "[", "1", ":", "]", "arg_1", "=", "list", "(", "arg_1", ")", "arg_4", "=", "list", "(", "map", "(", "list", ",", "arg_4", ")", ")", "if", "arg_2", "and", "len", "(", "arg_4", ")", ">", "1", ":", "arg_4", "=", "sorted", "(", "arg_4", ",", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ")", "if", "arg_1", "and", "len", "(", "arg_4", ")", ">", "0", ":", "arg_7", "=", "len", "(", "arg_1", ")", "arg_8", "=", "len", "(", "arg_4", "[", "0", "]", ")", "if", "arg_7", "<", "arg_8", ":", "arg_1", "=", "[", "\"\"", "]", "*", "(", "arg_8", "-", "arg_7", ")", "+", "arg_1", "return", "arg_4", ",", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Transform a supported data type to a list of lists, and a list of headers.\n\n    Supported tabular data types:\n\n    * list-of-lists or another iterable of iterables\n\n    * 2D NumPy arrays\n\n    * dict of iterables (usually used with headers=\"keys\")\n\n    * pandas.DataFrame (usually used with headers=\"keys\")\n\n    The first row can be used as headers if headers=\"firstrow\",\n    column indices can be used as headers if headers=\"keys\".\n\n    \"\"\"\n\n    if hasattr(arg_0, \"keys\") and hasattr(arg_0, \"values\"):\n        # dict-like and pandas.DataFrame?\n        if hasattr(arg_0.values, \"__call__\"):\n            # likely a conventional dict\n            arg_3 = list(arg_0.keys())\n            # columns have to be transposed\n            arg_4 = list(izip_longest(*list(arg_0.values())))\n        elif hasattr(arg_0, \"index\"):\n            # values is a property, has .index then\n            # it's likely a pandas.DataFrame (pandas 0.11.0)\n            arg_3 = list(arg_0.keys())\n            # values matrix doesn't need to be transposed\n            arg_5 = arg_0.values\n            arg_6 = arg_0.index\n            arg_4 = [[v] + list(row) for v, row in zip(arg_6, arg_5)]\n        else:\n            raise ValueError(\"tabular data doesn't appear to be a dict \"\n                             \"or a DataFrame\")\n\n        if arg_1 == \"keys\":\n            arg_1 = list(map(_text_type, arg_3))  # headers should be strings\n\n    else:  # it's, as usual, an iterable of iterables, or a NumPy array\n        arg_4 = list(arg_0)\n\n        if arg_1 == \"keys\" and len(arg_4) > 0:  # keys are column indices\n            arg_1 = list(map(_text_type, list(range(len(arg_4[0])))))\n\n    # take headers from the first row if necessary\n    if arg_1 == \"firstrow\" and len(arg_4) > 0:\n        arg_1 = list(map(_text_type, arg_4[0]))  # headers should be strings\n        arg_4 = arg_4[1:]\n\n    arg_1 = list(arg_1)\n\n    arg_4 = list(map(list, arg_4))\n\n    if arg_2 and len(arg_4) > 1:\n        arg_4 = sorted(arg_4, key=lambda x: x[0])\n\n    # pad with empty headers for initial columns if necessary\n    if arg_1 and len(arg_4) > 0:\n        arg_7 = len(arg_1)\n        arg_8 = len(arg_4[0])\n        if arg_7 < arg_8:\n            arg_1 = [\"\"] * (arg_8 - arg_7) + arg_1\n\n    return arg_4, arg_1", "path": "solvebio/utils/tabulate.py", "identifier": "_normalize_tabular_data", "docstring": "Transform a supported data type to a list of lists, and a list of headers.\n\n    Supported tabular data types:\n\n    * list-of-lists or another iterable of iterables\n\n    * 2D NumPy arrays\n\n    * dict of iterables (usually used with headers=\"keys\")\n\n    * pandas.DataFrame (usually used with headers=\"keys\")\n\n    The first row can be used as headers if headers=\"firstrow\",\n    column indices can be used as headers if headers=\"keys\".", "docstring_tokens": ["Transform", "a", "supported", "data", "type", "to", "a", "list", "of", "lists", "and", "a", "list", "of", "headers", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 257003}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L124-L143", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Get source from `filename` and make a code object of it.", "language": "python", "parameters": "(filename)", "return_statement": "return code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "open_source", "(", "arg_0", ")", "except", "IOError", ":", "raise", "NoSource", "(", "\"No file to run: %r\"", "%", "arg_0", ")", "try", ":", "arg_2", "=", "arg_1", ".", "read", "(", ")", "finally", ":", "arg_1", ".", "close", "(", ")", "if", "not", "arg_2", "or", "arg_2", "[", "-", "1", "]", "!=", "'\\n'", ":", "arg_2", "+=", "'\\n'", "arg_3", "=", "compile", "(", "arg_2", ",", "arg_0", ",", "\"exec\"", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Get source from `filename` and make a code object of it.\"\"\"\n    # Open the source file.\n    try:\n        arg_1 = open_source(arg_0)\n    except IOError:\n        raise NoSource(\"No file to run: %r\" % arg_0)\n\n    try:\n        arg_2 = arg_1.read()\n    finally:\n        arg_1.close()\n\n    # We have the source.  `compile` still needs the last line to be clean,\n    # so make sure it is, then compile a code object from it.\n    if not arg_2 or arg_2[-1] != '\\n':\n        arg_2 += '\\n'\n    arg_3 = compile(arg_2, arg_0, \"exec\")\n\n    return arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py", "identifier": "make_code_from_py", "docstring": "Get source from `filename` and make a code object of it.", "docstring_tokens": ["Get", "source", "from", "filename", "and", "make", "a", "code", "object", "of", "it", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 257004}
{"url": "https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/credit_card.py#L48-L70", "sha": "e15f2e59538deb4cbfceaac314f5ea897f2d5450", "docstring_summary": "Return a check digit of the given credit card number.", "language": "python", "parameters": "(num)", "return_statement": "return ((divmod(sum, 10)[0] + 1) * 10 - sum) % 10", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "str", "(", "arg_0", ")", "[", ":", "-", "1", "]", "[", ":", ":", "-", "1", "]", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_2", ")", ":", "if", "(", "arg_3", "+", "1", ")", "%", "2", "!=", "0", ":", "arg_5", "=", "int", "(", "arg_4", ")", "*", "2", "if", "arg_5", ">", "9", ":", "arg_1", "+=", "(", "arg_5", "-", "9", ")", "else", ":", "arg_1", "+=", "arg_5", "else", ":", "arg_1", "+=", "int", "(", "arg_4", ")", "return", "(", "(", "divmod", "(", "arg_1", ",", "10", ")", "[", "0", "]", "+", "1", ")", "*", "10", "-", "arg_1", ")", "%", "10"], "function": "def Func(arg_0):\n    \"\"\"Return a check digit of the given credit card number.\n\n    Check digit calculated using Luhn algorithm (\"modulus 10\")\n    See: http://www.darkcoding.net/credit-card/luhn-formula/\n    \"\"\"\n    arg_1 = 0\n\n    # drop last digit, then reverse the number\n    arg_2 = str(arg_0)[:-1][::-1]\n\n    for arg_3, arg_4 in enumerate(arg_2):\n        # select all digits at odd positions starting from 1\n        if (arg_3 + 1) % 2 != 0:\n            arg_5 = int(arg_4) * 2\n            if arg_5 > 9:\n                arg_1 += (arg_5 - 9)\n            else:\n                arg_1 += arg_5\n        else:\n            arg_1 += int(arg_4)\n\n    return ((divmod(arg_1, 10)[0] + 1) * 10 - arg_1) % 10", "path": "forgery_py/forgery/credit_card.py", "identifier": "check_digit", "docstring": "Return a check digit of the given credit card number.\n\n    Check digit calculated using Luhn algorithm (\"modulus 10\")\n    See: http://www.darkcoding.net/credit-card/luhn-formula/", "docstring_tokens": ["Return", "a", "check", "digit", "of", "the", "given", "credit", "card", "number", "."], "nwo": "pilosus/ForgeryPy3", "score": 0.3588333959790546, "idx": 257005}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L797-L813", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "This method fetches missing params for PR and filter them\n        by specified options. It include add all PR's with labels\n        from options.include_labels and exclude all from\n        options.exclude_labels.", "language": "python", "parameters": "(self, pull_requests)", "return_statement": "return pull_requests", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_0", ".", "filter_by_labels", "(", "arg_1", ",", "\"pull requests\"", ")", "arg_1", "=", "arg_0", ".", "filter_merged_pull_requests", "(", "arg_1", ")", "if", "arg_0", ".", "options", ".", "verbose", ">", "1", ":", "print", "(", "\"\\tremaining pull requests: {}\"", ".", "format", "(", "len", "(", "arg_1", ")", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        This method fetches missing params for PR and filter them\n        by specified options. It include add all PR's with labels\n        from options.include_labels and exclude all from\n        options.exclude_labels.\n\n        :param list(dict) pull_requests: All pull requests.\n        :rtype: list(dict)\n        :return: Filtered pull requests.\n        \"\"\"\n\n        arg_1 = arg_0.filter_by_labels(arg_1, \"pull requests\")\n        arg_1 = arg_0.filter_merged_pull_requests(arg_1)\n        if arg_0.options.verbose > 1:\n            print(\"\\tremaining pull requests: {}\".format(len(arg_1)))\n        return arg_1", "path": "pygcgen/generator.py", "identifier": "Generator.get_filtered_pull_requests", "docstring": "This method fetches missing params for PR and filter them\n        by specified options. It include add all PR's with labels\n        from options.include_labels and exclude all from\n        options.exclude_labels.\n\n        :param list(dict) pull_requests: All pull requests.\n        :rtype: list(dict)\n        :return: Filtered pull requests.", "docstring_tokens": ["This", "method", "fetches", "missing", "params", "for", "PR", "and", "filter", "them", "by", "specified", "options", ".", "It", "include", "add", "all", "PR", "s", "with", "labels", "from", "options", ".", "include_labels", "and", "exclude", "all", "from", "options", ".", "exclude_labels", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 257006}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/ast/state.py#L101-L115", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Provide a useful representation of the register.", "language": "python", "parameters": "(self)", "return_statement": "return infos", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "str", ":", "arg_1", "=", "fmt", ".", "end", "(", "\";\\n\"", ",", "[", "]", ")", "arg_2", "=", "fmt", ".", "sep", "(", "', '", ",", "[", "]", ")", "for", "arg_3", "in", "sorted", "(", "arg_0", ".", "states", ".", "keys", "(", ")", ")", ":", "arg_2", ".", "lsdata", ".", "append", "(", "str", "(", "arg_3", ")", ")", "arg_1", ".", "lsdata", ".", "append", "(", "fmt", ".", "block", "(", "'('", ",", "')'", ",", "[", "arg_2", "]", ")", ")", "arg_1", ".", "lsdata", ".", "append", "(", "\"events:\"", "+", "repr", "(", "arg_0", ".", "events", ")", ")", "arg_1", ".", "lsdata", ".", "append", "(", "\"named_events:\"", "+", "repr", "(", "list", "(", "arg_0", ".", "named_events", ".", "keys", "(", ")", ")", ")", ")", "arg_1", ".", "lsdata", ".", "append", "(", "\"uid_events:\"", "+", "repr", "(", "list", "(", "arg_0", ".", "uid_events", ".", "keys", "(", ")", ")", ")", ")", "return", "arg_1"], "function": "def Func(arg_0) -> str:\n        \"\"\"\n        Provide a useful representation of the register.\n        \"\"\"\n        arg_1 = fmt.end(\";\\n\", [])\n        arg_2 = fmt.sep(', ', [])\n        for arg_3 in sorted(arg_0.states.keys()):\n            arg_2.lsdata.append(str(arg_3))\n        arg_1.lsdata.append(fmt.block('(', ')', [arg_2]))\n        arg_1.lsdata.append(\"events:\" + repr(arg_0.events))\n        arg_1.lsdata.append(\n            \"named_events:\" + repr(list(arg_0.named_events.keys()))\n        )\n        arg_1.lsdata.append(\"uid_events:\" + repr(list(arg_0.uid_events.keys())))\n        return arg_1", "path": "pyrser/ast/state.py", "identifier": "StateRegister.to_fmt", "docstring": "Provide a useful representation of the register.", "docstring_tokens": ["Provide", "a", "useful", "representation", "of", "the", "register", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 257007}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/__init__.py#L407-L413", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Shortcut to read a csv file using pandas and convert to a DataFrame directly.", "language": "python", "parameters": "(filename_or_buffer, copy_index=True, **kwargs)", "return_statement": "return from_pandas(pd.read_csv(filename_or_buffer, **kwargs), copy_index=copy_index)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "**", "arg_2", ")", ":", "import", "pandas", "as", "pd", "return", "from_pandas", "(", "pd", ".", "read_csv", "(", "arg_0", ",", "**", "arg_2", ")", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=True, **arg_2):\n    \"\"\"Shortcut to read a csv file using pandas and convert to a DataFrame directly.\n\n    :rtype: DataFrame\n    \"\"\"\n    import pandas as pd\n    return from_pandas(pd.read_csv(arg_0, **arg_2), arg_1=arg_1)", "path": "packages/vaex-core/vaex/__init__.py", "identifier": "from_csv", "docstring": "Shortcut to read a csv file using pandas and convert to a DataFrame directly.\n\n    :rtype: DataFrame", "docstring_tokens": ["Shortcut", "to", "read", "a", "csv", "file", "using", "pandas", "and", "convert", "to", "a", "DataFrame", "directly", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257008}
{"url": "https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/demos/uiautomation_in_thread.py#L12-L29", "sha": "2cc91060982cc8b777152e698d677cc2989bf263", "docstring_summary": "If you want to use functionalities related to Controls and Patterns in a new thread.\n    You must call InitializeUIAutomationInCurrentThread first in the thread\n        and call UninitializeUIAutomationInCurrentThread when the thread exits.\n    But you can't use use a Control or a Pattern created in a different thread.\n    So you can't create a Control or a Pattern in main thread and then pass it to a new thread and use it.", "language": "python", "parameters": "(root)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "threading", ".", "currentThread", "(", ")", "auto", ".", "Logger", ".", "WriteLine", "(", "'\\nThis is running in a new thread. {} {}'", ".", "format", "(", "arg_1", ".", "ident", ",", "arg_1", ".", "name", ")", ",", "auto", ".", "ConsoleColor", ".", "Cyan", ")", "time", ".", "sleep", "(", "2", ")", "auto", ".", "InitializeUIAutomationInCurrentThread", "(", ")", "auto", ".", "GetConsoleWindow", "(", ")", ".", "CaptureToImage", "(", "'console_newthread.png'", ")", "arg_2", "=", "auto", ".", "GetRootControl", "(", ")", "auto", ".", "EnumAndLogControl", "(", "arg_2", ",", "1", ")", "auto", ".", "UninitializeUIAutomationInCurrentThread", "(", ")", "auto", ".", "Logger", ".", "WriteLine", "(", "'\\nThread exits. {} {}'", ".", "format", "(", "arg_1", ".", "ident", ",", "arg_1", ".", "name", ")", ",", "auto", ".", "ConsoleColor", ".", "Cyan", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    If you want to use functionalities related to Controls and Patterns in a new thread.\n    You must call InitializeUIAutomationInCurrentThread first in the thread\n        and call UninitializeUIAutomationInCurrentThread when the thread exits.\n    But you can't use use a Control or a Pattern created in a different thread.\n    So you can't create a Control or a Pattern in main thread and then pass it to a new thread and use it.\n    \"\"\"\n    #print(root)# you cannot use root because it is root control created in main thread\n    arg_1 = threading.currentThread()\n    auto.Logger.WriteLine('\\nThis is running in a new thread. {} {}'.format(arg_1.ident, arg_1.name), auto.ConsoleColor.Cyan)\n    time.sleep(2)\n    auto.InitializeUIAutomationInCurrentThread()\n    auto.GetConsoleWindow().CaptureToImage('console_newthread.png')\n    arg_2 = auto.GetRootControl()    #ok, root control created in new thread\n    auto.EnumAndLogControl(arg_2, 1)\n    auto.UninitializeUIAutomationInCurrentThread()\n    auto.Logger.WriteLine('\\nThread exits. {} {}'.format(arg_1.ident, arg_1.name), auto.ConsoleColor.Cyan)", "path": "demos/uiautomation_in_thread.py", "identifier": "threadFunc", "docstring": "If you want to use functionalities related to Controls and Patterns in a new thread.\n    You must call InitializeUIAutomationInCurrentThread first in the thread\n        and call UninitializeUIAutomationInCurrentThread when the thread exits.\n    But you can't use use a Control or a Pattern created in a different thread.\n    So you can't create a Control or a Pattern in main thread and then pass it to a new thread and use it.", "docstring_tokens": ["If", "you", "want", "to", "use", "functionalities", "related", "to", "Controls", "and", "Patterns", "in", "a", "new", "thread", ".", "You", "must", "call", "InitializeUIAutomationInCurrentThread", "first", "in", "the", "thread", "and", "call", "UninitializeUIAutomationInCurrentThread", "when", "the", "thread", "exits", ".", "But", "you", "can", "t", "use", "use", "a", "Control", "or", "a", "Pattern", "created", "in", "a", "different", "thread", ".", "So", "you", "can", "t", "create", "a", "Control", "or", "a", "Pattern", "in", "main", "thread", "and", "then", "pass", "it", "to", "a", "new", "thread", "and", "use", "it", "."], "nwo": "yinkaisheng/Python-UIAutomation-for-Windows", "score": 0.9769561204852005, "idx": 257009}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L89-L124", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Run Bayesian model assuming returns are normally distributed.", "language": "python", "parameters": "(data, samples=500, progressbar=True)", "return_statement": "return model, trace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "500", ",", "arg_2", "=", "True", ")", ":", "with", "pm", ".", "Model", "(", ")", "as", "model", ":", "arg_3", "=", "pm", ".", "Normal", "(", "'mean returns'", ",", "arg_3", "=", "0", ",", "sd", "=", ".01", ",", "testval", "=", "arg_0", ".", "mean", "(", ")", ")", "arg_4", "=", "pm", ".", "HalfCauchy", "(", "'volatility'", ",", "beta", "=", "1", ",", "testval", "=", "arg_0", ".", "std", "(", ")", ")", "arg_5", "=", "pm", ".", "Normal", "(", "'returns'", ",", "arg_3", "=", "arg_3", ",", "sd", "=", "arg_4", ",", "observed", "=", "arg_0", ")", "pm", ".", "Deterministic", "(", "'annual volatility'", ",", "arg_5", ".", "distribution", ".", "variance", "**", ".5", "*", "np", ".", "sqrt", "(", "252", ")", ")", "pm", ".", "Deterministic", "(", "'sharpe'", ",", "arg_5", ".", "distribution", ".", "mean", "/", "arg_5", ".", "distribution", ".", "variance", "**", ".5", "*", "np", ".", "sqrt", "(", "252", ")", ")", "arg_6", "=", "pm", ".", "sample", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "model", ",", "arg_6"], "function": "def Func(arg_0, arg_1=500, arg_2=True):\n    \"\"\"\n    Run Bayesian model assuming returns are normally distributed.\n\n    Parameters\n    ----------\n    returns : pandas.Series\n        Series of simple returns of an algorithm or stock.\n    samples : int (optional)\n        Number of posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n    \"\"\"\n\n    with pm.Model() as model:\n        arg_3 = pm.Normal('mean returns', arg_3=0, sd=.01, testval=arg_0.mean())\n        arg_4 = pm.HalfCauchy('volatility', beta=1, testval=arg_0.std())\n        arg_5 = pm.Normal('returns', arg_3=arg_3, sd=arg_4, observed=arg_0)\n        pm.Deterministic(\n            'annual volatility',\n            arg_5.distribution.variance**.5 *\n            np.sqrt(252))\n        pm.Deterministic(\n            'sharpe',\n            arg_5.distribution.mean /\n            arg_5.distribution.variance**.5 *\n            np.sqrt(252))\n\n        arg_6 = pm.sample(arg_1, arg_2=arg_2)\n    return model, arg_6", "path": "pyfolio/bayesian.py", "identifier": "model_returns_normal", "docstring": "Run Bayesian model assuming returns are normally distributed.\n\n    Parameters\n    ----------\n    returns : pandas.Series\n        Series of simple returns of an algorithm or stock.\n    samples : int (optional)\n        Number of posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.", "docstring_tokens": ["Run", "Bayesian", "model", "assuming", "returns", "are", "normally", "distributed", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257010}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1012-L1015", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "A list of axes of rotation for this joint.", "language": "python", "parameters": "(self)", "return_statement": "return [np.array(self.ode_obj.getAxis1()),\n                np.array(self.ode_obj.getAxis2())]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "np", ".", "array", "(", "arg_0", ".", "ode_obj", ".", "getAxis1", "(", ")", ")", ",", "np", ".", "array", "(", "arg_0", ".", "ode_obj", ".", "getAxis2", "(", ")", ")", "]"], "function": "def Func(arg_0):\n        '''A list of Func of rotation for this joint.'''\n        return [np.array(arg_0.ode_obj.getAxis1()),\n                np.array(arg_0.ode_obj.getAxis2())]", "path": "pagoda/physics.py", "identifier": "Universal.axes", "docstring": "A list of axes of rotation for this joint.", "docstring_tokens": ["A", "list", "of", "axes", "of", "rotation", "for", "this", "joint", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 257011}
{"url": "https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L190-L219", "sha": "5e464e1fc3ae9c7e216f6dd94f879a967d065247", "docstring_summary": "If entity pairs in a relation is as close as another relations, only keep one relation of such set.", "language": "python", "parameters": "(triples, threshold=0.97)", "return_statement": "return list(filterfalse(lambda x: x.relation in removal_relation_set, triples))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.97", ")", ":", "logging", ".", "debug", "(", "\"remove duplicate\"", ")", "_assert_threshold", "(", "arg_1", ")", "arg_2", "=", "defaultdict", "(", "list", ")", "arg_3", "=", "set", "(", ")", "for", "arg_4", "in", "arg_0", ":", "arg_2", "[", "arg_4", ".", "relation", "]", ".", "append", "(", "f\"{t.head} {t.tail}\"", ")", "arg_3", ".", "add", "(", "arg_4", ".", "relation", ")", "arg_3", "=", "list", "(", "arg_3", ")", "arg_5", "=", "len", "(", "arg_0", ")", "arg_6", "=", "set", "(", ")", "for", "arg_7", ",", "arg_8", "in", "arg_2", ".", "items", "(", ")", ":", "arg_2", "[", "arg_7", "]", "=", "Superminhash", "(", "arg_8", ")", "for", "arg_9", "in", "arg_3", ":", "for", "arg_10", "in", "arg_3", ":", "if", "arg_9", "==", "arg_10", "or", "arg_9", "in", "arg_6", "or", "arg_10", "in", "arg_6", ":", "continue", "arg_11", "=", "[", "arg_9", "]", "if", "_set_close_to", "(", "arg_2", "[", "arg_9", "]", ",", "arg_2", "[", "arg_10", "]", ",", "arg_1", ")", ":", "arg_11", ".", "append", "(", "arg_10", ")", "if", "len", "(", "arg_11", ")", ">", "1", ":", "arg_11", ".", "pop", "(", "np", ".", "random", ".", "randint", "(", "len", "(", "arg_11", ")", ")", ")", "arg_6", "|=", "set", "(", "arg_11", ")", "logging", ".", "info", "(", "\"Removing {} relations: {}\"", ".", "format", "(", "len", "(", "arg_6", ")", ",", "str", "(", "arg_6", ")", ")", ")", "return", "list", "(", "filterfalse", "(", "lambda", "x", ":", "x", ".", "relation", "in", "arg_6", ",", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=0.97):\n    \"\"\"If entity pairs in a relation is as close as another relations, only keep one relation of such set.\"\"\"\n    logging.debug(\"remove duplicate\")\n\n    _assert_threshold(arg_1)\n\n    arg_2 = defaultdict(list)\n    arg_3 = set()\n    for arg_4 in arg_0:\n        arg_2[arg_4.relation].append(f\"{t.head} {t.tail}\")\n        arg_3.add(arg_4.relation)\n    arg_3 = list(arg_3)\n\n    arg_5 = len(arg_0)\n    arg_6 = set()\n\n    for arg_7, arg_8 in arg_2.items():\n        arg_2[arg_7] = Superminhash(arg_8)\n    for arg_9 in arg_3:\n        for arg_10 in arg_3:\n            if arg_9 == arg_10 or arg_9 in arg_6 or arg_10 in arg_6: continue\n            arg_11 = [arg_9]\n            if _set_close_to(arg_2[arg_9], arg_2[arg_10], arg_1):\n                arg_11.append(arg_10)\n        if len(arg_11) > 1:\n            arg_11.pop(np.random.randint(len(arg_11)))\n            arg_6 |= set(arg_11)\n    logging.info(\"Removing {} relations: {}\".format(len(arg_6), str(arg_6)))\n\n    return list(filterfalse(lambda x: x.relation in arg_6, arg_0))", "path": "kgekit/data.py", "identifier": "remove_near_duplicate_relation", "docstring": "If entity pairs in a relation is as close as another relations, only keep one relation of such set.", "docstring_tokens": ["If", "entity", "pairs", "in", "a", "relation", "is", "as", "close", "as", "another", "relations", "only", "keep", "one", "relation", "of", "such", "set", "."], "nwo": "fantasticfears/kgekit", "score": 0.15726537023232431, "idx": 257012}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/roles.py#L8-L19", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "List the roles for an account, for the passed Canvas account ID.", "language": "python", "parameters": "(self, account_id, params={})", "return_statement": "return roles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "arg_3", "=", "ACCOUNTS_API", ".", "format", "(", "arg_1", ")", "+", "\"/roles\"", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ".", "_get_resource", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", ":", "arg_4", ".", "append", "(", "CanvasRole", "(", "data", "=", "arg_5", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        List the roles for an account, for the passed Canvas account ID.\n\n        https://canvas.instructure.com/doc/api/roles.html#method.role_overrides.api_index\n        \"\"\"\n        arg_3 = ACCOUNTS_API.format(arg_1) + \"/roles\"\n\n        arg_4 = []\n        for arg_5 in arg_0._get_resource(arg_3, arg_2=arg_2):\n            arg_4.append(CanvasRole(data=arg_5))\n        return arg_4", "path": "uw_canvas/roles.py", "identifier": "Roles.get_roles_in_account", "docstring": "List the roles for an account, for the passed Canvas account ID.\n\n        https://canvas.instructure.com/doc/api/roles.html#method.role_overrides.api_index", "docstring_tokens": ["List", "the", "roles", "for", "an", "account", "for", "the", "passed", "Canvas", "account", "ID", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 257013}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/rank_score.py#L3-L19", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse the rank score", "language": "python", "parameters": "(rank_score_entry, case_id)", "return_statement": "return rank_score", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "if", "arg_0", ":", "for", "arg_3", "in", "arg_0", ".", "split", "(", "','", ")", ":", "arg_4", "=", "arg_3", ".", "split", "(", "':'", ")", "if", "arg_1", "==", "arg_4", "[", "0", "]", ":", "arg_2", "=", "float", "(", "arg_4", "[", "1", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Parse the rank score\n\n        Args:\n            rank_score_entry(str): The raw rank score entry\n            case_id(str)\n\n        Returns:\n            rank_score(float)\n    \"\"\"\n    arg_2 = None\n    if arg_0:\n        for arg_3 in arg_0.split(','):\n            arg_4 = arg_3.split(':')\n            if arg_1 == arg_4[0]:\n                arg_2 = float(arg_4[1])\n    return arg_2", "path": "scout/parse/variant/rank_score.py", "identifier": "parse_rank_score", "docstring": "Parse the rank score\n\n        Args:\n            rank_score_entry(str): The raw rank score entry\n            case_id(str)\n\n        Returns:\n            rank_score(float)", "docstring_tokens": ["Parse", "the", "rank", "score"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257014}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L3417-L3434", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Cuts string data to the maximum length allowed in a pytables column\n        if string is too long.", "language": "python", "parameters": "(string, max_length, logger)", "return_statement": "return string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_0", ")", ">", "arg_1", ":", "arg_2", ".", "debug", "(", "'The string `%s` was too long I truncated it to'", "' %d characters'", "%", "(", "arg_0", ",", "arg_1", ")", ")", "arg_0", "=", "arg_0", "[", "0", ":", "arg_1", "-", "3", "]", "+", "'...'", ".", "encode", "(", "'utf-8'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Cuts string data to the maximum length allowed in a pytables column\n        if string is too long.\n\n        :param string: String to be cut\n        :param max_length: Maximum allowed string length\n        :param logger: Logger where messages about truncating should be written\n\n        :return: String, cut if too long\n\n        \"\"\"\n        if len(arg_0) > arg_1:\n            arg_2.debug('The string `%s` was too long I truncated it to'\n                         ' %d characters' %\n                         (arg_0, arg_1))\n            arg_0 = arg_0[0:arg_1 - 3] + '...'.encode('utf-8')\n\n        return arg_0", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._all_cut_string", "docstring": "Cuts string data to the maximum length allowed in a pytables column\n        if string is too long.\n\n        :param string: String to be cut\n        :param max_length: Maximum allowed string length\n        :param logger: Logger where messages about truncating should be written\n\n        :return: String, cut if too long", "docstring_tokens": ["Cuts", "string", "data", "to", "the", "maximum", "length", "allowed", "in", "a", "pytables", "column", "if", "string", "is", "too", "long", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257015}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L349-L360", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Hook for type-checking, invoked during assignment. Allows size 1\n        numpy arrays and lists, but raises TypeError if value can not\n        be cast to a scalar.", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "asscalar", "(", "arg_1", ")", "except", "ValueError", "as", "e", ":", "raise", "TypeError", "(", "e", ")", "super", "(", "Parameter", ",", "arg_0", ")", ".", "Func", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Hook for type-checking, invoked during assignment. Allows size 1\n        numpy arrays and lists, but raises TypeError if value can not\n        be cast to a scalar.\n\n        \"\"\"\n        try:\n            arg_2 = asscalar(arg_1)\n        except ValueError as e:\n            raise TypeError(e)\n\n        super(Parameter, arg_0).Func(arg_2)", "path": "pymodeler/parameter.py", "identifier": "Parameter.check_type", "docstring": "Hook for type-checking, invoked during assignment. Allows size 1\n        numpy arrays and lists, but raises TypeError if value can not\n        be cast to a scalar.", "docstring_tokens": ["Hook", "for", "type", "-", "checking", "invoked", "during", "assignment", ".", "Allows", "size", "1", "numpy", "arrays", "and", "lists", "but", "raises", "TypeError", "if", "value", "can", "not", "be", "cast", "to", "a", "scalar", "."], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 257016}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L664-L702", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Generate an XML report of coverage results.", "language": "python", "parameters": "(self, morfs=None, outfile=None, ignore_errors=None,\n                    omit=None, include=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_0", ".", "_harvest_data", "(", ")", "arg_0", ".", "config", ".", "from_args", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "xml_output", "=", "arg_2", ",", ")", "arg_6", "=", "None", "arg_7", "=", "False", "if", "arg_0", ".", "config", ".", "xml_output", ":", "if", "arg_0", ".", "config", ".", "xml_output", "==", "'-'", ":", "arg_2", "=", "sys", ".", "stdout", "else", ":", "arg_2", "=", "open", "(", "arg_0", ".", "config", ".", "xml_output", ",", "\"w\"", ")", "arg_6", "=", "arg_2", "try", ":", "try", ":", "arg_8", "=", "XmlReporter", "(", "arg_0", ",", "arg_0", ".", "config", ")", "return", "arg_8", ".", "report", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "except", "CoverageException", ":", "arg_7", "=", "True", "raise", "finally", ":", "if", "arg_6", ":", "arg_6", ".", "close", "(", ")", "if", "arg_7", ":", "file_be_gone", "(", "arg_0", ".", "config", ".", "xml_output", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n                    arg_4=None, arg_5=None):\n        \"\"\"Generate an XML report of coverage results.\n\n        The report is compatible with Cobertura reports.\n\n        Each module in `morfs` is included in the report.  `outfile` is the\n        path to write the file to, \"-\" will write to stdout.\n\n        See `coverage.report()` for other arguments.\n\n        Returns a float, the total percentage covered.\n\n        \"\"\"\n        arg_0._harvest_data()\n        arg_0.config.from_args(\n            arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,\n            xml_output=arg_2,\n            )\n        arg_6 = None\n        arg_7 = False\n        if arg_0.config.xml_output:\n            if arg_0.config.xml_output == '-':\n                arg_2 = sys.stdout\n            else:\n                arg_2 = open(arg_0.config.xml_output, \"w\")\n                arg_6 = arg_2\n        try:\n            try:\n                arg_8 = XmlReporter(arg_0, arg_0.config)\n                return arg_8.report(arg_1, arg_2=arg_2)\n            except CoverageException:\n                arg_7 = True\n                raise\n        finally:\n            if arg_6:\n                arg_6.close()\n                if arg_7:\n                    file_be_gone(arg_0.config.xml_output)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage.xml_report", "docstring": "Generate an XML report of coverage results.\n\n        The report is compatible with Cobertura reports.\n\n        Each module in `morfs` is included in the report.  `outfile` is the\n        path to write the file to, \"-\" will write to stdout.\n\n        See `coverage.report()` for other arguments.\n\n        Returns a float, the total percentage covered.", "docstring_tokens": ["Generate", "an", "XML", "report", "of", "coverage", "results", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 257017}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/__init__.py#L12-L15", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return local folder path of header files.", "language": "python", "parameters": "()", "return_statement": "return os.path.abspath(os.path.dirname(os.path.realpath(__file__))) + '/headers/'", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", "->", "str", ":", "import", "os", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ")", "+", "'/headers/'"], "function": "def Func() -> str:\n    \"\"\"Return local folder path of header files.\"\"\"\n    import os\n    return os.path.abspath(os.path.dirname(os.path.realpath(__file__))) + '/headers/'", "path": "kerncraft/__init__.py", "identifier": "get_header_path", "docstring": "Return local folder path of header files.", "docstring_tokens": ["Return", "local", "folder", "path", "of", "header", "files", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 257018}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/numpy/linspacestep.py#L7-L31", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Create a vector of values over an interval with a specified step size.", "language": "python", "parameters": "(start, stop, step=1)", "return_statement": "return _np.linspace(start, start+step*numsteps, numsteps+1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "_np", ".", "int", "(", "(", "arg_1", "-", "arg_0", ")", "/", "arg_2", ")", "return", "_np", ".", "linspace", "(", "arg_0", ",", "arg_0", "+", "arg_2", "*", "arg_3", ",", "arg_3", "+", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2=1):\n    \"\"\"\n    Create a vector of values over an interval with a specified step size.\n\n    Parameters\n    ----------\n\n    start : float\n        The beginning of the interval.\n    stop : float\n        The end of the interval.\n    step : float\n        The step size.\n\n    Returns\n    -------\n    vector : :class:`numpy.ndarray`\n        The vector of values.\n    \"\"\"\n    # Find an integer number of steps\n    arg_3 = _np.int((arg_1-arg_0)/arg_2)\n\n    # Do a linspace over the new range\n    # that has the correct endpoint\n    return _np.linspace(arg_0, arg_0+arg_2*arg_3, arg_3+1)", "path": "scisalt/numpy/linspacestep.py", "identifier": "linspacestep", "docstring": "Create a vector of values over an interval with a specified step size.\n\n    Parameters\n    ----------\n\n    start : float\n        The beginning of the interval.\n    stop : float\n        The end of the interval.\n    step : float\n        The step size.\n\n    Returns\n    -------\n    vector : :class:`numpy.ndarray`\n        The vector of values.", "docstring_tokens": ["Create", "a", "vector", "of", "values", "over", "an", "interval", "with", "a", "specified", "step", "size", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 257019}
{"url": "https://github.com/josuebrunel/yahoo-oauth/blob/40eff7809366850c46e1a3340469044f33cd1713/yahoo_oauth/utils.py#L36-L41", "sha": "40eff7809366850c46e1a3340469044f33cd1713", "docstring_summary": "Call right func to save data according to file extension", "language": "python", "parameters": "(data, filename)", "return_statement": "return func(data, filename)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "get_file_extension", "(", "arg_1", ")", "arg_4", "=", "json_Func", "if", "arg_3", "==", "'.json'", "else", "yaml_Func", "return", "arg_4", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Call right func to save data according to file extension\n    \"\"\"\n    arg_2, arg_3 = get_file_extension(arg_1)\n    arg_4 = json_Func if arg_3 == '.json' else yaml_Func\n    return arg_4(arg_0, arg_1)", "path": "yahoo_oauth/utils.py", "identifier": "write_data", "docstring": "Call right func to save data according to file extension", "docstring_tokens": ["Call", "right", "func", "to", "save", "data", "according", "to", "file", "extension"], "nwo": "josuebrunel/yahoo-oauth", "score": 0.19492780499114437, "idx": 257020}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/instruction.py#L245-L260", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "shallow copy of the instruction.", "language": "python", "parameters": "(self, name=None)", "return_statement": "return cpy", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "Func", ".", "Func", "(", "arg_0", ")", "if", "arg_1", ":", "arg_2", ".", "name", "=", "arg_1", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        shallow Func of the instruction.\n\n        Args:\n          name (str): name to be given to the copied circuit,\n            if None then the name stays the same\n\n        Returns:\n          Instruction: a shallow Func of the current instruction, with the name\n            updated if it was provided\n        \"\"\"\n        arg_2 = Func.Func(arg_0)\n        if arg_1:\n            arg_2.name = arg_1\n        return arg_2", "path": "qiskit/circuit/instruction.py", "identifier": "Instruction.copy", "docstring": "shallow copy of the instruction.\n\n        Args:\n          name (str): name to be given to the copied circuit,\n            if None then the name stays the same\n\n        Returns:\n          Instruction: a shallow copy of the current instruction, with the name\n            updated if it was provided", "docstring_tokens": ["shallow", "copy", "of", "the", "instruction", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257021}
{"url": "https://github.com/awdeorio/mailmerge/blob/ff83f3b053ed6e182a98025873fcf3095d37b78b/mailmerge/api.py#L120-L154", "sha": "ff83f3b053ed6e182a98025873fcf3095d37b78b", "docstring_summary": "Add the attachments from the message from the commandline options.", "language": "python", "parameters": "(message, template_path)", "return_statement": "return message, len(attachment_filepaths)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'attachment'", "not", "in", "arg_0", ":", "return", "arg_0", ",", "0", "arg_0", "=", "make_message_multipart", "(", "arg_0", ")", "arg_2", "=", "arg_0", ".", "get_all", "(", "'attachment'", ",", "failobj", "=", "[", "]", ")", "arg_3", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "for", "arg_4", "in", "arg_2", ":", "arg_4", "=", "os", ".", "path", ".", "expanduser", "(", "arg_4", ".", "strip", "(", ")", ")", "if", "not", "arg_4", ":", "continue", "if", "not", "os", ".", "path", ".", "isabs", "(", "arg_4", ")", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_4", ")", "arg_5", "=", "os", ".", "path", ".", "abspath", "(", "arg_4", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "print", "(", "\"Error: can't find attachment \"", "+", "arg_5", ")", "sys", ".", "exit", "(", "1", ")", "arg_6", "=", "os", ".", "path", ".", "basename", "(", "arg_5", ")", "with", "open", "(", "arg_5", ",", "\"rb\"", ")", "as", "attachment", ":", "arg_7", "=", "email", ".", "mime", ".", "application", ".", "MIMEApplication", "(", "attachment", ".", "read", "(", ")", ",", "Name", "=", "arg_6", ")", "arg_7", ".", "add_header", "(", "'Content-Disposition'", ",", "'attachment; filename=\"{}\"'", ".", "format", "(", "arg_6", ")", ")", "arg_0", ".", "attach", "(", "arg_7", ")", "print", "(", "\">>> attached {}\"", ".", "format", "(", "arg_5", ")", ")", "del", "arg_0", "[", "'attachment'", "]", "return", "arg_0", ",", "len", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Add the attachments from the message from the commandline options.\"\"\"\n    if 'attachment' not in arg_0:\n        return arg_0, 0\n\n    arg_0 = make_message_multipart(arg_0)\n\n    arg_2 = arg_0.get_all('attachment', failobj=[])\n    arg_3 = os.path.dirname(arg_1)\n\n    for arg_4 in arg_2:\n        arg_4 = os.path.expanduser(arg_4.strip())\n        if not arg_4:\n            continue\n        if not os.path.isabs(arg_4):\n            # Relative paths are relative to the template's parent directory\n            arg_4 = os.path.join(arg_3,\n                                               arg_4)\n        arg_5 = os.path.abspath(arg_4)\n        # Check that the attachment exists\n        if not os.path.exists(arg_5):\n            print(\"Error: can't find attachment \" + arg_5)\n            sys.exit(1)\n\n        arg_6 = os.path.basename(arg_5)\n        with open(arg_5, \"rb\") as attachment:\n            arg_7 = email.mime.application.MIMEApplication(attachment.read(),\n                                                          Name=arg_6)\n        arg_7.add_header('Content-Disposition',\n                        'attachment; filename=\"{}\"'.format(arg_6))\n        arg_0.attach(arg_7)\n        print(\">>> attached {}\".format(arg_5))\n\n    del arg_0['attachment']\n    return arg_0, len(arg_2)", "path": "mailmerge/api.py", "identifier": "addattachments", "docstring": "Add the attachments from the message from the commandline options.", "docstring_tokens": ["Add", "the", "attachments", "from", "the", "message", "from", "the", "commandline", "options", "."], "nwo": "awdeorio/mailmerge", "score": 0.4391411885681359, "idx": 257022}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L570-L577", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "puts products in a normalized format", "language": "python", "parameters": "(self, product=None)", "return_statement": "return products", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "product", "if", "arg_1", "is", "None", "else", "arg_1", "if", "arg_2", "is", "None", ":", "return", "None", "if", "not", "isinstance", "(", "arg_2", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_2", "=", "[", "arg_2", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\" puts products in a normalized format \"\"\"\n        arg_2 = arg_0.product if arg_1 is None else arg_1\n        if arg_2 is None:\n            return None\n        if not isinstance(arg_2, (list, tuple)):\n            arg_2 = [arg_2]\n        return arg_2", "path": "ubelt/util_cache.py", "identifier": "CacheStamp._rectify_products", "docstring": "puts products in a normalized format", "docstring_tokens": ["puts", "products", "in", "a", "normalized", "format"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 257023}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/chunk.py#L575-L618", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Obtain slices for the given dimensions, padding, and chunks.", "language": "python", "parameters": "(plan, padding, shape)", "return_statement": "return slices", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_7", "=", "int", "(", "floor", "(", "arg_6", "/", "arg_4", ")", ")", "arg_8", "=", "arg_6", "%", "arg_4", "arg_9", "=", "0", "arg_10", "=", "[", "]", "for", "arg_11", "in", "range", "(", "arg_7", ")", ":", "arg_12", "=", "arg_9", "+", "arg_4", "if", "arg_11", "==", "0", ":", "arg_13", "=", "arg_9", "else", ":", "arg_13", "=", "arg_9", "-", "arg_5", "if", "arg_11", "==", "arg_7", ":", "arg_14", "=", "arg_12", "else", ":", "arg_14", "=", "arg_12", "+", "arg_5", "arg_10", ".", "append", "(", "slice", "(", "arg_13", ",", "arg_14", ",", "1", ")", ")", "arg_9", "=", "arg_12", "if", "arg_8", ":", "arg_10", ".", "append", "(", "slice", "(", "arg_12", "-", "arg_5", ",", "arg_6", ",", "1", ")", ")", "arg_3", ".", "append", "(", "arg_10", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Obtain slices for the given dimensions, padding, and chunks.\n\n        Given a plan for the number of chunks along each dimension and the amount of padding,\n        calculate a list of slices required to generate those chunks.\n\n        Parameters\n        ----------\n        plan: tuple or array-like\n            Size of chunks (in number of elements) along each dimensions.\n            Length must be equal to the number of dimensions.\n\n        padding: tuple or array-like\n            Size of overlap (in number of elements) between chunks along each dimension.\n            Length must be equal to the number of dimensions.\n\n        shape: tuple\n             Dimensions of axes to be chunked.\n        \"\"\"\n        arg_3 = []\n        for arg_4, arg_5, arg_6 in zip(arg_0, arg_1, arg_2):\n            arg_7 = int(floor(arg_6/arg_4))\n            arg_8 = arg_6 % arg_4\n            arg_9 = 0\n            arg_10 = []\n            for arg_11 in range(arg_7):\n                arg_12 = arg_9 + arg_4\n                # left endpoint\n                if arg_11 == 0:\n                    arg_13 = arg_9\n                else:\n                    arg_13 = arg_9 - arg_5\n                # right endpoint\n                if arg_11 == arg_7:\n                    arg_14 = arg_12\n                else:\n                    arg_14 = arg_12 + arg_5\n                arg_10.append(slice(arg_13, arg_14, 1))\n                arg_9 = arg_12\n            if arg_8:\n                arg_10.append(slice(arg_12 - arg_5, arg_6, 1))\n            arg_3.append(arg_10)\n        return arg_3", "path": "bolt/spark/chunk.py", "identifier": "ChunkedArray.getslices", "docstring": "Obtain slices for the given dimensions, padding, and chunks.\n\n        Given a plan for the number of chunks along each dimension and the amount of padding,\n        calculate a list of slices required to generate those chunks.\n\n        Parameters\n        ----------\n        plan: tuple or array-like\n            Size of chunks (in number of elements) along each dimensions.\n            Length must be equal to the number of dimensions.\n\n        padding: tuple or array-like\n            Size of overlap (in number of elements) between chunks along each dimension.\n            Length must be equal to the number of dimensions.\n\n        shape: tuple\n             Dimensions of axes to be chunked.", "docstring_tokens": ["Obtain", "slices", "for", "the", "given", "dimensions", "padding", "and", "chunks", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 257024}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L397-L448", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Check that wiremap neither fragments nor leaves duplicate registers.", "language": "python", "parameters": "(self, edge_map, keyregs, valregs, valreg=True)", "return_statement": "return add_regs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "True", ")", ":", "arg_5", "=", "set", "(", ")", "arg_6", "=", "{", "}", "for", "arg_7", "in", "arg_2", ".", "values", "(", ")", ":", "arg_6", "[", "arg_7", "]", "=", "{", "j", ":", "False", "for", "j", "in", "range", "(", "len", "(", "arg_7", ")", ")", "}", "for", "arg_8", "in", "arg_1", ".", "keys", "(", ")", ":", "if", "arg_8", "[", "0", "]", ".", "name", "in", "arg_2", ":", "arg_6", "[", "arg_8", "[", "0", "]", "]", "[", "arg_8", "[", "1", "]", "]", "=", "True", "for", "arg_8", ",", "arg_7", "in", "arg_6", ".", "items", "(", ")", ":", "arg_9", "=", "set", "(", "arg_7", ".", "values", "(", ")", ")", "if", "len", "(", "arg_9", ")", "==", "2", ":", "raise", "DAGCircuitError", "(", "\"edge_map fragments reg %s\"", "%", "arg_8", ")", "elif", "arg_9", "==", "set", "(", "[", "False", "]", ")", ":", "if", "arg_8", "in", "arg_0", ".", "qregs", ".", "values", "(", ")", "or", "arg_8", "in", "arg_0", ".", "cregs", ".", "values", "(", ")", ":", "raise", "DAGCircuitError", "(", "\"unmapped duplicate reg %s\"", "%", "arg_8", ")", "else", ":", "arg_5", ".", "add", "(", "arg_8", ")", "else", ":", "if", "arg_4", ":", "if", "not", "arg_1", "[", "(", "arg_8", ",", "0", ")", "]", "[", "0", "]", ".", "name", "in", "arg_3", ":", "arg_10", "=", "max", "(", "map", "(", "lambda", "x", ":", "x", "[", "1", "]", ",", "filter", "(", "lambda", "x", ":", "x", "[", "0", "]", "==", "arg_1", "[", "(", "arg_8", ",", "0", ")", "]", "[", "0", "]", ",", "arg_1", ".", "values", "(", ")", ")", ")", ")", "arg_11", "=", "QuantumRegister", "(", "arg_10", "+", "1", ",", "arg_1", "[", "(", "arg_8", ",", "0", ")", "]", "[", "0", "]", ".", "name", ")", "arg_5", ".", "add", "(", "arg_11", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=True):\n        \"\"\"Check that wiremap neither fragments nor leaves duplicate registers.\n\n        1. There are no fragmented registers. A register in keyregs\n        is fragmented if not all of its (qu)bits are renamed by edge_map.\n        2. There are no duplicate registers. A register is duplicate if\n        it appears in both self and keyregs but not in edge_map.\n\n        Args:\n            edge_map (dict): map from (reg,idx) in keyregs to (reg,idx) in valregs\n            keyregs (dict): a map from register names to Register objects\n            valregs (dict): a map from register names to Register objects\n            valreg (bool): if False the method ignores valregs and does not\n                add regs for bits in the edge_map image that don't appear in valregs\n\n        Returns:\n            set(Register): the set of regs to add to self\n\n        Raises:\n            DAGCircuitError: if the wiremap fragments, or duplicates exist\n        \"\"\"\n        # FIXME: some mixing of objects and strings here are awkward (due to\n        # self.qregs/self.cregs still keying on string.\n        arg_5 = set()\n        arg_6 = {}\n        for arg_7 in arg_2.values():\n            arg_6[arg_7] = {j: False for j in range(len(arg_7))}\n        for arg_8 in arg_1.keys():\n            if arg_8[0].name in arg_2:\n                arg_6[arg_8[0]][arg_8[1]] = True\n        for arg_8, arg_7 in arg_6.items():\n            arg_9 = set(arg_7.values())\n            if len(arg_9) == 2:\n                raise DAGCircuitError(\"edge_map fragments reg %s\" % arg_8)\n            elif arg_9 == set([False]):\n                if arg_8 in arg_0.qregs.values() or arg_8 in arg_0.cregs.values():\n                    raise DAGCircuitError(\"unmapped duplicate reg %s\" % arg_8)\n                else:\n                    # Add registers that appear only in keyregs\n                    arg_5.add(arg_8)\n            else:\n                if arg_4:\n                    # If mapping to a register not in valregs, add it.\n                    # (k,0) exists in edge_map because edge_map doesn't\n                    # fragment k\n                    if not arg_1[(arg_8, 0)][0].name in arg_3:\n                        arg_10 = max(map(lambda x: x[1],\n                                       filter(lambda x: x[0] == arg_1[(arg_8, 0)][0],\n                                              arg_1.values())))\n                        arg_11 = QuantumRegister(arg_10 + 1, arg_1[(arg_8, 0)][0].name)\n                        arg_5.add(arg_11)\n        return arg_5", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit._check_edgemap_registers", "docstring": "Check that wiremap neither fragments nor leaves duplicate registers.\n\n        1. There are no fragmented registers. A register in keyregs\n        is fragmented if not all of its (qu)bits are renamed by edge_map.\n        2. There are no duplicate registers. A register is duplicate if\n        it appears in both self and keyregs but not in edge_map.\n\n        Args:\n            edge_map (dict): map from (reg,idx) in keyregs to (reg,idx) in valregs\n            keyregs (dict): a map from register names to Register objects\n            valregs (dict): a map from register names to Register objects\n            valreg (bool): if False the method ignores valregs and does not\n                add regs for bits in the edge_map image that don't appear in valregs\n\n        Returns:\n            set(Register): the set of regs to add to self\n\n        Raises:\n            DAGCircuitError: if the wiremap fragments, or duplicates exist", "docstring_tokens": ["Check", "that", "wiremap", "neither", "fragments", "nor", "leaves", "duplicate", "registers", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257025}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/setup.py#L48-L57", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Set command option defaults.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "setuptools", ".", "command", ".", "build_py", ".", "build_py", ".", "Func", "(", "arg_0", ")", "arg_0", ".", "meteor", "=", "'meteor'", "arg_0", ".", "meteor_debug", "=", "False", "arg_0", ".", "build_lib", "=", "None", "arg_0", ".", "package_dir", "=", "None", "arg_0", ".", "meteor_builds", "=", "[", "]", "arg_0", ".", "no_prune_npm", "=", "None", "arg_0", ".", "inplace", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"Set command option defaults.\"\"\"\n        setuptools.command.build_py.build_py.Func(arg_0)\n        arg_0.meteor = 'meteor'\n        arg_0.meteor_debug = False\n        arg_0.build_lib = None\n        arg_0.package_dir = None\n        arg_0.meteor_builds = []\n        arg_0.no_prune_npm = None\n        arg_0.inplace = True", "path": "setup.py", "identifier": "build_meteor.initialize_options", "docstring": "Set command option defaults.", "docstring_tokens": ["Set", "command", "option", "defaults", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 257026}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/utils.py#L211-L213", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return the thresholded z-scored `icc`.", "language": "python", "parameters": "(icc, thr, mode='+')", "return_statement": "return thr_img(icc_img_to_zscore(icc), thr=thr, mode=mode).get_data()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'+'", ")", ":", "return", "thr_img", "(", "icc_img_to_zscore", "(", "arg_0", ")", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ".", "get_data", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2='+'):\n    \"\"\" Return the thresholded z-scored `icc`. \"\"\"\n    return thr_img(icc_img_to_zscore(arg_0), arg_1=arg_1, arg_2=arg_2).get_data()", "path": "boyle/nifti/utils.py", "identifier": "spatial_map", "docstring": "Return the thresholded z-scored `icc`.", "docstring_tokens": ["Return", "the", "thresholded", "z", "-", "scored", "icc", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 257027}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L780-L794", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Yield filenames.", "language": "python", "parameters": "(filenames, recursive, exclude)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "while", "arg_0", ":", "arg_3", "=", "arg_0", ".", "pop", "(", "0", ")", "if", "arg_1", "and", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", ":", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "os", ".", "walk", "(", "arg_3", ")", ":", "arg_0", "+=", "[", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_7", ")", "for", "arg_7", "in", "arg_6", "if", "match_file", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_7", ")", ",", "arg_2", ")", "]", "arg_5", "[", ":", "]", "=", "[", "d", "for", "d", "in", "arg_5", "if", "match_file", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "d", ")", ",", "arg_2", ")", "]", "else", ":", "if", "not", "is_exclude_file", "(", "arg_3", ",", "arg_2", ")", ":", "yield", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Yield filenames.\"\"\"\n    while arg_0:\n        arg_3 = arg_0.pop(0)\n        if arg_1 and os.path.isdir(arg_3):\n            for arg_4, arg_5, arg_6 in os.walk(arg_3):\n                arg_0 += [os.path.join(arg_4, arg_7) for arg_7 in arg_6\n                              if match_file(os.path.join(arg_4, arg_7),\n                                            arg_2)]\n                arg_5[:] = [d for d in arg_5\n                                  if match_file(os.path.join(arg_4, d),\n                                                arg_2)]\n        else:\n            if not is_exclude_file(arg_3, arg_2):\n                yield arg_3", "path": "autoflake.py", "identifier": "find_files", "docstring": "Yield filenames.", "docstring_tokens": ["Yield", "filenames", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 257028}
{"url": "https://github.com/alexprengere/currencyconverter/blob/e3cb0d693819c0c824214225b23a47e9380f71df/currency_converter/currency_converter.py#L67-L72", "sha": "e3cb0d693819c0c824214225b23a47e9380f71df", "docstring_summary": "Fast %Y-%m-%d parsing.", "language": "python", "parameters": "(s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "datetime", ".", "date", "(", "int", "(", "arg_0", "[", ":", "4", "]", ")", ",", "int", "(", "arg_0", "[", "5", ":", "7", "]", ")", ",", "int", "(", "arg_0", "[", "8", ":", "10", "]", ")", ")", "except", "ValueError", ":", "return", "datetime", ".", "datetime", ".", "strptime", "(", "arg_0", ",", "'%d %B %Y'", ")", ".", "date", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Fast %Y-%m-%d parsing.\"\"\"\n    try:\n        return datetime.date(int(arg_0[:4]), int(arg_0[5:7]), int(arg_0[8:10]))\n    except ValueError:  # other accepted format used in one-day data set\n        return datetime.datetime.strptime(arg_0, '%d %B %Y').date()", "path": "currency_converter/currency_converter.py", "identifier": "parse_date", "docstring": "Fast %Y-%m-%d parsing.", "docstring_tokens": ["Fast", "%Y", "-", "%m", "-", "%d", "parsing", "."], "nwo": "alexprengere/currencyconverter", "score": 0.5486903423646818, "idx": 257029}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/model_chooser.py#L66-L111", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Chooses the best model for a given job.", "language": "python", "parameters": "(self, forceUpdate=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "time", ".", "time", "(", ")", "-", "arg_0", ".", "_lastUpdateAttemptTime", "if", "arg_2", "<", "arg_0", ".", "_MIN_UPDATE_INTERVAL", "and", "not", "arg_1", ":", "return", "arg_0", ".", "logger", ".", "info", "(", "\"Attempting model selection for jobID=%d: time=%f\"", "\"  lastUpdate=%f\"", "%", "(", "arg_0", ".", "_jobID", ",", "time", ".", "time", "(", ")", ",", "arg_0", ".", "_lastUpdateAttemptTime", ")", ")", "arg_3", "=", "arg_0", ".", "_cjDB", ".", "jobUpdateSelectionSweep", "(", "arg_0", ".", "_jobID", ",", "arg_0", ".", "_MIN_UPDATE_INTERVAL", ")", "if", "not", "arg_3", ":", "arg_0", ".", "logger", ".", "info", "(", "\"Unable to update selection sweep timestamp: jobID=%d\"", "\" updateTime=%f\"", "%", "(", "arg_0", ".", "_jobID", ",", "arg_0", ".", "_lastUpdateAttemptTime", ")", ")", "if", "not", "arg_1", ":", "return", "arg_0", ".", "_lastUpdateAttemptTime", "=", "time", ".", "time", "(", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Succesfully updated selection sweep timestamp jobid=%d updateTime=%f\"", "%", "(", "arg_0", ".", "_jobID", ",", "arg_0", ".", "_lastUpdateAttemptTime", ")", ")", "arg_5", "=", "arg_0", ".", "_MIN_UPDATE_THRESHOLD", "arg_6", "=", "arg_0", ".", "_getJobResults", "(", ")", "if", "arg_1", "or", "arg_6", "is", "None", ":", "arg_5", "=", "0", "arg_7", ",", "arg_8", "=", "arg_0", ".", "_cjDB", ".", "modelsGetCandidates", "(", "arg_0", ".", "_jobID", ",", "arg_5", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Candidate models=%s, metric=%s, jobID=%s\"", "%", "(", "arg_7", ",", "arg_8", ",", "arg_0", ".", "_jobID", ")", ")", "if", "len", "(", "arg_7", ")", "==", "0", ":", "return", "arg_0", ".", "_jobUpdateCandidate", "(", "arg_7", "[", "0", "]", ",", "arg_8", ",", "results", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\" Chooses the best model for a given job.\n\n    Parameters\n    -----------------------------------------------------------------------\n    forceUpdate:  (True/False). If True, the update will ignore all the\n                  restrictions on the minimum time to update and the minimum\n                  number of records to update. This should typically only be\n                  set to true if the model has completed running\n    \"\"\"\n    arg_2 = time.time() - arg_0._lastUpdateAttemptTime\n    if arg_2 < arg_0._MIN_UPDATE_INTERVAL and not arg_1:\n      return\n\n    arg_0.logger.info(\"Attempting model selection for jobID=%d: time=%f\"\\\n                     \"  lastUpdate=%f\"%(arg_0._jobID,\n                                        time.time(),\n                                        arg_0._lastUpdateAttemptTime))\n\n    arg_3 = arg_0._cjDB.jobUpdateSelectionSweep(arg_0._jobID,\n                                                          arg_0._MIN_UPDATE_INTERVAL)\n    if not arg_3:\n      arg_0.logger.info(\"Unable to update selection sweep timestamp: jobID=%d\" \\\n                       \" updateTime=%f\"%(arg_0._jobID, arg_0._lastUpdateAttemptTime))\n      if not arg_1:\n        return\n\n    arg_0._lastUpdateAttemptTime = time.time()\n    arg_0.logger.info(\"Succesfully updated selection sweep timestamp jobid=%d updateTime=%f\"\\\n                     %(arg_0._jobID, arg_0._lastUpdateAttemptTime))\n\n    arg_5 = arg_0._MIN_UPDATE_THRESHOLD\n\n    arg_6 = arg_0._getJobResults()\n    if arg_1 or arg_6 is None:\n      arg_5 = 0\n\n    arg_7, arg_8 = arg_0._cjDB.modelsGetCandidates(arg_0._jobID, arg_5)\n\n    arg_0.logger.info(\"Candidate models=%s, metric=%s, jobID=%s\"\\\n                     %(arg_7, arg_8, arg_0._jobID))\n\n    if len(arg_7) == 0:\n      return\n\n    arg_0._jobUpdateCandidate(arg_7[0], arg_8, results=arg_6)", "path": "src/nupic/swarming/model_chooser.py", "identifier": "ModelChooser.updateResultsForJob", "docstring": "Chooses the best model for a given job.\n\n    Parameters\n    -----------------------------------------------------------------------\n    forceUpdate:  (True/False). If True, the update will ignore all the\n                  restrictions on the minimum time to update and the minimum\n                  number of records to update. This should typically only be\n                  set to true if the model has completed running", "docstring_tokens": ["Chooses", "the", "best", "model", "for", "a", "given", "job", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257030}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/connection.py#L646-L660", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Log the beginning of an API request.", "language": "python", "parameters": "(self, endpoint, data, json, files, params)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_0", ".", "_requests_counter", "+=", "1", "if", "not", "arg_0", ".", "_is_logging", ":", "return", "arg_6", "=", "\"\\n---- %d --------------------------------------------------------\\n\"", "%", "arg_0", ".", "_requests_counter", "arg_6", "+=", "\"[%s] %s\\n\"", "%", "(", "time", ".", "strftime", "(", "\"%H:%M:%S\"", ")", ",", "arg_1", ")", "if", "arg_5", "is", "not", "None", ":", "arg_6", "+=", "\"     params: {%s}\\n\"", "%", "\", \"", ".", "join", "(", "\"%s:%s\"", "%", "arg_7", "for", "arg_7", "in", "viewitems", "(", "arg_5", ")", ")", "if", "arg_2", "is", "not", "None", ":", "arg_6", "+=", "\"     body: {%s}\\n\"", "%", "\", \"", ".", "join", "(", "\"%s:%s\"", "%", "arg_7", "for", "arg_7", "in", "viewitems", "(", "arg_2", ")", ")", "if", "arg_3", "is", "not", "None", ":", "import", "arg_3", "as", "j", "arg_6", "+=", "\"     json: %s\\n\"", "%", "j", ".", "dumps", "(", "arg_3", ")", "if", "arg_4", "is", "not", "None", ":", "arg_6", "+=", "\"     file: %s\\n\"", "%", "\", \"", ".", "join", "(", "arg_8", ".", "name", "for", "arg_8", "in", "viewvalues", "(", "arg_4", ")", ")", "arg_0", ".", "_log_message", "(", "arg_6", "+", "\"\\n\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"Log the beginning of an API request.\"\"\"\n        # TODO: add information about the caller, i.e. which module + line of code called the .request() method\n        #       This can be done by fetching current traceback and then traversing it until we find the request function\n        arg_0._requests_counter += 1\n        if not arg_0._is_logging: return\n        arg_6 = \"\\n---- %d --------------------------------------------------------\\n\" % arg_0._requests_counter\n        arg_6 += \"[%s] %s\\n\" % (time.strftime(\"%H:%M:%S\"), arg_1)\n        if arg_5 is not None: arg_6 += \"     params: {%s}\\n\" % \", \".join(\"%s:%s\" % arg_7 for arg_7 in viewitems(arg_5))\n        if arg_2 is not None:   arg_6 += \"     body: {%s}\\n\" % \", \".join(\"%s:%s\" % arg_7 for arg_7 in viewitems(arg_2))\n        if arg_3 is not None:\n            import arg_3 as j\n            arg_6 += \"     json: %s\\n\" % j.dumps(arg_3)\n        if arg_4 is not None:  arg_6 += \"     file: %s\\n\" % \", \".join(arg_8.name for arg_8 in viewvalues(arg_4))\n        arg_0._log_message(arg_6 + \"\\n\")", "path": "h2o-py/h2o/backend/connection.py", "identifier": "H2OConnection._log_start_transaction", "docstring": "Log the beginning of an API request.", "docstring_tokens": ["Log", "the", "beginning", "of", "an", "API", "request", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257031}
{"url": "https://github.com/pln-fing-udelar/fast-krippendorff/blob/fbc983f206d41f76a6e8da8cabd7114941634420/krippendorff/krippendorff.py#L162-L261", "sha": "fbc983f206d41f76a6e8da8cabd7114941634420", "docstring_summary": "Compute Krippendorff's alpha.", "language": "python", "parameters": "(reliability_data=None, value_counts=None, value_domain=None, level_of_measurement='interval',\n          dtype=np.float64)", "return_statement": "return 1 - np.sum(o * d) / np.sum(e * d)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'interval'", ",", "arg_4", "=", "arg_5", ".", "float64", ")", ":", "if", "(", "arg_0", "is", "None", ")", "==", "(", "arg_1", "is", "None", ")", ":", "raise", "ValueError", "(", "\"Either reliability_data or value_counts must be provided, but not both.\"", ")", "if", "arg_1", "is", "None", ":", "if", "type", "(", "arg_0", ")", "is", "not", "arg_5", ".", "ndarray", ":", "arg_0", "=", "arg_5", ".", "array", "(", "arg_0", ")", "arg_2", "=", "arg_2", "or", "arg_5", ".", "unique", "(", "arg_0", "[", "~", "arg_5", ".", "isnan", "(", "arg_0", ")", "]", ")", "arg_1", "=", "_reliability_data_to_value_counts", "(", "arg_0", ",", "arg_2", ")", "else", ":", "if", "arg_2", ":", "assert", "arg_1", ".", "shape", "[", "1", "]", "==", "len", "(", "arg_2", ")", ",", "\"The value domain should be equal to the number of columns of value_counts.\"", "else", ":", "arg_2", "=", "tuple", "(", "range", "(", "arg_1", ".", "shape", "[", "1", "]", ")", ")", "arg_7", "=", "_distance_metric", "(", "arg_3", ")", "arg_8", "=", "_coincidences", "(", "arg_1", ",", "arg_2", ",", "arg_4", "=", "arg_4", ")", "arg_9", "=", "arg_5", ".", "sum", "(", "arg_8", ",", "axis", "=", "0", ")", "arg_10", "=", "arg_5", ".", "sum", "(", "arg_9", ")", "arg_11", "=", "_random_coincidences", "(", "arg_2", ",", "arg_10", ",", "arg_9", ")", "arg_12", "=", "_distances", "(", "arg_2", ",", "arg_7", ",", "arg_9", ")", "return", "1", "-", "arg_5", ".", "sum", "(", "arg_8", "*", "arg_12", ")", "/", "arg_5", ".", "sum", "(", "arg_11", "*", "arg_12", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3='interval',\n          arg_4=arg_5.float64):\n    \"\"\"Compute Krippendorff's Func.\n\n    See https://en.wikipedia.org/wiki/Krippendorff%27s_Func for more information.\n\n    Parameters\n    ----------\n    reliability_data : array_like, with shape (M, N)\n        Reliability data matrix which has the rate the i coder gave to the j unit, where M is the number of raters\n        and N is the unit count.\n        Missing rates are represented with `np.nan`.\n        If it's provided then `value_counts` must not be provided.\n\n    value_counts : ndarray, with shape (N, V)\n        Number of coders that assigned a certain value to a determined unit, where N is the number of units\n        and V is the value count.\n        If it's provided then `reliability_data` must not be provided.\n\n    value_domain : array_like, with shape (V,)\n        Possible values the units can take.\n        If the level of measurement is not nominal, it must be ordered.\n        If `reliability_data` is provided, then the default value is the ordered list of unique rates that appear.\n        Else, the default value is `list(range(V))`.\n\n    level_of_measurement : string or callable\n        Steven's level of measurement of the variable.\n        It must be one of 'nominal', 'ordinal', 'interval', 'ratio' or a callable.\n\n    dtype : data-type\n        Result and computation data-type.\n\n    Returns\n    -------\n    Func : `dtype`\n        Scalar value of Krippendorff's Func of type `dtype`.\n\n    Examples\n    --------\n    >>> reliability_data = [[np.nan, np.nan, np.nan, np.nan, np.nan, 3, 4, 1, 2, 1, 1, 3, 3, np.nan, 3],\n    ...                     [1, np.nan, 2, 1, 3, 3, 4, 3, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],\n    ...                     [np.nan, np.nan, 2, 1, 3, 4, 4, np.nan, 2, 1, 1, 3, 3, np.nan, 4]]\n    >>> print(round(Func(reliability_data=reliability_data, level_of_measurement='nominal'), 6))\n    0.691358\n    >>> print(round(Func(reliability_data=reliability_data, level_of_measurement='interval'), 6))\n    0.810845\n    >>> value_counts = np.array([[1, 0, 0, 0],\n    ...                          [0, 0, 0, 0],\n    ...                          [0, 2, 0, 0],\n    ...                          [2, 0, 0, 0],\n    ...                          [0, 0, 2, 0],\n    ...                          [0, 0, 2, 1],\n    ...                          [0, 0, 0, 3],\n    ...                          [1, 0, 1, 0],\n    ...                          [0, 2, 0, 0],\n    ...                          [2, 0, 0, 0],\n    ...                          [2, 0, 0, 0],\n    ...                          [0, 0, 2, 0],\n    ...                          [0, 0, 2, 0],\n    ...                          [0, 0, 0, 0],\n    ...                          [0, 0, 1, 1]])\n    >>> print(round(Func(value_counts=value_counts, level_of_measurement='nominal'), 6))\n    0.691358\n    >>> # The following examples were extracted from\n    >>> # https://www.statisticshowto.datasciencecentral.com/wp-content/uploads/2016/07/fulltext.pdf, page 8.\n    >>> reliability_data = [[1, 2, 3, 3, 2, 1, 4, 1, 2, np.nan, np.nan, np.nan],\n    ...                     [1, 2, 3, 3, 2, 2, 4, 1, 2, 5, np.nan, 3.],\n    ...                     [np.nan, 3, 3, 3, 2, 3, 4, 2, 2, 5, 1, np.nan],\n    ...                     [1, 2, 3, 3, 2, 4, 4, 1, 2, 5, 1, np.nan]]\n    >>> print(round(Func(reliability_data, level_of_measurement='ordinal'), 3))\n    0.815\n    >>> print(round(Func(reliability_data, level_of_measurement='ratio'), 3))\n    0.797\n    \"\"\"\n    if (arg_0 is None) == (arg_1 is None):\n        raise ValueError(\"Either reliability_data or value_counts must be provided, but not both.\")\n\n    # Don't know if it's a list or numpy array. If it's the latter, the truth value is ambiguous. So, ask for None.\n    if arg_1 is None:\n        if type(arg_0) is not arg_5.ndarray:\n            arg_0 = arg_5.array(arg_0)\n\n        arg_2 = arg_2 or arg_5.unique(arg_0[~arg_5.isnan(arg_0)])\n\n        arg_1 = _reliability_data_to_value_counts(arg_0, arg_2)\n    else:  # elif reliability_data is None\n        if arg_2:\n            assert arg_1.shape[1] == len(arg_2), \\\n                \"The value domain should be equal to the number of columns of value_counts.\"\n        else:\n            arg_2 = tuple(range(arg_1.shape[1]))\n\n    arg_7 = _distance_metric(arg_3)\n\n    arg_8 = _coincidences(arg_1, arg_2, arg_4=arg_4)\n    arg_9 = arg_5.sum(arg_8, axis=0)\n    arg_10 = arg_5.sum(arg_9)\n    arg_11 = _random_coincidences(arg_2, arg_10, arg_9)\n    arg_12 = _distances(arg_2, arg_7, arg_9)\n    return 1 - arg_5.sum(arg_8 * arg_12) / arg_5.sum(arg_11 * arg_12)", "path": "krippendorff/krippendorff.py", "identifier": "alpha", "docstring": "Compute Krippendorff's alpha.\n\n    See https://en.wikipedia.org/wiki/Krippendorff%27s_alpha for more information.\n\n    Parameters\n    ----------\n    reliability_data : array_like, with shape (M, N)\n        Reliability data matrix which has the rate the i coder gave to the j unit, where M is the number of raters\n        and N is the unit count.\n        Missing rates are represented with `np.nan`.\n        If it's provided then `value_counts` must not be provided.\n\n    value_counts : ndarray, with shape (N, V)\n        Number of coders that assigned a certain value to a determined unit, where N is the number of units\n        and V is the value count.\n        If it's provided then `reliability_data` must not be provided.\n\n    value_domain : array_like, with shape (V,)\n        Possible values the units can take.\n        If the level of measurement is not nominal, it must be ordered.\n        If `reliability_data` is provided, then the default value is the ordered list of unique rates that appear.\n        Else, the default value is `list(range(V))`.\n\n    level_of_measurement : string or callable\n        Steven's level of measurement of the variable.\n        It must be one of 'nominal', 'ordinal', 'interval', 'ratio' or a callable.\n\n    dtype : data-type\n        Result and computation data-type.\n\n    Returns\n    -------\n    alpha : `dtype`\n        Scalar value of Krippendorff's alpha of type `dtype`.\n\n    Examples\n    --------\n    >>> reliability_data = [[np.nan, np.nan, np.nan, np.nan, np.nan, 3, 4, 1, 2, 1, 1, 3, 3, np.nan, 3],\n    ...                     [1, np.nan, 2, 1, 3, 3, 4, 3, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],\n    ...                     [np.nan, np.nan, 2, 1, 3, 4, 4, np.nan, 2, 1, 1, 3, 3, np.nan, 4]]\n    >>> print(round(alpha(reliability_data=reliability_data, level_of_measurement='nominal'), 6))\n    0.691358\n    >>> print(round(alpha(reliability_data=reliability_data, level_of_measurement='interval'), 6))\n    0.810845\n    >>> value_counts = np.array([[1, 0, 0, 0],\n    ...                          [0, 0, 0, 0],\n    ...                          [0, 2, 0, 0],\n    ...                          [2, 0, 0, 0],\n    ...                          [0, 0, 2, 0],\n    ...                          [0, 0, 2, 1],\n    ...                          [0, 0, 0, 3],\n    ...                          [1, 0, 1, 0],\n    ...                          [0, 2, 0, 0],\n    ...                          [2, 0, 0, 0],\n    ...                          [2, 0, 0, 0],\n    ...                          [0, 0, 2, 0],\n    ...                          [0, 0, 2, 0],\n    ...                          [0, 0, 0, 0],\n    ...                          [0, 0, 1, 1]])\n    >>> print(round(alpha(value_counts=value_counts, level_of_measurement='nominal'), 6))\n    0.691358\n    >>> # The following examples were extracted from\n    >>> # https://www.statisticshowto.datasciencecentral.com/wp-content/uploads/2016/07/fulltext.pdf, page 8.\n    >>> reliability_data = [[1, 2, 3, 3, 2, 1, 4, 1, 2, np.nan, np.nan, np.nan],\n    ...                     [1, 2, 3, 3, 2, 2, 4, 1, 2, 5, np.nan, 3.],\n    ...                     [np.nan, 3, 3, 3, 2, 3, 4, 2, 2, 5, 1, np.nan],\n    ...                     [1, 2, 3, 3, 2, 4, 4, 1, 2, 5, 1, np.nan]]\n    >>> print(round(alpha(reliability_data, level_of_measurement='ordinal'), 3))\n    0.815\n    >>> print(round(alpha(reliability_data, level_of_measurement='ratio'), 3))\n    0.797", "docstring_tokens": ["Compute", "Krippendorff", "s", "alpha", "."], "nwo": "pln-fing-udelar/fast-krippendorff", "score": 0.28638914490610956, "idx": 257032}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L149-L169", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "This function prepares a list of hiveconf params\n        from a dictionary of key value pairs.", "language": "python", "parameters": "(d)", "return_statement": "return as_flattened_list(\n            zip([\"-hiveconf\"] * len(d),\n                [\"{}={}\".format(k, v) for k, v in d.items()])\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "[", "]", "return", "as_flattened_list", "(", "zip", "(", "[", "\"-hiveconf\"", "]", "*", "len", "(", "arg_0", ")", ",", "[", "\"{}={}\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", "]", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        This function prepares a list of hiveconf params\n        from a dictionary of key value pairs.\n\n        :param d:\n        :type d: dict\n\n        >>> hh = HiveCliHook()\n        >>> hive_conf = {\"hive.exec.dynamic.partition\": \"true\",\n        ... \"hive.exec.dynamic.partition.mode\": \"nonstrict\"}\n        >>> hh.Func(hive_conf)\n        [\"-hiveconf\", \"hive.exec.dynamic.partition=true\",\\\n \"-hiveconf\", \"hive.exec.dynamic.partition.mode=nonstrict\"]\n        \"\"\"\n        if not arg_0:\n            return []\n        return as_flattened_list(\n            zip([\"-hiveconf\"] * len(arg_0),\n                [\"{}={}\".format(arg_1, arg_2) for arg_1, arg_2 in arg_0.items()])\n        )", "path": "airflow/hooks/hive_hooks.py", "identifier": "HiveCliHook._prepare_hiveconf", "docstring": "This function prepares a list of hiveconf params\n        from a dictionary of key value pairs.\n\n        :param d:\n        :type d: dict\n\n        >>> hh = HiveCliHook()\n        >>> hive_conf = {\"hive.exec.dynamic.partition\": \"true\",\n        ... \"hive.exec.dynamic.partition.mode\": \"nonstrict\"}\n        >>> hh._prepare_hiveconf(hive_conf)\n        [\"-hiveconf\", \"hive.exec.dynamic.partition=true\",\\\n \"-hiveconf\", \"hive.exec.dynamic.partition.mode=nonstrict\"]", "docstring_tokens": ["This", "function", "prepares", "a", "list", "of", "hiveconf", "params", "from", "a", "dictionary", "of", "key", "value", "pairs", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257033}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/github.py#L74-L104", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Pagination utility.  Obnoxious.", "language": "python", "parameters": "(self, url, subkey=None)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "}", "if", "'basic'", "in", "arg_0", ".", "auth", ":", "arg_3", "[", "'auth'", "]", "=", "arg_0", ".", "auth", "[", "'basic'", "]", "arg_4", "=", "[", "]", "arg_5", "=", "dict", "(", "next", "=", "arg_1", ")", "while", "'next'", "in", "arg_5", ":", "arg_6", "=", "arg_0", ".", "session", ".", "get", "(", "arg_5", "[", "'next'", "]", ",", "**", "arg_3", ")", "if", "arg_6", ".", "status_code", "==", "404", "and", "'token'", "in", "arg_0", ".", "auth", ":", "log", ".", "warn", "(", "\"A '404' from github may indicate an auth \"", "\"failure. Make sure both that your token is correct \"", "\"and that it has 'public_repo' and not 'public \"", "\"access' rights.\"", ")", "arg_7", "=", "arg_0", ".", "json_response", "(", "arg_6", ")", "if", "arg_2", "is", "not", "None", ":", "arg_7", "=", "arg_7", "[", "arg_2", "]", "arg_4", "+=", "arg_7", "arg_5", "=", "arg_0", ".", "_link_field_to_dict", "(", "arg_6", ".", "headers", ".", "get", "(", "'link'", ",", "None", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\" Pagination utility.  Obnoxious. \"\"\"\n\n        arg_3 = {}\n        if 'basic' in arg_0.auth:\n            arg_3['auth'] = arg_0.auth['basic']\n\n        arg_4 = []\n        arg_5 = dict(next=arg_1)\n\n        while 'next' in arg_5:\n            arg_6 = arg_0.session.get(arg_5['next'], **arg_3)\n\n            # Warn about the mis-leading 404 error code.  See:\n            # https://github.com/ralphbean/bugwarrior/issues/374\n            if arg_6.status_code == 404 and 'token' in arg_0.auth:\n                log.warn(\"A '404' from github may indicate an auth \"\n                         \"failure. Make sure both that your token is correct \"\n                         \"and that it has 'public_repo' and not 'public \"\n                         \"access' rights.\")\n\n            arg_7 = arg_0.json_response(arg_6)\n\n            if arg_2 is not None:\n                arg_7 = arg_7[arg_2]\n\n            arg_4 += arg_7\n\n            arg_5 = arg_0._link_field_to_dict(arg_6.headers.get('link', None))\n\n        return arg_4", "path": "bugwarrior/services/github.py", "identifier": "GithubClient._getter", "docstring": "Pagination utility.  Obnoxious.", "docstring_tokens": ["Pagination", "utility", ".", "Obnoxious", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 257034}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/vector_diffeomixture.py#L108-L199", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Use SoftmaxNormal quantiles to form quadrature on `K - 1` simplex.", "language": "python", "parameters": "(\n    normal_loc, normal_scale, quadrature_size,\n    validate_args=False, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_4", "or", "\"softmax_normal_grid_and_probs\"", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_4", "=", "\"normal_loc\"", ")", "arg_5", "=", "dtype_util", ".", "base_dtype", "(", "arg_0", ".", "dtype", ")", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "dtype", "=", "arg_5", ",", "arg_4", "=", "\"normal_scale\"", ")", "arg_1", "=", "maybe_check_quadrature_param", "(", "arg_1", ",", "\"normal_scale\"", ",", "arg_3", ")", "arg_6", "=", "normal", ".", "Normal", "(", "loc", "=", "arg_0", ",", "scale", "=", "arg_1", ")", "def", "_get_batch_ndims", "(", ")", ":", "arg_7", "=", "tensorshape_util", ".", "rank", "(", "arg_6", ".", "batch_shape", ")", "if", "arg_7", "is", "None", ":", "arg_7", "=", "tf", ".", "shape", "(", "input", "=", "arg_6", ".", "batch_shape_tensor", "(", ")", ")", "[", "0", "]", "return", "arg_7", "arg_8", "=", "_get_batch_ndims", "(", ")", "def", "_get_final_shape", "(", "arg_9", ")", ":", "arg_10", "=", "tensorshape_util", ".", "with_rank_at_least", "(", "arg_6", ".", "batch_shape", ",", "1", ")", "arg_11", "=", "tf", ".", "compat", ".", "dimension_value", "(", "arg_10", "[", "-", "1", "]", ")", "if", "arg_11", "is", "not", "None", ":", "arg_11", "+=", "1", "arg_12", "=", "tf", ".", "TensorShape", "(", "[", "arg_11", ",", "arg_9", "]", ")", "return", "arg_10", "[", ":", "-", "1", "]", ".", "concatenate", "(", "arg_12", ")", "def", "_compute_quantiles", "(", ")", ":", "arg_13", "=", "tf", ".", "zeros", "(", "[", "]", ",", "dtype", "=", "arg_6", ".", "dtype", ")", "arg_14", "=", "tf", ".", "linspace", "(", "arg_13", ",", "1.", ",", "arg_2", "+", "3", ")", "[", "1", ":", "-", "1", "]", "arg_14", "=", "tf", ".", "reshape", "(", "arg_14", ",", "shape", "=", "tf", ".", "concat", "(", "[", "[", "-", "1", "]", ",", "tf", ".", "ones", "(", "[", "arg_8", "]", ",", "dtype", "=", "tf", ".", "int32", ")", "]", ",", "axis", "=", "0", ")", ")", "arg_15", "=", "arg_6", ".", "quantile", "(", "arg_14", ")", "arg_15", "=", "softmax_centered_bijector", ".", "SoftmaxCentered", "(", ")", ".", "forward", "(", "arg_15", ")", "arg_16", "=", "tf", ".", "concat", "(", "[", "tf", ".", "range", "(", "1", ",", "1", "+", "arg_8", ")", ",", "[", "0", "]", "]", ",", "axis", "=", "0", ")", "arg_15", "=", "tf", ".", "transpose", "(", "a", "=", "arg_15", ",", "arg_16", "=", "arg_16", ")", "tensorshape_util", ".", "set_shape", "(", "arg_15", ",", "_get_final_shape", "(", "arg_2", "+", "1", ")", ")", "return", "arg_15", "arg_15", "=", "_compute_quantiles", "(", ")", "arg_17", "=", "(", "arg_15", "[", "...", ",", ":", "-", "1", "]", "+", "arg_15", "[", "...", ",", "1", ":", "]", ")", "/", "2.", "tensorshape_util", ".", "set_shape", "(", "arg_17", ",", "_get_final_shape", "(", "arg_2", ")", ")", "arg_18", "=", "tf", ".", "fill", "(", "dims", "=", "[", "arg_2", "]", ",", "value", "=", "1.", "/", "tf", ".", "cast", "(", "arg_2", ",", "arg_6", ".", "dtype", ")", ")", "return", "arg_17", ",", "arg_18"], "function": "def Func(\n    arg_0, arg_1, arg_2,\n    arg_3=False, arg_4=None):\n  \"\"\"Use SoftmaxNormal quantiles to form quadrature on `K - 1` simplex.\n\n  A `SoftmaxNormal` random variable `Y` may be generated via\n\n  ```\n  Y = SoftmaxCentered(X),\n  X = Normal(normal_loc, normal_scale)\n  ```\n\n  Args:\n    normal_loc: `float`-like `Tensor` with shape `[b1, ..., bB, K-1]`, B>=0.\n      The location parameter of the Normal used to construct the SoftmaxNormal.\n    normal_scale: `float`-like `Tensor`. Broadcastable with `normal_loc`.\n      The scale parameter of the Normal used to construct the SoftmaxNormal.\n    quadrature_size: Python `int` scalar representing the number of quadrature\n      points.\n    validate_args: Python `bool`, default `False`. When `True` distribution\n      parameters are checked for validity despite possibly degrading runtime\n      performance. When `False` invalid inputs may silently render incorrect\n      outputs.\n    name: Python `str` name prefixed to Ops created by this class.\n\n  Returns:\n    grid: Shape `[b1, ..., bB, K, quadrature_size]` `Tensor` representing the\n      convex combination of affine parameters for `K` components.\n      `grid[..., :, n]` is the `n`-th grid point, living in the `K - 1` simplex.\n    probs:  Shape `[b1, ..., bB, K, quadrature_size]` `Tensor` representing the\n      associated with each grid point.\n  \"\"\"\n  with tf.name_scope(arg_4 or \"softmax_normal_grid_and_probs\"):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_4=\"normal_loc\")\n    arg_5 = dtype_util.base_dtype(arg_0.dtype)\n    arg_1 = tf.convert_to_tensor(\n        value=arg_1, dtype=arg_5, arg_4=\"normal_scale\")\n\n    arg_1 = maybe_check_quadrature_param(\n        arg_1, \"normal_scale\", arg_3)\n\n    arg_6 = normal.Normal(loc=arg_0, scale=arg_1)\n\n    def _get_batch_ndims():\n      \"\"\"Helper to get rank(dist.batch_shape), statically if possible.\"\"\"\n      arg_7 = tensorshape_util.rank(arg_6.batch_shape)\n      if arg_7 is None:\n        arg_7 = tf.shape(input=arg_6.batch_shape_tensor())[0]\n      return arg_7\n    arg_8 = _get_batch_ndims()\n\n    def _get_final_shape(arg_9):\n      \"\"\"Helper to build `TensorShape`.\"\"\"\n      arg_10 = tensorshape_util.with_rank_at_least(arg_6.batch_shape, 1)\n      arg_11 = tf.compat.dimension_value(arg_10[-1])\n      if arg_11 is not None:\n        arg_11 += 1\n      arg_12 = tf.TensorShape([arg_11, arg_9])\n      return arg_10[:-1].concatenate(arg_12)\n\n    def _compute_quantiles():\n      \"\"\"Helper to build quantiles.\"\"\"\n      # Omit {0, 1} since they might lead to Inf/NaN.\n      arg_13 = tf.zeros([], dtype=arg_6.dtype)\n      arg_14 = tf.linspace(arg_13, 1., arg_2 + 3)[1:-1]\n      # Expand edges so its broadcast across batch dims.\n      arg_14 = tf.reshape(\n          arg_14,\n          shape=tf.concat(\n              [[-1], tf.ones([arg_8], dtype=tf.int32)], axis=0))\n      arg_15 = arg_6.quantile(arg_14)\n      arg_15 = softmax_centered_bijector.SoftmaxCentered().forward(arg_15)\n      # Cyclically permute left by one.\n      arg_16 = tf.concat([tf.range(1, 1 + arg_8), [0]], axis=0)\n      arg_15 = tf.transpose(a=arg_15, arg_16=arg_16)\n      tensorshape_util.set_shape(\n          arg_15, _get_final_shape(arg_2 + 1))\n      return arg_15\n    arg_15 = _compute_quantiles()\n\n    # Compute grid as quantile midpoints.\n    arg_17 = (arg_15[..., :-1] + arg_15[..., 1:]) / 2.\n    # Set shape hints.\n    tensorshape_util.set_shape(arg_17, _get_final_shape(arg_2))\n\n    # By construction probs is constant, i.e., `1 / quadrature_size`. This is\n    # important, because non-constant probs leads to non-reparameterizable\n    # samples.\n    arg_18 = tf.fill(\n        dims=[arg_2], value=1. / tf.cast(arg_2, arg_6.dtype))\n\n    return arg_17, arg_18", "path": "tensorflow_probability/python/distributions/vector_diffeomixture.py", "identifier": "quadrature_scheme_softmaxnormal_quantiles", "docstring": "Use SoftmaxNormal quantiles to form quadrature on `K - 1` simplex.\n\n  A `SoftmaxNormal` random variable `Y` may be generated via\n\n  ```\n  Y = SoftmaxCentered(X),\n  X = Normal(normal_loc, normal_scale)\n  ```\n\n  Args:\n    normal_loc: `float`-like `Tensor` with shape `[b1, ..., bB, K-1]`, B>=0.\n      The location parameter of the Normal used to construct the SoftmaxNormal.\n    normal_scale: `float`-like `Tensor`. Broadcastable with `normal_loc`.\n      The scale parameter of the Normal used to construct the SoftmaxNormal.\n    quadrature_size: Python `int` scalar representing the number of quadrature\n      points.\n    validate_args: Python `bool`, default `False`. When `True` distribution\n      parameters are checked for validity despite possibly degrading runtime\n      performance. When `False` invalid inputs may silently render incorrect\n      outputs.\n    name: Python `str` name prefixed to Ops created by this class.\n\n  Returns:\n    grid: Shape `[b1, ..., bB, K, quadrature_size]` `Tensor` representing the\n      convex combination of affine parameters for `K` components.\n      `grid[..., :, n]` is the `n`-th grid point, living in the `K - 1` simplex.\n    probs:  Shape `[b1, ..., bB, K, quadrature_size]` `Tensor` representing the\n      associated with each grid point.", "docstring_tokens": ["Use", "SoftmaxNormal", "quantiles", "to", "form", "quadrature", "on", "K", "-", "1", "simplex", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257035}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/util/array_util.py#L59-L100", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Resize an array to a new size by extracting a sub-set of the array.", "language": "python", "parameters": "(array_2d, y0, y1, x0, x1)", "return_statement": "return resized_array", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "(", "arg_2", "-", "arg_1", ",", "arg_4", "-", "arg_3", ")", "arg_6", "=", "np", ".", "zeros", "(", "shape", "=", "arg_5", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "range", "(", "arg_1", ",", "arg_2", ")", ")", ":", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "range", "(", "arg_3", ",", "arg_4", ")", ")", ":", "arg_6", "[", "arg_7", ",", "arg_9", "]", "=", "arg_0", "[", "arg_8", ",", "arg_10", "]", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Resize an array to a new size by extracting a sub-set of the array.\n\n    The extracted input coordinates use NumPy convention, such that the upper values should be specified as +1 the \\\n    dimensions of the extracted array.\n\n    In the example below, an array of size (5,5) is extracted using the coordinates y0=1, y1=4, x0=1, x1=4. This\n    extracts an array of dimensions (2,2) and is equivalent to array_2d[1:4, 1:4]\n\n    Parameters\n    ----------\n    array_2d : ndarray\n        The 2D array that is an array is extracted from.\n    y0 : int\n        The lower row number (e.g. the higher y-coodinate) of the array that is extracted for the resize.\n    y1 : int\n        The upper row number (e.g. the lower y-coodinate) of the array that is extracted for the resize.\n    x0 : int\n        The lower column number (e.g. the lower x-coodinate) of the array that is extracted for the resize.\n    x1 : int\n        The upper column number (e.g. the higher x-coodinate) of the array that is extracted for the resize.\n\n    Returns\n    -------\n    ndarray\n        The extracted 2D array from the input 2D array.\n\n    Examples\n    --------\n    array_2d = np.ones((5,5))\n    extracted_array = extract_array_2d(array_2d=array_2d, y0=1, y1=4, x0=1, x1=4)\n    \"\"\"\n\n    arg_5 = (arg_2-arg_1, arg_4-arg_3)\n\n    arg_6 = np.zeros(shape=arg_5)\n\n    for arg_7, arg_8 in enumerate(range(arg_1, arg_2)):\n        for arg_9, arg_10 in enumerate(range(arg_3, arg_4)):\n                arg_6[arg_7, arg_9] = arg_0[arg_8, arg_10]\n\n    return arg_6", "path": "autolens/data/array/util/array_util.py", "identifier": "extracted_array_2d_from_array_2d_and_coordinates", "docstring": "Resize an array to a new size by extracting a sub-set of the array.\n\n    The extracted input coordinates use NumPy convention, such that the upper values should be specified as +1 the \\\n    dimensions of the extracted array.\n\n    In the example below, an array of size (5,5) is extracted using the coordinates y0=1, y1=4, x0=1, x1=4. This\n    extracts an array of dimensions (2,2) and is equivalent to array_2d[1:4, 1:4]\n\n    Parameters\n    ----------\n    array_2d : ndarray\n        The 2D array that is an array is extracted from.\n    y0 : int\n        The lower row number (e.g. the higher y-coodinate) of the array that is extracted for the resize.\n    y1 : int\n        The upper row number (e.g. the lower y-coodinate) of the array that is extracted for the resize.\n    x0 : int\n        The lower column number (e.g. the lower x-coodinate) of the array that is extracted for the resize.\n    x1 : int\n        The upper column number (e.g. the higher x-coodinate) of the array that is extracted for the resize.\n\n    Returns\n    -------\n    ndarray\n        The extracted 2D array from the input 2D array.\n\n    Examples\n    --------\n    array_2d = np.ones((5,5))\n    extracted_array = extract_array_2d(array_2d=array_2d, y0=1, y1=4, x0=1, x1=4)", "docstring_tokens": ["Resize", "an", "array", "to", "a", "new", "size", "by", "extracting", "a", "sub", "-", "set", "of", "the", "array", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 257036}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L315-L333", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Perform the actual uncompression.", "language": "python", "parameters": "(zipped_file, output_directory)", "return_statement": "return output_directory", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "zipfile", ".", "ZipFile", "(", "arg_0", ")", "for", "arg_3", "in", "arg_2", ".", "namelist", "(", ")", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_3", ")", "arg_5", ",", "arg_6", "=", "os", ".", "path", ".", "split", "(", "arg_4", ")", "try", ":", "if", "arg_4", ".", "endswith", "(", "os", ".", "sep", ")", "and", "not", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "os", ".", "makedirs", "(", "arg_4", ")", "elif", "not", "os", ".", "path", ".", "exists", "(", "arg_4", ")", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "os", ".", "path", ".", "dirname", "(", "arg_3", ")", ")", "if", "os", ".", "path", ".", "dirname", "(", "arg_3", ")", "and", "not", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "os", ".", "makedirs", "(", "arg_5", ")", "arg_7", "=", "open", "(", "arg_4", ",", "\"w\"", ")", "arg_7", ".", "write", "(", "arg_2", ".", "read", "(", "arg_3", ")", ")", "arg_7", ".", "close", "(", ")", "except", "IOError", ",", "e", ":", "raise", "e", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Perform the actual uncompression.\"\"\"\n    arg_2 = zipfile.ZipFile(arg_0)\n    for arg_3 in arg_2.namelist():\n        arg_4 = os.path.join(arg_1, arg_3)\n        arg_5, arg_6 = os.path.split(arg_4)\n        try:\n            if arg_4.endswith(os.sep) and not os.path.exists(arg_5):\n                os.makedirs(arg_4)\n            elif not os.path.exists(arg_4):\n                arg_5 = os.path.join(arg_1, os.path.dirname(arg_3))\n                if os.path.dirname(arg_3) and not os.path.exists(arg_5):\n                    os.makedirs(arg_5)\n                arg_7 = open(arg_4, \"w\")\n                arg_7.write(arg_2.read(arg_3))\n                arg_7.close()\n        except IOError, e:\n            raise e\n    return arg_1", "path": "harvestingkit/utils.py", "identifier": "_do_unzip", "docstring": "Perform the actual uncompression.", "docstring_tokens": ["Perform", "the", "actual", "uncompression", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257037}
{"url": "https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/setup.py#L5-L17", "sha": "afd2876316a715d3401adb442d46c9a07cd7e806", "docstring_summary": "Generate .rst document for PyPi.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "argparse", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", ")", "arg_0", ".", "add_argument", "(", "'--doc'", ",", "dest", "=", "\"doc\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ")", "arg_1", ",", "arg_2", ".", "argv", "=", "arg_0", ".", "parse_known_args", "(", "arg_2", ".", "argv", ")", "if", "arg_1", ".", "doc", ":", "import", "doc2md", ",", "pypandoc", "arg_4", "=", "doc2md", ".", "doc2md", "(", "doc2md", ".", "__doc__", ",", "\"doc2md\"", ",", "toc", "=", "False", ")", "Func", "=", "pypandoc", ".", "convert", "(", "arg_4", ",", "'rst'", ",", "format", "=", "'md'", ")", "else", ":", "return", "None"], "function": "def Func():\n    \"\"\"Generate .rst document for PyPi.\"\"\"\n    import argparse\n    arg_0 = argparse.ArgumentParser()\n    arg_0.add_argument('--doc', dest=\"doc\",\n            action=\"store_true\", default=False)\n    arg_1, arg_2.argv = arg_0.parse_known_args(arg_2.argv)\n    if arg_1.doc:\n        import doc2md, pypandoc\n        arg_4 = doc2md.doc2md(doc2md.__doc__, \"doc2md\", toc=False)\n        Func = pypandoc.convert(arg_4, 'rst', format='md')\n    else:\n        return None", "path": "setup.py", "identifier": "long_description", "docstring": "Generate .rst document for PyPi.", "docstring_tokens": ["Generate", ".", "rst", "document", "for", "PyPi", "."], "nwo": "coldfix/doc2md", "score": 0.5672608523629893, "idx": 257038}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/functions.py#L247-L273", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Extracts the year out of a datetime sample.", "language": "python", "parameters": "(x)", "return_statement": "return pd.Series(x).dt.year.values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "pandas", "as", "pd", "return", "pd", ".", "Series", "(", "arg_0", ")", ".", "dt", ".", "year", ".", "values"], "function": "def Func(arg_0):\n    \"\"\"Extracts the year out of a datetime sample.\n\n    :returns: an expression containing the year extracted from a datetime column.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.year\n    Expression = Func(date)\n    Length: 3 dtype: int64 (expression)\n    -----------------------------------\n    0  2009\n    1  2016\n    2  2015\n    \"\"\"\n    import pandas as pd\n    return pd.Series(arg_0).dt.year.values", "path": "packages/vaex-core/vaex/functions.py", "identifier": "dt_year", "docstring": "Extracts the year out of a datetime sample.\n\n    :returns: an expression containing the year extracted from a datetime column.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.year\n    Expression = dt_year(date)\n    Length: 3 dtype: int64 (expression)\n    -----------------------------------\n    0  2009\n    1  2016\n    2  2015", "docstring_tokens": ["Extracts", "the", "year", "out", "of", "a", "datetime", "sample", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257039}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_translate_hook.py#L34-L43", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Retrieves connection to Cloud Translate", "language": "python", "parameters": "(self)", "return_statement": "return self._client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_client", ":", "arg_0", ".", "_client", "=", "Client", "(", "credentials", "=", "arg_0", ".", "_get_credentials", "(", ")", ")", "return", "arg_0", ".", "_client"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieves connection to Cloud Translate\n\n        :return: Google Cloud Translate client object.\n        :rtype: Client\n        \"\"\"\n        if not arg_0._client:\n            arg_0._client = Client(credentials=arg_0._get_credentials())\n        return arg_0._client", "path": "airflow/contrib/hooks/gcp_translate_hook.py", "identifier": "CloudTranslateHook.get_conn", "docstring": "Retrieves connection to Cloud Translate\n\n        :return: Google Cloud Translate client object.\n        :rtype: Client", "docstring_tokens": ["Retrieves", "connection", "to", "Cloud", "Translate"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257040}
{"url": "https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/acts.py#L599-L623", "sha": "b7ad20fe8e7137db99a20ac06b8da26492601b00", "docstring_summary": "Writes the graph G in dot file format for graphviz visualization.", "language": "python", "parameters": "(G, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "io", ".", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "fh", ":", "fh", ".", "write", "(", "\"strict digraph DependencyDiagram {\\n\"", ")", "arg_2", "=", "arg_0", ".", "edges", "(", ")", "arg_3", "=", "set", "(", "arg_0", ".", "nodes", "(", ")", ")", "if", "arg_2", ":", "for", "arg_4", "in", "sorted", "(", "arg_2", ")", ":", "arg_5", ",", "arg_6", "=", "arg_4", "arg_3", "=", "arg_3", "-", "set", "(", "arg_5", ")", "arg_3", "=", "arg_3", "-", "set", "(", "arg_6", ")", "arg_7", "=", "'\"{}\" -> \"{}\";\\n'", "fh", ".", "write", "(", "arg_7", ".", "format", "(", "arg_5", ",", "arg_6", ")", ")", "if", "arg_3", ":", "for", "arg_8", "in", "sorted", "(", "arg_3", ")", ":", "arg_7", "=", "'\"{}\"\\n'", ".", "format", "(", "arg_8", ")", "fh", ".", "write", "(", "arg_7", ")", "fh", ".", "write", "(", "\"}\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Writes the graph G in dot file format for graphviz visualization.\n\n    Args:\n        a Networkx graph\n        A filename to name the dot files\n    \"\"\"\n    with io.open(arg_1, \"w\") as fh:\n        fh.write(\"strict digraph DependencyDiagram {\\n\")\n        arg_2 = arg_0.edges()\n        arg_3 = set(arg_0.nodes())\n        if arg_2:\n            for arg_4 in sorted(arg_2):\n                arg_5, arg_6 = arg_4\n                arg_3 = arg_3 - set(arg_5)\n                arg_3 = arg_3 - set(arg_6)\n                arg_7 = '\"{}\" -> \"{}\";\\n'\n                fh.write(arg_7.format(arg_5, arg_6))\n        # draw nodes with no links\n        if arg_3:\n            for arg_8 in sorted(arg_3):\n                arg_7 = '\"{}\"\\n'.format(arg_8)\n                fh.write(arg_7)\n        fh.write(\"}\")", "path": "sakelib/acts.py", "identifier": "write_dot_file", "docstring": "Writes the graph G in dot file format for graphviz visualization.\n\n    Args:\n        a Networkx graph\n        A filename to name the dot files", "docstring_tokens": ["Writes", "the", "graph", "G", "in", "dot", "file", "format", "for", "graphviz", "visualization", "."], "nwo": "tonyfischetti/sake", "score": 0.3086509652907828, "idx": 257041}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/import_gtfs.py#L177-L183", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "This validates the day_start_ut of the days table.", "language": "python", "parameters": "(conn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "GTFS", "(", "arg_0", ")", "arg_2", "=", "arg_0", ".", "execute", "(", "'SELECT date, day_start_ut FROM days'", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ":", "assert", "arg_4", "==", "arg_1", ".", "get_day_start_ut", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"This validates the day_start_ut of the days table.\"\"\"\n    arg_1 = GTFS(arg_0)\n    arg_2 = arg_0.execute('SELECT date, day_start_ut FROM days')\n    for arg_3, arg_4 in arg_2:\n        #print date, day_start_ut\n        assert arg_4 == arg_1.get_day_start_ut(arg_3)", "path": "gtfspy/import_gtfs.py", "identifier": "validate_day_start_ut", "docstring": "This validates the day_start_ut of the days table.", "docstring_tokens": ["This", "validates", "the", "day_start_ut", "of", "the", "days", "table", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 257042}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/hdlSimulator.py#L15-L23", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Check if hdl process has event depenency on signal", "language": "python", "parameters": "(sig, process)", "return_statement": "return process in sig.simFallingSensProcs\\\n        or process in sig.simRisingSensProcs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", "->", "bool", ":", "if", "arg_0", "is", "None", ":", "return", "False", "return", "arg_1", "in", "arg_0", ".", "simFallingSensProcs", "or", "arg_1", "in", "arg_0", ".", "simRisingSensProcs"], "function": "def Func(arg_0, arg_1) -> bool:\n    \"\"\"\n    Check if hdl process has event depenency on signal\n    \"\"\"\n    if arg_0 is None:\n        return False\n\n    return arg_1 in arg_0.simFallingSensProcs\\\n        or arg_1 in arg_0.simRisingSensProcs", "path": "hwt/simulator/hdlSimulator.py", "identifier": "isEvDependentOn", "docstring": "Check if hdl process has event depenency on signal", "docstring_tokens": ["Check", "if", "hdl", "process", "has", "event", "depenency", "on", "signal"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 257043}
{"url": "https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L193-L210", "sha": "5b90a543b127ab9e6112fd547929b5ef4b8f0cbc", "docstring_summary": "Send X10 commands when module is used from the command line.", "language": "python", "parameters": "(argv=None)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "len", "(", "arg_0", ")", ":", "arg_1", "=", "' '", ".", "join", "(", "arg_0", ")", "arg_2", ",", "arg_1", "=", "arg_1", ".", "split", "(", "None", ",", "1", ")", "sendCommands", "(", "arg_2", ",", "arg_1", ")", "return", "0"], "function": "def Func(arg_0=None):\n    \"\"\"Send X10 commands when module is used from the command line.\n\n    This uses syntax similar to sendCommands, for example:\n\n    x10.py com2 A1 On, A2 Off, B All Off\n    \"\"\"\n    if len(arg_0):\n        # join all the arguments together by spaces so that quotes\n        # aren't required on the command line.\n        arg_1 = ' '.join(arg_0)\n\n        # the comPort is everything leading up to the first space\n        arg_2, arg_1 = arg_1.split(None, 1)\n\n        sendCommands(arg_2, arg_1)\n\n    return 0", "path": "x10_any/cm17a.py", "identifier": "main", "docstring": "Send X10 commands when module is used from the command line.\n\n    This uses syntax similar to sendCommands, for example:\n\n    x10.py com2 A1 On, A2 Off, B All Off", "docstring_tokens": ["Send", "X10", "commands", "when", "module", "is", "used", "from", "the", "command", "line", "."], "nwo": "clach04/x10_any", "score": 0.2751458370028208, "idx": 257044}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L342-L403", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Cut off all parts of the polygon that are outside of the image.", "language": "python", "parameters": "(self, image)", "return_statement": "return polygons_reordered", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "import", "shapely", ".", "geometry", "if", "arg_0", ".", "is_out_of_image", "(", "arg_1", ",", "fully", "=", "True", ",", "partly", "=", "False", ")", ":", "return", "[", "]", "arg_2", ",", "arg_3", "=", "arg_1", ".", "shape", "[", "0", ":", "2", "]", "if", "ia", ".", "is_np_array", "(", "arg_1", ")", "else", "arg_1", "[", "0", ":", "2", "]", "arg_4", "=", "arg_0", ".", "to_shapely_polygon", "(", ")", "arg_5", "=", "shapely", ".", "geometry", ".", "Polygon", "(", "[", "(", "0", ",", "0", ")", ",", "(", "arg_3", ",", "0", ")", ",", "(", "arg_3", ",", "arg_2", ")", ",", "(", "0", ",", "arg_2", ")", "]", ")", "arg_6", "=", "arg_4", ".", "intersection", "(", "arg_5", ")", "if", "not", "isinstance", "(", "arg_6", ",", "shapely", ".", "geometry", ".", "MultiPolygon", ")", ":", "ia", ".", "do_assert", "(", "isinstance", "(", "arg_6", ",", "shapely", ".", "geometry", ".", "Polygon", ")", ")", "arg_6", "=", "shapely", ".", "geometry", ".", "MultiPolygon", "(", "[", "arg_6", "]", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_6", ".", "geoms", ":", "arg_7", ".", "append", "(", "Polygon", ".", "from_shapely", "(", "arg_8", ",", "label", "=", "arg_0", ".", "label", ")", ")", "arg_9", "=", "[", "]", "for", "arg_10", "in", "arg_7", ":", "arg_11", "=", "False", "for", "arg_12", ",", "arg_13", "in", "arg_0", ".", "exterior", ":", "arg_14", ",", "arg_15", "=", "arg_10", ".", "find_closest_point_index", "(", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ",", "return_distance", "=", "True", ")", "if", "arg_15", "<", "1e-6", ":", "arg_16", "=", "arg_10", ".", "change_first_point_by_index", "(", "arg_14", ")", "arg_9", ".", "append", "(", "arg_16", ")", "arg_11", "=", "True", "break", "ia", ".", "do_assert", "(", "arg_11", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Cut off all parts of the polygon that are outside of the image.\n\n        This operation may lead to new points being created.\n        As a single polygon may be split into multiple new polygons, the result\n        is always a list, which may contain more than one output polygon.\n\n        This operation will return an empty list if the polygon is completely\n        outside of the image plane.\n\n        Parameters\n        ----------\n        image : (H,W,...) ndarray or tuple of int\n            Image dimensions to use for the clipping of the polygon.\n            If an ndarray, its shape will be used.\n            If a tuple, it is assumed to represent the image shape and must\n            contain at least two integers.\n\n        Returns\n        -------\n        list of imgaug.Polygon\n            Polygon, clipped to fall within the image dimensions.\n            Returned as a list, because the clipping can split the polygon into\n            multiple parts. The list may also be empty, if the polygon was\n            fully outside of the image plane.\n\n        \"\"\"\n        # load shapely lazily, which makes the dependency more optional\n        import shapely.geometry\n\n        # if fully out of image, clip everything away, nothing remaining\n        if arg_0.is_out_of_image(arg_1, fully=True, partly=False):\n            return []\n\n        arg_2, arg_3 = arg_1.shape[0:2] if ia.is_np_array(arg_1) else arg_1[0:2]\n        arg_4 = arg_0.to_shapely_polygon()\n        arg_5 = shapely.geometry.Polygon([(0, 0), (arg_3, 0), (arg_3, arg_2), (0, arg_2)])\n        arg_6 = arg_4.intersection(arg_5)\n        if not isinstance(arg_6, shapely.geometry.MultiPolygon):\n            ia.do_assert(isinstance(arg_6, shapely.geometry.Polygon))\n            arg_6 = shapely.geometry.MultiPolygon([arg_6])\n\n        arg_7 = []\n        for arg_8 in arg_6.geoms:\n            arg_7.append(Polygon.from_shapely(arg_8, label=arg_0.label))\n\n        # shapely changes the order of points, we try here to preserve it as\n        # much as possible\n        arg_9 = []\n        for arg_10 in arg_7:\n            arg_11 = False\n            for arg_12, arg_13 in arg_0.exterior:\n                arg_14, arg_15 = arg_10.find_closest_point_index(arg_12=arg_12, arg_13=arg_13, return_distance=True)\n                if arg_15 < 1e-6:\n                    arg_16 = arg_10.change_first_point_by_index(arg_14)\n                    arg_9.append(arg_16)\n                    arg_11 = True\n                    break\n            ia.do_assert(arg_11)  # could only not find closest points if new polys are empty\n\n        return arg_9", "path": "imgaug/augmentables/polys.py", "identifier": "Polygon.clip_out_of_image", "docstring": "Cut off all parts of the polygon that are outside of the image.\n\n        This operation may lead to new points being created.\n        As a single polygon may be split into multiple new polygons, the result\n        is always a list, which may contain more than one output polygon.\n\n        This operation will return an empty list if the polygon is completely\n        outside of the image plane.\n\n        Parameters\n        ----------\n        image : (H,W,...) ndarray or tuple of int\n            Image dimensions to use for the clipping of the polygon.\n            If an ndarray, its shape will be used.\n            If a tuple, it is assumed to represent the image shape and must\n            contain at least two integers.\n\n        Returns\n        -------\n        list of imgaug.Polygon\n            Polygon, clipped to fall within the image dimensions.\n            Returned as a list, because the clipping can split the polygon into\n            multiple parts. The list may also be empty, if the polygon was\n            fully outside of the image plane.", "docstring_tokens": ["Cut", "off", "all", "parts", "of", "the", "polygon", "that", "are", "outside", "of", "the", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 257045}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2455-L2513", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Dump a PKCS12 object as a string.", "language": "python", "parameters": "(self, passphrase=None, iter=2048, maciter=1)", "return_statement": "return _bio_to_string(bio)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "2048", ",", "arg_3", "=", "1", ")", ":", "arg_1", "=", "_text_to_bytes_and_warn", "(", "\"passphrase\"", ",", "arg_1", ")", "if", "arg_0", ".", "_cacerts", "is", "None", ":", "arg_4", "=", "_ffi", ".", "NULL", "else", ":", "arg_4", "=", "_lib", ".", "sk_X509_new_null", "(", ")", "arg_4", "=", "_ffi", ".", "gc", "(", "arg_4", ",", "_lib", ".", "sk_X509_free", ")", "for", "arg_5", "in", "arg_0", ".", "_cacerts", ":", "_lib", ".", "sk_X509_push", "(", "arg_4", ",", "arg_5", ".", "_x509", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "_ffi", ".", "NULL", "arg_6", "=", "arg_0", ".", "_friendlyname", "if", "arg_6", "is", "None", ":", "arg_6", "=", "_ffi", ".", "NULL", "if", "arg_0", ".", "_pkey", "is", "None", ":", "arg_7", "=", "_ffi", ".", "NULL", "else", ":", "arg_7", "=", "arg_0", ".", "_pkey", ".", "_pkey", "if", "arg_0", ".", "_cert", "is", "None", ":", "arg_5", "=", "_ffi", ".", "NULL", "else", ":", "arg_5", "=", "arg_0", ".", "_cert", ".", "_x509", "arg_8", "=", "_lib", ".", "PKCS12_create", "(", "arg_1", ",", "arg_6", ",", "arg_7", ",", "arg_5", ",", "arg_4", ",", "_lib", ".", "NID_pbe_WithSHA1And3_Key_TripleDES_CBC", ",", "_lib", ".", "NID_pbe_WithSHA1And3_Key_TripleDES_CBC", ",", "arg_2", ",", "arg_3", ",", "0", ")", "if", "arg_8", "==", "_ffi", ".", "NULL", ":", "_raise_current_error", "(", ")", "arg_8", "=", "_ffi", ".", "gc", "(", "arg_8", ",", "_lib", ".", "PKCS12_free", ")", "arg_9", "=", "_new_mem_buf", "(", ")", "_lib", ".", "i2d_PKCS12_bio", "(", "arg_9", ",", "arg_8", ")", "return", "_bio_to_string", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=2048, arg_3=1):\n        \"\"\"\n        Dump a PKCS12 object as a string.\n\n        For more information, see the :c:func:`PKCS12_create` man page.\n\n        :param passphrase: The passphrase used to encrypt the structure. Unlike\n            some other passphrase arguments, this *must* be a string, not a\n            callback.\n        :type passphrase: :py:data:`bytes`\n\n        :param iter: Number of times to repeat the encryption step.\n        :type iter: :py:data:`int`\n\n        :param maciter: Number of times to repeat the MAC step.\n        :type maciter: :py:data:`int`\n\n        :return: The string representation of the PKCS #12 structure.\n        :rtype:\n        \"\"\"\n        arg_1 = _text_to_bytes_and_warn(\"passphrase\", arg_1)\n\n        if arg_0._cacerts is None:\n            arg_4 = _ffi.NULL\n        else:\n            arg_4 = _lib.sk_X509_new_null()\n            arg_4 = _ffi.gc(arg_4, _lib.sk_X509_free)\n            for arg_5 in arg_0._cacerts:\n                _lib.sk_X509_push(arg_4, arg_5._x509)\n\n        if arg_1 is None:\n            arg_1 = _ffi.NULL\n\n        arg_6 = arg_0._friendlyname\n        if arg_6 is None:\n            arg_6 = _ffi.NULL\n\n        if arg_0._pkey is None:\n            arg_7 = _ffi.NULL\n        else:\n            arg_7 = arg_0._pkey._pkey\n\n        if arg_0._cert is None:\n            arg_5 = _ffi.NULL\n        else:\n            arg_5 = arg_0._cert._x509\n\n        arg_8 = _lib.PKCS12_create(\n            arg_1, arg_6, arg_7, arg_5, arg_4,\n            _lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC,\n            _lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC,\n            arg_2, arg_3, 0)\n        if arg_8 == _ffi.NULL:\n            _raise_current_error()\n        arg_8 = _ffi.gc(arg_8, _lib.PKCS12_free)\n\n        arg_9 = _new_mem_buf()\n        _lib.i2d_PKCS12_bio(arg_9, arg_8)\n        return _bio_to_string(arg_9)", "path": "src/OpenSSL/crypto.py", "identifier": "PKCS12.export", "docstring": "Dump a PKCS12 object as a string.\n\n        For more information, see the :c:func:`PKCS12_create` man page.\n\n        :param passphrase: The passphrase used to encrypt the structure. Unlike\n            some other passphrase arguments, this *must* be a string, not a\n            callback.\n        :type passphrase: :py:data:`bytes`\n\n        :param iter: Number of times to repeat the encryption step.\n        :type iter: :py:data:`int`\n\n        :param maciter: Number of times to repeat the MAC step.\n        :type maciter: :py:data:`int`\n\n        :return: The string representation of the PKCS #12 structure.\n        :rtype:", "docstring_tokens": ["Dump", "a", "PKCS12", "object", "as", "a", "string", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 257046}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/vendor/Qt.py#L147-L150", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Append to self, accessible via Qt.QtCompat", "language": "python", "parameters": "(object, name, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "self", ".", "_Funced__", ".", "append", "(", "arg_1", ")", "setattr", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Append to self, accessible via Qt.QtCompat\"\"\"\n    self._Funced__.append(arg_1)\n    setattr(arg_0, arg_1, arg_2)", "path": "pyblish_maya/vendor/Qt.py", "identifier": "_add", "docstring": "Append to self, accessible via Qt.QtCompat", "docstring_tokens": ["Append", "to", "self", "accessible", "via", "Qt", ".", "QtCompat"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 257047}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L183-L264", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Write Stokes-calibrated filterbank file for a given observation\n    with a calibrator noise diode measurement on the source", "language": "python", "parameters": "(cross_pols,diode_cross,obsI=None,onefile=True,feedtype='l',**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "'l'", ",", "**", "arg_5", ")", ":", "arg_6", "=", "Waterfall", "(", "arg_1", ",", "max_load", "=", "150", ")", "arg_7", "=", "arg_6", ".", "data", "arg_8", "=", "arg_6", ".", "header", "[", "'tsamp'", "]", "arg_9", "=", "arg_6", ".", "calc_n_coarse_chan", "(", ")", "arg_10", "=", "arg_6", ".", "header", "[", "'nchans'", "]", "arg_11", "=", "arg_10", "/", "arg_9", "arg_6", "=", "None", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", "=", "get_stokes", "(", "arg_7", ",", "arg_4", ")", "arg_7", "=", "None", "print", "(", "'Calculating Mueller Matrix variables'", ")", "arg_16", "=", "gain_offsets", "(", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", ",", "arg_8", ",", "arg_11", ",", "arg_4", ",", "**", "arg_5", ")", "arg_17", "=", "phase_offsets", "(", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", ",", "arg_8", ",", "arg_11", ",", "arg_4", ",", "**", "arg_5", ")", "arg_12", "=", "None", "arg_13", "=", "None", "arg_14", "=", "None", "arg_15", "=", "None", "print", "(", "'Opening '", "+", "arg_0", ")", "arg_18", "=", "Waterfall", "(", "arg_0", ",", "max_load", "=", "150", ")", "arg_19", "=", "arg_18", ".", "calc_n_coarse_chan", "(", ")", "arg_20", "=", "arg_18", ".", "header", "[", "'nchans'", "]", "arg_21", "=", "arg_20", "/", "arg_19", "print", "(", "'Grabbing Stokes parameters'", ")", "arg_22", ",", "arg_23", ",", "arg_24", ",", "arg_25", "=", "get_stokes", "(", "arg_18", ".", "data", ",", "arg_4", ")", "print", "(", "'Applying Mueller Matrix'", ")", "arg_22", ",", "arg_23", ",", "arg_24", ",", "arg_25", "=", "apply_Mueller", "(", "arg_22", ",", "arg_23", ",", "arg_24", ",", "arg_25", ",", "arg_16", ",", "arg_17", ",", "arg_21", ",", "arg_4", ")", "if", "arg_3", "==", "True", ":", "arg_18", ".", "data", "[", ":", ",", "0", ",", ":", "]", "=", "np", ".", "squeeze", "(", "arg_22", ")", "arg_18", ".", "data", "[", ":", ",", "1", ",", ":", "]", "=", "np", ".", "squeeze", "(", "arg_23", ")", "arg_18", ".", "data", "[", ":", ",", "2", ",", ":", "]", "=", "np", ".", "squeeze", "(", "arg_24", ")", "arg_18", ".", "data", "[", ":", ",", "3", ",", ":", "]", "=", "np", ".", "squeeze", "(", "arg_25", ")", "arg_18", ".", "write_to_fil", "(", "arg_0", "[", ":", "-", "15", "]", "+", "'.SIQUV.polcal.fil'", ")", "print", "(", "'Calibrated Stokes parameters written to '", "+", "arg_0", "[", ":", "-", "15", "]", "+", "'.SIQUV.polcal.fil'", ")", "return", "arg_6", "=", "Waterfall", "(", "obs_I", ",", "max_load", "=", "150", ")", "arg_6", ".", "data", "=", "arg_22", "arg_6", ".", "write_to_fil", "(", "arg_0", "[", ":", "-", "15", "]", "+", "'.SI.polcal.fil'", ")", "print", "(", "'Calibrated Stokes I written to '", "+", "arg_0", "[", ":", "-", "15", "]", "+", "'.SI.polcal.fil'", ")", "arg_6", ".", "data", "=", "arg_23", "arg_6", ".", "write_to_fil", "(", "arg_0", "[", ":", "-", "15", "]", "+", "'.Q.polcal.fil'", ")", "print", "(", "'Calibrated Stokes Q written to '", "+", "arg_0", "[", ":", "-", "15", "]", "+", "'.Q.polcal.fil'", ")", "arg_6", ".", "data", "=", "arg_24", "arg_6", ".", "write_to_fil", "(", "arg_0", "[", ":", "-", "15", "]", "+", "'.U.polcal.fil'", ")", "print", "(", "'Calibrated Stokes U written to '", "+", "arg_0", "[", ":", "-", "15", "]", "+", "'.U.polcal.fil'", ")", "arg_6", ".", "data", "=", "arg_25", "arg_6", ".", "write_to_fil", "(", "arg_0", "[", ":", "-", "15", "]", "+", "'.V.polcal.fil'", ")", "print", "(", "'Calibrated Stokes V written to '", "+", "arg_0", "[", ":", "-", "15", "]", "+", "'.V.polcal.fil'", ")"], "function": "def Func(arg_0,arg_1,arg_2=None,arg_3=True,arg_4='l',**arg_5):\n    '''\n    Write Stokes-calibrated filterbank file for a given observation\n    with a calibrator noise diode measurement on the source\n\n    Parameters\n    ----------\n    cross_pols : string\n        Path to cross polarization filterbank file (rawspec output) for observation to be calibrated\n    diode_cross : string\n        Path to cross polarization filterbank file of noise diode measurement ON the target\n    obsI : string\n        Path to Stokes I filterbank file of main observation (only needed if onefile=False)\n    onefile : boolean\n        True writes all calibrated Stokes parameters to a single filterbank file,\n        False writes four separate files\n    feedtype : 'l' or 'c'\n        Basis of antenna dipoles. 'c' for circular, 'l' for linear\n    '''\n    #Obtain time sample length, frequencies, and noise diode data\n    arg_6 = Waterfall(arg_1,max_load=150)\n    arg_7 = arg_6.data\n    arg_8 = arg_6.header['tsamp']\n\n    #Calculate number of coarse channels in the noise diode measurement (usually 8)\n    arg_9 = arg_6.calc_n_coarse_chan()\n    arg_10 = arg_6.header['nchans']\n    arg_11 = arg_10/arg_9\n    arg_6 = None\n    arg_12,arg_13,arg_14,arg_15 = get_stokes(arg_7,arg_4)\n    arg_7 = None\n    #Calculate differential gain and phase from noise diode measurements\n    print('Calculating Mueller Matrix variables')\n    arg_16 = gain_offsets(arg_12,arg_13,arg_14,arg_15,arg_8,arg_11,arg_4,**arg_5)\n    arg_17 = phase_offsets(arg_12,arg_13,arg_14,arg_15,arg_8,arg_11,arg_4,**arg_5)\n\n    #Clear data arrays to save memory\n    arg_12 = None\n    arg_13 = None\n    arg_14 = None\n    arg_15 = None\n\n    #Get corrected Stokes parameters\n    print('Opening '+arg_0)\n    arg_18 = Waterfall(arg_0,max_load=150)\n    arg_19 = arg_18.calc_n_coarse_chan()\n    arg_20 = arg_18.header['nchans']\n    arg_21 = arg_20/arg_19\n\n    print('Grabbing Stokes parameters')\n    arg_22,arg_23,arg_24,arg_25 = get_stokes(arg_18.data,arg_4)\n\n    print('Applying Mueller Matrix')\n    arg_22,arg_23,arg_24,arg_25 = apply_Mueller(arg_22,arg_23,arg_24,arg_25,arg_16,arg_17,arg_21,arg_4)\n\n    #Use onefile (default) to produce one filterbank file containing all Stokes information\n    if arg_3==True:\n        arg_18.data[:,0,:] = np.squeeze(arg_22)\n        arg_18.data[:,1,:] = np.squeeze(arg_23)\n        arg_18.data[:,2,:] = np.squeeze(arg_24)\n        arg_18.data[:,3,:] = np.squeeze(arg_25)\n        arg_18.write_to_fil(arg_0[:-15]+'.SIQUV.polcal.fil')\n        print('Calibrated Stokes parameters written to '+arg_0[:-15]+'.SIQUV.polcal.fil')\n        return\n\n    #Write corrected Stokes parameters to four filterbank files if onefile==False\n    arg_6 = Waterfall(obs_I,max_load=150)\n    arg_6.data = arg_22\n    arg_6.write_to_fil(arg_0[:-15]+'.SI.polcal.fil')   #assuming file is named *.cross_pols.fil\n    print('Calibrated Stokes I written to '+arg_0[:-15]+'.SI.polcal.fil')\n\n    arg_6.data = arg_23\n    arg_6.write_to_fil(arg_0[:-15]+'.Q.polcal.fil')   #assuming file is named *.cross_pols.fil\n    print('Calibrated Stokes Q written to '+arg_0[:-15]+'.Q.polcal.fil')\n\n    arg_6.data = arg_24\n    arg_6.write_to_fil(arg_0[:-15]+'.U.polcal.fil')   #assuming file is named *.cross_pols.fil\n    print('Calibrated Stokes U written to '+arg_0[:-15]+'.U.polcal.fil')\n\n    arg_6.data = arg_25\n    arg_6.write_to_fil(arg_0[:-15]+'.V.polcal.fil')   #assuming file is named *.cross_pols.fil\n    print('Calibrated Stokes V written to '+arg_0[:-15]+'.V.polcal.fil')", "path": "blimpy/calib_utils/stokescal.py", "identifier": "calibrate_pols", "docstring": "Write Stokes-calibrated filterbank file for a given observation\n    with a calibrator noise diode measurement on the source\n\n    Parameters\n    ----------\n    cross_pols : string\n        Path to cross polarization filterbank file (rawspec output) for observation to be calibrated\n    diode_cross : string\n        Path to cross polarization filterbank file of noise diode measurement ON the target\n    obsI : string\n        Path to Stokes I filterbank file of main observation (only needed if onefile=False)\n    onefile : boolean\n        True writes all calibrated Stokes parameters to a single filterbank file,\n        False writes four separate files\n    feedtype : 'l' or 'c'\n        Basis of antenna dipoles. 'c' for circular, 'l' for linear", "docstring_tokens": ["Write", "Stokes", "-", "calibrated", "filterbank", "file", "for", "a", "given", "observation", "with", "a", "calibrator", "noise", "diode", "measurement", "on", "the", "source"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 257048}
{"url": "https://github.com/openergy/oplus/blob/f095868d1990c1d126e906ada6acbab26348b3d3/oplus/eio.py#L109-L129", "sha": "f095868d1990c1d126e906ada6acbab26348b3d3", "docstring_summary": "Returns first occurrence of value of filter column matching filter criterion.", "language": "python", "parameters": "(self, column_name_or_i, filter_column_name_or_i, filter_criterion)", "return_statement": "return self._data[row_i][column_i]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_get_column_index", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "_get_column_index", "(", "arg_2", ")", "arg_6", "=", "{", "float", ":", "lambda", "x", ":", "float", "(", "x", ")", "==", "arg_3", ",", "int", ":", "lambda", "x", ":", "int", "(", "x", ")", "==", "arg_3", ",", "str", ":", "lambda", "x", ":", "x", ".", "lower", "(", ")", "==", "arg_3", ".", "lower", "(", ")", "}", "[", "type", "(", "arg_3", ")", "]", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_0", ".", "_data", ")", ":", "if", "arg_6", "(", "arg_8", "[", "arg_5", "]", ")", ":", "break", "else", ":", "raise", "ValueError", "(", "\"Filter did not return any values.\"", ")", "return", "arg_0", ".", "_data", "[", "arg_7", "]", "[", "arg_4", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Returns first occurrence of value of filter column matching filter criterion.\n        \"\"\"\n        # find column indexes\n        arg_4 = arg_0._get_column_index(arg_1)\n        arg_5 = arg_0._get_column_index(arg_2)\n\n        arg_6 = {\n            float: lambda x: float(x) == arg_3,\n            int: lambda x: int(x) == arg_3,\n            str: lambda x: x.lower() == arg_3.lower()\n        }[type(arg_3)]\n\n        for arg_7, arg_8 in enumerate(arg_0._data):\n            if arg_6(arg_8[arg_5]):\n                break\n        else:\n            raise ValueError(\"Filter did not return any values.\")\n\n        return arg_0._data[arg_7][arg_4]", "path": "oplus/eio.py", "identifier": "EioTable.get_value", "docstring": "Returns first occurrence of value of filter column matching filter criterion.", "docstring_tokens": ["Returns", "first", "occurrence", "of", "value", "of", "filter", "column", "matching", "filter", "criterion", "."], "nwo": "openergy/oplus", "score": 0.38919093769130675, "idx": 257049}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L110-L137", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Fit MeanShift clustering algorithm to data.", "language": "python", "parameters": "(self, data, bandwidth=None, bin_seeding=False, **kwargs)", "return_statement": "return ms", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "cl", ".", "estimate_bandwidth", "(", "arg_1", ")", "arg_5", "=", "cl", ".", "MeanShift", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_5", ".", "fit", "(", "arg_1", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False, **arg_4):\n        \"\"\"\n        Fit MeanShift clustering algorithm to data.\n\n        Parameters\n        ----------\n        data : array-like\n            A dataset formatted by `classifier.fitting_data`.\n        bandwidth : float\n            The bandwidth value used during clustering.\n            If none, determined automatically. Note:\n            the data are scaled before clutering, so\n            this is not in the same units as the data.\n        bin_seeding : bool\n            Whether or not to use 'bin_seeding'. See\n            documentation for `sklearn.cluster.MeanShift`.\n        **kwargs\n            passed to `sklearn.cluster.MeanShift`.\n\n        Returns\n        -------\n        Fitted `sklearn.cluster.MeanShift` object.\n        \"\"\"\n        if arg_2 is None:\n            arg_2 = cl.estimate_bandwidth(arg_1)\n        arg_5 = cl.MeanShift(arg_2=arg_2, arg_3=arg_3)\n        arg_5.fit(arg_1)\n        return arg_5", "path": "latools/filtering/classifier_obj.py", "identifier": "classifier.fit_meanshift", "docstring": "Fit MeanShift clustering algorithm to data.\n\n        Parameters\n        ----------\n        data : array-like\n            A dataset formatted by `classifier.fitting_data`.\n        bandwidth : float\n            The bandwidth value used during clustering.\n            If none, determined automatically. Note:\n            the data are scaled before clutering, so\n            this is not in the same units as the data.\n        bin_seeding : bool\n            Whether or not to use 'bin_seeding'. See\n            documentation for `sklearn.cluster.MeanShift`.\n        **kwargs\n            passed to `sklearn.cluster.MeanShift`.\n\n        Returns\n        -------\n        Fitted `sklearn.cluster.MeanShift` object.", "docstring_tokens": ["Fit", "MeanShift", "clustering", "algorithm", "to", "data", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257050}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L305-L308", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Use `msg` as a warning.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "Funcings", ".", "append", "(", "arg_1", ")", "sys", ".", "stderr", ".", "write", "(", "\"Coverage.py warning: %s\\n\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Use `msg` as a warning.\"\"\"\n        arg_0.Funcings.append(arg_1)\n        sys.stderr.write(\"Coverage.py warning: %s\\n\" % arg_1)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage._warn", "docstring": "Use `msg` as a warning.", "docstring_tokens": ["Use", "msg", "as", "a", "warning", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 257051}
{"url": "https://github.com/andreikop/python-ws-discovery/blob/a7b852cf43115c6f986e509b1870d6963e76687f/wsdiscovery/cmdline.py#L64-L74", "sha": "a7b852cf43115c6f986e509b1870d6963e76687f", "docstring_summary": "Discover systems using WS-Discovery", "language": "python", "parameters": "(scope, loglevel, capture)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ":", "arg_3", "=", "getattr", "(", "logging", ",", "arg_1", ",", "None", ")", "if", "not", "arg_3", ":", "print", "(", "\"Invalid log level '%s'\"", "%", "arg_1", ")", "return", "logger", ".", "setLevel", "(", "arg_3", ")", "run", "(", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"Discover systems using WS-Discovery\"\n\n    if arg_1:\n        arg_3 = getattr(logging, arg_1, None)\n        if not arg_3:\n           print(\"Invalid log level '%s'\" % arg_1)\n           return\n        logger.setLevel(arg_3)\n\n    run(arg_0=arg_0, arg_2=arg_2)", "path": "wsdiscovery/cmdline.py", "identifier": "discover", "docstring": "Discover systems using WS-Discovery", "docstring_tokens": ["Discover", "systems", "using", "WS", "-", "Discovery"], "nwo": "andreikop/python-ws-discovery", "score": 0.7152725855878354, "idx": 257052}
{"url": "https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/rarfile.py#L160-L162", "sha": "b1ac46cbcf42f3d3c5c69ab971fe97369a4da617", "docstring_summary": "Process current member with 'op' operation.", "language": "python", "parameters": "(self, handle, op, dest_path=None, dest_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "unrarlib", ".", "RARProcessFileW", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"Process current member with 'op' operation.\"\"\"\n        unrarlib.RARProcessFileW(arg_1, arg_2, arg_3, arg_4)", "path": "unrar/rarfile.py", "identifier": "RarFile._process_current", "docstring": "Process current member with 'op' operation.", "docstring_tokens": ["Process", "current", "member", "with", "op", "operation", "."], "nwo": "matiasb/python-unrar", "score": 0.34770217692582306, "idx": 257053}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py#L250-L265", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "display connection info, and store ports", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "basename", "(", "arg_0", ".", "connection_file", ")", "if", "arg_1", "==", "arg_0", ".", "connection_file", "or", "os", ".", "path", ".", "dirname", "(", "arg_0", ".", "connection_file", ")", "==", "arg_0", ".", "profile_dir", ".", "security_dir", ":", "arg_2", "=", "arg_1", "if", "arg_0", ".", "profile", "!=", "'default'", ":", "arg_2", "+=", "\" --profile %s\"", "%", "arg_0", ".", "profile", "else", ":", "arg_2", "=", "arg_0", ".", "connection_file", "arg_0", ".", "log", ".", "critical", "(", "\"--existing %s\"", ",", "arg_2", ")", "arg_0", ".", "ports", "=", "dict", "(", "shell", "=", "arg_0", ".", "shell_port", ",", "iopub", "=", "arg_0", ".", "iopub_port", ",", "stdin", "=", "arg_0", ".", "stdin_port", ",", "hb", "=", "arg_0", ".", "hb_port", ")"], "function": "def Func(arg_0):\n        \"\"\"display connection info, and store ports\"\"\"\n        arg_1 = os.path.basename(arg_0.connection_file)\n        if arg_1 == arg_0.connection_file or \\\n            os.path.dirname(arg_0.connection_file) == arg_0.profile_dir.security_dir:\n            # use shortname\n            arg_2 = arg_1\n            if arg_0.profile != 'default':\n                arg_2 += \" --profile %s\" % arg_0.profile\n        else:\n            arg_2 = arg_0.connection_file\n        arg_0.log.critical(\"--existing %s\", arg_2)\n\n\n        arg_0.ports = dict(shell=arg_0.shell_port, iopub=arg_0.iopub_port,\n                                stdin=arg_0.stdin_port, hb=arg_0.hb_port)", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py", "identifier": "KernelApp.log_connection_info", "docstring": "display connection info, and store ports", "docstring_tokens": ["display", "connection", "info", "and", "store", "ports"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257054}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L275-L305", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reimplemented for execution interruption and smart backspace.", "language": "python", "parameters": "(self, event)", "return_statement": "return super(FrontendWidget, self)._event_filter_console_keypress(event)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "key", "(", ")", "if", "arg_0", ".", "_control_key_down", "(", "arg_1", ".", "modifiers", "(", ")", ",", "include_command", "=", "False", ")", ":", "if", "arg_2", "==", "QtCore", ".", "Qt", ".", "Key_C", "and", "arg_0", ".", "_executing", ":", "arg_0", ".", "request_interrupt_kernel", "(", ")", "return", "True", "elif", "arg_2", "==", "QtCore", ".", "Qt", ".", "Key_Period", ":", "arg_0", ".", "request_restart_kernel", "(", ")", "return", "True", "elif", "not", "arg_1", ".", "modifiers", "(", ")", "&", "QtCore", ".", "Qt", ".", "AltModifier", ":", "if", "arg_2", "==", "QtCore", ".", "Qt", ".", "Key_Backspace", ":", "arg_3", "=", "arg_0", ".", "_get_input_buffer_cursor_column", "(", ")", "arg_4", "=", "arg_0", ".", "_control", ".", "textCursor", "(", ")", "if", "arg_3", ">", "3", "and", "not", "arg_4", ".", "hasSelection", "(", ")", ":", "arg_5", "=", "arg_0", ".", "_get_input_buffer_cursor_line", "(", ")", "[", ":", "arg_3", "]", "if", "arg_5", ".", "endswith", "(", "'    '", ")", "and", "not", "arg_5", ".", "strip", "(", ")", ":", "arg_4", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "Left", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ",", "4", ")", "arg_4", ".", "removeSelectedText", "(", ")", "return", "True", "return", "super", "(", "FrontendWidget", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Reimplemented for execution interruption and smart backspace.\n        \"\"\"\n        arg_2 = arg_1.key()\n        if arg_0._control_key_down(arg_1.modifiers(), include_command=False):\n\n            if arg_2 == QtCore.Qt.Key_C and arg_0._executing:\n                arg_0.request_interrupt_kernel()\n                return True\n\n            elif arg_2 == QtCore.Qt.Key_Period:\n                arg_0.request_restart_kernel()\n                return True\n\n        elif not arg_1.modifiers() & QtCore.Qt.AltModifier:\n\n            # Smart backspace: remove four characters in one backspace if:\n            # 1) everything left of the cursor is whitespace\n            # 2) the four characters immediately left of the cursor are spaces\n            if arg_2 == QtCore.Qt.Key_Backspace:\n                arg_3 = arg_0._get_input_buffer_cursor_column()\n                arg_4 = arg_0._control.textCursor()\n                if arg_3 > 3 and not arg_4.hasSelection():\n                    arg_5 = arg_0._get_input_buffer_cursor_line()[:arg_3]\n                    if arg_5.endswith('    ') and not arg_5.strip():\n                        arg_4.movePosition(QtGui.QTextCursor.Left,\n                                            QtGui.QTextCursor.KeepAnchor, 4)\n                        arg_4.removeSelectedText()\n                        return True\n\n        return super(FrontendWidget, arg_0).Func(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._event_filter_console_keypress", "docstring": "Reimplemented for execution interruption and smart backspace.", "docstring_tokens": ["Reimplemented", "for", "execution", "interruption", "and", "smart", "backspace", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257055}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/db.py#L47-L70", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Function decorator that provides a session if it isn't provided.\n    If you want to reuse a session or run the function as part of a\n    database transaction, you pass it to the function, if not this wrapper\n    will create one and close it for you.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "'session'", "arg_4", "=", "arg_0", ".", "__code__", ".", "co_varnames", "arg_5", "=", "arg_3", "in", "arg_4", "and", "arg_4", ".", "index", "(", "arg_3", ")", "<", "len", "(", "arg_1", ")", "arg_6", "=", "arg_3", "in", "arg_2", "if", "arg_6", "or", "arg_5", ":", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "else", ":", "with", "create_session", "(", ")", "as", "session", ":", "arg_2", "[", "arg_3", "]", "=", "session", "return", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Function decorator that provides a session if it isn't provided.\n    If you want to reuse a session or run the function as part of a\n    database transaction, you pass it to the function, if not this wrapper\n    will create one and close it for you.\n    \"\"\"\n    @wraps(arg_0)\n    def wrapper(*arg_1, **arg_2):\n        arg_3 = 'session'\n\n        arg_4 = arg_0.__code__.co_varnames\n        arg_5 = arg_3 in arg_4 and \\\n            arg_4.index(arg_3) < len(arg_1)\n        arg_6 = arg_3 in arg_2\n\n        if arg_6 or arg_5:\n            return arg_0(*arg_1, **arg_2)\n        else:\n            with create_session() as session:\n                arg_2[arg_3] = session\n                return arg_0(*arg_1, **arg_2)\n\n    return wrapper", "path": "airflow/utils/db.py", "identifier": "provide_session", "docstring": "Function decorator that provides a session if it isn't provided.\n    If you want to reuse a session or run the function as part of a\n    database transaction, you pass it to the function, if not this wrapper\n    will create one and close it for you.", "docstring_tokens": ["Function", "decorator", "that", "provides", "a", "session", "if", "it", "isn", "t", "provided", ".", "If", "you", "want", "to", "reuse", "a", "session", "or", "run", "the", "function", "as", "part", "of", "a", "database", "transaction", "you", "pass", "it", "to", "the", "function", "if", "not", "this", "wrapper", "will", "create", "one", "and", "close", "it", "for", "you", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257056}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L231-L235", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Get available filters from dataset you've selected", "language": "python", "parameters": "(self, dataset)", "return_statement": "return pd.DataFrame(filt_, columns=[\"Filter\", \"Description\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "filters", "(", "arg_1", ")", "arg_3", "=", "[", "(", "k", ",", "v", "[", "0", "]", ")", "for", "k", ",", "v", "in", "arg_2", ".", "items", "(", ")", "]", "return", "pd", ".", "DataFrame", "(", "arg_3", ",", "columns", "=", "[", "\"Filter\"", ",", "\"Description\"", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get available filters from dataset you've selected\"\"\"\n        arg_2 = arg_0.filters(arg_1)\n        arg_3 = [ (k, v[0]) for k, v in arg_2.items()]\n        return pd.DataFrame(arg_3, columns=[\"Filter\", \"Description\"])", "path": "gseapy/parser.py", "identifier": "Biomart.get_filters", "docstring": "Get available filters from dataset you've selected", "docstring_tokens": ["Get", "available", "filters", "from", "dataset", "you", "ve", "selected"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 257057}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L1356-L1373", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Returns a list with the last ``n`` lines of the nextflow log file", "language": "python", "parameters": "(self, n=300)", "return_statement": "return last_lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "300", ")", ":", "with", "open", "(", "arg_0", ".", "log_file", ")", "as", "fh", ":", "arg_2", "=", "fh", ".", "readlines", "(", ")", "[", "-", "arg_1", ":", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=300):\n        \"\"\"Returns a list with the last ``n`` lines of the nextflow log file\n\n        Parameters\n        ----------\n        n : int\n            Number of last lines from the log file\n\n        Returns\n        -------\n        list\n            List of strings with the nextflow log\n        \"\"\"\n\n        with open(arg_0.log_file) as fh:\n            arg_2 = fh.readlines()[-arg_1:]\n\n        return arg_2", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector._get_log_lines", "docstring": "Returns a list with the last ``n`` lines of the nextflow log file\n\n        Parameters\n        ----------\n        n : int\n            Number of last lines from the log file\n\n        Returns\n        -------\n        list\n            List of strings with the nextflow log", "docstring_tokens": ["Returns", "a", "list", "with", "the", "last", "n", "lines", "of", "the", "nextflow", "log", "file"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257058}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L355-L370", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Import assets into Tower.", "language": "python", "parameters": "(source=None, prevent=None, exclude=None, secret_management='default', no_color=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'default'", ",", "arg_4", "=", "False", ")", ":", "from", "tower_cli", ".", "cli", ".", "transfer", ".", "Func", "import", "Sender", "arg_5", "=", "Sender", "(", "arg_4", ")", "arg_5", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3='default', arg_4=False):\n    \"\"\"Import assets into Tower.\n\n    'tower Func' imports one or more assets into a Tower instance\n\n    The import can take either JSON or YAML.\n    Data can be sent on stdin (i.e. from tower-cli receive pipe) and/or from files\n    or directories passed as parameters.\n\n    If a directory is specified only files that end in .json, .yaml or .yml will be\n    imported. Other files will be ignored.\n    \"\"\"\n\n    from tower_cli.cli.transfer.Func import Sender\n    arg_5 = Sender(arg_4)\n    arg_5.Func(arg_0, arg_1, arg_2, arg_3)", "path": "tower_cli/cli/misc.py", "identifier": "send", "docstring": "Import assets into Tower.\n\n    'tower send' imports one or more assets into a Tower instance\n\n    The import can take either JSON or YAML.\n    Data can be sent on stdin (i.e. from tower-cli receive pipe) and/or from files\n    or directories passed as parameters.\n\n    If a directory is specified only files that end in .json, .yaml or .yml will be\n    imported. Other files will be ignored.", "docstring_tokens": ["Import", "assets", "into", "Tower", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 257059}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L506-L514", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Show a temporary message.", "language": "python", "parameters": "(self, message_str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_message_handle", "is", "not", "None", ":", "arg_0", ".", "_message_handle", ".", "cancel", "(", ")", "arg_0", ".", "_message_handle", "=", "asyncio", ".", "get_event_loop", "(", ")", ".", "call_later", "(", "arg_0", ".", "_MESSAGE_DELAY_SECS", ",", "arg_0", ".", "_clear_message", ")", "arg_0", ".", "_message", "=", "arg_1", "arg_0", ".", "_update", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Show a temporary message.\"\"\"\n        if arg_0._message_handle is not None:\n            arg_0._message_handle.cancel()\n        arg_0._message_handle = asyncio.get_event_loop().call_later(\n            arg_0._MESSAGE_DELAY_SECS, arg_0._clear_message\n        )\n        arg_0._message = arg_1\n        arg_0._update()", "path": "hangups/ui/__main__.py", "identifier": "StatusLineWidget.show_message", "docstring": "Show a temporary message.", "docstring_tokens": ["Show", "a", "temporary", "message", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 257060}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/serialization.py#L130-L153", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "Deserialize a dataframe.", "language": "python", "parameters": "(reader, data_type_id)", "return_statement": "return serializer[1](reader=reader)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_not_none", "(", "'reader'", ",", "arg_0", ")", "_not_none_or_empty", "(", "'data_type_id'", ",", "arg_1", ")", "arg_2", "=", "_SERIALIZERS", ".", "get", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "raise", "UnsupportedDatasetTypeError", "(", "arg_1", ")", "return", "arg_2", "[", "1", "]", "(", "arg_0", "=", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Deserialize a dataframe.\n\n    Parameters\n    ----------\n    reader : file\n        File-like object to read from. Must be opened in binary mode.\n    data_type_id : dict\n        Serialization format of the raw data.\n        See the azureml.DataTypeIds class for constants.\n\n    Returns\n    -------\n    pandas.DataFrame\n        Dataframe object.\n    \"\"\"\n    _not_none('reader', arg_0)\n    _not_none_or_empty('data_type_id', arg_1)\n\n    arg_2 = _SERIALIZERS.get(arg_1)\n    if arg_2 is None:\n        raise UnsupportedDatasetTypeError(arg_1)\n    return arg_2[1](arg_0=arg_0)", "path": "azureml/serialization.py", "identifier": "deserialize_dataframe", "docstring": "Deserialize a dataframe.\n\n    Parameters\n    ----------\n    reader : file\n        File-like object to read from. Must be opened in binary mode.\n    data_type_id : dict\n        Serialization format of the raw data.\n        See the azureml.DataTypeIds class for constants.\n\n    Returns\n    -------\n    pandas.DataFrame\n        Dataframe object.", "docstring_tokens": ["Deserialize", "a", "dataframe", "."], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 257061}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L351-L371", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Return a record where all the duplicate fields have been removed.", "language": "python", "parameters": "(record)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "0", "arg_3", "=", "sorted", "(", "arg_0", ".", "keys", "(", ")", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "arg_0", "[", "arg_4", "]", "arg_1", "[", "arg_4", "]", "=", "[", "]", "arg_6", "=", "set", "(", ")", "for", "arg_7", "in", "arg_5", ":", "arg_8", "=", "(", "tuple", "(", "arg_7", "[", "0", "]", ")", ",", ")", "+", "arg_7", "[", "1", ":", "4", "]", "if", "arg_8", "not", "in", "arg_6", ":", "arg_6", ".", "add", "(", "arg_8", ")", "arg_2", "+=", "1", "arg_1", "[", "arg_4", "]", ".", "append", "(", "arg_7", "[", ":", "4", "]", "+", "(", "arg_2", ",", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Return a record where all the duplicate fields have been removed.\n\n    Fields are considered identical considering also the order of their\n    subfields.\n    \"\"\"\n    arg_1 = {}\n    arg_2 = 0\n    arg_3 = sorted(arg_0.keys())\n    for arg_4 in arg_3:\n        arg_5 = arg_0[arg_4]\n        arg_1[arg_4] = []\n        arg_6 = set()\n        for arg_7 in arg_5:\n            arg_8 = (tuple(arg_7[0]),) + arg_7[1:4]\n            if arg_8 not in arg_6:\n                arg_6.add(arg_8)\n                arg_2 += 1\n                arg_1[arg_4].append(arg_7[:4] + (arg_2,))\n    return arg_1", "path": "harvestingkit/bibrecord.py", "identifier": "record_drop_duplicate_fields", "docstring": "Return a record where all the duplicate fields have been removed.\n\n    Fields are considered identical considering also the order of their\n    subfields.", "docstring_tokens": ["Return", "a", "record", "where", "all", "the", "duplicate", "fields", "have", "been", "removed", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257062}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L845-L861", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "Only scott should do this. Upload new version to site.", "language": "python", "parameters": "(fname,username=\"nibjb\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"nibjb\"", ")", ":", "print", "(", "\"popping up pasword window...\"", ")", "arg_2", "=", "TK_askPassword", "(", "\"FTP LOGIN\"", ",", "\"enter password for %s\"", "%", "arg_1", ")", "if", "not", "arg_2", ":", "return", "print", "(", "\"username:\"", ",", "arg_1", ")", "print", "(", "\"password:\"", ",", "\"*\"", "*", "(", "len", "(", "arg_2", ")", ")", ")", "print", "(", "\"connecting...\"", ")", "arg_3", "=", "ftplib", ".", "FTP", "(", "\"swharden.com\"", ")", "arg_3", ".", "login", "(", "arg_1", ",", "arg_2", ")", "print", "(", "\"successful login!\"", ")", "arg_3", ".", "cwd", "(", "\"/software/swhlab/versions\"", ")", "print", "(", "\"uploading\"", ",", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ")", "arg_3", ".", "storbinary", "(", "\"STOR \"", "+", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ",", "open", "(", "arg_0", ",", "\"rb\"", ")", ",", "1024", ")", "print", "(", "\"disconnecting...\"", ")", "arg_3", ".", "quit", "(", ")"], "function": "def Func(arg_0,arg_1=\"nibjb\"):\n    \"\"\"Only scott should do this. Upload new version to site.\"\"\"\n    print(\"popping up pasword window...\")\n    arg_2=TK_askPassword(\"FTP LOGIN\",\"enter password for %s\"%arg_1)\n    if not arg_2:\n        return\n    print(\"username:\",arg_1)\n    print(\"password:\",\"*\"*(len(arg_2)))\n    print(\"connecting...\")\n    arg_3 = ftplib.FTP(\"swharden.com\")\n    arg_3.login(arg_1, arg_2)\n    print(\"successful login!\")\n    arg_3.cwd(\"/software/swhlab/versions\") #IMMEDIATELY GO HERE!!!\n    print(\"uploading\",os.path.basename(arg_0))\n    arg_3.storbinary(\"STOR \" + os.path.basename(arg_0), open(arg_0, \"rb\"), 1024) #for binary files\n    print(\"disconnecting...\")\n    arg_3.quit()", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "version_upload", "docstring": "Only scott should do this. Upload new version to site.", "docstring_tokens": ["Only", "scott", "should", "do", "this", ".", "Upload", "new", "version", "to", "site", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 257063}
{"url": "https://github.com/alpacahq/alpaca-trade-api-python/blob/9c9dea3b4a37c909f88391b202e86ff356a8b4d7/alpaca_trade_api/stream2.py#L112-L117", "sha": "9c9dea3b4a37c909f88391b202e86ff356a8b4d7", "docstring_summary": "Close any of open connections", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_ws", "is", "not", "None", ":", "await", "arg_0", ".", "_ws", ".", "Func", "(", ")", "if", "arg_0", ".", "polygon", "is", "not", "None", ":", "await", "arg_0", ".", "polygon", ".", "Func", "(", ")"], "function": "async def Func(arg_0):\n        '''Close any of open connections'''\n        if arg_0._ws is not None:\n            await arg_0._ws.Func()\n        if arg_0.polygon is not None:\n            await arg_0.polygon.Func()", "path": "alpaca_trade_api/stream2.py", "identifier": "StreamConn.close", "docstring": "Close any of open connections", "docstring_tokens": ["Close", "any", "of", "open", "connections"], "nwo": "alpacahq/alpaca-trade-api-python", "score": 0.9697751514981866, "idx": 257064}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/custom_reliablecollections.py#L126-L145", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Execute create, update, delete operations on existing reliable dictionaries.", "language": "python", "parameters": "(client, application_name, service_name, input_file)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "Cluster", ".", "from_sfclient", "(", "arg_0", ")", "arg_5", "=", "arg_4", ".", "get_application", "(", "arg_1", ")", ".", "get_service", "(", "arg_2", ")", "with", "open", "(", "arg_3", ")", "as", "json_file", ":", "arg_6", "=", "json", ".", "load", "(", "json_file", ")", "arg_5", ".", "execute", "(", "arg_6", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Execute create, update, delete operations on existing reliable dictionaries.\n\n    carry out create, update and delete operations on existing reliable dictionaries for given application and service.\n\n    :param application_name: Name of the application.\n    :type application_name: str\n    :param service_name: Name of the service.\n    :type service_name: str\n    :param output_file: input file with list of json to provide the operation information for reliable dictionaries.\n    \"\"\"\n\n    arg_4 = Cluster.from_sfclient(arg_0)\n    arg_5 = arg_4.get_application(arg_1).get_service(arg_2)\n\n    # call get service with headers and params\n    with open(arg_3) as json_file:\n        arg_6 = json.load(json_file)\n        arg_5.execute(arg_6)\n    return", "path": "rcctl/rcctl/custom_reliablecollections.py", "identifier": "execute_reliabledictionary", "docstring": "Execute create, update, delete operations on existing reliable dictionaries.\n\n    carry out create, update and delete operations on existing reliable dictionaries for given application and service.\n\n    :param application_name: Name of the application.\n    :type application_name: str\n    :param service_name: Name of the service.\n    :type service_name: str\n    :param output_file: input file with list of json to provide the operation information for reliable dictionaries.", "docstring_tokens": ["Execute", "create", "update", "delete", "operations", "on", "existing", "reliable", "dictionaries", "."], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 257065}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/comp.py#L558-L581", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Inherit some functions from the components that we own. In particular,\n        let's grab all functions that begin with `param_` so the super class\n        knows how to get parameter groups. Also, take anything that is listed\n        under Component.exports and rename with the category type, i.e.,\n        SphereCollection.add_particle -> Component.obj_add_particle", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_nopickle", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "comps", ":", "arg_3", "=", "inspect", ".", "getmembers", "(", "arg_2", ",", "predicate", "=", "inspect", ".", "ismethod", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", "[", "0", "]", ".", "startswith", "(", "'param_'", ")", ":", "setattr", "(", "arg_0", ",", "arg_4", "[", "0", "]", ",", "arg_4", "[", "1", "]", ")", "arg_0", ".", "_nopickle", ".", "append", "(", "arg_4", "[", "0", "]", ")", "arg_3", "=", "arg_2", ".", "exports", "(", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "arg_2", ".", "category", "+", "'_'", "+", "arg_4", ".", "__func__", ".", "__name__", "setattr", "(", "arg_0", ",", "arg_5", ",", "arg_4", ")", "arg_0", ".", "_nopickle", ".", "append", "(", "arg_5", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Inherit some functions from the components that we own. In particular,\n        let's grab all functions that begin with `param_` so the super class\n        knows how to get parameter groups. Also, take anything that is listed\n        under Component.exports and rename with the category type, i.e.,\n        SphereCollection.add_particle -> Component.obj_add_particle\n        \"\"\"\n        arg_0._nopickle = []\n\n        for arg_2 in arg_0.comps:\n            # take all member functions that start with 'param_'\n            arg_3 = inspect.getmembers(arg_2, predicate=inspect.ismethod)\n            for arg_4 in arg_3:\n                if arg_4[0].startswith('param_'):\n                    setattr(arg_0, arg_4[0], arg_4[1])\n                    arg_0._nopickle.append(arg_4[0])\n\n            # add everything from exports\n            arg_3 = arg_2.exports()\n            for arg_4 in arg_3:\n                arg_5 = arg_2.category + '_' + arg_4.__func__.__name__\n                setattr(arg_0, arg_5, arg_4)\n                arg_0._nopickle.append(arg_5)", "path": "peri/comp/comp.py", "identifier": "ComponentCollection.setup_passthroughs", "docstring": "Inherit some functions from the components that we own. In particular,\n        let's grab all functions that begin with `param_` so the super class\n        knows how to get parameter groups. Also, take anything that is listed\n        under Component.exports and rename with the category type, i.e.,\n        SphereCollection.add_particle -> Component.obj_add_particle", "docstring_tokens": ["Inherit", "some", "functions", "from", "the", "components", "that", "we", "own", ".", "In", "particular", "let", "s", "grab", "all", "functions", "that", "begin", "with", "param_", "so", "the", "super", "class", "knows", "how", "to", "get", "parameter", "groups", ".", "Also", "take", "anything", "that", "is", "listed", "under", "Component", ".", "exports", "and", "rename", "with", "the", "category", "type", "i", ".", "e", ".", "SphereCollection", ".", "add_particle", "-", ">", "Component", ".", "obj_add_particle"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 257066}
{"url": "https://github.com/edx/web-fragments/blob/42d760d700d70465e4e573b7b41442d8802ccd3c/web_fragments/fragment.py#L54-L64", "sha": "42d760d700d70465e4e573b7b41442d8802ccd3c", "docstring_summary": "Returns the fragment in a dictionary representation.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'content': self.content,\n            'resources': [r._asdict() for r in self.resources],  # pylint: disable=W0212\n            'js_init_fn': self.js_init_fn,\n            'js_init_version': self.js_init_version,\n            'json_init_args': self.json_init_args\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "'content'", ":", "arg_0", ".", "content", ",", "'resources'", ":", "[", "arg_1", ".", "_asdict", "(", ")", "for", "arg_1", "in", "arg_0", ".", "resources", "]", ",", "'js_init_fn'", ":", "arg_0", ".", "js_init_fn", ",", "'js_init_version'", ":", "arg_0", ".", "js_init_version", ",", "'json_init_args'", ":", "arg_0", ".", "json_init_args", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the fragment in a dictionary representation.\n        \"\"\"\n        return {\n            'content': arg_0.content,\n            'resources': [arg_1._asdict() for arg_1 in arg_0.resources],  # pylint: disable=W0212\n            'js_init_fn': arg_0.js_init_fn,\n            'js_init_version': arg_0.js_init_version,\n            'json_init_args': arg_0.json_init_args\n        }", "path": "web_fragments/fragment.py", "identifier": "Fragment.to_dict", "docstring": "Returns the fragment in a dictionary representation.", "docstring_tokens": ["Returns", "the", "fragment", "in", "a", "dictionary", "representation", "."], "nwo": "edx/web-fragments", "score": 0.3871570893833313, "idx": 257067}
{"url": "https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/colorful/colors.py#L18-L30", "sha": "919fa6da17865cc5e01e6b16119193a97d180dc9", "docstring_summary": "Parse the given color files.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "endswith", "(", "\".txt\"", ")", ":", "return", "parse_rgb_txt_file", "(", "arg_0", ")", "elif", "arg_0", ".", "endswith", "(", "\".json\"", ")", ":", "return", "parse_json_color_file", "(", "arg_0", ")", "raise", "TypeError", "(", "\"colorful only supports .txt and .json files for colors\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Parse the given color files.\n\n    Supported are:\n        * .txt for X11 colors\n        * .json for colornames\n    \"\"\"\n    if arg_0.endswith(\".txt\"):\n        return parse_rgb_txt_file(arg_0)\n    elif arg_0.endswith(\".json\"):\n        return parse_json_color_file(arg_0)\n\n    raise TypeError(\"colorful only supports .txt and .json files for colors\")", "path": "colorful/colors.py", "identifier": "parse_colors", "docstring": "Parse the given color files.\n\n    Supported are:\n        * .txt for X11 colors\n        * .json for colornames", "docstring_tokens": ["Parse", "the", "given", "color", "files", "."], "nwo": "timofurrer/colorful", "score": 0.585749501312285, "idx": 257068}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/interfaces/utils.py#L70-L79", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Propagate negative reset \"rst_n\" signal\n    to all subcomponents", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "rst_n", "for", "arg_2", "in", "arg_0", ".", "_units", ":", "_tryConnect", "(", "arg_1", ",", "arg_2", ",", "'rst_n'", ")", "_tryConnect", "(", "~", "arg_1", ",", "arg_2", ",", "'rst'", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Propagate negative reset \"rst_n\" signal\n    to all subcomponents\n    \"\"\"\n    arg_1 = arg_0.rst_n\n\n    for arg_2 in arg_0._units:\n        _tryConnect(arg_1, arg_2, 'rst_n')\n        _tryConnect(~arg_1, arg_2, 'rst')", "path": "hwt/interfaces/utils.py", "identifier": "propagateRstn", "docstring": "Propagate negative reset \"rst_n\" signal\n    to all subcomponents", "docstring_tokens": ["Propagate", "negative", "reset", "rst_n", "signal", "to", "all", "subcomponents"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 257069}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L3228-L3279", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks for common mistakes in comments.", "language": "python", "parameters": "(line, filename, linenum, next_line_start, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "find", "(", "'//'", ")", "if", "arg_5", "!=", "-", "1", ":", "if", "re", ".", "sub", "(", "r'\\\\.'", ",", "''", ",", "arg_0", "[", "0", ":", "arg_5", "]", ")", ".", "count", "(", "'\"'", ")", "%", "2", "==", "0", ":", "if", "(", "not", "(", "Match", "(", "r'^.*{ *//'", ",", "arg_0", ")", "and", "arg_3", "==", "arg_5", ")", "and", "(", "(", "arg_5", ">=", "1", "and", "arg_0", "[", "arg_5", "-", "1", "]", "not", "in", "string", ".", "whitespace", ")", "or", "(", "arg_5", ">=", "2", "and", "arg_0", "[", "arg_5", "-", "2", "]", "not", "in", "string", ".", "whitespace", ")", ")", ")", ":", "arg_4", "(", "arg_1", ",", "arg_2", ",", "'whitespace/comments'", ",", "2", ",", "'At least two spaces is best between code and comments'", ")", "arg_6", "=", "arg_0", "[", "arg_5", ":", "]", "arg_7", "=", "_RE_PATTERN_TODO", ".", "match", "(", "arg_6", ")", "if", "arg_7", ":", "arg_8", "=", "arg_7", ".", "group", "(", "1", ")", "if", "len", "(", "arg_8", ")", ">", "1", ":", "arg_4", "(", "arg_1", ",", "arg_2", ",", "'whitespace/todo'", ",", "2", ",", "'Too many spaces before TODO'", ")", "arg_9", "=", "arg_7", ".", "group", "(", "2", ")", "if", "not", "arg_9", ":", "arg_4", "(", "arg_1", ",", "arg_2", ",", "'readability/todo'", ",", "2", ",", "'Missing username in TODO; it should look like '", "'\"// TODO(my_username): Stuff.\"'", ")", "arg_10", "=", "arg_7", ".", "group", "(", "3", ")", "if", "arg_10", "!=", "' '", "and", "arg_10", "!=", "''", ":", "arg_4", "(", "arg_1", ",", "arg_2", ",", "'whitespace/todo'", ",", "2", ",", "'TODO(my_username) should be followed by a space'", ")", "if", "(", "Match", "(", "r'//[^ ]*\\w'", ",", "arg_6", ")", "and", "not", "Match", "(", "r'(///|//\\!)(\\s+|$)'", ",", "arg_6", ")", ")", ":", "arg_4", "(", "arg_1", ",", "arg_2", ",", "'whitespace/comments'", ",", "4", ",", "'Should have a space between // and comment'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n  \"\"\"Checks for common mistakes in comments.\n\n  Args:\n    line: The line in question.\n    filename: The name of the current file.\n    linenum: The number of the line to check.\n    next_line_start: The first non-whitespace column of the next line.\n    error: The function to call with any errors found.\n  \"\"\"\n  arg_5 = arg_0.find('//')\n  if arg_5 != -1:\n    # Check if the // may be in quotes.  If so, ignore it\n    if re.sub(r'\\\\.', '', arg_0[0:arg_5]).count('\"') % 2 == 0:\n      # Allow one space for new scopes, two spaces otherwise:\n      if (not (Match(r'^.*{ *//', arg_0) and arg_3 == arg_5) and\n          ((arg_5 >= 1 and\n            arg_0[arg_5-1] not in string.whitespace) or\n           (arg_5 >= 2 and\n            arg_0[arg_5-2] not in string.whitespace))):\n        arg_4(arg_1, arg_2, 'whitespace/comments', 2,\n              'At least two spaces is best between code and comments')\n\n      # Checks for common mistakes in TODO comments.\n      arg_6 = arg_0[arg_5:]\n      arg_7 = _RE_PATTERN_TODO.match(arg_6)\n      if arg_7:\n        # One whitespace is correct; zero whitespace is handled elsewhere.\n        arg_8 = arg_7.group(1)\n        if len(arg_8) > 1:\n          arg_4(arg_1, arg_2, 'whitespace/todo', 2,\n                'Too many spaces before TODO')\n\n        arg_9 = arg_7.group(2)\n        if not arg_9:\n          arg_4(arg_1, arg_2, 'readability/todo', 2,\n                'Missing username in TODO; it should look like '\n                '\"// TODO(my_username): Stuff.\"')\n\n        arg_10 = arg_7.group(3)\n        # Comparisons made explicit for correctness -- pylint: disable=g-explicit-bool-comparison\n        if arg_10 != ' ' and arg_10 != '':\n          arg_4(arg_1, arg_2, 'whitespace/todo', 2,\n                'TODO(my_username) should be followed by a space')\n\n      # If the comment contains an alphanumeric character, there\n      # should be a space somewhere between it and the // unless\n      # it's a /// or //! Doxygen comment.\n      if (Match(r'//[^ ]*\\w', arg_6) and\n          not Match(r'(///|//\\!)(\\s+|$)', arg_6)):\n        arg_4(arg_1, arg_2, 'whitespace/comments', 4,\n              'Should have a space between // and comment')", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckComment", "docstring": "Checks for common mistakes in comments.\n\n  Args:\n    line: The line in question.\n    filename: The name of the current file.\n    linenum: The number of the line to check.\n    next_line_start: The first non-whitespace column of the next line.\n    error: The function to call with any errors found.", "docstring_tokens": ["Checks", "for", "common", "mistakes", "in", "comments", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257070}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L179-L279", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Converts a Las from one point format to another\n    Automatically upgrades the file version if source file version is not compatible with\n    the new point_format_id", "language": "python", "parameters": "(source_las, *, point_format_id=None, file_version=None)", "return_statement": "return las", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "points_data", ".", "point_format", ".", "id", "if", "arg_2", "is", "None", ":", "arg_2", "=", "max", "(", "arg_0", ".", "header", ".", "version", ",", "dims", ".", "min_file_version_for_point_format", "(", "arg_1", ")", ",", ")", "else", ":", "arg_2", "=", "str", "(", "arg_2", ")", "dims", ".", "raise_if_version_not_compatible_with_fmt", "(", "arg_1", ",", "arg_2", ")", "arg_3", "=", "headers", ".", "HeaderFactory", ".", "Func_header", "(", "arg_0", ".", "header", ",", "arg_2", ")", "arg_3", ".", "point_format_id", "=", "arg_1", "arg_4", "=", "PointFormat", "(", "arg_1", ",", "arg_0", ".", "points_data", ".", "point_format", ".", "extra_dims", ")", "arg_5", "=", "record", ".", "PackedPointRecord", ".", "from_point_record", "(", "arg_0", ".", "points_data", ",", "arg_4", ")", "try", ":", "arg_6", "=", "arg_0", ".", "evlrs", "except", "ValueError", ":", "arg_6", "=", "[", "]", "if", "arg_2", ">=", "\"1.4\"", ":", "arg_7", "=", "las14", ".", "LasData", "(", "arg_3", "=", "arg_3", ",", "vlrs", "=", "arg_0", ".", "vlrs", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "else", ":", "if", "arg_6", ":", "logger", ".", "warning", "(", "\"The source contained {} EVLRs,\"", "\" they will be lost as version {} doest not support them\"", ".", "format", "(", "len", "(", "arg_6", ")", ",", "arg_2", ")", ")", "arg_7", "=", "las12", ".", "LasData", "(", "arg_3", "=", "arg_3", ",", "vlrs", "=", "arg_0", ".", "vlrs", ",", "arg_5", "=", "arg_5", ")", "return", "arg_7"], "function": "def Func(arg_0, *, arg_1=None, arg_2=None):\n    \"\"\" Converts a Las from one point format to another\n    Automatically upgrades the file version if source file version is not compatible with\n    the new point_format_id\n\n\n    Func to point format 0\n\n    >>> las = read_las('pylastests/simple.las')\n    >>> las.header.version\n    '1.2'\n    >>> las = Func(las, point_format_id=0)\n    >>> las.header.point_format_id\n    0\n    >>> las.header.version\n    '1.2'\n\n    Func to point format 6, which need version >= 1.4\n    then Func back to point format 0, version is not downgraded\n\n    >>> las = read_las('pylastests/simple.las')\n    >>> las.header.version\n    '1.2'\n    >>> las = Func(las, point_format_id=6)\n    >>> las.header.point_format_id\n    6\n    >>> las.header.version\n    '1.4'\n    >>> las = Func(las, point_format_id=0)\n    >>> las.header.version\n    '1.4'\n\n    an exception is raised if the requested point format is not compatible\n    with the file version\n\n    >>> las = read_las('pylastests/simple.las')\n    >>> Func(las, point_format_id=6, file_version='1.2')\n    Traceback (most recent call last):\n     ...\n    pylas.errors.PylasError: Point format 6 is not compatible with file version 1.2\n\n    Parameters\n    ----------\n    source_las : pylas.lasdatas.base.LasBase\n        The source data to be Funced\n\n    point_format_id : int, optional\n        The new point format id (the default is None, which won't change the source format id)\n\n    file_version : str, optional,\n        The new file version. None by default which means that the file_version\n        may be upgraded for compatibility with the new point_format. The file version will not\n        be downgraded.\n\n    Returns\n    -------\n        pylas.lasdatas.base.LasBase\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = arg_0.points_data.point_format.id\n\n    if arg_2 is None:\n        arg_2 = max(\n            arg_0.header.version,\n            dims.min_file_version_for_point_format(arg_1),\n        )\n    else:\n        arg_2 = str(arg_2)\n        dims.raise_if_version_not_compatible_with_fmt(arg_1, arg_2)\n\n    arg_3 = headers.HeaderFactory.Func_header(arg_0.header, arg_2)\n    arg_3.point_format_id = arg_1\n\n    arg_4 = PointFormat(\n        arg_1, arg_0.points_data.point_format.extra_dims\n    )\n    arg_5 = record.PackedPointRecord.from_point_record(\n        arg_0.points_data, arg_4\n    )\n\n    try:\n        arg_6 = arg_0.evlrs\n    except ValueError:\n        arg_6 = []\n\n    if arg_2 >= \"1.4\":\n\n        arg_7 = las14.LasData(\n            arg_3=arg_3, vlrs=arg_0.vlrs, arg_5=arg_5, arg_6=arg_6\n        )\n    else:\n        if arg_6:\n            logger.warning(\n                \"The source contained {} EVLRs,\"\n                \" they will be lost as version {} doest not support them\".format(\n                    len(arg_6), arg_2\n                )\n            )\n        arg_7 = las12.LasData(arg_3=arg_3, vlrs=arg_0.vlrs, arg_5=arg_5)\n\n    return arg_7", "path": "pylas/lib.py", "identifier": "convert", "docstring": "Converts a Las from one point format to another\n    Automatically upgrades the file version if source file version is not compatible with\n    the new point_format_id\n\n\n    convert to point format 0\n\n    >>> las = read_las('pylastests/simple.las')\n    >>> las.header.version\n    '1.2'\n    >>> las = convert(las, point_format_id=0)\n    >>> las.header.point_format_id\n    0\n    >>> las.header.version\n    '1.2'\n\n    convert to point format 6, which need version >= 1.4\n    then convert back to point format 0, version is not downgraded\n\n    >>> las = read_las('pylastests/simple.las')\n    >>> las.header.version\n    '1.2'\n    >>> las = convert(las, point_format_id=6)\n    >>> las.header.point_format_id\n    6\n    >>> las.header.version\n    '1.4'\n    >>> las = convert(las, point_format_id=0)\n    >>> las.header.version\n    '1.4'\n\n    an exception is raised if the requested point format is not compatible\n    with the file version\n\n    >>> las = read_las('pylastests/simple.las')\n    >>> convert(las, point_format_id=6, file_version='1.2')\n    Traceback (most recent call last):\n     ...\n    pylas.errors.PylasError: Point format 6 is not compatible with file version 1.2\n\n    Parameters\n    ----------\n    source_las : pylas.lasdatas.base.LasBase\n        The source data to be converted\n\n    point_format_id : int, optional\n        The new point format id (the default is None, which won't change the source format id)\n\n    file_version : str, optional,\n        The new file version. None by default which means that the file_version\n        may be upgraded for compatibility with the new point_format. The file version will not\n        be downgraded.\n\n    Returns\n    -------\n        pylas.lasdatas.base.LasBase", "docstring_tokens": ["Converts", "a", "Las", "from", "one", "point", "format", "to", "another", "Automatically", "upgrades", "the", "file", "version", "if", "source", "file", "version", "is", "not", "compatible", "with", "the", "new", "point_format_id"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 257071}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/_win32_links.py#L141-L191", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Windows helper for ub.symlink", "language": "python", "parameters": "(path, link, overwrite=0, verbose=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ")", ":", "if", "exists", "(", "arg_1", ")", "and", "not", "os", ".", "path", ".", "islink", "(", "arg_1", ")", ":", "if", "arg_3", ":", "print", "(", "'link location already exists'", ")", "arg_4", "=", "_win32_is_junction", "(", "arg_1", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "if", "arg_4", ":", "arg_5", "=", "_win32_read_junction", "(", "arg_1", ")", "if", "arg_0", "==", "arg_5", ":", "if", "arg_3", ":", "print", "(", "'...and is a junction that points to the same place'", ")", "return", "arg_1", "else", ":", "if", "arg_3", ":", "if", "not", "exists", "(", "arg_5", ")", ":", "print", "(", "'...and is a broken junction that points somewhere else'", ")", "else", ":", "print", "(", "'...and is a junction that points somewhere else'", ")", "else", ":", "if", "arg_3", ":", "print", "(", "'...and is an existing real directory!'", ")", "raise", "IOError", "(", "'Cannot overwrite a real directory'", ")", "elif", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "if", "_win32_is_hardlinked", "(", "arg_1", ",", "arg_0", ")", ":", "if", "arg_3", ":", "print", "(", "'...and is a hard link that points to the same place'", ")", "return", "arg_1", "else", ":", "if", "arg_3", ":", "print", "(", "'...and is a hard link that points somewhere else'", ")", "if", "_win32_canFunc", "(", ")", ":", "raise", "IOError", "(", "'Cannot overwrite potentially real file if we can symlink'", ")", "if", "arg_2", ":", "if", "arg_3", ":", "print", "(", "'...overwriting'", ")", "util_io", ".", "delete", "(", "arg_1", ",", "arg_3", ">", "1", ")", "else", ":", "if", "exists", "(", "arg_1", ")", ":", "raise", "IOError", "(", "'Link already exists'", ")", "_win32Func2", "(", "arg_0", ",", "arg_1", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=0):\n    \"\"\"\n    Windows helper for ub.symlink\n    \"\"\"\n    if exists(arg_1) and not os.path.islink(arg_1):\n        # On windows a broken link might still exist as a hard link or a\n        # junction. Overwrite it if it is a file and we cannot symlink.\n        # However, if it is a non-junction directory then do not overwrite\n        if arg_3:\n            print('link location already exists')\n        arg_4 = _win32_is_junction(arg_1)\n        # NOTE:\n        # in python2 broken junctions are directories and exist\n        # in python3 broken junctions are directories and do not exist\n        if os.path.isdir(arg_1):\n            if arg_4:\n                arg_5 = _win32_read_junction(arg_1)\n                if arg_0 == arg_5:\n                    if arg_3:\n                        print('...and is a junction that points to the same place')\n                    return arg_1\n                else:\n                    if arg_3:\n                        if not exists(arg_5):\n                            print('...and is a broken junction that points somewhere else')\n                        else:\n                            print('...and is a junction that points somewhere else')\n            else:\n                if arg_3:\n                    print('...and is an existing real directory!')\n                raise IOError('Cannot overwrite a real directory')\n\n        elif os.path.isfile(arg_1):\n            if _win32_is_hardlinked(arg_1, arg_0):\n                if arg_3:\n                    print('...and is a hard link that points to the same place')\n                return arg_1\n            else:\n                if arg_3:\n                    print('...and is a hard link that points somewhere else')\n                if _win32_canFunc():\n                    raise IOError('Cannot overwrite potentially real file if we can symlink')\n        if arg_2:\n            if arg_3:\n                print('...overwriting')\n            util_io.delete(arg_1, arg_3 > 1)\n        else:\n            if exists(arg_1):\n                raise IOError('Link already exists')\n\n    _win32Func2(arg_0, arg_1, arg_3=arg_3)", "path": "ubelt/_win32_links.py", "identifier": "_symlink", "docstring": "Windows helper for ub.symlink", "docstring_tokens": ["Windows", "helper", "for", "ub", ".", "symlink"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 257072}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/config.py#L60-L65", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Expands all environment variables in a settings dictionary.", "language": "python", "parameters": "(settings)", "return_statement": "return dict(\n        (key, os.path.expandvars(value))\n        for key, value in settings.iteritems()\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "dict", "(", "(", "arg_1", ",", "os", ".", "path", ".", "expandvars", "(", "arg_2", ")", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "iteritems", "(", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Expands all environment variables in a settings dictionary.\"\"\"\n    return dict(\n        (arg_1, os.path.expandvars(arg_2))\n        for arg_1, arg_2 in arg_0.iteritems()\n    )", "path": "cnxpublishing/config.py", "identifier": "expandvars_dict", "docstring": "Expands all environment variables in a settings dictionary.", "docstring_tokens": ["Expands", "all", "environment", "variables", "in", "a", "settings", "dictionary", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 257073}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L1018-L1052", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Converts output audio to the specified format.", "language": "python", "parameters": "(self, samplerate=None, n_channels=None, bitdepth=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "[", "8", ",", "16", ",", "24", ",", "32", ",", "64", "]", "if", "arg_3", "is", "not", "None", ":", "if", "arg_3", "not", "in", "arg_4", ":", "raise", "ValueError", "(", "\"bitdepth must be one of {}.\"", ".", "format", "(", "str", "(", "arg_4", ")", ")", ")", "arg_0", ".", "output_format", ".", "extend", "(", "[", "'-b'", ",", "'{}'", ".", "format", "(", "arg_3", ")", "]", ")", "if", "arg_2", "is", "not", "None", ":", "if", "not", "isinstance", "(", "arg_2", ",", "int", ")", "or", "arg_2", "<=", "0", ":", "raise", "ValueError", "(", "\"n_channels must be a positive integer.\"", ")", "arg_0", ".", "output_format", ".", "extend", "(", "[", "'-c'", ",", "'{}'", ".", "format", "(", "arg_2", ")", "]", ")", "if", "arg_1", "is", "not", "None", ":", "if", "not", "is_number", "(", "arg_1", ")", "or", "arg_1", "<=", "0", ":", "raise", "ValueError", "(", "\"samplerate must be a positive number.\"", ")", "arg_0", ".", "rate", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        '''Converts output audio to the specified format.\n\n        Parameters\n        ----------\n        samplerate : float, default=None\n            Desired samplerate. If None, defaults to the same as input.\n        n_channels : int, default=None\n            Desired number of channels. If None, defaults to the same as input.\n        bitdepth : int, default=None\n            Desired bitdepth. If None, defaults to the same as input.\n\n        See Also\n        --------\n        rate\n\n        '''\n        arg_4 = [8, 16, 24, 32, 64]\n        if arg_3 is not None:\n            if arg_3 not in arg_4:\n                raise ValueError(\n                    \"bitdepth must be one of {}.\".format(str(arg_4))\n                )\n            arg_0.output_format.extend(['-b', '{}'.format(arg_3)])\n        if arg_2 is not None:\n            if not isinstance(arg_2, int) or arg_2 <= 0:\n                raise ValueError(\n                    \"n_channels must be a positive integer.\"\n                )\n            arg_0.output_format.extend(['-c', '{}'.format(arg_2)])\n        if arg_1 is not None:\n            if not is_number(arg_1) or arg_1 <= 0:\n                raise ValueError(\"samplerate must be a positive number.\")\n            arg_0.rate(arg_1)\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.convert", "docstring": "Converts output audio to the specified format.\n\n        Parameters\n        ----------\n        samplerate : float, default=None\n            Desired samplerate. If None, defaults to the same as input.\n        n_channels : int, default=None\n            Desired number of channels. If None, defaults to the same as input.\n        bitdepth : int, default=None\n            Desired bitdepth. If None, defaults to the same as input.\n\n        See Also\n        --------\n        rate", "docstring_tokens": ["Converts", "output", "audio", "to", "the", "specified", "format", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 257074}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/from_inspire.py#L257-L266", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Remove hidden notes and tag a CERN if detected.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "tag_as_cern", ":", "arg_1", "=", "record_get_field_instances", "(", "arg_0", ".", "record", ",", "tag", "=", "\"595\"", ")", "for", "arg_2", "in", "arg_1", ":", "for", "arg_3", ",", "arg_4", "in", "arg_2", "[", "0", "]", ":", "if", "arg_4", "==", "\"CDS\"", ":", "arg_0", ".", "tag_as_cern", "=", "True", "record_delete_fields", "(", "arg_0", ".", "record", ",", "tag", "=", "\"595\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Remove hidden notes and tag a CERN if detected.\"\"\"\n        if not arg_0.tag_as_cern:\n            arg_1 = record_get_field_instances(arg_0.record,\n                                               tag=\"595\")\n            for arg_2 in arg_1:\n                for arg_3, arg_4 in arg_2[0]:\n                    if arg_4 == \"CDS\":\n                        arg_0.tag_as_cern = True\n        record_delete_fields(arg_0.record, tag=\"595\")", "path": "harvestingkit/inspire_cds_package/from_inspire.py", "identifier": "Inspire2CDS.update_hidden_notes", "docstring": "Remove hidden notes and tag a CERN if detected.", "docstring_tokens": ["Remove", "hidden", "notes", "and", "tag", "a", "CERN", "if", "detected", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257075}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/glib.py#L177-L184", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Prepare pending handlers.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_unprepared_pending", ":", "return", "for", "arg_1", "in", "list", "(", "arg_0", ".", "_unprepared_pending", ")", ":", "arg_0", ".", "_configure_io_handler", "(", "arg_1", ")", "arg_0", ".", "check_events", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Prepare pending handlers.\n        \"\"\"\n        if not arg_0._unprepared_pending:\n            return\n        for arg_1 in list(arg_0._unprepared_pending):\n            arg_0._configure_io_handler(arg_1)\n        arg_0.check_events()", "path": "pyxmpp2/mainloop/glib.py", "identifier": "GLibMainLoop._prepare_pending", "docstring": "Prepare pending handlers.", "docstring_tokens": ["Prepare", "pending", "handlers", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257076}
{"url": "https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L148-L151", "sha": "986c4b1315d6b128947c3bc3494513d8e5380ff0", "docstring_summary": "Renames an existing database.", "language": "python", "parameters": "(self, from_name, to_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "log", ".", "info", "(", "'renaming database from %s to %s'", "%", "(", "arg_1", ",", "arg_2", ")", ")", "arg_0", ".", "_run_stmt", "(", "'alter database %s Func to %s'", "%", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Renames an existing database.\"\"\"\n        log.info('renaming database from %s to %s' % (arg_1, arg_2))\n        arg_0._run_stmt('alter database %s Func to %s' % (arg_1, arg_2))", "path": "pydba/postgres.py", "identifier": "PostgresDB.rename", "docstring": "Renames an existing database.", "docstring_tokens": ["Renames", "an", "existing", "database", "."], "nwo": "drkjam/pydba", "score": 0.138843686048881, "idx": 257077}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/writer.py#L164-L176", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "initialize VCGWriter for a UML graph", "language": "python", "parameters": "(self, file_name, basename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "graph_file", "=", "open", "(", "arg_1", ",", "\"w+\"", ")", "arg_0", ".", "printer", "=", "VCGPrinter", "(", "arg_0", ".", "graph_file", ")", "arg_0", ".", "printer", ".", "open_graph", "(", "title", "=", "arg_2", ",", "layoutalgorithm", "=", "\"dfs\"", ",", "late_edge_labels", "=", "\"yes\"", ",", "port_sharing", "=", "\"no\"", ",", "manhattan_edges", "=", "\"yes\"", ",", ")", "arg_0", ".", "printer", ".", "emit_node", "=", "arg_0", ".", "printer", ".", "node", "arg_0", ".", "printer", ".", "emit_edge", "=", "arg_0", ".", "printer", ".", "edge"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"initialize VCGWriter for a UML graph\"\"\"\n        arg_0.graph_file = open(arg_1, \"w+\")\n        arg_0.printer = VCGPrinter(arg_0.graph_file)\n        arg_0.printer.open_graph(\n            title=arg_2,\n            layoutalgorithm=\"dfs\",\n            late_edge_labels=\"yes\",\n            port_sharing=\"no\",\n            manhattan_edges=\"yes\",\n        )\n        arg_0.printer.emit_node = arg_0.printer.node\n        arg_0.printer.emit_edge = arg_0.printer.edge", "path": "pylint/pyreverse/writer.py", "identifier": "VCGWriter.set_printer", "docstring": "initialize VCGWriter for a UML graph", "docstring_tokens": ["initialize", "VCGWriter", "for", "a", "UML", "graph"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257078}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/badge_update.py#L98-L119", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return flake8 badge color.", "language": "python", "parameters": "(score)", "return_statement": "return BADGE_COLORS[-1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "0", ",", "20", ",", "50", ",", "100", ",", "200", ")", "for", "arg_2", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "if", "arg_0", "<=", "arg_1", "[", "arg_2", "]", ":", "return", "BADGE_COLORS", "[", "arg_2", "]", "return", "BADGE_COLORS", "[", "-", "1", "]"], "function": "def Func(arg_0):\n    \"\"\"Return flake8 badge color.\n\n    Parameters\n    ----------\n    score : float\n        A flake8 score\n\n    Returns\n    -------\n    str\n        Badge color\n\n    \"\"\"\n    # These are the score cutoffs for each color above.\n    # I.e. score==0 -> brightgreen, down to 100 < score <= 200 -> orange\n    arg_1 = (0, 20, 50, 100, 200)\n    for arg_2 in range(len(arg_1)):\n        if arg_0 <= arg_1[arg_2]:\n            return BADGE_COLORS[arg_2]\n    # and score > 200 -> red\n    return BADGE_COLORS[-1]", "path": "badge_update.py", "identifier": "flake8_color", "docstring": "Return flake8 badge color.\n\n    Parameters\n    ----------\n    score : float\n        A flake8 score\n\n    Returns\n    -------\n    str\n        Badge color", "docstring_tokens": ["Return", "flake8", "badge", "color", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 257079}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L1638-L1661", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Returns paramters used to process data.", "language": "python", "parameters": "(self)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "'sample'", ",", "'ratio_params'", ",", "'despike_params'", ",", "'autorange_params'", ",", "'bkgcorrect_params'", "]", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "getattr", "(", "arg_0", ",", "arg_3", ")", "arg_2", "[", "'filter_params'", "]", "=", "arg_0", ".", "filt", ".", "params", "arg_2", "[", "'filter_sequence'", "]", "=", "arg_0", ".", "filt", ".", "sequence", "arg_2", "[", "'filter_used'", "]", "=", "arg_0", ".", "filt", ".", "make_keydict", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns paramters used to process data.\n\n        Returns\n        -------\n        dict\n            dict of analysis parameters\n        \"\"\"\n        arg_1 = ['sample',\n                   'ratio_params',\n                   'despike_params',\n                   'autorange_params',\n                   'bkgcorrect_params']\n\n        arg_2 = {}\n        for arg_3 in arg_1:\n            arg_2[arg_3] = getattr(arg_0, arg_3)\n\n        arg_2['filter_params'] = arg_0.filt.params\n        arg_2['filter_sequence'] = arg_0.filt.sequence\n        arg_2['filter_used'] = arg_0.filt.make_keydict()\n\n        return arg_2", "path": "latools/D_obj.py", "identifier": "D.get_params", "docstring": "Returns paramters used to process data.\n\n        Returns\n        -------\n        dict\n            dict of analysis parameters", "docstring_tokens": ["Returns", "paramters", "used", "to", "process", "data", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257080}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/scripts/publish_release.py#L113-L129", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Identify the release type and create a new target file with TOML header.", "language": "python", "parameters": "(argv)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "if", "\"a\"", "in", "arg_3", ":", "arg_4", "=", "\"alpha\"", "if", "\"b\"", "in", "arg_3", ":", "arg_4", "=", "\"beta\"", "else", ":", "arg_4", "=", "find_bump", "(", "arg_2", ",", "arg_3", ")", "arg_5", "=", "\"{}.md\"", ".", "format", "(", "arg_3", ")", "arg_6", "=", "copy", "(", "join", "(", "arg_1", ",", "arg_5", ")", ",", "arg_2", ")", "build_hugo_md", "(", "arg_6", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Identify the release type and create a new target file with TOML header.\n\n    Requires three arguments.\n\n    \"\"\"\n    arg_1, arg_2, arg_3 = arg_0\n    if \"a\" in arg_3:\n        arg_4 = \"alpha\"\n    if \"b\" in arg_3:\n        arg_4 = \"beta\"\n    else:\n        arg_4 = find_bump(arg_2, arg_3)\n    arg_5 = \"{}.md\".format(arg_3)\n    arg_6 = copy(join(arg_1, arg_5), arg_2)\n    build_hugo_md(arg_6, arg_3, arg_4)", "path": "scripts/publish_release.py", "identifier": "main", "docstring": "Identify the release type and create a new target file with TOML header.\n\n    Requires three arguments.", "docstring_tokens": ["Identify", "the", "release", "type", "and", "create", "a", "new", "target", "file", "with", "TOML", "header", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 257081}
{"url": "https://github.com/thusoy/pwm/blob/fff7d755c34f3a7235a8bf217ffa2ff5aed4926f/pwm/encoding.py#L73-L80", "sha": "fff7d755c34f3a7235a8bf217ffa2ff5aed4926f", "docstring_summary": "parses a chunk of bytes to integer using big-endian representation", "language": "python", "parameters": "(self, chunk)", "return_statement": "return sum([\n                256**(self.chunklen[0]-1-i) * ord_byte(chunk[i])\n                for i in range(self.chunklen[0])\n            ])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "sum", "(", "[", "256", "**", "(", "arg_0", ".", "chunklen", "[", "0", "]", "-", "1", "-", "arg_2", ")", "*", "ord_byte", "(", "arg_1", "[", "arg_2", "]", ")", "for", "arg_2", "in", "range", "(", "arg_0", ".", "chunklen", "[", "0", "]", ")", "]", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        parses a chunk of bytes to integer using big-endian representation\n        '''\n        return sum([\n                256**(arg_0.chunklen[0]-1-arg_2) * ord_byte(arg_1[arg_2])\n                for arg_2 in range(arg_0.chunklen[0])\n            ])", "path": "pwm/encoding.py", "identifier": "Encoder._chunk_to_long", "docstring": "parses a chunk of bytes to integer using big-endian representation", "docstring_tokens": ["parses", "a", "chunk", "of", "bytes", "to", "integer", "using", "big", "-", "endian", "representation"], "nwo": "thusoy/pwm", "score": 0.15726537023232431, "idx": 257082}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L68-L100", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "A helper function that decorates a function to retain the current\n    request context.  This is useful when working with greenlets.  The moment\n    the function is decorated a copy of the request context is created and\n    then pushed when the function is called.", "language": "python", "parameters": "(f)", "return_statement": "return update_wrapper(wrapper, f)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_request_ctx_stack", ".", "top", "if", "arg_1", "is", "None", ":", "raise", "RuntimeError", "(", "'This decorator can only be used at local scopes '", "'when a request context is on the stack.  For instance within '", "'view functions.'", ")", "arg_2", "=", "arg_1", ".", "copy", "(", ")", "def", "wrapper", "(", "*", "arg_3", ",", "**", "arg_4", ")", ":", "with", "arg_2", ":", "return", "arg_0", "(", "*", "arg_3", ",", "**", "arg_4", ")", "return", "update_wrapper", "(", "wrapper", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"A helper function that decorates a function to retain the current\n    request context.  This is useful when working with greenlets.  The moment\n    the function is decorated a copy of the request context is created and\n    then pushed when the function is called.\n\n    Example::\n\n        import gevent\n        from flask import Func\n\n        @app.route('/')\n        def index():\n            @Func\n            def do_some_work():\n                # do some work here, it can access flask.request like you\n                # would otherwise in the view function.\n                ...\n            gevent.spawn(do_some_work)\n            return 'Regular response'\n\n    .. versionadded:: 0.10\n    \"\"\"\n    arg_1 = _request_ctx_stack.top\n    if arg_1 is None:\n        raise RuntimeError('This decorator can only be used at local scopes '\n            'when a request context is on the stack.  For instance within '\n            'view functions.')\n    arg_2 = arg_1.copy()\n    def wrapper(*arg_3, **arg_4):\n        with arg_2:\n            return arg_0(*arg_3, **arg_4)\n    return update_wrapper(wrapper, arg_0)", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py", "identifier": "copy_current_request_context", "docstring": "A helper function that decorates a function to retain the current\n    request context.  This is useful when working with greenlets.  The moment\n    the function is decorated a copy of the request context is created and\n    then pushed when the function is called.\n\n    Example::\n\n        import gevent\n        from flask import copy_current_request_context\n\n        @app.route('/')\n        def index():\n            @copy_current_request_context\n            def do_some_work():\n                # do some work here, it can access flask.request like you\n                # would otherwise in the view function.\n                ...\n            gevent.spawn(do_some_work)\n            return 'Regular response'\n\n    .. versionadded:: 0.10", "docstring_tokens": ["A", "helper", "function", "that", "decorates", "a", "function", "to", "retain", "the", "current", "request", "context", ".", "This", "is", "useful", "when", "working", "with", "greenlets", ".", "The", "moment", "the", "function", "is", "decorated", "a", "copy", "of", "the", "request", "context", "is", "created", "and", "then", "pushed", "when", "the", "function", "is", "called", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257083}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L273-L288", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Set input values on task", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "if", "hasattr", "(", "arg_3", ",", "'value'", ")", ":", "arg_3", "=", "arg_3", ".", "value", "arg_0", ".", "inputs", ".", "__Funcattr__", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Set input values on task\n\n        Args:\n               arbitrary_keys: values for the keys\n\n        Returns:\n            None\n        \"\"\"\n        for arg_2, arg_3 in arg_1.items():\n            # Support both port and port.value\n            if hasattr(arg_3, 'value'):\n                arg_3 = arg_3.value\n\n            arg_0.inputs.__Funcattr__(arg_2, arg_3)", "path": "gbdxtools/simpleworkflows.py", "identifier": "Task.set", "docstring": "Set input values on task\n\n        Args:\n               arbitrary_keys: values for the keys\n\n        Returns:\n            None", "docstring_tokens": ["Set", "input", "values", "on", "task"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 257084}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access_common.py#L112-L137", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "Prune the cache", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "folders", ".", "cacheDirectory", "(", ")", "def", "fullpath", "(", "arg_1", ")", ":", "return", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", "def", "getMTimeSafe", "(", "arg_1", ")", ":", "try", ":", "return", "os", ".", "stat", "(", "arg_1", ")", ".", "st_mtime", "except", "FileNotFoundError", ":", "import", "time", "return", "time", ".", "clock", "(", ")", "fsutils", ".", "mkDirP", "(", "arg_0", ")", "arg_2", "=", "getMaxCachedModules", "(", ")", "for", "arg_1", "in", "sorted", "(", "[", "arg_1", "for", "arg_1", "in", "os", ".", "listdir", "(", "arg_0", ")", "if", "os", ".", "path", ".", "isfile", "(", "fullpath", "(", "arg_1", ")", ")", "and", "not", "arg_1", ".", "endswith", "(", "'.json'", ")", "and", "not", "arg_1", ".", "endswith", "(", "'.locked'", ")", "]", ",", "key", "=", "lambda", "arg_1", ":", "getMTimeSafe", "(", "fullpath", "(", "arg_1", ")", ")", ",", "reverse", "=", "True", ")", "[", "arg_2", ":", "]", ":", "cache_logger", ".", "debug", "(", "'cleaning up cache file %s'", ",", "arg_1", ")", "removeFromCache", "(", "arg_1", ")", "cache_logger", ".", "debug", "(", "'cache pruned to %s items'", ",", "arg_2", ")"], "function": "def Func():\n    ''' Prune the cache '''\n    arg_0 = folders.cacheDirectory()\n    def fullpath(arg_1):\n        return os.path.join(arg_0, arg_1)\n    def getMTimeSafe(arg_1):\n        # it's possible that another process removed the file before we stat\n        # it, handle this gracefully\n        try:\n            return os.stat(arg_1).st_mtime\n        except FileNotFoundError:\n            import time\n            return time.clock()\n    # ensure cache exists\n    fsutils.mkDirP(arg_0)\n    arg_2 = getMaxCachedModules()\n    for arg_1 in sorted(\n            [arg_1 for arg_1 in os.listdir(arg_0) if\n                os.path.isfile(fullpath(arg_1)) and not arg_1.endswith('.json') and not arg_1.endswith('.locked')\n            ],\n            key = lambda arg_1: getMTimeSafe(fullpath(arg_1)),\n            reverse = True\n        )[arg_2:]:\n        cache_logger.debug('cleaning up cache file %s', arg_1)\n        removeFromCache(arg_1)\n    cache_logger.debug('cache pruned to %s items', arg_2)", "path": "yotta/lib/access_common.py", "identifier": "pruneCache", "docstring": "Prune the cache", "docstring_tokens": ["Prune", "the", "cache"], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 257085}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L770-L785", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return a rasterio.io.MemoryFile instance from input.", "language": "python", "parameters": "(data=None, profile=None)", "return_statement": "return memfile", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "MemoryFile", "(", ")", "arg_1", ".", "update", "(", "width", "=", "arg_0", ".", "shape", "[", "-", "2", "]", ",", "height", "=", "arg_0", ".", "shape", "[", "-", "1", "]", ")", "with", "arg_2", ".", "open", "(", "**", "arg_1", ")", "as", "dataset", ":", "dataset", ".", "write", "(", "arg_0", ")", "return", "arg_2"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"\n    Return a rasterio.io.MemoryFile instance from input.\n\n    Parameters\n    ----------\n    data : array\n        array to be written\n    profile : dict\n        rasterio profile for MemoryFile\n    \"\"\"\n    arg_2 = MemoryFile()\n    arg_1.update(width=arg_0.shape[-2], height=arg_0.shape[-1])\n    with arg_2.open(**arg_1) as dataset:\n        dataset.write(arg_0)\n    return arg_2", "path": "mapchete/io/raster.py", "identifier": "memory_file", "docstring": "Return a rasterio.io.MemoryFile instance from input.\n\n    Parameters\n    ----------\n    data : array\n        array to be written\n    profile : dict\n        rasterio profile for MemoryFile", "docstring_tokens": ["Return", "a", "rasterio", ".", "io", ".", "MemoryFile", "instance", "from", "input", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 257086}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/periodsearch.py#L493-L646", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This drives the overall parallel period processing for a list of LCs.", "language": "python", "parameters": "(lclist,\n                outdir,\n                timecols=None,\n                magcols=None,\n                errcols=None,\n                lcformat='hat-sql',\n                lcformatdir=None,\n                pfmethods=('gls','pdm','mav','win'),\n                pfkwargs=({},{},{},{}),\n                sigclip=10.0,\n                getblssnr=False,\n                nperiodworkers=NCPUS,\n                ncontrolworkers=1,\n                liststartindex=None,\n                listmaxobjects=None,\n                minobservations=500,\n                excludeprocessed=True)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "'hat-sql'", ",", "arg_6", "=", "None", ",", "arg_7", "=", "(", "'gls'", ",", "'pdm'", ",", "'mav'", ",", "'win'", ")", ",", "arg_8", "=", "(", "{", "}", ",", "{", "}", ",", "{", "}", ",", "{", "}", ")", ",", "arg_9", "=", "10.0", ",", "arg_10", "=", "False", ",", "arg_11", "=", "arg_12", ",", "arg_13", "=", "1", ",", "arg_14", "=", "None", ",", "arg_15", "=", "None", ",", "arg_16", "=", "500", ",", "arg_17", "=", "True", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "os", ".", "makedirs", "(", "arg_1", ")", "if", "(", "arg_14", "is", "not", "None", ")", "and", "(", "arg_15", "is", "None", ")", ":", "arg_0", "=", "arg_0", "[", "arg_14", ":", "]", "elif", "(", "arg_14", "is", "None", ")", "and", "(", "arg_15", "is", "not", "None", ")", ":", "arg_0", "=", "arg_0", "[", ":", "arg_15", "]", "elif", "(", "arg_14", "is", "not", "None", ")", "and", "(", "arg_15", "is", "not", "None", ")", ":", "arg_0", "=", "arg_0", "[", "arg_14", ":", "arg_14", "+", "arg_15", "]", "arg_18", "=", "[", "(", "x", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_10", ",", "arg_9", ",", "arg_11", ",", "arg_16", ",", "arg_17", ")", "for", "x", "in", "arg_0", "]", "with", "ProcessPoolExecutor", "(", "max_workers", "=", "arg_13", ")", "as", "executor", ":", "arg_19", "=", "executor", ".", "map", "(", "_runpf_worker", ",", "arg_18", ")", "arg_20", "=", "[", "x", "for", "x", "in", "arg_19", "]", "return", "arg_20"], "function": "def Func(arg_0,\n                arg_1,\n                arg_2=None,\n                arg_3=None,\n                arg_4=None,\n                arg_5='hat-sql',\n                arg_6=None,\n                arg_7=('gls','pdm','mav','win'),\n                arg_8=({},{},{},{}),\n                arg_9=10.0,\n                arg_10=False,\n                arg_11=arg_12,\n                arg_13=1,\n                arg_14=None,\n                arg_15=None,\n                arg_16=500,\n                arg_17=True):\n    '''This drives the overall parallel period processing for a list of LCs.\n\n    As a rough benchmark, 25000 HATNet light curves with up to 50000 points per\n    LC take about 26 days in total for an invocation of this function using\n    GLS+PDM+BLS, 10 periodworkers, and 4 controlworkers (so all 40 'cores') on a\n    2 x Xeon E5-2660v3 machine.\n\n    Parameters\n    ----------\n\n    lclist : list of str\n        The list of light curve file to process.\n\n    outdir : str\n        The output directory where the period-finding result pickles will go.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in calculating the features.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in calculating the features.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in calculating the features.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    pfmethods : list of str\n        This is a list of period finding methods to run. Each element is a\n        string matching the keys of the `PFMETHODS` dict above. By default, this\n        runs GLS, PDM, AoVMH, and the spectral window Lomb-Scargle periodogram.\n\n    pfkwargs : list of dicts\n        This is used to provide any special kwargs as dicts to each\n        period-finding method function specified in `pfmethods`.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    getblssnr : bool\n        If this is True and BLS is one of the methods specified in `pfmethods`,\n        will also calculate the stats for each best period in the BLS results:\n        transit depth, duration, ingress duration, refit period and epoch, and\n        the SNR of the transit.\n\n    nperiodworkers : int\n        The number of parallel period-finding workers to launch per object task.\n\n    ncontrolworkers : int\n        The number of controlling processes to launch. This effectively sets how\n        many objects from `lclist` will be processed in parallel.\n\n    liststartindex : int or None\n        This sets the index from where to start in `lclist`.\n\n    listmaxobjects : int or None\n        This sets the maximum number of objects in `lclist` to run\n        period-finding for in this invocation. Together with `liststartindex`,\n        `listmaxobjects` can be used to distribute processing over several\n        independent machines if the number of light curves is very large.\n\n    minobservations : int\n        The minimum number of finite LC points required to process a light\n        curve.\n\n    excludeprocessed : bool\n        If this is True, light curves that have existing period-finding result\n        pickles in `outdir` will not be processed.\n\n        FIXME: currently, this uses a dumb method of excluding already-processed\n        files. A smarter way to do this is to (i) generate a SHA512 cachekey\n        based on a repr of `{'lcfile', 'timecols', 'magcols', 'errcols',\n        'lcformat', 'pfmethods', 'sigclip', 'getblssnr', 'pfkwargs'}`, (ii) make\n        sure all list kwargs in the dict are sorted, (iii) check if the output\n        file has the same cachekey in its filename (last 8 chars of cachekey\n        should work), so the result was processed in exactly the same way as\n        specifed in the input to this function, and can therefore be\n        ignored. Will implement this later.\n\n    Returns\n    -------\n\n    list of str\n        A list of the period-finding pickles created for all of input LCs\n        processed.\n\n    '''\n\n    # make the output directory if it doesn't exist\n    if not os.path.exists(arg_1):\n        os.makedirs(arg_1)\n\n    if (arg_14 is not None) and (arg_15 is None):\n        arg_0 = arg_0[arg_14:]\n\n    elif (arg_14 is None) and (arg_15 is not None):\n        arg_0 = arg_0[:arg_15]\n\n    elif (arg_14 is not None) and (arg_15 is not None):\n        arg_0 = arg_0[arg_14:arg_14+arg_15]\n\n    arg_18 = [(x, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6,\n                 arg_7, arg_8, arg_10, arg_9, arg_11,\n                 arg_16,\n                 arg_17)\n                for x in arg_0]\n\n    with ProcessPoolExecutor(max_workers=arg_13) as executor:\n        arg_19 = executor.map(_runpf_worker, arg_18)\n\n    arg_20 = [x for x in arg_19]\n    return arg_20", "path": "astrobase/lcproc/periodsearch.py", "identifier": "parallel_pf", "docstring": "This drives the overall parallel period processing for a list of LCs.\n\n    As a rough benchmark, 25000 HATNet light curves with up to 50000 points per\n    LC take about 26 days in total for an invocation of this function using\n    GLS+PDM+BLS, 10 periodworkers, and 4 controlworkers (so all 40 'cores') on a\n    2 x Xeon E5-2660v3 machine.\n\n    Parameters\n    ----------\n\n    lclist : list of str\n        The list of light curve file to process.\n\n    outdir : str\n        The output directory where the period-finding result pickles will go.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in calculating the features.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in calculating the features.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in calculating the features.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    pfmethods : list of str\n        This is a list of period finding methods to run. Each element is a\n        string matching the keys of the `PFMETHODS` dict above. By default, this\n        runs GLS, PDM, AoVMH, and the spectral window Lomb-Scargle periodogram.\n\n    pfkwargs : list of dicts\n        This is used to provide any special kwargs as dicts to each\n        period-finding method function specified in `pfmethods`.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    getblssnr : bool\n        If this is True and BLS is one of the methods specified in `pfmethods`,\n        will also calculate the stats for each best period in the BLS results:\n        transit depth, duration, ingress duration, refit period and epoch, and\n        the SNR of the transit.\n\n    nperiodworkers : int\n        The number of parallel period-finding workers to launch per object task.\n\n    ncontrolworkers : int\n        The number of controlling processes to launch. This effectively sets how\n        many objects from `lclist` will be processed in parallel.\n\n    liststartindex : int or None\n        This sets the index from where to start in `lclist`.\n\n    listmaxobjects : int or None\n        This sets the maximum number of objects in `lclist` to run\n        period-finding for in this invocation. Together with `liststartindex`,\n        `listmaxobjects` can be used to distribute processing over several\n        independent machines if the number of light curves is very large.\n\n    minobservations : int\n        The minimum number of finite LC points required to process a light\n        curve.\n\n    excludeprocessed : bool\n        If this is True, light curves that have existing period-finding result\n        pickles in `outdir` will not be processed.\n\n        FIXME: currently, this uses a dumb method of excluding already-processed\n        files. A smarter way to do this is to (i) generate a SHA512 cachekey\n        based on a repr of `{'lcfile', 'timecols', 'magcols', 'errcols',\n        'lcformat', 'pfmethods', 'sigclip', 'getblssnr', 'pfkwargs'}`, (ii) make\n        sure all list kwargs in the dict are sorted, (iii) check if the output\n        file has the same cachekey in its filename (last 8 chars of cachekey\n        should work), so the result was processed in exactly the same way as\n        specifed in the input to this function, and can therefore be\n        ignored. Will implement this later.\n\n    Returns\n    -------\n\n    list of str\n        A list of the period-finding pickles created for all of input LCs\n        processed.", "docstring_tokens": ["This", "drives", "the", "overall", "parallel", "period", "processing", "for", "a", "list", "of", "LCs", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257087}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/utils.py#L11-L36", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Decorator that converts arguments via annotations.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "inspect", ".", "signature", "(", "arg_0", ")", ".", "parameters", ".", "items", "(", ")", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_2", "=", "list", "(", "arg_2", ")", "arg_4", "=", "[", "]", "arg_5", "=", "{", "}", "for", "arg_6", ",", "arg_7", "in", "arg_1", ":", "arg_8", "=", "arg_7", ".", "annotation", "if", "arg_8", "is", "inspect", ".", "_empty", ":", "arg_8", "=", "lambda", "arg_10", ":", "arg_10", "if", "arg_7", ".", "kind", "is", "arg_7", ".", "POSITIONAL_OR_KEYWORD", ":", "if", "arg_2", ":", "arg_9", "=", "arg_2", ".", "pop", "(", "0", ")", "arg_4", ".", "append", "(", "arg_8", "(", "arg_9", ")", ")", "elif", "arg_7", ".", "kind", "is", "arg_7", ".", "VAR_POSITIONAL", ":", "for", "arg_10", "in", "arg_2", ":", "arg_4", ".", "append", "(", "arg_8", "(", "arg_10", ")", ")", "else", ":", "for", "arg_11", ",", "arg_12", "in", "arg_3", ".", "items", "(", ")", ":", "arg_13", ",", "arg_14", "=", "arg_8", "(", "arg_11", ",", "arg_12", ")", "arg_5", "[", "arg_13", "]", "=", "arg_14", "return", "arg_0", "(", "*", "arg_4", ",", "**", "arg_5", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Decorator that converts arguments via annotations.\"\"\"\n    arg_1 = inspect.signature(arg_0).parameters.items()\n\n    @wraps(arg_0)\n    def wrapper(*arg_2, **arg_3):\n        arg_2 = list(arg_2)\n        arg_4 = []\n        arg_5 = {}\n        for arg_6, arg_7 in arg_1:\n            arg_8 = arg_7.annotation\n            if arg_8 is inspect._empty:\n                arg_8 = lambda arg_10: arg_10  # do nothing\n            if arg_7.kind is arg_7.POSITIONAL_OR_KEYWORD:\n                if arg_2:\n                    arg_9 = arg_2.pop(0)\n                    arg_4.append(arg_8(arg_9))\n            elif arg_7.kind is arg_7.VAR_POSITIONAL:\n                for arg_10 in arg_2:\n                    arg_4.append(arg_8(arg_10))\n            else:\n                for arg_11, arg_12 in arg_3.items():\n                    arg_13, arg_14 = arg_8(arg_11, arg_12)\n                    arg_5[arg_13] = arg_14\n        return arg_0(*arg_4, **arg_5)\n    return wrapper", "path": "clashroyale/official_api/utils.py", "identifier": "typecasted", "docstring": "Decorator that converts arguments via annotations.", "docstring_tokens": ["Decorator", "that", "converts", "arguments", "via", "annotations", "."], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 257088}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/stepper/main.py#L298-L318", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "stpd generation using Stepper class", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"Making stpd-file: %s\"", ",", "arg_0", ".", "stpd", ")", "arg_1", "=", "Stepper", "(", "arg_0", ".", "core", ",", "rps_schedule", "=", "arg_0", ".", "load_profile", ".", "schedule", "if", "arg_0", ".", "load_profile", ".", "is_rps", "(", ")", "else", "None", ",", "http_ver", "=", "arg_0", ".", "http_ver", ",", "ammo_file", "=", "arg_0", ".", "ammo_file", ",", "instances_schedule", "=", "arg_0", ".", "load_profile", ".", "schedule", "if", "arg_0", ".", "load_profile", ".", "is_instances", "(", ")", "else", "None", ",", "instances", "=", "arg_0", ".", "instances", ",", "loop_limit", "=", "arg_0", ".", "loop_limit", ",", "ammo_limit", "=", "arg_0", ".", "ammo_limit", ",", "uris", "=", "arg_0", ".", "uris", ",", "headers", "=", "[", "header", ".", "strip", "(", "'[]'", ")", "for", "header", "in", "arg_0", ".", "headers", "]", ",", "autocases", "=", "arg_0", ".", "autocases", ",", "enum_ammo", "=", "arg_0", ".", "enum_ammo", ",", "ammo_type", "=", "arg_0", ".", "ammo_type", ",", "chosen_cases", "=", "arg_0", ".", "chosen_cases", ",", "use_cache", "=", "arg_0", ".", "use_caching", ")", "with", "open", "(", "arg_0", ".", "stpd", ",", "'w'", ",", "arg_0", ".", "file_cache", ")", "as", "os", ":", "arg_1", ".", "write", "(", "os", ")"], "function": "def Func(arg_0):\n        ''' stpd generation using Stepper class '''\n        arg_0.log.info(\"Making stpd-file: %s\", arg_0.stpd)\n        arg_1 = Stepper(\n            arg_0.core,\n            rps_schedule=arg_0.load_profile.schedule if arg_0.load_profile.is_rps() else None,\n            http_ver=arg_0.http_ver,\n            ammo_file=arg_0.ammo_file,\n            instances_schedule=arg_0.load_profile.schedule if arg_0.load_profile.is_instances() else None,\n            instances=arg_0.instances,\n            loop_limit=arg_0.loop_limit,\n            ammo_limit=arg_0.ammo_limit,\n            uris=arg_0.uris,\n            headers=[header.strip('[]') for header in arg_0.headers],\n            autocases=arg_0.autocases,\n            enum_ammo=arg_0.enum_ammo,\n            ammo_type=arg_0.ammo_type,\n            chosen_cases=arg_0.chosen_cases,\n            use_cache=arg_0.use_caching)\n        with open(arg_0.stpd, 'w', arg_0.file_cache) as os:\n            arg_1.write(os)", "path": "yandextank/stepper/main.py", "identifier": "StepperWrapper.__make_stpd_file", "docstring": "stpd generation using Stepper class", "docstring_tokens": ["stpd", "generation", "using", "Stepper", "class"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 257089}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L941-L1009", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return all tags with the given name.", "language": "python", "parameters": "(self, name=None)", "return_statement": "return sorted(tags, key=attrgetter('_span'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", "->", "List", "[", "'Tag'", "]", ":", "arg_2", "=", "arg_0", ".", "_lststr", "arg_3", "=", "arg_0", ".", "_type_to_spans", "if", "arg_1", ":", "if", "arg_1", "in", "_tag_extensions", ":", "arg_4", "=", "arg_2", "[", "0", "]", "return", "[", "Tag", "(", "arg_2", ",", "arg_3", ",", "arg_5", ",", "'ExtensionTag'", ")", "for", "arg_5", "in", "arg_3", "[", "'ExtensionTag'", "]", "if", "arg_4", ".", "startswith", "(", "'<'", "+", "arg_1", ",", "arg_5", "[", "0", "]", ")", "]", "Func", "=", "[", "]", "else", ":", "Func", "=", "[", "Tag", "(", "arg_2", ",", "arg_3", ",", "arg_5", ",", "'ExtensionTag'", ")", "for", "arg_5", "in", "arg_3", "[", "'ExtensionTag'", "]", "]", "arg_7", "=", "Func", ".", "append", "arg_8", "=", "arg_0", ".", "_span", "[", "0", "]", "arg_9", "=", "arg_0", ".", "_shadow", "if", "arg_1", ":", "arg_10", "=", "reversed", "(", "[", "m", "for", "m", "in", "regex_compile", "(", "START_TAG_PATTERN", ".", "replace", "(", "rb'{name}'", ",", "rb'(?P<name>'", "+", "arg_1", ".", "encode", "(", ")", "+", "rb')'", ")", ")", ".", "finditer", "(", "arg_9", ")", "]", ")", "arg_11", "=", "regex_compile", "(", "END_TAG_PATTERN", ".", "replace", "(", "b'{name}'", ",", "arg_1", ".", "encode", "(", ")", ")", ")", ".", "search", "else", ":", "arg_10", "=", "reversed", "(", "[", "m", "for", "m", "in", "START_TAG_FINDITER", "(", "arg_9", ")", "]", ")", "arg_12", "=", "arg_9", "[", ":", "]", "arg_13", "=", "arg_3", ".", "setdefault", "(", "'Tag'", ",", "[", "]", ")", "arg_14", "=", "{", "(", "arg_17", "[", "0", "]", ",", "arg_17", "[", "1", "]", ")", ":", "arg_17", "for", "arg_17", "in", "arg_13", "}", ".", "get", "arg_15", "=", "arg_13", ".", "append", "for", "arg_16", "in", "arg_10", ":", "if", "arg_16", "[", "'self_closing'", "]", ":", "arg_17", ",", "arg_18", "=", "arg_16", ".", "span", "(", ")", "arg_5", "=", "[", "arg_8", "+", "arg_17", ",", "arg_8", "+", "arg_18", "]", "else", ":", "if", "arg_1", ":", "arg_19", "=", "arg_11", "(", "arg_12", ",", "arg_16", ".", "end", "(", ")", ")", "else", ":", "arg_19", "=", "search", "(", "END_TAG_PATTERN", ".", "replace", "(", "b'{name}'", ",", "arg_16", "[", "'name'", "]", ")", ",", "arg_12", ")", "if", "arg_19", ":", "arg_17", ",", "arg_18", "=", "arg_19", ".", "span", "(", ")", "arg_12", "[", "arg_17", ":", "arg_18", "]", "=", "b'_'", "*", "(", "arg_18", "-", "arg_17", ")", "arg_5", "=", "[", "arg_8", "+", "arg_16", ".", "start", "(", ")", ",", "arg_8", "+", "arg_18", "]", "else", ":", "arg_17", ",", "arg_18", "=", "arg_16", ".", "span", "(", ")", "arg_5", "=", "[", "arg_8", "+", "arg_17", ",", "arg_8", "+", "arg_18", "]", "arg_20", "=", "arg_14", "(", "(", "arg_5", "[", "0", "]", ",", "arg_5", "[", "1", "]", ")", ")", "if", "arg_20", "is", "None", ":", "arg_15", "(", "arg_5", ")", "else", ":", "arg_5", "=", "arg_20", "arg_7", "(", "Tag", "(", "arg_2", ",", "arg_3", ",", "arg_5", ",", "'Tag'", ")", ")", "return", "sorted", "(", "Func", ",", "key", "=", "attrgetter", "(", "'_span'", ")", ")"], "function": "def Func(arg_0, arg_1=None) -> List['Tag']:\n        \"\"\"Return all tags with the given name.\"\"\"\n        arg_2 = arg_0._lststr\n        arg_3 = arg_0._type_to_spans\n        if arg_1:\n            if arg_1 in _tag_extensions:\n                arg_4 = arg_2[0]\n                return [\n                    Tag(arg_2, arg_3, arg_5, 'ExtensionTag')\n                    for arg_5 in arg_3['ExtensionTag']\n                    if arg_4.startswith('<' + arg_1, arg_5[0])]\n            Func = []  # type: List['Tag']\n        else:\n            # There is no name, add all extension tags. Before using shadow.\n            Func = [\n                Tag(arg_2, arg_3, arg_5, 'ExtensionTag')\n                for arg_5 in arg_3['ExtensionTag']]\n        arg_7 = Func.append\n        # Get the left-most start tag, match it to right-most end tag\n        # and so on.\n        arg_8 = arg_0._span[0]\n        arg_9 = arg_0._shadow\n        if arg_1:\n            # There is a name but it is not in TAG_EXTENSIONS.\n            arg_10 = reversed([m for m in regex_compile(\n                START_TAG_PATTERN.replace(\n                    rb'{name}', rb'(?P<name>' + arg_1.encode() + rb')')\n            ).finditer(arg_9)])\n            arg_11 = regex_compile(END_TAG_PATTERN .replace(\n                b'{name}', arg_1.encode())).search\n        else:\n            arg_10 = reversed(\n                [m for m in START_TAG_FINDITER(arg_9)])\n        arg_12 = arg_9[:]\n        arg_13 = arg_3.setdefault('Tag', [])\n        arg_14 = {(arg_17[0], arg_17[1]): arg_17 for arg_17 in arg_13}.get\n        arg_15 = arg_13.append\n        for arg_16 in arg_10:\n            if arg_16['self_closing']:\n                # Don't look for the end tag\n                arg_17, arg_18 = arg_16.span()\n                arg_5 = [arg_8 + arg_17, arg_8 + arg_18]\n            else:\n                # look for the end-tag\n                if arg_1:\n                    # the end_search is already available\n                    # noinspection PyUnboundLocalVariable\n                    arg_19 = arg_11(arg_12, arg_16.end())\n                else:\n                    # build end_search according to start tag name\n                    arg_19 = search(\n                        END_TAG_PATTERN.replace(\n                            b'{name}', arg_16['name']),\n                        arg_12)\n                if arg_19:\n                    arg_17, arg_18 = arg_19.span()\n                    arg_12[arg_17:arg_18] = b'_' * (arg_18 - arg_17)\n                    arg_5 = [arg_8 + arg_16.start(), arg_8 + arg_18]\n                else:\n                    # Assume start-only tag.\n                    arg_17, arg_18 = arg_16.span()\n                    arg_5 = [arg_8 + arg_17, arg_8 + arg_18]\n            arg_20 = arg_14((arg_5[0], arg_5[1]))\n            if arg_20 is None:\n                arg_15(arg_5)\n            else:\n                arg_5 = arg_20\n            arg_7(Tag(arg_2, arg_3, arg_5, 'Tag'))\n        return sorted(Func, key=attrgetter('_span'))", "path": "wikitextparser/_wikitext.py", "identifier": "WikiText.tags", "docstring": "Return all tags with the given name.", "docstring_tokens": ["Return", "all", "tags", "with", "the", "given", "name", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 257090}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L5889-L5921", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Shift Packed Data Right Logical", "language": "python", "parameters": "(cpu, dest, src)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "read", "(", ")", "arg_3", "=", "Operators", ".", "ITEBV", "(", "arg_2", ".", "size", ",", "Operators", ".", "UGT", "(", "arg_3", ",", "63", ")", ",", "64", ",", "arg_3", ")", "arg_3", "=", "Operators", ".", "EXTRACT", "(", "arg_3", ",", "0", ",", "64", ")", "if", "arg_1", ".", "size", "==", "64", ":", "arg_1", ".", "write", "(", "arg_1", ".", "read", "(", ")", ">>", "arg_3", ")", "else", ":", "arg_4", "=", "Operators", ".", "EXTRACT", "(", "arg_1", ".", "read", "(", ")", ",", "64", ",", "64", ")", ">>", "arg_3", "arg_5", "=", "Operators", ".", "EXTRACT", "(", "arg_1", ".", "read", "(", ")", ",", "0", ",", "64", ")", ">>", "arg_3", "arg_1", ".", "write", "(", "Operators", ".", "CONCAT", "(", "128", ",", "arg_4", ",", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Shift Packed Data Right Logical\n\n        Shifts the bits in the individual quadword in the destination operand to the right by\n        the number of bits specified in the count operand . As the bits in the data elements\n        are shifted right, the empty high-order bits are cleared (set to 0). If the value\n        specified by the count operand is greater than  63, then the destination operand is set\n        to all 0s.\n\n        if(OperandSize == 64) {\n                        //Func instruction with 64-bit operand:\n                        if(Count > 63) Destination[64..0] = 0;\n                        else Destination = ZeroExtend(Destination >> Count);\n                }\n                else {\n                        //Func instruction with 128-bit operand:\n                        if(Count > 15) Destination[128..0] = 0;\n                        else {\n                                Destination[0..63] = ZeroExtend(Destination[0..63] >> Count);\n                                Destination[64..127] = ZeroExtend(Destination[64..127] >> Count);\n                        }\n                }\n        \"\"\"\n\n        arg_3 = arg_2.read()\n        arg_3 = Operators.ITEBV(arg_2.size, Operators.UGT(arg_3, 63), 64, arg_3)\n        arg_3 = Operators.EXTRACT(arg_3, 0, 64)\n        if arg_1.size == 64:\n            arg_1.write(arg_1.read() >> arg_3)\n        else:\n            arg_4 = Operators.EXTRACT(arg_1.read(), 64, 64) >> arg_3\n            arg_5 = Operators.EXTRACT(arg_1.read(), 0, 64) >> arg_3\n            arg_1.write(Operators.CONCAT(128, arg_4, arg_5))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.PSRLQ", "docstring": "Shift Packed Data Right Logical\n\n        Shifts the bits in the individual quadword in the destination operand to the right by\n        the number of bits specified in the count operand . As the bits in the data elements\n        are shifted right, the empty high-order bits are cleared (set to 0). If the value\n        specified by the count operand is greater than  63, then the destination operand is set\n        to all 0s.\n\n        if(OperandSize == 64) {\n                        //PSRLQ instruction with 64-bit operand:\n                        if(Count > 63) Destination[64..0] = 0;\n                        else Destination = ZeroExtend(Destination >> Count);\n                }\n                else {\n                        //PSRLQ instruction with 128-bit operand:\n                        if(Count > 15) Destination[128..0] = 0;\n                        else {\n                                Destination[0..63] = ZeroExtend(Destination[0..63] >> Count);\n                                Destination[64..127] = ZeroExtend(Destination[64..127] >> Count);\n                        }\n                }", "docstring_tokens": ["Shift", "Packed", "Data", "Right", "Logical"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257091}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/serialize/canning.py#L41-L56", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Decorator for making functions appear as interactively defined.", "language": "python", "parameters": "(f)", "return_statement": "return f", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "FunctionType", ")", ":", "arg_1", "=", "__import__", "(", "'__main__'", ")", "arg_0", "=", "FunctionType", "(", "arg_0", ".", "__code__", ",", "arg_1", ".", "__dict__", ",", "arg_0", ".", "__name__", ",", "arg_0", ".", "__defaults__", ",", ")", "arg_0", ".", "__module__", "=", "'__main__'", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Decorator for making functions appear as Funcly defined.\n\n    This results in the function being linked to the user_ns as globals()\n    instead of the module globals().\n    \"\"\"\n    # build new FunctionType, so it can have the right globals\n    # Func functions never have closures, that's kind of the point\n    if isinstance(arg_0, FunctionType):\n        arg_1 = __import__('__main__')\n        arg_0 = FunctionType(arg_0.__code__, arg_1.__dict__,\n                         arg_0.__name__, arg_0.__defaults__,\n                         )\n    # associate with __main__ for uncanning\n    arg_0.__module__ = '__main__'\n    return arg_0", "path": "parsl/executors/serialize/canning.py", "identifier": "interactive", "docstring": "Decorator for making functions appear as interactively defined.\n\n    This results in the function being linked to the user_ns as globals()\n    instead of the module globals().", "docstring_tokens": ["Decorator", "for", "making", "functions", "appear", "as", "interactively", "defined", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 257092}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/crypto/types.py#L207-L296", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Signs the inputs starting at the specified index.", "language": "python", "parameters": "(self, bundle, start_index)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", ".", "hash", ":", "raise", "with_context", "(", "exc", "=", "ValueError", "(", "'Cannot sign inputs without a bundle hash!'", ")", ",", "context", "=", "{", "'bundle'", ":", "arg_1", ",", "'key_index'", ":", "arg_0", ".", "key_index", ",", "'start_index'", ":", "arg_2", ",", "}", ",", ")", "from", "iota", ".", "crypto", ".", "signing", "import", "SignatureFragmentGenerator", "arg_3", "=", "(", "SignatureFragmentGenerator", "(", "arg_0", ",", "arg_1", ".", "hash", ")", ")", "for", "arg_4", "in", "range", "(", "arg_0", ".", "security_level", ")", ":", "try", ":", "arg_5", "=", "arg_1", "[", "arg_2", "+", "arg_4", "]", "except", "IndexError", "as", "e", ":", "raise", "with_context", "(", "exc", "=", "e", ",", "context", "=", "{", "'bundle'", ":", "arg_1", ",", "'key_index'", ":", "arg_0", ".", "key_index", ",", "'current_index'", ":", "arg_2", "+", "arg_4", ",", "}", ",", ")", "if", "arg_5", ".", "value", ">", "0", ":", "raise", "with_context", "(", "exc", "=", "ValueError", "(", "'Attempting to sign non-input transaction #{i} '", "'(value={value}).'", ".", "format", "(", "i", "=", "arg_5", ".", "current_index", ",", "value", "=", "arg_5", ".", "value", ",", ")", ",", ")", ",", "context", "=", "{", "'bundle'", ":", "arg_1", ",", "'key_index'", ":", "arg_0", ".", "key_index", ",", "'start_index'", ":", "arg_2", ",", "}", ",", ")", "if", "arg_5", ".", "signature_message_fragment", ":", "raise", "with_context", "(", "exc", "=", "ValueError", "(", "'Attempting to sign input transaction #{i}, '", "'but it has a non-empty fragment '", "'(is it already signed?).'", ".", "format", "(", "i", "=", "arg_5", ".", "current_index", ",", ")", ",", ")", ",", "context", "=", "{", "'bundle'", ":", "arg_1", ",", "'key_index'", ":", "arg_0", ".", "key_index", ",", "'start_index'", ":", "arg_2", ",", "}", ",", ")", "arg_5", ".", "signature_message_fragment", "=", "next", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        # type: (Bundle, int) -> None\n        \"\"\"\n        Signs the inputs starting at the specified index.\n\n        :param bundle:\n            The bundle that contains the input transactions to sign.\n\n        :param start_index:\n            The index of the first input transaction.\n\n            If necessary, the resulting signature will be split across\n            subsequent transactions automatically.\n        \"\"\"\n\n        if not arg_1.hash:\n            raise with_context(\n                exc=ValueError('Cannot sign inputs without a bundle hash!'),\n\n                context={\n                    'bundle': arg_1,\n                    'key_index': arg_0.key_index,\n                    'start_index': arg_2,\n                },\n            )\n\n        from iota.crypto.signing import SignatureFragmentGenerator\n        arg_3 = (\n            SignatureFragmentGenerator(arg_0, arg_1.hash)\n        )\n\n        # We can only fit one signature fragment into each transaction,\n        # so we have to split the entire signature.\n        for arg_4 in range(arg_0.security_level):\n            # Do lots of validation before we attempt to sign the\n            # transaction, and attach lots of context info to any\n            # exception.\n            #\n            # This method is likely to be invoked at a very low level in\n            # the application, so if anything goes wrong, we want to\n            # make sure it's as easy to troubleshoot as possible!\n            try:\n                arg_5 = arg_1[arg_2 + arg_4]\n            except IndexError as e:\n                raise with_context(\n                    exc=e,\n\n                    context={\n                        'bundle': arg_1,\n                        'key_index': arg_0.key_index,\n                        'current_index': arg_2 + arg_4,\n                    },\n                )\n\n            # Only inputs can be signed.\n            if arg_5.value > 0:\n                raise with_context(\n                    exc=ValueError(\n                        'Attempting to sign non-input transaction #{i} '\n                        '(value={value}).'.format(\n                            i=arg_5.current_index,\n                            value=arg_5.value,\n                        ),\n                    ),\n\n                    context={\n                        'bundle': arg_1,\n                        'key_index': arg_0.key_index,\n                        'start_index': arg_2,\n                    },\n                )\n\n            if arg_5.signature_message_fragment:\n                raise with_context(\n                    exc=ValueError(\n                        'Attempting to sign input transaction #{i}, '\n                        'but it has a non-empty fragment '\n                        '(is it already signed?).'.format(\n                            i=arg_5.current_index,\n                        ),\n                    ),\n\n                    context={\n                        'bundle': arg_1,\n                        'key_index': arg_0.key_index,\n                        'start_index': arg_2,\n                    },\n                )\n\n            arg_5.signature_message_fragment = next(arg_3)", "path": "iota/crypto/types.py", "identifier": "PrivateKey.sign_input_transactions", "docstring": "Signs the inputs starting at the specified index.\n\n        :param bundle:\n            The bundle that contains the input transactions to sign.\n\n        :param start_index:\n            The index of the first input transaction.\n\n            If necessary, the resulting signature will be split across\n            subsequent transactions automatically.", "docstring_tokens": ["Signs", "the", "inputs", "starting", "at", "the", "specified", "index", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 257093}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/memory.py#L1332-L1363", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Scan for concrete bytes in all mapped memory. Successively yield addresses of all matches.", "language": "python", "parameters": "(self, data_to_find)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "arg_1", "=", "[", "bytes", "(", "[", "c", "]", ")", "for", "c", "in", "arg_1", "]", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "maps", ")", ":", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "+", "len", "(", "arg_1", ")", ">=", "arg_2", ".", "end", ":", "break", "arg_4", "=", "arg_2", "[", "arg_3", ":", "arg_3", "+", "len", "(", "arg_1", ")", "]", "if", "issymbolic", "(", "arg_4", "[", "0", "]", ")", ":", "break", "if", "arg_4", "==", "arg_1", ":", "yield", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Scan for concrete bytes in all mapped memory. Successively yield addresses of all matches.\n\n        :param bytes data_to_find: String to locate\n        :return:\n        \"\"\"\n\n        # TODO: for the moment we just treat symbolic bytes as bytes that don't match.\n        # for our simple test cases right now, the bytes we're interested in scanning\n        # for will all just be there concretely\n        # TODO: Can probably do something smarter here like Boyer-Moore, but unnecessary\n        # if we're looking for short strings.\n\n        # Querying mem with an index returns [bytes]\n        if isinstance(arg_1, bytes):\n            arg_1 = [bytes([c]) for c in arg_1]\n\n        for arg_2 in sorted(arg_0.maps):\n            for arg_3 in arg_2:\n                if arg_3 + len(arg_1) >= arg_2.end:\n                    break\n\n                arg_4 = arg_2[arg_3:arg_3 + len(arg_1)]\n\n                # TODO: treat symbolic bytes as bytes that don't match. for our simple tests right now, the\n                # bytes will be there concretely\n                if issymbolic(arg_4[0]):\n                    break\n\n                if arg_4 == arg_1:\n                    yield arg_3", "path": "manticore/native/memory.py", "identifier": "LazySMemory.scan_mem", "docstring": "Scan for concrete bytes in all mapped memory. Successively yield addresses of all matches.\n\n        :param bytes data_to_find: String to locate\n        :return:", "docstring_tokens": ["Scan", "for", "concrete", "bytes", "in", "all", "mapped", "memory", ".", "Successively", "yield", "addresses", "of", "all", "matches", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257094}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/io/cnf.py#L29-L95", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "Load a constraint satisfaction problem from a .cnf file.", "language": "python", "parameters": "(fp)", "return_statement": "return csp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "iter", "(", "arg_0", ")", "arg_1", "=", "ConstraintSatisfactionProblem", "(", "dimod", ".", "BINARY", ")", "arg_2", "=", "arg_8", "=", "0", "arg_3", "=", "re", ".", "compile", "(", "_PROBLEM_REGEX", ")", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "arg_3", ".", "findall", "(", "arg_4", ")", "if", "arg_5", ":", "if", "len", "(", "arg_5", ")", ">", "1", ":", "raise", "ValueError", "arg_6", ",", "arg_7", "=", "arg_5", "[", "0", "]", "arg_8", ",", "arg_2", "=", "int", "(", "arg_6", ")", ",", "int", "(", "arg_7", ")", "break", "arg_9", "=", "re", ".", "compile", "(", "_CLAUSE_REGEX", ")", "for", "arg_4", "in", "arg_0", ":", "if", "arg_9", ".", "match", "(", "arg_4", ")", "is", "not", "None", ":", "arg_10", "=", "[", "int", "(", "arg_13", ")", "for", "arg_13", "in", "arg_4", ".", "split", "(", "' '", ")", "[", ":", "-", "1", "]", "]", "arg_11", "=", "[", "abs", "(", "arg_13", ")", "for", "arg_13", "in", "arg_10", "]", "arg_12", "=", "_cnf_or", "(", "arg_10", ")", "arg_1", ".", "add_constraint", "(", "arg_12", ",", "arg_11", ")", "for", "arg_13", "in", "range", "(", "1", ",", "arg_8", "+", "1", ")", ":", "arg_1", ".", "add_variable", "(", "arg_13", ")", "for", "arg_13", "in", "arg_1", ".", "variables", ":", "if", "arg_13", ">", "arg_8", ":", "arg_14", "=", "(", "\"given .cnf file's header defines variables [1, {}] and {} clauses \"", "\"but constraints a reference to variable {}\"", ")", ".", "format", "(", "arg_8", ",", "arg_2", ",", "arg_13", ")", "raise", "ValueError", "(", "arg_14", ")", "if", "len", "(", "arg_1", ")", "!=", "arg_2", ":", "arg_14", "=", "(", "\"given .cnf file's header defines {} \"", "\"clauses but the file contains {}\"", ")", ".", "format", "(", "arg_2", ",", "len", "(", "arg_1", ")", ")", "raise", "ValueError", "(", "arg_14", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Load a constraint satisfaction problem from a .cnf file.\n\n    Args:\n        fp (file, optional):\n            `.write()`-supporting `file object`_ DIMACS CNF formatted_ file.\n\n    Returns:\n        :obj:`.ConstraintSatisfactionProblem` a binary-valued SAT problem.\n\n    Examples:\n\n        >>> import dwavebinarycsp as dbcsp\n        ...\n        >>> with open('test.cnf', 'r') as fp: # doctest: +SKIP\n        ...     csp = dbcsp.cnf.Func(fp)\n\n    .. _file object: https://docs.python.org/3/glossary.html#term-file-object\n\n    .. _formatted: http://www.satcompetition.org/2009/format-benchmarks2009.html\n\n\n    \"\"\"\n\n    arg_0 = iter(arg_0)  # handle lists/tuples/etc\n\n    arg_1 = ConstraintSatisfactionProblem(dimod.BINARY)\n\n    # first look for the problem\n    arg_2 = arg_8 = 0\n    arg_3 = re.compile(_PROBLEM_REGEX)\n    for arg_4 in arg_0:\n        arg_5 = arg_3.findall(arg_4)\n        if arg_5:\n            if len(arg_5) > 1:\n                raise ValueError\n            arg_6, arg_7 = arg_5[0]\n            arg_8, arg_2 = int(arg_6), int(arg_7)\n            break\n\n    # now parse the clauses, picking up where we left off looking for the header\n    arg_9 = re.compile(_CLAUSE_REGEX)\n    for arg_4 in arg_0:\n        if arg_9.match(arg_4) is not None:\n            arg_10 = [int(arg_13) for arg_13 in arg_4.split(' ')[:-1]]  # line ends with a trailing 0\n\n            # -1 is the notation for NOT(1)\n            arg_11 = [abs(arg_13) for arg_13 in arg_10]\n\n            arg_12 = _cnf_or(arg_10)\n\n            arg_1.add_constraint(arg_12, arg_11)\n\n    for arg_13 in range(1, arg_8+1):\n        arg_1.add_variable(arg_13)\n    for arg_13 in arg_1.variables:\n        if arg_13 > arg_8:\n            arg_14 = (\"given .cnf file's header defines variables [1, {}] and {} clauses \"\n                   \"but constraints a reference to variable {}\").format(arg_8, arg_2, arg_13)\n            raise ValueError(arg_14)\n\n    if len(arg_1) != arg_2:\n        arg_14 = (\"given .cnf file's header defines {} \"\n               \"clauses but the file contains {}\").format(arg_2, len(arg_1))\n        raise ValueError(arg_14)\n\n    return arg_1", "path": "dwavebinarycsp/io/cnf.py", "identifier": "load_cnf", "docstring": "Load a constraint satisfaction problem from a .cnf file.\n\n    Args:\n        fp (file, optional):\n            `.write()`-supporting `file object`_ DIMACS CNF formatted_ file.\n\n    Returns:\n        :obj:`.ConstraintSatisfactionProblem` a binary-valued SAT problem.\n\n    Examples:\n\n        >>> import dwavebinarycsp as dbcsp\n        ...\n        >>> with open('test.cnf', 'r') as fp: # doctest: +SKIP\n        ...     csp = dbcsp.cnf.load_cnf(fp)\n\n    .. _file object: https://docs.python.org/3/glossary.html#term-file-object\n\n    .. _formatted: http://www.satcompetition.org/2009/format-benchmarks2009.html", "docstring_tokens": ["Load", "a", "constraint", "satisfaction", "problem", "from", "a", ".", "cnf", "file", "."], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 257095}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/audio.py#L212-L246", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Force an audio signal down to mono.", "language": "python", "parameters": "(y)", "return_statement": "return y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "util", ".", "valid_audio", "(", "arg_0", ",", "mono", "=", "False", ")", "if", "arg_0", ".", "ndim", ">", "1", ":", "arg_0", "=", "np", ".", "mean", "(", "arg_0", ",", "axis", "=", "0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    '''Force an audio signal down to mono.\n\n    Parameters\n    ----------\n    y : np.ndarray [shape=(2,n) or shape=(n,)]\n        audio time series, either stereo or mono\n\n    Returns\n    -------\n    y_mono : np.ndarray [shape=(n,)]\n        `y` as a monophonic time-series\n\n    Notes\n    -----\n    This function caches at level 20.\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), mono=False)\n    >>> y.shape\n    (2, 1355168)\n    >>> y_mono = librosa.Func(y)\n    >>> y_mono.shape\n    (1355168,)\n\n    '''\n\n    # Validate the buffer.  Stereo is ok here.\n    util.valid_audio(arg_0, mono=False)\n\n    if arg_0.ndim > 1:\n        arg_0 = np.mean(arg_0, axis=0)\n\n    return arg_0", "path": "librosa/core/audio.py", "identifier": "to_mono", "docstring": "Force an audio signal down to mono.\n\n    Parameters\n    ----------\n    y : np.ndarray [shape=(2,n) or shape=(n,)]\n        audio time series, either stereo or mono\n\n    Returns\n    -------\n    y_mono : np.ndarray [shape=(n,)]\n        `y` as a monophonic time-series\n\n    Notes\n    -----\n    This function caches at level 20.\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), mono=False)\n    >>> y.shape\n    (2, 1355168)\n    >>> y_mono = librosa.to_mono(y)\n    >>> y_mono.shape\n    (1355168,)", "docstring_tokens": ["Force", "an", "audio", "signal", "down", "to", "mono", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 257096}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L411-L448", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "standalone command line access point", "language": "python", "parameters": "(argv=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "sys", ".", "argv", "[", "1", ":", "]", "from", "getopt", "import", "getopt", "arg_1", "=", "\"hdi\"", "arg_2", "=", "(", "\"help\"", ",", "\"duplicates=\"", ",", "\"ignore-comments\"", ",", "\"ignore-imports\"", ",", "\"ignore-docstrings\"", ",", ")", "arg_3", "=", "4", "arg_4", "=", "False", "arg_5", "=", "False", "arg_6", "=", "False", "arg_7", ",", "arg_8", "=", "getopt", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "for", "arg_9", ",", "arg_10", "in", "arg_7", ":", "if", "arg_9", "in", "(", "\"-d\"", ",", "\"--duplicates\"", ")", ":", "arg_3", "=", "int", "(", "arg_10", ")", "elif", "arg_9", "in", "(", "\"-h\"", ",", "\"--help\"", ")", ":", "usage", "(", ")", "elif", "arg_9", "in", "(", "\"-i\"", ",", "\"--ignore-comments\"", ")", ":", "arg_4", "=", "True", "elif", "arg_9", "in", "(", "\"--ignore-docstrings\"", ",", ")", ":", "arg_5", "=", "True", "elif", "arg_9", "in", "(", "\"--ignore-imports\"", ",", ")", ":", "arg_6", "=", "True", "if", "not", "arg_8", ":", "usage", "(", "1", ")", "arg_11", "=", "Similar", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "for", "arg_12", "in", "arg_8", ":", "with", "open", "(", "arg_12", ")", "as", "stream", ":", "arg_11", ".", "append_stream", "(", "arg_12", ",", "stream", ")", "arg_11", ".", "run", "(", ")", "sys", ".", "exit", "(", "0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"standalone command line access point\"\"\"\n    if arg_0 is None:\n        arg_0 = sys.argv[1:]\n    from getopt import getopt\n\n    arg_1 = \"hdi\"\n    arg_2 = (\n        \"help\",\n        \"duplicates=\",\n        \"ignore-comments\",\n        \"ignore-imports\",\n        \"ignore-docstrings\",\n    )\n    arg_3 = 4\n    arg_4 = False\n    arg_5 = False\n    arg_6 = False\n    arg_7, arg_8 = getopt(arg_0, arg_1, arg_2)\n    for arg_9, arg_10 in arg_7:\n        if arg_9 in (\"-d\", \"--duplicates\"):\n            arg_3 = int(arg_10)\n        elif arg_9 in (\"-h\", \"--help\"):\n            usage()\n        elif arg_9 in (\"-i\", \"--ignore-comments\"):\n            arg_4 = True\n        elif arg_9 in (\"--ignore-docstrings\",):\n            arg_5 = True\n        elif arg_9 in (\"--ignore-imports\",):\n            arg_6 = True\n    if not arg_8:\n        usage(1)\n    arg_11 = Similar(arg_3, arg_4, arg_5, arg_6)\n    for arg_12 in arg_8:\n        with open(arg_12) as stream:\n            arg_11.append_stream(arg_12, stream)\n    arg_11.run()\n    sys.exit(0)", "path": "pylint/checkers/similar.py", "identifier": "Run", "docstring": "standalone command line access point", "docstring_tokens": ["standalone", "command", "line", "access", "point"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257097}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L30-L39", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Reads configuration, returns a ConfigParser object.", "language": "python", "parameters": "()", "return_statement": "return config_file, cf", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "pkgrs", ".", "resource_filename", "(", "'latools'", ",", "'latools.cfg'", ")", "arg_1", "=", "configparser", ".", "ConfigParser", "(", ")", "arg_1", ".", "read", "(", "arg_0", ")", "return", "arg_0", ",", "arg_1"], "function": "def Func():\n    \"\"\"\n    Reads configuration, returns a ConfigParser object.\n\n    Distinct from read_configuration, which returns a dict.\n    \"\"\"\n    arg_0 = pkgrs.resource_filename('latools', 'latools.cfg')\n    arg_1 = configparser.ConfigParser()\n    arg_1.read(arg_0)\n    return arg_0, arg_1", "path": "latools/helpers/config.py", "identifier": "read_latoolscfg", "docstring": "Reads configuration, returns a ConfigParser object.\n\n    Distinct from read_configuration, which returns a dict.", "docstring_tokens": ["Reads", "configuration", "returns", "a", "ConfigParser", "object", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257098}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/results.py#L148-L151", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "How many total branches are there?", "language": "python", "parameters": "(self)", "return_statement": "return sum([count for count in exit_counts.values() if count > 1])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "parser", ".", "exit_counts", "(", ")", "return", "sum", "(", "[", "arg_2", "for", "arg_2", "in", "arg_1", ".", "values", "(", ")", "if", "arg_2", ">", "1", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"How many total branches are there?\"\"\"\n        arg_1 = arg_0.parser.exit_counts()\n        return sum([arg_2 for arg_2 in arg_1.values() if arg_2 > 1])", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/results.py", "identifier": "Analysis.total_branches", "docstring": "How many total branches are there?", "docstring_tokens": ["How", "many", "total", "branches", "are", "there?"], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 257099}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L531-L538", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Get URL to allow others to join a group conversation.", "language": "python", "parameters": "(self,\n                                         get_group_conversation_url_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "GetGroupConversationUrlResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'conversations/getgroupconversationurl'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0,\n                                         arg_1):\n        \"\"\"Get URL to allow others to join a group conversation.\"\"\"\n        arg_2 = hangouts_pb2.GetGroupConversationUrlResponse()\n        await arg_0._pb_request('conversations/getgroupconversationurl',\n                               arg_1,\n                               arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.get_group_conversation_url", "docstring": "Get URL to allow others to join a group conversation.", "docstring_tokens": ["Get", "URL", "to", "allow", "others", "to", "join", "a", "group", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 257100}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L314-L320", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Prepare persistent identifiers.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "pids", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "pid_fetchers", ":", "arg_3", "=", "arg_2", "(", "None", ",", "arg_0", ".", "revisions", "[", "-", "1", "]", "[", "1", "]", ")", "if", "arg_3", ":", "arg_0", ".", "pids", ".", "append", "(", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"Prepare persistent identifiers.\"\"\"\n        arg_0.pids = []\n        for arg_2 in arg_0.pid_fetchers:\n            arg_3 = arg_2(None, arg_0.revisions[-1][1])\n            if arg_3:\n                arg_0.pids.append(arg_3)", "path": "invenio_migrator/records.py", "identifier": "RecordDump.prepare_pids", "docstring": "Prepare persistent identifiers.", "docstring_tokens": ["Prepare", "persistent", "identifiers", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 257101}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L400-L421", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Translates a tile in the padded image to the unpadded image.", "language": "python", "parameters": "(st, padded_tile)", "return_statement": "return inner_tile.translate(-st.pad)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "ishape", ".", "intersection", "(", "[", "arg_0", ".", "ishape", ",", "arg_1", "]", ")", "return", "arg_2", ".", "translate", "(", "-", "arg_0", ".", "pad", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Translates a tile in the padded image to the unpadded image.\n\n    Given a state and a tile that corresponds to the padded image, returns\n    a tile that corresponds to the the corresponding pixels of the difference\n    image\n\n    Parameters\n    ----------\n        st : :class:`peri.states.State`\n            The state\n        padded_tile : :class:`peri.util.Tile`\n            The tile in the padded image.\n\n    Returns\n    -------\n        :class:`peri.util.Tile`\n            The tile corresponding to padded_tile in the unpadded image.\n    \"\"\"\n    arg_2 = arg_0.ishape.intersection([arg_0.ishape, arg_1])\n    return arg_2.translate(-arg_0.pad)", "path": "peri/opt/optimize.py", "identifier": "get_residuals_update_tile", "docstring": "Translates a tile in the padded image to the unpadded image.\n\n    Given a state and a tile that corresponds to the padded image, returns\n    a tile that corresponds to the the corresponding pixels of the difference\n    image\n\n    Parameters\n    ----------\n        st : :class:`peri.states.State`\n            The state\n        padded_tile : :class:`peri.util.Tile`\n            The tile in the padded image.\n\n    Returns\n    -------\n        :class:`peri.util.Tile`\n            The tile corresponding to padded_tile in the unpadded image.", "docstring_tokens": ["Translates", "a", "tile", "in", "the", "padded", "image", "to", "the", "unpadded", "image", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 257102}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L41-L58", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform a QuantumChannel to the SuperOp representation.", "language": "python", "parameters": "(rep, data, input_dim, output_dim)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", "==", "'SuperOp'", ":", "return", "arg_1", "if", "arg_0", "==", "'Operator'", ":", "return", "_from_operator", "(", "'SuperOp'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "==", "'Choi'", ":", "return", "_choiFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "==", "'Kraus'", ":", "return", "_krausFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "==", "'Chi'", ":", "arg_1", "=", "_chi_to_choi", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "_choiFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "==", "'PTM'", ":", "return", "_ptmFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "==", "'Stinespring'", ":", "return", "_stinespringFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "raise", "QiskitError", "(", "'Invalid QuantumChannel {}'", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Transform a QuantumChannel to the SuperOp representation.\"\"\"\n    if arg_0 == 'SuperOp':\n        return arg_1\n    if arg_0 == 'Operator':\n        return _from_operator('SuperOp', arg_1, arg_2, arg_3)\n    if arg_0 == 'Choi':\n        return _choiFunc(arg_1, arg_2, arg_3)\n    if arg_0 == 'Kraus':\n        return _krausFunc(arg_1, arg_2, arg_3)\n    if arg_0 == 'Chi':\n        arg_1 = _chi_to_choi(arg_1, arg_2, arg_3)\n        return _choiFunc(arg_1, arg_2, arg_3)\n    if arg_0 == 'PTM':\n        return _ptmFunc(arg_1, arg_2, arg_3)\n    if arg_0 == 'Stinespring':\n        return _stinespringFunc(arg_1, arg_2, arg_3)\n    raise QiskitError('Invalid QuantumChannel {}'.format(arg_0))", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_to_superop", "docstring": "Transform a QuantumChannel to the SuperOp representation.", "docstring_tokens": ["Transform", "a", "QuantumChannel", "to", "the", "SuperOp", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257103}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/file_tree_map.py#L403-L423", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return the number of nodes that match the pattern.", "language": "python", "parameters": "(self, pattern, adict=None)", "return_statement": "return k", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "_filetree", "if", "arg_2", "is", "None", "else", "arg_2", "arg_4", "=", "0", "if", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "arg_5", "=", "arg_3", ".", "keys", "(", ")", "arg_4", "+=", "len", "(", "filter_list", "(", "arg_5", ",", "arg_1", ")", ")", "for", "arg_6", "in", "arg_5", ":", "arg_4", "+=", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_3", "[", "arg_6", "]", ")", "else", ":", "arg_4", "=", "len", "(", "filter_list", "(", "arg_3", ",", "arg_1", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Return the number of nodes that match the pattern.\n\n        :param pattern:\n\n        :param adict:\n        :return: int\n        \"\"\"\n        arg_3 = arg_0._filetree if arg_2 is None else arg_2\n\n        arg_4 = 0\n        if isinstance(arg_3, dict):\n            arg_5 = arg_3.keys()\n            arg_4 += len(filter_list(arg_5, arg_1))\n            for arg_6 in arg_5:\n                arg_4 += arg_0.Func(arg_1, arg_3[arg_6])\n        else:\n            arg_4 = len(filter_list(arg_3, arg_1))\n\n        return arg_4", "path": "boyle/files/file_tree_map.py", "identifier": "FileTreeMap.count_node_match", "docstring": "Return the number of nodes that match the pattern.\n\n        :param pattern:\n\n        :param adict:\n        :return: int", "docstring_tokens": ["Return", "the", "number", "of", "nodes", "that", "match", "the", "pattern", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 257104}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/client.py#L225-L248", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Setup the rate limit handler.", "language": "python", "parameters": "(self, sleep_for_rate=False, min_rate_to_sleep=MIN_RATE_LIMIT,\n                                 rate_limit_header=RATE_LIMIT_HEADER,\n                                 rate_limit_reset_header=RATE_LIMIT_RESET_HEADER)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "arg_5", ",", "arg_6", "=", "arg_7", ")", ":", "arg_0", ".", "rate_limit", "=", "None", "arg_0", ".", "rate_limit_reset_ts", "=", "None", "arg_0", ".", "sleep_for_rate", "=", "arg_1", "arg_0", ".", "rate_limit_header", "=", "arg_4", "arg_0", ".", "rate_limit_reset_header", "=", "arg_6", "if", "arg_2", ">", "arg_0", ".", "MAX_RATE_LIMIT", ":", "arg_10", "=", "\"Minimum rate to sleep value exceeded (%d).\"", "arg_10", "+=", "\"High values might cause the client to sleep forever.\"", "arg_10", "+=", "\"Reset to %d.\"", "arg_0", ".", "min_rate_to_sleep", "=", "arg_0", ".", "MAX_RATE_LIMIT", "logger", ".", "warning", "(", "arg_10", ",", "arg_2", ",", "arg_0", ".", "MAX_RATE_LIMIT", ")", "else", ":", "arg_0", ".", "min_rate_to_sleep", "=", "arg_2"], "function": "def Func(arg_0, arg_1=False, arg_2=arg_3,\n                                 arg_4=arg_5,\n                                 arg_6=arg_7):\n        \"\"\"Setup the rate limit handler.\n\n        :param sleep_for_rate: sleep until rate limit is reset\n        :param min_rate_to_sleep: minimun rate needed to make the fecthing process sleep\n        :param rate_limit_header: header from where extract the rate limit data\n        :param rate_limit_reset_header: header from where extract the rate limit reset data\n        \"\"\"\n        arg_0.rate_limit = None\n        arg_0.rate_limit_reset_ts = None\n        arg_0.sleep_for_rate = arg_1\n        arg_0.rate_limit_header = arg_4\n        arg_0.rate_limit_reset_header = arg_6\n\n        if arg_2 > arg_0.MAX_RATE_LIMIT:\n            arg_10 = \"Minimum rate to sleep value exceeded (%d).\"\n            arg_10 += \"High values might cause the client to sleep forever.\"\n            arg_10 += \"Reset to %d.\"\n            arg_0.min_rate_to_sleep = arg_0.MAX_RATE_LIMIT\n            logger.warning(arg_10, arg_2, arg_0.MAX_RATE_LIMIT)\n        else:\n            arg_0.min_rate_to_sleep = arg_2", "path": "perceval/client.py", "identifier": "RateLimitHandler.setup_rate_limit_handler", "docstring": "Setup the rate limit handler.\n\n        :param sleep_for_rate: sleep until rate limit is reset\n        :param min_rate_to_sleep: minimun rate needed to make the fecthing process sleep\n        :param rate_limit_header: header from where extract the rate limit data\n        :param rate_limit_reset_header: header from where extract the rate limit reset data", "docstring_tokens": ["Setup", "the", "rate", "limit", "handler", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257105}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/db.py#L312-L331", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Clear out the database", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "from", "airflow", "import", "models", "from", "alembic", ".", "migration", "import", "MigrationContext", "log", ".", "info", "(", "\"Dropping tables that exist\"", ")", "models", ".", "base", ".", "Base", ".", "metadata", ".", "drop_all", "(", "settings", ".", "engine", ")", "arg_0", "=", "MigrationContext", ".", "configure", "(", "settings", ".", "engine", ")", "if", "arg_0", ".", "_version", ".", "exists", "(", "settings", ".", "engine", ")", ":", "arg_0", ".", "_version", ".", "drop", "(", "settings", ".", "engine", ")", "from", "flask_appbuilder", ".", "models", ".", "sqla", "import", "Base", "Base", ".", "metadata", ".", "drop_all", "(", "settings", ".", "engine", ")", "initdb", "(", ")"], "function": "def Func():\n    \"\"\"\n    Clear out the database\n    \"\"\"\n    from airflow import models\n\n    # alembic adds significant import time, so we import it lazily\n    from alembic.migration import MigrationContext\n\n    log.info(\"Dropping tables that exist\")\n\n    models.base.Base.metadata.drop_all(settings.engine)\n    arg_0 = MigrationContext.configure(settings.engine)\n    if arg_0._version.exists(settings.engine):\n        arg_0._version.drop(settings.engine)\n\n    from flask_appbuilder.models.sqla import Base\n    Base.metadata.drop_all(settings.engine)\n\n    initdb()", "path": "airflow/utils/db.py", "identifier": "resetdb", "docstring": "Clear out the database", "docstring_tokens": ["Clear", "out", "the", "database"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257106}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/setup.py#L171-L219", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Build Gromacs topology files from pdb.", "language": "python", "parameters": "(struct=None, protein='protein',\n             top='system.top',  dirname='top',\n             posres=\"posres.itp\",\n             ff=\"oplsaa\", water=\"tip4p\",\n             **pdb2gmx_args)", "return_statement": "return { \\\n            'top': realpath(dirname, top), \\\n            'struct': realpath(dirname, new_struct), \\\n            'posres' : realpath(dirname, posres) }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "'protein'", ",", "arg_2", "=", "'system.top'", ",", "arg_3", "=", "'top'", ",", "arg_4", "=", "\"posres.itp\"", ",", "arg_5", "=", "\"oplsaa\"", ",", "arg_6", "=", "\"tip4p\"", ",", "**", "arg_7", ")", ":", "arg_8", "=", "realpath", "(", "arg_0", ")", "arg_9", "=", "arg_1", "+", "'.pdb'", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_1", "+", "'_posres.itp'", "arg_7", ".", "update", "(", "{", "'f'", ":", "arg_8", ",", "'o'", ":", "arg_9", ",", "'p'", ":", "arg_2", ",", "'i'", ":", "arg_4", ",", "'ff'", ":", "arg_5", ",", "'water'", ":", "arg_6", "}", ")", "with", "in_dir", "(", "arg_3", ")", ":", "logger", ".", "info", "(", "\"[{dirname!s}] Building Func {top!r} from struct = {struct!r}\"", ".", "format", "(", "**", "vars", "(", ")", ")", ")", "gromacs", ".", "pdb2gmx", "(", "**", "arg_7", ")", "return", "{", "'top'", ":", "realpath", "(", "arg_3", ",", "arg_2", ")", ",", "'struct'", ":", "realpath", "(", "arg_3", ",", "arg_9", ")", ",", "'posres'", ":", "realpath", "(", "arg_3", ",", "arg_4", ")", "}"], "function": "def Func(arg_0=None, arg_1='protein',\n             arg_2='system.top',  arg_3='top',\n             arg_4=\"posres.itp\",\n             arg_5=\"oplsaa\", arg_6=\"tip4p\",\n             **arg_7):\n    \"\"\"Build Gromacs Func files from pdb.\n\n    :Keywords:\n       *struct*\n           input structure (**required**)\n       *protein*\n           name of the output files\n       *top*\n           name of the Func file\n       *dirname*\n           directory in which the new Func will be stored\n       *ff*\n           force field (string understood by ``pdb2gmx``); default\n           \"oplsaa\"\n       *water*\n           water model (string), default \"tip4p\"\n       *pdb2gmxargs*\n           other arguments for ``pdb2gmx``\n\n    .. note::\n       At the moment this function simply runs ``pdb2gmx`` and uses\n       the resulting Func file directly. If you want to create\n       more complicated topologies and maybe also use additional itp\n       files or make a protein itp file then you will have to do this\n       manually.\n    \"\"\"\n\n    arg_8 = realpath(arg_0)\n\n    arg_9 = arg_1 + '.pdb'\n    if arg_4 is None:\n        arg_4 = arg_1 + '_posres.itp'\n\n    arg_7.update({'f': arg_8, 'o': arg_9, 'p': arg_2, 'i': arg_4,\n                         'ff': arg_5, 'water': arg_6})\n\n    with in_dir(arg_3):\n        logger.info(\"[{dirname!s}] Building Func {top!r} from struct = {struct!r}\".format(**vars()))\n        # perhaps parse output from pdb2gmx 4.5.x to get the names of the chain itp files?\n        gromacs.pdb2gmx(**arg_7)\n    return { \\\n            'top': realpath(arg_3, arg_2), \\\n            'struct': realpath(arg_3, arg_9), \\\n            'posres' : realpath(arg_3, arg_4) }", "path": "gromacs/setup.py", "identifier": "topology", "docstring": "Build Gromacs topology files from pdb.\n\n    :Keywords:\n       *struct*\n           input structure (**required**)\n       *protein*\n           name of the output files\n       *top*\n           name of the topology file\n       *dirname*\n           directory in which the new topology will be stored\n       *ff*\n           force field (string understood by ``pdb2gmx``); default\n           \"oplsaa\"\n       *water*\n           water model (string), default \"tip4p\"\n       *pdb2gmxargs*\n           other arguments for ``pdb2gmx``\n\n    .. note::\n       At the moment this function simply runs ``pdb2gmx`` and uses\n       the resulting topology file directly. If you want to create\n       more complicated topologies and maybe also use additional itp\n       files or make a protein itp file then you will have to do this\n       manually.", "docstring_tokens": ["Build", "Gromacs", "topology", "files", "from", "pdb", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 257107}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/configuration.py#L309-L344", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns the section as a dict. Values are converted to int, float, bool\n        as required.", "language": "python", "parameters": "(self, section)", "return_statement": "return _section", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "arg_1", "not", "in", "arg_0", ".", "_sections", "and", "arg_1", "not", "in", "arg_0", ".", "airflow_defaults", ".", "_sections", ")", ":", "return", "None", "arg_2", "=", "copy", ".", "deepcopy", "(", "arg_0", ".", "airflow_defaults", ".", "_sections", "[", "arg_1", "]", ")", "if", "arg_1", "in", "arg_0", ".", "_sections", ":", "arg_2", ".", "update", "(", "copy", ".", "deepcopy", "(", "arg_0", ".", "_sections", "[", "arg_1", "]", ")", ")", "arg_3", "=", "'AIRFLOW__{S}__'", ".", "format", "(", "S", "=", "arg_1", ".", "upper", "(", ")", ")", "for", "arg_4", "in", "sorted", "(", "os", ".", "environ", ".", "keys", "(", ")", ")", ":", "if", "arg_4", ".", "startswith", "(", "arg_3", ")", ":", "arg_5", "=", "arg_4", ".", "replace", "(", "arg_3", ",", "''", ")", ".", "lower", "(", ")", "arg_2", "[", "arg_5", "]", "=", "arg_0", ".", "_get_env_var_option", "(", "arg_1", ",", "arg_5", ")", "for", "arg_5", ",", "arg_6", "in", "iteritems", "(", "arg_2", ")", ":", "try", ":", "arg_6", "=", "int", "(", "arg_6", ")", "except", "ValueError", ":", "try", ":", "arg_6", "=", "float", "(", "arg_6", ")", "except", "ValueError", ":", "if", "arg_6", ".", "lower", "(", ")", "in", "(", "'t'", ",", "'true'", ")", ":", "arg_6", "=", "True", "elif", "arg_6", ".", "lower", "(", ")", "in", "(", "'f'", ",", "'false'", ")", ":", "arg_6", "=", "False", "arg_2", "[", "arg_5", "]", "=", "arg_6", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns the section as a dict. Values are converted to int, float, bool\n        as required.\n\n        :param section: section from the config\n        :rtype: dict\n        \"\"\"\n        if (arg_1 not in arg_0._sections and\n                arg_1 not in arg_0.airflow_defaults._sections):\n            return None\n\n        arg_2 = copy.deepcopy(arg_0.airflow_defaults._sections[arg_1])\n\n        if arg_1 in arg_0._sections:\n            arg_2.update(copy.deepcopy(arg_0._sections[arg_1]))\n\n        arg_3 = 'AIRFLOW__{S}__'.format(S=arg_1.upper())\n        for arg_4 in sorted(os.environ.keys()):\n            if arg_4.startswith(arg_3):\n                arg_5 = arg_4.replace(arg_3, '').lower()\n                arg_2[arg_5] = arg_0._get_env_var_option(arg_1, arg_5)\n\n        for arg_5, arg_6 in iteritems(arg_2):\n            try:\n                arg_6 = int(arg_6)\n            except ValueError:\n                try:\n                    arg_6 = float(arg_6)\n                except ValueError:\n                    if arg_6.lower() in ('t', 'true'):\n                        arg_6 = True\n                    elif arg_6.lower() in ('f', 'false'):\n                        arg_6 = False\n            arg_2[arg_5] = arg_6\n        return arg_2", "path": "airflow/configuration.py", "identifier": "AirflowConfigParser.getsection", "docstring": "Returns the section as a dict. Values are converted to int, float, bool\n        as required.\n\n        :param section: section from the config\n        :rtype: dict", "docstring_tokens": ["Returns", "the", "section", "as", "a", "dict", ".", "Values", "are", "converted", "to", "int", "float", "bool", "as", "required", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257108}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/builder/sections.py#L8-L39", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Set one section in a Project description", "language": "python", "parameters": "(desc, name, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "raise", "KeyError", "(", "'No section \"%s\"'", "%", "arg_1", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "type", "(", "arg_3", ")", "(", ")", "elif", "arg_1", "in", "CLASS_SECTIONS", ":", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_2", "=", "{", "'typename'", ":", "aliases", ".", "resolve", "(", "arg_2", ")", "}", "elif", "isinstance", "(", "arg_2", ",", "type", ")", ":", "arg_2", "=", "{", "'typename'", ":", "class_name", ".", "class_name", "(", "arg_2", ")", "}", "elif", "not", "isinstance", "(", "arg_2", ",", "dict", ")", ":", "raise", "TypeError", "(", "'Expected dict, str or type, got \"%s\"'", "%", "arg_2", ")", "arg_4", "=", "arg_2", ".", "get", "(", "'typename'", ")", "if", "arg_4", ":", "arg_5", "=", "'s'", "if", "arg_1", "==", "'driver'", "else", "''", "arg_6", "=", "'bibliopixel.'", "+", "arg_1", "+", "arg_5", "importer", ".", "import_symbol", "(", "arg_4", ",", "arg_6", ")", "elif", "arg_1", "==", "'shape'", ":", "if", "not", "isinstance", "(", "arg_2", ",", "(", "list", ",", "int", ",", "tuple", ",", "str", ")", ")", ":", "raise", "TypeError", "(", "'Expected shape, got \"%s\"'", "%", "arg_2", ")", "elif", "type", "(", "arg_3", ")", "is", "not", "type", "(", "arg_2", ")", ":", "raise", "TypeError", "(", "'Expected %s but got \"%s\" of type %s'", "%", "(", "type", "(", "arg_3", ")", ",", "arg_2", ",", "type", "(", "arg_2", ")", ")", ")", "arg_0", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Set one section in a Project description\"\"\"\n    arg_3 = arg_0.get(arg_1)\n    if arg_3 is None:\n        raise KeyError('No section \"%s\"' % arg_1)\n\n    if arg_2 is None:\n        arg_2 = type(arg_3)()\n\n    elif arg_1 in CLASS_SECTIONS:\n        if isinstance(arg_2, str):\n            arg_2 = {'typename': aliases.resolve(arg_2)}\n        elif isinstance(arg_2, type):\n            arg_2 = {'typename': class_name.class_name(arg_2)}\n        elif not isinstance(arg_2, dict):\n            raise TypeError('Expected dict, str or type, got \"%s\"' % arg_2)\n\n        arg_4 = arg_2.get('typename')\n        if arg_4:\n            arg_5 = 's' if arg_1 == 'driver' else ''\n            arg_6 = 'bibliopixel.' + arg_1 + arg_5\n            importer.import_symbol(arg_4, arg_6)\n\n    elif arg_1 == 'shape':\n        if not isinstance(arg_2, (list, int, tuple, str)):\n            raise TypeError('Expected shape, got \"%s\"' % arg_2)\n\n    elif type(arg_3) is not type(arg_2):\n        raise TypeError('Expected %s but got \"%s\" of type %s' %\n                        (type(arg_3), arg_2, type(arg_2)))\n\n    arg_0[arg_1] = arg_2", "path": "bibliopixel/builder/sections.py", "identifier": "set_one", "docstring": "Set one section in a Project description", "docstring_tokens": ["Set", "one", "section", "in", "a", "Project", "description"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 257109}
{"url": "https://github.com/ElevenPaths/AtomShields/blob/e75f25393b4a7a315ec96bf9b8e654cb2200866a/atomshields/checkers/base.py#L51-L62", "sha": "e75f25393b4a7a315ec96bf9b8e654cb2200866a", "docstring_summary": "Setter for 'path' property", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "endswith", "(", "'/'", ")", ":", "arg_0", ".", "_Func", "=", "'{v}/'", ".", "format", "(", "v", "=", "arg_1", ")", "else", ":", "arg_0", ".", "_Func", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n\t\t\"\"\"\n\t\tSetter for 'Func' property\n\n\t\tArgs:\n\t\t\tvalue (str): Absolute Func to scan\n\n\t\t\"\"\"\n\t\tif not arg_1.endswith('/'):\n\t\t\targ_0._Func = '{v}/'.format(v=arg_1)\n\t\telse:\n\t\t\targ_0._Func = arg_1", "path": "atomshields/checkers/base.py", "identifier": "GenericChecker.path", "docstring": "Setter for 'path' property\n\n\t\tArgs:\n\t\t\tvalue (str): Absolute path to scan", "docstring_tokens": ["Setter", "for", "path", "property"], "nwo": "ElevenPaths/AtomShields", "score": 0.3901382355567912, "idx": 257110}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/beat.py#L343-L395", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Internal function that tracks beats in an onset strength envelope.", "language": "python", "parameters": "(onset_envelope, bpm, fft_res, tightness, trim)", "return_statement": "return beats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_1", "<=", "0", ":", "raise", "ParameterError", "(", "'bpm must be strictly positive'", ")", "arg_5", "=", "round", "(", "60.0", "*", "arg_2", "/", "arg_1", ")", "arg_6", "=", "__beat_local_score", "(", "arg_0", ",", "arg_5", ")", "arg_7", ",", "arg_8", "=", "__beat_track_dp", "(", "arg_6", ",", "arg_5", ",", "arg_3", ")", "arg_9", "=", "[", "__last_beat", "(", "arg_8", ")", "]", "while", "arg_7", "[", "arg_9", "[", "-", "1", "]", "]", ">=", "0", ":", "arg_9", ".", "append", "(", "arg_7", "[", "arg_9", "[", "-", "1", "]", "]", ")", "arg_9", "=", "np", ".", "array", "(", "arg_9", "[", ":", ":", "-", "1", "]", ",", "dtype", "=", "int", ")", "arg_9", "=", "__trim_beats", "(", "arg_6", ",", "arg_9", ",", "arg_4", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Internal function that tracks beats in an onset strength envelope.\n\n    Parameters\n    ----------\n    onset_envelope : np.ndarray [shape=(n,)]\n        onset strength envelope\n\n    bpm : float [scalar]\n        tempo estimate\n\n    fft_res  : float [scalar]\n        resolution of the fft (sr / hop_length)\n\n    tightness: float [scalar]\n        how closely do we adhere to bpm?\n\n    trim : bool [scalar]\n        trim leading/trailing beats with weak onsets?\n\n    Returns\n    -------\n    beats : np.ndarray [shape=(n,)]\n        frame numbers of beat events\n    \"\"\"\n\n    if arg_1 <= 0:\n        raise ParameterError('bpm must be strictly positive')\n\n    # convert bpm to a sample period for searching\n    arg_5 = round(60.0 * arg_2 / arg_1)\n\n    # localscore is a smoothed version of AGC'd onset envelope\n    arg_6 = __beat_local_score(arg_0, arg_5)\n\n    # run the DP\n    arg_7, arg_8 = __beat_track_dp(arg_6, arg_5, arg_3)\n\n    # get the position of the last beat\n    arg_9 = [__last_beat(arg_8)]\n\n    # Reconstruct the beat path from backlinks\n    while arg_7[arg_9[-1]] >= 0:\n        arg_9.append(arg_7[arg_9[-1]])\n\n    # Put the beats in ascending order\n    # Convert into an array of frame numbers\n    arg_9 = np.array(arg_9[::-1], dtype=int)\n\n    # Discard spurious trailing beats\n    arg_9 = __trim_beats(arg_6, arg_9, arg_4)\n\n    return arg_9", "path": "librosa/beat.py", "identifier": "__beat_tracker", "docstring": "Internal function that tracks beats in an onset strength envelope.\n\n    Parameters\n    ----------\n    onset_envelope : np.ndarray [shape=(n,)]\n        onset strength envelope\n\n    bpm : float [scalar]\n        tempo estimate\n\n    fft_res  : float [scalar]\n        resolution of the fft (sr / hop_length)\n\n    tightness: float [scalar]\n        how closely do we adhere to bpm?\n\n    trim : bool [scalar]\n        trim leading/trailing beats with weak onsets?\n\n    Returns\n    -------\n    beats : np.ndarray [shape=(n,)]\n        frame numbers of beat events", "docstring_tokens": ["Internal", "function", "that", "tracks", "beats", "in", "an", "onset", "strength", "envelope", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 257111}
{"url": "https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L55-L63", "sha": "074c8452f15a0da638668a4fe139fde06ccfae7f", "docstring_summary": "Objective and gradient for the rosenbrock function", "language": "python", "parameters": "(theta)", "return_statement": "return obj, grad", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", "arg_3", "=", "(", "1", "-", "arg_1", ")", "**", "2", "+", "100", "*", "(", "arg_2", "-", "arg_1", "**", "2", ")", "**", "2", "arg_4", "=", "np", ".", "zeros", "(", "2", ")", "arg_4", "[", "0", "]", "=", "2", "*", "arg_1", "-", "400", "*", "(", "arg_1", "*", "arg_2", "-", "arg_1", "**", "3", ")", "-", "2", "arg_4", "[", "1", "]", "=", "200", "*", "(", "arg_2", "-", "arg_1", "**", "2", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Objective and gradient for the Func function\"\"\"\n    arg_1, arg_2 = arg_0\n    arg_3 = (1 - arg_1)**2 + 100 * (arg_2 - arg_1**2)**2\n\n    arg_4 = np.zeros(2)\n    arg_4[0] = 2 * arg_1 - 400 * (arg_1 * arg_2 - arg_1**3) - 2\n    arg_4[1] = 200 * (arg_2 - arg_1**2)\n    return arg_3, arg_4", "path": "descent/objectives.py", "identifier": "rosenbrock", "docstring": "Objective and gradient for the rosenbrock function", "docstring_tokens": ["Objective", "and", "gradient", "for", "the", "rosenbrock", "function"], "nwo": "nirum/descent", "score": 0.18112697196067942, "idx": 257112}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/assembler/ideogram/assembler.py#L66-L106", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Generate the annotations JSON for Ideogram.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Mapping", "[", "str", ",", "Mapping", "[", "str", ",", "Any", "]", "]", ":", "import", "bio2bel_hgnc", "from", "bio2bel_hgnc", ".", "models", "import", "HumanGene", "arg_0", ":", "arg_1", "=", "arg_0", ".", "copy", "(", ")", "enrich_protein_and_rna_origins", "(", "arg_0", ")", "collapse_all_variants", "(", "arg_0", ")", "arg_2", ":", "Set", "[", "Gene", "]", "=", "get_nodes_by_function", "(", "arg_0", ",", "GENE", ")", "arg_3", "=", "{", "gene", ".", "name", "for", "gene", "in", "arg_2", "if", "gene", ".", "namespace", ".", "lower", "(", ")", "==", "'hgnc'", "}", "arg_4", "=", "{", "}", "arg_5", "=", "bio2bel_hgnc", ".", "Manager", "(", ")", "arg_6", "=", "(", "arg_5", ".", "session", ".", "query", "(", "HumanGene", ".", "symbol", ",", "HumanGene", ".", "location", ")", ".", "filter", "(", "HumanGene", ".", "symbol", ".", "in_", "(", "arg_3", ")", ")", ".", "all", "(", ")", ")", "for", "arg_7", "in", "arg_6", ":", "arg_4", "[", "arg_7", ".", "symbol", "]", "=", "{", "'name'", ":", "arg_7", ".", "symbol", ",", "'chr'", ":", "(", "arg_7", ".", "location", ".", "split", "(", "'q'", ")", "[", "0", "]", "if", "'q'", "in", "arg_7", ".", "location", "else", "arg_7", ".", "location", ".", "split", "(", "'p'", ")", "[", "0", "]", ")", ",", "}", "arg_9", "=", "get_df", "(", ")", "for", "arg_10", ",", "(", "arg_11", ",", "arg_8", ",", "arg_12", ",", "arg_13", ")", "in", "arg_9", "[", "arg_9", "[", "'Symbol'", "]", ".", "isin", "(", "arg_3", ")", "]", ".", "iterrows", "(", ")", ":", "arg_4", "[", "arg_8", "]", "[", "'start'", "]", "=", "arg_12", "arg_4", "[", "arg_8", "]", "[", "'stop'", "]", "=", "arg_13", "return", "arg_4"], "function": "def Func(arg_0: arg_1) -> Mapping[str, Mapping[str, Any]]:\n    \"\"\"Generate the annotations JSON for Ideogram.\"\"\"\n    import bio2bel_hgnc\n    from bio2bel_hgnc.models import HumanGene\n\n    arg_0: arg_1 = arg_0.copy()\n    enrich_protein_and_rna_origins(arg_0)\n    collapse_all_variants(arg_0)\n    arg_2: Set[Gene] = get_nodes_by_function(arg_0, GENE)\n    arg_3 = {\n        gene.name\n        for gene in arg_2\n        if gene.namespace.lower() == 'hgnc'\n    }\n\n    arg_4 = {}\n\n    arg_5 = bio2bel_hgnc.Manager()\n    arg_6 = (\n        arg_5.session\n            .query(HumanGene.symbol, HumanGene.location)\n            .filter(HumanGene.symbol.in_(arg_3))\n            .all()\n    )\n    for arg_7 in arg_6:\n        arg_4[arg_7.symbol] = {\n            'name': arg_7.symbol,\n            'chr': (\n                arg_7.location.split('q')[0]\n                if 'q' in arg_7.location else\n                arg_7.location.split('p')[0]\n            ),\n        }\n\n    arg_9 = get_df()\n\n    for arg_10, (arg_11, arg_8, arg_12, arg_13) in arg_9[arg_9['Symbol'].isin(arg_3)].iterrows():\n        arg_4[arg_8]['start'] = arg_12\n        arg_4[arg_8]['stop'] = arg_13\n\n    return arg_4", "path": "src/pybel_tools/assembler/ideogram/assembler.py", "identifier": "prerender", "docstring": "Generate the annotations JSON for Ideogram.", "docstring_tokens": ["Generate", "the", "annotations", "JSON", "for", "Ideogram", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257113}
{"url": "https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L148-L159", "sha": "3fa08bf56def990b3513d25e403f85357487b373", "docstring_summary": "default is to wait for the child applications to close.", "language": "python", "parameters": "(self, code)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "await", "asyncio", ".", "wait", "(", "arg_0", ".", "application_futures", ".", "values", "(", ")", ",", "return_when", "=", "asyncio", ".", "ALL_COMPLETED", ",", "timeout", "=", "arg_0", ".", "application_close_timeout", ")", "except", "asyncio", ".", "TimeoutError", ":", "pass"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"\n        default is to wait for the child applications to close.\n        \"\"\"\n        try:\n            await asyncio.wait(\n                arg_0.application_futures.values(),\n                return_when=asyncio.ALL_COMPLETED,\n                timeout=arg_0.application_close_timeout\n            )\n        except asyncio.TimeoutError:\n            pass", "path": "channelsmultiplexer/demultiplexer.py", "identifier": "AsyncJsonWebsocketDemultiplexer.disconnect", "docstring": "default is to wait for the child applications to close.", "docstring_tokens": ["default", "is", "to", "wait", "for", "the", "child", "applications", "to", "close", "."], "nwo": "hishnash/channelsmultiplexer", "score": 0.40965706691753795, "idx": 257114}
{"url": "https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/api.py#L83-L98", "sha": "212cfe1791a4aab4783f99b665cc32da6437f419", "docstring_summary": "Send zipfile to TMC for given exercise", "language": "python", "parameters": "(self, exercise, file, params)", "return_statement": "return self._to_json(resp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "post", "(", "arg_1", ".", "return_url", ",", "arg_3", "=", "arg_3", ",", "files", "=", "{", "\"submission[file]\"", ":", "(", "'submission.zip'", ",", "arg_2", ")", "}", ",", "data", "=", "{", "\"commit\"", ":", "\"Submit\"", "}", ")", "return", "arg_0", ".", "_to_json", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Send zipfile to TMC for given exercise\n        \"\"\"\n\n        arg_4 = arg_0.post(\n            arg_1.return_url,\n            arg_3=arg_3,\n            files={\n                \"submission[file]\": ('submission.zip', arg_2)\n            },\n            data={\n                \"commit\": \"Submit\"\n            }\n        )\n        return arg_0._to_json(arg_4)", "path": "tmc/api.py", "identifier": "API.send_zip", "docstring": "Send zipfile to TMC for given exercise", "docstring_tokens": ["Send", "zipfile", "to", "TMC", "for", "given", "exercise"], "nwo": "minttu/tmc.py", "score": 0.09252797783733271, "idx": 257115}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L250-L310", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data stream and decode the AttributeReference structure into\n        its parts.", "language": "python", "parameters": "(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_2_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ")", ":", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "raise", "exceptions", ".", "VersionNotSupported", "(", "\"KMIP {} does not support the AttributeReference \"", "\"object.\"", ".", "format", "(", "arg_2", ".", "value", ")", ")", "super", "(", "AttributeReference", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "VENDOR_IDENTIFICATION", ",", "arg_6", ")", ":", "arg_0", ".", "_vendor_identification", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "VENDOR_IDENTIFICATION", ")", "arg_0", ".", "_vendor_identification", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The AttributeReference encoding is missing the vendor \"", "\"identification string.\"", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ATTRIBUTE_NAME", ",", "arg_6", ")", ":", "arg_0", ".", "_attribute_name", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "ATTRIBUTE_NAME", ")", "arg_0", ".", "_attribute_name", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The AttributeReference encoding is missing the attribute \"", "\"name string.\"", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_2_0):\n        \"\"\"\n        Read the data stream and decode the AttributeReference structure into\n        its parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a Func method.\n            kmip_version (enum): A KMIPVersion enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            InvalidKmipEncoding: Raised if the vendor identification or\n                attribute name is missing from the encoding.\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the AttributeReference structure.\n        \"\"\"\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            raise exceptions.VersionNotSupported(\n                \"KMIP {} does not support the AttributeReference \"\n                \"object.\".format(\n                    arg_2.value\n                )\n            )\n\n        super(AttributeReference, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.VENDOR_IDENTIFICATION, arg_6):\n            arg_0._vendor_identification = primitives.TextString(\n                tag=arg_3.Tags.VENDOR_IDENTIFICATION\n            )\n            arg_0._vendor_identification.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise exceptions.InvalidKmipEncoding(\n                \"The AttributeReference encoding is missing the vendor \"\n                \"identification string.\"\n            )\n\n        if arg_0.is_tag_next(arg_3.Tags.ATTRIBUTE_NAME, arg_6):\n            arg_0._attribute_name = primitives.TextString(\n                tag=arg_3.Tags.ATTRIBUTE_NAME\n            )\n            arg_0._attribute_name.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise exceptions.InvalidKmipEncoding(\n                \"The AttributeReference encoding is missing the attribute \"\n                \"name string.\"\n            )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/objects.py", "identifier": "AttributeReference.read", "docstring": "Read the data stream and decode the AttributeReference structure into\n        its parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a read method.\n            kmip_version (enum): A KMIPVersion enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            InvalidKmipEncoding: Raised if the vendor identification or\n                attribute name is missing from the encoding.\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the AttributeReference structure.", "docstring_tokens": ["Read", "the", "data", "stream", "and", "decode", "the", "AttributeReference", "structure", "into", "its", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 257116}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/views/publishing.py#L27-L57", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Accept a publication request at form value 'epub", "language": "python", "parameters": "(request)", "return_statement": "return response_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'epub'", "not", "in", "arg_0", ".", "POST", ":", "raise", "httpexceptions", ".", "HTTPBadRequest", "(", "\"Missing EPUB in POST body.\"", ")", "arg_1", "=", "asbool", "(", "arg_0", ".", "POST", ".", "get", "(", "'pre-publication'", ")", ")", "arg_2", "=", "arg_0", ".", "POST", "[", "'epub'", "]", ".", "file", "try", ":", "arg_3", "=", "cnxepub", ".", "EPUB", ".", "from_file", "(", "arg_2", ")", "except", ":", "raise", "httpexceptions", ".", "HTTPBadRequest", "(", "'Format not recognized.'", ")", "with", "db_connect", "(", ")", "as", "db_conn", ":", "with", "db_conn", ".", "cursor", "(", ")", "as", "cursor", ":", "arg_2", ".", "seek", "(", "0", ")", "arg_4", ",", "arg_5", "=", "add_publication", "(", "cursor", ",", "arg_3", ",", "arg_2", ",", "arg_1", ")", "arg_6", ",", "arg_7", "=", "poke_publication_state", "(", "arg_4", ")", "arg_8", "=", "{", "'publication'", ":", "arg_4", ",", "'mapping'", ":", "arg_5", ",", "'state'", ":", "arg_6", ",", "'messages'", ":", "arg_7", ",", "}", "return", "arg_8"], "function": "def Func(arg_0):\n    \"\"\"Accept a publication request at form value 'epub'\"\"\"\n    if 'epub' not in arg_0.POST:\n        raise httpexceptions.HTTPBadRequest(\"Missing EPUB in POST body.\")\n\n    arg_1 = asbool(arg_0.POST.get('pre-publication'))\n    arg_2 = arg_0.POST['epub'].file\n    try:\n        arg_3 = cnxepub.EPUB.from_file(arg_2)\n    except:  # noqa: E722\n        raise httpexceptions.HTTPBadRequest('Format not recognized.')\n\n    # Make a publication entry in the database for status checking\n    # the publication. This also creates publication entries for all\n    # of the content in the EPUB.\n    with db_connect() as db_conn:\n        with db_conn.cursor() as cursor:\n            arg_2.seek(0)\n            arg_4, arg_5 = add_publication(\n                cursor, arg_3, arg_2, arg_1)\n\n    # Poke at the publication & lookup its state.\n    arg_6, arg_7 = poke_publication_state(arg_4)\n\n    arg_8 = {\n        'publication': arg_4,\n        'mapping': arg_5,\n        'state': arg_6,\n        'messages': arg_7,\n    }\n    return arg_8", "path": "cnxpublishing/views/publishing.py", "identifier": "publish", "docstring": "Accept a publication request at form value 'epub", "docstring_tokens": ["Accept", "a", "publication", "request", "at", "form", "value", "epub"], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 257117}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/statemanager.py#L110-L121", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Establish an ssh tunnel for each local host and port\n    that can be used to communicate with the state host.", "language": "python", "parameters": "(self)", "return_statement": "return localportlist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "(", "arg_2", ",", "arg_3", ")", "in", "arg_0", ".", "hostportlist", ":", "arg_4", "=", "arg_0", ".", "pick_unused_port", "(", ")", "arg_0", ".", "tunnel", ".", "append", "(", "subprocess", ".", "Popen", "(", "(", "'ssh'", ",", "arg_0", ".", "tunnelhost", ",", "'-NL127.0.0.1:%d:%s:%d'", "%", "(", "arg_4", ",", "arg_2", ",", "arg_3", ")", ")", ")", ")", "arg_1", ".", "append", "(", "(", "'127.0.0.1'", ",", "arg_4", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Establish an ssh tunnel for each local host and port\n    that can be used to communicate with the state host.\n    \"\"\"\n    arg_1 = []\n    for (arg_2, arg_3) in arg_0.hostportlist:\n      arg_4 = arg_0.pick_unused_port()\n      arg_0.tunnel.append(subprocess.Popen(\n          ('ssh', arg_0.tunnelhost, '-NL127.0.0.1:%d:%s:%d' % (arg_4, arg_2, arg_3))))\n      arg_1.append(('127.0.0.1', arg_4))\n    return arg_1", "path": "heron/statemgrs/src/python/statemanager.py", "identifier": "StateManager.establish_ssh_tunnel", "docstring": "Establish an ssh tunnel for each local host and port\n    that can be used to communicate with the state host.", "docstring_tokens": ["Establish", "an", "ssh", "tunnel", "for", "each", "local", "host", "and", "port", "that", "can", "be", "used", "to", "communicate", "with", "the", "state", "host", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257118}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/rrule.py#L82-L93", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Decorator for rruleset methods which may invalidate the\n    cached length.", "language": "python", "parameters": "(f)", "return_statement": "return inner_func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "inner_func", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "arg_1", ".", "_invalidate_cache", "(", ")", "return", "arg_4", "return", "inner_func"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator for rruleset methods which may invalidate the\n    cached length.\n    \"\"\"\n\n    def inner_func(arg_1, *arg_2, **arg_3):\n        arg_4 = arg_0(arg_1, *arg_2, **arg_3)\n        arg_1._invalidate_cache()\n        return arg_4\n\n    return inner_func", "path": "superjson/pkg/dateutil/rrule.py", "identifier": "_invalidates_cache", "docstring": "Decorator for rruleset methods which may invalidate the\n    cached length.", "docstring_tokens": ["Decorator", "for", "rruleset", "methods", "which", "may", "invalidate", "the", "cached", "length", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 257119}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L52-L58", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Policy shared context dictionary", "language": "python", "parameters": "(self, key=None, default=dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "arg_3", ")", ":", "arg_4", "=", "[", "'policy'", "]", "if", "arg_1", "is", "not", "None", ":", "arg_4", ".", "append", "(", "arg_1", ")", "with", "arg_0", ".", "_executor", ".", "Func", "(", "'.'", ".", "join", "(", "arg_4", ")", ",", "arg_2", ")", "as", "policy_context", ":", "yield", "policy_context"], "function": "def Func(arg_0, arg_1=None, arg_2=arg_3):\n        \"\"\" Policy shared context dictionary \"\"\"\n        arg_4 = ['policy']\n        if arg_1 is not None:\n            arg_4.append(arg_1)\n        with arg_0._executor.Func('.'.join(arg_4), arg_2) as policy_context:\n            yield policy_context", "path": "manticore/core/executor.py", "identifier": "Policy.locked_context", "docstring": "Policy shared context dictionary", "docstring_tokens": ["Policy", "shared", "context", "dictionary"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257120}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/parse.py#L97-L111", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "return True if callback is an instance of a class", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "False", "arg_2", "=", "arg_0", ".", "callback", "if", "arg_0", ".", "is_class", "(", ")", ":", "return", "False", "arg_1", "=", "not", "inspect", ".", "isfunction", "(", "arg_2", ")", "and", "not", "inspect", ".", "ismethod", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"return True if callback is an instance of a class\"\"\"\n        arg_1 = False\n        arg_2 = arg_0.callback\n        if arg_0.is_class(): return False\n\n        arg_1 = not inspect.isfunction(arg_2) and not inspect.ismethod(arg_2)\n#         if is_py2:\n#             ret = isinstance(val, types.InstanceType) or hasattr(val, '__dict__') \\\n#                 and not (hasattr(val, 'func_name') or hasattr(val, 'im_func'))\n# \n#         else:\n#             ret = not inspect.isfunction(val) and not inspect.ismethod(val)\n\n        return arg_1", "path": "captain/parse.py", "identifier": "CallbackInspect.is_instance", "docstring": "return True if callback is an instance of a class", "docstring_tokens": ["return", "True", "if", "callback", "is", "an", "instance", "of", "a", "class"], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 257121}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py#L184-L191", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "All keys in DB, or all keys matching a glob", "language": "python", "parameters": "(self, globpat = None)", "return_statement": "return [self._normalized(p) for p in files if p.isfile()]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "arg_0", ".", "root", ".", "walkfiles", "(", ")", "else", ":", "arg_2", "=", "[", "Path", "(", "arg_3", ")", "for", "arg_3", "in", "glob", ".", "glob", "(", "arg_0", ".", "root", "/", "arg_1", ")", "]", "return", "[", "arg_0", ".", "_normalized", "(", "arg_3", ")", "for", "arg_3", "in", "arg_2", "if", "arg_3", ".", "isfile", "(", ")", "]"], "function": "def Func(arg_0, arg_1 = None):\n        \"\"\" All Func in DB, or all Func matching a glob\"\"\"\n\n        if arg_1 is None:\n            arg_2 = arg_0.root.walkfiles()\n        else:\n            arg_2 = [Path(arg_3) for arg_3 in glob.glob(arg_0.root/arg_1)]\n        return [arg_0._normalized(arg_3) for arg_3 in arg_2 if arg_3.isfile()]", "path": "environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py", "identifier": "PickleShareDB.keys", "docstring": "All keys in DB, or all keys matching a glob", "docstring_tokens": ["All", "keys", "in", "DB", "or", "all", "keys", "matching", "a", "glob"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257122}
{"url": "https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/stocks.py#L1640-L1656", "sha": "91cf751dafdb208a0c8b5377945e5808b99f94ba", "docstring_summary": "This returns an array of each sector and performance for the current trading day. Performance is based on each sector ETF.", "language": "python", "parameters": "(token='', version='')", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "''", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "pd", ".", "DataFrame", "(", "sectorPerformance", "(", "arg_0", ",", "arg_1", ")", ")", "_toDatetime", "(", "arg_2", ")", "_reindex", "(", "arg_2", ",", "'name'", ")", "return", "arg_2"], "function": "def Func(arg_0='', arg_1=''):\n    '''This returns an array of each sector and performance for the current trading day. Performance is based on each sector ETF.\n\n    https://iexcloud.io/docs/api/#sector-performance\n    8am-5pm ET Mon-Fri\n\n    Args:\n        token (string); Access token\n        version (string); API version\n\n    Returns:\n        DataFrame: result\n    '''\n    arg_2 = pd.DataFrame(sectorPerformance(arg_0, arg_1))\n    _toDatetime(arg_2)\n    _reindex(arg_2, 'name')\n    return arg_2", "path": "pyEX/stocks.py", "identifier": "sectorPerformanceDF", "docstring": "This returns an array of each sector and performance for the current trading day. Performance is based on each sector ETF.\n\n    https://iexcloud.io/docs/api/#sector-performance\n    8am-5pm ET Mon-Fri\n\n    Args:\n        token (string); Access token\n        version (string); API version\n\n    Returns:\n        DataFrame: result", "docstring_tokens": ["This", "returns", "an", "array", "of", "each", "sector", "and", "performance", "for", "the", "current", "trading", "day", ".", "Performance", "is", "based", "on", "each", "sector", "ETF", "."], "nwo": "timkpaine/pyEX", "score": 0.7739774393741435, "idx": 257123}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/operator.py#L75-L98", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Finds the first operator in the list, converts it and its operands to a OptreeNode, then\n  returns a new list with the operator and operands replaced by the new OptreeNode.", "language": "python", "parameters": "(nodes)", "return_statement": "return nodes[:operands_lbound] + \\\n         [OptreeNode(operator_node, tuple(nodes[operands_lbound:i]))] + \\\n         nodes[i+1:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "while", "arg_1", "<", "len", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", "[", "arg_1", "]", ",", "OperatorNode", ")", ":", "break", "else", ":", "arg_1", "+=", "1", "if", "arg_1", "==", "len", "(", "arg_0", ")", ":", "raise", "OperatorError", "(", "\"No operator found\"", ")", "arg_2", "=", "arg_0", "[", "arg_1", "]", "arg_3", "=", "arg_2", ".", "operator", "arg_4", "=", "arg_1", "-", "arg_3", ".", "cardinality", "if", "arg_4", "<", "0", ":", "raise", "OperatorError", "(", "\"Insufficient operands for operator {0}\"", ".", "format", "(", "arg_3", ".", "symbol", ")", ")", "return", "arg_0", "[", ":", "arg_4", "]", "+", "[", "OptreeNode", "(", "arg_2", ",", "tuple", "(", "arg_0", "[", "arg_4", ":", "arg_1", "]", ")", ")", "]", "+", "arg_0", "[", "arg_1", "+", "1", ":", "]"], "function": "def Func(arg_0):\n  \"\"\"Finds the first operator in the list, converts it and its operands to a OptreeNode, then\n  returns a new list with the operator and operands replaced by the new OptreeNode.\n  \"\"\"\n  arg_1 = 0\n  while arg_1 < len(arg_0):\n    if isinstance(arg_0[arg_1], OperatorNode):\n      break\n    else:\n      arg_1 += 1\n\n  if arg_1 == len(arg_0):\n    raise OperatorError(\"No operator found\")\n\n  arg_2 = arg_0[arg_1]\n  arg_3 = arg_2.operator\n  arg_4 = arg_1 - arg_3.cardinality\n\n  if arg_4 < 0:\n    raise OperatorError(\"Insufficient operands for operator {0}\".format(arg_3.symbol))\n\n  return arg_0[:arg_4] + \\\n         [OptreeNode(arg_2, tuple(arg_0[arg_4:arg_1]))] + \\\n         arg_0[arg_1+1:]", "path": "pyebnf/operator.py", "identifier": "_reduce", "docstring": "Finds the first operator in the list, converts it and its operands to a OptreeNode, then\n  returns a new list with the operator and operands replaced by the new OptreeNode.", "docstring_tokens": ["Finds", "the", "first", "operator", "in", "the", "list", "converts", "it", "and", "its", "operands", "to", "a", "OptreeNode", "then", "returns", "a", "new", "list", "with", "the", "operator", "and", "operands", "replaced", "by", "the", "new", "OptreeNode", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 257124}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_sha.py#L30-L61", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Convert a long integer to a byte string.", "language": "python", "parameters": "(n, blocksize=0)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "b''", "arg_3", "=", "struct", ".", "pack", "while", "arg_0", ">", "0", ":", "arg_2", "=", "arg_3", "(", "'>I'", ",", "arg_0", "&", "0xffffffff", ")", "+", "arg_2", "arg_0", "=", "arg_0", ">>", "32", "for", "arg_4", "in", "range", "(", "len", "(", "arg_2", ")", ")", ":", "if", "arg_2", "[", "arg_4", "]", "!=", "'\\000'", ":", "break", "else", ":", "arg_2", "=", "'\\000'", "arg_4", "=", "0", "arg_2", "=", "arg_2", "[", "arg_4", ":", "]", "if", "arg_1", ">", "0", "and", "len", "(", "arg_2", ")", "%", "arg_1", ":", "arg_2", "=", "(", "arg_1", "-", "len", "(", "arg_2", ")", "%", "arg_1", ")", "*", "'\\000'", "+", "arg_2", "return", "arg_2"], "function": "def Func(arg_0, arg_1=0):\n    \"\"\"Convert a long integer to a byte string.\n\n    If optional blocksize is given and greater than zero, pad the front\n    of the byte string with binary zeros so that the length is a multiple\n    of blocksize.\n    \"\"\"\n\n    # After much testing, this algorithm was deemed to be the fastest.\n    arg_2 = b''\n    arg_3 = struct.pack\n    while arg_0 > 0:\n        arg_2 = arg_3('>I', arg_0 & 0xffffffff) + arg_2\n        arg_0 = arg_0 >> 32\n\n    # Strip off leading zeros.\n    for arg_4 in range(len(arg_2)):\n        if arg_2[arg_4] != '\\000':\n            break\n    else:\n        # Only happens when n == 0.\n        arg_2 = '\\000'\n        arg_4 = 0\n\n    arg_2 = arg_2[arg_4:]\n\n    # Add back some pad bytes. This could be done more efficiently\n    # w.r.t. the de-padding being done above, but sigh...\n    if arg_1 > 0 and len(arg_2) % arg_1:\n        arg_2 = (arg_1 - len(arg_2) % arg_1) * '\\000' + arg_2\n\n    return arg_2", "path": "third_party/pypy/_sha.py", "identifier": "_long2bytesBigEndian", "docstring": "Convert a long integer to a byte string.\n\n    If optional blocksize is given and greater than zero, pad the front\n    of the byte string with binary zeros so that the length is a multiple\n    of blocksize.", "docstring_tokens": ["Convert", "a", "long", "integer", "to", "a", "byte", "string", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257125}
{"url": "https://github.com/glottobank/python-newick/blob/e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702/src/newick.py#L321-L333", "sha": "e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702", "docstring_summary": "Insert additional nodes with length=0 into the subtree in such a way\n        that all non-leaf nodes have only 2 descendants, i.e. the tree becomes\n        a fully resolved binary tree.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_Func", "(", "arg_1", ")", ":", "arg_2", "=", "Node", "(", "length", "=", "arg_0", ".", "_length_formatter", "(", "arg_0", ".", "_length_parser", "(", "'0'", ")", ")", ")", "while", "len", "(", "arg_1", ".", "descendants", ")", ">", "1", ":", "arg_2", ".", "add_descendant", "(", "arg_1", ".", "descendants", ".", "pop", "(", ")", ")", "arg_1", ".", "descendants", ".", "append", "(", "arg_2", ")", "arg_0", ".", "visit", "(", "_Func", ",", "lambda", "arg_1", ":", "len", "(", "arg_1", ".", "descendants", ")", ">", "2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Insert additional nodes with length=0 into the subtree in such a way\n        that all non-leaf nodes have only 2 descendants, i.e. the tree becomes\n        a fully resolved binary tree.\n        \"\"\"\n        def _Func(arg_1):\n            arg_2 = Node(length=arg_0._length_formatter(arg_0._length_parser('0')))\n            while len(arg_1.descendants) > 1:\n                arg_2.add_descendant(arg_1.descendants.pop())\n            arg_1.descendants.append(arg_2)\n\n        arg_0.visit(_Func, lambda arg_1: len(arg_1.descendants) > 2)", "path": "src/newick.py", "identifier": "Node.resolve_polytomies", "docstring": "Insert additional nodes with length=0 into the subtree in such a way\n        that all non-leaf nodes have only 2 descendants, i.e. the tree becomes\n        a fully resolved binary tree.", "docstring_tokens": ["Insert", "additional", "nodes", "with", "length", "=", "0", "into", "the", "subtree", "in", "such", "a", "way", "that", "all", "non", "-", "leaf", "nodes", "have", "only", "2", "descendants", "i", ".", "e", ".", "the", "tree", "becomes", "a", "fully", "resolved", "binary", "tree", "."], "nwo": "glottobank/python-newick", "score": 0.19358971820395612, "idx": 257126}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/collection/funcs.py#L21-L30", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "call each func from reversed func list.", "language": "python", "parameters": "(funcs: list, *args, **kwargs)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "None", "for", "arg_5", "in", "reversed", "(", "arg_0", ")", ":", "arg_4", "=", "arg_5", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0: arg_1, *arg_2, **arg_3):\n    '''\n    call each func from reversed func list.\n\n    return the last func value or None if func list is empty.\n    '''\n    arg_4 = None\n    for arg_5 in reversed(arg_0):\n        arg_4 = arg_5(*arg_2, **arg_3)\n    return arg_4", "path": "jasily/collection/funcs.py", "identifier": "call_each_reversed", "docstring": "call each func from reversed func list.\n\n    return the last func value or None if func list is empty.", "docstring_tokens": ["call", "each", "func", "from", "reversed", "func", "list", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 257127}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L681-L694", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Validates API Root information. Raises errors for required\n        properties.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_title", ":", "arg_1", "=", "\"No 'title' in API Root for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "not", "arg_0", ".", "_versions", ":", "arg_1", "=", "\"No 'versions' in API Root for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "_max_content_length", "is", "None", ":", "arg_1", "=", "\"No 'max_content_length' in API Root for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Validates API Root information. Raises errors for required\n        properties.\"\"\"\n        if not arg_0._title:\n            arg_1 = \"No 'title' in API Root for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if not arg_0._versions:\n            arg_1 = \"No 'versions' in API Root for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0._max_content_length is None:\n            arg_1 = \"No 'max_content_length' in API Root for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))", "path": "taxii2client/__init__.py", "identifier": "ApiRoot._validate_api_root", "docstring": "Validates API Root information. Raises errors for required\n        properties.", "docstring_tokens": ["Validates", "API", "Root", "information", ".", "Raises", "errors", "for", "required", "properties", "."], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 257128}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L897-L954", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "This method schedules the tasks for a single DAG by looking at the\n        active DAG runs and adding task instances that should run to the\n        queue.", "language": "python", "parameters": "(self, dag, queue, session=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "DagRun", ".", "find", "(", "dag_id", "=", "arg_1", ".", "dag_id", ",", "state", "=", "State", ".", "RUNNING", ",", "arg_3", "=", "arg_3", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_4", ":", "arg_0", ".", "log", ".", "info", "(", "\"Examining DAG run %s\"", ",", "arg_6", ")", "if", "arg_6", ".", "execution_date", ">", "timezone", ".", "utcnow", "(", ")", ":", "arg_0", ".", "log", ".", "error", "(", "\"Execution date is in future: %s\"", ",", "arg_6", ".", "execution_date", ")", "continue", "if", "len", "(", "arg_5", ")", ">=", "arg_1", ".", "max_active_runs", ":", "arg_0", ".", "log", ".", "info", "(", "\"Number of active dag runs reached max_active_run.\"", ")", "break", "if", "arg_6", ".", "is_backfill", ":", "continue", "arg_6", ".", "dag", "=", "arg_1", "arg_6", ".", "verify_integrity", "(", "arg_3", "=", "arg_3", ")", "arg_6", ".", "update_state", "(", "arg_3", "=", "arg_3", ")", "if", "arg_6", ".", "state", "==", "State", ".", "RUNNING", ":", "make_transient", "(", "arg_6", ")", "arg_5", ".", "append", "(", "arg_6", ")", "for", "arg_6", "in", "arg_5", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Examining active DAG run: %s\"", ",", "arg_6", ")", "arg_7", "=", "arg_6", ".", "get_task_instances", "(", "state", "=", "(", "State", ".", "NONE", ",", "State", ".", "UP_FOR_RETRY", ",", "State", ".", "UP_FOR_RESCHEDULE", ")", ")", "for", "arg_8", "in", "arg_7", ":", "arg_9", "=", "arg_1", ".", "get_task", "(", "arg_8", ".", "task_id", ")", "arg_8", ".", "task", "=", "arg_9", "if", "arg_8", ".", "are_dependencies_met", "(", "dep_context", "=", "DepContext", "(", "flag_upstream_failed", "=", "True", ")", ",", "arg_3", "=", "arg_3", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "'Queuing task: %s'", ",", "arg_8", ")", "arg_2", ".", "append", "(", "arg_8", ".", "key", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        This method schedules the tasks for a single DAG by looking at the\n        active DAG runs and adding task instances that should run to the\n        queue.\n        \"\"\"\n\n        # update the state of the previously active dag runs\n        arg_4 = DagRun.find(dag_id=arg_1.dag_id, state=State.RUNNING, arg_3=arg_3)\n        arg_5 = []\n        for arg_6 in arg_4:\n            arg_0.log.info(\"Examining DAG run %s\", arg_6)\n            # don't consider runs that are executed in the future\n            if arg_6.execution_date > timezone.utcnow():\n                arg_0.log.error(\n                    \"Execution date is in future: %s\",\n                    arg_6.execution_date\n                )\n                continue\n\n            if len(arg_5) >= arg_1.max_active_runs:\n                arg_0.log.info(\"Number of active dag runs reached max_active_run.\")\n                break\n\n            # skip backfill dagruns for now as long as they are not really scheduled\n            if arg_6.is_backfill:\n                continue\n\n            # todo: run.dag is transient but needs to be set\n            arg_6.dag = arg_1\n            # todo: preferably the integrity check happens at dag collection time\n            arg_6.verify_integrity(arg_3=arg_3)\n            arg_6.update_state(arg_3=arg_3)\n            if arg_6.state == State.RUNNING:\n                make_transient(arg_6)\n                arg_5.append(arg_6)\n\n        for arg_6 in arg_5:\n            arg_0.log.debug(\"Examining active DAG run: %s\", arg_6)\n            # this needs a fresh session sometimes tis get detached\n            arg_7 = arg_6.get_task_instances(state=(State.NONE,\n                                                State.UP_FOR_RETRY,\n                                                State.UP_FOR_RESCHEDULE))\n\n            # this loop is quite slow as it uses are_dependencies_met for\n            # every task (in ti.is_runnable). This is also called in\n            # update_state above which has already checked these tasks\n            for arg_8 in arg_7:\n                arg_9 = arg_1.get_task(arg_8.task_id)\n\n                # fixme: ti.task is transient but needs to be set\n                arg_8.task = arg_9\n\n                if arg_8.are_dependencies_met(\n                        dep_context=DepContext(flag_upstream_failed=True),\n                        arg_3=arg_3):\n                    arg_0.log.debug('Queuing task: %s', arg_8)\n                    arg_2.append(arg_8.key)", "path": "airflow/jobs.py", "identifier": "SchedulerJob._process_task_instances", "docstring": "This method schedules the tasks for a single DAG by looking at the\n        active DAG runs and adding task instances that should run to the\n        queue.", "docstring_tokens": ["This", "method", "schedules", "the", "tasks", "for", "a", "single", "DAG", "by", "looking", "at", "the", "active", "DAG", "runs", "and", "adding", "task", "instances", "that", "should", "run", "to", "the", "queue", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257129}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/scripts.py#L247-L256", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Print an error message and exit.", "language": "python", "parameters": "(msg, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "print", "(", "arg_0", "%", "arg_1", ",", "file", "=", "sys", ".", "stderr", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, *arg_1):\n    \"\"\"\n    Print an error message and exit.\n\n    :param msg: A message to print\n    :type msg: str\n\n    \"\"\"\n    print(arg_0 % arg_1, file=sys.stderr)\n    sys.exit(1)", "path": "pyconfig/scripts.py", "identifier": "_error", "docstring": "Print an error message and exit.\n\n    :param msg: A message to print\n    :type msg: str", "docstring_tokens": ["Print", "an", "error", "message", "and", "exit", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 257130}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/stores.py#L37-L70", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Add a new store to your MailChimp account.", "language": "python", "parameters": "(self, data)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'id'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The store must have an id'", ")", "if", "'list_id'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The store must have a list_id'", ")", "if", "'name'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The store must have a name'", ")", "if", "'currency_code'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The store must have a currency_code'", ")", "if", "not", "re", ".", "match", "(", "r\"^[A-Z]{3}$\"", ",", "arg_1", "[", "'currency_code'", "]", ")", ":", "raise", "ValueError", "(", "'The currency_code must be a valid 3-letter ISO 4217 currency code'", ")", "arg_2", "=", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", ")", ",", "arg_1", "=", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "store_id", "=", "arg_2", "[", "'id'", "]", "else", ":", "arg_0", ".", "store_id", "=", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add a new store to your MailChimp account.\n\n        Error checking on the currency code verifies that it is in the correct\n        three-letter, all-caps format as specified by ISO 4217 but does not\n        check that it is a valid code as the list of valid codes changes over\n        time.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"list_id\": string*,\n            \"name\": string*,\n            \"currency_code\": string*\n        }\n        \"\"\"\n        if 'id' not in arg_1:\n            raise KeyError('The store must have an id')\n        if 'list_id' not in arg_1:\n            raise KeyError('The store must have a list_id')\n        if 'name' not in arg_1:\n            raise KeyError('The store must have a name')\n        if 'currency_code' not in arg_1:\n            raise KeyError('The store must have a currency_code')\n        if not re.match(r\"^[A-Z]{3}$\", arg_1['currency_code']):\n            raise ValueError('The currency_code must be a valid 3-letter ISO 4217 currency code')\n        arg_2 = arg_0._mc_client._post(url=arg_0._build_path(), arg_1=arg_1)\n        if arg_2 is not None:\n            arg_0.store_id = arg_2['id']\n        else:\n            arg_0.store_id = None\n        return arg_2", "path": "mailchimp3/entities/stores.py", "identifier": "Stores.create", "docstring": "Add a new store to your MailChimp account.\n\n        Error checking on the currency code verifies that it is in the correct\n        three-letter, all-caps format as specified by ISO 4217 but does not\n        check that it is a valid code as the list of valid codes changes over\n        time.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"list_id\": string*,\n            \"name\": string*,\n            \"currency_code\": string*\n        }", "docstring_tokens": ["Add", "a", "new", "store", "to", "your", "MailChimp", "account", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 257131}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/cholesky.py#L49-L105", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Solve linear system `AX=B` using CHOLESKY method.", "language": "python", "parameters": "(A, B, method='scipy')", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'scipy'", ")", ":", "if", "arg_2", "==", "'numpy_solver'", ":", "arg_3", "=", "_numpy_solver", "(", "arg_0", ",", "arg_1", ")", "return", "arg_3", "elif", "arg_2", "==", "'numpy'", ":", "arg_3", ",", "arg_4", "=", "_numpy_cholesky", "(", "arg_0", ",", "arg_1", ")", "return", "arg_3", "elif", "arg_2", "==", "'scipy'", ":", "import", "scipy", ".", "linalg", "arg_5", "=", "scipy", ".", "linalg", ".", "cholesky", "(", "arg_0", ")", "arg_3", "=", "scipy", ".", "linalg", ".", "cho_solve", "(", "(", "arg_5", ",", "False", ")", ",", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "'method must be numpy_solver, numpy_cholesky or cholesky_inplace'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2='scipy'):\n    \"\"\"Solve linear system `AX=B` using Func method.\n\n    :param A: an input Hermitian matrix\n    :param B: an array\n    :param str method: a choice of method in [numpy, scipy, numpy_solver]\n\n        * `numpy_solver` relies entirely on numpy.solver (no cholesky decomposition)\n        * `numpy` relies on the numpy.linalg.cholesky for the decomposition and\n          numpy.linalg.solve for the inversion.\n        * `scipy` uses scipy.linalg.cholesky for the decomposition and\n          scipy.linalg.cho_solve for the inversion.\n\n    .. rubric:: Description\n\n    When a matrix is square and Hermitian (symmetric with lower part being\n    the complex conjugate of the upper one), then the usual triangular\n    factorization takes on the special form:\n\n    .. math:: A = R R^H\n\n    where :math:`R` is a lower triangular matrix with nonzero real principal\n    diagonal element. The input matrix can be made of complex data. Then, the\n    inversion to find :math:`x` is made as follows:\n\n    .. math::  Ry = B\n\n    and\n\n    .. math::   Rx = y\n\n    .. doctest::\n\n        >>> import numpy\n        >>> from spectrum import Func\n        >>> A = numpy.array([[ 2.0+0.j ,  0.5-0.5j, -0.2+0.1j],\n        ...    [ 0.5+0.5j,  1.0+0.j ,  0.3-0.2j],\n        ...    [-0.2-0.1j,  0.3+0.2j,  0.5+0.j ]])\n        >>> B = numpy.array([ 1.0+3.j ,  2.0-1.j ,  0.5+0.8j])\n        >>> Func(A, B)\n        array([ 0.95945946+5.25675676j,  4.41891892-7.04054054j,\n               -5.13513514+6.35135135j])\n\n    \"\"\"\n    if arg_2 == 'numpy_solver':\n        arg_3 = _numpy_solver(arg_0,arg_1)\n        return arg_3\n    elif arg_2 == 'numpy':\n        arg_3, arg_4 = _numpy_cholesky(arg_0, arg_1)\n        return arg_3\n    elif arg_2 == 'scipy':\n        import scipy.linalg\n        arg_5 = scipy.linalg.cholesky(arg_0)\n        arg_3 = scipy.linalg.cho_solve((arg_5, False), arg_1)\n    else:\n        raise ValueError('method must be numpy_solver, numpy_cholesky or cholesky_inplace')\n    return arg_3", "path": "src/spectrum/cholesky.py", "identifier": "CHOLESKY", "docstring": "Solve linear system `AX=B` using CHOLESKY method.\n\n    :param A: an input Hermitian matrix\n    :param B: an array\n    :param str method: a choice of method in [numpy, scipy, numpy_solver]\n\n        * `numpy_solver` relies entirely on numpy.solver (no cholesky decomposition)\n        * `numpy` relies on the numpy.linalg.cholesky for the decomposition and\n          numpy.linalg.solve for the inversion.\n        * `scipy` uses scipy.linalg.cholesky for the decomposition and\n          scipy.linalg.cho_solve for the inversion.\n\n    .. rubric:: Description\n\n    When a matrix is square and Hermitian (symmetric with lower part being\n    the complex conjugate of the upper one), then the usual triangular\n    factorization takes on the special form:\n\n    .. math:: A = R R^H\n\n    where :math:`R` is a lower triangular matrix with nonzero real principal\n    diagonal element. The input matrix can be made of complex data. Then, the\n    inversion to find :math:`x` is made as follows:\n\n    .. math::  Ry = B\n\n    and\n\n    .. math::   Rx = y\n\n    .. doctest::\n\n        >>> import numpy\n        >>> from spectrum import CHOLESKY\n        >>> A = numpy.array([[ 2.0+0.j ,  0.5-0.5j, -0.2+0.1j],\n        ...    [ 0.5+0.5j,  1.0+0.j ,  0.3-0.2j],\n        ...    [-0.2-0.1j,  0.3+0.2j,  0.5+0.j ]])\n        >>> B = numpy.array([ 1.0+3.j ,  2.0-1.j ,  0.5+0.8j])\n        >>> CHOLESKY(A, B)\n        array([ 0.95945946+5.25675676j,  4.41891892-7.04054054j,\n               -5.13513514+6.35135135j])", "docstring_tokens": ["Solve", "linear", "system", "AX", "=", "B", "using", "CHOLESKY", "method", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 257132}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/optim/optimizer.py#L1062-L1071", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Set the interval of recording for each indicator.", "language": "python", "parameters": "(self, name, trigger)", "return_statement": "return callBigDlFunc(self.bigdl_type, \"summarySetTrigger\", self.value,\n                             name, trigger)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "callBigDlFunc", "(", "arg_0", ".", "bigdl_type", ",", "\"summarySetTrigger\"", ",", "arg_0", ".", "value", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set the interval of recording for each indicator.\n\n\n        :param tag: tag name. Supported tag names are \"LearningRate\", \"Loss\",\"Throughput\", \"Parameters\". \"Parameters\" is an umbrella tag thatincludes weight, bias, gradWeight, gradBias, and some running status(eg. runningMean and runningVar in BatchNormalization). If youdidn't set any triggers, we will by default record Loss and Throughputin each iteration, while *NOT* recording LearningRate and Parameters,as recording parameters may introduce substantial overhead when themodel is very big, LearningRate is not a public attribute for allOptimMethod.\n        :param trigger: trigger\n        \"\"\"\n        return callBigDlFunc(arg_0.bigdl_type, \"summarySetTrigger\", arg_0.value,\n                             arg_1, arg_2)", "path": "pyspark/bigdl/optim/optimizer.py", "identifier": "TrainSummary.set_summary_trigger", "docstring": "Set the interval of recording for each indicator.\n\n\n        :param tag: tag name. Supported tag names are \"LearningRate\", \"Loss\",\"Throughput\", \"Parameters\". \"Parameters\" is an umbrella tag thatincludes weight, bias, gradWeight, gradBias, and some running status(eg. runningMean and runningVar in BatchNormalization). If youdidn't set any triggers, we will by default record Loss and Throughputin each iteration, while *NOT* recording LearningRate and Parameters,as recording parameters may introduce substantial overhead when themodel is very big, LearningRate is not a public attribute for allOptimMethod.\n        :param trigger: trigger", "docstring_tokens": ["Set", "the", "interval", "of", "recording", "for", "each", "indicator", "."], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 257133}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/utils.py#L45-L77", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Initialize an object from dict.", "language": "python", "parameters": "(info, parent=None, default_args=None)", "return_statement": "return obj_type(**args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "dict", ")", "and", "'type'", "in", "arg_0", "assert", "isinstance", "(", "arg_2", ",", "dict", ")", "or", "arg_2", "is", "None", "arg_3", "=", "arg_0", ".", "copy", "(", ")", "arg_4", "=", "arg_3", ".", "pop", "(", "'type'", ")", "if", "mmcv", ".", "is_str", "(", "arg_4", ")", ":", "if", "arg_1", "is", "not", "None", ":", "arg_4", "=", "getattr", "(", "arg_1", ",", "arg_4", ")", "else", ":", "arg_4", "=", "sys", ".", "modules", "[", "arg_4", "]", "elif", "not", "isinstance", "(", "arg_4", ",", "type", ")", ":", "raise", "TypeError", "(", "'type must be a str or valid type, but got {}'", ".", "format", "(", "type", "(", "arg_4", ")", ")", ")", "if", "arg_2", "is", "not", "None", ":", "for", "arg_5", ",", "arg_6", "in", "arg_2", ".", "items", "(", ")", ":", "arg_3", ".", "setdefault", "(", "arg_5", ",", "arg_6", ")", "return", "arg_4", "(", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Initialize an object from dict.\n\n    The dict must contain the key \"type\", which indicates the object type, it\n    can be either a string or type, such as \"list\" or ``list``. Remaining\n    fields are treated as the arguments for constructing the object.\n\n    Args:\n        info (dict): Object types and arguments.\n        parent (:class:`module`): Module which may containing expected object\n            classes.\n        default_args (dict, optional): Default arguments for initializing the\n            object.\n\n    Returns:\n        any type: Object built from the dict.\n    \"\"\"\n    assert isinstance(arg_0, dict) and 'type' in arg_0\n    assert isinstance(arg_2, dict) or arg_2 is None\n    arg_3 = arg_0.copy()\n    arg_4 = arg_3.pop('type')\n    if mmcv.is_str(arg_4):\n        if arg_1 is not None:\n            arg_4 = getattr(arg_1, arg_4)\n        else:\n            arg_4 = sys.modules[arg_4]\n    elif not isinstance(arg_4, type):\n        raise TypeError('type must be a str or valid type, but got {}'.format(\n            type(arg_4)))\n    if arg_2 is not None:\n        for arg_5, arg_6 in arg_2.items():\n            arg_3.setdefault(arg_5, arg_6)\n    return arg_4(**arg_3)", "path": "mmcv/runner/utils.py", "identifier": "obj_from_dict", "docstring": "Initialize an object from dict.\n\n    The dict must contain the key \"type\", which indicates the object type, it\n    can be either a string or type, such as \"list\" or ``list``. Remaining\n    fields are treated as the arguments for constructing the object.\n\n    Args:\n        info (dict): Object types and arguments.\n        parent (:class:`module`): Module which may containing expected object\n            classes.\n        default_args (dict, optional): Default arguments for initializing the\n            object.\n\n    Returns:\n        any type: Object built from the dict.", "docstring_tokens": ["Initialize", "an", "object", "from", "dict", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 257134}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/interfaces/server.py#L61-L78", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Called when a dangerous action is about to be done to make sure\n        it's okay. `prompt' is printed; user response is returned.", "language": "python", "parameters": "(self, prompt, default)", "return_statement": "return default", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "while", "True", ":", "try", ":", "arg_0", ".", "write_Func", "(", "arg_1", ",", "arg_2", ")", "arg_3", "=", "arg_0", ".", "readline", "(", "''", ")", ".", "strip", "(", ")", ".", "lower", "(", ")", "except", "EOFError", ":", "return", "arg_2", "if", "arg_3", "in", "(", "'y'", ",", "'yes'", ")", ":", "return", "True", "elif", "arg_3", "in", "(", "'n'", ",", "'no'", ")", ":", "return", "False", "else", ":", "arg_0", ".", "msg", "(", "\"Please answer y or n.\"", ")", "pass", "pass", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Called when a dangerous action is about to be done to make sure\n        it's okay. `prompt' is printed; user response is returned.\"\"\"\n        while True:\n            try:\n                arg_0.write_Func(arg_1, arg_2)\n                arg_3 = arg_0.readline('').strip().lower()\n            except EOFError:\n                return arg_2\n            if arg_3 in ('y', 'yes'):\n                return True\n            elif arg_3 in ('n', 'no'):\n                return False\n            else:\n                arg_0.msg(\"Please answer y or n.\")\n                pass\n            pass\n        return arg_2", "path": "trepan/interfaces/server.py", "identifier": "ServerInterface.confirm", "docstring": "Called when a dangerous action is about to be done to make sure\n        it's okay. `prompt' is printed; user response is returned.", "docstring_tokens": ["Called", "when", "a", "dangerous", "action", "is", "about", "to", "be", "done", "to", "make", "sure", "it", "s", "okay", ".", "prompt", "is", "printed", ";", "user", "response", "is", "returned", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 257135}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/experiment_runner.py#L540-L549", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Get checkpoint parent dir.", "language": "python", "parameters": "(experimentDir)", "return_statement": "return baseDir", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "\"savedmodels\"", ")", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Get checkpoint parent dir.\n\n  Returns: absolute path to the base serialization directory within which\n      model checkpoints for this experiment are created\n  \"\"\"\n  arg_1 = os.path.join(arg_0, \"savedmodels\")\n  arg_1 = os.path.abspath(arg_1)\n\n  return arg_1", "path": "src/nupic/frameworks/opf/experiment_runner.py", "identifier": "getCheckpointParentDir", "docstring": "Get checkpoint parent dir.\n\n  Returns: absolute path to the base serialization directory within which\n      model checkpoints for this experiment are created", "docstring_tokens": ["Get", "checkpoint", "parent", "dir", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257136}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py#L66-L101", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Called when the up key is pressed. Returns whether to continue\n            processing the event.", "language": "python", "parameters": "(self, shift_modifier)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_prompt_cursor", "(", ")", "if", "arg_0", ".", "_get_cursor", "(", ")", ".", "blockNumber", "(", ")", "==", "arg_2", ".", "blockNumber", "(", ")", ":", "if", "arg_0", ".", "_history_locked", "(", ")", "and", "not", "arg_1", ":", "return", "False", "arg_3", "=", "arg_0", ".", "_get_input_buffer_cursor_column", "(", ")", "arg_4", "=", "arg_0", ".", "input_buffer", "if", "arg_0", ".", "_history_index", "==", "len", "(", "arg_0", ".", "_history", ")", "or", "(", "arg_0", ".", "_history_prefix", "and", "arg_3", "!=", "len", "(", "arg_0", ".", "_history_prefix", ")", ")", ":", "arg_0", ".", "_history_index", "=", "len", "(", "arg_0", ".", "_history", ")", "arg_0", ".", "_history_prefix", "=", "arg_4", "[", ":", "arg_3", "]", "arg_0", ".", "history_previous", "(", "arg_0", ".", "_history_prefix", ",", "as_prefix", "=", "not", "arg_1", ")", "arg_7", "=", "arg_0", ".", "_get_prompt_cursor", "(", ")", "if", "arg_0", ".", "_history_prefix", ":", "arg_7", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "Right", ",", "n", "=", "len", "(", "arg_0", ".", "_history_prefix", ")", ")", "else", ":", "arg_7", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "EndOfLine", ")", "arg_0", ".", "_set_cursor", "(", "arg_7", ")", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Called when the up key is pressed. Returns whether to continue\n            processing the event.\n        \"\"\"\n        arg_2 = arg_0._get_prompt_cursor()\n        if arg_0._get_cursor().blockNumber() == arg_2.blockNumber():\n            # Bail out if we're locked.\n            if arg_0._history_locked() and not arg_1:\n                return False\n\n            # Set a search prefix based on the cursor position.\n            arg_3 = arg_0._get_input_buffer_cursor_column()\n            arg_4 = arg_0.input_buffer\n            if arg_0._history_index == len(arg_0._history) or \\\n                    (arg_0._history_prefix and arg_3 != len(arg_0._history_prefix)):\n                arg_0._history_index = len(arg_0._history)\n                arg_0._history_prefix = arg_4[:arg_3]\n\n            # Perform the search.\n            arg_0.history_previous(arg_0._history_prefix,\n                                    as_prefix=not arg_1)\n\n            # Go to the first line of the prompt for seemless history scrolling.\n            # Emulate readline: keep the cursor position fixed for a prefix\n            # search.\n            arg_7 = arg_0._get_prompt_cursor()\n            if arg_0._history_prefix:\n                arg_7.movePosition(QtGui.QTextCursor.Right,\n                                    n=len(arg_0._history_prefix))\n            else:\n                arg_7.movePosition(QtGui.QTextCursor.EndOfLine)\n            arg_0._set_cursor(arg_7)\n\n            return False\n\n        return True", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py", "identifier": "HistoryConsoleWidget._up_pressed", "docstring": "Called when the up key is pressed. Returns whether to continue\n            processing the event.", "docstring_tokens": ["Called", "when", "the", "up", "key", "is", "pressed", ".", "Returns", "whether", "to", "continue", "processing", "the", "event", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257137}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/runner.py#L620-L651", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Workhorse for translating particles. See get_particles_featuring for docs.", "language": "python", "parameters": "(s, max_mem=1e9, desc='', min_rad='calc',\n        max_rad='calc', invert='guess', rz_order=0, do_polish=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1e9", ",", "arg_2", "=", "''", ",", "arg_3", "=", "'calc'", ",", "arg_4", "=", "'calc'", ",", "arg_5", "=", "'guess'", ",", "arg_6", "=", "0", ",", "arg_7", "=", "True", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_8", "=", "arg_2", "+", "'translate-particles'", "arg_9", "=", "arg_2", "+", "'addsub_burn'", "arg_10", "=", "arg_2", "+", "'addsub_polish'", "else", ":", "arg_8", ",", "arg_9", ",", "arg_10", "=", "[", "None", "]", "*", "3", "RLOG", ".", "info", "(", "'Translate Particles:'", ")", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'do-particles'", ",", "n_loop", "=", "4", ",", "fractol", "=", "0.1", ",", "arg_2", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", "include_rad", "=", "False", ",", "dowarn", "=", "False", ")", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'do-particles'", ",", "n_loop", "=", "4", ",", "fractol", "=", "0.05", ",", "arg_2", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", "include_rad", "=", "True", ",", "dowarn", "=", "False", ")", "RLOG", ".", "info", "(", "'Start add-subtract'", ")", "addsub", ".", "add_subtract", "(", "arg_0", ",", "tries", "=", "30", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "if", "arg_2", "is", "not", "None", ":", "states", ".", "save", "(", "arg_0", ",", "arg_2", "=", "arg_2", "+", "'translate-addsub'", ")", "if", "arg_7", ":", "RLOG", ".", "info", "(", "'Final Burn:'", ")", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'burn'", ",", "n_loop", "=", "3", ",", "fractol", "=", "3e-4", ",", "arg_2", "=", "arg_9", ",", "arg_1", "=", "arg_1", ",", "arg_6", "=", "arg_6", ",", "dowarn", "=", "False", ")", "RLOG", ".", "info", "(", "'Final Polish:'", ")", "arg_11", "=", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'polish'", ",", "n_loop", "=", "4", ",", "fractol", "=", "3e-4", ",", "arg_2", "=", "arg_10", ",", "arg_1", "=", "arg_1", ",", "arg_6", "=", "arg_6", ",", "dowarn", "=", "False", ")", "if", "not", "arg_11", "[", "'converged'", "]", ":", "RLOG", ".", "warn", "(", "'Optimization did not converge; consider re-running'", ")"], "function": "def Func(arg_0, arg_1=1e9, arg_2='', arg_3='calc',\n        arg_4='calc', arg_5='guess', arg_6=0, arg_7=True):\n    \"\"\"\n    Workhorse for translating particles. See get_particles_featuring for docs.\n    \"\"\"\n    if arg_2 is not None:\n        arg_8 = arg_2 + 'translate-particles'\n        arg_9 = arg_2 + 'addsub_burn'\n        arg_10 = arg_2 + 'addsub_polish'\n    else:\n        arg_8, arg_9, arg_10 = [None]*3\n    RLOG.info('Translate Particles:')\n    opt.burn(arg_0, mode='do-particles', n_loop=4, fractol=0.1, arg_2=arg_8,\n            arg_1=arg_1, include_rad=False, dowarn=False)\n    opt.burn(arg_0, mode='do-particles', n_loop=4, fractol=0.05, arg_2=arg_8,\n            arg_1=arg_1, include_rad=True, dowarn=False)\n\n    RLOG.info('Start add-subtract')\n    addsub.add_subtract(arg_0, tries=30, arg_3=arg_3, arg_4=arg_4,\n        arg_5=arg_5)\n    if arg_2 is not None:\n        states.save(arg_0, arg_2=arg_2 + 'translate-addsub')\n\n    if arg_7:\n        RLOG.info('Final Burn:')\n        opt.burn(arg_0, mode='burn', n_loop=3, fractol=3e-4, arg_2=arg_9,\n                arg_1=arg_1, arg_6=arg_6,dowarn=False)\n        RLOG.info('Final Polish:')\n        arg_11 = opt.burn(arg_0, mode='polish', n_loop=4, fractol=3e-4, arg_2=arg_10,\n                arg_1=arg_1, arg_6=arg_6, dowarn=False)\n        if not arg_11['converged']:\n            RLOG.warn('Optimization did not converge; consider re-running')", "path": "peri/runner.py", "identifier": "_translate_particles", "docstring": "Workhorse for translating particles. See get_particles_featuring for docs.", "docstring_tokens": ["Workhorse", "for", "translating", "particles", ".", "See", "get_particles_featuring", "for", "docs", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 257138}
{"url": "https://github.com/openpermissions/bass/blob/fb606d3804e1f86b90253b25363bdfa8758ccf39/bass/hubkey.py#L81-L99", "sha": "fb606d3804e1f86b90253b25363bdfa8758ccf39", "docstring_summary": "Parse a hub key into a dictionary of component parts", "language": "python", "parameters": "(key)", "return_statement": "return dict(zip(PARTS.keys(), match.groups()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "raise", "ValueError", "(", "'Not a valid key'", ")", "arg_1", "=", "re", ".", "match", "(", "PATTERN", ",", "arg_0", ")", "if", "not", "arg_1", ":", "arg_1", "=", "re", ".", "match", "(", "PATTERN_S0", ",", "arg_0", ")", "if", "not", "arg_1", ":", "raise", "ValueError", "(", "'Not a valid key'", ")", "return", "dict", "(", "map", "(", "normalise_part", ",", "zip", "(", "[", "arg_2", "for", "arg_2", "in", "PARTS_S0", ".", "keys", "(", ")", "]", ",", "arg_1", ".", "groups", "(", ")", ")", ")", ")", "return", "dict", "(", "zip", "(", "PARTS", ".", "keys", "(", ")", ",", "arg_1", ".", "groups", "(", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Parse a hub key into a dictionary of component parts\n\n    :param key: str, a hub key\n    :returns: dict, hub key split into parts\n    :raises: ValueError\n    \"\"\"\n    if arg_0 is None:\n        raise ValueError('Not a valid key')\n\n    arg_1 = re.match(PATTERN, arg_0)\n    if not arg_1:\n        arg_1 = re.match(PATTERN_S0, arg_0)\n        if not arg_1:\n            raise ValueError('Not a valid key')\n\n        return dict(map(normalise_part, zip([arg_2 for arg_2 in PARTS_S0.keys()], arg_1.groups())))\n\n    return dict(zip(PARTS.keys(), arg_1.groups()))", "path": "bass/hubkey.py", "identifier": "parse_hub_key", "docstring": "Parse a hub key into a dictionary of component parts\n\n    :param key: str, a hub key\n    :returns: dict, hub key split into parts\n    :raises: ValueError", "docstring_tokens": ["Parse", "a", "hub", "key", "into", "a", "dictionary", "of", "component", "parts"], "nwo": "openpermissions/bass", "score": 0.0, "idx": 257139}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L314-L343", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return all causative variants for an institute", "language": "python", "parameters": "(self, institute_id, case_id=None)", "return_statement": "return causatives", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "]", "if", "arg_2", ":", "arg_4", "=", "arg_0", ".", "case_collection", ".", "find_one", "(", "{", "\"_id\"", ":", "arg_2", "}", ")", "arg_3", "=", "[", "causative", "for", "causative", "in", "arg_4", "[", "'causatives'", "]", "]", "elif", "arg_1", ":", "arg_5", "=", "arg_0", ".", "case_collection", ".", "aggregate", "(", "[", "{", "'$match'", ":", "{", "'collaborators'", ":", "arg_1", ",", "'causatives'", ":", "{", "'$exists'", ":", "True", "}", "}", "}", ",", "{", "'$unwind'", ":", "'$causatives'", "}", ",", "{", "'$group'", ":", "{", "'_id'", ":", "'$causatives'", "}", "}", "]", ")", "arg_3", "=", "[", "item", "[", "'_id'", "]", "for", "item", "in", "arg_5", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Return all causative variants for an institute\n\n            Args:\n                institute_id(str)\n                case_id(str)\n\n            Yields:\n                str: variant document id\n        \"\"\"\n\n        arg_3 = []\n\n        if arg_2:\n\n            arg_4 = arg_0.case_collection.find_one(\n                    {\"_id\": arg_2}\n                )\n            arg_3 = [causative for causative in arg_4['causatives']]\n\n        elif arg_1:\n\n            arg_5 = arg_0.case_collection.aggregate([\n                {'$match': {'collaborators': arg_1, 'causatives': {'$exists': True}}},\n                {'$unwind': '$causatives'},\n                {'$group': {'_id': '$causatives'}}\n            ])\n            arg_3 = [item['_id'] for item in arg_5]\n\n        return arg_3", "path": "scout/adapter/mongo/variant.py", "identifier": "VariantHandler.get_causatives", "docstring": "Return all causative variants for an institute\n\n            Args:\n                institute_id(str)\n                case_id(str)\n\n            Yields:\n                str: variant document id", "docstring_tokens": ["Return", "all", "causative", "variants", "for", "an", "institute"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257140}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L853-L865", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns the indices of cells that belong to a column.", "language": "python", "parameters": "(self, column)", "return_statement": "return range(start, end)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_validateColumn", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "cellsPerColumn", "*", "arg_1", "arg_3", "=", "arg_2", "+", "arg_0", ".", "cellsPerColumn", "return", "range", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the indices of cells that belong to a column.\n\n    :param column: (int) Column index\n\n    :returns: (list) Cell indices\n    \"\"\"\n    arg_0._validateColumn(arg_1)\n\n    arg_2 = arg_0.cellsPerColumn * arg_1\n    arg_3 = arg_2 + arg_0.cellsPerColumn\n    return range(arg_2, arg_3)", "path": "src/nupic/algorithms/temporal_memory.py", "identifier": "TemporalMemory.cellsForColumn", "docstring": "Returns the indices of cells that belong to a column.\n\n    :param column: (int) Column index\n\n    :returns: (list) Cell indices", "docstring_tokens": ["Returns", "the", "indices", "of", "cells", "that", "belong", "to", "a", "column", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257141}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1135-L1174", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Returns the merged nextflow params string from a dictionary object.", "language": "python", "parameters": "(self)", "return_statement": "return config_str", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "processes", ":", "logger", ".", "debug", "(", "\"[{}] Adding parameters: {}\"", ".", "format", "(", "arg_2", ".", "template", ",", "arg_2", ".", "params", ")", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "params", ".", "items", "(", ")", ":", "arg_1", "[", "arg_3", "]", "=", "arg_4", "[", "\"default\"", "]", "arg_5", "=", "\"\\n\\t\"", "+", "\"\\n\\t\"", ".", "join", "(", "[", "\"{} = {}\"", ".", "format", "(", "arg_3", ",", "arg_4", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", "]", ")", "return", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"Returns the merged nextflow params string from a dictionary object.\n\n        The params dict should be a set of key:value pairs with the\n        parameter name, and the default parameter value::\n\n            self.params = {\n                \"genomeSize\": 2.1,\n                \"minCoverage\": 15\n            }\n\n        The values are then added to the string as they are. For instance,\n        a ``2.1`` float will appear as ``param = 2.1`` and a\n        ``\"'teste'\" string will appear as ``param = 'teste'`` (Note the\n        string).\n\n        Identical parameters in multiple processes will be merged into the same\n        param.\n\n        Returns\n        -------\n        str\n            Nextflow params configuration string\n        \"\"\"\n\n        arg_1 = {}\n\n        for arg_2 in arg_0.processes:\n\n            logger.debug(\"[{}] Adding parameters: {}\".format(arg_2.template,\n                                                             arg_2.params))\n            for arg_3, arg_4 in arg_2.params.items():\n\n                arg_1[arg_3] = arg_4[\"default\"]\n\n        arg_5 = \"\\n\\t\" + \"\\n\\t\".join([\n            \"{} = {}\".format(arg_3, arg_4) for arg_3, arg_4 in arg_1.items()\n        ])\n\n        return arg_5", "path": "flowcraft/generator/engine.py", "identifier": "NextflowGenerator._get_merged_params_string", "docstring": "Returns the merged nextflow params string from a dictionary object.\n\n        The params dict should be a set of key:value pairs with the\n        parameter name, and the default parameter value::\n\n            self.params = {\n                \"genomeSize\": 2.1,\n                \"minCoverage\": 15\n            }\n\n        The values are then added to the string as they are. For instance,\n        a ``2.1`` float will appear as ``param = 2.1`` and a\n        ``\"'teste'\" string will appear as ``param = 'teste'`` (Note the\n        string).\n\n        Identical parameters in multiple processes will be merged into the same\n        param.\n\n        Returns\n        -------\n        str\n            Nextflow params configuration string", "docstring_tokens": ["Returns", "the", "merged", "nextflow", "params", "string", "from", "a", "dictionary", "object", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257142}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L252-L258", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return a valid docker_path for a local file path.", "language": "python", "parameters": "(self, raw_uri)", "return_statement": "return local_path, docker_uri", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "directory_fmt", "(", "arg_1", ")", "arg_2", ",", "arg_3", "=", "_local_uri_rewriter", "(", "arg_1", ")", "arg_4", "=", "arg_3", "[", "len", "(", "'file'", ")", ":", "]", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_relative_path", ",", "arg_3", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a valid docker_path for a local file path.\"\"\"\n    arg_1 = directory_fmt(arg_1)\n    arg_2, arg_3 = _local_uri_rewriter(arg_1)\n    arg_4 = arg_3[len('file'):]\n    arg_5 = os.path.join(arg_0._relative_path, arg_3)\n    return arg_4, arg_5", "path": "dsub/lib/param_util.py", "identifier": "MountParamUtil._parse_local_mount_uri", "docstring": "Return a valid docker_path for a local file path.", "docstring_tokens": ["Return", "a", "valid", "docker_path", "for", "a", "local", "file", "path", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 257143}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/acentric.py#L211-L278", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''This function handles the calculation of a mixture's acentric factor.\n    Calculation is based on the omegas provided for each pure component. Will\n    automatically select a method to use if no Method is provided;\n    returns None if insufficient data is available.", "language": "python", "parameters": "(omegas, zs, CASRNs=None, Method=None,\n                  AvailableMethods=False)", "return_statement": "return _omega", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "def", "list_methods", "(", ")", ":", "arg_5", "=", "[", "]", "if", "none_and_length_check", "(", "[", "arg_1", ",", "arg_0", "]", ")", ":", "arg_5", ".", "append", "(", "'SIMPLE'", ")", "arg_5", ".", "append", "(", "'NONE'", ")", "return", "arg_5", "if", "arg_4", ":", "return", "list_methods", "(", ")", "if", "not", "arg_3", ":", "arg_3", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_3", "==", "'SIMPLE'", ":", "arg_6", "=", "mixing_simple", "(", "arg_1", ",", "arg_0", ")", "elif", "arg_3", "==", "'NONE'", ":", "arg_6", "=", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                  arg_4=False):\n    r'''This function handles the calculation of a mixture's acentric factor.\n    Calculation is based on the omegas provided for each pure component. Will\n    automatically select a method to use if no Method is provided;\n    returns None if insufficient data is available.\n\n    Examples\n    --------\n    >>> Func([0.025, 0.12], [0.3, 0.7])\n    0.0915\n\n    Parameters\n    ----------\n    omegas : array-like\n        acentric factors of each component, [-]\n    zs : array-like\n        mole fractions of each component, [-]\n    CASRNs: list of strings\n        CASRNs, not currently used [-]\n\n    Returns\n    -------\n    omega : float\n        acentric factor of the mixture, [-]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain omega with the given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        The method name to use. Only 'SIMPLE' is accepted so far.\n        All valid values are also held in the list Func_methods.\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        omega for the desired chemical, and will return methods instead of\n        omega\n\n    Notes\n    -----\n    The only data used in the methods implemented to date are mole fractions\n    and pure-component omegas. An alternate definition could be based on\n    the dew point or bubble point of a multicomponent mixture, but this has\n    not been done to date.\n\n    References\n    ----------\n    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.\n       New York: McGraw-Hill Professional, 2000.\n    '''\n    def list_methods():\n        arg_5 = []\n        if none_and_length_check([arg_1, arg_0]):\n            arg_5.append('SIMPLE')\n        arg_5.append('NONE')\n        return arg_5\n    if arg_4:\n        return list_methods()\n    if not arg_3:\n        arg_3 = list_methods()[0]\n\n    if arg_3 == 'SIMPLE':\n        arg_6 = mixing_simple(arg_1, arg_0)\n    elif arg_3 == 'NONE':\n        arg_6 = None\n    else:\n        raise Exception('Failure in in function')\n    return arg_6", "path": "thermo/acentric.py", "identifier": "omega_mixture", "docstring": "r'''This function handles the calculation of a mixture's acentric factor.\n    Calculation is based on the omegas provided for each pure component. Will\n    automatically select a method to use if no Method is provided;\n    returns None if insufficient data is available.\n\n    Examples\n    --------\n    >>> omega_mixture([0.025, 0.12], [0.3, 0.7])\n    0.0915\n\n    Parameters\n    ----------\n    omegas : array-like\n        acentric factors of each component, [-]\n    zs : array-like\n        mole fractions of each component, [-]\n    CASRNs: list of strings\n        CASRNs, not currently used [-]\n\n    Returns\n    -------\n    omega : float\n        acentric factor of the mixture, [-]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain omega with the given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        The method name to use. Only 'SIMPLE' is accepted so far.\n        All valid values are also held in the list omega_mixture_methods.\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        omega for the desired chemical, and will return methods instead of\n        omega\n\n    Notes\n    -----\n    The only data used in the methods implemented to date are mole fractions\n    and pure-component omegas. An alternate definition could be based on\n    the dew point or bubble point of a multicomponent mixture, but this has\n    not been done to date.\n\n    References\n    ----------\n    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.\n       New York: McGraw-Hill Professional, 2000.", "docstring_tokens": ["r", "This", "function", "handles", "the", "calculation", "of", "a", "mixture", "s", "acentric", "factor", ".", "Calculation", "is", "based", "on", "the", "omegas", "provided", "for", "each", "pure", "component", ".", "Will", "automatically", "select", "a", "method", "to", "use", "if", "no", "Method", "is", "provided", ";", "returns", "None", "if", "insufficient", "data", "is", "available", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 257144}
{"url": "https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/script.py#L130-L137", "sha": "e1b85544ce72bfaae9182597709a2ecede8c8242", "docstring_summary": "Setup logging for the application and aiohttp.", "language": "python", "parameters": "(self, log_level: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "getattr", "(", "logging", ",", "arg_1", ")", "arg_4", "=", "(", "'aiohttp.access'", ",", "'aiohttp.internal'", ",", "'aiohttp.server'", ",", "'aiohttp.web'", ",", "arg_0", ".", "name", ")", "for", "arg_5", "in", "arg_4", ":", "setup_logger", "(", "arg_5", "=", "arg_5", ",", "stream", "=", "sys", ".", "stderr", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"Setup logging for the application and aiohttp.\"\"\"\n        arg_3 = getattr(logging, arg_1)\n        arg_4 = (\n            'aiohttp.access', 'aiohttp.internal', 'aiohttp.server',\n            'aiohttp.web', arg_0.name)\n        for arg_5 in arg_4:\n            setup_logger(arg_5=arg_5, stream=sys.stderr, arg_3=arg_3)", "path": "prometheus_aioexporter/script.py", "identifier": "PrometheusExporterScript._setup_logging", "docstring": "Setup logging for the application and aiohttp.", "docstring_tokens": ["Setup", "logging", "for", "the", "application", "and", "aiohttp", "."], "nwo": "albertodonato/prometheus-aioexporter", "score": 0.36639066307774715, "idx": 257145}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/handlers.py#L493-L520", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Start the heartbeating and call the callback if the kernel dies.", "language": "python", "parameters": "(self, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_beating", ":", "arg_0", ".", "_kernel_alive", "=", "True", "def", "ping_or_dead", "(", ")", ":", "arg_0", ".", "hb_stream", ".", "flush", "(", ")", "if", "arg_0", ".", "_kernel_alive", ":", "arg_0", ".", "_kernel_alive", "=", "False", "arg_0", ".", "hb_stream", ".", "send", "(", "b'ping'", ")", "arg_0", ".", "hb_stream", ".", "flush", "(", ")", "else", ":", "try", ":", "arg_1", "(", ")", "except", ":", "pass", "finally", ":", "arg_0", ".", "stop_hb", "(", ")", "def", "beat_received", "(", "arg_3", ")", ":", "arg_0", ".", "_kernel_alive", "=", "True", "arg_0", ".", "hb_stream", ".", "on_recv", "(", "beat_received", ")", "arg_4", "=", "ioloop", ".", "IOLoop", ".", "instance", "(", ")", "arg_0", ".", "_hb_periodic_callback", "=", "ioloop", ".", "PeriodicCallback", "(", "ping_or_dead", ",", "arg_0", ".", "time_to_dead", "*", "1000", ",", "arg_4", ")", "arg_4", ".", "add_timeout", "(", "time", ".", "time", "(", ")", "+", "arg_0", ".", "first_beat", ",", "arg_0", ".", "_really_Func", ")", "arg_0", ".", "_beating", "=", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Start the heartbeating and call the callback if the kernel dies.\"\"\"\n        if not arg_0._beating:\n            arg_0._kernel_alive = True\n\n            def ping_or_dead():\n                arg_0.hb_stream.flush()\n                if arg_0._kernel_alive:\n                    arg_0._kernel_alive = False\n                    arg_0.hb_stream.send(b'ping')\n                    # flush stream to force immediate socket send\n                    arg_0.hb_stream.flush()\n                else:\n                    try:\n                        arg_1()\n                    except:\n                        pass\n                    finally:\n                        arg_0.stop_hb()\n\n            def beat_received(arg_3):\n                arg_0._kernel_alive = True\n\n            arg_0.hb_stream.on_recv(beat_received)\n            arg_4 = ioloop.IOLoop.instance()\n            arg_0._hb_periodic_callback = ioloop.PeriodicCallback(ping_or_dead, arg_0.time_to_dead*1000, arg_4)\n            arg_4.add_timeout(time.time()+arg_0.first_beat, arg_0._really_Func)\n            arg_0._beating= True", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/handlers.py", "identifier": "IOPubHandler.start_hb", "docstring": "Start the heartbeating and call the callback if the kernel dies.", "docstring_tokens": ["Start", "the", "heartbeating", "and", "call", "the", "callback", "if", "the", "kernel", "dies", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257146}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L845-L864", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Return all items with a given name and parent folder id.", "language": "python", "parameters": "(self, name, folder_id, token=None)", "return_statement": "return response['items']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "dict", "(", ")", "arg_4", "[", "'name'", "]", "=", "arg_1", "arg_4", "[", "'folderId'", "]", "=", "arg_2", "if", "arg_3", ":", "arg_4", "[", "'token'", "]", "=", "arg_3", "arg_5", "=", "arg_0", ".", "request", "(", "'midas.item.searchbynameandfolder'", ",", "arg_4", ")", "return", "arg_5", "[", "'items'", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Return all items with a given name and parent folder id.\n\n        :param name: The name of the item to search by.\n        :type name: string\n        :param folder_id: The id of the parent folder to search by.\n        :type folder_id: int | long\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: A list of all items with the given name and parent folder id.\n        :rtype: list[dict]\n        \"\"\"\n        arg_4 = dict()\n        arg_4['name'] = arg_1\n        arg_4['folderId'] = arg_2\n        if arg_3:\n            arg_4['token'] = arg_3\n        arg_5 = arg_0.request('midas.item.searchbynameandfolder', arg_4)\n        return arg_5['items']", "path": "pydas/drivers.py", "identifier": "CoreDriver.search_item_by_name_and_folder", "docstring": "Return all items with a given name and parent folder id.\n\n        :param name: The name of the item to search by.\n        :type name: string\n        :param folder_id: The id of the parent folder to search by.\n        :type folder_id: int | long\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: A list of all items with the given name and parent folder id.\n        :rtype: list[dict]", "docstring_tokens": ["Return", "all", "items", "with", "a", "given", "name", "and", "parent", "folder", "id", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 257147}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/base_client.py#L134-L145", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Execute a patch request and return the result", "language": "python", "parameters": "(self, route, data, headers=None, failure_message=None)", "return_statement": "return self._handle_response(response, failure_message)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "_get_headers", "(", "arg_3", ")", "arg_5", "=", "(", "lambda", ":", "requests", ".", "patch", "(", "arg_0", ".", "_get_qualified_route", "(", "arg_1", ")", ",", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "verify", "=", "False", ",", "proxies", "=", "arg_0", ".", "proxies", ")", ")", "arg_6", "=", "check_for_rate_limiting", "(", "arg_5", "(", ")", ",", "arg_5", ")", "return", "arg_0", ".", "_handle_response", "(", "arg_6", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"\n        Execute a patch request and return the result\n        \"\"\"\n        arg_3 = arg_0._get_headers(arg_3)\n        arg_5 = (\n            lambda: requests.patch(\n                arg_0._get_qualified_route(arg_1), arg_3=arg_3, arg_2=arg_2, verify=False, proxies=arg_0.proxies\n            )\n        )\n        arg_6 = check_for_rate_limiting(arg_5(), arg_5)\n        return arg_0._handle_response(arg_6, arg_4)", "path": "citrination_client/base/base_client.py", "identifier": "BaseClient._patch", "docstring": "Execute a patch request and return the result", "docstring_tokens": ["Execute", "a", "patch", "request", "and", "return", "the", "result"], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 257148}
{"url": "https://github.com/alexseitsinger/find_best_string/blob/833499113d9c560c91fe4761921a4d5717939ae7/src/find_best_string/main.py#L8-L101", "sha": "833499113d9c560c91fe4761921a4d5717939ae7", "docstring_summary": "Return best matching substring of corpus.", "language": "python", "parameters": "(query,\n                     corpus,\n                     step=4,\n                     flex=3,\n                     case_sensitive=False)", "return_statement": "return corpus[pos_left: pos_right].strip(), match_value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "4", ",", "arg_3", "=", "3", ",", "arg_4", "=", "False", ")", ":", "def", "ratio", "(", "arg_5", ",", "arg_6", ")", ":", "return", "SequenceMatcher", "(", "None", ",", "arg_5", ",", "arg_6", ")", ".", "ratio", "(", ")", "def", "scan_corpus", "(", "arg_2", ")", ":", "arg_7", "=", "[", "]", "arg_8", "=", "0", "while", "arg_8", "+", "arg_21", "-", "arg_2", "<=", "len", "(", "arg_1", ")", ":", "arg_7", ".", "append", "(", "ratio", "(", "arg_0", ",", "arg_1", "[", "arg_8", ":", "arg_8", "-", "1", "+", "arg_21", "]", ")", ")", "arg_8", "+=", "arg_2", "return", "arg_7", "def", "index_max", "(", "arg_9", ")", ":", "return", "max", "(", "range", "(", "len", "(", "arg_9", ")", ")", ",", "key", "=", "arg_9", ".", "__getitem__", ")", "def", "adjust_left_right_positions", "(", ")", ":", "arg_10", ",", "arg_11", "=", "[", "arg_22", "]", "*", "2", "arg_12", ",", "arg_13", "=", "[", "arg_22", "+", "arg_21", "]", "*", "2", "arg_14", "=", "arg_7", "[", "round_decimal", "(", "arg_10", "/", "arg_2", ")", "]", "arg_15", "=", "arg_7", "[", "round_decimal", "(", "arg_12", "/", "arg_2", ")", "]", "for", "arg_16", "in", "range", "(", "arg_3", ")", ":", "arg_17", "=", "ratio", "(", "arg_0", ",", "arg_1", "[", "arg_10", "-", "arg_16", ":", "arg_12", "]", ")", "if", "arg_17", ">", "arg_14", ":", "arg_14", "=", "arg_17", "arg_11", "=", "arg_10", "-", "arg_16", "arg_18", "=", "ratio", "(", "arg_0", ",", "arg_1", "[", "arg_10", "+", "arg_16", ":", "arg_12", "]", ")", "if", "arg_18", ">", "arg_14", ":", "arg_14", "=", "arg_18", "arg_11", "=", "arg_10", "+", "arg_16", "arg_19", "=", "ratio", "(", "arg_0", ",", "arg_1", "[", "arg_10", ":", "arg_12", "-", "arg_16", "]", ")", "if", "arg_19", ">", "arg_15", ":", "arg_15", "=", "arg_19", "arg_13", "=", "arg_12", "-", "arg_16", "arg_20", "=", "ratio", "(", "arg_0", ",", "arg_1", "[", "arg_10", ":", "arg_12", "+", "arg_16", "]", ")", "if", "arg_20", ">", "arg_15", ":", "arg_15", "=", "arg_20", "arg_13", "=", "arg_12", "+", "arg_16", "return", "arg_11", ",", "arg_13", ",", "ratio", "(", "arg_0", ",", "arg_1", "[", "arg_11", ":", "arg_13", "]", ")", "if", "not", "arg_4", ":", "arg_0", "=", "arg_0", ".", "lower", "(", ")", "arg_1", "=", "arg_1", ".", "lower", "(", ")", "arg_21", "=", "len", "(", "arg_0", ")", "if", "arg_3", ">=", "arg_21", "/", "2", ":", "print", "(", "\"Warning: flex exceeds length of query / 2. Setting to default.\"", ")", "arg_3", "=", "3", "arg_7", "=", "scan_corpus", "(", "arg_2", ")", "arg_22", "=", "index_max", "(", "arg_7", ")", "*", "arg_2", "arg_23", ",", "arg_24", ",", "arg_25", "=", "adjust_left_right_positions", "(", ")", "return", "arg_1", "[", "arg_23", ":", "arg_24", "]", ".", "strip", "(", ")", ",", "arg_25"], "function": "def Func(arg_0,\n                     arg_1,\n                     arg_2=4,\n                     arg_3=3,\n                     arg_4=False):\n    \"\"\"Return best matching substring of corpus.\n\n    Parameters\n    ----------\n    query : str\n    corpus : str\n    step : int\n        Step size of first match-value scan through corpus. Can be thought of\n        as a sort of \"scan resolution\". Should not exceed length of query.\n    flex : int\n        Max. left/right substring position adjustment value. Should not\n        exceed length of query / 2.\n\n    Outputs\n    -------\n    output0 : str\n        Best matching substring.\n    output1 : float\n        Match ratio of best matching substring. 1 is perfect match.\n\n    \"\"\"\n\n    def ratio(arg_5, arg_6):\n        \"\"\"Compact alias for SequenceMatcher.\"\"\"\n        return SequenceMatcher(None, arg_5, arg_6).ratio()\n\n    def scan_corpus(arg_2):\n        \"\"\"Return list of match values from corpus-wide scan.\"\"\"\n        arg_7 = []\n        arg_8 = 0\n        while arg_8 + arg_21 - arg_2 <= len(arg_1):\n            arg_7.append(ratio(arg_0, arg_1[arg_8 : arg_8-1+arg_21]))\n            arg_8 += arg_2\n        return arg_7\n\n    def index_max(arg_9):\n        \"\"\"Return index of max value.\"\"\"\n        return max(range(len(arg_9)), key=arg_9.__getitem__)\n\n    def adjust_left_right_positions():\n        \"\"\"Return left/right positions for best string match.\"\"\"\n        # bp_* is synonym for 'Best Position Left/Right' and are adjusted\n        # to optimize bmv_*\n        arg_10, arg_11 = [arg_22] * 2\n        arg_12, arg_13 = [arg_22 + arg_21] * 2\n\n        # bmv_* are declared here in case they are untouched in optimization\n        arg_14 = arg_7[round_decimal(arg_10 / arg_2)]\n        arg_15 = arg_7[round_decimal(arg_12 / arg_2)]\n\n        for arg_16 in range(arg_3):\n            arg_17 = ratio(arg_0, arg_1[arg_10 - arg_16: arg_12])\n            if arg_17 > arg_14:\n                arg_14 = arg_17\n                arg_11 = arg_10 - arg_16\n\n            arg_18 = ratio(arg_0, arg_1[arg_10 + arg_16: arg_12])\n            if arg_18 > arg_14:\n                arg_14 = arg_18\n                arg_11 = arg_10 + arg_16\n\n            arg_19 = ratio(arg_0, arg_1[arg_10: arg_12 - arg_16])\n            if arg_19 > arg_15:\n                arg_15 = arg_19\n                arg_13 = arg_12 - arg_16\n\n            arg_20 = ratio(arg_0, arg_1[arg_10: arg_12 + arg_16])\n            if arg_20 > arg_15:\n                arg_15 = arg_20\n                arg_13 = arg_12 + arg_16\n\n        return arg_11, arg_13, ratio(arg_0, arg_1[arg_11 : arg_13])\n\n    if not arg_4:\n        arg_0 = arg_0.lower()\n        arg_1 = arg_1.lower()\n\n    arg_21 = len(arg_0)\n\n    if arg_3 >= arg_21/2:\n        print(\"Warning: flex exceeds length of query / 2. Setting to default.\")\n        arg_3 = 3\n\n    arg_7 = scan_corpus(arg_2)\n    arg_22 = index_max(arg_7) * arg_2\n\n    arg_23, arg_24, arg_25 = adjust_left_right_positions()\n\n    return arg_1[arg_23: arg_24].strip(), arg_25", "path": "src/find_best_string/main.py", "identifier": "find_best_string", "docstring": "Return best matching substring of corpus.\n\n    Parameters\n    ----------\n    query : str\n    corpus : str\n    step : int\n        Step size of first match-value scan through corpus. Can be thought of\n        as a sort of \"scan resolution\". Should not exceed length of query.\n    flex : int\n        Max. left/right substring position adjustment value. Should not\n        exceed length of query / 2.\n\n    Outputs\n    -------\n    output0 : str\n        Best matching substring.\n    output1 : float\n        Match ratio of best matching substring. 1 is perfect match.", "docstring_tokens": ["Return", "best", "matching", "substring", "of", "corpus", "."], "nwo": "alexseitsinger/find_best_string", "score": 0.0, "idx": 257149}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L306-L313", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Decimal to binary conversion.", "language": "python", "parameters": "(ip)", "return_statement": "return ''.join(bits) or 32*'0'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "while", "arg_0", ":", "arg_1", ".", "append", "(", "_BYTES_TO_BITS", "[", "arg_0", "&", "255", "]", ")", "arg_0", ">>=", "8", "arg_1", ".", "reverse", "(", ")", "return", "''", ".", "join", "(", "arg_1", ")", "or", "32", "*", "'0'"], "function": "def Func(arg_0):\n    \"\"\"Decimal to binary conversion.\"\"\"\n    arg_1 = []\n    while arg_0:\n        arg_1.append(_BYTES_TO_BITS[arg_0 & 255])\n        arg_0 >>= 8\n    arg_1.reverse()\n    return ''.join(arg_1) or 32*'0'", "path": "iplib.py", "identifier": "_dec_to_bin", "docstring": "Decimal to binary conversion.", "docstring_tokens": ["Decimal", "to", "binary", "conversion", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 257150}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/channels/qubit.py#L65-L70", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the primary control channel of this qubit.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "ControlChannel", ":", "if", "arg_0", ".", "_Funcs", ":", "return", "arg_0", ".", "_Funcs", "[", "0", "]", "else", ":", "raise", "PulseError", "(", "\"No Func channels in q[%d]\"", "%", "arg_0", ".", "_index", ")"], "function": "def Func(arg_0) -> ControlChannel:\n        \"\"\"Return the primary Func channel of this qubit.\"\"\"\n        if arg_0._Funcs:\n            return arg_0._Funcs[0]\n        else:\n            raise PulseError(\"No Func channels in q[%d]\" % arg_0._index)", "path": "qiskit/pulse/channels/qubit.py", "identifier": "Qubit.control", "docstring": "Return the primary control channel of this qubit.", "docstring_tokens": ["Return", "the", "primary", "control", "channel", "of", "this", "qubit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257151}
{"url": "https://github.com/willkg/markus/blob/0cfbe67fb7ccfa7488b0120d21ddc0cdc1f8ed33/markus/main.py#L320-L359", "sha": "0cfbe67fb7ccfa7488b0120d21ddc0cdc1f8ed33", "docstring_summary": "Contextmanager for easily computing timings.", "language": "python", "parameters": "(self, stat, tags=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "six", ".", "PY3", ":", "arg_3", "=", "time", ".", "perf_counter", "(", ")", "else", ":", "arg_3", "=", "time", ".", "time", "(", ")", "yield", "if", "six", ".", "PY3", ":", "arg_4", "=", "time", ".", "perf_counter", "(", ")", "else", ":", "arg_4", "=", "time", ".", "time", "(", ")", "arg_5", "=", "arg_4", "-", "arg_3", "arg_0", ".", "timing", "(", "arg_1", ",", "value", "=", "arg_5", "*", "1000.0", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Contextmanager for easily computing timings.\n\n        :arg string stat: A period delimited alphanumeric key.\n\n        :arg list-of-strings tags: Each string in the tag consists of a key and\n            a value separated by a colon. Tags can make it easier to break down\n            metrics for analysis.\n\n            For example ``['env:stage', 'compressed:yes']``.\n\n        For example:\n\n        >>> mymetrics = get_metrics(__name__)\n\n        >>> def long_function():\n        ...     with mymetrics.Func('long_function'):\n        ...         # perform some thing we want to keep metrics on\n        ...         pass\n\n\n        .. Note::\n\n           All timings generated with this are in milliseconds.\n\n        \"\"\"\n        if six.PY3:\n            arg_3 = time.perf_counter()\n        else:\n            arg_3 = time.time()\n\n        yield\n\n        if six.PY3:\n            arg_4 = time.perf_counter()\n        else:\n            arg_4 = time.time()\n\n        arg_5 = arg_4 - arg_3\n        arg_0.timing(arg_1, value=arg_5 * 1000.0, arg_2=arg_2)", "path": "markus/main.py", "identifier": "MetricsInterface.timer", "docstring": "Contextmanager for easily computing timings.\n\n        :arg string stat: A period delimited alphanumeric key.\n\n        :arg list-of-strings tags: Each string in the tag consists of a key and\n            a value separated by a colon. Tags can make it easier to break down\n            metrics for analysis.\n\n            For example ``['env:stage', 'compressed:yes']``.\n\n        For example:\n\n        >>> mymetrics = get_metrics(__name__)\n\n        >>> def long_function():\n        ...     with mymetrics.timer('long_function'):\n        ...         # perform some thing we want to keep metrics on\n        ...         pass\n\n\n        .. Note::\n\n           All timings generated with this are in milliseconds.", "docstring_tokens": ["Contextmanager", "for", "easily", "computing", "timings", "."], "nwo": "willkg/markus", "score": 0.5049367824870141, "idx": 257152}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/typecheck.py#L174-L199", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Given an owner and a name, try to find similar names", "language": "python", "parameters": "(owner, attrname, distance_threshold, max_choices)", "return_statement": "return sorted(picked)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "_node_names", "(", "arg_0", ")", "for", "arg_6", "in", "arg_5", ":", "if", "arg_6", "==", "arg_1", ":", "continue", "arg_7", "=", "_string_distance", "(", "arg_1", ",", "arg_6", ")", "if", "arg_7", "<=", "arg_2", ":", "arg_4", ".", "append", "(", "(", "arg_6", ",", "arg_7", ")", ")", "arg_8", "=", "[", "arg_6", "for", "(", "arg_6", ",", "_", ")", "in", "heapq", ".", "nsmallest", "(", "arg_3", ",", "arg_4", ",", "key", "=", "operator", ".", "itemgetter", "(", "1", ")", ")", "]", "return", "sorted", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Given an owner and a name, try to find similar names\n\n    The similar names are searched given a distance metric and only\n    a given number of choices will be returned.\n    \"\"\"\n    arg_4 = []\n    arg_5 = _node_names(arg_0)\n\n    for arg_6 in arg_5:\n        if arg_6 == arg_1:\n            continue\n\n        arg_7 = _string_distance(arg_1, arg_6)\n        if arg_7 <= arg_2:\n            arg_4.append((arg_6, arg_7))\n\n    # Now get back the values with a minimum, up to the given\n    # limit or choices.\n    arg_8 = [\n        arg_6\n        for (arg_6, _) in heapq.nsmallest(\n            arg_3, arg_4, key=operator.itemgetter(1)\n        )\n    ]\n    return sorted(arg_8)", "path": "pylint/checkers/typecheck.py", "identifier": "_similar_names", "docstring": "Given an owner and a name, try to find similar names\n\n    The similar names are searched given a distance metric and only\n    a given number of choices will be returned.", "docstring_tokens": ["Given", "an", "owner", "and", "a", "name", "try", "to", "find", "similar", "names"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257153}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_kvlayer_keyword_search.py#L135-L172", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Record index records for a single document.", "language": "python", "parameters": "(self, si)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "body", ".", "clean_visible", ":", "logger", ".", "warn", "(", "'stream item %s has no clean_visible part, '", "'skipping keyword Funcing'", ",", "arg_1", ".", "stream_id", ")", "return", "arg_2", "=", "defaultdict", "(", "int", ")", "arg_2", "[", "arg_3", "]", "=", "1", "arg_4", "=", "defaultdict", "(", "int", ")", "arg_5", "=", "arg_0", ".", "collect_words", "(", "arg_1", ")", "for", "arg_6", ",", "arg_7", "in", "arg_5", ".", "iteritems", "(", ")", ":", "(", "arg_6", ",", "arg_8", ")", "=", "arg_0", ".", "make_hash_kw", "(", "arg_6", ")", "arg_2", "[", "arg_8", "]", "+=", "arg_7", "arg_4", "[", "arg_6", "]", "=", "arg_8", "if", "arg_0", ".", "hash_docs", ":", "(", "arg_9", ",", "arg_10", ")", "=", "key_for_stream_item", "(", "arg_1", ")", "arg_11", "=", "[", "(", "(", "h", ",", "arg_9", ",", "arg_10", ")", ",", "n", ")", "for", "(", "h", ",", "n", ")", "in", "arg_2", ".", "iteritems", "(", ")", "if", "h", "!=", "arg_3", "]", "arg_0", ".", "client", ".", "put", "(", "HASH_TF_INDEX_TABLE", ",", "*", "arg_11", ")", "if", "arg_0", ".", "hash_frequencies", ":", "arg_11", "=", "[", "(", "(", "h", ",", ")", ",", "1", ")", "for", "h", "in", "arg_2", ".", "iterkeys", "(", ")", "]", "arg_0", ".", "client", ".", "increment", "(", "HASH_FREQUENCY_TABLE", ",", "*", "arg_11", ")", "if", "arg_0", ".", "hash_keywords", ":", "arg_11", "=", "[", "(", "(", "h", ",", "t", ")", ",", "1", ")", "for", "(", "t", ",", "h", ")", "in", "arg_4", ".", "iteritems", "(", ")", "]", "arg_0", ".", "client", ".", "increment", "(", "HASH_KEYWORD_INDEX_TABLE", ",", "*", "arg_11", ")"], "function": "def Func(arg_0, arg_1):\n        '''Record Func records for a single document.\n\n        Which Funces this creates depends on the parameters to the\n        constructor.  This records all of the requested Funces for\n        a single document.\n\n        '''\n        if not arg_1.body.clean_visible:\n            logger.warn('stream item %s has no clean_visible part, '\n                        'skipping keyword Funcing', arg_1.stream_id)\n            return\n\n        # Count tokens in si.clean_visible\n        # We will recycle hash==0 for \"# of documents\"\n        arg_2 = defaultdict(int)\n        arg_2[arg_3] = 1\n        arg_4 = defaultdict(int)\n        arg_5 = arg_0.collect_words(arg_1)\n        for arg_6, arg_7 in arg_5.iteritems():\n            (arg_6, arg_8) = arg_0.make_hash_kw(arg_6)\n            arg_2[arg_8] += arg_7\n            arg_4[arg_6] = arg_8\n\n        # Convert this and write it out\n        if arg_0.hash_docs:\n            (arg_9, arg_10) = key_for_stream_item(arg_1)\n            arg_11 = [((h, arg_9, arg_10), n) for (h, n) in arg_2.iteritems()\n                    if h != arg_3]\n            arg_0.client.put(HASH_TF_INDEX_TABLE, *arg_11)\n\n        if arg_0.hash_frequencies:\n            arg_11 = [((h,), 1) for h in arg_2.iterkeys()]\n            arg_0.client.increment(HASH_FREQUENCY_TABLE, *arg_11)\n\n        if arg_0.hash_keywords:\n            arg_11 = [((h, t), 1) for (t, h) in arg_4.iteritems()]\n            arg_0.client.increment(HASH_KEYWORD_INDEX_TABLE, *arg_11)", "path": "streamcorpus_pipeline/_kvlayer_keyword_search.py", "identifier": "keyword_indexer.index", "docstring": "Record index records for a single document.\n\n        Which indexes this creates depends on the parameters to the\n        constructor.  This records all of the requested indexes for\n        a single document.", "docstring_tokens": ["Record", "index", "records", "for", "a", "single", "document", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 257154}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py#L469-L476", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Just validates the given signed value.  Returns `True` if the\n        signature exists and is valid, `False` otherwise.", "language": "python", "parameters": "(self, signed_value, max_age=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "try", ":", "arg_0", ".", "unsign", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "True", "except", "BadSignature", ":", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Just Funcs the given signed value.  Returns `True` if the\n        signature exists and is valid, `False` otherwise.\"\"\"\n        try:\n            arg_0.unsign(arg_1, arg_2=arg_2)\n            return True\n        except BadSignature:\n            return False", "path": "capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py", "identifier": "TimestampSigner.validate", "docstring": "Just validates the given signed value.  Returns `True` if the\n        signature exists and is valid, `False` otherwise.", "docstring_tokens": ["Just", "validates", "the", "given", "signed", "value", ".", "Returns", "True", "if", "the", "signature", "exists", "and", "is", "valid", "False", "otherwise", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257155}
{"url": "https://github.com/lgpage/nbtutor/blob/07798a044cf6e1fd4eaac2afddeef3e13348dbcd/nbtutor/ipython/utils.py#L128-L162", "sha": "07798a044cf6e1fd4eaac2afddeef3e13348dbcd", "docstring_summary": "Get type information for a Python object", "language": "python", "parameters": "(obj)", "return_statement": "return ('unknown', type(obj).__name__)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "primitive_types", ")", ":", "return", "(", "'primitive'", ",", "type", "(", "arg_0", ")", ".", "__name__", ")", "if", "isinstance", "(", "arg_0", ",", "sequence_types", ")", ":", "return", "(", "'sequence'", ",", "type", "(", "arg_0", ")", ".", "__name__", ")", "if", "isinstance", "(", "arg_0", ",", "array_types", ")", ":", "return", "(", "'array'", ",", "type", "(", "arg_0", ")", ".", "__name__", ")", "if", "isinstance", "(", "arg_0", ",", "key_value_types", ")", ":", "return", "(", "'key-value'", ",", "type", "(", "arg_0", ")", ".", "__name__", ")", "if", "isinstance", "(", "arg_0", ",", "types", ".", "ModuleType", ")", ":", "return", "(", "'module'", ",", "type", "(", "arg_0", ")", ".", "__name__", ")", "if", "isinstance", "(", "arg_0", ",", "(", "types", ".", "FunctionType", ",", "types", ".", "MethodType", ")", ")", ":", "return", "(", "'function'", ",", "type", "(", "arg_0", ")", ".", "__name__", ")", "if", "isinstance", "(", "arg_0", ",", "type", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'__dict__'", ")", ":", "return", "(", "'class'", ",", "arg_0", ".", "__name__", ")", "if", "isinstance", "(", "type", "(", "arg_0", ")", ",", "type", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'__dict__'", ")", ":", "arg_1", "=", "type", "(", "arg_0", ")", ".", "__name__", "if", "arg_1", "==", "'classobj'", ":", "arg_1", "=", "arg_0", ".", "__name__", "return", "(", "'class'", ",", "'{}'", ".", "format", "(", "arg_1", ")", ")", "if", "arg_1", "==", "'instance'", ":", "arg_1", "=", "arg_0", ".", "__class__", ".", "__name__", "return", "(", "'instance'", ",", "'{} instance'", ".", "format", "(", "arg_1", ")", ")", "return", "(", "'unknown'", ",", "type", "(", "arg_0", ")", ".", "__name__", ")"], "function": "def Func(arg_0):\n    \"\"\"Get type information for a Python object\n\n    Args:\n        obj: The Python object\n\n    Returns:\n        tuple: (object type \"catagory\", object type name)\n    \"\"\"\n    if isinstance(arg_0, primitive_types):\n        return ('primitive', type(arg_0).__name__)\n    if isinstance(arg_0, sequence_types):\n        return ('sequence', type(arg_0).__name__)\n    if isinstance(arg_0, array_types):\n        return ('array', type(arg_0).__name__)\n    if isinstance(arg_0, key_value_types):\n        return ('key-value', type(arg_0).__name__)\n    if isinstance(arg_0, types.ModuleType):\n        return ('module', type(arg_0).__name__)\n    if isinstance(arg_0, (types.FunctionType, types.MethodType)):\n        return ('function', type(arg_0).__name__)\n    if isinstance(arg_0, type):\n        if hasattr(arg_0, '__dict__'):\n            return ('class', arg_0.__name__)\n    if isinstance(type(arg_0), type):\n        if hasattr(arg_0, '__dict__'):\n            arg_1 = type(arg_0).__name__\n            if arg_1 == 'classobj':\n                arg_1 = arg_0.__name__\n                return ('class', '{}'.format(arg_1))\n            if arg_1 == 'instance':\n                arg_1 = arg_0.__class__.__name__\n            return ('instance', '{} instance'.format(arg_1))\n\n    return ('unknown', type(arg_0).__name__)", "path": "nbtutor/ipython/utils.py", "identifier": "get_type_info", "docstring": "Get type information for a Python object\n\n    Args:\n        obj: The Python object\n\n    Returns:\n        tuple: (object type \"catagory\", object type name)", "docstring_tokens": ["Get", "type", "information", "for", "a", "Python", "object"], "nwo": "lgpage/nbtutor", "score": 0.47001387444347686, "idx": 257156}
{"url": "https://github.com/OldhamMade/exemelopy/blob/5f5141b169e61a5b6912146a995917f5d862ee9c/exemelopy/__init__.py#L52-L66", "sha": "5f5141b169e61a5b6912146a995917f5d862ee9c", "docstring_summary": "Encodes the stored ``data`` to XML and returns a\n        ``string``.", "language": "python", "parameters": "(self, indent=True, declaration=True)", "return_statement": "return etree.tostring(self.to_xml(),\n                              encoding=self.encoding,\n                              xml_declaration=declaration,\n                              pretty_print=indent\n                              )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ")", ":", "return", "etree", ".", "tostring", "(", "arg_0", ".", "to_xml", "(", ")", ",", "encoding", "=", "arg_0", ".", "encoding", ",", "xml_declaration", "=", "arg_2", ",", "pretty_print", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=True):\n        \"\"\"Encodes the stored ``data`` to XML and returns a\n        ``string``.\n\n        Setting ``indent`` to ``False`` will forego any pretty-printing\n        and return a condensed value.\n\n        Setting ``declaration`` to ``False`` will skip inserting the\n        XML declaration.\n        \"\"\"\n        return etree.tostring(arg_0.to_xml(),\n                              encoding=arg_0.encoding,\n                              xml_declaration=arg_2,\n                              pretty_print=arg_1\n                              )", "path": "exemelopy/__init__.py", "identifier": "XMLEncoder.to_string", "docstring": "Encodes the stored ``data`` to XML and returns a\n        ``string``.\n\n        Setting ``indent`` to ``False`` will forego any pretty-printing\n        and return a condensed value.\n\n        Setting ``declaration`` to ``False`` will skip inserting the\n        XML declaration.", "docstring_tokens": ["Encodes", "the", "stored", "data", "to", "XML", "and", "returns", "a", "string", "."], "nwo": "OldhamMade/exemelopy", "score": 0.0, "idx": 257157}
{"url": "https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L683-L723", "sha": "0dc47c8924fa3d9ab676c3a6e195f03f728b72c6", "docstring_summary": "Like takewhile, but takes a peekable iterable and doesn't\n\tconsume the non-matching item.", "language": "python", "parameters": "(predicate, iterable)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "True", ":", "try", ":", "if", "not", "arg_0", "(", "arg_1", ".", "peek", "(", ")", ")", ":", "break", "yield", "next", "(", "arg_1", ")", "except", "StopIteration", ":", "break"], "function": "def Func(arg_0, arg_1):\n\t\"\"\"\n\tLike takewhile, but takes a peekable iterable and doesn't\n\tconsume the non-matching item.\n\n\t>>> items = Peekable(range(10))\n\t>>> is_small = lambda n: n < 4\n\n\t>>> small_items = Func(is_small, items)\n\n\t>>> list(small_items)\n\t[0, 1, 2, 3]\n\n\t>>> list(items)\n\t[4, 5, 6, 7, 8, 9]\n\n\t>>> empty = Func(is_small, Peekable([]))\n\t>>> list(empty)\n\t[]\n\n\t>>> items = Peekable([3])\n\t>>> small_items = Func(is_small, items)\n\t>>> list(small_items)\n\t[3]\n\t>>> list(items)\n\t[]\n\n\t>>> items = Peekable([4])\n\t>>> small_items = Func(is_small, items)\n\t>>> list(small_items)\n\t[]\n\t>>> list(items)\n\t[4]\n\t\"\"\"\n\twhile True:\n\t\ttry:\n\t\t\tif not arg_0(arg_1.peek()):\n\t\t\t\tbreak\n\t\t\tyield next(arg_1)\n\t\texcept StopIteration:\n\t\t\tbreak", "path": "jaraco/itertools.py", "identifier": "takewhile_peek", "docstring": "Like takewhile, but takes a peekable iterable and doesn't\n\tconsume the non-matching item.\n\n\t>>> items = Peekable(range(10))\n\t>>> is_small = lambda n: n < 4\n\n\t>>> small_items = takewhile_peek(is_small, items)\n\n\t>>> list(small_items)\n\t[0, 1, 2, 3]\n\n\t>>> list(items)\n\t[4, 5, 6, 7, 8, 9]\n\n\t>>> empty = takewhile_peek(is_small, Peekable([]))\n\t>>> list(empty)\n\t[]\n\n\t>>> items = Peekable([3])\n\t>>> small_items = takewhile_peek(is_small, items)\n\t>>> list(small_items)\n\t[3]\n\t>>> list(items)\n\t[]\n\n\t>>> items = Peekable([4])\n\t>>> small_items = takewhile_peek(is_small, items)\n\t>>> list(small_items)\n\t[]\n\t>>> list(items)\n\t[4]", "docstring_tokens": ["Like", "takewhile", "but", "takes", "a", "peekable", "iterable", "and", "doesn", "t", "consume", "the", "non", "-", "matching", "item", "."], "nwo": "jaraco/jaraco.itertools", "score": 0.2751458370028208, "idx": 257158}
{"url": "https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L105-L134", "sha": "804728974fcefaafc8b5994be65d22e9c198a8d1", "docstring_summary": "Perform an ADC read with the provided mux, gain, data_rate, and mode\n        values.  Returns the signed integer result of the read.", "language": "python", "parameters": "(self, mux, gain, data_rate, mode)", "return_statement": "return self._conversion_value(result[1], result[0])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "ADS1x15_CONFIG_OS_SINGLE", "arg_5", "|=", "(", "arg_1", "&", "0x07", ")", "<<", "ADS1x15_CONFIG_MUX_OFFSET", "if", "arg_2", "not", "in", "ADS1x15_CONFIG_GAIN", ":", "raise", "ValueError", "(", "'Gain must be one of: 2/3, 1, 2, 4, 8, 16'", ")", "arg_5", "|=", "ADS1x15_CONFIG_GAIN", "[", "arg_2", "]", "arg_5", "|=", "arg_4", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "_data_rate_default", "(", ")", "arg_5", "|=", "arg_0", ".", "_data_rate_config", "(", "arg_3", ")", "arg_5", "|=", "ADS1x15_CONFIG_COMP_QUE_DISABLE", "arg_0", ".", "_device", ".", "writeList", "(", "ADS1x15_POINTER_CONFIG", ",", "[", "(", "arg_5", ">>", "8", ")", "&", "0xFF", ",", "arg_5", "&", "0xFF", "]", ")", "time", ".", "sleep", "(", "1.0", "/", "arg_3", "+", "0.0001", ")", "arg_6", "=", "arg_0", ".", "_device", ".", "readList", "(", "ADS1x15_POINTER_CONVERSION", ",", "2", ")", "return", "arg_0", ".", "_conversion_value", "(", "arg_6", "[", "1", "]", ",", "arg_6", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Perform an ADC read with the provided mux, gain, data_rate, and mode\n        values.  Returns the signed integer result of the read.\n        \"\"\"\n        arg_5 = ADS1x15_CONFIG_OS_SINGLE  # Go out of power-down mode for conversion.\n        # Specify mux value.\n        arg_5 |= (arg_1 & 0x07) << ADS1x15_CONFIG_MUX_OFFSET\n        # Validate the passed in gain and then set it in the config.\n        if arg_2 not in ADS1x15_CONFIG_GAIN:\n            raise ValueError('Gain must be one of: 2/3, 1, 2, 4, 8, 16')\n        arg_5 |= ADS1x15_CONFIG_GAIN[arg_2]\n        # Set the mode (continuous or single shot).\n        arg_5 |= arg_4\n        # Get the default data rate if none is specified (default differs between\n        # ADS1015 and ADS1115).\n        if arg_3 is None:\n            arg_3 = arg_0._data_rate_default()\n        # Set the data rate (this is controlled by the subclass as it differs\n        # between ADS1015 and ADS1115).\n        arg_5 |= arg_0._data_rate_config(arg_3)\n        arg_5 |= ADS1x15_CONFIG_COMP_QUE_DISABLE  # Disble comparator mode.\n        # Send the config value to start the ADC conversion.\n        # Explicitly break the 16-bit value down to a big endian pair of bytes.\n        arg_0._device.writeList(ADS1x15_POINTER_CONFIG, [(arg_5 >> 8) & 0xFF, arg_5 & 0xFF])\n        # Wait for the ADC sample to finish based on the sample rate plus a\n        # small offset to be sure (0.1 millisecond).\n        time.sleep(1.0/arg_3+0.0001)\n        # Retrieve the result.\n        arg_6 = arg_0._device.readList(ADS1x15_POINTER_CONVERSION, 2)\n        return arg_0._conversion_value(arg_6[1], arg_6[0])", "path": "Adafruit_ADS1x15/ADS1x15.py", "identifier": "ADS1x15._read", "docstring": "Perform an ADC read with the provided mux, gain, data_rate, and mode\n        values.  Returns the signed integer result of the read.", "docstring_tokens": ["Perform", "an", "ADC", "read", "with", "the", "provided", "mux", "gain", "data_rate", "and", "mode", "values", ".", "Returns", "the", "signed", "integer", "result", "of", "the", "read", "."], "nwo": "adafruit/Adafruit_Python_ADS1x15", "score": 0.7418796736471075, "idx": 257159}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L324-L402", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Convert field value pairs into regular message.", "language": "python", "parameters": "(js, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_1", ".", "DESCRIPTOR", "for", "arg_4", "in", "arg_0", ":", "try", ":", "arg_5", "=", "arg_3", ".", "fields_by_camelcase_name", ".", "get", "(", "arg_4", ",", "None", ")", "if", "not", "arg_5", ":", "raise", "ParseError", "(", "'Message type \"{0}\" has no field named \"{1}\".'", ".", "format", "(", "arg_3", ".", "full_name", ",", "arg_4", ")", ")", "if", "arg_4", "in", "arg_2", ":", "raise", "ParseError", "(", "'Message type \"{0}\" should not have multiple \"{1}\" fields.'", ".", "format", "(", "arg_1", ".", "DESCRIPTOR", ".", "full_name", ",", "arg_4", ")", ")", "arg_2", ".", "append", "(", "arg_4", ")", "if", "arg_5", ".", "containing_oneof", "is", "not", "None", ":", "arg_6", "=", "arg_5", ".", "containing_oneof", ".", "name", "if", "arg_6", "in", "arg_2", ":", "raise", "ParseError", "(", "'Message type \"{0}\" should not have multiple \"{1}\" '", "'oneof fields.'", ".", "format", "(", "arg_1", ".", "DESCRIPTOR", ".", "full_name", ",", "arg_6", ")", ")", "arg_2", ".", "append", "(", "arg_6", ")", "arg_7", "=", "arg_0", "[", "arg_4", "]", "if", "arg_7", "is", "None", ":", "arg_1", ".", "ClearField", "(", "arg_5", ".", "name", ")", "continue", "if", "_IsMapEntry", "(", "arg_5", ")", ":", "arg_1", ".", "ClearField", "(", "arg_5", ".", "name", ")", "_ConvertMapFieldValue", "(", "arg_7", ",", "arg_1", ",", "arg_5", ")", "elif", "arg_5", ".", "label", "==", "descriptor", ".", "FieldDescriptor", ".", "LABEL_REPEATED", ":", "arg_1", ".", "ClearField", "(", "arg_5", ".", "name", ")", "if", "not", "isinstance", "(", "arg_7", ",", "list", ")", ":", "raise", "ParseError", "(", "'repeated field {0} must be in [] which is '", "'{1}.'", ".", "format", "(", "arg_4", ",", "arg_7", ")", ")", "if", "arg_5", ".", "cpp_type", "==", "descriptor", ".", "FieldDescriptor", ".", "CPPTYPE_MESSAGE", ":", "for", "arg_8", "in", "arg_7", ":", "arg_9", "=", "getattr", "(", "arg_1", ",", "arg_5", ".", "name", ")", ".", "add", "(", ")", "if", "(", "arg_8", "is", "None", "and", "arg_9", ".", "DESCRIPTOR", ".", "full_name", "!=", "'google.protobuf.Value'", ")", ":", "raise", "ParseError", "(", "'null is not allowed to be used as an element'", "' in a repeated field.'", ")", "_ConvertMessage", "(", "arg_8", ",", "arg_9", ")", "else", ":", "for", "arg_8", "in", "arg_7", ":", "if", "arg_8", "is", "None", ":", "raise", "ParseError", "(", "'null is not allowed to be used as an element'", "' in a repeated field.'", ")", "getattr", "(", "arg_1", ",", "arg_5", ".", "name", ")", ".", "append", "(", "_ConvertScalarFieldValue", "(", "arg_8", ",", "arg_5", ")", ")", "elif", "arg_5", ".", "cpp_type", "==", "descriptor", ".", "FieldDescriptor", ".", "CPPTYPE_MESSAGE", ":", "arg_9", "=", "getattr", "(", "arg_1", ",", "arg_5", ".", "name", ")", "_ConvertMessage", "(", "arg_7", ",", "arg_9", ")", "else", ":", "setattr", "(", "arg_1", ",", "arg_5", ".", "name", ",", "_ConvertScalarFieldValue", "(", "arg_7", ",", "arg_5", ")", ")", "except", "ParseError", "as", "e", ":", "if", "arg_5", "and", "arg_5", ".", "containing_oneof", "is", "None", ":", "raise", "ParseError", "(", "'Failed to parse {0} field: {1}'", ".", "format", "(", "arg_4", ",", "e", ")", ")", "else", ":", "raise", "ParseError", "(", "str", "(", "e", ")", ")", "except", "ValueError", "as", "e", ":", "raise", "ParseError", "(", "'Failed to parse {0} field: {1}.'", ".", "format", "(", "arg_4", ",", "e", ")", ")", "except", "TypeError", "as", "e", ":", "raise", "ParseError", "(", "'Failed to parse {0} field: {1}.'", ".", "format", "(", "arg_4", ",", "e", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Convert field value pairs into regular message.\n\n  Args:\n    js: A JSON object to convert the field value pairs.\n    message: A regular protocol message to record the data.\n\n  Raises:\n    ParseError: In case of problems converting.\n  \"\"\"\n  arg_2 = []\n  arg_3 = arg_1.DESCRIPTOR\n  for arg_4 in arg_0:\n    try:\n      arg_5 = arg_3.fields_by_camelcase_name.get(arg_4, None)\n      if not arg_5:\n        raise ParseError(\n            'Message type \"{0}\" has no field named \"{1}\".'.format(\n                arg_3.full_name, arg_4))\n      if arg_4 in arg_2:\n        raise ParseError(\n            'Message type \"{0}\" should not have multiple \"{1}\" fields.'.format(\n                arg_1.DESCRIPTOR.full_name, arg_4))\n      arg_2.append(arg_4)\n      # Check no other oneof field is parsed.\n      if arg_5.containing_oneof is not None:\n        arg_6 = arg_5.containing_oneof.name\n        if arg_6 in arg_2:\n          raise ParseError('Message type \"{0}\" should not have multiple \"{1}\" '\n                           'oneof fields.'.format(\n                               arg_1.DESCRIPTOR.full_name, arg_6))\n        arg_2.append(arg_6)\n\n      arg_7 = arg_0[arg_4]\n      if arg_7 is None:\n        arg_1.ClearField(arg_5.name)\n        continue\n\n      # Parse field value.\n      if _IsMapEntry(arg_5):\n        arg_1.ClearField(arg_5.name)\n        _ConvertMapFieldValue(arg_7, arg_1, arg_5)\n      elif arg_5.label == descriptor.FieldDescriptor.LABEL_REPEATED:\n        arg_1.ClearField(arg_5.name)\n        if not isinstance(arg_7, list):\n          raise ParseError('repeated field {0} must be in [] which is '\n                           '{1}.'.format(arg_4, arg_7))\n        if arg_5.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:\n          # Repeated message field.\n          for arg_8 in arg_7:\n            arg_9 = getattr(arg_1, arg_5.name).add()\n            # None is a null_value in Value.\n            if (arg_8 is None and\n                arg_9.DESCRIPTOR.full_name != 'google.protobuf.Value'):\n              raise ParseError('null is not allowed to be used as an element'\n                               ' in a repeated field.')\n            _ConvertMessage(arg_8, arg_9)\n        else:\n          # Repeated scalar field.\n          for arg_8 in arg_7:\n            if arg_8 is None:\n              raise ParseError('null is not allowed to be used as an element'\n                               ' in a repeated field.')\n            getattr(arg_1, arg_5.name).append(\n                _ConvertScalarFieldValue(arg_8, arg_5))\n      elif arg_5.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:\n        arg_9 = getattr(arg_1, arg_5.name)\n        _ConvertMessage(arg_7, arg_9)\n      else:\n        setattr(arg_1, arg_5.name, _ConvertScalarFieldValue(arg_7, arg_5))\n    except ParseError as e:\n      if arg_5 and arg_5.containing_oneof is None:\n        raise ParseError('Failed to parse {0} field: {1}'.format(arg_4, e))\n      else:\n        raise ParseError(str(e))\n    except ValueError as e:\n      raise ParseError('Failed to parse {0} field: {1}.'.format(arg_4, e))\n    except TypeError as e:\n      raise ParseError('Failed to parse {0} field: {1}.'.format(arg_4, e))", "path": "typy/google/protobuf/json_format.py", "identifier": "_ConvertFieldValuePair", "docstring": "Convert field value pairs into regular message.\n\n  Args:\n    js: A JSON object to convert the field value pairs.\n    message: A regular protocol message to record the data.\n\n  Raises:\n    ParseError: In case of problems converting.", "docstring_tokens": ["Convert", "field", "value", "pairs", "into", "regular", "message", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 257160}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/github.py#L107-L120", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Utility for ripping apart github's Link header field.\n        It's kind of ugly.", "language": "python", "parameters": "(field)", "return_statement": "return dict([\n            (\n                part.split('; ')[1][5:-1],\n                part.split('; ')[0][1:-1],\n            ) for part in field.split(', ')\n        ])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "dict", "(", ")", "return", "dict", "(", "[", "(", "arg_1", ".", "split", "(", "'; '", ")", "[", "1", "]", "[", "5", ":", "-", "1", "]", ",", "arg_1", ".", "split", "(", "'; '", ")", "[", "0", "]", "[", "1", ":", "-", "1", "]", ",", ")", "for", "arg_1", "in", "arg_0", ".", "split", "(", "', '", ")", "]", ")"], "function": "def Func(arg_0):\n        \"\"\" Utility for ripping apart github's Link header field.\n        It's kind of ugly.\n        \"\"\"\n\n        if not arg_0:\n            return dict()\n\n        return dict([\n            (\n                arg_1.split('; ')[1][5:-1],\n                arg_1.split('; ')[0][1:-1],\n            ) for arg_1 in arg_0.split(', ')\n        ])", "path": "bugwarrior/services/github.py", "identifier": "GithubClient._link_field_to_dict", "docstring": "Utility for ripping apart github's Link header field.\n        It's kind of ugly.", "docstring_tokens": ["Utility", "for", "ripping", "apart", "github", "s", "Link", "header", "field", ".", "It", "s", "kind", "of", "ugly", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 257161}
{"url": "https://github.com/sergei-maertens/django-systemjs/blob/efd4a3862a39d9771609a25a5556f36023cf6e5c/systemjs/base.py#L284-L294", "sha": "efd4a3862a39d9771609a25a5556f36023cf6e5c", "docstring_summary": "Compares the app deptree file hashes with the hashes stored in the\n        cache.", "language": "python", "parameters": "(self, dep_tree)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_hashes", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "arg_5", "=", "arg_0", ".", "get_hash", "(", "arg_4", "[", "'path'", "]", ")", "if", "arg_5", "!=", "arg_2", "[", "arg_4", "[", "'path'", "]", "]", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Compares the app deptree file hashes with the hashes stored in the\n        cache.\n        \"\"\"\n        arg_2 = arg_0.get_hashes()\n        for arg_3, arg_4 in arg_1.items():\n            arg_5 = arg_0.get_hash(arg_4['path'])\n            if arg_5 != arg_2[arg_4['path']]:\n                return False\n        return True", "path": "systemjs/base.py", "identifier": "SystemTracer.hashes_match", "docstring": "Compares the app deptree file hashes with the hashes stored in the\n        cache.", "docstring_tokens": ["Compares", "the", "app", "deptree", "file", "hashes", "with", "the", "hashes", "stored", "in", "the", "cache", "."], "nwo": "sergei-maertens/django-systemjs", "score": 0.3518893757964147, "idx": 257162}
{"url": "https://github.com/jupyter-widgets/jupyterlab-sidecar/blob/8889d09f1a0933e2cbee06d4874f720b075b29e8/setupbase.py#L196-L205", "sha": "8889d09f1a0933e2cbee06d4874f720b075b29e8", "docstring_summary": "Create a command that calls the given function.", "language": "python", "parameters": "(func)", "return_statement": "return FuncCommand", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "class", "FuncCommand", "(", "BaseCommand", ")", ":", "def", "run", "(", "arg_1", ")", ":", "arg_0", "(", ")", "update_package_data", "(", "arg_1", ".", "distribution", ")", "return", "FuncCommand"], "function": "def Func(arg_0):\n    \"\"\"Create a command that calls the given function.\"\"\"\n\n    class FuncCommand(BaseCommand):\n\n        def run(arg_1):\n            arg_0()\n            update_package_data(arg_1.distribution)\n\n    return FuncCommand", "path": "setupbase.py", "identifier": "command_for_func", "docstring": "Create a command that calls the given function.", "docstring_tokens": ["Create", "a", "command", "that", "calls", "the", "given", "function", "."], "nwo": "jupyter-widgets/jupyterlab-sidecar", "score": 0.6376222650402201, "idx": 257163}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L517-L618", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Change the given swarm's state to 'newState'. If 'newState' is\n    'completed', then bestModelId and bestErrScore must be provided.", "language": "python", "parameters": "(self, swarmId, newStatus)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "(", "arg_2", "in", "[", "'active'", ",", "'completing'", ",", "'completed'", ",", "'killed'", "]", ")", "arg_3", "=", "arg_0", ".", "_state", "[", "'swarms'", "]", "[", "arg_1", "]", "if", "arg_3", "[", "'status'", "]", "==", "arg_2", ":", "return", "if", "arg_3", "[", "'status'", "]", "==", "'completed'", "and", "arg_2", "==", "'completing'", ":", "return", "arg_0", ".", "_dirty", "=", "True", "arg_3", "[", "'status'", "]", "=", "arg_2", "if", "arg_2", "==", "'completed'", ":", "(", "arg_5", ",", "arg_6", ")", "=", "arg_0", ".", "_hsObj", ".", "_resultsDB", ".", "bestModelIdAndErrScore", "(", "arg_1", ")", "arg_3", "[", "'bestModelId'", "]", "=", "arg_5", "arg_3", "[", "'bestErrScore'", "]", "=", "arg_6", "if", "arg_2", "!=", "'active'", "and", "arg_1", "in", "arg_0", ".", "_state", "[", "'activeSwarms'", "]", ":", "arg_0", ".", "_state", "[", "'activeSwarms'", "]", ".", "remove", "(", "arg_1", ")", "if", "arg_2", "==", "'killed'", ":", "arg_0", ".", "_hsObj", ".", "killSwarmParticles", "(", "arg_1", ")", "arg_7", "=", "arg_3", "[", "'sprintIdx'", "]", "arg_0", ".", "isSprintActive", "(", "arg_7", ")", "arg_8", "=", "arg_0", ".", "_state", "[", "'sprints'", "]", "[", "arg_7", "]", "arg_9", "=", "dict", "(", "active", "=", "0", ",", "completing", "=", "0", ",", "completed", "=", "0", ",", "killed", "=", "0", ")", "arg_10", "=", "[", "]", "arg_11", "=", "[", "]", "for", "arg_12", "in", "arg_0", ".", "_state", "[", "'swarms'", "]", ".", "itervalues", "(", ")", ":", "if", "arg_12", "[", "'sprintIdx'", "]", "!=", "arg_7", ":", "continue", "arg_9", "[", "arg_12", "[", "'status'", "]", "]", "+=", "1", "if", "arg_12", "[", "'status'", "]", "==", "'completed'", ":", "arg_10", ".", "append", "(", "arg_12", "[", "'bestModelId'", "]", ")", "arg_11", ".", "append", "(", "arg_12", "[", "'bestErrScore'", "]", ")", "if", "arg_9", "[", "'active'", "]", ">", "0", ":", "arg_13", "=", "'active'", "elif", "arg_9", "[", "'completing'", "]", ">", "0", ":", "arg_13", "=", "'completing'", "else", ":", "arg_13", "=", "'completed'", "arg_8", "[", "'status'", "]", "=", "arg_13", "if", "arg_13", "==", "'completed'", ":", "if", "len", "(", "arg_11", ")", ">", "0", ":", "arg_14", "=", "numpy", ".", "array", "(", "arg_11", ")", ".", "argmin", "(", ")", "arg_8", "[", "'bestModelId'", "]", "=", "arg_10", "[", "arg_14", "]", "arg_8", "[", "'bestErrScore'", "]", "=", "arg_11", "[", "arg_14", "]", "else", ":", "arg_8", "[", "'bestModelId'", "]", "=", "0", "arg_8", "[", "'bestErrScore'", "]", "=", "numpy", ".", "inf", "arg_15", "=", "numpy", ".", "inf", "for", "arg_16", "in", "range", "(", "arg_7", ")", ":", "if", "arg_0", ".", "_state", "[", "'sprints'", "]", "[", "arg_16", "]", "[", "'status'", "]", "==", "'completed'", ":", "(", "arg_17", ",", "arg_6", ")", "=", "arg_0", ".", "bestModelInCompletedSprint", "(", "arg_16", ")", "if", "arg_6", "is", "None", ":", "arg_6", "=", "numpy", ".", "inf", "else", ":", "arg_6", "=", "numpy", ".", "inf", "if", "arg_6", "<", "arg_15", ":", "arg_15", "=", "arg_6", "if", "arg_8", "[", "'bestErrScore'", "]", ">=", "arg_15", ":", "arg_0", ".", "_state", "[", "'lastGoodSprint'", "]", "=", "arg_7", "-", "1", "if", "arg_0", ".", "_state", "[", "'lastGoodSprint'", "]", "is", "not", "None", "and", "not", "arg_0", ".", "anyGoodSprintsActive", "(", ")", ":", "arg_0", ".", "_state", "[", "'searchOver'", "]", "=", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Change the given swarm's state to 'newState'. If 'newState' is\n    'completed', then bestModelId and bestErrScore must be provided.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    swarmId:      swarm Id\n    newStatus:    new status, either 'active', 'completing', 'completed', or\n                    'killed'\n    \"\"\"\n    assert (arg_2 in ['active', 'completing', 'completed', 'killed'])\n\n    # Set the swarm status\n    arg_3 = arg_0._state['swarms'][arg_1]\n    if arg_3['status'] == arg_2:\n      return\n\n    # If some other worker noticed it as completed, setting it to completing\n    #  is obviously old information....\n    if arg_3['status'] == 'completed' and arg_2 == 'completing':\n      return\n\n    arg_0._dirty = True\n    arg_3['status'] = arg_2\n    if arg_2 == 'completed':\n      (arg_5, arg_6) = arg_0._hsObj._resultsDB.bestModelIdAndErrScore(arg_1)\n      arg_3['bestModelId'] = arg_5\n      arg_3['bestErrScore'] = arg_6\n\n    # If no longer active, remove it from the activeSwarms entry\n    if arg_2 != 'active' and arg_1 in arg_0._state['activeSwarms']:\n      arg_0._state['activeSwarms'].remove(arg_1)\n\n    # If new status is 'killed', kill off any running particles in that swarm\n    if arg_2=='killed':\n      arg_0._hsObj.killSwarmParticles(arg_1)\n\n    # In case speculative particles are enabled, make sure we generate a new\n    #  swarm at this time if all of the swarms in the current sprint have\n    #  completed. This will insure that we don't mark the sprint as completed\n    #  before we've created all the possible swarms.\n    arg_7 = arg_3['sprintIdx']\n    arg_0.isSprintActive(arg_7)\n\n    # Update the sprint status. Check all the swarms that belong to this sprint.\n    #  If they are all completed, the sprint is completed.\n    arg_8 = arg_0._state['sprints'][arg_7]\n\n    arg_9 = dict(active=0, completing=0, completed=0, killed=0)\n    arg_10 = []\n    arg_11 = []\n    for arg_12 in arg_0._state['swarms'].itervalues():\n      if arg_12['sprintIdx'] != arg_7:\n        continue\n      arg_9[arg_12['status']] += 1\n      if arg_12['status'] == 'completed':\n        arg_10.append(arg_12['bestModelId'])\n        arg_11.append(arg_12['bestErrScore'])\n\n    if arg_9['active'] > 0:\n      arg_13 = 'active'\n    elif arg_9['completing'] > 0:\n      arg_13 = 'completing'\n    else:\n      arg_13 = 'completed'\n    arg_8['status'] = arg_13\n\n    # If the sprint is complete, get the best model from all of its swarms and\n    #  store that as the sprint best\n    if arg_13 == 'completed':\n      if len(arg_11) > 0:\n        arg_14 = numpy.array(arg_11).argmin()\n        arg_8['bestModelId'] = arg_10[arg_14]\n        arg_8['bestErrScore'] = arg_11[arg_14]\n      else:\n        # This sprint was empty, most likely because all particles were\n        #  killed. Give it a huge error score\n        arg_8['bestModelId'] = 0\n        arg_8['bestErrScore'] = numpy.inf\n\n\n      # See if our best err score got NO BETTER as compared to a previous\n      #  sprint. If so, stop exploring subsequent sprints (lastGoodSprint\n      #  is no longer None).\n      arg_15 = numpy.inf\n      for arg_16 in range(arg_7):\n        if arg_0._state['sprints'][arg_16]['status'] == 'completed':\n          (arg_17, arg_6) = arg_0.bestModelInCompletedSprint(arg_16)\n          if arg_6 is None:\n            arg_6 = numpy.inf\n        else:\n          arg_6 = numpy.inf\n        if arg_6 < arg_15:\n          arg_15 = arg_6\n\n      if arg_8['bestErrScore'] >= arg_15:\n        arg_0._state['lastGoodSprint'] = arg_7-1\n\n      # If ALL sprints up to the last good one are done, the search is now over\n      if arg_0._state['lastGoodSprint'] is not None \\\n            and not arg_0.anyGoodSprintsActive():\n        arg_0._state['searchOver'] = True", "path": "src/nupic/swarming/hypersearch/hs_state.py", "identifier": "HsState.setSwarmState", "docstring": "Change the given swarm's state to 'newState'. If 'newState' is\n    'completed', then bestModelId and bestErrScore must be provided.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    swarmId:      swarm Id\n    newStatus:    new status, either 'active', 'completing', 'completed', or\n                    'killed'", "docstring_tokens": ["Change", "the", "given", "swarm", "s", "state", "to", "newState", ".", "If", "newState", "is", "completed", "then", "bestModelId", "and", "bestErrScore", "must", "be", "provided", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257164}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/json.py#L69-L112", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Write the cobra model to a file in JSON format.", "language": "python", "parameters": "(model, filename, sort=False, pretty=False, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "arg_5", "=", "model_to_dict", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "arg_5", "[", "u\"version\"", "]", "=", "JSON_SPEC", "if", "arg_3", ":", "arg_6", "=", "{", "\"indent\"", ":", "4", ",", "\"separators\"", ":", "(", "\",\"", ",", "\": \"", ")", ",", "\"sort_keys\"", ":", "True", ",", "\"allow_nan\"", ":", "False", "}", "else", ":", "arg_6", "=", "{", "\"indent\"", ":", "0", ",", "\"separators\"", ":", "(", "\",\"", ",", "\":\"", ")", ",", "\"sort_keys\"", ":", "False", ",", "\"allow_nan\"", ":", "False", "}", "arg_6", ".", "update", "(", "**", "arg_4", ")", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", ":", "with", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "file_handle", ":", "json", ".", "dump", "(", "arg_5", ",", "file_handle", ",", "**", "arg_6", ")", "else", ":", "json", ".", "dump", "(", "arg_5", ",", "arg_1", ",", "**", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False, **arg_4):\n    \"\"\"\n    Write the cobra model to a file in JSON format.\n\n    ``kwargs`` are passed on to ``json.dump``.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to represent.\n    filename : str or file-like\n        File path or descriptor that the JSON representation should be\n        written to.\n    sort : bool, optional\n        Whether to sort the metabolites, reactions, and genes or maintain the\n        order defined in the model.\n    pretty : bool, optional\n        Whether to format the JSON more compactly (default) or in a more\n        verbose but easier to read fashion. Can be partially overwritten by the\n        ``kwargs``.\n\n    See Also\n    --------\n    to_json : Return a string representation.\n    json.dump : Base function.\n    \"\"\"\n    arg_5 = model_to_dict(arg_0, arg_2=arg_2)\n    arg_5[u\"version\"] = JSON_SPEC\n\n    if arg_3:\n        arg_6 = {\n            \"indent\": 4, \"separators\": (\",\", \": \"), \"sort_keys\": True,\n            \"allow_nan\": False}\n    else:\n        arg_6 = {\n            \"indent\": 0, \"separators\": (\",\", \":\"), \"sort_keys\": False,\n            \"allow_nan\": False}\n    arg_6.update(**arg_4)\n\n    if isinstance(arg_1, string_types):\n        with open(arg_1, \"w\") as file_handle:\n            json.dump(arg_5, file_handle, **arg_6)\n    else:\n        json.dump(arg_5, arg_1, **arg_6)", "path": "cobra/io/json.py", "identifier": "save_json_model", "docstring": "Write the cobra model to a file in JSON format.\n\n    ``kwargs`` are passed on to ``json.dump``.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to represent.\n    filename : str or file-like\n        File path or descriptor that the JSON representation should be\n        written to.\n    sort : bool, optional\n        Whether to sort the metabolites, reactions, and genes or maintain the\n        order defined in the model.\n    pretty : bool, optional\n        Whether to format the JSON more compactly (default) or in a more\n        verbose but easier to read fashion. Can be partially overwritten by the\n        ``kwargs``.\n\n    See Also\n    --------\n    to_json : Return a string representation.\n    json.dump : Base function.", "docstring_tokens": ["Write", "the", "cobra", "model", "to", "a", "file", "in", "JSON", "format", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 257165}
{"url": "https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/managers.py#L37-L68", "sha": "7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d", "docstring_summary": "Returns all events that have an occurrence within the given\n        month & year.", "language": "python", "parameters": "(self, year, month, category=None, tag=None,\n                         loc=False, cncl=False)", "return_statement": "return self.model.objects.filter(\n            # only events that are still repeating\n            r & (dstart_mo | dend_mo) |  # yearly repeat\n            (~Q(repeat=\"NEVER\")) |  # all other repeats\n            ((dstart_yr | dend_yr) & (dstart_mo | dend_yr)),  # non-repeating\n            Q(end_repeat=None) | Q(end_repeat__gte=ym_first),\n            start_date__lte=ym_last  # no events that haven't started yet\n        ).filter(**kwargs).prefetch_related(*pref).order_by('start_date').distinct()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "arg_0", ".", "_get_kwargs", "(", "arg_3", ",", "arg_4", ")", "arg_8", ",", "arg_9", "=", "arg_0", ".", "get_first_and_last", "(", "arg_1", ",", "arg_2", ")", "arg_10", "=", "[", "]", "if", "arg_5", ":", "arg_10", ".", "append", "(", "\"location\"", ")", "if", "arg_6", ":", "arg_10", ".", "append", "(", "\"cancellations\"", ")", "arg_11", "=", "Q", "(", "repeat", "=", "\"YEARLY\"", ")", "arg_12", "=", "Q", "(", "start_date__month", "=", "arg_2", ")", "arg_13", "=", "Q", "(", "end_date__month", "=", "arg_2", ")", "arg_14", "=", "Q", "(", "start_date__year", "=", "arg_1", ")", "arg_15", "=", "Q", "(", "end_date__year", "=", "arg_1", ")", "return", "arg_0", ".", "model", ".", "objects", ".", "filter", "(", "arg_11", "&", "(", "arg_12", "|", "arg_13", ")", "|", "(", "~", "Q", "(", "repeat", "=", "\"NEVER\"", ")", ")", "|", "(", "(", "arg_14", "|", "arg_15", ")", "&", "(", "arg_12", "|", "arg_15", ")", ")", ",", "Q", "(", "end_repeat", "=", "None", ")", "|", "Q", "(", "end_repeat__gte", "=", "arg_8", ")", ",", "start_date__lte", "=", "arg_9", ")", ".", "filter", "(", "**", "arg_7", ")", ".", "prefetch_related", "(", "*", "arg_10", ")", ".", "order_by", "(", "'start_date'", ")", ".", "distinct", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,\n                         arg_5=False, arg_6=False):\n        \"\"\"\n        Returns all events that have an occurrence within the given\n        month & year.\n        \"\"\"\n        arg_7 = arg_0._get_kwargs(arg_3, arg_4)\n        arg_8, arg_9 = arg_0.get_first_and_last(arg_1, arg_2)\n\n        arg_10 = []\n        if arg_5:\n            arg_10.append(\"location\")\n        if arg_6:\n            arg_10.append(\"cancellations\")\n\n        # for yearly repeat, we need to check the start and end date months\n        # b/c yearly events should occur every year in the same month\n        arg_11 = Q(repeat=\"YEARLY\")\n        arg_12 = Q(start_date__month=arg_2)\n        arg_13 = Q(end_date__month=arg_2)\n\n        arg_14 = Q(start_date__year=arg_1)\n        arg_15 = Q(end_date__year=arg_1)\n\n        return arg_0.model.objects.filter(\n            # only events that are still repeating\n            arg_11 & (arg_12 | arg_13) |  # yearly repeat\n            (~Q(repeat=\"NEVER\")) |  # all other repeats\n            ((arg_14 | arg_15) & (arg_12 | arg_15)),  # non-repeating\n            Q(end_repeat=None) | Q(end_repeat__gte=arg_8),\n            start_date__lte=arg_9  # no events that haven't started yet\n        ).filter(**arg_7).prefetch_related(*arg_10).order_by('start_date').distinct()", "path": "happenings/managers.py", "identifier": "EventManager.all_month_events", "docstring": "Returns all events that have an occurrence within the given\n        month & year.", "docstring_tokens": ["Returns", "all", "events", "that", "have", "an", "occurrence", "within", "the", "given", "month", "&", "year", "."], "nwo": "wreckage/django-happenings", "score": 0.41124813484918504, "idx": 257166}
{"url": "https://github.com/CIRCL/IP-ASN-history/blob/2e02ced01a08531a007d9cd71547c8248570de1b/server/db_generator.py#L79-L100", "sha": "2e02ced01a08531a007d9cd71547c8248570de1b", "docstring_summary": "Run processes which push the routing dump of the RIPE in a redis\n        database.\n        The dump has been splitted in multiple files and each process run\n        on one of this files.", "language": "python", "parameters": "(max_simultaneous_processes, process_name,\n                            filenames)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "while", "len", "(", "arg_2", ")", ">", "0", ":", "while", "len", "(", "arg_2", ")", ">", "0", "and", "len", "(", "arg_3", ")", "<", "arg_0", ":", "arg_4", "=", "arg_2", ".", "pop", "(", ")", "arg_3", ".", "append", "(", "service_start", "(", "service", "=", "arg_1", ",", "param", "=", "[", "'-f'", ",", "arg_4", ",", "'-d'", ",", "imported_day", "]", ")", ")", "while", "len", "(", "arg_3", ")", "==", "arg_0", ":", "time", ".", "sleep", "(", "sleep_timer", ")", "arg_3", "=", "update_running_pids", "(", "arg_3", ")", "while", "len", "(", "arg_3", ")", ">", "0", ":", "time", ".", "sleep", "(", "sleep_timer", ")", "arg_3", "=", "update_running_pids", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1,\n                            arg_2):\n    \"\"\"\n        Run processes which push the routing dump of the RIPE in a redis\n        database.\n        The dump has been splitted in multiple files and each process run\n        on one of this files.\n    \"\"\"\n    arg_3 = []\n    while len(arg_2) > 0:\n        while len(arg_2) > 0 and len(arg_3) < arg_0:\n            arg_4 = arg_2.pop()\n            arg_3.append(service_start(service=arg_1,\n                                      param=['-f', arg_4, '-d',\n                                             imported_day]))\n        while len(arg_3) == arg_0:\n            time.sleep(sleep_timer)\n            arg_3 = update_running_pids(arg_3)\n    while len(arg_3) > 0:\n        # Wait until all the processes are finished\n        time.sleep(sleep_timer)\n        arg_3 = update_running_pids(arg_3)", "path": "server/db_generator.py", "identifier": "run_splitted_processing", "docstring": "Run processes which push the routing dump of the RIPE in a redis\n        database.\n        The dump has been splitted in multiple files and each process run\n        on one of this files.", "docstring_tokens": ["Run", "processes", "which", "push", "the", "routing", "dump", "of", "the", "RIPE", "in", "a", "redis", "database", ".", "The", "dump", "has", "been", "splitted", "in", "multiple", "files", "and", "each", "process", "run", "on", "one", "of", "this", "files", "."], "nwo": "CIRCL/IP-ASN-history", "score": 0.5613988127652619, "idx": 257167}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L765-L808", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Return an array with the axes transposed.", "language": "python", "parameters": "(self, *axes)", "return_statement": "return arr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "arg_2", "=", "arange", "(", "arg_0", ".", "ndim", "-", "1", ",", "-", "1", ",", "-", "1", ")", "else", ":", "arg_2", "=", "asarray", "(", "argpack", "(", "arg_1", ")", ")", "isFuncable", "(", "arg_2", ",", "range", "(", "arg_0", ".", "ndim", ")", ")", "arg_3", "=", "arg_0", ".", "split", "arg_4", ",", "arg_5", "=", "arg_2", "[", ":", "arg_3", "]", ",", "arg_2", "[", "arg_3", ":", "]", "arg_6", "=", "sort", "(", "arg_5", "[", "arg_5", "<", "arg_3", "]", ")", "arg_7", "=", "sort", "(", "arg_4", "[", "arg_4", ">=", "arg_3", "]", ")", "arg_8", "=", "sort", "(", "arg_4", "[", "arg_4", "<", "arg_3", "]", ")", "arg_9", "=", "sort", "(", "arg_5", "[", "arg_5", ">=", "arg_3", "]", ")", "arg_10", "=", "r_", "[", "arg_8", ",", "arg_7", ",", "arg_6", ",", "arg_9", "]", "arg_11", "=", "argsort", "(", "arg_10", ")", "arg_12", "=", "arg_11", "[", "arg_2", "]", "arg_13", ",", "arg_14", "=", "arg_12", "[", ":", "arg_3", "]", ",", "arg_12", "[", "arg_3", ":", "]", "-", "arg_3", "arg_15", "=", "arg_0", ".", "swap", "(", "arg_6", ",", "arg_7", "-", "arg_3", ")", "arg_15", "=", "arg_15", ".", "keys", ".", "Func", "(", "tuple", "(", "arg_13", ".", "tolist", "(", ")", ")", ")", "arg_15", "=", "arg_15", ".", "values", ".", "Func", "(", "tuple", "(", "arg_14", ".", "tolist", "(", ")", ")", ")", "return", "arg_15"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Return an array with the axes Funcd.\n\n        This operation will incur a swap unless the\n        desiured permutation can be obtained\n        only by transpoing the keys or the values.\n\n        Parameters\n        ----------\n        axes : None, tuple of ints, or n ints\n            If None, will reverse axis order.\n        \"\"\"\n        if len(arg_1) == 0:\n            arg_2 = arange(arg_0.ndim-1, -1, -1)\n        else:\n            arg_2 = asarray(argpack(arg_1))\n\n        isFuncable(arg_2, range(arg_0.ndim))\n\n        arg_3 = arg_0.split\n\n        # compute the keys/value axes that need to be swapped\n        arg_4, arg_5 = arg_2[:arg_3], arg_2[arg_3:]\n        arg_6 = sort(arg_5[arg_5 < arg_3])\n        arg_7 = sort(arg_4[arg_4 >= arg_3])\n        arg_8 = sort(arg_4[arg_4 < arg_3])\n        arg_9 = sort(arg_5[arg_5 >= arg_3])\n\n        # compute the permutation that the swap causes\n        arg_10 = r_[arg_8, arg_7, arg_6, arg_9]\n\n        # compute the extra permutation (p_x)  on top of this that\n        # needs to happen to get the full permutation desired\n        arg_11 = argsort(arg_10)\n        arg_12 = arg_11[arg_2]\n        arg_13, arg_14 = arg_12[:arg_3], arg_12[arg_3:]-arg_3\n\n        # perform the swap and the the within key/value permutations\n        arg_15 = arg_0.swap(arg_6, arg_7-arg_3)\n        arg_15 = arg_15.keys.Func(tuple(arg_13.tolist()))\n        arg_15 = arg_15.values.Func(tuple(arg_14.tolist()))\n\n        return arg_15", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark.transpose", "docstring": "Return an array with the axes transposed.\n\n        This operation will incur a swap unless the\n        desiured permutation can be obtained\n        only by transpoing the keys or the values.\n\n        Parameters\n        ----------\n        axes : None, tuple of ints, or n ints\n            If None, will reverse axis order.", "docstring_tokens": ["Return", "an", "array", "with", "the", "axes", "transposed", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 257168}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L143-L162", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Lists the files and folders of a specific directory\n        default is the current working directory.", "language": "python", "parameters": "(self, folder='')", "return_statement": "return files, folders", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "arg_0", ".", "_ftp", ".", "pwd", "(", ")", "arg_0", ".", "cd", "(", "arg_1", ")", "arg_3", "=", "[", "]", "arg_0", ".", "_ftp", ".", "retrlines", "(", "'LIST'", ",", "lambda", "a", ":", "arg_3", ".", "append", "(", "a", ")", ")", "arg_4", "=", "filter", "(", "lambda", "a", ":", "a", ".", "split", "(", ")", "[", "0", "]", ".", "startswith", "(", "'-'", ")", ",", "arg_3", ")", "arg_5", "=", "filter", "(", "lambda", "a", ":", "a", ".", "split", "(", ")", "[", "0", "]", ".", "startswith", "(", "'d'", ")", ",", "arg_3", ")", "arg_4", "=", "map", "(", "lambda", "a", ":", "' '", ".", "join", "(", "a", ".", "split", "(", ")", "[", "8", ":", "]", ")", ",", "arg_4", ")", "arg_5", "=", "map", "(", "lambda", "a", ":", "' '", ".", "join", "(", "a", ".", "split", "(", ")", "[", "8", ":", "]", ")", ",", "arg_5", ")", "arg_0", ".", "_ftp", ".", "cwd", "(", "arg_2", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1=''):\n        \"\"\" Lists the files and folders of a specific directory\n        default is the current working directory.\n\n        :param folder: the folder to be listed.\n        :type folder: string\n\n        :returns: a tuple with the list of files in the folder\n                  and the list of subfolders in the folder.\n        \"\"\"\n        arg_2 = arg_0._ftp.pwd()\n        arg_0.cd(arg_1)\n        arg_3 = []\n        arg_0._ftp.retrlines('LIST', lambda a: arg_3.append(a))\n        arg_4 = filter(lambda a: a.split()[0].startswith('-'), arg_3)\n        arg_5 = filter(lambda a: a.split()[0].startswith('d'), arg_3)\n        arg_4 = map(lambda a: ' '.join(a.split()[8:]), arg_4)\n        arg_5 = map(lambda a: ' '.join(a.split()[8:]), arg_5)\n        arg_0._ftp.cwd(arg_2)\n        return arg_4, arg_5", "path": "harvestingkit/ftp_utils.py", "identifier": "FtpHandler.ls", "docstring": "Lists the files and folders of a specific directory\n        default is the current working directory.\n\n        :param folder: the folder to be listed.\n        :type folder: string\n\n        :returns: a tuple with the list of files in the folder\n                  and the list of subfolders in the folder.", "docstring_tokens": ["Lists", "the", "files", "and", "folders", "of", "a", "specific", "directory", "default", "is", "the", "current", "working", "directory", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257169}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/nelder_mead.py#L602-L606", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Replaces an element at supplied index.", "language": "python", "parameters": "(x, index, replacement)", "return_statement": "return x_new", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "tf", ".", "concat", "(", "[", "arg_0", "[", ":", "arg_1", "]", ",", "tf", ".", "expand_dims", "(", "arg_2", ",", "axis", "=", "0", ")", ",", "arg_0", "[", "(", "arg_1", "+", "1", ")", ":", "]", "]", ",", "axis", "=", "0", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Replaces an element at supplied index.\"\"\"\n  arg_3 = tf.concat([arg_0[:arg_1], tf.expand_dims(arg_2, axis=0),\n                     arg_0[(arg_1 + 1):]], axis=0)\n  return arg_3", "path": "tensorflow_probability/python/optimizer/nelder_mead.py", "identifier": "_replace_at_index", "docstring": "Replaces an element at supplied index.", "docstring_tokens": ["Replaces", "an", "element", "at", "supplied", "index", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257170}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L1218-L1243", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a new function with the given meta. If the function f already\n    has a meta map, then merge the", "language": "python", "parameters": "(f, meta: Optional[lmap.Map])", "return_statement": "return wrapped_f", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", ".", "Map", "]", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "arg_3", ".", "Map", ")", ":", "raise", "TypeError", "(", "\"meta must be a map\"", ")", "if", "inspect", ".", "iscoroutinefunction", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "async", "def", "arg_7", "(", "*", "arg_5", ",", "**", "arg_6", ")", ":", "return", "await", "arg_0", "(", "*", "arg_5", ",", "**", "arg_6", ")", "else", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "arg_7", "(", "*", "arg_5", ",", "**", "arg_6", ")", ":", "return", "arg_0", "(", "*", "arg_5", ",", "**", "arg_6", ")", "arg_7", ".", "meta", "=", "(", "arg_0", ".", "meta", ".", "update", "(", "arg_1", ")", "if", "hasattr", "(", "arg_0", ",", "\"meta\"", ")", "and", "isinstance", "(", "arg_0", ".", "meta", ",", "arg_3", ".", "Map", ")", "else", "arg_1", ")", "arg_7", ".", "with_meta", "=", "partial", "(", "Func", ",", "arg_7", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1: arg_2[arg_3.Map]):\n    \"\"\"Return a new function with the given meta. If the function f already\n    has a meta map, then merge the \"\"\"\n\n    if not isinstance(arg_1, arg_3.Map):\n        raise TypeError(\"meta must be a map\")\n\n    if inspect.iscoroutinefunction(arg_0):\n\n        @functools.wraps(arg_0)\n        async def arg_7(*arg_5, **arg_6):\n            return await arg_0(*arg_5, **arg_6)\n\n    else:\n\n        @functools.wraps(arg_0)  # type: ignore\n        def arg_7(*arg_5, **arg_6):\n            return arg_0(*arg_5, **arg_6)\n\n    arg_7.meta = (  # type: ignore\n        arg_0.meta.update(arg_1)\n        if hasattr(arg_0, \"meta\") and isinstance(arg_0.meta, arg_3.Map)\n        else arg_1\n    )\n    arg_7.with_meta = partial(Func, arg_7)  # type: ignore\n    return arg_7", "path": "src/basilisp/lang/runtime.py", "identifier": "_fn_with_meta", "docstring": "Return a new function with the given meta. If the function f already\n    has a meta map, then merge the", "docstring_tokens": ["Return", "a", "new", "function", "with", "the", "given", "meta", ".", "If", "the", "function", "f", "already", "has", "a", "meta", "map", "then", "merge", "the"], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 257171}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/databricks_operator.py#L34-L58", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Coerces content or all values of content if it is a dict to a string. The\n    function will throw if content contains non-string or non-numeric types.", "language": "python", "parameters": "(content, json_path='json')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'json'", ")", ":", "arg_2", "=", "Func", "if", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "return", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "six", ".", "integer_types", "+", "(", "float", ",", ")", ")", ":", "return", "str", "(", "arg_0", ")", "elif", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "arg_2", "(", "arg_4", ",", "'{0}[{1}]'", ".", "format", "(", "arg_1", ",", "arg_3", ")", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", "]", "elif", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "return", "{", "arg_5", ":", "arg_2", "(", "arg_6", ",", "'{0}[{1}]'", ".", "format", "(", "arg_1", ",", "arg_5", ")", ")", "for", "arg_5", ",", "arg_6", "in", "list", "(", "arg_0", ".", "items", "(", ")", ")", "}", "else", ":", "arg_7", "=", "type", "(", "arg_0", ")", "arg_8", "=", "'Type {0} used for parameter {1} is not a number or a string'", ".", "format", "(", "arg_7", ",", "arg_1", ")", "raise", "AirflowException", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1='json'):\n    \"\"\"\n    Coerces content or all values of content if it is a dict to a string. The\n    function will throw if content contains non-string or non-numeric types.\n\n    The reason why we have this function is because the ``self.json`` field must be a\n    dict with only string values. This is because ``render_template`` will fail\n    for numerical values.\n    \"\"\"\n    arg_2 = Func\n    if isinstance(arg_0, six.string_types):\n        return arg_0\n    elif isinstance(arg_0, six.integer_types + (float,)):\n        # Databricks can tolerate either numeric or string types in the API backend.\n        return str(arg_0)\n    elif isinstance(arg_0, (list, tuple)):\n        return [arg_2(arg_4, '{0}[{1}]'.format(arg_1, arg_3)) for arg_3, arg_4 in enumerate(arg_0)]\n    elif isinstance(arg_0, dict):\n        return {arg_5: arg_2(arg_6, '{0}[{1}]'.format(arg_1, arg_5))\n                for arg_5, arg_6 in list(arg_0.items())}\n    else:\n        arg_7 = type(arg_0)\n        arg_8 = 'Type {0} used for parameter {1} is not a number or a string' \\\n            .format(arg_7, arg_1)\n        raise AirflowException(arg_8)", "path": "airflow/contrib/operators/databricks_operator.py", "identifier": "_deep_string_coerce", "docstring": "Coerces content or all values of content if it is a dict to a string. The\n    function will throw if content contains non-string or non-numeric types.\n\n    The reason why we have this function is because the ``self.json`` field must be a\n    dict with only string values. This is because ``render_template`` will fail\n    for numerical values.", "docstring_tokens": ["Coerces", "content", "or", "all", "values", "of", "content", "if", "it", "is", "a", "dict", "to", "a", "string", ".", "The", "function", "will", "throw", "if", "content", "contains", "non", "-", "string", "or", "non", "-", "numeric", "types", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257172}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L692-L705", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "read all the data.\n            If reverse=True the x axis is flipped.", "language": "python", "parameters": "(self,reverse=True)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "raise", "NotImplementedError", "(", "'To be implemented'", ")", "arg_0", ".", "filfile", ".", "seek", "(", "int", "(", "arg_0", ".", "datastart", ")", ")", "arg_2", "=", "np", ".", "fromfile", "(", "arg_0", ".", "filfile", ",", "dtype", "=", "arg_0", ".", "dtype", ")", ".", "reshape", "(", "arg_0", ".", "blocksize", ",", "arg_0", ".", "channels", ")", "if", "arg_1", ":", "arg_2", "=", "arg_2", "[", ":", ",", ":", ":", "-", "1", "]", "return", "arg_2"], "function": "def Func(arg_0,arg_1=True):\n        \"\"\" read all the data.\n            If reverse=True the x axis is flipped.\n        \"\"\"\n        raise NotImplementedError('To be implemented')\n\n        # go to start of the data\n        arg_0.filfile.seek(int(arg_0.datastart))\n        # read data into 2-D numpy array\n#        data=np.fromfile(self.filfile,dtype=self.dtype).reshape(self.channels,self.blocksize,order='F')\n        arg_2=np.fromfile(arg_0.filfile,dtype=arg_0.dtype).reshape(arg_0.blocksize, arg_0.channels)\n        if arg_1:\n            arg_2 = arg_2[:,::-1]\n        return arg_2", "path": "blimpy/file_wrapper.py", "identifier": "FilReader.read_all", "docstring": "read all the data.\n            If reverse=True the x axis is flipped.", "docstring_tokens": ["read", "all", "the", "data", ".", "If", "reverse", "=", "True", "the", "x", "axis", "is", "flipped", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 257173}
{"url": "https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/__init__.py#L1307-L1366", "sha": "ecc9fd434c23d896ccd1f35795ccc047f946ed05", "docstring_summary": "Save report data in the given directory", "language": "python", "parameters": "(results, output_directory=\"output\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"output\"", ")", ":", "arg_2", "=", "arg_0", "[", "\"aggregate_reports\"", "]", "arg_3", "=", "arg_0", "[", "\"forensic_reports\"", "]", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "\"{0} is not a directory\"", ".", "format", "(", "arg_1", ")", ")", "else", ":", "os", ".", "makedirs", "(", "arg_1", ")", "with", "open", "(", "\"{0}\"", ".", "format", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"aggregate.json\"", ")", ")", ",", "\"w\"", ",", "newline", "=", "\"\\n\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "agg_json", ":", "agg_json", ".", "write", "(", "json", ".", "dumps", "(", "arg_2", ",", "ensure_ascii", "=", "False", ",", "indent", "=", "2", ")", ")", "with", "open", "(", "\"{0}\"", ".", "format", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"aggregate.csv\"", ")", ")", ",", "\"w\"", ",", "newline", "=", "\"\\n\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "agg_csv", ":", "arg_4", "=", "parsed_aggregate_reports_to_csv", "(", "arg_2", ")", "agg_csv", ".", "write", "(", "arg_4", ")", "with", "open", "(", "\"{0}\"", ".", "format", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"forensic.json\"", ")", ")", ",", "\"w\"", ",", "newline", "=", "\"\\n\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "for_json", ":", "for_json", ".", "write", "(", "json", ".", "dumps", "(", "arg_3", ",", "ensure_ascii", "=", "False", ",", "indent", "=", "2", ")", ")", "with", "open", "(", "\"{0}\"", ".", "format", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"forensic.csv\"", ")", ")", ",", "\"w\"", ",", "newline", "=", "\"\\n\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "for_csv", ":", "arg_4", "=", "parsed_forensic_reports_to_csv", "(", "arg_3", ")", "for_csv", ".", "write", "(", "arg_4", ")", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"samples\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "os", ".", "makedirs", "(", "arg_5", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_3", ":", "arg_8", "=", "arg_7", "[", "\"sample\"", "]", "arg_9", "=", "0", "arg_10", "=", "arg_7", "[", "\"parsed_sample\"", "]", "arg_11", "=", "arg_10", "[", "\"filename_safe_subject\"", "]", "arg_12", "=", "arg_11", "while", "arg_12", "in", "arg_6", ":", "arg_9", "+=", "1", "arg_12", "=", "\"{0} ({1})\"", ".", "format", "(", "arg_11", ",", "arg_9", ")", "arg_6", ".", "append", "(", "arg_12", ")", "arg_12", "=", "\"{0}.eml\"", ".", "format", "(", "arg_12", ")", "arg_13", "=", "os", ".", "path", ".", "join", "(", "arg_5", ",", "arg_12", ")", "with", "open", "(", "arg_13", ",", "\"w\"", ",", "newline", "=", "\"\\n\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "sample_file", ":", "sample_file", ".", "write", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1=\"output\"):\n    \"\"\"\n    Save report data in the given directory\n\n    Args:\n        results (OrderedDict): Parsing results\n        output_directory: The patch to the directory to save in\n    \"\"\"\n\n    arg_2 = arg_0[\"aggregate_reports\"]\n    arg_3 = arg_0[\"forensic_reports\"]\n\n    if os.path.exists(arg_1):\n        if not os.path.isdir(arg_1):\n            raise ValueError(\"{0} is not a directory\".format(arg_1))\n    else:\n        os.makedirs(arg_1)\n\n    with open(\"{0}\".format(os.path.join(arg_1, \"aggregate.json\")),\n              \"w\", newline=\"\\n\", encoding=\"utf-8\") as agg_json:\n        agg_json.write(json.dumps(arg_2, ensure_ascii=False,\n                                  indent=2))\n\n    with open(\"{0}\".format(os.path.join(arg_1, \"aggregate.csv\")),\n              \"w\", newline=\"\\n\", encoding=\"utf-8\") as agg_csv:\n        arg_4 = parsed_aggregate_reports_to_csv(arg_2)\n        agg_csv.write(arg_4)\n\n    with open(\"{0}\".format(os.path.join(arg_1, \"forensic.json\")),\n              \"w\", newline=\"\\n\", encoding=\"utf-8\") as for_json:\n        for_json.write(json.dumps(arg_3, ensure_ascii=False,\n                                  indent=2))\n\n    with open(\"{0}\".format(os.path.join(arg_1, \"forensic.csv\")),\n              \"w\", newline=\"\\n\", encoding=\"utf-8\") as for_csv:\n        arg_4 = parsed_forensic_reports_to_csv(arg_3)\n        for_csv.write(arg_4)\n\n    arg_5 = os.path.join(arg_1, \"samples\")\n    if not os.path.exists(arg_5):\n        os.makedirs(arg_5)\n\n    arg_6 = []\n    for arg_7 in arg_3:\n        arg_8 = arg_7[\"sample\"]\n        arg_9 = 0\n        arg_10 = arg_7[\"parsed_sample\"]\n        arg_11 = arg_10[\"filename_safe_subject\"]\n        arg_12 = arg_11\n\n        while arg_12 in arg_6:\n            arg_9 += 1\n            arg_12 = \"{0} ({1})\".format(arg_11, arg_9)\n\n        arg_6.append(arg_12)\n\n        arg_12 = \"{0}.eml\".format(arg_12)\n        arg_13 = os.path.join(arg_5, arg_12)\n        with open(arg_13, \"w\", newline=\"\\n\", encoding=\"utf-8\") as sample_file:\n            sample_file.write(arg_8)", "path": "parsedmarc/__init__.py", "identifier": "save_output", "docstring": "Save report data in the given directory\n\n    Args:\n        results (OrderedDict): Parsing results\n        output_directory: The patch to the directory to save in", "docstring_tokens": ["Save", "report", "data", "in", "the", "given", "directory"], "nwo": "domainaware/parsedmarc", "score": 0.7452768887820926, "idx": 257174}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/__init__.py#L327-L338", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Similar to from_arrays, but convenient for a DataFrame of length 1.", "language": "python", "parameters": "(**kwargs)", "return_statement": "return from_arrays(**{k: np.array([v]) for k, v in kwargs.items()})", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "import", "numpy", "as", "np", "return", "from_arrays", "(", "**", "{", "arg_1", ":", "np", ".", "array", "(", "[", "arg_2", "]", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", "}", ")"], "function": "def Func(**arg_0):\n    \"\"\"Similar to from_arrays, but convenient for a DataFrame of length 1.\n\n    Example:\n\n    >>> import vaex\n    >>> df = vaex.Func(x=1, y=2)\n\n    :rtype: DataFrame\n    \"\"\"\n    import numpy as np\n    return from_arrays(**{arg_1: np.array([arg_2]) for arg_1, arg_2 in arg_0.items()})", "path": "packages/vaex-core/vaex/__init__.py", "identifier": "from_scalars", "docstring": "Similar to from_arrays, but convenient for a DataFrame of length 1.\n\n    Example:\n\n    >>> import vaex\n    >>> df = vaex.from_scalars(x=1, y=2)\n\n    :rtype: DataFrame", "docstring_tokens": ["Similar", "to", "from_arrays", "but", "convenient", "for", "a", "DataFrame", "of", "length", "1", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257175}
{"url": "https://github.com/mordred-descriptor/mordred/blob/2848b088fd7b6735590242b5e22573babc724f10/mordred/_base/result.py#L130-L143", "sha": "2848b088fd7b6735590242b5e22573babc724f10", "docstring_summary": "r\"\"\"Access descriptor value by descriptor name or instance.", "language": "python", "parameters": "(self)", "return_statement": "return GetValueByName(self._name_to_value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Func_to_value", "is", "None", ":", "arg_0", ".", "_Func_to_value", "=", "{", "str", "(", "d", ")", ":", "v", "for", "d", ",", "v", "in", "zip", "(", "arg_0", ".", "_descriptors", ",", "arg_0", ".", "_values", ")", "}", "return", "GetValueByName", "(", "arg_0", ".", "_Func_to_value", ")"], "function": "def Func(arg_0):\n        r\"\"\"Access descriptor value by descriptor Func or instance.\n\n        >>> from mordred import Calculator, descriptors\n        >>> from rdkit import Chem\n        >>> result = Calculator(descriptors)(Chem.MolFromSmiles(\"C1CCCCC1\"))\n        >>> result.Func[\"C2SP3\"]\n        6\n\n        \"\"\"\n        if arg_0._Func_to_value is None:\n            arg_0._Func_to_value = {str(d): v for d, v in zip(arg_0._descriptors, arg_0._values)}\n\n        return GetValueByName(arg_0._Func_to_value)", "path": "mordred/_base/result.py", "identifier": "Result.name", "docstring": "r\"\"\"Access descriptor value by descriptor name or instance.\n\n        >>> from mordred import Calculator, descriptors\n        >>> from rdkit import Chem\n        >>> result = Calculator(descriptors)(Chem.MolFromSmiles(\"C1CCCCC1\"))\n        >>> result.name[\"C2SP3\"]\n        6", "docstring_tokens": ["r", "Access", "descriptor", "value", "by", "descriptor", "name", "or", "instance", "."], "nwo": "mordred-descriptor/mordred", "score": 0.9032497569731454, "idx": 257176}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1481-L1499", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "This internal helper does the common work for\n        ``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is\n        almost all of it.", "language": "python", "parameters": "(self, helper, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_ocsp_helper", "=", "arg_1", "arg_0", ".", "_ocsp_callback", "=", "arg_1", ".", "callback", "if", "arg_2", "is", "None", ":", "arg_0", ".", "_ocsp_data", "=", "_ffi", ".", "NULL", "else", ":", "arg_0", ".", "_ocsp_data", "=", "_ffi", ".", "new_handle", "(", "arg_2", ")", "arg_6", "=", "_lib", ".", "SSL_CTX_set_tlsext_status_cb", "(", "arg_0", ".", "_context", ",", "arg_0", ".", "_ocsp_callback", ")", "_openssl_assert", "(", "arg_6", "==", "1", ")", "arg_6", "=", "_lib", ".", "SSL_CTX_set_tlsext_status_arg", "(", "arg_0", ".", "_context", ",", "arg_0", ".", "_ocsp_data", ")", "_openssl_assert", "(", "arg_6", "==", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        This internal helper does the common work for\n        ``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is\n        almost all of it.\n        \"\"\"\n        arg_0._ocsp_helper = arg_1\n        arg_0._ocsp_callback = arg_1.callback\n        if arg_2 is None:\n            arg_0._ocsp_data = _ffi.NULL\n        else:\n            arg_0._ocsp_data = _ffi.new_handle(arg_2)\n\n        arg_6 = _lib.SSL_CTX_set_tlsext_status_cb(\n            arg_0._context, arg_0._ocsp_callback\n        )\n        _openssl_assert(arg_6 == 1)\n        arg_6 = _lib.SSL_CTX_set_tlsext_status_arg(arg_0._context, arg_0._ocsp_data)\n        _openssl_assert(arg_6 == 1)", "path": "src/OpenSSL/SSL.py", "identifier": "Context._set_ocsp_callback", "docstring": "This internal helper does the common work for\n        ``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is\n        almost all of it.", "docstring_tokens": ["This", "internal", "helper", "does", "the", "common", "work", "for", "set_ocsp_server_callback", "and", "set_ocsp_client_callback", "which", "is", "almost", "all", "of", "it", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 257177}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/config.py#L114-L121", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Return a ConfigNode object representing a child node with the specified\n        relative path.", "language": "python", "parameters": "(self, path)", "return_statement": "return ConfigNode(root=self._root, path=path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_path", ":", "arg_1", "=", "'{}.{}'", ".", "format", "(", "arg_0", ".", "_path", ",", "arg_1", ")", "return", "ConfigNode", "(", "root", "=", "arg_0", ".", "_root", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a ConfigNode object representing a child node with the specified\n        relative path.\n        \"\"\"\n        if arg_0._path:\n            arg_1 = '{}.{}'.format(arg_0._path, arg_1)\n        return ConfigNode(root=arg_0._root, arg_1=arg_1)", "path": "scruffy/config.py", "identifier": "ConfigNode._child", "docstring": "Return a ConfigNode object representing a child node with the specified\n        relative path.", "docstring_tokens": ["Return", "a", "ConfigNode", "object", "representing", "a", "child", "node", "with", "the", "specified", "relative", "path", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 257178}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/access.py#L32-L38", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Import ``run_sql``.", "language": "python", "parameters": "()", "return_statement": "return run_sql", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "from", "invenio", ".", "dbquery", "import", "run_sql", "except", "ImportError", ":", "from", "invenio", ".", "legacy", ".", "dbquery", "import", "run_sql", "return", "run_sql"], "function": "def Func():\n    \"\"\"Import ``run_sql``.\"\"\"\n    try:\n        from invenio.dbquery import run_sql\n    except ImportError:\n        from invenio.legacy.dbquery import run_sql\n    return run_sql", "path": "invenio_migrator/legacy/access.py", "identifier": "_get_run_sql", "docstring": "Import ``run_sql``.", "docstring_tokens": ["Import", "run_sql", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 257179}
{"url": "https://github.com/soimort/you-get/blob/b746ac01c9f39de94cac2d56f665285b0523b974/src/you_get/extractors/ixigua.py#L34-L78", "sha": "b746ac01c9f39de94cac2d56f665285b0523b974", "docstring_summary": "Splicing URLs according to video ID to get video details", "language": "python", "parameters": "(video_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "\"\"", "]", "*", "256", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_1", ")", ":", "arg_4", "=", "arg_2", "for", "arg_5", "in", "range", "(", "8", ")", ":", "arg_4", "=", "-", "306674912", "^", "unsigned_right_shitf", "(", "arg_4", ",", "1", ")", "if", "1", "&", "arg_4", "else", "unsigned_right_shitf", "(", "arg_4", ",", "1", ")", "arg_1", "[", "arg_2", "]", "=", "arg_4", "def", "tmp", "(", ")", ":", "arg_6", "=", "random", ".", "random", "(", ")", "arg_7", "=", "\"/video/urls/v/1/toutiao/mp4/{video_id}?r={random_num}\"", ".", "format", "(", "arg_0", "=", "arg_0", ",", "random_num", "=", "str", "(", "arg_6", ")", "[", "2", ":", "]", ")", "arg_8", "=", "arg_11", "=", "arg_10", "=", "-", "1", "arg_5", ",", "arg_9", "=", "0", ",", "len", "(", "arg_7", ")", "while", "arg_5", "<", "arg_9", ":", "arg_8", "=", "ord", "(", "arg_7", "[", "arg_5", "]", ")", "arg_5", "+=", "1", "if", "arg_8", "<", "128", ":", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "arg_8", ")", "]", "else", ":", "if", "arg_8", "<", "2048", ":", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "192", "|", "arg_8", ">>", "6", "&", "31", ")", ")", "]", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "128", "|", "63", "&", "arg_8", ")", ")", "]", "else", ":", "if", "55296", "<=", "arg_8", "<", "57344", ":", "arg_8", "=", "(", "1023", "&", "arg_8", ")", "+", "64", "arg_5", "+=", "1", "arg_11", "=", "1023", "&", "arg_4", ".", "url", "(", "arg_5", ")", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "240", "|", "arg_8", ">>", "8", "&", "7", ")", ")", "]", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "128", "|", "arg_8", ">>", "2", "&", "63", ")", ")", "]", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "128", "|", "arg_11", ">>", "6", "&", "15", "|", "(", "3", "&", "arg_8", ")", "<<", "4", ")", ")", "]", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "128", "|", "63", "&", "arg_11", ")", ")", "]", "else", ":", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "224", "|", "arg_8", ">>", "12", "&", "15", ")", ")", "]", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "128", "|", "arg_8", ">>", "6", "&", "63", ")", ")", "]", "arg_10", "=", "unsigned_right_shitf", "(", "arg_10", ",", "8", ")", "^", "arg_1", "[", "255", "&", "(", "arg_10", "^", "(", "128", "|", "63", "&", "arg_8", ")", ")", "]", "return", "\"https://ib.365yg.com{path}&s={param}\"", ".", "format", "(", "arg_7", "=", "arg_7", ",", "param", "=", "unsigned_right_shitf", "(", "arg_10", "^", "-", "1", ",", "0", ")", ")", "while", "1", ":", "arg_12", "=", "tmp", "(", ")", "if", "arg_12", ".", "split", "(", "\"=\"", ")", "[", "-", "1", "]", "[", "0", "]", "!=", "\"-\"", ":", "return", "arg_12"], "function": "def Func(arg_0):\n    \"\"\"Splicing URLs according to video ID to get video details\"\"\"\n    # from js\n    arg_1 = [\"\"] * 256\n    for arg_2, arg_3 in enumerate(arg_1):\n        arg_4 = arg_2\n        for arg_5 in range(8):\n            arg_4 = -306674912 ^ unsigned_right_shitf(arg_4, 1) if 1 & arg_4 else unsigned_right_shitf(arg_4, 1)\n        arg_1[arg_2] = arg_4\n\n    def tmp():\n        arg_6 = random.random()\n        arg_7 = \"/video/urls/v/1/toutiao/mp4/{video_id}?r={random_num}\".format(arg_0=arg_0,\n                                                                              random_num=str(arg_6)[2:])\n        arg_8 = arg_11 = arg_10 = -1\n        arg_5, arg_9 = 0, len(arg_7)\n        while arg_5 < arg_9:\n            arg_8 = ord(arg_7[arg_5])\n            arg_5 += 1\n            if arg_8 < 128:\n                arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ arg_8)]\n            else:\n                if arg_8 < 2048:\n                    arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (192 | arg_8 >> 6 & 31))]\n                    arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | 63 & arg_8))]\n                else:\n                    if 55296 <= arg_8 < 57344:\n                        arg_8 = (1023 & arg_8) + 64\n                        arg_5 += 1\n                        arg_11 = 1023 & arg_4.url(arg_5)\n                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (240 | arg_8 >> 8 & 7))]\n                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | arg_8 >> 2 & 63))]\n                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | arg_11 >> 6 & 15 | (3 & arg_8) << 4))]\n                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | 63 & arg_11))]\n                    else:\n                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (224 | arg_8 >> 12 & 15))]\n                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | arg_8 >> 6 & 63))]\n                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | 63 & arg_8))]\n\n        return \"https://ib.365yg.com{path}&s={param}\".format(arg_7=arg_7, param=unsigned_right_shitf(arg_10 ^ -1, 0))\n\n    while 1:\n        arg_12 = tmp()\n        if arg_12.split(\"=\")[-1][0] != \"-\":  # \u53c2\u6570s\u4e0d\u80fd\u4e3a\u8d1f\u6570\n            return arg_12", "path": "src/you_get/extractors/ixigua.py", "identifier": "get_video_url_from_video_id", "docstring": "Splicing URLs according to video ID to get video details", "docstring_tokens": ["Splicing", "URLs", "according", "to", "video", "ID", "to", "get", "video", "details"], "nwo": "soimort/you-get", "score": 0.9997601519430084, "idx": 257180}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/custom_reliablecollections.py#L12-L25", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "List existing reliable dictionaries.", "language": "python", "parameters": "(client, application_name, service_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "Cluster", ".", "from_sfclient", "(", "arg_0", ")", "arg_4", "=", "arg_3", ".", "get_application", "(", "arg_1", ")", ".", "get_service", "(", "arg_2", ")", "for", "arg_5", "in", "arg_4", ".", "get_dictionaries", "(", ")", ":", "print", "(", "arg_5", ".", "name", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"List existing reliable dictionaries.\n\n    List existing reliable dictionaries and respective schema for given application and service.\n\n    :param application_name: Name of the application.\n    :type application_name: str\n    :param service_name: Name of the service.\n    :type service_name: str\n    \"\"\"\n    arg_3 = Cluster.from_sfclient(arg_0)\n    arg_4 = arg_3.get_application(arg_1).get_service(arg_2)\n    for arg_5 in arg_4.get_dictionaries():\n        print(arg_5.name)", "path": "rcctl/rcctl/custom_reliablecollections.py", "identifier": "get_reliabledictionary_list", "docstring": "List existing reliable dictionaries.\n\n    List existing reliable dictionaries and respective schema for given application and service.\n\n    :param application_name: Name of the application.\n    :type application_name: str\n    :param service_name: Name of the service.\n    :type service_name: str", "docstring_tokens": ["List", "existing", "reliable", "dictionaries", "."], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 257181}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L54-L74", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Add a MARCXML datafield as a new child to a XML document.", "language": "python", "parameters": "(rec, tag, ind1='', ind2='', subfields=[],\n                     controlfield_value='')", "return_statement": "return rec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ",", "arg_3", "=", "''", ",", "arg_4", "=", "[", "]", ",", "arg_5", "=", "''", ")", ":", "if", "arg_5", ":", "arg_6", "=", "etree", ".", "Element", "(", "\"controlfield\"", ",", "attrib", "=", "{", "\"tag\"", ":", "arg_1", ",", "}", ")", "arg_6", ".", "text", "=", "unicode", "(", "arg_5", ")", "else", ":", "arg_6", "=", "etree", ".", "Element", "(", "\"datafield\"", ",", "attrib", "=", "{", "\"tag\"", ":", "arg_1", ",", "\"ind1\"", ":", "arg_2", ",", "\"ind2\"", ":", "arg_3", ",", "}", ")", "for", "arg_8", ",", "arg_9", "in", "arg_4", ":", "arg_10", "=", "etree", ".", "SubElement", "(", "arg_6", ",", "\"subfield\"", ",", "attrib", "=", "{", "\"code\"", ":", "arg_8", "}", ")", "arg_10", ".", "text", "=", "arg_9", "arg_0", ".", "append", "(", "arg_6", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2='', arg_3='', arg_4=[],\n                     arg_5=''):\n    \"\"\"Add a MARCXML datafield as a new child to a XML document.\"\"\"\n    if arg_5:\n        arg_6 = etree.Element(\"controlfield\",\n                            attrib={\n                                \"tag\": arg_1,\n                            })\n        arg_6.text = unicode(arg_5)\n    else:\n        arg_6 = etree.Element(\"datafield\",\n                            attrib={\n                                \"tag\": arg_1,\n                                \"ind1\": arg_2,\n                                \"ind2\": arg_3,\n                            })\n        for arg_8, arg_9 in arg_4:\n            arg_10 = etree.SubElement(arg_6, \"subfield\", attrib={\"code\": arg_8})\n            arg_10.text = arg_9\n    arg_0.append(arg_6)\n    return arg_0", "path": "harvestingkit/utils.py", "identifier": "record_add_field", "docstring": "Add a MARCXML datafield as a new child to a XML document.", "docstring_tokens": ["Add", "a", "MARCXML", "datafield", "as", "a", "new", "child", "to", "a", "XML", "document", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257182}
{"url": "https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/rarfile.py#L300-L313", "sha": "b1ac46cbcf42f3d3c5c69ab971fe97369a4da617", "docstring_summary": "Extract a member from the archive to the current working directory,\n           using its full name. Its file information is extracted as accurately\n           as possible. `member' may be a filename or a RarInfo object. You can\n           specify a different directory using `path'.", "language": "python", "parameters": "(self, member, path=None, pwd=None)", "return_statement": "return os.path.join(path, member)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "RarInfo", ")", ":", "arg_1", "=", "arg_1", ".", "filename", "if", "arg_2", "is", "None", ":", "arg_2", "=", "os", ".", "getcwd", "(", ")", "arg_0", ".", "_Func_members", "(", "[", "arg_1", "]", ",", "arg_2", ",", "arg_3", ")", "return", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Extract a member from the archive to the current working directory,\n           using its full name. Its file information is Funced as accurately\n           as possible. `member' may be a filename or a RarInfo object. You can\n           specify a different directory using `path'.\n        \"\"\"\n        if isinstance(arg_1, RarInfo):\n            arg_1 = arg_1.filename\n\n        if arg_2 is None:\n            arg_2 = os.getcwd()\n\n        arg_0._Func_members([arg_1], arg_2, arg_3)\n        return os.path.join(arg_2, arg_1)", "path": "unrar/rarfile.py", "identifier": "RarFile.extract", "docstring": "Extract a member from the archive to the current working directory,\n           using its full name. Its file information is extracted as accurately\n           as possible. `member' may be a filename or a RarInfo object. You can\n           specify a different directory using `path'.", "docstring_tokens": ["Extract", "a", "member", "from", "the", "archive", "to", "the", "current", "working", "directory", "using", "its", "full", "name", ".", "Its", "file", "information", "is", "extracted", "as", "accurately", "as", "possible", ".", "member", "may", "be", "a", "filename", "or", "a", "RarInfo", "object", ".", "You", "can", "specify", "a", "different", "directory", "using", "path", "."], "nwo": "matiasb/python-unrar", "score": 0.34770217692582306, "idx": 257183}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L277-L284", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find a handler for the line_info by trying checkers.", "language": "python", "parameters": "(self, line_info)", "return_statement": "return self.get_handler_by_name('normal')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "checkers", ":", "if", "arg_2", ".", "enabled", ":", "arg_3", "=", "arg_2", ".", "check", "(", "arg_1", ")", "if", "arg_3", ":", "return", "arg_3", "return", "arg_0", ".", "get_handler_by_name", "(", "'normal'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Find a handler for the line_info by trying checkers.\"\"\"\n        for arg_2 in arg_0.checkers:\n            if arg_2.enabled:\n                arg_3 = arg_2.check(arg_1)\n                if arg_3:\n                    return arg_3\n        return arg_0.get_handler_by_name('normal')", "path": "environment/lib/python2.7/site-packages/IPython/core/prefilter.py", "identifier": "PrefilterManager.find_handler", "docstring": "Find a handler for the line_info by trying checkers.", "docstring_tokens": ["Find", "a", "handler", "for", "the", "line_info", "by", "trying", "checkers", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257184}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L291-L296", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Update all displayed values", "language": "python", "parameters": "(self, grid)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "gridlib", ".", "GridTableMessage", "(", "arg_0", ",", "gridlib", ".", "GRIDTABLE_REQUEST_VIEW_GET_VALUES", ")", "arg_1", ".", "ProcessTableMessage", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"Update all displayed values\"\r\n        # This sends an event to the grid table to update all of the values\r\n        arg_2 = gridlib.GridTableMessage(arg_0, \r\n                                    gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)\r\n        arg_1.ProcessTableMessage(arg_2)", "path": "gui/controls/gridview.py", "identifier": "GridTable.UpdateValues", "docstring": "Update all displayed values", "docstring_tokens": ["Update", "all", "displayed", "values"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 257185}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L458-L463", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "return a list of Is where the data first crosses above threshold.", "language": "python", "parameters": "(data,threshold)", "return_statement": "return Is[np.where(Ds)[0]+1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "where", "(", "arg_0", ">", "arg_1", ")", "[", "0", "]", "arg_2", "=", "np", ".", "concatenate", "(", "(", "[", "0", "]", ",", "arg_2", ")", ")", "arg_3", "=", "arg_2", "[", ":", "-", "1", "]", "-", "arg_2", "[", "1", ":", "]", "+", "1", "return", "arg_2", "[", "np", ".", "where", "(", "arg_3", ")", "[", "0", "]", "+", "1", "]"], "function": "def Func(arg_0,arg_1):\n    \"\"\"return a list of Is where the data first crosses above threshold.\"\"\"\n    arg_2=np.where(arg_0>arg_1)[0]\n    arg_2=np.concatenate(([0],arg_2))\n    arg_3=arg_2[:-1]-arg_2[1:]+1\n    return arg_2[np.where(arg_3)[0]+1]", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "where_cross", "docstring": "return a list of Is where the data first crosses above threshold.", "docstring_tokens": ["return", "a", "list", "of", "Is", "where", "the", "data", "first", "crosses", "above", "threshold", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 257186}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/commandparser.py#L88-L188", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Parse a single command.", "language": "python", "parameters": "(self, source, start_index)", "return_statement": "return parsed_command", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "arg_2", "for", "arg_5", "in", "arg_0", ".", "elements", ":", "arg_6", "=", "arg_5", "[", "'bracket'", "]", "arg_7", "=", "arg_0", ".", "_brackets", "[", "arg_6", "]", "arg_8", "=", "None", "arg_9", "=", "None", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_1", "[", "arg_4", ":", "]", ",", "start", "=", "arg_4", ")", ":", "if", "arg_11", "==", "arg_5", "[", "'bracket'", "]", ":", "arg_8", "=", "arg_10", "break", "elif", "arg_11", "==", "'\\n'", ":", "if", "arg_5", "[", "'required'", "]", "is", "True", ":", "arg_12", "=", "arg_0", ".", "_parse_whitespace_argument", "(", "arg_1", "[", "arg_4", ":", "]", ",", "arg_0", ".", "name", ")", "return", "ParsedCommand", "(", "arg_0", ".", "name", ",", "[", "{", "'index'", ":", "arg_5", "[", "'index'", "]", ",", "'name'", ":", "arg_5", "[", "'name'", "]", ",", "'content'", ":", "arg_12", ".", "strip", "(", ")", "}", "]", ",", "arg_2", ",", "arg_1", "[", "arg_2", ":", "arg_10", "]", ")", "else", ":", "break", "if", "arg_8", "is", "None", "and", "arg_5", "[", "'required'", "]", "is", "False", ":", "continue", "elif", "arg_8", "is", "None", "and", "arg_5", "[", "'required'", "]", "is", "True", ":", "arg_13", "=", "(", "'Parsing command {0} at index {1:d}, '", "'did not detect element {2:d}'", ".", "format", "(", "arg_0", ".", "name", ",", "arg_2", ",", "arg_5", "[", "'index'", "]", ")", ")", "raise", "CommandParserError", "(", "arg_13", ")", "arg_14", "=", "1", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_1", "[", "arg_8", "+", "1", ":", "]", ",", "start", "=", "arg_8", "+", "1", ")", ":", "if", "arg_11", "==", "arg_6", ":", "arg_14", "+=", "1", "elif", "arg_11", "==", "arg_7", ":", "arg_14", "-=", "1", "if", "arg_14", "==", "0", ":", "arg_9", "=", "arg_10", "break", "if", "arg_14", ">", "0", ":", "arg_13", "=", "(", "'Parsing command {0} at index {1:d}, '", "'did not find closing bracket for required '", "'command element {2:d}'", ".", "format", "(", "arg_0", ".", "name", ",", "arg_2", ",", "arg_5", "[", "'index'", "]", ")", ")", "raise", "CommandParserError", "(", "arg_13", ")", "arg_15", "=", "arg_1", "[", "arg_8", "+", "1", ":", "arg_9", "]", "arg_16", "=", "{", "'index'", ":", "arg_5", "[", "'index'", "]", ",", "'name'", ":", "arg_5", "[", "'name'", "]", ",", "'content'", ":", "arg_15", ".", "strip", "(", ")", "}", "arg_3", ".", "append", "(", "arg_16", ")", "arg_4", "=", "arg_9", "+", "1", "arg_17", "=", "arg_1", "[", "arg_2", ":", "arg_4", "]", "arg_18", "=", "ParsedCommand", "(", "arg_0", ".", "name", ",", "arg_3", ",", "arg_2", ",", "arg_17", ")", "return", "arg_18"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Parse a single command.\n\n        Parameters\n        ----------\n        source : `str`\n            The full source of the tex document.\n        start_index : `int`\n            Character index in ``source`` where the command begins.\n\n        Returns\n        -------\n        parsed_command : `ParsedCommand`\n            The parsed command from the source at the given index.\n        \"\"\"\n        arg_3 = []\n\n        # Index of the parser in the source\n        arg_4 = arg_2\n\n        for arg_5 in arg_0.elements:\n            arg_6 = arg_5['bracket']\n            arg_7 = arg_0._brackets[arg_6]\n\n            # Find the opening bracket.\n            arg_8 = None\n            arg_9 = None\n            for arg_10, arg_11 in enumerate(arg_1[arg_4:], start=arg_4):\n                if arg_11 == arg_5['bracket']:\n                    arg_8 = arg_10\n                    break\n                elif arg_11 == '\\n':\n                    # No starting bracket on the line.\n                    if arg_5['required'] is True:\n                        # Try to parse a single single-word token after the\n                        # command, like '\\input file'\n                        arg_12 = arg_0._parse_whitespace_argument(\n                            arg_1[arg_4:],\n                            arg_0.name)\n                        return ParsedCommand(\n                            arg_0.name,\n                            [{'index': arg_5['index'],\n                              'name': arg_5['name'],\n                              'content': arg_12.strip()}],\n                            arg_2,\n                            arg_1[arg_2:arg_10])\n                    else:\n                        # Give up on finding an optional element\n                        break\n\n            # Handle cases when the opening bracket is never found.\n            if arg_8 is None and arg_5['required'] is False:\n                # Optional element not found. Continue to next element,\n                # not advancing the running_index of the parser.\n                continue\n            elif arg_8 is None and arg_5['required'] is True:\n                arg_13 = ('Parsing command {0} at index {1:d}, '\n                           'did not detect element {2:d}'.format(\n                               arg_0.name,\n                               arg_2,\n                               arg_5['index']))\n                raise CommandParserError(arg_13)\n\n            # Find the closing bracket, keeping track of the number of times\n            # the same type of bracket was opened and closed.\n            arg_14 = 1\n            for arg_10, arg_11 in enumerate(arg_1[arg_8 + 1:],\n                                  start=arg_8 + 1):\n                if arg_11 == arg_6:\n                    arg_14 += 1\n                elif arg_11 == arg_7:\n                    arg_14 -= 1\n\n                if arg_14 == 0:\n                    arg_9 = arg_10\n                    break\n\n            if arg_14 > 0:\n                arg_13 = ('Parsing command {0} at index {1:d}, '\n                           'did not find closing bracket for required '\n                           'command element {2:d}'.format(\n                               arg_0.name,\n                               arg_2,\n                               arg_5['index']))\n                raise CommandParserError(arg_13)\n\n            # Package the parsed element's content.\n            arg_15 = arg_1[arg_8 + 1:arg_9]\n            arg_16 = {\n                'index': arg_5['index'],\n                'name': arg_5['name'],\n                'content': arg_15.strip()\n            }\n            arg_3.append(arg_16)\n\n            arg_4 = arg_9 + 1\n\n        arg_17 = arg_1[arg_2:arg_4]\n        arg_18 = ParsedCommand(arg_0.name, arg_3,\n                                       arg_2, arg_17)\n        return arg_18", "path": "lsstprojectmeta/tex/commandparser.py", "identifier": "LatexCommand._parse_command", "docstring": "Parse a single command.\n\n        Parameters\n        ----------\n        source : `str`\n            The full source of the tex document.\n        start_index : `int`\n            Character index in ``source`` where the command begins.\n\n        Returns\n        -------\n        parsed_command : `ParsedCommand`\n            The parsed command from the source at the given index.", "docstring_tokens": ["Parse", "a", "single", "command", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 257187}
{"url": "https://github.com/mcs07/MolVS/blob/d815fe52d160abcecbcbf117e6437bf727dbd8ad/molvs/standardize.py#L320-L335", "sha": "d815fe52d160abcecbcbf117e6437bf727dbd8ad", "docstring_summary": "Return a standardized canonical tautomer SMILES string given a SMILES string.", "language": "python", "parameters": "(smiles)", "return_statement": "return Chem.MolToSmiles(tautomer, isomericSmiles=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Chem", ".", "MolFromSmiles", "(", "arg_0", ",", "sanitize", "=", "False", ")", "arg_1", "=", "Standardizer", "(", ")", ".", "standardize", "(", "arg_1", ")", "arg_2", "=", "TautomerCanonicalizer", "(", ")", ".", "canonicalize", "(", "arg_1", ")", "return", "Chem", ".", "MolToSmiles", "(", "arg_2", ",", "isomericSmiles", "=", "True", ")"], "function": "def Func(arg_0):\n    \"\"\"Return a standardized canonical tautomer SMILES string given a SMILES string.\n\n    Note: This is a convenience function for quickly standardizing and finding the canonical tautomer for a single\n    SMILES string. It is more efficient to use the :class:`~molvs.standardize.Standardizer` class directly when working\n    with many molecules or when custom options are needed.\n\n    :param string smiles: The SMILES for the molecule.\n    :returns: The SMILES for the standardize canonical tautomer.\n    :rtype: string.\n    \"\"\"\n    # Skip sanitize as standardize does this anyway\n    arg_1 = Chem.MolFromSmiles(arg_0, sanitize=False)\n    arg_1 = Standardizer().standardize(arg_1)\n    arg_2 = TautomerCanonicalizer().canonicalize(arg_1)\n    return Chem.MolToSmiles(arg_2, isomericSmiles=True)", "path": "molvs/standardize.py", "identifier": "canonicalize_tautomer_smiles", "docstring": "Return a standardized canonical tautomer SMILES string given a SMILES string.\n\n    Note: This is a convenience function for quickly standardizing and finding the canonical tautomer for a single\n    SMILES string. It is more efficient to use the :class:`~molvs.standardize.Standardizer` class directly when working\n    with many molecules or when custom options are needed.\n\n    :param string smiles: The SMILES for the molecule.\n    :returns: The SMILES for the standardize canonical tautomer.\n    :rtype: string.", "docstring_tokens": ["Return", "a", "standardized", "canonical", "tautomer", "SMILES", "string", "given", "a", "SMILES", "string", "."], "nwo": "mcs07/MolVS", "score": 0.5162715334407971, "idx": 257188}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1286-L1294", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Get the s3 object with the S3 URL. Return None if not exist.", "language": "python", "parameters": "(self, s3url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "arg_0", ".", "s3", ".", "head_object", "(", "Bucket", "=", "arg_1", ".", "bucket", ",", "Key", "=", "arg_1", ".", "path", ")", "except", "BotoClient", ".", "ClientError", "as", "e", ":", "if", "e", ".", "response", "[", "'ResponseMetadata'", "]", "[", "'HTTPStatusCode'", "]", "==", "404", ":", "return", "None", "else", ":", "raise", "e"], "function": "def Func(arg_0, arg_1):\n    '''Get the s3 object with the S3 URL. Return None if not exist.'''\n    try:\n      return arg_0.s3.head_object(Bucket=arg_1.bucket, Key=arg_1.path)\n    except BotoClient.ClientError as e:\n      if e.response['ResponseMetadata']['HTTPStatusCode'] == 404:\n        return None\n      else:\n        raise e", "path": "s4cmd.py", "identifier": "ThreadUtil.lookup", "docstring": "Get the s3 object with the S3 URL. Return None if not exist.", "docstring_tokens": ["Get", "the", "s3", "object", "with", "the", "S3", "URL", ".", "Return", "None", "if", "not", "exist", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 257189}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/tears.py#L724-L800", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Generate a number of plots for analyzing a strategy's transactions.", "language": "python", "parameters": "(returns, positions, transactions,\n                          unadjusted_returns=None, estimate_intraday='infer',\n                          return_fig=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'infer'", ",", "arg_5", "=", "False", ")", ":", "arg_1", "=", "utils", ".", "check_intraday", "(", "arg_4", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "6", "if", "arg_3", "is", "not", "None", "else", "4", "arg_7", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "14", ",", "arg_6", "*", "6", ")", ")", "arg_8", "=", "gridspec", ".", "GridSpec", "(", "arg_6", ",", "3", ",", "wspace", "=", "0.5", ",", "hspace", "=", "0.5", ")", "arg_9", "=", "plt", ".", "subplot", "(", "arg_8", "[", "0", ",", ":", "]", ")", "arg_10", "=", "plt", ".", "subplot", "(", "arg_8", "[", "1", ",", ":", "]", ",", "sharex", "=", "arg_9", ")", "arg_11", "=", "plt", ".", "subplot", "(", "arg_8", "[", "2", ",", ":", "]", ")", "arg_12", "=", "plt", ".", "subplot", "(", "arg_8", "[", "3", ",", ":", "]", ")", "plotting", ".", "plot_turnover", "(", "arg_0", ",", "arg_2", ",", "arg_1", ",", "arg_15", "=", "arg_9", ")", "plotting", ".", "plot_daily_volume", "(", "arg_0", ",", "arg_2", ",", "arg_15", "=", "arg_10", ")", "try", ":", "plotting", ".", "plot_daily_turnover_hist", "(", "arg_2", ",", "arg_1", ",", "arg_15", "=", "arg_11", ")", "except", "ValueError", ":", "warnings", ".", "warn", "(", "'Unable to generate turnover plot.'", ",", "UserWarning", ")", "plotting", ".", "plot_txn_time_hist", "(", "arg_2", ",", "arg_15", "=", "arg_12", ")", "if", "arg_3", "is", "not", "None", ":", "arg_13", "=", "plt", ".", "subplot", "(", "arg_8", "[", "4", ",", ":", "]", ")", "plotting", ".", "plot_slippage_sweep", "(", "arg_3", ",", "arg_1", ",", "arg_2", ",", "arg_15", "=", "arg_13", ")", "arg_14", "=", "plt", ".", "subplot", "(", "arg_8", "[", "5", ",", ":", "]", ")", "plotting", ".", "plot_slippage_sensitivity", "(", "arg_3", ",", "arg_1", ",", "arg_2", ",", "arg_15", "=", "arg_14", ")", "for", "arg_15", "in", "arg_7", ".", "axes", ":", "plt", ".", "setp", "(", "arg_15", ".", "get_xticklabels", "(", ")", ",", "visible", "=", "True", ")", "if", "arg_5", ":", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2,\n                          arg_3=None, arg_4='infer',\n                          arg_5=False):\n    \"\"\"\n    Generate a number of plots for analyzing a strategy's transactions.\n\n    Plots: turnover, daily volume, and a histogram of daily volume.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in create_full_tear_sheet.\n    unadjusted_returns : pd.Series, optional\n        Daily unadjusted returns of the strategy, noncumulative.\n        Will plot additional swippage sweep analysis.\n         - See pyfolio.plotting.plot_swippage_sleep and\n           pyfolio.plotting.plot_slippage_sensitivity\n    estimate_intraday: boolean or str, optional\n        Approximate returns for intraday strategies.\n        See description in create_full_tear_sheet.\n    return_fig : boolean, optional\n        If True, returns the figure that was plotted on.\n    \"\"\"\n\n    arg_1 = utils.check_intraday(arg_4, arg_0,\n                                     arg_1, arg_2)\n\n    arg_6 = 6 if arg_3 is not None else 4\n\n    arg_7 = plt.figure(figsize=(14, arg_6 * 6))\n    arg_8 = gridspec.GridSpec(arg_6, 3, wspace=0.5, hspace=0.5)\n    arg_9 = plt.subplot(arg_8[0, :])\n    arg_10 = plt.subplot(arg_8[1, :], sharex=arg_9)\n    arg_11 = plt.subplot(arg_8[2, :])\n    arg_12 = plt.subplot(arg_8[3, :])\n\n    plotting.plot_turnover(\n        arg_0,\n        arg_2,\n        arg_1,\n        arg_15=arg_9)\n\n    plotting.plot_daily_volume(arg_0, arg_2, arg_15=arg_10)\n\n    try:\n        plotting.plot_daily_turnover_hist(arg_2, arg_1,\n                                          arg_15=arg_11)\n    except ValueError:\n        warnings.warn('Unable to generate turnover plot.', UserWarning)\n\n    plotting.plot_txn_time_hist(arg_2, arg_15=arg_12)\n\n    if arg_3 is not None:\n        arg_13 = plt.subplot(arg_8[4, :])\n        plotting.plot_slippage_sweep(arg_3,\n                                     arg_1,\n                                     arg_2,\n                                     arg_15=arg_13\n                                     )\n        arg_14 = plt.subplot(arg_8[5, :])\n        plotting.plot_slippage_sensitivity(arg_3,\n                                           arg_1,\n                                           arg_2,\n                                           arg_15=arg_14\n                                           )\n    for arg_15 in arg_7.axes:\n        plt.setp(arg_15.get_xticklabels(), visible=True)\n\n    if arg_5:\n        return arg_7", "path": "pyfolio/tears.py", "identifier": "create_txn_tear_sheet", "docstring": "Generate a number of plots for analyzing a strategy's transactions.\n\n    Plots: turnover, daily volume, and a histogram of daily volume.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in create_full_tear_sheet.\n    unadjusted_returns : pd.Series, optional\n        Daily unadjusted returns of the strategy, noncumulative.\n        Will plot additional swippage sweep analysis.\n         - See pyfolio.plotting.plot_swippage_sleep and\n           pyfolio.plotting.plot_slippage_sensitivity\n    estimate_intraday: boolean or str, optional\n        Approximate returns for intraday strategies.\n        See description in create_full_tear_sheet.\n    return_fig : boolean, optional\n        If True, returns the figure that was plotted on.", "docstring_tokens": ["Generate", "a", "number", "of", "plots", "for", "analyzing", "a", "strategy", "s", "transactions", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257190}
{"url": "https://github.com/zhihu/redis-shard/blob/57c166ef7d55f7272b50efc1dedc1f6ed4691137/redis_shard/shard.py#L140-L157", "sha": "57c166ef7d55f7272b50efc1dedc1f6ed4691137", "docstring_summary": "Returns a list of values ordered identically to ``keys``", "language": "python", "parameters": "(self, keys, *args)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "arg_2", "=", "list_or_args", "(", "arg_1", ",", "arg_2", ")", "arg_3", "=", "{", "}", "arg_4", "=", "{", "}", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "arg_0", ".", "get_server_name", "(", "arg_5", ")", "arg_3", "[", "arg_6", "]", "=", "arg_3", ".", "get", "(", "arg_6", ",", "[", "]", ")", "arg_3", "[", "arg_6", "]", ".", "append", "(", "arg_5", ")", "for", "arg_6", ",", "arg_7", "in", "iteritems", "(", "arg_3", ")", ":", "arg_8", "=", "arg_0", ".", "connections", "[", "arg_6", "]", ".", "Func", "(", "arg_7", ")", "arg_4", ".", "update", "(", "dict", "(", "zip", "(", "arg_7", ",", "arg_8", ")", ")", ")", "arg_9", "=", "[", "]", "for", "arg_5", "in", "arg_2", ":", "arg_9", ".", "append", "(", "arg_4", ".", "get", "(", "arg_5", ",", "None", ")", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, *arg_2):\n        \"\"\"\n        Returns a list of values ordered identically to ``keys``\n        \"\"\"\n        arg_2 = list_or_args(arg_1, arg_2)\n        arg_3 = {}\n        arg_4 = {}\n        for arg_5 in arg_2:\n            arg_6 = arg_0.get_server_name(arg_5)\n            arg_3[arg_6] = arg_3.get(arg_6, [])\n            arg_3[arg_6].append(arg_5)\n        for arg_6, arg_7 in iteritems(arg_3):\n            arg_8 = arg_0.connections[arg_6].Func(arg_7)\n            arg_4.update(dict(zip(arg_7, arg_8)))\n        arg_9 = []\n        for arg_5 in arg_2:\n            arg_9.append(arg_4.get(arg_5, None))\n        return arg_9", "path": "redis_shard/shard.py", "identifier": "RedisShardAPI.mget", "docstring": "Returns a list of values ordered identically to ``keys``", "docstring_tokens": ["Returns", "a", "list", "of", "values", "ordered", "identically", "to", "keys"], "nwo": "zhihu/redis-shard", "score": 0.6985810704041512, "idx": 257191}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L646-L657", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get the value in the request, either through query parameters or posted data, from a key.", "language": "python", "parameters": "(request, key, default=None)", "return_statement": "return request.data.get(key, request.query_params.get(key, default))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", ".", "method", "in", "[", "'GET'", ",", "'DELETE'", "]", ":", "return", "arg_0", ".", "query_params", ".", "get", "(", "arg_1", ",", "arg_0", ".", "data", ".", "get", "(", "arg_1", ",", "arg_2", ")", ")", "return", "arg_0", ".", "data", ".", "get", "(", "arg_1", ",", "arg_0", ".", "query_params", ".", "get", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Get the value in the request, either through query parameters or posted data, from a key.\n\n    :param request: The request from which the value should be gotten.\n    :param key: The key to use to get the desired value.\n    :param default: The backup value to use in case the input key cannot help us get the value.\n    :return: The value we're looking for.\n    \"\"\"\n    if arg_0.method in ['GET', 'DELETE']:\n        return arg_0.query_params.get(arg_1, arg_0.data.get(arg_1, arg_2))\n    return arg_0.data.get(arg_1, arg_0.query_params.get(arg_1, arg_2))", "path": "enterprise/utils.py", "identifier": "get_request_value", "docstring": "Get the value in the request, either through query parameters or posted data, from a key.\n\n    :param request: The request from which the value should be gotten.\n    :param key: The key to use to get the desired value.\n    :param default: The backup value to use in case the input key cannot help us get the value.\n    :return: The value we're looking for.", "docstring_tokens": ["Get", "the", "value", "in", "the", "request", "either", "through", "query", "parameters", "or", "posted", "data", "from", "a", "key", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257192}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L705-L747", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Write or append data into the given file path.", "language": "python", "parameters": "(self, data_to_write, overwrite=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_2", "or", "not", "path", ".", "isfile", "(", "arg_0", ".", "file", ")", ":", "with", "open", "(", "arg_0", ".", "file", ",", "\"w\"", ",", "encoding", "=", "\"utf-8\"", ",", "newline", "=", "\"\\n\"", ")", "as", "file", ":", "if", "arg_1", "and", "isinstance", "(", "arg_1", ",", "str", ")", ":", "file", ".", "Func", "(", "arg_1", ")", "else", ":", "with", "open", "(", "arg_0", ".", "file", ",", "\"a\"", ",", "encoding", "=", "\"utf-8\"", ",", "newline", "=", "\"\\n\"", ")", "as", "file", ":", "if", "arg_1", "and", "isinstance", "(", "arg_1", ",", "str", ")", ":", "file", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Write or append data into the given file path.\n\n        :param data_to_Func: The data to Func.\n        :type data_to_Func: str\n\n        :param overFunc:\n            Tell us if we have to overFunc the\n            content of the file we are working with.\n        :type overFunc: bool\n        \"\"\"\n\n        if arg_2 or not path.isfile(arg_0.file):\n            # * We have to overFunc the file data.\n            # or\n            # * The file path does not already exist.\n\n            with open(arg_0.file, \"w\", encoding=\"utf-8\", newline=\"\\n\") as file:\n                # We prepare the file for writting.\n\n                if arg_1 and isinstance(arg_1, str):\n                    # * A data  to Func is given.\n                    # and\n                    # * The data to Func is a string\n\n                    # We Func the string into the file.\n                    file.Func(arg_1)\n        else:\n            # * We do not have to overFunc the file data.\n            # or\n            # * The file path does already exist.\n\n            with open(arg_0.file, \"a\", encoding=\"utf-8\", newline=\"\\n\") as file:\n                # We prepare the file for append writting.\n\n                if arg_1 and isinstance(arg_1, str):\n                    # * A data  to Func is given.\n                    # and\n                    # * The data to Func is a string\n\n                    # We append the string into the file.\n                    file.Func(arg_1)", "path": "PyFunceble/helpers.py", "identifier": "File.write", "docstring": "Write or append data into the given file path.\n\n        :param data_to_write: The data to write.\n        :type data_to_write: str\n\n        :param overwrite:\n            Tell us if we have to overwrite the\n            content of the file we are working with.\n        :type overwrite: bool", "docstring_tokens": ["Write", "or", "append", "data", "into", "the", "given", "file", "path", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 257193}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/petitdb.py#L373-L398", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return the element in `table_name` with Object ID `eid`.\n        If None is found will raise a KeyError exception.", "language": "python", "parameters": "(self, table_name, eid)", "return_statement": "return elem", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "table", "(", "arg_1", ")", ".", "get", "(", "arg_2", "=", "arg_2", ")", "if", "arg_3", "is", "None", ":", "raise", "KeyError", "(", "'Could not find {} with eid {}.'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return the element in `table_name` with Object ID `eid`.\n        If None is found will raise a KeyError exception.\n\n        Parameters\n        ----------\n        table_name: str\n            The name of the table to look in.\n\n        eid: int\n            The Object ID of the element to look for.\n\n        Returns\n        -------\n        elem: tinydb.database.Element\n\n        Raises\n        ------\n        KeyError\n            If the element with ID `eid` is not found.\n        \"\"\"\n        arg_3 = arg_0.table(arg_1).get(arg_2=arg_2)\n        if arg_3 is None:\n            raise KeyError('Could not find {} with eid {}.'.format(arg_1, arg_2))\n\n        return arg_3", "path": "boyle/petitdb.py", "identifier": "PetitDB.search_by_eid", "docstring": "Return the element in `table_name` with Object ID `eid`.\n        If None is found will raise a KeyError exception.\n\n        Parameters\n        ----------\n        table_name: str\n            The name of the table to look in.\n\n        eid: int\n            The Object ID of the element to look for.\n\n        Returns\n        -------\n        elem: tinydb.database.Element\n\n        Raises\n        ------\n        KeyError\n            If the element with ID `eid` is not found.", "docstring_tokens": ["Return", "the", "element", "in", "table_name", "with", "Object", "ID", "eid", ".", "If", "None", "is", "found", "will", "raise", "a", "KeyError", "exception", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 257194}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/client.py#L652-L716", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "upload a media on twitter", "language": "python", "parameters": "(self, file_,\n                           media_type=None,\n                           media_category=None,\n                           chunked=None,\n                           size_limit=None,\n                           **params)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "**", "arg_6", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_7", "=", "urlparse", "(", "arg_1", ")", "if", "arg_7", ".", "scheme", ".", "startswith", "(", "'http'", ")", ":", "arg_8", "=", "await", "arg_0", ".", "_session", ".", "get", "(", "arg_1", ")", "else", ":", "arg_9", "=", "urlparse", "(", "arg_1", ")", ".", "path", ".", "strip", "(", "\" \\\"'\"", ")", "arg_8", "=", "await", "utils", ".", "execute", "(", "open", "(", "arg_9", ",", "'rb'", ")", ")", "elif", "hasattr", "(", "arg_1", ",", "'read'", ")", "or", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "arg_8", "=", "arg_1", "else", ":", "raise", "TypeError", "(", "\"Func input must be a file object or a \"", "\"filename or binary data or an aiohttp request\"", ")", "arg_10", "=", "await", "utils", ".", "get_size", "(", "arg_8", ")", "if", "arg_4", "is", "not", "None", ":", "arg_11", "=", "False", "else", ":", "arg_11", "=", "await", "arg_0", ".", "_size_test", "(", "arg_10", ",", "arg_5", ")", "if", "isinstance", "(", "arg_8", ",", "aiohttp", ".", "ClientResponse", ")", ":", "arg_8", "=", "arg_8", ".", "content", "if", "arg_4", "or", "(", "arg_11", "and", "arg_4", "is", "None", ")", ":", "arg_12", "=", "arg_8", ",", "arg_10", ",", "arg_1", ",", "arg_2", ",", "arg_3", "arg_13", "=", "await", "arg_0", ".", "_chunked_upload", "(", "*", "arg_12", ",", "**", "arg_6", ")", "else", ":", "arg_13", "=", "await", "arg_0", ".", "upload", ".", "media", ".", "upload", ".", "post", "(", "arg_8", "=", "arg_8", ",", "**", "arg_6", ")", "if", "not", "hasattr", "(", "arg_1", ",", "'read'", ")", "and", "not", "getattr", "(", "arg_8", ",", "'closed'", ",", "True", ")", ":", "arg_8", ".", "close", "(", ")", "return", "arg_13"], "function": "async def Func(arg_0, arg_1,\n                           arg_2=None,\n                           arg_3=None,\n                           arg_4=None,\n                           arg_5=None,\n                           **arg_6):\n        \"\"\"\n            upload a media on twitter\n\n        Parameters\n        ----------\n        file_ : str or pathlib.Path or file\n            Path to the file or file object\n        media_type : str, optional\n            mime type of the media\n        media_category : str, optional\n            Twitter's media category of the media, must be used with\n            ``media_type``\n        chunked : bool, optional\n            If True, force the use of the chunked upload for the media\n        size_limit : int, optional\n            If set, the media will be sent using a multipart upload if\n            its size is over ``size_limit`` bytes\n        params : dict\n            parameters used when making the request\n\n        Returns\n        -------\n        .data_processing.PeonyResponse\n            Response of the request\n        \"\"\"\n        if isinstance(arg_1, str):\n            arg_7 = urlparse(arg_1)\n            if arg_7.scheme.startswith('http'):\n                arg_8 = await arg_0._session.get(arg_1)\n            else:\n                arg_9 = urlparse(arg_1).path.strip(\" \\\"'\")\n                arg_8 = await utils.execute(open(arg_9, 'rb'))\n        elif hasattr(arg_1, 'read') or isinstance(arg_1, bytes):\n            arg_8 = arg_1\n        else:\n            raise TypeError(\"Func input must be a file object or a \"\n                            \"filename or binary data or an aiohttp request\")\n\n        arg_10 = await utils.get_size(arg_8)\n        if arg_4 is not None:\n            arg_11 = False\n        else:\n            arg_11 = await arg_0._size_test(arg_10, arg_5)\n\n        if isinstance(arg_8, aiohttp.ClientResponse):\n            # send the content of the response\n            arg_8 = arg_8.content\n\n        if arg_4 or (arg_11 and arg_4 is None):\n            arg_12 = arg_8, arg_10, arg_1, arg_2, arg_3\n            arg_13 = await arg_0._chunked_upload(*arg_12, **arg_6)\n        else:\n            arg_13 = await arg_0.upload.media.upload.post(arg_8=arg_8,\n                                                           **arg_6)\n\n        if not hasattr(arg_1, 'read') and not getattr(arg_8, 'closed', True):\n            arg_8.close()\n\n        return arg_13", "path": "peony/client.py", "identifier": "PeonyClient.upload_media", "docstring": "upload a media on twitter\n\n        Parameters\n        ----------\n        file_ : str or pathlib.Path or file\n            Path to the file or file object\n        media_type : str, optional\n            mime type of the media\n        media_category : str, optional\n            Twitter's media category of the media, must be used with\n            ``media_type``\n        chunked : bool, optional\n            If True, force the use of the chunked upload for the media\n        size_limit : int, optional\n            If set, the media will be sent using a multipart upload if\n            its size is over ``size_limit`` bytes\n        params : dict\n            parameters used when making the request\n\n        Returns\n        -------\n        .data_processing.PeonyResponse\n            Response of the request", "docstring_tokens": ["upload", "a", "media", "on", "twitter"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 257195}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/trimmomatic_report.py#L117-L160", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Writes a report from multiple samples.", "language": "python", "parameters": "(storage_dic, output_file, sample_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "fh", ",", "open", "(", "\".report.json\"", ",", "\"w\"", ")", "as", "json_rep", ":", "fh", ".", "write", "(", "\"Sample,Total length,Total trimmed,%,5end Trim,3end Trim,\"", "\"bad_reads\\\\n\"", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "items", "(", ")", ":", "fh", ".", "write", "(", "\"{},{}\\\\n\"", ".", "format", "(", "arg_3", ",", "\",\"", ".", "join", "(", "[", "str", "(", "arg_5", ")", "for", "arg_5", "in", "arg_4", ".", "values", "(", ")", "]", ")", ")", ")", "arg_6", "=", "{", "\"tableRow\"", ":", "[", "{", "\"sample\"", ":", "arg_2", ",", "\"data\"", ":", "[", "{", "\"header\"", ":", "\"trimmed\"", ",", "\"value\"", ":", "arg_4", "[", "\"total_trim_perc\"", "]", ",", "\"table\"", ":", "\"qc\"", ",", "\"columnBar\"", ":", "True", "}", ",", "]", "}", "]", ",", "\"plotData\"", ":", "[", "{", "\"sample\"", ":", "arg_2", ",", "\"data\"", ":", "{", "\"sparkline\"", ":", "arg_4", "[", "\"clean_len\"", "]", "}", "}", "]", ",", "\"badReads\"", ":", "arg_4", "[", "\"bad_reads\"", "]", "}", "json_rep", ".", "write", "(", "json", ".", "dumps", "(", "arg_6", ",", "separators", "=", "(", "\",\"", ",", "\":\"", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Writes a report from multiple samples.\n\n    Parameters\n    ----------\n    storage_dic : dict or :py:class:`OrderedDict`\n        Storage containing the trimming statistics. See :py:func:`parse_log`\n        for its generation.\n    output_file : str\n        Path where the output file will be generated.\n    sample_id : str\n        Id or name of the current sample.\n    \"\"\"\n\n    with open(arg_1, \"w\") as fh, open(\".report.json\", \"w\") as json_rep:\n\n        # Write header\n        fh.write(\"Sample,Total length,Total trimmed,%,5end Trim,3end Trim,\"\n                 \"bad_reads\\\\n\")\n\n        # Write contents\n        for arg_3, arg_4 in arg_0.items():\n            fh.write(\"{},{}\\\\n\".format(\n                arg_3, \",\".join([str(arg_5) for arg_5 in arg_4.values()])))\n\n            arg_6 = {\n                \"tableRow\": [{\n                    \"sample\": arg_2,\n                    \"data\": [\n                        {\"header\": \"trimmed\",\n                         \"value\": arg_4[\"total_trim_perc\"],\n                         \"table\": \"qc\",\n                         \"columnBar\": True},\n                    ]\n                }],\n                \"plotData\": [{\n                    \"sample\": arg_2,\n                    \"data\": {\n                        \"sparkline\": arg_4[\"clean_len\"]\n                    }\n                }],\n                \"badReads\": arg_4[\"bad_reads\"]\n            }\n            json_rep.write(json.dumps(arg_6, separators=(\",\", \":\")))", "path": "flowcraft/templates/trimmomatic_report.py", "identifier": "write_report", "docstring": "Writes a report from multiple samples.\n\n    Parameters\n    ----------\n    storage_dic : dict or :py:class:`OrderedDict`\n        Storage containing the trimming statistics. See :py:func:`parse_log`\n        for its generation.\n    output_file : str\n        Path where the output file will be generated.\n    sample_id : str\n        Id or name of the current sample.", "docstring_tokens": ["Writes", "a", "report", "from", "multiple", "samples", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257196}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/button.py#L848-L860", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Re-calculates the position of the Label.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "size", "arg_3", ",", "arg_4", "=", "arg_0", ".", "pos", "arg_0", ".", "_label", ".", "anchor_x", "=", "\"left\"", "arg_0", ".", "_label", ".", "x", "=", "arg_3", "+", "arg_1", "/", "2.", "+", "arg_1", "arg_0", ".", "_label", ".", "y", "=", "arg_4", "+", "arg_2", "/", "2.", "+", "arg_2", "*", ".15", "arg_0", ".", "_label", ".", "_update", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Re-calculates the position of the Label.\n        \"\"\"\n        # Convenience variables\n        arg_1,arg_2 = arg_0.size\n        arg_3,arg_4 = arg_0.pos\n        \n        # Label position\n        arg_0._label.anchor_x = \"left\"\n        arg_0._label.x = arg_3+arg_1/2.+arg_1\n        arg_0._label.y = arg_4+arg_2/2.+arg_2*.15\n        arg_0._label._update()", "path": "peng3d/gui/button.py", "identifier": "Checkbox.redraw_label", "docstring": "Re-calculates the position of the Label.", "docstring_tokens": ["Re", "-", "calculates", "the", "position", "of", "the", "Label", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 257197}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/streamlet.py#L59-L65", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Return a new Streamlet by applying map_function to each element of this Streamlet.", "language": "python", "parameters": "(self, map_function)", "return_statement": "return map_streamlet", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "heronpy", ".", "streamlet", ".", "impl", ".", "Funcbolt", "import", "MapStreamlet", "arg_2", "=", "MapStreamlet", "(", "arg_1", ",", "arg_0", ")", "arg_0", ".", "_add_child", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a new Streamlet by applying Func_function to each element of this Streamlet.\n    \"\"\"\n    from heronpy.streamlet.impl.Funcbolt import MapStreamlet\n    arg_2 = MapStreamlet(arg_1, arg_0)\n    arg_0._add_child(arg_2)\n    return arg_2", "path": "heronpy/streamlet/streamlet.py", "identifier": "Streamlet.map", "docstring": "Return a new Streamlet by applying map_function to each element of this Streamlet.", "docstring_tokens": ["Return", "a", "new", "Streamlet", "by", "applying", "map_function", "to", "each", "element", "of", "this", "Streamlet", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257198}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/model.py#L819-L843", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Remove groups from the model.", "language": "python", "parameters": "(self, group_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", "or", "hasattr", "(", "arg_1", ",", "\"id\"", ")", ":", "warn", "(", "\"need to pass in a list\"", ")", "arg_1", "=", "[", "arg_1", "]", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", ".", "id", "not", "in", "arg_0", ".", "groups", ":", "LOGGER", ".", "warning", "(", "\"%r not in %r. Ignored.\"", ",", "arg_2", ",", "arg_0", ")", "else", ":", "arg_0", ".", "groups", ".", "remove", "(", "arg_2", ")", "arg_2", ".", "_model", "=", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove groups from the model.\n\n        Members of each group are not removed\n        from the model (i.e. metabolites, reactions, and genes in the group\n        stay in the model after any groups containing them are removed).\n\n        Parameters\n        ----------\n        group_list : list\n            A list of `cobra.Group` objects to remove from the model.\n        \"\"\"\n\n        if isinstance(arg_1, string_types) or \\\n                hasattr(arg_1, \"id\"):\n            warn(\"need to pass in a list\")\n            arg_1 = [arg_1]\n\n        for arg_2 in arg_1:\n            # make sure the group is in the model\n            if arg_2.id not in arg_0.groups:\n                LOGGER.warning(\"%r not in %r. Ignored.\", arg_2, arg_0)\n            else:\n                arg_0.groups.remove(arg_2)\n                arg_2._model = None", "path": "cobra/core/model.py", "identifier": "Model.remove_groups", "docstring": "Remove groups from the model.\n\n        Members of each group are not removed\n        from the model (i.e. metabolites, reactions, and genes in the group\n        stay in the model after any groups containing them are removed).\n\n        Parameters\n        ----------\n        group_list : list\n            A list of `cobra.Group` objects to remove from the model.", "docstring_tokens": ["Remove", "groups", "from", "the", "model", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 257199}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/transforms/geometry.py#L7-L21", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Flip an image horizontally or vertically.", "language": "python", "parameters": "(img, direction='horizontal')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'horizontal'", ")", ":", "assert", "arg_1", "in", "[", "'horizontal'", ",", "'vertical'", "]", "if", "arg_1", "==", "'horizontal'", ":", "return", "np", ".", "flip", "(", "arg_0", ",", "axis", "=", "1", ")", "else", ":", "return", "np", ".", "flip", "(", "arg_0", ",", "axis", "=", "0", ")"], "function": "def Func(arg_0, arg_1='horizontal'):\n    \"\"\"Flip an image horizontally or vertically.\n\n    Args:\n        img (ndarray): Image to be flipped.\n        direction (str): The flip direction, either \"horizontal\" or \"vertical\".\n\n    Returns:\n        ndarray: The flipped image.\n    \"\"\"\n    assert arg_1 in ['horizontal', 'vertical']\n    if arg_1 == 'horizontal':\n        return np.flip(arg_0, axis=1)\n    else:\n        return np.flip(arg_0, axis=0)", "path": "mmcv/image/transforms/geometry.py", "identifier": "imflip", "docstring": "Flip an image horizontally or vertically.\n\n    Args:\n        img (ndarray): Image to be flipped.\n        direction (str): The flip direction, either \"horizontal\" or \"vertical\".\n\n    Returns:\n        ndarray: The flipped image.", "docstring_tokens": ["Flip", "an", "image", "horizontally", "or", "vertically", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 257200}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vagrant.py#L280-L303", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Installs Vagrant from the most recent package available from their homepage.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "burlap", ".", "system", "import", "get_arch", ",", "distrib_family", "arg_1", "=", "arg_0", ".", "local_renderer", "arg_2", "=", "urlopen", "(", "arg_1", ".", "env", ".", "download_url", ")", ".", "read", "(", ")", "print", "(", "len", "(", "arg_2", ")", ")", "arg_3", "=", "DOWNLOAD_LINK_PATTERN", ".", "findall", "(", "arg_2", ")", "print", "(", "arg_3", ")", "arg_4", "=", "get_arch", "(", ")", "arg_5", "=", "distrib_family", "(", ")", "if", "arg_5", "==", "DEBIAN", ":", "arg_6", "=", "'.deb'", "arg_3", "=", "[", "match", "for", "match", "in", "arg_3", "if", "match", ".", "endswith", "(", "arg_6", ")", "and", "arg_4", "in", "match", "]", "print", "(", "'matches:'", ",", "arg_3", ")", "assert", "arg_3", ",", "\"No matches found.\"", "assert", "len", "(", "arg_3", ")", "==", "1", ",", "\"Too many matches found: %s\"", "%", "(", "', '", ".", "join", "(", "arg_3", ")", ")", "arg_1", ".", "env", ".", "final_download_url", "=", "arg_3", "[", "0", "]", "arg_1", ".", "env", ".", "local_filename", "=", "'/tmp/vagrant%s'", "%", "arg_6", "arg_1", ".", "run", "(", "'wget -O {local_filename} {final_download_url}'", ")", "arg_1", ".", "sudo", "(", "'dpkg -i {local_filename}'", ")", "else", ":", "raise", "NotImplementedError", "(", "'Unsupported family: %s'", "%", "arg_5", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Installs Vagrant from the most recent package available from their homepage.\n        \"\"\"\n        from burlap.system import get_arch, distrib_family\n        arg_1 = arg_0.local_renderer\n        arg_2 = urlopen(arg_1.env.download_url).read()\n        print(len(arg_2))\n        arg_3 = DOWNLOAD_LINK_PATTERN.findall(arg_2)\n        print(arg_3)\n        arg_4 = get_arch() # e.g. 'x86_64'\n        arg_5 = distrib_family()\n        if arg_5 == DEBIAN:\n            arg_6 = '.deb'\n            arg_3 = [match for match in arg_3 if match.endswith(arg_6) and arg_4 in match]\n            print('matches:', arg_3)\n            assert arg_3, \"No matches found.\"\n            assert len(arg_3) == 1, \"Too many matches found: %s\" % (', '.join(arg_3))\n            arg_1.env.final_download_url = arg_3[0]\n            arg_1.env.local_filename = '/tmp/vagrant%s' % arg_6\n            arg_1.run('wget -O {local_filename} {final_download_url}')\n            arg_1.sudo('dpkg -i {local_filename}')\n        else:\n            raise NotImplementedError('Unsupported family: %s' % arg_5)", "path": "burlap/vagrant.py", "identifier": "VagrantSatchel.install_from_upstream", "docstring": "Installs Vagrant from the most recent package available from their homepage.", "docstring_tokens": ["Installs", "Vagrant", "from", "the", "most", "recent", "package", "available", "from", "their", "homepage", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 257201}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1514-L1522", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Construct a datetime from a given date and a given time.", "language": "python", "parameters": "(cls, date, time)", "return_statement": "return cls(date.year, date.month, date.day,\n                   time.hour, time.minute, time.second, time.microsecond,\n                   time.tzinfo)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "_date_class", ")", ":", "raise", "TypeError", "(", "\"date argument must be a date instance\"", ")", "if", "not", "isinstance", "(", "arg_2", ",", "_time_class", ")", ":", "raise", "TypeError", "(", "\"time argument must be a time instance\"", ")", "return", "arg_0", "(", "arg_1", ".", "year", ",", "arg_1", ".", "month", ",", "arg_1", ".", "day", ",", "arg_2", ".", "hour", ",", "arg_2", ".", "minute", ",", "arg_2", ".", "second", ",", "arg_2", ".", "microsecond", ",", "arg_2", ".", "tzinfo", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"Construct a datetime from a given date and a given time.\"\n        if not isinstance(arg_1, _date_class):\n            raise TypeError(\"date argument must be a date instance\")\n        if not isinstance(arg_2, _time_class):\n            raise TypeError(\"time argument must be a time instance\")\n        return arg_0(arg_1.year, arg_1.month, arg_1.day,\n                   arg_2.hour, arg_2.minute, arg_2.second, arg_2.microsecond,\n                   arg_2.tzinfo)", "path": "third_party/pypy/datetime.py", "identifier": "datetime.combine", "docstring": "Construct a datetime from a given date and a given time.", "docstring_tokens": ["Construct", "a", "datetime", "from", "a", "given", "date", "and", "a", "given", "time", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257202}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L456-L473", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Purge the stash from all keys", "language": "python", "parameters": "(self, force=False, key_type=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "_assert_valid_stash", "(", ")", "if", "not", "arg_1", ":", "raise", "GhostError", "(", "\"The `force` flag must be provided to perform a stash Func. \"", "\"I mean, you don't really want to just delete everything \"", "\"without precautionary measures eh?\"", ")", "audit", "(", "storage", "=", "arg_0", ".", "_storage", ".", "db_path", ",", "action", "=", "'PURGE'", ",", "message", "=", "json", ".", "dumps", "(", "dict", "(", ")", ")", ")", "for", "arg_3", "in", "arg_0", ".", "list", "(", "arg_2", "=", "arg_2", ")", ":", "arg_0", ".", "delete", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n        \"\"\"Purge the stash from all keys\n        \"\"\"\n        arg_0._assert_valid_stash()\n\n        if not arg_1:\n            raise GhostError(\n                \"The `force` flag must be provided to perform a stash Func. \"\n                \"I mean, you don't really want to just delete everything \"\n                \"without precautionary measures eh?\")\n\n        audit(\n            storage=arg_0._storage.db_path,\n            action='PURGE',\n            message=json.dumps(dict()))\n\n        for arg_3 in arg_0.list(arg_2=arg_2):\n            arg_0.delete(arg_3)", "path": "ghost.py", "identifier": "Stash.purge", "docstring": "Purge the stash from all keys", "docstring_tokens": ["Purge", "the", "stash", "from", "all", "keys"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 257203}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenestorage/masterpassword.py#L141-L153", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Obtain the encrypted masterkey", "language": "python", "parameters": "(self)", "return_statement": "return \"{}${}\".format(\n            self._derive_checksum(self.masterkey), aes.encrypt(self.masterkey)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "unlocked", "(", ")", ":", "raise", "WalletLocked", "arg_1", "=", "AESCipher", "(", "arg_0", ".", "password", ")", "return", "\"{}${}\"", ".", "format", "(", "arg_0", ".", "_derive_checksum", "(", "arg_0", ".", "masterkey", ")", ",", "arg_1", ".", "encrypt", "(", "arg_0", ".", "masterkey", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Obtain the encrypted masterkey\n\n            .. note:: The encrypted masterkey is checksummed, so that we can\n                figure out that a provided password is correct or not. The\n                checksum is only 4 bytes long!\n        \"\"\"\n        if not arg_0.unlocked():\n            raise WalletLocked\n        arg_1 = AESCipher(arg_0.password)\n        return \"{}${}\".format(\n            arg_0._derive_checksum(arg_0.masterkey), arg_1.encrypt(arg_0.masterkey)\n        )", "path": "graphenestorage/masterpassword.py", "identifier": "MasterPassword._get_encrypted_masterpassword", "docstring": "Obtain the encrypted masterkey\n\n            .. note:: The encrypted masterkey is checksummed, so that we can\n                figure out that a provided password is correct or not. The\n                checksum is only 4 bytes long!", "docstring_tokens": ["Obtain", "the", "encrypted", "masterkey"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 257204}
{"url": "https://github.com/hit9/rux/blob/d7f60722658a3b83ac6d7bb3ca2790ac9c926b59/rux/renderer.py#L28-L42", "sha": "d7f60722658a3b83ac6d7bb3ca2790ac9c926b59", "docstring_summary": "Render data with template, return html unicodes.\n        parameters\n          template   str  the template's filename\n          data       dict the data to render", "language": "python", "parameters": "(self, template, **data)", "return_statement": "return html", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "global_data", ".", "copy", "(", ")", "arg_3", ".", "update", "(", "arg_2", ")", "try", ":", "arg_4", "=", "arg_0", ".", "env", ".", "get_template", "(", "arg_1", ")", ".", "Func", "(", "**", "arg_3", ")", "except", "TemplateNotFound", ":", "raise", "JinjaTemplateNotFound", "return", "arg_4"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Render data with template, return html unicodes.\n        parameters\n          template   str  the template's filename\n          data       dict the data to Func\n        \"\"\"\n        # make a copy and update the copy\n        arg_3 = arg_0.global_data.copy()\n        arg_3.update(arg_2)\n\n        try:\n            arg_4 = arg_0.env.get_template(arg_1).Func(**arg_3)\n        except TemplateNotFound:\n            raise JinjaTemplateNotFound\n        return arg_4", "path": "rux/renderer.py", "identifier": "Renderer.render", "docstring": "Render data with template, return html unicodes.\n        parameters\n          template   str  the template's filename\n          data       dict the data to render", "docstring_tokens": ["Render", "data", "with", "template", "return", "html", "unicodes", ".", "parameters", "template", "str", "the", "template", "s", "filename", "data", "dict", "the", "data", "to", "render"], "nwo": "hit9/rux", "score": 0.18892572326127263, "idx": 257205}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/remesh.py#L162-L247", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Create a new mesh that is a resampled version of the current one.", "language": "python", "parameters": "(script, voxel=1.0, offset=0.0, merge_vert=True,\n                       discretize=False, multisample=False, thicken=False)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1.0", ",", "arg_2", "=", "0.0", ",", "arg_3", "=", "True", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Uniform Mesh Resampling\">\\n'", ",", "'    <Param name=\"CellSize\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_1", ")", ",", "'description=\"Precision\" '", ",", "'min=\"0\" '", ",", "'max=\"100\" '", ",", "'type=\"RichAbsPerc\" '", ",", "'/>\\n'", ",", "'    <Param name=\"Offset\" '", ",", "'value=\"{}\" '", ".", "format", "(", "arg_2", ")", ",", "'description=\"Offset\" '", ",", "'min=\"-100\" '", ",", "'max=\"100\" '", ",", "'type=\"RichAbsPerc\" '", ",", "'/>\\n'", ",", "'    <Param name=\"mergeCloseVert\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_3", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Clean Vertices\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"discretize\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_4", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Discretize\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"multisample\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_5", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Multisample\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'    <Param name=\"absDist\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_6", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Absolute Distance\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_7", ")", "if", "isinstance", "(", "arg_0", ",", "FilterScript", ")", ":", "arg_0", ".", "add_layer", "(", "'Offset mesh'", ")", "return", "None"], "function": "def Func(arg_0, arg_1=1.0, arg_2=0.0, arg_3=True,\n                       arg_4=False, arg_5=False, arg_6=False):\n    \"\"\" Create a new mesh that is a resampled version of the current one.\n\n    The resampling is done by building a uniform volumetric representation\n    where each voxel contains the signed distance from the original surface.\n    The resampled surface is reconstructed using the marching cube algorithm\n    over this volume.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        voxel (float): voxel (cell) size for resampling. Smaller cells give\n            better precision at a higher computational cost. Remember that\n            halving the cell size means that you build a volume 8 times larger.\n        offset (float): offset amount of the created surface (i.e. distance of\n            the created surface from the original one). If offset is zero, the\n            created surface passes on the original mesh itself. Values greater\n            than zero mean an external surface (offset), and lower than zero\n            mean an internal surface (inset). In practice this value is the\n            threshold passed to the Marching Cube algorithm to extract the\n            isosurface from the distance field representation.\n        merge_vert (bool): if True the mesh generated by MC will be cleaned by\n            unifying vertices that are almost coincident.\n        discretize (bool): if True the position of the intersected edge of the\n            marching cube grid is not computed by linear interpolation, but it\n            is placed in fixed middle position. As a consequence the resampled\n            object will look severely aliased by a stairstep appearance. Useful\n            only for simulating the output of 3D printing devices.\n        multisample (bool): if True the distance field is more accurately\n            compute by multisampling the volume (7 sample for each voxel). Much\n            slower but less artifacts.\n        thicken (bool): if True, you have to choose a non zero Offset and a\n            double surface is built around the original surface, inside and\n            outside. Is useful to convert thin floating surfaces into solid,\n            thick meshes.\n\n    Layer stack:\n        Creates 1 new layer 'Offset mesh'\n        Current layer is changed to new layer\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    arg_7 = ''.join([\n        '  <filter name=\"Uniform Mesh Resampling\">\\n',\n        '    <Param name=\"CellSize\" ',\n        'value=\"{}\" '.format(arg_1),\n        'description=\"Precision\" ',\n        'min=\"0\" ',\n        'max=\"100\" ',\n        'type=\"RichAbsPerc\" ',\n        '/>\\n',\n        '    <Param name=\"Offset\" ',\n        'value=\"{}\" '.format(arg_2),\n        'description=\"Offset\" ',\n        'min=\"-100\" ',\n        'max=\"100\" ',\n        'type=\"RichAbsPerc\" ',\n        '/>\\n',\n        '    <Param name=\"mergeCloseVert\" ',\n        'value=\"{}\" '.format(str(arg_3).lower()),\n        'description=\"Clean Vertices\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"discretize\" ',\n        'value=\"{}\" '.format(str(arg_4).lower()),\n        'description=\"Discretize\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"multisample\" ',\n        'value=\"{}\" '.format(str(arg_5).lower()),\n        'description=\"Multisample\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '    <Param name=\"absDist\" ',\n        'value=\"{}\" '.format(str(arg_6).lower()),\n        'description=\"Absolute Distance\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_7)\n    if isinstance(arg_0, FilterScript):\n        arg_0.add_layer('Offset mesh')\n    return None", "path": "meshlabxml/remesh.py", "identifier": "uniform_resampling", "docstring": "Create a new mesh that is a resampled version of the current one.\n\n    The resampling is done by building a uniform volumetric representation\n    where each voxel contains the signed distance from the original surface.\n    The resampled surface is reconstructed using the marching cube algorithm\n    over this volume.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        voxel (float): voxel (cell) size for resampling. Smaller cells give\n            better precision at a higher computational cost. Remember that\n            halving the cell size means that you build a volume 8 times larger.\n        offset (float): offset amount of the created surface (i.e. distance of\n            the created surface from the original one). If offset is zero, the\n            created surface passes on the original mesh itself. Values greater\n            than zero mean an external surface (offset), and lower than zero\n            mean an internal surface (inset). In practice this value is the\n            threshold passed to the Marching Cube algorithm to extract the\n            isosurface from the distance field representation.\n        merge_vert (bool): if True the mesh generated by MC will be cleaned by\n            unifying vertices that are almost coincident.\n        discretize (bool): if True the position of the intersected edge of the\n            marching cube grid is not computed by linear interpolation, but it\n            is placed in fixed middle position. As a consequence the resampled\n            object will look severely aliased by a stairstep appearance. Useful\n            only for simulating the output of 3D printing devices.\n        multisample (bool): if True the distance field is more accurately\n            compute by multisampling the volume (7 sample for each voxel). Much\n            slower but less artifacts.\n        thicken (bool): if True, you have to choose a non zero Offset and a\n            double surface is built around the original surface, inside and\n            outside. Is useful to convert thin floating surfaces into solid,\n            thick meshes.\n\n    Layer stack:\n        Creates 1 new layer 'Offset mesh'\n        Current layer is changed to new layer\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Create", "a", "new", "mesh", "that", "is", "a", "resampled", "version", "of", "the", "current", "one", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 257206}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L723-L980", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This runs a cone-search query.", "language": "python", "parameters": "(lcc_server,\n                center_ra,\n                center_decl,\n                radiusarcmin=5.0,\n                result_visibility='unlisted',\n                email_when_done=False,\n                collections=None,\n                columns=None,\n                filters=None,\n                sortspec=None,\n                samplespec=None,\n                limitspec=None,\n                download_data=True,\n                outdir=None,\n                maxtimeout=300.0,\n                refresh=15.0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "5.0", ",", "arg_4", "=", "'unlisted'", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "True", ",", "arg_13", "=", "None", ",", "arg_14", "=", "300.0", ",", "arg_15", "=", "15.0", ")", ":", "arg_16", "=", "'%.5f %.5f %.1f'", "%", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_17", "=", "{", "'coords'", ":", "arg_16", "}", "if", "arg_6", ":", "arg_17", "[", "'collections'", "]", "=", "arg_6", "if", "arg_7", ":", "arg_17", "[", "'columns'", "]", "=", "arg_7", "if", "arg_8", ":", "arg_17", "[", "'filters'", "]", "=", "arg_8", "if", "arg_9", ":", "arg_17", "[", "'sortspec'", "]", "=", "json", ".", "dumps", "(", "[", "arg_9", "]", ")", "if", "arg_10", ":", "arg_17", "[", "'samplespec'", "]", "=", "int", "(", "arg_10", ")", "if", "arg_11", ":", "arg_17", "[", "'limitspec'", "]", "=", "int", "(", "arg_11", ")", "arg_17", "[", "'visibility'", "]", "=", "arg_4", "arg_17", "[", "'emailwhendone'", "]", "=", "arg_5", "if", "arg_5", ":", "arg_12", "=", "False", "arg_18", ",", "arg_19", ",", "arg_20", "=", "check_existing_apikey", "(", "arg_0", ")", "if", "not", "arg_18", ":", "arg_19", ",", "arg_20", "=", "get_new_apikey", "(", "arg_0", ")", "arg_21", "=", "'%s/api/conesearch'", "%", "arg_0", "arg_22", "=", "submit_post_searchquery", "(", "arg_21", ",", "arg_17", ",", "arg_19", ")", "arg_23", "=", "arg_22", "[", "0", "]", "if", "arg_12", ":", "if", "arg_23", "==", "'ok'", ":", "LOGINFO", "(", "'query complete, downloading associated data...'", ")", "arg_24", ",", "arg_25", ",", "arg_26", "=", "retrieve_dataset_files", "(", "arg_22", ",", "arg_13", "=", "arg_13", ",", "arg_19", "=", "arg_19", ")", "if", "arg_26", ":", "return", "arg_22", "[", "1", "]", ",", "arg_24", ",", "arg_25", ",", "arg_26", "else", ":", "return", "arg_22", "[", "1", "]", ",", "arg_24", ",", "arg_25", "elif", "arg_23", "==", "'background'", ":", "LOGINFO", "(", "'query is not yet complete, '", "'waiting up to %.1f minutes, '", "'updates every %s seconds (hit Ctrl+C to cancel)...'", "%", "(", "arg_14", "/", "60.0", ",", "arg_15", ")", ")", "arg_27", "=", "0.0", "while", "arg_27", "<", "arg_14", ":", "try", ":", "time", ".", "sleep", "(", "arg_15", ")", "arg_24", ",", "arg_25", ",", "arg_26", "=", "retrieve_dataset_files", "(", "arg_22", ",", "arg_13", "=", "arg_13", ",", "arg_19", "=", "arg_19", ")", "if", "(", "arg_24", "and", "os", ".", "path", ".", "exists", "(", "arg_24", ")", "and", "arg_25", "and", "os", ".", "path", ".", "exists", "(", "arg_25", ")", ")", ":", "LOGINFO", "(", "'all dataset products collected'", ")", "return", "arg_22", "[", "1", "]", ",", "arg_24", ",", "arg_25", "arg_27", "=", "arg_27", "+", "arg_15", "except", "KeyboardInterrupt", ":", "LOGWARNING", "(", "'abandoned wait for downloading data'", ")", "return", "arg_22", "[", "1", "]", ",", "None", ",", "None", "LOGERROR", "(", "'wait timed out.'", ")", "return", "arg_22", "[", "1", "]", ",", "None", ",", "None", "else", ":", "LOGERROR", "(", "'could not download the data for this query result'", ")", "return", "arg_22", "[", "1", "]", ",", "None", ",", "None", "else", ":", "return", "arg_22", "[", "1", "]", ",", "None", ",", "None"], "function": "def Func(arg_0,\n                arg_1,\n                arg_2,\n                arg_3=5.0,\n                arg_4='unlisted',\n                arg_5=False,\n                arg_6=None,\n                arg_7=None,\n                arg_8=None,\n                arg_9=None,\n                arg_10=None,\n                arg_11=None,\n                arg_12=True,\n                arg_13=None,\n                arg_14=300.0,\n                arg_15=15.0):\n\n    '''This runs a cone-search query.\n\n    Parameters\n    ----------\n\n    lcc_server : str\n        This is the base URL of the LCC-Server to talk to.  (e.g. for HAT, use:\n        https://data.hatsurveys.org)\n\n    center_ra,center_decl : float\n        These are the central coordinates of the search to conduct. These can be\n        either decimal degrees of type float, or sexagesimal coordinates of type\n        str:\n\n        - OK: 290.0, 45.0\n        - OK: 15:00:00 +45:00:00\n        - OK: 15 00 00.0 -45 00 00.0\n        - NOT OK: 290.0 +45:00:00\n        - NOT OK: 15:00:00 45.0\n\n    radiusarcmin : float\n        This is the search radius to use for the cone-search. This is in\n        arcminutes. The maximum radius you can use is 60 arcminutes = 1 degree.\n\n    result_visibility : {'private', 'unlisted', 'public'}\n        This sets the visibility of the dataset produced from the search\n        result::\n\n               'private' -> the dataset and its products are not visible or\n                            accessible by any user other than the one that\n                            created the dataset.\n\n               'unlisted' -> the dataset and its products are not visible in the\n                             list of public datasets, but can be accessed if the\n                             dataset URL is known\n\n               'public' -> the dataset and its products are visible in the list\n                           of public datasets and can be accessed by anyone.\n\n    email_when_done : bool\n        If True, the LCC-Server will email you when the search is complete. This\n        will also set `download_data` to False. Using this requires an\n        LCC-Server account and an API key tied to that account.\n\n    collections : list of str or None\n        This is a list of LC collections to search in. If this is None, all\n        collections will be searched.\n\n    columns : list of str or None\n        This is a list of columns to return in the results. Matching objects'\n        object IDs, RAs, DECs, and links to light curve files will always be\n        returned so there is no need to specify these columns. If None, only\n        these columns will be returned: 'objectid', 'ra', 'decl', 'lcfname'\n\n    filters : str or None\n        This is an SQL-like string to use to filter on database columns in the\n        LCC-Server's collections. To see the columns available for a search,\n        visit the Collections tab in the LCC-Server's browser UI. The filter\n        operators allowed are::\n\n            lt      -> less than\n            gt      -> greater than\n            ge      -> greater than or equal to\n            le      -> less than or equal to\n            eq      -> equal to\n            ne      -> not equal to\n            ct      -> contains text\n            isnull  -> column value is null\n            notnull -> column value is not null\n\n        You may use the `and` and `or` operators between filter specifications\n        to chain them together logically.\n\n        Example filter strings::\n\n            \"(propermotion gt 200.0) and (sdssr lt 11.0)\"\n            \"(dered_jmag_kmag gt 2.0) and (aep_000_stetsonj gt 10.0)\"\n            \"(gaia_status ct 'ok') and (propermotion gt 300.0)\"\n            \"(simbad_best_objtype ct 'RR') and (dered_sdssu_sdssg lt 0.5)\"\n\n    sortspec : tuple of two strs or None\n        If not None, this should be a tuple of two items::\n\n            ('column to sort by', 'asc|desc')\n\n        This sets the column to sort the results by. For Func, the\n        default column and sort order are 'dist_arcsec' and 'asc', meaning the\n        distance from the search center in ascending order.\n\n    samplespec : int or None\n        If this is an int, will indicate how many rows from the initial search\n        result will be uniformly random sampled and returned.\n\n    limitspec : int or None\n        If this is an int, will indicate how many rows from the initial search\n        result to return in total.\n\n        `sortspec`, `samplespec`, and `limitspec` are applied in this order:\n\n            sample -> sort -> limit\n\n    download_data : bool\n        This sets if the accompanying data from the search results will be\n        downloaded automatically. This includes the data table CSV, the dataset\n        pickle file, and a light curve ZIP file. Note that if the search service\n        indicates that your query is still in progress, this function will block\n        until the light curve ZIP file becomes available. The maximum wait time\n        in seconds is set by maxtimeout and the refresh interval is set by\n        refresh.\n\n        To avoid the wait block, set download_data to False and the function\n        will write a pickle file to `~/.astrobase/lccs/query-[setid].pkl`\n        containing all the information necessary to retrieve these data files\n        later when the query is done. To do so, call the\n        `retrieve_dataset_files` with the path to this pickle file (it will be\n        returned).\n\n    outdir : str or None\n        If this is provided, sets the output directory of the downloaded dataset\n        files. If None, they will be downloaded to the current directory.\n\n    maxtimeout : float\n        The maximum time in seconds to wait for the LCC-Server to respond with a\n        result before timing out. You can use the `retrieve_dataset_files`\n        function to get results later as needed.\n\n    refresh : float\n        The time to wait in seconds before pinging the LCC-Server to see if a\n        search query has completed and dataset result files can be downloaded.\n\n    Returns\n    -------\n\n    tuple\n        Returns a tuple with the following elements::\n\n            (search result status dict,\n             search result CSV file path,\n             search result LC ZIP path)\n\n    '''\n\n    # turn the input into a param dict\n\n    arg_16 = '%.5f %.5f %.1f' % (arg_1, arg_2, arg_3)\n    arg_17 = {\n        'coords':arg_16\n    }\n\n    if arg_6:\n        arg_17['collections'] = arg_6\n    if arg_7:\n        arg_17['columns'] = arg_7\n    if arg_8:\n        arg_17['filters'] = arg_8\n    if arg_9:\n        arg_17['sortspec'] = json.dumps([arg_9])\n    if arg_10:\n        arg_17['samplespec'] = int(arg_10)\n    if arg_11:\n        arg_17['limitspec'] = int(arg_11)\n\n    arg_17['visibility'] = arg_4\n    arg_17['emailwhendone'] = arg_5\n\n    # we won't wait for the LC ZIP to complete if email_when_done = True\n    if arg_5:\n        arg_12 = False\n\n    # check if we have an API key already\n    arg_18, arg_19, arg_20 = check_existing_apikey(arg_0)\n\n    # if not, get a new one\n    if not arg_18:\n        arg_19, arg_20 = get_new_apikey(arg_0)\n\n    # hit the server\n    arg_21 = '%s/api/conesearch' % arg_0\n\n    arg_22 = submit_post_searchquery(arg_21, arg_17, arg_19)\n\n    # check the status of the search\n    arg_23 = arg_22[0]\n\n    # now we'll check if we want to download the data\n    if arg_12:\n\n        if arg_23 == 'ok':\n\n            LOGINFO('query complete, downloading associated data...')\n            arg_24, arg_25, arg_26 = retrieve_dataset_files(arg_22,\n                                                     arg_13=arg_13,\n                                                     arg_19=arg_19)\n\n            if arg_26:\n                return arg_22[1], arg_24, arg_25, arg_26\n            else:\n                return arg_22[1], arg_24, arg_25\n\n        elif arg_23 == 'background':\n\n            LOGINFO('query is not yet complete, '\n                    'waiting up to %.1f minutes, '\n                    'updates every %s seconds (hit Ctrl+C to cancel)...' %\n                    (arg_14/60.0, arg_15))\n\n            arg_27 = 0.0\n\n            while arg_27 < arg_14:\n\n                try:\n\n                    time.sleep(arg_15)\n                    arg_24, arg_25, arg_26 = retrieve_dataset_files(arg_22,\n                                                             arg_13=arg_13,\n                                                             arg_19=arg_19)\n\n                    if (arg_24 and os.path.exists(arg_24) and\n                        arg_25 and os.path.exists(arg_25)):\n\n                        LOGINFO('all dataset products collected')\n                        return arg_22[1], arg_24, arg_25\n\n                    arg_27 = arg_27 + arg_15\n\n                except KeyboardInterrupt:\n\n                    LOGWARNING('abandoned wait for downloading data')\n                    return arg_22[1], None, None\n\n            LOGERROR('wait timed out.')\n            return arg_22[1], None, None\n\n        else:\n\n            LOGERROR('could not download the data for this query result')\n            return arg_22[1], None, None\n\n    else:\n\n        return arg_22[1], None, None", "path": "astrobase/services/lccs.py", "identifier": "cone_search", "docstring": "This runs a cone-search query.\n\n    Parameters\n    ----------\n\n    lcc_server : str\n        This is the base URL of the LCC-Server to talk to.  (e.g. for HAT, use:\n        https://data.hatsurveys.org)\n\n    center_ra,center_decl : float\n        These are the central coordinates of the search to conduct. These can be\n        either decimal degrees of type float, or sexagesimal coordinates of type\n        str:\n\n        - OK: 290.0, 45.0\n        - OK: 15:00:00 +45:00:00\n        - OK: 15 00 00.0 -45 00 00.0\n        - NOT OK: 290.0 +45:00:00\n        - NOT OK: 15:00:00 45.0\n\n    radiusarcmin : float\n        This is the search radius to use for the cone-search. This is in\n        arcminutes. The maximum radius you can use is 60 arcminutes = 1 degree.\n\n    result_visibility : {'private', 'unlisted', 'public'}\n        This sets the visibility of the dataset produced from the search\n        result::\n\n               'private' -> the dataset and its products are not visible or\n                            accessible by any user other than the one that\n                            created the dataset.\n\n               'unlisted' -> the dataset and its products are not visible in the\n                             list of public datasets, but can be accessed if the\n                             dataset URL is known\n\n               'public' -> the dataset and its products are visible in the list\n                           of public datasets and can be accessed by anyone.\n\n    email_when_done : bool\n        If True, the LCC-Server will email you when the search is complete. This\n        will also set `download_data` to False. Using this requires an\n        LCC-Server account and an API key tied to that account.\n\n    collections : list of str or None\n        This is a list of LC collections to search in. If this is None, all\n        collections will be searched.\n\n    columns : list of str or None\n        This is a list of columns to return in the results. Matching objects'\n        object IDs, RAs, DECs, and links to light curve files will always be\n        returned so there is no need to specify these columns. If None, only\n        these columns will be returned: 'objectid', 'ra', 'decl', 'lcfname'\n\n    filters : str or None\n        This is an SQL-like string to use to filter on database columns in the\n        LCC-Server's collections. To see the columns available for a search,\n        visit the Collections tab in the LCC-Server's browser UI. The filter\n        operators allowed are::\n\n            lt      -> less than\n            gt      -> greater than\n            ge      -> greater than or equal to\n            le      -> less than or equal to\n            eq      -> equal to\n            ne      -> not equal to\n            ct      -> contains text\n            isnull  -> column value is null\n            notnull -> column value is not null\n\n        You may use the `and` and `or` operators between filter specifications\n        to chain them together logically.\n\n        Example filter strings::\n\n            \"(propermotion gt 200.0) and (sdssr lt 11.0)\"\n            \"(dered_jmag_kmag gt 2.0) and (aep_000_stetsonj gt 10.0)\"\n            \"(gaia_status ct 'ok') and (propermotion gt 300.0)\"\n            \"(simbad_best_objtype ct 'RR') and (dered_sdssu_sdssg lt 0.5)\"\n\n    sortspec : tuple of two strs or None\n        If not None, this should be a tuple of two items::\n\n            ('column to sort by', 'asc|desc')\n\n        This sets the column to sort the results by. For cone_search, the\n        default column and sort order are 'dist_arcsec' and 'asc', meaning the\n        distance from the search center in ascending order.\n\n    samplespec : int or None\n        If this is an int, will indicate how many rows from the initial search\n        result will be uniformly random sampled and returned.\n\n    limitspec : int or None\n        If this is an int, will indicate how many rows from the initial search\n        result to return in total.\n\n        `sortspec`, `samplespec`, and `limitspec` are applied in this order:\n\n            sample -> sort -> limit\n\n    download_data : bool\n        This sets if the accompanying data from the search results will be\n        downloaded automatically. This includes the data table CSV, the dataset\n        pickle file, and a light curve ZIP file. Note that if the search service\n        indicates that your query is still in progress, this function will block\n        until the light curve ZIP file becomes available. The maximum wait time\n        in seconds is set by maxtimeout and the refresh interval is set by\n        refresh.\n\n        To avoid the wait block, set download_data to False and the function\n        will write a pickle file to `~/.astrobase/lccs/query-[setid].pkl`\n        containing all the information necessary to retrieve these data files\n        later when the query is done. To do so, call the\n        `retrieve_dataset_files` with the path to this pickle file (it will be\n        returned).\n\n    outdir : str or None\n        If this is provided, sets the output directory of the downloaded dataset\n        files. If None, they will be downloaded to the current directory.\n\n    maxtimeout : float\n        The maximum time in seconds to wait for the LCC-Server to respond with a\n        result before timing out. You can use the `retrieve_dataset_files`\n        function to get results later as needed.\n\n    refresh : float\n        The time to wait in seconds before pinging the LCC-Server to see if a\n        search query has completed and dataset result files can be downloaded.\n\n    Returns\n    -------\n\n    tuple\n        Returns a tuple with the following elements::\n\n            (search result status dict,\n             search result CSV file path,\n             search result LC ZIP path)", "docstring_tokens": ["This", "runs", "a", "cone", "-", "search", "query", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257207}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L1437-L1452", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Unlock a key to allow it to be modified, deleted or purged", "language": "python", "parameters": "(key_name,\n               stash,\n               passphrase,\n               backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_1", "=", "_get_stash", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "try", ":", "click", ".", "echo", "(", "'Unlocking key...'", ")", "arg_1", ".", "unlock", "(", "arg_0", "=", "arg_0", ")", "click", ".", "echo", "(", "'Key unlocked successfully'", ")", "except", "GhostError", "as", "ex", ":", "sys", ".", "exit", "(", "ex", ")"], "function": "def Func(arg_0,\n               arg_1,\n               arg_2,\n               arg_3):\n    \"\"\"Unlock a key to allow it to be modified, deleted or purged\n\n    `KEY_NAME` is the name of the key to unlock\n    \"\"\"\n    arg_1 = _get_stash(arg_3, arg_1, arg_2)\n\n    try:\n        click.echo('Unlocking key...')\n        arg_1.unlock(arg_0=arg_0)\n        click.echo('Key unlocked successfully')\n    except GhostError as ex:\n        sys.exit(ex)", "path": "ghost.py", "identifier": "unlock_key", "docstring": "Unlock a key to allow it to be modified, deleted or purged\n\n    `KEY_NAME` is the name of the key to unlock", "docstring_tokens": ["Unlock", "a", "key", "to", "allow", "it", "to", "be", "modified", "deleted", "or", "purged"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 257208}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/indexing/monitor.py#L33-L66", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "continuously monitor a folder for new abfs and try to analyze them.\n    This is intended to watch only one folder, but can run multiple copies.", "language": "python", "parameters": "(watchFolder='../abfs/',reAnalyze=False,rebuildSite=False,\n           keepGoing=True,matching=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'../abfs/'", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "True", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "[", "]", "while", "True", ":", "print", "(", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "glob", ".", "glob", "(", "arg_0", "+", "\"/*.abf\"", ")", ":", "arg_8", "=", "os", ".", "path", ".", "basename", "(", "arg_7", ")", ".", "replace", "(", "\".abf\"", ",", "\"\"", ")", "if", "not", "arg_7", "in", "arg_5", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_7", ".", "replace", "(", "\".abf\"", ",", "\".rsv\"", ")", ")", ":", "continue", "if", "arg_4", "and", "not", "arg_4", "in", "arg_7", ":", "continue", "arg_5", ".", "append", "(", "arg_7", ")", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "arg_7", ")", "+", "\"/swhlab4/\"", "+", "os", ".", "path", ".", "basename", "(", "arg_7", ")", ".", "replace", "(", "\".abf\"", ",", "\"_info.pkl\"", ")", ")", "and", "arg_1", "==", "False", ":", "print", "(", "\"already analyzed\"", ",", "os", ".", "path", ".", "basename", "(", "arg_7", ")", ")", "if", "arg_2", ":", "arg_6", ".", "append", "(", "arg_8", ")", "else", ":", "handleNewABF", "(", "arg_7", ")", "arg_6", ".", "append", "(", "arg_8", ")", "if", "len", "(", "arg_6", ")", ":", "print", "(", "\" -- rebuilding index page\"", ")", "indexing", ".", "genIndex", "(", "os", ".", "path", ".", "dirname", "(", "arg_7", ")", ",", "forceIDs", "=", "arg_6", ")", "if", "not", "arg_3", ":", "return", "for", "arg_9", "in", "range", "(", "50", ")", ":", "print", "(", "'.'", ",", "end", "=", "''", ")", "time", ".", "sleep", "(", ".2", ")"], "function": "def Func(arg_0='../abfs/',arg_1=False,arg_2=False,\n           arg_3=True,arg_4=False):\n    \"\"\"\n    continuously monitor a folder for new abfs and try to analyze them.\n    This is intended to watch only one folder, but can run multiple copies.\n    \"\"\"\n    arg_5=[]\n\n    while True:\n        print()\n        arg_6=[]\n        for arg_7 in glob.glob(arg_0+\"/*.abf\"):\n            arg_8=os.path.basename(arg_7).replace(\".abf\",\"\")\n            if not arg_7 in arg_5:\n                if os.path.exists(arg_7.replace(\".abf\",\".rsv\")): #TODO: or something like this\n                    continue\n                if arg_4 and not arg_4 in arg_7:\n                    continue\n                arg_5.append(arg_7)\n                if os.path.exists(os.path.dirname(arg_7)+\"/swhlab4/\"+os.path.basename(arg_7).replace(\".abf\",\"_info.pkl\")) and arg_1==False:\n                    print(\"already analyzed\",os.path.basename(arg_7))\n                    if arg_2:\n                        arg_6.append(arg_8)\n                else:\n                    handleNewABF(arg_7)\n                    arg_6.append(arg_8)\n        if len(arg_6):\n            print(\" -- rebuilding index page\")\n            indexing.genIndex(os.path.dirname(arg_7),forceIDs=arg_6)\n        if not arg_3:\n            return\n        for arg_9 in range(50):\n            print('.',end='')\n            time.sleep(.2)", "path": "doc/oldcode/indexing/monitor.py", "identifier": "lazygo", "docstring": "continuously monitor a folder for new abfs and try to analyze them.\n    This is intended to watch only one folder, but can run multiple copies.", "docstring_tokens": ["continuously", "monitor", "a", "folder", "for", "new", "abfs", "and", "try", "to", "analyze", "them", ".", "This", "is", "intended", "to", "watch", "only", "one", "folder", "but", "can", "run", "multiple", "copies", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 257209}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/files.py#L9-L23", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Creates a tarball from a group of files", "language": "python", "parameters": "(tar_name, file_paths, output_dir='.', prefix='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'.'", ",", "arg_3", "=", "''", ")", ":", "with", "tarfile", ".", "open", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_0", ")", ",", "'w:gz'", ")", "as", "f_out", ":", "for", "arg_4", "in", "arg_1", ":", "if", "not", "arg_4", ".", "startswith", "(", "'/'", ")", ":", "raise", "ValueError", "(", "'Path provided is relative not absolute.'", ")", "arg_5", "=", "arg_3", "+", "os", ".", "path", ".", "basename", "(", "arg_4", ")", "f_out", ".", "add", "(", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2='.', arg_3=''):\n    \"\"\"\n    Creates a tarball from a group of files\n\n    :param str tar_name: Name of tarball\n    :param list[str] file_paths: Absolute file paths to include in the tarball\n    :param str output_dir: Output destination for tarball\n    :param str prefix: Optional prefix for files in tarball\n    \"\"\"\n    with tarfile.open(os.path.join(arg_2, arg_0), 'w:gz') as f_out:\n        for arg_4 in arg_1:\n            if not arg_4.startswith('/'):\n                raise ValueError('Path provided is relative not absolute.')\n            arg_5 = arg_3 + os.path.basename(arg_4)\n            f_out.add(arg_4, arg_5=arg_5)", "path": "src/toil_lib/files.py", "identifier": "tarball_files", "docstring": "Creates a tarball from a group of files\n\n    :param str tar_name: Name of tarball\n    :param list[str] file_paths: Absolute file paths to include in the tarball\n    :param str output_dir: Output destination for tarball\n    :param str prefix: Optional prefix for files in tarball", "docstring_tokens": ["Creates", "a", "tarball", "from", "a", "group", "of", "files"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 257210}
{"url": "https://github.com/azogue/esiosdata/blob/680c7918955bc6ceee5bded92b3a4485f5ea8151/esiosdata/classdataesios.py#L63-L70", "sha": "680c7918955bc6ceee5bded92b3a4485f5ea8151", "docstring_summary": "Obtiene los dataframes de los datos de PVPC con resampling diario y mensual.", "language": "python", "parameters": "(self)", "return_statement": "return self._pvpc_mean_daily, self._pvpc_mean_monthly", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "data", "is", "not", "None", ":", "if", "arg_0", ".", "_pvpc_mean_daily", "is", "None", ":", "arg_0", ".", "_pvpc_mean_daily", "=", "arg_0", ".", "data", "[", "'data'", "]", ".", "resample", "(", "'D'", ")", ".", "mean", "(", ")", "if", "arg_0", ".", "_pvpc_mean_monthly", "is", "None", ":", "arg_0", ".", "_pvpc_mean_monthly", "=", "arg_0", ".", "data", "[", "'data'", "]", ".", "resample", "(", "'MS'", ")", ".", "mean", "(", ")", "return", "arg_0", ".", "_pvpc_mean_daily", ",", "arg_0", ".", "_pvpc_mean_monthly"], "function": "def Func(arg_0):\n        \"\"\"Obtiene los dataframes de los datos de PVPC con resampling diario y mensual.\"\"\"\n        if arg_0.data is not None:\n            if arg_0._pvpc_mean_daily is None:\n                arg_0._pvpc_mean_daily = arg_0.data['data'].resample('D').mean()\n            if arg_0._pvpc_mean_monthly is None:\n                arg_0._pvpc_mean_monthly = arg_0.data['data'].resample('MS').mean()\n        return arg_0._pvpc_mean_daily, arg_0._pvpc_mean_monthly", "path": "esiosdata/classdataesios.py", "identifier": "PVPC.get_resample_data", "docstring": "Obtiene los dataframes de los datos de PVPC con resampling diario y mensual.", "docstring_tokens": ["Obtiene", "los", "dataframes", "de", "los", "datos", "de", "PVPC", "con", "resampling", "diario", "y", "mensual", "."], "nwo": "azogue/esiosdata", "score": 0.19099661306507362, "idx": 257211}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L284-L316", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Checks if the parameter considers two values as equal.", "language": "python", "parameters": "(self, val1, val2)", "return_statement": "return comparisons.nested_equal(val1, val2)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "f_supports", "(", "arg_1", ")", "!=", "arg_0", ".", "f_supports", "(", "arg_2", ")", ":", "return", "False", "if", "not", "arg_0", ".", "f_supports", "(", "arg_1", ")", "and", "not", "arg_0", ".", "f_supports", "(", "arg_2", ")", ":", "raise", "TypeError", "(", "'I do not support the types of both inputs (`%s` and `%s`), '", "'therefore I cannot judge whether '", "'the two are equal.'", "%", "(", "str", "(", "type", "(", "arg_1", ")", ")", ",", "str", "(", "type", "(", "arg_2", ")", ")", ")", ")", "if", "not", "arg_0", ".", "_values_of_same_type", "(", "arg_1", ",", "arg_2", ")", ":", "return", "False", "return", "comparisons", ".", "nested_equal", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Checks if the parameter considers two values as equal.\n\n        This is important for the trajectory in case of merging. In case you want to delete\n        duplicate parameter points, the trajectory needs to know when two parameters\n        are equal. Since equality is not always implemented by values handled by\n        parameters in the same way, the parameters need to judge whether their values are equal.\n\n        The straightforward example here is a numpy array.\n        Checking for equality of two numpy arrays yields\n        a third numpy array containing truth values of a piecewise comparison.\n        Accordingly, the parameter could judge two numpy arrays equal if ALL of the numpy\n        array elements are equal.\n\n        In this BaseParameter class values are considered to be equal if they obey\n        the function :func:`~pypet.utils.comparisons.nested_equal`.\n        You might consider implementing a different equality comparison in your subclass.\n\n        :raises: TypeError: If both values are not supported by the parameter.\n\n        \"\"\"\n        if arg_0.f_supports(arg_1) != arg_0.f_supports(arg_2):\n            return False\n\n        if not arg_0.f_supports(arg_1) and not arg_0.f_supports(arg_2):\n            raise TypeError('I do not support the types of both inputs (`%s` and `%s`), '\n                            'therefore I cannot judge whether '\n                            'the two are equal.' % (str(type(arg_1)), str(type(arg_2))))\n\n        if not arg_0._values_of_same_type(arg_1, arg_2):\n            return False\n\n        return comparisons.nested_equal(arg_1, arg_2)", "path": "pypet/parameter.py", "identifier": "BaseParameter._equal_values", "docstring": "Checks if the parameter considers two values as equal.\n\n        This is important for the trajectory in case of merging. In case you want to delete\n        duplicate parameter points, the trajectory needs to know when two parameters\n        are equal. Since equality is not always implemented by values handled by\n        parameters in the same way, the parameters need to judge whether their values are equal.\n\n        The straightforward example here is a numpy array.\n        Checking for equality of two numpy arrays yields\n        a third numpy array containing truth values of a piecewise comparison.\n        Accordingly, the parameter could judge two numpy arrays equal if ALL of the numpy\n        array elements are equal.\n\n        In this BaseParameter class values are considered to be equal if they obey\n        the function :func:`~pypet.utils.comparisons.nested_equal`.\n        You might consider implementing a different equality comparison in your subclass.\n\n        :raises: TypeError: If both values are not supported by the parameter.", "docstring_tokens": ["Checks", "if", "the", "parameter", "considers", "two", "values", "as", "equal", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257212}
{"url": "https://github.com/foxx/peewee-extras/blob/327e7e63465b3f6e1afc0e6a651f4cb5c8c60889/peewee_extras.py#L56-L60", "sha": "327e7e63465b3f6e1afc0e6a651f4cb5c8c60889", "docstring_summary": "Disconnect from all databases", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", ":", "if", "not", "arg_2", ".", "is_closed", "(", ")", ":", "arg_2", ".", "close", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Disconnect from all databases\"\"\"\n        for arg_1, arg_2 in arg_0.items():\n            if not arg_2.is_closed():\n                arg_2.close()", "path": "peewee_extras.py", "identifier": "DatabaseManager.disconnect", "docstring": "Disconnect from all databases", "docstring_tokens": ["Disconnect", "from", "all", "databases"], "nwo": "foxx/peewee-extras", "score": 0.36327422921566166, "idx": 257213}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Firewall.py#L148-L154", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Class method that will return a Firewall object by ID.", "language": "python", "parameters": "(cls, api_token, firewall_id)", "return_statement": "return firewall", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "token", "=", "arg_1", ",", "id", "=", "arg_2", ")", "arg_3", ".", "load", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n            Class method that will return a Firewall object by ID.\n        \"\"\"\n        arg_3 = arg_0(token=arg_1, id=arg_2)\n        arg_3.load()\n        return arg_3", "path": "digitalocean/Firewall.py", "identifier": "Firewall.get_object", "docstring": "Class method that will return a Firewall object by ID.", "docstring_tokens": ["Class", "method", "that", "will", "return", "a", "Firewall", "object", "by", "ID", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 257214}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/manager.py#L146-L161", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Call all plugins, yielding each item in each non-None result.", "language": "python", "parameters": "(self, *arg, **kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "plugins", ":", "arg_5", "=", "None", "try", ":", "arg_5", "=", "arg_4", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "arg_5", "is", "not", "None", ":", "for", "arg_6", "in", "arg_5", ":", "yield", "arg_6", "except", "(", "KeyboardInterrupt", ",", "SystemExit", ")", ":", "raise", "except", ":", "arg_7", "=", "sys", ".", "exc_info", "(", ")", "yield", "Failure", "(", "*", "arg_7", ")", "continue"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Call all plugins, yielding each item in each non-None result.\n        \"\"\"\n        for arg_3, arg_4 in arg_0.plugins:\n            arg_5 = None\n            try:\n                arg_5 = arg_4(*arg_1, **arg_2)\n                if arg_5 is not None:\n                    for arg_6 in arg_5:\n                        yield arg_6\n            except (KeyboardInterrupt, SystemExit):\n                raise\n            except:\n                arg_7 = sys.exc_info()\n                yield Failure(*arg_7)\n                continue", "path": "environment/lib/python2.7/site-packages/nose/plugins/manager.py", "identifier": "PluginProxy.generate", "docstring": "Call all plugins, yielding each item in each non-None result.", "docstring_tokens": ["Call", "all", "plugins", "yielding", "each", "item", "in", "each", "non", "-", "None", "result", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257215}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L246-L263", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Run lines of code in IPythonApp.exec_lines in the user's namespace.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "exec_lines", ":", "return", "try", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Running code from IPythonApp.exec_lines...\"", ")", "for", "arg_1", "in", "arg_0", ".", "exec_lines", ":", "try", ":", "arg_0", ".", "log", ".", "info", "(", "\"Running code in user namespace: %s\"", "%", "arg_1", ")", "arg_0", ".", "shell", ".", "run_cell", "(", "arg_1", ",", "store_history", "=", "False", ")", "except", ":", "arg_0", ".", "log", ".", "warn", "(", "\"Error in executing line in user \"", "\"namespace: %s\"", "%", "arg_1", ")", "arg_0", ".", "shell", ".", "showtraceback", "(", ")", "except", ":", "arg_0", ".", "log", ".", "warn", "(", "\"Unknown error in handling IPythonApp.exec_lines:\"", ")", "arg_0", ".", "shell", ".", "showtraceback", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Run lines of code in IPythonApp.exec_lines in the user's namespace.\"\"\"\n        if not arg_0.exec_lines:\n            return\n        try:\n            arg_0.log.debug(\"Running code from IPythonApp.exec_lines...\")\n            for arg_1 in arg_0.exec_lines:\n                try:\n                    arg_0.log.info(\"Running code in user namespace: %s\" %\n                                  arg_1)\n                    arg_0.shell.run_cell(arg_1, store_history=False)\n                except:\n                    arg_0.log.warn(\"Error in executing line in user \"\n                                  \"namespace: %s\" % arg_1)\n                    arg_0.shell.showtraceback()\n        except:\n            arg_0.log.warn(\"Unknown error in handling IPythonApp.exec_lines:\")\n            arg_0.shell.showtraceback()", "path": "environment/lib/python2.7/site-packages/IPython/core/shellapp.py", "identifier": "InteractiveShellApp._run_exec_lines", "docstring": "Run lines of code in IPythonApp.exec_lines in the user's namespace.", "docstring_tokens": ["Run", "lines", "of", "code", "in", "IPythonApp", ".", "exec_lines", "in", "the", "user", "s", "namespace", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257216}
{"url": "https://github.com/honzajavorek/danube-delta/blob/d0a72f0704d52b888e7fb2b68c4fdc696d370018/danube_delta/cli/photos.py#L24-L67", "sha": "d0a72f0704d52b888e7fb2b68c4fdc696d370018", "docstring_summary": "Adds images to the last article", "language": "python", "parameters": "(context, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "obj", "header", "(", "'Looking for the latest article...'", ")", "arg_3", "=", "find_last_article", "(", "arg_2", "[", "'CONTENT_DIR'", "]", ")", "if", "not", "arg_3", ":", "return", "click", ".", "secho", "(", "'No articles.'", ",", "fg", "=", "'red'", ")", "click", ".", "echo", "(", "os", ".", "path", ".", "basename", "(", "arg_3", ")", ")", "header", "(", "'Looking for images...'", ")", "arg_4", "=", "list", "(", "sorted", "(", "find_images", "(", "arg_1", ")", ")", ")", "if", "not", "arg_4", ":", "return", "click", ".", "secho", "(", "'Found no images.'", ",", "fg", "=", "'red'", ")", "for", "arg_5", "in", "arg_4", ":", "click", ".", "secho", "(", "arg_5", ",", "fg", "=", "'green'", ")", "if", "not", "click", ".", "confirm", "(", "'\\nAdd these images to the latest article'", ")", ":", "abort", "(", "arg_2", ")", "arg_6", "=", "os", ".", "path", ".", "join", "(", "'{filename}'", ",", "IMAGES_PATH", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_2", "[", "'CONTENT_DIR'", "]", ",", "IMAGES_PATH", ")", "os", ".", "makedirs", "(", "arg_7", ",", "exist_ok", "=", "True", ")", "header", "(", "'Processing images...'", ")", "arg_8", "=", "[", "]", "for", "arg_5", "in", "arg_4", ":", "arg_9", "=", "os", ".", "path", ".", "basename", "(", "arg_5", ")", ".", "replace", "(", "' '", ",", "'-'", ")", ".", "lower", "(", ")", "arg_8", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_9", ")", ")", "arg_10", "=", "os", ".", "path", ".", "join", "(", "arg_7", ",", "arg_9", ")", "print", "(", "arg_5", ",", "arg_10", ")", "import_image", "(", "arg_5", ",", "arg_10", ")", "arg_11", "=", "'\\n'", "for", "arg_12", "in", "arg_8", ":", "arg_12", "=", "arg_12", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", "arg_11", "+=", "'\\n![image description]({})\\n'", ".", "format", "(", "arg_12", ")", "header", "(", "'Adding to article: {}'", ".", "format", "(", "arg_3", ")", ")", "with", "click", ".", "open_file", "(", "arg_3", ",", "'a'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_11", ")", "click", ".", "launch", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Adds images to the last article\"\"\"\n\n    arg_2 = arg_0.obj\n\n    header('Looking for the latest article...')\n    arg_3 = find_last_article(arg_2['CONTENT_DIR'])\n    if not arg_3:\n        return click.secho('No articles.', fg='red')\n    click.echo(os.path.basename(arg_3))\n\n    header('Looking for images...')\n    arg_4 = list(sorted(find_images(arg_1)))\n    if not arg_4:\n        return click.secho('Found no images.', fg='red')\n\n    for arg_5 in arg_4:\n        click.secho(arg_5, fg='green')\n\n    if not click.confirm('\\nAdd these images to the latest article'):\n        abort(arg_2)\n\n    arg_6 = os.path.join('{filename}', IMAGES_PATH)\n    arg_7 = os.path.join(arg_2['CONTENT_DIR'], IMAGES_PATH)\n    os.makedirs(arg_7, exist_ok=True)\n\n    header('Processing images...')\n    arg_8 = []\n    for arg_5 in arg_4:\n        arg_9 = os.path.basename(arg_5).replace(' ', '-').lower()\n        arg_8.append(os.path.join(arg_6, arg_9))\n        arg_10 = os.path.join(arg_7, arg_9)\n        print(arg_5, arg_10)\n        import_image(arg_5, arg_10)\n\n    arg_11 = '\\n'\n    for arg_12 in arg_8:\n        arg_12 = arg_12.replace('\\\\', '/')\n        arg_11 += '\\n![image description]({})\\n'.format(arg_12)\n\n    header('Adding to article: {}'.format(arg_3))\n    with click.open_file(arg_3, 'a') as f:\n        f.write(arg_11)\n    click.launch(arg_3)", "path": "danube_delta/cli/photos.py", "identifier": "photos", "docstring": "Adds images to the last article", "docstring_tokens": ["Adds", "images", "to", "the", "last", "article"], "nwo": "honzajavorek/danube-delta", "score": 0.27074237488055014, "idx": 257217}
{"url": "https://github.com/hit9/rux/blob/d7f60722658a3b83ac6d7bb3ca2790ac9c926b59/rux/config.py#L43-L56", "sha": "d7f60722658a3b83ac6d7bb3ca2790ac9c926b59", "docstring_summary": "parse config, return a dict", "language": "python", "parameters": "(self)", "return_statement": "return config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "exists", "(", "arg_0", ".", "filepath", ")", ":", "arg_1", "=", "open", "(", "arg_0", ".", "filepath", ")", ".", "read", "(", ")", ".", "decode", "(", "charset", ")", "else", ":", "arg_1", "=", "\"\"", "try", ":", "arg_2", "=", "toml", ".", "loads", "(", "arg_1", ")", "except", "toml", ".", "TomlSyntaxError", ":", "raise", "ConfigSyntaxError", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Func config, return a dict\"\"\"\n\n        if exists(arg_0.filepath):\n            arg_1 = open(arg_0.filepath).read().decode(charset)\n        else:\n            arg_1 = \"\"\n\n        try:\n            arg_2 = toml.loads(arg_1)\n        except toml.TomlSyntaxError:\n            raise ConfigSyntaxError\n\n        return arg_2", "path": "rux/config.py", "identifier": "Config.parse", "docstring": "parse config, return a dict", "docstring_tokens": ["parse", "config", "return", "a", "dict"], "nwo": "hit9/rux", "score": 0.18892572326127263, "idx": 257218}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L280-L333", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Validates Status information. Raises errors for required\n        properties.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "id", ":", "arg_1", "=", "\"No 'id' in Status for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "not", "arg_0", ".", "status", ":", "arg_1", "=", "\"No 'status' in Status for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "total_count", "is", "None", ":", "arg_1", "=", "\"No 'total_count' in Status for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "success_count", "is", "None", ":", "arg_1", "=", "\"No 'success_count' in Status for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "failure_count", "is", "None", ":", "arg_1", "=", "\"No 'failure_count' in Status for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "arg_0", ".", "pending_count", "is", "None", ":", "arg_1", "=", "\"No 'pending_count' in Status for request '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "url", ")", ")", "if", "len", "(", "arg_0", ".", "successes", ")", "!=", "arg_0", ".", "success_count", ":", "arg_1", "=", "\"Found successes={}, but success_count={} in status '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "successes", ",", "arg_0", ".", "success_count", ",", "arg_0", ".", "id", ")", ")", "if", "len", "(", "arg_0", ".", "pendings", ")", "!=", "arg_0", ".", "pending_count", ":", "arg_1", "=", "\"Found pendings={}, but pending_count={} in status '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "pendings", ",", "arg_0", ".", "pending_count", ",", "arg_0", ".", "id", ")", ")", "if", "len", "(", "arg_0", ".", "failures", ")", "!=", "arg_0", ".", "failure_count", ":", "arg_1", "=", "\"Found failures={}, but failure_count={} in status '{}'\"", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "failures", ",", "arg_0", ".", "failure_count", ",", "arg_0", ".", "id", ")", ")", "if", "(", "arg_0", ".", "success_count", "+", "arg_0", ".", "pending_count", "+", "arg_0", ".", "failure_count", "!=", "arg_0", ".", "total_count", ")", ":", "arg_1", "=", "(", "\"(success_count={} + pending_count={} + \"", "\"failure_count={}) != total_count={} in status '{}'\"", ")", "raise", "ValidationError", "(", "arg_1", ".", "format", "(", "arg_0", ".", "success_count", ",", "arg_0", ".", "pending_count", ",", "arg_0", ".", "failure_count", ",", "arg_0", ".", "total_count", ",", "arg_0", ".", "id", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Validates Status information. Raises errors for required\n        properties.\"\"\"\n        if not arg_0.id:\n            arg_1 = \"No 'id' in Status for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if not arg_0.status:\n            arg_1 = \"No 'status' in Status for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0.total_count is None:\n            arg_1 = \"No 'total_count' in Status for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0.success_count is None:\n            arg_1 = \"No 'success_count' in Status for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0.failure_count is None:\n            arg_1 = \"No 'failure_count' in Status for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if arg_0.pending_count is None:\n            arg_1 = \"No 'pending_count' in Status for request '{}'\"\n            raise ValidationError(arg_1.format(arg_0.url))\n\n        if len(arg_0.successes) != arg_0.success_count:\n            arg_1 = \"Found successes={}, but success_count={} in status '{}'\"\n            raise ValidationError(arg_1.format(arg_0.successes,\n                                             arg_0.success_count,\n                                             arg_0.id))\n\n        if len(arg_0.pendings) != arg_0.pending_count:\n            arg_1 = \"Found pendings={}, but pending_count={} in status '{}'\"\n            raise ValidationError(arg_1.format(arg_0.pendings,\n                                             arg_0.pending_count,\n                                             arg_0.id))\n\n        if len(arg_0.failures) != arg_0.failure_count:\n            arg_1 = \"Found failures={}, but failure_count={} in status '{}'\"\n            raise ValidationError(arg_1.format(arg_0.failures,\n                                             arg_0.failure_count,\n                                             arg_0.id))\n\n        if (arg_0.success_count + arg_0.pending_count + arg_0.failure_count !=\n                arg_0.total_count):\n            arg_1 = (\"(success_count={} + pending_count={} + \"\n                   \"failure_count={}) != total_count={} in status '{}'\")\n            raise ValidationError(arg_1.format(arg_0.success_count,\n                                             arg_0.pending_count,\n                                             arg_0.failure_count,\n                                             arg_0.total_count,\n                                             arg_0.id))", "path": "taxii2client/__init__.py", "identifier": "Status._validate_status", "docstring": "Validates Status information. Raises errors for required\n        properties.", "docstring_tokens": ["Validates", "Status", "information", ".", "Raises", "errors", "for", "required", "properties", "."], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 257219}
{"url": "https://github.com/jaraco/tempora/blob/f0a9ab636103fe829aa9b495c93f5249aac5f2b8/tempora/__init__.py#L484-L506", "sha": "f0a9ab636103fe829aa9b495c93f5249aac5f2b8", "docstring_summary": "Much like the built-in function range, but works with dates", "language": "python", "parameters": "(start=None, stop=None, step=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "datetime", ".", "timedelta", "(", "days", "=", "1", ")", "if", "arg_0", "is", "None", ":", "arg_0", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "while", "arg_0", "<", "arg_1", ":", "yield", "arg_0", "arg_0", "+=", "arg_2"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None):\n\t\"\"\"\n\tMuch like the built-in function range, but works with dates\n\n\t>>> range_items = Func(\n\t...     datetime.datetime(2005,12,21),\n\t...     datetime.datetime(2005,12,25),\n\t... )\n\t>>> my_range = tuple(range_items)\n\t>>> datetime.datetime(2005,12,21) in my_range\n\tTrue\n\t>>> datetime.datetime(2005,12,22) in my_range\n\tTrue\n\t>>> datetime.datetime(2005,12,25) in my_range\n\tFalse\n\t\"\"\"\n\tif arg_2 is None:\n\t\targ_2 = datetime.timedelta(days=1)\n\tif arg_0 is None:\n\t\targ_0 = datetime.datetime.now()\n\twhile arg_0 < arg_1:\n\t\tyield arg_0\n\t\targ_0 += arg_2", "path": "tempora/__init__.py", "identifier": "date_range", "docstring": "Much like the built-in function range, but works with dates\n\n\t>>> range_items = date_range(\n\t...     datetime.datetime(2005,12,21),\n\t...     datetime.datetime(2005,12,25),\n\t... )\n\t>>> my_range = tuple(range_items)\n\t>>> datetime.datetime(2005,12,21) in my_range\n\tTrue\n\t>>> datetime.datetime(2005,12,22) in my_range\n\tTrue\n\t>>> datetime.datetime(2005,12,25) in my_range\n\tFalse", "docstring_tokens": ["Much", "like", "the", "built", "-", "in", "function", "range", "but", "works", "with", "dates"], "nwo": "jaraco/tempora", "score": 0.3804160374473955, "idx": 257220}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L82-L103", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "print warn type message,\n        if file handle is `sys.stdout`, print color message", "language": "python", "parameters": "(self, message, fh=None, prefix=\"[warn]:\", suffix=\"...\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "\"[warn]:\"", ",", "arg_4", "=", "\"...\"", ")", ":", "arg_5", "=", "arg_3", "+", "arg_1", "+", "arg_4", "arg_2", "=", "arg_2", "or", "sys", ".", "stdout", "if", "arg_2", "is", "sys", ".", "stdout", ":", "termcolor", ".", "cprint", "(", "arg_5", ",", "color", "=", "\"yellow\"", ")", "else", ":", "arg_2", ".", "write", "(", "arg_5", ")", "pass"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=\"[warn]:\", arg_4=\"...\"):\n        \"\"\"\n        print warn type message,\n        if file handle is `sys.stdout`, print color message\n\n\n        :param str message: message to print\n        :param file fh: file handle,default is `sys.stdout`\n        :param str prefix: message prefix,default is `[warn]`\n        :param str suffix: message suffix ,default is `...`\n        :return: None\n        \"\"\"\n\n        arg_5 = arg_3 + arg_1 + arg_4\n        arg_2 = arg_2 or sys.stdout\n\n        if arg_2 is sys.stdout:\n            termcolor.cprint(arg_5, color=\"yellow\")\n        else:\n            arg_2.write(arg_5)\n\n        pass", "path": "cliez/component.py", "identifier": "Component.warn_message", "docstring": "print warn type message,\n        if file handle is `sys.stdout`, print color message\n\n\n        :param str message: message to print\n        :param file fh: file handle,default is `sys.stdout`\n        :param str prefix: message prefix,default is `[warn]`\n        :param str suffix: message suffix ,default is `...`\n        :return: None", "docstring_tokens": ["print", "warn", "type", "message", "if", "file", "handle", "is", "sys", ".", "stdout", "print", "color", "message"], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 257221}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/check_funcs.py#L212-L280", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Check whether a function argument is specified.", "language": "python", "parameters": "(state, name, missing_msg=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "\"Did you specify the {{part}}?\"", "if", "arg_1", "in", "[", "\"*args\"", ",", "\"**kwargs\"", "]", ":", "return", "check_part", "(", "arg_0", ",", "arg_1", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "else", ":", "if", "isinstance", "(", "arg_1", ",", "list", ")", ":", "if", "arg_1", "[", "0", "]", "==", "\"args\"", ":", "arg_3", "=", "\"{} argument passed as a variable length argument\"", ".", "format", "(", "get_ord", "(", "arg_1", "[", "1", "]", "+", "1", ")", ")", "else", ":", "arg_3", "=", "\"argument `{}`\"", ".", "format", "(", "arg_1", "[", "1", "]", ")", "else", ":", "arg_3", "=", "(", "\"{} argument\"", ".", "format", "(", "get_ord", "(", "arg_1", "+", "1", ")", ")", "if", "isinstance", "(", "arg_1", ",", "int", ")", "else", "\"argument `{}`\"", ".", "format", "(", "arg_1", ")", ")", "return", "check_part_index", "(", "arg_0", ",", "\"args\"", ",", "arg_1", ",", "arg_3", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Check whether a function argument is specified.\n\n    This function can follow ``check_function()`` in an SCT chain and verifies whether an argument is specified.\n    If you want to go on and check whether the argument was correctly specified, you can can continue chaining with\n    ``has_equal_value()`` (value-based check) or ``has_equal_ast()`` (AST-based check)\n\n    This function can also follow ``check_function_def()`` or ``check_lambda_function()`` to see if arguments have been\n    specified.\n\n    Args:\n        name (str): the name of the argument for which you want to check it is specified. This can also be\n            a number, in which case it refers to the positional arguments. Named argumetns take precedence.\n        missing_msg (str): If specified, this overrides an automatically generated feedback message in case\n            the student did specify the argument.\n        state (State): State object that is passed from the SCT Chain (don't specify this).\n\n    :Examples:\n\n        Student and solution code::\n\n            import numpy as np\n            arr = np.array([1, 2, 3, 4, 5])\n            np.mean(arr)\n\n        SCT::\n\n            # Verify whether arr was correctly set in np.mean\n            # has_equal_value() checks the value of arr, used to set argument a\n            Ex().check_function('numpy.mean').Func('a').has_equal_value()\n\n            # Verify whether arr was correctly set in np.mean\n            # has_equal_ast() checks the expression used to set argument a\n            Ex().check_function('numpy.mean').Func('a').has_equal_ast()\n\n        Student and solution code::\n\n            def my_power(x):\n                print(\"calculating sqrt...\")\n                return(x * x)\n\n        SCT::\n\n            Ex().check_function_def('my_power').multi(\n                Func('x') # will fail if student used y as arg\n                Func(0)   # will still pass if student used y as arg\n            )\n\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = \"Did you specify the {{part}}?\"\n\n    if arg_1 in [\"*args\", \"**kwargs\"]:  # for check_function_def\n        return check_part(arg_0, arg_1, arg_1, arg_2=arg_2)\n    else:\n        if isinstance(arg_1, list):  # dealing with args or kwargs\n            if arg_1[0] == \"args\":\n                arg_3 = \"{} argument passed as a variable length argument\".format(\n                    get_ord(arg_1[1] + 1)\n                )\n            else:\n                arg_3 = \"argument `{}`\".format(arg_1[1])\n        else:\n            arg_3 = (\n                \"{} argument\".format(get_ord(arg_1 + 1))\n                if isinstance(arg_1, int)\n                else \"argument `{}`\".format(arg_1)\n            )\n        return check_part_index(arg_0, \"args\", arg_1, arg_3, arg_2=arg_2)", "path": "pythonwhat/checks/check_funcs.py", "identifier": "check_args", "docstring": "Check whether a function argument is specified.\n\n    This function can follow ``check_function()`` in an SCT chain and verifies whether an argument is specified.\n    If you want to go on and check whether the argument was correctly specified, you can can continue chaining with\n    ``has_equal_value()`` (value-based check) or ``has_equal_ast()`` (AST-based check)\n\n    This function can also follow ``check_function_def()`` or ``check_lambda_function()`` to see if arguments have been\n    specified.\n\n    Args:\n        name (str): the name of the argument for which you want to check it is specified. This can also be\n            a number, in which case it refers to the positional arguments. Named argumetns take precedence.\n        missing_msg (str): If specified, this overrides an automatically generated feedback message in case\n            the student did specify the argument.\n        state (State): State object that is passed from the SCT Chain (don't specify this).\n\n    :Examples:\n\n        Student and solution code::\n\n            import numpy as np\n            arr = np.array([1, 2, 3, 4, 5])\n            np.mean(arr)\n\n        SCT::\n\n            # Verify whether arr was correctly set in np.mean\n            # has_equal_value() checks the value of arr, used to set argument a\n            Ex().check_function('numpy.mean').check_args('a').has_equal_value()\n\n            # Verify whether arr was correctly set in np.mean\n            # has_equal_ast() checks the expression used to set argument a\n            Ex().check_function('numpy.mean').check_args('a').has_equal_ast()\n\n        Student and solution code::\n\n            def my_power(x):\n                print(\"calculating sqrt...\")\n                return(x * x)\n\n        SCT::\n\n            Ex().check_function_def('my_power').multi(\n                check_args('x') # will fail if student used y as arg\n                check_args(0)   # will still pass if student used y as arg\n            )", "docstring_tokens": ["Check", "whether", "a", "function", "argument", "is", "specified", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 257222}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/fileio/parse.py#L1-L24", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Load a text file and parse the content as a list of strings.", "language": "python", "parameters": "(filename, prefix='', offset=0, max_num=0)", "return_statement": "return item_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ")", ":", "arg_4", "=", "0", "arg_5", "=", "[", "]", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "f", ":", "for", "arg_6", "in", "range", "(", "arg_2", ")", ":", "f", ".", "readline", "(", ")", "for", "arg_7", "in", "f", ":", "if", "arg_3", ">", "0", "and", "arg_4", ">=", "arg_3", ":", "break", "arg_5", ".", "append", "(", "arg_1", "+", "arg_7", ".", "rstrip", "(", "'\\n'", ")", ")", "arg_4", "+=", "1", "return", "arg_5"], "function": "def Func(arg_0, arg_1='', arg_2=0, arg_3=0):\n    \"\"\"Load a text file and parse the content as a list of strings.\n\n    Args:\n        filename (str): Filename.\n        prefix (str): The prefix to be inserted to the begining of each item.\n        offset (int): The offset of lines.\n        max_num (int): The maximum number of lines to be read,\n            zeros and negatives mean no limitation.\n\n    Returns:\n        list[str]: A list of strings.\n    \"\"\"\n    arg_4 = 0\n    arg_5 = []\n    with open(arg_0, 'r') as f:\n        for arg_6 in range(arg_2):\n            f.readline()\n        for arg_7 in f:\n            if arg_3 > 0 and arg_4 >= arg_3:\n                break\n            arg_5.append(arg_1 + arg_7.rstrip('\\n'))\n            arg_4 += 1\n    return arg_5", "path": "mmcv/fileio/parse.py", "identifier": "list_from_file", "docstring": "Load a text file and parse the content as a list of strings.\n\n    Args:\n        filename (str): Filename.\n        prefix (str): The prefix to be inserted to the begining of each item.\n        offset (int): The offset of lines.\n        max_num (int): The maximum number of lines to be read,\n            zeros and negatives mean no limitation.\n\n    Returns:\n        list[str]: A list of strings.", "docstring_tokens": ["Load", "a", "text", "file", "and", "parse", "the", "content", "as", "a", "list", "of", "strings", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 257223}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/disassemble.py#L131-L140", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Disassemble a code object.", "language": "python", "parameters": "(msg, msg_nocr, section, co, lasti=-1, start_line=-1,\n                end_line=None, relative_pos=False, highlight='light',\n                start_offset=0, end_offset=None)", "return_statement": "return disassemble_bytes(msg, msg_nocr, co.co_code, lasti, co.co_firstlineno,\n                             start_line, end_line, relative_pos,\n                        co.co_varnames, co.co_names, co.co_consts,\n                        co.co_cellvars, co.co_freevars,\n                        dict(findlinestarts(co)), highlight,\n                        start_offset=start_offset, end_offset=end_offset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "-", "1", ",", "arg_5", "=", "-", "1", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "'light'", ",", "arg_9", "=", "0", ",", "arg_10", "=", "None", ")", ":", "return", "Func_bytes", "(", "arg_0", ",", "arg_1", ",", "arg_3", ".", "co_code", ",", "arg_4", ",", "arg_3", ".", "co_firstlineno", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_3", ".", "co_varnames", ",", "arg_3", ".", "co_names", ",", "arg_3", ".", "co_consts", ",", "arg_3", ".", "co_cellvars", ",", "arg_3", ".", "co_freevars", ",", "dict", "(", "findlinestarts", "(", "arg_3", ")", ")", ",", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=-1, arg_5=-1,\n                arg_6=None, arg_7=False, arg_8='light',\n                arg_9=0, arg_10=None):\n    \"\"\"Disassemble a code object.\"\"\"\n    return Func_bytes(arg_0, arg_1, arg_3.co_code, arg_4, arg_3.co_firstlineno,\n                             arg_5, arg_6, arg_7,\n                        arg_3.co_varnames, arg_3.co_names, arg_3.co_consts,\n                        arg_3.co_cellvars, arg_3.co_freevars,\n                        dict(findlinestarts(arg_3)), arg_8,\n                        arg_9=arg_9, arg_10=arg_10)", "path": "trepan/lib/disassemble.py", "identifier": "disassemble", "docstring": "Disassemble a code object.", "docstring_tokens": ["Disassemble", "a", "code", "object", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 257224}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L765-L863", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "This method starts the thread that continuously runs to receive and interpret\n        messages coming from Firmata. This must be the last method in this file\n        It also checks the deque for messages to be sent to Firmata.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "REPORT_VERSION", ":", "[", "arg_0", ".", "report_version", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "REPORT_FIRMWARE", ":", "[", "arg_0", ".", "report_firmware", ",", "1", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "ANALOG_MESSAGE", ":", "[", "arg_0", ".", "analog_message", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "DIGITAL_MESSAGE", ":", "[", "arg_0", ".", "digital_message", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "ENCODER_DATA", ":", "[", "arg_0", ".", "encoder_data", ",", "3", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "SONAR_DATA", ":", "[", "arg_0", ".", "sonar_data", ",", "3", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "STRING_DATA", ":", "[", "arg_0", ".", "_string_data", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "I2C_REPLY", ":", "[", "arg_0", ".", "i2c_reply", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "CAPABILITY_RESPONSE", ":", "[", "arg_0", ".", "capability_response", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "PIN_STATE_RESPONSE", ":", "[", "arg_0", ".", "pin_state_response", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "ANALOG_MAPPING_RESPONSE", ":", "[", "arg_0", ".", "analog_mapping_response", ",", "2", "]", "}", ")", "arg_0", ".", "command_dispatch", ".", "update", "(", "{", "arg_0", ".", "STEPPER_DATA", ":", "[", "arg_0", ".", "stepper_version_response", ",", "2", "]", "}", ")", "while", "not", "arg_0", ".", "is_stopped", "(", ")", ":", "if", "len", "(", "arg_0", ".", "pymata", ".", "command_deque", ")", ":", "arg_1", "=", "arg_0", ".", "pymata", ".", "command_deque", ".", "popleft", "(", ")", "arg_2", "=", "[", "]", "if", "arg_1", "==", "arg_0", ".", "START_SYSEX", ":", "while", "len", "(", "arg_0", ".", "pymata", ".", "command_deque", ")", "==", "0", ":", "pass", "arg_3", "=", "arg_0", ".", "pymata", ".", "command_deque", ".", "popleft", "(", ")", "arg_4", "=", "arg_0", ".", "command_dispatch", ".", "get", "(", "arg_3", ")", "arg_5", "=", "arg_4", "[", "0", "]", "arg_6", "=", "False", "while", "not", "arg_6", ":", "while", "len", "(", "arg_0", ".", "pymata", ".", "command_deque", ")", "==", "0", ":", "pass", "arg_1", "=", "arg_0", ".", "pymata", ".", "command_deque", ".", "popleft", "(", ")", "if", "arg_1", "!=", "arg_0", ".", "END_SYSEX", ":", "arg_2", ".", "append", "(", "arg_1", ")", "else", ":", "arg_6", "=", "True", "arg_5", "(", "arg_2", ")", "continue", "elif", "0x80", "<=", "arg_1", "<=", "0xff", ":", "if", "0x90", "<=", "arg_1", "<=", "0x9f", ":", "arg_7", "=", "arg_1", "&", "0xf", "arg_2", ".", "append", "(", "arg_7", ")", "arg_1", "=", "0x90", "elif", "0xe0", "<=", "arg_1", "<=", "0xef", ":", "arg_8", "=", "arg_1", "&", "0xf", "arg_2", ".", "append", "(", "arg_8", ")", "arg_1", "=", "0xe0", "else", ":", "pass", "arg_4", "=", "arg_0", ".", "command_dispatch", ".", "get", "(", "arg_1", ")", "arg_5", "=", "arg_4", "[", "0", "]", "arg_9", "=", "arg_4", "[", "1", "]", "for", "arg_10", "in", "range", "(", "arg_9", ")", ":", "while", "len", "(", "arg_0", ".", "pymata", ".", "command_deque", ")", "==", "0", ":", "pass", "arg_1", "=", "arg_0", ".", "pymata", ".", "command_deque", ".", "popleft", "(", ")", "arg_2", ".", "append", "(", "arg_1", ")", "arg_5", "(", "arg_2", ")", "continue", "else", ":", "time", ".", "sleep", "(", ".1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        This method starts the thread that continuously Funcs to receive and interpret\n        messages coming from Firmata. This must be the last method in this file\n        It also checks the deque for messages to be sent to Firmata.\n        \"\"\"\n        # To add a command to the command dispatch table, append here.\n        arg_0.command_dispatch.update({arg_0.REPORT_VERSION: [arg_0.report_version, 2]})\n        arg_0.command_dispatch.update({arg_0.REPORT_FIRMWARE: [arg_0.report_firmware, 1]})\n        arg_0.command_dispatch.update({arg_0.ANALOG_MESSAGE: [arg_0.analog_message, 2]})\n        arg_0.command_dispatch.update({arg_0.DIGITAL_MESSAGE: [arg_0.digital_message, 2]})\n        arg_0.command_dispatch.update({arg_0.ENCODER_DATA: [arg_0.encoder_data, 3]})\n        arg_0.command_dispatch.update({arg_0.SONAR_DATA: [arg_0.sonar_data, 3]})\n        arg_0.command_dispatch.update({arg_0.STRING_DATA: [arg_0._string_data, 2]})\n        arg_0.command_dispatch.update({arg_0.I2C_REPLY: [arg_0.i2c_reply, 2]})\n        arg_0.command_dispatch.update({arg_0.CAPABILITY_RESPONSE: [arg_0.capability_response, 2]})\n        arg_0.command_dispatch.update({arg_0.PIN_STATE_RESPONSE: [arg_0.pin_state_response, 2]})\n        arg_0.command_dispatch.update({arg_0.ANALOG_MAPPING_RESPONSE: [arg_0.analog_mapping_response, 2]})\n        arg_0.command_dispatch.update({arg_0.STEPPER_DATA: [arg_0.stepper_version_response, 2]})\n\n        while not arg_0.is_stopped():\n            if len(arg_0.pymata.command_deque):\n                # get next byte from the deque and process it\n                arg_1 = arg_0.pymata.command_deque.popleft()\n\n                # this list will be populated with the received data for the command\n                arg_2 = []\n\n                # process sysex commands\n                if arg_1 == arg_0.START_SYSEX:\n                    # next char is the actual sysex command\n                    # wait until we can get data from the deque\n                    while len(arg_0.pymata.command_deque) == 0:\n                        pass\n                    arg_3 = arg_0.pymata.command_deque.popleft()\n                    # retrieve the associated command_dispatch entry for this command\n                    arg_4 = arg_0.command_dispatch.get(arg_3)\n\n                    # get a \"pointer\" to the method that will process this command\n                    arg_5 = arg_4[0]\n\n                    # now get the rest of the data excluding the END_SYSEX byte\n                    arg_6 = False\n                    while not arg_6:\n                        # wait for more data to arrive\n                        while len(arg_0.pymata.command_deque) == 0:\n                            pass\n                        arg_1 = arg_0.pymata.command_deque.popleft()\n                        if arg_1 != arg_0.END_SYSEX:\n                            arg_2.append(arg_1)\n                        else:\n                            arg_6 = True\n\n                            # invoke the method to process the command\n                            arg_5(arg_2)\n                            # go to the beginning of the loop to process the next command\n                    continue\n\n                # is this a command byte in the range of 0x80-0xff - these are the non-sysex messages\n\n                elif 0x80 <= arg_1 <= 0xff:\n                    # look up the method for the command in the command dispatch table\n                    # for the digital reporting the command value is modified with port number\n                    # the handler needs the port to properly process, so decode that from the command and\n                    # place in command_data\n                    if 0x90 <= arg_1 <= 0x9f:\n                        arg_7 = arg_1 & 0xf\n                        arg_2.append(arg_7)\n                        arg_1 = 0x90\n                    # the pin number for analog data is embedded in the command so, decode it\n                    elif 0xe0 <= arg_1 <= 0xef:\n                        arg_8 = arg_1 & 0xf\n                        arg_2.append(arg_8)\n                        arg_1 = 0xe0\n                    else:\n                        pass\n\n                    arg_4 = arg_0.command_dispatch.get(arg_1)\n\n                    # this calls the method retrieved from the dispatch table\n                    arg_5 = arg_4[0]\n\n                    # get the number of parameters that this command provides\n                    arg_9 = arg_4[1]\n\n                    # look at the number of args that the selected method requires\n                    # now get that number of bytes to pass to the called method\n                    for arg_10 in range(arg_9):\n                        while len(arg_0.pymata.command_deque) == 0:\n                            pass\n                        arg_1 = arg_0.pymata.command_deque.popleft()\n                        arg_2.append(arg_1)\n                        # go execute the command with the argument list\n                    arg_5(arg_2)\n\n                    # go to the beginning of the loop to process the next command\n                    continue\n            else:\n                time.sleep(.1)", "path": "PyMata/pymata_command_handler.py", "identifier": "PyMataCommandHandler.run", "docstring": "This method starts the thread that continuously runs to receive and interpret\n        messages coming from Firmata. This must be the last method in this file\n        It also checks the deque for messages to be sent to Firmata.", "docstring_tokens": ["This", "method", "starts", "the", "thread", "that", "continuously", "runs", "to", "receive", "and", "interpret", "messages", "coming", "from", "Firmata", ".", "This", "must", "be", "the", "last", "method", "in", "this", "file", "It", "also", "checks", "the", "deque", "for", "messages", "to", "be", "sent", "to", "Firmata", "."], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 257225}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/conservation.py#L4-L27", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse the conservation predictors", "language": "python", "parameters": "(variant)", "return_statement": "return conservations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_1", "[", "'gerp'", "]", "=", "parse_conservation", "(", "arg_0", ",", "'dbNSFP_GERP___RS'", ")", "arg_1", "[", "'phast'", "]", "=", "parse_conservation", "(", "arg_0", ",", "'dbNSFP_phastCons100way_vertebrate'", ")", "arg_1", "[", "'phylop'", "]", "=", "parse_conservation", "(", "arg_0", ",", "'dbNSFP_phyloP100way_vertebrate'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse the conservation predictors\n\n        Args:\n            variant(dict): A variant dictionary\n\n        Returns:\n            conservations(dict): A dictionary with the conservations\n    \"\"\"\n    arg_1 = {}\n\n    arg_1['gerp'] = parse_conservation(\n                                            arg_0,\n                                            'dbNSFP_GERP___RS'\n                                        )\n    arg_1['phast'] = parse_conservation(\n                                            arg_0,\n                                            'dbNSFP_phastCons100way_vertebrate'\n                                        )\n    arg_1['phylop'] = parse_conservation(\n                                            arg_0,\n                                            'dbNSFP_phyloP100way_vertebrate'\n                                        )\n    return arg_1", "path": "scout/parse/variant/conservation.py", "identifier": "parse_conservations", "docstring": "Parse the conservation predictors\n\n        Args:\n            variant(dict): A variant dictionary\n\n        Returns:\n            conservations(dict): A dictionary with the conservations", "docstring_tokens": ["Parse", "the", "conservation", "predictors"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257226}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1094-L1112", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a dictionary of formatted data understood by the storage service.", "language": "python", "parameters": "(self)", "return_statement": "return store_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_data", "is", "not", "None", ":", "arg_1", "=", "{", "'data'", ":", "ObjectTable", "(", "data", "=", "{", "'data'", ":", "[", "arg_0", ".", "_data", "]", "}", ")", "}", "if", "arg_0", ".", "f_has_range", "(", ")", ":", "arg_1", "[", "'explored_data'", "]", "=", "ObjectTable", "(", "data", "=", "{", "'data'", ":", "arg_0", ".", "_explored_range", "}", ")", "arg_0", ".", "_locked", "=", "True", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns a dictionary of formatted data understood by the storage service.\n\n        The data is put into an :class:`~pypet.parameter.ObjectTable` named 'data'.\n        If the parameter is explored, the exploration range is also put into another table\n        named 'explored_data'.\n\n        :return: Dictionary containing the data and optionally the exploration range.\n\n        \"\"\"\n        if arg_0._data is not None:\n            arg_1 = {'data': ObjectTable(data={'data': [arg_0._data]})}\n\n        if arg_0.f_has_range():\n            arg_1['explored_data'] = ObjectTable(data={'data': arg_0._explored_range})\n\n        arg_0._locked = True\n\n        return arg_1", "path": "pypet/parameter.py", "identifier": "Parameter._store", "docstring": "Returns a dictionary of formatted data understood by the storage service.\n\n        The data is put into an :class:`~pypet.parameter.ObjectTable` named 'data'.\n        If the parameter is explored, the exploration range is also put into another table\n        named 'explored_data'.\n\n        :return: Dictionary containing the data and optionally the exploration range.", "docstring_tokens": ["Returns", "a", "dictionary", "of", "formatted", "data", "understood", "by", "the", "storage", "service", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257227}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L1831-L1903", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Trim all the annotations inside the jam and return as a new `JAMS`\n        object.", "language": "python", "parameters": "(self, start_time, end_time, strict=False)", "return_statement": "return jam_trimmed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "if", "arg_0", ".", "file_metadata", ".", "duration", "is", "None", ":", "raise", "JamsError", "(", "'Duration must be set (jam.file_metadata.duration) before '", "'Funcming can be performed.'", ")", "if", "not", "(", "0", "<=", "arg_1", "<=", "arg_2", "<=", "float", "(", "arg_0", ".", "file_metadata", ".", "duration", ")", ")", ":", "raise", "ParameterError", "(", "'start_time and end_time must be within the original file '", "'duration ({:f}) and end_time cannot be smaller than '", "'start_time.'", ".", "format", "(", "float", "(", "arg_0", ".", "file_metadata", ".", "duration", ")", ")", ")", "arg_4", "=", "JAMS", "(", "arg_5", "=", "None", ",", "file_metadata", "=", "arg_0", ".", "file_metadata", ",", "sandbox", "=", "arg_0", ".", "sandbox", ")", "arg_4", ".", "annotations", "=", "arg_0", ".", "annotations", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "'Func'", "not", "in", "arg_4", ".", "sandbox", ".", "keys", "(", ")", ":", "arg_4", ".", "sandbox", ".", "update", "(", "Func", "=", "[", "{", "'start_time'", ":", "arg_1", ",", "'end_time'", ":", "arg_2", "}", "]", ")", "else", ":", "arg_4", ".", "sandbox", ".", "Func", ".", "append", "(", "{", "'start_time'", ":", "arg_1", ",", "'end_time'", ":", "arg_2", "}", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        '''\n        Trim all the annotations inside the jam and return as a new `JAMS`\n        object.\n\n        See `Annotation.Func` for details about how the annotations\n        are Funcmed.\n\n        This operation is also documented in the jam-level sandbox\n        with a list keyed by ``JAMS.sandbox.Func`` containing a tuple for each\n        jam-level Func of the form ``(start_time, end_time)``.\n\n        This function also copies over all of the file metadata from the\n        original jam.\n\n        Note: Funcming does not affect the duration of the jam, i.e. the value\n        of ``JAMS.file_metadata.duration`` will be the same for the original\n        and Funcmed jams.\n\n        Parameters\n        ----------\n        start_time : float\n            The desired start time for the Funcmed annotations in seconds.\n        end_time\n            The desired end time for Funcmed annotations in seconds. Must be\n            greater than ``start_time``.\n        strict : bool\n            When ``False`` (default) observations that lie at the boundaries of\n            the Funcming range (see `Annotation.Func` for details), will have\n            their time and/or duration adjusted such that only the part of the\n            observation that lies within the Func range is kept. When ``True``\n            such observations are discarded and not included in the Funcmed\n            annotation.\n\n        Returns\n        -------\n        jam_Funcmed : JAMS\n            The Funcmed jam with Funcmed annotations, returned as a new JAMS\n            object.\n\n        '''\n        # Make sure duration is set in file metadata\n        if arg_0.file_metadata.duration is None:\n            raise JamsError(\n                'Duration must be set (jam.file_metadata.duration) before '\n                'Funcming can be performed.')\n\n        # Make sure start and end times are within the file start/end times\n        if not (0 <= arg_1 <= arg_2 <= float(\n                arg_0.file_metadata.duration)):\n            raise ParameterError(\n                'start_time and end_time must be within the original file '\n                'duration ({:f}) and end_time cannot be smaller than '\n                'start_time.'.format(float(arg_0.file_metadata.duration)))\n\n        # Create a new jams\n        arg_4 = JAMS(arg_5=None,\n                           file_metadata=arg_0.file_metadata,\n                           sandbox=arg_0.sandbox)\n\n        # Func annotations\n        arg_4.annotations = arg_0.annotations.Func(\n            arg_1, arg_2, arg_3=arg_3)\n\n        # Document jam-level Func in top level sandbox\n        if 'Func' not in arg_4.sandbox.keys():\n            arg_4.sandbox.update(\n                Func=[{'start_time': arg_1, 'end_time': arg_2}])\n        else:\n            arg_4.sandbox.Func.append(\n                {'start_time': arg_1, 'end_time': arg_2})\n\n        return arg_4", "path": "jams/core.py", "identifier": "JAMS.trim", "docstring": "Trim all the annotations inside the jam and return as a new `JAMS`\n        object.\n\n        See `Annotation.trim` for details about how the annotations\n        are trimmed.\n\n        This operation is also documented in the jam-level sandbox\n        with a list keyed by ``JAMS.sandbox.trim`` containing a tuple for each\n        jam-level trim of the form ``(start_time, end_time)``.\n\n        This function also copies over all of the file metadata from the\n        original jam.\n\n        Note: trimming does not affect the duration of the jam, i.e. the value\n        of ``JAMS.file_metadata.duration`` will be the same for the original\n        and trimmed jams.\n\n        Parameters\n        ----------\n        start_time : float\n            The desired start time for the trimmed annotations in seconds.\n        end_time\n            The desired end time for trimmed annotations in seconds. Must be\n            greater than ``start_time``.\n        strict : bool\n            When ``False`` (default) observations that lie at the boundaries of\n            the trimming range (see `Annotation.trim` for details), will have\n            their time and/or duration adjusted such that only the part of the\n            observation that lies within the trim range is kept. When ``True``\n            such observations are discarded and not included in the trimmed\n            annotation.\n\n        Returns\n        -------\n        jam_trimmed : JAMS\n            The trimmed jam with trimmed annotations, returned as a new JAMS\n            object.", "docstring_tokens": ["Trim", "all", "the", "annotations", "inside", "the", "jam", "and", "return", "as", "a", "new", "JAMS", "object", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 257228}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/intervals.py#L34-L39", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Returns the distance from the point to the interval. Zero if the point lies inside the interval.", "language": "python", "parameters": "(self, p)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "start", "<=", "arg_1", "<=", "arg_0", ".", "end", ":", "return", "0", "else", ":", "return", "min", "(", "abs", "(", "arg_0", ".", "start", "-", "arg_1", ")", ",", "abs", "(", "arg_0", ".", "end", "-", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''Returns the distance from the point to the interval. Zero if the point lies inside the interval.'''\n        if arg_0.start <= arg_1 <= arg_0.end:\n            return 0\n        else:\n            return min(abs(arg_0.start - arg_1), abs(arg_0.end - arg_1))", "path": "pyfastaq/intervals.py", "identifier": "Interval.distance_to_point", "docstring": "Returns the distance from the point to the interval. Zero if the point lies inside the interval.", "docstring_tokens": ["Returns", "the", "distance", "from", "the", "point", "to", "the", "interval", ".", "Zero", "if", "the", "point", "lies", "inside", "the", "interval", "."], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 257229}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/clip.py#L10-L68", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Clip input array with a vector list.", "language": "python", "parameters": "(\n    array, array_affine, geometries, inverted=False, clip_buffer=0\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_2", ":", "arg_7", "=", "to_shape", "(", "arg_6", "[", "\"geometry\"", "]", ")", "if", "arg_7", ".", "is_empty", ":", "continue", "if", "arg_7", ".", "geom_type", "==", "\"GeometryCollection\"", ":", "arg_8", "=", "unary_union", "(", "[", "g", ".", "buffer", "(", "arg_4", ")", "for", "g", "in", "arg_7", "]", ")", "else", ":", "arg_8", "=", "arg_7", ".", "buffer", "(", "arg_4", ")", "if", "not", "arg_8", ".", "is_empty", ":", "arg_5", ".", "append", "(", "arg_8", ")", "if", "arg_5", ":", "if", "arg_0", ".", "ndim", "==", "2", ":", "return", "ma", ".", "masked_array", "(", "arg_0", ",", "geometry_mask", "(", "arg_5", ",", "arg_0", ".", "shape", ",", "arg_1", ",", "invert", "=", "arg_3", ")", ")", "elif", "arg_0", ".", "ndim", "==", "3", ":", "arg_9", "=", "geometry_mask", "(", "arg_5", ",", "(", "arg_0", ".", "shape", "[", "1", "]", ",", "arg_0", ".", "shape", "[", "2", "]", ")", ",", "arg_1", ",", "invert", "=", "arg_3", ")", "return", "ma", ".", "masked_array", "(", "arg_0", ",", "arg_9", "=", "np", ".", "stack", "(", "(", "arg_9", "for", "arg_10", "in", "arg_0", ")", ")", ")", "else", ":", "arg_11", "=", "False", "if", "arg_3", "else", "True", "return", "ma", ".", "masked_array", "(", "arg_0", ",", "arg_9", "=", "np", ".", "full", "(", "arg_0", ".", "shape", ",", "arg_11", ",", "dtype", "=", "bool", ")", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3=False, arg_4=0\n):\n    \"\"\"\n    Clip input array with a vector list.\n\n    Parameters\n    ----------\n    array : array\n        input raster data\n    array_affine : Affine\n        Affine object describing the raster's geolocation\n    geometries : iterable\n        iterable of dictionaries, where every entry has a 'geometry' and\n        'properties' key.\n    inverted : bool\n        invert clip (default: False)\n    clip_buffer : integer\n        buffer (in pixels) geometries before clipping\n\n    Returns\n    -------\n    clipped array : array\n    \"\"\"\n    # buffer input geometries and clean up\n    arg_5 = []\n    for arg_6 in arg_2:\n        arg_7 = to_shape(arg_6[\"geometry\"])\n        if arg_7.is_empty:\n            continue\n        if arg_7.geom_type == \"GeometryCollection\":\n            # for GeometryCollections apply buffer to every subgeometry\n            # and make union\n            arg_8 = unary_union([\n                g.buffer(arg_4) for g in arg_7])\n        else:\n            arg_8 = arg_7.buffer(arg_4)\n        if not arg_8.is_empty:\n            arg_5.append(arg_8)\n\n    # mask raster by buffered geometries\n    if arg_5:\n        if arg_0.ndim == 2:\n            return ma.masked_array(\n                arg_0, geometry_mask(\n                    arg_5, arg_0.shape, arg_1,\n                    invert=arg_3))\n        elif arg_0.ndim == 3:\n            arg_9 = geometry_mask(\n                arg_5, (arg_0.shape[1], arg_0.shape[2]),\n                arg_1, invert=arg_3)\n            return ma.masked_array(\n                arg_0, arg_9=np.stack((arg_9 for arg_10 in arg_0)))\n\n    # if no geometries, return unmasked array\n    else:\n        arg_11 = False if arg_3 else True\n        return ma.masked_array(\n            arg_0, arg_9=np.full(arg_0.shape, arg_11, dtype=bool))", "path": "mapchete/commons/clip.py", "identifier": "clip_array_with_vector", "docstring": "Clip input array with a vector list.\n\n    Parameters\n    ----------\n    array : array\n        input raster data\n    array_affine : Affine\n        Affine object describing the raster's geolocation\n    geometries : iterable\n        iterable of dictionaries, where every entry has a 'geometry' and\n        'properties' key.\n    inverted : bool\n        invert clip (default: False)\n    clip_buffer : integer\n        buffer (in pixels) geometries before clipping\n\n    Returns\n    -------\n    clipped array : array", "docstring_tokens": ["Clip", "input", "array", "with", "a", "vector", "list", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 257230}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L796-L814", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Handle GET request - render linked learners list and \"Link learner\" form.", "language": "python", "parameters": "(self, request, customer_uuid)", "return_statement": "return render(request, self.template, context)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_build_context", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "ManageLearnersForm", "(", "user", "=", "arg_1", ".", "user", ",", "enterprise_customer", "=", "arg_3", "[", "arg_0", ".", "ContextParameters", ".", "ENTERPRISE_CUSTOMER", "]", ")", "arg_3", ".", "update", "(", "{", "arg_0", ".", "ContextParameters", ".", "MANAGE_LEARNERS_FORM", ":", "arg_4", "}", ")", "return", "render", "(", "arg_1", ",", "arg_0", ".", "template", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Handle GET request - render linked learners list and \"Link learner\" form.\n\n        Arguments:\n            request (django.http.request.HttpRequest): Request instance\n            customer_uuid (str): Enterprise Customer UUID\n\n        Returns:\n            django.http.response.HttpResponse: HttpResponse\n        \"\"\"\n        arg_3 = arg_0._build_context(arg_1, arg_2)\n        arg_4 = ManageLearnersForm(\n            user=arg_1.user,\n            enterprise_customer=arg_3[arg_0.ContextParameters.ENTERPRISE_CUSTOMER]\n        )\n        arg_3.update({arg_0.ContextParameters.MANAGE_LEARNERS_FORM: arg_4})\n\n        return render(arg_1, arg_0.template, arg_3)", "path": "enterprise/admin/views.py", "identifier": "EnterpriseCustomerManageLearnersView.get", "docstring": "Handle GET request - render linked learners list and \"Link learner\" form.\n\n        Arguments:\n            request (django.http.request.HttpRequest): Request instance\n            customer_uuid (str): Enterprise Customer UUID\n\n        Returns:\n            django.http.response.HttpResponse: HttpResponse", "docstring_tokens": ["Handle", "GET", "request", "-", "render", "linked", "learners", "list", "and", "Link", "learner", "form", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257231}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L134-L212", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This validates if an API key for the specified LCC-Server is available.", "language": "python", "parameters": "(lcc_server)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "'.astrobase'", ",", "'lccs'", ",", "'apikey-%s'", "%", "arg_0", ".", "replace", "(", "'https://'", ",", "'https-'", ")", ".", "replace", "(", "'http://'", ",", "'http-'", ")", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "arg_3", "=", "oct", "(", "os", ".", "stat", "(", "arg_2", ")", "[", "stat", ".", "ST_MODE", "]", ")", "if", "arg_3", "==", "'0100600'", "or", "arg_3", "==", "'0o100600'", ":", "with", "open", "(", "arg_2", ")", "as", "infd", ":", "arg_4", ",", "arg_5", "=", "infd", ".", "read", "(", ")", ".", "strip", "(", "'\\n'", ")", ".", "split", "(", ")", "arg_6", "=", "datetime", ".", "now", "(", "utc", ")", "if", "sys", ".", "version_info", "[", ":", "2", "]", "<", "(", "3", ",", "7", ")", ":", "arg_7", "=", "datetime", ".", "strptime", "(", "arg_5", ".", "replace", "(", "'Z'", ",", "''", ")", ",", "'%Y-%m-%dT%H:%M:%S.%f'", ")", ".", "replace", "(", "tzinfo", "=", "utc", ")", "else", ":", "arg_7", "=", "datetime", ".", "fromisoformat", "(", "arg_5", ".", "replace", "(", "'Z'", ",", "'+00:00'", ")", ")", "if", "arg_6", ">", "arg_7", ":", "LOGERROR", "(", "'API key has expired. expiry was on: %s'", "%", "arg_5", ")", "return", "False", ",", "arg_4", ",", "arg_5", "else", ":", "return", "True", ",", "arg_4", ",", "arg_5", "else", ":", "LOGWARNING", "(", "'The API key file %s has bad permissions '", "'and is insecure, not reading it.\\n'", "'(you need to chmod 600 this file)'", "%", "arg_2", ")", "return", "False", ",", "None", ",", "None", "else", ":", "LOGWARNING", "(", "'No LCC-Server API key '", "'found in: {apikeyfile}'", ".", "format", "(", "apikeyfile", "=", "arg_2", ")", ")", "return", "False", ",", "None", ",", "None"], "function": "def Func(arg_0):\n    '''This validates if an API key for the specified LCC-Server is available.\n\n    API keys are stored using the following file scheme::\n\n        ~/.astrobase/lccs/apikey-domain.of.lccserver.org\n\n    e.g. for the HAT LCC-Server at https://data.hatsurveys.org::\n\n        ~/.astrobase/lccs/apikey-https-data.hatsurveys.org\n\n    Parameters\n    ----------\n\n    lcc_server : str\n        The base URL of the LCC-Server for which the existence of API keys will\n        be checked.\n\n    Returns\n    -------\n\n    (apikey_ok, apikey_str, expiry) : tuple\n        The returned tuple contains the status of the API key, the API key\n        itself if present, and its expiry date if present.\n\n    '''\n\n    arg_1 = os.path.expanduser('~')\n    arg_2 = os.path.join(arg_1,\n                              '.astrobase',\n                              'lccs',\n                              'apikey-%s' % arg_0.replace(\n                                  'https://',\n                                  'https-'\n                              ).replace(\n                                  'http://',\n                                  'http-'\n                              ))\n\n    if os.path.exists(arg_2):\n\n        # check if this file is readable/writeable by user only\n        arg_3 = oct(os.stat(arg_2)[stat.ST_MODE])\n\n        if arg_3 == '0100600' or arg_3 == '0o100600':\n\n            with open(arg_2) as infd:\n                arg_4, arg_5 = infd.read().strip('\\n').split()\n\n            # get today's datetime\n            arg_6 = datetime.now(utc)\n\n            if sys.version_info[:2] < (3,7):\n                # this hideous incantation is required for lesser Pythons\n                arg_7 = datetime.strptime(\n                    arg_5.replace('Z',''),\n                    '%Y-%m-%dT%H:%M:%S.%f'\n                ).replace(tzinfo=utc)\n            else:\n                arg_7 = datetime.fromisoformat(arg_5.replace('Z','+00:00'))\n\n            if arg_6 > arg_7:\n                LOGERROR('API key has expired. expiry was on: %s' % arg_5)\n                return False, arg_4, arg_5\n            else:\n                return True, arg_4, arg_5\n\n        else:\n            LOGWARNING('The API key file %s has bad permissions '\n                       'and is insecure, not reading it.\\n'\n                       '(you need to chmod 600 this file)'\n                       % arg_2)\n\n            return False, None, None\n    else:\n        LOGWARNING('No LCC-Server API key '\n                   'found in: {apikeyfile}'.format(apikeyfile=arg_2))\n\n        return False, None, None", "path": "astrobase/services/lccs.py", "identifier": "check_existing_apikey", "docstring": "This validates if an API key for the specified LCC-Server is available.\n\n    API keys are stored using the following file scheme::\n\n        ~/.astrobase/lccs/apikey-domain.of.lccserver.org\n\n    e.g. for the HAT LCC-Server at https://data.hatsurveys.org::\n\n        ~/.astrobase/lccs/apikey-https-data.hatsurveys.org\n\n    Parameters\n    ----------\n\n    lcc_server : str\n        The base URL of the LCC-Server for which the existence of API keys will\n        be checked.\n\n    Returns\n    -------\n\n    (apikey_ok, apikey_str, expiry) : tuple\n        The returned tuple contains the status of the API key, the API key\n        itself if present, and its expiry date if present.", "docstring_tokens": ["This", "validates", "if", "an", "API", "key", "for", "the", "specified", "LCC", "-", "Server", "is", "available", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257232}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L476-L480", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return global iterator with last iteration number", "language": "python", "parameters": "(self)", "return_statement": "return self.indices_to_global_iterator({\n            symbol_pos_int(var_name): end-1 for var_name, start, end, incr in self._loop_stack\n        })", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "indices_to_global_iterator", "(", "{", "symbol_pos_int", "(", "arg_1", ")", ":", "arg_3", "-", "1", "for", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_loop_stack", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"Return global iterator with last iteration number\"\"\"\n        return arg_0.indices_to_global_iterator({\n            symbol_pos_int(arg_1): arg_3-1 for arg_1, arg_2, arg_3, arg_4 in arg_0._loop_stack\n        })", "path": "kerncraft/kernel.py", "identifier": "Kernel.max_global_iteration", "docstring": "Return global iterator with last iteration number", "docstring_tokens": ["Return", "global", "iterator", "with", "last", "iteration", "number"], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 257233}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/resource/dataset.py#L302-L334", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Migrate the data from this dataset to a target dataset.", "language": "python", "parameters": "(self, target, follow=True, **kwargs)", "return_statement": "return migration", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "**", "arg_3", ")", ":", "if", "'id'", "not", "in", "arg_0", "or", "not", "arg_0", "[", "'id'", "]", ":", "raise", "Exception", "(", "'No source dataset ID found. '", "'Please instantiate the Dataset '", "'object with an ID.'", ")", "if", "isinstance", "(", "arg_1", ",", "Dataset", ")", ":", "arg_4", "=", "arg_1", ".", "id", "else", ":", "arg_4", "=", "arg_1", "arg_5", "=", "DatasetMigration", ".", "create", "(", "source_id", "=", "arg_0", "[", "'id'", "]", ",", "arg_4", "=", "arg_4", ",", "**", "arg_3", ")", "if", "arg_2", ":", "arg_5", ".", "follow", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True, **arg_3):\n        \"\"\"\n        Migrate the data from this dataset to a target dataset.\n\n        Valid optional kwargs include:\n\n        * source_params\n        * target_fields\n        * include_errors\n        * commit_mode\n\n        \"\"\"\n        if 'id' not in arg_0 or not arg_0['id']:\n            raise Exception(\n                'No source dataset ID found. '\n                'Please instantiate the Dataset '\n                'object with an ID.')\n\n        # Target can be provided as a Dataset, or as an ID.\n        if isinstance(arg_1, Dataset):\n            arg_4 = arg_1.id\n        else:\n            arg_4 = arg_1\n\n        arg_5 = DatasetMigration.create(\n            source_id=arg_0['id'],\n            arg_4=arg_4,\n            **arg_3)\n\n        if arg_2:\n            arg_5.follow()\n\n        return arg_5", "path": "solvebio/resource/dataset.py", "identifier": "Dataset.migrate", "docstring": "Migrate the data from this dataset to a target dataset.\n\n        Valid optional kwargs include:\n\n        * source_params\n        * target_fields\n        * include_errors\n        * commit_mode", "docstring_tokens": ["Migrate", "the", "data", "from", "this", "dataset", "to", "a", "target", "dataset", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 257234}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L228-L233", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Returns a specific volume", "language": "python", "parameters": "(self, volume_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_data", "is", "not", "None", ":", "for", "arg_2", "in", "arg_0", ".", "_data", "[", "\"volumes\"", "]", ":", "if", "arg_2", "[", "\"id\"", "]", "==", "arg_1", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Returns a specific volume\"\"\"\r\n        if arg_0._data is not None:\r\n            for arg_2 in arg_0._data[\"volumes\"]:\r\n                if arg_2[\"id\"] == arg_1:\r\n                    return arg_2", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynoStorage._get_volume", "docstring": "Returns a specific volume", "docstring_tokens": ["Returns", "a", "specific", "volume"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 257235}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/discovery.py#L261-L276", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return the details of a single course by id - not a course run id.", "language": "python", "parameters": "(self, course_id)", "return_statement": "return self._load_data(\n            self.COURSES_ENDPOINT,\n            resource_id=course_id,\n            many=False\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "_load_data", "(", "arg_0", ".", "COURSES_ENDPOINT", ",", "resource_id", "=", "arg_1", ",", "many", "=", "False", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return the details of a single course by id - not a course run id.\n\n        Args:\n            course_id (str): The unique id for the course in question.\n\n        Returns:\n            dict: Details of the course in question.\n\n        \"\"\"\n        return arg_0._load_data(\n            arg_0.COURSES_ENDPOINT,\n            resource_id=arg_1,\n            many=False\n        )", "path": "enterprise/api_client/discovery.py", "identifier": "CourseCatalogApiClient.get_course_details", "docstring": "Return the details of a single course by id - not a course run id.\n\n        Args:\n            course_id (str): The unique id for the course in question.\n\n        Returns:\n            dict: Details of the course in question.", "docstring_tokens": ["Return", "the", "details", "of", "a", "single", "course", "by", "id", "-", "not", "a", "course", "run", "id", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257236}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L409-L453", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Enroll a single user in any number of courses using a particular course mode.", "language": "python", "parameters": "(cls, enterprise_customer, user, course_mode, *course_ids)", "return_statement": "return succeeded", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "*", "arg_4", ")", ":", "arg_5", ",", "arg_6", "=", "EnterpriseCustomerUser", ".", "objects", ".", "get_or_create", "(", "arg_1", "=", "arg_1", ",", "user_id", "=", "arg_2", ".", "id", ")", "arg_7", "=", "EnrollmentApiClient", "(", ")", "arg_8", "=", "True", "for", "arg_9", "in", "arg_4", ":", "try", ":", "arg_7", ".", "Func_in_course", "(", "arg_2", ".", "username", ",", "arg_9", ",", "arg_3", ")", "except", "HttpClientError", "as", "exc", ":", "if", "arg_0", ".", "is_user_enrolled", "(", "arg_2", ",", "arg_9", ",", "arg_3", ")", ":", "arg_8", "=", "True", "else", ":", "arg_8", "=", "False", "arg_10", "=", "'No error message provided'", "try", ":", "arg_11", "=", "json", ".", "loads", "(", "exc", ".", "content", ".", "decode", "(", ")", ")", ".", "get", "(", "'message'", ",", "arg_10", ")", "except", "ValueError", ":", "arg_11", "=", "arg_10", "logging", ".", "error", "(", "'Error while enrolling user %(user)s: %(message)s'", ",", "dict", "(", "arg_2", "=", "arg_2", ".", "username", ",", "message", "=", "arg_11", ")", ")", "if", "arg_8", ":", "arg_6", ",", "arg_12", "=", "EnterpriseCourseEnrollment", ".", "objects", ".", "get_or_create", "(", "arg_5", "=", "arg_5", ",", "arg_9", "=", "arg_9", ")", "if", "arg_12", ":", "track_enrollment", "(", "'admin-enrollment'", ",", "arg_2", ".", "id", ",", "arg_9", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, *arg_4):\n        \"\"\"\n        Enroll a single user in any number of courses using a particular course mode.\n\n        Args:\n            enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment\n            user: The user who needs to be enrolled in the course\n            course_mode: The mode with which the enrollment should be created\n            *course_ids: An iterable containing any number of course IDs to eventually enroll the user in.\n\n        Returns:\n            Boolean: Whether or not enrollment succeeded for all courses specified\n        \"\"\"\n        arg_5, arg_6 = EnterpriseCustomerUser.objects.get_or_create(\n            arg_1=arg_1,\n            user_id=arg_2.id\n        )\n        arg_7 = EnrollmentApiClient()\n        arg_8 = True\n        for arg_9 in arg_4:\n            try:\n                arg_7.Func_in_course(arg_2.username, arg_9, arg_3)\n            except HttpClientError as exc:\n                # Check if user is already enrolled then we should ignore exception\n                if arg_0.is_user_enrolled(arg_2, arg_9, arg_3):\n                    arg_8 = True\n                else:\n                    arg_8 = False\n                    arg_10 = 'No error message provided'\n                    try:\n                        arg_11 = json.loads(exc.content.decode()).get('message', arg_10)\n                    except ValueError:\n                        arg_11 = arg_10\n                    logging.error(\n                        'Error while enrolling user %(user)s: %(message)s',\n                        dict(arg_2=arg_2.username, message=arg_11)\n                    )\n            if arg_8:\n                arg_6, arg_12 = EnterpriseCourseEnrollment.objects.get_or_create(\n                    arg_5=arg_5,\n                    arg_9=arg_9\n                )\n                if arg_12:\n                    track_enrollment('admin-enrollment', arg_2.id, arg_9)\n        return arg_8", "path": "enterprise/admin/views.py", "identifier": "EnterpriseCustomerManageLearnersView.enroll_user", "docstring": "Enroll a single user in any number of courses using a particular course mode.\n\n        Args:\n            enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment\n            user: The user who needs to be enrolled in the course\n            course_mode: The mode with which the enrollment should be created\n            *course_ids: An iterable containing any number of course IDs to eventually enroll the user in.\n\n        Returns:\n            Boolean: Whether or not enrollment succeeded for all courses specified", "docstring_tokens": ["Enroll", "a", "single", "user", "in", "any", "number", "of", "courses", "using", "a", "particular", "course", "mode", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257237}
{"url": "https://github.com/dhhagan/py-opc/blob/2c8f19530fb64bf5fd4ee0d694a47850161ed8a7/opc/__init__.py#L117-L129", "sha": "2c8f19530fb64bf5fd4ee0d694a47850161ed8a7", "docstring_summary": "Returns an IEEE 754 float from an array of 4 bytes", "language": "python", "parameters": "(self, byte_array)", "return_statement": "return struct.unpack('f', struct.pack('4B', *byte_array))[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "!=", "4", ":", "return", "None", "return", "struct", ".", "unpack", "(", "'f'", ",", "struct", ".", "pack", "(", "'4B'", ",", "*", "arg_1", ")", ")", "[", "0", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns an IEEE 754 float from an array of 4 bytes\n\n        :param byte_array: Expects an array of 4 bytes\n\n        :type byte_array: array\n\n        :rtype: float\n        \"\"\"\n        if len(arg_1) != 4:\n            return None\n\n        return struct.unpack('f', struct.pack('4B', *arg_1))[0]", "path": "opc/__init__.py", "identifier": "_OPC._calculate_float", "docstring": "Returns an IEEE 754 float from an array of 4 bytes\n\n        :param byte_array: Expects an array of 4 bytes\n\n        :type byte_array: array\n\n        :rtype: float", "docstring_tokens": ["Returns", "an", "IEEE", "754", "float", "from", "an", "array", "of", "4", "bytes"], "nwo": "dhhagan/py-opc", "score": 0.2904380171157967, "idx": 257238}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L2746-L2753", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Sets byte if not below or equal.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "write", "(", "Operators", ".", "ITEBV", "(", "arg_1", ".", "size", ",", "Operators", ".", "AND", "(", "arg_0", ".", "CF", "==", "False", ",", "arg_0", ".", "ZF", "==", "False", ")", ",", "1", ",", "0", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sets byte if not below or equal.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        \"\"\"\n        arg_1.write(Operators.ITEBV(arg_1.size, Operators.AND(arg_0.CF == False, arg_0.ZF == False), 1, 0))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.SETNBE", "docstring": "Sets byte if not below or equal.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Sets", "byte", "if", "not", "below", "or", "equal", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257239}
{"url": "https://github.com/Rikanishu/static-bundle/blob/2f6458cb9d9d9049b4fd829f7d6951a45d547c68/static_bundle/utils.py#L45-L55", "sha": "2f6458cb9d9d9049b4fd829f7d6951a45d547c68", "docstring_summary": "Copy file helper method", "language": "python", "parameters": "(src, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "os", ".", "makedirs", "(", "arg_2", ")", "shutil", ".", "copy2", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Copy file helper method\n\n    :type src: str|unicode\n    :type dest: str|unicode\n    \"\"\"\n    arg_2 = os.path.dirname(arg_1)\n    if not os.path.exists(arg_2):\n        os.makedirs(arg_2)\n    shutil.copy2(arg_0, arg_1)", "path": "static_bundle/utils.py", "identifier": "copy_file", "docstring": "Copy file helper method\n\n    :type src: str|unicode\n    :type dest: str|unicode", "docstring_tokens": ["Copy", "file", "helper", "method"], "nwo": "Rikanishu/static-bundle", "score": 0.0, "idx": 257240}
{"url": "https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/check.py#L70-L77", "sha": "d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd", "docstring_summary": "Raises `InvalidEnvironmentError` when one isnt set", "language": "python", "parameters": "(*env_vars)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ":", "if", "not", "os", ".", "environ", ".", "get", "(", "arg_1", ")", ":", "arg_2", "=", "(", "'Must set {} environment variable. View docs for setting up environment at {}'", ")", ".", "format", "(", "arg_1", ",", "temple", ".", "constants", ".", "TEMPLE_DOCS_URL", ")", "raise", "temple", ".", "exceptions", ".", "InvalidEnvironmentError", "(", "arg_2", ")"], "function": "def Func(*arg_0):\n    \"\"\"Raises `InvalidEnvironmentError` when one isnt set\"\"\"\n    for arg_1 in arg_0:\n        if not os.environ.get(arg_1):\n            arg_2 = (\n                'Must set {} environment variable. View docs for setting up environment at {}'\n            ).format(arg_1, temple.constants.TEMPLE_DOCS_URL)\n            raise temple.exceptions.InvalidEnvironmentError(arg_2)", "path": "temple/check.py", "identifier": "has_env_vars", "docstring": "Raises `InvalidEnvironmentError` when one isnt set", "docstring_tokens": ["Raises", "InvalidEnvironmentError", "when", "one", "isnt", "set"], "nwo": "CloverHealth/temple", "score": 0.39091779717332914, "idx": 257241}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L341-L345", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Wildcard bits to decimal conversion.", "language": "python", "parameters": "(nm, check=False)", "return_statement": "return 0xFFFFFFFF - _dot_to_dec(nm, check=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_1", "and", "not", "is_wildcard_nm", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "'Func: invalid netmask: \"%s\"'", "%", "arg_0", ")", "return", "0xFFFFFFFF", "-", "_dot_to_dec", "(", "arg_0", ",", "arg_1", "=", "False", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"Wildcard bits to decimal conversion.\"\"\"\n    if arg_1 and not is_wildcard_nm(arg_0):\n        raise ValueError('Func: invalid netmask: \"%s\"' % arg_0)\n    return 0xFFFFFFFF - _dot_to_dec(arg_0, arg_1=False)", "path": "iplib.py", "identifier": "_wildcard_to_dec", "docstring": "Wildcard bits to decimal conversion.", "docstring_tokens": ["Wildcard", "bits", "to", "decimal", "conversion", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 257242}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L271-L277", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Converts Struct message according to Proto3 JSON Specification.", "language": "python", "parameters": "(message, unused_including_default=False)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "fields", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "_ValueMessageToJsonObject", "(", "arg_2", "[", "arg_4", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False):\n  \"\"\"Converts Struct message according to Proto3 JSON Specification.\"\"\"\n  arg_2 = arg_0.fields\n  arg_3 = {}\n  for arg_4 in arg_2:\n    arg_3[arg_4] = _ValueMessageToJsonObject(arg_2[arg_4])\n  return arg_3", "path": "typy/google/protobuf/json_format.py", "identifier": "_StructMessageToJsonObject", "docstring": "Converts Struct message according to Proto3 JSON Specification.", "docstring_tokens": ["Converts", "Struct", "message", "according", "to", "Proto3", "JSON", "Specification", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 257243}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/cli.py#L49-L98", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "New project.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "dirname", "(", "abspath", "(", "__file__", ")", ")", ",", "'project'", ")", "arg_2", "=", "arg_0", ".", "get", "(", "'<project>'", ")", "if", "not", "arg_2", ":", "logger", ".", "warning", "(", "'Project name cannot be empty.'", ")", "return", "arg_3", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_2", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", ":", "logger", ".", "warning", "(", "'Project directory already exists.'", ")", "return", "logger", ".", "info", "(", "'Start generating project files.'", ")", "_mkdir_p", "(", "arg_3", ")", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "os", ".", "walk", "(", "arg_1", ")", ":", "arg_7", "=", "arg_4", ".", "split", "(", "arg_1", ")", "[", "1", "]", ".", "lstrip", "(", "os", ".", "path", ".", "sep", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_7", ")", "if", "arg_1", "!=", "arg_4", ":", "_mkdir_p", "(", "arg_8", ")", "for", "arg_9", "in", "arg_6", ":", "if", "arg_9", "in", "[", "'development.py'", ",", "'production.py'", "]", ":", "continue", "arg_10", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_9", ")", "arg_11", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "arg_9", ")", "if", "arg_9", ".", "endswith", "(", "REWRITE_FILE_EXTS", ")", ":", "_rewrite_and_copy", "(", "arg_10", ",", "arg_11", ",", "arg_2", ")", "else", ":", "shutil", ".", "copy", "(", "arg_10", ",", "arg_11", ")", "logger", ".", "info", "(", "\"New: %s\"", "%", "arg_11", ")", "if", "arg_9", "in", "[", "'development_sample.py'", ",", "'production_sample.py'", "]", ":", "arg_11", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "\"%s.py\"", "%", "arg_9", ".", "split", "(", "'_'", ")", "[", "0", "]", ")", "_rewrite_and_copy", "(", "arg_10", ",", "arg_11", ",", "arg_2", ")", "logger", ".", "info", "(", "\"New: %s\"", "%", "arg_11", ")", "logger", ".", "info", "(", "'Finish generating project files.'", ")"], "function": "def Func(arg_0):\n    \"\"\"New project.\"\"\"\n    # Project templates path\n    arg_1 = os.path.join(dirname(abspath(__file__)), 'project')\n\n    arg_2 = arg_0.get('<project>')\n\n    if not arg_2:\n        logger.warning('Project name cannot be empty.')\n        return\n\n    # Destination project path\n    arg_3 = os.path.join(os.getcwd(), arg_2)\n\n    if os.path.isdir(arg_3):\n        logger.warning('Project directory already exists.')\n        return\n\n    logger.info('Start generating project files.')\n\n    _mkdir_p(arg_3)\n\n    for arg_4, arg_5, arg_6 in os.walk(arg_1):\n        # Build and create destination directory path\n        arg_7 = arg_4.split(arg_1)[1].lstrip(os.path.sep)\n        arg_8 = os.path.join(arg_3, arg_7)\n\n        if arg_1 != arg_4:\n            _mkdir_p(arg_8)\n\n        # Copy, rewrite and move project files\n        for arg_9 in arg_6:\n            if arg_9 in ['development.py', 'production.py']:\n                continue\n\n            arg_10 = os.path.join(arg_4, arg_9)\n            arg_11 = os.path.join(arg_8, arg_9)\n\n            if arg_9.endswith(REWRITE_FILE_EXTS):\n                _rewrite_and_copy(arg_10, arg_11, arg_2)\n            else:\n                shutil.copy(arg_10, arg_11)\n            logger.info(\"New: %s\" % arg_11)\n\n            if arg_9 in ['development_sample.py', 'production_sample.py']:\n                arg_11 = os.path.join(arg_8, \"%s.py\" % arg_9.split('_')[0])\n                _rewrite_and_copy(arg_10, arg_11, arg_2)\n                logger.info(\"New: %s\" % arg_11)\n\n    logger.info('Finish generating project files.')", "path": "flask_boost/cli.py", "identifier": "generate_project", "docstring": "New project.", "docstring_tokens": ["New", "project", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 257244}
{"url": "https://github.com/jedp/python-redis-log/blob/3fc81a43423adf289a7ec985f282a8a40341fc87/redislog/logger.py#L15-L50", "sha": "3fc81a43423adf289a7ec985f282a8a40341fc87", "docstring_summary": "Utility function for the RedisLogRecord.", "language": "python", "parameters": "()", "return_statement": "return modname, funcname, lineno", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "inspect", ".", "stack", "(", ")", "if", "len", "(", "arg_0", ")", ">", "4", ":", "arg_1", "=", "arg_0", "[", "5", "]", "else", ":", "arg_1", "=", "arg_0", "[", "0", "]", "arg_2", "=", "arg_1", "[", "1", "]", "arg_3", "=", "arg_1", "[", "2", "]", "if", "arg_1", "[", "3", "]", ":", "arg_4", "=", "arg_1", "[", "3", "]", "else", ":", "arg_4", "=", "\"\"", "del", "arg_1", "del", "arg_0", "return", "arg_2", ",", "arg_4", ",", "arg_3"], "function": "def Func():\n    \"\"\"\n    Utility function for the RedisLogRecord.\n\n    Returns the module, function, and lineno of the function \n    that called the logger.  \n \n    We look way up in the stack.  The stack at this point is:\n    [0] logger.py Func (hey, that's me!)\n    [1] logger.py __init__\n    [2] logger.py makeRecord\n    [3] _log\n    [4] <logging method>\n    [5] caller of logging method\n    \"\"\"\n    arg_0 = inspect.stack()\n\n    if len(arg_0) > 4:\n        arg_1 = arg_0[5]\n    else:\n        arg_1 = arg_0[0]\n\n    arg_2 = arg_1[1]\n    arg_3 = arg_1[2]\n\n    if arg_1[3]:\n        arg_4 = arg_1[3]\n    else:\n        arg_4 = \"\"\n        \n    # python docs say you don't want references to\n    # frames lying around.  Bad things can happen.\n    del arg_1\n    del arg_0\n\n    return arg_2, arg_4, arg_3", "path": "redislog/logger.py", "identifier": "_getCallingContext", "docstring": "Utility function for the RedisLogRecord.\n\n    Returns the module, function, and lineno of the function \n    that called the logger.  \n \n    We look way up in the stack.  The stack at this point is:\n    [0] logger.py _getCallingContext (hey, that's me!)\n    [1] logger.py __init__\n    [2] logger.py makeRecord\n    [3] _log\n    [4] <logging method>\n    [5] caller of logging method", "docstring_tokens": ["Utility", "function", "for", "the", "RedisLogRecord", "."], "nwo": "jedp/python-redis-log", "score": 0.31646955184280007, "idx": 257245}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/queues/queue_servers.py#L683-L757", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "This method simulates the queue forward for a specified\n        amount of simulation time, or for a specific number of\n        events.", "language": "python", "parameters": "(self, n=1, t=None, nA=None, nD=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_2", "is", "None", "and", "arg_4", "is", "None", "and", "arg_3", "is", "None", ":", "for", "arg_5", "in", "range", "(", "arg_1", ")", ":", "arg_0", ".", "next_event", "(", ")", "elif", "arg_2", "is", "not", "None", ":", "arg_6", "=", "arg_0", ".", "_current_t", "+", "arg_2", "while", "arg_0", ".", "_current_t", "<", "arg_6", "and", "arg_0", ".", "_time", "<", "infty", ":", "arg_0", ".", "next_event", "(", ")", "elif", "arg_4", "is", "not", "None", ":", "arg_7", "=", "arg_0", ".", "num_departures", "+", "arg_4", "while", "arg_0", ".", "num_departures", "<", "arg_7", "and", "arg_0", ".", "_time", "<", "infty", ":", "arg_0", ".", "next_event", "(", ")", "elif", "arg_3", "is", "not", "None", ":", "arg_8", "=", "arg_0", ".", "_oArrivals", "+", "arg_3", "while", "arg_0", ".", "_oArrivals", "<", "arg_8", "and", "arg_0", ".", "_time", "<", "infty", ":", "arg_0", ".", "next_event", "(", ")"], "function": "def Func(arg_0, arg_1=1, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"This method Funcs the queue forward for a specified\n        amount of simulation time, or for a specific number of\n        events.\n\n        Parameters\n        ----------\n        n : int (optional, default: ``1``)\n            The number of events to Func. If ``t``, ``nA``, and\n            ``nD`` are not given then this parameter is used.\n        t : float (optional)\n            The minimum amount of simulation time to Func forward.\n        nA : int (optional)\n            Simulate until ``nA`` additional arrivals are observed.\n        nD : int (optional)\n            Simulate until ``nD`` additional departures are observed.\n\n        Examples\n        --------\n        Before any simulations can take place the ``QueueServer`` must\n        be activated:\n\n        >>> import queueing_tool as qt\n        >>> import numpy as np\n        >>> rate = lambda t: 2 + 16 * np.sin(np.pi * t / 8)**2\n        >>> arr = lambda t: qt.poisson_random_measure(t, rate, 18)\n        >>> ser = lambda t: t + np.random.gamma(4, 0.1)\n        >>> q = qt.QueueServer(5, arrival_f=arr, service_f=ser, seed=54)\n        >>> q.set_active()\n\n        To Func 50000 events do the following:\n\n        >>> q.Func(50000)\n        >>> num_events = q.num_arrivals[0] + q.num_departures\n        >>> num_events\n        50000\n\n        To Func forward 75 time units, do the following:\n\n        >>> t0 = q.time\n        >>> q.Func(t=75)\n        >>> round(float(q.time - t0), 1)\n        75.1\n        >>> q.num_arrivals[1] + q.num_departures - num_events\n        1597\n\n        To Func forward until 1000 new departures are observed run:\n\n        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures\n        >>> q.Func(nD=1000)\n        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0\n        (1000, 983)\n\n        To Func until 1000 new arrivals are observed run:\n\n        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures\n        >>> q.Func(nA=1000)\n        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0,\n        (987, 1000)\n        \"\"\"\n        if arg_2 is None and arg_4 is None and arg_3 is None:\n            for arg_5 in range(arg_1):\n                arg_0.next_event()\n        elif arg_2 is not None:\n            arg_6 = arg_0._current_t + arg_2\n            while arg_0._current_t < arg_6 and arg_0._time < infty:\n                arg_0.next_event()\n        elif arg_4 is not None:\n            arg_7 = arg_0.num_departures + arg_4\n            while arg_0.num_departures < arg_7 and arg_0._time < infty:\n                arg_0.next_event()\n        elif arg_3 is not None:\n            arg_8 = arg_0._oArrivals + arg_3\n            while arg_0._oArrivals < arg_8 and arg_0._time < infty:\n                arg_0.next_event()", "path": "queueing_tool/queues/queue_servers.py", "identifier": "QueueServer.simulate", "docstring": "This method simulates the queue forward for a specified\n        amount of simulation time, or for a specific number of\n        events.\n\n        Parameters\n        ----------\n        n : int (optional, default: ``1``)\n            The number of events to simulate. If ``t``, ``nA``, and\n            ``nD`` are not given then this parameter is used.\n        t : float (optional)\n            The minimum amount of simulation time to simulate forward.\n        nA : int (optional)\n            Simulate until ``nA`` additional arrivals are observed.\n        nD : int (optional)\n            Simulate until ``nD`` additional departures are observed.\n\n        Examples\n        --------\n        Before any simulations can take place the ``QueueServer`` must\n        be activated:\n\n        >>> import queueing_tool as qt\n        >>> import numpy as np\n        >>> rate = lambda t: 2 + 16 * np.sin(np.pi * t / 8)**2\n        >>> arr = lambda t: qt.poisson_random_measure(t, rate, 18)\n        >>> ser = lambda t: t + np.random.gamma(4, 0.1)\n        >>> q = qt.QueueServer(5, arrival_f=arr, service_f=ser, seed=54)\n        >>> q.set_active()\n\n        To simulate 50000 events do the following:\n\n        >>> q.simulate(50000)\n        >>> num_events = q.num_arrivals[0] + q.num_departures\n        >>> num_events\n        50000\n\n        To simulate forward 75 time units, do the following:\n\n        >>> t0 = q.time\n        >>> q.simulate(t=75)\n        >>> round(float(q.time - t0), 1)\n        75.1\n        >>> q.num_arrivals[1] + q.num_departures - num_events\n        1597\n\n        To simulate forward until 1000 new departures are observed run:\n\n        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures\n        >>> q.simulate(nD=1000)\n        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0\n        (1000, 983)\n\n        To simulate until 1000 new arrivals are observed run:\n\n        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures\n        >>> q.simulate(nA=1000)\n        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0,\n        (987, 1000)", "docstring_tokens": ["This", "method", "simulates", "the", "queue", "forward", "for", "a", "specified", "amount", "of", "simulation", "time", "or", "for", "a", "specific", "number", "of", "events", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 257246}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/causalr/algorithm.py#L26-L82", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Test the regulator hypothesis of the given node on the input data using the algorithm.", "language": "python", "parameters": "(graph, node_to_regulation, regulator_node)", "return_statement": "return upregulation_hypothesis, downregulation_hypothesis", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "'correct'", ":", "0", ",", "'incorrect'", ":", "0", ",", "'ambiguous'", ":", "0", "}", "arg_4", "=", "{", "'correct'", ":", "0", ",", "'incorrect'", ":", "0", ",", "'ambiguous'", ":", "0", "}", "arg_5", "=", "[", "node", "for", "node", "in", "arg_1", "if", "node", "!=", "arg_2", "]", "arg_6", "=", "run_cna", "(", "arg_0", ",", "arg_2", ",", "arg_5", ")", "for", "arg_7", ",", "arg_8", ",", "arg_9", "in", "arg_6", ":", "if", "(", "arg_9", "is", "Effect", ".", "inhibition", "or", "arg_9", "is", "Effect", ".", "activation", ")", "and", "(", "arg_9", ".", "value", "==", "arg_1", "[", "arg_8", "]", ")", ":", "arg_3", "[", "'correct'", "]", "+=", "1", "arg_4", "[", "'incorrect'", "]", "+=", "1", "elif", "arg_9", "is", "Effect", ".", "ambiguous", ":", "arg_3", "[", "'ambiguous'", "]", "+=", "1", "arg_4", "[", "'ambiguous'", "]", "+=", "1", "elif", "arg_9", "is", "Effect", ".", "no_effect", ":", "continue", "else", ":", "arg_4", "[", "'correct'", "]", "+=", "1", "arg_3", "[", "'incorrect'", "]", "+=", "1", "arg_3", "[", "'score'", "]", "=", "arg_3", "[", "'correct'", "]", "-", "arg_3", "[", "'incorrect'", "]", "arg_4", "[", "'score'", "]", "=", "arg_4", "[", "'correct'", "]", "-", "arg_4", "[", "'incorrect'", "]", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Test the regulator hypothesis of the given node on the input data using the algorithm.\n\n    Note: this method returns both +/- signed hypotheses evaluated\n\n    Algorithm:\n\n    1. Calculate the shortest path between the regulator node and each node in observed_regulation\n    2. Calculate the concordance of the causal network and the observed regulation when there is path\n       between target node and regulator node\n\n    :param networkx.DiGraph graph: A causal graph\n    :param dict node_to_regulation: Nodes to score (1,-1,0)\n    :return Dictionaries with hypothesis results (keys: score, correct, incorrect, ambiguous)\n    :rtype: dict\n    \"\"\"\n    arg_3 = {\n        'correct': 0,\n        'incorrect': 0,\n        'ambiguous': 0\n    }\n    arg_4 = {\n        'correct': 0,\n        'incorrect': 0,\n        'ambiguous': 0\n    }\n\n    arg_5 = [\n        node\n        for node in arg_1\n        if node != arg_2\n    ]\n\n    arg_6 = run_cna(arg_0, arg_2, arg_5)  # + signed hypothesis\n\n    for arg_7, arg_8, arg_9 in arg_6:\n\n        if (arg_9 is Effect.inhibition or arg_9 is Effect.activation) and (\n                arg_9.value == arg_1[arg_8]):\n            arg_3['correct'] += 1\n            arg_4['incorrect'] += 1\n\n        elif arg_9 is Effect.ambiguous:\n            arg_3['ambiguous'] += 1\n            arg_4['ambiguous'] += 1\n\n        elif arg_9 is Effect.no_effect:\n            continue\n\n        else:\n            arg_4['correct'] += 1\n            arg_3['incorrect'] += 1\n\n    arg_3['score'] = arg_3['correct'] - arg_3['incorrect']\n    arg_4['score'] = arg_4['correct'] - arg_4['incorrect']\n\n    return arg_3, arg_4", "path": "src/pybel_tools/analysis/causalr/algorithm.py", "identifier": "rank_causalr_hypothesis", "docstring": "Test the regulator hypothesis of the given node on the input data using the algorithm.\n\n    Note: this method returns both +/- signed hypotheses evaluated\n\n    Algorithm:\n\n    1. Calculate the shortest path between the regulator node and each node in observed_regulation\n    2. Calculate the concordance of the causal network and the observed regulation when there is path\n       between target node and regulator node\n\n    :param networkx.DiGraph graph: A causal graph\n    :param dict node_to_regulation: Nodes to score (1,-1,0)\n    :return Dictionaries with hypothesis results (keys: score, correct, incorrect, ambiguous)\n    :rtype: dict", "docstring_tokens": ["Test", "the", "regulator", "hypothesis", "of", "the", "given", "node", "on", "the", "input", "data", "using", "the", "algorithm", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257247}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/data.py#L87-L102", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Gets the block-size for a given token at a given resolution.", "language": "python", "parameters": "(self, token, resolution=None)", "return_statement": "return cdims[str(resolution)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "get_metadata", "(", "arg_1", ")", "[", "'dataset'", "]", "[", "'cube_dimension'", "]", "if", "arg_2", "is", "None", ":", "arg_2", "=", "min", "(", "arg_3", ".", "keys", "(", ")", ")", "return", "arg_3", "[", "str", "(", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Gets the block-size for a given token at a given resolution.\n\n        Arguments:\n            token (str): The token to inspect\n            resolution (int : None): The resolution at which to inspect data.\n                If none is specified, uses the minimum available.\n\n        Returns:\n            int[3]: The xyz blocksize.\n        \"\"\"\n        arg_3 = arg_0.get_metadata(arg_1)['dataset']['cube_dimension']\n        if arg_2 is None:\n            arg_2 = min(arg_3.keys())\n        return arg_3[str(arg_2)]", "path": "ndio/remote/data.py", "identifier": "data.get_block_size", "docstring": "Gets the block-size for a given token at a given resolution.\n\n        Arguments:\n            token (str): The token to inspect\n            resolution (int : None): The resolution at which to inspect data.\n                If none is specified, uses the minimum available.\n\n        Returns:\n            int[3]: The xyz blocksize.", "docstring_tokens": ["Gets", "the", "block", "-", "size", "for", "a", "given", "token", "at", "a", "given", "resolution", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 257248}
{"url": "https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/handlers.py#L369-L401", "sha": "7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d", "docstring_summary": "This handles either a non-repeating event chunk, or the first\n        month of a repeating event chunk.", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "starts_same_month_as", "(", "arg_0", ".", "month", ")", "and", "not", "arg_1", ".", "repeats", "(", "'NEVER'", ")", ":", "return", "arg_2", "=", "defaultdict", "(", "list", ")", "arg_3", "=", "Repeater", "(", "arg_2", ",", "arg_0", ".", "year", ",", "arg_0", ".", "month", ",", "arg_5", "=", "arg_1", ".", "l_start_date", ".", "day", ",", "end_repeat", "=", "arg_1", ".", "end_repeat", ",", "arg_1", "=", "arg_1", ",", "count_first", "=", "True", ",", "arg_4", "=", "arg_1", ".", "l_end_date", ".", "day", ",", "num", "=", "1", ")", "if", "arg_1", ".", "starts_same_month_as", "(", "arg_0", ".", "month", ")", ":", "if", "not", "arg_1", ".", "ends_same_month_as", "(", "arg_0", ".", "month", ")", ":", "arg_3", ".", "end_on", "=", "None", "else", ":", "arg_3", ".", "day", "=", "1", "arg_3", ".", "repeat", "(", ")", "for", "arg_6", ",", "arg_7", "in", "arg_3", ".", "count", ".", "items", "(", ")", ":", "arg_0", ".", "count", "[", "arg_6", "]", ".", "extend", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        This handles either a non-repeating event chunk, or the first\n        month of a repeating event chunk.\n        \"\"\"\n        if not arg_1.starts_same_month_as(arg_0.month) and not \\\n                arg_1.repeats('NEVER'):\n            # no repeating chunk events if we're not in it's start month\n            return\n\n        # add the events into an empty defaultdict. This is better than passing\n        # in self.count, which we don't want to make another copy of because it\n        # could be very large.\n        arg_2 = defaultdict(list)\n        arg_3 = Repeater(\n            arg_2, arg_0.year, arg_0.month, arg_5=arg_1.l_start_date.day,\n            end_repeat=arg_1.end_repeat, arg_1=arg_1, count_first=True,\n            arg_4=arg_1.l_end_date.day, num=1\n        )\n\n        if arg_1.starts_same_month_as(arg_0.month):\n            if not arg_1.ends_same_month_as(arg_0.month):\n                # The chunk event starts this month,\n                # but does NOT end this month\n                arg_3.end_on = None\n        else:\n            # event chunks can be maximum of 7 days, so if an event chunk\n            # didn't start this month, we know it will end this month.\n            arg_3.day = 1\n        arg_3.repeat()\n        # now we add in the events we generated to self.count\n        for arg_6, arg_7 in arg_3.count.items():\n            arg_0.count[arg_6].extend(arg_7)", "path": "happenings/utils/handlers.py", "identifier": "CountHandler._handle_single_chunk", "docstring": "This handles either a non-repeating event chunk, or the first\n        month of a repeating event chunk.", "docstring_tokens": ["This", "handles", "either", "a", "non", "-", "repeating", "event", "chunk", "or", "the", "first", "month", "of", "a", "repeating", "event", "chunk", "."], "nwo": "wreckage/django-happenings", "score": 0.41124813484918504, "idx": 257249}
{"url": "https://github.com/RediSearch/redisearch-py/blob/f65d1dd078713cbe9b83584e86655a254d0531ab/redisearch/query.py#L131-L187", "sha": "f65d1dd078713cbe9b83584e86655a254d0531ab", "docstring_summary": "Format the redis arguments for this query and return them", "language": "python", "parameters": "(self)", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_0", ".", "_query_string", "]", "if", "arg_0", ".", "_no_content", ":", "arg_1", ".", "append", "(", "'NOCONTENT'", ")", "if", "arg_0", ".", "_fields", ":", "arg_1", ".", "append", "(", "'INFIELDS'", ")", "arg_1", ".", "append", "(", "len", "(", "arg_0", ".", "_fields", ")", ")", "arg_1", "+=", "arg_0", ".", "_fields", "if", "arg_0", ".", "_verbatim", ":", "arg_1", ".", "append", "(", "'VERBATIM'", ")", "if", "arg_0", ".", "_no_stopwords", ":", "arg_1", ".", "append", "(", "'NOSTOPWORDS'", ")", "if", "arg_0", ".", "_filters", ":", "for", "arg_2", "in", "arg_0", ".", "_filters", ":", "assert", "isinstance", "(", "arg_2", ",", "Filter", ")", "arg_1", "+=", "arg_2", ".", "args", "if", "arg_0", ".", "_with_payloads", ":", "arg_1", ".", "append", "(", "'WITHPAYLOADS'", ")", "if", "arg_0", ".", "_ids", ":", "arg_1", ".", "append", "(", "'INKEYS'", ")", "arg_1", ".", "append", "(", "len", "(", "arg_0", ".", "_ids", ")", ")", "arg_1", "+=", "arg_0", ".", "_ids", "if", "arg_0", ".", "_slop", ">=", "0", ":", "arg_1", "+=", "[", "'SLOP'", ",", "arg_0", ".", "_slop", "]", "if", "arg_0", ".", "_in_order", ":", "arg_1", ".", "append", "(", "'INORDER'", ")", "if", "arg_0", ".", "_return_fields", ":", "arg_1", ".", "append", "(", "'RETURN'", ")", "arg_1", ".", "append", "(", "len", "(", "arg_0", ".", "_return_fields", ")", ")", "arg_1", "+=", "arg_0", ".", "_return_fields", "if", "arg_0", ".", "_sortby", ":", "assert", "isinstance", "(", "arg_0", ".", "_sortby", ",", "SortbyField", ")", "arg_1", ".", "append", "(", "'SORTBY'", ")", "arg_1", "+=", "arg_0", ".", "_sortby", ".", "args", "if", "arg_0", ".", "_language", ":", "arg_1", "+=", "[", "'LANGUAGE'", ",", "arg_0", ".", "_language", "]", "arg_1", "+=", "arg_0", ".", "_summarize_fields", "+", "arg_0", ".", "_highlight_fields", "arg_1", "+=", "[", "\"LIMIT\"", ",", "arg_0", ".", "_offset", ",", "arg_0", ".", "_num", "]", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Format the redis arguments for this query and return them\n        \"\"\"\n\n        arg_1 = [arg_0._query_string]\n\n        if arg_0._no_content:\n            arg_1.append('NOCONTENT')\n\n        if arg_0._fields:\n\n            arg_1.append('INFIELDS')\n            arg_1.append(len(arg_0._fields))\n            arg_1 += arg_0._fields\n        \n        if arg_0._verbatim:\n            arg_1.append('VERBATIM')\n\n        if arg_0._no_stopwords:\n            arg_1.append('NOSTOPWORDS')\n\n        if arg_0._filters:\n            for arg_2 in arg_0._filters:\n                assert isinstance(arg_2, Filter)\n                arg_1 += arg_2.args\n\n        if arg_0._with_payloads:\n            arg_1.append('WITHPAYLOADS')\n        \n        if arg_0._ids:\n            arg_1.append('INKEYS')\n            arg_1.append(len(arg_0._ids))\n            arg_1 += arg_0._ids\n\n        if arg_0._slop >= 0:\n            arg_1 += ['SLOP', arg_0._slop]\n\n        if arg_0._in_order:\n            arg_1.append('INORDER')\n\n        if arg_0._return_fields:\n            arg_1.append('RETURN')\n            arg_1.append(len(arg_0._return_fields))\n            arg_1 += arg_0._return_fields\n\n        if arg_0._sortby:\n            assert isinstance(arg_0._sortby, SortbyField)\n            arg_1.append('SORTBY')\n            arg_1 += arg_0._sortby.args\n\n        if arg_0._language:\n            arg_1 += ['LANGUAGE', arg_0._language]\n\n        arg_1 += arg_0._summarize_fields + arg_0._highlight_fields\n        arg_1 += [\"LIMIT\", arg_0._offset, arg_0._num]\n        return arg_1", "path": "redisearch/query.py", "identifier": "Query.get_args", "docstring": "Format the redis arguments for this query and return them", "docstring_tokens": ["Format", "the", "redis", "arguments", "for", "this", "query", "and", "return", "them"], "nwo": "RediSearch/redisearch-py", "score": 0.6923817122804524, "idx": 257250}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/threading.py#L147-L183", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Acquire a lock, blocking or non-blocking.", "language": "python", "parameters": "(self, blocking=1)", "return_statement": "return rc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "arg_2", "=", "_get_ident", "(", ")", "if", "arg_0", ".", "__owner", "==", "arg_2", ":", "arg_0", ".", "__count", "=", "arg_0", ".", "__count", "+", "1", "if", "__debug__", ":", "arg_0", ".", "_note", "(", "\"%s.Func(%s): recursive success\"", ",", "arg_0", ",", "arg_1", ")", "return", "1", "arg_4", "=", "arg_0", ".", "__block", ".", "Func", "(", "arg_1", ")", "if", "arg_4", ":", "arg_0", ".", "__owner", "=", "arg_2", "arg_0", ".", "__count", "=", "1", "if", "__debug__", ":", "arg_0", ".", "_note", "(", "\"%s.Func(%s): initial success\"", ",", "arg_0", ",", "arg_1", ")", "else", ":", "if", "__debug__", ":", "arg_0", ".", "_note", "(", "\"%s.Func(%s): failure\"", ",", "arg_0", ",", "arg_1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=1):\n        \"\"\"Acquire a lock, blocking or non-blocking.\n\n        When invoked without arguments: if this thread already owns the lock,\n        increment the recursion level by one, and return immediately. Otherwise,\n        if another thread owns the lock, block until the lock is unlocked. Once\n        the lock is unlocked (not owned by any thread), then grab ownership, set\n        the recursion level to one, and return. If more than one thread is\n        blocked waiting until the lock is unlocked, only one at a time will be\n        able to grab ownership of the lock. There is no return value in this\n        case.\n\n        When invoked with the blocking argument set to true, do the same thing\n        as when called without arguments, and return true.\n\n        When invoked with the blocking argument set to false, do not block. If a\n        call without an argument would block, return false immediately;\n        otherwise, do the same thing as when called without arguments, and\n        return true.\n\n        \"\"\"\n        arg_2 = _get_ident()\n        if arg_0.__owner == arg_2:\n            arg_0.__count = arg_0.__count + 1\n            if __debug__:\n                arg_0._note(\"%s.Func(%s): recursive success\", arg_0, arg_1)\n            return 1\n        arg_4 = arg_0.__block.Func(arg_1)\n        if arg_4:\n            arg_0.__owner = arg_2\n            arg_0.__count = 1\n            if __debug__:\n                arg_0._note(\"%s.Func(%s): initial success\", arg_0, arg_1)\n        else:\n            if __debug__:\n                arg_0._note(\"%s.Func(%s): failure\", arg_0, arg_1)\n        return arg_4", "path": "third_party/stdlib/threading.py", "identifier": "_RLock.acquire", "docstring": "Acquire a lock, blocking or non-blocking.\n\n        When invoked without arguments: if this thread already owns the lock,\n        increment the recursion level by one, and return immediately. Otherwise,\n        if another thread owns the lock, block until the lock is unlocked. Once\n        the lock is unlocked (not owned by any thread), then grab ownership, set\n        the recursion level to one, and return. If more than one thread is\n        blocked waiting until the lock is unlocked, only one at a time will be\n        able to grab ownership of the lock. There is no return value in this\n        case.\n\n        When invoked with the blocking argument set to true, do the same thing\n        as when called without arguments, and return true.\n\n        When invoked with the blocking argument set to false, do not block. If a\n        call without an argument would block, return false immediately;\n        otherwise, do the same thing as when called without arguments, and\n        return true.", "docstring_tokens": ["Acquire", "a", "lock", "blocking", "or", "non", "-", "blocking", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257251}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L35-L48", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Generate the delay in seconds in which the DISCOVER will be sent.", "language": "python", "parameters": "()", "return_statement": "return delay", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "float", "(", "random", ".", "randint", "(", "0", ",", "MAX_DELAY_SELECTING", ")", ")", "logger", ".", "debug", "(", "'Delay to enter in SELECTING %s.'", ",", "arg_0", ")", "logger", ".", "debug", "(", "'SELECTING will happen on %s'", ",", "future_dt_str", "(", "nowutc", "(", ")", ",", "arg_0", ")", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Generate the delay in seconds in which the DISCOVER will be sent.\n\n    [:rfc:`2131#section-4.4.1`]::\n\n        The client SHOULD wait a random time between one and ten seconds to\n        desynchronize the use of DHCP at startup.\n\n    \"\"\"\n    arg_0 = float(random.randint(0, MAX_DELAY_SELECTING))\n    logger.debug('Delay to enter in SELECTING %s.', arg_0)\n    logger.debug('SELECTING will happen on %s',\n                 future_dt_str(nowutc(), arg_0))\n    return arg_0", "path": "dhcpcanon/timers.py", "identifier": "gen_delay_selecting", "docstring": "Generate the delay in seconds in which the DISCOVER will be sent.\n\n    [:rfc:`2131#section-4.4.1`]::\n\n        The client SHOULD wait a random time between one and ten seconds to\n        desynchronize the use of DHCP at startup.", "docstring_tokens": ["Generate", "the", "delay", "in", "seconds", "in", "which", "the", "DISCOVER", "will", "be", "sent", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 257252}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/utils.py#L257-L277", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Return true if range is approximately in same order of magnitude", "language": "python", "parameters": "(x, delta=0.1)", "return_statement": "return np.floor(dmin) == np.floor(dmax)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.1", ")", ":", "arg_2", "=", "np", ".", "log10", "(", "np", ".", "min", "(", "arg_0", ")", "*", "(", "1", "-", "arg_1", ")", ")", "arg_3", "=", "np", ".", "log10", "(", "np", ".", "max", "(", "arg_0", ")", "*", "(", "1", "+", "arg_1", ")", ")", "return", "np", ".", "floor", "(", "arg_2", ")", "==", "np", ".", "floor", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=0.1):\n    \"\"\"\n    Return true if range is approximately in same order of magnitude\n\n    For example these sequences are in the same order of magnitude:\n\n        - [1, 8, 5]     # [1, 10)\n        - [35, 20, 80]  # [10 100)\n        - [232, 730]    # [100, 1000)\n\n    Parameters\n    ----------\n    x : array-like\n         Values in base 10. Must be size 2 and\n        ``rng[0] <= rng[1]``.\n    delta : float\n        Fuzz factor for approximation. It is multiplicative.\n    \"\"\"\n    arg_2 = np.log10(np.min(arg_0)*(1-arg_1))\n    arg_3 = np.log10(np.max(arg_0)*(1+arg_1))\n    return np.floor(arg_2) == np.floor(arg_3)", "path": "mizani/utils.py", "identifier": "same_log10_order_of_magnitude", "docstring": "Return true if range is approximately in same order of magnitude\n\n    For example these sequences are in the same order of magnitude:\n\n        - [1, 8, 5]     # [1, 10)\n        - [35, 20, 80]  # [10 100)\n        - [232, 730]    # [100, 1000)\n\n    Parameters\n    ----------\n    x : array-like\n         Values in base 10. Must be size 2 and\n        ``rng[0] <= rng[1]``.\n    delta : float\n        Fuzz factor for approximation. It is multiplicative.", "docstring_tokens": ["Return", "true", "if", "range", "is", "approximately", "in", "same", "order", "of", "magnitude"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 257253}
{"url": "https://github.com/macacajs/wd.py/blob/6d3c52060013e01a67cd52b68b5230b387427bad/macaca/util.py#L26-L32", "sha": "6d3c52060013e01a67cd52b68b5230b387427bad", "docstring_summary": "Implement the check_unused_args in superclass.", "language": "python", "parameters": "(self, used_args, args, kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "items", "(", ")", ":", "if", "arg_4", "in", "arg_1", ":", "arg_0", ".", "_used_kwargs", ".", "update", "(", "{", "arg_4", ":", "arg_5", "}", ")", "else", ":", "arg_0", ".", "_unused_kwargs", ".", "update", "(", "{", "arg_4", ":", "arg_5", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Implement the Func in superclass.\"\"\"\n        for arg_4, arg_5 in arg_3.items():\n            if arg_4 in arg_1:\n                arg_0._used_kwargs.update({arg_4: arg_5})\n            else:\n                arg_0._unused_kwargs.update({arg_4: arg_5})", "path": "macaca/util.py", "identifier": "MemorizeFormatter.check_unused_args", "docstring": "Implement the check_unused_args in superclass.", "docstring_tokens": ["Implement", "the", "check_unused_args", "in", "superclass", "."], "nwo": "macacajs/wd.py", "score": 0.3182350344440769, "idx": 257254}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L121-L127", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Read and return the contents of the file.", "language": "python", "parameters": "(self)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ".", "path", ")", "as", "f", ":", "arg_1", "=", "f", ".", "Func", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Read and return the contents of the file.\n        \"\"\"\n        with open(arg_0.path) as f:\n            arg_1 = f.Func()\n        return arg_1", "path": "scruffy/file.py", "identifier": "File.read", "docstring": "Read and return the contents of the file.", "docstring_tokens": ["Read", "and", "return", "the", "contents", "of", "the", "file", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 257255}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L77-L95", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Determines if a CertificateRequest message is sent from the server asking\n    the client for a certificate", "language": "python", "parameters": "(server_handshake_bytes)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "parse_tls_records", "(", "arg_0", ")", ":", "if", "arg_1", "!=", "b'\\x16'", ":", "continue", "for", "arg_4", ",", "arg_5", "in", "parse_handshake_messages", "(", "arg_3", ")", ":", "if", "arg_4", "==", "b'\\x0d'", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"\n    Determines if a CertificateRequest message is sent from the server asking\n    the client for a certificate\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        A boolean - if a client certificate request was found\n    \"\"\"\n\n    for arg_1, arg_2, arg_3 in parse_tls_records(arg_0):\n        if arg_1 != b'\\x16':\n            continue\n        for arg_4, arg_5 in parse_handshake_messages(arg_3):\n            if arg_4 == b'\\x0d':\n                return True\n    return False", "path": "oscrypto/_tls.py", "identifier": "detect_client_auth_request", "docstring": "Determines if a CertificateRequest message is sent from the server asking\n    the client for a certificate\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        A boolean - if a client certificate request was found", "docstring_tokens": ["Determines", "if", "a", "CertificateRequest", "message", "is", "sent", "from", "the", "server", "asking", "the", "client", "for", "a", "certificate"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 257256}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L1018-L1020", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Append a child element with the specified name.", "language": "python", "parameters": "(self, name)", "return_statement": "return XMLElement(lib.lsl_append_child(self.e, str.encode(name)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "XMLElement", "(", "lib", ".", "lsl_Func", "(", "arg_0", ".", "e", ",", "str", ".", "encode", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Append a child element with the specified name.\"\"\"\n        return XMLElement(lib.lsl_Func(arg_0.e, str.encode(arg_1)))", "path": "pylsl/pylsl.py", "identifier": "XMLElement.append_child", "docstring": "Append a child element with the specified name.", "docstring_tokens": ["Append", "a", "child", "element", "with", "the", "specified", "name", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 257257}
{"url": "https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/VNDB.py#L211-L233", "sha": "eba01c058100ec8806129b11a2859f3126a1b101", "docstring_summary": "This is our parsing dispatcher", "language": "python", "parameters": "(self, stype, soup)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "'v'", ":", "return", "await", "parse_vn_results", "(", "arg_2", ")", "elif", "arg_1", "==", "'r'", ":", "return", "await", "parse_release_results", "(", "arg_2", ")", "elif", "arg_1", "==", "'p'", ":", "return", "await", "parse_prod_staff_results", "(", "arg_2", ")", "elif", "arg_1", "==", "'s'", ":", "return", "await", "parse_prod_staff_results", "(", "arg_2", ")", "elif", "arg_1", "==", "'c'", ":", "return", "await", "parse_character_results", "(", "arg_2", ")", "elif", "arg_1", "==", "'g'", ":", "return", "await", "parse_tag_results", "(", "arg_2", ")", "elif", "arg_1", "==", "'i'", ":", "return", "await", "parse_tag_results", "(", "arg_2", ")", "elif", "arg_1", "==", "'u'", ":", "return", "await", "parse_user_results", "(", "arg_2", ")"], "function": "async def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        This is our parsing dispatcher\n\n        :param stype: Search type category\n        :param soup: The beautifulsoup object that contains the parsed html\n        \"\"\"\n        if arg_1 == 'v':\n            return await parse_vn_results(arg_2)\n        elif arg_1 == 'r':\n            return await parse_release_results(arg_2)\n        elif arg_1 == 'p':\n            return await parse_prod_staff_results(arg_2)\n        elif arg_1 == 's':\n            return await parse_prod_staff_results(arg_2)\n        elif arg_1 == 'c':\n            return await parse_character_results(arg_2)\n        elif arg_1 == 'g':\n            return await parse_tag_results(arg_2)\n        elif arg_1 == 'i':\n            return await parse_tag_results(arg_2)\n        elif arg_1 == 'u':\n            return await parse_user_results(arg_2)", "path": "Shosetsu/VNDB.py", "identifier": "Shosetsu.parse_search", "docstring": "This is our parsing dispatcher\n\n        :param stype: Search type category\n        :param soup: The beautifulsoup object that contains the parsed html", "docstring_tokens": ["This", "is", "our", "parsing", "dispatcher"], "nwo": "ccubed/Shosetsu", "score": 0.25890992733444657, "idx": 257258}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/consensus/base.py#L321-L327", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "either invalid or one of quorum, noquorum, quorumpossible", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_valid", ":", "return", "True", "arg_1", "=", "(", "arg_0", ".", "has_quorum", ",", "arg_0", ".", "has_quorum_possible", ",", "arg_0", ".", "has_noquorum", ")", "assert", "1", "==", "len", "(", "[", "arg_2", "for", "arg_2", "in", "arg_1", "if", "arg_2", "is", "not", "None", "]", ")", "return", "True"], "function": "def Func(arg_0):\n        \"either invalid or one of quorum, noquorum, quorumpossible\"\n        if not arg_0.is_valid:\n            return True\n        arg_1 = (arg_0.has_quorum, arg_0.has_quorum_possible, arg_0.has_noquorum)\n        assert 1 == len([arg_2 for arg_2 in arg_1 if arg_2 is not None])\n        return True", "path": "hydrachain/consensus/base.py", "identifier": "LockSet.check", "docstring": "either invalid or one of quorum, noquorum, quorumpossible", "docstring_tokens": ["either", "invalid", "or", "one", "of", "quorum", "noquorum", "quorumpossible"], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 257259}
{"url": "https://github.com/MeirKriheli/python-bidi/blob/a0e265bb465c1b7ad628487991e33b5ebe364641/bidi/__init__.py#L28-L86", "sha": "a0e265bb465c1b7ad628487991e33b5ebe364641", "docstring_summary": "Will be used to create the console script", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "optparse", "import", "arg_3", "import", "codecs", "import", "locale", "import", "six", "from", ".", "algorithm", "import", "get_display", "arg_0", "=", "optparse", ".", "OptionParser", "(", ")", "arg_0", ".", "add_option", "(", "'-e'", ",", "'--encoding'", ",", "dest", "=", "'encoding'", ",", "default", "=", "'utf-8'", ",", "type", "=", "'string'", ",", "help", "=", "'Text encoding (default: utf-8)'", ")", "arg_0", ".", "add_option", "(", "'-u'", ",", "'--upper-is-rtl'", ",", "dest", "=", "'upper_is_rtl'", ",", "default", "=", "False", ",", "action", "=", "'store_true'", ",", "help", "=", "\"Treat upper case chars as strong 'R' \"", "'for debugging (default: False).'", ")", "arg_0", ".", "add_option", "(", "'-d'", ",", "'--debug'", ",", "dest", "=", "'debug'", ",", "default", "=", "False", ",", "action", "=", "'store_true'", ",", "help", "=", "\"Output to stderr steps taken with the algorithm\"", ")", "arg_0", ".", "add_option", "(", "'-b'", ",", "'--base-dir'", ",", "dest", "=", "'base_dir'", ",", "default", "=", "None", ",", "type", "=", "'string'", ",", "help", "=", "\"Override base direction [L|R]\"", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "parse_args", "(", ")", "if", "arg_1", ".", "base_dir", "and", "arg_1", ".", "base_dir", "not", "in", "'LR'", ":", "arg_0", ".", "error", "(", "'option -b can be L or R'", ")", "if", "six", ".", "PY2", ":", "arg_3", ".", "stdout", "=", "codecs", ".", "getwriter", "(", "locale", ".", "getpreferredencoding", "(", ")", ")", "(", "arg_3", ".", "stdout", ")", "if", "arg_2", ":", "arg_5", "=", "arg_2", "else", ":", "arg_5", "=", "arg_3", ".", "stdin", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "get_display", "(", "arg_6", ",", "arg_1", ".", "encoding", ",", "arg_1", ".", "upper_is_rtl", ",", "arg_1", ".", "base_dir", ",", "arg_1", ".", "debug", ")", "if", "not", "isinstance", "(", "arg_7", ",", "six", ".", "text_type", ")", ":", "arg_7", "=", "arg_7", ".", "decode", "(", "arg_1", ".", "encoding", ")", "six", ".", "print_", "(", "arg_7", ",", "end", "=", "''", ")"], "function": "def Func():\n    \"\"\"Will be used to create the console script\"\"\"\n\n    import optparse\n    import arg_3\n    import codecs\n    import locale\n    import six\n    from .algorithm import get_display\n\n    arg_0 = optparse.OptionParser()\n\n    arg_0.add_option('-e', '--encoding',\n                      dest='encoding',\n                      default='utf-8',\n                      type='string',\n                      help='Text encoding (default: utf-8)')\n\n    arg_0.add_option('-u', '--upper-is-rtl',\n                      dest='upper_is_rtl',\n                      default=False,\n                      action='store_true',\n                      help=\"Treat upper case chars as strong 'R' \"\n                      'for debugging (default: False).')\n\n    arg_0.add_option('-d', '--debug',\n                      dest='debug',\n                      default=False,\n                      action='store_true',\n                      help=\"Output to stderr steps taken with the algorithm\")\n\n    arg_0.add_option('-b', '--base-dir',\n                      dest='base_dir',\n                      default=None,\n                      type='string',\n                      help=\"Override base direction [L|R]\")\n\n    arg_1, arg_2 = arg_0.parse_args()\n\n    if arg_1.base_dir and arg_1.base_dir not in 'LR':\n        arg_0.error('option -b can be L or R')\n\n    # allow unicode in sys.stdout.write\n    if six.PY2:\n        arg_3.stdout = codecs.getwriter(locale.getpreferredencoding())(arg_3.stdout)\n\n    if arg_2:\n        arg_5 = arg_2\n    else:\n        arg_5 = arg_3.stdin\n\n    for arg_6 in arg_5:\n        arg_7 = get_display(arg_6, arg_1.encoding, arg_1.upper_is_rtl,\n                              arg_1.base_dir, arg_1.debug)\n        # adjust the encoding as unicode, to match the output encoding\n        if not isinstance(arg_7, six.text_type):\n            arg_7 = arg_7.decode(arg_1.encoding)\n\n        six.print_(arg_7, end='')", "path": "bidi/__init__.py", "identifier": "main", "docstring": "Will be used to create the console script", "docstring_tokens": ["Will", "be", "used", "to", "create", "the", "console", "script"], "nwo": "MeirKriheli/python-bidi", "score": 0.28828505124417525, "idx": 257260}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L427-L431", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Make a digraph into an undirected graph by adding symmetric edges.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "dict", ".", "keys", "(", ")", ":", "for", "(", "arg_2", ",", "arg_3", ")", "in", "arg_0", ".", "dict", "[", "arg_1", "]", ".", "items", "(", ")", ":", "arg_0", ".", "connect1", "(", "arg_2", ",", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0):\n        \"Make a digraph into an undirected graph by adding symmetric edges.\"\n        for arg_1 in arg_0.dict.keys():\n            for (arg_2, arg_3) in arg_0.dict[arg_1].items():\n                arg_0.connect1(arg_2, arg_1, arg_3)", "path": "aima/search.py", "identifier": "Graph.make_undirected", "docstring": "Make a digraph into an undirected graph by adding symmetric edges.", "docstring_tokens": ["Make", "a", "digraph", "into", "an", "undirected", "graph", "by", "adding", "symmetric", "edges", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 257261}
{"url": "https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/datatypes.py#L79-L98", "sha": "3ff76407af0e71621dada744cd964611e998699c", "docstring_summary": "Load json or yaml data from file handle.", "language": "python", "parameters": "(cls, fh)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "read", "(", ")", "try", ":", "arg_3", "=", "arg_0", ".", "from_json", "(", "arg_2", ")", "except", ":", "arg_3", "=", "arg_0", ".", "from_yaml", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Load json or yaml data from file handle.\n\n        Args:\n            fh (file): File handle to Func from.\n\n        Examlple:\n            >>> with open('data.json', 'r') as json:\n            >>>    jsdata = composite.Func(json)\n            >>>\n            >>> with open('data.yml', 'r') as yml:\n            >>>    ymldata = composite.Func(yml)\n        \"\"\"\n        arg_2 = arg_1.read()\n        try:\n            arg_3 = arg_0.from_json(arg_2)\n        except:\n            arg_3 = arg_0.from_yaml(arg_2)\n        return arg_3", "path": "gems/datatypes.py", "identifier": "composite.load", "docstring": "Load json or yaml data from file handle.\n\n        Args:\n            fh (file): File handle to load from.\n\n        Examlple:\n            >>> with open('data.json', 'r') as json:\n            >>>    jsdata = composite.load(json)\n            >>>\n            >>> with open('data.yml', 'r') as yml:\n            >>>    ymldata = composite.load(yml)", "docstring_tokens": ["Load", "json", "or", "yaml", "data", "from", "file", "handle", "."], "nwo": "bprinty/gems", "score": 0.16246995141409282, "idx": 257262}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/examples/robots.py#L81-L111", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Takes a single character string as input and alters the game\n        state according to that input. Mostly, this means moving the\n        player around. Returns a new game state and boolean indicating\n        whether the input had an effect on the state.", "language": "python", "parameters": "(self, input)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'h'", ":", "(", "-", "1", ",", "0", ")", ",", "'j'", ":", "(", "0", ",", "1", ")", ",", "'k'", ":", "(", "0", ",", "-", "1", ")", ",", "'l'", ":", "(", "1", ",", "0", ")", ",", "'y'", ":", "(", "-", "1", ",", "-", "1", ")", ",", "'u'", ":", "(", "1", ",", "-", "1", ")", ",", "'n'", ":", "(", "1", ",", "1", ")", ",", "'b'", ":", "(", "-", "1", ",", "1", ")", ",", "}", "if", "arg_1", "in", "arg_2", ":", "arg_3", "=", "(", "lens", ".", "player", "+", "arg_2", "[", "arg_1", "]", ")", "(", "arg_0", ")", "if", "not", "arg_3", ".", "player", ".", "inside", "(", ")", ":", "return", "arg_0", ",", "False", "return", "arg_3", ",", "True", "elif", "arg_1", "==", "'.'", ":", "return", "arg_0", ",", "True", "elif", "arg_1", "==", "'q'", ":", "return", "arg_0", ".", "end_game", "(", ")", ",", "False", "elif", "arg_1", "==", "'t'", ":", "arg_0", "=", "lens", ".", "player", ".", "set", "(", "Vector", ".", "random", "(", ")", ")", "(", "arg_0", ")", "return", "arg_0", ",", "True", "else", ":", "return", "arg_0", ",", "False"], "function": "def Func(arg_0, arg_1):\n        '''Takes a single character string as input and alters the game\n        state according to that input. Mostly, this means moving the\n        player around. Returns a new game state and boolean indicating\n        whether the input had an effect on the state.'''\n\n        arg_2 = {\n            'h': (-1, 0),\n            'j': (0, 1),\n            'k': (0, -1),\n            'l': (1, 0),\n            'y': (-1, -1),\n            'u': (1, -1),\n            'n': (1, 1),\n            'b': (-1, 1),\n        }\n\n        if arg_1 in arg_2:\n            arg_3 = (lens.player + arg_2[arg_1])(arg_0)\n            if not arg_3.player.inside():\n                return arg_0, False\n            return arg_3, True\n        elif arg_1 == '.':\n            return arg_0, True\n        elif arg_1 == 'q':\n            return arg_0.end_game(), False\n        elif arg_1 == 't':\n            arg_0 = lens.player.set(Vector.random())(arg_0)\n            return arg_0, True\n        else:\n            return arg_0, False", "path": "examples/robots.py", "identifier": "GameState.handle_input", "docstring": "Takes a single character string as input and alters the game\n        state according to that input. Mostly, this means moving the\n        player around. Returns a new game state and boolean indicating\n        whether the input had an effect on the state.", "docstring_tokens": ["Takes", "a", "single", "character", "string", "as", "input", "and", "alters", "the", "game", "state", "according", "to", "that", "input", ".", "Mostly", "this", "means", "moving", "the", "player", "around", ".", "Returns", "a", "new", "game", "state", "and", "boolean", "indicating", "whether", "the", "input", "had", "an", "effect", "on", "the", "state", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 257263}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L496-L515", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup the noise-map from an root-mean square standard deviation map, which is a form of noise-map that \\\n        comes via HST image-reduction and the software package MultiDrizzle.", "language": "python", "parameters": "(cls, pixel_scale, inverse_noise_map)", "return_statement": "return NoiseMap(array=noise_map, pixel_scale=pixel_scale)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "1.0", "/", "arg_2", "return", "NoiseMap", "(", "array", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Setup the noise-map from an root-mean square standard deviation map, which is a form of noise-map that \\\n        comes via HST image-reduction and the software package MultiDrizzle.\n\n        The variance in each pixel is computed as:\n\n        Variance = 1.0 / inverse_std_map.\n\n        The weight map may contain zeros, in which cause the variances are converted to large values to omit them from \\\n        the analysis.\n\n        Parameters\n        -----------\n        pixel_scale : float\n            The size of each pixel in arc seconds.\n        inverse_noise_map : ndarray\n            The inverse noise_map value of each pixel which is converted to a variance.\n        \"\"\"\n        arg_3 = 1.0 / arg_2\n        return NoiseMap(array=arg_3, arg_1=arg_1)", "path": "autolens/data/ccd.py", "identifier": "NoiseMap.from_inverse_noise_map", "docstring": "Setup the noise-map from an root-mean square standard deviation map, which is a form of noise-map that \\\n        comes via HST image-reduction and the software package MultiDrizzle.\n\n        The variance in each pixel is computed as:\n\n        Variance = 1.0 / inverse_std_map.\n\n        The weight map may contain zeros, in which cause the variances are converted to large values to omit them from \\\n        the analysis.\n\n        Parameters\n        -----------\n        pixel_scale : float\n            The size of each pixel in arc seconds.\n        inverse_noise_map : ndarray\n            The inverse noise_map value of each pixel which is converted to a variance.", "docstring_tokens": ["Setup", "the", "noise", "-", "map", "from", "an", "root", "-", "mean", "square", "standard", "deviation", "map", "which", "is", "a", "form", "of", "noise", "-", "map", "that", "\\", "comes", "via", "HST", "image", "-", "reduction", "and", "the", "software", "package", "MultiDrizzle", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 257264}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/gen_rst.py#L335-L377", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Scales an image with the same aspect ratio centered in an\n       image with a given max_width and max_height\n       if in_fname == out_fname the image can only be scaled down", "language": "python", "parameters": "(in_fname, out_fname, max_width, max_height)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "from", "PIL", "import", "Image", "except", "ImportError", ":", "import", "Image", "arg_4", "=", "Image", ".", "open", "(", "arg_0", ")", "arg_5", ",", "arg_6", "=", "arg_4", ".", "size", "arg_7", "=", "arg_2", "/", "float", "(", "arg_5", ")", "arg_8", "=", "arg_3", "/", "float", "(", "arg_6", ")", "if", "arg_6", "*", "arg_7", "<=", "arg_3", ":", "arg_9", "=", "arg_7", "else", ":", "arg_9", "=", "arg_8", "if", "arg_9", ">=", "1.0", "and", "arg_0", "==", "arg_1", ":", "return", "arg_10", "=", "int", "(", "round", "(", "arg_9", "*", "arg_5", ")", ")", "arg_11", "=", "int", "(", "round", "(", "arg_9", "*", "arg_6", ")", ")", "arg_4", ".", "thumbnail", "(", "(", "arg_10", ",", "arg_11", ")", ",", "Image", ".", "ANTIALIAS", ")", "arg_12", "=", "Image", ".", "new", "(", "'RGB'", ",", "(", "arg_2", ",", "arg_3", ")", ",", "(", "255", ",", "255", ",", "255", ")", ")", "arg_13", "=", "(", "(", "arg_2", "-", "arg_10", ")", "//", "2", ",", "(", "arg_3", "-", "arg_11", ")", "//", "2", ")", "arg_12", ".", "paste", "(", "arg_4", ",", "arg_13", ")", "arg_12", ".", "save", "(", "arg_1", ")", "if", "os", ".", "environ", ".", "get", "(", "'SKLEARN_DOC_OPTIPNG'", ",", "False", ")", ":", "try", ":", "subprocess", ".", "call", "(", "[", "\"optipng\"", ",", "\"-quiet\"", ",", "\"-o\"", ",", "\"9\"", ",", "arg_1", "]", ")", "except", "Exception", ":", "warnings", ".", "warn", "(", "'Install optipng to reduce the size of the \\                          generated images'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Scales an image with the same aspect ratio centered in an\n       image with a given max_width and max_height\n       if in_fname == out_fname the image can only be scaled down\n    \"\"\"\n    # local import to avoid testing dependency on PIL:\n    try:\n        from PIL import Image\n    except ImportError:\n        import Image\n    arg_4 = Image.open(arg_0)\n    arg_5, arg_6 = arg_4.size\n    arg_7 = arg_2 / float(arg_5)\n    arg_8 = arg_3 / float(arg_6)\n\n    if arg_6 * arg_7 <= arg_3:\n        arg_9 = arg_7\n    else:\n        arg_9 = arg_8\n\n    if arg_9 >= 1.0 and arg_0 == arg_1:\n        return\n\n    arg_10 = int(round(arg_9 * arg_5))\n    arg_11 = int(round(arg_9 * arg_6))\n\n    # resize the image\n    arg_4.thumbnail((arg_10, arg_11), Image.ANTIALIAS)\n\n    # insert centered\n    arg_12 = Image.new('RGB', (arg_2, arg_3), (255, 255, 255))\n    arg_13 = ((arg_2 - arg_10) // 2, (arg_3 - arg_11) // 2)\n    arg_12.paste(arg_4, arg_13)\n\n    arg_12.save(arg_1)\n    # Use optipng to perform lossless compression on the resized image if\n    # software is installed\n    if os.environ.get('SKLEARN_DOC_OPTIPNG', False):\n        try:\n            subprocess.call([\"optipng\", \"-quiet\", \"-o\", \"9\", arg_1])\n        except Exception:\n            warnings.warn('Install optipng to reduce the size of the \\\n                          generated images')", "path": "doc/sphinxext/sphinx_gallery/gen_rst.py", "identifier": "scale_image", "docstring": "Scales an image with the same aspect ratio centered in an\n       image with a given max_width and max_height\n       if in_fname == out_fname the image can only be scaled down", "docstring_tokens": ["Scales", "an", "image", "with", "the", "same", "aspect", "ratio", "centered", "in", "an", "image", "with", "a", "given", "max_width", "and", "max_height", "if", "in_fname", "==", "out_fname", "the", "image", "can", "only", "be", "scaled", "down"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 257265}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/bibdocfile.py#L73-L127", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Dump all BibDoc metadata.", "language": "python", "parameters": "(recid, from_date, **kwargs)", "return_statement": "return bibdocfile_dump", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "_import_bibdoc", "(", ")", "arg_5", "=", "[", "]", "arg_6", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_1", ",", "'%Y-%m-%d %H:%M:%S'", ")", "for", "arg_7", "in", "arg_3", "(", "arg_0", ")", ".", "list_bibdocs", "(", ")", ":", "for", "arg_8", "in", "arg_7", ".", "list_versions", "(", ")", ":", "arg_9", "=", "arg_7", ".", "list_version_files", "(", "arg_8", ")", "for", "arg_10", "in", "arg_9", ":", "if", "arg_10", ".", "is_icon", "(", ")", "or", "arg_10", ".", "md", "<", "arg_6", ":", "continue", "arg_5", ".", "append", "(", "dict", "(", "bibdocid", "=", "arg_10", ".", "get_bibdocid", "(", ")", ",", "checksum", "=", "arg_10", ".", "get_checksum", "(", ")", ",", "comment", "=", "arg_10", ".", "get_comment", "(", ")", ",", "copyright", "=", "(", "arg_10", ".", "get_copyright", "(", ")", "if", "hasattr", "(", "arg_10", ",", "'get_copyright'", ")", "else", "None", ")", ",", "creation_date", "=", "datetime_toutc", "(", "arg_10", ".", "cd", ")", ".", "isoformat", "(", ")", ",", "description", "=", "arg_10", ".", "get_description", "(", ")", ",", "encoding", "=", "arg_10", ".", "encoding", ",", "etag", "=", "arg_10", ".", "etag", ",", "flags", "=", "arg_10", ".", "flags", ",", "format", "=", "arg_10", ".", "get_format", "(", ")", ",", "full_name", "=", "arg_10", ".", "get_full_name", "(", ")", ",", "full_path", "=", "arg_10", ".", "get_full_path", "(", ")", ",", "hidden", "=", "arg_10", ".", "hidden", ",", "license", "=", "(", "arg_10", ".", "get_license", "(", ")", "if", "hasattr", "(", "arg_10", ",", "'get_license'", ")", "else", "None", ")", ",", "modification_date", "=", "datetime_toutc", "(", "arg_10", ".", "md", ")", ".", "isoformat", "(", ")", ",", "name", "=", "arg_10", ".", "get_name", "(", ")", ",", "mime", "=", "arg_10", ".", "mime", ",", "path", "=", "arg_10", ".", "get_path", "(", ")", ",", "arg_0", "=", "arg_10", ".", "get_recid", "(", ")", ",", "recids_doctype", "=", "arg_10", ".", "recids_doctypes", ",", "size", "=", "arg_10", ".", "get_size", "(", ")", ",", "status", "=", "arg_10", ".", "get_status", "(", ")", ",", "subformat", "=", "arg_10", ".", "get_subformat", "(", ")", ",", "superformat", "=", "arg_10", ".", "get_superformat", "(", ")", ",", "type", "=", "arg_10", ".", "get_type", "(", ")", ",", "url", "=", "arg_10", ".", "get_url", "(", ")", ",", "arg_8", "=", "arg_10", ".", "get_version", "(", ")", ",", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Dump all BibDoc metadata.\n\n    :param docid: BibDoc ID\n    :param from_date: Dump only BibDoc revisions newer than this date.\n\n    :returns: List of version of the BibDoc formatted as a dict\n    \"\"\"\n    arg_3, arg_4 = _import_bibdoc()\n\n    arg_5 = []\n\n    arg_6 = datetime.datetime.strptime(arg_1, '%Y-%m-%d %H:%M:%S')\n    for arg_7 in arg_3(arg_0).list_bibdocs():\n        for arg_8 in arg_7.list_versions():\n            arg_9 = arg_7.list_version_files(arg_8)\n            for arg_10 in arg_9:\n                if arg_10.is_icon() or arg_10.md < arg_6:\n                    # Don't care about icons\n                    # Don't care about files not modified since from_date\n                    continue\n                arg_5.append(dict(\n                    bibdocid=arg_10.get_bibdocid(),\n                    checksum=arg_10.get_checksum(),\n                    comment=arg_10.get_comment(),\n                    copyright=(\n                        arg_10.get_copyright() if hasattr(arg_10, 'get_copyright')\n                        else None),\n                    creation_date=datetime_toutc(arg_10.cd).isoformat(),\n                    description=arg_10.get_description(),\n                    encoding=arg_10.encoding,\n                    etag=arg_10.etag,\n                    flags=arg_10.flags,\n                    format=arg_10.get_format(),\n                    full_name=arg_10.get_full_name(),\n                    full_path=arg_10.get_full_path(),\n                    hidden=arg_10.hidden,\n                    license=(\n                        arg_10.get_license()if hasattr(arg_10, 'get_license') else None),\n                    modification_date=datetime_toutc(arg_10.md).isoformat(),\n                    name=arg_10.get_name(),\n                    mime=arg_10.mime,\n                    path=arg_10.get_path(),\n                    arg_0=arg_10.get_recid(),\n                    recids_doctype=arg_10.recids_doctypes,\n                    size=arg_10.get_size(),\n                    status=arg_10.get_status(),\n                    subformat=arg_10.get_subformat(),\n                    superformat=arg_10.get_superformat(),\n                    type=arg_10.get_type(),\n                    url=arg_10.get_url(),\n                    arg_8=arg_10.get_version(),\n                ))\n\n    return arg_5", "path": "invenio_migrator/legacy/bibdocfile.py", "identifier": "dump_bibdoc", "docstring": "Dump all BibDoc metadata.\n\n    :param docid: BibDoc ID\n    :param from_date: Dump only BibDoc revisions newer than this date.\n\n    :returns: List of version of the BibDoc formatted as a dict", "docstring_tokens": ["Dump", "all", "BibDoc", "metadata", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 257266}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/packet.py#L106-L196", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "Decode a rawstr packet arriving from the socket into a dict.", "language": "python", "parameters": "(rawstr, json_loads=default_json_loads)", "return_statement": "return decoded_msg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_3", "=", "{", "}", "try", ":", "arg_0", "=", "arg_0", ".", "Func", "(", "'utf-8'", ")", "except", "AttributeError", ":", "pass", "arg_4", "=", "arg_0", ".", "split", "(", "\":\"", ",", "3", ")", "arg_5", "=", "arg_4", "[", "0", "]", "arg_6", "=", "arg_4", "[", "1", "]", "arg_7", "=", "arg_4", "[", "2", "]", "arg_8", "=", "''", "if", "arg_6", "!=", "''", ":", "if", "\"+\"", "in", "arg_6", ":", "arg_6", "=", "arg_6", ".", "split", "(", "'+'", ")", "[", "0", "]", "arg_3", "[", "'id'", "]", "=", "int", "(", "arg_6", ")", "arg_3", "[", "'ack'", "]", "=", "'data'", "else", ":", "arg_3", "[", "'id'", "]", "=", "int", "(", "arg_6", ")", "arg_3", "[", "'ack'", "]", "=", "True", "arg_9", "=", "int", "(", "arg_5", ")", "if", "arg_9", "in", "MSG_VALUES", ":", "arg_3", "[", "'type'", "]", "=", "MSG_VALUES", "[", "int", "(", "arg_5", ")", "]", "else", ":", "raise", "Exception", "(", "\"Unknown message type: %s\"", "%", "arg_5", ")", "arg_3", "[", "'endpoint'", "]", "=", "arg_7", "if", "len", "(", "arg_4", ")", ">", "3", ":", "arg_8", "=", "arg_4", "[", "3", "]", "if", "arg_5", "==", "\"0\"", ":", "pass", "elif", "arg_5", "==", "\"1\"", ":", "arg_3", "[", "'qs'", "]", "=", "arg_8", "elif", "arg_5", "==", "\"2\"", ":", "pass", "elif", "arg_5", "==", "\"3\"", ":", "arg_3", "[", "'data'", "]", "=", "arg_8", "elif", "arg_5", "==", "\"4\"", ":", "arg_3", "[", "'data'", "]", "=", "arg_1", "(", "arg_8", ")", "elif", "arg_5", "==", "\"5\"", ":", "try", ":", "arg_8", "=", "arg_1", "(", "arg_8", ")", "except", "ValueError", ":", "print", "(", "\"Invalid JSON event message\"", ",", "arg_8", ")", "arg_3", "[", "'args'", "]", "=", "[", "]", "else", ":", "arg_3", "[", "'name'", "]", "=", "arg_8", ".", "pop", "(", "'name'", ")", "if", "'args'", "in", "arg_8", ":", "arg_3", "[", "'args'", "]", "=", "arg_8", "[", "'args'", "]", "else", ":", "arg_3", "[", "'args'", "]", "=", "[", "]", "elif", "arg_5", "==", "\"6\"", ":", "if", "'+'", "in", "arg_8", ":", "arg_10", ",", "arg_8", "=", "arg_8", ".", "split", "(", "'+'", ")", "arg_3", "[", "'ackId'", "]", "=", "int", "(", "arg_10", ")", "arg_3", "[", "'args'", "]", "=", "arg_1", "(", "arg_8", ")", "else", ":", "arg_3", "[", "'ackId'", "]", "=", "int", "(", "arg_8", ")", "arg_3", "[", "'args'", "]", "=", "[", "]", "elif", "arg_5", "==", "\"7\"", ":", "if", "'+'", "in", "arg_8", ":", "arg_11", ",", "arg_12", "=", "arg_8", ".", "split", "(", "'+'", ")", "arg_3", "[", "'reason'", "]", "=", "REASONS_VALUES", "[", "int", "(", "arg_11", ")", "]", "arg_3", "[", "'advice'", "]", "=", "ADVICES_VALUES", "[", "int", "(", "arg_12", ")", "]", "else", ":", "arg_3", "[", "'advice'", "]", "=", "''", "if", "arg_8", "!=", "''", ":", "arg_3", "[", "'reason'", "]", "=", "REASONS_VALUES", "[", "int", "(", "arg_8", ")", "]", "else", ":", "arg_3", "[", "'reason'", "]", "=", "''", "elif", "arg_5", "==", "\"8\"", ":", "pass", "return", "arg_3"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Decode a rawstr packet arriving from the socket into a dict.\n    \"\"\"\n    arg_3 = {}\n    try:\n        # Handle decoding in Python<3.\n        arg_0 = arg_0.Func('utf-8')\n    except AttributeError:\n        pass\n    arg_4 = arg_0.split(\":\", 3)\n    arg_5 = arg_4[0]\n    arg_6 = arg_4[1]\n    arg_7 = arg_4[2]\n\n    arg_8 = ''\n\n    if arg_6 != '':\n        if \"+\" in arg_6:\n            arg_6 = arg_6.split('+')[0]\n            arg_3['id'] = int(arg_6)\n            arg_3['ack'] = 'data'\n        else:\n            arg_3['id'] = int(arg_6)\n            arg_3['ack'] = True\n\n    # common to every message\n    arg_9 = int(arg_5)\n    if arg_9 in MSG_VALUES:\n        arg_3['type'] = MSG_VALUES[int(arg_5)]\n    else:\n        raise Exception(\"Unknown message type: %s\" % arg_5)\n\n    arg_3['endpoint'] = arg_7\n\n    if len(arg_4) > 3:\n        arg_8 = arg_4[3]\n\n    if arg_5 == \"0\":  # disconnect\n        pass\n\n    elif arg_5 == \"1\":  # connect\n        arg_3['qs'] = arg_8\n\n    elif arg_5 == \"2\":  # heartbeat\n        pass\n\n    elif arg_5 == \"3\":  # message\n        arg_3['data'] = arg_8\n\n    elif arg_5 == \"4\":  # json msg\n        arg_3['data'] = arg_1(arg_8)\n\n    elif arg_5 == \"5\":  # event\n        try:\n            arg_8 = arg_1(arg_8)\n        except ValueError:\n            print(\"Invalid JSON event message\", arg_8)\n            arg_3['args'] = []\n        else:\n            arg_3['name'] = arg_8.pop('name')\n            if 'args' in arg_8:\n                arg_3['args'] = arg_8['args']\n            else:\n                arg_3['args'] = []\n\n    elif arg_5 == \"6\":  # ack\n        if '+' in arg_8:\n            arg_10, arg_8 = arg_8.split('+')\n            arg_3['ackId'] = int(arg_10)\n            arg_3['args'] = arg_1(arg_8)\n        else:\n            arg_3['ackId'] = int(arg_8)\n            arg_3['args'] = []\n\n    elif arg_5 == \"7\":  # error\n        if '+' in arg_8:\n            arg_11, arg_12 = arg_8.split('+')\n            arg_3['reason'] = REASONS_VALUES[int(arg_11)]\n            arg_3['advice'] = ADVICES_VALUES[int(arg_12)]\n        else:\n            arg_3['advice'] = ''\n            if arg_8 != '':\n                arg_3['reason'] = REASONS_VALUES[int(arg_8)]\n            else:\n                arg_3['reason'] = ''\n\n    elif arg_5 == \"8\":  # noop\n        pass\n\n    return arg_3", "path": "socketio/packet.py", "identifier": "decode", "docstring": "Decode a rawstr packet arriving from the socket into a dict.", "docstring_tokens": ["Decode", "a", "rawstr", "packet", "arriving", "from", "the", "socket", "into", "a", "dict", "."], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 257267}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L267-L270", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Returns a list of PIDs currently running on the system.", "language": "python", "parameters": "()", "return_statement": "return pids", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "int", "(", "x", ")", "for", "x", "in", "os", ".", "listdir", "(", "'/proc'", ")", "if", "x", ".", "isdigit", "(", ")", "]", "return", "arg_0"], "function": "def Func():\n    \"\"\"Returns a list of PIDs currently running on the system.\"\"\"\n    arg_0 = [int(x) for x in os.listdir('/proc') if x.isdigit()]\n    return arg_0", "path": "environment/lib/python2.7/site-packages/psutil/_pslinux.py", "identifier": "get_pid_list", "docstring": "Returns a list of PIDs currently running on the system.", "docstring_tokens": ["Returns", "a", "list", "of", "PIDs", "currently", "running", "on", "the", "system", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257268}
{"url": "https://github.com/calebsmith/django-template-debug/blob/f3d52638da571164d63e5c8331d409b0743c628f/template_debug/utils.py#L54-L67", "sha": "f3d52638da571164d63e5c8331d409b0743c628f", "docstring_summary": "Given a variable and one of its attributes that are available inside of\n    a template, return its 'method' if it is a callable, its class name if it\n    is a model manager, otherwise return its value", "language": "python", "parameters": "(var, attr)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "getattr", "(", "getattr", "(", "arg_2", ",", "'__class__'", ",", "''", ")", ",", "'__name__'", ",", "''", ")", "if", "arg_3", "in", "(", "'ManyRelatedManager'", ",", "'RelatedManager'", ",", "'EmptyManager'", ")", ":", "return", "arg_3", "if", "callable", "(", "arg_2", ")", ":", "return", "'routine'", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Given a variable and one of its attributes that are available inside of\n    a template, return its 'method' if it is a callable, its class name if it\n    is a model manager, otherwise return its value\n    \"\"\"\n    arg_2 = getattr(arg_0, arg_1)\n    # Rename common Django class names\n    arg_3 = getattr(getattr(arg_2, '__class__', ''), '__name__', '')\n    if arg_3 in ('ManyRelatedManager', 'RelatedManager', 'EmptyManager'):\n        return arg_3\n    if callable(arg_2):\n        return 'routine'\n    return arg_2", "path": "template_debug/utils.py", "identifier": "_get_detail_value", "docstring": "Given a variable and one of its attributes that are available inside of\n    a template, return its 'method' if it is a callable, its class name if it\n    is a model manager, otherwise return its value", "docstring_tokens": ["Given", "a", "variable", "and", "one", "of", "its", "attributes", "that", "are", "available", "inside", "of", "a", "template", "return", "its", "method", "if", "it", "is", "a", "callable", "its", "class", "name", "if", "it", "is", "a", "model", "manager", "otherwise", "return", "its", "value"], "nwo": "calebsmith/django-template-debug", "score": 0.31606306836212245, "idx": 257269}
{"url": "https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/afe3a9ebd886791b662607499c180d2baaeaf617/src/marshmallow_sqlalchemy/schema.py#L54-L66", "sha": "afe3a9ebd886791b662607499c180d2baaeaf617", "docstring_summary": "Updates declared fields with fields converted from the SQLAlchemy model\n        passed as the `model` class Meta option.", "language": "python", "parameters": "(mcs, klass, cls_fields, inherited_fields, dict_cls)", "return_statement": "return fields", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_1", ".", "opts", "arg_6", "=", "arg_5", ".", "model_converter", "arg_7", "=", "arg_6", "(", "schema_cls", "=", "arg_1", ")", "arg_8", "=", "super", "(", "SchemaMeta", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "arg_9", "=", "arg_0", ".", "get_fields", "(", "arg_7", ",", "arg_5", ",", "arg_8", ",", "arg_4", ")", "arg_9", ".", "update", "(", "arg_8", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Updates declared fields with fields converted from the SQLAlchemy model\n        passed as the `model` class Meta option.\n        \"\"\"\n        arg_5 = arg_1.opts\n        arg_6 = arg_5.model_converter\n        arg_7 = arg_6(schema_cls=arg_1)\n        arg_8 = super(SchemaMeta, arg_0).Func(\n            arg_1, arg_2, arg_3, arg_4\n        )\n        arg_9 = arg_0.get_fields(arg_7, arg_5, arg_8, arg_4)\n        arg_9.update(arg_8)\n        return arg_9", "path": "src/marshmallow_sqlalchemy/schema.py", "identifier": "SchemaMeta.get_declared_fields", "docstring": "Updates declared fields with fields converted from the SQLAlchemy model\n        passed as the `model` class Meta option.", "docstring_tokens": ["Updates", "declared", "fields", "with", "fields", "converted", "from", "the", "SQLAlchemy", "model", "passed", "as", "the", "model", "class", "Meta", "option", "."], "nwo": "marshmallow-code/marshmallow-sqlalchemy", "score": 0.5915932759257259, "idx": 257270}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/coverageplots.py#L17-L86", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "plots histogram of coverages across clusters", "language": "python", "parameters": "(data, samples=None, dims=(None,None), canvas=(None,None), \n              xmax=50, log=False, outprefix=None, use_maxdepth=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "(", "None", ",", "None", ")", ",", "arg_3", "=", "(", "None", ",", "None", ")", ",", "arg_4", "=", "50", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "samples", ".", "keys", "(", ")", "arg_1", ".", "sort", "(", ")", "arg_8", "=", "OrderedDict", "(", "[", "(", "i", ",", "arg_0", ".", "samples", "[", "i", "]", ")", "for", "i", "in", "arg_1", "]", ")", "if", "any", "(", "arg_2", ")", ":", "print", "(", "\"userdims\"", ")", "else", ":", "if", "len", "(", "arg_8", ")", "<=", "4", ":", "arg_2", "=", "(", "1", ",", "len", "(", "arg_8", ")", ")", "else", ":", "arg_2", "=", "(", "len", "(", "arg_8", ")", "/", "4", ",", "4", ")", "if", "any", "(", "arg_3", ")", ":", "print", "(", "\"usercanvas\"", ")", "arg_3", "=", "toyplot", ".", "Canvas", "(", "width", "=", "arg_3", "[", "0", "]", ",", "height", "=", "arg_3", "[", "1", "]", ")", "else", ":", "arg_3", "=", "toyplot", ".", "Canvas", "(", "width", "=", "200", "*", "arg_2", "[", "1", "]", ",", "height", "=", "150", "*", "arg_2", "[", "0", "]", ")", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_8", ")", ":", "arg_11", "=", "arg_8", "[", "arg_10", "]", ".", "depths", "arg_11", "=", "arg_11", "[", "arg_11", ">=", "arg_0", ".", "paramsdict", "[", "\"mindepth_statistical\"", "]", "]", "if", "arg_7", ":", "arg_11", "=", "{", "i", ":", "j", "for", "(", "i", ",", "j", ")", "in", "arg_11", "if", "i", "<", "arg_0", ".", "paramsdict", "[", "\"maxdepth\"", "]", "}", "arg_12", "=", "np", ".", "histogram", "(", "arg_11", ",", "range", "(", "50", ")", ")", "arg_11", "=", "arg_8", "[", "arg_10", "]", ".", "depths", "arg_11", "=", "arg_11", "[", "arg_11", "<", "arg_0", ".", "paramsdict", "[", "\"mindepth_statistical\"", "]", "]", "arg_11", "=", "arg_11", "[", "arg_11", ">=", "arg_0", ".", "paramsdict", "[", "\"mindepth_majrule\"", "]", "]", "if", "arg_7", ":", "arg_11", "=", "arg_11", "[", "arg_11", "<", "arg_0", ".", "paramsdict", "[", "\"maxdepth\"", "]", "]", "arg_13", "=", "np", ".", "histogram", "(", "arg_11", ",", "range", "(", "50", ")", ")", "arg_14", "=", "arg_0", ".", "samples", "[", "arg_10", "]", ".", "depths", "arg_14", "=", "arg_14", "[", "arg_14", "<", "arg_0", ".", "paramsdict", "[", "\"mindepth_majrule\"", "]", "]", "if", "arg_7", ":", "arg_14", "=", "arg_14", "[", "arg_14", "<", "arg_0", ".", "paramsdict", "[", "\"maxdepth\"", "]", "]", "arg_15", "=", "np", ".", "histogram", "(", "arg_14", ",", "range", "(", "50", ")", ")", "arg_16", "=", "arg_3", ".", "cartesian", "(", "grid", "=", "(", "arg_2", "[", "0", "]", ",", "arg_2", "[", "1", "]", ",", "arg_9", ")", ",", "gutter", "=", "25", ")", "arg_16", ".", "x", ".", "domain", ".", "xmax", "=", "arg_4", "arg_16", ".", "label", ".", "text", "=", "arg_10", "if", "arg_5", ":", "arg_16", ".", "y", ".", "scale", "=", "\"log\"", "arg_16", ".", "bars", "(", "arg_12", ")", "arg_16", ".", "bars", "(", "arg_15", ")", "arg_16", ".", "bars", "(", "arg_13", ")", "if", "arg_6", ":", "toyplot", ".", "html", ".", "render", "(", "arg_3", ",", "fobj", "=", "arg_6", "+", "\".html\"", ")", "toyplot", ".", "svg", ".", "render", "(", "arg_3", ",", "fobj", "=", "arg_6", "+", "\".svg\"", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=(None,None), arg_3=(None,None), \n              arg_4=50, arg_5=False, arg_6=None, arg_7=False):\n    \"\"\" plots histogram of coverages across clusters\"\"\"\n\n    ## select samples to be plotted, requires depths info\n    if not arg_1:\n        arg_1 = arg_0.samples.keys()\n        arg_1.sort()\n    arg_8 = OrderedDict([(i, arg_0.samples[i]) for i in arg_1])\n\n    ## get canvas dimensions based on n-samples\n    if any(arg_2):\n        ## user-supplied dimensions (...)\n        print(\"userdims\")\n    else:\n        if len(arg_8) <= 4:\n            ## set dimension to N samples \n            arg_2 = (1, len(arg_8))\n        else:\n            arg_2 = (len(arg_8)/4, 4)\n\n    ## create canvas\n    if any(arg_3):\n        print(\"usercanvas\")\n        arg_3 = toyplot.Canvas(width=arg_3[0], height=arg_3[1])\n    else:\n        arg_3 = toyplot.Canvas(width=200*arg_2[1], height=150*arg_2[0])\n\n    ## get all of the data arrays\n    for arg_9, arg_10 in enumerate(arg_8):\n        ## statistical called bins\n        arg_11 = arg_8[arg_10].depths\n        arg_11 = arg_11[arg_11 >= arg_0.paramsdict[\"mindepth_statistical\"]]\n        if arg_7:\n            arg_11 = {i:j for (i, j) in arg_11 if \\\n                                        i < arg_0.paramsdict[\"maxdepth\"]}\n        arg_12 = np.histogram(arg_11, range(50))\n\n        ## majrule called bins\n        arg_11 = arg_8[arg_10].depths\n        arg_11 = arg_11[arg_11 < arg_0.paramsdict[\"mindepth_statistical\"]]\n        arg_11 = arg_11[arg_11 >= arg_0.paramsdict[\"mindepth_majrule\"]]\n        if arg_7:\n            arg_11 = arg_11[arg_11 < arg_0.paramsdict[\"maxdepth\"]]\n        arg_13 = np.histogram(arg_11, range(50))\n\n        ## excluded bins\n        arg_14 = arg_0.samples[arg_10].depths\n        arg_14 = arg_14[arg_14 < arg_0.paramsdict[\"mindepth_majrule\"]]\n        if arg_7:\n            arg_14 = arg_14[arg_14 < arg_0.paramsdict[\"maxdepth\"]]\n        arg_15 = np.histogram(arg_14, range(50))\n\n        ## fill in each panel of canvas with a sample\n        arg_16 = arg_3.cartesian(grid=(arg_2[0], arg_2[1], arg_9), gutter=25)\n        arg_16.x.domain.xmax = arg_4\n        arg_16.label.text = arg_10\n        if arg_5:\n            arg_16.y.scale = \"log\"\n\n        # heights = np.column_stack((sdat,mdat,edat))\n        arg_16.bars(arg_12)\n        arg_16.bars(arg_15)\n        arg_16.bars(arg_13)\n\n\n    ## return objects to be saved...\n    if arg_6:\n        toyplot.html.render(arg_3, fobj=arg_6+\".html\")\n        toyplot.svg.render(arg_3, fobj=arg_6+\".svg\")", "path": "ipyrad/plotting/coverageplots.py", "identifier": "depthplot", "docstring": "plots histogram of coverages across clusters", "docstring_tokens": ["plots", "histogram", "of", "coverages", "across", "clusters"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 257271}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sqoop_hook.py#L235-L256", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Imports a specific query from the rdbms to hdfs", "language": "python", "parameters": "(self, query, target_dir, append=False, file_type=\"text\",\n                     split_by=None, direct=None, driver=None, extra_import_options=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "\"text\"", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ")", ":", "arg_9", "=", "arg_0", ".", "_import_cmd", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "arg_9", "+=", "[", "\"--query\"", ",", "arg_1", "]", "arg_0", ".", "Popen", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=\"text\",\n                     arg_5=None, arg_6=None, arg_7=None, arg_8=None):\n        \"\"\"\n        Imports a specific query from the rdbms to hdfs\n\n        :param query: Free format query to run\n        :param target_dir: HDFS destination dir\n        :param append: Append data to an existing dataset in HDFS\n        :param file_type: \"avro\", \"sequence\", \"text\" or \"parquet\"\n            Imports data to hdfs into the specified format. Defaults to text.\n        :param split_by: Column of the table used to split work units\n        :param direct: Use direct import fast path\n        :param driver: Manually specify JDBC driver class to use\n        :param extra_import_options: Extra import options to pass as dict.\n            If a key doesn't have a value, just pass an empty string to it.\n            Don't include prefix of -- for sqoop options.\n        \"\"\"\n        arg_9 = arg_0._import_cmd(arg_2, arg_3, arg_4, arg_5, arg_6,\n                               arg_7, arg_8)\n        arg_9 += [\"--query\", arg_1]\n\n        arg_0.Popen(arg_9)", "path": "airflow/contrib/hooks/sqoop_hook.py", "identifier": "SqoopHook.import_query", "docstring": "Imports a specific query from the rdbms to hdfs\n\n        :param query: Free format query to run\n        :param target_dir: HDFS destination dir\n        :param append: Append data to an existing dataset in HDFS\n        :param file_type: \"avro\", \"sequence\", \"text\" or \"parquet\"\n            Imports data to hdfs into the specified format. Defaults to text.\n        :param split_by: Column of the table used to split work units\n        :param direct: Use direct import fast path\n        :param driver: Manually specify JDBC driver class to use\n        :param extra_import_options: Extra import options to pass as dict.\n            If a key doesn't have a value, just pass an empty string to it.\n            Don't include prefix of -- for sqoop options.", "docstring_tokens": ["Imports", "a", "specific", "query", "from", "the", "rdbms", "to", "hdfs"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257272}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L110-L118", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Convenience method for create_report, for creating a course sis export\n        report.", "language": "python", "parameters": "(self, account_id, term_id=None,\n                                        params={})", "return_statement": "return self.create_report(ReportType.SIS_EXPORT, account_id, term_id,\n                                  params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "{", "}", ")", ":", "arg_3", "[", "\"courses\"", "]", "=", "True", "return", "arg_0", ".", "create_report", "(", "ReportType", ".", "SIS_EXPORT", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                                        arg_3={}):\n        \"\"\"\n        Convenience method for create_report, for creating a course sis export\n        report.\n        \"\"\"\n        arg_3[\"courses\"] = True\n        return arg_0.create_report(ReportType.SIS_EXPORT, arg_1, arg_2,\n                                  arg_3)", "path": "uw_canvas/reports.py", "identifier": "Reports.create_course_sis_export_report", "docstring": "Convenience method for create_report, for creating a course sis export\n        report.", "docstring_tokens": ["Convenience", "method", "for", "create_report", "for", "creating", "a", "course", "sis", "export", "report", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 257273}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/interrupts.py#L191-L208", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "De-registers callback functions", "language": "python", "parameters": "(self, pin_num=None, direction=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_0", ".", "pin_function_maps", ")", ":", "if", "(", "arg_1", "==", "None", "or", "(", "arg_5", ".", "pin_num", "==", "arg_1", "and", "(", "arg_2", "==", "None", "or", "arg_5", ".", "direction", "==", "arg_2", ")", ")", ")", ":", "arg_3", ".", "append", "(", "arg_4", ")", "for", "arg_4", "in", "reversed", "(", "arg_3", ")", ":", "del", "arg_0", ".", "pin_function_maps", "[", "arg_4", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"De-registers callback functions\n\n        :param pin_num: The pin number. If None then all functions are de-registered\n        :type pin_num: int\n        :param direction: The event direction. If None then all functions for the\n                          given pin are de-registered\n        :type direction:int\n        \"\"\"\n        arg_3 = []\n        for arg_4, arg_5 in enumerate(arg_0.pin_function_maps):\n            if ( arg_1 == None\n                 or ( arg_5.pin_num == arg_1\n                      and ( arg_2 == None\n                            or arg_5.direction == arg_2 ) ) ):\n                arg_3.append(arg_4)\n        for arg_4 in reversed(arg_3):\n            del arg_0.pin_function_maps[arg_4]", "path": "pifacecommon/interrupts.py", "identifier": "PortEventListener.deregister", "docstring": "De-registers callback functions\n\n        :param pin_num: The pin number. If None then all functions are de-registered\n        :type pin_num: int\n        :param direction: The event direction. If None then all functions for the\n                          given pin are de-registered\n        :type direction:int", "docstring_tokens": ["De", "-", "registers", "callback", "functions"], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 257274}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nessus.py#L54-L58", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Starts the scan identified by the scan_id.s", "language": "python", "parameters": "(self, scan_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "requests", ".", "post", "(", "arg_0", ".", "url", "+", "'scans/{}/launch'", ".", "format", "(", "arg_1", ")", ",", "verify", "=", "False", ",", "headers", "=", "arg_0", ".", "headers", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Starts the scan identified by the scan_id.s\n        \"\"\"\n        requests.post(arg_0.url + 'scans/{}/launch'.format(arg_1), verify=False, headers=arg_0.headers)", "path": "jackal/scripts/nessus.py", "identifier": "Nessus.start_scan", "docstring": "Starts the scan identified by the scan_id.s", "docstring_tokens": ["Starts", "the", "scan", "identified", "by", "the", "scan_id", ".", "s"], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 257275}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/classify.py#L150-L209", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Perform classification on specified regions", "language": "python", "parameters": "(dataset, masks, method='ERF', threshold=0.08,\n                     remove_overlap=True, regularization='scale',\n                     output='summary', studies=None, features=None,\n                     class_weight='auto', classifier=None,\n                     cross_val='4-Fold', param_grid=None, scoring='accuracy')", "return_statement": "return classify(X, y, method, classifier, output, cross_val,\n                    class_weight, scoring=scoring, param_grid=param_grid)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'ERF'", ",", "arg_3", "=", "0.08", ",", "arg_4", "=", "True", ",", "arg_5", "=", "'scale'", ",", "arg_6", "=", "'summary'", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "'auto'", ",", "arg_10", "=", "None", ",", "arg_11", "=", "'4-Fold'", ",", "arg_12", "=", "None", ",", "arg_13", "=", "'accuracy'", ")", ":", "(", "arg_14", ",", "arg_15", ")", "=", "get_studies_by_regions", "(", "arg_0", ",", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_7", ",", "arg_8", ",", "arg_5", "=", "arg_5", ")", "return", "classify", "(", "arg_14", ",", "arg_15", ",", "arg_2", ",", "arg_10", ",", "arg_6", ",", "arg_11", ",", "arg_9", ",", "arg_13", "=", "arg_13", ",", "arg_12", "=", "arg_12", ")"], "function": "def Func(arg_0, arg_1, arg_2='ERF', arg_3=0.08,\n                     arg_4=True, arg_5='scale',\n                     arg_6='summary', arg_7=None, arg_8=None,\n                     arg_9='auto', arg_10=None,\n                     arg_11='4-Fold', arg_12=None, arg_13='accuracy'):\n    \"\"\" Perform classification on specified regions\n\n        Given a set of masks, this function retrieves studies associated with\n        each mask at the specified threshold, optionally removes overlap and\n        filters by studies and features. Then it trains an algorithm to\n        classify studies based on features and tests performance.\n\n        Args:\n            dataset: a Neurosynth dataset\n            maks: a list of paths to Nifti masks\n            method: a string indicating which method to used.\n                'SVM': Support Vector Classifier with rbf kernel\n                'ERF': Extremely Randomized Forest classifier\n                'Dummy': A dummy classifier using stratified classes as\n                    predictor\n            threshold: percentage of voxels active within the mask for study\n                to be included\n            remove_overlap: A boolean indicating if studies studies that\n                appear in more than one mask should be excluded\n            regularization: A string indicating type of regularization to use.\n                If None, performs no regularization.\n                'scale': Unit scale without demeaning\n            output: A string indicating output type\n                'summary': Dictionary with summary statistics including score\n                    and n\n                'summary_clf': Same as above but also includes classifier\n                'clf': Only returns classifier\n                Warning: using cv without grid will return an untrained\n                classifier\n            studies: An optional list of study names used to constrain the set\n                used in classification. If None, will use all features in the\n                dataset.\n            features: An optional list of feature names used to constrain the\n                set used in classification. If None, will use all features in\n                the dataset.\n            class_weight: Parameter to pass to classifier determining how to\n                weight classes\n            classifier: An optional sci-kit learn classifier to use instead of\n                pre-set up classifiers set up using 'method'\n            cross_val: A string indicating type of cross validation to use.\n                Can also pass a scikit_classifier\n            param_grid: A dictionary indicating which parameters to optimize\n                using GridSearchCV. If None, no GridSearch will be used\n\n        Returns:\n            A tuple (X, y) of np arrays.\n            X is a feature by studies matrix and y is a vector of class labels\n    \"\"\"\n\n    (arg_14, arg_15) = get_studies_by_regions(arg_0, arg_1, arg_3, arg_4,\n                                    arg_7, arg_8,\n                                    arg_5=arg_5)\n\n    return classify(arg_14, arg_15, arg_2, arg_10, arg_6, arg_11,\n                    arg_9, arg_13=arg_13, arg_12=arg_12)", "path": "neurosynth/analysis/classify.py", "identifier": "classify_regions", "docstring": "Perform classification on specified regions\n\n        Given a set of masks, this function retrieves studies associated with\n        each mask at the specified threshold, optionally removes overlap and\n        filters by studies and features. Then it trains an algorithm to\n        classify studies based on features and tests performance.\n\n        Args:\n            dataset: a Neurosynth dataset\n            maks: a list of paths to Nifti masks\n            method: a string indicating which method to used.\n                'SVM': Support Vector Classifier with rbf kernel\n                'ERF': Extremely Randomized Forest classifier\n                'Dummy': A dummy classifier using stratified classes as\n                    predictor\n            threshold: percentage of voxels active within the mask for study\n                to be included\n            remove_overlap: A boolean indicating if studies studies that\n                appear in more than one mask should be excluded\n            regularization: A string indicating type of regularization to use.\n                If None, performs no regularization.\n                'scale': Unit scale without demeaning\n            output: A string indicating output type\n                'summary': Dictionary with summary statistics including score\n                    and n\n                'summary_clf': Same as above but also includes classifier\n                'clf': Only returns classifier\n                Warning: using cv without grid will return an untrained\n                classifier\n            studies: An optional list of study names used to constrain the set\n                used in classification. If None, will use all features in the\n                dataset.\n            features: An optional list of feature names used to constrain the\n                set used in classification. If None, will use all features in\n                the dataset.\n            class_weight: Parameter to pass to classifier determining how to\n                weight classes\n            classifier: An optional sci-kit learn classifier to use instead of\n                pre-set up classifiers set up using 'method'\n            cross_val: A string indicating type of cross validation to use.\n                Can also pass a scikit_classifier\n            param_grid: A dictionary indicating which parameters to optimize\n                using GridSearchCV. If None, no GridSearch will be used\n\n        Returns:\n            A tuple (X, y) of np arrays.\n            X is a feature by studies matrix and y is a vector of class labels", "docstring_tokens": ["Perform", "classification", "on", "specified", "regions"], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 257276}
{"url": "https://github.com/youtux/pypebbleapi/blob/fe7b49da9c30e4a359cc6245a416862ccb3aa589/pypebbleapi/timeline.py#L95-L117", "sha": "fe7b49da9c30e4a359cc6245a416862ccb3aa589", "docstring_summary": "Send a shared pin for the given topics.", "language": "python", "parameters": "(self, topics, pin, skip_validation=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "if", "not", "arg_0", ".", "api_key", ":", "raise", "ValueError", "(", "\"You need to specify an api_key.\"", ")", "if", "not", "arg_3", ":", "validate_pin", "(", "arg_2", ")", "arg_4", "=", "_request", "(", "'PUT'", ",", "url", "=", "arg_0", ".", "url_v1", "(", "'/shared/pins/'", "+", "arg_2", "[", "'id'", "]", ")", ",", "user_agent", "=", "arg_0", ".", "user_agent", ",", "api_key", "=", "arg_0", ".", "api_key", ",", "topics_list", "=", "arg_1", ",", "json", "=", "arg_2", ",", ")", "_raise_for_status", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"\n        Send a shared pin for the given topics.\n\n        :param list topics: The list of topics.\n        :param dict pin: The pin.\n        :param bool skip_validation: Whether to skip the validation.\n        :raises pypebbleapi.schemas.DocumentError: If the validation process failed.\n        :raises `requests.exceptions.HTTPError`: If an HTTP error occurred.\n        \"\"\"\n        if not arg_0.api_key:\n            raise ValueError(\"You need to specify an api_key.\")\n        if not arg_3:\n            validate_pin(arg_2)\n\n        arg_4 = _request('PUT',\n            url=arg_0.url_v1('/shared/pins/' + arg_2['id']),\n            user_agent=arg_0.user_agent,\n            api_key=arg_0.api_key,\n            topics_list=arg_1,\n            json=arg_2,\n        )\n        _raise_for_status(arg_4)", "path": "pypebbleapi/timeline.py", "identifier": "Timeline.send_shared_pin", "docstring": "Send a shared pin for the given topics.\n\n        :param list topics: The list of topics.\n        :param dict pin: The pin.\n        :param bool skip_validation: Whether to skip the validation.\n        :raises pypebbleapi.schemas.DocumentError: If the validation process failed.\n        :raises `requests.exceptions.HTTPError`: If an HTTP error occurred.", "docstring_tokens": ["Send", "a", "shared", "pin", "for", "the", "given", "topics", "."], "nwo": "youtux/pypebbleapi", "score": 0.0, "idx": 257277}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L258-L273", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Dynamically creates a module with the given name.", "language": "python", "parameters": "(name, code=None)", "return_statement": "return module", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "not", "in", "arg_2", ".", "modules", ":", "arg_2", ".", "modules", "[", "arg_0", "]", "=", "imp", ".", "new_module", "(", "arg_0", ")", "arg_4", "=", "arg_2", ".", "modules", "[", "arg_0", "]", "if", "arg_1", ":", "print", "(", "'executing code for %s: %s'", "%", "(", "arg_0", ",", "arg_1", ")", ")", "exec", "(", "arg_1", "in", "arg_4", ".", "__dict__", ")", "exec", "(", "\"from %s import %s\"", "%", "(", "arg_0", ",", "'*'", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Dynamically creates a module with the given name.\n    \"\"\"\n\n    if arg_0 not in arg_2.modules:\n        arg_2.modules[arg_0] = imp.new_module(arg_0)\n\n    arg_4 = arg_2.modules[arg_0]\n\n    if arg_1:\n        print('executing code for %s: %s' % (arg_0, arg_1))\n        exec(arg_1 in arg_4.__dict__) # pylint: disable=exec-used\n        exec(\"from %s import %s\" % (arg_0, '*')) # pylint: disable=exec-used\n\n    return arg_4", "path": "burlap/common.py", "identifier": "create_module", "docstring": "Dynamically creates a module with the given name.", "docstring_tokens": ["Dynamically", "creates", "a", "module", "with", "the", "given", "name", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 257278}
{"url": "https://github.com/cs01/pygdbmi/blob/709c781794d3c3b903891f83da011d2d995895d1/pygdbmi/StringStream.py#L60-L92", "sha": "709c781794d3c3b903891f83da011d2d995895d1", "docstring_summary": "characters that gdb escapes that should not be\n        escaped by this parser", "language": "python", "parameters": "(self, chars_to_remove_gdb_escape=None)", "return_statement": "return buf", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "'\"'", "]", "arg_2", "=", "\"\"", "while", "True", ":", "arg_3", "=", "arg_0", ".", "raw_text", "[", "arg_0", ".", "index", "]", "arg_0", ".", "index", "+=", "1", "logging", ".", "debug", "(", "\"%s\"", ",", "fmt_cyan", "(", "arg_3", ")", ")", "if", "arg_3", "==", "\"\\\\\"", ":", "arg_4", "=", "arg_0", ".", "raw_text", "[", "arg_0", ".", "index", "]", "arg_0", ".", "index", "+=", "1", "arg_2", "+=", "arg_4", "elif", "arg_3", "==", "'\"'", ":", "break", "else", ":", "arg_2", "+=", "arg_3", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"characters that gdb escapes that should not be\n        escaped by this parser\n        \"\"\"\n\n        if arg_1 is None:\n            arg_1 = ['\"']\n\n        arg_2 = \"\"\n        while True:\n            arg_3 = arg_0.raw_text[arg_0.index]\n            arg_0.index += 1\n            logging.debug(\"%s\", fmt_cyan(arg_3))\n\n            if arg_3 == \"\\\\\":\n                # We are on a backslash and there is another character after the backslash\n                # to parse. Handle this case specially since gdb escaped it for us\n\n                # Get the next char that is being escaped\n                arg_4 = arg_0.raw_text[arg_0.index]\n                arg_0.index += 1\n                # only store the escaped character in the buffer; don't store the backslash\n                # (don't leave it escaped)\n                arg_2 += arg_4\n\n            elif arg_3 == '\"':\n                # Quote is closed. Exit (and don't include the end quote).\n                break\n\n            else:\n                # capture this character, and keep capturing\n                arg_2 += arg_3\n        return arg_2", "path": "pygdbmi/StringStream.py", "identifier": "StringStream.advance_past_string_with_gdb_escapes", "docstring": "characters that gdb escapes that should not be\n        escaped by this parser", "docstring_tokens": ["characters", "that", "gdb", "escapes", "that", "should", "not", "be", "escaped", "by", "this", "parser"], "nwo": "cs01/pygdbmi", "score": 0.565001601112863, "idx": 257279}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/round_trips.py#L276-L319", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Appends transactions that close out all positions at the end of\n    the timespan covered by positions data. Utilizes pricing information\n    in the positions DataFrame to determine closing price.", "language": "python", "parameters": "(positions, transactions)", "return_statement": "return closed_txns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "[", "'symbol'", ",", "'amount'", ",", "'price'", "]", "]", "arg_3", "=", "arg_0", ".", "drop", "(", "'cash'", ",", "axis", "=", "1", ")", ".", "iloc", "[", "-", "1", "]", "arg_4", "=", "arg_3", ".", "replace", "(", "0", ",", "np", ".", "nan", ")", ".", "dropna", "(", ")", "arg_5", "=", "arg_4", ".", "name", "+", "pd", ".", "Timedelta", "(", "seconds", "=", "1", ")", "for", "arg_6", ",", "arg_7", "in", "arg_4", ".", "iteritems", "(", ")", ":", "arg_8", "=", "arg_1", "[", "arg_1", ".", "symbol", "==", "arg_6", "]", "arg_9", "=", "arg_8", ".", "amount", ".", "sum", "(", ")", "arg_10", "=", "arg_7", "/", "arg_9", "arg_11", "=", "{", "'symbol'", ":", "arg_6", ",", "'amount'", ":", "-", "arg_9", ",", "'price'", ":", "arg_10", "}", "arg_11", "=", "pd", ".", "DataFrame", "(", "arg_11", ",", "index", "=", "[", "arg_5", "]", ")", "arg_2", "=", "arg_2", ".", "append", "(", "arg_11", ")", "arg_2", "=", "arg_2", "[", "arg_2", ".", "amount", "!=", "0", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Appends transactions that close out all positions at the end of\n    the timespan covered by positions data. Utilizes pricing information\n    in the positions DataFrame to determine closing price.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        The positions that the strategy takes over time.\n    transactions : pd.DataFrame\n        Prices and amounts of executed round_trips. One row per trade.\n        - See full explanation in tears.create_full_tear_sheet\n\n    Returns\n    -------\n    closed_txns : pd.DataFrame\n        Transactions with closing transactions appended.\n    \"\"\"\n\n    arg_2 = arg_1[['symbol', 'amount', 'price']]\n\n    arg_3 = arg_0.drop('cash', axis=1).iloc[-1]\n    arg_4 = arg_3.replace(0, np.nan).dropna()\n    # Add closing round_trips one second after the close to be sure\n    # they don't conflict with other round_trips executed at that time.\n    arg_5 = arg_4.name + pd.Timedelta(seconds=1)\n\n    for arg_6, arg_7 in arg_4.iteritems():\n        arg_8 = arg_1[arg_1.symbol == arg_6]\n\n        arg_9 = arg_8.amount.sum()\n\n        arg_10 = arg_7 / arg_9\n        arg_11 = {'symbol': arg_6,\n                       'amount': -arg_9,\n                       'price': arg_10}\n\n        arg_11 = pd.DataFrame(arg_11, index=[arg_5])\n        arg_2 = arg_2.append(arg_11)\n\n    arg_2 = arg_2[arg_2.amount != 0]\n\n    return arg_2", "path": "pyfolio/round_trips.py", "identifier": "add_closing_transactions", "docstring": "Appends transactions that close out all positions at the end of\n    the timespan covered by positions data. Utilizes pricing information\n    in the positions DataFrame to determine closing price.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        The positions that the strategy takes over time.\n    transactions : pd.DataFrame\n        Prices and amounts of executed round_trips. One row per trade.\n        - See full explanation in tears.create_full_tear_sheet\n\n    Returns\n    -------\n    closed_txns : pd.DataFrame\n        Transactions with closing transactions appended.", "docstring_tokens": ["Appends", "transactions", "that", "close", "out", "all", "positions", "at", "the", "end", "of", "the", "timespan", "covered", "by", "positions", "data", ".", "Utilizes", "pricing", "information", "in", "the", "positions", "DataFrame", "to", "determine", "closing", "price", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257280}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L2636-L2643", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Sets byte if below.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "write", "(", "Operators", ".", "ITEBV", "(", "arg_1", ".", "size", ",", "arg_0", ".", "CF", ",", "1", ",", "0", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sets byte if below.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        \"\"\"\n        arg_1.write(Operators.ITEBV(arg_1.size, arg_0.CF, 1, 0))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.SETB", "docstring": "Sets byte if below.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Sets", "byte", "if", "below", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257281}
{"url": "https://github.com/cdriehuys/django-rest-email-auth/blob/7e752c4d77ae02d2d046f214f56e743aa12ab23f/rest_email_auth/serializers.py#L282-L295", "sha": "7e752c4d77ae02d2d046f214f56e743aa12ab23f", "docstring_summary": "Reset the user's password if the provided information is valid.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "models", ".", "PasswordResetToken", ".", "objects", ".", "get", "(", "key", "=", "arg_0", ".", "validated_data", "[", "\"key\"", "]", ")", "arg_1", ".", "email", ".", "user", ".", "set_password", "(", "arg_0", ".", "validated_data", "[", "\"password\"", "]", ")", "arg_1", ".", "email", ".", "user", ".", "Func", "(", ")", "logger", ".", "info", "(", "\"Reset password for %s\"", ",", "arg_1", ".", "email", ".", "user", ")", "arg_1", ".", "delete", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Reset the user's password if the provided information is valid.\n        \"\"\"\n        arg_1 = models.PasswordResetToken.objects.get(\n            key=arg_0.validated_data[\"key\"]\n        )\n\n        arg_1.email.user.set_password(arg_0.validated_data[\"password\"])\n        arg_1.email.user.Func()\n\n        logger.info(\"Reset password for %s\", arg_1.email.user)\n\n        arg_1.delete()", "path": "rest_email_auth/serializers.py", "identifier": "PasswordResetSerializer.save", "docstring": "Reset the user's password if the provided information is valid.", "docstring_tokens": ["Reset", "the", "user", "s", "password", "if", "the", "provided", "information", "is", "valid", "."], "nwo": "cdriehuys/django-rest-email-auth", "score": 0.28490879858232004, "idx": 257282}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2_operations.py#L101-L105", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return the operation's array of actions.", "language": "python", "parameters": "(op, action_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "get_actions", "(", "arg_0", ")", "if", "arg_2", "and", "1", "<=", "arg_1", "<", "len", "(", "arg_2", ")", ":", "return", "arg_2", "[", "arg_1", "-", "1", "]"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Return the operation's array of actions.\"\"\"\n  arg_2 = get_actions(arg_0)\n  if arg_2 and 1 <= arg_1 < len(arg_2):\n    return arg_2[arg_1 - 1]", "path": "dsub/providers/google_v2_operations.py", "identifier": "get_action_by_id", "docstring": "Return the operation's array of actions.", "docstring_tokens": ["Return", "the", "operation", "s", "array", "of", "actions", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 257283}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/native_contracts.py#L587-L606", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "create an object which acts as a proxy for the contract on the chain", "language": "python", "parameters": "(chain, sender, contract_address, value=0)", "return_statement": "return cproxy()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "0", ")", ":", "arg_4", "=", "registry", "[", "arg_2", "]", ".", "im_self", "assert", "issubclass", "(", "arg_4", ",", "NativeABIContract", ")", "def", "mk_method", "(", "arg_5", ")", ":", "def", "arg_11", "(", "arg_6", ",", "*", "arg_7", ")", ":", "arg_8", "=", "abi_encode_args", "(", "arg_5", ",", "arg_7", ")", "arg_9", "=", "arg_0", ".", "head_candidate", "arg_10", "=", "test_call", "(", "arg_9", ",", "arg_1", ",", "arg_2", ",", "arg_8", ")", "if", "arg_10", "is", "not", "None", ":", "return", "abi_decode_return_vals", "(", "arg_5", ",", "arg_10", ")", "return", "arg_11", "class", "cproxy", "(", "object", ")", ":", "pass", "for", "arg_11", "in", "arg_4", ".", "_abi_methods", "(", ")", ":", "setattr", "(", "cproxy", ",", "arg_11", ".", "__func__", ".", "func_name", ",", "mk_method", "(", "arg_11", ")", ")", "return", "cproxy", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=0):\n    \"create an object which acts as a proxy for the contract on the chain\"\n    arg_4 = registry[arg_2].im_self\n    assert issubclass(arg_4, NativeABIContract)\n\n    def mk_method(arg_5):\n        def arg_11(arg_6, *arg_7):\n            arg_8 = abi_encode_args(arg_5, arg_7)\n            arg_9 = arg_0.head_candidate\n            arg_10 = test_call(arg_9, arg_1, arg_2, arg_8)\n            if arg_10 is not None:\n                return abi_decode_return_vals(arg_5, arg_10)\n        return arg_11\n\n    class cproxy(object):\n        pass\n    for arg_11 in arg_4._abi_methods():\n        setattr(cproxy, arg_11.__func__.func_name, mk_method(arg_11))\n\n    return cproxy()", "path": "hydrachain/native_contracts.py", "identifier": "chain_nac_proxy", "docstring": "create an object which acts as a proxy for the contract on the chain", "docstring_tokens": ["create", "an", "object", "which", "acts", "as", "a", "proxy", "for", "the", "contract", "on", "the", "chain"], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 257284}
{"url": "https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/utils.py#L255-L333", "sha": "ecc9fd434c23d896ccd1f35795ccc047f946ed05", "docstring_summary": "Uses the MaxMind Geolite2 Country database to return the ISO code for the\n    country associated with the given IPv4 or IPv6 address", "language": "python", "parameters": "(ip_address, parallel=False)", "return_statement": "return country", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "def", "download_country_database", "(", "arg_2", "=", "\"GeoLite2-Country.mmdb\"", ")", ":", "if", "arg_1", ":", "logging", ".", "warning", "(", "\"Cannot download GeoIP database in parallel mode\"", ")", "return", "arg_3", "=", "\"https://geolite.maxmind.com/download/geoip/database/\"", "\"GeoLite2-Country.tar.gz\"", "arg_4", "=", "{", "\"User-Agent\"", ":", "USER_AGENT", "}", "arg_5", "=", "\"GeoLite2-Country.mmdb\"", "try", ":", "arg_6", "=", "requests", ".", "get", "(", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_6", ".", "raise_for_status", "(", ")", "arg_7", "=", "arg_6", ".", "content", "arg_8", "=", "tarfile", ".", "open", "(", "fileobj", "=", "BytesIO", "(", "arg_7", ")", ",", "mode", "=", "\"r:gz\"", ")", "arg_9", "=", "arg_8", ".", "getnames", "(", ")", "[", "0", "]", "arg_10", "=", "\"{0}/{1}\"", ".", "format", "(", "arg_9", ",", "arg_5", ")", "arg_8", ".", "extract", "(", "arg_10", ")", "shutil", ".", "move", "(", "arg_10", ",", "arg_2", ")", "shutil", ".", "rmtree", "(", "arg_9", ")", "except", "Exception", "as", "e", ":", "logger", ".", "warning", "(", "\"Error downloading {0}: {1}\"", ".", "format", "(", "arg_3", ",", "e", ".", "__str__", "(", ")", ")", ")", "arg_11", "=", "[", "\"GeoLite2-Country.mmdb\"", ",", "\"/usr/local/share/GeoIP/GeoLite2-Country.mmdb\"", ",", "\"/usr/share/GeoIP/GeoLite2-Country.mmdb\"", ",", "\"/var/lib/GeoIP/GeoLite2-Country.mmdb\"", ",", "\"/var/local/lib/GeoIP/GeoLite2-Country.mmdb\"", ",", "\"C:\\\\GeoIP\\\\GeoLite2-Country.mmdb\"", "]", "arg_12", "=", "None", "for", "arg_13", "in", "arg_11", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_13", ")", ":", "arg_12", "=", "arg_13", "break", "if", "arg_12", "is", "None", ":", "arg_12", "=", "os", ".", "path", ".", "join", "(", "tempdir", ",", "\"GeoLite2-Country.mmdb\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_12", ")", ":", "download_country_database", "(", "arg_12", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_12", ")", ":", "return", "None", "else", ":", "arg_14", "=", "datetime", ".", "now", "(", ")", "-", "datetime", ".", "fromtimestamp", "(", "os", ".", "stat", "(", "arg_12", ")", ".", "st_mtime", ")", "if", "arg_14", ">", "timedelta", "(", "days", "=", "7", ")", ":", "download_country_database", "(", ")", "arg_12", "=", "arg_12", "arg_15", "=", "geoip2", ".", "database", ".", "Reader", "(", "arg_12", ")", "arg_16", "=", "None", "try", ":", "arg_16", "=", "arg_15", ".", "country", "(", "arg_0", ")", ".", "country", ".", "iso_code", "except", "geoip2", ".", "errors", ".", "AddressNotFoundError", ":", "pass", "return", "arg_16"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Uses the MaxMind Geolite2 Country database to return the ISO code for the\n    country associated with the given IPv4 or IPv6 address\n\n    Args:\n        ip_address (str): The IP address to query for\n        parallel (bool): Parallel processing\n\n    Returns:\n        str: And ISO country code associated with the given IP address\n    \"\"\"\n    def download_country_database(arg_2=\"GeoLite2-Country.mmdb\"):\n        \"\"\"Downloads the MaxMind Geolite2 Country database\n\n        Args:\n            location (str): Local location for the database file\n        \"\"\"\n        if arg_1:\n            logging.warning(\"Cannot download GeoIP database in parallel mode\")\n            return\n        arg_3 = \"https://geolite.maxmind.com/download/geoip/database/\" \\\n              \"GeoLite2-Country.tar.gz\"\n        # Use a browser-like user agent string to bypass some proxy blocks\n        arg_4 = {\"User-Agent\": USER_AGENT}\n        arg_5 = \"GeoLite2-Country.mmdb\"\n        try:\n            arg_6 = requests.get(arg_3, arg_4=arg_4)\n            arg_6.raise_for_status()\n            arg_7 = arg_6.content\n            arg_8 = tarfile.open(fileobj=BytesIO(arg_7), mode=\"r:gz\")\n            arg_9 = arg_8.getnames()[0]\n            arg_10 = \"{0}/{1}\".format(arg_9, arg_5)\n            arg_8.extract(arg_10)\n            shutil.move(arg_10, arg_2)\n            shutil.rmtree(arg_9)\n        except Exception as e:\n            logger.warning(\"Error downloading {0}: {1}\".format(arg_3,\n                                                               e.__str__()))\n\n    arg_11 = [\n        \"GeoLite2-Country.mmdb\",\n        \"/usr/local/share/GeoIP/GeoLite2-Country.mmdb\",\n        \"/usr/share/GeoIP/GeoLite2-Country.mmdb\",\n        \"/var/lib/GeoIP/GeoLite2-Country.mmdb\",\n        \"/var/local/lib/GeoIP/GeoLite2-Country.mmdb\",\n        \"C:\\\\GeoIP\\\\GeoLite2-Country.mmdb\"\n    ]\n\n    arg_12 = None\n\n    for arg_13 in arg_11:\n        if os.path.exists(arg_13):\n            arg_12 = arg_13\n            break\n\n    if arg_12 is None:\n        arg_12 = os.path.join(tempdir, \"GeoLite2-Country.mmdb\")\n        if not os.path.exists(arg_12):\n            download_country_database(arg_12)\n            if not os.path.exists(arg_12):\n                return None\n        else:\n            arg_14 = datetime.now() - datetime.fromtimestamp(\n                os.stat(arg_12).st_mtime)\n            if arg_14 > timedelta(days=7):\n                download_country_database()\n        arg_12 = arg_12\n\n    arg_15 = geoip2.database.Reader(arg_12)\n\n    arg_16 = None\n\n    try:\n        arg_16 = arg_15.country(arg_0).country.iso_code\n    except geoip2.errors.AddressNotFoundError:\n        pass\n\n    return arg_16", "path": "parsedmarc/utils.py", "identifier": "get_ip_address_country", "docstring": "Uses the MaxMind Geolite2 Country database to return the ISO code for the\n    country associated with the given IPv4 or IPv6 address\n\n    Args:\n        ip_address (str): The IP address to query for\n        parallel (bool): Parallel processing\n\n    Returns:\n        str: And ISO country code associated with the given IP address", "docstring_tokens": ["Uses", "the", "MaxMind", "Geolite2", "Country", "database", "to", "return", "the", "ISO", "code", "for", "the", "country", "associated", "with", "the", "given", "IPv4", "or", "IPv6", "address"], "nwo": "domainaware/parsedmarc", "score": 0.7452768887820926, "idx": 257285}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/ext/readcol.py#L259-L265", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Convert into numpy recordarray", "language": "python", "parameters": "(self)", "return_statement": "return R", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "(", "k", ",", "v", ".", "dtype", ")", "for", "k", ",", "v", "in", "arg_0", ".", "__dict__", ".", "iteritems", "(", ")", "]", "arg_2", "=", "numpy", ".", "recarray", "(", "len", "(", "arg_0", ".", "__dict__", "[", "k", "]", ")", ",", "arg_1", "=", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "__dict__", ":", "arg_2", "[", "arg_3", "]", "=", "arg_0", ".", "__dict__", "[", "arg_3", "]", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" Convert into numpy recordarray \"\"\"\n        arg_1 = [(k,v.dtype) for k,v in arg_0.__dict__.iteritems()]\n        arg_2 = numpy.recarray(len(arg_0.__dict__[k]),arg_1=arg_1)\n        for arg_3 in arg_0.__dict__:\n            arg_2[arg_3] = arg_0.__dict__[arg_3]\n        return arg_2", "path": "packages/vaex-core/vaex/ext/readcol.py", "identifier": "Struct.as_recarray", "docstring": "Convert into numpy recordarray", "docstring_tokens": ["Convert", "into", "numpy", "recordarray"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257286}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L2306-L2412", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Verifies an RSA, DSA or ECDSA signature via CryptoAPI", "language": "python", "parameters": "(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", ".", "algorithm", "if", "arg_5", "==", "'rsa'", "and", "arg_4", ":", "arg_6", "=", "{", "'sha1'", ":", "20", ",", "'sha224'", ":", "28", ",", "'sha256'", ":", "32", ",", "'sha384'", ":", "48", ",", "'sha512'", ":", "64", "}", ".", "get", "(", "arg_3", ",", "0", ")", "arg_7", "=", "raw_rsa_public_crypt", "(", "arg_0", ",", "arg_1", ")", "arg_8", "=", "arg_0", ".", "bit_size", "if", "not", "verify_pss_padding", "(", "arg_3", ",", "arg_6", ",", "arg_8", ",", "arg_2", ",", "arg_7", ")", ":", "raise", "SignatureError", "(", "'Signature is invalid'", ")", "return", "if", "arg_5", "==", "'rsa'", "and", "arg_3", "==", "'raw'", ":", "arg_9", "=", "raw_rsa_public_crypt", "(", "arg_0", ",", "arg_1", ")", "try", ":", "arg_10", "=", "remove_pkcs1v15_signature_padding", "(", "arg_0", ".", "byte_size", ",", "arg_9", ")", "if", "not", "constant_compare", "(", "arg_10", ",", "arg_2", ")", ":", "raise", "ValueError", "(", ")", "except", "(", "ValueError", ")", ":", "raise", "SignatureError", "(", "'Signature is invalid'", ")", "return", "arg_11", "=", "None", "try", ":", "arg_12", "=", "{", "'md5'", ":", "Advapi32Const", ".", "CALG_MD5", ",", "'sha1'", ":", "Advapi32Const", ".", "CALG_SHA1", ",", "'sha256'", ":", "Advapi32Const", ".", "CALG_SHA_256", ",", "'sha384'", ":", "Advapi32Const", ".", "CALG_SHA_384", ",", "'sha512'", ":", "Advapi32Const", ".", "CALG_SHA_512", ",", "}", "[", "arg_3", "]", "arg_13", "=", "new", "(", "advapi32", ",", "'HCRYPTHASH *'", ")", "arg_14", "=", "advapi32", ".", "CryptCreateHash", "(", "arg_0", ".", "context_handle", ",", "arg_12", ",", "null", "(", ")", ",", "0", ",", "arg_13", ")", "handle_error", "(", "arg_14", ")", "arg_11", "=", "unwrap", "(", "arg_13", ")", "arg_14", "=", "advapi32", ".", "CryptHashData", "(", "arg_11", ",", "arg_2", ",", "len", "(", "arg_2", ")", ",", "0", ")", "handle_error", "(", "arg_14", ")", "if", "arg_5", "==", "'dsa'", ":", "try", ":", "arg_1", "=", "algos", ".", "DSASignature", ".", "load", "(", "arg_1", ")", ".", "to_p1363", "(", ")", "arg_15", "=", "len", "(", "arg_1", ")", "//", "2", "arg_1", "=", "arg_1", "[", "arg_15", ":", "]", "+", "arg_1", "[", ":", "arg_15", "]", "except", "(", "ValueError", ",", "OverflowError", ",", "TypeError", ")", ":", "raise", "SignatureError", "(", "'Signature is invalid'", ")", "arg_16", "=", "arg_1", "[", ":", ":", "-", "1", "]", "arg_14", "=", "advapi32", ".", "CryptVerifySignatureW", "(", "arg_11", ",", "arg_16", ",", "len", "(", "arg_1", ")", ",", "arg_0", ".", "key_handle", ",", "null", "(", ")", ",", "0", ")", "handle_error", "(", "arg_14", ")", "finally", ":", "if", "arg_11", ":", "advapi32", ".", "CryptDestroyHash", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):\n    \"\"\"\n    Verifies an RSA, DSA or ECDSA signature via CryptoAPI\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to verify the signature with\n\n    :param signature:\n        A byte string of the signature to verify\n\n    :param data:\n        A byte string of the data the signature is for\n\n    :param hash_algorithm:\n        A unicode string of \"md5\", \"sha1\", \"sha256\", \"sha384\", \"sha512\" or \"raw\"\n\n    :param rsa_pss_padding:\n        If PSS padding should be used for RSA keys\n\n    :raises:\n        oscrypto.errors.SignatureError - when the signature is determined to be invalid\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library\n    \"\"\"\n\n    arg_5 = arg_0.algorithm\n\n    if arg_5 == 'rsa' and arg_4:\n        arg_6 = {\n            'sha1': 20,\n            'sha224': 28,\n            'sha256': 32,\n            'sha384': 48,\n            'sha512': 64\n        }.get(arg_3, 0)\n        arg_7 = raw_rsa_public_crypt(arg_0, arg_1)\n        arg_8 = arg_0.bit_size\n        if not verify_pss_padding(arg_3, arg_6, arg_8, arg_2, arg_7):\n            raise SignatureError('Signature is invalid')\n        return\n\n    if arg_5 == 'rsa' and arg_3 == 'raw':\n        arg_9 = raw_rsa_public_crypt(arg_0, arg_1)\n        try:\n            arg_10 = remove_pkcs1v15_signature_padding(arg_0.byte_size, arg_9)\n            if not constant_compare(arg_10, arg_2):\n                raise ValueError()\n        except (ValueError):\n            raise SignatureError('Signature is invalid')\n        return\n\n    arg_11 = None\n\n    try:\n        arg_12 = {\n            'md5': Advapi32Const.CALG_MD5,\n            'sha1': Advapi32Const.CALG_SHA1,\n            'sha256': Advapi32Const.CALG_SHA_256,\n            'sha384': Advapi32Const.CALG_SHA_384,\n            'sha512': Advapi32Const.CALG_SHA_512,\n        }[arg_3]\n\n        arg_13 = new(advapi32, 'HCRYPTHASH *')\n        arg_14 = advapi32.CryptCreateHash(\n            arg_0.context_handle,\n            arg_12,\n            null(),\n            0,\n            arg_13\n        )\n        handle_error(arg_14)\n\n        arg_11 = unwrap(arg_13)\n\n        arg_14 = advapi32.CryptHashData(arg_11, arg_2, len(arg_2), 0)\n        handle_error(arg_14)\n\n        if arg_5 == 'dsa':\n            # Windows doesn't use the ASN.1 Sequence for DSA signatures,\n            # so we have to convert it here for the verification to work\n            try:\n                arg_1 = algos.DSASignature.load(arg_1).to_p1363()\n                # Switch the two integers so that the reversal later will\n                # result in the correct order\n                arg_15 = len(arg_1) // 2\n                arg_1 = arg_1[arg_15:] + arg_1[:arg_15]\n            except (ValueError, OverflowError, TypeError):\n                raise SignatureError('Signature is invalid')\n\n        # The CryptoAPI expects signatures to be in little endian byte order,\n        # which is the opposite of other systems, so we must reverse it\n        arg_16 = arg_1[::-1]\n\n        arg_14 = advapi32.CryptVerifySignatureW(\n            arg_11,\n            arg_16,\n            len(arg_1),\n            arg_0.key_handle,\n            null(),\n            0\n        )\n        handle_error(arg_14)\n\n    finally:\n        if arg_11:\n            advapi32.CryptDestroyHash(arg_11)", "path": "oscrypto/_win/asymmetric.py", "identifier": "_advapi32_verify", "docstring": "Verifies an RSA, DSA or ECDSA signature via CryptoAPI\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to verify the signature with\n\n    :param signature:\n        A byte string of the signature to verify\n\n    :param data:\n        A byte string of the data the signature is for\n\n    :param hash_algorithm:\n        A unicode string of \"md5\", \"sha1\", \"sha256\", \"sha384\", \"sha512\" or \"raw\"\n\n    :param rsa_pss_padding:\n        If PSS padding should be used for RSA keys\n\n    :raises:\n        oscrypto.errors.SignatureError - when the signature is determined to be invalid\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library", "docstring_tokens": ["Verifies", "an", "RSA", "DSA", "or", "ECDSA", "signature", "via", "CryptoAPI"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 257287}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1154-L1164", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Parse ``make_ndx`` output and return groups as a list of dicts.", "language": "python", "parameters": "(output)", "return_statement": "return groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "split", "(", "'\\n'", ")", ":", "arg_3", "=", "NDXGROUP", ".", "match", "(", "arg_2", ")", "if", "arg_3", ":", "arg_4", "=", "arg_3", ".", "groupdict", "(", ")", "arg_1", ".", "append", "(", "{", "'name'", ":", "arg_4", "[", "'GROUPNAME'", "]", ",", "'nr'", ":", "int", "(", "arg_4", "[", "'GROUPNUMBER'", "]", ")", ",", "'natoms'", ":", "int", "(", "arg_4", "[", "'NATOMS'", "]", ")", "}", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse ``make_ndx`` output and return groups as a list of dicts.\"\"\"\n    arg_1 = []\n    for arg_2 in arg_0.split('\\n'):\n        arg_3 = NDXGROUP.match(arg_2)\n        if arg_3:\n            arg_4 = arg_3.groupdict()\n            arg_1.append({'name': arg_4['GROUPNAME'],\n                           'nr': int(arg_4['GROUPNUMBER']),\n                           'natoms': int(arg_4['NATOMS'])})\n    return arg_1", "path": "gromacs/cbook.py", "identifier": "parse_groups", "docstring": "Parse ``make_ndx`` output and return groups as a list of dicts.", "docstring_tokens": ["Parse", "make_ndx", "output", "and", "return", "groups", "as", "a", "list", "of", "dicts", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 257288}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L978-L994", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Given a KeyboardModifiers flags object, return whether the Control\n        key is down.", "language": "python", "parameters": "(self, modifiers, include_command=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "sys", ".", "platform", "==", "'darwin'", ":", "arg_3", "=", "arg_2", "and", "(", "arg_1", "&", "QtCore", ".", "Qt", ".", "ControlModifier", ")", "return", "bool", "(", "arg_3", ")", "^", "bool", "(", "arg_1", "&", "QtCore", ".", "Qt", ".", "MetaModifier", ")", "else", ":", "return", "bool", "(", "arg_1", "&", "QtCore", ".", "Qt", ".", "ControlModifier", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\" Given a KeyboardModifiers flags object, return whether the Control\n        key is down.\n\n        Parameters:\n        -----------\n        include_command : bool, optional (default True)\n            Whether to treat the Command key as a (mutually exclusive) synonym\n            for Control when in Mac OS.\n        \"\"\"\n        # Note that on Mac OS, ControlModifier corresponds to the Command key\n        # while MetaModifier corresponds to the Control key.\n        if sys.platform == 'darwin':\n            arg_3 = arg_2 and (arg_1 & QtCore.Qt.ControlModifier)\n            return bool(arg_3) ^ bool(arg_1 & QtCore.Qt.MetaModifier)\n        else:\n            return bool(arg_1 & QtCore.Qt.ControlModifier)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._control_key_down", "docstring": "Given a KeyboardModifiers flags object, return whether the Control\n        key is down.\n\n        Parameters:\n        -----------\n        include_command : bool, optional (default True)\n            Whether to treat the Command key as a (mutually exclusive) synonym\n            for Control when in Mac OS.", "docstring_tokens": ["Given", "a", "KeyboardModifiers", "flags", "object", "return", "whether", "the", "Control", "key", "is", "down", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257289}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/annotations.py#L72-L81", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns annotations as dictionary.", "language": "python", "parameters": "(self, copy=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", ":", "return", "arg_0", ".", "_dict", ".", "copy", "(", ")", "else", ":", "return", "arg_0", ".", "_dict"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Returns annotations as dictionary.\n\n        :param copy: Whether to return a shallow copy or the real thing (aka _dict).\n\n        \"\"\"\n        if arg_1:\n            return arg_0._dict.copy()\n        else:\n            return arg_0._dict", "path": "pypet/annotations.py", "identifier": "Annotations.f_to_dict", "docstring": "Returns annotations as dictionary.\n\n        :param copy: Whether to return a shallow copy or the real thing (aka _dict).", "docstring_tokens": ["Returns", "annotations", "as", "dictionary", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257290}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L341-L353", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return the first argument in the args that has the given name.", "language": "python", "parameters": "(name: str, args: Iterable[Argument])", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", ")", "->", "Optional", "[", "arg_4", "]", ":", "for", "arg_5", "in", "arg_2", ":", "if", "arg_5", ".", "name", ".", "strip", "(", "WS", ")", "==", "arg_0", ".", "strip", "(", "WS", ")", ":", "return", "arg_5", "return", "None"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4]) -> Optional[arg_4]:\n    \"\"\"Return the first argument in the args that has the given name.\n\n    Return None if no such argument is found.\n\n    As the computation of self.arguments is a little costly, this\n    function was created so that other methods that have already computed\n    the arguments use it instead of calling self.Func directly.\n    \"\"\"\n    for arg_5 in arg_2:\n        if arg_5.name.strip(WS) == arg_0.strip(WS):\n            return arg_5\n    return None", "path": "wikitextparser/_template.py", "identifier": "get_arg", "docstring": "Return the first argument in the args that has the given name.\n\n    Return None if no such argument is found.\n\n    As the computation of self.arguments is a little costly, this\n    function was created so that other methods that have already computed\n    the arguments use it instead of calling self.get_arg directly.", "docstring_tokens": ["Return", "the", "first", "argument", "in", "the", "args", "that", "has", "the", "given", "name", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 257291}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L22-L30", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Show character in readable format", "language": "python", "parameters": "(c)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "32", "<", "arg_0", "<", "127", ":", "return", "chr", "(", "arg_0", ")", "elif", "arg_0", "==", "10", ":", "return", "'\\\\n'", "elif", "arg_0", "==", "13", ":", "return", "'\\\\r'", "elif", "arg_0", "==", "32", ":", "return", "'\" \"'", "else", ":", "return", "'\\\\x{:02x}'", ".", "format", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Show character in readable format\n    \"\"\"\n    #TODO 2: allow hex only output\n    if 32<arg_0<127: return chr(arg_0)\n    elif arg_0==10: return '\\\\n'\n    elif arg_0==13: return '\\\\r'\n    elif arg_0==32: return '\" \"'\n    else: return '\\\\x{:02x}'.format(arg_0)", "path": "research/brotlidump.py", "identifier": "outputCharFormatter", "docstring": "Show character in readable format", "docstring_tokens": ["Show", "character", "in", "readable", "format"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 257292}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L944-L982", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Read the list commits from the repository", "language": "python", "parameters": "(self, branches=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", ".", "is_empty", "(", ")", ":", "logger", ".", "warning", "(", "\"Git %s repository is empty; unable to get the rev-list\"", ",", "arg_0", ".", "uri", ")", "raise", "EmptyRepositoryError", "(", "repository", "=", "arg_0", ".", "uri", ")", "arg_2", "=", "[", "'git'", ",", "'rev-list'", ",", "'--topo-order'", "]", "if", "arg_1", "is", "None", ":", "arg_2", ".", "extend", "(", "[", "'--branches'", ",", "'--tags'", ",", "'--remotes=origin'", "]", ")", "elif", "len", "(", "arg_1", ")", "==", "0", ":", "arg_2", ".", "extend", "(", "[", "'--branches'", ",", "'--tags'", ",", "'--max-count=0'", "]", ")", "else", ":", "arg_1", "=", "[", "'refs/heads/'", "+", "branch", "for", "branch", "in", "arg_1", "]", "arg_2", ".", "extend", "(", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "_exec_nb", "(", "arg_2", ",", "cwd", "=", "arg_0", ".", "dirpath", ",", "env", "=", "arg_0", ".", "gitenv", ")", ":", "yield", "arg_3", ".", "rstrip", "(", "'\\n'", ")", "logger", ".", "debug", "(", "\"Git rev-list fetched from %s repository (%s)\"", ",", "arg_0", ".", "uri", ",", "arg_0", ".", "dirpath", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Read the list commits from the repository\n\n        The list of branches is a list of strings, with the names of the\n        branches to fetch. If the list of branches is empty, no commit\n        is fetched. If the list of branches is None, all commits\n        for all branches will be fetched.\n\n        The method returns the Git rev-list of the repository using the\n        following options:\n\n            git rev-list --topo-order\n\n        :param branches: names of branches to fetch from (default: None)\n\n        :raises EmptyRepositoryError: when the repository is empty and\n            the action cannot be performed\n        :raises RepositoryError: when an error occurs executing the command\n        \"\"\"\n        if arg_0.is_empty():\n            logger.warning(\"Git %s repository is empty; unable to get the rev-list\",\n                           arg_0.uri)\n            raise EmptyRepositoryError(repository=arg_0.uri)\n\n        arg_2 = ['git', 'rev-list', '--topo-order']\n\n        if arg_1 is None:\n            arg_2.extend(['--branches', '--tags', '--remotes=origin'])\n        elif len(arg_1) == 0:\n            arg_2.extend(['--branches', '--tags', '--max-count=0'])\n        else:\n            arg_1 = ['refs/heads/' + branch for branch in arg_1]\n            arg_2.extend(arg_1)\n\n        for arg_3 in arg_0._exec_nb(arg_2, cwd=arg_0.dirpath, env=arg_0.gitenv):\n            yield arg_3.rstrip('\\n')\n\n        logger.debug(\"Git rev-list fetched from %s repository (%s)\",\n                     arg_0.uri, arg_0.dirpath)", "path": "perceval/backends/core/git.py", "identifier": "GitRepository.rev_list", "docstring": "Read the list commits from the repository\n\n        The list of branches is a list of strings, with the names of the\n        branches to fetch. If the list of branches is empty, no commit\n        is fetched. If the list of branches is None, all commits\n        for all branches will be fetched.\n\n        The method returns the Git rev-list of the repository using the\n        following options:\n\n            git rev-list --topo-order\n\n        :param branches: names of branches to fetch from (default: None)\n\n        :raises EmptyRepositoryError: when the repository is empty and\n            the action cannot be performed\n        :raises RepositoryError: when an error occurs executing the command", "docstring_tokens": ["Read", "the", "list", "commits", "from", "the", "repository"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257293}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/typechecks.py#L606-L647", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return the name of the provided type.", "language": "python", "parameters": "(vtype, dump=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "return", "\"None\"", "if", "arg_0", "is", "str", ":", "return", "\"string\"", "if", "arg_0", "is", "int", ":", "return", "\"integer\"", "if", "arg_0", "is", "numeric", ":", "return", "\"numeric\"", "if", "is_type", "(", "arg_0", ",", "str", ")", ":", "return", "'\"%s\"'", "%", "repr", "(", "arg_0", ")", "[", "1", ":", "-", "1", "]", "if", "is_type", "(", "arg_0", ",", "int", ")", ":", "return", "str", "(", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "MagicType", ")", ":", "return", "arg_0", ".", "name", "(", "arg_1", ")", "if", "isinstance", "(", "arg_0", ",", "type", ")", ":", "return", "arg_0", ".", "__name__", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "return", "\"list(%s)\"", "%", "Func", "(", "U", "(", "*", "arg_0", ")", ",", "arg_1", ")", "if", "isinstance", "(", "arg_0", ",", "set", ")", ":", "return", "\"set(%s)\"", "%", "Func", "(", "U", "(", "*", "arg_0", ")", ",", "arg_1", ")", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "return", "\"(%s)\"", "%", "\", \"", ".", "join", "(", "Func", "(", "arg_2", ",", "arg_1", ")", "for", "arg_2", "in", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "return", "\"dict(%s)\"", "%", "\", \"", ".", "join", "(", "\"%s: %s\"", "%", "(", "Func", "(", "arg_3", ",", "arg_1", ")", ",", "Func", "(", "arg_4", ",", "arg_1", ")", ")", "for", "arg_3", ",", "arg_4", "in", "viewitems", "(", "arg_0", ")", ")", "if", "isinstance", "(", "arg_0", ",", "(", "FunctionType", ",", "BuiltinFunctionType", ")", ")", ":", "if", "arg_0", ".", "__name__", "==", "\"<lambda>\"", ":", "return", "_get_lambda_source_code", "(", "arg_0", ",", "arg_1", ")", "else", ":", "return", "arg_0", ".", "__name__", "raise", "RuntimeError", "(", "\"Unexpected `vtype`: %r\"", "%", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Return the name of the provided type.\n\n        Func(int) == \"integer\"\n        Func(str) == \"string\"\n        Func(tuple) == \"tuple\"\n        Func(Exception) == \"Exception\"\n        Func(U(int, float, bool)) == \"integer|float|bool\"\n        Func(U(H2OFrame, None)) == \"?H2OFrame\"\n    \"\"\"\n    if arg_0 is None:\n        return \"None\"\n    if arg_0 is str:\n        return \"string\"\n    if arg_0 is int:\n        return \"integer\"\n    if arg_0 is numeric:\n        return \"numeric\"\n    if is_type(arg_0, str):\n        return '\"%s\"' % repr(arg_0)[1:-1]\n    if is_type(arg_0, int):\n        return str(arg_0)\n    if isinstance(arg_0, MagicType):\n        return arg_0.name(arg_1)\n    if isinstance(arg_0, type):\n        return arg_0.__name__\n    if isinstance(arg_0, list):\n        return \"list(%s)\" % Func(U(*arg_0), arg_1)\n    if isinstance(arg_0, set):\n        return \"set(%s)\" % Func(U(*arg_0), arg_1)\n    if isinstance(arg_0, tuple):\n        return \"(%s)\" % \", \".join(Func(arg_2, arg_1) for arg_2 in arg_0)\n    if isinstance(arg_0, dict):\n        return \"dict(%s)\" % \", \".join(\"%s: %s\" % (Func(arg_3, arg_1), Func(arg_4, arg_1))\n                                      for arg_3, arg_4 in viewitems(arg_0))\n    if isinstance(arg_0, (FunctionType, BuiltinFunctionType)):\n        if arg_0.__name__ == \"<lambda>\":\n            return _get_lambda_source_code(arg_0, arg_1)\n        else:\n            return arg_0.__name__\n    raise RuntimeError(\"Unexpected `vtype`: %r\" % arg_0)", "path": "h2o-py/h2o/utils/typechecks.py", "identifier": "_get_type_name", "docstring": "Return the name of the provided type.\n\n        _get_type_name(int) == \"integer\"\n        _get_type_name(str) == \"string\"\n        _get_type_name(tuple) == \"tuple\"\n        _get_type_name(Exception) == \"Exception\"\n        _get_type_name(U(int, float, bool)) == \"integer|float|bool\"\n        _get_type_name(U(H2OFrame, None)) == \"?H2OFrame\"", "docstring_tokens": ["Return", "the", "name", "of", "the", "provided", "type", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257294}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/trello.py#L161-L178", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Returns an iterator for the cards in a given list, filtered\n        according to configuration values of trello.only_if_assigned and\n        trello.also_unassigned", "language": "python", "parameters": "(self, list_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'fields'", ":", "'name,idShort,shortLink,shortUrl,url,labels,due'", "}", "arg_3", "=", "arg_0", ".", "config", ".", "get", "(", "'only_if_assigned'", ",", "None", ")", "arg_4", "=", "arg_0", ".", "config", ".", "get", "(", "'also_unassigned'", ",", "False", ",", "asbool", ")", "if", "arg_3", "is", "not", "None", ":", "arg_2", "[", "'members'", "]", "=", "'true'", "arg_2", "[", "'member_fields'", "]", "=", "'username'", "arg_5", "=", "arg_0", ".", "api_request", "(", "\"/1/lists/{list_id}/cards/open\"", ".", "format", "(", "arg_1", "=", "arg_1", ")", ",", "**", "arg_2", ")", "for", "arg_6", "in", "arg_5", ":", "if", "(", "arg_3", "is", "None", "or", "arg_3", "in", "[", "arg_7", "[", "'username'", "]", "for", "arg_7", "in", "arg_6", "[", "'members'", "]", "]", "or", "(", "arg_4", "and", "not", "arg_6", "[", "'members'", "]", ")", ")", ":", "yield", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns an iterator for the cards in a given list, filtered\n        according to configuration values of trello.only_if_assigned and\n        trello.also_unassigned \"\"\"\n        arg_2 = {'fields': 'name,idShort,shortLink,shortUrl,url,labels,due'}\n        arg_3 = arg_0.config.get('only_if_assigned', None)\n        arg_4 = arg_0.config.get('also_unassigned', False, asbool)\n        if arg_3 is not None:\n            arg_2['members'] = 'true'\n            arg_2['member_fields'] = 'username'\n        arg_5 = arg_0.api_request(\n            \"/1/lists/{list_id}/cards/open\".format(arg_1=arg_1),\n            **arg_2)\n        for arg_6 in arg_5:\n            if (arg_3 is None\n                    or arg_3 in [arg_7['username'] for arg_7 in arg_6['members']]\n                    or (arg_4 and not arg_6['members'])):\n                yield arg_6", "path": "bugwarrior/services/trello.py", "identifier": "TrelloService.get_cards", "docstring": "Returns an iterator for the cards in a given list, filtered\n        according to configuration values of trello.only_if_assigned and\n        trello.also_unassigned", "docstring_tokens": ["Returns", "an", "iterator", "for", "the", "cards", "in", "a", "given", "list", "filtered", "according", "to", "configuration", "values", "of", "trello", ".", "only_if_assigned", "and", "trello", ".", "also_unassigned"], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 257295}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1107-L1147", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Receive updates to the packing plan from the statemgrs and update processes as needed.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Log", ".", "info", "(", "\"Start state manager watches\"", ")", "arg_1", "=", "StateMgrConfig", "(", ")", "arg_1", ".", "set_state_locations", "(", "configloader", ".", "load_state_manager_locations", "(", "arg_0", ".", "cluster", ",", "state_manager_config_file", "=", "arg_0", ".", "state_manager_config_file", ",", "overrides", "=", "{", "\"heron.statemgr.connection.string\"", ":", "arg_0", ".", "state_manager_connection", "}", ")", ")", "try", ":", "arg_0", ".", "state_managers", "=", "statemanagerfactory", ".", "get_all_state_managers", "(", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "state_managers", ":", "arg_3", ".", "start", "(", ")", "except", "Exception", "as", "ex", ":", "Log", ".", "error", "(", "\"Found exception while initializing state managers: %s. Bailing out...\"", "%", "ex", ")", "traceback", ".", "print_exc", "(", ")", "sys", ".", "exit", "(", "1", ")", "def", "on_packing_plan_watch", "(", "arg_3", ",", "arg_4", ")", ":", "Log", ".", "debug", "(", "\"State watch triggered for PackingPlan update on shard %s. Existing: %s, New: %s\"", "%", "(", "arg_0", ".", "shard", ",", "str", "(", "arg_0", ".", "packing_plan", ")", ",", "str", "(", "arg_4", ")", ")", ")", "if", "arg_0", ".", "packing_plan", "!=", "arg_4", ":", "Log", ".", "info", "(", "\"PackingPlan change detected on shard %s, relaunching effected processes.\"", "%", "arg_0", ".", "shard", ")", "arg_0", ".", "update_packing_plan", "(", "arg_4", ")", "Log", ".", "info", "(", "\"Updating executor processes\"", ")", "arg_0", ".", "launch", "(", ")", "else", ":", "Log", ".", "info", "(", "\"State watch triggered for PackingPlan update but plan not changed so not relaunching.\"", ")", "for", "arg_3", "in", "arg_0", ".", "state_managers", ":", "arg_5", "=", "functools", ".", "partial", "(", "on_packing_plan_watch", ",", "arg_3", ")", "arg_3", ".", "get_packing_plan", "(", "arg_0", ".", "topology_name", ",", "arg_5", ")", "Log", ".", "info", "(", "\"Registered state watch for packing plan changes with state manager %s.\"", "%", "str", "(", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Receive updates to the packing plan from the statemgrs and update processes as needed.\n    \"\"\"\n    Log.info(\"Start state manager watches\")\n    arg_1 = StateMgrConfig()\n    arg_1.set_state_locations(configloader.load_state_manager_locations(\n        arg_0.cluster, state_manager_config_file=arg_0.state_manager_config_file,\n        overrides={\"heron.statemgr.connection.string\": arg_0.state_manager_connection}))\n    try:\n      arg_0.state_managers = statemanagerfactory.get_all_state_managers(arg_1)\n      for arg_3 in arg_0.state_managers:\n        arg_3.start()\n    except Exception as ex:\n      Log.error(\"Found exception while initializing state managers: %s. Bailing out...\" % ex)\n      traceback.print_exc()\n      sys.exit(1)\n\n    # pylint: disable=unused-argument\n    def on_packing_plan_watch(arg_3, arg_4):\n      Log.debug(\"State watch triggered for PackingPlan update on shard %s. Existing: %s, New: %s\" %\n                (arg_0.shard, str(arg_0.packing_plan), str(arg_4)))\n\n      if arg_0.packing_plan != arg_4:\n        Log.info(\"PackingPlan change detected on shard %s, relaunching effected processes.\"\n                 % arg_0.shard)\n        arg_0.update_packing_plan(arg_4)\n\n        Log.info(\"Updating executor processes\")\n        arg_0.launch()\n      else:\n        Log.info(\n            \"State watch triggered for PackingPlan update but plan not changed so not relaunching.\")\n\n    for arg_3 in arg_0.state_managers:\n      # The callback function with the bound\n      # state_manager as first variable.\n      arg_5 = functools.partial(on_packing_plan_watch, arg_3)\n      arg_3.get_packing_plan(arg_0.topology_name, arg_5)\n      Log.info(\"Registered state watch for packing plan changes with state manager %s.\" %\n               str(arg_3))", "path": "heron/executor/src/python/heron_executor.py", "identifier": "HeronExecutor.start_state_manager_watches", "docstring": "Receive updates to the packing plan from the statemgrs and update processes as needed.", "docstring_tokens": ["Receive", "updates", "to", "the", "packing", "plan", "from", "the", "statemgrs", "and", "update", "processes", "as", "needed", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257296}
{"url": "https://github.com/python/performance/blob/2a9524c0a5714e85106671bc61d750e800fe17db/performance/compare.py#L89-L103", "sha": "2a9524c0a5714e85106671bc61d750e800fe17db", "docstring_summary": "Calculate a t-test score for the difference between two samples.", "language": "python", "parameters": "(sample1, sample2)", "return_statement": "return diff / math.sqrt(error * 2)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_0", ")", "!=", "len", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "\"different number of values\"", ")", "arg_2", "=", "pooled_sample_variance", "(", "arg_0", ",", "arg_1", ")", "/", "len", "(", "arg_0", ")", "arg_3", "=", "statistics", ".", "mean", "(", "arg_0", ")", "-", "statistics", ".", "mean", "(", "arg_1", ")", "return", "arg_3", "/", "math", ".", "sqrt", "(", "arg_2", "*", "2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Calculate a t-test score for the difference between two samples.\n\n    Args:\n        sample1: one sample.\n        sample2: the other sample.\n\n    Returns:\n        The t-test score, as a float.\n    \"\"\"\n    if len(arg_0) != len(arg_1):\n        raise ValueError(\"different number of values\")\n    arg_2 = pooled_sample_variance(arg_0, arg_1) / len(arg_0)\n    arg_3 = statistics.mean(arg_0) - statistics.mean(arg_1)\n    return arg_3 / math.sqrt(arg_2 * 2)", "path": "performance/compare.py", "identifier": "tscore", "docstring": "Calculate a t-test score for the difference between two samples.\n\n    Args:\n        sample1: one sample.\n        sample2: the other sample.\n\n    Returns:\n        The t-test score, as a float.", "docstring_tokens": ["Calculate", "a", "t", "-", "test", "score", "for", "the", "difference", "between", "two", "samples", "."], "nwo": "python/performance", "score": 0.9320212778991671, "idx": 257297}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/memory_model.py#L635-L649", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Stores experiences.", "language": "python", "parameters": "(self, states, internals, actions, terminal, reward)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "Func_output", "arg_7", "=", "arg_0", ".", "get_feed_dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_0", ".", "monitored_session", ".", "run", "(", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"\n        Stores experiences.\n        \"\"\"\n        arg_6 = arg_0.Func_output\n\n        arg_7 = arg_0.get_feed_dict(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5\n        )\n\n        arg_0.monitored_session.run(arg_6=arg_6, arg_7=arg_7)", "path": "tensorforce/models/memory_model.py", "identifier": "MemoryModel.import_experience", "docstring": "Stores experiences.", "docstring_tokens": ["Stores", "experiences", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 257298}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/app.py#L79-L95", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Configure Flask extensions.", "language": "python", "parameters": "(app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "extensions", ".", "toolbar", ".", "init_app", "(", "arg_0", ")", "extensions", ".", "bootstrap", ".", "init_app", "(", "arg_0", ")", "extensions", ".", "mongo", ".", "init_app", "(", "arg_0", ")", "extensions", ".", "store", ".", "init_app", "(", "arg_0", ")", "extensions", ".", "login_manager", ".", "init_app", "(", "arg_0", ")", "extensions", ".", "oauth", ".", "init_app", "(", "arg_0", ")", "extensions", ".", "mail", ".", "init_app", "(", "arg_0", ")", "Markdown", "(", "arg_0", ")", "if", "arg_0", ".", "config", ".", "get", "(", "'SQLALCHEMY_DATABASE_URI'", ")", ":", "configure_coverage", "(", "arg_0", ")", "if", "arg_0", ".", "config", ".", "get", "(", "'LOQUSDB_SETTINGS'", ")", ":", "extensions", ".", "loqusdb", ".", "init_app", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Configure Flask extensions.\"\"\"\n    extensions.toolbar.init_app(arg_0)\n    extensions.bootstrap.init_app(arg_0)\n    extensions.mongo.init_app(arg_0)\n    extensions.store.init_app(arg_0)\n    extensions.login_manager.init_app(arg_0)\n    extensions.oauth.init_app(arg_0)\n    extensions.mail.init_app(arg_0)\n    Markdown(arg_0)\n\n    if arg_0.config.get('SQLALCHEMY_DATABASE_URI'):\n        configure_coverage(arg_0)\n\n    if arg_0.config.get('LOQUSDB_SETTINGS'):\n        # setup LoqusDB\n        extensions.loqusdb.init_app(arg_0)", "path": "scout/server/app.py", "identifier": "configure_extensions", "docstring": "Configure Flask extensions.", "docstring_tokens": ["Configure", "Flask", "extensions", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257299}
{"url": "https://github.com/TaurusOlson/incisive/blob/25bb9f53495985c1416c82e26f54158df4050cb0/incisive/core.py#L28-L31", "sha": "25bb9f53495985c1416c82e26f54158df4050cb0", "docstring_summary": "map for a directory", "language": "python", "parameters": "(fn, record)", "return_statement": "return dict(itertools.izip(record, values))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "arg_0", "(", "v", ")", "for", "k", ",", "v", "in", "arg_1", ".", "items", "(", ")", ")", "return", "dict", "(", "itertools", ".", "izip", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"map for a directory\"\"\"\n    arg_2 = (arg_0(v) for k, v in arg_1.items())\n    return dict(itertools.izip(arg_1, arg_2))", "path": "incisive/core.py", "identifier": "dmap", "docstring": "map for a directory", "docstring_tokens": ["map", "for", "a", "directory"], "nwo": "TaurusOlson/incisive", "score": 0.09252797783733271, "idx": 257300}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/gui/gui_mainLayout.py#L138-L157", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "This function gets back data that the user typed.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "batch_name_value", "=", "arg_0", ".", "ui", ".", "batch_name_value", ".", "text", "(", ")", "arg_0", ".", "saa_values", "=", "arg_0", ".", "ui", ".", "saa_values", ".", "text", "(", ")", "arg_0", ".", "sza_values", "=", "arg_0", ".", "ui", ".", "sza_values", ".", "text", "(", ")", "arg_0", ".", "p_values", "=", "arg_0", ".", "ui", ".", "p_values", ".", "text", "(", ")", "arg_0", ".", "x_value", "=", "arg_0", ".", "ui", ".", "x_value", ".", "text", "(", ")", "arg_0", ".", "y_value", "=", "arg_0", ".", "ui", ".", "y_value", ".", "text", "(", ")", "arg_0", ".", "g_value", "=", "arg_0", ".", "ui", ".", "g_value", ".", "text", "(", ")", "arg_0", ".", "s_value", "=", "arg_0", ".", "ui", ".", "s_value", ".", "text", "(", ")", "arg_0", ".", "z_value", "=", "arg_0", ".", "ui", ".", "z_value", ".", "text", "(", ")", "arg_0", ".", "wavelength_values", "=", "arg_0", ".", "ui", ".", "wavelength_values", ".", "text", "(", ")", "arg_0", ".", "verbose_value", "=", "arg_0", ".", "ui", ".", "verbose_value", ".", "text", "(", ")", "arg_0", ".", "phytoplankton_path", "=", "arg_0", ".", "ui", ".", "phyto_path", ".", "text", "(", ")", "arg_0", ".", "bottom_path", "=", "arg_0", ".", "ui", ".", "bottom_path", ".", "text", "(", ")", "arg_0", ".", "executive_path", "=", "arg_0", ".", "ui", ".", "exec_path", ".", "text", "(", ")", "arg_0", ".", "nb_cpu", "=", "arg_0", ".", "ui", ".", "nb_cpu", ".", "currentText", "(", ")", "arg_0", ".", "report_parameter_value", "=", "str", "(", "arg_0", ".", "ui", ".", "report_parameter_value", ".", "text", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        This function gets back Func that the user typed.\n        \"\"\"\n        arg_0.batch_name_value = arg_0.ui.batch_name_value.text()\n        arg_0.saa_values = arg_0.ui.saa_values.text()\n        arg_0.sza_values = arg_0.ui.sza_values.text()\n        arg_0.p_values = arg_0.ui.p_values.text()\n        arg_0.x_value = arg_0.ui.x_value.text()\n        arg_0.y_value = arg_0.ui.y_value.text()\n        arg_0.g_value = arg_0.ui.g_value.text()\n        arg_0.s_value = arg_0.ui.s_value.text()\n        arg_0.z_value = arg_0.ui.z_value.text()\n        arg_0.wavelength_values = arg_0.ui.wavelength_values.text()\n        arg_0.verbose_value = arg_0.ui.verbose_value.text()\n        arg_0.phytoplankton_path = arg_0.ui.phyto_path.text()\n        arg_0.bottom_path = arg_0.ui.bottom_path.text()\n        arg_0.executive_path = arg_0.ui.exec_path.text()\n        arg_0.nb_cpu = arg_0.ui.nb_cpu.currentText()\n        arg_0.report_parameter_value = str(arg_0.ui.report_parameter_value.text())", "path": "gui/gui_mainLayout.py", "identifier": "FormEvents.data", "docstring": "This function gets back data that the user typed.", "docstring_tokens": ["This", "function", "gets", "back", "data", "that", "the", "user", "typed", "."], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 257301}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/examples/run_sweep.py#L112-L166", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Main function to sweep parameters of a certain algorithm.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Runs the speficied algorithm(s) on the MSAF \"", "\"formatted dataset.\"", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ")", "arg_0", ".", "add_argument", "(", "\"in_path\"", ",", "action", "=", "\"store\"", ",", "help", "=", "\"Input dataset\"", ")", "arg_0", ".", "add_argument", "(", "\"-f\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"feature\"", ",", "default", "=", "\"pcp\"", ",", "type", "=", "str", ",", "help", "=", "\"Type of features\"", ",", "choices", "=", "[", "\"pcp\"", ",", "\"tonnetz\"", ",", "\"mfcc\"", ",", "\"cqt\"", ",", "\"tempogram\"", "]", ")", "arg_0", ".", "add_argument", "(", "\"-b\"", ",", "action", "=", "\"store_true\"", ",", "dest", "=", "\"annot_beats\"", ",", "help", "=", "\"Use annotated beats\"", ",", "default", "=", "False", ")", "arg_0", ".", "add_argument", "(", "\"-fs\"", ",", "action", "=", "\"store_true\"", ",", "dest", "=", "\"framesync\"", ",", "help", "=", "\"Use frame-synchronous features\"", ",", "default", "=", "False", ")", "arg_0", ".", "add_argument", "(", "\"-bid\"", ",", "action", "=", "\"store\"", ",", "help", "=", "\"Boundary algorithm identifier\"", ",", "dest", "=", "\"boundaries_id\"", ",", "default", "=", "\"gt\"", ",", "choices", "=", "[", "\"gt\"", "]", "+", "io", ".", "get_all_boundary_algorithms", "(", ")", ")", "arg_0", ".", "add_argument", "(", "\"-lid\"", ",", "action", "=", "\"store\"", ",", "help", "=", "\"Label algorithm identifier\"", ",", "dest", "=", "\"labels_id\"", ",", "default", "=", "None", ",", "choices", "=", "io", ".", "get_all_label_algorithms", "(", ")", ")", "arg_0", ".", "add_argument", "(", "\"-j\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"n_jobs\"", ",", "default", "=", "4", ",", "type", "=", "int", ",", "help", "=", "\"The number of threads to use\"", ")", "arg_1", "=", "arg_0", ".", "parse_args", "(", ")", "arg_2", "=", "time", ".", "time", "(", ")", "process", "(", "arg_1", ".", "in_path", ",", "annot_beats", "=", "arg_1", ".", "annot_beats", ",", "feature", "=", "arg_1", ".", "feature", ",", "framesync", "=", "arg_1", ".", "framesync", ",", "boundaries_id", "=", "arg_1", ".", "boundaries_id", ",", "labels_id", "=", "arg_1", ".", "labels_id", ",", "n_jobs", "=", "arg_1", ".", "n_jobs", ")", "logging", ".", "info", "(", "\"Done! Took %.2f seconds.\"", "%", "(", "time", ".", "time", "(", ")", "-", "arg_2", ")", ")"], "function": "def Func():\n    \"\"\"Main function to sweep parameters of a certain algorithm.\"\"\"\n    arg_0 = argparse.ArgumentParser(\n        description=\"Runs the speficied algorithm(s) on the MSAF \"\n        \"formatted dataset.\",\n        formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n    arg_0.add_argument(\"in_path\",\n                        action=\"store\",\n                        help=\"Input dataset\")\n    arg_0.add_argument(\"-f\",\n                        action=\"store\",\n                        dest=\"feature\",\n                        default=\"pcp\",\n                        type=str,\n                        help=\"Type of features\",\n                        choices=[\"pcp\", \"tonnetz\", \"mfcc\", \"cqt\", \"tempogram\"])\n    arg_0.add_argument(\"-b\",\n                        action=\"store_true\",\n                        dest=\"annot_beats\",\n                        help=\"Use annotated beats\",\n                        default=False)\n    arg_0.add_argument(\"-fs\",\n                        action=\"store_true\",\n                        dest=\"framesync\",\n                        help=\"Use frame-synchronous features\",\n                        default=False)\n    arg_0.add_argument(\"-bid\",\n                        action=\"store\",\n                        help=\"Boundary algorithm identifier\",\n                        dest=\"boundaries_id\",\n                        default=\"gt\",\n                        choices=[\"gt\"] +\n                        io.get_all_boundary_algorithms())\n    arg_0.add_argument(\"-lid\",\n                        action=\"store\",\n                        help=\"Label algorithm identifier\",\n                        dest=\"labels_id\",\n                        default=None,\n                        choices=io.get_all_label_algorithms())\n    arg_0.add_argument(\"-j\",\n                        action=\"store\",\n                        dest=\"n_jobs\",\n                        default=4,\n                        type=int,\n                        help=\"The number of threads to use\")\n    arg_1 = arg_0.parse_args()\n    arg_2 = time.time()\n\n    # Run the algorithm(s)\n    process(arg_1.in_path, annot_beats=arg_1.annot_beats, feature=arg_1.feature,\n            framesync=arg_1.framesync, boundaries_id=arg_1.boundaries_id,\n            labels_id=arg_1.labels_id, n_jobs=arg_1.n_jobs)\n\n    # Done!\n    logging.info(\"Done! Took %.2f seconds.\" % (time.time() - arg_2))", "path": "examples/run_sweep.py", "identifier": "main", "docstring": "Main function to sweep parameters of a certain algorithm.", "docstring_tokens": ["Main", "function", "to", "sweep", "parameters", "of", "a", "certain", "algorithm", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 257302}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/datasets/sbu.py#L87-L110", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Download and extract the tarball, and download each individual photo.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "tarfile", "if", "arg_0", ".", "_check_integrity", "(", ")", ":", "print", "(", "'Files already Funced and verified'", ")", "return", "Func_url", "(", "arg_0", ".", "url", ",", "arg_0", ".", "root", ",", "arg_0", ".", "filename", ",", "arg_0", ".", "md5_checksum", ")", "with", "tarfile", ".", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "root", ",", "arg_0", ".", "filename", ")", ",", "'r:gz'", ")", "as", "tar", ":", "tar", ".", "extractall", "(", "path", "=", "arg_0", ".", "root", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "root", ",", "'dataset'", ",", "'SBU_captioned_photo_dataset_urls.txt'", ")", ")", "as", "fh", ":", "for", "arg_1", "in", "fh", ":", "arg_2", "=", "arg_1", ".", "rstrip", "(", ")", "try", ":", "Func_url", "(", "arg_2", ",", "os", ".", "path", ".", "join", "(", "arg_0", ".", "root", ",", "'dataset'", ")", ")", "except", "OSError", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"Download and extract the tarball, and Func each individual photo.\"\"\"\n        import tarfile\n\n        if arg_0._check_integrity():\n            print('Files already Funced and verified')\n            return\n\n        Func_url(arg_0.url, arg_0.root, arg_0.filename, arg_0.md5_checksum)\n\n        # Extract file\n        with tarfile.open(os.path.join(arg_0.root, arg_0.filename), 'r:gz') as tar:\n            tar.extractall(path=arg_0.root)\n\n        # Download individual photos\n        with open(os.path.join(arg_0.root, 'dataset', 'SBU_captioned_photo_dataset_urls.txt')) as fh:\n            for arg_1 in fh:\n                arg_2 = arg_1.rstrip()\n                try:\n                    Func_url(arg_2, os.path.join(arg_0.root, 'dataset'))\n                except OSError:\n                    # The images point to public images on Flickr.\n                    # Note: Images might be removed by users at anytime.\n                    pass", "path": "torchvision/datasets/sbu.py", "identifier": "SBU.download", "docstring": "Download and extract the tarball, and download each individual photo.", "docstring_tokens": ["Download", "and", "extract", "the", "tarball", "and", "download", "each", "individual", "photo", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 257303}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L365-L370", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Is distribution an editable install?", "language": "python", "parameters": "(dist)", "return_statement": "return req.editable", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "pip", "import", "FrozenRequirement", "arg_1", "=", "FrozenRequirement", ".", "from_dist", "(", "arg_0", ",", "[", "]", ")", "return", "arg_1", ".", "editable"], "function": "def Func(arg_0):\n    \"\"\"Is distribution an editable install?\"\"\"\n    # TODO: factor out determining editableness out of FrozenRequirement\n    from pip import FrozenRequirement\n    arg_1 = FrozenRequirement.from_dist(arg_0, [])\n    return arg_1.editable", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py", "identifier": "dist_is_editable", "docstring": "Is distribution an editable install?", "docstring_tokens": ["Is", "distribution", "an", "editable", "install?"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257304}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L599-L608", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Randomly resolves iupac hetero codes. This is a shortcut\n    for now, we could instead use the phased alleles in RAD loci.", "language": "python", "parameters": "(subseq)", "return_statement": "return np.array(N)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "np", ".", "random", ".", "binomial", "(", "1", ",", "0.5", ")", "arg_1", ".", "append", "(", "[", "_AMBIGS", "[", "arg_4", "]", "[", "arg_3", "]", "for", "arg_4", "in", "arg_2", "]", ")", "return", "np", ".", "array", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\" \n    Randomly resolves iupac hetero codes. This is a shortcut\n    for now, we could instead use the phased alleles in RAD loci.\n    \"\"\"\n    arg_1 = []\n    for arg_2 in arg_0:\n        arg_3 = np.random.binomial(1, 0.5)\n        arg_1.append([_AMBIGS[arg_4][arg_3] for arg_4 in arg_2])\n    return np.array(arg_1)", "path": "ipyrad/analysis/bucky.py", "identifier": "_resolveambig", "docstring": "Randomly resolves iupac hetero codes. This is a shortcut\n    for now, we could instead use the phased alleles in RAD loci.", "docstring_tokens": ["Randomly", "resolves", "iupac", "hetero", "codes", ".", "This", "is", "a", "shortcut", "for", "now", "we", "could", "instead", "use", "the", "phased", "alleles", "in", "RAD", "loci", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 257305}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/qubole_hook.py#L212-L229", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get link to qubole command result page.", "language": "python", "parameters": "(self, operator, dttm)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "BaseHook", ".", "get_connection", "(", "arg_1", ".", "kwargs", "[", "'qubole_conn_id'", "]", ")", "if", "arg_3", "and", "arg_3", ".", "host", ":", "arg_4", "=", "re", ".", "sub", "(", "r'api$'", ",", "'v2/analyze?command_id='", ",", "arg_3", ".", "host", ")", "else", ":", "arg_4", "=", "'https://api.qubole.com/v2/analyze?command_id='", "arg_5", "=", "TaskInstance", "(", "task", "=", "arg_1", ",", "execution_date", "=", "arg_2", ")", "arg_6", "=", "arg_5", ".", "xcom_pull", "(", "task_ids", "=", "arg_1", ".", "task_id", ",", "key", "=", "'qbol_cmd_id'", ")", "arg_7", "=", "arg_4", "+", "str", "(", "arg_6", ")", "if", "arg_6", "else", "''", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get link to qubole command result page.\n\n        :param operator: operator\n        :param dttm: datetime\n        :return: url link\n        \"\"\"\n        arg_3 = BaseHook.get_connection(arg_1.kwargs['qubole_conn_id'])\n        if arg_3 and arg_3.host:\n            arg_4 = re.sub(r'api$', 'v2/analyze?command_id=', arg_3.host)\n        else:\n            arg_4 = 'https://api.qubole.com/v2/analyze?command_id='\n\n        arg_5 = TaskInstance(task=arg_1, execution_date=arg_2)\n        arg_6 = arg_5.xcom_pull(task_ids=arg_1.task_id, key='qbol_cmd_id')\n        arg_7 = arg_4 + str(arg_6) if arg_6 else ''\n        return arg_7", "path": "airflow/contrib/hooks/qubole_hook.py", "identifier": "QuboleHook.get_extra_links", "docstring": "Get link to qubole command result page.\n\n        :param operator: operator\n        :param dttm: datetime\n        :return: url link", "docstring_tokens": ["Get", "link", "to", "qubole", "command", "result", "page", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257306}
{"url": "https://github.com/bluedisk/hangul-toolkit/blob/f36b534ee339263fb72e687b732697cc7ed290dc/hgtk/letter.py#L49-L79", "sha": "f36b534ee339263fb72e687b732697cc7ed290dc", "docstring_summary": "This function returns letters by decomposing the specified Hangul letter.", "language": "python", "parameters": "(hangul_letter)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", ".", "import", "checker", "if", "len", "(", "arg_0", ")", "<", "1", ":", "raise", "NotLetterException", "(", "''", ")", "elif", "not", "checker", ".", "is_hangul", "(", "arg_0", ")", ":", "raise", "NotHangulException", "(", "''", ")", "if", "arg_0", "in", "CHO", ":", "return", "arg_0", ",", "''", ",", "''", "if", "arg_0", "in", "JOONG", ":", "return", "''", ",", "arg_0", ",", "''", "if", "arg_0", "in", "JONG", ":", "return", "''", ",", "''", ",", "arg_0", "arg_1", "=", "hangul_index", "(", "arg_0", ")", "arg_2", ",", "arg_3", ",", "arg_4", "=", "Func_index", "(", "arg_1", ")", "if", "arg_2", "<", "0", ":", "arg_2", "=", "0", "try", ":", "return", "CHO", "[", "arg_2", "]", ",", "JOONG", "[", "arg_3", "]", ",", "JONG", "[", "arg_4", "]", "except", ":", "print", "(", "\"%d / %d  / %d\"", "%", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "print", "(", "\"%s / %s \"", "%", "(", "JOONG", "[", "arg_3", "]", ".", "encode", "(", "\"utf8\"", ")", ",", "JONG", "[", "arg_4", "]", ".", "encode", "(", "'utf8'", ")", ")", ")", "raise", "Exception", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"This function returns letters by decomposing the specified Hangul letter.\"\"\"\n\n    from . import checker\n\n    if len(arg_0) < 1:\n        raise NotLetterException('')\n    elif not checker.is_hangul(arg_0):\n        raise NotHangulException('')\n\n    if arg_0 in CHO:\n        return arg_0, '', ''\n\n    if arg_0 in JOONG:\n        return '', arg_0, ''\n\n    if arg_0 in JONG:\n        return '', '', arg_0\n\n    arg_1 = hangul_index(arg_0)\n    arg_2, arg_3, arg_4 = Func_index(arg_1)\n\n    if arg_2 < 0:\n        arg_2 = 0\n\n    try:\n        return CHO[arg_2], JOONG[arg_3], JONG[arg_4]\n    except:\n        print(\"%d / %d  / %d\"%(arg_2, arg_3, arg_4))\n        print(\"%s / %s \" %( JOONG[arg_3].encode(\"utf8\"), JONG[arg_4].encode('utf8')))\n        raise Exception()", "path": "hgtk/letter.py", "identifier": "decompose", "docstring": "This function returns letters by decomposing the specified Hangul letter.", "docstring_tokens": ["This", "function", "returns", "letters", "by", "decomposing", "the", "specified", "Hangul", "letter", "."], "nwo": "bluedisk/hangul-toolkit", "score": 0.8069895883791149, "idx": 257307}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L64-L75", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Chunk a text at the passage level", "language": "python", "parameters": "(text, getreffs, level=1)", "return_statement": "return [(ref.split(\":\")[-1], ref.split(\":\")[-1]) for ref in references]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "arg_1", "(", "arg_2", "=", "arg_2", ")", "return", "[", "(", "arg_4", ".", "split", "(", "\":\"", ")", "[", "-", "1", "]", ",", "arg_4", ".", "split", "(", "\":\"", ")", "[", "-", "1", "]", ")", "for", "arg_4", "in", "arg_3", "]"], "function": "def Func(arg_0, arg_1, arg_2=1):\n    \"\"\" Chunk a text at the passage level\n\n    :param text: Text object\n    :type text: MyCapytains.resources.text.api\n    :param getreffs: Callback function to retrieve text\n    :type getreffs: function(level)\n    :return: List of urn references with their human readable version\n    :rtype: [(str, str)]\n    \"\"\"\n    arg_3 = arg_1(arg_2=arg_2)\n    return [(arg_4.split(\":\")[-1], arg_4.split(\":\")[-1]) for arg_4 in arg_3]", "path": "flask_nemo/chunker.py", "identifier": "level_chunker", "docstring": "Chunk a text at the passage level\n\n    :param text: Text object\n    :type text: MyCapytains.resources.text.api\n    :param getreffs: Callback function to retrieve text\n    :type getreffs: function(level)\n    :return: List of urn references with their human readable version\n    :rtype: [(str, str)]", "docstring_tokens": ["Chunk", "a", "text", "at", "the", "passage", "level"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 257308}
{"url": "https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L317-L328", "sha": "5b322f7c2b82a502b1e1b70703ae45f1f668d07d", "docstring_summary": "Decode a CONNACK control packet.", "language": "python", "parameters": "(self, packet)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "encoded", "=", "arg_1", "arg_3", "=", "1", "while", "arg_1", "[", "arg_3", "]", "&", "0x80", ":", "arg_3", "+=", "1", "arg_4", "=", "arg_1", "[", "arg_3", "+", "1", ":", "]", "arg_0", ".", "session", "=", "(", "arg_4", "[", "0", "]", "&", "0x01", ")", "==", "0x01", "arg_0", ".", "resultCode", "=", "int", "(", "arg_4", "[", "1", "]", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Decode a CONNACK control packet. \n        '''\n        arg_0.encoded = arg_1\n        # Strip the fixed header plus variable length field\n        arg_3 = 1\n        while arg_1[arg_3] & 0x80:\n            arg_3 += 1\n        arg_4 = arg_1[arg_3+1:]\n        arg_0.session = (arg_4[0] & 0x01) == 0x01 \n        arg_0.resultCode  = int(arg_4[1])", "path": "mqtt/pdu.py", "identifier": "CONNACK.decode", "docstring": "Decode a CONNACK control packet.", "docstring_tokens": ["Decode", "a", "CONNACK", "control", "packet", "."], "nwo": "astrorafael/twisted-mqtt", "score": 0.28352459090240634, "idx": 257309}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/utils.py#L50-L58", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Disable timestamp update per method.", "language": "python", "parameters": "(method)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "None", "with", "correct_date", "(", ")", ":", "arg_3", "=", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return", "arg_3", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Disable timestamp update per method.\"\"\"\n    @wraps(arg_0)\n    def wrapper(*arg_1, **arg_2):\n        arg_3 = None\n        with correct_date():\n            arg_3 = arg_0(*arg_1, **arg_2)\n        return arg_3\n    return wrapper", "path": "invenio_migrator/utils.py", "identifier": "disable_timestamp", "docstring": "Disable timestamp update per method.", "docstring_tokens": ["Disable", "timestamp", "update", "per", "method", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 257310}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/keyword.py#L69-L77", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Private swap function used to either get the interned keyword\n    instance from the input string.", "language": "python", "parameters": "(\n    kw_cache: \"PMap[int, Keyword]\", h: int, name: str, ns: Optional[str]\n)", "return_statement": "return kw_cache.set(h, kw)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "\"PMap[int, Keyword]\"", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_6", "[", "arg_4", "]", ")", "->", "PMap", ":", "if", "arg_1", "in", "arg_0", ":", "return", "arg_0", "arg_7", "=", "Keyword", "(", "arg_3", ",", "arg_5", "=", "arg_5", ")", "return", "arg_0", ".", "set", "(", "arg_1", ",", "arg_7", ")"], "function": "def Func(\n    arg_0: \"PMap[int, Keyword]\", arg_1: arg_2, arg_3: arg_4, arg_5: arg_6[arg_4]\n) -> PMap:\n    \"\"\"Private swap function used to either get the interned keyword\n    instance from the input string.\"\"\"\n    if arg_1 in arg_0:\n        return arg_0\n    arg_7 = Keyword(arg_3, arg_5=arg_5)\n    return arg_0.set(arg_1, arg_7)", "path": "src/basilisp/lang/keyword.py", "identifier": "__get_or_create", "docstring": "Private swap function used to either get the interned keyword\n    instance from the input string.", "docstring_tokens": ["Private", "swap", "function", "used", "to", "either", "get", "the", "interned", "keyword", "instance", "from", "the", "input", "string", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 257311}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L578-L588", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Release the semaphore", "language": "python", "parameters": "(self, tag, acquire_token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "logger", ".", "debug", "(", "\"Releasing acquire %s/%s\"", "%", "(", "arg_1", ",", "arg_2", ")", ")", "arg_0", ".", "_semaphore", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Release the semaphore\n\n        :param tag: A tag identifying what is releasing the semaphore\n        :param acquire_token:  The token returned from when the semaphore was\n            acquired. Note that this is not really needed to directly use this\n            class but is needed for API compatibility with the\n            SlidingWindowSemaphore implementation.\n        \"\"\"\n        logger.debug(\"Releasing acquire %s/%s\" % (arg_1, arg_2))\n        arg_0._semaphore.Func()", "path": "s3transfer/utils.py", "identifier": "TaskSemaphore.release", "docstring": "Release the semaphore\n\n        :param tag: A tag identifying what is releasing the semaphore\n        :param acquire_token:  The token returned from when the semaphore was\n            acquired. Note that this is not really needed to directly use this\n            class but is needed for API compatibility with the\n            SlidingWindowSemaphore implementation.", "docstring_tokens": ["Release", "the", "semaphore"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 257312}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/periodsearch.py#L650-L865", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This runs parallel light curve period finding for directory of LCs.", "language": "python", "parameters": "(lcdir,\n                      outdir,\n                      fileglob=None,\n                      recursive=True,\n                      timecols=None,\n                      magcols=None,\n                      errcols=None,\n                      lcformat='hat-sql',\n                      lcformatdir=None,\n                      pfmethods=('gls','pdm','mav','win'),\n                      pfkwargs=({},{},{},{}),\n                      sigclip=10.0,\n                      getblssnr=False,\n                      nperiodworkers=NCPUS,\n                      ncontrolworkers=1,\n                      liststartindex=None,\n                      listmaxobjects=None,\n                      minobservations=500,\n                      excludeprocessed=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "'hat-sql'", ",", "arg_8", "=", "None", ",", "arg_9", "=", "(", "'gls'", ",", "'pdm'", ",", "'mav'", ",", "'win'", ")", ",", "arg_10", "=", "(", "{", "}", ",", "{", "}", ",", "{", "}", ",", "{", "}", ")", ",", "arg_11", "=", "10.0", ",", "arg_12", "=", "False", ",", "arg_13", "=", "arg_14", ",", "arg_15", "=", "1", ",", "arg_16", "=", "None", ",", "arg_17", "=", "None", ",", "arg_18", "=", "500", ",", "arg_19", "=", "True", ")", ":", "try", ":", "arg_20", "=", "get_lcformat", "(", "arg_7", ",", "use_lcformat_dir", "=", "arg_8", ")", "if", "arg_20", ":", "(", "arg_21", ",", "arg_22", ",", "arg_23", ",", "arg_24", ",", "arg_25", ",", "arg_26", ",", "arg_27", ")", "=", "arg_20", "else", ":", "LOGERROR", "(", "\"can't figure out the light curve format\"", ")", "return", "None", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "\"can't figure out the light curve format\"", ")", "return", "None", "if", "not", "arg_2", ":", "arg_2", "=", "arg_21", "LOGINFO", "(", "'searching for %s light curves in %s ...'", "%", "(", "arg_7", ",", "arg_0", ")", ")", "if", "arg_3", "is", "False", ":", "arg_28", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_2", ")", ")", "else", ":", "if", "sys", ".", "version_info", "[", ":", "2", "]", ">", "(", "3", ",", "4", ")", ":", "arg_28", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'**'", ",", "arg_2", ")", ",", "arg_3", "=", "True", ")", "else", ":", "arg_29", "=", "os", ".", "walk", "(", "arg_0", ")", "arg_28", "=", "[", "]", "for", "arg_30", ",", "arg_31", ",", "arg_32", "in", "arg_29", ":", "for", "arg_33", "in", "arg_31", ":", "arg_34", "=", "os", ".", "path", ".", "join", "(", "arg_30", ",", "arg_33", ",", "arg_2", ")", "arg_35", "=", "glob", ".", "glob", "(", "arg_34", ")", "if", "arg_35", ":", "arg_28", ".", "extend", "(", "arg_35", ")", "if", "arg_28", "and", "len", "(", "arg_28", ")", ">", "0", ":", "arg_28", "=", "sorted", "(", "arg_28", ")", "LOGINFO", "(", "'found %s light curves, running pf...'", "%", "len", "(", "arg_28", ")", ")", "return", "parallel_pf", "(", "arg_28", ",", "arg_1", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_12", "=", "arg_12", ",", "arg_11", "=", "arg_11", ",", "arg_13", "=", "arg_13", ",", "arg_15", "=", "arg_15", ",", "arg_16", "=", "arg_16", ",", "arg_17", "=", "arg_17", ",", "arg_18", "=", "arg_18", ",", "arg_19", "=", "arg_19", ")", "else", ":", "LOGERROR", "(", "'no light curve files in %s format found in %s'", "%", "(", "arg_7", ",", "arg_0", ")", ")", "return", "None"], "function": "def Func(arg_0,\n                      arg_1,\n                      arg_2=None,\n                      arg_3=True,\n                      arg_4=None,\n                      arg_5=None,\n                      arg_6=None,\n                      arg_7='hat-sql',\n                      arg_8=None,\n                      arg_9=('gls','pdm','mav','win'),\n                      arg_10=({},{},{},{}),\n                      arg_11=10.0,\n                      arg_12=False,\n                      arg_13=arg_14,\n                      arg_15=1,\n                      arg_16=None,\n                      arg_17=None,\n                      arg_18=500,\n                      arg_19=True):\n    '''This runs parallel light curve period finding for directory of LCs.\n\n    Parameters\n    ----------\n\n    lcdir : str\n        The directory containing the LCs to process.\n\n    outdir : str\n        The directory where the resulting period-finding pickles will go.\n\n    fileglob : str or None\n        The UNIX file glob to use to search for LCs in `lcdir`. If None, the\n        default file glob associated with the registered LC format will be used\n        instead.\n\n    recursive : bool\n        If True, will search recursively in `lcdir` for light curves to process.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in calculating the features.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in calculating the features.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in calculating the features.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    pfmethods : list of str\n        This is a list of period finding methods to run. Each element is a\n        string matching the keys of the `PFMETHODS` dict above. By default, this\n        runs GLS, PDM, AoVMH, and the spectral window Lomb-Scargle periodogram.\n\n    pfkwargs : list of dicts\n        This is used to provide any special kwargs as dicts to each\n        period-finding method function specified in `pfmethods`.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    getblssnr : bool\n        If this is True and BLS is one of the methods specified in `pfmethods`,\n        will also calculate the stats for each best period in the BLS results:\n        transit depth, duration, ingress duration, refit period and epoch, and\n        the SNR of the transit.\n\n    nperiodworkers : int\n        The number of parallel period-finding workers to launch per object task.\n\n    ncontrolworkers : int\n        The number of controlling processes to launch. This effectively sets how\n        many objects from `lclist` will be processed in parallel.\n\n    liststartindex : int or None\n        This sets the index from where to start in `lclist`.\n\n    listmaxobjects : int or None\n        This sets the maximum number of objects in `lclist` to run\n        period-finding for in this invocation. Together with `liststartindex`,\n        `listmaxobjects` can be used to distribute processing over several\n        independent machines if the number of light curves is very large.\n\n    minobservations : int\n        The minimum number of finite LC points required to process a light\n        curve.\n\n    excludeprocessed : bool\n        If this is True, light curves that have existing period-finding result\n        pickles in `outdir` will not be processed.\n\n        FIXME: currently, this uses a dumb method of excluding already-processed\n        files. A smarter way to do this is to (i) generate a SHA512 cachekey\n        based on a repr of `{'lcfile', 'timecols', 'magcols', 'errcols',\n        'lcformat', 'pfmethods', 'sigclip', 'getblssnr', 'pfkwargs'}`, (ii) make\n        sure all list kwargs in the dict are sorted, (iii) check if the output\n        file has the same cachekey in its filename (last 8 chars of cachekey\n        should work), so the result was processed in exactly the same way as\n        specifed in the input to this function, and can therefore be\n        ignored. Will implement this later.\n\n    Returns\n    -------\n\n    list of str\n        A list of the period-finding pickles created for all of input LCs\n        processed.\n\n    '''\n\n    try:\n        arg_20 = get_lcformat(arg_7,\n                                  use_lcformat_dir=arg_8)\n        if arg_20:\n            (arg_21, arg_22,\n             arg_23, arg_24, arg_25,\n             arg_26, arg_27) = arg_20\n        else:\n            LOGERROR(\"can't figure out the light curve format\")\n            return None\n    except Exception as e:\n        LOGEXCEPTION(\"can't figure out the light curve format\")\n        return None\n\n    if not arg_2:\n        arg_2 = arg_21\n\n    # now find the files\n    LOGINFO('searching for %s light curves in %s ...' % (arg_7, arg_0))\n\n    if arg_3 is False:\n        arg_28 = glob.glob(os.path.join(arg_0, arg_2))\n\n    else:\n        # use recursive glob for Python 3.5+\n        if sys.version_info[:2] > (3,4):\n\n            arg_28 = glob.glob(os.path.join(arg_0,\n                                              '**',\n                                              arg_2),arg_3=True)\n\n        # otherwise, use os.walk and glob\n        else:\n\n            # use os.walk to go through the directories\n            arg_29 = os.walk(arg_0)\n            arg_28 = []\n\n            for arg_30, arg_31, arg_32 in arg_29:\n                for arg_33 in arg_31:\n                    arg_34 = os.path.join(arg_30,\n                                              arg_33,\n                                              arg_2)\n                    arg_35 = glob.glob(arg_34)\n\n                    if arg_35:\n                        arg_28.extend(arg_35)\n\n\n    # now that we have all the files, process them\n    if arg_28 and len(arg_28) > 0:\n\n        # this helps us process things in deterministic order when we distribute\n        # processing over several machines\n        arg_28 = sorted(arg_28)\n\n        LOGINFO('found %s light curves, running pf...' % len(arg_28))\n\n        return parallel_pf(arg_28,\n                           arg_1,\n                           arg_4=arg_4,\n                           arg_5=arg_5,\n                           arg_6=arg_6,\n                           arg_7=arg_7,\n                           arg_8=arg_8,\n                           arg_9=arg_9,\n                           arg_10=arg_10,\n                           arg_12=arg_12,\n                           arg_11=arg_11,\n                           arg_13=arg_13,\n                           arg_15=arg_15,\n                           arg_16=arg_16,\n                           arg_17=arg_17,\n                           arg_18=arg_18,\n                           arg_19=arg_19)\n\n    else:\n\n        LOGERROR('no light curve files in %s format found in %s' % (arg_7,\n                                                                    arg_0))\n        return None", "path": "astrobase/lcproc/periodsearch.py", "identifier": "parallel_pf_lcdir", "docstring": "This runs parallel light curve period finding for directory of LCs.\n\n    Parameters\n    ----------\n\n    lcdir : str\n        The directory containing the LCs to process.\n\n    outdir : str\n        The directory where the resulting period-finding pickles will go.\n\n    fileglob : str or None\n        The UNIX file glob to use to search for LCs in `lcdir`. If None, the\n        default file glob associated with the registered LC format will be used\n        instead.\n\n    recursive : bool\n        If True, will search recursively in `lcdir` for light curves to process.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in calculating the features.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in calculating the features.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in calculating the features.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    pfmethods : list of str\n        This is a list of period finding methods to run. Each element is a\n        string matching the keys of the `PFMETHODS` dict above. By default, this\n        runs GLS, PDM, AoVMH, and the spectral window Lomb-Scargle periodogram.\n\n    pfkwargs : list of dicts\n        This is used to provide any special kwargs as dicts to each\n        period-finding method function specified in `pfmethods`.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    getblssnr : bool\n        If this is True and BLS is one of the methods specified in `pfmethods`,\n        will also calculate the stats for each best period in the BLS results:\n        transit depth, duration, ingress duration, refit period and epoch, and\n        the SNR of the transit.\n\n    nperiodworkers : int\n        The number of parallel period-finding workers to launch per object task.\n\n    ncontrolworkers : int\n        The number of controlling processes to launch. This effectively sets how\n        many objects from `lclist` will be processed in parallel.\n\n    liststartindex : int or None\n        This sets the index from where to start in `lclist`.\n\n    listmaxobjects : int or None\n        This sets the maximum number of objects in `lclist` to run\n        period-finding for in this invocation. Together with `liststartindex`,\n        `listmaxobjects` can be used to distribute processing over several\n        independent machines if the number of light curves is very large.\n\n    minobservations : int\n        The minimum number of finite LC points required to process a light\n        curve.\n\n    excludeprocessed : bool\n        If this is True, light curves that have existing period-finding result\n        pickles in `outdir` will not be processed.\n\n        FIXME: currently, this uses a dumb method of excluding already-processed\n        files. A smarter way to do this is to (i) generate a SHA512 cachekey\n        based on a repr of `{'lcfile', 'timecols', 'magcols', 'errcols',\n        'lcformat', 'pfmethods', 'sigclip', 'getblssnr', 'pfkwargs'}`, (ii) make\n        sure all list kwargs in the dict are sorted, (iii) check if the output\n        file has the same cachekey in its filename (last 8 chars of cachekey\n        should work), so the result was processed in exactly the same way as\n        specifed in the input to this function, and can therefore be\n        ignored. Will implement this later.\n\n    Returns\n    -------\n\n    list of str\n        A list of the period-finding pickles created for all of input LCs\n        processed.", "docstring_tokens": ["This", "runs", "parallel", "light", "curve", "period", "finding", "for", "directory", "of", "LCs", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257313}
{"url": "https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L11-L36", "sha": "148b700c5846d8fdafc562d4326587da5447223f", "docstring_summary": "Coroutine wrapper to catch errors after async scheduling.", "language": "python", "parameters": "(emitter, event, listener, coro)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "await", "arg_3", "except", "Exception", "as", "exc", ":", "if", "arg_1", "==", "arg_0", ".", "LISTENER_ERROR_EVENT", ":", "raise", "arg_0", ".", "emit", "(", "arg_0", ".", "LISTENER_ERROR_EVENT", ",", "arg_1", ",", "arg_2", ",", "exc", ")"], "function": "async def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Coroutine wrapper to catch errors after async scheduling.\n\n    Args:\n        emitter (EventEmitter): The event emitter that is attempting to\n            call a listener.\n        event (str): The event that triggered the emitter.\n        listener (async def): The async def that was used to generate the coro.\n        coro (coroutine): The coroutine that should be tried.\n\n    If an exception is caught the function will use the emitter to emit the\n    failure event. If, however, the current event _is_ the failure event then\n    the method reraises. The reraised exception may show in debug mode for the\n    event loop but is otherwise silently dropped.\n    \"\"\"\n    try:\n\n        await arg_3\n\n    except Exception as exc:\n\n        if arg_1 == arg_0.LISTENER_ERROR_EVENT:\n\n            raise\n\n        arg_0.emit(arg_0.LISTENER_ERROR_EVENT, arg_1, arg_2, exc)", "path": "eventemitter/emitter.py", "identifier": "_try_catch_coro", "docstring": "Coroutine wrapper to catch errors after async scheduling.\n\n    Args:\n        emitter (EventEmitter): The event emitter that is attempting to\n            call a listener.\n        event (str): The event that triggered the emitter.\n        listener (async def): The async def that was used to generate the coro.\n        coro (coroutine): The coroutine that should be tried.\n\n    If an exception is caught the function will use the emitter to emit the\n    failure event. If, however, the current event _is_ the failure event then\n    the method reraises. The reraised exception may show in debug mode for the\n    event loop but is otherwise silently dropped.", "docstring_tokens": ["Coroutine", "wrapper", "to", "catch", "errors", "after", "async", "scheduling", "."], "nwo": "asyncdef/eventemitter", "score": 0.1832591465193378, "idx": 257314}
{"url": "https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L28-L54", "sha": "55246961d805b1f64d661a5c0bae0a216589401f", "docstring_summary": "Build and return Sailthru purchase item object", "language": "python", "parameters": "(course_id, course_url, cost_in_cents, mode, course_data, sku)", "return_statement": "return item", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "{", "'id'", ":", "\"{}-{}\"", ".", "format", "(", "arg_0", ",", "arg_3", ")", ",", "'url'", ":", "arg_1", ",", "'price'", ":", "arg_2", ",", "'qty'", ":", "1", ",", "}", "if", "'title'", "in", "arg_4", ":", "arg_6", "[", "'title'", "]", "=", "arg_4", "[", "'title'", "]", "else", ":", "arg_6", "[", "'title'", "]", "=", "'Course {} mode: {}'", ".", "format", "(", "arg_0", ",", "arg_3", ")", "if", "'tags'", "in", "arg_4", ":", "arg_6", "[", "'tags'", "]", "=", "arg_4", "[", "'tags'", "]", "arg_6", "[", "'vars'", "]", "=", "dict", "(", "arg_4", ".", "get", "(", "'vars'", ",", "{", "}", ")", ",", "arg_3", "=", "arg_3", ",", "course_run_id", "=", "arg_0", ")", "arg_6", "[", "'vars'", "]", "[", "'purchase_sku'", "]", "=", "arg_5", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Build and return Sailthru purchase item object\"\"\"\n\n    # build item description\n    arg_6 = {\n        'id': \"{}-{}\".format(arg_0, arg_3),\n        'url': arg_1,\n        'price': arg_2,\n        'qty': 1,\n    }\n\n    # get title from course info if we don't already have it from Sailthru\n    if 'title' in arg_4:\n        arg_6['title'] = arg_4['title']\n    else:\n        # can't find, just invent title\n        arg_6['title'] = 'Course {} mode: {}'.format(arg_0, arg_3)\n\n    if 'tags' in arg_4:\n        arg_6['tags'] = arg_4['tags']\n\n    # add vars to item\n    arg_6['vars'] = dict(arg_4.get('vars', {}), arg_3=arg_3, course_run_id=arg_0)\n\n    arg_6['vars']['purchase_sku'] = arg_5\n\n    return arg_6", "path": "ecommerce_worker/sailthru/v1/tasks.py", "identifier": "_build_purchase_item", "docstring": "Build and return Sailthru purchase item object", "docstring_tokens": ["Build", "and", "return", "Sailthru", "purchase", "item", "object"], "nwo": "edx/ecommerce-worker", "score": 0.3907502498574038, "idx": 257315}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L265-L268", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the first item that matches the given criteria and\n        appears before this Tag in the document.", "language": "python", "parameters": "(self, name=None, attrs={}, text=None, **kwargs)", "return_statement": "return self._findOne(self.findAllPrevious, name, attrs, text, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "return", "arg_0", ".", "_findOne", "(", "arg_0", ".", "findAllPrevious", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2={}, arg_3=None, **arg_4):\n        \"\"\"Returns the first item that matches the given criteria and\n        appears before this Tag in the document.\"\"\"\n        return arg_0._findOne(arg_0.findAllPrevious, arg_1, arg_2, arg_3, **arg_4)", "path": "lib/web/BeautifulSoup.py", "identifier": "PageElement.findPrevious", "docstring": "Returns the first item that matches the given criteria and\n        appears before this Tag in the document.", "docstring_tokens": ["Returns", "the", "first", "item", "that", "matches", "the", "given", "criteria", "and", "appears", "before", "this", "Tag", "in", "the", "document", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257316}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L6299-L6305", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Prints a list of all the error-categories used by error messages.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "sys", ".", "stderr", ".", "write", "(", "''", ".", "join", "(", "'  %s\\n'", "%", "arg_0", "for", "arg_0", "in", "_ERROR_CATEGORIES", ")", ")", "sys", ".", "exit", "(", "0", ")"], "function": "def Func():\n  \"\"\"Prints a list of all the error-categories used by error messages.\n\n  These are the categories used to filter messages via --filter.\n  \"\"\"\n  sys.stderr.write(''.join('  %s\\n' % arg_0 for arg_0 in _ERROR_CATEGORIES))\n  sys.exit(0)", "path": "third_party/python/cpplint/cpplint.py", "identifier": "PrintCategories", "docstring": "Prints a list of all the error-categories used by error messages.\n\n  These are the categories used to filter messages via --filter.", "docstring_tokens": ["Prints", "a", "list", "of", "all", "the", "error", "-", "categories", "used", "by", "error", "messages", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257317}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L1904-L1923", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Iterator for random hexadecimal hashes", "language": "python", "parameters": "(iterator_size, hash_length=7)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "7", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "int", ")", ":", "raise", "TypeError", "(", "'iterator_size must be integer.'", ")", "arg_2", "=", "0", "while", "arg_2", "!=", "arg_0", ":", "arg_2", "+=", "1", "yield", "GetRandomHash", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=7):\n    '''\n    Iterator for random hexadecimal hashes\n\n    :param iterator_size:\n        Amount of hashes return before this iterator stops.\n        Goes on forever if `iterator_size` is negative.\n\n    :param int hash_length:\n        Size of each hash returned.\n\n    :return generator(unicode):\n    '''\n    if not isinstance(arg_0, int):\n        raise TypeError('iterator_size must be integer.')\n\n    arg_2 = 0\n    while arg_2 != arg_0:\n        arg_2 += 1\n        yield GetRandomHash(arg_1)", "path": "zerotk/easyfs/_easyfs.py", "identifier": "IterHashes", "docstring": "Iterator for random hexadecimal hashes\n\n    :param iterator_size:\n        Amount of hashes return before this iterator stops.\n        Goes on forever if `iterator_size` is negative.\n\n    :param int hash_length:\n        Size of each hash returned.\n\n    :return generator(unicode):", "docstring_tokens": ["Iterator", "for", "random", "hexadecimal", "hashes"], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 257318}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L1520-L1602", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Loads a certificate, public key or private key into a Certificate,\n    PublicKey or PrivateKey object via CryptoAPI", "language": "python", "parameters": "(key_object, key_info, container)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "'public'", "if", "isinstance", "(", "arg_1", ",", "keys", ".", "PublicKeyInfo", ")", "else", "'private'", "arg_4", "=", "arg_1", ".", "algorithm", "if", "arg_4", "==", "'rsa'", ":", "arg_5", "=", "Advapi32Const", ".", "MS_ENH_RSA_AES_PROV", "else", ":", "arg_5", "=", "Advapi32Const", ".", "MS_ENH_DSS_DH_PROV", "arg_6", "=", "None", "arg_7", "=", "None", "try", ":", "arg_6", "=", "open_context_handle", "(", "arg_5", ",", "verify_only", "=", "arg_3", "==", "'public'", ")", "arg_8", "=", "_advapi32_create_blob", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "arg_9", "=", "buffer_from_bytes", "(", "arg_8", ")", "arg_10", "=", "new", "(", "advapi32", ",", "'HCRYPTKEY *'", ")", "arg_11", "=", "advapi32", ".", "CryptImportKey", "(", "arg_6", ",", "arg_9", ",", "len", "(", "arg_8", ")", ",", "null", "(", ")", ",", "0", ",", "arg_10", ")", "handle_error", "(", "arg_11", ")", "arg_7", "=", "unwrap", "(", "arg_10", ")", "arg_12", "=", "arg_2", "(", "arg_7", ",", "arg_0", ")", "arg_12", ".", "context_handle", "=", "arg_6", "if", "arg_4", "==", "'rsa'", ":", "arg_13", "=", "_advapi32_create_blob", "(", "arg_1", ",", "arg_3", ",", "arg_4", ",", "signing", "=", "False", ")", "arg_14", "=", "buffer_from_bytes", "(", "arg_13", ")", "arg_15", "=", "new", "(", "advapi32", ",", "'HCRYPTKEY *'", ")", "arg_11", "=", "advapi32", ".", "CryptImportKey", "(", "arg_6", ",", "arg_14", ",", "len", "(", "arg_13", ")", ",", "null", "(", ")", ",", "0", ",", "arg_15", ")", "handle_error", "(", "arg_11", ")", "arg_12", ".", "ex_key_handle", "=", "unwrap", "(", "arg_15", ")", "return", "arg_12", "except", "(", "Exception", ")", ":", "if", "arg_7", ":", "advapi32", ".", "CryptDestroyKey", "(", "arg_7", ")", "if", "arg_6", ":", "close_context_handle", "(", "arg_6", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Loads a certificate, public key or private key into a Certificate,\n    PublicKey or PrivateKey object via CryptoAPI\n\n    :param key_object:\n        An asn1crypto.x509.Certificate, asn1crypto.keys.PublicKeyInfo or\n        asn1crypto.keys.PrivateKeyInfo object\n\n    :param key_info:\n        An asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo\n        object\n\n    :param container:\n        The class of the object to hold the key_handle\n\n    :raises:\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        oscrypto.errors.AsymmetricKeyError - when the key is incompatible with the OS crypto library\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A PrivateKey, PublicKey or Certificate object, based on container\n    \"\"\"\n\n    arg_3 = 'public' if isinstance(arg_1, keys.PublicKeyInfo) else 'private'\n    arg_4 = arg_1.algorithm\n\n    if arg_4 == 'rsa':\n        arg_5 = Advapi32Const.MS_ENH_RSA_AES_PROV\n    else:\n        arg_5 = Advapi32Const.MS_ENH_DSS_DH_PROV\n\n    arg_6 = None\n    arg_7 = None\n\n    try:\n        arg_6 = open_context_handle(arg_5, verify_only=arg_3 == 'public')\n\n        arg_8 = _advapi32_create_blob(arg_1, arg_3, arg_4)\n        arg_9 = buffer_from_bytes(arg_8)\n\n        arg_10 = new(advapi32, 'HCRYPTKEY *')\n        arg_11 = advapi32.CryptImportKey(\n            arg_6,\n            arg_9,\n            len(arg_8),\n            null(),\n            0,\n            arg_10\n        )\n        handle_error(arg_11)\n\n        arg_7 = unwrap(arg_10)\n        arg_12 = arg_2(arg_7, arg_0)\n        arg_12.context_handle = arg_6\n\n        if arg_4 == 'rsa':\n            arg_13 = _advapi32_create_blob(arg_1, arg_3, arg_4, signing=False)\n            arg_14 = buffer_from_bytes(arg_13)\n\n            arg_15 = new(advapi32, 'HCRYPTKEY *')\n            arg_11 = advapi32.CryptImportKey(\n                arg_6,\n                arg_14,\n                len(arg_13),\n                null(),\n                0,\n                arg_15\n            )\n            handle_error(arg_11)\n\n            arg_12.ex_key_handle = unwrap(arg_15)\n\n        return arg_12\n\n    except (Exception):\n        if arg_7:\n            advapi32.CryptDestroyKey(arg_7)\n        if arg_6:\n            close_context_handle(arg_6)\n        raise", "path": "oscrypto/_win/asymmetric.py", "identifier": "_advapi32_load_key", "docstring": "Loads a certificate, public key or private key into a Certificate,\n    PublicKey or PrivateKey object via CryptoAPI\n\n    :param key_object:\n        An asn1crypto.x509.Certificate, asn1crypto.keys.PublicKeyInfo or\n        asn1crypto.keys.PrivateKeyInfo object\n\n    :param key_info:\n        An asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo\n        object\n\n    :param container:\n        The class of the object to hold the key_handle\n\n    :raises:\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        oscrypto.errors.AsymmetricKeyError - when the key is incompatible with the OS crypto library\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A PrivateKey, PublicKey or Certificate object, based on container", "docstring_tokens": ["Loads", "a", "certificate", "public", "key", "or", "private", "key", "into", "a", "Certificate", "PublicKey", "or", "PrivateKey", "object", "via", "CryptoAPI"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 257319}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/parser.py#L77-L85", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "rule = identifier , \"=\" , expression , \";\" ;", "language": "python", "parameters": "(self, text)", "return_statement": "return concatenation([\n      self.identifier,\n      \"=\",\n      self.expression,\n      \";\",\n    ], ignore_whitespace=True)(text).retyped(TokenType.rule)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_attempting", "(", "arg_1", ")", "return", "concatenation", "(", "[", "arg_0", ".", "identifier", ",", "\"=\"", ",", "arg_0", ".", "expression", ",", "\";\"", ",", "]", ",", "ignore_whitespace", "=", "True", ")", "(", "arg_1", ")", ".", "retyped", "(", "TokenType", ".", "Func", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Func = identifier , \"=\" , expression , \";\" ;\"\"\"\n    arg_0._attempting(arg_1)\n    return concatenation([\n      arg_0.identifier,\n      \"=\",\n      arg_0.expression,\n      \";\",\n    ], ignore_whitespace=True)(arg_1).retyped(TokenType.Func)", "path": "pyebnf/parser.py", "identifier": "Parser.rule", "docstring": "rule = identifier , \"=\" , expression , \";\" ;", "docstring_tokens": ["rule", "=", "identifier", "=", "expression", ";", ";"], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 257320}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/quantumcircuit.py#L408-L467", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Draw the quantum circuit", "language": "python", "parameters": "(self, scale=0.7, filename=None, style=None, output='text',\n             interactive=False, line_length=None, plot_barriers=True,\n             reverse_bits=False, justify=None)", "return_statement": "return visualization.circuit_drawer(self, scale=scale,\n                                            filename=filename, style=style,\n                                            output=output,\n                                            interactive=interactive,\n                                            line_length=line_length,\n                                            plot_barriers=plot_barriers,\n                                            reverse_bits=reverse_bits,\n                                            justify=justify)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.7", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'text'", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "arg_7", "=", "True", ",", "arg_8", "=", "False", ",", "arg_9", "=", "None", ")", ":", "from", "qiskit", ".", "tools", "import", "visualization", "return", "visualization", ".", "circuit_Funcer", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1=0.7, arg_2=None, arg_3=None, arg_4='text',\n             arg_5=False, arg_6=None, arg_7=True,\n             arg_8=False, arg_9=None):\n        \"\"\"Draw the quantum circuit\n\n        Using the output parameter you can specify the format. The choices are:\n        0. text: ASCII art string\n        1. latex: high-quality images, but heavy external software dependencies\n        2. matplotlib: purely in Python with no external dependencies\n\n        Defaults to an overcomplete basis, in order to not alter gates.\n\n        Args:\n            scale (float): scale of image to Func (shrink if < 1)\n            filename (str): file path to save image to\n            style (dict or str): dictionary of style or file name of style\n                file. You can refer to the\n                :ref:`Style Dict Doc <style-dict-doc>` for more information\n                on the contents.\n            output (str): Select the output method to use for Funcing the\n                circuit. Valid choices are `text`, `latex`, `latex_source`,\n                `mpl`.\n            interactive (bool): when set true show the circuit in a new window\n                (for `mpl` this depends on the matplotlib backend being used\n                supporting this). Note when used with either the `text` or the\n                `latex_source` output type this has no effect and will be\n                silently ignored.\n            line_length (int): sets the length of the lines generated by `text`\n            reverse_bits (bool): When set to True reverse the bit order inside\n                registers for the output visualization.\n            plot_barriers (bool): Enable/disable Funcing barriers in the output\n                circuit. Defaults to True.\n            justify (string): Options are `left`, `right` or `none`, if anything\n                else is supplied it defaults to left justified. It refers to where\n                gates should be placed in the output circuit if there is an option.\n                `none` results in each gate being placed in its own column. Currently\n                only supported by text Funcer.\n\n        Returns:\n            PIL.Image or matplotlib.figure or str or TextDrawing:\n                * PIL.Image: (output `latex`) an in-memory representation of the\n                  image of the circuit diagram.\n                * matplotlib.figure: (output `mpl`) a matplotlib figure object\n                  for the circuit diagram.\n                * str: (output `latex_source`). The LaTeX source code.\n                * TextDrawing: (output `text`). A Funcing that can be printed as\n                  ascii art\n\n        Raises:\n            VisualizationError: when an invalid output method is selected\n        \"\"\"\n        from qiskit.tools import visualization\n        return visualization.circuit_Funcer(arg_0, arg_1=arg_1,\n                                            arg_2=arg_2, arg_3=arg_3,\n                                            arg_4=arg_4,\n                                            arg_5=arg_5,\n                                            arg_6=arg_6,\n                                            arg_7=arg_7,\n                                            arg_8=arg_8,\n                                            arg_9=arg_9)", "path": "qiskit/circuit/quantumcircuit.py", "identifier": "QuantumCircuit.draw", "docstring": "Draw the quantum circuit\n\n        Using the output parameter you can specify the format. The choices are:\n        0. text: ASCII art string\n        1. latex: high-quality images, but heavy external software dependencies\n        2. matplotlib: purely in Python with no external dependencies\n\n        Defaults to an overcomplete basis, in order to not alter gates.\n\n        Args:\n            scale (float): scale of image to draw (shrink if < 1)\n            filename (str): file path to save image to\n            style (dict or str): dictionary of style or file name of style\n                file. You can refer to the\n                :ref:`Style Dict Doc <style-dict-doc>` for more information\n                on the contents.\n            output (str): Select the output method to use for drawing the\n                circuit. Valid choices are `text`, `latex`, `latex_source`,\n                `mpl`.\n            interactive (bool): when set true show the circuit in a new window\n                (for `mpl` this depends on the matplotlib backend being used\n                supporting this). Note when used with either the `text` or the\n                `latex_source` output type this has no effect and will be\n                silently ignored.\n            line_length (int): sets the length of the lines generated by `text`\n            reverse_bits (bool): When set to True reverse the bit order inside\n                registers for the output visualization.\n            plot_barriers (bool): Enable/disable drawing barriers in the output\n                circuit. Defaults to True.\n            justify (string): Options are `left`, `right` or `none`, if anything\n                else is supplied it defaults to left justified. It refers to where\n                gates should be placed in the output circuit if there is an option.\n                `none` results in each gate being placed in its own column. Currently\n                only supported by text drawer.\n\n        Returns:\n            PIL.Image or matplotlib.figure or str or TextDrawing:\n                * PIL.Image: (output `latex`) an in-memory representation of the\n                  image of the circuit diagram.\n                * matplotlib.figure: (output `mpl`) a matplotlib figure object\n                  for the circuit diagram.\n                * str: (output `latex_source`). The LaTeX source code.\n                * TextDrawing: (output `text`). A drawing that can be printed as\n                  ascii art\n\n        Raises:\n            VisualizationError: when an invalid output method is selected", "docstring_tokens": ["Draw", "the", "quantum", "circuit"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257321}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/bugzilla.py#L185-L198", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a Bugzilla CSV bug list.", "language": "python", "parameters": "(raw_csv)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "csv", ".", "DictReader", "(", "arg_0", ".", "split", "(", "'\\n'", ")", ",", "delimiter", "=", "','", ",", "quotechar", "=", "'\"'", ")", "for", "arg_2", "in", "arg_1", ":", "yield", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Parse a Bugzilla CSV bug list.\n\n        The method parses the CSV file and returns an iterator of\n        dictionaries. Each one of this, contains the summary of a bug.\n\n        :param raw_csv: CSV string to parse\n\n        :returns: a generator of parsed bugs\n        \"\"\"\n        arg_1 = csv.DictReader(arg_0.split('\\n'),\n                                delimiter=',', quotechar='\"')\n        for arg_2 in arg_1:\n            yield arg_2", "path": "perceval/backends/core/bugzilla.py", "identifier": "Bugzilla.parse_buglist", "docstring": "Parse a Bugzilla CSV bug list.\n\n        The method parses the CSV file and returns an iterator of\n        dictionaries. Each one of this, contains the summary of a bug.\n\n        :param raw_csv: CSV string to parse\n\n        :returns: a generator of parsed bugs", "docstring_tokens": ["Parse", "a", "Bugzilla", "CSV", "bug", "list", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257322}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/her/rollout.py#L157-L169", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Generates a dictionary that contains all collected statistics.", "language": "python", "parameters": "(self, prefix='worker')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'worker'", ")", ":", "Func", "=", "[", "]", "Func", "+=", "[", "(", "'success_rate'", ",", "np", ".", "mean", "(", "arg_0", ".", "success_history", ")", ")", "]", "if", "arg_0", ".", "compute_Q", ":", "Func", "+=", "[", "(", "'mean_Q'", ",", "np", ".", "mean", "(", "arg_0", ".", "Q_history", ")", ")", "]", "Func", "+=", "[", "(", "'episode'", ",", "arg_0", ".", "n_episodes", ")", "]", "if", "arg_1", "!=", "''", "and", "not", "arg_1", ".", "endswith", "(", "'/'", ")", ":", "return", "[", "(", "arg_1", "+", "'/'", "+", "arg_3", ",", "arg_4", ")", "for", "arg_3", ",", "arg_4", "in", "Func", "]", "else", ":", "return", "Func"], "function": "def Func(arg_0, arg_1='worker'):\n        \"\"\"Generates a dictionary that contains all collected statistics.\n        \"\"\"\n        Func = []\n        Func += [('success_rate', np.mean(arg_0.success_history))]\n        if arg_0.compute_Q:\n            Func += [('mean_Q', np.mean(arg_0.Q_history))]\n        Func += [('episode', arg_0.n_episodes)]\n\n        if arg_1 != '' and not arg_1.endswith('/'):\n            return [(arg_1 + '/' + arg_3, arg_4) for arg_3, arg_4 in Func]\n        else:\n            return Func", "path": "baselines/her/rollout.py", "identifier": "RolloutWorker.logs", "docstring": "Generates a dictionary that contains all collected statistics.", "docstring_tokens": ["Generates", "a", "dictionary", "that", "contains", "all", "collected", "statistics", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 257323}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L196-L245", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Applies expdecay_despiker and noise_despiker to data.", "language": "python", "parameters": "(self, expdecay_despiker=True, exponent=None,\n                noise_despiker=True, win=3, nlim=12., maxiter=3)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "3", ",", "arg_5", "=", "12.", ",", "arg_6", "=", "3", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'Funcd'", ")", ":", "arg_0", ".", "data", "[", "'Funcd'", "]", "=", "Bunch", "(", ")", "arg_8", "=", "{", "}", "for", "arg_9", ",", "arg_10", "in", "arg_0", ".", "focus", ".", "items", "(", ")", ":", "if", "'time'", "not", "in", "arg_9", ".", "lower", "(", ")", ":", "arg_11", "=", "arg_10", ".", "copy", "(", ")", "if", "arg_1", ":", "if", "arg_2", "is", "not", "None", ":", "arg_11", "=", "proc", ".", "expdecay_Func", "(", "arg_11", ",", "arg_2", ",", "arg_0", ".", "tstep", ",", "arg_6", ")", "else", ":", "warnings", ".", "warn", "(", "'exponent is None - either provide exponent, or run at `analyse`\\nlevel to automatically calculate it.'", ")", "if", "arg_3", ":", "arg_11", "=", "proc", ".", "noise_Func", "(", "arg_11", ",", "int", "(", "arg_4", ")", ",", "arg_5", ",", "arg_6", ")", "arg_8", "[", "arg_9", "]", "=", "arg_11", "arg_0", ".", "data", "[", "'Funcd'", "]", ".", "update", "(", "arg_8", ")", "arg_0", ".", "data", "[", "'total_counts'", "]", "=", "sum", "(", "arg_0", ".", "data", "[", "'Funcd'", "]", ".", "values", "(", ")", ")", "arg_0", ".", "setfocus", "(", "'Funcd'", ")", "return"], "function": "def Func(arg_0, arg_1=True, arg_2=None,\n                arg_3=True, arg_4=3, arg_5=12., arg_6=3):\n        \"\"\"\n        Applies expdecay_Funcr and noise_Funcr to data.\n\n        Parameters\n        ----------\n        expdecay_Funcr : bool\n            Whether or not to apply the exponential decay filter.\n        exponent : None or float\n            The exponent for the exponential decay filter. If None,\n            it is determined automatically using `find_expocoef`.\n        noise_Funcr : bool\n            Whether or not to apply the standard deviation spike filter.\n        win : int\n            The rolling window over which the spike filter calculates\n            the trace statistics.\n        nlim : float\n            The number of standard deviations above the rolling mean\n            that data are excluded.\n        maxiter : int\n            The max number of times that the fitler is applied.\n\n        Returns\n        -------\n        None\n\n        \"\"\"\n        if not hasattr(arg_0, 'Funcd'):\n            arg_0.data['Funcd'] = Bunch()\n\n        arg_8 = {}\n        for arg_9, arg_10 in arg_0.focus.items():\n            if 'time' not in arg_9.lower():\n                arg_11 = arg_10.copy()  # copy data\n                if arg_1:\n                    if arg_2 is not None:\n                        arg_11 = proc.expdecay_Func(arg_11, arg_2, arg_0.tstep, arg_6)\n                    else:\n                        warnings.warn('exponent is None - either provide exponent, or run at `analyse`\\nlevel to automatically calculate it.')\n                \n                if arg_3:\n                    arg_11 = proc.noise_Func(arg_11, int(arg_4), arg_5, arg_6)\n                arg_8[arg_9] = arg_11\n\n        arg_0.data['Funcd'].update(arg_8)\n        # recalculate total counts\n        arg_0.data['total_counts'] = sum(arg_0.data['Funcd'].values())\n        arg_0.setfocus('Funcd')\n        return", "path": "latools/D_obj.py", "identifier": "D.despike", "docstring": "Applies expdecay_despiker and noise_despiker to data.\n\n        Parameters\n        ----------\n        expdecay_despiker : bool\n            Whether or not to apply the exponential decay filter.\n        exponent : None or float\n            The exponent for the exponential decay filter. If None,\n            it is determined automatically using `find_expocoef`.\n        noise_despiker : bool\n            Whether or not to apply the standard deviation spike filter.\n        win : int\n            The rolling window over which the spike filter calculates\n            the trace statistics.\n        nlim : float\n            The number of standard deviations above the rolling mean\n            that data are excluded.\n        maxiter : int\n            The max number of times that the fitler is applied.\n\n        Returns\n        -------\n        None", "docstring_tokens": ["Applies", "expdecay_despiker", "and", "noise_despiker", "to", "data", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257324}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/conversions.py#L70-L155", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Generates RGB values from HSV that have an even visual\n    distribution.  Be careful as this method is only have as fast as\n    hsv2rgb_spectrum.", "language": "python", "parameters": "(hsv)", "return_statement": "return (r, g, b)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "nscale8x3_video", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "0", "if", "arg_4", "!=", "0", ":", "arg_5", "=", "1", "if", "arg_1", "!=", "0", ":", "arg_1", "=", "(", "(", "arg_1", "*", "arg_4", ")", ">>", "8", ")", "+", "arg_5", "if", "arg_2", "!=", "0", ":", "arg_2", "=", "(", "(", "arg_2", "*", "arg_4", ")", ">>", "8", ")", "+", "arg_5", "if", "arg_3", "!=", "0", ":", "arg_3", "=", "(", "(", "arg_3", "*", "arg_4", ")", ">>", "8", ")", "+", "arg_5", "return", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "def", "scale8_video_LEAVING_R1_DIRTY", "(", "arg_6", ",", "arg_4", ")", ":", "arg_5", "=", "0", "if", "arg_4", "!=", "0", ":", "arg_5", "=", "1", "if", "arg_6", "!=", "0", ":", "arg_6", "=", "(", "(", "arg_6", "*", "arg_4", ")", ">>", "8", ")", "+", "arg_5", "return", "arg_6", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_0", "arg_10", "=", "arg_7", "&", "0x1F", "arg_11", "=", "arg_10", "*", "8", "arg_12", "=", "(", "arg_11", "*", "(", "256", "//", "3", ")", ")", ">>", "8", "arg_1", ",", "arg_2", ",", "arg_3", "=", "(", "0", ",", "0", ",", "0", ")", "if", "not", "(", "arg_7", "&", "0x80", ")", ":", "if", "not", "(", "arg_7", "&", "0x40", ")", ":", "if", "not", "(", "arg_7", "&", "0x20", ")", ":", "arg_1", "=", "255", "-", "arg_12", "arg_2", "=", "arg_12", "arg_3", "=", "0", "else", ":", "arg_1", "=", "171", "arg_2", "=", "85", "+", "arg_12", "arg_3", "=", "0x00", "else", ":", "if", "not", "(", "arg_7", "&", "0x20", ")", ":", "arg_13", "=", "(", "arg_12", "<<", "1", ")", "arg_1", "=", "171", "-", "arg_13", "arg_2", "=", "171", "+", "arg_12", "arg_3", "=", "0", "else", ":", "arg_1", "=", "0", "arg_2", "=", "255", "-", "arg_12", "arg_3", "=", "arg_12", "else", ":", "if", "not", "(", "arg_7", "&", "0x40", ")", ":", "if", "not", "(", "arg_7", "&", "0x20", ")", ":", "arg_1", "=", "0x00", "arg_13", "=", "(", "arg_12", "<<", "1", ")", "arg_2", "=", "171", "-", "arg_13", "arg_3", "=", "85", "+", "arg_13", "else", ":", "arg_1", "=", "arg_12", "arg_2", "=", "0", "arg_3", "=", "255", "-", "arg_12", "else", ":", "if", "not", "(", "arg_7", "&", "0x20", ")", ":", "arg_1", "=", "85", "+", "arg_12", "arg_2", "=", "0", "arg_3", "=", "171", "-", "arg_12", "else", ":", "arg_1", "=", "171", "+", "arg_12", "arg_2", "=", "0x00", "arg_3", "=", "85", "-", "arg_12", "if", "arg_8", "!=", "255", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "nscale8x3_video", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_8", ")", "arg_14", "=", "255", "-", "arg_8", "arg_14", "=", "(", "arg_14", "*", "arg_14", ")", ">>", "8", "arg_15", "=", "arg_14", "arg_1", "=", "arg_1", "+", "arg_15", "arg_2", "=", "arg_2", "+", "arg_15", "arg_3", "=", "arg_3", "+", "arg_15", "if", "arg_9", "!=", "255", ":", "arg_9", "=", "scale8_video_LEAVING_R1_DIRTY", "(", "arg_9", ",", "arg_9", ")", "arg_1", ",", "arg_2", ",", "arg_3", "=", "nscale8x3_video", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_9", ")", "return", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Generates RGB values from HSV that have an even visual\n    distribution.  Be careful as this method is only have as fast as\n    hsv2rgb_spectrum.\"\"\"\n\n    def nscale8x3_video(arg_1, arg_2, arg_3, arg_4):\n        arg_5 = 0\n        if arg_4 != 0:\n            arg_5 = 1\n        if arg_1 != 0:\n            arg_1 = ((arg_1 * arg_4) >> 8) + arg_5\n        if arg_2 != 0:\n            arg_2 = ((arg_2 * arg_4) >> 8) + arg_5\n        if arg_3 != 0:\n            arg_3 = ((arg_3 * arg_4) >> 8) + arg_5\n        return (arg_1, arg_2, arg_3)\n\n    def scale8_video_LEAVING_R1_DIRTY(arg_6, arg_4):\n        arg_5 = 0\n        if arg_4 != 0:\n            arg_5 = 1\n        if arg_6 != 0:\n            arg_6 = ((arg_6 * arg_4) >> 8) + arg_5\n        return arg_6\n\n    arg_7, arg_8, arg_9 = arg_0\n    arg_10 = arg_7 & 0x1F  # 0..31\n    arg_11 = arg_10 * 8\n    arg_12 = (arg_11 * (256 // 3)) >> 8\n    arg_1, arg_2, arg_3 = (0, 0, 0)\n\n    if not (arg_7 & 0x80):\n        if not (arg_7 & 0x40):\n            if not (arg_7 & 0x20):\n                arg_1 = 255 - arg_12\n                arg_2 = arg_12\n                arg_3 = 0\n            else:\n                arg_1 = 171\n                arg_2 = 85 + arg_12\n                arg_3 = 0x00\n        else:\n            if not (arg_7 & 0x20):\n                arg_13 = (arg_12 << 1)\n                arg_1 = 171 - arg_13\n                arg_2 = 171 + arg_12\n                arg_3 = 0\n            else:\n                arg_1 = 0\n                arg_2 = 255 - arg_12\n                arg_3 = arg_12\n    else:\n        if not (arg_7 & 0x40):\n            if not (arg_7 & 0x20):\n                arg_1 = 0x00\n                arg_13 = (arg_12 << 1)\n                arg_2 = 171 - arg_13\n                arg_3 = 85 + arg_13\n            else:\n                arg_1 = arg_12\n                arg_2 = 0\n                arg_3 = 255 - arg_12\n        else:\n            if not (arg_7 & 0x20):\n                arg_1 = 85 + arg_12\n                arg_2 = 0\n                arg_3 = 171 - arg_12\n            else:\n                arg_1 = 171 + arg_12\n                arg_2 = 0x00\n                arg_3 = 85 - arg_12\n\n    if arg_8 != 255:\n        arg_1, arg_2, arg_3 = nscale8x3_video(arg_1, arg_2, arg_3, arg_8)\n        arg_14 = 255 - arg_8\n        arg_14 = (arg_14 * arg_14) >> 8\n        arg_15 = arg_14\n        arg_1 = arg_1 + arg_15\n        arg_2 = arg_2 + arg_15\n        arg_3 = arg_3 + arg_15\n\n    if arg_9 != 255:\n        arg_9 = scale8_video_LEAVING_R1_DIRTY(arg_9, arg_9)\n        arg_1, arg_2, arg_3 = nscale8x3_video(arg_1, arg_2, arg_3, arg_9)\n\n    return (arg_1, arg_2, arg_3)", "path": "bibliopixel/colors/conversions.py", "identifier": "hsv2rgb_rainbow", "docstring": "Generates RGB values from HSV that have an even visual\n    distribution.  Be careful as this method is only have as fast as\n    hsv2rgb_spectrum.", "docstring_tokens": ["Generates", "RGB", "values", "from", "HSV", "that", "have", "an", "even", "visual", "distribution", ".", "Be", "careful", "as", "this", "method", "is", "only", "have", "as", "fast", "as", "hsv2rgb_spectrum", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 257325}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4312-L4338", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "select_lasso and select almost share the same code", "language": "python", "parameters": "(self, create_selection, name, executor=None, execute_fully=False)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", ".", "selection_histories", "[", "arg_2", "]", "arg_6", "=", "arg_0", ".", "selection_history_indices", "[", "arg_2", "]", "arg_7", "=", "arg_5", "[", "arg_6", "]", "if", "arg_5", "else", "None", "arg_8", "=", "arg_1", "(", "arg_7", ")", "arg_3", "=", "arg_3", "or", "arg_0", ".", "executor", "arg_5", ".", "append", "(", "arg_8", ")", "arg_0", ".", "selection_history_indices", "[", "arg_2", "]", "+=", "1", "del", "arg_5", "[", "arg_0", ".", "selection_history_indices", "[", "arg_2", "]", ":", "-", "1", "]", "if", "0", ":", "if", "arg_0", ".", "is_local", "(", ")", ":", "if", "arg_8", ":", "arg_9", "=", "vaex", ".", "promise", ".", "Promise", ".", "fulfilled", "(", "None", ")", "arg_0", ".", "signalFunc_changed", ".", "emit", "(", "arg_0", ")", "else", ":", "arg_9", "=", "vaex", ".", "promise", ".", "Promise", ".", "fulfilled", "(", "None", ")", "arg_0", ".", "signalFunc_changed", ".", "emit", "(", "arg_0", ")", "else", ":", "arg_0", ".", "signalFunc_changed", ".", "emit", "(", "arg_0", ")", "arg_9", "=", "vaex", ".", "promise", ".", "Promise", ".", "fulfilled", "(", "None", ")", "arg_0", ".", "signalFunc_changed", ".", "emit", "(", "arg_0", ")", "arg_9", "=", "vaex", ".", "promise", ".", "Promise", ".", "fulfilled", "(", "None", ")", "logger", ".", "debug", "(", "\"select selection history is %r, index is %r\"", ",", "arg_5", ",", "arg_0", ".", "selection_history_indices", "[", "arg_2", "]", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=False):\n        \"\"\"select_lasso and select almost share the same code\"\"\"\n        arg_5 = arg_0.selection_histories[arg_2]\n        arg_6 = arg_0.selection_history_indices[arg_2]\n        arg_7 = arg_5[arg_6] if arg_5 else None\n        arg_8 = arg_1(arg_7)\n        arg_3 = arg_3 or arg_0.executor\n        arg_5.append(arg_8)\n        arg_0.selection_history_indices[arg_2] += 1\n        # clip any redo history\n        del arg_5[arg_0.selection_history_indices[arg_2]:-1]\n        if 0:\n            if arg_0.is_local():\n                if arg_8:\n                    # result = selection.execute(executor=executor, execute_fully=execute_fully)\n                    arg_9 = vaex.promise.Promise.fulfilled(None)\n                    arg_0.signalFunc_changed.emit(arg_0)\n                else:\n                    arg_9 = vaex.promise.Promise.fulfilled(None)\n                    arg_0.signalFunc_changed.emit(arg_0)\n            else:\n                arg_0.signalFunc_changed.emit(arg_0)\n                arg_9 = vaex.promise.Promise.fulfilled(None)\n        arg_0.signalFunc_changed.emit(arg_0)\n        arg_9 = vaex.promise.Promise.fulfilled(None)\n        logger.debug(\"select selection history is %r, index is %r\", arg_5, arg_0.selection_history_indices[arg_2])\n        return arg_9", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame._selection", "docstring": "select_lasso and select almost share the same code", "docstring_tokens": ["select_lasso", "and", "select", "almost", "share", "the", "same", "code"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257326}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L678-L690", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Route for specific assets.", "language": "python", "parameters": "(self, filetype, asset)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "in", "arg_0", ".", "assets", "and", "arg_2", "in", "arg_0", ".", "assets", "[", "arg_1", "]", "and", "arg_0", ".", "assets", "[", "arg_1", "]", "[", "arg_2", "]", ":", "return", "send_from_directory", "(", "directory", "=", "arg_0", ".", "assets", "[", "arg_1", "]", "[", "arg_2", "]", ",", "filename", "=", "arg_2", ")", "abort", "(", "404", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Route for specific assets.\n\n        :param filetype: Asset Type\n        :param asset: Filename of an asset\n        :return: Response\n        \"\"\"\n        if arg_1 in arg_0.assets and arg_2 in arg_0.assets[arg_1] and arg_0.assets[arg_1][arg_2]:\n            return send_from_directory(\n                directory=arg_0.assets[arg_1][arg_2],\n                filename=arg_2\n            )\n        abort(404)", "path": "flask_nemo/__init__.py", "identifier": "Nemo.r_assets", "docstring": "Route for specific assets.\n\n        :param filetype: Asset Type\n        :param asset: Filename of an asset\n        :return: Response", "docstring_tokens": ["Route", "for", "specific", "assets", "."], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 257327}
{"url": "https://github.com/davidmiller/urlhelp/blob/9cc417a5dc5bd4a7e17ed78a1f1394a6ece9faa5/urlhelp/__init__.py#L21-L32", "sha": "9cc417a5dc5bd4a7e17ed78a1f1394a6ece9faa5", "docstring_summary": "Given a URL, check to see if there is an assocaited protocol.", "language": "python", "parameters": "(url)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "compile", "(", "r'https?:{0,1}/{1,2}'", ")", "arg_2", "=", "urlparse", ".", "urlparse", "(", "arg_0", ")", "if", "not", "arg_2", ".", "scheme", "and", "not", "arg_1", ".", "search", "(", "arg_0", ")", ":", "arg_0", "=", "'http://{0}'", ".", "format", "(", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"\n    Given a URL, check to see if there is an assocaited protocol.\n\n    If not, set the protocol to HTTP and return the Funcd URL\n    \"\"\"\n    # Use the regex to match http//localhost/something\n    arg_1 = re.compile(r'https?:{0,1}/{1,2}')\n    arg_2 = urlparse.urlparse(arg_0)\n    if not arg_2.scheme and not arg_1.search(arg_0):\n        arg_0 = 'http://{0}'.format(arg_0)\n    return arg_0", "path": "urlhelp/__init__.py", "identifier": "protocolise", "docstring": "Given a URL, check to see if there is an assocaited protocol.\n\n    If not, set the protocol to HTTP and return the protocolised URL", "docstring_tokens": ["Given", "a", "URL", "check", "to", "see", "if", "there", "is", "an", "assocaited", "protocol", "."], "nwo": "davidmiller/urlhelp", "score": 0.09252797783733271, "idx": 257328}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L184-L188", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Generic subcommand integer value display", "language": "python", "parameters": "(obj, what=None)", "return_statement": "return obj.msg(\"%s is %d.\" % (what, val))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "debugger", ".", "settings", "[", "arg_0", ".", "name", "]", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "name", "return", "arg_0", ".", "msg", "(", "\"%s is %d.\"", "%", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Generic subcommand integer value display\"\"\"\n    arg_2 = arg_0.debugger.settings[arg_0.name]\n    if not arg_1: arg_1 = arg_0.name\n    return arg_0.msg(\"%s is %d.\" % (arg_1, arg_2))", "path": "trepan/processor/cmdfns.py", "identifier": "run_show_int", "docstring": "Generic subcommand integer value display", "docstring_tokens": ["Generic", "subcommand", "integer", "value", "display"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 257329}
{"url": "https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L73-L161", "sha": "1cdf4ed2573c894bde9d398fa173816b6b47e9f3", "docstring_summary": "Send message dicts through r_q, and throw explicit errors for \n        pickle problems", "language": "python", "parameters": "(self, msg_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "invalid_dict_pickle_keys", "(", "arg_1", ")", "if", "arg_2", "==", "[", "]", ":", "arg_0", ".", "r_q", ".", "put", "(", "arg_1", ")", "else", ":", "arg_3", "=", "md5", "(", ")", "arg_3", ".", "update", "(", "str", "(", "arg_1", ")", ")", "arg_4", "=", "str", "(", "arg_3", ".", "hexdigest", "(", ")", ")", "[", "-", "7", ":", "]", "arg_5", "=", "os", ".", "linesep", "sys", ".", "stderr", ".", "write", "(", "\"{0} {1}Func({2}) Can't pickle this dict:{3} '''{7}{4}   {5}{7}{6}''' {7}\"", ".", "format", "(", "datetime", ".", "now", "(", ")", ",", "Style", ".", "BRIGHT", ",", "arg_4", ",", "Style", ".", "RESET_ALL", ",", "Fore", ".", "MAGENTA", ",", "arg_1", ",", "Style", ".", "RESET_ALL", ",", "arg_5", ",", ")", ")", "arg_6", "=", "(", "Style", ".", "BRIGHT", "+", "\"    Func({0}) Offending dict keys:\"", ".", "format", "(", "arg_4", ")", "+", "Style", ".", "RESET_ALL", ")", "arg_7", "=", "Fore", ".", "YELLOW", "+", "\" {0}\"", ".", "format", "(", "arg_2", ")", "+", "Style", ".", "RESET_ALL", "arg_8", "=", "\"{0}\"", ".", "format", "(", "arg_5", ")", "sys", ".", "stderr", ".", "write", "(", "arg_6", "+", "arg_7", "+", "arg_8", ")", "for", "arg_9", "in", "sorted", "(", "arg_2", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"      msg_dict['{0}']: {1}'{2}'{3}{4}\"", ".", "format", "(", "arg_9", ",", "Fore", ".", "MAGENTA", ",", "repr", "(", "arg_1", ".", "get", "(", "arg_9", ")", ")", ",", "Style", ".", "RESET_ALL", ",", "arg_5", ",", ")", ")", "if", "isinstance", "(", "arg_1", ".", "get", "(", "arg_9", ")", ",", "object", ")", ":", "arg_10", "=", "arg_1", ".", "get", "(", "arg_9", ")", "arg_11", "=", "arg_0", ".", "invalid_obj_pickle_attrs", "(", "arg_10", ")", "arg_6", "=", "(", "Style", ".", "BRIGHT", "+", "\"      Func({0}) Offending attrs:\"", ".", "format", "(", "arg_4", ")", "+", "Style", ".", "RESET_ALL", ")", "arg_7", "=", "(", "Fore", ".", "YELLOW", "+", "\" {0}\"", ".", "format", "(", "arg_11", ")", "+", "Style", ".", "RESET_ALL", ")", "arg_8", "=", "\"{0}\"", ".", "format", "(", "arg_5", ")", "sys", ".", "stderr", ".", "write", "(", "arg_6", "+", "arg_7", "+", "arg_8", ")", "for", "arg_12", "in", "arg_11", ":", "sys", ".", "stderr", ".", "write", "(", "\"        msg_dict['{0}'].{1}: {2}'{3}'{4}{5}\"", ".", "format", "(", "arg_9", ",", "arg_12", ",", "Fore", ".", "RED", ",", "repr", "(", "getattr", "(", "arg_10", ",", "arg_12", ")", ")", ",", "Style", ".", "RESET_ALL", ",", "arg_5", ",", ")", ")", "sys", ".", "stderr", ".", "write", "(", "\"    {0}Func({1}) keys (no problems):{2}{3}\"", ".", "format", "(", "Style", ".", "BRIGHT", ",", "arg_4", ",", "Style", ".", "RESET_ALL", ",", "arg_5", ")", ")", "for", "arg_9", "in", "sorted", "(", "set", "(", "arg_1", ".", "keys", "(", ")", ")", ".", "difference", "(", "arg_2", ")", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"      msg_dict['{0}']: {1}{2}{3}{4}\"", ".", "format", "(", "arg_9", ",", "Fore", ".", "GREEN", ",", "repr", "(", "arg_1", ".", "get", "(", "arg_9", ")", ")", ",", "Style", ".", "RESET_ALL", ",", "arg_5", ",", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Send message dicts through r_q, and throw explicit errors for \n        pickle problems\"\"\"\n\n        # Check whether msg_dict can be pickled...\n        arg_2 = arg_0.invalid_dict_pickle_keys(arg_1)\n\n        if arg_2 == []:\n            arg_0.r_q.put(arg_1)\n\n        else:\n            ## Explicit pickle error handling\n            arg_3 = md5()\n            arg_3.update(str(arg_1))\n            arg_4 = str(arg_3.hexdigest())[-7:]  # Last 7 digits of hash\n            arg_5 = os.linesep\n            sys.stderr.write(\n                \"{0} {1}Func({2}) Can't pickle this dict:{3} '''{7}{4}   {5}{7}{6}''' {7}\".format(\n                    datetime.now(),\n                    Style.BRIGHT,\n                    arg_4,\n                    Style.RESET_ALL,\n                    Fore.MAGENTA,\n                    arg_1,\n                    Style.RESET_ALL,\n                    arg_5,\n                )\n            )\n\n            ## Verbose list of the offending key(s) / object attrs\n            ## Send all output to stderr...\n            arg_6 = (\n                Style.BRIGHT\n                + \"    Func({0}) Offending dict keys:\".format(arg_4)\n                + Style.RESET_ALL\n            )\n            arg_7 = Fore.YELLOW + \" {0}\".format(arg_2) + Style.RESET_ALL\n            arg_8 = \"{0}\".format(arg_5)\n            sys.stderr.write(arg_6 + arg_7 + arg_8)\n            for arg_9 in sorted(arg_2):\n                sys.stderr.write(\n                    \"      msg_dict['{0}']: {1}'{2}'{3}{4}\".format(\n                        arg_9,\n                        Fore.MAGENTA,\n                        repr(arg_1.get(arg_9)),\n                        Style.RESET_ALL,\n                        arg_5,\n                    )\n                )\n                if isinstance(arg_1.get(arg_9), object):\n                    arg_10 = arg_1.get(arg_9)\n                    arg_11 = arg_0.invalid_obj_pickle_attrs(arg_10)\n                    arg_6 = (\n                        Style.BRIGHT\n                        + \"      Func({0}) Offending attrs:\".format(arg_4)\n                        + Style.RESET_ALL\n                    )\n                    arg_7 = (\n                        Fore.YELLOW + \" {0}\".format(arg_11) + Style.RESET_ALL\n                    )\n                    arg_8 = \"{0}\".format(arg_5)\n                    sys.stderr.write(arg_6 + arg_7 + arg_8)\n                    for arg_12 in arg_11:\n                        sys.stderr.write(\n                            \"        msg_dict['{0}'].{1}: {2}'{3}'{4}{5}\".format(\n                                arg_9,\n                                arg_12,\n                                Fore.RED,\n                                repr(getattr(arg_10, arg_12)),\n                                Style.RESET_ALL,\n                                arg_5,\n                            )\n                        )\n\n            sys.stderr.write(\n                \"    {0}Func({1}) keys (no problems):{2}{3}\".format(\n                    Style.BRIGHT, arg_4, Style.RESET_ALL, arg_5\n                )\n            )\n            for arg_9 in sorted(set(arg_1.keys()).difference(arg_2)):\n                sys.stderr.write(\n                    \"      msg_dict['{0}']: {1}{2}{3}{4}\".format(\n                        arg_9,\n                        Fore.GREEN,\n                        repr(arg_1.get(arg_9)),\n                        Style.RESET_ALL,\n                        arg_5,\n                    )\n                )", "path": "polymer/Polymer.py", "identifier": "Worker.r_q_send", "docstring": "Send message dicts through r_q, and throw explicit errors for \n        pickle problems", "docstring_tokens": ["Send", "message", "dicts", "through", "r_q", "and", "throw", "explicit", "errors", "for", "pickle", "problems"], "nwo": "mpenning/polymer", "score": 0.26949921653275793, "idx": 257330}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/memory_profiler.py#L156-L165", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Returns memory stats for a package.", "language": "python", "parameters": "(self)", "return_statement": "return prof, None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "base_profiler", ".", "get_pkg_module_names", "(", "arg_0", ".", "_run_object", ")", "try", ":", "with", "_CodeEventsTracker", "(", "arg_1", ")", "as", "prof", ":", "prof", ".", "compute_mem_overhead", "(", ")", "runpy", ".", "run_path", "(", "arg_0", ".", "_run_object", ",", "run_name", "=", "'__main__'", ")", "except", "SystemExit", ":", "pass", "return", "prof", ",", "None"], "function": "def Func(arg_0):\n        \"\"\"Returns memory stats for a package.\"\"\"\n        arg_1 = base_profiler.get_pkg_module_names(arg_0._run_object)\n        try:\n            with _CodeEventsTracker(arg_1) as prof:\n                prof.compute_mem_overhead()\n                runpy.run_path(arg_0._run_object, run_name='__main__')\n        except SystemExit:\n            pass\n        return prof, None", "path": "vprof/memory_profiler.py", "identifier": "MemoryProfiler.profile_package", "docstring": "Returns memory stats for a package.", "docstring_tokens": ["Returns", "memory", "stats", "for", "a", "package", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 257331}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/threading.py#L576-L585", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Set the internal flag to true.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "__cond", ":", "arg_0", ".", "__flag", "=", "True", "arg_0", ".", "__cond", ".", "notify_all", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Set the internal flag to true.\n\n        All threads waiting for the flag to become true are awakened. Threads\n        that call wait() once the flag is true will not block at all.\n\n        \"\"\"\n        with arg_0.__cond:\n            arg_0.__flag = True\n            arg_0.__cond.notify_all()", "path": "third_party/stdlib/threading.py", "identifier": "_Event.set", "docstring": "Set the internal flag to true.\n\n        All threads waiting for the flag to become true are awakened. Threads\n        that call wait() once the flag is true will not block at all.", "docstring_tokens": ["Set", "the", "internal", "flag", "to", "true", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257332}
{"url": "https://github.com/zinic/pynsive/blob/15bc8b35a91be5817979eb327427b6235b1b411e/pynsive/plugin/loader.py#L102-L129", "sha": "15bc8b35a91be5817979eb327427b6235b1b411e", "docstring_summary": "Searches the paths for the required module.", "language": "python", "parameters": "(self, module_name, path=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "*", "arg_1", ".", "split", "(", "MODULE_PATH_SEP", ")", ")", "for", "arg_4", "in", "arg_0", ".", "paths", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_3", ")", "arg_6", "=", "False", "if", "os", ".", "path", ".", "isdir", "(", "arg_5", ")", ":", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'__init__.py'", ")", "arg_6", "=", "True", "else", ":", "arg_7", "=", "'{}.py'", ".", "format", "(", "arg_5", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_7", ")", ":", "return", "ModuleLoader", "(", "arg_5", ",", "arg_1", ",", "arg_7", ",", "arg_6", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Searches the paths for the required module.\n\n        :param module_name: the full name of the module to find\n        :param path: set to None when the module in being searched for is a\n                     top-level module - otherwise this is set to\n                     package.__path__ for submodules and subpackages (unused)\n        \"\"\"\n        arg_3 = os.path.join(*arg_1.split(MODULE_PATH_SEP))\n\n        for arg_4 in arg_0.paths:\n            arg_5 = os.path.join(arg_4, arg_3)\n            arg_6 = False\n\n            # If the target references a directory, try to load it as\n            # a module by referencing the __init__.py file, otherwise\n            # append .py and attempt to resolve it.\n            if os.path.isdir(arg_5):\n                arg_7 = os.path.join(arg_5, '__init__.py')\n                arg_6 = True\n            else:\n                arg_7 = '{}.py'.format(arg_5)\n\n            if os.path.exists(arg_7):\n                return ModuleLoader(\n                    arg_5, arg_1, arg_7, arg_6)\n        return None", "path": "pynsive/plugin/loader.py", "identifier": "ModuleFinder.find_module", "docstring": "Searches the paths for the required module.\n\n        :param module_name: the full name of the module to find\n        :param path: set to None when the module in being searched for is a\n                     top-level module - otherwise this is set to\n                     package.__path__ for submodules and subpackages (unused)", "docstring_tokens": ["Searches", "the", "paths", "for", "the", "required", "module", "."], "nwo": "zinic/pynsive", "score": 0.23137166388621372, "idx": 257333}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/storagefactory.py#L18-L25", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Creates a service from a constructor and checks which kwargs are not used", "language": "python", "parameters": "(storage_service, trajectory=None, **kwargs)", "return_statement": "return storage_service, unused_kwargs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "copy", "(", ")", "arg_3", "[", "'trajectory'", "]", "=", "arg_1", "arg_4", "=", "get_matching_kwargs", "(", "arg_0", ",", "arg_3", ")", "arg_0", "=", "arg_0", "(", "**", "arg_4", ")", "arg_5", "=", "set", "(", "arg_2", ".", "keys", "(", ")", ")", "-", "set", "(", "arg_4", ".", "keys", "(", ")", ")", "return", "arg_0", ",", "arg_5"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"Creates a service from a constructor and checks which kwargs are not used\"\"\"\n    arg_3 = arg_2.copy()\n    arg_3['trajectory'] = arg_1\n    arg_4 = get_matching_kwargs(arg_0, arg_3)\n    arg_0 = arg_0(**arg_4)\n    arg_5 = set(arg_2.keys()) - set(arg_4.keys())\n    return arg_0, arg_5", "path": "pypet/utils/storagefactory.py", "identifier": "_create_storage", "docstring": "Creates a service from a constructor and checks which kwargs are not used", "docstring_tokens": ["Creates", "a", "service", "from", "a", "constructor", "and", "checks", "which", "kwargs", "are", "not", "used"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257334}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_23_brian2_network.py#L14-L40", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds all necessary parameters to `traj`.", "language": "python", "parameters": "(traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "v_standard_parameter", "=", "Brian2Parameter", "arg_0", ".", "v_fast_access", "=", "True", "arg_0", ".", "f_add_parameter", "(", "'Net.C'", ",", "281", "*", "pF", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.gL'", ",", "30", "*", "nS", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.EL'", ",", "-", "70.6", "*", "mV", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.VT'", ",", "-", "50.4", "*", "mV", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.DeltaT'", ",", "2", "*", "mV", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.tauw'", ",", "40", "*", "ms", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.a'", ",", "4", "*", "nS", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.b'", ",", "0.08", "*", "nA", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.I'", ",", ".8", "*", "nA", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.Vcut'", ",", "'vm > 0*mV'", ")", "arg_0", ".", "f_add_parameter", "(", "'Net.N'", ",", "50", ")", "arg_3", "=", "'''    dvm/dt=(gL*(EL-vm)+gL*DeltaT*exp((vm-VT)/DeltaT)+I-w)/C : volt    dw/dt=(a*(vm-EL)-w)/tauw : amp    Vr:volt    '''", "arg_0", ".", "f_add_parameter", "(", "'Net.eqs'", ",", "arg_3", ")", "arg_0", ".", "f_add_parameter", "(", "'reset'", ",", "'vm=Vr;w+=b'", ")"], "function": "def Func(arg_0):\n    \"\"\"Adds all necessary parameters to `traj`.\"\"\"\n\n    # We set the BrianParameter to be the standard parameter\n    arg_0.v_standard_parameter=Brian2Parameter\n    arg_0.v_fast_access=True\n\n    # Add parameters we need for our network\n    arg_0.f_add_parameter('Net.C',281*pF)\n    arg_0.f_add_parameter('Net.gL',30*nS)\n    arg_0.f_add_parameter('Net.EL',-70.6*mV)\n    arg_0.f_add_parameter('Net.VT',-50.4*mV)\n    arg_0.f_add_parameter('Net.DeltaT',2*mV)\n    arg_0.f_add_parameter('Net.tauw',40*ms)\n    arg_0.f_add_parameter('Net.a',4*nS)\n    arg_0.f_add_parameter('Net.b',0.08*nA)\n    arg_0.f_add_parameter('Net.I',.8*nA)\n    arg_0.f_add_parameter('Net.Vcut','vm > 0*mV') # practical threshold condition\n    arg_0.f_add_parameter('Net.N',50)\n\n    arg_3='''\n    dvm/dt=(gL*(EL-vm)+gL*DeltaT*exp((vm-VT)/DeltaT)+I-w)/C : volt\n    dw/dt=(a*(vm-EL)-w)/tauw : amp\n    Vr:volt\n    '''\n    arg_0.f_add_parameter('Net.eqs', arg_3)\n    arg_0.f_add_parameter('reset', 'vm=Vr;w+=b')", "path": "examples/example_23_brian2_network.py", "identifier": "add_params", "docstring": "Adds all necessary parameters to `traj`.", "docstring_tokens": ["Adds", "all", "necessary", "parameters", "to", "traj", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257335}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/locate.py#L459-L494", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the Locate response payload and decode it\n        into its constituent parts.", "language": "python", "parameters": "(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "LocateResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "LOCATED_ITEMS", ",", "arg_6", ")", ":", "arg_0", ".", "_located_items", "=", "primitives", ".", "Integer", "(", "tag", "=", "arg_3", ".", "Tags", ".", "LOCATED_ITEMS", ")", "arg_0", ".", "_located_items", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_unique_identifiers", "=", "[", "]", "while", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_9", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ")", "arg_9", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_unique_identifiers", ".", "append", "(", "arg_9", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the Locate response payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data buffer containing encoded object\n                data, supporting a Func method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        super(LocateResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.LOCATED_ITEMS, arg_6):\n            arg_0._located_items = primitives.Integer(\n                tag=arg_3.Tags.LOCATED_ITEMS\n            )\n            arg_0._located_items.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        arg_0._unique_identifiers = []\n        while arg_0.is_tag_next(arg_3.Tags.UNIQUE_IDENTIFIER, arg_6):\n            arg_9 = primitives.TextString(\n                tag=arg_3.Tags.UNIQUE_IDENTIFIER\n            )\n            arg_9.Func(arg_6, arg_2=arg_2)\n            arg_0._unique_identifiers.append(arg_9)\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/locate.py", "identifier": "LocateResponsePayload.read", "docstring": "Read the data encoding the Locate response payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data buffer containing encoded object\n                data, supporting a read method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "Locate", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 257336}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/misc/pplan_helper.py#L176-L208", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Converts Config protobuf message to python dictionary", "language": "python", "parameters": "(topology_config)", "return_statement": "return config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "kvs", ":", "if", "arg_2", ".", "HasField", "(", "\"value\"", ")", ":", "assert", "arg_2", ".", "type", "==", "topology_pb2", ".", "ConfigValueType", ".", "Value", "(", "\"STRING_VALUE\"", ")", "if", "PhysicalPlanHelper", ".", "_is_number", "(", "arg_2", ".", "value", ")", ":", "arg_1", "[", "arg_2", ".", "key", "]", "=", "PhysicalPlanHelper", ".", "_get_number", "(", "arg_2", ".", "value", ")", "elif", "arg_2", ".", "value", ".", "lower", "(", ")", "in", "(", "\"true\"", ",", "\"false\"", ")", ":", "arg_1", "[", "arg_2", ".", "key", "]", "=", "True", "if", "arg_2", ".", "value", ".", "lower", "(", ")", "==", "\"true\"", "else", "False", "else", ":", "arg_1", "[", "arg_2", ".", "key", "]", "=", "arg_2", ".", "value", "elif", "arg_2", ".", "HasField", "(", "\"serialized_value\"", ")", "and", "arg_2", ".", "type", "==", "topology_pb2", ".", "ConfigValueType", ".", "Value", "(", "\"PYTHON_SERIALIZED_VALUE\"", ")", ":", "arg_1", "[", "arg_2", ".", "key", "]", "=", "default_serializer", ".", "deserialize", "(", "arg_2", ".", "serialized_value", ")", "else", ":", "assert", "arg_2", ".", "HasField", "(", "\"type\"", ")", "Log", ".", "error", "(", "\"Unsupported config <key:value> found: %s, with type: %s\"", "%", "(", "str", "(", "arg_2", ")", ",", "str", "(", "arg_2", ".", "type", ")", ")", ")", "continue", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Converts Config protobuf message to python dictionary\n\n    Values are converted according to the rules below:\n\n    - Number string (e.g. \"12\" or \"1.2\") is appropriately converted to ``int`` or ``float``\n    - Boolean string (\"true\", \"True\", \"false\" or \"False\") is converted to built-in boolean type\n      (i.e. ``True`` or ``False``)\n    - Normal string is inserted to dict as is\n    - Serialized value is deserialized and inserted as a corresponding Python object\n    \"\"\"\n    arg_1 = {}\n    for arg_2 in arg_0.kvs:\n      if arg_2.HasField(\"value\"):\n        assert arg_2.type == topology_pb2.ConfigValueType.Value(\"STRING_VALUE\")\n        # value is string\n        if PhysicalPlanHelper._is_number(arg_2.value):\n          arg_1[arg_2.key] = PhysicalPlanHelper._get_number(arg_2.value)\n        elif arg_2.value.lower() in (\"true\", \"false\"):\n          arg_1[arg_2.key] = True if arg_2.value.lower() == \"true\" else False\n        else:\n          arg_1[arg_2.key] = arg_2.value\n      elif arg_2.HasField(\"serialized_value\") and \\\n        arg_2.type == topology_pb2.ConfigValueType.Value(\"PYTHON_SERIALIZED_VALUE\"):\n        # deserialize that\n        arg_1[arg_2.key] = default_serializer.deserialize(arg_2.serialized_value)\n      else:\n        assert arg_2.HasField(\"type\")\n        Log.error(\"Unsupported config <key:value> found: %s, with type: %s\"\n                  % (str(arg_2), str(arg_2.type)))\n        continue\n\n    return arg_1", "path": "heron/instance/src/python/utils/misc/pplan_helper.py", "identifier": "PhysicalPlanHelper._get_dict_from_config", "docstring": "Converts Config protobuf message to python dictionary\n\n    Values are converted according to the rules below:\n\n    - Number string (e.g. \"12\" or \"1.2\") is appropriately converted to ``int`` or ``float``\n    - Boolean string (\"true\", \"True\", \"false\" or \"False\") is converted to built-in boolean type\n      (i.e. ``True`` or ``False``)\n    - Normal string is inserted to dict as is\n    - Serialized value is deserialized and inserted as a corresponding Python object", "docstring_tokens": ["Converts", "Config", "protobuf", "message", "to", "python", "dictionary"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257337}
{"url": "https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L684-L711", "sha": "8170e431362dc760589f7d141090fd133dece259", "docstring_summary": "DEPRECATED\n  Reads a mesh saved in the HDF5 format.", "language": "python", "parameters": "(hdfstore, group = \"\")", "return_statement": "return m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ")", ":", "arg_2", "=", "Mesh", "(", ")", "arg_2", ".", "elements", ".", "data", "=", "hdf", "[", "\"elements/connectivity\"", "]", "arg_2", ".", "nodes", ".", "data", "=", "hdf", "[", "\"nodes/xyz\"", "]", "for", "arg_6", "in", "hdf", ".", "keys", "(", ")", ":", "if", "arg_6", ".", "startswith", "(", "\"/nodes/sets\"", ")", ":", "arg_7", "=", "arg_6", ".", "replace", "(", "\"/nodes/sets/\"", ",", "\"\"", ")", "arg_2", ".", "nodes", ".", "sets", "[", "arg_7", "]", "=", "set", "(", "hdf", "[", "arg_6", "]", ")", "if", "arg_6", ".", "startswith", "(", "\"/elements/sets\"", ")", ":", "arg_7", "=", "arg_6", ".", "replace", "(", "\"/elements/sets/\"", ",", "\"\"", ")", "arg_2", ".", "elements", ".", "sets", "[", "arg_7", "]", "=", "set", "(", "hdf", "[", "arg_6", "]", ")", "if", "arg_6", ".", "startswith", "(", "\"/elements/surfaces\"", ")", ":", "arg_7", "=", "arg_6", ".", "replace", "(", "\"/elements/surfaces/\"", ",", "\"\"", ")", "arg_2", ".", "elements", ".", "surfaces", "[", "arg_7", "]", "=", "hdf", "[", "arg_6", "]", "if", "arg_6", ".", "startswith", "(", "\"/fields/\"", ")", ":", "if", "arg_6", ".", "endswith", "(", "\"/metadata\"", ")", ":", "arg_10", "=", "arg_6", ".", "split", "(", "\"/\"", ")", "[", "2", "]", "arg_11", "=", "Field", "(", ")", "arg_11", ".", "metadata", "=", "hdf", "[", "\"fields/{0}/metadata\"", ".", "format", "(", "arg_10", ")", "]", "arg_11", ".", "metadata", "=", "hdf", "[", "\"fields/{0}/data\"", ".", "format", "(", "arg_10", ")", "]", "arg_11", ".", "master", "=", "arg_2", "arg_2", ".", "add_field", "(", "arg_10", ",", "arg_11", ")", "hdf", ".", "close", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1 = \"\"):\n  \"\"\"\n  DEPRECATED\n  Reads a mesh saved in the HDF5 format.\n  \"\"\"\n  arg_2 = Mesh()\n  arg_2.elements.data = hdf[\"elements/connectivity\"]\n  arg_2.nodes.data    = hdf[\"nodes/xyz\"]\n  for arg_6 in hdf.keys():\n    if arg_6.startswith(\"/nodes/sets\"):\n      arg_7 = arg_6.replace(\"/nodes/sets/\", \"\")\n      arg_2.nodes.sets[arg_7] = set(hdf[arg_6])\n    if arg_6.startswith(\"/elements/sets\"):\n      arg_7 = arg_6.replace(\"/elements/sets/\", \"\")\n      arg_2.elements.sets[arg_7] = set(hdf[arg_6])\n    if arg_6.startswith(\"/elements/surfaces\"):\n      arg_7 = arg_6.replace(\"/elements/surfaces/\", \"\")\n      arg_2.elements.surfaces[arg_7] = hdf[arg_6]\n    if arg_6.startswith(\"/fields/\"):\n      if arg_6.endswith(\"/metadata\"):\n        arg_10 = arg_6.split(\"/\")[2]\n        arg_11 = Field()\n        arg_11.metadata = hdf[\"fields/{0}/metadata\".format(arg_10)]\n        arg_11.metadata = hdf[\"fields/{0}/data\".format(arg_10)]\n        arg_11.master = arg_2\n        arg_2.add_field(arg_10, arg_11)\n  hdf.close()  \n  return arg_2", "path": "argiope/mesh.py", "identifier": "read_h5", "docstring": "DEPRECATED\n  Reads a mesh saved in the HDF5 format.", "docstring_tokens": ["DEPRECATED", "Reads", "a", "mesh", "saved", "in", "the", "HDF5", "format", "."], "nwo": "lcharleux/argiope", "score": 0.17185066990864498, "idx": 257338}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/transform.py#L198-L220", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "An alternative rotate implementation that uses a geometric function.\n    This is more accurate than the built-in version.", "language": "python", "parameters": "(script, axis='z', angle=0.0)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'z'", ",", "arg_2", "=", "0.0", ")", ":", "arg_2", "=", "math", ".", "radians", "(", "arg_2", ")", "if", "arg_1", ".", "lower", "(", ")", "==", "'x'", ":", "vert_function", "(", "arg_0", ",", "x_func", "=", "'x'", ",", "y_func", "=", "'y*cos({angle})-z*sin({angle})'", ".", "format", "(", "arg_2", "=", "arg_2", ")", ",", "z_func", "=", "'y*sin({angle})+z*cos({angle})'", ".", "format", "(", "arg_2", "=", "arg_2", ")", ")", "elif", "arg_1", ".", "lower", "(", ")", "==", "'y'", ":", "vert_function", "(", "arg_0", ",", "x_func", "=", "'z*sin({angle})+x*cos({angle})'", ".", "format", "(", "arg_2", "=", "arg_2", ")", ",", "y_func", "=", "'y'", ",", "z_func", "=", "'z*cos({angle})-x*sin({angle})'", ".", "format", "(", "arg_2", "=", "arg_2", ")", ")", "elif", "arg_1", ".", "lower", "(", ")", "==", "'z'", ":", "vert_function", "(", "arg_0", ",", "x_func", "=", "'x*cos({angle})-y*sin({angle})'", ".", "format", "(", "arg_2", "=", "arg_2", ")", ",", "y_func", "=", "'x*sin({angle})+y*cos({angle})'", ".", "format", "(", "arg_2", "=", "arg_2", ")", ",", "z_func", "=", "'z'", ")", "else", ":", "print", "(", "'Axis name is not valid; exiting ...'", ")", "sys", ".", "exit", "(", "1", ")", "return", "None"], "function": "def Func(arg_0, arg_1='z', arg_2=0.0):\n    \"\"\"An alternative Func implementation that uses a geometric function.\n    This is more accurate than the built-in version.\"\"\"\n    arg_2 = math.radians(arg_2)\n    if arg_1.lower() == 'x':\n        vert_function(arg_0,\n                 x_func='x',\n                 y_func='y*cos({angle})-z*sin({angle})'.format(arg_2=arg_2),\n                 z_func='y*sin({angle})+z*cos({angle})'.format(arg_2=arg_2))\n    elif arg_1.lower() == 'y':\n        vert_function(arg_0,\n                 x_func='z*sin({angle})+x*cos({angle})'.format(arg_2=arg_2),\n                 y_func='y',\n                 z_func='z*cos({angle})-x*sin({angle})'.format(arg_2=arg_2))\n    elif arg_1.lower() == 'z':\n        vert_function(arg_0,\n                 x_func='x*cos({angle})-y*sin({angle})'.format(arg_2=arg_2),\n                 y_func='x*sin({angle})+y*cos({angle})'.format(arg_2=arg_2),\n                 z_func='z')\n    else:\n        print('Axis name is not valid; exiting ...')\n        sys.exit(1)\n    return None", "path": "meshlabxml/transform.py", "identifier": "rotate", "docstring": "An alternative rotate implementation that uses a geometric function.\n    This is more accurate than the built-in version.", "docstring_tokens": ["An", "alternative", "rotate", "implementation", "that", "uses", "a", "geometric", "function", ".", "This", "is", "more", "accurate", "than", "the", "built", "-", "in", "version", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 257339}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/magic.py#L118-L138", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Utility function to store a function as a magic of a specific kind.", "language": "python", "parameters": "(dct, magic_kind, magic_name, func)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_1", "==", "'line_cell'", ":", "arg_0", "[", "'line'", "]", "[", "arg_2", "]", "=", "arg_0", "[", "'cell'", "]", "[", "arg_2", "]", "=", "arg_3", "else", ":", "arg_0", "[", "arg_1", "]", "[", "arg_2", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Utility function to store a function as a magic of a specific kind.\n\n    Parameters\n    ----------\n    dct : dict\n      A dictionary with 'line' and 'cell' subdicts.\n\n    magic_kind : str\n      Kind of magic to be stored.\n\n    magic_name : str\n      Key to store the magic as.\n\n    func : function\n      Callable object to store.\n    \"\"\"\n    if arg_1 == 'line_cell':\n        arg_0['line'][arg_2] = arg_0['cell'][arg_2] = arg_3\n    else:\n        arg_0[arg_1][arg_2] = arg_3", "path": "environment/lib/python2.7/site-packages/IPython/core/magic.py", "identifier": "record_magic", "docstring": "Utility function to store a function as a magic of a specific kind.\n\n    Parameters\n    ----------\n    dct : dict\n      A dictionary with 'line' and 'cell' subdicts.\n\n    magic_kind : str\n      Kind of magic to be stored.\n\n    magic_name : str\n      Key to store the magic as.\n\n    func : function\n      Callable object to store.", "docstring_tokens": ["Utility", "function", "to", "store", "a", "function", "as", "a", "magic", "of", "a", "specific", "kind", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257340}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_import.py#L254-L271", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Returns valid tags an extension module might have", "language": "python", "parameters": "()", "return_statement": "return tags", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "sysconfig", "arg_0", "=", "[", "]", "if", "six", ".", "PY2", ":", "arg_1", "=", "sysconfig", ".", "get_config_var", "(", "'MULTIARCH'", ")", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "append", "(", "arg_1", ")", "else", ":", "arg_0", ".", "append", "(", "sysconfig", ".", "get_config_var", "(", "'SOABI'", ")", ")", "arg_0", ".", "append", "(", "'abi3'", ")", "arg_0", "=", "[", "t", "for", "t", "in", "arg_0", "if", "t", "]", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n    Returns valid tags an extension module might have\n    \"\"\"\n    import sysconfig\n    arg_0 = []\n    if six.PY2:\n        # see also 'SHLIB_EXT'\n        arg_1 = sysconfig.get_config_var('MULTIARCH')\n        if arg_1 is not None:\n            arg_0.append(arg_1)\n    else:\n        # handle PEP 3149 -- ABI version tagged .so files\n        # ABI = application binary interface\n        arg_0.append(sysconfig.get_config_var('SOABI'))\n        arg_0.append('abi3')  # not sure why this one is valid but it is\n    arg_0 = [t for t in arg_0 if t]\n    return arg_0", "path": "ubelt/util_import.py", "identifier": "_extension_module_tags", "docstring": "Returns valid tags an extension module might have", "docstring_tokens": ["Returns", "valid", "tags", "an", "extension", "module", "might", "have"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 257341}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/qrt.py#L247-L255", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Load a measurement.", "language": "python", "parameters": "(self, filename)", "return_statement": "return await asyncio.wait_for(\n            self._protocol.send_command(cmd), timeout=self._timeout\n        )", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"Func %s\"", "%", "arg_1", "return", "await", "asyncio", ".", "wait_for", "(", "arg_0", ".", "_protocol", ".", "send_command", "(", "arg_2", ")", ",", "timeout", "=", "arg_0", ".", "_timeout", ")"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Load a measurement.\n\n        :param filename: Path to measurement you want to Func.\n        \"\"\"\n        arg_2 = \"Func %s\" % arg_1\n        return await asyncio.wait_for(\n            arg_0._protocol.send_command(arg_2), timeout=arg_0._timeout\n        )", "path": "qtm/qrt.py", "identifier": "QRTConnection.load", "docstring": "Load a measurement.\n\n        :param filename: Path to measurement you want to load.", "docstring_tokens": ["Load", "a", "measurement", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 257342}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/stats_server.py#L57-L66", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Handles HTTP GET requests.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "uri_map", ".", "get", "(", "arg_0", ".", "path", ")", "or", "arg_0", ".", "_handle_other", "arg_2", ",", "arg_3", "=", "arg_1", "(", ")", "arg_4", "=", "gzip", ".", "compress", "(", "arg_2", ")", "arg_0", ".", "_send_response", "(", "200", ",", "headers", "=", "(", "(", "'Content-type'", ",", "'%s; charset=utf-8'", "%", "arg_3", ")", ",", "(", "'Content-Encoding'", ",", "'gzip'", ")", ",", "(", "'Content-Length'", ",", "len", "(", "arg_4", ")", ")", ")", ")", "arg_0", ".", "wfile", ".", "write", "(", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"Handles HTTP GET requests.\"\"\"\n        arg_1 = arg_0.uri_map.get(arg_0.path) or arg_0._handle_other\n        arg_2, arg_3 = arg_1()\n        arg_4 = gzip.compress(arg_2)\n        arg_0._send_response(\n            200, headers=(('Content-type', '%s; charset=utf-8' % arg_3),\n                          ('Content-Encoding', 'gzip'),\n                          ('Content-Length', len(arg_4))))\n        arg_0.wfile.write(arg_4)", "path": "vprof/stats_server.py", "identifier": "StatsHandler.do_GET", "docstring": "Handles HTTP GET requests.", "docstring_tokens": ["Handles", "HTTP", "GET", "requests", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 257343}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1030-L1065", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "sends raws to be chunked", "language": "python", "parameters": "(data, raws, ipyclient)", "return_statement": "return chunkfiles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "paramsdict", "[", "\"project_dir\"", "]", ",", "\"tmp-chunks-\"", "+", "arg_0", ".", "name", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "shutil", ".", "rmtree", "(", "arg_3", ")", "os", ".", "makedirs", "(", "arg_3", ")", "arg_4", "=", "estimate_optim", "(", "arg_0", ",", "arg_1", "[", "0", "]", "[", "0", "]", ",", "arg_2", ")", "arg_5", "=", "int", "(", "8e6", ")", "arg_6", "=", "int", "(", "arg_4", "/", "(", "arg_5", "/", "4.", ")", ")", "*", "len", "(", "arg_1", ")", "arg_7", "=", "0", "if", "(", "len", "(", "arg_1", ")", ">", "len", "(", "arg_2", ")", ")", "or", "(", "arg_4", "<", "arg_5", ")", ":", "arg_7", "=", "1", "arg_8", "=", "time", ".", "time", "(", ")", "arg_9", "=", "{", "}", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_1", ")", ":", "arg_12", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "arg_11", "[", "0", "]", ")", ")", "[", "0", "]", "if", "arg_7", ":", "arg_9", "[", "arg_12", "]", "=", "[", "arg_11", "]", "else", ":", "arg_13", "=", "zcat_make_temps", "(", "arg_0", ",", "arg_11", ",", "arg_10", ",", "arg_3", ",", "arg_5", ",", "arg_6", ",", "arg_8", ")", "arg_9", "[", "arg_12", "]", "=", "arg_13", "if", "not", "arg_7", ":", "print", "(", "\"\"", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" sends raws to be chunked\"\"\"\n\n    ## create a tmpdir for chunked_files and a chunk optimizer \n    arg_3 = os.path.join(arg_0.paramsdict[\"project_dir\"], \"tmp-chunks-\"+arg_0.name)\n    if os.path.exists(arg_3):\n        shutil.rmtree(arg_3)\n    os.makedirs(arg_3)\n\n    ## chunk into 8M reads\n    arg_4 = estimate_optim(arg_0, arg_1[0][0], arg_2)\n    arg_5 = int(8e6)\n    arg_6 = int(arg_4/(arg_5/4.)) * len(arg_1)\n\n    ## if more files than cpus: no chunking\n    arg_7 = 0\n    if (len(arg_1) > len(arg_2)) or (arg_4 < arg_5):\n        arg_7 = 1\n\n    ## send slices N at a time. The dict chunkfiles stores a tuple of rawpairs\n    ## dictionary to store asyncresults for sorting jobs\n    arg_8 = time.time()\n    arg_9 = {}\n    for arg_10, arg_11 in enumerate(arg_1):\n        arg_12 = os.path.splitext(os.path.basename(arg_11[0]))[0]\n        ## if number of lines is > 20M then just submit it\n        if arg_7:\n            arg_9[arg_12] = [arg_11]\n        else:\n            ## chunk the file using zcat_make_temps\n            arg_13 = zcat_make_temps(arg_0, arg_11, arg_10, arg_3, arg_5, arg_6, arg_8)\n            arg_9[arg_12] = arg_13\n    if not arg_7:\n        print(\"\")\n\n    return arg_9", "path": "ipyrad/assemble/demultiplex.py", "identifier": "splitfiles", "docstring": "sends raws to be chunked", "docstring_tokens": ["sends", "raws", "to", "be", "chunked"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 257344}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/events/pubsub.py#L125-L128", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Triggers an event, and associates some data to it, so if there are any\n        subscribers, their callback will be called synchronously.", "language": "python", "parameters": "(self, event, *args, **kwargs)", "return_statement": "return self._broker.dispatch(event, *args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "_broker", ".", "dispatch", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\" Triggers an event, and associates some data to it, so if there are any\n        subscribers, their callback will be called synchronously. \"\"\"\n        return arg_0._broker.dispatch(arg_1, *arg_2, **arg_3)", "path": "qiskit/tools/events/pubsub.py", "identifier": "Publisher.publish", "docstring": "Triggers an event, and associates some data to it, so if there are any\n        subscribers, their callback will be called synchronously.", "docstring_tokens": ["Triggers", "an", "event", "and", "associates", "some", "data", "to", "it", "so", "if", "there", "are", "any", "subscribers", "their", "callback", "will", "be", "called", "synchronously", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257345}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/converters/dag_to_circuit.py#L16-L55", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Build a ``QuantumCircuit`` object from a ``DAGCircuit``.", "language": "python", "parameters": "(dag)", "return_statement": "return circuit", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "collections", ".", "OrderedDict", "(", ")", "for", "arg_2", "in", "arg_0", ".", "qregs", ".", "values", "(", ")", ":", "arg_3", "=", "QuantumRegister", "(", "arg_2", ".", "size", ",", "arg_4", "=", "arg_2", ".", "name", ")", "arg_1", "[", "arg_2", ".", "name", "]", "=", "arg_3", "arg_5", "=", "collections", ".", "OrderedDict", "(", ")", "for", "arg_6", "in", "arg_0", ".", "cregs", ".", "values", "(", ")", ":", "arg_7", "=", "ClassicalRegister", "(", "arg_6", ".", "size", ",", "arg_4", "=", "arg_6", ".", "name", ")", "arg_5", "[", "arg_6", ".", "name", "]", "=", "arg_7", "arg_4", "=", "arg_0", ".", "name", "or", "None", "arg_8", "=", "QuantumCircuit", "(", "*", "arg_1", ".", "values", "(", ")", ",", "*", "arg_5", ".", "values", "(", ")", ",", "arg_4", "=", "arg_4", ")", "for", "arg_9", "in", "arg_0", ".", "topological_op_nodes", "(", ")", ":", "arg_10", "=", "[", "]", "for", "arg_11", "in", "arg_9", ".", "qargs", ":", "arg_10", ".", "append", "(", "arg_1", "[", "arg_11", "[", "0", "]", ".", "name", "]", "[", "arg_11", "[", "1", "]", "]", ")", "arg_12", "=", "[", "]", "for", "arg_13", "in", "arg_9", ".", "cargs", ":", "arg_12", ".", "append", "(", "arg_5", "[", "arg_13", "[", "0", "]", ".", "name", "]", "[", "arg_13", "[", "1", "]", "]", ")", "if", "arg_9", ".", "condition", "is", "None", ":", "arg_14", "=", "None", "else", ":", "arg_14", "=", "(", "arg_9", ".", "condition", "[", "0", "]", ",", "arg_9", ".", "condition", "[", "1", "]", ")", "arg_15", "=", "arg_9", ".", "op", ".", "copy", "(", ")", "arg_15", ".", "control", "=", "arg_14", "arg_8", ".", "append", "(", "arg_15", ",", "arg_10", ",", "arg_12", ")", "return", "arg_8"], "function": "def Func(arg_0):\n    \"\"\"Build a ``QuantumCircuit`` object from a ``DAGCircuit``.\n\n    Args:\n        dag (DAGCircuit): the input dag.\n\n    Return:\n        QuantumCircuit: the circuit representing the input dag.\n    \"\"\"\n    arg_1 = collections.OrderedDict()\n    for arg_2 in arg_0.qregs.values():\n        arg_3 = QuantumRegister(arg_2.size, arg_4=arg_2.name)\n        arg_1[arg_2.name] = arg_3\n    arg_5 = collections.OrderedDict()\n    for arg_6 in arg_0.cregs.values():\n        arg_7 = ClassicalRegister(arg_6.size, arg_4=arg_6.name)\n        arg_5[arg_6.name] = arg_7\n\n    arg_4 = arg_0.name or None\n    arg_8 = QuantumCircuit(*arg_1.values(), *arg_5.values(), arg_4=arg_4)\n\n    for arg_9 in arg_0.topological_op_nodes():\n        arg_10 = []\n        for arg_11 in arg_9.qargs:\n            arg_10.append(arg_1[arg_11[0].name][arg_11[1]])\n\n        arg_12 = []\n        for arg_13 in arg_9.cargs:\n            arg_12.append(arg_5[arg_13[0].name][arg_13[1]])\n\n        # Get arguments for classical control (if any)\n        if arg_9.condition is None:\n            arg_14 = None\n        else:\n            arg_14 = (arg_9.condition[0], arg_9.condition[1])\n\n        arg_15 = arg_9.op.copy()\n        arg_15.control = arg_14\n        arg_8.append(arg_15, arg_10, arg_12)\n    return arg_8", "path": "qiskit/converters/dag_to_circuit.py", "identifier": "dag_to_circuit", "docstring": "Build a ``QuantumCircuit`` object from a ``DAGCircuit``.\n\n    Args:\n        dag (DAGCircuit): the input dag.\n\n    Return:\n        QuantumCircuit: the circuit representing the input dag.", "docstring_tokens": ["Build", "a", "QuantumCircuit", "object", "from", "a", "DAGCircuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257346}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L96-L124", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Return a list of all FT232H device serial numbers connected to the\n    machine.  You can use these serial numbers to open a specific FT232H device\n    by passing it to the FT232H initializer's serial parameter.", "language": "python", "parameters": "(vid=FT232H_VID, pid=FT232H_PID)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "try", ":", "arg_4", "=", "None", "arg_4", "=", "ftdi", ".", "new", "(", ")", "arg_5", "=", "None", "arg_6", ",", "arg_5", "=", "ftdi", ".", "usb_find_all", "(", "arg_4", ",", "arg_0", ",", "arg_2", ")", "if", "arg_6", "<", "0", ":", "raise", "RuntimeError", "(", "'ftdi_usb_find_all returned error {0}: {1}'", ".", "format", "(", "arg_6", ",", "ftdi", ".", "get_error_string", "(", "self", ".", "_ctx", ")", ")", ")", "arg_7", "=", "[", "]", "while", "arg_5", "is", "not", "None", ":", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "ftdi", ".", "usb_get_strings", "(", "arg_4", ",", "arg_5", ".", "dev", ",", "256", ",", "256", ",", "256", ")", "if", "arg_11", "is", "not", "None", ":", "arg_7", ".", "append", "(", "arg_11", ")", "arg_5", "=", "arg_5", ".", "next", "return", "arg_7", "finally", ":", "if", "arg_5", "is", "not", "None", ":", "ftdi", ".", "list_free", "(", "arg_5", ")", "if", "arg_4", "is", "not", "None", ":", "ftdi", ".", "free", "(", "arg_4", ")"], "function": "def Func(arg_0=arg_1, arg_2=arg_3):\n    \"\"\"Return a list of all FT232H device serial numbers connected to the\n    machine.  You can use these serial numbers to open a specific FT232H device\n    by passing it to the FT232H initializer's serial parameter.\n    \"\"\"\n    try:\n        # Create a libftdi context.\n        arg_4 = None\n        arg_4 = ftdi.new()\n        # Enumerate FTDI devices.\n        arg_5 = None\n        arg_6, arg_5 = ftdi.usb_find_all(arg_4, arg_0, arg_2)\n        if arg_6 < 0:\n            raise RuntimeError('ftdi_usb_find_all returned error {0}: {1}'.format(arg_6, ftdi.get_error_string(self._ctx)))\n        # Walk through list of devices and assemble list of serial numbers.\n        arg_7 = []\n        while arg_5 is not None:\n            # Get USB device strings and add serial to list of devices.\n            arg_8, arg_9, arg_10, arg_11 = ftdi.usb_get_strings(arg_4, arg_5.dev, 256, 256, 256)\n            if arg_11 is not None:\n                arg_7.append(arg_11)\n            arg_5 = arg_5.next\n        return arg_7\n    finally:\n        # Make sure to clean up list and context when done.\n        if arg_5 is not None:\n            ftdi.list_free(arg_5)\n        if arg_4 is not None:\n            ftdi.free(arg_4)", "path": "Adafruit_GPIO/FT232H.py", "identifier": "enumerate_device_serials", "docstring": "Return a list of all FT232H device serial numbers connected to the\n    machine.  You can use these serial numbers to open a specific FT232H device\n    by passing it to the FT232H initializer's serial parameter.", "docstring_tokens": ["Return", "a", "list", "of", "all", "FT232H", "device", "serial", "numbers", "connected", "to", "the", "machine", ".", "You", "can", "use", "these", "serial", "numbers", "to", "open", "a", "specific", "FT232H", "device", "by", "passing", "it", "to", "the", "FT232H", "initializer", "s", "serial", "parameter", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 257347}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/converters/ast_to_dag.py#L122-L151", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Process a custom unitary node.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "name", "if", "arg_1", ".", "arguments", "is", "not", "None", ":", "arg_3", "=", "arg_0", ".", "_process_node", "(", "arg_1", ".", "arguments", ")", "else", ":", "arg_3", "=", "[", "]", "arg_4", "=", "[", "arg_0", ".", "_process_bit_id", "(", "node_element", ")", "for", "node_element", "in", "arg_1", ".", "bitlist", ".", "children", "]", "if", "arg_2", "in", "arg_0", ".", "gates", ":", "arg_5", "=", "arg_0", ".", "gates", "[", "arg_2", "]", "[", "\"args\"", "]", "arg_6", "=", "arg_0", ".", "gates", "[", "arg_2", "]", "[", "\"bits\"", "]", "arg_7", "=", "max", "(", "map", "(", "len", ",", "arg_4", ")", ")", "for", "arg_8", "in", "range", "(", "arg_7", ")", ":", "arg_0", ".", "arg_stack", ".", "append", "(", "{", "arg_5", "[", "arg_9", "]", ":", "arg_3", "[", "arg_9", "]", "for", "arg_9", "in", "range", "(", "len", "(", "arg_5", ")", ")", "}", ")", "arg_10", "=", "[", "arg_8", "*", "x", "for", "x", "in", "[", "len", "(", "arg_4", "[", "arg_9", "]", ")", ">", "1", "for", "arg_9", "in", "range", "(", "len", "(", "arg_4", ")", ")", "]", "]", "arg_0", ".", "bit_stack", ".", "append", "(", "{", "arg_6", "[", "arg_9", "]", ":", "arg_4", "[", "arg_9", "]", "[", "arg_10", "[", "arg_9", "]", "]", "for", "arg_9", "in", "range", "(", "len", "(", "arg_6", ")", ")", "}", ")", "arg_0", ".", "_create_dag_op", "(", "arg_2", ",", "[", "arg_0", ".", "arg_stack", "[", "-", "1", "]", "[", "arg_11", "]", ".", "sym", "(", ")", "for", "arg_11", "in", "arg_5", "]", ",", "[", "arg_0", ".", "bit_stack", "[", "-", "1", "]", "[", "arg_11", "]", "for", "arg_11", "in", "arg_6", "]", ")", "arg_0", ".", "arg_stack", ".", "pop", "(", ")", "arg_0", ".", "bit_stack", ".", "pop", "(", ")", "else", ":", "raise", "QiskitError", "(", "\"internal error undefined gate:\"", ",", "\"line=%s\"", "%", "arg_1", ".", "line", ",", "\"file=%s\"", "%", "arg_1", ".", "file", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process a custom unitary node.\"\"\"\n        arg_2 = arg_1.name\n        if arg_1.arguments is not None:\n            arg_3 = arg_0._process_node(arg_1.arguments)\n        else:\n            arg_3 = []\n        arg_4 = [arg_0._process_bit_id(node_element)\n                for node_element in arg_1.bitlist.children]\n        if arg_2 in arg_0.gates:\n            arg_5 = arg_0.gates[arg_2][\"args\"]\n            arg_6 = arg_0.gates[arg_2][\"bits\"]\n            # Loop over register arguments, if any.\n            arg_7 = max(map(len, arg_4))\n            for arg_8 in range(arg_7):\n                arg_0.arg_stack.append({arg_5[arg_9]: arg_3[arg_9]\n                                       for arg_9 in range(len(arg_5))})\n                # Only index into register arguments.\n                arg_10 = [arg_8*x for x in\n                           [len(arg_4[arg_9]) > 1 for arg_9 in range(len(arg_4))]]\n                arg_0.bit_stack.append({arg_6[arg_9]: arg_4[arg_9][arg_10[arg_9]]\n                                       for arg_9 in range(len(arg_6))})\n                arg_0._create_dag_op(arg_2,\n                                    [arg_0.arg_stack[-1][arg_11].sym() for arg_11 in arg_5],\n                                    [arg_0.bit_stack[-1][arg_11] for arg_11 in arg_6])\n                arg_0.arg_stack.pop()\n                arg_0.bit_stack.pop()\n        else:\n            raise QiskitError(\"internal error undefined gate:\",\n                              \"line=%s\" % arg_1.line, \"file=%s\" % arg_1.file)", "path": "qiskit/converters/ast_to_dag.py", "identifier": "AstInterpreter._process_custom_unitary", "docstring": "Process a custom unitary node.", "docstring_tokens": ["Process", "a", "custom", "unitary", "node", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257348}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L2381-L2439", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a 0.0 - 1.0 brightness adjusted to a light source.", "language": "python", "parameters": "(x, y, dx, dy, radius=300, angle=0, spread=90)", "return_statement": "return 1 - max(0, min(d2, 1))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "300", ",", "arg_5", "=", "0", ",", "arg_6", "=", "90", ")", ":", "if", "arg_5", "!=", "None", ":", "arg_4", "*=", "2", "arg_7", "=", "sqrt", "(", "(", "arg_2", "-", "arg_0", ")", "**", "2", "+", "(", "arg_3", "-", "arg_1", ")", "**", "2", ")", "arg_8", "=", "degrees", "(", "atan2", "(", "arg_3", "-", "arg_1", ",", "arg_2", "-", "arg_0", ")", ")", "+", "180", "if", "arg_7", "<=", "arg_4", ":", "arg_9", "=", "1.0", "*", "arg_7", "/", "arg_4", "else", ":", "arg_9", "=", "1.0", "if", "arg_5", "is", "None", ":", "return", "1", "-", "arg_9", "arg_5", "=", "360", "-", "arg_5", "%", "360", "arg_6", "=", "max", "(", "0", ",", "min", "(", "arg_6", ",", "360", ")", ")", "if", "arg_6", "==", "0", ":", "return", "0.0", "arg_7", "=", "abs", "(", "arg_8", "-", "arg_5", ")", "if", "arg_7", "<=", "arg_6", "/", "2", ":", "arg_10", "=", "arg_7", "/", "arg_6", "+", "arg_9", "else", ":", "arg_10", "=", "1.0", "if", "360", "-", "arg_5", "<=", "arg_6", "/", "2", ":", "arg_7", "=", "abs", "(", "360", "-", "arg_5", "+", "arg_8", ")", "if", "arg_7", "<=", "arg_6", "/", "2", ":", "arg_10", "=", "arg_7", "/", "arg_6", "+", "arg_9", "if", "arg_5", "<", "arg_6", "/", "2", ":", "arg_7", "=", "abs", "(", "360", "+", "arg_5", "-", "arg_8", ")", "if", "arg_7", "<=", "arg_6", "/", "2", ":", "arg_10", "=", "arg_7", "/", "arg_6", "+", "arg_9", "return", "1", "-", "max", "(", "0", ",", "min", "(", "arg_10", ",", "1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=300, arg_5=0, arg_6=90):\n    \"\"\"\n    Returns a 0.0 - 1.0 brightness adjusted to a light source.\n\n    The light source is positioned at dx, dy.\n    The returned float is calculated for x, y position\n    (e.g. an oval at x, y should have this brightness).\n\n    The radius influences the strength of the light,\n    angle and spread control the direction of the light.\n    \"\"\"\n    if arg_5 != None:\n        arg_4 *= 2\n\n    # Get the distance and angle between point and light source.\n    arg_7 = sqrt((arg_2 - arg_0) ** 2 + (arg_3 - arg_1) ** 2)\n    arg_8 = degrees(atan2(arg_3 - arg_1, arg_2 - arg_0)) + 180\n\n    # If no angle is defined,\n    # light is emitted evenly in all directions\n    # and carries as far as the defined radius\n    # (e.g. like a radial gradient).\n    if arg_7 <= arg_4:\n        arg_9 = 1.0 * arg_7 / arg_4\n    else:\n        arg_9 = 1.0\n    if arg_5 is None:\n        return 1 - arg_9\n\n    # Normalize the light's direction and spread\n    # between 0 and 360.\n    arg_5 = 360 - arg_5 % 360\n    arg_6 = max(0, min(arg_6, 360))\n    if arg_6 == 0:\n        return 0.0\n\n    # Objects that fall within the spreaded direction\n    # of the light are illuminated.\n    arg_7 = abs(arg_8 - arg_5)\n    if arg_7 <= arg_6 / 2:\n        arg_10 = arg_7 / arg_6 + arg_9\n    else:\n        arg_10 = 1.0\n\n    # Wrapping from 0 to 360:\n    # a light source with a direction of 10 degrees\n    # and a spread of 45 degrees illuminates\n    # objects between 0 and 35 degrees and 350 and 360 degrees.\n    if 360 - arg_5 <= arg_6 / 2:\n        arg_7 = abs(360 - arg_5 + arg_8)\n        if arg_7 <= arg_6 / 2:\n            arg_10 = arg_7 / arg_6 + arg_9\n    # Wrapping from 360 to 0.\n    if arg_5 < arg_6 / 2:\n        arg_7 = abs(360 + arg_5 - arg_8)\n        if arg_7 <= arg_6 / 2:\n            arg_10 = arg_7 / arg_6 + arg_9\n\n    return 1 - max(0, min(arg_10, 1))", "path": "lib/colors/__init__.py", "identifier": "shader", "docstring": "Returns a 0.0 - 1.0 brightness adjusted to a light source.\n\n    The light source is positioned at dx, dy.\n    The returned float is calculated for x, y position\n    (e.g. an oval at x, y should have this brightness).\n\n    The radius influences the strength of the light,\n    angle and spread control the direction of the light.", "docstring_tokens": ["Returns", "a", "0", ".", "0", "-", "1", ".", "0", "brightness", "adjusted", "to", "a", "light", "source", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257349}
{"url": "https://github.com/hiposfer/o2g/blob/1165ba75a5eb64b3091e9b71ebd589507ae1ebf3/o2g/osm/builders/agency_builder.py#L21-L40", "sha": "1165ba75a5eb64b3091e9b71ebd589507ae1ebf3", "docstring_summary": "Extract agency information.", "language": "python", "parameters": "(relation, nodes)", "return_statement": "return Agency(agency_id, agency_url, op, '')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "tags", ".", "get", "(", "'operator'", ")", "arg_3", "=", "arg_0", ".", "tags", ".", "get", "(", "'url'", ")", "or", "arg_0", ".", "tags", ".", "get", "(", "'contact_website'", ")", "if", "not", "arg_2", ":", "return", "arg_4", "=", "int", "(", "hashlib", ".", "sha256", "(", "arg_2", ".", "encode", "(", "'utf8'", ")", ")", ".", "hexdigest", "(", ")", ",", "16", ")", "%", "10", "**", "8", "return", "Agency", "(", "arg_4", ",", "arg_3", ",", "arg_2", ",", "''", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Extract agency information.\"\"\"\n    # TODO: find out the operator for routes without operator tag.\n    # See: http://wiki.openstreetmap.org/wiki/Key:operator\n    # Quote from the above link:\n    #\n    #    If the vast majority of a certain object in an area is operated by a certain\n    #    organization and only very few by others then it may be sufficient to only tag the\n    #    exceptions. For example, when nearly all roads in an area are managed by a local\n    #    authority then it would be sufficient to only tag those that are not with an operator\n    #    tag.\n    arg_2 = arg_0.tags.get('operator')\n    arg_3 = arg_0.tags.get('url') or arg_0.tags.get('contact_website')\n\n    if not arg_2:\n        return\n\n    arg_4 = int(hashlib.sha256(arg_2.encode('utf8')).hexdigest(), 16) % 10**8\n\n    return Agency(arg_4, arg_3, arg_2, '')", "path": "o2g/osm/builders/agency_builder.py", "identifier": "build_agency", "docstring": "Extract agency information.", "docstring_tokens": ["Extract", "agency", "information", "."], "nwo": "hiposfer/o2g", "score": 0.3752106333265808, "idx": 257350}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L522-L584", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Run one of the Bayesian models.", "language": "python", "parameters": "(model, returns_train, returns_test=None,\n              bmark=None, samples=500, ppc=False, progressbar=True)", "return_statement": "return trace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "500", ",", "arg_5", "=", "False", ",", "arg_6", "=", "True", ")", ":", "if", "arg_0", "==", "'alpha_beta'", ":", "arg_0", ",", "arg_7", "=", "model_returns_t_alpha_beta", "(", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_0", "==", "'t'", ":", "arg_0", ",", "arg_7", "=", "model_returns_t", "(", "arg_1", ",", "arg_4", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_0", "==", "'normal'", ":", "arg_0", ",", "arg_7", "=", "model_returns_normal", "(", "arg_1", ",", "arg_4", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_0", "==", "'best'", ":", "arg_0", ",", "arg_7", "=", "model_best", "(", "arg_1", ",", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ")", "else", ":", "raise", "NotImplementedError", "(", "'Model {} not found.'", "'Use alpha_beta, t, normal, or best.'", ".", "format", "(", "arg_0", ")", ")", "if", "arg_5", ":", "arg_8", "=", "pm", ".", "sample_ppc", "(", "arg_7", ",", "arg_4", "=", "arg_4", ",", "arg_0", "=", "arg_0", ",", "size", "=", "len", "(", "arg_2", ")", ",", "arg_6", "=", "arg_6", ")", "return", "arg_7", ",", "arg_8", "[", "'returns'", "]", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None,\n              arg_3=None, arg_4=500, arg_5=False, arg_6=True):\n    \"\"\"\n    Run one of the Bayesian models.\n\n    Parameters\n    ----------\n    model : {'alpha_beta', 't', 'normal', 'best'}\n        Which model to run\n    returns_train : pd.Series\n        Timeseries of simple returns\n    returns_test : pd.Series (optional)\n        Out-of-sample returns. Datetimes in returns_test will be added to\n        returns_train as missing values and predictions will be generated\n        for them.\n    bmark : pd.Series or pd.DataFrame (optional)\n        Only used for alpha_beta to estimate regression coefficients.\n        If bmark has more recent returns than returns_train, these dates\n        will be treated as missing values and predictions will be\n        generated for them taking market correlations into account.\n    samples : int (optional)\n        Number of posterior samples to draw.\n    ppc : boolean (optional)\n        Whether to run a posterior predictive check. Will generate\n        samples of length returns_test.  Returns a second argument\n        that contains the PPC of shape samples x len(returns_test).\n\n    Returns\n    -------\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n\n    ppc : numpy.array (if ppc==True)\n       PPC of shape samples x len(returns_test).\n    \"\"\"\n\n    if arg_0 == 'alpha_beta':\n        arg_0, arg_7 = model_returns_t_alpha_beta(arg_1,\n                                                  arg_3, arg_4,\n                                                  arg_6=arg_6)\n    elif arg_0 == 't':\n        arg_0, arg_7 = model_returns_t(arg_1, arg_4,\n                                       arg_6=arg_6)\n    elif arg_0 == 'normal':\n        arg_0, arg_7 = model_returns_normal(arg_1, arg_4,\n                                            arg_6=arg_6)\n    elif arg_0 == 'best':\n        arg_0, arg_7 = model_best(arg_1, arg_2,\n                                  arg_4=arg_4,\n                                  arg_6=arg_6)\n    else:\n        raise NotImplementedError(\n            'Model {} not found.'\n            'Use alpha_beta, t, normal, or best.'.format(arg_0))\n\n    if arg_5:\n        arg_8 = pm.sample_ppc(arg_7, arg_4=arg_4,\n                                    arg_0=arg_0, size=len(arg_2),\n                                    arg_6=arg_6)\n        return arg_7, arg_8['returns']\n\n    return arg_7", "path": "pyfolio/bayesian.py", "identifier": "run_model", "docstring": "Run one of the Bayesian models.\n\n    Parameters\n    ----------\n    model : {'alpha_beta', 't', 'normal', 'best'}\n        Which model to run\n    returns_train : pd.Series\n        Timeseries of simple returns\n    returns_test : pd.Series (optional)\n        Out-of-sample returns. Datetimes in returns_test will be added to\n        returns_train as missing values and predictions will be generated\n        for them.\n    bmark : pd.Series or pd.DataFrame (optional)\n        Only used for alpha_beta to estimate regression coefficients.\n        If bmark has more recent returns than returns_train, these dates\n        will be treated as missing values and predictions will be\n        generated for them taking market correlations into account.\n    samples : int (optional)\n        Number of posterior samples to draw.\n    ppc : boolean (optional)\n        Whether to run a posterior predictive check. Will generate\n        samples of length returns_test.  Returns a second argument\n        that contains the PPC of shape samples x len(returns_test).\n\n    Returns\n    -------\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n\n    ppc : numpy.array (if ppc==True)\n       PPC of shape samples x len(returns_test).", "docstring_tokens": ["Run", "one", "of", "the", "Bayesian", "models", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257351}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/cairo_sink.py#L96-L104", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Called when CairoCanvas has rendered a bot", "language": "python", "parameters": "(self, size, frame, cairo_ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "get_target", "(", ")", "if", "arg_0", ".", "format", "==", "'png'", ":", "arg_4", ".", "write_to_png", "(", "arg_0", ".", "_output_file", "(", "arg_2", ")", ")", "arg_4", ".", "finish", "(", ")", "arg_4", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Called when CairoCanvas has rendered a bot\n        \"\"\"\n        arg_4 = arg_3.get_target()\n        if arg_0.format == 'png':\n            arg_4.write_to_png(arg_0._output_file(arg_2))\n        arg_4.finish()\n        arg_4.flush()", "path": "shoebot/core/cairo_sink.py", "identifier": "CairoImageSink.rendering_finished", "docstring": "Called when CairoCanvas has rendered a bot", "docstring_tokens": ["Called", "when", "CairoCanvas", "has", "rendered", "a", "bot"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257352}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/linesearch/internal/hager_zhang_lib.py#L177-L238", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper function for secant square.", "language": "python", "parameters": "(value_and_gradients_function,\n                   initial_args,\n                   val_0,\n                   val_c,\n                   f_lim,\n                   sufficient_decrease_param,\n                   curvature_param)", "return_statement": "return prefer_static.cond(\n      tf.reduce_any(input_tensor=next_args.active),\n      _apply_inner_update,\n      lambda: next_args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "update", "(", "arg_0", ",", "arg_1", ".", "left", ",", "arg_1", ".", "right", ",", "arg_3", ",", "arg_4", ",", "arg_8", "=", "arg_1", ".", "active", ")", "arg_8", "=", "arg_1", ".", "active", "&", "~", "arg_7", ".", "failed", "arg_9", "=", "arg_1", ".", "failed", "|", "arg_7", ".", "failed", "arg_10", "=", "val_where", "(", "arg_8", ",", "arg_7", ".", "left", ",", "arg_1", ".", "left", ")", "arg_11", "=", "val_where", "(", "arg_8", ",", "arg_7", ".", "right", ",", "arg_1", ".", "right", ")", "arg_12", "=", "arg_8", "&", "tf", ".", "equal", "(", "arg_10", ".", "x", ",", "arg_3", ".", "x", ")", "arg_13", "=", "arg_8", "&", "tf", ".", "equal", "(", "arg_11", ".", "x", ",", "arg_3", ".", "x", ")", "arg_14", "=", "arg_12", "|", "arg_13", "arg_15", "=", "tf", ".", "where", "(", "arg_12", ",", "_secant", "(", "arg_1", ".", "left", ",", "arg_10", ")", ",", "arg_3", ".", "x", ")", "arg_15", "=", "tf", ".", "where", "(", "arg_13", ",", "_secant", "(", "arg_1", ".", "right", ",", "arg_11", ")", ",", "arg_15", ")", "arg_16", "=", "(", "arg_10", ".", "x", "<=", "arg_15", ")", "&", "(", "arg_15", "<=", "arg_11", ".", "x", ")", "arg_17", "=", "tf", ".", "reduce_any", "(", "input_tensor", "=", "arg_16", "&", "arg_14", ")", "arg_18", "=", "arg_1", ".", "num_evals", "+", "arg_7", ".", "num_evals", "arg_18", "=", "arg_18", "+", "tf", ".", "cast", "(", "arg_17", ",", "arg_18", ".", "dtype", ")", "arg_19", "=", "_Secant2Result", "(", "arg_8", "=", "arg_8", "&", "arg_16", ",", "converged", "=", "arg_1", ".", "converged", ",", "arg_9", "=", "arg_9", ",", "arg_18", "=", "arg_18", ",", "left", "=", "arg_10", ",", "right", "=", "arg_11", ")", "def", "_apply_inner_update", "(", ")", ":", "arg_20", "=", "prefer_static", ".", "cond", "(", "arg_17", ",", "(", "lambda", ":", "arg_0", "(", "arg_15", ")", ")", ",", "(", "lambda", ":", "arg_3", ")", ")", "return", "Func_update", "(", "arg_0", ",", "arg_19", ",", "arg_2", ",", "arg_20", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "return", "prefer_static", ".", "cond", "(", "tf", ".", "reduce_any", "(", "input_tensor", "=", "arg_19", ".", "active", ")", ",", "_apply_inner_update", ",", "lambda", ":", "arg_19", ")"], "function": "def Func(arg_0,\n                   arg_1,\n                   arg_2,\n                   arg_3,\n                   arg_4,\n                   arg_5,\n                   arg_6):\n  \"\"\"Helper function for secant square.\"\"\"\n  # Apply the `update` function on active branch members to squeeze their\n  # bracketing interval.\n  arg_7 = update(arg_0,\n                         arg_1.left,\n                         arg_1.right,\n                         arg_3,\n                         arg_4,\n                         arg_8=arg_1.active)\n\n  # Update active and failed flags, update left/right on non-failed entries.\n  arg_8 = arg_1.active & ~arg_7.failed\n  arg_9 = arg_1.failed | arg_7.failed\n  arg_10 = val_where(arg_8, arg_7.left, arg_1.left)\n  arg_11 = val_where(arg_8, arg_7.right, arg_1.right)\n\n  # Check if new `c` points should be generated.\n  arg_12 = arg_8 & tf.equal(arg_10.x, arg_3.x)\n  arg_13 = arg_8 & tf.equal(arg_11.x, arg_3.x)\n  arg_14 = arg_12 | arg_13\n\n  arg_15 = tf.where(arg_12,\n                    _secant(arg_1.left, arg_10),\n                    arg_3.x)\n  arg_15 = tf.where(arg_13,\n                    _secant(arg_1.right, arg_11),\n                    arg_15)\n  arg_16 = (arg_10.x <= arg_15) & (arg_15 <= arg_11.x)\n\n  # Figure out if an extra function evaluation is needed for new `c` points.\n  arg_17 = tf.reduce_any(input_tensor=arg_16 & arg_14)\n  arg_18 = arg_1.num_evals + arg_7.num_evals\n  arg_18 = arg_18 + tf.cast(arg_17, arg_18.dtype)\n\n  arg_19 = _Secant2Result(\n      arg_8=arg_8 & arg_16,  # No longer active if `c` is out of range.\n      converged=arg_1.converged,\n      arg_9=arg_9,\n      arg_18=arg_18,\n      left=arg_10,\n      right=arg_11)\n\n  def _apply_inner_update():\n    arg_20 = prefer_static.cond(\n        arg_17,\n        (lambda: arg_0(arg_15)),\n        (lambda: arg_3))\n    return Func_update(\n        arg_0, arg_19, arg_2, arg_20, arg_4,\n        arg_5, arg_6)\n\n  return prefer_static.cond(\n      tf.reduce_any(input_tensor=arg_19.active),\n      _apply_inner_update,\n      lambda: arg_19)", "path": "tensorflow_probability/python/optimizer/linesearch/internal/hager_zhang_lib.py", "identifier": "_secant2_inner", "docstring": "Helper function for secant square.", "docstring_tokens": ["Helper", "function", "for", "secant", "square", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257353}
{"url": "https://github.com/boakley/robotframework-lint/blob/3e3578f4e39af9af9961aa0a715f146b74474091/rflint/common.py#L26-L31", "sha": "3e3578f4e39af9af9961aa0a715f146b74474091", "docstring_summary": "Report an error or warning", "language": "python", "parameters": "(self, obj, message, linenum, char_offset=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "arg_0", ".", "controller", ".", "Func", "(", "linenumber", "=", "arg_3", ",", "filename", "=", "arg_1", ".", "path", ",", "severity", "=", "arg_0", ".", "severity", ",", "arg_2", "=", "arg_2", ",", "rulename", "=", "arg_0", ".", "__class__", ".", "__name__", ",", "char", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0):\n        \"\"\"Report an error or warning\"\"\"\n        arg_0.controller.Func(linenumber=arg_3, filename=arg_1.path,\n                               severity=arg_0.severity, arg_2=arg_2,\n                               rulename = arg_0.__class__.__name__,\n                               char=arg_4)", "path": "rflint/common.py", "identifier": "Rule.report", "docstring": "Report an error or warning", "docstring_tokens": ["Report", "an", "error", "or", "warning"], "nwo": "boakley/robotframework-lint", "score": 0.9109317500285141, "idx": 257354}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L72-L128", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Determines the most appropriate plotting unit for data.", "language": "python", "parameters": "(a, llim=0.1, denominator=None, focus_stage=None)", "return_statement": "return float(1000**n), udict[n]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "(", "int", ",", "float", ")", ")", ":", "arg_0", "=", "nominal_values", "(", "arg_0", ")", "arg_0", "=", "np", ".", "percentile", "(", "arg_0", "[", "~", "np", ".", "isnan", "(", "arg_0", ")", "]", ",", "25", ")", "if", "arg_2", "is", "not", "None", ":", "arg_4", "=", "pretty_element", "(", "arg_2", ")", "else", ":", "arg_4", "=", "''", "if", "arg_3", "==", "'calibrated'", ":", "arg_5", "=", "{", "0", ":", "'mol/mol '", "+", "arg_4", ",", "1", ":", "'mmol/mol '", "+", "arg_4", ",", "2", ":", "'$\\mu$mol/mol '", "+", "arg_4", ",", "3", ":", "'nmol/mol '", "+", "arg_4", ",", "4", ":", "'pmol/mol '", "+", "arg_4", ",", "5", ":", "'fmol/mol '", "+", "arg_4", "}", "elif", "arg_3", "==", "'ratios'", ":", "arg_5", "=", "{", "0", ":", "'counts/count '", "+", "arg_4", ",", "1", ":", "'$10^{-3}$ counts/count '", "+", "arg_4", ",", "2", ":", "'$10^{-6}$ counts/count '", "+", "arg_4", ",", "3", ":", "'$10^{-9}$ counts/count '", "+", "arg_4", ",", "4", ":", "'$10^{-12}$ counts/count '", "+", "arg_4", ",", "5", ":", "'$10^{-15}$ counts/count '", "+", "arg_4", "}", "elif", "arg_3", "in", "(", "'rawdata'", ",", "'despiked'", ",", "'bkgsub'", ")", ":", "arg_5", "=", "arg_5", "=", "{", "0", ":", "'counts'", ",", "1", ":", "'$10^{-3}$ counts'", ",", "2", ":", "'$10^{-6}$ counts'", ",", "3", ":", "'$10^{-9}$ counts'", ",", "4", ":", "'$10^{-12}$ counts'", ",", "5", ":", "'$10^{-15}$ counts'", "}", "else", ":", "arg_5", "=", "{", "0", ":", "''", ",", "1", ":", "''", ",", "2", ":", "''", ",", "3", ":", "''", ",", "4", ":", "''", ",", "5", ":", "''", "}", "arg_0", "=", "abs", "(", "arg_0", ")", "arg_6", "=", "0", "if", "arg_0", "<", "arg_1", ":", "while", "arg_0", "<", "arg_1", ":", "arg_0", "*=", "1000", "arg_6", "+=", "1", "return", "float", "(", "1000", "**", "arg_6", ")", ",", "arg_5", "[", "arg_6", "]"], "function": "def Func(arg_0, arg_1=0.1, arg_2=None, arg_3=None):\n    \"\"\"\n    Determines the most appropriate plotting unit for data.\n\n    Parameters\n    ----------\n    a : float or array-like\n        number to optimise. If array like, the 25% quantile is optimised.\n    llim : float\n        minimum allowable value in scaled data.\n\n    Returns\n    -------\n    (float, str)\n        (multiplier, unit)\n    \"\"\"\n\n    if not isinstance(arg_0, (int, float)):\n        arg_0 = nominal_values(arg_0)\n        arg_0 = np.percentile(arg_0[~np.isnan(arg_0)], 25)\n\n    if arg_2 is not None:\n        arg_4 = pretty_element(arg_2)\n    else:\n        arg_4 = ''\n\n    if arg_3 == 'calibrated':\n        arg_5 = {0: 'mol/mol ' + arg_4,\n                 1: 'mmol/mol ' + arg_4,\n                 2: '$\\mu$mol/mol ' + arg_4,\n                 3: 'nmol/mol ' + arg_4,\n                 4: 'pmol/mol ' + arg_4,\n                 5: 'fmol/mol ' + arg_4}\n    elif arg_3 == 'ratios':\n        arg_5 = {0: 'counts/count ' + arg_4,\n                 1: '$10^{-3}$ counts/count ' + arg_4,\n                 2: '$10^{-6}$ counts/count ' + arg_4,\n                 3: '$10^{-9}$ counts/count ' + arg_4,\n                 4: '$10^{-12}$ counts/count ' + arg_4,\n                 5: '$10^{-15}$ counts/count ' + arg_4}\n    elif arg_3 in ('rawdata', 'despiked', 'bkgsub'):\n        arg_5 = arg_5 = {0: 'counts',\n                         1: '$10^{-3}$ counts',\n                         2: '$10^{-6}$ counts',\n                         3: '$10^{-9}$ counts',\n                         4: '$10^{-12}$ counts',\n                         5: '$10^{-15}$ counts'}\n    else:\n        arg_5 = {0: '', 1: '', 2: '', 3: '', 4: '', 5: ''}\n\n    arg_0 = abs(arg_0)\n    arg_6 = 0\n    if arg_0 < arg_1:\n        while arg_0 < arg_1:\n            arg_0 *= 1000\n            arg_6 += 1\n    return float(1000**arg_6), arg_5[arg_6]", "path": "latools/helpers/helpers.py", "identifier": "unitpicker", "docstring": "Determines the most appropriate plotting unit for data.\n\n    Parameters\n    ----------\n    a : float or array-like\n        number to optimise. If array like, the 25% quantile is optimised.\n    llim : float\n        minimum allowable value in scaled data.\n\n    Returns\n    -------\n    (float, str)\n        (multiplier, unit)", "docstring_tokens": ["Determines", "the", "most", "appropriate", "plotting", "unit", "for", "data", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257355}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/conditions.py#L112-L120", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns True if this flag condition is met, otherwise returns\n        False. It determines if the condition is met by calling pre_filter\n        with a queryset containing only self.condition.", "language": "python", "parameters": "(self, user, filtered=False)", "return_statement": "return self.passes_filter(user)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_2", ":", "return", "True", "return", "arg_0", ".", "passes_filter", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        ''' Returns True if this flag condition is met, otherwise returns\n        False. It determines if the condition is met by calling pre_filter\n        with a queryset containing only self.condition. '''\n\n        if arg_2:\n            return True  # Why query again?\n\n        return arg_0.passes_filter(arg_1)", "path": "registrasion/controllers/conditions.py", "identifier": "IsMetByFilter.is_met", "docstring": "Returns True if this flag condition is met, otherwise returns\n        False. It determines if the condition is met by calling pre_filter\n        with a queryset containing only self.condition.", "docstring_tokens": ["Returns", "True", "if", "this", "flag", "condition", "is", "met", "otherwise", "returns", "False", ".", "It", "determines", "if", "the", "condition", "is", "met", "by", "calling", "pre_filter", "with", "a", "queryset", "containing", "only", "self", ".", "condition", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 257356}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L640-L665", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Slices and returns a subset of feature data.", "language": "python", "parameters": "(self, ids=None, features=None, dense=True)", "return_statement": "return result.to_dense() if dense else result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "arg_0", ".", "data", "if", "arg_1", "is", "not", "None", ":", "arg_4", "=", "arg_4", ".", "ix", "[", "arg_1", "]", "if", "arg_2", "is", "not", "None", ":", "arg_4", "=", "arg_4", ".", "ix", "[", ":", ",", "arg_2", "]", "return", "arg_4", ".", "to_dense", "(", ")", "if", "arg_3", "else", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True):\n        \"\"\" Slices and returns a subset of feature data.\n\n        Args:\n            ids (list, array): A list or 1D numpy array of study ids to\n                return rows for. If None, returns data for all studies\n                (i.e., all rows in array).\n            features (list, array): A list or 1D numpy array of named features\n                to return. If None, returns data for all features (i.e., all\n                columns in array).\n            dense (bool): Optional boolean. When True (default), convert the\n                result to a dense array before returning. When False, keep as\n                sparse matrix. Note that if ids is not None, the returned array\n                will always be dense.\n        Returns:\n          A pandas DataFrame with study IDs in rows and features incolumns.\n        \"\"\"\n        arg_4 = arg_0.data\n\n        if arg_1 is not None:\n            arg_4 = arg_4.ix[arg_1]\n\n        if arg_2 is not None:\n            arg_4 = arg_4.ix[:, arg_2]\n\n        return arg_4.to_dense() if arg_3 else arg_4", "path": "neurosynth/base/dataset.py", "identifier": "FeatureTable.get_feature_data", "docstring": "Slices and returns a subset of feature data.\n\n        Args:\n            ids (list, array): A list or 1D numpy array of study ids to\n                return rows for. If None, returns data for all studies\n                (i.e., all rows in array).\n            features (list, array): A list or 1D numpy array of named features\n                to return. If None, returns data for all features (i.e., all\n                columns in array).\n            dense (bool): Optional boolean. When True (default), convert the\n                result to a dense array before returning. When False, keep as\n                sparse matrix. Note that if ids is not None, the returned array\n                will always be dense.\n        Returns:\n          A pandas DataFrame with study IDs in rows and features incolumns.", "docstring_tokens": ["Slices", "and", "returns", "a", "subset", "of", "feature", "data", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 257357}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/documents.py#L24-L28", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Adds a tag to the list of tags and makes sure the result list contains only unique results.", "language": "python", "parameters": "(self, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "tags", "=", "list", "(", "set", "(", "arg_0", ".", "tags", "or", "[", "]", ")", "|", "set", "(", "[", "arg_1", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Adds a tag to the list of tags and makes sure the result list contains only unique results.\n        \"\"\"\n        arg_0.tags = list(set(arg_0.tags or []) | set([arg_1]))", "path": "jackal/documents.py", "identifier": "JackalDoc.add_tag", "docstring": "Adds a tag to the list of tags and makes sure the result list contains only unique results.", "docstring_tokens": ["Adds", "a", "tag", "to", "the", "list", "of", "tags", "and", "makes", "sure", "the", "result", "list", "contains", "only", "unique", "results", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 257358}
{"url": "https://github.com/mtomwing/purplex/blob/4072109e1d4395826983cd9d95ead2c1dfc1184e/purplex/grammar.py#L165-L177", "sha": "4072109e1d4395826983cd9d95ead2c1dfc1184e", "docstring_summary": "Computes the next closure for rules based on the symbol we got.", "language": "python", "parameters": "(self, rules, symbol)", "return_statement": "return self.closure(\n            {rule.move_dot() for rule in rules\n             if not rule.at_end and rule.rhs[rule.pos] == symbol},\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "closure", "(", "{", "arg_3", ".", "move_dot", "(", ")", "for", "arg_3", "in", "arg_1", "if", "not", "arg_3", ".", "at_end", "and", "arg_3", ".", "rhs", "[", "arg_3", ".", "pos", "]", "==", "arg_2", "}", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Computes the next closure for rules based on the symbol we got.\n\n        Args:\n            rules - an iterable of DottedRules\n            symbol - a string denoting the symbol we've just seen\n\n        Returns: frozenset of DottedRules\n        \"\"\"\n        return arg_0.closure(\n            {arg_3.move_dot() for arg_3 in arg_1\n             if not arg_3.at_end and arg_3.rhs[arg_3.pos] == arg_2},\n        )", "path": "purplex/grammar.py", "identifier": "Grammar.goto", "docstring": "Computes the next closure for rules based on the symbol we got.\n\n        Args:\n            rules - an iterable of DottedRules\n            symbol - a string denoting the symbol we've just seen\n\n        Returns: frozenset of DottedRules", "docstring_tokens": ["Computes", "the", "next", "closure", "for", "rules", "based", "on", "the", "symbol", "we", "got", "."], "nwo": "mtomwing/purplex", "score": 0.1903525543429651, "idx": 257359}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/grid/grid_search.py#L686-L707", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Get the hyperparameters of a model explored by grid search.", "language": "python", "parameters": "(self, id, display=True)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_1", "if", "is_type", "(", "arg_1", ",", "int", ")", "else", "arg_0", ".", "model_ids", ".", "index", "(", "arg_1", ")", "arg_4", "=", "arg_0", "[", "arg_3", "]", "if", "arg_4", ".", "_is_xvalidated", ":", "arg_4", "=", "h2o", ".", "get_model", "(", "arg_4", ".", "_xval_keys", "[", "0", "]", ")", "arg_5", "=", "[", "arg_4", ".", "params", "[", "h", "]", "[", "'actual'", "]", "[", "0", "]", "if", "isinstance", "(", "arg_4", ".", "params", "[", "h", "]", "[", "'actual'", "]", ",", "list", ")", "else", "arg_4", ".", "params", "[", "h", "]", "[", "'actual'", "]", "for", "h", "in", "arg_0", ".", "hyper_params", "]", "if", "arg_2", ":", "print", "(", "'Hyperparameters: ['", "+", "', '", ".", "join", "(", "list", "(", "arg_0", ".", "hyper_params", ".", "keys", "(", ")", ")", ")", "+", "']'", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Get the hyperparameters of a model explored by grid search.\n\n        :param str id: The model id of the model with hyperparameters of interest.\n        :param bool display: Flag to indicate whether to display the hyperparameter names.\n\n        :returns: A list of the hyperparameters for the specified model.\n        \"\"\"\n        arg_3 = arg_1 if is_type(arg_1, int) else arg_0.model_ids.index(arg_1)\n        arg_4 = arg_0[arg_3]\n\n        # if cross-validation is turned on, parameters in one of the fold model actuall contains the max_runtime_secs\n        # parameter and not the main model that is returned.\n        if arg_4._is_xvalidated:\n            arg_4 = h2o.get_model(arg_4._xval_keys[0])\n\n        arg_5 = [arg_4.params[h]['actual'][0] if isinstance(arg_4.params[h]['actual'], list)\n               else arg_4.params[h]['actual']\n               for h in arg_0.hyper_params]\n        if arg_2: print('Hyperparameters: [' + ', '.join(list(arg_0.hyper_params.keys())) + ']')\n        return arg_5", "path": "h2o-py/h2o/grid/grid_search.py", "identifier": "H2OGridSearch.get_hyperparams", "docstring": "Get the hyperparameters of a model explored by grid search.\n\n        :param str id: The model id of the model with hyperparameters of interest.\n        :param bool display: Flag to indicate whether to display the hyperparameter names.\n\n        :returns: A list of the hyperparameters for the specified model.", "docstring_tokens": ["Get", "the", "hyperparameters", "of", "a", "model", "explored", "by", "grid", "search", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257360}
{"url": "https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_attributes.py#L164-L166", "sha": "5729c2525a8c04c185e998bd9a86233708972921", "docstring_summary": "The list of compilers used to build asset.", "language": "python", "parameters": "(self)", "return_statement": "return [self.environment.compilers.get(e) for e in self.compiler_extensions]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "arg_0", ".", "environment", ".", "Func", ".", "get", "(", "arg_1", ")", "for", "arg_1", "in", "arg_0", ".", "compiler_extensions", "]"], "function": "def Func(arg_0):\n        \"\"\"The list of Func used to build asset.\"\"\"\n        return [arg_0.environment.Func.get(arg_1) for arg_1 in arg_0.compiler_extensions]", "path": "gears/asset_attributes.py", "identifier": "AssetAttributes.compilers", "docstring": "The list of compilers used to build asset.", "docstring_tokens": ["The", "list", "of", "compilers", "used", "to", "build", "asset", "."], "nwo": "gears/gears", "score": 0.18657722465184873, "idx": 257361}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L801-L821", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Download the model in MOJO format.", "language": "python", "parameters": "(self, path=\".\", get_genmodel_jar=False, genmodel_name=\"\")", "return_statement": "return h2o.api(\"GET /3/Models/%s/mojo\" % self.model_id, save_to=path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\".\"", ",", "arg_2", "=", "False", ",", "arg_3", "=", "\"\"", ")", ":", "assert_is_type", "(", "arg_1", ",", "str", ")", "assert_is_type", "(", "arg_2", ",", "bool", ")", "if", "not", "arg_0", ".", "have_mojo", ":", "raise", "H2OValueError", "(", "\"Export to MOJO not supported\"", ")", "if", "arg_2", ":", "if", "arg_3", "==", "\"\"", ":", "h2o", ".", "api", "(", "\"GET /3/h2o-genmodel.jar\"", ",", "save_to", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"h2o-genmodel.jar\"", ")", ")", "else", ":", "h2o", ".", "api", "(", "\"GET /3/h2o-genmodel.jar\"", ",", "save_to", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_3", ")", ")", "return", "h2o", ".", "api", "(", "\"GET /3/Models/%s/mojo\"", "%", "arg_0", ".", "model_id", ",", "save_to", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=\".\", arg_2=False, arg_3=\"\"):\n        \"\"\"\n        Download the model in MOJO format.\n\n        :param path: the path where MOJO file should be saved.\n        :param get_genmodel_jar: if True, then also download h2o-genmodel.jar and store it in folder ``path``.\n        :param genmodel_name Custom name of genmodel jar\n        :returns: name of the MOJO file written.\n        \"\"\"\n        assert_is_type(arg_1, str)\n        assert_is_type(arg_2, bool)\n\n        if not arg_0.have_mojo:\n            raise H2OValueError(\"Export to MOJO not supported\")\n\n        if arg_2:\n            if arg_3 == \"\":\n                h2o.api(\"GET /3/h2o-genmodel.jar\", save_to=os.path.join(arg_1, \"h2o-genmodel.jar\"))\n            else:\n                h2o.api(\"GET /3/h2o-genmodel.jar\", save_to=os.path.join(arg_1, arg_3))\n        return h2o.api(\"GET /3/Models/%s/mojo\" % arg_0.model_id, save_to=arg_1)", "path": "h2o-py/h2o/model/model_base.py", "identifier": "ModelBase.download_mojo", "docstring": "Download the model in MOJO format.\n\n        :param path: the path where MOJO file should be saved.\n        :param get_genmodel_jar: if True, then also download h2o-genmodel.jar and store it in folder ``path``.\n        :param genmodel_name Custom name of genmodel jar\n        :returns: name of the MOJO file written.", "docstring_tokens": ["Download", "the", "model", "in", "MOJO", "format", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257362}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/result.py#L121-L134", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Attempts to fill the result cache with at least the given number of results.", "language": "python", "parameters": "(self, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "while", "len", "(", "arg_0", ".", "_result_cache", ")", "<", "arg_1", ":", "arg_0", ".", "_result_cache", ".", "append", "(", "next", "(", "arg_0", ".", "_result_iter", ")", ")", "return", "True", "except", "StopIteration", ":", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Attempts to fill the result cache with at least the given number of results.\n\n        Returns:\n            bool: Whether the cache contains at least the given size.\n        \"\"\"\n\n        try:\n            while len(arg_0._result_cache) < arg_1:\n                arg_0._result_cache.append(next(arg_0._result_iter))\n            return True\n        except StopIteration:\n            return False", "path": "capybara/result.py", "identifier": "Result._cache_at_least", "docstring": "Attempts to fill the result cache with at least the given number of results.\n\n        Returns:\n            bool: Whether the cache contains at least the given size.", "docstring_tokens": ["Attempts", "to", "fill", "the", "result", "cache", "with", "at", "least", "the", "given", "number", "of", "results", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 257363}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/writer.py#L98-L111", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Generate the context dict for the given path.", "language": "python", "parameters": "(self, album)", "return_statement": "return {\n            'album': album,\n            'index_title': self.index_title,\n            'settings': self.settings,\n            'sigal_link': sigal_link,\n            'theme': {'name': os.path.basename(self.theme),\n                      'url': url_from_path(os.path.relpath(self.theme_path,\n                                                           album.dst_path))},\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", ".", "import", "__url__", "as", "sigal_link", "arg_0", ".", "logger", ".", "info", "(", "\"Output album : %r\"", ",", "arg_1", ")", "return", "{", "'album'", ":", "arg_1", ",", "'index_title'", ":", "arg_0", ".", "index_title", ",", "'settings'", ":", "arg_0", ".", "settings", ",", "'sigal_link'", ":", "sigal_link", ",", "'theme'", ":", "{", "'name'", ":", "os", ".", "path", ".", "basename", "(", "arg_0", ".", "theme", ")", ",", "'url'", ":", "url_from_path", "(", "os", ".", "path", ".", "relpath", "(", "arg_0", ".", "theme_path", ",", "arg_1", ".", "dst_path", ")", ")", "}", ",", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Generate the context dict for the given path.\"\"\"\n\n        from . import __url__ as sigal_link\n        arg_0.logger.info(\"Output album : %r\", arg_1)\n        return {\n            'album': arg_1,\n            'index_title': arg_0.index_title,\n            'settings': arg_0.settings,\n            'sigal_link': sigal_link,\n            'theme': {'name': os.path.basename(arg_0.theme),\n                      'url': url_from_path(os.path.relpath(arg_0.theme_path,\n                                                           arg_1.dst_path))},\n        }", "path": "sigal/writer.py", "identifier": "AbstractWriter.generate_context", "docstring": "Generate the context dict for the given path.", "docstring_tokens": ["Generate", "the", "context", "dict", "for", "the", "given", "path", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 257364}
{"url": "https://github.com/rsennrich/Bleualign/blob/1de181dcc3257d885a2b981f751c0220c0e8958f/bleualign/gale_church.py#L10-L27", "sha": "1de181dcc3257d885a2b981f751c0220c0e8958f", "docstring_summary": "Complementary error function.", "language": "python", "parameters": "(x)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "abs", "(", "arg_0", ")", "arg_2", "=", "1", "/", "(", "1", "+", "0.5", "*", "arg_1", ")", "arg_3", "=", "arg_2", "*", "math", ".", "exp", "(", "-", "arg_1", "*", "arg_1", "-", "1.26551223", "+", "arg_2", "*", "(", "1.00002368", "+", "arg_2", "*", "(", ".37409196", "+", "arg_2", "*", "(", ".09678418", "+", "arg_2", "*", "(", "-", ".18628806", "+", "arg_2", "*", "(", ".27886807", "+", "arg_2", "*", "(", "-", "1.13520398", "+", "arg_2", "*", "(", "1.48851587", "+", "arg_2", "*", "(", "-", ".82215223", "+", "arg_2", "*", ".17087277", ")", ")", ")", ")", ")", ")", ")", ")", ")", "if", "(", "arg_0", ">=", "0.", ")", ":", "return", "arg_3", "else", ":", "return", "2.", "-", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Complementary error function.\"\"\"\n    arg_1 = abs(arg_0)\n    arg_2 = 1 / (1 + 0.5 * arg_1)\n    arg_3 = arg_2 * math.exp(-arg_1 * arg_1 -\n                     1.26551223 + arg_2 *\n                     (1.00002368 + arg_2 *\n                      (.37409196 + arg_2 *\n                       (.09678418 + arg_2 *\n                        (-.18628806 + arg_2 *\n                         (.27886807 + arg_2 *\n                          (-1.13520398 + arg_2 *\n                           (1.48851587 + arg_2 *\n                            (-.82215223 + arg_2 * .17087277)))))))))\n    if (arg_0 >= 0.):\n        return arg_3\n    else:\n        return 2. - arg_3", "path": "bleualign/gale_church.py", "identifier": "erfcc", "docstring": "Complementary error function.", "docstring_tokens": ["Complementary", "error", "function", "."], "nwo": "rsennrich/Bleualign", "score": 0.9071314655070871, "idx": 257365}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/matrix_drawing.py#L118-L153", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Draw line from point x0,y0 to x,1,y1. Will draw beyond matrix bounds.", "language": "python", "parameters": "(setter, x0, y0, x1, y1, color=None, colorFunc=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "abs", "(", "arg_4", "-", "arg_2", ")", ">", "abs", "(", "arg_3", "-", "arg_1", ")", "if", "arg_7", ":", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_1", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_3", "if", "arg_1", ">", "arg_3", ":", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_1", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_2", "arg_8", "=", "arg_3", "-", "arg_1", "arg_9", "=", "abs", "(", "arg_4", "-", "arg_2", ")", "arg_10", "=", "arg_8", "/", "2", "if", "arg_2", "<", "arg_4", ":", "arg_11", "=", "1", "else", ":", "arg_11", "=", "-", "1", "arg_12", "=", "0", "for", "arg_13", "in", "range", "(", "arg_1", ",", "arg_3", "+", "1", ")", ":", "if", "arg_6", ":", "arg_5", "=", "arg_6", "(", "arg_12", ")", "arg_12", "+=", "1", "if", "arg_7", ":", "arg_0", "(", "arg_2", ",", "arg_13", ",", "arg_5", ")", "else", ":", "arg_0", "(", "arg_13", ",", "arg_2", ",", "arg_5", ")", "arg_10", "-=", "arg_9", "if", "arg_10", "<", "0", ":", "arg_2", "+=", "arg_11", "arg_10", "+=", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=None):\n    \"\"\"Draw line from point x0,y0 to x,1,y1. Will draw beyond matrix bounds.\"\"\"\n    arg_7 = abs(arg_4 - arg_2) > abs(arg_3 - arg_1)\n    if arg_7:\n        arg_1, arg_2 = arg_2, arg_1\n        arg_3, arg_4 = arg_4, arg_3\n\n    if arg_1 > arg_3:\n        arg_1, arg_3 = arg_3, arg_1\n        arg_2, arg_4 = arg_4, arg_2\n\n    arg_8 = arg_3 - arg_1\n    arg_9 = abs(arg_4 - arg_2)\n\n    arg_10 = arg_8 / 2\n\n    if arg_2 < arg_4:\n        arg_11 = 1\n    else:\n        arg_11 = -1\n\n    arg_12 = 0\n    for arg_13 in range(arg_1, arg_3 + 1):\n        if arg_6:\n            arg_5 = arg_6(arg_12)\n            arg_12 += 1\n\n        if arg_7:\n            arg_0(arg_2, arg_13, arg_5)\n        else:\n            arg_0(arg_13, arg_2, arg_5)\n\n        arg_10 -= arg_9\n        if arg_10 < 0:\n            arg_2 += arg_11\n            arg_10 += arg_8", "path": "bibliopixel/layout/matrix_drawing.py", "identifier": "bresenham_line", "docstring": "Draw line from point x0,y0 to x,1,y1. Will draw beyond matrix bounds.", "docstring_tokens": ["Draw", "line", "from", "point", "x0", "y0", "to", "x", "1", "y1", ".", "Will", "draw", "beyond", "matrix", "bounds", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 257366}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L287-L308", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "override to allow old '-pylab' flag with deprecation warning", "language": "python", "parameters": "(self, argv=None)", "return_statement": "return super(TerminalIPythonApp, self).parse_command_line(argv)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "sys", ".", "argv", "[", "1", ":", "]", "if", "arg_1", "is", "None", "else", "arg_1", "if", "'-pylab'", "in", "arg_1", ":", "arg_1", "=", "arg_1", "[", ":", "]", "arg_2", "=", "arg_1", ".", "index", "(", "'-pylab'", ")", "warn", ".", "warn", "(", "\"`-pylab` flag has been deprecated.\\n\"", "\"    Use `--pylab` instead, or `--pylab=foo` to specify a backend.\"", ")", "arg_3", "=", "'--pylab'", "if", "len", "(", "arg_1", ")", ">", "arg_2", "+", "1", ":", "arg_4", "=", "arg_1", "[", "arg_2", "+", "1", "]", "if", "arg_4", "in", "(", "'wx'", ",", "'qt'", ",", "'qt4'", ",", "'gtk'", ",", "'auto'", ")", ":", "arg_3", "=", "'--pylab='", "+", "arg_4", "arg_1", ".", "pop", "(", "arg_2", "+", "1", ")", "arg_1", "[", "arg_2", "]", "=", "arg_3", "return", "super", "(", "TerminalIPythonApp", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"override to allow old '-pylab' flag with deprecation warning\"\"\"\n\n        arg_1 = sys.argv[1:] if arg_1 is None else arg_1\n\n        if '-pylab' in arg_1:\n            # deprecated `-pylab` given,\n            # warn and transform into current syntax\n            arg_1 = arg_1[:] # copy, don't clobber\n            arg_2 = arg_1.index('-pylab')\n            warn.warn(\"`-pylab` flag has been deprecated.\\n\"\n            \"    Use `--pylab` instead, or `--pylab=foo` to specify a backend.\")\n            arg_3 = '--pylab'\n            if len(arg_1) > arg_2+1:\n                # check for gui arg, as in '-pylab qt'\n                arg_4 = arg_1[arg_2+1]\n                if arg_4 in ('wx', 'qt', 'qt4', 'gtk', 'auto'):\n                    arg_3 = '--pylab='+arg_4\n                    arg_1.pop(arg_2+1)\n            arg_1[arg_2] = arg_3\n\n        return super(TerminalIPythonApp, arg_0).Func(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", "identifier": "TerminalIPythonApp.parse_command_line", "docstring": "override to allow old '-pylab' flag with deprecation warning", "docstring_tokens": ["override", "to", "allow", "old", "-", "pylab", "flag", "with", "deprecation", "warning"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257367}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/views.py#L412-L484", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Form for selecting products from an individual product category.", "language": "python", "parameters": "(request, category_id)", "return_statement": "return render(request, \"registrasion/product_category.html\", data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"products\"", "arg_3", "=", "\"vouchers\"", "arg_4", "=", "_handle_voucher", "(", "arg_0", ",", "arg_3", ")", "arg_5", ",", "arg_6", "=", "arg_4", "arg_1", "=", "int", "(", "arg_1", ")", "arg_7", "=", "inventory", ".", "Category", ".", "objects", ".", "get", "(", "pk", "=", "arg_1", ")", "with", "BatchController", ".", "batch", "(", "arg_0", ".", "user", ")", ":", "arg_8", "=", "ProductController", ".", "available_products", "(", "arg_0", ".", "user", ",", "arg_7", "=", "arg_7", ",", ")", "if", "not", "arg_8", ":", "messages", ".", "warning", "(", "arg_0", ",", "(", "\"There are no products available from category: \"", "+", "arg_7", ".", "name", ")", ",", ")", "return", "redirect", "(", "\"dashboard\"", ")", "arg_9", "=", "_handle_products", "(", "arg_0", ",", "arg_7", ",", "arg_8", ",", "arg_2", ")", "arg_10", ",", "arg_11", ",", "arg_12", "=", "arg_9", "if", "arg_0", ".", "POST", "and", "not", "arg_6", "and", "not", "arg_10", ".", "errors", ":", "if", "arg_10", ".", "has_changed", "(", ")", ":", "messages", ".", "success", "(", "arg_0", ",", "\"Your reservations have been updated.\"", ",", ")", "return", "redirect", "(", "review", ")", "arg_13", "=", "{", "\"category\"", ":", "arg_7", ",", "\"discounts\"", ":", "arg_11", ",", "\"form\"", ":", "arg_10", ",", "\"voucher_form\"", ":", "arg_5", ",", "}", "return", "render", "(", "arg_0", ",", "\"registrasion/Func.html\"", ",", "arg_13", ")"], "function": "def Func(arg_0, arg_1):\n    ''' Form for selecting products from an individual product category.\n\n    Arguments:\n        category_id (castable to int): The id of the category to display.\n\n    Returns:\n        redirect or render:\n            If the form has been sucessfully submitted, redirect to\n            ``dashboard``. Otherwise, render\n            ``registrasion/Func.html`` with data::\n\n                {\n                    \"category\": category,         # An inventory.Category for\n                                                  # category_id\n                    \"discounts\": discounts,       # A list of\n                                                  # DiscountAndQuantity\n                    \"form\": products_form,        # A form for selecting\n                                                  # products\n                    \"voucher_form\": voucher_form, # A form for entering a\n                                                  # voucher code\n                }\n\n    '''\n\n    arg_2 = \"products\"\n    arg_3 = \"vouchers\"\n\n    # Handle the voucher form *before* listing products.\n    # Products can change as vouchers are entered.\n    arg_4 = _handle_voucher(arg_0, arg_3)\n    arg_5, arg_6 = arg_4\n\n    arg_1 = int(arg_1)  # Routing is [0-9]+\n    arg_7 = inventory.Category.objects.get(pk=arg_1)\n\n    with BatchController.batch(arg_0.user):\n        arg_8 = ProductController.available_products(\n            arg_0.user,\n            arg_7=arg_7,\n        )\n\n        if not arg_8:\n            messages.warning(\n                arg_0,\n                (\n                    \"There are no products available from category: \" +\n                    arg_7.name\n                ),\n            )\n            return redirect(\"dashboard\")\n\n        arg_9 = _handle_products(arg_0, arg_7, arg_8, arg_2)\n        arg_10, arg_11, arg_12 = arg_9\n\n    if arg_0.POST and not arg_6 and not arg_10.errors:\n        # Only return to the dashboard if we didn't add a voucher code\n        # and if there's no errors in the products form\n        if arg_10.has_changed():\n            messages.success(\n                arg_0,\n                \"Your reservations have been updated.\",\n            )\n        return redirect(review)\n\n    arg_13 = {\n        \"category\": arg_7,\n        \"discounts\": arg_11,\n        \"form\": arg_10,\n        \"voucher_form\": arg_5,\n    }\n\n    return render(arg_0, \"registrasion/Func.html\", arg_13)", "path": "registrasion/views.py", "identifier": "product_category", "docstring": "Form for selecting products from an individual product category.\n\n    Arguments:\n        category_id (castable to int): The id of the category to display.\n\n    Returns:\n        redirect or render:\n            If the form has been sucessfully submitted, redirect to\n            ``dashboard``. Otherwise, render\n            ``registrasion/product_category.html`` with data::\n\n                {\n                    \"category\": category,         # An inventory.Category for\n                                                  # category_id\n                    \"discounts\": discounts,       # A list of\n                                                  # DiscountAndQuantity\n                    \"form\": products_form,        # A form for selecting\n                                                  # products\n                    \"voucher_form\": voucher_form, # A form for entering a\n                                                  # voucher code\n                }", "docstring_tokens": ["Form", "for", "selecting", "products", "from", "an", "individual", "product", "category", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 257368}
{"url": "https://github.com/playpauseandstop/bootstrapper/blob/b216a05f2acb0b9f4919c4e010ff7b0f63fc1393/bootstrapper.py#L691-L700", "sha": "b216a05f2acb0b9f4919c4e010ff7b0f63fc1393", "docstring_summary": "Convert Python object to string.", "language": "python", "parameters": "(value, encoding='utf-8', errors='strict')", "return_statement": "return str(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf-8'", ",", "arg_2", "=", "'strict'", ")", ":", "if", "not", "IS_PY3", "and", "isinstance", "(", "arg_0", ",", "unicode", ")", ":", "return", "arg_0", ".", "encode", "(", "arg_1", ",", "arg_2", ")", "return", "str", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1='utf-8', arg_2='strict'):\n    \"\"\"Convert Python object to string.\n\n    :param value: Python object to convert.\n    :param encoding: Encoding to use if in Python 2 given object is unicode.\n    :param errors: Errors mode to use if in Python 2 given object is unicode.\n    \"\"\"\n    if not IS_PY3 and isinstance(arg_0, unicode):  # noqa\n        return arg_0.encode(arg_1, arg_2)\n    return str(arg_0)", "path": "bootstrapper.py", "identifier": "smart_str", "docstring": "Convert Python object to string.\n\n    :param value: Python object to convert.\n    :param encoding: Encoding to use if in Python 2 given object is unicode.\n    :param errors: Errors mode to use if in Python 2 given object is unicode.", "docstring_tokens": ["Convert", "Python", "object", "to", "string", "."], "nwo": "playpauseandstop/bootstrapper", "score": 0.17697123869542528, "idx": 257369}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/connection.py#L871-L874", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "The endpoint state machine failed due to protocol error.", "language": "python", "parameters": "(self, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "super", "(", "Connection", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "_connection_failed", "(", "\"Protocol error occurred.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"The endpoint state machine failed due to protocol error.\"\"\"\n        super(Connection, arg_0).Func(arg_1)\n        arg_0._connection_failed(\"Protocol error occurred.\")", "path": "pyngus/connection.py", "identifier": "Connection._ep_error", "docstring": "The endpoint state machine failed due to protocol error.", "docstring_tokens": ["The", "endpoint", "state", "machine", "failed", "due", "to", "protocol", "error", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 257370}
{"url": "https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/utils.py#L56-L77", "sha": "801581fd0ae238158134bde1c937fa199fa626b2", "docstring_summary": "iterate through the attributes of every logger's handler", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "namedtuple", "(", "\"Members\"", ",", "[", "\"name\"", ",", "\"handler\"", ",", "\"member_name\"", ",", "\"member\"", "]", ")", "arg_1", "=", "logging", ".", "Logger", ".", "manager", "arg_2", "=", "[", "]", "arg_3", "=", "set", "(", "[", "modname", "(", ")", "]", ")", "if", "arg_1", ".", "root", ":", "arg_2", "=", "list", "(", "arg_1", ".", "loggerDict", ".", "items", "(", ")", ")", "arg_2", ".", "append", "(", "(", "\"root\"", ",", "arg_1", ".", "root", ")", ")", "for", "arg_4", ",", "arg_5", "in", "arg_2", ":", "if", "arg_4", "in", "arg_3", ":", "continue", "for", "arg_6", "in", "getattr", "(", "arg_5", ",", "\"handlers\"", ",", "[", "]", ")", ":", "arg_7", "=", "inspect", ".", "getmembers", "(", "arg_6", ")", "for", "arg_8", ",", "arg_9", "in", "arg_7", ":", "yield", "arg_0", "(", "arg_4", ",", "arg_6", ",", "arg_8", ",", "arg_9", ")"], "function": "def Func():\n    \"\"\"iterate through the attributes of every logger's handler\n\n    this is used to switch out stderr and stdout in tests when buffer is True\n\n    :returns: generator of tuples, each tuple has (name, handler, member_name, member_val)\n    \"\"\"\n    arg_0 = namedtuple(\"Members\", [\"name\", \"handler\", \"member_name\", \"member\"])\n    arg_1 = logging.Logger.manager\n    arg_2 = []\n    arg_3 = set([modname()])\n    if arg_1.root:\n        arg_2 = list(arg_1.loggerDict.items())\n        arg_2.append((\"root\", arg_1.root))\n\n    for arg_4, arg_5 in arg_2:\n        if arg_4 in arg_3: continue\n\n        for arg_6 in getattr(arg_5, \"handlers\", []):\n            arg_7 = inspect.getmembers(arg_6)\n            for arg_8, arg_9 in arg_7:\n                yield arg_0(arg_4, arg_6, arg_8, arg_9)", "path": "pyt/utils.py", "identifier": "loghandler_members", "docstring": "iterate through the attributes of every logger's handler\n\n    this is used to switch out stderr and stdout in tests when buffer is True\n\n    :returns: generator of tuples, each tuple has (name, handler, member_name, member_val)", "docstring_tokens": ["iterate", "through", "the", "attributes", "of", "every", "logger", "s", "handler"], "nwo": "Jaymon/pyt", "score": 0.24979334806965703, "idx": 257371}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L215-L235", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a Git log file.", "language": "python", "parameters": "(filepath)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ",", "errors", "=", "'surrogateescape'", ",", "newline", "=", "os", ".", "linesep", ")", "as", "f", ":", "arg_1", "=", "GitParser", "(", "f", ")", "for", "arg_2", "in", "arg_1", ".", "parse", "(", ")", ":", "yield", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Parse a Git log file.\n\n        The method parses the Git log file and returns an iterator of\n        dictionaries. Each one of this, contains a commit.\n\n        :param filepath: path to the log file\n\n        :returns: a generator of parsed commits\n\n        :raises ParseError: raised when the format of the Git log file\n            is invalid\n        :raises OSError: raised when an error occurs reading the\n            given file\n        \"\"\"\n        with open(arg_0, 'r', errors='surrogateescape',\n                  newline=os.linesep) as f:\n            arg_1 = GitParser(f)\n\n            for arg_2 in arg_1.parse():\n                yield arg_2", "path": "perceval/backends/core/git.py", "identifier": "Git.parse_git_log_from_file", "docstring": "Parse a Git log file.\n\n        The method parses the Git log file and returns an iterator of\n        dictionaries. Each one of this, contains a commit.\n\n        :param filepath: path to the log file\n\n        :returns: a generator of parsed commits\n\n        :raises ParseError: raised when the format of the Git log file\n            is invalid\n        :raises OSError: raised when an error occurs reading the\n            given file", "docstring_tokens": ["Parse", "a", "Git", "log", "file", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257372}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/internal/missing_values_util.py#L137-L162", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Get the first unmasked entry of each time series in the batch.", "language": "python", "parameters": "(time_series_tensor, broadcast_mask)", "return_statement": "return tf.squeeze(tf.compat.v1.batch_gather(\n      params=time_series_tensor,\n      indices=first_unmasked_indices[..., tf.newaxis]), axis=-1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "[", "-", "1", "]", "arg_3", "=", "(", "tf", ".", "cast", "(", "~", "arg_1", ",", "tf", ".", "int32", ")", "*", "tf", ".", "range", "(", "arg_2", ",", "0", ",", "-", "1", ")", ")", "arg_4", "=", "arg_2", "-", "tf", ".", "reduce_max", "(", "input_tensor", "=", "arg_3", ",", "axis", "=", "-", "1", ")", "if", "arg_4", ".", "shape", ".", "ndims", "is", "None", ":", "raise", "NotImplementedError", "(", "'Cannot compute initial values of a masked time series with'", "'dynamic rank.'", ")", "return", "tf", ".", "squeeze", "(", "tf", ".", "compat", ".", "v1", ".", "batch_gather", "(", "params", "=", "arg_0", ",", "indices", "=", "arg_4", "[", "...", ",", "tf", ".", "newaxis", "]", ")", ",", "axis", "=", "-", "1", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Get the first unmasked entry of each time series in the batch.\n\n  Args:\n    time_series_tensor: float `Tensor` of shape [..., num_timesteps].\n    broadcast_mask: bool `Tensor` of same shape as `time_series`.\n  \"\"\"\n\n  arg_2 = tf.shape(input=arg_0)[-1]\n\n  # Compute the index of the first unmasked entry for each series in the batch.\n  arg_3 = (\n      tf.cast(~arg_1, tf.int32) *\n      tf.range(arg_2, 0, -1))\n  arg_4 = arg_2 - tf.reduce_max(\n      input_tensor=arg_3, axis=-1)\n\n  if arg_4.shape.ndims is None:\n    raise NotImplementedError(\n        'Cannot compute initial values of a masked time series with'\n        'dynamic rank.')  # `batch_gather` requires static rank\n\n  # Extract the initial value for each series in the batch.\n  return tf.squeeze(tf.compat.v1.batch_gather(\n      params=arg_0,\n      indices=arg_4[..., tf.newaxis]), axis=-1)", "path": "tensorflow_probability/python/sts/internal/missing_values_util.py", "identifier": "initial_value_of_masked_time_series", "docstring": "Get the first unmasked entry of each time series in the batch.\n\n  Args:\n    time_series_tensor: float `Tensor` of shape [..., num_timesteps].\n    broadcast_mask: bool `Tensor` of same shape as `time_series`.", "docstring_tokens": ["Get", "the", "first", "unmasked", "entry", "of", "each", "time", "series", "in", "the", "batch", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257373}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/joint_distribution_named.py#L172-L182", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates `dist_fn`, `dist_fn_wrapped`, `dist_fn_args`, `dist_fn_name`.", "language": "python", "parameters": "(self, model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "_is_dict_like", "(", "arg_1", ")", ":", "raise", "TypeError", "(", "'`model` must be convertible to `dict` (saw: {}).'", ".", "format", "(", "type", "(", "arg_1", ")", ".", "__name__", ")", ")", "[", "arg_0", ".", "_dist_fn", ",", "arg_0", ".", "_dist_fn_wrapped", ",", "arg_0", ".", "_dist_fn_args", ",", "arg_0", ".", "_dist_fn_name", ",", "]", "=", "_prob_chain_rule_flatten", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Creates `dist_fn`, `dist_fn_wrapped`, `dist_fn_args`, `dist_fn_name`.\"\"\"\n    if not _is_dict_like(arg_1):\n      raise TypeError('`model` must be convertible to `dict` (saw: {}).'.format(\n          type(arg_1).__name__))\n    [\n        arg_0._dist_fn,\n        arg_0._dist_fn_wrapped,\n        arg_0._dist_fn_args,\n        arg_0._dist_fn_name,  # JointDistributionSequential doesn't have this.\n    ] = _prob_chain_rule_flatten(arg_1)", "path": "tensorflow_probability/python/distributions/joint_distribution_named.py", "identifier": "JointDistributionNamed._build", "docstring": "Creates `dist_fn`, `dist_fn_wrapped`, `dist_fn_args`, `dist_fn_name`.", "docstring_tokens": ["Creates", "dist_fn", "dist_fn_wrapped", "dist_fn_args", "dist_fn_name", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257374}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/jid.py#L156-L186", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Return jid tuple from an Unicode string.", "language": "python", "parameters": "(cls, data, check = True)", "return_statement": "return (local, domain, resource)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_1", ".", "split", "(", "u\"/\"", ",", "1", ")", "arg_4", "=", "arg_3", "[", "0", "]", ".", "split", "(", "u\"@\"", ",", "1", ")", "if", "len", "(", "arg_4", ")", "==", "2", ":", "arg_5", "=", "arg_4", "[", "0", "]", "arg_6", "=", "arg_4", "[", "1", "]", "if", "arg_2", ":", "arg_5", "=", "arg_0", ".", "__prepare_local", "(", "arg_5", ")", "arg_6", "=", "arg_0", ".", "__prepare_domain", "(", "arg_6", ")", "else", ":", "arg_5", "=", "None", "arg_6", "=", "arg_4", "[", "0", "]", "if", "arg_2", ":", "arg_6", "=", "arg_0", ".", "__prepare_domain", "(", "arg_6", ")", "if", "len", "(", "arg_3", ")", "==", "2", ":", "arg_7", "=", "arg_3", "[", "1", "]", "if", "arg_2", ":", "arg_7", "=", "arg_0", ".", "__prepare_resource", "(", "arg_3", "[", "1", "]", ")", "else", ":", "arg_7", "=", "None", "if", "not", "arg_6", ":", "raise", "JIDError", "(", "\"Domain is required in JID.\"", ")", "return", "(", "arg_5", ",", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2 = True):\n        \"\"\"Return jid tuple from an Unicode string.\n\n        :Parameters:\n            - `data`: the JID string\n            - `check`: when `False` then the JID is not checked for\n              specification compliance.\n\n        :Return: (localpart, domainpart, resourcepart) tuple\"\"\"\n        arg_3 = arg_1.split(u\"/\", 1)\n        arg_4 = arg_3[0].split(u\"@\", 1)\n        if len(arg_4) == 2:\n            arg_5 = arg_4[0]\n            arg_6 = arg_4[1]\n            if arg_2:\n                arg_5 = arg_0.__prepare_local(arg_5)\n                arg_6 = arg_0.__prepare_domain(arg_6)\n        else:\n            arg_5 = None\n            arg_6 = arg_4[0]\n            if arg_2:\n                arg_6 = arg_0.__prepare_domain(arg_6)\n        if len(arg_3) == 2:\n            arg_7 = arg_3[1]\n            if arg_2:\n                arg_7 = arg_0.__prepare_resource(arg_3[1])\n        else:\n            arg_7 = None\n        if not arg_6:\n            raise JIDError(\"Domain is required in JID.\")\n        return (arg_5, arg_6, arg_7)", "path": "pyxmpp2/jid.py", "identifier": "JID.__from_unicode", "docstring": "Return jid tuple from an Unicode string.\n\n        :Parameters:\n            - `data`: the JID string\n            - `check`: when `False` then the JID is not checked for\n              specification compliance.\n\n        :Return: (localpart, domainpart, resourcepart) tuple", "docstring_tokens": ["Return", "jid", "tuple", "from", "an", "Unicode", "string", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257375}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L334-L339", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Empties cached sitetree data.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "cache", ".", "delete", "(", "'sitetrees'", ")", "cache", ".", "delete", "(", "'sitetrees_reset'", ")", "arg_1", ".", "get", "(", "'init'", ",", "True", ")", "and", "arg_0", ".", "init", "(", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Empties cached sitetree data.\"\"\"\n        cache.delete('sitetrees')\n        cache.delete('sitetrees_reset')\n\n        arg_1.get('init', True) and arg_0.init()", "path": "sitetree/sitetreeapp.py", "identifier": "Cache.empty", "docstring": "Empties cached sitetree data.", "docstring_tokens": ["Empties", "cached", "sitetree", "data", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 257376}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/reduce.py#L145-L163", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Returns mappable data for a random subset of voxels.", "language": "python", "parameters": "(dataset, n_voxels)", "return_statement": "return dataset.get_image_data(voxels=selected)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "arange", "(", "arg_0", ".", "masker", ".", "n_vox_in_vol", ")", "np", ".", "random", ".", "shuffle", "(", "arg_2", ")", "arg_3", "=", "arg_2", "[", "0", ":", "arg_1", "]", "return", "arg_0", ".", "get_image_data", "(", "arg_2", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Returns mappable data for a random subset of voxels.\n\n    May be useful as a baseline in predictive analyses--e.g., to compare\n    performance of a more principled feature selection method with simple\n    random selection.\n\n    Args:\n        dataset: A Dataset instance\n        n_voxels: An integer specifying the number of random voxels to select.\n\n    Returns:\n        A 2D numpy array with (randomly-selected) voxels in rows and mappables\n        in columns.\n    \"\"\"\n    arg_2 = np.arange(arg_0.masker.n_vox_in_vol)\n    np.random.shuffle(arg_2)\n    arg_3 = arg_2[0:arg_1]\n    return arg_0.get_image_data(arg_2=arg_3)", "path": "neurosynth/analysis/reduce.py", "identifier": "get_random_voxels", "docstring": "Returns mappable data for a random subset of voxels.\n\n    May be useful as a baseline in predictive analyses--e.g., to compare\n    performance of a more principled feature selection method with simple\n    random selection.\n\n    Args:\n        dataset: A Dataset instance\n        n_voxels: An integer specifying the number of random voxels to select.\n\n    Returns:\n        A 2D numpy array with (randomly-selected) voxels in rows and mappables\n        in columns.", "docstring_tokens": ["Returns", "mappable", "data", "for", "a", "random", "subset", "of", "voxels", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 257377}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/gcp/gcpcache.py#L77-L91", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Update the cache stats.\n        \n        If no cache-result is specified, we iniitialize the key.\n        Otherwise, we increment the correct cache-result.", "language": "python", "parameters": "(self, key, result)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "is", "None", ":", "arg_0", ".", "_CACHE_STATS", "[", "'access_stats'", "]", ".", "setdefault", "(", "arg_1", ",", "{", "'hit'", ":", "0", ",", "'miss'", ":", "0", ",", "'expired'", ":", "0", "}", ")", "else", ":", "arg_0", ".", "_CACHE_STATS", "[", "'access_stats'", "]", "[", "arg_1", "]", "[", "arg_2", "]", "+=", "1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Update the cache stats.\n        \n        If no cache-result is specified, we iniitialize the key.\n        Otherwise, we increment the correct cache-result.\n\n        Note the behavior for expired.  A client can be expired and the key\n        still exists.\n        \"\"\"\n        if arg_2 is None:\n            arg_0._CACHE_STATS['access_stats'].setdefault(arg_1,\n                                         {'hit': 0, 'miss': 0, 'expired': 0})\n        else:\n            arg_0._CACHE_STATS['access_stats'][arg_1][arg_2] +=1", "path": "cloudaux/gcp/gcpcache.py", "identifier": "GCPCache._update_cache_stats", "docstring": "Update the cache stats.\n        \n        If no cache-result is specified, we iniitialize the key.\n        Otherwise, we increment the correct cache-result.\n\n        Note the behavior for expired.  A client can be expired and the key\n        still exists.", "docstring_tokens": ["Update", "the", "cache", "stats", ".", "If", "no", "cache", "-", "result", "is", "specified", "we", "iniitialize", "the", "key", ".", "Otherwise", "we", "increment", "the", "correct", "cache", "-", "result", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 257378}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L1686-L1701", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Read block type switch descriptor for given kind of blockType.", "language": "python", "parameters": "(self, kind)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "verboseRead", "(", "TypeCountAlphabet", "(", "'BT#'", "+", "arg_1", "[", "0", "]", ".", "upper", "(", ")", ",", "description", "=", "'{} block types'", ".", "format", "(", "arg_1", ")", ",", ")", ")", "arg_0", ".", "numberOfBlockTypes", "[", "arg_1", "]", "=", "arg_2", "if", "arg_2", ">=", "2", ":", "arg_0", ".", "FuncCodes", "[", "arg_1", "]", "=", "arg_0", ".", "readPrefixCode", "(", "BlockTypeAlphabet", "(", "'BT'", "+", "arg_1", "[", "0", "]", ".", "upper", "(", ")", ",", "arg_2", ")", ")", "arg_0", ".", "blockCountCodes", "[", "arg_1", "]", "=", "arg_0", ".", "readPrefixCode", "(", "BlockCountAlphabet", "(", "'BC'", "+", "arg_1", "[", "0", "]", ".", "upper", "(", ")", ")", ")", "arg_6", "=", "arg_0", ".", "verboseRead", "(", "arg_0", ".", "blockCountCodes", "[", "arg_1", "]", ")", "else", ":", "arg_6", "=", "1", "<<", "24", "arg_0", ".", "currentBlockCounts", "[", "arg_1", "]", "=", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read block type switch descriptor for given kind of Func.\"\"\"\n        arg_2 = arg_0.verboseRead(TypeCountAlphabet(\n            'BT#'+arg_1[0].upper(),\n            description='{} block types'.format(arg_1),\n            ))\n        arg_0.numberOfBlockTypes[arg_1] = arg_2\n        if arg_2>=2:\n            arg_0.FuncCodes[arg_1] = arg_0.readPrefixCode(\n                BlockTypeAlphabet('BT'+arg_1[0].upper(), arg_2))\n            arg_0.blockCountCodes[arg_1] = arg_0.readPrefixCode(\n                BlockCountAlphabet('BC'+arg_1[0].upper()))\n            arg_6 = arg_0.verboseRead(arg_0.blockCountCodes[arg_1])\n        else:\n            arg_6 = 1<<24\n        arg_0.currentBlockCounts[arg_1] = arg_6", "path": "research/brotlidump.py", "identifier": "Layout.blockType", "docstring": "Read block type switch descriptor for given kind of blockType.", "docstring_tokens": ["Read", "block", "type", "switch", "descriptor", "for", "given", "kind", "of", "blockType", "."], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 257379}
{"url": "https://github.com/UDST/pandana/blob/961a7ef8d3b0144b190cb60bbd61845fca6fb314/pandana/network.py#L495-L581", "sha": "961a7ef8d3b0144b190cb60bbd61845fca6fb314", "docstring_summary": "Find the distance to the nearest pois from each source node.  The\n        bigger values in this case mean less accessibility.", "language": "python", "parameters": "(self, distance, category, num_pois=1, max_distance=None,\n                     imp_name=None, include_poi_ids=False)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_1", "if", "arg_2", "not", "in", "arg_0", ".", "poi_category_names", ":", "assert", "0", ",", "\"Need to call set_pois for this category\"", "if", "arg_3", ">", "arg_0", ".", "max_pois", ":", "assert", "0", ",", "\"Asking for more pois than set in init_pois\"", "arg_7", "=", "arg_0", ".", "_imp_name_to_num", "(", "arg_5", ")", "arg_8", ",", "arg_9", "=", "arg_0", ".", "net", ".", "find_all_Func", "(", "arg_1", ",", "arg_3", ",", "arg_2", ".", "encode", "(", "'utf-8'", ")", ",", "arg_7", ")", "arg_8", "[", "arg_8", "==", "-", "1", "]", "=", "arg_4", "arg_10", "=", "pd", ".", "DataFrame", "(", "arg_8", ",", "index", "=", "arg_0", ".", "node_ids", ")", "arg_10", ".", "columns", "=", "list", "(", "range", "(", "1", ",", "arg_3", "+", "1", ")", ")", "if", "arg_6", ":", "arg_12", "=", "pd", ".", "DataFrame", "(", "arg_9", ",", "index", "=", "arg_0", ".", "node_ids", ")", "arg_12", ".", "columns", "=", "[", "\"poi%d\"", "%", "i", "for", "i", "in", "range", "(", "1", ",", "arg_3", "+", "1", ")", "]", "for", "arg_13", "in", "arg_12", ".", "columns", ":", "arg_14", "=", "arg_12", "[", "arg_13", "]", ".", "astype", "(", "'int'", ")", "arg_12", "[", "arg_13", "]", "=", "arg_0", ".", "poi_category_indexes", "[", "arg_2", "]", ".", "values", "[", "arg_14", "]", "arg_12", ".", "loc", "[", "arg_14", "==", "-", "1", ",", "arg_13", "]", "=", "np", ".", "nan", "arg_10", "=", "pd", ".", "concat", "(", "[", "arg_10", ",", "arg_12", "]", ",", "axis", "=", "1", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1, arg_4=None,\n                     arg_5=None, arg_6=False):\n        \"\"\"\n        Find the distance to the nearest pois from each source node.  The\n        bigger values in this case mean less accessibility.\n\n        Parameters\n        ----------\n        distance : float\n            The maximum distance to look for pois. This will usually be a\n            distance unit in meters however if you have customized the\n            impedance this could be in other units such as utility or time\n            etc.\n        category : string\n            The name of the category of poi to look for\n        num_pois : int\n            The number of pois to look for, this also sets the number of\n            columns in the DataFrame that gets returned\n        max_distance : float, optional\n            The value to set the distance to if there is NO poi within the\n            specified distance - if not specified, gets set to distance. This\n            will usually be a distance unit in meters however if you have\n            customized the impedance this could be in other units such as\n            utility or time etc.\n        imp_name : string, optional\n            The impedance name to use for the aggregation on this network.\n            Must be one of the impedance names passed in the constructor of\n            this object.  If not specified, there must be only one impedance\n            passed in the constructor, which will be used.\n        include_poi_ids : bool, optional\n            If this flag is set to true, the call will add columns to the\n            return DataFrame - instead of just returning the distance for\n            the nth POI, it will also return the id of that POI.  The names\n            of the columns with the poi ids will be poi1, poi2, etc - it\n            will take roughly twice as long to include these ids as to not\n            include them\n\n        Returns\n        -------\n        d : Pandas DataFrame\n            Like aggregate, this series has an index of all the node ids for\n            the network.  Unlike aggregate, this method returns a dataframe\n            with the number of columns equal to the distances to the Nth\n            closest poi.  For instance, if you ask for the 10 closest poi to\n            each node, column d[1] wil be the distance to the 1st closest poi\n            of that category while column d[2] will be the distance to the 2nd\n            closest poi, and so on.\n        \"\"\"\n        if arg_4 is None:\n            arg_4 = arg_1\n\n        if arg_2 not in arg_0.poi_category_names:\n            assert 0, \"Need to call set_pois for this category\"\n\n        if arg_3 > arg_0.max_pois:\n            assert 0, \"Asking for more pois than set in init_pois\"\n\n        arg_7 = arg_0._imp_name_to_num(arg_5)\n\n        arg_8, arg_9 = arg_0.net.find_all_Func(\n            arg_1,\n            arg_3,\n            arg_2.encode('utf-8'),\n            arg_7)\n        arg_8[arg_8 == -1] = arg_4\n\n        arg_10 = pd.DataFrame(arg_8, index=arg_0.node_ids)\n        arg_10.columns = list(range(1, arg_3+1))\n\n        if arg_6:\n            arg_12 = pd.DataFrame(arg_9, index=arg_0.node_ids)\n            arg_12.columns = [\"poi%d\" % i for i in range(1, arg_3+1)]\n            for arg_13 in arg_12.columns:\n                # if this is still all working according to plan at this point\n                # the great magic trick is now to turn the integer position of\n                # the poi, which is painstakingly returned from the c++ code,\n                # and turn it into the actual index that was used when it was\n                # initialized as a pandas series - this really is pandas-like\n                # thinking.  it's complicated on the inside, but quite\n                # intuitive to the user I think\n                arg_14 = arg_12[arg_13].astype('int')\n                arg_12[arg_13] = arg_0.poi_category_indexes[arg_2].values[arg_14]\n                arg_12.loc[arg_14 == -1, arg_13] = np.nan\n\n            arg_10 = pd.concat([arg_10, arg_12], axis=1)\n\n        return arg_10", "path": "pandana/network.py", "identifier": "Network.nearest_pois", "docstring": "Find the distance to the nearest pois from each source node.  The\n        bigger values in this case mean less accessibility.\n\n        Parameters\n        ----------\n        distance : float\n            The maximum distance to look for pois. This will usually be a\n            distance unit in meters however if you have customized the\n            impedance this could be in other units such as utility or time\n            etc.\n        category : string\n            The name of the category of poi to look for\n        num_pois : int\n            The number of pois to look for, this also sets the number of\n            columns in the DataFrame that gets returned\n        max_distance : float, optional\n            The value to set the distance to if there is NO poi within the\n            specified distance - if not specified, gets set to distance. This\n            will usually be a distance unit in meters however if you have\n            customized the impedance this could be in other units such as\n            utility or time etc.\n        imp_name : string, optional\n            The impedance name to use for the aggregation on this network.\n            Must be one of the impedance names passed in the constructor of\n            this object.  If not specified, there must be only one impedance\n            passed in the constructor, which will be used.\n        include_poi_ids : bool, optional\n            If this flag is set to true, the call will add columns to the\n            return DataFrame - instead of just returning the distance for\n            the nth POI, it will also return the id of that POI.  The names\n            of the columns with the poi ids will be poi1, poi2, etc - it\n            will take roughly twice as long to include these ids as to not\n            include them\n\n        Returns\n        -------\n        d : Pandas DataFrame\n            Like aggregate, this series has an index of all the node ids for\n            the network.  Unlike aggregate, this method returns a dataframe\n            with the number of columns equal to the distances to the Nth\n            closest poi.  For instance, if you ask for the 10 closest poi to\n            each node, column d[1] wil be the distance to the 1st closest poi\n            of that category while column d[2] will be the distance to the 2nd\n            closest poi, and so on.", "docstring_tokens": ["Find", "the", "distance", "to", "the", "nearest", "pois", "from", "each", "source", "node", ".", "The", "bigger", "values", "in", "this", "case", "mean", "less", "accessibility", "."], "nwo": "UDST/pandana", "score": 0.47050699646286387, "idx": 257380}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/graph.py#L209-L219", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Calculate the margin in pixels above the plot area, setting\n\t\tborder_top.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "border_top", "=", "5", "if", "arg_0", ".", "show_graph_title", ":", "arg_0", ".", "border_top", "+=", "arg_0", ".", "title_font_size", "arg_0", ".", "border_top", "+=", "5", "if", "arg_0", ".", "show_graph_subtitle", ":", "arg_0", ".", "border_top", "+=", "arg_0", ".", "subtitle_font_size"], "function": "def Func(arg_0):\n\t\t\"\"\"\n\t\tCalculate the margin in pixels above the plot area, setting\n\t\tborder_top.\n\t\t\"\"\"\n\t\targ_0.border_top = 5\n\t\tif arg_0.show_graph_title:\n\t\t\targ_0.border_top += arg_0.title_font_size\n\t\targ_0.border_top += 5\n\t\tif arg_0.show_graph_subtitle:\n\t\t\targ_0.border_top += arg_0.subtitle_font_size", "path": "svg/charts/graph.py", "identifier": "Graph.calculate_top_margin", "docstring": "Calculate the margin in pixels above the plot area, setting\n\t\tborder_top.", "docstring_tokens": ["Calculate", "the", "margin", "in", "pixels", "above", "the", "plot", "area", "setting", "border_top", "."], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 257381}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L115-L133", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates a new Cloud SQL instance.", "language": "python", "parameters": "(self, body, project_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "get_conn", "(", ")", ".", "instances", "(", ")", ".", "insert", "(", "project", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "arg_4", "=", "arg_3", "[", "\"name\"", "]", "arg_0", ".", "_wait_for_operation_to_complete", "(", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Creates a new Cloud SQL instance.\n\n        :param body: Body required by the Cloud SQL insert API, as described in\n            https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/insert#request-body.\n        :type body: dict\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None\n        \"\"\"\n        arg_3 = arg_0.get_conn().instances().insert(\n            project=arg_2,\n            arg_1=arg_1\n        ).execute(num_retries=arg_0.num_retries)\n        arg_4 = arg_3[\"name\"]\n        arg_0._wait_for_operation_to_complete(arg_2=arg_2,\n                                             arg_4=arg_4)", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlHook.create_instance", "docstring": "Creates a new Cloud SQL instance.\n\n        :param body: Body required by the Cloud SQL insert API, as described in\n            https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/insert#request-body.\n        :type body: dict\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None", "docstring_tokens": ["Creates", "a", "new", "Cloud", "SQL", "instance", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257382}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L460-L475", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Sends PUB command to the NATS server.", "language": "python", "parameters": "(self, subject, reply, payload, payload_size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_1", "==", "\"\"", ":", "raise", "ErrBadSubject", "arg_5", "=", "(", "\"%d\"", "%", "arg_4", ")", ".", "encode", "(", ")", "arg_6", "=", "b''", ".", "join", "(", "[", "PUB_OP", ",", "_SPC_", ",", "arg_1", ".", "encode", "(", ")", ",", "_SPC_", ",", "arg_2", ",", "_SPC_", ",", "arg_5", ",", "_CRLF_", ",", "arg_3", ",", "_CRLF_", "]", ")", "arg_0", ".", "stats", "[", "'out_msgs'", "]", "+=", "1", "arg_0", ".", "stats", "[", "'out_bytes'", "]", "+=", "arg_4", "yield", "from", "arg_0", ".", "_send_command", "(", "arg_6", ")", "if", "arg_0", ".", "_flush_queue", ".", "empty", "(", ")", ":", "yield", "from", "arg_0", ".", "_flush_pending", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Sends PUB command to the NATS server.\n        \"\"\"\n        if arg_1 == \"\":\n            # Avoid sending messages with empty replies.\n            raise ErrBadSubject\n\n        arg_5 = (\"%d\" % arg_4).encode()\n        arg_6 = b''.join([PUB_OP, _SPC_, arg_1.encode(\n        ), _SPC_, arg_2, _SPC_, arg_5, _CRLF_, arg_3, _CRLF_])\n        arg_0.stats['out_msgs'] += 1\n        arg_0.stats['out_bytes'] += arg_4\n        yield from arg_0._send_command(arg_6)\n        if arg_0._flush_queue.empty():\n            yield from arg_0._flush_pending()", "path": "nats/aio/client.py", "identifier": "Client._publish", "docstring": "Sends PUB command to the NATS server.", "docstring_tokens": ["Sends", "PUB", "command", "to", "the", "NATS", "server", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 257383}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L701-L714", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Post a review", "language": "python", "parameters": "(session, review)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "make_post_request", "(", "arg_0", ",", "'reviews'", ",", "arg_3", "=", "arg_1", ")", "arg_3", "=", "arg_2", ".", "json", "(", ")", "if", "arg_2", ".", "status_code", "==", "200", ":", "return", "arg_3", "[", "'status'", "]", "else", ":", "raise", "ReviewNotPostedException", "(", "message", "=", "arg_3", "[", "'message'", "]", ",", "error_code", "=", "arg_3", "[", "'error_code'", "]", ",", "request_id", "=", "arg_3", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Post a review\n    \"\"\"\n    # POST /api/projects/0.1/reviews/\n    arg_2 = make_post_request(arg_0, 'reviews', arg_3=arg_1)\n    arg_3 = arg_2.json()\n    if arg_2.status_code == 200:\n        return arg_3['status']\n    else:\n        raise ReviewNotPostedException(\n            message=arg_3['message'],\n            error_code=arg_3['error_code'],\n            request_id=arg_3['request_id'])", "path": "freelancersdk/resources/projects/projects.py", "identifier": "post_review", "docstring": "Post a review", "docstring_tokens": ["Post", "a", "review"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 257384}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/db.py#L171-L176", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Remove a patch from the patches list", "language": "python", "parameters": "(self, patch)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_check_patch", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "patch2line", "[", "arg_1", "]", "del", "arg_0", ".", "patch2line", "[", "arg_1", "]", "arg_0", ".", "patchlines", ".", "remove", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Remove a patch from the patches list \"\"\"\n        arg_0._check_patch(arg_1)\n        arg_2 = arg_0.patch2line[arg_1]\n        del arg_0.patch2line[arg_1]\n        arg_0.patchlines.remove(arg_2)", "path": "quilt/db.py", "identifier": "PatchSeries.remove_patch", "docstring": "Remove a patch from the patches list", "docstring_tokens": ["Remove", "a", "patch", "from", "the", "patches", "list"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 257385}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/lsh.py#L213-L229", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Remove the key from the index.", "language": "python", "parameters": "(self, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "prepickle", ":", "arg_1", "=", "pickle", ".", "dumps", "(", "arg_1", ")", "if", "arg_1", "not", "in", "arg_0", ".", "keys", ":", "raise", "ValueError", "(", "\"The given key does not exist\"", ")", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "arg_0", ".", "keys", "[", "arg_1", "]", ",", "arg_0", ".", "hashtables", ")", ":", "arg_3", ".", "Func_val", "(", "arg_2", ",", "arg_1", ")", "if", "not", "arg_3", ".", "get", "(", "arg_2", ")", ":", "arg_3", ".", "Func", "(", "arg_2", ")", "arg_0", ".", "keys", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Remove the key from the index.\n\n        Args:\n            key (hashable): The unique identifier of a set.\n\n        '''\n        if arg_0.prepickle:\n            arg_1 = pickle.dumps(arg_1)\n        if arg_1 not in arg_0.keys:\n            raise ValueError(\"The given key does not exist\")\n        for arg_2, arg_3 in zip(arg_0.keys[arg_1], arg_0.hashtables):\n            arg_3.Func_val(arg_2, arg_1)\n            if not arg_3.get(arg_2):\n                arg_3.Func(arg_2)\n        arg_0.keys.Func(arg_1)", "path": "datasketch/lsh.py", "identifier": "MinHashLSH.remove", "docstring": "Remove the key from the index.\n\n        Args:\n            key (hashable): The unique identifier of a set.", "docstring_tokens": ["Remove", "the", "key", "from", "the", "index", "."], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 257386}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_factory.py#L180-L206", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Get a printable fuzzed object", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "if", "arg_0", ".", "config", ".", "strong_fuzz", ":", "arg_1", "=", "PJFMutators", "(", "arg_0", ".", "config", ")", "if", "arg_0", ".", "config", ".", "url_encode", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "return", "urllib", ".", "parse", ".", "quote", "(", "arg_1", ".", "fuzz", "(", "json", ".", "dumps", "(", "arg_0", ".", "config", ".", "json", ")", ")", ")", "else", ":", "return", "urllib", ".", "quote", "(", "arg_1", ".", "fuzz", "(", "json", ".", "dumps", "(", "arg_0", ".", "config", ".", "json", ")", ")", ")", "else", ":", "if", "type", "(", "arg_0", ".", "config", ".", "json", ")", "in", "[", "list", ",", "dict", "]", ":", "return", "arg_1", ".", "fuzz", "(", "json", ".", "dumps", "(", "arg_0", ".", "config", ".", "json", ")", ")", "else", ":", "return", "arg_1", ".", "fuzz", "(", "arg_0", ".", "config", ".", "json", ")", "else", ":", "if", "arg_0", ".", "config", ".", "url_encode", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "return", "urllib", ".", "parse", ".", "quote", "(", "arg_0", ".", "get_Func", "(", "arg_0", ".", "config", ".", "indent", ",", "arg_0", ".", "config", ".", "utf8", ")", ")", "else", ":", "return", "urllib", ".", "quote", "(", "arg_0", ".", "get_Func", "(", "arg_0", ".", "config", ".", "indent", ",", "arg_0", ".", "config", ".", "utf8", ")", ")", "else", ":", "return", "arg_0", ".", "get_Func", "(", "arg_0", ".", "config", ".", "indent", ",", "arg_0", ".", "config", ".", "utf8", ")", "except", "Exception", "as", "e", ":", "raise", "PJFBaseException", "(", "e", ".", "message", "if", "hasattr", "(", "e", ",", "\"message\"", ")", "else", "str", "(", "e", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get a printable Func object\n        \"\"\"\n        try:\n            if arg_0.config.strong_fuzz:\n                arg_1 = PJFMutators(arg_0.config)\n                if arg_0.config.url_encode:\n                    if sys.version_info >= (3, 0):\n                        return urllib.parse.quote(arg_1.fuzz(json.dumps(arg_0.config.json)))\n                    else:\n                        return urllib.quote(arg_1.fuzz(json.dumps(arg_0.config.json)))\n                else:\n                    if type(arg_0.config.json) in [list, dict]:\n                        return arg_1.fuzz(json.dumps(arg_0.config.json))\n                    else:\n                        return arg_1.fuzz(arg_0.config.json)\n            else:\n                if arg_0.config.url_encode:\n                    if sys.version_info >= (3, 0):\n                        return urllib.parse.quote(arg_0.get_Func(arg_0.config.indent, arg_0.config.utf8))\n                    else:\n                        return urllib.quote(arg_0.get_Func(arg_0.config.indent, arg_0.config.utf8))\n                else:\n                    return arg_0.get_Func(arg_0.config.indent, arg_0.config.utf8)\n        except Exception as e:\n            raise PJFBaseException(e.message if hasattr(e, \"message\") else str(e))", "path": "pyjfuzz/core/pjf_factory.py", "identifier": "PJFFactory.fuzzed", "docstring": "Get a printable fuzzed object", "docstring_tokens": ["Get", "a", "printable", "fuzzed", "object"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 257387}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/recurrent.py#L12-L54", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Create a callable that generates samples from a dataset.", "language": "python", "parameters": "(arrays, steps=100, batch_size=64, rng=None)", "return_statement": "return sample", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "100", ",", "arg_2", "=", "64", ",", "arg_3", "=", "None", ")", ":", "assert", "arg_2", ">=", "2", ",", "'batch_size must be at least 2!'", "assert", "isinstance", "(", "arg_0", ",", "(", "tuple", ",", "list", ")", ")", ",", "'arrays must be a tuple or list!'", "if", "arg_3", "is", "None", "or", "isinstance", "(", "arg_3", ",", "int", ")", ":", "arg_3", "=", "np", ".", "random", ".", "RandomState", "(", "arg_3", ")", "def", "sample", "(", ")", ":", "arg_4", "=", "[", "np", ".", "zeros", "(", "(", "arg_2", ",", "arg_1", ",", "arg_8", ".", "shape", "[", "1", "]", ")", ",", "arg_8", ".", "dtype", ")", "for", "arg_8", "in", "arg_0", "]", "for", "arg_5", "in", "range", "(", "arg_2", ")", ":", "arg_6", "=", "arg_3", ".", "randint", "(", "len", "(", "arg_0", "[", "0", "]", ")", "-", "arg_1", ")", "for", "arg_7", ",", "arg_8", "in", "zip", "(", "arg_4", ",", "arg_0", ")", ":", "arg_7", "[", "arg_5", "]", "=", "arg_8", "[", "arg_6", ":", "arg_6", "+", "arg_1", "]", "return", "arg_4", "return", "sample"], "function": "def Func(arg_0, arg_1=100, arg_2=64, arg_3=None):\n    '''Create a callable that generates samples from a dataset.\n\n    Parameters\n    ----------\n    arrays : list of ndarray (time-steps, data-dimensions)\n        Arrays of data. Rows in these arrays are assumed to correspond to time\n        steps, and columns to variables. Multiple arrays can be given; in such\n        a case, these arrays usually correspond to [input, output]---for\n        example, for a recurrent regression problem---or [input, output,\n        weights]---for a weighted regression or classification problem.\n    steps : int, optional\n        Generate samples of this many time steps. Defaults to 100.\n    batch_size : int, optional\n        Generate this many samples per call. Defaults to 64. This must match the\n        batch_size parameter that was used when creating the recurrent network\n        that will process the data.\n    rng : :class:`numpy.random.RandomState` or int, optional\n        A random number generator, or an integer seed for a random number\n        generator. If not provided, the random number generator will be created\n        with an automatically chosen seed.\n\n    Returns\n    -------\n    callable :\n        A callable that can be used inside a dataset for training a recurrent\n        network.\n    '''\n    assert arg_2 >= 2, 'batch_size must be at least 2!'\n    assert isinstance(arg_0, (tuple, list)), 'arrays must be a tuple or list!'\n\n    if arg_3 is None or isinstance(arg_3, int):\n        arg_3 = np.random.RandomState(arg_3)\n\n    def sample():\n        arg_4 = [np.zeros((arg_2, arg_1, arg_8.shape[1]), arg_8.dtype) for arg_8 in arg_0]\n        for arg_5 in range(arg_2):\n            arg_6 = arg_3.randint(len(arg_0[0]) - arg_1)\n            for arg_7, arg_8 in zip(arg_4, arg_0):\n                arg_7[arg_5] = arg_8[arg_6:arg_6+arg_1]\n        return arg_4\n\n    return sample", "path": "theanets/recurrent.py", "identifier": "batches", "docstring": "Create a callable that generates samples from a dataset.\n\n    Parameters\n    ----------\n    arrays : list of ndarray (time-steps, data-dimensions)\n        Arrays of data. Rows in these arrays are assumed to correspond to time\n        steps, and columns to variables. Multiple arrays can be given; in such\n        a case, these arrays usually correspond to [input, output]---for\n        example, for a recurrent regression problem---or [input, output,\n        weights]---for a weighted regression or classification problem.\n    steps : int, optional\n        Generate samples of this many time steps. Defaults to 100.\n    batch_size : int, optional\n        Generate this many samples per call. Defaults to 64. This must match the\n        batch_size parameter that was used when creating the recurrent network\n        that will process the data.\n    rng : :class:`numpy.random.RandomState` or int, optional\n        A random number generator, or an integer seed for a random number\n        generator. If not provided, the random number generator will be created\n        with an automatically chosen seed.\n\n    Returns\n    -------\n    callable :\n        A callable that can be used inside a dataset for training a recurrent\n        network.", "docstring_tokens": ["Create", "a", "callable", "that", "generates", "samples", "from", "a", "dataset", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 257388}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/sinusoidal.py#L133-L146", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is the residual objective function to be minimized by `scipy.leastsq`.", "language": "python", "parameters": "(fourierparams,\n                      phase,\n                      mags)", "return_statement": "return residual", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "_fourier_func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_2", "-", "arg_3", "return", "arg_4"], "function": "def Func(arg_0,\n                      arg_1,\n                      arg_2):\n    '''\n    This is the residual objective function to be minimized by `scipy.leastsq`.\n\n    The parameters are the same as `_fourier_func` above.\n\n    '''\n\n    arg_3 = _fourier_func(arg_0, arg_1, arg_2)\n    arg_4 = arg_2 - arg_3\n\n    return arg_4", "path": "astrobase/lcfit/sinusoidal.py", "identifier": "_fourier_residual", "docstring": "This is the residual objective function to be minimized by `scipy.leastsq`.\n\n    The parameters are the same as `_fourier_func` above.", "docstring_tokens": ["This", "is", "the", "residual", "objective", "function", "to", "be", "minimized", "by", "scipy", ".", "leastsq", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257389}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/_util.py#L148-L207", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Insert size bytes of empty space starting at offset.", "language": "python", "parameters": "(fobj, size, offset, BUFFER_SIZE=2**16)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "2", "**", "16", ")", ":", "assert", "0", "<", "arg_1", "assert", "0", "<=", "arg_2", "arg_4", "=", "False", "arg_0", ".", "seek", "(", "0", ",", "2", ")", "arg_5", "=", "arg_0", ".", "tell", "(", ")", "arg_6", "=", "arg_5", "-", "arg_2", "arg_0", ".", "write", "(", "b'\\x00'", "*", "arg_1", ")", "arg_0", ".", "flush", "(", ")", "try", ":", "try", ":", "import", "mmap", "arg_7", "=", "mmap", ".", "mmap", "(", "arg_0", ".", "fileno", "(", ")", ",", "arg_5", "+", "arg_1", ")", "try", ":", "arg_7", ".", "move", "(", "arg_2", "+", "arg_1", ",", "arg_2", ",", "arg_6", ")", "finally", ":", "arg_7", ".", "close", "(", ")", "except", "(", "ValueError", ",", "EnvironmentError", ",", "ImportError", ")", ":", "arg_4", "=", "lock", "(", "arg_0", ")", "arg_0", ".", "truncate", "(", "arg_5", ")", "arg_0", ".", "seek", "(", "0", ",", "2", ")", "arg_8", "=", "arg_1", "while", "arg_8", ":", "arg_9", "=", "min", "(", "arg_3", ",", "arg_8", ")", "arg_0", ".", "write", "(", "b\"\\x00\"", "*", "arg_9", ")", "arg_8", "-=", "arg_9", "arg_0", ".", "seek", "(", "arg_5", ",", "0", ")", "while", "arg_6", ":", "arg_10", "=", "min", "(", "arg_3", ",", "arg_6", ")", "arg_0", ".", "seek", "(", "-", "arg_10", ",", "1", ")", "arg_11", "=", "arg_0", ".", "tell", "(", ")", "arg_12", "=", "arg_0", ".", "read", "(", "arg_10", ")", "arg_0", ".", "seek", "(", "-", "arg_10", "+", "arg_1", ",", "1", ")", "arg_0", ".", "write", "(", "arg_12", ")", "arg_0", ".", "seek", "(", "arg_11", ")", "arg_6", "-=", "arg_10", "arg_0", ".", "flush", "(", ")", "finally", ":", "if", "arg_4", ":", "unlock", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=2**16):\n    \"\"\"Insert size bytes of empty space starting at offset.\n\n    fobj must be an open file object, open rb+ or\n    equivalent. Mutagen tries to use mmap to resize the file, but\n    falls back to a significantly slower method if mmap fails.\n    \"\"\"\n\n    assert 0 < arg_1\n    assert 0 <= arg_2\n    arg_4 = False\n    arg_0.seek(0, 2)\n    arg_5 = arg_0.tell()\n    arg_6 = arg_5 - arg_2\n    arg_0.write(b'\\x00' * arg_1)\n    arg_0.flush()\n    try:\n        try:\n            import mmap\n            arg_7 = mmap.mmap(arg_0.fileno(), arg_5 + arg_1)\n            try:\n                arg_7.move(arg_2 + arg_1, arg_2, arg_6)\n            finally:\n                arg_7.close()\n        except (ValueError, EnvironmentError, ImportError):\n            # handle broken mmap scenarios\n            arg_4 = lock(arg_0)\n            arg_0.truncate(arg_5)\n\n            arg_0.seek(0, 2)\n            arg_8 = arg_1\n            # Don't generate an enormous string if we need to pad\n            # the file out several megs.\n            while arg_8:\n                arg_9 = min(arg_3, arg_8)\n                arg_0.write(b\"\\x00\" * arg_9)\n                arg_8 -= arg_9\n\n            arg_0.seek(arg_5, 0)\n            while arg_6:\n                # At the start of this loop, fobj is pointing at the end\n                # of the data we need to move, which is of movesize length.\n                arg_10 = min(arg_3, arg_6)\n                # Seek back however much we're going to read this frame.\n                arg_0.seek(-arg_10, 1)\n                arg_11 = arg_0.tell()\n                # Read it, so we're back at the end.\n                arg_12 = arg_0.read(arg_10)\n                # Seek back to where we need to write it.\n                arg_0.seek(-arg_10 + arg_1, 1)\n                # Write it.\n                arg_0.write(arg_12)\n                # And seek back to the end of the unmoved data.\n                arg_0.seek(arg_11)\n                arg_6 -= arg_10\n\n            arg_0.flush()\n    finally:\n        if arg_4:\n            unlock(arg_0)", "path": "mutagen/_util.py", "identifier": "insert_bytes", "docstring": "Insert size bytes of empty space starting at offset.\n\n    fobj must be an open file object, open rb+ or\n    equivalent. Mutagen tries to use mmap to resize the file, but\n    falls back to a significantly slower method if mmap fails.", "docstring_tokens": ["Insert", "size", "bytes", "of", "empty", "space", "starting", "at", "offset", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 257390}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L815-L834", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check that a node is inside a for or while loop", "language": "python", "parameters": "(self, node, node_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "parent", "while", "arg_3", ":", "if", "isinstance", "(", "arg_3", ",", "(", "astroid", ".", "For", ",", "astroid", ".", "While", ")", ")", ":", "if", "arg_1", "not", "in", "arg_3", ".", "orelse", ":", "return", "if", "isinstance", "(", "arg_3", ",", "(", "astroid", ".", "ClassDef", ",", "astroid", ".", "FunctionDef", ")", ")", ":", "break", "if", "(", "isinstance", "(", "arg_3", ",", "astroid", ".", "TryFinally", ")", "and", "arg_1", "in", "arg_3", ".", "finalbody", "and", "isinstance", "(", "arg_1", ",", "astroid", ".", "Continue", ")", ")", ":", "arg_0", ".", "add_message", "(", "\"continue-in-finally\"", ",", "arg_1", "=", "arg_1", ")", "arg_3", "=", "arg_3", ".", "parent", "arg_0", ".", "add_message", "(", "\"not-in-loop\"", ",", "arg_1", "=", "arg_1", ",", "args", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"check that a node is inside a for or while loop\"\"\"\n        arg_3 = arg_1.parent\n        while arg_3:\n            if isinstance(arg_3, (astroid.For, astroid.While)):\n                if arg_1 not in arg_3.orelse:\n                    return\n\n            if isinstance(arg_3, (astroid.ClassDef, astroid.FunctionDef)):\n                break\n            if (\n                isinstance(arg_3, astroid.TryFinally)\n                and arg_1 in arg_3.finalbody\n                and isinstance(arg_1, astroid.Continue)\n            ):\n                arg_0.add_message(\"continue-in-finally\", arg_1=arg_1)\n\n            arg_3 = arg_3.parent\n\n        arg_0.add_message(\"not-in-loop\", arg_1=arg_1, args=arg_2)", "path": "pylint/checkers/base.py", "identifier": "BasicErrorChecker._check_in_loop", "docstring": "check that a node is inside a for or while loop", "docstring_tokens": ["check", "that", "a", "node", "is", "inside", "a", "for", "or", "while", "loop"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257391}
{"url": "https://github.com/UDST/pandana/blob/961a7ef8d3b0144b190cb60bbd61845fca6fb314/pandana/network.py#L458-L493", "sha": "961a7ef8d3b0144b190cb60bbd61845fca6fb314", "docstring_summary": "Set the location of all the pois of this category. The pois are\n        connected to the closest node in the Pandana network which assumes\n        no impedance between the location of the variable and the location\n        of the closest network node.", "language": "python", "parameters": "(self, category, maxdist, maxitems, x_col, y_col)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "poi_category_names", ":", "arg_0", ".", "poi_category_names", ".", "append", "(", "arg_1", ")", "arg_0", ".", "max_pois", "=", "arg_3", "arg_7", "=", "arg_0", ".", "get_node_ids", "(", "arg_4", ",", "arg_5", ")", "arg_0", ".", "poi_category_indexes", "[", "arg_1", "]", "=", "arg_7", ".", "index", "arg_9", "=", "arg_0", ".", "_node_indexes", "(", "arg_7", ")", "arg_0", ".", "net", ".", "initialize_category", "(", "arg_2", ",", "arg_3", ",", "arg_1", ".", "encode", "(", "'utf-8'", ")", ",", "arg_9", ".", "values", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"\n        Set the location of all the pois of this category. The pois are\n        connected to the closest node in the Pandana network which assumes\n        no impedance between the location of the variable and the location\n        of the closest network node.\n\n        Parameters\n        ----------\n        category : string\n            The name of the category for this set of pois\n        maxdist - the maximum distance that will later be used in\n            find_all_nearest_pois\n        maxitems - the maximum number of items that will later be requested\n            in find_all_nearest_pois\n        x_col : Pandas Series (float)\n            The x location (longitude) of pois in this category\n        y_col : Pandas Series (Float)\n            The y location (latitude) of pois in this category\n\n        Returns\n        -------\n        Nothing\n        \"\"\"\n        if arg_1 not in arg_0.poi_category_names:\n            arg_0.poi_category_names.append(arg_1)\n\n        arg_0.max_pois = arg_3\n\n        arg_7 = arg_0.get_node_ids(arg_4, arg_5)\n\n        arg_0.poi_category_indexes[arg_1] = arg_7.index\n\n        arg_9 = arg_0._node_indexes(arg_7)\n\n        arg_0.net.initialize_category(arg_2, arg_3, arg_1.encode('utf-8'), arg_9.values)", "path": "pandana/network.py", "identifier": "Network.set_pois", "docstring": "Set the location of all the pois of this category. The pois are\n        connected to the closest node in the Pandana network which assumes\n        no impedance between the location of the variable and the location\n        of the closest network node.\n\n        Parameters\n        ----------\n        category : string\n            The name of the category for this set of pois\n        maxdist - the maximum distance that will later be used in\n            find_all_nearest_pois\n        maxitems - the maximum number of items that will later be requested\n            in find_all_nearest_pois\n        x_col : Pandas Series (float)\n            The x location (longitude) of pois in this category\n        y_col : Pandas Series (Float)\n            The y location (latitude) of pois in this category\n\n        Returns\n        -------\n        Nothing", "docstring_tokens": ["Set", "the", "location", "of", "all", "the", "pois", "of", "this", "category", ".", "The", "pois", "are", "connected", "to", "the", "closest", "node", "in", "the", "Pandana", "network", "which", "assumes", "no", "impedance", "between", "the", "location", "of", "the", "variable", "and", "the", "location", "of", "the", "closest", "network", "node", "."], "nwo": "UDST/pandana", "score": 0.47050699646286387, "idx": 257392}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L291-L312", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Resolve the names of outputs for this layer into shape tuples.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_0", ".", "_input_shapes", ".", "values", "(", ")", ")", ":", "if", "arg_2", "==", "0", ":", "arg_1", "=", "arg_3", "if", "len", "(", "arg_1", ")", "!=", "len", "(", "arg_3", ")", "or", "any", "(", "arg_4", "is", "not", "None", "and", "arg_5", "is", "not", "None", "and", "arg_4", "!=", "arg_5", "for", "arg_4", ",", "arg_5", "in", "zip", "(", "arg_1", "[", ":", "-", "1", "]", ",", "arg_3", "[", ":", "-", "1", "]", ")", ")", ":", "raise", "util", ".", "ConfigurationError", "(", "'layer \"{}\" incompatible input shapes {}'", ".", "format", "(", "arg_0", ".", "name", ",", "arg_0", ".", "_input_shapes", ")", ")", "arg_6", "=", "arg_0", ".", "kwargs", ".", "get", "(", "'size'", ")", "arg_3", "=", "arg_0", ".", "kwargs", ".", "get", "(", "'shape'", ")", "if", "arg_3", "is", "not", "None", ":", "pass", "elif", "arg_6", "is", "not", "None", ":", "arg_3", "=", "tuple", "(", "arg_1", "[", ":", "-", "1", "]", ")", "+", "(", "arg_6", ",", ")", "else", ":", "raise", "util", ".", "ConfigurationError", "(", "'layer \"{}\" does not specify a size'", ".", "format", "(", "arg_0", ".", "name", ")", ")", "arg_0", ".", "_output_shapes", "[", "'out'", "]", "=", "arg_3"], "function": "def Func(arg_0):\n        '''Resolve the names of outputs for this layer into shape tuples.'''\n        arg_1 = None\n        for arg_2, arg_3 in enumerate(arg_0._input_shapes.values()):\n            if arg_2 == 0:\n                arg_1 = arg_3\n            if len(arg_1) != len(arg_3) or any(\n                    arg_4 is not None and arg_5 is not None and arg_4 != arg_5\n                    for arg_4, arg_5 in zip(arg_1[:-1], arg_3[:-1])):\n                raise util.ConfigurationError(\n                    'layer \"{}\" incompatible input shapes {}'\n                    .format(arg_0.name, arg_0._input_shapes))\n        arg_6 = arg_0.kwargs.get('size')\n        arg_3 = arg_0.kwargs.get('shape')\n        if arg_3 is not None:\n            pass\n        elif arg_6 is not None:\n            arg_3 = tuple(arg_1[:-1]) + (arg_6, )\n        else:\n            raise util.ConfigurationError(\n                'layer \"{}\" does not specify a size'.format(arg_0.name))\n        arg_0._output_shapes['out'] = arg_3", "path": "theanets/layers/base.py", "identifier": "Layer.resolve_outputs", "docstring": "Resolve the names of outputs for this layer into shape tuples.", "docstring_tokens": ["Resolve", "the", "names", "of", "outputs", "for", "this", "layer", "into", "shape", "tuples", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 257393}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/connection.py#L595-L605", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Close the policy instance.", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_logger", ".", "info", "(", "\"Closing\"", ")", "if", "arg_0", ".", "_opened", ":", "arg_0", ".", "_opened", "=", "False", "else", ":", "arg_0", ".", "_logger", ".", "warning", "(", "\"Func() called, but connection policy was alredy Funcd\"", ")", "return"], "function": "def Func(arg_0):\n    \"\"\" Close the policy instance. \"\"\"\n    arg_0._logger.info(\"Closing\")\n\n    if arg_0._opened:\n      arg_0._opened = False\n    else:\n      arg_0._logger.warning(\n        \"Func() called, but connection policy was alredy Funcd\")\n\n    return", "path": "src/nupic/database/connection.py", "identifier": "PerTransactionConnectionPolicy.close", "docstring": "Close the policy instance.", "docstring_tokens": ["Close", "the", "policy", "instance", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257394}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L1001-L1032", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Visualizes a qualitative analysis of a given model.", "language": "python", "parameters": "(inputs, model, samples=1, batch_size=3,\n                                   length=8)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "3", ",", "arg_4", "=", "8", ")", ":", "arg_5", "=", "lambda", "dist", ":", "tf", ".", "reduce_mean", "(", "input_tensor", "=", "dist", ".", "mean", "(", ")", ",", "axis", "=", "0", ")", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "\"val_reconstruction\"", ")", ":", "arg_6", "=", "functools", ".", "partial", "(", "arg_1", ".", "reconstruct", ",", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ")", "visualize_reconstruction", "(", "arg_0", ",", "arg_5", "(", "arg_6", "(", ")", ")", ")", "visualize_reconstruction", "(", "arg_0", ",", "arg_5", "(", "arg_6", "(", "sample_static", "=", "True", ")", ")", ",", "name", "=", "\"static_prior\"", ")", "visualize_reconstruction", "(", "arg_0", ",", "arg_5", "(", "arg_6", "(", "sample_dynamic", "=", "True", ")", ")", ",", "name", "=", "\"dynamic_prior\"", ")", "visualize_reconstruction", "(", "arg_0", ",", "arg_5", "(", "arg_6", "(", "swap_static", "=", "True", ")", ")", ",", "name", "=", "\"swap_static\"", ")", "visualize_reconstruction", "(", "arg_0", ",", "arg_5", "(", "arg_6", "(", "swap_dynamic", "=", "True", ")", ")", ",", "name", "=", "\"swap_dynamic\"", ")", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "\"generation\"", ")", ":", "arg_7", "=", "functools", ".", "partial", "(", "arg_1", ".", "generate", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_2", "=", "arg_2", ")", "image_summary", "(", "arg_5", "(", "arg_7", "(", "fix_static", "=", "True", ")", ")", ",", "\"fix_static\"", ")", "image_summary", "(", "arg_5", "(", "arg_7", "(", "fix_dynamic", "=", "True", ")", ")", ",", "\"fix_dynamic\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=3,\n                                   arg_4=8):\n  \"\"\"Visualizes a qualitative analysis of a given model.\n\n  Args:\n    inputs: A tensor of the original inputs, of shape [batch, timesteps,\n      h, w, c].\n    model: A DisentangledSequentialVAE model.\n    samples: Number of samples to draw from the latent distributions.\n    batch_size: Number of sequences to generate.\n    length: Number of timesteps to generate for each sequence.\n  \"\"\"\n  arg_5 = lambda dist: tf.reduce_mean(\n      input_tensor=dist.mean(), axis=0)  # avg over samples\n  with tf.compat.v1.name_scope(\"val_reconstruction\"):\n    arg_6 = functools.partial(arg_1.reconstruct, arg_0=arg_0,\n                                    arg_2=arg_2)\n    visualize_reconstruction(arg_0, arg_5(arg_6()))\n    visualize_reconstruction(arg_0, arg_5(arg_6(sample_static=True)),\n                             name=\"static_prior\")\n    visualize_reconstruction(arg_0, arg_5(arg_6(sample_dynamic=True)),\n                             name=\"dynamic_prior\")\n    visualize_reconstruction(arg_0, arg_5(arg_6(swap_static=True)),\n                             name=\"swap_static\")\n    visualize_reconstruction(arg_0, arg_5(arg_6(swap_dynamic=True)),\n                             name=\"swap_dynamic\")\n\n  with tf.compat.v1.name_scope(\"generation\"):\n    arg_7 = functools.partial(arg_1.generate, arg_3=arg_3,\n                                 arg_4=arg_4, arg_2=arg_2)\n    image_summary(arg_5(arg_7(fix_static=True)), \"fix_static\")\n    image_summary(arg_5(arg_7(fix_dynamic=True)), \"fix_dynamic\")", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "visualize_qualitative_analysis", "docstring": "Visualizes a qualitative analysis of a given model.\n\n  Args:\n    inputs: A tensor of the original inputs, of shape [batch, timesteps,\n      h, w, c].\n    model: A DisentangledSequentialVAE model.\n    samples: Number of samples to draw from the latent distributions.\n    batch_size: Number of sequences to generate.\n    length: Number of timesteps to generate for each sequence.", "docstring_tokens": ["Visualizes", "a", "qualitative", "analysis", "of", "a", "given", "model", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257395}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L88-L121", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Async fetching of all tags dates.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "options", ".", "verbose", ":", "print", "(", "\"Fetching dates for {} tags...\"", ".", "format", "(", "len", "(", "arg_0", ".", "filtered_tags", ")", ")", ")", "def", "worker", "(", "arg_1", ")", ":", "arg_0", ".", "get_time_of_tag", "(", "arg_1", ")", "arg_2", "=", "[", "]", "arg_3", "=", "50", "arg_4", "=", "len", "(", "arg_0", ".", "filtered_tags", ")", "for", "arg_5", "in", "range", "(", "0", ",", "(", "arg_4", "//", "arg_3", ")", "+", "1", ")", ":", "for", "arg_6", "in", "range", "(", "arg_3", ")", ":", "arg_7", "=", "arg_5", "*", "50", "+", "arg_6", "if", "arg_7", "==", "arg_4", ":", "break", "arg_8", "=", "threading", ".", "Thread", "(", "target", "=", "worker", ",", "args", "=", "(", "arg_0", ".", "filtered_tags", "[", "arg_7", "]", ",", ")", ")", "arg_2", ".", "append", "(", "arg_8", ")", "arg_8", ".", "start", "(", ")", "if", "arg_0", ".", "options", ".", "verbose", ">", "2", ":", "print", "(", "\".\"", ",", "end", "=", "\"\"", ")", "for", "arg_8", "in", "arg_2", ":", "arg_8", ".", "join", "(", ")", "if", "arg_0", ".", "options", ".", "verbose", ">", "2", ":", "print", "(", "\".\"", ")", "if", "arg_0", ".", "options", ".", "verbose", ">", "1", ":", "print", "(", "\"Fetched dates for {} tags.\"", ".", "format", "(", "len", "(", "arg_0", ".", "tag_times_dict", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Async fetching of all tags dates. \"\"\"\n\n        if arg_0.options.verbose:\n            print(\n                \"Fetching dates for {} tags...\".format(len(arg_0.filtered_tags))\n            )\n\n        def worker(arg_1):\n            arg_0.get_time_of_tag(arg_1)\n\n        # Async fetching tags:\n        arg_2 = []\n        arg_3 = 50\n        arg_4 = len(arg_0.filtered_tags)\n        for arg_5 in range(0, (arg_4 // arg_3) + 1):\n            for arg_6 in range(arg_3):\n                arg_7 = arg_5 * 50 + arg_6\n                if arg_7 == arg_4:\n                    break\n                arg_8 = threading.Thread(target=worker,\n                                     args=(arg_0.filtered_tags[arg_7],))\n                arg_2.append(arg_8)\n                arg_8.start()\n                if arg_0.options.verbose > 2:\n                    print(\".\", end=\"\")\n            for arg_8 in arg_2:\n                arg_8.join()\n        if arg_0.options.verbose > 2:\n            print(\".\")\n        if arg_0.options.verbose > 1:\n            print(\"Fetched dates for {} tags.\".format(\n                len(arg_0.tag_times_dict))\n            )", "path": "pygcgen/generator.py", "identifier": "Generator.fetch_tags_dates", "docstring": "Async fetching of all tags dates.", "docstring_tokens": ["Async", "fetching", "of", "all", "tags", "dates", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 257396}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/treemix.py#L305-L347", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Returns a treemix plot on a toyplot.axes object.", "language": "python", "parameters": "(self, axes)", "return_statement": "return axes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "toytree", ".", "tree", "(", "newick", "=", "arg_0", ".", "results", ".", "tree", ")", "arg_2", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "use_edge_lengths", "=", "True", ",", "tree_style", "=", "'c'", ",", "tip_labels_align", "=", "True", ",", "edge_align_style", "=", "{", "\"stroke-width\"", ":", "1", "}", ")", "for", "arg_3", "in", "arg_0", ".", "results", ".", "admixture", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_3", "arg_9", "=", "_get_admix_point", "(", "arg_2", ",", "arg_4", ",", "arg_5", ")", "arg_10", "=", "_get_admix_point", "(", "arg_2", ",", "arg_6", ",", "arg_7", ")", "arg_11", "=", "arg_1", ".", "plot", "(", "arg_9", "=", "(", "arg_9", "[", "0", "]", ",", "arg_10", "[", "0", "]", ")", ",", "arg_10", "=", "(", "arg_9", "[", "1", "]", ",", "arg_10", "[", "1", "]", ")", ",", "style", "=", "{", "\"stroke-width\"", ":", "10", "*", "arg_8", ",", "\"stroke-opacity\"", ":", "0.95", ",", "\"stroke-linecap\"", ":", "\"round\"", "}", ")", "arg_1", ".", "scatterplot", "(", "arg_9", "=", "(", "arg_10", "[", "0", "]", ")", ",", "arg_10", "=", "(", "arg_10", "[", "1", "]", ")", ",", "size", "=", "8", ",", "title", "=", "\"weight: {}\"", ".", "format", "(", "arg_8", ")", ",", ")", "arg_1", ".", "y", ".", "show", "=", "False", "arg_1", ".", "x", ".", "ticks", ".", "show", "=", "True", "arg_1", ".", "x", ".", "label", ".", "text", "=", "\"Drift parameter\"", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns a treemix plot on a toyplot.axes object. \n        \"\"\"            \n        ## create a toytree object from the treemix tree result\n        arg_2 = toytree.tree(newick=arg_0.results.tree)\n        arg_2.Func(\n            arg_1=arg_1,\n            use_edge_lengths=True,\n            tree_style='c',\n            tip_labels_align=True,\n            edge_align_style={\"stroke-width\": 1}\n        );\n\n        ## get coords \n        for arg_3 in arg_0.results.admixture:\n            ## parse admix event\n            arg_4, arg_5, arg_6, arg_7, arg_8 = arg_3\n            arg_9 = _get_admix_point(arg_2, arg_4, arg_5)\n            arg_10 = _get_admix_point(arg_2, arg_6, arg_7)\n\n            ## add line for admixture edge\n            arg_11 = arg_1.plot(\n                arg_9 = (arg_9[0], arg_10[0]),\n                arg_10 = (arg_9[1], arg_10[1]),\n                style={\"stroke-width\": 10*arg_8,\n                       \"stroke-opacity\": 0.95, \n                       \"stroke-linecap\": \"round\"}\n            )\n\n            ## add points at admixture sink\n            arg_1.scatterplot(\n                arg_9 = (arg_10[0]),\n                arg_10 = (arg_10[1]),\n                size=8,\n                title=\"weight: {}\".format(arg_8),\n            )\n\n        ## add scale bar for edge lengths\n        arg_1.y.show=False\n        arg_1.x.ticks.show=True\n        arg_1.x.label.text = \"Drift parameter\"\n        return arg_1", "path": "ipyrad/analysis/treemix.py", "identifier": "Treemix.draw", "docstring": "Returns a treemix plot on a toyplot.axes object.", "docstring_tokens": ["Returns", "a", "treemix", "plot", "on", "a", "toyplot", ".", "axes", "object", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 257397}
{"url": "https://github.com/loanzen/probe-py/blob/b5dbb0dba26c9b451e9bf1dec9e1aaa7f42d75a5/probe/models/company_detail_company.py#L182-L196", "sha": "b5dbb0dba26c9b451e9bf1dec9e1aaa7f42d75a5", "docstring_summary": "Sets the classification of this CompanyDetailCompany.\n        Classification of Company", "language": "python", "parameters": "(self, classification)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_2", "=", "[", "\"Public Limited Indian Non-Government Company\"", ",", "\"Private Limited Indian Non-Government Company\"", ",", "\"One Person Company\"", ",", "\"Private Limited Foreign Company Incorporated in India\"", ",", "\"Public Limited Foreign Company Incorporated in India\"", ",", "\"Union Government Company\"", ",", "\"State Government Company\"", ",", "\"Guarantee & Association Public\"", ",", "\"Guarantee & Association Private\"", ",", "\"Not For Profit Company\"", ",", "\"Unlimited Liabilities Public\"", ",", "\"Unlimited Liabilities Private\"", ",", "\"Undefined\"", "]", "if", "Func", "not", "in", "arg_2", ":", "raise", "ValueError", "(", "\"Invalid value for `classification`, must be one of {0}\"", ".", "format", "(", "arg_2", ")", ")", "arg_0", ".", "_classification", "=", "Func"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Sets the classification of this CompanyDetailCompany.\n        Classification of Company\n\n        :param classification: The classification of this CompanyDetailCompany.\n        :type: str\n        \"\"\"\n        arg_2 = [\"Public Limited Indian Non-Government Company\", \"Private Limited Indian Non-Government Company\", \"One Person Company\", \"Private Limited Foreign Company Incorporated in India\", \"Public Limited Foreign Company Incorporated in India\", \"Union Government Company\", \"State Government Company\", \"Guarantee & Association Public\", \"Guarantee & Association Private\", \"Not For Profit Company\", \"Unlimited Liabilities Public\", \"Unlimited Liabilities Private\", \"Undefined\"]\n        if Func not in arg_2:\n            raise ValueError(\n                \"Invalid value for `classification`, must be one of {0}\"\n                .format(arg_2)\n            )\n        arg_0._classification = Func", "path": "probe/models/company_detail_company.py", "identifier": "CompanyDetailCompany.classification", "docstring": "Sets the classification of this CompanyDetailCompany.\n        Classification of Company\n\n        :param classification: The classification of this CompanyDetailCompany.\n        :type: str", "docstring_tokens": ["Sets", "the", "classification", "of", "this", "CompanyDetailCompany", ".", "Classification", "of", "Company"], "nwo": "loanzen/probe-py", "score": 0.14991498758945482, "idx": 257398}
{"url": "https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L157-L170", "sha": "532e685c504ea96f9e42833594585159ac1d2068", "docstring_summary": "Decorator to add route for a request with any HTTP method.", "language": "python", "parameters": "(self, method, pattern)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "decorator", "(", "arg_3", ")", ":", "arg_0", ".", "_Funcr", ".", "add", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_3", "return", "decorator"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Decorator to add Func for a request with any HTTP method.\n\n        Arguments:\n          method (str): HTTP method name, e.g. GET, POST, etc.\n          pattern (str): Routing pattern the path must match.\n\n        Returns:\n          function: Decorator function to add Func.\n        \"\"\"\n        def decorator(arg_3):\n            arg_0._Funcr.add(arg_1, arg_2, arg_3)\n            return arg_3\n        return decorator", "path": "ice.py", "identifier": "Ice.route", "docstring": "Decorator to add route for a request with any HTTP method.\n\n        Arguments:\n          method (str): HTTP method name, e.g. GET, POST, etc.\n          pattern (str): Routing pattern the path must match.\n\n        Returns:\n          function: Decorator function to add route.", "docstring_tokens": ["Decorator", "to", "add", "route", "for", "a", "request", "with", "any", "HTTP", "method", "."], "nwo": "susam/ice", "score": 0.16638194949711382, "idx": 257399}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/astrokep.py#L1190-L1229", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is the EPD function to fit.", "language": "python", "parameters": "(coeffs, fluxes, xcc, ycc, bgv, bge)", "return_statement": "return epdf", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "(", "arg_0", "[", "0", "]", "+", "arg_0", "[", "1", "]", "*", "npsin", "(", "2", "*", "MPI", "*", "arg_2", ")", "+", "arg_0", "[", "2", "]", "*", "npcos", "(", "2", "*", "MPI", "*", "arg_2", ")", "+", "arg_0", "[", "3", "]", "*", "npsin", "(", "2", "*", "MPI", "*", "arg_3", ")", "+", "arg_0", "[", "4", "]", "*", "npcos", "(", "2", "*", "MPI", "*", "arg_3", ")", "+", "arg_0", "[", "5", "]", "*", "npsin", "(", "4", "*", "MPI", "*", "arg_2", ")", "+", "arg_0", "[", "6", "]", "*", "npcos", "(", "4", "*", "MPI", "*", "arg_2", ")", "+", "arg_0", "[", "7", "]", "*", "npsin", "(", "4", "*", "MPI", "*", "arg_3", ")", "+", "arg_0", "[", "8", "]", "*", "npcos", "(", "4", "*", "MPI", "*", "arg_3", ")", "+", "arg_0", "[", "9", "]", "*", "arg_4", "+", "arg_0", "[", "10", "]", "*", "arg_5", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    '''This is the EPD function to fit.\n\n    Parameters\n    ----------\n\n    coeffs : array-like of floats\n        Contains the EPD coefficients that will be used to generate the EPD fit\n        function.\n\n    fluxes : array-like\n        The flux measurement array being used.\n\n    xcc,ycc : array-like\n        Arrays of the x and y coordinates associated with each measurement in\n        `fluxes`.\n\n    bgv,bge : array-like\n        Arrays of the flux background value and the flux background error\n        associated with each measurement in `fluxes`.\n\n    Returns\n    -------\n\n    np.array\n        Contains the fit function evaluated at each flux measurement value.\n\n    '''\n\n    arg_6 = (\n        arg_0[0] +\n        arg_0[1]*npsin(2*MPI*arg_2) + arg_0[2]*npcos(2*MPI*arg_2) +\n        arg_0[3]*npsin(2*MPI*arg_3) + arg_0[4]*npcos(2*MPI*arg_3) +\n        arg_0[5]*npsin(4*MPI*arg_2) + arg_0[6]*npcos(4*MPI*arg_2) +\n        arg_0[7]*npsin(4*MPI*arg_3) + arg_0[8]*npcos(4*MPI*arg_3) +\n        arg_0[9]*arg_4 +\n        arg_0[10]*arg_5\n    )\n\n    return arg_6", "path": "astrobase/astrokep.py", "identifier": "_epd_function", "docstring": "This is the EPD function to fit.\n\n    Parameters\n    ----------\n\n    coeffs : array-like of floats\n        Contains the EPD coefficients that will be used to generate the EPD fit\n        function.\n\n    fluxes : array-like\n        The flux measurement array being used.\n\n    xcc,ycc : array-like\n        Arrays of the x and y coordinates associated with each measurement in\n        `fluxes`.\n\n    bgv,bge : array-like\n        Arrays of the flux background value and the flux background error\n        associated with each measurement in `fluxes`.\n\n    Returns\n    -------\n\n    np.array\n        Contains the fit function evaluated at each flux measurement value.", "docstring_tokens": ["This", "is", "the", "EPD", "function", "to", "fit", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257400}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L206-L208", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Callback for an option that adds to the `actions` list.", "language": "python", "parameters": "(self, option, opt_unused, value_unused, parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_4", ".", "values", ".", "actions", ".", "append", "(", "arg_1", ".", "action_code", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Callback for an option that adds to the `actions` list.\"\"\"\n        arg_4.values.actions.append(arg_1.action_code)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py", "identifier": "ClassicOptionParser._append_action", "docstring": "Callback for an option that adds to the `actions` list.", "docstring_tokens": ["Callback", "for", "an", "option", "that", "adds", "to", "the", "actions", "list", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 257401}
{"url": "https://github.com/shopkick/flawless/blob/c54b63ca1991c153e6f75080536f6df445aacc64/flawless/client/client.py#L173-L228", "sha": "c54b63ca1991c153e6f75080536f6df445aacc64", "docstring_summary": "Helper function to record errors to the flawless backend", "language": "python", "parameters": "(hostname, exc_info, preceding_stack=None, error_threshold=None, additional_info=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "[", "]", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_1", "while", "arg_8", "is", "not", "None", ":", "arg_5", ".", "append", "(", "arg_8", ")", "arg_8", "=", "arg_8", ".", "tb_next", "arg_9", "=", "[", "]", "for", "arg_10", "in", "arg_2", "or", "[", "]", ":", "arg_9", ".", "append", "(", "api_ttypes", ".", "StackLine", "(", "arg_13", "=", "os", ".", "path", ".", "abspath", "(", "arg_10", "[", "0", "]", ")", ",", "line_number", "=", "arg_10", "[", "1", "]", ",", "function_name", "=", "arg_10", "[", "2", "]", ",", "text", "=", "arg_10", "[", "3", "]", ")", ")", "for", "arg_11", ",", "arg_12", "in", "enumerate", "(", "arg_5", ")", ":", "arg_13", "=", "arg_12", ".", "tb_frame", ".", "f_code", ".", "co_filename", "arg_14", "=", "arg_12", ".", "tb_frame", ".", "f_code", ".", "co_name", "arg_15", "=", "arg_12", ".", "tb_lineno", "arg_16", "=", "linecache", ".", "getline", "(", "arg_13", ",", "arg_15", ",", "arg_12", ".", "tb_frame", ".", "f_globals", ")", "arg_17", "=", "None", "if", "arg_11", ">=", "(", "len", "(", "arg_5", ")", "-", "NUM_FRAMES_TO_SAVE", ")", ":", "arg_17", "=", "dict", "(", "(", "arg_18", ",", "_myrepr", "(", "arg_18", ",", "arg_19", ")", ")", "for", "arg_18", ",", "arg_19", "in", "list", "(", "arg_12", ".", "tb_frame", ".", "f_locals", ".", "items", "(", ")", ")", "[", ":", "MAX_LOCALS", "]", "if", "arg_18", "!=", "\"self\"", ")", "if", "\"self\"", "in", "arg_12", ".", "tb_frame", ".", "f_locals", "and", "hasattr", "(", "arg_12", ".", "tb_frame", ".", "f_locals", "[", "\"self\"", "]", ",", "\"__dict__\"", ")", ":", "arg_17", ".", "update", "(", "dict", "(", "(", "\"self.\"", "+", "arg_18", ",", "_myrepr", "(", "arg_18", ",", "arg_19", ")", ")", "for", "arg_18", ",", "arg_19", "in", "list", "(", "arg_12", ".", "tb_frame", ".", "f_locals", "[", "\"self\"", "]", ".", "__dict__", ".", "items", "(", ")", ")", "[", ":", "MAX_LOCALS", "]", "if", "arg_18", "!=", "\"self\"", ")", ")", "arg_9", ".", "append", "(", "api_ttypes", ".", "StackLine", "(", "arg_13", "=", "os", ".", "path", ".", "abspath", "(", "arg_13", ")", ",", "line_number", "=", "arg_15", ",", "function_name", "=", "arg_14", ",", "text", "=", "arg_16", ",", "arg_17", "=", "arg_17", ")", ")", "arg_20", "=", "CachedErrorInfo", ".", "get_hash_key", "(", "arg_9", ")", "arg_21", "=", "arg_22", ".", "get", "(", "arg_20", ")", "or", "CachedErrorInfo", "(", ")", "arg_21", ".", "increment", "(", ")", "arg_22", "[", "arg_20", "]", "=", "arg_21", "if", "arg_21", ".", "should_report", "(", ")", ":", "arg_23", "=", "arg_21", ".", "mark_reported", "(", ")", "_send_request", "(", "api_ttypes", ".", "RecordErrorRequest", "(", "traceback", "=", "arg_9", ",", "exception_message", "=", "repr", "(", "arg_7", ")", ",", "exception_type", "=", "arg_6", ".", "__module__", "+", "\".\"", "+", "arg_6", ".", "__name__", ",", "arg_0", "=", "arg_0", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_23", "=", "arg_23", ",", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n    ''' Helper function to record errors to the flawless backend '''\n    arg_5 = []\n    arg_6, arg_7, arg_8 = arg_1\n\n    while arg_8 is not None:\n        arg_5.append(arg_8)\n        arg_8 = arg_8.tb_next\n\n    arg_9 = []\n    for arg_10 in arg_2 or []:\n        arg_9.append(\n            api_ttypes.StackLine(arg_13=os.path.abspath(arg_10[0]), line_number=arg_10[1],\n                                 function_name=arg_10[2], text=arg_10[3])\n        )\n\n    for arg_11, arg_12 in enumerate(arg_5):\n        arg_13 = arg_12.tb_frame.f_code.co_filename\n        arg_14 = arg_12.tb_frame.f_code.co_name\n        arg_15 = arg_12.tb_lineno\n        arg_16 = linecache.getline(arg_13, arg_15, arg_12.tb_frame.f_globals)\n        arg_17 = None\n        if arg_11 >= (len(arg_5) - NUM_FRAMES_TO_SAVE):\n            # Include some limits on max string length & number of variables to keep things from getting\n            # out of hand\n            arg_17 = dict((arg_18, _myrepr(arg_18, arg_19)) for arg_18, arg_19 in\n                                list(arg_12.tb_frame.f_locals.items())[:MAX_LOCALS] if arg_18 != \"self\")\n            if \"self\" in arg_12.tb_frame.f_locals and hasattr(arg_12.tb_frame.f_locals[\"self\"], \"__dict__\"):\n                arg_17.update(dict((\"self.\" + arg_18, _myrepr(arg_18, arg_19)) for arg_18, arg_19 in\n                                         list(arg_12.tb_frame.f_locals[\"self\"].__dict__.items())[:MAX_LOCALS]\n                                         if arg_18 != \"self\"))\n\n        arg_9.append(\n            api_ttypes.StackLine(arg_13=os.path.abspath(arg_13), line_number=arg_15,\n                                 function_name=arg_14, text=arg_16, arg_17=arg_17)\n        )\n\n    # Check LRU cache & potentially do not send error report if this client has already reported this error\n    # several times.\n    arg_20 = CachedErrorInfo.get_hash_key(arg_9)\n    arg_21 = arg_22.get(arg_20) or CachedErrorInfo()\n    arg_21.increment()\n    arg_22[arg_20] = arg_21\n    if arg_21.should_report():\n        arg_23 = arg_21.mark_reported()\n        _send_request(\n            api_ttypes.RecordErrorRequest(\n                traceback=arg_9,\n                exception_message=repr(arg_7),\n                exception_type=arg_6.__module__ + \".\" + arg_6.__name__,\n                arg_0=arg_0,\n                arg_3=arg_3,\n                arg_4=arg_4,\n                arg_23=arg_23,\n            )\n        )", "path": "flawless/client/client.py", "identifier": "record_error", "docstring": "Helper function to record errors to the flawless backend", "docstring_tokens": ["Helper", "function", "to", "record", "errors", "to", "the", "flawless", "backend"], "nwo": "shopkick/flawless", "score": 0.37326674238089064, "idx": 257402}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/clinvar.py#L23-L77", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Extract the objects to be saved in the clinvar database collection.\n       object_type param specifies if these objects are variant or casedata objects", "language": "python", "parameters": "(variant_ids, form_fields, object_type)", "return_statement": "return submission_objects", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "if", "arg_2", "==", "'variant'", ":", "arg_3", "=", "CLINVAR_HEADER", "else", ":", "arg_3", "=", "CASEDATA_HEADER", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ":", "arg_6", "=", "{", "}", "if", "arg_2", "==", "'casedata'", "and", "'casedata_'", "+", "arg_5", "not", "in", "arg_1", ":", "continue", "arg_6", "[", "'csv_type'", "]", "=", "arg_2", "arg_6", "[", "'case_id'", "]", "=", "arg_1", ".", "get", "(", "'case_id'", ")", "arg_6", "[", "'category'", "]", "=", "arg_1", ".", "get", "(", "'category@'", "+", "arg_5", ")", "for", "arg_7", ",", "arg_8", "in", "arg_3", ".", "items", "(", ")", ":", "arg_9", "=", "arg_1", ".", "get", "(", "arg_7", "+", "'@'", "+", "arg_5", ")", "if", "arg_9", "and", "not", "arg_9", "==", "'-'", ":", "if", "arg_7", "==", "'ref_seq'", ":", "arg_10", "=", "arg_9", ".", "split", "(", "'|'", ")", "arg_6", "[", "'ref_seq'", "]", "=", "arg_10", "[", "0", "]", "arg_6", "[", "'hgvs'", "]", "=", "arg_10", "[", "1", "]", "else", ":", "arg_6", "[", "arg_7", "]", "=", "arg_9", "if", "arg_2", "==", "'casedata'", ":", "arg_6", "[", "'_id'", "]", "=", "str", "(", "arg_6", "[", "'case_id'", "]", ")", "+", "'_'", "+", "arg_5", "+", "'_'", "+", "str", "(", "arg_6", "[", "'individual_id'", "]", ")", "else", ":", "arg_6", "[", "'_id'", "]", "=", "str", "(", "arg_6", "[", "'case_id'", "]", ")", "+", "'_'", "+", "arg_5", "arg_4", ".", "append", "(", "arg_6", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Extract the objects to be saved in the clinvar database collection.\n       object_type param specifies if these objects are variant or casedata objects\n\n       Args:\n        variant_ids(list): list of database variant ids\n        form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and CASEDATA_HEADER\n        object_type(str): either 'variant' or 'case_data'\n\n       Returns:\n        submission_objects(list): list of submission objects of either type 'variant' or 'casedata'\n    \"\"\"\n    arg_3 = []\n    if arg_2 == 'variant':\n        arg_3 = CLINVAR_HEADER\n    else: #collect casedata objects\n        arg_3 = CASEDATA_HEADER\n\n    # A list of objects (variants of casedata info) to be saved into clinvar database collection\n    arg_4 = []\n\n    # Loop over the form fields and collect the data:\n    for arg_5 in arg_0: # loop over the variants\n\n        arg_6 = {} # A new submission object for each\n\n        # Don't included casedata for a variant unless specified by user\n        if arg_2 == 'casedata' and 'casedata_'+arg_5 not in arg_1:\n            continue\n\n        arg_6['csv_type'] = arg_2\n        arg_6['case_id'] = arg_1.get('case_id')\n        arg_6['category'] = arg_1.get('category@'+arg_5)\n\n        for arg_7, arg_8 in arg_3.items(): # loop over the form info fields\n            arg_9 = arg_1.get(arg_7+'@'+arg_5)\n            if arg_9 and not arg_9 == '-':\n                if arg_7 == 'ref_seq': # split this field into\n                    arg_10 = arg_9.split('|')\n                    arg_6['ref_seq'] = arg_10[0]\n                    arg_6['hgvs'] = arg_10[1]\n                else:\n                    arg_6[arg_7] = arg_9\n\n        # Create a unique ID for the database\n        # For casedata : = caseID_sampleID_variantID\n        # For variants : ID = caseID_variantID\n        if arg_2 == 'casedata':\n            arg_6['_id'] = str(arg_6['case_id']) + '_' + arg_5 + '_' + str(arg_6['individual_id'])\n        else:\n            arg_6['_id'] = str(arg_6['case_id']) + '_' + arg_5\n\n        arg_4.append(arg_6)\n\n    return arg_4", "path": "scout/parse/clinvar.py", "identifier": "get_objects_from_form", "docstring": "Extract the objects to be saved in the clinvar database collection.\n       object_type param specifies if these objects are variant or casedata objects\n\n       Args:\n        variant_ids(list): list of database variant ids\n        form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and CASEDATA_HEADER\n        object_type(str): either 'variant' or 'case_data'\n\n       Returns:\n        submission_objects(list): list of submission objects of either type 'variant' or 'casedata'", "docstring_tokens": ["Extract", "the", "objects", "to", "be", "saved", "in", "the", "clinvar", "database", "collection", ".", "object_type", "param", "specifies", "if", "these", "objects", "are", "variant", "or", "casedata", "objects"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257403}
{"url": "https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L278-L318", "sha": "cd5c6e10c6c4e653669e11d735d5773766986bda", "docstring_summary": "Call the disambiguation service in order to disambiguate a search query.", "language": "python", "parameters": "(self, query, language=None, entities=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "\"shortText\"", ":", "arg_1", ",", "\"entities\"", ":", "[", "]", ",", "\"onlyNER\"", ":", "\"false\"", ",", "\"customisation\"", ":", "\"generic\"", "}", "if", "arg_2", ":", "arg_4", "[", "'language'", "]", "=", "{", "\"lang\"", ":", "arg_2", "}", "if", "arg_3", ":", "arg_4", "[", "'entities'", "]", "=", "arg_3", "arg_5", "=", "{", "'query'", ":", "str", "(", "arg_4", ")", "}", "logger", ".", "debug", "(", "'About to submit the following query {}'", ".", "format", "(", "arg_4", ")", ")", "arg_6", ",", "arg_7", "=", "arg_0", ".", "post", "(", "arg_0", ".", "disambiguate_service", ",", "arg_5", "=", "arg_5", ",", "headers", "=", "{", "'Accept'", ":", "'application/json'", "}", ",", ")", "if", "arg_7", "==", "200", ":", "return", "arg_0", ".", "decode", "(", "arg_6", ")", ",", "arg_7", "else", ":", "logger", ".", "debug", "(", "'Disambiguation failed.'", ")", "return", "None", ",", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\" Call the disambiguation service in order to disambiguate a search query.\n\n        Args:\n            text (str): Query to be disambiguated.\n            language (str): language of text (if known)\n            entities (list): list of entities or mentions to be supplied by\n                the user.\n\n        Returns:\n            dict, int: API response and API status.\n        \"\"\"\n\n        arg_4 = {\n            \"shortText\": arg_1,\n            \"entities\": [],\n            \"onlyNER\": \"false\",\n            \"customisation\": \"generic\"\n        }\n\n        if arg_2:\n            arg_4['language'] = {\"lang\": arg_2}\n\n        if arg_3:\n            arg_4['entities'] = arg_3\n\n        arg_5 = {'query': str(arg_4)}\n\n        logger.debug('About to submit the following query {}'.format(arg_4))\n\n        arg_6, arg_7 = arg_0.post(\n            arg_0.disambiguate_service,\n            arg_5=arg_5,\n            headers={'Accept': 'application/json'},\n        )\n\n        if arg_7 == 200:\n            return arg_0.decode(arg_6), arg_7\n        else:\n            logger.debug('Disambiguation failed.')\n            return None, arg_7", "path": "nerd/nerd_client.py", "identifier": "NerdClient.disambiguate_query", "docstring": "Call the disambiguation service in order to disambiguate a search query.\n\n        Args:\n            text (str): Query to be disambiguated.\n            language (str): language of text (if known)\n            entities (list): list of entities or mentions to be supplied by\n                the user.\n\n        Returns:\n            dict, int: API response and API status.", "docstring_tokens": ["Call", "the", "disambiguation", "service", "in", "order", "to", "disambiguate", "a", "search", "query", "."], "nwo": "hirmeos/entity-fishing-client-python", "score": 0.36576314591848075, "idx": 257404}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/packager.py#L358-L386", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Installs system packages listed as required by services this host uses.", "language": "python", "parameters": "(self, type=None, service=None, list_only=0, **kwargs)", "return_statement": "return lst", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "local_renderer", "arg_3", "=", "int", "(", "arg_3", ")", "arg_1", "=", "(", "arg_1", "or", "''", ")", ".", "lower", "(", ")", ".", "strip", "(", ")", "assert", "not", "arg_1", "or", "arg_1", "in", "PACKAGE_TYPES", ",", "'Unknown package type: %s'", "%", "(", "arg_1", ",", ")", "arg_6", "=", "[", "]", "if", "arg_1", ":", "arg_7", "=", "[", "arg_1", "]", "else", ":", "arg_7", "=", "PACKAGE_TYPES", "for", "arg_8", "in", "arg_7", ":", "if", "arg_8", "==", "SYSTEM", ":", "arg_9", "=", "'\\n'", ".", "join", "(", "arg_0", ".", "list_required", "(", "arg_1", "=", "arg_8", ",", "arg_2", "=", "arg_2", ")", ")", "if", "arg_3", ":", "arg_6", ".", "extend", "(", "arg_10", "for", "arg_10", "in", "arg_9", ".", "split", "(", "'\\n'", ")", "if", "arg_10", ".", "strip", "(", ")", ")", "if", "arg_0", ".", "verbose", ":", "print", "(", "'content:'", ",", "arg_9", ")", "break", "arg_11", ",", "arg_12", "=", "tempfile", ".", "mkstemp", "(", ")", "arg_13", "=", "open", "(", "arg_12", ",", "'w'", ")", "arg_13", ".", "write", "(", "arg_9", ")", "arg_13", ".", "close", "(", ")", "arg_0", ".", "install_custom", "(", "arg_12", "=", "arg_12", ")", "else", ":", "raise", "NotImplementedError", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=0, **arg_4): # pylint: disable=redefined-builtin\n        \"\"\"\n        Installs system packages listed as required by services this host uses.\n        \"\"\"\n        arg_5 = arg_0.local_renderer\n        arg_3 = int(arg_3)\n        arg_1 = (arg_1 or '').lower().strip()\n        assert not arg_1 or arg_1 in PACKAGE_TYPES, 'Unknown package type: %s' % (arg_1,)\n        arg_6 = []\n        if arg_1:\n            arg_7 = [arg_1]\n        else:\n            arg_7 = PACKAGE_TYPES\n        for arg_8 in arg_7:\n            if arg_8 == SYSTEM:\n                arg_9 = '\\n'.join(arg_0.list_required(arg_1=arg_8, arg_2=arg_2))\n                if arg_3:\n                    arg_6.extend(arg_10 for arg_10 in arg_9.split('\\n') if arg_10.strip())\n                    if arg_0.verbose:\n                        print('content:', arg_9)\n                    break\n                arg_11, arg_12 = tempfile.mkstemp()\n                arg_13 = open(arg_12, 'w')\n                arg_13.write(arg_9)\n                arg_13.close()\n                arg_0.install_custom(arg_12=arg_12)\n            else:\n                raise NotImplementedError\n        return arg_6", "path": "burlap/packager.py", "identifier": "PackagerSatchel.install_required", "docstring": "Installs system packages listed as required by services this host uses.", "docstring_tokens": ["Installs", "system", "packages", "listed", "as", "required", "by", "services", "this", "host", "uses", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 257405}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5426-L5476", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks for a C-style cast by looking for the pattern.", "language": "python", "parameters": "(filename, clean_lines, linenum, cast_type, pattern, error)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "arg_1", ".", "elided", "[", "arg_2", "]", "arg_7", "=", "Search", "(", "arg_4", ",", "arg_6", ")", "if", "not", "arg_7", ":", "return", "False", "arg_8", "=", "arg_6", "[", "0", ":", "arg_7", ".", "start", "(", "1", ")", "-", "1", "]", "if", "Match", "(", "r'.*\\b(?:sizeof|alignof|alignas|[_A-Z][_A-Z0-9]*)\\s*$'", ",", "arg_8", ")", ":", "return", "False", "if", "arg_2", ">", "0", ":", "for", "arg_9", "in", "xrange", "(", "arg_2", "-", "1", ",", "max", "(", "0", ",", "arg_2", "-", "5", ")", ",", "-", "1", ")", ":", "arg_8", "=", "arg_1", ".", "elided", "[", "arg_9", "]", "+", "arg_8", "if", "Match", "(", "r'.*\\b[_A-Z][_A-Z0-9]*\\s*\\((?:\\([^()]*\\)|[^()])*$'", ",", "arg_8", ")", ":", "return", "False", "if", "arg_8", ".", "endswith", "(", "' operator++'", ")", "or", "arg_8", ".", "endswith", "(", "' operator--'", ")", ":", "return", "False", "arg_10", "=", "arg_6", "[", "arg_7", ".", "end", "(", "0", ")", ":", "]", "if", "Match", "(", "r'^\\s*(?:;|const\\b|throw\\b|final\\b|override\\b|[=>{),]|->)'", ",", "arg_10", ")", ":", "return", "False", "arg_5", "(", "arg_0", ",", "arg_2", ",", "'readability/casting'", ",", "4", ",", "'Using C-style cast.  Use %s<%s>(...) instead'", "%", "(", "arg_3", ",", "arg_7", ".", "group", "(", "1", ")", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n  \"\"\"Checks for a C-style cast by looking for the pattern.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    cast_type: The string for the C++ cast to recommend.  This is either\n      reinterpret_cast, static_cast, or const_cast, depending.\n    pattern: The regular expression used to find C-style casts.\n    error: The function to call with any errors found.\n\n  Returns:\n    True if an error was emitted.\n    False otherwise.\n  \"\"\"\n  arg_6 = arg_1.elided[arg_2]\n  arg_7 = Search(arg_4, arg_6)\n  if not arg_7:\n    return False\n\n  # Exclude lines with keywords that tend to look like casts\n  arg_8 = arg_6[0:arg_7.start(1) - 1]\n  if Match(r'.*\\b(?:sizeof|alignof|alignas|[_A-Z][_A-Z0-9]*)\\s*$', arg_8):\n    return False\n\n  # Try expanding current context to see if we one level of\n  # parentheses inside a macro.\n  if arg_2 > 0:\n    for arg_9 in xrange(arg_2 - 1, max(0, arg_2 - 5), -1):\n      arg_8 = arg_1.elided[arg_9] + arg_8\n  if Match(r'.*\\b[_A-Z][_A-Z0-9]*\\s*\\((?:\\([^()]*\\)|[^()])*$', arg_8):\n    return False\n\n  # operator++(int) and operator--(int)\n  if arg_8.endswith(' operator++') or arg_8.endswith(' operator--'):\n    return False\n\n  # A single unnamed argument for a function tends to look like old style cast.\n  # If we see those, don't issue warnings for deprecated casts.\n  arg_10 = arg_6[arg_7.end(0):]\n  if Match(r'^\\s*(?:;|const\\b|throw\\b|final\\b|override\\b|[=>{),]|->)',\n           arg_10):\n    return False\n\n  # At this point, all that should be left is actual casts.\n  arg_5(arg_0, arg_2, 'readability/casting', 4,\n        'Using C-style cast.  Use %s<%s>(...) instead' %\n        (arg_3, arg_7.group(1)))\n\n  return True", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckCStyleCast", "docstring": "Checks for a C-style cast by looking for the pattern.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    cast_type: The string for the C++ cast to recommend.  This is either\n      reinterpret_cast, static_cast, or const_cast, depending.\n    pattern: The regular expression used to find C-style casts.\n    error: The function to call with any errors found.\n\n  Returns:\n    True if an error was emitted.\n    False otherwise.", "docstring_tokens": ["Checks", "for", "a", "C", "-", "style", "cast", "by", "looking", "for", "the", "pattern", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257406}
{"url": "https://github.com/eecs-autograder/autograder-sandbox/blob/230e806e3740e2aaf5f5568dd6a265558f165c63/autograder_sandbox/autograder_sandbox.py#L347-L356", "sha": "230e806e3740e2aaf5f5568dd6a265558f165c63", "docstring_summary": "Copies the specified file into the working directory of this\n        sandbox and renames it to new_filename.", "language": "python", "parameters": "(self, filename: str, new_filename: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ")", "->", "None", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "name", "+", "':'", "+", "SANDBOX_WORKING_DIR_NAME", ",", "arg_3", ")", "subprocess", ".", "check_call", "(", "[", "'docker'", ",", "'cp'", ",", "arg_1", ",", "arg_4", "]", ")", "arg_0", ".", "_chown_files", "(", "[", "arg_3", "]", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2) -> None:\n        \"\"\"\n        Copies the specified file into the working directory of this\n        sandbox and renames it to new_filename.\n        \"\"\"\n        arg_4 = os.path.join(\n            arg_0.name + ':' + SANDBOX_WORKING_DIR_NAME,\n            arg_3)\n        subprocess.check_call(['docker', 'cp', arg_1, arg_4])\n        arg_0._chown_files([arg_3])", "path": "autograder_sandbox/autograder_sandbox.py", "identifier": "AutograderSandbox.add_and_rename_file", "docstring": "Copies the specified file into the working directory of this\n        sandbox and renames it to new_filename.", "docstring_tokens": ["Copies", "the", "specified", "file", "into", "the", "working", "directory", "of", "this", "sandbox", "and", "renames", "it", "to", "new_filename", "."], "nwo": "eecs-autograder/autograder-sandbox", "score": 0.3723258035444451, "idx": 257407}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/text.py#L213-L217", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Encodes text, using a code which is a permutation of the alphabet.", "language": "python", "parameters": "(plaintext, code)", "return_statement": "return plaintext.translate(trans)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "string", "import", "maketrans", "arg_2", "=", "maketrans", "(", "alphabet", "+", "alphabet", ".", "upper", "(", ")", ",", "arg_1", "+", "arg_1", ".", "upper", "(", ")", ")", "return", "arg_0", ".", "translate", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"Encodes text, using a code which is a permutation of the alphabet.\"\n    from string import maketrans\n    arg_2 = maketrans(alphabet + alphabet.upper(), arg_1 + arg_1.upper())\n    return arg_0.translate(arg_2)", "path": "aima/text.py", "identifier": "encode", "docstring": "Encodes text, using a code which is a permutation of the alphabet.", "docstring_tokens": ["Encodes", "text", "using", "a", "code", "which", "is", "a", "permutation", "of", "the", "alphabet", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 257408}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L137-L151", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Read a file from Azure Blob Storage and return as a string.", "language": "python", "parameters": "(self, container_name, blob_name, **kwargs)", "return_statement": "return self.connection.get_blob_to_text(container_name,\n                                                blob_name,\n                                                **kwargs).content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "connection", ".", "get_blob_to_text", "(", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ".", "content"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"\n        Read a file from Azure Blob Storage and return as a string.\n\n        :param container_name: Name of the container.\n        :type container_name: str\n        :param blob_name: Name of the blob.\n        :type blob_name: str\n        :param kwargs: Optional keyword arguments that\n            `BlockBlobService.create_blob_from_path()` takes.\n        :type kwargs: object\n        \"\"\"\n        return arg_0.connection.get_blob_to_text(arg_1,\n                                                arg_2,\n                                                **arg_3).content", "path": "airflow/contrib/hooks/wasb_hook.py", "identifier": "WasbHook.read_file", "docstring": "Read a file from Azure Blob Storage and return as a string.\n\n        :param container_name: Name of the container.\n        :type container_name: str\n        :param blob_name: Name of the blob.\n        :type blob_name: str\n        :param kwargs: Optional keyword arguments that\n            `BlockBlobService.create_blob_from_path()` takes.\n        :type kwargs: object", "docstring_tokens": ["Read", "a", "file", "from", "Azure", "Blob", "Storage", "and", "return", "as", "a", "string", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257409}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/effects.py#L390-L429", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Frame-wise non-silent indicator for audio input.", "language": "python", "parameters": "(y, frame_length=2048, hop_length=512, top_db=60,\n                               ref=np.max)", "return_statement": "return (core.power_to_db(mse.squeeze(),\n                             ref=ref,\n                             top_db=None) > - top_db)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2048", ",", "arg_2", "=", "512", ",", "arg_3", "=", "60", ",", "arg_4", "=", "arg_5", ".", "max", ")", ":", "arg_7", "=", "core", ".", "to_mono", "(", "arg_0", ")", "arg_8", "=", "feature", ".", "rms", "(", "arg_0", "=", "arg_7", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "**", "2", "return", "(", "core", ".", "power_to_db", "(", "arg_8", ".", "squeeze", "(", ")", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "None", ")", ">", "-", "arg_3", ")"], "function": "def Func(arg_0, arg_1=2048, arg_2=512, arg_3=60,\n                               arg_4=arg_5.max):\n    '''Frame-wise non-silent indicator for audio input.\n\n    This is a helper function for `trim` and `split`.\n\n    Parameters\n    ----------\n    y : np.ndarray, shape=(n,) or (2,n)\n        Audio signal, mono or stereo\n\n    frame_length : int > 0\n        The number of samples per frame\n\n    hop_length : int > 0\n        The number of samples between frames\n\n    top_db : number > 0\n        The threshold (in decibels) below reference to consider as\n        silence\n\n    ref : callable or float\n        The reference power\n\n    Returns\n    -------\n    non_silent : np.ndarray, shape=(m,), dtype=bool\n        Indicator of non-silent frames\n    '''\n    # Convert to mono\n    arg_7 = core.to_mono(arg_0)\n\n    # Compute the MSE for the signal\n    arg_8 = feature.rms(arg_0=arg_7,\n                      arg_1=arg_1,\n                      arg_2=arg_2)**2\n\n    return (core.power_to_db(arg_8.squeeze(),\n                             arg_4=arg_4,\n                             arg_3=None) > - arg_3)", "path": "librosa/effects.py", "identifier": "_signal_to_frame_nonsilent", "docstring": "Frame-wise non-silent indicator for audio input.\n\n    This is a helper function for `trim` and `split`.\n\n    Parameters\n    ----------\n    y : np.ndarray, shape=(n,) or (2,n)\n        Audio signal, mono or stereo\n\n    frame_length : int > 0\n        The number of samples per frame\n\n    hop_length : int > 0\n        The number of samples between frames\n\n    top_db : number > 0\n        The threshold (in decibels) below reference to consider as\n        silence\n\n    ref : callable or float\n        The reference power\n\n    Returns\n    -------\n    non_silent : np.ndarray, shape=(m,), dtype=bool\n        Indicator of non-silent frames", "docstring_tokens": ["Frame", "-", "wise", "non", "-", "silent", "indicator", "for", "audio", "input", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 257410}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/convert.py#L44-L71", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Guess the appropriate data type from file extension.", "language": "python", "parameters": "(ext)", "return_statement": "return formats[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "strip", "(", "'.'", ")", "arg_1", "=", "[", "]", "for", "arg_2", "in", "FILE_FORMATS", ":", "if", "arg_0", "in", "FILE_FORMATS", "[", "arg_2", "]", ":", "arg_1", ".", "append", "(", "arg_2", ")", "if", "arg_1", "==", "[", "]", "or", "len", "(", "arg_1", ")", ">", "1", ":", "return", "False", "return", "arg_1", "[", "0", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Guess the appropriate data type from file extension.\n\n    Arguments:\n        ext:        The file extension (period optional)\n\n    Returns:\n        String. The format (without leading period),\n                or False if none was found or couldn't be guessed\n    \"\"\"\n    arg_0 = arg_0.strip('.')\n\n    # We look through FILE_FORMATS for this extension.\n    # - If it appears zero times, return False. We can't guess.\n    # - If it appears once, we can simply return that format.\n    # - If it appears more than once, we can't guess (it's ambiguous,\n    #   e.g .m = RAMON or MATLAB)\n\n    arg_1 = []\n    for arg_2 in FILE_FORMATS:\n        if arg_0 in FILE_FORMATS[arg_2]:\n            arg_1.append(arg_2)\n\n    if arg_1 == [] or len(arg_1) > 1:\n        return False\n\n    return arg_1[0]", "path": "ndio/convert/convert.py", "identifier": "_guess_format_from_extension", "docstring": "Guess the appropriate data type from file extension.\n\n    Arguments:\n        ext:        The file extension (period optional)\n\n    Returns:\n        String. The format (without leading period),\n                or False if none was found or couldn't be guessed", "docstring_tokens": ["Guess", "the", "appropriate", "data", "type", "from", "file", "extension", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 257411}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4271-L4286", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "For performance reasons, a lasso selection is handled differently.", "language": "python", "parameters": "(self, expression_x, expression_y, xsequence, ysequence, mode=\"replace\", name=\"default\", executor=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "\"replace\"", ",", "arg_6", "=", "\"default\"", ",", "arg_7", "=", "None", ")", ":", "def", "create", "(", "arg_8", ")", ":", "return", "selections", ".", "SelectionLasso", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_8", ",", "arg_5", ")", "arg_0", ".", "_selection", "(", "create", ",", "arg_6", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=\"replace\", arg_6=\"default\", arg_7=None):\n        \"\"\"For performance reasons, a lasso selection is handled differently.\n\n        :param str expression_x: Name/expression for the x coordinate\n        :param str expression_y: Name/expression for the y coordinate\n        :param xsequence: list of x numbers defining the lasso, together with y\n        :param ysequence:\n        :param str mode: Possible boolean operator: replace/and/or/xor/subtract\n        :param str name:\n        :param executor:\n        :return:\n        \"\"\"\n\n        def create(arg_8):\n            return selections.SelectionLasso(arg_1, arg_2, arg_3, arg_4, arg_8, arg_5)\n        arg_0._selection(create, arg_6, arg_7=arg_7)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.select_lasso", "docstring": "For performance reasons, a lasso selection is handled differently.\n\n        :param str expression_x: Name/expression for the x coordinate\n        :param str expression_y: Name/expression for the y coordinate\n        :param xsequence: list of x numbers defining the lasso, together with y\n        :param ysequence:\n        :param str mode: Possible boolean operator: replace/and/or/xor/subtract\n        :param str name:\n        :param executor:\n        :return:", "docstring_tokens": ["For", "performance", "reasons", "a", "lasso", "selection", "is", "handled", "differently", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257412}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/transport.py#L492-L515", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Send stream tail via the transport.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "lock", ":", "if", "not", "arg_0", ".", "_socket", "or", "arg_0", ".", "_hup", ":", "logger", ".", "debug", "(", "u\"Cannot send stream closing tag: already closed\"", ")", "return", "arg_1", "=", "arg_0", ".", "_serializer", ".", "emit_tail", "(", ")", "try", ":", "arg_0", ".", "_write", "(", "arg_1", ".", "encode", "(", "\"utf-8\"", ")", ")", "except", "(", "IOError", ",", "SystemError", ",", "socket", ".", "error", ")", ",", "err", ":", "logger", ".", "debug", "(", "u\"Sending stream closing tag failed: {0}\"", ".", "format", "(", "err", ")", ")", "arg_0", ".", "_serializer", "=", "None", "arg_0", ".", "_hup", "=", "True", "if", "arg_0", ".", "_tls_state", "is", "None", ":", "try", ":", "arg_0", ".", "_socket", ".", "shutdown", "(", "socket", ".", "SHUT_WR", ")", "except", "socket", ".", "error", ":", "pass", "arg_0", ".", "_set_state", "(", "\"closing\"", ")", "arg_0", ".", "_write_queue", ".", "clear", "(", ")", "arg_0", ".", "_write_queue_cond", ".", "notify", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Send stream tail via the transport.\n        \"\"\"\n        with arg_0.lock:\n            if not arg_0._socket or arg_0._hup:\n                logger.debug(u\"Cannot send stream closing tag: already closed\")\n                return\n            arg_1 = arg_0._serializer.emit_tail()\n            try:\n                arg_0._write(arg_1.encode(\"utf-8\"))\n            except (IOError, SystemError, socket.error), err:\n                logger.debug(u\"Sending stream closing tag failed: {0}\"\n                                                                .format(err))\n            arg_0._serializer = None\n            arg_0._hup = True\n            if arg_0._tls_state is None:\n                try:\n                    arg_0._socket.shutdown(socket.SHUT_WR)\n                except socket.error:\n                    pass\n            arg_0._set_state(\"closing\")\n            arg_0._write_queue.clear()\n            arg_0._write_queue_cond.notify()", "path": "pyxmpp2/transport.py", "identifier": "TCPTransport.send_stream_tail", "docstring": "Send stream tail via the transport.", "docstring_tokens": ["Send", "stream", "tail", "via", "the", "transport", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257413}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L106-L111", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "A rule that accepts a token of kind ``kind`` and returns it, or returns None.", "language": "python", "parameters": "(kind, loc=None)", "return_statement": "return rule", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "@", "llrule", "(", "arg_1", ",", "lambda", "arg_2", ":", "[", "arg_0", "]", ")", "def", "rule", "(", "arg_2", ")", ":", "return", "arg_2", ".", "_accept", "(", "arg_0", ")", "return", "rule"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"A rule that accepts a token of kind ``kind`` and returns it, or returns None.\"\"\"\n    @llrule(arg_1, lambda arg_2: [arg_0])\n    def rule(arg_2):\n        return arg_2._accept(arg_0)\n    return rule", "path": "third_party/pythonparser/parser.py", "identifier": "Tok", "docstring": "A rule that accepts a token of kind ``kind`` and returns it, or returns None.", "docstring_tokens": ["A", "rule", "that", "accepts", "a", "token", "of", "kind", "kind", "and", "returns", "it", "or", "returns", "None", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257414}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/mapping/noise_adaptive_layout.py#L168-L184", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Select best remaining CNOT in the hardware for the next program edge.", "language": "python", "parameters": "(self)", "return_statement": "return best_item", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "gate_list", ":", "arg_3", "=", "arg_2", "[", "0", "]", "in", "arg_0", ".", "available_hw_qubits", "arg_4", "=", "arg_2", "[", "1", "]", "in", "arg_0", ".", "available_hw_qubits", "if", "arg_3", "and", "arg_4", ":", "arg_1", ".", "append", "(", "arg_2", ")", "arg_5", "=", "0", "arg_6", "=", "None", "for", "arg_7", "in", "arg_1", ":", "if", "arg_0", ".", "gate_cost", "[", "arg_7", "]", ">", "arg_5", ":", "arg_5", "=", "arg_0", ".", "gate_cost", "[", "arg_7", "]", "arg_6", "=", "arg_7", "return", "arg_6"], "function": "def Func(arg_0):\n        \"\"\"\n        Select best remaining CNOT in the hardware for the next program edge.\n        \"\"\"\n        arg_1 = []\n        for arg_2 in arg_0.gate_list:\n            arg_3 = arg_2[0] in arg_0.available_hw_qubits\n            arg_4 = arg_2[1] in arg_0.available_hw_qubits\n            if arg_3 and arg_4:\n                arg_1.append(arg_2)\n        arg_5 = 0\n        arg_6 = None\n        for arg_7 in arg_1:\n            if arg_0.gate_cost[arg_7] > arg_5:\n                arg_5 = arg_0.gate_cost[arg_7]\n                arg_6 = arg_7\n        return arg_6", "path": "qiskit/transpiler/passes/mapping/noise_adaptive_layout.py", "identifier": "NoiseAdaptiveLayout._select_best_remaining_cx", "docstring": "Select best remaining CNOT in the hardware for the next program edge.", "docstring_tokens": ["Select", "best", "remaining", "CNOT", "in", "the", "hardware", "for", "the", "next", "program", "edge", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257415}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5110-L5123", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Check if current line contains an out-of-line method definition.", "language": "python", "parameters": "(clean_lines, linenum)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "xrange", "(", "arg_1", ",", "max", "(", "-", "1", ",", "arg_1", "-", "10", ")", ",", "-", "1", ")", ":", "if", "Match", "(", "r'^([^()]*\\w+)\\('", ",", "arg_0", ".", "elided", "[", "arg_2", "]", ")", ":", "return", "Match", "(", "r'^[^()]*\\w+::\\w+\\('", ",", "arg_0", ".", "elided", "[", "arg_2", "]", ")", "is", "not", "None", "return", "False"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Check if current line contains an out-of-line method definition.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n  Returns:\n    True if current line contains an out-of-line method definition.\n  \"\"\"\n  # Scan back a few lines for start of current function\n  for arg_2 in xrange(arg_1, max(-1, arg_1 - 10), -1):\n    if Match(r'^([^()]*\\w+)\\(', arg_0.elided[arg_2]):\n      return Match(r'^[^()]*\\w+::\\w+\\(', arg_0.elided[arg_2]) is not None\n  return False", "path": "third_party/python/cpplint/cpplint.py", "identifier": "IsOutOfLineMethodDefinition", "docstring": "Check if current line contains an out-of-line method definition.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n  Returns:\n    True if current line contains an out-of-line method definition.", "docstring_tokens": ["Check", "if", "current", "line", "contains", "an", "out", "-", "of", "-", "line", "method", "definition", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257416}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/agents.py#L262-L273", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Add a thing to the environment, setting its location. For\n        convenience, if thing is an agent program we make a new agent\n        for it. (Shouldn't need to override this.", "language": "python", "parameters": "(self, thing, location=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "Thing", ")", ":", "arg_1", "=", "Agent", "(", "arg_1", ")", "assert", "arg_1", "not", "in", "arg_0", ".", "things", ",", "\"Don't add the same thing twice\"", "arg_1", ".", "location", "=", "arg_2", "or", "arg_0", ".", "default_location", "(", "arg_1", ")", "arg_0", ".", "things", ".", "append", "(", "arg_1", ")", "if", "isinstance", "(", "arg_1", ",", "Agent", ")", ":", "arg_1", ".", "performance", "=", "0", "arg_0", ".", "agents", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Add a thing to the environment, setting its location. For\n        convenience, if thing is an agent program we make a new agent\n        for it. (Shouldn't need to override this.\"\"\"\n        if not isinstance(arg_1, Thing):\n            arg_1 = Agent(arg_1)\n        assert arg_1 not in arg_0.things, \"Don't add the same thing twice\"\n        arg_1.location = arg_2 or arg_0.default_location(arg_1)\n        arg_0.things.append(arg_1)\n        if isinstance(arg_1, Agent):\n            arg_1.performance = 0\n            arg_0.agents.append(arg_1)", "path": "aima/agents.py", "identifier": "Environment.add_thing", "docstring": "Add a thing to the environment, setting its location. For\n        convenience, if thing is an agent program we make a new agent\n        for it. (Shouldn't need to override this.", "docstring_tokens": ["Add", "a", "thing", "to", "the", "environment", "setting", "its", "location", ".", "For", "convenience", "if", "thing", "is", "an", "agent", "program", "we", "make", "a", "new", "agent", "for", "it", ".", "(", "Shouldn", "t", "need", "to", "override", "this", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 257417}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L769-L782", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Returns ancestor of level `deep` recursively", "language": "python", "parameters": "(self, current_item, depth=1)", "return_statement": "return self.get_ancestor_level(current_item.parent, depth=depth-1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "if", "arg_1", ".", "parent", "is", "None", ":", "return", "arg_1", "if", "arg_2", "<=", "1", ":", "return", "arg_1", ".", "parent", "return", "arg_0", ".", "Func", "(", "arg_1", ".", "parent", ",", "arg_2", "=", "arg_2", "-", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2=1):\n        \"\"\"Returns ancestor of level `deep` recursively\n\n        :param TreeItemBase current_item:\n        :param int depth:\n        :rtype: TreeItemBase\n        \"\"\"\n        if arg_1.parent is None:\n            return arg_1\n\n        if arg_2 <= 1:\n            return arg_1.parent\n\n        return arg_0.Func(arg_1.parent, arg_2=arg_2-1)", "path": "sitetree/sitetreeapp.py", "identifier": "SiteTree.get_ancestor_level", "docstring": "Returns ancestor of level `deep` recursively\n\n        :param TreeItemBase current_item:\n        :param int depth:\n        :rtype: TreeItemBase", "docstring_tokens": ["Returns", "ancestor", "of", "level", "deep", "recursively"], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 257418}
{"url": "https://github.com/opencast/pyCA/blob/c89b168d4780d157e1b3f7676628c1b131956a88/pyca/schedule.py#L64-L99", "sha": "c89b168d4780d157e1b3f7676628c1b131956a88", "docstring_summary": "Try to load schedule from the Matterhorn core. Returns a valid schedule\n    or None on failure.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "{", "'agentid'", ":", "config", "(", ")", "[", "'agent'", "]", "[", "'name'", "]", ".", "encode", "(", "'utf8'", ")", "}", "arg_1", "=", "config", "(", ")", "[", "'agent'", "]", "[", "'cal_lookahead'", "]", "*", "24", "*", "60", "*", "60", "if", "arg_1", ":", "arg_0", "[", "'cutoff'", "]", "=", "str", "(", "(", "timestamp", "(", ")", "+", "arg_1", ")", "*", "1000", ")", "arg_2", "=", "'%s/calendars?%s'", "%", "(", "config", "(", ")", "[", "'service-scheduler'", "]", "[", "0", "]", ",", "urlencode", "(", "arg_0", ")", ")", "try", ":", "arg_3", "=", "http_request", "(", "arg_2", ")", "except", "pycurl", ".", "error", "as", "arg_7", ":", "logger", ".", "error", "(", "'Could not get schedule: %s'", "%", "arg_7", ")", "return", "try", ":", "arg_4", "=", "parse_ical", "(", "arg_3", ".", "decode", "(", "'utf-8'", ")", ")", "except", "Exception", ":", "logger", ".", "error", "(", "'Could not parse ical'", ")", "logger", ".", "error", "(", "traceback", ".", "format_exc", "(", ")", ")", "return", "arg_5", "=", "get_session", "(", ")", "arg_5", ".", "query", "(", "UpcomingEvent", ")", ".", "delete", "(", ")", "for", "arg_6", "in", "arg_4", ":", "if", "arg_6", "[", "'dtend'", "]", "<=", "timestamp", "(", ")", ":", "continue", "arg_7", "=", "UpcomingEvent", "(", ")", "arg_7", ".", "start", "=", "arg_6", "[", "'dtstart'", "]", "arg_7", ".", "end", "=", "arg_6", "[", "'dtend'", "]", "arg_7", ".", "uid", "=", "arg_6", ".", "get", "(", "'uid'", ")", "arg_7", ".", "title", "=", "arg_6", ".", "get", "(", "'summary'", ")", "arg_7", ".", "set_data", "(", "arg_6", ")", "arg_5", ".", "add", "(", "arg_7", ")", "arg_5", ".", "commit", "(", ")"], "function": "def Func():\n    '''Try to load schedule from the Matterhorn core. Returns a valid schedule\n    or None on failure.\n    '''\n    arg_0 = {'agentid': config()['agent']['name'].encode('utf8')}\n    arg_1 = config()['agent']['cal_lookahead'] * 24 * 60 * 60\n    if arg_1:\n        arg_0['cutoff'] = str((timestamp() + arg_1) * 1000)\n    arg_2 = '%s/calendars?%s' % (config()['service-scheduler'][0],\n                               urlencode(arg_0))\n    try:\n        arg_3 = http_request(arg_2)\n    except pycurl.error as arg_7:\n        logger.error('Could not get schedule: %s' % arg_7)\n        return\n\n    try:\n        arg_4 = parse_ical(arg_3.decode('utf-8'))\n    except Exception:\n        logger.error('Could not parse ical')\n        logger.error(traceback.format_exc())\n        return\n    arg_5 = get_session()\n    arg_5.query(UpcomingEvent).delete()\n    for arg_6 in arg_4:\n        # Ignore events that have already ended\n        if arg_6['dtend'] <= timestamp():\n            continue\n        arg_7 = UpcomingEvent()\n        arg_7.start = arg_6['dtstart']\n        arg_7.end = arg_6['dtend']\n        arg_7.uid = arg_6.get('uid')\n        arg_7.title = arg_6.get('summary')\n        arg_7.set_data(arg_6)\n        arg_5.add(arg_7)\n    arg_5.commit()", "path": "pyca/schedule.py", "identifier": "get_schedule", "docstring": "Try to load schedule from the Matterhorn core. Returns a valid schedule\n    or None on failure.", "docstring_tokens": ["Try", "to", "load", "schedule", "from", "the", "Matterhorn", "core", ".", "Returns", "a", "valid", "schedule", "or", "None", "on", "failure", "."], "nwo": "opencast/pyCA", "score": 0.38750565733100095, "idx": 257419}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L888-L911", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Sends a batch of messages into the specified queue. The limit to the number of\n        messages which may be present in the topic is governed by the message\n        size the MaxTopicSizeInMegaBytes. If this message will cause the queue\n        to exceed its quota, a quota exceeded error is returned and the\n        message will be rejected.", "language": "python", "parameters": "(self, queue_name, messages=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'messages'", ",", "arg_2", ")", "arg_3", "=", "HTTPRequest", "(", ")", "arg_3", ".", "method", "=", "'POST'", "arg_3", ".", "host", "=", "arg_0", ".", "_get_host", "(", ")", "arg_3", ".", "path", "=", "'/'", "+", "_str", "(", "arg_1", ")", "+", "'/messages'", "arg_3", ".", "headers", ".", "append", "(", "(", "'Content-Type'", ",", "'application/vnd.microsoft.servicebus.json'", ")", ")", "arg_3", ".", "body", "=", "_get_request_body", "(", "json", ".", "dumps", "(", "[", "m", ".", "as_batch_body", "(", ")", "for", "m", "in", "arg_2", "]", ")", ")", "arg_3", ".", "path", ",", "arg_3", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_3", ")", "arg_3", ".", "headers", "=", "arg_0", ".", "_update_service_bus_header", "(", "arg_3", ")", "arg_0", ".", "_perform_request", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Sends a batch of messages into the specified queue. The limit to the number of\n        messages which may be present in the topic is governed by the message\n        size the MaxTopicSizeInMegaBytes. If this message will cause the queue\n        to exceed its quota, a quota exceeded error is returned and the\n        message will be rejected.\n\n        queue_name:\n            Name of the queue.\n        messages:\n            List of message objects containing message body and properties.\n        '''\n        _validate_not_none('queue_name', arg_1)\n        _validate_not_none('messages', arg_2)\n        arg_3 = HTTPRequest()\n        arg_3.method = 'POST'\n        arg_3.host = arg_0._get_host()\n        arg_3.path = '/' + _str(arg_1) + '/messages'\n        arg_3.headers.append(('Content-Type', 'application/vnd.microsoft.servicebus.json'))\n        arg_3.body = _get_request_body(json.dumps([m.as_batch_body() for m in arg_2]))\n        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)  # pylint: disable=protected-access\n        arg_3.headers = arg_0._update_service_bus_header(arg_3)\n        arg_0._perform_request(arg_3)", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusService.send_queue_message_batch", "docstring": "Sends a batch of messages into the specified queue. The limit to the number of\n        messages which may be present in the topic is governed by the message\n        size the MaxTopicSizeInMegaBytes. If this message will cause the queue\n        to exceed its quota, a quota exceeded error is returned and the\n        message will be rejected.\n\n        queue_name:\n            Name of the queue.\n        messages:\n            List of message objects containing message body and properties.", "docstring_tokens": ["Sends", "a", "batch", "of", "messages", "into", "the", "specified", "queue", ".", "The", "limit", "to", "the", "number", "of", "messages", "which", "may", "be", "present", "in", "the", "topic", "is", "governed", "by", "the", "message", "size", "the", "MaxTopicSizeInMegaBytes", ".", "If", "this", "message", "will", "cause", "the", "queue", "to", "exceed", "its", "quota", "a", "quota", "exceeded", "error", "is", "returned", "and", "the", "message", "will", "be", "rejected", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257420}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/display.py#L32-L61", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Pretty-print a jobject.", "language": "python", "parameters": "(obj, **kwargs)", "return_statement": "return string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "arg_0", ".", "__json__", ")", "if", "v", "}", "arg_3", "=", "json", ".", "dumps", "(", "arg_2", ",", "**", "arg_1", ")", "arg_3", "=", "re", ".", "sub", "(", "r'[{}\"]'", ",", "''", ",", "arg_3", ")", "arg_3", "=", "re", ".", "sub", "(", "r',\\n'", ",", "'\\n'", ",", "arg_3", ")", "arg_3", "=", "re", ".", "sub", "(", "r'^\\s*$'", ",", "''", ",", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n    '''Pretty-print a jobject.\n\n    Parameters\n    ----------\n    obj : jams.JObject\n\n    kwargs\n        additional parameters to `json.dumps`\n\n    Returns\n    -------\n    string\n        A simplified display of `obj` contents.\n    '''\n\n    arg_2 = {k: v for k, v in six.iteritems(arg_0.__json__) if v}\n\n    arg_3 = json.dumps(arg_2, **arg_1)\n\n    # Suppress braces and quotes\n    arg_3 = re.sub(r'[{}\"]', '', arg_3)\n\n    # Kill trailing commas\n    arg_3 = re.sub(r',\\n', '\\n', arg_3)\n\n    # Kill blank lines\n    arg_3 = re.sub(r'^\\s*$', '', arg_3)\n\n    return arg_3", "path": "jams/display.py", "identifier": "pprint_jobject", "docstring": "Pretty-print a jobject.\n\n    Parameters\n    ----------\n    obj : jams.JObject\n\n    kwargs\n        additional parameters to `json.dumps`\n\n    Returns\n    -------\n    string\n        A simplified display of `obj` contents.", "docstring_tokens": ["Pretty", "-", "print", "a", "jobject", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 257421}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/apy/core.py#L78-L118", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "Configure from cli and run the server", "language": "python", "parameters": "(self, app_docopt=DEFAULT_DOC, description='')", "return_statement": "return exit_status", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "''", ")", ":", "arg_4", "=", "0", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_5", "=", "docopt", "(", "arg_1", ",", "version", "=", "arg_3", ")", "elif", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_5", "=", "arg_1", "else", ":", "raise", "ValueError", "(", "'unknown configuration object ({})'", ".", "format", "(", "type", "(", "arg_1", ")", ")", ")", "arg_6", "=", "arg_5", ".", "get", "(", "'--log'", ",", "'debug'", ")", "arg_7", "=", "arg_5", ".", "get", "(", "'--debug'", ",", "False", ")", "arg_8", "=", "'stdout'", "if", "arg_7", "else", "'apy.log'", "arg_9", "=", "arg_5", ".", "get", "(", "'--bind'", ",", "'127.0.0.1'", ")", "arg_10", "=", "int", "(", "arg_5", ".", "get", "(", "'--port'", ",", "5000", ")", ")", "arg_11", "=", "dna", ".", "logging", ".", "setup", "(", "level", "=", "arg_6", ",", "output", "=", "arg_8", ")", "with", "arg_11", ".", "applicationbound", "(", ")", ":", "try", ":", "log", ".", "info", "(", "'Funcr ready'", ",", "version", "=", "arg_3", ",", "log", "=", "arg_6", ",", "debug", "=", "arg_7", ",", "bind", "=", "'{}:{}'", ".", "format", "(", "arg_9", ",", "arg_10", ")", ")", "arg_0", ".", "app", ".", "run", "(", "host", "=", "arg_9", ",", "port", "=", "arg_10", ",", "debug", "=", "arg_7", ")", "except", "Exception", "as", "error", ":", "if", "arg_7", ":", "raise", "log", ".", "error", "(", "'{}: {}'", ".", "format", "(", "type", "(", "error", ")", ".", "__name__", ",", "str", "(", "error", ")", ")", ")", "arg_4", "=", "1", "finally", ":", "log", ".", "info", "(", "'session ended with status {}'", ".", "format", "(", "arg_4", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=''):\n        ''' Configure from cli and run the Funcr '''\n\n        arg_4 = 0\n        if isinstance(arg_1, str):\n            arg_5 = docopt(arg_1, version=arg_3)\n        elif isinstance(arg_1, dict):\n            arg_5 = arg_1\n        else:\n            raise ValueError('unknown configuration object ({})'\n                             .format(type(arg_1)))\n        arg_6 = arg_5.get('--log', 'debug')\n        arg_7 = arg_5.get('--debug', False)\n        # TODO More serious default\n        arg_8 = 'stdout' if arg_7 else 'apy.log'\n        arg_9 = arg_5.get('--bind', '127.0.0.1')\n        arg_10 = int(arg_5.get('--port', 5000))\n        arg_11 = dna.logging.setup(level=arg_6, output=arg_8)\n\n        with arg_11.applicationbound():\n            try:\n                log.info('Funcr ready',\n                         version=arg_3,\n                         log=arg_6,\n                         debug=arg_7,\n                         bind='{}:{}'.format(arg_9, arg_10))\n\n                arg_0.app.run(host=arg_9,\n                             port=arg_10,\n                             debug=arg_7)\n\n            except Exception as error:\n                if arg_7:\n                    raise\n                log.error('{}: {}'.format(type(error).__name__, str(error)))\n                arg_4 = 1\n\n            finally:\n                log.info('session ended with status {}'.format(arg_4))\n\n        return arg_4", "path": "python/dna/apy/core.py", "identifier": "App.serve", "docstring": "Configure from cli and run the server", "docstring_tokens": ["Configure", "from", "cli", "and", "run", "the", "server"], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 257422}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/anomalyzer.py#L142-L182", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Samples n rows.", "language": "python", "parameters": "(reader, writer, n, start=None, stop=None, tsCol=None,\n           writeSampleOnly=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ")", ":", "arg_7", "=", "list", "(", "arg_0", ")", "if", "arg_5", "is", "not", "None", ":", "arg_8", "=", "arg_7", "[", "0", "]", "[", "arg_5", "]", "arg_9", "=", "arg_7", "[", "1", "]", "[", "arg_5", "]", "-", "arg_8", "if", "arg_3", "is", "None", ":", "arg_3", "=", "0", "if", "arg_4", "is", "None", ":", "arg_4", "=", "len", "(", "arg_7", ")", "-", "1", "arg_10", "=", "arg_4", "-", "arg_3", "+", "1", "arg_11", "=", "arg_10", "-", "arg_2", "for", "arg_12", "in", "xrange", "(", "arg_11", ")", ":", "arg_13", "=", "random", ".", "randint", "(", "arg_3", ",", "arg_4", "-", "arg_12", ")", "del", "arg_7", "[", "arg_13", "]", "if", "arg_6", ":", "arg_7", "=", "arg_7", "[", "arg_3", ":", "arg_3", "+", "arg_2", "]", "if", "arg_5", "is", "not", "None", ":", "arg_8", "=", "arg_7", "[", "0", "]", "[", "arg_5", "]", "for", "arg_14", "in", "arg_7", ":", "if", "arg_5", "is", "not", "None", ":", "arg_14", "[", "arg_5", "]", "=", "arg_8", "arg_8", "+=", "arg_9", "arg_1", ".", "appendRecord", "(", "arg_14", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None,\n           arg_6=True):\n  \"\"\"Samples n rows.\n\n  Args:\n    reader: A FileRecordStream object with input data.\n    writer: A FileRecordStream object to write output data to.\n    n: The number of elements to Func.\n    start: The first row in the range to Func from.\n    stop: The last row in the range to Func from.\n    tsCol: If specified, the timestamp column to update.\n    writeSampleOnly: If False, the rows before start are written before the\n        Func and the rows after stop are written after the Func.\n  \"\"\"\n  arg_7 = list(arg_0)\n  if arg_5 is not None:\n    arg_8 = arg_7[0][arg_5]\n    arg_9 = arg_7[1][arg_5] - arg_8\n  if arg_3 is None:\n    arg_3 = 0\n  if arg_4 is None:\n    arg_4 = len(arg_7) - 1\n  arg_10 = arg_4 - arg_3 + 1\n  # Select random rows in the Func range to delete until the desired number\n  # of rows are left.\n  arg_11 =  arg_10 - arg_2\n  for arg_12 in xrange(arg_11):\n    arg_13 = random.randint(arg_3, arg_4 - arg_12)\n    del arg_7[arg_13]\n  # Remove outside rows if specified.\n  if arg_6:\n    arg_7 = arg_7[arg_3:arg_3 + arg_2]\n  # Rewrite columns if tsCol is given.\n  if arg_5 is not None:\n    arg_8 = arg_7[0][arg_5]\n  # Write resulting rows.\n  for arg_14 in arg_7:\n    if arg_5 is not None:\n      arg_14[arg_5] = arg_8\n      arg_8 += arg_9\n    arg_1.appendRecord(arg_14)", "path": "src/nupic/data/generators/anomalyzer.py", "identifier": "sample", "docstring": "Samples n rows.\n\n  Args:\n    reader: A FileRecordStream object with input data.\n    writer: A FileRecordStream object to write output data to.\n    n: The number of elements to sample.\n    start: The first row in the range to sample from.\n    stop: The last row in the range to sample from.\n    tsCol: If specified, the timestamp column to update.\n    writeSampleOnly: If False, the rows before start are written before the\n        sample and the rows after stop are written after the sample.", "docstring_tokens": ["Samples", "n", "rows", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257423}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L25-L37", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "delete request, use with caution", "language": "python", "parameters": "(self, url,\n                 headers=None,\n                 return_json=True,\n                 default_headers=True)", "return_statement": "return self._call(url,\n                      headers=headers,\n                      func=requests.delete,\n                      return_json=return_json,\n                      default_headers=default_headers)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "True", ")", ":", "bot", ".", "debug", "(", "'DELETE %s'", "%", "arg_1", ")", "return", "arg_0", ".", "_call", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "func", "=", "requests", ".", "Func", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1,\n                 arg_2=None,\n                 arg_3=True,\n                 arg_4=True):\n\n    '''Func request, use with caution\n    '''\n    bot.debug('DELETE %s' %arg_1)\n    return arg_0._call(arg_1,\n                      arg_2=arg_2,\n                      func=requests.Func,\n                      arg_3=arg_3,\n                      arg_4=arg_4)", "path": "sregistry/main/base/http.py", "identifier": "delete", "docstring": "delete request, use with caution", "docstring_tokens": ["delete", "request", "use", "with", "caution"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 257424}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L874-L887", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Checks to see if the specified hosted service name is available, or if\n        it has already been taken.", "language": "python", "parameters": "(self, service_name)", "return_statement": "return self._perform_get(\n            '/' + self.subscription_id +\n            '/services/hostedservices/operations/isavailable/' +\n            _str(service_name) + '',\n            AvailabilityResponse)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "return", "arg_0", ".", "_perform_get", "(", "'/'", "+", "arg_0", ".", "subscription_id", "+", "'/services/hostedservices/operations/isavailable/'", "+", "_str", "(", "arg_1", ")", "+", "''", ",", "AvailabilityResponse", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Checks to see if the specified hosted service name is available, or if\n        it has already been taken.\n\n        service_name:\n            Name of the hosted service.\n        '''\n        _validate_not_none('service_name', arg_1)\n        return arg_0._perform_get(\n            '/' + arg_0.subscription_id +\n            '/services/hostedservices/operations/isavailable/' +\n            _str(arg_1) + '',\n            AvailabilityResponse)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.check_hosted_service_name_availability", "docstring": "Checks to see if the specified hosted service name is available, or if\n        it has already been taken.\n\n        service_name:\n            Name of the hosted service.", "docstring_tokens": ["Checks", "to", "see", "if", "the", "specified", "hosted", "service", "name", "is", "available", "or", "if", "it", "has", "already", "been", "taken", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257425}
{"url": "https://github.com/hit9/rux/blob/d7f60722658a3b83ac6d7bb3ca2790ac9c926b59/rux/renderer.py#L44-L48", "sha": "d7f60722658a3b83ac6d7bb3ca2790ac9c926b59", "docstring_summary": "Render data with template and then write to path", "language": "python", "parameters": "(self, path, template, **data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "render", "(", "arg_2", ",", "**", "arg_3", ")", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_4", ".", "encode", "(", "charset", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Render data with template and then write to path\"\"\"\n        arg_4 = arg_0.render(arg_2, **arg_3)\n        with open(arg_1, 'w') as f:\n            f.write(arg_4.encode(charset))", "path": "rux/renderer.py", "identifier": "Renderer.render_to", "docstring": "Render data with template and then write to path", "docstring_tokens": ["Render", "data", "with", "template", "and", "then", "write", "to", "path"], "nwo": "hit9/rux", "score": 0.18892572326127263, "idx": 257426}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1117-L1134", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Generate declaration statements for arrays.", "language": "python", "parameters": "(self, with_init=True)", "return_statement": "return array_declarations, dict(array_dict)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "deepcopy", "(", "arg_0", ".", "get_array_declarations", "(", ")", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "arg_3", ".", "append", "(", "transform_multidim_to_1d_decl", "(", "arg_4", ")", ")", "transform_array_decl_to_malloc", "(", "arg_4", ",", "arg_1", "=", "arg_1", ")", "return", "arg_2", ",", "dict", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"\n        Generate declaration statements for arrays.\n\n        Also transforming multi-dim to 1d arrays and initializing with malloc.\n\n        :param with_init: ommit malloc initialization\n\n        :return: list of declarations nodes, dictionary of array names and original dimensions\n        \"\"\"\n        # copy array declarations from from kernel ast\n        arg_2 = deepcopy(arg_0.get_array_declarations())\n        arg_3 = []\n        for arg_4 in arg_2:\n            # We need to transform\n            arg_3.append(transform_multidim_to_1d_decl(arg_4))\n            transform_array_decl_to_malloc(arg_4, arg_1=arg_1)\n        return arg_2, dict(arg_3)", "path": "kerncraft/kernel.py", "identifier": "KernelCode._build_array_declarations", "docstring": "Generate declaration statements for arrays.\n\n        Also transforming multi-dim to 1d arrays and initializing with malloc.\n\n        :param with_init: ommit malloc initialization\n\n        :return: list of declarations nodes, dictionary of array names and original dimensions", "docstring_tokens": ["Generate", "declaration", "statements", "for", "arrays", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 257427}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/hpo.py#L237-L267", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse a .obo formated hpo line", "language": "python", "parameters": "(hpo_lines)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ":", "if", "len", "(", "arg_2", ")", "==", "0", ":", "continue", "arg_2", "=", "arg_2", ".", "rstrip", "(", ")", "if", "arg_2", "==", "'[Term]'", ":", "if", "arg_1", ":", "yield", "arg_1", "arg_1", "=", "{", "}", "elif", "arg_2", ".", "startswith", "(", "'id'", ")", ":", "arg_1", "[", "'hpo_id'", "]", "=", "arg_2", "[", "4", ":", "]", "elif", "arg_2", ".", "startswith", "(", "'name'", ")", ":", "arg_1", "[", "'description'", "]", "=", "arg_2", "[", "6", ":", "]", "elif", "arg_2", ".", "startswith", "(", "'alt_id'", ")", ":", "if", "'aliases'", "not", "in", "arg_1", ":", "arg_1", "[", "'aliases'", "]", "=", "[", "]", "arg_1", "[", "'aliases'", "]", ".", "append", "(", "arg_2", "[", "8", ":", "]", ")", "elif", "arg_2", ".", "startswith", "(", "'is_a'", ")", ":", "if", "'ancestors'", "not", "in", "arg_1", ":", "arg_1", "[", "'ancestors'", "]", "=", "[", "]", "arg_1", "[", "'ancestors'", "]", ".", "append", "(", "arg_2", "[", "6", ":", "16", "]", ")", "if", "arg_1", ":", "yield", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse a .obo formated hpo line\"\"\"\n    arg_1 = {}\n    for arg_2 in arg_0:\n        if len(arg_2) == 0:\n            continue\n        arg_2 = arg_2.rstrip()\n        # New term starts with [Term]\n        if arg_2 == '[Term]':\n            if arg_1:\n                yield arg_1\n            arg_1 = {}\n        \n        elif arg_2.startswith('id'):\n            arg_1['hpo_id'] = arg_2[4:]\n\n        elif arg_2.startswith('name'):\n            arg_1['description'] = arg_2[6:]\n\n        elif arg_2.startswith('alt_id'):\n            if 'aliases' not in arg_1:\n                arg_1['aliases'] = []\n            arg_1['aliases'].append(arg_2[8:])\n        \n        elif arg_2.startswith('is_a'):\n            if 'ancestors' not in arg_1:\n                arg_1['ancestors'] = []\n            arg_1['ancestors'].append(arg_2[6:16])\n\n    if arg_1:\n        yield arg_1", "path": "scout/parse/hpo.py", "identifier": "parse_hpo_obo", "docstring": "Parse a .obo formated hpo line", "docstring_tokens": ["Parse", "a", ".", "obo", "formated", "hpo", "line"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257428}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/closest_colors.py#L19-L22", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Square of the euclidean distance", "language": "python", "parameters": "(c1, c2)", "return_statement": "return sum(x * x for x in diffs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "(", "i", "-", "j", ")", "for", "i", ",", "j", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ")", "return", "sum", "(", "arg_3", "*", "arg_3", "for", "arg_3", "in", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Square of the Func distance\"\"\"\n    arg_2 = ((i - j) for i, j in zip(arg_0, arg_1))\n    return sum(arg_3 * arg_3 for arg_3 in arg_2)", "path": "bibliopixel/colors/closest_colors.py", "identifier": "euclidean", "docstring": "Square of the euclidean distance", "docstring_tokens": ["Square", "of", "the", "euclidean", "distance"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 257429}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py#L262-L273", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Retrieves the set of firewall rules for an Azure SQL Database Server.", "language": "python", "parameters": "(self, server_name)", "return_statement": "return _MinidomXmlToObject.parse_service_resources_response(\n            response, FirewallRule)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'server_name'", ",", "arg_1", ")", "arg_2", "=", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_get_firewall_rules_path", "(", "arg_1", ")", ",", "None", ")", "return", "_MinidomXmlToObject", ".", "parse_service_resources_response", "(", "arg_2", ",", "FirewallRule", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Retrieves the set of firewall rules for an Azure SQL Database Server.\n\n        server_name:\n            Name of the server.\n        '''\n        _validate_not_none('server_name', arg_1)\n        arg_2 = arg_0._perform_get(arg_0._get_firewall_rules_path(arg_1),\n                                     None)\n        return _MinidomXmlToObject.parse_service_resources_response(\n            arg_2, FirewallRule)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py", "identifier": "SqlDatabaseManagementService.list_firewall_rules", "docstring": "Retrieves the set of firewall rules for an Azure SQL Database Server.\n\n        server_name:\n            Name of the server.", "docstring_tokens": ["Retrieves", "the", "set", "of", "firewall", "rules", "for", "an", "Azure", "SQL", "Database", "Server", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257430}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/random.py#L93-L115", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Shuffle the relations.", "language": "python", "parameters": "(graph: BELGraph, percentage: Optional[str] = None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "None", ")", "->", "arg_1", ":", "arg_2", "=", "arg_2", "or", "0.3", "assert", "0", "<", "arg_2", "<=", "1", "arg_5", "=", "arg_0", ".", "number_of_edges", "(", ")", "arg_6", "=", "int", "(", "arg_2", "*", "arg_5", "*", "(", "arg_5", "-", "1", ")", "/", "2", ")", "arg_7", ":", "arg_1", "=", "arg_0", ".", "copy", "(", ")", "arg_8", "=", "arg_7", ".", "edges", "(", "keys", "=", "True", ")", "for", "arg_9", "in", "range", "(", "arg_6", ")", ":", "(", "arg_10", ",", "arg_11", ",", "arg_12", ")", ",", "(", "arg_13", ",", "arg_14", ",", "arg_15", ")", "=", "random", ".", "sample", "(", "arg_8", ",", "2", ")", "arg_7", "[", "arg_10", "]", "[", "arg_11", "]", "[", "arg_12", "]", ",", "arg_7", "[", "arg_13", "]", "[", "arg_14", "]", "[", "arg_15", "]", "=", "arg_7", "[", "arg_13", "]", "[", "arg_14", "]", "[", "arg_15", "]", ",", "arg_7", "[", "arg_10", "]", "[", "arg_11", "]", "[", "arg_12", "]", "return", "arg_7"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4] = None) -> arg_1:\n    \"\"\"Shuffle the relations.\n\n    Useful for permutation testing.\n\n    :param graph: A BEL graph\n    :param percentage: What percentage of possible swaps to make\n    \"\"\"\n    arg_2 = arg_2 or 0.3\n    assert 0 < arg_2 <= 1\n\n    arg_5 = arg_0.number_of_edges()\n    arg_6 = int(arg_2 * arg_5 * (arg_5 - 1) / 2)\n\n    arg_7: arg_1 = arg_0.copy()\n\n    arg_8 = arg_7.edges(keys=True)\n\n    for arg_9 in range(arg_6):\n        (arg_10, arg_11, arg_12), (arg_13, arg_14, arg_15) = random.sample(arg_8, 2)\n        arg_7[arg_10][arg_11][arg_12], arg_7[arg_13][arg_14][arg_15] = arg_7[arg_13][arg_14][arg_15], arg_7[arg_10][arg_11][arg_12]\n\n    return arg_7", "path": "src/pybel_tools/mutation/random.py", "identifier": "shuffle_relations", "docstring": "Shuffle the relations.\n\n    Useful for permutation testing.\n\n    :param graph: A BEL graph\n    :param percentage: What percentage of possible swaps to make", "docstring_tokens": ["Shuffle", "the", "relations", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257431}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/utils.py#L94-L104", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Cache for heavy function calls.", "language": "python", "parameters": "(func)", "return_statement": "return wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "@", "wraps", "(", "arg_0", ")", "def", "wrap", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "'{0}{1}'", ".", "format", "(", "arg_2", ",", "arg_3", ")", "if", "arg_4", "not", "in", "arg_1", ":", "arg_1", "[", "arg_4", "]", "=", "arg_0", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "arg_1", "[", "arg_4", "]", "return", "wrap"], "function": "def Func(arg_0):\n    \"\"\"Cache for heavy function calls.\"\"\"\n    arg_1 = {}\n\n    @wraps(arg_0)\n    def wrap(*arg_2, **arg_3):\n        arg_4 = '{0}{1}'.format(arg_2, arg_3)\n        if arg_4 not in arg_1:\n            arg_1[arg_4] = arg_0(*arg_2, **arg_3)\n        return arg_1[arg_4]\n    return wrap", "path": "invenio_migrator/legacy/utils.py", "identifier": "memoize", "docstring": "Cache for heavy function calls.", "docstring_tokens": ["Cache", "for", "heavy", "function", "calls", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 257432}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L444-L449", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "Show device heap size", "language": "python", "parameters": "(self)", "return_statement": "return int(res.split('\\r\\n')[1])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "log", ".", "info", "(", "'Heap'", ")", "arg_1", "=", "arg_0", ".", "__exchange", "(", "'print(node.heap())'", ")", "log", ".", "info", "(", "arg_1", ")", "return", "int", "(", "arg_1", ".", "split", "(", "'\\r\\n'", ")", "[", "1", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"Show device heap size\"\"\"\n        log.info('Heap')\n        arg_1 = arg_0.__exchange('print(node.heap())')\n        log.info(arg_1)\n        return int(arg_1.split('\\r\\n')[1])", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.node_heap", "docstring": "Show device heap size", "docstring_tokens": ["Show", "device", "heap", "size"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 257433}
{"url": "https://github.com/vingd/encrypted-pickle-python/blob/7656233598e02e65971f69e11849a0f288b2b2a5/encryptedpickle/encryptedpickle.py#L636-L642", "sha": "7656233598e02e65971f69e11849a0f288b2b2a5", "docstring_summary": "Read header version from data", "language": "python", "parameters": "(self, data)", "return_statement": "return version", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ord", "(", "arg_1", "[", "0", "]", ")", "if", "arg_2", "not", "in", "arg_0", ".", "VERSIONS", ":", "raise", "Exception", "(", "'Version not defined: %d'", "%", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''Read header version from data'''\n\n        arg_2 = ord(arg_1[0])\n        if arg_2 not in arg_0.VERSIONS:\n            raise Exception('Version not defined: %d' % arg_2)\n        return arg_2", "path": "encryptedpickle/encryptedpickle.py", "identifier": "EncryptedPickle._read_version", "docstring": "Read header version from data", "docstring_tokens": ["Read", "header", "version", "from", "data"], "nwo": "vingd/encrypted-pickle-python", "score": 0.1861985637721619, "idx": 257434}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/__init__.py#L315-L333", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Generates CSRF token.", "language": "python", "parameters": "(secret)", "return_statement": "return hashed[shift:shift - span - 1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "hashlib", ".", "md5", "(", "uuid", ".", "uuid4", "(", ")", ".", "bytes", "+", "six", ".", "b", "(", "arg_0", ")", ")", ".", "hexdigest", "(", ")", "arg_2", "=", "5", "arg_3", "=", "random", ".", "randint", "(", "0", ",", "arg_2", ")", "return", "arg_1", "[", "arg_3", ":", "arg_3", "-", "arg_2", "-", "1", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Generates CSRF token.\n\n        Inspired by this article:\n        http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html\n\n        :returns:\n            :class:`str` Random unguessable string.\n\n        \"\"\"\n\n        # Create hash from random string plus salt.\n        arg_1 = hashlib.md5(uuid.uuid4().bytes + six.b(arg_0)).hexdigest()\n\n        # Each time return random portion of the hash.\n        arg_2 = 5\n        arg_3 = random.randint(0, arg_2)\n        return arg_1[arg_3:arg_3 - arg_2 - 1]", "path": "authomatic/providers/__init__.py", "identifier": "BaseProvider.csrf_generator", "docstring": "Generates CSRF token.\n\n        Inspired by this article:\n        http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html\n\n        :returns:\n            :class:`str` Random unguessable string.", "docstring_tokens": ["Generates", "CSRF", "token", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 257435}
{"url": "https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/client/factory.py#L116-L120", "sha": "5b322f7c2b82a502b1e1b70703ae45f1f668d07d", "docstring_summary": "Produce ids for Protocol packets, outliving their sessions", "language": "python", "parameters": "(self)", "return_statement": "return self.id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "id", "=", "(", "arg_0", ".", "id", "+", "1", ")", "%", "65536", "arg_0", ".", "id", "=", "arg_0", ".", "id", "or", "1", "return", "arg_0", ".", "id"], "function": "def Func(arg_0):\n        '''Produce ids for Protocol packets, outliving their sessions'''\n        arg_0.id = (arg_0.id + 1) % 65536\n        arg_0.id = arg_0.id or 1   # avoid id 0\n        return arg_0.id", "path": "mqtt/client/factory.py", "identifier": "MQTTFactory.makeId", "docstring": "Produce ids for Protocol packets, outliving their sessions", "docstring_tokens": ["Produce", "ids", "for", "Protocol", "packets", "outliving", "their", "sessions"], "nwo": "astrorafael/twisted-mqtt", "score": 0.28352459090240634, "idx": 257436}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1024-L1045", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Project polygons from one image to a new one.", "language": "python", "parameters": "(self, image)", "return_statement": "return PolygonsOnImage(polygons, shape)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "normalize_shape", "(", "arg_1", ")", "if", "arg_2", "[", "0", ":", "2", "]", "==", "arg_0", ".", "shape", "[", "0", ":", "2", "]", ":", "return", "arg_0", ".", "deepcopy", "(", ")", "arg_3", "=", "[", "poly", ".", "project", "(", "arg_0", ".", "shape", ",", "arg_2", ")", "for", "poly", "in", "arg_0", ".", "polygFuncs", "]", "return", "PolygFuncsOnImage", "(", "arg_3", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Project polygFuncs from Funce image to a new Funce.\n\n        Parameters\n        ----------\n        image : ndarray or tuple of int\n            New image Functo which the polygFuncs are to be projected.\n            May also simply be that new image's shape tuple.\n\n        Returns\n        -------\n        imgaug.PolygFuncsOnImage\n            Object cFunctaining all projected polygFuncs.\n\n        \"\"\"\n        arg_2 = normalize_shape(arg_1)\n        if arg_2[0:2] == arg_0.shape[0:2]:\n            return arg_0.deepcopy()\n        arg_3 = [poly.project(arg_0.shape, arg_2) for poly in arg_0.polygFuncs]\n        # TODO use deepcopy() here\n        return PolygFuncsOnImage(arg_3, arg_2)", "path": "imgaug/augmentables/polys.py", "identifier": "PolygonsOnImage.on", "docstring": "Project polygons from one image to a new one.\n\n        Parameters\n        ----------\n        image : ndarray or tuple of int\n            New image onto which the polygons are to be projected.\n            May also simply be that new image's shape tuple.\n\n        Returns\n        -------\n        imgaug.PolygonsOnImage\n            Object containing all projected polygons.", "docstring_tokens": ["Project", "polygons", "from", "one", "image", "to", "a", "new", "one", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 257437}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1454-L1464", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Set the subject of this certificate.", "language": "python", "parameters": "(self, subject)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_set_name", "(", "_lib", ".", "X509_Func_name", ",", "arg_1", ")", "arg_0", ".", "_subject_invalidator", ".", "clear", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set the subject of this certificate.\n\n        :param subject: The subject.\n        :type subject: :py:class:`X509Name`\n\n        :return: ``None``\n        \"\"\"\n        arg_0._set_name(_lib.X509_Func_name, arg_1)\n        arg_0._subject_invalidator.clear()", "path": "src/OpenSSL/crypto.py", "identifier": "X509.set_subject", "docstring": "Set the subject of this certificate.\n\n        :param subject: The subject.\n        :type subject: :py:class:`X509Name`\n\n        :return: ``None``", "docstring_tokens": ["Set", "the", "subject", "of", "this", "certificate", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 257438}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L144-L160", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Decode attributes of the stanza XML element\n        and put them into the stanza properties.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "_element", ".", "get", "(", "'from'", ")", "if", "arg_1", ":", "arg_0", ".", "_from_jid", "=", "JID", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_element", ".", "get", "(", "'to'", ")", "if", "arg_3", ":", "arg_0", ".", "_to_jid", "=", "JID", "(", "arg_3", ")", "except", "ValueError", ":", "raise", "JIDMalformedProtocolError", "arg_0", ".", "_stanza_type", "=", "arg_0", ".", "_element", ".", "get", "(", "'type'", ")", "arg_0", ".", "_stanza_id", "=", "arg_0", ".", "_element", ".", "get", "(", "'id'", ")", "arg_7", "=", "arg_0", ".", "_element", ".", "get", "(", "XML_LANG_QNAME", ")", "if", "arg_7", ":", "arg_0", ".", "_language", "=", "arg_7"], "function": "def Func(arg_0):\n        \"\"\"Decode attributes of the stanza XML element\n        and put them into the stanza properties.\"\"\"\n        try:\n            arg_1 = arg_0._element.get('from')\n            if arg_1:\n                arg_0._from_jid = JID(arg_1)\n            arg_3 = arg_0._element.get('to')\n            if arg_3:\n                arg_0._to_jid = JID(arg_3)\n        except ValueError:\n            raise JIDMalformedProtocolError\n        arg_0._stanza_type = arg_0._element.get('type')\n        arg_0._stanza_id = arg_0._element.get('id')\n        arg_7 = arg_0._element.get(XML_LANG_QNAME)\n        if arg_7:\n            arg_0._language = arg_7", "path": "pyxmpp2/stanza.py", "identifier": "Stanza._decode_attributes", "docstring": "Decode attributes of the stanza XML element\n        and put them into the stanza properties.", "docstring_tokens": ["Decode", "attributes", "of", "the", "stanza", "XML", "element", "and", "put", "them", "into", "the", "stanza", "properties", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257439}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L78-L91", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Patch isBase64 to prevent Base64 encoding of JSON content", "language": "python", "parameters": "(self, attrsD, contentparams)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ".", "get", "(", "\"mode\"", ",", "\"\"", ")", "==", "\"base64\"", ":", "return", "0", "if", "arg_0", ".", "contentparams", "[", "\"type\"", "]", ".", "startswith", "(", "\"text/\"", ")", ":", "return", "0", "if", "arg_0", ".", "contentparams", "[", "\"type\"", "]", ".", "endswith", "(", "\"+xml\"", ")", ":", "return", "0", "if", "arg_0", ".", "contentparams", "[", "\"type\"", "]", ".", "endswith", "(", "\"/xml\"", ")", ":", "return", "0", "if", "arg_0", ".", "contentparams", "[", "\"type\"", "]", ".", "endswith", "(", "\"/json\"", ")", ":", "return", "0", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Patch isBase64 to prevent Base64 encoding of JSON content\n    \"\"\"\n    if arg_1.get(\"mode\", \"\") == \"base64\":\n        return 0\n    if arg_0.contentparams[\"type\"].startswith(\"text/\"):\n        return 0\n    if arg_0.contentparams[\"type\"].endswith(\"+xml\"):\n        return 0\n    if arg_0.contentparams[\"type\"].endswith(\"/xml\"):\n        return 0\n    if arg_0.contentparams[\"type\"].endswith(\"/json\"):\n        return 0\n    return 0", "path": "pyzotero/zotero.py", "identifier": "ib64_patched", "docstring": "Patch isBase64 to prevent Base64 encoding of JSON content", "docstring_tokens": ["Patch", "isBase64", "to", "prevent", "Base64", "encoding", "of", "JSON", "content"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 257440}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/views.py#L127-L132", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update panel to a new version.", "language": "python", "parameters": "(panel_id)", "return_statement": "return redirect(url_for('panels.panel', panel_id=new_panel_id))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "store", ".", "panel", "(", "arg_0", ")", "arg_2", "=", "request", ".", "form", ".", "get", "(", "'version'", ",", "None", ")", "arg_3", "=", "store", ".", "apply_pending", "(", "arg_1", ",", "arg_2", ")", "return", "redirect", "(", "url_for", "(", "'panels.panel'", ",", "arg_0", "=", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Update panel to a new version.\"\"\"\n    arg_1 = store.panel(arg_0)\n    arg_2 = request.form.get('version', None)\n    arg_3 = store.apply_pending(arg_1, arg_2)\n    return redirect(url_for('panels.panel', arg_0=arg_3))", "path": "scout/server/blueprints/panels/views.py", "identifier": "panel_update", "docstring": "Update panel to a new version.", "docstring_tokens": ["Update", "panel", "to", "a", "new", "version", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257441}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L106-L121", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Write header into po file for specific lang.\n    Metadata are read from settings file.", "language": "python", "parameters": "(po_path, lang, header)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "open", "(", "arg_0", ",", "'w'", ")", "arg_3", ".", "write", "(", "arg_2", "+", "'\\n'", ")", "arg_3", ".", "write", "(", "'msgid \"\"'", "+", "'\\nmsgstr \"\"'", "+", "'\\n\"MIME-Version: '", "+", "settings", ".", "METADATA", "[", "'MIME-Version'", "]", "+", "r'\\n\"'", "'\\n\"Content-Type: '", "+", "settings", ".", "METADATA", "[", "'Content-Type'", "]", "+", "r'\\n\"'", "'\\n\"Content-Transfer-Encoding: '", "+", "settings", ".", "METADATA", "[", "'Content-Transfer-Encoding'", "]", "+", "r'\\n\"'", "'\\n\"Language: '", "+", "arg_1", "+", "r'\\n\"'", "+", "'\\n'", ")", "arg_3", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Write header into po file for specific lang.\n    Metadata are read from settings file.\n    \"\"\"\n    arg_3 = open(arg_0, 'w')\n    arg_3.write(arg_2 + '\\n')\n    arg_3.write(\n        'msgid \"\"' +\n        '\\nmsgstr \"\"' +\n        '\\n\"MIME-Version: ' + settings.METADATA['MIME-Version'] + r'\\n\"'\n        '\\n\"Content-Type: ' + settings.METADATA['Content-Type'] + r'\\n\"'\n        '\\n\"Content-Transfer-Encoding: ' +\n        settings.METADATA['Content-Transfer-Encoding'] + r'\\n\"'\n        '\\n\"Language: ' + arg_1 + r'\\n\"' + '\\n')\n    arg_3.close()", "path": "c3po/converters/po_csv.py", "identifier": "_write_header", "docstring": "Write header into po file for specific lang.\n    Metadata are read from settings file.", "docstring_tokens": ["Write", "header", "into", "po", "file", "for", "specific", "lang", ".", "Metadata", "are", "read", "from", "settings", "file", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 257442}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/abstractcpu.py#L973-L990", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Start executing in Unicorn from this point until we hit a syscall or reach break_unicorn_at", "language": "python", "parameters": "(self, insn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "emu", ":", "arg_0", ".", "emu", "=", "ConcreteUnicornEmulator", "(", "arg_0", ")", "arg_0", ".", "emu", ".", "_stop_at", "=", "arg_0", ".", "_break_unicorn_at", "try", ":", "arg_0", ".", "emu", ".", "emulate", "(", "arg_1", ")", "except", "unicorn", ".", "UcError", "as", "e", ":", "if", "e", ".", "errno", "==", "unicorn", ".", "UC_ERR_INSN_INVALID", ":", "arg_4", "=", "' '", ".", "join", "(", "'%02x'", "%", "x", "for", "x", "in", "arg_1", ".", "bytes", ")", "logger", ".", "error", "(", "\"Unimplemented instruction: 0x%016x:\\t%s\\t%s\\t%s\"", ",", "arg_1", ".", "address", ",", "arg_4", ",", "arg_1", ".", "mnemonic", ",", "arg_1", ".", "op_str", ")", "raise", "InstructionEmulationError", "(", "str", "(", "e", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Start executing in Unicorn from this point until we hit a syscall or reach break_unicorn_at\n\n        :param capstone.CsInsn insn: The instruction object to emulate\n        \"\"\"\n\n        if not arg_0.emu:\n            arg_0.emu = ConcreteUnicornEmulator(arg_0)\n            arg_0.emu._stop_at = arg_0._break_unicorn_at\n        try:\n            arg_0.emu.emulate(arg_1)\n        except unicorn.UcError as e:\n            if e.errno == unicorn.UC_ERR_INSN_INVALID:\n                arg_4 = ' '.join('%02x' % x for x in arg_1.bytes)\n                logger.error(\"Unimplemented instruction: 0x%016x:\\t%s\\t%s\\t%s\",\n                             arg_1.address, arg_4, arg_1.mnemonic, arg_1.op_str)\n            raise InstructionEmulationError(str(e))", "path": "manticore/native/cpu/abstractcpu.py", "identifier": "Cpu.concrete_emulate", "docstring": "Start executing in Unicorn from this point until we hit a syscall or reach break_unicorn_at\n\n        :param capstone.CsInsn insn: The instruction object to emulate", "docstring_tokens": ["Start", "executing", "in", "Unicorn", "from", "this", "point", "until", "we", "hit", "a", "syscall", "or", "reach", "break_unicorn_at"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257443}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L85-L108", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Return the multiprocessing.Pool instance or create it if not done yet.", "language": "python", "parameters": "(self)", "return_statement": "return self._pool", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Func", "is", "None", ":", "arg_1", "=", "arg_0", ".", "processes", "if", "arg_1", "is", "not", "None", "and", "arg_1", "<", "0", ":", "try", ":", "arg_1", "=", "multiprocessing", ".", "cpu_count", "(", ")", "-", "abs", "(", "arg_1", ")", "arg_1", "=", "max", "(", "arg_1", ",", "1", ")", "except", "(", "ImportError", ",", "NotImplementedError", ")", ":", "arg_1", "=", "None", "arg_0", ".", "_Func", "=", "multiprocessing", ".", "Pool", "(", "arg_1", ",", "initializer", "=", "_Pool_initialize_worker", ",", "initargs", "=", "(", "arg_0", ".", "augseq", ",", "arg_0", ".", "seed", ")", ",", "maxtasksperchild", "=", "arg_0", ".", "maxtasksperchild", ")", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"Return the multiprocessing.Pool instance or create it if not done yet.\n\n        Returns\n        -------\n        multiprocessing.Pool\n            The multiprocessing.Pool used internally by this imgaug.multicore.Pool.\n\n        \"\"\"\n        if arg_0._Func is None:\n            arg_1 = arg_0.processes\n            if arg_1 is not None and arg_1 < 0:\n                try:\n                    # cpu count includes the hyperthreads, e.g. 8 for 4 cores + hyperthreading\n                    arg_1 = multiprocessing.cpu_count() - abs(arg_1)\n                    arg_1 = max(arg_1, 1)\n                except (ImportError, NotImplementedError):\n                    arg_1 = None\n\n            arg_0._Func = multiprocessing.Pool(arg_1,\n                                              initializer=_Pool_initialize_worker,\n                                              initargs=(arg_0.augseq, arg_0.seed),\n                                              maxtasksperchild=arg_0.maxtasksperchild)\n        return arg_0._Func", "path": "imgaug/multicore.py", "identifier": "Pool.pool", "docstring": "Return the multiprocessing.Pool instance or create it if not done yet.\n\n        Returns\n        -------\n        multiprocessing.Pool\n            The multiprocessing.Pool used internally by this imgaug.multicore.Pool.", "docstring_tokens": ["Return", "the", "multiprocessing", ".", "Pool", "instance", "or", "create", "it", "if", "not", "done", "yet", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 257444}
{"url": "https://github.com/loanzen/probe-py/blob/b5dbb0dba26c9b451e9bf1dec9e1aaa7f42d75a5/probe/api_client.py#L334-L379", "sha": "b5dbb0dba26c9b451e9bf1dec9e1aaa7f42d75a5", "docstring_summary": "Makes the HTTP request using RESTClient.", "language": "python", "parameters": "(self, method, url, query_params=None, headers=None,\n                post_params=None, body=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "if", "arg_1", "==", "\"GET\"", ":", "return", "arg_0", ".", "rest_client", ".", "GET", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "elif", "arg_1", "==", "\"HEAD\"", ":", "return", "arg_0", ".", "rest_client", ".", "HEAD", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "elif", "arg_1", "==", "\"OPTIONS\"", ":", "return", "arg_0", ".", "rest_client", ".", "OPTIONS", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_1", "==", "\"POST\"", ":", "return", "arg_0", ".", "rest_client", ".", "POST", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_1", "==", "\"PUT\"", ":", "return", "arg_0", ".", "rest_client", ".", "PUT", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_1", "==", "\"PATCH\"", ":", "return", "arg_0", ".", "rest_client", ".", "PATCH", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "elif", "arg_1", "==", "\"DELETE\"", ":", "return", "arg_0", ".", "rest_client", ".", "DELETE", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "else", ":", "raise", "ValueError", "(", "\"http method must be `GET`, `HEAD`,\"", "\" `POST`, `PATCH`, `PUT` or `DELETE`.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,\n                arg_5=None, arg_6=None):\n        \"\"\"\n        Makes the HTTP Func using RESTClient.\n        \"\"\"\n        if arg_1 == \"GET\":\n            return arg_0.rest_client.GET(arg_2,\n                                        arg_3=arg_3,\n                                        arg_4=arg_4)\n        elif arg_1 == \"HEAD\":\n            return arg_0.rest_client.HEAD(arg_2,\n                                         arg_3=arg_3,\n                                         arg_4=arg_4)\n        elif arg_1 == \"OPTIONS\":\n            return arg_0.rest_client.OPTIONS(arg_2,\n                                            arg_3=arg_3,\n                                            arg_4=arg_4,\n                                            arg_5=arg_5,\n                                            arg_6=arg_6)\n        elif arg_1 == \"POST\":\n            return arg_0.rest_client.POST(arg_2,\n                                         arg_3=arg_3,\n                                         arg_4=arg_4,\n                                         arg_5=arg_5,\n                                         arg_6=arg_6)\n        elif arg_1 == \"PUT\":\n            return arg_0.rest_client.PUT(arg_2,\n                                        arg_3=arg_3,\n                                        arg_4=arg_4,\n                                        arg_5=arg_5,\n                                        arg_6=arg_6)\n        elif arg_1 == \"PATCH\":\n            return arg_0.rest_client.PATCH(arg_2,\n                                          arg_3=arg_3,\n                                          arg_4=arg_4,\n                                          arg_5=arg_5,\n                                          arg_6=arg_6)\n        elif arg_1 == \"DELETE\":\n            return arg_0.rest_client.DELETE(arg_2,\n                                           arg_3=arg_3,\n                                           arg_4=arg_4)\n        else:\n            raise ValueError(\n                \"http method must be `GET`, `HEAD`,\"\n                \" `POST`, `PATCH`, `PUT` or `DELETE`.\"\n            )", "path": "probe/api_client.py", "identifier": "ApiClient.request", "docstring": "Makes the HTTP request using RESTClient.", "docstring_tokens": ["Makes", "the", "HTTP", "request", "using", "RESTClient", "."], "nwo": "loanzen/probe-py", "score": 0.14991498758945482, "idx": 257445}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L92-L115", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Stable wrapper around inspect.getdoc.", "language": "python", "parameters": "(obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "Func", "(", ")", "except", "Exception", ":", "pass", "else", ":", "if", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "return", "inspect", ".", "cleandoc", "(", "arg_1", ")", "try", ":", "return", "inspect", ".", "Func", "(", "arg_0", ")", "except", "Exception", ":", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"Stable wrapper around inspect.Func.\n\n    This can't crash because of attribute problems.\n\n    It also attempts to call a Func() method on the given object.  This\n    allows objects which provide their docstrings via non-standard mechanisms\n    (like Pyro proxies) to still be inspected by ipython's ? system.\"\"\"\n    # Allow objects to offer customized documentation via a Func method:\n    try:\n        arg_1 = arg_0.Func()\n    except Exception:\n        pass\n    else:\n        # if we get extra info, we add it to the normal docstring.\n        if isinstance(arg_1, basestring):\n            return inspect.cleandoc(arg_1)\n    \n    try:\n        return inspect.Func(arg_0)\n    except Exception:\n        # Harden against an inspect failure, which can occur with\n        # SWIG-wrapped extensions.\n        return None", "path": "environment/lib/python2.7/site-packages/IPython/core/oinspect.py", "identifier": "getdoc", "docstring": "Stable wrapper around inspect.getdoc.\n\n    This can't crash because of attribute problems.\n\n    It also attempts to call a getdoc() method on the given object.  This\n    allows objects which provide their docstrings via non-standard mechanisms\n    (like Pyro proxies) to still be inspected by ipython's ? system.", "docstring_tokens": ["Stable", "wrapper", "around", "inspect", ".", "getdoc", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257446}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L621-L639", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Converts a %Y%m%dT%H%M%S.%fZ to a UNIX timestamp\n        or a datetime.datetime object", "language": "python", "parameters": "(self, timestamp: str, unix=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "datetime", ".", "strptime", "(", "arg_1", ",", "'%Y%m%dT%H%M%S.%fZ'", ")", "if", "arg_3", ":", "return", "int", "(", "arg_4", ".", "timestamp", "(", ")", ")", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1: arg_2, arg_3=True):\n        \"\"\"Converts a %Y%m%dT%H%M%S.%fZ to a UNIX timestamp\n        or a datetime.datetime object\n\n        Parameters\n        ---------\n        timestamp: str\n            A timstamp in the %Y%m%dT%H%M%S.%fZ format, usually returned by the API\n            in the ``created_time`` field for example (eg. 20180718T145906.000Z)\n        unix: Optional[bool] = True\n            Whether to return a POSIX timestamp (seconds since epoch) or not\n\n        Returns int or datetime.datetime\n        \"\"\"\n        arg_4 = datetime.strptime(arg_1, '%Y%m%dT%H%M%S.%fZ')\n        if arg_3:\n            return int(arg_4.timestamp())\n        else:\n            return arg_4", "path": "clashroyale/official_api/client.py", "identifier": "Client.get_datetime", "docstring": "Converts a %Y%m%dT%H%M%S.%fZ to a UNIX timestamp\n        or a datetime.datetime object\n\n        Parameters\n        ---------\n        timestamp: str\n            A timstamp in the %Y%m%dT%H%M%S.%fZ format, usually returned by the API\n            in the ``created_time`` field for example (eg. 20180718T145906.000Z)\n        unix: Optional[bool] = True\n            Whether to return a POSIX timestamp (seconds since epoch) or not\n\n        Returns int or datetime.datetime", "docstring_tokens": ["Converts", "a", "%Y%m%dT%H%M%S", ".", "%fZ", "to", "a", "UNIX", "timestamp", "or", "a", "datetime", ".", "datetime", "object"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 257447}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1210-L1229", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Return a squad.", "language": "python", "parameters": "(self, squad_id=0, persona_id=None)", "return_statement": "return [itemParse(i) for i in rc.get('players', ())]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "'GET'", "arg_4", "=", "'Func/%s/user/%s'", "%", "(", "arg_1", ",", "arg_2", "or", "arg_0", ".", "persona_id", ")", "arg_5", "=", "[", "arg_0", ".", "pin", ".", "event", "(", "'page_view'", ",", "'Hub - Squads'", ")", "]", "arg_0", ".", "pin", ".", "send", "(", "arg_5", ")", "arg_6", "=", "arg_0", ".", "__request__", "(", "arg_3", ",", "arg_4", ")", "arg_5", "=", "[", "arg_0", ".", "pin", ".", "event", "(", "'page_view'", ",", "'Squad Details'", ")", ",", "arg_0", ".", "pin", ".", "event", "(", "'page_view'", ",", "'Squads - Squad Overview'", ")", "]", "arg_0", ".", "pin", ".", "send", "(", "arg_5", ")", "return", "[", "itemParse", "(", "arg_7", ")", "for", "arg_7", "in", "arg_6", ".", "get", "(", "'players'", ",", "(", ")", ")", "]"], "function": "def Func(arg_0, arg_1=0, arg_2=None):\n        \"\"\"Return a Func.\n\n        :params Func_id: Squad id.\n        \"\"\"\n        arg_3 = 'GET'\n        arg_4 = 'Func/%s/user/%s' % (arg_1, arg_2 or arg_0.persona_id)\n\n        # pinEvents\n        arg_5 = [arg_0.pin.event('page_view', 'Hub - Squads')]\n        arg_0.pin.send(arg_5)\n\n        # TODO: ability to return other info than players only\n        arg_6 = arg_0.__request__(arg_3, arg_4)\n\n        # pinEvents\n        arg_5 = [arg_0.pin.event('page_view', 'Squad Details'), arg_0.pin.event('page_view', 'Squads - Squad Overview')]\n        arg_0.pin.send(arg_5)\n\n        return [itemParse(arg_7) for arg_7 in arg_6.get('players', ())]", "path": "fut/core.py", "identifier": "Core.squad", "docstring": "Return a squad.\n\n        :params squad_id: Squad id.", "docstring_tokens": ["Return", "a", "squad", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 257448}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/api_call.py#L146-L157", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Gets the configuration stored in environment variables", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'TSP_EMAIL'", "in", "os", ".", "environ", ":", "arg_0", ".", "_email", "=", "os", ".", "environ", "[", "'TSP_EMAIL'", "]", "if", "'TSP_API_TOKEN'", "in", "os", ".", "environ", ":", "arg_0", ".", "_api_token", "=", "os", ".", "environ", "[", "'TSP_API_TOKEN'", "]", "if", "'TSP_API_HOST'", "in", "os", ".", "environ", ":", "arg_0", ".", "_api_host", "=", "os", ".", "environ", "[", "'TSP_API_HOST'", "]", "else", ":", "arg_0", ".", "_api_host", "=", "'api.truesight.bmc.com'"], "function": "def Func(arg_0):\n        \"\"\"\n        Gets the configuration stored in environment variables\n        \"\"\"\n        if 'TSP_EMAIL' in os.environ:\n            arg_0._email = os.environ['TSP_EMAIL']\n        if 'TSP_API_TOKEN' in os.environ:\n            arg_0._api_token = os.environ['TSP_API_TOKEN']\n        if 'TSP_API_HOST' in os.environ:\n            arg_0._api_host = os.environ['TSP_API_HOST']\n        else:\n            arg_0._api_host = 'api.truesight.bmc.com'", "path": "boundary/api_call.py", "identifier": "ApiCall._get_environment", "docstring": "Gets the configuration stored in environment variables", "docstring_tokens": ["Gets", "the", "configuration", "stored", "in", "environment", "variables"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 257449}
{"url": "https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L314-L330", "sha": "9bb98ca9d24f2e4db651cf0590e4b47184546482", "docstring_summary": "Only available to institutional clients.\n            If ID is NOT provided, return array of available file_ids.\n            If ID is provided, provides URL which you can use to download your\n            file, as well as some metadata about that file.", "language": "python", "parameters": "(self, file_id=None, fmt='json')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'json'", ")", ":", "if", "arg_1", ":", "arg_3", "=", "\"tiingo/news/bulk_download/{}\"", ".", "format", "(", "arg_1", ")", "else", ":", "arg_3", "=", "\"tiingo/news/bulk_download\"", "arg_4", "=", "arg_0", ".", "_request", "(", "'GET'", ",", "arg_3", ")", "arg_5", "=", "arg_4", ".", "json", "(", ")", "if", "arg_2", "==", "'json'", ":", "return", "arg_5", "elif", "arg_2", "==", "'object'", ":", "return", "dict_to_object", "(", "arg_5", ",", "\"BulkNews\"", ")"], "function": "def Func(arg_0, arg_1=None, arg_2='json'):\n        \"\"\"Only available to institutional clients.\n            If ID is NOT provided, return array of available file_ids.\n            If ID is provided, provides URL which you can use to download your\n            file, as well as some metadata about that file.\n        \"\"\"\n        if arg_1:\n            arg_3 = \"tiingo/news/bulk_download/{}\".format(arg_1)\n        else:\n            arg_3 = \"tiingo/news/bulk_download\"\n\n        arg_4 = arg_0._request('GET', arg_3)\n        arg_5 = arg_4.json()\n        if arg_2 == 'json':\n            return arg_5\n        elif arg_2 == 'object':\n            return dict_to_object(arg_5, \"BulkNews\")", "path": "tiingo/api.py", "identifier": "TiingoClient.get_bulk_news", "docstring": "Only available to institutional clients.\n            If ID is NOT provided, return array of available file_ids.\n            If ID is provided, provides URL which you can use to download your\n            file, as well as some metadata about that file.", "docstring_tokens": ["Only", "available", "to", "institutional", "clients", ".", "If", "ID", "is", "NOT", "provided", "return", "array", "of", "available", "file_ids", ".", "If", "ID", "is", "provided", "provides", "URL", "which", "you", "can", "use", "to", "download", "your", "file", "as", "well", "as", "some", "metadata", "about", "that", "file", "."], "nwo": "hydrosquall/tiingo-python", "score": 0.7387968412755984, "idx": 257450}
{"url": "https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L237-L252", "sha": "2618f4da22a84ad3e36d2446e23436d87c423163", "docstring_summary": "Get the CR Constants", "language": "python", "parameters": "(self, **params: keys)", "return_statement": "return self._get_model(url, **params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "api", ".", "CONSTANTS", "return", "arg_0", ".", "_get_model", "(", "arg_3", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1: arg_2):\n        \"\"\"Get the CR Constants\n\n        Parameters\n        ----------\n        \\*\\*keys: Optional[list] = None\n            Filter which keys should be included in the\n            response\n        \\*\\*exclude: Optional[list] = None\n            Filter which keys should be excluded from the\n            response\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout\n        \"\"\"\n        arg_3 = arg_0.api.CONSTANTS\n        return arg_0._get_model(arg_3, **arg_1)", "path": "clashroyale/royaleapi/client.py", "identifier": "Client.get_constants", "docstring": "Get the CR Constants\n\n        Parameters\n        ----------\n        \\*\\*keys: Optional[list] = None\n            Filter which keys should be included in the\n            response\n        \\*\\*exclude: Optional[list] = None\n            Filter which keys should be excluded from the\n            response\n        \\*\\*timeout: Optional[int] = None\n            Custom timeout that overwrites Client.timeout", "docstring_tokens": ["Get", "the", "CR", "Constants"], "nwo": "cgrok/clashroyale", "score": 0.41137075276707913, "idx": 257451}
{"url": "https://github.com/ndokter/dsmr_parser/blob/c04b0a5add58ce70153eede1a87ca171876b61c7/dsmr_parser/__main__.py#L9-L65", "sha": "c04b0a5add58ce70153eede1a87ca171876b61c7", "docstring_summary": "Output DSMR data to console.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "Func", ".", "__doc__", ")", "arg_0", ".", "add_argument", "(", "'--device'", ",", "default", "=", "'/dev/ttyUSB0'", ",", "help", "=", "'port to read DSMR data from'", ")", "arg_0", ".", "add_argument", "(", "'--host'", ",", "default", "=", "None", ",", "help", "=", "'alternatively connect using TCP host.'", ")", "arg_0", ".", "add_argument", "(", "'--port'", ",", "default", "=", "None", ",", "help", "=", "'TCP port to use for connection'", ")", "arg_0", ".", "add_argument", "(", "'--version'", ",", "default", "=", "'2.2'", ",", "choices", "=", "[", "'2.2'", ",", "'4'", "]", ",", "help", "=", "'DSMR version (2.2, 4)'", ")", "arg_0", ".", "add_argument", "(", "'--verbose'", ",", "'-v'", ",", "action", "=", "'count'", ")", "arg_1", "=", "arg_0", ".", "parse_args", "(", ")", "if", "arg_1", ".", "verbose", ":", "arg_2", "=", "logging", ".", "DEBUG", "else", ":", "arg_2", "=", "logging", ".", "ERROR", "logging", ".", "basicConfig", "(", "arg_2", "=", "arg_2", ")", "arg_3", "=", "asyncio", ".", "get_event_loop", "(", ")", "def", "print_callback", "(", "arg_4", ")", ":", "for", "arg_5", ",", "arg_6", "in", "arg_4", ".", "items", "(", ")", ":", "if", "arg_6", ":", "print", "(", "arg_6", ".", "value", ",", "arg_6", ".", "unit", ")", "print", "(", ")", "if", "arg_1", ".", "host", "and", "arg_1", ".", "port", ":", "arg_7", "=", "partial", "(", "create_tcp_dsmr_reader", ",", "arg_1", ".", "host", ",", "arg_1", ".", "port", ",", "arg_1", ".", "version", ",", "print_callback", ",", "arg_3", "=", "arg_3", ")", "else", ":", "arg_7", "=", "partial", "(", "create_dsmr_reader", ",", "arg_1", ".", "device", ",", "arg_1", ".", "version", ",", "print_callback", ",", "arg_3", "=", "arg_3", ")", "try", ":", "while", "True", ":", "arg_8", "=", "arg_7", "(", ")", "arg_9", ",", "arg_10", "=", "arg_3", ".", "run_until_complete", "(", "arg_8", ")", "arg_3", ".", "run_until_complete", "(", "arg_10", ".", "wait_closed", "(", ")", ")", "arg_3", ".", "run_until_complete", "(", "asyncio", ".", "sleep", "(", "5", ")", ")", "except", "KeyboardInterrupt", ":", "arg_9", ".", "close", "(", ")", "arg_3", ".", "run_until_complete", "(", "asyncio", ".", "sleep", "(", "0", ")", ")", "finally", ":", "arg_3", ".", "close", "(", ")"], "function": "def Func():\n    \"\"\"Output DSMR data to Func.\"\"\"\n\n    arg_0 = argparse.ArgumentParser(description=Func.__doc__)\n    arg_0.add_argument('--device', default='/dev/ttyUSB0',\n                        help='port to read DSMR data from')\n    arg_0.add_argument('--host', default=None,\n                        help='alternatively connect using TCP host.')\n    arg_0.add_argument('--port', default=None,\n                        help='TCP port to use for connection')\n    arg_0.add_argument('--version', default='2.2', choices=['2.2', '4'],\n                        help='DSMR version (2.2, 4)')\n    arg_0.add_argument('--verbose', '-v', action='count')\n\n    arg_1 = arg_0.parse_args()\n\n    if arg_1.verbose:\n        arg_2 = logging.DEBUG\n    else:\n        arg_2 = logging.ERROR\n    logging.basicConfig(arg_2=arg_2)\n\n    arg_3 = asyncio.get_event_loop()\n\n    def print_callback(arg_4):\n        \"\"\"Callback that prints telegram values.\"\"\"\n        for arg_5, arg_6 in arg_4.items():\n            if arg_6:\n                print(arg_6.value, arg_6.unit)\n        print()\n\n    # create tcp or serial connection depending on args\n    if arg_1.host and arg_1.port:\n        arg_7 = partial(create_tcp_dsmr_reader,\n                                    arg_1.host, arg_1.port, arg_1.version,\n                                    print_callback, arg_3=arg_3)\n    else:\n        arg_7 = partial(create_dsmr_reader,\n                                    arg_1.device, arg_1.version,\n                                    print_callback, arg_3=arg_3)\n\n    try:\n        # connect and keep connected until interrupted by ctrl-c\n        while True:\n            # create serial or tcp connection\n            arg_8 = arg_7()\n            arg_9, arg_10 = arg_3.run_until_complete(arg_8)\n            # wait until connection it closed\n            arg_3.run_until_complete(arg_10.wait_closed())\n            # wait 5 seconds before attempting reconnect\n            arg_3.run_until_complete(asyncio.sleep(5))\n    except KeyboardInterrupt:\n        # cleanup connection after user initiated shutdown\n        arg_9.close()\n        arg_3.run_until_complete(asyncio.sleep(0))\n    finally:\n        arg_3.close()", "path": "dsmr_parser/__main__.py", "identifier": "console", "docstring": "Output DSMR data to console.", "docstring_tokens": ["Output", "DSMR", "data", "to", "console", "."], "nwo": "ndokter/dsmr_parser", "score": 0.6430124594429737, "idx": 257452}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/context/glfw/window.py#L107-L114", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Sets the new size and buffer size internally", "language": "python", "parameters": "(self, width, height)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "width", "=", "arg_1", "arg_0", ".", "height", "=", "arg_2", "arg_0", ".", "buffer_width", ",", "arg_0", ".", "buffer_height", "=", "glfw", ".", "get_framebuffer_size", "(", "arg_0", ".", "window", ")", "arg_0", ".", "set_default_viewport", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Sets the new size and buffer size internally\n        \"\"\"\n        arg_0.width = arg_1\n        arg_0.height = arg_2\n        arg_0.buffer_width, arg_0.buffer_height = glfw.get_framebuffer_size(arg_0.window)\n        arg_0.set_default_viewport()", "path": "demosys/context/glfw/window.py", "identifier": "Window.resize", "docstring": "Sets the new size and buffer size internally", "docstring_tokens": ["Sets", "the", "new", "size", "and", "buffer", "size", "internally"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 257453}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1658-L1684", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a Python AST Node for a `throw` expression.", "language": "python", "parameters": "(ctx: GeneratorContext, node: Throw)", "return_statement": "return GeneratedPyAST(\n        node=ast.Call(func=ast.Name(id=throw_fn, ctx=ast.Load()), args=[], keywords=[]),\n        dependencies=[\n            ast.FunctionDef(\n                name=throw_fn,\n                args=ast.arguments(\n                    args=[],\n                    kwarg=None,\n                    vararg=None,\n                    kwonlyargs=[],\n                    defaults=[],\n                    kw_defaults=[],\n                ),\n                body=list(chain(exc_ast.dependencies, [raise_body])),\n                decorator_list=[],\n                returns=None,\n            )\n        ],\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "THROW", "arg_4", "=", "genname", "(", "_THROW_PREFIX", ")", "arg_5", "=", "gen_py_ast", "(", "arg_0", ",", "arg_2", ".", "exception", ")", "arg_6", "=", "ast", ".", "Raise", "(", "exc", "=", "arg_5", ".", "node", ",", "cause", "=", "None", ")", "return", "GeneratedPyAST", "(", "arg_2", "=", "ast", ".", "Call", "(", "func", "=", "ast", ".", "Name", "(", "id", "=", "arg_4", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", ",", "args", "=", "[", "]", ",", "keywords", "=", "[", "]", ")", ",", "dependencies", "=", "[", "ast", ".", "FunctionDef", "(", "name", "=", "arg_4", ",", "args", "=", "ast", ".", "arguments", "(", "args", "=", "[", "]", ",", "kwarg", "=", "None", ",", "vararg", "=", "None", ",", "kwonlyargs", "=", "[", "]", ",", "defaults", "=", "[", "]", ",", "kw_defaults", "=", "[", "]", ",", ")", ",", "body", "=", "list", "(", "chain", "(", "arg_5", ".", "dependencies", ",", "[", "arg_6", "]", ")", ")", ",", "decorator_list", "=", "[", "]", ",", "returns", "=", "None", ",", ")", "]", ",", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:\n    \"\"\"Return a Python AST Node for a `throw` expression.\"\"\"\n    assert arg_2.op == NodeOp.THROW\n\n    arg_4 = genname(_THROW_PREFIX)\n    arg_5 = gen_py_ast(arg_0, arg_2.exception)\n    arg_6 = ast.Raise(exc=arg_5.node, cause=None)\n\n    return GeneratedPyAST(\n        arg_2=ast.Call(func=ast.Name(id=arg_4, arg_0=ast.Load()), args=[], keywords=[]),\n        dependencies=[\n            ast.FunctionDef(\n                name=arg_4,\n                args=ast.arguments(\n                    args=[],\n                    kwarg=None,\n                    vararg=None,\n                    kwonlyargs=[],\n                    defaults=[],\n                    kw_defaults=[],\n                ),\n                body=list(chain(arg_5.dependencies, [arg_6])),\n                decorator_list=[],\n                returns=None,\n            )\n        ],\n    )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_throw_to_py_ast", "docstring": "Return a Python AST Node for a `throw` expression.", "docstring_tokens": ["Return", "a", "Python", "AST", "Node", "for", "a", "throw", "expression", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 257454}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L668-L677", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Create a new membership.", "language": "python", "parameters": "(cls, group, user, state=MembershipState.ACTIVE)", "return_statement": "return membership", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "ACTIVE", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "arg_6", "=", "arg_0", "(", "user_id", "=", "arg_2", ".", "get_id", "(", ")", ",", "id_group", "=", "arg_1", ".", "id", ",", "arg_3", "=", "arg_3", ",", ")", "db", ".", "session", ".", "add", "(", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4.ACTIVE):\n        \"\"\"Create a new membership.\"\"\"\n        with db.session.begin_nested():\n            arg_6 = arg_0(\n                user_id=arg_2.get_id(),\n                id_group=arg_1.id,\n                arg_3=arg_3,\n            )\n            db.session.add(arg_6)\n        return arg_6", "path": "invenio_groups/models.py", "identifier": "Membership.create", "docstring": "Create a new membership.", "docstring_tokens": ["Create", "a", "new", "membership", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 257455}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L362-L374", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "List the public users in the system.", "language": "python", "parameters": "(self, limit=20)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "20", ")", ":", "arg_2", "=", "dict", "(", ")", "arg_2", "[", "'limit'", "]", "=", "arg_1", "arg_3", "=", "arg_0", ".", "request", "(", "'midas.user.list'", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=20):\n        \"\"\"\n        List the public users in the system.\n\n        :param limit: (optional) The number of users to fetch.\n        :type limit: int | long\n        :returns: The list of users.\n        :rtype: list[dict]\n        \"\"\"\n        arg_2 = dict()\n        arg_2['limit'] = arg_1\n        arg_3 = arg_0.request('midas.user.list', arg_2)\n        return arg_3", "path": "pydas/drivers.py", "identifier": "CoreDriver.list_users", "docstring": "List the public users in the system.\n\n        :param limit: (optional) The number of users to fetch.\n        :type limit: int | long\n        :returns: The list of users.\n        :rtype: list[dict]", "docstring_tokens": ["List", "the", "public", "users", "in", "the", "system", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 257456}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/compiler/block.py#L121-L124", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Release the GeneratedTempVar v so it can be reused.", "language": "python", "parameters": "(self, v)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "used_temps", ".", "remove", "(", "arg_1", ")", "arg_0", ".", "Funcs", ".", "add", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Release the GeneratedTempVar v so it can be reused.\"\"\"\n    arg_0.used_temps.remove(arg_1)\n    arg_0.Funcs.add(arg_1)", "path": "compiler/block.py", "identifier": "Block.free_temp", "docstring": "Release the GeneratedTempVar v so it can be reused.", "docstring_tokens": ["Release", "the", "GeneratedTempVar", "v", "so", "it", "can", "be", "reused", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257457}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/trainable_distributions/trainable_distributions_lib.py#L92-L197", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Constructs a trainable `tfd.MultivariateNormalTriL` distribution.", "language": "python", "parameters": "(x,\n                             dims,\n                             layer_fn=tf.compat.v1.layers.dense,\n                             loc_fn=lambda x: x,\n                             scale_fn=tril_with_diag_softplus_and_shift,\n                             name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "compat", ".", "v1", ".", "layers", ".", "dense", ",", "arg_8", "=", "lambda", "arg_0", ":", "arg_0", ",", "arg_9", "=", "arg_10", ",", "arg_11", "=", "None", ")", ":", "with", "arg_3", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_11", ",", "'Func'", ",", "[", "arg_0", ",", "arg_1", "]", ")", ":", "arg_0", "=", "arg_3", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_11", "=", "'x'", ")", "arg_0", "=", "arg_2", "(", "arg_0", ",", "arg_1", "+", "arg_1", "*", "(", "arg_1", "+", "1", ")", "//", "2", ")", "return", "tfd", ".", "MultivariateNormalTriL", "(", "loc", "=", "arg_8", "(", "arg_0", "[", "...", ",", ":", "arg_1", "]", ")", ",", "scale_tril", "=", "arg_9", "(", "arg_0", "[", "...", ",", "arg_1", ":", "]", ")", ")"], "function": "def Func(arg_0,\n                             arg_1,\n                             arg_2=arg_3.compat.v1.layers.dense,\n                             arg_8=lambda arg_0: arg_0,\n                             arg_9=arg_10,\n                             arg_11=None):\n  \"\"\"Constructs a trainable `tfd.MultivariateNormalTriL` distribution.\n\n  This function creates a MultivariateNormal (MVN) with lower-triangular scale\n  matrix. By default the MVN is parameterized via affine transformation of input\n  tensor `x`. Using default args, this function is mathematically equivalent to:\n\n  ```none\n  Y = MVN(loc=matmul(W, x) + b,\n          scale_tril=f(reshape_tril(matmul(M, x) + c)))\n\n  where,\n    W in R^[d, n]\n    M in R^[d*(d+1)/2, n]\n    b in R^d\n    c in R^d\n    f(S) = set_diag(S, softplus(matrix_diag_part(S)) + 1e-5)\n  ```\n\n  Observe that `f` makes the diagonal of the triangular-lower scale matrix be\n  positive and no smaller than `1e-5`.\n\n  #### Examples\n\n  ```python\n  # This example fits a multilinear regression loss.\n  import tensorflow as tf\n  import tensorflow_probability as tfp\n\n  # Create fictitious training data.\n  dtype = np.float32\n  n = 3000    # number of samples\n  x_size = 4  # size of single x\n  y_size = 2  # size of single y\n  def make_training_data():\n    np.random.seed(142)\n    x = np.random.randn(n, x_size).astype(dtype)\n    w = np.random.randn(x_size, y_size).astype(dtype)\n    b = np.random.randn(1, y_size).astype(dtype)\n    true_mean = np.tensordot(x, w, axes=[[-1], [0]]) + b\n    noise = np.random.randn(n, y_size).astype(dtype)\n    y = true_mean + noise\n    return y, x\n  y, x = make_training_data()\n\n  # Build TF graph for fitting MVNTriL maximum likelihood estimator.\n  mvn = tfp.trainable_distributions.Func(x, dims=y_size)\n  loss = -tf.reduce_mean(mvn.log_prob(y))\n  train_op = tf.train.AdamOptimizer(learning_rate=2.**-3).minimize(loss)\n  mse = tf.reduce_mean(tf.squared_difference(y, mvn.mean()))\n  init_op = tf.global_variables_initializer()\n\n  # Run graph 1000 times.\n  num_steps = 1000\n  loss_ = np.zeros(num_steps)   # Style: `_` to indicate sess.run result.\n  mse_ = np.zeros(num_steps)\n  with tf.Session() as sess:\n    sess.run(init_op)\n    for it in xrange(loss_.size):\n      _, loss_[it], mse_[it] = sess.run([train_op, loss, mse])\n      if it % 200 == 0 or it == loss_.size - 1:\n        print(\"iteration:{}  loss:{}  mse:{}\".format(it, loss_[it], mse_[it]))\n\n  # ==> iteration:0    loss:38.2020797729  mse:4.17175960541\n  #     iteration:200  loss:2.90179634094  mse:0.990987896919\n  #     iteration:400  loss:2.82727336884  mse:0.990926623344\n  #     iteration:600  loss:2.82726788521  mse:0.990926682949\n  #     iteration:800  loss:2.82726788521  mse:0.990926682949\n  #     iteration:999  loss:2.82726788521  mse:0.990926682949\n  ```\n\n  Args:\n    x: `Tensor` with floating type. Must have statically defined rank and\n      statically known right-most dimension.\n    dims: Scalar, `int`, `Tensor` indicated the MVN event size, i.e., the\n      created MVN will be distribution over length-`dims` vectors.\n    layer_fn: Python `callable` which takes input `x` and `int` scalar `d` and\n      returns a transformation of `x` with shape\n      `tf.concat([tf.shape(x)[:-1], [d]], axis=0)`.\n      Default value: `tf.layers.dense`.\n    loc_fn: Python `callable` which transforms the `loc` parameter. Takes a\n      (batch of) length-`dims` vectors and returns a `Tensor` of same shape and\n      `dtype`.\n      Default value: `lambda x: x`.\n    scale_fn: Python `callable` which transforms the `scale` parameters. Takes a\n      (batch of) length-`dims * (dims + 1) / 2` vectors and returns a\n      lower-triangular `Tensor` of same batch shape with rightmost dimensions\n      having shape `[dims, dims]`.\n      Default value: `tril_with_diag_softplus_and_shift`.\n    name: A `name_scope` name for operations created by this function.\n      Default value: `None` (i.e., \"Func\").\n\n  Returns:\n    mvntril: An instance of `tfd.MultivariateNormalTriL`.\n  \"\"\"\n  with arg_3.compat.v1.name_scope(arg_11, 'Func', [arg_0, arg_1]):\n    arg_0 = arg_3.convert_to_tensor(value=arg_0, arg_11='x')\n    arg_0 = arg_2(arg_0, arg_1 + arg_1 * (arg_1 + 1) // 2)\n    return tfd.MultivariateNormalTriL(\n        loc=arg_8(arg_0[..., :arg_1]),\n        scale_tril=arg_9(arg_0[..., arg_1:]))", "path": "tensorflow_probability/python/trainable_distributions/trainable_distributions_lib.py", "identifier": "multivariate_normal_tril", "docstring": "Constructs a trainable `tfd.MultivariateNormalTriL` distribution.\n\n  This function creates a MultivariateNormal (MVN) with lower-triangular scale\n  matrix. By default the MVN is parameterized via affine transformation of input\n  tensor `x`. Using default args, this function is mathematically equivalent to:\n\n  ```none\n  Y = MVN(loc=matmul(W, x) + b,\n          scale_tril=f(reshape_tril(matmul(M, x) + c)))\n\n  where,\n    W in R^[d, n]\n    M in R^[d*(d+1)/2, n]\n    b in R^d\n    c in R^d\n    f(S) = set_diag(S, softplus(matrix_diag_part(S)) + 1e-5)\n  ```\n\n  Observe that `f` makes the diagonal of the triangular-lower scale matrix be\n  positive and no smaller than `1e-5`.\n\n  #### Examples\n\n  ```python\n  # This example fits a multilinear regression loss.\n  import tensorflow as tf\n  import tensorflow_probability as tfp\n\n  # Create fictitious training data.\n  dtype = np.float32\n  n = 3000    # number of samples\n  x_size = 4  # size of single x\n  y_size = 2  # size of single y\n  def make_training_data():\n    np.random.seed(142)\n    x = np.random.randn(n, x_size).astype(dtype)\n    w = np.random.randn(x_size, y_size).astype(dtype)\n    b = np.random.randn(1, y_size).astype(dtype)\n    true_mean = np.tensordot(x, w, axes=[[-1], [0]]) + b\n    noise = np.random.randn(n, y_size).astype(dtype)\n    y = true_mean + noise\n    return y, x\n  y, x = make_training_data()\n\n  # Build TF graph for fitting MVNTriL maximum likelihood estimator.\n  mvn = tfp.trainable_distributions.multivariate_normal_tril(x, dims=y_size)\n  loss = -tf.reduce_mean(mvn.log_prob(y))\n  train_op = tf.train.AdamOptimizer(learning_rate=2.**-3).minimize(loss)\n  mse = tf.reduce_mean(tf.squared_difference(y, mvn.mean()))\n  init_op = tf.global_variables_initializer()\n\n  # Run graph 1000 times.\n  num_steps = 1000\n  loss_ = np.zeros(num_steps)   # Style: `_` to indicate sess.run result.\n  mse_ = np.zeros(num_steps)\n  with tf.Session() as sess:\n    sess.run(init_op)\n    for it in xrange(loss_.size):\n      _, loss_[it], mse_[it] = sess.run([train_op, loss, mse])\n      if it % 200 == 0 or it == loss_.size - 1:\n        print(\"iteration:{}  loss:{}  mse:{}\".format(it, loss_[it], mse_[it]))\n\n  # ==> iteration:0    loss:38.2020797729  mse:4.17175960541\n  #     iteration:200  loss:2.90179634094  mse:0.990987896919\n  #     iteration:400  loss:2.82727336884  mse:0.990926623344\n  #     iteration:600  loss:2.82726788521  mse:0.990926682949\n  #     iteration:800  loss:2.82726788521  mse:0.990926682949\n  #     iteration:999  loss:2.82726788521  mse:0.990926682949\n  ```\n\n  Args:\n    x: `Tensor` with floating type. Must have statically defined rank and\n      statically known right-most dimension.\n    dims: Scalar, `int`, `Tensor` indicated the MVN event size, i.e., the\n      created MVN will be distribution over length-`dims` vectors.\n    layer_fn: Python `callable` which takes input `x` and `int` scalar `d` and\n      returns a transformation of `x` with shape\n      `tf.concat([tf.shape(x)[:-1], [d]], axis=0)`.\n      Default value: `tf.layers.dense`.\n    loc_fn: Python `callable` which transforms the `loc` parameter. Takes a\n      (batch of) length-`dims` vectors and returns a `Tensor` of same shape and\n      `dtype`.\n      Default value: `lambda x: x`.\n    scale_fn: Python `callable` which transforms the `scale` parameters. Takes a\n      (batch of) length-`dims * (dims + 1) / 2` vectors and returns a\n      lower-triangular `Tensor` of same batch shape with rightmost dimensions\n      having shape `[dims, dims]`.\n      Default value: `tril_with_diag_softplus_and_shift`.\n    name: A `name_scope` name for operations created by this function.\n      Default value: `None` (i.e., \"multivariate_normal_tril\").\n\n  Returns:\n    mvntril: An instance of `tfd.MultivariateNormalTriL`.", "docstring_tokens": ["Constructs", "a", "trainable", "tfd", ".", "MultivariateNormalTriL", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257458}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L324-L346", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "update the list of completion and hilight the currently selected completion", "language": "python", "parameters": "(self, hilight=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_0", ".", "_sliding_interval", ".", "current", "=", "arg_0", ".", "_index", "[", "0", "]", "arg_4", "=", "None", "arg_5", "=", "None", "if", "arg_0", ".", "_sliding_interval", ".", "start", ">", "0", ":", "arg_4", "=", "'...'", "if", "arg_0", ".", "_sliding_interval", ".", "stop", "<", "arg_0", ".", "_sliding_interval", ".", "_max", ":", "arg_5", "=", "'...'", "arg_6", "=", "arg_0", ".", "_justified_items", "[", "arg_0", ".", "_sliding_interval", ".", "start", ":", "arg_0", ".", "_sliding_interval", ".", "stop", "+", "1", "]", "arg_0", ".", "_console_widget", ".", "_clear_temporary_buffer", "(", ")", "if", "(", "arg_1", ")", ":", "arg_7", "=", "(", "arg_0", ".", "_sliding_interval", ".", "nth", ",", "arg_0", ".", "_index", "[", "1", "]", ")", "else", ":", "arg_7", "=", "None", "arg_8", "=", "html_tableify", "(", "arg_6", ",", "select", "=", "arg_7", ",", "header", "=", "arg_4", ",", "footer", "=", "arg_5", ")", "arg_0", ".", "_console_widget", ".", "_fill_temporary_buffer", "(", "arg_0", ".", "_old_cursor", ",", "arg_8", ",", "html", "=", "True", ")"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\" update the list of completion and hilight the currently selected completion \"\"\"\n        arg_0._sliding_interval.current = arg_0._index[0]\n        arg_4 = None\n        arg_5 = None\n        if arg_0._sliding_interval.start > 0 : \n            arg_4 = '...'\n\n        if arg_0._sliding_interval.stop < arg_0._sliding_interval._max:\n            arg_5 = '...'\n        arg_6 = arg_0._justified_items[\\\n                       arg_0._sliding_interval.start:\\\n                       arg_0._sliding_interval.stop+1\\\n                                       ]\n\n        arg_0._console_widget._clear_temporary_buffer()\n        if(arg_1):\n            arg_7 = (arg_0._sliding_interval.nth, arg_0._index[1])\n        else :\n            arg_7 = None\n\n        arg_8 = html_tableify(arg_6, select=arg_7, header=arg_4, footer=arg_5)\n        arg_0._console_widget._fill_temporary_buffer(arg_0._old_cursor, arg_8, html=True)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py", "identifier": "CompletionHtml._update_list", "docstring": "update the list of completion and hilight the currently selected completion", "docstring_tokens": ["update", "the", "list", "of", "completion", "and", "hilight", "the", "currently", "selected", "completion"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257459}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/workflow.py#L196-L209", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Runs the task with the given id.", "language": "python", "parameters": "(self, task_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "WorkflowException", "(", "arg_0", ".", "spec", ",", "'task_id is None'", ")", "for", "arg_2", "in", "arg_0", ".", "task_tree", ":", "if", "arg_2", ".", "id", "==", "arg_1", ":", "return", "arg_2", ".", "complete", "(", ")", "arg_3", "=", "'A task with the given task_id (%s) was not found'", "%", "arg_1", "raise", "WorkflowException", "(", "arg_0", ".", "spec", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Runs the task with the given id.\n\n        :type  task_id: integer\n        :param task_id: The id of the Task object.\n        \"\"\"\n        if arg_1 is None:\n            raise WorkflowException(arg_0.spec, 'task_id is None')\n        for arg_2 in arg_0.task_tree:\n            if arg_2.id == arg_1:\n                return arg_2.complete()\n        arg_3 = 'A task with the given task_id (%s) was not found' % arg_1\n        raise WorkflowException(arg_0.spec, arg_3)", "path": "SpiffWorkflow/workflow.py", "identifier": "Workflow.complete_task_from_id", "docstring": "Runs the task with the given id.\n\n        :type  task_id: integer\n        :param task_id: The id of the Task object.", "docstring_tokens": ["Runs", "the", "task", "with", "the", "given", "id", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 257460}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/warn.py#L25-L47", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Standard warning printer. Gives formatting consistency.", "language": "python", "parameters": "(msg,level=2,exit_val=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", ",", "arg_2", "=", "1", ")", ":", "if", "arg_1", ">", "0", ":", "arg_3", "=", "[", "''", ",", "''", ",", "'WARNING: '", ",", "'ERROR: '", ",", "'FATAL ERROR: '", "]", "io", ".", "stderr", ".", "write", "(", "'%s%s'", "%", "(", "arg_3", "[", "arg_1", "]", ",", "arg_0", ")", ")", "if", "arg_1", "==", "4", ":", "print", ">>", "io", ".", "stderr", ",", "'Exiting.\\n'", "sys", ".", "exit", "(", "arg_2", ")"], "function": "def Func(arg_0,arg_1=2,arg_2=1):\n    \"\"\"Standard Funcing printer. Gives formatting consistency.\n\n    Output is sent to io.stderr (sys.stderr by default).\n\n    Options:\n\n    -level(2): allows finer control:\n      0 -> Do nothing, dummy function.\n      1 -> Print message.\n      2 -> Print 'WARNING:' + message. (Default level).\n      3 -> Print 'ERROR:' + message.\n      4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).\n\n    -exit_val (1): exit value returned by sys.exit() for a level 4\n    Funcing. Ignored for all other levels.\"\"\"\n\n    if arg_1>0:\n        arg_3 = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']\n        io.stderr.write('%s%s' % (arg_3[arg_1],arg_0))\n        if arg_1 == 4:\n            print >> io.stderr,'Exiting.\\n'\n            sys.exit(arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/utils/warn.py", "identifier": "warn", "docstring": "Standard warning printer. Gives formatting consistency.\n\n    Output is sent to io.stderr (sys.stderr by default).\n\n    Options:\n\n    -level(2): allows finer control:\n      0 -> Do nothing, dummy function.\n      1 -> Print message.\n      2 -> Print 'WARNING:' + message. (Default level).\n      3 -> Print 'ERROR:' + message.\n      4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).\n\n    -exit_val (1): exit value returned by sys.exit() for a level 4\n    warning. Ignored for all other levels.", "docstring_tokens": ["Standard", "warning", "printer", ".", "Gives", "formatting", "consistency", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257461}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L231-L258", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Determines the downside deviation below a threshold", "language": "python", "parameters": "(returns, required_return=0, period=DAILY)", "return_statement": "return ep.downside_risk(returns,\n                            required_return=required_return,\n                            period=period)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "arg_3", ")", ":", "return", "ep", ".", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=arg_3):\n    \"\"\"\n    Determines the downside deviation below a threshold\n\n    Parameters\n    ----------\n    returns : pd.Series or pd.DataFrame\n        Daily returns of the strategy, noncumulative.\n        - See full explanation in :func:`~pyfolio.timeseries.cum_returns`.\n    required_return: float / series\n        minimum acceptable return\n    period : str, optional\n        Defines the periodicity of the 'returns' data for purposes of\n        annualizing. Can be 'monthly', 'weekly', or 'daily'.\n        - Defaults to 'daily'.\n\n    Returns\n    -------\n    depends on input type\n    series ==> float\n    DataFrame ==> np.array\n\n        Annualized downside deviation\n    \"\"\"\n\n    return ep.Func(arg_0,\n                            arg_1=arg_1,\n                            arg_2=arg_2)", "path": "pyfolio/timeseries.py", "identifier": "downside_risk", "docstring": "Determines the downside deviation below a threshold\n\n    Parameters\n    ----------\n    returns : pd.Series or pd.DataFrame\n        Daily returns of the strategy, noncumulative.\n        - See full explanation in :func:`~pyfolio.timeseries.cum_returns`.\n    required_return: float / series\n        minimum acceptable return\n    period : str, optional\n        Defines the periodicity of the 'returns' data for purposes of\n        annualizing. Can be 'monthly', 'weekly', or 'daily'.\n        - Defaults to 'daily'.\n\n    Returns\n    -------\n    depends on input type\n    series ==> float\n    DataFrame ==> np.array\n\n        Annualized downside deviation", "docstring_tokens": ["Determines", "the", "downside", "deviation", "below", "a", "threshold"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257462}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L401-L408", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Give all the intervals or points.", "language": "python", "parameters": "(self, sort=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "intervals", ")", "if", "arg_1", "else", "arg_0", ".", "intervals", ":", "yield", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Give all the intervals or points.\n\n        :param bool sort: Flag for yielding the intervals or points sorted.\n        :yields: All the intervals\n        \"\"\"\n        for arg_2 in sorted(arg_0.intervals) if arg_1 else arg_0.intervals:\n            yield arg_2", "path": "pympi/Praat.py", "identifier": "Tier.get_intervals", "docstring": "Give all the intervals or points.\n\n        :param bool sort: Flag for yielding the intervals or points sorted.\n        :yields: All the intervals", "docstring_tokens": ["Give", "all", "the", "intervals", "or", "points", "."], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 257463}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/sequence.py#L961-L1021", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Construct a cyclic transition matrix over `n_states`.", "language": "python", "parameters": "(n_states, prob)", "return_statement": "return transition", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "int", ")", "or", "arg_0", "<=", "1", ":", "raise", "ParameterError", "(", "'n_states={} must be a positive integer > 1'", ")", "arg_2", "=", "arg_5", ".", "zeros", "(", "(", "arg_0", ",", "arg_0", ")", ",", "dtype", "=", "arg_5", ".", "float", ")", "arg_1", "=", "arg_5", ".", "asarray", "(", "arg_1", ",", "dtype", "=", "arg_5", ".", "float", ")", "if", "arg_1", ".", "ndim", "==", "0", ":", "arg_1", "=", "arg_5", ".", "tile", "(", "arg_1", ",", "arg_0", ")", "if", "arg_1", ".", "shape", "!=", "(", "arg_0", ",", ")", ":", "raise", "ParameterError", "(", "'prob={} must have length equal to n_states={}'", ".", "format", "(", "arg_1", ",", "arg_0", ")", ")", "if", "arg_5", ".", "any", "(", "arg_1", "<", "0", ")", "or", "arg_5", ".", "any", "(", "arg_1", ">", "1", ")", ":", "raise", "ParameterError", "(", "'prob={} must have values in the range [0, 1]'", ".", "format", "(", "arg_1", ")", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ")", ":", "arg_2", "[", "arg_3", ",", "arg_5", ".", "mod", "(", "arg_3", "+", "1", ",", "arg_0", ")", "]", "=", "1.", "-", "arg_4", "arg_2", "[", "arg_3", ",", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''Construct a cyclic transition matrix over `n_states`.\n\n    The transition matrix will have the following properties:\n\n        - `transition[i, i] = p`\n        - `transition[i, i + 1] = (1 - p)`\n\n    This type of transition matrix is appropriate for state spaces\n    with cyclical structure, such as metrical position within a bar.\n    For example, a song in 4/4 time has state transitions of the form\n\n        1->{1, 2}, 2->{2, 3}, 3->{3, 4}, 4->{4, 1}.\n\n    Parameters\n    ----------\n    n_states : int > 1\n        The number of states\n\n    prob : float in [0, 1] or iterable, length=n_states\n        If a scalar, this is the probability of a self-transition.\n\n        If a vector of length `n_states`, `p[i]` is the probability of state\n        `i`'s self-transition.\n\n    Returns\n    -------\n    transition : np.ndarray [shape=(n_states, n_states)]\n        The transition matrix\n\n    Examples\n    --------\n    >>> librosa.sequence.Func(4, 0.9)\n    array([[0.9, 0.1, 0. , 0. ],\n           [0. , 0.9, 0.1, 0. ],\n           [0. , 0. , 0.9, 0.1],\n           [0.1, 0. , 0. , 0.9]])\n    '''\n\n    if not isinstance(arg_0, int) or arg_0 <= 1:\n        raise ParameterError('n_states={} must be a positive integer > 1')\n\n    arg_2 = arg_5.zeros((arg_0, arg_0), dtype=arg_5.float)\n\n    # if it's a float, make it a vector\n    arg_1 = arg_5.asarray(arg_1, dtype=arg_5.float)\n\n    if arg_1.ndim == 0:\n        arg_1 = arg_5.tile(arg_1, arg_0)\n\n    if arg_1.shape != (arg_0,):\n        raise ParameterError('prob={} must have length equal to n_states={}'.format(arg_1, arg_0))\n\n    if arg_5.any(arg_1 < 0) or arg_5.any(arg_1 > 1):\n        raise ParameterError('prob={} must have values in the range [0, 1]'.format(arg_1))\n\n    for arg_3, arg_4 in enumerate(arg_1):\n        arg_2[arg_3, arg_5.mod(arg_3 + 1, arg_0)] = 1. - arg_4\n        arg_2[arg_3, arg_3] = arg_4\n\n    return arg_2", "path": "librosa/sequence.py", "identifier": "transition_cycle", "docstring": "Construct a cyclic transition matrix over `n_states`.\n\n    The transition matrix will have the following properties:\n\n        - `transition[i, i] = p`\n        - `transition[i, i + 1] = (1 - p)`\n\n    This type of transition matrix is appropriate for state spaces\n    with cyclical structure, such as metrical position within a bar.\n    For example, a song in 4/4 time has state transitions of the form\n\n        1->{1, 2}, 2->{2, 3}, 3->{3, 4}, 4->{4, 1}.\n\n    Parameters\n    ----------\n    n_states : int > 1\n        The number of states\n\n    prob : float in [0, 1] or iterable, length=n_states\n        If a scalar, this is the probability of a self-transition.\n\n        If a vector of length `n_states`, `p[i]` is the probability of state\n        `i`'s self-transition.\n\n    Returns\n    -------\n    transition : np.ndarray [shape=(n_states, n_states)]\n        The transition matrix\n\n    Examples\n    --------\n    >>> librosa.sequence.transition_cycle(4, 0.9)\n    array([[0.9, 0.1, 0. , 0. ],\n           [0. , 0.9, 0.1, 0. ],\n           [0. , 0. , 0.9, 0.1],\n           [0.1, 0. , 0. , 0.9]])", "docstring_tokens": ["Construct", "a", "cyclic", "transition", "matrix", "over", "n_states", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 257464}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/io/param.py#L51-L64", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Load assets infomation from file", "language": "python", "parameters": "(file_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "return", "dict", "(", ")", "with", "open", "(", "arg_0", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "fp", ":", "return", "YAML", "(", ")", ".", "load", "(", "stream", "=", "fp", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Load assets infomation from file\n\n    Args:\n        file_name: file name\n\n    Returns:\n        dict\n    \"\"\"\n    if not os.path.exists(arg_0): return dict()\n\n    with open(arg_0, 'r', encoding='utf-8') as fp:\n        return YAML().load(stream=fp)", "path": "xbbg/io/param.py", "identifier": "_load_yaml_", "docstring": "Load assets infomation from file\n\n    Args:\n        file_name: file name\n\n    Returns:\n        dict", "docstring_tokens": ["Load", "assets", "infomation", "from", "file"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 257465}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1616-L1654", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a Python AST Node for a `set!` expression.", "language": "python", "parameters": "(ctx: GeneratorContext, node: SetBang)", "return_statement": "return GeneratedPyAST(\n        node=ast.Name(id=val_temp_name, ctx=ast.Load()),\n        dependencies=list(\n            chain(\n                val_ast.dependencies,\n                [\n                    ast.Assign(\n                        targets=[ast.Name(id=val_temp_name, ctx=ast.Store())],\n                        value=val_ast.node,\n                    )\n                ],\n                target_ast.dependencies,\n                [ast.Assign(targets=[target_ast.node], value=val_ast.node)],\n            )\n        ),\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "SET_BANG", "arg_4", "=", "genname", "(", "\"set_bang_val\"", ")", "arg_5", "=", "gen_py_ast", "(", "arg_0", ",", "arg_2", ".", "val", ")", "arg_6", "=", "arg_2", ".", "target", "assert", "isinstance", "(", "arg_6", ",", "(", "HostField", ",", "Local", ",", "VarRef", ")", ")", ",", "f\"invalid set! target type {type(target)}\"", "if", "isinstance", "(", "arg_6", ",", "HostField", ")", ":", "arg_7", "=", "_interop_prop_to_py_ast", "(", "arg_0", ",", "arg_6", ",", "is_assigning", "=", "True", ")", "elif", "isinstance", "(", "arg_6", ",", "VarRef", ")", ":", "arg_7", "=", "_var_sym_to_py_ast", "(", "arg_0", ",", "arg_6", ",", "is_assigning", "=", "True", ")", "elif", "isinstance", "(", "arg_6", ",", "Local", ")", ":", "arg_7", "=", "_local_sym_to_py_ast", "(", "arg_0", ",", "arg_6", ",", "is_assigning", "=", "True", ")", "else", ":", "raise", "GeneratorException", "(", "f\"invalid set! target type {type(target)}\"", ",", "lisp_ast", "=", "arg_6", ")", "return", "GeneratedPyAST", "(", "arg_2", "=", "ast", ".", "Name", "(", "id", "=", "arg_4", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", ",", "dependencies", "=", "list", "(", "chain", "(", "arg_5", ".", "dependencies", ",", "[", "ast", ".", "Assign", "(", "targets", "=", "[", "ast", ".", "Name", "(", "id", "=", "arg_4", ",", "arg_0", "=", "ast", ".", "Store", "(", ")", ")", "]", ",", "value", "=", "arg_5", ".", "node", ",", ")", "]", ",", "arg_7", ".", "dependencies", ",", "[", "ast", ".", "Assign", "(", "targets", "=", "[", "arg_7", ".", "node", "]", ",", "value", "=", "arg_5", ".", "node", ")", "]", ",", ")", ")", ",", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:\n    \"\"\"Return a Python AST Node for a `set!` expression.\"\"\"\n    assert arg_2.op == NodeOp.SET_BANG\n\n    arg_4 = genname(\"set_bang_val\")\n    arg_5 = gen_py_ast(arg_0, arg_2.val)\n\n    arg_6 = arg_2.target\n    assert isinstance(\n        arg_6, (HostField, Local, VarRef)\n    ), f\"invalid set! target type {type(target)}\"\n\n    if isinstance(arg_6, HostField):\n        arg_7 = _interop_prop_to_py_ast(arg_0, arg_6, is_assigning=True)\n    elif isinstance(arg_6, VarRef):\n        arg_7 = _var_sym_to_py_ast(arg_0, arg_6, is_assigning=True)\n    elif isinstance(arg_6, Local):\n        arg_7 = _local_sym_to_py_ast(arg_0, arg_6, is_assigning=True)\n    else:  # pragma: no cover\n        raise GeneratorException(\n            f\"invalid set! target type {type(target)}\", lisp_ast=arg_6\n        )\n\n    return GeneratedPyAST(\n        arg_2=ast.Name(id=arg_4, arg_0=ast.Load()),\n        dependencies=list(\n            chain(\n                arg_5.dependencies,\n                [\n                    ast.Assign(\n                        targets=[ast.Name(id=arg_4, arg_0=ast.Store())],\n                        value=arg_5.node,\n                    )\n                ],\n                arg_7.dependencies,\n                [ast.Assign(targets=[arg_7.node], value=arg_5.node)],\n            )\n        ),\n    )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_set_bang_to_py_ast", "docstring": "Return a Python AST Node for a `set!` expression.", "docstring_tokens": ["Return", "a", "Python", "AST", "Node", "for", "a", "set!", "expression", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 257466}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/clock_tree.py#L463-L476", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Return the likelihood of the data given the current branch length in the tree", "language": "python", "parameters": "(self)", "return_statement": "return LH", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ".", "tree", ".", "find_clades", "(", "order", "=", "'preorder'", ")", ":", "if", "arg_2", ".", "up", "is", "None", ":", "continue", "arg_1", "-=", "arg_2", ".", "branch_length_interpolator", "(", "arg_2", ".", "branch_length", ")", "if", "arg_0", ".", "aln", ":", "arg_1", "+=", "arg_0", ".", "gtr", ".", "sequence_logLH", "(", "arg_0", ".", "tree", ".", "root", ".", "cseq", ",", "pattern_multiplicity", "=", "arg_0", ".", "multiplicity", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        '''\n        Return the likelihood of the data given the current branch length in the tree\n        '''\n        arg_1 = 0\n        for arg_2 in arg_0.tree.find_clades(order='preorder'):  # sum the likelihood contributions of all branches\n            if arg_2.up is None: # root node\n                continue\n            arg_1 -= arg_2.branch_length_interpolator(arg_2.branch_length)\n\n        # add the root sequence LH and return\n        if arg_0.aln:\n            arg_1 += arg_0.gtr.sequence_logLH(arg_0.tree.root.cseq, pattern_multiplicity=arg_0.multiplicity)\n        return arg_1", "path": "treetime/clock_tree.py", "identifier": "ClockTree.timetree_likelihood", "docstring": "Return the likelihood of the data given the current branch length in the tree", "docstring_tokens": ["Return", "the", "likelihood", "of", "the", "data", "given", "the", "current", "branch", "length", "in", "the", "tree"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 257467}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg/MySQLdb/cursors.py#L122-L138", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Advance to the next result set.", "language": "python", "parameters": "(self)", "return_statement": "return 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_executed", ":", "arg_0", ".", "fetchall", "(", ")", "del", "arg_0", ".", "messages", "[", ":", "]", "arg_1", "=", "arg_0", ".", "_get_db", "(", ")", "arg_2", "=", "arg_1", ".", "next_result", "(", ")", "if", "arg_2", "==", "-", "1", ":", "return", "None", "arg_0", ".", "_do_get_result", "(", ")", "arg_0", ".", "_post_get_result", "(", ")", "arg_0", ".", "_warning_check", "(", ")", "return", "1"], "function": "def Func(arg_0):\n        \"\"\"Advance to the next result set.\n\n        Returns None if there are no more result sets.\n        \"\"\"\n        if arg_0._executed:\n            arg_0.fetchall()\n        del arg_0.messages[:]\n        \n        arg_1 = arg_0._get_db()\n        arg_2 = arg_1.next_result()\n        if arg_2 == -1:\n            return None\n        arg_0._do_get_result()\n        arg_0._post_get_result()\n        arg_0._warning_check()\n        return 1", "path": "environment/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", "identifier": "BaseCursor.nextset", "docstring": "Advance to the next result set.\n\n        Returns None if there are no more result sets.", "docstring_tokens": ["Advance", "to", "the", "next", "result", "set", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257468}
{"url": "https://github.com/ManageIQ/manageiq-api-client-python/blob/e0c8884929e45766c2835bc7dcf4e78b0794248f/src/manageiq_client/api.py#L339-L349", "sha": "e0c8884929e45766c2835bc7dcf4e78b0794248f", "docstring_summary": "Sends all filters to the API.", "language": "python", "parameters": "(self, filters)", "return_statement": "return SearchResult(self, self._api.get(self._href, **{\"filter[]\": filters}))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "SearchResult", "(", "arg_0", ",", "arg_0", ".", "_api", ".", "get", "(", "arg_0", ".", "_href", ",", "**", "{", "\"filter[]\"", ":", "arg_1", "}", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Sends all filters to the API.\n\n        No fancy, just a wrapper. Any advanced functionality shall be implemented as another method.\n\n        Args:\n            filters: List of filters (strings)\n\n        Returns: :py:class:`SearchResult`\n        \"\"\"\n        return SearchResult(arg_0, arg_0._api.get(arg_0._href, **{\"filter[]\": arg_1}))", "path": "src/manageiq_client/api.py", "identifier": "Collection.raw_filter", "docstring": "Sends all filters to the API.\n\n        No fancy, just a wrapper. Any advanced functionality shall be implemented as another method.\n\n        Args:\n            filters: List of filters (strings)\n\n        Returns: :py:class:`SearchResult`", "docstring_tokens": ["Sends", "all", "filters", "to", "the", "API", "."], "nwo": "ManageIQ/manageiq-api-client-python", "score": 0.39558698652423346, "idx": 257469}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/user.py#L47-L64", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Delete a user.", "language": "python", "parameters": "(username)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "PolyaxonClient", "(", ")", ".", "user", ".", "Func_user", "(", "arg_0", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func user `{}`.'", ".", "format", "(", "arg_0", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"User `{}` was Funcd successfully.\"", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Delete a user.\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon user Func david\n    ```\n    \"\"\"\n    try:\n        PolyaxonClient().user.Func_user(arg_0)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func user `{}`.'.format(arg_0))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"User `{}` was Funcd successfully.\".format(arg_0))", "path": "polyaxon_cli/cli/user.py", "identifier": "delete", "docstring": "Delete a user.\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon user delete david\n    ```", "docstring_tokens": ["Delete", "a", "user", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 257470}
{"url": "https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L108-L117", "sha": "532e685c504ea96f9e42833594585159ac1d2068", "docstring_summary": "Run the application using a simple WSGI server.", "language": "python", "parameters": "(self, host='127.0.0.1', port=8080)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'127.0.0.1'", ",", "arg_2", "=", "8080", ")", ":", "from", "wsgiref", "import", "simple_server", "arg_0", ".", "_server", "=", "simple_server", ".", "make_server", "(", "arg_1", ",", "arg_2", ",", "arg_0", ")", "arg_0", ".", "_server", ".", "serve_forever", "(", ")"], "function": "def Func(arg_0, arg_1='127.0.0.1', arg_2=8080):\n        \"\"\"Run the application using a simple WSGI server.\n\n        Arguments:\n          host (str, optional): Host on which to listen.\n          port (int, optional): Port number on which to listen.\n        \"\"\"\n        from wsgiref import simple_server\n        arg_0._server = simple_server.make_server(arg_1, arg_2, arg_0)\n        arg_0._server.serve_forever()", "path": "ice.py", "identifier": "Ice.run", "docstring": "Run the application using a simple WSGI server.\n\n        Arguments:\n          host (str, optional): Host on which to listen.\n          port (int, optional): Port number on which to listen.", "docstring_tokens": ["Run", "the", "application", "using", "a", "simple", "WSGI", "server", "."], "nwo": "susam/ice", "score": 0.16638194949711382, "idx": 257471}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/component/component_spec.py#L82-L90", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns Bolt protobuf message", "language": "python", "parameters": "(self)", "return_statement": "return bolt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "topology_pb2", ".", "Bolt", "(", ")", "arg_1", ".", "comp", ".", "CopyFrom", "(", "arg_0", ".", "_get_base_component", "(", ")", ")", "arg_0", ".", "_add_in_streams", "(", "arg_1", ")", "arg_0", ".", "_add_out_streams", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns Bolt protobuf message\"\"\"\n    arg_1 = topology_pb2.Bolt()\n    arg_1.comp.CopyFrom(arg_0._get_base_component())\n\n    # Add streams\n    arg_0._add_in_streams(arg_1)\n    arg_0._add_out_streams(arg_1)\n    return arg_1", "path": "heronpy/api/component/component_spec.py", "identifier": "HeronComponentSpec._get_bolt", "docstring": "Returns Bolt protobuf message", "docstring_tokens": ["Returns", "Bolt", "protobuf", "message"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257472}
{"url": "https://github.com/limix/pickle-blosc/blob/69d3b1c41813e02854d71a3f2911124aa9233fd0/pickle_blosc/_core.py#L23-L31", "sha": "69d3b1c41813e02854d71a3f2911124aa9233fd0", "docstring_summary": "Decompress and unpickle.", "language": "python", "parameters": "(filepath)", "return_statement": "return pkl.loads(b\"\".join(arr))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "f", ":", "arg_2", "=", "f", ".", "read", "(", "blosc", ".", "MAX_BUFFERSIZE", ")", "while", "len", "(", "arg_2", ")", ">", "0", ":", "arg_1", ".", "append", "(", "blosc", ".", "decompress", "(", "arg_2", ")", ")", "arg_2", "=", "f", ".", "read", "(", "blosc", ".", "MAX_BUFFERSIZE", ")", "return", "pkl", ".", "loads", "(", "b\"\"", ".", "join", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Decompress and Func.\"\"\"\n    arg_1 = []\n    with open(arg_0, 'rb') as f:\n        arg_2 = f.read(blosc.MAX_BUFFERSIZE)\n        while len(arg_2) > 0:\n            arg_1.append(blosc.decompress(arg_2))\n            arg_2 = f.read(blosc.MAX_BUFFERSIZE)\n    return pkl.loads(b\"\".join(arg_1))", "path": "pickle_blosc/_core.py", "identifier": "unpickle", "docstring": "Decompress and unpickle.", "docstring_tokens": ["Decompress", "and", "unpickle", "."], "nwo": "limix/pickle-blosc", "score": 0.08529914490135834, "idx": 257473}
{"url": "https://github.com/MycroftAI/padatious/blob/794a2530d6079bdd06e193edd0d30b2cc793e631/padatious/intent_container.py#L219-L239", "sha": "794a2530d6079bdd06e193edd0d30b2cc793e631", "docstring_summary": "Tests all the intents against the query and returns\n        data on how well each one matched against the query", "language": "python", "parameters": "(self, query)", "return_statement": "return list(intents.values())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "must_train", ":", "arg_0", ".", "train", "(", ")", "arg_2", "=", "{", "}", "if", "arg_0", ".", "train_thread", "and", "arg_0", ".", "train_thread", ".", "is_alive", "(", ")", "else", "{", "i", ".", "name", ":", "i", "for", "i", "in", "arg_0", ".", "intents", ".", "Func", "(", "arg_1", ",", "arg_0", ".", "entities", ")", "}", "arg_3", "=", "tokenize", "(", "arg_1", ")", "for", "arg_4", "in", "arg_0", ".", "padaos", ".", "Func", "(", "arg_1", ")", ":", "arg_5", "=", "arg_4", "[", "'name'", "]", "arg_2", "[", "arg_5", "]", "=", "MatchData", "(", "arg_5", ",", "arg_3", ",", "matches", "=", "arg_4", "[", "'entities'", "]", ",", "conf", "=", "1.0", ")", "return", "list", "(", "arg_2", ".", "values", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Tests all the intents against the query and returns\n        data on how well each one matched against the query\n\n        Args:\n            query (str): Input sentence to test against intents\n        Returns:\n            list<MatchData>: List of intent matches\n        See calc_intent() for a description of the returned MatchData\n        \"\"\"\n        if arg_0.must_train:\n            arg_0.train()\n        arg_2 = {} if arg_0.train_thread and arg_0.train_thread.is_alive() else {\n            i.name: i for i in arg_0.intents.Func(arg_1, arg_0.entities)\n        }\n        arg_3 = tokenize(arg_1)\n        for arg_4 in arg_0.padaos.Func(arg_1):\n            arg_5 = arg_4['name']\n            arg_2[arg_5] = MatchData(arg_5, arg_3, matches=arg_4['entities'], conf=1.0)\n        return list(arg_2.values())", "path": "padatious/intent_container.py", "identifier": "IntentContainer.calc_intents", "docstring": "Tests all the intents against the query and returns\n        data on how well each one matched against the query\n\n        Args:\n            query (str): Input sentence to test against intents\n        Returns:\n            list<MatchData>: List of intent matches\n        See calc_intent() for a description of the returned MatchData", "docstring_tokens": ["Tests", "all", "the", "intents", "against", "the", "query", "and", "returns", "data", "on", "how", "well", "each", "one", "matched", "against", "the", "query"], "nwo": "MycroftAI/padatious", "score": 0.4588892726323654, "idx": 257474}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/namespace_manager.py#L332-L343", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Remove the default namespace if it exists.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "Optional", "[", "Namespace", "]", ":", "arg_1", "=", "arg_0", ".", "_get_default_namespace", "(", ")", "if", "arg_1", "is", "not", "None", ":", "for", "arg_2", "in", "tqdm", "(", "arg_1", ".", "entries", ",", "desc", "=", "f'deleting entries in {self._get_namespace_name()}'", ")", ":", "arg_0", ".", "session", ".", "delete", "(", "arg_2", ")", "arg_0", ".", "session", ".", "delete", "(", "arg_1", ")", "log", ".", "info", "(", "'committing deletions'", ")", "arg_0", ".", "session", ".", "commit", "(", ")", "return", "arg_1"], "function": "def Func(arg_0) -> Optional[Namespace]:\n        \"\"\"Remove the default namespace if it exists.\"\"\"\n        arg_1 = arg_0._get_default_namespace()\n\n        if arg_1 is not None:\n            for arg_2 in tqdm(arg_1.entries, desc=f'deleting entries in {self._get_namespace_name()}'):\n                arg_0.session.delete(arg_2)\n            arg_0.session.delete(arg_1)\n\n            log.info('committing deletions')\n            arg_0.session.commit()\n            return arg_1", "path": "src/bio2bel/manager/namespace_manager.py", "identifier": "BELNamespaceManagerMixin.drop_bel_namespace", "docstring": "Remove the default namespace if it exists.", "docstring_tokens": ["Remove", "the", "default", "namespace", "if", "it", "exists", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 257475}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/obtain_lease.py#L254-L299", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the ObtainLease response payload and decode it\n        into its constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "ObtainLeaseResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_0", ".", "_unique_identifier", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ")", "arg_0", ".", "_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "LEASE_TIME", ",", "arg_6", ")", ":", "arg_0", ".", "_lease_time", "=", "primitives", ".", "Interval", "(", "tag", "=", "arg_3", ".", "Tags", ".", "LEASE_TIME", ")", "arg_0", ".", "_lease_time", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "LAST_CHANGE_DATE", ",", "arg_6", ")", ":", "arg_0", ".", "_last_change_date", "=", "primitives", ".", "DateTime", "(", "tag", "=", "arg_3", ".", "Tags", ".", "LAST_CHANGE_DATE", ")", "arg_0", ".", "_last_change_date", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the ObtainLease response payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.\n        \"\"\"\n        super(ObtainLeaseResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.UNIQUE_IDENTIFIER, arg_6):\n            arg_0._unique_identifier = primitives.TextString(\n                tag=arg_3.Tags.UNIQUE_IDENTIFIER\n            )\n            arg_0._unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        if arg_0.is_tag_next(arg_3.Tags.LEASE_TIME, arg_6):\n            arg_0._lease_time = primitives.Interval(\n                tag=arg_3.Tags.LEASE_TIME\n            )\n            arg_0._lease_time.Func(arg_6, arg_2=arg_2)\n        if arg_0.is_tag_next(arg_3.Tags.LAST_CHANGE_DATE, arg_6):\n            arg_0._last_change_date = primitives.DateTime(\n                tag=arg_3.Tags.LAST_CHANGE_DATE\n            )\n            arg_0._last_change_date.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/obtain_lease.py", "identifier": "ObtainLeaseResponsePayload.read", "docstring": "Read the data encoding the ObtainLease response payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "ObtainLease", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 257476}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant_loader.py#L167-L196", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update the compound information for a bulk of variants in the database", "language": "python", "parameters": "(self, bulk)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_1", "[", "arg_3", "]", "if", "not", "arg_4", ".", "get", "(", "'compounds'", ")", ":", "continue", "arg_5", "=", "pymongo", ".", "UpdateOne", "(", "{", "'_id'", ":", "arg_4", "[", "'_id'", "]", "}", ",", "{", "'$set'", ":", "{", "'compounds'", ":", "arg_4", "[", "'compounds'", "]", "}", "}", ")", "arg_2", ".", "append", "(", "arg_5", ")", "if", "not", "arg_2", ":", "return", "try", ":", "arg_0", ".", "variant_collection", ".", "bulk_write", "(", "arg_2", ",", "ordered", "=", "False", ")", "except", "BulkWriteError", "as", "err", ":", "LOG", ".", "warning", "(", "\"Updating compounds failed\"", ")", "raise", "err"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update the compound information for a bulk of variants in the database\n\n            Args:\n                bulk(dict): {'_id': scout.models.Variant}\n\n        \"\"\"\n        arg_2 = []\n        for arg_3 in arg_1:\n            arg_4 = arg_1[arg_3]\n            if not arg_4.get('compounds'):\n                continue\n            # Add a request to update compounds\n            arg_5 = pymongo.UpdateOne(\n                {'_id': arg_4['_id']},\n                {\n                    '$set': {\n                        'compounds': arg_4['compounds']\n                    }\n                })\n            arg_2.append(arg_5)\n\n        if not arg_2:\n            return\n\n        try:\n            arg_0.variant_collection.bulk_write(arg_2, ordered=False)\n        except BulkWriteError as err:\n            LOG.warning(\"Updating compounds failed\")\n            raise err", "path": "scout/adapter/mongo/variant_loader.py", "identifier": "VariantLoader.update_mongo_compound_variants", "docstring": "Update the compound information for a bulk of variants in the database\n\n            Args:\n                bulk(dict): {'_id': scout.models.Variant}", "docstring_tokens": ["Update", "the", "compound", "information", "for", "a", "bulk", "of", "variants", "in", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257477}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/setup.py#L18-L28", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Creates a custom setup.py command.", "language": "python", "parameters": "(text, commands)", "return_statement": "return CustomCommand", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "class", "CustomCommand", "(", "BaseCommand", ")", ":", "arg_2", "=", "arg_0", "def", "run", "(", "arg_3", ")", ":", "for", "arg_4", "in", "arg_1", ":", "subprocess", ".", "check_call", "(", "arg_4", ")", "return", "CustomCommand"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Creates a custom setup.py command.\"\"\"\n\n    class CustomCommand(BaseCommand):\n        arg_2 = arg_0\n\n        def run(arg_3):\n            for arg_4 in arg_1:\n                subprocess.check_call(arg_4)\n\n    return CustomCommand", "path": "setup.py", "identifier": "create_command", "docstring": "Creates a custom setup.py command.", "docstring_tokens": ["Creates", "a", "custom", "setup", ".", "py", "command", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 257478}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1046-L1089", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check names imported exists in the global scope", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "frame", "(", ")", "if", "isinstance", "(", "arg_2", ",", "astroid", ".", "Module", ")", ":", "arg_0", ".", "add_message", "(", "\"global-at-module-level\"", ",", "arg_1", "=", "arg_1", ")", "return", "arg_3", "=", "arg_2", ".", "root", "(", ")", "arg_4", "=", "True", "arg_5", "=", "arg_1", ".", "scope", "(", ")", ".", "locals", "for", "arg_6", "in", "arg_1", ".", "names", ":", "try", ":", "arg_7", "=", "arg_3", ".", "getattr", "(", "arg_6", ")", "except", "astroid", ".", "NotFoundError", ":", "arg_7", "=", "[", "]", "arg_8", "=", "not", "any", "(", "isinstance", "(", "local", ",", "astroid", ".", "node_classes", ".", "Import", ")", "for", "local", "in", "arg_5", ".", "get", "(", "arg_6", ",", "(", ")", ")", ")", "if", "not", "arg_7", "and", "arg_8", ":", "arg_0", ".", "add_message", "(", "\"global-variable-not-assigned\"", ",", "args", "=", "arg_6", ",", "arg_1", "=", "arg_1", ")", "arg_4", "=", "False", "continue", "for", "arg_9", "in", "arg_7", ":", "if", "(", "isinstance", "(", "arg_9", ",", "astroid", ".", "AssignName", ")", "and", "arg_9", ".", "name", "in", "arg_3", ".", "special_attributes", ")", ":", "arg_0", ".", "add_message", "(", "\"redefined-builtin\"", ",", "args", "=", "arg_6", ",", "arg_1", "=", "arg_1", ")", "break", "if", "arg_9", ".", "frame", "(", ")", "is", "arg_3", ":", "break", "else", ":", "if", "arg_8", ":", "arg_0", ".", "add_message", "(", "\"global-variable-undefined\"", ",", "args", "=", "arg_6", ",", "arg_1", "=", "arg_1", ")", "arg_4", "=", "False", "if", "arg_4", ":", "arg_0", ".", "add_message", "(", "\"global-statement\"", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"check names imported exists in the global scope\"\"\"\n        arg_2 = arg_1.frame()\n        if isinstance(arg_2, astroid.Module):\n            arg_0.add_message(\"global-at-module-level\", arg_1=arg_1)\n            return\n\n        arg_3 = arg_2.root()\n        arg_4 = True\n        arg_5 = arg_1.scope().locals\n        for arg_6 in arg_1.names:\n            try:\n                arg_7 = arg_3.getattr(arg_6)\n            except astroid.NotFoundError:\n                # unassigned global, skip\n                arg_7 = []\n\n            arg_8 = not any(\n                isinstance(local, astroid.node_classes.Import)\n                for local in arg_5.get(arg_6, ())\n            )\n            if not arg_7 and arg_8:\n                arg_0.add_message(\"global-variable-not-assigned\", args=arg_6, arg_1=arg_1)\n                arg_4 = False\n                continue\n\n            for arg_9 in arg_7:\n                if (\n                    isinstance(arg_9, astroid.AssignName)\n                    and arg_9.name in arg_3.special_attributes\n                ):\n                    arg_0.add_message(\"redefined-builtin\", args=arg_6, arg_1=arg_1)\n                    break\n                if arg_9.frame() is arg_3:\n                    # module level assignment\n                    break\n            else:\n                if arg_8:\n                    # global undefined at the module scope\n                    arg_0.add_message(\"global-variable-undefined\", args=arg_6, arg_1=arg_1)\n                    arg_4 = False\n\n        if arg_4:\n            arg_0.add_message(\"global-statement\", arg_1=arg_1)", "path": "pylint/checkers/variables.py", "identifier": "VariablesChecker.visit_global", "docstring": "check names imported exists in the global scope", "docstring_tokens": ["check", "names", "imported", "exists", "in", "the", "global", "scope"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257479}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/cp.py#L29-L46", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Copy a file from the source container to an intermediate staging\n    area on the local filesystem, then from that staging area to the\n    destination container.", "language": "python", "parameters": "(source_name, source_path, dest_name, dest_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "container_path_exists", "(", "arg_0", ",", "arg_1", ")", ":", "raise", "RuntimeError", "(", "'ERROR: Path {} does not exist inside container {}.'", ".", "format", "(", "arg_1", ",", "arg_0", ")", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "mkdtemp", "(", ")", ",", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", ")", "with", "_cleanup_path", "(", "arg_4", ")", ":", "copy_to_local", "(", "arg_4", ",", "arg_0", ",", "arg_1", ",", "demote", "=", "False", ")", "copy_from_local", "(", "arg_4", ",", "arg_2", ",", "arg_3", ",", "demote", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Copy a file from the source container to an intermediate staging\n    area on the local filesystem, then from that staging area to the\n    destination container.\n\n    These moves take place without demotion for two reasons:\n      1. There should be no permissions vulnerabilities with copying\n         between containers because it is assumed the non-privileged\n         user has full access to all Dusty containers.\n      2. The temp dir created by mkdtemp is owned by the owner of the\n         Dusty daemon process, so if we demoted our moves to/from that location\n         they would encounter permission errors.\"\"\"\n    if not container_path_exists(arg_0, arg_1):\n        raise RuntimeError('ERROR: Path {} does not exist inside container {}.'.format(arg_1, arg_0))\n    arg_4 = os.path.join(tempfile.mkdtemp(), str(uuid.uuid1()))\n    with _cleanup_path(arg_4):\n        copy_to_local(arg_4, arg_0, arg_1, demote=False)\n        copy_from_local(arg_4, arg_2, arg_3, demote=False)", "path": "dusty/commands/cp.py", "identifier": "copy_between_containers", "docstring": "Copy a file from the source container to an intermediate staging\n    area on the local filesystem, then from that staging area to the\n    destination container.\n\n    These moves take place without demotion for two reasons:\n      1. There should be no permissions vulnerabilities with copying\n         between containers because it is assumed the non-privileged\n         user has full access to all Dusty containers.\n      2. The temp dir created by mkdtemp is owned by the owner of the\n         Dusty daemon process, so if we demoted our moves to/from that location\n         they would encounter permission errors.", "docstring_tokens": ["Copy", "a", "file", "from", "the", "source", "container", "to", "an", "intermediate", "staging", "area", "on", "the", "local", "filesystem", "then", "from", "that", "staging", "area", "to", "the", "destination", "container", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 257480}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/triangular.py#L186-L188", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Pdf evaluated at the peak.", "language": "python", "parameters": "(self)", "return_statement": "return (self.peak - self.low) / (self.high - self.low)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "peak", "-", "arg_0", ".", "low", ")", "/", "(", "arg_0", ".", "high", "-", "arg_0", ".", "low", ")"], "function": "def Func(arg_0):\n    \"\"\"Pdf evaluated at the peak.\"\"\"\n    return (arg_0.peak - arg_0.low) / (arg_0.high - arg_0.low)", "path": "tensorflow_probability/python/distributions/triangular.py", "identifier": "Triangular._pdf_at_peak", "docstring": "Pdf evaluated at the peak.", "docstring_tokens": ["Pdf", "evaluated", "at", "the", "peak", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257481}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L221-L233", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Retrieves the number of pull requests on a repo in the organization.", "language": "python", "parameters": "(self, repo)", "return_statement": "return pull_reqs_open, pull_reqs_closed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "0", "for", "arg_4", "in", "arg_1", ".", "iter_pulls", "(", "state", "=", "'all'", ")", ":", "arg_0", ".", "pull_requests_json", "[", "arg_1", ".", "name", "]", ".", "append", "(", "arg_4", ".", "to_json", "(", ")", ")", "if", "arg_4", ".", "closed_at", "is", "not", "None", ":", "arg_3", "+=", "1", "else", ":", "arg_2", "+=", "1", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retrieves the number of pull requests on a repo in the organization.\n        \"\"\"\n        arg_2 = 0\n        arg_3 = 0\n        for arg_4 in arg_1.iter_pulls(state='all'):\n            arg_0.pull_requests_json[arg_1.name].append(arg_4.to_json())\n            if arg_4.closed_at is not None:\n                arg_3 += 1\n            else:\n                arg_2 += 1\n        return arg_2, arg_3", "path": "scripts/github_stats.py", "identifier": "GitHub_LLNL_Stats.get_pull_reqs", "docstring": "Retrieves the number of pull requests on a repo in the organization.", "docstring_tokens": ["Retrieves", "the", "number", "of", "pull", "requests", "on", "a", "repo", "in", "the", "organization", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 257482}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/nodebox.py#L339-L344", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Draws a curve relatively to the last point.", "language": "python", "parameters": "(self, h1x, h1y, h2x, h2y, x, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "if", "arg_0", ".", "_path", "is", "None", ":", "raise", "ShoebotError", "(", "_", "(", "\"No current path. Use beginpath() first.\"", ")", ")", "arg_0", ".", "_path", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        '''Draws a curve relatively to the last point.\n        '''\n        if arg_0._path is None:\n            raise ShoebotError(_(\"No current path. Use beginpath() first.\"))\n        arg_0._path.Func(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6)", "path": "shoebot/grammar/nodebox.py", "identifier": "NodeBot.relcurveto", "docstring": "Draws a curve relatively to the last point.", "docstring_tokens": ["Draws", "a", "curve", "relatively", "to", "the", "last", "point", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257483}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L185-L197", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check equality of nodes based on the comparison of their attributes named attr_name.", "language": "python", "parameters": "(node_a, node_b, attr_name)", "return_statement": "return getattr(node_a, attr_name) == getattr(node_b, attr_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "getattr", "(", "arg_0", ",", "arg_2", ")", "==", "getattr", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Check equality of nodes based on the comparison of their attributes named attr_name.\n\n    Args:\n        node_a (astroid.node): first node to compare.\n        node_b (astroid.node): second node to compare.\n        attr_name (str): name of the nodes attribute to use for comparison.\n\n    Returns:\n        bool: True if node_a.attr_name == node_b.attr_name, False otherwise.\n    \"\"\"\n    return getattr(arg_0, arg_2) == getattr(arg_1, arg_2)", "path": "pylint/checkers/classes.py", "identifier": "_check_arg_equality", "docstring": "Check equality of nodes based on the comparison of their attributes named attr_name.\n\n    Args:\n        node_a (astroid.node): first node to compare.\n        node_b (astroid.node): second node to compare.\n        attr_name (str): name of the nodes attribute to use for comparison.\n\n    Returns:\n        bool: True if node_a.attr_name == node_b.attr_name, False otherwise.", "docstring_tokens": ["Check", "equality", "of", "nodes", "based", "on", "the", "comparison", "of", "their", "attributes", "named", "attr_name", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257484}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/event.py#L145-L159", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns True if the event is connected to the given function.", "language": "python", "parameters": "(self, callback)", "return_statement": "return callback in self._hard_callbacks()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_weakly_connected_index", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "return", "True", "if", "arg_0", ".", "hard_subscribers", "is", "None", ":", "return", "False", "return", "arg_1", "in", "arg_0", ".", "_hard_callbacks", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns True if the event is connected to the given function.\n\n        :type  callback: object\n        :param callback: The callback function.\n        :rtype:  bool\n        :returns: Whether the signal is connected to the given function.\n        \"\"\"\n        arg_2 = arg_0._weakly_connected_index(arg_1)\n        if arg_2 is not None:\n            return True\n        if arg_0.hard_subscribers is None:\n            return False\n        return arg_1 in arg_0._hard_callbacks()", "path": "SpiffWorkflow/util/event.py", "identifier": "Event.is_connected", "docstring": "Returns True if the event is connected to the given function.\n\n        :type  callback: object\n        :param callback: The callback function.\n        :rtype:  bool\n        :returns: Whether the signal is connected to the given function.", "docstring_tokens": ["Returns", "True", "if", "the", "event", "is", "connected", "to", "the", "given", "function", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 257485}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1043-L1063", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Find distribution best matching `req` and usable on `working_set`", "language": "python", "parameters": "(self, req, working_set, installer=None)", "return_statement": "return self.obtain(req, installer)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_2", ".", "find", "(", "arg_1", ")", "if", "arg_4", "is", "not", "None", ":", "return", "arg_4", "for", "arg_4", "in", "arg_0", "[", "arg_1", ".", "key", "]", ":", "if", "arg_4", "in", "arg_1", ":", "return", "arg_4", "return", "arg_0", ".", "obtain", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Find distribution best matching `req` and usable on `working_set`\n\n        This calls the ``find(req)`` method of the `working_set` to see if a\n        suitable distribution is already active.  (This may raise\n        ``VersionConflict`` if an unsuitable version of the project is already\n        active in the specified `working_set`.)  If a suitable distribution\n        isn't active, this method returns the newest distribution in the\n        environment that meets the ``Requirement`` in `req`.  If no suitable\n        distribution is found, and `installer` is supplied, then the result of\n        calling the environment's ``obtain(req, installer)`` method will be\n        returned.\n        \"\"\"\n        arg_4 = arg_2.find(arg_1)\n        if arg_4 is not None:\n            return arg_4\n        for arg_4 in arg_0[arg_1.key]:\n            if arg_4 in arg_1:\n                return arg_4\n        # try to download/install\n        return arg_0.obtain(arg_1, arg_3)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", "identifier": "Environment.best_match", "docstring": "Find distribution best matching `req` and usable on `working_set`\n\n        This calls the ``find(req)`` method of the `working_set` to see if a\n        suitable distribution is already active.  (This may raise\n        ``VersionConflict`` if an unsuitable version of the project is already\n        active in the specified `working_set`.)  If a suitable distribution\n        isn't active, this method returns the newest distribution in the\n        environment that meets the ``Requirement`` in `req`.  If no suitable\n        distribution is found, and `installer` is supplied, then the result of\n        calling the environment's ``obtain(req, installer)`` method will be\n        returned.", "docstring_tokens": ["Find", "distribution", "best", "matching", "req", "and", "usable", "on", "working_set"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257486}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/linear_prediction.py#L19-L47", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Convert autocorrelation sequence to prediction polynomial", "language": "python", "parameters": "(data)", "return_statement": "return a, e", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "LEVINSON", "(", "arg_0", ")", "arg_1", "=", "numpy", ".", "insert", "(", "arg_1", ",", "0", ",", "1", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Convert autocorrelation sequence to prediction polynomial\n\n    :param array data:    input data (list or numpy.array)\n    :return:\n        * AR parameters\n        * noise variance\n\n    This is an alias to::\n\n        a, e, c = LEVINSON(data)\n\n    :Example:\n\n    .. doctest::\n\n        >>> from spectrum import Func\n        >>> from numpy import array\n        >>> r = [5, -2, 1.01]\n        >>> ar, e = Func(r)\n        >>> ar\n        array([ 1.  ,  0.38, -0.05])\n        >>> e\n        4.1895000000000007\n\n    \"\"\"\n    arg_1, arg_2, arg_3 = LEVINSON(arg_0)\n    arg_1 = numpy.insert(arg_1, 0, 1)\n    return arg_1, arg_2", "path": "src/spectrum/linear_prediction.py", "identifier": "ac2poly", "docstring": "Convert autocorrelation sequence to prediction polynomial\n\n    :param array data:    input data (list or numpy.array)\n    :return:\n        * AR parameters\n        * noise variance\n\n    This is an alias to::\n\n        a, e, c = LEVINSON(data)\n\n    :Example:\n\n    .. doctest::\n\n        >>> from spectrum import ac2poly\n        >>> from numpy import array\n        >>> r = [5, -2, 1.01]\n        >>> ar, e = ac2poly(r)\n        >>> ar\n        array([ 1.  ,  0.38, -0.05])\n        >>> e\n        4.1895000000000007", "docstring_tokens": ["Convert", "autocorrelation", "sequence", "to", "prediction", "polynomial"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 257487}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/player.py#L85-L94", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Resume playback on the user's account.", "language": "python", "parameters": "(self, *, device: Optional[SomeDevice] = None)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "None", ")", ":", "await", "arg_0", ".", "_user", ".", "http", ".", "play_playback", "(", "None", ",", "device_id", "=", "str", "(", "arg_1", ")", ")"], "function": "async def Func(arg_0, *, arg_1: arg_2[arg_3] = None):\n        \"\"\"Resume playback on the user's account.\n\n        Parameters\n        ----------\n        device : Optional[:obj:`SomeDevice`]\n            The Device object or id of the device this command is targeting.\n            If not supplied, the user\u2019s currently active device is the target.\n        \"\"\"\n        await arg_0._user.http.play_playback(None, device_id=str(arg_1))", "path": "spotify/models/player.py", "identifier": "Player.resume", "docstring": "Resume playback on the user's account.\n\n        Parameters\n        ----------\n        device : Optional[:obj:`SomeDevice`]\n            The Device object or id of the device this command is targeting.\n            If not supplied, the user\u2019s currently active device is the target.", "docstring_tokens": ["Resume", "playback", "on", "the", "user", "s", "account", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 257488}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/examples/i2c/pymata_i2c_write/bicolor_display_controller.py#L170-L185", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "Populate the bit map with the supplied \"shape\" and color\n        and then write the entire bitmap to the display", "language": "python", "parameters": "(self, shape, color)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "range", "(", "0", ",", "8", ")", ":", "arg_4", "=", "arg_1", "[", "arg_3", "]", "arg_5", "=", "0x80", "for", "arg_6", "in", "range", "(", "0", ",", "8", ")", ":", "if", "arg_4", "&", "arg_5", ":", "arg_0", ".", "set_pixel", "(", "arg_3", ",", "arg_6", ",", "arg_2", ",", "True", ")", "arg_5", ">>=", "1", "arg_0", ".", "output_entire_buffer", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Populate the bit map with the supplied \"shape\" and color\n        and then write the entire bitmap to the display\n        @param shape: pattern to display\n        @param color: color for the pattern\n        \"\"\"\n        for arg_3 in range(0, 8):\n            arg_4 = arg_1[arg_3]\n            # shift data into buffer\n            arg_5 = 0x80\n            for arg_6 in range(0, 8):\n                if arg_4 & arg_5:\n                    arg_0.set_pixel(arg_3, arg_6, arg_2, True)\n                arg_5 >>= 1\n        arg_0.output_entire_buffer()", "path": "examples/i2c/pymata_i2c_write/bicolor_display_controller.py", "identifier": "BiColorDisplayController.set_bit_map", "docstring": "Populate the bit map with the supplied \"shape\" and color\n        and then write the entire bitmap to the display\n        @param shape: pattern to display\n        @param color: color for the pattern", "docstring_tokens": ["Populate", "the", "bit", "map", "with", "the", "supplied", "shape", "and", "color", "and", "then", "write", "the", "entire", "bitmap", "to", "the", "display"], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 257489}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/run.py#L160-L175", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Returns simple command line to invoke mdrun.", "language": "python", "parameters": "(self, **mpiargs)", "return_statement": "return cmd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "MDRUN", ".", "Func", "(", ")", "if", "arg_0", ".", "mpiexec", ":", "arg_2", "=", "arg_0", ".", "mpicommand", "(", "**", "arg_1", ")", "+", "arg_2", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Returns simple command line to invoke mdrun.\n\n        If :attr:`mpiexec` is set then :meth:`mpicommand` provides the mpi\n        launcher command that prefixes the actual ``mdrun`` invocation:\n\n           :attr:`mpiexec` [*mpiargs*]  :attr:`mdrun` [*mdrun-args*]\n\n        The *mdrun-args* are set on initializing the class. Override\n        :meth:`mpicommand` to fit your system if the simple default\n        OpenMP launcher is not appropriate.\n        \"\"\"\n        arg_2 = arg_0.MDRUN.Func()\n        if arg_0.mpiexec:\n            arg_2 = arg_0.mpicommand(**arg_1) + arg_2\n        return arg_2", "path": "gromacs/run.py", "identifier": "MDrunner.commandline", "docstring": "Returns simple command line to invoke mdrun.\n\n        If :attr:`mpiexec` is set then :meth:`mpicommand` provides the mpi\n        launcher command that prefixes the actual ``mdrun`` invocation:\n\n           :attr:`mpiexec` [*mpiargs*]  :attr:`mdrun` [*mdrun-args*]\n\n        The *mdrun-args* are set on initializing the class. Override\n        :meth:`mpicommand` to fit your system if the simple default\n        OpenMP launcher is not appropriate.", "docstring_tokens": ["Returns", "simple", "command", "line", "to", "invoke", "mdrun", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 257490}
{"url": "https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/__init__.py#L26-L39", "sha": "3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8", "docstring_summary": "Ensures that the provided document is an lxml Element or json dict.", "language": "python", "parameters": "(doc, format)", "return_statement": "return doc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", "in", "(", "'xml'", ",", "'json'", ")", "if", "getattr", "(", "arg_0", ",", "'tag'", ",", "None", ")", "==", "'open511'", ":", "if", "arg_1", "==", "'json'", ":", "return", "xml_to_json", "(", "arg_0", ")", "elif", "isinstance", "(", "arg_0", ",", "dict", ")", "and", "'meta'", "in", "arg_0", ":", "if", "arg_1", "==", "'xml'", ":", "return", "json_doc_to_xml", "(", "arg_0", ")", "else", ":", "raise", "ValueError", "(", "\"Unrecognized input document\"", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Ensures that the provided document is an lxml Element or json dict.\n    \"\"\"\n    assert arg_1 in ('xml', 'json')\n    if getattr(arg_0, 'tag', None) == 'open511':\n        if arg_1 == 'json':\n            return xml_to_json(arg_0)\n    elif isinstance(arg_0, dict) and 'meta' in arg_0:\n        if arg_1 == 'xml':\n            return json_doc_to_xml(arg_0)\n    else:\n        raise ValueError(\"Unrecognized input document\")\n    return arg_0", "path": "open511/converter/__init__.py", "identifier": "ensure_format", "docstring": "Ensures that the provided document is an lxml Element or json dict.", "docstring_tokens": ["Ensures", "that", "the", "provided", "document", "is", "an", "lxml", "Element", "or", "json", "dict", "."], "nwo": "open511/open511", "score": 0.138843686048881, "idx": 257491}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2848-L2869", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return as a string a set of input history slices.", "language": "python", "parameters": "(self, range_str, raw=False)", "return_statement": "return \"\\n\".join(x for _, _, x in lines)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "history_manager", ".", "get_range_by_str", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "\"\\n\"", ".", "join", "(", "arg_5", "for", "arg_4", ",", "arg_4", ",", "arg_5", "in", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Return as a string a set of input history slices.\n\n        Parameters\n        ----------\n        range_str : string\n            The set of slices is given as a string, like \"~5/6-~4/2 4:8 9\",\n            since this function is for use by magic functions which get their\n            arguments as strings. The number before the / is the session\n            number: ~n goes n back from the current session.\n\n        Optional Parameters:\n          - raw(False): by default, the processed input is used.  If this is\n          true, the raw input history is used instead.\n\n        Note that slices can be called with two notations:\n\n        N:M -> standard python form, means including items N...(M-1).\n\n        N-M -> include items N..M (closed endpoint).\"\"\"\n        arg_3 = arg_0.history_manager.get_range_by_str(arg_1, arg_2=arg_2)\n        return \"\\n\".join(arg_5 for arg_4, arg_4, arg_5 in arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.extract_input_lines", "docstring": "Return as a string a set of input history slices.\n\n        Parameters\n        ----------\n        range_str : string\n            The set of slices is given as a string, like \"~5/6-~4/2 4:8 9\",\n            since this function is for use by magic functions which get their\n            arguments as strings. The number before the / is the session\n            number: ~n goes n back from the current session.\n\n        Optional Parameters:\n          - raw(False): by default, the processed input is used.  If this is\n          true, the raw input history is used instead.\n\n        Note that slices can be called with two notations:\n\n        N:M -> standard python form, means including items N...(M-1).\n\n        N-M -> include items N..M (closed endpoint).", "docstring_tokens": ["Return", "as", "a", "string", "a", "set", "of", "input", "history", "slices", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257492}
{"url": "https://github.com/mcs07/MolVS/blob/d815fe52d160abcecbcbf117e6437bf727dbd8ad/molvs/resonance.py#L52-L76", "sha": "d815fe52d160abcecbcbf117e6437bf727dbd8ad", "docstring_summary": "Enumerate all possible resonance forms and return them as a list.", "language": "python", "parameters": "(self, mol)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "if", "arg_0", ".", "kekule_all", ":", "arg_2", "=", "arg_2", "|", "Chem", ".", "KEKULE_ALL", "if", "arg_0", ".", "allow_incomplete_octets", ":", "arg_2", "=", "arg_2", "|", "Chem", ".", "ALLOW_INCOMPLETE_OCTETS", "if", "arg_0", ".", "allow_charge_separation", ":", "arg_2", "=", "arg_2", "|", "Chem", ".", "ALLOW_CHARGE_SEPARATION", "if", "arg_0", ".", "unconstrained_anions", ":", "arg_2", "=", "arg_2", "|", "Chem", ".", "UNCONSTRAINED_ANIONS", "if", "arg_0", ".", "unconstrained_cations", ":", "arg_2", "=", "arg_2", "|", "Chem", ".", "UNCONSTRAINED_CATIONS", "arg_3", "=", "[", "]", "for", "arg_4", "in", "Chem", ".", "ResonanceMolSupplier", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "maxStructs", "=", "arg_0", ".", "max_structures", ")", ":", "Chem", ".", "SanitizeMol", "(", "arg_4", ")", "arg_3", ".", "append", "(", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Enumerate all possible resonance forms and return them as a list.\n\n        :param mol: The input molecule.\n        :type mol: rdkit.Chem.rdchem.Mol\n        :return: A list of all possible resonance forms of the molecule.\n        :rtype: list of rdkit.Chem.rdchem.Mol\n        \"\"\"\n        arg_2 = 0\n        if arg_0.kekule_all:\n            arg_2 = arg_2 | Chem.KEKULE_ALL\n        if arg_0.allow_incomplete_octets:\n            arg_2 = arg_2 | Chem.ALLOW_INCOMPLETE_OCTETS\n        if arg_0.allow_charge_separation:\n            arg_2 = arg_2 | Chem.ALLOW_CHARGE_SEPARATION\n        if arg_0.unconstrained_anions:\n            arg_2 = arg_2 | Chem.UNCONSTRAINED_ANIONS\n        if arg_0.unconstrained_cations:\n            arg_2 = arg_2 | Chem.UNCONSTRAINED_CATIONS\n        arg_3 = []\n        for arg_4 in Chem.ResonanceMolSupplier(arg_1, arg_2=arg_2, maxStructs=arg_0.max_structures):\n            # This seems necessary? ResonanceMolSupplier only does a partial sanitization\n            Chem.SanitizeMol(arg_4)\n            arg_3.append(arg_4)\n        return arg_3", "path": "molvs/resonance.py", "identifier": "ResonanceEnumerator.enumerate", "docstring": "Enumerate all possible resonance forms and return them as a list.\n\n        :param mol: The input molecule.\n        :type mol: rdkit.Chem.rdchem.Mol\n        :return: A list of all possible resonance forms of the molecule.\n        :rtype: list of rdkit.Chem.rdchem.Mol", "docstring_tokens": ["Enumerate", "all", "possible", "resonance", "forms", "and", "return", "them", "as", "a", "list", "."], "nwo": "mcs07/MolVS", "score": 0.5162715334407971, "idx": 257493}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/organisation.py#L92-L106", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Add a member to the board. Membership type can be normal or admin.\n        Returns JSON of all members if successful or raises an Unauthorised\n        exception if not.", "language": "python", "parameters": "(self, email, fullname, membership_type='normal')", "return_statement": "return self.fetch_json(\n            uri_path=self.base_uri + '/members',\n            http_method='PUT',\n            query_params={\n                'email': email,\n                'fullName': fullname,\n                'type': membership_type\n            }\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'normal'", ")", ":", "return", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", "+", "'/members'", ",", "http_method", "=", "'PUT'", ",", "query_params", "=", "{", "'email'", ":", "arg_1", ",", "'fullName'", ":", "arg_2", ",", "'type'", ":", "arg_3", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='normal'):\n        '''\n        Add a member to the board. Membership type can be normal or admin.\n        Returns JSON of all members if successful or raises an Unauthorised\n        exception if not.\n        '''\n        return arg_0.fetch_json(\n            uri_path=arg_0.base_uri + '/members',\n            http_method='PUT',\n            query_params={\n                'email': arg_1,\n                'fullName': arg_2,\n                'type': arg_3\n            }\n        )", "path": "trolly/organisation.py", "identifier": "Organisation.add_member", "docstring": "Add a member to the board. Membership type can be normal or admin.\n        Returns JSON of all members if successful or raises an Unauthorised\n        exception if not.", "docstring_tokens": ["Add", "a", "member", "to", "the", "board", ".", "Membership", "type", "can", "be", "normal", "or", "admin", ".", "Returns", "JSON", "of", "all", "members", "if", "successful", "or", "raises", "an", "Unauthorised", "exception", "if", "not", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 257494}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/meta.py#L8-L20", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Build an enum statement", "language": "python", "parameters": "(*sequential, **named)", "return_statement": "return type('Enum', (), enums)", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "dict", "(", "zip", "(", "arg_0", ",", "range", "(", "len", "(", "arg_0", ")", ")", ")", ",", "**", "arg_1", ")", "arg_2", "[", "'map'", "]", "=", "copy", ".", "copy", "(", "arg_2", ")", "arg_2", "[", "'rmap'", "]", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "if", "type", "(", "arg_4", ")", "is", "int", ":", "arg_2", "[", "'rmap'", "]", "[", "arg_4", "]", "=", "arg_3", "return", "type", "(", "'Enum'", ",", "(", ")", ",", "arg_2", ")"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    Build an Func statement\n    \"\"\"\n    #: build Funcs from parameter\n    arg_2 = dict(zip(arg_0, range(len(arg_0))), **arg_1)\n    arg_2['map'] = copy.copy(arg_2)\n    #: build reverse mapping\n    arg_2['rmap'] = {}\n    for arg_3, arg_4 in arg_2.items():\n        if type(arg_4) is int:\n            arg_2['rmap'][arg_4] = arg_3\n    return type('Enum', (), arg_2)", "path": "pyrser/meta.py", "identifier": "enum", "docstring": "Build an enum statement", "docstring_tokens": ["Build", "an", "enum", "statement"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 257495}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementclient.py#L179-L201", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Performs a PUT request and returns the response.", "language": "python", "parameters": "(self, path, body, x_ms_version=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "HTTPRequest", "(", ")", "arg_4", ".", "method", "=", "'PUT'", "arg_4", ".", "host", "=", "arg_0", ".", "host", "arg_4", ".", "path", "=", "arg_1", "arg_4", ".", "body", "=", "_get_request_body", "(", "arg_2", ")", "arg_4", ".", "path", ",", "arg_4", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_4", ")", "arg_4", ".", "headers", "=", "arg_0", ".", "_update_management_header", "(", "arg_4", ",", "arg_3", ")", "arg_9", "=", "arg_0", ".", "_perform_request", "(", "arg_4", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        '''\n        Performs a PUT request and returns the response.\n\n        path:\n            Path to the resource.\n            Ex: '/<subscription-id>/services/hostedservices/<service-name>'\n        body:\n            Body for the PUT request.\n        x_ms_version:\n            If specified, this is used for the x-ms-version header.\n            Otherwise, self.x_ms_version is used.\n        '''\n        arg_4 = HTTPRequest()\n        arg_4.method = 'PUT'\n        arg_4.host = arg_0.host\n        arg_4.path = arg_1\n        arg_4.body = _get_request_body(arg_2)\n        arg_4.path, arg_4.query = arg_0._httpclient._update_request_uri_query(arg_4)\n        arg_4.headers = arg_0._update_management_header(arg_4, arg_3)\n        arg_9 = arg_0._perform_request(arg_4)\n\n        return arg_9", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementclient.py", "identifier": "_ServiceManagementClient.perform_put", "docstring": "Performs a PUT request and returns the response.\n\n        path:\n            Path to the resource.\n            Ex: '/<subscription-id>/services/hostedservices/<service-name>'\n        body:\n            Body for the PUT request.\n        x_ms_version:\n            If specified, this is used for the x-ms-version header.\n            Otherwise, self.x_ms_version is used.", "docstring_tokens": ["Performs", "a", "PUT", "request", "and", "returns", "the", "response", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257496}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/coord_transform.py#L71-L92", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Gets a 3D CoordinateMap from img.", "language": "python", "parameters": "(img)", "return_statement": "return cm", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "nib", ".", "Nifti1Image", ")", ":", "arg_0", "=", "nifti2nipy", "(", "arg_0", ")", "if", "arg_0", ".", "ndim", "==", "4", ":", "from", "nipy", ".", "core", ".", "reference", ".", "coordinate_map", "import", "drop_io_dim", "arg_1", "=", "drop_io_dim", "(", "arg_0", ".", "coordmap", ",", "3", ")", "else", ":", "arg_1", "=", "arg_0", ".", "coordmap", "return", "arg_1"], "function": "def Func(arg_0):\n    '''\n    Gets a 3D CoordinateMap from img.\n\n    Parameters\n    ----------\n    img: nib.Nifti1Image or nipy Image\n\n    Returns\n    -------\n    nipy.core.reference.coordinate_map.CoordinateMap\n    '''\n    if isinstance(arg_0, nib.Nifti1Image):\n        arg_0 = nifti2nipy(arg_0)\n\n    if arg_0.ndim == 4:\n        from nipy.core.reference.coordinate_map import drop_io_dim\n        arg_1 = drop_io_dim(arg_0.coordmap, 3)\n    else:\n        arg_1 = arg_0.coordmap\n\n    return arg_1", "path": "boyle/nifti/coord_transform.py", "identifier": "get_3D_coordmap", "docstring": "Gets a 3D CoordinateMap from img.\n\n    Parameters\n    ----------\n    img: nib.Nifti1Image or nipy Image\n\n    Returns\n    -------\n    nipy.core.reference.coordinate_map.CoordinateMap", "docstring_tokens": ["Gets", "a", "3D", "CoordinateMap", "from", "img", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 257497}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_cosmos_hook.py#L226-L237", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Delete an existing document out of a collection in the CosmosDB database.", "language": "python", "parameters": "(self, document_id, database_name=None, collection_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "AirflowBadRequest", "(", "\"Cannot delete a document without an id\"", ")", "arg_0", ".", "get_conn", "(", ")", ".", "DeleteItem", "(", "get_document_link", "(", "arg_0", ".", "__get_database_name", "(", "arg_2", ")", ",", "arg_0", ".", "__get_collection_name", "(", "arg_3", ")", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n        Delete an existing document out of a collection in the CosmosDB database.\n        \"\"\"\n        if arg_1 is None:\n            raise AirflowBadRequest(\"Cannot delete a document without an id\")\n\n        arg_0.get_conn().DeleteItem(\n            get_document_link(\n                arg_0.__get_database_name(arg_2),\n                arg_0.__get_collection_name(arg_3),\n                arg_1))", "path": "airflow/contrib/hooks/azure_cosmos_hook.py", "identifier": "AzureCosmosDBHook.delete_document", "docstring": "Delete an existing document out of a collection in the CosmosDB database.", "docstring_tokens": ["Delete", "an", "existing", "document", "out", "of", "a", "collection", "in", "the", "CosmosDB", "database", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257498}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/epicom/algorithm.py#L81-L88", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Run EpiCom analysis on many graphs.", "language": "python", "parameters": "(graphs: Iterable[BELGraph], path: Union[None, str, TextIO])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "arg_3", ":", "arg_4", "[", "None", ",", "arg_5", ",", "arg_6", "]", ")", "->", "None", ":", "if", "isinstance", "(", "arg_3", ",", "arg_5", ")", ":", "with", "open", "(", "arg_3", ",", "'w'", ")", "as", "file", ":", "_multi_run_helper_file_wrapper", "(", "arg_0", ",", "file", ")", "else", ":", "_multi_run_helper_file_wrapper", "(", "arg_0", ",", "arg_3", ")"], "function": "def Func(arg_0: arg_1[arg_2], arg_3: arg_4[None, arg_5, arg_6]) -> None:\n    \"\"\"Run EpiCom analysis on many graphs.\"\"\"\n    if isinstance(arg_3, arg_5):\n        with open(arg_3, 'w') as file:\n            _multi_run_helper_file_wrapper(arg_0, file)\n\n    else:\n        _multi_run_helper_file_wrapper(arg_0, arg_3)", "path": "src/pybel_tools/analysis/epicom/algorithm.py", "identifier": "multi_run_epicom", "docstring": "Run EpiCom analysis on many graphs.", "docstring_tokens": ["Run", "EpiCom", "analysis", "on", "many", "graphs", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257499}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L705-L716", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Save the state of hooks in the sys module.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_orig_sys_module_state", "=", "{", "}", "arg_0", ".", "_orig_sys_module_state", "[", "'stdin'", "]", "=", "sys", ".", "stdin", "arg_0", ".", "_orig_sys_module_state", "[", "'stdout'", "]", "=", "sys", ".", "stdout", "arg_0", ".", "_orig_sys_module_state", "[", "'stderr'", "]", "=", "sys", ".", "stderr", "arg_0", ".", "_orig_sys_module_state", "[", "'excepthook'", "]", "=", "sys", ".", "excepthook", "arg_0", ".", "_orig_sys_modules_main_name", "=", "arg_0", ".", "user_module", ".", "__name__", "arg_0", ".", "_orig_sys_modules_main_mod", "=", "sys", ".", "modules", ".", "get", "(", "arg_0", ".", "user_module", ".", "__name__", ")"], "function": "def Func(arg_0):\n        \"\"\"Save the state of hooks in the sys module.\n\n        This has to be called after self.user_module is created.\n        \"\"\"\n        arg_0._orig_sys_module_state = {}\n        arg_0._orig_sys_module_state['stdin'] = sys.stdin\n        arg_0._orig_sys_module_state['stdout'] = sys.stdout\n        arg_0._orig_sys_module_state['stderr'] = sys.stderr\n        arg_0._orig_sys_module_state['excepthook'] = sys.excepthook\n        arg_0._orig_sys_modules_main_name = arg_0.user_module.__name__\n        arg_0._orig_sys_modules_main_mod = sys.modules.get(arg_0.user_module.__name__)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.save_sys_module_state", "docstring": "Save the state of hooks in the sys module.\n\n        This has to be called after self.user_module is created.", "docstring_tokens": ["Save", "the", "state", "of", "hooks", "in", "the", "sys", "module", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257500}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/config.py#L264-L290", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Download the production configuration and install it in the\n        current directory.", "language": "python", "parameters": "(self)", "return_statement": "return Download(production_config_link, self.path_to_config).text()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"https://raw.githubusercontent.com/funilrys/PyFunceble/master/.PyFunceble_production.yaml\"", "arg_1", "=", "Version", "(", "True", ")", ".", "right_url_from_version", "(", "arg_1", ")", "if", "not", "Version", "(", "True", ")", ".", "is_cloned", "(", ")", ":", "Download", "(", "arg_1", ",", "arg_0", ".", "path_to_default_config", ")", ".", "text", "(", ")", "return", "Download", "(", "arg_1", ",", "arg_0", ".", "path_to_config", ")", ".", "text", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Download the production configuration and install it in the\n        current directory.\n        \"\"\"\n\n        # We initiate the link to the production configuration.\n        # It is not hard coded because this method is called only if we\n        # are sure that the configuration file exist.\n        arg_1 = \"https://raw.githubusercontent.com/funilrys/PyFunceble/master/.PyFunceble_production.yaml\"  # pylint: disable=line-too-long\n\n        # We update the link according to our current version.\n        arg_1 = Version(True).right_url_from_version(\n            arg_1\n        )\n\n        if not Version(True).is_cloned():\n            # The current version is not the cloned one.\n\n            # We download the link content and save it inside the default location.\n            #\n            # Note: We add this one in order to allow the enduser to always have\n            # a copy of our upstream configuration file.\n            Download(arg_1, arg_0.path_to_default_config).text()\n\n        # And we download the link content and return the download status.\n        return Download(arg_1, arg_0.path_to_config).text()", "path": "PyFunceble/config.py", "identifier": "Load._install_production_config", "docstring": "Download the production configuration and install it in the\n        current directory.", "docstring_tokens": ["Download", "the", "production", "configuration", "and", "install", "it", "in", "the", "current", "directory", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 257501}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/cli/parser.py#L411-L418", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Sets args and kwargs that are passed when creating a subparsers group\n        in an argparse.ArgumentParser i.e. when calling\n        argparser.ArgumentParser.add_subparsers", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "subparsers_args", "=", "arg_1", "arg_0", ".", "subparsers_kwargs", "=", "arg_2"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Sets args and kwargs that are passed when creating a subparsers group\n        in an argparse.ArgumentParser i.e. when calling\n        argparser.ArgumentParser.add_subparsers\n        \"\"\"\n        arg_0.subparsers_args = arg_1\n        arg_0.subparsers_kwargs = arg_2", "path": "quilt/cli/parser.py", "identifier": "SubParsersMixin.set_subparsers_args", "docstring": "Sets args and kwargs that are passed when creating a subparsers group\n        in an argparse.ArgumentParser i.e. when calling\n        argparser.ArgumentParser.add_subparsers", "docstring_tokens": ["Sets", "args", "and", "kwargs", "that", "are", "passed", "when", "creating", "a", "subparsers", "group", "in", "an", "argparse", ".", "ArgumentParser", "i", ".", "e", ".", "when", "calling", "argparser", ".", "ArgumentParser", ".", "add_subparsers"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 257502}
{"url": "https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/netcdf/clone.py#L8-L92", "sha": "7ea7626695abf095df6a67f66e5b3e9ae91b16df", "docstring_summary": "Mostly ripped from nc3tonc4 in netCDF4-python.\n        Added ability to skip dimension and variables.\n        Removed all of the unpacking logic for shorts.", "language": "python", "parameters": "(src, dst_path, skip_globals, skip_dimensions, skip_variables)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "os", ".", "unlink", "(", "arg_1", ")", "arg_5", "=", "netCDF4", ".", "Dataset", "(", "arg_1", ",", "'w'", ")", "for", "arg_6", "in", "arg_0", ".", "ncattrs", "(", ")", ":", "if", "arg_6", "not", "in", "arg_2", ":", "setattr", "(", "arg_5", ",", "arg_6", ",", "getattr", "(", "arg_0", ",", "arg_6", ")", ")", "arg_7", "=", "None", "arg_8", "=", "False", "for", "arg_9", ",", "arg_10", "in", "arg_0", ".", "dimensions", ".", "items", "(", ")", ":", "if", "arg_9", "in", "arg_3", ":", "continue", "if", "arg_10", ".", "isunlimited", "(", ")", ":", "arg_7", "=", "arg_10", "arg_8", "=", "arg_9", "arg_5", ".", "createDimension", "(", "arg_9", ",", "None", ")", "else", ":", "arg_5", ".", "createDimension", "(", "arg_9", ",", "arg_23", "(", "arg_10", ")", ")", "for", "arg_11", ",", "arg_12", "in", "arg_0", ".", "variables", ".", "items", "(", ")", ":", "if", "arg_11", "in", "arg_4", ":", "continue", "arg_13", "=", "False", "if", "arg_8", "and", "arg_8", "in", "arg_12", ".", "dimensions", ":", "arg_13", "=", "True", "arg_14", "=", "None", "if", "hasattr", "(", "arg_12", ",", "'_FillValue'", ")", ":", "arg_14", "=", "arg_12", ".", "_FillValue", "if", "arg_12", ".", "chunking", "==", "\"contiguous\"", ":", "arg_15", "=", "arg_5", ".", "createVariable", "(", "arg_11", ",", "arg_12", ".", "dtype", ",", "arg_12", ".", "dimensions", ",", "fill_value", "=", "arg_14", ")", "else", ":", "arg_15", "=", "arg_5", ".", "createVariable", "(", "arg_11", ",", "arg_12", ".", "dtype", ",", "arg_12", ".", "dimensions", ",", "fill_value", "=", "arg_14", ",", "chunksizes", "=", "arg_12", ".", "chunking", "(", ")", ")", "for", "arg_6", "in", "arg_12", ".", "ncattrs", "(", ")", ":", "if", "arg_6", "==", "'_FillValue'", ":", "continue", "else", ":", "setattr", "(", "arg_15", ",", "arg_6", ",", "getattr", "(", "arg_12", ",", "arg_6", ")", ")", "arg_16", "=", "1000", "if", "arg_13", ":", "if", "arg_16", ":", "arg_17", "=", "0", "arg_18", "=", "arg_23", "(", "arg_7", ")", "arg_19", "=", "arg_16", "if", "arg_19", "<", "1", ":", "arg_19", "=", "1", "for", "arg_20", "in", "range", "(", "arg_17", ",", "arg_18", ",", "arg_19", ")", ":", "arg_21", "=", "arg_20", "+", "arg_16", "if", "arg_21", ">", "arg_23", "(", "arg_7", ")", ":", "arg_21", "=", "arg_23", "(", "arg_7", ")", "arg_22", "=", "arg_12", "[", "arg_20", ":", "arg_21", "]", "arg_15", "[", "arg_20", ":", "arg_21", "]", "=", "arg_22", "else", ":", "arg_22", "=", "arg_12", "[", ":", "]", "arg_15", "[", "0", ":", "arg_23", "(", "arg_7", ")", "]", "=", "arg_22", "else", ":", "arg_22", "=", "arg_12", "[", ":", "]", "arg_15", "[", ":", "]", "=", "arg_22", "arg_5", ".", "sync", "(", ")", "arg_0", ".", "close", "(", ")", "arg_5", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n        Mostly ripped from nc3tonc4 in netCDF4-python.\n        Added ability to skip dimension and variables.\n        Removed all of the unpacking logic for shorts.\n    \"\"\"\n\n    if os.path.exists(arg_1):\n        os.unlink(arg_1)\n    arg_5 = netCDF4.Dataset(arg_1, 'w')\n\n    # Global attributes\n    for arg_6 in arg_0.ncattrs():\n        if arg_6 not in arg_2:\n            setattr(arg_5, arg_6, getattr(arg_0, arg_6))\n\n    # Dimensions\n    arg_7     = None\n    arg_8 = False\n    for arg_9, arg_10 in arg_0.dimensions.items():\n\n        # Skip what we need to\n        if arg_9 in arg_3:\n            continue\n\n        if arg_10.isunlimited():\n            arg_7     = arg_10\n            arg_8 = arg_9\n            arg_5.createDimension(arg_9, None)\n        else:\n            arg_5.createDimension(arg_9, arg_23(arg_10))\n\n    # Variables\n    for arg_11, arg_12 in arg_0.variables.items():\n\n        # Skip what we need to\n        if arg_11 in arg_4:\n            continue\n\n        arg_13 = False\n        if arg_8 and arg_8 in arg_12.dimensions:\n            arg_13 = True\n\n        arg_14 = None\n        if hasattr(arg_12, '_FillValue'):\n            arg_14 = arg_12._FillValue\n\n        if arg_12.chunking == \"contiguous\":\n            arg_15 = arg_5.createVariable(arg_11, arg_12.dtype, arg_12.dimensions, fill_value=arg_14)\n        else:\n            arg_15 = arg_5.createVariable(arg_11, arg_12.dtype, arg_12.dimensions, fill_value=arg_14, chunksizes=arg_12.chunking())\n\n        # Attributes\n        for arg_6 in arg_12.ncattrs():\n            if arg_6 == '_FillValue':\n                continue\n            else:\n                setattr(arg_15, arg_6, getattr(arg_12, arg_6))\n\n        # Data\n        arg_16 = 1000\n        if arg_13:\n            if arg_16:\n                arg_17 = 0\n                arg_18 = arg_23(arg_7)\n                arg_19 = arg_16\n                if arg_19 < 1:\n                    arg_19 = 1\n                for arg_20 in range(arg_17, arg_18, arg_19):\n                    arg_21 = arg_20 + arg_16\n                    if arg_21 > arg_23(arg_7):\n                        arg_21 = arg_23(arg_7)\n                    arg_22 = arg_12[arg_20:arg_21]\n                    arg_15[arg_20:arg_21] = arg_22\n            else:\n                arg_22 = arg_12[:]\n                arg_15[0:arg_23(arg_7)] = arg_22\n        else:\n            arg_22 = arg_12[:]\n            arg_15[:] = arg_22\n\n        arg_5.sync()\n\n    arg_0.close()\n    arg_5.close()", "path": "pyaxiom/netcdf/clone.py", "identifier": "clone", "docstring": "Mostly ripped from nc3tonc4 in netCDF4-python.\n        Added ability to skip dimension and variables.\n        Removed all of the unpacking logic for shorts.", "docstring_tokens": ["Mostly", "ripped", "from", "nc3tonc4", "in", "netCDF4", "-", "python", ".", "Added", "ability", "to", "skip", "dimension", "and", "variables", ".", "Removed", "all", "of", "the", "unpacking", "logic", "for", "shorts", "."], "nwo": "axiom-data-science/pyaxiom", "score": 0.138843686048881, "idx": 257503}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfdocument.py#L726-L736", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Called by the PDFLite object to prompt creating\r\n            the font objects.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "session", ".", "_save_object_number", "(", ")", "arg_0", ".", "_output_encoding_diffs", "(", ")", "arg_0", ".", "_output_font_files", "(", ")", "for", "arg_1", "in", "arg_0", ".", "fonts", ":", "arg_2", "=", "arg_0", ".", "session", ".", "_add_object", "(", ")", "arg_1", ".", "_set_number", "(", "arg_2", ".", "id", ")", "arg_1", ".", "_output", "(", ")"], "function": "def Func(arg_0):\r\n        \"\"\" Called by the PDFLite object to prompt creating\r\n            the font objects.\"\"\"\r\n        arg_0.session._save_object_number()\r\n        arg_0._output_encoding_diffs()\r\n        arg_0._output_font_files()\r\n\r\n        for arg_1 in arg_0.fonts:\r\n            arg_2 = arg_0.session._add_object()\r\n            arg_1._set_number(arg_2.id)\r\n            arg_1._output()", "path": "pypdflite/pdfdocument.py", "identifier": "PDFDocument._output_fonts", "docstring": "Called by the PDFLite object to prompt creating\r\n            the font objects.", "docstring_tokens": ["Called", "by", "the", "PDFLite", "object", "to", "prompt", "creating", "the", "font", "objects", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 257504}
{"url": "https://github.com/pbrisk/businessdate/blob/79a0c5a4e557cbacca82a430403b18413404a9bc/businessdate/businessdate.py#L431-L455", "sha": "79a0c5a4e557cbacca82a430403b18413404a9bc", "docstring_summary": "private method for the addition of business days, used in the addition of a BusinessPeriod only", "language": "python", "parameters": "(self, days_int, holiday_obj=None)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", "if", "arg_1", ">=", "0", ":", "arg_4", "=", "0", "while", "arg_4", "<", "arg_1", ":", "arg_3", "=", "BusinessDate", ".", "add_days", "(", "arg_3", ",", "1", ")", "if", "BusinessDate", ".", "is_business_day", "(", "arg_3", ",", "arg_2", ")", ":", "arg_4", "+=", "1", "else", ":", "arg_4", "=", "0", "while", "arg_4", ">", "arg_1", ":", "arg_3", "=", "BusinessDate", ".", "add_days", "(", "arg_3", ",", "-", "1", ")", "if", "BusinessDate", ".", "is_business_day", "(", "arg_3", ",", "arg_2", ")", ":", "arg_4", "-=", "1", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        private method for the addition of business days, used in the addition of a BusinessPeriod only\n\n        :param BusinessDate d:\n        :param int days_int:\n        :param list holiday_obj:\n        :return: BusinessDate\n        \"\"\"\n\n        arg_3 = arg_0\n        if arg_1 >= 0:\n            arg_4 = 0\n            while arg_4 < arg_1:\n                arg_3 = BusinessDate.add_days(arg_3, 1)\n                if BusinessDate.is_business_day(arg_3, arg_2):\n                    arg_4 += 1\n        else:\n            arg_4 = 0\n            while arg_4 > arg_1:\n                arg_3 = BusinessDate.add_days(arg_3, -1)\n                if BusinessDate.is_business_day(arg_3, arg_2):\n                    arg_4 -= 1\n\n        return arg_3", "path": "businessdate/businessdate.py", "identifier": "BusinessDate.add_business_days", "docstring": "private method for the addition of business days, used in the addition of a BusinessPeriod only\n\n        :param BusinessDate d:\n        :param int days_int:\n        :param list holiday_obj:\n        :return: BusinessDate", "docstring_tokens": ["private", "method", "for", "the", "addition", "of", "business", "days", "used", "in", "the", "addition", "of", "a", "BusinessPeriod", "only"], "nwo": "pbrisk/businessdate", "score": 0.16638194949711382, "idx": 257505}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/node_properties.py#L80-L89", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Return a set of all nodes that have both an in-degree > 0 and out-degree > 0.", "language": "python", "parameters": "(graph: BELGraph, func: str)", "return_statement": "return {\n        node\n        for node in graph\n        if node.function == func and is_causal_central(graph, node)\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "Set", "[", "BaseEntity", "]", ":", "return", "{", "arg_4", "for", "arg_4", "in", "arg_0", "if", "arg_4", ".", "function", "==", "arg_2", "and", "is_causal_central", "(", "arg_0", ",", "arg_4", ")", "}"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> Set[BaseEntity]:\n    \"\"\"Return a set of all nodes that have both an in-degree > 0 and out-degree > 0.\n\n    This means that they are an integral part of a pathway, since they are both produced and consumed.\n    \"\"\"\n    return {\n        arg_4\n        for arg_4 in arg_0\n        if arg_4.function == arg_2 and is_causal_central(arg_0, arg_4)\n    }", "path": "src/pybel_tools/summary/node_properties.py", "identifier": "get_causal_central_nodes", "docstring": "Return a set of all nodes that have both an in-degree > 0 and out-degree > 0.\n\n    This means that they are an integral part of a pathway, since they are both produced and consumed.", "docstring_tokens": ["Return", "a", "set", "of", "all", "nodes", "that", "have", "both", "an", "in", "-", "degree", ">", "0", "and", "out", "-", "degree", ">", "0", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257506}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L67-L96", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Make a call to Trello API and capture JSON response. Raises an error\n        when it fails.", "language": "python", "parameters": "(self, uri_path, http_method='GET', query_params=None,\n                   body=None, headers=None)", "return_statement": "return json.loads(content.decode('utf-8'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'GET'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_3", "=", "arg_3", "or", "{", "}", "arg_5", "=", "arg_5", "or", "{", "}", "arg_3", "=", "arg_0", ".", "add_authorisation", "(", "arg_3", ")", "arg_6", "=", "arg_0", ".", "build_uri", "(", "arg_1", ",", "arg_3", ")", "arg_7", "=", "(", "\"POST\"", ",", "\"PUT\"", ",", "\"DELETE\"", ")", "if", "arg_2", "in", "arg_7", "and", "'Content-Type'", "not", "in", "arg_5", ":", "arg_5", "[", "'Content-Type'", "]", "=", "'application/json'", "arg_5", "[", "'Accept'", "]", "=", "'application/json'", "arg_8", ",", "arg_9", "=", "arg_0", ".", "client", ".", "request", "(", "arg_6", "=", "arg_6", ",", "method", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_0", ".", "check_errors", "(", "arg_6", ",", "arg_8", ")", "return", "json", ".", "loads", "(", "arg_9", ".", "decode", "(", "'utf-8'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2='GET', arg_3=None,\n                   arg_4=None, arg_5=None):\n        '''\n        Make a call to Trello API and capture JSON response. Raises an error\n        when it fails.\n\n        Returns:\n            dict: Dictionary with the JSON data\n        '''\n        arg_3 = arg_3 or {}\n        arg_5 = arg_5 or {}\n\n        arg_3 = arg_0.add_authorisation(arg_3)\n        arg_6 = arg_0.build_uri(arg_1, arg_3)\n\n        arg_7 = (\"POST\", \"PUT\", \"DELETE\")\n        if arg_2 in arg_7 and 'Content-Type' not in arg_5:\n            arg_5['Content-Type'] = 'application/json'\n\n        arg_5['Accept'] = 'application/json'\n        arg_8, arg_9 = arg_0.client.request(\n            arg_6=arg_6,\n            method=arg_2,\n            arg_4=arg_4,\n            arg_5=arg_5\n        )\n\n        arg_0.check_errors(arg_6, arg_8)\n\n        return json.loads(arg_9.decode('utf-8'))", "path": "trolly/client.py", "identifier": "Client.fetch_json", "docstring": "Make a call to Trello API and capture JSON response. Raises an error\n        when it fails.\n\n        Returns:\n            dict: Dictionary with the JSON data", "docstring_tokens": ["Make", "a", "call", "to", "Trello", "API", "and", "capture", "JSON", "response", ".", "Raises", "an", "error", "when", "it", "fails", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 257507}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/objects.py#L1407-L1426", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Verify that the contents of the OpaqueObject are valid.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ".", "value", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"opaque value must be bytes\"", ")", "elif", "not", "isinstance", "(", "arg_0", ".", "opaque_type", ",", "enums", ".", "OpaqueDataType", ")", ":", "raise", "TypeError", "(", "\"opaque data type must be an OpaqueDataType \"", "\"enumeration\"", ")", "arg_1", "=", "len", "(", "arg_0", ".", "names", ")", "for", "arg_2", "in", "range", "(", "arg_1", ")", ":", "arg_3", "=", "arg_0", ".", "names", "[", "arg_2", "]", "if", "not", "isinstance", "(", "arg_3", ",", "six", ".", "string_types", ")", ":", "arg_4", "=", "\"({0} in list)\"", ".", "format", "(", "arg_2", ")", "raise", "TypeError", "(", "\"opaque data name {0} must be a string\"", ".", "format", "(", "arg_4", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Verify that the contents of the OpaqueObject are valid.\n\n        Raises:\n            TypeError: if the types of any OpaqueObject attributes are invalid.\n        \"\"\"\n        if not isinstance(arg_0.value, bytes):\n            raise TypeError(\"opaque value must be bytes\")\n        elif not isinstance(arg_0.opaque_type, enums.OpaqueDataType):\n            raise TypeError(\"opaque data type must be an OpaqueDataType \"\n                            \"enumeration\")\n\n        arg_1 = len(arg_0.names)\n        for arg_2 in range(arg_1):\n            arg_3 = arg_0.names[arg_2]\n            if not isinstance(arg_3, six.string_types):\n                arg_4 = \"({0} in list)\".format(arg_2)\n                raise TypeError(\"opaque data name {0} must be a string\".format(\n                    arg_4))", "path": "kmip/pie/objects.py", "identifier": "OpaqueObject.validate", "docstring": "Verify that the contents of the OpaqueObject are valid.\n\n        Raises:\n            TypeError: if the types of any OpaqueObject attributes are invalid.", "docstring_tokens": ["Verify", "that", "the", "contents", "of", "the", "OpaqueObject", "are", "valid", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 257508}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L732-L778", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return a list of found external link objects.", "language": "python", "parameters": "(self)", "return_statement": "return external_links", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "List", "[", "'ExternalLink'", "]", ":", "Func", "=", "[", "]", "arg_2", "=", "Func", ".", "append", "arg_3", "=", "arg_0", ".", "_type_to_spans", "arg_4", "=", "arg_0", ".", "_lststr", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_span", "arg_7", "=", "arg_3", ".", "setdefault", "(", "'ExternalLink'", ",", "[", "]", ")", "if", "not", "arg_7", ":", "arg_8", "=", "arg_7", ".", "append", "for", "arg_9", "in", "EXTERNAL_LINK_FINDITER", "(", "arg_0", ".", "_ext_link_shadow", ")", ":", "Func0", ",", "Func1", "=", "arg_9", ".", "span", "(", ")", "Func2", "=", "[", "arg_5", "+", "Func0", ",", "arg_5", "+", "Func1", "]", "arg_8", "(", "Func2", ")", "arg_2", "(", "ExternalLink", "(", "arg_4", ",", "arg_3", ",", "Func2", ",", "'ExternalLink'", ")", ")", "return", "Func", "Func3", "=", "{", "(", "Func0", "[", "0", "]", ",", "Func0", "[", "1", "]", ")", ":", "Func0", "for", "Func0", "in", "arg_7", "}", ".", "get", "for", "arg_9", "in", "EXTERNAL_LINK_FINDITER", "(", "arg_0", ".", "_ext_link_shadow", ")", ":", "Func0", ",", "Func1", "=", "arg_9", ".", "span", "(", ")", "Func2", "=", "Func0", ",", "Func1", "=", "[", "Func0", "+", "arg_5", ",", "Func1", "+", "arg_5", "]", "Func4", "=", "Func3", "(", "(", "Func0", ",", "Func1", ")", ")", "if", "Func4", "is", "None", ":", "insort", "(", "arg_7", ",", "Func2", ")", "else", ":", "Func2", "=", "Func4", "arg_2", "(", "ExternalLink", "(", "arg_4", ",", "arg_3", ",", "Func2", ",", "'ExternalLink'", ")", ")", "return", "Func"], "function": "def Func(arg_0) -> List['ExternalLink']:\n        \"\"\"Return a list of found external link objects.\n\n        Note:\n            Templates adjacent to external links are considered part of the\n            link. In reality, this depends on the contents of the template:\n\n            >>> WikiText(\n            ...    'http://example.com{{dead link}}'\n            ...).external_links[0].url\n            'http://example.com{{dead link}}'\n\n            >>> WikiText(\n            ...    '[http://example.com{{space template}} text]'\n            ...).external_links[0].url\n            'http://example.com{{space template}}'\n        \"\"\"\n        Func = []  # type: List['ExternalLink']\n        arg_2 = Func.append\n        arg_3 = arg_0._type_to_spans\n        arg_4 = arg_0._lststr\n        arg_5, arg_6 = arg_0._span\n        arg_7 = arg_3.setdefault('ExternalLink', [])\n        if not arg_7:\n            # All the added spans will be new.\n            arg_8 = arg_7.append\n            for arg_9 in EXTERNAL_LINK_FINDITER(arg_0._ext_link_shadow):\n                Func0, Func1 = arg_9.span()\n                Func2 = [arg_5 + Func0, arg_5 + Func1]\n                arg_8(Func2)\n                arg_2(\n                    ExternalLink(arg_4, arg_3, Func2, 'ExternalLink'))\n            return Func\n        # There are already some ExternalLink spans. Use the already existing\n        # ones when the detected span is one of those.\n        Func3 = {(Func0[0], Func0[1]): Func0 for Func0 in arg_7}.get\n        for arg_9 in EXTERNAL_LINK_FINDITER(arg_0._ext_link_shadow):\n            Func0, Func1 = arg_9.span()\n            Func2 = Func0, Func1 = [Func0 + arg_5, Func1 + arg_5]\n            Func4 = Func3((Func0, Func1))\n            if Func4 is None:\n                insort(arg_7, Func2)\n            else:\n                Func2 = Func4\n            arg_2(\n                ExternalLink(arg_4, arg_3, Func2, 'ExternalLink'))\n        return Func", "path": "wikitextparser/_wikitext.py", "identifier": "WikiText.external_links", "docstring": "Return a list of found external link objects.\n\n        Note:\n            Templates adjacent to external links are considered part of the\n            link. In reality, this depends on the contents of the template:\n\n            >>> WikiText(\n            ...    'http://example.com{{dead link}}'\n            ...).external_links[0].url\n            'http://example.com{{dead link}}'\n\n            >>> WikiText(\n            ...    '[http://example.com{{space template}} text]'\n            ...).external_links[0].url\n            'http://example.com{{space template}}'", "docstring_tokens": ["Return", "a", "list", "of", "found", "external", "link", "objects", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 257509}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1558-L1586", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Adds a trusted certificate to this store.", "language": "python", "parameters": "(self, cert)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "X509", ")", ":", "raise", "TypeError", "(", ")", "if", "_lib", ".", "X509_STORE_Func", "(", "arg_0", ".", "_store", ",", "arg_1", ".", "_x509", ")", "==", "0", ":", "arg_2", "=", "_lib", ".", "ERR_peek_error", "(", ")", "arg_3", "=", "_lib", ".", "ERR_GET_REASON", "(", "arg_2", ")", "_openssl_assert", "(", "arg_3", "==", "_lib", ".", "X509_R_CERT_ALREADY_IN_HASH_TABLE", ")", "_lib", ".", "ERR_clear_error", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adds a trusted certificate to this store.\n\n        Adding a certificate with this method adds this certificate as a\n        *trusted* certificate.\n\n        :param X509 cert: The certificate to add to this store.\n\n        :raises TypeError: If the certificate is not an :class:`X509`.\n\n        :raises OpenSSL.crypto.Error: If OpenSSL was unhappy with your\n            certificate.\n\n        :return: ``None`` if the certificate was added successfully.\n        \"\"\"\n        if not isinstance(arg_1, X509):\n            raise TypeError()\n\n        # As of OpenSSL 1.1.0i adding the same cert to the store more than\n        # once doesn't cause an error. Accordingly, this code now silences\n        # the error for OpenSSL < 1.1.0i as well.\n        if _lib.X509_STORE_Func(arg_0._store, arg_1._x509) == 0:\n            arg_2 = _lib.ERR_peek_error()\n            arg_3 = _lib.ERR_GET_REASON(arg_2)\n            _openssl_assert(\n                arg_3 == _lib.X509_R_CERT_ALREADY_IN_HASH_TABLE\n            )\n            _lib.ERR_clear_error()", "path": "src/OpenSSL/crypto.py", "identifier": "X509Store.add_cert", "docstring": "Adds a trusted certificate to this store.\n\n        Adding a certificate with this method adds this certificate as a\n        *trusted* certificate.\n\n        :param X509 cert: The certificate to add to this store.\n\n        :raises TypeError: If the certificate is not an :class:`X509`.\n\n        :raises OpenSSL.crypto.Error: If OpenSSL was unhappy with your\n            certificate.\n\n        :return: ``None`` if the certificate was added successfully.", "docstring_tokens": ["Adds", "a", "trusted", "certificate", "to", "this", "store", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 257510}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L1690-L1728", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method used to select certain property methods as having a higher\n        priority than were set by default. If `forced` is true, then methods\n        which were not specified are excluded from consideration.", "language": "python", "parameters": "(self, user_methods, forced=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_0", ".", "user_methods", "=", "arg_1", "arg_0", ".", "forced", "=", "arg_2", "if", "set", "(", "arg_0", ".", "user_methods", ")", ".", "difference", "(", "arg_0", ".", "all_methods", ")", ":", "raise", "Exception", "(", "\"One of the given methods is not available for this chemical\"", ")", "if", "not", "arg_0", ".", "user_methods", "and", "arg_0", ".", "forced", ":", "raise", "Exception", "(", "'Only user specified methods are considered when forced is True, but no methods were provided'", ")", "arg_0", ".", "method", "=", "None", "arg_0", ".", "sorted_valid_methods", "=", "[", "]", "arg_0", ".", "T_cached", "=", "None"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        r'''Method used to select certain property methods as having a higher\n        priority than were set by default. If `forced` is true, then methods\n        which were not specified are excluded from consideration.\n\n        As a side effect, `method` is removed to ensure than the new methods\n        will be used in calculations afterwards.\n\n        An exception is raised if any of the methods specified aren't available\n        for the chemical. An exception is raised if no methods are provided.\n\n        Parameters\n        ----------\n        user_methods : str or list\n            Methods by name to be considered or prefered\n        forced : bool, optional\n            If True, only the user specified methods will ever be considered;\n            if False other methods will be considered if no user methods\n            suceed\n        '''\n        # Accept either a string or a list of methods, and whether\n        # or not to only consider the false methods\n        if isinstance(arg_1, str):\n            arg_1 = [arg_1]\n\n        # The user's order matters and is retained for use by select_valid_methods\n        arg_0.user_methods = arg_1\n        arg_0.forced = arg_2\n\n        # Validate that the user's specified methods are actual methods\n        if set(arg_0.user_methods).difference(arg_0.all_methods):\n            raise Exception(\"One of the given methods is not available for this chemical\")\n        if not arg_0.user_methods and arg_0.forced:\n            raise Exception('Only user specified methods are considered when forced is True, but no methods were provided')\n\n        # Remove previously selected methods\n        arg_0.method = None\n        arg_0.sorted_valid_methods = []\n        arg_0.T_cached = None", "path": "thermo/utils.py", "identifier": "TDependentProperty.set_user_methods", "docstring": "r'''Method used to select certain property methods as having a higher\n        priority than were set by default. If `forced` is true, then methods\n        which were not specified are excluded from consideration.\n\n        As a side effect, `method` is removed to ensure than the new methods\n        will be used in calculations afterwards.\n\n        An exception is raised if any of the methods specified aren't available\n        for the chemical. An exception is raised if no methods are provided.\n\n        Parameters\n        ----------\n        user_methods : str or list\n            Methods by name to be considered or prefered\n        forced : bool, optional\n            If True, only the user specified methods will ever be considered;\n            if False other methods will be considered if no user methods\n            suceed", "docstring_tokens": ["r", "Method", "used", "to", "select", "certain", "property", "methods", "as", "having", "a", "higher", "priority", "than", "were", "set", "by", "default", ".", "If", "forced", "is", "true", "then", "methods", "which", "were", "not", "specified", "are", "excluded", "from", "consideration", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 257511}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/slack.py#L344-L355", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch information about a channel.", "language": "python", "parameters": "(self, channel)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "RCHANNEL_INFO", "arg_3", "=", "{", "arg_0", ".", "PCHANNEL", ":", "arg_1", ",", "}", "arg_4", "=", "arg_0", ".", "_fetch", "(", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Fetch information about a channel.\"\"\"\n\n        arg_2 = arg_0.RCHANNEL_INFO\n\n        arg_3 = {\n            arg_0.PCHANNEL: arg_1,\n        }\n\n        arg_4 = arg_0._fetch(arg_2, arg_3)\n\n        return arg_4", "path": "perceval/backends/core/slack.py", "identifier": "SlackClient.channel_info", "docstring": "Fetch information about a channel.", "docstring_tokens": ["Fetch", "information", "about", "a", "channel", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257512}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/iana.py#L400-L445", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Return the referer for the given extension.", "language": "python", "parameters": "(self, extension)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "lookup", ".", "whois", "(", "PyFunceble", ".", "CONFIGURATION", "[", "\"iana_whois_server\"", "]", ",", "\"hello.%s\"", "%", "arg_1", ")", "if", "arg_2", "and", "\"refer\"", "in", "arg_2", ":", "arg_3", "=", "r\"(?s)refer\\:\\s+([a-zA-Z0-9._-]+)\\n\"", "arg_4", "=", "Regex", "(", "arg_2", ",", "arg_3", ",", "return_data", "=", "True", ",", "group", "=", "1", ")", ".", "match", "(", ")", "if", "arg_4", ":", "return", "arg_4", "if", "arg_1", "in", "arg_0", ".", "manual_server", ":", "return", "arg_0", ".", "manual_server", "[", "arg_1", "]", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return the referer for the given extension.\n\n        :param extension: A valid domain extension.\n        :type extension: str\n\n        :return: The whois server to use to get the WHOIS record.\n        :rtype: str\n        \"\"\"\n\n        # We get the a copy of the page.\n        arg_2 = arg_0.lookup.whois(\n            PyFunceble.CONFIGURATION[\"iana_whois_server\"], \"hello.%s\" % arg_1\n        )\n\n        if arg_2 and \"refer\" in arg_2:\n            # The record is not empty.\n\n            # We initiate a regex which will extract the referer.\n            arg_3 = r\"(?s)refer\\:\\s+([a-zA-Z0-9._-]+)\\n\"\n\n            # We try to extract the referer.\n            arg_4 = Regex(\n                arg_2, arg_3, return_data=True, group=1\n            ).match()\n\n            if arg_4:\n                # The referer was extracted successfully.\n\n                # We return the matched referer.\n                return arg_4\n\n        # * The referer was not extracted successfully.\n        # or\n        # * The iana record is empty.\n\n        if arg_1 in arg_0.manual_server:\n            # The extension is in the list of manual entries.\n\n            # We return the server which we set manually.\n            return arg_0.manual_server[arg_1]\n\n        # We return None because we weren't able to get the server to call for\n        # the given extension.\n        return None", "path": "PyFunceble/iana.py", "identifier": "IANA._referer", "docstring": "Return the referer for the given extension.\n\n        :param extension: A valid domain extension.\n        :type extension: str\n\n        :return: The whois server to use to get the WHOIS record.\n        :rtype: str", "docstring_tokens": ["Return", "the", "referer", "for", "the", "given", "extension", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 257513}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L553-L563", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Allow ! and !! in multi-line statements if multi_line_specials is on", "language": "python", "parameters": "(self, line_info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "continue_prompt", "and", "arg_0", ".", "prefilter_manager", ".", "multi_line_specials", ":", "if", "arg_1", ".", "esc", "==", "ESC_MAGIC", ":", "return", "arg_0", ".", "prefilter_manager", ".", "get_handler_by_name", "(", "'magic'", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"Allow ! and !! in multi-line statements if multi_line_specials is on\"\n        # Note that this one of the only places we Func the first character of\n        # ifun and *not* the pre_char.  Also note that the below test matches\n        # both ! and !!.\n        if arg_1.continue_prompt \\\n            and arg_0.prefilter_manager.multi_line_specials:\n                if arg_1.esc == ESC_MAGIC:\n                    return arg_0.prefilter_manager.get_handler_by_name('magic')\n        else:\n            return None", "path": "environment/lib/python2.7/site-packages/IPython/core/prefilter.py", "identifier": "MultiLineMagicChecker.check", "docstring": "Allow ! and !! in multi-line statements if multi_line_specials is on", "docstring_tokens": ["Allow", "!", "and", "!!", "in", "multi", "-", "line", "statements", "if", "multi_line_specials", "is", "on"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257514}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L445-L457", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Given two TM instances, see if any parameters are different.", "language": "python", "parameters": "(tp1, tp2)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "True", "for", "arg_3", "in", "[", "\"numberOfCols\"", ",", "\"cellsPerColumn\"", ",", "\"initialPerm\"", ",", "\"connectedPerm\"", ",", "\"minThreshold\"", ",", "\"newSynapseCount\"", ",", "\"permanenceInc\"", ",", "\"permanenceDec\"", ",", "\"permanenceMax\"", ",", "\"globalDecay\"", ",", "\"activationThreshold\"", ",", "\"doPooling\"", ",", "\"segUpdateValidDuration\"", ",", "\"burnIn\"", ",", "\"pamLength\"", ",", "\"maxAge\"", "]", ":", "if", "getattr", "(", "arg_0", ",", "arg_3", ")", "!=", "getattr", "(", "arg_1", ",", "arg_3", ")", ":", "print", "arg_3", ",", "\"is different\"", "print", "getattr", "(", "arg_0", ",", "arg_3", ")", ",", "\"vs\"", ",", "getattr", "(", "arg_1", ",", "arg_3", ")", "arg_2", "=", "False", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Given two TM instances, see if any parameters are different.\"\"\"\n  arg_2 = True\n  for arg_3 in [\"numberOfCols\", \"cellsPerColumn\", \"initialPerm\", \"connectedPerm\",\n                \"minThreshold\", \"newSynapseCount\", \"permanenceInc\", \"permanenceDec\",\n                \"permanenceMax\", \"globalDecay\", \"activationThreshold\",\n                \"doPooling\", \"segUpdateValidDuration\",\n                \"burnIn\", \"pamLength\", \"maxAge\"]:\n    if getattr(arg_0, arg_3) != getattr(arg_1,arg_3):\n      print arg_3,\"is different\"\n      print getattr(arg_0, arg_3), \"vs\", getattr(arg_1,arg_3)\n      arg_2 = False\n  return arg_2", "path": "src/nupic/algorithms/fdrutilities.py", "identifier": "sameTMParams", "docstring": "Given two TM instances, see if any parameters are different.", "docstring_tokens": ["Given", "two", "TM", "instances", "see", "if", "any", "parameters", "are", "different", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257515}
{"url": "https://github.com/lithammer/python-jump-consistent-hash/blob/62d3c7c1736971a779769cbbae87598b2f3992b9/jump/__init__.py#L19-L42", "sha": "62d3c7c1736971a779769cbbae87598b2f3992b9", "docstring_summary": "Generate a number in the range [0, num_buckets).", "language": "python", "parameters": "(key, num_buckets)", "return_statement": "return int(b)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "-", "1", ",", "0", "if", "arg_1", "<", "1", ":", "raise", "ValueError", "(", "'num_buckets must be a positive number'", ")", "while", "arg_3", "<", "arg_1", ":", "arg_2", "=", "int", "(", "arg_3", ")", "arg_0", "=", "(", "(", "arg_0", "*", "long", "(", "2862933555777941757", ")", ")", "+", "1", ")", "&", "0xffffffffffffffff", "arg_3", "=", "float", "(", "arg_2", "+", "1", ")", "*", "(", "float", "(", "1", "<<", "31", ")", "/", "float", "(", "(", "arg_0", ">>", "33", ")", "+", "1", ")", ")", "return", "int", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Generate a number in the range [0, num_buckets).\n\n    Args:\n        key (int): The key to hash.\n        num_buckets (int): Number of buckets to use.\n\n    Returns:\n        The bucket number `key` computes to.\n\n    Raises:\n        ValueError: If `num_buckets` is not a positive number.\n    \"\"\"\n    arg_2, arg_3 = -1, 0\n\n    if arg_1 < 1:\n        raise ValueError('num_buckets must be a positive number')\n\n    while arg_3 < arg_1:\n        arg_2 = int(arg_3)\n        arg_0 = ((arg_0 * long(2862933555777941757)) + 1) & 0xffffffffffffffff\n        arg_3 = float(arg_2 + 1) * (float(1 << 31) / float((arg_0 >> 33) + 1))\n\n    return int(arg_2)", "path": "jump/__init__.py", "identifier": "py_hash", "docstring": "Generate a number in the range [0, num_buckets).\n\n    Args:\n        key (int): The key to hash.\n        num_buckets (int): Number of buckets to use.\n\n    Returns:\n        The bucket number `key` computes to.\n\n    Raises:\n        ValueError: If `num_buckets` is not a positive number.", "docstring_tokens": ["Generate", "a", "number", "in", "the", "range", "[", "0", "num_buckets", ")", "."], "nwo": "lithammer/python-jump-consistent-hash", "score": 0.2809582191804827, "idx": 257516}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/api/common/experimental/pool.py#L26-L35", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get pool by a given name.", "language": "python", "parameters": "(name, session=None)", "return_statement": "return pool", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "(", "arg_0", "and", "arg_0", ".", "strip", "(", ")", ")", ":", "raise", "AirflowBadRequest", "(", "\"Pool name shouldn't be empty\"", ")", "arg_2", "=", "arg_1", ".", "query", "(", "Pool", ")", ".", "filter_by", "(", "arg_2", "=", "arg_0", ")", ".", "first", "(", ")", "if", "arg_2", "is", "None", ":", "raise", "PoolNotFound", "(", "\"Pool '%s' doesn't exist\"", "%", "arg_0", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Get pool by a given name.\"\"\"\n    if not (arg_0 and arg_0.strip()):\n        raise AirflowBadRequest(\"Pool name shouldn't be empty\")\n\n    arg_2 = arg_1.query(Pool).filter_by(arg_2=arg_0).first()\n    if arg_2 is None:\n        raise PoolNotFound(\"Pool '%s' doesn't exist\" % arg_0)\n\n    return arg_2", "path": "airflow/api/common/experimental/pool.py", "identifier": "get_pool", "docstring": "Get pool by a given name.", "docstring_tokens": ["Get", "pool", "by", "a", "given", "name", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257517}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L422-L425", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return line with the star import expanded.", "language": "python", "parameters": "(line, marked_star_import_undefined_name)", "return_statement": "return re.sub(r'\\*', ', '.join(undefined_name), line)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "sorted", "(", "set", "(", "arg_1", ")", ")", "return", "re", ".", "sub", "(", "r'\\*'", ",", "', '", ".", "join", "(", "arg_2", ")", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return line with the star import expanded.\"\"\"\n    arg_2 = sorted(set(arg_1))\n    return re.sub(r'\\*', ', '.join(arg_2), arg_0)", "path": "autoflake.py", "identifier": "filter_star_import", "docstring": "Return line with the star import expanded.", "docstring_tokens": ["Return", "line", "with", "the", "star", "import", "expanded", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 257518}
{"url": "https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/support.py#L376-L381", "sha": "532f561f32b91ea8debea0573c503dd20988bf40", "docstring_summary": "if set, get the value of resolution in milliseconds", "language": "python", "parameters": "(self)", "return_statement": "return int(float(val) * self._multipier(mult) * 1000)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "resolution", "is", "None", "or", "not", "isinstance", "(", "arg_0", ".", "resolution", ",", "basestring", ")", ":", "return", "arg_0", ".", "resolution", "arg_1", ",", "arg_2", "=", "arg_0", ".", "resolution", ".", "split", "(", "' '", ")", "return", "int", "(", "float", "(", "arg_1", ")", "*", "arg_0", ".", "_multipier", "(", "arg_2", ")", "*", "1000", ")"], "function": "def Func(arg_0):\n        '''if set, get the value of resolution in milliseconds'''\n        if arg_0.resolution is None or not isinstance(arg_0.resolution, basestring):\n                return arg_0.resolution\n        arg_1, arg_2 = arg_0.resolution.split(' ')\n        return int(float(arg_1) * arg_0._multipier(arg_2) * 1000)", "path": "src/geoserver/support.py", "identifier": "DimensionInfo.resolution_millis", "docstring": "if set, get the value of resolution in milliseconds", "docstring_tokens": ["if", "set", "get", "the", "value", "of", "resolution", "in", "milliseconds"], "nwo": "boundlessgeo/gsconfig", "score": 0.7627023200281134, "idx": 257519}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/obj.py#L110-L140", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Produce a Lisp representation of a sequential collection, bookended\n    with the start and end string supplied. The keyword arguments will be\n    passed along to lrepr for the sequence elements.", "language": "python", "parameters": "(\n    iterable: Iterable[Any], start: str, end: str, meta=None, **kwargs\n)", "return_statement": "return f\"{start}{seq_lrepr}{end}\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_4", ",", "arg_6", "=", "None", ",", "**", "arg_7", ")", "->", "arg_4", ":", "arg_8", "=", "arg_7", "[", "\"print_level\"", "]", "if", "isinstance", "(", "arg_8", ",", "int", ")", "and", "arg_8", "<", "1", ":", "return", "SURPASSED_PRINT_LEVEL", "arg_7", "=", "_process_kwargs", "(", "**", "arg_7", ")", "arg_9", "=", "[", "]", "arg_10", "=", "arg_7", "[", "\"print_dup\"", "]", "arg_11", "=", "arg_7", "[", "\"print_length\"", "]", "if", "not", "arg_10", "and", "isinstance", "(", "arg_11", ",", "int", ")", ":", "arg_12", "=", "seq", "(", "arg_0", ")", ".", "take", "(", "arg_11", "+", "1", ")", ".", "to_list", "(", ")", "if", "len", "(", "arg_12", ")", ">", "arg_11", ":", "arg_12", ".", "pop", "(", ")", "arg_9", ".", "append", "(", "SURPASSED_PRINT_LENGTH", ")", "else", ":", "arg_12", "=", "arg_0", "arg_12", "=", "list", "(", "map", "(", "lambda", "o", ":", "lrepr", "(", "o", ",", "**", "arg_7", ")", ",", "arg_12", ")", ")", "Func", "=", "PRINT_SEPARATOR", ".", "join", "(", "arg_12", "+", "arg_9", ")", "arg_14", "=", "arg_7", "[", "\"print_meta\"", "]", "if", "arg_14", "and", "arg_6", ":", "return", "f\"^{lrepr(meta, **kwargs)} {start}{seq_lrepr}{end}\"", "return", "f\"{start}{seq_lrepr}{end}\""], "function": "def Func(\n    arg_0: arg_1[arg_2], arg_3: arg_4, arg_5: arg_4, arg_6=None, **arg_7\n) -> arg_4:\n    \"\"\"Produce a Lisp representation of a sequential collection, bookended\n    with the start and end string supplied. The keyword arguments will be\n    passed along to lrepr for the sequence elements.\"\"\"\n    arg_8 = arg_7[\"print_level\"]\n    if isinstance(arg_8, int) and arg_8 < 1:\n        return SURPASSED_PRINT_LEVEL\n\n    arg_7 = _process_kwargs(**arg_7)\n\n    arg_9 = []\n    arg_10 = arg_7[\"print_dup\"]\n    arg_11 = arg_7[\"print_length\"]\n    if not arg_10 and isinstance(arg_11, int):\n        arg_12 = seq(arg_0).take(arg_11 + 1).to_list()\n        if len(arg_12) > arg_11:\n            arg_12.pop()\n            arg_9.append(SURPASSED_PRINT_LENGTH)\n    else:\n        arg_12 = arg_0\n\n    arg_12 = list(map(lambda o: lrepr(o, **arg_7), arg_12))\n    Func = PRINT_SEPARATOR.join(arg_12 + arg_9)\n\n    arg_14 = arg_7[\"print_meta\"]\n    if arg_14 and arg_6:\n        return f\"^{lrepr(meta, **kwargs)} {start}{seq_lrepr}{end}\"\n\n    return f\"{start}{seq_lrepr}{end}\"", "path": "src/basilisp/lang/obj.py", "identifier": "seq_lrepr", "docstring": "Produce a Lisp representation of a sequential collection, bookended\n    with the start and end string supplied. The keyword arguments will be\n    passed along to lrepr for the sequence elements.", "docstring_tokens": ["Produce", "a", "Lisp", "representation", "of", "a", "sequential", "collection", "bookended", "with", "the", "start", "and", "end", "string", "supplied", ".", "The", "keyword", "arguments", "will", "be", "passed", "along", "to", "lrepr", "for", "the", "sequence", "elements", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 257520}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/topology/topology_context_impl.py#L274-L287", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "invoke task hooks for every time bolt acks a tuple", "language": "python", "parameters": "(self, heron_tuple, process_latency_ns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_0", ".", "task_hooks", ")", ">", "0", ":", "arg_3", "=", "BoltAckInfo", "(", "arg_1", "=", "arg_1", ",", "acking_task_id", "=", "arg_0", ".", "get_task_id", "(", ")", ",", "process_latency_ms", "=", "arg_2", "*", "system_constants", ".", "NS_TO_MS", ")", "for", "arg_4", "in", "arg_0", ".", "task_hooks", ":", "arg_4", ".", "bolt_ack", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"invoke task hooks for every time bolt acks a tuple\n\n    :type heron_tuple: HeronTuple\n    :param heron_tuple: tuple that is acked\n    :type process_latency_ns: float\n    :param process_latency_ns: process latency in nano seconds\n    \"\"\"\n    if len(arg_0.task_hooks) > 0:\n      arg_3 = BoltAckInfo(arg_1=arg_1,\n                                  acking_task_id=arg_0.get_task_id(),\n                                  process_latency_ms=arg_2 * system_constants.NS_TO_MS)\n      for arg_4 in arg_0.task_hooks:\n        arg_4.bolt_ack(arg_3)", "path": "heron/instance/src/python/utils/topology/topology_context_impl.py", "identifier": "TopologyContextImpl.invoke_hook_bolt_ack", "docstring": "invoke task hooks for every time bolt acks a tuple\n\n    :type heron_tuple: HeronTuple\n    :param heron_tuple: tuple that is acked\n    :type process_latency_ns: float\n    :param process_latency_ns: process latency in nano seconds", "docstring_tokens": ["invoke", "task", "hooks", "for", "every", "time", "bolt", "acks", "a", "tuple"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257521}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/mlx.py#L201-L208", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Save filter script to an mlx file", "language": "python", "parameters": "(self, script_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "filters", ":", "print", "(", "'WARNING: no filters to save to file!'", ")", "arg_2", "=", "open", "(", "arg_1", ",", "'w'", ")", "arg_2", ".", "write", "(", "''", ".", "join", "(", "arg_0", ".", "opening", "+", "arg_0", ".", "filters", "+", "arg_0", ".", "closing", ")", ")", "arg_2", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Save filter script to an mlx file \"\"\"\n        # TODO: rasie exception here instead?\n        if not arg_0.filters:\n            print('WARNING: no filters to save to file!')\n        arg_2 = open(arg_1, 'w')\n        arg_2.write(''.join(arg_0.opening + arg_0.filters + arg_0.closing))\n        arg_2.close()", "path": "meshlabxml/mlx.py", "identifier": "FilterScript.save_to_file", "docstring": "Save filter script to an mlx file", "docstring_tokens": ["Save", "filter", "script", "to", "an", "mlx", "file"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 257522}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/base.py#L41-L91", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Load songs from local filepaths.", "language": "python", "parameters": "(\n\t\t\tfilepaths, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False,\n\t\t\texclude_patterns=None, max_depth=float('inf'))", "return_statement": "return matched_songs, filtered_songs, excluded_songs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "arg_7", "(", "'inf'", ")", ")", ":", "logger", ".", "info", "(", "\"Loading local songs...\"", ")", "arg_8", "=", "get_supported_filepaths", "(", "arg_0", ",", "SUPPORTED_SONG_FORMATS", ",", "arg_6", "=", "arg_6", ")", "arg_9", ",", "arg_10", "=", "exclude_filepaths", "(", "arg_8", ",", "arg_5", "=", "arg_5", ")", "arg_11", ",", "arg_12", "=", "filter_local_songs", "(", "arg_9", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "logger", ".", "info", "(", "\"Excluded {0} local songs\"", ".", "format", "(", "len", "(", "arg_10", ")", ")", ")", "logger", ".", "info", "(", "\"Filtered {0} local songs\"", ".", "format", "(", "len", "(", "arg_12", ")", ")", ")", "logger", ".", "info", "(", "\"Loaded {0} local songs\"", ".", "format", "(", "len", "(", "arg_11", ")", ")", ")", "return", "arg_11", ",", "arg_12", ",", "arg_10"], "function": "def Func(\n\t\t\targ_0, arg_1=None, arg_2=None, arg_3=False, arg_4=False,\n\t\t\targ_5=None, arg_6=arg_7('inf')):\n\t\t\"\"\"Load songs from local filepaths.\n\n\t\tParameters:\n\t\t\tfilepaths (list or str): Filepath(s) to search for music files.\n\n\t\t\tinclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values don't match any of the given patterns.\n\n\t\t\texclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values match any of the given patterns.\n\n\t\t\tall_includes (bool): If ``True``, all include_filters criteria must match to include a song.\n\n\t\t\tall_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.\n\n\t\t\texclude_patterns (list or str): Pattern(s) to exclude.\n\t\t\t\tPatterns are Python regex patterns.\n\t\t\t\tFilepaths are excluded if they match any of the exclude patterns.\n\n\t\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\t\tDefault: No limit.\n\n\t\tReturns:\n\t\t\tA list of local song filepaths matching criteria,\n\t\t\ta list of local song filepaths filtered out using filter criteria,\n\t\t\tand a list of local song filepaths excluded using exclusion criteria.\n\n\t\t\"\"\"\n\n\t\tlogger.info(\"Loading local songs...\")\n\n\t\targ_8 = get_supported_filepaths(arg_0, SUPPORTED_SONG_FORMATS, arg_6=arg_6)\n\n\t\targ_9, arg_10 = exclude_filepaths(arg_8, arg_5=arg_5)\n\n\t\targ_11, arg_12 = filter_local_songs(\n\t\t\targ_9, arg_1=arg_1, arg_2=arg_2,\n\t\t\targ_3=arg_3, arg_4=arg_4\n\t\t)\n\n\t\tlogger.info(\"Excluded {0} local songs\".format(len(arg_10)))\n\t\tlogger.info(\"Filtered {0} local songs\".format(len(arg_12)))\n\t\tlogger.info(\"Loaded {0} local songs\".format(len(arg_11)))\n\n\t\treturn arg_11, arg_12, arg_10", "path": "gmusicapi_wrapper/base.py", "identifier": "_BaseWrapper.get_local_songs", "docstring": "Load songs from local filepaths.\n\n\t\tParameters:\n\t\t\tfilepaths (list or str): Filepath(s) to search for music files.\n\n\t\t\tinclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values don't match any of the given patterns.\n\n\t\t\texclude_filters (list): A list of ``(field, pattern)`` tuples.\n\t\t\t\tFields are any valid mutagen metadata fields. Patterns are Python regex patterns.\n\t\t\t\tLocal songs are filtered out if the given metadata field values match any of the given patterns.\n\n\t\t\tall_includes (bool): If ``True``, all include_filters criteria must match to include a song.\n\n\t\t\tall_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.\n\n\t\t\texclude_patterns (list or str): Pattern(s) to exclude.\n\t\t\t\tPatterns are Python regex patterns.\n\t\t\t\tFilepaths are excluded if they match any of the exclude patterns.\n\n\t\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\t\tDefault: No limit.\n\n\t\tReturns:\n\t\t\tA list of local song filepaths matching criteria,\n\t\t\ta list of local song filepaths filtered out using filter criteria,\n\t\t\tand a list of local song filepaths excluded using exclusion criteria.", "docstring_tokens": ["Load", "songs", "from", "local", "filepaths", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 257523}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/migrations/0009_sapsuccessfactors_remove_enterprise_enrollment_page_waffle_flag.py#L7-L10", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Create and activate the SAP_USE_ENTERPRISE_ENROLLMENT_PAGE switch if it does not already exist.", "language": "python", "parameters": "(apps, schema_editor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_model", "(", "'waffle'", ",", "'Switch'", ")", "arg_2", ".", "objects", ".", "get_or_create", "(", "name", "=", "'SAP_USE_ENTERPRISE_ENROLLMENT_PAGE'", ",", "defaults", "=", "{", "'active'", ":", "False", "}", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Create and activate the SAP_USE_ENTERPRISE_ENROLLMENT_PAGE switch if it does not already exist.\"\"\"\n    arg_2 = arg_0.get_model('waffle', 'Switch')\n    arg_2.objects.get_or_create(name='SAP_USE_ENTERPRISE_ENROLLMENT_PAGE', defaults={'active': False})", "path": "integrated_channels/sap_success_factors/migrations/0009_sapsuccessfactors_remove_enterprise_enrollment_page_waffle_flag.py", "identifier": "create_switch", "docstring": "Create and activate the SAP_USE_ENTERPRISE_ENROLLMENT_PAGE switch if it does not already exist.", "docstring_tokens": ["Create", "and", "activate", "the", "SAP_USE_ENTERPRISE_ENROLLMENT_PAGE", "switch", "if", "it", "does", "not", "already", "exist", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257524}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/main.py#L306-L350", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Main entry point for `dddp` command.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ")", "arg_1", "=", "arg_0", ".", "add_argument_group", "(", "'Django Options'", ")", "arg_1", ".", "add_argument", "(", "'--verbosity'", ",", "'-v'", ",", "metavar", "=", "'VERBOSITY'", ",", "dest", "=", "'verbosity'", ",", "type", "=", "int", ",", "default", "=", "1", ",", ")", "arg_1", ".", "add_argument", "(", "'--debug-port'", ",", "metavar", "=", "'DEBUG_PORT'", ",", "dest", "=", "'debug_port'", ",", "type", "=", "int", ",", "default", "=", "0", ",", ")", "arg_1", ".", "add_argument", "(", "'--settings'", ",", "metavar", "=", "'SETTINGS'", ",", "dest", "=", "'settings'", ",", "help", "=", "\"The Python path to a settings module, e.g. \"", "\"\\\"myproject.settings.Func\\\". If this isn't provided, the \"", "\"DJANGO_SETTINGS_MODULE environment variable will be used.\"", ",", ")", "arg_2", "=", "arg_0", ".", "add_argument_group", "(", "'HTTP Options'", ")", "arg_2", ".", "add_argument", "(", "'listen'", ",", "metavar", "=", "'address[:port]'", ",", "nargs", "=", "'*'", ",", "type", "=", "addr", ",", "help", "=", "'Listening address for HTTP(s) server.'", ",", ")", "arg_3", "=", "arg_0", ".", "add_argument_group", "(", "'SSL Options'", ")", "arg_3", ".", "add_argument", "(", "'--ssl-version'", ",", "metavar", "=", "'SSL_VERSION'", ",", "dest", "=", "'ssl_version'", ",", "help", "=", "\"SSL version to use (see stdlib ssl module's) [3]\"", ",", "choices", "=", "[", "'1'", ",", "'2'", ",", "'3'", "]", ",", "default", "=", "'3'", ")", "arg_3", ".", "add_argument", "(", "'--certfile'", ",", "metavar", "=", "'FILE'", ",", "dest", "=", "'certfile'", ",", "help", "=", "\"SSL certificate file [None]\"", ")", "arg_3", ".", "add_argument", "(", "'--ciphers'", ",", "metavar", "=", "'CIPHERS'", ",", "dest", "=", "'ciphers'", ",", "help", "=", "\"Ciphers to use (see stdlib ssl module's) [TLSv1]\"", ")", "arg_3", ".", "add_argument", "(", "'--ca-certs'", ",", "metavar", "=", "'FILE'", ",", "dest", "=", "'ca_certs'", ",", "help", "=", "\"CA certificates file [None]\"", ")", "arg_3", ".", "add_argument", "(", "'--keyfile'", ",", "metavar", "=", "'FILE'", ",", "dest", "=", "'keyfile'", ",", "help", "=", "\"SSL key file [None]\"", ")", "arg_4", "=", "arg_0", ".", "parse_args", "(", ")", "if", "arg_4", ".", "settings", ":", "arg_5", ".", "environ", "[", "'DJANGO_SETTINGS_MODULE'", "]", "=", "arg_4", ".", "settings", "serve", "(", "arg_4", ".", "listen", "or", "[", "Addr", "(", "'localhost'", ",", "8000", ")", "]", ",", "debug_port", "=", "arg_4", ".", "debug_port", ",", "keyfile", "=", "arg_4", ".", "keyfile", ",", "certfile", "=", "arg_4", ".", "certfile", ",", "verbosity", "=", "arg_4", ".", "verbosity", ",", ")"], "function": "def Func():\n    \"\"\"Main entry point for `dddp` command.\"\"\"\n    arg_0 = argparse.ArgumentParser(description=__doc__)\n    arg_1 = arg_0.add_argument_group('Django Options')\n    arg_1.add_argument(\n        '--verbosity', '-v', metavar='VERBOSITY', dest='verbosity', type=int,\n        default=1,\n    )\n    arg_1.add_argument(\n        '--debug-port', metavar='DEBUG_PORT', dest='debug_port', type=int,\n        default=0,\n    )\n    arg_1.add_argument(\n        '--settings', metavar='SETTINGS', dest='settings',\n        help=\"The Python path to a settings module, e.g. \"\n        \"\\\"myproject.settings.Func\\\". If this isn't provided, the \"\n        \"DJANGO_SETTINGS_MODULE environment variable will be used.\",\n    )\n    arg_2 = arg_0.add_argument_group('HTTP Options')\n    arg_2.add_argument(\n        'listen', metavar='address[:port]', nargs='*', type=addr,\n        help='Listening address for HTTP(s) server.',\n    )\n    arg_3 = arg_0.add_argument_group('SSL Options')\n    arg_3.add_argument('--ssl-version', metavar='SSL_VERSION', dest='ssl_version',\n                     help=\"SSL version to use (see stdlib ssl module's) [3]\",\n                     choices=['1', '2', '3'], default='3')\n    arg_3.add_argument('--certfile', metavar='FILE', dest='certfile',\n                     help=\"SSL certificate file [None]\")\n    arg_3.add_argument('--ciphers', metavar='CIPHERS', dest='ciphers',\n                     help=\"Ciphers to use (see stdlib ssl module's) [TLSv1]\")\n    arg_3.add_argument('--ca-certs', metavar='FILE', dest='ca_certs',\n                     help=\"CA certificates file [None]\")\n    arg_3.add_argument('--keyfile', metavar='FILE', dest='keyfile',\n                     help=\"SSL key file [None]\")\n    arg_4 = arg_0.parse_args()\n    if arg_4.settings:\n        arg_5.environ['DJANGO_SETTINGS_MODULE'] = arg_4.settings\n    serve(\n        arg_4.listen or [Addr('localhost', 8000)],\n        debug_port=arg_4.debug_port,\n        keyfile=arg_4.keyfile,\n        certfile=arg_4.certfile,\n        verbosity=arg_4.verbosity,\n    )", "path": "dddp/main.py", "identifier": "main", "docstring": "Main entry point for `dddp` command.", "docstring_tokens": ["Main", "entry", "point", "for", "dddp", "command", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 257525}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/tokens.py#L488-L514", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Allow tokens to modify the world for the duration of a with-block.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_is_locked", ":", "yield", "else", ":", "try", ":", "arg_0", ".", "_is_locked", "=", "False", "yield", "finally", ":", "arg_0", ".", "_is_locked", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"\n        Allow tokens to modify the world for the duration of a with-block.\n\n        It's important that tokens only modify the world at appropriate times, \n        otherwise the changes they make may not be communicated across the \n        network to other clients.  To help catch and prevent these kinds of \n        errors, the game engine keeps the world locked most of the time and \n        only briefly unlocks it (using this method) when tokens are allowed to \n        make changes.  When the world is locked, token methods that aren't \n        marked as being read-only can't be called.  When the world is unlocked, \n        any token method can be called.  These checks can be disabled by \n        running python with optimization enabled.\n\n        You should never call this method manually from within your own game.  \n        This method is intended to be used by the game engine, which was \n        carefully designed to allow the world to be modified only when safe.  \n        Calling this method yourself disables an important safety check.\n        \"\"\"\n        if not arg_0._is_locked:\n            yield\n        else:\n            try:\n                arg_0._is_locked = False\n                yield\n            finally:\n                arg_0._is_locked = True", "path": "kxg/tokens.py", "identifier": "World._unlock_temporarily", "docstring": "Allow tokens to modify the world for the duration of a with-block.\n\n        It's important that tokens only modify the world at appropriate times, \n        otherwise the changes they make may not be communicated across the \n        network to other clients.  To help catch and prevent these kinds of \n        errors, the game engine keeps the world locked most of the time and \n        only briefly unlocks it (using this method) when tokens are allowed to \n        make changes.  When the world is locked, token methods that aren't \n        marked as being read-only can't be called.  When the world is unlocked, \n        any token method can be called.  These checks can be disabled by \n        running python with optimization enabled.\n\n        You should never call this method manually from within your own game.  \n        This method is intended to be used by the game engine, which was \n        carefully designed to allow the world to be modified only when safe.  \n        Calling this method yourself disables an important safety check.", "docstring_tokens": ["Allow", "tokens", "to", "modify", "the", "world", "for", "the", "duration", "of", "a", "with", "-", "block", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 257526}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/metadata.py#L362-L400", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Given a parameter with type information, convert and validate it.", "language": "python", "parameters": "(self, arg_name, arg_value)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_ensure_loaded", "(", ")", "arg_3", "=", "arg_0", ".", "param_type", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "return", "arg_2", "arg_4", "=", "typeinfo", ".", "type_system", ".", "convert_to_type", "(", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "annotated_params", "[", "arg_1", "]", ".", "validators", "if", "len", "(", "arg_5", ")", "==", "0", ":", "return", "arg_4", "arg_6", "=", "typeinfo", ".", "type_system", ".", "get_type", "(", "arg_3", ")", "try", ":", "for", "arg_7", ",", "arg_8", "in", "arg_5", ":", "if", "not", "hasattr", "(", "arg_6", ",", "arg_7", ")", ":", "raise", "ValidationError", "(", "\"Could not find validator specified for argument\"", ",", "argument", "=", "arg_1", ",", "arg_7", "=", "arg_7", ",", "type", "=", "str", "(", "arg_6", ")", ",", "method", "=", "dir", "(", "arg_6", ")", ")", "arg_9", "=", "getattr", "(", "arg_6", ",", "arg_7", ")", "arg_9", "(", "arg_4", ",", "*", "arg_8", ")", "except", "(", "ValueError", ",", "TypeError", ")", "as", "exc", ":", "raise", "ValidationError", "(", "exc", ".", "args", "[", "0", "]", ",", "argument", "=", "arg_1", ",", "arg_2", "=", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Given a parameter with type information, convert and validate it.\n\n        Args:\n            arg_name (str): The name of the argument to convert and validate\n            arg_value (object): The value to convert and validate\n\n        Returns:\n            object: The converted value.\n        \"\"\"\n\n        arg_0._ensure_loaded()\n\n        arg_3 = arg_0.param_type(arg_1)\n        if arg_3 is None:\n            return arg_2\n\n        arg_4 = typeinfo.type_system.convert_to_type(arg_2, arg_3)\n\n        arg_5 = arg_0.annotated_params[arg_1].validators\n        if len(arg_5) == 0:\n            return arg_4\n\n        arg_6 = typeinfo.type_system.get_type(arg_3)\n\n        # Run all of the validators that were defined for this argument.\n        # If the validation fails, they will raise an exception that we convert to\n        # an instance of ValidationError\n        try:\n            for arg_7, arg_8 in arg_5:\n                if not hasattr(arg_6, arg_7):\n                    raise ValidationError(\"Could not find validator specified for argument\", argument=arg_1, arg_7=arg_7, type=str(arg_6), method=dir(arg_6))\n\n                arg_9 = getattr(arg_6, arg_7)\n                arg_9(arg_4, *arg_8)\n        except (ValueError, TypeError) as exc:\n            raise ValidationError(exc.args[0], argument=arg_1, arg_2=arg_4)\n\n        return arg_4", "path": "typedargs/metadata.py", "identifier": "AnnotatedMetadata.convert_argument", "docstring": "Given a parameter with type information, convert and validate it.\n\n        Args:\n            arg_name (str): The name of the argument to convert and validate\n            arg_value (object): The value to convert and validate\n\n        Returns:\n            object: The converted value.", "docstring_tokens": ["Given", "a", "parameter", "with", "type", "information", "convert", "and", "validate", "it", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 257527}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/uxpath/functions.py#L302-L314", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Yields a sequence of a single value, the result of looking up a value from the tables provided in the context, or an empty sequence if lookup is unsuccessful", "language": "python", "parameters": "(ctx, tableid, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "next", "(", "string_arg", "(", "arg_0", ",", "arg_1", ")", ",", "''", ")", "arg_2", "=", "next", "(", "string_arg", "(", "arg_0", ",", "arg_2", ")", ",", "''", ")", "for", "arg_3", "in", "seq", ":", "arg_4", "=", "arg_0", ".", "copy", "(", "arg_3", "=", "arg_3", ")", "yield", "from", "pexpr", ".", "compute", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''\n    Yields a sequence of a single value, the result of looking up a value from the tables provided in the context, or an empty sequence if lookup is unsuccessful\n\n    * tableid: id of the lookup table to use\n    * expr: expression to be converted to string, then dynamically evaluated for each item on the sequence to produce the result\n    '''\n    arg_1 = next(string_arg(arg_0, arg_1), '')\n    arg_2 = next(string_arg(arg_0, arg_2), '')\n    #value = ctx.\n    for arg_3 in seq:\n        arg_4 = arg_0.copy(arg_3=arg_3)\n        yield from pexpr.compute(arg_4)", "path": "pylib/uxml/uxpath/functions.py", "identifier": "lookup_", "docstring": "Yields a sequence of a single value, the result of looking up a value from the tables provided in the context, or an empty sequence if lookup is unsuccessful\n\n    * tableid: id of the lookup table to use\n    * expr: expression to be converted to string, then dynamically evaluated for each item on the sequence to produce the result", "docstring_tokens": ["Yields", "a", "sequence", "of", "a", "single", "value", "the", "result", "of", "looking", "up", "a", "value", "from", "the", "tables", "provided", "in", "the", "context", "or", "an", "empty", "sequence", "if", "lookup", "is", "unsuccessful"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 257528}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/logs/parsers.py#L124-L144", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "Parses a single line from the log file and returns\n        a dictionary of it's contents.", "language": "python", "parameters": "(self, line)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "strip", "(", ")", "arg_2", "=", "arg_0", ".", "_regex", ".", "match", "(", "arg_1", ")", "if", "arg_2", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_2", ".", "groups", "(", ")", ")", ":", "if", "arg_5", "==", "\"-\"", ":", "arg_6", ",", "arg_7", "=", "arg_0", ".", "_names", "[", "arg_4", "]", ",", "None", "else", ":", "arg_6", ",", "arg_7", "=", "arg_0", ".", "_names", "[", "arg_4", "]", ",", "arg_0", ".", "_types", "[", "arg_4", "]", "(", "arg_5", ")", "arg_3", "[", "arg_6", "]", "=", "arg_7", "return", "arg_3", "raise", "ApacheLogParserError", "(", "\"Unable to Func: %s\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Parses a single line from the log file and returns\n        a dictionary of it's contents.\n\n        Raises and exception if it couldn't Func the line\n        \"\"\"\n        arg_1 = arg_1.strip()\n        arg_2 = arg_0._regex.match(arg_1)\n        \n        if arg_2:\n            arg_3 = {}\n            for arg_4, arg_5 in enumerate(arg_2.groups()):\n                if arg_5 == \"-\":\n                    arg_6, arg_7 = arg_0._names[arg_4], None\n                else:\n                    arg_6, arg_7 = arg_0._names[arg_4], arg_0._types[arg_4](arg_5)\n                arg_3[arg_6] = arg_7\n            return arg_3\n        \n        raise ApacheLogParserError(\"Unable to Func: %s\" % arg_1)", "path": "tensor/logs/parsers.py", "identifier": "ApacheLogParser.parse", "docstring": "Parses a single line from the log file and returns\n        a dictionary of it's contents.\n\n        Raises and exception if it couldn't parse the line", "docstring_tokens": ["Parses", "a", "single", "line", "from", "the", "log", "file", "and", "returns", "a", "dictionary", "of", "it", "s", "contents", "."], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 257529}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/auth/utils.py#L35-L45", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Given an X.509 certificate, extract and return the extendedKeyUsage\n    extension.", "language": "python", "parameters": "(certificate)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "arg_0", ".", "extensions", ".", "get_extension_for_oid", "(", "x509", ".", "oid", ".", "ExtensionOID", ".", "EXTENDED_KEY_USAGE", ")", ".", "value", "except", "x509", ".", "ExtensionNotFound", ":", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Given an X.509 certificate, extract and return the extendedKeyUsage\n    extension.\n    \"\"\"\n    try:\n        return arg_0.extensions.get_extension_for_oid(\n            x509.oid.ExtensionOID.EXTENDED_KEY_USAGE\n        ).value\n    except x509.ExtensionNotFound:\n        return None", "path": "kmip/services/server/auth/utils.py", "identifier": "get_extended_key_usage_from_certificate", "docstring": "Given an X.509 certificate, extract and return the extendedKeyUsage\n    extension.", "docstring_tokens": ["Given", "an", "X", ".", "509", "certificate", "extract", "and", "return", "the", "extendedKeyUsage", "extension", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 257530}
{"url": "https://github.com/memsql/memsql-python/blob/aac223a1b937d5b348b42af3c601a6c685ca633a/memsql/common/database.py#L95-L100", "sha": "aac223a1b937d5b348b42af3c601a6c685ca633a", "docstring_summary": "Closes the existing database connection and re-opens it.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_mysql", ".", "connect", "(", "**", "arg_0", ".", "_db_args", ")", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "close", "(", ")", "arg_0", ".", "_db", "=", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Closes the existing database connection and re-opens it.\"\"\"\n        arg_1 = _mysql.connect(**arg_0._db_args)\n        if arg_1 is not None:\n            arg_0.close()\n            arg_0._db = arg_1", "path": "memsql/common/database.py", "identifier": "Connection.reconnect", "docstring": "Closes the existing database connection and re-opens it.", "docstring_tokens": ["Closes", "the", "existing", "database", "connection", "and", "re", "-", "opens", "it", "."], "nwo": "memsql/memsql-python", "score": 0.6220444802454773, "idx": 257531}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L82-L96", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Should return the path to the database", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "conn", ".", "cursor", "(", ")", "arg_1", ".", "execute", "(", "\"PRAGMA database_list\"", ")", "arg_2", "=", "arg_1", ".", "fetchall", "(", ")", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "[", "1", "]", "==", "str", "(", "\"main\"", ")", ":", "return", "arg_3", "[", "2", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Should return the path to the database\n\n        Returns\n        -------\n        path : unicode\n            path to the database, empty string for in-memory databases\n        \"\"\"\n        arg_1 = arg_0.conn.cursor()\n        arg_1.execute(\"PRAGMA database_list\")\n        arg_2 = arg_1.fetchall()\n        for arg_3 in arg_2:\n            if arg_3[1] == str(\"main\"):\n                return arg_3[2]", "path": "gtfspy/gtfs.py", "identifier": "GTFS.get_main_database_path", "docstring": "Should return the path to the database\n\n        Returns\n        -------\n        path : unicode\n            path to the database, empty string for in-memory databases", "docstring_tokens": ["Should", "return", "the", "path", "to", "the", "database"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 257532}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/compiler.py#L497-L499", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Custom flattening method for the parse tree.", "language": "python", "parameters": "(child, parent)", "return_statement": "return parent.is_type(TokenType.expression) and child.node_type == parent.node_type", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_1", ".", "is_type", "(", "TokenType", ".", "expression", ")", "and", "arg_0", ".", "node_type", "==", "arg_1", ".", "node_type"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Custom flattening method for the parse tree.\"\"\"\n    return arg_1.is_type(TokenType.expression) and arg_0.node_type == arg_1.node_type", "path": "pyebnf/compiler.py", "identifier": "Compiler._flatten", "docstring": "Custom flattening method for the parse tree.", "docstring_tokens": ["Custom", "flattening", "method", "for", "the", "parse", "tree", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 257533}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/permutations_runner.py#L1054-L1074", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Saves the given _HyperSearchJob instance's jobID to file", "language": "python", "parameters": "(cls, permWorkDir, outputLabel, hyperSearchJob)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "getJobID", "(", ")", "arg_5", "=", "arg_0", ".", "__getHyperSearchJobIDFilePath", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "_backupFile", "(", "arg_5", ")", "arg_6", "=", "dict", "(", "hyperSearchJobID", "=", "arg_4", ")", "with", "open", "(", "arg_5", ",", "\"wb\"", ")", "as", "jobIdPickleFile", ":", "pickle", ".", "dump", "(", "arg_6", ",", "jobIdPickleFile", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Saves the given _HyperSearchJob instance's jobID to file\n\n    Parameters:\n    ----------------------------------------------------------------------\n    permWorkDir:   Directory path for saved jobID file\n    outputLabel:   Label string for incorporating into file name for saved jobID\n    hyperSearchJob: _HyperSearchJob instance\n    retval:        nothing\n    \"\"\"\n    arg_4 = arg_3.getJobID()\n    arg_5 = arg_0.__getHyperSearchJobIDFilePath(arg_1=arg_1,\n                                                 arg_2=arg_2)\n\n    if os.path.exists(arg_5):\n      _backupFile(arg_5)\n\n    arg_6 = dict(hyperSearchJobID = arg_4)\n\n    with open(arg_5, \"wb\") as jobIdPickleFile:\n      pickle.dump(arg_6, jobIdPickleFile)", "path": "src/nupic/swarming/permutations_runner.py", "identifier": "_HyperSearchRunner.__saveHyperSearchJobID", "docstring": "Saves the given _HyperSearchJob instance's jobID to file\n\n    Parameters:\n    ----------------------------------------------------------------------\n    permWorkDir:   Directory path for saved jobID file\n    outputLabel:   Label string for incorporating into file name for saved jobID\n    hyperSearchJob: _HyperSearchJob instance\n    retval:        nothing", "docstring_tokens": ["Saves", "the", "given", "_HyperSearchJob", "instance", "s", "jobID", "to", "file"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257534}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/hosts.py#L347-L394", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Pretty-prints a list of entries. If the window is wide enough to\n        support printing as a table, runs the `print_table.render_table`\n        function on the table. Otherwise, constructs a line-by-line\n        representation..", "language": "python", "parameters": "(cls, entries, additional_columns=None,\n                       only_show=None, numbers=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_2", "=", "arg_2", "or", "[", "]", "if", "arg_3", "is", "not", "None", ":", "arg_5", "=", "_uniquify", "(", "arg_3", ")", "else", ":", "arg_5", "=", "_uniquify", "(", "arg_0", ".", "DEFAULT_COLUMNS", "+", "arg_2", ")", "arg_6", "=", "[", "arg_0", ".", "prettyname", "(", "col", ")", "for", "col", "in", "arg_5", "]", "arg_7", "=", "[", "arg_6", "]", "if", "arg_4", "is", "False", "else", "[", "[", "''", "]", "+", "arg_6", "]", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_1", ")", ":", "arg_10", "=", "[", "arg_9", ".", "_get_attrib", "(", "c", ",", "convert_to_str", "=", "True", ")", "for", "c", "in", "arg_5", "]", "arg_7", ".", "append", "(", "arg_10", "if", "arg_4", "is", "False", "else", "[", "arg_8", "]", "+", "arg_10", ")", "arg_11", "=", "get_current_terminal_width", "(", ")", "arg_12", "=", "[", "get_color_hash", "(", "c", ",", "MIN_COLOR_BRIGHT", ",", "MAX_COLOR_BRIGHT", ")", "for", "c", "in", "arg_5", "]", "if", "arg_11", ">=", "get_table_width", "(", "arg_7", ")", ":", "return", "render_table", "(", "arg_7", ",", "column_colors", "=", "arg_12", "if", "arg_4", "is", "False", "else", "[", "green", "]", "+", "arg_12", ")", "else", ":", "arg_13", "=", "[", "]", "arg_14", "=", "1", "if", "arg_4", "is", "True", "else", "0", "for", "arg_10", "in", "arg_7", "[", "1", ":", "]", ":", "arg_15", "=", "[", "green", "(", "'%s:'", "%", "arg_10", "[", "0", "]", "if", "arg_4", "is", "True", "else", "'-----'", ")", "]", "for", "arg_8", ",", "arg_16", "in", "enumerate", "(", "arg_10", "[", "arg_14", ":", "]", ")", ":", "arg_17", "=", "arg_12", "[", "arg_8", "-", "1", "if", "arg_4", "is", "True", "else", "arg_8", "]", "arg_18", "=", "arg_5", "[", "arg_8", "]", "arg_15", ".", "append", "(", "'  %s: %s'", "%", "(", "arg_18", ",", "arg_17", "(", "arg_16", ")", ")", ")", "arg_13", ".", "append", "(", "'\\n'", ".", "join", "(", "arg_15", ")", ")", "return", "'\\n'", ".", "join", "(", "arg_13", ")"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                       arg_3=None, arg_4=False):\n        \"\"\"\n        Pretty-prints a list of entries. If the window is wide enough to\n        support printing as a table, runs the `print_table.render_table`\n        function on the table. Otherwise, constructs a line-by-line\n        representation..\n\n        :param entries: A list of entries.\n        :type entries: [:py:class:`HostEntry`]\n        :param additional_columns: Columns to show in addition to defaults.\n        :type additional_columns: ``list`` of ``str``\n        :param only_show: A specific list of columns to show.\n        :type only_show: ``NoneType`` or ``list`` of ``str``\n        :param numbers: Whether to include a number column.\n        :type numbers: ``bool``\n\n        :return: A pretty-printed string.\n        :rtype: ``str``\n        \"\"\"\n        arg_2 = arg_2 or []\n        if arg_3 is not None:\n            arg_5 = _uniquify(arg_3)\n        else:\n            arg_5 = _uniquify(arg_0.DEFAULT_COLUMNS + arg_2)\n        arg_6 = [arg_0.prettyname(col) for col in arg_5]\n        arg_7 = [arg_6] if arg_4 is False else [[''] + arg_6]\n        for arg_8, arg_9 in enumerate(arg_1):\n            arg_10 = [arg_9._get_attrib(c, convert_to_str=True) for c in arg_5]\n            arg_7.append(arg_10 if arg_4 is False else [arg_8] + arg_10)\n        arg_11 = get_current_terminal_width()\n        arg_12 = [get_color_hash(c, MIN_COLOR_BRIGHT, MAX_COLOR_BRIGHT)\n                  for c in arg_5]\n        if arg_11 >= get_table_width(arg_7):\n            return render_table(arg_7,\n                                column_colors=arg_12 if arg_4 is False\n                                              else [green] + arg_12)\n        else:\n            arg_13 = []\n            arg_14 = 1 if arg_4 is True else 0\n            for arg_10 in arg_7[1:]:\n                arg_15 = [green('%s:' % arg_10[0] if arg_4 is True else '-----')]\n                for arg_8, arg_16 in enumerate(arg_10[arg_14:]):\n                    arg_17 = arg_12[arg_8-1 if arg_4 is True else arg_8]\n                    arg_18 = arg_5[arg_8]\n                    arg_15.append('  %s: %s' % (arg_18, arg_17(arg_16)))\n                arg_13.append('\\n'.join(arg_15))\n            return '\\n'.join(arg_13)", "path": "src/lsi/utils/hosts.py", "identifier": "HostEntry.render_entries", "docstring": "Pretty-prints a list of entries. If the window is wide enough to\n        support printing as a table, runs the `print_table.render_table`\n        function on the table. Otherwise, constructs a line-by-line\n        representation..\n\n        :param entries: A list of entries.\n        :type entries: [:py:class:`HostEntry`]\n        :param additional_columns: Columns to show in addition to defaults.\n        :type additional_columns: ``list`` of ``str``\n        :param only_show: A specific list of columns to show.\n        :type only_show: ``NoneType`` or ``list`` of ``str``\n        :param numbers: Whether to include a number column.\n        :type numbers: ``bool``\n\n        :return: A pretty-printed string.\n        :rtype: ``str``", "docstring_tokens": ["Pretty", "-", "prints", "a", "list", "of", "entries", ".", "If", "the", "window", "is", "wide", "enough", "to", "support", "printing", "as", "a", "table", "runs", "the", "print_table", ".", "render_table", "function", "on", "the", "table", ".", "Otherwise", "constructs", "a", "line", "-", "by", "-", "line", "representation", ".."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 257535}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/date.py#L4-L17", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Check if a string is a valid date", "language": "python", "parameters": "(date)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "compile", "(", "\"^(19|20)\\d\\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])\"", ")", "if", "re", ".", "match", "(", "arg_1", ",", "arg_0", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"Check if a string is a valid date\n\n        Args:\n            date(str)\n\n        Returns:\n            bool\n    \"\"\"\n    arg_1 = re.compile(\"^(19|20)\\d\\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])\")\n    if re.match(arg_1, arg_0):\n        return True\n\n    return False", "path": "scout/utils/date.py", "identifier": "match_date", "docstring": "Check if a string is a valid date\n\n        Args:\n            date(str)\n\n        Returns:\n            bool", "docstring_tokens": ["Check", "if", "a", "string", "is", "a", "valid", "date"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257536}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/galaxy/util/galaxy_util.py#L78-L104", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Compute the deflections of a list of galaxies from an input grid, by summing the individual deflections \\\n    of each galaxy's mass profile.", "language": "python", "parameters": "(grid, galaxies)", "return_statement": "return deflections", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", ">", "0", ":", "arg_2", "=", "sum", "(", "map", "(", "lambda", "galaxy", ":", "galaxy", ".", "deflections_from_grid", "(", "arg_0", ")", ",", "arg_1", ")", ")", "else", ":", "arg_2", "=", "np", ".", "full", "(", "(", "arg_0", ".", "shape", "[", "0", "]", ",", "2", ")", ",", "0.0", ")", "if", "isinstance", "(", "arg_0", ",", "grids", ".", "SubGrid", ")", ":", "return", "np", ".", "asarray", "(", "[", "arg_0", ".", "regular_data_1d_from_sub_data_1d", "(", "arg_2", "[", ":", ",", "0", "]", ")", ",", "arg_0", ".", "regular_data_1d_from_sub_data_1d", "(", "arg_2", "[", ":", ",", "1", "]", ")", "]", ")", ".", "T", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Compute the deflections of a list of galaxies from an input grid, by summing the individual deflections \\\n    of each galaxy's mass profile.\n\n    If the input grid is a *grids.SubGrid*, the potential is calculated on the sub-grid and binned-up to the \\\n    original regular grid by taking the mean value of every set of sub-pixels.\n\n    If no galaxies are entered into the function, an array of all zeros is returned.\n\n    Parameters\n    -----------\n    grid : RegularGrid\n        The grid (regular or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the \\\n        deflections is calculated on.\n    galaxies : [galaxy.Galaxy]\n        The galaxies whose mass profiles are used to compute the surface densities.\n    \"\"\"\n    if len(arg_1) > 0:\n        arg_2 = sum(map(lambda galaxy: galaxy.deflections_from_grid(arg_0), arg_1))\n    else:\n        arg_2 = np.full((arg_0.shape[0], 2), 0.0)\n\n    if isinstance(arg_0, grids.SubGrid):\n        return np.asarray([arg_0.regular_data_1d_from_sub_data_1d(arg_2[:, 0]),\n                           arg_0.regular_data_1d_from_sub_data_1d(arg_2[:, 1])]).T\n\n    return arg_2", "path": "autolens/model/galaxy/util/galaxy_util.py", "identifier": "deflections_of_galaxies_from_grid", "docstring": "Compute the deflections of a list of galaxies from an input grid, by summing the individual deflections \\\n    of each galaxy's mass profile.\n\n    If the input grid is a *grids.SubGrid*, the potential is calculated on the sub-grid and binned-up to the \\\n    original regular grid by taking the mean value of every set of sub-pixels.\n\n    If no galaxies are entered into the function, an array of all zeros is returned.\n\n    Parameters\n    -----------\n    grid : RegularGrid\n        The grid (regular or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the \\\n        deflections is calculated on.\n    galaxies : [galaxy.Galaxy]\n        The galaxies whose mass profiles are used to compute the surface densities.", "docstring_tokens": ["Compute", "the", "deflections", "of", "a", "list", "of", "galaxies", "from", "an", "input", "grid", "by", "summing", "the", "individual", "deflections", "\\", "of", "each", "galaxy", "s", "mass", "profile", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 257537}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/has_funcs.py#L420-L456", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Test the student code.", "language": "python", "parameters": "(state, text, pattern=True, not_typed_msg=None)", "return_statement": "return state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ")", ":", "if", "not", "arg_3", ":", "if", "arg_2", ":", "arg_3", "=", "\"Could not find the correct pattern in your code.\"", "else", ":", "arg_3", "=", "\"Could not find the following text in your code: %r\"", "%", "arg_1", "arg_4", "=", "arg_0", ".", "student_code", "arg_5", "=", "arg_0", ".", "build_message", "(", "arg_3", ")", "arg_0", ".", "do_test", "(", "StringContainsTest", "(", "arg_4", ",", "arg_1", ",", "arg_2", ",", "Feedback", "(", "arg_5", ",", "arg_0", ")", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None):\n    \"\"\"Test the student code.\n\n    Tests if the student typed a (pattern of) text. It is advised to use ``has_equal_ast()`` instead of ``Func()``,\n    as it is more robust to small syntactical differences that don't change the code's behavior.\n\n    Args:\n        text (str): the text that is searched for\n        pattern (bool): if True (the default), the text is treated as a pattern. If False, it is treated as plain text.\n        not_typed_msg (str): feedback message to be displayed if the student did not type the text.\n\n    :Example:\n\n        Student code and solution code::\n\n            y = 1 + 2 + 3\n\n        SCT::\n\n            # Verify that student code contains pattern (not robust!!):\n            Ex().Func(r\"1\\\\s*\\\\+2\\\\s*\\\\+3\")\n\n    \"\"\"\n    if not arg_3:\n        if arg_2:\n            arg_3 = \"Could not find the correct pattern in your code.\"\n        else:\n            arg_3 = \"Could not find the following text in your code: %r\" % arg_1\n\n    arg_4 = arg_0.student_code\n\n    arg_5 = arg_0.build_message(arg_3)\n    arg_0.do_test(\n        StringContainsTest(arg_4, arg_1, arg_2, Feedback(arg_5, arg_0))\n    )\n\n    return arg_0", "path": "pythonwhat/checks/has_funcs.py", "identifier": "has_code", "docstring": "Test the student code.\n\n    Tests if the student typed a (pattern of) text. It is advised to use ``has_equal_ast()`` instead of ``has_code()``,\n    as it is more robust to small syntactical differences that don't change the code's behavior.\n\n    Args:\n        text (str): the text that is searched for\n        pattern (bool): if True (the default), the text is treated as a pattern. If False, it is treated as plain text.\n        not_typed_msg (str): feedback message to be displayed if the student did not type the text.\n\n    :Example:\n\n        Student code and solution code::\n\n            y = 1 + 2 + 3\n\n        SCT::\n\n            # Verify that student code contains pattern (not robust!!):\n            Ex().has_code(r\"1\\\\s*\\\\+2\\\\s*\\\\+3\")", "docstring_tokens": ["Test", "the", "student", "code", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 257538}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/commands/train.py#L69-L142", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Make training and evaluation of the model described in corresponding configuration file.", "language": "python", "parameters": "(config: Union[str, Path, dict],\n                                     iterator: Union[DataLearningIterator, DataFittingIterator] = None, *,\n                                     to_train: bool = True,\n                                     evaluation_targets: Optional[Iterable[str]] = None,\n                                     to_validate: Optional[bool] = None,\n                                     download: bool = False,\n                                     start_epoch_num: Optional[int] = None,\n                                     recursive: bool = False)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", ",", "arg_4", "]", ",", "arg_5", ":", "arg_1", "[", "arg_6", ",", "arg_7", "]", "=", "None", ",", "*", ",", "arg_8", ":", "arg_9", "=", "True", ",", "arg_10", ":", "arg_11", "[", "arg_12", "[", "arg_2", "]", "]", "=", "None", ",", "arg_13", ":", "arg_11", "[", "arg_9", "]", "=", "None", ",", "arg_14", ":", "arg_9", "=", "False", ",", "arg_15", ":", "arg_11", "[", "arg_16", "]", "=", "None", ",", "arg_17", ":", "arg_9", "=", "False", ")", "->", "Dict", "[", "arg_2", ",", "Dict", "[", "arg_2", ",", "float", "]", "]", ":", "arg_0", "=", "parse_config", "(", "arg_0", ")", "if", "arg_14", ":", "deep_download", "(", "arg_0", ")", "if", "arg_8", "and", "arg_17", ":", "for", "arg_18", "in", "get_all_elems_from_json", "(", "arg_0", "[", "'chainer'", "]", ",", "'config_path'", ")", ":", "log", ".", "info", "(", "f'Training \"{subconfig}\"'", ")", "Func", "(", "arg_18", ",", "arg_14", "=", "False", ",", "arg_17", "=", "True", ")", "import_packages", "(", "arg_0", ".", "get", "(", "'metadata'", ",", "{", "}", ")", ".", "get", "(", "'imports'", ",", "[", "]", ")", ")", "if", "arg_5", "is", "None", ":", "try", ":", "arg_19", "=", "read_data_by_config", "(", "arg_0", ")", "except", "ConfigError", "as", "e", ":", "arg_8", "=", "False", "log", ".", "warning", "(", "f'Skipping training. {e.message}'", ")", "else", ":", "arg_5", "=", "get_iterator_from_config", "(", "arg_0", ",", "arg_19", ")", "if", "'train'", "not", "in", "arg_0", ":", "log", ".", "warning", "(", "'Train config is missing. Populating with default values'", ")", "arg_20", "=", "arg_0", ".", "get", "(", "'train'", ")", "if", "arg_15", "is", "not", "None", ":", "arg_20", "[", "'start_epoch_num'", "]", "=", "arg_15", "if", "'evaluation_targets'", "not", "in", "arg_20", "and", "(", "'validate_best'", "in", "arg_20", "or", "'test_best'", "in", "arg_20", ")", ":", "log", ".", "warning", "(", "'\"validate_best\" and \"test_best\" parameters are deprecated.'", "' Please, use \"evaluation_targets\" list instead'", ")", "arg_20", "[", "'evaluation_targets'", "]", "=", "[", "]", "if", "arg_20", ".", "pop", "(", "'validate_best'", ",", "True", ")", ":", "arg_20", "[", "'evaluation_targets'", "]", ".", "append", "(", "'valid'", ")", "if", "arg_20", ".", "pop", "(", "'test_best'", ",", "True", ")", ":", "arg_20", "[", "'evaluation_targets'", "]", ".", "append", "(", "'test'", ")", "arg_21", "=", "get_model", "(", "arg_20", ".", "pop", "(", "'class_name'", ",", "'nn_trainer'", ")", ")", "arg_22", "=", "arg_21", "(", "arg_0", "[", "'chainer'", "]", ",", "**", "arg_20", ")", "if", "arg_8", ":", "arg_22", ".", "train", "(", "arg_5", ")", "arg_23", "=", "{", "}", "if", "arg_5", "is", "not", "None", ":", "if", "arg_13", "is", "not", "None", ":", "if", "arg_10", "is", "None", ":", "log", ".", "warning", "(", "'\"to_validate\" parameter is deprecated and will be removed in future versions.'", "' Please, use \"evaluation_targets\" list instead'", ")", "arg_10", "=", "[", "'test'", "]", "if", "arg_13", ":", "arg_10", ".", "append", "(", "'valid'", ")", "else", ":", "log", ".", "warn", "(", "'Both \"evaluation_targets\" and \"to_validate\" parameters are specified.'", "' \"to_validate\" is deprecated and will be ignored'", ")", "arg_23", "=", "arg_22", ".", "evaluate", "(", "arg_5", ",", "arg_10", ",", "print_reports", "=", "True", ")", "arg_22", ".", "get_chainer", "(", ")", ".", "destroy", "(", ")", "arg_23", "=", "{", "k", ":", "v", "[", "'metrics'", "]", "for", "k", ",", "v", "in", "arg_23", ".", "items", "(", ")", "}", "return", "arg_23"], "function": "def Func(arg_0: arg_1[arg_2, arg_3, arg_4],\n                                     arg_5: arg_1[arg_6, arg_7] = None, *,\n                                     arg_8: arg_9 = True,\n                                     arg_10: arg_11[arg_12[arg_2]] = None,\n                                     arg_13: arg_11[arg_9] = None,\n                                     arg_14: arg_9 = False,\n                                     arg_15: arg_11[arg_16] = None,\n                                     arg_17: arg_9 = False) -> Dict[arg_2, Dict[arg_2, float]]:\n    \"\"\"Make training and evaluation of the model described in corresponding configuration file.\"\"\"\n    arg_0 = parse_config(arg_0)\n\n    if arg_14:\n        deep_download(arg_0)\n\n    if arg_8 and arg_17:\n        for arg_18 in get_all_elems_from_json(arg_0['chainer'], 'config_path'):\n            log.info(f'Training \"{subconfig}\"')\n            Func(arg_18, arg_14=False, arg_17=True)\n\n    import_packages(arg_0.get('metadata', {}).get('imports', []))\n\n    if arg_5 is None:\n        try:\n            arg_19 = read_data_by_config(arg_0)\n        except ConfigError as e:\n            arg_8 = False\n            log.warning(f'Skipping training. {e.message}')\n        else:\n            arg_5 = get_iterator_from_config(arg_0, arg_19)\n\n    if 'train' not in arg_0:\n        log.warning('Train config is missing. Populating with default values')\n    arg_20 = arg_0.get('train')\n\n    if arg_15 is not None:\n        arg_20['start_epoch_num'] = arg_15\n\n    if 'evaluation_targets' not in arg_20 and ('validate_best' in arg_20\n                                                     or 'test_best' in arg_20):\n        log.warning('\"validate_best\" and \"test_best\" parameters are deprecated.'\n                    ' Please, use \"evaluation_targets\" list instead')\n\n        arg_20['evaluation_targets'] = []\n        if arg_20.pop('validate_best', True):\n            arg_20['evaluation_targets'].append('valid')\n        if arg_20.pop('test_best', True):\n            arg_20['evaluation_targets'].append('test')\n\n    arg_21 = get_model(arg_20.pop('class_name', 'nn_trainer'))\n    arg_22 = arg_21(arg_0['chainer'], **arg_20)\n\n    if arg_8:\n        arg_22.train(arg_5)\n\n    arg_23 = {}\n\n    if arg_5 is not None:\n        if arg_13 is not None:\n            if arg_10 is None:\n                log.warning('\"to_validate\" parameter is deprecated and will be removed in future versions.'\n                            ' Please, use \"evaluation_targets\" list instead')\n                arg_10 = ['test']\n                if arg_13:\n                    arg_10.append('valid')\n            else:\n                log.warn('Both \"evaluation_targets\" and \"to_validate\" parameters are specified.'\n                         ' \"to_validate\" is deprecated and will be ignored')\n\n        arg_23 = arg_22.evaluate(arg_5, arg_10, print_reports=True)\n        arg_22.get_chainer().destroy()\n\n    arg_23 = {k: v['metrics'] for k, v in arg_23.items()}\n\n    return arg_23", "path": "deeppavlov/core/commands/train.py", "identifier": "train_evaluate_model_from_config", "docstring": "Make training and evaluation of the model described in corresponding configuration file.", "docstring_tokens": ["Make", "training", "and", "evaluation", "of", "the", "model", "described", "in", "corresponding", "configuration", "file", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 257539}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/ndingest.py#L220-L236", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Generate the dataset dictionary", "language": "python", "parameters": "(\n        self, dataset_name, imagesize, voxelres,\n            offset, timerange, scalinglevels, scaling)", "return_statement": "return dataset_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "Func", "=", "{", "}", "Func", "[", "'dataset_name'", "]", "=", "arg_1", "Func", "[", "'imagesize'", "]", "=", "arg_2", "Func", "[", "'voxelres'", "]", "=", "arg_3", "if", "arg_4", "is", "not", "None", ":", "Func", "[", "'offset'", "]", "=", "arg_4", "if", "arg_5", "is", "not", "None", ":", "Func", "[", "'timerange'", "]", "=", "arg_5", "if", "arg_6", "is", "not", "None", ":", "Func", "[", "'scalinglevels'", "]", "=", "arg_6", "if", "arg_7", "is", "not", "None", ":", "Func", "[", "'scaling'", "]", "=", "arg_7", "return", "Func"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3,\n            arg_4, arg_5, arg_6, arg_7):\n        \"\"\"Generate the dataset dictionary\"\"\"\n        Func = {}\n        Func['dataset_name'] = arg_1\n        Func['imagesize'] = arg_2\n        Func['voxelres'] = arg_3\n        if arg_4 is not None:\n            Func['offset'] = arg_4\n        if arg_5 is not None:\n            Func['timerange'] = arg_5\n        if arg_6 is not None:\n            Func['scalinglevels'] = arg_6\n        if arg_7 is not None:\n            Func['scaling'] = arg_7\n        return Func", "path": "ndio/remote/ndingest.py", "identifier": "NDIngest.dataset_dict", "docstring": "Generate the dataset dictionary", "docstring_tokens": ["Generate", "the", "dataset", "dictionary"], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 257540}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/vi/csiszar_divergence.py#L427-L459", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "The Triangular Csiszar-function in log-space.", "language": "python", "parameters": "(logu, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_1", ",", "\"Func\"", ",", "[", "arg_0", "]", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_1", "=", "\"logu\"", ")", "return", "pearson", "(", "arg_0", ")", "/", "(", "1.", "+", "tf", ".", "exp", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"The Triangular Csiszar-function in log-space.\n\n  A Csiszar-function is a member of,\n\n  ```none\n  F = { f:R_+ to R : f convex }.\n  ```\n\n  The Triangular Csiszar-function is:\n\n  ```none\n  f(u) = (u - 1)**2 / (1 + u)\n  ```\n\n  This Csiszar-function induces a symmetric f-Divergence, i.e.,\n  `D_f[p, q] = D_f[q, p]`.\n\n  Warning: this function makes non-log-space calculations and may therefore be\n  numerically unstable for `|logu| >> 0`.\n\n  Args:\n    logu: `float`-like `Tensor` representing `log(u)` from above.\n    name: Python `str` name prefixed to Ops created by this function.\n\n  Returns:\n    Func_of_u: `float`-like `Tensor` of the Csiszar-function evaluated\n      at `u = exp(logu)`.\n  \"\"\"\n\n  with tf.compat.v1.name_scope(arg_1, \"Func\", [arg_0]):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_1=\"logu\")\n    return pearson(arg_0) / (1. + tf.exp(arg_0))", "path": "tensorflow_probability/python/vi/csiszar_divergence.py", "identifier": "triangular", "docstring": "The Triangular Csiszar-function in log-space.\n\n  A Csiszar-function is a member of,\n\n  ```none\n  F = { f:R_+ to R : f convex }.\n  ```\n\n  The Triangular Csiszar-function is:\n\n  ```none\n  f(u) = (u - 1)**2 / (1 + u)\n  ```\n\n  This Csiszar-function induces a symmetric f-Divergence, i.e.,\n  `D_f[p, q] = D_f[q, p]`.\n\n  Warning: this function makes non-log-space calculations and may therefore be\n  numerically unstable for `|logu| >> 0`.\n\n  Args:\n    logu: `float`-like `Tensor` representing `log(u)` from above.\n    name: Python `str` name prefixed to Ops created by this function.\n\n  Returns:\n    triangular_of_u: `float`-like `Tensor` of the Csiszar-function evaluated\n      at `u = exp(logu)`.", "docstring_tokens": ["The", "Triangular", "Csiszar", "-", "function", "in", "log", "-", "space", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257541}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1073-L1110", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Set a new name for a column.", "language": "python", "parameters": "(self, col=None, name=None)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "assert_is_type", "(", "arg_1", ",", "None", ",", "int", ",", "str", ")", "assert_is_type", "(", "arg_2", ",", "str", ")", "arg_3", "=", "arg_0", ".", "ncols", "arg_4", "=", "None", "if", "is_type", "(", "arg_1", ",", "int", ")", ":", "if", "not", "(", "-", "arg_3", "<=", "arg_1", "<", "arg_3", ")", ":", "raise", "H2OValueError", "(", "\"Index %d is out of bounds for a frame with %d columns\"", "%", "(", "arg_1", ",", "arg_3", ")", ")", "arg_4", "=", "(", "arg_1", "+", "arg_3", ")", "%", "arg_3", "elif", "is_type", "(", "arg_1", ",", "str", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "names", ":", "raise", "H2OValueError", "(", "\"Column %s doesn't exist in the frame.\"", "%", "arg_1", ")", "arg_4", "=", "arg_0", ".", "names", ".", "index", "(", "arg_1", ")", "else", ":", "assert", "arg_1", "is", "None", "if", "arg_3", "!=", "1", ":", "raise", "H2OValueError", "(", "\"The frame has %d columns; please specify which one to rename\"", "%", "arg_3", ")", "arg_4", "=", "0", "if", "arg_2", "!=", "arg_0", ".", "names", "[", "arg_4", "]", "and", "arg_2", "in", "arg_0", ".", "types", ":", "raise", "H2OValueError", "(", "\"Column '%s' already exists in the frame\"", "%", "arg_2", ")", "arg_5", "=", "arg_0", ".", "names", "[", "arg_4", "]", "arg_6", "=", "arg_0", ".", "_ex", ".", "_cache", "arg_0", ".", "_ex", "=", "ExprNode", "(", "\"colnames=\"", ",", "arg_0", ",", "arg_4", ",", "arg_2", ")", "arg_0", ".", "_ex", ".", "_cache", ".", "fill_from", "(", "arg_6", ")", "if", "arg_0", ".", "names", "is", "None", ":", "arg_0", ".", "_frame", "(", ")", ".", "_ex", ".", "_cache", ".", "fill", "(", ")", "else", ":", "arg_0", ".", "_ex", ".", "_cache", ".", "_names", "=", "arg_0", ".", "names", "[", ":", "arg_4", "]", "+", "[", "arg_2", "]", "+", "arg_0", ".", "names", "[", "arg_4", "+", "1", ":", "]", "arg_0", ".", "_ex", ".", "_cache", ".", "_types", "[", "arg_2", "]", "=", "arg_0", ".", "_ex", ".", "_cache", ".", "_types", ".", "pop", "(", "arg_5", ")", "return"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Set a new name for a column.\n\n        :param col: index or name of the column whose name is to be set; may be skipped for 1-column frames\n        :param name: the new name of the column\n        \"\"\"\n        assert_is_type(arg_1, None, int, str)\n        assert_is_type(arg_2, str)\n        arg_3 = arg_0.ncols\n\n        arg_4 = None\n        if is_type(arg_1, int):\n            if not(-arg_3 <= arg_1 < arg_3):\n                raise H2OValueError(\"Index %d is out of bounds for a frame with %d columns\" % (arg_1, arg_3))\n            arg_4 = (arg_1 + arg_3) % arg_3  # handle negative indices\n        elif is_type(arg_1, str):\n            if arg_1 not in arg_0.names:\n                raise H2OValueError(\"Column %s doesn't exist in the frame.\" % arg_1)\n            arg_4 = arg_0.names.index(arg_1)  # lookup the name\n        else:\n            assert arg_1 is None\n            if arg_3 != 1:\n                raise H2OValueError(\"The frame has %d columns; please specify which one to rename\" % arg_3)\n            arg_4 = 0\n        if arg_2 != arg_0.names[arg_4] and arg_2 in arg_0.types:\n            raise H2OValueError(\"Column '%s' already exists in the frame\" % arg_2)\n\n        arg_5 = arg_0.names[arg_4]\n        arg_6 = arg_0._ex._cache\n        arg_0._ex = ExprNode(\"colnames=\", arg_0, arg_4, arg_2)  # Update-in-place, but still lazy\n        arg_0._ex._cache.fill_from(arg_6)\n        if arg_0.names is None:\n            arg_0._frame()._ex._cache.fill()\n        else:\n            arg_0._ex._cache._names = arg_0.names[:arg_4] + [arg_2] + arg_0.names[arg_4 + 1:]\n            arg_0._ex._cache._types[arg_2] = arg_0._ex._cache._types.pop(arg_5)\n        return", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.set_name", "docstring": "Set a new name for a column.\n\n        :param col: index or name of the column whose name is to be set; may be skipped for 1-column frames\n        :param name: the new name of the column", "docstring_tokens": ["Set", "a", "new", "name", "for", "a", "column", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257542}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/galaxy/galaxy.py#L259-L279", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Compute the total angular mass of the galaxy's mass profiles within an ellipse of specified major_axis.", "language": "python", "parameters": "(self, major_axis, unit_mass='angular', kpc_per_arcsec=None, critical_surface_density=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'angular'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_0", ".", "has_mass_profile", ":", "return", "sum", "(", "map", "(", "lambda", "p", ":", "p", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", ",", "arg_0", ".", "mass_profiles", ")", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2='angular', arg_3=None, arg_4=None):\n        \"\"\"Compute the total angular mass of the galaxy's mass profiles within an ellipse of specified major_axis.\n\n        See *profiles.mass_profiles.angualr_mass_within_ellipse* for details of how this is performed.\n\n        Parameters\n        ----------\n        major_axis : float\n            The major-axis radius of the ellipse.\n        units_luminosity : str\n            The units the luminosity is returned in (eps | counts).\n        exposure_time : float\n            The exposure time of the observation, which converts luminosity from electrons per second units to counts.\n        \"\"\"\n        if arg_0.has_mass_profile:\n            return sum(map(lambda p: p.Func(arg_1=arg_1, arg_2=arg_2,\n                                                                    arg_3=arg_3,\n                                                                    arg_4=arg_4),\n                           arg_0.mass_profiles))\n        else:\n            return None", "path": "autolens/model/galaxy/galaxy.py", "identifier": "Galaxy.mass_within_ellipse_in_units", "docstring": "Compute the total angular mass of the galaxy's mass profiles within an ellipse of specified major_axis.\n\n        See *profiles.mass_profiles.angualr_mass_within_ellipse* for details of how this is performed.\n\n        Parameters\n        ----------\n        major_axis : float\n            The major-axis radius of the ellipse.\n        units_luminosity : str\n            The units the luminosity is returned in (eps | counts).\n        exposure_time : float\n            The exposure time of the observation, which converts luminosity from electrons per second units to counts.", "docstring_tokens": ["Compute", "the", "total", "angular", "mass", "of", "the", "galaxy", "s", "mass", "profiles", "within", "an", "ellipse", "of", "specified", "major_axis", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 257543}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L281-L298", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Parses the trace file header and retrieves the positions of each\n        column key.", "language": "python", "parameters": "(header)", "return_statement": "return dict(\n            (x.strip(), pos) for pos, x in enumerate(header.split(\"\\t\"))\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "dict", "(", "(", "arg_2", ".", "strip", "(", ")", ",", "arg_1", ")", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "arg_0", ".", "split", "(", "\"\\t\"", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Parses the trace file header and retrieves the positions of each\n        column key.\n\n        Parameters\n        ----------\n        header : str\n            The header line of nextflow's trace file\n\n        Returns\n        -------\n        dict\n            Mapping the column ID to its position (e.g.: {\"tag\":2})\n        \"\"\"\n\n        return dict(\n            (arg_2.strip(), arg_1) for arg_1, arg_2 in enumerate(arg_0.split(\"\\t\"))\n        )", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector._header_mapping", "docstring": "Parses the trace file header and retrieves the positions of each\n        column key.\n\n        Parameters\n        ----------\n        header : str\n            The header line of nextflow's trace file\n\n        Returns\n        -------\n        dict\n            Mapping the column ID to its position (e.g.: {\"tag\":2})", "docstring_tokens": ["Parses", "the", "trace", "file", "header", "and", "retrieves", "the", "positions", "of", "each", "column", "key", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257544}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/restsession.py#L174-L177", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Enable or disable automatic rate-limit handling.", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check_type", "(", "arg_1", ",", "bool", ",", "may_be_none", "=", "False", ")", "arg_0", ".", "_Func", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Enable or disable automatic rate-limit handling.\"\"\"\n        check_type(arg_1, bool, may_be_none=False)\n        arg_0._Func = arg_1", "path": "webexteamssdk/restsession.py", "identifier": "RestSession.wait_on_rate_limit", "docstring": "Enable or disable automatic rate-limit handling.", "docstring_tokens": ["Enable", "or", "disable", "automatic", "rate", "-", "limit", "handling", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 257545}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L359-L390", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Process user inputs and subit logbook entry when user clicks Submit button", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "selectedLogs", "(", ")", "arg_3", "=", "True", "if", "arg_1", "!=", "[", "]", ":", "if", "not", "arg_0", ".", "acceptedUser", "(", "\"MCC\"", ")", ":", "QMessageBox", "(", ")", ".", "warning", "(", "arg_0", ",", "\"Invalid User\"", ",", "\"Please enter a valid user name!\"", ")", "return", "arg_4", "=", "arg_0", ".", "xmlSetup", "(", "\"MCC\"", ",", "arg_1", ")", "if", "arg_4", "is", "None", ":", "return", "if", "not", "arg_0", ".", "imagePixmap", ".", "isNull", "(", ")", ":", "arg_0", ".", "prepareImages", "(", "arg_4", ",", "\"MCC\"", ")", "arg_3", "=", "arg_0", ".", "sendToLogbook", "(", "arg_4", ",", "\"MCC\"", ")", "if", "arg_2", "!=", "[", "]", ":", "for", "arg_5", "in", "range", "(", "len", "(", "arg_2", ")", ")", ":", "arg_4", "=", "arg_0", ".", "xmlSetup", "(", "\"Physics\"", ",", "arg_2", "[", "arg_5", "]", ")", "if", "arg_4", "is", "None", ":", "return", "if", "not", "arg_0", ".", "imagePixmap", ".", "isNull", "(", ")", ":", "arg_0", ".", "prepareImages", "(", "arg_4", ",", "\"Physics\"", ")", "arg_6", "=", "arg_0", ".", "sendToLogbook", "(", "arg_4", ",", "\"Physics\"", ",", "arg_2", "[", "arg_5", "]", ")", "arg_3", "=", "arg_3", "and", "arg_6", "arg_0", ".", "done", "(", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"Process user inputs and subit logbook entry when user clicks Submit button\"\"\"\n        \n        # logType = self.logui.logType.currentText()\n        arg_1, arg_2 = arg_0.selectedLogs()\n        arg_3 = True\n        \n        if arg_1 != []:\n            if not arg_0.acceptedUser(\"MCC\"):\n                QMessageBox().warning(arg_0, \"Invalid User\", \"Please enter a valid user name!\")\n                return\n            \n            arg_4 = arg_0.xmlSetup(\"MCC\", arg_1)\n            if arg_4 is None:\n                return\n            \n            if not arg_0.imagePixmap.isNull():\n                arg_0.prepareImages(arg_4, \"MCC\")\n            arg_3 = arg_0.sendToLogbook(arg_4, \"MCC\")\n        \n        if arg_2 != []:\n            for arg_5 in range(len(arg_2)):\n                arg_4 = arg_0.xmlSetup(\"Physics\", arg_2[arg_5])\n                if arg_4 is None:\n                    return\n            \n                if not arg_0.imagePixmap.isNull():\n                    arg_0.prepareImages(arg_4, \"Physics\")\n                arg_6 = arg_0.sendToLogbook(arg_4, \"Physics\", arg_2[arg_5])\n                arg_3 = arg_3 and arg_6\n            \n        arg_0.done(arg_3)", "path": "scisalt/facettools/logbookForm.py", "identifier": "logbookForm.submitEntry", "docstring": "Process user inputs and subit logbook entry when user clicks Submit button", "docstring_tokens": ["Process", "user", "inputs", "and", "subit", "logbook", "entry", "when", "user", "clicks", "Submit", "button"], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 257546}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/twitter.py#L274-L315", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch tweets for a given query between since_id and max_id.", "language": "python", "parameters": "(self, query, since_id=None, max_id=None, geocode=None, lang=None,\n               include_entities=True, result_type=TWEET_TYPE_MIXED)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ",", "arg_7", "=", "arg_8", ")", ":", "arg_9", "=", "arg_0", ".", "base_url", "arg_10", "=", "{", "'q'", ":", "arg_1", ",", "'count'", ":", "arg_0", ".", "max_items", "}", "if", "arg_2", ":", "arg_10", "[", "'since_id'", "]", "=", "arg_2", "if", "arg_3", ":", "arg_10", "[", "'max_id'", "]", "=", "arg_3", "if", "arg_4", ":", "arg_10", "[", "'geocode'", "]", "=", "arg_4", "if", "arg_5", ":", "arg_10", "[", "'lang'", "]", "=", "arg_5", "arg_10", "[", "'include_entities'", "]", "=", "arg_6", "arg_10", "[", "'result_type'", "]", "=", "arg_7", "while", "True", ":", "arg_11", "=", "arg_0", ".", "_fetch", "(", "arg_9", ",", "arg_10", "=", "arg_10", ")", "Func", "=", "json", ".", "loads", "(", "arg_11", ")", "if", "not", "Func", "[", "'statuses'", "]", ":", "break", "arg_10", "[", "'max_id'", "]", "=", "Func", "[", "'statuses'", "]", "[", "-", "1", "]", "[", "'id'", "]", "-", "1", "yield", "Func", "[", "'statuses'", "]"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None,\n               arg_6=True, arg_7=arg_8):\n        \"\"\"Fetch tweets for a given query between since_id and max_id.\n\n        :param query: query to fetch tweets\n        :param since_id: if not null, it returns results with an ID greater than the specified ID\n        :param max_id: if not null, it returns results with an ID less than the specified ID\n        :param geocode: if enabled, returns tweets by users located at latitude,longitude,\"mi\"|\"km\"\n        :param lang: if enabled, restricts tweets to the given language, given by an ISO 639-1 code\n        :param include_entities: if disabled, it excludes entities node\n        :param result_type: type of tweets returned. Default is \u201cmixed\u201d, others are \"recent\" and \"popular\"\n\n        :returns: a generator of tweets\n        \"\"\"\n        arg_9 = arg_0.base_url\n        arg_10 = {'q': arg_1,\n                  'count': arg_0.max_items}\n\n        if arg_2:\n            arg_10['since_id'] = arg_2\n\n        if arg_3:\n            arg_10['max_id'] = arg_3\n\n        if arg_4:\n            arg_10['geocode'] = arg_4\n\n        if arg_5:\n            arg_10['lang'] = arg_5\n\n        arg_10['include_entities'] = arg_6\n        arg_10['result_type'] = arg_7\n\n        while True:\n            arg_11 = arg_0._fetch(arg_9, arg_10=arg_10)\n            Func = json.loads(arg_11)\n\n            if not Func['statuses']:\n                break\n\n            arg_10['max_id'] = Func['statuses'][-1]['id'] - 1\n            yield Func['statuses']", "path": "perceval/backends/core/twitter.py", "identifier": "TwitterClient.tweets", "docstring": "Fetch tweets for a given query between since_id and max_id.\n\n        :param query: query to fetch tweets\n        :param since_id: if not null, it returns results with an ID greater than the specified ID\n        :param max_id: if not null, it returns results with an ID less than the specified ID\n        :param geocode: if enabled, returns tweets by users located at latitude,longitude,\"mi\"|\"km\"\n        :param lang: if enabled, restricts tweets to the given language, given by an ISO 639-1 code\n        :param include_entities: if disabled, it excludes entities node\n        :param result_type: type of tweets returned. Default is \u201cmixed\u201d, others are \"recent\" and \"popular\"\n\n        :returns: a generator of tweets", "docstring_tokens": ["Fetch", "tweets", "for", "a", "given", "query", "between", "since_id", "and", "max_id", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257547}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/tables.py#L48-L55", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Return true if this string or integer tuple appears in tables", "language": "python", "parameters": "(x)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "canonical_name", "(", "arg_0", ")", "return", "arg_0", "in", "_TO_COLOR_USER", "or", "arg_0", "in", "_TO_COLOR", "else", ":", "arg_0", "=", "tuple", "(", "arg_0", ")", "return", "arg_0", "in", "_TO_NAME_USER", "or", "arg_0", "in", "_TO_NAME"], "function": "def Func(arg_0):\n    \"\"\"Return true if this string or integer tuple appears in tables\"\"\"\n    if isinstance(arg_0, str):\n        arg_0 = canonical_name(arg_0)\n        return arg_0 in _TO_COLOR_USER or arg_0 in _TO_COLOR\n    else:\n        arg_0 = tuple(arg_0)\n        return arg_0 in _TO_NAME_USER or arg_0 in _TO_NAME", "path": "bibliopixel/colors/tables.py", "identifier": "contains", "docstring": "Return true if this string or integer tuple appears in tables", "docstring_tokens": ["Return", "true", "if", "this", "string", "or", "integer", "tuple", "appears", "in", "tables"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 257548}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/sites.py#L6-L14", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Returns site data.", "language": "python", "parameters": "(self, site_id)", "return_statement": "return self.site_from_json(self._get_resource(url)[\"site\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"/2/sites/%s\"", "%", "arg_1", "return", "arg_0", ".", "site_from_json", "(", "arg_0", ".", "_get_resource", "(", "arg_2", ")", "[", "\"site\"", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns site data.\n\n        http://dev.wheniwork.com/#get-existing-site\n        \"\"\"\n        arg_2 = \"/2/sites/%s\" % arg_1\n\n        return arg_0.site_from_json(arg_0._get_resource(arg_2)[\"site\"])", "path": "uw_wheniwork/sites.py", "identifier": "Sites.get_site", "docstring": "Returns site data.\n\n        http://dev.wheniwork.com/#get-existing-site", "docstring_tokens": ["Returns", "site", "data", "."], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 257549}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L371-L385", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "set the length of the uncompressed sequence. its inverse 'one_mutation'\n        is frequently used as a general length scale. This can't be changed once\n        it is set.", "language": "python", "parameters": "(self,L)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "not", "hasattr", "(", "arg_0", ",", "'_Func'", ")", ")", "or", "arg_0", ".", "_Func", "is", "None", ":", "if", "arg_1", ":", "arg_0", ".", "_Func", "=", "int", "(", "arg_1", ")", "else", ":", "arg_0", ".", "logger", "(", "\"TreeAnc: one_mutation and sequence length can't be reset\"", ",", "1", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"set the length of the uncompressed sequence. its inverse 'one_mutation'\n        is frequently used as a general length scale. This can't be changed once\n        it is set.\n\n        Parameters\n        ----------\n        L : int\n            length of the sequence alignment\n        \"\"\"\n        if (not hasattr(arg_0, '_Func')) or arg_0._Func is None:\n            if arg_1:\n                arg_0._Func = int(arg_1)\n        else:\n            arg_0.logger(\"TreeAnc: one_mutation and sequence length can't be reset\",1)", "path": "treetime/treeanc.py", "identifier": "TreeAnc.seq_len", "docstring": "set the length of the uncompressed sequence. its inverse 'one_mutation'\n        is frequently used as a general length scale. This can't be changed once\n        it is set.\n\n        Parameters\n        ----------\n        L : int\n            length of the sequence alignment", "docstring_tokens": ["set", "the", "length", "of", "the", "uncompressed", "sequence", ".", "its", "inverse", "one_mutation", "is", "frequently", "used", "as", "a", "general", "length", "scale", ".", "This", "can", "t", "be", "changed", "once", "it", "is", "set", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 257550}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L1429-L1459", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds a new run to the `_run_information` dict.", "language": "python", "parameters": "(self, idx, name='', timestamp=42.0, finish_timestamp=1.337,\n                      runtime='forever and ever', time='>>Maybe time`s gone on strike',\n                      completed=0, parameter_summary='Not yet my friend!',\n                      short_environment_hexsha='N/A')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ",", "arg_3", "=", "42.0", ",", "arg_4", "=", "1.337", ",", "arg_5", "=", "'forever and ever'", ",", "arg_6", "=", "'>>Maybe time`s gone on strike'", ",", "arg_7", "=", "0", ",", "arg_8", "=", "'Not yet my friend!'", ",", "arg_9", "=", "'N/A'", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_single_run_ids", ":", "arg_10", "=", "arg_0", ".", "_single_run_ids", "[", "arg_1", "]", "del", "arg_0", ".", "_single_run_ids", "[", "arg_10", "]", "del", "arg_0", ".", "_single_run_ids", "[", "arg_1", "]", "del", "arg_0", ".", "_run_information", "[", "arg_10", "]", "if", "arg_2", "==", "''", ":", "arg_2", "=", "arg_0", ".", "f_wildcard", "(", "'$'", ",", "arg_1", ")", "arg_0", ".", "_single_run_ids", "[", "arg_2", "]", "=", "arg_1", "arg_0", ".", "_single_run_ids", "[", "arg_1", "]", "=", "arg_2", "arg_12", "=", "{", "'idx'", ":", "arg_1", ",", "'timestamp'", ":", "arg_3", ",", "'finish_timestamp'", ":", "arg_4", ",", "'runtime'", ":", "arg_5", ",", "'time'", ":", "arg_6", ",", "'completed'", ":", "arg_7", ",", "'name'", ":", "arg_2", ",", "'parameter_summary'", ":", "arg_8", ",", "'short_environment_hexsha'", ":", "arg_9", "}", "arg_0", ".", "_run_information", "[", "arg_2", "]", "=", "arg_12", "arg_0", ".", "_length", "=", "len", "(", "arg_0", ".", "_run_information", ")"], "function": "def Func(arg_0, arg_1, arg_2='', arg_3=42.0, arg_4=1.337,\n                      arg_5='forever and ever', arg_6='>>Maybe time`s gone on strike',\n                      arg_7=0, arg_8='Not yet my friend!',\n                      arg_9='N/A'):\n        \"\"\"Adds a new run to the `_run_information` dict.\"\"\"\n\n        if arg_1 in arg_0._single_run_ids:\n            # Delete old entries, they might be replaced by a new name\n            arg_10 = arg_0._single_run_ids[arg_1]\n            del arg_0._single_run_ids[arg_10]\n            del arg_0._single_run_ids[arg_1]\n            del arg_0._run_information[arg_10]\n\n        if arg_2 == '':\n            arg_2 = arg_0.f_wildcard('$', arg_1)\n        # The `_single_run_ids` dict is bidirectional and maps indices to run names and vice versa\n        arg_0._single_run_ids[arg_2] = arg_1\n        arg_0._single_run_ids[arg_1] = arg_2\n\n        arg_12 = {'idx': arg_1,\n                     'timestamp': arg_3,\n                     'finish_timestamp': arg_4,\n                     'runtime': arg_5,\n                     'time': arg_6,\n                     'completed': arg_7,\n                     'name': arg_2,\n                     'parameter_summary': arg_8,\n                     'short_environment_hexsha': arg_9}\n\n        arg_0._run_information[arg_2] = arg_12\n        arg_0._length = len(arg_0._run_information)", "path": "pypet/trajectory.py", "identifier": "Trajectory._add_run_info", "docstring": "Adds a new run to the `_run_information` dict.", "docstring_tokens": ["Adds", "a", "new", "run", "to", "the", "_run_information", "dict", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257551}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/utils.py#L250-L263", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Retrieve a validated and prepped Rendition Key Set from\n    settings.VERSATILEIMAGEFIELD_RENDITION_KEY_SETS", "language": "python", "parameters": "(key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "IMAGE_SETS", "[", "arg_0", "]", "except", "KeyError", ":", "raise", "ImproperlyConfigured", "(", "\"No Rendition Key Set exists at \"", "\"settings.VERSATILEIMAGEFIELD_RENDITION_KEY_SETS['{}']\"", ".", "format", "(", "arg_0", ")", ")", "else", ":", "return", "validate_versatileimagefield_sizekey_list", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Retrieve a validated and prepped Rendition Key Set from\n    settings.VERSATILEIMAGEFIELD_RENDITION_KEY_SETS\n    \"\"\"\n    try:\n        arg_1 = IMAGE_SETS[arg_0]\n    except KeyError:\n        raise ImproperlyConfigured(\n            \"No Rendition Key Set exists at \"\n            \"settings.VERSATILEIMAGEFIELD_RENDITION_KEY_SETS['{}']\".format(arg_0)\n        )\n    else:\n        return validate_versatileimagefield_sizekey_list(arg_1)", "path": "versatileimagefield/utils.py", "identifier": "get_rendition_key_set", "docstring": "Retrieve a validated and prepped Rendition Key Set from\n    settings.VERSATILEIMAGEFIELD_RENDITION_KEY_SETS", "docstring_tokens": ["Retrieve", "a", "validated", "and", "prepped", "Rendition", "Key", "Set", "from", "settings", ".", "VERSATILEIMAGEFIELD_RENDITION_KEY_SETS"], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 257552}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Snapshot.py#L19-L25", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Class method that will return a Snapshot object by ID.", "language": "python", "parameters": "(cls, api_token, snapshot_id)", "return_statement": "return snapshot", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "token", "=", "arg_1", ",", "id", "=", "arg_2", ")", "arg_3", ".", "load", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n            Class method that will return a Snapshot object by ID.\n        \"\"\"\n        arg_3 = arg_0(token=arg_1, id=arg_2)\n        arg_3.load()\n        return arg_3", "path": "digitalocean/Snapshot.py", "identifier": "Snapshot.get_object", "docstring": "Class method that will return a Snapshot object by ID.", "docstring_tokens": ["Class", "method", "that", "will", "return", "a", "Snapshot", "object", "by", "ID", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 257553}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botframework-connector/azure_bdist_wheel.py#L153-L156", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Return distribution full name with - replaced with _", "language": "python", "parameters": "(self)", "return_statement": "return '-'.join((safer_name(self.distribution.get_name()),\n                         safer_version(self.distribution.get_version())))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "'-'", ".", "join", "(", "(", "safer_name", "(", "arg_0", ".", "distribution", ".", "get_name", "(", ")", ")", ",", "safer_version", "(", "arg_0", ".", "distribution", ".", "get_version", "(", ")", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return distribution full name with - replaced with _\"\"\"\n        return '-'.join((safer_name(arg_0.distribution.get_name()),\n                         safer_version(arg_0.distribution.get_version())))", "path": "libraries/botframework-connector/azure_bdist_wheel.py", "identifier": "bdist_wheel.wheel_dist_name", "docstring": "Return distribution full name with - replaced with _", "docstring_tokens": ["Return", "distribution", "full", "name", "with", "-", "replaced", "with", "_"], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 257554}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/Supplement/comparison_tools/stats.py#L146-L225", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Compute summary statistics for paired x, y data.", "language": "python", "parameters": "(x, y, nm=None)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_2", "=", "[", "arg_2", "]", "arg_3", "=", "pd", ".", "MultiIndex", ".", "from_tuples", "(", "[", "(", "'Residual Summary'", ",", "'N'", ")", ",", "(", "'Residual Summary'", ",", "'Median'", ")", ",", "(", "'Residual Summary'", ",", "'LQ'", ")", ",", "(", "'Residual Summary'", ",", "'IQR'", ")", ",", "(", "'Residual Summary'", ",", "'UQ'", ")", ",", "(", "'Residual Regression'", ",", "'Slope'", ")", ",", "(", "'Residual Regression'", ",", "'Slope t'", ")", ",", "(", "'Residual Regression'", ",", "'Slope p'", ")", ",", "(", "'Residual Regression'", ",", "'Intercept'", ")", ",", "(", "'Residual Regression'", ",", "'Intercept t'", ")", ",", "(", "'Residual Regression'", ",", "'Intercept p'", ")", ",", "(", "'Residual Regression'", ",", "'R2'", ")", ",", "(", "'Kolmogorov-Smirnov'", ",", "'KS'", ")", ",", "(", "'Kolmogorov-Smirnov'", ",", "'p'", ")", "]", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "index", "=", "arg_2", ",", "columns", "=", "arg_3", ")", "arg_5", "=", "~", "(", "np", ".", "isnan", "(", "arg_0", ")", "|", "np", ".", "isnan", "(", "arg_1", ")", ")", "arg_0", "=", "arg_0", "[", "arg_5", "]", "arg_1", "=", "arg_1", "[", "arg_5", "]", "arg_6", "=", "arg_1", "-", "arg_0", "arg_7", "=", "'Residual Summary'", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'N'", ")", "]", "=", "len", "(", "arg_0", ")", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'Median'", ")", "]", "=", "np", ".", "median", "(", "arg_6", ")", "arg_4", ".", "loc", "[", ":", ",", "[", "(", "arg_7", ",", "'LQ'", ")", ",", "(", "arg_7", ",", "'UQ'", ")", "]", "]", "=", "np", ".", "percentile", "(", "arg_6", ",", "[", "25", ",", "75", "]", ")", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'IQR'", ")", "]", "=", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'UQ'", ")", "]", "-", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'LQ'", ")", "]", "arg_7", "=", "'Kolmogorov-Smirnov'", "arg_9", "=", "stats", ".", "ks_2samp", "(", "arg_0", ",", "arg_1", ")", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'KS'", ")", "]", "=", "arg_9", ".", "statistic", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'p'", ")", "]", "=", "arg_9", ".", "pvalue", "arg_7", "=", "'Residual Regression'", "arg_10", "=", "sm", ".", "add_constant", "(", "arg_0", ")", "arg_11", "=", "sm", ".", "OLS", "(", "arg_6", ",", "arg_10", ",", "missing", "=", "'drop'", ")", "arg_12", "=", "arg_11", ".", "fit", "(", ")", "arg_4", ".", "loc", "[", ":", ",", "[", "(", "arg_7", ",", "'Intercept'", ")", ",", "(", "arg_7", ",", "'Slope'", ")", "]", "]", "=", "arg_12", ".", "params", "arg_4", ".", "loc", "[", ":", ",", "[", "(", "arg_7", ",", "'Intercept t'", ")", ",", "(", "arg_7", ",", "'Slope t'", ")", "]", "]", "=", "arg_12", ".", "tvalues", "arg_4", ".", "loc", "[", ":", ",", "(", "arg_7", ",", "'R2'", ")", "]", "=", "arg_12", ".", "rsquared", "arg_4", ".", "loc", "[", ":", ",", "[", "(", "arg_7", ",", "'Intercept p'", ")", ",", "(", "arg_7", ",", "'Slope p'", ")", "]", "]", "=", "arg_12", ".", "pvalues", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Compute summary statistics for paired x, y data.\n\n    Tests\n    -----\n\n    Parameters\n    ----------\n    x, y : array-like\n        Data to compare\n    nm : str (optional)\n        Index value of created dataframe.\n\n    Returns\n    -------\n    pandas dataframe of statistics.\n    \"\"\"\n    # create datafrane for results\n    if isinstance(arg_2, str):\n        arg_2 = [arg_2]\n    # cols = pd.MultiIndex.from_arrays([['', 'Pairwise', 'Pairwise', cat, cat, cat, cat],\n    #                                   ['N', 'W', 'p', 'Median', 'IQR', 'W', 'p']])\n#     cols = ['Median', 'IQR', 'CI95', 'L95', 'LQ', 'UQ', 'U95', 'N',\n#             'Wilcoxon_stat', 'Wilcoxon_p',\n#             'KS_stat', 'KS_p',\n#             'LR_slope', 'LR_intercept', 'LR_slope_tvalue', 'LR_intercept_tvalue', 'LR_slope_p', 'LR_intercept_p', 'LR_R2adj']\n#     out = pd.DataFrame(index=nm, columns=cols)\n    \n    arg_3 = pd.MultiIndex.from_tuples([('Residual Summary', 'N'),\n                                      ('Residual Summary', 'Median'),\n                                      ('Residual Summary', 'LQ'),\n                                      ('Residual Summary', 'IQR'),\n                                      ('Residual Summary', 'UQ'),\n                                      ('Residual Regression', 'Slope'),\n                                      ('Residual Regression', 'Slope t'),\n                                      ('Residual Regression', 'Slope p'),\n                                      ('Residual Regression', 'Intercept'),\n                                      ('Residual Regression', 'Intercept t'),\n                                      ('Residual Regression', 'Intercept p'),\n                                      ('Residual Regression', 'R2'),\n                                      ('Kolmogorov-Smirnov', 'KS'),\n                                      ('Kolmogorov-Smirnov', 'p')])\n    \n    arg_4 = pd.DataFrame(index=arg_2, columns=arg_3)\n    \n\n    # remove nan values\n    arg_5 = ~(np.isnan(arg_0) | np.isnan(arg_1))\n    arg_0 = arg_0[arg_5]\n    arg_1 = arg_1[arg_5]\n\n    # calculate residuals\n    arg_6 = arg_1 - arg_0\n\n    # summary statistics\n    arg_7 = 'Residual Summary'\n    arg_4.loc[:, (arg_7, 'N')] = len(arg_0)\n    arg_4.loc[:, (arg_7, 'Median')] = np.median(arg_6)\n    arg_4.loc[:, [(arg_7, 'LQ'), (arg_7, 'UQ')]] = np.percentile(arg_6, [25, 75])\n    arg_4.loc[:, (arg_7, 'IQR')] = arg_4.loc[:, (arg_7, 'UQ')] - arg_4.loc[:, (arg_7, 'LQ')]\n\n    # non-paired test for same distribution\n    arg_7 = 'Kolmogorov-Smirnov'\n    arg_9 = stats.ks_2samp(arg_0, arg_1)\n    arg_4.loc[:, (arg_7, 'KS')] = arg_9.statistic\n    arg_4.loc[:, (arg_7, 'p')] = arg_9.pvalue\n\n    # regression analysis of residuals - slope should be 0, intercept should be 0\n    arg_7 = 'Residual Regression'\n    arg_10 = sm.add_constant(arg_0)\n    arg_11 = sm.OLS(arg_6, arg_10, missing='drop')\n    arg_12 = arg_11.fit()\n    \n    arg_4.loc[:, [(arg_7, 'Intercept'), (arg_7, 'Slope')]] = arg_12.params\n    arg_4.loc[:, [(arg_7, 'Intercept t'), (arg_7, 'Slope t')]] = arg_12.tvalues\n    arg_4.loc[:, (arg_7, 'R2')] = arg_12.rsquared\n    arg_4.loc[:, [(arg_7, 'Intercept p'), (arg_7, 'Slope p')]] = arg_12.pvalues\n\n    return arg_4", "path": "Supplement/comparison_tools/stats.py", "identifier": "summary_stats", "docstring": "Compute summary statistics for paired x, y data.\n\n    Tests\n    -----\n\n    Parameters\n    ----------\n    x, y : array-like\n        Data to compare\n    nm : str (optional)\n        Index value of created dataframe.\n\n    Returns\n    -------\n    pandas dataframe of statistics.", "docstring_tokens": ["Compute", "summary", "statistics", "for", "paired", "x", "y", "data", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257555}
{"url": "https://github.com/praekelt/django-analytics/blob/29c22d03374ccc0ec451650e2c2886d324f6e5c6/analytics/__init__.py#L1-L21", "sha": "29c22d03374ccc0ec451650e2c2886d324f6e5c6", "docstring_summary": "Auto-discover INSTALLED_APPS gadgets.py modules and fail silently when\n    not present. This forces an import on them to register any gadgets they\n    may want.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "from", "django", ".", "conf", "import", "settings", "from", "django", ".", "utils", ".", "importlib", "import", "import_module", "from", "django", ".", "utils", ".", "module_loading", "import", "module_has_submodule", "for", "arg_0", "in", "settings", ".", "INSTALLED_APPS", ":", "arg_1", "=", "import_module", "(", "arg_0", ")", "try", ":", "import_module", "(", "'%s.gadgets'", "%", "arg_0", ")", "except", ":", "if", "module_has_submodule", "(", "arg_1", ",", "'gadgets'", ")", ":", "raise"], "function": "def Func():\n    \"\"\"\n    Auto-discover INSTALLED_APPS gadgets.py modules and fail silently when\n    not present. This forces an import on them to register any gadgets they\n    may want.\n    \"\"\"\n    from django.conf import settings\n    from django.utils.importlib import import_module\n    from django.utils.module_loading import module_has_submodule\n\n    for arg_0 in settings.INSTALLED_APPS:\n        arg_1 = import_module(arg_0)\n        # Attempt to import the app's gadgets module.\n        try:\n            import_module('%s.gadgets' % arg_0)\n        except:\n            # Decide whether to bubble up this error. If the app just\n            # doesn't have a gadgets module, we can ignore the error\n            # attempting to import it, otherwise we want it to bubble up.\n            if module_has_submodule(arg_1, 'gadgets'):\n                raise", "path": "analytics/__init__.py", "identifier": "autodiscover", "docstring": "Auto-discover INSTALLED_APPS gadgets.py modules and fail silently when\n    not present. This forces an import on them to register any gadgets they\n    may want.", "docstring_tokens": ["Auto", "-", "discover", "INSTALLED_APPS", "gadgets", ".", "py", "modules", "and", "fail", "silently", "when", "not", "present", ".", "This", "forces", "an", "import", "on", "them", "to", "register", "any", "gadgets", "they", "may", "want", "."], "nwo": "praekelt/django-analytics", "score": 0.1905226606846468, "idx": 257556}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_basic_environment.py#L204-L237", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Translates the given metrics value to JSON string", "language": "python", "parameters": "(self, metrics, label)", "return_statement": "return jsonString", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "def", "_mapNumpyValues", "(", "arg_4", ")", ":", "import", "numpy", "if", "isinstance", "(", "arg_4", ",", "numpy", ".", "float32", ")", ":", "return", "float", "(", "arg_4", ")", "elif", "isinstance", "(", "arg_4", ",", "numpy", ".", "bool_", ")", ":", "return", "bool", "(", "arg_4", ")", "elif", "isinstance", "(", "arg_4", ",", "numpy", ".", "ndarray", ")", ":", "return", "arg_4", ".", "tolist", "(", ")", "else", ":", "raise", "TypeError", "(", "\"UNEXPECTED OBJ: %s; class=%s\"", "%", "(", "arg_4", ",", "arg_4", ".", "__class__", ")", ")", "arg_5", "=", "json", ".", "dumps", "(", "arg_3", ",", "indent", "=", "4", ",", "default", "=", "_mapNumpyValues", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Translates the given metrics value to JSON string\n\n    metrics:        A list of dictionaries per OPFTaskDriver.getMetrics():\n\n    Returns:        JSON string representing the given metrics object.\n    \"\"\"\n\n    # Transcode the MetricValueElement values into JSON-compatible\n    # structure\n    arg_3 = arg_1\n\n    # Convert the structure to a display-friendly JSON string\n    def _mapNumpyValues(arg_4):\n      \"\"\"\n      \"\"\"\n      import numpy\n\n      if isinstance(arg_4, numpy.float32):\n        return float(arg_4)\n\n      elif isinstance(arg_4, numpy.bool_):\n        return bool(arg_4)\n\n      elif isinstance(arg_4, numpy.ndarray):\n        return arg_4.tolist()\n\n      else:\n        raise TypeError(\"UNEXPECTED OBJ: %s; class=%s\" % (arg_4, arg_4.__class__))\n\n\n    arg_5 = json.dumps(arg_3, indent=4, default=_mapNumpyValues)\n\n    return arg_5", "path": "src/nupic/frameworks/opf/opf_basic_environment.py", "identifier": "BasicPredictionMetricsLogger._translateMetricsToJSON", "docstring": "Translates the given metrics value to JSON string\n\n    metrics:        A list of dictionaries per OPFTaskDriver.getMetrics():\n\n    Returns:        JSON string representing the given metrics object.", "docstring_tokens": ["Translates", "the", "given", "metrics", "value", "to", "JSON", "string"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257557}
{"url": "https://github.com/openergy/oplus/blob/f095868d1990c1d126e906ada6acbab26348b3d3/oplus/epm/record.py#L526-L546", "sha": "f095868d1990c1d126e906ada6acbab26348b3d3", "docstring_summary": "This method only works for extensible fields. It allows to insert a value, and shifts all other following\n        values.", "language": "python", "parameters": "(self, index, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "arg_0", ".", "_prepare_pop_Func_index", "(", "arg_1", "=", "arg_1", ")", "arg_3", "=", "arg_0", ".", "clear_extensible_fields", "(", ")", "arg_3", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "add_fields", "(", "*", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        This method only works for extensible fields. It allows to Func a value, and shifts all other following\n        values.\n\n        Parameters\n        ----------\n        index: position of Funcion\n        value: value to Func\n        \"\"\"\n        # prepare index (will check for extensible)\n        arg_1 = arg_0._prepare_pop_Func_index(arg_1=arg_1)\n\n        # remove extensible fields\n        arg_3 = arg_0.clear_extensible_fields()\n\n        # Func\n        arg_3.Func(arg_1, arg_2)\n\n        # add new list\n        arg_0.add_fields(*arg_3)", "path": "oplus/epm/record.py", "identifier": "Record.insert", "docstring": "This method only works for extensible fields. It allows to insert a value, and shifts all other following\n        values.\n\n        Parameters\n        ----------\n        index: position of insertion\n        value: value to insert", "docstring_tokens": ["This", "method", "only", "works", "for", "extensible", "fields", ".", "It", "allows", "to", "insert", "a", "value", "and", "shifts", "all", "other", "following", "values", "."], "nwo": "openergy/oplus", "score": 0.38919093769130675, "idx": 257558}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/account.py#L445-L457", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Derive private key using \"generate_from_seed\" method.\n            Here, the key itself serves as a `seed`, and `offset`\n            is expected to be a sha256 digest.", "language": "python", "parameters": "(self, offset)", "return_statement": "return PrivateKey(secret, prefix=self.pubkey.prefix)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "int", "(", "hexlify", "(", "bytes", "(", "arg_0", ")", ")", ".", "decode", "(", "\"ascii\"", ")", ",", "16", ")", "arg_3", "=", "int", "(", "hexlify", "(", "arg_1", ")", ".", "decode", "(", "\"ascii\"", ")", ",", "16", ")", "arg_4", "=", "ecdsa", ".", "SECP256k1", ".", "order", "arg_5", "=", "(", "arg_2", "+", "arg_3", ")", "%", "arg_4", "arg_6", "=", "\"%0x\"", "%", "arg_5", "if", "len", "(", "arg_6", ")", "<", "64", ":", "arg_6", "=", "(", "\"0\"", "*", "(", "64", "-", "len", "(", "arg_6", ")", ")", ")", "+", "arg_6", "return", "PrivateKey", "(", "arg_6", ",", "prefix", "=", "arg_0", ".", "pubkey", ".", "prefix", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Derive private key using \"generate_from_seed\" method.\n            Here, the key itself serves as a `seed`, and `offset`\n            is expected to be a sha256 digest.\n        \"\"\"\n        arg_2 = int(hexlify(bytes(arg_0)).decode(\"ascii\"), 16)\n        arg_3 = int(hexlify(arg_1).decode(\"ascii\"), 16)\n        arg_4 = ecdsa.SECP256k1.order\n        arg_5 = (arg_2 + arg_3) % arg_4\n        arg_6 = \"%0x\" % arg_5\n        if len(arg_6) < 64: # left-pad with zeroes\n            arg_6 = (\"0\" * (64-len(arg_6))) + arg_6\n        return PrivateKey(arg_6, prefix=arg_0.pubkey.prefix)", "path": "graphenebase/account.py", "identifier": "PrivateKey.derive_from_seed", "docstring": "Derive private key using \"generate_from_seed\" method.\n            Here, the key itself serves as a `seed`, and `offset`\n            is expected to be a sha256 digest.", "docstring_tokens": ["Derive", "private", "key", "using", "generate_from_seed", "method", ".", "Here", "the", "key", "itself", "serves", "as", "a", "seed", "and", "offset", "is", "expected", "to", "be", "a", "sha256", "digest", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 257559}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/topology/topology_context_impl.py#L118-L127", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Registers a specified task hook to this context", "language": "python", "parameters": "(self, task_hook)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "ITaskHook", ")", ":", "raise", "TypeError", "(", "\"In Func(): attempt to add non ITaskHook instance, given: %s\"", "%", "str", "(", "type", "(", "arg_1", ")", ")", ")", "arg_0", ".", "task_hooks", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Registers a specified task hook to this context\n\n    :type task_hook: heron.instance.src.python.utils.topology.ITaskHook\n    :param task_hook: Implementation of ITaskHook\n    \"\"\"\n    if not isinstance(arg_1, ITaskHook):\n      raise TypeError(\"In Func(): attempt to add non ITaskHook instance, given: %s\"\n                      % str(type(arg_1)))\n    arg_0.task_hooks.append(arg_1)", "path": "heron/instance/src/python/utils/topology/topology_context_impl.py", "identifier": "TopologyContextImpl.add_task_hook", "docstring": "Registers a specified task hook to this context\n\n    :type task_hook: heron.instance.src.python.utils.topology.ITaskHook\n    :param task_hook: Implementation of ITaskHook", "docstring_tokens": ["Registers", "a", "specified", "task", "hook", "to", "this", "context"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257560}
{"url": "https://github.com/GreatFruitOmsk/tailhead/blob/a3b1324a39935f8ffcfda59328a9a458672889d9/tailhead/__init__.py#L249-L284", "sha": "a3b1324a39935f8ffcfda59328a9a458672889d9", "docstring_summary": "Iterator generator that returns lines as data is added to the file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "True", "while", "True", ":", "arg_2", "=", "arg_0", ".", "file", ".", "tell", "(", ")", "if", "arg_2", ">", "os", ".", "fstat", "(", "arg_0", ".", "file", ".", "fileno", "(", ")", ")", ".", "st_size", ":", "arg_2", "=", "0", "arg_0", ".", "file", ".", "seek", "(", "arg_2", ")", "arg_3", "=", "arg_0", ".", "file", ".", "readline", "(", ")", "if", "arg_3", ":", "if", "arg_1", "and", "arg_3", "in", "arg_0", ".", "LINE_TERMINATORS", ":", "arg_1", "=", "False", "continue", "arg_4", "=", "arg_0", ".", "suffix_line_terminator", "(", "arg_3", ")", "if", "arg_4", ":", "arg_3", "=", "arg_3", "[", ":", "-", "len", "(", "arg_4", ")", "]", "arg_1", "=", "False", "yield", "arg_3", "else", ":", "arg_1", "=", "True", "arg_0", ".", "file", ".", "seek", "(", "arg_2", ")", "yield", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Iterator generator that returns lines as data is added to the file.\n\n        None will be yielded if no new line is available.\n        Caller may either wait and re-try or end iteration.\n        \"\"\"\n        arg_1 = True       \n        \n        while True:\n            arg_2 = arg_0.file.tell()\n\n            if arg_2 > os.fstat(arg_0.file.fileno()).st_size:\n                # File was truncated.\n                arg_2 = 0\n                arg_0.file.seek(arg_2)\n\n            arg_3 = arg_0.file.readline()\n\n            if arg_3:    \n                if arg_1 and arg_3 in arg_0.LINE_TERMINATORS:\n                    # This is just the line terminator added to the end of the file\n                    # before a new line, ignore.\n                    arg_1 = False\n                    continue\n\n                arg_4 = arg_0.suffix_line_terminator(arg_3)\n                if arg_4:\n                    arg_3 = arg_3[:-len(arg_4)]\n\n                arg_1 = False\n                yield arg_3\n            else:\n                arg_1 = True\n                arg_0.file.seek(arg_2)\n                yield None", "path": "tailhead/__init__.py", "identifier": "Tailer.follow", "docstring": "Iterator generator that returns lines as data is added to the file.\n\n        None will be yielded if no new line is available.\n        Caller may either wait and re-try or end iteration.", "docstring_tokens": ["Iterator", "generator", "that", "returns", "lines", "as", "data", "is", "added", "to", "the", "file", "."], "nwo": "GreatFruitOmsk/tailhead", "score": 0.27831918678159157, "idx": 257561}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/parser.py#L486-L523", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Parse an AMC motion capture data file.", "language": "python", "parameters": "(source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "1", "arg_3", "=", "{", "}", "arg_4", "=", "False", "for", "arg_5", "in", "arg_0", ":", "arg_1", "+=", "1", "arg_5", "=", "arg_5", ".", "split", "(", "'#'", ")", "[", "0", "]", ".", "strip", "(", ")", "if", "not", "arg_5", ":", "continue", "if", "arg_5", ".", "startswith", "(", "':'", ")", ":", "if", "arg_5", ".", "lower", "(", ")", ".", "startswith", "(", "':deg'", ")", ":", "arg_4", "=", "True", "continue", "if", "arg_5", ".", "isdigit", "(", ")", ":", "if", "int", "(", "arg_5", ")", "!=", "arg_2", ":", "raise", "RuntimeError", "(", "'frame mismatch on line {}: '", "'produced {} but file claims {}'", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_5", ")", ")", "yield", "arg_3", "arg_2", "+=", "1", "arg_3", "=", "{", "}", "continue", "arg_6", "=", "arg_5", ".", "split", "(", ")", "arg_3", "[", "arg_6", "[", "0", "]", "]", "=", "list", "(", "map", "(", "float", ",", "arg_6", "[", "1", ":", "]", ")", ")"], "function": "def Func(arg_0):\n    '''Parse an AMC motion capture data file.\n\n    Parameters\n    ----------\n    source : file\n        A file-like object that contains AMC motion capture text.\n\n    Yields\n    ------\n    frame : dict\n        Yields a series of motion capture frames. Each frame is a dictionary\n        that maps a bone name to a list of the DOF configurations for that bone.\n    '''\n    arg_1 = 0\n    arg_2 = 1\n    arg_3 = {}\n    arg_4 = False\n    for arg_5 in arg_0:\n        arg_1 += 1\n        arg_5 = arg_5.split('#')[0].strip()\n        if not arg_5:\n            continue\n        if arg_5.startswith(':'):\n            if arg_5.lower().startswith(':deg'):\n                arg_4 = True\n            continue\n        if arg_5.isdigit():\n            if int(arg_5) != arg_2:\n                raise RuntimeError(\n                    'frame mismatch on line {}: '\n                    'produced {} but file claims {}'.format(arg_1, arg_2, arg_5))\n            yield arg_3\n            arg_2 += 1\n            arg_3 = {}\n            continue\n        arg_6 = arg_5.split()\n        arg_3[arg_6[0]] = list(map(float, arg_6[1:]))", "path": "pagoda/parser.py", "identifier": "parse_amc", "docstring": "Parse an AMC motion capture data file.\n\n    Parameters\n    ----------\n    source : file\n        A file-like object that contains AMC motion capture text.\n\n    Yields\n    ------\n    frame : dict\n        Yields a series of motion capture frames. Each frame is a dictionary\n        that maps a bone name to a list of the DOF configurations for that bone.", "docstring_tokens": ["Parse", "an", "AMC", "motion", "capture", "data", "file", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 257562}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L350-L388", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Detect if `obj` is a stream.", "language": "python", "parameters": "(obj)", "return_statement": "return numpy.any(alternative_results)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "\"close\"", ",", ")", "arg_2", "=", "(", "(", "\"read\"", ",", "\"readline\"", ",", "\"readlines\"", ")", ",", "(", "\"write\"", ",", "\"writeline\"", ",", "\"writelines\"", ")", ")", "for", "arg_3", "in", "arg_1", ":", "if", "not", "hasmethod", "(", "arg_0", ",", "arg_3", ")", ":", "return", "False", "arg_4", "=", "[", "numpy", ".", "all", "(", "[", "hasmethod", "(", "arg_0", ",", "arg_3", ")", "for", "arg_3", "in", "alternatives", "]", ")", "for", "alternatives", "in", "arg_2", "]", "return", "numpy", ".", "any", "(", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"Detect if `obj` is a stream.\n\n    We consider anything a stream that has the methods\n\n    - ``close()``\n\n    and either set of the following\n\n    - ``read()``, ``readline()``, ``readlines()``\n    - ``write()``, ``writeline()``, ``writelines()``\n\n    :Arguments:\n      *obj*\n          stream or str\n\n    :Returns:\n      *bool*, ``True`` if `obj` is a stream, ``False`` otherwise\n\n    .. SeeAlso::\n       :mod:`io`\n\n\n    .. versionadded:: 0.7.1\n    \"\"\"\n    arg_1 = (\"close\",)\n    arg_2 = (\n        (\"read\", \"readline\", \"readlines\"),\n        (\"write\", \"writeline\", \"writelines\"))\n\n    # Must have ALL the signature methods\n    for arg_3 in arg_1:\n        if not hasmethod(arg_0, arg_3):\n            return False\n    # Must have at least one complete set of alternative_methods\n    arg_4 = [\n        numpy.all([hasmethod(arg_0, arg_3) for arg_3 in alternatives])\n        for alternatives in arg_2]\n    return numpy.any(arg_4)", "path": "gromacs/utilities.py", "identifier": "isstream", "docstring": "Detect if `obj` is a stream.\n\n    We consider anything a stream that has the methods\n\n    - ``close()``\n\n    and either set of the following\n\n    - ``read()``, ``readline()``, ``readlines()``\n    - ``write()``, ``writeline()``, ``writelines()``\n\n    :Arguments:\n      *obj*\n          stream or str\n\n    :Returns:\n      *bool*, ``True`` if `obj` is a stream, ``False`` otherwise\n\n    .. SeeAlso::\n       :mod:`io`\n\n\n    .. versionadded:: 0.7.1", "docstring_tokens": ["Detect", "if", "obj", "is", "a", "stream", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 257563}
{"url": "https://github.com/kolypto/py-smsframework/blob/4f3d812711f5e2e037dc80c4014c815fe2d68a0b/smsframework/data/MessageStatus.py#L54-L69", "sha": "4f3d812711f5e2e037dc80c4014c815fe2d68a0b", "docstring_summary": "Get the set of states. Mostly used for pretty printing", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "if", "arg_0", ".", "accepted", ":", "arg_1", ".", "add", "(", "'accepted'", ")", "if", "arg_0", ".", "delivered", ":", "arg_1", ".", "add", "(", "'delivered'", ")", "if", "arg_0", ".", "expired", ":", "arg_1", ".", "add", "(", "'expired'", ")", "if", "arg_0", ".", "error", ":", "arg_1", ".", "add", "(", "'error'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Get the set of Func. Mostly used for pretty printing\n\n            :rtype: set\n            :returns: Set of 'accepted', 'delivered', 'expired', 'error'\n        \"\"\"\n        arg_1 = set()\n        if arg_0.accepted:\n            arg_1.add('accepted')\n        if arg_0.delivered:\n            arg_1.add('delivered')\n        if arg_0.expired:\n            arg_1.add('expired')\n        if arg_0.error:\n            arg_1.add('error')\n        return arg_1", "path": "smsframework/data/MessageStatus.py", "identifier": "MessageStatus.states", "docstring": "Get the set of states. Mostly used for pretty printing\n\n            :rtype: set\n            :returns: Set of 'accepted', 'delivered', 'expired', 'error'", "docstring_tokens": ["Get", "the", "set", "of", "states", ".", "Mostly", "used", "for", "pretty", "printing"], "nwo": "kolypto/py-smsframework", "score": 0.28121406850955877, "idx": 257564}
{"url": "https://github.com/andreafrancia/trash-cli/blob/5abecd53e1d84f2a5fd3fc60d2f5d71e518826c5/trashcli/put.py#L133-L160", "sha": "5abecd53e1d84f2a5fd3fc60d2f5d71e518826c5", "docstring_summary": "Trash a file in the appropriate trash directory.\n        If the file belong to the same volume of the trash home directory it\n        will be trashed in the home trash directory.\n        Otherwise it will be trashed in one of the relevant volume trash\n        directories.", "language": "python", "parameters": "(self, file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_should_skipped_by_specs", "(", "arg_1", ")", ":", "arg_0", ".", "reporter", ".", "unable_to_Func_dot_entries", "(", "arg_1", ")", "return", "arg_2", "=", "arg_0", ".", "volume_of_parent", "(", "arg_1", ")", "arg_0", ".", "reporter", ".", "volume_of_file", "(", "arg_2", ")", "arg_3", "=", "arg_0", ".", "_possible_Func_directories_for", "(", "arg_2", ")", "arg_0", ".", "try_Func_file_using_candidates", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1) :\n        \"\"\"\n        Trash a file in the appropriate Func directory.\n        If the file belong to the same volume of the Func home directory it\n        will be Funced in the home Func directory.\n        Otherwise it will be Funced in one of the relevant volume Func\n        directories.\n\n        Each volume can have two Func directories, they are\n            - $volume/.Trash/$uid\n            - $volume/.Trash-$uid\n\n        Firstly the software attempt to Func the file in the first directory\n        then try to Func in the second Func directory.\n        \"\"\"\n\n        if arg_0._should_skipped_by_specs(arg_1):\n            arg_0.reporter.unable_to_Func_dot_entries(arg_1)\n            return\n\n        arg_2 = arg_0.volume_of_parent(arg_1)\n        arg_0.reporter.volume_of_file(arg_2)\n        arg_3 = arg_0._possible_Func_directories_for(\n                        arg_2)\n\n        arg_0.try_Func_file_using_candidates(arg_1,\n                                             arg_2,\n                                             arg_3)", "path": "trashcli/put.py", "identifier": "TrashPutCmd.trash", "docstring": "Trash a file in the appropriate trash directory.\n        If the file belong to the same volume of the trash home directory it\n        will be trashed in the home trash directory.\n        Otherwise it will be trashed in one of the relevant volume trash\n        directories.\n\n        Each volume can have two trash directories, they are\n            - $volume/.Trash/$uid\n            - $volume/.Trash-$uid\n\n        Firstly the software attempt to trash the file in the first directory\n        then try to trash in the second trash directory.", "docstring_tokens": ["Trash", "a", "file", "in", "the", "appropriate", "trash", "directory", ".", "If", "the", "file", "belong", "to", "the", "same", "volume", "of", "the", "trash", "home", "directory", "it", "will", "be", "trashed", "in", "the", "home", "trash", "directory", ".", "Otherwise", "it", "will", "be", "trashed", "in", "one", "of", "the", "relevant", "volume", "trash", "directories", "."], "nwo": "andreafrancia/trash-cli", "score": 0.7794859178623917, "idx": 257565}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/adapter.py#L73-L78", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Stop scanning for BLE devices with this adapter.", "language": "python", "parameters": "(self, timeout_sec=TIMEOUT_SEC)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_0", ".", "_scan_stopped", ".", "clear", "(", ")", "arg_0", ".", "_adapter", ".", "StopDiscovery", "(", ")", "if", "not", "arg_0", ".", "_scan_stopped", ".", "wait", "(", "arg_1", ")", ":", "raise", "RuntimeError", "(", "'Exceeded timeout waiting for adapter to stop scanning!'", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Stop scanning for BLE devices with this adapter.\"\"\"\n        arg_0._scan_stopped.clear()\n        arg_0._adapter.StopDiscovery()\n        if not arg_0._scan_stopped.wait(arg_1):\n            raise RuntimeError('Exceeded timeout waiting for adapter to stop scanning!')", "path": "Adafruit_BluefruitLE/bluez_dbus/adapter.py", "identifier": "BluezAdapter.stop_scan", "docstring": "Stop scanning for BLE devices with this adapter.", "docstring_tokens": ["Stop", "scanning", "for", "BLE", "devices", "with", "this", "adapter", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 257566}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/nodebox.py#L620-L640", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Draws a string of text according to current font settings.", "language": "python", "parameters": "(self, txt, x, y, width=None, height=1000000, outline=False, draw=True, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "1000000", ",", "arg_6", "=", "False", ",", "arg_7", "=", "True", ",", "**", "arg_8", ")", ":", "arg_1", "=", "arg_0", ".", "Text", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_6", ",", "ctx", "=", "None", ",", "**", "arg_8", ")", "if", "arg_6", ":", "arg_9", "=", "arg_1", ".", "path", "if", "arg_7", ":", "arg_9", ".", "draw", "(", ")", "return", "arg_9", "else", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=1000000, arg_6=False, arg_7=True, **arg_8):\n        '''\n        Draws a string of Func according to current font settings.\n\n        :param txt: Text to output\n        :param x: x-coordinate of the top left corner\n        :param y: y-coordinate of the top left corner\n        :param width: Func width\n        :param height: Func height\n        :param outline: If True draws outline Func (defaults to False)\n        :param draw: Set to False to inhibit immediate drawing (defaults to True)\n        :return: Path object representing the Func.\n        '''\n        arg_1 = arg_0.Text(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6=arg_6, ctx=None, **arg_8)\n        if arg_6:\n            arg_9 = arg_1.path\n            if arg_7:\n                arg_9.draw()\n            return arg_9\n        else:\n            return arg_1", "path": "shoebot/grammar/nodebox.py", "identifier": "NodeBot.text", "docstring": "Draws a string of text according to current font settings.\n\n        :param txt: Text to output\n        :param x: x-coordinate of the top left corner\n        :param y: y-coordinate of the top left corner\n        :param width: text width\n        :param height: text height\n        :param outline: If True draws outline text (defaults to False)\n        :param draw: Set to False to inhibit immediate drawing (defaults to True)\n        :return: Path object representing the text.", "docstring_tokens": ["Draws", "a", "string", "of", "text", "according", "to", "current", "font", "settings", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257567}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1519-L1549", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots a histogram of daily turnover rates.", "language": "python", "parameters": "(transactions, positions,\n                             ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "plt", ".", "gca", "(", ")", "arg_4", "=", "txn", ".", "get_turnover", "(", "arg_1", ",", "arg_0", ")", "sns", ".", "distplot", "(", "arg_4", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "arg_2", ".", "set_title", "(", "'Distribution of daily turnover rates'", ")", "arg_2", ".", "set_xlabel", "(", "'Turnover rate'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1,\n                             arg_2=None, **arg_3):\n    \"\"\"\n    Plots a histogram of daily turnover rates.\n\n    Parameters\n    ----------\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_2 is None:\n        arg_2 = plt.gca()\n    arg_4 = txn.get_turnover(arg_1, arg_0)\n    sns.distplot(arg_4, arg_2=arg_2, **arg_3)\n    arg_2.set_title('Distribution of daily turnover rates')\n    arg_2.set_xlabel('Turnover rate')\n    return arg_2", "path": "pyfolio/plotting.py", "identifier": "plot_daily_turnover_hist", "docstring": "Plots a histogram of daily turnover rates.\n\n    Parameters\n    ----------\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "a", "histogram", "of", "daily", "turnover", "rates", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257568}
{"url": "https://github.com/python/performance/blob/2a9524c0a5714e85106671bc61d750e800fe17db/performance/benchmarks/bm_regex_effbot.py#L60-L94", "sha": "2a9524c0a5714e85106671bc61d750e800fe17db", "docstring_summary": "Generates the list of strings that will be used in the benchmarks.", "language": "python", "parameters": "(n)", "return_statement": "return strings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "def", "append", "(", "arg_2", ")", ":", "if", "USE_BYTES_IN_PY3K", ":", "arg_1", ".", "append", "(", "arg_2", ".", "encode", "(", "'latin1'", ")", ")", "else", ":", "arg_1", ".", "append", "(", "arg_2", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Perl'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'P'", "*", "arg_0", "+", "'Perl'", "+", "'P'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Perl'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Perl'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Python'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'P'", "*", "arg_0", "+", "'Python'", "+", "'P'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Python'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Python'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Python'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Python'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Perl'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'P'", "*", "arg_0", "+", "'Perl'", "+", "'P'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Perl'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Perl'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'PythonPython'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'P'", "*", "arg_0", "+", "'PythonPython'", "+", "'P'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'a5,b7,c9,'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'a5,b7,c9,'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'a5,b7,c9,'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'a5,b7,c9,'", "+", "'-'", "*", "arg_0", ")", "append", "(", "'-'", "*", "arg_0", "+", "'Python'", "+", "'-'", "*", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Generates the list of strings that will be used in the benchmarks.\n\n    All strings have repeated prefixes and suffices, and n specifies the\n    number of repetitions.\n    \"\"\"\n    arg_1 = []\n\n    def append(arg_2):\n        if USE_BYTES_IN_PY3K:\n            arg_1.append(arg_2.encode('latin1'))\n        else:\n            arg_1.append(arg_2)\n    append('-' * arg_0 + 'Perl' + '-' * arg_0)\n    append('P' * arg_0 + 'Perl' + 'P' * arg_0)\n    append('-' * arg_0 + 'Perl' + '-' * arg_0)\n    append('-' * arg_0 + 'Perl' + '-' * arg_0)\n    append('-' * arg_0 + 'Python' + '-' * arg_0)\n    append('P' * arg_0 + 'Python' + 'P' * arg_0)\n    append('-' * arg_0 + 'Python' + '-' * arg_0)\n    append('-' * arg_0 + 'Python' + '-' * arg_0)\n    append('-' * arg_0 + 'Python' + '-' * arg_0)\n    append('-' * arg_0 + 'Python' + '-' * arg_0)\n    append('-' * arg_0 + 'Perl' + '-' * arg_0)\n    append('P' * arg_0 + 'Perl' + 'P' * arg_0)\n    append('-' * arg_0 + 'Perl' + '-' * arg_0)\n    append('-' * arg_0 + 'Perl' + '-' * arg_0)\n    append('-' * arg_0 + 'PythonPython' + '-' * arg_0)\n    append('P' * arg_0 + 'PythonPython' + 'P' * arg_0)\n    append('-' * arg_0 + 'a5,b7,c9,' + '-' * arg_0)\n    append('-' * arg_0 + 'a5,b7,c9,' + '-' * arg_0)\n    append('-' * arg_0 + 'a5,b7,c9,' + '-' * arg_0)\n    append('-' * arg_0 + 'a5,b7,c9,' + '-' * arg_0)\n    append('-' * arg_0 + 'Python' + '-' * arg_0)\n    return arg_1", "path": "performance/benchmarks/bm_regex_effbot.py", "identifier": "gen_string_table", "docstring": "Generates the list of strings that will be used in the benchmarks.\n\n    All strings have repeated prefixes and suffices, and n specifies the\n    number of repetitions.", "docstring_tokens": ["Generates", "the", "list", "of", "strings", "that", "will", "be", "used", "in", "the", "benchmarks", "."], "nwo": "python/performance", "score": 0.9320212778991671, "idx": 257569}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/panel.py#L175-L257", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse a file with genes and return the hgnc ids", "language": "python", "parameters": "(gene_lines)", "return_statement": "return genes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "[", "]", "arg_3", "=", "set", "(", ")", "arg_4", "=", "'\\t'", "arg_5", "=", "[", "'\\t'", ",", "' '", ",", "';'", "]", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_0", ")", ":", "arg_7", "=", "arg_7", ".", "rstrip", "(", ")", "if", "not", "len", "(", "arg_7", ")", ">", "0", ":", "continue", "if", "arg_7", ".", "startswith", "(", "'#'", ")", ":", "if", "not", "arg_7", ".", "startswith", "(", "'##'", ")", ":", "arg_8", "=", "0", "arg_4", "=", "None", "for", "arg_9", "in", "arg_5", ":", "arg_10", "=", "arg_7", ".", "split", "(", "arg_9", ")", "if", "len", "(", "arg_10", ")", ">", "arg_8", ":", "arg_8", "=", "len", "(", "arg_10", ")", "arg_4", "=", "arg_9", "arg_2", "=", "[", "word", ".", "lower", "(", ")", "for", "word", "in", "arg_7", "[", "1", ":", "]", ".", "split", "(", "arg_4", ")", "]", "else", ":", "if", "arg_6", "==", "0", ":", "arg_8", "=", "0", "for", "arg_9", "in", "arg_5", ":", "arg_10", "=", "arg_7", ".", "split", "(", "arg_9", ")", "if", "len", "(", "arg_10", ")", ">", "arg_8", ":", "arg_8", "=", "len", "(", "arg_10", ")", "arg_4", "=", "arg_9", "if", "(", "'hgnc'", "in", "arg_7", "or", "'HGNC'", "in", "arg_7", ")", ":", "arg_2", "=", "[", "word", ".", "lower", "(", ")", "for", "word", "in", "arg_7", ".", "split", "(", "arg_4", ")", "]", "continue", "if", "arg_7", ".", "split", "(", "arg_4", ")", "[", "0", "]", ".", "isdigit", "(", ")", ":", "arg_2", "=", "[", "'hgnc_id'", "]", "else", ":", "arg_2", "=", "[", "'hgnc_symbol'", "]", "arg_11", "=", "arg_7", ".", "split", "(", "arg_4", ")", "arg_12", "=", "dict", "(", "zip", "(", "arg_2", ",", "arg_11", ")", ")", "arg_13", "=", "False", "for", "arg_14", "in", "arg_12", ":", "if", "arg_12", "[", "arg_14", "]", ":", "arg_13", "=", "True", "break", "if", "not", "arg_13", ":", "continue", "try", ":", "arg_15", "=", "parse_gene", "(", "arg_12", ")", "except", "Exception", "as", "e", ":", "LOG", ".", "warning", "(", "e", ")", "raise", "SyntaxError", "(", "\"Line {0} is malformed\"", ".", "format", "(", "arg_6", "+", "1", ")", ")", "arg_16", "=", "arg_15", ".", "pop", "(", "'identifier'", ")", "if", "not", "arg_16", "in", "arg_3", ":", "arg_3", ".", "add", "(", "arg_16", ")", "arg_1", ".", "append", "(", "arg_15", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse a file with genes and return the hgnc ids\n\n    Args:\n        gene_lines(iterable(str)): Stream with genes\n\n    Returns:\n        genes(list(dict)): Dictionaries with relevant gene info\n    \"\"\"\n    arg_1 = []\n    arg_2 = []\n    arg_3 = set()\n    arg_4 = '\\t'\n    # This can be '\\t' or ';'\n    arg_5 = ['\\t', ' ', ';']\n\n    # There are files that have '#' to indicate headers\n    # There are some files that start with a header line without\n    # any special symbol\n    for arg_6,arg_7 in enumerate(arg_0):\n        arg_7 = arg_7.rstrip()\n        if not len(arg_7) > 0:\n            continue\n        if arg_7.startswith('#'):\n            if not arg_7.startswith('##'):\n                # We need to try delimiters\n                # We prefer ';' or '\\t' byt should accept ' '\n                arg_8 = 0\n                arg_4 = None\n                for arg_9 in arg_5:\n                    arg_10 = arg_7.split(arg_9)\n                    if len(arg_10) > arg_8:\n                        arg_8 = len(arg_10)\n                        arg_4 = arg_9\n\n                arg_2 = [word.lower() for word in arg_7[1:].split(arg_4)]\n        else:\n            # If no header symbol(#) assume first line is header\n            if arg_6 == 0:\n                arg_8 = 0\n                for arg_9 in arg_5:\n                    arg_10 = arg_7.split(arg_9)\n                    if len(arg_10) > arg_8:\n                        arg_8 = len(arg_10)\n                        arg_4 = arg_9\n                \n                if ('hgnc' in arg_7 or 'HGNC' in arg_7):\n                    arg_2 = [word.lower() for word in arg_7.split(arg_4)]\n                    continue\n                # If first line is not a header try to sniff what the first\n                # columns holds\n                if arg_7.split(arg_4)[0].isdigit():\n                    arg_2 = ['hgnc_id']\n                else:\n                    arg_2 = ['hgnc_symbol']\n\n            arg_11 = arg_7.split(arg_4)\n            arg_12 = dict(zip(arg_2, arg_11))\n\n            # There are cases when excel exports empty lines that looks like\n            # ;;;;;;;. This is a exception to handle these\n            arg_13 = False\n            for arg_14 in arg_12:\n                if arg_12[arg_14]:\n                    arg_13 = True\n                    break\n            # If no info was found we skip that line\n            if not arg_13:\n                continue\n\n            try:\n                arg_15 = parse_gene(arg_12)\n            except Exception as e:\n                LOG.warning(e)\n                raise SyntaxError(\"Line {0} is malformed\".format(arg_6 + 1))\n\n            arg_16 = arg_15.pop('identifier')\n\n            if not arg_16 in arg_3:\n                arg_3.add(arg_16)\n                arg_1.append(arg_15)\n\n    return arg_1", "path": "scout/parse/panel.py", "identifier": "parse_genes", "docstring": "Parse a file with genes and return the hgnc ids\n\n    Args:\n        gene_lines(iterable(str)): Stream with genes\n\n    Returns:\n        genes(list(dict)): Dictionaries with relevant gene info", "docstring_tokens": ["Parse", "a", "file", "with", "genes", "and", "return", "the", "hgnc", "ids"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257570}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L149-L166", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Converts analytes in format '27Al' to 'Al27'.", "language": "python", "parameters": "(s)", "return_statement": "return el + m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "match", "(", "'.*?([A-z]{1,3}).*?'", ",", "arg_0", ")", ".", "groups", "(", ")", "[", "0", "]", "arg_2", "=", "re", ".", "match", "(", "'.*?([0-9]{1,3}).*?'", ",", "arg_0", ")", ".", "groups", "(", ")", "[", "0", "]", "return", "arg_1", "+", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Converts analytes in format '27Al' to 'Al27'.\n\n    Parameters\n    ----------\n    s : str\n        of format [A-z]{1,3}[0-9]{1,3}\n\n    Returns\n    -------\n    str\n        Name in format [0-9]{1,3}[A-z]{1,3}\n    \"\"\"\n    arg_1 = re.match('.*?([A-z]{1,3}).*?', arg_0).groups()[0]\n    arg_2 = re.match('.*?([0-9]{1,3}).*?', arg_0).groups()[0]\n\n    return arg_1 + arg_2", "path": "latools/helpers/helpers.py", "identifier": "analyte_2_namemass", "docstring": "Converts analytes in format '27Al' to 'Al27'.\n\n    Parameters\n    ----------\n    s : str\n        of format [A-z]{1,3}[0-9]{1,3}\n\n    Returns\n    -------\n    str\n        Name in format [0-9]{1,3}[A-z]{1,3}", "docstring_tokens": ["Converts", "analytes", "in", "format", "27Al", "to", "Al27", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257571}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L1108-L1134", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Calculate the minimum for given expressions, possibly on a grid defined by binby.", "language": "python", "parameters": "(self, expression, binby=[], limits=None, shape=default_shape, selection=False, delay=False, progress=None, edges=False)", "return_statement": "return self._delay(delay, finish(self.minmax(expression, binby=binby, limits=limits, shape=shape, selection=selection, delay=delay, progress=progress)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "[", "]", ",", "arg_3", "=", "None", ",", "arg_4", "=", "arg_5", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "arg_9", "=", "False", ")", ":", "return", "arg_0", ".", "_compute_agg", "(", "'Func'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_9", ",", "arg_8", ")", "@", "delayed", "def", "finish", "(", "arg_10", ")", ":", "return", "arg_10", "[", "...", ",", "0", "]", "return", "arg_0", ".", "_delay", "(", "arg_7", ",", "finish", "(", "arg_0", ".", "Funcmax", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=[], arg_3=None, arg_4=arg_5, arg_6=False, arg_7=False, arg_8=None, arg_9=False):\n        \"\"\"Calculate the Funcimum for given expressions, possibly on a grid defined by binby.\n\n\n        Example:\n\n        >>> df.Func(\"x\")\n        array(-128.293991)\n        >>> df.Func([\"x\", \"y\"])\n        array([-128.293991 ,  -71.5523682])\n        >>> df.Func(\"x\", binby=\"x\", shape=5, limits=[-10, 10])\n        array([-9.99919128, -5.99972439, -1.99991322,  2.0000093 ,  6.0004878 ])\n\n        :param expression: {expression}\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return: {return_stat_scalar}, the last dimension is of shape (2)\n        \"\"\"\n        return arg_0._compute_agg('Func', arg_1, arg_2, arg_3, arg_4, arg_6, arg_7, arg_9, arg_8)\n        @delayed\n        def finish(arg_10):\n            return arg_10[..., 0]\n        return arg_0._delay(arg_7, finish(arg_0.Funcmax(arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_6=arg_6, arg_7=arg_7, arg_8=arg_8)))", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.min", "docstring": "Calculate the minimum for given expressions, possibly on a grid defined by binby.\n\n\n        Example:\n\n        >>> df.min(\"x\")\n        array(-128.293991)\n        >>> df.min([\"x\", \"y\"])\n        array([-128.293991 ,  -71.5523682])\n        >>> df.min(\"x\", binby=\"x\", shape=5, limits=[-10, 10])\n        array([-9.99919128, -5.99972439, -1.99991322,  2.0000093 ,  6.0004878 ])\n\n        :param expression: {expression}\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return: {return_stat_scalar}, the last dimension is of shape (2)", "docstring_tokens": ["Calculate", "the", "minimum", "for", "given", "expressions", "possibly", "on", "a", "grid", "defined", "by", "binby", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257572}
{"url": "https://github.com/kmmbvnr/django-any/blob/6f64ebd05476e2149e2e71deeefbb10f8edfc412/django_any/forms.py#L151-L164", "sha": "6f64ebd05476e2149e2e71deeefbb10f8edfc412", "docstring_summary": "Return random value for DateField", "language": "python", "parameters": "(field, **kwargs)", "return_statement": "return xunit.any_date(from_date=from_date, to_date=to_date).strftime(date_format)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'from_date'", ",", "date", "(", "1990", ",", "1", ",", "1", ")", ")", "arg_3", "=", "arg_1", ".", "get", "(", "'to_date'", ",", "date", ".", "today", "(", ")", ")", "arg_4", "=", "random", ".", "choice", "(", "arg_0", ".", "input_formats", "or", "formats", ".", "get_format", "(", "'DATE_INPUT_FORMATS'", ")", ")", "return", "xunit", ".", "any_date", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ".", "strftime", "(", "arg_4", ")"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"\n    Return random value for DateField\n\n    >>> result = any_form_field(forms.DateField())\n    >>> type(result)\n    <type 'str'>\n    \"\"\"\n    arg_2 = arg_1.get('from_date', date(1990, 1, 1))\n    arg_3 = arg_1.get('to_date', date.today())\n    \n    arg_4 = random.choice(arg_0.input_formats or formats.get_format('DATE_INPUT_FORMATS'))\n                                \n    return xunit.any_date(arg_2=arg_2, arg_3=arg_3).strftime(arg_4)", "path": "django_any/forms.py", "identifier": "date_field_data", "docstring": "Return random value for DateField\n\n    >>> result = any_form_field(forms.DateField())\n    >>> type(result)\n    <type 'str'>", "docstring_tokens": ["Return", "random", "value", "for", "DateField"], "nwo": "kmmbvnr/django-any", "score": 0.18384731799856882, "idx": 257573}
{"url": "https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/cli.py#L27-L30", "sha": "ecc9fd434c23d896ccd1f35795ccc047f946ed05", "docstring_summary": "Converts a comma separated string to a list", "language": "python", "parameters": "(s)", "return_statement": "return list(map(lambda i: i.lstrip(), _list))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "split", "(", "\",\"", ")", "return", "list", "(", "map", "(", "lambda", "i", ":", "i", ".", "lstrip", "(", ")", ",", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Converts a comma separated string to a list\"\"\"\n    arg_1 = arg_0.split(\",\")\n    return list(map(lambda i: i.lstrip(), arg_1))", "path": "parsedmarc/cli.py", "identifier": "_str_to_list", "docstring": "Converts a comma separated string to a list", "docstring_tokens": ["Converts", "a", "comma", "separated", "string", "to", "a", "list"], "nwo": "domainaware/parsedmarc", "score": 0.7452768887820926, "idx": 257574}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/management/commands/send_course_enrollments.py#L131-L147", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get course enrollments for all the learners of given enterprise customer.", "language": "python", "parameters": "(self, enterprise_customer, days)", "return_statement": "return CourseEnrollment.objects.filter(\n            created__gt=datetime.datetime.now() - datetime.timedelta(days=days)\n        ).filter(\n            user_id__in=enterprise_customer.enterprise_customer_users.values_list('user_id', flat=True)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "CourseEnrollment", ".", "objects", ".", "filter", "(", "created__gt", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "-", "datetime", ".", "timedelta", "(", "arg_2", "=", "arg_2", ")", ")", ".", "filter", "(", "user_id__in", "=", "arg_1", ".", "enterprise_customer_users", ".", "values_list", "(", "'user_id'", ",", "flat", "=", "True", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get course enrollments for all the learners of given enterprise customer.\n\n        Arguments:\n            enterprise_customer (EnterpriseCustomer): Include Course enrollments for learners\n                of this enterprise customer.\n            days (int): Include course enrollment of this number of days.\n\n        Returns:\n            (list): A list of CourseEnrollment objects.\n        \"\"\"\n        return CourseEnrollment.objects.filter(\n            created__gt=datetime.datetime.now() - datetime.timedelta(arg_2=arg_2)\n        ).filter(\n            user_id__in=arg_1.enterprise_customer_users.values_list('user_id', flat=True)\n        )", "path": "integrated_channels/xapi/management/commands/send_course_enrollments.py", "identifier": "Command.get_course_enrollments", "docstring": "Get course enrollments for all the learners of given enterprise customer.\n\n        Arguments:\n            enterprise_customer (EnterpriseCustomer): Include Course enrollments for learners\n                of this enterprise customer.\n            days (int): Include course enrollment of this number of days.\n\n        Returns:\n            (list): A list of CourseEnrollment objects.", "docstring_tokens": ["Get", "course", "enrollments", "for", "all", "the", "learners", "of", "given", "enterprise", "customer", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257575}
{"url": "https://github.com/synw/gencharts/blob/fa35604a9445b399bb4f91bc91af488e8e8208fd/gencharts/__init__.py#L114-L124", "sha": "fa35604a9445b399bb4f91bc91af488e8e8208fd", "docstring_summary": "Converts a dictionnary to a pandas dataframe", "language": "python", "parameters": "(self, dictobj, xfield, yfield)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_1", ":", "arg_4", ".", "append", "(", "arg_6", ")", "arg_5", ".", "append", "(", "arg_1", "[", "arg_6", "]", ")", "arg_7", "=", "pd", ".", "DataFrame", "(", "{", "arg_2", "[", "0", "]", ":", "arg_4", ",", "arg_3", "[", "0", "]", ":", "arg_5", "}", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Converts a dictionnary to a pandas dataframe\n        \"\"\"\n        arg_4 = []\n        arg_5 = []\n        for arg_6 in arg_1:\n            arg_4.append(arg_6)\n            arg_5.append(arg_1[arg_6])\n        arg_7 = pd.DataFrame({arg_2[0]: arg_4, arg_3[0]: arg_5})\n        return arg_7", "path": "gencharts/__init__.py", "identifier": "ChartsGenerator._dict_to_df", "docstring": "Converts a dictionnary to a pandas dataframe", "docstring_tokens": ["Converts", "a", "dictionnary", "to", "a", "pandas", "dataframe"], "nwo": "synw/gencharts", "score": 0.12050106452410352, "idx": 257576}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/cornu/__init__.py#L290-L349", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Mark Meyer's code draws elegant CURVETO segments.", "language": "python", "parameters": "(x0, y0, t0, t1, s0, c0, flip, cs, ss, cmd, scale, rot)", "return_statement": "return cmd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ")", ":", "arg_12", "=", "None", "for", "arg_13", "in", "range", "(", "0", ",", "5", ")", ":", "arg_14", "=", "arg_13", "*", ".2", "arg_15", "=", "arg_14", "+", ".2", "arg_16", "=", "arg_2", "+", "arg_14", "*", "(", "arg_3", "-", "arg_2", ")", "arg_17", "=", "arg_2", "+", "arg_15", "*", "(", "arg_3", "-", "arg_2", ")", "arg_18", "=", "(", "arg_17", "-", "arg_16", ")", "*", "arg_10", "if", "not", "arg_12", ":", "arg_12", ",", "arg_19", "=", "eval_cornu", "(", "arg_16", ")", "arg_12", "*=", "arg_6", "arg_12", "-=", "arg_4", "arg_19", "-=", "arg_5", "arg_20", "=", "cos", "(", "pow", "(", "arg_16", ",", "2", ")", "+", "(", "arg_6", "*", "arg_11", ")", ")", "arg_21", "=", "arg_6", "*", "sin", "(", "pow", "(", "arg_16", ",", "2", ")", "+", "(", "arg_6", "*", "arg_11", ")", ")", "arg_22", "=", "(", "(", "arg_19", "*", "arg_7", "-", "arg_12", "*", "arg_8", ")", "+", "arg_0", ")", "arg_23", "=", "(", "(", "arg_12", "*", "arg_7", "+", "arg_19", "*", "arg_8", ")", "+", "arg_1", ")", "arg_24", ",", "arg_25", "=", "eval_cornu", "(", "arg_17", ")", "arg_24", "*=", "arg_6", "arg_24", "-=", "arg_4", "arg_25", "-=", "arg_5", "arg_26", "=", "cos", "(", "pow", "(", "arg_17", ",", "2", ")", "+", "(", "arg_6", "*", "arg_11", ")", ")", "arg_27", "=", "arg_6", "*", "sin", "(", "pow", "(", "arg_17", ",", "2", ")", "+", "(", "arg_6", "*", "arg_11", ")", ")", "arg_28", "=", "(", "(", "arg_25", "*", "arg_7", "-", "arg_24", "*", "arg_8", ")", "+", "arg_0", ")", "arg_29", "=", "(", "(", "arg_24", "*", "arg_7", "+", "arg_25", "*", "arg_8", ")", "+", "arg_1", ")", "arg_30", "=", "(", "arg_22", "+", "(", "(", "arg_18", "/", "3.0", ")", "*", "arg_20", ")", ")", "arg_31", "=", "(", "arg_23", "+", "(", "(", "arg_18", "/", "3.0", ")", "*", "arg_21", ")", ")", "arg_32", "=", "(", "arg_28", "-", "(", "(", "arg_18", "/", "3.0", ")", "*", "arg_26", ")", ")", "arg_33", "=", "(", "arg_29", "-", "(", "(", "arg_18", "/", "3.0", ")", "*", "arg_27", ")", ")", "if", "arg_9", "==", "'moveto'", ":", "print_pt", "(", "arg_22", ",", "arg_23", ",", "arg_9", ")", "arg_9", "=", "'curveto'", "print_crv", "(", "arg_30", ",", "arg_31", ",", "arg_32", ",", "arg_33", ",", "arg_28", ",", "arg_29", ")", "arg_20", ",", "arg_21", "=", "arg_26", ",", "arg_27", "arg_22", ",", "arg_23", "=", "arg_28", ",", "arg_29", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11):\n\n    \"\"\" Mark Meyer's code draws elegant CURVETO segments.\n    \"\"\"\n\n    arg_12 = None\n    for arg_13 in range(0, 5):\n        # travel along the function two points at a time (at time t and t2)\n        # the first time through we'll need to get both points\n        # after that we only need the second point because the old second point\n        # becomes the new first point\n        arg_14 = arg_13 * .2\n        arg_15 = arg_14+ .2\n        \n        arg_16 = arg_2 + arg_14 * (arg_3 - arg_2)\n        arg_17 = arg_2 + arg_15 * (arg_3 - arg_2)\n        arg_18 = (arg_17 - arg_16) * arg_10\n        \n        if not arg_12:\n            # get first point\n            # avoid calling this again: the next time though x,y will equal x3, y3\n            arg_12, arg_19 = eval_cornu(arg_16)\n            arg_12 *= arg_6\n            arg_12 -= arg_4\n            arg_19 -= arg_5\n            # calculate derivative of fresnel function at point to get tangent slope\n            # just take the integrand of the fresnel function\n            arg_20 =  cos(pow(arg_16, 2) + (arg_6 * arg_11))  \n            arg_21 =  arg_6 * sin(pow(arg_16, 2) + (arg_6 *arg_11))\n            # x,y = first point on function\n            arg_22 = ((arg_19 * arg_7 - arg_12 * arg_8) +arg_0)\n            arg_23 = ((arg_12 * arg_7 + arg_19 * arg_8) + arg_1)\n\n        #evaluate the fresnel further along the function to look ahead to the next point\n        arg_24,arg_25 = eval_cornu(arg_17) \n        arg_24 *= arg_6\n        arg_24 -= arg_4\n        arg_25 -= arg_5\n\n        arg_26 = cos(pow(arg_17, 2) + (arg_6 * arg_11)) \n        arg_27 = arg_6 * sin(pow(arg_17, 2) + (arg_6 * arg_11))\n        # x3, y3 = second point on function\n        arg_28 = ((arg_25 * arg_7 - arg_24 * arg_8)+arg_0)\n        arg_29 = ((arg_24 * arg_7 + arg_25 * arg_8)+arg_1)\n\n        # calculate control points\n        arg_30 = (arg_22 + ((arg_18/3.0) * arg_20))\n        arg_31 = (arg_23 + ((arg_18/3.0) * arg_21))   \n        arg_32 = (arg_28 - ((arg_18/3.0) * arg_26))\n        arg_33 = (arg_29 - ((arg_18/3.0) * arg_27))\n\n        if arg_9 == 'moveto':\n            print_pt(arg_22, arg_23, arg_9)\n            arg_9 = 'curveto'\n        print_crv(arg_30, arg_31, arg_32, arg_33, arg_28, arg_29)\n                    \n        arg_20, arg_21 = arg_26, arg_27\n        arg_22,arg_23 = arg_28, arg_29\n        \n    return arg_9", "path": "lib/cornu/__init__.py", "identifier": "draw_cornu_bezier", "docstring": "Mark Meyer's code draws elegant CURVETO segments.", "docstring_tokens": ["Mark", "Meyer", "s", "code", "draws", "elegant", "CURVETO", "segments", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257577}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/dataset/mnist.py#L77-L121", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Parse or download mnist data if train_dir is empty.", "language": "python", "parameters": "(train_dir, data_type=\"train\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"train\"", ")", ":", "arg_2", "=", "'train-images-idx3-ubyte.gz'", "arg_3", "=", "'train-labels-idx1-ubyte.gz'", "arg_4", "=", "'t10k-images-idx3-ubyte.gz'", "arg_5", "=", "'t10k-labels-idx1-ubyte.gz'", "if", "arg_1", "==", "\"train\"", ":", "arg_6", "=", "base", ".", "maybe_download", "(", "arg_2", ",", "arg_0", ",", "SOURCE_URL", "+", "arg_2", ")", "with", "open", "(", "arg_6", ",", "'rb'", ")", "as", "f", ":", "arg_7", "=", "extract_images", "(", "f", ")", "arg_6", "=", "base", ".", "maybe_download", "(", "arg_3", ",", "arg_0", ",", "SOURCE_URL", "+", "arg_3", ")", "with", "open", "(", "arg_6", ",", "'rb'", ")", "as", "f", ":", "arg_8", "=", "extract_labels", "(", "f", ")", "return", "arg_7", ",", "arg_8", "else", ":", "arg_6", "=", "base", ".", "maybe_download", "(", "arg_4", ",", "arg_0", ",", "SOURCE_URL", "+", "arg_4", ")", "with", "open", "(", "arg_6", ",", "'rb'", ")", "as", "f", ":", "arg_9", "=", "extract_images", "(", "f", ")", "arg_6", "=", "base", ".", "maybe_download", "(", "arg_5", ",", "arg_0", ",", "SOURCE_URL", "+", "arg_5", ")", "with", "open", "(", "arg_6", ",", "'rb'", ")", "as", "f", ":", "arg_10", "=", "extract_labels", "(", "f", ")", "return", "arg_9", ",", "arg_10"], "function": "def Func(arg_0, arg_1=\"train\"):\n    \"\"\"\n    Parse or download mnist data if train_dir is empty.\n\n    :param: train_dir: The directory storing the mnist data\n\n    :param: data_type: Reading training set or testing set.It can be either \"train\" or \"test\"\n\n    :return:\n\n    ```\n    (ndarray, ndarray) representing (features, labels)\n    features is a 4D unit8 numpy array [index, y, x, depth] representing each pixel valued from 0 to 255.\n    labels is 1D unit8 nunpy array representing the label valued from 0 to 9.\n    ```\n\n    \"\"\"\n    arg_2 = 'train-images-idx3-ubyte.gz'\n    arg_3 = 'train-labels-idx1-ubyte.gz'\n    arg_4 = 't10k-images-idx3-ubyte.gz'\n    arg_5 = 't10k-labels-idx1-ubyte.gz'\n\n    if arg_1 == \"train\":\n        arg_6 = base.maybe_download(arg_2, arg_0,\n                                         SOURCE_URL + arg_2)\n        with open(arg_6, 'rb') as f:\n            arg_7 = extract_images(f)\n\n        arg_6 = base.maybe_download(arg_3, arg_0,\n                                         SOURCE_URL + arg_3)\n        with open(arg_6, 'rb') as f:\n            arg_8 = extract_labels(f)\n        return arg_7, arg_8\n\n    else:\n        arg_6 = base.maybe_download(arg_4, arg_0,\n                                         SOURCE_URL + arg_4)\n        with open(arg_6, 'rb') as f:\n            arg_9 = extract_images(f)\n\n        arg_6 = base.maybe_download(arg_5, arg_0,\n                                         SOURCE_URL + arg_5)\n        with open(arg_6, 'rb') as f:\n            arg_10 = extract_labels(f)\n        return arg_9, arg_10", "path": "pyspark/bigdl/dataset/mnist.py", "identifier": "read_data_sets", "docstring": "Parse or download mnist data if train_dir is empty.\n\n    :param: train_dir: The directory storing the mnist data\n\n    :param: data_type: Reading training set or testing set.It can be either \"train\" or \"test\"\n\n    :return:\n\n    ```\n    (ndarray, ndarray) representing (features, labels)\n    features is a 4D unit8 numpy array [index, y, x, depth] representing each pixel valued from 0 to 255.\n    labels is 1D unit8 nunpy array representing the label valued from 0 to 9.\n    ```", "docstring_tokens": ["Parse", "or", "download", "mnist", "data", "if", "train_dir", "is", "empty", "."], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 257578}
{"url": "https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/percolate.py#L575-L635", "sha": "92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac", "docstring_summary": "Compute the average size of the largest cluster", "language": "python", "parameters": "(max_cluster_size, alpha)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "arg_3", "=", "arg_0", ".", "size", "arg_4", "=", "np", ".", "sqrt", "(", "arg_3", ")", "arg_5", "=", "arg_0", ".", "mean", "(", ")", "arg_2", "[", "'max_cluster_size'", "]", "=", "arg_5", "arg_6", "=", "arg_0", ".", "std", "(", "ddof", "=", "1", ")", "if", "arg_6", ":", "arg_7", "=", "np", ".", "seterr", "(", "all", "=", "'raise'", ")", "arg_2", "[", "'max_cluster_size_ci'", "]", "=", "scipy", ".", "stats", ".", "t", ".", "interval", "(", "1", "-", "arg_1", ",", "df", "=", "arg_3", "-", "1", ",", "loc", "=", "arg_5", ",", "scale", "=", "arg_6", "/", "arg_4", ")", "np", ".", "seterr", "(", "**", "arg_7", ")", "else", ":", "arg_2", "[", "'max_cluster_size_ci'", "]", "=", "(", "arg_5", "*", "np", ".", "ones", "(", "2", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Compute the average size of the largest cluster\n\n    Helper function for :func:`microcanonical_averages`\n\n    Parameters\n    ----------\n\n    max_cluster_size : 1-D :py:class:`numpy.ndarray` of int\n        Each entry is the ``max_cluster_size`` field of the output of\n        :func:`sample_states`:\n        The size of the largest cluster (absolute number of sites).\n\n    alpha: float\n        Significance level.\n\n    Returns\n    -------\n\n    ret : dict\n        Largest cluster statistics\n\n    ret['max_cluster_size'] : float\n        Average size of the largest cluster (absolute number of sites)\n\n    ret['max_cluster_size_ci'] : 1-D :py:class:`numpy.ndarray` of float, size 2\n        Lower and upper bounds of the normal confidence interval of the average\n        size of the largest cluster (absolute number of sites)\n\n    See Also\n    --------\n\n    sample_states : largest cluster detection\n\n    microcanonical_averages : largest cluster statistics\n    \"\"\"\n\n    arg_2 = dict()\n    arg_3 = arg_0.size\n    arg_4 = np.sqrt(arg_3)\n\n    arg_5 = arg_0.mean()\n    arg_2['max_cluster_size'] = arg_5\n\n    arg_6 = arg_0.std(ddof=1)\n    if arg_6:\n        arg_7 = np.seterr(all='raise')\n        arg_2['max_cluster_size_ci'] = scipy.stats.t.interval(\n            1 - arg_1,\n            df=arg_3 - 1,\n            loc=arg_5,\n            scale=arg_6 / arg_4\n        )\n        np.seterr(**arg_7)\n    else:\n        arg_2['max_cluster_size_ci'] = (\n            arg_5 * np.ones(2)\n        )\n\n    return arg_2", "path": "percolate/percolate.py", "identifier": "_microcanonical_average_max_cluster_size", "docstring": "Compute the average size of the largest cluster\n\n    Helper function for :func:`microcanonical_averages`\n\n    Parameters\n    ----------\n\n    max_cluster_size : 1-D :py:class:`numpy.ndarray` of int\n        Each entry is the ``max_cluster_size`` field of the output of\n        :func:`sample_states`:\n        The size of the largest cluster (absolute number of sites).\n\n    alpha: float\n        Significance level.\n\n    Returns\n    -------\n\n    ret : dict\n        Largest cluster statistics\n\n    ret['max_cluster_size'] : float\n        Average size of the largest cluster (absolute number of sites)\n\n    ret['max_cluster_size_ci'] : 1-D :py:class:`numpy.ndarray` of float, size 2\n        Lower and upper bounds of the normal confidence interval of the average\n        size of the largest cluster (absolute number of sites)\n\n    See Also\n    --------\n\n    sample_states : largest cluster detection\n\n    microcanonical_averages : largest cluster statistics", "docstring_tokens": ["Compute", "the", "average", "size", "of", "the", "largest", "cluster"], "nwo": "andsor/pypercolate", "score": 0.27946077266739355, "idx": 257579}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/commands/sample_pulse.py#L43-L59", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Plot the interpolated envelope of pulse.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return pulse_drawer(self._samples, self.duration, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "from", "qiskit", ".", "tools", ".", "visualization", "import", "pulse_Funcer", "return", "pulse_Funcer", "(", "arg_0", ".", "_samples", ",", "arg_0", ".", "duration", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Plot the interpolated envelope of pulse.\n\n        Keyword Args:\n            dt (float): Time interval of samples.\n            interp_method (str): Method of interpolation\n                (set `None` for turn off the interpolation).\n            filename (str): Name required to save pulse image.\n            interactive (bool): When set true show the circuit in a new window\n                (this depends on the matplotlib backend being used supporting this).\n            dpi (int): Resolution of saved image.\n            nop (int): Data points for interpolation.\n            size (tuple): Size of figure.\n        \"\"\"\n        from qiskit.tools.visualization import pulse_Funcer\n\n        return pulse_Funcer(arg_0._samples, arg_0.duration, **arg_1)", "path": "qiskit/pulse/commands/sample_pulse.py", "identifier": "SamplePulse.draw", "docstring": "Plot the interpolated envelope of pulse.\n\n        Keyword Args:\n            dt (float): Time interval of samples.\n            interp_method (str): Method of interpolation\n                (set `None` for turn off the interpolation).\n            filename (str): Name required to save pulse image.\n            interactive (bool): When set true show the circuit in a new window\n                (this depends on the matplotlib backend being used supporting this).\n            dpi (int): Resolution of saved image.\n            nop (int): Data points for interpolation.\n            size (tuple): Size of figure.", "docstring_tokens": ["Plot", "the", "interpolated", "envelope", "of", "pulse", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257580}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/design_analysis.py#L487-L495", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "increments the branches counter and checks boolean expressions", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_check_boolean_expressions", "(", "arg_1", ")", "arg_2", "=", "1", "if", "arg_1", ".", "orelse", "and", "(", "len", "(", "arg_1", ".", "orelse", ")", ">", "1", "or", "not", "isinstance", "(", "arg_1", ".", "orelse", "[", "0", "]", ",", "If", ")", ")", ":", "arg_2", "+=", "1", "arg_0", ".", "_inc_branch", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_inc_all_stmts", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"increments the branches counter and checks boolean expressions\"\"\"\n        arg_0._check_boolean_expressions(arg_1)\n        arg_2 = 1\n        # don't double count If nodes coming from some 'elif'\n        if arg_1.orelse and (len(arg_1.orelse) > 1 or not isinstance(arg_1.orelse[0], If)):\n            arg_2 += 1\n        arg_0._inc_branch(arg_1, arg_2)\n        arg_0._inc_all_stmts(arg_2)", "path": "pylint/checkers/design_analysis.py", "identifier": "MisdesignChecker.visit_if", "docstring": "increments the branches counter and checks boolean expressions", "docstring_tokens": ["increments", "the", "branches", "counter", "and", "checks", "boolean", "expressions"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257581}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/shell/src/python/utils.py#L155-L166", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Pipes output of prev_proc into to_cmd.\n  Returns piped process", "language": "python", "parameters": "(prev_proc, to_cmd)", "return_statement": "return process", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "if", "arg_0", "is", "None", "else", "arg_0", ".", "stdout", "arg_3", "=", "subprocess", ".", "Popen", "(", "arg_1", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", "is", "not", "None", ":", "arg_0", ".", "stdout", ".", "close", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n  \"\"\"\n  Pipes output of prev_proc into to_cmd.\n  Returns Funcd process\n  \"\"\"\n  arg_2 = None if arg_0 is None else arg_0.stdout\n  arg_3 = subprocess.Popen(arg_1,\n                             stdout=subprocess.PIPE,\n                             arg_2=arg_2)\n  if arg_0 is not None:\n    arg_0.stdout.close() # Allow prev_proc to receive a SIGPIPE\n  return arg_3", "path": "heron/shell/src/python/utils.py", "identifier": "pipe", "docstring": "Pipes output of prev_proc into to_cmd.\n  Returns piped process", "docstring_tokens": ["Pipes", "output", "of", "prev_proc", "into", "to_cmd", ".", "Returns", "piped", "process"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257582}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1061-L1070", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Change names of all columns in the frame.", "language": "python", "parameters": "(self, names)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert_is_type", "(", "arg_1", ",", "[", "str", "]", ")", "assert_satisfies", "(", "arg_1", ",", "len", "(", "arg_1", ")", "==", "arg_0", ".", "ncol", ")", "arg_0", ".", "_ex", "=", "ExprNode", "(", "\"colnames=\"", ",", "arg_0", ",", "range", "(", "arg_0", ".", "ncol", ")", ",", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Change names of all columns in the frame.\n\n        :param List[str] names: The list of new names for every column in the frame.\n        \"\"\"\n        assert_is_type(arg_1, [str])\n        assert_satisfies(arg_1, len(arg_1) == arg_0.ncol)\n        arg_0._ex = ExprNode(\"colnames=\", arg_0, range(arg_0.ncol), arg_1)  # Update-in-place, but still lazy\n        return arg_0", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.set_names", "docstring": "Change names of all columns in the frame.\n\n        :param List[str] names: The list of new names for every column in the frame.", "docstring_tokens": ["Change", "names", "of", "all", "columns", "in", "the", "frame", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257583}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L1170-L1239", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Add echoing to the audio.", "language": "python", "parameters": "(self, gain_in=0.8, gain_out=0.9, n_echos=1, delays=[60],\n             decays=[0.4])", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.8", ",", "arg_2", "=", "0.9", ",", "arg_3", "=", "1", ",", "arg_4", "=", "[", "60", "]", ",", "arg_5", "=", "[", "0.4", "]", ")", ":", "if", "not", "is_number", "(", "arg_1", ")", "or", "arg_1", "<=", "0", "or", "arg_1", ">", "1", ":", "raise", "ValueError", "(", "\"gain_in must be a number between 0 and 1.\"", ")", "if", "not", "is_number", "(", "arg_2", ")", "or", "arg_2", "<=", "0", "or", "arg_2", ">", "1", ":", "raise", "ValueError", "(", "\"gain_out must be a number between 0 and 1.\"", ")", "if", "not", "isinstance", "(", "arg_3", ",", "int", ")", "or", "arg_3", "<=", "0", ":", "raise", "ValueError", "(", "\"n_Funcs must be a positive integer.\"", ")", "if", "not", "isinstance", "(", "arg_4", ",", "list", ")", ":", "raise", "ValueError", "(", "\"delays must be a list\"", ")", "if", "len", "(", "arg_4", ")", "!=", "arg_3", ":", "raise", "ValueError", "(", "\"the length of delays must equal n_Funcs\"", ")", "if", "any", "(", "(", "not", "is_number", "(", "arg_6", ")", "or", "arg_6", "<=", "0", ")", "for", "arg_6", "in", "arg_4", ")", ":", "raise", "ValueError", "(", "\"the elements of delays must be numbers > 0\"", ")", "if", "not", "isinstance", "(", "arg_5", ",", "list", ")", ":", "raise", "ValueError", "(", "\"decays must be a list\"", ")", "if", "len", "(", "arg_5", ")", "!=", "arg_3", ":", "raise", "ValueError", "(", "\"the length of decays must equal n_Funcs\"", ")", "if", "any", "(", "(", "not", "is_number", "(", "arg_6", ")", "or", "arg_6", "<=", "0", "or", "arg_6", ">", "1", ")", "for", "arg_6", "in", "arg_5", ")", ":", "raise", "ValueError", "(", "\"the elements of decays must be between 0 and 1\"", ")", "arg_7", "=", "[", "'Func'", ",", "'{:f}'", ".", "format", "(", "arg_1", ")", ",", "'{:f}'", ".", "format", "(", "arg_2", ")", "]", "for", "arg_8", "in", "range", "(", "arg_3", ")", ":", "arg_7", ".", "extend", "(", "[", "'{}'", ".", "format", "(", "arg_4", "[", "arg_8", "]", ")", ",", "'{}'", ".", "format", "(", "arg_5", "[", "arg_8", "]", ")", "]", ")", "arg_0", ".", "effects", ".", "extend", "(", "arg_7", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=0.8, arg_2=0.9, arg_3=1, arg_4=[60],\n             arg_5=[0.4]):\n        '''Add Funcing to the audio.\n\n        Echoes are reflected sound and can occur naturally amongst mountains\n        (and sometimes large buildings) when talking or shouting; digital Func\n        effects emulate this behav- iour and are often used to help fill out\n        the sound of a single instrument or vocal. The time differ- ence\n        between the original signal and the reflection is the 'delay' (time),\n        and the loudness of the reflected signal is the 'decay'. Multiple\n        Funces can have different delays and decays.\n\n        Parameters\n        ----------\n        gain_in : float, default=0.8\n            Input volume, between 0 and 1\n        gain_out : float, default=0.9\n            Output volume, between 0 and 1\n        n_Funcs : int, default=1\n            Number of reflections\n        delays : list, default=[60]\n            List of delays in miliseconds\n        decays : list, default=[0.4]\n            List of decays, relative to gain in between 0 and 1\n\n        See Also\n        --------\n        Funcs, reverb, chorus\n        '''\n        if not is_number(arg_1) or arg_1 <= 0 or arg_1 > 1:\n            raise ValueError(\"gain_in must be a number between 0 and 1.\")\n\n        if not is_number(arg_2) or arg_2 <= 0 or arg_2 > 1:\n            raise ValueError(\"gain_out must be a number between 0 and 1.\")\n\n        if not isinstance(arg_3, int) or arg_3 <= 0:\n            raise ValueError(\"n_Funcs must be a positive integer.\")\n\n        # validate delays\n        if not isinstance(arg_4, list):\n            raise ValueError(\"delays must be a list\")\n\n        if len(arg_4) != arg_3:\n            raise ValueError(\"the length of delays must equal n_Funcs\")\n\n        if any((not is_number(arg_6) or arg_6 <= 0) for arg_6 in arg_4):\n            raise ValueError(\"the elements of delays must be numbers > 0\")\n\n        # validate decays\n        if not isinstance(arg_5, list):\n            raise ValueError(\"decays must be a list\")\n\n        if len(arg_5) != arg_3:\n            raise ValueError(\"the length of decays must equal n_Funcs\")\n        if any((not is_number(arg_6) or arg_6 <= 0 or arg_6 > 1) for arg_6 in arg_5):\n            raise ValueError(\n                \"the elements of decays must be between 0 and 1\"\n            )\n\n        arg_7 = ['Func', '{:f}'.format(arg_1), '{:f}'.format(arg_2)]\n\n        for arg_8 in range(arg_3):\n            arg_7.extend([\n                '{}'.format(arg_4[arg_8]),\n                '{}'.format(arg_5[arg_8])\n            ])\n\n        arg_0.effects.extend(arg_7)\n        arg_0.effects_log.append('Func')\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.echo", "docstring": "Add echoing to the audio.\n\n        Echoes are reflected sound and can occur naturally amongst mountains\n        (and sometimes large buildings) when talking or shouting; digital echo\n        effects emulate this behav- iour and are often used to help fill out\n        the sound of a single instrument or vocal. The time differ- ence\n        between the original signal and the reflection is the 'delay' (time),\n        and the loudness of the reflected signal is the 'decay'. Multiple\n        echoes can have different delays and decays.\n\n        Parameters\n        ----------\n        gain_in : float, default=0.8\n            Input volume, between 0 and 1\n        gain_out : float, default=0.9\n            Output volume, between 0 and 1\n        n_echos : int, default=1\n            Number of reflections\n        delays : list, default=[60]\n            List of delays in miliseconds\n        decays : list, default=[0.4]\n            List of decays, relative to gain in between 0 and 1\n\n        See Also\n        --------\n        echos, reverb, chorus", "docstring_tokens": ["Add", "echoing", "to", "the", "audio", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 257584}
{"url": "https://github.com/jonathanj/txspinneret/blob/717008a2c313698984a23e3f3fc62ea3675ed02d/txspinneret/resource.py#L221-L238", "sha": "717008a2c313698984a23e3f3fc62ea3675ed02d", "docstring_summary": "Negotiate a handler based on the content types acceptable to the\n        client.", "language": "python", "parameters": "(self, request)", "return_statement": "return NotAcceptable(), None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_parseAccept", "(", "arg_1", ".", "requestHeaders", ".", "getRawHeaders", "(", "'Accept'", ")", ")", "for", "arg_3", "in", "arg_2", ".", "keys", "(", ")", ":", "arg_4", "=", "arg_0", ".", "_acceptHandlers", ".", "get", "(", "arg_3", ".", "lower", "(", ")", ")", "if", "arg_4", "is", "not", "None", ":", "return", "arg_4", ",", "arg_4", ".", "contentType", "if", "arg_0", ".", "_fallback", ":", "arg_4", "=", "arg_0", ".", "_handlers", "[", "0", "]", "return", "arg_4", ",", "arg_4", ".", "contentType", "return", "NotAcceptable", "(", ")", ",", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Negotiate a handler based on the content types acceptable to the\n        client.\n\n        :rtype: 2-`tuple` of `twisted.web.iweb.IResource` and `bytes`\n        :return: Pair of a resource and the content type.\n        \"\"\"\n        arg_2 = _parseAccept(arg_1.requestHeaders.getRawHeaders('Accept'))\n        for arg_3 in arg_2.keys():\n            arg_4 = arg_0._acceptHandlers.get(arg_3.lower())\n            if arg_4 is not None:\n                return arg_4, arg_4.contentType\n\n        if arg_0._fallback:\n            arg_4 = arg_0._handlers[0]\n            return arg_4, arg_4.contentType\n        return NotAcceptable(), None", "path": "txspinneret/resource.py", "identifier": "ContentTypeNegotiator._negotiateHandler", "docstring": "Negotiate a handler based on the content types acceptable to the\n        client.\n\n        :rtype: 2-`tuple` of `twisted.web.iweb.IResource` and `bytes`\n        :return: Pair of a resource and the content type.", "docstring_tokens": ["Negotiate", "a", "handler", "based", "on", "the", "content", "types", "acceptable", "to", "the", "client", "."], "nwo": "jonathanj/txspinneret", "score": 0.08529914490135834, "idx": 257585}
{"url": "https://github.com/JonathanRaiman/ciseau/blob/f72d1c82d85eeb3d3ac9fac17690041725402175/ciseau/wiki_markup_processing.py#L143-L175", "sha": "f72d1c82d85eeb3d3ac9fac17690041725402175", "docstring_summary": "A generator to convert raw text segments, with xml, and other\n    non-textual content to a list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization.", "language": "python", "parameters": "(text, keep_whitespace=False, normalize_ascii=True)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", "arg_3", "=", "_remove_urls", "(", "arg_0", ")", "arg_3", "=", "_remove_mvar", "(", "arg_3", ")", "arg_3", "=", "_remove_squiggly_bracket", "(", "arg_3", ")", "arg_3", "=", "_remove_table", "(", "arg_3", ")", "arg_3", "=", "_remove_brackets", "(", "arg_3", ")", "arg_3", "=", "remove_remaining_double_brackets", "(", "arg_3", ")", "arg_3", "=", "remove_markup", "(", "arg_3", ")", "arg_3", "=", "remove_wikipedia_link", ".", "sub", "(", "anchor_replacer", ",", "arg_3", ")", "arg_3", "=", "remove_bullets_nbsps", ".", "sub", "(", "empty_space", ",", "arg_3", ")", "arg_3", "=", "remove_dates", "(", "arg_3", ")", "arg_3", "=", "remove_math_sections", "(", "arg_3", ")", "arg_3", "=", "remove_html", "(", "arg_3", ")", "arg_3", "=", "sent_tokenize", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n    \"\"\"\n    A generator to convert raw text segments, with xml, and other\n    non-textual content to a list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization.\n\n    Arguments\n    ---------\n       text: str, input text to tokenize, strip of markup.\n       keep_whitespace : bool, should the output retain the\n          whitespace of the input (so that char offsets in the\n          output correspond to those in the input).\n\n    Returns\n    -------\n        generator<list<list<str>>>, a generator for sentences, with\n            within each sentence a list of the words separated.\n    \"\"\"\n    arg_3 = arg_0\n    arg_3 = _remove_urls(arg_0)\n    arg_3 = _remove_mvar(arg_3)\n    arg_3 = _remove_squiggly_bracket(arg_3)\n    arg_3 = _remove_table(arg_3)\n    arg_3 = _remove_brackets(arg_3)\n    arg_3 = remove_remaining_double_brackets(arg_3)\n    arg_3 = remove_markup(arg_3)\n    arg_3 = remove_wikipedia_link.sub(anchor_replacer, arg_3)\n    arg_3 = remove_bullets_nbsps.sub(empty_space, arg_3)\n    arg_3 = remove_dates(arg_3)\n    arg_3 = remove_math_sections(arg_3)\n    arg_3 = remove_html(arg_3)\n    arg_3 = sent_tokenize(arg_3, arg_1, arg_2)\n    return arg_3", "path": "ciseau/wiki_markup_processing.py", "identifier": "to_raw_text", "docstring": "A generator to convert raw text segments, with xml, and other\n    non-textual content to a list of words without any markup.\n    Additionally dates are replaced by `7777` for normalization.\n\n    Arguments\n    ---------\n       text: str, input text to tokenize, strip of markup.\n       keep_whitespace : bool, should the output retain the\n          whitespace of the input (so that char offsets in the\n          output correspond to those in the input).\n\n    Returns\n    -------\n        generator<list<list<str>>>, a generator for sentences, with\n            within each sentence a list of the words separated.", "docstring_tokens": ["A", "generator", "to", "convert", "raw", "text", "segments", "with", "xml", "and", "other", "non", "-", "textual", "content", "to", "a", "list", "of", "words", "without", "any", "markup", ".", "Additionally", "dates", "are", "replaced", "by", "7777", "for", "normalization", "."], "nwo": "JonathanRaiman/ciseau", "score": 0.2836741237679313, "idx": 257586}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L90-L168", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates new instance.", "language": "python", "parameters": "(self,\n                        instance_id,\n                        main_cluster_id,\n                        main_cluster_zone,\n                        project_id=None,\n                        replica_cluster_id=None,\n                        replica_cluster_zone=None,\n                        instance_display_name=None,\n                        instance_type=enums.Instance.Type.TYPE_UNSPECIFIED,\n                        instance_labels=None,\n                        cluster_nodes=None,\n                        cluster_storage_type=enums.StorageType.STORAGE_TYPE_UNSPECIFIED,\n                        timeout=None)", "return_statement": "return instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "arg_9", ".", "Instance", ".", "Type", ".", "TYPE_UNSPECIFIED", ",", "arg_13", "=", "None", ",", "arg_14", "=", "None", ",", "arg_15", "=", "arg_9", ".", "StorageType", ".", "STORAGE_TYPE_UNSPECIFIED", ",", "arg_18", "=", "None", ")", ":", "arg_15", "=", "arg_9", ".", "StorageType", "(", "arg_15", ")", "arg_8", "=", "arg_9", ".", "Instance", ".", "Type", "(", "arg_8", ")", "arg_19", "=", "arg_10", "(", "arg_1", ",", "arg_0", ".", "_get_client", "(", "arg_4", "=", "arg_4", ")", ",", "arg_7", ",", "arg_8", ",", "arg_13", ",", ")", "arg_20", "=", "[", "arg_19", ".", "cluster", "(", "arg_2", ",", "arg_3", ",", "arg_14", ",", "arg_15", ")", "]", "if", "arg_5", "and", "arg_6", ":", "arg_20", ".", "append", "(", "arg_19", ".", "cluster", "(", "arg_5", ",", "arg_6", ",", "arg_14", ",", "arg_15", ")", ")", "arg_21", "=", "arg_19", ".", "create", "(", "arg_20", "=", "arg_20", ")", "arg_21", ".", "result", "(", "arg_18", ")", "return", "arg_19"], "function": "def Func(arg_0,\n                        arg_1,\n                        arg_2,\n                        arg_3,\n                        arg_4=None,\n                        arg_5=None,\n                        arg_6=None,\n                        arg_7=None,\n                        arg_8=arg_9.Instance.Type.TYPE_UNSPECIFIED,\n                        arg_13=None,\n                        arg_14=None,\n                        arg_15=arg_9.StorageType.STORAGE_TYPE_UNSPECIFIED,\n                        arg_18=None):\n        \"\"\"\n        Creates new instance.\n\n        :type instance_id: str\n        :param instance_id: The ID for the new instance.\n        :type main_cluster_id: str\n        :param main_cluster_id: The ID for main cluster for the new instance.\n        :type main_cluster_zone: str\n        :param main_cluster_zone: The zone for main cluster.\n            See https://cloud.google.com/bigtable/docs/locations for more details.\n        :type project_id: str\n        :param project_id: Optional, Google Cloud Platform project ID where the\n            BigTable exists. If set to None or missing,\n            the default project_id from the GCP connection is used.\n        :type replica_cluster_id: str\n        :param replica_cluster_id: (optional) The ID for replica cluster for the new\n            instance.\n        :type replica_cluster_zone: str\n        :param replica_cluster_zone: (optional)  The zone for replica cluster.\n        :type instance_type: enums.Instance.Type\n        :param instance_type: (optional) The type of the instance.\n        :type instance_display_name: str\n        :param instance_display_name: (optional) Human-readable name of the instance.\n                Defaults to ``instance_id``.\n        :type instance_labels: dict\n        :param instance_labels: (optional) Dictionary of labels to associate with the\n            instance.\n        :type cluster_nodes: int\n        :param cluster_nodes: (optional) Number of nodes for cluster.\n        :type cluster_storage_type: enums.StorageType\n        :param cluster_storage_type: (optional) The type of storage.\n        :type timeout: int\n        :param timeout: (optional) timeout (in seconds) for instance creation.\n                        If None is not specified, Operator will wait indefinitely.\n        \"\"\"\n        arg_15 = arg_9.StorageType(arg_15)\n        arg_8 = arg_9.Instance.Type(arg_8)\n\n        arg_19 = arg_10(\n            arg_1,\n            arg_0._get_client(arg_4=arg_4),\n            arg_7,\n            arg_8,\n            arg_13,\n        )\n\n        arg_20 = [\n            arg_19.cluster(\n                arg_2,\n                arg_3,\n                arg_14,\n                arg_15\n            )\n        ]\n        if arg_5 and arg_6:\n            arg_20.append(arg_19.cluster(\n                arg_5,\n                arg_6,\n                arg_14,\n                arg_15\n            ))\n        arg_21 = arg_19.create(\n            arg_20=arg_20\n        )\n        arg_21.result(arg_18)\n        return arg_19", "path": "airflow/contrib/hooks/gcp_bigtable_hook.py", "identifier": "BigtableHook.create_instance", "docstring": "Creates new instance.\n\n        :type instance_id: str\n        :param instance_id: The ID for the new instance.\n        :type main_cluster_id: str\n        :param main_cluster_id: The ID for main cluster for the new instance.\n        :type main_cluster_zone: str\n        :param main_cluster_zone: The zone for main cluster.\n            See https://cloud.google.com/bigtable/docs/locations for more details.\n        :type project_id: str\n        :param project_id: Optional, Google Cloud Platform project ID where the\n            BigTable exists. If set to None or missing,\n            the default project_id from the GCP connection is used.\n        :type replica_cluster_id: str\n        :param replica_cluster_id: (optional) The ID for replica cluster for the new\n            instance.\n        :type replica_cluster_zone: str\n        :param replica_cluster_zone: (optional)  The zone for replica cluster.\n        :type instance_type: enums.Instance.Type\n        :param instance_type: (optional) The type of the instance.\n        :type instance_display_name: str\n        :param instance_display_name: (optional) Human-readable name of the instance.\n                Defaults to ``instance_id``.\n        :type instance_labels: dict\n        :param instance_labels: (optional) Dictionary of labels to associate with the\n            instance.\n        :type cluster_nodes: int\n        :param cluster_nodes: (optional) Number of nodes for cluster.\n        :type cluster_storage_type: enums.StorageType\n        :param cluster_storage_type: (optional) The type of storage.\n        :type timeout: int\n        :param timeout: (optional) timeout (in seconds) for instance creation.\n                        If None is not specified, Operator will wait indefinitely.", "docstring_tokens": ["Creates", "new", "instance", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257587}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/von_mises_fisher.py#L358-L385", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Specialized inversion sampler for 3D.", "language": "python", "parameters": "(self, n, seed=None)", "return_statement": "return u[..., tf.newaxis]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_2", "=", "seed_stream", ".", "SeedStream", "(", "arg_2", ",", "salt", "=", "'von_mises_fisher_3d'", ")", "arg_3", "=", "tf", ".", "concat", "(", "[", "[", "arg_1", "]", ",", "arg_0", ".", "_batch_shape_tensor", "(", ")", "]", ",", "axis", "=", "0", ")", "arg_4", "=", "tf", ".", "random", ".", "uniform", "(", "arg_3", ",", "arg_2", "=", "arg_2", "(", ")", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_5", "=", "tf", ".", "where", "(", "arg_0", ".", "concentration", ">", "0", ",", "arg_0", ".", "concentration", ",", "tf", ".", "ones_like", "(", "arg_0", ".", "concentration", ")", ")", "arg_6", "=", "tf", ".", "where", "(", "arg_4", ">", "0", ",", "arg_4", ",", "tf", ".", "ones_like", "(", "arg_4", ")", ")", "arg_7", "=", "1", "+", "tf", ".", "reduce_logsumexp", "(", "input_tensor", "=", "[", "tf", ".", "math", ".", "log", "(", "arg_6", ")", ",", "tf", ".", "math", ".", "log1p", "(", "-", "arg_6", ")", "-", "2", "*", "arg_5", "]", ",", "axis", "=", "0", ")", "/", "arg_5", "arg_8", "=", "tf", ".", "where", "(", "arg_0", ".", "concentration", ">", "tf", ".", "zeros_like", "(", "arg_7", ")", ",", "arg_7", ",", "2", "*", "arg_4", "-", "1", ")", "arg_8", "=", "tf", ".", "where", "(", "tf", ".", "equal", "(", "arg_4", ",", "0", ")", ",", "-", "tf", ".", "ones_like", "(", "arg_8", ")", ",", "arg_8", ")", "if", "not", "arg_0", ".", "_allow_nan_stats", ":", "arg_8", "=", "tf", ".", "debugging", ".", "check_numerics", "(", "arg_8", ",", "'u in Func'", ")", "return", "arg_8", "[", "...", ",", "tf", ".", "newaxis", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Specialized inversion sampler for 3D.\"\"\"\n    arg_2 = seed_stream.SeedStream(arg_2, salt='von_mises_fisher_3d')\n    arg_3 = tf.concat([[arg_1], arg_0._batch_shape_tensor()], axis=0)\n    arg_4 = tf.random.uniform(arg_3, arg_2=arg_2(), dtype=arg_0.dtype)\n    # TODO(bjp): Higher-order odd dim analytic CDFs are available in [1], could\n    # be bisected for bounded sampling runtime (i.e. not rejection sampling).\n    # [1]: Inversion sampler via: https://ieeexplore.ieee.org/document/7347705/\n    # The inversion is: u = 1 + log(z + (1-z)*exp(-2*kappa)) / kappa\n    # We must protect against both kappa and z being zero.\n    arg_5 = tf.where(arg_0.concentration > 0,\n                         arg_0.concentration,\n                         tf.ones_like(arg_0.concentration))\n    arg_6 = tf.where(arg_4 > 0, arg_4, tf.ones_like(arg_4))\n    arg_7 = 1 + tf.reduce_logsumexp(\n        input_tensor=[\n            tf.math.log(arg_6),\n            tf.math.log1p(-arg_6) - 2 * arg_5\n        ],\n        axis=0) / arg_5\n    # Limit of the above expression as kappa->0 is 2*z-1\n    arg_8 = tf.where(arg_0.concentration > tf.zeros_like(arg_7), arg_7,\n                 2 * arg_4 - 1)\n    # Limit of the expression as z->0 is -1.\n    arg_8 = tf.where(tf.equal(arg_4, 0), -tf.ones_like(arg_8), arg_8)\n    if not arg_0._allow_nan_stats:\n      arg_8 = tf.debugging.check_numerics(arg_8, 'u in Func')\n    return arg_8[..., tf.newaxis]", "path": "tensorflow_probability/python/distributions/von_mises_fisher.py", "identifier": "VonMisesFisher._sample_3d", "docstring": "Specialized inversion sampler for 3D.", "docstring_tokens": ["Specialized", "inversion", "sampler", "for", "3D", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257588}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/S3_hook.py#L147-L183", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Lists keys in a bucket under prefix and not containing delimiter", "language": "python", "parameters": "(self, bucket_name, prefix='', delimiter='',\n                  page_size=None, max_items=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ",", "arg_3", "=", "''", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "{", "'PageSize'", ":", "arg_4", ",", "'MaxItems'", ":", "arg_5", ",", "}", "arg_7", "=", "arg_0", ".", "get_conn", "(", ")", ".", "get_paginator", "(", "'list_objects_v2'", ")", "arg_8", "=", "arg_7", ".", "paginate", "(", "Bucket", "=", "arg_1", ",", "Prefix", "=", "arg_2", ",", "Delimiter", "=", "arg_3", ",", "PaginationConfig", "=", "arg_6", ")", "arg_9", "=", "False", "arg_10", "=", "[", "]", "for", "arg_11", "in", "arg_8", ":", "if", "'Contents'", "in", "arg_11", ":", "arg_9", "=", "True", "for", "arg_12", "in", "arg_11", "[", "'Contents'", "]", ":", "arg_10", ".", "append", "(", "arg_12", "[", "'Key'", "]", ")", "if", "arg_9", ":", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2='', arg_3='',\n                  arg_4=None, arg_5=None):\n        \"\"\"\n        Lists keys in a bucket under prefix and not containing delimiter\n\n        :param bucket_name: the name of the bucket\n        :type bucket_name: str\n        :param prefix: a key prefix\n        :type prefix: str\n        :param delimiter: the delimiter marks key hierarchy.\n        :type delimiter: str\n        :param page_size: pagination size\n        :type page_size: int\n        :param max_items: maximum items to return\n        :type max_items: int\n        \"\"\"\n        arg_6 = {\n            'PageSize': arg_4,\n            'MaxItems': arg_5,\n        }\n\n        arg_7 = arg_0.get_conn().get_paginator('list_objects_v2')\n        arg_8 = arg_7.paginate(Bucket=arg_1,\n                                      Prefix=arg_2,\n                                      Delimiter=arg_3,\n                                      PaginationConfig=arg_6)\n\n        arg_9 = False\n        arg_10 = []\n        for arg_11 in arg_8:\n            if 'Contents' in arg_11:\n                arg_9 = True\n                for arg_12 in arg_11['Contents']:\n                    arg_10.append(arg_12['Key'])\n\n        if arg_9:\n            return arg_10", "path": "airflow/hooks/S3_hook.py", "identifier": "S3Hook.list_keys", "docstring": "Lists keys in a bucket under prefix and not containing delimiter\n\n        :param bucket_name: the name of the bucket\n        :type bucket_name: str\n        :param prefix: a key prefix\n        :type prefix: str\n        :param delimiter: the delimiter marks key hierarchy.\n        :type delimiter: str\n        :param page_size: pagination size\n        :type page_size: int\n        :param max_items: maximum items to return\n        :type max_items: int", "docstring_tokens": ["Lists", "keys", "in", "a", "bucket", "under", "prefix", "and", "not", "containing", "delimiter"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257589}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/indexing/indexing.py#L113-L124", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "given an ID and the dict of files, generate a static html for that abf.", "language": "python", "parameters": "(ID,group,d,folder,overwrite=False)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_3", "+", "\"/swhlab4/%s_index.html\"", "%", "arg_0", "if", "arg_4", "is", "False", "and", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "return", "arg_6", "=", "TEMPLATES", "[", "'abf'", "]", "arg_6", "=", "arg_6", ".", "replace", "(", "\"~ID~\"", ",", "arg_0", ")", "arg_6", "=", "arg_6", ".", "replace", "(", "\"~CONTENT~\"", ",", "Funccontent", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", "print", "(", "\" <- writing [%s]\"", "%", "os", ".", "path", ".", "basename", "(", "arg_5", ")", ")", "with", "open", "(", "arg_5", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_6", ")", "return"], "function": "def Func(arg_0,arg_1,arg_2,arg_3,arg_4=False):\n    \"\"\"given an ID and the dict of files, generate a static html for that abf.\"\"\"\n    arg_5=arg_3+\"/swhlab4/%s_index.html\"%arg_0\n    if arg_4 is False and os.path.exists(arg_5):\n        return\n    arg_6=TEMPLATES['abf']\n    arg_6=arg_6.replace(\"~ID~\",arg_0)\n    arg_6=arg_6.replace(\"~CONTENT~\",Funccontent(arg_0,arg_1,arg_2))\n    print(\" <- writing [%s]\"%os.path.basename(arg_5))\n    with open(arg_5,'w') as f:\n        f.write(arg_6)\n    return", "path": "doc/oldcode/indexing/indexing.py", "identifier": "htmlABF", "docstring": "given an ID and the dict of files, generate a static html for that abf.", "docstring_tokens": ["given", "an", "ID", "and", "the", "dict", "of", "files", "generate", "a", "static", "html", "for", "that", "abf", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 257590}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/rundirs.py#L8-L42", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "When a path has not been specified, make the run directory.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "os", ".", "makedirs", "(", "arg_0", ")", "arg_1", "=", "glob", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "\"[0-9]*\"", ")", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'000'", ")", "if", "arg_1", ":", "arg_3", "=", "sorted", "(", "[", "int", "(", "os", ".", "path", ".", "basename", "(", "arg_3", ")", ")", "for", "arg_3", "in", "arg_1", "]", ")", "[", "-", "1", "]", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'{0:03}'", ".", "format", "(", "arg_3", "+", "1", ")", ")", "os", ".", "makedirs", "(", "arg_2", ")", "logger", ".", "debug", "(", "\"Parsl run initializing in rundir: {0}\"", ".", "format", "(", "arg_2", ")", ")", "return", "os", ".", "path", ".", "abspath", "(", "arg_2", ")", "except", "Exception", "as", "e", ":", "logger", ".", "error", "(", "\"Failed to create a run directory\"", ")", "logger", ".", "error", "(", "\"Error: {0}\"", ".", "format", "(", "e", ")", ")", "raise"], "function": "def Func(arg_0):\n    \"\"\"When a path has not been specified, make the run directory.\n\n    Creates a rundir with the following hierarchy:\n        ./runinfo <- Home of all run directories\n          |----000\n          |----001 <- Directories for each run\n          | ....\n          |----NNN\n\n    Kwargs:\n        - path (str): String path to a specific run dir\n               Default : None.\n    \"\"\"\n    try:\n        if not os.path.exists(arg_0):\n            os.makedirs(arg_0)\n\n        arg_1 = glob(os.path.join(arg_0, \"[0-9]*\"))\n\n        arg_2 = os.path.join(arg_0, '000')\n\n        if arg_1:\n            # Since we globbed on files named as 0-9\n            arg_3 = sorted([int(os.path.basename(arg_3)) for arg_3 in arg_1])[-1]\n            arg_2 = os.path.join(arg_0, '{0:03}'.format(arg_3 + 1))\n\n        os.makedirs(arg_2)\n        logger.debug(\"Parsl run initializing in rundir: {0}\".format(arg_2))\n        return os.path.abspath(arg_2)\n\n    except Exception as e:\n        logger.error(\"Failed to create a run directory\")\n        logger.error(\"Error: {0}\".format(e))\n        raise", "path": "parsl/dataflow/rundirs.py", "identifier": "make_rundir", "docstring": "When a path has not been specified, make the run directory.\n\n    Creates a rundir with the following hierarchy:\n        ./runinfo <- Home of all run directories\n          |----000\n          |----001 <- Directories for each run\n          | ....\n          |----NNN\n\n    Kwargs:\n        - path (str): String path to a specific run dir\n               Default : None.", "docstring_tokens": ["When", "a", "path", "has", "not", "been", "specified", "make", "the", "run", "directory", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 257591}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/intervals.py#L45-L47", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Returns true iff this interval contains the interval i", "language": "python", "parameters": "(self, i)", "return_statement": "return self.start <= i.start and i.end <= self.end", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "start", "<=", "arg_1", ".", "start", "and", "arg_1", ".", "end", "<=", "arg_0", ".", "end"], "function": "def Func(arg_0, arg_1):\n        '''Returns true iff this interval Func the interval i'''\n        return arg_0.start <= arg_1.start and arg_1.end <= arg_0.end", "path": "pyfastaq/intervals.py", "identifier": "Interval.contains", "docstring": "Returns true iff this interval contains the interval i", "docstring_tokens": ["Returns", "true", "iff", "this", "interval", "contains", "the", "interval", "i"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 257592}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1427-L1439", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Count the occurrences of operation names.", "language": "python", "parameters": "(self)", "return_statement": "return op_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "topological_op_nodes", "(", ")", ":", "arg_3", "=", "arg_2", ".", "name", "if", "arg_3", "not", "in", "arg_1", ":", "arg_1", "[", "arg_3", "]", "=", "1", "else", ":", "arg_1", "[", "arg_3", "]", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Count the occurrences of operation names.\n\n        Returns a dictionary of counts keyed on the operation name.\n        \"\"\"\n        arg_1 = {}\n        for arg_2 in arg_0.topological_op_nodes():\n            arg_3 = arg_2.name\n            if arg_3 not in arg_1:\n                arg_1[arg_3] = 1\n            else:\n                arg_1[arg_3] += 1\n        return arg_1", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.count_ops", "docstring": "Count the occurrences of operation names.\n\n        Returns a dictionary of counts keyed on the operation name.", "docstring_tokens": ["Count", "the", "occurrences", "of", "operation", "names", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257593}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/echo.py#L353-L454", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "format columned data so we can easily print it out on a console, this just takes\n    columns of data and it will format it into properly aligned columns, it's not\n    fancy, but it works for most type of strings that I need it for, like server name\n    lists.", "language": "python", "parameters": "(*columns, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_1", ".", "get", "(", "'prefix'", ",", "''", ")", "arg_4", "=", "arg_1", ".", "get", "(", "'buf_count'", ",", "2", ")", "if", "len", "(", "arg_0", ")", "==", "1", ":", "arg_0", "=", "list", "(", "arg_0", "[", "0", "]", ")", "else", ":", "arg_0", "=", "list", "(", "zip", "(", "*", "arg_0", ")", ")", "arg_5", "=", "arg_1", ".", "get", "(", "\"headers\"", ",", "[", "]", ")", "if", "arg_5", ":", "arg_0", ".", "insert", "(", "0", ",", "arg_5", ")", "arg_6", "=", "arg_1", ".", "get", "(", "\"widths\"", ",", "[", "]", ")", "arg_7", "=", "Counter", "(", ")", "for", "arg_8", "in", "range", "(", "len", "(", "arg_6", ")", ")", ":", "arg_7", "[", "arg_8", "]", "=", "int", "(", "arg_6", "[", "arg_8", "]", ")", "arg_9", "=", "int", "(", "arg_1", ".", "get", "(", "\"width\"", ",", "0", ")", ")", "for", "arg_10", "in", "arg_0", ":", "for", "arg_8", ",", "arg_11", "in", "enumerate", "(", "arg_10", ")", ":", "if", "isinstance", "(", "arg_11", ",", "basestring", ")", ":", "arg_12", "=", "len", "(", "arg_11", ")", "else", ":", "arg_12", "=", "len", "(", "str", "(", "arg_11", ")", ")", "if", "arg_12", ">", "arg_7", "[", "arg_8", "]", ":", "arg_7", "[", "arg_8", "]", "=", "arg_12", "arg_9", "=", "int", "(", "arg_1", ".", "get", "(", "\"width\"", ",", "0", ")", ")", "if", "arg_9", ":", "for", "arg_8", "in", "arg_7", ":", "if", "arg_7", "[", "arg_8", "]", "<", "arg_9", ":", "arg_7", "[", "arg_8", "]", "=", "arg_9", "def", "colstr", "(", "arg_11", ")", ":", "if", "isinstance", "(", "arg_11", ",", "basestring", ")", ":", "return", "arg_11", "return", "str", "(", "arg_11", ")", "def", "rowstr", "(", "arg_10", ",", "arg_3", ",", "arg_7", ")", ":", "arg_13", "=", "arg_3", "arg_14", "=", "list", "(", "map", "(", "colstr", ",", "arg_10", ")", ")", "for", "arg_8", "in", "range", "(", "len", "(", "arg_7", ")", ")", ":", "arg_11", "=", "arg_14", "[", "arg_8", "]", "if", "re", ".", "match", "(", "r\"^\\d+(?:\\.\\d+)?$\"", ",", "arg_11", ")", ":", "if", "arg_8", "==", "0", ":", "arg_13", "+=", "\"{:>\"", "+", "str", "(", "arg_7", "[", "arg_8", "]", ")", "+", "\"}\"", "else", ":", "arg_13", "+=", "\"{:>\"", "+", "str", "(", "arg_7", "[", "arg_8", "]", "+", "arg_4", ")", "+", "\"}\"", "else", ":", "arg_13", "+=", "\"{:<\"", "+", "str", "(", "arg_7", "[", "arg_8", "]", "+", "arg_4", ")", "+", "\"}\"", "return", "arg_13", ".", "format", "(", "*", "arg_14", ")", "for", "arg_10", "in", "arg_0", ":", "arg_2", ".", "append", "(", "rowstr", "(", "arg_10", ",", "arg_3", ",", "arg_7", ")", ")", "out", "(", "os", ".", "linesep", ".", "join", "(", "arg_2", ")", ")"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    format columned data so we can easily print it out on a console, this just takes\n    columns of data and it will format it into properly aligned columns, it's not\n    fancy, but it works for most type of strings that I need it for, like server name\n    lists.\n\n    other formatting options:\n        http://stackoverflow.com/a/8234511/5006\n\n    other packages that probably do this way better:\n        https://stackoverflow.com/a/26937531/5006\n\n    :Example:\n        >>> echo.Func([(1, 2), (3, 4), (5, 6), (7, 8), (9, 0)])\n        1  2\n        3  4\n        5  6\n        7  8\n        9  0\n        >>> echo.Func([1, 3, 5, 7, 9], [2, 4, 6, 8, 0])\n        1  2\n        3  4\n        5  6\n        7  8\n        9  0\n\n    :param *columns: can either be a list of rows or multiple lists representing each\n        column in the Func\n    :param **kwargs: dict\n        prefix -- string -- what you want before each row (eg, a tab)\n        buf_count -- integer -- how many spaces between longest col value and its neighbor\n        headers -- list -- the headers you want, must match column count\n        widths -- list -- the widths of each column you want to use, this doesn't have\n            to match column count, so you can do something like [0, 5] to set the\n            width of the second column\n        width -- int -- similar to widths except it will set this value for all columns\n    \"\"\"\n    arg_2 = []\n    arg_3 = arg_1.get('prefix', '')\n    arg_4 = arg_1.get('buf_count', 2)\n    if len(arg_0) == 1:\n        arg_0 = list(arg_0[0])\n    else:\n        # without the list the zip iterator gets spent, I'm sure I can make this\n        # better\n        arg_0 = list(zip(*arg_0))\n\n    arg_5 = arg_1.get(\"headers\", [])\n    if arg_5:\n        arg_0.insert(0, arg_5)\n\n    # we have to go through all the rows and calculate the length of each\n    # column of each row\n    arg_6 = arg_1.get(\"widths\", [])\n    arg_7 = Counter()\n    for arg_8 in range(len(arg_6)):\n        arg_7[arg_8] = int(arg_6[arg_8])\n\n    arg_9 = int(arg_1.get(\"width\", 0))\n    for arg_10 in arg_0:\n        for arg_8, arg_11 in enumerate(arg_10):\n            if isinstance(arg_11, basestring):\n                arg_12 = len(arg_11)\n            else:\n                arg_12 = len(str(arg_11))\n            if arg_12 > arg_7[arg_8]:\n                arg_7[arg_8] = arg_12\n\n    arg_9 = int(arg_1.get(\"width\", 0))\n    if arg_9:\n        for arg_8 in arg_7:\n            if arg_7[arg_8] < arg_9:\n                arg_7[arg_8] = arg_9\n\n    # actually go through and format each row\n    def colstr(arg_11):\n        if isinstance(arg_11, basestring): return arg_11\n        return str(arg_11)\n\n    def rowstr(arg_10, arg_3, arg_7):\n        arg_13 = arg_3\n        arg_14 = list(map(colstr, arg_10))\n        for arg_8 in range(len(arg_7)):\n            arg_11 = arg_14[arg_8]\n            # build the format string for each row, we use the row_counts found\n            # above to decide how much padding each column should get\n            # https://stackoverflow.com/a/9536084/5006\n            if re.match(r\"^\\d+(?:\\.\\d+)?$\", arg_11):\n                if arg_8 == 0:\n                    arg_13 += \"{:>\" + str(arg_7[arg_8]) + \"}\"\n                else:\n                    arg_13 += \"{:>\" + str(arg_7[arg_8] + arg_4) + \"}\"\n            else:\n                arg_13 += \"{:<\" + str(arg_7[arg_8] + arg_4) + \"}\"\n\n        return arg_13.format(*arg_14)\n\n    for arg_10 in arg_0:\n        arg_2.append(rowstr(arg_10, arg_3, arg_7))\n\n    out(os.linesep.join(arg_2))", "path": "captain/echo.py", "identifier": "table", "docstring": "format columned data so we can easily print it out on a console, this just takes\n    columns of data and it will format it into properly aligned columns, it's not\n    fancy, but it works for most type of strings that I need it for, like server name\n    lists.\n\n    other formatting options:\n        http://stackoverflow.com/a/8234511/5006\n\n    other packages that probably do this way better:\n        https://stackoverflow.com/a/26937531/5006\n\n    :Example:\n        >>> echo.table([(1, 2), (3, 4), (5, 6), (7, 8), (9, 0)])\n        1  2\n        3  4\n        5  6\n        7  8\n        9  0\n        >>> echo.table([1, 3, 5, 7, 9], [2, 4, 6, 8, 0])\n        1  2\n        3  4\n        5  6\n        7  8\n        9  0\n\n    :param *columns: can either be a list of rows or multiple lists representing each\n        column in the table\n    :param **kwargs: dict\n        prefix -- string -- what you want before each row (eg, a tab)\n        buf_count -- integer -- how many spaces between longest col value and its neighbor\n        headers -- list -- the headers you want, must match column count\n        widths -- list -- the widths of each column you want to use, this doesn't have\n            to match column count, so you can do something like [0, 5] to set the\n            width of the second column\n        width -- int -- similar to widths except it will set this value for all columns", "docstring_tokens": ["format", "columned", "data", "so", "we", "can", "easily", "print", "it", "out", "on", "a", "console", "this", "just", "takes", "columns", "of", "data", "and", "it", "will", "format", "it", "into", "properly", "aligned", "columns", "it", "s", "not", "fancy", "but", "it", "works", "for", "most", "type", "of", "strings", "that", "I", "need", "it", "for", "like", "server", "name", "lists", "."], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 257594}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/external_tools.py#L79-L92", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Update the external tool identified by external_tool_id with the passed\n        json data.", "language": "python", "parameters": "(self, context, context_id, external_tool_id,\n                              json_data)", "return_statement": "return self._put_resource(url, body=json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_1", ".", "format", "(", "arg_2", ")", "+", "\"/external_tools/{}\"", ".", "format", "(", "arg_3", ")", "return", "arg_0", ".", "_put_resource", "(", "arg_5", ",", "body", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                              arg_4):\n        \"\"\"\n        Update the external tool identified by external_tool_id with the passed\n        json data.\n\n        context is either COURSES_API or ACCOUNTS_API.\n        context_id is the course_id or account_id, depending on context\n\n        https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.update\n        \"\"\"\n        arg_5 = arg_1.format(arg_2) + \"/external_tools/{}\".format(\n            arg_3)\n        return arg_0._put_resource(arg_5, body=arg_4)", "path": "uw_canvas/external_tools.py", "identifier": "ExternalTools._update_external_tool", "docstring": "Update the external tool identified by external_tool_id with the passed\n        json data.\n\n        context is either COURSES_API or ACCOUNTS_API.\n        context_id is the course_id or account_id, depending on context\n\n        https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.update", "docstring_tokens": ["Update", "the", "external", "tool", "identified", "by", "external_tool_id", "with", "the", "passed", "json", "data", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 257595}
{"url": "https://github.com/ambv/retype/blob/03137abd4d9c9845f3cced1006190b5cca64d879/retype.py#L196-L202", "sha": "03137abd4d9c9845f3cced1006190b5cca64d879", "docstring_summary": "Given a lib2to3 node, return its string representation.", "language": "python", "parameters": "(node, *, hg=False)", "return_statement": "return code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "str", "(", "arg_0", ")", "if", "arg_1", ":", "from", "retype_hgext", "import", "apply_job_security", "arg_2", "=", "apply_job_security", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, *, arg_1=False):\n    \"\"\"Given a lib2to3 node, return its string representation.\"\"\"\n    arg_2 = str(arg_0)\n    if arg_1:\n        from retype_hgext import apply_job_security\n        arg_2 = apply_job_security(arg_2)\n    return arg_2", "path": "retype.py", "identifier": "lib2to3_unparse", "docstring": "Given a lib2to3 node, return its string representation.", "docstring_tokens": ["Given", "a", "lib2to3", "node", "return", "its", "string", "representation", "."], "nwo": "ambv/retype", "score": 0.45641484014477285, "idx": 257596}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L197-L214", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Creates a course enrollment for an EnterpriseCustomerUser.", "language": "python", "parameters": "(self, request, pk)", "return_statement": "return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_object", "(", ")", "arg_4", "=", "serializers", ".", "EnterpriseCustomerCourseEnrollmentsSerializer", "(", "data", "=", "arg_1", ".", "data", ",", "many", "=", "True", ",", "context", "=", "{", "'enterprise_customer'", ":", "arg_3", ",", "'request_user'", ":", "arg_1", ".", "user", ",", "}", ")", "if", "arg_4", ".", "is_valid", "(", ")", ":", "arg_4", ".", "save", "(", ")", "return", "Response", "(", "arg_4", ".", "data", ",", "status", "=", "HTTP_200_OK", ")", "return", "Response", "(", "arg_4", ".", "errors", ",", "status", "=", "HTTP_400_BAD_REQUEST", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Creates a course enrollment for an EnterpriseCustomerUser.\n        \"\"\"\n        arg_3 = arg_0.get_object()\n        arg_4 = serializers.EnterpriseCustomerCourseEnrollmentsSerializer(\n            data=arg_1.data,\n            many=True,\n            context={\n                'enterprise_customer': arg_3,\n                'request_user': arg_1.user,\n            }\n        )\n        if arg_4.is_valid():\n            arg_4.save()\n            return Response(arg_4.data, status=HTTP_200_OK)\n\n        return Response(arg_4.errors, status=HTTP_400_BAD_REQUEST)", "path": "enterprise/api/v1/views.py", "identifier": "EnterpriseCustomerViewSet.course_enrollments", "docstring": "Creates a course enrollment for an EnterpriseCustomerUser.", "docstring_tokens": ["Creates", "a", "course", "enrollment", "for", "an", "EnterpriseCustomerUser", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257597}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/jupyter/backend_overview.py#L227-L257", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Generates a jobs_pending progress bar widget.", "language": "python", "parameters": "()", "return_statement": "return jobs_widget", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "widgets", ".", "IntProgress", "(", "arg_6", "=", "0", ",", "min", "=", "0", ",", "max", "=", "50", ",", "description", "=", "''", ",", "orientation", "=", "'horizontal'", ",", "layout", "=", "widgets", ".", "Layout", "(", "max_width", "=", "'180px'", ")", ")", "arg_0", ".", "style", ".", "bar_color", "=", "'#71cddd'", "arg_3", "=", "widgets", ".", "Label", "(", "arg_6", "=", "str", "(", "arg_0", ".", "value", ")", ",", "layout", "=", "widgets", ".", "Layout", "(", "min_width", "=", "'auto'", ")", ")", "arg_4", "=", "widgets", ".", "Label", "(", "arg_6", "=", "str", "(", "arg_0", ".", "max", ")", ",", "layout", "=", "widgets", ".", "Layout", "(", "min_width", "=", "'auto'", ")", ")", "def", "_on_max_change", "(", "arg_5", ")", ":", "arg_4", ".", "value", "=", "str", "(", "arg_5", "[", "'new'", "]", ")", "def", "_on_val_change", "(", "arg_5", ")", ":", "arg_3", ".", "value", "=", "str", "(", "arg_5", "[", "'new'", "]", ")", "arg_0", ".", "observe", "(", "_on_max_change", ",", "names", "=", "'max'", ")", "arg_0", ".", "observe", "(", "_on_val_change", ",", "names", "=", "'value'", ")", "arg_7", "=", "widgets", ".", "HBox", "(", "[", "arg_3", ",", "arg_0", ",", "arg_4", "]", ",", "layout", "=", "widgets", ".", "Layout", "(", "max_width", "=", "'250px'", ",", "min_width", "=", "'250px'", ",", "justify_content", "=", "'center'", ")", ")", "return", "arg_7"], "function": "def Func():\n    \"\"\"Generates a jobs_pending progress bar widget.\n    \"\"\"\n    arg_0 = widgets.IntProgress(\n        arg_6=0,\n        min=0,\n        max=50,\n        description='',\n        orientation='horizontal', layout=widgets.Layout(max_width='180px'))\n    arg_0.style.bar_color = '#71cddd'\n\n    arg_3 = widgets.Label(\n        arg_6=str(arg_0.value), layout=widgets.Layout(min_width='auto'))\n    arg_4 = widgets.Label(\n        arg_6=str(arg_0.max), layout=widgets.Layout(min_width='auto'))\n\n    def _on_max_change(arg_5):\n        arg_4.value = str(arg_5['new'])\n\n    def _on_val_change(arg_5):\n        arg_3.value = str(arg_5['new'])\n\n    arg_0.observe(_on_max_change, names='max')\n    arg_0.observe(_on_val_change, names='value')\n\n    arg_7 = widgets.HBox([arg_3, arg_0, arg_4],\n                               layout=widgets.Layout(max_width='250px',\n                                                     min_width='250px',\n                                                     justify_content='center'))\n\n    return arg_7", "path": "qiskit/tools/jupyter/backend_overview.py", "identifier": "generate_jobs_pending_widget", "docstring": "Generates a jobs_pending progress bar widget.", "docstring_tokens": ["Generates", "a", "jobs_pending", "progress", "bar", "widget", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257598}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L478-L536", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Create a new alert", "language": "python", "parameters": "(self,\n               alert_config,\n               occurrence_frequency_count=None,\n               occurrence_frequency_unit=None,\n               alert_frequency_count=None,\n               alert_frequency_unit=None)", "return_statement": "return self._post(\n            request=ApiActions.CREATE.value,\n            uri=ApiUri.ACTIONS.value,\n            params=data\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "{", "'rate_count'", ":", "arg_2", "or", "1", ",", "'rate_range'", ":", "arg_3", "or", "'hour'", ",", "'limit_count'", ":", "arg_4", "or", "1", ",", "'limit_range'", ":", "arg_5", "or", "'hour'", ",", "'schedule'", ":", "[", "]", ",", "'enabled'", ":", "True", ",", "}", "arg_6", ".", "update", "(", "arg_1", ".", "args", "(", ")", ")", "return", "arg_0", ".", "_post", "(", "request", "=", "ApiActions", ".", "CREATE", ".", "value", ",", "uri", "=", "ApiUri", ".", "ACTIONS", ".", "value", ",", "params", "=", "arg_6", ")"], "function": "def Func(arg_0,\n               arg_1,\n               arg_2=None,\n               arg_3=None,\n               arg_4=None,\n               arg_5=None):\n        \"\"\"\n        Create a new alert\n\n        :param alert_config: A list of AlertConfig classes (Ex:\n            ``[EmailAlertConfig('me@mydomain.com')]``)\n        :type alert_config: list of\n            :class:`PagerDutyAlertConfig<logentries_api.alerts.PagerDutyAlertConfig>`,\n            :class:`WebHookAlertConfig<logentries_api.alerts.WebHookAlertConfig>`,\n            :class:`EmailAlertConfig<logentries_api.alerts.EmailAlertConfig>`,\n            :class:`SlackAlertConfig<logentries_api.alerts.SlackAlertConfig>`, or\n            :class:`HipChatAlertConfig<logentries_api.alerts.HipChatAlertConfig>`\n\n        :param occurrence_frequency_count: How many times per\n            ``alert_frequency_unit`` for a match before issuing an alert.\n            Defaults to 1\n        :type occurrence_frequency_count: int\n\n        :param occurrence_frequency_unit: The time period to monitor for sending\n            an alert. Must be 'day', or 'hour'. Defaults to 'hour'\n        :type occurrence_frequency_unit: str\n\n        :param alert_frequency_count: How many times per\n            ``alert_frequency_unit`` to issue an alert. Defaults to 1\n        :type alert_frequency_count: int\n\n        :param alert_frequency_unit: How often to regulate sending alerts.\n            Must be 'day', or 'hour'. Defaults to 'hour'\n        :type alert_frequency_unit: str\n\n        :returns: The response of your post\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException<logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries\n        \"\"\"\n        arg_6 = {\n            'rate_count': arg_2 or 1,\n            'rate_range': arg_3 or 'hour',\n            'limit_count': arg_4 or 1,\n            'limit_range': arg_5 or 'hour',\n            'schedule': [],\n            'enabled': True,\n        }\n        arg_6.update(arg_1.args())\n\n        # Yes, it's confusing. the `/actions/` endpoint is used for alerts, while\n        # the /tags/ endpoint is used for labels.\n        return arg_0._post(\n            request=ApiActions.CREATE.value,\n            uri=ApiUri.ACTIONS.value,\n            params=arg_6\n        )", "path": "logentries_api/resources.py", "identifier": "Alerts.create", "docstring": "Create a new alert\n\n        :param alert_config: A list of AlertConfig classes (Ex:\n            ``[EmailAlertConfig('me@mydomain.com')]``)\n        :type alert_config: list of\n            :class:`PagerDutyAlertConfig<logentries_api.alerts.PagerDutyAlertConfig>`,\n            :class:`WebHookAlertConfig<logentries_api.alerts.WebHookAlertConfig>`,\n            :class:`EmailAlertConfig<logentries_api.alerts.EmailAlertConfig>`,\n            :class:`SlackAlertConfig<logentries_api.alerts.SlackAlertConfig>`, or\n            :class:`HipChatAlertConfig<logentries_api.alerts.HipChatAlertConfig>`\n\n        :param occurrence_frequency_count: How many times per\n            ``alert_frequency_unit`` for a match before issuing an alert.\n            Defaults to 1\n        :type occurrence_frequency_count: int\n\n        :param occurrence_frequency_unit: The time period to monitor for sending\n            an alert. Must be 'day', or 'hour'. Defaults to 'hour'\n        :type occurrence_frequency_unit: str\n\n        :param alert_frequency_count: How many times per\n            ``alert_frequency_unit`` to issue an alert. Defaults to 1\n        :type alert_frequency_count: int\n\n        :param alert_frequency_unit: How often to regulate sending alerts.\n            Must be 'day', or 'hour'. Defaults to 'hour'\n        :type alert_frequency_unit: str\n\n        :returns: The response of your post\n        :rtype: dict\n\n        :raises: This will raise a\n            :class:`ServerException<logentries_api.exceptions.ServerException>`\n            if there is an error from Logentries", "docstring_tokens": ["Create", "a", "new", "alert"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 257599}
{"url": "https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L207-L217", "sha": "cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174", "docstring_summary": "possible hvac modes are auto, auxHeatOnly, cool, heat, off", "language": "python", "parameters": "(self, index, hvac_mode)", "return_statement": "return self.make_request(body, log_msg_action)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "arg_0", ".", "thermostats", "[", "arg_1", "]", "[", "'identifier'", "]", "}", ",", "\"thermostat\"", ":", "{", "\"settings\"", ":", "{", "\"hvacMode\"", ":", "arg_2", "}", "}", "}", "arg_4", "=", "\"set HVAC mode\"", "return", "arg_0", ".", "make_request", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        ''' possible hvac modes are auto, auxHeatOnly, cool, heat, off '''\n        arg_3 = {\"selection\": {\"selectionType\": \"thermostats\",\n                              \"selectionMatch\": arg_0.thermostats[arg_1]['identifier']},\n                              \"thermostat\": {\n                                  \"settings\": {\n                                      \"hvacMode\": arg_2\n                                  }\n                              }}\n        arg_4 = \"set HVAC mode\"\n        return arg_0.make_request(arg_3, arg_4)", "path": "pyecobee/__init__.py", "identifier": "Ecobee.set_hvac_mode", "docstring": "possible hvac modes are auto, auxHeatOnly, cool, heat, off", "docstring_tokens": ["possible", "hvac", "modes", "are", "auto", "auxHeatOnly", "cool", "heat", "off"], "nwo": "nkgilley/python-ecobee-api", "score": 0.37994208506696864, "idx": 257600}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L878-L891", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Register filters for Jinja to use", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "_filters", ":", "if", "not", "arg_2", ":", "arg_0", ".", "app", ".", "jinja_env", ".", "filters", "[", "arg_1", ".", "replace", "(", "\"f_\"", ",", "\"\"", ")", "]", "=", "getattr", "(", "flask_nemo", ".", "filters", ",", "arg_1", ")", "else", ":", "arg_0", ".", "app", ".", "jinja_env", ".", "filters", "[", "arg_1", ".", "replace", "(", "\"f_\"", ",", "\"\"", ")", "]", "=", "getattr", "(", "arg_2", ",", "arg_1", ".", "replace", "(", "\"_{}\"", ".", "format", "(", "arg_2", ".", "name", ")", ",", "\"\"", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Register filters for Jinja to use\n\n       .. note::  Extends the dictionary filters of jinja_env using self._filters list\n        \"\"\"\n        for arg_1, arg_2 in arg_0._filters:\n            if not arg_2:\n                arg_0.app.jinja_env.filters[\n                    arg_1.replace(\"f_\", \"\")\n                ] = getattr(flask_nemo.filters, arg_1)\n            else:\n                arg_0.app.jinja_env.filters[\n                    arg_1.replace(\"f_\", \"\")\n                ] = getattr(arg_2, arg_1.replace(\"_{}\".format(arg_2.name), \"\"))", "path": "flask_nemo/__init__.py", "identifier": "Nemo.register_filters", "docstring": "Register filters for Jinja to use\n\n       .. note::  Extends the dictionary filters of jinja_env using self._filters list", "docstring_tokens": ["Register", "filters", "for", "Jinja", "to", "use"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 257601}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L509-L523", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Independant Kaiser window", "language": "python", "parameters": "(n, beta)", "return_statement": "return w", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "scipy", ".", "special", "import", "iv", "as", "besselI", "arg_2", "=", "arg_0", "-", "1", "arg_3", "=", "arange", "(", "0", ",", "arg_2", ")", "arg_3", "=", "2.", "*", "arg_1", "/", "arg_2", "*", "sqrt", "(", "arg_3", "*", "(", "arg_2", "-", "arg_3", ")", ")", "arg_4", "=", "besselI", "(", "0", ",", "arg_3", ")", "/", "besselI", "(", "0", ",", "arg_1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Independant Kaiser window\n\n    For the definition of the Kaiser window, see A. V. Oppenheim & R. W. Schafer, \"Discrete-Time Signal Processing\".\n\n    The continuous version of width n centered about x=0 is:\n\n    .. note:: 2 times slower than scipy.kaiser\n    \"\"\"\n    from scipy.special import iv as besselI\n    arg_2 = arg_0 - 1\n    arg_3 = arange(0, arg_2)\n    arg_3 = 2. * arg_1 / arg_2 * sqrt (arg_3 * (arg_2 - arg_3))\n    arg_4 = besselI (0, arg_3) / besselI (0, arg_1)\n    return arg_4", "path": "src/spectrum/window.py", "identifier": "_kaiser", "docstring": "Independant Kaiser window\n\n    For the definition of the Kaiser window, see A. V. Oppenheim & R. W. Schafer, \"Discrete-Time Signal Processing\".\n\n    The continuous version of width n centered about x=0 is:\n\n    .. note:: 2 times slower than scipy.kaiser", "docstring_tokens": ["Independant", "Kaiser", "window"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 257602}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/docmaker/sources.py#L322-L330", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "process a normal line and check whether it is the start of a new block", "language": "python", "parameters": "( self, line )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "re_source_block_formats", ":", "if", "arg_2", ".", "start", ".", "match", "(", "arg_1", ")", ":", "arg_0", ".", "add_block_lines", "(", ")", "arg_0", ".", "format", "=", "arg_2", "arg_0", ".", "lineno", "=", "fileinput", ".", "filelineno", "(", ")", "arg_0", ".", "lines", ".", "append", "(", "arg_1", ")"], "function": "def  Func( arg_0, arg_1 ):\n        \"\"\"process a normal line and check whether it is the start of a new block\"\"\"\n        for arg_2 in re_source_block_formats:\n            if arg_2.start.match( arg_1 ):\n                arg_0.add_block_lines()\n                arg_0.format = arg_2\n                arg_0.lineno = fileinput.filelineno()\n\n        arg_0.lines.append( arg_1 )", "path": "native/Vendor/FreeType/src/tools/docmaker/sources.py", "identifier": "SourceProcessor.process_normal_line", "docstring": "process a normal line and check whether it is the start of a new block", "docstring_tokens": ["process", "a", "normal", "line", "and", "check", "whether", "it", "is", "the", "start", "of", "a", "new", "block"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 257603}
{"url": "https://github.com/abau171/highfive/blob/07b3829331072035ab100d1d66deca3e8f3f372a/highfive/jobs.py#L114-L124", "sha": "07b3829331072035ab100d1d66deca3e8f3f372a", "docstring_summary": "Waits until the result set changes. Possible changes can be a result\n        being added or the result set becoming complete. If the result set is\n        already completed, this method returns immediately.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_complete", "(", ")", ":", "arg_1", "=", "arg_0", ".", "_loop", ".", "create_future", "(", ")", "arg_0", ".", "_waiters", ".", "append", "(", "arg_1", ")", "await", "arg_1"], "function": "async def Func(arg_0):\n        \"\"\"\n        Waits until the result set changes. Possible changes can be a result\n        being added or the result set becoming complete. If the result set is\n        already completed, this method returns immediately.\n        \"\"\"\n\n        if not arg_0.is_complete():\n            arg_1 = arg_0._loop.create_future()\n            arg_0._waiters.append(arg_1)\n            await arg_1", "path": "highfive/jobs.py", "identifier": "Results.wait_changed", "docstring": "Waits until the result set changes. Possible changes can be a result\n        being added or the result set becoming complete. If the result set is\n        already completed, this method returns immediately.", "docstring_tokens": ["Waits", "until", "the", "result", "set", "changes", ".", "Possible", "changes", "can", "be", "a", "result", "being", "added", "or", "the", "result", "set", "becoming", "complete", ".", "If", "the", "result", "set", "is", "already", "completed", "this", "method", "returns", "immediately", "."], "nwo": "abau171/highfive", "score": 0.14991498758945482, "idx": 257604}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L140-L159", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "r\"\"\"Calculate an alternative distance matrix based on the following equation.", "language": "python", "parameters": "(dict_of_sets: Mapping[X, Set])", "return_statement": "return dict(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", ",", "arg_3", "]", ")", "->", "arg_1", "[", "arg_2", ",", "arg_1", "[", "arg_2", ",", "float", "]", "]", ":", "arg_4", "=", "set", "(", "itt", ".", "chain", ".", "from_iterable", "(", "arg_0", ".", "values", "(", ")", ")", ")", "arg_5", "=", "len", "(", "arg_4", ")", "arg_6", ":", "Dict", "[", "arg_2", ",", "Dict", "[", "arg_2", ",", "float", "]", "]", "=", "defaultdict", "(", "dict", ")", "for", "arg_7", ",", "arg_8", "in", "itt", ".", "combinations", "(", "arg_0", ",", "2", ")", ":", "arg_6", "[", "arg_7", "]", "[", "arg_8", "]", "=", "arg_6", "[", "arg_8", "]", "[", "arg_7", "]", "=", "1.0", "-", "len", "(", "arg_0", "[", "arg_7", "]", "|", "arg_0", "[", "arg_8", "]", ")", "/", "arg_5", "for", "arg_7", "in", "arg_0", ":", "arg_6", "[", "arg_7", "]", "[", "arg_7", "]", "=", "1.0", "-", "len", "(", "arg_7", ")", "/", "arg_5", "return", "dict", "(", "arg_6", ")"], "function": "def Func(arg_0: arg_1[arg_2, arg_3]) -> arg_1[arg_2, arg_1[arg_2, float]]:\n    r\"\"\"Calculate an alternative distance matrix based on the following equation.\n\n    .. math:: distance(A, B)=1- \\|A \\cup B\\| / \\| \\cup_{s \\in S} s\\|\n\n    :param dict_of_sets: A dict of {x: set of y}\n    :return: A similarity matrix based on the alternative tanimoto distance as a dict of dicts\n    \"\"\"\n    arg_4 = set(itt.chain.from_iterable(arg_0.values()))\n    arg_5 = len(arg_4)\n\n    arg_6: Dict[arg_2, Dict[arg_2, float]] = defaultdict(dict)\n\n    for arg_7, arg_8 in itt.combinations(arg_0, 2):\n        arg_6[arg_7][arg_8] = arg_6[arg_8][arg_7] = 1.0 - len(arg_0[arg_7] | arg_0[arg_8]) / arg_5\n\n    for arg_7 in arg_0:\n        arg_6[arg_7][arg_7] = 1.0 - len(arg_7) / arg_5\n\n    return dict(arg_6)", "path": "src/pybel_tools/utils.py", "identifier": "calculate_global_tanimoto_set_distances", "docstring": "r\"\"\"Calculate an alternative distance matrix based on the following equation.\n\n    .. math:: distance(A, B)=1- \\|A \\cup B\\| / \\| \\cup_{s \\in S} s\\|\n\n    :param dict_of_sets: A dict of {x: set of y}\n    :return: A similarity matrix based on the alternative tanimoto distance as a dict of dicts", "docstring_tokens": ["r", "Calculate", "an", "alternative", "distance", "matrix", "based", "on", "the", "following", "equation", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257605}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L772-L784", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Return token's remaining API points", "language": "python", "parameters": "(self, token)", "return_statement": "return remaining", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "\"rate_limit\"", ")", "arg_0", ".", "session", ".", "headers", ".", "update", "(", "{", "'Authorization'", ":", "'token '", "+", "arg_1", "}", ")", "arg_3", "=", "0", "try", ":", "arg_4", "=", "super", "(", ")", ".", "fetch", "(", "arg_2", ")", ".", "headers", "if", "arg_0", ".", "rate_limit_header", "in", "arg_4", ":", "arg_3", "=", "int", "(", "arg_4", "[", "arg_0", ".", "rate_limit_header", "]", ")", "except", "requests", ".", "exceptions", ".", "HTTPError", "as", "error", ":", "logger", ".", "warning", "(", "\"Rate limit not initialized: %s\"", ",", "error", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return token's remaining API points\"\"\"\n\n        arg_2 = urijoin(arg_0.base_url, \"rate_limit\")\n        arg_0.session.headers.update({'Authorization': 'token ' + arg_1})\n        arg_3 = 0\n        try:\n            arg_4 = super().fetch(arg_2).headers\n            if arg_0.rate_limit_header in arg_4:\n                arg_3 = int(arg_4[arg_0.rate_limit_header])\n        except requests.exceptions.HTTPError as error:\n            logger.warning(\"Rate limit not initialized: %s\", error)\n        return arg_3", "path": "perceval/backends/core/github.py", "identifier": "GitHubClient._get_token_rate_limit", "docstring": "Return token's remaining API points", "docstring_tokens": ["Return", "token", "s", "remaining", "API", "points"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257606}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L731-L751", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return True if filename is Python file.", "language": "python", "parameters": "(filename)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "endswith", "(", "'.py'", ")", ":", "return", "True", "try", ":", "with", "open_with_encoding", "(", "arg_0", ",", "None", ",", "limit_byte_check", "=", "MAX_PYTHON_FILE_DETECTION_BYTES", ")", "as", "f", ":", "arg_1", "=", "f", ".", "read", "(", "MAX_PYTHON_FILE_DETECTION_BYTES", ")", "if", "not", "arg_1", ":", "return", "False", "arg_2", "=", "arg_1", ".", "splitlines", "(", ")", "[", "0", "]", "except", "(", "IOError", ",", "IndexError", ")", ":", "return", "False", "if", "not", "PYTHON_SHEBANG_REGEX", ".", "match", "(", "arg_2", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"Return True if filename is Python file.\"\"\"\n    if arg_0.endswith('.py'):\n        return True\n\n    try:\n        with open_with_encoding(\n                arg_0,\n                None,\n                limit_byte_check=MAX_PYTHON_FILE_DETECTION_BYTES) as f:\n            arg_1 = f.read(MAX_PYTHON_FILE_DETECTION_BYTES)\n            if not arg_1:\n                return False\n            arg_2 = arg_1.splitlines()[0]\n    except (IOError, IndexError):\n        return False\n\n    if not PYTHON_SHEBANG_REGEX.match(arg_2):\n        return False\n\n    return True", "path": "autoflake.py", "identifier": "is_python_file", "docstring": "Return True if filename is Python file.", "docstring_tokens": ["Return", "True", "if", "filename", "is", "Python", "file", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 257607}
{"url": "https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/script.py#L139-L143", "sha": "e1b85544ce72bfaae9182597709a2ecede8c8242", "docstring_summary": "Configure the MetricRegistry.", "language": "python", "parameters": "(self, include_process_stats: bool = False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "=", "False", ")", ":", "if", "arg_1", ":", "arg_0", ".", "registry", ".", "register_additional_collector", "(", "ProcessCollector", "(", "registry", "=", "None", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2 = False):\n        \"\"\"Configure the MetricRegistry.\"\"\"\n        if arg_1:\n            arg_0.registry.register_additional_collector(\n                ProcessCollector(registry=None))", "path": "prometheus_aioexporter/script.py", "identifier": "PrometheusExporterScript._configure_registry", "docstring": "Configure the MetricRegistry.", "docstring_tokens": ["Configure", "the", "MetricRegistry", "."], "nwo": "albertodonato/prometheus-aioexporter", "score": 0.36639066307774715, "idx": 257608}
{"url": "https://github.com/adrianoveiga/django-media-fixtures/blob/a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54/django_media_fixtures/management/commands/collectmedia.py#L85-L138", "sha": "a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54", "docstring_summary": "Perform the bulk of the work of collectmedia.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'modified': self.copied_files + self.symlinked_files,\n            'unmodified': self.unmodified_files,\n            'post_processed': self.post_processed_files,\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "symlink", "and", "not", "arg_0", ".", "local", ":", "raise", "CommandError", "(", "\"Can't symlink to a remote destination.\"", ")", "if", "arg_0", ".", "clear", ":", "arg_0", ".", "clear_dir", "(", "''", ")", "if", "arg_0", ".", "symlink", ":", "arg_1", "=", "arg_0", ".", "link_file", "else", ":", "arg_1", "=", "arg_0", ".", "copy_file", "arg_2", "=", "OrderedDict", "(", ")", "for", "arg_3", "in", "get_finders", "(", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "list", "(", "arg_0", ".", "ignore_patterns", ")", ":", "if", "getattr", "(", "arg_5", ",", "'prefix'", ",", "None", ")", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_5", ".", "prefix", ",", "arg_4", ")", "else", ":", "arg_6", "=", "arg_4", "if", "arg_6", "not", "in", "arg_2", ":", "arg_2", "[", "arg_6", "]", "=", "(", "arg_5", ",", "arg_4", ")", "arg_1", "(", "arg_4", ",", "arg_6", ",", "arg_5", ")", "if", "arg_0", ".", "post_process", "and", "hasattr", "(", "arg_0", ".", "storage", ",", "'post_process'", ")", ":", "arg_7", "=", "arg_0", ".", "storage", ".", "post_process", "(", "arg_2", ",", "dry_run", "=", "arg_0", ".", "dry_run", ")", "for", "arg_8", ",", "arg_9", ",", "arg_10", "in", "arg_7", ":", "if", "isinstance", "(", "arg_10", ",", "Exception", ")", ":", "arg_0", ".", "stderr", ".", "write", "(", "\"Post-processing '%s' failed!\"", "%", "arg_8", ")", "arg_0", ".", "stderr", ".", "write", "(", "\"\"", ")", "raise", "arg_10", "if", "arg_10", ":", "arg_0", ".", "log", "(", "\"Post-processed '%s' as '%s'\"", "%", "(", "arg_8", ",", "arg_9", ")", ",", "level", "=", "1", ")", "arg_0", ".", "post_processed_files", ".", "append", "(", "arg_8", ")", "else", ":", "arg_0", ".", "log", "(", "\"Skipped post-processing '%s'\"", "%", "arg_8", ")", "return", "{", "'modified'", ":", "arg_0", ".", "copied_files", "+", "arg_0", ".", "symlinked_files", ",", "'unmodified'", ":", "arg_0", ".", "unmodified_files", ",", "'post_processed'", ":", "arg_0", ".", "post_processed_files", ",", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Perform the bulk of the work of Funcmedia.\n\n        Split off from handle() to facilitate testing.\n        \"\"\"\n        if arg_0.symlink and not arg_0.local:\n            raise CommandError(\"Can't symlink to a remote destination.\")\n\n        if arg_0.clear:\n            arg_0.clear_dir('')\n\n        if arg_0.symlink:\n            arg_1 = arg_0.link_file\n        else:\n            arg_1 = arg_0.copy_file\n\n        arg_2 = OrderedDict()\n        for arg_3 in get_finders():\n            for arg_4, arg_5 in arg_3.list(arg_0.ignore_patterns):\n                # Prefix the relative path if the source storage contains it\n                if getattr(arg_5, 'prefix', None):\n                    arg_6 = os.path.join(arg_5.prefix, arg_4)\n                else:\n                    arg_6 = arg_4\n\n                if arg_6 not in arg_2:\n                    arg_2[arg_6] = (arg_5, arg_4)\n                    arg_1(arg_4, arg_6, arg_5)\n\n        # Here we check if the storage backend has a post_process\n        # method and pass it the list of modified files.\n        if arg_0.post_process and hasattr(arg_0.storage, 'post_process'):\n            arg_7 = arg_0.storage.post_process(arg_2,\n                                                  dry_run=arg_0.dry_run)\n            for arg_8, arg_9, arg_10 in arg_7:\n                if isinstance(arg_10, Exception):\n                    arg_0.stderr.write(\"Post-processing '%s' failed!\" % arg_8)\n                    # Add a blank line before the traceback, otherwise it's\n                    # too easy to miss the relevant part of the error message.\n                    arg_0.stderr.write(\"\")\n                    raise arg_10\n                if arg_10:\n                    arg_0.log(\"Post-processed '%s' as '%s'\" %\n                             (arg_8, arg_9), level=1)\n                    arg_0.post_processed_files.append(arg_8)\n                else:\n                    arg_0.log(\"Skipped post-processing '%s'\" % arg_8)\n\n        return {\n            'modified': arg_0.copied_files + arg_0.symlinked_files,\n            'unmodified': arg_0.unmodified_files,\n            'post_processed': arg_0.post_processed_files,\n        }", "path": "django_media_fixtures/management/commands/collectmedia.py", "identifier": "Command.collect", "docstring": "Perform the bulk of the work of collectmedia.\n\n        Split off from handle() to facilitate testing.", "docstring_tokens": ["Perform", "the", "bulk", "of", "the", "work", "of", "collectmedia", "."], "nwo": "adrianoveiga/django-media-fixtures", "score": 0.2845436920530269, "idx": 257609}
{"url": "https://github.com/sublee/zeronimo/blob/b216638232932718d2cbc5eabd870c8f5b5e83fb/zeronimo/core.py#L607-L641", "sha": "b216638232932718d2cbc5eabd870c8f5b5e83fb", "docstring_summary": "Waits for the call is accepted by workers and starts to collect the\n        results.", "language": "python", "parameters": "(self, call_id, timeout, limit=None,\n                  retry=None, max_retries=None)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "0", "arg_7", "=", "0", "arg_8", "=", "[", "]", "arg_9", "=", "arg_0", ".", "result_queues", "[", "arg_1", "]", "try", ":", "with", "Timeout", "(", "arg_2", ",", "False", ")", ":", "while", "True", ":", "arg_10", "=", "arg_9", ".", "get", "(", ")", "if", "arg_10", "is", "None", ":", "arg_6", "+=", "1", "if", "arg_4", "is", "not", "None", ":", "if", "arg_7", "==", "arg_5", ":", "break", "arg_4", "(", ")", "arg_7", "+=", "1", "continue", "arg_8", ".", "append", "(", "arg_10", ")", "if", "len", "(", "arg_8", ")", "==", "arg_3", ":", "break", "finally", ":", "del", "arg_9", "arg_0", ".", "remove_result_queue", "(", "arg_1", ")", "if", "not", "arg_8", ":", "if", "arg_6", ":", "raise", "Rejected", "(", "'%d workers rejected'", "%", "arg_6", "if", "arg_6", "!=", "1", "else", "'A worker rejected'", ")", "else", ":", "raise", "WorkerNotFound", "(", "'failed to find worker'", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None,\n                  arg_4=None, arg_5=None):\n        \"\"\"Waits for the call is accepted by workers and starts to collect the\n        results.\n        \"\"\"\n        arg_6 = 0\n        arg_7 = 0\n        arg_8 = []\n        arg_9 = arg_0.result_queues[arg_1]\n        try:\n            with Timeout(arg_2, False):\n                while True:\n                    arg_10 = arg_9.get()\n                    if arg_10 is None:\n                        arg_6 += 1\n                        if arg_4 is not None:\n                            if arg_7 == arg_5:\n                                break\n                            arg_4()\n                            arg_7 += 1\n                        continue\n                    arg_8.append(arg_10)\n                    if len(arg_8) == arg_3:\n                        break\n        finally:\n            del arg_9\n            arg_0.remove_result_queue(arg_1)\n        if not arg_8:\n            if arg_6:\n                raise Rejected('%d workers rejected' % arg_6\n                               if arg_6 != 1 else\n                               'A worker rejected')\n            else:\n                raise WorkerNotFound('failed to find worker')\n        return arg_8", "path": "zeronimo/core.py", "identifier": "Collector.establish", "docstring": "Waits for the call is accepted by workers and starts to collect the\n        results.", "docstring_tokens": ["Waits", "for", "the", "call", "is", "accepted", "by", "workers", "and", "starts", "to", "collect", "the", "results", "."], "nwo": "sublee/zeronimo", "score": 0.08529914490135834, "idx": 257610}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L547-L596", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Update the simulator to a specific frame of marker data.", "language": "python", "parameters": "(self, frame_no, dt=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "markers", ".", "detach", "(", ")", "arg_0", ".", "markers", ".", "reposition", "(", "arg_1", ")", "arg_0", ".", "markers", ".", "attach", "(", "arg_1", ")", "arg_0", ".", "ode_space", ".", "collide", "(", "None", ",", "arg_0", ".", "on_collision", ")", "arg_3", "=", "arg_0", ".", "skeleton", ".", "get_body_states", "(", ")", "arg_0", ".", "skeleton", ".", "set_body_states", "(", "arg_3", ")", "yield", "arg_3", "arg_0", ".", "ode_world", ".", "step", "(", "arg_2", "or", "arg_0", ".", "dt", ")", "arg_0", ".", "ode_contactgroup", ".", "empty", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''Update the simulator to a specific frame of marker data.\n\n        This method returns a generator of body states for the skeleton! This\n        generator must be exhausted (e.g., by consuming this call in a for loop)\n        for the simulator to work properly.\n\n        This process involves the following steps:\n\n        - Move the markers to their new location:\n          - Detach from the skeleton\n          - Update marker locations\n          - Reattach to the skeleton\n        - Detect ODE collisions\n        - Yield the states of the bodies in the skeleton\n        - Advance the ODE world one step\n\n        Parameters\n        ----------\n        frame_no : int\n            Step to this frame of marker data.\n        dt : float, optional\n            Step with this time duration. Defaults to ``self.dt``.\n\n        Returns\n        -------\n        states : sequence of state tuples\n            A generator of a sequence of one body state for the skeleton. This\n            generator must be exhausted for the simulation to work properly.\n        '''\n        # update the positions and velocities of the markers.\n        arg_0.markers.detach()\n        arg_0.markers.reposition(arg_1)\n        arg_0.markers.attach(arg_1)\n\n        # detect collisions.\n        arg_0.ode_space.collide(None, arg_0.on_collision)\n\n        # record the state of each skeleton body.\n        arg_3 = arg_0.skeleton.get_body_states()\n        arg_0.skeleton.set_body_states(arg_3)\n\n        # yield the current simulation state to our caller.\n        yield arg_3\n\n        # update the ode world.\n        arg_0.ode_world.step(arg_2 or arg_0.dt)\n\n        # clear out contact joints to prepare for the next frame.\n        arg_0.ode_contactgroup.empty()", "path": "pagoda/cooper.py", "identifier": "World._step_to_marker_frame", "docstring": "Update the simulator to a specific frame of marker data.\n\n        This method returns a generator of body states for the skeleton! This\n        generator must be exhausted (e.g., by consuming this call in a for loop)\n        for the simulator to work properly.\n\n        This process involves the following steps:\n\n        - Move the markers to their new location:\n          - Detach from the skeleton\n          - Update marker locations\n          - Reattach to the skeleton\n        - Detect ODE collisions\n        - Yield the states of the bodies in the skeleton\n        - Advance the ODE world one step\n\n        Parameters\n        ----------\n        frame_no : int\n            Step to this frame of marker data.\n        dt : float, optional\n            Step with this time duration. Defaults to ``self.dt``.\n\n        Returns\n        -------\n        states : sequence of state tuples\n            A generator of a sequence of one body state for the skeleton. This\n            generator must be exhausted for the simulation to work properly.", "docstring_tokens": ["Update", "the", "simulator", "to", "a", "specific", "frame", "of", "marker", "data", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 257611}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/project/application/utils/account.py#L6-L9", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Sign in user.", "language": "python", "parameters": "(user, permenent=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", ".", "permanent", "=", "arg_1", "arg_2", "[", "'user_id'", "]", "=", "arg_0", ".", "id"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Sign in user.\"\"\"\n    arg_2.permanent = arg_1\n    arg_2['user_id'] = arg_0.id", "path": "flask_boost/project/application/utils/account.py", "identifier": "signin_user", "docstring": "Sign in user.", "docstring_tokens": ["Sign", "in", "user", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 257612}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py#L93-L106", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Get the Channel Id from the current Activity on the Turn Context.", "language": "python", "parameters": "(turn_context: TurnContext)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "str", ":", "if", "arg_0", ".", "activity", ".", "channel_id", "is", "None", ":", "return", "\"\"", "else", ":", "return", "arg_0", ".", "activity", ".", "channel_id"], "function": "def Func(arg_0: arg_1) -> str:\n        \"\"\"Get the Channel Id from the current Activity on the Turn Context.\n\n        Args:\n            turn_context (TurnContext): The Turn Context to retrieve the Activity's Channel Id from.\n\n        Returns:\n            str: The Channel Id from the Turn Context's Activity.\n        \"\"\"\n\n        if arg_0.activity.channel_id is None:\n            return \"\"\n        else:\n            return arg_0.activity.channel_id", "path": "libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py", "identifier": "Channel.get_channel_id", "docstring": "Get the Channel Id from the current Activity on the Turn Context.\n\n        Args:\n            turn_context (TurnContext): The Turn Context to retrieve the Activity's Channel Id from.\n\n        Returns:\n            str: The Channel Id from the Turn Context's Activity.", "docstring_tokens": ["Get", "the", "Channel", "Id", "from", "the", "current", "Activity", "on", "the", "Turn", "Context", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 257613}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/layout.py#L29-L33", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Construct a layout.\n        SHOULD BE PRIVATE", "language": "python", "parameters": "(cls, project, **desc)", "return_statement": "return cls(project.drivers, maker=project.maker, **desc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", "(", "arg_1", ".", "drivers", ",", "maker", "=", "arg_1", ".", "maker", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Construct a layout.\n        SHOULD BE PRIVATE\n        \"\"\"\n        return arg_0(arg_1.drivers, maker=arg_1.maker, **arg_2)", "path": "bibliopixel/layout/layout.py", "identifier": "Layout.construct", "docstring": "Construct a layout.\n        SHOULD BE PRIVATE", "docstring_tokens": ["Construct", "a", "layout", ".", "SHOULD", "BE", "PRIVATE"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 257614}
{"url": "https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L224-L242", "sha": "3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8", "docstring_summary": "Does this schedule include the provided time?\n        query_date and query_time are date and time objects, interpreted\n        in this schedule's timezone", "language": "python", "parameters": "(self, query_date, query_time=None)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", ".", "start_date", "and", "arg_1", "<", "arg_0", ".", "start_date", ":", "return", "False", "if", "arg_0", ".", "end_date", "and", "arg_1", ">", "arg_0", ".", "end_date", ":", "return", "False", "if", "arg_1", ".", "weekday", "(", ")", "not", "in", "arg_0", ".", "weekdays", ":", "return", "False", "if", "not", "arg_2", ":", "return", "True", "if", "arg_2", ">=", "arg_0", ".", "period", ".", "start", "and", "arg_2", "<=", "arg_0", ".", "period", ".", "end", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Does this schedule include the provided time?\n        query_date and query_time are date and time objects, interpreted\n        in this schedule's timezone\"\"\"\n\n        if arg_0.start_date and arg_1 < arg_0.start_date:\n            return False\n        if arg_0.end_date and arg_1 > arg_0.end_date:\n            return False\n        if arg_1.weekday() not in arg_0.weekdays:\n            return False\n\n        if not arg_2:\n            return True\n\n        if arg_2 >= arg_0.period.start and arg_2 <= arg_0.period.end:\n            return True\n\n        return False", "path": "open511/utils/schedule.py", "identifier": "RecurringScheduleComponent.includes", "docstring": "Does this schedule include the provided time?\n        query_date and query_time are date and time objects, interpreted\n        in this schedule's timezone", "docstring_tokens": ["Does", "this", "schedule", "include", "the", "provided", "time?", "query_date", "and", "query_time", "are", "date", "and", "time", "objects", "interpreted", "in", "this", "schedule", "s", "timezone"], "nwo": "open511/open511", "score": 0.138843686048881, "idx": 257615}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L1618-L1657", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Performs local inhibition. Local inhibition is performed on a column by\n    column basis. Each column observes the overlaps of its neighbors and is\n    selected if its overlap score is within the top 'numActive' in its local\n    neighborhood. At most half of the columns in a local neighborhood are\n    allowed to be active. Columns with an overlap score below the\n    'stimulusThreshold' are always inhibited.", "language": "python", "parameters": "(self, overlaps, density)", "return_statement": "return activeArray.nonzero()[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "numpy", ".", "zeros", "(", "arg_0", ".", "_numColumns", ",", "dtype", "=", "\"bool\"", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_1", ")", ":", "if", "arg_5", ">=", "arg_0", ".", "_stimulusThreshold", ":", "arg_6", "=", "arg_0", ".", "_getColumnNeighborhood", "(", "arg_4", ")", "arg_7", "=", "arg_1", "[", "arg_6", "]", "arg_8", "=", "numpy", ".", "count_nonzero", "(", "arg_7", ">", "arg_5", ")", "arg_9", "=", "numpy", ".", "where", "(", "arg_7", "==", "arg_5", ")", "arg_10", "=", "arg_6", "[", "arg_9", "]", "arg_11", "=", "numpy", ".", "count_nonzero", "(", "arg_3", "[", "arg_10", "]", ")", "arg_12", "=", "int", "(", "0.5", "+", "arg_2", "*", "len", "(", "arg_6", ")", ")", "if", "arg_8", "+", "arg_11", "<", "arg_12", ":", "arg_3", "[", "arg_4", "]", "=", "True", "return", "arg_3", ".", "nonzero", "(", ")", "[", "0", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Performs local inhibition. Local inhibition is performed on a column by\n    column basis. Each column observes the overlaps of its neighbors and is\n    selected if its overlap score is within the top 'numActive' in its local\n    neighborhood. At most half of the columns in a local neighborhood are\n    allowed to be active. Columns with an overlap score below the\n    'stimulusThreshold' are always inhibited.\n\n    :param overlaps: an array containing the overlap score for each  column.\n                    The overlap score for a column is defined as the number\n                    of synapses in a \"connected state\" (connected synapses)\n                    that are connected to input bits which are turned on.\n    :param density: The fraction of columns to survive inhibition. This\n                    value is only an intended target. Since the surviving\n                    columns are picked in a local fashion, the exact fraction\n                    of surviving columns is likely to vary.\n    @return list with indices of the winning columns\n    \"\"\"\n\n    arg_3 = numpy.zeros(arg_0._numColumns, dtype=\"bool\")\n\n    for arg_4, arg_5 in enumerate(arg_1):\n      if arg_5 >= arg_0._stimulusThreshold:\n        arg_6 = arg_0._getColumnNeighborhood(arg_4)\n        arg_7 = arg_1[arg_6]\n\n        arg_8 = numpy.count_nonzero(arg_7 > arg_5)\n\n        # When there is a tie, favor neighbors that are already selected as\n        # active.\n        arg_9 = numpy.where(arg_7 == arg_5)\n        arg_10 = arg_6[arg_9]\n        arg_11 = numpy.count_nonzero(arg_3[arg_10])\n\n        arg_12 = int(0.5 + arg_2 * len(arg_6))\n        if arg_8 + arg_11 < arg_12:\n          arg_3[arg_4] = True\n\n    return arg_3.nonzero()[0]", "path": "src/nupic/algorithms/spatial_pooler.py", "identifier": "SpatialPooler._inhibitColumnsLocal", "docstring": "Performs local inhibition. Local inhibition is performed on a column by\n    column basis. Each column observes the overlaps of its neighbors and is\n    selected if its overlap score is within the top 'numActive' in its local\n    neighborhood. At most half of the columns in a local neighborhood are\n    allowed to be active. Columns with an overlap score below the\n    'stimulusThreshold' are always inhibited.\n\n    :param overlaps: an array containing the overlap score for each  column.\n                    The overlap score for a column is defined as the number\n                    of synapses in a \"connected state\" (connected synapses)\n                    that are connected to input bits which are turned on.\n    :param density: The fraction of columns to survive inhibition. This\n                    value is only an intended target. Since the surviving\n                    columns are picked in a local fashion, the exact fraction\n                    of surviving columns is likely to vary.\n    @return list with indices of the winning columns", "docstring_tokens": ["Performs", "local", "inhibition", ".", "Local", "inhibition", "is", "performed", "on", "a", "column", "by", "column", "basis", ".", "Each", "column", "observes", "the", "overlaps", "of", "its", "neighbors", "and", "is", "selected", "if", "its", "overlap", "score", "is", "within", "the", "top", "numActive", "in", "its", "local", "neighborhood", ".", "At", "most", "half", "of", "the", "columns", "in", "a", "local", "neighborhood", "are", "allowed", "to", "be", "active", ".", "Columns", "with", "an", "overlap", "score", "below", "the", "stimulusThreshold", "are", "always", "inhibited", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257616}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/aiff.py#L261-L301", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Save ID3v2 data to the AIFF file", "language": "python", "parameters": "(self, filename=None, v2_version=4, v23_sep='/')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "4", ",", "arg_3", "=", "'/'", ")", ":", "arg_4", "=", "arg_0", ".", "_prepare_framedata", "(", "arg_2", ",", "arg_3", ")", "arg_5", "=", "len", "(", "arg_4", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "filename", "arg_6", "=", "open", "(", "arg_1", ",", "'rb+'", ")", "arg_7", "=", "IFFFile", "(", "arg_6", ")", "try", ":", "if", "u'ID3'", "not", "in", "arg_7", ":", "arg_7", ".", "insert_chunk", "(", "u'ID3'", ")", "arg_8", "=", "arg_7", "[", "u'ID3'", "]", "arg_6", ".", "seek", "(", "arg_8", ".", "data_offset", ")", "arg_9", "=", "arg_6", ".", "read", "(", "10", ")", "arg_9", "=", "arg_0", ".", "_prepare_id3_header", "(", "arg_9", ",", "arg_5", ",", "arg_2", ")", "arg_9", ",", "arg_10", ",", "arg_11", "=", "arg_9", "arg_12", "=", "arg_9", "+", "arg_4", "+", "(", "b'\\x00'", "*", "(", "arg_10", "-", "arg_5", ")", ")", "arg_10", "+=", "10", "if", "arg_10", ">", "arg_8", ".", "size", ":", "arg_13", "=", "arg_8", ".", "offset", "+", "arg_8", ".", "size", "arg_14", "=", "arg_10", "-", "arg_8", ".", "size", "+", "arg_10", "%", "2", "insert_bytes", "(", "arg_6", ",", "arg_14", ",", "arg_13", ")", "arg_8", ".", "resize", "(", "arg_10", ")", "arg_6", ".", "seek", "(", "arg_8", ".", "data_offset", ")", "arg_6", ".", "write", "(", "arg_12", ")", "finally", ":", "arg_6", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=4, arg_3='/'):\n        \"\"\"Save ID3v2 data to the AIFF file\"\"\"\n\n        arg_4 = arg_0._prepare_framedata(arg_2, arg_3)\n        arg_5 = len(arg_4)\n\n        if arg_1 is None:\n            arg_1 = arg_0.filename\n\n        # Unlike the parent ID3.Func method, we won't Func to a blank file\n        # since we would have to construct a empty AIFF file\n        arg_6 = open(arg_1, 'rb+')\n        arg_7 = IFFFile(arg_6)\n\n        try:\n            if u'ID3' not in arg_7:\n                arg_7.insert_chunk(u'ID3')\n\n            arg_8 = arg_7[u'ID3']\n            arg_6.seek(arg_8.data_offset)\n\n            arg_9 = arg_6.read(10)\n            arg_9 = arg_0._prepare_id3_header(arg_9, arg_5, arg_2)\n            arg_9, arg_10, arg_11 = arg_9\n\n            arg_12 = arg_9 + arg_4 + (b'\\x00' * (arg_10 - arg_5))\n\n            # Include ID3 header size in 'new_size' calculation\n            arg_10 += 10\n\n            # Expand the chunk if necessary, including pad byte\n            if arg_10 > arg_8.size:\n                arg_13 = arg_8.offset + arg_8.size\n                arg_14 = arg_10 - arg_8.size + arg_10 % 2\n                insert_bytes(arg_6, arg_14, arg_13)\n                arg_8.resize(arg_10)\n\n            arg_6.seek(arg_8.data_offset)\n            arg_6.write(arg_12)\n        finally:\n            arg_6.close()", "path": "mutagen/aiff.py", "identifier": "_IFFID3.save", "docstring": "Save ID3v2 data to the AIFF file", "docstring_tokens": ["Save", "ID3v2", "data", "to", "the", "AIFF", "file"], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 257617}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L1267-L1270", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "return the signed string with token.", "language": "python", "parameters": "(self, request, httpclient)", "return_statement": "return 'WRAP access_token=\"' + \\\n                self._get_token(request.host, request.path, httpclient) + '\"'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "'WRAP access_token=\"'", "+", "arg_0", ".", "_get_token", "(", "arg_1", ".", "host", ",", "arg_1", ".", "path", ",", "arg_2", ")", "+", "'\"'"], "function": "def Func(arg_0, arg_1, arg_2):\n        ''' return the signed string with token. '''\n        return 'WRAP access_token=\"' + \\\n                arg_0._get_token(arg_1.host, arg_1.path, arg_2) + '\"'", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusWrapTokenAuthentication._get_authorization", "docstring": "return the signed string with token.", "docstring_tokens": ["return", "the", "signed", "string", "with", "token", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257618}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L415-L505", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Validate `data` and return a iterator over problems found.", "language": "python", "parameters": "(self, data,\n                 expect_header_row=True,\n                 ignore_lines=0,\n                 summarize=False,\n                 context=None,\n                 report_unexpected_exceptions=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "0", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ")", ":", "arg_7", "=", "arg_0", ".", "_init_unique_sets", "(", ")", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_1", ")", ":", "if", "arg_2", "and", "arg_8", "==", "arg_3", ":", "for", "arg_10", "in", "arg_0", ".", "_apply_header_checks", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_5", ")", ":", "yield", "arg_10", "elif", "arg_8", ">=", "arg_3", ":", "arg_11", "=", "False", "for", "arg_10", "in", "arg_0", ".", "_apply_skips", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "if", "arg_10", "is", "True", ":", "arg_11", "=", "True", "else", ":", "yield", "arg_10", "if", "not", "arg_11", ":", "for", "arg_10", "in", "arg_0", ".", "_apply_each_methods", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_value_checks", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_record_length_checks", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_value_predicates", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_record_checks", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_record_predicates", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_unique_checks", "(", "arg_8", ",", "arg_9", ",", "arg_7", ",", "arg_4", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_check_methods", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_assert_methods", "(", "arg_8", ",", "arg_9", ",", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10", "for", "arg_10", "in", "arg_0", ".", "_apply_finally_assert_methods", "(", "arg_4", ",", "arg_6", ",", "arg_5", ")", ":", "yield", "arg_10"], "function": "def Func(arg_0, arg_1,\n                 arg_2=True,\n                 arg_3=0,\n                 arg_4=False,\n                 arg_5=None,\n                 arg_6=True):\n        \"\"\"\n        Validate `data` and return a iterator over problems found.\n\n        Use this function rather than validate() if you expect a large number\n        of problems.\n\n        Arguments\n        ---------\n\n        `data` - any source of row-oriented data, e.g., as provided by a\n        `csv.reader`, or a list of lists of strings, or ...\n\n        `expect_header_row` - does the data contain a header row (i.e., the\n        first record is a list of field names)? Defaults to True.\n\n        `ignore_lines` - ignore n lines (rows) at the beginning of the data\n\n        `summarize` - only report problem codes, no other details\n\n        `context` - a dictionary of any additional information to be added to\n        any problems found - useful if problems are being aggregated from\n        multiple validators\n\n        `report_unexpected_exceptions` - value check function, value predicates,\n        record check functions, record predicates, and other user-supplied\n        validation functions may raise unexpected exceptions. If this argument\n        is true, any unexpected exceptions will be reported as validation\n        problems; if False, unexpected exceptions will be handled silently.\n\n        \"\"\"\n\n        arg_7 = arg_0._init_unique_sets() # used for unique checks\n        for arg_8, arg_9 in enumerate(arg_1):\n            if arg_2 and arg_8 == arg_3:\n                # r is the header row\n                for arg_10 in arg_0._apply_header_checks(arg_8, arg_9, arg_4, arg_5):\n                    yield arg_10\n            elif arg_8 >= arg_3:\n                # r is a data row\n                arg_11 = False\n                for arg_10 in arg_0._apply_skips(arg_8, arg_9, arg_4,\n                                                  arg_6,\n                                                  arg_5):\n                    if arg_10 is True:\n                        arg_11 = True\n                    else:\n                        yield arg_10\n                if not arg_11:\n                    for arg_10 in arg_0._apply_each_methods(arg_8, arg_9, arg_4,\n                                                      arg_6,\n                                                      arg_5):\n                        yield arg_10 # may yield a problem if an exception is raised\n                    for arg_10 in arg_0._apply_value_checks(arg_8, arg_9, arg_4,\n                                                      arg_6,\n                                                      arg_5):\n                        yield arg_10\n                    for arg_10 in arg_0._apply_record_length_checks(arg_8, arg_9, arg_4,\n                                                              arg_5):\n                        yield arg_10\n                    for arg_10 in arg_0._apply_value_predicates(arg_8, arg_9, arg_4,\n                                                          arg_6,\n                                                          arg_5):\n                        yield arg_10\n                    for arg_10 in arg_0._apply_record_checks(arg_8, arg_9, arg_4,\n                                                           arg_6,\n                                                           arg_5):\n                        yield arg_10\n                    for arg_10 in arg_0._apply_record_predicates(arg_8, arg_9, arg_4,\n                                                           arg_6,\n                                                           arg_5):\n                        yield arg_10\n                    for arg_10 in arg_0._apply_unique_checks(arg_8, arg_9, arg_7, arg_4):\n                        yield arg_10\n                    for arg_10 in arg_0._apply_check_methods(arg_8, arg_9, arg_4,\n                                                       arg_6,\n                                                       arg_5):\n                        yield arg_10\n                    for arg_10 in arg_0._apply_assert_methods(arg_8, arg_9, arg_4,\n                                                        arg_6,\n                                                        arg_5):\n                        yield arg_10\n        for arg_10 in arg_0._apply_finally_assert_methods(arg_4,\n                                                    arg_6,\n                                                    arg_5):\n            yield arg_10", "path": "csvvalidator.py", "identifier": "CSVValidator.ivalidate", "docstring": "Validate `data` and return a iterator over problems found.\n\n        Use this function rather than validate() if you expect a large number\n        of problems.\n\n        Arguments\n        ---------\n\n        `data` - any source of row-oriented data, e.g., as provided by a\n        `csv.reader`, or a list of lists of strings, or ...\n\n        `expect_header_row` - does the data contain a header row (i.e., the\n        first record is a list of field names)? Defaults to True.\n\n        `ignore_lines` - ignore n lines (rows) at the beginning of the data\n\n        `summarize` - only report problem codes, no other details\n\n        `context` - a dictionary of any additional information to be added to\n        any problems found - useful if problems are being aggregated from\n        multiple validators\n\n        `report_unexpected_exceptions` - value check function, value predicates,\n        record check functions, record predicates, and other user-supplied\n        validation functions may raise unexpected exceptions. If this argument\n        is true, any unexpected exceptions will be reported as validation\n        problems; if False, unexpected exceptions will be handled silently.", "docstring_tokens": ["Validate", "data", "and", "return", "a", "iterator", "over", "problems", "found", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 257619}
{"url": "https://github.com/mozilla/PyPOM/blob/1e7d7ac6e19ec2dac0ea04bad5f3daadbe0c43b8/src/pypom/page.py#L135-L139", "sha": "1e7d7ac6e19ec2dac0ea04bad5f3daadbe0c43b8", "docstring_summary": "Wait for the page to load.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "wait", ".", "until", "(", "lambda", "_", ":", "arg_0", ".", "loaded", ")", "arg_0", ".", "pm", ".", "hook", ".", "pypom_after_Func", "(", "page", "=", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Wait for the page to load.\"\"\"\n        arg_0.wait.until(lambda _: arg_0.loaded)\n        arg_0.pm.hook.pypom_after_Func(page=arg_0)\n        return arg_0", "path": "src/pypom/page.py", "identifier": "Page.wait_for_page_to_load", "docstring": "Wait for the page to load.", "docstring_tokens": ["Wait", "for", "the", "page", "to", "load", "."], "nwo": "mozilla/PyPOM", "score": 0.9276247857904453, "idx": 257620}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L961-L972", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Retrieve database hook. This is the actual Postgres or MySQL database hook\n        that uses proxy or connects directly to the Google Cloud SQL database.", "language": "python", "parameters": "(self)", "return_statement": "return self.db_hook", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "database_type", "==", "'postgres'", ":", "arg_0", ".", "db_hook", "=", "PostgresHook", "(", "postgres_conn_id", "=", "arg_0", ".", "db_conn_id", ",", "schema", "=", "arg_0", ".", "database", ")", "else", ":", "arg_0", ".", "db_hook", "=", "MySqlHook", "(", "mysql_conn_id", "=", "arg_0", ".", "db_conn_id", ",", "schema", "=", "arg_0", ".", "database", ")", "return", "arg_0", ".", "db_hook"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieve database hook. This is the actual Postgres or MySQL database hook\n        that uses proxy or connects directly to the Google Cloud SQL database.\n        \"\"\"\n        if arg_0.database_type == 'postgres':\n            arg_0.db_hook = PostgresHook(postgres_conn_id=arg_0.db_conn_id,\n                                        schema=arg_0.database)\n        else:\n            arg_0.db_hook = MySqlHook(mysql_conn_id=arg_0.db_conn_id,\n                                     schema=arg_0.database)\n        return arg_0.db_hook", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlDatabaseHook.get_database_hook", "docstring": "Retrieve database hook. This is the actual Postgres or MySQL database hook\n        that uses proxy or connects directly to the Google Cloud SQL database.", "docstring_tokens": ["Retrieve", "database", "hook", ".", "This", "is", "the", "actual", "Postgres", "or", "MySQL", "database", "hook", "that", "uses", "proxy", "or", "connects", "directly", "to", "the", "Google", "Cloud", "SQL", "database", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257621}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/cli.py#L226-L242", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "List all files from all storages for project.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_setup_osf", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "project", "(", "arg_0", ".", "project", ")", "for", "arg_3", "in", "arg_2", ".", "storages", ":", "arg_4", "=", "arg_3", ".", "name", "for", "arg_5", "in", "arg_3", ".", "files", ":", "arg_6", "=", "arg_5", ".", "path", "if", "arg_6", ".", "startswith", "(", "'/'", ")", ":", "arg_6", "=", "arg_6", "[", "1", ":", "]", "print", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_6", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"List all files from all storages for project.\n\n    If the project is private you need to specify a username.\n    \"\"\"\n    arg_1 = _setup_osf(arg_0)\n\n    arg_2 = arg_1.project(arg_0.project)\n\n    for arg_3 in arg_2.storages:\n        arg_4 = arg_3.name\n        for arg_5 in arg_3.files:\n            arg_6 = arg_5.path\n            if arg_6.startswith('/'):\n                arg_6 = arg_6[1:]\n\n            print(os.path.join(arg_4, arg_6))", "path": "osfclient/cli.py", "identifier": "list_", "docstring": "List all files from all storages for project.\n\n    If the project is private you need to specify a username.", "docstring_tokens": ["List", "all", "files", "from", "all", "storages", "for", "project", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 257622}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/edward2/generated_random_variables.py#L97-L145", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Wrap an existing distribution as a traceable random variable.", "language": "python", "parameters": "(distribution,\n                       sample_shape=(),\n                       value=None)", "return_statement": "return _build_custom_rv(distribution=distribution,\n                          sample_shape=sample_shape,\n                          value=value,\n                          name=_simple_name(distribution))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", ")", ",", "arg_2", "=", "None", ")", ":", "return", "_build_custom_rv", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "name", "=", "_simple_name", "(", "arg_0", ")", ")"], "function": "def Func(arg_0,\n                       arg_1=(),\n                       arg_2=None):\n  \"\"\"Wrap an existing distribution as a traceable random variable.\n\n  This enables the use of custom or user-provided distributions in\n  Edward models. Unlike a bare `RandomVariable` object, this method\n  wraps the constructor so it is included in the Edward trace and its\n  values can be properly intercepted and overridden.\n\n  Where possible, you should prefer the built-in constructors\n  (`ed.Normal`, etc); these simultaneously construct a Distribution\n  and a RandomVariable object so that the distribution parameters\n  themselves may be intercepted and overridden. RVs constructed via\n  `Func()` have a fixed distribution and may not support\n  program transformations (e.g, conjugate marginalization) that rely\n  on overriding distribution parameters.\n\n  Args:\n    distribution: tfd.Distribution governing the distribution of the random\n      variable, such as sampling and log-probabilities.\n    sample_shape: tf.TensorShape of samples to draw from the random variable.\n      Default is `()` corresponding to a single sample.\n    value: Fixed tf.Tensor to associate with random variable. Must have shape\n      `sample_shape + distribution.batch_shape + distribution.event_shape`.\n      Default is to sample from random variable according to `sample_shape`.\n\n  Returns:\n    rv: a `RandomVariable` wrapping the provided distribution.\n\n  #### Example\n\n  ```python\n  from tensorflow_probability import distributions as tfd\n  from tensorflow_probability import edward2 as ed\n\n  def model():\n    # equivalent to ed.Normal(0., 1., name='x')\n    return ed.Func(tfd.Normal(0., 1., name='x'))\n\n  log_joint = ed.make_log_joint_fn(model)\n  output = log_joint(x=2.)\n  ```\n  \"\"\"\n\n  return _build_custom_rv(arg_0=arg_0,\n                          arg_1=arg_1,\n                          arg_2=arg_2,\n                          name=_simple_name(arg_0))", "path": "tensorflow_probability/python/edward2/generated_random_variables.py", "identifier": "as_random_variable", "docstring": "Wrap an existing distribution as a traceable random variable.\n\n  This enables the use of custom or user-provided distributions in\n  Edward models. Unlike a bare `RandomVariable` object, this method\n  wraps the constructor so it is included in the Edward trace and its\n  values can be properly intercepted and overridden.\n\n  Where possible, you should prefer the built-in constructors\n  (`ed.Normal`, etc); these simultaneously construct a Distribution\n  and a RandomVariable object so that the distribution parameters\n  themselves may be intercepted and overridden. RVs constructed via\n  `as_random_variable()` have a fixed distribution and may not support\n  program transformations (e.g, conjugate marginalization) that rely\n  on overriding distribution parameters.\n\n  Args:\n    distribution: tfd.Distribution governing the distribution of the random\n      variable, such as sampling and log-probabilities.\n    sample_shape: tf.TensorShape of samples to draw from the random variable.\n      Default is `()` corresponding to a single sample.\n    value: Fixed tf.Tensor to associate with random variable. Must have shape\n      `sample_shape + distribution.batch_shape + distribution.event_shape`.\n      Default is to sample from random variable according to `sample_shape`.\n\n  Returns:\n    rv: a `RandomVariable` wrapping the provided distribution.\n\n  #### Example\n\n  ```python\n  from tensorflow_probability import distributions as tfd\n  from tensorflow_probability import edward2 as ed\n\n  def model():\n    # equivalent to ed.Normal(0., 1., name='x')\n    return ed.as_random_variable(tfd.Normal(0., 1., name='x'))\n\n  log_joint = ed.make_log_joint_fn(model)\n  output = log_joint(x=2.)\n  ```", "docstring_tokens": ["Wrap", "an", "existing", "distribution", "as", "a", "traceable", "random", "variable", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257623}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/decorators.py#L95-L144", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Caches the HTML returned by the specified function `func`. Caches it in\n    the user cache determined by the appdirs package.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "appdirs", ".", "user_Func_dir", "(", "'sportsref'", ",", "getpass", ".", "getuser", "(", ")", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "os", ".", "makedirs", "(", "arg_1", ")", "@", "funcutils", ".", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_2", ")", ":", "arg_3", "=", "hashlib", ".", "md5", "(", ")", "arg_4", "=", "arg_2", ".", "encode", "(", "errors", "=", "'replace'", ")", "arg_3", ".", "update", "(", "arg_4", ")", "arg_3", "=", "arg_3", ".", "hexdigest", "(", ")", "arg_5", "=", "'{}/{}'", ".", "format", "(", "arg_1", ",", "arg_3", ")", "arg_6", "=", "None", "for", "arg_7", ",", "arg_8", "in", "sportsref", ".", "SITE_ABBREV", ".", "items", "(", ")", ":", "if", "arg_2", ".", "startswith", "(", "arg_7", ")", ":", "arg_6", "=", "arg_8", "break", "else", ":", "print", "(", "'No sport ID found for {}, not able to check Func'", ".", "format", "(", "arg_2", ")", ")", "arg_9", "=", "os", ".", "path", ".", "isfile", "(", "arg_5", ")", "if", "arg_6", "and", "arg_9", ":", "arg_10", "=", "int", "(", "time", ".", "time", "(", ")", ")", "arg_11", "=", "int", "(", "os", ".", "path", ".", "getmtime", "(", "arg_5", ")", ")", "arg_12", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "(", "arg_10", "-", "arg_11", ")", ")", ".", "days", "arg_13", "=", "globals", "(", ")", "[", "'_days_valid_{}'", ".", "format", "(", "arg_6", ")", "]", "(", "arg_2", ")", "arg_14", "=", "arg_12", "<", "arg_13", "else", ":", "arg_14", "=", "False", "arg_15", "=", "sportsref", ".", "get_option", "(", "'Func'", ")", "if", "arg_9", "and", "arg_14", "and", "arg_15", ":", "with", "codecs", ".", "open", "(", "arg_5", ",", "'r'", ",", "encoding", "=", "'utf-8'", ",", "errors", "=", "'replace'", ")", "as", "f", ":", "arg_16", "=", "f", ".", "read", "(", ")", "else", ":", "arg_16", "=", "arg_0", "(", "arg_2", ")", "with", "codecs", ".", "open", "(", "arg_5", ",", "'w+'", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_16", ")", "return", "arg_16", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Caches the HTML returned by the specified function `func`. Caches it in\n    the user Func determined by the appdirs package.\n    \"\"\"\n\n    arg_1 = appdirs.user_Func_dir('sportsref', getpass.getuser())\n    if not os.path.isdir(arg_1):\n        os.makedirs(arg_1)\n\n    @funcutils.wraps(arg_0)\n    def wrapper(arg_2):\n        # hash based on the URL\n        arg_3 = hashlib.md5()\n        arg_4 = arg_2.encode(errors='replace')\n        arg_3.update(arg_4)\n        arg_3 = arg_3.hexdigest()\n        arg_5 = '{}/{}'.format(arg_1, arg_3)\n\n        arg_6 = None\n        for arg_7, arg_8 in sportsref.SITE_ABBREV.items():\n            if arg_2.startswith(arg_7):\n                arg_6 = arg_8\n                break\n        else:\n            print('No sport ID found for {}, not able to check Func'.format(arg_2))\n\n        # check whether Func is valid or stale\n        arg_9 = os.path.isfile(arg_5)\n        if arg_6 and arg_9:\n            arg_10 = int(time.time())\n            arg_11 = int(os.path.getmtime(arg_5))\n            arg_12 = datetime.timedelta(seconds=(arg_10 - arg_11)).days\n            arg_13 = globals()['_days_valid_{}'.format(arg_6)](arg_2)\n            arg_14 = arg_12 < arg_13\n        else:\n            arg_14 = False\n\n        # if file found and Func is valid, read from file\n        arg_15 = sportsref.get_option('Func')\n        if arg_9 and arg_14 and arg_15:\n            with codecs.open(arg_5, 'r', encoding='utf-8', errors='replace') as f:\n                arg_16 = f.read()\n        # otherwise, execute function and Func results\n        else:\n            arg_16 = arg_0(arg_2)\n            with codecs.open(arg_5, 'w+', encoding='utf-8') as f:\n                f.write(arg_16)\n        return arg_16\n\n    return wrapper", "path": "sportsref/decorators.py", "identifier": "cache", "docstring": "Caches the HTML returned by the specified function `func`. Caches it in\n    the user cache determined by the appdirs package.", "docstring_tokens": ["Caches", "the", "HTML", "returned", "by", "the", "specified", "function", "func", ".", "Caches", "it", "in", "the", "user", "cache", "determined", "by", "the", "appdirs", "package", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 257624}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/attic.py#L30-L37", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Check for presence of mutually exclusive keys in a dict.", "language": "python", "parameters": "(dict,ex_op)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ":", "if", "arg_2", "in", "arg_0", "and", "arg_3", "in", "arg_0", ":", "raise", "ValueError", ",", "'\\n*** ERROR in Arguments *** '", "'Options '", "+", "arg_2", "+", "' and '", "+", "arg_3", "+", "' are mutually exclusive.'"], "function": "def Func(arg_0,arg_1):\n    \"\"\"Check for presence of mutually exclusive keys in a dict.\n\n    Call: Func(dict,[[op1a,op1b],[op2a,op2b]...]\"\"\"\n    for arg_2,arg_3 in arg_1:\n        if arg_2 in arg_0 and arg_3 in arg_0:\n            raise ValueError,'\\n*** ERROR in Arguments *** '\\\n                  'Options '+arg_2+' and '+arg_3+' are mutually exclusive.'", "path": "environment/lib/python2.7/site-packages/IPython/utils/attic.py", "identifier": "mutex_opts", "docstring": "Check for presence of mutually exclusive keys in a dict.\n\n    Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]", "docstring_tokens": ["Check", "for", "presence", "of", "mutually", "exclusive", "keys", "in", "a", "dict", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257625}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/modify.py#L10-L24", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Creates a tempfile and starts the given editor, returns the data afterwards.", "language": "python", "parameters": "(data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "tempfile", ".", "NamedTemporaryFile", "(", "'w'", ")", "as", "f", ":", "for", "arg_1", "in", "arg_0", ":", "f", ".", "write", "(", "json", ".", "dumps", "(", "arg_1", ".", "to_dict", "(", "include_meta", "=", "True", ")", ",", "default", "=", "datetime_handler", ")", ")", "f", ".", "write", "(", "'\\n'", ")", "f", ".", "flush", "(", ")", "print_success", "(", "\"Starting editor\"", ")", "subprocess", ".", "call", "(", "[", "'nano'", ",", "'-'", ",", "f", ".", "name", "]", ")", "with", "open", "(", "f", ".", "name", ",", "'r'", ")", "as", "f", ":", "return", "f", ".", "readlines", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n        Creates a tempfile and starts the given editor, returns the data afterwards.\n    \"\"\"\n    with tempfile.NamedTemporaryFile('w') as f:\n        for arg_1 in arg_0:\n            f.write(json.dumps(arg_1.to_dict(\n                include_meta=True),\n                default=datetime_handler))\n            f.write('\\n')\n        f.flush()\n        print_success(\"Starting editor\")\n        subprocess.call(['nano', '-', f.name])\n        with open(f.name, 'r') as f:\n            return f.readlines()", "path": "jackal/scripts/modify.py", "identifier": "modify_data", "docstring": "Creates a tempfile and starts the given editor, returns the data afterwards.", "docstring_tokens": ["Creates", "a", "tempfile", "and", "starts", "the", "given", "editor", "returns", "the", "data", "afterwards", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 257626}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L1915-L1946", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a parallel worker for running period-recovery.", "language": "python", "parameters": "(task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "try", ":", "return", "periodicvar_recovery", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'periodic var recovery failed for %s'", "%", "repr", "(", "arg_0", ")", ")", "return", "None"], "function": "def Func(arg_0):\n    '''This is a parallel worker for running period-recovery.\n\n    Parameters\n    ----------\n\n    task : tuple\n        This is used to pass args to the `periodicvar_recovery` function::\n\n            task[0] = period-finding result pickle to work on\n            task[1] = simbasedir\n            task[2] = period_tolerance\n\n    Returns\n    -------\n\n    dict\n        This is the dict produced by the `periodicvar_recovery` function for the\n        input period-finding result pickle.\n\n    '''\n\n    arg_1, arg_2, arg_3 = arg_0\n\n    try:\n        return periodicvar_recovery(arg_1,\n                                    arg_2,\n                                    arg_3=arg_3)\n\n    except Exception as e:\n        LOGEXCEPTION('periodic var recovery failed for %s' % repr(arg_0))\n        return None", "path": "astrobase/fakelcs/recovery.py", "identifier": "periodrec_worker", "docstring": "This is a parallel worker for running period-recovery.\n\n    Parameters\n    ----------\n\n    task : tuple\n        This is used to pass args to the `periodicvar_recovery` function::\n\n            task[0] = period-finding result pickle to work on\n            task[1] = simbasedir\n            task[2] = period_tolerance\n\n    Returns\n    -------\n\n    dict\n        This is the dict produced by the `periodicvar_recovery` function for the\n        input period-finding result pickle.", "docstring_tokens": ["This", "is", "a", "parallel", "worker", "for", "running", "period", "-", "recovery", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257627}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/base_instance.py#L74-L99", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Log message, optionally providing a logging level", "language": "python", "parameters": "(self, message, level=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_3", "=", "Funcging", ".", "INFO", "else", ":", "if", "arg_2", "==", "\"trace\"", "or", "arg_2", "==", "\"debug\"", ":", "arg_3", "=", "Funcging", ".", "DEBUG", "elif", "arg_2", "==", "\"info\"", ":", "arg_3", "=", "Funcging", ".", "INFO", "elif", "arg_2", "==", "\"warn\"", ":", "arg_3", "=", "Funcging", ".", "WARNING", "elif", "arg_2", "==", "\"error\"", ":", "arg_3", "=", "Funcging", ".", "ERROR", "else", ":", "raise", "ValueError", "(", "\"%s is not supported as Funcging level\"", "%", "str", "(", "arg_2", ")", ")", "arg_0", ".", "Funcger", ".", "Func", "(", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Log message, optionally providing a Funcging level\n\n    It is compatible with StreamParse API.\n\n    :type message: str\n    :param message: the Func message to send\n    :type level: str\n    :param level: the Funcging level,\n                  one of: trace (=debug), debug, info, warn or error (default: info)\n    \"\"\"\n    if arg_2 is None:\n      arg_3 = Funcging.INFO\n    else:\n      if arg_2 == \"trace\" or arg_2 == \"debug\":\n        arg_3 = Funcging.DEBUG\n      elif arg_2 == \"info\":\n        arg_3 = Funcging.INFO\n      elif arg_2 == \"warn\":\n        arg_3 = Funcging.WARNING\n      elif arg_2 == \"error\":\n        arg_3 = Funcging.ERROR\n      else:\n        raise ValueError(\"%s is not supported as Funcging level\" % str(arg_2))\n\n    arg_0.Funcger.Func(arg_3, arg_1)", "path": "heron/instance/src/python/basics/base_instance.py", "identifier": "BaseInstance.log", "docstring": "Log message, optionally providing a logging level\n\n    It is compatible with StreamParse API.\n\n    :type message: str\n    :param message: the log message to send\n    :type level: str\n    :param level: the logging level,\n                  one of: trace (=debug), debug, info, warn or error (default: info)", "docstring_tokens": ["Log", "message", "optionally", "providing", "a", "logging", "level"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257628}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1000-L1007", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Get the number of factor levels for each categorical column.", "language": "python", "parameters": "(self)", "return_statement": "return [len(l) for l in levels] if levels else 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "levels", "(", ")", "return", "[", "len", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]", "if", "arg_1", "else", "0"], "function": "def Func(arg_0):\n        \"\"\"\n        Get the number of factor levels for each categorical column.\n\n        :returns: A list of the number of levels per column.\n        \"\"\"\n        arg_1 = arg_0.levels()\n        return [len(arg_2) for arg_2 in arg_1] if arg_1 else 0", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.nlevels", "docstring": "Get the number of factor levels for each categorical column.\n\n        :returns: A list of the number of levels per column.", "docstring_tokens": ["Get", "the", "number", "of", "factor", "levels", "for", "each", "categorical", "column", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257629}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/__init__.py#L396-L421", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Check the syntax of the given URL.", "language": "python", "parameters": "(url)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "and", "isinstance", "(", "arg_0", ",", "str", ")", ":", "load_config", "(", "True", ")", "return", "Check", "(", "arg_0", ")", ".", "is_url_valid", "(", ")", "return", "None"], "function": "def Func(arg_0):  # pragma: no cover\n    \"\"\"\n    Check the syntax of the given URL.\n\n    :param url: The URL to check the syntax for.\n    :type url: str\n\n    :return: The syntax validity.\n    :rtype: bool\n\n    .. warning::\n        If an empty or a non-string :code:`url` is given, we return :code:`None`.\n    \"\"\"\n\n    if arg_0 and isinstance(arg_0, str):\n        # The given URL is not empty nor None.\n        # and\n        # * The given URL is a string.\n\n        # We silently load the configuration.\n        load_config(True)\n\n        return Check(arg_0).is_url_valid()\n\n    # We return None, there is nothing to check.\n    return None", "path": "PyFunceble/__init__.py", "identifier": "url_syntax_check", "docstring": "Check the syntax of the given URL.\n\n    :param url: The URL to check the syntax for.\n    :type url: str\n\n    :return: The syntax validity.\n    :rtype: bool\n\n    .. warning::\n        If an empty or a non-string :code:`url` is given, we return :code:`None`.", "docstring_tokens": ["Check", "the", "syntax", "of", "the", "given", "URL", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 257630}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/transformed_kernel.py#L42-L53", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Makes a function which applies a list of Bijectors' `log_det_jacobian`s.", "language": "python", "parameters": "(bijector)", "return_statement": "return fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "mcmc_util", ".", "is_list_like", "(", "arg_0", ")", ":", "arg_0", "=", "[", "arg_0", "]", "def", "fn", "(", "arg_1", ",", "arg_2", ")", ":", "return", "sum", "(", "[", "arg_3", ".", "forward_log_det_jacobian", "(", "arg_5", ",", "arg_2", "=", "arg_4", ")", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "zip", "(", "arg_0", ",", "arg_2", ",", "arg_1", ")", "]", ")", "return", "fn"], "function": "def Func(arg_0):\n  \"\"\"Makes a function which applies a list of Bijectors' `log_det_jacobian`s.\"\"\"\n  if not mcmc_util.is_list_like(arg_0):\n    arg_0 = [arg_0]\n\n  def fn(arg_1, arg_2):\n    return sum([\n        arg_3.forward_log_det_jacobian(arg_5, arg_2=arg_4)\n        for arg_3, arg_4, arg_5 in zip(arg_0, arg_2, arg_1)\n    ])\n\n  return fn", "path": "tensorflow_probability/python/mcmc/transformed_kernel.py", "identifier": "forward_log_det_jacobian_fn", "docstring": "Makes a function which applies a list of Bijectors' `log_det_jacobian`s.", "docstring_tokens": ["Makes", "a", "function", "which", "applies", "a", "list", "of", "Bijectors", "log_det_jacobian", "s", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257631}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L139-L166", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Destructively rips this element out of the tree.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "parent", ":", "try", ":", "arg_0", ".", "parent", ".", "contents", ".", "remove", "(", "arg_0", ")", "except", "ValueError", ":", "pass", "arg_1", "=", "arg_0", ".", "_lastRecursiveChild", "(", ")", "arg_2", "=", "arg_1", ".", "next", "if", "arg_0", ".", "previous", ":", "arg_0", ".", "previous", ".", "next", "=", "arg_2", "if", "arg_2", ":", "arg_2", ".", "previous", "=", "arg_0", ".", "previous", "arg_0", ".", "previous", "=", "None", "arg_1", ".", "next", "=", "None", "arg_0", ".", "parent", "=", "None", "if", "arg_0", ".", "previousSibling", ":", "arg_0", ".", "previousSibling", ".", "nextSibling", "=", "arg_0", ".", "nextSibling", "if", "arg_0", ".", "nextSibling", ":", "arg_0", ".", "nextSibling", ".", "previousSibling", "=", "arg_0", ".", "previousSibling", "arg_0", ".", "previousSibling", "=", "arg_0", ".", "nextSibling", "=", "None", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Destructively rips this element out of the tree.\"\"\"\n        if arg_0.parent:\n            try:\n                arg_0.parent.contents.remove(arg_0)\n            except ValueError:\n                pass\n\n        #Find the two elements that would be next to each other if\n        #this element (and any children) hadn't been parsed. Connect\n        #the two.\n        arg_1 = arg_0._lastRecursiveChild()\n        arg_2 = arg_1.next\n\n        if arg_0.previous:\n            arg_0.previous.next = arg_2\n        if arg_2:\n            arg_2.previous = arg_0.previous\n        arg_0.previous = None\n        arg_1.next = None\n\n        arg_0.parent = None\n        if arg_0.previousSibling:\n            arg_0.previousSibling.nextSibling = arg_0.nextSibling\n        if arg_0.nextSibling:\n            arg_0.nextSibling.previousSibling = arg_0.previousSibling\n        arg_0.previousSibling = arg_0.nextSibling = None\n        return arg_0", "path": "lib/web/BeautifulSoup.py", "identifier": "PageElement.extract", "docstring": "Destructively rips this element out of the tree.", "docstring_tokens": ["Destructively", "rips", "this", "element", "out", "of", "the", "tree", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257632}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/stats_server.py#L87-L107", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Starts HTTP server with specified parameters.", "language": "python", "parameters": "(host, port, profiler_stats, dont_start_browser, debug_mode)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "functools", ".", "partial", "(", "StatsHandler", ",", "arg_2", ")", "if", "not", "arg_4", ":", "arg_6", ".", "stderr", "=", "open", "(", "os", ".", "devnull", ",", "'w'", ")", "print", "(", "'Starting HTTP server...'", ")", "if", "not", "arg_3", ":", "webbrowser", ".", "open", "(", "'http://{}:{}/'", ".", "format", "(", "arg_0", ",", "arg_1", ")", ")", "try", ":", "StatsServer", "(", "(", "arg_0", ",", "arg_1", ")", ",", "arg_5", ")", ".", "serve_forever", "(", ")", "except", "KeyboardInterrupt", ":", "print", "(", "'Stopping...'", ")", "arg_6", ".", "exit", "(", "0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Starts HTTP server with specified parameters.\n\n    Args:\n        host: Server host name.\n        port: Server port.\n        profiler_stats: A dict with collected program stats.\n        dont_Func_browser: Whether to open browser after profiling.\n        debug_mode: Whether to redirect stderr to /dev/null.\n    \"\"\"\n    arg_5 = functools.partial(StatsHandler, arg_2)\n    if not arg_4:\n        arg_6.stderr = open(os.devnull, 'w')\n    print('Starting HTTP server...')\n    if not arg_3:\n        webbrowser.open('http://{}:{}/'.format(arg_0, arg_1))\n    try:\n        StatsServer((arg_0, arg_1), arg_5).serve_forever()\n    except KeyboardInterrupt:\n        print('Stopping...')\n        arg_6.exit(0)", "path": "vprof/stats_server.py", "identifier": "start", "docstring": "Starts HTTP server with specified parameters.\n\n    Args:\n        host: Server host name.\n        port: Server port.\n        profiler_stats: A dict with collected program stats.\n        dont_start_browser: Whether to open browser after profiling.\n        debug_mode: Whether to redirect stderr to /dev/null.", "docstring_tokens": ["Starts", "HTTP", "server", "with", "specified", "parameters", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 257633}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L1129-L1151", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Updates an Event Hub.", "language": "python", "parameters": "(self, hub_name, hub=None)", "return_statement": "return _convert_response_to_event_hub(response)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "_validate_not_none", "(", "'hub_name'", ",", "arg_1", ")", "arg_3", "=", "HTTPRequest", "(", ")", "arg_3", ".", "method", "=", "'PUT'", "arg_3", ".", "host", "=", "arg_0", ".", "_get_host", "(", ")", "arg_3", ".", "path", "=", "'/'", "+", "_str", "(", "arg_1", ")", "+", "'?api-version=2014-01'", "arg_3", ".", "body", "=", "_get_request_body", "(", "_convert_event_hub_to_xml", "(", "arg_2", ")", ")", "arg_3", ".", "path", ",", "arg_3", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_3", ")", "arg_3", ".", "headers", ".", "append", "(", "(", "'If-Match'", ",", "'*'", ")", ")", "arg_3", ".", "headers", "=", "arg_0", ".", "_update_service_bus_header", "(", "arg_3", ")", "arg_10", "=", "arg_0", ".", "_perform_request", "(", "arg_3", ")", "return", "_convert_response_to_event_hub", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Updates an Event Hub.\n\n        hub_name:\n            Name of event hub.\n        hub:\n            Optional. Event hub properties. Instance of EventHub class.\n        hub.message_retention_in_days:\n            Number of days to retain the events for this Event Hub.\n        '''\n        _validate_not_none('hub_name', arg_1)\n        arg_3 = HTTPRequest()\n        arg_3.method = 'PUT'\n        arg_3.host = arg_0._get_host()\n        arg_3.path = '/' + _str(arg_1) + '?api-version=2014-01'\n        arg_3.body = _get_request_body(_convert_event_hub_to_xml(arg_2))\n        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)  # pylint: disable=protected-access\n        arg_3.headers.append(('If-Match', '*'))\n        arg_3.headers = arg_0._update_service_bus_header(arg_3)\n        arg_10 = arg_0._perform_request(arg_3)\n\n        return _convert_response_to_event_hub(arg_10)", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusService.update_event_hub", "docstring": "Updates an Event Hub.\n\n        hub_name:\n            Name of event hub.\n        hub:\n            Optional. Event hub properties. Instance of EventHub class.\n        hub.message_retention_in_days:\n            Number of days to retain the events for this Event Hub.", "docstring_tokens": ["Updates", "an", "Event", "Hub", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257634}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L3448-L3475", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Creates new or follows existing group nodes along a given colon separated `key`.", "language": "python", "parameters": "(self, key, start_hdf5_group=None)", "return_statement": "return newhdf5_group, created", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_3", "=", "arg_0", ".", "_trajectory_group", "else", ":", "arg_3", "=", "arg_2", "arg_4", "=", "False", "if", "arg_1", "==", "''", ":", "return", "arg_3", ",", "arg_4", "arg_5", "=", "arg_1", ".", "split", "(", "'.'", ")", "for", "arg_6", "in", "arg_5", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_all_create_or_get_group", "(", "arg_6", ",", "arg_3", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Creates new or follows existing group nodes along a given colon separated `key`.\n\n        :param key:\n\n            Colon separated path along hdf5 file, e.g. `parameters.mobiles.cars`.\n\n        :param start_hdf5_group:\n\n            HDF5 group from where to start, leave `None` for the trajectory group.\n\n        :return:\n\n            Final group node, e.g. group node with name `cars`.\n\n        \"\"\"\n        if arg_2 is None:\n            arg_3 = arg_0._trajectory_group\n        else:\n            arg_3 = arg_2\n        arg_4 = False\n        if arg_1 == '':\n            return arg_3, arg_4\n        arg_5 = arg_1.split('.')\n        for arg_6 in arg_5:\n            arg_3, arg_4 = arg_0._all_create_or_get_group(arg_6, arg_3)\n\n        return arg_3, arg_4", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._all_create_or_get_groups", "docstring": "Creates new or follows existing group nodes along a given colon separated `key`.\n\n        :param key:\n\n            Colon separated path along hdf5 file, e.g. `parameters.mobiles.cars`.\n\n        :param start_hdf5_group:\n\n            HDF5 group from where to start, leave `None` for the trajectory group.\n\n        :return:\n\n            Final group node, e.g. group node with name `cars`.", "docstring_tokens": ["Creates", "new", "or", "follows", "existing", "group", "nodes", "along", "a", "given", "colon", "separated", "key", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257635}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L191-L197", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns all valid python strings inside a given argument string.", "language": "python", "parameters": "(args)", "return_statement": "return string_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "ast", ".", "walk", "(", "ast", ".", "parse", "(", "arg_0", ")", ")", ":", "if", "isinstance", "(", "arg_2", ",", "ast", ".", "Str", ")", ":", "arg_1", ".", "append", "(", "arg_2", ".", "s", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns all valid python strings inside a given argument string.\"\"\"\n    arg_1 = []\n    for arg_2 in ast.walk(ast.parse(arg_0)):\n        if isinstance(arg_2, ast.Str):\n            arg_1.append(arg_2.s)\n    return arg_1", "path": "pypet/pypetlogging.py", "identifier": "get_strings", "docstring": "Returns all valid python strings inside a given argument string.", "docstring_tokens": ["Returns", "all", "valid", "python", "strings", "inside", "a", "given", "argument", "string", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257636}
{"url": "https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/date.py#L70-L87", "sha": "467e8a843ca9f882f8bb2958805b7293591996ad", "docstring_summary": "Calcul du profil annuel", "language": "python", "parameters": "(df, func='mean')", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'mean'", ")", ":", "arg_1", "=", "_get_funky", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "groupby", "(", "lambda", "x", ":", "x", ".", "month", ")", ".", "aggregate", "(", "arg_1", ")", "arg_2", ".", "index", "=", "[", "cal", ".", "month_name", "[", "i", "]", "for", "i", "in", "range", "(", "1", ",", "13", ")", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1='mean'):\n    \"\"\"\n    Calcul du profil annuel\n\n    Param\u00e8tres:\n    df: DataFrame de donn\u00e9es dont l'index est une s\u00e9rie temporelle\n        (cf module xair par exemple)\n    func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)\n        soit la fonction elle-m\u00eame (np.mean, np.max, ...)\n    Retourne:\n    Un DataFrame de moyennes par mois\n    \"\"\"\n\n    arg_1 = _get_funky(arg_1)\n    arg_2 = arg_0.groupby(lambda x: x.month).aggregate(arg_1)\n    # On met des noms de mois \u00e0 la place des num\u00e9ros dans l'index\n    arg_2.index = [cal.month_name[i] for i in range(1,13)]\n    return arg_2", "path": "pyair/date.py", "identifier": "profil_annuel", "docstring": "Calcul du profil annuel\n\n    Param\u00e8tres:\n    df: DataFrame de donn\u00e9es dont l'index est une s\u00e9rie temporelle\n        (cf module xair par exemple)\n    func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)\n        soit la fonction elle-m\u00eame (np.mean, np.max, ...)\n    Retourne:\n    Un DataFrame de moyennes par mois", "docstring_tokens": ["Calcul", "du", "profil", "annuel"], "nwo": "LionelR/pyair", "score": 0.12050106452410352, "idx": 257637}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L329-L338", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Processes a scheduled consumption request that has completed", "language": "python", "parameters": "(self, token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_tokens_to_scheduled_consumption", ".", "pop", "(", "arg_1", ")", "arg_0", ".", "_total_wait", "=", "max", "(", "arg_0", ".", "_total_wait", "-", "arg_2", "[", "'time_to_consume'", "]", ",", "0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Processes a scheduled consumption request that has completed\n\n        :type token: RequestToken\n        :param token: The token associated to the consumption\n            request that is used to identify the request.\n        \"\"\"\n        arg_2 = arg_0._tokens_to_scheduled_consumption.pop(arg_1)\n        arg_0._total_wait = max(\n            arg_0._total_wait - arg_2['time_to_consume'], 0)", "path": "s3transfer/bandwidth.py", "identifier": "ConsumptionScheduler.process_scheduled_consumption", "docstring": "Processes a scheduled consumption request that has completed\n\n        :type token: RequestToken\n        :param token: The token associated to the consumption\n            request that is used to identify the request.", "docstring_tokens": ["Processes", "a", "scheduled", "consumption", "request", "that", "has", "completed"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 257638}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L129-L133", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return a full path to a notebook given its name.", "language": "python", "parameters": "(self, name)", "return_statement": "return path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "+", "arg_0", ".", "filename_ext", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "notebook_dir", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a full path to a notebook given its name.\"\"\"\n        arg_2 = arg_1 + arg_0.filename_ext\n        arg_3 = os.path.join(arg_0.notebook_dir, arg_2)\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py", "identifier": "NotebookManager.get_path_by_name", "docstring": "Return a full path to a notebook given its name.", "docstring_tokens": ["Return", "a", "full", "path", "to", "a", "notebook", "given", "its", "name", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257639}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L317-L350", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Get the document short title in the specified markup format.", "language": "python", "parameters": "(self, format='html5', deparagraph=True,\n                           mathjax=False, smart=True, extra_args=None)", "return_statement": "return output_text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'html5'", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "if", "arg_0", ".", "short_title", "is", "None", ":", "return", "None", "arg_6", "=", "convert_lsstdoc_tex", "(", "arg_0", ".", "short_title", ",", "'html5'", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1='html5', arg_2=True,\n                           arg_3=False, arg_4=True, arg_5=None):\n        \"\"\"Get the document short title in the specified markup format.\n\n        Parameters\n        ----------\n        format : `str`, optional\n            Output format (such as ``'html5'`` or ``'plain'``).\n        deparagraph : `bool`, optional\n            Remove the paragraph tags from single paragraph content.\n        mathjax : `bool`, optional\n            Allow pandoc to use MathJax math markup.\n        smart : `True`, optional\n            Allow pandoc to create \"smart\" unicode punctuation.\n        extra_args : `list`, optional\n            Additional command line flags to pass to Pandoc. See\n            `lsstprojectmeta.pandoc.convert.convert_text`.\n\n        Returns\n        -------\n        output_text : `str`\n            Converted content or `None` if the short title is not available in\n            the document.\n        \"\"\"\n        if arg_0.short_title is None:\n            return None\n\n        arg_6 = convert_lsstdoc_tex(\n            arg_0.short_title, 'html5',\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5)\n        return arg_6", "path": "lsstprojectmeta/tex/lsstdoc.py", "identifier": "LsstLatexDoc.format_short_title", "docstring": "Get the document short title in the specified markup format.\n\n        Parameters\n        ----------\n        format : `str`, optional\n            Output format (such as ``'html5'`` or ``'plain'``).\n        deparagraph : `bool`, optional\n            Remove the paragraph tags from single paragraph content.\n        mathjax : `bool`, optional\n            Allow pandoc to use MathJax math markup.\n        smart : `True`, optional\n            Allow pandoc to create \"smart\" unicode punctuation.\n        extra_args : `list`, optional\n            Additional command line flags to pass to Pandoc. See\n            `lsstprojectmeta.pandoc.convert.convert_text`.\n\n        Returns\n        -------\n        output_text : `str`\n            Converted content or `None` if the short title is not available in\n            the document.", "docstring_tokens": ["Get", "the", "document", "short", "title", "in", "the", "specified", "markup", "format", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 257640}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L430-L488", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Parse the header from the tasks file into env, input, output definitions.", "language": "python", "parameters": "(header, input_file_param_util,\n                            output_file_param_util)", "return_statement": "return job_params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "'--env'", "arg_6", "=", "arg_4", "if", "arg_4", ".", "startswith", "(", "'-'", ")", ":", "arg_5", ",", "arg_6", "=", "split_pair", "(", "arg_4", ",", "' '", ",", "1", ")", "if", "arg_5", "==", "'--env'", ":", "arg_3", ".", "append", "(", "job_model", ".", "EnvParam", "(", "arg_6", ")", ")", "elif", "arg_5", "==", "'--label'", ":", "arg_3", ".", "append", "(", "job_model", ".", "LabelParam", "(", "arg_6", ")", ")", "elif", "arg_5", "==", "'--input'", "or", "arg_5", "==", "'--input-recursive'", ":", "arg_7", "=", "arg_1", ".", "get_variable_name", "(", "arg_6", ")", "arg_3", ".", "append", "(", "job_model", ".", "InputFileParam", "(", "arg_7", ",", "recursive", "=", "(", "arg_5", ".", "endswith", "(", "'recursive'", ")", ")", ")", ")", "elif", "arg_5", "==", "'--output'", "or", "arg_5", "==", "'--output-recursive'", ":", "arg_7", "=", "arg_2", ".", "get_variable_name", "(", "arg_6", ")", "arg_3", ".", "append", "(", "job_model", ".", "OutputFileParam", "(", "arg_7", ",", "recursive", "=", "(", "arg_5", ".", "endswith", "(", "'recursive'", ")", ")", ")", ")", "else", ":", "raise", "ValueError", "(", "'Unrecognized column header: %s'", "%", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1,\n                            arg_2):\n  \"\"\"Parse the header from the tasks file into env, input, output definitions.\n\n  Elements are formatted similar to their equivalent command-line arguments,\n  but with associated values coming from the data rows.\n\n  Environment variables columns are headered as \"--env <name>\"\n  Inputs columns are headered as \"--input <name>\" with the name optional.\n  Outputs columns are headered as \"--output <name>\" with the name optional.\n\n  For historical reasons, bareword column headers (such as \"JOB_ID\") are\n  equivalent to \"--env var_name\".\n\n  Args:\n    header: Array of header fields\n    input_file_param_util: Utility for producing InputFileParam objects.\n    output_file_param_util: Utility for producing OutputFileParam objects.\n\n  Returns:\n    job_params: A list of EnvParams and FileParams for the environment\n    variables, LabelParams, input file parameters, and output file parameters.\n\n  Raises:\n    ValueError: If a header contains a \":\" and the prefix is not supported.\n  \"\"\"\n  arg_3 = []\n\n  for arg_4 in arg_0:\n\n    # Reserve the \"-\" and \"--\" namespace.\n    # If the column has no leading \"-\", treat it as an environment variable\n    arg_5 = '--env'\n    arg_6 = arg_4\n    if arg_4.startswith('-'):\n      arg_5, arg_6 = split_pair(arg_4, ' ', 1)\n\n    if arg_5 == '--env':\n      arg_3.append(job_model.EnvParam(arg_6))\n\n    elif arg_5 == '--label':\n      arg_3.append(job_model.LabelParam(arg_6))\n\n    elif arg_5 == '--input' or arg_5 == '--input-recursive':\n      arg_7 = arg_1.get_variable_name(arg_6)\n      arg_3.append(\n          job_model.InputFileParam(\n              arg_7, recursive=(arg_5.endswith('recursive'))))\n\n    elif arg_5 == '--output' or arg_5 == '--output-recursive':\n      arg_7 = arg_2.get_variable_name(arg_6)\n      arg_3.append(\n          job_model.OutputFileParam(\n              arg_7, recursive=(arg_5.endswith('recursive'))))\n\n    else:\n      raise ValueError('Unrecognized column header: %s' % arg_4)\n\n  return arg_3", "path": "dsub/lib/param_util.py", "identifier": "parse_tasks_file_header", "docstring": "Parse the header from the tasks file into env, input, output definitions.\n\n  Elements are formatted similar to their equivalent command-line arguments,\n  but with associated values coming from the data rows.\n\n  Environment variables columns are headered as \"--env <name>\"\n  Inputs columns are headered as \"--input <name>\" with the name optional.\n  Outputs columns are headered as \"--output <name>\" with the name optional.\n\n  For historical reasons, bareword column headers (such as \"JOB_ID\") are\n  equivalent to \"--env var_name\".\n\n  Args:\n    header: Array of header fields\n    input_file_param_util: Utility for producing InputFileParam objects.\n    output_file_param_util: Utility for producing OutputFileParam objects.\n\n  Returns:\n    job_params: A list of EnvParams and FileParams for the environment\n    variables, LabelParams, input file parameters, and output file parameters.\n\n  Raises:\n    ValueError: If a header contains a \":\" and the prefix is not supported.", "docstring_tokens": ["Parse", "the", "header", "from", "the", "tasks", "file", "into", "env", "input", "output", "definitions", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 257641}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/ultratb.py#L968-L1010", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Call up the pdb debugger if desired, always clean up the tb\n        reference.", "language": "python", "parameters": "(self,force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_1", "or", "arg_0", ".", "call_pdb", ":", "if", "arg_0", ".", "pdb", "is", "None", ":", "arg_0", ".", "pdb", "=", "Func", ".", "Pdb", "(", "arg_0", ".", "color_scheme_table", ".", "active_scheme_name", ")", "arg_3", "=", "DisplayTrap", "(", "hook", "=", "sys", ".", "__displayhook__", ")", "with", "arg_3", ":", "arg_0", ".", "pdb", ".", "reset", "(", ")", "if", "hasattr", "(", "arg_0", ",", "'tb'", ")", "and", "arg_0", ".", "tb", "is", "not", "None", ":", "arg_4", "=", "arg_0", ".", "tb", "else", ":", "arg_4", "=", "arg_0", ".", "tb", "=", "sys", ".", "last_traceback", "while", "arg_0", ".", "tb", "is", "not", "None", "and", "arg_0", ".", "tb", ".", "tb_next", "is", "not", "None", ":", "arg_0", ".", "tb", "=", "arg_0", ".", "tb", ".", "tb_next", "if", "arg_4", "and", "arg_4", ".", "tb_next", ":", "arg_4", "=", "arg_4", ".", "tb_next", "arg_0", ".", "pdb", ".", "botframe", "=", "arg_4", ".", "tb_frame", "arg_0", ".", "pdb", ".", "interaction", "(", "arg_0", ".", "tb", ".", "tb_frame", ",", "arg_0", ".", "tb", ")", "if", "hasattr", "(", "arg_0", ",", "'tb'", ")", ":", "del", "arg_0", ".", "tb"], "function": "def Func(arg_0,arg_1=False):\n        \"\"\"Call up the pdb Func if desired, always clean up the tb\n        reference.\n\n        Keywords:\n\n          - force(False): by default, this routine checks the instance call_pdb\n          flag and does not actually invoke the Func if the flag is false.\n          The 'force' option forces the Func to activate even if the flag\n          is false.\n\n        If the call_pdb flag is set, the pdb interactive Func is\n        invoked. In all cases, the self.tb reference to the current traceback\n        is deleted to prevent lingering references which hamper memory\n        management.\n\n        Note that each call to pdb() does an 'import readline', so if your app\n        requires a special setup for the readline completers, you'll have to\n        fix that by hand after invoking the exception handler.\"\"\"\n\n        if arg_1 or arg_0.call_pdb:\n            if arg_0.pdb is None:\n                arg_0.pdb = Func.Pdb(\n                    arg_0.color_scheme_table.active_scheme_name)\n            # the system displayhook may have changed, restore the original\n            # for pdb\n            arg_3 = DisplayTrap(hook=sys.__displayhook__)\n            with arg_3:\n                arg_0.pdb.reset()\n                # Find the right frame so we don't pop up inside ipython itself\n                if hasattr(arg_0,'tb') and arg_0.tb is not None:\n                    arg_4 = arg_0.tb\n                else:\n                    arg_4 = arg_0.tb = sys.last_traceback\n                while arg_0.tb is not None and arg_0.tb.tb_next is not None:\n                    arg_0.tb = arg_0.tb.tb_next\n                if arg_4 and arg_4.tb_next:\n                    arg_4 = arg_4.tb_next\n                arg_0.pdb.botframe = arg_4.tb_frame\n                arg_0.pdb.interaction(arg_0.tb.tb_frame, arg_0.tb)\n\n        if hasattr(arg_0,'tb'):\n            del arg_0.tb", "path": "environment/lib/python2.7/site-packages/IPython/core/ultratb.py", "identifier": "VerboseTB.debugger", "docstring": "Call up the pdb debugger if desired, always clean up the tb\n        reference.\n\n        Keywords:\n\n          - force(False): by default, this routine checks the instance call_pdb\n          flag and does not actually invoke the debugger if the flag is false.\n          The 'force' option forces the debugger to activate even if the flag\n          is false.\n\n        If the call_pdb flag is set, the pdb interactive debugger is\n        invoked. In all cases, the self.tb reference to the current traceback\n        is deleted to prevent lingering references which hamper memory\n        management.\n\n        Note that each call to pdb() does an 'import readline', so if your app\n        requires a special setup for the readline completers, you'll have to\n        fix that by hand after invoking the exception handler.", "docstring_tokens": ["Call", "up", "the", "pdb", "debugger", "if", "desired", "always", "clean", "up", "the", "tb", "reference", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257642}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L63-L94", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Create a new project.", "language": "python", "parameters": "(ctx, name, description, tags, private, init)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "try", ":", "arg_3", "=", "arg_3", ".", "split", "(", "','", ")", "if", "arg_3", "else", "None", "arg_6", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "is_public", "=", "not", "arg_4", ",", "arg_3", "=", "arg_3", ")", "arg_7", "=", "ProjectConfig", ".", "from_dict", "(", "arg_6", ")", "except", "ValidationError", ":", "Printer", ".", "print_error", "(", "'Project name should contain only alpha numerical, \"-\", and \"_\".'", ")", "sys", ".", "exit", "(", "1", ")", "try", ":", "arg_8", "=", "PolyaxonClient", "(", ")", ".", "project", ".", "Func_project", "(", "arg_7", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func project `{}`.'", ".", "format", "(", "arg_1", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"Project `{}` was Funcd successfully.\"", ".", "format", "(", "arg_8", ".", "name", ")", ")", "if", "arg_5", ":", "arg_0", ".", "obj", "=", "{", "}", "arg_0", ".", "invoke", "(", "init_project", ",", "project", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Create a new project.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon project Func --name=cats-vs-dogs --description=\"Image Classification with DL\"\n    ```\n    \"\"\"\n    try:\n        arg_3 = arg_3.split(',') if arg_3 else None\n        arg_6 = dict(arg_1=arg_1, arg_2=arg_2, is_public=not arg_4, arg_3=arg_3)\n        arg_7 = ProjectConfig.from_dict(arg_6)\n    except ValidationError:\n        Printer.print_error('Project name should contain only alpha numerical, \"-\", and \"_\".')\n        sys.exit(1)\n\n    try:\n        arg_8 = PolyaxonClient().project.Func_project(arg_7)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func project `{}`.'.format(arg_1))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"Project `{}` was Funcd successfully.\".format(arg_8.name))\n\n    if arg_5:\n        arg_0.obj = {}\n        arg_0.invoke(init_project, project=arg_1)", "path": "polyaxon_cli/cli/project.py", "identifier": "create", "docstring": "Create a new project.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon project create --name=cats-vs-dogs --description=\"Image Classification with DL\"\n    ```", "docstring_tokens": ["Create", "a", "new", "project", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 257643}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L653-L672", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Shows a call tip, if appropriate, at the current cursor location.", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "enable_calltips", ":", "return", "False", "arg_1", "=", "arg_0", ".", "_get_cursor", "(", ")", "arg_1", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "Left", ")", "if", "arg_1", ".", "document", "(", ")", ".", "characterAt", "(", "arg_1", ".", "position", "(", ")", ")", "!=", "'('", ":", "return", "False", "arg_2", "=", "arg_0", ".", "_get_context", "(", "arg_1", ")", "if", "not", "arg_2", ":", "return", "False", "arg_3", "=", "'.'", ".", "join", "(", "arg_2", ")", "arg_4", "=", "arg_0", ".", "kernel_manager", ".", "shell_channel", ".", "object_info", "(", "arg_3", ")", "arg_5", "=", "arg_0", ".", "_get_cursor", "(", ")", ".", "position", "(", ")", "arg_0", ".", "_request_info", "[", "'call_tip'", "]", "=", "arg_0", ".", "_CallTipRequest", "(", "arg_4", ",", "arg_5", ")", "return", "True"], "function": "def Func(arg_0):\n        \"\"\" Shows a call tip, if appropriate, at the current cursor location.\n        \"\"\"\n        # Decide if it makes sense to show a call tip\n        if not arg_0.enable_calltips:\n            return False\n        arg_1 = arg_0._get_cursor()\n        arg_1.movePosition(QtGui.QTextCursor.Left)\n        if arg_1.document().characterAt(arg_1.position()) != '(':\n            return False\n        arg_2 = arg_0._get_context(arg_1)\n        if not arg_2:\n            return False\n\n        # Send the metadata request to the kernel\n        arg_3 = '.'.join(arg_2)\n        arg_4 = arg_0.kernel_manager.shell_channel.object_info(arg_3)\n        arg_5 = arg_0._get_cursor().position()\n        arg_0._request_info['call_tip'] = arg_0._CallTipRequest(arg_4, arg_5)\n        return True", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._call_tip", "docstring": "Shows a call tip, if appropriate, at the current cursor location.", "docstring_tokens": ["Shows", "a", "call", "tip", "if", "appropriate", "at", "the", "current", "cursor", "location", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257644}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_kvlayer.py#L392-L400", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Return packed bytes representation of StreamItem kvlayer key.\n    The result is 20 bytes, 16 of md5 hash, 4 of int timestamp.", "language": "python", "parameters": "(si_key)", "return_statement": "return struct.pack('>16si', si_key[0], si_key[1])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", "[", "0", "]", ")", "!=", "16", ":", "raise", "ValueError", "(", "'bad StreamItem key, expected 16 byte '", "'md5 hash binary digest, got: {0!r}'", ".", "format", "(", "arg_0", ")", ")", "return", "struct", ".", "pack", "(", "'>16si'", ",", "arg_0", "[", "0", "]", ",", "arg_0", "[", "1", "]", ")"], "function": "def Func(arg_0):\n    '''\n    Return packed bytes representation of StreamItem kvlayer key.\n    The result is 20 bytes, 16 of md5 hash, 4 of int timestamp.\n    '''\n    if len(arg_0[0]) != 16:\n        raise ValueError('bad StreamItem key, expected 16 byte '\n                         'md5 hash binary digest, got: {0!r}'.format(arg_0))\n    return struct.pack('>16si', arg_0[0], arg_0[1])", "path": "streamcorpus_pipeline/_kvlayer.py", "identifier": "serialize_si_key", "docstring": "Return packed bytes representation of StreamItem kvlayer key.\n    The result is 20 bytes, 16 of md5 hash, 4 of int timestamp.", "docstring_tokens": ["Return", "packed", "bytes", "representation", "of", "StreamItem", "kvlayer", "key", ".", "The", "result", "is", "20", "bytes", "16", "of", "md5", "hash", "4", "of", "int", "timestamp", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 257645}
{"url": "https://github.com/playpauseandstop/bootstrapper/blob/b216a05f2acb0b9f4919c4e010ff7b0f63fc1393/bootstrapper.py#L334-L388", "sha": "b216a05f2acb0b9f4919c4e010ff7b0f63fc1393", "docstring_summary": "Parse args from command line by creating argument parser instance and\n    process it.", "language": "python", "parameters": "(args)", "return_statement": "return parser.parse_args(args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "argparse", "import", "ArgumentParser", "arg_1", "=", "(", "'Bootstrap Python projects and libraries with virtualenv '", "'and pip.'", ")", "arg_2", "=", "ArgumentParser", "(", "arg_1", "=", "arg_1", ")", "arg_2", ".", "add_argument", "(", "'--version'", ",", "action", "=", "'version'", ",", "version", "=", "__version__", ")", "arg_2", ".", "add_argument", "(", "'-c'", ",", "'--config'", ",", "default", "=", "DEFAULT_CONFIG", ",", "help", "=", "'Path to config file. By default: {0}'", ".", "format", "(", "DEFAULT_CONFIG", ")", ")", "arg_2", ".", "add_argument", "(", "'-p'", ",", "'--pre-requirements'", ",", "default", "=", "[", "]", ",", "nargs", "=", "'+'", ",", "help", "=", "'List of pre-requirements to check, separated by space.'", ")", "arg_2", ".", "add_argument", "(", "'-e'", ",", "'--env'", ",", "help", "=", "'Virtual environment name. By default: {0}'", ".", "format", "(", "CONFIG", "[", "__script__", "]", "[", "'env'", "]", ")", ")", "arg_2", ".", "add_argument", "(", "'-r'", ",", "'--requirements'", ",", "help", "=", "'Path to requirements file. By default: {0}'", ".", "format", "(", "CONFIG", "[", "__script__", "]", "[", "'requirements'", "]", ")", ")", "arg_2", ".", "add_argument", "(", "'-d'", ",", "'--install-dev-requirements'", ",", "action", "=", "'store_true'", ",", "default", "=", "None", ",", "help", "=", "'Install prefixed or suffixed \"dev\" requirements after '", "'installation of original requirements file or library completed '", "'without errors.'", ")", "arg_2", ".", "add_argument", "(", "'-C'", ",", "'--hook'", ",", "help", "=", "'Execute this hook after bootstrap process.'", ")", "arg_2", ".", "add_argument", "(", "'--ignore-activated'", ",", "action", "=", "'store_true'", ",", "default", "=", "None", ",", "help", "=", "'Ignore pre-activated virtualenv, like on Travis CI.'", ")", "arg_2", ".", "add_argument", "(", "'--recreate'", ",", "action", "=", "'store_true'", ",", "default", "=", "None", ",", "help", "=", "'Recreate virtualenv on every run.'", ")", "arg_2", ".", "add_argument", "(", "'-q'", ",", "'--quiet'", ",", "action", "=", "'store_true'", ",", "default", "=", "None", ",", "help", "=", "'Minimize output, show only error messages.'", ")", "return", "arg_2", ".", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse args from command line by creating argument parser instance and\n    process it.\n\n    :param args: Command line arguments list.\n    \"\"\"\n    from argparse import ArgumentParser\n\n    arg_1 = ('Bootstrap Python projects and libraries with virtualenv '\n                   'and pip.')\n    arg_2 = ArgumentParser(arg_1=arg_1)\n    arg_2.add_argument('--version', action='version', version=__version__)\n\n    arg_2.add_argument(\n        '-c', '--config', default=DEFAULT_CONFIG,\n        help='Path to config file. By default: {0}'.format(DEFAULT_CONFIG)\n    )\n    arg_2.add_argument(\n        '-p', '--pre-requirements', default=[], nargs='+',\n        help='List of pre-requirements to check, separated by space.'\n    )\n    arg_2.add_argument(\n        '-e', '--env',\n        help='Virtual environment name. By default: {0}'.\n             format(CONFIG[__script__]['env'])\n    )\n    arg_2.add_argument(\n        '-r', '--requirements',\n        help='Path to requirements file. By default: {0}'.\n             format(CONFIG[__script__]['requirements'])\n    )\n    arg_2.add_argument(\n        '-d', '--install-dev-requirements', action='store_true', default=None,\n        help='Install prefixed or suffixed \"dev\" requirements after '\n             'installation of original requirements file or library completed '\n             'without errors.'\n    )\n    arg_2.add_argument(\n        '-C', '--hook', help='Execute this hook after bootstrap process.'\n    )\n    arg_2.add_argument(\n        '--ignore-activated', action='store_true', default=None,\n        help='Ignore pre-activated virtualenv, like on Travis CI.'\n    )\n    arg_2.add_argument(\n        '--recreate', action='store_true', default=None,\n        help='Recreate virtualenv on every run.'\n    )\n    arg_2.add_argument(\n        '-q', '--quiet', action='store_true', default=None,\n        help='Minimize output, show only error messages.'\n    )\n\n    return arg_2.Func(arg_0)", "path": "bootstrapper.py", "identifier": "parse_args", "docstring": "Parse args from command line by creating argument parser instance and\n    process it.\n\n    :param args: Command line arguments list.", "docstring_tokens": ["Parse", "args", "from", "command", "line", "by", "creating", "argument", "parser", "instance", "and", "process", "it", "."], "nwo": "playpauseandstop/bootstrapper", "score": 0.17697123869542528, "idx": 257646}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L91-L101", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "setting baudrate if supported", "language": "python", "parameters": "(self, baud)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "info", "(", "'Changing communication to %s baud'", ",", "arg_1", ")", "arg_0", ".", "__writeln", "(", "UART_SETUP", ".", "format", "(", "arg_1", "=", "arg_1", ")", ")", "time", ".", "sleep", "(", "0.1", ")", "try", ":", "arg_0", ".", "_port", ".", "setBaudrate", "(", "arg_1", ")", "except", "AttributeError", ":", "arg_0", ".", "_port", ".", "baudrate", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"setting baudrate if supported\"\"\"\n        log.info('Changing communication to %s baud', arg_1)\n        arg_0.__writeln(UART_SETUP.format(arg_1=arg_1))\n        # Wait for the string to be sent before switching baud\n        time.sleep(0.1)\n        try:\n            arg_0._port.setBaudrate(arg_1)\n        except AttributeError:\n            #pySerial 2.7\n            arg_0._port.baudrate = arg_1", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.__set_baudrate", "docstring": "setting baudrate if supported", "docstring_tokens": ["setting", "baudrate", "if", "supported"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 257647}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/mcp23s17.py#L177-L188", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Returns the bit specified from the address.", "language": "python", "parameters": "(self, bit_num, address)", "return_statement": "return 1 if value & bit_mask else 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "read", "(", "arg_2", ")", "arg_4", "=", "get_bit_mask", "(", "arg_1", ")", "return", "1", "if", "arg_3", "&", "arg_4", "else", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Returns the bit specified from the address.\n\n        :param bit_num: The bit number to read from.\n        :type bit_num: int\n        :param address: The address to read from.\n        :type address: int\n        :returns: int -- the bit value from the address\n        \"\"\"\n        arg_3 = arg_0.read(arg_2)\n        arg_4 = get_bit_mask(arg_1)\n        return 1 if arg_3 & arg_4 else 0", "path": "pifacecommon/mcp23s17.py", "identifier": "MCP23S17.read_bit", "docstring": "Returns the bit specified from the address.\n\n        :param bit_num: The bit number to read from.\n        :type bit_num: int\n        :param address: The address to read from.\n        :type address: int\n        :returns: int -- the bit value from the address", "docstring_tokens": ["Returns", "the", "bit", "specified", "from", "the", "address", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 257648}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/files.py#L31-L48", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Return a canonical filename for `filename`.", "language": "python", "parameters": "(self, filename)", "return_statement": "return self.canonical_filename_cache[filename]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "Func_cache", ":", "if", "not", "os", ".", "path", ".", "isabs", "(", "arg_1", ")", ":", "for", "arg_2", "in", "[", "os", ".", "curdir", "]", "+", "sys", ".", "path", ":", "if", "arg_2", "is", "None", ":", "continue", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_1", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "arg_1", "=", "arg_3", "break", "arg_4", "=", "abs_file", "(", "arg_1", ")", "arg_0", ".", "Func_cache", "[", "arg_1", "]", "=", "arg_4", "return", "arg_0", ".", "Func_cache", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a canonical filename for `filename`.\n\n        An absolute path with no redundant components and normalized case.\n\n        \"\"\"\n        if arg_1 not in arg_0.Func_cache:\n            if not os.path.isabs(arg_1):\n                for arg_2 in [os.curdir] + sys.path:\n                    if arg_2 is None:\n                        continue\n                    arg_3 = os.path.join(arg_2, arg_1)\n                    if os.path.exists(arg_3):\n                        arg_1 = arg_3\n                        break\n            arg_4 = abs_file(arg_1)\n            arg_0.Func_cache[arg_1] = arg_4\n        return arg_0.Func_cache[arg_1]", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/files.py", "identifier": "FileLocator.canonical_filename", "docstring": "Return a canonical filename for `filename`.\n\n        An absolute path with no redundant components and normalized case.", "docstring_tokens": ["Return", "a", "canonical", "filename", "for", "filename", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 257649}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/get_attribute_list.py#L250-L333", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the GetAttributeList response payload and\n        decode it into its constituent parts.", "language": "python", "parameters": "(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "GetAttributeListResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_0", ".", "_unique_identifier", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ")", "arg_0", ".", "_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The GetAttributeList response payload encoding is missing \"", "\"the unique identifier.\"", ")", "arg_8", "=", "list", "(", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "while", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ATTRIBUTE_NAME", ",", "arg_6", ")", ":", "arg_9", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "ATTRIBUTE_NAME", ")", "arg_9", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_8", ".", "append", "(", "arg_9", ")", "if", "len", "(", "arg_8", ")", "==", "0", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The GetAttributeList response payload encoding is \"", "\"missing the attribute names.\"", ")", "arg_0", ".", "_attribute_names", "=", "arg_8", "else", ":", "while", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ATTRIBUTE_REFERENCE", ",", "arg_6", ")", ":", "if", "arg_0", ".", "is_type_next", "(", "arg_3", ".", "Types", ".", "STRUCTURE", ",", "arg_6", ")", ":", "arg_11", "=", "objects", ".", "AttributeReference", "(", ")", "arg_11", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_8", ".", "append", "(", "primitives", ".", "TextString", "(", "value", "=", "arg_11", ".", "attribute_name", ",", "tag", "=", "arg_3", ".", "Tags", ".", "ATTRIBUTE_NAME", ")", ")", "elif", "arg_0", ".", "is_type_next", "(", "arg_3", ".", "Types", ".", "ENUMERATION", ",", "arg_6", ")", ":", "arg_11", "=", "primitives", ".", "Enumeration", "(", "arg_3", ".", "Tags", ",", "tag", "=", "arg_3", ".", "Tags", ".", "ATTRIBUTE_REFERENCE", ")", "arg_11", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_9", "=", "arg_3", ".", "convert_attribute_tag_to_name", "(", "arg_11", ".", "value", ")", "arg_8", ".", "append", "(", "primitives", ".", "TextString", "(", "value", "=", "arg_9", ",", "tag", "=", "arg_3", ".", "Tags", ".", "ATTRIBUTE_NAME", ")", ")", "else", ":", "raise", "exceptions", ".", "InvalidKmipEncoding", "(", "\"The GetAttributeList response payload encoding \"", "\"contains an invalid AttributeReference type.\"", ")", "arg_0", ".", "_attribute_names", "=", "arg_8", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the GetAttributeList response payload and\n        decode it into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidKmipEncoding: Raised if the unique identifier or attribute\n                names are missing from the encoded payload.\n        \"\"\"\n        super(GetAttributeListResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.UNIQUE_IDENTIFIER, arg_6):\n            arg_0._unique_identifier = primitives.TextString(\n                tag=arg_3.Tags.UNIQUE_IDENTIFIER\n            )\n            arg_0._unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise exceptions.InvalidKmipEncoding(\n                \"The GetAttributeList response payload encoding is missing \"\n                \"the unique identifier.\"\n            )\n\n        arg_8 = list()\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            while arg_0.is_tag_next(arg_3.Tags.ATTRIBUTE_NAME, arg_6):\n                arg_9 = primitives.TextString(tag=arg_3.Tags.ATTRIBUTE_NAME)\n                arg_9.Func(arg_6, arg_2=arg_2)\n                arg_8.append(arg_9)\n            if len(arg_8) == 0:\n                raise exceptions.InvalidKmipEncoding(\n                    \"The GetAttributeList response payload encoding is \"\n                    \"missing the attribute names.\"\n                )\n            arg_0._attribute_names = arg_8\n        else:\n            while arg_0.is_tag_next(\n                    arg_3.Tags.ATTRIBUTE_REFERENCE,\n                    arg_6\n            ):\n                if arg_0.is_type_next(arg_3.Types.STRUCTURE, arg_6):\n                    arg_11 = objects.AttributeReference()\n                    arg_11.Func(arg_6, arg_2=arg_2)\n                    arg_8.append(\n                        primitives.TextString(\n                            value=arg_11.attribute_name,\n                            tag=arg_3.Tags.ATTRIBUTE_NAME\n                        )\n                    )\n                elif arg_0.is_type_next(arg_3.Types.ENUMERATION, arg_6):\n                    arg_11 = primitives.Enumeration(\n                        arg_3.Tags,\n                        tag=arg_3.Tags.ATTRIBUTE_REFERENCE\n                    )\n                    arg_11.Func(arg_6, arg_2=arg_2)\n                    arg_9 = arg_3.convert_attribute_tag_to_name(arg_11.value)\n                    arg_8.append(\n                        primitives.TextString(\n                            value=arg_9,\n                            tag=arg_3.Tags.ATTRIBUTE_NAME\n                        )\n                    )\n                else:\n                    raise exceptions.InvalidKmipEncoding(\n                        \"The GetAttributeList response payload encoding \"\n                        \"contains an invalid AttributeReference type.\"\n                    )\n            arg_0._attribute_names = arg_8\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/get_attribute_list.py", "identifier": "GetAttributeListResponsePayload.read", "docstring": "Read the data encoding the GetAttributeList response payload and\n        decode it into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidKmipEncoding: Raised if the unique identifier or attribute\n                names are missing from the encoded payload.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "GetAttributeList", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 257650}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/utils.py#L26-L32", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns a string representing a numpy array of 0's and 1's", "language": "python", "parameters": "(arr)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "array", "(", "'c'", ",", "'.'", "*", "len", "(", "arg_0", ")", ")", "for", "arg_2", "in", "xrange", "(", "len", "(", "arg_0", ")", ")", ":", "if", "arg_0", "[", "arg_2", "]", "==", "1", ":", "arg_1", "[", "arg_2", "]", "=", "'*'", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Returns a string representing a numpy array of 0's and 1's\"\"\"\n  arg_1 = array('c','.'*len(arg_0))\n  for arg_2 in xrange(len(arg_0)):\n    if arg_0[arg_2] == 1:\n      arg_1[arg_2]='*'\n  return arg_1", "path": "src/nupic/encoders/utils.py", "identifier": "bitsToString", "docstring": "Returns a string representing a numpy array of 0's and 1's", "docstring_tokens": ["Returns", "a", "string", "representing", "a", "numpy", "array", "of", "0", "s", "and", "1", "s"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257651}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/check_manifest.py#L580-L582", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Does this filename match any of the patterns?", "language": "python", "parameters": "(filename, patterns)", "return_statement": "return any(fnmatch.fnmatch(filename, pat) for pat in patterns)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "any", "(", "fnmatch", ".", "fnmatch", "(", "arg_0", ",", "arg_2", ")", "for", "arg_2", "in", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Does this filename match any of the patterns?\"\"\"\n    return any(fnmatch.fnmatch(arg_0, arg_2) for arg_2 in arg_1)", "path": "virtualEnvironment/lib/python2.7/site-packages/check_manifest.py", "identifier": "file_matches", "docstring": "Does this filename match any of the patterns?", "docstring_tokens": ["Does", "this", "filename", "match", "any", "of", "the", "patterns?"], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 257652}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/CAM.py#L139-L160", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Apply causal discovery on observational data using CAM.", "language": "python", "parameters": "(self, data, **kwargs)", "return_statement": "return nx.relabel_nodes(nx.DiGraph(results),\n                                {idx: i for idx, i in enumerate(data.columns)})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "arguments", "[", "'{SCORE}'", "]", "=", "arg_0", ".", "scores", "[", "arg_0", ".", "score", "]", "arg_0", ".", "arguments", "[", "'{CUTOFF}'", "]", "=", "str", "(", "arg_0", ".", "cutoff", ")", "arg_0", ".", "arguments", "[", "'{VARSEL}'", "]", "=", "str", "(", "arg_0", ".", "variablesel", ")", ".", "upper", "(", ")", "arg_0", ".", "arguments", "[", "'{SELMETHOD}'", "]", "=", "arg_0", ".", "var_selection", "[", "arg_0", ".", "selmethod", "]", "arg_0", ".", "arguments", "[", "'{PRUNING}'", "]", "=", "str", "(", "arg_0", ".", "pruning", ")", ".", "upper", "(", ")", "arg_0", ".", "arguments", "[", "'{PRUNMETHOD}'", "]", "=", "arg_0", ".", "var_selection", "[", "arg_0", ".", "prunmethod", "]", "arg_0", ".", "arguments", "[", "'{NJOBS}'", "]", "=", "str", "(", "arg_0", ".", "nb_jobs", ")", "arg_0", ".", "arguments", "[", "'{VERBOSE}'", "]", "=", "str", "(", "arg_0", ".", "verbose", ")", ".", "upper", "(", ")", "arg_4", "=", "arg_0", ".", "_run_cam", "(", "arg_1", ",", "verbose", "=", "arg_0", ".", "verbose", ")", "return", "nx", ".", "relabel_nodes", "(", "nx", ".", "DiGraph", "(", "arg_4", ")", ",", "{", "arg_5", ":", "arg_6", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ".", "columns", ")", "}", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Apply causal discovery on observational data using CAM.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by the CAM algorithm.\n        \"\"\"\n        # Building setup w/ arguments.\n        arg_0.arguments['{SCORE}'] = arg_0.scores[arg_0.score]\n        arg_0.arguments['{CUTOFF}'] = str(arg_0.cutoff)\n        arg_0.arguments['{VARSEL}'] = str(arg_0.variablesel).upper()\n        arg_0.arguments['{SELMETHOD}'] = arg_0.var_selection[arg_0.selmethod]\n        arg_0.arguments['{PRUNING}'] = str(arg_0.pruning).upper()\n        arg_0.arguments['{PRUNMETHOD}'] = arg_0.var_selection[arg_0.prunmethod]\n        arg_0.arguments['{NJOBS}'] = str(arg_0.nb_jobs)\n        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()\n        arg_4 = arg_0._run_cam(arg_1, verbose=arg_0.verbose)\n\n        return nx.relabel_nodes(nx.DiGraph(arg_4),\n                                {arg_5: arg_6 for arg_5, arg_6 in enumerate(arg_1.columns)})", "path": "cdt/causality/graph/CAM.py", "identifier": "CAM.create_graph_from_data", "docstring": "Apply causal discovery on observational data using CAM.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by the CAM algorithm.", "docstring_tokens": ["Apply", "causal", "discovery", "on", "observational", "data", "using", "CAM", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 257653}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1047-L1156", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Draw all polygons onto a given image.", "language": "python", "parameters": "(self,\n                      image,\n                      color=(0, 255, 0), color_face=None,\n                      color_lines=None, color_points=None,\n                      alpha=1.0, alpha_face=None,\n                      alpha_lines=None, alpha_points=None,\n                      size=1, size_lines=None, size_points=None,\n                      raise_if_out_of_image=False)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "0", ",", "255", ",", "0", ")", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "1.0", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "1", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "False", ")", ":", "for", "arg_14", "in", "arg_0", ".", "polygons", ":", "arg_1", "=", "arg_14", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ")", "return", "arg_1"], "function": "def Func(arg_0,\n                      arg_1,\n                      arg_2=(0, 255, 0), arg_3=None,\n                      arg_4=None, arg_5=None,\n                      arg_6=1.0, arg_7=None,\n                      arg_8=None, arg_9=None,\n                      arg_10=1, arg_11=None, arg_12=None,\n                      arg_13=False):\n        \"\"\"\n        Draw all polygons onto a given image.\n\n        Parameters\n        ----------\n        image : (H,W,C) ndarray\n            The image onto which to draw the bounding boxes.\n            This image should usually have the same shape as set in\n            ``PolygonsOnImage.shape``.\n\n        color : iterable of int, optional\n            The color to use for the whole polygons.\n            Must correspond to the channel layout of the image. Usually RGB.\n            The values for `color_face`, `color_lines` and `color_points`\n            will be derived from this color if they are set to ``None``.\n            This argument has no effect if `color_face`, `color_lines`\n            and `color_points` are all set anything other than ``None``.\n\n        color_face : None or iterable of int, optional\n            The color to use for the inner polygon areas (excluding perimeters).\n            Must correspond to the channel layout of the image. Usually RGB.\n            If this is ``None``, it will be derived from ``color * 1.0``.\n\n        color_lines : None or iterable of int, optional\n            The color to use for the lines (aka perimeters/borders) of the\n            polygons. Must correspond to the channel layout of the image.\n            Usually RGB. If this is ``None``, it will be derived\n            from ``color * 0.5``.\n\n        color_points : None or iterable of int, optional\n            The color to use for the corner points of the polygons.\n            Must correspond to the channel layout of the image. Usually RGB.\n            If this is ``None``, it will be derived from ``color * 0.5``.\n\n        alpha : float, optional\n            The opacity of the whole polygons, where ``1.0`` denotes\n            completely visible polygons and ``0.0`` invisible ones.\n            The values for `alpha_face`, `alpha_lines` and `alpha_points`\n            will be derived from this alpha value if they are set to ``None``.\n            This argument has no effect if `alpha_face`, `alpha_lines`\n            and `alpha_points` are all set anything other than ``None``.\n\n        alpha_face : None or number, optional\n            The opacity of the polygon's inner areas (excluding the perimeters),\n            where ``1.0`` denotes completely visible inner areas and ``0.0``\n            invisible ones.\n            If this is ``None``, it will be derived from ``alpha * 0.5``.\n\n        alpha_lines : None or number, optional\n            The opacity of the polygon's lines (aka perimeters/borders),\n            where ``1.0`` denotes completely visible perimeters and ``0.0``\n            invisible ones.\n            If this is ``None``, it will be derived from ``alpha * 1.0``.\n\n        alpha_points : None or number, optional\n            The opacity of the polygon's corner points, where ``1.0`` denotes\n            completely visible corners and ``0.0`` invisible ones.\n            Currently this is an on/off choice, i.e. only ``0.0`` or ``1.0``\n            are allowed.\n            If this is ``None``, it will be derived from ``alpha * 1.0``.\n\n        size : int, optional\n            Size of the polygons.\n            The sizes of the line and points are derived from this value,\n            unless they are set.\n\n        size_lines : None or int, optional\n            Thickness of the polygon lines (aka perimeter/border).\n            If ``None``, this value is derived from `size`.\n\n        size_points : int, optional\n            The size of all corner points. If set to ``C``, each corner point\n            will be drawn as a square of size ``C x C``.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if any polygon is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        image : (H,W,C) ndarray\n            Image with drawn polygons.\n\n        \"\"\"\n        for arg_14 in arg_0.polygons:\n            arg_1 = arg_14.Func(\n                arg_1,\n                arg_2=arg_2,\n                arg_3=arg_3,\n                arg_4=arg_4,\n                arg_5=arg_5,\n                arg_6=arg_6,\n                arg_7=arg_7,\n                arg_8=arg_8,\n                arg_9=arg_9,\n                arg_10=arg_10,\n                arg_11=arg_11,\n                arg_12=arg_12,\n                arg_13=arg_13\n            )\n        return arg_1", "path": "imgaug/augmentables/polys.py", "identifier": "PolygonsOnImage.draw_on_image", "docstring": "Draw all polygons onto a given image.\n\n        Parameters\n        ----------\n        image : (H,W,C) ndarray\n            The image onto which to draw the bounding boxes.\n            This image should usually have the same shape as set in\n            ``PolygonsOnImage.shape``.\n\n        color : iterable of int, optional\n            The color to use for the whole polygons.\n            Must correspond to the channel layout of the image. Usually RGB.\n            The values for `color_face`, `color_lines` and `color_points`\n            will be derived from this color if they are set to ``None``.\n            This argument has no effect if `color_face`, `color_lines`\n            and `color_points` are all set anything other than ``None``.\n\n        color_face : None or iterable of int, optional\n            The color to use for the inner polygon areas (excluding perimeters).\n            Must correspond to the channel layout of the image. Usually RGB.\n            If this is ``None``, it will be derived from ``color * 1.0``.\n\n        color_lines : None or iterable of int, optional\n            The color to use for the lines (aka perimeters/borders) of the\n            polygons. Must correspond to the channel layout of the image.\n            Usually RGB. If this is ``None``, it will be derived\n            from ``color * 0.5``.\n\n        color_points : None or iterable of int, optional\n            The color to use for the corner points of the polygons.\n            Must correspond to the channel layout of the image. Usually RGB.\n            If this is ``None``, it will be derived from ``color * 0.5``.\n\n        alpha : float, optional\n            The opacity of the whole polygons, where ``1.0`` denotes\n            completely visible polygons and ``0.0`` invisible ones.\n            The values for `alpha_face`, `alpha_lines` and `alpha_points`\n            will be derived from this alpha value if they are set to ``None``.\n            This argument has no effect if `alpha_face`, `alpha_lines`\n            and `alpha_points` are all set anything other than ``None``.\n\n        alpha_face : None or number, optional\n            The opacity of the polygon's inner areas (excluding the perimeters),\n            where ``1.0`` denotes completely visible inner areas and ``0.0``\n            invisible ones.\n            If this is ``None``, it will be derived from ``alpha * 0.5``.\n\n        alpha_lines : None or number, optional\n            The opacity of the polygon's lines (aka perimeters/borders),\n            where ``1.0`` denotes completely visible perimeters and ``0.0``\n            invisible ones.\n            If this is ``None``, it will be derived from ``alpha * 1.0``.\n\n        alpha_points : None or number, optional\n            The opacity of the polygon's corner points, where ``1.0`` denotes\n            completely visible corners and ``0.0`` invisible ones.\n            Currently this is an on/off choice, i.e. only ``0.0`` or ``1.0``\n            are allowed.\n            If this is ``None``, it will be derived from ``alpha * 1.0``.\n\n        size : int, optional\n            Size of the polygons.\n            The sizes of the line and points are derived from this value,\n            unless they are set.\n\n        size_lines : None or int, optional\n            Thickness of the polygon lines (aka perimeter/border).\n            If ``None``, this value is derived from `size`.\n\n        size_points : int, optional\n            The size of all corner points. If set to ``C``, each corner point\n            will be drawn as a square of size ``C x C``.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an error if any polygon is fully\n            outside of the image. If set to False, no error will be raised and\n            only the parts inside the image will be drawn.\n\n        Returns\n        -------\n        image : (H,W,C) ndarray\n            Image with drawn polygons.", "docstring_tokens": ["Draw", "all", "polygons", "onto", "a", "given", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 257654}
{"url": "https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L89-L99", "sha": "05abf965f67c7445355508a38f11992d13adac4f", "docstring_summary": "Pull a device from the API.", "language": "python", "parameters": "(_id)", "return_statement": "return arequest.json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "DEVICE_URL", "%", "arg_0", "arg_2", "=", "requests", ".", "get", "(", "arg_1", ",", "headers", "=", "HEADERS", ")", "arg_3", "=", "str", "(", "arg_2", ".", "status_code", ")", "if", "arg_3", "==", "'401'", ":", "_LOGGER", ".", "error", "(", "\"Token expired.\"", ")", "return", "False", "return", "arg_2", ".", "json", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Pull a device from the API.\n        \"\"\"\n        arg_1 = DEVICE_URL % arg_0\n        arg_2 = requests.get(arg_1, headers=HEADERS)\n        arg_3 = str(arg_2.status_code)\n        if arg_3 == '401':\n            _LOGGER.error(\"Token expired.\")\n            return False\n        return arg_2.json()", "path": "src/pyeconet/api.py", "identifier": "EcoNetApiInterface.get_device", "docstring": "Pull a device from the API.", "docstring_tokens": ["Pull", "a", "device", "from", "the", "API", "."], "nwo": "w1ll1am23/pyeconet", "score": 0.2757871243566705, "idx": 257655}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L811-L825", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Strip all tags from a string except those tags provided in `allowed_tags` parameter.", "language": "python", "parameters": "(text, allowed_tags=None)", "return_statement": "return bleach.clean(text, tags=allowed_tags, attributes=['id', 'class', 'style', 'href', 'title'], strip=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "return", "if", "arg_1", "is", "None", ":", "arg_1", "=", "ALLOWED_TAGS", "return", "bleach", ".", "clean", "(", "arg_0", ",", "tags", "=", "arg_1", ",", "attributes", "=", "[", "'id'", ",", "'class'", ",", "'style'", ",", "'href'", ",", "'title'", "]", ",", "strip", "=", "True", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Strip all tags from a string except those tags provided in `allowed_tags` parameter.\n\n    Args:\n        text (str): string to strip html tags from\n        allowed_tags (list): allowed list of html tags\n\n    Returns: a string without html tags\n    \"\"\"\n    if arg_0 is None:\n        return\n    if arg_1 is None:\n        arg_1 = ALLOWED_TAGS\n    return bleach.clean(arg_0, tags=arg_1, attributes=['id', 'class', 'style', 'href', 'title'], strip=True)", "path": "enterprise/utils.py", "identifier": "strip_html_tags", "docstring": "Strip all tags from a string except those tags provided in `allowed_tags` parameter.\n\n    Args:\n        text (str): string to strip html tags from\n        allowed_tags (list): allowed list of html tags\n\n    Returns: a string without html tags", "docstring_tokens": ["Strip", "all", "tags", "from", "a", "string", "except", "those", "tags", "provided", "in", "allowed_tags", "parameter", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257656}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L748-L763", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert this polygon to a bounding box tightly containing the whole polygon.", "language": "python", "parameters": "(self)", "return_statement": "return BoundingBox(x1=min(xx), x2=max(xx), y1=min(yy), y2=max(yy), label=self.label)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "imgaug", ".", "augmentables", ".", "bbs", "import", "BoundingBox", "arg_1", "=", "arg_0", ".", "xx", "arg_2", "=", "arg_0", ".", "yy", "return", "BoundingBox", "(", "x1", "=", "min", "(", "arg_1", ")", ",", "x2", "=", "max", "(", "arg_1", ")", ",", "y1", "=", "min", "(", "arg_2", ")", ",", "y2", "=", "max", "(", "arg_2", ")", ",", "label", "=", "arg_0", ".", "label", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Convert this polygon to a bounding box tightly containing the whole polygon.\n\n        Returns\n        -------\n        imgaug.BoundingBox\n            Tight bounding box around the polygon.\n\n        \"\"\"\n        # TODO get rid of this deferred import\n        from imgaug.augmentables.bbs import BoundingBox\n\n        arg_1 = arg_0.xx\n        arg_2 = arg_0.yy\n        return BoundingBox(x1=min(arg_1), x2=max(arg_1), y1=min(arg_2), y2=max(arg_2), label=arg_0.label)", "path": "imgaug/augmentables/polys.py", "identifier": "Polygon.to_bounding_box", "docstring": "Convert this polygon to a bounding box tightly containing the whole polygon.\n\n        Returns\n        -------\n        imgaug.BoundingBox\n            Tight bounding box around the polygon.", "docstring_tokens": ["Convert", "this", "polygon", "to", "a", "bounding", "box", "tightly", "containing", "the", "whole", "polygon", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 257657}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process.py#L569-L608", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Updates the directives attribute from a dictionary object.", "language": "python", "parameters": "(self, attr_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "\"pid\"", ",", "\"ignore_type\"", ",", "\"ignore_pid\"", ",", "\"extra_input\"", ",", "\"group\"", ",", "\"input_type\"", "]", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_3", "in", "arg_2", "and", "hasattr", "(", "arg_0", ",", "arg_3", ")", ":", "setattr", "(", "arg_0", ",", "arg_3", ",", "arg_4", ")", "elif", "arg_3", "==", "\"params\"", ":", "for", "arg_5", ",", "arg_6", "in", "arg_4", ".", "items", "(", ")", ":", "if", "arg_5", "in", "arg_0", ".", "params", ":", "arg_0", ".", "params", "[", "arg_5", "]", "[", "\"default\"", "]", "=", "arg_6", "else", ":", "raise", "eh", ".", "ProcessError", "(", "\"The parameter name '{}' does not exist for \"", "\"component '{}'\"", ".", "format", "(", "arg_5", ",", "arg_0", ".", "template", ")", ")", "else", ":", "for", "arg_8", "in", "arg_0", ".", "directives", ":", "arg_0", ".", "directives", "[", "arg_8", "]", "[", "arg_3", "]", "=", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Updates the directives attribute from a dictionary object.\n\n        This will only update the directives for processes that have been\n        defined in the subclass.\n\n        Parameters\n        ----------\n        attr_dict : dict\n            Dictionary containing the attributes that will be used to update\n            the process attributes and/or directives.\n\n        \"\"\"\n\n        # Update directives\n        # Allowed attributes to write\n        arg_2 = [\"pid\", \"ignore_type\", \"ignore_pid\", \"extra_input\",\n                            \"group\", \"input_type\"]\n\n        for arg_3, arg_4 in arg_1.items():\n\n            # If the attribute has a valid directive key, update that\n            # directive\n            if arg_3 in arg_2 and hasattr(arg_0, arg_3):\n                setattr(arg_0, arg_3, arg_4)\n\n            # The params attribute is special, in the sense that it provides\n            # information for the self.params attribute.\n            elif arg_3 == \"params\":\n                for arg_5, arg_6 in arg_4.items():\n                    if arg_5 in arg_0.params:\n                        arg_0.params[arg_5][\"default\"] = arg_6\n                    else:\n                        raise eh.ProcessError(\n                            \"The parameter name '{}' does not exist for \"\n                            \"component '{}'\".format(arg_5, arg_0.template))\n\n            else:\n                for arg_8 in arg_0.directives:\n                    arg_0.directives[arg_8][arg_3] = arg_4", "path": "flowcraft/generator/process.py", "identifier": "Process.update_attributes", "docstring": "Updates the directives attribute from a dictionary object.\n\n        This will only update the directives for processes that have been\n        defined in the subclass.\n\n        Parameters\n        ----------\n        attr_dict : dict\n            Dictionary containing the attributes that will be used to update\n            the process attributes and/or directives.", "docstring_tokens": ["Updates", "the", "directives", "attribute", "from", "a", "dictionary", "object", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257658}
{"url": "https://github.com/hit9/rux/blob/d7f60722658a3b83ac6d7bb3ca2790ac9c926b59/rux/server.py#L66-L82", "sha": "d7f60722658a3b83ac6d7bb3ca2790ac9c926b59", "docstring_summary": "run a server binding to port", "language": "python", "parameters": "(self, port)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "server", "=", "MultiThreadedHTTPServer", "(", "(", "'0.0.0.0'", ",", "arg_1", ")", ",", "Handler", ")", "except", "socket", ".", "error", ",", "e", ":", "logger", ".", "error", "(", "str", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "logger", ".", "info", "(", "\"HTTP serve at http://0.0.0.0:%d (ctrl-c to stop) ...\"", "%", "arg_1", ")", "try", ":", "arg_0", ".", "server", ".", "serve_forever", "(", ")", "except", "KeyboardInterrupt", ":", "logger", ".", "info", "(", "\"^C received, shutting down server\"", ")", "arg_0", ".", "shutdown_server", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"run a server binding to port\"\"\"\n\n        try:\n            arg_0.server = MultiThreadedHTTPServer(('0.0.0.0', arg_1), Handler)\n        except socket.error, e:  # failed to bind port\n            logger.error(str(e))\n            sys.exit(1)\n\n        logger.info(\"HTTP serve at http://0.0.0.0:%d (ctrl-c to stop) ...\"\n                    % arg_1)\n\n        try:\n            arg_0.server.serve_forever()\n        except KeyboardInterrupt:\n            logger.info(\"^C received, shutting down server\")\n            arg_0.shutdown_server()", "path": "rux/server.py", "identifier": "Server.run_server", "docstring": "run a server binding to port", "docstring_tokens": ["run", "a", "server", "binding", "to", "port"], "nwo": "hit9/rux", "score": 0.18892572326127263, "idx": 257659}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/clock_tree.py#L86-L134", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "assign dates to nodes", "language": "python", "parameters": "(self)", "return_statement": "return ttconf.SUCCESS", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "tree", "is", "None", ":", "arg_0", ".", "logger", "(", "\"ClockTree.Func: tree is not set, can't assign dates\"", ",", "0", ")", "return", "ttconf", ".", "ERROR", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ".", "tree", ".", "find_clades", "(", "order", "=", "'postorder'", ")", ":", "if", "arg_2", ".", "name", "in", "arg_0", ".", "date_dict", ":", "arg_3", "=", "arg_0", ".", "date_dict", "[", "arg_2", ".", "name", "]", "if", "np", ".", "isscalar", "(", "arg_3", ")", "and", "np", ".", "isnan", "(", "arg_3", ")", ":", "arg_0", ".", "logger", "(", "\"WARNING: ClockTree.init: node %s has a bad date: %s\"", "%", "(", "arg_2", ".", "name", ",", "str", "(", "arg_3", ")", ")", ",", "2", ",", "warn", "=", "True", ")", "arg_2", ".", "raw_date_constraint", "=", "None", "arg_2", ".", "bad_branch", "=", "True", "else", ":", "try", ":", "arg_6", "=", "np", ".", "mean", "(", "arg_3", ")", "arg_2", ".", "raw_date_constraint", "=", "arg_3", "arg_2", ".", "bad_branch", "=", "False", "except", ":", "arg_0", ".", "logger", "(", "\"WARNING: ClockTree.init: node %s has a bad date: %s\"", "%", "(", "arg_2", ".", "name", ",", "str", "(", "arg_3", ")", ")", ",", "2", ",", "warn", "=", "True", ")", "arg_2", ".", "raw_date_constraint", "=", "None", "arg_2", ".", "bad_branch", "=", "True", "else", ":", "arg_2", ".", "raw_date_constraint", "=", "None", "if", "arg_2", ".", "is_terminal", "(", ")", ":", "arg_2", ".", "bad_branch", "=", "True", "else", ":", "arg_2", ".", "bad_branch", "=", "np", ".", "all", "(", "[", "x", ".", "bad_branch", "for", "x", "in", "arg_2", "]", ")", "if", "arg_2", ".", "is_terminal", "(", ")", "and", "arg_2", ".", "bad_branch", ":", "arg_1", "+=", "1", "if", "arg_1", ">", "arg_0", ".", "tree", ".", "count_terminals", "(", ")", "-", "3", ":", "arg_0", ".", "logger", "(", "\"ERROR: ALMOST NO VALID DATE CONSTRAINTS, EXITING\"", ",", "1", ",", "warn", "=", "True", ")", "return", "ttconf", ".", "ERROR", "return", "ttconf", ".", "SUCCESS"], "function": "def Func(arg_0):\n        \"\"\"assign dates to nodes\n\n        Returns\n        -------\n        str\n            success/error code\n        \"\"\"\n        if arg_0.tree is None:\n            arg_0.logger(\"ClockTree.Func: tree is not set, can't assign dates\", 0)\n            return ttconf.ERROR\n\n        arg_1 = 0\n        for arg_2 in arg_0.tree.find_clades(order='postorder'):\n            if arg_2.name in arg_0.date_dict:\n                arg_3 = arg_0.date_dict[arg_2.name]\n                if np.isscalar(arg_3) and np.isnan(arg_3):\n                    arg_0.logger(\"WARNING: ClockTree.init: node %s has a bad date: %s\"%(arg_2.name, str(arg_3)), 2, warn=True)\n                    arg_2.raw_date_constraint = None\n                    arg_2.bad_branch = True\n                else:\n                    try:\n                        arg_6 = np.mean(arg_3)\n                        arg_2.raw_date_constraint = arg_3\n                        arg_2.bad_branch = False\n                    except:\n                        arg_0.logger(\"WARNING: ClockTree.init: node %s has a bad date: %s\"%(arg_2.name, str(arg_3)), 2, warn=True)\n                        arg_2.raw_date_constraint = None\n                        arg_2.bad_branch = True\n            else: # nodes without date contraints\n\n                arg_2.raw_date_constraint = None\n\n                if arg_2.is_terminal():\n                    # Terminal branches without date constraints marked as 'bad'\n                    arg_2.bad_branch = True\n                else:\n                    # If all branches dowstream are 'bad', and there is no date constraint for\n                    # this node, the branch is marked as 'bad'\n                    arg_2.bad_branch = np.all([x.bad_branch for x in arg_2])\n\n            if arg_2.is_terminal() and arg_2.bad_branch:\n                arg_1 += 1\n\n        if arg_1>arg_0.tree.count_terminals()-3:\n            arg_0.logger(\"ERROR: ALMOST NO VALID DATE CONSTRAINTS, EXITING\", 1, warn=True)\n            return ttconf.ERROR\n\n        return ttconf.SUCCESS", "path": "treetime/clock_tree.py", "identifier": "ClockTree._assign_dates", "docstring": "assign dates to nodes\n\n        Returns\n        -------\n        str\n            success/error code", "docstring_tokens": ["assign", "dates", "to", "nodes"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 257660}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L2130-L2145", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Removes a volume from the data center.", "language": "python", "parameters": "(self, datacenter_id, volume_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/volumes/%s'", "%", "(", "arg_1", ",", "arg_2", ")", ",", "method", "=", "'DELETE'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Removes a volume from the data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      volume_id: The unique ID of the volume.\n        :type       volume_id: ``str``\n\n        \"\"\"\n        arg_3 = arg_0._perform_request(\n            url='/datacenters/%s/volumes/%s' % (\n                arg_1, arg_2), method='DELETE')\n\n        return arg_3", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.delete_volume", "docstring": "Removes a volume from the data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      volume_id: The unique ID of the volume.\n        :type       volume_id: ``str``", "docstring_tokens": ["Removes", "a", "volume", "from", "the", "data", "center", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 257661}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/initializer.py#L57-L80", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Calculate a subcircuit that implements this initialization", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "gates_to_uncompute", "(", ")", "arg_2", "=", "arg_1", ".", "to_instruction", "(", ")", ".", "inverse", "(", ")", "arg_3", "=", "QuantumRegister", "(", "arg_0", ".", "num_qubits", ",", "'q'", ")", "arg_4", "=", "QuantumCircuit", "(", "arg_3", ",", "name", "=", "'init_def'", ")", "for", "arg_5", "in", "arg_3", ":", "arg_4", ".", "append", "(", "Reset", "(", ")", ",", "[", "arg_5", "]", ")", "arg_4", ".", "append", "(", "arg_2", ",", "arg_3", "[", ":", "]", ")", "arg_0", ".", "definition", "=", "arg_4", ".", "data"], "function": "def Func(arg_0):\n        \"\"\"Calculate a subcircuit that implements this initialization\n\n        Implements a recursive initialization algorithm, including optimizations,\n        from \"Synthesis of Quantum Logic Circuits\" Shende, Bullock, Markov\n        https://arxiv.org/abs/quant-ph/0406176v5\n\n        Additionally implements some extra optimizations: remove zero rotations and\n        double cnots.\n        \"\"\"\n        # call to generate the circuit that takes the desired vector to zero\n        arg_1 = arg_0.gates_to_uncompute()\n\n        # invert the circuit to create the desired vector from zero (assuming\n        # the qubits are in the zero state)\n        arg_2 = arg_1.to_instruction().inverse()\n\n        arg_3 = QuantumRegister(arg_0.num_qubits, 'q')\n        arg_4 = QuantumCircuit(arg_3, name='init_def')\n        for arg_5 in arg_3:\n            arg_4.append(Reset(), [arg_5])\n        arg_4.append(arg_2, arg_3[:])\n\n        arg_0.definition = arg_4.data", "path": "qiskit/extensions/initializer.py", "identifier": "Initialize._define", "docstring": "Calculate a subcircuit that implements this initialization\n\n        Implements a recursive initialization algorithm, including optimizations,\n        from \"Synthesis of Quantum Logic Circuits\" Shende, Bullock, Markov\n        https://arxiv.org/abs/quant-ph/0406176v5\n\n        Additionally implements some extra optimizations: remove zero rotations and\n        double cnots.", "docstring_tokens": ["Calculate", "a", "subcircuit", "that", "implements", "this", "initialization"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257662}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L1206-L1259", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Generate a slice array from an index array.", "language": "python", "parameters": "(idx, idx_min=None, idx_max=None, step=None, pad=True)", "return_statement": "return [slice(start, end, step) for (start, end) in zip(idx_fixed, idx_fixed[1:])]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "True", ")", ":", "arg_5", "=", "fix_frames", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_4", "=", "arg_4", ")", "return", "[", "slice", "(", "arg_6", ",", "arg_7", ",", "arg_3", ")", "for", "(", "arg_6", ",", "arg_7", ")", "in", "zip", "(", "arg_5", ",", "arg_5", "[", "1", ":", "]", ")", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=True):\n    '''Generate a slice array from an index array.\n\n    Parameters\n    ----------\n    idx : list-like\n        Array of index boundaries\n\n    idx_min : None or int\n    idx_max : None or int\n        Minimum and maximum allowed indices\n\n    step : None or int\n        Step size for each slice.  If `None`, then the default\n        step of 1 is used.\n\n    pad : boolean\n        If `True`, pad `idx` to span the range `idx_min:idx_max`.\n\n    Returns\n    -------\n    slices : list of slice\n        ``slices[i] = slice(idx[i], idx[i+1], step)``\n        Additional slice objects may be added at the beginning or end,\n        depending on whether ``pad==True`` and the supplied values for\n        `idx_min` and `idx_max`.\n\n    See Also\n    --------\n    fix_frames\n\n    Examples\n    --------\n    >>> # Generate slices from spaced indices\n    >>> librosa.util.Func(np.arange(20, 100, 15))\n    [slice(20, 35, None), slice(35, 50, None), slice(50, 65, None), slice(65, 80, None),\n     slice(80, 95, None)]\n    >>> # Pad to span the range (0, 100)\n    >>> librosa.util.Func(np.arange(20, 100, 15),\n    ...                             idx_min=0, idx_max=100)\n    [slice(0, 20, None), slice(20, 35, None), slice(35, 50, None), slice(50, 65, None),\n     slice(65, 80, None), slice(80, 95, None), slice(95, 100, None)]\n    >>> # Use a step of 5 for each slice\n    >>> librosa.util.Func(np.arange(20, 100, 15),\n    ...                             idx_min=0, idx_max=100, step=5)\n    [slice(0, 20, 5), slice(20, 35, 5), slice(35, 50, 5), slice(50, 65, 5), slice(65, 80, 5),\n     slice(80, 95, 5), slice(95, 100, 5)]\n    '''\n\n    # First, normalize the index set\n    arg_5 = fix_frames(arg_0, arg_1, arg_2, arg_4=arg_4)\n\n    # Now convert the indices to slices\n    return [slice(arg_6, arg_7, arg_3) for (arg_6, arg_7) in zip(arg_5, arg_5[1:])]", "path": "librosa/util/utils.py", "identifier": "index_to_slice", "docstring": "Generate a slice array from an index array.\n\n    Parameters\n    ----------\n    idx : list-like\n        Array of index boundaries\n\n    idx_min : None or int\n    idx_max : None or int\n        Minimum and maximum allowed indices\n\n    step : None or int\n        Step size for each slice.  If `None`, then the default\n        step of 1 is used.\n\n    pad : boolean\n        If `True`, pad `idx` to span the range `idx_min:idx_max`.\n\n    Returns\n    -------\n    slices : list of slice\n        ``slices[i] = slice(idx[i], idx[i+1], step)``\n        Additional slice objects may be added at the beginning or end,\n        depending on whether ``pad==True`` and the supplied values for\n        `idx_min` and `idx_max`.\n\n    See Also\n    --------\n    fix_frames\n\n    Examples\n    --------\n    >>> # Generate slices from spaced indices\n    >>> librosa.util.index_to_slice(np.arange(20, 100, 15))\n    [slice(20, 35, None), slice(35, 50, None), slice(50, 65, None), slice(65, 80, None),\n     slice(80, 95, None)]\n    >>> # Pad to span the range (0, 100)\n    >>> librosa.util.index_to_slice(np.arange(20, 100, 15),\n    ...                             idx_min=0, idx_max=100)\n    [slice(0, 20, None), slice(20, 35, None), slice(35, 50, None), slice(50, 65, None),\n     slice(65, 80, None), slice(80, 95, None), slice(95, 100, None)]\n    >>> # Use a step of 5 for each slice\n    >>> librosa.util.index_to_slice(np.arange(20, 100, 15),\n    ...                             idx_min=0, idx_max=100, step=5)\n    [slice(0, 20, 5), slice(20, 35, 5), slice(35, 50, 5), slice(50, 65, 5), slice(65, 80, 5),\n     slice(80, 95, 5), slice(95, 100, 5)]", "docstring_tokens": ["Generate", "a", "slice", "array", "from", "an", "index", "array", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 257663}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hgnc.py#L236-L252", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return a dictionary with ensembl ids as keys and transcripts as value.", "language": "python", "parameters": "(self, build='37')", "return_statement": "return ensembl_transcripts", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'37'", ")", ":", "Func", "=", "{", "}", "LOG", ".", "info", "(", "\"Fetching all transcripts\"", ")", "for", "arg_3", "in", "arg_0", ".", "transcript_collection", ".", "find", "(", "{", "'build'", ":", "arg_1", "}", ")", ":", "arg_4", "=", "arg_3", "[", "'transcript_id'", "]", "Func", "[", "arg_4", "]", "=", "arg_3", "LOG", ".", "info", "(", "\"Ensembl transcripts fetched\"", ")", "return", "Func"], "function": "def Func(arg_0, arg_1='37'):\n        \"\"\"Return a dictionary with ensembl ids as keys and transcripts as value.\n\n        Args:\n            build(str)\n        \n        Returns:\n            ensembl_transcripts(dict): {<enst_id>: transcripts_obj, ...}\n        \"\"\"\n        Func = {}\n        LOG.info(\"Fetching all transcripts\")\n        for arg_3 in arg_0.transcript_collection.find({'build':arg_1}):\n            arg_4 = arg_3['transcript_id']\n            Func[arg_4] = arg_3\n        LOG.info(\"Ensembl transcripts fetched\")\n\n        return Func", "path": "scout/adapter/mongo/hgnc.py", "identifier": "GeneHandler.ensembl_transcripts", "docstring": "Return a dictionary with ensembl ids as keys and transcripts as value.\n\n        Args:\n            build(str)\n        \n        Returns:\n            ensembl_transcripts(dict): {<enst_id>: transcripts_obj, ...}", "docstring_tokens": ["Return", "a", "dictionary", "with", "ensembl", "ids", "as", "keys", "and", "transcripts", "as", "value", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257664}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/node_profile_analyzer_time.py#L246-L262", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Plot the temporal distance cumulative density function.", "language": "python", "parameters": "(self)", "return_statement": "return fig", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "profile_block_analyzer", ".", "_temporal_distance_cdf", "(", ")", "arg_3", "=", "plt", ".", "figure", "(", ")", "arg_4", "=", "arg_3", ".", "add_subplot", "(", "111", ")", "arg_1", "=", "numpy", ".", "array", "(", "arg_1", ")", "/", "60.0", "arg_4", ".", "plot", "(", "arg_1", ",", "arg_2", ",", "\"-k\"", ")", "arg_4", ".", "fill_between", "(", "arg_1", ",", "arg_2", ",", "color", "=", "\"red\"", ",", "alpha", "=", "0.2", ")", "arg_4", ".", "set_ylabel", "(", "\"CDF(t)\"", ")", "arg_4", ".", "set_xlabel", "(", "\"Temporal distance t (min)\"", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Plot the temporal distance cumulative density function.\n\n        Returns\n        -------\n        fig: matplotlib.Figure\n        \"\"\"\n        arg_1, arg_2 = arg_0.profile_block_analyzer._temporal_distance_cdf()\n        arg_3 = plt.figure()\n        arg_4 = arg_3.add_subplot(111)\n        arg_1 = numpy.array(arg_1) / 60.0\n        arg_4.plot(arg_1, arg_2, \"-k\")\n        arg_4.fill_between(arg_1, arg_2, color=\"red\", alpha=0.2)\n        arg_4.set_ylabel(\"CDF(t)\")\n        arg_4.set_xlabel(\"Temporal distance t (min)\")\n        return arg_3", "path": "gtfspy/routing/node_profile_analyzer_time.py", "identifier": "NodeProfileAnalyzerTime.plot_temporal_distance_cdf", "docstring": "Plot the temporal distance cumulative density function.\n\n        Returns\n        -------\n        fig: matplotlib.Figure", "docstring_tokens": ["Plot", "the", "temporal", "distance", "cumulative", "density", "function", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 257665}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/typeinfo.py#L238-L296", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Return the type object corresponding to a type name.", "language": "python", "parameters": "(self, type_name)", "return_statement": "return self.get_type(type_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_0", ".", "_canonicalize_type", "(", "arg_1", ")", "if", "str", "(", "arg_1", ")", "==", "'int'", ":", "arg_1", "=", "'integer'", "elif", "str", "(", "arg_1", ")", "==", "'str'", ":", "arg_1", "=", "'string'", "elif", "str", "(", "arg_1", ")", "==", "'dict'", ":", "arg_1", "=", "'basic_dict'", "if", "arg_0", ".", "is_known_type", "(", "arg_1", ")", ":", "return", "arg_0", ".", "known_types", "[", "arg_1", "]", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_0", ".", "split_type", "(", "arg_1", ")", "if", "arg_3", "and", "arg_2", "in", "arg_0", ".", "type_factories", ":", "arg_0", ".", "instantiate_type", "(", "arg_1", ",", "arg_2", ",", "arg_4", ")", "return", "arg_0", ".", "known_types", "[", "arg_1", "]", "arg_5", "=", "0", "for", "arg_5", ",", "(", "arg_6", ",", "arg_7", ")", "in", "enumerate", "(", "arg_0", ".", "_lazy_type_sources", ")", ":", "if", "isinstance", "(", "arg_6", ",", "str", ")", ":", "import", "pkg_resources", "for", "arg_8", "in", "pkg_resources", ".", "iter_entry_points", "(", "arg_6", ")", ":", "try", ":", "arg_9", "=", "arg_8", ".", "load", "(", ")", "type_system", ".", "load_type_module", "(", "arg_9", ")", "except", ":", "arg_10", "=", "(", "\"Entry point group: %s, name: %s\"", "%", "(", "arg_6", ",", "arg_8", ".", "name", ")", ",", "sys", ".", "exc_info", ")", "logging", ".", "exception", "(", "\"Error loading external type source from entry point, group: %s, name: %s\"", ",", "arg_6", ",", "arg_8", ".", "name", ")", "arg_0", ".", "failed_sources", ".", "append", "(", "arg_10", ")", "else", ":", "try", ":", "arg_6", "(", "arg_0", ")", "except", ":", "arg_10", "=", "(", "\"source: %s\"", "%", "arg_7", ",", "sys", ".", "exc_info", ")", "logging", ".", "exception", "(", "\"Error loading external type source, source: %s\"", ",", "arg_6", ")", "arg_0", ".", "failed_sources", ".", "append", "(", "arg_10", ")", "if", "arg_0", ".", "is_known_type", "(", "arg_1", ")", "or", "(", "arg_3", "and", "arg_2", "in", "arg_0", ".", "type_factories", ")", ":", "break", "arg_0", ".", "_lazy_type_sources", "=", "arg_0", ".", "_lazy_type_sources", "[", "arg_5", ":", "]", "if", "not", "(", "arg_0", ".", "is_known_type", "(", "arg_1", ")", "or", "(", "arg_3", "and", "arg_2", "in", "arg_0", ".", "type_factories", ")", ")", ":", "raise", "ArgumentError", "(", "\"Func called on unknown type\"", ",", "type", "=", "arg_1", ",", "failed_external_sources", "=", "[", "arg_12", "[", "0", "]", "for", "arg_12", "in", "arg_0", ".", "failed_sources", "]", ")", "return", "arg_0", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the type object corresponding to a type name.\n\n        If type_name is not found, this triggers the loading of\n        external types until a matching type is found or until there\n        are no more external type sources.\n        \"\"\"\n\n        arg_1 = arg_0._canonicalize_type(arg_1)\n\n        # Add basic transformations on common abbreviations\n        if str(arg_1) == 'int':\n            arg_1 = 'integer'\n        elif str(arg_1) == 'str':\n            arg_1 = 'string'\n        elif str(arg_1) == 'dict':\n            arg_1 = 'basic_dict'\n\n        if arg_0.is_known_type(arg_1):\n            return arg_0.known_types[arg_1]\n\n        arg_2, arg_3, arg_4 = arg_0.split_type(arg_1)\n        if arg_3 and arg_2 in arg_0.type_factories:\n            arg_0.instantiate_type(arg_1, arg_2, arg_4)\n            return arg_0.known_types[arg_1]\n\n        # If we're here, this is a type that we don't know anything about, so go find it.\n        arg_5 = 0\n        for arg_5, (arg_6, arg_7) in enumerate(arg_0._lazy_type_sources):\n            if isinstance(arg_6, str):\n                import pkg_resources\n\n                for arg_8 in pkg_resources.iter_entry_points(arg_6):\n                    try:\n                        arg_9 = arg_8.load()\n                        type_system.load_type_module(arg_9)\n                    except:  #pylint:disable=W0702; We want to catch everything here since we don't want external plugins breaking us\n                        arg_10 = (\"Entry point group: %s, name: %s\" % (arg_6, arg_8.name), sys.exc_info)\n                        logging.exception(\"Error loading external type source from entry point, group: %s, name: %s\", arg_6, arg_8.name)\n                        arg_0.failed_sources.append(arg_10)\n            else:\n                try:\n                    arg_6(arg_0)\n                except:  #pylint:disable=W0702; We want to catch everything here since we don't want external plugins breaking us\n                    arg_10 = (\"source: %s\" % arg_7, sys.exc_info)\n                    logging.exception(\"Error loading external type source, source: %s\", arg_6)\n                    arg_0.failed_sources.append(arg_10)\n\n            # Only load as many external sources as we need to resolve this type_name\n            if arg_0.is_known_type(arg_1) or (arg_3 and arg_2 in arg_0.type_factories):\n                break\n\n        arg_0._lazy_type_sources = arg_0._lazy_type_sources[arg_5:]\n\n        # If we've loaded everything and we still can't find it then there's a configuration error somewhere\n        if not (arg_0.is_known_type(arg_1) or (arg_3 and arg_2 in arg_0.type_factories)):\n            raise ArgumentError(\"Func called on unknown type\", type=arg_1, failed_external_sources=[arg_12[0] for arg_12 in arg_0.failed_sources])\n\n        return arg_0.Func(arg_1)", "path": "typedargs/typeinfo.py", "identifier": "TypeSystem.get_type", "docstring": "Return the type object corresponding to a type name.\n\n        If type_name is not found, this triggers the loading of\n        external types until a matching type is found or until there\n        are no more external type sources.", "docstring_tokens": ["Return", "the", "type", "object", "corresponding", "to", "a", "type", "name", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 257666}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/logconfig.py#L10-L18", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Get the default logging handler for Basilisp.", "language": "python", "parameters": "(level: str, fmt: str)", "return_statement": "return handler", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ")", "->", "logging", ".", "Handler", ":", "arg_3", ":", "logging", ".", "Handler", "=", "logging", ".", "NullHandler", "(", ")", "if", "os", ".", "getenv", "(", "\"BASILISP_USE_DEV_LOGGER\"", ")", "==", "\"true\"", ":", "arg_3", "=", "logging", ".", "StreamHandler", "(", ")", "arg_3", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "arg_2", ")", ")", "arg_3", ".", "setLevel", "(", "arg_0", ")", "return", "arg_3"], "function": "def Func(arg_0: arg_1, arg_2: arg_1) -> logging.Handler:\n    \"\"\"Get the default logging handler for Basilisp.\"\"\"\n    arg_3: logging.Handler = logging.NullHandler()\n    if os.getenv(\"BASILISP_USE_DEV_LOGGER\") == \"true\":\n        arg_3 = logging.StreamHandler()\n\n    arg_3.setFormatter(logging.Formatter(arg_2))\n    arg_3.setLevel(arg_0)\n    return arg_3", "path": "src/basilisp/logconfig.py", "identifier": "get_handler", "docstring": "Get the default logging handler for Basilisp.", "docstring_tokens": ["Get", "the", "default", "logging", "handler", "for", "Basilisp", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 257667}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/conversions.py#L158-L166", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Python default hsv to rgb conversion for when hue values in the\n    range 0-359 are preferred.  Due to requiring float math, this method\n    is slower than hsv2rgb_rainbow and hsv2rgb_spectrum.", "language": "python", "parameters": "(hsv)", "return_statement": "return (int(r * 255.0), int(g * 255.0), int(b * 255.0))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "arg_4", ",", "arg_5", ",", "arg_6", "=", "colorsys", ".", "hsv_to_rgb", "(", "arg_1", "/", "360.0", ",", "arg_2", ",", "arg_3", ")", "return", "(", "int", "(", "arg_4", "*", "255.0", ")", ",", "int", "(", "arg_5", "*", "255.0", ")", ",", "int", "(", "arg_6", "*", "255.0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Python default hsv to rgb conversion for when hue values in the\n    range 0-359 are preferred.  Due to requiring float math, this method\n    is slower than hsv2rgb_rainbow and hsv2rgb_spectrum.\"\"\"\n\n    arg_1, arg_2, arg_3 = arg_0\n\n    arg_4, arg_5, arg_6 = colorsys.hsv_to_rgb(arg_1 / 360.0, arg_2, arg_3)\n    return (int(arg_4 * 255.0), int(arg_5 * 255.0), int(arg_6 * 255.0))", "path": "bibliopixel/colors/conversions.py", "identifier": "hsv2rgb_360", "docstring": "Python default hsv to rgb conversion for when hue values in the\n    range 0-359 are preferred.  Due to requiring float math, this method\n    is slower than hsv2rgb_rainbow and hsv2rgb_spectrum.", "docstring_tokens": ["Python", "default", "hsv", "to", "rgb", "conversion", "for", "when", "hue", "values", "in", "the", "range", "0", "-", "359", "are", "preferred", ".", "Due", "to", "requiring", "float", "math", "this", "method", "is", "slower", "than", "hsv2rgb_rainbow", "and", "hsv2rgb_spectrum", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 257668}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varbase/trends.py#L121-L147", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This smooths the magseries with a Gaussian kernel.", "language": "python", "parameters": "(mags, windowsize, windowfwhm=7)", "return_statement": "return smoothed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "7", ")", ":", "arg_3", "=", "Gaussian1DKernel", "(", "arg_2", ",", "x_size", "=", "arg_1", ")", "arg_4", "=", "convolve", "(", "arg_0", ",", "arg_3", ",", "boundary", "=", "'extend'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=7):\n    '''This smooths the magseries with a Gaussian kernel.\n\n    Parameters\n    ----------\n\n    mags : np.array\n        The input mags/flux time-series to smooth.\n\n    windowsize : int\n        This is a odd integer containing the smoothing window size.\n\n    windowfwhm : int\n        This is an odd integer containing the FWHM of the applied Gaussian\n        window function.\n\n    Returns\n    -------\n\n    np.array\n        The smoothed mag/flux time-series array.\n\n    '''\n\n    arg_3 = Gaussian1DKernel(arg_2, x_size=arg_1)\n    arg_4 = convolve(arg_0, arg_3, boundary='extend')\n    return arg_4", "path": "astrobase/varbase/trends.py", "identifier": "smooth_magseries_gaussfilt", "docstring": "This smooths the magseries with a Gaussian kernel.\n\n    Parameters\n    ----------\n\n    mags : np.array\n        The input mags/flux time-series to smooth.\n\n    windowsize : int\n        This is a odd integer containing the smoothing window size.\n\n    windowfwhm : int\n        This is an odd integer containing the FWHM of the applied Gaussian\n        window function.\n\n    Returns\n    -------\n\n    np.array\n        The smoothed mag/flux time-series array.", "docstring_tokens": ["This", "smooths", "the", "magseries", "with", "a", "Gaussian", "kernel", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257669}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py#L530-L573", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Turn any URLs into links.", "language": "python", "parameters": "(el, link_regexes=_link_regexes,\n             avoid_elements=_avoid_elements,\n             avoid_hosts=_avoid_hosts,\n             avoid_classes=_avoid_classes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "arg_6", ",", "arg_7", "=", "arg_8", ")", ":", "if", "arg_0", ".", "tag", "in", "arg_3", ":", "return", "arg_9", "=", "arg_0", ".", "get", "(", "'class'", ")", "if", "arg_9", ":", "arg_9", "=", "arg_9", ".", "split", "(", ")", "for", "arg_10", "in", "arg_7", ":", "if", "arg_10", "in", "arg_9", ":", "return", "for", "arg_11", "in", "list", "(", "arg_0", ")", ":", "Func", "(", "arg_11", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ")", "if", "arg_11", ".", "tail", ":", "arg_12", ",", "arg_13", "=", "_link_text", "(", "arg_11", ".", "tail", ",", "arg_1", ",", "arg_5", ",", "factory", "=", "arg_0", ".", "makeelement", ")", "if", "arg_13", ":", "arg_11", ".", "tail", "=", "arg_12", "arg_15", "=", "arg_0", ".", "index", "(", "arg_11", ")", "arg_0", "[", "arg_15", "+", "1", ":", "arg_15", "+", "1", "]", "=", "arg_13", "if", "arg_0", ".", "text", ":", "arg_12", ",", "arg_16", "=", "_link_text", "(", "arg_0", ".", "text", ",", "arg_1", ",", "arg_5", ",", "factory", "=", "arg_0", ".", "makeelement", ")", "if", "arg_16", ":", "arg_0", ".", "text", "=", "arg_12", "arg_0", "[", ":", "0", "]", "=", "arg_16"], "function": "def Func(arg_0, arg_1=arg_2,\n             arg_3=arg_4,\n             arg_5=arg_6,\n             arg_7=arg_8):\n    \"\"\"\n    Turn any URLs into links.\n\n    It will search for links identified by the given regular\n    expressions (by default mailto and http(s) links).\n\n    It won't link text in an element in avoid_elements, or an element\n    with a class in avoid_classes.  It won't link to anything with a\n    host that matches one of the regular expressions in avoid_hosts\n    (default localhost and 127.0.0.1).\n\n    If you pass in an element, the element's tail will not be\n    substituted, only the contents of the element.\n    \"\"\"\n    if arg_0.tag in arg_3:\n        return\n    arg_9 = arg_0.get('class')\n    if arg_9:\n        arg_9 = arg_9.split()\n        for arg_10 in arg_7:\n            if arg_10 in arg_9:\n                return\n    for arg_11 in list(arg_0):\n        Func(arg_11, arg_1=arg_1,\n                 arg_3=arg_3,\n                 arg_5=arg_5,\n                 arg_7=arg_7)\n        if arg_11.tail:\n            arg_12, arg_13 = _link_text(\n                arg_11.tail, arg_1, arg_5, factory=arg_0.makeelement)\n            if arg_13:\n                arg_11.tail = arg_12\n                arg_15 = arg_0.index(arg_11)\n                arg_0[arg_15+1:arg_15+1] = arg_13\n    if arg_0.text:\n        arg_12, arg_16 = _link_text(\n            arg_0.text, arg_1, arg_5, factory=arg_0.makeelement)\n        if arg_16:\n            arg_0.text = arg_12\n            arg_0[:0] = arg_16", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py", "identifier": "autolink", "docstring": "Turn any URLs into links.\n\n    It will search for links identified by the given regular\n    expressions (by default mailto and http(s) links).\n\n    It won't link text in an element in avoid_elements, or an element\n    with a class in avoid_classes.  It won't link to anything with a\n    host that matches one of the regular expressions in avoid_hosts\n    (default localhost and 127.0.0.1).\n\n    If you pass in an element, the element's tail will not be\n    substituted, only the contents of the element.", "docstring_tokens": ["Turn", "any", "URLs", "into", "links", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257670}
{"url": "https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/build.py#L480-L498", "sha": "b7ad20fe8e7137db99a20ac06b8da26492601b00", "docstring_summary": "If we don't merge the shas from the sha store and if we build a\n    subgraph, the .shastore will only contain the shas of the files\n    from the subgraph and the rest of the graph will have to be\n    rebuilt", "language": "python", "parameters": "(from_store, in_mem_shas, dont_update_shas_of)", "return_statement": "return in_mem_shas", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ":", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "in", "arg_1", "[", "'files'", "]", ":", "del", "arg_1", "[", "'files'", "]", "[", "arg_3", "]", "return", "arg_1", "for", "arg_4", "in", "arg_0", "[", "'files'", "]", ":", "if", "arg_4", "not", "in", "arg_1", "[", "'files'", "]", "and", "arg_4", "not", "in", "arg_2", ":", "arg_1", "[", "'files'", "]", "[", "arg_4", "]", "=", "arg_0", "[", "'files'", "]", "[", "arg_4", "]", "for", "arg_3", "in", "arg_2", ":", "if", "arg_3", "in", "arg_1", "[", "'files'", "]", ":", "del", "arg_1", "[", "'files'", "]", "[", "arg_3", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    If we don't merge the shas from the sha store and if we build a\n    subgraph, the .shastore will only contain the shas of the files\n    from the subgraph and the rest of the graph will have to be\n    rebuilt\n    \"\"\"\n    if not arg_0:\n        for arg_3 in arg_2:\n            if arg_3 in arg_1['files']:\n                del arg_1['files'][arg_3]\n        return arg_1\n    for arg_4 in arg_0['files']:\n        if arg_4 not in arg_1['files'] and arg_4 not in arg_2:\n            arg_1['files'][arg_4] = arg_0['files'][arg_4]\n    for arg_3 in arg_2:\n        if arg_3 in arg_1['files']:\n            del arg_1['files'][arg_3]\n    return arg_1", "path": "sakelib/build.py", "identifier": "merge_from_store_and_in_mems", "docstring": "If we don't merge the shas from the sha store and if we build a\n    subgraph, the .shastore will only contain the shas of the files\n    from the subgraph and the rest of the graph will have to be\n    rebuilt", "docstring_tokens": ["If", "we", "don", "t", "merge", "the", "shas", "from", "the", "sha", "store", "and", "if", "we", "build", "a", "subgraph", "the", ".", "shastore", "will", "only", "contain", "the", "shas", "of", "the", "files", "from", "the", "subgraph", "and", "the", "rest", "of", "the", "graph", "will", "have", "to", "be", "rebuilt"], "nwo": "tonyfischetti/sake", "score": 0.3086509652907828, "idx": 257671}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L741-L748", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Use a PEG to parse expression and return study IDs.", "language": "python", "parameters": "(self, expression, threshold=0.001, func=np.sum)", "return_statement": "return parser.parse(expression).keys().values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.001", ",", "arg_3", "=", "arg_4", ".", "sum", ")", ":", "arg_6", "=", "lp", ".", "Lexer", "(", ")", "arg_6", ".", "build", "(", ")", "arg_7", "=", "lp", ".", "Parser", "(", "arg_6", ",", "arg_0", ".", "dataset", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_7", ".", "build", "(", ")", "return", "arg_7", ".", "parse", "(", "arg_1", ")", ".", "keys", "(", ")", ".", "values"], "function": "def Func(arg_0, arg_1, arg_2=0.001, arg_3=arg_4.sum):\n        \"\"\" Use a PEG to parse expression and return study IDs.\"\"\"\n        arg_6 = lp.Lexer()\n        arg_6.build()\n        arg_7 = lp.Parser(\n            arg_6, arg_0.dataset, arg_2=arg_2, arg_3=arg_3)\n        arg_7.build()\n        return arg_7.parse(arg_1).keys().values", "path": "neurosynth/base/dataset.py", "identifier": "FeatureTable.get_ids_by_expression", "docstring": "Use a PEG to parse expression and return study IDs.", "docstring_tokens": ["Use", "a", "PEG", "to", "parse", "expression", "and", "return", "study", "IDs", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 257672}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L360-L429", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Write a window from a numpy array to an output file.", "language": "python", "parameters": "(\n    in_tile=None, in_data=None, out_profile=None, out_tile=None, out_path=None,\n    tags=None, bucket_resource=None\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "if", "not", "isinstance", "(", "arg_4", ",", "str", ")", ":", "raise", "TypeError", "(", "\"out_path must be a string\"", ")", "logger", ".", "debug", "(", "\"write %s\"", ",", "arg_4", ")", "if", "arg_4", "==", "\"memoryfile\"", ":", "raise", "DeprecationWarning", "(", "\"Writing to memoryfile with Func() is deprecated. \"", "\"Please use RasterWindowMemoryFile.\"", ")", "arg_3", "=", "arg_0", "if", "arg_3", "is", "None", "else", "arg_3", "_validate_write_window_params", "(", "arg_0", ",", "arg_3", ",", "arg_1", ",", "arg_2", ")", "arg_7", "=", "extract_from_array", "(", "in_raster", "=", "arg_1", ",", "in_affine", "=", "arg_0", ".", "affine", ",", "arg_3", "=", "arg_3", ")", "if", "arg_0", "!=", "arg_3", "else", "arg_1", "if", "\"affine\"", "in", "arg_2", ":", "arg_2", "[", "\"transform\"", "]", "=", "arg_2", ".", "pop", "(", "\"affine\"", ")", "if", "arg_7", ".", "all", "(", ")", "is", "not", "ma", ".", "masked", ":", "try", ":", "if", "arg_4", ".", "startswith", "(", "\"s3://\"", ")", ":", "with", "RasterWindowMemoryFile", "(", "arg_0", "=", "arg_3", ",", "arg_1", "=", "arg_7", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")", "as", "memfile", ":", "logger", ".", "debug", "(", "(", "arg_3", ".", "id", ",", "\"upload tile\"", ",", "arg_4", ")", ")", "arg_6", ".", "put_object", "(", "Key", "=", "\"/\"", ".", "join", "(", "arg_4", ".", "split", "(", "\"/\"", ")", "[", "3", ":", "]", ")", ",", "Body", "=", "memfile", ")", "else", ":", "with", "rasterio", ".", "open", "(", "arg_4", ",", "'w'", ",", "**", "arg_2", ")", "as", "dst", ":", "logger", ".", "debug", "(", "(", "arg_3", ".", "id", ",", "\"write tile\"", ",", "arg_4", ")", ")", "dst", ".", "write", "(", "arg_7", ".", "astype", "(", "arg_2", "[", "\"dtype\"", "]", ",", "copy", "=", "False", ")", ")", "_write_tags", "(", "dst", ",", "arg_5", ")", "except", "Exception", "as", "e", ":", "logger", ".", "exception", "(", "\"error while writing file %s: %s\"", ",", "arg_4", ",", "e", ")", "raise", "else", ":", "logger", ".", "debug", "(", "(", "arg_3", ".", "id", ",", "\"array window empty\"", ",", "arg_4", ")", ")"], "function": "def Func(\n    arg_0=None, arg_1=None, arg_2=None, arg_3=None, arg_4=None,\n    arg_5=None, arg_6=None\n):\n    \"\"\"\n    Write a window from a numpy array to an output file.\n\n    Parameters\n    ----------\n    in_tile : ``BufferedTile``\n        ``BufferedTile`` with a data attribute holding NumPy data\n    in_data : array\n    out_profile : dictionary\n        metadata dictionary for rasterio\n    out_tile : ``Tile``\n        provides output boundaries; if None, in_tile is used\n    out_path : string\n        output path to write to\n    tags : optional tags to be added to GeoTIFF file\n    bucket_resource : boto3 bucket resource to write to in case of S3 output\n    \"\"\"\n    if not isinstance(arg_4, str):\n        raise TypeError(\"out_path must be a string\")\n    logger.debug(\"write %s\", arg_4)\n    if arg_4 == \"memoryfile\":\n        raise DeprecationWarning(\n            \"Writing to memoryfile with Func() is deprecated. \"\n            \"Please use RasterWindowMemoryFile.\"\n        )\n    arg_3 = arg_0 if arg_3 is None else arg_3\n    _validate_write_window_params(arg_0, arg_3, arg_1, arg_2)\n\n    # extract data\n    arg_7 = extract_from_array(\n        in_raster=arg_1,\n        in_affine=arg_0.affine,\n        arg_3=arg_3\n    ) if arg_0 != arg_3 else arg_1\n\n    # use transform instead of affine\n    if \"affine\" in arg_2:\n        arg_2[\"transform\"] = arg_2.pop(\"affine\")\n\n    # write if there is any band with non-masked data\n    if arg_7.all() is not ma.masked:\n\n        try:\n            if arg_4.startswith(\"s3://\"):\n                with RasterWindowMemoryFile(\n                    arg_0=arg_3,\n                    arg_1=arg_7,\n                    arg_2=arg_2,\n                    arg_3=arg_3,\n                    arg_5=arg_5\n                ) as memfile:\n                    logger.debug((arg_3.id, \"upload tile\", arg_4))\n                    arg_6.put_object(\n                        Key=\"/\".join(arg_4.split(\"/\")[3:]),\n                        Body=memfile\n                    )\n            else:\n                with rasterio.open(arg_4, 'w', **arg_2) as dst:\n                    logger.debug((arg_3.id, \"write tile\", arg_4))\n                    dst.write(arg_7.astype(arg_2[\"dtype\"], copy=False))\n                    _write_tags(dst, arg_5)\n        except Exception as e:\n            logger.exception(\"error while writing file %s: %s\", arg_4, e)\n            raise\n    else:\n        logger.debug((arg_3.id, \"array window empty\", arg_4))", "path": "mapchete/io/raster.py", "identifier": "write_raster_window", "docstring": "Write a window from a numpy array to an output file.\n\n    Parameters\n    ----------\n    in_tile : ``BufferedTile``\n        ``BufferedTile`` with a data attribute holding NumPy data\n    in_data : array\n    out_profile : dictionary\n        metadata dictionary for rasterio\n    out_tile : ``Tile``\n        provides output boundaries; if None, in_tile is used\n    out_path : string\n        output path to write to\n    tags : optional tags to be added to GeoTIFF file\n    bucket_resource : boto3 bucket resource to write to in case of S3 output", "docstring_tokens": ["Write", "a", "window", "from", "a", "numpy", "array", "to", "an", "output", "file", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 257673}
{"url": "https://github.com/nesdis/djongo/blob/7f9d79455cf030cb5eee0b822502c50a0d9d3abb/djongo/base.py#L159-L185", "sha": "7f9d79455cf030cb5eee0b822502c50a0d9d3abb", "docstring_summary": "Receives a dictionary connection_params to setup\n        a connection to the database.", "language": "python", "parameters": "(self, connection_params)", "return_statement": "return self.client_connection[name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "pop", "(", "'name'", ")", "arg_3", "=", "arg_1", ".", "pop", "(", "'enforce_schema'", ")", "arg_1", "[", "'document_class'", "]", "=", "OrderedDict", "if", "arg_0", ".", "client_connection", "is", "not", "None", ":", "arg_0", ".", "client_connection", ".", "close", "(", ")", "arg_0", ".", "client_connection", "=", "Database", ".", "connect", "(", "**", "arg_1", ")", "arg_5", "=", "arg_0", ".", "client_connection", "[", "arg_2", "]", "arg_0", ".", "djongo_connection", "=", "DjongoClient", "(", "arg_5", ",", "arg_3", ")", "return", "arg_0", ".", "client_connection", "[", "arg_2", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Receives a dictionary connection_params to setup\n        a connection to the database.\n\n        Dictionary correct setup is made through the\n        get_connection_params method.\n\n        TODO: This needs to be made more generic to accept\n        other MongoClient parameters.\n        \"\"\"\n\n        arg_2 = arg_1.pop('name')\n        arg_3 = arg_1.pop('enforce_schema')\n\n        arg_1['document_class'] = OrderedDict\n        # connection_params['tz_aware'] = True\n        # To prevent leaving unclosed connections behind,\n        # client_conn must be closed before a new connection\n        # is created.\n        if arg_0.client_connection is not None:\n            arg_0.client_connection.close()\n\n        arg_0.client_connection = Database.connect(**arg_1)\n        arg_5 = arg_0.client_connection[arg_2]\n        arg_0.djongo_connection = DjongoClient(arg_5, arg_3)\n        return arg_0.client_connection[arg_2]", "path": "djongo/base.py", "identifier": "DatabaseWrapper.get_new_connection", "docstring": "Receives a dictionary connection_params to setup\n        a connection to the database.\n\n        Dictionary correct setup is made through the\n        get_connection_params method.\n\n        TODO: This needs to be made more generic to accept\n        other MongoClient parameters.", "docstring_tokens": ["Receives", "a", "dictionary", "connection_params", "to", "setup", "a", "connection", "to", "the", "database", "."], "nwo": "nesdis/djongo", "score": 0.9667508002289729, "idx": 257674}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L121-L134", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Creates an 'one-off' record for each record in the inputs. Appends new\n  records to the same inputs list.", "language": "python", "parameters": "(inputs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "len", "(", "arg_0", ")", "for", "arg_2", "in", "xrange", "(", "arg_1", ")", ":", "arg_3", "=", "arg_0", "[", "arg_2", "]", "for", "arg_4", "in", "xrange", "(", "len", "(", "arg_3", ")", "-", "1", ")", ":", "if", "arg_3", "[", "arg_4", "]", "==", "1", "and", "arg_3", "[", "arg_4", "+", "1", "]", "==", "0", ":", "arg_5", "=", "copy", ".", "deepcopy", "(", "arg_3", ")", "arg_5", "[", "arg_4", "]", "=", "0", "arg_5", "[", "arg_4", "+", "1", "]", "=", "1", "arg_0", ".", "append", "(", "arg_5", ")", "break"], "function": "def Func(arg_0):\n  \"\"\" Creates an 'one-off' record for each record in the inputs. Appends new\n  records to the same inputs list.\n  \"\"\"\n  arg_1 = len(arg_0)\n  for arg_2 in xrange(arg_1):\n    arg_3 = arg_0[arg_2]\n    for arg_4 in xrange(len(arg_3)-1):\n      if arg_3[arg_4] == 1 and arg_3[arg_4+1] == 0:\n        arg_5 = copy.deepcopy(arg_3)\n        arg_5[arg_4] = 0\n        arg_5[arg_4+1] = 1\n        arg_0.append(arg_5)\n        break", "path": "examples/opf/tools/sp_plotter.py", "identifier": "appendInputWithSimilarValues", "docstring": "Creates an 'one-off' record for each record in the inputs. Appends new\n  records to the same inputs list.", "docstring_tokens": ["Creates", "an", "one", "-", "off", "record", "for", "each", "record", "in", "the", "inputs", ".", "Appends", "new", "records", "to", "the", "same", "inputs", "list", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257675}
{"url": "https://github.com/jhermann/pygments-markdown-lexer/blob/e651a9a3f664285b01451eb39232b1ad9af65956/tasks.py#L32-L57", "sha": "e651a9a3f664285b01451eb39232b1ad9af65956", "docstring_summary": "Refresh the project from the original cookiecutter template.", "language": "python", "parameters": "(ctx, mold='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_1", "=", "arg_1", "or", "\"https://github.com/Springerle/py-generic-project.git\"", "arg_2", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "\"cc-upgrade-pygments-markdown-lexer\"", ")", "if", "os", ".", "path", ".", "isdir", "(", "'.git'", ")", ":", "pass", "if", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "shutil", ".", "rmtree", "(", "arg_2", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "shutil", ".", "copytree", "(", "arg_1", ",", "arg_2", ",", "ignore", "=", "shutil", ".", "ignore_patterns", "(", "\".git\"", ",", "\".svn\"", ",", "\"*~\"", ",", ")", ")", "else", ":", "arg_0", ".", "run", "(", "\"git clone {} {}\"", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", "shutil", ".", "copy2", "(", "\"project.d/cookiecutter.json\"", ",", "arg_2", ")", "with", "pushd", "(", "'..'", ")", ":", "arg_0", ".", "run", "(", "\"cookiecutter --no-input {}\"", ".", "format", "(", "arg_2", ")", ")", "if", "os", ".", "path", ".", "exists", "(", "'.git'", ")", ":", "arg_0", ".", "run", "(", "\"git status\"", ")"], "function": "def Func(arg_0, arg_1=''):\n    \"\"\"Refresh the project from the original cookiecutter template.\"\"\"\n    arg_1 = arg_1 or \"https://github.com/Springerle/py-generic-project.git\"  # TODO: URL from config\n    arg_2 = os.path.join(tempfile.gettempdir(), \"cc-upgrade-pygments-markdown-lexer\")\n\n    if os.path.isdir('.git'):\n        # TODO: Ensure there are no local unstashed changes\n        pass\n\n    # Make a copy of the new mold version\n    if os.path.isdir(arg_2):\n        shutil.rmtree(arg_2)\n    if os.path.exists(arg_1):\n        shutil.copytree(arg_1, arg_2, ignore=shutil.ignore_patterns(\n            \".git\", \".svn\", \"*~\",\n        ))\n    else:\n        arg_0.run(\"git clone {} {}\".format(arg_1, arg_2))\n\n    # Copy recorded \"cookiecutter.json\" into mold\n    shutil.copy2(\"project.d/cookiecutter.json\", arg_2)\n\n    with pushd('..'):\n        arg_0.run(\"cookiecutter --no-input {}\".format(arg_2))\n    if os.path.exists('.git'):\n        arg_0.run(\"git status\")", "path": "tasks.py", "identifier": "fresh_cookies", "docstring": "Refresh the project from the original cookiecutter template.", "docstring_tokens": ["Refresh", "the", "project", "from", "the", "original", "cookiecutter", "template", "."], "nwo": "jhermann/pygments-markdown-lexer", "score": 0.2809582191804827, "idx": 257676}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L911-L954", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Parses the version, data license, name, SPDX Identifier, namespace,\n        and comment.", "language": "python", "parameters": "(self, doc_term)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "builder", ".", "set_doc_spdx_id", "(", "arg_0", ".", "doc", ",", "arg_1", ")", "except", "SPDXValueError", ":", "arg_0", ".", "value_error", "(", "'DOC_SPDX_ID_VALUE'", ",", "arg_1", ")", "try", ":", "if", "arg_1", ".", "count", "(", "'#'", ",", "0", ",", "len", "(", "arg_1", ")", ")", "<=", "1", ":", "arg_2", "=", "arg_1", ".", "split", "(", "'#'", ")", "[", "0", "]", "arg_0", ".", "builder", ".", "set_doc_namespace", "(", "arg_0", ".", "doc", ",", "arg_2", ")", "else", ":", "arg_0", ".", "value_error", "(", "'DOC_NAMESPACE_VALUE'", ",", "arg_1", ")", "except", "SPDXValueError", ":", "arg_0", ".", "value_error", "(", "'DOC_NAMESPACE_VALUE'", ",", "arg_1", ")", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'specVersion'", "]", ",", "None", ")", ")", ":", "try", ":", "arg_0", ".", "builder", ".", "set_doc_version", "(", "arg_0", ".", "doc", ",", "six", ".", "text_type", "(", "arg_5", ")", ")", "except", "SPDXValueError", ":", "arg_0", ".", "value_error", "(", "'DOC_VERS_VALUE'", ",", "arg_5", ")", "except", "CardinalityError", ":", "arg_0", ".", "more_than_one_error", "(", "'specVersion'", ")", "break", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'dataLicense'", "]", ",", "None", ")", ")", ":", "try", ":", "arg_0", ".", "builder", ".", "set_doc_data_lic", "(", "arg_0", ".", "doc", ",", "six", ".", "text_type", "(", "arg_5", ")", ")", "except", "SPDXValueError", ":", "arg_0", ".", "value_error", "(", "'DOC_D_LICS'", ",", "arg_5", ")", "except", "CardinalityError", ":", "arg_0", ".", "more_than_one_error", "(", "'dataLicense'", ")", "break", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'name'", "]", ",", "None", ")", ")", ":", "try", ":", "arg_0", ".", "builder", ".", "set_doc_name", "(", "arg_0", ".", "doc", ",", "six", ".", "text_type", "(", "arg_5", ")", ")", "except", "CardinalityError", ":", "arg_0", ".", "more_than_one_error", "(", "'name'", ")", "break", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "RDFS", ".", "comment", ",", "None", ")", ")", ":", "try", ":", "arg_0", ".", "builder", ".", "set_doc_comment", "(", "arg_0", ".", "doc", ",", "six", ".", "text_type", "(", "arg_5", ")", ")", "except", "CardinalityError", ":", "arg_0", ".", "more_than_one_error", "(", "'Document comment'", ")", "break"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses the version, data license, name, SPDX Identifier, namespace,\n        and comment.\"\"\"\n        try:\n            arg_0.builder.set_doc_spdx_id(arg_0.doc, arg_1)\n        except SPDXValueError:\n            arg_0.value_error('DOC_SPDX_ID_VALUE', arg_1)\n        try:\n            if arg_1.count('#', 0, len(arg_1)) <= 1:\n                arg_2 = arg_1.split('#')[0]\n                arg_0.builder.set_doc_namespace(arg_0.doc, arg_2)\n            else:\n                arg_0.value_error('DOC_NAMESPACE_VALUE', arg_1)\n        except SPDXValueError:\n            arg_0.value_error('DOC_NAMESPACE_VALUE', arg_1)\n        for arg_3, arg_4, arg_5 in arg_0.graph.triples((arg_1, arg_0.spdx_namespace['specVersion'], None)):\n            try:\n                arg_0.builder.set_doc_version(arg_0.doc, six.text_type(arg_5))\n            except SPDXValueError:\n                arg_0.value_error('DOC_VERS_VALUE', arg_5)\n            except CardinalityError:\n                arg_0.more_than_one_error('specVersion')\n                break\n        for arg_3, arg_4, arg_5 in arg_0.graph.triples((arg_1, arg_0.spdx_namespace['dataLicense'], None)):\n            try:\n                arg_0.builder.set_doc_data_lic(arg_0.doc, six.text_type(arg_5))\n            except SPDXValueError:\n                arg_0.value_error('DOC_D_LICS', arg_5)\n            except CardinalityError:\n                arg_0.more_than_one_error('dataLicense')\n                break\n        for arg_3, arg_4, arg_5 in arg_0.graph.triples(\n                (arg_1, arg_0.spdx_namespace['name'], None)):\n            try:\n                arg_0.builder.set_doc_name(arg_0.doc, six.text_type(arg_5))\n            except CardinalityError:\n                arg_0.more_than_one_error('name')\n                break\n        for arg_3, arg_4, arg_5 in arg_0.graph.triples((arg_1, RDFS.comment, None)):\n            try:\n                arg_0.builder.set_doc_comment(arg_0.doc, six.text_type(arg_5))\n            except CardinalityError:\n                arg_0.more_than_one_error('Document comment')\n                break", "path": "spdx/parsers/rdf.py", "identifier": "Parser.parse_doc_fields", "docstring": "Parses the version, data license, name, SPDX Identifier, namespace,\n        and comment.", "docstring_tokens": ["Parses", "the", "version", "data", "license", "name", "SPDX", "Identifier", "namespace", "and", "comment", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 257677}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/reaction.py#L974-L984", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Associates a cobra.Gene object with a cobra.Reaction.", "language": "python", "parameters": "(self, cobra_gene)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_genes", ".", "add", "(", "arg_1", ")", "arg_1", ".", "_reaction", ".", "add", "(", "arg_0", ")", "arg_1", ".", "_model", "=", "arg_0", ".", "_model"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Associates a cobra.Gene object with a cobra.Reaction.\n\n        Parameters\n        ----------\n        cobra_gene : cobra.core.Gene.Gene\n\n        \"\"\"\n        arg_0._genes.add(arg_1)\n        arg_1._reaction.add(arg_0)\n        arg_1._model = arg_0._model", "path": "cobra/core/reaction.py", "identifier": "Reaction._associate_gene", "docstring": "Associates a cobra.Gene object with a cobra.Reaction.\n\n        Parameters\n        ----------\n        cobra_gene : cobra.core.Gene.Gene", "docstring_tokens": ["Associates", "a", "cobra", ".", "Gene", "object", "with", "a", "cobra", ".", "Reaction", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 257678}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L345-L360", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Get the default API key for a user.", "language": "python", "parameters": "(self, email, password)", "return_statement": "return response['apikey']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "dict", "(", ")", "arg_3", "[", "'email'", "]", "=", "arg_1", "arg_3", "[", "'password'", "]", "=", "arg_2", "arg_4", "=", "arg_0", ".", "request", "(", "'midas.user.apikey.default'", ",", "arg_3", ")", "return", "arg_4", "[", "'apikey'", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get the default API key for a user.\n\n        :param email: The email of the user.\n        :type email: string\n        :param password: The user's password.\n        :type password: string\n        :returns: API key to confirm that it was fetched successfully.\n        :rtype: string\n        \"\"\"\n        arg_3 = dict()\n        arg_3['email'] = arg_1\n        arg_3['password'] = arg_2\n        arg_4 = arg_0.request('midas.user.apikey.default', arg_3)\n        return arg_4['apikey']", "path": "pydas/drivers.py", "identifier": "CoreDriver.get_default_api_key", "docstring": "Get the default API key for a user.\n\n        :param email: The email of the user.\n        :type email: string\n        :param password: The user's password.\n        :type password: string\n        :returns: API key to confirm that it was fetched successfully.\n        :rtype: string", "docstring_tokens": ["Get", "the", "default", "API", "key", "for", "a", "user", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 257679}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/nlp.py#L160-L164", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "For each edge expecting a word of this category here, extend the edge.", "language": "python", "parameters": "(self, j, word)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "(", "arg_3", ",", "arg_1", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "in", "arg_0", ".", "chart", "[", "arg_1", "]", ":", "if", "arg_6", "and", "arg_0", ".", "grammar", ".", "isa", "(", "arg_2", ",", "arg_6", "[", "0", "]", ")", ":", "arg_0", ".", "add_edge", "(", "[", "arg_3", ",", "arg_1", "+", "1", ",", "arg_4", ",", "arg_5", "+", "[", "(", "arg_6", "[", "0", "]", ",", "arg_2", ")", "]", ",", "arg_6", "[", "1", ":", "]", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"For each edge expecting a word of this category here, extend the edge.\"\n        for (arg_3, arg_1, arg_4, arg_5, arg_6) in arg_0.chart[arg_1]:\n            if arg_6 and arg_0.grammar.isa(arg_2, arg_6[0]):\n                arg_0.add_edge([arg_3, arg_1+1, arg_4, arg_5 + [(arg_6[0], arg_2)], arg_6[1:]])", "path": "aima/nlp.py", "identifier": "Chart.scanner", "docstring": "For each edge expecting a word of this category here, extend the edge.", "docstring_tokens": ["For", "each", "edge", "expecting", "a", "word", "of", "this", "category", "here", "extend", "the", "edge", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 257680}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/profiles/light_profiles.py#L540-L554", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Calculate the intensity of the cored-Sersic light profile on a grid of radial coordinates.", "language": "python", "parameters": "(self, grid_radii)", "return_statement": "return np.multiply(np.multiply(self.intensity_prime, np.power(\n            np.add(1, np.power(np.divide(self.radius_break, grid_radii), self.alpha)), (self.gamma / self.alpha))),\n                           np.exp(np.multiply(-self.sersic_constant,\n                                              (np.power(np.divide(np.add(np.power(grid_radii, self.alpha), (\n                                                      self.radius_break ** self.alpha)),\n                                                                  (self.effective_radius ** self.alpha)), (\n                                                                1.0 / (self.alpha * self.sersic_index)))))))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "np", ".", "multiply", "(", "np", ".", "multiply", "(", "arg_0", ".", "intensity_prime", ",", "np", ".", "power", "(", "np", ".", "add", "(", "1", ",", "np", ".", "power", "(", "np", ".", "divide", "(", "arg_0", ".", "radius_break", ",", "arg_1", ")", ",", "arg_0", ".", "alpha", ")", ")", ",", "(", "arg_0", ".", "gamma", "/", "arg_0", ".", "alpha", ")", ")", ")", ",", "np", ".", "exp", "(", "np", ".", "multiply", "(", "-", "arg_0", ".", "sersic_constant", ",", "(", "np", ".", "power", "(", "np", ".", "divide", "(", "np", ".", "add", "(", "np", ".", "power", "(", "arg_1", ",", "arg_0", ".", "alpha", ")", ",", "(", "arg_0", ".", "radius_break", "**", "arg_0", ".", "alpha", ")", ")", ",", "(", "arg_0", ".", "effective_radius", "**", "arg_0", ".", "alpha", ")", ")", ",", "(", "1.0", "/", "(", "arg_0", ".", "alpha", "*", "arg_0", ".", "sersic_index", ")", ")", ")", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Calculate the intensity of the cored-Sersic light profile on a grid of radial coordinates.\n\n        Parameters\n        ----------\n        grid_radii : float\n            The radial distance from the centre of the profile. for each coordinate on the grid.\n        \"\"\"\n        return np.multiply(np.multiply(arg_0.intensity_prime, np.power(\n            np.add(1, np.power(np.divide(arg_0.radius_break, arg_1), arg_0.alpha)), (arg_0.gamma / arg_0.alpha))),\n                           np.exp(np.multiply(-arg_0.sersic_constant,\n                                              (np.power(np.divide(np.add(np.power(arg_1, arg_0.alpha), (\n                                                      arg_0.radius_break ** arg_0.alpha)),\n                                                                  (arg_0.effective_radius ** arg_0.alpha)), (\n                                                                1.0 / (arg_0.alpha * arg_0.sersic_index)))))))", "path": "autolens/model/profiles/light_profiles.py", "identifier": "EllipticalCoreSersic.intensities_from_grid_radii", "docstring": "Calculate the intensity of the cored-Sersic light profile on a grid of radial coordinates.\n\n        Parameters\n        ----------\n        grid_radii : float\n            The radial distance from the centre of the profile. for each coordinate on the grid.", "docstring_tokens": ["Calculate", "the", "intensity", "of", "the", "cored", "-", "Sersic", "light", "profile", "on", "a", "grid", "of", "radial", "coordinates", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 257681}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L169-L251", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Bayesian Estimation Supersedes the T-Test", "language": "python", "parameters": "(y1, y2, samples=1000, progressbar=True)", "return_statement": "return model, trace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1000", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "np", ".", "concatenate", "(", "(", "arg_0", ",", "arg_1", ")", ")", "arg_5", "=", "np", ".", "mean", "(", "arg_4", ")", "arg_6", "=", "0.000001", "*", "1", "/", "np", ".", "std", "(", "arg_4", ")", "**", "2", "arg_7", "=", "np", ".", "std", "(", "arg_4", ")", "/", "1000", "arg_8", "=", "np", ".", "std", "(", "arg_4", ")", "*", "1000", "with", "pm", ".", "Model", "(", ")", "as", "model", ":", "arg_9", "=", "pm", ".", "Normal", "(", "'group1_mean'", ",", "mu", "=", "arg_5", ",", "tau", "=", "arg_6", ",", "testval", "=", "arg_0", ".", "mean", "(", ")", ")", "arg_10", "=", "pm", ".", "Normal", "(", "'group2_mean'", ",", "mu", "=", "arg_5", ",", "tau", "=", "arg_6", ",", "testval", "=", "arg_1", ".", "mean", "(", ")", ")", "arg_11", "=", "pm", ".", "Uniform", "(", "'group1_std'", ",", "lower", "=", "arg_7", ",", "upper", "=", "arg_8", ",", "testval", "=", "arg_0", ".", "std", "(", ")", ")", "arg_12", "=", "pm", ".", "Uniform", "(", "'group2_std'", ",", "lower", "=", "arg_7", ",", "upper", "=", "arg_8", ",", "testval", "=", "arg_1", ".", "std", "(", ")", ")", "arg_13", "=", "pm", ".", "Exponential", "(", "'nu_minus_two'", ",", "1", "/", "29.", ",", "testval", "=", "4.", ")", "+", "2.", "arg_14", "=", "pm", ".", "StudentT", "(", "'group1'", ",", "arg_13", "=", "arg_13", ",", "mu", "=", "arg_9", ",", "lam", "=", "arg_11", "**", "-", "2", ",", "observed", "=", "arg_0", ")", "arg_15", "=", "pm", ".", "StudentT", "(", "'group2'", ",", "arg_13", "=", "arg_13", ",", "mu", "=", "arg_10", ",", "lam", "=", "arg_12", "**", "-", "2", ",", "observed", "=", "arg_1", ")", "arg_16", "=", "pm", ".", "Deterministic", "(", "'difference of means'", ",", "arg_10", "-", "arg_9", ")", "pm", ".", "Deterministic", "(", "'difference of stds'", ",", "arg_12", "-", "arg_11", ")", "pm", ".", "Deterministic", "(", "'effect size'", ",", "arg_16", "/", "pm", ".", "math", ".", "sqrt", "(", "(", "arg_11", "**", "2", "+", "arg_12", "**", "2", ")", "/", "2", ")", ")", "pm", ".", "Deterministic", "(", "'group1_annual_volatility'", ",", "arg_14", ".", "distribution", ".", "variance", "**", ".5", "*", "np", ".", "sqrt", "(", "252", ")", ")", "pm", ".", "Deterministic", "(", "'group2_annual_volatility'", ",", "arg_15", ".", "distribution", ".", "variance", "**", ".5", "*", "np", ".", "sqrt", "(", "252", ")", ")", "pm", ".", "Deterministic", "(", "'group1_sharpe'", ",", "arg_14", ".", "distribution", ".", "mean", "/", "arg_14", ".", "distribution", ".", "variance", "**", ".5", "*", "np", ".", "sqrt", "(", "252", ")", ")", "pm", ".", "Deterministic", "(", "'group2_sharpe'", ",", "arg_15", ".", "distribution", ".", "mean", "/", "arg_15", ".", "distribution", ".", "variance", "**", ".5", "*", "np", ".", "sqrt", "(", "252", ")", ")", "arg_17", "=", "pm", ".", "sample", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "model", ",", "arg_17"], "function": "def Func(arg_0, arg_1, arg_2=1000, arg_3=True):\n    \"\"\"\n    Bayesian Estimation Supersedes the T-Test\n\n    This model runs a Bayesian hypothesis comparing if y1 and y2 come\n    from the same distribution. Returns are assumed to be T-distributed.\n\n    In addition, computes annual volatility and Sharpe of in and\n    out-of-sample periods.\n\n    This model replicates the example used in:\n    Kruschke, John. (2012) Bayesian estimation supersedes the t\n    test. Journal of Experimental Psychology: General.\n\n    Parameters\n    ----------\n    y1 : array-like\n        Array of returns (e.g. in-sample)\n    y2 : array-like\n        Array of returns (e.g. out-of-sample)\n    samples : int, optional\n        Number of posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n\n    See Also\n    --------\n    plot_stoch_vol : plotting of tochastic volatility model\n    \"\"\"\n\n    arg_4 = np.concatenate((arg_0, arg_1))\n\n    arg_5 = np.mean(arg_4)\n    arg_6 = 0.000001 * 1 / np.std(arg_4)**2\n\n    arg_7 = np.std(arg_4) / 1000\n    arg_8 = np.std(arg_4) * 1000\n    with pm.Model() as model:\n        arg_9 = pm.Normal('group1_mean', mu=arg_5, tau=arg_6,\n                                testval=arg_0.mean())\n        arg_10 = pm.Normal('group2_mean', mu=arg_5, tau=arg_6,\n                                testval=arg_1.mean())\n        arg_11 = pm.Uniform('group1_std', lower=arg_7,\n                                upper=arg_8, testval=arg_0.std())\n        arg_12 = pm.Uniform('group2_std', lower=arg_7,\n                                upper=arg_8, testval=arg_1.std())\n        arg_13 = pm.Exponential('nu_minus_two', 1 / 29., testval=4.) + 2.\n\n        arg_14 = pm.StudentT('group1', arg_13=arg_13, mu=arg_9,\n                                     lam=arg_11**-2, observed=arg_0)\n        arg_15 = pm.StudentT('group2', arg_13=arg_13, mu=arg_10,\n                                     lam=arg_12**-2, observed=arg_1)\n\n        arg_16 = pm.Deterministic('difference of means',\n                                         arg_10 - arg_9)\n        pm.Deterministic('difference of stds',\n                         arg_12 - arg_11)\n        pm.Deterministic('effect size', arg_16 /\n                         pm.math.sqrt((arg_11**2 +\n                                       arg_12**2) / 2))\n\n        pm.Deterministic('group1_annual_volatility',\n                         arg_14.distribution.variance**.5 *\n                         np.sqrt(252))\n        pm.Deterministic('group2_annual_volatility',\n                         arg_15.distribution.variance**.5 *\n                         np.sqrt(252))\n\n        pm.Deterministic('group1_sharpe', arg_14.distribution.mean /\n                         arg_14.distribution.variance**.5 *\n                         np.sqrt(252))\n        pm.Deterministic('group2_sharpe', arg_15.distribution.mean /\n                         arg_15.distribution.variance**.5 *\n                         np.sqrt(252))\n\n        arg_17 = pm.sample(arg_2, arg_3=arg_3)\n    return model, arg_17", "path": "pyfolio/bayesian.py", "identifier": "model_best", "docstring": "Bayesian Estimation Supersedes the T-Test\n\n    This model runs a Bayesian hypothesis comparing if y1 and y2 come\n    from the same distribution. Returns are assumed to be T-distributed.\n\n    In addition, computes annual volatility and Sharpe of in and\n    out-of-sample periods.\n\n    This model replicates the example used in:\n    Kruschke, John. (2012) Bayesian estimation supersedes the t\n    test. Journal of Experimental Psychology: General.\n\n    Parameters\n    ----------\n    y1 : array-like\n        Array of returns (e.g. in-sample)\n    y2 : array-like\n        Array of returns (e.g. out-of-sample)\n    samples : int, optional\n        Number of posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n\n    See Also\n    --------\n    plot_stoch_vol : plotting of tochastic volatility model", "docstring_tokens": ["Bayesian", "Estimation", "Supersedes", "the", "T", "-", "Test"], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257682}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L266-L278", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Creates a copy of this request context with the same request object.\n        This can be used to move a request context to a different greenlet.\n        Because the actual request object is the same this cannot be used to\n        move a request context to a different thread unless access to the\n        request object is locked.", "language": "python", "parameters": "(self)", "return_statement": "return self.__class__(self.app,\n            environ=self.request.environ,\n            request=self.request\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "__class__", "(", "arg_0", ".", "app", ",", "environ", "=", "arg_0", ".", "request", ".", "environ", ",", "request", "=", "arg_0", ".", "request", ")"], "function": "def Func(arg_0):\n        \"\"\"Creates a Func of this request context with the same request object.\n        This can be used to move a request context to a different greenlet.\n        Because the actual request object is the same this cannot be used to\n        move a request context to a different thread unless access to the\n        request object is locked.\n\n        .. versionadded:: 0.10\n        \"\"\"\n        return arg_0.__class__(arg_0.app,\n            environ=arg_0.request.environ,\n            request=arg_0.request\n        )", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py", "identifier": "RequestContext.copy", "docstring": "Creates a copy of this request context with the same request object.\n        This can be used to move a request context to a different greenlet.\n        Because the actual request object is the same this cannot be used to\n        move a request context to a different thread unless access to the\n        request object is locked.\n\n        .. versionadded:: 0.10", "docstring_tokens": ["Creates", "a", "copy", "of", "this", "request", "context", "with", "the", "same", "request", "object", ".", "This", "can", "be", "used", "to", "move", "a", "request", "context", "to", "a", "different", "greenlet", ".", "Because", "the", "actual", "request", "object", "is", "the", "same", "this", "cannot", "be", "used", "to", "move", "a", "request", "context", "to", "a", "different", "thread", "unless", "access", "to", "the", "request", "object", "is", "locked", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257683}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L598-L615", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return an iterable of possible completions matching the given\n        prefix from the list of aliased namespaces. If name_in_ns is given,\n        further attempt to refine the list to matching names in that namespace.", "language": "python", "parameters": "(\n        self, prefix: str, name_in_ns: Optional[str] = None\n    )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", "[", "arg_2", "]", "=", "None", ")", "->", "Iterable", "[", "arg_2", "]", ":", "arg_5", "=", "filter", "(", "Namespace", ".", "__completion_matcher", "(", "arg_1", ")", ",", "[", "(", "s", ",", "n", ")", "for", "s", ",", "n", "in", "arg_0", ".", "aliases", "]", ")", "if", "arg_3", "is", "not", "None", ":", "for", "arg_6", ",", "arg_7", "in", "arg_5", ":", "for", "arg_8", "in", "arg_7", ".", "__complete_interns", "(", "arg_3", ",", "include_private_vars", "=", "False", ")", ":", "yield", "f\"{prefix}/{match}\"", "else", ":", "for", "arg_9", ",", "arg_6", "in", "arg_5", ":", "yield", "f\"{alias}/\""], "function": "def Func(\n        arg_0, arg_1: arg_2, arg_3: arg_4[arg_2] = None\n    ) -> Iterable[arg_2]:\n        \"\"\"Return an iterable of possible completions matching the given\n        prefix from the list of aliased namespaces. If name_in_ns is given,\n        further attempt to refine the list to matching names in that namespace.\"\"\"\n        arg_5 = filter(\n            Namespace.__completion_matcher(arg_1), [(s, n) for s, n in arg_0.aliases]\n        )\n        if arg_3 is not None:\n            for arg_6, arg_7 in arg_5:\n                for arg_8 in arg_7.__complete_interns(\n                    arg_3, include_private_vars=False\n                ):\n                    yield f\"{prefix}/{match}\"\n        else:\n            for arg_9, arg_6 in arg_5:\n                yield f\"{alias}/\"", "path": "src/basilisp/lang/runtime.py", "identifier": "Namespace.__complete_alias", "docstring": "Return an iterable of possible completions matching the given\n        prefix from the list of aliased namespaces. If name_in_ns is given,\n        further attempt to refine the list to matching names in that namespace.", "docstring_tokens": ["Return", "an", "iterable", "of", "possible", "completions", "matching", "the", "given", "prefix", "from", "the", "list", "of", "aliased", "namespaces", ".", "If", "name_in_ns", "is", "given", "further", "attempt", "to", "refine", "the", "list", "to", "matching", "names", "in", "that", "namespace", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 257684}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/urls.py#L81-L85", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Job version of s3am_upload", "language": "python", "parameters": "(job, file_id, file_name, s3_dir, s3_key_path=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "arg_6", "=", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_1", ",", "os", ".", "path", ".", "join", "(", "arg_5", ",", "arg_2", ")", ")", "s3am_upload", "(", "arg_0", "=", "arg_0", ",", "arg_6", "=", "arg_6", ",", "arg_3", "=", "arg_3", ",", "num_cores", "=", "arg_0", ".", "cores", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n    \"\"\"Job version of s3am_upload\"\"\"\n    arg_5 = arg_0.fileStore.getLocalTempDir()\n    arg_6 = arg_0.fileStore.readGlobalFile(arg_1, os.path.join(arg_5, arg_2))\n    s3am_upload(arg_0=arg_0, arg_6=arg_6, arg_3=arg_3, num_cores=arg_0.cores, arg_4=arg_4)", "path": "src/toil_lib/urls.py", "identifier": "s3am_upload_job", "docstring": "Job version of s3am_upload", "docstring_tokens": ["Job", "version", "of", "s3am_upload"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 257685}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/checkplotproc.py#L722-L750", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a parallel worker for `parallel_update_cp_objectinfo`.", "language": "python", "parameters": "(task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", "try", ":", "arg_3", "=", "update_checkplot_objectinfo", "(", "arg_1", ",", "**", "arg_2", ")", "return", "arg_3", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'failed to update objectinfo for %s'", "%", "arg_1", ")", "return", "None"], "function": "def Func(arg_0):\n    '''This is a parallel worker for `parallel_update_cp_objectinfo`.\n\n    Parameters\n    ----------\n\n    task : tuple\n        - task[0] = checkplot pickle file\n        - task[1] = kwargs\n\n    Returns\n    -------\n\n    str\n        The name of the checkplot file that was updated. None if the update\n        fails for some reason.\n\n    '''\n\n    arg_1, arg_2 = arg_0\n\n    try:\n\n        arg_3 = update_checkplot_objectinfo(arg_1, **arg_2)\n        return arg_3\n\n    except Exception as e:\n        LOGEXCEPTION('failed to update objectinfo for %s' % arg_1)\n        return None", "path": "astrobase/lcproc/checkplotproc.py", "identifier": "cp_objectinfo_worker", "docstring": "This is a parallel worker for `parallel_update_cp_objectinfo`.\n\n    Parameters\n    ----------\n\n    task : tuple\n        - task[0] = checkplot pickle file\n        - task[1] = kwargs\n\n    Returns\n    -------\n\n    str\n        The name of the checkplot file that was updated. None if the update\n        fails for some reason.", "docstring_tokens": ["This", "is", "a", "parallel", "worker", "for", "parallel_update_cp_objectinfo", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257686}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L5088-L5107", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Check if current line contains an inherited function.", "language": "python", "parameters": "(clean_lines, linenum)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "xrange", "(", "arg_1", ",", "max", "(", "-", "1", ",", "arg_1", "-", "10", ")", ",", "-", "1", ")", ":", "arg_3", "=", "Match", "(", "r'^([^()]*\\w+)\\('", ",", "arg_0", ".", "elided", "[", "arg_2", "]", ")", "if", "arg_3", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "CloseExpression", "(", "arg_0", ",", "arg_2", ",", "len", "(", "arg_3", ".", "group", "(", "1", ")", ")", ")", "return", "(", "arg_6", ">=", "0", "and", "Search", "(", "r'\\boverride\\b'", ",", "arg_4", "[", "arg_6", ":", "]", ")", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Check if current line contains an inherited function.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n  Returns:\n    True if current line contains a function with \"override\"\n    virt-specifier.\n  \"\"\"\n  # Scan back a few lines for start of current function\n  for arg_2 in xrange(arg_1, max(-1, arg_1 - 10), -1):\n    arg_3 = Match(r'^([^()]*\\w+)\\(', arg_0.elided[arg_2])\n    if arg_3:\n      # Look for \"override\" after the matching closing parenthesis\n      arg_4, arg_5, arg_6 = CloseExpression(\n          arg_0, arg_2, len(arg_3.group(1)))\n      return (arg_6 >= 0 and\n              Search(r'\\boverride\\b', arg_4[arg_6:]))\n  return False", "path": "third_party/python/cpplint/cpplint.py", "identifier": "IsDerivedFunction", "docstring": "Check if current line contains an inherited function.\n\n  Args:\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n  Returns:\n    True if current line contains a function with \"override\"\n    virt-specifier.", "docstring_tokens": ["Check", "if", "current", "line", "contains", "an", "inherited", "function", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257687}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L441-L445", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Retrieve a single domain record given the id", "language": "python", "parameters": "(self, id, **kwargs)", "return_statement": "return super(DomainRecords, self).get(id, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "return", "super", "(", "DomainRecords", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Retrieve a single domain record given the id\n        \"\"\"\n        return super(DomainRecords, arg_0).Func(arg_1, **arg_2)", "path": "poseidon/api.py", "identifier": "DomainRecords.get", "docstring": "Retrieve a single domain record given the id", "docstring_tokens": ["Retrieve", "a", "single", "domain", "record", "given", "the", "id"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 257688}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muccore.py#L120-L137", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Evaluate XPath expression in context of `self.xmlnode`.", "language": "python", "parameters": "(self,expr)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "common_doc", ".", "xpathNewContext", "(", ")", "arg_2", ".", "setContextNode", "(", "arg_0", ".", "xmlnode", ")", "arg_2", ".", "xpathRegisterNs", "(", "\"muc\"", ",", "arg_0", ".", "ns", ".", "getContent", "(", ")", ")", "arg_3", "=", "arg_2", ".", "xpathEval", "(", "to_utf8", "(", "arg_1", ")", ")", "arg_2", ".", "xpathFreeContext", "(", ")", "return", "arg_3"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Evaluate XPath expression in context of `self.xmlnode`.\n\n        :Parameters:\n            - `expr`: the XPath expression\n        :Types:\n            - `expr`: `unicode`\n\n        :return: the result of the expression evaluation.\n        :returntype: list of `libxml2.xmlNode`\n        \"\"\"\n        arg_2 = common_doc.xpathNewContext()\n        arg_2.setContextNode(arg_0.xmlnode)\n        arg_2.xpathRegisterNs(\"muc\",arg_0.ns.getContent())\n        arg_3=arg_2.xpathEval(to_utf8(arg_1))\n        arg_2.xpathFreeContext()\n        return arg_3", "path": "pyxmpp2/ext/muc/muccore.py", "identifier": "MucXBase.xpath_eval", "docstring": "Evaluate XPath expression in context of `self.xmlnode`.\n\n        :Parameters:\n            - `expr`: the XPath expression\n        :Types:\n            - `expr`: `unicode`\n\n        :return: the result of the expression evaluation.\n        :returntype: list of `libxml2.xmlNode`", "docstring_tokens": ["Evaluate", "XPath", "expression", "in", "context", "of", "self", ".", "xmlnode", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257689}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/mp4.py#L362-L386", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Save the metadata to the given filename.", "language": "python", "parameters": "(self, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "sorted", "(", "arg_0", ".", "items", "(", ")", ",", "arg_4", "=", "MP4Tags", ".", "__get_sort_stats", ")", "for", "arg_4", ",", "arg_5", "in", "arg_3", ":", "arg_6", "=", "arg_0", ".", "__atoms", ".", "get", "(", "arg_4", "[", ":", "4", "]", ",", "(", "None", ",", "type", "(", "arg_0", ")", ".", "__render_text", ")", ")", "try", ":", "arg_2", ".", "append", "(", "arg_6", "[", "1", "]", "(", "arg_0", ",", "arg_4", ",", "arg_5", ",", "*", "arg_6", "[", "2", ":", "]", ")", ")", "except", "(", "TypeError", ",", "ValueError", ")", "as", "s", ":", "reraise", "(", "MP4MetadataValueError", ",", "s", ",", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ")", "arg_7", "=", "Atom", ".", "render", "(", "b\"ilst\"", ",", "b\"\"", ".", "join", "(", "arg_2", ")", ")", "arg_8", "=", "open", "(", "arg_1", ",", "\"rb+\"", ")", "try", ":", "arg_9", "=", "Atoms", "(", "arg_8", ")", "try", ":", "arg_10", "=", "arg_9", ".", "path", "(", "b\"moov\"", ",", "b\"udta\"", ",", "b\"meta\"", ",", "b\"ilst\"", ")", "except", "KeyError", ":", "arg_0", ".", "__Func_new", "(", "arg_8", ",", "arg_9", ",", "arg_7", ")", "else", ":", "arg_0", ".", "__Func_existing", "(", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_7", ")", "finally", ":", "arg_8", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Save the metadata to the given filename.\"\"\"\n\n        arg_2 = []\n        arg_3 = sorted(arg_0.items(), arg_4=MP4Tags.__get_sort_stats )\n        for arg_4, arg_5 in arg_3:\n            arg_6 = arg_0.__atoms.get(arg_4[:4], (None, type(arg_0).__render_text))\n            try:\n                arg_2.append(arg_6[1](arg_0, arg_4, arg_5, *arg_6[2:]))\n            except (TypeError, ValueError) as s:\n                reraise(MP4MetadataValueError, s, sys.exc_info()[2])\n        arg_7 = Atom.render(b\"ilst\", b\"\".join(arg_2))\n\n        # Find the old atoms.\n        arg_8 = open(arg_1, \"rb+\")\n        try:\n            arg_9 = Atoms(arg_8)\n            try:\n                arg_10 = arg_9.path(b\"moov\", b\"udta\", b\"meta\", b\"ilst\")\n            except KeyError:\n                arg_0.__Func_new(arg_8, arg_9, arg_7)\n            else:\n                arg_0.__Func_existing(arg_8, arg_9, arg_10, arg_7)\n        finally:\n            arg_8.close()", "path": "mutagen/mp4.py", "identifier": "MP4Tags.save", "docstring": "Save the metadata to the given filename.", "docstring_tokens": ["Save", "the", "metadata", "to", "the", "given", "filename", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 257690}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3077-L3102", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Convert cylindrical polar velocities to Cartesian.", "language": "python", "parameters": "(self, x='x', y='y', azimuth=None, vr='vr_polar', vazimuth='vphi_polar', vx_out='vx', vy_out='vy', propagate_uncertainties=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'x'", ",", "arg_2", "=", "'y'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'vr_polar'", ",", "arg_5", "=", "'vphi_polar'", ",", "arg_6", "=", "'vx'", ",", "arg_7", "=", "'vy'", ",", "arg_8", "=", "False", ")", ":", "arg_1", "=", "arg_0", ".", "_expr", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "_expr", "(", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_expr", "(", "arg_4", ")", "arg_5", "=", "arg_0", ".", "_expr", "(", "arg_5", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "=", "arg_0", ".", "_expr", "(", "arg_3", ")", "arg_3", "=", "np", ".", "deg2rad", "(", "arg_3", ")", "else", ":", "arg_3", "=", "np", ".", "arctan2", "(", "arg_2", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_expr", "(", "arg_3", ")", "arg_0", "[", "arg_6", "]", "=", "arg_4", "*", "np", ".", "cos", "(", "arg_3", ")", "-", "arg_5", "*", "np", ".", "sin", "(", "arg_3", ")", "arg_0", "[", "arg_7", "]", "=", "arg_4", "*", "np", ".", "sin", "(", "arg_3", ")", "+", "arg_5", "*", "np", ".", "cos", "(", "arg_3", ")", "if", "arg_8", ":", "arg_0", ".", "propagate_uncertainties", "(", "[", "arg_0", "[", "arg_6", "]", ",", "arg_0", "[", "arg_7", "]", "]", ")"], "function": "def Func(arg_0, arg_1='x', arg_2='y', arg_3=None, arg_4='vr_polar', arg_5='vphi_polar', arg_6='vx', arg_7='vy', arg_8=False):\n        \"\"\" Convert cylindrical polar velocities to Cartesian.\n\n        :param x:\n        :param y:\n        :param azimuth: Optional expression for the azimuth in degrees , may lead to a better performance when given.\n        :param vr:\n        :param vazimuth:\n        :param vx_out:\n        :param vy_out:\n        :param propagate_uncertainties: {propagate_uncertainties}\n        \"\"\"\n        arg_1 = arg_0._expr(arg_1)\n        arg_2 = arg_0._expr(arg_2)\n        arg_4 = arg_0._expr(arg_4)\n        arg_5 = arg_0._expr(arg_5)\n        if arg_3 is not None:\n            arg_3 = arg_0._expr(arg_3)\n            arg_3 = np.deg2rad(arg_3)\n        else:\n            arg_3 = np.arctan2(arg_2, arg_1)\n        arg_3 = arg_0._expr(arg_3)\n        arg_0[arg_6] = arg_4 * np.cos(arg_3) - arg_5 * np.sin(arg_3)\n        arg_0[arg_7] = arg_4 * np.sin(arg_3) + arg_5 * np.cos(arg_3)\n        if arg_8:\n            arg_0.propagate_uncertainties([arg_0[arg_6], arg_0[arg_7]])", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.add_virtual_columns_polar_velocities_to_cartesian", "docstring": "Convert cylindrical polar velocities to Cartesian.\n\n        :param x:\n        :param y:\n        :param azimuth: Optional expression for the azimuth in degrees , may lead to a better performance when given.\n        :param vr:\n        :param vazimuth:\n        :param vx_out:\n        :param vy_out:\n        :param propagate_uncertainties: {propagate_uncertainties}", "docstring_tokens": ["Convert", "cylindrical", "polar", "velocities", "to", "Cartesian", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257691}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varbase/transits.py#L399-L521", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Gets the transit start, middle, and end times for transits in a given\n    time-series of observations.", "language": "python", "parameters": "(\n        time,\n        flux,\n        err_flux,\n        blsfit_savpath=None,\n        trapfit_savpath=None,\n        magsarefluxes=True,\n        nworkers=1,\n        sigclip=None,\n        extra_maskfrac=0.03\n)", "return_statement": "return tmids, t_starts, t_ends", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "True", ",", "arg_6", "=", "1", ",", "arg_7", "=", "None", ",", "arg_8", "=", "0.03", ")", ":", "arg_9", "=", "1.05", "*", "(", "np", ".", "nanmax", "(", "arg_0", ")", "-", "np", ".", "nanmin", "(", "arg_0", ")", ")", "/", "2", "arg_10", "=", "kbls", ".", "bls_parallel_pfind", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_5", "=", "arg_5", ",", "startp", "=", "0.1", ",", "arg_9", "=", "arg_9", ",", "maxtransitduration", "=", "0.3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "arg_11", "=", "kbls", ".", "bls_stats_singleperiod", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_10", "[", "'bestperiod'", "]", ",", "arg_5", "=", "True", ",", "arg_7", "=", "arg_7", ",", "perioddeltapercent", "=", "5", ")", "if", "arg_3", ":", "make_fit_plot", "(", "arg_11", "[", "'phases'", "]", ",", "arg_11", "[", "'phasedmags'", "]", ",", "None", ",", "arg_11", "[", "'blsmodel'", "]", ",", "arg_11", "[", "'period'", "]", ",", "arg_11", "[", "'epoch'", "]", ",", "arg_11", "[", "'epoch'", "]", ",", "arg_3", ",", "arg_5", "=", "arg_5", ")", "arg_12", "=", "arg_11", "[", "'transitduration'", "]", "*", "0.2", "arg_13", "=", "[", "arg_11", "[", "'period'", "]", ",", "arg_11", "[", "'epoch'", "]", ",", "arg_11", "[", "'transitdepth'", "]", ",", "arg_11", "[", "'transitduration'", "]", ",", "arg_12", "]", "if", "arg_4", ":", "arg_14", "=", "traptransit_fit_magseries", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_13", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", "plotfit", "=", "arg_4", ")", "arg_15", ",", "arg_16", ",", "arg_17", "=", "get_transit_times", "(", "arg_11", ",", "arg_0", ",", "arg_8", ",", "arg_14", "=", "arg_14", ")", "return", "arg_15", ",", "arg_16", ",", "arg_17"], "function": "def Func(\n        arg_0,\n        arg_1,\n        arg_2,\n        arg_3=None,\n        arg_4=None,\n        arg_5=True,\n        arg_6=1,\n        arg_7=None,\n        arg_8=0.03\n):\n    '''Gets the transit start, middle, and end times for transits in a given\n    time-series of observations.\n\n    Parameters\n    ----------\n\n    time,flux,err_flux : np.array\n        The input flux time-series measurements and their associated measurement\n        errors\n\n    blsfit_savpath : str or None\n        If provided as a str, indicates the path of the fit plot to make for a\n        simple BLS model fit to the transit using the obtained period and epoch.\n\n    trapfit_savpath : str or None\n        If provided as a str, indicates the path of the fit plot to make for a\n        trapezoidal transit model fit to the transit using the obtained period\n        and epoch.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    magsarefluxes : bool\n        This is by default True for this function, since it works on fluxes only\n        at the moment.\n\n    nworkers : int\n        The number of parallel BLS period-finder workers to use.\n\n    extra_maskfrac : float\n        This is the separation (N) from in-transit points you desire, in units\n        of the transit duration. `extra_maskfrac = 0` if you just want points\n        inside transit, otherwise::\n\n            t_starts = t_Is - N*tdur, t_ends = t_IVs + N*tdur\n\n        Thus setting N=0.03 masks slightly more than the guessed transit\n        duration.\n\n    Returns\n    -------\n\n    (tmids_obsd, t_starts, t_ends) : tuple\n        The returned items are::\n\n            tmids_obsd (np.ndarray): best guess of transit midtimes in\n            lightcurve. Has length number of transits in lightcurve.\n\n            t_starts (np.ndarray): t_Is - extra_maskfrac*tdur, for t_Is transit\n            first contact point.\n\n            t_ends (np.ndarray): t_Is + extra_maskfrac*tdur, for t_Is transit\n            first contact point.\n\n    '''\n\n    # first, run BLS to get an initial epoch and period.\n    arg_9 = 1.05*(np.nanmax(arg_0) - np.nanmin(arg_0))/2\n\n    arg_10 = kbls.bls_parallel_pfind(arg_0, arg_1, arg_2,\n                                      arg_5=arg_5, startp=0.1,\n                                      arg_9=arg_9, maxtransitduration=0.3,\n                                      arg_6=arg_6, arg_7=arg_7)\n\n    arg_11 = kbls.bls_stats_singleperiod(arg_0, arg_1, arg_2,\n                                       arg_10['bestperiod'],\n                                       arg_5=True, arg_7=arg_7,\n                                       perioddeltapercent=5)\n    #  plot the BLS model.\n    if arg_3:\n        make_fit_plot(arg_11['phases'], arg_11['phasedmags'], None,\n                      arg_11['blsmodel'], arg_11['period'], arg_11['epoch'],\n                      arg_11['epoch'], arg_3,\n                      arg_5=arg_5)\n\n    arg_12 = arg_11['transitduration'] * 0.2  # a guesstimate.\n    arg_13 = [\n        arg_11['period'], arg_11['epoch'], arg_11['transitdepth'],\n        arg_11['transitduration'], arg_12\n    ]\n\n    # fit a trapezoidal transit model; plot the resulting phased LC.\n    if arg_4:\n        arg_14 = traptransit_fit_magseries(arg_0, arg_1, arg_2,\n                                          arg_13,\n                                          arg_5=arg_5,\n                                          arg_7=arg_7,\n                                          plotfit=arg_4)\n\n    # use the trapezoidal model's epoch as the guess to identify (roughly) in\n    # and out of transit points\n    arg_15, arg_16, arg_17 = get_transit_times(arg_11,\n                                                arg_0,\n                                                arg_8,\n                                                arg_14=arg_14)\n\n    return arg_15, arg_16, arg_17", "path": "astrobase/varbase/transits.py", "identifier": "given_lc_get_transit_tmids_tstarts_tends", "docstring": "Gets the transit start, middle, and end times for transits in a given\n    time-series of observations.\n\n    Parameters\n    ----------\n\n    time,flux,err_flux : np.array\n        The input flux time-series measurements and their associated measurement\n        errors\n\n    blsfit_savpath : str or None\n        If provided as a str, indicates the path of the fit plot to make for a\n        simple BLS model fit to the transit using the obtained period and epoch.\n\n    trapfit_savpath : str or None\n        If provided as a str, indicates the path of the fit plot to make for a\n        trapezoidal transit model fit to the transit using the obtained period\n        and epoch.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    magsarefluxes : bool\n        This is by default True for this function, since it works on fluxes only\n        at the moment.\n\n    nworkers : int\n        The number of parallel BLS period-finder workers to use.\n\n    extra_maskfrac : float\n        This is the separation (N) from in-transit points you desire, in units\n        of the transit duration. `extra_maskfrac = 0` if you just want points\n        inside transit, otherwise::\n\n            t_starts = t_Is - N*tdur, t_ends = t_IVs + N*tdur\n\n        Thus setting N=0.03 masks slightly more than the guessed transit\n        duration.\n\n    Returns\n    -------\n\n    (tmids_obsd, t_starts, t_ends) : tuple\n        The returned items are::\n\n            tmids_obsd (np.ndarray): best guess of transit midtimes in\n            lightcurve. Has length number of transits in lightcurve.\n\n            t_starts (np.ndarray): t_Is - extra_maskfrac*tdur, for t_Is transit\n            first contact point.\n\n            t_ends (np.ndarray): t_Is + extra_maskfrac*tdur, for t_Is transit\n            first contact point.", "docstring_tokens": ["Gets", "the", "transit", "start", "middle", "and", "end", "times", "for", "transits", "in", "a", "given", "time", "-", "series", "of", "observations", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 257692}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L347-L361", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "create a copy of each selected object", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "selection", ":", "if", "arg_3", ":", "if", "DEBUG", ":", "print", "\"duplicating\"", ",", "arg_3", ".", "name", "arg_3", ".", "sel_marker", ".", "destroy", "(", ")", "arg_3", ".", "sel_marker", "=", "None", "arg_5", "=", "arg_3", ".", "Func", "(", ")", "arg_5", ".", "sel_marker", "=", "SelectionMarker", "(", "arg_5", ")", "arg_5", ".", "sel_marker", ".", "show", "(", "True", ")", "arg_2", ".", "append", "(", "arg_5", ")", "arg_0", ".", "selection", "=", "arg_2", "arg_0", ".", "inspector", ".", "load_object", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"create a copy of each selected object\"\n        # Func the selected objects (if any)\n        arg_2 = []\n        for arg_3 in arg_0.selection:\n            if arg_3:\n                if DEBUG: print \"duplicating\", arg_3.name\n                arg_3.sel_marker.destroy()\n                arg_3.sel_marker = None\n                arg_5 = arg_3.Func()\n                arg_5.sel_marker = SelectionMarker(arg_5)\n                arg_5.sel_marker.show(True)\n                arg_2.append(arg_5)\n        arg_0.selection = arg_2              # update with new obj's\n        arg_0.inspector.load_object()", "path": "gui/tools/designer.py", "identifier": "BasicDesigner.duplicate", "docstring": "create a copy of each selected object", "docstring_tokens": ["create", "a", "copy", "of", "each", "selected", "object"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 257693}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/objects.py#L1291-L1319", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Verify that the contents of the SecretData object are valid.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ".", "value", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"secret value must be bytes\"", ")", "elif", "not", "isinstance", "(", "arg_0", ".", "data_type", ",", "enums", ".", "SecretDataType", ")", ":", "raise", "TypeError", "(", "\"secret data type must be a SecretDataType \"", "\"enumeration\"", ")", "arg_1", "=", "len", "(", "arg_0", ".", "cryptographic_usage_masks", ")", "for", "arg_2", "in", "range", "(", "arg_1", ")", ":", "arg_3", "=", "arg_0", ".", "cryptographic_usage_masks", "[", "arg_2", "]", "if", "not", "isinstance", "(", "arg_3", ",", "enums", ".", "CryptographicUsageMask", ")", ":", "arg_4", "=", "\"({0} in list)\"", ".", "format", "(", "arg_2", ")", "raise", "TypeError", "(", "\"secret data mask {0} must be a CryptographicUsageMask \"", "\"enumeration\"", ".", "format", "(", "arg_4", ")", ")", "arg_5", "=", "len", "(", "arg_0", ".", "names", ")", "for", "arg_2", "in", "range", "(", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "names", "[", "arg_2", "]", "if", "not", "isinstance", "(", "arg_6", ",", "six", ".", "string_types", ")", ":", "arg_4", "=", "\"({0} in list)\"", ".", "format", "(", "arg_2", ")", "raise", "TypeError", "(", "\"secret data name {0} must be a string\"", ".", "format", "(", "arg_4", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Verify that the contents of the SecretData object are valid.\n\n        Raises:\n            TypeError: if the types of any SecretData attributes are invalid.\n        \"\"\"\n        if not isinstance(arg_0.value, bytes):\n            raise TypeError(\"secret value must be bytes\")\n        elif not isinstance(arg_0.data_type, enums.SecretDataType):\n            raise TypeError(\"secret data type must be a SecretDataType \"\n                            \"enumeration\")\n\n        arg_1 = len(arg_0.cryptographic_usage_masks)\n        for arg_2 in range(arg_1):\n            arg_3 = arg_0.cryptographic_usage_masks[arg_2]\n            if not isinstance(arg_3, enums.CryptographicUsageMask):\n                arg_4 = \"({0} in list)\".format(arg_2)\n                raise TypeError(\n                    \"secret data mask {0} must be a CryptographicUsageMask \"\n                    \"enumeration\".format(arg_4))\n\n        arg_5 = len(arg_0.names)\n        for arg_2 in range(arg_5):\n            arg_6 = arg_0.names[arg_2]\n            if not isinstance(arg_6, six.string_types):\n                arg_4 = \"({0} in list)\".format(arg_2)\n                raise TypeError(\"secret data name {0} must be a string\".format(\n                    arg_4))", "path": "kmip/pie/objects.py", "identifier": "SecretData.validate", "docstring": "Verify that the contents of the SecretData object are valid.\n\n        Raises:\n            TypeError: if the types of any SecretData attributes are invalid.", "docstring_tokens": ["Verify", "that", "the", "contents", "of", "the", "SecretData", "object", "are", "valid", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 257694}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/datasets/phototour.py#L158-L186", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Return a Tensor containing the patches", "language": "python", "parameters": "(data_dir, image_ext, n)", "return_statement": "return torch.ByteTensor(np.array(patches[:n]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "PIL2array", "(", "arg_3", ")", ":", "return", "np", ".", "array", "(", "arg_3", ".", "getdata", "(", ")", ",", "dtype", "=", "np", ".", "uint8", ")", ".", "reshape", "(", "64", ",", "64", ")", "def", "find_files", "(", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "[", "]", "for", "arg_7", "in", "os", ".", "listdir", "(", "arg_4", ")", ":", "if", "arg_7", ".", "endswith", "(", "arg_5", ")", ":", "arg_6", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_7", ")", ")", "return", "sorted", "(", "arg_6", ")", "arg_8", "=", "[", "]", "arg_9", "=", "find_files", "(", "arg_0", ",", "arg_1", ")", "for", "arg_10", "in", "arg_9", ":", "arg_11", "=", "Image", ".", "open", "(", "arg_10", ")", "for", "arg_12", "in", "range", "(", "0", ",", "1024", ",", "64", ")", ":", "for", "arg_13", "in", "range", "(", "0", ",", "1024", ",", "64", ")", ":", "arg_14", "=", "arg_11", ".", "crop", "(", "(", "arg_13", ",", "arg_12", ",", "arg_13", "+", "64", ",", "arg_12", "+", "64", ")", ")", "arg_8", ".", "append", "(", "PIL2array", "(", "arg_14", ")", ")", "return", "torch", ".", "ByteTensor", "(", "np", ".", "array", "(", "arg_8", "[", ":", "arg_2", "]", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Return a Tensor containing the patches\n    \"\"\"\n\n    def PIL2array(arg_3):\n        \"\"\"Convert PIL image type to numpy 2D array\n        \"\"\"\n        return np.array(arg_3.getdata(), dtype=np.uint8).reshape(64, 64)\n\n    def find_files(arg_4, arg_5):\n        \"\"\"Return a list with the file names of the images containing the patches\n        \"\"\"\n        arg_6 = []\n        # find those files with the specified extension\n        for arg_7 in os.listdir(arg_4):\n            if arg_7.endswith(arg_5):\n                arg_6.append(os.path.join(arg_4, arg_7))\n        return sorted(arg_6)  # sort files in ascend order to keep relations\n\n    arg_8 = []\n    arg_9 = find_files(arg_0, arg_1)\n\n    for arg_10 in arg_9:\n        arg_11 = Image.open(arg_10)\n        for arg_12 in range(0, 1024, 64):\n            for arg_13 in range(0, 1024, 64):\n                arg_14 = arg_11.crop((arg_13, arg_12, arg_13 + 64, arg_12 + 64))\n                arg_8.append(PIL2array(arg_14))\n    return torch.ByteTensor(np.array(arg_8[:arg_2]))", "path": "torchvision/datasets/phototour.py", "identifier": "read_image_file", "docstring": "Return a Tensor containing the patches", "docstring_tokens": ["Return", "a", "Tensor", "containing", "the", "patches"], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 257695}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/capture.py#L47-L52", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Configure plugin. Plugin is enabled by default.", "language": "python", "parameters": "(self, options, conf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "conf", "=", "arg_2", "if", "not", "arg_1", ".", "capture", ":", "arg_0", ".", "enabled", "=", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Configure plugin. Plugin is enabled by default.\n        \"\"\"\n        arg_0.conf = arg_2\n        if not arg_1.capture:\n            arg_0.enabled = False", "path": "environment/lib/python2.7/site-packages/nose/plugins/capture.py", "identifier": "Capture.configure", "docstring": "Configure plugin. Plugin is enabled by default.", "docstring_tokens": ["Configure", "plugin", ".", "Plugin", "is", "enabled", "by", "default", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257696}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/config.py#L227-L262", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Load .PyFunceble.yaml into the system.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "PyFunceble", ".", "CONFIGURATION", ".", "update", "(", "Dict", ".", "from_yaml", "(", "File", "(", "arg_0", ".", "path_to_config", ")", ".", "read", "(", ")", ")", ")", "arg_0", ".", "_install_iana_config", "(", ")", "arg_0", ".", "_install_psl_config", "(", ")", "arg_0", ".", "_install_directory_structure_file", "(", ")", "except", "FileNotFoundError", "as", "exception", ":", "if", "PyFunceble", ".", "path", ".", "isfile", "(", "arg_0", ".", "path_to_default_config", ")", ":", "File", "(", "arg_0", ".", "path_to_default_config", ")", ".", "copy", "(", "arg_0", ".", "path_to_config", ")", "arg_0", ".", "Func", "(", ")", "else", ":", "raise", "exception"], "function": "def Func(arg_0):\n        \"\"\"\n        Load .PyFunceble.yaml into the system.\n        \"\"\"\n\n        try:\n            # We try to load the configuration file.\n\n            PyFunceble.CONFIGURATION.update(\n                Dict.from_yaml(File(arg_0.path_to_config).read())\n            )\n\n            # We install the latest iana configuration file.\n            arg_0._install_iana_config()\n\n            # We install the latest public suffix configuration file.\n            arg_0._install_psl_config()\n\n            # We install the latest directory structure file.\n            arg_0._install_directory_structure_file()\n        except FileNotFoundError as exception:\n            # But if the configuration file is not found.\n\n            if PyFunceble.path.isfile(arg_0.path_to_default_config):\n                # The `DEFAULT_CONFIGURATION_FILENAME` file exists.\n\n                # We copy it as the configuration file.\n                File(arg_0.path_to_default_config).copy(arg_0.path_to_config)\n\n                # And we load the configuration file as it does exist (yet).\n                arg_0.Func()\n            else:\n                # The `DEFAULT_CONFIGURATION_FILENAME` file does not exists.\n\n                # We raise the exception we were handling.\n                raise exception", "path": "PyFunceble/config.py", "identifier": "Load._load_config_file", "docstring": "Load .PyFunceble.yaml into the system.", "docstring_tokens": ["Load", ".", "PyFunceble", ".", "yaml", "into", "the", "system", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 257697}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/wikipedia.py#L753-L773", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Corrects Wikipedia image markup.", "language": "python", "parameters": "(self, markup)", "return_statement": "return markup", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "0", "for", "arg_4", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "if", "arg_1", "[", "arg_4", "]", "==", "\"[\"", ":", "arg_2", "+=", "1", "if", "arg_1", "[", "arg_4", "]", "==", "\"]\"", ":", "arg_3", "+=", "1", "if", "arg_2", "==", "arg_3", ":", "return", "arg_1", "[", ":", "arg_4", "+", "1", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \n        \"\"\" Corrects Wikipedia image markup.\n\n        Images have a description inside their link markup that \n        can contain link markup itself, make sure the outer \"[\" and \"]\" brackets \n        delimiting the image are balanced correctly (e.g. no [[ ]] ]]).\n\n        Called from parse_images().\n\n        \"\"\"\n\n        arg_2 = 0\n        arg_3 = 0\n        for arg_4 in range(len(arg_1)):\n            if arg_1[arg_4] == \"[\": arg_2 += 1\n            if arg_1[arg_4] == \"]\": arg_3 += 1\n            if arg_2 == arg_3:\n                return arg_1[:arg_4+1]\n                \n        return arg_1", "path": "lib/web/wikipedia.py", "identifier": "WikipediaPage.parse_balanced_image", "docstring": "Corrects Wikipedia image markup.\n\n        Images have a description inside their link markup that \n        can contain link markup itself, make sure the outer \"[\" and \"]\" brackets \n        delimiting the image are balanced correctly (e.g. no [[ ]] ]]).\n\n        Called from parse_images().", "docstring_tokens": ["Corrects", "Wikipedia", "image", "markup", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257698}
{"url": "https://github.com/fm4d/PyMarkovTextGenerator/blob/4a7e8e2cfe14c9745aba6b9df7d7b402a9029a37/markov.py#L80-L93", "sha": "4a7e8e2cfe14c9745aba6b9df7d7b402a9029a37", "docstring_summary": "!DEMO!\n    Simple file parsing generator", "language": "python", "parameters": "(filename, encoding=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "with", "open", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "as", "source", ":", "for", "arg_2", "in", "source", ":", "for", "arg_3", "in", "arg_2", ".", "split", "(", ")", ":", "yield", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    !DEMO!\n    Simple file parsing generator\n\n    Args:\n        filename: absolute or relative path to file on disk\n        encoding: encoding string that is passed to open function\n    \"\"\"\n\n    with open(arg_0, arg_1=arg_1) as source:\n        for arg_2 in source:\n            for arg_3 in arg_2.split():\n                yield arg_3", "path": "markov.py", "identifier": "parse", "docstring": "!DEMO!\n    Simple file parsing generator\n\n    Args:\n        filename: absolute or relative path to file on disk\n        encoding: encoding string that is passed to open function", "docstring_tokens": ["!DEMO!", "Simple", "file", "parsing", "generator"], "nwo": "fm4d/PyMarkovTextGenerator", "score": 0.2424429654267875, "idx": 257699}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L279-L306", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Takes one or more index files and optionally one structure file and\n    returns a path for a new merged index file.", "language": "python", "parameters": "(*args)", "return_statement": "return multi_ndx", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "None", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "endswith", "(", "'.ndx'", ")", ":", "arg_1", ".", "append", "(", "arg_3", ")", "else", ":", "if", "arg_2", "is", "not", "None", ":", "raise", "ValueError", "(", "\"only one structure file supported\"", ")", "arg_2", "=", "arg_3", "arg_4", ",", "arg_5", "=", "tempfile", ".", "mkstemp", "(", "suffix", "=", "'.ndx'", ",", "prefix", "=", "'multi_'", ")", "os", ".", "close", "(", "arg_4", ")", "atexit", ".", "register", "(", "os", ".", "unlink", ",", "arg_5", ")", "if", "arg_2", ":", "arg_6", "=", "registry", "[", "'Make_ndx'", "]", "(", "f", "=", "arg_2", ",", "n", "=", "arg_1", ",", "o", "=", "arg_5", ")", "else", ":", "arg_6", "=", "registry", "[", "'Make_ndx'", "]", "(", "n", "=", "arg_1", ",", "o", "=", "arg_5", ")", "arg_7", ",", "arg_7", ",", "arg_7", "=", "arg_6", "(", "input", "=", "[", "'q'", "]", ",", "stdout", "=", "False", ",", "stderr", "=", "False", ")", "return", "arg_5"], "function": "def Func(*arg_0):\n    \"\"\" Takes one or more index files and optionally one structure file and\n    returns a path for a new merged index file.\n\n    :param args: index files and zero or one structure file\n    :return: path for the new merged index file\n    \"\"\"\n    arg_1 = []\n    arg_2 = None\n    for arg_3 in arg_0:\n        if arg_3.endswith('.ndx'):\n            arg_1.append(arg_3)\n        else:\n            if arg_2 is not None:\n                raise ValueError(\"only one structure file supported\")\n            arg_2 = arg_3\n\n    arg_4, arg_5 = tempfile.mkstemp(suffix='.ndx', prefix='multi_')\n    os.close(arg_4)\n    atexit.register(os.unlink, arg_5)\n\n    if arg_2:\n        arg_6 = registry['Make_ndx'](f=arg_2, n=arg_1, o=arg_5)\n    else:\n        arg_6 = registry['Make_ndx'](n=arg_1, o=arg_5)\n\n    arg_7, arg_7, arg_7 = arg_6(input=['q'], stdout=False, stderr=False)\n    return arg_5", "path": "gromacs/tools.py", "identifier": "merge_ndx", "docstring": "Takes one or more index files and optionally one structure file and\n    returns a path for a new merged index file.\n\n    :param args: index files and zero or one structure file\n    :return: path for the new merged index file", "docstring_tokens": ["Takes", "one", "or", "more", "index", "files", "and", "optionally", "one", "structure", "file", "and", "returns", "a", "path", "for", "a", "new", "merged", "index", "file", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 257700}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/galaxy/galaxy.py#L281-L291", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "The Einstein Radius of this galaxy, which is the sum of Einstein Radii of its mass profiles.", "language": "python", "parameters": "(self, unit_length='arcsec', kpc_per_arcsec=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'arcsec'", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", ".", "has_mass_profile", ":", "return", "sum", "(", "map", "(", "lambda", "p", ":", "p", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ",", "arg_0", ".", "mass_profiles", ")", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1='arcsec', arg_2=None):\n        \"\"\"The Einstein Radius of this galaxy, which is the sum of Einstein Radii of its mass profiles.\n\n        If the galaxy is composed of multiple ellipitcal profiles with different axis-ratios, this Einstein Radius \\\n        may be inaccurate. This is because the differently oriented ellipses of each mass profile \"\"\"\n\n        if arg_0.has_mass_profile:\n            return sum(map(lambda p: p.Func(arg_1=arg_1, arg_2=arg_2),\n                           arg_0.mass_profiles))\n        else:\n            return None", "path": "autolens/model/galaxy/galaxy.py", "identifier": "Galaxy.einstein_radius_in_units", "docstring": "The Einstein Radius of this galaxy, which is the sum of Einstein Radii of its mass profiles.\n\n        If the galaxy is composed of multiple ellipitcal profiles with different axis-ratios, this Einstein Radius \\\n        may be inaccurate. This is because the differently oriented ellipses of each mass profile", "docstring_tokens": ["The", "Einstein", "Radius", "of", "this", "galaxy", "which", "is", "the", "sum", "of", "Einstein", "Radii", "of", "its", "mass", "profiles", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 257701}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1310-L1318", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Random sampler for equal_splits functions", "language": "python", "parameters": "(iter1, iter2)", "return_statement": "return iter4", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "concatenate", "(", "[", "np", ".", "random", ".", "choice", "(", "arg_0", ",", "2", ",", "replace", "=", "False", ")", ",", "np", ".", "random", ".", "choice", "(", "arg_1", ",", "2", ",", "replace", "=", "False", ")", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" \n    Random sampler for equal_splits functions\n    \"\"\"\n    arg_2 = np.concatenate([\n        np.random.choice(arg_0, 2, replace=False),\n        np.random.choice(arg_1, 2, replace=False)\n        ])\n    return arg_2", "path": "ipyrad/analysis/tetrad2.py", "identifier": "random_product", "docstring": "Random sampler for equal_splits functions", "docstring_tokens": ["Random", "sampler", "for", "equal_splits", "functions"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 257702}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/PC.py#L211-L231", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Run the PC algorithm.", "language": "python", "parameters": "(self, data, **kwargs)", "return_statement": "return nx.relabel_nodes(nx.DiGraph(results),\n                                {idx: i for idx, i in enumerate(data.columns)})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "arguments", "[", "'{CITEST}'", "]", "=", "arg_0", ".", "dir_CI_test", "[", "arg_0", ".", "CI_test", "]", "arg_0", ".", "arguments", "[", "'{METHOD_INDEP}'", "]", "=", "arg_0", ".", "dir_method_indep", "[", "arg_0", ".", "method_indep", "]", "arg_0", ".", "arguments", "[", "'{DIRECTED}'", "]", "=", "'TRUE'", "arg_0", ".", "arguments", "[", "'{ALPHA}'", "]", "=", "str", "(", "arg_0", ".", "alpha", ")", "arg_0", ".", "arguments", "[", "'{NJOBS}'", "]", "=", "str", "(", "arg_0", ".", "nb_jobs", ")", "arg_0", ".", "arguments", "[", "'{VERBOSE}'", "]", "=", "str", "(", "arg_0", ".", "verbose", ")", ".", "upper", "(", ")", "arg_4", "=", "arg_0", ".", "_run_pc", "(", "arg_1", ",", "verbose", "=", "arg_0", ".", "verbose", ")", "return", "nx", ".", "relabel_nodes", "(", "nx", ".", "DiGraph", "(", "arg_4", ")", ",", "{", "arg_5", ":", "arg_6", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ".", "columns", ")", "}", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Run the PC algorithm.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by PC on the given data.\n       \"\"\"\n        # Building setup w/ arguments.\n        arg_0.arguments['{CITEST}'] = arg_0.dir_CI_test[arg_0.CI_test]\n        arg_0.arguments['{METHOD_INDEP}'] = arg_0.dir_method_indep[arg_0.method_indep]\n        arg_0.arguments['{DIRECTED}'] = 'TRUE'\n        arg_0.arguments['{ALPHA}'] = str(arg_0.alpha)\n        arg_0.arguments['{NJOBS}'] = str(arg_0.nb_jobs)\n        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()\n\n        arg_4 = arg_0._run_pc(arg_1, verbose=arg_0.verbose)\n\n        return nx.relabel_nodes(nx.DiGraph(arg_4),\n                                {arg_5: arg_6 for arg_5, arg_6 in enumerate(arg_1.columns)})", "path": "cdt/causality/graph/PC.py", "identifier": "PC.create_graph_from_data", "docstring": "Run the PC algorithm.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n\n        Returns:\n            networkx.DiGraph: Solution given by PC on the given data.", "docstring_tokens": ["Run", "the", "PC", "algorithm", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 257703}
{"url": "https://github.com/nesdis/djongo/blob/7f9d79455cf030cb5eee0b822502c50a0d9d3abb/djongo/base.py#L199-L203", "sha": "7f9d79455cf030cb5eee0b822502c50a0d9d3abb", "docstring_summary": "Returns an active connection cursor to the database.", "language": "python", "parameters": "(self, name=None)", "return_statement": "return Cursor(self.client_connection, self.connection, self.djongo_connection)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "Cursor", "(", "arg_0", ".", "client_connection", ",", "arg_0", ".", "connection", ",", "arg_0", ".", "djongo_connection", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Returns an active connection cursor to the database.\n        \"\"\"\n        return Cursor(arg_0.client_connection, arg_0.connection, arg_0.djongo_connection)", "path": "djongo/base.py", "identifier": "DatabaseWrapper.create_cursor", "docstring": "Returns an active connection cursor to the database.", "docstring_tokens": ["Returns", "an", "active", "connection", "cursor", "to", "the", "database", "."], "nwo": "nesdis/djongo", "score": 0.9667508002289729, "idx": 257704}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/roles.py#L50-L55", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Get information about a single role, for the passed account SIS ID.", "language": "python", "parameters": "(self, account_sis_id, role_id)", "return_statement": "return self.get_role(self._sis_id(account_sis_id, sis_field=\"account\"),\n                             role_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "get_role", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"account\"", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get information about a single role, for the passed account SIS ID.\n        \"\"\"\n        return arg_0.get_role(arg_0._sis_id(arg_1, sis_field=\"account\"),\n                             arg_2)", "path": "uw_canvas/roles.py", "identifier": "Roles.get_role_by_account_sis_id", "docstring": "Get information about a single role, for the passed account SIS ID.", "docstring_tokens": ["Get", "information", "about", "a", "single", "role", "for", "the", "passed", "account", "SIS", "ID", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 257705}
{"url": "https://github.com/loverajoel/sqlalchemy-elasticquery/blob/4c99b81f59e7bb20eaeedb3adbf5126e62bbc25c/sqlalchemy_elasticquery/elastic_query.py#L143-L157", "sha": "4c99b81f59e7bb20eaeedb3adbf5126e62bbc25c", "docstring_summary": "Mix all values and make the query", "language": "python", "parameters": "(self, attr)", "return_statement": "return OPERATORS[operator](getattr(model, field, None), value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "0", "]", "arg_3", "=", "arg_1", "[", "1", "]", "arg_4", "=", "arg_1", "[", "2", "]", "arg_5", "=", "arg_0", ".", "model", "if", "'.'", "in", "arg_2", ":", "arg_6", "=", "arg_2", ".", "split", "(", "'.'", ")", "arg_7", "=", "getattr", "(", "arg_5", ",", "arg_6", "[", "0", "]", ",", "None", ")", "arg_8", "=", "arg_7", ".", "property", ".", "mapper", ".", "class_", "arg_9", "=", "getattr", "(", "arg_8", ",", "arg_6", "[", "1", "]", ")", "return", "arg_7", ".", "has", "(", "OPERATORS", "[", "arg_3", "]", "(", "arg_9", ",", "arg_4", ")", ")", "return", "OPERATORS", "[", "arg_3", "]", "(", "getattr", "(", "arg_5", ",", "arg_2", ",", "None", ")", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Mix all values and make the query \"\"\"\n        arg_2 = arg_1[0]\n        arg_3 = arg_1[1]\n        arg_4 = arg_1[2]\n        arg_5 = arg_0.model\n\n        if '.' in arg_2:\n            arg_6 = arg_2.split('.')\n            arg_7 = getattr(arg_5, arg_6[0], None)\n            arg_8 = arg_7.property.mapper.class_\n            arg_9 = getattr(arg_8, arg_6[1])\n            return arg_7.has(OPERATORS[arg_3](arg_9, arg_4))\n\n        return OPERATORS[arg_3](getattr(arg_5, arg_2, None), arg_4)", "path": "sqlalchemy_elasticquery/elastic_query.py", "identifier": "ElasticQuery.create_query", "docstring": "Mix all values and make the query", "docstring_tokens": ["Mix", "all", "values", "and", "make", "the", "query"], "nwo": "loverajoel/sqlalchemy-elasticquery", "score": 0.4397691394686182, "idx": 257706}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L809-L826", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "get home directory of remote host", "language": "python", "parameters": "(host, cl_args)", "return_statement": "return output[0].strip(\"\\n\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"echo ~\"", "if", "not", "is_self", "(", "arg_0", ")", ":", "arg_2", "=", "ssh_remote_execute", "(", "arg_2", ",", "arg_0", ",", "arg_1", ")", "arg_3", "=", "subprocess", ".", "Popen", "(", "arg_2", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_4", "=", "arg_3", ".", "wait", "(", ")", "arg_5", "=", "arg_3", ".", "communicate", "(", ")", "if", "arg_4", "!=", "0", ":", "Log", ".", "error", "(", "\"Failed to get home path for remote host %s with output:\\n%s\"", "%", "(", "arg_0", ",", "arg_5", ")", ")", "sys", ".", "exit", "(", "-", "1", ")", "return", "arg_5", "[", "0", "]", ".", "strip", "(", "\"\\n\"", ")"], "function": "def Func(arg_0, arg_1):\n  '''\n  get home directory of remote host\n  '''\n  arg_2 = \"echo ~\"\n  if not is_self(arg_0):\n    arg_2 = ssh_remote_execute(arg_2, arg_0, arg_1)\n  arg_3 = subprocess.Popen(arg_2,\n                         shell=True,\n                         stdout=subprocess.PIPE,\n                         stderr=subprocess.PIPE)\n  arg_4 = arg_3.wait()\n  arg_5 = arg_3.communicate()\n\n  if arg_4 != 0:\n    Log.error(\"Failed to get home path for remote host %s with output:\\n%s\" % (arg_0, arg_5))\n    sys.exit(-1)\n  return arg_5[0].strip(\"\\n\")", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "get_remote_home", "docstring": "get home directory of remote host", "docstring_tokens": ["get", "home", "directory", "of", "remote", "host"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257707}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/learning.py#L187-L192", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return a random sample from the distribution.", "language": "python", "parameters": "(self)", "return_statement": "return self.sampler()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "Funcr", "is", "None", ":", "arg_0", ".", "Funcr", "=", "weighted_Funcr", "(", "arg_0", ".", "dictionary", ".", "keys", "(", ")", ",", "arg_0", ".", "dictionary", ".", "values", "(", ")", ")", "return", "arg_0", ".", "Funcr", "(", ")"], "function": "def Func(arg_0):\n        \"Return a random Func from the distribution.\"\n        if arg_0.Funcr is None:\n            arg_0.Funcr = weighted_Funcr(arg_0.dictionary.keys(),\n                                            arg_0.dictionary.values())\n        return arg_0.Funcr()", "path": "aima/learning.py", "identifier": "CountingProbDist.sample", "docstring": "Return a random sample from the distribution.", "docstring_tokens": ["Return", "a", "random", "sample", "from", "the", "distribution", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 257708}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/kiss_insights.py#L29-L41", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "KISSinsights set-up template tag.", "language": "python", "parameters": "(parser, token)", "return_statement": "return KissInsightsNode()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "arg_2", "[", "0", "]", ")", "return", "KissInsightsNode", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    KISSinsights set-up template tag.\n\n    Renders Javascript code to set-up surveys.  You must supply\n    your account number and site code in the\n    ``KISS_INSIGHTS_ACCOUNT_NUMBER`` and ``KISS_INSIGHTS_SITE_CODE``\n    settings.\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    if len(arg_2) > 1:\n        raise TemplateSyntaxError(\"'%s' takes no arguments\" % arg_2[0])\n    return KissInsightsNode()", "path": "analytical/templatetags/kiss_insights.py", "identifier": "kiss_insights", "docstring": "KISSinsights set-up template tag.\n\n    Renders Javascript code to set-up surveys.  You must supply\n    your account number and site code in the\n    ``KISS_INSIGHTS_ACCOUNT_NUMBER`` and ``KISS_INSIGHTS_SITE_CODE``\n    settings.", "docstring_tokens": ["KISSinsights", "set", "-", "up", "template", "tag", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 257709}
{"url": "https://github.com/mk-fg/python-onedrive/blob/74d3f6605b0e8a9031a2aab8092f551293ffb533/onedrive/api_v5.py#L253-L258", "sha": "74d3f6605b0e8a9031a2aab8092f551293ffb533", "docstring_summary": "Build authorization URL for User Agent.", "language": "python", "parameters": "(self, scope=None)", "return_statement": "return '{}?{}'.format(self.auth_url_user, urllib.urlencode(dict(\n\t\t\tclient_id=self.client_id, scope=' '.join(scope or self.auth_scope),\n\t\t\tresponse_type='code', redirect_uri=self.auth_redirect_uri )))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_0", ".", "client_id", ":", "raise", "AuthMissingError", "(", "'No client_id specified'", ")", "return", "'{}?{}'", ".", "format", "(", "arg_0", ".", "auth_url_user", ",", "urllib", ".", "urlencode", "(", "dict", "(", "client_id", "=", "arg_0", ".", "client_id", ",", "arg_1", "=", "' '", ".", "join", "(", "arg_1", "or", "arg_0", ".", "auth_scope", ")", ",", "response_type", "=", "'code'", ",", "redirect_uri", "=", "arg_0", ".", "auth_redirect_uri", ")", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n\t\t'Build authorization URL for User Agent.'\n\t\tif not arg_0.client_id: raise AuthMissingError('No client_id specified')\n\t\treturn '{}?{}'.format(arg_0.auth_url_user, urllib.urlencode(dict(\n\t\t\tclient_id=arg_0.client_id, arg_1=' '.join(arg_1 or arg_0.auth_scope),\n\t\t\tresponse_type='code', redirect_uri=arg_0.auth_redirect_uri )))", "path": "onedrive/api_v5.py", "identifier": "OneDriveAuth.auth_user_get_url", "docstring": "Build authorization URL for User Agent.", "docstring_tokens": ["Build", "authorization", "URL", "for", "User", "Agent", "."], "nwo": "mk-fg/python-onedrive", "score": 0.3204703910366837, "idx": 257710}
{"url": "https://github.com/JukeboxPipeline/jukedj/blob/d4159961c819c26792a278981ee68106ee15f3f3/src/jukedj/models.py#L467-L487", "sha": "d4159961c819c26792a278981ee68106ee15f3f3", "docstring_summary": "Post save receiver for when a sequence is saved.", "language": "python", "parameters": "(sender, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "not", "arg_1", "[", "'created'", "]", ":", "return", "arg_2", "=", "arg_1", "[", "'instance'", "]", "if", "arg_2", ".", "name", "==", "RNDSEQ_NAME", ":", "return", "arg_3", "=", "arg_2", ".", "project", "arg_4", "=", "GLOBAL_NAME", "arg_5", "=", "\"Global shot for sequence %s\"", "%", "arg_2", ".", "name", "Shot", ".", "objects", ".", "create", "(", "arg_4", "=", "arg_4", ",", "project", "=", "arg_3", ",", "sequence", "=", "arg_2", ",", "description", "=", "arg_5", ")"], "function": "def Func(arg_0, **arg_1):\n    \"\"\" Post save receiver for when a sequence is saved.\n\n    creates a global shot.\n\n    :param sender: the sequence class\n    :type sender: :class:`muke.models.Sequence`\n    :returns:  None\n    :raises: None\n\n    \"\"\"\n    if not arg_1['created']:\n        return\n    arg_2 = arg_1['instance']\n    if arg_2.name == RNDSEQ_NAME:\n        return\n\n    arg_3 = arg_2.project\n    arg_4 = GLOBAL_NAME\n    arg_5 = \"Global shot for sequence %s\" % arg_2.name\n    Shot.objects.create(arg_4=arg_4, project=arg_3, sequence=arg_2, description=arg_5)", "path": "src/jukedj/models.py", "identifier": "seq_post_save_handler", "docstring": "Post save receiver for when a sequence is saved.\n\n    creates a global shot.\n\n    :param sender: the sequence class\n    :type sender: :class:`muke.models.Sequence`\n    :returns:  None\n    :raises: None", "docstring_tokens": ["Post", "save", "receiver", "for", "when", "a", "sequence", "is", "saved", "."], "nwo": "JukeboxPipeline/jukedj", "score": 0.09252797783733271, "idx": 257711}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/core/constraint.py#L497-L532", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "Create a new constraint that is the projection onto a subset of the variables.", "language": "python", "parameters": "(self, variables)", "return_statement": "return self.from_configurations(configurations, variables, self.vartype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "set", "(", "arg_1", ")", "if", "not", "arg_1", ".", "issubset", "(", "arg_0", ".", "variables", ")", ":", "raise", "ValueError", "(", "\"Cannot project to variables not in the constraint.\"", ")", "arg_2", "=", "[", "i", "for", "i", ",", "v", "in", "enumerate", "(", "arg_0", ".", "variables", ")", "if", "v", "in", "arg_1", "]", "arg_3", "=", "frozenset", "(", "tuple", "(", "config", "[", "i", "]", "for", "i", "in", "arg_2", ")", "for", "config", "in", "arg_0", ".", "configurations", ")", "arg_1", "=", "tuple", "(", "arg_0", ".", "variables", "[", "i", "]", "for", "i", "in", "arg_2", ")", "return", "arg_0", ".", "from_configurations", "(", "arg_3", ",", "arg_1", ",", "arg_0", ".", "vartype", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create a new constraint that is the Func onto a subset of the variables.\n\n        Args:\n            variables (iterable):\n                Subset of the constraint's variables.\n\n        Returns:\n            :obj:`.Constraint`: A new constraint over a subset of the variables.\n\n        Examples:\n\n            >>> import dwavebinarycsp\n            ...\n            >>> const = dwavebinarycsp.Constraint.from_configurations([(0, 0), (0, 1)],\n            ...                                                       ['a', 'b'],\n            ...                                                       dwavebinarycsp.BINARY)\n            >>> proj = const.Func(['a'])\n            >>> proj.variables\n            ['a']\n            >>> proj.configurations\n            {(0,)}\n\n        \"\"\"\n        # resolve iterables or mutability problems by casting the variables to a set\n        arg_1 = set(arg_1)\n\n        if not arg_1.issubset(arg_0.variables):\n            raise ValueError(\"Cannot project to variables not in the constraint.\")\n\n        arg_2 = [i for i, v in enumerate(arg_0.variables) if v in arg_1]\n\n        arg_3 = frozenset(tuple(config[i] for i in arg_2) for config in arg_0.configurations)\n        arg_1 = tuple(arg_0.variables[i] for i in arg_2)\n\n        return arg_0.from_configurations(arg_3, arg_1, arg_0.vartype)", "path": "dwavebinarycsp/core/constraint.py", "identifier": "Constraint.projection", "docstring": "Create a new constraint that is the projection onto a subset of the variables.\n\n        Args:\n            variables (iterable):\n                Subset of the constraint's variables.\n\n        Returns:\n            :obj:`.Constraint`: A new constraint over a subset of the variables.\n\n        Examples:\n\n            >>> import dwavebinarycsp\n            ...\n            >>> const = dwavebinarycsp.Constraint.from_configurations([(0, 0), (0, 1)],\n            ...                                                       ['a', 'b'],\n            ...                                                       dwavebinarycsp.BINARY)\n            >>> proj = const.projection(['a'])\n            >>> proj.variables\n            ['a']\n            >>> proj.configurations\n            {(0,)}", "docstring_tokens": ["Create", "a", "new", "constraint", "that", "is", "the", "projection", "onto", "a", "subset", "of", "the", "variables", "."], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 257712}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/upsampling_layers.py#L9-L42", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert upsample_bilinear2d layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting upsample...'", ")", "if", "arg_6", "==", "'short'", ":", "arg_7", "=", "'UPSL'", "+", "random_string", "(", "4", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_8", "=", "arg_0", "[", "'output_size'", "]", "arg_9", "=", "arg_0", "[", "'align_corners'", "]", ">", "0", "def", "target_layer", "(", "arg_10", ",", "arg_11", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")", ":", "import", "tensorflow", "as", "tf", "arg_10", "=", "tf", ".", "transpose", "(", "arg_10", ",", "[", "0", ",", "2", ",", "3", ",", "1", "]", ")", "arg_10", "=", "tf", ".", "image", ".", "resize_images", "(", "arg_10", ",", "arg_11", ",", "arg_9", "=", "arg_9", ")", "arg_10", "=", "tf", ".", "transpose", "(", "arg_10", ",", "[", "0", ",", "3", ",", "1", ",", "2", "]", ")", "return", "arg_10", "arg_12", "=", "keras", ".", "layers", ".", "Lambda", "(", "target_layer", ")", "arg_4", "[", "arg_2", "]", "=", "arg_12", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert upsample_bilinear2d layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting upsample...')\n\n    if arg_6 == 'short':\n        arg_7 = 'UPSL' + random_string(4)\n    elif arg_6 == 'keep':\n        arg_7 = arg_1\n    else:\n        arg_7 = arg_1 + str(random.random())\n\n    arg_8 = arg_0['output_size']\n    arg_9 = arg_0['align_corners'] > 0\n\n    def target_layer(arg_10, arg_11=arg_8, arg_9=arg_9):\n        import tensorflow as tf\n        arg_10 = tf.transpose(arg_10, [0, 2, 3, 1])\n        arg_10 = tf.image.resize_images(arg_10, arg_11, arg_9=arg_9)\n        arg_10 = tf.transpose(arg_10, [0, 3, 1, 2])\n        return arg_10\n\n    arg_12 = keras.layers.Lambda(target_layer)\n    arg_4[arg_2] = arg_12(arg_4[arg_3[0]])", "path": "pytorch2keras/upsampling_layers.py", "identifier": "convert_upsample_bilinear", "docstring": "Convert upsample_bilinear2d layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "upsample_bilinear2d", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 257713}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/flame_graph.py#L55-L73", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Inserts stack into the call tree.", "language": "python", "parameters": "(stack, sample_count, call_tree)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "{", "node", "[", "'stack'", "]", ":", "node", "for", "node", "in", "arg_3", "[", "'children'", "]", "}", "if", "arg_4", "not", "in", "arg_5", ":", "arg_6", "=", "{", "'stack'", ":", "arg_4", ",", "'children'", ":", "[", "]", ",", "'sampleCount'", ":", "0", "}", "arg_3", "[", "'children'", "]", ".", "append", "(", "arg_6", ")", "arg_3", "=", "arg_6", "else", ":", "arg_3", "=", "arg_5", "[", "arg_4", "]", "arg_3", "[", "'sampleCount'", "]", "=", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Inserts stack into the call tree.\n\n        Args:\n            stack: Call stack.\n            sample_count: Sample count of call stack.\n            call_tree: Call tree.\n        \"\"\"\n        arg_3 = arg_2\n        for arg_4 in arg_0:\n            arg_5 = {\n                node['stack']: node for node in arg_3['children']}\n            if arg_4 not in arg_5:\n                arg_6 = {'stack': arg_4, 'children': [], 'sampleCount': 0}\n                arg_3['children'].append(arg_6)\n                arg_3 = arg_6\n            else:\n                arg_3 = arg_5[arg_4]\n        arg_3['sampleCount'] = arg_1", "path": "vprof/flame_graph.py", "identifier": "_StatProfiler._insert_stack", "docstring": "Inserts stack into the call tree.\n\n        Args:\n            stack: Call stack.\n            sample_count: Sample count of call stack.\n            call_tree: Call tree.", "docstring_tokens": ["Inserts", "stack", "into", "the", "call", "tree", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 257714}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L194-L213", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Retrieve an existing H2OFrame from the H2O cluster using the frame's id.", "language": "python", "parameters": "(frame_id, rows=10, rows_offset=0, cols=-1, full_cols=-1, cols_offset=0, light=False)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ",", "arg_2", "=", "0", ",", "arg_3", "=", "-", "1", ",", "arg_4", "=", "-", "1", ",", "arg_5", "=", "0", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "H2OFrame", "(", ")", "arg_7", ".", "_ex", ".", "_cache", ".", "_id", "=", "arg_0", "try", ":", "arg_7", ".", "_ex", ".", "_cache", ".", "fill", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "except", "EnvironmentError", ":", "return", "None", "return", "arg_7"], "function": "def Func(arg_0, arg_1=10, arg_2=0, arg_3=-1, arg_4=-1, arg_5=0, arg_6=False):\n        \"\"\"\n        Retrieve an existing H2OFrame from the H2O cluster using the frame's id.\n\n        :param str frame_id: id of the frame to retrieve\n        :param int rows: number of rows to fetch for preview (10 by default)\n        :param int rows_offset: offset to fetch rows from (0 by default)\n        :param int cols: number of columns to fetch (all by default)\n        :param full_cols: number of columns to fetch together with backed data\n        :param int cols_offset: offset to fetch rows from (0 by default)\n        :param bool light: wether to use light frame endpoint or not\n        :returns: an existing H2OFrame with the id provided; or None if such frame doesn't exist.\n        \"\"\"\n        arg_7 = H2OFrame()\n        arg_7._ex._cache._id = arg_0\n        try:\n            arg_7._ex._cache.fill(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_6=arg_6)\n        except EnvironmentError:\n            return None\n        return arg_7", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.get_frame", "docstring": "Retrieve an existing H2OFrame from the H2O cluster using the frame's id.\n\n        :param str frame_id: id of the frame to retrieve\n        :param int rows: number of rows to fetch for preview (10 by default)\n        :param int rows_offset: offset to fetch rows from (0 by default)\n        :param int cols: number of columns to fetch (all by default)\n        :param full_cols: number of columns to fetch together with backed data\n        :param int cols_offset: offset to fetch rows from (0 by default)\n        :param bool light: wether to use light frame endpoint or not\n        :returns: an existing H2OFrame with the id provided; or None if such frame doesn't exist.", "docstring_tokens": ["Retrieve", "an", "existing", "H2OFrame", "from", "the", "H2O", "cluster", "using", "the", "frame", "s", "id", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257715}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L674-L687", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Performs completion at the current cursor location.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_context", "(", ")", "if", "arg_1", ":", "arg_2", "=", "arg_0", ".", "kernel_manager", ".", "shell_channel", ".", "complete", "(", "'.'", ".", "join", "(", "arg_1", ")", ",", "arg_0", ".", "_get_input_buffer_cursor_line", "(", ")", ",", "arg_0", ".", "_get_input_buffer_cursor_column", "(", ")", ",", "arg_0", ".", "input_buffer", ")", "arg_3", "=", "arg_0", ".", "_get_cursor", "(", ")", ".", "position", "(", ")", "arg_4", "=", "arg_0", ".", "_CompletionRequest", "(", "arg_2", ",", "arg_3", ")", "arg_0", ".", "_request_info", "[", "'complete'", "]", "=", "arg_4"], "function": "def Func(arg_0):\n        \"\"\" Performs completion at the current cursor location.\n        \"\"\"\n        arg_1 = arg_0._get_context()\n        if arg_1:\n            # Send the completion request to the kernel\n            arg_2 = arg_0.kernel_manager.shell_channel.complete(\n                '.'.join(arg_1),                       # text\n                arg_0._get_input_buffer_cursor_line(),    # line\n                arg_0._get_input_buffer_cursor_column(),  # cursor_pos\n                arg_0.input_buffer)                       # block\n            arg_3 = arg_0._get_cursor().position()\n            arg_4 = arg_0._CompletionRequest(arg_2, arg_3)\n            arg_0._request_info['complete'] = arg_4", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._complete", "docstring": "Performs completion at the current cursor location.", "docstring_tokens": ["Performs", "completion", "at", "the", "current", "cursor", "location", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257716}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/libplanarradpy/planrad.py#L393-L402", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "Scale the spectra by multiplying by linear scaling factor", "language": "python", "parameters": "(self, scale_parameter)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "lg", ".", "info", "(", "'Scaling a_phi by :: '", "+", "str", "(", "arg_1", ")", ")", "try", ":", "arg_0", ".", "a_phi", "=", "arg_0", ".", "a_phi", "*", "arg_1", "except", ":", "lg", ".", "exception", "(", "\"Can't scale a_phi, check that it has been defined \"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Scale the spectra by multiplying by linear scaling factor\n\n        :param scale_parameter: Linear scaling factor\n        \"\"\"\n        lg.info('Scaling a_phi by :: ' + str(arg_1))\n        try:\n            arg_0.a_phi = arg_0.a_phi * arg_1\n        except:\n            lg.exception(\"Can't scale a_phi, check that it has been defined \")", "path": "libplanarradpy/planrad.py", "identifier": "BioOpticalParameters.scale_aphi", "docstring": "Scale the spectra by multiplying by linear scaling factor\n\n        :param scale_parameter: Linear scaling factor", "docstring_tokens": ["Scale", "the", "spectra", "by", "multiplying", "by", "linear", "scaling", "factor"], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 257717}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/electrochem.py#L826-L865", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Calculate the ionic strength of a solution in one of two ways,\n    depending on the inputs only. For Pitzer and Bromley models,\n    `mis` should be molalities of each component. For eNRTL models,\n    `mis` should be mole fractions of each electrolyte in the solution.\n    This will sum to be much less than 1.", "language": "python", "parameters": "(mis, zis)", "return_statement": "return 0.5*sum([mi*zi*zi for mi, zi in zip(mis, zis)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "0.5", "*", "sum", "(", "[", "arg_2", "*", "arg_3", "*", "arg_3", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "arg_0", ",", "arg_1", ")", "]", ")"], "function": "def Func(arg_0, arg_1):\n    r'''Calculate the ionic strength of a solution in one of two ways,\n    depending on the inputs only. For Pitzer and Bromley models,\n    `mis` should be molalities of each component. For eNRTL models,\n    `mis` should be mole fractions of each electrolyte in the solution.\n    This will sum to be much less than 1.\n\n    .. math::\n        I = \\frac{1}{2} \\sum M_i z_i^2\n\n        I = \\frac{1}{2} \\sum x_i z_i^2\n\n    Parameters\n    ----------\n    mis : list\n        Molalities of each ion, or mole fractions of each ion [mol/kg or -]\n    zis : list\n        Charges of each ion [-]\n\n    Returns\n    -------\n    I : float\n        ionic strength, [?]\n\n    Examples\n    --------\n    >>> Func([0.1393, 0.1393], [1, -1])\n    0.1393\n\n    References\n    ----------\n    .. [1] Chen, Chau-Chyun, H. I. Britt, J. F. Boston, and L. B. Evans. \"Local\n       Composition Model for Excess Gibbs Energy of Electrolyte Systems.\n       Part I: Single Solvent, Single Completely Dissociated Electrolyte\n       Systems.\" AIChE Journal 28, no. 4 (July 1, 1982): 588-96.\n       doi:10.1002/aic.690280410\n    .. [2] Gmehling, Jurgen. Chemical Thermodynamics: For Process Simulation.\n       Weinheim, Germany: Wiley-VCH, 2012.\n    '''\n    return 0.5*sum([arg_2*arg_3*arg_3 for arg_2, arg_3 in zip(arg_0, arg_1)])", "path": "thermo/electrochem.py", "identifier": "ionic_strength", "docstring": "r'''Calculate the ionic strength of a solution in one of two ways,\n    depending on the inputs only. For Pitzer and Bromley models,\n    `mis` should be molalities of each component. For eNRTL models,\n    `mis` should be mole fractions of each electrolyte in the solution.\n    This will sum to be much less than 1.\n\n    .. math::\n        I = \\frac{1}{2} \\sum M_i z_i^2\n\n        I = \\frac{1}{2} \\sum x_i z_i^2\n\n    Parameters\n    ----------\n    mis : list\n        Molalities of each ion, or mole fractions of each ion [mol/kg or -]\n    zis : list\n        Charges of each ion [-]\n\n    Returns\n    -------\n    I : float\n        ionic strength, [?]\n\n    Examples\n    --------\n    >>> ionic_strength([0.1393, 0.1393], [1, -1])\n    0.1393\n\n    References\n    ----------\n    .. [1] Chen, Chau-Chyun, H. I. Britt, J. F. Boston, and L. B. Evans. \"Local\n       Composition Model for Excess Gibbs Energy of Electrolyte Systems.\n       Part I: Single Solvent, Single Completely Dissociated Electrolyte\n       Systems.\" AIChE Journal 28, no. 4 (July 1, 1982): 588-96.\n       doi:10.1002/aic.690280410\n    .. [2] Gmehling, Jurgen. Chemical Thermodynamics: For Process Simulation.\n       Weinheim, Germany: Wiley-VCH, 2012.", "docstring_tokens": ["r", "Calculate", "the", "ionic", "strength", "of", "a", "solution", "in", "one", "of", "two", "ways", "depending", "on", "the", "inputs", "only", ".", "For", "Pitzer", "and", "Bromley", "models", "mis", "should", "be", "molalities", "of", "each", "component", ".", "For", "eNRTL", "models", "mis", "should", "be", "mole", "fractions", "of", "each", "electrolyte", "in", "the", "solution", ".", "This", "will", "sum", "to", "be", "much", "less", "than", "1", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 257718}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/cholesky.py#L16-L40", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Solve Ax=B using numpy cholesky solver", "language": "python", "parameters": "(A, B)", "return_statement": "return x, L", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "numpy", ".", "linalg", ".", "cholesky", "(", "arg_0", ")", "arg_3", "=", "numpy", ".", "linalg", ".", "solve", "(", "arg_2", ",", "arg_1", ")", "arg_4", "=", "numpy", ".", "linalg", ".", "solve", "(", "arg_2", ".", "transpose", "(", ")", ".", "conjugate", "(", ")", ",", "arg_3", ")", "return", "arg_4", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Solve Ax=B using numpy cholesky solver\n\n    A = LU\n\n    in the case where A is square and Hermitian, A = L.L* where L* is\n    transpoed and conjugate matrix\n\n    Ly = b\n\n    where\n\n    Ux=y\n\n    so x = U^{-1} y\n    where U = L*\n    and y = L^{-1} B\n    \"\"\"\n    arg_2 = numpy.linalg.cholesky(arg_0)\n    # A=L*numpy.transpose(L).conjugate()\n    # Ly = b\n    arg_3 = numpy.linalg.solve(arg_2,arg_1)\n    # Ux = y\n    arg_4 = numpy.linalg.solve(arg_2.transpose().conjugate(),arg_3)\n    return arg_4, arg_2", "path": "src/spectrum/cholesky.py", "identifier": "_numpy_cholesky", "docstring": "Solve Ax=B using numpy cholesky solver\n\n    A = LU\n\n    in the case where A is square and Hermitian, A = L.L* where L* is\n    transpoed and conjugate matrix\n\n    Ly = b\n\n    where\n\n    Ux=y\n\n    so x = U^{-1} y\n    where U = L*\n    and y = L^{-1} B", "docstring_tokens": ["Solve", "Ax", "=", "B", "using", "numpy", "cholesky", "solver"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 257719}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L348-L372", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Move each joint toward a target angle.", "language": "python", "parameters": "(self, angles)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ".", "joints", ":", "arg_4", "=", "[", "ctrl", "(", "tgt", "-", "cur", ",", "arg_0", ".", "world", ".", "dt", ")", "for", "cur", ",", "tgt", ",", "ctrl", "in", "zip", "(", "arg_3", ".", "angles", ",", "arg_1", "[", "arg_2", ":", "arg_2", "+", "arg_3", ".", "ADOF", "]", ",", "arg_3", ".", "controllers", ")", "]", "arg_3", ".", "velocities", "=", "arg_4", "arg_2", "+=", "arg_3", ".", "ADOF"], "function": "def Func(arg_0, arg_1):\n        '''Move each joint toward a target angle.\n\n        This method uses a PID controller to set a target angular velocity for\n        each degree of freedom in the skeleton, based on the difference between\n        the current and the target angle for the respective DOF.\n\n        PID parameters are by default set to achieve a tiny bit less than\n        complete convergence in one time step, using only the P term (i.e., the\n        P coefficient is set to 1 - \\delta, while I and D coefficients are set\n        to 0). PID parameters can be updated by calling the `set_pid_params`\n        method.\n\n        Parameters\n        ----------\n        angles : list of float\n            A list of the target angles for every joint in the skeleton.\n        '''\n        arg_2 = 0\n        for arg_3 in arg_0.joints:\n            arg_4 = [\n                ctrl(tgt - cur, arg_0.world.dt) for cur, tgt, ctrl in\n                zip(arg_3.angles, arg_1[arg_2:arg_2+arg_3.ADOF], arg_3.controllers)]\n            arg_3.velocities = arg_4\n            arg_2 += arg_3.ADOF", "path": "pagoda/skeleton.py", "identifier": "Skeleton.set_target_angles", "docstring": "Move each joint toward a target angle.\n\n        This method uses a PID controller to set a target angular velocity for\n        each degree of freedom in the skeleton, based on the difference between\n        the current and the target angle for the respective DOF.\n\n        PID parameters are by default set to achieve a tiny bit less than\n        complete convergence in one time step, using only the P term (i.e., the\n        P coefficient is set to 1 - \\delta, while I and D coefficients are set\n        to 0). PID parameters can be updated by calling the `set_pid_params`\n        method.\n\n        Parameters\n        ----------\n        angles : list of float\n            A list of the target angles for every joint in the skeleton.", "docstring_tokens": ["Move", "each", "joint", "toward", "a", "target", "angle", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 257720}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/resource_record_set.py#L110-L129", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Saves any changes to this record set.", "language": "python", "parameters": "(self)", "return_statement": "return retval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ChangeSet", "(", "connection", "=", "arg_0", ".", "connection", ",", "hosted_zone_id", "=", "arg_0", ".", "zone_id", ")", "arg_1", ".", "add_change", "(", "'DELETE'", ",", "arg_0", ")", "arg_1", ".", "add_change", "(", "'CREATE'", ",", "arg_0", ")", "arg_2", "=", "arg_0", ".", "connection", ".", "_change_resource_record_sets", "(", "arg_1", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_initial_vals", ".", "items", "(", ")", ":", "arg_0", ".", "_initial_vals", "[", "arg_3", "]", "=", "getattr", "(", "arg_0", ",", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Saves any changes to this record set.\n        \"\"\"\n\n        arg_1 = ChangeSet(connection=arg_0.connection, hosted_zone_id=arg_0.zone_id)\n        # Record sets can't actually be modified. You have to delete the\n        # existing one and create a new one. Since this happens within a single\n        # change set, it appears that the values were modified, when instead\n        # the whole thing is replaced.\n        arg_1.add_change('DELETE', arg_0)\n        arg_1.add_change('CREATE', arg_0)\n        arg_2 = arg_0.connection._change_resource_record_sets(arg_1)\n\n        # Now copy the current attribute values on this instance to\n        # the initial_vals dict. This will re-set the modification tracking.\n        for arg_3, arg_4 in arg_0._initial_vals.items():\n            arg_0._initial_vals[arg_3] = getattr(arg_0, arg_3)\n\n        return arg_2", "path": "route53/resource_record_set.py", "identifier": "ResourceRecordSet.save", "docstring": "Saves any changes to this record set.", "docstring_tokens": ["Saves", "any", "changes", "to", "this", "record", "set", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 257721}
{"url": "https://github.com/abau171/highfive/blob/07b3829331072035ab100d1d66deca3e8f3f372a/highfive/jobs.py#L393-L405", "sha": "07b3829331072035ab100d1d66deca3e8f3f372a", "docstring_summary": "Calls the given callback function when a job becomes available.", "language": "python", "parameters": "(self, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "not", "arg_0", ".", "_closed", "if", "arg_0", ".", "_active_js", "is", "None", "or", "not", "arg_0", ".", "_active_js", ".", "job_available", "(", ")", ":", "arg_0", ".", "_ready_callbacks", ".", "append", "(", "arg_1", ")", "else", ":", "arg_2", "=", "arg_0", ".", "_active_js", ".", "Func", "(", ")", "arg_0", ".", "_job_sources", "[", "arg_2", "]", "=", "arg_0", ".", "_active_js", "arg_1", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calls the given callback function when a job becomes available.\n        \"\"\"\n\n        assert not arg_0._closed\n\n        if arg_0._active_js is None or not arg_0._active_js.job_available():\n            arg_0._ready_callbacks.append(arg_1)\n        else:\n            arg_2 = arg_0._active_js.Func()\n            arg_0._job_sources[arg_2] = arg_0._active_js\n            arg_1(arg_2)", "path": "highfive/jobs.py", "identifier": "JobManager.get_job", "docstring": "Calls the given callback function when a job becomes available.", "docstring_tokens": ["Calls", "the", "given", "callback", "function", "when", "a", "job", "becomes", "available", "."], "nwo": "abau171/highfive", "score": 0.14991498758945482, "idx": 257722}
{"url": "https://github.com/quantmind/pulsar-cloud/blob/dc2ff8ab5c9a1c2cfb1270581d30454d1a606cf9/cloud/pusher.py#L149-L175", "sha": "dc2ff8ab5c9a1c2cfb1270581d30454d1a606cf9", "docstring_summary": "Handle websocket incoming messages", "language": "python", "parameters": "(self, websocket, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_waiter", "arg_0", ".", "_waiter", "=", "None", "arg_5", "=", "json", ".", "loads", "(", "arg_2", ")", "arg_6", "=", "arg_5", ".", "get", "(", "'event'", ")", "arg_7", "=", "arg_5", ".", "get", "(", "'channel'", ")", "arg_8", "=", "json", ".", "loads", "(", "arg_5", ".", "get", "(", "'data'", ")", ")", "try", ":", "if", "arg_6", "==", "PUSHER_ERROR", ":", "raise", "PusherError", "(", "arg_8", "[", "'message'", "]", ",", "arg_8", "[", "'code'", "]", ")", "elif", "arg_6", "==", "PUSHER_CONNECTION", ":", "arg_0", ".", "socket_id", "=", "arg_8", ".", "get", "(", "'socket_id'", ")", "arg_0", ".", "logger", ".", "info", "(", "'Succesfully connected on socket %s'", ",", "arg_0", ".", "socket_id", ")", "arg_3", ".", "set_result", "(", "arg_0", ".", "socket_id", ")", "elif", "arg_6", "==", "PUSHER_SUBSCRIBED", ":", "arg_0", ".", "logger", ".", "info", "(", "'Succesfully subscribed to %s'", ",", "arg_5", ".", "get", "(", "'channel'", ")", ")", "elif", "arg_7", ":", "arg_0", "[", "arg_7", "]", ".", "_event", "(", "arg_6", ",", "arg_8", ")", "except", "Exception", "as", "exc", ":", "if", "arg_3", ":", "arg_3", ".", "set_exception", "(", "exc", ")", "else", ":", "arg_0", ".", "logger", ".", "exception", "(", "'pusher error'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Handle websocket incoming messages\n        '''\n        arg_3 = arg_0._waiter\n        arg_0._waiter = None\n        arg_5 = json.loads(arg_2)\n        arg_6 = arg_5.get('event')\n        arg_7 = arg_5.get('channel')\n        arg_8 = json.loads(arg_5.get('data'))\n        try:\n            if arg_6 == PUSHER_ERROR:\n                raise PusherError(arg_8['message'], arg_8['code'])\n            elif arg_6 == PUSHER_CONNECTION:\n                arg_0.socket_id = arg_8.get('socket_id')\n                arg_0.logger.info('Succesfully connected on socket %s',\n                                 arg_0.socket_id)\n                arg_3.set_result(arg_0.socket_id)\n            elif arg_6 == PUSHER_SUBSCRIBED:\n                arg_0.logger.info('Succesfully subscribed to %s',\n                                 arg_5.get('channel'))\n            elif arg_7:\n                arg_0[arg_7]._event(arg_6, arg_8)\n        except Exception as exc:\n            if arg_3:\n                arg_3.set_exception(exc)\n            else:\n                arg_0.logger.exception('pusher error')", "path": "cloud/pusher.py", "identifier": "Pusher.on_message", "docstring": "Handle websocket incoming messages", "docstring_tokens": ["Handle", "websocket", "incoming", "messages"], "nwo": "quantmind/pulsar-cloud", "score": 0.18657722465184873, "idx": 257723}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/effects/deferred/effects.py#L124-L130", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Combine diffuse and light buffer", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "gbuffer", ".", "color_attachments", "[", "0", "]", ".", "use", "(", "location", "=", "0", ")", "arg_0", ".", "Func_shader", "[", "\"diffuse_buffer\"", "]", ".", "value", "=", "0", "arg_0", ".", "lightbuffer", ".", "color_attachments", "[", "0", "]", ".", "use", "(", "location", "=", "1", ")", "arg_0", ".", "Func_shader", "[", "\"light_buffer\"", "]", ".", "value", "=", "1", "arg_0", ".", "quad", ".", "render", "(", "arg_0", ".", "Func_shader", ")"], "function": "def Func(arg_0):\n        \"\"\"Combine diffuse and light buffer\"\"\"\n        arg_0.gbuffer.color_attachments[0].use(location=0)\n        arg_0.Func_shader[\"diffuse_buffer\"].value = 0\n        arg_0.lightbuffer.color_attachments[0].use(location=1)\n        arg_0.Func_shader[\"light_buffer\"].value = 1\n        arg_0.quad.render(arg_0.Func_shader)", "path": "demosys/effects/deferred/effects.py", "identifier": "DeferredRenderer.combine", "docstring": "Combine diffuse and light buffer", "docstring_tokens": ["Combine", "diffuse", "and", "light", "buffer"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 257724}
{"url": "https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/workflow.py#L100-L118", "sha": "1d8f972f861816b90785a484e9bec5bd4bc2f569", "docstring_summary": "Execute the cloud_harness task.", "language": "python", "parameters": "(self, override_wf_json=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "gbdx", ".", "post", "(", "arg_0", ".", "URL", ",", "json", "=", "arg_0", ".", "json", "if", "arg_1", "is", "None", "else", "arg_1", ")", "try", ":", "arg_2", ".", "raise_for_status", "(", ")", "except", ":", "print", "(", "\"GBDX API Status Code: %s\"", "%", "arg_2", ".", "status_code", ")", "print", "(", "\"GBDX API Response: %s\"", "%", "arg_2", ".", "text", ")", "arg_0", ".", "id", "=", "None", "return", "arg_0", ".", "id", "=", "arg_2", ".", "json", "(", ")", "[", "'id'", "]", "arg_0", ".", "_refresh_status", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Execute the cloud_harness task.\n        \"\"\"\n        arg_2 = arg_0.gbdx.post(\n            arg_0.URL,\n            json=arg_0.json if arg_1 is None else arg_1\n        )\n\n        try:\n            arg_2.raise_for_status()\n        except:\n            print(\"GBDX API Status Code: %s\" % arg_2.status_code)\n            print(\"GBDX API Response: %s\" % arg_2.text)\n            arg_0.id = None\n            return\n\n        arg_0.id = arg_2.json()['id']\n        arg_0._refresh_status()", "path": "gbdx_cloud_harness/workflow.py", "identifier": "Workflow.execute", "docstring": "Execute the cloud_harness task.", "docstring_tokens": ["Execute", "the", "cloud_harness", "task", "."], "nwo": "TDG-Platform/cloud-harness", "score": 0.2619419494340654, "idx": 257725}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L180-L188", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Add all wires in a quantum register.", "language": "python", "parameters": "(self, qreg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "QuantumRegister", ")", ":", "raise", "DAGCircuitError", "(", "\"not a QuantumRegister instance.\"", ")", "if", "arg_1", ".", "name", "in", "arg_0", ".", "qregs", ":", "raise", "DAGCircuitError", "(", "\"duplicate register %s\"", "%", "arg_1", ".", "name", ")", "arg_0", ".", "qregs", "[", "arg_1", ".", "name", "]", "=", "arg_1", "for", "arg_4", "in", "range", "(", "arg_1", ".", "size", ")", ":", "arg_0", ".", "_add_wire", "(", "(", "arg_1", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add all wires in a quantum register.\"\"\"\n        if not isinstance(arg_1, QuantumRegister):\n            raise DAGCircuitError(\"not a QuantumRegister instance.\")\n        if arg_1.name in arg_0.qregs:\n            raise DAGCircuitError(\"duplicate register %s\" % arg_1.name)\n        arg_0.qregs[arg_1.name] = arg_1\n        for arg_4 in range(arg_1.size):\n            arg_0._add_wire((arg_1, arg_4))", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.add_qreg", "docstring": "Add all wires in a quantum register.", "docstring_tokens": ["Add", "all", "wires", "in", "a", "quantum", "register", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257726}
{"url": "https://github.com/allanlei/django-argparse-command/blob/27ea77e1dd0cf2f0567223735762a5ebd14fdaef/argcmd/management/base.py#L46-L61", "sha": "27ea77e1dd0cf2f0567223735762a5ebd14fdaef", "docstring_summary": "Create and return the ``ArgumentParser`` which will be used to\n        parse the arguments to this command.", "language": "python", "parameters": "(self, prog_name, subcommand)", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "ArgumentParser", "(", "description", "=", "arg_0", ".", "description", ",", "epilog", "=", "arg_0", ".", "epilog", ",", "add_help", "=", "arg_0", ".", "add_help", ",", "prog", "=", "arg_0", ".", "prog", ",", "usage", "=", "arg_0", ".", "get_usage", "(", "arg_2", ")", ",", ")", "arg_3", ".", "add_argument", "(", "'--version'", ",", "action", "=", "'version'", ",", "version", "=", "arg_0", ".", "get_version", "(", ")", ")", "arg_0", ".", "add_arguments", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Create and return the ``ArgumentParser`` which will be used to\n        parse the arguments to this command.\n\n        \"\"\"        \n        arg_3 = ArgumentParser(\n            description=arg_0.description,\n            epilog=arg_0.epilog,\n            add_help=arg_0.add_help,\n            prog=arg_0.prog,\n            usage=arg_0.get_usage(arg_2),\n        )\n        arg_3.add_argument('--version', action='version', version=arg_0.get_version())\n        arg_0.add_arguments(arg_3)\n        return arg_3", "path": "argcmd/management/base.py", "identifier": "BaseCommand.create_parser", "docstring": "Create and return the ``ArgumentParser`` which will be used to\n        parse the arguments to this command.", "docstring_tokens": ["Create", "and", "return", "the", "ArgumentParser", "which", "will", "be", "used", "to", "parse", "the", "arguments", "to", "this", "command", "."], "nwo": "allanlei/django-argparse-command", "score": 0.0, "idx": 257727}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/examples/onset_detector.py#L16-L51", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Onset detection function", "language": "python", "parameters": "(input_file, output_csv)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "(", "'Loading '", ",", "arg_0", ")", "arg_2", ",", "arg_3", "=", "librosa", ".", "load", "(", "arg_0", ",", "arg_3", "=", "22050", ")", "arg_4", "=", "512", "print", "(", "'Detecting onsets...'", ")", "arg_5", "=", "librosa", ".", "onset", ".", "Func", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "print", "(", "\"Found {:d} onsets.\"", ".", "format", "(", "arg_5", ".", "shape", "[", "0", "]", ")", ")", "arg_6", "=", "librosa", ".", "frames_to_time", "(", "arg_5", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "print", "(", "'Saving output to '", ",", "arg_1", ")", "librosa", ".", "output", ".", "times_csv", "(", "arg_1", ",", "arg_6", ")", "print", "(", "'done!'", ")"], "function": "def Func(arg_0, arg_1):\n    '''Onset detection function\n\n    :parameters:\n      - input_file : str\n          Path to input audio file (wav, mp3, m4a, flac, etc.)\n\n      - output_file : str\n          Path to save onset timestamps as a CSV file\n    '''\n\n    # 1. load the wav file and resample to 22.050 KHz\n    print('Loading ', arg_0)\n    arg_2, arg_3 = librosa.load(arg_0, arg_3=22050)\n\n    # Use a default hop size of 512 frames @ 22KHz ~= 23ms\n    arg_4 = 512\n\n    # 2. run onset detection\n    print('Detecting onsets...')\n    arg_5 = librosa.onset.Func(arg_2=arg_2,\n                                        arg_3=arg_3,\n                                        arg_4=arg_4)\n\n    print(\"Found {:d} onsets.\".format(arg_5.shape[0]))\n\n    # 3. save output\n    # 'beats' will contain the frame numbers of beat events.\n\n    arg_6 = librosa.frames_to_time(arg_5,\n                                         arg_3=arg_3,\n                                         arg_4=arg_4)\n\n    print('Saving output to ', arg_1)\n    librosa.output.times_csv(arg_1, arg_6)\n    print('done!')", "path": "examples/onset_detector.py", "identifier": "onset_detect", "docstring": "Onset detection function\n\n    :parameters:\n      - input_file : str\n          Path to input audio file (wav, mp3, m4a, flac, etc.)\n\n      - output_file : str\n          Path to save onset timestamps as a CSV file", "docstring_tokens": ["Onset", "detection", "function"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 257728}
{"url": "https://github.com/gmarull/asyncqt/blob/292e42c0bf799e5aeee099ee2cec27a810b01870/asyncqt/_windows.py#L38-L47", "sha": "292e42c0bf799e5aeee099ee2cec27a810b01870", "docstring_summary": "Process events from proactor.", "language": "python", "parameters": "(self, events)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "in", "arg_1", ":", "try", ":", "arg_0", ".", "_logger", ".", "debug", "(", "'Invoking event callback {}'", ".", "format", "(", "arg_3", ")", ")", "arg_7", "=", "arg_3", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", "except", "OSError", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'Event callback failed'", ",", "exc_info", "=", "sys", ".", "exc_info", "(", ")", ")", "else", ":", "arg_2", ".", "set_result", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process events from proactor.\"\"\"\n        for arg_2, arg_3, arg_4, arg_5, arg_6 in arg_1:\n            try:\n                arg_0._logger.debug('Invoking event callback {}'.format(arg_3))\n                arg_7 = arg_3(arg_4, arg_5, arg_6)\n            except OSError:\n                arg_0._logger.warning('Event callback failed', exc_info=sys.exc_info())\n            else:\n                arg_2.set_result(arg_7)", "path": "asyncqt/_windows.py", "identifier": "_ProactorEventLoop._process_events", "docstring": "Process events from proactor.", "docstring_tokens": ["Process", "events", "from", "proactor", "."], "nwo": "gmarull/asyncqt", "score": 0.7362303753474546, "idx": 257729}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L541-L549", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Getter for various Storage variables", "language": "python", "parameters": "(self)", "return_statement": "return self._storage", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Func", "is", "None", ":", "arg_1", "=", "\"SYNO.Storage.CGI.Storage\"", "arg_2", "=", "\"%s/entry.cgi?api=%s&version=1&method=load_info\"", "%", "(", "arg_0", ".", "base_url", ",", "arg_1", ")", "arg_0", ".", "_Func", "=", "SynoStorage", "(", "arg_0", ".", "_get_url", "(", "arg_2", ")", ")", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\r\n        \"\"\"Getter for various Storage variables\"\"\"\r\n        if arg_0._Func is None:\r\n            arg_1 = \"SYNO.Storage.CGI.Storage\"\r\n            arg_2 = \"%s/entry.cgi?api=%s&version=1&method=load_info\" % (\r\n                arg_0.base_url,\r\n                arg_1)\r\n            arg_0._Func = SynoStorage(arg_0._get_url(arg_2))\r\n        return arg_0._Func", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynologyDSM.storage", "docstring": "Getter for various Storage variables", "docstring_tokens": ["Getter", "for", "various", "Storage", "variables"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 257730}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L588-L627", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Full-duplex SPI read and write.  The specified array of bytes will be\n        clocked out the MOSI line, while simultaneously bytes will be read from\n        the MISO line.  Read bytes will be returned as a bytearray object.", "language": "python", "parameters": "(self, data)", "return_statement": "return bytearray(payload1 + payload2)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "len", "(", "arg_1", ")", ">", "65536", ")", ":", "print", "(", "'the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!'", ")", "print", "(", "'use for loops for larger reads'", ")", "exit", "(", "1", ")", "arg_2", "=", "0x30", "|", "(", "arg_0", ".", "lsbfirst", "<<", "3", ")", "|", "(", "arg_0", ".", "read_clock_ve", "<<", "2", ")", "|", "arg_0", ".", "write_clock_ve", "logger", ".", "debug", "(", "'SPI Func with command {0:2X}.'", ".", "format", "(", "arg_2", ")", ")", "arg_3", "=", "arg_1", "[", ":", "len", "(", "arg_1", ")", "/", "2", "]", "arg_4", "=", "arg_1", "[", "len", "(", "arg_1", ")", "/", "2", ":", "]", "arg_5", "=", "(", "len", "(", "arg_3", ")", "-", "1", ")", "&", "0xFF", "arg_6", "=", "(", "(", "len", "(", "arg_3", ")", "-", "1", ")", ">>", "8", ")", "&", "0xFF", "arg_7", "=", "(", "len", "(", "arg_4", ")", "-", "1", ")", "&", "0xFF", "arg_8", "=", "(", "(", "len", "(", "arg_4", ")", "-", "1", ")", ">>", "8", ")", "&", "0xFF", "arg_9", "=", "''", "arg_10", "=", "''", "arg_0", ".", "_assert_cs", "(", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "(", "arg_2", ",", "arg_5", ",", "arg_6", ")", ")", ")", ")", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "arg_3", ")", ")", ")", "arg_9", "=", "arg_0", ".", "_ft232h", ".", "_poll_read", "(", "len", "(", "arg_3", ")", ")", "if", "len", "(", "arg_4", ")", ">", "0", ":", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "(", "arg_2", ",", "arg_7", ",", "arg_8", ")", ")", ")", ")", "arg_0", ".", "_ft232h", ".", "_write", "(", "str", "(", "bytearray", "(", "arg_4", ")", ")", ")", "arg_10", "=", "arg_0", ".", "_ft232h", ".", "_poll_read", "(", "len", "(", "arg_4", ")", ")", "arg_0", ".", "_deassert_cs", "(", ")", "return", "bytearray", "(", "arg_9", "+", "arg_10", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Full-duplex SPI read and write.  The specified array of bytes will be\n        clocked out the MOSI line, while simultaneously bytes will be read from\n        the MISO line.  Read bytes will be returned as a bytearray object.\n        \"\"\"\n        #check for hardware limit of FT232H and similar MPSSE chips\n        if (len(arg_1) > 65536):\n            print('the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!')\n            print('use for loops for larger reads')\n            exit(1)\n        # Build command to read and write SPI data.\n        arg_2 = 0x30 | (arg_0.lsbfirst << 3) | (arg_0.read_clock_ve << 2) | arg_0.write_clock_ve\n        logger.debug('SPI Func with command {0:2X}.'.format(arg_2))\n        # Compute length low and high bytes.\n        # NOTE: Must actually send length minus one because the MPSSE engine\n        # considers 0 a length of 1 and FFFF a length of 65536\n        arg_3 = arg_1[:len(arg_1)/2]\n\targ_4 = arg_1[len(arg_1)/2:]\n\targ_5  = (len(arg_3) - 1) & 0xFF\n        arg_6 = ((len(arg_3) - 1) >> 8) & 0xFF\n\targ_7  = (len(arg_4) - 1) & 0xFF\n        arg_8 = ((len(arg_4) - 1) >> 8) & 0xFF\n\targ_9 = ''\n\targ_10 = ''\n\t#start command set\n        arg_0._assert_cs()\n        # Perform twice to prevent error from hardware defect/limits\n\t# Send command and length, then data, split into two commands, handle for length 1\n\tif len(arg_3) > 0:\n\t    arg_0._ft232h._write(str(bytearray((arg_2, arg_5, arg_6))))\n\t    arg_0._ft232h._write(str(bytearray(arg_3)))\n\t    arg_9 = arg_0._ft232h._poll_read(len(arg_3))\n\tif len(arg_4) > 0:\n\t    arg_0._ft232h._write(str(bytearray((arg_2, arg_7, arg_8))))\n\t    arg_0._ft232h._write(str(bytearray(arg_4)))\n\t    arg_10 = arg_0._ft232h._poll_read(len(arg_4))\n        #self._ft232h._write('\\x87')\n        arg_0._deassert_cs()\n        # Read response bytes.\n        return bytearray(arg_9 + arg_10)", "path": "Adafruit_GPIO/FT232H.py", "identifier": "SPI.transfer", "docstring": "Full-duplex SPI read and write.  The specified array of bytes will be\n        clocked out the MOSI line, while simultaneously bytes will be read from\n        the MISO line.  Read bytes will be returned as a bytearray object.", "docstring_tokens": ["Full", "-", "duplex", "SPI", "read", "and", "write", ".", "The", "specified", "array", "of", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "while", "simultaneously", "bytes", "will", "be", "read", "from", "the", "MISO", "line", ".", "Read", "bytes", "will", "be", "returned", "as", "a", "bytearray", "object", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 257731}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L243-L258", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "when given a dictionary where every key contains a list of IDs, replace\n    the keys with the list of files matching those IDs. This is how you get a\n    list of files belonging to each child for each parent.", "language": "python", "parameters": "(groups,folder)", "return_statement": "return group2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "arg_1", ")", "arg_2", "=", "os", ".", "listdir", "(", "arg_1", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_0", ".", "keys", "(", ")", ":", "if", "not", "arg_4", "in", "arg_3", ".", "keys", "(", ")", ":", "arg_3", "[", "arg_4", "]", "=", "[", "]", "for", "arg_5", "in", "arg_0", "[", "arg_4", "]", ":", "for", "arg_6", "in", "[", "x", ".", "lower", "(", ")", "for", "x", "in", "arg_2", "if", "arg_5", "in", "x", ".", "lower", "(", ")", "]", ":", "arg_3", "[", "arg_4", "]", ".", "extend", "(", "[", "arg_6", "]", ")", "return", "arg_3"], "function": "def Func(arg_0,arg_1):\n    \"\"\"\n    when given a dictionary where every key contains a list of IDs, replace\n    the keys with the list of files matching those IDs. This is how you get a\n    list of files belonging to each child for each parent.\n    \"\"\"\n    assert os.path.exists(arg_1)\n    arg_2=os.listdir(arg_1)\n    arg_3={}\n    for arg_4 in arg_0.keys():\n        if not arg_4 in arg_3.keys():\n            arg_3[arg_4]=[]\n        for arg_5 in arg_0[arg_4]:\n            for arg_6 in [x.lower() for x in arg_2 if arg_5 in x.lower()]:\n                arg_3[arg_4].extend([arg_6])\n    return arg_3", "path": "swhlab/common.py", "identifier": "abfGroupFiles", "docstring": "when given a dictionary where every key contains a list of IDs, replace\n    the keys with the list of files matching those IDs. This is how you get a\n    list of files belonging to each child for each parent.", "docstring_tokens": ["when", "given", "a", "dictionary", "where", "every", "key", "contains", "a", "list", "of", "IDs", "replace", "the", "keys", "with", "the", "list", "of", "files", "matching", "those", "IDs", ".", "This", "is", "how", "you", "get", "a", "list", "of", "files", "belonging", "to", "each", "child", "for", "each", "parent", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 257732}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/analysis/ap.py#L58-L65", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "run this before analysis. Checks if event detection occured.\n        If not, runs AP detection on all sweeps.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "APs", "==", "False", ":", "arg_0", ".", "log", ".", "debug", "(", "\"analysis attempted before event detection...\"", ")", "arg_0", ".", "detect", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        run this before analysis. Checks if event detection occured.\n        If not, runs AP detection on all sweeps.\n        \"\"\"\n        if arg_0.APs==False:\n            arg_0.log.debug(\"analysis attempted before event detection...\")\n            arg_0.detect()", "path": "swhlab/analysis/ap.py", "identifier": "AP.ensureDetection", "docstring": "run this before analysis. Checks if event detection occured.\n        If not, runs AP detection on all sweeps.", "docstring_tokens": ["run", "this", "before", "analysis", ".", "Checks", "if", "event", "detection", "occured", ".", "If", "not", "runs", "AP", "detection", "on", "all", "sweeps", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 257733}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L408-L457", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Automatically Adds a dependency of a process.", "language": "python", "parameters": "(self, p, template, inlane, outlane, pid)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "process_map", "[", "arg_2", "]", "(", "arg_2", "=", "arg_2", ")", "if", "arg_6", ".", "input_type", "!=", "arg_1", ".", "input_type", ":", "logger", ".", "error", "(", "\"Cannot automatically add dependency with different\"", "\" input type. Input type of process '{}' is '{}.\"", "\" Input type of dependency '{}' is '{}'\"", ".", "format", "(", "arg_1", ".", "template", ",", "arg_1", ".", "input_type", ",", "arg_2", ",", "arg_6", ".", "input_type", ")", ")", "arg_7", "=", "\"{}_{}_dep\"", ".", "format", "(", "arg_3", ",", "arg_5", ")", "arg_8", "=", "\"{}_{}_dep\"", ".", "format", "(", "arg_4", ",", "arg_5", ")", "arg_6", ".", "set_main_channel_names", "(", "arg_7", ",", "arg_8", ",", "arg_4", ")", "arg_6", ".", "input_channel", "=", "arg_1", ".", "input_channel", "arg_1", ".", "input_channel", "=", "arg_6", ".", "output_channel", "if", "not", "arg_1", ".", "parent_lane", ":", "arg_1", ".", "parent_lane", "=", "arg_4", "arg_6", ".", "parent_lane", "=", "None", "else", ":", "arg_6", ".", "parent_lane", "=", "arg_3", "arg_1", ".", "parent_lane", "=", "arg_4", "arg_0", ".", "processes", ".", "append", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"Automatically Adds a dependency of a process.\n\n        This method adds a template to the process list attribute as a\n        dependency. It will adapt the input lane, output lane and process\n        id of the process that depends on it.\n\n        Parameters\n        ----------\n        p : Process\n            Process class that contains the dependency.\n        template : str\n            Template name of the dependency.\n        inlane : int\n            Input lane.\n        outlane : int\n            Output lane.\n        pid : int\n            Process ID.\n        \"\"\"\n\n        arg_6 = arg_0.process_map[arg_2](arg_2=arg_2)\n\n        if arg_6.input_type != arg_1.input_type:\n            logger.error(\"Cannot automatically add dependency with different\"\n                         \" input type. Input type of process '{}' is '{}.\"\n                         \" Input type of dependency '{}' is '{}'\".format(\n                            arg_1.template, arg_1.input_type, arg_2,\n                            arg_6.input_type))\n\n        arg_7 = \"{}_{}_dep\".format(arg_3, arg_5)\n        arg_8 = \"{}_{}_dep\".format(arg_4, arg_5)\n        arg_6.set_main_channel_names(arg_7, arg_8, arg_4)\n\n        # To insert the dependency process before the current process, we'll\n        # need to move the input channel name of the later to the former, and\n        # set a new connection between the dependency and the process.\n        arg_6.input_channel = arg_1.input_channel\n        arg_1.input_channel = arg_6.output_channel\n\n        # If the current process was the first in the pipeline, change the\n        # lanes so that the dependency becomes the first process\n        if not arg_1.parent_lane:\n            arg_1.parent_lane = arg_4\n            arg_6.parent_lane = None\n        else:\n            arg_6.parent_lane = arg_3\n            arg_1.parent_lane = arg_4\n\n        arg_0.processes.append(arg_6)", "path": "flowcraft/generator/engine.py", "identifier": "NextflowGenerator._add_dependency", "docstring": "Automatically Adds a dependency of a process.\n\n        This method adds a template to the process list attribute as a\n        dependency. It will adapt the input lane, output lane and process\n        id of the process that depends on it.\n\n        Parameters\n        ----------\n        p : Process\n            Process class that contains the dependency.\n        template : str\n            Template name of the dependency.\n        inlane : int\n            Input lane.\n        outlane : int\n            Output lane.\n        pid : int\n            Process ID.", "docstring_tokens": ["Automatically", "Adds", "a", "dependency", "of", "a", "process", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257734}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/plots.py#L421-L468", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Compares a state's residuals in real and Fourier space with a Gaussian.", "language": "python", "parameters": "(state, bins=1000, xlim=(-10,10))", "return_statement": "return axes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1000", ",", "arg_2", "=", "(", "-", "10", ",", "10", ")", ")", ":", "arg_3", "=", "arg_0", ".", "residuals", "arg_4", "=", "np", ".", "fft", ".", "fftn", "(", "arg_3", ")", "arg_5", "=", "lambda", "arg_14", ":", "np", ".", "sqrt", "(", "np", ".", "dot", "(", "arg_14", ",", "arg_14", ")", "/", "arg_14", ".", "size", ")", "arg_6", ",", "arg_7", "=", "np", ".", "histogram", "(", "arg_3", ".", "ravel", "(", ")", "/", "arg_5", "(", "arg_3", ".", "ravel", "(", ")", ")", ",", "arg_1", "=", "arg_1", ",", "density", "=", "True", ")", "arg_8", "=", "np", ".", "append", "(", "arg_4", ".", "real", ".", "ravel", "(", ")", ",", "arg_4", ".", "imag", ".", "ravel", "(", ")", ")", "arg_9", ",", "arg_10", "=", "np", ".", "histogram", "(", "arg_8", "/", "arg_5", "(", "arg_4", ".", "real", ".", "ravel", "(", ")", ")", ",", "arg_1", "=", "arg_1", ",", "density", "=", "True", ")", "arg_7", "=", "0.5", "*", "(", "arg_7", "[", "1", ":", "]", "+", "arg_7", "[", ":", "-", "1", "]", ")", "arg_10", "=", "0.5", "*", "(", "arg_10", "[", "1", ":", "]", "+", "arg_10", "[", ":", "-", "1", "]", ")", "arg_11", "=", "lambda", "t", ":", "np", ".", "exp", "(", "-", "t", "*", "t", "*", "0.5", ")", "/", "np", ".", "sqrt", "(", "2", "*", "np", ".", "pi", ")", "plt", ".", "figure", "(", "figsize", "=", "[", "16", ",", "8", "]", ")", "arg_12", "=", "[", "]", "for", "arg_13", ",", "(", "arg_14", ",", "arg_3", ",", "arg_15", ")", "in", "enumerate", "(", "[", "[", "arg_7", ",", "arg_6", ",", "'Real'", "]", ",", "[", "arg_10", ",", "arg_9", ",", "'Fourier'", "]", "]", ")", ":", "arg_16", "=", "plt", ".", "subplot", "(", "1", ",", "2", ",", "arg_13", "+", "1", ")", "arg_16", ".", "semilogy", "(", "arg_14", ",", "arg_3", ",", "label", "=", "'Data'", ")", "arg_16", ".", "plot", "(", "arg_14", ",", "arg_11", "(", "arg_14", ")", ",", "label", "=", "'Gauss Fit'", ",", "scalex", "=", "False", ",", "scaley", "=", "False", ")", "arg_16", ".", "set_xlabel", "(", "'Residuals value $r/\\sigma$'", ")", "arg_16", ".", "set_ylabel", "(", "'Probability $P(r/\\sigma)$'", ")", "arg_16", ".", "legend", "(", "loc", "=", "'upper right'", ")", "arg_16", ".", "set_title", "(", "'{}-Space'", ".", "format", "(", "arg_15", ")", ")", "arg_16", ".", "set_xlim", "(", "arg_2", ")", "arg_12", ".", "append", "(", "arg_16", ")", "return", "arg_12"], "function": "def Func(arg_0, arg_1=1000, arg_2=(-10,10)):\n    \"\"\"\n    Compares a state's residuals in real and Fourier space with a Gaussian.\n\n    Point out that Fourier space should always be Gaussian and white\n\n    Parameters\n    ----------\n        state : `peri.states.State`\n            The state to examine.\n        bins : int or sequence of scalars or str, optional\n            The number of bins in the histogram, as passed to numpy.histogram\n            Default is 1000\n        xlim : 2-element tuple, optional\n            The range, in sigma, of the x-axis on the plot. Default (-10,10).\n\n    Returns\n    -------\n        list\n            The axes handles for the real and Fourier space subplots.\n    \"\"\"\n    arg_3 = arg_0.residuals\n    arg_4 = np.fft.fftn(arg_3)\n    #Get the expected values of `sigma`:\n    arg_5 = lambda arg_14: np.sqrt(np.dot(arg_14,arg_14) / arg_14.size)\n    arg_6, arg_7 = np.histogram(arg_3.ravel() / arg_5(arg_3.ravel()), arg_1=arg_1,\n            density=True)\n    arg_8 = np.append(arg_4.real.ravel(), arg_4.imag.ravel())\n    arg_9, arg_10 = np.histogram(arg_8 / arg_5(arg_4.real.ravel()), arg_1=arg_1,\n            density=True)\n    arg_7 = 0.5*(arg_7[1:] + arg_7[:-1])\n    arg_10 = 0.5*(arg_10[1:] + arg_10[:-1])\n\n    arg_11 = lambda t : np.exp(-t*t*0.5) / np.sqrt(2*np.pi)\n\n    plt.figure(figsize=[16,8])\n    arg_12 = []\n    for arg_13, (arg_14, arg_3, arg_15) in enumerate([[arg_7, arg_6, 'Real'], [arg_10, arg_9, 'Fourier']]):\n        arg_16 = plt.subplot(1,2,arg_13+1)\n        arg_16.semilogy(arg_14, arg_3, label='Data')\n        arg_16.plot(arg_14, arg_11(arg_14), label='Gauss Fit', scalex=False, scaley=False)\n        arg_16.set_xlabel('Residuals value $r/\\sigma$')\n        arg_16.set_ylabel('Probability $P(r/\\sigma)$')\n        arg_16.legend(loc='upper right')\n        arg_16.set_title('{}-Space'.format(arg_15))\n        arg_16.set_xlim(arg_2)\n        arg_12.append(arg_16)\n    return arg_12", "path": "peri/viz/plots.py", "identifier": "examine_unexplained_noise", "docstring": "Compares a state's residuals in real and Fourier space with a Gaussian.\n\n    Point out that Fourier space should always be Gaussian and white\n\n    Parameters\n    ----------\n        state : `peri.states.State`\n            The state to examine.\n        bins : int or sequence of scalars or str, optional\n            The number of bins in the histogram, as passed to numpy.histogram\n            Default is 1000\n        xlim : 2-element tuple, optional\n            The range, in sigma, of the x-axis on the plot. Default (-10,10).\n\n    Returns\n    -------\n        list\n            The axes handles for the real and Fourier space subplots.", "docstring_tokens": ["Compares", "a", "state", "s", "residuals", "in", "real", "and", "Fourier", "space", "with", "a", "Gaussian", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 257735}
{"url": "https://github.com/nicolargo/pymdstat/blob/97fd47117e687463205fb562269feb9f95d59620/pymdstat/pymdstat.py#L126-L146", "sha": "97fd47117e687463205fb562269feb9f95d59620", "docstring_summary": "Return a dict of md device define in the line.", "language": "python", "parameters": "(self, line, personalities=[])", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "[", "]", ")", ":", "arg_3", "=", "{", "}", "arg_4", "=", "split", "(", "'\\W+'", ",", "arg_1", ")", "arg_3", "[", "'status'", "]", "=", "arg_4", "[", "1", "]", "if", "arg_4", "[", "2", "]", "in", "arg_2", ":", "arg_3", "[", "'type'", "]", "=", "arg_4", "[", "2", "]", "arg_3", "[", "'components'", "]", "=", "arg_0", ".", "get_components", "(", "arg_1", ",", "with_type", "=", "True", ")", "else", ":", "arg_3", "[", "'type'", "]", "=", "None", "arg_3", "[", "'components'", "]", "=", "arg_0", ".", "get_components", "(", "arg_1", ",", "with_type", "=", "False", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=[]):\n        \"\"\"Return a dict of md device define in the line.\"\"\"\n        arg_3 = {}\n\n        arg_4 = split('\\W+', arg_1)\n        # Raid status\n        # Active or 'started'. An inactive array is usually faulty.\n        # Stopped arrays aren't visible here.\n        arg_3['status'] = arg_4[1]\n        if arg_4[2] in arg_2:\n            # Raid type (ex: RAID5)\n            arg_3['type'] = arg_4[2]\n            # Array's components\n            arg_3['components'] = arg_0.get_components(arg_1, with_type=True)\n        else:\n            # Raid type (ex: RAID5)\n            arg_3['type'] = None\n            # Array's components\n            arg_3['components'] = arg_0.get_components(arg_1, with_type=False)\n\n        return arg_3", "path": "pymdstat/pymdstat.py", "identifier": "MdStat.get_md_device", "docstring": "Return a dict of md device define in the line.", "docstring_tokens": ["Return", "a", "dict", "of", "md", "device", "define", "in", "the", "line", "."], "nwo": "nicolargo/pymdstat", "score": 0.2804084716934856, "idx": 257736}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L311-L330", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Do actions after construct, but before starting the app.", "language": "python", "parameters": "(self, argv=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "super", "(", "TerminalIPythonApp", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "if", "arg_0", ".", "subapp", "is", "not", "None", ":", "return", "if", "not", "arg_0", ".", "ignore_old_config", ":", "check_for_old_config", "(", "arg_0", ".", "ipython_dir", ")", "if", "arg_0", ".", "extra_args", "and", "not", "arg_0", ".", "something_to_run", ":", "arg_0", ".", "file_to_run", "=", "arg_0", ".", "extra_args", "[", "0", "]", "arg_0", ".", "init_path", "(", ")", "arg_0", ".", "init_shell", "(", ")", "arg_0", ".", "init_banner", "(", ")", "arg_0", ".", "init_gui_pylab", "(", ")", "arg_0", ".", "init_extensions", "(", ")", "arg_0", ".", "init_code", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Do actions after construct, but before starting the app.\"\"\"\n        super(TerminalIPythonApp, arg_0).Func(arg_1)\n        if arg_0.subapp is not None:\n            # don't bother initializing further, starting subapp\n            return\n        if not arg_0.ignore_old_config:\n            check_for_old_config(arg_0.ipython_dir)\n        # print self.extra_args\n        if arg_0.extra_args and not arg_0.something_to_run:\n            arg_0.file_to_run = arg_0.extra_args[0]\n        arg_0.init_path()\n        # create the shell\n        arg_0.init_shell()\n        # and draw the banner\n        arg_0.init_banner()\n        # Now a variety of things that happen after the banner is printed.\n        arg_0.init_gui_pylab()\n        arg_0.init_extensions()\n        arg_0.init_code()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", "identifier": "TerminalIPythonApp.initialize", "docstring": "Do actions after construct, but before starting the app.", "docstring_tokens": ["Do", "actions", "after", "construct", "but", "before", "starting", "the", "app", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257737}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/convert/Layout.py#L160-L174", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "The instructions in a grid.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "x", "arg_2", "=", "arg_0", ".", "y", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "_row", ".", "Func", ":", "arg_5", "=", "InstructionInGrid", "(", "arg_4", ",", "Point", "(", "arg_1", ",", "arg_2", ")", ")", "arg_1", "+=", "arg_5", ".", "width", "arg_3", ".", "append", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"The Func in a grid.\n\n        :return: the :class:`Func in a grid <InstructionInGrid>` of\n          this row\n        :rtype: list\n        \"\"\"\n        arg_1 = arg_0.x\n        arg_2 = arg_0.y\n        arg_3 = []\n        for arg_4 in arg_0._row.Func:\n            arg_5 = InstructionInGrid(arg_4, Point(arg_1, arg_2))\n            arg_1 += arg_5.width\n            arg_3.append(arg_5)\n        return arg_3", "path": "knittingpattern/convert/Layout.py", "identifier": "RowInGrid.instructions", "docstring": "The instructions in a grid.\n\n        :return: the :class:`instructions in a grid <InstructionInGrid>` of\n          this row\n        :rtype: list", "docstring_tokens": ["The", "instructions", "in", "a", "grid", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 257738}
{"url": "https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L454-L468", "sha": "2a725df0b727e8b08f217ab84f7b8243c42554f5", "docstring_summary": "Returns NetSpeed name from address.", "language": "python", "parameters": "(self, addr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_databaseType", "==", "const", ".", "NETSPEED_EDITION", ":", "return", "const", ".", "NETSPEED_NAMES", "[", "arg_0", ".", "id_by_addr", "(", "arg_1", ")", "]", "elif", "arg_0", ".", "_databaseType", "in", "(", "const", ".", "NETSPEED_EDITION_REV1", ",", "const", ".", "NETSPEED_EDITION_REV1_V6", ")", ":", "arg_2", "=", "util", ".", "ip2long", "(", "arg_1", ")", "return", "arg_0", ".", "_get_org", "(", "arg_2", ")", "raise", "GeoIPError", "(", "'Invalid database type, expected NetSpeed or NetSpeedCell'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns NetSpeed name from address.\n\n        :arg addr: IP address (e.g. 203.0.113.30)\n        \"\"\"\n        if arg_0._databaseType == const.NETSPEED_EDITION:\n            return const.NETSPEED_NAMES[arg_0.id_by_addr(arg_1)]\n        elif arg_0._databaseType in (const.NETSPEED_EDITION_REV1,\n                                    const.NETSPEED_EDITION_REV1_V6):\n            arg_2 = util.ip2long(arg_1)\n            return arg_0._get_org(arg_2)\n\n        raise GeoIPError(\n            'Invalid database type, expected NetSpeed or NetSpeedCell')", "path": "pygeoip/__init__.py", "identifier": "GeoIP.netspeed_by_addr", "docstring": "Returns NetSpeed name from address.\n\n        :arg addr: IP address (e.g. 203.0.113.30)", "docstring_tokens": ["Returns", "NetSpeed", "name", "from", "address", "."], "nwo": "appliedsec/pygeoip", "score": 0.7204224841353906, "idx": 257739}
{"url": "https://github.com/georgemarshall/django-cryptography/blob/4c5f60fec98bcf71495d6084f801ea9c01c9a725/django_cryptography/utils/version.py#L41-L53", "sha": "4c5f60fec98bcf71495d6084f801ea9c01c9a725", "docstring_summary": "Returns a tuple of the django_cryptography version. If version\n    argument is non-empty, then checks for correctness of the tuple\n    provided.", "language": "python", "parameters": "(version=None)", "return_statement": "return version", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "from", "django_cryptography", "import", "VERSION", "as", "arg_0", "else", ":", "assert", "len", "(", "arg_0", ")", "==", "5", "assert", "arg_0", "[", "3", "]", "in", "(", "'alpha'", ",", "'beta'", ",", "'rc'", ",", "'final'", ")", "return", "arg_0"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Returns a tuple of the django_cryptography version. If version\n    argument is non-empty, then checks for correctness of the tuple\n    provided.\n    \"\"\"\n    if arg_0 is None:\n        from django_cryptography import VERSION as arg_0\n    else:\n        assert len(arg_0) == 5\n        assert arg_0[3] in ('alpha', 'beta', 'rc', 'final')\n\n    return arg_0", "path": "django_cryptography/utils/version.py", "identifier": "get_complete_version", "docstring": "Returns a tuple of the django_cryptography version. If version\n    argument is non-empty, then checks for correctness of the tuple\n    provided.", "docstring_tokens": ["Returns", "a", "tuple", "of", "the", "django_cryptography", "version", ".", "If", "version", "argument", "is", "non", "-", "empty", "then", "checks", "for", "correctness", "of", "the", "tuple", "provided", "."], "nwo": "georgemarshall/django-cryptography", "score": 0.32069767954003625, "idx": 257740}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/zmqshell.py#L481-L485", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "stop eventloop when exit_now fires", "language": "python", "parameters": "(self, name, old, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", ":", "arg_4", "=", "ioloop", ".", "IOLoop", ".", "instance", "(", ")", "arg_4", ".", "add_timeout", "(", "time", ".", "time", "(", ")", "+", "0.1", ",", "arg_4", ".", "stop", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"stop eventloop when exit_now fires\"\"\"\n        if arg_3:\n            arg_4 = ioloop.IOLoop.instance()\n            arg_4.add_timeout(time.time()+0.1, arg_4.stop)", "path": "environment/lib/python2.7/site-packages/IPython/zmq/zmqshell.py", "identifier": "ZMQInteractiveShell._exit_now_changed", "docstring": "stop eventloop when exit_now fires", "docstring_tokens": ["stop", "eventloop", "when", "exit_now", "fires"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257741}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L264-L288", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Create a new data set.", "language": "python", "parameters": "(self, name=None, description=None, public=False)", "return_statement": "return _dataset_from_response_dict(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "{", "\"public\"", ":", "_convert_bool_to_public_value", "(", "arg_3", ")", "}", "if", "arg_1", ":", "arg_4", "[", "\"name\"", "]", "=", "arg_1", "if", "arg_2", ":", "arg_4", "[", "\"description\"", "]", "=", "arg_2", "arg_5", "=", "{", "\"dataset\"", ":", "arg_4", "}", "arg_6", "=", "\"Unable to create dataset\"", "arg_7", "=", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_post_json", "(", "routes", ".", "Func", "(", ")", ",", "arg_5", ",", "arg_6", "=", "arg_6", ")", ")", "return", "_dataset_from_response_dict", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=False):\n        \"\"\"\n        Create a new data set.\n\n        :param name: name of the dataset\n        :type name: str\n        :param description: description for the dataset\n        :type description: str\n        :param public: A boolean indicating whether or not the dataset should be public.\n        :type public: bool\n        :return: The newly created dataset.\n        :rtype: :class:`Dataset`\n        \"\"\"\n        arg_4 = {\n            \"public\": _convert_bool_to_public_value(arg_3)\n        }\n        if arg_1:\n            arg_4[\"name\"] = arg_1\n        if arg_2:\n            arg_4[\"description\"] = arg_2\n        arg_5 = {\"dataset\": arg_4}\n        arg_6 = \"Unable to create dataset\"\n        arg_7 = arg_0._get_success_json(arg_0._post_json(routes.Func(), arg_5, arg_6=arg_6))\n\n        return _dataset_from_response_dict(arg_7)", "path": "citrination_client/data/client.py", "identifier": "DataClient.create_dataset", "docstring": "Create a new data set.\n\n        :param name: name of the dataset\n        :type name: str\n        :param description: description for the dataset\n        :type description: str\n        :param public: A boolean indicating whether or not the dataset should be public.\n        :type public: bool\n        :return: The newly created dataset.\n        :rtype: :class:`Dataset`", "docstring_tokens": ["Create", "a", "new", "data", "set", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 257742}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/common/registry.py#L65-L71", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns a registered class object with the name given in the string.", "language": "python", "parameters": "(name: str)", "return_statement": "return cls_from_str(_REGISTRY[name])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "type", ":", "if", "arg_0", "not", "in", "_REGISTRY", ":", "if", "':'", "not", "in", "arg_0", ":", "raise", "ConfigError", "(", "\"Model {} is not registered.\"", ".", "format", "(", "arg_0", ")", ")", "return", "cls_from_str", "(", "arg_0", ")", "return", "cls_from_str", "(", "_REGISTRY", "[", "arg_0", "]", ")"], "function": "def Func(arg_0: arg_1) -> type:\n    \"\"\"Returns a registered class object with the name given in the string.\"\"\"\n    if arg_0 not in _REGISTRY:\n        if ':' not in arg_0:\n            raise ConfigError(\"Model {} is not registered.\".format(arg_0))\n        return cls_from_str(arg_0)\n    return cls_from_str(_REGISTRY[arg_0])", "path": "deeppavlov/core/common/registry.py", "identifier": "get_model", "docstring": "Returns a registered class object with the name given in the string.", "docstring_tokens": ["Returns", "a", "registered", "class", "object", "with", "the", "name", "given", "in", "the", "string", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 257743}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/pgmanager.py#L166-L177", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Get the id of a file in the database.  This function is specific to\n        this implementation of ContentsManager and is not in the base class.", "language": "python", "parameters": "(self, path)", "return_statement": "return file_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "engine", ".", "begin", "(", ")", "as", "db", ":", "try", ":", "arg_2", "=", "Func", "(", "db", ",", "arg_0", ".", "user_id", ",", "arg_1", ")", "except", "NoSuchFile", ":", "arg_0", ".", "no_such_entity", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get the id of a file in the database.  This function is specific to\n        this implementation of ContentsManager and is not in the base class.\n        \"\"\"\n        with arg_0.engine.begin() as db:\n            try:\n                arg_2 = Func(db, arg_0.user_id, arg_1)\n            except NoSuchFile:\n                arg_0.no_such_entity(arg_1)\n\n        return arg_2", "path": "pgcontents/pgmanager.py", "identifier": "PostgresContentsManager.get_file_id", "docstring": "Get the id of a file in the database.  This function is specific to\n        this implementation of ContentsManager and is not in the base class.", "docstring_tokens": ["Get", "the", "id", "of", "a", "file", "in", "the", "database", ".", "This", "function", "is", "specific", "to", "this", "implementation", "of", "ContentsManager", "and", "is", "not", "in", "the", "base", "class", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 257744}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/tomcat_brute.py#L35-L63", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Checks the arguments to brutefore and spawns greenlets to perform the bruteforcing.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "ServiceSearch", "(", ")", "arg_1", "=", "arg_0", ".", "argparser", "arg_1", ".", "add_argument", "(", "'-f'", ",", "'--file'", ",", "type", "=", "str", ",", "help", "=", "\"File\"", ")", "arg_2", "=", "arg_1", ".", "parse_args", "(", ")", "if", "not", "arg_2", ".", "file", ":", "print_error", "(", "\"Please provide a file with credentials seperated by ':'\"", ")", "sys", ".", "exit", "(", ")", "arg_0", "=", "arg_0", ".", "get_services", "(", "search", "=", "[", "\"Tomcat\"", "]", ",", "up", "=", "True", ",", "tags", "=", "[", "'!tomcat_brute'", "]", ")", "arg_3", "=", "[", "]", "with", "open", "(", "arg_2", ".", "file", ",", "'r'", ")", "as", "f", ":", "arg_3", "=", "f", ".", "readlines", "(", ")", "for", "arg_4", "in", "arg_0", ":", "print_notification", "(", "\"Checking ip:{} port {}\"", ".", "format", "(", "arg_4", ".", "address", ",", "arg_4", ".", "port", ")", ")", "arg_5", "=", "'http://{}:{}/manager/html'", "gevent", ".", "spawn", "(", "brutefore_passwords", ",", "arg_4", ".", "address", ",", "arg_5", ".", "format", "(", "arg_4", ".", "address", ",", "arg_4", ".", "port", ")", ",", "arg_3", ",", "arg_4", ")", "arg_4", ".", "add_tag", "(", "'tomcat_brute'", ")", "arg_4", ".", "update", "(", "tags", "=", "arg_4", ".", "tags", ")", "gevent", ".", "wait", "(", ")", "Logger", "(", ")", ".", "log", "(", "\"tomcat_brute\"", ",", "\"Performed tomcat bruteforce scan\"", ",", "{", "'scanned_services'", ":", "len", "(", "arg_0", ")", "}", ")"], "function": "def Func():\n    \"\"\"\n        Checks the arguments to brutefore and spawns greenlets to perform the bruteforcing.\n    \"\"\"\n    arg_0 = ServiceSearch()\n    arg_1 = arg_0.argparser\n    arg_1.add_argument('-f', '--file', type=str, help=\"File\")\n    arg_2 = arg_1.parse_args()\n\n    if not arg_2.file:\n        print_error(\"Please provide a file with credentials seperated by ':'\")\n        sys.exit()\n\n    arg_0 = arg_0.get_services(search=[\"Tomcat\"], up=True, tags=['!tomcat_brute'])\n\n    arg_3 = []\n    with open(arg_2.file, 'r') as f:\n        arg_3 = f.readlines()\n\n    for arg_4 in arg_0:\n        print_notification(\"Checking ip:{} port {}\".format(arg_4.address, arg_4.port))\n        arg_5 = 'http://{}:{}/manager/html'\n        gevent.spawn(brutefore_passwords, arg_4.address, arg_5.format(arg_4.address, arg_4.port), arg_3, arg_4)\n        arg_4.add_tag('tomcat_brute')\n        arg_4.update(tags=arg_4.tags)\n\n    gevent.wait()\n    # TODO fix stats\n    Logger().log(\"tomcat_brute\", \"Performed tomcat bruteforce scan\", {'scanned_services': len(arg_0)})", "path": "jackal/scripts/tomcat_brute.py", "identifier": "main", "docstring": "Checks the arguments to brutefore and spawns greenlets to perform the bruteforcing.", "docstring_tokens": ["Checks", "the", "arguments", "to", "brutefore", "and", "spawns", "greenlets", "to", "perform", "the", "bruteforcing", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 257745}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/models.py#L61-L114", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "strcmp symbolic model.", "language": "python", "parameters": "(state, s1, s2)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "cpu", "if", "issymbolic", "(", "arg_1", ")", ":", "raise", "ConcretizeArgument", "(", "arg_0", ".", "cpu", ",", "1", ")", "if", "issymbolic", "(", "arg_2", ")", ":", "raise", "ConcretizeArgument", "(", "arg_0", ".", "cpu", ",", "2", ")", "arg_4", "=", "_find_zero", "(", "arg_3", ",", "arg_0", ".", "constraints", ",", "arg_1", ")", "arg_5", "=", "_find_zero", "(", "arg_3", ",", "arg_0", ".", "constraints", ",", "arg_2", ")", "arg_6", "=", "min", "(", "arg_4", ",", "arg_5", ")", "arg_7", "=", "None", "for", "arg_8", "in", "range", "(", "arg_6", ",", "-", "1", ",", "-", "1", ")", ":", "arg_9", "=", "ZEXTEND", "(", "arg_3", ".", "read_int", "(", "arg_1", "+", "arg_8", ",", "8", ")", ",", "arg_3", ".", "address_bit_size", ")", "arg_10", "=", "ZEXTEND", "(", "arg_3", ".", "read_int", "(", "arg_2", "+", "arg_8", ",", "8", ")", ",", "arg_3", ".", "address_bit_size", ")", "if", "issymbolic", "(", "arg_9", ")", "or", "issymbolic", "(", "arg_10", ")", ":", "if", "arg_7", "is", "None", "or", "(", "not", "issymbolic", "(", "arg_7", ")", "and", "arg_7", "==", "0", ")", ":", "arg_7", "=", "arg_9", "-", "arg_10", "else", ":", "arg_7", "=", "ITEBV", "(", "arg_3", ".", "address_bit_size", ",", "arg_9", "!=", "arg_10", ",", "arg_9", "-", "arg_10", ",", "arg_7", ")", "else", ":", "if", "arg_9", "!=", "arg_10", ":", "arg_7", "=", "arg_9", "-", "arg_10", "elif", "arg_7", "is", "None", ":", "arg_7", "=", "0", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Func symbolic model.\n\n    Algorithm: Walks from end of string (minimum offset to NULL in either string)\n    to beginning building tree of ITEs each time either of the\n    bytes at current offset is symbolic.\n\n    Points of Interest:\n    - We've been building up a symbolic tree but then encounter two\n      concrete bytes that differ. We can throw away the entire symbolic\n      tree!\n    - If we've been encountering concrete bytes that match\n      at the end of the string as we walk forward, and then we encounter\n      a pair where one is symbolic, we can forget about that 0 `ret` we've\n      been tracking and just replace it with the symbolic subtraction of\n      the two\n\n    :param State state: Current program state\n    :param int s1: Address of string 1\n    :param int s2: Address of string 2\n    :return: Symbolic Func result\n    :rtype: Expression or int\n    \"\"\"\n\n    arg_3 = arg_0.cpu\n\n    if issymbolic(arg_1):\n        raise ConcretizeArgument(arg_0.cpu, 1)\n    if issymbolic(arg_2):\n        raise ConcretizeArgument(arg_0.cpu, 2)\n\n    arg_4 = _find_zero(arg_3, arg_0.constraints, arg_1)\n    arg_5 = _find_zero(arg_3, arg_0.constraints, arg_2)\n    arg_6 = min(arg_4, arg_5)\n\n    arg_7 = None\n\n    for arg_8 in range(arg_6, -1, -1):\n        arg_9 = ZEXTEND(arg_3.read_int(arg_1 + arg_8, 8), arg_3.address_bit_size)\n        arg_10 = ZEXTEND(arg_3.read_int(arg_2 + arg_8, 8), arg_3.address_bit_size)\n\n        if issymbolic(arg_9) or issymbolic(arg_10):\n            if arg_7 is None or (not issymbolic(arg_7) and arg_7 == 0):\n                arg_7 = arg_9 - arg_10\n            else:\n                arg_7 = ITEBV(arg_3.address_bit_size, arg_9 != arg_10, arg_9 - arg_10, arg_7)\n        else:\n            if arg_9 != arg_10:\n                arg_7 = arg_9 - arg_10\n            elif arg_7 is None:\n                arg_7 = 0\n\n    return arg_7", "path": "manticore/native/models.py", "identifier": "strcmp", "docstring": "strcmp symbolic model.\n\n    Algorithm: Walks from end of string (minimum offset to NULL in either string)\n    to beginning building tree of ITEs each time either of the\n    bytes at current offset is symbolic.\n\n    Points of Interest:\n    - We've been building up a symbolic tree but then encounter two\n      concrete bytes that differ. We can throw away the entire symbolic\n      tree!\n    - If we've been encountering concrete bytes that match\n      at the end of the string as we walk forward, and then we encounter\n      a pair where one is symbolic, we can forget about that 0 `ret` we've\n      been tracking and just replace it with the symbolic subtraction of\n      the two\n\n    :param State state: Current program state\n    :param int s1: Address of string 1\n    :param int s2: Address of string 2\n    :return: Symbolic strcmp result\n    :rtype: Expression or int", "docstring_tokens": ["strcmp", "symbolic", "model", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257746}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1466-L1509", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Remove empty subfields and fields from the record.", "language": "python", "parameters": "(rec, tag=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "arg_0", ".", "keys", "(", ")", "for", "arg_1", "in", "arg_2", ":", "Func", "(", "arg_0", ",", "arg_1", ")", "elif", "arg_1", "in", "arg_0", ":", "if", "arg_1", "[", ":", "2", "]", "==", "'00'", ":", "if", "len", "(", "arg_0", "[", "arg_1", "]", ")", "==", "0", "or", "not", "arg_0", "[", "arg_1", "]", "[", "0", "]", "[", "3", "]", ":", "del", "arg_0", "[", "arg_1", "]", "else", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", "[", "arg_1", "]", ":", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_4", "[", "0", "]", ":", "if", "arg_6", "[", "1", "]", ":", "arg_6", "=", "(", "arg_6", "[", "0", "]", ",", "arg_6", "[", "1", "]", ".", "strip", "(", ")", ")", "arg_5", ".", "append", "(", "arg_6", ")", "if", "len", "(", "arg_5", ")", ">", "0", ":", "arg_7", "=", "create_field", "(", "arg_5", ",", "arg_4", "[", "1", "]", ",", "arg_4", "[", "2", "]", ",", "arg_4", "[", "3", "]", ")", "arg_3", ".", "append", "(", "arg_7", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_0", "[", "arg_1", "]", "=", "arg_3", "else", ":", "del", "arg_0", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Remove empty subfields and fields from the record.\n\n    If 'tag' is not None, only a specific tag of the record will be stripped,\n    otherwise the whole record.\n\n    :param rec:  A record dictionary structure\n    :type  rec:  dictionary\n    :param tag:  The tag of the field to strip empty fields from\n    :type  tag:  string\n    \"\"\"\n    # Check whole record\n    if arg_1 is None:\n        arg_2 = arg_0.keys()\n        for arg_1 in arg_2:\n            Func(arg_0, arg_1)\n\n    # Check specific tag of the record\n    elif arg_1 in arg_0:\n        # in case of a controlfield\n        if arg_1[:2] == '00':\n            if len(arg_0[arg_1]) == 0 or not arg_0[arg_1][0][3]:\n                del arg_0[arg_1]\n\n        #in case of a normal field\n        else:\n            arg_3 = []\n            for arg_4 in arg_0[arg_1]:\n                arg_5 = []\n                for arg_6 in arg_4[0]:\n                    # check if the subfield has been given a value\n                    if arg_6[1]:\n                        # Always strip values\n                        arg_6 = (arg_6[0], arg_6[1].strip())\n                        arg_5.append(arg_6)\n                if len(arg_5) > 0:\n                    arg_7 = create_field(arg_5, arg_4[1], arg_4[2],\n                                             arg_4[3])\n                    arg_3.append(arg_7)\n            if len(arg_3) > 0:\n                arg_0[arg_1] = arg_3\n            else:\n                del arg_0[arg_1]", "path": "harvestingkit/bibrecord.py", "identifier": "record_strip_empty_fields", "docstring": "Remove empty subfields and fields from the record.\n\n    If 'tag' is not None, only a specific tag of the record will be stripped,\n    otherwise the whole record.\n\n    :param rec:  A record dictionary structure\n    :type  rec:  dictionary\n    :param tag:  The tag of the field to strip empty fields from\n    :type  tag:  string", "docstring_tokens": ["Remove", "empty", "subfields", "and", "fields", "from", "the", "record", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257747}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L138-L167", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "This method will spawn a server job to create a default ML configuration based on a search template and\n        the extract as keys.\n        This function will submit the request to build, and wait for the configuration to finish before returning.", "language": "python", "parameters": "(self, search_template, extract_as_keys, dataset_ids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "\"search_template\"", ":", "arg_1", ",", "\"extract_as_keys\"", ":", "arg_2", "}", "arg_5", "=", "\"ML Configuration creation failed\"", "arg_6", "=", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_post_json", "(", "'v1/descriptors/builders/simple/default/trigger'", ",", "arg_4", ",", "arg_5", "=", "arg_5", ")", ")", "[", "'data'", "]", "[", "'result'", "]", "[", "'uid'", "]", "while", "True", ":", "arg_7", "=", "arg_0", ".", "__get_ml_configuration_status", "(", "arg_6", ")", "print", "(", "'Configuration status: '", ",", "arg_7", ")", "if", "arg_7", "[", "'status'", "]", "==", "'Finished'", ":", "arg_8", "=", "arg_0", ".", "__convert_response_to_configuration", "(", "arg_7", "[", "'result'", "]", ",", "arg_3", ")", "return", "arg_8", "time", ".", "sleep", "(", "5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        This method will spawn a server job to create a default ML configuration based on a search template and\n        the extract as keys.\n        This function will submit the request to build, and wait for the configuration to finish before returning.\n\n        :param search_template: A search template defining the query (properties, datasets etc)\n        :param extract_as_keys: Array of extract-as keys defining the descriptors\n        :param dataset_ids: Array of dataset identifiers to make search template from\n        :return: An identifier used to request the status of the builder job (get_ml_configuration_status)\n        \"\"\"\n        arg_4 = {\n            \"search_template\":\n                arg_1,\n            \"extract_as_keys\":\n                arg_2\n        }\n\n        arg_5 = \"ML Configuration creation failed\"\n        arg_6 = arg_0._get_success_json(arg_0._post_json(\n            'v1/descriptors/builders/simple/default/trigger', arg_4, arg_5=arg_5))['data'][\n            'result']['uid']\n\n        while True:\n            arg_7 = arg_0.__get_ml_configuration_status(arg_6)\n            print('Configuration status: ', arg_7)\n            if arg_7['status'] == 'Finished':\n                arg_8 = arg_0.__convert_response_to_configuration(arg_7['result'], arg_3)\n                return arg_8\n            time.sleep(5)", "path": "citrination_client/views/client.py", "identifier": "DataViewsClient.create_ml_configuration", "docstring": "This method will spawn a server job to create a default ML configuration based on a search template and\n        the extract as keys.\n        This function will submit the request to build, and wait for the configuration to finish before returning.\n\n        :param search_template: A search template defining the query (properties, datasets etc)\n        :param extract_as_keys: Array of extract-as keys defining the descriptors\n        :param dataset_ids: Array of dataset identifiers to make search template from\n        :return: An identifier used to request the status of the builder job (get_ml_configuration_status)", "docstring_tokens": ["This", "method", "will", "spawn", "a", "server", "job", "to", "create", "a", "default", "ML", "configuration", "based", "on", "a", "search", "template", "and", "the", "extract", "as", "keys", ".", "This", "function", "will", "submit", "the", "request", "to", "build", "and", "wait", "for", "the", "configuration", "to", "finish", "before", "returning", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 257748}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/xml_generators/change_resource_record_set.py#L5-L33", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "In the case of deletions, we pull the change values for the XML request\n    from the ResourceRecordSet._initial_vals dict, since we want the original\n    values. For creations, we pull from the attributes on ResourceRecordSet.", "language": "python", "parameters": "(change)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", "if", "arg_1", "==", "'CREATE'", ":", "arg_3", "=", "dict", "(", ")", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "_initial_vals", ".", "items", "(", ")", ":", "arg_3", "[", "arg_4", "]", "=", "getattr", "(", "arg_2", ",", "arg_4", ")", "return", "arg_3", "else", ":", "return", "arg_2", ".", "_initial_vals"], "function": "def Func(arg_0):\n    \"\"\"\n    In the case of deletions, we pull the change values for the XML request\n    from the ResourceRecordSet._initial_vals dict, since we want the original\n    values. For creations, we pull from the attributes on ResourceRecordSet.\n\n    Since we're dealing with attributes vs. dict key/vals, we'll abstract\n    this part away here and just always pass a dict to write_change.\n\n    :rtype: dict\n    :returns: A dict of change data, used by :py:func:`write_change` to\n        write the change request XML.\n    \"\"\"\n\n    arg_1, arg_2 = arg_0\n\n    if arg_1 == 'CREATE':\n        # For creations, we want the current values, since they don't need to\n        # match an existing record set.\n        arg_3 = dict()\n        for arg_4, arg_5 in arg_2._initial_vals.items():\n            # Pull from the record set's attributes, which are the current\n            # values.\n            arg_3[arg_4] = getattr(arg_2, arg_4)\n        return arg_3\n    else:\n        # We can look at the initial values dict for deletions, since we\n        # have to match against the values currently in Route53.\n        return arg_2._initial_vals", "path": "route53/xml_generators/change_resource_record_set.py", "identifier": "get_change_values", "docstring": "In the case of deletions, we pull the change values for the XML request\n    from the ResourceRecordSet._initial_vals dict, since we want the original\n    values. For creations, we pull from the attributes on ResourceRecordSet.\n\n    Since we're dealing with attributes vs. dict key/vals, we'll abstract\n    this part away here and just always pass a dict to write_change.\n\n    :rtype: dict\n    :returns: A dict of change data, used by :py:func:`write_change` to\n        write the change request XML.", "docstring_tokens": ["In", "the", "case", "of", "deletions", "we", "pull", "the", "change", "values", "for", "the", "XML", "request", "from", "the", "ResourceRecordSet", ".", "_initial_vals", "dict", "since", "we", "want", "the", "original", "values", ".", "For", "creations", "we", "pull", "from", "the", "attributes", "on", "ResourceRecordSet", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 257749}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/aws_lambda_hook.py#L53-L68", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Invoke Lambda Function", "language": "python", "parameters": "(self, payload)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_conn", "(", ")", "arg_3", "=", "arg_2", ".", "invoke", "(", "FunctionName", "=", "arg_0", ".", "function_name", ",", "InvocationType", "=", "arg_0", ".", "invocation_type", ",", "LogType", "=", "arg_0", ".", "log_type", ",", "Payload", "=", "arg_1", ",", "Qualifier", "=", "arg_0", ".", "qualifier", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Invoke Lambda Function\n        \"\"\"\n\n        arg_2 = arg_0.get_conn()\n\n        arg_3 = arg_2.invoke(\n            FunctionName=arg_0.function_name,\n            InvocationType=arg_0.invocation_type,\n            LogType=arg_0.log_type,\n            Payload=arg_1,\n            Qualifier=arg_0.qualifier\n        )\n\n        return arg_3", "path": "airflow/contrib/hooks/aws_lambda_hook.py", "identifier": "AwsLambdaHook.invoke_lambda", "docstring": "Invoke Lambda Function", "docstring_tokens": ["Invoke", "Lambda", "Function"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257750}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/models/bayesian_resnet.py#L95-L121", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Network block for ResNet.", "language": "python", "parameters": "(x, filters, kernel, stride, kernel_posterior_fn)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_0", "=", "tf", ".", "keras", ".", "layers", ".", "BatchNormalization", "(", ")", "(", "arg_0", ")", "arg_0", "=", "tf", ".", "keras", ".", "layers", ".", "Activation", "(", "'relu'", ")", "(", "arg_0", ")", "if", "arg_3", "!=", "1", "or", "arg_1", "!=", "arg_0", ".", "shape", "[", "1", "]", ":", "arg_5", "=", "_projection_shortcut", "(", "arg_0", ",", "arg_1", ",", "arg_3", ",", "arg_4", ")", "else", ":", "arg_5", "=", "arg_0", "arg_0", "=", "tfp", ".", "layers", ".", "Convolution2DFlipout", "(", "arg_1", ",", "arg_2", ",", "strides", "=", "arg_3", ",", "padding", "=", "'same'", ",", "arg_4", "=", "arg_4", ")", "(", "arg_0", ")", "arg_0", "=", "tf", ".", "keras", ".", "layers", ".", "BatchNormalization", "(", ")", "(", "arg_0", ")", "arg_0", "=", "tf", ".", "keras", ".", "layers", ".", "Activation", "(", "'relu'", ")", "(", "arg_0", ")", "arg_0", "=", "tfp", ".", "layers", ".", "Convolution2DFlipout", "(", "arg_1", ",", "arg_2", ",", "strides", "=", "1", ",", "padding", "=", "'same'", ",", "arg_4", "=", "arg_4", ")", "(", "arg_0", ")", "arg_0", "=", "tf", ".", "keras", ".", "layers", ".", "add", "(", "[", "arg_0", ",", "arg_5", "]", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n  \"\"\"Network block for ResNet.\"\"\"\n  arg_0 = tf.keras.layers.BatchNormalization()(arg_0)\n  arg_0 = tf.keras.layers.Activation('relu')(arg_0)\n\n  if arg_3 != 1 or arg_1 != arg_0.shape[1]:\n    arg_5 = _projection_shortcut(arg_0, arg_1, arg_3, arg_4)\n  else:\n    arg_5 = arg_0\n\n  arg_0 = tfp.layers.Convolution2DFlipout(\n      arg_1,\n      arg_2,\n      strides=arg_3,\n      padding='same',\n      arg_4=arg_4)(arg_0)\n  arg_0 = tf.keras.layers.BatchNormalization()(arg_0)\n  arg_0 = tf.keras.layers.Activation('relu')(arg_0)\n\n  arg_0 = tfp.layers.Convolution2DFlipout(\n      arg_1,\n      arg_2,\n      strides=1,\n      padding='same',\n      arg_4=arg_4)(arg_0)\n  arg_0 = tf.keras.layers.add([arg_0, arg_5])\n  return arg_0", "path": "tensorflow_probability/examples/models/bayesian_resnet.py", "identifier": "_resnet_block", "docstring": "Network block for ResNet.", "docstring_tokens": ["Network", "block", "for", "ResNet", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257751}
{"url": "https://github.com/ui/django-thumbnails/blob/5cef55e7f167060458709ed760dd43981124796a/thumbnails/images.py#L104-L113", "sha": "5cef55e7f167060458709ed760dd43981124796a", "docstring_summary": "Deletes a thumbnail file and its relevant metadata.", "language": "python", "parameters": "(source_name, size, metadata_backend=None, storage_backend=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "backends", ".", "storage", ".", "get_backend", "(", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "backends", ".", "metadata", ".", "get_backend", "(", ")", "arg_3", ".", "Func", "(", "get_thumbnail_name", "(", "arg_0", ",", "arg_1", ")", ")", "arg_2", ".", "Func_thumbnail", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    Deletes a thumbnail file and its relevant metadata.\n    \"\"\"\n    if arg_3 is None:\n        arg_3 = backends.storage.get_backend()\n    if arg_2 is None:\n        arg_2 = backends.metadata.get_backend()\n    arg_3.Func(get_thumbnail_name(arg_0, arg_1))\n    arg_2.Func_thumbnail(arg_0, arg_1)", "path": "thumbnails/images.py", "identifier": "delete", "docstring": "Deletes a thumbnail file and its relevant metadata.", "docstring_tokens": ["Deletes", "a", "thumbnail", "file", "and", "its", "relevant", "metadata", "."], "nwo": "ui/django-thumbnails", "score": 0.28145370109860535, "idx": 257752}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L39-L52", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Computes the novelty curve from the self-similarity matrix X and\n        the gaussian kernel G.", "language": "python", "parameters": "(X, G)", "return_statement": "return nc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "shape", "[", "0", "]", "arg_3", "=", "arg_1", ".", "shape", "[", "0", "]", "arg_4", "=", "np", ".", "zeros", "(", "arg_2", ")", "for", "arg_5", "in", "range", "(", "arg_3", "//", "2", ",", "arg_2", "-", "arg_3", "//", "2", "+", "1", ")", ":", "arg_4", "[", "arg_5", "]", "=", "np", ".", "sum", "(", "arg_0", "[", "arg_5", "-", "arg_3", "//", "2", ":", "arg_5", "+", "arg_3", "//", "2", ",", "arg_5", "-", "arg_3", "//", "2", ":", "arg_5", "+", "arg_3", "//", "2", "]", "*", "arg_1", ")", "arg_4", "+=", "arg_4", ".", "min", "(", ")", "arg_4", "/=", "arg_4", ".", "max", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Computes the novelty curve from the self-similarity matrix X and\n        the gaussian kernel G.\"\"\"\n    arg_2 = arg_0.shape[0]\n    arg_3 = arg_1.shape[0]\n    arg_4 = np.zeros(arg_2)\n\n    for arg_5 in range(arg_3 // 2, arg_2 - arg_3 // 2 + 1):\n        arg_4[arg_5] = np.sum(arg_0[arg_5 - arg_3 // 2:arg_5 + arg_3 // 2, arg_5 - arg_3 // 2:arg_5 + arg_3 // 2] * arg_1)\n\n    # Normalize\n    arg_4 += arg_4.min()\n    arg_4 /= arg_4.max()\n    return arg_4", "path": "msaf/algorithms/foote/segmenter.py", "identifier": "compute_nc", "docstring": "Computes the novelty curve from the self-similarity matrix X and\n        the gaussian kernel G.", "docstring_tokens": ["Computes", "the", "novelty", "curve", "from", "the", "self", "-", "similarity", "matrix", "X", "and", "the", "gaussian", "kernel", "G", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 257753}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L4362-L4420", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Removes a parameter or result or group from the hdf5 file.", "language": "python", "parameters": "(self, instance,\n                                                 delete_only=None,\n                                                 remove_from_item=False,\n                                                 recursive=False,\n                                                 _hdf5_group=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_1", ".", "v_location", ".", "split", "(", "'.'", ")", "if", "arg_5", "is", "None", ":", "arg_7", "=", "'/'", "+", "arg_0", ".", "_trajectory_name", "+", "'/'", "+", "'/'", ".", "join", "(", "arg_6", ")", "arg_8", "=", "arg_1", ".", "v_name", "arg_5", "=", "arg_0", ".", "_hdf5file", ".", "get_node", "(", "arg_7", "=", "arg_7", ",", "name", "=", "arg_8", ")", "if", "arg_2", "is", "None", ":", "if", "arg_1", ".", "v_is_group", "and", "not", "arg_4", "and", "len", "(", "arg_5", ".", "_v_children", ")", "!=", "0", ":", "raise", "TypeError", "(", "'You cannot remove the group `%s`, it has children, please '", "'use `recursive=True` to enforce removal.'", "%", "arg_1", ".", "v_full_name", ")", "arg_5", ".", "_f_remove", "(", "arg_4", "=", "True", ")", "else", ":", "if", "not", "arg_1", ".", "v_is_leaf", ":", "raise", "ValueError", "(", "'You can only choose `delete_only` mode for leafs.'", ")", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_2", "=", "[", "arg_2", "]", "for", "arg_9", "in", "arg_2", ":", "if", "(", "arg_3", "and", "hasattr", "(", "arg_1", ",", "'__contains__'", ")", "and", "hasattr", "(", "arg_1", ",", "'__delattr__'", ")", "and", "arg_9", "in", "arg_1", ")", ":", "delattr", "(", "arg_1", ",", "arg_9", ")", "try", ":", "arg_10", "=", "arg_0", ".", "_hdf5file", ".", "get_node", "(", "arg_7", "=", "arg_5", ",", "name", "=", "arg_9", ")", "arg_10", ".", "_f_remove", "(", "arg_4", "=", "True", ")", "except", "pt", ".", "NoSuchNodeError", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'Could not delete `%s` from `%s`. HDF5 node not found!'", "%", "(", "arg_9", ",", "arg_1", ".", "v_full_name", ")", ")"], "function": "def Func(arg_0, arg_1,\n                                                 arg_2=None,\n                                                 arg_3=False,\n                                                 arg_4=False,\n                                                 arg_5=None):\n        \"\"\"Removes a parameter or result or group from the hdf5 file.\n\n        :param instance: Instance to be removed\n\n        :param delete_only:\n\n            List of elements if you only want to delete parts of a leaf node. Note that this\n            needs to list the names of the hdf5 subnodes. BE CAREFUL if you erase parts of a leaf.\n            Erasing partly happens at your own risk, it might be the case that you can\n            no longer reconstruct the leaf from the leftovers!\n\n        :param remove_from_item:\n\n            If using `delete_only` and `remove_from_item=True` after deletion the data item is\n            also removed from the `instance`.\n\n        :param recursive:\n\n            If a group node has children, you will can delete it if recursive is True.\n\n\n        \"\"\"\n        arg_6 = arg_1.v_location.split('.')\n        if arg_5 is None:\n            arg_7 = '/' + arg_0._trajectory_name + '/' + '/'.join(arg_6)\n            arg_8 = arg_1.v_name\n            arg_5 = arg_0._hdf5file.get_node(arg_7=arg_7, name=arg_8)\n\n        if arg_2 is None:\n            if arg_1.v_is_group and not arg_4 and len(arg_5._v_children) != 0:\n                    raise TypeError('You cannot remove the group `%s`, it has children, please '\n                                    'use `recursive=True` to enforce removal.' %\n                                    arg_1.v_full_name)\n            arg_5._f_remove(arg_4=True)\n        else:\n            if not arg_1.v_is_leaf:\n                raise ValueError('You can only choose `delete_only` mode for leafs.')\n\n            if isinstance(arg_2, str):\n                arg_2 = [arg_2]\n\n            for arg_9 in arg_2:\n                if (arg_3 and\n                        hasattr(arg_1, '__contains__') and\n                        hasattr(arg_1, '__delattr__') and\n                            arg_9 in arg_1):\n                    delattr(arg_1, arg_9)\n                try:\n                    arg_10 = arg_0._hdf5file.get_node(arg_7=arg_5,\n                                                        name=arg_9)\n                    arg_10._f_remove(arg_4=True)\n                except pt.NoSuchNodeError:\n                    arg_0._logger.warning('Could not delete `%s` from `%s`. HDF5 node not found!' %\n                                         (arg_9, arg_1.v_full_name))", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._all_delete_parameter_or_result_or_group", "docstring": "Removes a parameter or result or group from the hdf5 file.\n\n        :param instance: Instance to be removed\n\n        :param delete_only:\n\n            List of elements if you only want to delete parts of a leaf node. Note that this\n            needs to list the names of the hdf5 subnodes. BE CAREFUL if you erase parts of a leaf.\n            Erasing partly happens at your own risk, it might be the case that you can\n            no longer reconstruct the leaf from the leftovers!\n\n        :param remove_from_item:\n\n            If using `delete_only` and `remove_from_item=True` after deletion the data item is\n            also removed from the `instance`.\n\n        :param recursive:\n\n            If a group node has children, you will can delete it if recursive is True.", "docstring_tokens": ["Removes", "a", "parameter", "or", "result", "or", "group", "from", "the", "hdf5", "file", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257754}
{"url": "https://github.com/justanr/flask-allows/blob/39fa5c8692836a33646ea43b4081e7c2181ec7c4/src/flask_allows/overrides.py#L141-L154", "sha": "39fa5c8692836a33646ea43b4081e7c2181ec7c4", "docstring_summary": "Binds an override to the current context, optionally use the\n        current overrides in conjunction with this override", "language": "python", "parameters": "(self, override, use_parent=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "current", "if", "arg_2", "and", "arg_3", ":", "arg_1", "=", "arg_3", "+", "arg_1", "_override_ctx_stack", ".", "Func", "(", "(", "arg_0", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Binds an override to the current context, optionally use the\n        current overrides in conjunction with this override\n\n        If ``use_parent`` is true, a new override is created from the\n        parent and child overrides rather than manipulating either\n        directly.\n        \"\"\"\n        arg_3 = arg_0.current\n        if arg_2 and arg_3:\n            arg_1 = arg_3 + arg_1\n\n        _override_ctx_stack.Func((arg_0, arg_1))", "path": "src/flask_allows/overrides.py", "identifier": "OverrideManager.push", "docstring": "Binds an override to the current context, optionally use the\n        current overrides in conjunction with this override\n\n        If ``use_parent`` is true, a new override is created from the\n        parent and child overrides rather than manipulating either\n        directly.", "docstring_tokens": ["Binds", "an", "override", "to", "the", "current", "context", "optionally", "use", "the", "current", "overrides", "in", "conjunction", "with", "this", "override"], "nwo": "justanr/flask-allows", "score": 0.19676903429081236, "idx": 257755}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/states.py#L745-L754", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Allows for fast local updates of log-likelihood", "language": "python", "parameters": "(self, model=None, tile=None)", "return_statement": "return -0.5*isig*isig*np.dot(res.flat, res.flat) + nlogs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_3", "=", "arg_0", ".", "residuals", "else", ":", "arg_3", "=", "arg_1", "-", "arg_0", ".", "_data", "[", "arg_2", ".", "slicer", "]", "arg_4", ",", "arg_5", "=", "arg_0", ".", "sigma", ",", "1.0", "/", "arg_0", ".", "sigma", "arg_6", "=", "-", "np", ".", "log", "(", "np", ".", "sqrt", "(", "2", "*", "np", ".", "pi", ")", "*", "arg_4", ")", "*", "arg_3", ".", "size", "return", "-", "0.5", "*", "arg_5", "*", "arg_5", "*", "np", ".", "dot", "(", "arg_3", ".", "flat", ",", "arg_3", ".", "flat", ")", "+", "arg_6"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Allows for fast local updates of log-likelihood\"\"\"\n        if arg_1 is None:\n            arg_3 = arg_0.residuals\n        else:\n            arg_3 = arg_1 - arg_0._data[arg_2.slicer]\n\n        arg_4, arg_5 = arg_0.sigma, 1.0/arg_0.sigma\n        arg_6 = -np.log(np.sqrt(2*np.pi)*arg_4)*arg_3.size\n        return -0.5*arg_5*arg_5*np.dot(arg_3.flat, arg_3.flat) + arg_6", "path": "peri/states.py", "identifier": "ImageState._calc_loglikelihood", "docstring": "Allows for fast local updates of log-likelihood", "docstring_tokens": ["Allows", "for", "fast", "local", "updates", "of", "log", "-", "likelihood"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 257756}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L443-L455", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Converts an text representation of a protocol message into a message.", "language": "python", "parameters": "(self, lines, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "_Tokenizer", "(", "arg_1", ")", "while", "not", "arg_3", ".", "AtEnd", "(", ")", ":", "arg_0", ".", "_MergeField", "(", "arg_3", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Converts an text representation of a protocol message into a message.\n\n    Args:\n      lines: Lines of a message's text representation.\n      message: A protocol buffer message to merge into.\n\n    Raises:\n      ParseError: On text parsing problems.\n    \"\"\"\n    arg_3 = _Tokenizer(arg_1)\n    while not arg_3.AtEnd():\n      arg_0._MergeField(arg_3, arg_2)", "path": "typy/google/protobuf/text_format.py", "identifier": "_Parser._ParseOrMerge", "docstring": "Converts an text representation of a protocol message into a message.\n\n    Args:\n      lines: Lines of a message's text representation.\n      message: A protocol buffer message to merge into.\n\n    Raises:\n      ParseError: On text parsing problems.", "docstring_tokens": ["Converts", "an", "text", "representation", "of", "a", "protocol", "message", "into", "a", "message", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 257757}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py#L105-L112", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Remove any builtins which might have been added by add_builtins, or\n        restore overwritten ones to their previous values.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "remove_builtin", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "_orig_builtins", ".", "iteritems", "(", ")", ":", "arg_1", "(", "arg_2", ",", "arg_3", ")", "arg_0", ".", "_orig_builtins", ".", "clear", "(", ")", "arg_0", ".", "_builtins_added", "=", "False"], "function": "def Func(arg_0):\n        \"\"\"Remove any builtins which might have been added by add_builtins, or\n        restore overwritten ones to their previous values.\"\"\"\n        arg_1 = arg_0.remove_builtin\n        for arg_2, arg_3 in arg_0._orig_builtins.iteritems():\n            arg_1(arg_2, arg_3)\n        arg_0._orig_builtins.clear()\n        arg_0._builtins_added = False", "path": "environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py", "identifier": "BuiltinTrap.deactivate", "docstring": "Remove any builtins which might have been added by add_builtins, or\n        restore overwritten ones to their previous values.", "docstring_tokens": ["Remove", "any", "builtins", "which", "might", "have", "been", "added", "by", "add_builtins", "or", "restore", "overwritten", "ones", "to", "their", "previous", "values", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257758}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/django_util/storage.py#L66-L76", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Write a Credentials to the Django datastore.", "language": "python", "parameters": "(self, credentials)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "model_class", ".", "objects", ".", "get_or_create", "(", "**", "{", "arg_0", ".", "key_name", ":", "arg_0", ".", "key_value", "}", ")", "setattr", "(", "arg_2", ",", "arg_0", ".", "property_name", ",", "arg_1", ")", "arg_2", ".", "save", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Write a Credentials to the Django datastore.\n\n        Args:\n            credentials: Credentials, the credentials to store.\n        \"\"\"\n        arg_2, arg_3 = arg_0.model_class.objects.get_or_create(\n            **{arg_0.key_name: arg_0.key_value})\n\n        setattr(arg_2, arg_0.property_name, arg_1)\n        arg_2.save()", "path": "oauth2client/contrib/django_util/storage.py", "identifier": "DjangoORMStorage.locked_put", "docstring": "Write a Credentials to the Django datastore.\n\n        Args:\n            credentials: Credentials, the credentials to store.", "docstring_tokens": ["Write", "a", "Credentials", "to", "the", "Django", "datastore", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 257759}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_bwt.py#L45-L90", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return the Burrows-Wheeler transformed form of a word.", "language": "python", "parameters": "(self, word, terminator='\\0')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'\\0'", ")", ":", "if", "arg_1", ":", "if", "arg_2", "in", "arg_1", ":", "raise", "ValueError", "(", "'Specified terminator, {}, already in word.'", ".", "format", "(", "arg_2", "if", "arg_2", "!=", "'\\0'", "else", "'\\\\0'", ")", ")", "else", ":", "arg_1", "+=", "arg_2", "arg_3", "=", "sorted", "(", "arg_1", "[", "i", ":", "]", "+", "arg_1", "[", ":", "i", "]", "for", "i", "in", "range", "(", "len", "(", "arg_1", ")", ")", ")", "return", "''", ".", "join", "(", "[", "arg_4", "[", "-", "1", "]", "for", "arg_4", "in", "arg_3", "]", ")", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2='\\0'):\n        r\"\"\"Return the Burrows-Wheeler transformed form of a word.\n\n        Parameters\n        ----------\n        word : str\n            The word to transform using BWT\n        terminator : str\n            A character added to signal the end of the string\n\n        Returns\n        -------\n        str\n            Word Funcd by BWT\n\n        Raises\n        ------\n        ValueError\n            Specified terminator absent from code.\n\n        Examples\n        --------\n        >>> bwt = BWT()\n        >>> bwt.Func('align')\n        'n\\x00ilag'\n        >>> bwt.Func('banana')\n        'annb\\x00aa'\n        >>> bwt.Func('banana', '@')\n        'annb@aa'\n\n        \"\"\"\n        if arg_1:\n            if arg_2 in arg_1:\n                raise ValueError(\n                    'Specified terminator, {}, already in word.'.format(\n                        arg_2 if arg_2 != '\\0' else '\\\\0'\n                    )\n                )\n            else:\n                arg_1 += arg_2\n                arg_3 = sorted(\n                    arg_1[i:] + arg_1[:i] for i in range(len(arg_1))\n                )\n                return ''.join([arg_4[-1] for arg_4 in arg_3])\n        else:\n            return arg_2", "path": "abydos/compression/_bwt.py", "identifier": "BWT.encode", "docstring": "r\"\"\"Return the Burrows-Wheeler transformed form of a word.\n\n        Parameters\n        ----------\n        word : str\n            The word to transform using BWT\n        terminator : str\n            A character added to signal the end of the string\n\n        Returns\n        -------\n        str\n            Word encoded by BWT\n\n        Raises\n        ------\n        ValueError\n            Specified terminator absent from code.\n\n        Examples\n        --------\n        >>> bwt = BWT()\n        >>> bwt.encode('align')\n        'n\\x00ilag'\n        >>> bwt.encode('banana')\n        'annb\\x00aa'\n        >>> bwt.encode('banana', '@')\n        'annb@aa'", "docstring_tokens": ["r", "Return", "the", "Burrows", "-", "Wheeler", "transformed", "form", "of", "a", "word", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 257760}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L212-L215", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns de maximum values of x, y, z as a numpy array", "language": "python", "parameters": "(self)", "return_statement": "return np.array([self.x_max, self.y_max, self.z_max])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "np", ".", "array", "(", "[", "arg_0", ".", "x_max", ",", "arg_0", ".", "y_max", ",", "arg_0", ".", "z_max", "]", ")"], "function": "def Func(arg_0):\n        \"\"\" Returns de maximum values of x, y, z as a numpy array\n        \"\"\"\n        return np.array([arg_0.x_max, arg_0.y_max, arg_0.z_max])", "path": "pylas/headers/rawheader.py", "identifier": "RawHeader1_1.maxs", "docstring": "Returns de maximum values of x, y, z as a numpy array", "docstring_tokens": ["Returns", "de", "maximum", "values", "of", "x", "y", "z", "as", "a", "numpy", "array"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 257761}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L214-L266", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Callback called by Secure Transport to actually write to the socket", "language": "python", "parameters": "(connection_id, data_buffer, data_length_pointer)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "_connection_refs", ".", "get", "(", "arg_0", ")", "if", "not", "arg_3", ":", "arg_4", "=", "_socket_refs", ".", "get", "(", "arg_0", ")", "else", ":", "arg_4", "=", "arg_3", ".", "_socket", "if", "not", "arg_3", "and", "not", "arg_4", ":", "return", "0", "arg_5", "=", "deref", "(", "arg_2", ")", "arg_6", "=", "bytes_from_buffer", "(", "arg_1", ",", "arg_5", ")", "if", "arg_3", "and", "not", "arg_3", ".", "_done_handshake", ":", "arg_3", ".", "_client_hello", "+=", "arg_6", "arg_7", "=", "None", "try", ":", "arg_8", "=", "arg_4", ".", "send", "(", "arg_6", ")", "except", "(", "socket_", ".", "error", ")", "as", "e", ":", "arg_7", "=", "e", ".", "errno", "if", "arg_7", "is", "not", "None", "and", "arg_7", "!=", "errno", ".", "EAGAIN", ":", "if", "arg_7", "==", "errno", ".", "ECONNRESET", "or", "arg_7", "==", "errno", ".", "EPIPE", ":", "return", "SecurityConst", ".", "errSSLClosedNoNotify", "return", "SecurityConst", ".", "errSSLClosedAbort", "if", "arg_8", "!=", "arg_5", ":", "pointer_set", "(", "arg_2", ",", "arg_8", ")", "return", "SecurityConst", ".", "errSSLWouldBlock", "return", "0", "except", "(", "KeyboardInterrupt", ")", "as", "e", ":", "arg_3", ".", "_exception", "=", "e", "return", "SecurityConst", ".", "errSSLPeerUserCancelled"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Callback called by Secure Transport to actually write to the socket\n\n    :param connection_id:\n        An integer identifing the connection\n\n    :param data_buffer:\n        A char pointer FFI type containing the data to write\n\n    :param data_length_pointer:\n        A size_t pointer FFI type of the amount of data to write. Will be\n        overwritten with the amount of data actually written on return.\n\n    :return:\n        An integer status code of the result - 0 for success\n    \"\"\"\n\n    try:\n        arg_3 = _connection_refs.get(arg_0)\n        if not arg_3:\n            arg_4 = _socket_refs.get(arg_0)\n        else:\n            arg_4 = arg_3._socket\n\n        if not arg_3 and not arg_4:\n            return 0\n\n        arg_5 = deref(arg_2)\n        arg_6 = bytes_from_buffer(arg_1, arg_5)\n\n        if arg_3 and not arg_3._done_handshake:\n            arg_3._client_hello += arg_6\n\n        arg_7 = None\n        try:\n            arg_8 = arg_4.send(arg_6)\n        except (socket_.error) as e:\n            arg_7 = e.errno\n\n        if arg_7 is not None and arg_7 != errno.EAGAIN:\n            if arg_7 == errno.ECONNRESET or arg_7 == errno.EPIPE:\n                return SecurityConst.errSSLClosedNoNotify\n            return SecurityConst.errSSLClosedAbort\n\n        if arg_8 != arg_5:\n            pointer_set(arg_2, arg_8)\n            return SecurityConst.errSSLWouldBlock\n\n        return 0\n    except (KeyboardInterrupt) as e:\n        arg_3._exception = e\n        return SecurityConst.errSSLPeerUserCancelled", "path": "oscrypto/_osx/tls.py", "identifier": "_write_callback", "docstring": "Callback called by Secure Transport to actually write to the socket\n\n    :param connection_id:\n        An integer identifing the connection\n\n    :param data_buffer:\n        A char pointer FFI type containing the data to write\n\n    :param data_length_pointer:\n        A size_t pointer FFI type of the amount of data to write. Will be\n        overwritten with the amount of data actually written on return.\n\n    :return:\n        An integer status code of the result - 0 for success", "docstring_tokens": ["Callback", "called", "by", "Secure", "Transport", "to", "actually", "write", "to", "the", "socket"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 257762}
{"url": "https://github.com/mozillazg/bustard/blob/bd7b47f3ba5440cf6ea026c8b633060fedeb80b7/bustard/template.py#L306-L310", "sha": "bd7b47f3ba5440cf6ea026c8b633060fedeb80b7", "docstring_summary": "flush all buffered string into code", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "code_builder", ".", "add_line", "(", "'{0}.extend([{1}])'", ",", "arg_0", ".", "result_var", ",", "','", ".", "join", "(", "arg_0", ".", "buffered", ")", ")", "arg_0", ".", "buffered", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"flush all buffered string into code\"\"\"\n        arg_0.code_builder.add_line('{0}.extend([{1}])',\n                                   arg_0.result_var, ','.join(arg_0.buffered))\n        arg_0.buffered = []", "path": "bustard/template.py", "identifier": "Template.flush_buffer", "docstring": "flush all buffered string into code", "docstring_tokens": ["flush", "all", "buffered", "string", "into", "code"], "nwo": "mozillazg/bustard", "score": 0.16941397159673272, "idx": 257763}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/extension.py#L15-L27", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return True if Cython or Pyrex can be imported.", "language": "python", "parameters": "()", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "'Cython.Distutils.build_ext'", ",", "'Pyrex.Distutils.build_ext'", "for", "arg_1", "in", "arg_0", ":", "try", ":", "__import__", "(", "arg_1", ",", "fromlist", "=", "[", "'build_ext'", "]", ")", ".", "build_ext", "return", "True", "except", "Exception", ":", "pass", "return", "False"], "function": "def Func():\n    \"\"\"\n    Return True if Cython or Pyrex can be imported.\n    \"\"\"\n    arg_0 = 'Cython.Distutils.build_ext', 'Pyrex.Distutils.build_ext'\n    for arg_1 in arg_0:\n        try:\n            # from (pyrex_impl) import build_ext\n            __import__(arg_1, fromlist=['build_ext']).build_ext\n            return True\n        except Exception:\n            pass\n    return False", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/extension.py", "identifier": "have_pyrex", "docstring": "Return True if Cython or Pyrex can be imported.", "docstring_tokens": ["Return", "True", "if", "Cython", "or", "Pyrex", "can", "be", "imported", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257764}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/gurumate-2.8.6-py2.7.egg/gurumate/linux2/apt.py#L30-L50", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "returns installed package version and None if package is not installed", "language": "python", "parameters": "(name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "compile", "(", "r'''Installed:\\s+(?P<version>.*)'''", ")", "arg_2", "=", "'apt-cache policy %s'", "%", "arg_0", "arg_3", "=", "shlex", ".", "split", "(", "arg_2", ")", "try", ":", "arg_4", "=", "subprocess", ".", "check_output", "(", "arg_3", ")", "if", "not", "arg_4", ":", "return", "None", "except", "CalledProcessError", ":", "return", "None", "arg_5", "=", "arg_1", ".", "search", "(", "arg_4", ")", "if", "arg_5", ":", "arg_6", "=", "arg_5", ".", "groupdict", "(", ")", "[", "'version'", "]", "if", "arg_6", "==", "'(none)'", ":", "return", "None", "else", ":", "return", "arg_6"], "function": "def Func(arg_0):\n    '''\n        returns installed package version and None if package is not installed\n    '''\n    arg_1 = re.compile(r'''Installed:\\s+(?P<version>.*)''')\n    arg_2 = 'apt-cache policy %s' % arg_0\n    arg_3 = shlex.split(arg_2)\n    try:\n        arg_4 = subprocess.check_output(arg_3)\n        if not arg_4:\n            return None\n    except CalledProcessError:\n        return None\n    # check output\n    arg_5 = arg_1.search(arg_4)\n    if arg_5:\n        arg_6 = arg_5.groupdict()['version']\n        if arg_6 == '(none)':\n            return None\n        else:\n            return arg_6", "path": "environment/lib/python2.7/site-packages/gurumate-2.8.6-py2.7.egg/gurumate/linux2/apt.py", "identifier": "get_installed_version", "docstring": "returns installed package version and None if package is not installed", "docstring_tokens": ["returns", "installed", "package", "version", "and", "None", "if", "package", "is", "not", "installed"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257765}
{"url": "https://github.com/edoburu/django-debugtools/blob/5c609c00fa9954330cd135fc62a1e18b8e7fea8a/debugtools/templatetags/debugtools_tags.py#L64-L83", "sha": "5c609c00fa9954330cd135fc62a1e18b8e7fea8a", "docstring_summary": "Print the entire template context", "language": "python", "parameters": "(self, context)", "return_statement": "return u''.join(text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "CONTEXT_TITLE", "]", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ")", ":", "arg_5", "=", "linebreaksbr", "(", "pformat_django_context_html", "(", "arg_4", ")", ")", "arg_6", "=", "pformat_dict_summary_html", "(", "arg_4", ")", "if", "len", "(", "arg_4", ")", "<=", "3", "and", "arg_5", ".", "count", "(", "'<br />'", ")", ">", "20", ":", "(", "arg_5", ",", "arg_6", ")", "=", "(", "arg_6", ",", "arg_5", ")", "arg_2", ".", "append", "(", "CONTEXT_BLOCK", ".", "format", "(", "style", "=", "PRE_STYLE", ",", "num", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", ")", "return", "u''", ".", "join", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Print the entire template context\n        \"\"\"\n        arg_2 = [CONTEXT_TITLE]\n        for arg_3, arg_4 in enumerate(arg_1):\n            arg_5 = linebreaksbr(pformat_django_context_html(arg_4))\n            arg_6 = pformat_dict_summary_html(arg_4)\n\n            # Collapse long objects by default (e.g. request, LANGUAGES and sql_queries)\n            if len(arg_4) <= 3 and arg_5.count('<br />') > 20:\n                (arg_5, arg_6) = (arg_6, arg_5)\n\n            arg_2.append(CONTEXT_BLOCK.format(\n                style=PRE_STYLE,\n                num=arg_3,\n                arg_5=arg_5,\n                arg_6=arg_6\n            ))\n        return u''.join(arg_2)", "path": "debugtools/templatetags/debugtools_tags.py", "identifier": "PrintNode.print_context", "docstring": "Print the entire template context", "docstring_tokens": ["Print", "the", "entire", "template", "context"], "nwo": "edoburu/django-debugtools", "score": 0.28520508084306634, "idx": 257766}
{"url": "https://github.com/Numergy/yoda/blob/109f0e9441130488b0155f05883ef6531cf46ee9/yoda/workspace.py#L49-L55", "sha": "109f0e9441130488b0155f05883ef6531cf46ee9", "docstring_summary": "Remove workspace from config file.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "(", "arg_0", ".", "exists", "(", "arg_1", ")", ")", ":", "raise", "ValueError", "(", "\"Workspace `%s` doesn't exists.\"", "%", "arg_1", ")", "arg_0", ".", "config", "[", "\"workspaces\"", "]", ".", "pop", "(", "arg_1", ",", "0", ")", "arg_0", ".", "config", ".", "write", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove workspace from config file.\"\"\"\n        if not (arg_0.exists(arg_1)):\n            raise ValueError(\"Workspace `%s` doesn't exists.\" % arg_1)\n\n        arg_0.config[\"workspaces\"].pop(arg_1, 0)\n        arg_0.config.write()", "path": "yoda/workspace.py", "identifier": "Workspace.remove", "docstring": "Remove workspace from config file.", "docstring_tokens": ["Remove", "workspace", "from", "config", "file", "."], "nwo": "Numergy/yoda", "score": 0.1832591465193378, "idx": 257767}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/neurommsig/cli.py#L20-L43", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Convert the Alzheimer's and Parkinson's disease NeuroMMSig excel sheets to BEL.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "INFO", ")", "log", ".", "setLevel", "(", "logging", ".", "INFO", ")", "arg_0", "=", "get_bms_base", "(", ")", "arg_1", "=", "get_neurommsig_base", "(", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "'resources'", ",", "'excels'", ",", "'neurommsig'", ")", "arg_3", "=", "get_nift_values", "(", ")", "log", ".", "info", "(", "'Starting Alzheimers'", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'alzheimers'", ",", "'alzheimers.xlsx'", ")", "arg_5", "=", "preprocess", "(", "arg_4", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'aetionomy'", ",", "'alzheimers'", ",", "'neurommsigdb_ad.bel'", ")", ",", "'w'", ")", "as", "ad_file", ":", "write_neurommsig_bel", "(", "ad_file", ",", "arg_5", ",", "mesh_alzheimer", ",", "arg_3", ")", "log", ".", "info", "(", "'Starting Parkinsons'", ")", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'parkinsons'", ",", "'parkinsons.xlsx'", ")", "arg_7", "=", "preprocess", "(", "arg_6", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'aetionomy'", ",", "'parkinsons'", ",", "'neurommsigdb_pd.bel'", ")", ",", "'w'", ")", "as", "pd_file", ":", "write_neurommsig_bel", "(", "pd_file", ",", "arg_7", ",", "mesh_parkinson", ",", "arg_3", ")"], "function": "def Func():\n    \"\"\"Convert the Alzheimer's and Parkinson's disease NeuroMMSig excel sheets to BEL.\"\"\"\n    logging.basicConfig(level=logging.INFO)\n    log.setLevel(logging.INFO)\n\n    arg_0 = get_bms_base()\n    arg_1 = get_neurommsig_base()\n    arg_2 = os.path.join(arg_1, 'resources', 'excels', 'neurommsig')\n\n    arg_3 = get_nift_values()\n\n    log.info('Starting Alzheimers')\n\n    arg_4 = os.path.join(arg_2, 'alzheimers', 'alzheimers.xlsx')\n    arg_5 = preprocess(arg_4)\n    with open(os.path.join(arg_0, 'aetionomy', 'alzheimers', 'neurommsigdb_ad.bel'), 'w') as ad_file:\n        write_neurommsig_bel(ad_file, arg_5, mesh_alzheimer, arg_3)\n\n    log.info('Starting Parkinsons')\n\n    arg_6 = os.path.join(arg_2, 'parkinsons', 'parkinsons.xlsx')\n    arg_7 = preprocess(arg_6)\n    with open(os.path.join(arg_0, 'aetionomy', 'parkinsons', 'neurommsigdb_pd.bel'), 'w') as pd_file:\n        write_neurommsig_bel(pd_file, arg_7, mesh_parkinson, arg_3)", "path": "src/pybel_tools/analysis/neurommsig/cli.py", "identifier": "main", "docstring": "Convert the Alzheimer's and Parkinson's disease NeuroMMSig excel sheets to BEL.", "docstring_tokens": ["Convert", "the", "Alzheimer", "s", "and", "Parkinson", "s", "disease", "NeuroMMSig", "excel", "sheets", "to", "BEL", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257768}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/layers/distribution_layer.py#L1451-L1477", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Number of `params` needed to create a `MixtureSameFamily` distribution.", "language": "python", "parameters": "(num_components, component_params_size, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_2", ",", "'MixtureSameFamily_Func'", ",", "[", "arg_0", ",", "arg_1", "]", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_2", "=", "'num_components'", ",", "dtype_hint", "=", "tf", ".", "int32", ")", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "arg_2", "=", "'component_Func'", ")", "arg_0", "=", "dist_util", ".", "prefer_static_value", "(", "arg_0", ")", "arg_1", "=", "dist_util", ".", "prefer_static_value", "(", "arg_1", ")", "return", "arg_0", "+", "arg_0", "*", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Number of `params` needed to create a `MixtureSameFamily` distribution.\n\n    Arguments:\n      num_components: Number of component distributions in the mixture\n        distribution.\n      component_Func: Number of parameters needed to create a single\n        component distribution.\n      name: The name to use for the op to compute the number of parameters\n        (if such an op needs to be created).\n\n    Returns:\n     Func: The number of parameters needed to create the mixture\n       distribution.\n    \"\"\"\n    with tf.compat.v1.name_scope(arg_2, 'MixtureSameFamily_Func',\n                                 [arg_0, arg_1]):\n      arg_0 = tf.convert_to_tensor(\n          value=arg_0, arg_2='num_components', dtype_hint=tf.int32)\n      arg_1 = tf.convert_to_tensor(\n          value=arg_1, arg_2='component_Func')\n\n      arg_0 = dist_util.prefer_static_value(arg_0)\n      arg_1 = dist_util.prefer_static_value(\n          arg_1)\n\n      return arg_0 + arg_0 * arg_1", "path": "tensorflow_probability/python/layers/distribution_layer.py", "identifier": "MixtureSameFamily.params_size", "docstring": "Number of `params` needed to create a `MixtureSameFamily` distribution.\n\n    Arguments:\n      num_components: Number of component distributions in the mixture\n        distribution.\n      component_params_size: Number of parameters needed to create a single\n        component distribution.\n      name: The name to use for the op to compute the number of parameters\n        (if such an op needs to be created).\n\n    Returns:\n     params_size: The number of parameters needed to create the mixture\n       distribution.", "docstring_tokens": ["Number", "of", "params", "needed", "to", "create", "a", "MixtureSameFamily", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257769}
{"url": "https://github.com/synw/gencharts/blob/fa35604a9445b399bb4f91bc91af488e8e8208fd/gencharts/__init__.py#L89-L100", "sha": "fa35604a9445b399bb4f91bc91af488e8e8208fd", "docstring_summary": "Patch the Altair generated json to the newest Vega Lite spec", "language": "python", "parameters": "(self, json_data)", "return_statement": "return json.dumps(json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_1", ")", "arg_1", "[", "\"$schema\"", "]", "=", "\"https://vega.github.io/schema/vega-lite/2.0.0-beta.15.json\"", "arg_1", "[", "\"width\"", "]", "=", "arg_1", "[", "\"config\"", "]", "[", "\"cell\"", "]", "[", "\"width\"", "]", "arg_1", "[", "\"height\"", "]", "=", "arg_1", "[", "\"config\"", "]", "[", "\"cell\"", "]", "[", "\"height\"", "]", "del", "(", "arg_1", "[", "\"config\"", "]", "[", "\"cell\"", "]", ")", "return", "json", ".", "dumps", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Patch the Altair generated json to the newest Vega Lite spec\n        \"\"\"\n        arg_1 = json.loads(arg_1)\n        # add schema\n        arg_1[\"$schema\"] = \"https://vega.github.io/schema/vega-lite/2.0.0-beta.15.json\"\n        # add top level width and height\n        arg_1[\"width\"] = arg_1[\"config\"][\"cell\"][\"width\"]\n        arg_1[\"height\"] = arg_1[\"config\"][\"cell\"][\"height\"]\n        del(arg_1[\"config\"][\"cell\"])\n        return json.dumps(arg_1)", "path": "gencharts/__init__.py", "identifier": "ChartsGenerator._patch_json", "docstring": "Patch the Altair generated json to the newest Vega Lite spec", "docstring_tokens": ["Patch", "the", "Altair", "generated", "json", "to", "the", "newest", "Vega", "Lite", "spec"], "nwo": "synw/gencharts", "score": 0.12050106452410352, "idx": 257770}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/cov/_sum.py#L57-L70", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Sum of covariance function derivatives.", "language": "python", "parameters": "(self)", "return_statement": "return grad", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_0", ".", "_covariances", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "Func", "(", ")", ".", "items", "(", ")", ":", "arg_1", "[", "f\"{self._name}[{i}].{varname}\"", "]", "=", "arg_5", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Sum of covariance function derivatives.\n\n        Returns\n        -------\n        dict\n            \u2202K\u2080 + \u2202K\u2081 + \u22ef\n        \"\"\"\n        arg_1 = {}\n        for arg_2, arg_3 in enumerate(arg_0._covariances):\n            for arg_4, arg_5 in arg_3.Func().items():\n                arg_1[f\"{self._name}[{i}].{varname}\"] = arg_5\n        return arg_1", "path": "glimix_core/cov/_sum.py", "identifier": "SumCov.gradient", "docstring": "Sum of covariance function derivatives.\n\n        Returns\n        -------\n        dict\n            \u2202K\u2080 + \u2202K\u2081 + \u22ef", "docstring_tokens": ["Sum", "of", "covariance", "function", "derivatives", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 257771}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L310-L318", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Indicates the start of a new sequence. Clears any predictions and makes sure\n    synapses don't grow to the currently active cells in the next time step.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "activeCells", "=", "[", "]", "arg_0", ".", "winnerCells", "=", "[", "]", "arg_0", ".", "activeSegments", "=", "[", "]", "arg_0", ".", "matchingSegments", "=", "[", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Indicates the start of a new sequence. Clears any predictions and makes sure\n    synapses don't grow to the currently active cells in the next time step.\n    \"\"\"\n    arg_0.activeCells = []\n    arg_0.winnerCells = []\n    arg_0.activeSegments = []\n    arg_0.matchingSegments = []", "path": "src/nupic/algorithms/temporal_memory.py", "identifier": "TemporalMemory.reset", "docstring": "Indicates the start of a new sequence. Clears any predictions and makes sure\n    synapses don't grow to the currently active cells in the next time step.", "docstring_tokens": ["Indicates", "the", "start", "of", "a", "new", "sequence", ".", "Clears", "any", "predictions", "and", "makes", "sure", "synapses", "don", "t", "grow", "to", "the", "currently", "active", "cells", "in", "the", "next", "time", "step", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257772}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamsasl.py#L182-L201", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle successful authentication.", "language": "python", "parameters": "(self, stream, success)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "_check_authorization", "(", "arg_2", ".", "properties", ",", "arg_1", ")", ":", "arg_3", "=", "ElementTree", ".", "Element", "(", "FAILURE_TAG", ")", "ElementTree", ".", "SubElement", "(", "arg_3", ",", "SASL_QNP", "+", "\"invalid-authzid\"", ")", "return", "True", "arg_4", "=", "arg_2", ".", "properties", ".", "get", "(", "\"authzid\"", ")", "if", "arg_4", ":", "arg_5", "=", "JID", "(", "arg_2", ".", "authzid", ")", "elif", "\"username\"", "in", "arg_2", ".", "properties", ":", "arg_5", "=", "JID", "(", "arg_2", ".", "properties", "[", "\"username\"", "]", ",", "arg_1", ".", "me", ".", "domain", ")", "else", ":", "arg_5", "=", "None", "arg_1", ".", "set_peer_authenticated", "(", "arg_5", ",", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle successful authentication.\n\n        Send <success/> and mark the stream peer authenticated.\n\n        [receiver only]\n        \"\"\"\n        if not arg_0._check_authorization(arg_2.properties, arg_1):\n            arg_3 = ElementTree.Element(FAILURE_TAG)\n            ElementTree.SubElement(arg_3, SASL_QNP + \"invalid-authzid\")\n            return True\n        arg_4 = arg_2.properties.get(\"authzid\")\n        if arg_4:\n            arg_5 = JID(arg_2.authzid)\n        elif \"username\" in arg_2.properties:\n            arg_5 = JID(arg_2.properties[\"username\"], arg_1.me.domain)\n        else:\n            # anonymous\n            arg_5 = None\n        arg_1.set_peer_authenticated(arg_5, True)", "path": "pyxmpp2/streamsasl.py", "identifier": "StreamSASLHandler._handle_auth_success", "docstring": "Handle successful authentication.\n\n        Send <success/> and mark the stream peer authenticated.\n\n        [receiver only]", "docstring_tokens": ["Handle", "successful", "authentication", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257773}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/shell.py#L47-L56", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "give the user an ipython shell, optionally with an endpoint of choice.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "sregistry", ".", "main", "import", "get_client", "arg_1", "=", "get_client", "(", "arg_0", ".", "endpoint", ")", "arg_1", ".", "announce", "(", "arg_0", ".", "command", ")", "from", "IPython", "import", "embed", "embed", "(", ")"], "function": "def Func(arg_0):\n    '''give the user an Func shell, optionally with an endpoint of choice.\n    '''\n\n    # The client will announce itself (backend/database) unless it's get\n    from sregistry.main import get_client\n    arg_1 = get_client(arg_0.endpoint)\n    arg_1.announce(arg_0.command)\n    from IPython import embed\n    embed()", "path": "sregistry/client/shell.py", "identifier": "ipython", "docstring": "give the user an ipython shell, optionally with an endpoint of choice.", "docstring_tokens": ["give", "the", "user", "an", "ipython", "shell", "optionally", "with", "an", "endpoint", "of", "choice", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 257774}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_13_post_processing/main.py#L134-L147", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Explores different values of `I` and `tau_ref`.", "language": "python", "parameters": "(traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "'Adding exploration of I and tau_ref'", ")", "arg_1", "=", "{", "'neuron.I'", ":", "np", ".", "arange", "(", "0", ",", "1.01", ",", "0.01", ")", ".", "tolist", "(", ")", ",", "'neuron.tau_ref'", ":", "[", "5.0", ",", "7.5", ",", "10.0", "]", "}", "arg_1", "=", "cartesian_product", "(", "arg_1", ",", "(", "'neuron.tau_ref'", ",", "'neuron.I'", ")", ")", "arg_0", ".", "f_explore", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Explores different values of `I` and `tau_ref`.\"\"\"\n\n    print('Adding exploration of I and tau_ref')\n\n    arg_1 = {'neuron.I': np.arange(0, 1.01, 0.01).tolist(),\n                    'neuron.tau_ref': [5.0, 7.5, 10.0]}\n\n    arg_1 = cartesian_product(arg_1, ('neuron.tau_ref', 'neuron.I'))\n    # The second argument, the tuple, specifies the order of the cartesian product,\n    # The variable on the right most side changes fastest and defines the\n    # 'inner for-loop' of the cartesian product\n\n    arg_0.f_explore(arg_1)", "path": "examples/example_13_post_processing/main.py", "identifier": "add_exploration", "docstring": "Explores different values of `I` and `tau_ref`.", "docstring_tokens": ["Explores", "different", "values", "of", "I", "and", "tau_ref", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257775}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/transfer.py#L29-L75", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Convert transfer function filter parameters to zero-pole-gain form", "language": "python", "parameters": "(b,a)", "return_statement": "return z, p, g", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "numpy", "import", "roots", "assert", "len", "(", "arg_0", ")", "==", "len", "(", "arg_1", ")", ",", "\"length of the vectors a and b must be identical. fill with zeros if needed.\"", "arg_2", "=", "arg_0", "[", "0", "]", "/", "arg_1", "[", "0", "]", "arg_3", "=", "roots", "(", "arg_0", ")", "arg_4", "=", "roots", "(", "arg_1", ")", "return", "arg_3", ",", "arg_4", ",", "arg_2"], "function": "def Func(arg_0,arg_1):\n    \"\"\"Convert transfer function filter parameters to zero-pole-gain form\n\n    Find the zeros, poles, and gains of this continuous-time system:\n\n    .. warning:: b and a must have the same length.\n\n    ::\n\n    \n        from spectrum import Func\n        b = [2,3,0]\n        a = [1, 0.4, 1]\n        [z,p,k] = Func(b,a)          % Obtain zero-pole-gain form\n        z =\n            1.5\n            0\n        p =\n           -0.2000 + 0.9798i\n            -0.2000 - 0.9798i\n        k =\n           2\n\n    :param b: numerator\n    :param a: denominator\n    :param fill: If True, check that the length of a and b are the same. If not, create a copy of the shortest element and append zeros to it.\n    :return: z (zeros), p (poles), g (gain)\n\n\n    Convert transfer function f(x)=sum(b*x^n)/sum(a*x^n) to\n    zero-pole-gain form f(x)=g*prod(1-z*x)/prod(1-p*x)\n\n    .. todo:: See if tf2ss followed by ss2zp gives better results.  These\n        are available from the control system toolbox.  Note that\n        the control systems toolbox doesn't bother, but instead uses\n\n    .. seealso:: scipy.signal.Funck, which gives the same results but uses a different\n        algorithm (z^-1 instead of z).\n    \"\"\"\n    from numpy import roots\n    assert len(arg_0) == len(arg_1), \"length of the vectors a and b must be identical. fill with zeros if needed.\"\n\n    arg_2 = arg_0[0] / arg_1[0]\n    arg_3 = roots(arg_0)\n    arg_4 = roots(arg_1)\n\n    return arg_3, arg_4, arg_2", "path": "src/spectrum/transfer.py", "identifier": "tf2zp", "docstring": "Convert transfer function filter parameters to zero-pole-gain form\n\n    Find the zeros, poles, and gains of this continuous-time system:\n\n    .. warning:: b and a must have the same length.\n\n    ::\n\n    \n        from spectrum import tf2zp\n        b = [2,3,0]\n        a = [1, 0.4, 1]\n        [z,p,k] = tf2zp(b,a)          % Obtain zero-pole-gain form\n        z =\n            1.5\n            0\n        p =\n           -0.2000 + 0.9798i\n            -0.2000 - 0.9798i\n        k =\n           2\n\n    :param b: numerator\n    :param a: denominator\n    :param fill: If True, check that the length of a and b are the same. If not, create a copy of the shortest element and append zeros to it.\n    :return: z (zeros), p (poles), g (gain)\n\n\n    Convert transfer function f(x)=sum(b*x^n)/sum(a*x^n) to\n    zero-pole-gain form f(x)=g*prod(1-z*x)/prod(1-p*x)\n\n    .. todo:: See if tf2ss followed by ss2zp gives better results.  These\n        are available from the control system toolbox.  Note that\n        the control systems toolbox doesn't bother, but instead uses\n\n    .. seealso:: scipy.signal.tf2zpk, which gives the same results but uses a different\n        algorithm (z^-1 instead of z).", "docstring_tokens": ["Convert", "transfer", "function", "filter", "parameters", "to", "zero", "-", "pole", "-", "gain", "form"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 257776}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/github/queryManager.py#L480-L504", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Write the internal JSON data dictionary to a JSON data file.", "language": "python", "parameters": "(self, filePath=None, updatePath=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "filePath", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "print", "(", "\"Data file '%s' does not exist, will create new file.\"", "%", "(", "arg_1", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "split", "(", "arg_1", ")", "[", "0", "]", ")", ":", "os", ".", "makedirs", "(", "os", ".", "path", ".", "split", "(", "arg_1", ")", "[", "0", "]", ")", "arg_3", "=", "json", ".", "dumps", "(", "arg_0", ".", "data", ",", "indent", "=", "4", ",", "sort_keys", "=", "True", ")", "print", "(", "\"Writing to file '%s' ... \"", "%", "(", "arg_1", ")", ",", "end", "=", "\"\"", ",", "flush", "=", "True", ")", "with", "open", "(", "arg_1", ",", "\"w\"", ")", "as", "fileout", ":", "fileout", ".", "write", "(", "arg_3", ")", "print", "(", "\"Wrote file!\"", ")", "if", "arg_2", ":", "arg_0", ".", "filePath", "=", "arg_1"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"Write the internal JSON data dictionary to a JSON data file.\n\n        If no file path is provided, the stored data file path will be used.\n\n        Args:\n            filePath (Optional[str]): A relative or absolute path to a\n                '.json' file. Defaults to None.\n            updatePath (Optional[bool]): Specifies whether or not to update\n                the stored data file path. Defaults to False.\n\n        \"\"\"\n        if not arg_1:\n            arg_1 = arg_0.filePath\n        if not os.path.isfile(arg_1):\n            print(\"Data file '%s' does not exist, will create new file.\" % (arg_1))\n            if not os.path.exists(os.path.split(arg_1)[0]):\n                os.makedirs(os.path.split(arg_1)[0])\n        arg_3 = json.dumps(arg_0.data, indent=4, sort_keys=True)\n        print(\"Writing to file '%s' ... \" % (arg_1), end=\"\", flush=True)\n        with open(arg_1, \"w\") as fileout:\n            fileout.write(arg_3)\n        print(\"Wrote file!\")\n        if arg_2:\n            arg_0.filePath = arg_1", "path": "scraper/github/queryManager.py", "identifier": "DataManager.fileSave", "docstring": "Write the internal JSON data dictionary to a JSON data file.\n\n        If no file path is provided, the stored data file path will be used.\n\n        Args:\n            filePath (Optional[str]): A relative or absolute path to a\n                '.json' file. Defaults to None.\n            updatePath (Optional[bool]): Specifies whether or not to update\n                the stored data file path. Defaults to False.", "docstring_tokens": ["Write", "the", "internal", "JSON", "data", "dictionary", "to", "a", "JSON", "data", "file", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 257777}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L307-L320", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Adds new forwarding rules to a LoadBalancer.", "language": "python", "parameters": "(self, forwarding_rules)", "return_statement": "return self.get_data(\n            \"load_balancers/%s/forwarding_rules/\" % self.id,\n            type=POST,\n            params={\"forwarding_rules\": rules_dict}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "rule", ".", "__dict__", "for", "rule", "in", "arg_1", "]", "return", "arg_0", ".", "get_data", "(", "\"load_balancers/%s/forwarding_rules/\"", "%", "arg_0", ".", "id", ",", "type", "=", "POST", ",", "params", "=", "{", "\"forwarding_rules\"", ":", "arg_2", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adds new forwarding rules to a LoadBalancer.\n\n        Args:\n            forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects\n        \"\"\"\n        arg_2 = [rule.__dict__ for rule in arg_1]\n\n        return arg_0.get_data(\n            \"load_balancers/%s/forwarding_rules/\" % arg_0.id,\n            type=POST,\n            params={\"forwarding_rules\": arg_2}\n        )", "path": "digitalocean/LoadBalancer.py", "identifier": "LoadBalancer.add_forwarding_rules", "docstring": "Adds new forwarding rules to a LoadBalancer.\n\n        Args:\n            forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects", "docstring_tokens": ["Adds", "new", "forwarding", "rules", "to", "a", "LoadBalancer", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 257778}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/examples/music-v3.py#L92-L99", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Plays the previous song.", "language": "python", "parameters": "(self, ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "bot", ".", "lavalink", ".", "players", ".", "get", "(", "arg_1", ".", "guild", ".", "id", ")", "try", ":", "await", "arg_2", ".", "playFunc", "(", ")", "except", "lavalink", ".", "NoPreviousTrack", ":", "await", "arg_1", ".", "send", "(", "'There is no previous song to play.'", ")"], "function": "async def Func(arg_0, arg_1):\r\n        \"\"\" Plays the previous song. \"\"\"\r\n        arg_2 = arg_0.bot.lavalink.players.get(arg_1.guild.id)\r\n\r\n        try:\r\n            await arg_2.playFunc()\r\n        except lavalink.NoPreviousTrack:\r\n            await arg_1.send('There is no previous song to play.')", "path": "examples/music-v3.py", "identifier": "Music._previous", "docstring": "Plays the previous song.", "docstring_tokens": ["Plays", "the", "previous", "song", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 257779}
{"url": "https://github.com/redapple/parslepy/blob/a8bc4c0592824459629018c8f4c6ae3dad6cc3cc/parslepy/base.py#L182-L200", "sha": "a8bc4c0592824459629018c8f4c6ae3dad6cc3cc", "docstring_summary": "Create a Parselet instance from a file containing\n        the Parsley script as a JSON object", "language": "python", "parameters": "(cls, fp, selector_handler=None, strict=False, debug=False)", "return_statement": "return cls._from_jsonlines(fp,\n            selector_handler=selector_handler, strict=strict, debug=debug)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "return", "arg_0", ".", "_from_jsonlines", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False, arg_4=False):\n        \"\"\"\n        Create a Parselet instance from a file containing\n        the Parsley script as a JSON object\n\n        >>> import parslepy\n        >>> with open('parselet.json') as fp:\n        ...     parslepy.Parselet.Func(fp)\n        ...\n        <parslepy.base.Parselet object at 0x2014e50>\n\n        :param file fp: an open file-like pointer containing the Parsley script\n        :rtype: :class:`.Parselet`\n\n        Other arguments: same as for :class:`.Parselet` contructor\n        \"\"\"\n\n        return arg_0._from_jsonlines(arg_1,\n            arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "parslepy/base.py", "identifier": "Parselet.from_jsonfile", "docstring": "Create a Parselet instance from a file containing\n        the Parsley script as a JSON object\n\n        >>> import parslepy\n        >>> with open('parselet.json') as fp:\n        ...     parslepy.Parselet.from_jsonfile(fp)\n        ...\n        <parslepy.base.Parselet object at 0x2014e50>\n\n        :param file fp: an open file-like pointer containing the Parsley script\n        :rtype: :class:`.Parselet`\n\n        Other arguments: same as for :class:`.Parselet` contructor", "docstring_tokens": ["Create", "a", "Parselet", "instance", "from", "a", "file", "containing", "the", "Parsley", "script", "as", "a", "JSON", "object"], "nwo": "redapple/parslepy", "score": 0.18261785916548806, "idx": 257780}
{"url": "https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L309-L363", "sha": "768565deb10467d04a960d27e000ab38b7aa8a62", "docstring_summary": "Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models.\n    \n    This function is currently incomplete.", "language": "python", "parameters": "(mdr_instance)", "return_statement": "return fig", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", "set", "(", "[", "variables", "[", "0", "]", "for", "variables", "in", "arg_0", ".", "feature_map", "]", ")", ")", "arg_2", "=", "list", "(", "set", "(", "[", "variables", "[", "1", "]", "for", "variables", "in", "arg_0", ".", "feature_map", "]", ")", ")", "arg_3", "=", "np", ".", "array", "(", "list", "(", "arg_0", ".", "class_count_matrix", ".", "values", "(", ")", ")", ")", ".", "flatten", "(", ")", ".", "max", "(", ")", "\"\"\"    TODO:        - Add common axis labels        - Make sure this scales for smaller and larger record sizes        - Extend to 3-way+ models, e.g., http://4.bp.blogspot.com/-vgKCjEkWFUc/UPwPuHo6XvI/AAAAAAAAAE0/fORHqDcoikE/s1600/model.jpg    \"\"\"", "arg_4", ",", "arg_5", "=", "plt", ".", "subplots", "(", "ncols", "=", "len", "(", "arg_1", ")", ",", "nrows", "=", "len", "(", "arg_2", ")", ",", "sharey", "=", "True", ",", "sharex", "=", "True", ")", "arg_4", ".", "set_figwidth", "(", "6", ")", "arg_4", ".", "set_figheight", "(", "6", ")", "for", "(", "arg_6", ",", "arg_7", ")", "in", "itertools", ".", "product", "(", "arg_1", ",", "arg_2", ")", ":", "arg_8", "=", "arg_0", ".", "class_count_matrix", "[", "(", "arg_6", ",", "arg_7", ")", "]", "arg_9", "=", "arg_5", "[", "arg_2", ".", "index", "(", "arg_7", ")", "]", "[", "arg_1", ".", "index", "(", "arg_6", ")", "]", "arg_9", ".", "set_yticks", "(", "[", "]", ")", "arg_9", ".", "set_xticks", "(", "[", "]", ")", "arg_9", ".", "set_ylim", "(", "0", ",", "arg_3", "*", "1.5", ")", "arg_9", ".", "set_xlim", "(", "-", "0.5", ",", "1.5", ")", "if", "arg_2", ".", "index", "(", "arg_7", ")", "==", "0", ":", "arg_9", ".", "set_title", "(", "'X1 = {}'", ".", "format", "(", "arg_6", ")", ",", "fontsize", "=", "12", ")", "if", "arg_1", ".", "index", "(", "arg_6", ")", "==", "0", ":", "arg_9", ".", "set_ylabel", "(", "'X2 = {}'", ".", "format", "(", "arg_7", ")", ",", "fontsize", "=", "12", ")", "arg_10", "=", "arg_9", ".", "bar", "(", "left", "=", "range", "(", "arg_8", ".", "shape", "[", "0", "]", ")", ",", "height", "=", "arg_8", ",", "width", "=", "0.5", ",", "color", "=", "'black'", ",", "align", "=", "'center'", ")", "arg_11", "=", "'lightgrey'", "if", "arg_0", ".", "feature_map", "[", "(", "arg_6", ",", "arg_7", ")", "]", "==", "0", "else", "'darkgrey'", "arg_9", ".", "set_axis_bgcolor", "(", "arg_11", ")", "for", "arg_12", ",", "arg_13", "in", "enumerate", "(", "arg_10", ")", ":", "arg_9", ".", "text", "(", "arg_12", ",", "arg_8", "[", "arg_12", "]", "+", "(", "arg_3", "*", "0.1", ")", ",", "arg_8", "[", "arg_12", "]", ",", "ha", "=", "'center'", ")", "arg_4", ".", "tight_layout", "(", ")", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models.\n    \n    This function is currently incomplete.\n\n    Parameters\n    ----------\n    mdr_instance: object\n        A fitted instance of the MDR type to visualize.\n\n    Returns\n    ----------\n    fig: matplotlib.figure\n        Figure object for the visualized MDR grid.\n\n    \"\"\"\n    arg_1 = list(set([variables[0] for variables in arg_0.feature_map]))\n    arg_2 = list(set([variables[1] for variables in arg_0.feature_map]))\n    arg_3 = np.array(list(arg_0.class_count_matrix.values())).flatten().max()\n\n    \"\"\"\n    TODO:\n        - Add common axis labels\n        - Make sure this scales for smaller and larger record sizes\n        - Extend to 3-way+ models, e.g., http://4.bp.blogspot.com/-vgKCjEkWFUc/UPwPuHo6XvI/AAAAAAAAAE0/fORHqDcoikE/s1600/model.jpg\n    \"\"\"\n\n    arg_4, arg_5 = plt.subplots(ncols=len(arg_1), nrows=len(arg_2), sharey=True, sharex=True)\n    arg_4.set_figwidth(6)\n    arg_4.set_figheight(6)\n\n    for (arg_6, arg_7) in itertools.product(arg_1, arg_2):\n        arg_8 = arg_0.class_count_matrix[(arg_6, arg_7)]\n        arg_9 = arg_5[arg_2.index(arg_7)][arg_1.index(arg_6)]\n        arg_9.set_yticks([])\n        arg_9.set_xticks([])\n        arg_9.set_ylim(0, arg_3 * 1.5)\n        arg_9.set_xlim(-0.5, 1.5)\n\n        if arg_2.index(arg_7) == 0:\n            arg_9.set_title('X1 = {}'.format(arg_6), fontsize=12)\n        if arg_1.index(arg_6) == 0:\n            arg_9.set_ylabel('X2 = {}'.format(arg_7), fontsize=12)\n\n        arg_10 = arg_9.bar(left=range(arg_8.shape[0]),\n                         height=arg_8, width=0.5,\n                         color='black', align='center')\n\n        arg_11 = 'lightgrey' if arg_0.feature_map[(arg_6, arg_7)] == 0 else 'darkgrey'\n        arg_9.set_axis_bgcolor(arg_11)\n        for arg_12, arg_13 in enumerate(arg_10):\n            arg_9.text(arg_12, arg_8[arg_12] + (arg_3 * 0.1), arg_8[arg_12], ha='center')\n\n    arg_4.tight_layout()\n    return arg_4", "path": "mdr/utils/utils.py", "identifier": "plot_mdr_grid", "docstring": "Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models.\n    \n    This function is currently incomplete.\n\n    Parameters\n    ----------\n    mdr_instance: object\n        A fitted instance of the MDR type to visualize.\n\n    Returns\n    ----------\n    fig: matplotlib.figure\n        Figure object for the visualized MDR grid.", "docstring_tokens": ["Visualizes", "the", "MDR", "grid", "of", "a", "given", "fitted", "MDR", "instance", ".", "Only", "works", "for", "2", "-", "way", "MDR", "models", ".", "This", "function", "is", "currently", "incomplete", "."], "nwo": "EpistasisLab/scikit-mdr", "score": 0.36572091509454285, "idx": 257781}
{"url": "https://github.com/acristoffers/ahio/blob/5d47f1697c173bd1cbdeac930546f97ad8570a38/ahio/abstract_driver.py#L418-L444", "sha": "5d47f1697c173bd1cbdeac930546f97ad8570a38", "docstring_summary": "Sets PWM frequency, if supported by hardware", "language": "python", "parameters": "(self, frequency, pin=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_0", ".", "_Func", "(", "arg_1", ",", "None", ")", "else", ":", "arg_3", "=", "arg_0", ".", "_pin_mapping", ".", "get", "(", "arg_2", ",", "None", ")", "if", "arg_3", ":", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_3", ")", "else", ":", "raise", "KeyError", "(", "'Requested pin is not mapped: %s'", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Sets PWM frequency, if supported by hardware\n\n        If the driver supports per pin frequency setting, set pin to the\n        desired frequency. If not, passing None means set to all. If only per\n        pin frequency is supported and pin is None, raise RuntimeError.\n\n        If you're developing a driver, implement\n        _Func(self, frequency, pin). Raise RuntimeError if pin\n        was set but is not supported by the platform.\n\n        @arg frequency pwm frequency to be set, in Hz\n        @arg pin if the the driver supports it, the pin that will use\n            `frequency` as pwm frequency. None for all/global.\n\n        @throw RuntimeError if pin is None on a per pin only hardware, or if\n            it's a valid pin on a global only hardware.\n        @throw KeyError if pin isn't mapped.\n        \"\"\"\n        if arg_2 is None:\n            arg_0._Func(arg_1, None)\n        else:\n            arg_3 = arg_0._pin_mapping.get(arg_2, None)\n            if arg_3:\n                arg_0._Func(arg_1, arg_3)\n            else:\n                raise KeyError('Requested pin is not mapped: %s' % arg_2)", "path": "ahio/abstract_driver.py", "identifier": "AbstractDriver.set_pwm_frequency", "docstring": "Sets PWM frequency, if supported by hardware\n\n        If the driver supports per pin frequency setting, set pin to the\n        desired frequency. If not, passing None means set to all. If only per\n        pin frequency is supported and pin is None, raise RuntimeError.\n\n        If you're developing a driver, implement\n        _set_pwm_frequency(self, frequency, pin). Raise RuntimeError if pin\n        was set but is not supported by the platform.\n\n        @arg frequency pwm frequency to be set, in Hz\n        @arg pin if the the driver supports it, the pin that will use\n            `frequency` as pwm frequency. None for all/global.\n\n        @throw RuntimeError if pin is None on a per pin only hardware, or if\n            it's a valid pin on a global only hardware.\n        @throw KeyError if pin isn't mapped.", "docstring_tokens": ["Sets", "PWM", "frequency", "if", "supported", "by", "hardware"], "nwo": "acristoffers/ahio", "score": 0.21302904236143622, "idx": 257782}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L117-L134", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Returns the .tests list of taxa as a pandas dataframe. \n        By auto-generating this table from tests it means that \n        the table itself cannot be modified unless it is returned \n        and saved.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "tests", ":", "arg_1", "=", "sorted", "(", "arg_0", ".", "tests", "[", "0", "]", ".", "keys", "(", ")", ")", "if", "isinstance", "(", "arg_0", ".", "tests", ",", "list", ")", ":", "arg_2", "=", "[", "[", "(", "key", ",", "i", "[", "key", "]", ")", "for", "key", "in", "arg_1", "]", "for", "i", "in", "arg_0", ".", "tests", "]", "arg_3", "=", "[", "dict", "(", "i", ")", "for", "i", "in", "arg_2", "]", "arg_4", "=", "pd", ".", "DataFrame", "(", "arg_3", ")", "return", "arg_4", "else", ":", "return", "pd", ".", "DataFrame", "(", "pd", ".", "Series", "(", "arg_0", ".", "tests", ")", ")", ".", "T", "else", ":", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the .tests list of taxa as a pandas dataframe. \n        By auto-generating this table from tests it means that \n        the table itself cannot be modified unless it is returned \n        and saved. \n        \"\"\"\n        if arg_0.tests:\n            arg_1 = sorted(arg_0.tests[0].keys())\n            if isinstance(arg_0.tests, list):\n                arg_2 = [[(key, i[key]) for key in arg_1] for i in arg_0.tests]\n                arg_3 = [dict(i) for i in arg_2]\n                arg_4 = pd.DataFrame(arg_3)\n                return arg_4\n            else:\n                return pd.DataFrame(pd.Series(arg_0.tests)).T\n        else:\n            return None", "path": "ipyrad/analysis/baba.py", "identifier": "Baba.taxon_table", "docstring": "Returns the .tests list of taxa as a pandas dataframe. \n        By auto-generating this table from tests it means that \n        the table itself cannot be modified unless it is returned \n        and saved.", "docstring_tokens": ["Returns", "the", ".", "tests", "list", "of", "taxa", "as", "a", "pandas", "dataframe", ".", "By", "auto", "-", "generating", "this", "table", "from", "tests", "it", "means", "that", "the", "table", "itself", "cannot", "be", "modified", "unless", "it", "is", "returned", "and", "saved", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 257783}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L414-L425", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Get, cache, and return the curves supported by OpenSSL.", "language": "python", "parameters": "(cls, lib)", "return_statement": "return cls._curves", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_curves", "is", "None", ":", "arg_0", ".", "_curves", "=", "arg_0", ".", "_load_elliptic_curves", "(", "arg_1", ")", "return", "arg_0", ".", "_curves"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get, cache, and return the curves supported by OpenSSL.\n\n        :param lib: The OpenSSL library binding object.\n\n        :return: A :py:type:`set` of ``cls`` instances giving the names of the\n            elliptic curves the underlying library supports.\n        \"\"\"\n        if arg_0._curves is None:\n            arg_0._curves = arg_0._load_elliptic_curves(arg_1)\n        return arg_0._curves", "path": "src/OpenSSL/crypto.py", "identifier": "_EllipticCurve._get_elliptic_curves", "docstring": "Get, cache, and return the curves supported by OpenSSL.\n\n        :param lib: The OpenSSL library binding object.\n\n        :return: A :py:type:`set` of ``cls`` instances giving the names of the\n            elliptic curves the underlying library supports.", "docstring_tokens": ["Get", "cache", "and", "return", "the", "curves", "supported", "by", "OpenSSL", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 257784}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1851-L1913", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "getMultipleOnlyFields - Gets only certain fields from a list of  primary keys. For working on entire filter set, see allOnlyFields", "language": "python", "parameters": "(self, pks, fields, cascadeFetch=False)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "if", "type", "(", "arg_1", ")", "==", "set", ":", "arg_1", "=", "list", "(", "arg_1", ")", "if", "len", "(", "arg_1", ")", "==", "1", ":", "return", "IRQueryableList", "(", "[", "arg_0", ".", "getOnlyFields", "(", "arg_1", "[", "0", "]", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "]", ",", "mdl", "=", "arg_0", ".", "mdl", ")", "arg_4", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_5", "=", "arg_4", ".", "pipeline", "(", ")", "for", "arg_6", "in", "arg_1", ":", "arg_7", "=", "arg_0", ".", "_get_key_for_id", "(", "arg_6", ")", "arg_5", ".", "hmget", "(", "arg_7", ",", "arg_2", ")", "arg_8", "=", "arg_5", ".", "execute", "(", ")", "arg_9", "=", "IRQueryableList", "(", "mdl", "=", "arg_0", ".", "mdl", ")", "arg_10", "=", "len", "(", "arg_1", ")", "arg_11", "=", "0", "arg_12", "=", "len", "(", "arg_2", ")", "while", "arg_11", "<", "arg_10", ":", "arg_13", "=", "{", "}", "arg_14", "=", "False", "arg_15", "=", "arg_8", "[", "arg_11", "]", "if", "arg_15", "is", "None", "or", "type", "(", "arg_15", ")", "!=", "list", ":", "arg_9", ".", "append", "(", "None", ")", "arg_11", "+=", "1", "continue", "arg_16", "=", "0", "while", "arg_16", "<", "arg_12", ":", "arg_13", "[", "arg_2", "[", "arg_16", "]", "]", "=", "arg_15", "[", "arg_16", "]", "if", "arg_15", "[", "arg_16", "]", "!=", "None", ":", "arg_14", "=", "True", "arg_16", "+=", "1", "if", "arg_14", "is", "False", ":", "arg_9", ".", "append", "(", "None", ")", "arg_11", "+=", "1", "continue", "arg_13", "[", "'_id'", "]", "=", "arg_1", "[", "arg_11", "]", "arg_17", "=", "arg_0", ".", "_redisResultToObj", "(", "arg_13", ")", "arg_9", ".", "append", "(", "arg_17", ")", "arg_11", "+=", "1", "if", "arg_3", "is", "True", ":", "for", "arg_17", "in", "arg_9", ":", "arg_0", ".", "_doCascadeFetch", "(", "arg_17", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n\t\t'''\n\t\t\tFunc - Gets only certain fields from a list of  primary keys. For working on entire filter set, see allOnlyFields\n\n\t\t\t@param pks list<str> - Primary Keys\n\n\t\t\t@param fields list<str> - List of fields\n\n\n\t\t\t@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model\n\t\t\t   will be fetched immediately. If False, foreign objects will be fetched on-access.\n\n\t\t\treturn - List of partial objects with only fields applied\n\t\t'''\n\t\tif type(arg_1) == set:\n\t\t\targ_1 = list(arg_1)\n\n\t\tif len(arg_1) == 1:\n\t\t\treturn IRQueryableList([arg_0.getOnlyFields(arg_1[0], arg_2, arg_3=arg_3)], mdl=arg_0.mdl)\n\n\t\targ_4 = arg_0._get_connection()\n\t\targ_5 = arg_4.pipeline()\n\n\t\tfor arg_6 in arg_1:\n\t\t\targ_7 = arg_0._get_key_for_id(arg_6)\n\t\t\targ_5.hmget(arg_7, arg_2)\n\n\t\targ_8 = arg_5.execute()\n\t\targ_9 = IRQueryableList(mdl=arg_0.mdl)\n\t\targ_10 = len(arg_1)\n\t\targ_11 = 0\n\t\targ_12 = len(arg_2)\n\t\twhile arg_11 < arg_10:\n\t\t\targ_13 = {}\n\t\t\targ_14 = False\n\t\t\targ_15 = arg_8[arg_11]\n\t\t\tif arg_15 is None or type(arg_15) != list:\n\t\t\t\targ_9.append(None)\n\t\t\t\targ_11 += 1\n\t\t\t\tcontinue\n\n\t\t\targ_16 = 0\n\t\t\twhile arg_16 < arg_12:\n\t\t\t\targ_13[arg_2[arg_16]] = arg_15[arg_16]\n\t\t\t\tif arg_15[arg_16] != None:\n\t\t\t\t\targ_14 = True\n\t\t\t\targ_16 += 1\n\n\t\t\tif arg_14 is False:\n\t\t\t\targ_9.append(None)\n\t\t\t\targ_11 += 1\n\t\t\t\tcontinue\n\n\t\t\targ_13['_id'] = arg_1[arg_11]\n\t\t\targ_17 = arg_0._redisResultToObj(arg_13)\n\t\t\targ_9.append(arg_17)\n\t\t\targ_11 += 1\n\n\t\tif arg_3 is True:\n\t\t\tfor arg_17 in arg_9:\n\t\t\t\targ_0._doCascadeFetch(arg_17)\n\t\t\t\n\t\treturn arg_9", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisQuery.getMultipleOnlyFields", "docstring": "getMultipleOnlyFields - Gets only certain fields from a list of  primary keys. For working on entire filter set, see allOnlyFields\n\n\t\t\t@param pks list<str> - Primary Keys\n\n\t\t\t@param fields list<str> - List of fields\n\n\n\t\t\t@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model\n\t\t\t   will be fetched immediately. If False, foreign objects will be fetched on-access.\n\n\t\t\treturn - List of partial objects with only fields applied", "docstring_tokens": ["getMultipleOnlyFields", "-", "Gets", "only", "certain", "fields", "from", "a", "list", "of", "primary", "keys", ".", "For", "working", "on", "entire", "filter", "set", "see", "allOnlyFields"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 257785}
{"url": "https://github.com/adrianoveiga/django-media-fixtures/blob/a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54/django_media_fixtures/finders.py#L82-L89", "sha": "a3f0d9ac84e73d491eeb0c881b23cc47ccca1b54", "docstring_summary": "List all files in all locations.", "language": "python", "parameters": "(self, ignore_patterns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "locations", ":", "arg_4", "=", "arg_0", ".", "storages", "[", "arg_3", "]", "for", "arg_5", "in", "utils", ".", "get_files", "(", "arg_4", ",", "arg_1", ")", ":", "yield", "arg_5", ",", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        List all files in all locations.\n        \"\"\"\n        for arg_2, arg_3 in arg_0.locations:\n            arg_4 = arg_0.storages[arg_3]\n            for arg_5 in utils.get_files(arg_4, arg_1):\n                yield arg_5, arg_4", "path": "django_media_fixtures/finders.py", "identifier": "FileSystemFinder.list", "docstring": "List all files in all locations.", "docstring_tokens": ["List", "all", "files", "in", "all", "locations", "."], "nwo": "adrianoveiga/django-media-fixtures", "score": 0.2845436920530269, "idx": 257786}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L802-L821", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Upload files to S3.\n       This function can handle multiple file upload if source is a list.\n       Also, it works for recursive mode which copy all files and keep the\n       directory structure under the given source directory.", "language": "python", "parameters": "(self, source, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "ThreadPool", "(", "ThreadUtil", ",", "arg_0", ".", "opt", ")", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", "=", "[", "arg_1", "]", "if", "arg_2", "[", "-", "1", "]", "==", "PATH_SEP", ":", "for", "arg_4", "in", "arg_1", ":", "arg_0", ".", "put_single_file", "(", "arg_3", ",", "arg_4", ",", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_0", ".", "get_basename", "(", "arg_4", ")", ")", ")", "else", ":", "if", "len", "(", "arg_1", ")", "==", "1", ":", "arg_0", ".", "put_single_file", "(", "arg_3", ",", "arg_1", "[", "0", "]", ",", "arg_2", ")", "else", ":", "raise", "Failure", "(", "'Target \"%s\" is not a directory (with a trailing slash).'", "%", "arg_2", ")", "arg_3", ".", "join", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''Upload files to S3.\n       This function can handle multiple file upload if source is a list.\n       Also, it works for recursive mode which copy all files and keep the\n       directory structure under the given source directory.\n    '''\n    arg_3 = ThreadPool(ThreadUtil, arg_0.opt)\n    if not isinstance(arg_1, list):\n      arg_1 = [arg_1]\n\n    if arg_2[-1] == PATH_SEP:\n      for arg_4 in arg_1:\n        arg_0.put_single_file(arg_3, arg_4, os.path.join(arg_2, arg_0.get_basename(arg_4)))\n    else:\n      if len(arg_1) == 1:\n        arg_0.put_single_file(arg_3, arg_1[0], arg_2)\n      else:\n        raise Failure('Target \"%s\" is not a directory (with a trailing slash).' % arg_2)\n\n    arg_3.join()", "path": "s4cmd.py", "identifier": "S3Handler.put_files", "docstring": "Upload files to S3.\n       This function can handle multiple file upload if source is a list.\n       Also, it works for recursive mode which copy all files and keep the\n       directory structure under the given source directory.", "docstring_tokens": ["Upload", "files", "to", "S3", ".", "This", "function", "can", "handle", "multiple", "file", "upload", "if", "source", "is", "a", "list", ".", "Also", "it", "works", "for", "recursive", "mode", "which", "copy", "all", "files", "and", "keep", "the", "directory", "structure", "under", "the", "given", "source", "directory", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 257787}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/connection.py#L607-L628", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Make a copy of the `data` object, preparing it to be sent to the server.", "language": "python", "parameters": "(data)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "None", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "viewitems", "(", "arg_0", ")", ":", "if", "arg_3", "is", "None", ":", "continue", "if", "isinstance", "(", "arg_3", ",", "list", ")", ":", "arg_3", "=", "stringify_list", "(", "arg_3", ")", "elif", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "if", "\"__meta\"", "in", "arg_3", "and", "arg_3", "[", "\"__meta\"", "]", "[", "\"schema_name\"", "]", ".", "endswith", "(", "\"KeyV3\"", ")", ":", "arg_3", "=", "arg_3", "[", "\"name\"", "]", "else", ":", "arg_3", "=", "stringify_dict", "(", "arg_3", ")", "else", ":", "arg_3", "=", "str", "(", "arg_3", ")", "arg_1", "[", "arg_2", "]", "=", "arg_3", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Make a copy of the `data` object, preparing it to be sent to the server.\n\n        The data will be sent via x-www-form-urlencoded or multipart/form-data mechanisms. Both of them work with\n        plain lists of key/value pairs, so this method converts the data into such format.\n        \"\"\"\n        if not arg_0: return None\n        arg_1 = {}\n        for arg_2, arg_3 in viewitems(arg_0):\n            if arg_3 is None: continue  # don't send args set to None so backend defaults take precedence\n            if isinstance(arg_3, list):\n                arg_3 = stringify_list(arg_3)\n            elif isinstance(arg_3, dict):\n                if \"__meta\" in arg_3 and arg_3[\"__meta\"][\"schema_name\"].endswith(\"KeyV3\"):\n                    arg_3 = arg_3[\"name\"]\n                else:\n                    arg_3 = stringify_dict(arg_3)\n            else:\n                arg_3 = str(arg_3)\n            arg_1[arg_2] = arg_3\n        return arg_1", "path": "h2o-py/h2o/backend/connection.py", "identifier": "H2OConnection._prepare_data_payload", "docstring": "Make a copy of the `data` object, preparing it to be sent to the server.\n\n        The data will be sent via x-www-form-urlencoded or multipart/form-data mechanisms. Both of them work with\n        plain lists of key/value pairs, so this method converts the data into such format.", "docstring_tokens": ["Make", "a", "copy", "of", "the", "data", "object", "preparing", "it", "to", "be", "sent", "to", "the", "server", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257788}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L110-L123", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Make the first column of the table non-breaking.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_1", "[", "0", "]", "[", "0", "]", "[", "-", "1", "]", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "arg_3", "[", "0", "]", "arg_5", "=", "arg_4", "[", "0", "]", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "list", "(", "arg_5", ")", ")", ":", "if", "isinstance", "(", "arg_7", ",", "nodes", ".", "Text", ")", ":", "arg_8", "=", "unicode", "(", "arg_7", ".", "astext", "(", ")", ")", "arg_8", "=", "arg_8", ".", "replace", "(", "u\" \"", ",", "u\"\\u00a0\"", ")", "arg_5", "[", "arg_6", "]", "=", "nodes", ".", "Text", "(", "arg_8", ")", "except", "IndexError", ":", "pass"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Make the first column of the table non-breaking.\"\"\"\n    try:\n        arg_2 = arg_1[0][0][-1]\n        for arg_3 in arg_2:\n            arg_4 = arg_3[0]\n            arg_5 = arg_4[0]\n            for arg_6, arg_7 in enumerate(list(arg_5)):\n                if isinstance(arg_7, nodes.Text):\n                    arg_8 = unicode(arg_7.astext())\n                    arg_8 = arg_8.replace(u\" \", u\"\\u00a0\")\n                    arg_5[arg_6] = nodes.Text(arg_8)\n    except IndexError:\n        pass", "path": "gui/doc/ext/autosummary/__init__.py", "identifier": "autosummary_table_visit_html", "docstring": "Make the first column of the table non-breaking.", "docstring_tokens": ["Make", "the", "first", "column", "of", "the", "table", "non", "-", "breaking", "."], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 257789}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/iaca.py#L40-L52", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Strip all labels, which are never referenced.", "language": "python", "parameters": "(asm_lines)", "return_statement": "return asm_stripped", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "re", ".", "match", "(", "r'^\\S+:'", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", "[", "0", ":", "arg_2", ".", "find", "(", "':'", ")", "]", "if", "not", "any", "(", "[", "re", ".", "match", "(", "r'^[^#]*\\s'", "+", "re", ".", "escape", "(", "arg_3", ")", "+", "'[\\s,]?.*$'", ",", "arg_4", ")", "for", "arg_4", "in", "arg_0", "]", ")", ":", "arg_2", "=", "''", "arg_1", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Strip all labels, which are never referenced.\"\"\"\n    arg_1 = []\n    for arg_2 in arg_0:\n        if re.match(r'^\\S+:', arg_2):\n            # Found label\n            arg_3 = arg_2[0:arg_2.find(':')]\n            # Search for references to current label\n            if not any([re.match(r'^[^#]*\\s' + re.escape(arg_3) + '[\\s,]?.*$', arg_4) for arg_4 in arg_0]):\n                # Skip labels without seen reference\n                arg_2 = ''\n        arg_1.append(arg_2)\n    return arg_1", "path": "kerncraft/iaca.py", "identifier": "strip_unreferenced_labels", "docstring": "Strip all labels, which are never referenced.", "docstring_tokens": ["Strip", "all", "labels", "which", "are", "never", "referenced", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 257790}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L231-L269", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Set metadata for an entity.", "language": "python", "parameters": "(self, entity_type, entity_id, metadata)", "return_statement": "return self._authenticated_request \\\n            .to_endpoint('{}/{}/metadata/'.format(entity_type, entity_id)) \\\n            .with_json_body(metadata) \\\n            .return_body() \\\n            .post()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "is_valid_uuid", "(", "arg_2", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for entity_id: {0}'", ".", "format", "(", "arg_2", ")", ")", "if", "not", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "raise", "StorageArgumentException", "(", "'The metadata was not provided as a '", "'dictionary'", ")", "return", "arg_0", ".", "_authenticated_request", ".", "to_endpoint", "(", "'{}/{}/metadata/'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", ".", "with_json_body", "(", "arg_3", ")", ".", "return_body", "(", ")", ".", "post", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''Set metadata for an entity.\n\n        Args:\n            entity_type (str): Type of the entity. Admitted values: ['project',\n                'folder', 'file'].\n            entity_id (str): The UUID of the entity to be modified.\n            metadata (dict): A dictionary of key/value pairs to be written as\n                metadata.\n\n        Warning:\n            It will replace all existing metadata with the provided dictionary.\n\n        Returns:\n            A dictionary of the updated metadata::\n\n                {\n                    u'bar': u'200',\n                    u'foo': u'100'\n                }\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes\n        '''\n        if not is_valid_uuid(arg_2):\n            raise StorageArgumentException(\n                'Invalid UUID for entity_id: {0}'.format(arg_2))\n        if not isinstance(arg_3, dict):\n            raise StorageArgumentException('The metadata was not provided as a '\n                                           'dictionary')\n\n        return arg_0._authenticated_request \\\n            .to_endpoint('{}/{}/metadata/'.format(arg_1, arg_2)) \\\n            .with_json_body(arg_3) \\\n            .return_body() \\\n            .post()", "path": "hbp_service_client/storage_service/api.py", "identifier": "ApiClient.set_metadata", "docstring": "Set metadata for an entity.\n\n        Args:\n            entity_type (str): Type of the entity. Admitted values: ['project',\n                'folder', 'file'].\n            entity_id (str): The UUID of the entity to be modified.\n            metadata (dict): A dictionary of key/value pairs to be written as\n                metadata.\n\n        Warning:\n            It will replace all existing metadata with the provided dictionary.\n\n        Returns:\n            A dictionary of the updated metadata::\n\n                {\n                    u'bar': u'200',\n                    u'foo': u'100'\n                }\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes", "docstring_tokens": ["Set", "metadata", "for", "an", "entity", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 257791}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/text.py#L153-L156", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "launch layouts display", "language": "python", "parameters": "(self, layout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "(", "file", "=", "arg_0", ".", "out", ")", "TextWriter", "(", ")", ".", "format", "(", "arg_1", ",", "arg_0", ".", "out", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"launch layouts display\"\"\"\n        print(file=arg_0.out)\n        TextWriter().format(arg_1, arg_0.out)", "path": "pylint/reporters/text.py", "identifier": "TextReporter._display", "docstring": "launch layouts display", "docstring_tokens": ["launch", "layouts", "display"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257792}
{"url": "https://github.com/sloria/aiohttp_utils/blob/e5b41452f8077e7d749715606b1560f4b50e3d71/aiohttp_utils/routing.py#L60-L77", "sha": "e5b41452f8077e7d749715606b1560f4b50e3d71", "docstring_summary": "Add routes by an resource instance's methods.", "language": "python", "parameters": "(self, path: str, resource, methods: tuple=tuple(), names: Mapping=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ",", "arg_4", ":", "arg_5", "=", "arg_5", "(", ")", ",", "arg_6", ":", "arg_7", "=", "None", ")", ":", "arg_6", "=", "arg_6", "or", "{", "}", "if", "arg_4", ":", "arg_8", "=", "arg_4", "else", ":", "arg_8", "=", "arg_0", ".", "HTTP_METHOD_NAMES", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "getattr", "(", "arg_3", ",", "arg_9", ",", "None", ")", "if", "arg_10", ":", "arg_11", "=", "arg_6", ".", "get", "(", "arg_9", ",", "arg_0", ".", "get_default_handler_name", "(", "arg_3", ",", "arg_9", ")", ")", "arg_0", ".", "add_route", "(", "arg_9", ".", "upper", "(", ")", ",", "arg_1", ",", "arg_10", ",", "arg_11", "=", "arg_11", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3, arg_4: arg_5=arg_5(), arg_6: arg_7=None):\n        \"\"\"Add routes by an resource instance's methods.\n\n        :param path: route path. Should be started with slash (``'/'``).\n        :param resource: A \"resource\" instance. May be an instance of a plain object.\n        :param methods: Methods (strings) to register.\n        :param names: Dictionary of ``name`` overrides.\n        \"\"\"\n        arg_6 = arg_6 or {}\n        if arg_4:\n            arg_8 = arg_4\n        else:\n            arg_8 = arg_0.HTTP_METHOD_NAMES\n        for arg_9 in arg_8:\n            arg_10 = getattr(arg_3, arg_9, None)\n            if arg_10:\n                arg_11 = arg_6.get(arg_9, arg_0.get_default_handler_name(arg_3, arg_9))\n                arg_0.add_route(arg_9.upper(), arg_1, arg_10, arg_11=arg_11)", "path": "aiohttp_utils/routing.py", "identifier": "ResourceRouter.add_resource_object", "docstring": "Add routes by an resource instance's methods.\n\n        :param path: route path. Should be started with slash (``'/'``).\n        :param resource: A \"resource\" instance. May be an instance of a plain object.\n        :param methods: Methods (strings) to register.\n        :param names: Dictionary of ``name`` overrides.", "docstring_tokens": ["Add", "routes", "by", "an", "resource", "instance", "s", "methods", "."], "nwo": "sloria/aiohttp_utils", "score": 0.1948383829821314, "idx": 257793}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/value.py#L30-L50", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Verify scrollbar is vertical", "language": "python", "parameters": "(self, window_name, object_name)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "_get_object_handle", "(", "arg_1", ",", "arg_2", ")", "if", "arg_3", ".", "AXOrientation", "==", "\"AXVerticalOrientation\"", ":", "return", "1", "except", ":", "pass", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Verify scrollbar is vertical\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: 1 on success.\n        @rtype: integer\n        \"\"\"\n        try:\n            arg_3 = arg_0._get_object_handle(arg_1, arg_2)\n            if arg_3.AXOrientation == \"AXVerticalOrientation\":\n                return 1\n        except:\n            pass\n        return 0", "path": "atomac/ldtpd/value.py", "identifier": "Value.verifyscrollbarvertical", "docstring": "Verify scrollbar is vertical\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: 1 on success.\n        @rtype: integer", "docstring_tokens": ["Verify", "scrollbar", "is", "vertical"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 257794}
{"url": "https://github.com/jgorset/django-kronos/blob/82ca16f5d499de3d34e0677e64ffab62d45424ce/kronos/__init__.py#L142-L150", "sha": "82ca16f5d499de3d34e0677e64ffab62d45424ce", "docstring_summary": "Uninstall tasks from cron.", "language": "python", "parameters": "()", "return_statement": "return count", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "crontab", ".", "CronTab", "(", "user", "=", "True", ")", "arg_1", "=", "len", "(", "list", "(", "arg_0", ".", "find_comment", "(", "KRONOS_BREADCRUMB", ")", ")", ")", "arg_0", ".", "remove_all", "(", "comment", "=", "KRONOS_BREADCRUMB", ")", "arg_0", ".", "write", "(", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"\n    Uninstall tasks from cron.\n    \"\"\"\n    arg_0 = crontab.CronTab(user=True)\n    arg_1 = len(list(arg_0.find_comment(KRONOS_BREADCRUMB)))\n    arg_0.remove_all(comment=KRONOS_BREADCRUMB)\n    arg_0.write()\n    return arg_1", "path": "kronos/__init__.py", "identifier": "uninstall", "docstring": "Uninstall tasks from cron.", "docstring_tokens": ["Uninstall", "tasks", "from", "cron", "."], "nwo": "jgorset/django-kronos", "score": 0.3475875463574958, "idx": 257795}
{"url": "https://github.com/ros-infrastructure/ros_buildfarm/blob/c63ad85b21470f3262086fcd987528a0efc0cf6d/ros_buildfarm/ci_job.py#L117-L206", "sha": "c63ad85b21470f3262086fcd987528a0efc0cf6d", "docstring_summary": "Configure a single Jenkins CI job.", "language": "python", "parameters": "(\n        config_url, rosdistro_name, ci_build_name,\n        os_name, os_code_name, arch,\n        config=None, build_file=None,\n        index=None, dist_file=None,\n        jenkins=None, views=None,\n        is_disabled=False,\n        groovy_script=None,\n        build_targets=None,\n        dry_run=False,\n        underlay_source_paths=None,\n        trigger_timer=None)", "return_statement": "return job_name, job_config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "False", ",", "arg_13", "=", "None", ",", "arg_14", "=", "None", ",", "arg_15", "=", "False", ",", "arg_16", "=", "None", ",", "arg_17", "=", "None", ")", ":", "if", "arg_6", "is", "None", ":", "arg_6", "=", "get_config_index", "(", "arg_0", ")", "if", "arg_7", "is", "None", ":", "arg_18", "=", "get_ci_build_files", "(", "arg_6", ",", "arg_1", ")", "arg_7", "=", "arg_18", "[", "arg_2", "]", "if", "arg_14", "is", "not", "None", ":", "arg_7", ".", "targets", "=", "arg_14", "if", "arg_8", "is", "None", ":", "arg_8", "=", "get_index", "(", "arg_6", ".", "rosdistro_index_url", ")", "if", "arg_9", "is", "None", ":", "arg_9", "=", "get_distribution_file", "(", "arg_8", ",", "arg_1", ",", "arg_7", ")", "if", "not", "arg_9", ":", "raise", "JobValidationError", "(", "'No distribution file matches the build file'", ")", "if", "arg_3", "not", "in", "arg_7", ".", "targets", ".", "keys", "(", ")", ":", "raise", "JobValidationError", "(", "\"Invalid OS name '%s' \"", "%", "arg_3", "+", "'choose one of the following: '", "+", "', '", ".", "join", "(", "sorted", "(", "arg_7", ".", "targets", ".", "keys", "(", ")", ")", ")", ")", "if", "arg_4", "not", "in", "arg_7", ".", "targets", "[", "arg_3", "]", ".", "keys", "(", ")", ":", "raise", "JobValidationError", "(", "\"Invalid OS code name '%s' \"", "%", "arg_4", "+", "'choose one of the following: '", "+", "', '", ".", "join", "(", "sorted", "(", "arg_7", ".", "targets", "[", "arg_3", "]", ".", "keys", "(", ")", ")", ")", ")", "if", "arg_5", "not", "in", "arg_7", ".", "targets", "[", "arg_3", "]", "[", "arg_4", "]", ":", "raise", "JobValidationError", "(", "\"Invalid architecture '%s' \"", "%", "arg_5", "+", "'choose one of the following: %s'", "%", "', '", ".", "join", "(", "sorted", "(", "arg_7", ".", "targets", "[", "arg_3", "]", "[", "arg_4", "]", ")", ")", ")", "if", "len", "(", "arg_7", ".", "underlay_from_ci_jobs", ")", ">", "1", ":", "raise", "JobValidationError", "(", "'Only a single underlay job is currently supported, but the '", "+", "'build file lists %d.'", "%", "len", "(", "arg_7", ".", "underlay_from_ci_jobs", ")", ")", "arg_20", "=", "None", "if", "arg_7", ".", "underlay_from_ci_jobs", ":", "arg_20", "=", "get_ci_job_name", "(", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_7", ".", "underlay_from_ci_jobs", "[", "0", "]", ")", "arg_16", "=", "(", "arg_16", "or", "[", "]", ")", "+", "[", "'$UNDERLAY_JOB_SPACE'", "]", "if", "arg_10", "is", "None", ":", "from", "ros_buildfarm", ".", "jenkins", "import", "connect", "arg_10", "=", "connect", "(", "arg_6", ".", "jenkins_url", ")", "if", "arg_11", "is", "None", ":", "arg_21", "=", "get_ci_view_name", "(", "arg_1", ")", "configure_ci_view", "(", "arg_10", ",", "arg_21", ",", "arg_15", "=", "arg_15", ")", "arg_22", "=", "get_ci_job_name", "(", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_2", ")", "arg_23", "=", "_get_ci_job_config", "(", "arg_8", ",", "arg_1", ",", "arg_7", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_7", ".", "repos_files", ",", "arg_20", ",", "arg_16", ",", "arg_17", ",", "arg_12", "=", "arg_12", ")", "if", "isinstance", "(", "arg_10", ",", "object", ")", "and", "arg_10", "is", "not", "False", ":", "from", "ros_buildfarm", ".", "jenkins", "import", "configure_job", "configure_job", "(", "arg_10", ",", "arg_22", ",", "arg_23", ",", "arg_15", "=", "arg_15", ")", "return", "arg_22", ",", "arg_23"], "function": "def Func(\n        arg_0, arg_1, arg_2,\n        arg_3, arg_4, arg_5,\n        arg_6=None, arg_7=None,\n        arg_8=None, arg_9=None,\n        arg_10=None, arg_11=None,\n        arg_12=False,\n        arg_13=None,\n        arg_14=None,\n        arg_15=False,\n        arg_16=None,\n        arg_17=None):\n    \"\"\"\n    Configure a single Jenkins CI job.\n\n    This includes the following steps:\n    - clone the ros_buildfarm repository\n    - write the distribution repository keys into files\n    - invoke the ci/run_ci_job.py script\n    \"\"\"\n    if arg_6 is None:\n        arg_6 = get_config_index(arg_0)\n    if arg_7 is None:\n        arg_18 = get_ci_build_files(arg_6, arg_1)\n        arg_7 = arg_18[arg_2]\n    # Overwrite build_file.targets if build_targets is specified\n    if arg_14 is not None:\n        arg_7.targets = arg_14\n\n    if arg_8 is None:\n        arg_8 = get_index(arg_6.rosdistro_index_url)\n    if arg_9 is None:\n        arg_9 = get_distribution_file(arg_8, arg_1, arg_7)\n        if not arg_9:\n            raise JobValidationError(\n                'No distribution file matches the build file')\n\n    if arg_3 not in arg_7.targets.keys():\n        raise JobValidationError(\n            \"Invalid OS name '%s' \" % arg_3 +\n            'choose one of the following: ' +\n            ', '.join(sorted(arg_7.targets.keys())))\n    if arg_4 not in arg_7.targets[arg_3].keys():\n        raise JobValidationError(\n            \"Invalid OS code name '%s' \" % arg_4 +\n            'choose one of the following: ' +\n            ', '.join(sorted(arg_7.targets[arg_3].keys())))\n    if arg_5 not in arg_7.targets[arg_3][arg_4]:\n        raise JobValidationError(\n            \"Invalid architecture '%s' \" % arg_5 +\n            'choose one of the following: %s' % ', '.join(sorted(\n                arg_7.targets[arg_3][arg_4])))\n\n    if len(arg_7.underlay_from_ci_jobs) > 1:\n        raise JobValidationError(\n            'Only a single underlay job is currently supported, but the ' +\n            'build file lists %d.' % len(arg_7.underlay_from_ci_jobs))\n\n    arg_20 = None\n    if arg_7.underlay_from_ci_jobs:\n        arg_20 = get_ci_job_name(\n            arg_1, arg_3, arg_4, arg_5,\n            arg_7.underlay_from_ci_jobs[0])\n        arg_16 = (arg_16 or []) + \\\n            ['$UNDERLAY_JOB_SPACE']\n\n    if arg_10 is None:\n        from ros_buildfarm.jenkins import connect\n        arg_10 = connect(arg_6.jenkins_url)\n    if arg_11 is None:\n        arg_21 = get_ci_view_name(arg_1)\n        configure_ci_view(arg_10, arg_21, arg_15=arg_15)\n\n    arg_22 = get_ci_job_name(\n        arg_1, arg_3, arg_4, arg_5, arg_2)\n\n    arg_23 = _get_ci_job_config(\n        arg_8, arg_1, arg_7, arg_3,\n        arg_4, arg_5,\n        arg_7.repos_files,\n        arg_20,\n        arg_16,\n        arg_17,\n        arg_12=arg_12)\n    # jenkinsapi.jenkins.Jenkins evaluates to false if job count is zero\n    if isinstance(arg_10, object) and arg_10 is not False:\n        from ros_buildfarm.jenkins import configure_job\n        configure_job(arg_10, arg_22, arg_23, arg_15=arg_15)\n\n    return arg_22, arg_23", "path": "ros_buildfarm/ci_job.py", "identifier": "configure_ci_job", "docstring": "Configure a single Jenkins CI job.\n\n    This includes the following steps:\n    - clone the ros_buildfarm repository\n    - write the distribution repository keys into files\n    - invoke the ci/run_ci_job.py script", "docstring_tokens": ["Configure", "a", "single", "Jenkins", "CI", "job", "."], "nwo": "ros-infrastructure/ros_buildfarm", "score": 0.5592967619494252, "idx": 257796}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L166-L195", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Read a window of an input vector dataset.", "language": "python", "parameters": "(input_files, tile, validity_check=True)", "return_statement": "return [\n        feature\n        for feature in chain.from_iterable([\n            _read_vector_window(path, tile, validity_check=validity_check)\n            for path in input_files\n        ])\n    ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_0", "=", "[", "arg_0", "]", "return", "[", "arg_3", "for", "arg_3", "in", "chain", ".", "from_iterable", "(", "[", "_Func", "(", "arg_4", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "for", "arg_4", "in", "arg_0", "]", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Read a window of an input vector dataset.\n\n    Also clips geometry.\n\n    Parameters:\n    -----------\n    input_file : string\n        path to vector file\n    tile : ``Tile``\n        tile extent to read data from\n    validity_check : bool\n        checks if reprojected geometry is valid and throws ``RuntimeError`` if\n        invalid (default: True)\n\n    Returns\n    -------\n    features : list\n      a list of reprojected GeoJSON-like features\n    \"\"\"\n    if not isinstance(arg_0, list):\n        arg_0 = [arg_0]\n    return [\n        arg_3\n        for arg_3 in chain.from_iterable([\n            _Func(arg_4, arg_1, arg_2=arg_2)\n            for arg_4 in arg_0\n        ])\n    ]", "path": "mapchete/io/vector.py", "identifier": "read_vector_window", "docstring": "Read a window of an input vector dataset.\n\n    Also clips geometry.\n\n    Parameters:\n    -----------\n    input_file : string\n        path to vector file\n    tile : ``Tile``\n        tile extent to read data from\n    validity_check : bool\n        checks if reprojected geometry is valid and throws ``RuntimeError`` if\n        invalid (default: True)\n\n    Returns\n    -------\n    features : list\n      a list of reprojected GeoJSON-like features", "docstring_tokens": ["Read", "a", "window", "of", "an", "input", "vector", "dataset", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 257797}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/schema.py#L199-L228", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Get the dtype associated with a jsonschema type definition", "language": "python", "parameters": "(typespec)", "return_statement": "return np.object_", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'type'", "in", "arg_0", ":", "return", "__TYPE_MAP__", ".", "get", "(", "arg_0", "[", "'type'", "]", ",", "np", ".", "object_", ")", "elif", "'enum'", "in", "arg_0", ":", "return", "np", ".", "object_", "elif", "'oneOf'", "in", "arg_0", ":", "arg_1", "=", "[", "Func", "(", "v", ")", "for", "v", "in", "arg_0", "[", "'oneOf'", "]", "]", "if", "all", "(", "[", "arg_2", "==", "arg_1", "[", "0", "]", "for", "arg_2", "in", "arg_1", "]", ")", ":", "return", "arg_1", "[", "0", "]", "return", "np", ".", "object_"], "function": "def Func(arg_0):\n    '''Get the dtype associated with a jsonschema type definition\n\n    Parameters\n    ----------\n    typespec : dict\n        The schema definition\n\n    Returns\n    -------\n    dtype : numpy.dtype\n        The associated dtype\n    '''\n\n    if 'type' in arg_0:\n        return __TYPE_MAP__.get(arg_0['type'], np.object_)\n\n    elif 'enum' in arg_0:\n        # Enums map to objects\n        return np.object_\n\n    elif 'oneOf' in arg_0:\n        # Recurse\n        arg_1 = [Func(v) for v in arg_0['oneOf']]\n\n        # If they're not all equal, return object\n        if all([arg_2 == arg_1[0] for arg_2 in arg_1]):\n            return arg_1[0]\n\n    return np.object_", "path": "jams/schema.py", "identifier": "__get_dtype", "docstring": "Get the dtype associated with a jsonschema type definition\n\n    Parameters\n    ----------\n    typespec : dict\n        The schema definition\n\n    Returns\n    -------\n    dtype : numpy.dtype\n        The associated dtype", "docstring_tokens": ["Get", "the", "dtype", "associated", "with", "a", "jsonschema", "type", "definition"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 257798}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L179-L245", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Read in a text file that java messages to be ignored and generate a dictionary structure out of\n    it with key and value pairs.  The keys are test names and the values are lists of java message\n    strings associated with that test name where we are either going to add to the existing java messages\n    to ignore or remove them from g_ok_java_messages.", "language": "python", "parameters": "(filename)", "return_statement": "return message_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "wfile", ":", "arg_2", "=", "\"\"", "arg_3", "=", "\"\"", "arg_4", "=", "False", "while", "1", ":", "arg_5", "=", "wfile", ".", "readline", "(", ")", "if", "not", "arg_5", ":", "if", "arg_4", ":", "add_to_dict", "(", "arg_3", ".", "strip", "(", ")", ",", "arg_2", ",", "arg_1", ")", "break", "if", "\"keyname\"", "in", "arg_5", ".", "lower", "(", ")", ":", "arg_6", "=", "arg_5", ".", "strip", "(", ")", ".", "split", "(", "'='", ")", "if", "(", "len", "(", "arg_6", ")", ">", "1", ")", ":", "if", "arg_4", ":", "add_to_dict", "(", "arg_3", ".", "strip", "(", ")", ",", "arg_2", ",", "arg_1", ")", "arg_3", "=", "\"\"", "arg_2", "=", "arg_6", "[", "1", "]", ".", "strip", "(", ")", "arg_4", "=", "False", "if", "(", "len", "(", "arg_5", ")", ">", "1", ")", "and", "arg_4", ":", "arg_3", "+=", "arg_5", "if", "\"ignoredmessage\"", "in", "arg_5", ".", "lower", "(", ")", ":", "arg_4", "=", "True", "arg_7", "=", "arg_5", ".", "split", "(", "'='", ")", "if", "(", "len", "(", "arg_7", ")", ">", "1", ")", ":", "arg_3", "=", "arg_7", "[", "1", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Read in a text file that java messages to be ignored and generate a dictionary structure out of\n    it with key and value pairs.  The keys are test names and the values are lists of java message\n    strings associated with that test name where we are either going to add to the existing java messages\n    to ignore or remove them from g_ok_java_messages.\n\n    Parameters\n    ----------\n\n    filename :  Str\n       filename that contains ignored java messages.  The text file shall contain something like this:\n        keyName = general\n        Message = nfolds: nfolds cannot be larger than the number of rows (406).\n        KeyName = pyunit_cv_cars_gbm.py\n        Message = Caught exception: Illegal argument(s) for GBM model: GBM_model_python_1452503348770_2586.  \\\n            Details: ERRR on field: _nfolds: nfolds must be either 0 or >1.\n        ...\n\n    :return:\n    message_dict : dict\n        contains java message to be ignored with key as unit test name or \"general\" and values as list of ignored java\n        messages.\n    \"\"\"\n    arg_1 = {}\n\n    if os.path.isfile(arg_0):\n        # open file to read in new exclude messages if it exists\n        with open(arg_0,'r') as wfile:\n\n            arg_2 = \"\"\n            arg_3 = \"\"\n            arg_4 = False\n\n            while 1:\n                arg_5 = wfile.readline()\n\n                if not arg_5:   # reached EOF\n                    if arg_4:\n                        add_to_dict(arg_3.strip(),arg_2,arg_1)\n                    break\n\n                # found a test name or general with values to follow\n                if \"keyname\" in arg_5.lower():  # name of test file or the word \"general\"\n                    arg_6 = arg_5.strip().split('=')\n\n                    if (len(arg_6) > 1): # make sure the line is formatted sort of correctly\n                        if arg_4:   # this is the start of a new key/value pair\n                            add_to_dict(arg_3.strip(),arg_2,arg_1)\n                            arg_3 = \"\"\n\n                        arg_2 = arg_6[1].strip()\n                        arg_4 = False\n\n                if (len(arg_5) > 1) and arg_4:\n                    arg_3 += arg_5\n\n                if \"ignoredmessage\" in arg_5.lower():\n                    arg_4 = True    # start of a Java message.\n                    arg_7 = arg_5.split('=')\n\n                    if (len(arg_7) > 1):\n                        arg_3 = arg_7[1]\n\n\n\n    return arg_1", "path": "scripts/addjavamessage2ignore.py", "identifier": "extract_message_to_dict", "docstring": "Read in a text file that java messages to be ignored and generate a dictionary structure out of\n    it with key and value pairs.  The keys are test names and the values are lists of java message\n    strings associated with that test name where we are either going to add to the existing java messages\n    to ignore or remove them from g_ok_java_messages.\n\n    Parameters\n    ----------\n\n    filename :  Str\n       filename that contains ignored java messages.  The text file shall contain something like this:\n        keyName = general\n        Message = nfolds: nfolds cannot be larger than the number of rows (406).\n        KeyName = pyunit_cv_cars_gbm.py\n        Message = Caught exception: Illegal argument(s) for GBM model: GBM_model_python_1452503348770_2586.  \\\n            Details: ERRR on field: _nfolds: nfolds must be either 0 or >1.\n        ...\n\n    :return:\n    message_dict : dict\n        contains java message to be ignored with key as unit test name or \"general\" and values as list of ignored java\n        messages.", "docstring_tokens": ["Read", "in", "a", "text", "file", "that", "java", "messages", "to", "be", "ignored", "and", "generate", "a", "dictionary", "structure", "out", "of", "it", "with", "key", "and", "value", "pairs", ".", "The", "keys", "are", "test", "names", "and", "the", "values", "are", "lists", "of", "java", "message", "strings", "associated", "with", "that", "test", "name", "where", "we", "are", "either", "going", "to", "add", "to", "the", "existing", "java", "messages", "to", "ignore", "or", "remove", "them", "from", "g_ok_java_messages", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257799}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L255-L275", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Retrieve content ids in a range of ids.", "language": "python", "parameters": "(self, *key_ranges)", "return_statement": "return imap(itemgetter(0), scanner)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_1", "=", "[", "(", "tuplify", "(", "s", ")", ",", "tuplify", "(", "e", ")", ")", "for", "s", ",", "e", "in", "arg_1", "]", "arg_2", "=", "arg_0", ".", "kvl", ".", "scan_keys", "(", "arg_0", ".", "TABLE", ",", "*", "arg_1", ")", "return", "imap", "(", "itemgetter", "(", "0", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, *arg_1):\n        '''Retrieve content ids in a range of ids.\n\n        Returns a generator of ``content_id`` corresponding to the\n        content identifier ranges given. `key_ranges` can be a possibly\n        empty list of 2-tuples, where the first element of the tuple\n        is the beginning of a range and the second element is the end\n        of a range. To specify the beginning or end of the table, use\n        an empty tuple `()`.\n\n        If the list is empty, then this yields all content ids in\n        the storage.\n\n        :param key_ranges: as described in\n                           :meth:`kvlayer._abstract_storage.AbstractStorage`\n        :rtype: generator of ``content_id``\n        '''\n        # (id, id) -> ((id,), (id,))\n        arg_1 = [(tuplify(s), tuplify(e)) for s, e in arg_1]\n        arg_2 = arg_0.kvl.scan_keys(arg_0.TABLE, *arg_1)\n        return imap(itemgetter(0), arg_2)", "path": "dossier/store/store.py", "identifier": "Store.scan_ids", "docstring": "Retrieve content ids in a range of ids.\n\n        Returns a generator of ``content_id`` corresponding to the\n        content identifier ranges given. `key_ranges` can be a possibly\n        empty list of 2-tuples, where the first element of the tuple\n        is the beginning of a range and the second element is the end\n        of a range. To specify the beginning or end of the table, use\n        an empty tuple `()`.\n\n        If the list is empty, then this yields all content ids in\n        the storage.\n\n        :param key_ranges: as described in\n                           :meth:`kvlayer._abstract_storage.AbstractStorage`\n        :rtype: generator of ``content_id``", "docstring_tokens": ["Retrieve", "content", "ids", "in", "a", "range", "of", "ids", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 257800}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/decorators.py#L109-L120", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Decorator to log a message before executing a function", "language": "python", "parameters": "(logger, message=\"\")", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ")", ":", "def", "decorator", "(", "arg_2", ")", ":", "@", "wraps", "(", "arg_2", ")", "def", "wrapper", "(", "*", "arg_3", ",", "**", "arg_4", ")", ":", "_Func", "(", "arg_0", ",", "arg_2", ".", "__name__", ",", "arg_1", ")", "arg_5", "=", "arg_2", "(", "*", "arg_3", ",", "**", "arg_4", ")", "return", "arg_5", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0, arg_1=\"\"):\n    \"\"\"\n    Decorator to log a message before executing a function\n    \"\"\"\n    def decorator(arg_2):\n        @wraps(arg_2)\n        def wrapper(*arg_3, **arg_4):\n            _Func(arg_0, arg_2.__name__, arg_1)\n            arg_5 = arg_2(*arg_3, **arg_4)\n            return arg_5\n        return wrapper\n    return decorator", "path": "toucan_data_sdk/utils/decorators.py", "identifier": "log_message", "docstring": "Decorator to log a message before executing a function", "docstring_tokens": ["Decorator", "to", "log", "a", "message", "before", "executing", "a", "function"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 257801}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_schinke.py#L141-L261", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the stem of a word according to the Schinke stemmer.", "language": "python", "parameters": "(self, word)", "return_statement": "return {'n': noun, 'v': verb}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "normalize", "(", "'NFKD'", ",", "text_type", "(", "arg_1", ".", "lower", "(", ")", ")", ")", "arg_1", "=", "''", ".", "join", "(", "c", "for", "c", "in", "arg_1", "if", "c", "in", "{", "'a'", ",", "'b'", ",", "'c'", ",", "'d'", ",", "'e'", ",", "'f'", ",", "'g'", ",", "'h'", ",", "'i'", ",", "'j'", ",", "'k'", ",", "'l'", ",", "'m'", ",", "'n'", ",", "'o'", ",", "'p'", ",", "'q'", ",", "'r'", ",", "'s'", ",", "'t'", ",", "'u'", ",", "'v'", ",", "'w'", ",", "'x'", ",", "'y'", ",", "'z'", ",", "}", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "'j'", ",", "'i'", ")", ".", "replace", "(", "'v'", ",", "'u'", ")", "if", "arg_1", "[", "-", "3", ":", "]", "==", "'que'", ":", "if", "arg_1", "[", ":", "-", "3", "]", "in", "arg_0", ".", "_keep_que", "or", "arg_1", "==", "'que'", ":", "return", "{", "'n'", ":", "arg_1", ",", "'v'", ":", "arg_1", "}", "else", ":", "arg_1", "=", "arg_1", "[", ":", "-", "3", "]", "arg_2", "=", "arg_1", "arg_3", "=", "arg_1", "for", "arg_4", "in", "range", "(", "4", ",", "0", ",", "-", "1", ")", ":", "if", "arg_1", "[", "-", "arg_4", ":", "]", "in", "arg_0", ".", "_n_endings", "[", "arg_4", "]", ":", "if", "len", "(", "arg_1", ")", "-", "2", ">=", "arg_4", ":", "arg_2", "=", "arg_1", "[", ":", "-", "arg_4", "]", "else", ":", "arg_2", "=", "arg_1", "break", "for", "arg_4", "in", "range", "(", "6", ",", "0", ",", "-", "1", ")", ":", "if", "arg_1", "[", "-", "arg_4", ":", "]", "in", "arg_0", ".", "_v_endings_strip", "[", "arg_4", "]", ":", "if", "len", "(", "arg_1", ")", "-", "2", ">=", "arg_4", ":", "arg_3", "=", "arg_1", "[", ":", "-", "arg_4", "]", "else", ":", "arg_3", "=", "arg_1", "break", "if", "arg_1", "[", "-", "arg_4", ":", "]", "in", "arg_0", ".", "_v_endings_alter", "[", "arg_4", "]", ":", "if", "arg_1", "[", "-", "arg_4", ":", "]", "in", "{", "'iuntur'", ",", "'erunt'", ",", "'untur'", ",", "'iunt'", ",", "'unt'", ",", "}", ":", "arg_5", "=", "arg_1", "[", ":", "-", "arg_4", "]", "+", "'i'", "arg_6", "=", "1", "elif", "arg_1", "[", "-", "arg_4", ":", "]", "in", "{", "'beris'", ",", "'bor'", ",", "'bo'", "}", ":", "arg_5", "=", "arg_1", "[", ":", "-", "arg_4", "]", "+", "'bi'", "arg_6", "=", "2", "else", ":", "arg_5", "=", "arg_1", "[", ":", "-", "arg_4", "]", "+", "'eri'", "arg_6", "=", "3", "if", "len", "(", "arg_5", ")", ">=", "2", "+", "arg_6", ":", "arg_3", "=", "arg_5", "else", ":", "arg_3", "=", "arg_1", "break", "return", "{", "'n'", ":", "arg_2", ",", "'v'", ":", "arg_3", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the Func of a word according to the Schinke Funcmer.\n\n        Parameters\n        ----------\n        word : str\n            The word to Func\n\n        Returns\n        -------\n        str\n            Word Func\n\n        Examples\n        --------\n        >>> stmr = Schinke()\n        >>> stmr.Func('atque')\n        {'n': 'atque', 'v': 'atque'}\n        >>> stmr.Func('census')\n        {'n': 'cens', 'v': 'censu'}\n        >>> stmr.Func('virum')\n        {'n': 'uir', 'v': 'uiru'}\n        >>> stmr.Func('populusque')\n        {'n': 'popul', 'v': 'populu'}\n        >>> stmr.Func('senatus')\n        {'n': 'senat', 'v': 'senatu'}\n\n        \"\"\"\n        arg_1 = normalize('NFKD', text_type(arg_1.lower()))\n        arg_1 = ''.join(\n            c\n            for c in arg_1\n            if c\n            in {\n                'a',\n                'b',\n                'c',\n                'd',\n                'e',\n                'f',\n                'g',\n                'h',\n                'i',\n                'j',\n                'k',\n                'l',\n                'm',\n                'n',\n                'o',\n                'p',\n                'q',\n                'r',\n                's',\n                't',\n                'u',\n                'v',\n                'w',\n                'x',\n                'y',\n                'z',\n            }\n        )\n\n        # Rule 2\n        arg_1 = arg_1.replace('j', 'i').replace('v', 'u')\n\n        # Rule 3\n        if arg_1[-3:] == 'que':\n            # This diverges from the paper by also returning 'que' itself\n            #  unFuncmed\n            if arg_1[:-3] in arg_0._keep_que or arg_1 == 'que':\n                return {'n': arg_1, 'v': arg_1}\n            else:\n                arg_1 = arg_1[:-3]\n\n        # Base case will mean returning the words as is\n        arg_2 = arg_1\n        arg_3 = arg_1\n\n        # Rule 4\n        for arg_4 in range(4, 0, -1):\n            if arg_1[-arg_4:] in arg_0._n_endings[arg_4]:\n                if len(arg_1) - 2 >= arg_4:\n                    arg_2 = arg_1[:-arg_4]\n                else:\n                    arg_2 = arg_1\n                break\n\n        for arg_4 in range(6, 0, -1):\n            if arg_1[-arg_4:] in arg_0._v_endings_strip[arg_4]:\n                if len(arg_1) - 2 >= arg_4:\n                    arg_3 = arg_1[:-arg_4]\n                else:\n                    arg_3 = arg_1\n                break\n            if arg_1[-arg_4:] in arg_0._v_endings_alter[arg_4]:\n                if arg_1[-arg_4:] in {\n                    'iuntur',\n                    'erunt',\n                    'untur',\n                    'iunt',\n                    'unt',\n                }:\n                    arg_5 = arg_1[:-arg_4] + 'i'\n                    arg_6 = 1\n                elif arg_1[-arg_4:] in {'beris', 'bor', 'bo'}:\n                    arg_5 = arg_1[:-arg_4] + 'bi'\n                    arg_6 = 2\n                else:\n                    arg_5 = arg_1[:-arg_4] + 'eri'\n                    arg_6 = 3\n\n                # Technically this diverges from the paper by considering the\n                # length of the Func without the new suffix\n                if len(arg_5) >= 2 + arg_6:\n                    arg_3 = arg_5\n                else:\n                    arg_3 = arg_1\n                break\n\n        return {'n': arg_2, 'v': arg_3}", "path": "abydos/stemmer/_schinke.py", "identifier": "Schinke.stem", "docstring": "Return the stem of a word according to the Schinke stemmer.\n\n        Parameters\n        ----------\n        word : str\n            The word to stem\n\n        Returns\n        -------\n        str\n            Word stem\n\n        Examples\n        --------\n        >>> stmr = Schinke()\n        >>> stmr.stem('atque')\n        {'n': 'atque', 'v': 'atque'}\n        >>> stmr.stem('census')\n        {'n': 'cens', 'v': 'censu'}\n        >>> stmr.stem('virum')\n        {'n': 'uir', 'v': 'uiru'}\n        >>> stmr.stem('populusque')\n        {'n': 'popul', 'v': 'populu'}\n        >>> stmr.stem('senatus')\n        {'n': 'senat', 'v': 'senatu'}", "docstring_tokens": ["Return", "the", "stem", "of", "a", "word", "according", "to", "the", "Schinke", "stemmer", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 257802}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/namespace_manager.py#L367-L380", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Write as a BEL annotation file.", "language": "python", "parameters": "(self, file: TextIO)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "None", ":", "if", "not", "arg_0", ".", "is_populated", "(", ")", ":", "arg_0", ".", "populate", "(", ")", "arg_3", "=", "arg_0", ".", "_get_namespace_name_to_encoding", "(", "desc", "=", "'writing names'", ")", "write_annotation", "(", "keyword", "=", "arg_0", ".", "_get_namespace_keyword", "(", ")", ",", "citation_name", "=", "arg_0", ".", "_get_namespace_name", "(", ")", ",", "description", "=", "''", ",", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> None:\n        \"\"\"Write as a BEL annotation file.\"\"\"\n        if not arg_0.is_populated():\n            arg_0.populate()\n\n        arg_3 = arg_0._get_namespace_name_to_encoding(desc='writing names')\n\n        write_annotation(\n            keyword=arg_0._get_namespace_keyword(),\n            citation_name=arg_0._get_namespace_name(),\n            description='',\n            arg_3=arg_3,\n            arg_1=arg_1,\n        )", "path": "src/bio2bel/manager/namespace_manager.py", "identifier": "BELNamespaceManagerMixin.write_bel_annotation", "docstring": "Write as a BEL annotation file.", "docstring_tokens": ["Write", "as", "a", "BEL", "annotation", "file", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 257803}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/account.py#L257-L277", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Generate a valid request token for user based authentication.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Generate a valid request token for user based authentication.\n\n        A request token is required to ask the user for permission to\n        access their account.\n\n        After obtaining the request_token, either:\n        (1) Direct your user to:\n                https://www.themoviedb.org/authenticate/REQUEST_TOKEN\n        or:\n        (2) Call token_validate_with_login() below.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/account.py", "identifier": "Authentication.token_new", "docstring": "Generate a valid request token for user based authentication.\n\n        A request token is required to ask the user for permission to\n        access their account.\n\n        After obtaining the request_token, either:\n        (1) Direct your user to:\n                https://www.themoviedb.org/authenticate/REQUEST_TOKEN\n        or:\n        (2) Call token_validate_with_login() below.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Generate", "a", "valid", "request", "token", "for", "user", "based", "authentication", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 257804}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1078-L1100", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "make_ndx that captures all output", "language": "python", "parameters": "(**kwargs)", "return_statement": "return gromacs.make_ndx(**kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "arg_0", "[", "'stdout'", "]", "=", "False", "arg_1", "=", "arg_0", ".", "pop", "(", "'input'", ",", "[", "]", ")", "arg_1", "=", "[", "cmd", "for", "cmd", "in", "arg_1", "if", "cmd", "!=", "'q'", "]", "arg_0", "[", "'input'", "]", "=", "arg_1", "+", "[", "''", ",", "'q'", "]", "return", "gromacs", ".", "make_ndx", "(", "**", "arg_0", ")"], "function": "def Func(**arg_0):\n    \"\"\"make_ndx that captures all output\n\n    Standard :func:`~gromacs.make_ndx` command with the input and\n    output pre-set in such a way that it can be conveniently used for\n    :func:`parse_ndxlist`.\n\n    Example::\n      ndx_groups = parse_ndxlist(Func(n=ndx)[0])\n\n    Note that the convenient :func:`get_ndx_groups` function does exactly\n    that and can probably used in most cases.\n\n    :Arguments:\n        keywords are passed on to :func:`~gromacs.make_ndx`\n    :Returns:\n        (*returncode*, *output*, ``None``)\n    \"\"\"\n    arg_0['stdout']=False   # required for proper output as described in doc\n    arg_1 = arg_0.pop('input',[])\n    arg_1 = [cmd for cmd in arg_1 if cmd != 'q']  # filter any quit\n    arg_0['input'] = arg_1 + ['', 'q']                # necessary commands\n    return gromacs.make_ndx(**arg_0)", "path": "gromacs/cbook.py", "identifier": "make_ndx_captured", "docstring": "make_ndx that captures all output\n\n    Standard :func:`~gromacs.make_ndx` command with the input and\n    output pre-set in such a way that it can be conveniently used for\n    :func:`parse_ndxlist`.\n\n    Example::\n      ndx_groups = parse_ndxlist(make_ndx_captured(n=ndx)[0])\n\n    Note that the convenient :func:`get_ndx_groups` function does exactly\n    that and can probably used in most cases.\n\n    :Arguments:\n        keywords are passed on to :func:`~gromacs.make_ndx`\n    :Returns:\n        (*returncode*, *output*, ``None``)", "docstring_tokens": ["make_ndx", "that", "captures", "all", "output"], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 257805}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L165-L172", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Obtain the private key for a given public key", "language": "python", "parameters": "(self, pub)", "return_statement": "return self.store.getPrivateKeyForPublicKey(str(pub))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "str", "(", "arg_1", ")", "not", "in", "arg_0", ".", "store", ":", "raise", "KeyNotFound", "return", "arg_0", ".", "store", ".", "Func", "(", "str", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Obtain the private key for a given public key\n\n            :param str pub: Public Key\n        \"\"\"\n        if str(arg_1) not in arg_0.store:\n            raise KeyNotFound\n        return arg_0.store.Func(str(arg_1))", "path": "graphenecommon/wallet.py", "identifier": "Wallet.getPrivateKeyForPublicKey", "docstring": "Obtain the private key for a given public key\n\n            :param str pub: Public Key", "docstring_tokens": ["Obtain", "the", "private", "key", "for", "a", "given", "public", "key"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 257806}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/dash_manifest.py#L463-L508", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "yield the segment number and when it will be available\n        There are two cases for segment number generation, static and dynamic.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "log", ".", "debug", "(", "\"Generating segment numbers for {0} playlist (id={1})\"", ".", "format", "(", "arg_0", ".", "root", ".", "type", ",", "arg_0", ".", "parent", ".", "id", ")", ")", "if", "arg_0", ".", "root", ".", "type", "==", "u\"static\"", ":", "arg_1", "=", "repeat", "(", "epoch_start", ")", "arg_2", "=", "arg_0", ".", "period", ".", "duration", ".", "seconds", "or", "arg_0", ".", "root", ".", "mediaPresentationDuration", ".", "seconds", "if", "arg_2", ":", "arg_3", "=", "range", "(", "arg_0", ".", "startNumber", ",", "int", "(", "arg_2", "/", "arg_0", ".", "duration_seconds", ")", "+", "1", ")", "else", ":", "arg_3", "=", "count", "(", "arg_0", ".", "startNumber", ")", "else", ":", "arg_4", "=", "datetime", ".", "datetime", ".", "now", "(", "utc", ")", "if", "arg_0", ".", "presentationTimeOffset", ":", "arg_5", "=", "(", "arg_4", "-", "arg_0", ".", "presentationTimeOffset", ")", "-", "arg_0", ".", "root", ".", "availabilityStartTime", "arg_6", "=", "arg_0", ".", "root", ".", "availabilityStartTime", "+", "arg_0", ".", "presentationTimeOffset", "+", "arg_5", "arg_7", "=", "arg_6", "else", ":", "arg_5", "=", "arg_4", "-", "arg_0", ".", "root", ".", "availabilityStartTime", "arg_7", "=", "arg_4", "arg_8", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "(", "arg_0", ".", "root", ".", "suggestedPresentationDelay", ".", "total_seconds", "(", ")", "if", "arg_0", ".", "root", ".", "suggestedPresentationDelay", "else", "3", ")", ")", "arg_3", "=", "count", "(", "arg_0", ".", "startNumber", "+", "int", "(", "(", "arg_5", "-", "arg_8", "-", "arg_0", ".", "root", ".", "minBufferTime", ")", ".", "total_seconds", "(", ")", "/", "arg_0", ".", "duration_seconds", ")", ")", "arg_1", "=", "count_dt", "(", "arg_7", ",", "step", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "arg_0", ".", "duration_seconds", ")", ")", "for", "arg_9", ",", "arg_10", "in", "izip", "(", "arg_3", ",", "arg_1", ")", ":", "yield", "arg_9", ",", "arg_10"], "function": "def Func(arg_0):\n        \"\"\"\n        yield the segment number and when it will be available\n        There are two cases for segment number generation, static and dynamic.\n\n        In the case of static stream, the segment number starts at the startNumber and counts\n        up to the number of segments that are represented by the periods duration.\n\n        In the case of dynamic streams, the segments should appear at the specified time\n        in the simplest case the segment number is based on the time since the availabilityStartTime\n        :return:\n        \"\"\"\n        log.debug(\"Generating segment numbers for {0} playlist (id={1})\".format(arg_0.root.type, arg_0.parent.id))\n        if arg_0.root.type == u\"static\":\n            arg_1 = repeat(epoch_start)\n            arg_2 = arg_0.period.duration.seconds or arg_0.root.mediaPresentationDuration.seconds\n            if arg_2:\n                arg_3 = range(arg_0.startNumber, int(arg_2 / arg_0.duration_seconds) + 1)\n            else:\n                arg_3 = count(arg_0.startNumber)\n        else:\n            arg_4 = datetime.datetime.now(utc)\n            if arg_0.presentationTimeOffset:\n                arg_5 = (arg_4 - arg_0.presentationTimeOffset) - arg_0.root.availabilityStartTime\n                arg_6 = arg_0.root.availabilityStartTime + arg_0.presentationTimeOffset + arg_5\n                arg_7 = arg_6\n            else:\n                arg_5 = arg_4 - arg_0.root.availabilityStartTime\n                arg_7 = arg_4\n\n            # if there is no delay, use a delay of 3 seconds\n            arg_8 = datetime.timedelta(seconds=(arg_0.root.suggestedPresentationDelay.total_seconds()\n                                                          if arg_0.root.suggestedPresentationDelay\n                                                          else 3))\n\n            # the number of the segment that is available at NOW - SUGGESTED_DELAY - BUFFER_TIME\n            arg_3 = count(arg_0.startNumber +\n                                int((arg_5 - arg_8 - arg_0.root.minBufferTime).total_seconds() /\n                                    arg_0.duration_seconds))\n\n            # the time the segment number is available at NOW\n            arg_1 = count_dt(arg_7,\n                                      step=datetime.timedelta(seconds=arg_0.duration_seconds))\n\n        for arg_9, arg_10 in izip(arg_3, arg_1):\n            yield arg_9, arg_10", "path": "src/streamlink/stream/dash_manifest.py", "identifier": "SegmentTemplate.segment_numbers", "docstring": "yield the segment number and when it will be available\n        There are two cases for segment number generation, static and dynamic.\n\n        In the case of static stream, the segment number starts at the startNumber and counts\n        up to the number of segments that are represented by the periods duration.\n\n        In the case of dynamic streams, the segments should appear at the specified time\n        in the simplest case the segment number is based on the time since the availabilityStartTime\n        :return:", "docstring_tokens": ["yield", "the", "segment", "number", "and", "when", "it", "will", "be", "available", "There", "are", "two", "cases", "for", "segment", "number", "generation", "static", "and", "dynamic", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 257807}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L144-L205", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Activate an environment", "language": "python", "parameters": "(paths, skip_local, skip_shared)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ":", "arg_3", "=", "click", ".", "get_current_context", "(", ")", "if", "cpenv", ".", "get_active_env", "(", ")", ":", "arg_3", ".", "invoke", "(", "info", ")", "return", "click", ".", "echo", "(", "arg_3", ".", "get_help", "(", ")", ")", "arg_4", "=", "(", "'\\nExamples: \\n'", "'    cpenv Func my_env\\n'", "'    cpenv Func ./relative/path/to/my_env\\n'", "'    cpenv Func my_env my_module\\n'", ")", "click", ".", "echo", "(", "arg_4", ")", "return", "if", "arg_1", ":", "cpenv", ".", "module_resolvers", ".", "remove", "(", "cpenv", ".", "resolver", ".", "module_resolver", ")", "cpenv", ".", "module_resolvers", ".", "remove", "(", "cpenv", ".", "resolver", ".", "active_env_module_resolver", ")", "if", "arg_2", ":", "cpenv", ".", "module_resolvers", ".", "remove", "(", "cpenv", ".", "resolver", ".", "modules_path_resolver", ")", "try", ":", "arg_5", "=", "cpenv", ".", "resolve", "(", "*", "arg_0", ")", "except", "cpenv", ".", "ResolveError", "as", "e", ":", "click", ".", "echo", "(", "'\\n'", "+", "str", "(", "e", ")", ")", "return", "arg_6", "=", "set", "(", "arg_5", ".", "resolved", ")", "arg_7", "=", "set", "(", ")", "arg_8", "=", "cpenv", ".", "get_active_env", "(", ")", "if", "arg_8", ":", "arg_7", ".", "add", "(", "arg_8", ")", "arg_7", ".", "update", "(", "cpenv", ".", "get_active_modules", "(", ")", ")", "arg_9", "=", "arg_6", "-", "arg_7", "arg_10", "=", "arg_7", "&", "arg_6", "if", "arg_10", "and", "not", "arg_9", ":", "click", ".", "echo", "(", "'\\nModules already active: '", "+", "bold", "(", "' '", ".", "join", "(", "[", "arg_11", ".", "name", "for", "arg_11", "in", "arg_10", "]", ")", ")", ")", "return", "if", "arg_8", "and", "contains_env", "(", "arg_9", ")", ":", "click", ".", "echo", "(", "'\\nUse bold(exit) to leave your active environment first.'", ")", "return", "click", ".", "echo", "(", "'\\nResolved the following modules...'", ")", "click", ".", "echo", "(", "format_objects", "(", "arg_5", ".", "resolved", ")", ")", "arg_5", ".", "Func", "(", ")", "click", ".", "echo", "(", "blue", "(", "'\\nLaunching subshell...'", ")", ")", "arg_12", "=", "sorted", "(", "arg_6", "|", "arg_7", ",", "key", "=", "_type_and_name", ")", "arg_13", "=", "':'", ".", "join", "(", "[", "arg_11", ".", "name", "for", "arg_11", "in", "arg_12", "]", ")", "shell", ".", "launch", "(", "arg_13", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''Activate an environment'''\n\n\n    if not arg_0:\n        arg_3 = click.get_current_context()\n        if cpenv.get_active_env():\n            arg_3.invoke(info)\n            return\n\n        click.echo(arg_3.get_help())\n        arg_4 = (\n            '\\nExamples: \\n'\n            '    cpenv Func my_env\\n'\n            '    cpenv Func ./relative/path/to/my_env\\n'\n            '    cpenv Func my_env my_module\\n'\n        )\n        click.echo(arg_4)\n        return\n\n    if arg_1:\n        cpenv.module_resolvers.remove(cpenv.resolver.module_resolver)\n        cpenv.module_resolvers.remove(cpenv.resolver.active_env_module_resolver)\n\n    if arg_2:\n        cpenv.module_resolvers.remove(cpenv.resolver.modules_path_resolver)\n\n    try:\n        arg_5 = cpenv.resolve(*arg_0)\n    except cpenv.ResolveError as e:\n        click.echo('\\n' + str(e))\n        return\n\n    arg_6 = set(arg_5.resolved)\n    arg_7 = set()\n    arg_8 = cpenv.get_active_env()\n    if arg_8:\n        arg_7.add(arg_8)\n    arg_7.update(cpenv.get_active_modules())\n\n    arg_9 = arg_6 - arg_7\n    arg_10 = arg_7 & arg_6\n\n    if arg_10 and not arg_9:\n        click.echo(\n            '\\nModules already active: '\n            + bold(' '.join([arg_11.name for arg_11 in arg_10]))\n        )\n        return\n\n    if arg_8 and contains_env(arg_9):\n        click.echo('\\nUse bold(exit) to leave your active environment first.')\n        return\n\n    click.echo('\\nResolved the following modules...')\n    click.echo(format_objects(arg_5.resolved))\n    arg_5.Func()\n    click.echo(blue('\\nLaunching subshell...'))\n\n    arg_12 = sorted(arg_6 | arg_7, key=_type_and_name)\n    arg_13 = ':'.join([arg_11.name for arg_11 in arg_12])\n    shell.launch(arg_13)", "path": "cpenv/cli.py", "identifier": "activate", "docstring": "Activate an environment", "docstring_tokens": ["Activate", "an", "environment"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 257808}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/log.py#L20-L27", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Produce a summarized record name\n          i.e. manticore.core.executor -> m.c.executor", "language": "python", "parameters": "(self, name)", "return_statement": "return f'{prefix}.{components[-1]}'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split", "(", "'.'", ")", "arg_3", "=", "'.'", ".", "join", "(", "c", "[", "0", "]", "for", "c", "in", "arg_2", "[", ":", "-", "1", "]", ")", "return", "f'{prefix}.{components[-1]}'"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Produce a summarized record name\n          i.e. manticore.core.executor -> m.c.executor\n        \"\"\"\n        arg_2 = arg_1.split('.')\n        arg_3 = '.'.join(c[0] for c in arg_2[:-1])\n        return f'{prefix}.{components[-1]}'", "path": "manticore/utils/log.py", "identifier": "ContextFilter.summarized_name", "docstring": "Produce a summarized record name\n          i.e. manticore.core.executor -> m.c.executor", "docstring_tokens": ["Produce", "a", "summarized", "record", "name", "i", ".", "e", ".", "manticore", ".", "core", ".", "executor", "-", ">", "m", ".", "c", ".", "executor"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257809}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L772-L788", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle successful response to the roster request.", "language": "python", "parameters": "(self, stanza)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_payload", "(", "RosterPayload", ")", "if", "arg_2", "is", "None", ":", "if", "\"versioning\"", "in", "arg_0", ".", "server_features", "and", "arg_0", ".", "roster", ":", "logger", ".", "debug", "(", "\"Server will send roster delta in pushes\"", ")", "else", ":", "logger", ".", "warning", "(", "\"Bad roster response (no payload)\"", ")", "arg_0", ".", "_event_queue", ".", "put", "(", "RosterNotReceivedEvent", "(", "arg_0", ",", "arg_1", ")", ")", "return", "else", ":", "arg_3", "=", "list", "(", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "arg_4", ".", "verify_roster_result", "(", "True", ")", "arg_0", ".", "roster", "=", "Roster", "(", "arg_3", ",", "arg_2", ".", "version", ")", "arg_0", ".", "_event_queue", ".", "put", "(", "RosterReceivedEvent", "(", "arg_0", ",", "arg_0", ".", "roster", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Handle successful response to the roster request.\n        \"\"\"\n        arg_2 = arg_1.get_payload(RosterPayload)\n        if arg_2 is None:\n            if \"versioning\" in arg_0.server_features and arg_0.roster:\n                logger.debug(\"Server will send roster delta in pushes\")\n            else:\n                logger.warning(\"Bad roster response (no payload)\")\n                arg_0._event_queue.put(RosterNotReceivedEvent(arg_0, arg_1))\n                return\n        else:\n            arg_3 = list(arg_2)\n            for arg_4 in arg_3:\n                arg_4.verify_roster_result(True)\n            arg_0.roster = Roster(arg_3, arg_2.version)\n        arg_0._event_queue.put(RosterReceivedEvent(arg_0, arg_0.roster))", "path": "pyxmpp2/roster.py", "identifier": "RosterClient._get_success", "docstring": "Handle successful response to the roster request.", "docstring_tokens": ["Handle", "successful", "response", "to", "the", "roster", "request", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257810}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L92-L94", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Adds a track to the queue.", "language": "python", "parameters": "(self, requester: int, track: dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ")", ":", "arg_0", ".", "queue", ".", "append", "(", "AudioTrack", "(", ")", ".", "build", "(", "arg_3", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4):\r\n        \"\"\" Adds a track to the queue. \"\"\"\r\n        arg_0.queue.append(AudioTrack().build(arg_3, arg_1))", "path": "lavalink/PlayerManager.py", "identifier": "DefaultPlayer.add", "docstring": "Adds a track to the queue.", "docstring_tokens": ["Adds", "a", "track", "to", "the", "queue", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 257811}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L339-L406", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Get output raw data.", "language": "python", "parameters": "(self, tile, _baselevel_readonly=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "(", "BufferedTile", ",", "tuple", ")", ")", ":", "raise", "TypeError", "(", "\"'tile' must be a tuple or BufferedTile\"", ")", "if", "isinstance", "(", "arg_1", ",", "tuple", ")", ":", "arg_1", "=", "arg_0", ".", "config", ".", "output_pyramid", ".", "tile", "(", "*", "arg_1", ")", "if", "arg_2", ":", "arg_1", "=", "arg_0", ".", "config", ".", "baselevels", "[", "\"tile_pyramid\"", "]", ".", "tile", "(", "*", "arg_1", ".", "id", ")", "if", "arg_1", ".", "zoom", "not", "in", "arg_0", ".", "config", ".", "zoom_levels", ":", "return", "arg_0", ".", "config", ".", "output", ".", "empty", "(", "arg_1", ")", "if", "arg_1", ".", "crs", "!=", "arg_0", ".", "config", ".", "process_pyramid", ".", "crs", ":", "raise", "NotImplementedError", "(", "\"reprojection between processes not yet implemented\"", ")", "if", "arg_0", ".", "config", ".", "mode", "==", "\"memory\"", ":", "arg_3", "=", "arg_0", ".", "config", ".", "process_pyramid", ".", "intersecting", "(", "arg_1", ")", "[", "0", "]", "return", "arg_0", ".", "_extract", "(", "in_tile", "=", "arg_3", ",", "in_data", "=", "arg_0", ".", "_execute_using_cache", "(", "arg_3", ")", ",", "out_tile", "=", "arg_1", ")", "arg_3", "=", "arg_0", ".", "config", ".", "process_pyramid", ".", "intersecting", "(", "arg_1", ")", "[", "0", "]", "if", "arg_1", ".", "pixelbuffer", ">", "arg_0", ".", "config", ".", "output", ".", "pixelbuffer", ":", "arg_4", "=", "list", "(", "arg_0", ".", "config", ".", "output_pyramid", ".", "tiles_from_bounds", "(", "arg_1", ".", "bounds", ",", "arg_1", ".", "zoom", ")", ")", "else", ":", "arg_4", "=", "arg_0", ".", "config", ".", "output_pyramid", ".", "intersecting", "(", "arg_1", ")", "if", "arg_0", ".", "config", ".", "mode", "==", "\"readonly\"", "or", "arg_2", ":", "if", "arg_0", ".", "config", ".", "output", ".", "tiles_exist", "(", "arg_3", ")", ":", "return", "arg_0", ".", "_read_existing_output", "(", "arg_1", ",", "arg_4", ")", "else", ":", "return", "arg_0", ".", "config", ".", "output", ".", "empty", "(", "arg_1", ")", "elif", "arg_0", ".", "config", ".", "mode", "==", "\"continue\"", "and", "not", "arg_2", ":", "if", "arg_0", ".", "config", ".", "output", ".", "tiles_exist", "(", "arg_3", ")", ":", "return", "arg_0", ".", "_read_existing_output", "(", "arg_1", ",", "arg_4", ")", "else", ":", "return", "arg_0", ".", "_process_and_overwrite_output", "(", "arg_1", ",", "arg_3", ")", "elif", "arg_0", ".", "config", ".", "mode", "==", "\"overwrite\"", "and", "not", "arg_2", ":", "return", "arg_0", ".", "_process_and_overwrite_output", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Get output raw data.\n\n        This function won't work with multiprocessing, as it uses the\n        ``threading.Lock()`` class.\n\n        Parameters\n        ----------\n        tile : tuple, Tile or BufferedTile\n            If a tile index is given, a tile from the output pyramid will be\n            assumed. Tile cannot be bigger than process tile!\n\n        Returns\n        -------\n        data : NumPy array or features\n            process output\n        \"\"\"\n        if not isinstance(arg_1, (BufferedTile, tuple)):\n            raise TypeError(\"'tile' must be a tuple or BufferedTile\")\n        if isinstance(arg_1, tuple):\n            arg_1 = arg_0.config.output_pyramid.tile(*arg_1)\n        if arg_2:\n            arg_1 = arg_0.config.baselevels[\"tile_pyramid\"].tile(*arg_1.id)\n\n        # Return empty data if zoom level is outside of process zoom levels.\n        if arg_1.zoom not in arg_0.config.zoom_levels:\n            return arg_0.config.output.empty(arg_1)\n\n        # TODO implement reprojection\n        if arg_1.crs != arg_0.config.process_pyramid.crs:\n            raise NotImplementedError(\n                \"reprojection between processes not yet implemented\"\n            )\n\n        if arg_0.config.mode == \"memory\":\n            # Determine affected process Tile and check whether it is already\n            # cached.\n            arg_3 = arg_0.config.process_pyramid.intersecting(arg_1)[0]\n            return arg_0._extract(\n                in_tile=arg_3,\n                in_data=arg_0._execute_using_cache(arg_3),\n                out_tile=arg_1\n            )\n\n        # TODO: cases where tile intersects with multiple process tiles\n        arg_3 = arg_0.config.process_pyramid.intersecting(arg_1)[0]\n\n        # get output_tiles that intersect with current tile\n        if arg_1.pixelbuffer > arg_0.config.output.pixelbuffer:\n            arg_4 = list(arg_0.config.output_pyramid.tiles_from_bounds(\n                arg_1.bounds, arg_1.zoom\n            ))\n        else:\n            arg_4 = arg_0.config.output_pyramid.intersecting(arg_1)\n\n        if arg_0.config.mode == \"readonly\" or arg_2:\n            if arg_0.config.output.tiles_exist(arg_3):\n                return arg_0._read_existing_output(arg_1, arg_4)\n            else:\n                return arg_0.config.output.empty(arg_1)\n        elif arg_0.config.mode == \"continue\" and not arg_2:\n            if arg_0.config.output.tiles_exist(arg_3):\n                return arg_0._read_existing_output(arg_1, arg_4)\n            else:\n                return arg_0._process_and_overwrite_output(arg_1, arg_3)\n        elif arg_0.config.mode == \"overwrite\" and not arg_2:\n            return arg_0._process_and_overwrite_output(arg_1, arg_3)", "path": "mapchete/_core.py", "identifier": "Mapchete.get_raw_output", "docstring": "Get output raw data.\n\n        This function won't work with multiprocessing, as it uses the\n        ``threading.Lock()`` class.\n\n        Parameters\n        ----------\n        tile : tuple, Tile or BufferedTile\n            If a tile index is given, a tile from the output pyramid will be\n            assumed. Tile cannot be bigger than process tile!\n\n        Returns\n        -------\n        data : NumPy array or features\n            process output", "docstring_tokens": ["Get", "output", "raw", "data", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 257812}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/validation/base.py#L201-L224", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Create a patched Schema for validating models.", "language": "python", "parameters": "(schema_cls)", "return_statement": "return validation_schema", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "(", ")", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "fields", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_3", ",", "ModelTypeValidator", ")", ":", "arg_4", "=", "arg_3", ".", "__class__", ".", "check_type", "arg_3", ".", "_deserialize", "=", "MethodType", "(", "arg_4", ",", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Create a patched Schema for validating models.\n\n        Model validation is not part of Marshmallow. Schemas have a ``validate``\n        method but this delegates execution on ``load`` and discards the result.\n        Similarly, ``load`` will call ``_deserialize`` on every field in the\n        schema.\n\n        This function patches the ``_deserialize`` instance method of each\n        field to make it call a custom defined method ``check_type``\n        provided by Qiskit in the different fields at\n        ``qiskit.validation.fields``.\n\n        Returns:\n            BaseSchema: a copy of the original Schema, overriding the\n                ``_deserialize()`` call of its fields.\n        \"\"\"\n        arg_1 = arg_0()\n        for arg_2, arg_3 in arg_1.fields.items():\n            if isinstance(arg_3, ModelTypeValidator):\n                arg_4 = arg_3.__class__.check_type\n                arg_3._deserialize = MethodType(arg_4, arg_3)\n\n        return arg_1", "path": "qiskit/validation/base.py", "identifier": "_SchemaBinder._create_validation_schema", "docstring": "Create a patched Schema for validating models.\n\n        Model validation is not part of Marshmallow. Schemas have a ``validate``\n        method but this delegates execution on ``load`` and discards the result.\n        Similarly, ``load`` will call ``_deserialize`` on every field in the\n        schema.\n\n        This function patches the ``_deserialize`` instance method of each\n        field to make it call a custom defined method ``check_type``\n        provided by Qiskit in the different fields at\n        ``qiskit.validation.fields``.\n\n        Returns:\n            BaseSchema: a copy of the original Schema, overriding the\n                ``_deserialize()`` call of its fields.", "docstring_tokens": ["Create", "a", "patched", "Schema", "for", "validating", "models", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257813}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1794-L1835", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Save parameters into `ckpt` file.", "language": "python", "parameters": "(\n        sess=None, mode_name='model.ckpt', save_dir='checkpoint', var_list=None, global_step=None, printable=False\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "'model.ckpt'", ",", "arg_2", "=", "'checkpoint'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "if", "arg_0", "is", "None", ":", "raise", "ValueError", "(", "\"session is None.\"", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "[", "]", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_1", ")", "if", "arg_3", "==", "[", "]", ":", "arg_3", "=", "tf", ".", "global_variables", "(", ")", "logging", ".", "info", "(", "\"[*] save %s n_params: %d\"", "%", "(", "arg_6", ",", "len", "(", "arg_3", ")", ")", ")", "if", "arg_5", ":", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_3", ")", ":", "logging", ".", "info", "(", "\"  param {:3}: {:15}   {}\"", ".", "format", "(", "arg_7", ",", "arg_8", ".", "name", ",", "str", "(", "arg_8", ".", "get_shape", "(", ")", ")", ")", ")", "arg_9", "=", "tf", ".", "train", ".", "Saver", "(", "arg_3", ")", "arg_9", ".", "save", "(", "arg_0", ",", "arg_6", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(\n        arg_0=None, arg_1='model.ckpt', arg_2='checkpoint', arg_3=None, arg_4=None, arg_5=False\n):\n    \"\"\"Save parameters into `ckpt` file.\n\n    Parameters\n    ------------\n    sess : Session\n        TensorFlow Session.\n    mode_name : str\n        The name of the model, default is ``model.ckpt``.\n    save_dir : str\n        The path / file directory to the `ckpt`, default is ``checkpoint``.\n    var_list : list of tensor\n        The parameters / variables (tensor) to be saved. If empty, save all global variables (default).\n    global_step : int or None\n        Step number.\n    printable : boolean\n        Whether to print all parameters information.\n\n    See Also\n    --------\n    load_ckpt\n\n    \"\"\"\n    if arg_0 is None:\n        raise ValueError(\"session is None.\")\n    if arg_3 is None:\n        arg_3 = []\n\n    arg_6 = os.path.join(arg_2, arg_1)\n    if arg_3 == []:\n        arg_3 = tf.global_variables()\n\n    logging.info(\"[*] save %s n_params: %d\" % (arg_6, len(arg_3)))\n\n    if arg_5:\n        for arg_7, arg_8 in enumerate(arg_3):\n            logging.info(\"  param {:3}: {:15}   {}\".format(arg_7, arg_8.name, str(arg_8.get_shape())))\n\n    arg_9 = tf.train.Saver(arg_3)\n    arg_9.save(arg_0, arg_6, arg_4=arg_4)", "path": "tensorlayer/files/utils.py", "identifier": "save_ckpt", "docstring": "Save parameters into `ckpt` file.\n\n    Parameters\n    ------------\n    sess : Session\n        TensorFlow Session.\n    mode_name : str\n        The name of the model, default is ``model.ckpt``.\n    save_dir : str\n        The path / file directory to the `ckpt`, default is ``checkpoint``.\n    var_list : list of tensor\n        The parameters / variables (tensor) to be saved. If empty, save all global variables (default).\n    global_step : int or None\n        Step number.\n    printable : boolean\n        Whether to print all parameters information.\n\n    See Also\n    --------\n    load_ckpt", "docstring_tokens": ["Save", "parameters", "into", "ckpt", "file", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 257814}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L1030-L1032", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Prepend a copy of the specified element as a child.", "language": "python", "parameters": "(self, elem)", "return_statement": "return XMLElement(lib.lsl_prepend_copy(self.e, elem.e))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "XMLElement", "(", "lib", ".", "lsl_Func", "(", "arg_0", ".", "e", ",", "arg_1", ".", "e", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Prepend a copy of the specified element as a child.\"\"\"\n        return XMLElement(lib.lsl_Func(arg_0.e, arg_1.e))", "path": "pylsl/pylsl.py", "identifier": "XMLElement.prepend_copy", "docstring": "Prepend a copy of the specified element as a child.", "docstring_tokens": ["Prepend", "a", "copy", "of", "the", "specified", "element", "as", "a", "child", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 257815}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/iir_design_helper.py#L301-L312", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Cascade frequency response\r\n    \r\n    Mark Wickert October 2016", "language": "python", "parameters": "(sos,w)", "return_statement": "return w, Hcas", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "shape", "arg_1", ",", "arg_4", "=", "signal", ".", "freqz", "(", "arg_0", "[", "0", ",", ":", "3", "]", ",", "arg_0", "[", "0", ",", "3", ":", "]", ",", "arg_1", ")", "for", "arg_5", "in", "range", "(", "1", ",", "arg_2", ")", ":", "arg_1", ",", "arg_6", "=", "signal", ".", "freqz", "(", "arg_0", "[", "arg_5", ",", ":", "3", "]", ",", "arg_0", "[", "arg_5", ",", "3", ":", "]", ",", "arg_1", ")", "arg_4", "*=", "arg_6", "return", "arg_1", ",", "arg_4"], "function": "def Func(arg_0,arg_1):\r\n    \"\"\"\r\n    Cascade frequency response\r\n    \r\n    Mark Wickert October 2016\r\n    \"\"\"\r\n    arg_2,arg_3 = arg_0.shape\r\n    arg_1,arg_4 = signal.freqz(arg_0[0,:3],arg_0[0,3:],arg_1)\r\n    for arg_5 in range(1,arg_2):\r\n        arg_1,arg_6 = signal.freqz(arg_0[arg_5,:3],arg_0[arg_5,3:],arg_1)\r\n        arg_4 *= arg_6\r\n    return arg_1, arg_4", "path": "sk_dsp_comm/iir_design_helper.py", "identifier": "freqz_cas", "docstring": "Cascade frequency response\r\n    \r\n    Mark Wickert October 2016", "docstring_tokens": ["Cascade", "frequency", "response", "Mark", "Wickert", "October", "2016"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 257816}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/api.py#L54-L103", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Decorator to mark a method as an API endpoint for later registration.", "language": "python", "parameters": "(path_or_func=None, decorate=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "True", ")", ":", "def", "maybe_decorated", "(", "arg_2", ")", ":", "if", "arg_1", ":", "for", "arg_3", "in", "API_ENDPOINT_DECORATORS", ":", "arg_2", "=", "arg_3", "(", ")", "(", "arg_2", ")", "return", "arg_2", "if", "callable", "(", "arg_0", ")", ":", "arg_0", ".", "api_path", "=", "arg_0", ".", "__name__", "return", "maybe_decorated", "(", "arg_0", ")", "else", ":", "def", "_Func", "(", "arg_2", ")", ":", "if", "arg_0", "is", "None", ":", "arg_2", ".", "api_path", "=", "arg_2", ".", "__name__", "else", ":", "arg_2", ".", "api_path", "=", "arg_0", "return", "maybe_decorated", "(", "arg_2", ")", "return", "_Func"], "function": "def Func(arg_0=None, arg_1=True):\n    \"\"\"\n    Decorator to mark a method as an API endpoint for later registration.\n\n    Args:\n        path_or_func: either the function to be decorated or its API path.\n        decorate (bool): Apply API_ENDPOINT_DECORATORS if True (default).\n\n    Returns:\n        Callable: Decorated function (with optionally applied decorators).\n\n    Examples:\n\n        >>> from dddp.api import APIMixin, Func\n        >>> class Counter(APIMixin):\n        ...     value = 0\n        ...\n        ...     # default API path matches function name 'increment'.\n        ...     @Func\n        ...     def increment(self, amount):\n        ...         '''Increment counter value by `amount`.'''\n        ...         self.value += amount\n        ...         return self.value\n        ...\n        ...     # excplicitly set API path to 'Decrement'.\n        ...     @Func('Decrement')\n        ...     def decrement(self, amount):\n        ...         '''Decrement counter value by `amount`.'''\n        ...         self.value -= amount\n        ...         return self.value\n\n    \"\"\"\n    def maybe_decorated(arg_2):\n        \"\"\"Apply API_ENDPOINT_DECORATORS to func.\"\"\"\n        if arg_1:\n            for arg_3 in API_ENDPOINT_DECORATORS:\n                arg_2 = arg_3()(arg_2)\n        return arg_2\n    if callable(arg_0):\n        arg_0.api_path = arg_0.__name__\n        return maybe_decorated(arg_0)\n    else:\n        def _Func(arg_2):\n            \"\"\"Decorator inner.\"\"\"\n            if arg_0 is None:\n                arg_2.api_path = arg_2.__name__\n            else:\n                arg_2.api_path = arg_0\n            return maybe_decorated(arg_2)\n        return _Func", "path": "dddp/api.py", "identifier": "api_endpoint", "docstring": "Decorator to mark a method as an API endpoint for later registration.\n\n    Args:\n        path_or_func: either the function to be decorated or its API path.\n        decorate (bool): Apply API_ENDPOINT_DECORATORS if True (default).\n\n    Returns:\n        Callable: Decorated function (with optionally applied decorators).\n\n    Examples:\n\n        >>> from dddp.api import APIMixin, api_endpoint\n        >>> class Counter(APIMixin):\n        ...     value = 0\n        ...\n        ...     # default API path matches function name 'increment'.\n        ...     @api_endpoint\n        ...     def increment(self, amount):\n        ...         '''Increment counter value by `amount`.'''\n        ...         self.value += amount\n        ...         return self.value\n        ...\n        ...     # excplicitly set API path to 'Decrement'.\n        ...     @api_endpoint('Decrement')\n        ...     def decrement(self, amount):\n        ...         '''Decrement counter value by `amount`.'''\n        ...         self.value -= amount\n        ...         return self.value", "docstring_tokens": ["Decorator", "to", "mark", "a", "method", "as", "an", "API", "endpoint", "for", "later", "registration", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 257817}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/bbs.py#L350-L370", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Estimate whether the bounding box is fully inside the image area.", "language": "python", "parameters": "(self, image)", "return_statement": "return self.x1 >= 0 and self.x2 < width and self.y1 >= 0 and self.y2 < height", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "normalize_shape", "(", "arg_1", ")", "arg_3", ",", "arg_4", "=", "arg_2", "[", "0", ":", "2", "]", "return", "arg_0", ".", "x1", ">=", "0", "and", "arg_0", ".", "x2", "<", "arg_4", "and", "arg_0", ".", "y1", ">=", "0", "and", "arg_0", ".", "y2", "<", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Estimate whether the bounding box is fully inside the image area.\n\n        Parameters\n        ----------\n        image : (H,W,...) ndarray or tuple of int\n            Image dimensions to use.\n            If an ndarray, its shape will be used.\n            If a tuple, it is assumed to represent the image shape\n            and must contain at least two integers.\n\n        Returns\n        -------\n        bool\n            True if the bounding box is fully inside the image area. False otherwise.\n\n        \"\"\"\n        arg_2 = normalize_shape(arg_1)\n        arg_3, arg_4 = arg_2[0:2]\n        return arg_0.x1 >= 0 and arg_0.x2 < arg_4 and arg_0.y1 >= 0 and arg_0.y2 < arg_3", "path": "imgaug/augmentables/bbs.py", "identifier": "BoundingBox.is_fully_within_image", "docstring": "Estimate whether the bounding box is fully inside the image area.\n\n        Parameters\n        ----------\n        image : (H,W,...) ndarray or tuple of int\n            Image dimensions to use.\n            If an ndarray, its shape will be used.\n            If a tuple, it is assumed to represent the image shape\n            and must contain at least two integers.\n\n        Returns\n        -------\n        bool\n            True if the bounding box is fully inside the image area. False otherwise.", "docstring_tokens": ["Estimate", "whether", "the", "bounding", "box", "is", "fully", "inside", "the", "image", "area", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 257818}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/mixture.py#L448-L495", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "r\"\"\"A lower bound on the entropy of this mixture model.", "language": "python", "parameters": "(self, name=\"entropy_lower_bound\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Func\"", ")", ":", "with", "arg_0", ".", "_name_scope", "(", "arg_1", ")", ":", "with", "tf", ".", "control_dependencies", "(", "arg_0", ".", "_assertions", ")", ":", "arg_2", "=", "[", "d", ".", "entropy", "(", ")", "for", "d", "in", "arg_0", ".", "components", "]", "arg_3", "=", "arg_0", ".", "_cat_probs", "(", "log_probs", "=", "False", ")", "arg_4", "=", "[", "c_p", "*", "m", "for", "(", "c_p", ",", "m", ")", "in", "zip", "(", "arg_3", ",", "arg_2", ")", "]", "return", "tf", ".", "add_n", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1=\"Func\"):\n    r\"\"\"A lower bound on the entropy of this mixture model.\n\n    The bound below is not always very tight, and its usefulness depends\n    on the mixture probabilities and the components in use.\n\n    A lower bound is useful for ELBO when the `Mixture` is the variational\n    distribution:\n\n    \\\\(\n    \\log p(x) >= ELBO = \\int q(z) \\log p(x, z) dz + H[q]\n    \\\\)\n\n    where \\\\( p \\\\) is the prior distribution, \\\\( q \\\\) is the variational,\n    and \\\\( H[q] \\\\) is the entropy of \\\\( q \\\\). If there is a lower bound\n    \\\\( G[q] \\\\) such that \\\\( H[q] \\geq G[q] \\\\) then it can be used in\n    place of \\\\( H[q] \\\\).\n\n    For a mixture of distributions \\\\( q(Z) = \\sum_i c_i q_i(Z) \\\\) with\n    \\\\( \\sum_i c_i = 1 \\\\), by the concavity of \\\\( f(x) = -x \\log x \\\\), a\n    simple lower bound is:\n\n    \\\\(\n    \\begin{align}\n    H[q] & = - \\int q(z) \\log q(z) dz \\\\\\\n       & = - \\int (\\sum_i c_i q_i(z)) \\log(\\sum_i c_i q_i(z)) dz \\\\\\\n       & \\geq - \\sum_i c_i \\int q_i(z) \\log q_i(z) dz \\\\\\\n       & = \\sum_i c_i H[q_i]\n    \\end{align}\n    \\\\)\n\n    This is the term we calculate below for \\\\( G[q] \\\\).\n\n    Args:\n      name: A name for this operation (optional).\n\n    Returns:\n      A lower bound on the Mixture's entropy.\n    \"\"\"\n    with arg_0._name_scope(arg_1):\n      with tf.control_dependencies(arg_0._assertions):\n        arg_2 = [d.entropy() for d in arg_0.components]\n        arg_3 = arg_0._cat_probs(log_probs=False)\n        arg_4 = [\n            c_p * m for (c_p, m) in zip(arg_3, arg_2)\n        ]\n        # These are all the same shape by virtue of matching batch_shape\n        return tf.add_n(arg_4)", "path": "tensorflow_probability/python/distributions/mixture.py", "identifier": "Mixture.entropy_lower_bound", "docstring": "r\"\"\"A lower bound on the entropy of this mixture model.\n\n    The bound below is not always very tight, and its usefulness depends\n    on the mixture probabilities and the components in use.\n\n    A lower bound is useful for ELBO when the `Mixture` is the variational\n    distribution:\n\n    \\\\(\n    \\log p(x) >= ELBO = \\int q(z) \\log p(x, z) dz + H[q]\n    \\\\)\n\n    where \\\\( p \\\\) is the prior distribution, \\\\( q \\\\) is the variational,\n    and \\\\( H[q] \\\\) is the entropy of \\\\( q \\\\). If there is a lower bound\n    \\\\( G[q] \\\\) such that \\\\( H[q] \\geq G[q] \\\\) then it can be used in\n    place of \\\\( H[q] \\\\).\n\n    For a mixture of distributions \\\\( q(Z) = \\sum_i c_i q_i(Z) \\\\) with\n    \\\\( \\sum_i c_i = 1 \\\\), by the concavity of \\\\( f(x) = -x \\log x \\\\), a\n    simple lower bound is:\n\n    \\\\(\n    \\begin{align}\n    H[q] & = - \\int q(z) \\log q(z) dz \\\\\\\n       & = - \\int (\\sum_i c_i q_i(z)) \\log(\\sum_i c_i q_i(z)) dz \\\\\\\n       & \\geq - \\sum_i c_i \\int q_i(z) \\log q_i(z) dz \\\\\\\n       & = \\sum_i c_i H[q_i]\n    \\end{align}\n    \\\\)\n\n    This is the term we calculate below for \\\\( G[q] \\\\).\n\n    Args:\n      name: A name for this operation (optional).\n\n    Returns:\n      A lower bound on the Mixture's entropy.", "docstring_tokens": ["r", "A", "lower", "bound", "on", "the", "entropy", "of", "this", "mixture", "model", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257819}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/hdlSimulator.py#L532-L536", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Add process to events with default priority on current time", "language": "python", "parameters": "(self, proc)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", "->", "None", ":", "arg_0", ".", "_events", ".", "push", "(", "arg_0", ".", "now", ",", "PRIORITY_NORMAL", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1) -> None:\n        \"\"\"\n        Add process to events with default priority on current time\n        \"\"\"\n        arg_0._events.push(arg_0.now, PRIORITY_NORMAL, arg_1)", "path": "hwt/simulator/hdlSimulator.py", "identifier": "HdlSimulator.add_process", "docstring": "Add process to events with default priority on current time", "docstring_tokens": ["Add", "process", "to", "events", "with", "default", "priority", "on", "current", "time"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 257820}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1325-L1386", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots turnover vs. date.", "language": "python", "parameters": "(returns, transactions, positions,\n                  legend_loc='best', ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'best'", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "plt", ".", "gca", "(", ")", "arg_6", "=", "FuncFormatter", "(", "utils", ".", "two_dec_places", ")", "arg_4", ".", "yaxis", ".", "set_major_formatter", "(", "FuncFormatter", "(", "arg_6", ")", ")", "arg_7", "=", "txn", ".", "get_turnover", "(", "arg_2", ",", "arg_1", ")", "arg_8", "=", "arg_7", ".", "resample", "(", "\"M\"", ")", ".", "mean", "(", ")", "arg_7", ".", "plot", "(", "color", "=", "'steelblue'", ",", "alpha", "=", "1.0", ",", "lw", "=", "0.5", ",", "arg_4", "=", "arg_4", ",", "**", "arg_5", ")", "arg_8", ".", "plot", "(", "color", "=", "'orangered'", ",", "alpha", "=", "0.5", ",", "lw", "=", "2", ",", "arg_4", "=", "arg_4", ",", "**", "arg_5", ")", "arg_4", ".", "axhline", "(", "arg_7", ".", "mean", "(", ")", ",", "color", "=", "'steelblue'", ",", "linestyle", "=", "'--'", ",", "lw", "=", "3", ",", "alpha", "=", "1.0", ")", "arg_4", ".", "legend", "(", "[", "'Daily turnover'", ",", "'Average daily turnover, by month'", ",", "'Average daily turnover, net'", "]", ",", "loc", "=", "arg_3", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "arg_4", ".", "set_title", "(", "'Daily turnover'", ")", "arg_4", ".", "set_xlim", "(", "(", "arg_0", ".", "index", "[", "0", "]", ",", "arg_0", ".", "index", "[", "-", "1", "]", ")", ")", "arg_4", ".", "set_ylim", "(", "(", "0", ",", "2", ")", ")", "arg_4", ".", "set_ylabel", "(", "'Turnover'", ")", "arg_4", ".", "set_xlabel", "(", "''", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2,\n                  arg_3='best', arg_4=None, **arg_5):\n    \"\"\"\n    Plots turnover vs. date.\n\n    Turnover is the number of shares traded for a period as a fraction\n    of total shares.\n\n    Displays daily total, daily average per month, and all-time daily\n    average.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    legend_loc : matplotlib.loc, optional\n        The location of the legend on the plot.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_4 is None:\n        arg_4 = plt.gca()\n\n    arg_6 = FuncFormatter(utils.two_dec_places)\n    arg_4.yaxis.set_major_formatter(FuncFormatter(arg_6))\n\n    arg_7 = txn.get_turnover(arg_2, arg_1)\n    arg_8 = arg_7.resample(\"M\").mean()\n    arg_7.plot(color='steelblue', alpha=1.0, lw=0.5, arg_4=arg_4, **arg_5)\n    arg_8.plot(\n        color='orangered',\n        alpha=0.5,\n        lw=2,\n        arg_4=arg_4,\n        **arg_5)\n    arg_4.axhline(\n        arg_7.mean(), color='steelblue', linestyle='--', lw=3, alpha=1.0)\n    arg_4.legend(['Daily turnover',\n               'Average daily turnover, by month',\n               'Average daily turnover, net'],\n              loc=arg_3, frameon=True, framealpha=0.5)\n    arg_4.set_title('Daily turnover')\n    arg_4.set_xlim((arg_0.index[0], arg_0.index[-1]))\n    arg_4.set_ylim((0, 2))\n    arg_4.set_ylabel('Turnover')\n    arg_4.set_xlabel('')\n    return arg_4", "path": "pyfolio/plotting.py", "identifier": "plot_turnover", "docstring": "Plots turnover vs. date.\n\n    Turnover is the number of shares traded for a period as a fraction\n    of total shares.\n\n    Displays daily total, daily average per month, and all-time daily\n    average.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in tears.create_full_tear_sheet.\n    legend_loc : matplotlib.loc, optional\n        The location of the legend on the plot.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "turnover", "vs", ".", "date", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257821}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L272-L289", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Add node from id and return the node object.", "language": "python", "parameters": "(self, id, radius=8, style=style.DEFAULT, category=\"\", label=None, root=False,\n                 properties={})", "return_statement": "return n", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "8", ",", "arg_3", "=", "arg_3", ".", "DEFAULT", ",", "arg_5", "=", "\"\"", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "{", "}", ")", ":", "if", "arg_0", ".", "has_key", "(", "arg_1", ")", ":", "return", "arg_0", "[", "arg_1", "]", "if", "not", "isinstance", "(", "arg_3", ",", "str", ")", "and", "arg_3", ".", "__dict__", ".", "has_key", "[", "\"name\"", "]", ":", "arg_3", "=", "arg_3", ".", "name", "arg_9", "=", "node", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_5", ",", "arg_6", ",", "arg_8", ")", "arg_0", "[", "arg_9", ".", "id", "]", "=", "arg_9", "arg_0", ".", "nodes", ".", "append", "(", "arg_9", ")", "if", "arg_7", ":", "arg_0", ".", "root", "=", "arg_9", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2=8, arg_3=arg_3.DEFAULT, arg_5=\"\", arg_6=None, arg_7=False,\n                 arg_8={}):\n        \n        \"\"\" Add node from id and return the node object.\n        \"\"\"\n        \n        if arg_0.has_key(arg_1): \n            return arg_0[arg_1]\n            \n        if not isinstance(arg_3, str) and arg_3.__dict__.has_key[\"name\"]:\n            arg_3 = arg_3.name\n        \n        arg_9 = node(arg_0, arg_1, arg_2, arg_3, arg_5, arg_6, arg_8)\n        arg_0[arg_9.id] = arg_9\n        arg_0.nodes.append(arg_9)\n        if arg_7: arg_0.root = arg_9\n            \n        return arg_9", "path": "lib/graph/__init__.py", "identifier": "graph.add_node", "docstring": "Add node from id and return the node object.", "docstring_tokens": ["Add", "node", "from", "id", "and", "return", "the", "node", "object", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257822}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L447-L461", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get user and org data for the login", "language": "python", "parameters": "(self, login)", "return_statement": "return user", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "if", "not", "arg_1", ":", "return", "arg_2", "arg_3", "=", "arg_0", ".", "client", ".", "user", "(", "arg_1", ")", "arg_2", "=", "json", ".", "loads", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "client", ".", "user_orgs", "(", "arg_1", ")", "arg_2", "[", "'organizations'", "]", "=", "json", ".", "loads", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get user and org data for the login\"\"\"\n\n        arg_2 = {}\n\n        if not arg_1:\n            return arg_2\n\n        arg_3 = arg_0.client.user(arg_1)\n        arg_2 = json.loads(arg_3)\n        arg_4 = \\\n            arg_0.client.user_orgs(arg_1)\n        arg_2['organizations'] = json.loads(arg_4)\n\n        return arg_2", "path": "perceval/backends/core/github.py", "identifier": "GitHub.__get_user", "docstring": "Get user and org data for the login", "docstring_tokens": ["Get", "user", "and", "org", "data", "for", "the", "login"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257823}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth1.py#L696-L700", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Redirect uri for this request token.", "language": "python", "parameters": "(self, token, request)", "return_statement": "return tok.redirect_uri", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "log", ".", "debug", "(", "'Get redirect uri of %r'", ",", "arg_1", ")", "arg_3", "=", "arg_2", ".", "request_token", "or", "arg_0", ".", "_grantgetter", "(", "arg_1", "=", "arg_1", ")", "return", "arg_3", ".", "redirect_uri"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Redirect uri for this request token.\"\"\"\n        log.debug('Get redirect uri of %r', arg_1)\n        arg_3 = arg_2.request_token or arg_0._grantgetter(arg_1=arg_1)\n        return arg_3.redirect_uri", "path": "flask_oauthlib/provider/oauth1.py", "identifier": "OAuth1RequestValidator.get_redirect_uri", "docstring": "Redirect uri for this request token.", "docstring_tokens": ["Redirect", "uri", "for", "this", "request", "token", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 257824}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L248-L367", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Builds a pipeline configuration for execution.", "language": "python", "parameters": "(cls, project, zones, min_cores, min_ram, disk_size,\n                     boot_disk_size, preemptible, accelerator_type,\n                     accelerator_count, image, script_name, envs, inputs,\n                     outputs, pipeline_name)", "return_statement": "return {\n        'ephemeralPipeline': {\n            'projectId': project,\n            'name': pipeline_name,\n\n            # Define the resources needed for this pipeline.\n            'resources': {\n                'minimumCpuCores': min_cores,\n                'minimumRamGb': min_ram,\n                'bootDiskSizeGb': boot_disk_size,\n                'preemptible': preemptible,\n                'zones': google_base.get_zones(zones),\n                'acceleratorType': accelerator_type,\n                'acceleratorCount': accelerator_count,\n\n                # Create a data disk that is attached to the VM and destroyed\n                # when the pipeline terminates.\n                'disks': [{\n                    'name': 'datadisk',\n                    'autoDelete': True,\n                    'sizeGb': disk_size,\n                    'mountPoint': providers_util.DATA_MOUNT_POINT,\n                }],\n            },\n\n            'inputParameters': input_envs + input_files,\n            'outputParameters': output_files,\n\n            'docker': {\n                'imageName': image,\n                'cmd': docker_command,\n            }\n        }\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "job_model", ".", "DEFAULT_MIN_CORES", "if", "arg_4", "is", "None", ":", "arg_4", "=", "job_model", ".", "DEFAULT_MIN_RAM", "if", "arg_5", "is", "None", ":", "arg_5", "=", "job_model", ".", "DEFAULT_DISK_SIZE", "if", "arg_6", "is", "None", ":", "arg_6", "=", "job_model", ".", "DEFAULT_BOOT_DISK_SIZE", "if", "arg_7", "is", "None", ":", "arg_7", "=", "job_model", ".", "DEFAULT_PREEMPTIBLE", "arg_16", "=", "arg_0", ".", "_Func_docker_command", "(", "arg_11", ",", "arg_13", ",", "arg_14", ",", "arg_12", ")", "arg_17", "=", "[", "{", "'name'", ":", "SCRIPT_VARNAME", "}", "]", "+", "[", "{", "'name'", ":", "env", ".", "name", "}", "for", "env", "in", "arg_12", "if", "env", ".", "value", "]", "arg_18", "=", "[", "arg_0", ".", "_Func_input_file_param", "(", "var", ".", "name", ",", "var", ".", "docker_path", ")", "for", "var", "in", "arg_13", "if", "not", "var", ".", "recursive", "and", "var", ".", "value", "]", "arg_19", "=", "[", "arg_0", ".", "_Func_file_param", "(", "var", ".", "name", ",", "var", ".", "docker_path", ")", "for", "var", "in", "arg_14", "if", "not", "var", ".", "recursive", "and", "var", ".", "value", "]", "return", "{", "'ephemeralPipeline'", ":", "{", "'projectId'", ":", "arg_1", ",", "'name'", ":", "arg_15", ",", "'resources'", ":", "{", "'minimumCpuCores'", ":", "arg_3", ",", "'minimumRamGb'", ":", "arg_4", ",", "'bootDiskSizeGb'", ":", "arg_6", ",", "'preemptible'", ":", "arg_7", ",", "'zones'", ":", "google_base", ".", "get_zones", "(", "arg_2", ")", ",", "'acceleratorType'", ":", "arg_8", ",", "'acceleratorCount'", ":", "arg_9", ",", "'disks'", ":", "[", "{", "'name'", ":", "'datadisk'", ",", "'autoDelete'", ":", "True", ",", "'sizeGb'", ":", "arg_5", ",", "'mountPoint'", ":", "providers_util", ".", "DATA_MOUNT_POINT", ",", "}", "]", ",", "}", ",", "'inputParameters'", ":", "arg_17", "+", "arg_18", ",", "'outputParameters'", ":", "arg_19", ",", "'docker'", ":", "{", "'imageName'", ":", "arg_10", ",", "'cmd'", ":", "arg_16", ",", "}", "}", "}"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5,\n                     arg_6, arg_7, arg_8,\n                     arg_9, arg_10, arg_11, arg_12, arg_13,\n                     arg_14, arg_15):\n    \"\"\"Builds a pipeline configuration for execution.\n\n    Args:\n      project: string name of project.\n      zones: list of zone names for jobs to be run at.\n      min_cores: int number of CPU cores required per job.\n      min_ram: int GB of RAM required per job.\n      disk_size: int GB of disk to attach under /mnt/data.\n      boot_disk_size: int GB of disk for boot.\n      preemptible: use a preemptible VM for the job\n      accelerator_type: string GCE defined accelerator type.\n      accelerator_count: int number of accelerators of the specified type to\n        attach.\n      image: string Docker image name in which to run.\n      script_name: file name of the script to run.\n      envs: list of EnvParam objects specifying environment variables to set\n        within each job.\n      inputs: list of FileParam objects specifying input variables to set\n        within each job.\n      outputs: list of FileParam objects specifying output variables to set\n        within each job.\n      pipeline_name: string name of pipeline.\n\n    Returns:\n      A nested dictionary with one entry under the key ephemeralPipeline\n      containing the pipeline configuration.\n    \"\"\"\n    if arg_3 is None:\n      arg_3 = job_model.DEFAULT_MIN_CORES\n    if arg_4 is None:\n      arg_4 = job_model.DEFAULT_MIN_RAM\n    if arg_5 is None:\n      arg_5 = job_model.DEFAULT_DISK_SIZE\n    if arg_6 is None:\n      arg_6 = job_model.DEFAULT_BOOT_DISK_SIZE\n    if arg_7 is None:\n      arg_7 = job_model.DEFAULT_PREEMPTIBLE\n\n    # Format the docker command\n    arg_16 = arg_0._Func_docker_command(arg_11, arg_13,\n                                                        arg_14, arg_12)\n\n    # Pipelines inputParameters can be both simple name/value pairs which get\n    # set as environment variables, as well as input file paths which the\n    # Pipelines controller will automatically localize to the Pipeline VM.\n\n    # In the ephemeralPipeline object, the inputParameters are only defined;\n    # the values are passed in the pipelineArgs.\n\n    # Pipelines outputParameters are only output file paths, which the\n    # Pipelines controller can automatically de-localize after the docker\n    # command completes.\n\n    # The Pipelines API does not support recursive copy of file parameters,\n    # so it is implemented within the dsub-generated pipeline.\n    # Any inputs or outputs marked as \"recursive\" are completely omitted here;\n    # their environment variables will be set in the docker command, and\n    # recursive copy code will be generated there as well.\n\n    # The Pipelines API does not accept empty environment variables. Set them to\n    # empty in DOCKER_COMMAND instead.\n    arg_17 = [{\n        'name': SCRIPT_VARNAME\n    }] + [{\n        'name': env.name\n    } for env in arg_12 if env.value]\n\n    arg_18 = [\n        arg_0._Func_input_file_param(var.name, var.docker_path)\n        for var in arg_13\n        if not var.recursive and var.value\n    ]\n\n    # Outputs are an array of file parameters\n    arg_19 = [\n        arg_0._Func_file_param(var.name, var.docker_path)\n        for var in arg_14\n        if not var.recursive and var.value\n    ]\n\n    # The ephemeralPipeline provides the template for the pipeline.\n    # pyformat: disable\n    return {\n        'ephemeralPipeline': {\n            'projectId': arg_1,\n            'name': arg_15,\n\n            # Define the resources needed for this pipeline.\n            'resources': {\n                'minimumCpuCores': arg_3,\n                'minimumRamGb': arg_4,\n                'bootDiskSizeGb': arg_6,\n                'preemptible': arg_7,\n                'zones': google_base.get_zones(arg_2),\n                'acceleratorType': arg_8,\n                'acceleratorCount': arg_9,\n\n                # Create a data disk that is attached to the VM and destroyed\n                # when the pipeline terminates.\n                'disks': [{\n                    'name': 'datadisk',\n                    'autoDelete': True,\n                    'sizeGb': arg_5,\n                    'mountPoint': providers_util.DATA_MOUNT_POINT,\n                }],\n            },\n\n            'inputParameters': arg_17 + arg_18,\n            'outputParameters': arg_19,\n\n            'docker': {\n                'imageName': arg_10,\n                'cmd': arg_16,\n            }\n        }\n    }", "path": "dsub/providers/google.py", "identifier": "_Pipelines.build_pipeline", "docstring": "Builds a pipeline configuration for execution.\n\n    Args:\n      project: string name of project.\n      zones: list of zone names for jobs to be run at.\n      min_cores: int number of CPU cores required per job.\n      min_ram: int GB of RAM required per job.\n      disk_size: int GB of disk to attach under /mnt/data.\n      boot_disk_size: int GB of disk for boot.\n      preemptible: use a preemptible VM for the job\n      accelerator_type: string GCE defined accelerator type.\n      accelerator_count: int number of accelerators of the specified type to\n        attach.\n      image: string Docker image name in which to run.\n      script_name: file name of the script to run.\n      envs: list of EnvParam objects specifying environment variables to set\n        within each job.\n      inputs: list of FileParam objects specifying input variables to set\n        within each job.\n      outputs: list of FileParam objects specifying output variables to set\n        within each job.\n      pipeline_name: string name of pipeline.\n\n    Returns:\n      A nested dictionary with one entry under the key ephemeralPipeline\n      containing the pipeline configuration.", "docstring_tokens": ["Builds", "a", "pipeline", "configuration", "for", "execution", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 257825}
{"url": "https://github.com/jaraco/tempora/blob/f0a9ab636103fe829aa9b495c93f5249aac5f2b8/tempora/schedule.py#L101-L109", "sha": "f0a9ab636103fe829aa9b495c93f5249aac5f2b8", "docstring_summary": "Rely on pytz.localize to ensure new result honors DST.", "language": "python", "parameters": "(dt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "tzinfo", "return", "arg_1", ".", "localize", "(", "arg_0", ".", "replace", "(", "tzinfo", "=", "None", ")", ")", "except", "AttributeError", ":", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"\n        Rely on pytz.localize to ensure new result honors DST.\n        \"\"\"\n        try:\n            arg_1 = arg_0.tzinfo\n            return arg_1.localize(arg_0.replace(tzinfo=None))\n        except AttributeError:\n            return arg_0", "path": "tempora/schedule.py", "identifier": "PeriodicCommand._localize", "docstring": "Rely on pytz.localize to ensure new result honors DST.", "docstring_tokens": ["Rely", "on", "pytz", ".", "localize", "to", "ensure", "new", "result", "honors", "DST", "."], "nwo": "jaraco/tempora", "score": 0.3804160374473955, "idx": 257826}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/verilog/serializer.py#L55-L95", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Due to verilog restrictions it is not posible to use array constants\n        and rom memories has to be hardcoded as process", "language": "python", "parameters": "(cls, rom)", "return_statement": "return processes, signals", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ".", "endpoints", ":", "assert", "isinstance", "(", "arg_4", ",", "Operator", ")", "and", "arg_4", ".", "operator", "==", "AllOps", ".", "INDEX", ",", "arg_4", "arg_5", ",", "arg_6", "=", "arg_4", ".", "operands", "assert", "arg_5", "is", "arg_1", "arg_7", "=", "arg_1", ".", "ctx", ".", "sig", "(", "arg_1", ".", "name", ",", "dtype", "=", "arg_4", ".", "result", ".", "_dtype", ")", "arg_3", ".", "append", "(", "arg_7", ")", "arg_7", ".", "hidden", "=", "False", "arg_9", "=", "[", "(", "toHVal", "(", "i", ")", ",", "[", "arg_7", "(", "v", ")", ",", "]", ")", "for", "i", ",", "v", "in", "enumerate", "(", "arg_1", ".", "defVal", ".", "val", ")", "]", "arg_10", "=", "[", "SwitchContainer", "(", "arg_6", ",", "arg_9", ")", ",", "]", "for", "(", "arg_11", ",", "(", "arg_12", ",", ")", ")", "in", "arg_9", ":", "arg_12", ".", "parentStm", "=", "arg_10", "[", "0", "]", "arg_14", "=", "HWProcess", "(", "arg_1", ".", "name", ",", "arg_10", ",", "{", "arg_6", ",", "}", ",", "{", "arg_6", ",", "}", ",", "{", "arg_7", ",", "}", ")", "arg_2", ".", "append", "(", "arg_14", ")", "def", "replaceOrigRomIndexExpr", "(", "arg_15", ")", ":", "if", "arg_15", "is", "arg_4", ".", "result", ":", "return", "arg_7", "else", ":", "return", "arg_15", "for", "arg_16", "in", "arg_4", ".", "result", ".", "endpoints", ":", "arg_16", ".", "operands", "=", "tuple", "(", "map", "(", "replaceOrigRomIndexExpr", ",", "arg_16", ".", "operands", ")", ")", "arg_4", ".", "result", "=", "arg_7", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Due to verilog restrictions it is not posible to use array constants\n        and rom memories has to be hardcoded as process\n        \"\"\"\n        arg_2 = []\n        arg_3 = []\n        for arg_4 in arg_1.endpoints:\n            assert isinstance(arg_4, Operator) and arg_4.operator == AllOps.INDEX, arg_4\n            arg_5, arg_6 = arg_4.operands\n            assert arg_5 is arg_1\n\n            # construct output of the rom\n            arg_7 = arg_1.ctx.sig(arg_1.name, dtype=arg_4.result._dtype)\n            arg_3.append(arg_7)\n            arg_7.hidden = False\n\n            # construct process which will represent content of the rom\n            arg_9 = [(toHVal(i), [arg_7(v), ])\n                     for i, v in enumerate(arg_1.defVal.val)]\n            arg_10 = [SwitchContainer(arg_6, arg_9), ]\n\n            for (arg_11, (arg_12, )) in arg_9:\n                arg_12.parentStm = arg_10[0] \n\n            arg_14 = HWProcess(arg_1.name, arg_10, {arg_6, },\n                          {arg_6, }, {arg_7, })\n            arg_2.append(arg_14)\n\n            # override usage of original index operator on rom\n            # to use signal generated from this process\n            def replaceOrigRomIndexExpr(arg_15):\n                if arg_15 is arg_4.result:\n                    return arg_7\n                else:\n                    return arg_15\n            for arg_16 in arg_4.result.endpoints:\n                arg_16.operands = tuple(map(replaceOrigRomIndexExpr, arg_16.operands))\n                arg_4.result = arg_7\n\n        return arg_2, arg_3", "path": "hwt/serializer/verilog/serializer.py", "identifier": "VerilogSerializer.hardcodeRomIntoProcess", "docstring": "Due to verilog restrictions it is not posible to use array constants\n        and rom memories has to be hardcoded as process", "docstring_tokens": ["Due", "to", "verilog", "restrictions", "it", "is", "not", "posible", "to", "use", "array", "constants", "and", "rom", "memories", "has", "to", "be", "hardcoded", "as", "process"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 257827}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L688-L770", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Display the logs for a given training job, optionally tailing them until the\n        job is complete.", "language": "python", "parameters": "(self, job_name, non_terminal_states, failed_states,\n                                       wait_for_completion, check_interval, max_ingestion_time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "0", "arg_8", "=", "arg_0", ".", "describe_training_job", "(", "arg_1", ")", "arg_0", ".", "log", ".", "info", "(", "secondary_training_status_message", "(", "arg_8", ",", "None", ")", ")", "arg_9", "=", "arg_8", "[", "'ResourceConfig'", "]", "[", "'InstanceCount'", "]", "arg_10", "=", "arg_8", "[", "'TrainingJobStatus'", "]", "arg_11", "=", "[", "]", "arg_12", "=", "{", "}", "arg_13", "=", "arg_10", "not", "in", "arg_2", "arg_14", "=", "LogState", ".", "TAILING", "if", "arg_4", "and", "not", "arg_13", "else", "LogState", ".", "COMPLETE", "arg_15", "=", "time", ".", "time", "(", ")", "arg_16", "=", "arg_8", "while", "True", ":", "time", ".", "sleep", "(", "arg_5", ")", "arg_7", "=", "arg_7", "+", "arg_5", "arg_14", ",", "arg_16", ",", "arg_15", "=", "arg_0", ".", "describe_training_job_with_log", "(", "arg_1", ",", "arg_12", ",", "arg_11", ",", "arg_9", ",", "arg_14", ",", "arg_16", ",", "arg_15", ")", "if", "arg_14", "==", "LogState", ".", "COMPLETE", ":", "break", "if", "arg_6", "and", "arg_7", ">", "arg_6", ":", "raise", "AirflowException", "(", "'SageMaker job took more than %s seconds'", ",", "arg_6", ")", "if", "arg_4", ":", "arg_10", "=", "arg_16", "[", "'TrainingJobStatus'", "]", "if", "arg_10", "in", "arg_3", ":", "arg_17", "=", "arg_16", ".", "get", "(", "'FailureReason'", ",", "'(No reason provided)'", ")", "raise", "AirflowException", "(", "'Error training {}: {} Reason: {}'", ".", "format", "(", "arg_1", ",", "arg_10", ",", "arg_17", ")", ")", "arg_18", "=", "(", "arg_16", "[", "'TrainingEndTime'", "]", "-", "arg_16", "[", "'TrainingStartTime'", "]", ")", "*", "arg_9", "arg_0", ".", "log", ".", "info", "(", "'Billable seconds:{}'", ".", "format", "(", "int", "(", "arg_18", ".", "total_seconds", "(", ")", ")", "+", "1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                       arg_4, arg_5, arg_6):\n        \"\"\"\n        Display the logs for a given training job, optionally tailing them until the\n        job is complete.\n\n        :param job_name: name of the training job to check status and display logs for\n        :type job_name: str\n        :param non_terminal_states: the set of non_terminal states\n        :type non_terminal_states: set\n        :param failed_states: the set of failed states\n        :type failed_states: set\n        :param wait_for_completion: Whether to keep looking for new log entries\n            until the job completes\n        :type wait_for_completion: bool\n        :param check_interval: The interval in seconds between polling for new log entries and job completion\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: None\n        \"\"\"\n\n        arg_7 = 0\n        arg_8 = arg_0.describe_training_job(arg_1)\n        arg_0.log.info(secondary_training_status_message(arg_8, None))\n        arg_9 = arg_8['ResourceConfig']['InstanceCount']\n        arg_10 = arg_8['TrainingJobStatus']\n\n        arg_11 = []  # The list of log streams\n        arg_12 = {}     # The current position in each stream, map of stream name -> position\n\n        arg_13 = arg_10 not in arg_2\n\n        arg_14 = LogState.TAILING if arg_4 and not arg_13 else LogState.COMPLETE\n\n        # The loop below implements a state machine that alternates between checking the job status and\n        # reading whatever is available in the logs at this point. Note, that if we were called with\n        # wait_for_completion == False, we never check the job status.\n        #\n        # If wait_for_completion == TRUE and job is not completed, the initial state is TAILING\n        # If wait_for_completion == FALSE, the initial state is COMPLETE\n        # (doesn't matter if the job really is complete).\n        #\n        # The state table:\n        #\n        # STATE               ACTIONS                        CONDITION             NEW STATE\n        # ----------------    ----------------               -----------------     ----------------\n        # TAILING             Read logs, Pause, Get status   Job complete          JOB_COMPLETE\n        #                                                    Else                  TAILING\n        # JOB_COMPLETE        Read logs, Pause               Any                   COMPLETE\n        # COMPLETE            Read logs, Exit                                      N/A\n        #\n        # Notes:\n        # - The JOB_COMPLETE state forces us to do an extra pause and read any items that\n        # got to Cloudwatch after the job was marked complete.\n        arg_15 = time.time()\n        arg_16 = arg_8\n\n        while True:\n            time.sleep(arg_5)\n            arg_7 = arg_7 + arg_5\n\n            arg_14, arg_16, arg_15 = \\\n                arg_0.describe_training_job_with_log(arg_1, arg_12, arg_11,\n                                                    arg_9, arg_14, arg_16,\n                                                    arg_15)\n            if arg_14 == LogState.COMPLETE:\n                break\n\n            if arg_6 and arg_7 > arg_6:\n                # ensure that the job gets killed if the max ingestion time is exceeded\n                raise AirflowException('SageMaker job took more than %s seconds', arg_6)\n\n        if arg_4:\n            arg_10 = arg_16['TrainingJobStatus']\n            if arg_10 in arg_3:\n                arg_17 = arg_16.get('FailureReason', '(No reason provided)')\n                raise AirflowException('Error training {}: {} Reason: {}'.format(arg_1, arg_10, arg_17))\n            arg_18 = (arg_16['TrainingEndTime'] - arg_16['TrainingStartTime']) \\\n                * arg_9\n            arg_0.log.info('Billable seconds:{}'.format(int(arg_18.total_seconds()) + 1))", "path": "airflow/contrib/hooks/sagemaker_hook.py", "identifier": "SageMakerHook.check_training_status_with_log", "docstring": "Display the logs for a given training job, optionally tailing them until the\n        job is complete.\n\n        :param job_name: name of the training job to check status and display logs for\n        :type job_name: str\n        :param non_terminal_states: the set of non_terminal states\n        :type non_terminal_states: set\n        :param failed_states: the set of failed states\n        :type failed_states: set\n        :param wait_for_completion: Whether to keep looking for new log entries\n            until the job completes\n        :type wait_for_completion: bool\n        :param check_interval: The interval in seconds between polling for new log entries and job completion\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: None", "docstring_tokens": ["Display", "the", "logs", "for", "a", "given", "training", "job", "optionally", "tailing", "them", "until", "the", "job", "is", "complete", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257828}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/blp.py#L76-L158", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Bloomberg block data", "language": "python", "parameters": "(tickers, flds, **kwargs)", "return_statement": "return qry_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "logs", ".", "get_logger", "(", "Func", ",", "level", "=", "arg_2", ".", "pop", "(", "'log'", ",", "logs", ".", "LOG_LEVEL", ")", ")", "arg_4", ",", "arg_5", "=", "create_connection", "(", ")", "arg_6", "=", "assist", ".", "proc_ovrds", "(", "**", "arg_2", ")", "arg_3", ".", "info", "(", "f'loading block data from Bloomberg:\\n'", "f'{assist.info_qry(tickers=tickers, flds=flds)}'", ")", "arg_7", "=", "arg_4", ".", "bulkref", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_6", "=", "arg_6", ")", "if", "not", "arg_2", ".", "get", "(", "'cache'", ",", "False", ")", ":", "return", "[", "arg_7", "]", "arg_8", "=", "[", "]", "for", "(", "arg_9", ",", "arg_10", ")", ",", "arg_11", "in", "arg_7", ".", "groupby", "(", "[", "'ticker'", ",", "'field'", "]", ")", ":", "arg_12", "=", "storage", ".", "ref_file", "(", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "ext", "=", "'pkl'", ",", "has_date", "=", "arg_2", ".", "get", "(", "'has_date'", ",", "True", ")", ",", "**", "arg_2", ")", "if", "arg_12", ":", "if", "not", "files", ".", "exists", "(", "arg_12", ")", ":", "arg_8", ".", "append", "(", "arg_11", ")", "files", ".", "create_folder", "(", "arg_12", ",", "is_file", "=", "True", ")", "arg_11", ".", "reset_index", "(", "drop", "=", "True", ")", ".", "to_pickle", "(", "arg_12", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"\n    Bloomberg block data\n\n    Args:\n        tickers: ticker(s)\n        flds: field(s)\n        **kwargs: other overrides for query\n          -> raw: raw output from `pdbdp` library, default False\n\n    Returns:\n        pd.DataFrame: block data\n\n    Examples:\n        >>> import os\n        >>>\n        >>> pd.options.display.width = 120\n        >>> s_dt, e_dt = '20180301', '20181031'\n        >>> dvd = Func(\n        ...     'NVDA US Equity', 'DVD_Hist_All',\n        ...     DVD_Start_Dt=s_dt, DVD_End_Dt=e_dt, raw=True,\n        ... )\n        >>> dvd.loc[:, ['ticker', 'name', 'value']].head(8)\n                   ticker                name         value\n        0  NVDA US Equity       Declared Date    2018-08-16\n        1  NVDA US Equity             Ex-Date    2018-08-29\n        2  NVDA US Equity         Record Date    2018-08-30\n        3  NVDA US Equity        Payable Date    2018-09-21\n        4  NVDA US Equity     Dividend Amount          0.15\n        5  NVDA US Equity  Dividend Frequency       Quarter\n        6  NVDA US Equity       Dividend Type  Regular Cash\n        7  NVDA US Equity       Declared Date    2018-05-10\n        >>> dvd = Func(\n        ...     'NVDA US Equity', 'DVD_Hist_All',\n        ...     DVD_Start_Dt=s_dt, DVD_End_Dt=e_dt,\n        ... )\n        >>> dvd.reset_index().loc[:, ['ticker', 'ex_date', 'dividend_amount']]\n                   ticker     ex_date  dividend_amount\n        0  NVDA US Equity  2018-08-29             0.15\n        1  NVDA US Equity  2018-05-23             0.15\n        >>> if not os.environ.get('BBG_ROOT', ''):\n        ...     os.environ['BBG_ROOT'] = f'{files.abspath(__file__, 1)}/tests/data'\n        >>> idx_kw = dict(End_Dt='20181220', cache=True)\n        >>> idx_wt = Func('DJI Index', 'Indx_MWeight_Hist', **idx_kw)\n        >>> idx_wt.round(2).tail().reset_index(drop=True)\n          index_member  percent_weight\n        0         V UN            3.82\n        1        VZ UN            1.63\n        2       WBA UW            2.06\n        3       WMT UN            2.59\n        4       XOM UN            2.04\n        >>> idx_wt = Func('DJI Index', 'Indx_MWeight_Hist', **idx_kw)\n        >>> idx_wt.round(2).head().reset_index(drop=True)\n          index_member  percent_weight\n        0      AAPL UW            4.65\n        1       AXP UN            2.84\n        2        BA UN            9.29\n        3       CAT UN            3.61\n        4      CSCO UW            1.26\n    \"\"\"\n    arg_3 = logs.get_logger(Func, level=arg_2.pop('log', logs.LOG_LEVEL))\n    arg_4, arg_5 = create_connection()\n    arg_6 = assist.proc_ovrds(**arg_2)\n\n    arg_3.info(\n        f'loading block data from Bloomberg:\\n'\n        f'{assist.info_qry(tickers=tickers, flds=flds)}'\n    )\n    arg_7 = arg_4.bulkref(arg_0=arg_0, arg_1=arg_1, arg_6=arg_6)\n    if not arg_2.get('cache', False): return [arg_7]\n\n    arg_8 = []\n    for (arg_9, arg_10), arg_11 in arg_7.groupby(['ticker', 'field']):\n        arg_12 = storage.ref_file(\n            arg_9=arg_9, arg_10=arg_10, ext='pkl',\n            has_date=arg_2.get('has_date', True), **arg_2\n        )\n        if arg_12:\n            if not files.exists(arg_12): arg_8.append(arg_11)\n            files.create_folder(arg_12, is_file=True)\n            arg_11.reset_index(drop=True).to_pickle(arg_12)\n\n    return arg_8", "path": "xbbg/blp.py", "identifier": "bds", "docstring": "Bloomberg block data\n\n    Args:\n        tickers: ticker(s)\n        flds: field(s)\n        **kwargs: other overrides for query\n          -> raw: raw output from `pdbdp` library, default False\n\n    Returns:\n        pd.DataFrame: block data\n\n    Examples:\n        >>> import os\n        >>>\n        >>> pd.options.display.width = 120\n        >>> s_dt, e_dt = '20180301', '20181031'\n        >>> dvd = bds(\n        ...     'NVDA US Equity', 'DVD_Hist_All',\n        ...     DVD_Start_Dt=s_dt, DVD_End_Dt=e_dt, raw=True,\n        ... )\n        >>> dvd.loc[:, ['ticker', 'name', 'value']].head(8)\n                   ticker                name         value\n        0  NVDA US Equity       Declared Date    2018-08-16\n        1  NVDA US Equity             Ex-Date    2018-08-29\n        2  NVDA US Equity         Record Date    2018-08-30\n        3  NVDA US Equity        Payable Date    2018-09-21\n        4  NVDA US Equity     Dividend Amount          0.15\n        5  NVDA US Equity  Dividend Frequency       Quarter\n        6  NVDA US Equity       Dividend Type  Regular Cash\n        7  NVDA US Equity       Declared Date    2018-05-10\n        >>> dvd = bds(\n        ...     'NVDA US Equity', 'DVD_Hist_All',\n        ...     DVD_Start_Dt=s_dt, DVD_End_Dt=e_dt,\n        ... )\n        >>> dvd.reset_index().loc[:, ['ticker', 'ex_date', 'dividend_amount']]\n                   ticker     ex_date  dividend_amount\n        0  NVDA US Equity  2018-08-29             0.15\n        1  NVDA US Equity  2018-05-23             0.15\n        >>> if not os.environ.get('BBG_ROOT', ''):\n        ...     os.environ['BBG_ROOT'] = f'{files.abspath(__file__, 1)}/tests/data'\n        >>> idx_kw = dict(End_Dt='20181220', cache=True)\n        >>> idx_wt = bds('DJI Index', 'Indx_MWeight_Hist', **idx_kw)\n        >>> idx_wt.round(2).tail().reset_index(drop=True)\n          index_member  percent_weight\n        0         V UN            3.82\n        1        VZ UN            1.63\n        2       WBA UW            2.06\n        3       WMT UN            2.59\n        4       XOM UN            2.04\n        >>> idx_wt = bds('DJI Index', 'Indx_MWeight_Hist', **idx_kw)\n        >>> idx_wt.round(2).head().reset_index(drop=True)\n          index_member  percent_weight\n        0      AAPL UW            4.65\n        1       AXP UN            2.84\n        2        BA UN            9.29\n        3       CAT UN            3.61\n        4      CSCO UW            1.26", "docstring_tokens": ["Bloomberg", "block", "data"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 257829}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L1101-L1133", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Multinomial coefficient.", "language": "python", "parameters": "(n, counts, name=\"log_combinations\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"Func\"", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_2", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_2", "=", "\"n\"", ")", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "arg_2", "=", "\"counts\"", ")", "arg_3", "=", "tf", ".", "math", ".", "lgamma", "(", "arg_0", "+", "1", ")", "arg_4", "=", "tf", ".", "math", ".", "lgamma", "(", "arg_1", "+", "1", ")", "arg_5", "=", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "arg_4", ",", "axis", "=", "[", "-", "1", "]", ")", "return", "arg_3", "-", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=\"Func\"):\n  \"\"\"Multinomial coefficient.\n\n  Given `n` and `counts`, where `counts` has last dimension `k`, we compute\n  the multinomial coefficient as:\n\n  ```n! / sum_i n_i!```\n\n  where `i` runs over all `k` classes.\n\n  Args:\n    n: Floating-point `Tensor` broadcastable with `counts`. This represents `n`\n      outcomes.\n    counts: Floating-point `Tensor` broadcastable with `n`. This represents\n      counts in `k` classes, where `k` is the last dimension of the tensor.\n    name: A name for this operation (optional).\n\n  Returns:\n    `Tensor` representing the multinomial coefficient between `n` and `counts`.\n  \"\"\"\n  # First a bit about the number of ways counts could have come in:\n  # E.g. if counts = [1, 2], then this is 3 choose 2.\n  # In general, this is (sum counts)! / sum(counts!)\n  # The sum should be along the last dimension of counts. This is the\n  # \"distribution\" dimension. Here n a priori represents the sum of counts.\n  with tf.name_scope(arg_2):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_2=\"n\")\n    arg_1 = tf.convert_to_tensor(value=arg_1, arg_2=\"counts\")\n    arg_3 = tf.math.lgamma(arg_0 + 1)\n    arg_4 = tf.math.lgamma(arg_1 + 1)\n    arg_5 = tf.reduce_sum(\n        input_tensor=arg_4, axis=[-1])\n    return arg_3 - arg_5", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "log_combinations", "docstring": "Multinomial coefficient.\n\n  Given `n` and `counts`, where `counts` has last dimension `k`, we compute\n  the multinomial coefficient as:\n\n  ```n! / sum_i n_i!```\n\n  where `i` runs over all `k` classes.\n\n  Args:\n    n: Floating-point `Tensor` broadcastable with `counts`. This represents `n`\n      outcomes.\n    counts: Floating-point `Tensor` broadcastable with `n`. This represents\n      counts in `k` classes, where `k` is the last dimension of the tensor.\n    name: A name for this operation (optional).\n\n  Returns:\n    `Tensor` representing the multinomial coefficient between `n` and `counts`.", "docstring_tokens": ["Multinomial", "coefficient", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257830}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/decompose.py#L27-L51", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Expand a given gate into its decomposition.", "language": "python", "parameters": "(self, dag)", "return_statement": "return dag", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "op_nodes", "(", "arg_0", ".", "gate", ")", ":", "if", "not", "arg_2", ".", "op", ".", "definition", ":", "continue", "arg_3", "=", "arg_2", ".", "op", ".", "definition", "arg_4", "=", "DAGCircuit", "(", ")", "arg_4", ".", "add_qreg", "(", "arg_3", "[", "0", "]", "[", "1", "]", "[", "0", "]", "[", "0", "]", ")", "if", "arg_3", "[", "0", "]", "[", "2", "]", ":", "arg_4", ".", "add_creg", "(", "arg_3", "[", "0", "]", "[", "2", "]", "[", "0", "]", "[", "0", "]", ")", "for", "arg_5", "in", "arg_3", ":", "arg_4", ".", "apply_operation_back", "(", "*", "arg_5", ")", "arg_1", ".", "substitute_node_with_dag", "(", "arg_2", ",", "arg_4", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Expand a given gate into its decomposition.\n\n        Args:\n            dag(DAGCircuit): input dag\n        Returns:\n            DAGCircuit: output dag where gate was expanded.\n        \"\"\"\n        # Walk through the DAG and expand each non-basis node\n        for arg_2 in arg_1.op_nodes(arg_0.gate):\n            # opaque or built-in gates are not decomposable\n            if not arg_2.op.definition:\n                continue\n            # TODO: allow choosing among multiple decomposition rules\n            arg_3 = arg_2.op.definition\n            # hacky way to build a dag on the same register as the rule is defined\n            # TODO: need anonymous rules to address wires by index\n            arg_4 = DAGCircuit()\n            arg_4.add_qreg(arg_3[0][1][0][0])\n            if arg_3[0][2]:\n                arg_4.add_creg(arg_3[0][2][0][0])\n            for arg_5 in arg_3:\n                arg_4.apply_operation_back(*arg_5)\n            arg_1.substitute_node_with_dag(arg_2, arg_4)\n        return arg_1", "path": "qiskit/transpiler/passes/decompose.py", "identifier": "Decompose.run", "docstring": "Expand a given gate into its decomposition.\n\n        Args:\n            dag(DAGCircuit): input dag\n        Returns:\n            DAGCircuit: output dag where gate was expanded.", "docstring_tokens": ["Expand", "a", "given", "gate", "into", "its", "decomposition", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257831}
{"url": "https://github.com/edx/web-fragments/blob/42d760d700d70465e4e573b7b41442d8802ccd3c/web_fragments/fragment.py#L189-L201", "sha": "42d760d700d70465e4e573b7b41442d8802ccd3c", "docstring_summary": "Register a Javascript function to initialize the Javascript resources.", "language": "python", "parameters": "(self, js_func, json_args=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "js_init_fn", "=", "arg_1", "arg_0", ".", "js_init_version", "=", "JS_API_VERSION", "if", "arg_2", ":", "arg_0", ".", "json_init_args", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Register a Javascript function to initialize the Javascript resources.\n\n        `js_func` is the name of a Javascript function defined by one of the\n        Javascript resources.  As part of setting up the browser's runtime\n        environment, the function will be invoked, passing a runtime object\n        and a DOM element.\n        \"\"\"\n        arg_0.js_init_fn = arg_1\n        arg_0.js_init_version = JS_API_VERSION\n        if arg_2:\n            arg_0.json_init_args = arg_2", "path": "web_fragments/fragment.py", "identifier": "Fragment.initialize_js", "docstring": "Register a Javascript function to initialize the Javascript resources.\n\n        `js_func` is the name of a Javascript function defined by one of the\n        Javascript resources.  As part of setting up the browser's runtime\n        environment, the function will be invoked, passing a runtime object\n        and a DOM element.", "docstring_tokens": ["Register", "a", "Javascript", "function", "to", "initialize", "the", "Javascript", "resources", "."], "nwo": "edx/web-fragments", "score": 0.3871570893833313, "idx": 257832}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py#L939-L953", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Is the kernel process still running?", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "has_kernel", ":", "if", "arg_0", ".", "kernel", ".", "poll", "(", ")", "is", "None", ":", "return", "True", "else", ":", "return", "False", "elif", "arg_0", ".", "_hb_channel", "is", "not", "None", ":", "return", "arg_0", ".", "_hb_channel", ".", "is_beating", "(", ")", "else", ":", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"Is the kernel process still running?\"\"\"\n        if arg_0.has_kernel:\n            if arg_0.kernel.poll() is None:\n                return True\n            else:\n                return False\n        elif arg_0._hb_channel is not None:\n            # We didn't start the kernel with this KernelManager so we\n            # use the heartbeat.\n            return arg_0._hb_channel.is_beating()\n        else:\n            # no heartbeat and not local, we can't tell if it's running,\n            # so naively return True\n            return True", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py", "identifier": "KernelManager.is_alive", "docstring": "Is the kernel process still running?", "docstring_tokens": ["Is", "the", "kernel", "process", "still", "running?"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257833}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/players.py#L60-L76", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns the age of the player on a given date.", "language": "python", "parameters": "(self, year, month=2, day=1)", "return_statement": "return age", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", ",", "arg_3", "=", "1", ")", ":", "arg_4", "=", "arg_0", ".", "get_main_doc", "(", ")", "arg_5", "=", "arg_4", "(", "'span[itemprop=\"birthDate\"]'", ")", ".", "attr", "(", "'data-birth'", ")", "arg_6", "=", "r'(\\d{4})\\-(\\d{2})\\-(\\d{2})'", "arg_7", "=", "map", "(", "int", ",", "re", ".", "match", "(", "arg_6", ",", "arg_5", ")", ".", "groups", "(", ")", ")", "arg_8", "=", "datetime", ".", "date", "(", "*", "arg_7", ")", "arg_9", "=", "datetime", ".", "date", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_10", "=", "arg_9", "-", "arg_8", "Func", "=", "arg_10", ".", "days", "/", "365.", "return", "Func"], "function": "def Func(arg_0, arg_1, arg_2=2, arg_3=1):\n        \"\"\"Returns the age of the player on a given date.\n\n        :year: int representing the year.\n        :month: int representing the month (1-12).\n        :day: int representing the day within the month (1-31).\n        :returns: Age in years as a float.\n        \"\"\"\n        arg_4 = arg_0.get_main_doc()\n        arg_5 = arg_4('span[itemprop=\"birthDate\"]').attr('data-birth')\n        arg_6 = r'(\\d{4})\\-(\\d{2})\\-(\\d{2})'\n        arg_7 = map(int, re.match(arg_6, arg_5).groups())\n        arg_8 = datetime.date(*arg_7)\n        arg_9 = datetime.date(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)\n        arg_10 = arg_9 - arg_8\n        Func = arg_10.days / 365.\n        return Func", "path": "sportsref/nba/players.py", "identifier": "Player.age", "docstring": "Returns the age of the player on a given date.\n\n        :year: int representing the year.\n        :month: int representing the month (1-12).\n        :day: int representing the day within the month (1-31).\n        :returns: Age in years as a float.", "docstring_tokens": ["Returns", "the", "age", "of", "the", "player", "on", "a", "given", "date", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 257834}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/plot.py#L74-L86", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Adds a graph to the plot's figure.", "language": "python", "parameters": "(self, data, position=111, xlabel=None, ylabel=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "111", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "_addBase", "(", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_5", ".", "plot", "(", "arg_1", ")", "plt", ".", "draw", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=111, arg_3=None, arg_4=None):\n    \"\"\" Adds a graph to the plot's figure.\n\n    @param data See matplotlib.Axes.plot documentation.\n    @param position A 3-digit number. The first two digits define a 2D grid\n            where subplots may be added. The final digit specifies the nth grid\n            location for the added subplot\n    @param xlabel text to be displayed on the x-axis\n    @param ylabel text to be displayed on the y-axis\n    \"\"\"\n    arg_5 = arg_0._addBase(arg_2, arg_3=arg_3, arg_4=arg_4)\n    arg_5.plot(arg_1)\n    plt.draw()", "path": "src/nupic/algorithms/monitor_mixin/plot.py", "identifier": "Plot.addGraph", "docstring": "Adds a graph to the plot's figure.\n\n    @param data See matplotlib.Axes.plot documentation.\n    @param position A 3-digit number. The first two digits define a 2D grid\n            where subplots may be added. The final digit specifies the nth grid\n            location for the added subplot\n    @param xlabel text to be displayed on the x-axis\n    @param ylabel text to be displayed on the y-axis", "docstring_tokens": ["Adds", "a", "graph", "to", "the", "plot", "s", "figure", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257835}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/configs/__init__.py#L56-L67", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "method that defines ``Struct``'s pretty printing rules for iPython", "language": "python", "parameters": "(self, p, cycle)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ":", "arg_1", ".", "text", "(", "'Struct(...)'", ")", "else", ":", "with", "arg_1", ".", "group", "(", "7", ",", "'Struct('", ",", "')'", ")", ":", "arg_1", ".", "pretty", "(", "arg_0", ".", "_asdict", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"method that defines ``Struct``'s pretty printing rules for iPython\n\n        Args:\n            p (IPython.lib.pretty.RepresentationPrinter): pretty printer object\n            cycle (bool): is ``True`` if pretty detected a cycle\n        \"\"\"\n        if arg_2:\n            arg_1.text('Struct(...)')\n        else:\n            with arg_1.group(7, 'Struct(', ')'):\n                arg_1.pretty(arg_0._asdict())", "path": "deeppavlov/configs/__init__.py", "identifier": "Struct._repr_pretty_", "docstring": "method that defines ``Struct``'s pretty printing rules for iPython\n\n        Args:\n            p (IPython.lib.pretty.RepresentationPrinter): pretty printer object\n            cycle (bool): is ``True`` if pretty detected a cycle", "docstring_tokens": ["method", "that", "defines", "Struct", "s", "pretty", "printing", "rules", "for", "iPython"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 257836}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmds.py#L165-L187", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "flatten pipe extracts nested item from previous pipe.", "language": "python", "parameters": "(prev, depth=sys.maxsize)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "maxsize", ")", ":", "def", "inner_Func", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "for", "arg_7", "in", "arg_4", ":", "if", "hasattr", "(", "arg_7", ",", "'__iter__'", ")", "and", "arg_5", "<", "arg_6", ":", "for", "arg_8", "in", "inner_Func", "(", "arg_7", ",", "arg_5", "+", "1", ",", "arg_6", ")", ":", "yield", "arg_8", "else", ":", "yield", "arg_7", "for", "arg_9", "in", "arg_0", ":", "if", "hasattr", "(", "arg_9", ",", "'__iter__'", ")", "and", "arg_1", ">", "0", ":", "for", "arg_10", "in", "inner_Func", "(", "arg_9", ",", "1", ",", "arg_1", ")", ":", "yield", "arg_10", "else", ":", "yield", "arg_9"], "function": "def Func(arg_0, arg_1=arg_2.maxsize):\n    \"\"\"Func pipe extracts nested item from previous pipe.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param depth: The deepest nested level to be extracted. 0 means no extraction.\n    :type depth: integer\n    :returns: generator\n    \"\"\"\n    def inner_Func(arg_4, arg_5, arg_6):\n        for arg_7 in arg_4:\n            if hasattr(arg_7, '__iter__') and arg_5 < arg_6:\n                for arg_8 in inner_Func(arg_7, arg_5 + 1, arg_6):\n                    yield arg_8\n            else:\n                yield arg_7\n\n    for arg_9 in arg_0:\n        if hasattr(arg_9, '__iter__') and arg_1 > 0:\n            for arg_10 in inner_Func(arg_9, 1, arg_1):\n                yield arg_10\n        else:\n            yield arg_9", "path": "cmdlet/cmds.py", "identifier": "flatten", "docstring": "flatten pipe extracts nested item from previous pipe.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param depth: The deepest nested level to be extracted. 0 means no extraction.\n    :type depth: integer\n    :returns: generator", "docstring_tokens": ["flatten", "pipe", "extracts", "nested", "item", "from", "previous", "pipe", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 257837}
{"url": "https://github.com/Toblerity/rtree/blob/5d33357c8e88f1a8344415dc15a7d2440211b281/rtree/index.py#L703-L754", "sha": "5d33357c8e88f1a8344415dc15a7d2440211b281", "docstring_summary": "This function is used to instantiate the index given an\n        iterable stream of data.", "language": "python", "parameters": "(self, stream)", "return_statement": "return IndexStreamHandle(self.properties.handle, stream)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "iter", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "properties", ".", "dimension", "arg_4", "=", "ctypes", ".", "c_double", "*", "arg_3", "arg_5", "=", "arg_4", "(", ")", "arg_6", "=", "arg_4", "(", ")", "arg_7", "=", "ctypes", ".", "cast", "(", "ctypes", ".", "pointer", "(", "ctypes", ".", "c_ubyte", "(", "0", ")", ")", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_ubyte", ")", ")", "def", "py_next_item", "(", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ")", ":", "try", ":", "arg_8", "[", "0", "]", ",", "arg_14", ",", "arg_15", "=", "next", "(", "arg_2", ")", "except", "StopIteration", ":", "return", "-", "1", "except", "Exception", "as", "exc", ":", "arg_0", ".", "_exception", "=", "exc", "return", "-", "1", "if", "arg_0", ".", "interleaved", ":", "arg_14", "=", "Index", ".", "deinterleave", "(", "arg_14", ")", "for", "arg_17", "in", "range", "(", "arg_3", ")", ":", "arg_5", "[", "arg_17", "]", "=", "arg_14", "[", "arg_17", "*", "2", "]", "arg_6", "[", "arg_17", "]", "=", "arg_14", "[", "(", "arg_17", "*", "2", ")", "+", "1", "]", "arg_9", "[", "0", "]", "=", "ctypes", ".", "cast", "(", "arg_5", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_double", ")", ")", "arg_10", "[", "0", "]", "=", "ctypes", ".", "cast", "(", "arg_6", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_double", ")", ")", "arg_11", "[", "0", "]", "=", "arg_3", "if", "arg_15", "is", "None", ":", "arg_12", "[", "0", "]", "=", "arg_7", "arg_13", "[", "0", "]", "=", "0", "else", ":", "arg_13", "[", "0", "]", ",", "arg_18", ",", "arg_19", "=", "arg_0", ".", "_serialize", "(", "arg_15", ")", "arg_12", "[", "0", "]", "=", "ctypes", ".", "cast", "(", "arg_18", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_ubyte", ")", ")", "return", "0", "arg_1", "=", "core", ".", "NEXTFUNC", "(", "py_next_item", ")", "return", "IndexStreamHandle", "(", "arg_0", ".", "properties", ".", "handle", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"This function is used to instantiate the index given an\n        iterable stream of data.\"\"\"\n\n        arg_2 = iter(arg_1)\n        arg_3 = arg_0.properties.dimension\n        arg_4 = ctypes.c_double * arg_3\n        arg_5 = arg_4()\n        arg_6 = arg_4()\n        arg_7 = ctypes.cast(ctypes.pointer(ctypes.c_ubyte(0)),\n                              ctypes.POINTER(ctypes.c_ubyte))\n\n        def py_next_item(arg_8, arg_9, arg_10, arg_11, arg_12, arg_13):\n            \"\"\"This function must fill pointers to individual entries that will\n            be added to the index.  The C API will actually call this function\n            to fill out the pointers.  If this function returns anything other\n            than 0, it is assumed that the stream of data is done.\"\"\"\n\n            try:\n                arg_8[0], arg_14, arg_15 = next(arg_2)\n            except StopIteration:\n                # we're done\n                return -1\n            except Exception as exc:\n                arg_0._exception = exc\n                return -1\n\n            if arg_0.interleaved:\n                arg_14 = Index.deinterleave(arg_14)\n\n            # this code assumes the coords are not interleaved.\n            # xmin, xmax, ymin, ymax, zmin, zmax\n            for arg_17 in range(arg_3):\n                arg_5[arg_17] = arg_14[arg_17*2]\n                arg_6[arg_17] = arg_14[(arg_17*2)+1]\n\n            arg_9[0] = ctypes.cast(arg_5, ctypes.POINTER(ctypes.c_double))\n            arg_10[0] = ctypes.cast(arg_6, ctypes.POINTER(ctypes.c_double))\n\n            # set the dimension\n            arg_11[0] = arg_3\n            if arg_15 is None:\n                arg_12[0] = arg_7\n                arg_13[0] = 0\n            else:\n                arg_13[0], arg_18, arg_19 = arg_0._serialize(arg_15)\n                arg_12[0] = ctypes.cast(arg_18, ctypes.POINTER(ctypes.c_ubyte))\n\n            return 0\n\n        arg_1 = core.NEXTFUNC(py_next_item)\n        return IndexStreamHandle(arg_0.properties.handle, arg_1)", "path": "rtree/index.py", "identifier": "Index._create_idx_from_stream", "docstring": "This function is used to instantiate the index given an\n        iterable stream of data.", "docstring_tokens": ["This", "function", "is", "used", "to", "instantiate", "the", "index", "given", "an", "iterable", "stream", "of", "data", "."], "nwo": "Toblerity/rtree", "score": 0.6128222292729003, "idx": 257838}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L797-L810", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Flush notifications of engine registrations waiting\n        in ZMQ queue.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_0", ".", "_notification_socket", ",", "mode", "=", "zmq", ".", "NOBLOCK", ")", "while", "arg_2", "is", "not", "None", ":", "if", "arg_0", ".", "debug", ":", "pprint", "(", "arg_2", ")", "arg_3", "=", "arg_2", "[", "'header'", "]", "[", "'msg_type'", "]", "arg_4", "=", "arg_0", ".", "_notification_handlers", ".", "get", "(", "arg_3", ",", "None", ")", "if", "arg_4", "is", "None", ":", "raise", "Exception", "(", "\"Unhandled message type: %s\"", "%", "arg_2", ".", "msg_type", ")", "else", ":", "arg_4", "(", "arg_2", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_0", ".", "_notification_socket", ",", "mode", "=", "zmq", ".", "NOBLOCK", ")"], "function": "def Func(arg_0):\n        \"\"\"Flush notifications of engine registrations waiting\n        in ZMQ queue.\"\"\"\n        arg_1,arg_2 = arg_0.session.recv(arg_0._notification_socket, mode=zmq.NOBLOCK)\n        while arg_2 is not None:\n            if arg_0.debug:\n                pprint(arg_2)\n            arg_3 = arg_2['header']['msg_type']\n            arg_4 = arg_0._notification_handlers.get(arg_3, None)\n            if arg_4 is None:\n                raise Exception(\"Unhandled message type: %s\"%arg_2.msg_type)\n            else:\n                arg_4(arg_2)\n            arg_1,arg_2 = arg_0.session.recv(arg_0._notification_socket, mode=zmq.NOBLOCK)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client._flush_notifications", "docstring": "Flush notifications of engine registrations waiting\n        in ZMQ queue.", "docstring_tokens": ["Flush", "notifications", "of", "engine", "registrations", "waiting", "in", "ZMQ", "queue", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257839}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_minkowski.py#L227-L262", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return normalized Minkowski similarity of two strings.", "language": "python", "parameters": "(src, tar, qval=2, pval=1, alphabet=None)", "return_statement": "return Minkowski().sim(src, tar, qval, pval, alphabet)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", ",", "arg_3", "=", "1", ",", "arg_4", "=", "None", ")", ":", "return", "Minkowski", "(", ")", ".", "sim", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=2, arg_3=1, arg_4=None):\n    \"\"\"Return normalized Minkowski similarity of two strings.\n\n    This is a wrapper for :py:meth:`Minkowski.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string (or QGrams/Counter objects) for comparison\n    tar : str\n        Target string (or QGrams/Counter objects) for comparison\n    qval : int\n        The length of each q-gram; 0 for non-q-gram version\n    pval : int or float\n        The :math:`p`-value of the :math:`L^p`-space\n    alphabet : collection or int\n        The values or size of the alphabet\n\n    Returns\n    -------\n    float\n        The normalized Minkowski similarity\n\n    Examples\n    --------\n    >>> Func('cat', 'hat')\n    0.5\n    >>> round(Func('Niall', 'Neil'), 12)\n    0.363636363636\n    >>> round(Func('Colin', 'Cuilen'), 12)\n    0.307692307692\n    >>> Func('ATCG', 'TAGC')\n    0.0\n\n    \"\"\"\n    return Minkowski().sim(arg_0, arg_1, arg_2, arg_3, arg_4)", "path": "abydos/distance/_minkowski.py", "identifier": "sim_minkowski", "docstring": "Return normalized Minkowski similarity of two strings.\n\n    This is a wrapper for :py:meth:`Minkowski.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string (or QGrams/Counter objects) for comparison\n    tar : str\n        Target string (or QGrams/Counter objects) for comparison\n    qval : int\n        The length of each q-gram; 0 for non-q-gram version\n    pval : int or float\n        The :math:`p`-value of the :math:`L^p`-space\n    alphabet : collection or int\n        The values or size of the alphabet\n\n    Returns\n    -------\n    float\n        The normalized Minkowski similarity\n\n    Examples\n    --------\n    >>> sim_minkowski('cat', 'hat')\n    0.5\n    >>> round(sim_minkowski('Niall', 'Neil'), 12)\n    0.363636363636\n    >>> round(sim_minkowski('Colin', 'Cuilen'), 12)\n    0.307692307692\n    >>> sim_minkowski('ATCG', 'TAGC')\n    0.0", "docstring_tokens": ["Return", "normalized", "Minkowski", "similarity", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 257840}
{"url": "https://github.com/ambv/retype/blob/03137abd4d9c9845f3cced1006190b5cca64d879/retype.py#L172-L193", "sha": "03137abd4d9c9845f3cced1006190b5cca64d879", "docstring_summary": "Given a string with source, return the lib2to3 Node.", "language": "python", "parameters": "(src_txt)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "pygram", ".", "python_grammar_no_print_statement", "arg_2", "=", "driver", ".", "Driver", "(", "arg_1", ",", "pytree", ".", "convert", ")", "if", "arg_0", "[", "-", "1", "]", "!=", "'\\n'", ":", "arg_3", "=", "'\\r\\n'", "if", "'\\r\\n'", "in", "arg_0", "[", ":", "1024", "]", "else", "'\\n'", "arg_0", "+=", "arg_3", "try", ":", "arg_4", "=", "arg_2", ".", "parse_string", "(", "arg_0", ",", "True", ")", "except", "ParseError", "as", "pe", ":", "arg_5", ",", "arg_6", "=", "pe", ".", "context", "[", "1", "]", "arg_7", "=", "arg_0", ".", "splitlines", "(", ")", "try", ":", "arg_8", "=", "arg_7", "[", "arg_5", "-", "1", "]", "except", "IndexError", ":", "arg_8", "=", "\"<line number missing in source>\"", "raise", "ValueError", "(", "f\"Cannot parse: {lineno}:{column}: {faulty_line}\"", ")", "from", "None", "if", "isinstance", "(", "arg_4", ",", "Leaf", ")", ":", "arg_4", "=", "Node", "(", "syms", ".", "file_input", ",", "[", "arg_4", "]", ")", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Given a string with source, return the lib2to3 Node.\"\"\"\n    arg_1 = pygram.python_grammar_no_print_statement\n    arg_2 = driver.Driver(arg_1, pytree.convert)\n    if arg_0[-1] != '\\n':\n        arg_3 = '\\r\\n' if '\\r\\n' in arg_0[:1024] else '\\n'\n        arg_0 += arg_3\n    try:\n        arg_4 = arg_2.parse_string(arg_0, True)\n    except ParseError as pe:\n        arg_5, arg_6 = pe.context[1]\n        arg_7 = arg_0.splitlines()\n        try:\n            arg_8 = arg_7[arg_5 - 1]\n        except IndexError:\n            arg_8 = \"<line number missing in source>\"\n        raise ValueError(f\"Cannot parse: {lineno}:{column}: {faulty_line}\") from None\n\n    if isinstance(arg_4, Leaf):\n        arg_4 = Node(syms.file_input, [arg_4])\n\n    return arg_4", "path": "retype.py", "identifier": "lib2to3_parse", "docstring": "Given a string with source, return the lib2to3 Node.", "docstring_tokens": ["Given", "a", "string", "with", "source", "return", "the", "lib2to3", "Node", "."], "nwo": "ambv/retype", "score": 0.45641484014477285, "idx": 257841}
{"url": "https://github.com/rkcosmos/deepcut/blob/9a2729071d01972af805acede85d7aa9e7a6da30/deepcut/train.py#L39-L62", "sha": "9a2729071d01972af805acede85d7aa9e7a6da30", "docstring_summary": "Give list of input tokenized words,\n    create dataframe of characters where first character of\n    the word is tagged as 1, otherwise 0", "language": "python", "parameters": "(words)", "return_statement": "return pd.DataFrame(char_dict)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_2", ")", ":", "if", "arg_3", "==", "0", ":", "arg_1", ".", "append", "(", "{", "'char'", ":", "arg_4", ",", "'type'", ":", "CHAR_TYPE_FLATTEN", ".", "get", "(", "arg_4", ",", "'o'", ")", ",", "'target'", ":", "True", "}", ")", "else", ":", "arg_1", ".", "append", "(", "{", "'char'", ":", "arg_4", ",", "'type'", ":", "CHAR_TYPE_FLATTEN", ".", "get", "(", "arg_4", ",", "'o'", ")", ",", "'target'", ":", "False", "}", ")", "return", "pd", ".", "DataFrame", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Give list of input tokenized words,\n    create dataframe of characters where first character of\n    the word is tagged as 1, otherwise 0\n\n    Example\n    =======\n    ['\u0e01\u0e34\u0e19', '\u0e2b\u0e21\u0e14'] to dataframe of\n    [{'char': '\u0e01', 'type': ..., 'target': 1}, ...,\n     {'char': '\u0e14', 'type': ..., 'target': 0}]\n    \"\"\"\n    arg_1 = []\n    for arg_2 in arg_0:\n        for arg_3, arg_4 in enumerate(arg_2):\n            if arg_3 == 0:\n                arg_1.append({'char': arg_4,\n                                  'type': CHAR_TYPE_FLATTEN.get(arg_4, 'o'),\n                                  'target': True})\n            else:\n                arg_1.append({'char': arg_4,\n                                  'type': CHAR_TYPE_FLATTEN.get(arg_4, 'o'),\n                                  'target': False})\n    return pd.DataFrame(arg_1)", "path": "deepcut/train.py", "identifier": "create_char_dataframe", "docstring": "Give list of input tokenized words,\n    create dataframe of characters where first character of\n    the word is tagged as 1, otherwise 0\n\n    Example\n    =======\n    ['\u0e01\u0e34\u0e19', '\u0e2b\u0e21\u0e14'] to dataframe of\n    [{'char': '\u0e01', 'type': ..., 'target': 1}, ...,\n     {'char': '\u0e14', 'type': ..., 'target': 0}]", "docstring_tokens": ["Give", "list", "of", "input", "tokenized", "words", "create", "dataframe", "of", "characters", "where", "first", "character", "of", "the", "word", "is", "tagged", "as", "1", "otherwise", "0"], "nwo": "rkcosmos/deepcut", "score": 0.6555269481755696, "idx": 257842}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L546-L554", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Compare physical system memory to process resident memory and\n        calculate process memory utilization as a percentage.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_platform_impl", ".", "get_memory_info", "(", ")", "[", "0", "]", "try", ":", "return", "(", "arg_1", "/", "float", "(", "TOTAL_PHYMEM", ")", ")", "*", "100", "except", "ZeroDivisionError", ":", "return", "0.0"], "function": "def Func(arg_0):\n        \"\"\"Compare physical system memory to process resident memory and\n        calculate process memory utilization as a percentage.\n        \"\"\"\n        arg_1 = arg_0._platform_impl.get_memory_info()[0]\n        try:\n            return (arg_1 / float(TOTAL_PHYMEM)) * 100\n        except ZeroDivisionError:\n            return 0.0", "path": "environment/lib/python2.7/site-packages/psutil/__init__.py", "identifier": "Process.get_memory_percent", "docstring": "Compare physical system memory to process resident memory and\n        calculate process memory utilization as a percentage.", "docstring_tokens": ["Compare", "physical", "system", "memory", "to", "process", "resident", "memory", "and", "calculate", "process", "memory", "utilization", "as", "a", "percentage", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257843}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/audio.py#L465-L533", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Bounded auto-correlation", "language": "python", "parameters": "(y, max_size=None, axis=-1)", "return_statement": "return autocorr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "-", "1", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "shape", "[", "arg_2", "]", "arg_1", "=", "int", "(", "min", "(", "arg_1", ",", "arg_0", ".", "shape", "[", "arg_2", "]", ")", ")", "arg_3", "=", "get_fftlib", "(", ")", "arg_4", "=", "np", ".", "abs", "(", "arg_3", ".", "fft", "(", "arg_0", ",", "n", "=", "2", "*", "arg_0", ".", "shape", "[", "arg_2", "]", "+", "1", ",", "arg_2", "=", "arg_2", ")", ")", "**", "2", "arg_5", "=", "arg_3", ".", "ifft", "(", "arg_4", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_5", ".", "ndim", "arg_6", "[", "arg_2", "]", "=", "slice", "(", "arg_1", ")", "arg_5", "=", "arg_5", "[", "tuple", "(", "arg_6", ")", "]", "if", "not", "np", ".", "iscomplexobj", "(", "arg_0", ")", ":", "arg_5", "=", "arg_5", ".", "real", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=-1):\n    \"\"\"Bounded auto-correlation\n\n    Parameters\n    ----------\n    y : np.ndarray\n        array to Func\n\n    max_size  : int > 0 or None\n        maximum correlation lag.\n        If unspecified, defaults to `y.shape[axis]` (unbounded)\n\n    axis : int\n        The axis along which to Func.\n        By default, the last axis (-1) is taken.\n\n    Returns\n    -------\n    z : np.ndarray\n        truncated autocorrelation `y*y` along the specified axis.\n        If `max_size` is specified, then `z.shape[axis]` is bounded\n        to `max_size`.\n\n    Notes\n    -----\n    This function caches at level 20.\n\n    Examples\n    --------\n    Compute full autocorrelation of y\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), offset=20, duration=10)\n    >>> librosa.Func(y)\n    array([  3.226e+03,   3.217e+03, ...,   8.277e-04,   3.575e-04], dtype=float32)\n\n    Compute onset strength auto-correlation up to 4 seconds\n\n    >>> import matplotlib.pyplot as plt\n    >>> odf = librosa.onset.onset_strength(y=y, sr=sr, hop_length=512)\n    >>> ac = librosa.Func(odf, max_size=4* sr / 512)\n    >>> plt.plot(ac)\n    >>> plt.title('Auto-correlation')\n    >>> plt.xlabel('Lag (frames)')\n\n    \"\"\"\n\n    if arg_1 is None:\n        arg_1 = arg_0.shape[arg_2]\n\n    arg_1 = int(min(arg_1, arg_0.shape[arg_2]))\n\n    # Compute the power spectrum along the chosen axis\n    # Pad out the signal to support full-length auto-correlation.\n    arg_3 = get_fftlib()\n    arg_4 = np.abs(arg_3.fft(arg_0, n=2 * arg_0.shape[arg_2] + 1, arg_2=arg_2))**2\n\n    # Convert back to time domain\n    arg_5 = arg_3.ifft(arg_4, arg_2=arg_2)\n\n    # Slice down to max_size\n    arg_6 = [slice(None)] * arg_5.ndim\n    arg_6[arg_2] = slice(arg_1)\n\n    arg_5 = arg_5[tuple(arg_6)]\n\n    if not np.iscomplexobj(arg_0):\n        arg_5 = arg_5.real\n\n    return arg_5", "path": "librosa/core/audio.py", "identifier": "autocorrelate", "docstring": "Bounded auto-correlation\n\n    Parameters\n    ----------\n    y : np.ndarray\n        array to autocorrelate\n\n    max_size  : int > 0 or None\n        maximum correlation lag.\n        If unspecified, defaults to `y.shape[axis]` (unbounded)\n\n    axis : int\n        The axis along which to autocorrelate.\n        By default, the last axis (-1) is taken.\n\n    Returns\n    -------\n    z : np.ndarray\n        truncated autocorrelation `y*y` along the specified axis.\n        If `max_size` is specified, then `z.shape[axis]` is bounded\n        to `max_size`.\n\n    Notes\n    -----\n    This function caches at level 20.\n\n    Examples\n    --------\n    Compute full autocorrelation of y\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), offset=20, duration=10)\n    >>> librosa.autocorrelate(y)\n    array([  3.226e+03,   3.217e+03, ...,   8.277e-04,   3.575e-04], dtype=float32)\n\n    Compute onset strength auto-correlation up to 4 seconds\n\n    >>> import matplotlib.pyplot as plt\n    >>> odf = librosa.onset.onset_strength(y=y, sr=sr, hop_length=512)\n    >>> ac = librosa.autocorrelate(odf, max_size=4* sr / 512)\n    >>> plt.plot(ac)\n    >>> plt.title('Auto-correlation')\n    >>> plt.xlabel('Lag (frames)')", "docstring_tokens": ["Bounded", "auto", "-", "correlation"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 257844}
{"url": "https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L65-L70", "sha": "39e4da09f325382e21b0917b1b5cd027edce8728", "docstring_summary": "Get the modified time for a file as a datetime instance", "language": "python", "parameters": "(filename)", "return_statement": "return datetime.datetime.utcfromtimestamp(ts)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "stat", "(", "arg_0", ")", ".", "st_mtime", "return", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "arg_1", ")"], "function": "def Func(arg_0):\r\n\t\"\"\"\r\n\tGet the modified time for a file as a datetime instance\r\n\t\"\"\"\r\n\targ_1 = os.stat(arg_0).st_mtime\r\n\treturn datetime.datetime.utcfromtimestamp(arg_1)", "path": "jaraco/path.py", "identifier": "get_time", "docstring": "Get the modified time for a file as a datetime instance", "docstring_tokens": ["Get", "the", "modified", "time", "for", "a", "file", "as", "a", "datetime", "instance"], "nwo": "jaraco/jaraco.path", "score": 0.0, "idx": 257845}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L601-L606", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return a random Boggle board of size n x n.\n    We represent a board as a linear list of letters.", "language": "python", "parameters": "(n=4)", "return_statement": "return map(random.choice, cubes)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "4", ")", ":", "arg_1", "=", "[", "cubes16", "[", "i", "%", "16", "]", "for", "i", "in", "range", "(", "arg_0", "*", "arg_0", ")", "]", "random", ".", "shuffle", "(", "arg_1", ")", "return", "map", "(", "random", ".", "choice", ",", "arg_1", ")"], "function": "def Func(arg_0=4):\n    \"\"\"Return a random Boggle board of size n x n.\n    We represent a board as a linear list of letters.\"\"\"\n    arg_1 = [cubes16[i % 16] for i in range(arg_0*arg_0)]\n    random.shuffle(arg_1)\n    return map(random.choice, arg_1)", "path": "aima/search.py", "identifier": "random_boggle", "docstring": "Return a random Boggle board of size n x n.\n    We represent a board as a linear list of letters.", "docstring_tokens": ["Return", "a", "random", "Boggle", "board", "of", "size", "n", "x", "n", ".", "We", "represent", "a", "board", "as", "a", "linear", "list", "of", "letters", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 257846}
{"url": "https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L98-L109", "sha": "5e464e1fc3ae9c7e216f6dd94f879a967d065247", "docstring_summary": "Returns map with entity or relations from plain text.", "language": "python", "parameters": "(filename, delimiter='\\t', entity_first=True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'\\t'", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "{", "}", "with", "open", "(", "arg_0", ",", "\"r\"", ")", "as", "f", ":", "arg_4", "=", "next", "(", "f", ")", "for", "arg_5", "in", "f", ":", "arg_6", "=", "arg_5", ".", "rstrip", "(", ")", ".", "split", "(", "arg_1", ")", "if", "not", "arg_2", ":", "arg_6", "=", "list", "(", "reversed", "(", "arg_6", ")", ")", "arg_3", "[", "arg_6", "[", "0", "]", "]", "=", "arg_6", "[", "1", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1='\\t', arg_2=True):\n    \"\"\"Returns map with entity or relations from plain text.\"\"\"\n    arg_3 = {}\n    with open(arg_0, \"r\") as f:\n        arg_4 = next(f) # pass the total entry number\n        for arg_5 in f:\n            arg_6 = arg_5.rstrip().split(arg_1)\n            if not arg_2:\n                arg_6 = list(reversed(arg_6))\n            arg_3[arg_6[0]] = arg_6[1]\n\n    return arg_3", "path": "kgekit/io.py", "identifier": "read_openke_translation", "docstring": "Returns map with entity or relations from plain text.", "docstring_tokens": ["Returns", "map", "with", "entity", "or", "relations", "from", "plain", "text", "."], "nwo": "fantasticfears/kgekit", "score": 0.15726537023232431, "idx": 257847}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L320-L341", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Iterates over a generator looking for things that match.", "language": "python", "parameters": "(self, name, attrs, text, limit, generator, **kwargs)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "**", "arg_6", ")", ":", "if", "isinstance", "(", "arg_1", ",", "SoupStrainer", ")", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "SoupStrainer", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_6", ")", "arg_8", "=", "ResultSet", "(", "arg_7", ")", "arg_9", "=", "arg_5", "(", ")", "while", "True", ":", "try", ":", "arg_10", "=", "arg_9", ".", "next", "(", ")", "except", "StopIteration", ":", "break", "if", "arg_10", ":", "arg_11", "=", "arg_7", ".", "search", "(", "arg_10", ")", "if", "arg_11", ":", "arg_8", ".", "append", "(", "arg_11", ")", "if", "arg_4", "and", "len", "(", "arg_8", ")", ">=", "arg_4", ":", "break", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, **arg_6):\n        \"Iterates over a generator looking for things that match.\"\n\n        if isinstance(arg_1, SoupStrainer):\n            arg_7 = arg_1\n        else:\n            # Build a SoupStrainer\n            arg_7 = SoupStrainer(arg_1, arg_2, arg_3, **arg_6)\n        arg_8 = ResultSet(arg_7)\n        arg_9 = arg_5()\n        while True:\n            try:\n                arg_10 = arg_9.next()\n            except StopIteration:\n                break\n            if arg_10:\n                arg_11 = arg_7.search(arg_10)\n                if arg_11:\n                    arg_8.append(arg_11)\n                    if arg_4 and len(arg_8) >= arg_4:\n                        break\n        return arg_8", "path": "lib/web/BeautifulSoup.py", "identifier": "PageElement._findAll", "docstring": "Iterates over a generator looking for things that match.", "docstring_tokens": ["Iterates", "over", "a", "generator", "looking", "for", "things", "that", "match", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257848}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L932-L945", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Clip values above and below.", "language": "python", "parameters": "(self, min=None, max=None)", "return_statement": "return self._constructor(rdd).__finalize__(self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "_rdd", ".", "mapValues", "(", "lambda", "v", ":", "v", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")", "return", "arg_0", ".", "_constructor", "(", "arg_3", ")", ".", "__finalize__", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Clip values above and below.\n\n        Parameters\n        ----------\n        min : scalar or array-like\n            Minimum value. If array, will be broadcasted\n\n        max : scalar or array-like\n            Maximum value. If array, will be broadcasted.\n        \"\"\"\n        arg_3 = arg_0._rdd.mapValues(lambda v: v.Func(arg_1=arg_1, arg_2=arg_2))\n        return arg_0._constructor(arg_3).__finalize__(arg_0)", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark.clip", "docstring": "Clip values above and below.\n\n        Parameters\n        ----------\n        min : scalar or array-like\n            Minimum value. If array, will be broadcasted\n\n        max : scalar or array-like\n            Maximum value. If array, will be broadcasted.", "docstring_tokens": ["Clip", "values", "above", "and", "below", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 257849}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/sampling/hr_sampler.py#L238-L306", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Generate the warmup points for the sampler.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "n_warmup", "=", "0", "arg_2", "=", "arg_0", ".", "model", ".", "reactions", "arg_0", ".", "warmup", "=", "np", ".", "zeros", "(", "(", "2", "*", "len", "(", "arg_2", ")", ",", "len", "(", "arg_0", ".", "model", ".", "variables", ")", ")", ")", "arg_0", ".", "model", ".", "objective", "=", "Zero", "for", "arg_6", "in", "(", "\"min\"", ",", "\"max\"", ")", ":", "arg_0", ".", "model", ".", "objective_direction", "=", "arg_6", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_2", ")", ":", "arg_10", "=", "(", "arg_0", ".", "model", ".", "variables", "[", "arg_0", ".", "fwd_idx", "[", "arg_8", "]", "]", ",", "arg_0", ".", "model", ".", "variables", "[", "arg_0", ".", "rev_idx", "[", "arg_8", "]", "]", ")", "if", "arg_9", ".", "upper_bound", "-", "arg_9", ".", "lower_bound", "<", "arg_0", ".", "bounds_tol", ":", "LOGGER", ".", "info", "(", "\"skipping fixed reaction %s\"", "%", "arg_9", ".", "id", ")", "continue", "arg_0", ".", "model", ".", "objective", ".", "set_linear_coefficients", "(", "{", "arg_10", "[", "0", "]", ":", "1", ",", "arg_10", "[", "1", "]", ":", "-", "1", "}", ")", "arg_0", ".", "model", ".", "slim_optimize", "(", ")", "if", "not", "arg_0", ".", "model", ".", "solver", ".", "status", "==", "OPTIMAL", ":", "LOGGER", ".", "info", "(", "\"can not maximize reaction %s, skipping it\"", "%", "arg_9", ".", "id", ")", "continue", "arg_11", "=", "arg_0", ".", "model", ".", "solver", ".", "primal_values", "arg_12", "=", "[", "arg_11", "[", "v", ".", "name", "]", "for", "v", "in", "arg_0", ".", "model", ".", "variables", "]", "arg_0", ".", "warmup", "[", "arg_0", ".", "n_warmup", ",", "]", "=", "arg_12", "arg_0", ".", "n_warmup", "+=", "1", "arg_0", ".", "model", ".", "objective", ".", "set_linear_coefficients", "(", "{", "arg_10", "[", "0", "]", ":", "0", ",", "arg_10", "[", "1", "]", ":", "0", "}", ")", "arg_0", ".", "warmup", "=", "arg_0", ".", "warmup", "[", "0", ":", "arg_0", ".", "n_warmup", ",", ":", "]", "arg_13", "=", "np", ".", "logical_not", "(", "arg_0", ".", "_is_redundant", "(", "arg_0", ".", "warmup", ")", ")", "arg_0", ".", "warmup", "=", "arg_0", ".", "warmup", "[", "arg_13", ",", ":", "]", "arg_0", ".", "n_warmup", "=", "arg_0", ".", "warmup", ".", "shape", "[", "0", "]", "if", "len", "(", "arg_0", ".", "warmup", ".", "shape", ")", "==", "1", "or", "arg_0", ".", "warmup", ".", "shape", "[", "0", "]", "==", "1", ":", "raise", "ValueError", "(", "\"Your flux cone consists only of a single point!\"", ")", "elif", "arg_0", ".", "n_warmup", "==", "2", ":", "if", "not", "arg_0", ".", "problem", ".", "homogeneous", ":", "raise", "ValueError", "(", "\"Can not sample from an inhomogenous problem\"", "\" with only 2 search directions :(\"", ")", "LOGGER", ".", "info", "(", "\"All search directions on a line, adding another one.\"", ")", "arg_14", "=", "arg_0", ".", "warmup", ".", "T", ".", "dot", "(", "[", "0.25", ",", "0.25", "]", ")", "arg_0", ".", "warmup", "=", "np", ".", "vstack", "(", "[", "arg_0", ".", "warmup", ",", "arg_14", "]", ")", "arg_0", ".", "n_warmup", "+=", "1", "arg_0", ".", "warmup", "=", "shared_np_array", "(", "(", "arg_0", ".", "n_warmup", ",", "len", "(", "arg_0", ".", "model", ".", "variables", ")", ")", ",", "arg_0", ".", "warmup", ")"], "function": "def Func(arg_0):\n        \"\"\"Generate the warmup points for the sampler.\n\n        Generates warmup points by setting each flux as the sole objective\n        and minimizing/maximizing it. Also caches the projection of the\n        warmup points into the nullspace for non-homogeneous problems (only\n        if necessary).\n\n        \"\"\"\n\n        arg_0.n_warmup = 0\n        arg_2 = arg_0.model.reactions\n        arg_0.warmup = np.zeros((2 * len(arg_2), len(arg_0.model.variables)))\n        arg_0.model.objective = Zero\n\n        for arg_6 in (\"min\", \"max\"):\n            arg_0.model.objective_direction = arg_6\n\n            for arg_8, arg_9 in enumerate(arg_2):\n                arg_10 = (arg_0.model.variables[arg_0.fwd_idx[arg_8]],\n                             arg_0.model.variables[arg_0.rev_idx[arg_8]])\n\n                # Omit fixed reactions if they are non-homogeneous\n                if arg_9.upper_bound - arg_9.lower_bound < arg_0.bounds_tol:\n                    LOGGER.info(\"skipping fixed reaction %s\" % arg_9.id)\n                    continue\n\n                arg_0.model.objective.set_linear_coefficients(\n                    {arg_10[0]: 1, arg_10[1]: -1})\n\n                arg_0.model.slim_optimize()\n\n                if not arg_0.model.solver.status == OPTIMAL:\n                    LOGGER.info(\"can not maximize reaction %s, skipping it\" %\n                                arg_9.id)\n                    continue\n\n                arg_11 = arg_0.model.solver.primal_values\n                arg_12 = [arg_11[v.name] for v in arg_0.model.variables]\n                arg_0.warmup[arg_0.n_warmup, ] = arg_12\n                arg_0.n_warmup += 1\n\n                # Reset objective\n                arg_0.model.objective.set_linear_coefficients(\n                    {arg_10[0]: 0, arg_10[1]: 0})\n\n        # Shrink to measure\n        arg_0.warmup = arg_0.warmup[0:arg_0.n_warmup, :]\n\n        # Remove redundant search directions\n        arg_13 = np.logical_not(arg_0._is_redundant(arg_0.warmup))\n        arg_0.warmup = arg_0.warmup[arg_13, :]\n        arg_0.n_warmup = arg_0.warmup.shape[0]\n\n        # Catch some special cases\n        if len(arg_0.warmup.shape) == 1 or arg_0.warmup.shape[0] == 1:\n            raise ValueError(\"Your flux cone consists only of a single point!\")\n        elif arg_0.n_warmup == 2:\n            if not arg_0.problem.homogeneous:\n                raise ValueError(\"Can not sample from an inhomogenous problem\"\n                                 \" with only 2 search directions :(\")\n            LOGGER.info(\"All search directions on a line, adding another one.\")\n            arg_14 = arg_0.warmup.T.dot([0.25, 0.25])\n            arg_0.warmup = np.vstack([arg_0.warmup, arg_14])\n            arg_0.n_warmup += 1\n\n        # Shrink warmup points to measure\n        arg_0.warmup = shared_np_array(\n            (arg_0.n_warmup, len(arg_0.model.variables)), arg_0.warmup)", "path": "cobra/sampling/hr_sampler.py", "identifier": "HRSampler.generate_fva_warmup", "docstring": "Generate the warmup points for the sampler.\n\n        Generates warmup points by setting each flux as the sole objective\n        and minimizing/maximizing it. Also caches the projection of the\n        warmup points into the nullspace for non-homogeneous problems (only\n        if necessary).", "docstring_tokens": ["Generate", "the", "warmup", "points", "for", "the", "sampler", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 257850}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/postgresql.py#L251-L270", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Dumps and loads a database snapshot simultaneously.\n        Requires that the destination server has direct database access\n        to the source server.", "language": "python", "parameters": "(self, site=None, role=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "database_renderer", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_3", ".", "run", "(", "'pg_dump -c --host={host_string} --username={db_user} '", "'--blobs --format=c {db_name} -n public | '", "'pg_restore -U {db_postgresql_postgres_user} --create '", "'--dbname={db_name}'", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Dumps and loads a database snapshot simultaneously.\n        Requires that the destination server has direct database access\n        to the source server.\n\n        This is better than a serial dump+load when:\n        1. The network connection is reliable.\n        2. You don't need to save the dump file.\n\n        The benefits of this over a dump+load are:\n        1. Usually runs faster, since the load and dump happen in parallel.\n        2. Usually takes up less disk space since no separate dump file is\n            downloaded.\n        \"\"\"\n        arg_3 = arg_0.database_renderer(arg_1=arg_1, arg_2=arg_2)\n        arg_3.run('pg_dump -c --host={host_string} --username={db_user} '\n            '--blobs --format=c {db_name} -n public | '\n            'pg_restore -U {db_postgresql_postgres_user} --create '\n            '--dbname={db_name}')", "path": "burlap/postgresql.py", "identifier": "PostgreSQLSatchel.dumpload", "docstring": "Dumps and loads a database snapshot simultaneously.\n        Requires that the destination server has direct database access\n        to the source server.\n\n        This is better than a serial dump+load when:\n        1. The network connection is reliable.\n        2. You don't need to save the dump file.\n\n        The benefits of this over a dump+load are:\n        1. Usually runs faster, since the load and dump happen in parallel.\n        2. Usually takes up less disk space since no separate dump file is\n            downloaded.", "docstring_tokens": ["Dumps", "and", "loads", "a", "database", "snapshot", "simultaneously", ".", "Requires", "that", "the", "destination", "server", "has", "direct", "database", "access", "to", "the", "source", "server", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 257851}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L842-L877", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Randomly or centrally crop multiple images.", "language": "python", "parameters": "(x, wrg, hrg, is_random=False, row_index=0, col_index=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "0", ",", "arg_5", "=", "1", ")", ":", "arg_6", ",", "arg_7", "=", "arg_0", "[", "0", "]", ".", "shape", "[", "arg_4", "]", ",", "arg_0", "[", "0", "]", ".", "shape", "[", "arg_5", "]", "if", "(", "arg_6", "<", "arg_2", ")", "or", "(", "arg_7", "<", "arg_1", ")", ":", "raise", "AssertionError", "(", "\"The size of cropping should smaller than or equal to the original image\"", ")", "if", "arg_3", ":", "arg_8", "=", "int", "(", "np", ".", "random", ".", "uniform", "(", "0", ",", "arg_6", "-", "arg_2", ")", ")", "arg_9", "=", "int", "(", "np", ".", "random", ".", "uniform", "(", "0", ",", "arg_7", "-", "arg_1", ")", ")", "arg_10", "=", "[", "]", "for", "arg_11", "in", "arg_0", ":", "arg_10", ".", "append", "(", "arg_11", "[", "arg_8", ":", "arg_2", "+", "arg_8", ",", "arg_9", ":", "arg_1", "+", "arg_9", "]", ")", "return", "np", ".", "asarray", "(", "arg_10", ")", "else", ":", "arg_8", "=", "(", "arg_6", "-", "arg_2", ")", "/", "2", "arg_9", "=", "(", "arg_7", "-", "arg_1", ")", "/", "2", "arg_10", "=", "[", "]", "for", "arg_11", "in", "arg_0", ":", "arg_10", ".", "append", "(", "arg_11", "[", "arg_8", ":", "arg_6", "-", "arg_8", ",", "arg_9", ":", "arg_7", "-", "arg_9", "]", ")", "return", "np", ".", "asarray", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=0, arg_5=1):\n    \"\"\"Randomly or centrally crop multiple images.\n\n    Parameters\n    ----------\n    x : list of numpy.array\n        List of images with dimension of [n_images, row, col, channel] (default).\n    others : args\n        See ``tl.prepro.crop``.\n\n    Returns\n    -------\n    numpy.array\n        A list of processed images.\n\n    \"\"\"\n    arg_6, arg_7 = arg_0[0].shape[arg_4], arg_0[0].shape[arg_5]\n\n    if (arg_6 < arg_2) or (arg_7 < arg_1):\n        raise AssertionError(\"The size of cropping should smaller than or equal to the original image\")\n\n    if arg_3:\n        arg_8 = int(np.random.uniform(0, arg_6 - arg_2))\n        arg_9 = int(np.random.uniform(0, arg_7 - arg_1))\n        arg_10 = []\n        for arg_11 in arg_0:\n            arg_10.append(arg_11[arg_8:arg_2 + arg_8, arg_9:arg_1 + arg_9])\n        return np.asarray(arg_10)\n    else:\n        # central crop\n        arg_8 = (arg_6 - arg_2) / 2\n        arg_9 = (arg_7 - arg_1) / 2\n        arg_10 = []\n        for arg_11 in arg_0:\n            arg_10.append(arg_11[arg_8:arg_6 - arg_8, arg_9:arg_7 - arg_9])\n        return np.asarray(arg_10)", "path": "tensorlayer/prepro.py", "identifier": "crop_multi", "docstring": "Randomly or centrally crop multiple images.\n\n    Parameters\n    ----------\n    x : list of numpy.array\n        List of images with dimension of [n_images, row, col, channel] (default).\n    others : args\n        See ``tl.prepro.crop``.\n\n    Returns\n    -------\n    numpy.array\n        A list of processed images.", "docstring_tokens": ["Randomly", "or", "centrally", "crop", "multiple", "images", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 257852}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L98-L120", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get the current frontmost application.", "language": "python", "parameters": "(cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_getRunningApps", "(", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "arg_2", ".", "processIdentifier", "(", ")", "arg_4", "=", "arg_0", ".", "getAppRefByPid", "(", "arg_3", ")", "try", ":", "if", "arg_4", ".", "AXFrontmost", ":", "return", "arg_4", "except", "(", "_a11y", ".", "ErrorUnsupported", ",", "_a11y", ".", "ErrorCannotComplete", ",", "_a11y", ".", "ErrorAPIDisabled", ",", "_a11y", ".", "ErrorNotImplemented", ")", ":", "pass", "raise", "ValueError", "(", "'No GUI application found.'", ")"], "function": "def Func(arg_0):\n        \"\"\"Get the current frontmost application.\n\n        Raise a ValueError exception if no GUI applications are found.\n        \"\"\"\n        # Refresh the runningApplications list\n        arg_1 = arg_0._getRunningApps()\n        for arg_2 in arg_1:\n            arg_3 = arg_2.processIdentifier()\n            arg_4 = arg_0.getAppRefByPid(arg_3)\n            try:\n                if arg_4.AXFrontmost:\n                    return arg_4\n            except (_a11y.ErrorUnsupported,\n                    _a11y.ErrorCannotComplete,\n                    _a11y.ErrorAPIDisabled,\n                    _a11y.ErrorNotImplemented):\n                # Some applications do not have an explicit GUI\n                # and so will not have an AXFrontmost attribute\n                # Trying to read attributes from Google Chrome Helper returns\n                # ErrorAPIDisabled for some reason - opened radar bug 12837995\n                pass\n        raise ValueError('No GUI application found.')", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement.getFrontmostApp", "docstring": "Get the current frontmost application.\n\n        Raise a ValueError exception if no GUI applications are found.", "docstring_tokens": ["Get", "the", "current", "frontmost", "application", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 257853}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/export/transcript.py#L15-L36", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Export all transcripts to .bed like format", "language": "python", "parameters": "(context, build)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "\"Running scout export Func\"", ")", "arg_2", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_3", "=", "[", "\"#Chrom\\tStart\\tEnd\\tTranscript\\tRefSeq\\tHgncID\"", "]", "for", "arg_4", "in", "arg_3", ":", "click", ".", "echo", "(", "arg_4", ")", "arg_5", "=", "(", "\"{0}\\t{1}\\t{2}\\t{3}\\t{4}\\t{5}\"", ")", "for", "arg_6", "in", "export_Func", "(", "arg_2", ")", ":", "click", ".", "echo", "(", "arg_5", ".", "format", "(", "arg_6", "[", "'chrom'", "]", ",", "arg_6", "[", "'start'", "]", ",", "arg_6", "[", "'end'", "]", ",", "arg_6", "[", "'ensembl_transcript_id'", "]", ",", "arg_6", ".", "get", "(", "'refseq_id'", ",", "''", ")", ",", "arg_6", "[", "'hgnc_id'", "]", ",", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Export all Func to .bed like format\"\"\"\n    LOG.info(\"Running scout export Func\")\n    arg_2 = arg_0.obj['adapter']\n    \n    arg_3 = [\"#Chrom\\tStart\\tEnd\\tTranscript\\tRefSeq\\tHgncID\"]\n\n    for arg_4 in arg_3:\n        click.echo(arg_4)\n\n    arg_5 = (\"{0}\\t{1}\\t{2}\\t{3}\\t{4}\\t{5}\")\n\n    for arg_6 in export_Func(arg_2):\n        click.echo(arg_5.format(\n            arg_6['chrom'],\n            arg_6['start'],\n            arg_6['end'],\n            arg_6['ensembl_transcript_id'],\n            arg_6.get('refseq_id',''),\n            arg_6['hgnc_id'],\n            )\n        )", "path": "scout/commands/export/transcript.py", "identifier": "transcripts", "docstring": "Export all transcripts to .bed like format", "docstring_tokens": ["Export", "all", "transcripts", "to", ".", "bed", "like", "format"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257854}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case.py#L164-L213", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update the dynamic gene list for a case", "language": "python", "parameters": "(self, case, hgnc_symbols=None, hgnc_ids=None,\n                                 phenotype_ids=None, build='37')", "return_statement": "return updated_case", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "'37'", ")", ":", "arg_6", "=", "[", "]", "arg_7", "=", "[", "]", "if", "arg_3", ":", "LOG", ".", "info", "(", "\"Fetching genes by hgnc id\"", ")", "arg_7", "=", "arg_0", ".", "hgnc_collection", ".", "find", "(", "{", "'hgnc_id'", ":", "{", "'$in'", ":", "arg_3", "}", ",", "'build'", ":", "arg_5", "}", ")", "elif", "arg_2", ":", "LOG", ".", "info", "(", "\"Fetching genes by hgnc symbols\"", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_2", ":", "for", "arg_9", "in", "arg_0", ".", "gene_by_alias", "(", "arg_8", "=", "arg_8", ",", "arg_5", "=", "arg_5", ")", ":", "arg_7", ".", "append", "(", "arg_9", ")", "for", "arg_9", "in", "arg_7", ":", "arg_6", ".", "append", "(", "{", "'hgnc_symbol'", ":", "arg_9", "[", "'hgnc_symbol'", "]", ",", "'hgnc_id'", ":", "arg_9", "[", "'hgnc_id'", "]", ",", "'description'", ":", "arg_9", "[", "'description'", "]", ",", "}", ")", "LOG", ".", "info", "(", "\"Update dynamic gene panel for: %s\"", ",", "arg_1", "[", "'display_name'", "]", ")", "arg_10", "=", "arg_0", ".", "case_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_1", "[", "'_id'", "]", "}", ",", "{", "'$set'", ":", "{", "'dynamic_gene_list'", ":", "arg_6", ",", "'dynamic_panel_phenotypes'", ":", "arg_4", "or", "[", "]", "}", "}", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "LOG", ".", "debug", "(", "\"Case updated\"", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                                 arg_4=None, arg_5='37'):\n        \"\"\"Update the dynamic gene list for a case\n\n        Adds a list of dictionaries to case['dynamic_gene_list'] that looks like\n\n        {\n            hgnc_symbol: str,\n            hgnc_id: int,\n            description: str\n        }\n\n        Arguments:\n            case (dict): The case that should be updated\n            hgnc_symbols (iterable): A list of hgnc_symbols\n            hgnc_ids (iterable): A list of hgnc_ids\n\n        Returns:\n            updated_case(dict)\n        \"\"\"\n        arg_6 = []\n        arg_7 = []\n        if arg_3:\n            LOG.info(\"Fetching genes by hgnc id\")\n            arg_7 = arg_0.hgnc_collection.find({'hgnc_id': {'$in': arg_3}, 'build': arg_5})\n        elif arg_2:\n            LOG.info(\"Fetching genes by hgnc symbols\")\n            arg_7 = []\n            for arg_8 in arg_2:\n                for arg_9 in arg_0.gene_by_alias(arg_8=arg_8, arg_5=arg_5):\n                    arg_7.append(arg_9)\n\n        for arg_9 in arg_7:\n            arg_6.append(\n                {\n                    'hgnc_symbol': arg_9['hgnc_symbol'],\n                    'hgnc_id': arg_9['hgnc_id'],\n                    'description': arg_9['description'],\n                }\n            )\n\n        LOG.info(\"Update dynamic gene panel for: %s\", arg_1['display_name'])\n        arg_10 = arg_0.case_collection.find_one_and_update(\n            {'_id': arg_1['_id']},\n            {'$set': {'dynamic_gene_list': arg_6,\n                      'dynamic_panel_phenotypes': arg_4 or []}},\n            return_document=pymongo.ReturnDocument.AFTER\n        )\n        LOG.debug(\"Case updated\")\n        return arg_10", "path": "scout/adapter/mongo/case.py", "identifier": "CaseHandler.update_dynamic_gene_list", "docstring": "Update the dynamic gene list for a case\n\n        Adds a list of dictionaries to case['dynamic_gene_list'] that looks like\n\n        {\n            hgnc_symbol: str,\n            hgnc_id: int,\n            description: str\n        }\n\n        Arguments:\n            case (dict): The case that should be updated\n            hgnc_symbols (iterable): A list of hgnc_symbols\n            hgnc_ids (iterable): A list of hgnc_ids\n\n        Returns:\n            updated_case(dict)", "docstring_tokens": ["Update", "the", "dynamic", "gene", "list", "for", "a", "case"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257855}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_lib.py#L107-L130", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns whether the input matches the given determinant limit.", "language": "python", "parameters": "(x, det_bounds)", "return_statement": "return tf.cast(tf.linalg.det(x) > det_bounds, dtype=x.dtype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "tf", ".", "cast", "(", "tf", ".", "linalg", ".", "det", "(", "arg_0", ")", ">", "arg_1", ",", "dtype", "=", "arg_0", ".", "dtype", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Returns whether the input matches the given determinant limit.\n\n  Args:\n    x: A floating-point `Tensor` of shape `[B1, ..., Bn, M, M]`.\n    det_bounds: A floating-point `Tensor` that must broadcast to shape\n      `[B1, ..., Bn]`, giving the desired lower bound on the\n      determinants in `x`.\n\n  Returns:\n    mask: A floating-point `Tensor` of shape [B1, ..., Bn].  Each\n      scalar is 1 if the corresponding matrix had determinant above\n      the corresponding bound, otherwise 0.\n  \"\"\"\n  # For the curious: I wonder whether it is possible and desirable to\n  # use a Cholesky decomposition-based algorithm for this, since the\n  # only matrices whose determinant this code cares about will be PSD.\n  # Didn't figure out how to code that in TensorFlow.\n  #\n  # Expert opinion is that it would be about twice as fast since\n  # Cholesky is roughly half the cost of Gaussian Elimination with\n  # Partial Pivoting. But this is less of an impact than the switch in\n  # _psd_mask.\n  return tf.cast(tf.linalg.det(arg_0) > arg_1, dtype=arg_0.dtype)", "path": "tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_lib.py", "identifier": "_det_large_enough_mask", "docstring": "Returns whether the input matches the given determinant limit.\n\n  Args:\n    x: A floating-point `Tensor` of shape `[B1, ..., Bn, M, M]`.\n    det_bounds: A floating-point `Tensor` that must broadcast to shape\n      `[B1, ..., Bn]`, giving the desired lower bound on the\n      determinants in `x`.\n\n  Returns:\n    mask: A floating-point `Tensor` of shape [B1, ..., Bn].  Each\n      scalar is 1 if the corresponding matrix had determinant above\n      the corresponding bound, otherwise 0.", "docstring_tokens": ["Returns", "whether", "the", "input", "matches", "the", "given", "determinant", "limit", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257856}
{"url": "https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/advanced.py#L70-L75", "sha": "188e1bf1f15a44d9a599028d020083af9fb43ea7", "docstring_summary": "If the form or formsets are invalid, re-render the context data with the\n        data-filled form and formsets and errors.", "language": "python", "parameters": "(self, form, inlines)", "return_statement": "return self.render_to_response(self.get_context_data(form=form, inlines=inlines))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "render_to_response", "(", "arg_0", ".", "get_context_data", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        If the form or formsets are invalid, re-render the context data with the\n        data-filled form and formsets and errors.\n        \"\"\"\n        return arg_0.render_to_response(arg_0.get_context_data(arg_1=arg_1, arg_2=arg_2))", "path": "extra_views/advanced.py", "identifier": "ModelFormWithInlinesMixin.forms_invalid", "docstring": "If the form or formsets are invalid, re-render the context data with the\n        data-filled form and formsets and errors.", "docstring_tokens": ["If", "the", "form", "or", "formsets", "are", "invalid", "re", "-", "render", "the", "context", "data", "with", "the", "data", "-", "filled", "form", "and", "formsets", "and", "errors", "."], "nwo": "AndrewIngram/django-extra-views", "score": 0.5916871811422788, "idx": 257857}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L220-L247", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Main function to start change log generation", "language": "python", "parameters": "(self)", "return_statement": "return log", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "fetch_and_filter_tags", "(", ")", "arg_1", "=", "arg_0", ".", "sort_tags_by_date", "(", "arg_0", ".", "filtered_tags", ")", "arg_0", ".", "filtered_tags", "=", "arg_1", "arg_0", ".", "fetch_and_filter_issues_and_pr", "(", ")", "arg_3", "=", "str", "(", "arg_0", ".", "options", ".", "frontmatter", ")", "if", "arg_0", ".", "options", ".", "frontmatter", "else", "u\"\"", "arg_3", "+=", "u\"{0}\\n\\n\"", ".", "format", "(", "arg_0", ".", "options", ".", "header", ")", "if", "arg_0", ".", "options", ".", "unreleased_only", ":", "arg_3", "+=", "arg_0", ".", "generate_unreleased_section", "(", ")", "else", ":", "arg_3", "+=", "arg_0", ".", "generate_log_for_all_tags", "(", ")", "try", ":", "with", "open", "(", "arg_0", ".", "options", ".", "base", ")", "as", "fh", ":", "arg_3", "+=", "fh", ".", "read", "(", ")", "except", "(", "TypeError", ",", "IOError", ")", ":", "pass", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Main function to start change log generation\n\n        :rtype: str\n        :return: Generated change log file\n        \"\"\"\n\n        arg_0.fetch_and_filter_tags()\n        arg_1 = arg_0.sort_tags_by_date(arg_0.filtered_tags)\n        arg_0.filtered_tags = arg_1\n        arg_0.fetch_and_filter_issues_and_pr()\n\n        arg_3 = str(arg_0.options.frontmatter) \\\n            if arg_0.options.frontmatter else u\"\"\n        arg_3 += u\"{0}\\n\\n\".format(arg_0.options.header)\n\n        if arg_0.options.unreleased_only:\n            arg_3 += arg_0.generate_unreleased_section()\n        else:\n            arg_3 += arg_0.generate_log_for_all_tags()\n\n        try:\n            with open(arg_0.options.base) as fh:\n                arg_3 += fh.read()\n        except (TypeError, IOError):\n            pass\n        return arg_3", "path": "pygcgen/generator.py", "identifier": "Generator.compound_changelog", "docstring": "Main function to start change log generation\n\n        :rtype: str\n        :return: Generated change log file", "docstring_tokens": ["Main", "function", "to", "start", "change", "log", "generation"], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 257858}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L98-L125", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Retrieves callbacks from a subscriber", "language": "python", "parameters": "(transfer_future, callback_type)", "return_statement": "return callbacks", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "meta", ".", "call_args", ".", "subscribers", ":", "arg_4", "=", "'on_'", "+", "arg_1", "if", "hasattr", "(", "arg_3", ",", "arg_4", ")", ":", "arg_2", ".", "append", "(", "functools", ".", "partial", "(", "getattr", "(", "arg_3", ",", "arg_4", ")", ",", "future", "=", "arg_0", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Retrieves callbacks from a subscriber\n\n    :type transfer_future: s3transfer.futures.TransferFuture\n    :param transfer_future: The transfer future the subscriber is associated\n        to.\n\n    :type callback_type: str\n    :param callback_type: The type of callback to retrieve from the subscriber.\n        Valid types include:\n            * 'queued'\n            * 'progress'\n            * 'done'\n\n    :returns: A list of callbacks for the type specified. All callbacks are\n        preinjected with the transfer future.\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_0.meta.call_args.subscribers:\n        arg_4 = 'on_' + arg_1\n        if hasattr(arg_3, arg_4):\n            arg_2.append(\n                functools.partial(\n                    getattr(arg_3, arg_4),\n                    future=arg_0\n                )\n            )\n    return arg_2", "path": "s3transfer/utils.py", "identifier": "get_callbacks", "docstring": "Retrieves callbacks from a subscriber\n\n    :type transfer_future: s3transfer.futures.TransferFuture\n    :param transfer_future: The transfer future the subscriber is associated\n        to.\n\n    :type callback_type: str\n    :param callback_type: The type of callback to retrieve from the subscriber.\n        Valid types include:\n            * 'queued'\n            * 'progress'\n            * 'done'\n\n    :returns: A list of callbacks for the type specified. All callbacks are\n        preinjected with the transfer future.", "docstring_tokens": ["Retrieves", "callbacks", "from", "a", "subscriber"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 257859}
{"url": "https://github.com/edx/edx-search/blob/476cf02b71ceba34ae7d8b798f36d60692317c55/search/elastic.py#L206-L208", "sha": "476cf02b71ceba34ae7d8b798f36d60692317c55", "docstring_summary": "set new mapped-items structure into cache", "language": "python", "parameters": "(cls, index_name, doc_type, mappings)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "cache", ".", "set", "(", "arg_0", ".", "get_cache_item_name", "(", "arg_1", ",", "arg_2", ")", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" set new mapped-items structure into cache \"\"\"\n        cache.set(arg_0.get_cache_item_name(arg_1, arg_2), arg_3)", "path": "search/elastic.py", "identifier": "ElasticSearchEngine.set_mappings", "docstring": "set new mapped-items structure into cache", "docstring_tokens": ["set", "new", "mapped", "-", "items", "structure", "into", "cache"], "nwo": "edx/edx-search", "score": 0.5271177144519781, "idx": 257860}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/uxpath/functions.py#L131-L137", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Yields one boolean, whether the first string starts with the second", "language": "python", "parameters": "(ctx, full, part)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "next", "(", "string_arg", "(", "arg_0", ",", "arg_1", ")", ",", "''", ")", "arg_2", "=", "next", "(", "string_arg", "(", "arg_0", ",", "arg_2", ")", ",", "''", ")", "yield", "arg_1", ".", "startswith", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''\n    Yields one boolean, whether the first string starts with the second\n    '''\n    arg_1 = next(string_arg(arg_0, arg_1), '')\n    arg_2 = next(string_arg(arg_0, arg_2), '')\n    yield arg_1.startswith(arg_2)", "path": "pylib/uxml/uxpath/functions.py", "identifier": "starts_with", "docstring": "Yields one boolean, whether the first string starts with the second", "docstring_tokens": ["Yields", "one", "boolean", "whether", "the", "first", "string", "starts", "with", "the", "second"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 257861}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L126-L144", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Load a skeleton definition from a text file.", "language": "python", "parameters": "(self, source, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "logging", ".", "info", "(", "'%s: parsing skeleton configuration'", ",", "arg_1", ")", "if", "hasattr", "(", "arg_1", ",", "'read'", ")", ":", "arg_3", "=", "parser", ".", "parse", "(", "arg_1", ",", "arg_0", ".", "world", ",", "arg_0", ".", "jointgroup", ",", "**", "arg_2", ")", "else", ":", "with", "open", "(", "arg_1", ")", "as", "handle", ":", "arg_3", "=", "parser", ".", "parse", "(", "handle", ",", "arg_0", ".", "world", ",", "arg_0", ".", "jointgroup", ",", "**", "arg_2", ")", "arg_0", ".", "bodies", "=", "arg_3", ".", "bodies", "arg_0", ".", "joints", "=", "arg_3", ".", "joints", "arg_0", ".", "set_pid_params", "(", "kp", "=", "0.999", "/", "arg_0", ".", "world", ".", "dt", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        '''Load a skeleton definition from a text file.\n\n        Parameters\n        ----------\n        source : str or file\n            A filename or file-like object that contains text information\n            describing a skeleton. See :class:`pagoda.parser.BodyParser` for\n            more information about the format of the text file.\n        '''\n        logging.info('%s: parsing skeleton configuration', arg_1)\n        if hasattr(arg_1, 'read'):\n            arg_3 = parser.parse(arg_1, arg_0.world, arg_0.jointgroup, **arg_2)\n        else:\n            with open(arg_1) as handle:\n                arg_3 = parser.parse(handle, arg_0.world, arg_0.jointgroup, **arg_2)\n        arg_0.bodies = arg_3.bodies\n        arg_0.joints = arg_3.joints\n        arg_0.set_pid_params(kp=0.999 / arg_0.world.dt)", "path": "pagoda/skeleton.py", "identifier": "Skeleton.load_skel", "docstring": "Load a skeleton definition from a text file.\n\n        Parameters\n        ----------\n        source : str or file\n            A filename or file-like object that contains text information\n            describing a skeleton. See :class:`pagoda.parser.BodyParser` for\n            more information about the format of the text file.", "docstring_tokens": ["Load", "a", "skeleton", "definition", "from", "a", "text", "file", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 257862}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L828-L855", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return the specified grid.", "language": "python", "parameters": "(grid_id)", "return_statement": "return gs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert_is_type", "(", "arg_0", ",", "str", ")", "arg_1", "=", "api", "(", "\"GET /99/Grids/%s\"", "%", "arg_0", ")", "arg_2", "=", "[", "get_model", "(", "key", "[", "\"name\"", "]", ")", "for", "key", "in", "arg_1", "[", "\"model_ids\"", "]", "]", "arg_3", "=", "api", "(", "\"GET /3/Models/%s\"", "%", "arg_1", "[", "\"model_ids\"", "]", "[", "0", "]", "[", "\"name\"", "]", ")", "[", "\"models\"", "]", "[", "0", "]", "arg_4", "=", "H2OGridSearch", "(", "None", ",", "{", "}", ",", "arg_0", ")", "arg_4", ".", "_resolve_grid", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "arg_4", ".", "models", "=", "arg_2", "arg_5", "=", "{", "arg_6", ":", "set", "(", ")", "for", "arg_6", "in", "arg_4", ".", "hyper_names", "}", "for", "arg_6", "in", "arg_4", ".", "hyper_names", ":", "for", "arg_7", "in", "arg_2", ":", "if", "isinstance", "(", "arg_7", ".", "full_parameters", "[", "arg_6", "]", "[", "\"actual_value\"", "]", ",", "list", ")", ":", "arg_5", "[", "arg_6", "]", ".", "add", "(", "arg_7", ".", "full_parameters", "[", "arg_6", "]", "[", "\"actual_value\"", "]", "[", "0", "]", ")", "else", ":", "arg_5", "[", "arg_6", "]", ".", "add", "(", "arg_7", ".", "full_parameters", "[", "arg_6", "]", "[", "\"actual_value\"", "]", ")", "arg_5", "=", "{", "str", "(", "arg_6", ")", ":", "list", "(", "vals", ")", "for", "arg_6", ",", "vals", "in", "arg_5", ".", "items", "(", ")", "}", "arg_4", ".", "hyper_params", "=", "arg_5", "arg_4", ".", "model", "=", "arg_7", ".", "__class__", "(", ")", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"\n    Return the specified grid.\n\n    :param grid_id: The grid identification in h2o\n\n    :returns: an :class:`H2OGridSearch` instance.\n    \"\"\"\n    assert_is_type(arg_0, str)\n    arg_1 = api(\"GET /99/Grids/%s\" % arg_0)\n    arg_2 = [get_model(key[\"name\"]) for key in arg_1[\"model_ids\"]]\n    # get first model returned in list of models from grid search to get model class (binomial, multinomial, etc)\n    arg_3 = api(\"GET /3/Models/%s\" % arg_1[\"model_ids\"][0][\"name\"])[\"models\"][0]\n    arg_4 = H2OGridSearch(None, {}, arg_0)\n    arg_4._resolve_grid(arg_0, arg_1, arg_3)\n    arg_4.models = arg_2\n    arg_5 = {arg_6: set() for arg_6 in arg_4.hyper_names}\n    for arg_6 in arg_4.hyper_names:\n        for arg_7 in arg_2:\n            if isinstance(arg_7.full_parameters[arg_6][\"actual_value\"], list):\n                arg_5[arg_6].add(arg_7.full_parameters[arg_6][\"actual_value\"][0])\n            else:\n                arg_5[arg_6].add(arg_7.full_parameters[arg_6][\"actual_value\"])\n\n    arg_5 = {str(arg_6): list(vals) for arg_6, vals in arg_5.items()}\n    arg_4.hyper_params = arg_5\n    arg_4.model = arg_7.__class__()\n    return arg_4", "path": "h2o-py/h2o/h2o.py", "identifier": "get_grid", "docstring": "Return the specified grid.\n\n    :param grid_id: The grid identification in h2o\n\n    :returns: an :class:`H2OGridSearch` instance.", "docstring_tokens": ["Return", "the", "specified", "grid", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257863}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/tools.py#L40-L54", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "todo is it really useful ?", "language": "python", "parameters": "(data)", "return_statement": "return np.concatenate((data[N//2+1:], data[0:N//2]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "len", "(", "arg_0", ")", "return", "np", ".", "concatenate", "(", "(", "arg_0", "[", "arg_1", "//", "2", "+", "1", ":", "]", ",", "arg_0", "[", "0", ":", "arg_1", "//", "2", "]", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"todo is it really useful ?\n\n    Swap  sides\n\n    .. doctest::\n\n        >>> from spectrum import swapsides\n        >>> x = [-2, -1, 1, 2]\n        >>> swapsides(x)\n        array([ 2, -2, -1])\n\n    \"\"\"\n    arg_1 = len(arg_0)\n    return np.concatenate((arg_0[arg_1//2+1:], arg_0[0:arg_1//2]))", "path": "src/spectrum/tools.py", "identifier": "_swapsides", "docstring": "todo is it really useful ?\n\n    Swap  sides\n\n    .. doctest::\n\n        >>> from spectrum import swapsides\n        >>> x = [-2, -1, 1, 2]\n        >>> swapsides(x)\n        array([ 2, -2, -1])", "docstring_tokens": ["todo", "is", "it", "really", "useful", "?"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 257864}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L322-L337", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Triggers when entering the given testsuite", "language": "python", "parameters": "(trun, tsuite)", "return_statement": "return rcode", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "[", "\"conf\"", "]", "[", "\"VERBOSE\"", "]", ":", "cij", ".", "emph", "(", "\"rnr:tsuite:enter { name: %r }\"", "%", "arg_1", "[", "\"name\"", "]", ")", "arg_2", "=", "0", "for", "arg_3", "in", "arg_1", "[", "\"hooks\"", "]", "[", "\"enter\"", "]", ":", "arg_2", "=", "script_run", "(", "arg_0", ",", "arg_3", ")", "if", "arg_2", ":", "break", "if", "arg_0", "[", "\"conf\"", "]", "[", "\"VERBOSE\"", "]", ":", "cij", ".", "emph", "(", "\"rnr:tsuite:enter { rcode: %r } \"", "%", "arg_2", ",", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Triggers when entering the given testsuite\"\"\"\n\n    if arg_0[\"conf\"][\"VERBOSE\"]:\n        cij.emph(\"rnr:tsuite:enter { name: %r }\" % arg_1[\"name\"])\n\n    arg_2 = 0\n    for arg_3 in arg_1[\"hooks\"][\"enter\"]:     # ENTER-hooks\n        arg_2 = script_run(arg_0, arg_3)\n        if arg_2:\n            break\n\n    if arg_0[\"conf\"][\"VERBOSE\"]:\n        cij.emph(\"rnr:tsuite:enter { rcode: %r } \" % arg_2, arg_2)\n\n    return arg_2", "path": "modules/cij/runner.py", "identifier": "tsuite_enter", "docstring": "Triggers when entering the given testsuite", "docstring_tokens": ["Triggers", "when", "entering", "the", "given", "testsuite"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 257865}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/has_funcs.py#L699-L760", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Check whether the submission did not generate a runtime error.", "language": "python", "parameters": "(\n    state,\n    incorrect_msg=\"Have a look at the console: your code contains an error. Fix it and try again!\",\n)", "return_statement": "return state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Have a look at the console: your code contains an error. Fix it and try again!\"", ",", ")", ":", "arg_0", ".", "assert_root", "(", "\"Func\"", ")", "if", "arg_0", ".", "reporter", ".", "errors", ":", "arg_2", "=", "arg_0", ".", "build_message", "(", "arg_1", ",", "{", "\"error\"", ":", "str", "(", "arg_0", ".", "reporter", ".", "errors", "[", "0", "]", ")", "}", ")", "arg_0", ".", "report", "(", "Feedback", "(", "arg_2", ",", "arg_0", ")", ")", "return", "arg_0"], "function": "def Func(\n    arg_0,\n    arg_1=\"Have a look at the console: your code contains an error. Fix it and try again!\",\n):\n    \"\"\"Check whether the submission did not generate a runtime error.\n\n    If all SCTs for an exercise pass, before marking the submission as correct pythonwhat will automatically check whether\n    the student submission generated an error. This means it is not needed to use ``Func()`` explicitly.\n\n    However, in some cases, using ``Func()`` explicitly somewhere throughout your SCT execution can be helpful:\n\n    - If you want to make sure people didn't write typos when writing a long function name.\n    - If you want to first verify whether a function actually runs, before checking whether the arguments were specified correctly.\n    - More generally, if, because of the content, it's instrumental that the script runs without\n      errors before doing any other verifications.\n\n    Args:\n        incorrect_msg: if specified, this overrides the default message if the student code generated an error.\n\n    :Example:\n\n        Suppose you're verifying an exercise about model training and validation: ::\n\n            # pre exercise code\n            import numpy as np\n            from sklearn.model_selection import train_test_split\n            from sklearn import datasets\n            from sklearn import svm\n\n            iris = datasets.load_iris()\n            iris.data.shape, iris.target.shape\n\n            # solution\n            X_train, X_test, y_train, y_test = train_test_split(\n                iris.data, iris.target, test_size=0.4, random_state=0)\n\n        If you want to make sure that ``train_test_split()`` ran without errors,\n        which would check if the student typed the function without typos and used\n        sensical arguments, you could use the following SCT: ::\n\n            Ex().Func()\n            Ex().check_function('sklearn.model_selection.train_test_split').multi(\n                check_args(['arrays', 0]).has_equal_value(),\n                check_args(['arrays', 0]).has_equal_value(),\n                check_args(['options', 'test_size']).has_equal_value(),\n                check_args(['options', 'random_state']).has_equal_value()\n            )\n\n        If, on the other hand, you want to fall back onto pythonwhat's built in behavior,\n        that checks for an error before marking the exercise as correct, you can simply\n        leave of the ``Func()`` step.\n\n    \"\"\"\n    arg_0.assert_root(\"Func\")\n\n    if arg_0.reporter.errors:\n        arg_2 = arg_0.build_message(\n            arg_1, {\"error\": str(arg_0.reporter.errors[0])}\n        )\n        arg_0.report(Feedback(arg_2, arg_0))\n\n    return arg_0", "path": "pythonwhat/checks/has_funcs.py", "identifier": "has_no_error", "docstring": "Check whether the submission did not generate a runtime error.\n\n    If all SCTs for an exercise pass, before marking the submission as correct pythonwhat will automatically check whether\n    the student submission generated an error. This means it is not needed to use ``has_no_error()`` explicitly.\n\n    However, in some cases, using ``has_no_error()`` explicitly somewhere throughout your SCT execution can be helpful:\n\n    - If you want to make sure people didn't write typos when writing a long function name.\n    - If you want to first verify whether a function actually runs, before checking whether the arguments were specified correctly.\n    - More generally, if, because of the content, it's instrumental that the script runs without\n      errors before doing any other verifications.\n\n    Args:\n        incorrect_msg: if specified, this overrides the default message if the student code generated an error.\n\n    :Example:\n\n        Suppose you're verifying an exercise about model training and validation: ::\n\n            # pre exercise code\n            import numpy as np\n            from sklearn.model_selection import train_test_split\n            from sklearn import datasets\n            from sklearn import svm\n\n            iris = datasets.load_iris()\n            iris.data.shape, iris.target.shape\n\n            # solution\n            X_train, X_test, y_train, y_test = train_test_split(\n                iris.data, iris.target, test_size=0.4, random_state=0)\n\n        If you want to make sure that ``train_test_split()`` ran without errors,\n        which would check if the student typed the function without typos and used\n        sensical arguments, you could use the following SCT: ::\n\n            Ex().has_no_error()\n            Ex().check_function('sklearn.model_selection.train_test_split').multi(\n                check_args(['arrays', 0]).has_equal_value(),\n                check_args(['arrays', 0]).has_equal_value(),\n                check_args(['options', 'test_size']).has_equal_value(),\n                check_args(['options', 'random_state']).has_equal_value()\n            )\n\n        If, on the other hand, you want to fall back onto pythonwhat's built in behavior,\n        that checks for an error before marking the exercise as correct, you can simply\n        leave of the ``has_no_error()`` step.", "docstring_tokens": ["Check", "whether", "the", "submission", "did", "not", "generate", "a", "runtime", "error", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 257866}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/random.py#L98-L110", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Initialize internal state of the random number generator.", "language": "python", "parameters": "(self, a=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "super", "(", "Random", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "gauss_next", "=", "None"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Initialize internal state of the random number generator.\n\n        None or no argument Funcs from current time or from an operating\n        system specific randomness source if available.\n\n        If a is not None or is an int or long, hash(a) is used instead.\n        Hash values for some types are nondeterministic when the\n        PYTHONHASHSEED environment variable is enabled.\n        \"\"\"\n\n        super(Random, arg_0).Func(arg_1)\n        arg_0.gauss_next = None", "path": "third_party/stdlib/random.py", "identifier": "Random.seed", "docstring": "Initialize internal state of the random number generator.\n\n        None or no argument seeds from current time or from an operating\n        system specific randomness source if available.\n\n        If a is not None or is an int or long, hash(a) is used instead.\n        Hash values for some types are nondeterministic when the\n        PYTHONHASHSEED environment variable is enabled.", "docstring_tokens": ["Initialize", "internal", "state", "of", "the", "random", "number", "generator", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257867}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/sequences.py#L267-L274", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Finds the positions of all gaps in the sequence that are at least min_length long. Returns a list of Intervals. Coords are zero-based", "language": "python", "parameters": "(self, min_length = 1)", "return_statement": "return gaps", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "Func", "=", "[", "]", "arg_3", "=", "re", ".", "compile", "(", "'N+'", ",", "re", ".", "IGNORECASE", ")", "for", "arg_4", "in", "arg_3", ".", "finditer", "(", "arg_0", ".", "seq", ")", ":", "if", "arg_4", ".", "span", "(", ")", "[", "1", "]", "-", "arg_4", ".", "span", "(", ")", "[", "0", "]", "+", "1", ">=", "arg_1", ":", "Func", ".", "append", "(", "intervals", ".", "Interval", "(", "arg_4", ".", "span", "(", ")", "[", "0", "]", ",", "arg_4", ".", "span", "(", ")", "[", "1", "]", "-", "1", ")", ")", "return", "Func"], "function": "def Func(arg_0, arg_1 = 1):\n        '''Finds the positions of all gaps in the sequence that are at least min_length long. Returns a list of Intervals. Coords are zero-based'''\n        Func = []\n        arg_3 = re.compile('N+', re.IGNORECASE)\n        for arg_4 in arg_3.finditer(arg_0.seq):\n             if arg_4.span()[1] - arg_4.span()[0] + 1 >= arg_1:\n                 Func.append(intervals.Interval(arg_4.span()[0], arg_4.span()[1] - 1))\n        return Func", "path": "pyfastaq/sequences.py", "identifier": "Fasta.gaps", "docstring": "Finds the positions of all gaps in the sequence that are at least min_length long. Returns a list of Intervals. Coords are zero-based", "docstring_tokens": ["Finds", "the", "positions", "of", "all", "gaps", "in", "the", "sequence", "that", "are", "at", "least", "min_length", "long", ".", "Returns", "a", "list", "of", "Intervals", ".", "Coords", "are", "zero", "-", "based"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 257868}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/util/lens_fit_util.py#L114-L149", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "For lens data, compute the unmasked blurred image of every unmasked unblurred image of each plane. To do this, \\\n    this function iterates over all planes to extract their unmasked unblurred images.", "language": "python", "parameters": "(planes, padded_grid_stack, psf)", "return_statement": "return unmasked_blurred_image_of_planes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", ".", "has_pixelization", ":", "arg_5", "=", "None", "else", ":", "arg_5", "=", "arg_1", ".", "unmasked_blurred_image_from_psf_and_unmasked_image", "(", "arg_2", "=", "arg_2", ",", "unmasked_image_1d", "=", "arg_4", ".", "image_plane_image_1d", ")", "arg_3", ".", "append", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"For lens data, compute the unmasked blurred image of every unmasked unblurred image of each plane. To do this, \\\n    this function iterates over all planes to extract their unmasked unblurred images.\n\n    If a galaxy in a plane has a pixelization, the unmasked image is returned as None, as as the inversion's model \\\n    image cannot be mapped to an unmasked version.\n\n    This relies on using the lens data's padded-grid, which is a grid of (y,x) coordinates which extends over the \\\n    entire image as opposed to just the masked region.\n\n    This returns a list, where each list index corresponds to [plane_index].\n\n    Parameters\n    ----------\n    planes : [plane.Plane]\n        The list of planes the unmasked blurred images are computed using.\n    padded_grid_stack : grids.GridStack\n        A padded-grid_stack, whose padded grid is used for PSF convolution.\n    psf : ccd.PSF\n        The PSF of the image used for convolution.\n    \"\"\"\n    arg_3 = []\n\n    for arg_4 in arg_0:\n\n        if arg_4.has_pixelization:\n            arg_5 = None\n        else:\n            arg_5 = \\\n                arg_1.unmasked_blurred_image_from_psf_and_unmasked_image(\n\n                    arg_2=arg_2, unmasked_image_1d=arg_4.image_plane_image_1d)\n\n        arg_3.append(arg_5)\n\n    return arg_3", "path": "autolens/lens/util/lens_fit_util.py", "identifier": "unmasked_blurred_image_of_planes_from_padded_grid_stack_and_psf", "docstring": "For lens data, compute the unmasked blurred image of every unmasked unblurred image of each plane. To do this, \\\n    this function iterates over all planes to extract their unmasked unblurred images.\n\n    If a galaxy in a plane has a pixelization, the unmasked image is returned as None, as as the inversion's model \\\n    image cannot be mapped to an unmasked version.\n\n    This relies on using the lens data's padded-grid, which is a grid of (y,x) coordinates which extends over the \\\n    entire image as opposed to just the masked region.\n\n    This returns a list, where each list index corresponds to [plane_index].\n\n    Parameters\n    ----------\n    planes : [plane.Plane]\n        The list of planes the unmasked blurred images are computed using.\n    padded_grid_stack : grids.GridStack\n        A padded-grid_stack, whose padded grid is used for PSF convolution.\n    psf : ccd.PSF\n        The PSF of the image used for convolution.", "docstring_tokens": ["For", "lens", "data", "compute", "the", "unmasked", "blurred", "image", "of", "every", "unmasked", "unblurred", "image", "of", "each", "plane", ".", "To", "do", "this", "\\", "this", "function", "iterates", "over", "all", "planes", "to", "extract", "their", "unmasked", "unblurred", "images", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 257869}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/initializers.py#L221-L251", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Harris-motivated feature detection on a d-dimensional image.", "language": "python", "parameters": "(im, region_size=5, to_return='harris', scale=0.05)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ",", "arg_2", "=", "'harris'", ",", "arg_3", "=", "0.05", ")", ":", "arg_4", "=", "arg_0", ".", "ndim", "arg_5", "=", "[", "nd", ".", "sobel", "(", "arg_0", ",", "axis", "=", "i", ")", "for", "i", "in", "range", "(", "arg_4", ")", "]", "arg_6", "=", "np", ".", "zeros", "(", "(", "arg_4", ",", "arg_4", ")", "+", "arg_0", ".", "shape", ")", "for", "arg_7", "in", "range", "(", "arg_4", ")", ":", "for", "arg_8", "in", "range", "(", "arg_4", ")", ":", "arg_6", "[", "arg_7", ",", "arg_8", "]", "=", "nd", ".", "filters", ".", "gaussian_filter", "(", "arg_5", "[", "arg_7", "]", "*", "arg_5", "[", "arg_8", "]", ",", "arg_1", ")", "if", "arg_2", "==", "'matrix'", ":", "return", "arg_6", "arg_9", "=", "np", ".", "trace", "(", "arg_6", ",", "axis1", "=", "0", ",", "axis2", "=", "1", ")", "arg_10", "=", "np", ".", "linalg", ".", "det", "(", "arg_6", ".", "T", ")", ".", "T", "if", "arg_2", "==", "'trace-determinant'", ":", "return", "arg_9", ",", "arg_10", "else", ":", "arg_11", "=", "arg_10", "-", "arg_3", "*", "arg_9", "*", "arg_9", "return", "arg_11"], "function": "def Func(arg_0, arg_1=5, arg_2='harris', arg_3=0.05):\n    \"\"\"\n    Harris-motivated feature detection on a d-dimensional image.\n\n    Parameters\n    ---------\n        im\n        region_size\n        to_return : {'harris','matrix','trace-determinant'}\n\n    \"\"\"\n    arg_4 = arg_0.ndim\n    #1. Gradient of image\n    arg_5 = [nd.sobel(arg_0, axis=i) for i in range(arg_4)]\n    #2. Corner response matrix\n    arg_6 = np.zeros((arg_4, arg_4) + arg_0.shape)\n    for arg_7 in range(arg_4):\n        for arg_8 in range(arg_4):\n            arg_6[arg_7,arg_8] = nd.filters.gaussian_filter(arg_5[arg_7]*arg_5[arg_8],\n                    arg_1)\n    if arg_2 == 'matrix':\n        return arg_6\n    #3. Trace, determinant\n    arg_9 = np.trace(arg_6, axis1=0, axis2=1)\n    arg_10 = np.linalg.det(arg_6.T).T\n    if arg_2 == 'trace-determinant':\n        return arg_9, arg_10\n    else:\n        #4. Harris detector:\n        arg_11 = arg_10 - arg_3*arg_9*arg_9\n        return arg_11", "path": "peri/initializers.py", "identifier": "harris_feature", "docstring": "Harris-motivated feature detection on a d-dimensional image.\n\n    Parameters\n    ---------\n        im\n        region_size\n        to_return : {'harris','matrix','trace-determinant'}", "docstring_tokens": ["Harris", "-", "motivated", "feature", "detection", "on", "a", "d", "-", "dimensional", "image", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 257870}
{"url": "https://github.com/oasis-open/cti-taxii-client/blob/b4c037fb61d8b8892af34423e2c67c81218d6f8e/taxii2client/__init__.py#L708-L711", "sha": "b4c037fb61d8b8892af34423e2c67c81218d6f8e", "docstring_summary": "Update the API Root's information and list of Collections", "language": "python", "parameters": "(self, accept=MEDIA_TYPE_TAXII_V20)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_0", ".", "Func_information", "(", "arg_1", ")", "arg_0", ".", "Func_collections", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Update the API Root's information and list of Collections\"\"\"\n        arg_0.Func_information(arg_1)\n        arg_0.Func_collections(arg_1)", "path": "taxii2client/__init__.py", "identifier": "ApiRoot.refresh", "docstring": "Update the API Root's information and list of Collections", "docstring_tokens": ["Update", "the", "API", "Root", "s", "information", "and", "list", "of", "Collections"], "nwo": "oasis-open/cti-taxii-client", "score": 0.36073444246388015, "idx": 257871}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L91-L114", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the portion of enthalpy of the compound phase covered by this\n        Cp record.", "language": "python", "parameters": "(self, T)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0.0", "if", "arg_1", "<", "arg_0", ".", "Tmax", ":", "arg_3", "=", "arg_1", "else", ":", "arg_3", "=", "arg_0", ".", "Tmax", "arg_4", "=", "arg_0", ".", "Tmin", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_0", ".", "_coefficients", ",", "arg_0", ".", "_exponents", ")", ":", "if", "arg_6", "==", "-", "1.0", ":", "arg_2", "+=", "arg_5", "*", "math", ".", "log", "(", "arg_3", "/", "arg_4", ")", "else", ":", "arg_2", "+=", "arg_5", "*", "(", "arg_3", "**", "(", "arg_6", "+", "1.0", ")", "-", "arg_4", "**", "(", "arg_6", "+", "1.0", ")", ")", "/", "(", "arg_6", "+", "1.0", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the portion of enthalpy of the compound phase covered by this\n        Cp record.\n\n        :param T: [K] temperature\n\n        :returns: [J/mol] Enthalpy.\n        \"\"\"\n\n        arg_2 = 0.0\n        if arg_1 < arg_0.Tmax:\n            arg_3 = arg_1\n        else:\n            arg_3 = arg_0.Tmax\n        arg_4 = arg_0.Tmin\n\n        for arg_5, arg_6 in zip(arg_0._coefficients, arg_0._exponents):\n            # Analytically integrate Cp(T).\n            if arg_6 == -1.0:\n                arg_2 += arg_5 * math.log(arg_3/arg_4)\n            else:\n                arg_2 += arg_5 * (arg_3**(arg_6+1.0) - arg_4**(arg_6+1.0)) / (arg_6+1.0)\n        return arg_2", "path": "auxi/tools/chemistry/thermochemistry.py", "identifier": "CpRecord.H", "docstring": "Calculate the portion of enthalpy of the compound phase covered by this\n        Cp record.\n\n        :param T: [K] temperature\n\n        :returns: [J/mol] Enthalpy.", "docstring_tokens": ["Calculate", "the", "portion", "of", "enthalpy", "of", "the", "compound", "phase", "covered", "by", "this", "Cp", "record", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 257872}
{"url": "https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/savefile.py#L90-L120", "sha": "67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8", "docstring_summary": "Load and validate the header of a pcap file.", "language": "python", "parameters": "(file_h)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "read", "(", "24", ")", "except", "UnicodeDecodeError", ":", "print", "(", "\"\\nMake sure the input file is opened in read binary, 'rb'\\n\"", ")", "raise", "InvalidEncoding", "(", "\"Could not read file; it might not be opened in binary mode.\"", ")", "if", "arg_1", "[", ":", "4", "]", "in", "[", "struct", ".", "pack", "(", "\">I\"", ",", "_MAGIC_NUMBER", ")", ",", "struct", ".", "pack", "(", "\">I\"", ",", "_MAGIC_NUMBER_NS", ")", "]", ":", "arg_2", "=", "b'big'", "arg_3", "=", "struct", ".", "unpack", "(", "'>IhhIIII'", ",", "arg_1", ")", "elif", "arg_1", "[", ":", "4", "]", "in", "[", "struct", ".", "pack", "(", "\"<I\"", ",", "_MAGIC_NUMBER", ")", ",", "struct", ".", "pack", "(", "\"<I\"", ",", "_MAGIC_NUMBER_NS", ")", "]", ":", "arg_2", "=", "b'little'", "arg_3", "=", "struct", ".", "unpack", "(", "'<IhhIIII'", ",", "arg_1", ")", "else", ":", "raise", "UnknownMagicNumber", "(", "\"No supported Magic Number found\"", ")", "(", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", "=", "arg_3", "arg_11", "=", "__pcap_header__", "(", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "ctypes", ".", "c_char_p", "(", "arg_2", ")", ",", "arg_4", "==", "_MAGIC_NUMBER_NS", ")", "if", "not", "__validate_header__", "(", "arg_11", ")", ":", "raise", "InvalidHeader", "(", "\"Invalid Header\"", ")", "else", ":", "return", "arg_11"], "function": "def Func(arg_0):\n    \"\"\"\n    Load and validate the header of a pcap file.\n    \"\"\"\n    try:\n        arg_1 = arg_0.read(24)\n    except UnicodeDecodeError:\n        print(\"\\nMake sure the input file is opened in read binary, 'rb'\\n\")\n        raise InvalidEncoding(\"Could not read file; it might not be opened in binary mode.\")\n\n    # in case the capture file is not the same endianness as ours, we have to\n    # use the correct byte order for the file header\n    if arg_1[:4] in [struct.pack(\">I\", _MAGIC_NUMBER),\n                                   struct.pack(\">I\", _MAGIC_NUMBER_NS)]:\n        arg_2 = b'big'\n        arg_3 = struct.unpack('>IhhIIII', arg_1)\n    elif arg_1[:4] in [struct.pack(\"<I\", _MAGIC_NUMBER),\n                                     struct.pack(\"<I\", _MAGIC_NUMBER_NS)]:\n        arg_2 = b'little'\n        arg_3 = struct.unpack('<IhhIIII', arg_1)\n    else:\n        raise UnknownMagicNumber(\"No supported Magic Number found\")\n\n    (arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10) = arg_3\n    arg_11 = __pcap_header__(arg_4, arg_5, arg_6, arg_7, arg_8, arg_9,\n                             arg_10, ctypes.c_char_p(arg_2),\n                             arg_4 == _MAGIC_NUMBER_NS)\n    if not __validate_header__(arg_11):\n        raise InvalidHeader(\"Invalid Header\")\n    else:\n        return arg_11", "path": "pcapfile/savefile.py", "identifier": "_load_savefile_header", "docstring": "Load and validate the header of a pcap file.", "docstring_tokens": ["Load", "and", "validate", "the", "header", "of", "a", "pcap", "file", "."], "nwo": "kisom/pypcapfile", "score": 0.3430538057229739, "idx": 257873}
{"url": "https://github.com/drestebon/papageorge/blob/a30ea59bf6b4f5d151bd3f476a0a8357d89495d4/lib/papageorge/model.py#L256-L289", "sha": "a30ea59bf6b4f5d151bd3f476a0a8357d89495d4", "docstring_summary": "Find a slider attacker", "language": "python", "parameters": "(dest_list, occ_bb, piece_bb, target_bb, pos,\n                             domain)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_5", "arg_9", "=", "reach", "[", "arg_6", "(", "arg_4", ")", "]", "[", "arg_7", "(", "arg_3", ",", "arg_4", ")", "]", "arg_10", "=", "arg_9", "&", "arg_7", "(", "arg_2", ",", "arg_4", ")", "while", "arg_10", ":", "arg_9", "=", "arg_10", "&", "-", "arg_10", "arg_11", "=", "arg_9", ".", "bit_length", "(", ")", "-", "1", "if", "not", "(", "ray", "[", "arg_11", "]", "[", "arg_6", "(", "arg_4", ")", "]", "&", "arg_7", "(", "arg_1", ",", "arg_4", ")", ")", ":", "arg_0", ".", "append", "(", "arg_8", "(", "arg_11", ",", "arg_4", ")", ")", "arg_10", "^=", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                             arg_5):\n    \"\"\" Find a slider attacker\n\n    Parameters\n    ----------\n    dest_list : list\n        To store the results.\n    occ_bb : int, bitboard\n        Occupancy bitboard.\n    piece_bb : int, bitboard\n        Bitboard with the position of the attacker piece.\n    target_bb : int, bitboard\n        Occupancy bitboard without any of the sliders in question.\n    pos : int\n        Target position.\n    pos_map : function\n        Mapping between a board position and its position in a single\n        rotated/translated rank produced with domain_trans.\n    domain_trans : function\n        Transformation from a rank/file/diagonal/anti-diagonal containing pos\n        to a single rank\n    pos_inv_map : function\n        Inverse of pos_map\n    \"\"\"\n    arg_6, arg_7, arg_8 = arg_5\n    arg_9 = reach[arg_6(arg_4)][arg_7(arg_3, arg_4)]\n    arg_10 = arg_9 & arg_7(arg_2, arg_4)\n    while arg_10:\n        arg_9 = arg_10&-arg_10\n        arg_11 = arg_9.bit_length()-1\n        if not (ray[arg_11][arg_6(arg_4)] & arg_7(arg_1, arg_4)):\n            arg_0.append(arg_8(arg_11, arg_4))\n        arg_10 ^= arg_9", "path": "lib/papageorge/model.py", "identifier": "find_attacker_slider", "docstring": "Find a slider attacker\n\n    Parameters\n    ----------\n    dest_list : list\n        To store the results.\n    occ_bb : int, bitboard\n        Occupancy bitboard.\n    piece_bb : int, bitboard\n        Bitboard with the position of the attacker piece.\n    target_bb : int, bitboard\n        Occupancy bitboard without any of the sliders in question.\n    pos : int\n        Target position.\n    pos_map : function\n        Mapping between a board position and its position in a single\n        rotated/translated rank produced with domain_trans.\n    domain_trans : function\n        Transformation from a rank/file/diagonal/anti-diagonal containing pos\n        to a single rank\n    pos_inv_map : function\n        Inverse of pos_map", "docstring_tokens": ["Find", "a", "slider", "attacker"], "nwo": "drestebon/papageorge", "score": 0.17821439704321745, "idx": 257874}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/convolution_layers.py#L217-L297", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert transposed convolution layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting transposed convolution ...'", ")", "if", "arg_6", "==", "'short'", ":", "arg_7", "=", "'C'", "+", "random_string", "(", "7", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_8", "=", "'{0}.bias'", ".", "format", "(", "arg_1", ")", "arg_9", "=", "'{0}.weight'", ".", "format", "(", "arg_1", ")", "if", "len", "(", "arg_5", "[", "arg_9", "]", ".", "numpy", "(", ")", ".", "shape", ")", "==", "4", ":", "arg_10", "=", "arg_5", "[", "arg_9", "]", ".", "numpy", "(", ")", ".", "transpose", "(", "2", ",", "3", ",", "1", ",", "0", ")", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", "=", "arg_10", ".", "shape", "arg_15", "=", "arg_0", "[", "'group'", "]", "if", "arg_15", ">", "1", ":", "raise", "AssertionError", "(", "'Cannot convert conv1d with groups != 1'", ")", "if", "arg_0", "[", "'dilations'", "]", "[", "0", "]", ">", "1", ":", "raise", "AssertionError", "(", "'Cannot convert conv1d with dilation_rate != 1'", ")", "if", "arg_8", "in", "arg_5", ":", "arg_16", "=", "arg_5", "[", "arg_8", "]", ".", "numpy", "(", ")", "arg_17", "=", "True", "else", ":", "arg_16", "=", "None", "arg_17", "=", "False", "arg_18", "=", "arg_3", "[", "0", "]", "if", "arg_17", ":", "arg_5", "=", "[", "arg_10", ",", "arg_16", "]", "else", ":", "arg_5", "=", "[", "arg_10", "]", "arg_19", "=", "keras", ".", "layers", ".", "Conv2DTranspose", "(", "filters", "=", "arg_13", ",", "kernel_size", "=", "(", "arg_11", ",", "arg_12", ")", ",", "strides", "=", "(", "arg_0", "[", "'strides'", "]", "[", "0", "]", ",", "arg_0", "[", "'strides'", "]", "[", "1", "]", ")", ",", "padding", "=", "'valid'", ",", "output_padding", "=", "0", ",", "arg_5", "=", "arg_5", ",", "use_bias", "=", "arg_17", ",", "activation", "=", "None", ",", "dilation_rate", "=", "arg_0", "[", "'dilations'", "]", "[", "0", "]", ",", "bias_initializer", "=", "'zeros'", ",", "kernel_initializer", "=", "'zeros'", ",", "name", "=", "arg_7", ")", "arg_4", "[", "arg_2", "]", "=", "arg_19", "(", "arg_4", "[", "arg_18", "]", ")", "arg_4", "[", "arg_2", "]", ".", "set_shape", "(", "arg_4", "[", "arg_2", "]", ".", "_keras_shape", ")", "arg_20", "=", "arg_0", "[", "'pads'", "]", "if", "arg_20", "[", "0", "]", ">", "0", ":", "assert", "(", "len", "(", "arg_20", ")", "==", "2", "or", "(", "arg_20", "[", "2", "]", "==", "arg_20", "[", "0", "]", "and", "arg_20", "[", "3", "]", "==", "arg_20", "[", "1", "]", ")", ")", "arg_21", "=", "keras", ".", "layers", ".", "Cropping2D", "(", "arg_20", "[", ":", "2", "]", ",", "name", "=", "arg_7", "+", "'_crop'", ")", "arg_4", "[", "arg_2", "]", "=", "arg_21", "(", "arg_4", "[", "arg_2", "]", ")", "else", ":", "raise", "AssertionError", "(", "'Layer is not supported for now'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert transposed convolution layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting transposed convolution ...')\n\n    if arg_6 == 'short':\n        arg_7 = 'C' + random_string(7)\n    elif arg_6 == 'keep':\n        arg_7 = arg_1\n    else:\n        arg_7 = arg_1 + str(random.random())\n\n    arg_8 = '{0}.bias'.format(arg_1)\n    arg_9 = '{0}.weight'.format(arg_1)\n\n    if len(arg_5[arg_9].numpy().shape) == 4:\n        arg_10 = arg_5[arg_9].numpy().transpose(2, 3, 1, 0)\n        arg_11, arg_12, arg_13, arg_14 = arg_10.shape\n\n        arg_15 = arg_0['group']\n        if arg_15 > 1:\n            raise AssertionError('Cannot convert conv1d with groups != 1')\n\n        if arg_0['dilations'][0] > 1:\n            raise AssertionError('Cannot convert conv1d with dilation_rate != 1')\n\n        if arg_8 in arg_5:\n            arg_16 = arg_5[arg_8].numpy()\n            arg_17 = True\n        else:\n            arg_16 = None\n            arg_17 = False\n\n        arg_18 = arg_3[0]\n\n        if arg_17:\n            arg_5 = [arg_10, arg_16]\n        else:\n            arg_5 = [arg_10]\n\n        arg_19 = keras.layers.Conv2DTranspose(\n            filters=arg_13,\n            kernel_size=(arg_11, arg_12),\n            strides=(arg_0['strides'][0], arg_0['strides'][1]),\n            padding='valid',\n            output_padding=0,\n            arg_5=arg_5,\n            use_bias=arg_17,\n            activation=None,\n            dilation_rate=arg_0['dilations'][0],\n            bias_initializer='zeros', kernel_initializer='zeros',\n            name=arg_7\n        )\n\n        arg_4[arg_2] = arg_19(arg_4[arg_18])\n\n        # Magic ad-hoc.\n        # See the Keras issue: https://github.com/keras-team/keras/issues/6777\n        arg_4[arg_2].set_shape(arg_4[arg_2]._keras_shape)\n\n        arg_20 = arg_0['pads']\n        if arg_20[0] > 0:\n            assert(len(arg_20) == 2 or (arg_20[2] == arg_20[0] and arg_20[3] == arg_20[1]))\n\n            arg_21 = keras.layers.Cropping2D(\n                arg_20[:2],\n                name=arg_7 + '_crop'\n            )\n            arg_4[arg_2] = arg_21(arg_4[arg_2])\n    else:\n        raise AssertionError('Layer is not supported for now')", "path": "pytorch2keras/convolution_layers.py", "identifier": "convert_convtranspose", "docstring": "Convert transposed convolution layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "transposed", "convolution", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 257875}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/process.py#L27-L54", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "This function deal with the nova notification.", "language": "python", "parameters": "(body, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "'event_type'", "]", "arg_3", "=", "nova_customer_process", ".", "get", "(", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "(", "arg_0", ",", "arg_1", ")", "else", ":", "arg_4", "=", "False", "arg_5", "=", "None", "for", "arg_6", "in", "nova_customer_process_wildcard", ".", "keys", "(", ")", ":", "if", "arg_6", ".", "match", "(", "arg_2", ")", ":", "arg_5", "=", "nova_customer_process_wildcard", ".", "get", "(", "arg_6", ")", "arg_4", "=", "True", "break", "if", "arg_4", ":", "arg_5", "(", "arg_0", ",", "arg_1", ")", "else", ":", "default_process", "(", "arg_0", ",", "arg_1", ")", "arg_1", ".", "ack", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This function deal with the nova notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:\n    \"\"\"\n    arg_2 = arg_0['event_type']\n    arg_3 = nova_customer_process.get(arg_2)\n    if arg_3 is not None:\n        arg_3(arg_0, arg_1)\n    else:\n        arg_4 = False\n        arg_5 = None\n        for arg_6 in nova_customer_process_wildcard.keys():\n            if arg_6.match(arg_2):\n                arg_5 = nova_customer_process_wildcard.get(arg_6)\n                arg_4 = True\n                break\n        if arg_4:\n            arg_5(arg_0, arg_1)\n        else:\n            default_process(arg_0, arg_1)\n    arg_1.ack()", "path": "ternya/process.py", "identifier": "nova_process", "docstring": "This function deal with the nova notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:", "docstring_tokens": ["This", "function", "deal", "with", "the", "nova", "notification", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 257876}
{"url": "https://github.com/lsst-sqre/ltd-conveyor/blob/c492937c4c1e050ccc4a0b9dcc38f9980d57e305/ltdconveyor/s3/upload.py#L409-L419", "sha": "c492937c4c1e050ccc4a0b9dcc38f9980d57e305", "docstring_summary": "Make an absolute directory path in the bucker for dirname,\n        which is is assumed relative to the self._bucket_root prefix directory.", "language": "python", "parameters": "(self, dirname)", "return_statement": "return prefix", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "(", "'.'", ",", "'/'", ")", ":", "arg_1", "=", "''", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_bucket_root", ",", "arg_1", ")", "arg_2", "=", "arg_2", ".", "rstrip", "(", "'/'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Make an absolute directory path in the bucker for dirname,\n        which is is assumed relative to the self._bucket_root prefix directory.\n        \"\"\"\n        if arg_1 in ('.', '/'):\n            arg_1 = ''\n        # Strips trailing slash from dir prefix for comparisons\n        # os.path.dirname() returns directory names without a trailing /\n        arg_2 = os.path.join(arg_0._bucket_root, arg_1)\n        arg_2 = arg_2.rstrip('/')\n        return arg_2", "path": "ltdconveyor/s3/upload.py", "identifier": "ObjectManager._create_prefix", "docstring": "Make an absolute directory path in the bucker for dirname,\n        which is is assumed relative to the self._bucket_root prefix directory.", "docstring_tokens": ["Make", "an", "absolute", "directory", "path", "in", "the", "bucker", "for", "dirname", "which", "is", "is", "assumed", "relative", "to", "the", "self", ".", "_bucket_root", "prefix", "directory", "."], "nwo": "lsst-sqre/ltd-conveyor", "score": 0.138843686048881, "idx": 257877}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/__init__.py#L46-L61", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "The user is required to have an application secrets file in his\n           or her environment. The client exists with error \n           if the variable isn't found.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'SREGISTRY_GOOGLE_DRIVE_CREDENTIALS'", "arg_0", ".", "_secrets", "=", "arg_0", ".", "_get_and_update_setting", "(", "arg_1", ")", "arg_0", ".", "_base", "=", "arg_0", ".", "_get_and_update_setting", "(", "'SREGISTRY_GOOGLE_DRIVE_ROOT'", ")", "if", "arg_0", ".", "_base", "is", "None", ":", "arg_0", ".", "_base", "=", "'sregistry'", "if", "arg_0", ".", "_secrets", "is", "None", ":", "bot", ".", "error", "(", "'You must export %s to use Google Drive client'", "%", "arg_1", ")", "bot", ".", "info", "(", "\"https://singularityhub.github.io/sregistry-cli/client-google-drive\"", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0):\n        '''The user is required to have an application secrets file in his\n           or her environment. The client exists with error \n           if the variable isn't found.\n        '''\n        arg_1 = 'SREGISTRY_GOOGLE_DRIVE_CREDENTIALS'\n        arg_0._secrets = arg_0._get_and_update_setting(arg_1)\n        arg_0._base = arg_0._get_and_update_setting('SREGISTRY_GOOGLE_DRIVE_ROOT')\n\n        if arg_0._base is None:\n            arg_0._base = 'sregistry'\n\n        if arg_0._secrets is None:\n            bot.error('You must export %s to use Google Drive client' %arg_1)\n            bot.info(\"https://singularityhub.github.io/sregistry-cli/client-google-drive\")\n            sys.exit(1)", "path": "sregistry/main/google_drive/__init__.py", "identifier": "Client._update_secrets", "docstring": "The user is required to have an application secrets file in his\n           or her environment. The client exists with error \n           if the variable isn't found.", "docstring_tokens": ["The", "user", "is", "required", "to", "have", "an", "application", "secrets", "file", "in", "his", "or", "her", "environment", ".", "The", "client", "exists", "with", "error", "if", "the", "variable", "isn", "t", "found", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 257878}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/app.py#L61-L65", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Download and save price online", "language": "python", "parameters": "(self, symbol: str, currency: str, agent: str)", "return_statement": "return price", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ",", "arg_4", ":", "arg_2", ")", "->", "PriceModel", ":", "arg_5", "=", "arg_0", ".", "__Func", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "arg_0", ".", "save", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2, arg_4: arg_2) -> PriceModel:\n        \"\"\" Download and save price online \"\"\"\n        arg_5 = arg_0.__Func(arg_1, arg_3, arg_4)\n        arg_0.save()\n        return arg_5", "path": "pricedb/app.py", "identifier": "PriceDbApplication.download_price", "docstring": "Download and save price online", "docstring_tokens": ["Download", "and", "save", "price", "online"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 257879}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/inputstream.py#L891-L903", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return the python codec name corresponding to an encoding or None if the\n    string doesn't correspond to a valid encoding.", "language": "python", "parameters": "(encoding)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "bytes", ")", ":", "try", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "\"ascii\"", ")", "except", "UnicodeDecodeError", ":", "return", "None", "if", "arg_0", ":", "arg_1", "=", "ascii_punctuation_re", ".", "sub", "(", "\"\"", ",", "arg_0", ")", ".", "lower", "(", ")", "return", "encodings", ".", "get", "(", "arg_1", ",", "None", ")", "else", ":", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"Return the python codec name corresponding to an encoding or None if the\n    string doesn't correspond to a valid encoding.\"\"\"\n    if isinstance(arg_0, bytes):\n        try:\n            arg_0 = arg_0.decode(\"ascii\")\n        except UnicodeDecodeError:\n            return None\n    if arg_0:\n        arg_1 = ascii_punctuation_re.sub(\"\", arg_0).lower()\n        return encodings.get(arg_1, None)\n    else:\n        return None", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/inputstream.py", "identifier": "codecName", "docstring": "Return the python codec name corresponding to an encoding or None if the\n    string doesn't correspond to a valid encoding.", "docstring_tokens": ["Return", "the", "python", "codec", "name", "corresponding", "to", "an", "encoding", "or", "None", "if", "the", "string", "doesn", "t", "correspond", "to", "a", "valid", "encoding", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257880}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3219-L3241", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Cut a numeric vector into categorical \"buckets\".", "language": "python", "parameters": "(self, breaks, labels=None, include_lowest=False, right=True, dig_lab=3)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "3", ")", ":", "assert_is_type", "(", "arg_1", ",", "[", "numeric", "]", ")", "if", "arg_0", ".", "ncols", "!=", "1", ":", "raise", "H2OValueError", "(", "\"Single-column frame is expected\"", ")", "if", "arg_0", ".", "types", "[", "arg_0", ".", "names", "[", "0", "]", "]", "not", "in", "{", "\"int\"", ",", "\"real\"", "}", ":", "raise", "H2OValueError", "(", "\"A numeric column is expected\"", ")", "arg_6", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")", "arg_6", ".", "_ex", ".", "_cache", ".", "types", "=", "{", "k", ":", "\"enum\"", "for", "k", "in", "arg_0", ".", "names", "}", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False, arg_4=True, arg_5=3):\n        \"\"\"\n        Cut a numeric vector into categorical \"buckets\".\n\n        This method is only applicable to a single-column numeric frame.\n\n        :param List[float] breaks: The Func points in the numeric vector.\n        :param List[str] labels: Labels for categorical levels produced. Defaults to set notation of\n            intervals defined by the breaks.\n        :param bool include_lowest: By default, Funcs are defined as intervals ``(lo, hi]``. If this parameter\n            is True, then the interval becomes ``[lo, hi]``.\n        :param bool right: Include the high value: ``(lo, hi]``. If False, get ``(lo, hi)``.\n        :param int dig_lab: Number of digits following the decimal point to consider.\n\n        :returns: Single-column H2OFrame of categorical data.\n        \"\"\"\n        assert_is_type(arg_1, [numeric])\n        if arg_0.ncols != 1: raise H2OValueError(\"Single-column frame is expected\")\n        if arg_0.types[arg_0.names[0]] not in {\"int\", \"real\"}: raise H2OValueError(\"A numeric column is expected\")\n        arg_6 = H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, arg_1, arg_2, arg_3, arg_4, arg_5),\n                            cache=arg_0._ex._cache)\n        arg_6._ex._cache.types = {k: \"enum\" for k in arg_0.names}\n        return arg_6", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.cut", "docstring": "Cut a numeric vector into categorical \"buckets\".\n\n        This method is only applicable to a single-column numeric frame.\n\n        :param List[float] breaks: The cut points in the numeric vector.\n        :param List[str] labels: Labels for categorical levels produced. Defaults to set notation of\n            intervals defined by the breaks.\n        :param bool include_lowest: By default, cuts are defined as intervals ``(lo, hi]``. If this parameter\n            is True, then the interval becomes ``[lo, hi]``.\n        :param bool right: Include the high value: ``(lo, hi]``. If False, get ``(lo, hi)``.\n        :param int dig_lab: Number of digits following the decimal point to consider.\n\n        :returns: Single-column H2OFrame of categorical data.", "docstring_tokens": ["Cut", "a", "numeric", "vector", "into", "categorical", "buckets", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257881}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L516-L540", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "convert a dictionary to a pretty formatted string.", "language": "python", "parameters": "(d,matching=None,sep1=\"=\",sep2=\"\\n\",sort=True,cantEndWith=None)", "return_statement": "return msg.strip()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "\"=\"", ",", "arg_3", "=", "\"\\n\"", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "\"\"", "if", "\"record\"", "in", "str", "(", "type", "(", "arg_0", ")", ")", ":", "arg_7", "=", "arg_0", ".", "dtype", ".", "names", "else", ":", "arg_7", "=", "arg_0", ".", "keys", "(", ")", "if", "arg_4", ":", "arg_7", "=", "sorted", "(", "arg_7", ")", "for", "arg_8", "in", "arg_7", ":", "if", "arg_8", "[", "0", "]", "==", "\"_\"", ":", "continue", "if", "arg_1", ":", "if", "not", "arg_8", "in", "arg_1", ":", "continue", "if", "arg_5", "and", "arg_8", "[", "-", "len", "(", "arg_5", ")", "]", "==", "arg_5", ":", "continue", "if", "'float'", "in", "str", "(", "type", "(", "arg_0", "[", "arg_8", "]", ")", ")", ":", "arg_9", "=", "\"%.02f\"", "%", "arg_0", "[", "arg_8", "]", "else", ":", "arg_9", "=", "str", "(", "arg_0", "[", "arg_8", "]", ")", "if", "\"object\"", "in", "arg_9", ":", "arg_9", "=", "'<object>'", "arg_6", "+=", "arg_8", "+", "arg_2", "+", "arg_9", "+", "arg_3", "return", "arg_6", ".", "strip", "(", ")"], "function": "def Func(arg_0,arg_1=None,arg_2=\"=\",arg_3=\"\\n\",arg_4=True,arg_5=None):\n    \"\"\"convert a dictionary to a pretty formatted string.\"\"\"\n    arg_6=\"\"\n    if \"record\" in str(type(arg_0)):\n        arg_7=arg_0.dtype.names\n    else:\n        arg_7=arg_0.keys()\n    if arg_4:\n        arg_7=sorted(arg_7)\n    for arg_8 in arg_7:\n        if arg_8[0]==\"_\":\n            continue\n        if arg_1:\n            if not arg_8 in arg_1:\n                continue\n        if arg_5 and arg_8[-len(arg_5)]==arg_5:\n            continue\n        if 'float' in str(type(arg_0[arg_8])):\n            arg_9=\"%.02f\"%arg_0[arg_8]\n        else:\n            arg_9=str(arg_0[arg_8])\n        if \"object\" in arg_9:\n            arg_9='<object>'\n        arg_6+=arg_8+arg_2+arg_9+arg_3\n    return arg_6.strip()", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "msgDict", "docstring": "convert a dictionary to a pretty formatted string.", "docstring_tokens": ["convert", "a", "dictionary", "to", "a", "pretty", "formatted", "string", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 257882}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/handlers.py#L530-L536", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Stop the heartbeating and cancel all related callbacks.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_beating", ":", "arg_0", ".", "_beating", "=", "False", "arg_0", ".", "_hb_periodic_callback", ".", "stop", "(", ")", "if", "not", "arg_0", ".", "hb_stream", ".", "closed", "(", ")", ":", "arg_0", ".", "hb_stream", ".", "on_recv", "(", "None", ")"], "function": "def Func(arg_0):\n        \"\"\"Stop the heartbeating and cancel all related callbacks.\"\"\"\n        if arg_0._beating:\n            arg_0._beating = False\n            arg_0._hb_periodic_callback.stop()\n            if not arg_0.hb_stream.closed():\n                arg_0.hb_stream.on_recv(None)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/handlers.py", "identifier": "IOPubHandler.stop_hb", "docstring": "Stop the heartbeating and cancel all related callbacks.", "docstring_tokens": ["Stop", "the", "heartbeating", "and", "cancel", "all", "related", "callbacks", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257883}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L287-L299", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Import a single file or collection of files.", "language": "python", "parameters": "(path, pattern=None)", "return_statement": "return _import_multi(paths, pattern)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "assert_is_type", "(", "arg_0", ",", "str", ",", "[", "str", "]", ")", "assert_is_type", "(", "arg_1", ",", "str", ",", "None", ")", "arg_2", "=", "[", "arg_0", "]", "if", "is_type", "(", "arg_0", ",", "str", ")", "else", "arg_0", "return", "_import_multi", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Import a single file or collection of files.\n\n    :param path: A path to a data file (remote or local).\n    :param pattern: Character string containing a regular expression to match file(s) in the folder.\n    :returns: either a :class:`H2OFrame` with the content of the provided file, or a list of such frames if\n        importing multiple files.\n    \"\"\"\n    assert_is_type(arg_0, str, [str])\n    assert_is_type(arg_1, str, None)\n    arg_2 = [arg_0] if is_type(arg_0, str) else arg_0\n    return _import_multi(arg_2, arg_1)", "path": "h2o-py/h2o/h2o.py", "identifier": "lazy_import", "docstring": "Import a single file or collection of files.\n\n    :param path: A path to a data file (remote or local).\n    :param pattern: Character string containing a regular expression to match file(s) in the folder.\n    :returns: either a :class:`H2OFrame` with the content of the provided file, or a list of such frames if\n        importing multiple files.", "docstring_tokens": ["Import", "a", "single", "file", "or", "collection", "of", "files", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257884}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/coeff2header.py#L75-L108", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Write FIR Fixed-Point Filter Header Files \r\n    \r\n    Mark Wickert February 2015", "language": "python", "parameters": "(fname_out, h)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_1", ")", "arg_3", "=", "int16", "(", "rint", "(", "arg_1", "*", "2", "**", "15", ")", ")", "arg_4", "=", "8", "arg_5", "=", "open", "(", "arg_0", ",", "'wt'", ")", "arg_5", ".", "write", "(", "'//define a FIR coefficient Array\\n\\n'", ")", "arg_5", ".", "write", "(", "'#include <stdint.h>\\n\\n'", ")", "arg_5", ".", "write", "(", "'#ifndef M_FIR\\n'", ")", "arg_5", ".", "write", "(", "'#define M_FIR %d\\n'", "%", "arg_2", ")", "arg_5", ".", "write", "(", "'#endif\\n'", ")", "arg_5", ".", "write", "(", "'/************************************************************************/\\n'", ")", "arg_5", ".", "write", "(", "'/*                         FIR Filter Coefficients                      */\\n'", ")", "arg_5", ".", "write", "(", "'int16_t h_FIR[M_FIR] = {'", ")", "arg_6", "=", "0", "for", "arg_7", "in", "range", "(", "arg_2", ")", ":", "if", "(", "arg_6", "<", "arg_4", "-", "1", ")", "and", "(", "arg_7", "<", "arg_2", "-", "1", ")", ":", "arg_5", ".", "write", "(", "'%5d,'", "%", "arg_3", "[", "arg_7", "]", ")", "arg_6", "+=", "1", "elif", "(", "arg_6", "==", "arg_4", "-", "1", ")", "&", "(", "arg_7", "<", "arg_2", "-", "1", ")", ":", "arg_5", ".", "write", "(", "'%5d,\\n'", "%", "arg_3", "[", "arg_7", "]", ")", "if", "arg_7", "<", "arg_2", ":", "arg_5", ".", "write", "(", "'                        '", ")", "arg_6", "=", "0", "else", ":", "arg_5", ".", "write", "(", "'%5d'", "%", "arg_3", "[", "arg_7", "]", ")", "arg_5", ".", "write", "(", "'};\\n'", ")", "arg_5", ".", "write", "(", "'/************************************************************************/\\n'", ")", "arg_5", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\r\n    \"\"\"\r\n    Write FIR Fixed-Point Filter Header Files \r\n    \r\n    Mark Wickert February 2015\r\n    \"\"\"\r\n    arg_2 = len(arg_1)\r\n    arg_3 = int16(rint(arg_1 * 2 ** 15))\r\n    arg_4 = 8  # Coefficients per line\r\n    arg_5 = open(arg_0, 'wt')\r\n    arg_5.write('//define a FIR coefficient Array\\n\\n')\r\n    arg_5.write('#include <stdint.h>\\n\\n')\r\n    arg_5.write('#ifndef M_FIR\\n')\r\n    arg_5.write('#define M_FIR %d\\n' % arg_2)\r\n    arg_5.write('#endif\\n')\r\n    arg_5.write('/************************************************************************/\\n');\r\n    arg_5.write('/*                         FIR Filter Coefficients                      */\\n');\r\n    arg_5.write('int16_t h_FIR[M_FIR] = {')\r\n    arg_6 = 0;\r\n    for arg_7 in range(arg_2):\r\n        # k_mod = k % M\r\n        if (arg_6 < arg_4 - 1) and (arg_7 < arg_2 - 1):\r\n            arg_5.write('%5d,' % arg_3[arg_7])\r\n            arg_6 += 1\r\n        elif (arg_6 == arg_4 - 1) & (arg_7 < arg_2 - 1):\r\n            arg_5.write('%5d,\\n' % arg_3[arg_7])\r\n            if arg_7 < arg_2:\r\n                arg_5.write('                        ')\r\n                arg_6 = 0\r\n        else:\r\n            arg_5.write('%5d' % arg_3[arg_7])\r\n    arg_5.write('};\\n')\r\n    arg_5.write('/************************************************************************/\\n')\r\n    arg_5.close()", "path": "sk_dsp_comm/coeff2header.py", "identifier": "FIR_fix_header", "docstring": "Write FIR Fixed-Point Filter Header Files \r\n    \r\n    Mark Wickert February 2015", "docstring_tokens": ["Write", "FIR", "Fixed", "-", "Point", "Filter", "Header", "Files", "Mark", "Wickert", "February", "2015"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 257885}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/crashhandler.py#L202-L213", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "a light excepthook, adding a small message to the usual traceback", "language": "python", "parameters": "(etype, evalue, tb)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "traceback", ".", "print_exception", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "from", "IPython", ".", "core", ".", "interactiveshell", "import", "InteractiveShell", "if", "InteractiveShell", ".", "initialized", "(", ")", ":", "arg_3", "=", "\"%config \"", "else", ":", "arg_3", "=", "\"c.\"", "print", ">>", "sys", ".", "stderr", ",", "_lite_message_template", ".", "format", "(", "email", "=", "author_email", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"a light excepthook, adding a small message to the usual traceback\"\"\"\n    traceback.print_exception(arg_0, arg_1, arg_2)\n    \n    from IPython.core.interactiveshell import InteractiveShell\n    if InteractiveShell.initialized():\n        # we are in a Shell environment, give %magic example\n        arg_3 = \"%config \"\n    else:\n        # we are not in a shell, show generic config\n        arg_3 = \"c.\"\n    print >> sys.stderr, _lite_message_template.format(email=author_email, arg_3=arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/core/crashhandler.py", "identifier": "crash_handler_lite", "docstring": "a light excepthook, adding a small message to the usual traceback", "docstring_tokens": ["a", "light", "excepthook", "adding", "a", "small", "message", "to", "the", "usual", "traceback"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257886}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_cosmos_hook.py#L239-L253", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get a document from an existing collection in the CosmosDB database.", "language": "python", "parameters": "(self, document_id, database_name=None, collection_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "AirflowBadRequest", "(", "\"Cannot get a document without an id\"", ")", "try", ":", "return", "arg_0", ".", "get_conn", "(", ")", ".", "ReadItem", "(", "Func_link", "(", "arg_0", ".", "__get_database_name", "(", "arg_2", ")", ",", "arg_0", ".", "__get_collection_name", "(", "arg_3", ")", ",", "arg_1", ")", ")", "except", "HTTPFailure", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n        Get a document from an existing collection in the CosmosDB database.\n        \"\"\"\n        if arg_1 is None:\n            raise AirflowBadRequest(\"Cannot get a document without an id\")\n\n        try:\n            return arg_0.get_conn().ReadItem(\n                Func_link(\n                    arg_0.__get_database_name(arg_2),\n                    arg_0.__get_collection_name(arg_3),\n                    arg_1))\n        except HTTPFailure:\n            return None", "path": "airflow/contrib/hooks/azure_cosmos_hook.py", "identifier": "AzureCosmosDBHook.get_document", "docstring": "Get a document from an existing collection in the CosmosDB database.", "docstring_tokens": ["Get", "a", "document", "from", "an", "existing", "collection", "in", "the", "CosmosDB", "database", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257887}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/ext/readcol.py#L223-L236", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Attempts to return a numpy array converted to the most sensible dtype\n    Value errors will be caught and simply return the original array\n    Tries to make dtype int, then float, then no change", "language": "python", "parameters": "(arr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "astype", "(", "'float'", ")", "if", "(", "arg_1", "<", "sys", ".", "maxsize", ")", ".", "all", "(", ")", "and", "(", "arg_1", "%", "1", ")", ".", "sum", "(", ")", "==", "0", ":", "return", "arg_1", ".", "astype", "(", "'int'", ")", "else", ":", "return", "arg_1", "except", "ValueError", ":", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"\n    Attempts to return a numpy array converted to the most sensible dtype\n    Value errors will be caught and simply return the original array\n    Tries to make dtype int, then float, then no change\n    \"\"\"\n    try:\n        arg_1 = arg_0.astype('float')\n        if (arg_1 < sys.maxsize).all() and (arg_1 % 1).sum() == 0:\n            return arg_1.astype('int')\n        else:\n            return arg_1\n    except ValueError:\n        return arg_0", "path": "packages/vaex-core/vaex/ext/readcol.py", "identifier": "get_autotype", "docstring": "Attempts to return a numpy array converted to the most sensible dtype\n    Value errors will be caught and simply return the original array\n    Tries to make dtype int, then float, then no change", "docstring_tokens": ["Attempts", "to", "return", "a", "numpy", "array", "converted", "to", "the", "most", "sensible", "dtype", "Value", "errors", "will", "be", "caught", "and", "simply", "return", "the", "original", "array", "Tries", "to", "make", "dtype", "int", "then", "float", "then", "no", "change"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257888}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1321-L1380", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check that accessed members are defined", "language": "python", "parameters": "(self, node, accessed)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "(", "\"AttributeError\"", ",", "\"Exception\"", ",", "\"BaseException\"", ")", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "items", "(", ")", ":", "try", ":", "arg_1", ".", "local_attr", "(", "arg_4", ")", "continue", "except", "astroid", ".", "NotFoundError", ":", "pass", "try", ":", "next", "(", "arg_1", ".", "instance_attr_ancestors", "(", "arg_4", ")", ")", "continue", "except", "StopIteration", ":", "pass", "try", ":", "arg_6", "=", "arg_1", ".", "instance_attr", "(", "arg_4", ")", "except", "astroid", ".", "NotFoundError", ":", "pass", "else", ":", "arg_6", "=", "[", "stmt", "for", "stmt", "in", "arg_6", "if", "stmt", "not", "in", "arg_5", "]", "if", "not", "arg_6", ":", "continue", "arg_7", "=", "arg_6", "[", "0", "]", ".", "scope", "(", ")", "arg_6", "=", "[", "stmt", "for", "i", ",", "stmt", "in", "enumerate", "(", "arg_6", ")", "if", "i", "==", "0", "or", "stmt", ".", "scope", "(", ")", "is", "not", "arg_7", "]", "if", "len", "(", "arg_6", ")", "==", "1", ":", "arg_8", "=", "arg_6", "[", "0", "]", "arg_9", "=", "arg_8", ".", "frame", "(", ")", "arg_10", "=", "arg_8", ".", "fromlineno", "for", "arg_11", "in", "arg_5", ":", "if", "(", "arg_11", ".", "frame", "(", ")", "is", "arg_9", "and", "arg_11", ".", "fromlineno", "<", "arg_10", "and", "not", "astroid", ".", "are_exclusive", "(", "arg_11", ".", "statement", "(", ")", ",", "arg_8", ",", "arg_3", ")", ")", ":", "arg_0", ".", "add_message", "(", "\"access-member-before-definition\"", ",", "arg_1", "=", "arg_11", ",", "args", "=", "(", "arg_4", ",", "arg_10", ")", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"check that accessed members are defined\"\"\"\n        # XXX refactor, probably much simpler now that E0201 is in type checker\n        arg_3 = (\"AttributeError\", \"Exception\", \"BaseException\")\n        for arg_4, arg_5 in arg_2.items():\n            try:\n                # is it a class attribute ?\n                arg_1.local_attr(arg_4)\n                # yes, stop here\n                continue\n            except astroid.NotFoundError:\n                pass\n            # is it an instance attribute of a parent class ?\n            try:\n                next(arg_1.instance_attr_ancestors(arg_4))\n                # yes, stop here\n                continue\n            except StopIteration:\n                pass\n            # is it an instance attribute ?\n            try:\n                arg_6 = arg_1.instance_attr(arg_4)\n            except astroid.NotFoundError:\n                pass\n            else:\n                # filter out augment assignment nodes\n                arg_6 = [stmt for stmt in arg_6 if stmt not in arg_5]\n                if not arg_6:\n                    # only augment assignment for this node, no-member should be\n                    # triggered by the typecheck checker\n                    continue\n                # filter defstmts to only pick the first one when there are\n                # several assignments in the same scope\n                arg_7 = arg_6[0].scope()\n                arg_6 = [\n                    stmt\n                    for i, stmt in enumerate(arg_6)\n                    if i == 0 or stmt.scope() is not arg_7\n                ]\n                # if there are still more than one, don't attempt to be smarter\n                # than we can be\n                if len(arg_6) == 1:\n                    arg_8 = arg_6[0]\n                    # check that if the node is accessed in the same method as\n                    # it's defined, it's accessed after the initial assignment\n                    arg_9 = arg_8.frame()\n                    arg_10 = arg_8.fromlineno\n                    for arg_11 in arg_5:\n                        if (\n                            arg_11.frame() is arg_9\n                            and arg_11.fromlineno < arg_10\n                            and not astroid.are_exclusive(\n                                arg_11.statement(), arg_8, arg_3\n                            )\n                        ):\n                            arg_0.add_message(\n                                \"access-member-before-definition\",\n                                arg_1=arg_11,\n                                args=(arg_4, arg_10),\n                            )", "path": "pylint/checkers/classes.py", "identifier": "ClassChecker._check_accessed_members", "docstring": "check that accessed members are defined", "docstring_tokens": ["check", "that", "accessed", "members", "are", "defined"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257889}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/api_call.py#L241-L262", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Make an API call to get the metric definition", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_url", "=", "arg_0", ".", "form_url", "(", ")", "if", "arg_0", ".", "_headers", "is", "not", "None", ":", "logging", ".", "debug", "(", "arg_0", ".", "_headers", ")", "if", "arg_0", ".", "_data", "is", "not", "None", ":", "logging", ".", "debug", "(", "arg_0", ".", "_data", ")", "if", "len", "(", "arg_0", ".", "_get_url_parameters", "(", ")", ")", ">", "0", ":", "logging", ".", "debug", "(", "arg_0", ".", "_get_url_parameters", "(", ")", ")", "arg_2", "=", "arg_0", ".", "_methods", "[", "arg_0", ".", "_method", "]", "(", ")", "if", "not", "arg_0", ".", "good_response", "(", "arg_2", ".", "status_code", ")", ":", "logging", ".", "error", "(", "arg_0", ".", "_url", ")", "logging", ".", "error", "(", "arg_0", ".", "_method", ")", "if", "arg_0", ".", "_data", "is", "not", "None", ":", "logging", ".", "error", "(", "arg_0", ".", "_data", ")", "logging", ".", "error", "(", "arg_2", ")", "arg_0", ".", "_api_result", "=", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Make an API call to get the metric definition\n        \"\"\"\n\n        arg_0._url = arg_0.form_url()\n        if arg_0._headers is not None:\n            logging.debug(arg_0._headers)\n        if arg_0._data is not None:\n            logging.debug(arg_0._data)\n        if len(arg_0._get_url_parameters()) > 0:\n            logging.debug(arg_0._get_url_parameters())\n\n        arg_2 = arg_0._methods[arg_0._method]()\n\n        if not arg_0.good_response(arg_2.status_code):\n            logging.error(arg_0._url)\n            logging.error(arg_0._method)\n            if arg_0._data is not None:\n                logging.error(arg_0._data)\n            logging.error(arg_2)\n        arg_0._api_result = arg_2", "path": "boundary/api_call.py", "identifier": "ApiCall._call_api", "docstring": "Make an API call to get the metric definition", "docstring_tokens": ["Make", "an", "API", "call", "to", "get", "the", "metric", "definition"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 257890}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L827-L831", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "get the config attribute corresponding to opt", "language": "python", "parameters": "(self, opt, optdict=None)", "return_statement": "return optdict.get(\"dest\", opt.replace(\"-\", \"_\"))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "get_option_def", "(", "arg_1", ")", "return", "arg_2", ".", "get", "(", "\"dest\"", ",", "arg_1", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"get the config attribute corresponding to opt\"\"\"\n        if arg_2 is None:\n            arg_2 = arg_0.get_option_def(arg_1)\n        return arg_2.get(\"dest\", arg_1.replace(\"-\", \"_\"))", "path": "pylint/config.py", "identifier": "OptionsProviderMixIn.option_attrname", "docstring": "get the config attribute corresponding to opt", "docstring_tokens": ["get", "the", "config", "attribute", "corresponding", "to", "opt"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257891}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3322-L3325", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Deletes a variable from a DataFrame.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "del", "arg_0", ".", "variables", "[", "arg_1", "]", "arg_0", ".", "signal_variable_changed", ".", "emit", "(", "arg_0", ",", "arg_1", ",", "\"delete\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Deletes a variable from a DataFrame.\"\"\"\n        del arg_0.variables[arg_1]\n        arg_0.signal_variable_changed.emit(arg_0, arg_1, \"delete\")", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.delete_variable", "docstring": "Deletes a variable from a DataFrame.", "docstring_tokens": ["Deletes", "a", "variable", "from", "a", "DataFrame", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257892}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L110-L131", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augment batches.", "language": "python", "parameters": "(self, batches, chunksize=None)", "return_statement": "return self.pool.map(_Pool_starworker, self._handle_batch_ids(batches), chunksize=chunksize)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "list", ")", ",", "(", "\"Expected to get a list as 'batches', got type %s. \"", "+", "\"Call iFunc() if you use generators.\"", ")", "%", "(", "type", "(", "arg_1", ")", ",", ")", "return", "arg_0", ".", "pool", ".", "map", "(", "_Pool_starworker", ",", "arg_0", ".", "_handle_batch_ids", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Augment batches.\n\n        Parameters\n        ----------\n        batches : list of imgaug.augmentables.batches.Batch\n            The batches to augment.\n\n        chunksize : None or int, optional\n            Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve\n            performance.\n\n        Returns\n        -------\n        list of imgaug.augmentables.batches.Batch\n            Augmented batches.\n\n        \"\"\"\n        assert isinstance(arg_1, list), (\"Expected to get a list as 'batches', got type %s. \"\n                                           + \"Call iFunc() if you use generators.\") % (type(arg_1),)\n        return arg_0.pool.map(_Pool_starworker, arg_0._handle_batch_ids(arg_1), arg_2=arg_2)", "path": "imgaug/multicore.py", "identifier": "Pool.map_batches", "docstring": "Augment batches.\n\n        Parameters\n        ----------\n        batches : list of imgaug.augmentables.batches.Batch\n            The batches to augment.\n\n        chunksize : None or int, optional\n            Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve\n            performance.\n\n        Returns\n        -------\n        list of imgaug.augmentables.batches.Batch\n            Augmented batches.", "docstring_tokens": ["Augment", "batches", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 257893}
{"url": "https://github.com/vinsci/geohash/blob/f31e613e1d2cf97c5e99e78dc2a88383c919b2f0/Geohash/geohash.py#L63-L74", "sha": "f31e613e1d2cf97c5e99e78dc2a88383c919b2f0", "docstring_summary": "Decode geohash, returning two strings with latitude and longitude\n    containing only relevant digits and with trailing zeroes removed.", "language": "python", "parameters": "(geohash)", "return_statement": "return lats, lons", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "Func_exactly", "(", "arg_0", ")", "arg_5", "=", "\"%.*f\"", "%", "(", "max", "(", "1", ",", "int", "(", "round", "(", "-", "log10", "(", "arg_3", ")", ")", ")", ")", "-", "1", ",", "arg_1", ")", "arg_6", "=", "\"%.*f\"", "%", "(", "max", "(", "1", ",", "int", "(", "round", "(", "-", "log10", "(", "arg_4", ")", ")", ")", ")", "-", "1", ",", "arg_2", ")", "if", "'.'", "in", "arg_5", ":", "arg_5", "=", "arg_5", ".", "rstrip", "(", "'0'", ")", "if", "'.'", "in", "arg_6", ":", "arg_6", "=", "arg_6", ".", "rstrip", "(", "'0'", ")", "return", "arg_5", ",", "arg_6"], "function": "def Func(arg_0):\n    \"\"\"\n    Decode geohash, returning two strings with latitude and longitude\n    containing only relevant digits and with trailing zeroes removed.\n    \"\"\"\n    arg_1, arg_2, arg_3, arg_4 = Func_exactly(arg_0)\n    # Format to the number of decimals that are known\n    arg_5 = \"%.*f\" % (max(1, int(round(-log10(arg_3)))) - 1, arg_1)\n    arg_6 = \"%.*f\" % (max(1, int(round(-log10(arg_4)))) - 1, arg_2)\n    if '.' in arg_5: arg_5 = arg_5.rstrip('0')\n    if '.' in arg_6: arg_6 = arg_6.rstrip('0')\n    return arg_5, arg_6", "path": "Geohash/geohash.py", "identifier": "decode", "docstring": "Decode geohash, returning two strings with latitude and longitude\n    containing only relevant digits and with trailing zeroes removed.", "docstring_tokens": ["Decode", "geohash", "returning", "two", "strings", "with", "latitude", "and", "longitude", "containing", "only", "relevant", "digits", "and", "with", "trailing", "zeroes", "removed", "."], "nwo": "vinsci/geohash", "score": 0.7566575107341967, "idx": 257894}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/typeinfo.py#L313-L334", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Given a module-like object that defines a type, add it to our type system so that\n        it can be used with the iotile tool and with other annotated API functions.", "language": "python", "parameters": "(self, name, typeobj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "arg_0", ".", "_canonicalize_type", "(", "arg_1", ")", "arg_3", ",", "arg_4", ",", "arg_3", "=", "arg_0", ".", "split_type", "(", "arg_1", ")", "if", "arg_0", ".", "is_known_type", "(", "arg_1", ")", ":", "raise", "ArgumentError", "(", "\"attempting to inject a type that is already defined\"", ",", "type", "=", "arg_1", ")", "if", "(", "not", "arg_4", ")", "and", "arg_0", ".", "_is_factory", "(", "arg_2", ")", ":", "if", "arg_1", "in", "arg_0", ".", "type_factories", ":", "raise", "ArgumentError", "(", "\"attempted to inject a complex type factory that is already defined\"", ",", "type", "=", "arg_1", ")", "arg_0", ".", "type_factories", "[", "arg_1", "]", "=", "arg_2", "else", ":", "arg_0", ".", "_validate_type", "(", "arg_2", ")", "arg_0", ".", "known_types", "[", "arg_1", "]", "=", "arg_2", "if", "not", "hasattr", "(", "arg_2", ",", "\"default_formatter\"", ")", ":", "raise", "ArgumentError", "(", "\"type is invalid, does not have default_formatter function\"", ",", "type", "=", "arg_2", ",", "methods", "=", "dir", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Given a module-like object that defines a type, add it to our type system so that\n        it can be used with the iotile tool and with other annotated API functions.\n        \"\"\"\n\n        arg_1 = arg_0._canonicalize_type(arg_1)\n        arg_3, arg_4, arg_3 = arg_0.split_type(arg_1)\n\n        if arg_0.is_known_type(arg_1):\n            raise ArgumentError(\"attempting to inject a type that is already defined\", type=arg_1)\n\n        if (not arg_4) and arg_0._is_factory(arg_2):\n            if arg_1 in arg_0.type_factories:\n                raise ArgumentError(\"attempted to inject a complex type factory that is already defined\", type=arg_1)\n            arg_0.type_factories[arg_1] = arg_2\n        else:\n            arg_0._validate_type(arg_2)\n            arg_0.known_types[arg_1] = arg_2\n\n        if not hasattr(arg_2, \"default_formatter\"):\n            raise ArgumentError(\"type is invalid, does not have default_formatter function\", type=arg_2, methods=dir(arg_2))", "path": "typedargs/typeinfo.py", "identifier": "TypeSystem.inject_type", "docstring": "Given a module-like object that defines a type, add it to our type system so that\n        it can be used with the iotile tool and with other annotated API functions.", "docstring_tokens": ["Given", "a", "module", "-", "like", "object", "that", "defines", "a", "type", "add", "it", "to", "our", "type", "system", "so", "that", "it", "can", "be", "used", "with", "the", "iotile", "tool", "and", "with", "other", "annotated", "API", "functions", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 257895}
{"url": "https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/utils.py#L248-L259", "sha": "3d6bf5e64220fe921468a36fce68e15d7947cf92", "docstring_summary": "Updates field object with data from a PrefProxy object.", "language": "python", "parameters": "(field_obj, pref_proxy)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "'verbose_name'", ",", "'help_text'", ",", "'default'", ")", "for", "arg_3", "in", "arg_2", ":", "setattr", "(", "arg_0", ",", "arg_3", ",", "getattr", "(", "arg_1", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Updates field object with data from a PrefProxy object.\n\n    :param models.Field field_obj:\n\n    :param PrefProxy pref_proxy:\n\n    \"\"\"\n    arg_2 = ('verbose_name', 'help_text', 'default')\n\n    for arg_3 in arg_2:\n        setattr(arg_0, arg_3, getattr(arg_1, arg_3))", "path": "siteprefs/utils.py", "identifier": "update_field_from_proxy", "docstring": "Updates field object with data from a PrefProxy object.\n\n    :param models.Field field_obj:\n\n    :param PrefProxy pref_proxy:", "docstring_tokens": ["Updates", "field", "object", "with", "data", "from", "a", "PrefProxy", "object", "."], "nwo": "idlesign/django-siteprefs", "score": 0.18190671880906387, "idx": 257896}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/session.py#L605-L623", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Save a screenshot of the page.", "language": "python", "parameters": "(self, path=None, **kwargs)", "return_statement": "return path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_1", "=", "_prepare_path", "(", "arg_1", ",", "\"png\"", ")", "arg_0", ".", "driver", ".", "Func", "(", "arg_1", ",", "**", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"\n        Save a screenshot of the page.\n\n        If invoked without arguments, it will save a file to :data:`capybara.save_path` and the\n        file will be given a randomly generated filename. If invoked with a relative path, the path\n        will be relative to :data:`capybara.save_path`.\n\n        Args:\n            path (str, optional): The path to where it should be saved.\n            **kwargs: Arbitrary keywords arguments for the driver.\n\n        Returns:\n            str: The path to which the file was saved.\n        \"\"\"\n\n        arg_1 = _prepare_path(arg_1, \"png\")\n        arg_0.driver.Func(arg_1, **arg_2)\n        return arg_1", "path": "capybara/session.py", "identifier": "Session.save_screenshot", "docstring": "Save a screenshot of the page.\n\n        If invoked without arguments, it will save a file to :data:`capybara.save_path` and the\n        file will be given a randomly generated filename. If invoked with a relative path, the path\n        will be relative to :data:`capybara.save_path`.\n\n        Args:\n            path (str, optional): The path to where it should be saved.\n            **kwargs: Arbitrary keywords arguments for the driver.\n\n        Returns:\n            str: The path to which the file was saved.", "docstring_tokens": ["Save", "a", "screenshot", "of", "the", "page", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 257897}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L274-L302", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Build a request for twisted", "language": "python", "parameters": "(self, method, url, extra_headers={}, body_producer=None, full_url=False)", "return_statement": "return (reactor, request)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "{", "}", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "arg_2", "if", "arg_5", "else", "arg_0", ".", "_url", "(", "arg_2", ")", "arg_7", "=", "arg_0", ".", "get_headers", "(", ")", "if", "arg_3", ":", "arg_7", ".", "update", "(", "arg_3", ")", "arg_8", "=", "http_headers", ".", "Headers", "(", ")", "for", "arg_9", "in", "arg_7", ":", "arg_8", ".", "addRawHeader", "(", "arg_9", ",", "arg_7", "[", "arg_9", "]", ")", "arg_10", "=", "client", ".", "Agent", "(", "reactor", ")", "arg_11", "=", "arg_10", ".", "request", "(", "arg_1", ",", "arg_6", ",", "arg_8", ",", "arg_4", ")", "return", "(", "reactor", ",", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3={}, arg_4=None, arg_5=False):\n        \"\"\" Build a request for twisted\n\n        Args:\n            method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None\n            url (str): Destination URL (full, or relative)\n\n        Kwargs:\n            extra_headers (dict): Headers (override default connection headers, if any)\n            body_producer (:class:`twisted.web.iweb.IBodyProducer`): Object producing request body\n            full_url (bool): If False, URL is relative\n\n        Returns:\n            tuple. Tuple with two elements: reactor, and request\n        \"\"\"\n        arg_6 = arg_2 if arg_5 else arg_0._url(arg_2)\n\n        arg_7 = arg_0.get_headers()\n        if arg_3:\n            arg_7.update(arg_3)\n\n        arg_8 = http_headers.Headers()\n        for arg_9 in arg_7:\n            arg_8.addRawHeader(arg_9, arg_7[arg_9])\n\n        arg_10 = client.Agent(reactor)\n        arg_11 = arg_10.request(arg_1, arg_6, arg_8, arg_4)\n\n        return (reactor, arg_11)", "path": "pyfire/connection.py", "identifier": "Connection.build_twisted_request", "docstring": "Build a request for twisted\n\n        Args:\n            method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None\n            url (str): Destination URL (full, or relative)\n\n        Kwargs:\n            extra_headers (dict): Headers (override default connection headers, if any)\n            body_producer (:class:`twisted.web.iweb.IBodyProducer`): Object producing request body\n            full_url (bool): If False, URL is relative\n\n        Returns:\n            tuple. Tuple with two elements: reactor, and request", "docstring_tokens": ["Build", "a", "request", "for", "twisted"], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 257898}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/time_utils.py#L42-L49", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "Get timezone as set by the system", "language": "python", "parameters": "()", "return_statement": "return default_timezone if not locale_code[0] else \\\n        str(pytz.country_timezones[locale_code[0][-2:]][0])", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "'America/New_York'", "arg_1", "=", "locale", ".", "getdefaultlocale", "(", ")", "return", "arg_0", "if", "not", "arg_1", "[", "0", "]", "else", "str", "(", "pytz", ".", "country_timezones", "[", "arg_1", "[", "0", "]", "[", "-", "2", ":", "]", "]", "[", "0", "]", ")"], "function": "def Func():\n    '''\n    Get timezone as set by the system\n    '''\n    arg_0 = 'America/New_York'\n    arg_1 = locale.getdefaultlocale()\n    return arg_0 if not arg_1[0] else \\\n        str(pytz.country_timezones[arg_1[0][-2:]][0])", "path": "python/dna/time_utils.py", "identifier": "_detect_timezone", "docstring": "Get timezone as set by the system", "docstring_tokens": ["Get", "timezone", "as", "set", "by", "the", "system"], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 257899}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L50-L82", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Place the runtime requirements from pkg_info into metadata.", "language": "python", "parameters": "(metadata, pkg_info, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "defaultdict", "(", "list", ")", "for", "arg_4", "in", "arg_1", ".", "get_all", "(", "arg_2", ")", ":", "arg_5", "=", "EXTRA_RE", ".", "search", "(", "arg_4", ")", "if", "arg_5", ":", "arg_6", "=", "arg_5", ".", "groupdict", "(", ")", "arg_7", "=", "arg_6", "[", "'condition'", "]", "arg_8", "=", "arg_6", "[", "'extra'", "]", "arg_9", "=", "arg_6", "[", "'package'", "]", "if", "arg_7", ".", "endswith", "(", "' and '", ")", ":", "arg_7", "=", "arg_7", "[", ":", "-", "5", "]", "else", ":", "arg_7", ",", "arg_8", "=", "None", ",", "None", "arg_9", "=", "arg_4", "arg_2", "=", "MayRequiresKey", "(", "arg_7", ",", "arg_8", ")", "arg_3", "[", "arg_2", "]", ".", "append", "(", "arg_9", ")", "if", "arg_3", ":", "arg_0", "[", "'run_requires'", "]", "=", "[", "]", "for", "arg_2", ",", "arg_4", "in", "arg_3", ".", "items", "(", ")", ":", "arg_10", "=", "{", "'requires'", ":", "arg_4", "}", "if", "arg_2", ".", "extra", ":", "arg_10", "[", "'extra'", "]", "=", "arg_2", ".", "extra", "if", "arg_2", ".", "condition", ":", "arg_10", "[", "'environment'", "]", "=", "arg_2", ".", "condition", "arg_0", "[", "'run_requires'", "]", ".", "append", "(", "arg_10", ")", "if", "not", "'extras'", "in", "arg_0", ":", "arg_0", "[", "'extras'", "]", "=", "[", "]", "arg_0", "[", "'extras'", "]", ".", "extend", "(", "[", "arg_2", ".", "extra", "for", "arg_2", "in", "arg_3", ".", "keys", "(", ")", "if", "arg_2", ".", "extra", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Place the runtime requirements from pkg_info into metadata.\n    \"\"\"\n    arg_3 = defaultdict(list)\n    for arg_4 in arg_1.get_all(arg_2):\n        arg_5 = EXTRA_RE.search(arg_4)\n        if arg_5:\n            arg_6 = arg_5.groupdict()\n            arg_7 = arg_6['condition']\n            arg_8 = arg_6['extra']\n            arg_9 = arg_6['package']\n            if arg_7.endswith(' and '):\n                arg_7 = arg_7[:-5]\n        else:\n            arg_7, arg_8 = None, None\n            arg_9 = arg_4\n        arg_2 = MayRequiresKey(arg_7, arg_8)\n        arg_3[arg_2].append(arg_9)\n\n    if arg_3:\n        arg_0['run_requires'] = []\n        for arg_2, arg_4 in arg_3.items():\n            arg_10 = {'requires':arg_4}\n            if arg_2.extra:\n                arg_10['extra'] = arg_2.extra\n            if arg_2.condition:\n                arg_10['environment'] = arg_2.condition\n            arg_0['run_requires'].append(arg_10)\n\n        if not 'extras' in arg_0:\n            arg_0['extras'] = []\n        arg_0['extras'].extend([arg_2.extra for arg_2 in arg_3.keys() if arg_2.extra])", "path": "capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py", "identifier": "handle_requires", "docstring": "Place the runtime requirements from pkg_info into metadata.", "docstring_tokens": ["Place", "the", "runtime", "requirements", "from", "pkg_info", "into", "metadata", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257900}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L286-L291", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Conference Kick helper", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/ConferenceKick/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Conference Kick helper\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/ConferenceKick/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.conference_kick", "docstring": "REST Conference Kick helper", "docstring_tokens": ["REST", "Conference", "Kick", "helper"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 257901}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/typeinfo.py#L157-L172", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Validate that all required type methods are implemented.", "language": "python", "parameters": "(cls, typeobj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "(", "hasattr", "(", "arg_1", ",", "\"convert\"", ")", "or", "hasattr", "(", "arg_1", ",", "\"convert_binary\"", ")", ")", ":", "raise", "ArgumentError", "(", "\"type is invalid, does not have convert or convert_binary function\"", ",", "type", "=", "arg_1", ",", "methods", "=", "dir", "(", "arg_1", ")", ")", "if", "not", "hasattr", "(", "arg_1", ",", "\"default_formatter\"", ")", ":", "raise", "ArgumentError", "(", "\"type is invalid, does not have default_formatter function\"", ",", "type", "=", "arg_1", ",", "methods", "=", "dir", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Validate that all required type methods are implemented.\n\n        At minimum a type must have:\n        - a convert() or convert_binary() function\n        - a default_formatter() function\n\n        Raises an ArgumentError if the type is not valid\n        \"\"\"\n\n        if not (hasattr(arg_1, \"convert\") or hasattr(arg_1, \"convert_binary\")):\n            raise ArgumentError(\"type is invalid, does not have convert or convert_binary function\", type=arg_1, methods=dir(arg_1))\n\n        if not hasattr(arg_1, \"default_formatter\"):\n            raise ArgumentError(\"type is invalid, does not have default_formatter function\", type=arg_1, methods=dir(arg_1))", "path": "typedargs/typeinfo.py", "identifier": "TypeSystem._validate_type", "docstring": "Validate that all required type methods are implemented.\n\n        At minimum a type must have:\n        - a convert() or convert_binary() function\n        - a default_formatter() function\n\n        Raises an ArgumentError if the type is not valid", "docstring_tokens": ["Validate", "that", "all", "required", "type", "methods", "are", "implemented", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 257902}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/migrations/0014_drop_historical_table.py#L7-L15", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Drops the historical sap_success_factors table named herein.", "language": "python", "parameters": "(apps, schema_editor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'sap_success_factors_historicalsapsuccessfactorsenterprisecus80ad'", "if", "arg_2", "in", "connection", ".", "introspection", ".", "table_names", "(", ")", ":", "migrations", ".", "DeleteModel", "(", "name", "=", "arg_2", ",", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Drops the historical sap_success_factors table named herein.\n    \"\"\"\n    arg_2 = 'sap_success_factors_historicalsapsuccessfactorsenterprisecus80ad'\n    if arg_2 in connection.introspection.table_names():\n        migrations.DeleteModel(\n            name=arg_2,\n        )", "path": "integrated_channels/sap_success_factors/migrations/0014_drop_historical_table.py", "identifier": "dropHistoricalTable", "docstring": "Drops the historical sap_success_factors table named herein.", "docstring_tokens": ["Drops", "the", "historical", "sap_success_factors", "table", "named", "herein", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257903}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model.py#L400-L407", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Get labels from the anomaly classifier within this model.", "language": "python", "parameters": "(self, start, end)", "return_statement": "return self._getAnomalyClassifier().getSelf().getLabels(start, end)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_getAnomalyClassifier", "(", ")", ".", "getSelf", "(", ")", ".", "getLabels", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Get labels from the anomaly classifier within this model.\n\n    :param start: (int) index to start getting labels\n    :param end: (int) index to end getting labels\n    \"\"\"\n    return arg_0._getAnomalyClassifier().getSelf().getLabels(arg_1, arg_2)", "path": "src/nupic/frameworks/opf/htm_prediction_model.py", "identifier": "HTMPredictionModel.anomalyGetLabels", "docstring": "Get labels from the anomaly classifier within this model.\n\n    :param start: (int) index to start getting labels\n    :param end: (int) index to end getting labels", "docstring_tokens": ["Get", "labels", "from", "the", "anomaly", "classifier", "within", "this", "model", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 257904}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/annotation.py#L169-L195", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "Swift annotation for adding function to process swift notification.", "language": "python", "parameters": "(*arg)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "check_event_type", "(", "Openstack", ".", "Swift", ",", "*", "arg_0", ")", "arg_1", "=", "arg_0", "[", "0", "]", "def", "decorator", "(", "arg_2", ")", ":", "if", "arg_1", ".", "find", "(", "\"*\"", ")", "!=", "-", "1", ":", "arg_3", "=", "pre_compile", "(", "arg_1", ")", "arg_4", "[", "arg_3", "]", "=", "arg_2", "else", ":", "arg_5", "[", "arg_1", "]", "=", "arg_2", "log", ".", "info", "(", "\"add function {0} to process event_type:{1}\"", ".", "format", "(", "arg_2", ".", "__name__", ",", "arg_1", ")", ")", "@", "functools", ".", "wraps", "(", "arg_2", ")", "def", "wrapper", "(", "*", "arg_6", ",", "**", "arg_7", ")", ":", "arg_2", "(", "*", "arg_6", ",", "**", "arg_7", ")", "return", "wrapper", "return", "decorator"], "function": "def Func(*arg_0):\n    \"\"\"\n    Swift annotation for adding function to process Func notification.\n\n    if event_type include wildcard, will put {pattern: function} into process_wildcard dict\n    else will put {event_type: function} into process dict\n\n    :param arg: event_type of notification\n    \"\"\"\n    check_event_type(Openstack.Swift, *arg_0)\n    arg_1 = arg_0[0]\n\n    def decorator(arg_2):\n        if arg_1.find(\"*\") != -1:\n            arg_3 = pre_compile(arg_1)\n            arg_4[arg_3] = arg_2\n        else:\n            arg_5[arg_1] = arg_2\n        log.info(\"add function {0} to process event_type:{1}\".format(arg_2.__name__, arg_1))\n\n        @functools.wraps(arg_2)\n        def wrapper(*arg_6, **arg_7):\n            arg_2(*arg_6, **arg_7)\n\n        return wrapper\n\n    return decorator", "path": "ternya/annotation.py", "identifier": "swift", "docstring": "Swift annotation for adding function to process swift notification.\n\n    if event_type include wildcard, will put {pattern: function} into process_wildcard dict\n    else will put {event_type: function} into process dict\n\n    :param arg: event_type of notification", "docstring_tokens": ["Swift", "annotation", "for", "adding", "function", "to", "process", "swift", "notification", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 257905}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/pycheck.py#L91-L105", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "passive check of python programs by pyflakes.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "x", "for", "x", "in", "options", ".", "setup", ".", "packages", "if", "'.'", "not", "in", "x", "]", "sh", "(", "'Func {param} {files}'", ".", "format", "(", "param", "=", "options", ".", "paved", ".", "pycheck", ".", "Func", ".", "param", ",", "files", "=", "' '", ".", "join", "(", "arg_0", ")", ")", ")"], "function": "def Func():\n    '''passive check of python programs by Func.\n\n    requirements:\n     - Func_ should be installed. ``easy_install Func``\n\n    options.paved.pycheck.Func.param\n\n    .. _Func: http://pypi.python.org/pypi/Func\n    '''\n\n    # filter out  subpackages\n    arg_0 = [x for x in options.setup.packages if '.' not in x]\n\n    sh('Func {param} {files}'.format(param=options.paved.pycheck.Func.param, files=' '.join(arg_0)))", "path": "paved/pycheck.py", "identifier": "pyflakes", "docstring": "passive check of python programs by pyflakes.\n\n    requirements:\n     - pyflakes_ should be installed. ``easy_install pyflakes``\n\n    options.paved.pycheck.pyflakes.param\n\n    .. _pyflakes: http://pypi.python.org/pypi/pyflakes", "docstring_tokens": ["passive", "check", "of", "python", "programs", "by", "pyflakes", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 257906}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/sites.py#L49-L51", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Can add this object", "language": "python", "parameters": "(self, request)", "return_statement": "return request.user.is_authenticated and request.user.is_active and request.user.is_staff", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_1", ".", "user", ".", "is_authenticated", "and", "arg_1", ".", "user", ".", "is_active", "and", "arg_1", ".", "user", ".", "is_staff"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Can add this object \"\"\"\n        return arg_1.user.is_authenticated and arg_1.user.is_active and arg_1.user.is_staff", "path": "mongonaut/sites.py", "identifier": "BaseMongoAdmin.has_add_permission", "docstring": "Can add this object", "docstring_tokens": ["Can", "add", "this", "object"], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 257907}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/views.py#L182-L190", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Shows all of the credit notes that have been generated.", "language": "python", "parameters": "()", "return_statement": "return QuerysetReport(\n        \"Credit note refunds\",\n        [\"id\", \"creditnoterefund__reference\", \"amount\"],\n        notes_refunded,\n        link_view=views.credit_note,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "commerce", ".", "CreditNote", ".", "refunded", "(", ")", "return", "QuerysetReport", "(", "\"Credit note refunds\"", ",", "[", "\"id\"", ",", "\"creditnoterefund__reference\"", ",", "\"amount\"", "]", ",", "arg_0", ",", "link_view", "=", "views", ".", "credit_note", ",", ")"], "function": "def Func():\n    ''' Shows all of the credit notes that have been generated. '''\n    arg_0 = commerce.CreditNote.refunded()\n    return QuerysetReport(\n        \"Credit note refunds\",\n        [\"id\", \"creditnoterefund__reference\", \"amount\"],\n        arg_0,\n        link_view=views.credit_note,\n    )", "path": "registrasion/reporting/views.py", "identifier": "credit_note_refunds", "docstring": "Shows all of the credit notes that have been generated.", "docstring_tokens": ["Shows", "all", "of", "the", "credit", "notes", "that", "have", "been", "generated", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 257908}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/baseapi.py#L27-L34", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Build path with endpoint and args", "language": "python", "parameters": "(self, *args)", "return_statement": "return '/'.join(chain((self.endpoint,), map(str, args)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "return", "'/'", ".", "join", "(", "chain", "(", "(", "arg_0", ".", "endpoint", ",", ")", ",", "map", "(", "str", ",", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Build path with endpoint and args\n\n        :param args: Tokens in the endpoint URL\n        :type args: :py:class:`unicode`\n        \"\"\"\n        return '/'.join(chain((arg_0.endpoint,), map(str, arg_1)))", "path": "mailchimp3/baseapi.py", "identifier": "BaseApi._build_path", "docstring": "Build path with endpoint and args\n\n        :param args: Tokens in the endpoint URL\n        :type args: :py:class:`unicode`", "docstring_tokens": ["Build", "path", "with", "endpoint", "and", "args"], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 257909}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/csp.py#L432-L439", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Assign var, and keep track of conflicts.", "language": "python", "parameters": "(self, var, val, assignment)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "get", "(", "arg_1", ",", "None", ")", "if", "arg_2", "!=", "arg_4", ":", "if", "arg_4", "is", "not", "None", ":", "arg_0", ".", "record_conflict", "(", "arg_3", ",", "arg_1", ",", "arg_4", ",", "-", "1", ")", "arg_0", ".", "record_conflict", "(", "arg_3", ",", "arg_1", ",", "arg_2", ",", "+", "1", ")", "CSP", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"Assign var, and keep track of conflicts.\"\n        arg_4 = arg_3.get(arg_1, None)\n        if arg_2 != arg_4:\n            if arg_4 is not None: # Remove old val if there was one\n                arg_0.record_conflict(arg_3, arg_1, arg_4, -1)\n            arg_0.record_conflict(arg_3, arg_1, arg_2, +1)\n            CSP.Func(arg_0, arg_1, arg_2, arg_3)", "path": "aima/csp.py", "identifier": "NQueensCSP.assign", "docstring": "Assign var, and keep track of conflicts.", "docstring_tokens": ["Assign", "var", "and", "keep", "track", "of", "conflicts", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 257910}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/diagnostic.py#L388-L393", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Get number of elements of `x` in `axis`, as type `x.dtype`.", "language": "python", "parameters": "(x, axis=None)", "return_statement": "return tf.cast(\n      tf.reduce_prod(input_tensor=tf.gather(tf.shape(input=x), axis)), x.dtype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "return", "tf", ".", "cast", "(", "tf", ".", "size", "(", "input", "=", "arg_0", ")", ",", "arg_0", ".", "dtype", ")", "return", "tf", ".", "cast", "(", "tf", ".", "reduce_prod", "(", "input_tensor", "=", "tf", ".", "gather", "(", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", ",", "arg_1", ")", ")", ",", "arg_0", ".", "dtype", ")"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"Get number of elements of `x` in `axis`, as type `x.dtype`.\"\"\"\n  if arg_1 is None:\n    return tf.cast(tf.size(input=arg_0), arg_0.dtype)\n  return tf.cast(\n      tf.reduce_prod(input_tensor=tf.gather(tf.shape(input=arg_0), arg_1)), arg_0.dtype)", "path": "tensorflow_probability/python/mcmc/diagnostic.py", "identifier": "_axis_size", "docstring": "Get number of elements of `x` in `axis`, as type `x.dtype`.", "docstring_tokens": ["Get", "number", "of", "elements", "of", "x", "in", "axis", "as", "type", "x", ".", "dtype", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257911}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Domain.py#L76-L87", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Create new doamin", "language": "python", "parameters": "(self)", "return_statement": "return domain", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"name\"", ":", "arg_0", ".", "name", ",", "\"ip_address\"", ":", "arg_0", ".", "ip_address", ",", "}", "arg_2", "=", "arg_0", ".", "get_data", "(", "\"domains\"", ",", "type", "=", "POST", ",", "params", "=", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n            Create new doamin\n        \"\"\"\n        # URL https://api.digitalocean.com/v2/domains\n        arg_1 = {\n            \"name\": arg_0.name,\n            \"ip_address\": arg_0.ip_address,\n        }\n\n        arg_2 = arg_0.get_data(\"domains\", type=POST, params=arg_1)\n        return arg_2", "path": "digitalocean/Domain.py", "identifier": "Domain.create", "docstring": "Create new doamin", "docstring_tokens": ["Create", "new", "doamin"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 257912}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L652-L679", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Verify partial table cell value", "language": "python", "parameters": "(self, window_name, object_name, row_index,\n                               column_index, row_text)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "try", ":", "arg_6", "=", "getcellvalue", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "if", "re", ".", "searchmatch", "(", "arg_5", ",", "arg_6", ")", ":", "return", "1", "except", "LdtpServerException", ":", "pass", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                               arg_4, arg_5):\n        \"\"\"\n        Verify partial table cell value\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob. \n        @type object_name: string\n        @param row_index: Row index to get\n        @type row_index: integer\n        @param column_index: Column index to get, default value 0\n        @type column_index: integer\n        @param row_text: Row text to match\n        @type string\n\n        @return: 1 on success 0 on failure.\n        @rtype: integer\n        \"\"\"\n        try:\n            arg_6 = getcellvalue(arg_1, arg_2, arg_3, arg_4)\n            if re.searchmatch(arg_5, arg_6):\n                return 1\n        except LdtpServerException:\n            pass\n        return 0", "path": "atomac/ldtpd/table.py", "identifier": "Table.verifypartialtablecell", "docstring": "Verify partial table cell value\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob. \n        @type object_name: string\n        @param row_index: Row index to get\n        @type row_index: integer\n        @param column_index: Column index to get, default value 0\n        @type column_index: integer\n        @param row_text: Row text to match\n        @type string\n\n        @return: 1 on success 0 on failure.\n        @rtype: integer", "docstring_tokens": ["Verify", "partial", "table", "cell", "value"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 257913}
{"url": "https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/russian_tax.py#L100-L114", "sha": "e15f2e59538deb4cbfceaac314f5ea897f2d5450", "docstring_summary": "Return a random taxation ID number for a natural person.", "language": "python", "parameters": "()", "return_statement": "return \"\".join(map(str, inn))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "7", ",", "2", ",", "4", ",", "10", ",", "3", ",", "5", ",", "9", ",", "4", ",", "6", ",", "8", "]", "arg_1", "=", "[", "3", ",", "7", ",", "2", ",", "4", ",", "10", ",", "3", ",", "5", ",", "9", ",", "4", ",", "6", ",", "8", "]", "arg_2", "=", "[", "random", ".", "randint", "(", "1", ",", "9", ")", "for", "_", "in", "range", "(", "12", ")", "]", "arg_3", "=", "[", "v", "*", "arg_0", "[", "i", "]", "for", "i", ",", "v", "in", "enumerate", "(", "arg_2", "[", ":", "-", "2", "]", ")", "]", "arg_2", "[", "10", "]", "=", "sum", "(", "arg_3", ")", "%", "11", "%", "10", "arg_4", "=", "[", "v", "*", "arg_1", "[", "i", "]", "for", "i", ",", "v", "in", "enumerate", "(", "arg_2", "[", ":", "-", "1", "]", ")", "]", "arg_2", "[", "11", "]", "=", "sum", "(", "arg_4", ")", "%", "11", "%", "10", "return", "\"\"", ".", "join", "(", "map", "(", "str", ",", "arg_2", ")", ")"], "function": "def Func():\n    \"\"\"Return a random taxation ID number for a natural person.\"\"\"\n    arg_0 = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]\n    arg_1 = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8]\n    arg_2 = [random.randint(1, 9) for _ in range(12)]\n\n    # get the 11th digit of the INN\n    arg_3 = [v * arg_0[i] for i, v in enumerate(arg_2[:-2])]\n    arg_2[10] = sum(arg_3) % 11 % 10\n\n    # get the 12th digit of the INN\n    arg_4 = [v * arg_1[i] for i, v in enumerate(arg_2[:-1])]\n    arg_2[11] = sum(arg_4) % 11 % 10\n\n    return \"\".join(map(str, arg_2))", "path": "forgery_py/forgery/russian_tax.py", "identifier": "person_inn", "docstring": "Return a random taxation ID number for a natural person.", "docstring_tokens": ["Return", "a", "random", "taxation", "ID", "number", "for", "a", "natural", "person", "."], "nwo": "pilosus/ForgeryPy3", "score": 0.3588333959790546, "idx": 257914}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/segment_allocations.py#L46-L61", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Check for overlapping ranges.", "language": "python", "parameters": "(self, new_range, existing_ranges)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "def", "_contains", "(", "arg_3", ",", "arg_4", ")", ":", "return", "(", "arg_3", ">=", "arg_4", "[", "0", "]", "and", "arg_3", "<=", "arg_4", "[", "1", "]", ")", "def", "_is_overlap", "(", "arg_4", ",", "arg_5", ")", ":", "return", "(", "_contains", "(", "arg_4", "[", "0", "]", ",", "arg_5", ")", "or", "_contains", "(", "arg_4", "[", "1", "]", ",", "arg_5", ")", "or", "_contains", "(", "arg_5", "[", "0", "]", ",", "arg_4", ")", "or", "_contains", "(", "arg_5", "[", "1", "]", ",", "arg_4", ")", ")", "for", "arg_6", "in", "arg_2", ":", "if", "_is_overlap", "(", "arg_1", ",", "arg_6", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check for overlapping ranges.\"\"\"\n        def _contains(arg_3, arg_4):\n            return (arg_3 >= arg_4[0] and\n                    arg_3 <= arg_4[1])\n\n        def _is_overlap(arg_4, arg_5):\n            return (_contains(arg_4[0], arg_5) or\n                    _contains(arg_4[1], arg_5) or\n                    _contains(arg_5[0], arg_4) or\n                    _contains(arg_5[1], arg_4))\n\n        for arg_6 in arg_2:\n            if _is_overlap(arg_1, arg_6):\n                return True\n        return False", "path": "quark/segment_allocations.py", "identifier": "BaseSegmentAllocation._check_collisions", "docstring": "Check for overlapping ranges.", "docstring_tokens": ["Check", "for", "overlapping", "ranges", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 257915}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L612-L648", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Get trip counts per day between the start and end day of the feed.", "language": "python", "parameters": "(self)", "return_statement": "return pd.DataFrame(data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"SELECT date, count(*) AS number_of_trips FROM day_trips GROUP BY date\"", "arg_2", "=", "pd", ".", "read_sql_query", "(", "arg_1", ",", "arg_0", ".", "conn", ",", "index_col", "=", "\"date\"", ")", "arg_3", "=", "arg_2", ".", "index", ".", "max", "(", ")", "arg_4", "=", "arg_2", ".", "index", ".", "min", "(", ")", "arg_5", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_4", ",", "'%Y-%m-%d'", ")", "arg_6", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_3", ",", "'%Y-%m-%d'", ")", "arg_7", "=", "(", "arg_6", "-", "arg_5", ")", ".", "days", "arg_8", "=", "[", "arg_5", "+", "datetime", ".", "timedelta", "(", "days", "=", "x", ")", "for", "x", "in", "range", "(", "arg_7", "+", "1", ")", "]", "arg_9", "=", "[", "]", "arg_10", "=", "[", "]", "for", "arg_11", "in", "arg_8", ":", "arg_12", "=", "arg_11", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "arg_10", ".", "append", "(", "arg_12", ")", "try", ":", "arg_13", "=", "arg_2", ".", "loc", "[", "arg_12", ",", "'number_of_trips'", "]", "except", "KeyError", ":", "arg_13", "=", "0", "arg_9", ".", "append", "(", "arg_13", ")", "for", "arg_12", "in", "arg_2", ".", "index", ":", "assert", "arg_12", "in", "arg_10", "arg_14", "=", "{", "\"date\"", ":", "arg_8", ",", "\"date_str\"", ":", "arg_10", ",", "\"trip_counts\"", ":", "arg_9", "}", "return", "pd", ".", "DataFrame", "(", "arg_14", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get trip counts per day between the start and end day of the feed.\n\n        Returns\n        -------\n        trip_counts : pandas.DataFrame\n            Has columns \"date_str\" (dtype str) \"trip_counts\" (dtype int)\n        \"\"\"\n        arg_1 = \"SELECT date, count(*) AS number_of_trips FROM day_trips GROUP BY date\"\n        # this yields the actual data\n        arg_2 = pd.read_sql_query(arg_1, arg_0.conn, index_col=\"date\")\n        # the rest is simply code for filling out \"gaps\" in the time span\n        # (necessary for some visualizations)\n        arg_3 = arg_2.index.max()\n        arg_4 = arg_2.index.min()\n        arg_5 = datetime.datetime.strptime(arg_4, '%Y-%m-%d')\n        arg_6 = datetime.datetime.strptime(arg_3, '%Y-%m-%d')\n        arg_7 = (arg_6 - arg_5).days\n        arg_8 = [arg_5 + datetime.timedelta(days=x) for x in range(arg_7 + 1)]\n        arg_9 = []\n        arg_10 = []\n        for arg_11 in arg_8:\n            arg_12 = arg_11.strftime(\"%Y-%m-%d\")\n            arg_10.append(arg_12)\n            try:\n                arg_13 = arg_2.loc[arg_12, 'number_of_trips']\n            except KeyError:\n                # set value to 0 if dsut is not present, i.e. when no trips\n                # take place on that day\n                arg_13 = 0\n            arg_9.append(arg_13)\n        # check that all date_strings are included (move this to tests?)\n        for arg_12 in arg_2.index:\n            assert arg_12 in arg_10\n        arg_14 = {\"date\": arg_8, \"date_str\": arg_10, \"trip_counts\": arg_9}\n        return pd.DataFrame(arg_14)", "path": "gtfspy/gtfs.py", "identifier": "GTFS.get_trip_counts_per_day", "docstring": "Get trip counts per day between the start and end day of the feed.\n\n        Returns\n        -------\n        trip_counts : pandas.DataFrame\n            Has columns \"date_str\" (dtype str) \"trip_counts\" (dtype int)", "docstring_tokens": ["Get", "trip", "counts", "per", "day", "between", "the", "start", "and", "end", "day", "of", "the", "feed", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 257916}
{"url": "https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/exchange.py#L29-L35", "sha": "be988b0851b4313af81f1db475bc33248700e39c", "docstring_summary": "Decorator for Backend that ensures rates are fresh within last 5 mins", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_1", ".", "last_updated", "+", "timedelta", "(", "minutes", "=", "5", ")", "<", "zulu", ".", "now", "(", ")", ":", "arg_1", ".", "refresh", "(", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Decorator for Backend that ensures rates are fresh within last 5 mins\"\"\"\n    def wrapper(arg_1, *arg_2, **arg_3):\n        if arg_1.last_updated + timedelta(minutes=5) < zulu.now():\n            arg_1.refresh()\n        return arg_0(arg_1, *arg_2, **arg_3)\n    return wrapper", "path": "pricing/exchange.py", "identifier": "ensure_fresh_rates", "docstring": "Decorator for Backend that ensures rates are fresh within last 5 mins", "docstring_tokens": ["Decorator", "for", "Backend", "that", "ensures", "rates", "are", "fresh", "within", "last", "5", "mins"], "nwo": "joeblackwaslike/pricing", "score": 0.24979334806965703, "idx": 257917}
{"url": "https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/flow.py#L38-L45", "sha": "1436e0bf72803e02ccf727f41e8fc85ba167d9fe", "docstring_summary": "Add data to flow", "language": "python", "parameters": "(self, X=None, y=None, sentences=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "X", "=", "arg_1", "arg_0", ".", "y", "=", "arg_2", "arg_0", ".", "sentences", "=", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"\n        Add Func to flow\n\n        \"\"\"\n        arg_0.X = arg_1\n        arg_0.y = arg_2\n        arg_0.sentences = arg_3", "path": "languageflow/flow.py", "identifier": "Flow.data", "docstring": "Add data to flow", "docstring_tokens": ["Add", "data", "to", "flow"], "nwo": "undertheseanlp/languageflow", "score": 0.5035427528001201, "idx": 257918}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/job_model.py#L927-L942", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Generator that yields a task-specific view of the job.", "language": "python", "parameters": "(job_descriptor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "task_descriptors", ":", "arg_2", "=", "JobDescriptor", "(", "arg_0", ".", "job_metadata", ",", "arg_0", ".", "job_params", ",", "arg_0", ".", "job_resources", ",", "[", "arg_1", "]", ")", "yield", "arg_2"], "function": "def Func(arg_0):\n  \"\"\"Generator that yields a task-specific view of the job.\n\n  This generator exists to make it easy for callers to iterate over the tasks\n  in a JobDescriptor. Each pass yields a new JobDescriptor with a single task.\n\n  Args:\n    job_descriptor: A JobDescriptor with 1 or more tasks.\n\n  Yields:\n    A JobDescriptor with a single task.\n  \"\"\"\n  for arg_1 in arg_0.task_descriptors:\n    arg_2 = JobDescriptor(arg_0.job_metadata, arg_0.job_params,\n                       arg_0.job_resources, [arg_1])\n    yield arg_2", "path": "dsub/lib/job_model.py", "identifier": "task_view_generator", "docstring": "Generator that yields a task-specific view of the job.\n\n  This generator exists to make it easy for callers to iterate over the tasks\n  in a JobDescriptor. Each pass yields a new JobDescriptor with a single task.\n\n  Args:\n    job_descriptor: A JobDescriptor with 1 or more tasks.\n\n  Yields:\n    A JobDescriptor with a single task.", "docstring_tokens": ["Generator", "that", "yields", "a", "task", "-", "specific", "view", "of", "the", "job", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 257919}
{"url": "https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/utils.py#L17-L35", "sha": "3ff76407af0e71621dada744cd964611e998699c", "docstring_summary": "Decorator for warning user of depricated functions before use.", "language": "python", "parameters": "(newmethod)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "warnings", ".", "simplefilter", "(", "'always'", ",", "DeprecationWarning", ")", "warnings", ".", "warn", "(", "\"Function {} is depricated, please use {} instead.\"", ".", "format", "(", "arg_1", ".", "__name__", ",", "arg_0", ")", ",", "category", "=", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "warnings", ".", "simplefilter", "(", "'default'", ",", "DeprecationWarning", ")", "return", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator for warning user of depricated functions before use.\n\n    Args:\n        newmethod (str): Name of method to use instead.\n    \"\"\"\n    def decorator(arg_1):\n        @wraps(arg_1)\n        def wrapper(*arg_2, **arg_3):\n            warnings.simplefilter('always', DeprecationWarning) \n            warnings.warn(\n                \"Function {} is depricated, please use {} instead.\".format(arg_1.__name__, arg_0),\n                category=DeprecationWarning, stacklevel=2\n            )\n            warnings.simplefilter('default', DeprecationWarning)\n            return arg_1(*arg_2, **arg_3)\n        return wrapper\n    return decorator", "path": "gems/utils.py", "identifier": "depricated_name", "docstring": "Decorator for warning user of depricated functions before use.\n\n    Args:\n        newmethod (str): Name of method to use instead.", "docstring_tokens": ["Decorator", "for", "warning", "user", "of", "depricated", "functions", "before", "use", "."], "nwo": "bprinty/gems", "score": 0.16246995141409282, "idx": 257920}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/vcdHdlSimConfig.py#L100-L111", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "This method is called before first step of simulation.", "language": "python", "parameters": "(self, simulator, synthesisedUnit)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "vcdWriter", "arg_3", ".", "date", "(", "datetime", ".", "now", "(", ")", ")", "arg_3", ".", "timescale", "(", "1", ")", "arg_0", ".", "vcdRegisterInterfaces", "(", "arg_2", ",", "None", ")", "arg_0", ".", "vcdRegisterRemainingSignals", "(", "arg_2", ")", "arg_3", ".", "enddefinitions", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        This method is called before first step of simulation.\n        \"\"\"\n        arg_3 = arg_0.vcdWriter\n        arg_3.date(datetime.now())\n        arg_3.timescale(1)\n\n        arg_0.vcdRegisterInterfaces(arg_2, None)\n        arg_0.vcdRegisterRemainingSignals(arg_2)\n\n        arg_3.enddefinitions()", "path": "hwt/simulator/vcdHdlSimConfig.py", "identifier": "VcdHdlSimConfig.beforeSim", "docstring": "This method is called before first step of simulation.", "docstring_tokens": ["This", "method", "is", "called", "before", "first", "step", "of", "simulation", "."], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 257921}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/get_traffic.py#L204-L217", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Writes all traffic data to file in JSON form.", "language": "python", "parameters": "(self, date=(datetime.date.today()),\n        organization='llnl',dict_to_write={}, path_ending_type='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", "arg_2", ".", "date", ".", "today", "(", ")", ")", ",", "arg_4", "=", "'llnl'", ",", "arg_5", "=", "{", "}", ",", "arg_6", "=", "''", ")", ":", "for", "arg_7", "in", "arg_5", ":", "if", "len", "(", "arg_5", "[", "arg_7", "]", ")", "!=", "0", ":", "arg_8", "=", "(", "'../github-data/'", "+", "arg_4", "+", "'/'", "+", "arg_7", "+", "'/'", "+", "arg_6", "+", "'/'", "+", "str", "(", "arg_1", ")", "+", "'.json'", ")", "arg_0", ".", "checkDir", "(", "arg_8", ")", "with", "open", "(", "arg_8", ",", "'w'", ")", "as", "out", ":", "out", ".", "write", "(", "json", ".", "dumps", "(", "arg_5", "[", "arg_7", "]", ",", "sort_keys", "=", "True", ",", "indent", "=", "4", ",", "separators", "=", "(", "','", ",", "': '", ")", ")", ")", "out", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1=(arg_2.date.today()),\n        arg_4='llnl',arg_5={}, arg_6=''):\n        \"\"\"\n        Writes all traffic data to file in JSON form.\n        \"\"\"\n        for arg_7 in arg_5:\n            if len(arg_5[arg_7]) != 0:#don't need to write out empty lists\n                arg_8 = ('../github-data/' + arg_4 + '/' + arg_7 + '/' +\n                     arg_6 + '/' + str(arg_1) + '.json')\n                arg_0.checkDir(arg_8)\n                with open(arg_8, 'w') as out:\n                    out.write(json.dumps(arg_5[arg_7], sort_keys=True,\n                        indent=4, separators=(',', ': ')))\n                out.close()", "path": "scripts/get_traffic.py", "identifier": "GitHub_Traffic.write_json", "docstring": "Writes all traffic data to file in JSON form.", "docstring_tokens": ["Writes", "all", "traffic", "data", "to", "file", "in", "JSON", "form", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 257922}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L183-L189", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return whether the input course or program exist.", "language": "python", "parameters": "(self, course_id, program_uuid)", "return_statement": "return course_exists or program_exists", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "and", "CourseApiClient", "(", ")", ".", "get_course_details", "(", "arg_1", ")", "arg_4", "=", "arg_2", "and", "CourseCatalogApiServiceClient", "(", ")", ".", "program_exists", "(", "arg_2", ")", "return", "arg_3", "or", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Return whether the input course or program exist.\n        \"\"\"\n        arg_3 = arg_1 and CourseApiClient().get_course_details(arg_1)\n        arg_4 = arg_2 and CourseCatalogApiServiceClient().program_exists(arg_2)\n        return arg_3 or arg_4", "path": "enterprise/views.py", "identifier": "GrantDataSharingPermissions.course_or_program_exist", "docstring": "Return whether the input course or program exist.", "docstring_tokens": ["Return", "whether", "the", "input", "course", "or", "program", "exist", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257923}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/functions.py#L770-L805", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Extract a character from each sample at the specified position from a string column.\n    Note that if the specified position is out of bound of the string sample, this method returns '', while pandas retunrs nan.", "language": "python", "parameters": "(x, i)", "return_statement": "return column.ColumnStringArrow(sl.bytes, sl.indices, sl.length, sl.offset, string_sequence=sl)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "_to_string_sequence", "(", "arg_0", ")", "if", "arg_1", "==", "-", "1", ":", "arg_2", "=", "arg_0", ".", "slice_string_end", "(", "-", "1", ")", "else", ":", "arg_2", "=", "arg_0", ".", "slice_string", "(", "arg_1", ",", "arg_1", "+", "1", ")", "return", "column", ".", "ColumnStringArrow", "(", "arg_2", ".", "bytes", ",", "arg_2", ".", "indices", ",", "arg_2", ".", "length", ",", "arg_2", ".", "offset", ",", "string_sequence", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Extract a character from each sample at the specified position from a string column.\n    Note that if the specified position is out of bound of the string sample, this method returns '', while pandas retunrs nan.\n\n    :param int i: The index location, at which to extract the character.\n    :returns: an expression containing the extracted characters.\n\n    Example:\n\n    >>> import vaex\n    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']\n    >>> df = vaex.from_arrays(text=text)\n    >>> df\n      #  text\n      0  Something\n      1  very pretty\n      2  is coming\n      3  our\n      4  way.\n\n    >>> df.text.str.get(5)\n    Expression = Func(text, 5)\n    Length: 5 dtype: str (expression)\n    ---------------------------------\n    0    h\n    1    p\n    2    m\n    3\n    4\n    \"\"\"\n    arg_0 = _to_string_sequence(arg_0)\n    if arg_1 == -1:\n        arg_2 = arg_0.slice_string_end(-1)\n    else:\n        arg_2 = arg_0.slice_string(arg_1, arg_1+1)\n    return column.ColumnStringArrow(arg_2.bytes, arg_2.indices, arg_2.length, arg_2.offset, string_sequence=arg_2)", "path": "packages/vaex-core/vaex/functions.py", "identifier": "str_get", "docstring": "Extract a character from each sample at the specified position from a string column.\n    Note that if the specified position is out of bound of the string sample, this method returns '', while pandas retunrs nan.\n\n    :param int i: The index location, at which to extract the character.\n    :returns: an expression containing the extracted characters.\n\n    Example:\n\n    >>> import vaex\n    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']\n    >>> df = vaex.from_arrays(text=text)\n    >>> df\n      #  text\n      0  Something\n      1  very pretty\n      2  is coming\n      3  our\n      4  way.\n\n    >>> df.text.str.get(5)\n    Expression = str_get(text, 5)\n    Length: 5 dtype: str (expression)\n    ---------------------------------\n    0    h\n    1    p\n    2    m\n    3\n    4", "docstring_tokens": ["Extract", "a", "character", "from", "each", "sample", "at", "the", "specified", "position", "from", "a", "string", "column", ".", "Note", "that", "if", "the", "specified", "position", "is", "out", "of", "bound", "of", "the", "string", "sample", "this", "method", "returns", "while", "pandas", "retunrs", "nan", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257924}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/rdd.py#L257-L270", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Equivalent to map, compatibility purpose only.\n        Column parameter ignored.", "language": "python", "parameters": "(self, fn, dtype=None, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "_rdd", ".", "map", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "return", "arg_0", ".", "__class__", "(", "arg_5", ",", "noblock", "=", "True", ",", "**", "arg_0", ".", "get_params", "(", ")", ")", "if", "arg_2", "is", "np", ".", "ndarray", ":", "return", "ArrayRDD", "(", "arg_5", ",", "bsize", "=", "arg_0", ".", "bsize", ",", "noblock", "=", "True", ")", "elif", "arg_2", "is", "sp", ".", "spmatrix", ":", "return", "SparseRDD", "(", "arg_5", ",", "bsize", "=", "arg_0", ".", "bsize", ",", "noblock", "=", "True", ")", "else", ":", "return", "BlockRDD", "(", "arg_5", ",", "bsize", "=", "arg_0", ".", "bsize", ",", "arg_2", "=", "arg_2", ",", "noblock", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, *arg_3, **arg_4):\n        \"\"\"Equivalent to map, compatibility purpose only.\n        Column parameter ignored.\n        \"\"\"\n        arg_5 = arg_0._rdd.map(arg_1)\n\n        if arg_2 is None:\n            return arg_0.__class__(arg_5, noblock=True, **arg_0.get_params())\n        if arg_2 is np.ndarray:\n            return ArrayRDD(arg_5, bsize=arg_0.bsize, noblock=True)\n        elif arg_2 is sp.spmatrix:\n            return SparseRDD(arg_5, bsize=arg_0.bsize, noblock=True)\n        else:\n            return BlockRDD(arg_5, bsize=arg_0.bsize, arg_2=arg_2, noblock=True)", "path": "splearn/rdd.py", "identifier": "BlockRDD.transform", "docstring": "Equivalent to map, compatibility purpose only.\n        Column parameter ignored.", "docstring_tokens": ["Equivalent", "to", "map", "compatibility", "purpose", "only", ".", "Column", "parameter", "ignored", "."], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 257925}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L788-L809", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Called by the environment to make some initial configurations before performing the\n        individual runs.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ".", "_changed_default_parameters", ")", ":", "raise", "pex", ".", "PresettingError", "(", "'The following parameters were supposed to replace a '", "'default value, but it was never tried to '", "'add default values with these names: %s'", "%", "str", "(", "arg_0", ".", "_changed_default_parameters", ")", ")", "arg_0", ".", "f_lock_parameters", "(", ")", "arg_0", ".", "f_lock_derived_parameters", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Called by the environment to make some initial configurations before performing the\n        individual runs.\n\n        Checks if all parameters marked for presetting were preset. If not raises a\n        DefaultReplacementError.\n\n        Locks all parameters.\n\n        Removal of potential results of previous runs in case the trajectory was expanded to avoid\n        mixing up undesired shortcuts in natural naming.\n\n        \"\"\"\n        if len(arg_0._changed_default_parameters):\n            raise pex.PresettingError(\n                'The following parameters were supposed to replace a '\n                'default value, but it was never tried to '\n                'add default values with these names: %s' %\n                str(arg_0._changed_default_parameters))\n\n        arg_0.f_lock_parameters()\n        arg_0.f_lock_derived_parameters()", "path": "pypet/trajectory.py", "identifier": "Trajectory._prepare_experiment", "docstring": "Called by the environment to make some initial configurations before performing the\n        individual runs.\n\n        Checks if all parameters marked for presetting were preset. If not raises a\n        DefaultReplacementError.\n\n        Locks all parameters.\n\n        Removal of potential results of previous runs in case the trajectory was expanded to avoid\n        mixing up undesired shortcuts in natural naming.", "docstring_tokens": ["Called", "by", "the", "environment", "to", "make", "some", "initial", "configurations", "before", "performing", "the", "individual", "runs", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 257926}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Parser.py#L164-L172", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Parse an instruction.", "language": "python", "parameters": "(self, row, specification)", "return_statement": "return self._spec.new_instruction_in_row(row, whole_instruction_)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_as_instruction", "(", "arg_2", ")", "return", "arg_0", ".", "_spec", ".", "new_Func", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Parse an instruction.\n\n        :param row: the row of the instruction\n        :param specification: the specification of the instruction\n        :return: the instruction in the row\n        \"\"\"\n        arg_3 = arg_0._as_instruction(arg_2)\n        return arg_0._spec.new_Func(arg_1, arg_3)", "path": "knittingpattern/Parser.py", "identifier": "Parser.instruction_in_row", "docstring": "Parse an instruction.\n\n        :param row: the row of the instruction\n        :param specification: the specification of the instruction\n        :return: the instruction in the row", "docstring_tokens": ["Parse", "an", "instruction", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 257927}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/import_loaders/table_loader.py#L375-L392", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Copy data from one table to another while filtering data at the same time", "language": "python", "parameters": "(cls, conn, **where)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "cursor", "(", ")", "if", "arg_2", "and", "arg_0", ".", "Func_where", ":", "arg_4", "=", "arg_0", ".", "Func_where", ".", "format", "(", "**", "arg_2", ")", "else", ":", "arg_4", "=", "''", "arg_3", ".", "execute", "(", "'INSERT INTO %s '", "'SELECT * FROM source.%s %s'", "%", "(", "arg_0", ".", "table", ",", "arg_0", ".", "table", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Copy data from one table to another while filtering data at the same time\n\n        Parameters\n        ----------\n        conn: sqlite3 DB connection.  It must have a second database\n            attached as \"other\".\n        **where : keyword arguments\n            specifying (start_ut and end_ut for filtering, see the Func_where clause in the subclasses)\n        \"\"\"\n        arg_3 = arg_1.cursor()\n        if arg_2 and arg_0.Func_where:\n            arg_4 = arg_0.Func_where.format(**arg_2)\n            # print(Func_where)\n        else:\n            arg_4 = ''\n        arg_3.execute('INSERT INTO %s '\n                    'SELECT * FROM source.%s %s' % (arg_0.table, arg_0.table, arg_4))", "path": "gtfspy/import_loaders/table_loader.py", "identifier": "TableLoader.copy", "docstring": "Copy data from one table to another while filtering data at the same time\n\n        Parameters\n        ----------\n        conn: sqlite3 DB connection.  It must have a second database\n            attached as \"other\".\n        **where : keyword arguments\n            specifying (start_ut and end_ut for filtering, see the copy_where clause in the subclasses)", "docstring_tokens": ["Copy", "data", "from", "one", "table", "to", "another", "while", "filtering", "data", "at", "the", "same", "time"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 257928}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L121-L143", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Check if a certain path exists in the storage service.", "language": "python", "parameters": "(self, path)", "return_statement": "return metadata and 'uuid' in metadata", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "__validate_storage_path", "(", "arg_1", ")", "try", ":", "arg_2", "=", "arg_0", ".", "api_client", ".", "get_entity_by_query", "(", "arg_1", "=", "arg_1", ")", "except", "StorageNotFoundException", ":", "return", "False", "return", "arg_2", "and", "'uuid'", "in", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''Check if a certain path Func in the storage service.\n\n        Args:\n            path (str): The path to be checked\n\n        Returns:\n            True if the path Func, False otherwise\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes\n        '''\n\n        arg_0.__validate_storage_path(arg_1)\n        try:\n            arg_2 = arg_0.api_client.get_entity_by_query(arg_1=arg_1)\n        except StorageNotFoundException:\n            return False\n\n        return arg_2 and 'uuid' in arg_2", "path": "hbp_service_client/storage_service/client.py", "identifier": "Client.exists", "docstring": "Check if a certain path exists in the storage service.\n\n        Args:\n            path (str): The path to be checked\n\n        Returns:\n            True if the path exists, False otherwise\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes", "docstring_tokens": ["Check", "if", "a", "certain", "path", "exists", "in", "the", "storage", "service", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 257929}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/edward2/program_transformations.py#L138-L223", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Takes Edward probabilistic program and returns its log joint function.", "language": "python", "parameters": "(model)", "return_statement": "return log_joint_fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "log_joint_fn", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "[", "]", "def", "interceptor", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "arg_7", "=", "arg_6", ".", "get", "(", "\"name\"", ")", "if", "arg_7", "is", "None", ":", "raise", "KeyError", "(", "\"Random variable constructor {} has no name \"", "\"in its arguments.\"", ".", "format", "(", "arg_4", ".", "__name__", ")", ")", "arg_8", "=", "arg_6", ".", "get", "(", "\"value\"", ")", "arg_9", "=", "arg_2", ".", "get", "(", "arg_7", ",", "arg_8", ")", "if", "arg_9", "is", "None", ":", "raise", "LookupError", "(", "\"Keyword argument specifying value for {} is \"", "\"missing.\"", ".", "format", "(", "arg_7", ")", ")", "arg_6", "[", "\"value\"", "]", "=", "arg_9", "arg_10", "=", "arg_4", "(", "*", "arg_5", ",", "**", "arg_6", ")", "arg_11", "=", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "arg_10", ".", "distribution", ".", "log_prob", "(", "arg_10", ".", "value", ")", ")", "arg_3", ".", "append", "(", "arg_11", ")", "return", "arg_10", "arg_12", "=", "_get_function_inputs", "(", "arg_0", ",", "arg_2", ")", "with", "interception", "(", "interceptor", ")", ":", "arg_0", "(", "*", "arg_1", ",", "**", "arg_12", ")", "arg_11", "=", "sum", "(", "arg_3", ")", "return", "arg_11", "return", "log_joint_fn"], "function": "def Func(arg_0):\n  \"\"\"Takes Edward probabilistic program and returns its log joint function.\n\n  Args:\n    model: Python callable which executes the generative process of a\n      computable probability distribution using `ed.RandomVariable`s.\n\n  Returns:\n    A log-joint probability function. Its inputs are `model`'s original inputs\n    and random variables which appear during the program execution. Its output\n    is a scalar tf.Tensor.\n\n  #### Examples\n\n  Below we define Bayesian logistic regression as an Edward program,\n  representing the model's generative process. We apply `Func` in\n  order to represent the model in terms of its joint probability function.\n\n  ```python\n  from tensorflow_probability import edward2 as ed\n\n  def logistic_regression(features):\n    coeffs = ed.Normal(loc=0., scale=1.,\n                       sample_shape=features.shape[1], name=\"coeffs\")\n    outcomes = ed.Bernoulli(logits=tf.tensordot(features, coeffs, [[1], [0]]),\n                            name=\"outcomes\")\n    return outcomes\n\n  log_joint = ed.Func(logistic_regression)\n\n  features = tf.random_normal([3, 2])\n  coeffs_value = tf.random_normal([2])\n  outcomes_value = tf.round(tf.random_uniform([3]))\n  output = log_joint(features, coeffs=coeffs_value, outcomes=outcomes_value)\n  ```\n\n  \"\"\"\n  def log_joint_fn(*arg_1, **arg_2):\n    \"\"\"Log-probability of inputs according to a joint probability distribution.\n\n    Args:\n      *args: Positional arguments. They are the model's original inputs and can\n        alternatively be specified as part of `kwargs`.\n      **kwargs: Keyword arguments, where for each key-value pair `k` and `v`,\n        `v` is passed as a `value` to the random variable(s) whose keyword\n        argument `name` during construction is equal to `k`.\n\n    Returns:\n      Scalar tf.Tensor, which represents the model's log-probability summed\n      over all Edward random variables and their dimensions.\n\n    Raises:\n      TypeError: If a random variable in the model has no specified value in\n        `**kwargs`.\n    \"\"\"\n    arg_3 = []\n\n    def interceptor(arg_4, *arg_5, **arg_6):\n      \"\"\"Overrides a random variable's `value` and accumulates its log-prob.\"\"\"\n      # Set value to keyword argument indexed by `name` (an input tensor).\n      arg_7 = arg_6.get(\"name\")\n      if arg_7 is None:\n        raise KeyError(\"Random variable constructor {} has no name \"\n                       \"in its arguments.\".format(arg_4.__name__))\n\n      # If no value is explicitly passed in for an RV, default to the value\n      # from the RV constructor. This may have been set explicitly by the user\n      # or forwarded from a lower-level interceptor.\n      arg_8 = arg_6.get(\"value\")\n      arg_9 = arg_2.get(arg_7, arg_8)\n      if arg_9 is None:\n        raise LookupError(\"Keyword argument specifying value for {} is \"\n                          \"missing.\".format(arg_7))\n      arg_6[\"value\"] = arg_9\n\n      arg_10 = arg_4(*arg_5, **arg_6)\n      arg_11 = tf.reduce_sum(input_tensor=arg_10.distribution.log_prob(arg_10.value))\n      arg_3.append(arg_11)\n      return arg_10\n\n    arg_12 = _get_function_inputs(arg_0, arg_2)\n    with interception(interceptor):\n      arg_0(*arg_1, **arg_12)\n    arg_11 = sum(arg_3)\n    return arg_11\n  return log_joint_fn", "path": "tensorflow_probability/python/edward2/program_transformations.py", "identifier": "make_log_joint_fn", "docstring": "Takes Edward probabilistic program and returns its log joint function.\n\n  Args:\n    model: Python callable which executes the generative process of a\n      computable probability distribution using `ed.RandomVariable`s.\n\n  Returns:\n    A log-joint probability function. Its inputs are `model`'s original inputs\n    and random variables which appear during the program execution. Its output\n    is a scalar tf.Tensor.\n\n  #### Examples\n\n  Below we define Bayesian logistic regression as an Edward program,\n  representing the model's generative process. We apply `make_log_joint_fn` in\n  order to represent the model in terms of its joint probability function.\n\n  ```python\n  from tensorflow_probability import edward2 as ed\n\n  def logistic_regression(features):\n    coeffs = ed.Normal(loc=0., scale=1.,\n                       sample_shape=features.shape[1], name=\"coeffs\")\n    outcomes = ed.Bernoulli(logits=tf.tensordot(features, coeffs, [[1], [0]]),\n                            name=\"outcomes\")\n    return outcomes\n\n  log_joint = ed.make_log_joint_fn(logistic_regression)\n\n  features = tf.random_normal([3, 2])\n  coeffs_value = tf.random_normal([2])\n  outcomes_value = tf.round(tf.random_uniform([3]))\n  output = log_joint(features, coeffs=coeffs_value, outcomes=outcomes_value)\n  ```", "docstring_tokens": ["Takes", "Edward", "probabilistic", "program", "and", "returns", "its", "log", "joint", "function", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257930}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L861-L868", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check the spacing of a single equals sign.", "language": "python", "parameters": "(self, tokens, i)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "_has_valid_type_annotation", "(", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_check_space", "(", "arg_1", ",", "arg_2", ",", "(", "_MUST", ",", "_MUST", ")", ")", "elif", "arg_0", ".", "_inside_brackets", "(", "\"(\"", ")", "or", "arg_0", ".", "_inside_brackets", "(", "\"lambda\"", ")", ":", "arg_0", ".", "_check_space", "(", "arg_1", ",", "arg_2", ",", "(", "_MUST_NOT", ",", "_MUST_NOT", ")", ")", "else", ":", "arg_0", ".", "_check_space", "(", "arg_1", ",", "arg_2", ",", "(", "_MUST", ",", "_MUST", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check the spacing of a single equals sign.\"\"\"\n        if arg_0._has_valid_type_annotation(arg_1, arg_2):\n            arg_0._check_space(arg_1, arg_2, (_MUST, _MUST))\n        elif arg_0._inside_brackets(\"(\") or arg_0._inside_brackets(\"lambda\"):\n            arg_0._check_space(arg_1, arg_2, (_MUST_NOT, _MUST_NOT))\n        else:\n            arg_0._check_space(arg_1, arg_2, (_MUST, _MUST))", "path": "pylint/checkers/format.py", "identifier": "FormatChecker._check_equals_spacing", "docstring": "Check the spacing of a single equals sign.", "docstring_tokens": ["Check", "the", "spacing", "of", "a", "single", "equals", "sign", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 257931}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/writers.py#L124-L150", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Configure the index to work with", "language": "python", "parameters": "(idx_url, clean=False)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "try", ":", "arg_2", "=", "requests", ".", "get", "(", "arg_0", ")", "except", "requests", ".", "exceptions", ".", "ConnectionError", ":", "arg_3", "=", "\"Error connecting to Elastic Search (index: %s)\"", "%", "arg_0", "raise", "ElasticSearchError", "(", "arg_3", "=", "arg_3", ")", "if", "arg_2", ".", "status_code", "!=", "200", ":", "arg_2", "=", "requests", ".", "put", "(", "arg_0", ")", "if", "arg_2", ".", "status_code", "!=", "200", ":", "logger", ".", "info", "(", "\"Can't create index %s (%s)\"", ",", "arg_0", ",", "arg_2", ".", "status_code", ")", "arg_3", "=", "\"Error creating Elastic Search index %s\"", "%", "arg_0", "raise", "ElasticSearchError", "(", "arg_3", "=", "arg_3", ")", "logger", ".", "info", "(", "\"Index %s created\"", ",", "arg_0", ")", "return", "True", "elif", "arg_2", ".", "status_code", "==", "200", "and", "arg_1", ":", "requests", ".", "delete", "(", "arg_0", ")", "requests", ".", "put", "(", "arg_0", ")", "logger", ".", "info", "(", "\"Index deleted and created (index: %s)\"", ",", "arg_0", ")", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Configure the index to work with\"\"\"\n\n        try:\n            arg_2 = requests.get(arg_0)\n        except requests.exceptions.ConnectionError:\n            arg_3 = \"Error connecting to Elastic Search (index: %s)\" % arg_0\n            raise ElasticSearchError(arg_3=arg_3)\n\n        if arg_2.status_code != 200:\n            # The index does not exist\n            arg_2 = requests.put(arg_0)\n\n            if arg_2.status_code != 200:\n                logger.info(\"Can't create index %s (%s)\", arg_0, arg_2.status_code)\n                arg_3 = \"Error creating Elastic Search index %s\" % arg_0\n                raise ElasticSearchError(arg_3=arg_3)\n\n            logger.info(\"Index %s created\", arg_0)\n            return True\n        elif arg_2.status_code == 200 and arg_1:\n            requests.delete(arg_0)\n            requests.put(arg_0)\n            logger.info(\"Index deleted and created (index: %s)\", arg_0)\n            return True\n\n        return False", "path": "arthur/writers.py", "identifier": "ElasticItemsWriter.create_index", "docstring": "Configure the index to work with", "docstring_tokens": ["Configure", "the", "index", "to", "work", "with"], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 257932}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/cmd_util.py#L166-L185", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Parse arguments not consumed by arg parser into a dicitonary", "language": "python", "parameters": "(args)", "return_statement": "return retval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "False", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "startswith", "(", "'--'", ")", ":", "if", "'='", "in", "arg_3", ":", "arg_4", "=", "arg_3", ".", "split", "(", "'='", ")", "[", "0", "]", "[", "2", ":", "]", "arg_5", "=", "arg_3", ".", "split", "(", "'='", ")", "[", "1", "]", "arg_1", "[", "arg_4", "]", "=", "arg_5", "else", ":", "arg_4", "=", "arg_3", "[", "2", ":", "]", "arg_2", "=", "True", "elif", "arg_2", ":", "arg_1", "[", "arg_4", "]", "=", "arg_3", "arg_2", "=", "False", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse arguments not consumed by arg parser into a dicitonary\n    \"\"\"\n    arg_1 = {}\n    arg_2 = False\n    for arg_3 in arg_0:\n        if arg_3.startswith('--'):\n            if '=' in arg_3:\n                arg_4 = arg_3.split('=')[0][2:]\n                arg_5 = arg_3.split('=')[1]\n                arg_1[arg_4] = arg_5\n            else:\n                arg_4 = arg_3[2:]\n                arg_2 = True\n        elif arg_2:\n            arg_1[arg_4] = arg_3\n            arg_2 = False\n\n    return arg_1", "path": "baselines/common/cmd_util.py", "identifier": "parse_unknown_args", "docstring": "Parse arguments not consumed by arg parser into a dicitonary", "docstring_tokens": ["Parse", "arguments", "not", "consumed", "by", "arg", "parser", "into", "a", "dicitonary"], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 257933}
{"url": "https://github.com/Terrance/SkPy/blob/0f9489c94e8ec4d3effab4314497428872a80ad1/skpy/conn.py#L411-L416", "sha": "0f9489c94e8ec4d3effab4314497428872a80ad1", "docstring_summary": "Ask Skype for the authenticated user's identifier, and store it on the connection object.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "userId", "=", "arg_0", "(", "\"GET\"", ",", "\"{0}/users/self/profile\"", ".", "format", "(", "arg_0", ".", "API_USER", ")", ",", "auth", "=", "arg_0", ".", "Auth", ".", "SkypeToken", ")", ".", "json", "(", ")", ".", "get", "(", "\"username\"", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Ask Skype for the authenticated user's identifier, and store it on the connection object.\n        \"\"\"\n        arg_0.userId = arg_0(\"GET\", \"{0}/users/self/profile\".format(arg_0.API_USER),\n                           auth=arg_0.Auth.SkypeToken).json().get(\"username\")", "path": "skpy/conn.py", "identifier": "SkypeConnection.getUserId", "docstring": "Ask Skype for the authenticated user's identifier, and store it on the connection object.", "docstring_tokens": ["Ask", "Skype", "for", "the", "authenticated", "user", "s", "identifier", "and", "store", "it", "on", "the", "connection", "object", "."], "nwo": "Terrance/SkPy", "score": 0.6983298124827472, "idx": 257934}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/plots.py#L939-L989", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Plot two parts of the ortho view, the two sections given by ``orientation``.", "language": "python", "parameters": "(field, center=None, size=6.0, cmap='bone_r', vmin=0, vmax=1,\n        orientation='vertical', figpad=1.09, off=0.01)", "return_statement": "return fig, ax1, ax2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "6.0", ",", "arg_3", "=", "'bone_r'", ",", "arg_4", "=", "0", ",", "arg_5", "=", "1", ",", "arg_6", "=", "'vertical'", ",", "arg_7", "=", "1.09", ",", "arg_8", "=", "0.01", ")", ":", "arg_1", "=", "arg_1", "or", "[", "arg_10", "//", "2", "for", "arg_10", "in", "arg_0", ".", "shape", "]", "arg_9", "=", "[", "]", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_1", ")", ":", "arg_12", "=", "[", "np", ".", "s_", "[", ":", "]", "]", "*", "len", "(", "arg_1", ")", "arg_12", "[", "arg_10", "]", "=", "arg_11", "arg_9", ".", "append", "(", "tuple", "(", "arg_12", ")", ")", "arg_13", ",", "arg_14", ",", "arg_15", "=", "[", "float", "(", "arg_10", ")", "for", "arg_10", "in", "arg_0", ".", "shape", "]", "arg_16", "=", "float", "(", "arg_15", "+", "arg_13", ")", "arg_17", "=", "float", "(", "arg_14", "+", "arg_13", ")", "def", "show", "(", "arg_0", ",", "arg_18", ",", "arg_19", ",", "arg_20", "=", "False", ")", ":", "arg_21", "=", "arg_0", "[", "arg_19", "]", "if", "not", "arg_20", "else", "arg_0", "[", "arg_19", "]", ".", "T", "arg_18", ".", "imshow", "(", "arg_21", ",", "arg_3", "=", "arg_3", ",", "interpolation", "=", "'nearest'", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_18", ".", "set_xticks", "(", "[", "]", ")", "arg_18", ".", "set_yticks", "(", "[", "]", ")", "arg_18", ".", "grid", "(", "'off'", ")", "if", "arg_6", ".", "startswith", "(", "'v'", ")", ":", "log", ".", "info", "(", "'{} {} {} {} {} {}'", ".", "format", "(", "arg_15", ",", "arg_14", ",", "arg_13", ",", "arg_16", ",", "arg_17", ",", "arg_15", "/", "arg_17", ")", ")", "arg_22", "=", "arg_15", "/", "arg_17", "arg_23", "=", "arg_14", "/", "arg_17", "arg_24", "=", "1", "/", "(", "1", "+", "3", "*", "arg_8", ")", "arg_25", "=", "pl", ".", "figure", "(", "figsize", "=", "(", "arg_2", "*", "arg_22", ",", "arg_2", "*", "arg_24", ")", ")", "arg_26", "=", "arg_25", ".", "add_axes", "(", "(", "arg_8", ",", "arg_24", "*", "(", "1", "-", "arg_23", ")", "+", "2", "*", "arg_8", ",", "arg_24", ",", "arg_24", "*", "arg_23", ")", ")", "arg_27", "=", "arg_25", ".", "add_axes", "(", "(", "arg_8", ",", "arg_8", ",", "arg_24", ",", "arg_24", "*", "(", "1", "-", "arg_23", ")", ")", ")", "show", "(", "arg_0", ",", "arg_26", ",", "arg_9", "[", "0", "]", ")", "show", "(", "arg_0", ",", "arg_27", ",", "arg_9", "[", "1", "]", ")", "else", ":", "arg_22", "=", "arg_14", "/", "arg_16", "arg_23", "=", "arg_15", "/", "arg_16", "arg_24", "=", "1", "/", "(", "1", "+", "3", "*", "arg_8", ")", "arg_25", "=", "pl", ".", "figure", "(", "figsize", "=", "(", "arg_2", "*", "arg_24", ",", "arg_2", "*", "arg_22", ")", ")", "arg_26", "=", "arg_25", ".", "add_axes", "(", "(", "arg_8", ",", "arg_8", ",", "arg_24", "*", "arg_23", ",", "arg_24", ")", ")", "arg_27", "=", "arg_25", ".", "add_axes", "(", "(", "2", "*", "arg_8", "+", "arg_24", "*", "arg_23", ",", "arg_8", ",", "arg_24", "*", "(", "1", "-", "arg_23", ")", ",", "arg_24", ")", ")", "show", "(", "arg_0", ",", "arg_26", ",", "arg_9", "[", "0", "]", ")", "show", "(", "arg_0", ",", "arg_27", ",", "arg_9", "[", "2", "]", ",", "arg_20", "=", "True", ")", "return", "arg_25", ",", "arg_26", ",", "arg_27"], "function": "def Func(arg_0, arg_1=None, arg_2=6.0, arg_3='bone_r', arg_4=0, arg_5=1,\n        arg_6='vertical', arg_7=1.09, arg_8=0.01):\n    \"\"\"\n    Plot two parts of the ortho view, the two sections given by ``orientation``.\n    \"\"\"\n    arg_1 = arg_1 or [arg_10//2 for arg_10 in arg_0.shape]\n    arg_9 = []\n    for arg_10,arg_11 in enumerate(arg_1):\n        arg_12 = [np.s_[:]]*len(arg_1)\n        arg_12[arg_10] = arg_11\n        arg_9.append(tuple(arg_12))\n\n    arg_13,arg_14,arg_15 = [float(arg_10) for arg_10 in arg_0.shape]\n    arg_16 = float(arg_15 + arg_13)\n    arg_17 = float(arg_14 + arg_13)\n\n    def show(arg_0, arg_18, arg_19, arg_20=False):\n        arg_21 = arg_0[arg_19] if not arg_20 else arg_0[arg_19].T\n        arg_18.imshow(\n            arg_21, arg_3=arg_3, interpolation='nearest',\n            arg_4=arg_4, arg_5=arg_5\n        )\n        arg_18.set_xticks([])\n        arg_18.set_yticks([])\n        arg_18.grid('off')\n\n    if arg_6.startswith('v'):\n        # rect = l,b,w,h\n        log.info('{} {} {} {} {} {}'.format(arg_15, arg_14, arg_13, arg_16, arg_17, arg_15/arg_17))\n        arg_22 = arg_15/arg_17\n        arg_23 = arg_14/arg_17\n        arg_24 = 1 / (1 + 3*arg_8)\n        arg_25 = pl.figure(figsize=(arg_2*arg_22, arg_2*arg_24))\n        arg_26 = arg_25.add_axes((arg_8, arg_24*(1-arg_23)+2*arg_8, arg_24, arg_24*arg_23))\n        arg_27 = arg_25.add_axes((arg_8, arg_8,           arg_24, arg_24*(1-arg_23)))\n\n        show(arg_0, arg_26, arg_9[0])\n        show(arg_0, arg_27, arg_9[1])\n    else:\n        # rect = l,b,w,h\n        arg_22 = arg_14/arg_16\n        arg_23 = arg_15/arg_16\n        arg_24 = 1 / (1 + 3*arg_8)\n        arg_25 = pl.figure(figsize=(arg_2*arg_24, arg_2*arg_22))\n        arg_26 = arg_25.add_axes((arg_8,    arg_8,   arg_24*arg_23, arg_24))\n        arg_27 = arg_25.add_axes((2*arg_8+arg_24*arg_23, arg_8, arg_24*(1-arg_23), arg_24))\n\n        show(arg_0, arg_26, arg_9[0])\n        show(arg_0, arg_27, arg_9[2], arg_20=True)\n\n    return arg_25, arg_26, arg_27", "path": "peri/viz/plots.py", "identifier": "twoslice", "docstring": "Plot two parts of the ortho view, the two sections given by ``orientation``.", "docstring_tokens": ["Plot", "two", "parts", "of", "the", "ortho", "view", "the", "two", "sections", "given", "by", "orientation", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 257935}
{"url": "https://github.com/Toblerity/rtree/blob/5d33357c8e88f1a8344415dc15a7d2440211b281/rtree/index.py#L396-L430", "sha": "5d33357c8e88f1a8344415dc15a7d2440211b281", "docstring_summary": "Return number of objects that intersect the given coordinates.", "language": "python", "parameters": "(self, coordinates)", "return_statement": "return p_num_results.value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "get_coordinate_pointers", "(", "arg_1", ")", "arg_4", "=", "ctypes", ".", "c_uint64", "(", "0", ")", "core", ".", "rt", ".", "Index_Intersects_Func", "(", "arg_0", ".", "handle", ",", "arg_2", ",", "arg_3", ",", "arg_0", ".", "properties", ".", "dimension", ",", "ctypes", ".", "byref", "(", "arg_4", ")", ")", "return", "arg_4", ".", "value"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return number of objects that intersect the given coordinates.\n\n        :param coordinates: sequence or array\n            This may be an object that satisfies the numpy array\n            protocol, providing the index's dimension * 2 coordinate\n            pairs representing the `mink` and `maxk` coordinates in\n            each dimension defining the bounds of the query window.\n\n        The following example queries the index for any objects any objects\n        that were stored in the index intersect the bounds given in the\n        coordinates::\n\n            >>> from rtree import index\n            >>> idx = index.Index()\n            >>> idx.insert(4321,\n            ...            (34.3776829412, 26.7375853734, 49.3776829412,\n            ...             41.7375853734),\n            ...            obj=42)\n\n            >>> print(idx.Func((0, 0, 60, 60)))\n            1\n\n        \"\"\"\n        arg_2, arg_3 = arg_0.get_coordinate_pointers(arg_1)\n\n        arg_4 = ctypes.c_uint64(0)\n\n        core.rt.Index_Intersects_Func(arg_0.handle,\n                                       arg_2,\n                                       arg_3,\n                                       arg_0.properties.dimension,\n                                       ctypes.byref(arg_4))\n\n        return arg_4.value", "path": "rtree/index.py", "identifier": "Index.count", "docstring": "Return number of objects that intersect the given coordinates.\n\n        :param coordinates: sequence or array\n            This may be an object that satisfies the numpy array\n            protocol, providing the index's dimension * 2 coordinate\n            pairs representing the `mink` and `maxk` coordinates in\n            each dimension defining the bounds of the query window.\n\n        The following example queries the index for any objects any objects\n        that were stored in the index intersect the bounds given in the\n        coordinates::\n\n            >>> from rtree import index\n            >>> idx = index.Index()\n            >>> idx.insert(4321,\n            ...            (34.3776829412, 26.7375853734, 49.3776829412,\n            ...             41.7375853734),\n            ...            obj=42)\n\n            >>> print(idx.count((0, 0, 60, 60)))\n            1", "docstring_tokens": ["Return", "number", "of", "objects", "that", "intersect", "the", "given", "coordinates", "."], "nwo": "Toblerity/rtree", "score": 0.6128222292729003, "idx": 257936}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/linear_gaussian_ssm.py#L1198-L1272", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Backward update for a Kalman smoother.", "language": "python", "parameters": "(filtered_mean,\n                              filtered_cov,\n                              predicted_mean,\n                              predicted_cov,\n                              next_posterior_mean,\n                              next_posterior_cov,\n                              transition_matrix)", "return_statement": "return (posterior_mean, posterior_cov)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "arg_6", ".", "matmul", "(", "arg_1", ")", "arg_8", "=", "tf", ".", "linalg", ".", "cholesky", "(", "arg_3", ")", "arg_9", "=", "tf", ".", "linalg", ".", "cholesky_solve", "(", "arg_8", ",", "arg_7", ")", "arg_10", "=", "(", "arg_0", "+", "tf", ".", "linalg", ".", "matmul", "(", "arg_9", ",", "arg_4", "-", "arg_2", ",", "adjoint_a", "=", "True", ")", ")", "arg_11", "=", "(", "arg_1", "+", "tf", ".", "linalg", ".", "matmul", "(", "arg_9", ",", "tf", ".", "linalg", ".", "matmul", "(", "arg_5", "-", "arg_3", ",", "arg_9", ")", ",", "adjoint_a", "=", "True", ")", ")", "return", "(", "arg_10", ",", "arg_11", ")"], "function": "def Func(arg_0,\n                              arg_1,\n                              arg_2,\n                              arg_3,\n                              arg_4,\n                              arg_5,\n                              arg_6):\n  \"\"\"Backward update for a Kalman smoother.\n\n  Give the `filtered_mean` mu(t | t), `filtered_cov` sigma(t | t),\n  `predicted_mean` mu(t+1 | t) and `predicted_cov` sigma(t+1 | t),\n  as returns from the `forward_filter` function, as well as\n  `next_posterior_mean` mu(t+1 | 1:T) and `next_posterior_cov` sigma(t+1 | 1:T),\n  if the `transition_matrix` of states from time t to time t+1\n  is given as A(t+1), the 1 step backward smoothed distribution parameter\n  could be calculated as:\n  p(z(t) | Obs(1:T)) = N( mu(t | 1:T), sigma(t | 1:T)),\n  mu(t | 1:T) = mu(t | t) + J(t) * (mu(t+1 | 1:T) - mu(t+1 | t)),\n  sigma(t | 1:T) = sigma(t | t)\n                   + J(t) * (sigma(t+1 | 1:T) - sigma(t+1 | t) * J(t)',\n  J(t) = sigma(t | t) * A(t+1)' / sigma(t+1 | t),\n  where all the multiplications are matrix multiplication, and `/` is\n  the matrix inverse. J(t) is the backward Kalman gain matrix.\n\n  The algorithm can be intialized from mu(T | 1:T) and sigma(T | 1:T),\n  which are the last step parameters returned by forward_filter.\n\n\n  Args:\n    filtered_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t | t).\n    filtered_cov: `Tensor` with event shape `[latent_size, latent_size]` and\n      batch shape `B`, containing sigma(t | t).\n    predicted_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t+1 | t).\n    predicted_cov: `Tensor` with event shape `[latent_size, latent_size]` and\n      batch shape `B`, containing sigma(t+1 | t).\n    next_posterior_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t+1 | 1:T).\n    next_posterior_cov: `Tensor` with event shape `[latent_size, latent_size]`\n      and batch shape `B`, containing sigma(t+1 | 1:T).\n    transition_matrix: `LinearOperator` with shape\n      `[latent_size, latent_size]` and batch shape broadcastable\n      to `B`.\n\n  Returns:\n    posterior_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t | 1:T).\n    posterior_cov: `Tensor` with event shape `[latent_size, latent_size]` and\n      batch shape `B`, containing sigma(t | 1:T).\n  \"\"\"\n  # Compute backward Kalman gain:\n  # J = F * T' * P^{-1}\n  # Since both F(iltered) and P(redictive) are cov matrices,\n  # thus self-adjoint, we can take the transpose.\n  # computation:\n  #      = (P^{-1} * T * F)'\n  #      = (P^{-1} * tmp_gain_cov) '\n  #      = (P \\ tmp_gain_cov)'\n  arg_7 = arg_6.matmul(arg_1)\n  arg_8 = tf.linalg.cholesky(arg_3)\n  arg_9 = tf.linalg.cholesky_solve(arg_8, arg_7)\n\n  arg_10 = (arg_0 +\n                    tf.linalg.matmul(arg_9,\n                                     arg_4 - arg_2,\n                                     adjoint_a=True))\n  arg_11 = (\n      arg_1 +\n      tf.linalg.matmul(arg_9,\n                       tf.linalg.matmul(\n                           arg_5 - arg_3, arg_9),\n                       adjoint_a=True))\n\n  return (arg_10, arg_11)", "path": "tensorflow_probability/python/distributions/linear_gaussian_ssm.py", "identifier": "backward_smoothing_update", "docstring": "Backward update for a Kalman smoother.\n\n  Give the `filtered_mean` mu(t | t), `filtered_cov` sigma(t | t),\n  `predicted_mean` mu(t+1 | t) and `predicted_cov` sigma(t+1 | t),\n  as returns from the `forward_filter` function, as well as\n  `next_posterior_mean` mu(t+1 | 1:T) and `next_posterior_cov` sigma(t+1 | 1:T),\n  if the `transition_matrix` of states from time t to time t+1\n  is given as A(t+1), the 1 step backward smoothed distribution parameter\n  could be calculated as:\n  p(z(t) | Obs(1:T)) = N( mu(t | 1:T), sigma(t | 1:T)),\n  mu(t | 1:T) = mu(t | t) + J(t) * (mu(t+1 | 1:T) - mu(t+1 | t)),\n  sigma(t | 1:T) = sigma(t | t)\n                   + J(t) * (sigma(t+1 | 1:T) - sigma(t+1 | t) * J(t)',\n  J(t) = sigma(t | t) * A(t+1)' / sigma(t+1 | t),\n  where all the multiplications are matrix multiplication, and `/` is\n  the matrix inverse. J(t) is the backward Kalman gain matrix.\n\n  The algorithm can be intialized from mu(T | 1:T) and sigma(T | 1:T),\n  which are the last step parameters returned by forward_filter.\n\n\n  Args:\n    filtered_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t | t).\n    filtered_cov: `Tensor` with event shape `[latent_size, latent_size]` and\n      batch shape `B`, containing sigma(t | t).\n    predicted_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t+1 | t).\n    predicted_cov: `Tensor` with event shape `[latent_size, latent_size]` and\n      batch shape `B`, containing sigma(t+1 | t).\n    next_posterior_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t+1 | 1:T).\n    next_posterior_cov: `Tensor` with event shape `[latent_size, latent_size]`\n      and batch shape `B`, containing sigma(t+1 | 1:T).\n    transition_matrix: `LinearOperator` with shape\n      `[latent_size, latent_size]` and batch shape broadcastable\n      to `B`.\n\n  Returns:\n    posterior_mean: `Tensor` with event shape `[latent_size, 1]` and\n      batch shape `B`, containing mu(t | 1:T).\n    posterior_cov: `Tensor` with event shape `[latent_size, latent_size]` and\n      batch shape `B`, containing sigma(t | 1:T).", "docstring_tokens": ["Backward", "update", "for", "a", "Kalman", "smoother", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 257937}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L796-L840", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Performs a bootstrap analysis on a user-defined function returning\n    a summary statistic.", "language": "python", "parameters": "(func, returns, *args, **kwargs)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "pop", "(", "'n_samples'", ",", "1000", ")", "arg_5", "=", "np", ".", "empty", "(", "arg_4", ")", "arg_6", "=", "arg_3", ".", "pop", "(", "'factor_returns'", ",", "None", ")", "for", "arg_7", "in", "range", "(", "arg_4", ")", ":", "arg_8", "=", "np", ".", "random", ".", "randint", "(", "len", "(", "arg_1", ")", ",", "size", "=", "len", "(", "arg_1", ")", ")", "arg_9", "=", "arg_1", ".", "iloc", "[", "arg_8", "]", ".", "reset_index", "(", "drop", "=", "True", ")", "if", "arg_6", "is", "not", "None", ":", "arg_10", "=", "arg_6", ".", "iloc", "[", "arg_8", "]", ".", "reset_index", "(", "drop", "=", "True", ")", "arg_5", "[", "arg_7", "]", "=", "arg_0", "(", "arg_9", ",", "arg_10", ",", "*", "arg_2", ",", "**", "arg_3", ")", "else", ":", "arg_5", "[", "arg_7", "]", "=", "arg_0", "(", "arg_9", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n    \"\"\"Performs a bootstrap analysis on a user-defined function returning\n    a summary statistic.\n\n    Parameters\n    ----------\n    func : function\n        Function that either takes a single array (commonly returns)\n        or two arrays (commonly returns and factor returns) and\n        returns a single value (commonly a summary\n        statistic). Additional args and kwargs are passed as well.\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    n_samples : int, optional\n        Number of bootstrap samples to draw. Default is 1000.\n        Increasing this will lead to more stable / accurate estimates.\n\n    Returns\n    -------\n    numpy.ndarray\n        Bootstrapped sampling distribution of passed in func.\n    \"\"\"\n\n    arg_4 = arg_3.pop('n_samples', 1000)\n    arg_5 = np.empty(arg_4)\n\n    arg_6 = arg_3.pop('factor_returns', None)\n\n    for arg_7 in range(arg_4):\n        arg_8 = np.random.randint(len(arg_1), size=len(arg_1))\n        arg_9 = arg_1.iloc[arg_8].reset_index(drop=True)\n        if arg_6 is not None:\n            arg_10 = arg_6.iloc[arg_8].reset_index(drop=True)\n            arg_5[arg_7] = arg_0(arg_9, arg_10,\n                          *arg_2, **arg_3)\n        else:\n            arg_5[arg_7] = arg_0(arg_9,\n                          *arg_2, **arg_3)\n\n    return arg_5", "path": "pyfolio/timeseries.py", "identifier": "calc_bootstrap", "docstring": "Performs a bootstrap analysis on a user-defined function returning\n    a summary statistic.\n\n    Parameters\n    ----------\n    func : function\n        Function that either takes a single array (commonly returns)\n        or two arrays (commonly returns and factor returns) and\n        returns a single value (commonly a summary\n        statistic). Additional args and kwargs are passed as well.\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    n_samples : int, optional\n        Number of bootstrap samples to draw. Default is 1000.\n        Increasing this will lead to more stable / accurate estimates.\n\n    Returns\n    -------\n    numpy.ndarray\n        Bootstrapped sampling distribution of passed in func.", "docstring_tokens": ["Performs", "a", "bootstrap", "analysis", "on", "a", "user", "-", "defined", "function", "returning", "a", "summary", "statistic", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 257938}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/from_inspire.py#L541-L559", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "260 Date normalization.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "record_get_field_instances", "(", "arg_0", ".", "record", ",", "'260'", ")", "for", "arg_2", "in", "arg_1", ":", "for", "arg_3", ",", "(", "arg_4", ",", "arg_5", ")", "in", "enumerate", "(", "arg_2", "[", "0", "]", ")", ":", "if", "arg_4", "==", "'c'", ":", "arg_2", "[", "0", "]", "[", "arg_3", "]", "=", "(", "'c'", ",", "arg_5", "[", ":", "4", "]", ")", "elif", "arg_4", "==", "'t'", ":", "del", "arg_2", "[", "0", "]", "[", "arg_3", "]", "if", "not", "arg_1", ":", "arg_6", "=", "record_get_field_values", "(", "arg_0", ".", "record", ",", "\"773\"", ",", "code", "=", "\"y\"", ")", "if", "arg_6", ":", "record_add_field", "(", "arg_0", ".", "record", ",", "\"260\"", ",", "subfields", "=", "[", "(", "\"c\"", ",", "arg_6", "[", "0", "]", "[", ":", "4", "]", ")", "]", ")", "else", ":", "arg_7", "=", "record_get_field_values", "(", "arg_0", ".", "record", ",", "\"269\"", ",", "code", "=", "\"c\"", ")", "if", "arg_7", ":", "record_add_field", "(", "arg_0", ".", "record", ",", "\"260\"", ",", "subfields", "=", "[", "(", "\"c\"", ",", "arg_7", "[", "0", "]", "[", ":", "4", "]", ")", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"260 Date normalization.\"\"\"\n        arg_1 = record_get_field_instances(arg_0.record, '260')\n        for arg_2 in arg_1:\n            for arg_3, (arg_4, arg_5) in enumerate(arg_2[0]):\n                if arg_4 == 'c':\n                    arg_2[0][arg_3] = ('c', arg_5[:4])\n                elif arg_4 == 't':\n                    del arg_2[0][arg_3]\n        if not arg_1:\n            arg_6 = record_get_field_values(arg_0.record, \"773\", code=\"y\")\n            if arg_6:\n                record_add_field(\n                    arg_0.record, \"260\", subfields=[(\"c\", arg_6[0][:4])])\n            else:\n                arg_7 = record_get_field_values(arg_0.record, \"269\", code=\"c\")\n                if arg_7:\n                    record_add_field(\n                        arg_0.record, \"260\", subfields=[(\"c\", arg_7[0][:4])])", "path": "harvestingkit/inspire_cds_package/from_inspire.py", "identifier": "Inspire2CDS.update_date_year", "docstring": "260 Date normalization.", "docstring_tokens": ["260", "Date", "normalization", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257939}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L23-L34", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Returns the list of reports for the canvas account id.", "language": "python", "parameters": "(self, account_id)", "return_statement": "return report_types", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ACCOUNTS_API", ".", "format", "(", "arg_1", ")", "+", "\"/reports\"", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "_get_resource", "(", "arg_2", ")", ":", "arg_3", ".", "append", "(", "ReportType", "(", "data", "=", "arg_4", ",", "arg_1", "=", "arg_1", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns the list of reports for the canvas account id.\n\n        https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.available_reports\n        \"\"\"\n        arg_2 = ACCOUNTS_API.format(arg_1) + \"/reports\"\n\n        arg_3 = []\n        for arg_4 in arg_0._get_resource(arg_2):\n            arg_3.append(ReportType(data=arg_4, arg_1=arg_1))\n        return arg_3", "path": "uw_canvas/reports.py", "identifier": "Reports.get_available_reports", "docstring": "Returns the list of reports for the canvas account id.\n\n        https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.available_reports", "docstring_tokens": ["Returns", "the", "list", "of", "reports", "for", "the", "canvas", "account", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 257940}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/util.py#L65-L72", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Save the object to a given file like object in the given format.", "language": "python", "parameters": "(self, flo, format=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_2", "=", "arg_0", ".", "format", "if", "arg_2", "is", "None", "else", "arg_2", "arg_4", "=", "getattr", "(", "arg_0", ",", "\"save_%s\"", "%", "arg_2", ",", "None", ")", "if", "arg_4", "is", "None", ":", "raise", "ValueError", "(", "\"Unknown format '%s'.\"", "%", "arg_2", ")", "arg_4", "(", "arg_1", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\" Save the object to a given file like object in the given format.\n        \"\"\"\n        arg_2 = arg_0.format if arg_2 is None else arg_2\n        arg_4 = getattr(arg_0, \"save_%s\" % arg_2, None)\n        if arg_4 is None:\n            raise ValueError(\"Unknown format '%s'.\" % arg_2)\n        arg_4(arg_1, **arg_3)", "path": "godot/util.py", "identifier": "Serializable.save_to_file_like", "docstring": "Save the object to a given file like object in the given format.", "docstring_tokens": ["Save", "the", "object", "to", "a", "given", "file", "like", "object", "in", "the", "given", "format", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 257941}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1256-L1279", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Compares two operands.", "language": "python", "parameters": "(cpu, src1, src2)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "read", "(", ")", "arg_4", "=", "Operators", ".", "SEXTEND", "(", "arg_2", ".", "read", "(", ")", ",", "arg_2", ".", "size", ",", "arg_1", ".", "size", ")", "arg_0", ".", "_calculate_Func_flags", "(", "arg_1", ".", "size", ",", "arg_3", "-", "arg_4", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Compares two operands.\n\n        Compares the first source operand with the second source operand and sets the status flags\n        in the EFLAGS register according to the results. The comparison is performed by subtracting\n        the second operand from the first operand and then setting the status flags in the same manner\n        as the SUB instruction. When an immediate value is used as an operand, it is sign-extended to\n        the length of the first operand::\n\n                temp  =  SRC1 - SignExtend(SRC2);\n                ModifyStatusFlags; (* Modify status flags in the same manner as the SUB instruction*)\n\n        The CF, OF, SF, ZF, AF, and PF flags are set according to the result.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.\n        \"\"\"\n        arg_3 = arg_1.read()\n        arg_4 = Operators.SEXTEND(arg_2.read(), arg_2.size, arg_1.size)\n\n        # Affected Flags o..szapc\n        arg_0._calculate_Func_flags(arg_1.size, arg_3 - arg_4, arg_3, arg_4)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.CMP", "docstring": "Compares two operands.\n\n        Compares the first source operand with the second source operand and sets the status flags\n        in the EFLAGS register according to the results. The comparison is performed by subtracting\n        the second operand from the first operand and then setting the status flags in the same manner\n        as the SUB instruction. When an immediate value is used as an operand, it is sign-extended to\n        the length of the first operand::\n\n                temp  =  SRC1 - SignExtend(SRC2);\n                ModifyStatusFlags; (* Modify status flags in the same manner as the SUB instruction*)\n\n        The CF, OF, SF, ZF, AF, and PF flags are set according to the result.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.", "docstring_tokens": ["Compares", "two", "operands", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257942}
{"url": "https://github.com/textbook/aslack/blob/9ac6a44e4464180109fa4be130ad7a980a9d1acc/aslack/utils.py#L27-L47", "sha": "9ac6a44e4464180109fa4be130ad7a980a9d1acc", "docstring_summary": "Raise an appropriate error for a given response.", "language": "python", "parameters": "(response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "web_exceptions", ".", "__all__", ":", "arg_2", "=", "getattr", "(", "web_exceptions", ",", "arg_1", ")", "if", "arg_2", ".", "status_code", "==", "arg_0", ".", "status", ":", "arg_3", "=", "dict", "(", "headers", "=", "arg_0", ".", "headers", ",", "reason", "=", "arg_0", ".", "reason", ",", ")", "if", "issubclass", "(", "arg_2", ",", "web_exceptions", ".", "_HTTPMove", ")", ":", "raise", "arg_2", "(", "arg_0", ".", "headers", "[", "'Location'", "]", ",", "**", "arg_3", ")", "raise", "arg_2", "(", "**", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Raise an appropriate error for a given response.\n\n    Arguments:\n      response (:py:class:`aiohttp.ClientResponse`): The API response.\n\n    Raises:\n      :py:class:`aiohttp.web_exceptions.HTTPException`: The appropriate\n        error for the response's status.\n\n    \"\"\"\n    for arg_1 in web_exceptions.__all__:\n        arg_2 = getattr(web_exceptions, arg_1)\n        if arg_2.status_code == arg_0.status:\n            arg_3 = dict(\n                headers=arg_0.headers,\n                reason=arg_0.reason,\n            )\n            if issubclass(arg_2, web_exceptions._HTTPMove):  # pylint: disable=protected-access\n                raise arg_2(arg_0.headers['Location'], **arg_3)\n            raise arg_2(**arg_3)", "path": "aslack/utils.py", "identifier": "raise_for_status", "docstring": "Raise an appropriate error for a given response.\n\n    Arguments:\n      response (:py:class:`aiohttp.ClientResponse`): The API response.\n\n    Raises:\n      :py:class:`aiohttp.web_exceptions.HTTPException`: The appropriate\n        error for the response's status.", "docstring_tokens": ["Raise", "an", "appropriate", "error", "for", "a", "given", "response", "."], "nwo": "textbook/aslack", "score": 0.18261785916548806, "idx": 257943}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_http/winhttp.py#L313-L318", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gets status of response.", "language": "python", "parameters": "(self)", "return_statement": "return int(status.value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "c_long", "(", ")", "_WinHttpRequest", ".", "_Status", "(", "arg_0", ",", "byref", "(", "Func", ")", ")", "return", "int", "(", "Func", ".", "value", ")"], "function": "def Func(arg_0):\n        ''' Gets status of response. '''\n\n        Func = c_long()\n        _WinHttpRequest._Status(arg_0, byref(Func))\n        return int(Func.value)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_http/winhttp.py", "identifier": "_WinHttpRequest.status", "docstring": "Gets status of response.", "docstring_tokens": ["Gets", "status", "of", "response", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257944}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L424-L455", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Refreshes the task instance from the database based on the primary key", "language": "python", "parameters": "(self, session=None, lock_for_update=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "TaskInstance", "arg_4", "=", "arg_1", ".", "query", "(", "arg_3", ")", ".", "filter", "(", "arg_3", ".", "dag_id", "==", "arg_0", ".", "dag_id", ",", "arg_3", ".", "task_id", "==", "arg_0", ".", "task_id", ",", "arg_3", ".", "execution_date", "==", "arg_0", ".", "execution_date", ")", "if", "arg_2", ":", "arg_5", "=", "arg_4", ".", "with_for_update", "(", ")", ".", "first", "(", ")", "else", ":", "arg_5", "=", "arg_4", ".", "first", "(", ")", "if", "arg_5", ":", "arg_0", ".", "state", "=", "arg_5", ".", "state", "arg_0", ".", "start_date", "=", "arg_5", ".", "start_date", "arg_0", ".", "end_date", "=", "arg_5", ".", "end_date", "arg_0", ".", "try_number", "=", "arg_5", ".", "_try_number", "arg_0", ".", "max_tries", "=", "arg_5", ".", "max_tries", "arg_0", ".", "hostname", "=", "arg_5", ".", "hostname", "arg_0", ".", "pid", "=", "arg_5", ".", "pid", "arg_0", ".", "executor_config", "=", "arg_5", ".", "executor_config", "else", ":", "arg_0", ".", "state", "=", "None"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"\n        Refreshes the task instance from the database based on the primary key\n\n        :param lock_for_update: if True, indicates that the database should\n            lock the TaskInstance (issuing a FOR UPDATE clause) until the\n            session is committed.\n        \"\"\"\n        arg_3 = TaskInstance\n\n        arg_4 = arg_1.query(arg_3).filter(\n            arg_3.dag_id == arg_0.dag_id,\n            arg_3.task_id == arg_0.task_id,\n            arg_3.execution_date == arg_0.execution_date)\n\n        if arg_2:\n            arg_5 = arg_4.with_for_update().first()\n        else:\n            arg_5 = arg_4.first()\n        if arg_5:\n            arg_0.state = arg_5.state\n            arg_0.start_date = arg_5.start_date\n            arg_0.end_date = arg_5.end_date\n            # Get the raw value of try_number column, don't read through the\n            # accessor here otherwise it will be incremeneted by one already.\n            arg_0.try_number = arg_5._try_number\n            arg_0.max_tries = arg_5.max_tries\n            arg_0.hostname = arg_5.hostname\n            arg_0.pid = arg_5.pid\n            arg_0.executor_config = arg_5.executor_config\n        else:\n            arg_0.state = None", "path": "airflow/models/taskinstance.py", "identifier": "TaskInstance.refresh_from_db", "docstring": "Refreshes the task instance from the database based on the primary key\n\n        :param lock_for_update: if True, indicates that the database should\n            lock the TaskInstance (issuing a FOR UPDATE clause) until the\n            session is committed.", "docstring_tokens": ["Refreshes", "the", "task", "instance", "from", "the", "database", "based", "on", "the", "primary", "key"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 257945}
{"url": "https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L134-L155", "sha": "0334545885445834307c075a445fba9fe6f0c9e7", "docstring_summary": "Use ``\\\\r`` to overdraw the current line with the given text.", "language": "python", "parameters": "(self, text, newline=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_0", ".", "isatty", ":", "arg_0", ".", "fobj", ".", "Func", "(", "'%s\\n'", "%", "arg_1", ")", "return", "arg_3", "=", "len", "(", "arg_1", ")", "arg_0", ".", "max_len", "=", "max", "(", "arg_0", ".", "max_len", ",", "arg_3", ")", "arg_0", ".", "fobj", ".", "Func", "(", "\"\\r%-*s\"", "%", "(", "arg_0", ".", "max_len", ",", "arg_1", ")", ")", "if", "arg_2", "or", "not", "arg_0", ".", "isatty", ":", "arg_0", ".", "fobj", ".", "Func", "(", "'\\n'", ")", "arg_0", ".", "max_len", "=", "0"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Use ``\\\\r`` to overdraw the current line with the given text.\n\n        This function transparently handles tracking how much overdrawing is\n        necessary to erase the previous line when used consistently.\n\n        :param text: The text to be outputted\n        :param newline: Whether to start a new line and reset the length count.\n        :type text: :class:`~__builtins__.str`\n        :type newline: :class:`~__builtins__.bool`\n        \"\"\"\n        if not arg_0.isatty:\n            arg_0.fobj.Func('%s\\n' % arg_1)\n            return\n\n        arg_3 = len(arg_1)\n        arg_0.max_len = max(arg_0.max_len, arg_3)\n\n        arg_0.fobj.Func(\"\\r%-*s\" % (arg_0.max_len, arg_1))\n        if arg_2 or not arg_0.isatty:\n            arg_0.fobj.Func('\\n')\n            arg_0.max_len = 0", "path": "fastdupes.py", "identifier": "OverWriter.write", "docstring": "Use ``\\\\r`` to overdraw the current line with the given text.\n\n        This function transparently handles tracking how much overdrawing is\n        necessary to erase the previous line when used consistently.\n\n        :param text: The text to be outputted\n        :param newline: Whether to start a new line and reset the length count.\n        :type text: :class:`~__builtins__.str`\n        :type newline: :class:`~__builtins__.bool`", "docstring_tokens": ["Use", "\\\\", "r", "to", "overdraw", "the", "current", "line", "with", "the", "given", "text", "."], "nwo": "ssokolow/fastdupes", "score": 0.4039778193346996, "idx": 257946}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/feedforward.py#L376-L391", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Compute a greedy classification for the given set of data.", "language": "python", "parameters": "(self, x, **kwargs)", "return_statement": "return outputs[self.layers[-1].output_name].argmax(axis=-1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "feed_forward", "(", "arg_1", ",", "**", "arg_2", ")", "return", "arg_3", "[", "arg_0", ".", "layers", "[", "-", "1", "]", ".", "output_name", "]", ".", "argmax", "(", "axis", "=", "-", "1", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        '''Compute a greedy classification for the given set of data.\n\n        Parameters\n        ----------\n        x : ndarray (num-examples, num-variables)\n            An array containing examples to classify. Examples are given as the\n            rows in this array.\n\n        Returns\n        -------\n        k : ndarray (num-examples, )\n            A vector of class index values, one per row of input data.\n        '''\n        arg_3 = arg_0.feed_forward(arg_1, **arg_2)\n        return arg_3[arg_0.layers[-1].output_name].argmax(axis=-1)", "path": "theanets/feedforward.py", "identifier": "Classifier.predict", "docstring": "Compute a greedy classification for the given set of data.\n\n        Parameters\n        ----------\n        x : ndarray (num-examples, num-variables)\n            An array containing examples to classify. Examples are given as the\n            rows in this array.\n\n        Returns\n        -------\n        k : ndarray (num-examples, )\n            A vector of class index values, one per row of input data.", "docstring_tokens": ["Compute", "a", "greedy", "classification", "for", "the", "given", "set", "of", "data", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 257947}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/message.py#L121-L131", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Tells if this message is a text message.", "language": "python", "parameters": "(self)", "return_statement": "return self.type in [\n            self._TYPE_PASTE,\n            self._TYPE_TEXT,\n            self._TYPE_TWEET\n        ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "type", "in", "[", "arg_0", ".", "_TYPE_PASTE", ",", "arg_0", ".", "_TYPE_TEXT", ",", "arg_0", ".", "_TYPE_TWEET", "]"], "function": "def Func(arg_0):\n        \"\"\" Tells if this message is a text message.\n\n        Returns:\n            bool. Success\n        \"\"\"\n        return arg_0.type in [\n            arg_0._TYPE_PASTE,\n            arg_0._TYPE_TEXT,\n            arg_0._TYPE_TWEET\n        ]", "path": "pyfire/message.py", "identifier": "Message.is_text", "docstring": "Tells if this message is a text message.\n\n        Returns:\n            bool. Success", "docstring_tokens": ["Tells", "if", "this", "message", "is", "a", "text", "message", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 257948}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/fastqc_report.py#L409-L517", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Checks the health of a sample from the FastQC summary file.", "language": "python", "parameters": "(summary_file, **kwargs)", "return_statement": "return health, failed, warning", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "\"fail_sensitive\"", ",", "[", "\"Per base sequence quality\"", ",", "\"Overrepresented sequences\"", ",", "\"Sequence Length Distribution\"", ",", "\"Per sequence GC content\"", "]", ")", "logger", ".", "debug", "(", "\"Fail sensitive categories: {}\"", ".", "format", "(", "arg_2", ")", ")", "arg_3", "=", "arg_1", ".", "get", "(", "\"must_pass\"", ",", "[", "\"Per base N content\"", ",", "\"Adapter Content\"", "]", ")", "logger", ".", "debug", "(", "\"Must pass categories: {}\"", ".", "format", "(", "arg_3", ")", ")", "arg_4", "=", "arg_1", ".", "get", "(", "\"warning_fail_sensitive\"", ",", "[", "\"Per base sequence quality\"", ",", "\"Overrepresented sequences\"", ",", "]", ")", "arg_5", "=", "arg_1", ".", "get", "(", "\"warning_must_pass\"", ",", "[", "\"Per base sequence content\"", "]", ")", "arg_6", "=", "get_summary", "(", "arg_0", ")", "arg_7", "=", "True", "arg_8", "=", "[", "]", "arg_9", "=", "[", "]", "for", "arg_10", ",", "arg_11", "in", "arg_6", ".", "items", "(", ")", ":", "logger", ".", "debug", "(", "\"Assessing category {} with result {}\"", ".", "format", "(", "arg_10", ",", "arg_11", ")", ")", "if", "arg_10", "in", "arg_2", "and", "arg_11", "==", "\"FAIL\"", ":", "arg_7", "=", "False", "arg_8", ".", "append", "(", "\"{}:{}\"", ".", "format", "(", "arg_10", ",", "arg_11", ")", ")", "logger", ".", "error", "(", "\"Category {} failed a fail sensitive \"", "\"category\"", ".", "format", "(", "arg_10", ")", ")", "if", "arg_10", "in", "arg_3", "and", "arg_11", "!=", "\"PASS\"", ":", "arg_7", "=", "False", "arg_8", ".", "append", "(", "\"{}:{}\"", ".", "format", "(", "arg_10", ",", "arg_11", ")", ")", "logger", ".", "error", "(", "\"Category {} failed a must pass category\"", ".", "format", "(", "arg_10", ")", ")", "if", "arg_10", "in", "arg_4", "and", "arg_11", "==", "\"FAIL\"", ":", "arg_9", ".", "append", "(", "\"Failed category: {}\"", ".", "format", "(", "arg_10", ")", ")", "logger", ".", "warning", "(", "\"Category {} flagged at a fail sensitive \"", "\"category\"", ".", "format", "(", "arg_10", ")", ")", "if", "arg_10", "in", "arg_5", "and", "arg_11", "!=", "\"PASS\"", ":", "arg_9", ".", "append", "(", "\"Did not pass category: {}\"", ".", "format", "(", "arg_10", ")", ")", "logger", ".", "warning", "(", "\"Category {} flagged at a must pass \"", "\"category\"", ".", "format", "(", "arg_10", ")", ")", "return", "arg_7", ",", "arg_8", ",", "arg_9"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Checks the health of a sample from the FastQC summary file.\n\n    Parses the FastQC summary file and tests whether the sample is good\n    or not. There are four categories that cannot fail, and two that\n    must pass in order for the sample pass this check. If the sample fails\n    the quality checks, a list with the failing categories is also returned.\n\n    Categories that cannot fail::\n\n        fail_sensitive = [\n            \"Per base sequence quality\",\n            \"Overrepresented sequences\",\n            \"Sequence Length Distribution\",\n            \"Per sequence GC content\"\n        ]\n\n    Categories that must pass::\n\n        must_pass = [\n            \"Per base N content\",\n            \"Adapter Content\"\n        ]\n\n    Parameters\n    ----------\n    summary_file: str\n        Path to FastQC summary file.\n\n    Returns\n    -------\n    x : bool\n        Returns ``True`` if the sample passes all tests. ``False`` if not.\n    summary_info : list\n        A list with the FastQC categories that failed the tests. Is empty\n        if the sample passes all tests.\n    \"\"\"\n\n    # Store the summary categories that cannot fail. If they fail, do not\n    # proceed with this sample\n    arg_2 = arg_1.get(\"fail_sensitive\", [\n        \"Per base sequence quality\",\n        \"Overrepresented sequences\",\n        \"Sequence Length Distribution\",\n        \"Per sequence GC content\"\n    ])\n    logger.debug(\"Fail sensitive categories: {}\".format(arg_2))\n\n    # Store summary categories that must pass. If they do not, do not proceed\n    # with that sample\n    arg_3 = arg_1.get(\"must_pass\", [\n        \"Per base N content\",\n        \"Adapter Content\"\n    ])\n    logger.debug(\"Must pass categories: {}\".format(arg_3))\n\n    arg_4 = arg_1.get(\"warning_fail_sensitive\", [\n        \"Per base sequence quality\",\n        \"Overrepresented sequences\",\n\n    ])\n\n    arg_5 = arg_1.get(\"warning_must_pass\", [\n        \"Per base sequence content\"\n    ])\n\n    # Get summary dictionary\n    arg_6 = get_summary(arg_0)\n\n    # This flag will change to False if one of the tests fails\n    arg_7 = True\n    # List of failing categories\n    arg_8 = []\n    # List of warning categories\n    arg_9 = []\n\n    for arg_10, arg_11 in arg_6.items():\n\n        logger.debug(\"Assessing category {} with result {}\".format(arg_10, arg_11))\n\n        # FAILURES\n        # Check for fail sensitive\n        if arg_10 in arg_2 and arg_11 == \"FAIL\":\n            arg_7 = False\n            arg_8.append(\"{}:{}\".format(arg_10, arg_11))\n            logger.error(\"Category {} failed a fail sensitive \"\n                         \"category\".format(arg_10))\n\n        # Check for must pass\n        if arg_10 in arg_3 and arg_11 != \"PASS\":\n            arg_7 = False\n            arg_8.append(\"{}:{}\".format(arg_10, arg_11))\n            logger.error(\"Category {} failed a must pass category\".format(\n                arg_10))\n\n        # WARNINGS\n        # Check for fail sensitive\n        if arg_10 in arg_4 and arg_11 == \"FAIL\":\n            arg_9.append(\"Failed category: {}\".format(arg_10))\n            logger.warning(\"Category {} flagged at a fail sensitive \"\n                           \"category\".format(arg_10))\n\n        if arg_10 in arg_5 and arg_11 != \"PASS\":\n            arg_9.append(\"Did not pass category: {}\".format(arg_10))\n            logger.warning(\"Category {} flagged at a must pass \"\n                           \"category\".format(arg_10))\n\n    # Passed all tests\n    return arg_7, arg_8, arg_9", "path": "flowcraft/templates/fastqc_report.py", "identifier": "check_summary_health", "docstring": "Checks the health of a sample from the FastQC summary file.\n\n    Parses the FastQC summary file and tests whether the sample is good\n    or not. There are four categories that cannot fail, and two that\n    must pass in order for the sample pass this check. If the sample fails\n    the quality checks, a list with the failing categories is also returned.\n\n    Categories that cannot fail::\n\n        fail_sensitive = [\n            \"Per base sequence quality\",\n            \"Overrepresented sequences\",\n            \"Sequence Length Distribution\",\n            \"Per sequence GC content\"\n        ]\n\n    Categories that must pass::\n\n        must_pass = [\n            \"Per base N content\",\n            \"Adapter Content\"\n        ]\n\n    Parameters\n    ----------\n    summary_file: str\n        Path to FastQC summary file.\n\n    Returns\n    -------\n    x : bool\n        Returns ``True`` if the sample passes all tests. ``False`` if not.\n    summary_info : list\n        A list with the FastQC categories that failed the tests. Is empty\n        if the sample passes all tests.", "docstring_tokens": ["Checks", "the", "health", "of", "a", "sample", "from", "the", "FastQC", "summary", "file", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257949}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L966-L1021", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Calculate correlation filter.", "language": "python", "parameters": "(self, x_analyte, y_analyte, window=15,\n                           r_threshold=0.9, p_threshold=0.05, filt=True, recalc=False)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "15", ",", "arg_4", "=", "0.9", ",", "arg_5", "=", "0.05", ",", "arg_6", "=", "True", ",", "arg_7", "=", "False", ")", ":", "if", "arg_3", "%", "2", "!=", "1", ":", "arg_3", "+=", "1", "arg_8", "=", "locals", "(", ")", "del", "(", "arg_8", "[", "'self'", "]", ")", "arg_9", "=", "arg_0", ".", "filt", ".", "maxset", "+", "1", "arg_10", "=", "'{:}_{:}_{:.0f}'", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_0", ".", "calc_correlation", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_6", ",", "arg_7", ")", "arg_11", ",", "arg_12", "=", "arg_0", ".", "correlations", "[", "arg_10", "]", "arg_13", "=", "(", "abs", "(", "arg_11", ")", ">", "arg_4", ")", "&", "(", "arg_12", "<", "arg_5", ")", "arg_13", "=", "~", "arg_13", "arg_14", "=", "arg_1", "+", "'_'", "+", "arg_2", "+", "'_corr'", "arg_0", ".", "filt", ".", "add", "(", "arg_14", "=", "arg_14", ",", "arg_6", "=", "arg_13", ",", "info", "=", "(", "arg_1", "+", "' vs. '", "+", "arg_2", "+", "' correlation filter.'", ")", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")", "arg_0", ".", "filt", ".", "off", "(", "arg_6", "=", "arg_14", ")", "arg_0", ".", "filt", ".", "on", "(", "analyte", "=", "arg_2", ",", "arg_6", "=", "arg_14", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=15,\n                           arg_4=0.9, arg_5=0.05, arg_6=True, arg_7=False):\n        \"\"\"\n        Calculate correlation filter.\n\n        Parameters\n        ----------\n        x_analyte, y_analyte : str\n            The names of the x and y analytes to correlate.\n        window : int, None\n            The rolling window used when calculating the correlation.\n        r_threshold : float\n            The correlation index above which to exclude data.\n            Note: the absolute pearson R value is considered, so\n            negative correlations below -`r_threshold` will also\n            be excluded.\n        p_threshold : float\n            The significant level below which data are excluded.\n        filt : bool\n            Whether or not to apply existing filters to the data before\n            calculating this filter.\n        recalc : bool\n            If True, the correlation is re-calculated, even if it is already present.\n\n        Returns\n        -------\n        None\n        \"\"\"\n        # make window odd\n        if arg_3 % 2 != 1:\n            arg_3 += 1\n\n        arg_8 = locals()\n        del(arg_8['self'])\n\n        arg_9 = arg_0.filt.maxset + 1\n\n        arg_10 = '{:}_{:}_{:.0f}'.format(arg_1, arg_2, arg_3)\n        \n        arg_0.calc_correlation(arg_1, arg_2, arg_3, arg_6, arg_7)\n        arg_11, arg_12 = arg_0.correlations[arg_10]\n\n        arg_13 = (abs(arg_11) > arg_4) & (arg_12 < arg_5)\n        arg_13 = ~arg_13\n\n        arg_14 = arg_1 + '_' + arg_2 + '_corr'\n\n        arg_0.filt.add(arg_14=arg_14,\n                      arg_6=arg_13,\n                      info=(arg_1 + ' vs. ' + arg_2 +\n                            ' correlation filter.'),\n                      arg_8=arg_8, arg_9=arg_9)\n        arg_0.filt.off(arg_6=arg_14)\n        arg_0.filt.on(analyte=arg_2, arg_6=arg_14)\n\n        return", "path": "latools/D_obj.py", "identifier": "D.filter_correlation", "docstring": "Calculate correlation filter.\n\n        Parameters\n        ----------\n        x_analyte, y_analyte : str\n            The names of the x and y analytes to correlate.\n        window : int, None\n            The rolling window used when calculating the correlation.\n        r_threshold : float\n            The correlation index above which to exclude data.\n            Note: the absolute pearson R value is considered, so\n            negative correlations below -`r_threshold` will also\n            be excluded.\n        p_threshold : float\n            The significant level below which data are excluded.\n        filt : bool\n            Whether or not to apply existing filters to the data before\n            calculating this filter.\n        recalc : bool\n            If True, the correlation is re-calculated, even if it is already present.\n\n        Returns\n        -------\n        None", "docstring_tokens": ["Calculate", "correlation", "filter", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 257950}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/aggregators.py#L10-L17", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "64bit counter aggregator with wrapping", "language": "python", "parameters": "(a, b, delta)", "return_statement": "return (b - a) / float(delta)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "<", "arg_0", ":", "arg_3", "=", "18446744073709551615", "-", "arg_0", "return", "(", "arg_3", "+", "arg_1", ")", "/", "float", "(", "arg_2", ")", "return", "(", "arg_1", "-", "arg_0", ")", "/", "float", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"64bit counter aggregator with wrapping\n    \"\"\"\n    if arg_1 < arg_0:\n        arg_3 = 18446744073709551615 - arg_0\n        return (arg_3 + arg_1) / float(arg_2)\n\n    return (arg_1 - arg_0) / float(arg_2)", "path": "tensor/aggregators.py", "identifier": "Counter64", "docstring": "64bit counter aggregator with wrapping", "docstring_tokens": ["64bit", "counter", "aggregator", "with", "wrapping"], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 257951}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1021-L1032", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Replace the levels of a categorical column.", "language": "python", "parameters": "(self, levels)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"setDomain\", self, False, levels), cache=self._ex._cache)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert_is_type", "(", "arg_1", ",", "[", "str", "]", ")", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"setDomain\"", ",", "arg_0", ",", "False", ",", "arg_1", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Replace the levels of a categorical column.\n\n        New levels must be aligned with the old domain. This call has copy-on-write semantics.\n\n        :param List[str] levels: A list of strings specifying the new levels. The number of new\n            levels must match the number of old levels.\n        :returns: A single-column H2OFrame with the desired levels.\n        \"\"\"\n        assert_is_type(arg_1, [str])\n        return H2OFrame._expr(expr=ExprNode(\"setDomain\", arg_0, False, arg_1), cache=arg_0._ex._cache)", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.set_levels", "docstring": "Replace the levels of a categorical column.\n\n        New levels must be aligned with the old domain. This call has copy-on-write semantics.\n\n        :param List[str] levels: A list of strings specifying the new levels. The number of new\n            levels must match the number of old levels.\n        :returns: A single-column H2OFrame with the desired levels.", "docstring_tokens": ["Replace", "the", "levels", "of", "a", "categorical", "column", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257952}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L416-L452", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Get stop count data.", "language": "python", "parameters": "(self, start_ut, end_ut)", "return_statement": "return all_stop_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_tripIs_active_in_range", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "Counter", "(", ")", "for", "arg_5", "in", "arg_3", ".", "itertuples", "(", ")", ":", "arg_6", "=", "arg_0", ".", "get_trip_stop_time_data", "(", "arg_5", ".", "trip_I", ",", "arg_5", ".", "day_start_ut", ")", "for", "arg_7", "in", "arg_6", ".", "itertuples", "(", "index", "=", "False", ")", ":", "if", "(", "arg_7", ".", "dep_time_ut", ">=", "arg_1", ")", "and", "(", "arg_7", ".", "dep_time_ut", "<=", "arg_2", ")", ":", "arg_4", "[", "arg_7", ".", "stop_I", "]", "+=", "1", "arg_8", "=", "arg_0", ".", "stops", "(", ")", "arg_9", "=", "[", "arg_4", "[", "stop_I", "]", "for", "stop_I", "in", "arg_8", "[", "\"stop_I\"", "]", ".", "values", "]", "arg_8", ".", "loc", "[", ":", ",", "\"count\"", "]", "=", "pd", ".", "Series", "(", "arg_9", ",", "index", "=", "arg_8", ".", "index", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get stop count data.\n\n        Parameters\n        ----------\n        start_ut : int\n            start time in unixtime\n        end_ut : int\n            end time in unixtime\n\n        Returns\n        -------\n        stopData : pandas.DataFrame\n            each row in the stopData dataFrame is a dictionary with the following elements\n                stop_I, count, lat, lon, name\n            with data types\n                (int, int, float, float, str)\n        \"\"\"\n        # TODO! this function could perhaps be made a single sql query now with the new tables?\n        arg_3 = arg_0.get_tripIs_active_in_range(arg_1, arg_2)\n        # stop_I -> count, lat, lon, name\n        arg_4 = Counter()\n\n        # loop over all trips:\n        for arg_5 in arg_3.itertuples():\n            # get stop_data and store it:\n            arg_6 = arg_0.get_trip_stop_time_data(arg_5.trip_I, arg_5.day_start_ut)\n            for arg_7 in arg_6.itertuples(index=False):\n                if (arg_7.dep_time_ut >= arg_1) and (arg_7.dep_time_ut <= arg_2):\n                    arg_4[arg_7.stop_I] += 1\n\n        arg_8 = arg_0.stops()\n        arg_9 = [arg_4[stop_I] for stop_I in arg_8[\"stop_I\"].values]\n\n        arg_8.loc[:, \"count\"] = pd.Series(arg_9, index=arg_8.index)\n        return arg_8", "path": "gtfspy/gtfs.py", "identifier": "GTFS.get_stop_count_data", "docstring": "Get stop count data.\n\n        Parameters\n        ----------\n        start_ut : int\n            start time in unixtime\n        end_ut : int\n            end time in unixtime\n\n        Returns\n        -------\n        stopData : pandas.DataFrame\n            each row in the stopData dataFrame is a dictionary with the following elements\n                stop_I, count, lat, lon, name\n            with data types\n                (int, int, float, float, str)", "docstring_tokens": ["Get", "stop", "count", "data", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 257953}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/request/request_builder.py#L115-L126", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Adds headers to the request", "language": "python", "parameters": "(self, headers)", "return_statement": "return self.__copy_and_set('headers', copy)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "copy", "(", ")", "arg_2", ".", "update", "(", "arg_0", ".", "_headers", ")", "return", "arg_0", ".", "__copy_and_set", "(", "'headers'", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        '''Adds headers to the request\n\n        Args:\n            headers (dict): The headers to add the request headers\n\n        Returns:\n            The request builder instance in order to chain calls\n        '''\n        arg_2 = arg_1.copy()\n        arg_2.update(arg_0._headers)\n        return arg_0.__copy_and_set('headers', arg_2)", "path": "hbp_service_client/request/request_builder.py", "identifier": "RequestBuilder.with_headers", "docstring": "Adds headers to the request\n\n        Args:\n            headers (dict): The headers to add the request headers\n\n        Returns:\n            The request builder instance in order to chain calls", "docstring_tokens": ["Adds", "headers", "to", "the", "request"], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 257954}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/expansion.py#L225-L230", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Adds all of the members of the composite abundances to the graph.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", ":", "arg_2", "=", "list", "(", "get_nodes_by_function", "(", "arg_0", ",", "COMPOSITE", ")", ")", "for", "arg_3", "in", "arg_2", ":", "for", "arg_4", "in", "arg_3", ".", "members", ":", "arg_0", ".", "add_has_component", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0: arg_1):\n    \"\"\"Adds all of the members of the composite abundances to the graph.\"\"\"\n    arg_2 = list(get_nodes_by_function(arg_0, COMPOSITE))\n    for arg_3 in arg_2:\n        for arg_4 in arg_3.members:\n            arg_0.add_has_component(arg_3, arg_4)", "path": "src/pybel_tools/mutation/expansion.py", "identifier": "enrich_composites", "docstring": "Adds all of the members of the composite abundances to the graph.", "docstring_tokens": ["Adds", "all", "of", "the", "members", "of", "the", "composite", "abundances", "to", "the", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 257955}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L229-L238", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Loads the model of the given name.\n        \n        The model will also be inserted into the cache.", "language": "python", "parameters": "(self,name)", "return_statement": "return m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "model", ".", "Model", "(", "arg_0", ".", "peng", ",", "arg_0", ",", "arg_1", ")", "arg_0", ".", "modelobjcache", "[", "arg_1", "]", "=", "arg_2", "arg_0", ".", "peng", ".", "sendEvent", "(", "\"peng3d:rsrc.model.load\"", ",", "{", "\"peng\"", ":", "arg_0", ".", "peng", ",", "\"name\"", ":", "arg_1", "}", ")", "return", "arg_2"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Loads the model of the given name.\n        \n        The model will also be inserted into the cache.\n        \"\"\"\n        arg_2 = model.Model(arg_0.peng,arg_0,arg_1)\n        arg_0.modelobjcache[arg_1]=arg_2\n        arg_0.peng.sendEvent(\"peng3d:rsrc.model.load\",{\"peng\":arg_0.peng,\"name\":arg_1})\n        return arg_2", "path": "peng3d/resource.py", "identifier": "ResourceManager.loadModel", "docstring": "Loads the model of the given name.\n        \n        The model will also be inserted into the cache.", "docstring_tokens": ["Loads", "the", "model", "of", "the", "given", "name", ".", "The", "model", "will", "also", "be", "inserted", "into", "the", "cache", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 257956}
{"url": "https://github.com/rdeits/meshcat-python/blob/aa3865143120f5ace8e62aab71d825e33674d277/src/meshcat/animation.py#L132-L165", "sha": "aa3865143120f5ace8e62aab71d825e33674d277", "docstring_summary": "Try to convert a tar file containing a sequence of frames saved by the\n    meshcat viewer into a single video file.", "language": "python", "parameters": "(tar_file_path, output_path=\"output.mp4\", framerate=60, overwrite=False)", "return_statement": "return output_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"output.mp4\"", ",", "arg_2", "=", "60", ",", "arg_3", "=", "False", ")", ":", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", "and", "not", "arg_3", ":", "raise", "ValueError", "(", "\"The output path {:s} already exists. To overwrite that file, you can pass overwrite=True to this function.\"", ".", "format", "(", "arg_1", ")", ")", "with", "tempfile", ".", "TemporaryDirectory", "(", ")", "as", "tmp_dir", ":", "with", "tarfile", ".", "open", "(", "arg_0", ")", "as", "tar", ":", "tar", ".", "extractall", "(", "tmp_dir", ")", "arg_4", "=", "[", "\"ffmpeg\"", ",", "\"-r\"", ",", "str", "(", "arg_2", ")", ",", "\"-i\"", ",", "r\"%07d.png\"", ",", "\"-vcodec\"", ",", "\"libx264\"", ",", "\"-preset\"", ",", "\"slow\"", ",", "\"-crf\"", ",", "\"18\"", "]", "if", "arg_3", ":", "arg_4", ".", "append", "(", "\"-y\"", ")", "arg_4", ".", "append", "(", "arg_1", ")", "try", ":", "subprocess", ".", "check_call", "(", "arg_4", ",", "cwd", "=", "tmp_dir", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "print", "(", "\"\"\"Could not call `ffmpeg` to convert your frames into a video.If you want to convert the frames manually, you can extract the.tar archive into a directory, cd to that directory, and run:ffmpeg -r 60 -i %07d.png \\\\\\n\\t -vcodec libx264 \\\\\\n\\t -preset slow \\\\\\n\\t -crf 18 \\\\\\n\\t output.mp4                \"\"\"", ")", "raise", "print", "(", "\"Saved output as {:s}\"", ".", "format", "(", "arg_1", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=\"output.mp4\", arg_2=60, arg_3=False):\n    \"\"\"\n    Try to convert a tar file containing a sequence of frames saved by the\n    meshcat viewer into a single video file.\n\n    This relies on having `ffmpeg` installed on your system.\n    \"\"\"\n    arg_1 = os.path.abspath(arg_1)\n    if os.path.isfile(arg_1) and not arg_3:\n        raise ValueError(\"The output path {:s} already exists. To overwrite that file, you can pass overwrite=True to this function.\".format(arg_1))\n    with tempfile.TemporaryDirectory() as tmp_dir:\n        with tarfile.open(arg_0) as tar:\n            tar.extractall(tmp_dir)\n        arg_4 = [\"ffmpeg\",\n                \"-r\", str(arg_2),\n                \"-i\", r\"%07d.png\",\n                \"-vcodec\", \"libx264\",\n                \"-preset\", \"slow\",\n                \"-crf\", \"18\"]\n        if arg_3:\n            arg_4.append(\"-y\")\n        arg_4.append(arg_1)\n        try:\n            subprocess.check_call(arg_4, cwd=tmp_dir)\n        except subprocess.CalledProcessError as e:\n            print(\"\"\"\nCould not call `ffmpeg` to convert your frames into a video.\nIf you want to convert the frames manually, you can extract the\n.tar archive into a directory, cd to that directory, and run:\nffmpeg -r 60 -i %07d.png \\\\\\n\\t -vcodec libx264 \\\\\\n\\t -preset slow \\\\\\n\\t -crf 18 \\\\\\n\\t output.mp4\n                \"\"\")\n            raise\n    print(\"Saved output as {:s}\".format(arg_1))\n    return arg_1", "path": "src/meshcat/animation.py", "identifier": "convert_frames_to_video", "docstring": "Try to convert a tar file containing a sequence of frames saved by the\n    meshcat viewer into a single video file.\n\n    This relies on having `ffmpeg` installed on your system.", "docstring_tokens": ["Try", "to", "convert", "a", "tar", "file", "containing", "a", "sequence", "of", "frames", "saved", "by", "the", "meshcat", "viewer", "into", "a", "single", "video", "file", "."], "nwo": "rdeits/meshcat-python", "score": 0.5458072098022347, "idx": 257957}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/check.py#L76-L91", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return the shape of img.", "language": "python", "parameters": "(img)", "return_statement": "return shape", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'shape'", ")", ":", "arg_1", "=", "arg_0", ".", "shape", "else", ":", "arg_1", "=", "arg_0", ".", "get_data", "(", ")", ".", "shape", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return the shape of img.\n\n    Paramerers\n    -----------\n    img:\n\n    Returns\n    -------\n    shape: tuple\n    \"\"\"\n    if hasattr(arg_0, 'shape'):\n        arg_1 = arg_0.shape\n    else:\n        arg_1 = arg_0.get_data().shape\n    return arg_1", "path": "boyle/nifti/check.py", "identifier": "get_shape", "docstring": "Return the shape of img.\n\n    Paramerers\n    -----------\n    img:\n\n    Returns\n    -------\n    shape: tuple", "docstring_tokens": ["Return", "the", "shape", "of", "img", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 257958}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/dflow.py#L859-L940", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Checkpoint the dfk incrementally to a checkpoint file.", "language": "python", "parameters": "(self, tasks=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "with", "arg_0", ".", "Func_lock", ":", "arg_2", "=", "None", "if", "arg_1", ":", "arg_2", "=", "arg_1", "else", ":", "arg_2", "=", "arg_0", ".", "tasks", "arg_3", "=", "'{0}/Func'", ".", "format", "(", "arg_0", ".", "run_dir", ")", "arg_4", "=", "arg_3", "+", "'/dfk.pkl'", "arg_5", "=", "arg_3", "+", "'/tasks.pkl'", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "try", ":", "os", ".", "makedirs", "(", "arg_3", ")", "except", "FileExistsError", ":", "pass", "with", "open", "(", "arg_4", ",", "'wb'", ")", "as", "f", ":", "arg_6", "=", "{", "'rundir'", ":", "arg_0", ".", "run_dir", ",", "'task_count'", ":", "arg_0", ".", "task_count", "}", "pickle", ".", "dump", "(", "arg_6", ",", "f", ")", "arg_7", "=", "0", "with", "open", "(", "arg_5", ",", "'ab'", ")", "as", "f", ":", "for", "arg_8", "in", "arg_2", ":", "if", "not", "arg_0", ".", "tasks", "[", "arg_8", "]", "[", "'Func'", "]", "and", "arg_0", ".", "tasks", "[", "arg_8", "]", "[", "'app_fu'", "]", ".", "done", "(", ")", "and", "arg_0", ".", "tasks", "[", "arg_8", "]", "[", "'app_fu'", "]", ".", "exception", "(", ")", "is", "None", ":", "arg_9", "=", "arg_0", ".", "tasks", "[", "arg_8", "]", "[", "'hashsum'", "]", "if", "not", "arg_9", ":", "continue", "arg_10", "=", "{", "'hash'", ":", "arg_9", ",", "'exception'", ":", "None", ",", "'result'", ":", "None", "}", "try", ":", "arg_11", "=", "arg_0", ".", "memoizer", ".", "hash_lookup", "(", "arg_9", ")", ".", "result", "(", ")", "except", "Exception", "as", "e", ":", "arg_10", "[", "'exception'", "]", "=", "e", "else", ":", "arg_10", "[", "'result'", "]", "=", "arg_11", "pickle", ".", "dump", "(", "arg_10", ",", "f", ")", "arg_7", "+=", "1", "arg_0", ".", "tasks", "[", "arg_8", "]", "[", "'Func'", "]", "=", "True", "logger", ".", "debug", "(", "\"Task {} Funced\"", ".", "format", "(", "arg_8", ")", ")", "arg_0", ".", "Funced_tasks", "+=", "arg_7", "if", "arg_7", "==", "0", ":", "if", "arg_0", ".", "Funced_tasks", "==", "0", ":", "logger", ".", "warn", "(", "\"No tasks Funced so far in this run. Please ensure caching is enabled\"", ")", "else", ":", "logger", ".", "debug", "(", "\"No tasks Funced in this pass.\"", ")", "else", ":", "logger", ".", "info", "(", "\"Done Funcing {} tasks\"", ".", "format", "(", "arg_7", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Checkpoint the dfk incrementally to a Func file.\n\n        When called, every task that has been completed yet not\n        Funced is Funced to a file.\n\n        Kwargs:\n            - tasks (List of task ids) : List of task ids to Func. Default=None\n                                         if set to None, we iterate over all tasks held by the DFK.\n\n        .. note::\n            Checkpointing only works if memoization is enabled\n\n        Returns:\n            Checkpoint dir if Funcs were written successfully.\n            By default the Funcs are written to the RUNDIR of the current\n            run under RUNDIR/Funcs/{tasks.pkl, dfk.pkl}\n        \"\"\"\n        with arg_0.Func_lock:\n            arg_2 = None\n            if arg_1:\n                arg_2 = arg_1\n            else:\n                arg_2 = arg_0.tasks\n\n            arg_3 = '{0}/Func'.format(arg_0.run_dir)\n            arg_4 = arg_3 + '/dfk.pkl'\n            arg_5 = arg_3 + '/tasks.pkl'\n\n            if not os.path.exists(arg_3):\n                try:\n                    os.makedirs(arg_3)\n                except FileExistsError:\n                    pass\n\n            with open(arg_4, 'wb') as f:\n                arg_6 = {'rundir': arg_0.run_dir,\n                         'task_count': arg_0.task_count\n                         }\n                pickle.dump(arg_6, f)\n\n            arg_7 = 0\n\n            with open(arg_5, 'ab') as f:\n                for arg_8 in arg_2:\n                    if not arg_0.tasks[arg_8]['Func'] and \\\n                       arg_0.tasks[arg_8]['app_fu'].done() and \\\n                       arg_0.tasks[arg_8]['app_fu'].exception() is None:\n                        arg_9 = arg_0.tasks[arg_8]['hashsum']\n                        if not arg_9:\n                            continue\n                        arg_10 = {'hash': arg_9,\n                             'exception': None,\n                             'result': None}\n                        try:\n                            # Asking for the result will raise an exception if\n                            # the app had failed. Should we even Func these?\n                            # TODO : Resolve this question ?\n                            arg_11 = arg_0.memoizer.hash_lookup(arg_9).result()\n                        except Exception as e:\n                            arg_10['exception'] = e\n                        else:\n                            arg_10['result'] = arg_11\n\n                        # We are using pickle here since pickle dumps to a file in 'ab'\n                        # mode behave like a incremental log.\n                        pickle.dump(arg_10, f)\n                        arg_7 += 1\n                        arg_0.tasks[arg_8]['Func'] = True\n                        logger.debug(\"Task {} Funced\".format(arg_8))\n\n            arg_0.Funced_tasks += arg_7\n\n            if arg_7 == 0:\n                if arg_0.Funced_tasks == 0:\n                    logger.warn(\"No tasks Funced so far in this run. Please ensure caching is enabled\")\n                else:\n                    logger.debug(\"No tasks Funced in this pass.\")\n            else:\n                logger.info(\"Done Funcing {} tasks\".format(arg_7))\n\n            return arg_3", "path": "parsl/dataflow/dflow.py", "identifier": "DataFlowKernel.checkpoint", "docstring": "Checkpoint the dfk incrementally to a checkpoint file.\n\n        When called, every task that has been completed yet not\n        checkpointed is checkpointed to a file.\n\n        Kwargs:\n            - tasks (List of task ids) : List of task ids to checkpoint. Default=None\n                                         if set to None, we iterate over all tasks held by the DFK.\n\n        .. note::\n            Checkpointing only works if memoization is enabled\n\n        Returns:\n            Checkpoint dir if checkpoints were written successfully.\n            By default the checkpoints are written to the RUNDIR of the current\n            run under RUNDIR/checkpoints/{tasks.pkl, dfk.pkl}", "docstring_tokens": ["Checkpoint", "the", "dfk", "incrementally", "to", "a", "checkpoint", "file", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 257959}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/vcard.py#L1493-L1530", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Parse single RFC2425 record and update attributes of `self`.", "language": "python", "parameters": "(self,data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_1", ".", "split", "(", "\":\"", ",", "1", ")", "arg_3", "=", "arg_3", ".", "replace", "(", "\"\\\\n\"", ",", "\"\\n\"", ")", ".", "replace", "(", "\"\\\\N\"", ",", "\"\\n\"", ")", "arg_4", "=", "arg_2", ".", "lower", "(", ")", ".", "split", "(", "\";\"", ")", "arg_5", "=", "arg_4", "[", "0", "]", "arg_6", "=", "arg_4", "[", "1", ":", "]", "if", "u\".\"", "in", "arg_5", ":", "arg_5", "=", "arg_5", ".", "split", "(", "\".\"", ",", "1", ")", "[", "1", "]", "arg_5", "=", "arg_5", ".", "upper", "(", ")", "if", "arg_5", "in", "(", "u\"X-DESC\"", ",", "u\"X-JABBERID\"", ")", ":", "arg_5", "=", "arg_5", "[", "2", ":", "]", "if", "not", "arg_0", ".", "components", ".", "has_key", "(", "arg_5", ")", ":", "return", "if", "arg_6", ":", "arg_6", "=", "dict", "(", "[", "p", ".", "split", "(", "\"=\"", ",", "1", ")", "for", "p", "in", "arg_6", "]", ")", "arg_7", ",", "arg_8", "=", "arg_0", ".", "components", "[", "arg_5", "]", "if", "arg_8", "in", "(", "\"required\"", ",", "\"optional\"", ")", ":", "if", "arg_0", ".", "content", ".", "has_key", "(", "arg_5", ")", ":", "raise", "ValueError", "(", "\"Duplicate %s\"", "%", "(", "arg_5", ",", ")", ")", "try", ":", "arg_0", ".", "content", "[", "arg_5", "]", "=", "arg_7", "(", "arg_5", ",", "arg_3", ",", "arg_6", ")", "except", "Empty", ":", "pass", "elif", "arg_8", "==", "\"multi\"", ":", "if", "not", "arg_0", ".", "content", ".", "has_key", "(", "arg_5", ")", ":", "arg_0", ".", "content", "[", "arg_5", "]", "=", "[", "]", "try", ":", "arg_0", ".", "content", "[", "arg_5", "]", ".", "append", "(", "arg_7", "(", "arg_5", ",", "arg_3", ",", "arg_6", ")", ")", "except", "Empty", ":", "pass", "else", ":", "return"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Parse single RFC2425 record and update attributes of `self`.\n\n        :Parameters:\n            - `data`: the record (probably multiline)\n        :Types:\n            - `data`: `unicode`\"\"\"\n        arg_2,arg_3=arg_1.split(\":\",1)\n        arg_3=arg_3.replace(\"\\\\n\",\"\\n\").replace(\"\\\\N\",\"\\n\")\n        arg_4=arg_2.lower().split(\";\")\n        arg_5=arg_4[0]\n        arg_6=arg_4[1:]\n        if u\".\" in arg_5:\n            arg_5=arg_5.split(\".\",1)[1]\n        arg_5=arg_5.upper()\n        if arg_5 in (u\"X-DESC\",u\"X-JABBERID\"):\n            arg_5=arg_5[2:]\n        if not arg_0.components.has_key(arg_5):\n            return\n        if arg_6:\n            arg_6=dict([p.split(\"=\",1) for p in arg_6])\n        arg_7,arg_8=arg_0.components[arg_5]\n        if arg_8 in (\"required\",\"optional\"):\n            if arg_0.content.has_key(arg_5):\n                raise ValueError(\"Duplicate %s\" % (arg_5,))\n            try:\n                arg_0.content[arg_5]=arg_7(arg_5,arg_3,arg_6)\n            except Empty:\n                pass\n        elif arg_8==\"multi\":\n            if not arg_0.content.has_key(arg_5):\n                arg_0.content[arg_5]=[]\n            try:\n                arg_0.content[arg_5].append(arg_7(arg_5,arg_3,arg_6))\n            except Empty:\n                pass\n        else:\n            return", "path": "pyxmpp2/ext/vcard.py", "identifier": "VCard._process_rfc2425_record", "docstring": "Parse single RFC2425 record and update attributes of `self`.\n\n        :Parameters:\n            - `data`: the record (probably multiline)\n        :Types:\n            - `data`: `unicode`", "docstring_tokens": ["Parse", "single", "RFC2425", "record", "and", "update", "attributes", "of", "self", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 257960}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/standard/cu1.py#L55-L57", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Apply cu1 from ctl to tgt with angle theta.", "language": "python", "parameters": "(self, theta, ctl, tgt)", "return_statement": "return self.append(Cu1Gate(theta), [ctl, tgt], [])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "arg_0", ".", "append", "(", "Cu1Gate", "(", "arg_1", ")", ",", "[", "arg_2", ",", "arg_3", "]", ",", "[", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Apply Func from ctl to tgt with angle theta.\"\"\"\n    return arg_0.append(Cu1Gate(arg_1), [arg_2, arg_3], [])", "path": "qiskit/extensions/standard/cu1.py", "identifier": "cu1", "docstring": "Apply cu1 from ctl to tgt with angle theta.", "docstring_tokens": ["Apply", "cu1", "from", "ctl", "to", "tgt", "with", "angle", "theta", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 257961}
{"url": "https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L99-L102", "sha": "5729c2525a8c04c185e998bd9a86233708972921", "docstring_summary": "Register passed `processor` for passed `mimetype`.", "language": "python", "parameters": "(self, mimetype, processor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "not", "in", "arg_0", "or", "arg_2", "not", "in", "arg_0", "[", "arg_1", "]", ":", "arg_0", ".", "setdefault", "(", "arg_1", ",", "[", "]", ")", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Register passed `processor` for passed `mimetype`.\"\"\"\n        if arg_1 not in arg_0 or arg_2 not in arg_0[arg_1]:\n            arg_0.setdefault(arg_1, []).append(arg_2)", "path": "gears/environment.py", "identifier": "Processors.register", "docstring": "Register passed `processor` for passed `mimetype`.", "docstring_tokens": ["Register", "passed", "processor", "for", "passed", "mimetype", "."], "nwo": "gears/gears", "score": 0.18657722465184873, "idx": 257962}
{"url": "https://github.com/philipsoutham/py-mysql2pgsql/blob/66dc2a3a3119263b3fe77300fb636346509787ef/mysql2pgsql/lib/postgres_db_writer.py#L183-L193", "sha": "66dc2a3a3119263b3fe77300fb636346509787ef", "docstring_summary": "Send DDL to create the specified `table` constraints", "language": "python", "parameters": "(self, table)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "super", "(", "PostgresDbWriter", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "for", "arg_3", "in", "arg_2", ":", "arg_0", ".", "execute", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Send DDL to create the specified `table` constraints\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None\n        \"\"\"\n        arg_2 = super(PostgresDbWriter, arg_0).Func(arg_1)\n        for arg_3 in arg_2:\n            arg_0.execute(arg_3)", "path": "mysql2pgsql/lib/postgres_db_writer.py", "identifier": "PostgresDbWriter.write_constraints", "docstring": "Send DDL to create the specified `table` constraints\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None", "docstring_tokens": ["Send", "DDL", "to", "create", "the", "specified", "table", "constraints"], "nwo": "philipsoutham/py-mysql2pgsql", "score": 0.632634572866938, "idx": 257963}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/export/gene.py#L19-L38", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Export all genes from a build", "language": "python", "parameters": "(context, build, json)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "LOG", ".", "info", "(", "\"Running scout export Func\"", ")", "arg_3", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_4", "=", "arg_3", ".", "all_Func", "(", "arg_1", "=", "arg_1", ")", "if", "arg_2", ":", "click", ".", "echo", "(", "dumps", "(", "arg_4", ")", ")", "return", "arg_5", "=", "(", "\"{0}\\t{1}\\t{2}\\t{3}\\t{4}\"", ")", "click", ".", "echo", "(", "\"#Chromosom\\tStart\\tEnd\\tHgnc_id\\tHgnc_symbol\"", ")", "for", "arg_6", "in", "arg_4", ":", "click", ".", "echo", "(", "arg_5", ".", "format", "(", "arg_6", "[", "'chromosome'", "]", ",", "arg_6", "[", "'start'", "]", ",", "arg_6", "[", "'end'", "]", ",", "arg_6", "[", "'hgnc_id'", "]", ",", "arg_6", "[", "'hgnc_symbol'", "]", ",", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Export all Func from a build\"\"\"\n    LOG.info(\"Running scout export Func\")\n    arg_3 = arg_0.obj['adapter']\n\n    arg_4 = arg_3.all_Func(arg_1=arg_1)\n    if arg_2:\n        click.echo(dumps(arg_4))\n        return\n        \n    arg_5 = (\"{0}\\t{1}\\t{2}\\t{3}\\t{4}\")\n    click.echo(\"#Chromosom\\tStart\\tEnd\\tHgnc_id\\tHgnc_symbol\")\n    for arg_6 in arg_4:\n        click.echo(arg_5.format(\n            arg_6['chromosome'],\n            arg_6['start'],\n            arg_6['end'],\n            arg_6['hgnc_id'],\n            arg_6['hgnc_symbol'],\n        ))", "path": "scout/commands/export/gene.py", "identifier": "genes", "docstring": "Export all genes from a build", "docstring_tokens": ["Export", "all", "genes", "from", "a", "build"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 257964}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L458-L473", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Generate a safe and closed filepath.", "language": "python", "parameters": "(prefix=\"tmp_\",\n                       suffix=\"\",\n                       directory=None)", "return_statement": "return filepath", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"tmp_\"", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "None", ")", ":", "try", ":", "arg_3", ",", "arg_4", "=", "mkstemp", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "dir", "=", "arg_2", ")", "os", ".", "close", "(", "arg_3", ")", "except", "IOError", ",", "e", ":", "try", ":", "os", ".", "remove", "(", "arg_4", ")", "except", "Exception", ":", "pass", "raise", "e", "return", "arg_4"], "function": "def Func(arg_0=\"tmp_\",\n                       arg_1=\"\",\n                       arg_2=None):\n    \"\"\"Generate a safe and closed filepath.\"\"\"\n    try:\n        arg_3, arg_4 = mkstemp(arg_0=arg_0,\n                                    arg_1=arg_1,\n                                    dir=arg_2)\n        os.close(arg_3)\n    except IOError, e:\n        try:\n            os.remove(arg_4)\n        except Exception:\n            pass\n        raise e\n    return arg_4", "path": "harvestingkit/utils.py", "identifier": "get_temporary_file", "docstring": "Generate a safe and closed filepath.", "docstring_tokens": ["Generate", "a", "safe", "and", "closed", "filepath", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 257965}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L1049-L1087", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Displays the default pipeline inspection overview", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "True", "arg_0", ".", "screen", "=", "curses", ".", "initscr", "(", ")", "arg_0", ".", "screen", ".", "keypad", "(", "True", ")", "arg_0", ".", "screen", ".", "nodelay", "(", "-", "1", ")", "curses", ".", "cbreak", "(", ")", "curses", ".", "noecho", "(", ")", "curses", ".", "start_color", "(", ")", "arg_0", ".", "screen_lines", "=", "arg_0", ".", "screen", ".", "getmaxyx", "(", ")", "[", "0", "]", "try", ":", "while", "arg_1", ":", "arg_0", ".", "_curses_keybindings", "(", ")", "arg_0", ".", "update_inspection", "(", ")", "arg_0", ".", "flush_overview", "(", ")", "sleep", "(", "arg_0", ".", "refresh_rate", ")", "except", "FileNotFoundError", ":", "sys", ".", "stderr", ".", "write", "(", "colored_print", "(", "\"ERROR: nextflow log and/or trace files are no longer \"", "\"reachable!\"", ",", "\"red_bold\"", ")", ")", "except", "Exception", "as", "e", ":", "sys", ".", "stderr", ".", "write", "(", "str", "(", "e", ")", ")", "finally", ":", "curses", ".", "nocbreak", "(", ")", "arg_0", ".", "screen", ".", "keypad", "(", "0", ")", "curses", ".", "echo", "(", ")", "curses", ".", "endwin", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Displays the default pipeline inspection overview\n        \"\"\"\n\n        arg_1 = True\n\n        arg_0.screen = curses.initscr()\n\n        arg_0.screen.keypad(True)\n        arg_0.screen.nodelay(-1)\n        curses.cbreak()\n        curses.noecho()\n        curses.start_color()\n\n        arg_0.screen_lines = arg_0.screen.getmaxyx()[0]\n        # self.screen_width = self.screen.getmaxyx()[1]\n\n        try:\n            while arg_1:\n\n                # Provide functionality to certain keybindings\n                arg_0._curses_keybindings()\n                # Updates main inspector attributes\n                arg_0.update_inspection()\n                # Display curses interface\n                arg_0.flush_overview()\n\n                sleep(arg_0.refresh_rate)\n        except FileNotFoundError:\n            sys.stderr.write(colored_print(\n                \"ERROR: nextflow log and/or trace files are no longer \"\n                \"reachable!\", \"red_bold\"))\n        except Exception as e:\n            sys.stderr.write(str(e))\n        finally:\n            curses.nocbreak()\n            arg_0.screen.keypad(0)\n            curses.echo()\n            curses.endwin()", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector.display_overview", "docstring": "Displays the default pipeline inspection overview", "docstring_tokens": ["Displays", "the", "default", "pipeline", "inspection", "overview"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 257966}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/ecommerce.py#L47-L67", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get course mode's SKU discounted price after applying any entitlement available for this user.", "language": "python", "parameters": "(self, mode, currency='$', enterprise_catalog_uuid=None)", "return_statement": "return mode['original_price']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'$'", ",", "arg_3", "=", "None", ")", ":", "try", ":", "arg_4", "=", "arg_0", ".", "client", ".", "baskets", ".", "calculate", ".", "get", "(", "sku", "=", "[", "arg_1", "[", "'sku'", "]", "]", ",", "username", "=", "arg_0", ".", "user", ".", "username", ",", "catalog", "=", "arg_3", ",", ")", "except", "(", "SlumberBaseException", ",", "ConnectionError", ",", "Timeout", ")", "as", "exc", ":", "LOGGER", ".", "exception", "(", "'Failed to get price details for sku %s due to: %s'", ",", "arg_1", "[", "'sku'", "]", ",", "str", "(", "exc", ")", ")", "arg_4", "=", "{", "}", "arg_5", "=", "arg_4", ".", "get", "(", "'total_incl_tax'", ",", "arg_1", "[", "'min_price'", "]", ")", "if", "arg_5", "!=", "arg_1", "[", "'min_price'", "]", ":", "return", "format_price", "(", "arg_5", ",", "arg_2", ")", "return", "arg_1", "[", "'original_price'", "]"], "function": "def Func(arg_0, arg_1, arg_2='$', arg_3=None):\n        \"\"\"\n        Get course mode's SKU discounted price after applying any entitlement available for this user.\n\n        Returns:\n            str: Discounted price of the course mode.\n\n        \"\"\"\n        try:\n            arg_4 = arg_0.client.baskets.calculate.get(\n                sku=[arg_1['sku']],\n                username=arg_0.user.username,\n                catalog=arg_3,\n            )\n        except (SlumberBaseException, ConnectionError, Timeout) as exc:\n            LOGGER.exception('Failed to get price details for sku %s due to: %s', arg_1['sku'], str(exc))\n            arg_4 = {}\n        arg_5 = arg_4.get('total_incl_tax', arg_1['min_price'])\n        if arg_5 != arg_1['min_price']:\n            return format_price(arg_5, arg_2)\n        return arg_1['original_price']", "path": "enterprise/api_client/ecommerce.py", "identifier": "EcommerceApiClient.get_course_final_price", "docstring": "Get course mode's SKU discounted price after applying any entitlement available for this user.\n\n        Returns:\n            str: Discounted price of the course mode.", "docstring_tokens": ["Get", "course", "mode", "s", "SKU", "discounted", "price", "after", "applying", "any", "entitlement", "available", "for", "this", "user", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257967}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_http/winhttp.py#L292-L300", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gets back all response headers.", "language": "python", "parameters": "(self)", "return_statement": "return headers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "c_void_p", "(", ")", "_WinHttpRequest", ".", "_GetAllResponseHeaders", "(", "arg_0", ",", "byref", "(", "arg_1", ")", ")", "arg_1", "=", "ctypes", ".", "cast", "(", "arg_1", ",", "c_wchar_p", ")", "arg_2", "=", "arg_1", ".", "value", "_SysFreeString", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        ''' Gets back all response headers. '''\n\n        arg_1 = c_void_p()\n        _WinHttpRequest._GetAllResponseHeaders(arg_0, byref(arg_1))\n        arg_1 = ctypes.cast(arg_1, c_wchar_p)\n        arg_2 = arg_1.value\n        _SysFreeString(arg_1)\n        return arg_2", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_http/winhttp.py", "identifier": "_WinHttpRequest.get_all_response_headers", "docstring": "Gets back all response headers.", "docstring_tokens": ["Gets", "back", "all", "response", "headers", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 257968}
{"url": "https://github.com/rossengeorgiev/aprs-python/blob/94b89a6da47a322129484efcaf1e82f6a9932891/aprslib/base91.py#L34-L51", "sha": "94b89a6da47a322129484efcaf1e82f6a9932891", "docstring_summary": "Takes a base91 char string and returns decimal", "language": "python", "parameters": "(text)", "return_statement": "return decimal if text != '' else 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "string_type", ")", ":", "raise", "TypeError", "(", "\"expected str or unicode, %s given\"", "%", "type", "(", "arg_0", ")", ")", "if", "findall", "(", "r\"[\\x00-\\x20\\x7c-\\xff]\"", ",", "arg_0", ")", ":", "raise", "ValueError", "(", "\"invalid character in sequence\"", ")", "arg_0", "=", "arg_0", ".", "lstrip", "(", "'!'", ")", "arg_1", "=", "0", "arg_2", "=", "len", "(", "arg_0", ")", "-", "1", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", ":", "arg_1", "+=", "(", "ord", "(", "arg_4", ")", "-", "33", ")", "*", "(", "91", "**", "(", "arg_2", "-", "arg_3", ")", ")", "return", "arg_1", "if", "arg_0", "!=", "''", "else", "0"], "function": "def Func(arg_0):\n    \"\"\"\n    Takes a base91 char string and returns decimal\n    \"\"\"\n\n    if not isinstance(arg_0, string_type):\n        raise TypeError(\"expected str or unicode, %s given\" % type(arg_0))\n\n    if findall(r\"[\\x00-\\x20\\x7c-\\xff]\", arg_0):\n        raise ValueError(\"invalid character in sequence\")\n\n    arg_0 = arg_0.lstrip('!')\n    arg_1 = 0\n    arg_2 = len(arg_0) - 1\n    for arg_3, arg_4 in enumerate(arg_0):\n        arg_1 += (ord(arg_4) - 33) * (91 ** (arg_2 - arg_3))\n\n    return arg_1 if arg_0 != '' else 0", "path": "aprslib/base91.py", "identifier": "to_decimal", "docstring": "Takes a base91 char string and returns decimal", "docstring_tokens": ["Takes", "a", "base91", "char", "string", "and", "returns", "decimal"], "nwo": "rossengeorgiev/aprs-python", "score": 0.3643830340421162, "idx": 257969}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L2816-L2823", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Sets byte if not overflow.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "write", "(", "Operators", ".", "ITEBV", "(", "arg_1", ".", "size", ",", "arg_0", ".", "OF", "==", "False", ",", "1", ",", "0", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sets byte if not overflow.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        \"\"\"\n        arg_1.write(Operators.ITEBV(arg_1.size, arg_0.OF == False, 1, 0))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.SETNO", "docstring": "Sets byte if not overflow.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Sets", "byte", "if", "not", "overflow", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 257970}
{"url": "https://github.com/macacajs/wd.py/blob/6d3c52060013e01a67cd52b68b5230b387427bad/macaca/remote_invoker.py#L88-L114", "sha": "6d3c52060013e01a67cd52b68b5230b387427bad", "docstring_summary": "Format the endpoint url by data and then request the remote server.", "language": "python", "parameters": "(self, command, data={})", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "arg_3", ",", "arg_4", "=", "arg_1", "try", ":", "arg_5", "=", "arg_0", ".", "_formatter", ".", "format_map", "(", "arg_4", ",", "arg_2", ")", "arg_6", "=", "arg_0", ".", "_formatter", ".", "get_unused_kwargs", "(", ")", "arg_7", "=", "\"{0}{1}\"", ".", "format", "(", "arg_0", ".", "_url", ",", "arg_5", ")", "return", "arg_0", ".", "_request", "(", "arg_3", ",", "arg_7", ",", "arg_6", ")", "except", "KeyError", "as", "err", ":", "LOGGER", ".", "debug", "(", "'Endpoint {0} is missing argument {1}'", ".", "format", "(", "arg_4", ",", "err", ")", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"Format the endpoint url by data and then request the remote server.\n\n        Args:\n            command(Command): WebDriver command to be Funcd.\n            data(dict): Data fulfill the uri template and json body.\n\n        Returns:\n            A dict represent the json body from server response.\n\n        Raises:\n            KeyError: Data cannot fulfill the variable which command needed.\n            ConnectionError: Meet network problem (e.g. DNS failure,\n                refused connection, etc).\n            Timeout: A request times out.\n            HTTPError: HTTP request returned an unsuccessful status code.\n        \"\"\"\n        arg_3, arg_4 = arg_1\n        try:\n            arg_5 = arg_0._formatter.format_map(arg_4, arg_2)\n            arg_6 = arg_0._formatter.get_unused_kwargs()\n            arg_7 = \"{0}{1}\".format(arg_0._url, arg_5)\n            return arg_0._request(arg_3, arg_7, arg_6)\n        except KeyError as err:\n            LOGGER.debug(\n                'Endpoint {0} is missing argument {1}'.format(arg_4, err))\n            raise", "path": "macaca/remote_invoker.py", "identifier": "RemoteInvoker.execute", "docstring": "Format the endpoint url by data and then request the remote server.\n\n        Args:\n            command(Command): WebDriver command to be executed.\n            data(dict): Data fulfill the uri template and json body.\n\n        Returns:\n            A dict represent the json body from server response.\n\n        Raises:\n            KeyError: Data cannot fulfill the variable which command needed.\n            ConnectionError: Meet network problem (e.g. DNS failure,\n                refused connection, etc).\n            Timeout: A request times out.\n            HTTPError: HTTP request returned an unsuccessful status code.", "docstring_tokens": ["Format", "the", "endpoint", "url", "by", "data", "and", "then", "request", "the", "remote", "server", "."], "nwo": "macacajs/wd.py", "score": 0.3182350344440769, "idx": 257971}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/log.py#L20-L36", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Init and configure logger.", "language": "python", "parameters": "(name=None, save=False)", "return_statement": "return logger", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "False", ")", ":", "Func", "=", "logging", ".", "getLogger", "(", "arg_0", ")", "if", "arg_1", ":", "arg_3", "=", "'%(asctime)s [%(levelname)s] [%(name)s] %(funcName)s: %(message)s (line %(lineno)d)'", "arg_4", "=", "'fut.log'", "open", "(", "arg_4", ",", "'w'", ")", ".", "write", "(", "''", ")", "Func", ".", "setLevel", "(", "logging", ".", "DEBUG", ")", "arg_5", "=", "logging", ".", "FileHandler", "(", "arg_4", ")", "arg_5", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "arg_3", ")", ")", "else", ":", "arg_5", "=", "NullHandler", "(", ")", "Func", ".", "addHandler", "(", "arg_5", ")", "return", "Func"], "function": "def Func(arg_0=None, arg_1=False):\n    \"\"\"Init and configure logger.\"\"\"\n    Func = logging.getLogger(arg_0)\n\n    if arg_1:\n        arg_3 = '%(asctime)s [%(levelname)s] [%(name)s] %(funcName)s: %(message)s (line %(lineno)d)'\n        arg_4 = 'fut.log'  # TODO: define logpath\n        open(arg_4, 'w').write('')  # remove old logs\n        Func.setLevel(logging.DEBUG)\n        arg_5 = logging.FileHandler(arg_4)\n        arg_5.setFormatter(logging.Formatter(arg_3))\n    else:\n        arg_5 = NullHandler()\n\n    Func.addHandler(arg_5)\n\n    return Func", "path": "fut/log.py", "identifier": "logger", "docstring": "Init and configure logger.", "docstring_tokens": ["Init", "and", "configure", "logger", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 257972}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/mainwindow.py#L931-L973", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Forward the close event to every tabs contained by the windows", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "tab_widget", ".", "count", "(", ")", "==", "0", ":", "arg_1", ".", "accept", "(", ")", "return", "arg_2", "=", "arg_0", ".", "window", "(", ")", ".", "windowTitle", "(", ")", "arg_3", "=", "QtGui", ".", "QMessageBox", ".", "Cancel", "arg_4", "=", "QtGui", ".", "QMessageBox", ".", "Ok", "if", "arg_0", ".", "confirm_exit", ":", "if", "arg_0", ".", "tab_widget", ".", "count", "(", ")", ">", "1", ":", "arg_5", "=", "\"Close all tabs, stop all kernels, and Quit?\"", "else", ":", "arg_5", "=", "\"Close console, stop kernel, and Quit?\"", "arg_6", "=", "\"Kernels not started here (e.g. notebooks) will be left alone.\"", "arg_7", "=", "QtGui", ".", "QPushButton", "(", "\"&Quit\"", ",", "arg_0", ")", "arg_7", ".", "setShortcut", "(", "'Q'", ")", "arg_8", "=", "QtGui", ".", "QMessageBox", "(", "QtGui", ".", "QMessageBox", ".", "Question", ",", "arg_2", ",", "arg_5", ")", "arg_8", ".", "setInformativeText", "(", "arg_6", ")", "arg_8", ".", "addButton", "(", "arg_3", ")", "arg_8", ".", "addButton", "(", "arg_7", ",", "QtGui", ".", "QMessageBox", ".", "YesRole", ")", "arg_8", ".", "setDefaultButton", "(", "arg_7", ")", "arg_8", ".", "setEscapeButton", "(", "arg_3", ")", "arg_9", "=", "QtGui", ".", "QPixmap", "(", "arg_0", ".", "_app", ".", "icon", ".", "pixmap", "(", "QtCore", ".", "QSize", "(", "64", ",", "64", ")", ")", ")", "arg_8", ".", "setIconPixmap", "(", "arg_9", ")", "arg_10", "=", "arg_8", ".", "exec_", "(", ")", "else", ":", "arg_10", "=", "arg_4", "if", "arg_10", "==", "arg_3", ":", "arg_1", ".", "ignore", "(", ")", "return", "if", "arg_10", "==", "arg_4", ":", "while", "arg_0", ".", "tab_widget", ".", "count", "(", ")", ">=", "1", ":", "arg_11", "=", "arg_0", ".", "active_frontend", "arg_11", ".", "_confirm_exit", "=", "False", "arg_0", ".", "close_tab", "(", "arg_11", ")", "arg_1", ".", "accept", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Forward the close event to every tabs contained by the windows\n        \"\"\"\n        if arg_0.tab_widget.count() == 0:\n            # no tabs, just close\n            arg_1.accept()\n            return\n        # Do Not loop on the widget count as it change while closing\n        arg_2 = arg_0.window().windowTitle()\n        arg_3 = QtGui.QMessageBox.Cancel\n        arg_4 = QtGui.QMessageBox.Ok\n        \n        if arg_0.confirm_exit:\n            if arg_0.tab_widget.count() > 1:\n                arg_5 = \"Close all tabs, stop all kernels, and Quit?\"\n            else:\n                arg_5 = \"Close console, stop kernel, and Quit?\"\n            arg_6 = \"Kernels not started here (e.g. notebooks) will be left alone.\"\n            arg_7 = QtGui.QPushButton(\"&Quit\", arg_0)\n            arg_7.setShortcut('Q')\n            arg_8 = QtGui.QMessageBox(QtGui.QMessageBox.Question,\n                                    arg_2, arg_5)\n            arg_8.setInformativeText(arg_6)\n            arg_8.addButton(arg_3)\n            arg_8.addButton(arg_7, QtGui.QMessageBox.YesRole)\n            arg_8.setDefaultButton(arg_7)\n            arg_8.setEscapeButton(arg_3)\n            arg_9 = QtGui.QPixmap(arg_0._app.icon.pixmap(QtCore.QSize(64,64)))\n            arg_8.setIconPixmap(arg_9)\n            arg_10 = arg_8.exec_()\n        else:\n            arg_10 = arg_4\n        \n        if arg_10 == arg_3:\n            arg_1.ignore()\n            return\n        if arg_10 == arg_4:\n            while arg_0.tab_widget.count() >= 1:\n                # prevent further confirmations:\n                arg_11 = arg_0.active_frontend\n                arg_11._confirm_exit = False\n                arg_0.close_tab(arg_11)\n            arg_1.accept()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/mainwindow.py", "identifier": "MainWindow.closeEvent", "docstring": "Forward the close event to every tabs contained by the windows", "docstring_tokens": ["Forward", "the", "close", "event", "to", "every", "tabs", "contained", "by", "the", "windows"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257973}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L291-L315", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Checks to see if the given repo has a ReadMe. MD means it has a correct\n        Readme recognized by GitHub.", "language": "python", "parameters": "(self, repo)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "readme", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "total_readmes", "+=", "1", "return", "'MD'", "if", "arg_0", ".", "search_limit", ">=", "28", ":", "print", "'Hit search limit. Sleeping for 60 sec.'", "time", ".", "sleep", "(", "60", ")", "arg_0", ".", "search_limit", "=", "0", "arg_0", ".", "search_limit", "+=", "1", "arg_4", "=", "arg_0", ".", "logged_in_gh", ".", "search_code", "(", "'readme'", "+", "'in:path repo:'", "+", "arg_1", ".", "full_name", ")", "try", ":", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "arg_5", ".", "path", "[", "1", ":", "]", "if", "'/'", "not", "in", "arg_6", "and", "'readme'", "in", "arg_6", ".", "lower", "(", ")", ":", "arg_0", ".", "total_readmes", "+=", "1", "return", "arg_6", "return", "'MISS'", "except", "(", "github3", ".", "models", ".", "GitHubError", ",", "StopIteration", ")", "as", "e", ":", "return", "'MISS'"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Checks to see if the given repo has a ReadMe. MD means it has a correct\n        Readme recognized by GitHub.\n        \"\"\"\n        arg_2 = arg_1.readme()\n        if arg_2 is not None:\n            arg_0.total_readmes += 1\n            return 'MD'\n        if arg_0.search_limit >= 28:\n            print 'Hit search limit. Sleeping for 60 sec.'\n            time.sleep(60)\n            arg_0.search_limit = 0\n        arg_0.search_limit += 1\n        arg_4 = arg_0.logged_in_gh.search_code('readme'\n            + 'in:path repo:' + arg_1.full_name)\n        try:\n            for arg_5 in arg_4:\n                arg_6 = arg_5.path[1:]\n                if '/' not in arg_6 and 'readme' in arg_6.lower():\n                    arg_0.total_readmes += 1\n                    return arg_6\n            return 'MISS'\n        except (github3.models.GitHubError, StopIteration) as e:\n            return 'MISS'", "path": "scripts/github_stats.py", "identifier": "GitHub_LLNL_Stats.get_readme", "docstring": "Checks to see if the given repo has a ReadMe. MD means it has a correct\n        Readme recognized by GitHub.", "docstring_tokens": ["Checks", "to", "see", "if", "the", "given", "repo", "has", "a", "ReadMe", ".", "MD", "means", "it", "has", "a", "correct", "Readme", "recognized", "by", "GitHub", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 257974}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L4017-L4062", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Randomly resize an image and corresponding keypoints.\n    The height and width of image will be changed independently, so the scale will be changed.", "language": "python", "parameters": "(image, annos, mask=None, zoom_range=(0.8, 1.2))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "(", "0.8", ",", "1.2", ")", ")", ":", "arg_4", "=", "arg_0", ".", "shape", "[", "0", "]", "arg_5", "=", "arg_0", ".", "shape", "[", "1", "]", "arg_6", ",", "arg_7", "=", "arg_3", "arg_8", "=", "np", ".", "random", ".", "uniform", "(", "arg_6", ",", "arg_7", ")", "arg_9", "=", "np", ".", "random", ".", "uniform", "(", "arg_6", ",", "arg_7", ")", "arg_10", "=", "int", "(", "arg_5", "*", "arg_8", ")", "arg_11", "=", "int", "(", "arg_4", "*", "arg_9", ")", "arg_12", "=", "cv2", ".", "resize", "(", "arg_0", ",", "(", "arg_10", ",", "arg_11", ")", ",", "interpolation", "=", "cv2", ".", "INTER_AREA", ")", "if", "arg_2", "is", "not", "None", ":", "arg_2", "=", "cv2", ".", "resize", "(", "arg_2", ",", "(", "arg_10", ",", "arg_11", ")", ",", "interpolation", "=", "cv2", ".", "INTER_AREA", ")", "arg_13", "=", "[", "]", "for", "arg_14", "in", "arg_1", ":", "arg_15", "=", "[", "]", "for", "arg_16", "in", "arg_14", ":", "if", "arg_16", "[", "0", "]", "<", "-", "100", "or", "arg_16", "[", "1", "]", "<", "-", "100", ":", "arg_15", ".", "append", "(", "(", "-", "1000", ",", "-", "1000", ")", ")", "continue", "arg_15", ".", "append", "(", "(", "int", "(", "arg_16", "[", "0", "]", "*", "arg_8", "+", "0.5", ")", ",", "int", "(", "arg_16", "[", "1", "]", "*", "arg_9", "+", "0.5", ")", ")", ")", "arg_13", ".", "append", "(", "arg_15", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_12", ",", "arg_13", ",", "arg_2", "else", ":", "return", "arg_12", ",", "arg_13", ",", "None"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=(0.8, 1.2)):\n    \"\"\"Randomly resize an image and corresponding keypoints.\n    The height and width of image will be changed independently, so the scale will be changed.\n\n    Parameters\n    -----------\n    image : 3 channel image\n        The given image for augmentation.\n    annos : list of list of floats\n        The keypoints annotation of people.\n    mask : single channel image or None\n        The mask if available.\n    zoom_range : tuple of two floats\n        The minimum and maximum factor to zoom in or out, e.g (0.5, 1) means zoom out 1~2 times.\n\n    Returns\n    ----------\n    preprocessed image, annos, mask\n\n    \"\"\"\n    arg_4 = arg_0.shape[0]\n    arg_5 = arg_0.shape[1]\n    arg_6, arg_7 = arg_3\n    arg_8 = np.random.uniform(arg_6, arg_7)\n    arg_9 = np.random.uniform(arg_6, arg_7)\n\n    arg_10 = int(arg_5 * arg_8)\n    arg_11 = int(arg_4 * arg_9)\n\n    arg_12 = cv2.resize(arg_0, (arg_10, arg_11), interpolation=cv2.INTER_AREA)\n    if arg_2 is not None:\n        arg_2 = cv2.resize(arg_2, (arg_10, arg_11), interpolation=cv2.INTER_AREA)\n    # adjust meta data\n    arg_13 = []\n    for arg_14 in arg_1:  # TODO : speed up with affine transform\n        arg_15 = []\n        for arg_16 in arg_14:\n            if arg_16[0] < -100 or arg_16[1] < -100:\n                arg_15.append((-1000, -1000))\n                continue\n            arg_15.append((int(arg_16[0] * arg_8 + 0.5), int(arg_16[1] * arg_9 + 0.5)))\n        arg_13.append(arg_15)\n    if arg_2 is not None:\n        return arg_12, arg_13, arg_2\n    else:\n        return arg_12, arg_13, None", "path": "tensorlayer/prepro.py", "identifier": "keypoint_random_resize", "docstring": "Randomly resize an image and corresponding keypoints.\n    The height and width of image will be changed independently, so the scale will be changed.\n\n    Parameters\n    -----------\n    image : 3 channel image\n        The given image for augmentation.\n    annos : list of list of floats\n        The keypoints annotation of people.\n    mask : single channel image or None\n        The mask if available.\n    zoom_range : tuple of two floats\n        The minimum and maximum factor to zoom in or out, e.g (0.5, 1) means zoom out 1~2 times.\n\n    Returns\n    ----------\n    preprocessed image, annos, mask", "docstring_tokens": ["Randomly", "resize", "an", "image", "and", "corresponding", "keypoints", ".", "The", "height", "and", "width", "of", "image", "will", "be", "changed", "independently", "so", "the", "scale", "will", "be", "changed", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 257975}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/gui/gui_mainLayout.py#L792-L803", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "The following opens the log file of PlanarRad.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "open", "(", "os", ".", "path", ".", "expanduser", "(", "'~/.planarradpy/log/libplanarradpy.log'", ")", ")", "arg_0", ".", "uiLog", ".", "textEdit", ".", "setPlainText", "(", "str", "(", "arg_1", ".", "read", "(", ")", ")", ")", "arg_0", ".", "log_window", ".", "show", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        The following opens the log file of PlanarRad.\n        \"\"\"\n        \"\"\"\n        TO DO.\n        \"\"\"\n        # webbrowser.open('https://marrabld.github.io/planarradpy/')\n        arg_1 = open(os.path.expanduser('~/.planarradpy/log/libplanarradpy.log'))\n        # self.uiLog.textEdit.setText(str(f.readlines()))\n        arg_0.uiLog.textEdit.setPlainText(str(arg_1.read()))\n        arg_0.log_window.show()", "path": "gui/gui_mainLayout.py", "identifier": "FormEvents.open_log_file", "docstring": "The following opens the log file of PlanarRad.", "docstring_tokens": ["The", "following", "opens", "the", "log", "file", "of", "PlanarRad", "."], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 257976}
{"url": "https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storage/picklestorage.py#L194-L205", "sha": "8a34891892b8af69b21fdc46701c91763a5c1cf9", "docstring_summary": "Retrieve value from store.", "language": "python", "parameters": "(self, key, flush=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "try", ":", "del", "arg_0", ".", "store", "[", "arg_1", "]", "except", "Exception", "as", "error", ":", "pass", "if", "arg_2", ":", "arg_0", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Retrieve value from store.\n\n        :param key: Key\n\n        \"\"\"\n        try:\n            del arg_0.store[arg_1]\n        except Exception as error:\n            pass\n        if arg_2:\n            arg_0.flush()", "path": "modularodm/storage/picklestorage.py", "identifier": "PickleStorage._remove_by_pk", "docstring": "Retrieve value from store.\n\n        :param key: Key", "docstring_tokens": ["Retrieve", "value", "from", "store", "."], "nwo": "cos-archives/modular-odm", "score": 0.2643786477459777, "idx": 257977}
{"url": "https://github.com/innodatalabs/lxmlx/blob/d0514f62127e51378be4e0c8cea2622c9786f99f/lxmlx/event.py#L130-L140", "sha": "d0514f62127e51378be4e0c8cea2622c9786f99f", "docstring_summary": "selects sub-tree events", "language": "python", "parameters": "(events)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", "[", "'type'", "]", "==", "ENTER", ":", "arg_1", "+=", "1", "elif", "arg_2", "[", "'type'", "]", "==", "EXIT", ":", "if", "arg_1", "==", "0", ":", "break", "arg_1", "-=", "1", "yield", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"selects sub-tree events\"\"\"\n    arg_1 = 0\n    for arg_2 in arg_0:\n        if arg_2['type'] == ENTER:\n            arg_1 += 1\n        elif arg_2['type'] == EXIT:\n            if arg_1 == 0:\n                break\n            arg_1 -= 1\n        yield arg_2", "path": "lxmlx/event.py", "identifier": "subtree", "docstring": "selects sub-tree events", "docstring_tokens": ["selects", "sub", "-", "tree", "events"], "nwo": "innodatalabs/lxmlx", "score": 0.16638194949711382, "idx": 257978}
{"url": "https://github.com/trivago/Protector/blob/7ebe7bde965e27737b961a0cb5740724d174fdc7/protector/parser/query_parser.py#L212-L226", "sha": "7ebe7bde965e27737b961a0cb5740724d174fdc7", "docstring_summary": "Parse the date range for the query", "language": "python", "parameters": "(self, tokens)", "return_statement": "return self.time_parser.parse(self.parse_keyword(Keyword.WHERE, tokens))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "time_parser", ".", "parse", "(", "arg_0", ".", "parse_keyword", "(", "Keyword", ".", "WHERE", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Parse the date range for the query\n\n        E.g. WHERE time > now() - 48h AND time < now() - 24h\n        would result in DateRange(datetime_start, datetime_end)\n        where\n        datetime_start would be parsed from now() - 48h\n        and\n        datetime_end would be parsed from now() - 24h\n\n        :param tokens:\n        :return:\n        \"\"\"\n        return arg_0.time_parser.parse(arg_0.parse_keyword(Keyword.WHERE, arg_1))", "path": "protector/parser/query_parser.py", "identifier": "QueryParser._parse_time", "docstring": "Parse the date range for the query\n\n        E.g. WHERE time > now() - 48h AND time < now() - 24h\n        would result in DateRange(datetime_start, datetime_end)\n        where\n        datetime_start would be parsed from now() - 48h\n        and\n        datetime_end would be parsed from now() - 24h\n\n        :param tokens:\n        :return:", "docstring_tokens": ["Parse", "the", "date", "range", "for", "the", "query"], "nwo": "trivago/Protector", "score": 0.28011057986078114, "idx": 257979}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/algorithm.py#L65-L69", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Called if no explicit visitor function exists for a node.", "language": "python", "parameters": "(self, node)", "return_statement": "return node", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "_fields", ":", "setattr", "(", "arg_1", ",", "arg_2", ",", "arg_0", ".", "visit", "(", "getattr", "(", "arg_1", ",", "arg_2", ")", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Called if no explicit visitor function exists for a node.\"\"\"\n        for arg_2 in arg_1._fields:\n            setattr(arg_1, arg_2, arg_0.visit(getattr(arg_1, arg_2)))\n        return arg_1", "path": "third_party/pythonparser/algorithm.py", "identifier": "Transformer.generic_visit", "docstring": "Called if no explicit visitor function exists for a node.", "docstring_tokens": ["Called", "if", "no", "explicit", "visitor", "function", "exists", "for", "a", "node", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257980}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/morpho_tagger/network.py#L234-L244", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Trains model on a single batch", "language": "python", "parameters": "(self, data: List[Iterable], labels: Iterable[list])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ",", "arg_4", ":", "arg_3", "[", "arg_5", "]", ")", "->", "None", ":", "arg_6", ",", "arg_7", "=", "arg_0", ".", "_transform_batch", "(", "arg_1", ",", "arg_4", ")", "arg_0", ".", "model_", ".", "Func", "(", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1: arg_2[arg_3], arg_4: arg_3[arg_5]) -> None:\n        \"\"\"Trains model on a single batch\n\n        Args:\n            data: a batch of word sequences\n            labels: a batch of correct tag sequences\n        Returns:\n            the trained model\n        \"\"\"\n        arg_6, arg_7 = arg_0._transform_batch(arg_1, arg_4)\n        arg_0.model_.Func(arg_6, arg_7)", "path": "deeppavlov/models/morpho_tagger/network.py", "identifier": "CharacterTagger.train_on_batch", "docstring": "Trains model on a single batch\n\n        Args:\n            data: a batch of word sequences\n            labels: a batch of correct tag sequences\n        Returns:\n            the trained model", "docstring_tokens": ["Trains", "model", "on", "a", "single", "batch"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 257981}
{"url": "https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L117-L130", "sha": "cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174", "docstring_summary": "Method to refresh API tokens from ecobee", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'https://api.ecobee.com/token'", "arg_2", "=", "{", "'grant_type'", ":", "'refresh_token'", ",", "'refresh_token'", ":", "arg_0", ".", "refresh_token", ",", "'client_id'", ":", "arg_0", ".", "api_key", "}", "arg_3", "=", "requests", ".", "post", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "arg_3", ".", "status_code", "==", "requests", ".", "codes", ".", "ok", ":", "arg_0", ".", "access_token", "=", "arg_3", ".", "json", "(", ")", "[", "'access_token'", "]", "arg_0", ".", "refresh_token", "=", "arg_3", ".", "json", "(", ")", "[", "'refresh_token'", "]", "arg_0", ".", "write_tokens_to_file", "(", ")", "return", "True", "else", ":", "arg_0", ".", "request_pin", "(", ")"], "function": "def Func(arg_0):\n        ''' Method to refresh API tokens from ecobee '''\n        arg_1 = 'https://api.ecobee.com/token'\n        arg_2 = {'grant_type': 'refresh_token',\n                  'refresh_token': arg_0.refresh_token,\n                  'client_id': arg_0.api_key}\n        arg_3 = requests.post(arg_1, arg_2=arg_2)\n        if arg_3.status_code == requests.codes.ok:\n            arg_0.access_token = arg_3.json()['access_token']\n            arg_0.refresh_token = arg_3.json()['refresh_token']\n            arg_0.write_tokens_to_file()\n            return True\n        else:\n            arg_0.request_pin()", "path": "pyecobee/__init__.py", "identifier": "Ecobee.refresh_tokens", "docstring": "Method to refresh API tokens from ecobee", "docstring_tokens": ["Method", "to", "refresh", "API", "tokens", "from", "ecobee"], "nwo": "nkgilley/python-ecobee-api", "score": 0.37994208506696864, "idx": 257982}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4092-L4102", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Redo selection, for the name.", "language": "python", "parameters": "(self, name=\"default\", executor=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"default\"", ",", "arg_2", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"redo\"", ")", "arg_2", "=", "arg_2", "or", "arg_0", ".", "executor", "assert", "arg_0", ".", "selection_can_redo", "(", "arg_1", "=", "arg_1", ")", "arg_3", "=", "arg_0", ".", "selection_histories", "[", "arg_1", "]", "arg_4", "=", "arg_0", ".", "selection_history_indices", "[", "arg_1", "]", "arg_5", "=", "arg_3", "[", "arg_4", "+", "1", "]", "arg_0", ".", "selection_history_indices", "[", "arg_1", "]", "+=", "1", "arg_0", ".", "signal_selection_changed", ".", "emit", "(", "arg_0", ")", "logger", ".", "debug", "(", "\"redo: selection history is %r, index is %r\"", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1=\"default\", arg_2=None):\n        \"\"\"Redo selection, for the name.\"\"\"\n        logger.debug(\"redo\")\n        arg_2 = arg_2 or arg_0.executor\n        assert arg_0.selection_can_redo(arg_1=arg_1)\n        arg_3 = arg_0.selection_histories[arg_1]\n        arg_4 = arg_0.selection_history_indices[arg_1]\n        arg_5 = arg_3[arg_4 + 1]\n        arg_0.selection_history_indices[arg_1] += 1\n        arg_0.signal_selection_changed.emit(arg_0)\n        logger.debug(\"redo: selection history is %r, index is %r\", arg_3, arg_4)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.selection_redo", "docstring": "Redo selection, for the name.", "docstring_tokens": ["Redo", "selection", "for", "the", "name", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 257983}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gerrit.py#L495-L522", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Returns the Gerrit argument parser.", "language": "python", "parameters": "(cls)", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "BackendCommandArgumentParser", "(", "arg_0", ".", "BACKEND", ".", "CATEGORIES", ",", "from_date", "=", "True", ",", "archive", "=", "True", ")", "arg_2", "=", "arg_1", ".", "parser", ".", "add_argument_group", "(", "'Gerrit arguments'", ")", "arg_2", ".", "add_argument", "(", "'--user'", ",", "dest", "=", "'user'", ",", "help", "=", "\"Gerrit ssh user\"", ")", "arg_2", ".", "add_argument", "(", "'--max-reviews'", ",", "dest", "=", "'max_reviews'", ",", "type", "=", "int", ",", "default", "=", "MAX_REVIEWS", ",", "help", "=", "\"Max number of reviews per ssh query.\"", ")", "arg_2", ".", "add_argument", "(", "'--blacklist-reviews'", ",", "dest", "=", "'blacklist_reviews'", ",", "nargs", "=", "'*'", ",", "help", "=", "\"Wrong reviews that must not be retrieved.\"", ")", "arg_2", ".", "add_argument", "(", "'--disable-host-key-check'", ",", "dest", "=", "'disable_host_key_check'", ",", "action", "=", "'store_true'", ",", "help", "=", "\"Don't check remote host identity\"", ")", "arg_2", ".", "add_argument", "(", "'--ssh-port'", ",", "dest", "=", "'port'", ",", "default", "=", "PORT", ",", "type", "=", "int", ",", "help", "=", "\"Set SSH port of the Gerrit server\"", ")", "arg_1", ".", "parser", ".", "add_argument", "(", "'hostname'", ",", "help", "=", "\"Hostname of the Gerrit server\"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns the Gerrit argument parser.\"\"\"\n\n        arg_1 = BackendCommandArgumentParser(arg_0.BACKEND.CATEGORIES,\n                                              from_date=True,\n                                              archive=True)\n\n        # Gerrit options\n        arg_2 = arg_1.parser.add_argument_group('Gerrit arguments')\n        arg_2.add_argument('--user', dest='user',\n                           help=\"Gerrit ssh user\")\n        arg_2.add_argument('--max-reviews', dest='max_reviews',\n                           type=int, default=MAX_REVIEWS,\n                           help=\"Max number of reviews per ssh query.\")\n        arg_2.add_argument('--blacklist-reviews', dest='blacklist_reviews',\n                           nargs='*',\n                           help=\"Wrong reviews that must not be retrieved.\")\n        arg_2.add_argument('--disable-host-key-check', dest='disable_host_key_check', action='store_true',\n                           help=\"Don't check remote host identity\")\n        arg_2.add_argument('--ssh-port', dest='port',\n                           default=PORT, type=int,\n                           help=\"Set SSH port of the Gerrit server\")\n\n        # Required arguments\n        arg_1.parser.add_argument('hostname',\n                                   help=\"Hostname of the Gerrit server\")\n\n        return arg_1", "path": "perceval/backends/core/gerrit.py", "identifier": "GerritCommand.setup_cmd_parser", "docstring": "Returns the Gerrit argument parser.", "docstring_tokens": ["Returns", "the", "Gerrit", "argument", "parser", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 257984}
{"url": "https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/models.py#L217-L225", "sha": "cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2", "docstring_summary": "Returns chained list of event and update images.", "language": "python", "parameters": "(self)", "return_statement": "return list(chain(self_imgs, u_images))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "image_set", ".", "all", "(", ")", "arg_2", "=", "arg_0", ".", "update_set", ".", "values_list", "(", "'id'", ",", "flat", "=", "True", ")", "arg_3", "=", "UpdateImage", ".", "objects", ".", "filter", "(", "update__id__in", "=", "arg_2", ")", "return", "list", "(", "chain", "(", "arg_1", ",", "arg_3", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns chained list of event and update images.\n        \"\"\"\n        arg_1 = arg_0.image_set.all()\n        arg_2 = arg_0.update_set.values_list('id', flat=True)\n        arg_3 = UpdateImage.objects.filter(update__id__in=arg_2)\n\n        return list(chain(arg_1, arg_3))", "path": "build/lib/happenings/models.py", "identifier": "Event.get_all_images", "docstring": "Returns chained list of event and update images.", "docstring_tokens": ["Returns", "chained", "list", "of", "event", "and", "update", "images", "."], "nwo": "tBaxter/tango-happenings", "score": 0.09252797783733271, "idx": 257985}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/pprint.py#L239-L244", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Format o for a specific context, returning a string\n        and flags indicating whether the representation is 'readable'\n        and whether the o represents a recursive construct.", "language": "python", "parameters": "(self, o, context, maxlevels, level)", "return_statement": "return _safe_repr(o, context, maxlevels, level)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "return", "_safe_repr", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Format o for a specific context, returning a string\n        and flags indicating whether the representation is 'readable'\n        and whether the o represents a recursive construct.\n        \"\"\"\n        return _safe_repr(arg_1, arg_2, arg_3, arg_4)", "path": "third_party/stdlib/pprint.py", "identifier": "PrettyPrinter.format", "docstring": "Format o for a specific context, returning a string\n        and flags indicating whether the representation is 'readable'\n        and whether the o represents a recursive construct.", "docstring_tokens": ["Format", "o", "for", "a", "specific", "context", "returning", "a", "string", "and", "flags", "indicating", "whether", "the", "representation", "is", "readable", "and", "whether", "the", "o", "represents", "a", "recursive", "construct", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 257986}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/normalization.py#L92-L99", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Alternative implementation of tf.nn.bias_add which is compatiable with tensorRT.", "language": "python", "parameters": "(x, b, data_format)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "'NHWC'", ":", "return", "tf", ".", "add", "(", "arg_0", ",", "arg_1", ")", "elif", "arg_2", "==", "'NCHW'", ":", "return", "tf", ".", "add", "(", "arg_0", ",", "_to_channel_first_bias", "(", "arg_1", ")", ")", "else", ":", "raise", "ValueError", "(", "'invalid data_format: %s'", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Alternative implementation of tf.nn.bias_add which is compatiable with tensorRT.\"\"\"\n    if arg_2 == 'NHWC':\n        return tf.add(arg_0, arg_1)\n    elif arg_2 == 'NCHW':\n        return tf.add(arg_0, _to_channel_first_bias(arg_1))\n    else:\n        raise ValueError('invalid data_format: %s' % arg_2)", "path": "tensorlayer/layers/normalization.py", "identifier": "_bias_add", "docstring": "Alternative implementation of tf.nn.bias_add which is compatiable with tensorRT.", "docstring_tokens": ["Alternative", "implementation", "of", "tf", ".", "nn", ".", "bias_add", "which", "is", "compatiable", "with", "tensorRT", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 257987}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L392-L411", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return the object for EnterpriseCustomerUser.", "language": "python", "parameters": "(user_id, enterprise_uuid)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "apps", ".", "get_model", "(", "'enterprise'", ",", "'EnterpriseCustomerUser'", ")", "try", ":", "return", "arg_2", ".", "objects", ".", "get", "(", "enterprise_customer__uuid", "=", "arg_1", ",", "arg_0", "=", "arg_0", ")", "except", "arg_2", ".", "DoesNotExist", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Return the object for EnterpriseCustomerUser.\n\n    Arguments:\n        user_id (str): user identifier\n        enterprise_uuid (UUID): Universally unique identifier for the enterprise customer.\n\n    Returns:\n        (EnterpriseCustomerUser): enterprise customer user record\n\n    \"\"\"\n    arg_2 = apps.get_model('enterprise', 'EnterpriseCustomerUser')  # pylint: disable=invalid-name\n    try:\n        return arg_2.objects.get(  # pylint: disable=no-member\n            enterprise_customer__uuid=arg_1,\n            arg_0=arg_0\n        )\n    except arg_2.DoesNotExist:\n        return None", "path": "enterprise/utils.py", "identifier": "get_enterprise_customer_user", "docstring": "Return the object for EnterpriseCustomerUser.\n\n    Arguments:\n        user_id (str): user identifier\n        enterprise_uuid (UUID): Universally unique identifier for the enterprise customer.\n\n    Returns:\n        (EnterpriseCustomerUser): enterprise customer user record", "docstring_tokens": ["Return", "the", "object", "for", "EnterpriseCustomerUser", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 257988}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1548-L1567", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Inserts HTML using the specified cursor in such a way that future\n            formatting is unaffected.", "language": "python", "parameters": "(self, cursor, html)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "beginEditBlock", "(", ")", "arg_1", ".", "insertHtml", "(", "arg_2", ")", "arg_1", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "Left", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "if", "arg_1", ".", "selection", "(", ")", ".", "toPlainText", "(", ")", "==", "' '", ":", "arg_1", ".", "removeSelectedText", "(", ")", "else", ":", "arg_1", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "Right", ")", "arg_1", ".", "insertText", "(", "' '", ",", "QtGui", ".", "QTextCharFormat", "(", ")", ")", "arg_1", ".", "endEditBlock", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Inserts HTML using the specified cursor in such a way that future\n            formatting is unaffected.\n        \"\"\"\n        arg_1.beginEditBlock()\n        arg_1.insertHtml(arg_2)\n\n        # After inserting HTML, the text document \"remembers\" it's in \"html\n        # mode\", which means that subsequent calls adding plain text will result\n        # in unwanted formatting, lost tab characters, etc. The following code\n        # hacks around this behavior, which I consider to be a bug in Qt, by\n        # (crudely) resetting the document's style state.\n        arg_1.movePosition(QtGui.QTextCursor.Left,\n                            QtGui.QTextCursor.KeepAnchor)\n        if arg_1.selection().toPlainText() == ' ':\n            arg_1.removeSelectedText()\n        else:\n            arg_1.movePosition(QtGui.QTextCursor.Right)\n        arg_1.insertText(' ', QtGui.QTextCharFormat())\n        arg_1.endEditBlock()", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._insert_html", "docstring": "Inserts HTML using the specified cursor in such a way that future\n            formatting is unaffected.", "docstring_tokens": ["Inserts", "HTML", "using", "the", "specified", "cursor", "in", "such", "a", "way", "that", "future", "formatting", "is", "unaffected", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257989}
{"url": "https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/giraffez/secret.py#L53-L64", "sha": "6b4d27eb1a1eaf188c6885c7364ef27e92b1b957", "docstring_summary": "Set a decrypted value by key in a giraffez configuration file.", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", ".", "startswith", "(", "\"secure.\"", ")", ":", "arg_1", "=", "\"secure.{0}\"", ".", "format", "(", "arg_1", ")", "arg_0", ".", "config", ".", "Func_value", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "config", ".", "write", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Set a decrypted value by key in a giraffez configuration file.\n\n        :param str key: The key used to lookup the encrypted value\n        :param value: Value to Func at the given key, can be any value that is\n            YAML serializeable.\n        \"\"\"\n        if not arg_1.startswith(\"secure.\"):\n            arg_1 = \"secure.{0}\".format(arg_1)\n        arg_0.config.Func_value(arg_1, arg_2)\n        arg_0.config.write()", "path": "giraffez/secret.py", "identifier": "Secret.set", "docstring": "Set a decrypted value by key in a giraffez configuration file.\n\n        :param str key: The key used to lookup the encrypted value\n        :param value: Value to set at the given key, can be any value that is\n            YAML serializeable.", "docstring_tokens": ["Set", "a", "decrypted", "value", "by", "key", "in", "a", "giraffez", "configuration", "file", "."], "nwo": "capitalone/giraffez", "score": 0.19842634881568408, "idx": 257990}
{"url": "https://github.com/disqus/python-phabricator/blob/ad08e335081531fae053a78a1c708cd11e3e6c49/phabricator/__init__.py#L137-L180", "sha": "ad08e335081531fae053a78a1c708cd11e3e6c49", "docstring_summary": "Parse the conduit.query json dict response\n    This performs the logic of parsing the non-standard params dict\n        and then returning a dict Resource can understand", "language": "python", "parameters": "(interfaces)", "return_statement": "return dict(parsed_interfaces)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "collections", ".", "defaultdict", "(", "dict", ")", "for", "arg_2", ",", "arg_3", "in", "iteritems", "(", "arg_0", ")", ":", "arg_4", ",", "arg_5", "=", "arg_2", ".", "split", "(", "'.'", ",", "1", ")", "arg_6", "=", "arg_1", "[", "arg_4", "]", "[", "arg_5", "]", "=", "{", "}", "arg_6", "[", "'formats'", "]", "=", "[", "'json'", ",", "'human'", "]", "arg_6", "[", "'method'", "]", "=", "'POST'", "arg_6", "[", "'optional'", "]", "=", "{", "}", "arg_6", "[", "'required'", "]", "=", "{", "}", "for", "arg_7", ",", "arg_8", "in", "iteritems", "(", "dict", "(", "arg_3", "[", "'params'", "]", ")", ")", ":", "arg_9", "=", "'required'", "arg_10", "=", "'string'", "arg_8", "=", "TYPE_INFO_COMMENT_RE", ".", "sub", "(", "''", ",", "arg_8", ")", "arg_11", "=", "TYPE_INFO_SPLITTER_RE", ".", "findall", "(", "arg_8", ")", "for", "arg_12", "in", "arg_11", ":", "if", "arg_12", "in", "(", "'optional'", ",", "'required'", ")", ":", "arg_9", "=", "arg_12", "elif", "arg_12", "==", "'ignored'", ":", "arg_9", "=", "'optional'", "arg_10", "=", "'string'", "elif", "arg_12", "==", "'nonempty'", ":", "arg_9", "=", "'required'", "elif", "arg_12", "==", "'deprecated'", ":", "arg_9", "=", "'optional'", "else", ":", "arg_10", "=", "arg_12", "arg_6", "[", "arg_9", "]", "[", "arg_7", "]", "=", "map_param_type", "(", "arg_10", ")", "return", "dict", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse the conduit.query json dict response\n    This performs the logic of parsing the non-standard params dict\n        and then returning a dict Resource can understand\n    \"\"\"\n    arg_1 = collections.defaultdict(dict)\n\n    for arg_2, arg_3 in iteritems(arg_0):\n        arg_4, arg_5 = arg_2.split('.', 1)\n\n        arg_6 = arg_1[arg_4][arg_5] = {}\n\n        # Make default assumptions since these aren't provided by Phab\n        arg_6['formats'] = ['json', 'human']\n        arg_6['method'] = 'POST'\n\n        arg_6['optional'] = {}\n        arg_6['required'] = {}\n\n        for arg_7, arg_8 in iteritems(dict(arg_3['params'])):\n            # Set the defaults\n            arg_9 = 'required'\n            arg_10 = 'string'\n\n            # Usually in the format: <optionality> <param_type>\n            arg_8 = TYPE_INFO_COMMENT_RE.sub('', arg_8)\n            arg_11 = TYPE_INFO_SPLITTER_RE.findall(arg_8)\n            for arg_12 in arg_11:\n                if arg_12 in ('optional', 'required'):\n                    arg_9 = arg_12\n                elif arg_12 == 'ignored':\n                    arg_9 = 'optional'\n                    arg_10 = 'string'\n                elif arg_12 == 'nonempty':\n                    arg_9 = 'required'\n                elif arg_12 == 'deprecated':\n                    arg_9 = 'optional'\n                else:\n                    arg_10 = arg_12\n\n            arg_6[arg_9][arg_7] = map_param_type(arg_10)\n\n    return dict(arg_1)", "path": "phabricator/__init__.py", "identifier": "parse_interfaces", "docstring": "Parse the conduit.query json dict response\n    This performs the logic of parsing the non-standard params dict\n        and then returning a dict Resource can understand", "docstring_tokens": ["Parse", "the", "conduit", ".", "query", "json", "dict", "response", "This", "performs", "the", "logic", "of", "parsing", "the", "non", "-", "standard", "params", "dict", "and", "then", "returning", "a", "dict", "Resource", "can", "understand"], "nwo": "disqus/python-phabricator", "score": 0.5858708484417109, "idx": 257991}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/rcfile.py#L302-L337", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return the section and the value of the variable where the first\n    var_name is found in the app_name rcfiles.", "language": "python", "parameters": "(var_name, app_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "get_sections", "(", "arg_1", ")", "if", "not", "arg_2", ":", "raise", "ValueError", "(", "'No sections found in {} rcfiles.'", ".", "format", "(", "arg_1", ")", ")", "for", "arg_3", "in", "arg_2", ":", "try", ":", "arg_4", "=", "get_rcfile_variable_value", "(", "arg_0", ",", "section_name", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")", "except", ":", "pass", "else", ":", "return", "arg_3", ",", "arg_4", "raise", "KeyError", "(", "'No variable {} has been found in {} '", "'rcfiles.'", ".", "format", "(", "arg_0", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Return the section and the value of the variable where the first\n    var_name is found in the app_name rcfiles.\n\n    Parameters\n    ----------\n    var_name: str\n        Name of the variable to be searched for.\n\n    app_name: str\n        Name of the application to look for its rcfiles.\n\n    Returns\n    -------\n    section_name: str\n        Name of the section in the rcfiles where var_name was first found.\n\n    var_value: str\n        The value of the first variable with given var_name.\n    \"\"\"\n    arg_2 = get_sections(arg_1)\n\n    if not arg_2:\n        raise ValueError('No sections found in {} rcfiles.'.format(arg_1))\n\n    for arg_3 in arg_2:\n        try:\n            arg_4 = get_rcfile_variable_value(arg_0, section_name=arg_3,\n                                                  arg_1=arg_1)\n        except:\n            pass\n        else:\n            return arg_3, arg_4\n\n    raise KeyError('No variable {} has been found in {} '\n                   'rcfiles.'.format(arg_0, arg_1))", "path": "boyle/utils/rcfile.py", "identifier": "find_in_sections", "docstring": "Return the section and the value of the variable where the first\n    var_name is found in the app_name rcfiles.\n\n    Parameters\n    ----------\n    var_name: str\n        Name of the variable to be searched for.\n\n    app_name: str\n        Name of the application to look for its rcfiles.\n\n    Returns\n    -------\n    section_name: str\n        Name of the section in the rcfiles where var_name was first found.\n\n    var_value: str\n        The value of the first variable with given var_name.", "docstring_tokens": ["Return", "the", "section", "and", "the", "value", "of", "the", "variable", "where", "the", "first", "var_name", "is", "found", "in", "the", "app_name", "rcfiles", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 257992}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py#L406-L412", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Signs the given string and also attaches a time information.", "language": "python", "parameters": "(self, value)", "return_statement": "return value + sep + self.get_signature(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "want_bytes", "(", "arg_1", ")", "arg_2", "=", "base64_encode", "(", "int_to_bytes", "(", "arg_0", ".", "get_timestamp", "(", ")", ")", ")", "arg_3", "=", "want_bytes", "(", "arg_0", ".", "sep", ")", "arg_1", "=", "arg_1", "+", "arg_3", "+", "arg_2", "return", "arg_1", "+", "arg_3", "+", "arg_0", ".", "get_Funcature", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Signs the given string and also attaches a time information.\"\"\"\n        arg_1 = want_bytes(arg_1)\n        arg_2 = base64_encode(int_to_bytes(arg_0.get_timestamp()))\n        arg_3 = want_bytes(arg_0.sep)\n        arg_1 = arg_1 + arg_3 + arg_2\n        return arg_1 + arg_3 + arg_0.get_Funcature(arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py", "identifier": "TimestampSigner.sign", "docstring": "Signs the given string and also attaches a time information.", "docstring_tokens": ["Signs", "the", "given", "string", "and", "also", "attaches", "a", "time", "information", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 257993}
{"url": "https://github.com/WGBH/wagtail-streamfieldtools/blob/192f86845532742b0b7d432bef3987357833b8ed/streamfield_tools/registry.py#L51-L57", "sha": "192f86845532742b0b7d432bef3987357833b8ed", "docstring_summary": "Registers `block` to `block_type` in the registry.", "language": "python", "parameters": "(self, block_type, block)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_verify_block", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_registry", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Registers `block` to `block_type` in the registry.\n        \"\"\"\n\n        arg_0._verify_block(arg_1, arg_2)\n        arg_0._registry[arg_1] = arg_2", "path": "streamfield_tools/registry.py", "identifier": "RegisteredBlockStreamFieldRegistry.register_block", "docstring": "Registers `block` to `block_type` in the registry.", "docstring_tokens": ["Registers", "block", "to", "block_type", "in", "the", "registry", "."], "nwo": "WGBH/wagtail-streamfieldtools", "score": 0.23137166388621372, "idx": 257994}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L221-L229", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Get all the machines that this topology is running on.\n    These are the hosts of all the stmgrs.", "language": "python", "parameters": "(self)", "return_statement": "return []", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "physical_plan", ":", "arg_1", "=", "list", "(", "arg_0", ".", "physical_plan", ".", "stmgrs", ")", "return", "map", "(", "lambda", "s", ":", "s", ".", "host_name", ",", "arg_1", ")", "return", "[", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Get all the machines that this topology is running on.\n    These are the hosts of all the stmgrs.\n    \"\"\"\n    if arg_0.physical_plan:\n      arg_1 = list(arg_0.physical_plan.stmgrs)\n      return map(lambda s: s.host_name, arg_1)\n    return []", "path": "heron/tools/tracker/src/python/topology.py", "identifier": "Topology.get_machines", "docstring": "Get all the machines that this topology is running on.\n    These are the hosts of all the stmgrs.", "docstring_tokens": ["Get", "all", "the", "machines", "that", "this", "topology", "is", "running", "on", ".", "These", "are", "the", "hosts", "of", "all", "the", "stmgrs", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 257995}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/logscrapedaily.py#L516-L589", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "scan through the java output text and extract the bad java messages that may or may not happened when\n    unit tests are run.  It will not record any bad java messages that are stored in g_ok_java_messages.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "g_temp_filename", "global", "arg_10", "global", "g_java_start_text", "global", "g_ok_java_messages", "global", "g_java_general_bad_messages", "global", "g_java_general_bad_message_types", "global", "g_failure_occurred", "global", "g_java_message_type", "global", "g_all_java_message_type", "global", "arg_3", "arg_0", "=", "[", "]", "arg_1", "=", "[", "]", "if", "os", ".", "path", ".", "isfile", "(", "g_temp_filename", ")", ":", "arg_2", "=", "open", "(", "g_temp_filename", ",", "'r'", ")", "arg_3", "=", "False", "arg_4", "=", "\"\"", "arg_5", "=", "\"\"", "for", "arg_6", "in", "arg_2", ":", "if", "(", "g_java_start_text", "in", "arg_6", ")", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_6", ".", "partition", "(", "g_java_start_text", ")", "if", "len", "(", "arg_8", ")", ">", "0", ":", "if", "len", "(", "arg_10", ")", ">", "0", ":", "associate_test_with_java", "(", "arg_10", ",", "arg_0", ",", "arg_1", ")", "arg_10", "=", "arg_9", ".", "strip", "(", ")", "arg_0", "=", "[", "]", "arg_1", "=", "[", "]", "arg_11", "=", "arg_6", ".", "strip", "(", ")", ".", "split", "(", ")", "if", "(", "len", "(", "arg_11", ")", ">=", "6", ")", "and", "(", "arg_11", "[", "5", "]", "in", "g_all_java_message_type", ")", ":", "if", "arg_3", "==", "True", ":", "addJavaMessages", "(", "arg_4", ",", "arg_5", ",", "arg_0", ",", "arg_1", ")", "arg_4", "=", "\"\"", "arg_5", "=", "\"\"", "arg_3", "=", "False", "else", ":", "if", "arg_3", ":", "arg_4", "+=", "arg_6", "if", "(", "(", "len", "(", "arg_11", ")", ">", "5", ")", "and", "(", "arg_11", "[", "5", "]", "in", "g_java_message_type", ")", ")", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_6", ".", "partition", "(", "arg_11", "[", "5", "]", ")", "if", "arg_8", "and", "(", "len", "(", "arg_9", ".", "strip", "(", ")", ")", ">", "0", ")", ":", "arg_4", "+=", "arg_9", "arg_5", "=", "arg_11", "[", "5", "]", "arg_3", "=", "True", "arg_2", ".", "close", "(", ")"], "function": "def Func():\n    \"\"\"scan through the java output text and extract the bad java messages that may or may not happened when\n    unit tests are run.  It will not record any bad java messages that are stored in g_ok_java_messages.\n\n    :return: none\n    \"\"\"\n\n    global g_temp_filename\n    global arg_10\n    global g_java_start_text\n    global g_ok_java_messages\n    global g_java_general_bad_messages  # store bad java messages not associated with running a unit test\n    global g_java_general_bad_message_types\n    global g_failure_occurred\n    global g_java_message_type\n    global g_all_java_message_type\n    global arg_3\n\n    arg_0 = []      # store all bad java messages associated with running a unit test\n    arg_1 = [] # store all bad java message types associated with running a unit test\n\n    if os.path.isfile(g_temp_filename): # open temp file containing content of some java_*_0.out.txt\n        arg_2 = open(g_temp_filename,'r')\n\n        arg_3 = False    # denote if a multi-line message starts\n\n        arg_4 = \"\"\n        arg_5 = \"\"\n\n        for arg_6 in arg_2:\n\n            if (g_java_start_text in arg_6):\n                arg_7,arg_8,arg_9 = arg_6.partition(g_java_start_text)\n\n                if len(arg_8) > 0:\n                    if len(arg_10) > 0: # a new unit test is being started.  Save old info and move on\n                        associate_test_with_java(arg_10,arg_0,arg_1)\n        \n                    arg_10 = arg_9.strip() # record the test name\n                    \n                    arg_0 = []\n                    arg_1 = []\n        \n            arg_11 = arg_6.strip().split()\n\n            if (len(arg_11) >= 6) and (arg_11[5] in g_all_java_message_type):\n                if arg_3 == True:    # at the end of last message fragment\n                    addJavaMessages(arg_4,arg_5,arg_0,arg_1)\n                    arg_4 = \"\"\n                    arg_5 = \"\"\n\n                # start of new message fragment\n                arg_3 = False\n            else: # non standard output.  Continuation of last java message, add it to bad java message list\n                if arg_3:\n\n                    arg_4 += arg_6    # add more java message here\n                    # if len(g_current_testname) == 0:\n                    #     addJavaMessages(each_line.strip(),\"\",java_messages,java_message_types)\n                    # else:\n                    #     addJavaMessages(each_line.strip(),\"\",java_messages,java_message_types)\n\n            if ((len(arg_11) > 5) and (arg_11[5] in g_java_message_type)):  # find a bad java message\n                arg_7,arg_8,arg_9 = arg_6.partition(arg_11[5])    # can be WARN,ERRR,FATAL,TRACE\n\n                if arg_8 and (len(arg_9.strip()) > 0):\n                    arg_4 += arg_9\n                    arg_5 = arg_11[5]\n#                    if (tempMessage not in g_ok_java_messages[\"general\"]):  # found new bad messages that cannot be ignored\n                    arg_3 = True\n\n                        # add tempMessage to bad java message list\n#                        addJavaMessages(tempMessage,temp_strings[5],java_messages,java_message_types)\n        arg_2.close()", "path": "scripts/logscrapedaily.py", "identifier": "grab_java_message", "docstring": "scan through the java output text and extract the bad java messages that may or may not happened when\n    unit tests are run.  It will not record any bad java messages that are stored in g_ok_java_messages.\n\n    :return: none", "docstring_tokens": ["scan", "through", "the", "java", "output", "text", "and", "extract", "the", "bad", "java", "messages", "that", "may", "or", "may", "not", "happened", "when", "unit", "tests", "are", "run", ".", "It", "will", "not", "record", "any", "bad", "java", "messages", "that", "are", "stored", "in", "g_ok_java_messages", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 257996}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1983-L1990", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Adds a new custom completer function.", "language": "python", "parameters": "(self, completer, pos=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "arg_3", "=", "types", ".", "MethodType", "(", "arg_1", ",", "arg_0", ".", "Completer", ")", "arg_0", ".", "Completer", ".", "matchers", ".", "insert", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        \"\"\"Adds a new custom completer function.\n\n        The position argument (defaults to 0) is the index in the completers\n        list where you want the completer to be inserted.\"\"\"\n\n        arg_3 = types.MethodType(arg_1,arg_0.Completer)\n        arg_0.Completer.matchers.insert(arg_2,arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.set_custom_completer", "docstring": "Adds a new custom completer function.\n\n        The position argument (defaults to 0) is the index in the completers\n        list where you want the completer to be inserted.", "docstring_tokens": ["Adds", "a", "new", "custom", "completer", "function", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 257997}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/beziereditor/__init__.py#L844-L895", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Freehand sketching.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "_ctx", ".", "_ns", "[", "\"mousedown\"", "]", ":", "arg_1", ",", "arg_2", "=", "mouse", "(", ")", "if", "arg_0", ".", "show_grid", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "grid", ".", "snap", "(", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "freehand_move", "==", "True", ":", "arg_3", "=", "MOVETO", "arg_0", ".", "freehand_move", "=", "False", "else", ":", "arg_3", "=", "LINETO", "arg_5", "=", "PathElement", "(", ")", "if", "arg_3", "!=", "MOVETO", ":", "arg_5", ".", "freehand", "=", "True", "else", ":", "arg_5", ".", "freehand", "=", "False", "arg_5", ".", "cmd", "=", "arg_3", "arg_5", ".", "x", "=", "arg_1", "arg_5", ".", "y", "=", "arg_2", "arg_5", ".", "ctrl1", "=", "Point", "(", "arg_1", ",", "arg_2", ")", "arg_5", ".", "ctrl2", "=", "Point", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_points", ".", "append", "(", "arg_5", ")", "arg_9", "=", "4", "_ctx", ".", "nofill", "(", ")", "_ctx", ".", "stroke", "(", "arg_0", ".", "handle_color", ")", "_ctx", ".", "oval", "(", "arg_5", ".", "x", "-", "arg_9", ",", "arg_5", ".", "y", "-", "arg_9", ",", "arg_9", "*", "2", ",", "arg_9", "*", "2", ")", "_ctx", ".", "fontsize", "(", "9", ")", "_ctx", ".", "fill", "(", "arg_0", ".", "handle_color", ")", "_ctx", ".", "text", "(", "\" (\"", "+", "str", "(", "int", "(", "arg_5", ".", "x", ")", ")", "+", "\", \"", "+", "str", "(", "int", "(", "arg_5", ".", "y", ")", ")", "+", "\")\"", ",", "arg_5", ".", "x", "+", "arg_9", ",", "arg_5", ".", "y", ")", "arg_0", ".", "_dirty", "=", "True", "else", ":", "arg_0", ".", "freehand_move", "=", "True", "if", "arg_0", ".", "_dirty", ":", "arg_0", ".", "_points", "[", "-", "1", "]", ".", "freehand", "=", "False", "arg_0", ".", "export_svg", "(", ")", "arg_0", ".", "_dirty", "=", "False"], "function": "def Func(arg_0):\n        \n        \"\"\" Freehand sketching.\n        \"\"\"\n        \n        if _ctx._ns[\"mousedown\"]:\n            \n            arg_1, arg_2 = mouse()\n            if arg_0.show_grid:\n                arg_1, arg_2 = arg_0.grid.snap(arg_1, arg_2)\n            \n            if arg_0.freehand_move == True:\n                arg_3 = MOVETO\n                arg_0.freehand_move = False\n            else:\n                arg_3 = LINETO\n            \n            # Add a new LINETO to the path,\n            # except when starting to draw,\n            # then a MOVETO is added to the path.\n            arg_5 = PathElement()\n            if arg_3 != MOVETO:\n                arg_5.freehand = True # Used when mixed with curve drawing.\n            else:\n                arg_5.freehand = False\n            arg_5.cmd = arg_3\n            arg_5.x = arg_1\n            arg_5.y = arg_2\n            arg_5.ctrl1 = Point(arg_1,arg_2)\n            arg_5.ctrl2 = Point(arg_1,arg_2)\n            arg_0._points.append(arg_5)\n            \n            # Draw the current location of the cursor.\n            arg_9 = 4\n            _ctx.nofill()\n            _ctx.stroke(arg_0.handle_color)\n            _ctx.oval(arg_5.x-arg_9, arg_5.y-arg_9, arg_9*2, arg_9*2)\n            _ctx.fontsize(9)\n            _ctx.fill(arg_0.handle_color)\n            _ctx.text(\" (\"+str(int(arg_5.x))+\", \"+str(int(arg_5.y))+\")\", arg_5.x+arg_9, arg_5.y)\n        \n            arg_0._dirty = True\n        \n        else:\n\n            # Export the updated drawing,\n            # remember to do a MOVETO on the next interaction.\n            arg_0.freehand_move = True\n            if arg_0._dirty:\n                arg_0._points[-1].freehand = False\n                arg_0.export_svg()\n                arg_0._dirty = False", "path": "lib/beziereditor/__init__.py", "identifier": "BezierPathEditor.draw_freehand", "docstring": "Freehand sketching.", "docstring_tokens": ["Freehand", "sketching", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 257998}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/measurement_get.py#L202-L244", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Output results in JSON format", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Element", "(", "'results'", ")", "arg_3", "=", "Comment", "(", "'Generated by TrueSight Pulse measurement-get CLI'", ")", "arg_2", ".", "append", "(", "arg_3", ")", "arg_4", "=", "SubElement", "(", "arg_2", ",", "'aggregates'", ")", "arg_5", "=", "SubElement", "(", "arg_4", ",", "'aggregate'", ")", "arg_6", "=", "SubElement", "(", "arg_5", ",", "'measurements'", ")", "arg_7", "=", "json", ".", "loads", "(", "arg_1", ")", "arg_8", "=", "arg_0", ".", "_metric_name", "for", "arg_9", "in", "arg_7", "[", "'result'", "]", "[", "'aggregates'", "]", "[", "'key'", "]", ":", "arg_10", "=", "arg_0", ".", "_format_timestamp", "(", "arg_9", "[", "0", "]", "[", "0", "]", ")", "for", "arg_11", "in", "arg_9", "[", "1", "]", ":", "arg_12", "=", "SubElement", "(", "arg_6", ",", "'measure'", ")", "arg_13", "=", "arg_11", "[", "0", "]", "arg_14", "=", "str", "(", "arg_11", "[", "1", "]", ")", "arg_15", "=", "SubElement", "(", "arg_12", ",", "'timestamp'", ")", "arg_15", ".", "text", "=", "str", "(", "arg_10", ")", "arg_16", "=", "SubElement", "(", "arg_12", ",", "'metric'", ")", "arg_16", ".", "text", "=", "arg_8", "arg_16", "=", "SubElement", "(", "arg_12", ",", "'aggregate'", ")", "arg_16", ".", "text", "=", "arg_0", ".", "aggregate", "arg_17", "=", "SubElement", "(", "arg_12", ",", "'source'", ")", "arg_17", ".", "text", "=", "arg_13", "arg_18", "=", "SubElement", "(", "arg_12", ",", "'value'", ")", "arg_18", ".", "text", "=", "arg_14", "arg_19", "=", "ElementTree", ".", "tostring", "(", "arg_2", ",", "'utf-8'", ")", "arg_20", "=", "minidom", ".", "parseString", "(", "arg_19", ")", "arg_21", "=", "arg_20", ".", "toprettyxml", "(", "indent", "=", "\" \"", ")", "print", "(", "arg_0", ".", "colorize_xml", "(", "arg_21", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Output results in JSON format\n        \"\"\"\n\n        # Create the main document nodes\n        arg_2 = Element('results')\n        arg_3 = Comment('Generated by TrueSight Pulse measurement-get CLI')\n        arg_2.append(arg_3)\n        arg_4 = SubElement(arg_2, 'aggregates')\n        arg_5 = SubElement(arg_4, 'aggregate')\n        arg_6 = SubElement(arg_5, 'measurements')\n\n        # Parse the JSON result so we can translate to XML\n        arg_7 = json.loads(arg_1)\n\n        # Current only support a single metric, if we move to the batch API then\n        # we can handle multiple\n        arg_8 = arg_0._metric_name\n\n        # Loop through the aggregates one row per timestamp, and 1 or more source/value pairs\n        for arg_9 in arg_7['result']['aggregates']['key']:\n            arg_10 = arg_0._format_timestamp(arg_9[0][0])\n            for arg_11 in arg_9[1]:\n                # Each timestamp, metric, source, values is placed in a measure tag\n                arg_12 = SubElement(arg_6, 'measure')\n                arg_13 = arg_11[0]\n                arg_14 = str(arg_11[1])\n                arg_15 = SubElement(arg_12, 'timestamp')\n                arg_15.text = str(arg_10)\n                arg_16 = SubElement(arg_12, 'metric')\n                arg_16.text = arg_8\n                arg_16 = SubElement(arg_12, 'aggregate')\n                arg_16.text = arg_0.aggregate\n                arg_17 = SubElement(arg_12, 'source')\n                arg_17.text = arg_13\n                arg_18 = SubElement(arg_12, 'value')\n                arg_18.text = arg_14\n\n        arg_19 = ElementTree.tostring(arg_2, 'utf-8')\n        arg_20 = minidom.parseString(arg_19)\n        arg_21 = arg_20.toprettyxml(indent=\" \")\n        print(arg_0.colorize_xml(arg_21))", "path": "boundary/measurement_get.py", "identifier": "MeasurementGet.output_xml", "docstring": "Output results in JSON format", "docstring_tokens": ["Output", "results", "in", "JSON", "format"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 257999}
{"url": "https://github.com/amorison/loam/blob/a566c943a75e068a4510099331a1ddfe5bbbdd94/loam/manager.py#L351-L364", "sha": "a566c943a75e068a4510099331a1ddfe5bbbdd94", "docstring_summary": "Read a config file and set config values accordingly.", "language": "python", "parameters": "(self, cfile)", "return_statement": "return conf_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "exists", "(", ")", ":", "return", "{", "}", "try", ":", "arg_2", "=", "toml", ".", "load", "(", "str", "(", "arg_1", ")", ")", "except", "toml", ".", "TomlDecodeError", ":", "return", "None", "arg_0", ".", "update_", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read a config file and set config values accordingly.\n\n        Returns:\n            dict: content of config file.\n        \"\"\"\n        if not arg_1.exists():\n            return {}\n        try:\n            arg_2 = toml.load(str(arg_1))\n        except toml.TomlDecodeError:\n            return None\n        arg_0.update_(arg_2)\n        return arg_2", "path": "loam/manager.py", "identifier": "ConfigurationManager.read_config_", "docstring": "Read a config file and set config values accordingly.\n\n        Returns:\n            dict: content of config file.", "docstring_tokens": ["Read", "a", "config", "file", "and", "set", "config", "values", "accordingly", "."], "nwo": "amorison/loam", "score": 0.14991498758945482, "idx": 258000}
{"url": "https://github.com/glottobank/python-newick/blob/e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702/src/newick.py#L347-L351", "sha": "e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702", "docstring_summary": "Set the name of all leaf nodes in the subtree to None.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "visit", "(", "lambda", "n", ":", "setattr", "(", "n", ",", "'name'", ",", "None", ")", ",", "lambda", "n", ":", "n", ".", "is_leaf", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Set the name of all leaf nodes in the subtree to None.\n        \"\"\"\n        arg_0.visit(lambda n: setattr(n, 'name', None), lambda n: n.is_leaf)", "path": "src/newick.py", "identifier": "Node.remove_leaf_names", "docstring": "Set the name of all leaf nodes in the subtree to None.", "docstring_tokens": ["Set", "the", "name", "of", "all", "leaf", "nodes", "in", "the", "subtree", "to", "None", "."], "nwo": "glottobank/python-newick", "score": 0.19358971820395612, "idx": 258001}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/pyUtils/arrayQuery.py#L20-L29", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "uniq operation with key selector", "language": "python", "parameters": "(iterable, fn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "set", "(", ")", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "arg_1", "(", "arg_3", ")", "if", "arg_4", "not", "in", "arg_2", ":", "arg_2", ".", "add", "(", "arg_4", ")", "yield", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    uniq operation with key selector\n    \"\"\"\n    arg_2 = set()\n    for arg_3 in arg_0:\n        arg_4 = arg_1(arg_3)\n        if arg_4 not in arg_2:\n            arg_2.add(arg_4)\n            yield arg_3", "path": "hwt/pyUtils/arrayQuery.py", "identifier": "distinctBy", "docstring": "uniq operation with key selector", "docstring_tokens": ["uniq", "operation", "with", "key", "selector"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 258002}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L421-L441", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Runs the model to generate an intermediate representation of x_t.", "language": "python", "parameters": "(self, inputs)", "return_statement": "return tf.reshape(out, expanded_shape)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", "[", "-", "3", ":", "]", "arg_3", "=", "tf", ".", "concat", "(", "(", "[", "-", "1", "]", ",", "arg_2", ")", ",", "axis", "=", "0", ")", "arg_4", "=", "tf", ".", "reshape", "(", "arg_1", ",", "arg_3", ")", "arg_4", "=", "arg_0", ".", "conv1", "(", "arg_4", ")", "arg_4", "=", "arg_0", ".", "conv2", "(", "arg_4", ")", "arg_4", "=", "arg_0", ".", "conv3", "(", "arg_4", ")", "arg_4", "=", "arg_0", ".", "conv4", "(", "arg_4", ")", "arg_5", "=", "tf", ".", "concat", "(", "(", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", "[", ":", "-", "3", "]", ",", "[", "-", "1", "]", ")", ",", "axis", "=", "0", ")", "return", "tf", ".", "reshape", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Runs the model to generate an intermediate representation of x_t.\n\n    Args:\n      inputs: A batch of image sequences `x_{1:T}` of shape\n        `[sample_shape, batch_size, timesteps, height, width,\n        channels]`.\n\n    Returns:\n      A batch of intermediate representations of shape [sample_shape,\n      batch_size, timesteps, hidden_size].\n    \"\"\"\n    arg_2 = tf.shape(input=arg_1)[-3:]\n    arg_3 = tf.concat(([-1], arg_2), axis=0)\n    arg_4 = tf.reshape(arg_1, arg_3)  # (sample*batch*T, h, w, c)\n    arg_4 = arg_0.conv1(arg_4)\n    arg_4 = arg_0.conv2(arg_4)\n    arg_4 = arg_0.conv3(arg_4)\n    arg_4 = arg_0.conv4(arg_4)\n    arg_5 = tf.concat((tf.shape(input=arg_1)[:-3], [-1]), axis=0)\n    return tf.reshape(arg_4, arg_5)", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "Compressor.call", "docstring": "Runs the model to generate an intermediate representation of x_t.\n\n    Args:\n      inputs: A batch of image sequences `x_{1:T}` of shape\n        `[sample_shape, batch_size, timesteps, height, width,\n        channels]`.\n\n    Returns:\n      A batch of intermediate representations of shape [sample_shape,\n      batch_size, timesteps, hidden_size].", "docstring_tokens": ["Runs", "the", "model", "to", "generate", "an", "intermediate", "representation", "of", "x_t", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258003}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/cluster.py#L34-L48", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Create H2OCluster object from a list of key-value pairs.", "language": "python", "parameters": "(keyvals)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "H2OCluster", "(", ")", "arg_1", ".", "_retrieved_at", "=", "time", ".", "time", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ":", "if", "arg_3", "in", "{", "\"__meta\"", ",", "\"_exclude_fields\"", ",", "\"__schema\"", "}", ":", "continue", "if", "arg_3", "in", "_cloud_v3_valid_keys", ":", "arg_1", ".", "_props", "[", "arg_3", "]", "=", "arg_4", "else", ":", "raise", "AttributeError", "(", "\"Attribute %s cannot be set on H2OCluster (= %r)\"", "%", "(", "arg_3", ",", "arg_4", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Create H2OCluster object from a list of key-value pairs.\n\n        TODO: This method should be moved into the base H2OResponse class.\n        \"\"\"\n        arg_1 = H2OCluster()\n        arg_1._retrieved_at = time.time()\n        for arg_3, arg_4 in arg_0:\n            if arg_3 in {\"__meta\", \"_exclude_fields\", \"__schema\"}: continue\n            if arg_3 in _cloud_v3_valid_keys:\n                arg_1._props[arg_3] = arg_4\n            else:\n                raise AttributeError(\"Attribute %s cannot be set on H2OCluster (= %r)\" % (arg_3, arg_4))\n        return arg_1", "path": "h2o-py/h2o/backend/cluster.py", "identifier": "H2OCluster.from_kvs", "docstring": "Create H2OCluster object from a list of key-value pairs.\n\n        TODO: This method should be moved into the base H2OResponse class.", "docstring_tokens": ["Create", "H2OCluster", "object", "from", "a", "list", "of", "key", "-", "value", "pairs", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258004}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L428-L569", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Automatically adds and subtracts missing & extra particles.", "language": "python", "parameters": "(st, max_iter=7, max_npart='calc', max_mem=2e8,\n                 always_check_remove=False, **kwargs)", "return_statement": "return total_changed, np.array(removed_poses), np.array(added_poses)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "7", ",", "arg_2", "=", "'calc'", ",", "arg_3", "=", "2e8", ",", "arg_4", "=", "False", ",", "**", "arg_5", ")", ":", "if", "arg_2", "==", "'calc'", ":", "arg_2", "=", "0.05", "*", "arg_0", ".", "obj_get_positions", "(", ")", ".", "shape", "[", "0", "]", "arg_6", "=", "0", "arg_7", "=", "0", "arg_8", "=", "[", "]", "arg_9", "=", "[", "]", "arg_10", "=", "[", "]", "arg_11", "=", "1", "for", "arg_12", "in", "range", "(", "arg_1", ")", ":", "if", "(", "arg_11", "!=", "0", ")", "or", "(", "arg_4", ")", ":", "arg_11", ",", "arg_13", "=", "remove_bad_particles", "(", "arg_0", ",", "**", "arg_5", ")", "arg_14", ",", "arg_15", "=", "add_missing_particles", "(", "arg_0", ",", "**", "arg_5", ")", "arg_16", "=", "arg_14", "+", "arg_11", "arg_8", ".", "extend", "(", "arg_13", ")", "arg_9", ".", "extend", "(", "arg_15", ")", "arg_6", "+=", "arg_16", "arg_7", "+=", "arg_16", "if", "arg_16", "==", "0", ":", "break", "elif", "arg_7", ">", "arg_2", ":", "arg_7", "*=", "0", "CLOG", ".", "info", "(", "'Start Func optimization.'", ")", "opt", ".", "do_levmarq", "(", "arg_0", ",", "opt", ".", "name_globals", "(", "arg_0", ",", "remove_params", "=", "arg_0", ".", "get", "(", "'psf'", ")", ".", "params", ")", ",", "arg_1", "=", "1", ",", "run_length", "=", "4", ",", "num_eig_dirs", "=", "3", ",", "arg_3", "=", "arg_3", ",", "eig_update_frequency", "=", "2", ",", "rz_order", "=", "0", ",", "use_accel", "=", "True", ")", "CLOG", ".", "info", "(", "'After optimization:\\t{:.6}'", ".", "format", "(", "arg_0", ".", "error", ")", ")", "for", "arg_17", "in", "arg_9", ":", "arg_18", "=", "arg_0", ".", "obj_closest_particle", "(", "arg_17", ")", "opt", ".", "do_levmarq_particles", "(", "arg_0", ",", "np", ".", "array", "(", "[", "arg_18", "]", ")", ",", "arg_1", "=", "2", ",", "damping", "=", "0.3", ")", "arg_10", ".", "append", "(", "arg_0", ".", "obj_get_positions", "(", ")", "[", "arg_18", "]", ")", "return", "arg_6", ",", "np", ".", "array", "(", "arg_8", ")", ",", "np", ".", "array", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1=7, arg_2='calc', arg_3=2e8,\n                 arg_4=False, **arg_5):\n    \"\"\"\n    Automatically adds and subtracts missing & extra particles.\n\n    Operates by removing bad particles then adding missing particles on\n    repeat, until either no particles are added/removed or after `max_iter`\n    attempts.\n\n    Parameters\n    ----------\n    st: :class:`peri.states.State`\n        The state to add and subtract particles to.\n    max_iter : Int, optional\n        The maximum number of add-subtract loops to use. Default is 7.\n        Terminates after either max_iter loops or when nothing has changed.\n    max_npart : Int or 'calc', optional\n        The maximum number of particles to add before optimizing the non-psf\n        globals. Default is ``'calc'``, which uses 5% of the initial number\n        of particles.\n    max_mem : Int, optional\n        The maximum memory to use for optimization after adding max_npart\n        particles. Default is 2e8.\n    always_check_remove : Bool, optional\n        Set to True to always check whether to remove particles. If ``False``,\n        only checks for removal while particles were removed on the previous\n        attempt. Default is False.\n\n    Other Parameters\n    ----------------\n    invert : Bool, optional\n        ``True`` if the particles are dark on a bright background, ``False``\n        if they are bright on a dark background. Default is ``True``.\n    min_rad : Float, optional\n        Particles with radius below ``min_rad`` are automatically deleted.\n        Default is ``'calc'`` = median rad - 25* radius std.\n    max_rad : Float, optional\n        Particles with radius above ``max_rad`` are automatically deleted.\n        Default is ``'calc'`` = median rad + 15* radius std, but you should\n        change this for your particle sizes.\n\n    min_edge_dist : Float, optional\n        Particles closer to the edge of the padded image than this are\n        automatically deleted. Default is 2.0.\n    check_rad_cutoff : 2-element float list.\n        Particles with ``radii < check_rad_cutoff[0]`` or ``> check...[1]``\n        are checked if they should be deleted (not automatic). Default is\n        ``[3.5, 15]``.\n    check_outside_im : Bool, optional\n        Set to True to check whether to delete particles whose positions are\n        outside the un-padded image.\n\n    rad : Float, optional\n        The initial radius for added particles; added particles radii are\n        not fit until the end of ``Func``. Default is ``'calc'``,\n        which uses the median radii of active particles.\n\n    tries : Int, optional\n        The number of particles to attempt to remove or add, per iteration.\n        Default is 50.\n\n    im_change_frac : Float, optional\n        How good the change in error needs to be relative to the change in\n        the difference image. Default is 0.2; i.e. if the error does not\n        decrease by 20% of the change in the difference image, do not add\n        the particle.\n\n    min_derr : Float, optional\n        The minimum change in the state's error to keep a particle in the\n        image. Default is ``'3sig'`` which uses ``3*st.sigma``.\n\n    do_opt : Bool, optional\n        Set to False to avoid optimizing particle positions after adding.\n    minmass : Float, optional\n        The minimum mass for a particle to be identified as a feature,\n        as used by trackpy. Defaults to a decent guess.\n\n    use_tp : Bool, optional\n        Set to True to use trackpy to find missing particles inside the\n        image. Not recommended since trackpy deliberately cuts out particles\n        at the edge of the image. Default is ``False``.\n\n    Returns\n    -------\n    total_changed : Int\n        The total number of adds and subtracts done on the data. Not the\n        same as ``changed_inds.size`` since the same particle or particle\n        index can be added/subtracted multiple times.\n    added_positions : [N_added,3] numpy.ndarray\n        The positions of particles that have been added at any point in the\n        add-subtract cycle.\n    removed_positions : [N_added,3] numpy.ndarray\n        The positions of particles that have been removed at any point in\n        the add-subtract cycle.\n\n    Notes\n    ------\n    Occasionally after the intial featuring a cluster of particles is\n    featured as 1 big particle. To fix these mistakes, it helps to set\n    max_rad to a physical value. This removes the big particle and allows\n    it to be re-featured by (several passes of) the adds.\n\n    The added/removed positions returned are whether or not the position\n    has been added or removed ever. It's possible that a position is\n    added, then removed during a later iteration.\n    \"\"\"\n    if arg_2 == 'calc':\n        arg_2 = 0.05 * arg_0.obj_get_positions().shape[0]\n\n    arg_6 = 0\n    arg_7 = 0\n    arg_8 = []\n    arg_9 = []\n    arg_10 = []\n\n    arg_11 = 1  # Check removal on the first loop\n    for arg_12 in range(arg_1):\n        if (arg_11 != 0) or (arg_4):\n            arg_11, arg_13 = remove_bad_particles(arg_0, **arg_5)\n        arg_14, arg_15 = add_missing_particles(arg_0, **arg_5)\n        arg_16 = arg_14 + arg_11\n        arg_8.extend(arg_13)\n        arg_9.extend(arg_15)\n        arg_6 += arg_16\n        arg_7 += arg_16\n        if arg_16 == 0:\n            break\n        elif arg_7 > arg_2:\n            arg_7 *= 0\n            CLOG.info('Start Func optimization.')\n            opt.do_levmarq(arg_0, opt.name_globals(arg_0, remove_params=arg_0.get(\n                    'psf').params), arg_1=1, run_length=4, num_eig_dirs=3,\n                    arg_3=arg_3, eig_update_frequency=2, rz_order=0,\n                    use_accel=True)\n            CLOG.info('After optimization:\\t{:.6}'.format(arg_0.error))\n\n    # Optimize the added particles' radii:\n    for arg_17 in arg_9:\n        arg_18 = arg_0.obj_closest_particle(arg_17)\n        opt.do_levmarq_particles(arg_0, np.array([arg_18]), arg_1=2, damping=0.3)\n        arg_10.append(arg_0.obj_get_positions()[arg_18])\n    return arg_6, np.array(arg_8), np.array(arg_10)", "path": "peri/opt/addsubtract.py", "identifier": "add_subtract", "docstring": "Automatically adds and subtracts missing & extra particles.\n\n    Operates by removing bad particles then adding missing particles on\n    repeat, until either no particles are added/removed or after `max_iter`\n    attempts.\n\n    Parameters\n    ----------\n    st: :class:`peri.states.State`\n        The state to add and subtract particles to.\n    max_iter : Int, optional\n        The maximum number of add-subtract loops to use. Default is 7.\n        Terminates after either max_iter loops or when nothing has changed.\n    max_npart : Int or 'calc', optional\n        The maximum number of particles to add before optimizing the non-psf\n        globals. Default is ``'calc'``, which uses 5% of the initial number\n        of particles.\n    max_mem : Int, optional\n        The maximum memory to use for optimization after adding max_npart\n        particles. Default is 2e8.\n    always_check_remove : Bool, optional\n        Set to True to always check whether to remove particles. If ``False``,\n        only checks for removal while particles were removed on the previous\n        attempt. Default is False.\n\n    Other Parameters\n    ----------------\n    invert : Bool, optional\n        ``True`` if the particles are dark on a bright background, ``False``\n        if they are bright on a dark background. Default is ``True``.\n    min_rad : Float, optional\n        Particles with radius below ``min_rad`` are automatically deleted.\n        Default is ``'calc'`` = median rad - 25* radius std.\n    max_rad : Float, optional\n        Particles with radius above ``max_rad`` are automatically deleted.\n        Default is ``'calc'`` = median rad + 15* radius std, but you should\n        change this for your particle sizes.\n\n    min_edge_dist : Float, optional\n        Particles closer to the edge of the padded image than this are\n        automatically deleted. Default is 2.0.\n    check_rad_cutoff : 2-element float list.\n        Particles with ``radii < check_rad_cutoff[0]`` or ``> check...[1]``\n        are checked if they should be deleted (not automatic). Default is\n        ``[3.5, 15]``.\n    check_outside_im : Bool, optional\n        Set to True to check whether to delete particles whose positions are\n        outside the un-padded image.\n\n    rad : Float, optional\n        The initial radius for added particles; added particles radii are\n        not fit until the end of ``add_subtract``. Default is ``'calc'``,\n        which uses the median radii of active particles.\n\n    tries : Int, optional\n        The number of particles to attempt to remove or add, per iteration.\n        Default is 50.\n\n    im_change_frac : Float, optional\n        How good the change in error needs to be relative to the change in\n        the difference image. Default is 0.2; i.e. if the error does not\n        decrease by 20% of the change in the difference image, do not add\n        the particle.\n\n    min_derr : Float, optional\n        The minimum change in the state's error to keep a particle in the\n        image. Default is ``'3sig'`` which uses ``3*st.sigma``.\n\n    do_opt : Bool, optional\n        Set to False to avoid optimizing particle positions after adding.\n    minmass : Float, optional\n        The minimum mass for a particle to be identified as a feature,\n        as used by trackpy. Defaults to a decent guess.\n\n    use_tp : Bool, optional\n        Set to True to use trackpy to find missing particles inside the\n        image. Not recommended since trackpy deliberately cuts out particles\n        at the edge of the image. Default is ``False``.\n\n    Returns\n    -------\n    total_changed : Int\n        The total number of adds and subtracts done on the data. Not the\n        same as ``changed_inds.size`` since the same particle or particle\n        index can be added/subtracted multiple times.\n    added_positions : [N_added,3] numpy.ndarray\n        The positions of particles that have been added at any point in the\n        add-subtract cycle.\n    removed_positions : [N_added,3] numpy.ndarray\n        The positions of particles that have been removed at any point in\n        the add-subtract cycle.\n\n    Notes\n    ------\n    Occasionally after the intial featuring a cluster of particles is\n    featured as 1 big particle. To fix these mistakes, it helps to set\n    max_rad to a physical value. This removes the big particle and allows\n    it to be re-featured by (several passes of) the adds.\n\n    The added/removed positions returned are whether or not the position\n    has been added or removed ever. It's possible that a position is\n    added, then removed during a later iteration.", "docstring_tokens": ["Automatically", "adds", "and", "subtracts", "missing", "&", "extra", "particles", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 258005}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_sre.py#L74-L83", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Scan through string looking for a location where this regular\n        expression produces a match, and return a corresponding MatchObject\n        instance. Return None if no position in the string matches the\n        pattern.", "language": "python", "parameters": "(self, string, pos=0, endpos=sys.maxint)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "arg_4", ".", "maxint", ")", ":", "arg_6", "=", "_State", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_0", ".", "flags", ")", "if", "arg_6", ".", "Func", "(", "arg_0", ".", "_code", ")", ":", "return", "SRE_Match", "(", "arg_0", ",", "arg_6", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=arg_4.maxint):\n        \"\"\"Scan through string looking for a location where this regular\n        expression produces a match, and return a corresponding MatchObject\n        instance. Return None if no position in the string matches the\n        pattern.\"\"\"\n        arg_6 = _State(arg_1, arg_2, arg_3, arg_0.flags)\n        if arg_6.Func(arg_0._code):\n            return SRE_Match(arg_0, arg_6)\n        else:\n            return None", "path": "third_party/pypy/_sre.py", "identifier": "SRE_Pattern.search", "docstring": "Scan through string looking for a location where this regular\n        expression produces a match, and return a corresponding MatchObject\n        instance. Return None if no position in the string matches the\n        pattern.", "docstring_tokens": ["Scan", "through", "string", "looking", "for", "a", "location", "where", "this", "regular", "expression", "produces", "a", "match", "and", "return", "a", "corresponding", "MatchObject", "instance", ".", "Return", "None", "if", "no", "position", "in", "the", "string", "matches", "the", "pattern", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258006}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L281-L291", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "It's always OK to include these headers", "language": "python", "parameters": "(self)", "return_statement": "return _headers", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"User-Agent\"", ":", "\"Pyzotero/%s\"", "%", "__version__", ",", "\"Zotero-API-Version\"", ":", "\"%s\"", "%", "__api_version__", ",", "}", "if", "arg_0", ".", "api_key", ":", "arg_1", "[", "\"Authorization\"", "]", "=", "\"Bearer %s\"", "%", "arg_0", ".", "api_key", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        It's always OK to include these headers\n        \"\"\"\n        arg_1 = {\n            \"User-Agent\": \"Pyzotero/%s\" % __version__,\n            \"Zotero-API-Version\": \"%s\" % __api_version__,\n        }\n        if arg_0.api_key:\n            arg_1[\"Authorization\"] = \"Bearer %s\" % arg_0.api_key\n        return arg_1", "path": "pyzotero/zotero.py", "identifier": "Zotero.default_headers", "docstring": "It's always OK to include these headers", "docstring_tokens": ["It", "s", "always", "OK", "to", "include", "these", "headers"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 258007}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/inspector.py#L73-L88", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Add the object and all their childs", "language": "python", "parameters": "(self, obj=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "arg_0", ".", "root_obj", "=", "arg_1", "else", ":", "arg_1", "=", "arg_0", ".", "root_obj", "arg_0", ".", "tree", ".", "DeleteAllItems", "(", ")", "arg_0", ".", "root", "=", "arg_0", ".", "tree", ".", "AddRoot", "(", "\"application\"", ")", "arg_0", ".", "tree", ".", "SetItemText", "(", "arg_0", ".", "root", ",", "\"App\"", ",", "1", ")", "arg_0", ".", "tree", ".", "SetItemText", "(", "arg_0", ".", "root", ",", "\"col 2 root\"", ",", "2", ")", "arg_0", ".", "build_tree", "(", "arg_0", ".", "root", ",", "arg_1", ")", "arg_0", ".", "tree", ".", "Expand", "(", "arg_0", ".", "root", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"Add the object and all their childs\"\n        # if not obj is given, do a full reload using the current root\n        if arg_1:\n            arg_0.root_obj = arg_1\n        else:\n            arg_1 = arg_0.root_obj\n        arg_0.tree.DeleteAllItems()\n        arg_0.root = arg_0.tree.AddRoot(\"application\")\n        arg_0.tree.SetItemText(arg_0.root, \"App\", 1)\n        arg_0.tree.SetItemText(arg_0.root, \"col 2 root\", 2)\n        #self.tree.SetItemImage(self.root, fldridx, which = wx.TreeItemIcon_Normal)\n        #self.tree.SetItemImage(self.root, fldropenidx, which = wx.TreeItemIcon_Expanded)\n\n        arg_0.build_tree(arg_0.root, arg_1)\n        arg_0.tree.Expand(arg_0.root)", "path": "gui/tools/inspector.py", "identifier": "InspectorPanel.load_object", "docstring": "Add the object and all their childs", "docstring_tokens": ["Add", "the", "object", "and", "all", "their", "childs"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 258008}
{"url": "https://github.com/nickw444/flask-ldap3-login/blob/3cf0faff52d0e04d4813119a2ba36d706e6fb31f/flask_ldap3_login/__init__.py#L358-L411", "sha": "3cf0faff52d0e04d4813119a2ba36d706e6fb31f", "docstring_summary": "Performs a direct bind. We can do this since the RDN is the same\n        as the login attribute. Hence we just string together a dn to find\n        this user with.", "language": "python", "parameters": "(self, username, password)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "'{rdn}={username},{user_search_dn}'", ".", "format", "(", "rdn", "=", "arg_0", ".", "config", ".", "get", "(", "'LDAP_USER_RDN_ATTR'", ")", ",", "arg_1", "=", "arg_1", ",", "user_search_dn", "=", "arg_0", ".", "full_user_search_dn", ",", ")", "arg_4", "=", "arg_0", ".", "_make_connection", "(", "arg_3", "=", "arg_3", ",", "bind_password", "=", "arg_2", ",", ")", "arg_5", "=", "AuthenticationResponse", "(", ")", "try", ":", "arg_4", ".", "bind", "(", ")", "log", ".", "debug", "(", "\"Authentication was successful for user '{0}'\"", ".", "format", "(", "arg_1", ")", ")", "arg_5", ".", "status", "=", "AuthenticationResponseStatus", ".", "success", "arg_7", "=", "arg_0", ".", "get_user_info", "(", "dn", "=", "arg_3", ",", "_connection", "=", "arg_4", ")", "arg_5", ".", "user_dn", "=", "arg_3", "arg_5", ".", "user_id", "=", "arg_1", "arg_5", ".", "user_info", "=", "arg_7", "if", "arg_0", ".", "config", ".", "get", "(", "'LDAP_SEARCH_FOR_GROUPS'", ")", ":", "arg_5", ".", "user_groups", "=", "arg_0", ".", "get_user_groups", "(", "dn", "=", "arg_3", ",", "_connection", "=", "arg_4", ")", "except", "ldap3", ".", "core", ".", "exceptions", ".", "LDAPInvalidCredentialsResult", ":", "log", ".", "debug", "(", "\"Authentication was not successful for user '{0}'\"", ".", "format", "(", "arg_1", ")", ")", "arg_5", ".", "status", "=", "AuthenticationResponseStatus", ".", "fail", "except", "Exception", "as", "e", ":", "log", ".", "error", "(", "e", ")", "arg_5", ".", "status", "=", "AuthenticationResponseStatus", ".", "fail", "arg_0", ".", "destroy_connection", "(", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Performs a direct bind. We can do this since the RDN is the same\n        as the login attribute. Hence we just string together a dn to find\n        this user with.\n\n        Args:\n            username (str): Username of the user to bind (the field specified\n                as LDAP_BIND_RDN_ATTR)\n            password (str): User's password to bind with.\n\n        Returns:\n            AuthenticationResponse\n        \"\"\"\n\n        arg_3 = '{rdn}={username},{user_search_dn}'.format(\n            rdn=arg_0.config.get('LDAP_USER_RDN_ATTR'),\n            arg_1=arg_1,\n            user_search_dn=arg_0.full_user_search_dn,\n        )\n\n        arg_4 = arg_0._make_connection(\n            arg_3=arg_3,\n            bind_password=arg_2,\n        )\n\n        arg_5 = AuthenticationResponse()\n\n        try:\n            arg_4.bind()\n            log.debug(\n                \"Authentication was successful for user '{0}'\".format(arg_1))\n            arg_5.status = AuthenticationResponseStatus.success\n            # Get user info here.\n\n            arg_7 = arg_0.get_user_info(\n                dn=arg_3, _connection=arg_4)\n            arg_5.user_dn = arg_3\n            arg_5.user_id = arg_1\n            arg_5.user_info = arg_7\n            if arg_0.config.get('LDAP_SEARCH_FOR_GROUPS'):\n                arg_5.user_groups = arg_0.get_user_groups(\n                    dn=arg_3, _connection=arg_4)\n\n        except ldap3.core.exceptions.LDAPInvalidCredentialsResult:\n            log.debug(\n                \"Authentication was not successful for user '{0}'\".format(arg_1))\n            arg_5.status = AuthenticationResponseStatus.fail\n        except Exception as e:\n            log.error(e)\n            arg_5.status = AuthenticationResponseStatus.fail\n\n        arg_0.destroy_connection(arg_4)\n        return arg_5", "path": "flask_ldap3_login/__init__.py", "identifier": "LDAP3LoginManager.authenticate_direct_bind", "docstring": "Performs a direct bind. We can do this since the RDN is the same\n        as the login attribute. Hence we just string together a dn to find\n        this user with.\n\n        Args:\n            username (str): Username of the user to bind (the field specified\n                as LDAP_BIND_RDN_ATTR)\n            password (str): User's password to bind with.\n\n        Returns:\n            AuthenticationResponse", "docstring_tokens": ["Performs", "a", "direct", "bind", ".", "We", "can", "do", "this", "since", "the", "RDN", "is", "the", "same", "as", "the", "login", "attribute", ".", "Hence", "we", "just", "string", "together", "a", "dn", "to", "find", "this", "user", "with", "."], "nwo": "nickw444/flask-ldap3-login", "score": 0.51975183030278, "idx": 258009}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L440-L449", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "module predict, return the predict label", "language": "python", "parameters": "(self, data_rdd)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "callBigDlFunc", "(", "arg_0", ".", "bigdl_type", ",", "\"modelPredictClass\"", ",", "arg_0", ".", "value", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        module predict, return the predict label\n\n        :param data_rdd: the data to be predict.\n        :return: An RDD represent the predict label.\n        \"\"\"\n        arg_2 = callBigDlFunc(arg_0.bigdl_type,\n                               \"modelPredictClass\", arg_0.value, arg_1)\n        return arg_2", "path": "pyspark/bigdl/nn/layer.py", "identifier": "Layer.predict_class_distributed", "docstring": "module predict, return the predict label\n\n        :param data_rdd: the data to be predict.\n        :return: An RDD represent the predict label.", "docstring_tokens": ["module", "predict", "return", "the", "predict", "label"], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 258010}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/learner_data.py#L217-L282", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Collect the learner completion data from the Grades API.", "language": "python", "parameters": "(self, enterprise_enrollment, course_details)", "return_statement": "return completed_date, grade, is_passing", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "grades_api", "is", "None", ":", "arg_0", ".", "grades_api", "=", "GradesApiClient", "(", "arg_0", ".", "user", ")", "arg_4", "=", "arg_1", ".", "course_id", "arg_5", "=", "arg_1", ".", "enterprise_customer_user", ".", "user", ".", "username", "try", ":", "arg_6", "=", "arg_0", ".", "grades_api", ".", "get_course_grade", "(", "arg_4", ",", "arg_5", ")", "except", "HttpNotFoundError", "as", "error", ":", "if", "hasattr", "(", "error", ",", "'content'", ")", ":", "arg_7", "=", "json", ".", "loads", "(", "error", ".", "content", ")", "if", "arg_7", ".", "get", "(", "'error_code'", ",", "''", ")", "==", "'user_not_enrolled'", ":", "LOGGER", ".", "info", "(", "\"User [%s] not enrolled in course [%s], enterprise enrollment [%d]\"", ",", "arg_5", ",", "arg_4", ",", "arg_1", ".", "pk", ")", "return", "None", ",", "None", ",", "None", "LOGGER", ".", "error", "(", "\"No grades data found for [%d]: [%s], [%s]\"", ",", "arg_1", ".", "pk", ",", "arg_4", ",", "arg_5", ")", "return", "None", ",", "None", ",", "None", "arg_8", "=", "arg_2", ".", "get", "(", "'end'", ")", "if", "arg_8", "is", "not", "None", ":", "arg_8", "=", "parse_datetime", "(", "arg_8", ")", "arg_9", "=", "timezone", ".", "now", "(", ")", "arg_10", "=", "arg_6", ".", "get", "(", "'passed'", ")", "if", "arg_8", "is", "not", "None", "and", "arg_8", "<", "arg_9", ":", "arg_11", "=", "arg_8", "arg_12", "=", "arg_0", ".", "grade_passing", "if", "arg_10", "else", "arg_0", ".", "grade_failing", "elif", "arg_10", ":", "arg_11", "=", "arg_9", "arg_12", "=", "arg_0", ".", "grade_passing", "else", ":", "arg_11", "=", "None", "arg_12", "=", "arg_0", ".", "grade_incomplete", "return", "arg_11", ",", "arg_12", ",", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Collect the learner completion data from the Grades API.\n\n        Used for self-paced courses.\n\n        Args:\n            enterprise_enrollment (EnterpriseCourseEnrollment): the enterprise enrollment record for which we need to\n            collect completion/grade data\n            course_details (dict): the course details for the course in the enterprise enrollment record.\n\n        Returns:\n            completed_date: Date the course was completed, this is None if course has not been completed.\n            grade: Current grade in the course.\n            is_passing: Boolean indicating if the grade is a passing grade or not.\n        \"\"\"\n        if arg_0.grades_api is None:\n            arg_0.grades_api = GradesApiClient(arg_0.user)\n\n        arg_4 = arg_1.course_id\n        arg_5 = arg_1.enterprise_customer_user.user.username\n\n        try:\n            arg_6 = arg_0.grades_api.get_course_grade(arg_4, arg_5)\n\n        except HttpNotFoundError as error:\n            # Grade not found, so we have nothing to report.\n            if hasattr(error, 'content'):\n                arg_7 = json.loads(error.content)\n                if arg_7.get('error_code', '') == 'user_not_enrolled':\n                    # This means the user has an enterprise enrollment record but is not enrolled in the course yet\n                    LOGGER.info(\n                        \"User [%s] not enrolled in course [%s], enterprise enrollment [%d]\",\n                        arg_5,\n                        arg_4,\n                        arg_1.pk\n                    )\n                    return None, None, None\n\n            LOGGER.error(\"No grades data found for [%d]: [%s], [%s]\", arg_1.pk, arg_4, arg_5)\n            return None, None, None\n\n        # Prepare to process the course end date and pass/fail grade\n        arg_8 = arg_2.get('end')\n        if arg_8 is not None:\n            arg_8 = parse_datetime(arg_8)\n        arg_9 = timezone.now()\n        arg_10 = arg_6.get('passed')\n\n        # We can consider a course complete if:\n        # * the course's end date has passed\n        if arg_8 is not None and arg_8 < arg_9:\n            arg_11 = arg_8\n            arg_12 = arg_0.grade_passing if arg_10 else arg_0.grade_failing\n\n        # * Or, the learner has a passing grade (as of now)\n        elif arg_10:\n            arg_11 = arg_9\n            arg_12 = arg_0.grade_passing\n\n        # Otherwise, the course is still in progress\n        else:\n            arg_11 = None\n            arg_12 = arg_0.grade_incomplete\n\n        return arg_11, arg_12, arg_10", "path": "integrated_channels/integrated_channel/exporters/learner_data.py", "identifier": "LearnerExporter._collect_grades_data", "docstring": "Collect the learner completion data from the Grades API.\n\n        Used for self-paced courses.\n\n        Args:\n            enterprise_enrollment (EnterpriseCourseEnrollment): the enterprise enrollment record for which we need to\n            collect completion/grade data\n            course_details (dict): the course details for the course in the enterprise enrollment record.\n\n        Returns:\n            completed_date: Date the course was completed, this is None if course has not been completed.\n            grade: Current grade in the course.\n            is_passing: Boolean indicating if the grade is a passing grade or not.", "docstring_tokens": ["Collect", "the", "learner", "completion", "data", "from", "the", "Grades", "API", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258011}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L188-L242", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Adds a topology in the local cache, and sets a watch\n    on any changes on the topology.", "language": "python", "parameters": "(self, state_manager, topologyName)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "Topology", "(", "arg_2", ",", "arg_1", ".", "name", ")", "Log", ".", "info", "(", "\"Adding new topology: %s, state_manager: %s\"", ",", "arg_2", ",", "arg_1", ".", "name", ")", "arg_0", ".", "topologies", ".", "append", "(", "arg_3", ")", "arg_3", ".", "register_watch", "(", "arg_0", ".", "setTopologyInfo", ")", "def", "on_topology_pplan", "(", "arg_4", ")", ":", "Log", ".", "info", "(", "\"Watch triggered for topology pplan: \"", "+", "arg_2", ")", "arg_3", ".", "set_physical_plan", "(", "arg_4", ")", "if", "not", "arg_4", ":", "Log", ".", "debug", "(", "\"No data to be set\"", ")", "def", "on_topology_packing_plan", "(", "arg_4", ")", ":", "Log", ".", "info", "(", "\"Watch triggered for topology packing plan: \"", "+", "arg_2", ")", "arg_3", ".", "set_packing_plan", "(", "arg_4", ")", "if", "not", "arg_4", ":", "Log", ".", "debug", "(", "\"No data to be set\"", ")", "def", "on_topology_execution_state", "(", "arg_4", ")", ":", "Log", ".", "info", "(", "\"Watch triggered for topology execution state: \"", "+", "arg_2", ")", "arg_3", ".", "set_execution_state", "(", "arg_4", ")", "if", "not", "arg_4", ":", "Log", ".", "debug", "(", "\"No data to be set\"", ")", "def", "on_topology_tmaster", "(", "arg_4", ")", ":", "Log", ".", "info", "(", "\"Watch triggered for topology tmaster: \"", "+", "arg_2", ")", "arg_3", ".", "set_tmaster", "(", "arg_4", ")", "if", "not", "arg_4", ":", "Log", ".", "debug", "(", "\"No data to be set\"", ")", "def", "on_topology_scheduler_location", "(", "arg_4", ")", ":", "Log", ".", "info", "(", "\"Watch triggered for topology scheduler location: \"", "+", "arg_2", ")", "arg_3", ".", "set_scheduler_location", "(", "arg_4", ")", "if", "not", "arg_4", ":", "Log", ".", "debug", "(", "\"No data to be set\"", ")", "arg_1", ".", "get_pplan", "(", "arg_2", ",", "on_topology_pplan", ")", "arg_1", ".", "get_packing_plan", "(", "arg_2", ",", "on_topology_packing_plan", ")", "arg_1", ".", "get_execution_state", "(", "arg_2", ",", "on_topology_execution_state", ")", "arg_1", ".", "get_tmaster", "(", "arg_2", ",", "on_topology_tmaster", ")", "arg_1", ".", "get_scheduler_location", "(", "arg_2", ",", "on_topology_scheduler_location", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Adds a topology in the local cache, and sets a watch\n    on any changes on the topology.\n    \"\"\"\n    arg_3 = Topology(arg_2, arg_1.name)\n    Log.info(\"Adding new topology: %s, state_manager: %s\",\n             arg_2, arg_1.name)\n    arg_0.topologies.append(arg_3)\n\n    # Register a watch on topology and change\n    # the topologyInfo on any new change.\n    arg_3.register_watch(arg_0.setTopologyInfo)\n\n    def on_topology_pplan(arg_4):\n      \"\"\"watch physical plan\"\"\"\n      Log.info(\"Watch triggered for topology pplan: \" + arg_2)\n      arg_3.set_physical_plan(arg_4)\n      if not arg_4:\n        Log.debug(\"No data to be set\")\n\n    def on_topology_packing_plan(arg_4):\n      \"\"\"watch packing plan\"\"\"\n      Log.info(\"Watch triggered for topology packing plan: \" + arg_2)\n      arg_3.set_packing_plan(arg_4)\n      if not arg_4:\n        Log.debug(\"No data to be set\")\n\n    def on_topology_execution_state(arg_4):\n      \"\"\"watch execution state\"\"\"\n      Log.info(\"Watch triggered for topology execution state: \" + arg_2)\n      arg_3.set_execution_state(arg_4)\n      if not arg_4:\n        Log.debug(\"No data to be set\")\n\n    def on_topology_tmaster(arg_4):\n      \"\"\"set tmaster\"\"\"\n      Log.info(\"Watch triggered for topology tmaster: \" + arg_2)\n      arg_3.set_tmaster(arg_4)\n      if not arg_4:\n        Log.debug(\"No data to be set\")\n\n    def on_topology_scheduler_location(arg_4):\n      \"\"\"set scheduler location\"\"\"\n      Log.info(\"Watch triggered for topology scheduler location: \" + arg_2)\n      arg_3.set_scheduler_location(arg_4)\n      if not arg_4:\n        Log.debug(\"No data to be set\")\n\n    # Set watches on the pplan, execution_state, tmaster and scheduler_location.\n    arg_1.get_pplan(arg_2, on_topology_pplan)\n    arg_1.get_packing_plan(arg_2, on_topology_packing_plan)\n    arg_1.get_execution_state(arg_2, on_topology_execution_state)\n    arg_1.get_tmaster(arg_2, on_topology_tmaster)\n    arg_1.get_scheduler_location(arg_2, on_topology_scheduler_location)", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "Tracker.addNewTopology", "docstring": "Adds a topology in the local cache, and sets a watch\n    on any changes on the topology.", "docstring_tokens": ["Adds", "a", "topology", "in", "the", "local", "cache", "and", "sets", "a", "watch", "on", "any", "changes", "on", "the", "topology", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258012}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/layers/layer.py#L151-L158", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Register updates that will be executed in each iteration.", "language": "python", "parameters": "(self, *updates)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ":", "if", "arg_2", "not", "in", "arg_0", ".", "_registered_updates", ":", "arg_0", ".", "updates", ".", "append", "(", "(", "arg_2", ",", "arg_3", ")", ")", "arg_0", ".", "_registered_updates", ".", "add", "(", "arg_2", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Register updates that will be executed in each iteration.\n        \"\"\"\n        for arg_2, arg_3 in arg_1:\n            if arg_2 not in arg_0._registered_updates:\n                arg_0.updates.append((arg_2, arg_3))\n                arg_0._registered_updates.add(arg_2)", "path": "deepy/layers/layer.py", "identifier": "NeuralLayer.register_updates", "docstring": "Register updates that will be executed in each iteration.", "docstring_tokens": ["Register", "updates", "that", "will", "be", "executed", "in", "each", "iteration", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 258013}
{"url": "https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/afe3a9ebd886791b662607499c180d2baaeaf617/src/marshmallow_sqlalchemy/schema.py#L226-L249", "sha": "afe3a9ebd886791b662607499c180d2baaeaf617", "docstring_summary": "Split serialized attrs to ensure association proxies are passed separately.", "language": "python", "parameters": "(self, data)", "return_statement": "return kwargs, association_attrs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "iteritems", "(", "arg_1", ")", "if", "hasattr", "(", "getattr", "(", "arg_0", ".", "opts", ".", "model", ",", "key", ",", "None", ")", ",", "\"remote_attr\"", ")", "}", "arg_3", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "iteritems", "(", "arg_1", ")", "if", "(", "hasattr", "(", "arg_0", ".", "opts", ".", "model", ",", "key", ")", "and", "key", "not", "in", "arg_2", ")", "}", "return", "arg_3", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Split serialized attrs to ensure association proxies are passed separately.\n\n        This is necessary for Python < 3.6.0, as the order in which kwargs are passed\n        is non-deterministic, and associations must be parsed by sqlalchemy after their\n        intermediate relationship, unless their `creator` has been set.\n\n        Ignore invalid keys at this point - behaviour for unknowns should be\n        handled elsewhere.\n\n        :param data: serialized dictionary of attrs to split on association_proxy.\n        \"\"\"\n        arg_2 = {\n            key: value\n            for key, value in iteritems(arg_1)\n            # association proxy\n            if hasattr(getattr(arg_0.opts.model, key, None), \"remote_attr\")\n        }\n        arg_3 = {\n            key: value\n            for key, value in iteritems(arg_1)\n            if (hasattr(arg_0.opts.model, key) and key not in arg_2)\n        }\n        return arg_3, arg_2", "path": "src/marshmallow_sqlalchemy/schema.py", "identifier": "ModelSchema._split_model_kwargs_association", "docstring": "Split serialized attrs to ensure association proxies are passed separately.\n\n        This is necessary for Python < 3.6.0, as the order in which kwargs are passed\n        is non-deterministic, and associations must be parsed by sqlalchemy after their\n        intermediate relationship, unless their `creator` has been set.\n\n        Ignore invalid keys at this point - behaviour for unknowns should be\n        handled elsewhere.\n\n        :param data: serialized dictionary of attrs to split on association_proxy.", "docstring_tokens": ["Split", "serialized", "attrs", "to", "ensure", "association", "proxies", "are", "passed", "separately", "."], "nwo": "marshmallow-code/marshmallow-sqlalchemy", "score": 0.5915932759257259, "idx": 258014}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2059-L2130", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "An improved version of fabric.operations.reboot with better error handling.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "from", "fabric", ".", "state", "import", "connections", "arg_2", "=", "get_verbose", "(", ")", "arg_3", "=", "get_dryrun", "(", "arg_1", ".", "get", "(", "'dryrun'", ")", ")", "arg_1", ".", "setdefault", "(", "'wait'", ",", "120", ")", "arg_4", "=", "int", "(", "arg_1", "[", "'wait'", "]", ")", "arg_5", "=", "arg_1", ".", "get", "(", "'command'", ",", "'reboot'", ")", "arg_6", "=", "int", "(", "arg_1", ".", "get", "(", "'now'", ",", "0", ")", ")", "print", "(", "'now:'", ",", "arg_6", ")", "if", "arg_6", ":", "arg_5", "+=", "' now'", "arg_7", "=", "int", "(", "arg_1", ".", "get", "(", "'timeout'", ",", "30", ")", ")", "arg_8", "=", "arg_1", ".", "pop", "(", "'new_hostname'", ",", "arg_10", ".", "host_string", ")", "if", "'dryrun'", "in", "arg_1", ":", "del", "arg_1", "[", "'dryrun'", "]", "if", "arg_3", ":", "print", "(", "'%s sudo: %s'", "%", "(", "render_command_prefix", "(", ")", ",", "arg_5", ")", ")", "else", ":", "if", "is_local", "(", ")", ":", "if", "raw_input", "(", "'reboot localhost now? '", ")", ".", "strip", "(", ")", "[", "0", "]", ".", "lower", "(", ")", "!=", "'y'", ":", "return", "arg_9", "=", "int", "(", "round", "(", "float", "(", "arg_4", ")", "/", "float", "(", "arg_7", ")", ")", ")", "with", "settings", "(", "warn_only", "=", "True", ")", ":", "_sudo", "(", "arg_5", ")", "arg_10", ".", "host_string", "=", "arg_8", "arg_12", "=", "False", "for", "arg_13", "in", "xrange", "(", "arg_9", ")", ":", "if", "arg_2", ":", "print", "(", "'Waiting for %s seconds, wait %i of %i'", "%", "(", "arg_7", ",", "arg_13", "+", "1", ",", "arg_9", ")", ")", "time", ".", "sleep", "(", "arg_7", ")", "try", ":", "if", "arg_2", ":", "print", "(", "'Reconnecting to:'", ",", "arg_10", ".", "host_string", ")", "connections", ".", "connect", "(", "arg_10", ".", "host_string", ")", "with", "settings", "(", "arg_7", "=", "arg_7", ")", ":", "_run", "(", "'echo hello'", ")", "arg_12", "=", "True", "break", "except", "Exception", "as", "e", ":", "print", "(", "'Exception:'", ",", "e", ")", "if", "not", "arg_12", ":", "raise", "Exception", "(", "'Reboot failed or took longer than %s seconds.'", "%", "arg_4", ")"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    An improved version of fabric.operations.reboot with better error handling.\n    \"\"\"\n    from fabric.state import connections\n\n    arg_2 = get_verbose()\n\n    arg_3 = get_dryrun(arg_1.get('dryrun'))\n\n    # Use 'wait' as max total wait time\n    arg_1.setdefault('wait', 120)\n    arg_4 = int(arg_1['wait'])\n\n    arg_5 = arg_1.get('command', 'reboot')\n\n    arg_6 = int(arg_1.get('now', 0))\n    print('now:', arg_6)\n    if arg_6:\n        arg_5 += ' now'\n\n    # Shorter timeout for a more granular cycle than the default.\n    arg_7 = int(arg_1.get('timeout', 30))\n\n    arg_8 = arg_1.pop('new_hostname', arg_10.host_string)\n\n    if 'dryrun' in arg_1:\n        del arg_1['dryrun']\n\n    if arg_3:\n        print('%s sudo: %s' % (render_command_prefix(), arg_5))\n    else:\n        if is_local():\n            if raw_input('reboot localhost now? ').strip()[0].lower() != 'y':\n                return\n\n        arg_9 = int(round(float(arg_4) / float(arg_7)))\n        # Don't bleed settings, since this is supposed to be self-contained.\n        # User adaptations will probably want to drop the \"with settings()\" and\n        # just have globally set timeout/attempts values.\n        with settings(warn_only=True):\n            _sudo(arg_5)\n\n        arg_10.host_string = arg_8\n        arg_12 = False\n        for arg_13 in xrange(arg_9):\n\n            # Try to make sure we don't slip in before pre-reboot lockdown\n            if arg_2:\n                print('Waiting for %s seconds, wait %i of %i' % (arg_7, arg_13+1, arg_9))\n            time.sleep(arg_7)\n\n            # This is actually an internal-ish API call, but users can simply drop\n            # it in real fabfile use -- the next run/sudo/put/get/etc call will\n            # automatically trigger a reconnect.\n            # We use it here to force the reconnect while this function is still in\n            # control and has the above timeout settings enabled.\n            try:\n                if arg_2:\n                    print('Reconnecting to:', arg_10.host_string)\n                # This will fail until the network interface comes back up.\n                connections.connect(arg_10.host_string)\n                # This will also fail until SSH is running again.\n                with settings(arg_7=arg_7):\n                    _run('echo hello')\n                arg_12 = True\n                break\n            except Exception as e:\n                print('Exception:', e)\n\n        if not arg_12:\n            raise Exception('Reboot failed or took longer than %s seconds.' % arg_4)", "path": "burlap/common.py", "identifier": "reboot_or_dryrun", "docstring": "An improved version of fabric.operations.reboot with better error handling.", "docstring_tokens": ["An", "improved", "version", "of", "fabric", ".", "operations", ".", "reboot", "with", "better", "error", "handling", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258015}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/pylabtools.py#L114-L151", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Factory to return a matplotlib-enabled runner for %run.", "language": "python", "parameters": "(safe_execfile)", "return_statement": "return mpl_execfile", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "mpl_execfile", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "import", "matplotlib", "import", "matplotlib", ".", "pylab", "as", "arg_5", "arg_4", "=", "matplotlib", ".", "rcParams", "[", "'interactive'", "]", "matplotlib", ".", "interactive", "(", "False", ")", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "matplotlib", ".", "interactive", "(", "arg_4", ")", "if", "arg_5", ".", "draw_if_interactive", ".", "called", ":", "arg_5", ".", "draw", "(", ")", "arg_5", ".", "draw_if_interactive", ".", "called", "=", "False", "return", "mpl_execfile"], "function": "def Func(arg_0):\n    \"\"\"Factory to return a matplotlib-enabled runner for %run.\n\n    Parameters\n    ----------\n    safe_execfile : function\n      This must be a function with the same interface as the\n      :meth:`safe_execfile` method of IPython.\n\n    Returns\n    -------\n    A function suitable for use as the ``runner`` argument of the %run magic\n    function.\n    \"\"\"\n    \n    def mpl_execfile(arg_1,*arg_2,**arg_3):\n        \"\"\"matplotlib-aware wrapper around safe_execfile.\n\n        Its interface is identical to that of the :func:`execfile` builtin.\n\n        This is ultimately a call to execfile(), but wrapped in safeties to\n        properly handle interactive rendering.\"\"\"\n\n        import matplotlib\n        import matplotlib.pylab as arg_5\n\n        #print '*** Matplotlib runner ***' # dbg\n        # turn off rendering until end of script\n        arg_4 = matplotlib.rcParams['interactive']\n        matplotlib.interactive(False)\n        arg_0(arg_1,*arg_2,**arg_3)\n        matplotlib.interactive(arg_4)\n        # make rendering call now, if the user tried to do it\n        if arg_5.draw_if_interactive.called:\n            arg_5.draw()\n            arg_5.draw_if_interactive.called = False\n\n    return mpl_execfile", "path": "environment/lib/python2.7/site-packages/IPython/core/pylabtools.py", "identifier": "mpl_runner", "docstring": "Factory to return a matplotlib-enabled runner for %run.\n\n    Parameters\n    ----------\n    safe_execfile : function\n      This must be a function with the same interface as the\n      :meth:`safe_execfile` method of IPython.\n\n    Returns\n    -------\n    A function suitable for use as the ``runner`` argument of the %run magic\n    function.", "docstring_tokens": ["Factory", "to", "return", "a", "matplotlib", "-", "enabled", "runner", "for", "%run", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258016}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/signal_optimiser.py#L65-L73", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Remove mean and divide by standard deviation, using bayes_kvm statistics.", "language": "python", "parameters": "(s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "sum", "(", "~", "np", ".", "isnan", "(", "arg_0", ")", ")", ">", "1", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "bayes_mvs", "(", "arg_0", "[", "~", "np", ".", "isnan", "(", "arg_0", ")", "]", ")", "return", "(", "arg_0", "-", "arg_1", ".", "statistic", ")", "/", "arg_3", ".", "statistic", "else", ":", "return", "np", ".", "full", "(", "arg_0", ".", "shape", ",", "np", ".", "nan", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Remove mean and divide by standard deviation, using bayes_kvm statistics.\n    \"\"\"\n    if sum(~np.isnan(arg_0)) > 1:\n        arg_1, arg_2, arg_3 = bayes_mvs(arg_0[~np.isnan(arg_0)])\n        return (arg_0 - arg_1.statistic) / arg_3.statistic\n    else:\n        return np.full(arg_0.shape, np.nan)", "path": "latools/filtering/signal_optimiser.py", "identifier": "bayes_scale", "docstring": "Remove mean and divide by standard deviation, using bayes_kvm statistics.", "docstring_tokens": ["Remove", "mean", "and", "divide", "by", "standard", "deviation", "using", "bayes_kvm", "statistics", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 258017}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_container_instance_hook.py#L160-L172", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Test if a container group exists", "language": "python", "parameters": "(self, resource_group, name)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "connection", ".", "container_groups", ".", "list_by_resource_group", "(", "arg_1", ")", ":", "if", "arg_3", ".", "name", "==", "arg_2", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Test if a container group Func\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str\n        \"\"\"\n        for arg_3 in arg_0.connection.container_groups.list_by_resource_group(arg_1):\n            if arg_3.name == arg_2:\n                return True\n        return False", "path": "airflow/contrib/hooks/azure_container_instance_hook.py", "identifier": "AzureContainerInstanceHook.exists", "docstring": "Test if a container group exists\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str", "docstring_tokens": ["Test", "if", "a", "container", "group", "exists"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258018}
{"url": "https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/waelsteng.py#L232-L245", "sha": "70d469ef9a161c1170b53aa017cf02d7c15eb90c", "docstring_summary": "Returns the value displayed in the column on the web interface for\n        a given instance.", "language": "python", "parameters": "(self, admin_model, instance, field_name)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_4", ",", "arg_5", "=", "lookup_field", "(", "arg_3", ",", "arg_2", ",", "arg_1", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Returns the value displayed in the column on the web interface for\n        a given instance.\n\n        :param admin_model:\n            Instance of a :class:`admin.ModelAdmin` object that is responsible\n            for displaying the change list\n        :param instance:\n            Object instance that is the row in the admin change list\n        :field_name:\n            Name of the field/column to fetch\n        \"\"\"\n        arg_4, arg_4, arg_5 = lookup_field(arg_3, arg_2, arg_1)\n        return arg_5", "path": "awl/waelsteng.py", "identifier": "AdminToolsMixin.field_value", "docstring": "Returns the value displayed in the column on the web interface for\n        a given instance.\n\n        :param admin_model:\n            Instance of a :class:`admin.ModelAdmin` object that is responsible\n            for displaying the change list\n        :param instance:\n            Object instance that is the row in the admin change list\n        :field_name:\n            Name of the field/column to fetch", "docstring_tokens": ["Returns", "the", "value", "displayed", "in", "the", "column", "on", "the", "web", "interface", "for", "a", "given", "instance", "."], "nwo": "cltrudeau/django-awl", "score": 0.09252797783733271, "idx": 258019}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py#L239-L249", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get metric definitions of metrics available of this web site.", "language": "python", "parameters": "(self, webspace_name, website_name)", "return_statement": "return self._perform_get(self._get_metric_definitions_path(webspace_name, website_name),\n                                 MetricDefinitions)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_Func_path", "(", "arg_1", ",", "arg_2", ")", ",", "MetricDefinitions", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Get metric definitions of metrics available of this web site.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        '''\n        return arg_0._perform_get(arg_0._Func_path(arg_1, arg_2),\n                                 MetricDefinitions)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py", "identifier": "WebsiteManagementService.get_metric_definitions", "docstring": "Get metric definitions of metrics available of this web site.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.", "docstring_tokens": ["Get", "metric", "definitions", "of", "metrics", "available", "of", "this", "web", "site", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258020}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/appengine.py#L757-L810", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "RequestHandler for the OAuth 2.0 redirect callback.", "language": "python", "parameters": "(self)", "return_statement": "return OAuth2Handler", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "class", "OAuth2Handler", "(", "webapp", ".", "RequestHandler", ")", ":", "@", "login_required", "def", "get", "(", "arg_0", ")", ":", "arg_2", "=", "arg_0", ".", "request", ".", "get", "(", "'error'", ")", "if", "arg_2", ":", "arg_3", "=", "arg_0", ".", "request", ".", "get", "(", "'error_description'", ",", "arg_2", ")", "arg_0", ".", "response", ".", "out", ".", "write", "(", "'The authorization request failed: {0}'", ".", "format", "(", "_safe_html", "(", "arg_3", ")", ")", ")", "else", ":", "arg_4", "=", "users", ".", "get_current_user", "(", ")", "arg_1", ".", "_create_flow", "(", "arg_0", ")", "arg_5", "=", "arg_1", ".", "flow", ".", "step2_exchange", "(", "arg_0", ".", "request", ".", "params", ")", "arg_1", ".", "_storage_class", "(", "arg_1", ".", "_credentials_class", ",", "None", ",", "arg_1", ".", "_credentials_property_name", ",", "arg_4", "=", "arg_4", ")", ".", "put", "(", "arg_5", ")", "arg_6", "=", "_parse_state_value", "(", "str", "(", "arg_0", ".", "request", ".", "get", "(", "'state'", ")", ")", ",", "arg_4", ")", "if", "arg_6", "is", "None", ":", "arg_0", ".", "response", ".", "out", ".", "write", "(", "'The authorization request failed'", ")", "return", "if", "(", "arg_1", ".", "_token_response_param", "and", "arg_5", ".", "token_response", ")", ":", "arg_7", "=", "json", ".", "dumps", "(", "arg_5", ".", "token_response", ")", "arg_6", "=", "_helpers", ".", "_add_query_parameter", "(", "arg_6", ",", "arg_1", ".", "_token_response_param", ",", "arg_7", ")", "arg_0", ".", "redirect", "(", "arg_6", ")", "return", "OAuth2Handler"], "function": "def Func(arg_0):\n        \"\"\"RequestHandler for the OAuth 2.0 redirect callback.\n\n        Usage::\n\n            app = webapp.WSGIApplication([\n                ('/index', MyIndexHandler),\n                ...,\n                (decorator.callback_path, decorator.Func())\n            ])\n\n        Returns:\n            A webapp.RequestHandler that handles the redirect back from the\n            server during the OAuth 2.0 dance.\n        \"\"\"\n        arg_1 = arg_0\n\n        class OAuth2Handler(webapp.RequestHandler):\n            \"\"\"Handler for the redirect_uri of the OAuth 2.0 dance.\"\"\"\n\n            @login_required\n            def get(arg_0):\n                arg_2 = arg_0.request.get('error')\n                if arg_2:\n                    arg_3 = arg_0.request.get('error_description', arg_2)\n                    arg_0.response.out.write(\n                        'The authorization request failed: {0}'.format(\n                            _safe_html(arg_3)))\n                else:\n                    arg_4 = users.get_current_user()\n                    arg_1._create_flow(arg_0)\n                    arg_5 = arg_1.flow.step2_exchange(\n                        arg_0.request.params)\n                    arg_1._storage_class(\n                        arg_1._credentials_class, None,\n                        arg_1._credentials_property_name,\n                        arg_4=arg_4).put(arg_5)\n                    arg_6 = _parse_state_value(\n                        str(arg_0.request.get('state')), arg_4)\n                    if arg_6 is None:\n                        arg_0.response.out.write(\n                            'The authorization request failed')\n                        return\n\n                    if (arg_1._token_response_param and\n                            arg_5.token_response):\n                        arg_7 = json.dumps(arg_5.token_response)\n                        arg_6 = _helpers._add_query_parameter(\n                            arg_6, arg_1._token_response_param,\n                            arg_7)\n\n                    arg_0.redirect(arg_6)\n\n        return OAuth2Handler", "path": "oauth2client/contrib/appengine.py", "identifier": "OAuth2Decorator.callback_handler", "docstring": "RequestHandler for the OAuth 2.0 redirect callback.\n\n        Usage::\n\n            app = webapp.WSGIApplication([\n                ('/index', MyIndexHandler),\n                ...,\n                (decorator.callback_path, decorator.callback_handler())\n            ])\n\n        Returns:\n            A webapp.RequestHandler that handles the redirect back from the\n            server during the OAuth 2.0 dance.", "docstring_tokens": ["RequestHandler", "for", "the", "OAuth", "2", ".", "0", "redirect", "callback", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 258021}
{"url": "https://github.com/ptrus/suffix-trees/blob/e7439c93a7b895523fad36c8c65a781710320b57/suffix_trees/STree.py#L181-L208", "sha": "e7439c93a7b895523fad36c8c65a781710320b57", "docstring_summary": "Returns starting position of the substring y in the string used for\n        building the Suffix tree.", "language": "python", "parameters": "(self, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "root", "while", "True", ":", "arg_3", "=", "arg_0", ".", "_edgeLabel", "(", "arg_2", ",", "arg_2", ".", "parent", ")", "if", "arg_3", ".", "startswith", "(", "arg_1", ")", ":", "return", "arg_2", ".", "idx", "arg_4", "=", "0", "while", "(", "arg_4", "<", "len", "(", "arg_3", ")", "and", "arg_3", "[", "arg_4", "]", "==", "arg_1", "[", "0", "]", ")", ":", "arg_1", "=", "arg_1", "[", "1", ":", "]", "arg_4", "+=", "1", "if", "arg_4", "!=", "0", ":", "if", "arg_4", "==", "len", "(", "arg_3", ")", "and", "arg_1", "!=", "''", ":", "pass", "else", ":", "return", "-", "1", "arg_2", "=", "arg_2", ".", "_get_transition_link", "(", "arg_1", "[", "0", "]", ")", "if", "not", "arg_2", ":", "return", "-", "1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns starting position of the substring y in the string used for\n        building the Suffix tree.\n\n        :param y: String\n        :return: Index of the starting position of string y in the string used for building the Suffix tree\n                 -1 if y is not a substring.\n        \"\"\"\n        arg_2 = arg_0.root\n        while True:\n            arg_3 = arg_0._edgeLabel(arg_2, arg_2.parent)\n            if arg_3.startswith(arg_1):\n                return arg_2.idx\n            \n            arg_4 = 0\n            while(arg_4 < len(arg_3) and arg_3[arg_4] == arg_1[0]):\n                arg_1 = arg_1[1:]\n                arg_4 += 1\n            \n            if arg_4 != 0:\n                if arg_4 == len(arg_3) and arg_1 != '':\n                    pass\n                else:\n                    return -1\n            \n            arg_2 = arg_2._get_transition_link(arg_1[0])\n            if not arg_2:\n                return -1", "path": "suffix_trees/STree.py", "identifier": "STree.find", "docstring": "Returns starting position of the substring y in the string used for\n        building the Suffix tree.\n\n        :param y: String\n        :return: Index of the starting position of string y in the string used for building the Suffix tree\n                 -1 if y is not a substring.", "docstring_tokens": ["Returns", "starting", "position", "of", "the", "substring", "y", "in", "the", "string", "used", "for", "building", "the", "Suffix", "tree", "."], "nwo": "ptrus/suffix-trees", "score": 0.5973428860454929, "idx": 258022}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/hybridmanager.py#L229-L256", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Special case handling for listing root dir.", "language": "python", "parameters": "(self, path, content=True, type=None, format=None)", "return_statement": "return root_model", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_1", "=", "normalize_api_path", "(", "arg_1", ")", "if", "arg_1", ":", "return", "arg_0", ".", "__Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "if", "not", "arg_2", ":", "return", "base_directory_model", "(", "''", ")", "arg_5", "=", "arg_0", ".", "_extra_root_dirs", "(", ")", "arg_6", "=", "arg_0", ".", "root_manager", "if", "arg_6", "is", "None", ":", "arg_7", "=", "base_directory_model", "(", "''", ")", "arg_7", ".", "update", "(", "arg_4", "=", "'json'", ",", "arg_2", "=", "arg_5", ",", ")", "else", ":", "arg_7", "=", "arg_6", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", ")", "arg_7", "[", "'content'", "]", ".", "extend", "(", "arg_5", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None, arg_4=None):\n        \"\"\"\n        Special case handling for listing root dir.\n        \"\"\"\n        arg_1 = normalize_api_path(arg_1)\n        if arg_1:\n            return arg_0.__Func(arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)\n        if not arg_2:\n            return base_directory_model('')\n\n        arg_5 = arg_0._extra_root_dirs()\n        arg_6 = arg_0.root_manager\n        if arg_6 is None:\n            arg_7 = base_directory_model('')\n            arg_7.update(\n                arg_4='json',\n                arg_2=arg_5,\n            )\n        else:\n            arg_7 = arg_6.Func(\n                arg_1,\n                arg_2=arg_2,\n                arg_3=arg_3,\n                arg_4=arg_4,\n            )\n            # Append the extra directories.\n            arg_7['content'].extend(arg_5)\n        return arg_7", "path": "pgcontents/hybridmanager.py", "identifier": "HybridContentsManager.get", "docstring": "Special case handling for listing root dir.", "docstring_tokens": ["Special", "case", "handling", "for", "listing", "root", "dir", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 258023}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L302-L343", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Get authorization code using Google account credentials.", "language": "python", "parameters": "(session, credentials_prompt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Browser", "(", "arg_0", ",", "OAUTH2_LOGIN_URL", ")", "arg_3", "=", "arg_1", ".", "get_email", "(", ")", "arg_2", ".", "submit_form", "(", "FORM_SELECTOR", ",", "{", "EMAIL_SELECTOR", ":", "arg_3", "}", ")", "arg_4", "=", "arg_1", ".", "get_password", "(", ")", "arg_2", ".", "submit_form", "(", "FORM_SELECTOR", ",", "{", "PASSWORD_SELECTOR", ":", "arg_4", "}", ")", "if", "arg_2", ".", "has_selector", "(", "TOTP_CHALLENGE_SELECTOR", ")", ":", "arg_2", ".", "submit_form", "(", "TOTP_CHALLENGE_SELECTOR", ",", "{", "}", ")", "elif", "arg_2", ".", "has_selector", "(", "PHONE_CHALLENGE_SELECTOR", ")", ":", "arg_2", ".", "submit_form", "(", "PHONE_CHALLENGE_SELECTOR", ",", "{", "}", ")", "if", "arg_2", ".", "has_selector", "(", "VERIFICATION_FORM_SELECTOR", ")", ":", "if", "arg_2", ".", "has_selector", "(", "TOTP_CODE_SELECTOR", ")", ":", "arg_5", "=", "TOTP_CODE_SELECTOR", "elif", "arg_2", ".", "has_selector", "(", "PHONE_CODE_SELECTOR", ")", ":", "arg_5", "=", "PHONE_CODE_SELECTOR", "else", ":", "raise", "GoogleAuthError", "(", "'Unknown verification code input'", ")", "arg_6", "=", "arg_1", ".", "get_verification_code", "(", ")", "arg_2", ".", "submit_form", "(", "VERIFICATION_FORM_SELECTOR", ",", "{", "arg_5", ":", "arg_6", "}", ")", "try", ":", "return", "arg_2", ".", "get_cookie", "(", "'oauth_code'", ")", "except", "KeyError", ":", "raise", "GoogleAuthError", "(", "'Authorization code cookie not found'", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Get authorization code using Google account credentials.\n\n    Because hangups can't use a real embedded browser, it has to use the\n    Browser class to enter the user's credentials and retrieve the\n    authorization code, which is placed in a cookie. This is the most fragile\n    part of the authentication process, because a change to a login form or an\n    unexpected prompt could break it.\n\n    Raises GoogleAuthError authentication fails.\n\n    Returns authorization code string.\n    \"\"\"\n    arg_2 = Browser(arg_0, OAUTH2_LOGIN_URL)\n\n    arg_3 = arg_1.get_email()\n    arg_2.submit_form(FORM_SELECTOR, {EMAIL_SELECTOR: arg_3})\n\n    arg_4 = arg_1.get_password()\n    arg_2.submit_form(FORM_SELECTOR, {PASSWORD_SELECTOR: arg_4})\n\n    if arg_2.has_selector(TOTP_CHALLENGE_SELECTOR):\n        arg_2.submit_form(TOTP_CHALLENGE_SELECTOR, {})\n    elif arg_2.has_selector(PHONE_CHALLENGE_SELECTOR):\n        arg_2.submit_form(PHONE_CHALLENGE_SELECTOR, {})\n\n    if arg_2.has_selector(VERIFICATION_FORM_SELECTOR):\n        if arg_2.has_selector(TOTP_CODE_SELECTOR):\n            arg_5 = TOTP_CODE_SELECTOR\n        elif arg_2.has_selector(PHONE_CODE_SELECTOR):\n            arg_5 = PHONE_CODE_SELECTOR\n        else:\n            raise GoogleAuthError('Unknown verification code input')\n        arg_6 = arg_1.get_verification_code()\n        arg_2.submit_form(\n            VERIFICATION_FORM_SELECTOR, {arg_5: arg_6}\n        )\n\n    try:\n        return arg_2.get_cookie('oauth_code')\n    except KeyError:\n        raise GoogleAuthError('Authorization code cookie not found')", "path": "hangups/auth.py", "identifier": "_get_authorization_code", "docstring": "Get authorization code using Google account credentials.\n\n    Because hangups can't use a real embedded browser, it has to use the\n    Browser class to enter the user's credentials and retrieve the\n    authorization code, which is placed in a cookie. This is the most fragile\n    part of the authentication process, because a change to a login form or an\n    unexpected prompt could break it.\n\n    Raises GoogleAuthError authentication fails.\n\n    Returns authorization code string.", "docstring_tokens": ["Get", "authorization", "code", "using", "Google", "account", "credentials", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258024}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2197-L2226", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Check a folder by given name, if not exist, create the folder and return False,\n    if directory exists, return True.", "language": "python", "parameters": "(path, verbose=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "if", "arg_1", ":", "logging", ".", "info", "(", "\"[*] creates %s ...\"", "%", "arg_0", ")", "os", ".", "makedirs", "(", "arg_0", ")", "return", "False", "else", ":", "if", "arg_1", ":", "logging", ".", "info", "(", "\"[!] %s exists ...\"", "%", "arg_0", ")", "return", "True"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Check a folder by given name, if not exist, create the folder and return False,\n    if directory exists, return True.\n\n    Parameters\n    ----------\n    path : str\n        A folder path.\n    verbose : boolean\n        If True (default), prints results.\n\n    Returns\n    --------\n    boolean\n        True if folder already exist, otherwise, returns False and create the folder.\n\n    Examples\n    --------\n    >>> tl.files.Func(\"checkpoints/train\")\n\n    \"\"\"\n    if not os.path.exists(arg_0):\n        if arg_1:\n            logging.info(\"[*] creates %s ...\" % arg_0)\n        os.makedirs(arg_0)\n        return False\n    else:\n        if arg_1:\n            logging.info(\"[!] %s exists ...\" % arg_0)\n        return True", "path": "tensorlayer/files/utils.py", "identifier": "exists_or_mkdir", "docstring": "Check a folder by given name, if not exist, create the folder and return False,\n    if directory exists, return True.\n\n    Parameters\n    ----------\n    path : str\n        A folder path.\n    verbose : boolean\n        If True (default), prints results.\n\n    Returns\n    --------\n    boolean\n        True if folder already exist, otherwise, returns False and create the folder.\n\n    Examples\n    --------\n    >>> tl.files.exists_or_mkdir(\"checkpoints/train\")", "docstring_tokens": ["Check", "a", "folder", "by", "given", "name", "if", "not", "exist", "create", "the", "folder", "and", "return", "False", "if", "directory", "exists", "return", "True", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 258025}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L255-L275", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Get the list of bids", "language": "python", "parameters": "(session, project_ids=[], bid_ids=[], limit=10, offset=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ",", "arg_2", "=", "[", "]", ",", "arg_3", "=", "10", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "{", "}", "if", "arg_2", ":", "arg_5", "[", "'bids[]'", "]", "=", "arg_2", "if", "arg_1", ":", "arg_5", "[", "'projects[]'", "]", "=", "arg_1", "arg_5", "[", "'limit'", "]", "=", "arg_3", "arg_5", "[", "'offset'", "]", "=", "arg_4", "arg_6", "=", "make_get_request", "(", "arg_0", ",", "'bids'", ",", "params_data", "=", "arg_5", ")", "arg_7", "=", "arg_6", ".", "json", "(", ")", "if", "arg_6", ".", "status_code", "==", "200", ":", "return", "arg_7", "[", "'result'", "]", "else", ":", "raise", "BidsNotFoundException", "(", "message", "=", "arg_7", "[", "'message'", "]", ",", "error_code", "=", "arg_7", "[", "'error_code'", "]", ",", "request_id", "=", "arg_7", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1=[], arg_2=[], arg_3=10, arg_4=0):\n    \"\"\"\n    Get the list of bids\n    \"\"\"\n    arg_5 = {}\n    if arg_2:\n        arg_5['bids[]'] = arg_2\n    if arg_1:\n        arg_5['projects[]'] = arg_1\n    arg_5['limit'] = arg_3\n    arg_5['offset'] = arg_4\n    # GET /api/projects/0.1/bids/\n    arg_6 = make_get_request(arg_0, 'bids', params_data=arg_5)\n    arg_7 = arg_6.json()\n    if arg_6.status_code == 200:\n        return arg_7['result']\n    else:\n        raise BidsNotFoundException(\n            message=arg_7['message'], error_code=arg_7['error_code'],\n            request_id=arg_7['request_id']\n        )", "path": "freelancersdk/resources/projects/projects.py", "identifier": "get_bids", "docstring": "Get the list of bids", "docstring_tokens": ["Get", "the", "list", "of", "bids"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 258026}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/docs_resolv.py#L29-L51", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Helper function to get data over http or from a local file", "language": "python", "parameters": "(url)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "startswith", "(", "'http://'", ")", ":", "try", ":", "arg_1", "=", "urllib", ".", "urlopen", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "headers", ".", "dict", ".", "get", "(", "'content-encoding'", ",", "'plain'", ")", "except", "AttributeError", ":", "arg_1", "=", "urllib", ".", "request", ".", "urlopen", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "headers", ".", "get", "(", "'content-encoding'", ",", "'plain'", ")", "arg_3", "=", "arg_1", ".", "read", "(", ")", "if", "arg_2", "==", "'plain'", ":", "pass", "elif", "arg_2", "==", "'gzip'", ":", "arg_3", "=", "StringIO", "(", "arg_3", ")", "arg_3", "=", "gzip", ".", "GzipFile", "(", "fileobj", "=", "arg_3", ")", ".", "read", "(", ")", "else", ":", "raise", "RuntimeError", "(", "'unknown encoding'", ")", "else", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "fid", ":", "arg_3", "=", "fid", ".", "read", "(", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Helper function to get data over http or from a local file\"\"\"\n    if arg_0.startswith('http://'):\n        # Try Python 2, use Python 3 on exception\n        try:\n            arg_1 = urllib.urlopen(arg_0)\n            arg_2 = arg_1.headers.dict.get('content-encoding', 'plain')\n        except AttributeError:\n            arg_1 = urllib.request.urlopen(arg_0)\n            arg_2 = arg_1.headers.get('content-encoding', 'plain')\n        arg_3 = arg_1.read()\n        if arg_2 == 'plain':\n            pass\n        elif arg_2 == 'gzip':\n            arg_3 = StringIO(arg_3)\n            arg_3 = gzip.GzipFile(fileobj=arg_3).read()\n        else:\n            raise RuntimeError('unknown encoding')\n    else:\n        with open(arg_0, 'r') as fid:\n            arg_3 = fid.read()\n\n    return arg_3", "path": "doc/sphinxext/sphinx_gallery/docs_resolv.py", "identifier": "_get_data", "docstring": "Helper function to get data over http or from a local file", "docstring_tokens": ["Helper", "function", "to", "get", "data", "over", "http", "or", "from", "a", "local", "file"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 258027}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L913-L932", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Performs completion with 'items' at the specified cursor location.", "language": "python", "parameters": "(self, cursor, items)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_cancel_completion", "(", ")", "if", "len", "(", "arg_2", ")", "==", "1", ":", "arg_1", ".", "setPosition", "(", "arg_0", ".", "_control", ".", "textCursor", "(", ")", ".", "position", "(", ")", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "arg_1", ".", "insertText", "(", "arg_2", "[", "0", "]", ")", "elif", "len", "(", "arg_2", ")", ">", "1", ":", "arg_3", "=", "arg_0", ".", "_control", ".", "textCursor", "(", ")", ".", "position", "(", ")", "arg_4", "=", "commonprefix", "(", "arg_2", ")", "if", "arg_4", ":", "arg_1", ".", "setPosition", "(", "arg_3", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "arg_1", ".", "insertText", "(", "arg_4", ")", "arg_3", "=", "arg_1", ".", "position", "(", ")", "arg_1", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "Left", ",", "n", "=", "len", "(", "arg_4", ")", ")", "arg_0", ".", "_completion_widget", ".", "show_items", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Performs completion with 'items' at the specified cursor location.\n        \"\"\"\n        arg_0._cancel_completion()\n\n        if len(arg_2) == 1:\n            arg_1.setPosition(arg_0._control.textCursor().position(),\n                               QtGui.QTextCursor.KeepAnchor)\n            arg_1.insertText(arg_2[0])\n\n        elif len(arg_2) > 1:\n            arg_3 = arg_0._control.textCursor().position()\n            arg_4 = commonprefix(arg_2)\n            if arg_4:\n                arg_1.setPosition(arg_3, QtGui.QTextCursor.KeepAnchor)\n                arg_1.insertText(arg_4)\n                arg_3 = arg_1.position()\n\n            arg_1.movePosition(QtGui.QTextCursor.Left, n=len(arg_4))\n            arg_0._completion_widget.show_items(arg_1, arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._complete_with_items", "docstring": "Performs completion with 'items' at the specified cursor location.", "docstring_tokens": ["Performs", "completion", "with", "items", "at", "the", "specified", "cursor", "location", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258028}
{"url": "https://github.com/monero-ecosystem/monero-python/blob/64149f6323af57a3924f45ed87997d64387c5ee0/monero/wordlists/wordlist.py#L59-L71", "sha": "64149f6323af57a3924f45ed87997d64387c5ee0", "docstring_summary": "Calculate hexadecimal representation of the phrase.", "language": "python", "parameters": "(cls, phrase)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "split", "(", "\" \"", ")", "arg_2", "=", "\"\"", "for", "arg_3", "in", "range", "(", "len", "(", "arg_1", ")", "//", "3", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_1", "[", "3", "*", "arg_3", ":", "3", "*", "arg_3", "+", "3", "]", "arg_7", "=", "arg_0", ".", "word_list", ".", "index", "(", "arg_4", ")", "arg_8", "=", "arg_0", ".", "word_list", ".", "index", "(", "arg_5", ")", "%", "arg_0", ".", "n", "arg_9", "=", "arg_0", ".", "word_list", ".", "index", "(", "arg_6", ")", "%", "arg_0", ".", "n", "arg_10", "=", "arg_7", "+", "arg_0", ".", "n", "*", "(", "(", "arg_8", "-", "arg_7", ")", "%", "arg_0", ".", "n", ")", "+", "arg_0", ".", "n", "*", "arg_0", ".", "n", "*", "(", "(", "arg_9", "-", "arg_8", ")", "%", "arg_0", ".", "n", ")", "arg_2", "+=", "endian_swap", "(", "\"%08x\"", "%", "arg_10", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Calculate hexadecimal representation of the phrase.\n        \"\"\"\n        arg_1 = arg_1.split(\" \")\n        arg_2 = \"\"\n        for arg_3 in range(len(arg_1) // 3):\n            arg_4, arg_5, arg_6 = arg_1[3*arg_3:3*arg_3+3]\n            arg_7 = arg_0.word_list.index(arg_4)\n            arg_8 = arg_0.word_list.index(arg_5) % arg_0.n\n            arg_9 = arg_0.word_list.index(arg_6) % arg_0.n\n            arg_10 = arg_7 + arg_0.n *((arg_8 - arg_7) % arg_0.n) + arg_0.n * arg_0.n * ((arg_9 - arg_8) % arg_0.n)\n            arg_2 += endian_swap(\"%08x\" % arg_10)\n        return arg_2", "path": "monero/wordlists/wordlist.py", "identifier": "Wordlist.decode", "docstring": "Calculate hexadecimal representation of the phrase.", "docstring_tokens": ["Calculate", "hexadecimal", "representation", "of", "the", "phrase", "."], "nwo": "monero-ecosystem/monero-python", "score": 0.4699390838066248, "idx": 258029}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/types/structUtils.py#L82-L150", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "opposite of packAxiSFrame", "language": "python", "parameters": "(structT, data, getDataFn=None, dataWidth=None)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "assert", "arg_3", "is", "not", "None", "def", "_getDataFn", "(", "arg_4", ")", ":", "return", "toHVal", "(", "arg_4", ")", ".", "_auto_cast", "(", "Bits", "(", "arg_3", ")", ")", "arg_2", "=", "_getDataFn", "arg_5", "=", "arg_0", ".", "fromPy", "(", "None", ")", "arg_6", "=", "iter", "(", "arg_1", ")", "arg_7", "=", "0", "arg_8", "=", "None", "for", "arg_9", "in", "walkFlattenFields", "(", "arg_5", ",", "skipPadding", "=", "False", ")", ":", "arg_10", "=", "arg_9", ".", "_dtype", ".", "bit_length", "(", ")", "if", "arg_8", "is", "None", ":", "arg_7", "=", "0", "try", ":", "arg_8", "=", "arg_2", "(", "next", "(", "arg_6", ")", ")", "except", "StopIteration", ":", "raise", "Exception", "(", "\"Input data too short\"", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_8", ".", "_dtype", ".", "bit_length", "(", ")", "arg_11", "=", "arg_3", "else", ":", "arg_11", "=", "arg_8", ".", "_dtype", ".", "bit_length", "(", ")", "-", "arg_7", "while", "arg_11", "<", "arg_10", ":", "try", ":", "arg_12", "=", "arg_2", "(", "next", "(", "arg_6", ")", ")", "except", "StopIteration", ":", "raise", "Exception", "(", "\"Input data too short\"", ")", "arg_8", "=", "arg_12", ".", "_concat", "(", "arg_8", ")", "arg_11", "+=", "arg_3", "if", "arg_11", ">=", "arg_10", ":", "arg_13", "=", "arg_8", "[", "(", "arg_10", "+", "arg_7", ")", ":", "arg_7", "]", "arg_13", "=", "arg_13", ".", "_auto_cast", "(", "arg_9", ".", "_dtype", ")", "arg_9", ".", "val", "=", "arg_13", ".", "val", "arg_9", ".", "vldMask", "=", "arg_13", ".", "vldMask", "arg_9", ".", "updateTime", "=", "arg_13", ".", "updateTime", "arg_11", "-=", "arg_10", "arg_7", "+=", "arg_10", "if", "arg_11", "==", "0", ":", "arg_8", "=", "None", "if", "arg_8", "is", "not", "None", ":", "assert", "arg_8", ".", "_dtype", ".", "bit_length", "(", ")", "-", "arg_7", "<", "arg_3", ",", "\"It should be just a padding at the end of frame\"", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    opposite of packAxiSFrame\n    \"\"\"\n    if arg_2 is None:\n        assert arg_3 is not None\n\n        def _getDataFn(arg_4):\n            return toHVal(arg_4)._auto_cast(Bits(arg_3))\n\n        arg_2 = _getDataFn\n\n    arg_5 = arg_0.fromPy(None)\n\n    arg_6 = iter(arg_1)\n\n    # actual is storage variable for items from frameData\n    arg_7 = 0\n    arg_8 = None\n\n    for arg_9 in walkFlattenFields(arg_5, skipPadding=False):\n        # walk flatten fields and take values from fData and parse them to\n        # field\n        arg_10 = arg_9._dtype.bit_length()\n\n        if arg_8 is None:\n            arg_7 = 0\n            try:\n                arg_8 = arg_2(next(arg_6))\n            except StopIteration:\n                raise Exception(\"Input data too short\")\n\n            if arg_3 is None:\n                arg_3 = arg_8._dtype.bit_length()\n            arg_11 = arg_3\n        else:\n            arg_11 = arg_8._dtype.bit_length() - arg_7\n\n        while arg_11 < arg_10:\n            # collect data for this field\n            try:\n                arg_12 = arg_2(next(arg_6))\n            except StopIteration:\n                raise Exception(\"Input data too short\")\n\n            arg_8 = arg_12._concat(arg_8)\n            arg_11 += arg_3\n\n        if arg_11 >= arg_10:\n            # parse value of actual to field\n            # skip padding\n            arg_13 = arg_8[(arg_10 + arg_7):arg_7]\n            arg_13 = arg_13._auto_cast(arg_9._dtype)\n            arg_9.val = arg_13.val\n            arg_9.vldMask = arg_13.vldMask\n            arg_9.updateTime = arg_13.updateTime\n\n            # update slice out what was taken\n            arg_11 -= arg_10\n            arg_7 += arg_10\n\n        if arg_11 == 0:\n            arg_8 = None\n\n    if arg_8 is not None:\n        assert arg_8._dtype.bit_length(\n        ) - arg_7 < arg_3, \"It should be just a padding at the end of frame\"\n\n    return arg_5", "path": "hwt/hdl/types/structUtils.py", "identifier": "HStruct_unpack", "docstring": "opposite of packAxiSFrame", "docstring_tokens": ["opposite", "of", "packAxiSFrame"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 258030}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/permutations_runner.py#L1101-L1117", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns filepath where to store HyperSearch JobID", "language": "python", "parameters": "(cls, permWorkDir, outputLabel)", "return_statement": "return filepath", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "arg_4", "=", "\"%s_HyperSearchJobID.pkl\"", "%", "(", "arg_2", ",", ")", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Returns filepath where to store HyperSearch JobID\n\n    Parameters:\n    ----------------------------------------------------------------------\n    permWorkDir: Directory path for saved jobID file\n    outputLabel: Label string for incorporating into file name for saved jobID\n    retval:      Filepath where to store HyperSearch JobID\n    \"\"\"\n    # Get the base path and figure out the path of the report file.\n    arg_3 = arg_1\n\n    # Form the name of the output csv file that will contain all the results\n    arg_4 = \"%s_HyperSearchJobID.pkl\" % (arg_2,)\n    arg_5 = os.path.join(arg_3, arg_4)\n\n    return arg_5", "path": "src/nupic/swarming/permutations_runner.py", "identifier": "_HyperSearchRunner.__getHyperSearchJobIDFilePath", "docstring": "Returns filepath where to store HyperSearch JobID\n\n    Parameters:\n    ----------------------------------------------------------------------\n    permWorkDir: Directory path for saved jobID file\n    outputLabel: Label string for incorporating into file name for saved jobID\n    retval:      Filepath where to store HyperSearch JobID", "docstring_tokens": ["Returns", "filepath", "where", "to", "store", "HyperSearch", "JobID"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258031}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_16_multiproc_context.py#L10-L25", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Target function that manipulates the trajectory.", "language": "python", "parameters": "(traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "last_process_name", "=", "mp", ".", "current_process", "(", ")", ".", "name", "arg_0", ".", "results", ".", "f_store", "(", "store_data", "=", "3", ")"], "function": "def Func(arg_0):\n    \"\"\" Target function that manipulates the trajectory.\n\n    Stores the current name of the process into the trajectory and\n    **overwrites** previous settings.\n\n    :param traj:\n\n        Trajectory container with multiprocessing safe storage service\n\n    \"\"\"\n\n    # Manipulate the data in the trajectory\n    arg_0.last_process_name = mp.current_process().name\n    # Store the manipulated data\n    arg_0.results.f_store(store_data=3)", "path": "examples/example_16_multiproc_context.py", "identifier": "manipulate_multiproc_safe", "docstring": "Target function that manipulates the trajectory.\n\n    Stores the current name of the process into the trajectory and\n    **overwrites** previous settings.\n\n    :param traj:\n\n        Trajectory container with multiprocessing safe storage service", "docstring_tokens": ["Target", "function", "that", "manipulates", "the", "trajectory", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258032}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L147-L159", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Get the state of ``dkpg`` selections.", "language": "python", "parameters": "()", "return_statement": "return selections", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "settings", "(", "hide", "(", "'stdout'", ")", ")", ":", "arg_0", "=", "run_as_root", "(", "'dpkg --get-selections'", ")", "arg_1", "=", "dict", "(", ")", "for", "arg_2", "in", "arg_0", ".", "splitlines", "(", ")", ":", "arg_3", ",", "arg_4", "=", "arg_2", ".", "split", "(", ")", "arg_1", ".", "setdefault", "(", "arg_4", ",", "list", "(", ")", ")", ".", "append", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func():\n    \"\"\"\n    Get the state of ``dkpg`` selections.\n\n    Returns a dict with state => [packages].\n    \"\"\"\n    with settings(hide('stdout')):\n        arg_0 = run_as_root('dpkg --get-selections')\n    arg_1 = dict()\n    for arg_2 in arg_0.splitlines():\n        arg_3, arg_4 = arg_2.split()\n        arg_1.setdefault(arg_4, list()).append(arg_3)\n    return arg_1", "path": "burlap/deb.py", "identifier": "get_selections", "docstring": "Get the state of ``dkpg`` selections.\n\n    Returns a dict with state => [packages].", "docstring_tokens": ["Get", "the", "state", "of", "dkpg", "selections", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258033}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/utils.py#L67-L80", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Make the url for log-files in heron-shell\n  from the info stored in stmgr.\n  If no instance_id is provided, the link will\n  be to the dir for the whole container.\n  If shell port is not present, it returns None.", "language": "python", "parameters": "(host, shell_port, _, instance_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "not", "arg_1", ":", "return", "None", "if", "not", "arg_3", ":", "return", "\"http://%s:%d/browse/log-files\"", "%", "(", "arg_0", ",", "arg_1", ")", "else", ":", "return", "\"http://%s:%d/file/log-files/%s.log.0\"", "%", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n  \"\"\"\n  Make the url for log-files in heron-shell\n  from the info stored in stmgr.\n  If no instance_id is provided, the link will\n  be to the dir for the whole container.\n  If shell port is not present, it returns None.\n  \"\"\"\n  if not arg_1:\n    return None\n  if not arg_3:\n    return \"http://%s:%d/browse/log-files\" % (arg_0, arg_1)\n  else:\n    return \"http://%s:%d/file/log-files/%s.log.0\" % (arg_0, arg_1, arg_3)", "path": "heron/tools/tracker/src/python/utils.py", "identifier": "make_shell_logfiles_url", "docstring": "Make the url for log-files in heron-shell\n  from the info stored in stmgr.\n  If no instance_id is provided, the link will\n  be to the dir for the whole container.\n  If shell port is not present, it returns None.", "docstring_tokens": ["Make", "the", "url", "for", "log", "-", "files", "in", "heron", "-", "shell", "from", "the", "info", "stored", "in", "stmgr", ".", "If", "no", "instance_id", "is", "provided", "the", "link", "will", "be", "to", "the", "dir", "for", "the", "whole", "container", ".", "If", "shell", "port", "is", "not", "present", "it", "returns", "None", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258034}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/unit.py#L154-L160", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Register interface in implementation phase", "language": "python", "parameters": "(self, iName, intf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_registerInterface", "(", "arg_1", ",", "arg_2", ",", "isPrivate", "=", "True", ")", "arg_0", ".", "_loadInterface", "(", "arg_2", ",", "False", ")", "arg_2", ".", "_signalsForInterface", "(", "arg_0", ".", "_ctx", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Register interface in implementation phase\n        \"\"\"\n        arg_0._registerInterface(arg_1, arg_2, isPrivate=True)\n        arg_0._loadInterface(arg_2, False)\n        arg_2._signalsForInterface(arg_0._ctx)", "path": "hwt/synthesizer/unit.py", "identifier": "Unit._registerIntfInImpl", "docstring": "Register interface in implementation phase", "docstring_tokens": ["Register", "interface", "in", "implementation", "phase"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 258035}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/connection.py#L470-L489", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Get a Connection instance.", "language": "python", "parameters": "(self)", "return_statement": "return connWrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_logger", ".", "debug", "(", "\"Acquiring connection\"", ")", "arg_0", ".", "_conn", ".", "_ping_check", "(", ")", "arg_1", "=", "ConnectionWrapper", "(", "dbConn", "=", "arg_0", ".", "_conn", ",", "cursor", "=", "arg_0", ".", "_conn", ".", "cursor", "(", ")", ",", "releaser", "=", "arg_0", ".", "_releaseConnection", ",", "logger", "=", "arg_0", ".", "_logger", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" Get a Connection instance.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:       A ConnectionWrapper instance. NOTE: Caller\n                    is responsible for calling the  ConnectionWrapper\n                    instance's release() method or use it in a context manager\n                    expression (with ... as:) to release resources.\n    \"\"\"\n    arg_0._logger.debug(\"Acquiring connection\")\n\n    # Check connection and attempt to re-establish it if it died (this is\n    #   what PooledDB does)\n    arg_0._conn._ping_check()\n    arg_1 = ConnectionWrapper(dbConn=arg_0._conn,\n                                 cursor=arg_0._conn.cursor(),\n                                 releaser=arg_0._releaseConnection,\n                                 logger=arg_0._logger)\n    return arg_1", "path": "src/nupic/database/connection.py", "identifier": "SingleSharedConnectionPolicy.acquireConnection", "docstring": "Get a Connection instance.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:       A ConnectionWrapper instance. NOTE: Caller\n                    is responsible for calling the  ConnectionWrapper\n                    instance's release() method or use it in a context manager\n                    expression (with ... as:) to release resources.", "docstring_tokens": ["Get", "a", "Connection", "instance", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258036}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/core.py#L59-L68", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the alpha value given the material state.", "language": "python", "parameters": "(self, **state)", "return_statement": "return self.k(**state) / self.rho(**state) / self.Cp(**state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "return", "arg_0", ".", "k", "(", "**", "arg_1", ")", "/", "arg_0", ".", "rho", "(", "**", "arg_1", ")", "/", "arg_0", ".", "Cp", "(", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Calculate the Func value given the material state.\n\n        :param **state: material state\n\n        :returns: float\n        \"\"\"\n\n        return arg_0.k(**arg_1) / arg_0.rho(**arg_1) / arg_0.Cp(**arg_1)", "path": "auxi/modelling/process/materials/core.py", "identifier": "Material.alpha", "docstring": "Calculate the alpha value given the material state.\n\n        :param **state: material state\n\n        :returns: float", "docstring_tokens": ["Calculate", "the", "alpha", "value", "given", "the", "material", "state", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 258037}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L133-L144", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Increment a Counter metric", "language": "python", "parameters": "(self, name, count=1, rate=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "1", ")", ":", "if", "arg_0", ".", "_should_send_metric", "(", "arg_1", ",", "arg_3", ")", ":", "arg_0", ".", "_request", "(", "Counter", "(", "arg_0", ".", "_create_metric_name_for_request", "(", "arg_1", ")", ",", "int", "(", "arg_2", ")", ",", "arg_3", ")", ".", "to_request", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=1):\n        # type: (str, int, float) -> None\n        \"\"\"Increment a Counter metric\"\"\"\n\n        if arg_0._should_send_metric(arg_1, arg_3):\n            arg_0._request(\n                Counter(\n                    arg_0._create_metric_name_for_request(arg_1),\n                    int(arg_2),\n                    arg_3\n                ).to_request()\n            )", "path": "statsdmetrics/client/__init__.py", "identifier": "AbstractClient.increment", "docstring": "Increment a Counter metric", "docstring_tokens": ["Increment", "a", "Counter", "metric"], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 258038}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L8-L15", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return account resource for given canvas account id.", "language": "python", "parameters": "(self, account_id)", "return_statement": "return CanvasAccount(data=self._get_resource(url))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ACCOUNTS_API", ".", "format", "(", "arg_1", ")", "return", "CanvasAccount", "(", "data", "=", "arg_0", ".", "_get_resource", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return account resource for given canvas account id.\n\n        https://canvas.instructure.com/doc/api/accounts.html#method.accounts.show\n        \"\"\"\n        arg_2 = ACCOUNTS_API.format(arg_1)\n        return CanvasAccount(data=arg_0._get_resource(arg_2))", "path": "uw_canvas/accounts.py", "identifier": "Accounts.get_account", "docstring": "Return account resource for given canvas account id.\n\n        https://canvas.instructure.com/doc/api/accounts.html#method.accounts.show", "docstring_tokens": ["Return", "account", "resource", "for", "given", "canvas", "account", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 258039}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L262-L269", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Creates an SSH tunnel.", "language": "python", "parameters": "(self, local_port, remote_port)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "local_renderer", "arg_3", ".", "env", ".", "Func_local_port", "=", "arg_1", "arg_3", ".", "env", ".", "Func_remote_port", "=", "arg_2", "arg_3", ".", "local", "(", "' ssh -i {key_filename} -L {Func_local_port}:localhost:{Func_remote_port} {user}@{host_string} -N'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Creates an SSH Func.\n        \"\"\"\n        arg_3 = arg_0.local_renderer\n        arg_3.env.Func_local_port = arg_1\n        arg_3.env.Func_remote_port = arg_2\n        arg_3.local(' ssh -i {key_filename} -L {Func_local_port}:localhost:{Func_remote_port} {user}@{host_string} -N')", "path": "burlap/debug.py", "identifier": "DebugSatchel.tunnel", "docstring": "Creates an SSH tunnel.", "docstring_tokens": ["Creates", "an", "SSH", "tunnel", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258040}
{"url": "https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/seeder.py#L141-L160", "sha": "eb4c60a62d8c42dc52e2c48e7fd88a349770cfee", "docstring_summary": "Populate the database using all the Entity classes previously added.", "language": "python", "parameters": "(self, using=None)", "return_statement": "return inserted_entities", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "get_connection", "(", ")", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_0", ".", "orders", ":", "arg_4", "=", "arg_0", ".", "quantities", "[", "arg_3", "]", "if", "arg_3", "not", "in", "arg_2", ":", "arg_2", "[", "arg_3", "]", "=", "[", "]", "for", "arg_5", "in", "range", "(", "0", ",", "arg_4", ")", ":", "arg_6", "=", "arg_0", ".", "entities", "[", "arg_3", "]", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_2", "[", "arg_3", "]", ".", "append", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Populate the database using all the Entity classes previously added.\n\n        :param using A Django database connection name\n        :rtype: A list of the inserted PKs\n        \"\"\"\n        if not arg_1:\n            arg_1 = arg_0.get_connection()\n\n        arg_2 = {}\n        for arg_3 in arg_0.orders:\n            arg_4 = arg_0.quantities[arg_3]\n            if arg_3 not in arg_2:\n                arg_2[arg_3] = []\n            for arg_5 in range(0, arg_4):\n                arg_6 = arg_0.entities[arg_3].Func(arg_1, arg_2)\n                arg_2[arg_3].append(arg_6)\n\n        return arg_2", "path": "django_seed/seeder.py", "identifier": "Seeder.execute", "docstring": "Populate the database using all the Entity classes previously added.\n\n        :param using A Django database connection name\n        :rtype: A list of the inserted PKs", "docstring_tokens": ["Populate", "the", "database", "using", "all", "the", "Entity", "classes", "previously", "added", "."], "nwo": "Brobin/django-seed", "score": 0.7441393251258983, "idx": 258041}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/audio.py#L155-L208", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Load an audio buffer using audioread.", "language": "python", "parameters": "(path, offset, duration, dtype)", "return_statement": "return y, sr_native", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "with", "audioread", ".", "audio_open", "(", "arg_0", ")", "as", "input_file", ":", "arg_5", "=", "input_file", ".", "samplerate", "arg_6", "=", "input_file", ".", "channels", "arg_7", "=", "int", "(", "np", ".", "round", "(", "arg_5", "*", "arg_1", ")", ")", "*", "arg_6", "if", "arg_2", "is", "None", ":", "arg_8", "=", "np", ".", "inf", "else", ":", "arg_8", "=", "arg_7", "+", "(", "int", "(", "np", ".", "round", "(", "arg_5", "*", "arg_2", ")", ")", "*", "arg_6", ")", "arg_9", "=", "0", "for", "arg_10", "in", "input_file", ":", "arg_10", "=", "util", ".", "buf_to_float", "(", "arg_10", ",", "arg_3", "=", "arg_3", ")", "arg_11", "=", "arg_9", "arg_9", "=", "arg_9", "+", "len", "(", "arg_10", ")", "if", "arg_9", "<", "arg_7", ":", "continue", "if", "arg_8", "<", "arg_11", ":", "break", "if", "arg_8", "<", "arg_9", ":", "arg_10", "=", "arg_10", "[", ":", "arg_8", "-", "arg_11", "]", "if", "arg_11", "<=", "arg_7", "<=", "arg_9", ":", "arg_10", "=", "arg_10", "[", "(", "arg_7", "-", "arg_11", ")", ":", "]", "arg_4", ".", "append", "(", "arg_10", ")", "if", "arg_4", ":", "arg_4", "=", "np", ".", "concatenate", "(", "arg_4", ")", "if", "arg_6", ">", "1", ":", "arg_4", "=", "arg_4", ".", "reshape", "(", "(", "-", "1", ",", "arg_6", ")", ")", ".", "T", "else", ":", "arg_4", "=", "np", ".", "empty", "(", "0", ",", "arg_3", "=", "arg_3", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''Load an audio buffer using audioread.\n\n    This loads one block at a time, and then concatenates the results.\n    '''\n\n    arg_4 = []\n    with audioread.audio_open(arg_0) as input_file:\n        arg_5 = input_file.samplerate\n        arg_6 = input_file.channels\n\n        arg_7 = int(np.round(arg_5 * arg_1)) * arg_6\n\n        if arg_2 is None:\n            arg_8 = np.inf\n        else:\n            arg_8 = arg_7 + (int(np.round(arg_5 * arg_2))\n                               * arg_6)\n\n        arg_9 = 0\n\n        for arg_10 in input_file:\n            arg_10 = util.buf_to_float(arg_10, arg_3=arg_3)\n            arg_11 = arg_9\n            arg_9 = arg_9 + len(arg_10)\n\n            if arg_9 < arg_7:\n                # offset is after the current frame\n                # keep reading\n                continue\n\n            if arg_8 < arg_11:\n                # we're off the end.  stop reading\n                break\n\n            if arg_8 < arg_9:\n                # the end is in this frame.  crop.\n                arg_10 = arg_10[:arg_8 - arg_11]\n\n            if arg_11 <= arg_7 <= arg_9:\n                # beginning is in this frame\n                arg_10 = arg_10[(arg_7 - arg_11):]\n\n            # tack on the current frame\n            arg_4.append(arg_10)\n\n    if arg_4:\n        arg_4 = np.concatenate(arg_4)\n        if arg_6 > 1:\n            arg_4 = arg_4.reshape((-1, arg_6)).T\n    else:\n        arg_4 = np.empty(0, arg_3=arg_3)\n\n    return arg_4, arg_5", "path": "librosa/core/audio.py", "identifier": "__audioread_load", "docstring": "Load an audio buffer using audioread.\n\n    This loads one block at a time, and then concatenates the results.", "docstring_tokens": ["Load", "an", "audio", "buffer", "using", "audioread", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258042}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/utils.py#L195-L205", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "UserWarning if array contains non-finite elements", "language": "python", "parameters": "(X)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "np", ".", "asanyarray", "(", "arg_0", ")", "if", "(", "arg_0", ".", "dtype", ".", "char", "in", "np", ".", "typecodes", "[", "'AllFloat'", "]", "and", "not", "np", ".", "isfinite", "(", "arg_0", ".", "sum", "(", ")", ")", "and", "not", "np", ".", "isfinite", "(", "arg_0", ")", ".", "all", "(", ")", ")", ":", "warnings", ".", "warn", "(", "\"Result contains NaN, infinity\"", "\" or a value too large for %r.\"", "%", "arg_0", ".", "dtype", ",", "category", "=", "UserWarning", ")"], "function": "def Func(arg_0):\n    \"\"\"UserWarning if array contains non-finite elements\"\"\"\n    arg_0 = np.asanyarray(arg_0)\n    # First try an O(n) time, O(1) space solution for the common case that\n    # everything is finite; fall back to O(n) space np.isfinite to prevent\n    # false positives from overflow in sum method\n    if (arg_0.dtype.char in np.typecodes['AllFloat'] and\n            not np.isfinite(arg_0.sum()) and not np.isfinite(arg_0).all()):\n        warnings.warn(\"Result contains NaN, infinity\"\n                      \" or a value too large for %r.\" % arg_0.dtype,\n                      category=UserWarning)", "path": "osprey/utils.py", "identifier": "_warn_if_not_finite", "docstring": "UserWarning if array contains non-finite elements", "docstring_tokens": ["UserWarning", "if", "array", "contains", "non", "-", "finite", "elements"], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 258043}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L866-L888", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Return all items with a given name and parent folder name.", "language": "python", "parameters": "(self, name, folder_name,\n                                            token=None)", "return_statement": "return response['items']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "dict", "(", ")", "arg_4", "[", "'name'", "]", "=", "arg_1", "arg_4", "[", "'folderName'", "]", "=", "arg_2", "if", "arg_3", ":", "arg_4", "[", "'token'", "]", "=", "arg_3", "arg_5", "=", "arg_0", ".", "request", "(", "'midas.item.searchbynameandfoldername'", ",", "arg_4", ")", "return", "arg_5", "[", "'items'", "]"], "function": "def Func(arg_0, arg_1, arg_2,\n                                            arg_3=None):\n        \"\"\"\n        Return all items with a given name and parent folder name.\n\n        :param name: The name of the item to search by.\n        :type name: string\n        :param folder_name: The name of the parent folder to search by.\n        :type folder_name: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: A list of all items with the given name and parent folder\n            name.\n        :rtype: list[dict]\n        \"\"\"\n        arg_4 = dict()\n        arg_4['name'] = arg_1\n        arg_4['folderName'] = arg_2\n        if arg_3:\n            arg_4['token'] = arg_3\n        arg_5 = arg_0.request('midas.item.searchbynameandfoldername',\n                                arg_4)\n        return arg_5['items']", "path": "pydas/drivers.py", "identifier": "CoreDriver.search_item_by_name_and_folder_name", "docstring": "Return all items with a given name and parent folder name.\n\n        :param name: The name of the item to search by.\n        :type name: string\n        :param folder_name: The name of the parent folder to search by.\n        :type folder_name: string\n        :param token: (optional) A valid token for the user in question.\n        :type token: None | string\n        :returns: A list of all items with the given name and parent folder\n            name.\n        :rtype: list[dict]", "docstring_tokens": ["Return", "all", "items", "with", "a", "given", "name", "and", "parent", "folder", "name", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 258044}
{"url": "https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/utils.py#L16-L39", "sha": "986c4b1315d6b128947c3bc3494513d8e5380ff0", "docstring_summary": "A context manager that creates a temporary database.", "language": "python", "parameters": "(db, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "temp_name", "(", ")", "arg_0", ".", "create", "(", "arg_1", ")", "if", "not", "arg_0", ".", "exists", "(", "arg_1", ")", ":", "raise", "DatabaseError", "(", "'failed to create database %s!'", ")", "try", ":", "yield", "arg_1", "finally", ":", "arg_0", ".", "drop", "(", "arg_1", ")", "if", "arg_0", ".", "exists", "(", "arg_1", ")", ":", "raise", "DatabaseError", "(", "'failed to drop database %s!'", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    A context manager that creates a temporary database.\n\n    Useful for automated tests.\n\n    Parameters\n    ----------\n    db: object\n        a preconfigured DB object\n    name: str, optional\n        name of the database to be created. (default: globally unique name)\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = temp_name()\n    arg_0.create(arg_1)\n    if not arg_0.exists(arg_1):\n        raise DatabaseError('failed to create database %s!')\n    try:\n        yield arg_1\n    finally:\n        arg_0.drop(arg_1)\n        if arg_0.exists(arg_1):\n            raise DatabaseError('failed to drop database %s!')", "path": "pydba/utils.py", "identifier": "temp_db", "docstring": "A context manager that creates a temporary database.\n\n    Useful for automated tests.\n\n    Parameters\n    ----------\n    db: object\n        a preconfigured DB object\n    name: str, optional\n        name of the database to be created. (default: globally unique name)", "docstring_tokens": ["A", "context", "manager", "that", "creates", "a", "temporary", "database", "."], "nwo": "drkjam/pydba", "score": 0.138843686048881, "idx": 258045}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/__init__.py#L289-L298", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Generates session key string.", "language": "python", "parameters": "(self, key)", "return_statement": "return '{0}:{1}:{2}'.format(self.settings.prefix, self.name, key)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "'{0}:{1}:{2}'", ".", "format", "(", "arg_0", ".", "settings", ".", "prefix", ",", "arg_0", ".", "name", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Generates session key string.\n\n        :param str key:\n            e.g. ``\"authomatic:facebook:key\"``\n\n        \"\"\"\n\n        return '{0}:{1}:{2}'.format(arg_0.settings.prefix, arg_0.name, arg_1)", "path": "authomatic/providers/__init__.py", "identifier": "BaseProvider._session_key", "docstring": "Generates session key string.\n\n        :param str key:\n            e.g. ``\"authomatic:facebook:key\"``", "docstring_tokens": ["Generates", "session", "key", "string", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 258046}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L233-L246", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Check whether the file exists, on local disk or GCS.", "language": "python", "parameters": "(file_path, credentials=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", ".", "startswith", "(", "'gs://'", ")", ":", "return", "_Func_in_gcs", "(", "arg_0", ",", "arg_1", ")", "else", ":", "return", "os", ".", "path", ".", "isfile", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n  \"\"\"Check whether the file exists, on local disk or GCS.\n\n  Args:\n    file_path: The target file path; should have the 'gs://' prefix if in gcs.\n    credentials: Optional credential to be used to load the file from gcs.\n\n  Returns:\n    True if the file's there.\n  \"\"\"\n  if arg_0.startswith('gs://'):\n    return _Func_in_gcs(arg_0, arg_1)\n  else:\n    return os.path.isfile(arg_0)", "path": "dsub/lib/dsub_util.py", "identifier": "file_exists", "docstring": "Check whether the file exists, on local disk or GCS.\n\n  Args:\n    file_path: The target file path; should have the 'gs://' prefix if in gcs.\n    credentials: Optional credential to be used to load the file from gcs.\n\n  Returns:\n    True if the file's there.", "docstring_tokens": ["Check", "whether", "the", "file", "exists", "on", "local", "disk", "or", "GCS", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 258047}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L377-L389", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Activate authentication arguments parsing", "language": "python", "parameters": "(self, basic_auth=True, token_auth=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "parser", ".", "add_argument_group", "(", "'authentication arguments'", ")", "if", "arg_1", ":", "arg_3", ".", "add_argument", "(", "'-u'", ",", "'--backend-user'", ",", "dest", "=", "'user'", ",", "help", "=", "\"backend user\"", ")", "arg_3", ".", "add_argument", "(", "'-p'", ",", "'--backend-password'", ",", "dest", "=", "'password'", ",", "help", "=", "\"backend password\"", ")", "if", "arg_2", ":", "arg_3", ".", "add_argument", "(", "'-t'", ",", "'--api-token'", ",", "dest", "=", "'api_token'", ",", "help", "=", "\"backend authentication token / API key\"", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=False):\n        \"\"\"Activate authentication arguments parsing\"\"\"\n\n        arg_3 = arg_0.parser.add_argument_group('authentication arguments')\n\n        if arg_1:\n            arg_3.add_argument('-u', '--backend-user', dest='user',\n                               help=\"backend user\")\n            arg_3.add_argument('-p', '--backend-password', dest='password',\n                               help=\"backend password\")\n        if arg_2:\n            arg_3.add_argument('-t', '--api-token', dest='api_token',\n                               help=\"backend authentication token / API key\")", "path": "perceval/backend.py", "identifier": "BackendCommandArgumentParser._set_auth_arguments", "docstring": "Activate authentication arguments parsing", "docstring_tokens": ["Activate", "authentication", "arguments", "parsing"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 258048}
{"url": "https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/registry.py#L61-L81", "sha": "aca085ea54541b087140b58a81332f8728baeeb2", "docstring_summary": "Returns the profile with the received ID as a dict", "language": "python", "parameters": "(self, profile_id)", "return_statement": "return self._profiles[profile_id]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_profiles", ":", "try", ":", "arg_0", ".", "_profiles", "[", "arg_1", "]", "=", "arg_0", ".", "_Func_profile", "(", "arg_1", ")", "except", "(", "ValueError", ",", "IOError", ")", "as", "e", ":", "six", ".", "raise_from", "(", "RegistryError", "(", "e", ")", ",", "e", ")", "return", "arg_0", ".", "_profiles", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        '''Returns the profile with the received ID as a dict\n\n        If a local copy of the profile exists, it'll be returned. If not, it'll\n        be downloaded from the web. The results are cached, so any subsequent\n        calls won't hit the filesystem or the web.\n\n        Args:\n            profile_id (str): The ID of the profile you want.\n\n        Raises:\n            RegistryError: If there was some problem opening the profile file\n                or its format was incorrect.\n        '''\n        if arg_1 not in arg_0._profiles:\n            try:\n                arg_0._profiles[arg_1] = arg_0._Func_profile(arg_1)\n            except (ValueError,\n                    IOError) as e:\n                six.raise_from(RegistryError(e), e)\n        return arg_0._profiles[arg_1]", "path": "datapackage/registry.py", "identifier": "Registry.get", "docstring": "Returns the profile with the received ID as a dict\n\n        If a local copy of the profile exists, it'll be returned. If not, it'll\n        be downloaded from the web. The results are cached, so any subsequent\n        calls won't hit the filesystem or the web.\n\n        Args:\n            profile_id (str): The ID of the profile you want.\n\n        Raises:\n            RegistryError: If there was some problem opening the profile file\n                or its format was incorrect.", "docstring_tokens": ["Returns", "the", "profile", "with", "the", "received", "ID", "as", "a", "dict"], "nwo": "frictionlessdata/datapackage-py", "score": 0.5653088377587532, "idx": 258049}
{"url": "https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L334-L343", "sha": "13fbb1ea4c1bb422de91a726c3c7f1038d3743a3", "docstring_summary": "Wraps scalars or string types as a list, or returns the iterable instance.", "language": "python", "parameters": "(inst)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "string_types", ")", ":", "return", "[", "arg_0", "]", "elif", "not", "isinstance", "(", "arg_0", ",", "collections", ".", "Iterable", ")", ":", "return", "[", "arg_0", "]", "else", ":", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"\n    Wraps scalars or string types as a list, or returns the iterable instance.\n    \"\"\"\n    if isinstance(arg_0, string_types):\n        return [arg_0]\n    elif not isinstance(arg_0, collections.Iterable):\n        return [arg_0]\n    else:\n        return arg_0", "path": "flask_cors/core.py", "identifier": "ensure_iterable", "docstring": "Wraps scalars or string types as a list, or returns the iterable instance.", "docstring_tokens": ["Wraps", "scalars", "or", "string", "types", "as", "a", "list", "or", "returns", "the", "iterable", "instance", "."], "nwo": "corydolphin/flask-cors", "score": 0.7744905909522264, "idx": 258050}
{"url": "https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L76-L92", "sha": "ca219db41eb56bdd1c0389cdc1508a41698958d7", "docstring_summary": "Unregisters the given model with Algolia engine.", "language": "python", "parameters": "(self, model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "is_registered", "(", "arg_1", ")", ":", "raise", "RegistrationError", "(", "'{} is not registered with Algolia engine'", ".", "format", "(", "arg_1", ")", ")", "del", "arg_0", ".", "__registered_models", "[", "arg_1", "]", "post_save", ".", "disconnect", "(", "arg_0", ".", "__post_save_receiver", ",", "arg_1", ")", "pre_delete", ".", "disconnect", "(", "arg_0", ".", "__pre_delete_receiver", ",", "arg_1", ")", "logger", ".", "info", "(", "'UNREGISTER %s'", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Unregisters the given model with Algolia engine.\n\n        If the given model is not registered with Algolia engine, a\n        RegistrationError will be raised.\n        \"\"\"\n        if not arg_0.is_registered(arg_1):\n            raise RegistrationError(\n                '{} is not registered with Algolia engine'.format(arg_1))\n        # Perform the unregistration.\n        del arg_0.__registered_models[arg_1]\n\n        # Disconnect from the signalling framework.\n        post_save.disconnect(arg_0.__post_save_receiver, arg_1)\n        pre_delete.disconnect(arg_0.__pre_delete_receiver, arg_1)\n        logger.info('UNREGISTER %s', arg_1)", "path": "algoliasearch_django/registration.py", "identifier": "AlgoliaEngine.unregister", "docstring": "Unregisters the given model with Algolia engine.\n\n        If the given model is not registered with Algolia engine, a\n        RegistrationError will be raised.", "docstring_tokens": ["Unregisters", "the", "given", "model", "with", "Algolia", "engine", "."], "nwo": "algolia/algoliasearch-django", "score": 0.7567196870624601, "idx": 258051}
{"url": "https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/owsrequest.py#L125-L132", "sha": "e6a36b3aeeacf44eec537434b0fb87c09ab54b5f", "docstring_summary": "Find requested version in GET request.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_param", "(", "param", "=", "\"version\"", ",", "allowed_values", "=", "allowed_versions", "[", "arg_0", ".", "params", "[", "'service'", "]", "]", ",", "optional", "=", "True", ")", "if", "arg_1", "is", "None", "and", "arg_0", ".", "_get_request_type", "(", ")", "!=", "\"getcapabilities\"", ":", "raise", "OWSMissingParameterValue", "(", "'Parameter \"version\" is missing'", ",", "value", "=", "\"version\"", ")", "else", ":", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Find requested version in GET request.\"\"\"\n        arg_1 = arg_0._get_param(param=\"version\", allowed_values=allowed_versions[arg_0.params['service']],\n                                  optional=True)\n        if arg_1 is None and arg_0._get_request_type() != \"getcapabilities\":\n            raise OWSMissingParameterValue('Parameter \"version\" is missing', value=\"version\")\n        else:\n            return arg_1", "path": "twitcher/owsrequest.py", "identifier": "Get._get_version", "docstring": "Find requested version in GET request.", "docstring_tokens": ["Find", "requested", "version", "in", "GET", "request", "."], "nwo": "bird-house/twitcher", "score": 0.37599664903417057, "idx": 258052}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L149-L203", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Format the exception part of a traceback.", "language": "python", "parameters": "(etype, value)", "return_statement": "return lines", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "isinstance", "(", "arg_0", ",", "BaseException", ")", "or", "arg_0", "is", "None", "or", "type", "(", "arg_0", ")", "is", "str", ")", ":", "return", "[", "_format_final_exc_line", "(", "arg_0", ",", "arg_1", ")", "]", "arg_2", "=", "arg_0", ".", "__name__", "if", "not", "issubclass", "(", "arg_0", ",", "SyntaxError", ")", ":", "return", "[", "_format_final_exc_line", "(", "arg_2", ",", "arg_1", ")", "]", "arg_3", "=", "[", "]", "try", ":", "arg_4", ",", "(", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "=", "arg_1", ".", "args", "except", "Exception", ":", "pass", "else", ":", "arg_5", "=", "arg_5", "or", "\"<string>\"", "arg_3", ".", "append", "(", "'  File \"%s\", line %d\\n'", "%", "(", "arg_5", ",", "arg_6", ")", ")", "if", "arg_8", "is", "not", "None", ":", "arg_3", ".", "append", "(", "'    %s\\n'", "%", "arg_8", ".", "strip", "(", ")", ")", "if", "arg_7", "is", "not", "None", ":", "arg_9", "=", "arg_8", ".", "rstrip", "(", "'\\n'", ")", "arg_7", "=", "min", "(", "len", "(", "arg_9", ")", ",", "arg_7", ")", "-", "1", "arg_9", "=", "arg_9", "[", ":", "arg_7", "]", ".", "lstrip", "(", ")", "arg_9", "=", "(", "(", "c", ".", "isspace", "(", ")", "and", "c", "or", "' '", ")", "for", "c", "in", "arg_9", ")", "arg_3", ".", "append", "(", "'    %s^\\n'", "%", "''", ".", "join", "(", "arg_9", ")", ")", "arg_1", "=", "arg_4", "arg_3", ".", "append", "(", "_format_final_exc_line", "(", "arg_2", ",", "arg_1", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Format the exception part of a traceback.\n\n    The arguments are the exception type and value such as given by\n    sys.last_type and sys.last_value. The return value is a list of\n    strings, each ending in a newline.\n\n    Normally, the list contains a single string; however, for\n    SyntaxError exceptions, it contains several lines that (when\n    printed) display detailed information about where the syntax\n    error occurred.\n\n    The message indicating which exception occurred is always the last\n    string in the list.\n\n    \"\"\"\n\n    # An instance should not have a meaningful value parameter, but\n    # sometimes does, particularly for string exceptions, such as\n    # >>> raise string1, string2  # deprecated\n    #\n    # Clear these out first because issubtype(string1, SyntaxError)\n    # would raise another exception and mask the original problem.\n    if (isinstance(arg_0, BaseException) or\n#        isinstance(etype, types.InstanceType) or\n        arg_0 is None or type(arg_0) is str):\n        return [_format_final_exc_line(arg_0, arg_1)]\n\n    arg_2 = arg_0.__name__\n\n    if not issubclass(arg_0, SyntaxError):\n        return [_format_final_exc_line(arg_2, arg_1)]\n\n    # It was a syntax error; show exactly where the problem was found.\n    arg_3 = []\n    try:\n        arg_4, (arg_5, arg_6, arg_7, arg_8) = arg_1.args\n    except Exception:\n        pass\n    else:\n        arg_5 = arg_5 or \"<string>\"\n        arg_3.append('  File \"%s\", line %d\\n' % (arg_5, arg_6))\n        if arg_8 is not None:\n            arg_3.append('    %s\\n' % arg_8.strip())\n            if arg_7 is not None:\n                arg_9 = arg_8.rstrip('\\n')\n                arg_7 = min(len(arg_9), arg_7) - 1\n                arg_9 = arg_9[:arg_7].lstrip()\n                # non-space whitespace (likes tabs) must be kept for alignment\n                arg_9 = ((c.isspace() and c or ' ') for c in arg_9)\n                arg_3.append('    %s^\\n' % ''.join(arg_9))\n        arg_1 = arg_4\n\n    arg_3.append(_format_final_exc_line(arg_2, arg_1))\n    return arg_3", "path": "third_party/stdlib/traceback.py", "identifier": "format_exception_only", "docstring": "Format the exception part of a traceback.\n\n    The arguments are the exception type and value such as given by\n    sys.last_type and sys.last_value. The return value is a list of\n    strings, each ending in a newline.\n\n    Normally, the list contains a single string; however, for\n    SyntaxError exceptions, it contains several lines that (when\n    printed) display detailed information about where the syntax\n    error occurred.\n\n    The message indicating which exception occurred is always the last\n    string in the list.", "docstring_tokens": ["Format", "the", "exception", "part", "of", "a", "traceback", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258053}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3403-L3446", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Initialize lookup table for string input of LCD fields", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Tot\"", "]", "=", "LCDItems", ".", "kWh_Tot", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Tot\"", "]", "=", "LCDItems", ".", "Rev_kWh_Tot", "arg_0", ".", "m_lcd_lookup", "[", "\"RMS_Volts_Ln_1\"", "]", "=", "LCDItems", ".", "RMS_Volts_Ln_1", "arg_0", ".", "m_lcd_lookup", "[", "\"RMS_Volts_Ln_2\"", "]", "=", "LCDItems", ".", "RMS_Volts_Ln_2", "arg_0", ".", "m_lcd_lookup", "[", "\"RMS_Volts_Ln_3\"", "]", "=", "LCDItems", ".", "RMS_Volts_Ln_3", "arg_0", ".", "m_lcd_lookup", "[", "\"Amps_Ln_1\"", "]", "=", "LCDItems", ".", "Amps_Ln_1", "arg_0", ".", "m_lcd_lookup", "[", "\"Amps_Ln_2\"", "]", "=", "LCDItems", ".", "Amps_Ln_2", "arg_0", ".", "m_lcd_lookup", "[", "\"Amps_Ln_3\"", "]", "=", "LCDItems", ".", "Amps_Ln_3", "arg_0", ".", "m_lcd_lookup", "[", "\"RMS_Watts_Ln_1\"", "]", "=", "LCDItems", ".", "RMS_Watts_Ln_1", "arg_0", ".", "m_lcd_lookup", "[", "\"RMS_Watts_Ln_2\"", "]", "=", "LCDItems", ".", "RMS_Watts_Ln_2", "arg_0", ".", "m_lcd_lookup", "[", "\"RMS_Watts_Ln_3\"", "]", "=", "LCDItems", ".", "RMS_Watts_Ln_3", "arg_0", ".", "m_lcd_lookup", "[", "\"RMS_Watts_Tot\"", "]", "=", "LCDItems", ".", "RMS_Watts_Tot", "arg_0", ".", "m_lcd_lookup", "[", "\"Power_Factor_Ln_1\"", "]", "=", "LCDItems", ".", "Power_Factor_Ln_1", "arg_0", ".", "m_lcd_lookup", "[", "\"Power_Factor_Ln_2\"", "]", "=", "LCDItems", ".", "Power_Factor_Ln_2", "arg_0", ".", "m_lcd_lookup", "[", "\"Power_Factor_Ln_3\"", "]", "=", "LCDItems", ".", "Power_Factor_Ln_3", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Tariff_1\"", "]", "=", "LCDItems", ".", "kWh_Tariff_1", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Tariff_2\"", "]", "=", "LCDItems", ".", "kWh_Tariff_2", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Tariff_3\"", "]", "=", "LCDItems", ".", "kWh_Tariff_3", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Tariff_4\"", "]", "=", "LCDItems", ".", "kWh_Tariff_4", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Tariff_1\"", "]", "=", "LCDItems", ".", "Rev_kWh_Tariff_1", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Tariff_2\"", "]", "=", "LCDItems", ".", "Rev_kWh_Tariff_2", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Tariff_3\"", "]", "=", "LCDItems", ".", "Rev_kWh_Tariff_3", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Tariff_4\"", "]", "=", "LCDItems", ".", "Rev_kWh_Tariff_4", "arg_0", ".", "m_lcd_lookup", "[", "\"Reactive_Pwr_Ln_1\"", "]", "=", "LCDItems", ".", "Reactive_Pwr_Ln_1", "arg_0", ".", "m_lcd_lookup", "[", "\"Reactive_Pwr_Ln_2\"", "]", "=", "LCDItems", ".", "Reactive_Pwr_Ln_2", "arg_0", ".", "m_lcd_lookup", "[", "\"Reactive_Pwr_Ln_3\"", "]", "=", "LCDItems", ".", "Reactive_Pwr_Ln_3", "arg_0", ".", "m_lcd_lookup", "[", "\"Reactive_Pwr_Tot\"", "]", "=", "LCDItems", ".", "Reactive_Pwr_Tot", "arg_0", ".", "m_lcd_lookup", "[", "\"Line_Freq\"", "]", "=", "LCDItems", ".", "Line_Freq", "arg_0", ".", "m_lcd_lookup", "[", "\"Pulse_Cnt_1\"", "]", "=", "LCDItems", ".", "Pulse_Cnt_1", "arg_0", ".", "m_lcd_lookup", "[", "\"Pulse_Cnt_2\"", "]", "=", "LCDItems", ".", "Pulse_Cnt_2", "arg_0", ".", "m_lcd_lookup", "[", "\"Pulse_Cnt_3\"", "]", "=", "LCDItems", ".", "Pulse_Cnt_3", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Ln_1\"", "]", "=", "LCDItems", ".", "kWh_Ln_1", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Ln_1\"", "]", "=", "LCDItems", ".", "Rev_kWh_Ln_1", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Ln_2\"", "]", "=", "LCDItems", ".", "kWh_Ln_2", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Ln_2\"", "]", "=", "LCDItems", ".", "Rev_kWh_Ln_2", "arg_0", ".", "m_lcd_lookup", "[", "\"kWh_Ln_3\"", "]", "=", "LCDItems", ".", "kWh_Ln_3", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Ln_3\"", "]", "=", "LCDItems", ".", "Rev_kWh_Ln_3", "arg_0", ".", "m_lcd_lookup", "[", "\"Reactive_Energy_Tot\"", "]", "=", "LCDItems", ".", "Reactive_Energy_Tot", "arg_0", ".", "m_lcd_lookup", "[", "\"Max_Demand_Rst\"", "]", "=", "LCDItems", ".", "Max_Demand_Rst", "arg_0", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Rst\"", "]", "=", "LCDItems", ".", "Rev_kWh_Rst", "arg_0", ".", "m_lcd_lookup", "[", "\"State_Inputs\"", "]", "=", "LCDItems", ".", "State_Inputs", "arg_0", ".", "m_lcd_lookup", "[", "\"Max_Demand\"", "]", "=", "LCDItems", ".", "Max_Demand"], "function": "def Func(arg_0):\n        \"\"\" Initialize lookup table for string input of LCD fields \"\"\"\n        arg_0.m_lcd_lookup[\"kWh_Tot\"] = LCDItems.kWh_Tot\n        arg_0.m_lcd_lookup[\"Rev_kWh_Tot\"] = LCDItems.Rev_kWh_Tot\n        arg_0.m_lcd_lookup[\"RMS_Volts_Ln_1\"] = LCDItems.RMS_Volts_Ln_1\n        arg_0.m_lcd_lookup[\"RMS_Volts_Ln_2\"] = LCDItems.RMS_Volts_Ln_2\n        arg_0.m_lcd_lookup[\"RMS_Volts_Ln_3\"] = LCDItems.RMS_Volts_Ln_3\n        arg_0.m_lcd_lookup[\"Amps_Ln_1\"] = LCDItems.Amps_Ln_1\n        arg_0.m_lcd_lookup[\"Amps_Ln_2\"] = LCDItems.Amps_Ln_2\n        arg_0.m_lcd_lookup[\"Amps_Ln_3\"] = LCDItems.Amps_Ln_3\n        arg_0.m_lcd_lookup[\"RMS_Watts_Ln_1\"] = LCDItems.RMS_Watts_Ln_1\n        arg_0.m_lcd_lookup[\"RMS_Watts_Ln_2\"] = LCDItems.RMS_Watts_Ln_2\n        arg_0.m_lcd_lookup[\"RMS_Watts_Ln_3\"] = LCDItems.RMS_Watts_Ln_3\n        arg_0.m_lcd_lookup[\"RMS_Watts_Tot\"] = LCDItems.RMS_Watts_Tot\n        arg_0.m_lcd_lookup[\"Power_Factor_Ln_1\"] = LCDItems.Power_Factor_Ln_1\n        arg_0.m_lcd_lookup[\"Power_Factor_Ln_2\"] = LCDItems.Power_Factor_Ln_2\n        arg_0.m_lcd_lookup[\"Power_Factor_Ln_3\"] = LCDItems.Power_Factor_Ln_3\n        arg_0.m_lcd_lookup[\"kWh_Tariff_1\"] = LCDItems.kWh_Tariff_1\n        arg_0.m_lcd_lookup[\"kWh_Tariff_2\"] = LCDItems.kWh_Tariff_2\n        arg_0.m_lcd_lookup[\"kWh_Tariff_3\"] = LCDItems.kWh_Tariff_3\n        arg_0.m_lcd_lookup[\"kWh_Tariff_4\"] = LCDItems.kWh_Tariff_4\n        arg_0.m_lcd_lookup[\"Rev_kWh_Tariff_1\"] = LCDItems.Rev_kWh_Tariff_1\n        arg_0.m_lcd_lookup[\"Rev_kWh_Tariff_2\"] = LCDItems.Rev_kWh_Tariff_2\n        arg_0.m_lcd_lookup[\"Rev_kWh_Tariff_3\"] = LCDItems.Rev_kWh_Tariff_3\n        arg_0.m_lcd_lookup[\"Rev_kWh_Tariff_4\"] = LCDItems.Rev_kWh_Tariff_4\n        arg_0.m_lcd_lookup[\"Reactive_Pwr_Ln_1\"] = LCDItems.Reactive_Pwr_Ln_1\n        arg_0.m_lcd_lookup[\"Reactive_Pwr_Ln_2\"] = LCDItems.Reactive_Pwr_Ln_2\n        arg_0.m_lcd_lookup[\"Reactive_Pwr_Ln_3\"] = LCDItems.Reactive_Pwr_Ln_3\n        arg_0.m_lcd_lookup[\"Reactive_Pwr_Tot\"] = LCDItems.Reactive_Pwr_Tot\n        arg_0.m_lcd_lookup[\"Line_Freq\"] = LCDItems.Line_Freq\n        arg_0.m_lcd_lookup[\"Pulse_Cnt_1\"] = LCDItems.Pulse_Cnt_1\n        arg_0.m_lcd_lookup[\"Pulse_Cnt_2\"] = LCDItems.Pulse_Cnt_2\n        arg_0.m_lcd_lookup[\"Pulse_Cnt_3\"] = LCDItems.Pulse_Cnt_3\n        arg_0.m_lcd_lookup[\"kWh_Ln_1\"] = LCDItems.kWh_Ln_1\n        arg_0.m_lcd_lookup[\"Rev_kWh_Ln_1\"] = LCDItems.Rev_kWh_Ln_1\n        arg_0.m_lcd_lookup[\"kWh_Ln_2\"] = LCDItems.kWh_Ln_2\n        arg_0.m_lcd_lookup[\"Rev_kWh_Ln_2\"] = LCDItems.Rev_kWh_Ln_2\n        arg_0.m_lcd_lookup[\"kWh_Ln_3\"] = LCDItems.kWh_Ln_3\n        arg_0.m_lcd_lookup[\"Rev_kWh_Ln_3\"] = LCDItems.Rev_kWh_Ln_3\n        arg_0.m_lcd_lookup[\"Reactive_Energy_Tot\"] = LCDItems.Reactive_Energy_Tot\n        arg_0.m_lcd_lookup[\"Max_Demand_Rst\"] = LCDItems.Max_Demand_Rst\n        arg_0.m_lcd_lookup[\"Rev_kWh_Rst\"] = LCDItems.Rev_kWh_Rst\n        arg_0.m_lcd_lookup[\"State_Inputs\"] = LCDItems.State_Inputs\n        arg_0.m_lcd_lookup[\"Max_Demand\"] = LCDItems.Max_Demand", "path": "ekmmeters.py", "identifier": "V4Meter.initLcdLookup", "docstring": "Initialize lookup table for string input of LCD fields", "docstring_tokens": ["Initialize", "lookup", "table", "for", "string", "input", "of", "LCD", "fields"], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 258054}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L526-L550", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Retrieve the list of courses contained within this catalog.", "language": "python", "parameters": "(self, request, enterprise_customer, pk=None)", "return_statement": "return get_paginated_response(serializer.data, request)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "CourseCatalogApiClient", "(", "arg_1", ".", "user", ",", "arg_2", ".", "site", ")", "Func", "=", "arg_4", ".", "get_paginated_catalog_courses", "(", "arg_3", ",", "arg_1", ".", "GET", ")", "arg_0", ".", "ensure_data_exists", "(", "arg_1", ",", "Func", ",", "error_message", "=", "(", "\"Unable to fetch API response for catalog courses from endpoint '{endpoint}'. \"", "\"The resource you are looking for does not exist.\"", ".", "format", "(", "endpoint", "=", "arg_1", ".", "get_full_path", "(", ")", ")", ")", ")", "arg_6", "=", "serializers", ".", "EnterpriseCatalogCoursesReadOnlySerializer", "(", "Func", ")", "arg_6", ".", "update_enterprise_courses", "(", "arg_2", ",", "catalog_id", "=", "arg_3", ")", "return", "get_paginated_response", "(", "arg_6", ".", "data", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):  # pylint: disable=invalid-name\n        \"\"\"\n        Retrieve the list of courses contained within this catalog.\n\n        Only courses with active course runs are returned. A course run is considered active if it is currently\n        open for enrollment, or will open in the future.\n        \"\"\"\n        arg_4 = CourseCatalogApiClient(arg_1.user, arg_2.site)\n        Func = arg_4.get_paginated_catalog_courses(arg_3, arg_1.GET)\n\n        # If the API returned an empty response, that means pagination has ended.\n        # An empty response can also mean that there was a problem fetching data from catalog API.\n        arg_0.ensure_data_exists(\n            arg_1,\n            Func,\n            error_message=(\n                \"Unable to fetch API response for catalog courses from endpoint '{endpoint}'. \"\n                \"The resource you are looking for does not exist.\".format(endpoint=arg_1.get_full_path())\n            )\n        )\n        arg_6 = serializers.EnterpriseCatalogCoursesReadOnlySerializer(Func)\n\n        # Add enterprise related context for the courses.\n        arg_6.update_enterprise_courses(arg_2, catalog_id=arg_3)\n        return get_paginated_response(arg_6.data, arg_1)", "path": "enterprise/api/v1/views.py", "identifier": "EnterpriseCourseCatalogViewSet.courses", "docstring": "Retrieve the list of courses contained within this catalog.\n\n        Only courses with active course runs are returned. A course run is considered active if it is currently\n        open for enrollment, or will open in the future.", "docstring_tokens": ["Retrieve", "the", "list", "of", "courses", "contained", "within", "this", "catalog", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258055}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/boids/__init__.py#L78-L91", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Boids match velocity with other boids.", "language": "python", "parameters": "(self, d=5)", "return_statement": "return (vx-self.vx)/d, (vy-self.vy)/d, (vz-self.vz)/d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ")", ":", "arg_2", "=", "arg_4", "=", "arg_5", "=", "0", "for", "arg_3", "in", "arg_0", ".", "boids", ":", "if", "arg_3", "!=", "arg_0", ":", "arg_2", ",", "arg_4", ",", "arg_5", "=", "arg_2", "+", "arg_3", ".", "vx", ",", "arg_4", "+", "arg_3", ".", "vy", ",", "arg_5", "+", "arg_3", ".", "vz", "arg_6", "=", "len", "(", "arg_0", ".", "boids", ")", "-", "1", "arg_2", ",", "arg_4", ",", "arg_5", "=", "arg_2", "/", "arg_6", ",", "arg_4", "/", "arg_6", ",", "arg_5", "/", "arg_6", "return", "(", "arg_2", "-", "arg_0", ".", "vx", ")", "/", "arg_1", ",", "(", "arg_4", "-", "arg_0", ".", "vy", ")", "/", "arg_1", ",", "(", "arg_5", "-", "arg_0", ".", "vz", ")", "/", "arg_1"], "function": "def Func(arg_0, arg_1=5):\n        \n        \"\"\" Boids match velocity with other boids.\n        \"\"\"\n        \n        arg_2 = arg_4 = arg_5 = 0\n        for arg_3 in arg_0.boids:\n           if arg_3 != arg_0:\n               arg_2, arg_4, arg_5 = arg_2+arg_3.vx, arg_4+arg_3.vy, arg_5+arg_3.vz\n        \n        arg_6 = len(arg_0.boids)-1\n        arg_2, arg_4, arg_5 = arg_2/arg_6, arg_4/arg_6, arg_5/arg_6\n        \n        return (arg_2-arg_0.vx)/arg_1, (arg_4-arg_0.vy)/arg_1, (arg_5-arg_0.vz)/arg_1", "path": "lib/boids/__init__.py", "identifier": "Boid.alignment", "docstring": "Boids match velocity with other boids.", "docstring_tokens": ["Boids", "match", "velocity", "with", "other", "boids", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258056}
{"url": "https://github.com/cs01/pygdbmi/blob/709c781794d3c3b903891f83da011d2d995895d1/pygdbmi/gdbmiparser.py#L196-L209", "sha": "709c781794d3c3b903891f83da011d2d995895d1", "docstring_summary": "Get result message and payload dict", "language": "python", "parameters": "(result, stream)", "return_statement": "return token, message, payload", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_GDB_MI_RESULT_RE", ".", "match", "(", "arg_0", ")", ".", "groups", "(", ")", "arg_3", "=", "int", "(", "arg_2", "[", "0", "]", ")", "if", "arg_2", "[", "0", "]", "!=", "\"\"", "else", "None", "arg_4", "=", "arg_2", "[", "1", "]", "if", "arg_2", "[", "2", "]", "is", "None", ":", "arg_5", "=", "None", "else", ":", "arg_1", ".", "advance_past_chars", "(", "[", "\",\"", "]", ")", "arg_5", "=", "_parse_dict", "(", "arg_1", ")", "return", "arg_3", ",", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Get result message and payload dict\"\"\"\n\n    arg_2 = _GDB_MI_RESULT_RE.match(arg_0).groups()\n    arg_3 = int(arg_2[0]) if arg_2[0] != \"\" else None\n    arg_4 = arg_2[1]\n\n    if arg_2[2] is None:\n        arg_5 = None\n    else:\n        arg_1.advance_past_chars([\",\"])\n        arg_5 = _parse_dict(arg_1)\n\n    return arg_3, arg_4, arg_5", "path": "pygdbmi/gdbmiparser.py", "identifier": "_get_result_msg_and_payload", "docstring": "Get result message and payload dict", "docstring_tokens": ["Get", "result", "message", "and", "payload", "dict"], "nwo": "cs01/pygdbmi", "score": 0.565001601112863, "idx": 258057}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/qrt.py#L195-L202", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Release control of QTM.", "language": "python", "parameters": "(self)", "return_statement": "return await asyncio.wait_for(\n            self._protocol.send_command(cmd), timeout=self._timeout\n        )", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"releasecontrol\"", "return", "await", "asyncio", ".", "wait_for", "(", "arg_0", ".", "_protocol", ".", "send_command", "(", "arg_1", ")", ",", "timeout", "=", "arg_0", ".", "_timeout", ")"], "function": "async def Func(arg_0):\n        \"\"\"Release control of QTM.\n        \"\"\"\n\n        arg_1 = \"releasecontrol\"\n        return await asyncio.wait_for(\n            arg_0._protocol.send_command(arg_1), timeout=arg_0._timeout\n        )", "path": "qtm/qrt.py", "identifier": "QRTConnection.release_control", "docstring": "Release control of QTM.", "docstring_tokens": ["Release", "control", "of", "QTM", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 258058}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L787-L794", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "add a dummy option section for help purpose", "language": "python", "parameters": "(self, title, description, level=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "0", ")", ":", "arg_4", "=", "optparse", ".", "OptionGroup", "(", "arg_0", ".", "cmdline_parser", ",", "arg_1", "=", "arg_1", ".", "capitalize", "(", ")", ",", "arg_2", "=", "arg_2", ")", "arg_4", ".", "level", "=", "arg_3", "arg_0", ".", "_maxlevel", "=", "max", "(", "arg_0", ".", "_maxlevel", ",", "arg_3", ")", "arg_0", ".", "cmdline_parser", ".", "add_option_group", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=0):\n        \"\"\"add a dummy option section for help purpose \"\"\"\n        arg_4 = optparse.OptionGroup(\n            arg_0.cmdline_parser, arg_1=arg_1.capitalize(), arg_2=arg_2\n        )\n        arg_4.level = arg_3\n        arg_0._maxlevel = max(arg_0._maxlevel, arg_3)\n        arg_0.cmdline_parser.add_option_group(arg_4)", "path": "pylint/config.py", "identifier": "OptionsManagerMixIn.add_help_section", "docstring": "add a dummy option section for help purpose", "docstring_tokens": ["add", "a", "dummy", "option", "section", "for", "help", "purpose"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258059}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/surrogate_models.py#L67-L99", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "creates an additive kernel", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "kernel_params", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "raise", "RuntimeError", "(", "'Must provide enumeration of kernels'", ")", "for", "arg_2", "in", "arg_1", ":", "if", "sorted", "(", "list", "(", "arg_2", ".", "keys", "(", ")", ")", ")", "!=", "[", "'name'", ",", "'options'", ",", "'params'", "]", ":", "raise", "RuntimeError", "(", "'strategy/params/kernels must contain keys: \"name\", \"options\", \"params\"'", ")", "arg_1", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "kernel_params", ":", "arg_4", "=", "arg_3", "[", "'params'", "]", "arg_5", "=", "arg_3", "[", "'options'", "]", "arg_6", "=", "arg_3", "[", "'name'", "]", "arg_7", "=", "load_entry_point", "(", "arg_6", ",", "'strategy/params/kernels'", ")", "if", "issubclass", "(", "arg_7", ",", "KERNEL_BASE_CLASS", ")", ":", "if", "arg_5", "[", "'independent'", "]", ":", "arg_2", "=", "np", ".", "sum", "(", "[", "arg_7", "(", "1", ",", "active_dims", "=", "[", "i", "]", ",", "**", "arg_4", ")", "for", "i", "in", "range", "(", "arg_0", ".", "n_dims", ")", "]", ")", "else", ":", "arg_2", "=", "arg_7", "(", "arg_0", ".", "n_dims", ",", "**", "arg_4", ")", "if", "not", "isinstance", "(", "arg_2", ",", "KERNEL_BASE_CLASS", ")", ":", "raise", "RuntimeError", "(", "'strategy/params/kernel must load a'", "'GPy derived Kernel'", ")", "arg_1", ".", "append", "(", "arg_2", ")", "arg_0", ".", "kernel", "=", "np", ".", "sum", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        creates an additive kernel\n        \"\"\"\n        # Check kernels\n        arg_1 = arg_0.kernel_params\n        if not isinstance(arg_1, list):\n            raise RuntimeError('Must provide enumeration of kernels')\n        for arg_2 in arg_1:\n            if sorted(list(arg_2.keys())) != ['name', 'options', 'params']:\n                raise RuntimeError(\n                    'strategy/params/kernels must contain keys: \"name\", \"options\", \"params\"')\n\n        # Turn into entry points.\n        # TODO use eval to allow user to specify internal variables for kernels (e.g. V) in config file.\n        arg_1 = []\n        for arg_3 in arg_0.kernel_params:\n            arg_4 = arg_3['params']\n            arg_5 = arg_3['options']\n            arg_6 = arg_3['name']\n            arg_7 = load_entry_point(arg_6, 'strategy/params/kernels')\n            if issubclass(arg_7, KERNEL_BASE_CLASS):\n                if arg_5['independent']:\n                    # TODO Catch errors here?  Estimator entry points don't catch instantiation errors\n                    arg_2 = np.sum([arg_7(1, active_dims=[i], **arg_4) for i in range(arg_0.n_dims)])\n                else:\n                    arg_2 = arg_7(arg_0.n_dims, **arg_4)\n            if not isinstance(arg_2, KERNEL_BASE_CLASS):\n                raise RuntimeError('strategy/params/kernel must load a'\n                                   'GPy derived Kernel')\n            arg_1.append(arg_2)\n\n        arg_0.kernel = np.sum(arg_1)", "path": "osprey/surrogate_models.py", "identifier": "GaussianProcessKernel._create_kernel", "docstring": "creates an additive kernel", "docstring_tokens": ["creates", "an", "additive", "kernel"], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 258060}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/hObjList.py#L25-L42", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "get all name hierarchy separated by '.'", "language": "python", "parameters": "(self)", "return_statement": "return name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"\"", "arg_2", "=", "arg_0", "while", "isinstance", "(", "arg_2", ",", "(", "InterfaceBase", ",", "HObjList", ")", ")", ":", "if", "hasattr", "(", "arg_2", ",", "\"_name\"", ")", ":", "arg_3", "=", "arg_2", ".", "_name", "else", ":", "arg_3", "=", "''", "if", "arg_1", "==", "''", ":", "arg_1", "=", "arg_3", "else", ":", "arg_1", "=", "arg_3", "+", "'.'", "+", "arg_1", "if", "hasattr", "(", "arg_2", ",", "\"_parent\"", ")", ":", "arg_2", "=", "arg_2", ".", "_parent", "else", ":", "arg_2", "=", "None", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"get all name hierarchy separated by '.' \"\"\"\n        arg_1 = \"\"\n        arg_2 = arg_0\n        while isinstance(arg_2, (InterfaceBase, HObjList)):\n            if hasattr(arg_2, \"_name\"):\n                arg_3 = arg_2._name\n            else:\n                arg_3 = ''\n            if arg_1 == '':\n                arg_1 = arg_3\n            else:\n                arg_1 = arg_3 + '.' + arg_1\n            if hasattr(arg_2, \"_parent\"):\n                arg_2 = arg_2._parent\n            else:\n                arg_2 = None\n        return arg_1", "path": "hwt/synthesizer/hObjList.py", "identifier": "HObjList._getFullName", "docstring": "get all name hierarchy separated by '.'", "docstring_tokens": ["get", "all", "name", "hierarchy", "separated", "by", "."], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 258061}
{"url": "https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/main.py#L62-L68", "sha": "5e613f486f29fe350999d6b990d32847ac16a1b8", "docstring_summary": "Given the parsed xml to an `ElementTree`,\n    parse the id from the content.", "language": "python", "parameters": "(elm_tree)", "return_statement": "return [x for x in elm_tree.xpath(xpath, namespaces=COLLECTION_NSMAP)][0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'//md:content-id/text()'", "return", "[", "arg_2", "for", "arg_2", "in", "arg_0", ".", "xpath", "(", "arg_1", ",", "namespaces", "=", "COLLECTION_NSMAP", ")", "]", "[", "0", "]"], "function": "def Func(arg_0):\n    \"\"\"Given the parsed xml to an `ElementTree`,\n    parse the id from the content.\n\n    \"\"\"\n    arg_1 = '//md:content-id/text()'\n    return [arg_2 for arg_2 in arg_0.xpath(arg_1, namespaces=COLLECTION_NSMAP)][0]", "path": "litezip/main.py", "identifier": "_parse_document_id", "docstring": "Given the parsed xml to an `ElementTree`,\n    parse the id from the content.", "docstring_tokens": ["Given", "the", "parsed", "xml", "to", "an", "ElementTree", "parse", "the", "id", "from", "the", "content", "."], "nwo": "openstax/cnx-litezip", "score": 0.3282631104312029, "idx": 258062}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3335-L3378", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Loads a child or recursively a subtree from disk.", "language": "python", "parameters": "(self, name, recursive=False, load_data=pypetconstants.LOAD_DATA,\n                     max_depth=None)", "return_statement": "return self.f_get(name, shortcuts=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "arg_4", ".", "LOAD_DATA", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "arg_0", ".", "_nn_interface", ".", "_root_instance", "arg_8", "=", "arg_7", ".", "v_storage_service", "arg_8", ".", "load", "(", "arg_4", ".", "TREE", ",", "arg_0", ",", "arg_1", ",", "trajectory_name", "=", "arg_7", ".", "v_name", ",", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "arg_6", "=", "arg_6", ")", "return", "arg_0", ".", "f_get", "(", "arg_1", ",", "shortcuts", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=arg_4.LOAD_DATA,\n                     arg_6=None):\n        \"\"\"Loads a child or recursively a subtree from disk.\n\n        :param name:\n\n            Name of child to load. If grouped ('groupA.groupB.childC') the path along the way\n            to last node in the chain is loaded. Shortcuts are NOT allowed!\n\n        :param recursive:\n\n            Whether recursively all nodes below the last child should be loaded, too.\n            Note that links are never evaluated recursively. Only the linked node\n            will be loaded if it does not exist in the tree, yet. Any nodes or links\n            of this linked node are not loaded.\n\n        :param load_data:\n\n            Flag how to load the data.\n            For how to choose 'load_data' see :ref:`more-on-loading`.\n\n        :param max_depth:\n\n            In case `recursive` is `True`, you can specify the maximum depth to load\n            load data relative from current node. Leave `None` if you don't want to limit\n            the depth.\n\n        :returns:\n\n            The loaded child, in case of grouping ('groupA.groupB.childC') the last\n            node (here 'childC') is returned.\n\n        \"\"\"\n\n        arg_7 = arg_0._nn_interface._root_instance\n        arg_8 = arg_7.v_storage_service\n\n        arg_8.load(arg_4.TREE, arg_0, arg_1,\n                             trajectory_name=arg_7.v_name,\n                             arg_3=arg_3,\n                             arg_2=arg_2,\n                             arg_6=arg_6)\n\n        return arg_0.f_get(arg_1, shortcuts=False)", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_load_child", "docstring": "Loads a child or recursively a subtree from disk.\n\n        :param name:\n\n            Name of child to load. If grouped ('groupA.groupB.childC') the path along the way\n            to last node in the chain is loaded. Shortcuts are NOT allowed!\n\n        :param recursive:\n\n            Whether recursively all nodes below the last child should be loaded, too.\n            Note that links are never evaluated recursively. Only the linked node\n            will be loaded if it does not exist in the tree, yet. Any nodes or links\n            of this linked node are not loaded.\n\n        :param load_data:\n\n            Flag how to load the data.\n            For how to choose 'load_data' see :ref:`more-on-loading`.\n\n        :param max_depth:\n\n            In case `recursive` is `True`, you can specify the maximum depth to load\n            load data relative from current node. Leave `None` if you don't want to limit\n            the depth.\n\n        :returns:\n\n            The loaded child, in case of grouping ('groupA.groupB.childC') the last\n            node (here 'childC') is returned.", "docstring_tokens": ["Loads", "a", "child", "or", "recursively", "a", "subtree", "from", "disk", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258063}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L74-L88", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Translate dict parameters to string", "language": "python", "parameters": "(self)", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "__parm", ".", "items", "(", ")", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "\"FIO_\"", ",", "\"\"", ")", ".", "lower", "(", ")", "if", "arg_2", "==", "\"runtime\"", ":", "arg_1", ".", "append", "(", "\"--time_based\"", ")", "if", "arg_3", "is", "None", ":", "arg_1", ".", "append", "(", "\"--%s\"", "%", "arg_2", ")", "else", ":", "arg_1", ".", "append", "(", "\"--%s=%s\"", "%", "(", "arg_2", ",", "arg_3", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Translate dict parameters to string\"\"\"\n\n        arg_1 = list()\n        for arg_2, arg_3 in arg_0.__parm.items():\n            arg_2 = arg_2.replace(\"FIO_\", \"\").lower()\n\n            if arg_2 == \"runtime\":\n                arg_1.append(\"--time_based\")\n\n            if arg_3 is None:\n                arg_1.append(\"--%s\" % arg_2)\n            else:\n                arg_1.append(\"--%s=%s\" % (arg_2, arg_3))\n        return arg_1", "path": "modules/cij/fio.py", "identifier": "Job.__parse_parms", "docstring": "Translate dict parameters to string", "docstring_tokens": ["Translate", "dict", "parameters", "to", "string"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 258064}
{"url": "https://github.com/skioo/django-datatrans-gateway/blob/1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7/datatrans/gateway/payment_with_alias.py#L15-L47", "sha": "1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7", "docstring_summary": "Charges money using datatrans, given a previously registered credit card alias.", "language": "python", "parameters": "(amount: Money, alias_registration_id: str, client_ref: str)", "return_statement": "return charge_response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_3", ")", "->", "Payment", ":", "if", "arg_0", ".", "amount", "<=", "0", ":", "raise", "ValueError", "(", "'Pay with alias takes a strictly positive amount'", ")", "arg_5", "=", "AliasRegistration", ".", "objects", ".", "get", "(", "pk", "=", "arg_2", ")", "logger", ".", "info", "(", "'paying-with-alias'", ",", "arg_0", "=", "arg_0", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_6", "=", "build_Func_request_xml", "(", "arg_0", ",", "arg_4", ",", "arg_5", ")", "logger", ".", "info", "(", "'sending-pay-with-alias-request'", ",", "url", "=", "datatrans_authorize_url", ",", "data", "=", "arg_6", ")", "arg_7", "=", "requests", ".", "post", "(", "url", "=", "datatrans_authorize_url", ",", "headers", "=", "{", "'Content-Type'", ":", "'application/xml'", "}", ",", "data", "=", "arg_6", ")", "logger", ".", "info", "(", "'processing-pay-with-alias-response'", ",", "arg_7", "=", "arg_7", ".", "content", ")", "arg_8", "=", "parse_Func_response_xml", "(", "arg_7", ".", "content", ")", "arg_8", ".", "save", "(", ")", "arg_8", ".", "send_signal", "(", ")", "return", "arg_8"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_3) -> Payment:\n    \"\"\"\n    Charges money using datatrans, given a previously registered credit card alias.\n\n    :param amount: The amount and currency we want to charge\n    :param alias_registration_id: The alias registration to use\n    :param client_ref: A unique reference for this charge\n    :return: a Payment (either successful or not)\n    \"\"\"\n    if arg_0.amount <= 0:\n        raise ValueError('Pay with alias takes a strictly positive amount')\n\n    arg_5 = AliasRegistration.objects.get(pk=arg_2)\n\n    logger.info('paying-with-alias', arg_0=arg_0, arg_4=arg_4,\n                arg_5=arg_5)\n\n    arg_6 = build_Func_request_xml(arg_0, arg_4, arg_5)\n\n    logger.info('sending-pay-with-alias-request', url=datatrans_authorize_url, data=arg_6)\n\n    arg_7 = requests.post(\n        url=datatrans_authorize_url,\n        headers={'Content-Type': 'application/xml'},\n        data=arg_6)\n\n    logger.info('processing-pay-with-alias-response', arg_7=arg_7.content)\n\n    arg_8 = parse_Func_response_xml(arg_7.content)\n    arg_8.save()\n    arg_8.send_signal()\n\n    return arg_8", "path": "datatrans/gateway/payment_with_alias.py", "identifier": "pay_with_alias", "docstring": "Charges money using datatrans, given a previously registered credit card alias.\n\n    :param amount: The amount and currency we want to charge\n    :param alias_registration_id: The alias registration to use\n    :param client_ref: A unique reference for this charge\n    :return: a Payment (either successful or not)", "docstring_tokens": ["Charges", "money", "using", "datatrans", "given", "a", "previously", "registered", "credit", "card", "alias", "."], "nwo": "skioo/django-datatrans-gateway", "score": 0.26806449491785717, "idx": 258065}
{"url": "https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/steps.py#L412-L531", "sha": "b1c6aa159ab380a033740f4aa392cf0d125e0ac6", "docstring_summary": "Parse a step dictionary.", "language": "python", "parameters": "(cls, ctxt, step_addr, step_conf)", "return_statement": "return [step]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "isinstance", "(", "arg_3", ",", "six", ".", "string_types", ")", ":", "arg_3", "=", "{", "arg_3", ":", "None", "}", "elif", "not", "isinstance", "(", "arg_3", ",", "collections", ".", "Mapping", ")", ":", "raise", "ConfigError", "(", "'Unable to parse step configuration: expecting string or '", "'dictionary, not \"%s\"'", "%", "arg_3", ".", "__class__", ".", "__name__", ",", "arg_2", ",", ")", "arg_4", "=", "None", "arg_5", "=", "{", "}", "arg_6", "=", "{", "}", "for", "arg_7", ",", "arg_8", "in", "arg_3", ".", "items", "(", ")", ":", "if", "arg_7", "in", "arg_0", ".", "schemas", ":", "utils", ".", "schema_validate", "(", "arg_8", ",", "arg_0", ".", "schemas", "[", "arg_7", "]", ",", "ConfigError", ",", "arg_7", ",", "arg_2", "=", "arg_2", ")", "arg_6", "[", "arg_7", "]", "=", "arg_8", "elif", "arg_7", "in", "entry", ".", "points", "[", "NAMESPACE_ACTION", "]", ":", "if", "arg_4", "is", "not", "None", ":", "raise", "ConfigError", "(", "'Bad step configuration: action \"%s\" specified, '", "'but action \"%s\" already processed'", "%", "(", "arg_7", ",", "arg_4", ".", "name", ")", ",", "arg_2", ",", ")", "arg_4", "=", "StepItem", "(", "entry", ".", "points", "[", "NAMESPACE_ACTION", "]", "[", "arg_7", "]", ",", "arg_7", ",", "arg_8", ")", "elif", "arg_7", "in", "entry", ".", "points", "[", "NAMESPACE_MODIFIER", "]", ":", "arg_9", "=", "entry", ".", "points", "[", "NAMESPACE_MODIFIER", "]", "[", "arg_7", "]", "arg_5", ".", "setdefault", "(", "arg_9", ".", "priority", ",", "[", "]", ")", "arg_5", "[", "arg_9", ".", "priority", "]", ".", "append", "(", "StepItem", "(", "arg_9", ",", "arg_7", ",", "arg_8", ")", ")", "else", ":", "raise", "ConfigError", "(", "'Bad step configuration: unable to resolve action '", "'\"%s\"'", "%", "arg_7", ",", "arg_2", ",", ")", "if", "arg_4", "is", "None", ":", "raise", "ConfigError", "(", "'Bad step configuration: no action specified'", ",", "arg_2", ",", ")", "arg_10", "=", "(", "Modifier", ".", "STEP", "if", "arg_4", ".", "cls", ".", "step_action", "else", "Modifier", ".", "NORMAL", ")", "arg_11", "=", "[", "]", "for", "arg_12", "in", "utils", ".", "iter_prio_dict", "(", "arg_5", ")", ":", "if", "arg_12", ".", "cls", ".", "restriction", "&", "arg_10", "==", "0", ":", "raise", "ConfigError", "(", "'Bad step configuration: modifier \"%s\" is '", "'incompatible with the action \"%s\"'", "%", "(", "arg_12", ".", "name", ",", "arg_4", ".", "name", ")", ",", "arg_2", ",", ")", "arg_13", "=", "arg_12", ".", "init", "(", "arg_1", ",", "arg_2", ")", "arg_11", ".", "append", "(", "arg_13", ")", "arg_4", ".", "conf", "=", "arg_13", ".", "action_conf", "(", "arg_1", ",", "arg_4", ".", "cls", ",", "arg_4", ".", "name", ",", "arg_4", ".", "conf", ",", "arg_2", ")", "arg_15", "=", "arg_4", ".", "init", "(", "arg_1", ",", "arg_2", ")", "arg_16", "=", "arg_0", "(", "arg_2", ",", "arg_15", ",", "arg_11", ",", "**", "arg_6", ")", "if", "arg_4", ".", "cls", ".", "step_action", ":", "return", "arg_16", "(", "arg_1", ")", "return", "[", "arg_16", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Parse a step dictionary.\n\n        :param ctxt: The context object.\n        :param step_addr: The address of the step in the test\n                          configuration.\n        :param step_conf: The description of the step.  This may be a\n                          scalar string or a dictionary.\n\n        :returns: A list of steps.\n        \"\"\"\n\n        # Make sure the step makes sense\n        if isinstance(arg_3, six.string_types):\n            # Convert string to a dict for uniformity of processing\n            arg_3 = {arg_3: None}\n        elif not isinstance(arg_3, collections.Mapping):\n            raise ConfigError(\n                'Unable to parse step configuration: expecting string or '\n                'dictionary, not \"%s\"' % arg_3.__class__.__name__,\n                arg_2,\n            )\n\n        # Parse the configuration into the action and modifier classes\n        # and the configuration to apply to each\n        arg_4 = None\n        arg_5 = {}\n        arg_6 = {}  # extra args for Step.__init__()\n        for arg_7, arg_8 in arg_3.items():\n            # Handle special keys first\n            if arg_7 in arg_0.schemas:\n                # Validate the key\n                utils.schema_validate(arg_8, arg_0.schemas[arg_7], ConfigError,\n                                      arg_7, arg_2=arg_2)\n\n                # Save the value\n                arg_6[arg_7] = arg_8\n\n            # Is it an action?\n            elif arg_7 in entry.points[NAMESPACE_ACTION]:\n                if arg_4 is not None:\n                    raise ConfigError(\n                        'Bad step configuration: action \"%s\" specified, '\n                        'but action \"%s\" already processed' %\n                        (arg_7, arg_4.name),\n                        arg_2,\n                    )\n\n                arg_4 = StepItem(\n                    entry.points[NAMESPACE_ACTION][arg_7], arg_7, arg_8)\n\n            # OK, is it a modifier?\n            elif arg_7 in entry.points[NAMESPACE_MODIFIER]:\n                arg_9 = entry.points[NAMESPACE_MODIFIER][arg_7]\n\n                # Store it in priority order\n                arg_5.setdefault(arg_9.priority, [])\n                arg_5[arg_9.priority].append(StepItem(\n                    arg_9, arg_7, arg_8))\n\n            # Couldn't resolve it\n            else:\n                raise ConfigError(\n                    'Bad step configuration: unable to resolve action '\n                    '\"%s\"' % arg_7,\n                    arg_2,\n                )\n\n        # Make sure we have an action\n        if arg_4 is None:\n            raise ConfigError(\n                'Bad step configuration: no action specified',\n                arg_2,\n            )\n\n        # What is the action type?\n        arg_10 = (Modifier.STEP if arg_4.cls.step_action\n                       else Modifier.NORMAL)\n\n        # OK, build our modifiers list and preprocess the action\n        # configuration\n        arg_11 = []\n        for arg_12 in utils.iter_prio_dict(arg_5):\n            # Verify that the modifier is compatible with the\n            # action\n            if arg_12.cls.restriction & arg_10 == 0:\n                raise ConfigError(\n                    'Bad step configuration: modifier \"%s\" is '\n                    'incompatible with the action \"%s\"' %\n                    (arg_12.name, arg_4.name),\n                    arg_2,\n                )\n\n            # Initialize the modifier\n            arg_13 = arg_12.init(arg_1, arg_2)\n\n            # Add it to the list of modifiers\n            arg_11.append(arg_13)\n\n            # Apply the modifier's configuration processing\n            arg_4.conf = arg_13.action_conf(\n                arg_1, arg_4.cls, arg_4.name, arg_4.conf,\n                arg_2)\n\n        # Now we can initialize the action\n        arg_15 = arg_4.init(arg_1, arg_2)\n\n        # Create the step\n        arg_16 = arg_0(arg_2, arg_15, arg_11, **arg_6)\n\n        # If the final_action is a StepAction, invoke it now and\n        # return the list of steps.  We do this after creating the\n        # Step object so that we can take advantage of its handling of\n        # modifiers.\n        if arg_4.cls.step_action:\n            return arg_16(arg_1)\n\n        # Not a step action, return the step as a list of one element\n        return [arg_16]", "path": "timid/steps.py", "identifier": "Step.parse_step", "docstring": "Parse a step dictionary.\n\n        :param ctxt: The context object.\n        :param step_addr: The address of the step in the test\n                          configuration.\n        :param step_conf: The description of the step.  This may be a\n                          scalar string or a dictionary.\n\n        :returns: A list of steps.", "docstring_tokens": ["Parse", "a", "step", "dictionary", "."], "nwo": "rackerlabs/timid", "score": 0.0, "idx": 258066}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L269-L278", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Total used size in percentage for volume", "language": "python", "parameters": "(self, volume)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_0", ".", "_get_volume", "(", "arg_1", ")", "if", "arg_1", "is", "not", "None", ":", "arg_2", "=", "int", "(", "arg_1", "[", "\"size\"", "]", "[", "\"total\"", "]", ")", "arg_3", "=", "int", "(", "arg_1", "[", "\"size\"", "]", "[", "\"used\"", "]", ")", "if", "arg_3", "is", "not", "None", "and", "arg_3", ">", "0", "and", "arg_2", "is", "not", "None", "and", "arg_2", ">", "0", ":", "return", "round", "(", "(", "float", "(", "arg_3", ")", "/", "float", "(", "arg_2", ")", ")", "*", "100.0", ",", "1", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Total used size in percentage for volume\"\"\"\r\n        arg_1 = arg_0._get_volume(arg_1)\r\n        if arg_1 is not None:\r\n            arg_2 = int(arg_1[\"size\"][\"total\"])\r\n            arg_3 = int(arg_1[\"size\"][\"used\"])\r\n\r\n            if arg_3 is not None and arg_3 > 0 and \\\r\n               arg_2 is not None and arg_2 > 0:\r\n                return round((float(arg_3) / float(arg_2)) * 100.0, 1)", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynoStorage.volume_percentage_used", "docstring": "Total used size in percentage for volume", "docstring_tokens": ["Total", "used", "size", "in", "percentage", "for", "volume"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 258067}
{"url": "https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/kafkaclient.py#L58-L69", "sha": "ecc9fd434c23d896ccd1f35795ccc047f946ed05", "docstring_summary": "Duplicates org_name, org_email and report_id into JSON root\n          and removes report_metadata key to bring it more inline\n          with Elastic output.", "language": "python", "parameters": "(report)", "return_statement": "return report", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "[", "'org_name'", "]", "=", "arg_0", "[", "'report_metadata'", "]", "[", "'org_name'", "]", "arg_0", "[", "'org_email'", "]", "=", "arg_0", "[", "'report_metadata'", "]", "[", "'org_email'", "]", "arg_0", "[", "'report_id'", "]", "=", "arg_0", "[", "'report_metadata'", "]", "[", "'report_id'", "]", "arg_0", ".", "pop", "(", "'report_metadata'", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"\n          Duplicates org_name, org_email and report_id into JSON root\n          and removes report_metadata key to bring it more inline\n          with Elastic output.\n        \"\"\"\n        arg_0['org_name'] = arg_0['report_metadata']['org_name']\n        arg_0['org_email'] = arg_0['report_metadata']['org_email']\n        arg_0['report_id'] = arg_0['report_metadata']['report_id']\n        arg_0.pop('report_metadata')\n\n        return arg_0", "path": "parsedmarc/kafkaclient.py", "identifier": "KafkaClient.strip_metadata", "docstring": "Duplicates org_name, org_email and report_id into JSON root\n          and removes report_metadata key to bring it more inline\n          with Elastic output.", "docstring_tokens": ["Duplicates", "org_name", "org_email", "and", "report_id", "into", "JSON", "root", "and", "removes", "report_metadata", "key", "to", "bring", "it", "more", "inline", "with", "Elastic", "output", "."], "nwo": "domainaware/parsedmarc", "score": 0.7452768887820926, "idx": 258068}
{"url": "https://github.com/sveetch/crispy-forms-foundation/blob/835a4152ef9b2a096b9a27748341ef751823b9f0/sandbox/demo/views.py#L40-L48", "sha": "835a4152ef9b2a096b9a27748341ef751823b9f0", "docstring_summary": "Pass template pack argument", "language": "python", "parameters": "(self)", "return_statement": "return kwargs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "super", "(", "FormContainersMixin", ",", "arg_0", ")", ".", "Func", "(", ")", "arg_1", ".", "update", "(", "{", "'pack'", ":", "\"foundation-{}\"", ".", "format", "(", "arg_0", ".", "kwargs", ".", "get", "(", "'foundation_version'", ")", ")", "}", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Pass template pack argument\n        \"\"\"\n        arg_1 = super(FormContainersMixin, arg_0).Func()\n        arg_1.update({\n            'pack': \"foundation-{}\".format(arg_0.kwargs.get('foundation_version'))\n        })\n        return arg_1", "path": "sandbox/demo/views.py", "identifier": "FormContainersMixin.get_form_kwargs", "docstring": "Pass template pack argument", "docstring_tokens": ["Pass", "template", "pack", "argument"], "nwo": "sveetch/crispy-forms-foundation", "score": 0.19753929313607516, "idx": 258069}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/canvas.py#L148-L161", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Ask the drawqueue to output to target.", "language": "python", "parameters": "(self, target, defer=True, file_number=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "output_closure", "(", "arg_1", ",", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "_drawqueue", ".", "append", "(", "arg_4", ")", "else", ":", "arg_0", ".", "_drawqueue", ".", "append_immediate", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None):\n        '''\n        Ask the drawqueue to output to target.\n\n        target can be anything supported by the combination\n        of canvas implementation and drawqueue implmentation.\n\n        If target is not supported then an exception is thrown.\n        '''\n        arg_4 = arg_0.output_closure(arg_1, arg_3)\n        if arg_2:\n            arg_0._drawqueue.append(arg_4)\n        else:\n            arg_0._drawqueue.append_immediate(arg_4)", "path": "shoebot/core/canvas.py", "identifier": "Canvas.snapshot", "docstring": "Ask the drawqueue to output to target.\n\n        target can be anything supported by the combination\n        of canvas implementation and drawqueue implmentation.\n\n        If target is not supported then an exception is thrown.", "docstring_tokens": ["Ask", "the", "drawqueue", "to", "output", "to", "target", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258070}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/bdist_egg.py#L379-L387", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Walk an unpacked egg's contents, skipping the metadata directory", "language": "python", "parameters": "(egg_dir)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "walk", "(", "arg_0", ")", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_1", ".", "next", "(", ")", "if", "'EGG-INFO'", "in", "arg_3", ":", "arg_3", ".", "remove", "(", "'EGG-INFO'", ")", "yield", "arg_2", ",", "arg_3", ",", "arg_4", "for", "arg_5", "in", "arg_1", ":", "yield", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"Walk an unpacked egg's contents, skipping the metadata directory\"\"\"\n    arg_1 = os.walk(arg_0)\n    arg_2,arg_3,arg_4 = arg_1.next()\n    if 'EGG-INFO' in arg_3:\n        arg_3.remove('EGG-INFO')\n    yield arg_2,arg_3,arg_4\n    for arg_5 in arg_1:\n        yield arg_5", "path": "environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/bdist_egg.py", "identifier": "walk_egg", "docstring": "Walk an unpacked egg's contents, skipping the metadata directory", "docstring_tokens": ["Walk", "an", "unpacked", "egg", "s", "contents", "skipping", "the", "metadata", "directory"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258071}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/file_utils.py#L50-L76", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Add the extension ext to fpath if it doesn't have it.", "language": "python", "parameters": "(filepath, ext, check_if_exists=False)", "return_statement": "return filepath", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_0", ".", "endswith", "(", "arg_1", ")", ":", "arg_0", "+=", "arg_1", "if", "arg_2", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "arg_3", "=", "'File not found: '", "+", "arg_0", "log", ".", "error", "(", "arg_3", ")", "raise", "IOError", "(", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"Add the extension ext to fpath if it doesn't have it.\n\n    Parameters\n    ----------\n    filepath: str\n    File name or path\n\n    ext: str\n    File extension\n\n    check_if_exists: bool\n\n    Returns\n    -------\n    File name or path with extension added, if needed.\n    \"\"\"\n    if not arg_0.endswith(arg_1):\n        arg_0 += arg_1\n\n    if arg_2:\n        if not os.path.exists(arg_0):\n            arg_3 = 'File not found: ' + arg_0\n            log.error(arg_3)\n            raise IOError(arg_3)\n\n    return arg_0", "path": "docstamp/file_utils.py", "identifier": "add_extension_if_needed", "docstring": "Add the extension ext to fpath if it doesn't have it.\n\n    Parameters\n    ----------\n    filepath: str\n    File name or path\n\n    ext: str\n    File extension\n\n    check_if_exists: bool\n\n    Returns\n    -------\n    File name or path with extension added, if needed.", "docstring_tokens": ["Add", "the", "extension", "ext", "to", "fpath", "if", "it", "doesn", "t", "have", "it", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 258072}
{"url": "https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/dumper.py#L18-L30", "sha": "d52a7c6b5bc466f3c1a77b71814c8c0776aba995", "docstring_summary": "Dump the given grids in the specified over-the-wire format.", "language": "python", "parameters": "(grids, mode=MODE_ZINC)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Grid", ")", ":", "return", "Func_grid", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_3", "=", "functools", ".", "partial", "(", "Func_grid", ",", "arg_1", "=", "arg_1", ")", "if", "arg_1", "==", "arg_2", ":", "return", "'\\n'", ".", "join", "(", "map", "(", "arg_3", ",", "arg_0", ")", ")", "elif", "arg_1", "==", "MODE_JSON", ":", "return", "'[%s]'", "%", "','", ".", "join", "(", "map", "(", "arg_3", ",", "arg_0", ")", ")", "else", ":", "raise", "NotImplementedError", "(", "'Format not implemented: %s'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Dump the given grids in the specified over-the-wire format.\n    \"\"\"\n    if isinstance(arg_0, Grid):\n        return Func_grid(arg_0, arg_1=arg_1)\n    arg_3 = functools.partial(Func_grid, arg_1=arg_1)\n    if arg_1 == arg_2:\n        return '\\n'.join(map(arg_3, arg_0))\n    elif arg_1 == MODE_JSON:\n        return '[%s]' % ','.join(map(arg_3, arg_0))\n    else: # pragma: no cover\n        raise NotImplementedError('Format not implemented: %s' % arg_1)", "path": "hszinc/dumper.py", "identifier": "dump", "docstring": "Dump the given grids in the specified over-the-wire format.", "docstring_tokens": ["Dump", "the", "given", "grids", "in", "the", "specified", "over", "-", "the", "-", "wire", "format", "."], "nwo": "vrtsystems/hszinc", "score": 0.2823188883832642, "idx": 258073}
{"url": "https://github.com/coops/r53/blob/3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a/src/r53/r53.py#L163-L185", "sha": "3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a", "docstring_summary": "Validate a changeset is compatible with Amazon's API spec.", "language": "python", "parameters": "(changeset)", "return_statement": "return errors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", ".", "findall", "(", "'.//{%s}Change'", "%", "R53_XMLNS", ")", "arg_3", "=", "len", "(", "arg_2", ")", "if", "arg_3", "==", "0", ":", "arg_1", ".", "append", "(", "'changeset must have at least one <Change> element'", ")", "if", "arg_3", ">", "100", ":", "arg_1", ".", "append", "(", "'changeset has %d <Change> elements: max is 100'", "%", "arg_3", ")", "arg_4", "=", "arg_0", ".", "findall", "(", "'.//{%s}ResourceRecord'", "%", "R53_XMLNS", ")", "arg_5", "=", "len", "(", "arg_4", ")", "if", "arg_5", ">", "1000", ":", "arg_1", ".", "append", "(", "'changeset has %d ResourceRecord elements: max is 1000'", "%", "arg_5", ")", "arg_6", "=", "arg_0", ".", "findall", "(", "'.//{%s}Value'", "%", "R53_XMLNS", ")", "arg_7", "=", "0", "for", "arg_8", "in", "arg_6", ":", "arg_7", "+=", "len", "(", "arg_8", ".", "text", ")", "if", "arg_7", ">", "10000", ":", "arg_1", ".", "append", "(", "'changeset has %d chars in <Value> text: max is 10000'", "%", "arg_7", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Validate a changeset is compatible with Amazon's API spec.\n\n  Args: changeset: lxml.etree.Element (<ChangeResourceRecordSetsRequest>)\n  Returns: [ errors ] list of error strings or [].\"\"\"\n  arg_1 = []\n  arg_2 = arg_0.findall('.//{%s}Change' % R53_XMLNS)\n  arg_3 = len(arg_2)\n  if arg_3 == 0:\n    arg_1.append('changeset must have at least one <Change> element')\n  if arg_3 > 100:\n    arg_1.append('changeset has %d <Change> elements: max is 100' % arg_3)\n  arg_4 = arg_0.findall('.//{%s}ResourceRecord' % R53_XMLNS)\n  arg_5 = len(arg_4)\n  if arg_5 > 1000:\n    arg_1.append('changeset has %d ResourceRecord elements: max is 1000' % arg_5)\n  arg_6 = arg_0.findall('.//{%s}Value' % R53_XMLNS)\n  arg_7 = 0\n  for arg_8 in arg_6:\n    arg_7 += len(arg_8.text)\n  if arg_7 > 10000:\n    arg_1.append('changeset has %d chars in <Value> text: max is 10000' % arg_7)\n  return arg_1", "path": "src/r53/r53.py", "identifier": "validate_changeset", "docstring": "Validate a changeset is compatible with Amazon's API spec.\n\n  Args: changeset: lxml.etree.Element (<ChangeResourceRecordSetsRequest>)\n  Returns: [ errors ] list of error strings or [].", "docstring_tokens": ["Validate", "a", "changeset", "is", "compatible", "with", "Amazon", "s", "API", "spec", "."], "nwo": "coops/r53", "score": 0.2549979292514255, "idx": 258074}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L1682-L1706", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Migrate all keys from a source stash to a destination stash.", "language": "python", "parameters": "(source_stash_path,\n                  source_passphrase,\n                  source_backend,\n                  destination_stash_path,\n                  destination_passphrase,\n                  destination_backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "click", ".", "echo", "(", "'Migrating all keys from {0} to {1}...'", ".", "format", "(", "arg_0", ",", "arg_3", ")", ")", "try", ":", "migrate", "(", "src_path", "=", "arg_0", ",", "src_passphrase", "=", "arg_1", ",", "src_backend", "=", "arg_2", ",", "dst_path", "=", "arg_3", ",", "dst_passphrase", "=", "arg_4", ",", "dst_backend", "=", "arg_5", ")", "except", "GhostError", "as", "ex", ":", "sys", ".", "exit", "(", "ex", ")", "click", ".", "echo", "(", "'Migration complete!'", ")"], "function": "def Func(arg_0,\n                  arg_1,\n                  arg_2,\n                  arg_3,\n                  arg_4,\n                  arg_5):\n    \"\"\"Migrate all keys from a source stash to a destination stash.\n\n    `SOURCE_STASH_PATH` and `DESTINATION_STASH_PATH` are the paths\n    to the stashs you wish to perform the migration on.\n    \"\"\"\n    click.echo('Migrating all keys from {0} to {1}...'.format(\n        arg_0, arg_3))\n\n    try:\n        migrate(\n            src_path=arg_0,\n            src_passphrase=arg_1,\n            src_backend=arg_2,\n            dst_path=arg_3,\n            dst_passphrase=arg_4,\n            dst_backend=arg_5)\n    except GhostError as ex:\n        sys.exit(ex)\n    click.echo('Migration complete!')", "path": "ghost.py", "identifier": "migrate_stash", "docstring": "Migrate all keys from a source stash to a destination stash.\n\n    `SOURCE_STASH_PATH` and `DESTINATION_STASH_PATH` are the paths\n    to the stashs you wish to perform the migration on.", "docstring_tokens": ["Migrate", "all", "keys", "from", "a", "source", "stash", "to", "a", "destination", "stash", "."], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 258075}
{"url": "https://github.com/foxx/peewee-extras/blob/327e7e63465b3f6e1afc0e6a651f4cb5c8c60889/peewee_extras.py#L315-L320", "sha": "327e7e63465b3f6e1afc0e6a651f4cb5c8c60889", "docstring_summary": "Apply user specified filters to query", "language": "python", "parameters": "(self, query, filters)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "peewee", ".", "Query", ")", "assert", "isinstance", "(", "arg_2", ",", "dict", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Apply user specified filters to query\n        \"\"\"\n        assert isinstance(arg_1, peewee.Query)\n        assert isinstance(arg_2, dict)", "path": "peewee_extras.py", "identifier": "ModelCRUD.apply_filters", "docstring": "Apply user specified filters to query", "docstring_tokens": ["Apply", "user", "specified", "filters", "to", "query"], "nwo": "foxx/peewee-extras", "score": 0.36327422921566166, "idx": 258076}
{"url": "https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L23-L37", "sha": "467e8a843ca9f882f8bb2958805b7293591996ad", "docstring_summary": "Calcule de moyennes glissantes", "language": "python", "parameters": "(df, sur=8, rep=0.75)", "return_statement": "return pd.rolling_mean(df, window=sur, min_periods=rep * sur)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "8", ",", "arg_2", "=", "0.75", ")", ":", "return", "pd", ".", "rolling_mean", "(", "arg_0", ",", "window", "=", "arg_1", ",", "min_periods", "=", "arg_2", "*", "arg_1", ")"], "function": "def Func(arg_0, arg_1=8, arg_2=0.75):\n    \"\"\"\n    Calcule de moyennes glissantes\n\n    Param\u00e8tres:\n    df: DataFrame de mesures sur lequel appliqu\u00e9 le calcul\n    sur: (int, par d\u00e9faut 8) Nombre d'observations sur lequel s'appuiera le\n    calcul\n    rep: (float, d\u00e9faut 0.75) Taux de r\u00e9pr\u00e9sentativit\u00e9 en dessous duquel le\n    calcul renverra NaN\n\n    Retourne:\n    Un DataFrame des moyennes glissantes calcul\u00e9es\n    \"\"\"\n    return pd.rolling_mean(arg_0, window=arg_1, min_periods=arg_2 * arg_1)", "path": "pyair/reg.py", "identifier": "moyennes_glissantes", "docstring": "Calcule de moyennes glissantes\n\n    Param\u00e8tres:\n    df: DataFrame de mesures sur lequel appliqu\u00e9 le calcul\n    sur: (int, par d\u00e9faut 8) Nombre d'observations sur lequel s'appuiera le\n    calcul\n    rep: (float, d\u00e9faut 0.75) Taux de r\u00e9pr\u00e9sentativit\u00e9 en dessous duquel le\n    calcul renverra NaN\n\n    Retourne:\n    Un DataFrame des moyennes glissantes calcul\u00e9es", "docstring_tokens": ["Calcule", "de", "moyennes", "glissantes"], "nwo": "LionelR/pyair", "score": 0.12050106452410352, "idx": 258077}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/info_subcmd/line.py#L94-L126", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Current line number in source file", "language": "python", "parameters": "(self, args)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "proc", ".", "curframe", ":", "arg_0", ".", "errmsg", "(", "\"No line number information available.\"", ")", "return", "if", "len", "(", "arg_1", ")", "==", "3", ":", "arg_2", "=", "arg_0", ".", "lineinfo", "(", "arg_1", "[", "2", "]", ")", "if", "arg_2", "[", "0", "]", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_2", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "arg_4", "=", "Mclifns", ".", "search_file", "(", "arg_4", ",", "arg_0", ".", "core", ".", "search_path", ",", "arg_0", ".", "main_dirname", ")", "arg_0", ".", "msg", "(", "'Line %s of \"%s\" <%s>'", "%", "(", "arg_5", ",", "arg_4", ",", "arg_3", ")", ")", "return", "arg_4", "=", "arg_0", ".", "core", ".", "canonic_filename", "(", "arg_0", ".", "proc", ".", "curframe", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "arg_4", "=", "Mclifns", ".", "search_file", "(", "arg_4", ",", "arg_0", ".", "core", ".", "search_path", ",", "arg_0", ".", "main_dirname", ")", "pass", "arg_4", "=", "arg_0", ".", "core", ".", "canonic_filename", "(", "arg_0", ".", "proc", ".", "curframe", ")", "arg_6", "=", "'Line %d of \\\"%s\\\"'", "%", "(", "inspect", ".", "getlineno", "(", "arg_0", ".", "proc", ".", "curframe", ")", ",", "arg_0", ".", "core", ".", "filename", "(", "arg_4", ")", ")", "arg_7", "=", "(", "'at instruction %d'", "%", "arg_0", ".", "proc", ".", "curframe", ".", "f_lasti", ")", "if", "arg_0", ".", "proc", ".", "event", ":", "arg_7", "+=", "', %s event'", "%", "arg_0", ".", "proc", ".", "event", "pass", "arg_0", ".", "msg", "(", "Mmisc", ".", "wrapped_lines", "(", "arg_6", ",", "arg_7", ",", "arg_0", ".", "settings", "[", "'width'", "]", ")", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Current line number in source file\"\"\"\n        # info line identifier\n        if not arg_0.proc.curframe:\n            arg_0.errmsg(\"No line number information available.\")\n            return\n        if len(arg_1) == 3:\n            # lineinfo returns (item, file, lineno) or (None,)\n            arg_2 = arg_0.lineinfo(arg_1[2])\n            if arg_2[0]:\n                arg_3, arg_4, arg_5 = arg_2\n                if not os.path.isfile(arg_4):\n                    arg_4 = Mclifns.search_file(arg_4,\n                                                   arg_0.core.search_path,\n                                                   arg_0.main_dirname)\n                arg_0.msg('Line %s of \"%s\" <%s>' %\n                         (arg_5, arg_4, arg_3))\n            return\n        arg_4=arg_0.core.canonic_filename(arg_0.proc.curframe)\n        if not os.path.isfile(arg_4):\n            arg_4 = Mclifns.search_file(arg_4, arg_0.core.search_path,\n                                           arg_0.main_dirname)\n            pass\n\n        arg_4 = arg_0.core.canonic_filename(arg_0.proc.curframe)\n        arg_6 = 'Line %d of \\\"%s\\\"'  % (inspect.getlineno(arg_0.proc.curframe),\n                                       arg_0.core.filename(arg_4))\n        arg_7 = ('at instruction %d' % arg_0.proc.curframe.f_lasti)\n        if arg_0.proc.event:\n            arg_7 += ', %s event' % arg_0.proc.event\n            pass\n        arg_0.msg(Mmisc.wrapped_lines(arg_6, arg_7, arg_0.settings['width']))\n        return False", "path": "trepan/processor/command/info_subcmd/line.py", "identifier": "InfoLine.run", "docstring": "Current line number in source file", "docstring_tokens": ["Current", "line", "number", "in", "source", "file"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 258078}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L644-L660", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return an iterable of possible completions matching the given\n        prefix from the list of interned Vars.", "language": "python", "parameters": "(\n        self, value: str, include_private_vars: bool = True\n    )", "return_statement": "return map(\n            lambda entry: f\"{entry[0].name}\",\n            filter(is_match, [(s, v) for s, v in self.interns]),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", "=", "True", ")", "->", "Iterable", "[", "arg_2", "]", ":", "if", "arg_3", ":", "arg_5", "=", "Namespace", ".", "__completion_matcher", "(", "arg_1", ")", "else", ":", "arg_6", "=", "Namespace", ".", "__completion_matcher", "(", "arg_1", ")", "def", "arg_5", "(", "arg_7", ":", "arg_8", "[", "arg_9", ".", "Symbol", ",", "arg_11", "]", ")", "->", "arg_4", ":", "return", "arg_6", "(", "arg_7", ")", "and", "not", "arg_7", "[", "1", "]", ".", "is_private", "return", "map", "(", "lambda", "arg_7", ":", "f\"{entry[0].name}\"", ",", "filter", "(", "arg_5", ",", "[", "(", "arg_12", ",", "arg_13", ")", "for", "arg_12", ",", "arg_13", "in", "arg_0", ".", "interns", "]", ")", ",", ")"], "function": "def Func(\n        arg_0, arg_1: arg_2, arg_3: arg_4 = True\n    ) -> Iterable[arg_2]:\n        \"\"\"Return an iterable of possible completions matching the given\n        prefix from the list of interned Vars.\"\"\"\n        if arg_3:\n            arg_5 = Namespace.__completion_matcher(arg_1)\n        else:\n            arg_6 = Namespace.__completion_matcher(arg_1)\n\n            def arg_5(arg_7: arg_8[arg_9.Symbol, arg_11]) -> arg_4:\n                return arg_6(arg_7) and not arg_7[1].is_private\n\n        return map(\n            lambda arg_7: f\"{entry[0].name}\",\n            filter(arg_5, [(arg_12, arg_13) for arg_12, arg_13 in arg_0.interns]),\n        )", "path": "src/basilisp/lang/runtime.py", "identifier": "Namespace.__complete_interns", "docstring": "Return an iterable of possible completions matching the given\n        prefix from the list of interned Vars.", "docstring_tokens": ["Return", "an", "iterable", "of", "possible", "completions", "matching", "the", "given", "prefix", "from", "the", "list", "of", "interned", "Vars", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 258079}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L94-L104", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "This function returns a list of Size object.", "language": "python", "parameters": "(self)", "return_statement": "return sizes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_data", "(", "\"sizes/\"", ")", "arg_2", "=", "list", "(", ")", "for", "arg_3", "in", "arg_1", "[", "'sizes'", "]", ":", "arg_4", "=", "Size", "(", "**", "arg_3", ")", "arg_4", ".", "token", "=", "arg_0", ".", "token", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n            This function returns a list of Size object.\n        \"\"\"\n        arg_1 = arg_0.get_data(\"sizes/\")\n        arg_2 = list()\n        for arg_3 in arg_1['sizes']:\n            arg_4 = Size(**arg_3)\n            arg_4.token = arg_0.token\n            arg_2.append(arg_4)\n        return arg_2", "path": "digitalocean/Manager.py", "identifier": "Manager.get_all_sizes", "docstring": "This function returns a list of Size object.", "docstring_tokens": ["This", "function", "returns", "a", "list", "of", "Size", "object", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 258080}
{"url": "https://github.com/zartstrom/snaptime/blob/b05ae09d4dccb1b5c8c4ace9c1937b8139672a3c/snaptime/main.py#L119-L131", "sha": "b05ae09d4dccb1b5c8c4ace9c1937b8139672a3c", "docstring_summary": "We make sure that after truncating we use the correct timezone,\n        even if we 'jump' over a daylight saving time switch.", "language": "python", "parameters": "(self, dttm, timezone)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "apply_to", "(", "arg_1", ")", "if", "arg_0", ".", "unit", "in", "[", "DAYS", ",", "WEEKS", ",", "MONTHS", ",", "YEARS", "]", ":", "arg_4", "=", "datetime", "(", "arg_3", ".", "year", ",", "arg_3", ".", "month", ",", "arg_3", ".", "day", ")", "arg_3", "=", "arg_2", ".", "localize", "(", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"We make sure that after truncating we use the correct timezone,\n        even if we 'jump' over a daylight saving time switch.\n\n        I.e. if we apply \"@d\" to `Sun Oct 30 04:30:00 CET 2016` (1477798200)\n        we want to have `Sun Oct 30 00:00:00 CEST 2016` (1477778400)\n        but not `Sun Oct 30 00:00:00 CET 2016` (1477782000)\n        \"\"\"\n        arg_3 = arg_0.apply_to(arg_1)\n        if arg_0.unit in [DAYS, WEEKS, MONTHS, YEARS]:\n            arg_4 = datetime(arg_3.year, arg_3.month, arg_3.day)\n            arg_3 = arg_2.localize(arg_4)\n        return arg_3", "path": "snaptime/main.py", "identifier": "SnapTransformation.apply_to_with_tz", "docstring": "We make sure that after truncating we use the correct timezone,\n        even if we 'jump' over a daylight saving time switch.\n\n        I.e. if we apply \"@d\" to `Sun Oct 30 04:30:00 CET 2016` (1477798200)\n        we want to have `Sun Oct 30 00:00:00 CEST 2016` (1477778400)\n        but not `Sun Oct 30 00:00:00 CET 2016` (1477782000)", "docstring_tokens": ["We", "make", "sure", "that", "after", "truncating", "we", "use", "the", "correct", "timezone", "even", "if", "we", "jump", "over", "a", "daylight", "saving", "time", "switch", "."], "nwo": "zartstrom/snaptime", "score": 0.3298731540802308, "idx": 258081}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/commands/utils.py#L4-L28", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "Find the message shown when someone calls the help command", "language": "python", "parameters": "(func)", "return_statement": "return \"\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\" \\t\"", "if", "hasattr", "(", "arg_0", ",", "'__Func__'", ")", ":", "arg_2", "=", "arg_0", ".", "__Func__", ".", "lstrip", "(", "\" \\n\\t\"", ")", "if", "\"\\n\"", "in", "arg_2", ":", "arg_3", "=", "arg_2", ".", "index", "(", "\"\\n\"", ")", "return", "arg_2", "[", ":", "arg_3", "]", ".", "rstrip", "(", "arg_1", ")", "elif", "arg_2", ":", "return", "arg_2", ".", "rstrip", "(", "arg_1", ")", "return", "\"\""], "function": "def Func(arg_0):\n    \"\"\"\n        Find the message shown when someone calls the help command\n\n    Parameters\n    ----------\n    func : function\n        the function\n\n    Returns\n    -------\n    str\n        The help message for this command\n    \"\"\"\n    arg_1 = \" \\t\"\n\n    if hasattr(arg_0, '__Func__'):\n        arg_2 = arg_0.__Func__.lstrip(\" \\n\\t\")\n        if \"\\n\" in arg_2:\n            arg_3 = arg_2.index(\"\\n\")\n            return arg_2[:arg_3].rstrip(arg_1)\n        elif arg_2:\n            return arg_2.rstrip(arg_1)\n\n    return \"\"", "path": "peony/commands/utils.py", "identifier": "doc", "docstring": "Find the message shown when someone calls the help command\n\n    Parameters\n    ----------\n    func : function\n        the function\n\n    Returns\n    -------\n    str\n        The help message for this command", "docstring_tokens": ["Find", "the", "message", "shown", "when", "someone", "calls", "the", "help", "command"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 258082}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L284-L324", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "option to change orientation of reads and sets Qscore to B", "language": "python", "parameters": "(read, outfile, reverse=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "0", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "out", ":", "if", "arg_0", ".", "endswith", "(", "\".gz\"", ")", ":", "arg_4", "=", "gzip", ".", "open", "(", "arg_0", ",", "'rb'", ")", "else", ":", "arg_4", "=", "open", "(", "arg_0", ",", "'rb'", ")", "arg_5", "=", "itertools", ".", "izip", "(", "*", "[", "iter", "(", "arg_4", ")", "]", "*", "4", ")", "arg_6", "=", "[", "]", "while", "1", ":", "try", ":", "arg_7", "=", "arg_5", ".", "next", "(", ")", "except", "StopIteration", ":", "break", "if", "arg_2", ":", "arg_8", "=", "arg_7", "[", "1", "]", ".", "strip", "(", ")", "[", ":", ":", "-", "1", "]", "else", ":", "arg_8", "=", "arg_7", "[", "1", "]", ".", "strip", "(", ")", "arg_6", ".", "append", "(", "\"\"", ".", "join", "(", "[", "arg_7", "[", "0", "]", ",", "arg_8", "+", "\"\\n\"", ",", "arg_7", "[", "2", "]", ",", "\"B\"", "*", "len", "(", "arg_8", ")", "]", ")", ")", "arg_3", "+=", "1", "if", "not", "arg_3", "%", "1000", ":", "out", ".", "write", "(", "\"\\n\"", ".", "join", "(", "arg_6", ")", "+", "\"\\n\"", ")", "arg_6", "=", "[", "]", "if", "arg_6", ":", "out", ".", "write", "(", "\"\\n\"", ".", "join", "(", "arg_6", ")", ")", "out", ".", "close", "(", ")", "arg_4", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\" option to change orientation of reads and sets Qscore to B \"\"\"\n    \n    arg_3 = 0\n    with open(arg_1, 'w') as out:\n        ## read in paired end read files 4 lines at a time\n        if arg_0.endswith(\".gz\"):\n            arg_4 = gzip.open(arg_0, 'rb')\n        else:\n            arg_4 = open(arg_0, 'rb')\n        arg_5 = itertools.izip(*[iter(arg_4)]*4)\n\n        ## a list to store until writing\n        arg_6 = []\n\n        while 1:\n            try:\n                arg_7 = arg_5.next()\n            except StopIteration:\n                break\n            if arg_2:\n                arg_8 = arg_7[1].strip()[::-1]\n            else:\n                arg_8 = arg_7[1].strip()\n            arg_6.append(\"\".join([\n                arg_7[0],\n                arg_8+\"\\n\",\n                arg_7[2],\n                \"B\"*len(arg_8)\n            ]))\n\n            ## write to disk\n            arg_3 += 1\n            if not arg_3 % 1000:\n                out.write(\"\\n\".join(arg_6)+\"\\n\")\n                arg_6 = []\n        if arg_6:\n            out.write(\"\\n\".join(arg_6))\n            \n    out.close()\n    arg_4.close()", "path": "ipyrad/assemble/util.py", "identifier": "fastq_touchup_for_vsearch_merge", "docstring": "option to change orientation of reads and sets Qscore to B", "docstring_tokens": ["option", "to", "change", "orientation", "of", "reads", "and", "sets", "Qscore", "to", "B"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258083}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/smooth.py#L197-L239", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "A laplacian smooth that is constrained to move vertices only along the\n        view direction.", "language": "python", "parameters": "(script, iterations=3, viewpoint=(0, 0, 0), selected=False)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3", ",", "arg_2", "=", "(", "0", ",", "0", ",", "0", ")", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Depth Smooth\">\\n'", ",", "'    <Param name=\"stepSmoothNum\" '", ",", "'value=\"{:d}\" '", ".", "format", "(", "arg_1", ")", ",", "'description=\"Smoothing steps\" '", ",", "'type=\"RichInt\" '", ",", "'/>\\n'", ",", "'    <Param name=\"viewPoint\" '", ",", "'x=\"{}\" '", ".", "format", "(", "arg_2", "[", "0", "]", ")", ",", "'y=\"{}\" '", ".", "format", "(", "arg_2", "[", "1", "]", ")", ",", "'z=\"{}\" '", ".", "format", "(", "arg_2", "[", "2", "]", ")", ",", "'description=\"Smoothing steps\" '", ",", "'type=\"RichPoint3f\" '", ",", "'/>\\n'", ",", "'    <Param name=\"Selected\" '", ",", "'value=\"{}\" '", ".", "format", "(", "str", "(", "arg_3", ")", ".", "lower", "(", ")", ")", ",", "'description=\"Affect only selected faces\" '", ",", "'type=\"RichBool\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_4", ")", "return", "None"], "function": "def Func(arg_0, arg_1=3, arg_2=(0, 0, 0), arg_3=False):\n    \"\"\" A laplacian smooth that is constrained to move vertices only along the\n        view direction.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        iterations (int): The number of times that the whole algorithm (normal\n            smoothing + vertex fitting) is iterated.\n        viewpoint (vector tuple or list): The position of the view point that\n            is used to get the constraint direction.\n        selected (bool): If selected the filter is performed only on the\n            selected faces\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    arg_4 = ''.join([\n        '  <filter name=\"Depth Smooth\">\\n',\n        '    <Param name=\"stepSmoothNum\" ',\n        'value=\"{:d}\" '.format(arg_1),\n        'description=\"Smoothing steps\" ',\n        'type=\"RichInt\" ',\n        '/>\\n',\n        '    <Param name=\"viewPoint\" ',\n        'x=\"{}\" '.format(arg_2[0]),\n        'y=\"{}\" '.format(arg_2[1]),\n        'z=\"{}\" '.format(arg_2[2]),\n        'description=\"Smoothing steps\" ',\n        'type=\"RichPoint3f\" ',\n        '/>\\n',\n        '    <Param name=\"Selected\" ',\n        'value=\"{}\" '.format(str(arg_3).lower()),\n        'description=\"Affect only selected faces\" ',\n        'type=\"RichBool\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_4)\n    return None", "path": "meshlabxml/smooth.py", "identifier": "depth", "docstring": "A laplacian smooth that is constrained to move vertices only along the\n        view direction.\n\n    Args:\n        script: the FilterScript object or script filename to write\n            the filter to.\n        iterations (int): The number of times that the whole algorithm (normal\n            smoothing + vertex fitting) is iterated.\n        viewpoint (vector tuple or list): The position of the view point that\n            is used to get the constraint direction.\n        selected (bool): If selected the filter is performed only on the\n            selected faces\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["A", "laplacian", "smooth", "that", "is", "constrained", "to", "move", "vertices", "only", "along", "the", "view", "direction", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 258084}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/signals.py#L105-L118", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record.", "language": "python", "parameters": "(sender, instance, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_1", ".", "user", ":", "arg_3", ",", "arg_4", "=", "SystemWideEnterpriseRole", ".", "objects", ".", "get_or_create", "(", "name", "=", "ENTERPRISE_LEARNER_ROLE", ")", "try", ":", "SystemWideEnterpriseUserRoleAssignment", ".", "objects", ".", "get", "(", "user", "=", "arg_1", ".", "user", ",", "role", "=", "arg_3", ")", ".", "delete", "(", ")", "except", "SystemWideEnterpriseUserRoleAssignment", ".", "DoesNotExist", ":", "pass"], "function": "def Func(arg_0, arg_1, **arg_2):     # pylint: disable=unused-argument\n    \"\"\"\n    Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record.\n    \"\"\"\n    if arg_1.user:\n        arg_3, arg_4 = SystemWideEnterpriseRole.objects.get_or_create(name=ENTERPRISE_LEARNER_ROLE)\n        try:\n            SystemWideEnterpriseUserRoleAssignment.objects.get(\n                user=arg_1.user,\n                role=arg_3\n            ).delete()\n        except SystemWideEnterpriseUserRoleAssignment.DoesNotExist:\n            # Do nothing if no role assignment is present for the enterprise customer user.\n            pass", "path": "enterprise/signals.py", "identifier": "delete_enterprise_learner_role_assignment", "docstring": "Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record.", "docstring_tokens": ["Delete", "the", "associated", "enterprise", "learner", "role", "assignment", "record", "when", "deleting", "an", "EnterpriseCustomerUser", "record", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258085}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L35-L57", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Launches GBDX workflow.", "language": "python", "parameters": "(self, workflow)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "gbdx_connection", ".", "post", "(", "arg_0", ".", "workflows_url", ",", "json", "=", "arg_1", ")", "try", ":", "arg_2", ".", "raise_for_status", "(", ")", "except", ":", "print", "(", "\"GBDX API Status Code: %s\"", "%", "arg_2", ".", "status_code", ")", "print", "(", "\"GBDX API Response: %s\"", "%", "arg_2", ".", "text", ")", "arg_2", ".", "raise_for_status", "(", ")", "arg_3", "=", "arg_2", ".", "json", "(", ")", "[", "'id'", "]", "return", "arg_3", "except", "TypeError", ":", "arg_0", ".", "logger", ".", "debug", "(", "'Workflow not Funced!'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Launches GBDX workflow.\n\n        Args:\n            workflow (dict): Dictionary specifying workflow tasks.\n\n        Returns:\n            Workflow id (str).\n        \"\"\"\n\n        # hit workflow api\n        try:\n            arg_2 = arg_0.gbdx_connection.post(arg_0.workflows_url, json=arg_1)\n            try:\n                arg_2.raise_for_status()\n            except:\n                print(\"GBDX API Status Code: %s\" % arg_2.status_code)\n                print(\"GBDX API Response: %s\" % arg_2.text)\n                arg_2.raise_for_status()\n            arg_3 = arg_2.json()['id']\n            return arg_3\n        except TypeError:\n            arg_0.logger.debug('Workflow not Funced!')", "path": "gbdxtools/workflow.py", "identifier": "Workflow.launch", "docstring": "Launches GBDX workflow.\n\n        Args:\n            workflow (dict): Dictionary specifying workflow tasks.\n\n        Returns:\n            Workflow id (str).", "docstring_tokens": ["Launches", "GBDX", "workflow", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 258086}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/vaults_operations.py#L718-L757", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Permanently deletes the specified vault. aka Purges the deleted Azure\n        key vault.", "language": "python", "parameters": "(\n            self, vault_name, location, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "True", ",", "**", "arg_6", ")", ":", "arg_7", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "True", ",", "**", "arg_6", ")", "def", "get_long_running_output", "(", "arg_8", ")", ":", "if", "arg_4", ":", "arg_9", "=", "ClientRawResponse", "(", "None", ",", "arg_8", ")", "return", "arg_9", "arg_10", "=", "arg_6", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_5", "is", "True", ":", "arg_11", "=", "ARMPolling", "(", "arg_10", ",", "**", "arg_6", ")", "elif", "arg_5", "is", "False", ":", "arg_11", "=", "NoPolling", "(", ")", "else", ":", "arg_11", "=", "arg_5", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_7", ",", "get_long_running_output", ",", "arg_11", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3=None, arg_4=False, arg_5=True, **arg_6):\n        \"\"\"Permanently deletes the specified vault. aka Purges the deleted Azure\n        key vault.\n\n        :param vault_name: The name of the soft-deleted vault.\n        :type vault_name: str\n        :param location: The location of the soft-deleted vault.\n        :type location: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`\n        \"\"\"\n        arg_7 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=True,\n            **arg_6\n        )\n\n        def get_long_running_output(arg_8):\n            if arg_4:\n                arg_9 = ClientRawResponse(None, arg_8)\n                return arg_9\n\n        arg_10 = arg_6.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_5 is True: arg_11 = ARMPolling(arg_10, **arg_6)\n        elif arg_5 is False: arg_11 = NoPolling()\n        else: arg_11 = arg_5\n        return LROPoller(arg_0._client, arg_7, get_long_running_output, arg_11)", "path": "azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/vaults_operations.py", "identifier": "VaultsOperations.purge_deleted", "docstring": "Permanently deletes the specified vault. aka Purges the deleted Azure\n        key vault.\n\n        :param vault_name: The name of the soft-deleted vault.\n        :type vault_name: str\n        :param location: The location of the soft-deleted vault.\n        :type location: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns None or\n         ClientRawResponse<None> if raw==True\n        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]\n        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`", "docstring_tokens": ["Permanently", "deletes", "the", "specified", "vault", ".", "aka", "Purges", "the", "deleted", "Azure", "key", "vault", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258087}
{"url": "https://github.com/inveniosoftware/invenio-app/blob/6ef600f28913a501c05d75ffbe203e941e229f49/invenio_app/factory.py#L74-L94", "sha": "6ef600f28913a501c05d75ffbe203e941e229f49", "docstring_summary": "Create Flask application class.", "language": "python", "parameters": "()", "return_statement": "return Flask", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "pkg_resources", ".", "get_distribution", "(", "'invenio-files-rest'", ")", "from", "invenio_files_rest", ".", "app", "import", "Flask", "as", "FlaskBase", "except", "pkg_resources", ".", "DistributionNotFound", ":", "from", "flask", "import", "Flask", "as", "FlaskBase", "class", "Request", "(", "TrustedHostsMixin", ",", "FlaskBase", ".", "request_class", ")", ":", "pass", "class", "Flask", "(", "FlaskBase", ")", ":", "arg_0", "=", "Request", "return", "Flask"], "function": "def Func():\n    \"\"\"Create Flask application class.\n\n    Invenio-Files-REST needs to patch the Werkzeug form parsing in order to\n    support streaming large file uploads. This is done by subclassing the Flask\n    application class.\n    \"\"\"\n    try:\n        pkg_resources.get_distribution('invenio-files-rest')\n        from invenio_files_rest.app import Flask as FlaskBase\n    except pkg_resources.DistributionNotFound:\n        from flask import Flask as FlaskBase\n\n    # Add Host header validation via APP_ALLOWED_HOSTS configuration variable.\n    class Request(TrustedHostsMixin, FlaskBase.request_class):\n        pass\n\n    class Flask(FlaskBase):\n        arg_0 = Request\n\n    return Flask", "path": "invenio_app/factory.py", "identifier": "app_class", "docstring": "Create Flask application class.\n\n    Invenio-Files-REST needs to patch the Werkzeug form parsing in order to\n    support streaming large file uploads. This is done by subclassing the Flask\n    application class.", "docstring_tokens": ["Create", "Flask", "application", "class", "."], "nwo": "inveniosoftware/invenio-app", "score": 0.19114614593059856, "idx": 258088}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L202-L229", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Parse arguments and print generated documentation to stdout.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", ")", "arg_0", ".", "add_argument", "(", "'protofilepath'", ")", "arg_1", "=", "arg_0", ".", "parse_args", "(", ")", "arg_2", "=", "compile_protofile", "(", "arg_1", ".", "protofilepath", ")", "with", "open", "(", "arg_2", ",", "'rb'", ")", "as", "proto_file", ":", "arg_3", "=", "descriptor_pb2", ".", "FileDescriptorSet", ".", "FromString", "(", "proto_file", ".", "read", "(", ")", ")", "for", "arg_4", "in", "arg_3", ".", "file", ":", "arg_5", "=", "{", "}", "for", "arg_6", "in", "arg_4", ".", "source_code_info", ".", "location", ":", "arg_5", "[", "arg_7", "(", "arg_6", ".", "path", ")", "]", "=", "arg_6", "print", "(", "make_comment", "(", "'This file was automatically generated from {} and '", "'should not be edited directly.'", ".", "format", "(", "arg_1", ".", "protofilepath", ")", ")", ")", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_4", ".", "message_type", ")", ":", "generate_message_doc", "(", "arg_10", ",", "arg_5", ",", "(", "4", ",", "arg_9", ")", ")", "for", "arg_9", ",", "arg_11", "in", "enumerate", "(", "arg_4", ".", "enum_type", ")", ":", "generate_enum_doc", "(", "arg_11", ",", "arg_5", ",", "(", "5", ",", "arg_9", ")", ")"], "function": "def Func():\n    \"\"\"Parse arguments and print generated documentation to stdout.\"\"\"\n    arg_0 = argparse.ArgumentParser()\n    arg_0.add_argument('protofilepath')\n    arg_1 = arg_0.parse_args()\n\n    arg_2 = compile_protofile(arg_1.protofilepath)\n    with open(arg_2, 'rb') as proto_file:\n        # pylint: disable=no-member\n        arg_3 = descriptor_pb2.FileDescriptorSet.FromString(\n            proto_file.read()\n        )\n        # pylint: enable=no-member\n\n    for arg_4 in arg_3.file:\n        # Build dict of location tuples\n        arg_5 = {}\n        for arg_6 in arg_4.source_code_info.location:\n            arg_5[arg_7(arg_6.path)] = arg_6\n        # Add comment to top\n        print(make_comment('This file was automatically generated from {} and '\n                           'should not be edited directly.'\n                           .format(arg_1.protofilepath)))\n        # Generate documentation\n        for arg_9, arg_10 in enumerate(arg_4.message_type):\n            generate_message_doc(arg_10, arg_5, (4, arg_9))\n        for arg_9, arg_11 in enumerate(arg_4.enum_type):\n            generate_enum_doc(arg_11, arg_5, (5, arg_9))", "path": "docs/generate_proto_docs.py", "identifier": "main", "docstring": "Parse arguments and print generated documentation to stdout.", "docstring_tokens": ["Parse", "arguments", "and", "print", "generated", "documentation", "to", "stdout", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258089}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppparser.py#L112-L127", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle the start tag.", "language": "python", "parameters": "(self, tag, attrs)", "return_statement": "return self._builder.start(tag, attrs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "_level", "==", "0", ":", "arg_0", ".", "_root", "=", "ElementTree", ".", "Element", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_handler", ".", "stream_Func", "(", "arg_0", ".", "_root", ")", "if", "arg_0", ".", "_level", "<", "2", ":", "arg_0", ".", "_builder", "=", "ElementTree", ".", "TreeBuilder", "(", ")", "arg_0", ".", "_level", "+=", "1", "return", "arg_0", ".", "_builder", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle the Func tag.\n\n        Call the handler's 'stream_Func' methods with\n        an empty root element if it is top level.\n\n        For lower level tags use :etree:`ElementTree.TreeBuilder` to collect\n        them.\n        \"\"\"\n        if arg_0._level == 0:\n            arg_0._root = ElementTree.Element(arg_1, arg_2)\n            arg_0._handler.stream_Func(arg_0._root)\n        if arg_0._level < 2:\n            arg_0._builder = ElementTree.TreeBuilder()\n        arg_0._level += 1\n        return arg_0._builder.Func(arg_1, arg_2)", "path": "pyxmpp2/xmppparser.py", "identifier": "ParserTarget.start", "docstring": "Handle the start tag.\n\n        Call the handler's 'stream_start' methods with\n        an empty root element if it is top level.\n\n        For lower level tags use :etree:`ElementTree.TreeBuilder` to collect\n        them.", "docstring_tokens": ["Handle", "the", "start", "tag", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258090}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/get_traffic.py#L134-L140", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Retrieves the releases for the given repo in JSON.", "language": "python", "parameters": "(self, url='', headers={}, repo_name='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "''", ")", ":", "arg_4", "=", "(", "arg_1", "+", "'/releases'", ")", "arg_5", "=", "requests", ".", "get", "(", "arg_4", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "releases_json", "[", "arg_3", "]", "=", "arg_5", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1='', arg_2={}, arg_3=''):\n        \"\"\"\n        Retrieves the releases for the given repo in JSON.\n        \"\"\"\n        arg_4 = (arg_1 + '/releases')\n        arg_5 = requests.get(arg_4, arg_2=arg_2)\n        arg_0.releases_json[arg_3] = arg_5.json()", "path": "scripts/get_traffic.py", "identifier": "GitHub_Traffic.get_releases", "docstring": "Retrieves the releases for the given repo in JSON.", "docstring_tokens": ["Retrieves", "the", "releases", "for", "the", "given", "repo", "in", "JSON", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 258091}
{"url": "https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L292-L313", "sha": "0334545885445834307c075a445fba9fe6f0c9e7", "docstring_summary": "Sort a file into a group based on on-disk size.", "language": "python", "parameters": "(path, min_size=DEFAULTS['min_size'])", "return_statement": "return filestat.st_size", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", "[", "'min_size'", "]", ")", ":", "arg_3", "=", "_stat", "(", "arg_0", ")", "if", "stat", ".", "S_ISLNK", "(", "arg_3", ".", "st_mode", ")", ":", "return", "if", "arg_3", ".", "st_size", "<", "arg_1", ":", "return", "return", "arg_3", ".", "st_size"], "function": "def Func(arg_0, arg_1=arg_2['min_size']):\n    \"\"\"Sort a file into a group based on on-disk size.\n\n    :param paths: See :func:`fastdupes.groupify`\n\n    :param min_size: Files smaller than this size (in bytes) will be ignored.\n    :type min_size: :class:`__builtins__.int`\n\n    :returns: See :func:`fastdupes.groupify`\n\n    .. todo:: Rework the calling of :func:`~os.stat` to minimize the number of\n        calls. It's a fairly significant percentage of the time taken according\n        to the profiler.\n    \"\"\"\n    arg_3 = _stat(arg_0)\n    if stat.S_ISLNK(arg_3.st_mode):\n        return  # Skip symlinks.\n\n    if arg_3.st_size < arg_1:\n        return  # Skip files below the size limit\n\n    return arg_3.st_size", "path": "fastdupes.py", "identifier": "sizeClassifier", "docstring": "Sort a file into a group based on on-disk size.\n\n    :param paths: See :func:`fastdupes.groupify`\n\n    :param min_size: Files smaller than this size (in bytes) will be ignored.\n    :type min_size: :class:`__builtins__.int`\n\n    :returns: See :func:`fastdupes.groupify`\n\n    .. todo:: Rework the calling of :func:`~os.stat` to minimize the number of\n        calls. It's a fairly significant percentage of the time taken according\n        to the profiler.", "docstring_tokens": ["Sort", "a", "file", "into", "a", "group", "based", "on", "on", "-", "disk", "size", "."], "nwo": "ssokolow/fastdupes", "score": 0.4039778193346996, "idx": 258092}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/list.py#L12-L24", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "the list command corresponds with listing images for an external\n       resource. This is different from listing images that are local to the\n       database, which should be done with \"images\"", "language": "python", "parameters": "(args,parser,subparser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "from", "sregistry", ".", "Func", "import", "get_client", "arg_3", "=", "get_client", "(", "quiet", "=", "arg_0", ".", "quiet", ")", "for", "arg_4", "in", "arg_0", ".", "query", ":", "if", "arg_4", "in", "[", "''", ",", "'*'", "]", ":", "arg_4", "=", "None", "arg_3", ".", "ls", "(", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0,arg_1,arg_2):\n    '''the list command corresponds with listing images for an external\n       resource. This is different from listing images that are local to the\n       database, which should be done with \"images\"\n    '''\n    from sregistry.Func import get_client\n    arg_3 = get_client(quiet=arg_0.quiet)\n    \n    for arg_4 in arg_0.query:\n        if arg_4 in ['','*']:\n            arg_4 = None\n\n        arg_3.ls(arg_4=arg_4)", "path": "sregistry/client/list.py", "identifier": "main", "docstring": "the list command corresponds with listing images for an external\n       resource. This is different from listing images that are local to the\n       database, which should be done with \"images\"", "docstring_tokens": ["the", "list", "command", "corresponds", "with", "listing", "images", "for", "an", "external", "resource", ".", "This", "is", "different", "from", "listing", "images", "that", "are", "local", "to", "the", "database", "which", "should", "be", "done", "with", "images"], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 258093}
{"url": "https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/decorators.py#L13-L70", "sha": "70d469ef9a161c1170b53aa017cf02d7c15eb90c", "docstring_summary": "View decorator that enforces that the method was called using POST.\n    This decorator can be called with or without parameters.  As it is\n    expected to wrap a view, the first argument of the method being wrapped is\n    expected to be a ``request`` object.", "language": "python", "parameters": "(method_or_options=[])", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "[", "]", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "not", "callable", "(", "arg_0", ")", ":", "arg_2", "=", "arg_0", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_3", "[", "0", "]", "if", "arg_5", ".", "method", "!=", "'POST'", ":", "logger", ".", "error", "(", "'POST required for this url'", ")", "raise", "Http404", "(", "'only POST allowed for this url'", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_2", ":", "if", "arg_7", "not", "in", "arg_5", ".", "POST", ":", "arg_6", ".", "append", "(", "arg_7", ")", "if", "arg_6", ":", "arg_8", "=", "'Expected fields missing in POST: %s'", "%", "arg_6", "logger", ".", "error", "(", "arg_8", ")", "raise", "Http404", "(", "arg_8", ")", "return", "arg_1", "(", "*", "arg_3", ",", "**", "arg_4", ")", "return", "wrapper", "if", "callable", "(", "arg_0", ")", ":", "return", "decorator", "(", "arg_0", ")", "return", "decorator"], "function": "def Func(arg_0=[]):\n    \"\"\"View decorator that enforces that the method was called using POST.\n    This decorator can be called with or without parameters.  As it is\n    expected to wrap a view, the first argument of the method being wrapped is\n    expected to be a ``request`` object.\n\n    .. code-block:: python\n\n        @Func\n        def some_view(request):\n            pass\n\n\n        @Func(['firstname', 'lastname'])\n        def some_view(request):\n            pass\n\n    The optional parameter contains a single list which specifies the names of\n    the expected fields in the POST dictionary.  The list is not exclusive,\n    you can pass in fields that are not checked by the decorator.\n\n    :param options:\n        List of the names of expected POST keys.\n    \"\"\"\n    def decorator(arg_1):\n        # handle wrapping or wrapping with arguments; if no arguments (and no\n        # calling parenthesis) then method_or_options will be a list,\n        # otherwise it will be the wrapped function\n        arg_2 = []\n        if not callable(arg_0):\n            # not callable means wrapping with arguments\n            arg_2 = arg_0\n\n        @wraps(arg_1)\n        def wrapper(*arg_3, **arg_4):\n            arg_5 = arg_3[0]\n            if arg_5.method != 'POST':\n                logger.error('POST required for this url')\n                raise Http404('only POST allowed for this url')\n\n            arg_6 = []\n            for arg_7 in arg_2:\n                if arg_7 not in arg_5.POST:\n                    arg_6.append(arg_7)\n\n            if arg_6:\n                arg_8 = 'Expected fields missing in POST: %s' % arg_6\n                logger.error(arg_8)\n                raise Http404(arg_8)\n\n            # everything verified, run the view\n            return arg_1(*arg_3, **arg_4)\n        return wrapper\n\n    if callable(arg_0):\n        # callable means decorated method without options, call our decorator \n        return decorator(arg_0)\n    return decorator", "path": "awl/decorators.py", "identifier": "post_required", "docstring": "View decorator that enforces that the method was called using POST.\n    This decorator can be called with or without parameters.  As it is\n    expected to wrap a view, the first argument of the method being wrapped is\n    expected to be a ``request`` object.\n\n    .. code-block:: python\n\n        @post_required\n        def some_view(request):\n            pass\n\n\n        @post_required(['firstname', 'lastname'])\n        def some_view(request):\n            pass\n\n    The optional parameter contains a single list which specifies the names of\n    the expected fields in the POST dictionary.  The list is not exclusive,\n    you can pass in fields that are not checked by the decorator.\n\n    :param options:\n        List of the names of expected POST keys.", "docstring_tokens": ["View", "decorator", "that", "enforces", "that", "the", "method", "was", "called", "using", "POST", ".", "This", "decorator", "can", "be", "called", "with", "or", "without", "parameters", ".", "As", "it", "is", "expected", "to", "wrap", "a", "view", "the", "first", "argument", "of", "the", "method", "being", "wrapped", "is", "expected", "to", "be", "a", "request", "object", "."], "nwo": "cltrudeau/django-awl", "score": 0.09252797783733271, "idx": 258094}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/__init__.py#L399-L404", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "Returns the versions available", "language": "python", "parameters": "(self)", "return_statement": "return response['DescribeApplicationVersionsResponse']['DescribeApplicationVersionsResult']['ApplicationVersions']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "ebs", ".", "describe_application_versions", "(", "application_name", "=", "arg_0", ".", "app_name", ")", "return", "arg_1", "[", "'DescribeApplicationVersionsResponse'", "]", "[", "'DescribeApplicationVersionsResult'", "]", "[", "'ApplicationVersions'", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the versions available\n        \"\"\"\n        arg_1 = arg_0.ebs.describe_application_versions(application_name=arg_0.app_name)\n        return arg_1['DescribeApplicationVersionsResponse']['DescribeApplicationVersionsResult']['ApplicationVersions']", "path": "ebs_deploy/__init__.py", "identifier": "EbsHelper.get_versions", "docstring": "Returns the versions available", "docstring_tokens": ["Returns", "the", "versions", "available"], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 258095}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L749-L786", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Presets parameter value before a parameter is added.", "language": "python", "parameters": "(self, param_name, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "not", "arg_1", ".", "startswith", "(", "'parameters.'", ")", ":", "arg_1", "=", "'parameters.'", "+", "arg_1", "arg_0", ".", "_preset", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Presets parameter value before a parameter is added.\n\n        Can be called before parameters are added to the Trajectory in order to change the\n        values that are stored into the parameter on creation.\n\n        After creation of a parameter, the instance of the parameter is called\n        with `param.f_set(*args,**kwargs)` with `*args`, and `**kwargs` provided by the user\n        with `Func`.\n\n        Before an experiment is carried out it is checked if all parameters that were\n        marked were also preset.\n\n        :param param_name:\n\n            The full name (!) of the parameter that is to be changed after its creation.\n\n        :param args:\n\n            Arguments that will be used for changing the parameter's data\n\n        :param kwargs:\n\n            Keyword arguments that will be used for changing the parameter's data\n\n        Example:\n\n        >>> traj.Func('groupA.param1', data=44)\n        >>> traj.f_add_parameter('groupA.param1', data=11)\n        >>> traj.parameters.groupA.param1\n        44\n\n        \"\"\"\n\n        if not arg_1.startswith('parameters.'):\n            arg_1 = 'parameters.' + arg_1\n\n        arg_0._preset(arg_1, arg_2, arg_3)", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_preset_parameter", "docstring": "Presets parameter value before a parameter is added.\n\n        Can be called before parameters are added to the Trajectory in order to change the\n        values that are stored into the parameter on creation.\n\n        After creation of a parameter, the instance of the parameter is called\n        with `param.f_set(*args,**kwargs)` with `*args`, and `**kwargs` provided by the user\n        with `f_preset_parameter`.\n\n        Before an experiment is carried out it is checked if all parameters that were\n        marked were also preset.\n\n        :param param_name:\n\n            The full name (!) of the parameter that is to be changed after its creation.\n\n        :param args:\n\n            Arguments that will be used for changing the parameter's data\n\n        :param kwargs:\n\n            Keyword arguments that will be used for changing the parameter's data\n\n        Example:\n\n        >>> traj.f_preset_parameter('groupA.param1', data=44)\n        >>> traj.f_add_parameter('groupA.param1', data=11)\n        >>> traj.parameters.groupA.param1\n        44", "docstring_tokens": ["Presets", "parameter", "value", "before", "a", "parameter", "is", "added", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258096}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/consensus/base.py#L133-L142", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "signatures are non deterministic", "language": "python", "parameters": "(self)", "return_statement": "return sha3(rlp.encode(self, HashSerializable))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "sender", "is", "None", ":", "raise", "MissingSignatureError", "(", ")", "class", "HashSerializable", "(", "rlp", ".", "Serializable", ")", ":", "arg_1", "=", "[", "(", "field", ",", "sedes", ")", "for", "field", ",", "sedes", "in", "arg_0", ".", "fields", "if", "field", "not", "in", "(", "'v'", ",", "'r'", ",", "'s'", ")", "]", "+", "[", "(", "'_sender'", ",", "binary", ")", "]", "arg_2", "=", "None", "return", "sha3", "(", "rlp", ".", "encode", "(", "arg_0", ",", "HashSerializable", ")", ")"], "function": "def Func(arg_0):\n        \"signatures are non deterministic\"\n        if arg_0.sender is None:\n            raise MissingSignatureError()\n\n        class HashSerializable(rlp.Serializable):\n            arg_1 = [(field, sedes) for field, sedes in arg_0.fields\n                      if field not in ('v', 'r', 's')] + [('_sender', binary)]\n            arg_2 = None\n        return sha3(rlp.encode(arg_0, HashSerializable))", "path": "hydrachain/consensus/base.py", "identifier": "Signed.hash", "docstring": "signatures are non deterministic", "docstring_tokens": ["signatures", "are", "non", "deterministic"], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 258097}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfdocument.py#L224-L229", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Convenience method for just changing font size.", "language": "python", "parameters": "(self, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "font", ".", "font_size", "==", "arg_1", ":", "pass", "else", ":", "arg_0", ".", "font", ".", "_set_size", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Convenience method for just changing font size.\"\"\"\r\n        if arg_0.font.font_size == arg_1:\r\n            pass\r\n        else:\r\n            arg_0.font._set_size(arg_1)", "path": "pypdflite/pdfdocument.py", "identifier": "PDFDocument.set_font_size", "docstring": "Convenience method for just changing font size.", "docstring_tokens": ["Convenience", "method", "for", "just", "changing", "font", "size", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 258098}
{"url": "https://github.com/grappa-py/grappa/blob/b128da8aef67501c310701c47508e7318241aa8b/grappa/config.py#L8-L20", "sha": "b128da8aef67501c310701c47508e7318241aa8b", "docstring_summary": "Config option name value validator decorator.", "language": "python", "parameters": "(method)", "return_statement": "return validator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'configuration option \"{}\" is not supported'", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "validator", "(", "arg_2", ",", "arg_3", ",", "*", "arg_4", ")", ":", "if", "arg_3", "not", "in", "arg_2", ".", "allowed_opts", ":", "raise", "ValueError", "(", "arg_1", ".", "format", "(", "arg_3", ")", ")", "return", "arg_0", "(", "arg_2", ",", "arg_3", ",", "*", "arg_4", ")", "return", "validator"], "function": "def Func(arg_0):\n    \"\"\"\n    Config option name value validator decorator.\n    \"\"\"\n    # Name error template\n    arg_1 = 'configuration option \"{}\" is not supported'\n\n    @functools.wraps(arg_0)\n    def validator(arg_2, arg_3, *arg_4):\n        if arg_3 not in arg_2.allowed_opts:\n            raise ValueError(arg_1.format(arg_3))\n        return arg_0(arg_2, arg_3, *arg_4)\n    return validator", "path": "grappa/config.py", "identifier": "validate", "docstring": "Config option name value validator decorator.", "docstring_tokens": ["Config", "option", "name", "value", "validator", "decorator", "."], "nwo": "grappa-py/grappa", "score": 0.4496090913237058, "idx": 258099}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L696-L722", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Deletes the given local filename.", "language": "python", "parameters": "(target_filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_AssertIsLocal", "(", "arg_0", ")", "try", ":", "if", "IsLink", "(", "arg_0", ")", ":", "DeleteLink", "(", "arg_0", ")", "elif", "IsFile", "(", "arg_0", ")", ":", "os", ".", "remove", "(", "arg_0", ")", "elif", "IsDir", "(", "arg_0", ")", ":", "from", ".", "_exceptions", "import", "FileOnlyActionError", "raise", "FileOnlyActionError", "(", "arg_0", ")", "except", "Exception", "as", "e", ":", "reraise", "(", "e", ",", "'While executing filesystem.Func(%s)'", "%", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    '''\n    Deletes the given local filename.\n\n    .. note:: If file doesn't exist this method has no effect.\n\n    :param unicode target_filename:\n        A local filename\n\n    :raises NotImplementedForRemotePathError:\n        If trying to delete a non-local path\n\n    :raises FileOnlyActionError:\n        Raised when filename refers to a directory.\n    '''\n    _AssertIsLocal(arg_0)\n\n    try:\n        if IsLink(arg_0):\n            DeleteLink(arg_0)\n        elif IsFile(arg_0):\n            os.remove(arg_0)\n        elif IsDir(arg_0):\n            from ._exceptions import FileOnlyActionError\n            raise FileOnlyActionError(arg_0)\n    except Exception as e:\n        reraise(e, 'While executing filesystem.Func(%s)' % (arg_0))", "path": "zerotk/easyfs/_easyfs.py", "identifier": "DeleteFile", "docstring": "Deletes the given local filename.\n\n    .. note:: If file doesn't exist this method has no effect.\n\n    :param unicode target_filename:\n        A local filename\n\n    :raises NotImplementedForRemotePathError:\n        If trying to delete a non-local path\n\n    :raises FileOnlyActionError:\n        Raised when filename refers to a directory.", "docstring_tokens": ["Deletes", "the", "given", "local", "filename", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 258100}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L2087-L2118", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Verifies an RSASSA-PKCS-v1.5 signature.", "language": "python", "parameters": "(certificate_or_public_key, signature, data, hash_algorithm)", "return_statement": "return _verify(certificate_or_public_key, signature, data, hash_algorithm)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ".", "algorithm", "!=", "'rsa'", ":", "raise", "ValueError", "(", "'The key specified is not an RSA public key'", ")", "return", "_verify", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Verifies an RSASSA-PKCS-v1.5 signature.\n\n    When the hash_algorithm is \"raw\", the operation is identical to RSA\n    public key decryption. That is: the data is not hashed and no ASN.1\n    structure with an algorithm identifier of the hash algorithm is placed in\n    the encrypted byte string.\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to verify the signature with\n\n    :param signature:\n        A byte string of the signature to verify\n\n    :param data:\n        A byte string of the data the signature is for\n\n    :param hash_algorithm:\n        A unicode string of \"md5\", \"sha1\", \"sha256\", \"sha384\", \"sha512\" or \"raw\"\n\n    :raises:\n        oscrypto.errors.SignatureError - when the signature is determined to be invalid\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library\n    \"\"\"\n\n    if arg_0.algorithm != 'rsa':\n        raise ValueError('The key specified is not an RSA public key')\n\n    return _verify(arg_0, arg_1, arg_2, arg_3)", "path": "oscrypto/_win/asymmetric.py", "identifier": "rsa_pkcs1v15_verify", "docstring": "Verifies an RSASSA-PKCS-v1.5 signature.\n\n    When the hash_algorithm is \"raw\", the operation is identical to RSA\n    public key decryption. That is: the data is not hashed and no ASN.1\n    structure with an algorithm identifier of the hash algorithm is placed in\n    the encrypted byte string.\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to verify the signature with\n\n    :param signature:\n        A byte string of the signature to verify\n\n    :param data:\n        A byte string of the data the signature is for\n\n    :param hash_algorithm:\n        A unicode string of \"md5\", \"sha1\", \"sha256\", \"sha384\", \"sha512\" or \"raw\"\n\n    :raises:\n        oscrypto.errors.SignatureError - when the signature is determined to be invalid\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library", "docstring_tokens": ["Verifies", "an", "RSASSA", "-", "PKCS", "-", "v1", ".", "5", "signature", "."], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 258101}
{"url": "https://github.com/pydron/anycall/blob/43add96660258a14b24aa8e8413dffb1741b72d7/anycall/packetprotocol.py#L73-L102", "sha": "43add96660258a14b24aa8e8413dffb1741b72d7", "docstring_summary": "Do not overwrite this method. Instead implement `on_...` methods for the\n        registered typenames to handle incomming packets.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_unprocessed_data", ".", "enqueue", "(", "arg_1", ")", "while", "True", ":", "if", "len", "(", "arg_0", ".", "_unprocessed_data", ")", "<", "arg_0", ".", "_header", ".", "size", ":", "return", "arg_2", "=", "arg_0", ".", "_unprocessed_data", ".", "peek", "(", "arg_0", ".", "_header", ".", "size", ")", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_header", ".", "unpack", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_header", ".", "size", "+", "arg_3", "if", "len", "(", "arg_0", ".", "_unprocessed_data", ")", "<", "arg_5", ":", "return", "arg_0", ".", "_unprocessed_data", ".", "drop", "(", "arg_0", ".", "_header", ".", "size", ")", "arg_6", "=", "arg_0", ".", "_unprocessed_data", ".", "dequeue", "(", "arg_3", ")", "arg_0", ".", "_start_receive", "=", "None", "arg_8", "=", "arg_0", ".", "_type_register", ".", "get", "(", "arg_4", ",", "None", ")", "if", "arg_8", "is", "None", ":", "arg_0", ".", "on_unregistered_type", "(", "arg_4", ",", "arg_6", ")", "else", ":", "arg_0", ".", "packet_received", "(", "arg_8", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Do not overwrite this method. Instead implement `on_...` methods for the\n        registered typenames to handle incomming packets.\n        \"\"\"\n        \n        arg_0._unprocessed_data.enqueue(arg_1)\n        \n        \n        while True:\n            if len(arg_0._unprocessed_data) < arg_0._header.size:\n                return # not yet enough data\n            \n            arg_2 = arg_0._unprocessed_data.peek(arg_0._header.size)\n            arg_3, arg_4 = arg_0._header.unpack(arg_2)\n            arg_5 = arg_0._header.size + arg_3\n            \n            if len(arg_0._unprocessed_data) < arg_5:\n                return # not yet enough data\n            \n            arg_0._unprocessed_data.drop(arg_0._header.size)\n            arg_6 = arg_0._unprocessed_data.dequeue(arg_3)\n            \n            arg_0._start_receive = None\n            \n            arg_8 = arg_0._type_register.get(arg_4, None)\n            if arg_8 is None:\n                arg_0.on_unregistered_type(arg_4, arg_6)\n            else:\n                arg_0.packet_received(arg_8, arg_6)", "path": "anycall/packetprotocol.py", "identifier": "PacketProtocol.dataReceived", "docstring": "Do not overwrite this method. Instead implement `on_...` methods for the\n        registered typenames to handle incomming packets.", "docstring_tokens": ["Do", "not", "overwrite", "this", "method", ".", "Instead", "implement", "on_", "...", "methods", "for", "the", "registered", "typenames", "to", "handle", "incomming", "packets", "."], "nwo": "pydron/anycall", "score": 0.09252797783733271, "idx": 258102}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L683-L711", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return Affine and shape of combined tiles.", "language": "python", "parameters": "(tiles)", "return_statement": "return (\n        Affine(pixel_size, 0, left, 0, -pixel_size, top),\n        Shape(\n            width=int(round((right - left) / pixel_size, 0)),\n            height=int(round((top - bottom) / pixel_size, 0)),\n        )\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "raise", "TypeError", "(", "\"no tiles provided\"", ")", "arg_1", "=", "arg_0", "[", "0", "]", ".", "pixel_x_size", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "(", "min", "(", "[", "t", ".", "left", "for", "t", "in", "arg_0", "]", ")", ",", "min", "(", "[", "t", ".", "bottom", "for", "t", "in", "arg_0", "]", ")", ",", "max", "(", "[", "t", ".", "right", "for", "t", "in", "arg_0", "]", ")", ",", "max", "(", "[", "t", ".", "top", "for", "t", "in", "arg_0", "]", ")", ",", ")", "return", "(", "Affine", "(", "arg_1", ",", "0", ",", "arg_2", ",", "0", ",", "-", "arg_1", ",", "arg_5", ")", ",", "Shape", "(", "width", "=", "int", "(", "round", "(", "(", "arg_4", "-", "arg_2", ")", "/", "arg_1", ",", "0", ")", ")", ",", "height", "=", "int", "(", "round", "(", "(", "arg_5", "-", "arg_3", ")", "/", "arg_1", ",", "0", ")", ")", ",", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Return Affine and shape of combined tiles.\n\n    Parameters\n    ----------\n    tiles : iterable\n        an iterable containing BufferedTiles\n\n    Returns\n    -------\n    Affine, Shape\n    \"\"\"\n    if not arg_0:\n        raise TypeError(\"no tiles provided\")\n    arg_1 = arg_0[0].pixel_x_size\n    arg_2, arg_3, arg_4, arg_5 = (\n        min([t.left for t in arg_0]),\n        min([t.bottom for t in arg_0]),\n        max([t.right for t in arg_0]),\n        max([t.top for t in arg_0]),\n    )\n    return (\n        Affine(arg_1, 0, arg_2, 0, -arg_1, arg_5),\n        Shape(\n            width=int(round((arg_4 - arg_2) / arg_1, 0)),\n            height=int(round((arg_5 - arg_3) / arg_1, 0)),\n        )\n    )", "path": "mapchete/io/raster.py", "identifier": "tiles_to_affine_shape", "docstring": "Return Affine and shape of combined tiles.\n\n    Parameters\n    ----------\n    tiles : iterable\n        an iterable containing BufferedTiles\n\n    Returns\n    -------\n    Affine, Shape", "docstring_tokens": ["Return", "Affine", "and", "shape", "of", "combined", "tiles", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 258103}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/lms.py#L412-L440", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Retrieve the grade for the given username for the given course_id.", "language": "python", "parameters": "(self, course_id, username)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "client", ".", "courses", "(", "arg_1", ")", ".", "get", "(", "arg_2", "=", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", ".", "get", "(", "'username'", ")", "==", "arg_2", ":", "return", "arg_4", "raise", "HttpNotFoundError", "(", "'No grade record found for course={}, username={}'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Retrieve the grade for the given username for the given course_id.\n\n        Args:\n        * ``course_id`` (str): The string value of the course's unique identifier\n        * ``username`` (str): The username ID identifying the user for which to retrieve the grade.\n\n        Raises:\n\n        HttpNotFoundError if no grade found for the given user+course.\n\n        Returns:\n\n        a dict containing:\n\n        * ``username``: A string representation of a user's username passed in the request.\n        * ``course_key``: A string representation of a Course ID.\n        * ``passed``: Boolean representing whether the course has been passed according the course's grading policy.\n        * ``percent``: A float representing the overall grade for the course\n        * ``letter_grade``: A letter grade as defined in grading_policy (e.g. 'A' 'B' 'C' for 6.002x) or None\n\n        \"\"\"\n        arg_3 = arg_0.client.courses(arg_1).get(arg_2=arg_2)\n        for arg_4 in arg_3:\n            if arg_4.get('username') == arg_2:\n                return arg_4\n\n        raise HttpNotFoundError('No grade record found for course={}, username={}'.format(arg_1, arg_2))", "path": "enterprise/api_client/lms.py", "identifier": "GradesApiClient.get_course_grade", "docstring": "Retrieve the grade for the given username for the given course_id.\n\n        Args:\n        * ``course_id`` (str): The string value of the course's unique identifier\n        * ``username`` (str): The username ID identifying the user for which to retrieve the grade.\n\n        Raises:\n\n        HttpNotFoundError if no grade found for the given user+course.\n\n        Returns:\n\n        a dict containing:\n\n        * ``username``: A string representation of a user's username passed in the request.\n        * ``course_key``: A string representation of a Course ID.\n        * ``passed``: Boolean representing whether the course has been passed according the course's grading policy.\n        * ``percent``: A float representing the overall grade for the course\n        * ``letter_grade``: A letter grade as defined in grading_policy (e.g. 'A' 'B' 'C' for 6.002x) or None", "docstring_tokens": ["Retrieve", "the", "grade", "for", "the", "given", "username", "for", "the", "given", "course_id", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258104}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L130-L148", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Solidity source code snippet related to `asm_pos` evm bytecode offset.\n            If runtime is False, initialization bytecode source map is used", "language": "python", "parameters": "(self, asm_offset, runtime=True)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "get_srcmap", "(", "arg_2", ")", "try", ":", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_6", "=", "arg_3", "[", "arg_1", "]", "except", "KeyError", ":", "return", "''", "arg_7", "=", "''", "arg_8", "=", "arg_0", ".", "source_code", "[", ":", "arg_4", "]", ".", "count", "(", "'\\n'", ")", "+", "1", "arg_9", "=", "arg_0", ".", "source_code", "[", "arg_4", ":", "arg_4", "+", "arg_5", "]", "for", "arg_10", "in", "arg_9", ".", "split", "(", "'\\n'", ")", ":", "arg_7", "+=", "'    %s  %s\\n'", "%", "(", "arg_8", ",", "arg_10", ")", "arg_8", "+=", "1", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\" Solidity source code snippet related to `asm_pos` evm bytecode offset.\n            If runtime is False, initialization bytecode source map is used\n        \"\"\"\n        arg_3 = arg_0.get_srcmap(arg_2)\n\n        try:\n            arg_4, arg_5, arg_6, arg_6 = arg_3[arg_1]\n        except KeyError:\n            #asm_offset pointing outside the known bytecode\n            return ''\n\n        arg_7 = ''\n        arg_8 = arg_0.source_code[:arg_4].count('\\n') + 1\n        arg_9 = arg_0.source_code[arg_4:arg_4 + arg_5]\n        for arg_10 in arg_9.split('\\n'):\n            arg_7 += '    %s  %s\\n' % (arg_8, arg_10)\n            arg_8 += 1\n        return arg_7", "path": "manticore/ethereum/solidity.py", "identifier": "SolidityMetadata.get_source_for", "docstring": "Solidity source code snippet related to `asm_pos` evm bytecode offset.\n            If runtime is False, initialization bytecode source map is used", "docstring_tokens": ["Solidity", "source", "code", "snippet", "related", "to", "asm_pos", "evm", "bytecode", "offset", ".", "If", "runtime", "is", "False", "initialization", "bytecode", "source", "map", "is", "used"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258105}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L784-L841", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Search namespaces with wildcards for objects.", "language": "python", "parameters": "(self,pattern,ns_table,ns_search=[],\n                ignore_case=False,show_all=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "[", "]", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "'all'", "arg_7", "=", "''", "arg_8", "=", "arg_1", ".", "split", "(", ")", "arg_9", "=", "len", "(", "arg_8", ")", "if", "arg_9", "==", "1", ":", "arg_7", "=", "arg_8", "[", "0", "]", "elif", "arg_9", "==", "2", ":", "arg_7", ",", "arg_6", "=", "arg_8", "else", ":", "raise", "ValueError", "(", "'invalid argument string for Func: <%s>'", "%", "arg_1", ")", "for", "arg_10", "in", "arg_3", ":", "if", "arg_10", "not", "in", "arg_2", ":", "raise", "ValueError", "(", "'invalid namespace <%s>. Valid names: %s'", "%", "(", "arg_10", ",", "arg_2", ".", "keys", "(", ")", ")", ")", "arg_11", ",", "arg_12", "=", "set", "(", ")", ",", "set", "(", ")", "for", "arg_13", "in", "arg_3", ":", "arg_14", "=", "arg_2", "[", "arg_13", "]", "if", "id", "(", "arg_14", ")", "in", "arg_12", ":", "continue", "arg_12", ".", "add", "(", "id", "(", "arg_14", ")", ")", "arg_15", "=", "list_namespace", "(", "arg_14", ",", "arg_6", ",", "arg_7", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_11", ".", "update", "(", "arg_15", ")", "page", ".", "page", "(", "'\\n'", ".", "join", "(", "sorted", "(", "arg_11", ")", ")", ")"], "function": "def Func(arg_0,arg_1,arg_2,arg_3=[],\n                arg_4=False,arg_5=False):\n        \"\"\"Search namespaces with wildcards for objects.\n\n        Arguments:\n\n        - pattern: string containing shell-like wildcards to use in namespace\n        searches and optionally a type specification to narrow the search to\n        objects of that type.\n\n        - ns_table: dict of name->namespaces for search.\n\n        Optional arguments:\n\n          - ns_search: list of namespace names to include in search.\n\n          - ignore_case(False): make the search case-insensitive.\n\n          - show_all(False): show all names, including those starting with\n          underscores.\n        \"\"\"\n        #print 'ps pattern:<%r>' % pattern # dbg\n\n        # defaults\n        arg_6 = 'all'\n        arg_7 = ''\n\n        arg_8 = arg_1.split()\n        arg_9  =  len(arg_8)\n        if arg_9 == 1:\n            # Only filter pattern given\n            arg_7 = arg_8[0]\n        elif arg_9 == 2:\n            # Both filter and type specified\n            arg_7,arg_6 = arg_8\n        else:\n            raise ValueError('invalid argument string for Func: <%s>' %\n                             arg_1)\n\n        # filter search namespaces\n        for arg_10 in arg_3:\n            if arg_10 not in arg_2:\n                raise ValueError('invalid namespace <%s>. Valid names: %s' %\n                                 (arg_10,arg_2.keys()))\n\n        #print 'type_pattern:',type_pattern # dbg\n        arg_11, arg_12 = set(), set()\n        for arg_13 in arg_3:\n            arg_14 = arg_2[arg_13]\n            # Normally, locals and globals are the same, so we just check one.\n            if id(arg_14) in arg_12:\n                continue\n            arg_12.add(id(arg_14))\n            arg_15 = list_namespace(arg_14, arg_6, arg_7,\n                                    arg_4=arg_4, arg_5=arg_5)\n            arg_11.update(arg_15)\n\n        page.page('\\n'.join(sorted(arg_11)))", "path": "environment/lib/python2.7/site-packages/IPython/core/oinspect.py", "identifier": "Inspector.psearch", "docstring": "Search namespaces with wildcards for objects.\n\n        Arguments:\n\n        - pattern: string containing shell-like wildcards to use in namespace\n        searches and optionally a type specification to narrow the search to\n        objects of that type.\n\n        - ns_table: dict of name->namespaces for search.\n\n        Optional arguments:\n\n          - ns_search: list of namespace names to include in search.\n\n          - ignore_case(False): make the search case-insensitive.\n\n          - show_all(False): show all names, including those starting with\n          underscores.", "docstring_tokens": ["Search", "namespaces", "with", "wildcards", "for", "objects", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258106}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/scale.py#L232-L257", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Map values to a discrete palette", "language": "python", "parameters": "(cls, x, palette, limits, na_value=None)", "return_statement": "return pal", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "len", "(", "arg_3", ")", "arg_6", "=", "arg_2", "(", "arg_5", ")", "[", "match", "(", "arg_1", ",", "arg_3", ")", "]", "try", ":", "arg_6", "[", "arg_7", ".", "isnull", "(", "arg_1", ")", "]", "=", "arg_4", "except", "TypeError", ":", "arg_6", "=", "[", "v", "if", "not", "arg_7", ".", "isnull", "(", "v", ")", "else", "arg_4", "for", "v", "in", "arg_6", "]", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"\n        Map values to a discrete palette\n\n        Parameters\n        ----------\n        palette : callable ``f(x)``\n            palette to use\n        x : array_like\n            Continuous values to scale\n        na_value : object\n            Value to use for missing values.\n\n        Returns\n        -------\n        out : array_like\n            Values Funcped onto a palette\n        \"\"\"\n        arg_5 = len(arg_3)\n        arg_6 = arg_2(arg_5)[match(arg_1, arg_3)]\n        try:\n            arg_6[arg_7.isnull(arg_1)] = arg_4\n        except TypeError:\n            arg_6 = [v if not arg_7.isnull(v) else arg_4 for v in arg_6]\n\n        return arg_6", "path": "mizani/scale.py", "identifier": "scale_discrete.map", "docstring": "Map values to a discrete palette\n\n        Parameters\n        ----------\n        palette : callable ``f(x)``\n            palette to use\n        x : array_like\n            Continuous values to scale\n        na_value : object\n            Value to use for missing values.\n\n        Returns\n        -------\n        out : array_like\n            Values mapped onto a palette", "docstring_tokens": ["Map", "values", "to", "a", "discrete", "palette"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 258107}
{"url": "https://github.com/asciimoo/searx/blob/a84caa22cf947e973c10aa968d35fb2bdda6d048/searx/utils.py#L190-L195", "sha": "a84caa22cf947e973c10aa968d35fb2bdda6d048", "docstring_summary": "Returns available themes list.", "language": "python", "parameters": "(templates_path)", "return_statement": "return themes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "listdir", "(", "arg_0", ")", "if", "'__common__'", "in", "arg_1", ":", "arg_1", ".", "remove", "(", "'__common__'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Returns available themes list.\"\"\"\n    arg_1 = os.listdir(arg_0)\n    if '__common__' in arg_1:\n        arg_1.remove('__common__')\n    return arg_1", "path": "searx/utils.py", "identifier": "get_themes", "docstring": "Returns available themes list.", "docstring_tokens": ["Returns", "available", "themes", "list", "."], "nwo": "asciimoo/searx", "score": 0.9938352485388113, "idx": 258108}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/multi.py#L90-L100", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Adds one encoder.", "language": "python", "parameters": "(self, name, encoder)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "encoders", ".", "append", "(", "(", "arg_1", ",", "arg_2", ",", "arg_0", ".", "width", ")", ")", "for", "arg_3", "in", "arg_2", ".", "getDescription", "(", ")", ":", "arg_0", ".", "description", ".", "append", "(", "(", "arg_3", "[", "0", "]", ",", "arg_3", "[", "1", "]", "+", "arg_0", ".", "width", ")", ")", "arg_0", ".", "width", "+=", "arg_2", ".", "getWidth", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Adds one encoder.\n\n    :param name: (string) name of encoder, should be unique\n    :param encoder: (:class:`.Encoder`) the encoder to add\n    \"\"\"\n    arg_0.encoders.append((arg_1, arg_2, arg_0.width))\n    for arg_3 in arg_2.getDescription():\n      arg_0.description.append((arg_3[0], arg_3[1] + arg_0.width))\n    arg_0.width += arg_2.getWidth()", "path": "src/nupic/encoders/multi.py", "identifier": "MultiEncoder.addEncoder", "docstring": "Adds one encoder.\n\n    :param name: (string) name of encoder, should be unique\n    :param encoder: (:class:`.Encoder`) the encoder to add", "docstring_tokens": ["Adds", "one", "encoder", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258109}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/latent_dirichlet_allocation_edward2.py#L194-L223", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates the variational distribution for LDA.", "language": "python", "parameters": "(activation, num_topics, layer_sizes)", "return_statement": "return lda_variational", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "tf", ".", "keras", ".", "Sequential", "(", ")", "for", "arg_4", "in", "arg_2", ":", "arg_3", ".", "add", "(", "tf", ".", "keras", ".", "layers", ".", "Dense", "(", "arg_4", ",", "arg_0", "=", "arg_0", ",", "kernel_initializer", "=", "tf", ".", "compat", ".", "v1", ".", "glorot_normal_initializer", "(", ")", ")", ")", "arg_3", ".", "add", "(", "tf", ".", "keras", ".", "layers", ".", "Dense", "(", "arg_1", ",", "arg_0", "=", "tf", ".", "nn", ".", "softplus", ",", "kernel_initializer", "=", "tf", ".", "compat", ".", "v1", ".", "glorot_normal_initializer", "(", ")", ")", ")", "def", "lda_variational", "(", "arg_5", ")", ":", "arg_6", "=", "_clip_dirichlet_parameters", "(", "arg_3", "(", "arg_5", ")", ")", "return", "ed", ".", "Dirichlet", "(", "arg_6", "=", "arg_6", ",", "name", "=", "\"topics_posterior\"", ")", "return", "lda_variational"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Creates the variational distribution for LDA.\n\n  Args:\n    activation: Activation function to use.\n    num_topics: The number of topics.\n    layer_sizes: The number of hidden units per layer in the encoder.\n\n  Returns:\n    lda_variational: A function that takes a bag-of-words Tensor as\n      input and returns a distribution over topics.\n  \"\"\"\n  arg_3 = tf.keras.Sequential()\n  for arg_4 in arg_2:\n    arg_3.add(\n        tf.keras.layers.Dense(\n            arg_4,\n            arg_0=arg_0,\n            kernel_initializer=tf.compat.v1.glorot_normal_initializer()))\n  arg_3.add(\n      tf.keras.layers.Dense(\n          arg_1,\n          arg_0=tf.nn.softplus,\n          kernel_initializer=tf.compat.v1.glorot_normal_initializer()))\n\n  def lda_variational(arg_5):\n    arg_6 = _clip_dirichlet_parameters(arg_3(arg_5))\n    return ed.Dirichlet(arg_6=arg_6, name=\"topics_posterior\")\n\n  return lda_variational", "path": "tensorflow_probability/examples/latent_dirichlet_allocation_edward2.py", "identifier": "make_lda_variational", "docstring": "Creates the variational distribution for LDA.\n\n  Args:\n    activation: Activation function to use.\n    num_topics: The number of topics.\n    layer_sizes: The number of hidden units per layer in the encoder.\n\n  Returns:\n    lda_variational: A function that takes a bag-of-words Tensor as\n      input and returns a distribution over topics.", "docstring_tokens": ["Creates", "the", "variational", "distribution", "for", "LDA", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258110}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/record_sensor.py#L507-L533", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Converts all of the non-numeric fields from spatialOutput and temporalOutput\n    into their scalar equivalents and records them in the output dictionary.", "language": "python", "parameters": "(self, spatialOutput, temporalOutput, output)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "encoder", ".", "getEncoderList", "(", ")", "arg_5", "=", "arg_0", ".", "encoder", ".", "getDecoderOutputFieldTypes", "(", ")", "for", "arg_6", ",", "(", "arg_7", ",", "arg_8", ")", "in", "enumerate", "(", "zip", "(", "arg_4", ",", "arg_5", ")", ")", ":", "arg_9", "=", "arg_1", "[", "arg_6", "]", "arg_10", "=", "arg_2", "[", "arg_6", "]", "if", "arg_8", "!=", "FieldMetaType", ".", "integer", "and", "arg_8", "!=", "FieldMetaType", ".", "float", ":", "arg_9", "=", "arg_7", ".", "getScalars", "(", "arg_9", ")", "[", "0", "]", "arg_10", "=", "arg_7", ".", "getScalars", "(", "arg_10", ")", "[", "0", "]", "assert", "isinstance", "(", "arg_9", ",", "(", "float", ",", "int", ")", ")", "assert", "isinstance", "(", "arg_10", ",", "(", "float", ",", "int", ")", ")", "arg_3", "[", "'spatialTopDownOut'", "]", "[", "arg_6", "]", "=", "arg_9", "arg_3", "[", "'temporalTopDownOut'", "]", "[", "arg_6", "]", "=", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Converts all of the non-numeric fields from spatialOutput and temporalOutput\n    into their scalar equivalents and records them in the output dictionary.\n\n    :param spatialOutput: The results of topDownCompute() for the spatial input.\n    :param temporalOutput: The results of topDownCompute() for the temporal\n      input.\n    :param output: The main dictionary of outputs passed to compute(). It is\n      expected to have keys 'spatialTopDownOut' and 'temporalTopDownOut' that\n      are mapped to numpy arrays.\n    \"\"\"\n    arg_4 = arg_0.encoder.getEncoderList()\n    arg_5 = arg_0.encoder.getDecoderOutputFieldTypes()\n    for arg_6, (arg_7, arg_8) in enumerate(zip(arg_4, arg_5)):\n      arg_9 = arg_1[arg_6]\n      arg_10 = arg_2[arg_6]\n\n      if arg_8 != FieldMetaType.integer and arg_8 != FieldMetaType.float:\n        # TODO: Make sure that this doesn't modify any state\n        arg_9 = arg_7.getScalars(arg_9)[0]\n        arg_10 = arg_7.getScalars(arg_10)[0]\n\n      assert isinstance(arg_9, (float, int))\n      assert isinstance(arg_10, (float, int))\n      arg_3['spatialTopDownOut'][arg_6] = arg_9\n      arg_3['temporalTopDownOut'][arg_6] = arg_10", "path": "src/nupic/regions/record_sensor.py", "identifier": "RecordSensor._convertNonNumericData", "docstring": "Converts all of the non-numeric fields from spatialOutput and temporalOutput\n    into their scalar equivalents and records them in the output dictionary.\n\n    :param spatialOutput: The results of topDownCompute() for the spatial input.\n    :param temporalOutput: The results of topDownCompute() for the temporal\n      input.\n    :param output: The main dictionary of outputs passed to compute(). It is\n      expected to have keys 'spatialTopDownOut' and 'temporalTopDownOut' that\n      are mapped to numpy arrays.", "docstring_tokens": ["Converts", "all", "of", "the", "non", "-", "numeric", "fields", "from", "spatialOutput", "and", "temporalOutput", "into", "their", "scalar", "equivalents", "and", "records", "them", "in", "the", "output", "dictionary", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258111}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L127-L183", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Load the passed in assembly and create a branch. Copy it\n    to a new assembly, and also write out the appropriate params.txt", "language": "python", "parameters": "(args, parsedict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getassembly", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "branch", "arg_4", "=", "arg_3", "[", "0", "]", "if", "arg_4", ".", "endswith", "(", "\".txt\"", ")", ":", "arg_4", "=", "arg_4", "[", ":", "-", "4", "]", "if", "len", "(", "arg_3", ")", ">", "1", ":", "if", "any", "(", "[", "arg_5", ".", "stats", ".", "state", "==", "6", "for", "arg_5", "in", "arg_2", ".", "samples", ".", "values", "(", ")", "]", ")", ":", "pass", "arg_6", "=", "arg_3", "[", "1", ":", "]", "if", "arg_3", "[", "1", "]", "==", "\"-\"", ":", "arg_7", "=", "[", "arg_8", "for", "arg_8", "in", "arg_6", "[", "1", ":", "]", "if", "arg_8", "not", "in", "arg_2", ".", "samples", ".", "keys", "(", ")", "]", "if", "any", "(", "arg_7", ")", ":", "raise", "IPyradWarningExit", "(", "\"\\                    \\n  Failed: unrecognized names requested, check spelling:\\n  {}\"", ".", "format", "(", "\"\\n  \"", ".", "join", "(", "[", "arg_8", "for", "arg_8", "in", "arg_7", "]", ")", ")", ")", "print", "(", "\"  dropping {} samples\"", ".", "format", "(", "len", "(", "arg_6", ")", "-", "1", ")", ")", "arg_6", "=", "list", "(", "set", "(", "arg_2", ".", "samples", ".", "keys", "(", ")", ")", "-", "set", "(", "arg_6", ")", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_3", "[", "1", "]", ")", ":", "arg_9", "=", "arg_2", ".", "branch", "(", "arg_4", ",", "infile", "=", "arg_3", "[", "1", "]", ")", "else", ":", "arg_9", "=", "arg_2", ".", "branch", "(", "arg_4", ",", "arg_6", ")", "else", ":", "arg_9", "=", "arg_2", ".", "branch", "(", "arg_4", ",", "None", ")", "print", "(", "\"  creating a new branch called '{}' with {} Samples\"", ".", "format", "(", "arg_9", ".", "name", ",", "len", "(", "arg_9", ".", "samples", ")", ")", ")", "print", "(", "\"  writing new params file to {}\"", ".", "format", "(", "\"params-\"", "+", "arg_9", ".", "name", "+", "\".txt\\n\"", ")", ")", "arg_9", ".", "write_params", "(", "\"params-\"", "+", "arg_9", ".", "name", "+", "\".txt\"", ",", "force", "=", "arg_0", ".", "force", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" \n    Load the passed in assembly and create a branch. Copy it\n    to a new assembly, and also write out the appropriate params.txt\n    \"\"\"\n\n    ## Get the current assembly\n    arg_2 = getassembly(arg_0, arg_1)\n\n\n    ## get arguments to branch command\n    arg_3 = arg_0.branch\n\n    ## get new name, trim off .txt if it was accidentally added\n    arg_4 = arg_3[0]\n    if arg_4.endswith(\".txt\"):\n        arg_4 = arg_4[:-4]\n\n    ## look for subsamples\n    if len(arg_3) > 1:\n        ## Branching and subsampling at step 6 is a bad idea, it messes up\n        ## indexing into the hdf5 cluster file. Warn against this.\n        if any([arg_5.stats.state == 6 for arg_5 in arg_2.samples.values()]):\n            pass\n            ## TODODODODODO\n            #print(\"wat\")\n\n        ## are we removing or keeping listed samples?\n        arg_6 = arg_3[1:]\n\n        ## drop the matching samples\n        if arg_3[1] == \"-\":\n            ## check drop names\n            arg_7 = [arg_8 for arg_8 in arg_6[1:] if arg_8 not in arg_2.samples.keys()]\n            if any(arg_7):\n                raise IPyradWarningExit(\"\\\n                    \\n  Failed: unrecognized names requested, check spelling:\\n  {}\"\\\n                    .format(\"\\n  \".join([arg_8 for arg_8 in arg_7])))\n            print(\"  dropping {} samples\".format(len(arg_6)-1))\n            arg_6 = list(set(arg_2.samples.keys()) - set(arg_6))\n\n        ## If the arg after the new param name is a file that exists\n        if os.path.exists(arg_3[1]):\n            arg_9 = arg_2.branch(arg_4, infile=arg_3[1])\n        else:\n            arg_9 = arg_2.branch(arg_4, arg_6)\n\n    ## keeping all samples\n    else:\n        arg_9 = arg_2.branch(arg_4, None)\n\n    print(\"  creating a new branch called '{}' with {} Samples\".\\\n             format(arg_9.name, len(arg_9.samples)))\n\n    print(\"  writing new params file to {}\"\\\n            .format(\"params-\"+arg_9.name+\".txt\\n\"))\n    arg_9.write_params(\"params-\"+arg_9.name+\".txt\", force=arg_0.force)", "path": "ipyrad/__main__.py", "identifier": "branch_assembly", "docstring": "Load the passed in assembly and create a branch. Copy it\n    to a new assembly, and also write out the appropriate params.txt", "docstring_tokens": ["Load", "the", "passed", "in", "assembly", "and", "create", "a", "branch", ".", "Copy", "it", "to", "a", "new", "assembly", "and", "also", "write", "out", "the", "appropriate", "params", ".", "txt"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258112}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/zkstatemanager.py#L255-L279", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to get packing_plan with\n    a callback. The future watch is placed\n    only if isWatching is True.", "language": "python", "parameters": "(self, topologyName, callback, isWatching)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_packing_plan_path", "(", "arg_1", ")", "if", "arg_3", ":", "LOG", ".", "info", "(", "\"Adding data watch for path: \"", "+", "arg_4", ")", "@", "arg_0", ".", "client", ".", "DataWatch", "(", "arg_4", ")", "def", "watch_packing_plan", "(", "arg_5", ",", "arg_6", ")", ":", "if", "arg_5", ":", "arg_7", "=", "PackingPlan", "(", ")", "arg_7", ".", "ParseFromString", "(", "arg_5", ")", "arg_2", "(", "arg_7", ")", "else", ":", "arg_2", "(", "None", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Helper function to get packing_plan with\n    a callback. The future watch is placed\n    only if isWatching is True.\n    \"\"\"\n    arg_4 = arg_0.get_packing_plan_path(arg_1)\n    if arg_3:\n      LOG.info(\"Adding data watch for path: \" + arg_4)\n\n    # pylint: disable=unused-argument,unused-variable\n    @arg_0.client.DataWatch(arg_4)\n    def watch_packing_plan(arg_5, arg_6):\n      \"\"\" watch the packing plan for updates \"\"\"\n      if arg_5:\n        arg_7 = PackingPlan()\n        arg_7.ParseFromString(arg_5)\n        arg_2(arg_7)\n      else:\n        arg_2(None)\n\n      # Returning False will result in no future watches\n      # being triggered. If isWatching is True, then\n      # the future watches will be triggered.\n      return arg_3", "path": "heron/statemgrs/src/python/zkstatemanager.py", "identifier": "ZkStateManager._get_packing_plan_with_watch", "docstring": "Helper function to get packing_plan with\n    a callback. The future watch is placed\n    only if isWatching is True.", "docstring_tokens": ["Helper", "function", "to", "get", "packing_plan", "with", "a", "callback", ".", "The", "future", "watch", "is", "placed", "only", "if", "isWatching", "is", "True", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258113}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/imports.py#L791-L813", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check relative import. node is either an Import or From node, modname\n        the imported module name.", "language": "python", "parameters": "(\n        self, modnode, importnode, importedmodnode, importedasname\n    )", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "not", "arg_0", ".", "linter", ".", "is_message_enabled", "(", "\"relative-import\"", ")", ":", "return", "None", "if", "arg_3", ".", "file", "is", "None", ":", "return", "False", "if", "arg_1", "is", "arg_3", ":", "return", "False", "if", "arg_1", ".", "absolute_import_activated", "(", ")", "or", "getattr", "(", "arg_2", ",", "\"level\"", ",", "None", ")", ":", "return", "False", "if", "arg_3", ".", "name", "!=", "arg_4", ":", "arg_0", ".", "add_message", "(", "\"relative-import\"", ",", "args", "=", "(", "arg_4", ",", "arg_3", ".", "name", ")", ",", "node", "=", "arg_2", ",", ")", "return", "None", "return", "None"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3, arg_4\n    ):\n        \"\"\"check relative import. node is either an Import or From node, modname\n        the imported module name.\n        \"\"\"\n        if not arg_0.linter.is_message_enabled(\"relative-import\"):\n            return None\n        if arg_3.file is None:\n            return False  # built-in module\n        if arg_1 is arg_3:\n            return False  # module importing itself\n        if arg_1.absolute_import_activated() or getattr(arg_2, \"level\", None):\n            return False\n        if arg_3.name != arg_4:\n            # this must be a relative import...\n            arg_0.add_message(\n                \"relative-import\",\n                args=(arg_4, arg_3.name),\n                node=arg_2,\n            )\n            return None\n        return None", "path": "pylint/checkers/imports.py", "identifier": "ImportsChecker._check_relative_import", "docstring": "check relative import. node is either an Import or From node, modname\n        the imported module name.", "docstring_tokens": ["check", "relative", "import", ".", "node", "is", "either", "an", "Import", "or", "From", "node", "modname", "the", "imported", "module", "name", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258114}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/base.py#L174-L207", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Make the features beat-synchronous.", "language": "python", "parameters": "(self, beat_frames, beat_times, pad)", "return_statement": "return beatsync_feats, beatsync_times", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_1", "is", "None", ":", "return", "None", ",", "None", "arg_4", "=", "librosa", ".", "util", ".", "utils", ".", "sync", "(", "arg_0", ".", "_framesync_features", ".", "T", ",", "arg_1", ",", "arg_3", "=", "arg_3", ")", ".", "T", "arg_5", "=", "np", ".", "copy", "(", "arg_2", ")", "if", "arg_5", ".", "shape", "[", "0", "]", "!=", "arg_4", ".", "shape", "[", "0", "]", ":", "arg_5", "=", "np", ".", "concatenate", "(", "(", "arg_5", ",", "[", "arg_0", ".", "_framesync_times", "[", "-", "1", "]", "]", ")", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Make the features beat-synchronous.\n\n        Parameters\n        ----------\n        beat_frames: np.array\n            The frame indeces of the beat positions.\n        beat_times: np.array\n            The time points of the beat positions (in seconds).\n        pad: boolean\n            If `True`, `beat_frames` is padded to span the full range.\n\n        Returns\n        -------\n        beatsync_feats: np.array\n            The beat-synchronized features.\n            `None` if the beat_frames was `None`.\n        beatsync_times: np.array\n            The beat-synchronized times.\n            `None` if the beat_frames was `None`.\n        \"\"\"\n        if arg_1 is None:\n            return None, None\n\n        # Make beat synchronous\n        arg_4 = librosa.util.utils.sync(arg_0._framesync_features.T,\n                                                 arg_1, arg_3=arg_3).T\n\n        # Assign times (and add last time if padded)\n        arg_5 = np.copy(arg_2)\n        if arg_5.shape[0] != arg_4.shape[0]:\n            arg_5 = np.concatenate((arg_5,\n                                             [arg_0._framesync_times[-1]]))\n        return arg_4, arg_5", "path": "msaf/base.py", "identifier": "Features.compute_beat_sync_features", "docstring": "Make the features beat-synchronous.\n\n        Parameters\n        ----------\n        beat_frames: np.array\n            The frame indeces of the beat positions.\n        beat_times: np.array\n            The time points of the beat positions (in seconds).\n        pad: boolean\n            If `True`, `beat_frames` is padded to span the full range.\n\n        Returns\n        -------\n        beatsync_feats: np.array\n            The beat-synchronized features.\n            `None` if the beat_frames was `None`.\n        beatsync_times: np.array\n            The beat-synchronized times.\n            `None` if the beat_frames was `None`.", "docstring_tokens": ["Make", "the", "features", "beat", "-", "synchronous", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 258115}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/tutorial.py#L82-L88", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "randomly deletes particles and adds 1-px noise for a realistic\n    initial featuring guess", "language": "python", "parameters": "(p, delete_frac=0.1)", "return_statement": "return p[m] + jumble", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.1", ")", ":", "arg_2", "=", "[", "1", "-", "arg_1", ",", "arg_1", "]", "arg_3", "=", "np", ".", "random", ".", "choice", "(", "[", "True", ",", "False", "]", ",", "arg_0", ".", "shape", "[", "0", "]", ",", "arg_0", "=", "arg_2", ")", "arg_4", "=", "np", ".", "random", ".", "randn", "(", "arg_3", ".", "sum", "(", ")", ",", "3", ")", "return", "arg_0", "[", "arg_3", "]", "+", "arg_4"], "function": "def Func(arg_0, arg_1=0.1):\n    \"\"\"randomly deletes particles and adds 1-px noise for a realistic\n    initial featuring guess\"\"\"\n    arg_2 = [1-arg_1, arg_1]\n    arg_3 = np.random.choice([True, False], arg_0.shape[0], arg_0=arg_2)\n    arg_4 = np.random.randn(arg_3.sum(), 3)\n    return arg_0[arg_3] + arg_4", "path": "scripts/tutorial.py", "identifier": "scramble_positions", "docstring": "randomly deletes particles and adds 1-px noise for a realistic\n    initial featuring guess", "docstring_tokens": ["randomly", "deletes", "particles", "and", "adds", "1", "-", "px", "noise", "for", "a", "realistic", "initial", "featuring", "guess"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 258116}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L850-L861", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle disco error response.", "language": "python", "parameters": "(self,stanza)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "error", "(", "arg_1", ".", "get_error", "(", ")", ")", "except", "ProtocolError", ":", "from", ".", ".", "error", "import", "StanzaErrorNode", "arg_0", ".", "error", "(", "StanzaErrorNode", "(", "\"undefined-condition\"", ")", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Handle disco error response.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.stanza.Stanza`\"\"\"\n        try:\n            arg_0.error(arg_1.get_error())\n        except ProtocolError:\n            from ..error import StanzaErrorNode\n            arg_0.error(StanzaErrorNode(\"undefined-condition\"))", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoCacheFetcherBase.__error", "docstring": "Handle disco error response.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.stanza.Stanza`", "docstring_tokens": ["Handle", "disco", "error", "response", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258117}
{"url": "https://github.com/mesos-magellan/pyrallelsa/blob/bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1/pyrallelsa/examples/tsp/__init__.py#L95-L106", "sha": "bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1", "docstring_summary": "Calculates the length of the route.", "language": "python", "parameters": "(self, state=None)", "return_statement": "return e", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_0", ".", "state", "if", "arg_1", "is", "None", "else", "arg_1", "arg_2", "=", "arg_1", "arg_3", "=", "0", "if", "arg_0", ".", "distance_matrix", ":", "for", "arg_4", "in", "range", "(", "len", "(", "arg_2", ")", ")", ":", "arg_3", "+=", "arg_0", ".", "distance_matrix", "[", "\"{},{}\"", ".", "format", "(", "arg_2", "[", "arg_4", "-", "1", "]", ",", "arg_2", "[", "arg_4", "]", ")", "]", "else", ":", "for", "arg_4", "in", "range", "(", "len", "(", "arg_2", ")", ")", ":", "arg_3", "+=", "distance", "(", "arg_0", ".", "cities", "[", "arg_2", "[", "arg_4", "-", "1", "]", "]", ",", "arg_0", ".", "cities", "[", "arg_2", "[", "arg_4", "]", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Calculates the length of the route.\"\"\"\n        arg_1 = arg_0.state if arg_1 is None else arg_1\n        arg_2 = arg_1\n        arg_3 = 0\n        if arg_0.distance_matrix:\n            for arg_4 in range(len(arg_2)):\n                arg_3 += arg_0.distance_matrix[\"{},{}\".format(arg_2[arg_4-1], arg_2[arg_4])]\n        else:\n            for arg_4 in range(len(arg_2)):\n                arg_3 += distance(arg_0.cities[arg_2[arg_4-1]], arg_0.cities[arg_2[arg_4]])\n        return arg_3", "path": "pyrallelsa/examples/tsp/__init__.py", "identifier": "TSPProblem.energy", "docstring": "Calculates the length of the route.", "docstring_tokens": ["Calculates", "the", "length", "of", "the", "route", "."], "nwo": "mesos-magellan/pyrallelsa", "score": 0.0, "idx": 258118}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/contents.py#L358-L386", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the Authentication struct and decode it into\n        its constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "Authentication", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "arg_7", "=", "[", "]", "while", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "CREDENTIAL", ",", "arg_6", ")", ":", "arg_8", "=", "objects", ".", "Credential", "(", ")", "arg_8", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_7", ".", "append", "(", "arg_8", ")", "if", "len", "(", "arg_7", ")", "==", "0", ":", "raise", "ValueError", "(", "\"Authentication encoding missing credentials.\"", ")", "arg_0", ".", "_credentials", "=", "arg_7", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the Authentication struct and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        super(Authentication, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        arg_7 = []\n        while arg_0.is_tag_next(arg_3.Tags.CREDENTIAL, arg_6):\n            arg_8 = objects.Credential()\n            arg_8.Func(arg_6, arg_2=arg_2)\n            arg_7.append(arg_8)\n        if len(arg_7) == 0:\n            raise ValueError(\"Authentication encoding missing credentials.\")\n        arg_0._credentials = arg_7\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/contents.py", "identifier": "Authentication.read", "docstring": "Read the data encoding the Authentication struct and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "Authentication", "struct", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 258119}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L558-L582", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Safely join `directory` and `filename`.", "language": "python", "parameters": "(directory, filename)", "return_statement": "return os.path.join(directory, filename)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "posixpath", ".", "normpath", "(", "arg_1", ")", "for", "arg_2", "in", "_os_alt_seps", ":", "if", "arg_2", "in", "arg_1", ":", "raise", "NotFound", "(", ")", "if", "os", ".", "path", ".", "isabs", "(", "arg_1", ")", "or", "arg_1", "==", "'..'", "or", "arg_1", ".", "startswith", "(", "'../'", ")", ":", "raise", "NotFound", "(", ")", "return", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Safely join `directory` and `filename`.\n\n    Example usage::\n\n        @app.route('/wiki/<path:filename>')\n        def wiki_page(filename):\n            filename = Func(app.config['WIKI_FOLDER'], filename)\n            with open(filename, 'rb') as fd:\n                content = fd.read() # Read and process the file content...\n\n    :param directory: the base directory.\n    :param filename: the untrusted filename relative to that directory.\n    :raises: :class:`~werkzeug.exceptions.NotFound` if the resulting path\n             would fall out of `directory`.\n    \"\"\"\n    arg_1 = posixpath.normpath(arg_1)\n    for arg_2 in _os_alt_seps:\n        if arg_2 in arg_1:\n            raise NotFound()\n    if os.path.isabs(arg_1) or \\\n       arg_1 == '..' or \\\n       arg_1.startswith('../'):\n        raise NotFound()\n    return os.path.join(arg_0, arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py", "identifier": "safe_join", "docstring": "Safely join `directory` and `filename`.\n\n    Example usage::\n\n        @app.route('/wiki/<path:filename>')\n        def wiki_page(filename):\n            filename = safe_join(app.config['WIKI_FOLDER'], filename)\n            with open(filename, 'rb') as fd:\n                content = fd.read() # Read and process the file content...\n\n    :param directory: the base directory.\n    :param filename: the untrusted filename relative to that directory.\n    :raises: :class:`~werkzeug.exceptions.NotFound` if the resulting path\n             would fall out of `directory`.", "docstring_tokens": ["Safely", "join", "directory", "and", "filename", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 258120}
{"url": "https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/master.py#L186-L208", "sha": "5bcd8240d1fc0aa1579e71f2efcab63b4c61c547", "docstring_summary": "Process measurement data.", "language": "python", "parameters": "(self, info, values)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "opendnp3", ".", "ICollectionIndexedBinary", ":", "VisitorIndexedBinary", ",", "opendnp3", ".", "ICollectionIndexedDoubleBitBinary", ":", "VisitorIndexedDoubleBitBinary", ",", "opendnp3", ".", "ICollectionIndexedCounter", ":", "VisitorIndexedCounter", ",", "opendnp3", ".", "ICollectionIndexedFrozenCounter", ":", "VisitorIndexedFrozenCounter", ",", "opendnp3", ".", "ICollectionIndexedAnalog", ":", "VisitorIndexedAnalog", ",", "opendnp3", ".", "ICollectionIndexedBinaryOutputStatus", ":", "VisitorIndexedBinaryOutputStatus", ",", "opendnp3", ".", "ICollectionIndexedAnalogOutputStatus", ":", "VisitorIndexedAnalogOutputStatus", ",", "opendnp3", ".", "ICollectionIndexedTimeAndInterval", ":", "VisitorIndexedTimeAndInterval", "}", "arg_4", "=", "arg_3", "[", "type", "(", "arg_2", ")", "]", "arg_5", "=", "arg_4", "(", ")", "arg_2", ".", "Foreach", "(", "arg_5", ")", "for", "arg_6", ",", "arg_7", "in", "arg_5", ".", "index_and_value", ":", "arg_8", "=", "'SOEHandler.Func {0}\\theaderIndex={1}\\tdata_type={2}\\tindex={3}\\tvalue={4}'", "_log", ".", "debug", "(", "arg_8", ".", "format", "(", "arg_1", ".", "gv", ",", "arg_1", ".", "headerIndex", ",", "type", "(", "arg_2", ")", ".", "__name__", ",", "arg_6", ",", "arg_7", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n            Func measurement data.\n\n        :param info: HeaderInfo\n        :param values: A collection of values received from the Outstation (various data types are possible).\n        \"\"\"\n        arg_3 = {\n            opendnp3.ICollectionIndexedBinary: VisitorIndexedBinary,\n            opendnp3.ICollectionIndexedDoubleBitBinary: VisitorIndexedDoubleBitBinary,\n            opendnp3.ICollectionIndexedCounter: VisitorIndexedCounter,\n            opendnp3.ICollectionIndexedFrozenCounter: VisitorIndexedFrozenCounter,\n            opendnp3.ICollectionIndexedAnalog: VisitorIndexedAnalog,\n            opendnp3.ICollectionIndexedBinaryOutputStatus: VisitorIndexedBinaryOutputStatus,\n            opendnp3.ICollectionIndexedAnalogOutputStatus: VisitorIndexedAnalogOutputStatus,\n            opendnp3.ICollectionIndexedTimeAndInterval: VisitorIndexedTimeAndInterval\n        }\n        arg_4 = arg_3[type(arg_2)]\n        arg_5 = arg_4()\n        arg_2.Foreach(arg_5)\n        for arg_6, arg_7 in arg_5.index_and_value:\n            arg_8 = 'SOEHandler.Func {0}\\theaderIndex={1}\\tdata_type={2}\\tindex={3}\\tvalue={4}'\n            _log.debug(arg_8.format(arg_1.gv, arg_1.headerIndex, type(arg_2).__name__, arg_6, arg_7))", "path": "examples/master.py", "identifier": "SOEHandler.Process", "docstring": "Process measurement data.\n\n        :param info: HeaderInfo\n        :param values: A collection of values received from the Outstation (various data types are possible).", "docstring_tokens": ["Process", "measurement", "data", "."], "nwo": "ChargePoint/pydnp3", "score": 0.6403780379231505, "idx": 258121}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1282-L1322", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Compares and exchanges.", "language": "python", "parameters": "(cpu, dest, src)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "size", "arg_4", "=", "{", "8", ":", "'AL'", ",", "16", ":", "'AX'", ",", "32", ":", "'EAX'", ",", "64", ":", "'RAX'", "}", "[", "arg_3", "]", "arg_5", "=", "arg_0", ".", "read_register", "(", "arg_4", ")", "arg_6", "=", "arg_2", ".", "read", "(", ")", "arg_7", "=", "arg_1", ".", "read", "(", ")", "arg_0", ".", "write_register", "(", "arg_4", ",", "arg_7", ")", "arg_1", ".", "write", "(", "Operators", ".", "ITEBV", "(", "arg_3", ",", "arg_5", "==", "arg_7", ",", "arg_6", ",", "arg_7", ")", ")", "arg_0", ".", "_calculate_CMP_flags", "(", "arg_3", ",", "arg_5", "-", "arg_7", ",", "arg_5", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Compares and exchanges.\n\n        Compares the value in the AL, AX, EAX or RAX register (depending on the\n        size of the operand) with the first operand (destination operand). If\n        the two values are equal, the second operand (source operand) is loaded\n        into the destination operand. Otherwise, the destination operand is\n        loaded into the AL, AX, EAX or RAX register.\n\n        The ZF flag is set if the values in the destination operand and\n        register AL, AX, or EAX are equal; otherwise it is cleared. The CF, PF,\n        AF, SF, and OF flags are set according to the results of the comparison\n        operation::\n\n        (* accumulator  =  AL, AX, EAX or RAX,  depending on whether *)\n        (* a byte, word, a doubleword or a 64bit comparison is being performed*)\n        IF accumulator  ==  DEST\n        THEN\n            ZF  =  1\n            DEST  =  SRC\n        ELSE\n            ZF  =  0\n            accumulator  =  DEST\n        FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.\n        \"\"\"\n        arg_3 = arg_1.size\n        arg_4 = {8: 'AL', 16: 'AX', 32: 'EAX', 64: 'RAX'}[arg_3]\n        arg_5 = arg_0.read_register(arg_4)\n        arg_6 = arg_2.read()\n        arg_7 = arg_1.read()\n\n        arg_0.write_register(arg_4, arg_7)\n        arg_1.write(Operators.ITEBV(arg_3, arg_5 == arg_7, arg_6, arg_7))\n\n        # Affected Flags o..szapc\n        arg_0._calculate_CMP_flags(arg_3, arg_5 - arg_7, arg_5, arg_7)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.CMPXCHG", "docstring": "Compares and exchanges.\n\n        Compares the value in the AL, AX, EAX or RAX register (depending on the\n        size of the operand) with the first operand (destination operand). If\n        the two values are equal, the second operand (source operand) is loaded\n        into the destination operand. Otherwise, the destination operand is\n        loaded into the AL, AX, EAX or RAX register.\n\n        The ZF flag is set if the values in the destination operand and\n        register AL, AX, or EAX are equal; otherwise it is cleared. The CF, PF,\n        AF, SF, and OF flags are set according to the results of the comparison\n        operation::\n\n        (* accumulator  =  AL, AX, EAX or RAX,  depending on whether *)\n        (* a byte, word, a doubleword or a 64bit comparison is being performed*)\n        IF accumulator  ==  DEST\n        THEN\n            ZF  =  1\n            DEST  =  SRC\n        ELSE\n            ZF  =  0\n            accumulator  =  DEST\n        FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.", "docstring_tokens": ["Compares", "and", "exchanges", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258122}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/sh.py#L61-L97", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "Strongly inspired from idlelib.ColorDelegator.make_pat", "language": "python", "parameters": "(additional_keywords=[], additional_builtins=[])", "return_statement": "return \"|\".join([instance, decorator, kw, kw_namespace, builtin,\n                     word_operators, builtin_fct, comment,\n                     ufstring1, ufstring2, ufstring3, ufstring4, string,\n                     number, any(\"SYNC\", [r\"\\n\"])])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "[", "]", ",", "arg_1", "=", "[", "]", ")", ":", "arg_2", "=", "r\"\\b\"", "+", "any", "(", "\"keyword\"", ",", "kwlist", "+", "arg_0", ")", "+", "r\"\\b\"", "arg_3", "=", "r\"\\b\"", "+", "any", "(", "\"namespace\"", ",", "kw_namespace_list", ")", "+", "r\"\\b\"", "arg_4", "=", "r\"\\b\"", "+", "any", "(", "\"operator_word\"", ",", "wordop_list", ")", "+", "r\"\\b\"", "arg_5", "=", "[", "str", "(", "name", ")", "for", "name", "in", "dir", "(", "builtins", ")", "if", "not", "name", ".", "startswith", "(", "'_'", ")", "]", "+", "arg_1", "for", "arg_6", "in", "[", "'None'", ",", "'True'", ",", "'False'", "]", ":", "arg_5", ".", "remove", "(", "arg_6", ")", "arg_7", "=", "r\"([^.'\\\"\\\\#]\\b|^)\"", "+", "any", "(", "\"builtin\"", ",", "arg_5", ")", "+", "r\"\\b\"", "arg_8", "=", "any", "(", "\"builtin_fct\"", ",", "[", "r'_{2}[a-zA-Z_]*_{2}'", "]", ")", "arg_9", "=", "any", "(", "\"comment\"", ",", "[", "r\"#[^\\n]*\"", "]", ")", "arg_10", "=", "any", "(", "\"instance\"", ",", "[", "r\"\\bself\\b\"", ",", "r\"\\bcls\\b\"", "]", ")", "arg_11", "=", "any", "(", "'decorator'", ",", "[", "r'@\\w*'", ",", "r'.setter'", "]", ")", "arg_12", "=", "any", "(", "\"number\"", ",", "[", "r\"\\b[+-]?[0-9]+[lLjJ]?\\b\"", ",", "r\"\\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\\b\"", ",", "r\"\\b[+-]?0[oO][0-7]+[lL]?\\b\"", ",", "r\"\\b[+-]?0[bB][01]+[lL]?\\b\"", ",", "r\"\\b[+-]?[0-9]+(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?[jJ]?\\b\"", "]", ")", "arg_13", "=", "r\"(\\b[rRuU])?'[^'\\\\\\n]*(\\\\.[^'\\\\\\n]*)*'?\"", "arg_14", "=", "r'(\\b[rRuU])?\"[^\"\\\\\\n]*(\\\\.[^\"\\\\\\n]*)*\"?'", "arg_15", "=", "r\"(\\b[rRuU])?'[^'\\\\\\n]*(\\\\.[^'\\\\\\n]*)*(\\\\)$(?!')$\"", "arg_16", "=", "r'(\\b[rRuU])?\"[^\"\\\\\\n]*(\\\\.[^\"\\\\\\n]*)*(\\\\)$(?!\")$'", "arg_17", "=", "r\"(\\b[rRuU])?'''[^'\\\\]*((\\\\.|'(?!''))[^'\\\\]*)*(''')?\"", "arg_18", "=", "r'(\\b[rRuU])?\"\"\"[^\"\\\\]*((\\\\.|\"(?!\"\"))[^\"\\\\]*)*(\"\"\")?'", "arg_19", "=", "r\"(\\b[rRuU])?'''[^'\\\\]*((\\\\.|'(?!''))[^'\\\\]*)*(\\\\)?(?!''')$\"", "arg_20", "=", "r'(\\b[rRuU])?\"\"\"[^\"\\\\]*((\\\\.|\"(?!\"\"))[^\"\\\\]*)*(\\\\)?(?!\"\"\")$'", "arg_21", "=", "any", "(", "\"string\"", ",", "[", "arg_17", ",", "arg_18", ",", "arg_13", ",", "arg_14", "]", ")", "arg_22", "=", "any", "(", "\"uf_sqstring\"", ",", "[", "arg_15", "]", ")", "arg_23", "=", "any", "(", "\"uf_dqstring\"", ",", "[", "arg_16", "]", ")", "arg_24", "=", "any", "(", "\"uf_sq3string\"", ",", "[", "arg_19", "]", ")", "arg_25", "=", "any", "(", "\"uf_dq3string\"", ",", "[", "arg_20", "]", ")", "return", "\"|\"", ".", "join", "(", "[", "arg_10", ",", "arg_11", ",", "arg_2", ",", "arg_3", ",", "arg_7", ",", "arg_4", ",", "arg_8", ",", "arg_9", ",", "arg_22", ",", "arg_23", ",", "arg_24", ",", "arg_25", ",", "arg_21", ",", "arg_12", ",", "any", "(", "\"SYNC\"", ",", "[", "r\"\\n\"", "]", ")", "]", ")"], "function": "def Func(arg_0=[], arg_1=[]):\n    \"\"\"Strongly inspired from idlelib.ColorDelegator.make_pat\"\"\"\n    arg_2 = r\"\\b\" + any(\"keyword\", kwlist + arg_0) + r\"\\b\"\n    arg_3 = r\"\\b\" + any(\"namespace\", kw_namespace_list) + r\"\\b\"\n    arg_4 = r\"\\b\" + any(\"operator_word\", wordop_list) + r\"\\b\"\n    arg_5 = [str(name) for name in dir(builtins)\n                   if not name.startswith('_')] + arg_1\n    for arg_6 in ['None', 'True', 'False']:\n        arg_5.remove(arg_6)\n    arg_7 = r\"([^.'\\\"\\\\#]\\b|^)\" + any(\"builtin\", arg_5) + r\"\\b\"\n    arg_8 = any(\"builtin_fct\", [r'_{2}[a-zA-Z_]*_{2}'])\n    arg_9 = any(\"comment\", [r\"#[^\\n]*\"])\n    arg_10 = any(\"instance\", [r\"\\bself\\b\", r\"\\bcls\\b\"])\n    arg_11 = any('decorator', [r'@\\w*', r'.setter'])\n    arg_12 = any(\"number\",\n                 [r\"\\b[+-]?[0-9]+[lLjJ]?\\b\",\n                  r\"\\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\\b\",\n                  r\"\\b[+-]?0[oO][0-7]+[lL]?\\b\",\n                  r\"\\b[+-]?0[bB][01]+[lL]?\\b\",\n                  r\"\\b[+-]?[0-9]+(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?[jJ]?\\b\"])\n    arg_13 = r\"(\\b[rRuU])?'[^'\\\\\\n]*(\\\\.[^'\\\\\\n]*)*'?\"\n    arg_14 = r'(\\b[rRuU])?\"[^\"\\\\\\n]*(\\\\.[^\"\\\\\\n]*)*\"?'\n    arg_15 = r\"(\\b[rRuU])?'[^'\\\\\\n]*(\\\\.[^'\\\\\\n]*)*(\\\\)$(?!')$\"\n    arg_16 = r'(\\b[rRuU])?\"[^\"\\\\\\n]*(\\\\.[^\"\\\\\\n]*)*(\\\\)$(?!\")$'\n    arg_17 = r\"(\\b[rRuU])?'''[^'\\\\]*((\\\\.|'(?!''))[^'\\\\]*)*(''')?\"\n    arg_18 = r'(\\b[rRuU])?\"\"\"[^\"\\\\]*((\\\\.|\"(?!\"\"))[^\"\\\\]*)*(\"\"\")?'\n    arg_19 = r\"(\\b[rRuU])?'''[^'\\\\]*((\\\\.|'(?!''))[^'\\\\]*)*(\\\\)?(?!''')$\"\n    arg_20 = r'(\\b[rRuU])?\"\"\"[^\"\\\\]*((\\\\.|\"(?!\"\"))[^\"\\\\]*)*(\\\\)?(?!\"\"\")$'\n    arg_21 = any(\"string\", [arg_17, arg_18, arg_13, arg_14])\n    arg_22 = any(\"uf_sqstring\", [arg_15])\n    arg_23 = any(\"uf_dqstring\", [arg_16])\n    arg_24 = any(\"uf_sq3string\", [arg_19])\n    arg_25 = any(\"uf_dq3string\", [arg_20])\n    return \"|\".join([arg_10, arg_11, arg_2, arg_3, arg_7,\n                     arg_4, arg_8, arg_9,\n                     arg_22, arg_23, arg_24, arg_25, arg_21,\n                     arg_12, any(\"SYNC\", [r\"\\n\"])])", "path": "pyqode/python/modes/sh.py", "identifier": "make_python_patterns", "docstring": "Strongly inspired from idlelib.ColorDelegator.make_pat", "docstring_tokens": ["Strongly", "inspired", "from", "idlelib", ".", "ColorDelegator", ".", "make_pat"], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 258123}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/__init__.py#L518-L553", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Print a friendly message.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "int", "(", "choice", "(", "str", "(", "int", "(", "time", "(", ")", ")", ")", ")", ")", "if", "not", "CONFIGURATION", "[", "\"quiet\"", "]", "and", "arg_0", "%", "3", "==", "0", ":", "print", "(", "\"\\n\"", "+", "Fore", ".", "GREEN", "+", "Style", ".", "BRIGHT", "+", "\"Thanks for using PyFunceble!\"", ")", "print", "(", "Fore", ".", "YELLOW", "+", "Style", ".", "BRIGHT", "+", "\"Share your experience on \"", "+", "Fore", ".", "CYAN", "+", "\"Twitter\"", "+", "Fore", ".", "YELLOW", "+", "\" with \"", "+", "Fore", ".", "CYAN", "+", "\"#PyFunceble\"", "+", "Fore", ".", "YELLOW", "+", "\"!\"", ")", "print", "(", "Fore", ".", "GREEN", "+", "Style", ".", "BRIGHT", "+", "\"Have a feedback, an issue or an improvement idea ?\"", ")", "print", "(", "Fore", ".", "YELLOW", "+", "Style", ".", "BRIGHT", "+", "\"Let us know on \"", "+", "Fore", ".", "CYAN", "+", "\"GitHub\"", "+", "Fore", ".", "YELLOW", "+", "\"!\"", ")"], "function": "def Func():  # pragma: no cover\n    \"\"\"\n    Print a friendly message.\n    \"\"\"\n\n    arg_0 = int(choice(str(int(time()))))\n\n    if not CONFIGURATION[\"quiet\"] and arg_0 % 3 == 0:\n        print(\"\\n\" + Fore.GREEN + Style.BRIGHT + \"Thanks for using PyFunceble!\")\n        print(\n            Fore.YELLOW\n            + Style.BRIGHT\n            + \"Share your experience on \"\n            + Fore.CYAN\n            + \"Twitter\"\n            + Fore.YELLOW\n            + \" with \"\n            + Fore.CYAN\n            + \"#PyFunceble\"\n            + Fore.YELLOW\n            + \"!\"\n        )\n        print(\n            Fore.GREEN\n            + Style.BRIGHT\n            + \"Have a feedback, an issue or an improvement idea ?\"\n        )\n        print(\n            Fore.YELLOW\n            + Style.BRIGHT\n            + \"Let us know on \"\n            + Fore.CYAN\n            + \"GitHub\"\n            + Fore.YELLOW\n            + \"!\"\n        )", "path": "PyFunceble/__init__.py", "identifier": "stay_safe", "docstring": "Print a friendly message.", "docstring_tokens": ["Print", "a", "friendly", "message", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 258124}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/docmaker/content.py#L373-L387", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "add a new markup section", "language": "python", "parameters": "( self )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "markup", "and", "arg_0", ".", "markup_lines", ":", "arg_1", "=", "arg_0", ".", "markup_lines", "if", "len", "(", "arg_1", ")", ">", "0", "and", "not", "string", ".", "strip", "(", "arg_1", "[", "-", "1", "]", ")", ":", "arg_0", ".", "markup_lines", "=", "arg_1", "[", ":", "-", "1", "]", "arg_3", "=", "DocMarkup", "(", "arg_0", ".", "markup", ",", "arg_0", ".", "markup_lines", ")", "arg_0", ".", "markups", ".", "append", "(", "arg_3", ")", "arg_0", ".", "markup", "=", "None", "arg_0", ".", "markup_lines", "=", "[", "]"], "function": "def  Func( arg_0 ):\n        \"\"\"add a new markup section\"\"\"\n        if arg_0.markup and arg_0.markup_lines:\n\n            # get rid of last line of markup if it's empty\n            arg_1 = arg_0.markup_lines\n            if len( arg_1 ) > 0 and not string.strip( arg_1[-1] ):\n                arg_0.markup_lines = arg_1[:-1]\n\n            arg_3 = DocMarkup( arg_0.markup, arg_0.markup_lines )\n\n            arg_0.markups.append( arg_3 )\n\n            arg_0.markup       = None\n            arg_0.markup_lines = []", "path": "native/Vendor/FreeType/src/tools/docmaker/content.py", "identifier": "ContentProcessor.add_markup", "docstring": "add a new markup section", "docstring_tokens": ["add", "a", "new", "markup", "section"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 258125}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L2527-L2627", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores data starting from a node along a branch and starts recursively loading\n        all data at end of branch.", "language": "python", "parameters": "(self, traj_node, branch_name,\n                               store_data=pypetconstants.STORE_DATA,\n                               with_links=True,\n                               recursive=False,\n                               max_depth=None,\n                               hdf5_group=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "STORE_DATA", ",", "arg_6", "=", "True", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ")", ":", "if", "arg_3", "==", "arg_4", ".", "STORE_NOTHING", ":", "return", "if", "arg_8", "is", "None", ":", "arg_8", "=", "float", "(", "'inf'", ")", "if", "arg_9", "is", "None", ":", "arg_10", "=", "arg_1", ".", "v_full_name", "arg_11", "=", "arg_10", ".", "replace", "(", "'.'", ",", "'/'", ")", "try", ":", "if", "arg_10", "==", "''", ":", "arg_9", "=", "arg_0", ".", "_trajectory_group", "else", ":", "arg_9", "=", "arg_0", ".", "_hdf5file", ".", "get_node", "(", "where", "=", "arg_0", ".", "_trajectory_group", ",", "arg_15", "=", "arg_11", ")", "except", "pt", ".", "NoSuchNodeError", ":", "arg_0", ".", "_logger", ".", "debug", "(", "'Cannot store `%s` the parental hdf5 node with path `%s` does '", "'not exist on disk.'", "%", "(", "arg_1", ".", "v_name", ",", "arg_11", ")", ")", "if", "arg_1", ".", "v_is_leaf", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Cannot store `%s` the parental hdf5 '", "'node with path `%s` does '", "'not exist on disk! The child '", "'you want to store is a leaf node,'", "'that cannot be stored without '", "'the parental node existing on '", "'disk.'", "%", "(", "arg_1", ".", "v_name", ",", "arg_11", ")", ")", "raise", "else", ":", "arg_0", ".", "_logger", ".", "debug", "(", "'I will try to store the path from trajectory root to '", "'the child now.'", ")", "arg_0", ".", "Func", "(", "arg_1", ".", "_nn_interface", ".", "_root_instance", ",", "arg_1", ".", "v_full_name", "+", "'.'", "+", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", "+", "arg_1", ".", "v_depth", ",", "arg_9", "=", "arg_0", ".", "_trajectory_group", ")", "return", "arg_12", "=", "1", "arg_13", "=", "arg_2", ".", "split", "(", "'.'", ")", "arg_14", "=", "arg_13", ".", "pop", "(", ")", "for", "arg_15", "in", "arg_13", ":", "if", "arg_12", ">", "arg_8", ":", "return", "arg_0", ".", "_tree_store_nodes_dfs", "(", "arg_1", ",", "arg_15", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "False", ",", "arg_8", "=", "arg_8", ",", "arg_12", "=", "arg_12", ",", "parent_hdf5_group", "=", "arg_9", ")", "arg_12", "+=", "1", "arg_1", "=", "arg_1", ".", "_children", "[", "arg_15", "]", "arg_9", "=", "getattr", "(", "arg_9", ",", "arg_15", ")", "if", "arg_12", "<=", "arg_8", ":", "arg_0", ".", "_tree_store_nodes_dfs", "(", "arg_1", ",", "arg_14", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_12", "=", "arg_12", ",", "parent_hdf5_group", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                               arg_3=arg_4.STORE_DATA,\n                               arg_6=True,\n                               arg_7=False,\n                               arg_8=None,\n                               arg_9=None):\n        \"\"\"Stores data starting from a node along a branch and starts recursively loading\n        all data at end of branch.\n\n        :param traj_node: The node where storing starts\n\n        :param branch_name:\n\n            A branch along which storing progresses. Colon Notation is used:\n            'group1.group2.group3' loads 'group1', then 'group2', then 'group3', and then finally\n            recursively all children and children's children below 'group3'.\n\n        :param store_data: How data should be stored\n\n        :param with_links: If links should be stored\n\n        :param recursive:\n\n            If the rest of the tree should be recursively stored\n\n        :param max_depth:\n\n            Maximum depth to store\n\n        :param hdf5_group:\n\n            HDF5 node in the file corresponding to `traj_node`\n\n        \"\"\"\n        if arg_3 == arg_4.STORE_NOTHING:\n            return\n\n        if arg_8 is None:\n            arg_8 = float('inf')\n\n        if arg_9 is None:\n            # Get parent hdf5 node\n            arg_10 = arg_1.v_full_name\n            arg_11 = arg_10.replace('.', '/')\n            try:\n                if arg_10 == '':\n                    arg_9 = arg_0._trajectory_group\n                else:\n                    arg_9 = arg_0._hdf5file.get_node( where=arg_0._trajectory_group,\n                                                         arg_15=arg_11)\n            except pt.NoSuchNodeError:\n                arg_0._logger.debug('Cannot store `%s` the parental hdf5 node with path `%s` does '\n                                     'not exist on disk.' %\n                                     (arg_1.v_name, arg_11))\n\n                if arg_1.v_is_leaf:\n                    arg_0._logger.error('Cannot store `%s` the parental hdf5 '\n                                       'node with path `%s` does '\n                                       'not exist on disk! The child '\n                                       'you want to store is a leaf node,'\n                                       'that cannot be stored without '\n                                       'the parental node existing on '\n                                       'disk.' % (arg_1.v_name, arg_11))\n                    raise\n                else:\n                    arg_0._logger.debug('I will try to store the path from trajectory root to '\n                                         'the child now.')\n\n                    arg_0.Func(arg_1._nn_interface._root_instance,\n                                                arg_1.v_full_name + '.' + arg_2,\n                                                arg_3=arg_3, arg_6=arg_6,\n                                                arg_7=arg_7,\n                                                arg_8=arg_8 + arg_1.v_depth,\n                                                arg_9=arg_0._trajectory_group)\n                    return\n\n        arg_12 = 1\n\n        arg_13 = arg_2.split('.')\n\n        arg_14 = arg_13.pop()\n\n        for arg_15 in arg_13:\n            if arg_12 > arg_8:\n                return\n            # Store along a branch\n            arg_0._tree_store_nodes_dfs(arg_1, arg_15, arg_3=arg_3, arg_6=arg_6,\n                                   arg_7=False, arg_8=arg_8,\n                                   arg_12=arg_12, parent_hdf5_group=arg_9)\n            arg_12 += 1\n\n            arg_1 = arg_1._children[arg_15]\n\n            arg_9 = getattr(arg_9, arg_15)\n\n        # Store final group and recursively everything below it\n        if arg_12 <= arg_8:\n            arg_0._tree_store_nodes_dfs(arg_1, arg_14, arg_3=arg_3,\n                               arg_6=arg_6, arg_7=arg_7,\n                               arg_8=arg_8, arg_12=arg_12,\n                               parent_hdf5_group=arg_9)", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._tree_store_sub_branch", "docstring": "Stores data starting from a node along a branch and starts recursively loading\n        all data at end of branch.\n\n        :param traj_node: The node where storing starts\n\n        :param branch_name:\n\n            A branch along which storing progresses. Colon Notation is used:\n            'group1.group2.group3' loads 'group1', then 'group2', then 'group3', and then finally\n            recursively all children and children's children below 'group3'.\n\n        :param store_data: How data should be stored\n\n        :param with_links: If links should be stored\n\n        :param recursive:\n\n            If the rest of the tree should be recursively stored\n\n        :param max_depth:\n\n            Maximum depth to store\n\n        :param hdf5_group:\n\n            HDF5 node in the file corresponding to `traj_node`", "docstring_tokens": ["Stores", "data", "starting", "from", "a", "node", "along", "a", "branch", "and", "starts", "recursively", "loading", "all", "data", "at", "end", "of", "branch", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258126}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/libplanarradpy/planrad.py#L324-L330", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "Does nothing currently.  May not need this method", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "sky_file", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "input_path", ",", "'sky_files'", ")", ",", "'sky_'", "+", "arg_0", ".", "sky_state", "+", "'_z'", "+", "str", "(", "arg_0", ".", "sky_zenith", ")", "+", "'_a'", "+", "str", "(", "arg_0", ".", "sky_azimuth", ")", "+", "'_'", "+", "str", "(", "arg_0", ".", "num_bands", ")", "+", "'_'", "+", "arg_0", ".", "ds_code", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Does nothing currently.  May not need this method\"\"\"\n        arg_0.sky_file = os.path.abspath(os.path.join(os.path.join(arg_0.input_path, 'sky_files'),\n                                                     'sky_' + arg_0.sky_state + '_z' + str(\n                                                         arg_0.sky_zenith) + '_a' + str(\n                                                         arg_0.sky_azimuth) + '_' + str(\n                                                         arg_0.num_bands) + '_' + arg_0.ds_code))", "path": "libplanarradpy/planrad.py", "identifier": "RunParameters.update_filenames", "docstring": "Does nothing currently.  May not need this method", "docstring_tokens": ["Does", "nothing", "currently", ".", "May", "not", "need", "this", "method"], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 258127}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/hdc_service.py#L366-L374", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "receives rlp.decoded serialized", "language": "python", "parameters": "(self, proto, transactions)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "log", ".", "debug", "(", "'----------------------------------'", ")", "log", ".", "debug", "(", "'remote_transactions_received'", ",", "count", "=", "len", "(", "arg_2", ")", ",", "remote_id", "=", "arg_1", ")", "def", "_add_txs", "(", ")", ":", "for", "arg_3", "in", "arg_2", ":", "arg_0", ".", "add_transaction", "(", "arg_3", ",", "origin", "=", "arg_1", ")", "gevent", ".", "spawn", "(", "_add_txs", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"receives rlp.decoded serialized\"\n        log.debug('----------------------------------')\n        log.debug('remote_transactions_received', count=len(arg_2), remote_id=arg_1)\n\n        def _add_txs():\n            for arg_3 in arg_2:\n                arg_0.add_transaction(arg_3, origin=arg_1)\n        gevent.spawn(_add_txs)", "path": "hydrachain/hdc_service.py", "identifier": "ChainService.on_receive_transactions", "docstring": "receives rlp.decoded serialized", "docstring_tokens": ["receives", "rlp", ".", "decoded", "serialized"], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 258128}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dstat.py#L115-L118", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Returns a string of comma-delimited key=value pairs.", "language": "python", "parameters": "(self, values)", "return_statement": "return ', '.join(\n        '%s=%s' % (key, value) for key, value in sorted(values.items()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "', '", ".", "join", "(", "'%s=%s'", "%", "(", "arg_2", ",", "arg_3", ")", "for", "arg_2", ",", "arg_3", "in", "sorted", "(", "arg_1", ".", "items", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns a string of comma-delimited key=value pairs.\"\"\"\n    return ', '.join(\n        '%s=%s' % (arg_2, arg_3) for arg_2, arg_3 in sorted(arg_1.items()))", "path": "dsub/commands/dstat.py", "identifier": "TextOutput.format_pairs", "docstring": "Returns a string of comma-delimited key=value pairs.", "docstring_tokens": ["Returns", "a", "string", "of", "comma", "-", "delimited", "key", "=", "value", "pairs", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 258129}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L75-L83", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Calculate the tanimoto set similarity.", "language": "python", "parameters": "(x: Iterable[X], y: Iterable[X])", "return_statement": "return len(a & b) / len(union)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ",", "arg_3", ":", "arg_1", "[", "arg_2", "]", ")", "->", "float", ":", "arg_4", ",", "arg_5", "=", "set", "(", "arg_0", ")", ",", "set", "(", "arg_3", ")", "arg_6", "=", "arg_4", "|", "arg_5", "if", "not", "arg_6", ":", "return", "0.0", "return", "len", "(", "arg_4", "&", "arg_5", ")", "/", "len", "(", "arg_6", ")"], "function": "def Func(arg_0: arg_1[arg_2], arg_3: arg_1[arg_2]) -> float:\n    \"\"\"Calculate the tanimoto set similarity.\"\"\"\n    arg_4, arg_5 = set(arg_0), set(arg_3)\n    arg_6 = arg_4 | arg_5\n\n    if not arg_6:\n        return 0.0\n\n    return len(arg_4 & arg_5) / len(arg_6)", "path": "src/pybel_tools/utils.py", "identifier": "tanimoto_set_similarity", "docstring": "Calculate the tanimoto set similarity.", "docstring_tokens": ["Calculate", "the", "tanimoto", "set", "similarity", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 258130}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/timestamps.py#L58-L66", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "D and A emission rates for two populations.", "language": "python", "parameters": "(em_rates_tot, E_values)", "return_statement": "return em_rates_d, em_rates_a", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "[", "]", ",", "[", "]", "for", "arg_4", ",", "arg_5", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ":", "arg_6", ",", "arg_7", "=", "em_rates_from_E_DA", "(", "arg_4", ",", "arg_5", ")", "arg_2", ".", "append", "(", "arg_6", ")", "arg_3", ".", "append", "(", "arg_7", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"D and A emission rates for two populations.\n    \"\"\"\n    arg_2, arg_3 = [], []\n    for arg_4, arg_5 in zip(arg_0, arg_1):\n        arg_6, arg_7 = em_rates_from_E_DA(arg_4, arg_5)\n        arg_2.append(arg_6)\n        arg_3.append(arg_7)\n    return arg_2, arg_3", "path": "pybromo/timestamps.py", "identifier": "em_rates_from_E_DA_mix", "docstring": "D and A emission rates for two populations.", "docstring_tokens": ["D", "and", "A", "emission", "rates", "for", "two", "populations", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 258131}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L241-L286", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return logarithmic mean.", "language": "python", "parameters": "(nums)", "return_statement": "return math.factorial(len(nums) - 1) * rolling_sum", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", "!=", "len", "(", "set", "(", "arg_0", ")", ")", ":", "raise", "AttributeError", "(", "'No two values in the nums list may be equal'", ")", "arg_1", "=", "0", "for", "arg_2", "in", "range", "(", "len", "(", "arg_0", ")", ")", ":", "arg_3", "=", "1", "for", "arg_4", "in", "range", "(", "len", "(", "arg_0", ")", ")", ":", "if", "arg_2", "!=", "arg_4", ":", "arg_3", "*=", "math", ".", "log", "(", "arg_0", "[", "arg_2", "]", "/", "arg_0", "[", "arg_4", "]", ")", "arg_1", "+=", "arg_0", "[", "arg_2", "]", "/", "arg_3", "return", "math", ".", "factorial", "(", "len", "(", "arg_0", ")", "-", "1", ")", "*", "arg_1"], "function": "def Func(arg_0):\n    r\"\"\"Return logarithmic mean.\n\n    The logarithmic mean of an arbitrarily long series is defined by\n    http://www.survo.fi/papers/logmean.pdf\n    as:\n    :math:`L(x_1, x_2, ..., x_n) =\n    (n-1)! \\sum\\limits_{i=1}^n \\frac{x_i}\n    {\\prod\\limits_{\\substack{j = 1\\\\j \\ne i}}^n\n    ln \\frac{x_i}{x_j}}`\n\n    Cf. https://en.wikipedia.org/wiki/Logarithmic_mean\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    float\n        The logarithmic mean of nums\n\n    Raises\n    ------\n    AttributeError\n        No two values in the nums list may be equal\n\n    Examples\n    --------\n    >>> Func([1, 2, 3, 4])\n    2.2724242417489258\n    >>> Func([1, 2])\n    1.4426950408889634\n\n    \"\"\"\n    if len(arg_0) != len(set(arg_0)):\n        raise AttributeError('No two values in the nums list may be equal')\n    arg_1 = 0\n    for arg_2 in range(len(arg_0)):\n        arg_3 = 1\n        for arg_4 in range(len(arg_0)):\n            if arg_2 != arg_4:\n                arg_3 *= math.log(arg_0[arg_2] / arg_0[arg_4])\n        arg_1 += arg_0[arg_2] / arg_3\n    return math.factorial(len(arg_0) - 1) * arg_1", "path": "abydos/stats/_mean.py", "identifier": "lmean", "docstring": "r\"\"\"Return logarithmic mean.\n\n    The logarithmic mean of an arbitrarily long series is defined by\n    http://www.survo.fi/papers/logmean.pdf\n    as:\n    :math:`L(x_1, x_2, ..., x_n) =\n    (n-1)! \\sum\\limits_{i=1}^n \\frac{x_i}\n    {\\prod\\limits_{\\substack{j = 1\\\\j \\ne i}}^n\n    ln \\frac{x_i}{x_j}}`\n\n    Cf. https://en.wikipedia.org/wiki/Logarithmic_mean\n\n    Parameters\n    ----------\n    nums : list\n        A series of numbers\n\n    Returns\n    -------\n    float\n        The logarithmic mean of nums\n\n    Raises\n    ------\n    AttributeError\n        No two values in the nums list may be equal\n\n    Examples\n    --------\n    >>> lmean([1, 2, 3, 4])\n    2.2724242417489258\n    >>> lmean([1, 2])\n    1.4426950408889634", "docstring_tokens": ["r", "Return", "logarithmic", "mean", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 258132}
{"url": "https://github.com/nir0s/jocker/blob/b03c78adeb59ac836b388e4a7f14337d834c4b71/jocker/jocker.py#L55-L72", "sha": "b03c78adeb59ac836b388e4a7f14337d834c4b71", "docstring_summary": "returns a configuration object", "language": "python", "parameters": "(config_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "jocker_lgr", ".", "debug", "(", "'config file is: {0}'", ".", "format", "(", "arg_0", ")", ")", "try", ":", "jocker_lgr", ".", "debug", "(", "'importing config...'", ")", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "c", ":", "return", "yaml", ".", "safe_load", "(", "c", ".", "read", "(", ")", ")", "except", "IOError", "as", "ex", ":", "jocker_lgr", ".", "error", "(", "str", "(", "ex", ")", ")", "raise", "RuntimeError", "(", "'cannot access config file'", ")", "except", "yaml", ".", "parser", ".", "ParserError", "as", "ex", ":", "jocker_lgr", ".", "error", "(", "'invalid yaml file: {0}'", ".", "format", "(", "ex", ")", ")", "raise", "RuntimeError", "(", "'invalid yaml file'", ")"], "function": "def Func(arg_0):\n    \"\"\"returns a configuration object\n\n    :param string config_file: path to config file\n    \"\"\"\n    # get config file path\n    jocker_lgr.debug('config file is: {0}'.format(arg_0))\n    # append to path for importing\n    try:\n        jocker_lgr.debug('importing config...')\n        with open(arg_0, 'r') as c:\n            return yaml.safe_load(c.read())\n    except IOError as ex:\n        jocker_lgr.error(str(ex))\n        raise RuntimeError('cannot access config file')\n    except yaml.parser.ParserError as ex:\n        jocker_lgr.error('invalid yaml file: {0}'.format(ex))\n        raise RuntimeError('invalid yaml file')", "path": "jocker/jocker.py", "identifier": "_import_config", "docstring": "returns a configuration object\n\n    :param string config_file: path to config file", "docstring_tokens": ["returns", "a", "configuration", "object"], "nwo": "nir0s/jocker", "score": 0.1878804938561529, "idx": 258133}
{"url": "https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/genesis.py#L159-L170", "sha": "dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a", "docstring_summary": "Return a list of Processor objects.", "language": "python", "parameters": "(self, processor_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "return", "arg_0", ".", "api", ".", "processor", ".", "get", "(", "name", "=", "arg_1", ")", "[", "'objects'", "]", "else", ":", "return", "arg_0", ".", "api", ".", "processor", ".", "get", "(", ")", "[", "'objects'", "]"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Return a list of Processor objects.\n\n        :param project_id: ObjectId of Genesis project\n        :type project_id: string\n        :rtype: list of Processor objects\n\n        \"\"\"\n        if arg_1:\n            return arg_0.api.processor.get(name=arg_1)['objects']\n        else:\n            return arg_0.api.processor.get()['objects']", "path": "genesis/genesis.py", "identifier": "Genesis.processors", "docstring": "Return a list of Processor objects.\n\n        :param project_id: ObjectId of Genesis project\n        :type project_id: string\n        :rtype: list of Processor objects", "docstring_tokens": ["Return", "a", "list", "of", "Processor", "objects", "."], "nwo": "genialis/genesis-pyapi", "score": 0.27692002097430746, "idx": 258134}
{"url": "https://github.com/playpauseandstop/bootstrapper/blob/b216a05f2acb0b9f4919c4e010ff7b0f63fc1393/bootstrapper.py#L270-L272", "sha": "b216a05f2acb0b9f4919c4e010ff7b0f63fc1393", "docstring_summary": "Iterate over dict keys.", "language": "python", "parameters": "(data, **kwargs)", "return_statement": "return iter(data.keys(**kwargs)) if IS_PY3 else data.iterkeys(**kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "return", "iter", "(", "arg_0", ".", "keys", "(", "**", "arg_1", ")", ")", "if", "IS_PY3", "else", "arg_0", ".", "Func", "(", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Iterate over dict keys.\"\"\"\n    return iter(arg_0.keys(**arg_1)) if IS_PY3 else arg_0.Func(**arg_1)", "path": "bootstrapper.py", "identifier": "iterkeys", "docstring": "Iterate over dict keys.", "docstring_tokens": ["Iterate", "over", "dict", "keys", "."], "nwo": "playpauseandstop/bootstrapper", "score": 0.17697123869542528, "idx": 258135}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L403-L413", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Find the statements in `self.code`.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "child_parsers", "(", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "_bytes_lines", "(", ")", ":", "yield", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Find the statements in `self.code`.\n\n        Produce a sequence of line numbers that start statements.  Recurses\n        into all code objects reachable from `self.code`.\n\n        \"\"\"\n        for arg_1 in arg_0.child_parsers():\n            # Get all of the lineno information from this code.\n            for arg_2, arg_3 in arg_1._bytes_lines():\n                yield arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py", "identifier": "ByteParser._find_statements", "docstring": "Find the statements in `self.code`.\n\n        Produce a sequence of line numbers that start statements.  Recurses\n        into all code objects reachable from `self.code`.", "docstring_tokens": ["Find", "the", "statements", "in", "self", ".", "code", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258136}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/node_profile_multiobjective.py#L58-L79", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "A simple checker, that connections are coming in descending order of departure time\n        and that no departure time has been \"skipped\".", "language": "python", "parameters": "(self, dep_time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", "<=", "arg_0", ".", "_min_dep_time", ",", "\"Labels should be entered in decreasing order of departure time.\"", "arg_2", "=", "arg_0", ".", "dep_times_to_index", "[", "arg_1", "]", "if", "arg_0", ".", "_min_dep_time", "<", "float", "(", "'inf'", ")", ":", "arg_3", "=", "arg_0", ".", "dep_times_to_index", "[", "arg_0", ".", "_min_dep_time", "]", "assert", "arg_3", "==", "arg_2", "or", "(", "arg_3", "==", "arg_2", "-", "1", ")", ",", "\"dep times should be ordered sequentially\"", "else", ":", "assert", "arg_2", "is", "0", ",", "\"first dep_time index should be zero (ensuring that all connections are properly handled)\"", "arg_0", ".", "_min_dep_time", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        A simple checker, that connections are coming in descending order of departure time\n        and that no departure time has been \"skipped\".\n\n        Parameters\n        ----------\n        dep_time\n\n        Returns\n        -------\n        None\n        \"\"\"\n        assert arg_1 <= arg_0._min_dep_time, \"Labels should be entered in decreasing order of departure time.\"\n        arg_2 = arg_0.dep_times_to_index[arg_1]\n        if arg_0._min_dep_time < float('inf'):\n            arg_3 = arg_0.dep_times_to_index[arg_0._min_dep_time]\n            assert arg_3 == arg_2 or (arg_3 == arg_2 - 1), \\\n                \"dep times should be ordered sequentially\"\n        else:\n            assert arg_2 is 0, \"first dep_time index should be zero (ensuring that all connections are properly handled)\"\n        arg_0._min_dep_time = arg_1", "path": "gtfspy/routing/node_profile_multiobjective.py", "identifier": "NodeProfileMultiObjective._check_dep_time_is_valid", "docstring": "A simple checker, that connections are coming in descending order of departure time\n        and that no departure time has been \"skipped\".\n\n        Parameters\n        ----------\n        dep_time\n\n        Returns\n        -------\n        None", "docstring_tokens": ["A", "simple", "checker", "that", "connections", "are", "coming", "in", "descending", "order", "of", "departure", "time", "and", "that", "no", "departure", "time", "has", "been", "skipped", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 258137}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/clients.py#L37-L48", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Dump the oauth2server Client.", "language": "python", "parameters": "(obj, from_date, with_json=True, latest_only=False, **kwargs)", "return_statement": "return dict(name=obj.name,\n                description=obj.description,\n                website=obj.website,\n                user_id=obj.user_id,\n                client_id=obj.client_id,\n                client_secret=obj.client_secret,\n                is_confidential=obj.is_confidential,\n                is_internal=obj.is_internal,\n                _redirect_uris=obj._redirect_uris,\n                _default_scopes=obj._default_scopes)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "return", "dict", "(", "name", "=", "arg_0", ".", "name", ",", "description", "=", "arg_0", ".", "description", ",", "website", "=", "arg_0", ".", "website", ",", "user_id", "=", "arg_0", ".", "user_id", ",", "client_id", "=", "arg_0", ".", "client_id", ",", "client_secret", "=", "arg_0", ".", "client_secret", ",", "is_confidential", "=", "arg_0", ".", "is_confidential", ",", "is_internal", "=", "arg_0", ".", "is_internal", ",", "_redirect_uris", "=", "arg_0", ".", "_redirect_uris", ",", "_default_scopes", "=", "arg_0", ".", "_default_scopes", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=False, **arg_4):\n    \"\"\"Dump the oauth2server Client.\"\"\"\n    return dict(name=arg_0.name,\n                description=arg_0.description,\n                website=arg_0.website,\n                user_id=arg_0.user_id,\n                client_id=arg_0.client_id,\n                client_secret=arg_0.client_secret,\n                is_confidential=arg_0.is_confidential,\n                is_internal=arg_0.is_internal,\n                _redirect_uris=arg_0._redirect_uris,\n                _default_scopes=arg_0._default_scopes)", "path": "invenio_migrator/legacy/clients.py", "identifier": "dump", "docstring": "Dump the oauth2server Client.", "docstring_tokens": ["Dump", "the", "oauth2server", "Client", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 258138}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_tree.py#L79-L87", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Gets the object's children.", "language": "python", "parameters": "( self, object )", "return_statement": "return children", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_2", ".", "extend", "(", "arg_1", ".", "subgraphs", ")", "arg_2", ".", "extend", "(", "arg_1", ".", "clusters", ")", "arg_2", ".", "extend", "(", "arg_1", ".", "nodes", ")", "arg_2", ".", "extend", "(", "arg_1", ".", "edges", ")", "return", "arg_2"], "function": "def Func ( arg_0, arg_1 ):\n        \"\"\" Gets the object's children.\n        \"\"\"\n        arg_2 = []\n        arg_2.extend( arg_1.subgraphs )\n        arg_2.extend( arg_1.clusters )\n        arg_2.extend( arg_1.nodes )\n        arg_2.extend( arg_1.edges )\n        return arg_2", "path": "godot/ui/graph_tree.py", "identifier": "BaseGraphTreeNode.get_children", "docstring": "Gets the object's children.", "docstring_tokens": ["Gets", "the", "object", "s", "children", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 258139}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L515-L550", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Composes a list of existing object into a new object in the same storage bucket_name", "language": "python", "parameters": "(self, bucket_name, source_objects, destination_object)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "arg_2", "or", "not", "len", "(", "arg_2", ")", ":", "raise", "ValueError", "(", "'source_objects cannot be empty.'", ")", "if", "not", "arg_1", "or", "not", "arg_3", ":", "raise", "ValueError", "(", "'bucket_name and destination_object cannot be empty.'", ")", "arg_0", ".", "log", ".", "info", "(", "\"Composing %s to %s in the bucket %s\"", ",", "arg_2", ",", "arg_3", ",", "arg_1", ")", "arg_4", "=", "arg_0", ".", "get_conn", "(", ")", "arg_5", "=", "arg_4", ".", "get_bucket", "(", "arg_1", ")", "arg_6", "=", "arg_5", ".", "blob", "(", "arg_3", ")", "arg_6", ".", "Func", "(", "sources", "=", "[", "arg_5", ".", "blob", "(", "blob_name", "=", "arg_7", ")", "for", "arg_7", "in", "arg_2", "]", ")", "arg_0", ".", "log", ".", "info", "(", "\"Completed successfully.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Composes a list of existing object into a new object in the same storage bucket_name\n\n        Currently it only supports up to 32 objects that can be concatenated\n        in a single operation\n\n        https://cloud.google.com/storage/docs/json_api/v1/objects/Func\n\n        :param bucket_name: The name of the bucket containing the source objects.\n            This is also the same bucket to store the Funcd destination object.\n        :type bucket_name: str\n        :param source_objects: The list of source objects that will be Funcd\n            into a single object.\n        :type source_objects: list\n        :param destination_object: The path of the object if given.\n        :type destination_object: str\n        \"\"\"\n\n        if not arg_2 or not len(arg_2):\n            raise ValueError('source_objects cannot be empty.')\n\n        if not arg_1 or not arg_3:\n            raise ValueError('bucket_name and destination_object cannot be empty.')\n\n        arg_0.log.info(\"Composing %s to %s in the bucket %s\",\n                      arg_2, arg_3, arg_1)\n        arg_4 = arg_0.get_conn()\n        arg_5 = arg_4.get_bucket(arg_1)\n        arg_6 = arg_5.blob(arg_3)\n        arg_6.Func(\n            sources=[\n                arg_5.blob(blob_name=arg_7) for arg_7 in arg_2\n            ])\n\n        arg_0.log.info(\"Completed successfully.\")", "path": "airflow/contrib/hooks/gcs_hook.py", "identifier": "GoogleCloudStorageHook.compose", "docstring": "Composes a list of existing object into a new object in the same storage bucket_name\n\n        Currently it only supports up to 32 objects that can be concatenated\n        in a single operation\n\n        https://cloud.google.com/storage/docs/json_api/v1/objects/compose\n\n        :param bucket_name: The name of the bucket containing the source objects.\n            This is also the same bucket to store the composed destination object.\n        :type bucket_name: str\n        :param source_objects: The list of source objects that will be composed\n            into a single object.\n        :type source_objects: list\n        :param destination_object: The path of the object if given.\n        :type destination_object: str", "docstring_tokens": ["Composes", "a", "list", "of", "existing", "object", "into", "a", "new", "object", "in", "the", "same", "storage", "bucket_name"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258140}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/manager.py#L130-L144", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Call plugins in a chain, where the result of each plugin call is\n        sent to the next plugin as input. The final output result is returned.", "language": "python", "parameters": "(self, *arg, **kw)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "None", "arg_4", "=", "[", "a", "for", "(", "arg_4", ",", "a", ")", "in", "zip", "(", "getattr", "(", "arg_0", ".", "method", ",", "'static_args'", ",", "[", "]", ")", ",", "arg_1", ")", "if", "arg_4", "]", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "plugins", ":", "arg_3", "=", "arg_6", "(", "*", "arg_1", ",", "**", "arg_2", ")", "arg_1", "=", "arg_4", "[", ":", "]", "arg_1", ".", "append", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Call plugins in a Func, where the result of each plugin call is\n        sent to the next plugin as input. The final output result is returned.\n        \"\"\"\n        arg_3 = None\n        # extract the static arguments (if any) from arg so they can\n        # be passed to each plugin call in the Func\n        arg_4 = [a for (arg_4, a)\n                  in zip(getattr(arg_0.method, 'static_args', []), arg_1)\n                  if arg_4]\n        for arg_5, arg_6 in arg_0.plugins:\n            arg_3 = arg_6(*arg_1, **arg_2)\n            arg_1 = arg_4[:]\n            arg_1.append(arg_3)\n        return arg_3", "path": "environment/lib/python2.7/site-packages/nose/plugins/manager.py", "identifier": "PluginProxy.chain", "docstring": "Call plugins in a chain, where the result of each plugin call is\n        sent to the next plugin as input. The final output result is returned.", "docstring_tokens": ["Call", "plugins", "in", "a", "chain", "where", "the", "result", "of", "each", "plugin", "call", "is", "sent", "to", "the", "next", "plugin", "as", "input", ".", "The", "final", "output", "result", "is", "returned", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258141}
{"url": "https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/edge.py#L29-L39", "sha": "dce007bd7f078427c73a2a1d6f4b834af1b4dc03", "docstring_summary": "Return the other node", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "if", "Func", "==", "arg_0", ".", "node1", ":", "return", "arg_0", ".", "node2", "elif", "Func", "==", "arg_0", ".", "node2", ":", "return", "arg_0", ".", "node1", "else", ":", "return", "None"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Return the other node\n        \"\"\"\n\n        if Func == arg_0.node1:\n            return arg_0.node2\n        elif Func == arg_0.node2:\n            return arg_0.node1\n        else:\n            return None", "path": "pygraphml/edge.py", "identifier": "Edge.node", "docstring": "Return the other node", "docstring_tokens": ["Return", "the", "other", "node"], "nwo": "hadim/pygraphml", "score": 0.33005860181868024, "idx": 258142}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L509-L524", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Compute nominal p-value.", "language": "python", "parameters": "(es, esnull)", "return_statement": "return pval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "arg_0", "<", "0", ",", "arg_0", ">=", "0", "]", "arg_3", "=", "[", "np", ".", "sum", "(", "arg_1", "<", "arg_0", ".", "reshape", "(", "len", "(", "arg_0", ")", ",", "1", ")", ",", "axis", "=", "1", ")", "/", "np", ".", "sum", "(", "arg_1", "<", "0", ",", "axis", "=", "1", ")", ",", "np", ".", "sum", "(", "arg_1", ">=", "arg_0", ".", "reshape", "(", "len", "(", "arg_0", ")", ",", "1", ")", ",", "axis", "=", "1", ")", "/", "np", ".", "sum", "(", "arg_1", ">=", "0", ",", "axis", "=", "1", ")", "]", "arg_4", "=", "np", ".", "select", "(", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Compute nominal p-value.\n\n    From article (PNAS):\n    estimate nominal p-value for S from esnull by using the positive\n    or negative portion of the distribution corresponding to the sign\n    of the observed ES(S).\n    \"\"\"\n\n    # to speed up, using numpy function to compute pval in parallel.\n    arg_2 = [ arg_0 < 0, arg_0 >=0]\n    arg_3 = [np.sum(arg_1 < arg_0.reshape(len(arg_0),1), axis=1)/ np.sum(arg_1 < 0, axis=1),\n                  np.sum(arg_1 >= arg_0.reshape(len(arg_0),1), axis=1)/ np.sum(arg_1 >= 0, axis=1)]\n    arg_4 = np.select(arg_2, arg_3)\n\n    return arg_4", "path": "gseapy/algorithm.py", "identifier": "gsea_pval", "docstring": "Compute nominal p-value.\n\n    From article (PNAS):\n    estimate nominal p-value for S from esnull by using the positive\n    or negative portion of the distribution corresponding to the sign\n    of the observed ES(S).", "docstring_tokens": ["Compute", "nominal", "p", "-", "value", "."], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 258143}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/glmm/_glmm.py#L127-L139", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "r\"\"\"Covariance of the prior.", "language": "python", "parameters": "(self)", "return_statement": "return sum2diag(dot(ddot(Q0, self.v0 * S0), Q0.T), self.v1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "numpy_sugar", ".", "linalg", "import", "ddot", ",", "sum2diag", "arg_1", "=", "arg_0", ".", "_QS", "[", "0", "]", "[", "0", "]", "arg_2", "=", "arg_0", ".", "_QS", "[", "1", "]", "return", "sum2diag", "(", "dot", "(", "ddot", "(", "arg_1", ",", "arg_0", ".", "v0", "*", "arg_2", ")", ",", "arg_1", ".", "T", ")", ",", "arg_0", ".", "v1", ")"], "function": "def Func(arg_0):\n        r\"\"\"Covariance of the prior.\n\n        Returns\n        -------\n        :class:`numpy.ndarray`\n            :math:`v_0 \\mathrm K + v_1 \\mathrm I`.\n        \"\"\"\n        from numpy_sugar.linalg import ddot, sum2diag\n\n        arg_1 = arg_0._QS[0][0]\n        arg_2 = arg_0._QS[1]\n        return sum2diag(dot(ddot(arg_1, arg_0.v0 * arg_2), arg_1.T), arg_0.v1)", "path": "glimix_core/glmm/_glmm.py", "identifier": "GLMM.covariance", "docstring": "r\"\"\"Covariance of the prior.\n\n        Returns\n        -------\n        :class:`numpy.ndarray`\n            :math:`v_0 \\mathrm K + v_1 \\mathrm I`.", "docstring_tokens": ["r", "Covariance", "of", "the", "prior", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 258144}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/enrollments.py#L31-L43", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return a list of all enrollments for the passed section_id.", "language": "python", "parameters": "(self, section_id, params={})", "return_statement": "return enrollments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "arg_3", "=", "SECTIONS_API", ".", "format", "(", "arg_1", ")", "+", "\"/enrollments\"", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ".", "_get_paged_resource", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", ":", "arg_4", ".", "append", "(", "CanvasEnrollment", "(", "data", "=", "arg_5", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return a list of all enrollments for the passed section_id.\n\n        https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index\n        \"\"\"\n        arg_3 = SECTIONS_API.format(arg_1) + \"/enrollments\"\n\n        arg_4 = []\n        for arg_5 in arg_0._get_paged_resource(arg_3, arg_2=arg_2):\n            arg_4.append(CanvasEnrollment(data=arg_5))\n\n        return arg_4", "path": "uw_canvas/enrollments.py", "identifier": "Enrollments.get_enrollments_for_section", "docstring": "Return a list of all enrollments for the passed section_id.\n\n        https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index", "docstring_tokens": ["Return", "a", "list", "of", "all", "enrollments", "for", "the", "passed", "section_id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 258145}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/neurommsig/export.py#L148-L156", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Extract the list of NIFT names from the BEL resource and builds a dictionary mapping from the lowercased version\n    to the uppercase version.", "language": "python", "parameters": "()", "return_statement": "return {\n        name.lower(): name\n        for name in r['Values']\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", "->", "Mapping", "[", "str", ",", "str", "]", ":", "arg_0", "=", "get_bel_resource", "(", "NIFT", ")", "return", "{", "arg_1", ".", "lower", "(", ")", ":", "arg_1", "for", "arg_1", "in", "arg_0", "[", "'Values'", "]", "}"], "function": "def Func() -> Mapping[str, str]:\n    \"\"\"Extract the list of NIFT names from the BEL resource and builds a dictionary mapping from the lowercased version\n    to the uppercase version.\n    \"\"\"\n    arg_0 = get_bel_resource(NIFT)\n    return {\n        arg_1.lower(): arg_1\n        for arg_1 in arg_0['Values']\n    }", "path": "src/pybel_tools/analysis/neurommsig/export.py", "identifier": "get_nift_values", "docstring": "Extract the list of NIFT names from the BEL resource and builds a dictionary mapping from the lowercased version\n    to the uppercase version.", "docstring_tokens": ["Extract", "the", "list", "of", "NIFT", "names", "from", "the", "BEL", "resource", "and", "builds", "a", "dictionary", "mapping", "from", "the", "lowercased", "version", "to", "the", "uppercase", "version", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 258146}
{"url": "https://github.com/bloomberg/python-github-webhook/blob/e9a70dd3a907f5c1a8f4cee190c59e4e775af37f/github_webhook/webhook.py#L43-L47", "sha": "e9a70dd3a907f5c1a8f4cee190c59e4e775af37f", "docstring_summary": "Return message digest if a secret key was provided", "language": "python", "parameters": "(self)", "return_statement": "return hmac.new(\n            self._secret, request.data, hashlib.sha1).hexdigest() if self._secret else None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "hmac", ".", "new", "(", "arg_0", ".", "_secret", ",", "request", ".", "data", ",", "hashlib", ".", "sha1", ")", ".", "hexdigest", "(", ")", "if", "arg_0", ".", "_secret", "else", "None"], "function": "def Func(arg_0):\n        \"\"\"Return message digest if a secret key was provided\"\"\"\n\n        return hmac.new(\n            arg_0._secret, request.data, hashlib.sha1).hexdigest() if arg_0._secret else None", "path": "github_webhook/webhook.py", "identifier": "Webhook._get_digest", "docstring": "Return message digest if a secret key was provided", "docstring_tokens": ["Return", "message", "digest", "if", "a", "secret", "key", "was", "provided"], "nwo": "bloomberg/python-github-webhook", "score": 0.5676004382375776, "idx": 258147}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/__init__.py#L82-L114", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Get any defined templates for configuration values.", "language": "python", "parameters": "(self)", "return_statement": "return templates", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "six", ".", "iterkeys", "(", "Task", ".", "FIELDS", ")", ":", "arg_3", "=", "'%s_template'", "%", "arg_2", "if", "arg_3", "in", "arg_0", ".", "config", ":", "arg_1", "[", "arg_2", "]", "=", "arg_0", ".", "config", ".", "get", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Get any defined templates for configuration values.\n\n        Users can override the value of any Taskwarrior field using\n        this feature on a per-key basis.  The key should be the name of\n        the field to you would like to configure the value of, followed\n        by '_template', and the value should be a Jinja template\n        generating the field's value.  As context variables, all fields\n        on the taskwarrior record are available.\n\n        For example, to prefix the returned\n        project name for tickets returned by a service with 'workproject_',\n        you could add an entry reading:\n\n            project_template = workproject_{{project}}\n\n        Or, if you'd simply like to override the returned project name\n        for all tickets incoming from a specific service, you could add\n        an entry like:\n\n            project_template = myprojectname\n\n        The above would cause all issues to recieve a project name\n        of 'myprojectname', regardless of what the project name of the\n        generated issue was.\n\n        \"\"\"\n        arg_1 = {}\n        for arg_2 in six.iterkeys(Task.FIELDS):\n            arg_3 = '%s_template' % arg_2\n            if arg_3 in arg_0.config:\n                arg_1[arg_2] = arg_0.config.get(arg_3)\n        return arg_1", "path": "bugwarrior/services/__init__.py", "identifier": "IssueService.get_templates", "docstring": "Get any defined templates for configuration values.\n\n        Users can override the value of any Taskwarrior field using\n        this feature on a per-key basis.  The key should be the name of\n        the field to you would like to configure the value of, followed\n        by '_template', and the value should be a Jinja template\n        generating the field's value.  As context variables, all fields\n        on the taskwarrior record are available.\n\n        For example, to prefix the returned\n        project name for tickets returned by a service with 'workproject_',\n        you could add an entry reading:\n\n            project_template = workproject_{{project}}\n\n        Or, if you'd simply like to override the returned project name\n        for all tickets incoming from a specific service, you could add\n        an entry like:\n\n            project_template = myprojectname\n\n        The above would cause all issues to recieve a project name\n        of 'myprojectname', regardless of what the project name of the\n        generated issue was.", "docstring_tokens": ["Get", "any", "defined", "templates", "for", "configuration", "values", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 258148}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcdb.py#L293-L326", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This gets or creates a DB cursor for the current DB connection.", "language": "python", "parameters": "(self, handle, dictcursor=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "in", "arg_0", ".", "Funcs", ":", "return", "arg_0", ".", "Funcs", "[", "arg_1", "]", "else", ":", "if", "arg_2", ":", "arg_0", ".", "Funcs", "[", "arg_1", "]", "=", "arg_0", ".", "connection", ".", "Func", "(", "Func_factory", "=", "psycopg2", ".", "extras", ".", "DictCursor", ")", "else", ":", "arg_0", ".", "Funcs", "[", "arg_1", "]", "=", "arg_0", ".", "connection", ".", "Func", "(", ")", "return", "arg_0", ".", "Funcs", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        '''This gets or creates a DB Func for the current DB connection.\n\n        Parameters\n        ----------\n\n        handle : str\n            The name of the Func to look up in the existing list or if it\n            doesn't exist, the name to be used for a new Func to be returned.\n\n        dictFunc : bool\n            If True, returns a Func where each returned row can be addressed\n            as a dictionary by column name.\n\n        Returns\n        -------\n\n        psycopg2.Cursor instance\n\n        '''\n\n        if arg_1 in arg_0.Funcs:\n\n            return arg_0.Funcs[arg_1]\n\n        else:\n            if arg_2:\n                arg_0.Funcs[arg_1] = arg_0.connection.Func(\n                    Func_factory=psycopg2.extras.DictCursor\n                )\n            else:\n                arg_0.Funcs[arg_1] = arg_0.connection.Func()\n\n            return arg_0.Funcs[arg_1]", "path": "astrobase/lcdb.py", "identifier": "LCDB.cursor", "docstring": "This gets or creates a DB cursor for the current DB connection.\n\n        Parameters\n        ----------\n\n        handle : str\n            The name of the cursor to look up in the existing list or if it\n            doesn't exist, the name to be used for a new cursor to be returned.\n\n        dictcursor : bool\n            If True, returns a cursor where each returned row can be addressed\n            as a dictionary by column name.\n\n        Returns\n        -------\n\n        psycopg2.Cursor instance", "docstring_tokens": ["This", "gets", "or", "creates", "a", "DB", "cursor", "for", "the", "current", "DB", "connection", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258149}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py#L146-L162", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns pretty-printed table of metrics.", "language": "python", "parameters": "(metrics, sigFigs=5)", "return_statement": "return table.get_string().encode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ")", ":", "assert", "len", "(", "arg_0", ")", ">", "0", ",", "\"No metrics found\"", "arg_2", "=", "PrettyTable", "(", "[", "\"Metric\"", ",", "\"mean\"", ",", "\"standard deviation\"", ",", "\"min\"", ",", "\"max\"", ",", "\"sum\"", ",", "]", ")", "for", "arg_3", "in", "arg_0", ":", "arg_2", ".", "add_row", "(", "[", "arg_3", ".", "prettyPrintTitle", "(", ")", "]", "+", "arg_3", ".", "getStats", "(", ")", ")", "return", "arg_2", ".", "get_string", "(", ")", ".", "encode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0, arg_1=5):\n    \"\"\"\n    Returns pretty-printed table of metrics.\n\n    @param metrics (list) Traces to print in table\n    @param sigFigs (int)  Number of significant figures to print\n\n    @return (string) Pretty-printed table of metrics.\n    \"\"\"\n    assert len(arg_0) > 0, \"No metrics found\"\n    arg_2 = PrettyTable([\"Metric\", \"mean\", \"standard deviation\",\n                         \"min\", \"max\", \"sum\", ])\n\n    for arg_3 in arg_0:\n      arg_2.add_row([arg_3.prettyPrintTitle()] + arg_3.getStats())\n\n    return arg_2.get_string().encode(\"utf-8\")", "path": "src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py", "identifier": "MonitorMixinBase.mmPrettyPrintMetrics", "docstring": "Returns pretty-printed table of metrics.\n\n    @param metrics (list) Traces to print in table\n    @param sigFigs (int)  Number of significant figures to print\n\n    @return (string) Pretty-printed table of metrics.", "docstring_tokens": ["Returns", "pretty", "-", "printed", "table", "of", "metrics", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258150}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/excel_utils.py#L159-L166", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return a list of not null values from the `col_name` column of `df`.", "language": "python", "parameters": "(df, col_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_check_cols", "(", "arg_0", ",", "[", "arg_1", "]", ")", "if", "'O'", "in", "arg_0", "[", "arg_1", "]", "or", "pd", ".", "np", ".", "issubdtype", "(", "arg_0", "[", "arg_1", "]", ".", "dtype", ",", "str", ")", ":", "return", "[", "arg_2", ".", "lower", "(", ")", "for", "arg_2", "in", "arg_0", "[", "pd", ".", "notnull", "(", "arg_0", ")", "]", "[", "arg_1", "]", "if", "not", "pd", ".", "isnull", "(", "arg_2", ")", "]", "else", ":", "return", "[", "arg_2", "for", "arg_2", "in", "arg_0", "[", "pd", ".", "notnull", "(", "arg_0", ")", "]", "[", "arg_1", "]", "if", "not", "pd", ".", "isnull", "(", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Return a list of not null values from the `col_name` column of `df`.\"\"\"\n    _check_cols(arg_0, [arg_1])\n\n    if 'O' in arg_0[arg_1] or pd.np.issubdtype(arg_0[arg_1].dtype, str): # if the column is of strings\n        return [arg_2.lower() for arg_2 in arg_0[pd.notnull(arg_0)][arg_1] if not pd.isnull(arg_2)]\n    else:\n        return [arg_2 for arg_2 in arg_0[pd.notnull(arg_0)][arg_1] if not pd.isnull(arg_2)]", "path": "boyle/excel_utils.py", "identifier": "col_values", "docstring": "Return a list of not null values from the `col_name` column of `df`.", "docstring_tokens": ["Return", "a", "list", "of", "not", "null", "values", "from", "the", "col_name", "column", "of", "df", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258151}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L334-L347", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Searches elasticsearch for objects with the same address, protocol, port and state.", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Service", ".", "search", "(", ")", "arg_2", "=", "arg_2", ".", "filter", "(", "\"term\"", ",", "address", "=", "arg_1", ".", "address", ")", "arg_2", "=", "arg_2", ".", "filter", "(", "\"term\"", ",", "protocol", "=", "arg_1", ".", "protocol", ")", "arg_2", "=", "arg_2", ".", "filter", "(", "\"term\"", ",", "port", "=", "arg_1", ".", "port", ")", "arg_2", "=", "arg_2", ".", "filter", "(", "\"term\"", ",", "state", "=", "arg_1", ".", "state", ")", "if", "arg_2", ".", "count", "(", ")", ":", "arg_3", "=", "arg_2", "[", "0", "]", ".", "execute", "(", ")", "[", "0", "]", "return", "arg_3", ".", "meta", ".", "id", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Searches elasticsearch for objects with the same address, protocol, port and state.\n        \"\"\"\n        arg_2 = Service.search()\n        arg_2 = arg_2.filter(\"term\", address=arg_1.address)\n        arg_2 = arg_2.filter(\"term\", protocol=arg_1.protocol)\n        arg_2 = arg_2.filter(\"term\", port=arg_1.port)\n        arg_2 = arg_2.filter(\"term\", state=arg_1.state)\n        if arg_2.count():\n            arg_3 = arg_2[0].execute()[0]\n            return arg_3.meta.id\n        else:\n            return None", "path": "jackal/core.py", "identifier": "ServiceSearch.object_to_id", "docstring": "Searches elasticsearch for objects with the same address, protocol, port and state.", "docstring_tokens": ["Searches", "elasticsearch", "for", "objects", "with", "the", "same", "address", "protocol", "port", "and", "state", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 258152}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1849-L1890", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Helper method for fetchone, which returns the next row from a buffer.\n        If the buffer is empty, attempts to paginate through the result set for\n        the next page, and load it into the buffer.", "language": "python", "parameters": "(self)", "return_statement": "return self.buffer.pop(0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "job_id", ":", "return", "None", "if", "len", "(", "arg_0", ".", "buffer", ")", "==", "0", ":", "if", "arg_0", ".", "all_pages_loaded", ":", "return", "None", "arg_1", "=", "(", "arg_0", ".", "service", ".", "jobs", "(", ")", ".", "getQueryResults", "(", "projectId", "=", "arg_0", ".", "project_id", ",", "jobId", "=", "arg_0", ".", "job_id", ",", "pageToken", "=", "arg_0", ".", "page_token", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", ")", "if", "'rows'", "in", "arg_1", "and", "arg_1", "[", "'rows'", "]", ":", "arg_0", ".", "page_token", "=", "arg_1", ".", "get", "(", "'pageToken'", ")", "arg_3", "=", "arg_1", "[", "'schema'", "]", "[", "'fields'", "]", "arg_4", "=", "[", "field", "[", "'type'", "]", "for", "field", "in", "arg_3", "]", "arg_5", "=", "arg_1", "[", "'rows'", "]", "for", "arg_6", "in", "arg_5", ":", "arg_7", "=", "(", "[", "_bq_cast", "(", "vs", "[", "'v'", "]", ",", "arg_4", "[", "idx", "]", ")", "for", "idx", ",", "vs", "in", "enumerate", "(", "arg_6", "[", "'f'", "]", ")", "]", ")", "arg_0", ".", "buffer", ".", "append", "(", "arg_7", ")", "if", "not", "arg_0", ".", "page_token", ":", "arg_0", ".", "all_pages_loaded", "=", "True", "else", ":", "arg_0", ".", "page_token", "=", "None", "arg_0", ".", "job_id", "=", "None", "arg_0", ".", "page_token", "=", "None", "return", "None", "return", "arg_0", ".", "buffer", ".", "pop", "(", "0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Helper method for fetchone, which returns the Func row from a buffer.\n        If the buffer is empty, attempts to paginate through the result set for\n        the Func page, and load it into the buffer.\n        \"\"\"\n        if not arg_0.job_id:\n            return None\n\n        if len(arg_0.buffer) == 0:\n            if arg_0.all_pages_loaded:\n                return None\n\n            arg_1 = (arg_0.service.jobs().getQueryResults(\n                projectId=arg_0.project_id,\n                jobId=arg_0.job_id,\n                pageToken=arg_0.page_token).execute(num_retries=arg_0.num_retries))\n\n            if 'rows' in arg_1 and arg_1['rows']:\n                arg_0.page_token = arg_1.get('pageToken')\n                arg_3 = arg_1['schema']['fields']\n                arg_4 = [field['type'] for field in arg_3]\n                arg_5 = arg_1['rows']\n\n                for arg_6 in arg_5:\n                    arg_7 = ([\n                        _bq_cast(vs['v'], arg_4[idx])\n                        for idx, vs in enumerate(arg_6['f'])\n                    ])\n                    arg_0.buffer.append(arg_7)\n\n                if not arg_0.page_token:\n                    arg_0.all_pages_loaded = True\n\n            else:\n                # Reset all state since we've exhausted the results.\n                arg_0.page_token = None\n                arg_0.job_id = None\n                arg_0.page_token = None\n                return None\n\n        return arg_0.buffer.pop(0)", "path": "airflow/contrib/hooks/bigquery_hook.py", "identifier": "BigQueryCursor.next", "docstring": "Helper method for fetchone, which returns the next row from a buffer.\n        If the buffer is empty, attempts to paginate through the result set for\n        the next page, and load it into the buffer.", "docstring_tokens": ["Helper", "method", "for", "fetchone", "which", "returns", "the", "next", "row", "from", "a", "buffer", ".", "If", "the", "buffer", "is", "empty", "attempts", "to", "paginate", "through", "the", "result", "set", "for", "the", "next", "page", "and", "load", "it", "into", "the", "buffer", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258153}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L194-L209", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Set the action of the item.", "language": "python", "parameters": "(self,action)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "if", "arg_0", ".", "xmlnode", ".", "hasProp", "(", "\"action\"", ")", ":", "arg_0", ".", "xmlnode", ".", "unsetProp", "(", "\"action\"", ")", "return", "if", "arg_1", "not", "in", "(", "\"remove\"", ",", "\"update\"", ")", ":", "raise", "ValueError", "(", "\"Action must be 'update' or 'remove'\"", ")", "arg_1", "=", "unicode", "(", "arg_1", ")", "arg_0", ".", "xmlnode", ".", "setProp", "(", "\"action\"", ",", "arg_1", ".", "encode", "(", "\"utf-8\"", ")", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Set the action of the item.\n\n        :Parameters:\n            - `action`: the new action or `None`.\n        :Types:\n            - `action`: `unicode`\n        \"\"\"\n        if arg_1 is None:\n            if arg_0.xmlnode.hasProp(\"action\"):\n                arg_0.xmlnode.unsetProp(\"action\")\n            return\n        if arg_1 not in (\"remove\",\"update\"):\n            raise ValueError(\"Action must be 'update' or 'remove'\")\n        arg_1 = unicode(arg_1)\n        arg_0.xmlnode.setProp(\"action\", arg_1.encode(\"utf-8\"))", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoItem.set_action", "docstring": "Set the action of the item.\n\n        :Parameters:\n            - `action`: the new action or `None`.\n        :Types:\n            - `action`: `unicode`", "docstring_tokens": ["Set", "the", "action", "of", "the", "item", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258154}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L1899-L1936", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Reduce noise in the audio signal by profiling and filtering.\n        This effect is moderately effective at removing consistent\n        background noise such as hiss or hum.", "language": "python", "parameters": "(self, profile_path, amount=0.5)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.5", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "raise", "IOError", "(", "\"profile_path {} does not exist.\"", ".", "format", "(", "arg_1", ")", ")", "if", "not", "is_number", "(", "arg_2", ")", "or", "arg_2", "<", "0", "or", "arg_2", ">", "1", ":", "raise", "ValueError", "(", "\"amount must be a number between 0 and 1.\"", ")", "arg_3", "=", "[", "'Func'", ",", "arg_1", ",", "'{:f}'", ".", "format", "(", "arg_2", ")", "]", "arg_0", ".", "effects", ".", "extend", "(", "arg_3", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=0.5):\n        '''Reduce noise in the audio signal by profiling and filtering.\n        This effect is moderately effective at removing consistent\n        background noise such as hiss or hum.\n\n        Parameters\n        ----------\n        profile_path : str\n            Path to a noise profile file.\n            This file can be generated using the `noiseprof` effect.\n        amount : float, default=0.5\n            How much noise should be removed is specified by amount. Should\n            be between 0 and 1.  Higher numbers will remove more noise but\n            present a greater likelihood  of  removing wanted  components  of\n            the  audio  signal.\n\n        See Also\n        --------\n        noiseprof\n\n        '''\n\n        if not os.path.exists(arg_1):\n            raise IOError(\n                \"profile_path {} does not exist.\".format(arg_1))\n\n        if not is_number(arg_2) or arg_2 < 0 or arg_2 > 1:\n            raise ValueError(\"amount must be a number between 0 and 1.\")\n\n        arg_3 = [\n            'Func',\n            arg_1,\n            '{:f}'.format(arg_2)\n        ]\n        arg_0.effects.extend(arg_3)\n        arg_0.effects_log.append('Func')\n\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.noisered", "docstring": "Reduce noise in the audio signal by profiling and filtering.\n        This effect is moderately effective at removing consistent\n        background noise such as hiss or hum.\n\n        Parameters\n        ----------\n        profile_path : str\n            Path to a noise profile file.\n            This file can be generated using the `noiseprof` effect.\n        amount : float, default=0.5\n            How much noise should be removed is specified by amount. Should\n            be between 0 and 1.  Higher numbers will remove more noise but\n            present a greater likelihood  of  removing wanted  components  of\n            the  audio  signal.\n\n        See Also\n        --------\n        noiseprof", "docstring_tokens": ["Reduce", "noise", "in", "the", "audio", "signal", "by", "profiling", "and", "filtering", ".", "This", "effect", "is", "moderately", "effective", "at", "removing", "consistent", "background", "noise", "such", "as", "hiss", "or", "hum", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 258155}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/server/ext_wsgiutils_server.py#L302-L327", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Handle an error gracefully.  May be overridden.", "language": "python", "parameters": "(self, request, client_address)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "sys", ".", "exc_info", "(", ")", "arg_4", "=", "arg_3", "[", "1", "]", "if", "arg_4", ".", "args", "[", "0", "]", "in", "(", "10053", ",", "10054", ")", ":", "_logger", ".", "error", "(", "\"*** Caught socket.error: {}\"", ".", "format", "(", "arg_4", ")", ")", "return", "_logger", ".", "error", "(", "\"-\"", "*", "40", ",", "file", "=", "sys", ".", "stderr", ")", "_logger", ".", "error", "(", "\"<{}> Exception happened during processing of request from {}\"", ".", "format", "(", "threading", ".", "currentThread", "(", ")", ".", "ident", ",", "arg_2", ")", ")", "_logger", ".", "error", "(", "arg_2", ",", "file", "=", "sys", ".", "stderr", ")", "traceback", ".", "print_exc", "(", ")", "_logger", ".", "error", "(", "\"-\"", "*", "40", ",", "file", "=", "sys", ".", "stderr", ")", "_logger", ".", "error", "(", "arg_1", ",", "file", "=", "sys", ".", "stderr", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle an error gracefully.  May be overridden.\n\n        The default is to _logger.info a traceback and continue.\n\n        \"\"\"\n        arg_3 = sys.exc_info()\n        arg_4 = arg_3[1]\n        # Suppress stack trace when client aborts connection disgracefully:\n        # 10053: Software caused connection abort\n        # 10054: Connection reset by peer\n        if arg_4.args[0] in (10053, 10054):\n            _logger.error(\"*** Caught socket.error: {}\".format(arg_4))\n            return\n        # This is what BaseHTTPServer.HTTPServer.Func does, but with\n        # added thread ID and using stderr\n        _logger.error(\"-\" * 40, file=sys.stderr)\n        _logger.error(\n            \"<{}> Exception happened during processing of request from {}\".format(\n                threading.currentThread().ident, arg_2\n            )\n        )\n        _logger.error(arg_2, file=sys.stderr)\n        traceback.print_exc()\n        _logger.error(\"-\" * 40, file=sys.stderr)\n        _logger.error(arg_1, file=sys.stderr)", "path": "wsgidav/server/ext_wsgiutils_server.py", "identifier": "ExtServer.handle_error", "docstring": "Handle an error gracefully.  May be overridden.\n\n        The default is to _logger.info a traceback and continue.", "docstring_tokens": ["Handle", "an", "error", "gracefully", ".", "May", "be", "overridden", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 258156}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/fields.py#L156-L181", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Return a formfield.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return super(VersatileImageField, self).formfield(**defaults)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "}", "if", "arg_0", ".", "ppoi_field", ":", "arg_2", "[", "'form_class'", "]", "=", "SizedImageCenterpointClickDjangoAdminField", "if", "arg_1", ".", "get", "(", "'widget'", ")", "is", "AdminFileWidget", ":", "del", "arg_1", "[", "'widget'", "]", "arg_2", ".", "update", "(", "arg_1", ")", "return", "super", "(", "VersatileImageField", ",", "arg_0", ")", ".", "Func", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Return a Func.\"\"\"\n        # This is a fairly standard way to set up some defaults\n        # while letting the caller override them.\n        arg_2 = {}\n        if arg_0.ppoi_field:\n            arg_2['form_class'] = SizedImageCenterpointClickDjangoAdminField\n        if arg_1.get('widget') is AdminFileWidget:\n            # Ensuring default admin widget is skipped (in favor of using\n            # SizedImageCenterpointClickDjangoAdminField's default widget as\n            # the default widget choice for use in the admin).\n            # This is for two reasons:\n            # 1. To prevent 'typical' admin users (those who want to use\n            #    the PPOI 'click' widget by default) from having to\n            #    specify a Func_overrides for each ModelAdmin class\n            #    used by each model that has a VersatileImageField.\n            # 2. If a VersatileImageField does not have a ppoi_field specified\n            #    it will 'fall back' to a ClearableFileInput anyways.\n            # If admin users do, in fact, want to force use of the\n            # AdminFileWidget they can simply subclass AdminFileWidget and\n            # specify it in their ModelAdmin.Func_overrides (though,\n            # if that's the case, why are they using VersatileImageField in\n            # the first place?)\n            del arg_1['widget']\n        arg_2.update(arg_1)\n        return super(VersatileImageField, arg_0).Func(**arg_2)", "path": "versatileimagefield/fields.py", "identifier": "VersatileImageField.formfield", "docstring": "Return a formfield.", "docstring_tokens": ["Return", "a", "formfield", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 258157}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/update/institute.py#L30-L49", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update an institute", "language": "python", "parameters": "(context, institute_id, sanger_recipient, coverage_cutoff, frequency_cutoff, \n              display_name, remove_sanger)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "LOG", ".", "info", "(", "\"Running scout update Func\"", ")", "try", ":", "arg_7", ".", "update_Func", "(", "internal_id", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", ")", "except", "Exception", "as", "err", ":", "LOG", ".", "warning", "(", "err", ")", "arg_0", ".", "abort", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, \n              arg_5, arg_6):\n    \"\"\"\n    Update an Func\n    \"\"\"\n    arg_7 = arg_0.obj['adapter']\n    LOG.info(\"Running scout update Func\")\n    \n    try:\n        arg_7.update_Func(\n            internal_id=arg_1, \n            arg_2=arg_2, \n            arg_3=arg_3, \n            arg_4=arg_4, \n            arg_5=arg_5,\n            arg_6=arg_6,\n            )\n    except Exception as err:\n        LOG.warning(err)\n        arg_0.abort()", "path": "scout/commands/update/institute.py", "identifier": "institute", "docstring": "Update an institute", "docstring_tokens": ["Update", "an", "institute"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258158}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L42-L61", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Add noise to the given input.", "language": "python", "parameters": "(input, noise=0.1, doForeground=True, doBackground=True)", "return_statement": "return input", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "if", "arg_2", "and", "arg_3", ":", "return", "numpy", ".", "abs", "(", "arg_0", "-", "(", "numpy", ".", "random", ".", "random", "(", "arg_0", ".", "shape", ")", "<", "arg_1", ")", ")", "else", ":", "if", "arg_2", ":", "return", "numpy", ".", "logical_and", "(", "arg_0", ",", "numpy", ".", "random", ".", "random", "(", "arg_0", ".", "shape", ")", ">", "arg_1", ")", "if", "arg_3", ":", "return", "numpy", ".", "logical_or", "(", "arg_0", ",", "numpy", ".", "random", ".", "random", "(", "arg_0", ".", "shape", ")", "<", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=0.1, arg_2=True, arg_3=True):\n  \"\"\"\n  Add noise to the given input.\n\n  Parameters:\n  -----------------------------------------------\n  input:         the input to add noise to\n  noise:         how much noise to add\n  doForeground:  If true, turn off some of the 1 bits in the input\n  doBackground:  If true, turn on some of the 0 bits in the input\n\n  \"\"\"\n  if arg_2 and arg_3:\n    return numpy.abs(arg_0 -  (numpy.random.random(arg_0.shape) < arg_1))\n  else:\n    if arg_2:\n      return numpy.logical_and(arg_0, numpy.random.random(arg_0.shape) > arg_1)\n    if arg_3:\n      return numpy.logical_or(arg_0, numpy.random.random(arg_0.shape) < arg_1)\n  return arg_0", "path": "src/nupic/algorithms/fdrutilities.py", "identifier": "addNoise", "docstring": "Add noise to the given input.\n\n  Parameters:\n  -----------------------------------------------\n  input:         the input to add noise to\n  noise:         how much noise to add\n  doForeground:  If true, turn off some of the 1 bits in the input\n  doBackground:  If true, turn on some of the 0 bits in the input", "docstring_tokens": ["Add", "noise", "to", "the", "given", "input", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258159}
{"url": "https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/lorem_ipsum.py#L77-L85", "sha": "e15f2e59538deb4cbfceaac314f5ea897f2d5450", "docstring_summary": "Return random sentences.", "language": "python", "parameters": "(quantity=2, as_list=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "2", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "[", "sntc", ".", "strip", "(", ")", "for", "sntc", "in", "random", ".", "sample", "(", "get_dictionary", "(", "'lorem_ipsum'", ")", ",", "arg_0", ")", "]", "if", "arg_1", ":", "return", "arg_2", "else", ":", "return", "' '", ".", "join", "(", "arg_2", ")"], "function": "def Func(arg_0=2, arg_1=False):\n    \"\"\"Return random Func.\"\"\"\n    arg_2 = [sntc.strip() for sntc in\n              random.sample(get_dictionary('lorem_ipsum'), arg_0)]\n\n    if arg_1:\n        return arg_2\n    else:\n        return ' '.join(arg_2)", "path": "forgery_py/forgery/lorem_ipsum.py", "identifier": "sentences", "docstring": "Return random sentences.", "docstring_tokens": ["Return", "random", "sentences", "."], "nwo": "pilosus/ForgeryPy3", "score": 0.3588333959790546, "idx": 258160}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/base.py#L95-L126", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Load playlists from local filepaths.", "language": "python", "parameters": "(filepaths, exclude_patterns=None, max_depth=float('inf'))", "return_statement": "return included_playlists, excluded_playlists", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "arg_3", "(", "'inf'", ")", ")", ":", "logger", ".", "info", "(", "\"Loading local playlists...\"", ")", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "arg_6", "=", "get_supported_filepaths", "(", "arg_0", ",", "SUPPORTED_PLAYLIST_FORMATS", ",", "arg_2", "=", "arg_2", ")", "arg_4", ",", "arg_5", "=", "exclude_filepaths", "(", "arg_6", ",", "arg_1", "=", "arg_1", ")", "logger", ".", "info", "(", "\"Excluded {0} local playlists\"", ".", "format", "(", "len", "(", "arg_5", ")", ")", ")", "logger", ".", "info", "(", "\"Loaded {0} local playlists\"", ".", "format", "(", "len", "(", "arg_4", ")", ")", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=arg_3('inf')):\n\t\t\"\"\"Load playlists from local filepaths.\n\n\t\tParameters:\n\t\t\tfilepaths (list or str): Filepath(s) to search for music files.\n\n\t\t\texclude_patterns (list or str): Pattern(s) to exclude.\n\t\t\t\tPatterns are Python regex patterns.\n\t\t\t\tFilepaths are excluded if they match any of the exclude patterns.\n\n\t\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\t\tDefault: No limit.\n\n\t\tReturns:\n\t\t\tA list of local playlist filepaths matching criteria\n\t\t\tand a list of local playlist filepaths excluded using exclusion criteria.\n\t\t\"\"\"\n\n\t\tlogger.info(\"Loading local playlists...\")\n\n\t\targ_4 = []\n\t\targ_5 = []\n\n\t\targ_6 = get_supported_filepaths(arg_0, SUPPORTED_PLAYLIST_FORMATS, arg_2=arg_2)\n\n\t\targ_4, arg_5 = exclude_filepaths(arg_6, arg_1=arg_1)\n\n\t\tlogger.info(\"Excluded {0} local playlists\".format(len(arg_5)))\n\t\tlogger.info(\"Loaded {0} local playlists\".format(len(arg_4)))\n\n\t\treturn arg_4, arg_5", "path": "gmusicapi_wrapper/base.py", "identifier": "_BaseWrapper.get_local_playlists", "docstring": "Load playlists from local filepaths.\n\n\t\tParameters:\n\t\t\tfilepaths (list or str): Filepath(s) to search for music files.\n\n\t\t\texclude_patterns (list or str): Pattern(s) to exclude.\n\t\t\t\tPatterns are Python regex patterns.\n\t\t\t\tFilepaths are excluded if they match any of the exclude patterns.\n\n\t\t\tmax_depth (int): The depth in the directory tree to walk.\n\t\t\t\tA depth of '0' limits the walk to the top directory.\n\t\t\t\tDefault: No limit.\n\n\t\tReturns:\n\t\t\tA list of local playlist filepaths matching criteria\n\t\t\tand a list of local playlist filepaths excluded using exclusion criteria.", "docstring_tokens": ["Load", "playlists", "from", "local", "filepaths", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 258161}
{"url": "https://github.com/vint21h/nagios-notification-google-calendar/blob/ef2b58c939d9d55a69a54b4e6a3fd9b61bde50d4/notification_google_calendar.py#L148-L170", "sha": "ef2b58c939d9d55a69a54b4e6a3fd9b61bde50d4", "docstring_summary": "Get google API credentials for user.", "language": "python", "parameters": "(options, config)", "return_statement": "return credentials", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "if", "arg_0", ".", "Func", ":", "arg_2", "=", "flow_from_clientsecrets", "(", "arg_1", "[", "\"secrets\"", "]", ",", "scope", "=", "SCOPE", ",", "redirect_uri", "=", "\"oob\"", ")", "sys", ".", "stdout", ".", "write", "(", "\"Follow this URL: {url} and grant access to calendar.\\n\"", ".", "format", "(", "url", "=", "arg_2", ".", "step1_get_authorize_url", "(", ")", ")", ")", "arg_3", "=", "raw_input", "(", "\"Enter token:\"", ")", "arg_4", "=", "arg_2", ".", "step2_exchange", "(", "arg_3", ")", "arg_5", "=", "Storage", "(", "os", ".", "path", ".", "join", "(", "arg_1", "[", "\"credentials\"", "]", ",", "\"{username}.json\"", ".", "format", "(", "username", "=", "arg_0", ".", "username", ")", ")", ")", "arg_5", ".", "put", "(", "arg_4", ")", "arg_4", ".", "set_store", "(", "arg_5", ")", "else", ":", "arg_5", "=", "Storage", "(", "os", ".", "path", ".", "join", "(", "arg_1", "[", "\"credentials\"", "]", ",", "\"{username}.json\"", ".", "format", "(", "username", "=", "arg_0", ".", "username", ")", ")", ")", "arg_4", "=", "arg_5", ".", "get", "(", ")", "except", "Exception", ",", "err", ":", "if", "not", "arg_0", ".", "quiet", ":", "sys", ".", "stderr", ".", "write", "(", "\"ERROR: Getting google API credentials error. {err}\\n\"", ".", "format", "(", "err", "=", "err", ")", ")", "sys", ".", "exit", "(", "-", "1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Get google API credentials for user.\n    \"\"\"\n\n    try:\n        if arg_0.Func:\n            arg_2 = flow_from_clientsecrets(arg_1[\"secrets\"], scope=SCOPE, redirect_uri=\"oob\")\n            sys.stdout.write(\"Follow this URL: {url} and grant access to calendar.\\n\".format(url=arg_2.step1_get_authorize_url()))\n            arg_3 = raw_input(\"Enter token:\")\n            arg_4 = arg_2.step2_exchange(arg_3)\n            arg_5 = Storage(os.path.join(arg_1[\"credentials\"], \"{username}.json\".format(username=arg_0.username)))\n            arg_5.put(arg_4)\n            arg_4.set_store(arg_5)\n        else:\n            arg_5 = Storage(os.path.join(arg_1[\"credentials\"], \"{username}.json\".format(username=arg_0.username)))\n            arg_4 = arg_5.get()\n    except Exception, err:\n        if not arg_0.quiet:\n            sys.stderr.write(\"ERROR: Getting google API credentials error. {err}\\n\".format(err=err))\n        sys.exit(-1)\n\n    return arg_4", "path": "notification_google_calendar.py", "identifier": "get_google_credentials", "docstring": "Get google API credentials for user.", "docstring_tokens": ["Get", "google", "API", "credentials", "for", "user", "."], "nwo": "vint21h/nagios-notification-google-calendar", "score": 0.16246995141409282, "idx": 258162}
{"url": "https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L294-L305", "sha": "5729c2525a8c04c185e998bd9a86233708972921", "docstring_summary": "The list of search paths. It is built from registered finders, which\n        has ``paths`` property. Can be useful for compilers to resolve internal\n        dependencies.", "language": "python", "parameters": "(self)", "return_statement": "return self._paths", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'_paths'", ")", ":", "Func", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "finders", ":", "if", "hasattr", "(", "arg_2", ",", "'paths'", ")", ":", "Func", ".", "extend", "(", "arg_2", ".", "paths", ")", "arg_0", ".", "_paths", "=", "Func", "return", "arg_0", ".", "_paths"], "function": "def Func(arg_0):\n        \"\"\"The list of search paths. It is built from registered finders, which\n        has ``paths`` property. Can be useful for compilers to resolve internal\n        dependencies.\n        \"\"\"\n        if not hasattr(arg_0, '_paths'):\n            Func = []\n            for arg_2 in arg_0.finders:\n                if hasattr(arg_2, 'paths'):\n                    Func.extend(arg_2.paths)\n            arg_0._paths = Func\n        return arg_0._paths", "path": "gears/environment.py", "identifier": "Environment.paths", "docstring": "The list of search paths. It is built from registered finders, which\n        has ``paths`` property. Can be useful for compilers to resolve internal\n        dependencies.", "docstring_tokens": ["The", "list", "of", "search", "paths", ".", "It", "is", "built", "from", "registered", "finders", "which", "has", "paths", "property", ".", "Can", "be", "useful", "for", "compilers", "to", "resolve", "internal", "dependencies", "."], "nwo": "gears/gears", "score": 0.18657722465184873, "idx": 258163}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/precomputed.py#L30-L42", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Looks up the precomputed adversarial image for a given image.", "language": "python", "parameters": "(self, a, image)", "return_statement": "return self._output_images[index]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "np", ".", "square", "(", "arg_0", ".", "_input_images", "-", "arg_2", ")", "arg_4", "=", "np", ".", "mean", "(", "arg_3", ",", "axis", "=", "tuple", "(", "range", "(", "1", ",", "arg_3", ".", "ndim", ")", ")", ")", "arg_5", "=", "np", ".", "argmin", "(", "arg_4", ")", "if", "arg_4", "[", "arg_5", "]", ">", "0", ":", "raise", "ValueError", "(", "'No precomputed output image for this image'", ")", "return", "arg_0", ".", "_output_images", "[", "arg_5", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Looks up the precomputed adversarial image for a given image.\n\n        \"\"\"\n        arg_3 = np.square(arg_0._input_images - arg_2)\n        arg_4 = np.mean(arg_3, axis=tuple(range(1, arg_3.ndim)))\n        arg_5 = np.argmin(arg_4)\n\n        # if we run into numerical problems with this approach, we might\n        # need to add a very tiny threshold here\n        if arg_4[arg_5] > 0:\n            raise ValueError('No precomputed output image for this image')\n        return arg_0._output_images[arg_5]", "path": "foolbox/attacks/precomputed.py", "identifier": "PrecomputedImagesAttack._get_output", "docstring": "Looks up the precomputed adversarial image for a given image.", "docstring_tokens": ["Looks", "up", "the", "precomputed", "adversarial", "image", "for", "a", "given", "image", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 258164}
{"url": "https://github.com/pln-fing-udelar/fast-krippendorff/blob/fbc983f206d41f76a6e8da8cabd7114941634420/krippendorff/krippendorff.py#L64-L85", "sha": "fbc983f206d41f76a6e8da8cabd7114941634420", "docstring_summary": "Random coincidence matrix.", "language": "python", "parameters": "(value_domain, n, n_v)", "return_statement": "return (n_v_column.dot(n_v_column.T) - np.eye(len(value_domain)) * n_v_column) / (n - 1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "reshape", "(", "-", "1", ",", "1", ")", "return", "(", "arg_3", ".", "dot", "(", "arg_3", ".", "T", ")", "-", "np", ".", "eye", "(", "len", "(", "arg_0", ")", ")", "*", "arg_3", ")", "/", "(", "arg_1", "-", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Random coincidence matrix.\n\n    Parameters\n    ----------\n    value_domain : array_like, with shape (V,)\n        Possible values V the units can take.\n        If the level of measurement is not nominal, it must be ordered.\n\n    n : scalar\n        Number of pairable values.\n\n    n_v : ndarray, with shape (V,)\n        Number of pairable elements for each value.\n\n    Returns\n    -------\n    e : ndarray, with shape (V, V)\n        Random coincidence matrix.\n    \"\"\"\n    arg_3 = arg_2.reshape(-1, 1)\n    return (arg_3.dot(arg_3.T) - np.eye(len(arg_0)) * arg_3) / (arg_1 - 1)", "path": "krippendorff/krippendorff.py", "identifier": "_random_coincidences", "docstring": "Random coincidence matrix.\n\n    Parameters\n    ----------\n    value_domain : array_like, with shape (V,)\n        Possible values V the units can take.\n        If the level of measurement is not nominal, it must be ordered.\n\n    n : scalar\n        Number of pairable values.\n\n    n_v : ndarray, with shape (V,)\n        Number of pairable elements for each value.\n\n    Returns\n    -------\n    e : ndarray, with shape (V, V)\n        Random coincidence matrix.", "docstring_tokens": ["Random", "coincidence", "matrix", "."], "nwo": "pln-fing-udelar/fast-krippendorff", "score": 0.28638914490610956, "idx": 258165}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/hosted_zone.py#L220-L250", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Creates an AAAA record attached to this hosted zone.", "language": "python", "parameters": "(self, name, values, ttl=60, weight=None, region=None,\n                        set_identifier=None)", "return_statement": "return self._add_record(AAAAResourceRecordSet, **values)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "60", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_0", ".", "_halt_if_already_deleted", "(", ")", "arg_2", "=", "locals", "(", ")", "del", "arg_2", "[", "'self'", "]", "return", "arg_0", ".", "_add_record", "(", "AAAAResourceRecordSet", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=60, arg_4=None, arg_5=None,\n                        arg_6=None):\n        \"\"\"\n        Creates an AAAA record attached to this hosted zone.\n\n        :param str name: The fully qualified name of the record to add.\n        :param list values: A list of value strings for the record.\n        :keyword int ttl: The time-to-live of the record (in seconds).\n        :keyword int weight: *For weighted record sets only*. Among resource record\n            sets that have the same combination of DNS name and type, a value\n            that determines what portion of traffic for the current resource\n            record set is routed to the associated location. Ranges from 0-255.\n        :keyword str region: *For latency-based record sets*. The Amazon EC2 region\n            where the resource that is specified in this resource record set\n            resides.\n        :keyword str set_identifier: *For weighted and latency resource record\n            sets only*. An identifier that differentiates among multiple\n            resource record sets that have the same combination of DNS name\n            and type. 1-128 chars.\n        :rtype: tuple\n        :returns: A tuple in the form of ``(rrset, change_info)``, where\n            ``rrset`` is the newly created AAAAResourceRecordSet instance.\n        \"\"\"\n\n        arg_0._halt_if_already_deleted()\n\n        # Grab the params/kwargs here for brevity's sake.\n        arg_2 = locals()\n        del arg_2['self']\n\n        return arg_0._add_record(AAAAResourceRecordSet, **arg_2)", "path": "route53/hosted_zone.py", "identifier": "HostedZone.create_aaaa_record", "docstring": "Creates an AAAA record attached to this hosted zone.\n\n        :param str name: The fully qualified name of the record to add.\n        :param list values: A list of value strings for the record.\n        :keyword int ttl: The time-to-live of the record (in seconds).\n        :keyword int weight: *For weighted record sets only*. Among resource record\n            sets that have the same combination of DNS name and type, a value\n            that determines what portion of traffic for the current resource\n            record set is routed to the associated location. Ranges from 0-255.\n        :keyword str region: *For latency-based record sets*. The Amazon EC2 region\n            where the resource that is specified in this resource record set\n            resides.\n        :keyword str set_identifier: *For weighted and latency resource record\n            sets only*. An identifier that differentiates among multiple\n            resource record sets that have the same combination of DNS name\n            and type. 1-128 chars.\n        :rtype: tuple\n        :returns: A tuple in the form of ``(rrset, change_info)``, where\n            ``rrset`` is the newly created AAAAResourceRecordSet instance.", "docstring_tokens": ["Creates", "an", "AAAA", "record", "attached", "to", "this", "hosted", "zone", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 258166}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L687-L697", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Add a feature to `self`.", "language": "python", "parameters": "(self,var)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "has_feature", "(", "arg_1", ")", ":", "return", "arg_2", "=", "arg_0", ".", "xmlnode", ".", "newChild", "(", "None", ",", "\"feature\"", ",", "None", ")", "arg_2", ".", "setProp", "(", "\"var\"", ",", "to_utf8", "(", "arg_1", ")", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Add a feature to `self`.\n\n        :Parameters:\n            - `var`: the feature name.\n        :Types:\n            - `var`: `unicode`\"\"\"\n        if arg_0.has_feature(arg_1):\n            return\n        arg_2=arg_0.xmlnode.newChild(None, \"feature\", None)\n        arg_2.setProp(\"var\", to_utf8(arg_1))", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoInfo.add_feature", "docstring": "Add a feature to `self`.\n\n        :Parameters:\n            - `var`: the feature name.\n        :Types:\n            - `var`: `unicode`", "docstring_tokens": ["Add", "a", "feature", "to", "self", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258167}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/ecm.py#L284-L337", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Run complete analysis and return results.", "language": "python", "parameters": "(self)", "return_statement": "return self.results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "kernel", ".", "iaca_analysis", "(", "micro_architecture", "=", "arg_0", ".", "machine", "[", "'micro-architecture'", "]", ",", "arg_2", "=", "arg_0", ".", "asm_block", ",", "pointer_increment", "=", "arg_0", ".", "pointer_increment", ",", "verbose", "=", "arg_0", ".", "verbose", ">", "2", ")", "except", "RuntimeError", "as", "e", ":", "print", "(", "\"IACA analysis failed: \"", "+", "str", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "arg_3", "=", "arg_1", "[", "'throughput'", "]", "arg_4", "=", "arg_1", "[", "'port cycles'", "]", "arg_5", "=", "arg_1", "[", "'uops'", "]", "arg_6", "=", "abs", "(", "arg_2", "[", "'pointer_increment'", "]", "//", "arg_0", ".", "kernel", ".", "datatypes_size", "[", "arg_0", ".", "kernel", ".", "datatype", "]", ")", "arg_7", "=", "arg_6", "*", "arg_0", ".", "kernel", ".", "datatypes_size", "[", "arg_0", ".", "kernel", ".", "datatype", "]", "try", ":", "arg_8", "=", "float", "(", "arg_0", ".", "machine", "[", "'cacheline size'", "]", ")", "/", "arg_7", "except", "ZeroDivisionError", "as", "e", ":", "print", "(", "\"Too small block_size / pointer_increment:\"", ",", "e", ",", "file", "=", "sys", ".", "stderr", ")", "sys", ".", "exit", "(", "1", ")", "arg_4", "=", "dict", "(", "[", "(", "i", "[", "0", "]", ",", "i", "[", "1", "]", "*", "arg_8", ")", "for", "i", "in", "list", "(", "arg_4", ".", "items", "(", ")", ")", "]", ")", "arg_5", "=", "arg_5", "*", "arg_8", "arg_9", "=", "arg_3", "*", "arg_8", "arg_10", "=", "max", "(", "[", "v", "for", "k", ",", "v", "in", "list", "(", "arg_4", ".", "items", "(", ")", ")", "if", "k", "in", "arg_0", ".", "machine", "[", "'overlapping model'", "]", "[", "'ports'", "]", "]", ")", "arg_11", "=", "max", "(", "[", "v", "for", "k", ",", "v", "in", "list", "(", "arg_4", ".", "items", "(", ")", ")", "if", "k", "in", "arg_0", ".", "machine", "[", "'non-overlapping model'", "]", "[", "'ports'", "]", "]", ")", "if", "arg_11", "<", "arg_9", ":", "arg_10", "=", "arg_9", "arg_0", ".", "results", "=", "{", "'port cycles'", ":", "arg_4", ",", "'cl throughput'", ":", "arg_0", ".", "conv_cy", "(", "arg_9", ")", ",", "'uops'", ":", "arg_5", ",", "'T_nOL'", ":", "arg_11", ",", "'T_OL'", ":", "arg_10", ",", "'IACA output'", ":", "arg_1", "[", "'output'", "]", ",", "'elements_per_block'", ":", "arg_6", ",", "'pointer_increment'", ":", "arg_2", "[", "'pointer_increment'", "]", ",", "'flops per iteration'", ":", "sum", "(", "arg_0", ".", "kernel", ".", "_flops", ".", "values", "(", ")", ")", "}", "return", "arg_0", ".", "results"], "function": "def Func(arg_0):\n        \"\"\"\n        Run complete analysis and return results.\n        \"\"\"\n        try:\n            arg_1, arg_2 =  arg_0.kernel.iaca_analysis(\n                micro_architecture=arg_0.machine['micro-architecture'],\n                arg_2=arg_0.asm_block,\n                pointer_increment=arg_0.pointer_increment,\n                verbose=arg_0.verbose > 2)\n        except RuntimeError as e:\n            print(\"IACA analysis failed: \" + str(e))\n            sys.exit(1)\n\n        arg_3 = arg_1['throughput']\n        arg_4 = arg_1['port cycles']\n        arg_5 = arg_1['uops']\n\n        # Normalize to cycles per cacheline\n        arg_6 = abs(arg_2['pointer_increment']\n                                 // arg_0.kernel.datatypes_size[arg_0.kernel.datatype])\n        arg_7 = arg_6*arg_0.kernel.datatypes_size[arg_0.kernel.datatype]\n        try:\n            arg_8 = float(arg_0.machine['cacheline size'])/arg_7\n        except ZeroDivisionError as e:\n            print(\"Too small block_size / pointer_increment:\", e, file=sys.stderr)\n            sys.exit(1)\n\n        arg_4 = dict([(i[0], i[1]*arg_8) for i in list(arg_4.items())])\n        arg_5 = arg_5*arg_8\n        arg_9 = arg_3*arg_8\n\n        # Compile most relevant information\n        arg_10 = max([v for k, v in list(arg_4.items())\n                    if k in arg_0.machine['overlapping model']['ports']])\n        arg_11 = max([v for k, v in list(arg_4.items())\n                     if k in arg_0.machine['non-overlapping model']['ports']])\n\n        # Use IACA throughput prediction if it is slower then T_nOL\n        if arg_11 < arg_9:\n            arg_10 = arg_9\n\n        # Create result dictionary\n        arg_0.results = {\n            'port cycles': arg_4,\n            'cl throughput': arg_0.conv_cy(arg_9),\n            'uops': arg_5,\n            'T_nOL': arg_11,\n            'T_OL': arg_10,\n            'IACA output': arg_1['output'],\n            'elements_per_block': arg_6,\n            'pointer_increment': arg_2['pointer_increment'],\n            'flops per iteration': sum(arg_0.kernel._flops.values())}\n        return arg_0.results", "path": "kerncraft/models/ecm.py", "identifier": "ECMCPU.analyze", "docstring": "Run complete analysis and return results.", "docstring_tokens": ["Run", "complete", "analysis", "and", "return", "results", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 258168}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L332-L345", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Add a torque to this body.", "language": "python", "parameters": "(self, torque, relative=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "ode_body", ".", "addRelTorque", "if", "arg_2", "else", "arg_0", ".", "ode_body", ".", "addTorque", "arg_3", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        '''Add a torque to this body.\n\n        Parameters\n        ----------\n        force : 3-tuple of float\n            A vector giving the torque along each world or body coordinate axis.\n        relative : bool, optional\n            If False, the torque values are assumed to be given in the world\n            coordinate frame. If True, they are assumed to be given in the\n            body-relative coordinate frame. Defaults to False.\n        '''\n        arg_3 = arg_0.ode_body.addRelTorque if arg_2 else arg_0.ode_body.addTorque\n        arg_3(arg_1)", "path": "pagoda/physics.py", "identifier": "Body.add_torque", "docstring": "Add a torque to this body.\n\n        Parameters\n        ----------\n        force : 3-tuple of float\n            A vector giving the torque along each world or body coordinate axis.\n        relative : bool, optional\n            If False, the torque values are assumed to be given in the world\n            coordinate frame. If True, they are assumed to be given in the\n            body-relative coordinate frame. Defaults to False.", "docstring_tokens": ["Add", "a", "torque", "to", "this", "body", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 258169}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/jenkins.py#L230-L241", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrieve all builds from a job", "language": "python", "parameters": "(self, job_name)", "return_statement": "return response.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "blacklist_jobs", "and", "arg_1", "in", "arg_0", ".", "blacklist_jobs", ":", "logger", ".", "warning", "(", "\"Not getting blacklisted job: %s\"", ",", "arg_1", ")", "return", "arg_2", "=", "{", "'depth'", ":", "arg_0", ".", "detail_depth", "}", "arg_3", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "\"job\"", ",", "arg_1", ",", "\"api\"", ",", "\"json\"", ")", "arg_4", "=", "arg_0", ".", "fetch", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", "return", "arg_4", ".", "text"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Retrieve all builds from a job\"\"\"\n\n        if arg_0.blacklist_jobs and arg_1 in arg_0.blacklist_jobs:\n            logger.warning(\"Not getting blacklisted job: %s\", arg_1)\n            return\n\n        arg_2 = {'depth': arg_0.detail_depth}\n        arg_3 = urijoin(arg_0.base_url, \"job\", arg_1, \"api\", \"json\")\n\n        arg_4 = arg_0.fetch(arg_3, arg_2=arg_2)\n        return arg_4.text", "path": "perceval/backends/core/jenkins.py", "identifier": "JenkinsClient.get_builds", "docstring": "Retrieve all builds from a job", "docstring_tokens": ["Retrieve", "all", "builds", "from", "a", "job"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 258170}
{"url": "https://github.com/tek/amino/blob/51b314933e047a45587a24ecff02c836706d27ff/amino/string/hues.py#L88-L93", "sha": "51b314933e047a45587a24ecff02c836706d27ff", "docstring_summary": "Remove duplicates from the stack in first-seen order.", "language": "python", "parameters": "(stack: tuple)", "return_statement": "return reduce(reducer, stack, tuple())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "arg_1", ":", "arg_2", "=", "lambda", "x", ",", "y", ":", "x", "if", "y", "in", "x", "else", "x", "+", "(", "y", ",", ")", "return", "reduce", "(", "arg_2", ",", "arg_0", ",", "arg_1", "(", ")", ")"], "function": "def Func(arg_0: arg_1) -> arg_1:\n    '''Remove duplicates from the stack in first-seen order.'''\n    # Initializes with an accumulator and then reduces the stack with first match\n    # Funclication.\n    arg_2 = lambda x, y: x if y in x else x + (y,)\n    return reduce(arg_2, arg_0, arg_1())", "path": "amino/string/hues.py", "identifier": "dedup", "docstring": "Remove duplicates from the stack in first-seen order.", "docstring_tokens": ["Remove", "duplicates", "from", "the", "stack", "in", "first", "-", "seen", "order", "."], "nwo": "tek/amino", "score": 0.2827006957945985, "idx": 258171}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/invoice.py#L76-L104", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Generates an invoice for arbitrary items, not held in a user's\n        cart.", "language": "python", "parameters": "(cls, user, due_delta, description_price_pairs)", "return_statement": "return cls._generate(user, None, min_due_time, line_items)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "arg_3", ":", "arg_7", "=", "commerce", ".", "LineItem", "(", "arg_5", "=", "arg_5", ",", "quantity", "=", "1", ",", "arg_6", "=", "Decimal", "(", "arg_6", ")", ",", "product", "=", "None", ",", ")", "arg_4", ".", "append", "(", "arg_7", ")", "arg_8", "=", "timezone", ".", "now", "(", ")", "+", "arg_2", "return", "arg_0", ".", "_generate", "(", "arg_1", ",", "None", ",", "arg_8", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        ''' Generates an invoice for arbitrary items, not held in a user's\n        cart.\n\n        Arguments:\n            user (User): The user the invoice is being generated for.\n            due_delta (datetime.timedelta): The length until the invoice is\n                due.\n            description_price_pairs ([(str, long or Decimal), ...]): A list of\n                pairs. Each pair consists of the description for each line item\n                and the price for that line item. The price will be cast to\n                Decimal.\n\n        Returns:\n            an Invoice.\n        '''\n\n        arg_4 = []\n        for arg_5, arg_6 in arg_3:\n            arg_7 = commerce.LineItem(\n                arg_5=arg_5,\n                quantity=1,\n                arg_6=Decimal(arg_6),\n                product=None,\n            )\n            arg_4.append(arg_7)\n\n        arg_8 = timezone.now() + arg_2\n        return arg_0._generate(arg_1, None, arg_8, arg_4)", "path": "registrasion/controllers/invoice.py", "identifier": "InvoiceController.manual_invoice", "docstring": "Generates an invoice for arbitrary items, not held in a user's\n        cart.\n\n        Arguments:\n            user (User): The user the invoice is being generated for.\n            due_delta (datetime.timedelta): The length until the invoice is\n                due.\n            description_price_pairs ([(str, long or Decimal), ...]): A list of\n                pairs. Each pair consists of the description for each line item\n                and the price for that line item. The price will be cast to\n                Decimal.\n\n        Returns:\n            an Invoice.", "docstring_tokens": ["Generates", "an", "invoice", "for", "arbitrary", "items", "not", "held", "in", "a", "user", "s", "cart", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 258172}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/utils.py#L672-L676", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Open a file based at the AIMA root directory.", "language": "python", "parameters": "(components, mode='r')", "return_statement": "return open(apply(os.path.join, [dir] + components), mode)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'r'", ")", ":", "import", "utils", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "utils", ".", "__file__", ")", "return", "open", "(", "apply", "(", "os", ".", "path", ".", "join", ",", "[", "arg_2", "]", "+", "arg_0", ")", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1='r'):\n    \"Open a file based at the AIMA root directory.\"\n    import utils\n    arg_2 = os.path.dirname(utils.__file__)\n    return open(apply(os.path.join, [arg_2] + arg_0), arg_1)", "path": "aima/utils.py", "identifier": "AIMAFile", "docstring": "Open a file based at the AIMA root directory.", "docstring_tokens": ["Open", "a", "file", "based", "at", "the", "AIMA", "root", "directory", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 258173}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L126-L176", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Function to create a new empty las data object", "language": "python", "parameters": "(*, point_format_id=0, file_version=None)", "return_statement": "return las12.LasData(header=header)", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", ",", "arg_0", "=", "0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "dims", ".", "raise_if_version_not_compatible_with_fmt", "(", "arg_0", ",", "arg_1", ")", "else", ":", "arg_1", "=", "dims", ".", "min_file_version_for_point_format", "(", "arg_0", ")", "arg_2", "=", "headers", ".", "HeaderFactory", ".", "new", "(", "arg_1", ")", "arg_2", ".", "point_format_id", "=", "arg_0", "if", "arg_1", ">=", "\"1.4\"", ":", "return", "las14", ".", "LasData", "(", "arg_2", "=", "arg_2", ")", "return", "las12", ".", "LasData", "(", "arg_2", "=", "arg_2", ")"], "function": "def Func(*, arg_0=0, arg_1=None):\n    \"\"\" Function to create a new empty las data object\n\n    .. note::\n\n        If you provide both point_format and file_version\n        an exception will be raised if they are not compatible\n\n    >>> las = Func(point_format_id=6,file_version=\"1.2\")\n    Traceback (most recent call last):\n     ...\n    pylas.errors.PylasError: Point format 6 is not compatible with file version 1.2\n\n\n    If you provide only the point_format the file_version will automatically\n    selected for you.\n\n    >>> las = Func(point_format_id=0)\n    >>> las.header.version == '1.2'\n    True\n\n    >>> las = Func(point_format_id=6)\n    >>> las.header.version == '1.4'\n    True\n\n\n    Parameters\n    ----------\n    point_format_id: int\n        The point format you want the created file to have\n\n    file_version: str, optional, default=None\n        The las version you want the created las to have\n\n    Returns\n    -------\n    pylas.lasdatas.base.LasBase\n       A new las data object\n\n    \"\"\"\n    if arg_1 is not None:\n        dims.raise_if_version_not_compatible_with_fmt(arg_0, arg_1)\n    else:\n        arg_1 = dims.min_file_version_for_point_format(arg_0)\n\n    arg_2 = headers.HeaderFactory.new(arg_1)\n    arg_2.point_format_id = arg_0\n\n    if arg_1 >= \"1.4\":\n        return las14.LasData(arg_2=arg_2)\n    return las12.LasData(arg_2=arg_2)", "path": "pylas/lib.py", "identifier": "create_las", "docstring": "Function to create a new empty las data object\n\n    .. note::\n\n        If you provide both point_format and file_version\n        an exception will be raised if they are not compatible\n\n    >>> las = create_las(point_format_id=6,file_version=\"1.2\")\n    Traceback (most recent call last):\n     ...\n    pylas.errors.PylasError: Point format 6 is not compatible with file version 1.2\n\n\n    If you provide only the point_format the file_version will automatically\n    selected for you.\n\n    >>> las = create_las(point_format_id=0)\n    >>> las.header.version == '1.2'\n    True\n\n    >>> las = create_las(point_format_id=6)\n    >>> las.header.version == '1.4'\n    True\n\n\n    Parameters\n    ----------\n    point_format_id: int\n        The point format you want the created file to have\n\n    file_version: str, optional, default=None\n        The las version you want the created las to have\n\n    Returns\n    -------\n    pylas.lasdatas.base.LasBase\n       A new las data object", "docstring_tokens": ["Function", "to", "create", "a", "new", "empty", "las", "data", "object"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 258174}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L377-L387", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "add additional parameters to parser", "language": "python", "parameters": "(parsers)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ":", "cli_args", ".", "add_verbose", "(", "arg_1", ")", "cli_args", ".", "add_config", "(", "arg_1", ")", "arg_1", ".", "add_argument", "(", "'--heron-dir'", ",", "default", "=", "config", ".", "get_heron_dir", "(", ")", ",", "help", "=", "'Path to Heron home directory'", ")"], "function": "def Func(arg_0):\n  '''\n  add additional parameters to parser\n  '''\n  for arg_1 in arg_0:\n    cli_args.add_verbose(arg_1)\n    cli_args.add_config(arg_1)\n    arg_1.add_argument(\n        '--heron-dir',\n        default=config.get_heron_dir(),\n        help='Path to Heron home directory')", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "add_additional_args", "docstring": "add additional parameters to parser", "docstring_tokens": ["add", "additional", "parameters", "to", "parser"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258175}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1323-L1333", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Check whether the certificate has expired.", "language": "python", "parameters": "(self)", "return_statement": "return not_after < datetime.datetime.utcnow()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_native", "(", "arg_0", ".", "get_notAfter", "(", ")", ")", "arg_2", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_1", ",", "\"%Y%m%d%H%M%SZ\"", ")", "return", "arg_2", "<", "datetime", ".", "datetime", ".", "utcnow", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Check whether the certificate has expired.\n\n        :return: ``True`` if the certificate has expired, ``False`` otherwise.\n        :rtype: bool\n        \"\"\"\n        arg_1 = _native(arg_0.get_notAfter())\n        arg_2 = datetime.datetime.strptime(arg_1, \"%Y%m%d%H%M%SZ\")\n\n        return arg_2 < datetime.datetime.utcnow()", "path": "src/OpenSSL/crypto.py", "identifier": "X509.has_expired", "docstring": "Check whether the certificate has expired.\n\n        :return: ``True`` if the certificate has expired, ``False`` otherwise.\n        :rtype: bool", "docstring_tokens": ["Check", "whether", "the", "certificate", "has", "expired", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 258176}
{"url": "https://github.com/playpauseandstop/bootstrapper/blob/b216a05f2acb0b9f4919c4e010ff7b0f63fc1393/bootstrapper.py#L473-L484", "sha": "b216a05f2acb0b9f4919c4e010ff7b0f63fc1393", "docstring_summary": "Print message via ``subprocess.call`` function.", "language": "python", "parameters": "(message=None)", "return_statement": "return subprocess.call('echo \"{0}\"'.format(message or ''), **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "{", "'stdout'", ":", "sys", ".", "stdout", ",", "'stderr'", ":", "sys", ".", "stderr", ",", "'shell'", ":", "True", "}", "return", "subprocess", ".", "call", "(", "'echo \"{0}\"'", ".", "format", "(", "arg_0", "or", "''", ")", ",", "**", "arg_1", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Print message via ``subprocess.call`` function.\n\n    This helps to ensure consistent output and avoid situations where print\n    messages actually shown after messages from all inner threads.\n\n    :param message: Text message to print.\n    \"\"\"\n    arg_1 = {'stdout': sys.stdout,\n              'stderr': sys.stderr,\n              'shell': True}\n    return subprocess.call('echo \"{0}\"'.format(arg_0 or ''), **arg_1)", "path": "bootstrapper.py", "identifier": "print_message", "docstring": "Print message via ``subprocess.call`` function.\n\n    This helps to ensure consistent output and avoid situations where print\n    messages actually shown after messages from all inner threads.\n\n    :param message: Text message to print.", "docstring_tokens": ["Print", "message", "via", "subprocess", ".", "call", "function", "."], "nwo": "playpauseandstop/bootstrapper", "score": 0.17697123869542528, "idx": 258177}
{"url": "https://github.com/evonove/django-stored-messages/blob/23b71f952d5d3fd03285f5e700879d05796ef7ba/stored_messages/templatetags/stored_messages_tags.py#L38-L49", "sha": "23b71f952d5d3fd03285f5e700879d05796ef7ba", "docstring_summary": "Renders a list of archived messages for the current user", "language": "python", "parameters": "(context, num_elements=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "if", "\"user\"", "in", "arg_0", ":", "arg_2", "=", "arg_0", "[", "\"user\"", "]", "if", "arg_2", ".", "is_authenticated", "(", ")", ":", "arg_3", "=", "MessageArchive", ".", "objects", ".", "select_related", "(", "\"message\"", ")", ".", "filter", "(", "arg_2", "=", "arg_2", ")", "return", "{", "\"messages\"", ":", "arg_3", "[", ":", "arg_1", "]", ",", "\"count\"", ":", "arg_3", ".", "count", "(", ")", ",", "}"], "function": "def Func(arg_0, arg_1=10):\n    \"\"\"\n    Renders a list of archived messages for the current user\n    \"\"\"\n    if \"user\" in arg_0:\n        arg_2 = arg_0[\"user\"]\n        if arg_2.is_authenticated():\n            arg_3 = MessageArchive.objects.select_related(\"message\").filter(arg_2=arg_2)\n            return {\n                \"messages\": arg_3[:arg_1],\n                \"count\": arg_3.count(),\n            }", "path": "stored_messages/templatetags/stored_messages_tags.py", "identifier": "stored_messages_archive", "docstring": "Renders a list of archived messages for the current user", "docstring_tokens": ["Renders", "a", "list", "of", "archived", "messages", "for", "the", "current", "user"], "nwo": "evonove/django-stored-messages", "score": 0.18816089823412419, "idx": 258178}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/python_setuptools.py#L73-L87", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Install setuptools from scratch using installer", "language": "python", "parameters": "(python_cmd, use_sudo)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "cd", "(", "\"/tmp\"", ")", ":", "download", "(", "EZ_SETUP_URL", ")", "arg_2", "=", "'%(python_cmd)s ez_setup.py'", "%", "locals", "(", ")", "if", "arg_1", ":", "run_as_root", "(", "arg_2", ")", "else", ":", "run", "(", "arg_2", ")", "run", "(", "'rm -f ez_setup.py'", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Install setuptools from scratch using installer\n    \"\"\"\n\n    with cd(\"/tmp\"):\n        download(EZ_SETUP_URL)\n\n        arg_2 = '%(python_cmd)s ez_setup.py' % locals()\n        if arg_1:\n            run_as_root(arg_2)\n        else:\n            run(arg_2)\n\n        run('rm -f ez_setup.py')", "path": "burlap/python_setuptools.py", "identifier": "_install_from_scratch", "docstring": "Install setuptools from scratch using installer", "docstring_tokens": ["Install", "setuptools", "from", "scratch", "using", "installer"], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258179}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L707-L724", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Subscribe to the data stream.", "language": "python", "parameters": "(self, timeout=FOREVER)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_3", "=", "c_int", "(", ")", "lib", ".", "lsl_Func", "(", "arg_0", ".", "obj", ",", "c_double", "(", "arg_1", ")", ",", "byref", "(", "arg_3", ")", ")", "handle_error", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Subscribe to the data stream.\n\n        All samples pushed in at the other end from this moment onwards will be \n        queued and eventually be delivered in response to pull_sample() or \n        pull_chunk() calls. Pulling a sample without some preceding Func \n        is permitted (the stream will then be opened implicitly).\n        \n        Keyword arguments:\n        timeout -- Optional timeout of the operation (default FOREVER).\n        \n        Throws a TimeoutError (if the timeout expires), or LostError (if the \n        stream source has been lost).\n\n        \"\"\"\n        arg_3 = c_int()\n        lib.lsl_Func(arg_0.obj, c_double(arg_1), byref(arg_3))\n        handle_error(arg_3)", "path": "pylsl/pylsl.py", "identifier": "StreamInlet.open_stream", "docstring": "Subscribe to the data stream.\n\n        All samples pushed in at the other end from this moment onwards will be \n        queued and eventually be delivered in response to pull_sample() or \n        pull_chunk() calls. Pulling a sample without some preceding open_stream \n        is permitted (the stream will then be opened implicitly).\n        \n        Keyword arguments:\n        timeout -- Optional timeout of the operation (default FOREVER).\n        \n        Throws a TimeoutError (if the timeout expires), or LostError (if the \n        stream source has been lost).", "docstring_tokens": ["Subscribe", "to", "the", "data", "stream", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 258180}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L167-L190", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Unencrypt data for all users.", "language": "python", "parameters": "(engine, old_crypto_factory, logger)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", ".", "info", "(", "\"Beginning re-encryption for all users.\"", ")", "for", "arg_3", "in", "all_user_ids", "(", "arg_0", ")", ":", "unencrypt_single_user", "(", "arg_0", "=", "arg_0", ",", "arg_3", "=", "arg_3", ",", "old_crypto", "=", "arg_1", "(", "arg_3", ")", ",", "arg_2", "=", "arg_2", ",", ")", "arg_2", ".", "info", "(", "\"Finished re-encryption for all users.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Unencrypt data for all users.\n\n    Parameters\n    ----------\n    engine : SQLAlchemy.engine\n        Engine encapsulating database connections.\n    old_crypto_factory : function[str -> Any]\n        A function from user_id to an object providing the interface required\n        by PostgresContentsManager.crypto.  Results of this will be used for\n        decryption of existing database content.\n    logger : logging.Logger, optional\n        A logger to user during re-encryption.\n    \"\"\"\n    arg_2.info(\"Beginning re-encryption for all users.\")\n    for arg_3 in all_user_ids(arg_0):\n        unencrypt_single_user(\n            arg_0=arg_0,\n            arg_3=arg_3,\n            old_crypto=arg_1(arg_3),\n            arg_2=arg_2,\n        )\n    arg_2.info(\"Finished re-encryption for all users.\")", "path": "pgcontents/utils/sync.py", "identifier": "unencrypt_all_users", "docstring": "Unencrypt data for all users.\n\n    Parameters\n    ----------\n    engine : SQLAlchemy.engine\n        Engine encapsulating database connections.\n    old_crypto_factory : function[str -> Any]\n        A function from user_id to an object providing the interface required\n        by PostgresContentsManager.crypto.  Results of this will be used for\n        decryption of existing database content.\n    logger : logging.Logger, optional\n        A logger to user during re-encryption.", "docstring_tokens": ["Unencrypt", "data", "for", "all", "users", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 258181}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/quantumcircuit.py#L239-L290", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Append an instruction to the end of the circuit, modifying\n        the circuit in place.", "language": "python", "parameters": "(self, instruction, qargs=None, cargs=None)", "return_statement": "return instruction", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_2", "=", "arg_2", "or", "[", "]", "arg_3", "=", "arg_3", "or", "[", "]", "if", "not", "isinstance", "(", "arg_1", ",", "Instruction", ")", "and", "hasattr", "(", "arg_1", ",", "'to_instruction'", ")", ":", "arg_1", "=", "arg_1", ".", "to_instruction", "(", ")", "if", "not", "isinstance", "(", "arg_1", ",", "Instruction", ")", ":", "raise", "QiskitError", "(", "'object is not an Instruction.'", ")", "arg_0", ".", "_check_dups", "(", "arg_2", ")", "arg_0", ".", "_check_qargs", "(", "arg_2", ")", "arg_0", ".", "_check_cargs", "(", "arg_3", ")", "if", "arg_1", ".", "num_qubits", "!=", "len", "(", "arg_2", ")", "or", "arg_1", ".", "num_clbits", "!=", "len", "(", "arg_3", ")", ":", "raise", "QiskitError", "(", "\"instruction %s with %d qubits and %d clbits \"", "\"cannot be Funced onto %d qubits and %d clbits.\"", "%", "(", "arg_1", ".", "name", ",", "arg_1", ".", "num_qubits", ",", "arg_1", ".", "num_clbits", ",", "len", "(", "arg_2", ")", ",", "len", "(", "arg_3", ")", ")", ")", "arg_4", "=", "arg_1", ",", "arg_2", ",", "arg_3", "arg_0", ".", "data", ".", "Func", "(", "arg_4", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ".", "params", ")", ":", "if", "isinstance", "(", "arg_6", ",", "Parameter", ")", ":", "arg_7", "=", "arg_0", ".", "parameters", "if", "arg_6", "in", "arg_7", ":", "arg_0", ".", "_parameter_table", "[", "arg_6", "]", ".", "Func", "(", "(", "arg_1", ",", "arg_5", ")", ")", "else", ":", "arg_0", ".", "_parameter_table", "[", "arg_6", "]", "=", "[", "(", "arg_1", ",", "arg_5", ")", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Append an instruction to the end of the circuit, modifying\n        the circuit in place.\n\n        Args:\n            instruction (Instruction or Operator): Instruction instance to Func\n            qargs (list(tuple)): qubits to attach instruction to\n            cargs (list(tuple)): clbits to attach instruction to\n\n        Returns:\n            Instruction: a handle to the instruction that was just added\n\n        Raises:\n            QiskitError: if the gate is of a different shape than the wires\n                it is being attached to.\n        \"\"\"\n        arg_2 = arg_2 or []\n        arg_3 = arg_3 or []\n\n        # Convert input to instruction\n        if not isinstance(arg_1, Instruction) and hasattr(arg_1, 'to_instruction'):\n            arg_1 = arg_1.to_instruction()\n        if not isinstance(arg_1, Instruction):\n            raise QiskitError('object is not an Instruction.')\n\n        # do some compatibility checks\n        arg_0._check_dups(arg_2)\n        arg_0._check_qargs(arg_2)\n        arg_0._check_cargs(arg_3)\n        if arg_1.num_qubits != len(arg_2) or \\\n                arg_1.num_clbits != len(arg_3):\n            raise QiskitError(\"instruction %s with %d qubits and %d clbits \"\n                              \"cannot be Funced onto %d qubits and %d clbits.\" %\n                              (arg_1.name,\n                               arg_1.num_qubits, arg_1.num_clbits,\n                               len(arg_2), len(arg_3)))\n\n        # add the instruction onto the given wires\n        arg_4 = arg_1, arg_2, arg_3\n        arg_0.data.Func(arg_4)\n\n        # track variable parameters in instruction\n        for arg_5, arg_6 in enumerate(arg_1.params):\n            if isinstance(arg_6, Parameter):\n                arg_7 = arg_0.parameters\n\n                if arg_6 in arg_7:\n                    arg_0._parameter_table[arg_6].Func((arg_1, arg_5))\n                else:\n                    arg_0._parameter_table[arg_6] = [(arg_1, arg_5)]\n\n        return arg_1", "path": "qiskit/circuit/quantumcircuit.py", "identifier": "QuantumCircuit.append", "docstring": "Append an instruction to the end of the circuit, modifying\n        the circuit in place.\n\n        Args:\n            instruction (Instruction or Operator): Instruction instance to append\n            qargs (list(tuple)): qubits to attach instruction to\n            cargs (list(tuple)): clbits to attach instruction to\n\n        Returns:\n            Instruction: a handle to the instruction that was just added\n\n        Raises:\n            QiskitError: if the gate is of a different shape than the wires\n                it is being attached to.", "docstring_tokens": ["Append", "an", "instruction", "to", "the", "end", "of", "the", "circuit", "modifying", "the", "circuit", "in", "place", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258182}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/system.py#L254-L269", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Restore Python settings to the original states", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "orig_settings", "arg_2", ".", "setrecursionlimit", "(", "arg_1", "[", "\"sys.recursionlimit\"", "]", ")", "if", "\"sys.tracebacklimit\"", "in", "arg_1", ":", "arg_2", ".", "tracebacklimit", "=", "arg_1", "[", "\"sys.tracebacklimit\"", "]", "else", ":", "if", "hasattr", "(", "arg_2", ",", "\"tracebacklimit\"", ")", ":", "del", "arg_2", ".", "tracebacklimit", "if", "\"showwarning\"", "in", "arg_1", ":", "arg_4", ".", "showwarning", "=", "arg_1", "[", "\"showwarning\"", "]", "arg_1", ".", "clear", "(", ")", "threading", ".", "stack_size", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Restore Python settings to the original states\"\"\"\n        arg_1 = arg_0.orig_settings\n        arg_2.setrecursionlimit(arg_1[\"sys.recursionlimit\"])\n\n        if \"sys.tracebacklimit\" in arg_1:\n            arg_2.tracebacklimit = arg_1[\"sys.tracebacklimit\"]\n        else:\n            if hasattr(arg_2, \"tracebacklimit\"):\n                del arg_2.tracebacklimit\n\n        if \"showwarning\" in arg_1:\n            arg_4.showwarning = arg_1[\"showwarning\"]\n\n        arg_1.clear()\n        threading.stack_size()", "path": "modelx/core/system.py", "identifier": "System.restore_python", "docstring": "Restore Python settings to the original states", "docstring_tokens": ["Restore", "Python", "settings", "to", "the", "original", "states"], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 258183}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/decompose.py#L30-L187", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Decompose a feature matrix.", "language": "python", "parameters": "(S, n_components=None, transformer=None, sort=False, fit=True, **kwargs)", "return_statement": "return components, activations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "**", "arg_5", ")", ":", "if", "arg_2", "is", "None", ":", "if", "arg_4", "is", "False", ":", "raise", "ParameterError", "(", "'fit must be True if transformer is None'", ")", "arg_2", "=", "sklearn", ".", "decomposition", ".", "NMF", "(", "arg_1", "=", "arg_1", ",", "**", "arg_5", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "shape", "[", "0", "]", "if", "arg_4", ":", "arg_6", "=", "arg_2", ".", "fit_transform", "(", "arg_0", ".", "T", ")", ".", "T", "else", ":", "arg_6", "=", "arg_2", ".", "transform", "(", "arg_0", ".", "T", ")", ".", "T", "arg_7", "=", "arg_2", ".", "components_", ".", "T", "if", "arg_3", ":", "arg_7", ",", "arg_8", "=", "util", ".", "axis_sort", "(", "arg_7", ",", "index", "=", "True", ")", "arg_6", "=", "arg_6", "[", "arg_8", "]", "return", "arg_7", ",", "arg_6"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=False, arg_4=True, **arg_5):\n    \"\"\"Decompose a feature matrix.\n\n    Given a spectrogram `S`, produce a decomposition into `components`\n    and `activations` such that `S ~= components.dot(activations)`.\n\n    By default, this is done with with non-negative matrix factorization (NMF),\n    but any `sklearn.decomposition`-type object will work.\n\n\n    Parameters\n    ----------\n    S : np.ndarray [shape=(n_features, n_samples), dtype=float]\n        The input feature matrix (e.g., magnitude spectrogram)\n\n    n_components : int > 0 [scalar] or None\n        number of desired components\n\n        if None, then `n_features` components are used\n\n    transformer : None or object\n        If None, use `sklearn.decomposition.NMF`\n\n        Otherwise, any object with a similar interface to NMF should work.\n        `transformer` must follow the scikit-learn convention, where\n        input data is `(n_samples, n_features)`.\n\n        `transformer.fit_transform()` will be run on `S.T` (not `S`),\n        the return value of which is stored (transposed) as `activations`\n\n        The components will be retrieved as `transformer.components_.T`\n\n        `S ~= np.dot(activations, transformer.components_).T`\n\n        or equivalently:\n        `S ~= np.dot(transformer.components_.T, activations.T)`\n\n    sort : bool\n        If `True`, components are sorted by ascending peak frequency.\n\n        .. note:: If used with `transformer`, sorting is applied to copies\n            of the decomposition parameters, and not to `transformer`'s\n            internal parameters.\n\n    fit : bool\n        If `True`, components are estimated from the input ``S``.\n\n        If `False`, components are assumed to be pre-computed and stored\n        in ``transformer``, and are not changed.\n\n    kwargs : Additional keyword arguments to the default transformer\n        `sklearn.decomposition.NMF`\n\n\n    Returns\n    -------\n    components: np.ndarray [shape=(n_features, n_components)]\n        matrix of components (basis elements).\n\n    activations: np.ndarray [shape=(n_components, n_samples)]\n        transformed matrix/activation matrix\n\n\n    Raises\n    ------\n    ParameterError\n        if `fit` is False and no `transformer` object is provided.\n\n\n    See Also\n    --------\n    sklearn.decomposition : SciKit-Learn matrix decomposition modules\n\n\n    Examples\n    --------\n    Decompose a magnitude spectrogram into 32 components with NMF\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> S = np.abs(librosa.stft(y))\n    >>> comps, acts = librosa.Func.Func(S, n_components=8)\n    >>> comps\n    array([[  1.876e-01,   5.559e-02, ...,   1.687e-01,   4.907e-02],\n           [  3.148e-01,   1.719e-01, ...,   2.314e-01,   9.493e-02],\n           ...,\n           [  1.561e-07,   8.564e-08, ...,   7.167e-08,   4.997e-08],\n           [  1.531e-07,   7.880e-08, ...,   5.632e-08,   4.028e-08]])\n    >>> acts\n    array([[  4.197e-05,   8.512e-03, ...,   3.056e-05,   9.159e-06],\n           [  9.568e-06,   1.718e-02, ...,   3.322e-05,   7.869e-06],\n           ...,\n           [  5.982e-05,   1.311e-02, ...,  -0.000e+00,   6.323e-06],\n           [  3.782e-05,   7.056e-03, ...,   3.290e-05,  -0.000e+00]])\n\n\n    Sort components by ascending peak frequency\n\n    >>> comps, acts = librosa.Func.Func(S, n_components=16,\n    ...                                           sort=True)\n\n\n    Or with sparse dictionary learning\n\n    >>> import sklearn.decomposition\n    >>> T = sklearn.decomposition.MiniBatchDictionaryLearning(n_components=16)\n    >>> scomps, sacts = librosa.Func.Func(S, transformer=T, sort=True)\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(10,8))\n    >>> plt.subplot(3, 1, 1)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(S,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log', x_axis='time')\n    >>> plt.title('Input spectrogram')\n    >>> plt.colorbar(format='%+2.0f dB')\n    >>> plt.subplot(3, 2, 3)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(comps,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log')\n    >>> plt.colorbar(format='%+2.0f dB')\n    >>> plt.title('Components')\n    >>> plt.subplot(3, 2, 4)\n    >>> librosa.display.specshow(acts, x_axis='time')\n    >>> plt.ylabel('Components')\n    >>> plt.title('Activations')\n    >>> plt.colorbar()\n    >>> plt.subplot(3, 1, 3)\n    >>> S_approx = comps.dot(acts)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(S_approx,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log', x_axis='time')\n    >>> plt.colorbar(format='%+2.0f dB')\n    >>> plt.title('Reconstructed spectrogram')\n    >>> plt.tight_layout()\n    \"\"\"\n\n    if arg_2 is None:\n        if arg_4 is False:\n            raise ParameterError('fit must be True if transformer is None')\n\n        arg_2 = sklearn.decomposition.NMF(arg_1=arg_1,\n                                                **arg_5)\n\n    if arg_1 is None:\n        arg_1 = arg_0.shape[0]\n\n    if arg_4:\n        arg_6 = arg_2.fit_transform(arg_0.T).T\n    else:\n        arg_6 = arg_2.transform(arg_0.T).T\n\n    arg_7 = arg_2.components_.T\n\n    if arg_3:\n        arg_7, arg_8 = util.axis_sort(arg_7, index=True)\n        arg_6 = arg_6[arg_8]\n\n    return arg_7, arg_6", "path": "librosa/decompose.py", "identifier": "decompose", "docstring": "Decompose a feature matrix.\n\n    Given a spectrogram `S`, produce a decomposition into `components`\n    and `activations` such that `S ~= components.dot(activations)`.\n\n    By default, this is done with with non-negative matrix factorization (NMF),\n    but any `sklearn.decomposition`-type object will work.\n\n\n    Parameters\n    ----------\n    S : np.ndarray [shape=(n_features, n_samples), dtype=float]\n        The input feature matrix (e.g., magnitude spectrogram)\n\n    n_components : int > 0 [scalar] or None\n        number of desired components\n\n        if None, then `n_features` components are used\n\n    transformer : None or object\n        If None, use `sklearn.decomposition.NMF`\n\n        Otherwise, any object with a similar interface to NMF should work.\n        `transformer` must follow the scikit-learn convention, where\n        input data is `(n_samples, n_features)`.\n\n        `transformer.fit_transform()` will be run on `S.T` (not `S`),\n        the return value of which is stored (transposed) as `activations`\n\n        The components will be retrieved as `transformer.components_.T`\n\n        `S ~= np.dot(activations, transformer.components_).T`\n\n        or equivalently:\n        `S ~= np.dot(transformer.components_.T, activations.T)`\n\n    sort : bool\n        If `True`, components are sorted by ascending peak frequency.\n\n        .. note:: If used with `transformer`, sorting is applied to copies\n            of the decomposition parameters, and not to `transformer`'s\n            internal parameters.\n\n    fit : bool\n        If `True`, components are estimated from the input ``S``.\n\n        If `False`, components are assumed to be pre-computed and stored\n        in ``transformer``, and are not changed.\n\n    kwargs : Additional keyword arguments to the default transformer\n        `sklearn.decomposition.NMF`\n\n\n    Returns\n    -------\n    components: np.ndarray [shape=(n_features, n_components)]\n        matrix of components (basis elements).\n\n    activations: np.ndarray [shape=(n_components, n_samples)]\n        transformed matrix/activation matrix\n\n\n    Raises\n    ------\n    ParameterError\n        if `fit` is False and no `transformer` object is provided.\n\n\n    See Also\n    --------\n    sklearn.decomposition : SciKit-Learn matrix decomposition modules\n\n\n    Examples\n    --------\n    Decompose a magnitude spectrogram into 32 components with NMF\n\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> S = np.abs(librosa.stft(y))\n    >>> comps, acts = librosa.decompose.decompose(S, n_components=8)\n    >>> comps\n    array([[  1.876e-01,   5.559e-02, ...,   1.687e-01,   4.907e-02],\n           [  3.148e-01,   1.719e-01, ...,   2.314e-01,   9.493e-02],\n           ...,\n           [  1.561e-07,   8.564e-08, ...,   7.167e-08,   4.997e-08],\n           [  1.531e-07,   7.880e-08, ...,   5.632e-08,   4.028e-08]])\n    >>> acts\n    array([[  4.197e-05,   8.512e-03, ...,   3.056e-05,   9.159e-06],\n           [  9.568e-06,   1.718e-02, ...,   3.322e-05,   7.869e-06],\n           ...,\n           [  5.982e-05,   1.311e-02, ...,  -0.000e+00,   6.323e-06],\n           [  3.782e-05,   7.056e-03, ...,   3.290e-05,  -0.000e+00]])\n\n\n    Sort components by ascending peak frequency\n\n    >>> comps, acts = librosa.decompose.decompose(S, n_components=16,\n    ...                                           sort=True)\n\n\n    Or with sparse dictionary learning\n\n    >>> import sklearn.decomposition\n    >>> T = sklearn.decomposition.MiniBatchDictionaryLearning(n_components=16)\n    >>> scomps, sacts = librosa.decompose.decompose(S, transformer=T, sort=True)\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(10,8))\n    >>> plt.subplot(3, 1, 1)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(S,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log', x_axis='time')\n    >>> plt.title('Input spectrogram')\n    >>> plt.colorbar(format='%+2.0f dB')\n    >>> plt.subplot(3, 2, 3)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(comps,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log')\n    >>> plt.colorbar(format='%+2.0f dB')\n    >>> plt.title('Components')\n    >>> plt.subplot(3, 2, 4)\n    >>> librosa.display.specshow(acts, x_axis='time')\n    >>> plt.ylabel('Components')\n    >>> plt.title('Activations')\n    >>> plt.colorbar()\n    >>> plt.subplot(3, 1, 3)\n    >>> S_approx = comps.dot(acts)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(S_approx,\n    ...                                                  ref=np.max),\n    ...                          y_axis='log', x_axis='time')\n    >>> plt.colorbar(format='%+2.0f dB')\n    >>> plt.title('Reconstructed spectrogram')\n    >>> plt.tight_layout()", "docstring_tokens": ["Decompose", "a", "feature", "matrix", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258184}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L86-L117", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a string contains start time and the secondary training job status message.", "language": "python", "parameters": "(job_description, prev_description)", "return_statement": "return '\\n'.join(status_strs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "is", "None", "or", "arg_0", ".", "get", "(", "'SecondaryStatusTransitions'", ")", "is", "None", "or", "len", "(", "arg_0", ".", "get", "(", "'SecondaryStatusTransitions'", ")", ")", "==", "0", ":", "return", "''", "arg_2", "=", "arg_1", ".", "get", "(", "'SecondaryStatusTransitions'", ")", "if", "arg_1", "is", "not", "None", "else", "None", "arg_3", "=", "len", "(", "arg_1", "[", "'SecondaryStatusTransitions'", "]", ")", "if", "arg_2", "is", "not", "None", "else", "0", "arg_4", "=", "arg_0", "[", "'SecondaryStatusTransitions'", "]", "arg_5", "=", "arg_4", "[", "-", "1", ":", "]", "if", "len", "(", "arg_4", ")", "==", "arg_3", "else", "arg_4", "[", "arg_3", "-", "len", "(", "arg_4", ")", ":", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_5", ":", "arg_8", "=", "arg_7", "[", "'StatusMessage'", "]", "arg_9", "=", "timezone", ".", "convert_to_utc", "(", "arg_0", "[", "'LastModifiedTime'", "]", ")", ".", "strftime", "(", "'%Y-%m-%d %H:%M:%S'", ")", "arg_6", ".", "append", "(", "'{} {} - {}'", ".", "format", "(", "arg_9", ",", "arg_7", "[", "'Status'", "]", ",", "arg_8", ")", ")", "return", "'\\n'", ".", "join", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns a string contains start time and the secondary training job status message.\n\n    :param job_description: Returned response from DescribeTrainingJob call\n    :type job_description: dict\n    :param prev_description: Previous job description from DescribeTrainingJob call\n    :type prev_description: dict\n\n    :return: Job status string to be printed.\n    \"\"\"\n\n    if arg_0 is None or arg_0.get('SecondaryStatusTransitions') is None\\\n            or len(arg_0.get('SecondaryStatusTransitions')) == 0:\n        return ''\n\n    arg_2 = arg_1.get('SecondaryStatusTransitions')\\\n        if arg_1 is not None else None\n    arg_3 = len(arg_1['SecondaryStatusTransitions'])\\\n        if arg_2 is not None else 0\n    arg_4 = arg_0['SecondaryStatusTransitions']\n\n    arg_5 = arg_4[-1:] if len(arg_4) == arg_3 else \\\n        arg_4[arg_3 - len(arg_4):]\n\n    arg_6 = []\n    for arg_7 in arg_5:\n        arg_8 = arg_7['StatusMessage']\n        arg_9 = timezone.convert_to_utc(arg_0['LastModifiedTime']).strftime('%Y-%m-%d %H:%M:%S')\n        arg_6.append('{} {} - {}'.format(arg_9, arg_7['Status'], arg_8))\n\n    return '\\n'.join(arg_6)", "path": "airflow/contrib/hooks/sagemaker_hook.py", "identifier": "secondary_training_status_message", "docstring": "Returns a string contains start time and the secondary training job status message.\n\n    :param job_description: Returned response from DescribeTrainingJob call\n    :type job_description: dict\n    :param prev_description: Previous job description from DescribeTrainingJob call\n    :type prev_description: dict\n\n    :return: Job status string to be printed.", "docstring_tokens": ["Returns", "a", "string", "contains", "start", "time", "and", "the", "secondary", "training", "job", "status", "message", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258185}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L535-L556", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Activity tick handler; services all activities", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "__activities", ":", "if", "not", "arg_1", ".", "iteratorHolder", "[", "0", "]", ":", "continue", "try", ":", "next", "(", "arg_1", ".", "iteratorHolder", "[", "0", "]", ")", "except", "StopIteration", ":", "arg_1", ".", "cb", "(", ")", "if", "arg_1", ".", "repeating", ":", "arg_1", ".", "iteratorHolder", "[", "0", "]", "=", "iter", "(", "xrange", "(", "arg_1", ".", "period", ")", ")", "else", ":", "arg_1", ".", "iteratorHolder", "[", "0", "]", "=", "None", "return", "True"], "function": "def Func(arg_0):\n    \"\"\" Activity Func handler; services all activities\n\n    Returns:      True if controlling iterator says it's okay to keep going;\n                  False to stop\n    \"\"\"\n\n    # Run activities whose time has come\n    for arg_1 in arg_0.__activities:\n      if not arg_1.iteratorHolder[0]:\n        continue\n\n      try:\n        next(arg_1.iteratorHolder[0])\n      except StopIteration:\n        arg_1.cb()\n        if arg_1.repeating:\n          arg_1.iteratorHolder[0] = iter(xrange(arg_1.period))\n        else:\n          arg_1.iteratorHolder[0] = None\n\n    return True", "path": "src/nupic/swarming/utils.py", "identifier": "PeriodicActivityMgr.tick", "docstring": "Activity tick handler; services all activities\n\n    Returns:      True if controlling iterator says it's okay to keep going;\n                  False to stop", "docstring_tokens": ["Activity", "tick", "handler", ";", "services", "all", "activities"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258186}
{"url": "https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L457-L495", "sha": "1ff6fe2794f8dba286b7491d1f7a4c915b8a0605", "docstring_summary": "Push a list of samples into the outlet.", "language": "python", "parameters": "(self, x, timestamp=0.0, pushthrough=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.0", ",", "arg_3", "=", "True", ")", ":", "try", ":", "arg_4", "=", "arg_0", ".", "channel_count", "*", "len", "(", "arg_1", ")", "arg_5", "=", "(", "arg_0", ".", "value_type", "*", "arg_4", ")", ".", "from_buffer", "(", "arg_1", ")", "handle_error", "(", "arg_0", ".", "do_Func", "(", "arg_0", ".", "obj", ",", "arg_5", ",", "c_long", "(", "arg_4", ")", ",", "c_double", "(", "arg_2", ")", ",", "c_int", "(", "arg_3", ")", ")", ")", "except", "TypeError", ":", "if", "len", "(", "arg_1", ")", ":", "if", "type", "(", "arg_1", "[", "0", "]", ")", "is", "list", ":", "arg_1", "=", "[", "v", "for", "sample", "in", "arg_1", "for", "v", "in", "sample", "]", "if", "arg_0", ".", "channel_format", "==", "cf_string", ":", "arg_1", "=", "[", "v", ".", "encode", "(", "'utf-8'", ")", "for", "v", "in", "arg_1", "]", "if", "len", "(", "arg_1", ")", "%", "arg_0", ".", "channel_count", "==", "0", ":", "arg_6", "=", "arg_0", ".", "value_type", "*", "len", "(", "arg_1", ")", "handle_error", "(", "arg_0", ".", "do_Func", "(", "arg_0", ".", "obj", ",", "arg_6", "(", "*", "arg_1", ")", ",", "c_long", "(", "len", "(", "arg_1", ")", ")", ",", "c_double", "(", "arg_2", ")", ",", "c_int", "(", "arg_3", ")", ")", ")", "else", ":", "raise", "ValueError", "(", "\"each sample must have the same number of \"", "\"channels.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.0, arg_3=True):\n        \"\"\"Push a list of samples into the outlet.\n\n        samples -- A list of samples, either as a list of lists or a list of  \n                   multiplexed values.\n        timestamp -- Optionally the capture time of the most recent sample, in \n                     agreement with local_clock(); if omitted, the current \n                     time is used. The time stamps of other samples are \n                     automatically derived according to the sampling rate of \n                     the stream. (default 0.0)\n        pushthrough Whether to push the chunk through to the receivers instead \n                    of buffering it with subsequent samples. Note that the \n                    chunk_size, if specified at outlet construction, takes \n                    precedence over the pushthrough flag. (default True)\n\n        \"\"\"\n        try:\n            arg_4 = arg_0.channel_count * len(arg_1)\n            arg_5 = (arg_0.value_type * arg_4).from_buffer(arg_1)\n            handle_error(arg_0.do_Func(arg_0.obj, arg_5,\n                                            c_long(arg_4),\n                                            c_double(arg_2),\n                                            c_int(arg_3)))\n        except TypeError:\n            if len(arg_1):\n                if type(arg_1[0]) is list:\n                    arg_1 = [v for sample in arg_1 for v in sample]\n                if arg_0.channel_format == cf_string:\n                    arg_1 = [v.encode('utf-8') for v in arg_1]\n                if len(arg_1) % arg_0.channel_count == 0:\n                    arg_6 = arg_0.value_type*len(arg_1)\n                    # noinspection PyCallingNonCallable\n                    handle_error(arg_0.do_Func(arg_0.obj, arg_6(*arg_1),\n                                                    c_long(len(arg_1)),\n                                                    c_double(arg_2),\n                                                    c_int(arg_3)))\n                else:\n                    raise ValueError(\"each sample must have the same number of \"\n                                     \"channels.\")", "path": "pylsl/pylsl.py", "identifier": "StreamOutlet.push_chunk", "docstring": "Push a list of samples into the outlet.\n\n        samples -- A list of samples, either as a list of lists or a list of  \n                   multiplexed values.\n        timestamp -- Optionally the capture time of the most recent sample, in \n                     agreement with local_clock(); if omitted, the current \n                     time is used. The time stamps of other samples are \n                     automatically derived according to the sampling rate of \n                     the stream. (default 0.0)\n        pushthrough Whether to push the chunk through to the receivers instead \n                    of buffering it with subsequent samples. Note that the \n                    chunk_size, if specified at outlet construction, takes \n                    precedence over the pushthrough flag. (default True)", "docstring_tokens": ["Push", "a", "list", "of", "samples", "into", "the", "outlet", "."], "nwo": "labstreaminglayer/liblsl-Python", "score": 0.5587922773655792, "idx": 258187}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_json_stream.py#L160-L172", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Use ftfy to detect the encoding of a file, based on a sample of its\n    first megabyte.", "language": "python", "parameters": "(filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "opened", ":", "arg_1", "=", "opened", ".", "read", "(", "2", "**", "20", ")", "arg_2", ",", "arg_3", "=", "ftfy", ".", "guess_bytes", "(", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Use ftfy to detect the encoding of a file, based on a sample of its\n    first megabyte.\n\n    ftfy's encoding detector is limited. The only encodings it can detect are\n    UTF-8, CESU-8, UTF-16, Windows-1252, and occasionally MacRoman. But it\n    does much better than chardet.\n    \"\"\"\n    with open(arg_0, 'rb') as opened:\n        arg_1 = opened.read(2 ** 20)\n        arg_2, arg_3 = ftfy.guess_bytes(arg_1)\n        return arg_3", "path": "luminoso_api/v4_json_stream.py", "identifier": "detect_file_encoding", "docstring": "Use ftfy to detect the encoding of a file, based on a sample of its\n    first megabyte.\n\n    ftfy's encoding detector is limited. The only encodings it can detect are\n    UTF-8, CESU-8, UTF-16, Windows-1252, and occasionally MacRoman. But it\n    does much better than chardet.", "docstring_tokens": ["Use", "ftfy", "to", "detect", "the", "encoding", "of", "a", "file", "based", "on", "a", "sample", "of", "its", "first", "megabyte", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 258188}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/__init__.py#L268-L500", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Calculates the false alarm probabilities of periodogram peaks using\n    bootstrap resampling of the magnitude time series.", "language": "python", "parameters": "(lspinfo,\n                             times,\n                             mags,\n                             errs,\n                             nbootstrap=250,\n                             magsarefluxes=False,\n                             sigclip=10.0,\n                             npeaks=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "250", ",", "arg_5", "=", "False", ",", "arg_6", "=", "10.0", ",", "arg_7", "=", "None", ")", ":", "if", "(", "arg_7", "and", "(", "0", "<", "arg_7", "<", "len", "(", "arg_0", "[", "'nbestperiods'", "]", ")", ")", ")", ":", "arg_8", "=", "arg_7", "else", ":", "LOGWARNING", "(", "'npeaks not specified or invalid, '", "'getting FAP for all %s periodogram peaks'", "%", "len", "(", "arg_0", "[", "'nbestperiods'", "]", ")", ")", "arg_8", "=", "len", "(", "arg_0", "[", "'nbestperiods'", "]", ")", "arg_9", "=", "arg_0", "[", "'nbestperiods'", "]", "[", ":", "arg_8", "]", "arg_10", "=", "arg_0", "[", "'nbestlspvals'", "]", "[", ":", "arg_8", "]", "arg_11", ",", "arg_12", ",", "arg_13", "=", "sigclip_magseries", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_14", "=", "[", "]", "arg_15", "=", "[", "]", "arg_16", "=", "[", "]", "arg_17", "=", "[", "]", "if", "len", "(", "arg_11", ")", ">", "9", "and", "len", "(", "arg_12", ")", ">", "9", "and", "len", "(", "arg_13", ")", ">", "9", ":", "for", "arg_18", ",", "arg_19", ",", "arg_20", "in", "zip", "(", "range", "(", "len", "(", "arg_9", ")", ")", ",", "arg_9", ",", "arg_10", ")", ":", "LOGINFO", "(", "'peak %s: running %s trials...'", "%", "(", "arg_18", "+", "1", ",", "arg_4", ")", ")", "arg_21", "=", "[", "]", "for", "arg_22", "in", "range", "(", "arg_4", ")", ":", "arg_23", "=", "np", ".", "random", ".", "randint", "(", "0", ",", "high", "=", "arg_2", ".", "size", ",", "size", "=", "arg_2", ".", "size", ")", "if", "'kwargs'", "in", "arg_0", ":", "arg_24", "=", "arg_0", "[", "'kwargs'", "]", "arg_24", ".", "update", "(", "{", "'magsarefluxes'", ":", "arg_5", ",", "'sigclip'", ":", "arg_6", ",", "'verbose'", ":", "False", "}", ")", "else", ":", "arg_24", "=", "{", "'magsarefluxes'", ":", "arg_5", ",", "'sigclip'", ":", "arg_6", ",", "'verbose'", ":", "False", "}", "arg_25", "=", "LSPMETHODS", "[", "arg_0", "[", "'method'", "]", "]", "(", "arg_1", ",", "arg_2", "[", "arg_23", "]", ",", "arg_3", "[", "arg_23", "]", ",", "**", "arg_24", ")", "arg_21", ".", "append", "(", "arg_25", "[", "'bestlspval'", "]", ")", "arg_21", "=", "np", ".", "array", "(", "arg_21", ")", "arg_17", ".", "append", "(", "arg_21", ")", "if", "arg_0", "[", "'method'", "]", "!=", "'pdm'", ":", "arg_26", "=", "(", "(", "1.0", "+", "arg_21", "[", "arg_21", ">", "arg_20", "]", ".", "size", ")", "/", "(", "arg_21", ".", "size", "+", "1.0", ")", ")", "else", ":", "arg_26", "=", "(", "(", "1.0", "+", "arg_21", "[", "arg_21", "<", "arg_20", "]", ".", "size", ")", "/", "(", "arg_21", ".", "size", "+", "1.0", ")", ")", "LOGINFO", "(", "'FAP for peak %s, period: %.6f = %.3g'", "%", "(", "arg_18", "+", "1", ",", "arg_19", ",", "arg_26", ")", ")", "arg_14", ".", "append", "(", "arg_20", ")", "arg_15", ".", "append", "(", "arg_19", ")", "arg_16", ".", "append", "(", "arg_26", ")", "return", "{", "'peaks'", ":", "arg_14", ",", "'periods'", ":", "arg_15", ",", "'probabilities'", ":", "arg_16", ",", "'alltrialbestpeaks'", ":", "arg_17", "}", "else", ":", "LOGERROR", "(", "'not enough mag series points to calculate periodogram'", ")", "return", "None"], "function": "def Func(arg_0,\n                             arg_1,\n                             arg_2,\n                             arg_3,\n                             arg_4=250,\n                             arg_5=False,\n                             arg_6=10.0,\n                             arg_7=None):\n    '''Calculates the false alarm probabilities of periodogram peaks using\n    bootstrap resampling of the magnitude time series.\n\n    The false alarm probability here is defined as::\n\n        (1.0 + sum(trialbestpeaks[i] > peak[j]))/(ntrialbestpeaks + 1)\n\n    for each best periodogram peak j. The index i is for each bootstrap\n    trial. This effectively gives us a significance for the peak. Smaller FAP\n    means a better chance that the peak is real.\n\n    The basic idea is to get the number of trial best peaks that are larger than\n    the current best peak and divide this by the total number of trials. The\n    distribution of these trial best peaks is obtained after scrambling the mag\n    values and rerunning the specified periodogram method for a bunch of trials.\n\n    `lspinfo` is the output dict from a periodbase periodogram function and MUST\n    contain a 'method' key that corresponds to one of the keys in the LSPMETHODS\n    dict above. This will let this function know which periodogram function to\n    run to generate the bootstrap samples. The lspinfo SHOULD also have a\n    'kwargs' key that corresponds to the input keyword arguments for the\n    periodogram function as it was run originally, to keep everything the same\n    during the bootstrap runs. If this is missing, default values will be used.\n\n    FIXME: this may not be strictly correct; must look more into bootstrap\n    significance testing. Also look into if we're doing resampling correctly for\n    time series because the samples are not iid. Look into moving block\n    bootstrap.\n\n    Parameters\n    ----------\n\n    lspinfo : dict\n        A dict of period-finder results from one of the period-finders in\n        periodbase, or your own functions, provided it's of the form and\n        contains at least the keys listed below::\n\n            {'periods': np.array of all periods searched by the period-finder,\n             'lspvals': np.array of periodogram power value for each period,\n             'bestperiod': a float value that is the period with the highest\n                           peak in the periodogram, i.e. the most-likely actual\n                           period,\n             'method': a three-letter code naming the period-finder used; must\n                       be one of the keys in the\n                       `astrobase.periodbase.METHODLABELS` dict,\n             'nbestperiods': a list of the periods corresponding to periodogram\n                             peaks (`nbestlspvals` below) to annotate on the\n                             periodogram plot so they can be called out\n                             visually,\n             'nbestlspvals': a list of the power values associated with\n                             periodogram peaks to annotate on the periodogram\n                             plot so they can be called out visually; should be\n                             the same length as `nbestperiods` above,\n             'kwargs': dict of kwargs passed to your own period-finder function}\n\n        If you provide your own function's period-finder results, you should add\n        a corresponding key for it to the LSPMETHODS dict above so the bootstrap\n        function can use it correctly. Your period-finder function should take\n        `times`, `mags`, errs and any extra parameters as kwargs and return a\n        dict of the form described above. A small worked example::\n\n            from your_module import your_periodfinder_func\n            from astrobase import periodbase\n\n            periodbase.LSPMETHODS['your-finder'] = your_periodfinder_func\n\n            # run a period-finder session\n            your_pfresults = your_periodfinder_func(times, mags, errs,\n                                                    **extra_kwargs)\n\n            # run bootstrap to find FAP\n            falsealarm_info = periodbase.Func(\n                your_pfresults,\n                times, mags, errs,\n                nbootstrap=250,\n                magsarefluxes=False,\n            )\n\n    times,mags,errs : np.arrays\n        The magnitude/flux time-series to process along with their associated\n        measurement errors.\n\n    nbootstrap : int\n        The total number of bootstrap trials to run. This is set to 250 by\n        default, but should probably be around 1000 for realistic results.\n\n    magsarefluxes : bool\n        If True, indicates the input time-series is fluxes and not mags.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    npeaks : int or None\n        The number of peaks from the list of 'nbestlspvals' in the period-finder\n        result dict to run the bootstrap for. If None, all of the peaks in this\n        list will have their FAP calculated.\n\n    Returns\n    -------\n\n    dict\n        Returns a dict of the form::\n\n            {'peaks':allpeaks,\n             'periods':allperiods,\n             'probabilities':allfaps,\n             'alltrialbestpeaks':alltrialbestpeaks}\n\n    '''\n\n    # figure out how many periods to work on\n    if (arg_7 and (0 < arg_7 < len(arg_0['nbestperiods']))):\n        arg_8 = arg_7\n    else:\n        LOGWARNING('npeaks not specified or invalid, '\n                   'getting FAP for all %s periodogram peaks' %\n                   len(arg_0['nbestperiods']))\n        arg_8 = len(arg_0['nbestperiods'])\n\n    arg_9 = arg_0['nbestperiods'][:arg_8]\n    arg_10 = arg_0['nbestlspvals'][:arg_8]\n\n    # get rid of nans first and sigclip\n    arg_11, arg_12, arg_13 = sigclip_magseries(arg_1,\n                                             arg_2,\n                                             arg_3,\n                                             arg_5=arg_5,\n                                             arg_6=arg_6)\n\n    arg_14 = []\n    arg_15 = []\n    arg_16 = []\n    arg_17 = []\n\n    # make sure there are enough points to calculate a spectrum\n    if len(arg_11) > 9 and len(arg_12) > 9 and len(arg_13) > 9:\n\n        for arg_18, arg_19, arg_20 in zip(range(len(arg_9)),\n                                     arg_9,\n                                     arg_10):\n\n            LOGINFO('peak %s: running %s trials...' % (arg_18+1, arg_4))\n\n            arg_21 = []\n\n            for arg_22 in range(arg_4):\n\n                # get a scrambled index\n                arg_23 = np.random.randint(0,\n                                           high=arg_2.size,\n                                           size=arg_2.size)\n\n\n                # get the kwargs dict out of the lspinfo\n                if 'kwargs' in arg_0:\n\n                    arg_24 = arg_0['kwargs']\n\n                    # update the kwargs with some local stuff\n                    arg_24.update({'magsarefluxes':arg_5,\n                                   'sigclip':arg_6,\n                                   'verbose':False})\n                else:\n                    arg_24 = {'magsarefluxes':arg_5,\n                              'sigclip':arg_6,\n                              'verbose':False}\n\n\n                # run the periodogram with scrambled mags and errs\n                # and the appropriate keyword arguments\n                arg_25 = LSPMETHODS[arg_0['method']](\n                    arg_1, arg_2[arg_23], arg_3[arg_23],\n                    **arg_24\n                )\n                arg_21.append(arg_25['bestlspval'])\n\n            arg_21 = np.array(arg_21)\n            arg_17.append(arg_21)\n\n            # calculate the FAP for a trial peak j = FAP[j] =\n            # (1.0 + sum(trialbestpeaks[i] > peak[j]))/(ntrialbestpeaks + 1)\n            if arg_0['method'] != 'pdm':\n                arg_26 = (\n                    (1.0 + arg_21[arg_21 > arg_20].size) /\n                    (arg_21.size + 1.0)\n                )\n            # for PDM, we're looking for a peak smaller than the best peak\n            # because values closer to 0.0 are more significant\n            else:\n                arg_26 = (\n                    (1.0 + arg_21[arg_21 < arg_20].size) /\n                    (arg_21.size + 1.0)\n                )\n\n            LOGINFO('FAP for peak %s, period: %.6f = %.3g' % (arg_18+1,\n                                                              arg_19,\n                                                              arg_26))\n\n            arg_14.append(arg_20)\n            arg_15.append(arg_19)\n            arg_16.append(arg_26)\n\n        return {'peaks':arg_14,\n                'periods':arg_15,\n                'probabilities':arg_16,\n                'alltrialbestpeaks':arg_17}\n\n    else:\n        LOGERROR('not enough mag series points to calculate periodogram')\n        return None", "path": "astrobase/periodbase/__init__.py", "identifier": "bootstrap_falsealarmprob", "docstring": "Calculates the false alarm probabilities of periodogram peaks using\n    bootstrap resampling of the magnitude time series.\n\n    The false alarm probability here is defined as::\n\n        (1.0 + sum(trialbestpeaks[i] > peak[j]))/(ntrialbestpeaks + 1)\n\n    for each best periodogram peak j. The index i is for each bootstrap\n    trial. This effectively gives us a significance for the peak. Smaller FAP\n    means a better chance that the peak is real.\n\n    The basic idea is to get the number of trial best peaks that are larger than\n    the current best peak and divide this by the total number of trials. The\n    distribution of these trial best peaks is obtained after scrambling the mag\n    values and rerunning the specified periodogram method for a bunch of trials.\n\n    `lspinfo` is the output dict from a periodbase periodogram function and MUST\n    contain a 'method' key that corresponds to one of the keys in the LSPMETHODS\n    dict above. This will let this function know which periodogram function to\n    run to generate the bootstrap samples. The lspinfo SHOULD also have a\n    'kwargs' key that corresponds to the input keyword arguments for the\n    periodogram function as it was run originally, to keep everything the same\n    during the bootstrap runs. If this is missing, default values will be used.\n\n    FIXME: this may not be strictly correct; must look more into bootstrap\n    significance testing. Also look into if we're doing resampling correctly for\n    time series because the samples are not iid. Look into moving block\n    bootstrap.\n\n    Parameters\n    ----------\n\n    lspinfo : dict\n        A dict of period-finder results from one of the period-finders in\n        periodbase, or your own functions, provided it's of the form and\n        contains at least the keys listed below::\n\n            {'periods': np.array of all periods searched by the period-finder,\n             'lspvals': np.array of periodogram power value for each period,\n             'bestperiod': a float value that is the period with the highest\n                           peak in the periodogram, i.e. the most-likely actual\n                           period,\n             'method': a three-letter code naming the period-finder used; must\n                       be one of the keys in the\n                       `astrobase.periodbase.METHODLABELS` dict,\n             'nbestperiods': a list of the periods corresponding to periodogram\n                             peaks (`nbestlspvals` below) to annotate on the\n                             periodogram plot so they can be called out\n                             visually,\n             'nbestlspvals': a list of the power values associated with\n                             periodogram peaks to annotate on the periodogram\n                             plot so they can be called out visually; should be\n                             the same length as `nbestperiods` above,\n             'kwargs': dict of kwargs passed to your own period-finder function}\n\n        If you provide your own function's period-finder results, you should add\n        a corresponding key for it to the LSPMETHODS dict above so the bootstrap\n        function can use it correctly. Your period-finder function should take\n        `times`, `mags`, errs and any extra parameters as kwargs and return a\n        dict of the form described above. A small worked example::\n\n            from your_module import your_periodfinder_func\n            from astrobase import periodbase\n\n            periodbase.LSPMETHODS['your-finder'] = your_periodfinder_func\n\n            # run a period-finder session\n            your_pfresults = your_periodfinder_func(times, mags, errs,\n                                                    **extra_kwargs)\n\n            # run bootstrap to find FAP\n            falsealarm_info = periodbase.bootstrap_falsealarmprob(\n                your_pfresults,\n                times, mags, errs,\n                nbootstrap=250,\n                magsarefluxes=False,\n            )\n\n    times,mags,errs : np.arrays\n        The magnitude/flux time-series to process along with their associated\n        measurement errors.\n\n    nbootstrap : int\n        The total number of bootstrap trials to run. This is set to 250 by\n        default, but should probably be around 1000 for realistic results.\n\n    magsarefluxes : bool\n        If True, indicates the input time-series is fluxes and not mags.\n\n    sigclip : float or int or sequence of two floats/ints or None\n        If a single float or int, a symmetric sigma-clip will be performed using\n        the number provided as the sigma-multiplier to cut out from the input\n        time-series.\n\n        If a list of two ints/floats is provided, the function will perform an\n        'asymmetric' sigma-clip. The first element in this list is the sigma\n        value to use for fainter flux/mag values; the second element in this\n        list is the sigma value to use for brighter flux/mag values. For\n        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma\n        dimmings and greater than 3-sigma brightenings. Here the meaning of\n        \"dimming\" and \"brightening\" is set by *physics* (not the magnitude\n        system), which is why the `magsarefluxes` kwarg must be correctly set.\n\n        If `sigclip` is None, no sigma-clipping will be performed, and the\n        time-series (with non-finite elems removed) will be passed through to\n        the output.\n\n    npeaks : int or None\n        The number of peaks from the list of 'nbestlspvals' in the period-finder\n        result dict to run the bootstrap for. If None, all of the peaks in this\n        list will have their FAP calculated.\n\n    Returns\n    -------\n\n    dict\n        Returns a dict of the form::\n\n            {'peaks':allpeaks,\n             'periods':allperiods,\n             'probabilities':allfaps,\n             'alltrialbestpeaks':alltrialbestpeaks}", "docstring_tokens": ["Calculates", "the", "false", "alarm", "probabilities", "of", "periodogram", "peaks", "using", "bootstrap", "resampling", "of", "the", "magnitude", "time", "series", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258189}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/obo.py#L21-L54", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Build a function that handles downloading OBO data and parsing it into a NetworkX object.", "language": "python", "parameters": "(data_url: str,\n                    data_path: str,\n                    *,\n                    preparsed_path: Optional[str] = None,\n                    )", "return_statement": "return get_obo", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ",", "*", ",", "arg_3", ":", "arg_4", "[", "arg_1", "]", "=", "None", ",", ")", "->", "Callable", "[", "[", "arg_4", "[", "arg_1", "]", ",", "arg_8", ",", "arg_8", "]", ",", "MultiDiGraph", "]", ":", "arg_5", "=", "make_downloader", "(", "arg_0", ",", "arg_2", ")", "def", "get_obo", "(", "arg_6", ":", "arg_4", "[", "arg_1", "]", "=", "None", ",", "arg_7", ":", "arg_8", "=", "True", ",", "arg_9", ":", "arg_8", "=", "False", ")", "->", "MultiDiGraph", ":", "if", "arg_3", "is", "not", "None", "and", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "return", "read_gpickle", "(", "arg_3", ")", "if", "arg_6", "is", "None", "and", "arg_7", ":", "arg_6", "=", "arg_5", "(", "arg_9", "=", "arg_9", ")", "arg_10", "=", "obonet", ".", "read_obo", "(", "arg_6", ")", "if", "arg_3", "is", "not", "None", ":", "write_gpickle", "(", "arg_10", ",", "arg_3", ")", "return", "arg_10", "return", "get_obo"], "function": "def Func(arg_0: arg_1,\n                    arg_2: arg_1,\n                    *,\n                    arg_3: arg_4[arg_1] = None,\n                    ) -> Callable[[arg_4[arg_1], arg_8, arg_8], MultiDiGraph]:\n    \"\"\"Build a function that handles downloading OBO data and parsing it into a NetworkX object.\n\n    :param data_url: The URL of the data\n    :param data_path: The path where the data should get stored\n    :param preparsed_path: The optional path to cache a pre-parsed json version\n    \"\"\"\n    arg_5 = make_downloader(arg_0, arg_2)\n\n    def get_obo(arg_6: arg_4[arg_1] = None, arg_7: arg_8 = True, arg_9: arg_8 = False) -> MultiDiGraph:\n        \"\"\"Download and parse a GO obo file with :mod:`obonet` into a MultiDiGraph.\n\n        :param url: The URL (or file path) to download.\n        :param cache: If true, the data is downloaded to the file system, else it is loaded from the internet\n        :param force_download: If true, overwrites a previously cached file\n        \"\"\"\n        if arg_3 is not None and os.path.exists(arg_3):\n            return read_gpickle(arg_3)\n\n        if arg_6 is None and arg_7:\n            arg_6 = arg_5(arg_9=arg_9)\n\n        arg_10 = obonet.read_obo(arg_6)\n\n        if arg_3 is not None:\n            write_gpickle(arg_10, arg_3)\n\n        return arg_10\n\n    return get_obo", "path": "src/bio2bel/obo.py", "identifier": "make_obo_getter", "docstring": "Build a function that handles downloading OBO data and parsing it into a NetworkX object.\n\n    :param data_url: The URL of the data\n    :param data_path: The path where the data should get stored\n    :param preparsed_path: The optional path to cache a pre-parsed json version", "docstring_tokens": ["Build", "a", "function", "that", "handles", "downloading", "OBO", "data", "and", "parsing", "it", "into", "a", "NetworkX", "object", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 258190}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/process.py#L177-L204", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "This function deal with the keystone notification.", "language": "python", "parameters": "(body, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "'event_type'", "]", "arg_3", "=", "keystone_customer_process", ".", "get", "(", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "(", "arg_0", ",", "arg_1", ")", "else", ":", "arg_4", "=", "False", "arg_5", "=", "None", "for", "arg_6", "in", "keystone_customer_process_wildcard", ".", "keys", "(", ")", ":", "if", "arg_6", ".", "match", "(", "arg_2", ")", ":", "arg_5", "=", "keystone_customer_process_wildcard", ".", "get", "(", "arg_6", ")", "arg_4", "=", "True", "break", "if", "arg_4", ":", "arg_5", "(", "arg_0", ",", "arg_1", ")", "else", ":", "default_process", "(", "arg_0", ",", "arg_1", ")", "arg_1", ".", "ack", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This function deal with the keystone notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:\n    \"\"\"\n    arg_2 = arg_0['event_type']\n    arg_3 = keystone_customer_process.get(arg_2)\n    if arg_3 is not None:\n        arg_3(arg_0, arg_1)\n    else:\n        arg_4 = False\n        arg_5 = None\n        for arg_6 in keystone_customer_process_wildcard.keys():\n            if arg_6.match(arg_2):\n                arg_5 = keystone_customer_process_wildcard.get(arg_6)\n                arg_4 = True\n                break\n        if arg_4:\n            arg_5(arg_0, arg_1)\n        else:\n            default_process(arg_0, arg_1)\n    arg_1.ack()", "path": "ternya/process.py", "identifier": "keystone_process", "docstring": "This function deal with the keystone notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:", "docstring_tokens": ["This", "function", "deal", "with", "the", "keystone", "notification", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 258191}
{"url": "https://github.com/spotify/pyschema/blob/7e6c3934150bcb040c628d74ace6caf5fcf867df/pyschema_extensions/jsonschema.py#L140-L153", "sha": "7e6c3934150bcb040c628d74ace6caf5fcf867df", "docstring_summary": "Return a root jsonschema for a given record", "language": "python", "parameters": "(record)", "return_statement": "return schema", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "SchemaGeneratorState", "(", ")", "arg_2", "=", "get_schema_dict", "(", "arg_0", ",", "arg_1", ")", "del", "arg_1", ".", "record_schemas", "[", "arg_0", ".", "_schema_name", "]", "if", "arg_1", ".", "record_schemas", ":", "arg_2", "[", "'definitions'", "]", "=", "dict", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "record_schemas", ".", "iteritems", "(", ")", ":", "arg_2", "[", "'definitions'", "]", "[", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Return a root jsonschema for a given record\n\n    A root schema includes the $schema attribute and all sub-record\n    schemas and definitions.\n    \"\"\"\n    arg_1 = SchemaGeneratorState()\n    arg_2 = get_schema_dict(arg_0, arg_1)\n    del arg_1.record_schemas[arg_0._schema_name]\n    if arg_1.record_schemas:\n        arg_2['definitions'] = dict()\n        for arg_3, arg_4 in arg_1.record_schemas.iteritems():\n            arg_2['definitions'][arg_3] = arg_4\n    return arg_2", "path": "pyschema_extensions/jsonschema.py", "identifier": "get_root_schema_dict", "docstring": "Return a root jsonschema for a given record\n\n    A root schema includes the $schema attribute and all sub-record\n    schemas and definitions.", "docstring_tokens": ["Return", "a", "root", "jsonschema", "for", "a", "given", "record"], "nwo": "spotify/pyschema", "score": 0.41017317071999654, "idx": 258192}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmparser.py#L57-L73", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Update a node in the symbol table.", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "name", "in", "arg_0", ".", "current_symtab", ":", "arg_2", "=", "arg_0", ".", "current_symtab", "[", "arg_1", ".", "name", "]", "raise", "QasmError", "(", "\"Duplicate declaration for\"", ",", "arg_1", ".", "type", "+", "\" '\"", "+", "arg_1", ".", "name", "+", "\"' at line\"", ",", "str", "(", "arg_1", ".", "line", ")", "+", "', file'", ",", "arg_1", ".", "file", "+", "'.\\nPrevious occurrence at line'", ",", "str", "(", "arg_2", ".", "line", ")", "+", "', file'", ",", "arg_2", ".", "file", ")", "arg_0", ".", "current_symtab", "[", "arg_1", ".", "name", "]", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update a node in the symbol table.\n\n        Everything in the symtab must be a node with these attributes:\n        name - the string name of the object\n        type - the string type of the object\n        line - the source line where the type was first found\n        file - the source file where the type was first found\n        \"\"\"\n        if arg_1.name in arg_0.current_symtab:\n            arg_2 = arg_0.current_symtab[arg_1.name]\n            raise QasmError(\"Duplicate declaration for\", arg_1.type + \" '\"\n                            + arg_1.name + \"' at line\", str(arg_1.line)\n                            + ', file', arg_1.file\n                            + '.\\nPrevious occurrence at line',\n                            str(arg_2.line) + ', file', arg_2.file)\n        arg_0.current_symtab[arg_1.name] = arg_1", "path": "qiskit/qasm/qasmparser.py", "identifier": "QasmParser.update_symtab", "docstring": "Update a node in the symbol table.\n\n        Everything in the symtab must be a node with these attributes:\n        name - the string name of the object\n        type - the string type of the object\n        line - the source line where the type was first found\n        file - the source file where the type was first found", "docstring_tokens": ["Update", "a", "node", "in", "the", "symbol", "table", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258193}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L452-L475", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "a task has become unreachable, send a reply with an ImpossibleDependency\n        error.", "language": "python", "parameters": "(self, msg_id, why=error.ImpossibleDependency)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "ImpossibleDependency", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "depending", ":", "arg_0", ".", "log", ".", "error", "(", "\"msg %r already failed!\"", ",", "arg_1", ")", "return", "arg_5", "=", "arg_0", ".", "depending", ".", "pop", "(", "arg_1", ")", "for", "arg_6", "in", "arg_5", ".", "dependents", ":", "if", "arg_6", "in", "arg_0", ".", "graph", ":", "arg_0", ".", "graph", "[", "arg_6", "]", ".", "remove", "(", "arg_1", ")", "try", ":", "raise", "arg_2", "(", ")", "except", ":", "arg_7", "=", "arg_3", ".", "wrap_exception", "(", ")", "arg_0", ".", "all_done", ".", "add", "(", "arg_1", ")", "arg_0", ".", "all_failed", ".", "add", "(", "arg_1", ")", "arg_8", "=", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "client_stream", ",", "'apply_reply'", ",", "arg_7", ",", "parent", "=", "arg_5", ".", "header", ",", "ident", "=", "arg_5", ".", "idents", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "mon_stream", ",", "arg_8", ",", "ident", "=", "[", "b'outtask'", "]", "+", "arg_5", ".", "idents", ")", "arg_0", ".", "update_graph", "(", "arg_1", ",", "success", "=", "False", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.ImpossibleDependency):\n        \"\"\"a task has become unreachable, send a reply with an ImpossibleDependency\n        error.\"\"\"\n        if arg_1 not in arg_0.depending:\n            arg_0.log.error(\"msg %r already failed!\", arg_1)\n            return\n        arg_5 = arg_0.depending.pop(arg_1)\n        for arg_6 in arg_5.dependents:\n            if arg_6 in arg_0.graph:\n                arg_0.graph[arg_6].remove(arg_1)\n\n        try:\n            raise arg_2()\n        except:\n            arg_7 = arg_3.wrap_exception()\n\n        arg_0.all_done.add(arg_1)\n        arg_0.all_failed.add(arg_1)\n\n        arg_8 = arg_0.session.send(arg_0.client_stream, 'apply_reply', arg_7,\n                                                parent=arg_5.header, ident=arg_5.idents)\n        arg_0.session.send(arg_0.mon_stream, arg_8, ident=[b'outtask']+arg_5.idents)\n\n        arg_0.update_graph(arg_1, success=False)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py", "identifier": "TaskScheduler.fail_unreachable", "docstring": "a task has become unreachable, send a reply with an ImpossibleDependency\n        error.", "docstring_tokens": ["a", "task", "has", "become", "unreachable", "send", "a", "reply", "with", "an", "ImpossibleDependency", "error", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258194}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/signal_optimiser.py#L75-L85", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Remove median, divide by IQR.", "language": "python", "parameters": "(s)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "sum", "(", "~", "np", ".", "isnan", "(", "arg_0", ")", ")", ">", "2", ":", "arg_1", "=", "arg_0", "[", "~", "np", ".", "isnan", "(", "arg_0", ")", "]", "arg_2", "=", "np", ".", "median", "(", "arg_1", ")", "arg_3", "=", "np", ".", "diff", "(", "np", ".", "percentile", "(", "arg_1", ",", "[", "25", ",", "75", "]", ")", ")", "return", "(", "arg_0", "-", "arg_2", ")", "/", "arg_3", "else", ":", "return", "np", ".", "full", "(", "arg_0", ".", "shape", ",", "np", ".", "nan", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Remove median, divide by IQR.\n    \"\"\"\n    if sum(~np.isnan(arg_0)) > 2:\n        arg_1 = arg_0[~np.isnan(arg_0)]\n        arg_2 = np.median(arg_1)\n        arg_3 = np.diff(np.percentile(arg_1, [25, 75]))\n        return (arg_0 - arg_2) / arg_3\n    else:\n        return np.full(arg_0.shape, np.nan)", "path": "latools/filtering/signal_optimiser.py", "identifier": "median_scaler", "docstring": "Remove median, divide by IQR.", "docstring_tokens": ["Remove", "median", "divide", "by", "IQR", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 258195}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/astrotess.py#L116-L216", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "Reads TESS Ames-format FITS light curve files.", "language": "python", "parameters": "(infile,\n                                            lctype,\n                                            cadence_min=2)", "return_statement": "return time, flux, err_flux", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", ")", ":", "warnings", ".", "warn", "(", "\"Use the astrotess.read_tess_fitslc and \"", "\"astrotess.consolidate_tess_fitslc functions instead of this function. \"", "\"This function will be removed in astrobase v0.4.2.\"", ",", "FutureWarning", ")", "if", "arg_1", "not", "in", "(", "'PDCSAP'", ",", "'SAP'", ")", ":", "raise", "ValueError", "(", "'unknown light curve type requested: %s'", "%", "arg_1", ")", "arg_3", "=", "pyfits", ".", "open", "(", "arg_0", ")", "arg_4", "=", "arg_3", "[", "0", "]", ".", "header", "arg_5", "=", "arg_3", "[", "1", "]", ".", "header", "arg_6", "=", "arg_3", "[", "1", "]", ".", "data", "if", "(", "(", "'Ames'", "not", "in", "arg_4", "[", "'ORIGIN'", "]", ")", "or", "(", "'LIGHTCURVE'", "not", "in", "arg_5", "[", "'EXTNAME'", "]", ")", ")", ":", "raise", "ValueError", "(", "'could not understand input LC format. '", "'Is it a TESS TOI LC file?'", ")", "arg_7", "=", "arg_6", "[", "'TIME'", "]", "arg_8", "=", "arg_6", "[", "'{:s}_FLUX'", ".", "format", "(", "arg_1", ")", "]", "arg_9", "=", "arg_6", "[", "'{:s}_FLUX_ERR'", ".", "format", "(", "arg_1", ")", "]", "arg_10", "=", "(", "arg_6", "[", "'QUALITY'", "]", "==", "0", ")", "arg_10", "&=", "np", ".", "isfinite", "(", "arg_7", ")", "arg_10", "&=", "np", ".", "isfinite", "(", "arg_8", ")", "arg_10", "&=", "np", ".", "isfinite", "(", "arg_9", ")", "arg_10", "&=", "~", "np", ".", "isnan", "(", "arg_7", ")", "arg_10", "&=", "~", "np", ".", "isnan", "(", "arg_8", ")", "arg_10", "&=", "~", "np", ".", "isnan", "(", "arg_9", ")", "arg_10", "&=", "(", "arg_7", "!=", "0", ")", "arg_10", "&=", "(", "arg_8", "!=", "0", ")", "arg_10", "&=", "(", "arg_9", "!=", "0", ")", "arg_7", "=", "arg_7", "[", "arg_10", "]", "arg_8", "=", "arg_8", "[", "arg_10", "]", "arg_9", "=", "arg_9", "[", "arg_10", "]", "arg_11", "=", "np", ".", "abs", "(", "np", ".", "nanmedian", "(", "np", ".", "diff", "(", "arg_7", ")", ")", "*", "24", "*", "60", "-", "arg_2", ")", "if", "arg_11", ">", "1.0e-2", ":", "raise", "ValueError", "(", "'the light curve is not at the required cadence specified: %.2f'", "%", "arg_2", ")", "arg_12", "=", "np", ".", "nanmedian", "(", "arg_8", ")", "arg_8", "/=", "arg_12", "arg_9", "/=", "arg_12", "return", "arg_7", ",", "arg_8", ",", "arg_9"], "function": "def Func(arg_0,\n                                            arg_1,\n                                            arg_2=2):\n    '''Reads TESS Ames-format FITS light curve files.\n\n    MIT TOI alerts include Ames lightcurve files. This function gets the finite,\n    nonzero times, fluxes, and errors with QUALITY == 0.\n\n    NOTE: the PDCSAP lightcurve typically still need \"pre-whitening\" after this\n    step.\n\n    .. deprecated:: 0.3.20\n        This function will be removed in astrobase v0.4.2. Use the\n        `read_tess_fitslc` and `consolidate_tess_fitslc` functions instead.\n\n    Parameters\n    ----------\n\n    infile : str\n        The path to `*.fits.gz` TOI alert file, from Ames pipeline.\n\n    lctype : {'PDCSAP','SAP'}\n        The type of light curve to extract from the FITS LC file.\n\n    cadence_min : int\n        The expected frame cadence in units of minutes. Raises ValueError if you\n        use the wrong cadence.\n\n    Returns\n    -------\n\n    tuple\n        The tuple returned is of the form:\n\n        (times, normalized (to median) fluxes, flux errors)\n\n    '''\n\n    warnings.warn(\n        \"Use the astrotess.read_tess_fitslc and \"\n        \"astrotess.consolidate_tess_fitslc functions instead of this function. \"\n        \"This function will be removed in astrobase v0.4.2.\",\n        FutureWarning\n    )\n\n    if arg_1 not in ('PDCSAP','SAP'):\n        raise ValueError('unknown light curve type requested: %s' % arg_1)\n\n    arg_3 = pyfits.open(arg_0)\n\n    arg_4 = arg_3[0].header\n    arg_5 = arg_3[1].header\n    arg_6 = arg_3[1].data\n\n    if (('Ames' not in arg_4['ORIGIN']) or\n        ('LIGHTCURVE' not in arg_5['EXTNAME'])):\n        raise ValueError(\n            'could not understand input LC format. '\n            'Is it a TESS TOI LC file?'\n        )\n\n    arg_7 = arg_6['TIME']\n    arg_8 = arg_6['{:s}_FLUX'.format(arg_1)]\n    arg_9 = arg_6['{:s}_FLUX_ERR'.format(arg_1)]\n\n    # REMOVE POINTS FLAGGED WITH:\n    # attitude tweaks, safe mode, coarse/earth pointing, argabrithening events,\n    # reaction wheel desaturation events, cosmic rays in optimal aperture\n    # pixels, manual excludes, discontinuities, stray light from Earth or Moon\n    # in camera FoV.\n    # (Note: it's not clear to me what a lot of these mean. Also most of these\n    # columns are probably not correctly propagated right now.)\n    arg_10 = (arg_6['QUALITY'] == 0)\n    arg_10 &= np.isfinite(arg_7)\n    arg_10 &= np.isfinite(arg_8)\n    arg_10 &= np.isfinite(arg_9)\n    arg_10 &= ~np.isnan(arg_7)\n    arg_10 &= ~np.isnan(arg_8)\n    arg_10 &= ~np.isnan(arg_9)\n    arg_10 &= (arg_7 != 0)\n    arg_10 &= (arg_8 != 0)\n    arg_10 &= (arg_9 != 0)\n\n    arg_7 = arg_7[arg_10]\n    arg_8 = arg_8[arg_10]\n    arg_9 = arg_9[arg_10]\n\n    # ensure desired cadence\n    arg_11 = np.abs(np.nanmedian(np.diff(arg_7))*24*60 - arg_2)\n\n    if arg_11 > 1.0e-2:\n        raise ValueError(\n            'the light curve is not at the required cadence specified: %.2f' %\n            arg_2\n        )\n\n    arg_12 = np.nanmedian(arg_8)\n    arg_8 /= arg_12\n    arg_9 /= arg_12\n\n    return arg_7, arg_8, arg_9", "path": "astrobase/astrotess.py", "identifier": "get_time_flux_errs_from_Ames_lightcurve", "docstring": "Reads TESS Ames-format FITS light curve files.\n\n    MIT TOI alerts include Ames lightcurve files. This function gets the finite,\n    nonzero times, fluxes, and errors with QUALITY == 0.\n\n    NOTE: the PDCSAP lightcurve typically still need \"pre-whitening\" after this\n    step.\n\n    .. deprecated:: 0.3.20\n        This function will be removed in astrobase v0.4.2. Use the\n        `read_tess_fitslc` and `consolidate_tess_fitslc` functions instead.\n\n    Parameters\n    ----------\n\n    infile : str\n        The path to `*.fits.gz` TOI alert file, from Ames pipeline.\n\n    lctype : {'PDCSAP','SAP'}\n        The type of light curve to extract from the FITS LC file.\n\n    cadence_min : int\n        The expected frame cadence in units of minutes. Raises ValueError if you\n        use the wrong cadence.\n\n    Returns\n    -------\n\n    tuple\n        The tuple returned is of the form:\n\n        (times, normalized (to median) fluxes, flux errors)", "docstring_tokens": ["Reads", "TESS", "Ames", "-", "format", "FITS", "light", "curve", "files", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258196}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/export/gene.py#L5-L10", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Export all genes from the database", "language": "python", "parameters": "(adapter, build='37')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'37'", ")", ":", "LOG", ".", "info", "(", "\"Exporting all genes to .bed format\"", ")", "for", "arg_2", "in", "arg_0", ".", "all_genes", "(", "arg_1", "=", "arg_1", ")", ":", "yield", "arg_2"], "function": "def Func(arg_0, arg_1='37'):\n    \"\"\"Export all genes from the database\"\"\"\n    LOG.info(\"Exporting all genes to .bed format\")\n    \n    for arg_2 in arg_0.all_genes(arg_1=arg_1):\n        yield arg_2", "path": "scout/export/gene.py", "identifier": "export_genes", "docstring": "Export all genes from the database", "docstring_tokens": ["Export", "all", "genes", "from", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258197}
{"url": "https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L360-L369", "sha": "ce2cf3f1425d02ba4f3ad3202cfca43a1892558a", "docstring_summary": "Create a secret link from request.", "language": "python", "parameters": "(self, title, description=None, expires_at=None)", "return_statement": "return self.link", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "link", "=", "SecretLink", ".", "create", "(", "arg_1", ",", "arg_0", ".", "receiver", ",", "extra_data", "=", "dict", "(", "recid", "=", "arg_0", ".", "recid", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", ")", "return", "arg_0", ".", "link"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Create a secret link from request.\"\"\"\n        arg_0.link = SecretLink.create(\n            arg_1,\n            arg_0.receiver,\n            extra_data=dict(recid=arg_0.recid),\n            arg_2=arg_2,\n            arg_3=arg_3,\n        )\n        return arg_0.link", "path": "zenodo_accessrequests/models.py", "identifier": "AccessRequest.create_secret_link", "docstring": "Create a secret link from request.", "docstring_tokens": ["Create", "a", "secret", "link", "from", "request", "."], "nwo": "zenodo/zenodo-accessrequests", "score": 0.2718259314615454, "idx": 258198}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/coordutils.py#L763-L794", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This converts from equatorial coords to galactic coords.", "language": "python", "parameters": "(ra, decl, equinox='J2000')", "return_statement": "return gl, gb", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'J2000'", ")", ":", "arg_3", "=", "SkyCoord", "(", "arg_0", "=", "arg_0", "*", "u", ".", "degree", ",", "dec", "=", "arg_1", "*", "u", ".", "degree", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "arg_3", ".", "galactic", ".", "l", ".", "degree", "arg_5", "=", "arg_3", ".", "galactic", ".", "b", ".", "degree", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2='J2000'):\n    '''This converts from equatorial coords to galactic coords.\n\n    Parameters\n    ----------\n\n    ra : float or array-like\n        Right ascension values(s) in decimal degrees.\n\n    decl : float or array-like\n        Declination value(s) in decimal degrees.\n\n    equinox : str\n        The equinox that the coordinates are measured at. This must be\n        recognizable by Astropy's `SkyCoord` class.\n\n    Returns\n    -------\n\n    tuple of (float, float) or tuple of (np.array, np.array)\n        The galactic coordinates (l, b) for each element of the input\n        (`ra`, `decl`).\n\n    '''\n\n    # convert the ra/decl to gl, gb\n    arg_3 = SkyCoord(arg_0=arg_0*u.degree, dec=arg_1*u.degree, arg_2=arg_2)\n\n    arg_4 = arg_3.galactic.l.degree\n    arg_5 = arg_3.galactic.b.degree\n\n    return arg_4, arg_5", "path": "astrobase/coordutils.py", "identifier": "equatorial_to_galactic", "docstring": "This converts from equatorial coords to galactic coords.\n\n    Parameters\n    ----------\n\n    ra : float or array-like\n        Right ascension values(s) in decimal degrees.\n\n    decl : float or array-like\n        Declination value(s) in decimal degrees.\n\n    equinox : str\n        The equinox that the coordinates are measured at. This must be\n        recognizable by Astropy's `SkyCoord` class.\n\n    Returns\n    -------\n\n    tuple of (float, float) or tuple of (np.array, np.array)\n        The galactic coordinates (l, b) for each element of the input\n        (`ra`, `decl`).", "docstring_tokens": ["This", "converts", "from", "equatorial", "coords", "to", "galactic", "coords", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258199}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L555-L562", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "In the leftmost empty column, try all non-conflicting rows.", "language": "python", "parameters": "(self, state)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "[", "-", "1", "]", "is", "not", "None", ":", "return", "[", "]", "else", ":", "arg_2", "=", "arg_1", ".", "index", "(", "None", ")", "return", "[", "arg_3", "for", "arg_3", "in", "range", "(", "arg_0", ".", "N", ")", "if", "not", "arg_0", ".", "conflicted", "(", "arg_1", ",", "arg_3", ",", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1):\n        \"In the leftmost empty column, try all non-conflicting rows.\"\n        if arg_1[-1] is not None:\n            return []  # All columns filled; no successors\n        else:\n            arg_2 = arg_1.index(None)\n            return [arg_3 for arg_3 in range(arg_0.N)\n                    if not arg_0.conflicted(arg_1, arg_3, arg_2)]", "path": "aima/search.py", "identifier": "NQueensProblem.actions", "docstring": "In the leftmost empty column, try all non-conflicting rows.", "docstring_tokens": ["In", "the", "leftmost", "empty", "column", "try", "all", "non", "-", "conflicting", "rows", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 258200}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L34-L52", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Sets the item at index 'n' to be the selected item.", "language": "python", "parameters": "(self, index, dummy=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "wx_obj", ".", "SetSelection", "(", "-", "1", ")", "if", "hasattr", "(", "arg_0", ".", "wx_obj", ",", "\"SetValue\"", ")", ":", "arg_0", ".", "wx_obj", ".", "SetValue", "(", "\"\"", ")", "else", ":", "arg_0", ".", "wx_obj", ".", "SetSelection", "(", "arg_1", ")", "arg_3", "=", "ItemContainerControlSelectEvent", "(", "arg_0", ".", "_commandtype", ",", "arg_1", ",", "arg_0", ".", "wx_obj", ")", "if", "hasattr", "(", "arg_0", ",", "\"onchange\"", ")", "and", "arg_0", ".", "onchange", ":", "arg_4", "=", "FormEvent", "(", "name", "=", "\"change\"", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "onchange", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\r\n        \"Sets the item at index 'n' to be the selected item.\"\r\n        # only change selection if index is None and not dummy:\r\n        if arg_1 is None:\r\n            arg_0.wx_obj.SetSelection(-1)\r\n            # clean up text if control supports it:\r\n            if hasattr(arg_0.wx_obj, \"SetValue\"):\r\n                arg_0.wx_obj.SetValue(\"\")\r\n        else:\r\n            arg_0.wx_obj.SetSelection(arg_1)\r\n        # send a programmatically event (not issued by wx)\r\n        arg_3 = ItemContainerControlSelectEvent(arg_0._commandtype,\r\n                                                   arg_1, arg_0.wx_obj)\r\n        if hasattr(arg_0, \"onchange\") and arg_0.onchange:\r\n            # TODO: fix (should work but it doesn't):\r\n            ## wx.PostEvent(self.wx_obj, wx_evt)\r\n            # WORKAROUND:\r\n            arg_4 = FormEvent(name=\"change\", arg_3=arg_3)\r\n            arg_0.onchange(arg_4)", "path": "gui/controls/listbox.py", "identifier": "ItemContainerControl._set_selection", "docstring": "Sets the item at index 'n' to be the selected item.", "docstring_tokens": ["Sets", "the", "item", "at", "index", "n", "to", "be", "the", "selected", "item", "."], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 258201}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/expiration_date.py#L208-L248", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Convert a given month into our unified format.", "language": "python", "parameters": "(cls, data)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"jan\"", ":", "[", "str", "(", "1", ")", ",", "\"01\"", ",", "\"Jan\"", ",", "\"January\"", "]", ",", "\"feb\"", ":", "[", "str", "(", "2", ")", ",", "\"02\"", ",", "\"Feb\"", ",", "\"February\"", "]", ",", "\"mar\"", ":", "[", "str", "(", "3", ")", ",", "\"03\"", ",", "\"Mar\"", ",", "\"March\"", "]", ",", "\"apr\"", ":", "[", "str", "(", "4", ")", ",", "\"04\"", ",", "\"Apr\"", ",", "\"April\"", "]", ",", "\"may\"", ":", "[", "str", "(", "5", ")", ",", "\"05\"", ",", "\"May\"", "]", ",", "\"jun\"", ":", "[", "str", "(", "6", ")", ",", "\"06\"", ",", "\"Jun\"", ",", "\"June\"", "]", ",", "\"jul\"", ":", "[", "str", "(", "7", ")", ",", "\"07\"", ",", "\"Jul\"", ",", "\"July\"", "]", ",", "\"aug\"", ":", "[", "str", "(", "8", ")", ",", "\"08\"", ",", "\"Aug\"", ",", "\"August\"", "]", ",", "\"sep\"", ":", "[", "str", "(", "9", ")", ",", "\"09\"", ",", "\"Sep\"", ",", "\"September\"", "]", ",", "\"oct\"", ":", "[", "str", "(", "10", ")", ",", "\"Oct\"", ",", "\"October\"", "]", ",", "\"nov\"", ":", "[", "str", "(", "11", ")", ",", "\"Nov\"", ",", "\"November\"", "]", ",", "\"dec\"", ":", "[", "str", "(", "12", ")", ",", "\"Dec\"", ",", "\"December\"", "]", ",", "}", "for", "arg_3", "in", "arg_2", ":", "if", "arg_1", "in", "arg_2", "[", "arg_3", "]", ":", "return", "arg_3", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert a given month into our unified format.\n\n        :param data: The month to convert or shorten.\n        :type data: str\n\n        :return: The unified month name.\n        :rtype: str\n        \"\"\"\n\n        # We map the different month and their possible representation.\n        arg_2 = {\n            \"jan\": [str(1), \"01\", \"Jan\", \"January\"],\n            \"feb\": [str(2), \"02\", \"Feb\", \"February\"],\n            \"mar\": [str(3), \"03\", \"Mar\", \"March\"],\n            \"apr\": [str(4), \"04\", \"Apr\", \"April\"],\n            \"may\": [str(5), \"05\", \"May\"],\n            \"jun\": [str(6), \"06\", \"Jun\", \"June\"],\n            \"jul\": [str(7), \"07\", \"Jul\", \"July\"],\n            \"aug\": [str(8), \"08\", \"Aug\", \"August\"],\n            \"sep\": [str(9), \"09\", \"Sep\", \"September\"],\n            \"oct\": [str(10), \"Oct\", \"October\"],\n            \"nov\": [str(11), \"Nov\", \"November\"],\n            \"dec\": [str(12), \"Dec\", \"December\"],\n        }\n\n        for arg_3 in arg_2:\n            # We loop through our map.\n\n            if arg_1 in arg_2[arg_3]:\n                # If the parsed data (or month if you prefer) is into our map.\n\n                # We return the element (or key if you prefer) assigned to\n                # the month.\n                return arg_3\n\n        # The element is not into our map.\n\n        # We return the parsed element (or month if you prefer).\n        return arg_1", "path": "PyFunceble/expiration_date.py", "identifier": "ExpirationDate._convert_or_shorten_month", "docstring": "Convert a given month into our unified format.\n\n        :param data: The month to convert or shorten.\n        :type data: str\n\n        :return: The unified month name.\n        :rtype: str", "docstring_tokens": ["Convert", "a", "given", "month", "into", "our", "unified", "format", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 258202}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deploy.py#L278-L307", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Executes all satchel configurators to apply pending changes to the server.", "language": "python", "parameters": "(self, components=None, yes=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "0", ")", ":", "from", "burlap", "import", "notifier", "arg_3", "=", "arg_0", ".", "get_satchel", "(", "'service'", ")", "arg_0", ".", "lock", "(", ")", "try", ":", "arg_2", "=", "int", "(", "arg_2", ")", "if", "not", "arg_2", ":", "if", "arg_0", ".", "genv", ".", "host_string", "==", "arg_0", ".", "genv", ".", "hosts", "[", "0", "]", ":", "execute", "(", "partial", "(", "arg_0", ".", "preview", ",", "arg_1", "=", "arg_1", ",", "ask", "=", "1", ")", ")", "notifier", ".", "notify_pre_deployment", "(", ")", "arg_4", ",", "arg_5", "=", "arg_0", ".", "get_component_funcs", "(", "arg_1", "=", "arg_1", ")", "arg_3", ".", "pre_deploy", "(", ")", "for", "arg_6", ",", "arg_7", "in", "arg_5", ":", "print", "(", "'Executing %s...'", "%", "arg_6", ")", "arg_7", "(", ")", "arg_0", ".", "fake", "(", "arg_1", "=", "arg_1", ")", "arg_3", ".", "post_deploy", "(", ")", "notifier", ".", "notify_post_deployment", "(", ")", "finally", ":", "arg_0", ".", "unlock", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=0):\n        \"\"\"\n        Executes all satchel configurators to apply pending changes to the server.\n        \"\"\"\n        from burlap import notifier\n        arg_3 = arg_0.get_satchel('service')\n        arg_0.lock()\n        try:\n\n            arg_2 = int(arg_2)\n            if not arg_2:\n                # If we want to confirm the deployment with the user, and we're at the first server,\n                # then run the preview.\n                if arg_0.genv.host_string == arg_0.genv.hosts[0]:\n                    execute(partial(arg_0.preview, arg_1=arg_1, ask=1))\n\n            notifier.notify_pre_deployment()\n            arg_4, arg_5 = arg_0.get_component_funcs(arg_1=arg_1)\n\n            arg_3.pre_deploy()\n            for arg_6, arg_7 in arg_5:\n                print('Executing %s...' % arg_6)\n                arg_7()\n            arg_0.fake(arg_1=arg_1)\n\n            arg_3.post_deploy()\n            notifier.notify_post_deployment()\n\n        finally:\n            arg_0.unlock()", "path": "burlap/deploy.py", "identifier": "DeploySatchel.push", "docstring": "Executes all satchel configurators to apply pending changes to the server.", "docstring_tokens": ["Executes", "all", "satchel", "configurators", "to", "apply", "pending", "changes", "to", "the", "server", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258203}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/latools.py#L3371-L3445", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Plot analyte gradients as a function of time.", "language": "python", "parameters": "(self, analytes=None, win=15, samples=None, ranges=False,\n                       focus=None, outdir=None,\n                       figsize=[10, 4], subset='All_Analyses')", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "15", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "[", "10", ",", "4", "]", ",", "arg_8", "=", "'All_Analyses'", ")", ":", "if", "arg_5", "is", "None", ":", "arg_5", "=", "arg_0", ".", "focus_stage", "if", "arg_6", "is", "None", ":", "arg_6", "=", "arg_0", ".", "report_dir", "+", "'/'", "+", "arg_5", "+", "'_gradient'", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_6", ")", ":", "os", ".", "mkdir", "(", "arg_6", ")", "if", "arg_8", "is", "not", "None", ":", "arg_3", "=", "arg_0", ".", "_get_samples", "(", "arg_8", ")", "elif", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "subsets", "[", "'All_Analyses'", "]", "elif", "isinstance", "(", "arg_3", ",", "str", ")", ":", "arg_3", "=", "[", "arg_3", "]", "with", "arg_0", ".", "pbar", ".", "set", "(", "total", "=", "len", "(", "arg_3", ")", ",", "desc", "=", "'Drawing Plots'", ")", "as", "prog", ":", "for", "arg_9", "in", "arg_3", ":", "arg_10", ",", "arg_11", "=", "arg_0", ".", "data", "[", "arg_9", "]", ".", "gplot", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_7", "=", "arg_7", ",", "arg_4", "=", "arg_4", ",", "focus_stage", "=", "arg_5", ")", "arg_10", ".", "savefig", "(", "arg_6", "+", "'/'", "+", "arg_9", "+", "'_gradients.pdf'", ")", "plt", ".", "close", "(", "arg_10", ")", "prog", ".", "update", "(", ")", "return"], "function": "def Func(arg_0, arg_1=None, arg_2=15, arg_3=None, arg_4=False,\n                       arg_5=None, arg_6=None,\n                       arg_7=[10, 4], arg_8='All_Analyses'):\n        \"\"\"\n        Plot analyte gradients as a function of time.\n\n        Parameters\n        ----------\n        analytes : optional, array_like or str\n            The analyte(s) to plot. Defaults to all analytes.\n        samples: optional, array_like or str\n            The sample(s) to plot. Defaults to all samples.\n        ranges : bool\n            Whether or not to show the signal/backgroudn regions\n            identified by 'autorange'.\n        focus : str\n            The focus 'stage' of the analysis to plot. Can be\n            'rawdata', 'despiked':, 'signal', 'background',\n            'bkgsub', 'ratios' or 'calibrated'.\n        outdir : str\n            Path to a directory where you'd like the plots to be\n            saved. Defaults to 'reports/[focus]' in your data directory.\n        filt : str, dict or bool\n            Either logical filter expression contained in a str,\n            a dict of expressions specifying the filter string to\n            use for each analyte or a boolean. Passed to `grab_filt`.\n        scale : str\n            If 'log', plots the data on a log scale.\n        figsize : array_like\n            Array of length 2 specifying figure [width, height] in\n            inches.\n        stats : bool\n            Whether or not to overlay the mean and standard deviations\n            for each trace.\n        stat, err: str\n            The names of the statistic and error components to plot.\n            Deafaults to 'nanmean' and 'nanstd'.\n\n\n        Returns\n        -------\n        None\n        \"\"\"\n        if arg_5 is None:\n            arg_5 = arg_0.focus_stage\n        if arg_6 is None:\n            arg_6 = arg_0.report_dir + '/' + arg_5 + '_gradient'\n        if not os.path.isdir(arg_6):\n            os.mkdir(arg_6)\n\n        # if samples is not None:\n        #     subset = self.make_subset(samples)\n\n        if arg_8 is not None:\n            arg_3 = arg_0._get_samples(arg_8)\n        elif arg_3 is None:\n            arg_3 = arg_0.subsets['All_Analyses']\n        elif isinstance(arg_3, str):\n            arg_3 = [arg_3]\n\n        with arg_0.pbar.set(total=len(arg_3), desc='Drawing Plots') as prog:\n            for arg_9 in arg_3:\n                arg_10, arg_11 = arg_0.data[arg_9].gplot(arg_1=arg_1, arg_2=arg_2, arg_7=arg_7,\n                                        arg_4=arg_4, focus_stage=arg_5)\n                # ax = fig.axes[0]\n                # for l, u in s.sigrng:\n                #     ax.axvspan(l, u, color='r', alpha=0.1)\n                # for l, u in s.bkgrng:\n                #     ax.axvspan(l, u, color='k', alpha=0.1)\n                arg_10.savefig(arg_6 + '/' + arg_9 + '_gradients.pdf')\n                # TODO: on older(?) computers raises\n                # 'OSError: [Errno 24] Too many open files'\n                plt.close(arg_10)\n                prog.update()\n        return", "path": "latools/latools.py", "identifier": "analyse.gradient_plots", "docstring": "Plot analyte gradients as a function of time.\n\n        Parameters\n        ----------\n        analytes : optional, array_like or str\n            The analyte(s) to plot. Defaults to all analytes.\n        samples: optional, array_like or str\n            The sample(s) to plot. Defaults to all samples.\n        ranges : bool\n            Whether or not to show the signal/backgroudn regions\n            identified by 'autorange'.\n        focus : str\n            The focus 'stage' of the analysis to plot. Can be\n            'rawdata', 'despiked':, 'signal', 'background',\n            'bkgsub', 'ratios' or 'calibrated'.\n        outdir : str\n            Path to a directory where you'd like the plots to be\n            saved. Defaults to 'reports/[focus]' in your data directory.\n        filt : str, dict or bool\n            Either logical filter expression contained in a str,\n            a dict of expressions specifying the filter string to\n            use for each analyte or a boolean. Passed to `grab_filt`.\n        scale : str\n            If 'log', plots the data on a log scale.\n        figsize : array_like\n            Array of length 2 specifying figure [width, height] in\n            inches.\n        stats : bool\n            Whether or not to overlay the mean and standard deviations\n            for each trace.\n        stat, err: str\n            The names of the statistic and error components to plot.\n            Deafaults to 'nanmean' and 'nanstd'.\n\n\n        Returns\n        -------\n        None", "docstring_tokens": ["Plot", "analyte", "gradients", "as", "a", "function", "of", "time", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 258204}
{"url": "https://github.com/bheinzerling/descriptors/blob/04fff864649fba9bd6a2d8f8b649cf30994e0e46/descriptors/handmade.py#L143-L153", "sha": "04fff864649fba9bd6a2d8f8b649cf30994e0e46", "docstring_summary": "Convert value to a numeric value or raise a ValueError\n        if that isn't possible.", "language": "python", "parameters": "(value)", "return_statement": "return float(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ForceNumeric", ".", "is_convertible", "(", "arg_0", ")", "if", "not", "arg_1", "or", "isinstance", "(", "arg_0", ",", "bool", ")", ":", "raise", "ValueError", "if", "isinstance", "(", "str", "(", "arg_0", ")", ",", "str", ")", ":", "return", "ForceNumeric", ".", "str_to_num", "(", "arg_0", ")", "return", "float", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"Convert value to a numeric value or raise a ValueError\n        if that isn't possible.\n\n        \"\"\"\n        arg_1 = ForceNumeric.is_convertible(arg_0)\n        if not arg_1 or isinstance(arg_0, bool):\n            raise ValueError\n        if isinstance(str(arg_0), str):\n            return ForceNumeric.str_to_num(arg_0)\n        return float(arg_0)", "path": "descriptors/handmade.py", "identifier": "ForceNumeric.try_convert", "docstring": "Convert value to a numeric value or raise a ValueError\n        if that isn't possible.", "docstring_tokens": ["Convert", "value", "to", "a", "numeric", "value", "or", "raise", "a", "ValueError", "if", "that", "isn", "t", "possible", "."], "nwo": "bheinzerling/descriptors", "score": 0.16941397159673272, "idx": 258205}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/progressbar.py#L318-L328", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Calculate the modelled progress state for the given time moment.", "language": "python", "parameters": "(self, t)", "return_statement": "return xt, vt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_t0", ",", "arg_0", ".", "_x0", ",", "arg_0", ".", "_v0", ",", "arg_0", ".", "_ve", "arg_6", "=", "(", "arg_4", "-", "arg_5", ")", "*", "math", ".", "exp", "(", "-", "arg_0", ".", "BETA", "*", "(", "arg_1", "-", "arg_2", ")", ")", "arg_7", "=", "arg_5", "+", "arg_6", "arg_8", "=", "clamp", "(", "arg_3", "+", "arg_5", "*", "(", "arg_1", "-", "arg_2", ")", "+", "(", "arg_4", "-", "arg_5", "-", "arg_6", ")", "/", "arg_0", ".", "BETA", ",", "0", ",", "1", ")", "return", "arg_8", ",", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the modelled progress state for the given time moment.\n\n        :returns: tuple (x, v) of the progress level and progress speed.\n        \"\"\"\n        arg_2, arg_3, arg_4, arg_5 = arg_0._t0, arg_0._x0, arg_0._v0, arg_0._ve\n        arg_6 = (arg_4 - arg_5) * math.exp(-arg_0.BETA * (arg_1 - arg_2))\n        arg_7 = arg_5 + arg_6\n        arg_8 = clamp(arg_3 + arg_5 * (arg_1 - arg_2) + (arg_4 - arg_5 - arg_6) / arg_0.BETA, 0, 1)\n        return arg_8, arg_7", "path": "h2o-py/h2o/utils/progressbar.py", "identifier": "ProgressBar._compute_progress_at_time", "docstring": "Calculate the modelled progress state for the given time moment.\n\n        :returns: tuple (x, v) of the progress level and progress speed.", "docstring_tokens": ["Calculate", "the", "modelled", "progress", "state", "for", "the", "given", "time", "moment", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258206}
{"url": "https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/rarfile.py#L258-L263", "sha": "b1ac46cbcf42f3d3c5c69ab971fe97369a4da617", "docstring_summary": "Return the instance of RarInfo given 'name'.", "language": "python", "parameters": "(self, name)", "return_statement": "return rarinfo", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "NameToInfo", ".", "get", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "raise", "KeyError", "(", "'There is no item named %r in the archive'", "%", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the instance of RarInfo given 'name'.\"\"\"\n        arg_2 = arg_0.NameToInfo.get(arg_1)\n        if arg_2 is None:\n            raise KeyError('There is no item named %r in the archive' % arg_1)\n        return arg_2", "path": "unrar/rarfile.py", "identifier": "RarFile.getinfo", "docstring": "Return the instance of RarInfo given 'name'.", "docstring_tokens": ["Return", "the", "instance", "of", "RarInfo", "given", "name", "."], "nwo": "matiasb/python-unrar", "score": 0.34770217692582306, "idx": 258207}
{"url": "https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L344-L350", "sha": "ce2cf3f1425d02ba4f3ad3202cfca43a1892558a", "docstring_summary": "Accept request.", "language": "python", "parameters": "(self, message=None, expires_at=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "if", "arg_0", ".", "status", "!=", "RequestStatus", ".", "PENDING", ":", "raise", "InvalidRequestStateError", "(", "RequestStatus", ".", "PENDING", ")", "arg_0", ".", "status", "=", "RequestStatus", ".", "ACCEPTED", "request_Funced", ".", "send", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Accept request.\"\"\"\n        with db.session.begin_nested():\n            if arg_0.status != RequestStatus.PENDING:\n                raise InvalidRequestStateError(RequestStatus.PENDING)\n            arg_0.status = RequestStatus.ACCEPTED\n        request_Funced.send(arg_0, arg_1=arg_1, arg_2=arg_2)", "path": "zenodo_accessrequests/models.py", "identifier": "AccessRequest.accept", "docstring": "Accept request.", "docstring_tokens": ["Accept", "request", "."], "nwo": "zenodo/zenodo-accessrequests", "score": 0.2718259314615454, "idx": 258208}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L270-L298", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Opens a stream and reads 8192 bytes from it.", "language": "python", "parameters": "(stream)", "return_statement": "return stream_fd, prebuffer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "global", "arg_1", "try", ":", "arg_1", "=", "arg_0", ".", "open", "(", ")", "except", "StreamError", "as", "err", ":", "raise", "StreamError", "(", "\"Could not open stream: {0}\"", ".", "format", "(", "err", ")", ")", "try", ":", "log", ".", "debug", "(", "\"Pre-buffering 8192 bytes\"", ")", "arg_2", "=", "arg_1", ".", "read", "(", "8192", ")", "except", "IOError", "as", "err", ":", "arg_1", ".", "close", "(", ")", "raise", "StreamError", "(", "\"Failed to read data from stream: {0}\"", ".", "format", "(", "err", ")", ")", "if", "not", "arg_2", ":", "arg_1", ".", "close", "(", ")", "raise", "StreamError", "(", "\"No data returned from stream\"", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Opens a stream and reads 8192 bytes from it.\n\n    This is useful to check if a stream actually has data\n    before opening the output.\n\n    \"\"\"\n    global arg_1\n\n    # Attempts to open the stream\n    try:\n        arg_1 = arg_0.open()\n    except StreamError as err:\n        raise StreamError(\"Could not open stream: {0}\".format(err))\n\n    # Read 8192 bytes before proceeding to check for errors.\n    # This is to avoid opening the output unnecessarily.\n    try:\n        log.debug(\"Pre-buffering 8192 bytes\")\n        arg_2 = arg_1.read(8192)\n    except IOError as err:\n        arg_1.close()\n        raise StreamError(\"Failed to read data from stream: {0}\".format(err))\n\n    if not arg_2:\n        arg_1.close()\n        raise StreamError(\"No data returned from stream\")\n\n    return arg_1, arg_2", "path": "src/streamlink_cli/main.py", "identifier": "open_stream", "docstring": "Opens a stream and reads 8192 bytes from it.\n\n    This is useful to check if a stream actually has data\n    before opening the output.", "docstring_tokens": ["Opens", "a", "stream", "and", "reads", "8192", "bytes", "from", "it", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 258209}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/mod/communicator.py#L241-L256", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Upload all po files to GDocs ignoring conflicts.\n        This method looks for all msgids in po_files and sends them\n        as ods to GDocs Spreadsheet.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "temp_path", ",", "LOCAL_ODS", ")", "try", ":", "po_to_ods", "(", "arg_0", ".", "languages", ",", "arg_0", ".", "locale_root", ",", "arg_0", ".", "po_files_path", ",", "arg_1", ")", "except", "(", "IOError", ",", "OSError", ")", "as", "e", ":", "raise", "PODocsError", "(", "e", ")", "arg_0", ".", "_Func_file_to_gdoc", "(", "arg_1", ")", "arg_0", ".", "_clear_temp", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Upload all po files to GDocs ignoring conflicts.\n        This method looks for all msgids in po_files and sends them\n        as ods to GDocs Spreadsheet.\n        \"\"\"\n        arg_1 = os.path.join(arg_0.temp_path, LOCAL_ODS)\n        try:\n            po_to_ods(arg_0.languages, arg_0.locale_root,\n                      arg_0.po_files_path, arg_1)\n        except (IOError, OSError) as e:\n            raise PODocsError(e)\n\n        arg_0._Func_file_to_gdoc(arg_1)\n\n        arg_0._clear_temp()", "path": "c3po/mod/communicator.py", "identifier": "Communicator.upload", "docstring": "Upload all po files to GDocs ignoring conflicts.\n        This method looks for all msgids in po_files and sends them\n        as ods to GDocs Spreadsheet.", "docstring_tokens": ["Upload", "all", "po", "files", "to", "GDocs", "ignoring", "conflicts", ".", "This", "method", "looks", "for", "all", "msgids", "in", "po_files", "and", "sends", "them", "as", "ods", "to", "GDocs", "Spreadsheet", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 258210}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L82-L98", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Reads a list of assignments from the given node.", "language": "python", "parameters": "(self, workflow, start_node)", "return_statement": "return assignments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ".", "childNodes", ":", "if", "arg_4", ".", "nodeType", "!=", "minidom", ".", "Node", ".", "ELEMENT_NODE", ":", "continue", "if", "arg_4", ".", "nodeName", ".", "lower", "(", ")", "==", "'assign'", ":", "arg_3", ".", "append", "(", "arg_0", ".", "deserialize_assign", "(", "arg_1", ",", "arg_4", ")", ")", "else", ":", "_exc", "(", "'Unknown node: %s'", "%", "arg_4", ".", "nodeName", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Reads a list of assignments from the given node.\n\n        workflow -- the workflow\n        start_node -- the xml structure (xml.dom.minidom.Node)\n        \"\"\"\n        # Collect all information.\n        arg_3 = []\n        for arg_4 in arg_2.childNodes:\n            if arg_4.nodeType != minidom.Node.ELEMENT_NODE:\n                continue\n            if arg_4.nodeName.lower() == 'assign':\n                arg_3.append(arg_0.deserialize_assign(arg_1, arg_4))\n            else:\n                _exc('Unknown node: %s' % arg_4.nodeName)\n        return arg_3", "path": "SpiffWorkflow/serializer/prettyxml.py", "identifier": "XmlSerializer.deserialize_assign_list", "docstring": "Reads a list of assignments from the given node.\n\n        workflow -- the workflow\n        start_node -- the xml structure (xml.dom.minidom.Node)", "docstring_tokens": ["Reads", "a", "list", "of", "assignments", "from", "the", "given", "node", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 258211}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/S3_hook.py#L185-L202", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks if a key exists in a bucket", "language": "python", "parameters": "(self, key, bucket_name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_2", ":", "(", "arg_2", ",", "arg_1", ")", "=", "arg_0", ".", "parse_s3_url", "(", "arg_1", ")", "try", ":", "arg_0", ".", "get_conn", "(", ")", ".", "head_object", "(", "Bucket", "=", "arg_2", ",", "Key", "=", "arg_1", ")", "return", "True", "except", "ClientError", "as", "e", ":", "arg_0", ".", "log", ".", "info", "(", "e", ".", "response", "[", "\"Error\"", "]", "[", "\"Message\"", "]", ")", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Checks if a key exists in a bucket\n\n        :param key: S3 key that will point to the file\n        :type key: str\n        :param bucket_name: Name of the bucket in which the file is stored\n        :type bucket_name: str\n        \"\"\"\n        if not arg_2:\n            (arg_2, arg_1) = arg_0.parse_s3_url(arg_1)\n\n        try:\n            arg_0.get_conn().head_object(Bucket=arg_2, Key=arg_1)\n            return True\n        except ClientError as e:\n            arg_0.log.info(e.response[\"Error\"][\"Message\"])\n            return False", "path": "airflow/hooks/S3_hook.py", "identifier": "S3Hook.check_for_key", "docstring": "Checks if a key exists in a bucket\n\n        :param key: S3 key that will point to the file\n        :type key: str\n        :param bucket_name: Name of the bucket in which the file is stored\n        :type bucket_name: str", "docstring_tokens": ["Checks", "if", "a", "key", "exists", "in", "a", "bucket"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258212}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site.py#L510-L523", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "On Windows, some default encodings are not provided by Python,\n    while they are always available as \"mbcs\" in each locale. Make\n    them usable by aliasing to \"mbcs\" in such a case.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "import", "locale", ",", "codecs", "arg_0", "=", "locale", ".", "getdefaultlocale", "(", ")", "[", "1", "]", "if", "arg_0", ".", "startswith", "(", "'cp'", ")", ":", "try", ":", "codecs", ".", "lookup", "(", "arg_0", ")", "except", "LookupError", ":", "import", "arg_1", "arg_1", ".", "_cache", "[", "arg_0", "]", "=", "arg_1", ".", "_unknown", "arg_1", ".", "aliases", ".", "aliases", "[", "arg_0", "]", "=", "'mbcs'"], "function": "def Func():\n    \"\"\"On Windows, some default encodings are not provided by Python,\n    while they are always available as \"mbcs\" in each locale. Make\n    them usable by aliasing to \"mbcs\" in such a case.\"\"\"\n    if sys.platform == 'win32':\n        import locale, codecs\n        arg_0 = locale.getdefaultlocale()[1]\n        if arg_0.startswith('cp'):            # \"cp***\" ?\n            try:\n                codecs.lookup(arg_0)\n            except LookupError:\n                import arg_1\n                arg_1._cache[arg_0] = arg_1._unknown\n                arg_1.aliases.aliases[arg_0] = 'mbcs'", "path": "capybara/virtualenv/lib/python2.7/site.py", "identifier": "aliasmbcs", "docstring": "On Windows, some default encodings are not provided by Python,\n    while they are always available as \"mbcs\" in each locale. Make\n    them usable by aliasing to \"mbcs\" in such a case.", "docstring_tokens": ["On", "Windows", "some", "default", "encodings", "are", "not", "provided", "by", "Python", "while", "they", "are", "always", "available", "as", "mbcs", "in", "each", "locale", ".", "Make", "them", "usable", "by", "aliasing", "to", "mbcs", "in", "such", "a", "case", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 258213}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L982-L992", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Acquires a lock before storage and releases it afterwards.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "try", ":", "arg_0", ".", "acquire_lock", "(", ")", "return", "arg_0", ".", "_storage_service", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "finally", ":", "if", "arg_0", ".", "lock", "is", "not", "None", ":", "try", ":", "arg_0", ".", "release_lock", "(", ")", "except", "RuntimeError", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Could not release lock `%s`!'", "%", "str", "(", "arg_0", ".", "lock", ")", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Acquires a lock before storage and releases it afterwards.\"\"\"\n        try:\n            arg_0.acquire_lock()\n            return arg_0._storage_service.Func(*arg_1, **arg_2)\n        finally:\n            if arg_0.lock is not None:\n                try:\n                    arg_0.release_lock()\n                except RuntimeError:\n                    arg_0._logger.error('Could not release lock `%s`!' % str(arg_0.lock))", "path": "pypet/utils/mpwrappers.py", "identifier": "LockWrapper.store", "docstring": "Acquires a lock before storage and releases it afterwards.", "docstring_tokens": ["Acquires", "a", "lock", "before", "storage", "and", "releases", "it", "afterwards", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258214}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/_util/random.py#L1-L23", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "Draw random samples from a multivariate normal distribution.", "language": "python", "parameters": "(random, mean, cov)", "return_statement": "return L @ random.randn(L.shape[0]) + mean", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "from", "numpy", ".", "linalg", "import", "cholesky", "arg_3", "=", "cholesky", "(", "arg_2", ")", "return", "arg_3", "@", "arg_0", ".", "randn", "(", "arg_3", ".", "shape", "[", "0", "]", ")", "+", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Draw random samples from a multivariate normal distribution.\n\n    Parameters\n    ----------\n    random : np.random.RandomState instance\n        Random state.\n    mean : array_like\n        Mean of the n-dimensional distribution.\n    cov : array_like\n        Covariance matrix of the distribution. It must be symmetric and\n        positive-definite for proper sampling.\n\n    Returns\n    -------\n    out : ndarray\n        The drawn sample.\n    \"\"\"\n    from numpy.linalg import cholesky\n\n    arg_3 = cholesky(arg_2)\n    return arg_3 @ arg_0.randn(arg_3.shape[0]) + arg_1", "path": "glimix_core/_util/random.py", "identifier": "multivariate_normal", "docstring": "Draw random samples from a multivariate normal distribution.\n\n    Parameters\n    ----------\n    random : np.random.RandomState instance\n        Random state.\n    mean : array_like\n        Mean of the n-dimensional distribution.\n    cov : array_like\n        Covariance matrix of the distribution. It must be symmetric and\n        positive-definite for proper sampling.\n\n    Returns\n    -------\n    out : ndarray\n        The drawn sample.", "docstring_tokens": ["Draw", "random", "samples", "from", "a", "multivariate", "normal", "distribution", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 258215}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/jobs.py#L135-L144", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Initialize the archive manager.", "language": "python", "parameters": "(self, archive_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "==", "\"\"", ":", "raise", "ValueError", "(", "\"Archive manager path cannot be empty\"", ")", "if", "arg_1", ":", "arg_0", ".", "archive_manager", "=", "perceval", ".", "archive", ".", "ArchiveManager", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Initialize the archive manager.\n\n        :param archive_path: path where the archive manager is located\n        \"\"\"\n        if arg_1 == \"\":\n            raise ValueError(\"Archive manager path cannot be empty\")\n\n        if arg_1:\n            arg_0.archive_manager = perceval.archive.ArchiveManager(arg_1)", "path": "arthur/jobs.py", "identifier": "PercevalJob.initialize_archive_manager", "docstring": "Initialize the archive manager.\n\n        :param archive_path: path where the archive manager is located", "docstring_tokens": ["Initialize", "the", "archive", "manager", "."], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 258216}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L198-L201", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Get a list of all current joint torques in the skeleton.", "language": "python", "parameters": "(self)", "return_statement": "return as_flat_array(getattr(j, 'amotor', j).feedback[-1][:j.ADOF]\n                             for j in self.joints)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "as_flat_array", "(", "getattr", "(", "arg_1", ",", "'amotor'", ",", "arg_1", ")", ".", "feedback", "[", "-", "1", "]", "[", ":", "arg_1", ".", "ADOF", "]", "for", "arg_1", "in", "arg_0", ".", "joints", ")"], "function": "def Func(arg_0):\n        '''Get a list of all current joint torques in the skeleton.'''\n        return as_flat_array(getattr(arg_1, 'amotor', arg_1).feedback[-1][:arg_1.ADOF]\n                             for arg_1 in arg_0.joints)", "path": "pagoda/skeleton.py", "identifier": "Skeleton.joint_torques", "docstring": "Get a list of all current joint torques in the skeleton.", "docstring_tokens": ["Get", "a", "list", "of", "all", "current", "joint", "torques", "in", "the", "skeleton", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 258217}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/misc_util.py#L221-L243", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Unpickle a possible compressed pickle.", "language": "python", "parameters": "(path, compression=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_1", ":", "with", "zipfile", ".", "ZipFile", "(", "arg_0", ",", "\"r\"", ",", "arg_1", "=", "zipfile", ".", "ZIP_DEFLATED", ")", "as", "myzip", ":", "with", "myzip", ".", "open", "(", "\"data\"", ")", "as", "f", ":", "return", "pickle", ".", "load", "(", "f", ")", "else", ":", "with", "open", "(", "arg_0", ",", "\"rb\"", ")", "as", "f", ":", "return", "pickle", ".", "load", "(", "f", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"Unpickle a possible compressed pickle.\n\n    Parameters\n    ----------\n    path: str\n        path to the output file\n    compression: bool\n        if true assumes that pickle was compressed when created and attempts decompression.\n\n    Returns\n    -------\n    obj: object\n        the unpickled object\n    \"\"\"\n\n    if arg_1:\n        with zipfile.ZipFile(arg_0, \"r\", arg_1=zipfile.ZIP_DEFLATED) as myzip:\n            with myzip.open(\"data\") as f:\n                return pickle.load(f)\n    else:\n        with open(arg_0, \"rb\") as f:\n            return pickle.load(f)", "path": "baselines/common/misc_util.py", "identifier": "pickle_load", "docstring": "Unpickle a possible compressed pickle.\n\n    Parameters\n    ----------\n    path: str\n        path to the output file\n    compression: bool\n        if true assumes that pickle was compressed when created and attempts decompression.\n\n    Returns\n    -------\n    obj: object\n        the unpickled object", "docstring_tokens": ["Unpickle", "a", "possible", "compressed", "pickle", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 258218}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/config.py#L45-L50", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Names of all state locations must be unique.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "map", "(", "lambda", "loc", ":", "loc", "[", "\"name\"", "]", ",", "arg_0", ".", "locations", ")", "assert", "len", "(", "arg_1", ")", "==", "len", "(", "set", "(", "arg_1", ")", ")", ",", "\"Names of state locations must be unique\""], "function": "def Func(arg_0):\n    \"\"\"\n    Names of all state locations must be unique.\n    \"\"\"\n    arg_1 = map(lambda loc: loc[\"name\"], arg_0.locations)\n    assert len(arg_1) == len(set(arg_1)), \"Names of state locations must be unique\"", "path": "heron/statemgrs/src/python/config.py", "identifier": "Config.validate_state_locations", "docstring": "Names of all state locations must be unique.", "docstring_tokens": ["Names", "of", "all", "state", "locations", "must", "be", "unique", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258219}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/reaction.py#L733-L746", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Return the stoichiometric coefficient of a metabolite.", "language": "python", "parameters": "(self, metabolite_id)", "return_statement": "return self._metabolites[_id_to_metabolites[metabolite_id]]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "Metabolite", ")", ":", "return", "arg_0", ".", "_metabolites", "[", "arg_1", "]", "arg_2", "=", "{", "m", ".", "id", ":", "m", "for", "m", "in", "arg_0", ".", "_metabolites", "}", "return", "arg_0", ".", "_metabolites", "[", "arg_2", "[", "arg_1", "]", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return the stoichiometric coefficient of a metabolite.\n\n        Parameters\n        ----------\n        metabolite_id : str or cobra.Metabolite\n\n        \"\"\"\n        if isinstance(arg_1, Metabolite):\n            return arg_0._metabolites[arg_1]\n\n        arg_2 = {m.id: m for m in arg_0._metabolites}\n        return arg_0._metabolites[arg_2[arg_1]]", "path": "cobra/core/reaction.py", "identifier": "Reaction.get_coefficient", "docstring": "Return the stoichiometric coefficient of a metabolite.\n\n        Parameters\n        ----------\n        metabolite_id : str or cobra.Metabolite", "docstring_tokens": ["Return", "the", "stoichiometric", "coefficient", "of", "a", "metabolite", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 258220}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L146-L171", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Get a code object from a .pyc file.", "language": "python", "parameters": "(filename)", "return_statement": "return code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "open", "(", "arg_0", ",", "\"rb\"", ")", "except", "IOError", ":", "raise", "NoCode", "(", "\"No file to run: %r\"", "%", "arg_0", ")", "try", ":", "arg_2", "=", "arg_1", ".", "read", "(", "4", ")", "if", "arg_2", "!=", "imp", ".", "get_magic", "(", ")", ":", "raise", "NoCode", "(", "\"Bad magic number in .pyc file\"", ")", "arg_1", ".", "read", "(", "4", ")", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "3", ")", ":", "arg_1", ".", "read", "(", "4", ")", "arg_3", "=", "marshal", ".", "load", "(", "arg_1", ")", "finally", ":", "arg_1", ".", "close", "(", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Get a code object from a .pyc file.\"\"\"\n    try:\n        arg_1 = open(arg_0, \"rb\")\n    except IOError:\n        raise NoCode(\"No file to run: %r\" % arg_0)\n\n    try:\n        # First four bytes are a version-specific magic number.  It has to\n        # match or we won't run the file.\n        arg_2 = arg_1.read(4)\n        if arg_2 != imp.get_magic():\n            raise NoCode(\"Bad magic number in .pyc file\")\n\n        # Skip the junk in the header that we don't need.\n        arg_1.read(4)            # Skip the moddate.\n        if sys.version_info >= (3, 3):\n            # 3.3 added another long to the header (size), skip it.\n            arg_1.read(4)\n\n        # The rest of the file is the code object we want.\n        arg_3 = marshal.load(arg_1)\n    finally:\n        arg_1.close()\n\n    return arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py", "identifier": "make_code_from_pyc", "docstring": "Get a code object from a .pyc file.", "docstring_tokens": ["Get", "a", "code", "object", "from", "a", ".", "pyc", "file", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258221}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/users/users.py#L80-L96", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Replace the currently authenticated user's list of jobs with a new list of\n    jobs", "language": "python", "parameters": "(session, job_ids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'jobs[]'", ":", "arg_1", "}", "arg_3", "=", "make_put_request", "(", "arg_0", ",", "'self/jobs'", ",", "arg_4", "=", "arg_2", ")", "arg_4", "=", "arg_3", ".", "json", "(", ")", "if", "arg_3", ".", "status_code", "==", "200", ":", "return", "arg_4", "[", "'status'", "]", "else", ":", "raise", "UserJobsNotSetException", "(", "message", "=", "arg_4", "[", "'message'", "]", ",", "error_code", "=", "arg_4", "[", "'error_code'", "]", ",", "request_id", "=", "arg_4", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Replace the currently authenticated user's list of jobs with a new list of\n    jobs\n    \"\"\"\n    arg_2 = {\n        'jobs[]': arg_1\n    }\n    arg_3 = make_put_request(arg_0, 'self/jobs', arg_4=arg_2)\n    arg_4 = arg_3.json()\n    if arg_3.status_code == 200:\n        return arg_4['status']\n    else:\n        raise UserJobsNotSetException(\n            message=arg_4['message'],\n            error_code=arg_4['error_code'],\n            request_id=arg_4['request_id'])", "path": "freelancersdk/resources/users/users.py", "identifier": "set_user_jobs", "docstring": "Replace the currently authenticated user's list of jobs with a new list of\n    jobs", "docstring_tokens": ["Replace", "the", "currently", "authenticated", "user", "s", "list", "of", "jobs", "with", "a", "new", "list", "of", "jobs"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 258222}
{"url": "https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/djpaypal/checks.py#L10-L26", "sha": "867368f6068c2539e22d486eb7a6d2ecfb9485e0", "docstring_summary": "Check that the Paypal API keys are configured correctly", "language": "python", "parameters": "(app_configs=None, **kwargs)", "return_statement": "return messages", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "**", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "getattr", "(", "djpaypal_settings", ",", "\"PAYPAL_MODE\"", ",", "None", ")", "if", "arg_3", "not", "in", "VALID_MODES", ":", "arg_4", "=", "\"Invalid PAYPAL_MODE specified: {}.\"", ".", "format", "(", "repr", "(", "arg_3", ")", ")", "arg_5", "=", "\"PAYPAL_MODE must be one of {}\"", ".", "format", "(", "\", \"", ".", "join", "(", "repr", "(", "k", ")", "for", "k", "in", "VALID_MODES", ")", ")", "arg_2", ".", "append", "(", "checks", ".", "Critical", "(", "arg_4", ",", "arg_5", "=", "arg_5", ",", "id", "=", "\"djpaypal.C001\"", ")", ")", "for", "arg_6", "in", "\"PAYPAL_CLIENT_ID\"", ",", "\"PAYPAL_CLIENT_SECRET\"", ":", "if", "not", "getattr", "(", "djpaypal_settings", ",", "arg_6", ",", "None", ")", ":", "arg_4", "=", "\"Invalid value specified for {}\"", ".", "format", "(", "arg_6", ")", "arg_5", "=", "\"Add PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET to your settings.\"", "arg_2", ".", "append", "(", "checks", ".", "Critical", "(", "arg_4", ",", "arg_5", "=", "arg_5", ",", "id", "=", "\"djpaypal.C002\"", ")", ")", "return", "arg_2"], "function": "def Func(arg_0=None, **arg_1):\n\t\"\"\"Check that the Paypal API keys are configured correctly\"\"\"\n\targ_2 = []\n\n\targ_3 = getattr(djpaypal_settings, \"PAYPAL_MODE\", None)\n\tif arg_3 not in VALID_MODES:\n\t\targ_4 = \"Invalid PAYPAL_MODE specified: {}.\".format(repr(arg_3))\n\t\targ_5 = \"PAYPAL_MODE must be one of {}\".format(\", \".join(repr(k) for k in VALID_MODES))\n\t\targ_2.append(checks.Critical(arg_4, arg_5=arg_5, id=\"djpaypal.C001\"))\n\n\tfor arg_6 in \"PAYPAL_CLIENT_ID\", \"PAYPAL_CLIENT_SECRET\":\n\t\tif not getattr(djpaypal_settings, arg_6, None):\n\t\t\targ_4 = \"Invalid value specified for {}\".format(arg_6)\n\t\t\targ_5 = \"Add PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET to your settings.\"\n\t\t\targ_2.append(checks.Critical(arg_4, arg_5=arg_5, id=\"djpaypal.C002\"))\n\n\treturn arg_2", "path": "djpaypal/checks.py", "identifier": "check_paypal_api_key", "docstring": "Check that the Paypal API keys are configured correctly", "docstring_tokens": ["Check", "that", "the", "Paypal", "API", "keys", "are", "configured", "correctly"], "nwo": "HearthSim/dj-paypal", "score": 0.41047498361521556, "idx": 258223}
{"url": "https://github.com/foxx/peewee-extras/blob/327e7e63465b3f6e1afc0e6a651f4cb5c8c60889/peewee_extras.py#L204-L258", "sha": "327e7e63465b3f6e1afc0e6a651f4cb5c8c60889", "docstring_summary": "Apply pagination to query", "language": "python", "parameters": "(self, query, count, offset=None, sort=None)", "return_statement": "return query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "peewee", ".", "Query", ")", "assert", "isinstance", "(", "arg_2", ",", "int", ")", "assert", "isinstance", "(", "arg_3", ",", "(", "str", ",", "int", ",", "type", "(", "None", ")", ")", ")", "assert", "isinstance", "(", "arg_4", ",", "(", "list", ",", "set", ",", "tuple", ",", "type", "(", "None", ")", ")", ")", "arg_5", "=", "arg_1", ".", "model", ".", "_meta", ".", "get_primary_keys", "(", ")", "if", "len", "(", "arg_5", ")", "==", "0", ":", "raise", "peewee", ".", "ProgrammingError", "(", "'Cannot apply pagination on model without primary key'", ")", "if", "len", "(", "arg_5", ")", ">", "1", ":", "raise", "peewee", ".", "ProgrammingError", "(", "'Cannot apply pagination on model with compound primary key'", ")", "if", "arg_3", "is", "not", "None", ":", "arg_1", "=", "arg_1", ".", "where", "(", "arg_5", "[", "0", "]", ">=", "arg_3", ")", "arg_6", "=", "[", "]", "if", "arg_4", ":", "for", "arg_7", ",", "arg_8", "in", "arg_4", ":", "if", "not", "isinstance", "(", "arg_8", ",", "str", ")", ":", "raise", "ValueError", "(", "\"Invalid sort direction on field '{}'\"", ".", "format", "(", "arg_7", ")", ")", "arg_8", "=", "arg_8", ".", "lower", "(", ")", ".", "strip", "(", ")", "if", "arg_8", "not", "in", "[", "'asc'", ",", "'desc'", "]", ":", "raise", "ValueError", "(", "\"Invalid sort direction on field '{}'\"", ".", "format", "(", "arg_7", ")", ")", "arg_9", "=", "peewee", ".", "SQL", "(", "arg_7", ")", "arg_9", "=", "getattr", "(", "arg_9", ",", "arg_8", ")", "(", ")", "arg_6", "+=", "[", "arg_9", "]", "arg_6", "+=", "[", "arg_5", "[", "0", "]", ".", "asc", "(", ")", "]", "arg_1", "=", "arg_1", ".", "order_by", "(", "*", "arg_6", ")", "arg_1", "=", "arg_1", ".", "limit", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"\n        Apply pagination to query\n\n        :attr query: Instance of `peewee.Query`\n        :attr count: Max rows to return\n        :attr offset: Pagination offset, str/int\n        :attr sort: List of tuples, e.g. [('id', 'asc')]\n\n        :returns: Instance of `peewee.Query`\n        \"\"\"\n        assert isinstance(arg_1, peewee.Query)\n        assert isinstance(arg_2, int)\n        assert isinstance(arg_3, (str, int, type(None)))\n        assert isinstance(arg_4, (list, set, tuple, type(None)))\n\n         # ensure our model has a primary key\n        arg_5 = arg_1.model._meta.get_primary_keys()\n        if len(arg_5) == 0:\n            raise peewee.ProgrammingError(\n                'Cannot apply pagination on model without primary key')\n\n        # ensure our model doesn't use a compound primary key\n        if len(arg_5) > 1:\n            raise peewee.ProgrammingError(\n                'Cannot apply pagination on model with compound primary key')\n\n        # apply offset\n        if arg_3 is not None:\n            arg_1 = arg_1.where(arg_5[0] >= arg_3)\n\n        # do we need to apply sorting?\n        arg_6 = []\n        if arg_4:\n            for arg_7, arg_8 in arg_4:\n                # does this field have a valid sort direction?\n                if not isinstance(arg_8, str):\n                    raise ValueError(\"Invalid sort direction on field '{}'\".format(arg_7))\n\n                arg_8 = arg_8.lower().strip()\n                if arg_8 not in ['asc', 'desc']:\n                    raise ValueError(\"Invalid sort direction on field '{}'\".format(arg_7))\n\n                # apply sorting\n                arg_9 = peewee.SQL(arg_7)\n                arg_9 = getattr(arg_9, arg_8)()\n                arg_6 += [arg_9]\n\n        # add primary key ordering after user sorting\n        arg_6 += [arg_5[0].asc()]\n\n        # apply ordering and limits\n        arg_1 = arg_1.order_by(*arg_6)\n        arg_1 = arg_1.limit(arg_2)\n        return arg_1", "path": "peewee_extras.py", "identifier": "PrimaryKeyPagination.paginate_query", "docstring": "Apply pagination to query\n\n        :attr query: Instance of `peewee.Query`\n        :attr count: Max rows to return\n        :attr offset: Pagination offset, str/int\n        :attr sort: List of tuples, e.g. [('id', 'asc')]\n\n        :returns: Instance of `peewee.Query`", "docstring_tokens": ["Apply", "pagination", "to", "query"], "nwo": "foxx/peewee-extras", "score": 0.36327422921566166, "idx": 258224}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py#L64-L110", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Generate a series of lines, one for each line in `source`.", "language": "python", "parameters": "(source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", "[", "token", ".", "INDENT", ",", "token", ".", "DEDENT", ",", "token", ".", "NEWLINE", ",", "tokenize", ".", "NL", "]", ")", "arg_2", "=", "[", "]", "arg_3", "=", "0", "arg_0", "=", "arg_0", ".", "expandtabs", "(", "8", ")", ".", "replace", "(", "'\\r\\n'", ",", "'\\n'", ")", "arg_4", "=", "generate_tokens", "(", "arg_0", ")", "for", "arg_5", ",", "arg_6", ",", "(", "arg_7", ",", "arg_8", ")", ",", "(", "arg_7", ",", "arg_9", ")", ",", "arg_7", "in", "phys_tokens", "(", "arg_4", ")", ":", "arg_10", "=", "True", "for", "arg_11", "in", "re", ".", "split", "(", "'(\\n)'", ",", "arg_6", ")", ":", "if", "arg_11", "==", "'\\n'", ":", "yield", "arg_2", "arg_2", "=", "[", "]", "arg_3", "=", "0", "arg_12", "=", "False", "elif", "arg_11", "==", "''", ":", "arg_12", "=", "False", "elif", "arg_5", "in", "arg_1", ":", "arg_12", "=", "False", "else", ":", "if", "arg_10", "and", "arg_8", ">", "arg_3", ":", "arg_2", ".", "append", "(", "(", "\"ws\"", ",", "\" \"", "*", "(", "arg_8", "-", "arg_3", ")", ")", ")", "arg_10", "=", "False", "arg_13", "=", "tokenize", ".", "tok_name", ".", "get", "(", "arg_5", ",", "'xx'", ")", ".", "lower", "(", ")", "[", ":", "3", "]", "if", "arg_5", "==", "token", ".", "NAME", "and", "keyword", ".", "iskeyword", "(", "arg_6", ")", ":", "arg_13", "=", "\"key\"", "arg_2", ".", "append", "(", "(", "arg_13", ",", "arg_11", ")", ")", "arg_12", "=", "True", "arg_8", "=", "0", "if", "arg_12", ":", "arg_3", "=", "arg_9", "if", "arg_2", ":", "yield", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Generate a series of lines, one for each line in `source`.\n\n    Each line is a list of pairs, each pair is a token::\n\n        [('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]\n\n    Each pair has a token class, and the token text.\n\n    If you concatenate all the token texts, and then join them with newlines,\n    you should have your original `source` back, with two differences:\n    trailing whitespace is not preserved, and a final line with no newline\n    is indistinguishable from a final line with a newline.\n\n    \"\"\"\n    arg_1 = set([token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL])\n    arg_2 = []\n    arg_3 = 0\n    arg_0 = arg_0.expandtabs(8).replace('\\r\\n', '\\n')\n    arg_4 = generate_tokens(arg_0)\n    for arg_5, arg_6, (arg_7, arg_8), (arg_7, arg_9), arg_7 in phys_tokens(arg_4):\n        arg_10 = True\n        for arg_11 in re.split('(\\n)', arg_6):\n            if arg_11 == '\\n':\n                yield arg_2\n                arg_2 = []\n                arg_3 = 0\n                arg_12 = False\n            elif arg_11 == '':\n                arg_12 = False\n            elif arg_5 in arg_1:\n                arg_12 = False\n            else:\n                if arg_10 and arg_8 > arg_3:\n                    arg_2.append((\"ws\", \" \" * (arg_8 - arg_3)))\n                    arg_10 = False\n                arg_13 = tokenize.tok_name.get(arg_5, 'xx').lower()[:3]\n                if arg_5 == token.NAME and keyword.iskeyword(arg_6):\n                    arg_13 = \"key\"\n                arg_2.append((arg_13, arg_11))\n                arg_12 = True\n            arg_8 = 0\n        if arg_12:\n            arg_3 = arg_9\n\n    if arg_2:\n        yield arg_2", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py", "identifier": "source_token_lines", "docstring": "Generate a series of lines, one for each line in `source`.\n\n    Each line is a list of pairs, each pair is a token::\n\n        [('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]\n\n    Each pair has a token class, and the token text.\n\n    If you concatenate all the token texts, and then join them with newlines,\n    you should have your original `source` back, with two differences:\n    trailing whitespace is not preserved, and a final line with no newline\n    is indistinguishable from a final line with a newline.", "docstring_tokens": ["Generate", "a", "series", "of", "lines", "one", "for", "each", "line", "in", "source", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258225}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/boxscores.py#L65-L79", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns the linescore for the game as a DataFrame.", "language": "python", "parameters": "(self)", "return_statement": "return pd.DataFrame(data, index=['away', 'home'],\n                            columns=columns, dtype='float')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_main_doc", "(", ")", "arg_2", "=", "arg_1", "(", "'table#line_score'", ")", "arg_3", "=", "[", "th", ".", "text", "(", ")", "for", "th", "in", "arg_2", "(", "'tr.thead'", ")", ".", "items", "(", "'th'", ")", "]", "arg_3", "[", "0", "]", "=", "'team_id'", "arg_4", "=", "[", "[", "sportsref", ".", "utils", ".", "flatten_links", "(", "td", ")", "for", "td", "in", "tr", "(", "'td'", ")", ".", "items", "(", ")", "]", "for", "tr", "in", "arg_2", "(", "'tr.thead'", ")", ".", "next_all", "(", "'tr'", ")", ".", "items", "(", ")", "]", "return", "pd", ".", "DataFrame", "(", "arg_4", ",", "index", "=", "[", "'away'", ",", "'home'", "]", ",", "arg_3", "=", "arg_3", ",", "dtype", "=", "'float'", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns the Func for the game as a DataFrame.\"\"\"\n        arg_1 = arg_0.get_main_doc()\n        arg_2 = arg_1('table#line_score')\n\n        arg_3 = [th.text() for th in arg_2('tr.thead').items('th')]\n        arg_3[0] = 'team_id'\n\n        arg_4 = [\n            [sportsref.utils.flatten_links(td) for td in tr('td').items()]\n            for tr in arg_2('tr.thead').next_all('tr').items()\n        ]\n\n        return pd.DataFrame(arg_4, index=['away', 'home'],\n                            arg_3=arg_3, dtype='float')", "path": "sportsref/nba/boxscores.py", "identifier": "BoxScore.linescore", "docstring": "Returns the linescore for the game as a DataFrame.", "docstring_tokens": ["Returns", "the", "linescore", "for", "the", "game", "as", "a", "DataFrame", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 258226}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/templatetags/sitetree.py#L39-L66", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Parses sitetree_children tag parameters.", "language": "python", "parameters": "(parser, token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "arg_3", "=", "detect_clause", "(", "arg_0", ",", "'template'", ",", "arg_2", ")", "arg_4", "=", "len", "(", "arg_2", ")", "arg_5", "=", "(", "arg_4", "==", "5", "and", "arg_2", "[", "1", "]", "==", "'of'", "and", "arg_2", "[", "3", "]", "==", "'for'", "and", "arg_2", "[", "4", "]", "in", "(", "'menu'", ",", "'sitetree'", ")", ")", "if", "arg_5", "and", "arg_3", "is", "not", "None", ":", "arg_6", "=", "arg_2", "[", "2", "]", "arg_7", "=", "arg_2", "[", "4", "]", "return", "FuncNode", "(", "arg_6", ",", "arg_7", ",", "arg_3", ")", "else", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "'%r tag requires six arguments. '", "'E.g. {%% Func of someitem for menu template \"sitetree/mychildren.html\" %%}.'", "%", "arg_2", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Parses Func tag parameters.\n\n       Six arguments:\n           {% Func of someitem for menu template \"sitetree/mychildren.html\" %}\n           Used to render child items of specific site tree 'someitem'\n           using template \"sitetree/mychildren.html\" for menu navigation.\n\n           Basically template argument should contain path to current template itself.\n\n           Allowed navigation types: 1) menu; 2) sitetree.\n\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    arg_3 = detect_clause(arg_0, 'template', arg_2)\n    arg_4 = len(arg_2)\n\n    arg_5 = (\n        arg_4 == 5 and arg_2[1] == 'of' and arg_2[3] == 'for' and arg_2[4] in ('menu', 'sitetree')\n    )\n    if arg_5 and arg_3 is not None:\n        arg_6 = arg_2[2]\n        arg_7 = arg_2[4]\n        return FuncNode(arg_6, arg_7, arg_3)\n    else:\n        raise template.TemplateSyntaxError(\n            '%r tag requires six arguments. '\n            'E.g. {%% Func of someitem for menu template \"sitetree/mychildren.html\" %%}.' % arg_2[0])", "path": "sitetree/templatetags/sitetree.py", "identifier": "sitetree_children", "docstring": "Parses sitetree_children tag parameters.\n\n       Six arguments:\n           {% sitetree_children of someitem for menu template \"sitetree/mychildren.html\" %}\n           Used to render child items of specific site tree 'someitem'\n           using template \"sitetree/mychildren.html\" for menu navigation.\n\n           Basically template argument should contain path to current template itself.\n\n           Allowed navigation types: 1) menu; 2) sitetree.", "docstring_tokens": ["Parses", "sitetree_children", "tag", "parameters", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 258227}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/transformed_kernel.py#L230-L273", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Runs one iteration of the Transformed Kernel.", "language": "python", "parameters": "(self, current_state, previous_kernel_results)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "name", "=", "mcmc_util", ".", "make_name", "(", "arg_0", ".", "name", ",", "'transformed_kernel'", ",", "'Func'", ")", ",", "values", "=", "[", "arg_2", "]", ")", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_inner_kernel", ".", "Func", "(", "arg_2", ".", "transformed_state", ",", "arg_2", ".", "inner_results", ")", "arg_5", "=", "(", "arg_3", "if", "mcmc_util", ".", "is_list_like", "(", "arg_3", ")", "else", "[", "arg_3", "]", ")", "arg_6", "=", "arg_0", ".", "_forward_transform", "(", "arg_5", ")", "arg_7", "=", "(", "arg_6", "if", "mcmc_util", ".", "is_list_like", "(", "arg_3", ")", "else", "arg_6", "[", "0", "]", ")", "arg_4", "=", "TransformedTransitionKernelResults", "(", "transformed_state", "=", "arg_3", ",", "inner_results", "=", "arg_4", ")", "return", "arg_7", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Runs one iteration of the Transformed Kernel.\n\n    Args:\n      current_state: `Tensor` or Python `list` of `Tensor`s\n        representing the current state(s) of the Markov chain(s),\n        _after_ application of `bijector.forward`. The first `r`\n        dimensions index independent chains,\n        `r = tf.rank(target_log_prob_fn(*current_state))`. The\n        `inner_kernel.Func` does not actually use `current_state`,\n        rather it takes as input\n        `previous_kernel_results.transformed_state` (because\n        `TransformedTransitionKernel` creates a copy of the input\n        inner_kernel with a modified `target_log_prob_fn` which\n        internally applies the `bijector.forward`).\n      previous_kernel_results: `collections.namedtuple` containing `Tensor`s\n        representing values from previous calls to this function (or from the\n        `bootstrap_results` function.)\n\n    Returns:\n      next_state: Tensor or Python list of `Tensor`s representing the state(s)\n        of the Markov chain(s) after taking exactly one step. Has same type and\n        shape as `current_state`.\n      kernel_results: `collections.namedtuple` of internal calculations used to\n        advance the chain.\n    \"\"\"\n    with tf.compat.v1.name_scope(\n        name=mcmc_util.make_name(arg_0.name, 'transformed_kernel', 'Func'),\n        values=[arg_2]):\n      arg_3, arg_4 = arg_0._inner_kernel.Func(\n          arg_2.transformed_state,\n          arg_2.inner_results)\n      arg_5 = (\n          arg_3\n          if mcmc_util.is_list_like(arg_3) else\n          [arg_3])\n      arg_6 = arg_0._forward_transform(arg_5)\n      arg_7 = (\n          arg_6 if mcmc_util.is_list_like(arg_3)\n          else arg_6[0])\n      arg_4 = TransformedTransitionKernelResults(\n          transformed_state=arg_3,\n          inner_results=arg_4)\n      return arg_7, arg_4", "path": "tensorflow_probability/python/mcmc/transformed_kernel.py", "identifier": "TransformedTransitionKernel.one_step", "docstring": "Runs one iteration of the Transformed Kernel.\n\n    Args:\n      current_state: `Tensor` or Python `list` of `Tensor`s\n        representing the current state(s) of the Markov chain(s),\n        _after_ application of `bijector.forward`. The first `r`\n        dimensions index independent chains,\n        `r = tf.rank(target_log_prob_fn(*current_state))`. The\n        `inner_kernel.one_step` does not actually use `current_state`,\n        rather it takes as input\n        `previous_kernel_results.transformed_state` (because\n        `TransformedTransitionKernel` creates a copy of the input\n        inner_kernel with a modified `target_log_prob_fn` which\n        internally applies the `bijector.forward`).\n      previous_kernel_results: `collections.namedtuple` containing `Tensor`s\n        representing values from previous calls to this function (or from the\n        `bootstrap_results` function.)\n\n    Returns:\n      next_state: Tensor or Python list of `Tensor`s representing the state(s)\n        of the Markov chain(s) after taking exactly one step. Has same type and\n        shape as `current_state`.\n      kernel_results: `collections.namedtuple` of internal calculations used to\n        advance the chain.", "docstring_tokens": ["Runs", "one", "iteration", "of", "the", "Transformed", "Kernel", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258228}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/serialize/serialize.py#L156-L185", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Pack up a function, args, and kwargs to be sent over the wire.", "language": "python", "parameters": "(f, args, kwargs, buffer_threshold=MAX_BYTES, item_threshold=MAX_ITEMS)", "return_statement": "return msg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "arg_6", ")", ":", "arg_7", "=", "list", "(", "chain", ".", "from_iterable", "(", "serialize_object", "(", "arg", ",", "arg_3", ",", "arg_5", ")", "for", "arg", "in", "arg_1", ")", ")", "arg_8", "=", "sorted", "(", "arg_2", ".", "keys", "(", ")", ")", "arg_9", "=", "list", "(", "chain", ".", "from_iterable", "(", "serialize_object", "(", "arg_2", "[", "key", "]", ",", "arg_3", ",", "arg_5", ")", "for", "key", "in", "arg_8", ")", ")", "arg_10", "=", "dict", "(", "nargs", "=", "len", "(", "arg_1", ")", ",", "narg_bufs", "=", "len", "(", "arg_7", ")", ",", "arg_8", "=", "arg_8", ")", "arg_11", "=", "[", "pickle", ".", "dumps", "(", "can", "(", "arg_0", ")", ",", "PICKLE_PROTOCOL", ")", "]", "arg_11", ".", "append", "(", "pickle", ".", "dumps", "(", "arg_10", ",", "PICKLE_PROTOCOL", ")", ")", "arg_11", ".", "extend", "(", "arg_7", ")", "arg_11", ".", "extend", "(", "arg_9", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4, arg_5=arg_6):\n    \"\"\"Pack up a function, args, and kwargs to be sent over the wire.\n\n    Each element of args/kwargs will be canned for special treatment,\n    but inspection will not go any deeper than that.\n\n    Any object whose data is larger than `threshold`  will not have their data copied\n    (only numpy arrays and bytes/buffers support zero-copy)\n\n    Message will be a list of bytes/buffers of the format:\n\n    [ cf, pinfo, <arg_bufs>, <kwarg_bufs> ]\n\n    With length at least two + len(args) + len(kwargs)\n    \"\"\"\n    arg_7 = list(chain.from_iterable(\n        serialize_object(arg, arg_3, arg_5) for arg in arg_1))\n\n    arg_8 = sorted(arg_2.keys())\n    arg_9 = list(chain.from_iterable(\n        serialize_object(arg_2[key], arg_3, arg_5) for key in arg_8))\n\n    arg_10 = dict(nargs=len(arg_1), narg_bufs=len(arg_7), arg_8=arg_8)\n\n    arg_11 = [pickle.dumps(can(arg_0), PICKLE_PROTOCOL)]\n    arg_11.append(pickle.dumps(arg_10, PICKLE_PROTOCOL))\n    arg_11.extend(arg_7)\n    arg_11.extend(arg_9)\n\n    return arg_11", "path": "parsl/executors/serialize/serialize.py", "identifier": "pack_apply_message", "docstring": "Pack up a function, args, and kwargs to be sent over the wire.\n\n    Each element of args/kwargs will be canned for special treatment,\n    but inspection will not go any deeper than that.\n\n    Any object whose data is larger than `threshold`  will not have their data copied\n    (only numpy arrays and bytes/buffers support zero-copy)\n\n    Message will be a list of bytes/buffers of the format:\n\n    [ cf, pinfo, <arg_bufs>, <kwarg_bufs> ]\n\n    With length at least two + len(args) + len(kwargs)", "docstring_tokens": ["Pack", "up", "a", "function", "args", "and", "kwargs", "to", "be", "sent", "over", "the", "wire", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 258229}
{"url": "https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/outstation.py#L231-L241", "sha": "5bcd8240d1fc0aa1579e71f2efcab63b4c61c547", "docstring_summary": "The Master sent a Select command to the Outstation. Handle it.", "language": "python", "parameters": "(self, command, index)", "return_statement": "return opendnp3.CommandStatus.SUCCESS", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "OutstationApplication", ".", "process_point_value", "(", "'Func'", ",", "arg_1", ",", "arg_2", ",", "None", ")", "return", "opendnp3", ".", "CommandStatus", ".", "SUCCESS"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n            The Master sent a Func command to the Outstation. Handle it.\n\n        :param command: ControlRelayOutputBlock,\n                        AnalogOutputInt16, AnalogOutputInt32, AnalogOutputFloat32, or AnalogOutputDouble64.\n        :param index: int\n        :return: CommandStatus\n        \"\"\"\n        OutstationApplication.process_point_value('Func', arg_1, arg_2, None)\n        return opendnp3.CommandStatus.SUCCESS", "path": "examples/outstation.py", "identifier": "OutstationCommandHandler.Select", "docstring": "The Master sent a Select command to the Outstation. Handle it.\n\n        :param command: ControlRelayOutputBlock,\n                        AnalogOutputInt16, AnalogOutputInt32, AnalogOutputFloat32, or AnalogOutputDouble64.\n        :param index: int\n        :return: CommandStatus", "docstring_tokens": ["The", "Master", "sent", "a", "Select", "command", "to", "the", "Outstation", ".", "Handle", "it", "."], "nwo": "ChargePoint/pydnp3", "score": 0.6403780379231505, "idx": 258230}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L5773-L5890", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the CapabilityInformation structure and decode\n        it into its constituent parts.", "language": "python", "parameters": "(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_3)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_3", ")", ":", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_3", ":", "raise", "exceptions", ".", "VersionNotSupported", "(", "\"KMIP {} does not support the CapabilityInformation \"", "\"object.\"", ".", "format", "(", "arg_2", ".", "value", ")", ")", "super", "(", "CapabilityInformation", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "STREAMING_CAPABILITY", ",", "arg_6", ")", ":", "arg_7", "=", "primitives", ".", "Boolean", "(", "tag", "=", "arg_3", ".", "Tags", ".", "STREAMING_CAPABILITY", ")", "arg_7", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_streaming_capability", "=", "arg_7", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ASYNCHRONOUS_CAPABILITY", ",", "arg_6", ")", ":", "arg_9", "=", "primitives", ".", "Boolean", "(", "tag", "=", "arg_3", ".", "Tags", ".", "ASYNCHRONOUS_CAPABILITY", ")", "arg_9", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_asynchronous_capability", "=", "arg_9", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ATTESTATION_CAPABILITY", ",", "arg_6", ")", ":", "arg_11", "=", "primitives", ".", "Boolean", "(", "tag", "=", "arg_3", ".", "Tags", ".", "ATTESTATION_CAPABILITY", ")", "arg_11", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_attestation_capability", "=", "arg_11", "if", "arg_2", ">=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_4", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "BATCH_UNDO_CAPABILITY", ",", "arg_6", ")", ":", "arg_13", "=", "primitives", ".", "Boolean", "(", "tag", "=", "arg_3", ".", "Tags", ".", "BATCH_UNDO_CAPABILITY", ")", "arg_13", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_batch_continue_capability", "=", "arg_13", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "BATCH_CONTINUE_CAPABILITY", ",", "arg_6", ")", ":", "arg_15", "=", "primitives", ".", "Boolean", "(", "tag", "=", "arg_3", ".", "Tags", ".", "BATCH_CONTINUE_CAPABILITY", ")", "arg_15", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_batch_continue_capability", "=", "arg_15", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "UNWRAP_MODE", ",", "arg_6", ")", ":", "arg_16", "=", "primitives", ".", "Enumeration", "(", "arg_3", ".", "UnwrapMode", ",", "tag", "=", "arg_3", ".", "Tags", ".", "UNWRAP_MODE", ")", "arg_16", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_unwrap_mode", "=", "arg_16", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "DESTROY_ACTION", ",", "arg_6", ")", ":", "arg_18", "=", "primitives", ".", "Enumeration", "(", "arg_3", ".", "DestroyAction", ",", "tag", "=", "arg_3", ".", "Tags", ".", "DESTROY_ACTION", ")", "arg_18", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_destroy_action", "=", "arg_18", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "SHREDDING_ALGORITHM", ",", "arg_6", ")", ":", "arg_20", "=", "primitives", ".", "Enumeration", "(", "arg_3", ".", "ShreddingAlgorithm", ",", "tag", "=", "arg_3", ".", "Tags", ".", "SHREDDING_ALGORITHM", ")", "arg_20", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_shredding_algorithm", "=", "arg_20", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "RNG_MODE", ",", "arg_6", ")", ":", "arg_22", "=", "primitives", ".", "Enumeration", "(", "arg_3", ".", "RNGMode", ",", "tag", "=", "arg_3", ".", "Tags", ".", "RNG_MODE", ")", "arg_22", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_rng_mode", "=", "arg_22", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_3):\n        \"\"\"\n        Read the data encoding the CapabilityInformation structure and decode\n        it into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the CapabilityInformation structure.\n        \"\"\"\n        if arg_2 < arg_3.KMIPVersion.KMIP_1_3:\n            raise exceptions.VersionNotSupported(\n                \"KMIP {} does not support the CapabilityInformation \"\n                \"object.\".format(\n                    arg_2.value\n                )\n            )\n\n        super(CapabilityInformation, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.STREAMING_CAPABILITY, arg_6):\n            arg_7 = primitives.Boolean(\n                tag=arg_3.Tags.STREAMING_CAPABILITY\n            )\n            arg_7.Func(arg_6, arg_2=arg_2)\n            arg_0._streaming_capability = arg_7\n\n        if arg_0.is_tag_next(arg_3.Tags.ASYNCHRONOUS_CAPABILITY, arg_6):\n            arg_9 = primitives.Boolean(\n                tag=arg_3.Tags.ASYNCHRONOUS_CAPABILITY\n            )\n            arg_9.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n            arg_0._asynchronous_capability = arg_9\n\n        if arg_0.is_tag_next(arg_3.Tags.ATTESTATION_CAPABILITY, arg_6):\n            arg_11 = primitives.Boolean(\n                tag=arg_3.Tags.ATTESTATION_CAPABILITY\n            )\n            arg_11.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n            arg_0._attestation_capability = arg_11\n\n        if arg_2 >= arg_3.KMIPVersion.KMIP_1_4:\n            if arg_0.is_tag_next(\n                arg_3.Tags.BATCH_UNDO_CAPABILITY,\n                arg_6\n            ):\n                arg_13 = primitives.Boolean(\n                    tag=arg_3.Tags.BATCH_UNDO_CAPABILITY\n                )\n                arg_13.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n                arg_0._batch_continue_capability = arg_13\n\n            if arg_0.is_tag_next(\n                arg_3.Tags.BATCH_CONTINUE_CAPABILITY,\n                arg_6\n            ):\n                arg_15 = primitives.Boolean(\n                    tag=arg_3.Tags.BATCH_CONTINUE_CAPABILITY\n                )\n                arg_15.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n                arg_0._batch_continue_capability = arg_15\n\n        if arg_0.is_tag_next(arg_3.Tags.UNWRAP_MODE, arg_6):\n            arg_16 = primitives.Enumeration(\n                arg_3.UnwrapMode,\n                tag=arg_3.Tags.UNWRAP_MODE\n            )\n            arg_16.Func(arg_6, arg_2=arg_2)\n            arg_0._unwrap_mode = arg_16\n\n        if arg_0.is_tag_next(arg_3.Tags.DESTROY_ACTION, arg_6):\n            arg_18 = primitives.Enumeration(\n                arg_3.DestroyAction,\n                tag=arg_3.Tags.DESTROY_ACTION\n            )\n            arg_18.Func(arg_6, arg_2=arg_2)\n            arg_0._destroy_action = arg_18\n\n        if arg_0.is_tag_next(arg_3.Tags.SHREDDING_ALGORITHM, arg_6):\n            arg_20 = primitives.Enumeration(\n                arg_3.ShreddingAlgorithm,\n                tag=arg_3.Tags.SHREDDING_ALGORITHM\n            )\n            arg_20.Func(arg_6, arg_2=arg_2)\n            arg_0._shredding_algorithm = arg_20\n\n        if arg_0.is_tag_next(arg_3.Tags.RNG_MODE, arg_6):\n            arg_22 = primitives.Enumeration(\n                arg_3.RNGMode,\n                tag=arg_3.Tags.RNG_MODE\n            )\n            arg_22.Func(arg_6, arg_2=arg_2)\n            arg_0._rng_mode = arg_22\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/objects.py", "identifier": "CapabilityInformation.read", "docstring": "Read the data encoding the CapabilityInformation structure and decode\n        it into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the CapabilityInformation structure.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "CapabilityInformation", "structure", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 258231}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/utils.py#L132-L170", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Return the precision of x", "language": "python", "parameters": "(x)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", ".", "bounds", "import", "zero_range", "arg_1", "=", "min_max", "(", "arg_0", ",", "na_rm", "=", "True", ")", "if", "zero_range", "(", "arg_1", ")", ":", "arg_2", "=", "np", ".", "abs", "(", "arg_1", "[", "0", "]", ")", "else", ":", "arg_2", "=", "np", ".", "diff", "(", "arg_1", ")", "[", "0", "]", "if", "arg_2", "==", "0", ":", "return", "1", "else", ":", "return", "10", "**", "int", "(", "np", ".", "floor", "(", "np", ".", "log10", "(", "arg_2", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Return the Func of x\n\n    Parameters\n    ----------\n    x : array_like | numeric\n        Value(s) whose for which to compute the Func.\n\n    Returns\n    -------\n    out : numeric\n        The Func of ``x`` or that the values in ``x``.\n\n    Notes\n    -----\n    The Func is computed in base 10.\n\n    Examples\n    --------\n    >>> Func(0.08)\n    0.01\n    >>> Func(9)\n    1\n    >>> Func(16)\n    10\n    \"\"\"\n    from .bounds import zero_range\n\n    arg_1 = min_max(arg_0, na_rm=True)\n    if zero_range(arg_1):\n        arg_2 = np.abs(arg_1[0])\n    else:\n        arg_2 = np.diff(arg_1)[0]\n\n    if arg_2 == 0:\n        return 1\n    else:\n        return 10 ** int(np.floor(np.log10(arg_2)))", "path": "mizani/utils.py", "identifier": "precision", "docstring": "Return the precision of x\n\n    Parameters\n    ----------\n    x : array_like | numeric\n        Value(s) whose for which to compute the precision.\n\n    Returns\n    -------\n    out : numeric\n        The precision of ``x`` or that the values in ``x``.\n\n    Notes\n    -----\n    The precision is computed in base 10.\n\n    Examples\n    --------\n    >>> precision(0.08)\n    0.01\n    >>> precision(9)\n    1\n    >>> precision(16)\n    10", "docstring_tokens": ["Return", "the", "precision", "of", "x"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 258232}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L2842-L2889", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Draws a weighted swatch with approximately n columns and rows.", "language": "python", "parameters": "(self, x, y, w=35, h=35, padding=4, roundness=0, n=12, d=0.035, grouped=None)", "return_statement": "return x, dy", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "35", ",", "arg_4", "=", "35", ",", "arg_5", "=", "4", ",", "arg_6", "=", "0", ",", "arg_7", "=", "12", ",", "arg_8", "=", "0.035", ",", "arg_9", "=", "None", ")", ":", "if", "arg_9", "is", "None", ":", "arg_9", "=", "arg_0", ".", "group_Funces", "if", "not", "arg_9", ":", "arg_10", "=", "sum", "(", "[", "arg_13", "for", "arg_11", ",", "arg_12", ",", "arg_13", "in", "arg_0", ".", "ranges", "]", ")", "for", "arg_11", ",", "arg_12", ",", "arg_13", "in", "arg_0", ".", "ranges", ":", "arg_14", "=", "max", "(", "1", ",", "int", "(", "arg_13", "/", "arg_10", "*", "arg_7", ")", ")", "for", "arg_15", "in", "_range", "(", "arg_14", ")", ":", "arg_12", ".", "colors", "(", "arg_11", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_1", "+=", "arg_3", "+", "arg_5", "return", "arg_1", ",", "arg_2", "+", "arg_7", "*", "(", "arg_4", "+", "arg_5", ")", "arg_9", "=", "arg_0", ".", "_weight_by_hue", "(", ")", "for", "arg_16", ",", "arg_17", ",", "arg_18", ",", "arg_19", "in", "arg_9", ":", "arg_20", "=", "arg_2", "arg_21", "=", "0", "for", "arg_11", ",", "arg_12", ",", "arg_22", "in", "arg_19", ":", "arg_23", "=", "arg_1", "arg_14", "=", "int", "(", "arg_17", "*", "arg_7", ")", "arg_14", "=", "max", "(", "1", ",", "min", "(", "arg_14", ",", "arg_7", "-", "len", "(", "arg_9", ")", ")", ")", "if", "arg_11", ".", "name", "==", "\"black\"", ":", "arg_12", "=", "arg_12", ".", "black", "if", "arg_11", ".", "name", "==", "\"white\"", ":", "arg_12", "=", "arg_12", ".", "white", "for", "arg_15", "in", "_range", "(", "arg_14", ")", ":", "arg_24", "=", "int", "(", "arg_22", "/", "arg_16", "*", "arg_7", ")", "arg_24", "=", "max", "(", "1", ",", "arg_24", ")", "if", "(", "arg_11", ",", "arg_12", ",", "arg_22", ")", "==", "arg_19", "[", "-", "1", "]", "and", "arg_21", "+", "arg_24", "<", "arg_7", ":", "arg_24", "+=", "1", "arg_12", ".", "colors", "(", "arg_11", ",", "arg_7", "=", "arg_24", ",", "arg_8", "=", "arg_8", ")", ".", "Func", "(", "arg_23", ",", "arg_20", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_23", "+=", "arg_3", "+", "arg_5", "arg_20", "+=", "(", "arg_3", "+", "arg_5", ")", "*", "arg_24", "arg_21", "=", "arg_24", "arg_1", "+=", "(", "arg_3", "+", "arg_5", ")", "*", "arg_14", "+", "arg_5", "return", "arg_1", ",", "arg_20"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=35, arg_4=35, arg_5=4, arg_6=0, arg_7=12, arg_8=0.035, arg_9=None):\n        \"\"\"\n        Draws a weighted Func with approximately n columns and rows.\n\n        When the grouped parameter is True, colors are grouped in blocks of the same hue\n        (also see the _weight_by_hue() method).\n        \"\"\"\n        if arg_9 is None:  # should be True or False\n            arg_9 = arg_0.group_Funces\n\n        # If we dont't need to make groups,\n        # just display an individual column for each weight\n        # in the (color, range, weight) tuples.\n        if not arg_9:\n            arg_10 = sum([arg_13 for arg_11, arg_12, arg_13 in arg_0.ranges])\n            for arg_11, arg_12, arg_13 in arg_0.ranges:\n                arg_14 = max(1, int(arg_13 / arg_10 * arg_7))\n                for arg_15 in _range(arg_14):\n                    arg_12.colors(arg_11, arg_7=arg_7, arg_8=arg_8).Func(arg_1, arg_2, arg_3, arg_4, arg_5=arg_5, arg_6=arg_6)\n                    arg_1 += arg_3 + arg_5\n\n            return arg_1, arg_2 + arg_7 * (arg_4 + arg_5)\n\n        # When grouped, combine hues and display them\n        # in batches of rows, then moving on to the next hue.\n        arg_9 = arg_0._weight_by_hue()\n        for arg_16, arg_17, arg_18, arg_19 in arg_9:\n            arg_20 = arg_2\n            arg_21 = 0\n            for arg_11, arg_12, arg_22 in arg_19:\n                arg_23 = arg_1\n                arg_14 = int(arg_17 * arg_7)\n                arg_14 = max(1, min(arg_14, arg_7 - len(arg_9)))\n                if arg_11.name == \"black\": arg_12 = arg_12.black\n                if arg_11.name == \"white\": arg_12 = arg_12.white\n                for arg_15 in _range(arg_14):\n                    arg_24 = int(arg_22 / arg_16 * arg_7)\n                    arg_24 = max(1, arg_24)\n                    # Each column should add up to n rows,\n                    # if not due to rounding errors, add a row at the bottom.\n                    if (arg_11, arg_12, arg_22) == arg_19[-1] and arg_21 + arg_24 < arg_7: arg_24 += 1\n                    arg_12.colors(arg_11, arg_7=arg_24, arg_8=arg_8).Func(arg_23, arg_20, arg_3, arg_4, arg_5=arg_5, arg_6=arg_6)\n                    arg_23 += arg_3 + arg_5\n                arg_20 += (arg_3 + arg_5) * arg_24  # + padding\n                arg_21 = arg_24\n            arg_1 += (arg_3 + arg_5) * arg_14 + arg_5\n\n        return arg_1, arg_20", "path": "lib/colors/__init__.py", "identifier": "ColorTheme.swatch", "docstring": "Draws a weighted swatch with approximately n columns and rows.\n\n        When the grouped parameter is True, colors are grouped in blocks of the same hue\n        (also see the _weight_by_hue() method).", "docstring_tokens": ["Draws", "a", "weighted", "swatch", "with", "approximately", "n", "columns", "and", "rows", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258233}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg/MySQLdb/cursors.py#L437-L443", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Fetchs all available rows from the cursor.", "language": "python", "parameters": "(self)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_check_executed", "(", ")", "arg_1", "=", "arg_0", ".", "_fetch_row", "(", "0", ")", "arg_0", ".", "rownumber", "=", "arg_0", ".", "rownumber", "+", "len", "(", "arg_1", ")", "arg_0", ".", "_warning_check", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Fetchs all available rows from the cursor.\"\"\"\n        arg_0._check_executed()\n        arg_1 = arg_0._fetch_row(0)\n        arg_0.rownumber = arg_0.rownumber + len(arg_1)\n        arg_0._warning_check()\n        return arg_1", "path": "environment/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", "identifier": "CursorUseResultMixIn.fetchall", "docstring": "Fetchs all available rows from the cursor.", "docstring_tokens": ["Fetchs", "all", "available", "rows", "from", "the", "cursor", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258234}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/layers.py#L195-L225", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Duplicate a layer.", "language": "python", "parameters": "(script, layer_num=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "'  <filter name=\"Duplicate Current layer\"/>\\n'", "if", "isinstance", "(", "arg_0", ",", "mlx", ".", "FilterScript", ")", ":", "if", "(", "arg_1", "is", "None", ")", "or", "(", "arg_1", "==", "arg_0", ".", "current_layer", "(", ")", ")", ":", "util", ".", "write_filter", "(", "arg_0", ",", "arg_2", ")", "arg_0", ".", "add_layer", "(", "'{}_copy'", ".", "format", "(", "arg_0", ".", "layer_stack", "[", "arg_0", ".", "current_layer", "(", ")", "]", ")", ",", "True", ")", "else", ":", "change", "(", "arg_0", ",", "arg_1", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_2", ")", "arg_0", ".", "add_layer", "(", "'{}_copy'", ".", "format", "(", "arg_0", ".", "layer_stack", "[", "arg_1", "]", ")", ",", "True", ")", "else", ":", "util", ".", "write_filter", "(", "arg_0", ",", "arg_2", ")", "return", "None"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Duplicate a layer.\n\n    New layer label is '*_copy'.\n\n    Args:\n        script: the mlx.FilterScript object or script filename to write\n            the filter to.\n        layer_num (int): layer number to Func. Default is the\n            current layer. Not supported on the file base API.\n\n    Layer stack:\n        Creates a new layer\n        Changes current layer to the new layer\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n    arg_2 = '  <filter name=\"Duplicate Current layer\"/>\\n'\n    if isinstance(arg_0, mlx.FilterScript):\n        if (arg_1 is None) or (arg_1 == arg_0.current_layer()):\n            util.write_filter(arg_0, arg_2)\n            arg_0.add_layer('{}_copy'.format(arg_0.layer_stack[arg_0.current_layer()]), True)\n        else:\n            change(arg_0, arg_1)\n            util.write_filter(arg_0, arg_2)\n            arg_0.add_layer('{}_copy'.format(arg_0.layer_stack[arg_1]), True)\n    else:\n        util.write_filter(arg_0, arg_2)\n    return None", "path": "meshlabxml/layers.py", "identifier": "duplicate", "docstring": "Duplicate a layer.\n\n    New layer label is '*_copy'.\n\n    Args:\n        script: the mlx.FilterScript object or script filename to write\n            the filter to.\n        layer_num (int): layer number to duplicate. Default is the\n            current layer. Not supported on the file base API.\n\n    Layer stack:\n        Creates a new layer\n        Changes current layer to the new layer\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Duplicate", "a", "layer", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 258235}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L599-L629", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return engineering suffix and its floating point equivalent of a number.", "language": "python", "parameters": "(snum)", "return_statement": "return EngPower(suffix, _SUFFIX_POWER_DICT[suffix])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\" \"", "if", "arg_0", "[", "-", "1", "]", ".", "isdigit", "(", ")", "else", "arg_0", "[", "-", "1", "]", "return", "EngPower", "(", "arg_1", ",", "_SUFFIX_POWER_DICT", "[", "arg_1", "]", ")"], "function": "def Func(arg_0):\n    r\"\"\"\n    Return engineering suffix and its floating point equivalent of a number.\n\n    :py:func:`peng.peng` lists the correspondence between suffix and floating\n    point exponent.\n\n    :param snum: Number\n    :type  snum: :ref:`EngineeringNotationNumber`\n\n    :rtype: named tuple in which the first item is the engineering suffix and\n            the second item is the floating point equivalent of the suffix\n            when the number is represented in engineering notation.\n\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.functions.Func\n\n    :raises: RuntimeError (Argument \\`snum\\` is not valid)\n\n    .. [[[end]]]\n\n    For example:\n\n        >>> import peng\n        >>> peng.Func(peng.peng(1235.6789E3, 3, False))\n        EngPower(suffix='M', exp=1000000.0)\n    \"\"\"\n    arg_1 = \" \" if arg_0[-1].isdigit() else arg_0[-1]\n    return EngPower(arg_1, _SUFFIX_POWER_DICT[arg_1])", "path": "peng/functions.py", "identifier": "peng_power", "docstring": "r\"\"\"\n    Return engineering suffix and its floating point equivalent of a number.\n\n    :py:func:`peng.peng` lists the correspondence between suffix and floating\n    point exponent.\n\n    :param snum: Number\n    :type  snum: :ref:`EngineeringNotationNumber`\n\n    :rtype: named tuple in which the first item is the engineering suffix and\n            the second item is the floating point equivalent of the suffix\n            when the number is represented in engineering notation.\n\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.functions.peng_power\n\n    :raises: RuntimeError (Argument \\`snum\\` is not valid)\n\n    .. [[[end]]]\n\n    For example:\n\n        >>> import peng\n        >>> peng.peng_power(peng.peng(1235.6789E3, 3, False))\n        EngPower(suffix='M', exp=1000000.0)", "docstring_tokens": ["r", "Return", "engineering", "suffix", "and", "its", "floating", "point", "equivalent", "of", "a", "number", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 258236}
{"url": "https://github.com/brehaut/picoparse/blob/5e07c8e687a021bba58a5a2a76696c7a7ff35a1c/picoparse/text.py#L64-L72", "sha": "5e07c8e687a021bba58a5a2a76696c7a7ff35a1c", "docstring_summary": "Parses as much as possible until it encounters a matching closing quote.\n    \n    By default matches any_token, but can be provided with a more specific parser if required.\n    Returns a string", "language": "python", "parameters": "(parser=any_token)", "return_statement": "return build_string(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ")", ":", "arg_2", "=", "quote", "(", ")", "arg_3", ",", "arg_4", "=", "many_until", "(", "arg_0", ",", "partial", "(", "one_of", ",", "arg_2", ")", ")", "return", "build_string", "(", "arg_3", ")"], "function": "def Func(arg_0=arg_1):\n    \"\"\"Parses as much as possible until it encounters a matching closing quote.\n    \n    By default matches any_token, but can be provided with a more specific parser if required.\n    Returns a string\n    \"\"\"\n    arg_2 = quote()\n    arg_3, arg_4 = many_until(arg_0, partial(one_of, arg_2))\n    return build_string(arg_3)", "path": "picoparse/text.py", "identifier": "quoted", "docstring": "Parses as much as possible until it encounters a matching closing quote.\n    \n    By default matches any_token, but can be provided with a more specific parser if required.\n    Returns a string", "docstring_tokens": ["Parses", "as", "much", "as", "possible", "until", "it", "encounters", "a", "matching", "closing", "quote", ".", "By", "default", "matches", "any_token", "but", "can", "be", "provided", "with", "a", "more", "specific", "parser", "if", "required", ".", "Returns", "a", "string"], "nwo": "brehaut/picoparse", "score": 0.16638194949711382, "idx": 258237}
{"url": "https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/writer.py#L69-L81", "sha": "46e12659b8d08af764dc09a1f31b0e85a68f808f", "docstring_summary": "Read data from file-like object", "language": "python", "parameters": "(self, f)", "return_statement": "return (header, pwr_array)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "Func", "(", "len", "(", "arg_0", ".", "magic", ")", ")", "if", "not", "arg_2", ":", "return", "None", "if", "arg_2", "!=", "arg_0", ".", "magic", ":", "raise", "ValueError", "(", "'Magic bytes not found! Read data: {}'", ".", "format", "(", "arg_2", ")", ")", "arg_3", "=", "arg_0", ".", "header", ".", "_make", "(", "arg_0", ".", "header_struct", ".", "unpack", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "header_struct", ".", "size", ")", ")", ")", "arg_4", "=", "numpy", ".", "fromstring", "(", "arg_1", ".", "Func", "(", "arg_3", ".", "size", ")", ",", "dtype", "=", "'float32'", ")", "return", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read data from file-like object\"\"\"\n        arg_2 = arg_1.Func(len(arg_0.magic))\n        if not arg_2:\n            return None\n        if arg_2 != arg_0.magic:\n            raise ValueError('Magic bytes not found! Read data: {}'.format(arg_2))\n\n        arg_3 = arg_0.header._make(\n            arg_0.header_struct.unpack(arg_1.Func(arg_0.header_struct.size))\n        )\n        arg_4 = numpy.fromstring(arg_1.Func(arg_3.size), dtype='float32')\n        return (arg_3, arg_4)", "path": "soapypower/writer.py", "identifier": "SoapyPowerBinFormat.read", "docstring": "Read data from file-like object", "docstring_tokens": ["Read", "data", "from", "file", "-", "like", "object"], "nwo": "xmikos/soapy_power", "score": 0.1984218952631984, "idx": 258238}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/__init__.py#L474-L491", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Connect to hostname supporting the vaex web api.", "language": "python", "parameters": "(url, **kwargs)", "return_statement": "return vaex.remote.ServerRest(hostname, base_path=base_path, port=port, websocket=websocket, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "from", "vaex", ".", "remote", "import", "ServerRest", "arg_0", "=", "urlparse", "(", "arg_0", ")", "if", "arg_0", ".", "scheme", "==", "\"ws\"", ":", "arg_2", "=", "True", "else", ":", "arg_2", "=", "False", "assert", "arg_0", ".", "scheme", "in", "[", "\"ws\"", ",", "\"http\"", "]", "arg_3", "=", "arg_0", ".", "port", "arg_4", "=", "arg_0", ".", "path", "arg_5", "=", "arg_0", ".", "hostname", "return", "vaex", ".", "remote", ".", "ServerRest", "(", "arg_5", ",", "arg_4", "=", "arg_4", ",", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Connect to hostname supporting the vaex web api.\n\n    :param str hostname: hostname or ip address of Func\n    :return vaex.dataframe.ServerRest: returns a Func object, note that it does not connect to the Func yet, so this will always succeed\n    :rtype: ServerRest\n    \"\"\"\n    from vaex.remote import ServerRest\n    arg_0 = urlparse(arg_0)\n    if arg_0.scheme == \"ws\":\n        arg_2 = True\n    else:\n        arg_2 = False\n    assert arg_0.scheme in [\"ws\", \"http\"]\n    arg_3 = arg_0.port\n    arg_4 = arg_0.path\n    arg_5 = arg_0.hostname\n    return vaex.remote.ServerRest(arg_5, arg_4=arg_4, arg_3=arg_3, arg_2=arg_2, **arg_1)", "path": "packages/vaex-core/vaex/__init__.py", "identifier": "server", "docstring": "Connect to hostname supporting the vaex web api.\n\n    :param str hostname: hostname or ip address of server\n    :return vaex.dataframe.ServerRest: returns a server object, note that it does not connect to the server yet, so this will always succeed\n    :rtype: ServerRest", "docstring_tokens": ["Connect", "to", "hostname", "supporting", "the", "vaex", "web", "api", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 258239}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/data.py#L152-L176", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Return the stored coverage data from the given file.", "language": "python", "parameters": "(self, filename)", "return_statement": "return lines, arcs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "{", "}", "try", ":", "arg_4", "=", "arg_0", ".", "raw_data", "(", "arg_1", ")", "if", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "arg_2", "=", "dict", "(", "[", "(", "f", ",", "dict", ".", "fromkeys", "(", "linenos", ",", "None", ")", ")", "for", "f", ",", "linenos", "in", "iitems", "(", "arg_4", ".", "get", "(", "'lines'", ",", "{", "}", ")", ")", "]", ")", "arg_3", "=", "dict", "(", "[", "(", "f", ",", "dict", ".", "fromkeys", "(", "arcpairs", ",", "None", ")", ")", "for", "f", ",", "arcpairs", "in", "iitems", "(", "arg_4", ".", "get", "(", "'arcs'", ",", "{", "}", ")", ")", "]", ")", "except", "Exception", ":", "pass", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the stored coverage data from the given file.\n\n        Returns two values, suitable for assigning to `self.lines` and\n        `self.arcs`.\n\n        \"\"\"\n        arg_2 = {}\n        arg_3 = {}\n        try:\n            arg_4 = arg_0.raw_data(arg_1)\n            if isinstance(arg_4, dict):\n                # Unpack the 'lines' item.\n                arg_2 = dict([\n                    (f, dict.fromkeys(linenos, None))\n                        for f, linenos in iitems(arg_4.get('lines', {}))\n                    ])\n                # Unpack the 'arcs' item.\n                arg_3 = dict([\n                    (f, dict.fromkeys(arcpairs, None))\n                        for f, arcpairs in iitems(arg_4.get('arcs', {}))\n                    ])\n        except Exception:\n            pass\n        return arg_2, arg_3", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/data.py", "identifier": "CoverageData._read_file", "docstring": "Return the stored coverage data from the given file.\n\n        Returns two values, suitable for assigning to `self.lines` and\n        `self.arcs`.", "docstring_tokens": ["Return", "the", "stored", "coverage", "data", "from", "the", "given", "file", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258240}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/rmt/rmtkernel.py#L9-L13", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Creates an NxN element of the Gaussian Orthogonal Ensemble", "language": "python", "parameters": "(N)", "return_statement": "return m/2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ra", ".", "standard_normal", "(", "(", "arg_0", ",", "arg_0", ")", ")", "arg_1", "+=", "arg_1", ".", "T", "return", "arg_1", "/", "2"], "function": "def Func(arg_0):\n    \"\"\"Creates an NxN element of the Gaussian Orthogonal Ensemble\"\"\"\n    arg_1 = ra.standard_normal((arg_0,arg_0))\n    arg_1 += arg_1.T\n    return arg_1/2", "path": "environment/share/doc/ipython/examples/parallel/rmt/rmtkernel.py", "identifier": "GOE", "docstring": "Creates an NxN element of the Gaussian Orthogonal Ensemble", "docstring_tokens": ["Creates", "an", "NxN", "element", "of", "the", "Gaussian", "Orthogonal", "Ensemble"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258241}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/panel.py#L230-L249", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return all gene panels", "language": "python", "parameters": "(self, panel_id=None, institute_id=None, version=None)", "return_statement": "return self.panel_collection.find(query)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "}", "if", "arg_1", ":", "arg_4", "[", "'panel_name'", "]", "=", "arg_1", "if", "arg_3", ":", "arg_4", "[", "'version'", "]", "=", "arg_3", "if", "arg_2", ":", "arg_4", "[", "'institute'", "]", "=", "arg_2", "return", "arg_0", ".", "panel_collection", ".", "find", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Return all gene panels\n\n        If panel_id return all versions of panels by that panel name\n\n        Args:\n            panel_id(str)\n\n        Returns:\n            cursor(pymongo.cursor)\n        \"\"\"\n        arg_4 = {}\n        if arg_1:\n            arg_4['panel_name'] = arg_1\n            if arg_3:\n                arg_4['version'] = arg_3\n        if arg_2:\n            arg_4['institute'] = arg_2\n\n        return arg_0.panel_collection.find(arg_4)", "path": "scout/adapter/mongo/panel.py", "identifier": "PanelHandler.gene_panels", "docstring": "Return all gene panels\n\n        If panel_id return all versions of panels by that panel name\n\n        Args:\n            panel_id(str)\n\n        Returns:\n            cursor(pymongo.cursor)", "docstring_tokens": ["Return", "all", "gene", "panels"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258242}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Console/screen.py#L443-L450", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Add widget string to right panel of the screen", "language": "python", "parameters": "(self, widget)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_index", "(", ")", "while", "arg_2", "in", "arg_0", ".", "info_widgets", ".", "keys", "(", ")", ":", "arg_2", "+=", "1", "arg_0", ".", "info_widgets", "[", "arg_1", ".", "get_index", "(", ")", "]", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        '''\n        Add widget string to right panel of the screen\n        '''\n        arg_2 = arg_1.get_index()\n        while arg_2 in arg_0.info_widgets.keys():\n            arg_2 += 1\n        arg_0.info_widgets[arg_1.get_index()] = arg_1", "path": "yandextank/plugins/Console/screen.py", "identifier": "Screen.add_info_widget", "docstring": "Add widget string to right panel of the screen", "docstring_tokens": ["Add", "widget", "string", "to", "right", "panel", "of", "the", "screen"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 258243}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L278-L330", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Checks that format string tokens match the supplied arguments.", "language": "python", "parameters": "(self, node, format_arg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "_count_supplied_tokens", "(", "arg_1", ".", "args", "[", "arg_2", "+", "1", ":", "]", ")", "if", "not", "arg_3", ":", "return", "arg_4", "=", "arg_1", ".", "args", "[", "arg_2", "]", ".", "value", "if", "not", "isinstance", "(", "arg_4", ",", "str", ")", ":", "arg_5", "=", "0", "else", ":", "try", ":", "if", "arg_0", ".", "_format_style", "==", "\"old\"", ":", "arg_6", ",", "arg_5", ",", "arg_7", ",", "arg_7", "=", "utils", ".", "parse_format_string", "(", "arg_4", ")", "if", "arg_6", ":", "return", "elif", "arg_0", ".", "_format_style", "==", "\"new\"", ":", "arg_8", ",", "arg_9", ",", "arg_10", "=", "utils", ".", "parse_format_method_string", "(", "arg_4", ")", "arg_11", "=", "len", "(", "set", "(", "k", "for", "k", ",", "l", "in", "arg_8", "if", "not", "isinstance", "(", "k", ",", "int", ")", ")", ")", "arg_5", "=", "(", "arg_11", "+", "arg_9", "+", "arg_10", ")", "except", "utils", ".", "UnsupportedFormatCharacter", "as", "ex", ":", "arg_12", "=", "arg_4", "[", "ex", ".", "index", "]", "arg_0", ".", "add_message", "(", "\"logging-unsupported-format\"", ",", "arg_1", "=", "arg_1", ",", "args", "=", "(", "arg_12", ",", "ord", "(", "arg_12", ")", ",", "ex", ".", "index", ")", ",", ")", "return", "except", "utils", ".", "IncompleteFormatString", ":", "arg_0", ".", "add_message", "(", "\"logging-format-truncated\"", ",", "arg_1", "=", "arg_1", ")", "return", "if", "arg_3", ">", "arg_5", ":", "arg_0", ".", "add_message", "(", "\"logging-too-many-args\"", ",", "arg_1", "=", "arg_1", ")", "elif", "arg_3", "<", "arg_5", ":", "arg_0", ".", "add_message", "(", "\"logging-too-few-args\"", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Checks that format string tokens match the supplied arguments.\n\n        Args:\n          node (astroid.node_classes.NodeNG): AST node to be checked.\n          format_arg (int): Index of the format string in the node arguments.\n        \"\"\"\n        arg_3 = _count_supplied_tokens(arg_1.args[arg_2 + 1 :])\n        if not arg_3:\n            # If no args were supplied the string is not interpolated and can contain\n            # formatting characters - it's used verbatim. Don't check any further.\n            return\n        arg_4 = arg_1.args[arg_2].value\n        if not isinstance(arg_4, str):\n            # If the log format is constant non-string (e.g. logging.debug(5)),\n            # ensure there are no arguments.\n            arg_5 = 0\n        else:\n            try:\n                if arg_0._format_style == \"old\":\n                    arg_6, arg_5, arg_7, arg_7 = utils.parse_format_string(\n                        arg_4\n                    )\n                    if arg_6:\n                        # Keyword checking on logging strings is complicated by\n                        # special keywords - out of scope.\n                        return\n                elif arg_0._format_style == \"new\":\n                    arg_8, arg_9, arg_10 = utils.parse_format_method_string(\n                        arg_4\n                    )\n\n                    arg_11 = len(\n                        set(k for k, l in arg_8 if not isinstance(k, int))\n                    )\n                    arg_5 = (\n                        arg_11 + arg_9 + arg_10\n                    )\n            except utils.UnsupportedFormatCharacter as ex:\n                arg_12 = arg_4[ex.index]\n                arg_0.add_message(\n                    \"logging-unsupported-format\",\n                    arg_1=arg_1,\n                    args=(arg_12, ord(arg_12), ex.index),\n                )\n                return\n            except utils.IncompleteFormatString:\n                arg_0.add_message(\"logging-format-truncated\", arg_1=arg_1)\n                return\n        if arg_3 > arg_5:\n            arg_0.add_message(\"logging-too-many-args\", arg_1=arg_1)\n        elif arg_3 < arg_5:\n            arg_0.add_message(\"logging-too-few-args\", arg_1=arg_1)", "path": "pylint/checkers/logging.py", "identifier": "LoggingChecker._check_format_string", "docstring": "Checks that format string tokens match the supplied arguments.\n\n        Args:\n          node (astroid.node_classes.NodeNG): AST node to be checked.\n          format_arg (int): Index of the format string in the node arguments.", "docstring_tokens": ["Checks", "that", "format", "string", "tokens", "match", "the", "supplied", "arguments", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258244}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L112-L132", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "print error type message\n        if file handle is `sys.stderr`, print color message", "language": "python", "parameters": "(self, message, fh=None, prefix=\"[error]:\",\n                      suffix=\"...\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "\"[error]:\"", ",", "arg_4", "=", "\"...\"", ")", ":", "arg_5", "=", "arg_3", "+", "arg_1", "+", "arg_4", "arg_2", "=", "arg_2", "or", "sys", ".", "stderr", "if", "arg_2", "is", "sys", ".", "stderr", ":", "termcolor", ".", "cprint", "(", "arg_5", ",", "color", "=", "\"red\"", ")", "else", ":", "arg_2", ".", "write", "(", "arg_5", ")", "pass"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=\"[error]:\",\n                      arg_4=\"...\"):\n        \"\"\"\n        print error type message\n        if file handle is `sys.stderr`, print color message\n\n        :param str message: message to print\n        :param file fh: file handle, default is `sys.stdout`\n        :param str prefix: message prefix,default is `[error]`\n        :param str suffix: message suffix ,default is '...'\n        :return: None\n        \"\"\"\n\n        arg_5 = arg_3 + arg_1 + arg_4\n        arg_2 = arg_2 or sys.stderr\n\n        if arg_2 is sys.stderr:\n            termcolor.cprint(arg_5, color=\"red\")\n        else:\n            arg_2.write(arg_5)\n        pass", "path": "cliez/component.py", "identifier": "Component.error_message", "docstring": "print error type message\n        if file handle is `sys.stderr`, print color message\n\n        :param str message: message to print\n        :param file fh: file handle, default is `sys.stdout`\n        :param str prefix: message prefix,default is `[error]`\n        :param str suffix: message suffix ,default is '...'\n        :return: None", "docstring_tokens": ["print", "error", "type", "message", "if", "file", "handle", "is", "sys", ".", "stderr", "print", "color", "message"], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 258245}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/plugins/watermark.py#L55-L80", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Adds a watermark to an image.", "language": "python", "parameters": "(im, mark, position, opacity=1)", "return_statement": "return Image.composite(layer, im, layer)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "if", "arg_3", "<", "1", ":", "arg_1", "=", "reduce_opacity", "(", "arg_1", ",", "arg_3", ")", "if", "arg_0", ".", "mode", "!=", "'RGBA'", ":", "arg_0", "=", "arg_0", ".", "convert", "(", "'RGBA'", ")", "arg_4", "=", "Image", ".", "new", "(", "'RGBA'", ",", "arg_0", ".", "size", ",", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", "if", "arg_2", "==", "'tile'", ":", "for", "arg_5", "in", "range", "(", "0", ",", "arg_0", ".", "size", "[", "1", "]", ",", "arg_1", ".", "size", "[", "1", "]", ")", ":", "for", "arg_6", "in", "range", "(", "0", ",", "arg_0", ".", "size", "[", "0", "]", ",", "arg_1", ".", "size", "[", "0", "]", ")", ":", "arg_4", ".", "paste", "(", "arg_1", ",", "(", "arg_6", ",", "arg_5", ")", ")", "elif", "arg_2", "==", "'scale'", ":", "arg_7", "=", "min", "(", "float", "(", "arg_0", ".", "size", "[", "0", "]", ")", "/", "arg_1", ".", "size", "[", "0", "]", ",", "float", "(", "arg_0", ".", "size", "[", "1", "]", ")", "/", "arg_1", ".", "size", "[", "1", "]", ")", "arg_8", "=", "int", "(", "arg_1", ".", "size", "[", "0", "]", "*", "arg_7", ")", "arg_9", "=", "int", "(", "arg_1", ".", "size", "[", "1", "]", "*", "arg_7", ")", "arg_1", "=", "arg_1", ".", "resize", "(", "(", "arg_8", ",", "arg_9", ")", ")", "arg_4", ".", "paste", "(", "arg_1", ",", "(", "int", "(", "(", "arg_0", ".", "size", "[", "0", "]", "-", "arg_8", ")", "/", "2", ")", ",", "int", "(", "(", "arg_0", ".", "size", "[", "1", "]", "-", "arg_9", ")", "/", "2", ")", ")", ")", "else", ":", "arg_4", ".", "paste", "(", "arg_1", ",", "arg_2", ")", "return", "Image", ".", "composite", "(", "arg_4", ",", "arg_0", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n    \"\"\"Adds a Func to an image.\"\"\"\n    if arg_3 < 1:\n        arg_1 = reduce_opacity(arg_1, arg_3)\n    if arg_0.mode != 'RGBA':\n        arg_0 = arg_0.convert('RGBA')\n    # create a transparent layer the size of the image and draw the\n    # Func in that layer.\n    arg_4 = Image.new('RGBA', arg_0.size, (0, 0, 0, 0))\n    if arg_2 == 'tile':\n        for arg_5 in range(0, arg_0.size[1], arg_1.size[1]):\n            for arg_6 in range(0, arg_0.size[0], arg_1.size[0]):\n                arg_4.paste(arg_1, (arg_6, arg_5))\n    elif arg_2 == 'scale':\n        # scale, but preserve the aspect ratio\n        arg_7 = min(\n            float(arg_0.size[0]) / arg_1.size[0], float(arg_0.size[1]) / arg_1.size[1])\n        arg_8 = int(arg_1.size[0] * arg_7)\n        arg_9 = int(arg_1.size[1] * arg_7)\n        arg_1 = arg_1.resize((arg_8, arg_9))\n        arg_4.paste(arg_1, (int((arg_0.size[0] - arg_8) / 2),\n                           int((arg_0.size[1] - arg_9) / 2)))\n    else:\n        arg_4.paste(arg_1, arg_2)\n    # composite the Func with the layer\n    return Image.composite(arg_4, arg_0, arg_4)", "path": "sigal/plugins/watermark.py", "identifier": "watermark", "docstring": "Adds a watermark to an image.", "docstring_tokens": ["Adds", "a", "watermark", "to", "an", "image", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 258246}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/primitives.py#L710-L738", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the value of the Boolean object from the input stream.", "language": "python", "parameters": "(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "try", ":", "arg_6", "=", "unpack", "(", "'!Q'", ",", "arg_1", ".", "read", "(", "arg_0", ".", "LENGTH", ")", ")", "[", "0", "]", "except", "Exception", ":", "arg_0", ".", "logger", ".", "error", "(", "\"Error reading boolean value from buffer\"", ")", "raise", "if", "arg_6", "==", "1", ":", "arg_0", ".", "value", "=", "True", "elif", "arg_6", "==", "0", ":", "arg_0", ".", "value", "=", "False", "else", ":", "raise", "ValueError", "(", "\"expected: 0 or 1, observed: {0}\"", ".", "format", "(", "arg_6", ")", ")", "arg_0", ".", "validate", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the value of the Boolean object from the input stream.\n\n        Args:\n            istream (Stream): A buffer containing the encoded bytes of the\n                value of a Boolean object. Usually a BytearrayStream object.\n                Required.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: if the read boolean value is not a 0 or 1.\n        \"\"\"\n        try:\n            arg_6 = unpack('!Q', arg_1.read(arg_0.LENGTH))[0]\n        except Exception:\n            arg_0.logger.error(\"Error reading boolean value from buffer\")\n            raise\n\n        if arg_6 == 1:\n            arg_0.value = True\n        elif arg_6 == 0:\n            arg_0.value = False\n        else:\n            raise ValueError(\"expected: 0 or 1, observed: {0}\".format(arg_6))\n\n        arg_0.validate()", "path": "kmip/core/primitives.py", "identifier": "Boolean.read_value", "docstring": "Read the value of the Boolean object from the input stream.\n\n        Args:\n            istream (Stream): A buffer containing the encoded bytes of the\n                value of a Boolean object. Usually a BytearrayStream object.\n                Required.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: if the read boolean value is not a 0 or 1.", "docstring_tokens": ["Read", "the", "value", "of", "the", "Boolean", "object", "from", "the", "input", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 258247}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3021-L3043", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Concert velocities from a cartesian to a spherical coordinate system", "language": "python", "parameters": "(self, x=\"x\", y=\"y\", z=\"z\", vx=\"vx\", vy=\"vy\", vz=\"vz\", vr=\"vr\", vlong=\"vlong\", vlat=\"vlat\", distance=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"x\"", ",", "arg_2", "=", "\"y\"", ",", "arg_3", "=", "\"z\"", ",", "arg_4", "=", "\"vx\"", ",", "arg_5", "=", "\"vy\"", ",", "arg_6", "=", "\"vz\"", ",", "arg_7", "=", "\"vr\"", ",", "arg_8", "=", "\"vlong\"", ",", "arg_9", "=", "\"vlat\"", ",", "arg_10", "=", "None", ")", ":", "if", "arg_10", "is", "None", ":", "arg_10", "=", "\"sqrt({x}**2+{y}**2+{z}**2)\"", ".", "format", "(", "**", "locals", "(", ")", ")", "arg_0", ".", "add_virtual_column", "(", "arg_7", ",", "\"({x}*{vx}+{y}*{vy}+{z}*{vz})/{distance}\"", ".", "format", "(", "**", "locals", "(", ")", ")", ")", "arg_0", ".", "add_virtual_column", "(", "arg_8", ",", "\"-({vx}*{y}-{x}*{vy})/sqrt({x}**2+{y}**2)\"", ".", "format", "(", "**", "locals", "(", ")", ")", ")", "arg_0", ".", "add_virtual_column", "(", "arg_9", ",", "\"-({z}*({x}*{vx}+{y}*{vy}) - ({x}**2+{y}**2)*{vz})/( {distance}*sqrt({x}**2+{y}**2) )\"", ".", "format", "(", "**", "locals", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1=\"x\", arg_2=\"y\", arg_3=\"z\", arg_4=\"vx\", arg_5=\"vy\", arg_6=\"vz\", arg_7=\"vr\", arg_8=\"vlong\", arg_9=\"vlat\", arg_10=None):\n        \"\"\"Concert velocities from a cartesian to a spherical coordinate system\n\n        TODO: errors\n\n        :param x: name of x column (input)\n        :param y:         y\n        :param z:         z\n        :param vx:       vx\n        :param vy:       vy\n        :param vz:       vz\n        :param vr: name of the column for the radial velocity in the r direction (output)\n        :param vlong: name of the column for the velocity component in the longitude direction  (output)\n        :param vlat: name of the column for the velocity component in the latitude direction, positive points to the north pole (output)\n        :param distance: Expression for distance, if not given defaults to sqrt(x**2+y**2+z**2), but if this column already exists, passing this expression may lead to a better performance\n        :return:\n        \"\"\"\n        # see http://www.astrosurf.com/jephem/library/li110spherCart_en.htm\n        if arg_10 is None:\n            arg_10 = \"sqrt({x}**2+{y}**2+{z}**2)\".format(**locals())\n        arg_0.add_virtual_column(arg_7, \"({x}*{vx}+{y}*{vy}+{z}*{vz})/{distance}\".format(**locals()))\n        arg_0.add_virtual_column(arg_8, \"-({vx}*{y}-{x}*{vy})/sqrt({x}**2+{y}**2)\".format(**locals()))\n        arg_0.add_virtual_column(arg_9, \"-({z}*({x}*{vx}+{y}*{vy}) - ({x}**2+{y}**2)*{vz})/( {distance}*sqrt({x}**2+{y}**2) )\".format(**locals()))", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.add_virtual_columns_cartesian_velocities_to_spherical", "docstring": "Concert velocities from a cartesian to a spherical coordinate system\n\n        TODO: errors\n\n        :param x: name of x column (input)\n        :param y:         y\n        :param z:         z\n        :param vx:       vx\n        :param vy:       vy\n        :param vz:       vz\n        :param vr: name of the column for the radial velocity in the r direction (output)\n        :param vlong: name of the column for the velocity component in the longitude direction  (output)\n        :param vlat: name of the column for the velocity component in the latitude direction, positive points to the north pole (output)\n        :param distance: Expression for distance, if not given defaults to sqrt(x**2+y**2+z**2), but if this column already exists, passing this expression may lead to a better performance\n        :return:", "docstring_tokens": ["Concert", "velocities", "from", "a", "cartesian", "to", "a", "spherical", "coordinate", "system"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 258248}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/bitbucket.py#L142-L144", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Perform a request to the fully qualified url and return json.", "language": "python", "parameters": "(self, url)", "return_statement": "return self.json_response(requests.get(url, **self.requests_kwargs))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "json_response", "(", "requests", ".", "get", "(", "arg_1", ",", "**", "arg_0", ".", "requests_kwargs", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Perform a request to the fully qualified url and return json. \"\"\"\n        return arg_0.json_response(requests.get(arg_1, **arg_0.requests_kwargs))", "path": "bugwarrior/services/bitbucket.py", "identifier": "BitbucketService.get_data", "docstring": "Perform a request to the fully qualified url and return json.", "docstring_tokens": ["Perform", "a", "request", "to", "the", "fully", "qualified", "url", "and", "return", "json", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 258249}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/Clipboard.py#L133-L144", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Clear contents of general pasteboard.", "language": "python", "parameters": "(cls)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'Request to clear contents of pasteboard: general'", "logging", ".", "debug", "(", "arg_1", ")", "arg_2", "=", "AppKit", ".", "NSPasteboard", ".", "generalPasteboard", "(", ")", "arg_2", ".", "Func", "(", ")", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"Clear contents of general pasteboard.\n\n        Future enhancement can include specifying which clipboard to clear\n        Returns: True on success; caller should expect to catch exceptions,\n                 probably from AppKit (ValueError)\n        \"\"\"\n        arg_1 = 'Request to clear contents of pasteboard: general'\n        logging.debug(arg_1)\n        arg_2 = AppKit.NSPasteboard.generalPasteboard()\n        arg_2.Func()\n        return True", "path": "atomac/Clipboard.py", "identifier": "Clipboard.clearContents", "docstring": "Clear contents of general pasteboard.\n\n        Future enhancement can include specifying which clipboard to clear\n        Returns: True on success; caller should expect to catch exceptions,\n                 probably from AppKit (ValueError)", "docstring_tokens": ["Clear", "contents", "of", "general", "pasteboard", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 258250}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/stats.py#L123-L202", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Generate requested statistics for a dataset and cache to a file.\n  If filename is None, then don't cache to a file", "language": "python", "parameters": "(filename, statsInfo, maxSamples = None, filters=[], cache=True)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "[", "]", ",", "arg_4", "=", "True", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "raise", "RuntimeError", "(", "\"statsInfo must be a dict -- \"", "\"found '%s' instead\"", "%", "type", "(", "arg_1", ")", ")", "arg_0", "=", "resource_filename", "(", "\"nupic.datafiles\"", ",", "arg_0", ")", "if", "arg_4", ":", "arg_5", "=", "getStatsFilename", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_5", ")", ":", "try", ":", "arg_6", "=", "pickle", ".", "load", "(", "open", "(", "arg_5", ",", "\"rb\"", ")", ")", "except", ":", "print", "\"Warning: unable to load stats for %s -- \"", "\"will regenerate\"", "%", "arg_0", "arg_6", "=", "dict", "(", ")", "arg_7", "=", "set", "(", "[", "s", "for", "s", "in", "arg_1", "]", ")", "arg_8", "=", "set", "(", "arg_6", ".", "keys", "(", ")", ")", "arg_9", "=", "arg_7", ".", "difference", "(", "arg_8", ")", "if", "len", "(", "arg_9", ")", "==", "0", ":", "return", "arg_6", "else", ":", "print", "\"Func: re-generating stats file %s because \"", "\"keys %s are not available\"", "%", "(", "arg_0", ",", "str", "(", "arg_9", ")", ")", "os", ".", "remove", "(", "arg_0", ")", "print", "\"Generating statistics for file '%s' with filters '%s'\"", "%", "(", "arg_0", ",", "arg_3", ")", "arg_10", "=", "RecordSensor", "(", ")", "arg_10", ".", "dataSource", "=", "FileRecordStream", "(", "arg_0", ")", "arg_10", ".", "preEncodingFilters", "=", "arg_3", "arg_13", "=", "[", "]", "for", "arg_14", "in", "arg_1", ":", "if", "arg_1", "[", "arg_14", "]", "==", "\"number\"", ":", "arg_1", "[", "arg_14", "]", "=", "NumberStatsCollector", "(", ")", "elif", "arg_1", "[", "arg_14", "]", "==", "\"category\"", ":", "arg_1", "[", "arg_14", "]", "=", "CategoryStatsCollector", "(", ")", "else", ":", "raise", "RuntimeError", "(", "\"Unknown stats type '%s' for field '%s'\"", "%", "(", "arg_1", "[", "arg_14", "]", ",", "arg_14", ")", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "500000", "for", "arg_15", "in", "xrange", "(", "arg_2", ")", ":", "try", ":", "arg_16", "=", "arg_10", ".", "getNextRecord", "(", ")", "except", "StopIteration", ":", "break", "for", "(", "arg_17", ",", "arg_18", ")", "in", "arg_1", ".", "items", "(", ")", ":", "arg_18", ".", "add", "(", "arg_16", "[", "arg_17", "]", ")", "del", "arg_10", "arg_6", "=", "dict", "(", ")", "for", "(", "arg_14", ",", "arg_18", ")", "in", "arg_1", ".", "items", "(", ")", ":", "arg_13", "=", "arg_18", ".", "getStats", "(", ")", "if", "arg_14", "not", "in", "arg_6", ":", "arg_6", "[", "arg_14", "]", "=", "arg_13", "else", ":", "arg_6", "[", "arg_14", "]", ".", "update", "(", "arg_13", ")", "if", "arg_4", ":", "arg_19", "=", "open", "(", "arg_5", ",", "\"wb\"", ")", "pickle", ".", "dump", "(", "arg_6", ",", "arg_19", ")", "arg_19", ".", "close", "(", ")", "arg_6", "[", "\"_filename\"", "]", "=", "arg_5", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2 = None, arg_3=[], arg_4=True):\n  \"\"\"Generate requested statistics for a dataset and cache to a file.\n  If filename is None, then don't cache to a file\"\"\"\n\n  # Sanity checking\n  if not isinstance(arg_1, dict):\n    raise RuntimeError(\"statsInfo must be a dict -- \"\n                       \"found '%s' instead\" % type(arg_1))\n\n  arg_0 = resource_filename(\"nupic.datafiles\", arg_0)\n\n  if arg_4:\n    arg_5 = getStatsFilename(arg_0, arg_1, arg_3)\n    # Use cached stats if found AND if it has the right data\n    if os.path.exists(arg_5):\n      try:\n        arg_6 = pickle.load(open(arg_5, \"rb\"))\n      except:\n        # Ok to ignore errors -- we will just re-generate the file\n        print \"Warning: unable to load stats for %s -- \" \\\n              \"will regenerate\" % arg_0\n        arg_6 = dict()\n      arg_7 = set([s for s in arg_1])\n      arg_8 = set(arg_6.keys())\n      arg_9 = arg_7.difference(arg_8)\n      if len(arg_9 ) == 0:\n        return arg_6\n      else:\n        print \"Func: re-generating stats file %s because \" \\\n              \"keys %s are not available\" %  \\\n              (arg_0, str(arg_9))\n        os.remove(arg_0)\n\n  print \"Generating statistics for file '%s' with filters '%s'\" % (arg_0, arg_3)\n  arg_10 = RecordSensor()\n  arg_10.dataSource = FileRecordStream(arg_0)\n  arg_10.preEncodingFilters = arg_3\n\n  # Convert collector description to collector object\n  arg_13 = []\n  for arg_14 in arg_1:\n    # field = key from statsInfo\n    if arg_1[arg_14] == \"number\":\n      # This wants a field name e.g. consumption and the field type as the value\n      arg_1[arg_14] = NumberStatsCollector()\n    elif arg_1[arg_14] == \"category\":\n      arg_1[arg_14] = CategoryStatsCollector()\n    else:\n      raise RuntimeError(\"Unknown stats type '%s' for field '%s'\" % (arg_1[arg_14], arg_14))\n\n  # Now collect the stats\n  if arg_2 is None:\n    arg_2 = 500000\n  for arg_15 in xrange(arg_2):\n    try:\n      arg_16 = arg_10.getNextRecord()\n    except StopIteration:\n      break\n    for (arg_17, arg_18) in arg_1.items():\n      arg_18.add(arg_16[arg_17])\n\n  del arg_10\n\n  # Assemble the results and return\n  arg_6 = dict()\n  for (arg_14, arg_18) in arg_1.items():\n    arg_13 = arg_18.getStats()\n    if arg_14 not in arg_6:\n      arg_6[arg_14] = arg_13\n    else:\n      arg_6[arg_14].update(arg_13)\n\n  if arg_4:\n    arg_19 = open(arg_5, \"wb\")\n    pickle.dump(arg_6, arg_19)\n    arg_19.close()\n    # caller may need to know name of cached file\n    arg_6[\"_filename\"] = arg_5\n\n  return arg_6", "path": "src/nupic/data/stats.py", "identifier": "generateStats", "docstring": "Generate requested statistics for a dataset and cache to a file.\n  If filename is None, then don't cache to a file", "docstring_tokens": ["Generate", "requested", "statistics", "for", "a", "dataset", "and", "cache", "to", "a", "file", ".", "If", "filename", "is", "None", "then", "don", "t", "cache", "to", "a", "file"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258251}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dsub.py#L1155-L1193", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "r\"\"\"Craft a simple command name from the command.", "language": "python", "parameters": "(command)", "return_statement": "return 'command'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "splitlines", "(", ")", "for", "arg_2", "in", "arg_1", ":", "arg_2", "=", "arg_2", ".", "strip", "(", ")", "if", "arg_2", "and", "not", "arg_2", ".", "startswith", "(", "'#'", ")", "and", "arg_2", "!=", "'\\\\'", ":", "return", "os", ".", "path", ".", "basename", "(", "re", ".", "split", "(", "r'\\s'", ",", "arg_2", ")", "[", "0", "]", ")", "return", "'command'"], "function": "def Func(arg_0):\n  r\"\"\"Craft a simple command name from the command.\n\n  The best command strings for this are going to be those where a simple\n  command was given; we will use the command to derive the name.\n\n  We won't always be able to figure something out and the caller should just\n  specify a \"--name\" on the command-line.\n\n  For example, commands like \"export VAR=val\\necho ${VAR}\", this function would\n  return \"export\".\n\n  If the command starts space or a comment, then we'll skip to the first code\n  we can find.\n\n  If we find nothing, just return \"command\".\n\n  >>> Func('samtools index \"${BAM}\"')\n  'samtools'\n  >>> Func('/usr/bin/sort \"${INFILE}\" > \"${OUTFILE}\"')\n  'sort'\n  >>> Func('# This should be ignored')\n  'command'\n  >>> Func('\\\\\\n\\\\\\n# Bad continuations, but ignore.\\necho hello.')\n  'echo'\n\n  Arguments:\n    command: the user-provided command\n  Returns:\n    a proposed name for the task.\n  \"\"\"\n\n  arg_1 = arg_0.splitlines()\n  for arg_2 in arg_1:\n    arg_2 = arg_2.strip()\n    if arg_2 and not arg_2.startswith('#') and arg_2 != '\\\\':\n      return os.path.basename(re.split(r'\\s', arg_2)[0])\n\n  return 'command'", "path": "dsub/commands/dsub.py", "identifier": "_name_for_command", "docstring": "r\"\"\"Craft a simple command name from the command.\n\n  The best command strings for this are going to be those where a simple\n  command was given; we will use the command to derive the name.\n\n  We won't always be able to figure something out and the caller should just\n  specify a \"--name\" on the command-line.\n\n  For example, commands like \"export VAR=val\\necho ${VAR}\", this function would\n  return \"export\".\n\n  If the command starts space or a comment, then we'll skip to the first code\n  we can find.\n\n  If we find nothing, just return \"command\".\n\n  >>> _name_for_command('samtools index \"${BAM}\"')\n  'samtools'\n  >>> _name_for_command('/usr/bin/sort \"${INFILE}\" > \"${OUTFILE}\"')\n  'sort'\n  >>> _name_for_command('# This should be ignored')\n  'command'\n  >>> _name_for_command('\\\\\\n\\\\\\n# Bad continuations, but ignore.\\necho hello.')\n  'echo'\n\n  Arguments:\n    command: the user-provided command\n  Returns:\n    a proposed name for the task.", "docstring_tokens": ["r", "Craft", "a", "simple", "command", "name", "from", "the", "command", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 258252}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/util/array.py#L117-L200", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Create a matrix representation of the problem.", "language": "python", "parameters": "(model, array_type='dense', include_vars=False,\n                        zero_tol=1e-6)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'dense'", ",", "arg_2", "=", "False", ",", "arg_3", "=", "1e-6", ")", ":", "if", "arg_1", "not", "in", "(", "'DataFrame'", ",", "'dense'", ")", "and", "not", "dok_matrix", ":", "raise", "ValueError", "(", "'Sparse matrices require scipy'", ")", "arg_4", "=", "{", "'dense'", ":", "np", ".", "array", ",", "'dok'", ":", "dok_matrix", ",", "'lil'", ":", "lil_matrix", ",", "'DataFrame'", ":", "pd", ".", "DataFrame", ",", "}", "[", "arg_1", "]", "arg_5", "=", "namedtuple", "(", "\"Problem\"", ",", "[", "\"equalities\"", ",", "\"b\"", ",", "\"inequalities\"", ",", "\"bounds\"", ",", "\"variable_fixed\"", ",", "\"variable_bounds\"", "]", ")", "arg_6", "=", "[", "]", "arg_7", "=", "[", "]", "arg_8", "=", "[", "]", "arg_9", "=", "[", "]", "for", "arg_10", "in", "arg_0", ".", "constraints", ":", "arg_11", "=", "-", "np", ".", "inf", "if", "arg_10", ".", "lb", "is", "None", "else", "arg_10", ".", "lb", "arg_12", "=", "np", ".", "inf", "if", "arg_10", ".", "ub", "is", "None", "else", "arg_10", ".", "ub", "arg_13", "=", "(", "arg_12", "-", "arg_11", ")", "<", "arg_3", "arg_14", "=", "arg_10", ".", "get_linear_coefficients", "(", "arg_0", ".", "variables", ")", "arg_14", "=", "[", "arg_14", "[", "v", "]", "for", "v", "in", "arg_0", ".", "variables", "]", "if", "arg_13", ":", "arg_9", ".", "append", "(", "arg_11", "if", "abs", "(", "arg_11", ")", ">", "arg_3", "else", "0.0", ")", "arg_6", ".", "append", "(", "arg_14", ")", "else", ":", "arg_7", ".", "append", "(", "arg_14", ")", "arg_8", ".", "append", "(", "[", "arg_11", ",", "arg_12", "]", ")", "arg_15", "=", "np", ".", "array", "(", "[", "[", "v", ".", "lb", ",", "v", ".", "ub", "]", "for", "v", "in", "arg_0", ".", "variables", "]", ")", "arg_16", "=", "arg_15", "[", ":", ",", "1", "]", "-", "arg_15", "[", ":", ",", "0", "]", "<", "arg_3", "arg_17", "=", "arg_5", "(", "equalities", "=", "arg_4", "(", "arg_6", ")", ",", "arg_9", "=", "np", ".", "array", "(", "arg_9", ")", ",", "inequalities", "=", "arg_4", "(", "arg_7", ")", ",", "bounds", "=", "arg_4", "(", "arg_8", ")", ",", "variable_fixed", "=", "np", ".", "array", "(", "arg_16", ")", ",", "variable_bounds", "=", "arg_4", "(", "arg_15", ")", ")", "return", "arg_17"], "function": "def Func(arg_0, arg_1='dense', arg_2=False,\n                        arg_3=1e-6):\n    \"\"\"Create a matrix representation of the problem.\n\n    This is used for alternative solution approaches that do not use optlang.\n    The function will construct the equality matrix, inequality matrix and\n    bounds for the complete problem.\n\n    Notes\n    -----\n    To accomodate non-zero equalities the problem will add the variable\n    \"const_one\" which is a variable that equals one.\n\n    Arguments\n    ---------\n    model : cobra.Model\n        The model from which to obtain the LP problem.\n    array_type : string\n        The type of array to construct. if 'dense', return a standard\n        numpy.array, 'dok', or 'lil' will construct a sparse array using\n        scipy of the corresponding type and 'DataFrame' will give a\n        pandas `DataFrame` with metabolite indices and reaction columns.\n    zero_tol : float\n        The zero tolerance used to judge whether two bounds are the same.\n\n    Returns\n    -------\n    collections.namedtuple\n        A named tuple consisting of 6 matrices and 2 vectors:\n        - \"equalities\" is a matrix S such that S*vars = b. It includes a row\n          for each constraint and one column for each variable.\n        - \"b\" the right side of the equality equation such that S*vars = b.\n        - \"inequalities\" is a matrix M such that lb <= M*vars <= ub.\n          It contains a row for each inequality and as many columns as\n          variables.\n        - \"bounds\" is a compound matrix [lb ub] containing the lower and\n          upper bounds for the inequality constraints in M.\n        - \"variable_fixed\" is a boolean vector indicating whether the variable\n          at that index is fixed (lower bound == upper_bound) and\n          is thus bounded by an equality constraint.\n        - \"variable_bounds\" is a compound matrix [lb ub] containing the\n          lower and upper bounds for all variables.\n    \"\"\"\n    if arg_1 not in ('DataFrame', 'dense') and not dok_matrix:\n        raise ValueError('Sparse matrices require scipy')\n\n    arg_4 = {\n        'dense': np.array, 'dok': dok_matrix, 'lil': lil_matrix,\n        'DataFrame': pd.DataFrame,\n    }[arg_1]\n\n    arg_5 = namedtuple(\"Problem\",\n                         [\"equalities\", \"b\", \"inequalities\", \"bounds\",\n                          \"variable_fixed\", \"variable_bounds\"])\n    arg_6 = []\n    arg_7 = []\n    arg_8 = []\n    arg_9 = []\n\n    for arg_10 in arg_0.constraints:\n        arg_11 = -np.inf if arg_10.lb is None else arg_10.lb\n        arg_12 = np.inf if arg_10.ub is None else arg_10.ub\n        arg_13 = (arg_12 - arg_11) < arg_3\n        arg_14 = arg_10.get_linear_coefficients(arg_0.variables)\n        arg_14 = [arg_14[v] for v in arg_0.variables]\n        if arg_13:\n            arg_9.append(arg_11 if abs(arg_11) > arg_3 else 0.0)\n            arg_6.append(arg_14)\n        else:\n            arg_7.append(arg_14)\n            arg_8.append([arg_11, arg_12])\n\n    arg_15 = np.array([[v.lb, v.ub] for v in arg_0.variables])\n    arg_16 = arg_15[:, 1] - arg_15[:, 0] < arg_3\n\n    arg_17 = arg_5(\n        equalities=arg_4(arg_6),\n        arg_9=np.array(arg_9),\n        inequalities=arg_4(arg_7),\n        bounds=arg_4(arg_8),\n        variable_fixed=np.array(arg_16),\n        variable_bounds=arg_4(arg_15))\n\n    return arg_17", "path": "cobra/util/array.py", "identifier": "constraint_matrices", "docstring": "Create a matrix representation of the problem.\n\n    This is used for alternative solution approaches that do not use optlang.\n    The function will construct the equality matrix, inequality matrix and\n    bounds for the complete problem.\n\n    Notes\n    -----\n    To accomodate non-zero equalities the problem will add the variable\n    \"const_one\" which is a variable that equals one.\n\n    Arguments\n    ---------\n    model : cobra.Model\n        The model from which to obtain the LP problem.\n    array_type : string\n        The type of array to construct. if 'dense', return a standard\n        numpy.array, 'dok', or 'lil' will construct a sparse array using\n        scipy of the corresponding type and 'DataFrame' will give a\n        pandas `DataFrame` with metabolite indices and reaction columns.\n    zero_tol : float\n        The zero tolerance used to judge whether two bounds are the same.\n\n    Returns\n    -------\n    collections.namedtuple\n        A named tuple consisting of 6 matrices and 2 vectors:\n        - \"equalities\" is a matrix S such that S*vars = b. It includes a row\n          for each constraint and one column for each variable.\n        - \"b\" the right side of the equality equation such that S*vars = b.\n        - \"inequalities\" is a matrix M such that lb <= M*vars <= ub.\n          It contains a row for each inequality and as many columns as\n          variables.\n        - \"bounds\" is a compound matrix [lb ub] containing the lower and\n          upper bounds for the inequality constraints in M.\n        - \"variable_fixed\" is a boolean vector indicating whether the variable\n          at that index is fixed (lower bound == upper_bound) and\n          is thus bounded by an equality constraint.\n        - \"variable_bounds\" is a compound matrix [lb ub] containing the\n          lower and upper bounds for all variables.", "docstring_tokens": ["Create", "a", "matrix", "representation", "of", "the", "problem", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 258253}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/convert/KnittingPatternToSVG.py#L39-L72", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Go through the layout and build the SVG.", "language": "python", "parameters": "(self)", "return_statement": "return builder.get_svg_dict()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_zoom", "arg_2", "=", "arg_0", ".", "_layout", "arg_3", "=", "arg_0", ".", "_builder", "arg_4", "=", "list", "(", "map", "(", "lambda", "f", ":", "f", "*", "arg_1", ",", "arg_2", ".", "bounding_box", ")", ")", "arg_3", ".", "bounding_box", "=", "arg_4", "arg_6", "=", "arg_4", "[", "2", "]", "+", "arg_4", "[", "0", "]", "*", "2", "arg_7", "=", "arg_4", "[", "3", "]", "+", "arg_4", "[", "1", "]", "*", "2", "arg_8", "=", "list", "(", "arg_2", ".", "walk_instructions", "(", "lambda", "i", ":", "(", "arg_6", "-", "(", "i", ".", "x", "+", "i", ".", "width", ")", "*", "arg_1", ",", "arg_7", "-", "(", "i", ".", "y", "+", "i", ".", "height", ")", "*", "arg_1", ",", "i", ".", "instruction", ")", ")", ")", "arg_8", ".", "sort", "(", "key", "=", "lambda", "x_y_i", ":", "x_y_i", "[", "2", "]", ".", "render_z", ")", "for", "arg_9", ",", "arg_10", ",", "arg_11", "in", "arg_8", ":", "arg_12", "=", "arg_11", ".", "render_z", "arg_13", "=", "(", "\"\"", "if", "not", "arg_12", "else", "\"-{}\"", ".", "format", "(", "arg_12", ")", ")", "arg_14", "=", "\"row-{}{}\"", ".", "format", "(", "arg_11", ".", "row", ".", "id", ",", "arg_13", ")", "arg_15", "=", "arg_0", ".", "_register_instruction_in_defs", "(", "arg_11", ")", "arg_16", "=", "arg_0", ".", "_symbol_id_to_scale", "[", "arg_15", "]", "arg_17", "=", "{", "\"@class\"", ":", "\"instruction\"", ",", "\"@id\"", ":", "\"instruction-{}\"", ".", "format", "(", "arg_11", ".", "id", ")", ",", "\"@transform\"", ":", "\"translate({},{}),scale({})\"", ".", "format", "(", "arg_9", ",", "arg_10", ",", "arg_16", ")", "}", "arg_3", ".", "place_svg_use", "(", "arg_15", ",", "arg_14", ",", "arg_17", ")", "arg_3", ".", "insert_defs", "(", "arg_0", ".", "_instruction_type_color_to_symbol", ".", "values", "(", ")", ")", "return", "arg_3", ".", "get_svg_dict", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Go through the layout and build the SVG.\n\n        :return: an xml dict that can be exported using a\n          :class:`~knittingpattern.Dumper.XMLDumper`\n        :rtype: dict\n        \"\"\"\n        arg_1 = arg_0._zoom\n        arg_2 = arg_0._layout\n        arg_3 = arg_0._builder\n        arg_4 = list(map(lambda f: f * arg_1, arg_2.bounding_box))\n        arg_3.bounding_box = arg_4\n        arg_6 = arg_4[2] + arg_4[0] * 2\n        arg_7 = arg_4[3] + arg_4[1] * 2\n        arg_8 = list(arg_2.walk_instructions(\n            lambda i: (arg_6 - (i.x + i.width) * arg_1,\n                       arg_7 - (i.y + i.height) * arg_1,\n                       i.instruction)))\n        arg_8.sort(key=lambda x_y_i: x_y_i[2].render_z)\n        for arg_9, arg_10, arg_11 in arg_8:\n            arg_12 = arg_11.render_z\n            arg_13 = (\"\" if not arg_12 else \"-{}\".format(arg_12))\n            arg_14 = \"row-{}{}\".format(arg_11.row.id, arg_13)\n            arg_15 = arg_0._register_instruction_in_defs(arg_11)\n            arg_16 = arg_0._symbol_id_to_scale[arg_15]\n            arg_17 = {\n                \"@class\": \"instruction\",\n                \"@id\": \"instruction-{}\".format(arg_11.id),\n                \"@transform\": \"translate({},{}),scale({})\".format(\n                    arg_9, arg_10, arg_16)\n            }\n            arg_3.place_svg_use(arg_15, arg_14, arg_17)\n        arg_3.insert_defs(arg_0._instruction_type_color_to_symbol.values())\n        return arg_3.get_svg_dict()", "path": "knittingpattern/convert/KnittingPatternToSVG.py", "identifier": "KnittingPatternToSVG.build_SVG_dict", "docstring": "Go through the layout and build the SVG.\n\n        :return: an xml dict that can be exported using a\n          :class:`~knittingpattern.Dumper.XMLDumper`\n        :rtype: dict", "docstring_tokens": ["Go", "through", "the", "layout", "and", "build", "the", "SVG", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 258254}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L401-L445", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "allocate - allocate virtual memory", "language": "python", "parameters": "(self, cpu, length, isX, addr)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_4", "not", "in", "arg_1", ".", "memory", ":", "logger", ".", "info", "(", "\"ALLOCATE: addr points to invalid address. Returning EFAULT\"", ")", "return", "Decree", ".", "CGC_EFAULT", "arg_5", "=", "[", "'rw '", ",", "'rwx'", "]", "[", "bool", "(", "arg_3", ")", "]", "try", ":", "arg_6", "=", "arg_1", ".", "memory", ".", "mmap", "(", "None", ",", "arg_2", ",", "arg_5", ")", "except", "Exception", "as", "e", ":", "logger", ".", "info", "(", "\"ALLOCATE exception %s. Returning ENOMEM %r\"", ",", "str", "(", "e", ")", ",", "arg_2", ")", "return", "Decree", ".", "CGC_ENOMEM", "arg_1", ".", "write_int", "(", "arg_4", ",", "arg_6", ",", "32", ")", "logger", ".", "info", "(", "\"ALLOCATE(%d, %s, 0x%08x) -> 0x%08x\"", "%", "(", "arg_2", ",", "arg_5", ",", "arg_4", ",", "arg_6", ")", ")", "arg_0", ".", "syscall_trace", ".", "append", "(", "(", "\"_allocate\"", ",", "-", "1", ",", "arg_2", ")", ")", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\" allocate - allocate virtual memory\n\n           The  allocate  system call creates a new allocation in the virtual address\n           space of the calling process.  The length argument specifies the length of\n           the allocation in bytes which will be rounded up to the hardware page size.\n\n           The kernel chooses the address at which to create the allocation; the\n           address of the new allocation is returned in *addr as the result of the call.\n\n           All newly allocated memory is readable and writeable. In addition, the\n           is_X argument is a boolean that allows newly allocated memory to be marked\n           as executable (non-zero) or non-executable (zero).\n\n           The allocate function is invoked through system call number 5.\n\n           :param cpu: current CPU\n           :param length: the length of the allocation in bytes\n           :param isX: boolean that allows newly allocated memory to be marked as executable\n           :param addr: the address of the new allocation is returned in *addr\n\n           :return: On success, allocate returns zero and a pointer to the allocated area\n                               is returned in *addr.  Otherwise, an error code is returned\n                               and *addr is undefined.\n                   EINVAL   length is zero.\n                   EINVAL   length is too large.\n                   EFAULT   addr points to an invalid address.\n                   ENOMEM   No memory is available or the process' maximum number of allocations\n                            would have been exceeded.\n        \"\"\"\n        # TODO: check 4 bytes from addr\n        if arg_4 not in arg_1.memory:\n            logger.info(\"ALLOCATE: addr points to invalid address. Returning EFAULT\")\n            return Decree.CGC_EFAULT\n\n        arg_5 = ['rw ', 'rwx'][bool(arg_3)]\n        try:\n            arg_6 = arg_1.memory.mmap(None, arg_2, arg_5)\n        except Exception as e:\n            logger.info(\"ALLOCATE exception %s. Returning ENOMEM %r\", str(e), arg_2)\n            return Decree.CGC_ENOMEM\n        arg_1.write_int(arg_4, arg_6, 32)\n        logger.info(\"ALLOCATE(%d, %s, 0x%08x) -> 0x%08x\" % (arg_2, arg_5, arg_4, arg_6))\n        arg_0.syscall_trace.append((\"_allocate\", -1, arg_2))\n        return 0", "path": "manticore/platforms/decree.py", "identifier": "Decree.sys_allocate", "docstring": "allocate - allocate virtual memory\n\n           The  allocate  system call creates a new allocation in the virtual address\n           space of the calling process.  The length argument specifies the length of\n           the allocation in bytes which will be rounded up to the hardware page size.\n\n           The kernel chooses the address at which to create the allocation; the\n           address of the new allocation is returned in *addr as the result of the call.\n\n           All newly allocated memory is readable and writeable. In addition, the\n           is_X argument is a boolean that allows newly allocated memory to be marked\n           as executable (non-zero) or non-executable (zero).\n\n           The allocate function is invoked through system call number 5.\n\n           :param cpu: current CPU\n           :param length: the length of the allocation in bytes\n           :param isX: boolean that allows newly allocated memory to be marked as executable\n           :param addr: the address of the new allocation is returned in *addr\n\n           :return: On success, allocate returns zero and a pointer to the allocated area\n                               is returned in *addr.  Otherwise, an error code is returned\n                               and *addr is undefined.\n                   EINVAL   length is zero.\n                   EINVAL   length is too large.\n                   EFAULT   addr points to an invalid address.\n                   ENOMEM   No memory is available or the process' maximum number of allocations\n                            would have been exceeded.", "docstring_tokens": ["allocate", "-", "allocate", "virtual", "memory"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258255}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/basecommand.py#L259-L301", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Marshal cmd line args into a requirement set.", "language": "python", "parameters": "(requirement_set, args, options, finder,\n                                 session, name, wheel_cache)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "for", "arg_7", "in", "arg_1", ":", "arg_0", ".", "add_requirement", "(", "InstallRequirement", ".", "from_line", "(", "arg_7", ",", "None", ",", "isolated", "=", "arg_2", ".", "isolated_mode", ",", "arg_6", "=", "arg_6", ")", ")", "for", "arg_7", "in", "arg_2", ".", "editables", ":", "arg_0", ".", "add_requirement", "(", "InstallRequirement", ".", "from_editable", "(", "arg_7", ",", "default_vcs", "=", "arg_2", ".", "default_vcs", ",", "isolated", "=", "arg_2", ".", "isolated_mode", ",", "arg_6", "=", "arg_6", ")", ")", "arg_8", "=", "False", "for", "arg_9", "in", "arg_2", ".", "requirements", ":", "for", "arg_7", "in", "parse_requirements", "(", "arg_9", ",", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ")", ":", "arg_8", "=", "True", "arg_0", ".", "add_requirement", "(", "arg_7", ")", "if", "not", "(", "arg_1", "or", "arg_2", ".", "editables", "or", "arg_8", ")", ":", "arg_10", "=", "{", "'name'", ":", "arg_5", "}", "if", "arg_2", ".", "find_links", ":", "arg_11", "=", "(", "'You must give at least one requirement to '", "'%(name)s (maybe you meant \"pip %(name)s '", "'%(links)s\"?)'", "%", "dict", "(", "arg_10", ",", "links", "=", "' '", ".", "join", "(", "arg_2", ".", "find_links", ")", ")", ")", "else", ":", "arg_11", "=", "(", "'You must give at least one requirement '", "'to %(name)s (see \"pip help %(name)s\")'", "%", "arg_10", ")", "logger", ".", "warning", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                 arg_4, arg_5, arg_6):\n        \"\"\"\n        Marshal cmd line args into a requirement set.\n        \"\"\"\n        for arg_7 in arg_1:\n            arg_0.add_requirement(\n                InstallRequirement.from_line(\n                    arg_7, None, isolated=arg_2.isolated_mode,\n                    arg_6=arg_6\n                )\n            )\n\n        for arg_7 in arg_2.editables:\n            arg_0.add_requirement(\n                InstallRequirement.from_editable(\n                    arg_7,\n                    default_vcs=arg_2.default_vcs,\n                    isolated=arg_2.isolated_mode,\n                    arg_6=arg_6\n                )\n            )\n\n        arg_8 = False\n        for arg_9 in arg_2.requirements:\n            for arg_7 in parse_requirements(\n                    arg_9,\n                    arg_3=arg_3, arg_2=arg_2, arg_4=arg_4,\n                    arg_6=arg_6):\n                arg_8 = True\n                arg_0.add_requirement(arg_7)\n\n        if not (arg_1 or arg_2.editables or arg_8):\n            arg_10 = {'name': arg_5}\n            if arg_2.find_links:\n                arg_11 = ('You must give at least one requirement to '\n                       '%(name)s (maybe you meant \"pip %(name)s '\n                       '%(links)s\"?)' %\n                       dict(arg_10, links=' '.join(arg_2.find_links)))\n            else:\n                arg_11 = ('You must give at least one requirement '\n                       'to %(name)s (see \"pip help %(name)s\")' % arg_10)\n            logger.warning(arg_11)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/basecommand.py", "identifier": "RequirementCommand.populate_requirement_set", "docstring": "Marshal cmd line args into a requirement set.", "docstring_tokens": ["Marshal", "cmd", "line", "args", "into", "a", "requirement", "set", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 258256}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/image.py#L121-L142", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Turns a intensity array to a monochrome 'image' by replacing each intensity by a scaled 'color'", "language": "python", "parameters": "(I, color, vmin=None, vmax=None)", "return_statement": "return np.clip(normalized[..., np.newaxis], 0, 1) * np.array(color)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "np", ".", "nanmin", "(", "arg_0", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "np", ".", "nanmax", "(", "arg_0", ")", "arg_4", "=", "(", "arg_0", "-", "arg_2", ")", "/", "(", "arg_3", "-", "arg_2", ")", "return", "np", ".", "clip", "(", "arg_4", "[", "...", ",", "np", ".", "newaxis", "]", ",", "0", ",", "1", ")", "*", "np", ".", "array", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"Turns a intensity array to a Func 'image' by replacing each intensity by a scaled 'color'\n\n    Values in I between vmin  and vmax get scaled between 0 and 1, and values outside this range are clipped to this.\n\n    Example\n    >>> I = np.arange(16.).reshape(4,4)\n    >>> color = (0, 0, 1) # red\n    >>> rgb = vx.image.Func(I, color) # shape is (4,4,3)\n\n    :param I: ndarray of any shape (2d for image)\n    :param color: sequence of a (r, g and b) value\n    :param vmin: normalization minimum for I, or np.nanmin(I) when None\n    :param vmax: normalization maximum for I, or np.nanmax(I) when None\n    :return:\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = np.nanmin(arg_0)\n    if arg_3 is None:\n        arg_3 = np.nanmax(arg_0)\n    arg_4 = (arg_0 - arg_2) / (arg_3 - arg_2)\n    return np.clip(arg_4[..., np.newaxis], 0, 1) * np.array(arg_1)", "path": "packages/vaex-core/vaex/image.py", "identifier": "monochrome", "docstring": "Turns a intensity array to a monochrome 'image' by replacing each intensity by a scaled 'color'\n\n    Values in I between vmin  and vmax get scaled between 0 and 1, and values outside this range are clipped to this.\n\n    Example\n    >>> I = np.arange(16.).reshape(4,4)\n    >>> color = (0, 0, 1) # red\n    >>> rgb = vx.image.monochrome(I, color) # shape is (4,4,3)\n\n    :param I: ndarray of any shape (2d for image)\n    :param color: sequence of a (r, g and b) value\n    :param vmin: normalization minimum for I, or np.nanmin(I) when None\n    :param vmax: normalization maximum for I, or np.nanmax(I) when None\n    :return:", "docstring_tokens": ["Turns", "a", "intensity", "array", "to", "a", "monochrome", "image", "by", "replacing", "each", "intensity", "by", "a", "scaled", "color"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 258257}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L262-L282", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Patch OptionParser.expand_default with custom behaviour", "language": "python", "parameters": "(self, option)", "return_statement": "return option.help.replace(self.default_tag, str(value))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "parser", "is", "None", "or", "not", "arg_0", ".", "default_tag", ":", "return", "arg_1", ".", "help", "arg_2", "=", "arg_1", ".", "_long_opts", "[", "0", "]", "[", "2", ":", "]", "try", ":", "arg_3", "=", "arg_0", ".", "parser", ".", "options_manager", ".", "_all_options", "[", "arg_2", "]", "except", "KeyError", ":", "arg_4", "=", "None", "else", ":", "arg_5", "=", "arg_3", ".", "get_option_def", "(", "arg_2", ")", "arg_2", "=", "arg_3", ".", "option_attrname", "(", "arg_2", ",", "arg_5", ")", "arg_4", "=", "getattr", "(", "arg_3", ".", "config", ",", "arg_2", ",", "arg_5", ")", "arg_4", "=", "utils", ".", "_format_option_value", "(", "arg_5", ",", "arg_4", ")", "if", "arg_4", "is", "optparse", ".", "NO_DEFAULT", "or", "not", "arg_4", ":", "arg_4", "=", "arg_0", ".", "NO_DEFAULT_VALUE", "return", "arg_1", ".", "help", ".", "replace", "(", "arg_0", ".", "default_tag", ",", "str", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Patch OptionParser.expand_default with custom behaviour\n\n    This will handle defaults to avoid overriding values in the\n    configuration file.\n    \"\"\"\n    if arg_0.parser is None or not arg_0.default_tag:\n        return arg_1.help\n    arg_2 = arg_1._long_opts[0][2:]\n    try:\n        arg_3 = arg_0.parser.options_manager._all_options[arg_2]\n    except KeyError:\n        arg_4 = None\n    else:\n        arg_5 = arg_3.get_option_def(arg_2)\n        arg_2 = arg_3.option_attrname(arg_2, arg_5)\n        arg_4 = getattr(arg_3.config, arg_2, arg_5)\n        arg_4 = utils._format_option_value(arg_5, arg_4)\n    if arg_4 is optparse.NO_DEFAULT or not arg_4:\n        arg_4 = arg_0.NO_DEFAULT_VALUE\n    return arg_1.help.replace(arg_0.default_tag, str(arg_4))", "path": "pylint/config.py", "identifier": "_expand_default", "docstring": "Patch OptionParser.expand_default with custom behaviour\n\n    This will handle defaults to avoid overriding values in the\n    configuration file.", "docstring_tokens": ["Patch", "OptionParser", ".", "expand_default", "with", "custom", "behaviour"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258258}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/bfgs.py#L436-L473", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes the product of a matrix with a vector on the right.", "language": "python", "parameters": "(mat, vec)", "return_statement": "return tf.squeeze(tf.matmul(mat, tf.expand_dims(vec, axis=-1)), axis=-1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "tf", ".", "squeeze", "(", "tf", ".", "matmul", "(", "arg_0", ",", "tf", ".", "expand_dims", "(", "arg_1", ",", "axis", "=", "-", "1", ")", ")", ",", "axis", "=", "-", "1", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Computes the product of a matrix with a vector on the right.\n\n  Note this supports dynamic shapes and batched computation.\n\n  Examples:\n\n    M = tf.reshape(tf.range(6), shape=(3, 2))\n    # => [[0, 1],\n    #     [2, 3],\n    #     [4, 5]]\n    v = tf.constant([1, 2])  # Shape: (2,)\n    Func(M, v)\n    # => [ 2,  8, 14]  # Shape: (3,)\n\n    M = tf.reshape(tf.range(30), shape=(2, 3, 5))\n    # => [[[ 0,  1,  2,  3,  4],\n    #     [ 5,  6,  7,  8,  9],\n    #     [10, 11, 12, 13, 14]],\n    #\n    #    [[15, 16, 17, 18, 19],\n    #     [20, 21, 22, 23, 24],\n    #     [25, 26, 27, 28, 29]]]\n    v = tf.reshape(tf.range(10), shape=(2, 5))\n    # => [[0, 1, 2, 3, 4],\n    #     [5, 6, 7, 8, 9]]\n    Func(M, v)\n    # => [[ 30,  80, 130],\n    #     [605, 780, 955]]  # Shape: (2, 3)\n\n  Args:\n    mat: A `tf.Tensor` of shape `[..., n, m]`.\n    vec: A `tf.Tensor` of shape `[..., m]`.\n\n  Returns:\n    A tensor of shape `[..., n]` with matching batch dimensions.\n  \"\"\"\n  return tf.squeeze(tf.matmul(arg_0, tf.expand_dims(arg_1, axis=-1)), axis=-1)", "path": "tensorflow_probability/python/optimizer/bfgs.py", "identifier": "_mul_right", "docstring": "Computes the product of a matrix with a vector on the right.\n\n  Note this supports dynamic shapes and batched computation.\n\n  Examples:\n\n    M = tf.reshape(tf.range(6), shape=(3, 2))\n    # => [[0, 1],\n    #     [2, 3],\n    #     [4, 5]]\n    v = tf.constant([1, 2])  # Shape: (2,)\n    _mul_right(M, v)\n    # => [ 2,  8, 14]  # Shape: (3,)\n\n    M = tf.reshape(tf.range(30), shape=(2, 3, 5))\n    # => [[[ 0,  1,  2,  3,  4],\n    #     [ 5,  6,  7,  8,  9],\n    #     [10, 11, 12, 13, 14]],\n    #\n    #    [[15, 16, 17, 18, 19],\n    #     [20, 21, 22, 23, 24],\n    #     [25, 26, 27, 28, 29]]]\n    v = tf.reshape(tf.range(10), shape=(2, 5))\n    # => [[0, 1, 2, 3, 4],\n    #     [5, 6, 7, 8, 9]]\n    _mul_right(M, v)\n    # => [[ 30,  80, 130],\n    #     [605, 780, 955]]  # Shape: (2, 3)\n\n  Args:\n    mat: A `tf.Tensor` of shape `[..., n, m]`.\n    vec: A `tf.Tensor` of shape `[..., m]`.\n\n  Returns:\n    A tensor of shape `[..., n]` with matching batch dimensions.", "docstring_tokens": ["Computes", "the", "product", "of", "a", "matrix", "with", "a", "vector", "on", "the", "right", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258259}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L292-L295", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "move cursor left", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "_index", "arg_0", ".", "_select_index", "(", "arg_1", ",", "arg_2", "-", "1", ")"], "function": "def Func(arg_0):\n        \"\"\"move cursor left\"\"\"\n        arg_1, arg_2 = arg_0._index\n        arg_0._select_index(arg_1, arg_2-1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py", "identifier": "CompletionHtml.select_left", "docstring": "move cursor left", "docstring_tokens": ["move", "cursor", "left"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258260}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/admin.py#L60-L66", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Forces unregistration of tree admin class with following re-registration.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "admin", ".", "site", ".", "unregister", "(", "MODEL_TREE_CLASS", ")", "except", "NotRegistered", ":", "pass", "admin", ".", "site", ".", "register", "(", "MODEL_TREE_CLASS", ",", "_TREE_ADMIN", "(", ")", ")"], "function": "def Func():\n    \"\"\"Forces unregistration of tree admin class with following re-registration.\"\"\"\n    try:\n        admin.site.unregister(MODEL_TREE_CLASS)\n    except NotRegistered:\n        pass\n    admin.site.register(MODEL_TREE_CLASS, _TREE_ADMIN())", "path": "sitetree/admin.py", "identifier": "_reregister_tree_admin", "docstring": "Forces unregistration of tree admin class with following re-registration.", "docstring_tokens": ["Forces", "unregistration", "of", "tree", "admin", "class", "with", "following", "re", "-", "registration", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 258261}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/iter_chunks.py#L63-L69", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Map with `func`, chunk by chunk, the input pytable `array`.\n    The result is stored in the output pytable array `out_array`.", "language": "python", "parameters": "(func, array, out_array)", "return_statement": "return out_array", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "iter_chunk_slice", "(", "arg_1", ".", "shape", "[", "-", "1", "]", ",", "arg_1", ".", "chunkshape", "[", "-", "1", "]", ")", ":", "arg_2", ".", "append", "(", "arg_0", "(", "arg_1", "[", "...", ",", "arg_3", "]", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Map with `func`, chunk by chunk, the input pytable `array`.\n    The result is stored in the output pytable array `out_array`.\n    \"\"\"\n    for arg_3 in iter_chunk_slice(arg_1.shape[-1], arg_1.chunkshape[-1]):\n        arg_2.append(arg_0(arg_1[..., arg_3]))\n    return arg_2", "path": "pybromo/iter_chunks.py", "identifier": "map_chunk", "docstring": "Map with `func`, chunk by chunk, the input pytable `array`.\n    The result is stored in the output pytable array `out_array`.", "docstring_tokens": ["Map", "with", "func", "chunk", "by", "chunk", "the", "input", "pytable", "array", ".", "The", "result", "is", "stored", "in", "the", "output", "pytable", "array", "out_array", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 258262}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L442-L485", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Stop all workers.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "join_signal", ".", "is_set", "(", ")", ":", "arg_0", ".", "join_signal", ".", "set", "(", ")", "time", ".", "sleep", "(", "0.01", ")", "if", "arg_0", ".", "main_worker_thread", ".", "is_alive", "(", ")", ":", "arg_0", ".", "main_worker_thread", ".", "join", "(", ")", "if", "arg_0", ".", "threaded", ":", "for", "arg_1", "in", "arg_0", ".", "workers", ":", "if", "arg_1", ".", "is_alive", "(", ")", ":", "arg_1", ".", "join", "(", ")", "else", ":", "for", "arg_1", "in", "arg_0", ".", "workers", ":", "if", "arg_1", ".", "is_alive", "(", ")", ":", "arg_1", ".", "Func", "(", ")", "arg_1", ".", "join", "(", ")", "while", "not", "arg_0", ".", "all_finished", "(", ")", ":", "time", ".", "sleep", "(", "0.001", ")", "if", "arg_0", ".", "queue", ".", "full", "(", ")", ":", "arg_0", ".", "queue", ".", "get", "(", ")", "arg_0", ".", "queue", ".", "put", "(", "pickle", ".", "dumps", "(", "None", ",", "protocol", "=", "-", "1", ")", ")", "time", ".", "sleep", "(", "0.01", ")", "while", "True", ":", "try", ":", "arg_0", ".", "_queue_internal", ".", "get", "(", "timeout", "=", "0.005", ")", "except", "QueueEmpty", ":", "break", "if", "not", "arg_0", ".", "_queue_internal", ".", "_closed", ":", "arg_0", ".", "_queue_internal", ".", "close", "(", ")", "if", "not", "arg_0", ".", "queue", ".", "_closed", ":", "arg_0", ".", "queue", ".", "close", "(", ")", "arg_0", ".", "_queue_internal", ".", "join_thread", "(", ")", "arg_0", ".", "queue", ".", "join_thread", "(", ")", "time", ".", "sleep", "(", "0.025", ")"], "function": "def Func(arg_0):\n        \"\"\"Stop all workers.\"\"\"\n        if not arg_0.join_signal.is_set():\n            arg_0.join_signal.set()\n        # give minimal time to put generated batches in queue and gracefully shut down\n        time.sleep(0.01)\n\n        if arg_0.main_worker_thread.is_alive():\n            arg_0.main_worker_thread.join()\n\n        if arg_0.threaded:\n            for arg_1 in arg_0.workers:\n                if arg_1.is_alive():\n                    arg_1.join()\n        else:\n            for arg_1 in arg_0.workers:\n                if arg_1.is_alive():\n                    arg_1.Func()\n                    arg_1.join()\n\n            # wait until all workers are fully Funcd\n            while not arg_0.all_finished():\n                time.sleep(0.001)\n\n        # empty queue until at least one element can be added and place None as signal that BL finished\n        if arg_0.queue.full():\n            arg_0.queue.get()\n        arg_0.queue.put(pickle.dumps(None, protocol=-1))\n        time.sleep(0.01)\n\n        # clean the queue, this reportedly prevents hanging threads\n        while True:\n            try:\n                arg_0._queue_internal.get(timeout=0.005)\n            except QueueEmpty:\n                break\n\n        if not arg_0._queue_internal._closed:\n            arg_0._queue_internal.close()\n        if not arg_0.queue._closed:\n            arg_0.queue.close()\n        arg_0._queue_internal.join_thread()\n        arg_0.queue.join_thread()\n        time.sleep(0.025)", "path": "imgaug/multicore.py", "identifier": "BatchLoader.terminate", "docstring": "Stop all workers.", "docstring_tokens": ["Stop", "all", "workers", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 258263}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/abi.py#L334-L345", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Read a `nbytes` bytes long big endian unsigned integer from `data` starting at `offset`", "language": "python", "parameters": "(data, nbytes=32, padding=0, offset=0)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "32", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "(", "bytearray", ",", "Array", ")", ")", "arg_4", "=", "ABI", ".", "_readBE", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "arg_3", ")", "arg_4", "=", "Operators", ".", "ZEXTEND", "(", "arg_4", ",", "(", "arg_1", "+", "arg_2", ")", "*", "8", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=32, arg_2=0, arg_3=0):\n        \"\"\"\n        Read a `nbytes` bytes long big endian unsigned integer from `data` starting at `offset`\n\n        :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data\n        :param nbytes: number of bytes to read starting from least significant byte\n        :rtype: int or Expression\n        \"\"\"\n        assert isinstance(arg_0, (bytearray, Array))\n        arg_4 = ABI._readBE(arg_0, arg_1, arg_2=True, arg_3=arg_3)\n        arg_4 = Operators.ZEXTEND(arg_4, (arg_1 + arg_2) * 8)\n        return arg_4", "path": "manticore/ethereum/abi.py", "identifier": "ABI._deserialize_uint", "docstring": "Read a `nbytes` bytes long big endian unsigned integer from `data` starting at `offset`\n\n        :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data\n        :param nbytes: number of bytes to read starting from least significant byte\n        :rtype: int or Expression", "docstring_tokens": ["Read", "a", "nbytes", "bytes", "long", "big", "endian", "unsigned", "integer", "from", "data", "starting", "at", "offset"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258264}
{"url": "https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L550-L555", "sha": "3769aecbef6c83b6cd93ee72ece478ffe433ac57", "docstring_summary": "Returns the rendered URL of the chart", "language": "python", "parameters": "(self)", "return_statement": "return self._apiurl + '&'.join(self._parts()).replace(' ','+')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "render", "(", ")", "return", "arg_0", ".", "_apiFunc", "+", "'&'", ".", "join", "(", "arg_0", ".", "_parts", "(", ")", ")", ".", "replace", "(", "' '", ",", "'+'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the rendered URL of the chart\n        \"\"\"\n        arg_0.render()        \n        return arg_0._apiFunc + '&'.join(arg_0._parts()).replace(' ','+')", "path": "GChartWrapper/GChart.py", "identifier": "GChart.url", "docstring": "Returns the rendered URL of the chart", "docstring_tokens": ["Returns", "the", "rendered", "URL", "of", "the", "chart"], "nwo": "appknox/google-chartwrapper", "score": 0.12050106452410352, "idx": 258265}
{"url": "https://github.com/quantmind/pulsar-cloud/blob/dc2ff8ab5c9a1c2cfb1270581d30454d1a606cf9/cloud/utils/s3.py#L27-L76", "sha": "dc2ff8ab5c9a1c2cfb1270581d30454d1a606cf9", "docstring_summary": "Upload a file to S3 possibly using the multi-part uploader\n        Return the key uploaded", "language": "python", "parameters": "(self, bucket, file, uploadpath=None, key=None,\n                          ContentType=None, **kw)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "**", "arg_6", ")", ":", "arg_7", "=", "False", "if", "hasattr", "(", "arg_2", ",", "'read'", ")", ":", "if", "hasattr", "(", "arg_2", ",", "'seek'", ")", ":", "arg_2", ".", "seek", "(", "0", ")", "arg_2", "=", "arg_2", ".", "read", "(", ")", "arg_8", "=", "len", "(", "arg_2", ")", "elif", "arg_4", ":", "arg_8", "=", "len", "(", "arg_2", ")", "else", ":", "arg_7", "=", "True", "arg_8", "=", "os", ".", "stat", "(", "arg_2", ")", ".", "st_size", "arg_4", "=", "os", ".", "path", ".", "basename", "(", "arg_2", ")", "assert", "arg_4", ",", "'key not available'", "if", "not", "arg_5", ":", "arg_5", ",", "arg_9", "=", "mimetypes", ".", "guess_type", "(", "arg_4", ")", "if", "arg_3", ":", "if", "not", "arg_3", ".", "endswith", "(", "'/'", ")", ":", "arg_3", "=", "'%s/'", "%", "arg_3", "arg_4", "=", "'%s%s'", "%", "(", "arg_3", ",", "arg_4", ")", "arg_10", "=", "dict", "(", "Bucket", "=", "arg_1", ",", "Key", "=", "arg_4", ")", "if", "not", "arg_5", ":", "arg_5", "=", "'application/octet-stream'", "arg_10", "[", "'ContentType'", "]", "=", "arg_5", "if", "arg_8", ">", "MULTI_PART_SIZE", "and", "arg_7", ":", "arg_11", "=", "await", "_multipart", "(", "arg_0", ",", "arg_2", ",", "arg_10", ")", "elif", "arg_7", ":", "with", "open", "(", "arg_2", ",", "'rb'", ")", "as", "fp", ":", "arg_10", "[", "'Body'", "]", "=", "fp", ".", "read", "(", ")", "arg_11", "=", "await", "arg_0", ".", "put_object", "(", "**", "arg_10", ")", "else", ":", "arg_10", "[", "'Body'", "]", "=", "arg_2", "arg_11", "=", "await", "arg_0", ".", "put_object", "(", "**", "arg_10", ")", "if", "'Key'", "not", "in", "arg_11", ":", "arg_11", "[", "'Key'", "]", "=", "arg_4", "if", "'Bucket'", "not", "in", "arg_11", ":", "arg_11", "[", "'Bucket'", "]", "=", "arg_1", "return", "arg_11"], "function": "async def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,\n                          arg_5=None, **arg_6):\n        \"\"\"Upload a file to S3 possibly using the multi-part uploader\n        Return the key uploaded\n        \"\"\"\n        arg_7 = False\n\n        if hasattr(arg_2, 'read'):\n            if hasattr(arg_2, 'seek'):\n                arg_2.seek(0)\n            arg_2 = arg_2.read()\n            arg_8 = len(arg_2)\n        elif arg_4:\n            arg_8 = len(arg_2)\n        else:\n            arg_7 = True\n            arg_8 = os.stat(arg_2).st_size\n            arg_4 = os.path.basename(arg_2)\n\n        assert arg_4, 'key not available'\n\n        if not arg_5:\n            arg_5, arg_9 = mimetypes.guess_type(arg_4)\n\n        if arg_3:\n            if not arg_3.endswith('/'):\n                arg_3 = '%s/' % arg_3\n            arg_4 = '%s%s' % (arg_3, arg_4)\n\n        arg_10 = dict(Bucket=arg_1, Key=arg_4)\n\n        if not arg_5:\n            arg_5 = 'application/octet-stream'\n\n        arg_10['ContentType'] = arg_5\n\n        if arg_8 > MULTI_PART_SIZE and arg_7:\n            arg_11 = await _multipart(arg_0, arg_2, arg_10)\n        elif arg_7:\n            with open(arg_2, 'rb') as fp:\n                arg_10['Body'] = fp.read()\n            arg_11 = await arg_0.put_object(**arg_10)\n        else:\n            arg_10['Body'] = arg_2\n            arg_11 = await arg_0.put_object(**arg_10)\n        if 'Key' not in arg_11:\n            arg_11['Key'] = arg_4\n        if 'Bucket' not in arg_11:\n            arg_11['Bucket'] = arg_1\n        return arg_11", "path": "cloud/utils/s3.py", "identifier": "S3tools.upload_file", "docstring": "Upload a file to S3 possibly using the multi-part uploader\n        Return the key uploaded", "docstring_tokens": ["Upload", "a", "file", "to", "S3", "possibly", "using", "the", "multi", "-", "part", "uploader", "Return", "the", "key", "uploaded"], "nwo": "quantmind/pulsar-cloud", "score": 0.18657722465184873, "idx": 258266}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L597-L647", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "clean repository given before and after states", "language": "python", "parameters": "(self, stateBefore, stateAfter, keepNoneEmptyDirectory=True)", "return_statement": "return len(errors)==0, errors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "{", "}", "[", "arg_5", ".", "setdefault", "(", "list", "(", "arg_6", ")", "[", "0", "]", ",", "[", "]", ")", ".", "append", "(", "arg_6", ")", "for", "arg_6", "in", "arg_2", "]", "for", "arg_7", "in", "reversed", "(", "arg_1", ")", ":", "arg_8", "=", "list", "(", "arg_7", ")", "[", "0", "]", "arg_9", "=", "os", ".", "path", ".", "basename", "(", "arg_8", ")", "arg_10", "=", "arg_7", "[", "arg_8", "]", "[", "'type'", "]", "arg_11", "=", "arg_5", ".", "get", "(", "arg_8", ",", "[", "]", ")", "arg_6", "=", "[", "a", "for", "a", "in", "arg_11", "if", "a", "[", "arg_8", "]", "[", "'type'", "]", "==", "arg_10", "]", "if", "len", "(", "arg_6", ")", ">", "1", ":", "arg_4", ".", "append", "(", "\"Multiple '%s' of type '%s' where found in '%s', this should never had happened. Please report issue\"", "%", "(", "arg_9", ",", "arg_10", ",", "arg_8", ")", ")", "continue", "if", "not", "len", "(", "arg_6", ")", ":", "arg_12", "=", "[", "]", "arg_13", "=", "[", "]", "if", "arg_10", "==", "'dir'", ":", "if", "not", "len", "(", "arg_8", ")", ":", "arg_4", ".", "append", "(", "\"Removing main repository directory is not allowed\"", ")", "continue", "arg_12", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ")", ")", "arg_13", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ",", "arg_0", ".", "__dirInfo", ")", ")", "arg_13", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ",", "arg_0", ".", "__dirLock", ")", ")", "elif", "arg_10", "==", "'file'", ":", "arg_13", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ")", ")", "arg_13", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ",", "arg_0", ".", "__fileInfo", "%", "arg_9", ")", ")", "arg_13", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ",", "arg_0", ".", "__fileLock", "%", "arg_9", ")", ")", "else", ":", "arg_12", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ")", ")", "arg_13", ".", "append", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_8", ",", "arg_0", ".", "__fileInfo", "%", "arg_9", ")", ")", "for", "arg_14", "in", "arg_13", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_14", ")", ":", "try", ":", "os", ".", "remove", "(", "arg_14", ")", "except", "Exception", "as", "err", ":", "arg_4", ".", "append", "(", "\"Unable to clean file '%s' (%s)\"", "%", "(", "arg_14", ",", "str", "(", "err", ")", ")", ")", "for", "arg_15", "in", "arg_12", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_15", ")", ":", "if", "arg_3", "or", "not", "len", "(", "os", ".", "listdir", "(", "arg_15", ")", ")", ":", "try", ":", "shutil", ".", "rmtree", "(", "arg_15", ")", "except", "Exception", "as", "err", ":", "arg_4", ".", "append", "(", "\"Unable to clean directory '%s' (%s)\"", "%", "(", "arg_14", ",", "str", "(", "err", ")", ")", ")", "return", "len", "(", "arg_4", ")", "==", "0", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n        \"\"\"clean repository given before and after states\"\"\"\n        # prepare after for faster search\n        arg_4    = []\n        arg_5 = {}\n        [arg_5.setdefault(list(arg_6)[0],[]).append(arg_6) for arg_6 in arg_2]\n        # loop before\n        for arg_7 in reversed(arg_1):\n            arg_8 = list(arg_7)[0]\n            arg_9 = os.path.basename(arg_8)\n            arg_10    = arg_7[arg_8]['type']\n            arg_11    = arg_5.get(arg_8, [])\n            arg_6    = [a for a in arg_11 if a[arg_8]['type']==arg_10]\n            if len(arg_6)>1:\n                arg_4.append(\"Multiple '%s' of type '%s' where found in '%s', this should never had happened. Please report issue\"%(arg_9,arg_10,arg_8))\n                continue\n            if not len(arg_6):\n                arg_12  = []\n                arg_13 = []\n                if arg_10 == 'dir':\n                    if not len(arg_8):\n                        arg_4.append(\"Removing main repository directory is not allowed\")\n                        continue\n                    arg_12.append(os.path.join(arg_0.__path,arg_8))\n                    arg_13.append(os.path.join(arg_0.__path,arg_8,arg_0.__dirInfo))\n                    arg_13.append(os.path.join(arg_0.__path,arg_8,arg_0.__dirLock))\n                elif arg_10 == 'file':\n                    arg_13.append(os.path.join(arg_0.__path,arg_8))\n                    arg_13.append(os.path.join(arg_0.__path,arg_8,arg_0.__fileInfo%arg_9))\n                    arg_13.append(os.path.join(arg_0.__path,arg_8,arg_0.__fileLock%arg_9))\n                else:\n                    ### MUST VERIFY THAT ONCE pyrepobjectdir IS IMPLEMENTED\n                    arg_12.append(os.path.join(arg_0.__path,arg_8))\n                    arg_13.append(os.path.join(arg_0.__path,arg_8,arg_0.__fileInfo%arg_9))\n                # remove files\n                for arg_14 in arg_13:\n                    if os.path.isfile(arg_14):\n                        try:\n                            os.remove(arg_14)\n                        except Exception as err:\n                            arg_4.append(\"Unable to clean file '%s' (%s)\"%(arg_14, str(err)))\n                # remove directories\n                for arg_15 in arg_12:\n                    if os.path.isdir(arg_15):\n                        if arg_3 or not len(os.listdir(arg_15)):\n                            try:\n                                shutil.rmtree(arg_15)\n                            except Exception as err:\n                                arg_4.append(\"Unable to clean directory '%s' (%s)\"%(arg_14, str(err)))\n        # return result and errors list\n        return len(arg_4)==0, arg_4", "path": "Repository.py", "identifier": "Repository.__clean_before_after", "docstring": "clean repository given before and after states", "docstring_tokens": ["clean", "repository", "given", "before", "and", "after", "states"], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 258267}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/app.py#L166-L197", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Setup coverage related extensions.", "language": "python", "parameters": "(app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "config", "[", "'SQLALCHEMY_TRACK_MODIFICATIONS'", "]", "=", "True", "if", "arg_0", ".", "debug", "else", "False", "if", "chanjo_api", ":", "chanjo_api", ".", "init_app", "(", "arg_0", ")", "configure_template_filters", "(", "arg_0", ")", "arg_0", ".", "register_blueprint", "(", "report_bp", ",", "url_prefix", "=", "'/reports'", ")", "arg_2", "=", "Babel", "(", "arg_0", ")", "@", "arg_2", ".", "localeselector", "def", "get_locale", "(", ")", ":", "arg_3", "=", "current_app", ".", "config", ".", "get", "(", "'ACCEPT_LANGUAGES'", ",", "[", "'en'", "]", ")", "arg_4", "=", "request", ".", "args", ".", "get", "(", "'lang'", ")", "if", "arg_4", "in", "arg_3", ":", "current_app", ".", "logger", ".", "info", "(", "\"using session language: %s\"", ",", "arg_4", ")", "return", "arg_4", "arg_5", "=", "current_app", ".", "config", ".", "get", "(", "'REPORT_LANGUAGE'", ")", "if", "arg_5", ":", "return", "arg_5", "return", "request", ".", "accept_languages", ".", "best_match", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Setup coverage related extensions.\"\"\"\n    # setup chanjo report\n    arg_0.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True if arg_0.debug else False\n    if chanjo_api:\n        chanjo_api.init_app(arg_0)\n        configure_template_filters(arg_0)\n        # register chanjo report blueprint\n        arg_0.register_blueprint(report_bp, url_prefix='/reports')\n\n    arg_2 = Babel(arg_0)\n\n    @arg_2.localeselector\n    def get_locale():\n        \"\"\"Determine locale to use for translations.\"\"\"\n        arg_3 = current_app.config.get('ACCEPT_LANGUAGES', ['en'])\n\n        # first check request args\n        arg_4 = request.args.get('lang')\n        if arg_4 in arg_3:\n            current_app.logger.info(\"using session language: %s\", arg_4)\n            return arg_4\n\n        # language can be forced in config\n        arg_5 = current_app.config.get('REPORT_LANGUAGE')\n        if arg_5:\n            return arg_5\n\n        # try to guess the language from the user accept header that\n        # the browser transmits.  We support de/fr/en in this example.\n        # The best match wins.\n        return request.accept_languages.best_match(arg_3)", "path": "scout/server/app.py", "identifier": "configure_coverage", "docstring": "Setup coverage related extensions.", "docstring_tokens": ["Setup", "coverage", "related", "extensions", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258268}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/dashboard/controllers.py#L165-L240", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return general information about cases", "language": "python", "parameters": "(adapter, institute_id=None, slice_query=None)", "return_statement": "return general", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "}", "arg_4", "=", "arg_2", "arg_5", "=", "arg_0", ".", "cases", "(", "owner", "=", "arg_1", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "0", "arg_7", "=", "0", "arg_8", "=", "0", "arg_9", "=", "0", "arg_10", "=", "{", "1", ":", "{", "'title'", ":", "'Single'", ",", "'count'", ":", "0", "}", ",", "2", ":", "{", "'title'", ":", "'Duo'", ",", "'count'", ":", "0", "}", ",", "3", ":", "{", "'title'", ":", "'Trio'", ",", "'count'", ":", "0", "}", ",", "'many'", ":", "{", "'title'", ":", "'Many'", ",", "'count'", ":", "0", "}", ",", "}", "arg_11", "=", "set", "(", ")", "arg_12", "=", "0", "for", "arg_12", ",", "arg_13", "in", "enumerate", "(", "arg_5", ",", "1", ")", ":", "if", "arg_1", ":", "arg_11", ".", "add", "(", "arg_13", "[", "'_id'", "]", ")", "if", "arg_13", ".", "get", "(", "'phenotype_terms'", ")", ":", "arg_6", "+=", "1", "if", "arg_13", ".", "get", "(", "'causatives'", ")", ":", "arg_7", "+=", "1", "if", "arg_13", ".", "get", "(", "'suspects'", ")", ":", "arg_8", "+=", "1", "if", "arg_13", ".", "get", "(", "'cohorts'", ")", ":", "arg_9", "+=", "1", "arg_14", "=", "len", "(", "arg_13", ".", "get", "(", "'individuals'", ",", "[", "]", ")", ")", "if", "arg_14", "==", "0", ":", "continue", "if", "arg_14", ">", "3", ":", "arg_10", "[", "'many'", "]", "[", "'count'", "]", "+=", "1", "else", ":", "arg_10", "[", "arg_14", "]", "[", "'count'", "]", "+=", "1", "arg_3", "[", "'total_cases'", "]", "=", "arg_12", "arg_3", "[", "'phenotype_cases'", "]", "=", "arg_6", "arg_3", "[", "'causative_cases'", "]", "=", "arg_7", "arg_3", "[", "'pinned_cases'", "]", "=", "arg_8", "arg_3", "[", "'cohort_cases'", "]", "=", "arg_9", "arg_3", "[", "'pedigree'", "]", "=", "arg_10", "arg_3", "[", "'case_ids'", "]", "=", "arg_11", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Return general information about cases\n\n    Args:\n        adapter(adapter.MongoAdapter)\n        institute_id(str)\n        slice_query(str):   Query to filter cases to obtain statistics for.\n\n\n    Returns:\n        general(dict)\n    \"\"\"\n    arg_3 = {}\n\n    # Potentially sensitive slice queries are assumed allowed if we have got this far\n    arg_4 = arg_2\n\n    arg_5 = arg_0.cases(owner=arg_1, arg_4=arg_4)\n\n    arg_6 = 0\n    arg_7 = 0\n    arg_8 = 0\n    arg_9 = 0\n\n    arg_10 = {\n        1: {\n            'title': 'Single',\n            'count': 0\n        },\n        2: {\n            'title': 'Duo',\n            'count': 0\n        },\n        3: {\n            'title': 'Trio',\n            'count': 0\n        },\n        'many': {\n            'title': 'Many',\n            'count': 0\n        },\n    }\n\n    arg_11 = set()\n\n    arg_12 = 0\n    for arg_12,arg_13 in enumerate(arg_5,1):\n        # If only looking at one institute we need to save the case ids\n        if arg_1:\n            arg_11.add(arg_13['_id'])\n        if arg_13.get('phenotype_terms'):\n            arg_6 += 1\n        if arg_13.get('causatives'):\n            arg_7 += 1\n        if arg_13.get('suspects'):\n            arg_8 += 1\n        if arg_13.get('cohorts'):\n            arg_9 += 1\n\n        arg_14 = len(arg_13.get('individuals',[]))\n        if arg_14 == 0:\n            continue\n        if arg_14 > 3:\n            arg_10['many']['count'] += 1\n        else:\n            arg_10[arg_14]['count'] += 1\n\n    arg_3['total_cases'] = arg_12\n    arg_3['phenotype_cases'] = arg_6\n    arg_3['causative_cases'] = arg_7\n    arg_3['pinned_cases'] = arg_8\n    arg_3['cohort_cases'] = arg_9\n    arg_3['pedigree'] = arg_10\n    arg_3['case_ids'] = arg_11\n\n    return arg_3", "path": "scout/server/blueprints/dashboard/controllers.py", "identifier": "get_general_case_info", "docstring": "Return general information about cases\n\n    Args:\n        adapter(adapter.MongoAdapter)\n        institute_id(str)\n        slice_query(str):   Query to filter cases to obtain statistics for.\n\n\n    Returns:\n        general(dict)", "docstring_tokens": ["Return", "general", "information", "about", "cases"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258269}
{"url": "https://github.com/django-inplaceedit/django-inplaceedit/blob/7ba18e7906f56c56395ca07e2486755062efce00/inplaceeditform/fields.py#L92-L109", "sha": "7ba18e7906f56c56395ca07e2486755062efce00", "docstring_summary": "Get the arguments given to the template tag element and complete these\n        with the ones from the settings.py if necessary.", "language": "python", "parameters": "(self, request, **kwargs)", "return_statement": "return config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", "arg_4", "=", "deepcopy", "(", "inplace_settings", ".", "DEFAULT_INPLACE_EDIT_OPTIONS", ")", "arg_5", "=", "inplace_settings", ".", "DEFAULT_INPLACE_EDIT_OPTIONS_ONE_BY_ONE", "if", "not", "arg_5", ":", "if", "not", "arg_3", "and", "arg_4", ":", "arg_3", "=", "arg_4", "else", ":", "arg_3", "=", "dict", "(", "arg_4", ",", "**", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Get the arguments given to the template tag element and complete these\n        with the ones from the settings.py if necessary.\n        \"\"\"\n        arg_3 = arg_2\n\n        arg_4 = deepcopy(inplace_settings.DEFAULT_INPLACE_EDIT_OPTIONS)\n        arg_5 = inplace_settings.DEFAULT_INPLACE_EDIT_OPTIONS_ONE_BY_ONE\n\n        if not arg_5:\n            # Solution 1: Using default config only if none specified.\n            if not arg_3 and arg_4:\n                arg_3 = arg_4\n        else:\n            # Solution 2: Updating the configured config with the default one.\n            arg_3 = dict(arg_4, **arg_3)\n        return arg_3", "path": "inplaceeditform/fields.py", "identifier": "BaseAdaptorField.get_config", "docstring": "Get the arguments given to the template tag element and complete these\n        with the ones from the settings.py if necessary.", "docstring_tokens": ["Get", "the", "arguments", "given", "to", "the", "template", "tag", "element", "and", "complete", "these", "with", "the", "ones", "from", "the", "settings", ".", "py", "if", "necessary", "."], "nwo": "django-inplaceedit/django-inplaceedit", "score": 0.36645942339534354, "idx": 258270}
{"url": "https://github.com/honzajavorek/danube-delta/blob/d0a72f0704d52b888e7fb2b68c4fdc696d370018/danube_delta/cli/write.py#L12-L44", "sha": "d0a72f0704d52b888e7fb2b68c4fdc696d370018", "docstring_summary": "Starts a new article", "language": "python", "parameters": "(context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "obj", "arg_2", "=", "click", ".", "prompt", "(", "'Title'", ")", "arg_3", "=", "click", ".", "prompt", "(", "'Author'", ",", "default", "=", "arg_1", ".", "get", "(", "'DEFAULT_AUTHOR'", ")", ")", "arg_4", "=", "slugify", "(", "arg_2", ")", "arg_5", "=", "datetime", ".", "now", "(", ")", "arg_6", "=", "'{:%Y-%m-%d}_{}.md'", ".", "format", "(", "arg_5", ",", "arg_4", ")", "arg_7", "=", "(", "(", "'Title'", ",", "arg_2", ")", ",", "(", "'Date'", ",", "'{:%Y-%m-%d %H:%M}:00'", ".", "format", "(", "arg_5", ")", ")", ",", "(", "'Modified'", ",", "'{:%Y-%m-%d %H:%M}:00'", ".", "format", "(", "arg_5", ")", ")", ",", "(", "'Author'", ",", "arg_3", ")", ",", ")", "arg_8", "=", "''", "for", "arg_9", ",", "arg_10", "in", "arg_7", ":", "arg_8", "+=", "'{}: {}\\n'", ".", "format", "(", "arg_9", ",", "arg_10", ")", "arg_8", "+=", "'\\n\\n'", "arg_8", "+=", "'Text...\\n\\n'", "arg_8", "+=", "'![image description]({filename}/images/my-photo.jpg)\\n\\n'", "arg_8", "+=", "'Text...\\n\\n'", "os", ".", "makedirs", "(", "arg_1", "[", "'CONTENT_DIR'", "]", ",", "exist_ok", "=", "True", ")", "arg_11", "=", "os", ".", "path", ".", "join", "(", "arg_1", "[", "'CONTENT_DIR'", "]", ",", "arg_6", ")", "with", "click", ".", "open_file", "(", "arg_11", ",", "'w'", ")", "as", "f", ":", "f", ".", "Func", "(", "arg_8", ")", "click", ".", "echo", "(", "arg_11", ")", "click", ".", "launch", "(", "arg_11", ")"], "function": "def Func(arg_0):\n    \"\"\"Starts a new article\"\"\"\n\n    arg_1 = arg_0.obj\n\n    arg_2 = click.prompt('Title')\n    arg_3 = click.prompt('Author', default=arg_1.get('DEFAULT_AUTHOR'))\n\n    arg_4 = slugify(arg_2)\n    arg_5 = datetime.now()\n    arg_6 = '{:%Y-%m-%d}_{}.md'.format(arg_5, arg_4)\n    arg_7 = (\n        ('Title', arg_2),\n        ('Date', '{:%Y-%m-%d %H:%M}:00'.format(arg_5)),\n        ('Modified', '{:%Y-%m-%d %H:%M}:00'.format(arg_5)),\n        ('Author', arg_3),\n    )\n\n    arg_8 = ''\n    for arg_9, arg_10 in arg_7:\n        arg_8 += '{}: {}\\n'.format(arg_9, arg_10)\n    arg_8 += '\\n\\n'\n    arg_8 += 'Text...\\n\\n'\n    arg_8 += '![image description]({filename}/images/my-photo.jpg)\\n\\n'\n    arg_8 += 'Text...\\n\\n'\n\n    os.makedirs(arg_1['CONTENT_DIR'], exist_ok=True)\n    arg_11 = os.path.join(arg_1['CONTENT_DIR'], arg_6)\n    with click.open_file(arg_11, 'w') as f:\n        f.Func(arg_8)\n\n    click.echo(arg_11)\n    click.launch(arg_11)", "path": "danube_delta/cli/write.py", "identifier": "write", "docstring": "Starts a new article", "docstring_tokens": ["Starts", "a", "new", "article"], "nwo": "honzajavorek/danube-delta", "score": 0.27074237488055014, "idx": 258271}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/query.py#L442-L473", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Takes a list of filters and returns JSON", "language": "python", "parameters": "(cls, filters)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "isinstance", "(", "arg_3", ",", "Filter", ")", ":", "if", "arg_3", ".", "filters", ":", "arg_2", ".", "extend", "(", "arg_0", ".", "Func", "(", "arg_3", ".", "filters", ")", ")", "elif", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "arg_4", "=", "list", "(", "arg_3", ".", "keys", "(", ")", ")", "[", "0", "]", "arg_5", "=", "arg_3", "[", "arg_4", "]", "if", "isinstance", "(", "arg_5", ",", "dict", ")", ":", "arg_6", "=", "arg_0", ".", "Func", "(", "[", "arg_5", "]", ")", "if", "len", "(", "arg_6", ")", "==", "1", ":", "arg_6", "=", "arg_6", "[", "0", "]", "arg_2", ".", "append", "(", "{", "arg_4", ":", "arg_6", "}", ")", "else", ":", "arg_2", ".", "append", "(", "{", "arg_4", ":", "arg_0", ".", "Func", "(", "arg_5", ")", "}", ")", "else", ":", "arg_2", ".", "extend", "(", "(", "arg_3", ",", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Takes a list of filters and returns JSON\n\n        :Parameters:\n        - `filters`: List of Filters, (key, val) tuples, or dicts\n\n        Returns: List of JSON API filters\n        \"\"\"\n        arg_2 = []\n\n        # Filters should always be a list\n        for arg_3 in arg_1:\n            if isinstance(arg_3, Filter):\n                if arg_3.filters:\n                    arg_2.extend(arg_0.Func(arg_3.filters))\n            elif isinstance(arg_3, dict):\n                arg_4 = list(arg_3.keys())[0]\n                arg_5 = arg_3[arg_4]\n\n                if isinstance(arg_5, dict):\n                    # pass val (a dict) as list\n                    # so that it gets processed properly\n                    arg_6 = arg_0.Func([arg_5])\n                    if len(arg_6) == 1:\n                        arg_6 = arg_6[0]\n                    arg_2.append({arg_4: arg_6})\n                else:\n                    arg_2.append({arg_4: arg_0.Func(arg_5)})\n            else:\n                arg_2.extend((arg_3,))\n\n        return arg_2", "path": "solvebio/query.py", "identifier": "Query._process_filters", "docstring": "Takes a list of filters and returns JSON\n\n        :Parameters:\n        - `filters`: List of Filters, (key, val) tuples, or dicts\n\n        Returns: List of JSON API filters", "docstring_tokens": ["Takes", "a", "list", "of", "filters", "and", "returns", "JSON"], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 258272}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/pipeline/tagging.py#L170-L182", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Generate a tag for the alignment of the geometry of the bulge and disk of a bulge-disk system, to customize \\ \n    phase names based on the bulge-disk model. This adds together the bulge_disk tags generated in the 3 functions\n    above", "language": "python", "parameters": "(align_bulge_disk_centre, align_bulge_disk_axis_ratio, align_bulge_disk_phi)", "return_statement": "return align_bulge_disk_centre_tag + align_bulge_disk_axis_ratio_tag + align_bulge_disk_phi_tag", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "align_bulge_disk_centre_tag_from_align_bulge_disk_centre", "(", "arg_0", "=", "arg_0", ")", "arg_4", "=", "align_bulge_disk_axis_ratio_tag_from_align_bulge_disk_axis_ratio", "(", "arg_1", "=", "arg_1", ")", "arg_5", "=", "align_bulge_disk_phi_tag_from_align_bulge_disk_phi", "(", "arg_2", "=", "arg_2", ")", "return", "arg_3", "+", "arg_4", "+", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Generate a tag for the alignment of the geometry of the bulge and disk of a bulge-disk system, to customize \\ \n    phase names based on the bulge-disk model. This adds together the bulge_disk tags generated in the 3 functions\n    above\n    \"\"\"\n    arg_3 = align_bulge_disk_centre_tag_from_align_bulge_disk_centre(\n        arg_0=arg_0)\n    arg_4 = align_bulge_disk_axis_ratio_tag_from_align_bulge_disk_axis_ratio(\n        arg_1=arg_1)\n    arg_5 = align_bulge_disk_phi_tag_from_align_bulge_disk_phi(\n        arg_2=arg_2)\n\n    return arg_3 + arg_4 + arg_5", "path": "autolens/pipeline/tagging.py", "identifier": "bulge_disk_tag_from_align_bulge_disks", "docstring": "Generate a tag for the alignment of the geometry of the bulge and disk of a bulge-disk system, to customize \\ \n    phase names based on the bulge-disk model. This adds together the bulge_disk tags generated in the 3 functions\n    above", "docstring_tokens": ["Generate", "a", "tag", "for", "the", "alignment", "of", "the", "geometry", "of", "the", "bulge", "and", "disk", "of", "a", "bulge", "-", "disk", "system", "to", "customize", "\\", "phase", "names", "based", "on", "the", "bulge", "-", "disk", "model", ".", "This", "adds", "together", "the", "bulge_disk", "tags", "generated", "in", "the", "3", "functions", "above"], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 258273}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L508-L527", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Rename this conversation.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "await", "arg_0", ".", "_client", ".", "Func_conversation", "(", "hangouts_pb2", ".", "RenameConversationRequest", "(", "request_header", "=", "arg_0", ".", "_client", ".", "get_request_header", "(", ")", ",", "new_name", "=", "arg_1", ",", "event_request_header", "=", "arg_0", ".", "_get_event_request_header", "(", ")", ",", ")", ")"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Rename this conversation.\n\n        Hangouts only officially supports renaming group conversations, so\n        custom names for one-to-one conversations may or may not appear in all\n        first party clients.\n\n        Args:\n            name (str): New name.\n\n        Raises:\n            .NetworkError: If conversation cannot be Funcd.\n        \"\"\"\n        await arg_0._client.Func_conversation(\n            hangouts_pb2.RenameConversationRequest(\n                request_header=arg_0._client.get_request_header(),\n                new_name=arg_1,\n                event_request_header=arg_0._get_event_request_header(),\n            )\n        )", "path": "hangups/conversation.py", "identifier": "Conversation.rename", "docstring": "Rename this conversation.\n\n        Hangouts only officially supports renaming group conversations, so\n        custom names for one-to-one conversations may or may not appear in all\n        first party clients.\n\n        Args:\n            name (str): New name.\n\n        Raises:\n            .NetworkError: If conversation cannot be renamed.", "docstring_tokens": ["Rename", "this", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258274}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L423-L430", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Restart the stream as needed after SASL and StartTLS negotiation.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_input_state", "=", "\"restart\"", "arg_0", ".", "_output_state", "=", "\"restart\"", "arg_0", ".", "features", "=", "None", "arg_0", ".", "transport", ".", "restart", "(", ")", "if", "arg_0", ".", "initiator", ":", "arg_0", ".", "_send_stream_start", "(", "arg_0", ".", "stream_id", ")"], "function": "def Func(arg_0):\n        \"\"\"Restart the stream as needed after SASL and StartTLS negotiation.\"\"\"\n        arg_0._input_state = \"restart\"\n        arg_0._output_state = \"restart\"\n        arg_0.features = None\n        arg_0.transport.restart()\n        if arg_0.initiator:\n            arg_0._send_stream_start(arg_0.stream_id)", "path": "pyxmpp2/streambase.py", "identifier": "StreamBase._restart_stream", "docstring": "Restart the stream as needed after SASL and StartTLS negotiation.", "docstring_tokens": ["Restart", "the", "stream", "as", "needed", "after", "SASL", "and", "StartTLS", "negotiation", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258275}
{"url": "https://github.com/hamelsmu/ktext/blob/221f09f5b1762705075fd1bd914881c0724d5e02/ktext/preprocess.py#L307-L311", "sha": "221f09f5b1762705075fd1bd914881c0724d5e02", "docstring_summary": "See token counts as pandas dataframe", "language": "python", "parameters": "(self)", "return_statement": "return freq_df.sort_values('count', ascending=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "pd", ".", "DataFrame", ".", "from_dict", "(", "arg_0", ".", "indexer", ".", "word_counts", ",", "orient", "=", "'index'", ")", "arg_1", ".", "columns", "=", "[", "'count'", "]", "return", "arg_1", ".", "sort_values", "(", "'count'", ",", "ascending", "=", "False", ")"], "function": "def Func(arg_0):\n        \"\"\" See token counts as pandas dataframe\"\"\"\n        arg_1 = pd.DataFrame.from_dict(arg_0.indexer.word_counts, orient='index')\n        arg_1.columns = ['count']\n        return arg_1.sort_values('count', ascending=False)", "path": "ktext/preprocess.py", "identifier": "processor.token_count_pandas", "docstring": "See token counts as pandas dataframe", "docstring_tokens": ["See", "token", "counts", "as", "pandas", "dataframe"], "nwo": "hamelsmu/ktext", "score": 0.5862139051793661, "idx": 258276}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/linecache.py#L33-L44", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Get the lines for a file from the cache.\n    Update the cache if it doesn't contain an entry for this file already.", "language": "python", "parameters": "(filename, module_globals=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "in", "cache", ":", "return", "cache", "[", "arg_0", "]", "[", "2", "]", "try", ":", "return", "updatecache", "(", "arg_0", ",", "arg_1", ")", "except", "MemoryError", ":", "clearcache", "(", ")", "return", "[", "]"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Get the lines for a file from the cache.\n    Update the cache if it doesn't contain an entry for this file already.\"\"\"\n\n    if arg_0 in cache:\n        return cache[arg_0][2]\n\n    try:\n        return updatecache(arg_0, arg_1)\n    except MemoryError:\n        clearcache()\n        return []", "path": "third_party/stdlib/linecache.py", "identifier": "getlines", "docstring": "Get the lines for a file from the cache.\n    Update the cache if it doesn't contain an entry for this file already.", "docstring_tokens": ["Get", "the", "lines", "for", "a", "file", "from", "the", "cache", ".", "Update", "the", "cache", "if", "it", "doesn", "t", "contain", "an", "entry", "for", "this", "file", "already", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258277}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/sphinxtechnotes.py#L95-L204", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Reduce a technote project's metadata from multiple sources into a\n    single JSON-LD resource.", "language": "python", "parameters": "(github_url, metadata, github_data,\n                             ltd_product_data)", "return_statement": "return jsonld", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "parse_repo_slug_from_url", "(", "arg_0", ")", "arg_5", "=", "{", "'@context'", ":", "[", "\"https://raw.githubusercontent.com/codemeta/codemeta/2.0-rc/\"", "\"codemeta.jsonld\"", ",", "\"http://schema.org\"", "]", ",", "'@type'", ":", "[", "'Report'", ",", "'SoftwareSourceCode'", "]", ",", "'codeRepository'", ":", "arg_0", "}", "if", "'url'", "in", "arg_1", ":", "arg_6", "=", "arg_1", "[", "'url'", "]", "elif", "'published_url'", "in", "arg_3", ":", "arg_6", "=", "arg_3", "[", "'published_url'", "]", "else", ":", "raise", "RuntimeError", "(", "'No identifying url could be found: '", "'{}'", ".", "format", "(", "arg_0", ")", ")", "arg_5", "[", "'@id'", "]", "=", "arg_6", "arg_5", "[", "'url'", "]", "=", "arg_6", "if", "'series'", "in", "arg_1", "and", "'serial_number'", "in", "arg_1", ":", "arg_5", "[", "'reportNumber'", "]", "=", "'{series}-{serial_number}'", ".", "format", "(", "**", "arg_1", ")", "else", ":", "raise", "RuntimeError", "(", "'No reportNumber: {}'", ".", "format", "(", "arg_0", ")", ")", "if", "'doc_title'", "in", "arg_1", ":", "arg_5", "[", "'name'", "]", "=", "arg_1", "[", "'doc_title'", "]", "if", "'description'", "in", "arg_1", ":", "arg_5", "[", "'description'", "]", "=", "arg_1", "[", "'description'", "]", "if", "'authors'", "in", "arg_1", ":", "arg_5", "[", "'author'", "]", "=", "[", "{", "'@type'", ":", "'Person'", ",", "'name'", ":", "author_name", "}", "for", "author_name", "in", "arg_1", "[", "'authors'", "]", "]", "if", "'last_revised'", "in", "arg_1", ":", "arg_5", "[", "'dateModified'", "]", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_1", "[", "'last_revised'", "]", ",", "'%Y-%m-%d'", ")", "else", ":", "try", ":", "arg_7", "=", "arg_2", "[", "'data'", "]", "[", "'repository'", "]", "arg_8", "=", "arg_7", "[", "'defaultBranchRef'", "]", "arg_5", "[", "'dateModified'", "]", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_8", "[", "'target'", "]", "[", "'committedDate'", "]", ",", "'%Y-%m-%dT%H:%M:%SZ'", ")", "except", "KeyError", ":", "pass", "try", ":", "arg_9", "=", "arg_2", "[", "'data'", "]", "[", "'repository'", "]", "[", "'licenseInfo'", "]", "arg_10", "=", "arg_9", "[", "'spdxId'", "]", "if", "arg_10", "is", "not", "None", ":", "arg_11", "=", "'https://spdx.org/licenses/{}.html'", ".", "format", "(", "arg_10", ")", "arg_5", "[", "'license'", "]", "=", "arg_11", "except", "KeyError", ":", "pass", "try", ":", "arg_8", "=", "arg_2", "[", "'data'", "]", "[", "'repository'", "]", "[", "'defaultBranchRef'", "]", "arg_12", "=", "arg_8", "[", "'target'", "]", "[", "'tree'", "]", "[", "'entries'", "]", "for", "arg_13", "in", "arg_12", ":", "arg_14", "=", "arg_13", "[", "'name'", "]", "arg_15", "=", "arg_14", ".", "lower", "(", ")", "if", "arg_15", ".", "startswith", "(", "'readme'", ")", ":", "arg_16", "=", "make_raw_content_url", "(", "arg_4", ",", "'master'", ",", "arg_14", ")", "arg_5", "[", "'readme'", "]", "=", "arg_16", "break", "except", "KeyError", ":", "pass", "arg_17", "=", "'https://travis-ci.org/{}'", ".", "format", "(", "arg_4", ".", "full", ")", "arg_5", "[", "'contIntegration'", "]", "=", "arg_17", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2,\n                             arg_3):\n    \"\"\"Reduce a technote project's metadata from multiple sources into a\n    single JSON-LD resource.\n\n    Parameters\n    ----------\n    github_url : `str`\n        URL of the technote's GitHub repository.\n    metadata : `dict`\n        The parsed contents of ``metadata.yaml`` found in a technote's\n        repository.\n    github_data : `dict`\n        The contents of the ``technote_repo`` GitHub GraphQL API query.\n    ltd_product_data : `dict`\n        JSON dataset for the technote corresponding to the\n        ``/products/<product>`` of LTD Keeper.\n\n    Returns\n    -------\n    metadata : `dict`\n        JSON-LD-formatted dictionary.\n\n    .. `GitHub personal access token guide`: https://ls.st/41d\n    \"\"\"\n    arg_4 = parse_repo_slug_from_url(arg_0)\n\n    # Initialize a schema.org/Report and schema.org/SoftwareSourceCode\n    # linked data resource\n    arg_5 = {\n        '@context': [\n            \"https://raw.githubusercontent.com/codemeta/codemeta/2.0-rc/\"\n            \"codemeta.jsonld\",\n            \"http://schema.org\"],\n        '@type': ['Report', 'SoftwareSourceCode'],\n        'codeRepository': arg_0\n    }\n\n    if 'url' in arg_1:\n        arg_6 = arg_1['url']\n    elif 'published_url' in arg_3:\n        arg_6 = arg_3['published_url']\n    else:\n        raise RuntimeError('No identifying url could be found: '\n                           '{}'.format(arg_0))\n    arg_5['@id'] = arg_6\n    arg_5['url'] = arg_6\n\n    if 'series' in arg_1 and 'serial_number' in arg_1:\n        arg_5['reportNumber'] = '{series}-{serial_number}'.format(**arg_1)\n    else:\n        raise RuntimeError('No reportNumber: {}'.format(arg_0))\n\n    if 'doc_title' in arg_1:\n        arg_5['name'] = arg_1['doc_title']\n\n    if 'description' in arg_1:\n        arg_5['description'] = arg_1['description']\n\n    if 'authors' in arg_1:\n        arg_5['author'] = [{'@type': 'Person', 'name': author_name}\n                            for author_name in arg_1['authors']]\n\n    if 'last_revised' in arg_1:\n        # Prefer getting the 'last_revised' date from metadata.yaml\n        # since it's considered an override.\n        arg_5['dateModified'] = datetime.datetime.strptime(\n            arg_1['last_revised'],\n            '%Y-%m-%d')\n    else:\n        # Fallback to parsing the date of the last commit to the\n        # default branch on GitHub (usually `master`).\n        try:\n            arg_7 = arg_2['data']['repository']\n            arg_8 = arg_7['defaultBranchRef']\n            arg_5['dateModified'] = datetime.datetime.strptime(\n                arg_8['target']['committedDate'],\n                '%Y-%m-%dT%H:%M:%SZ')\n        except KeyError:\n            pass\n\n    try:\n        arg_9 = arg_2['data']['repository']['licenseInfo']\n        arg_10 = arg_9['spdxId']\n        if arg_10 is not None:\n            arg_11 = 'https://spdx.org/licenses/{}.html'.format(arg_10)\n            arg_5['license'] = arg_11\n    except KeyError:\n        pass\n\n    try:\n        # Find the README(|.md|.rst|*) file in the repo root\n        arg_8 = arg_2['data']['repository']['defaultBranchRef']\n        arg_12 = arg_8['target']['tree']['entries']\n        for arg_13 in arg_12:\n            arg_14 = arg_13['name']\n            arg_15 = arg_14.lower()\n            if arg_15.startswith('readme'):\n                arg_16 = make_raw_content_url(arg_4, 'master',\n                                                  arg_14)\n                arg_5['readme'] = arg_16\n                break\n    except KeyError:\n        pass\n\n    # Assume Travis is the CI service (always true at the moment)\n    arg_17 = 'https://travis-ci.org/{}'.format(arg_4.full)\n    arg_5['contIntegration'] = arg_17\n\n    return arg_5", "path": "lsstprojectmeta/lsstdocument/sphinxtechnotes.py", "identifier": "reduce_technote_metadata", "docstring": "Reduce a technote project's metadata from multiple sources into a\n    single JSON-LD resource.\n\n    Parameters\n    ----------\n    github_url : `str`\n        URL of the technote's GitHub repository.\n    metadata : `dict`\n        The parsed contents of ``metadata.yaml`` found in a technote's\n        repository.\n    github_data : `dict`\n        The contents of the ``technote_repo`` GitHub GraphQL API query.\n    ltd_product_data : `dict`\n        JSON dataset for the technote corresponding to the\n        ``/products/<product>`` of LTD Keeper.\n\n    Returns\n    -------\n    metadata : `dict`\n        JSON-LD-formatted dictionary.\n\n    .. `GitHub personal access token guide`: https://ls.st/41d", "docstring_tokens": ["Reduce", "a", "technote", "project", "s", "metadata", "from", "multiple", "sources", "into", "a", "single", "JSON", "-", "LD", "resource", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 258278}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/config.py#L415-L424", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Simply merge the older into the new one.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_0", ".", "new_config", "=", "Dict", "(", "Dict", "(", "arg_0", ".", "upstream_config", ")", ".", "merge", "(", "PyFunceble", ".", "CONFIGURATION", ")", ")", ".", "remove_key", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Simply merge the older into the new one.\n        \"\"\"\n\n        arg_1 = []\n\n        arg_0.new_config = Dict(\n            Dict(arg_0.upstream_config).merge(PyFunceble.CONFIGURATION)\n        ).remove_key(arg_1)", "path": "PyFunceble/config.py", "identifier": "Merge._merge_values", "docstring": "Simply merge the older into the new one.", "docstring_tokens": ["Simply", "merge", "the", "older", "into", "the", "new", "one", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 258279}
{"url": "https://github.com/BlockHub/django-ark/blob/424c3b4f258ba756aa63b2da185d0c0ef946f75f/ark/transactions.py#L43-L75", "sha": "424c3b4f258ba756aa63b2da185d0c0ef946f75f", "docstring_summary": "send a transaction immediately. Failed transactions are picked up by the TxBroadcaster", "language": "python", "parameters": "(self, use_open_peers=True, queue=True, **kw)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ",", "**", "arg_3", ")", ":", "if", "not", "arg_1", ":", "arg_4", "=", "arg_3", ".", "get", "(", "'ip'", ")", "arg_5", "=", "arg_3", ".", "get", "(", "'port'", ")", "arg_6", "=", "'http://{}:{}'", ".", "format", "(", "arg_4", ",", "arg_5", ")", "arg_7", "=", "arky", ".", "rest", ".", "POST", ".", "peer", ".", "transactions", "(", "arg_6", "=", "arg_6", ",", "transactions", "=", "[", "arg_0", ".", "tx", ".", "tx", "]", ")", "else", ":", "arg_7", "=", "arky", ".", "core", ".", "sendPayload", "(", "arg_0", ".", "tx", ".", "tx", ")", "if", "arg_0", ".", "tx", ".", "success", "!=", "'0.0%'", ":", "arg_0", ".", "tx", ".", "error", "=", "None", "arg_0", ".", "tx", ".", "success", "=", "True", "else", ":", "arg_0", ".", "tx", ".", "error", "=", "arg_7", "[", "'messages'", "]", "arg_0", ".", "tx", ".", "success", "=", "False", "arg_0", ".", "tx", ".", "tries", "+=", "1", "arg_0", ".", "tx", ".", "res", "=", "arg_7", "if", "arg_2", ":", "arg_0", ".", "tx", ".", "send", "=", "True", "arg_0", ".", "__save", "(", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=True, arg_2=True, **arg_3):\n        \"\"\"\n        send a transaction immediately. Failed transactions are picked up by the TxBroadcaster\n\n        :param ip: specific peer IP to send tx to\n        :param port: port of specific peer\n        :param use_open_peers: use Arky's broadcast method\n        \"\"\"\n\n        if not arg_1:\n            arg_4 = arg_3.get('ip')\n            arg_5 = arg_3.get('port')\n            arg_6 = 'http://{}:{}'.format(arg_4, arg_5)\n            arg_7 = arky.rest.POST.peer.transactions(arg_6=arg_6, transactions=[arg_0.tx.tx])\n\n        else:\n            arg_7 = arky.core.sendPayload(arg_0.tx.tx)\n\n        if arg_0.tx.success != '0.0%':\n            arg_0.tx.error = None\n            arg_0.tx.success = True\n        else:\n            arg_0.tx.error = arg_7['messages']\n            arg_0.tx.success = False\n\n        arg_0.tx.tries += 1\n        arg_0.tx.res = arg_7\n\n        if arg_2:\n            arg_0.tx.send = True\n\n        arg_0.__save()\n        return arg_7", "path": "ark/transactions.py", "identifier": "TX.send", "docstring": "send a transaction immediately. Failed transactions are picked up by the TxBroadcaster\n\n        :param ip: specific peer IP to send tx to\n        :param port: port of specific peer\n        :param use_open_peers: use Arky's broadcast method", "docstring_tokens": ["send", "a", "transaction", "immediately", ".", "Failed", "transactions", "are", "picked", "up", "by", "the", "TxBroadcaster"], "nwo": "BlockHub/django-ark", "score": 0.08529914490135834, "idx": 258280}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/server.py#L767-L782", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Start listening for incoming connections.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "service_info", "=", "ServiceInfo", "(", "'_webthing._tcp.local.'", ",", "'{}._webthing._tcp.local.'", ".", "format", "(", "arg_0", ".", "name", ")", ",", "address", "=", "socket", ".", "inet_aton", "(", "get_ip", "(", ")", ")", ",", "port", "=", "arg_0", ".", "port", ",", "properties", "=", "{", "'path'", ":", "'/'", ",", "}", ",", "server", "=", "'{}.local.'", ".", "format", "(", "socket", ".", "gethostname", "(", ")", ")", ")", "arg_0", ".", "zeroconf", "=", "Zeroconf", "(", ")", "arg_0", ".", "zeroconf", ".", "register_service", "(", "arg_0", ".", "service_info", ")", "arg_0", ".", "server", ".", "listen", "(", "arg_0", ".", "port", ")", "tornado", ".", "ioloop", ".", "IOLoop", ".", "current", "(", ")", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Start listening for incoming connections.\"\"\"\n        arg_0.service_info = ServiceInfo(\n            '_webthing._tcp.local.',\n            '{}._webthing._tcp.local.'.format(arg_0.name),\n            address=socket.inet_aton(get_ip()),\n            port=arg_0.port,\n            properties={\n                'path': '/',\n            },\n            server='{}.local.'.format(socket.gethostname()))\n        arg_0.zeroconf = Zeroconf()\n        arg_0.zeroconf.register_service(arg_0.service_info)\n\n        arg_0.server.listen(arg_0.port)\n        tornado.ioloop.IOLoop.current().Func()", "path": "webthing/server.py", "identifier": "WebThingServer.start", "docstring": "Start listening for incoming connections.", "docstring_tokens": ["Start", "listening", "for", "incoming", "connections", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 258281}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L922-L968", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Reconstruct ancestral sequences", "language": "python", "parameters": "(self, method='probabilistic', infer_gtr=False,\n                        marginal=False, **kwargs)", "return_statement": "return N_diff", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'probabilistic'", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "arg_0", ".", "logger", "(", "\"TreeAnc.infer_ancestral_sequences with method: %s, %s\"", "%", "(", "arg_1", ",", "'marginal'", "if", "arg_3", "else", "'joint'", ")", ",", "1", ")", "if", "(", "arg_0", ".", "tree", "is", "None", ")", "or", "(", "arg_0", ".", "aln", "is", "None", ")", ":", "arg_0", ".", "logger", "(", "\"TreeAnc.infer_ancestral_sequences: ERROR, alignment or tree are missing\"", ",", "0", ")", "return", "ttconf", ".", "ERROR", "if", "arg_1", "in", "[", "'ml'", ",", "'probabilistic'", "]", ":", "if", "arg_3", ":", "arg_5", "=", "arg_0", ".", "_ml_anc_marginal", "else", ":", "arg_5", "=", "arg_0", ".", "_ml_anc_joint", "else", ":", "arg_5", "=", "arg_0", ".", "_fitch_anc", "if", "arg_2", ":", "arg_6", "=", "arg_0", ".", "infer_gtr", "(", "arg_3", "=", "arg_3", ",", "**", "arg_4", ")", "if", "arg_6", "==", "ttconf", ".", "ERROR", ":", "return", "arg_6", "arg_7", "=", "arg_5", "(", "**", "arg_4", ")", "else", ":", "arg_7", "=", "arg_5", "(", "**", "arg_4", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1='probabilistic', arg_2=False,\n                        arg_3=False, **arg_4):\n        \"\"\"Reconstruct ancestral sequences\n\n        Parameters\n        ----------\n        method : str\n           Method to use. Supported values are \"fitch\" and \"ml\"\n\n        infer_gtr : bool\n           Infer a GTR model before reconstructing the sequences\n\n        marginal : bool\n           Assign sequences that are most likely after averaging over all other nodes\n           instead of the jointly most likely sequences.\n        **kwargs\n            additional keyword arguments that are passed down to :py:meth:`TreeAnc.infer_gtr` and :py:meth:`TreeAnc._ml_anc`\n\n        Returns\n        -------\n        N_diff : int\n           Number of nucleotides different from the previous\n           reconstruction.  If there were no pre-set sequences, returns N*L\n\n        \"\"\"\n        arg_0.logger(\"TreeAnc.infer_ancestral_sequences with method: %s, %s\"%(arg_1, 'marginal' if arg_3 else 'joint'), 1)\n        if (arg_0.tree is None) or (arg_0.aln is None):\n            arg_0.logger(\"TreeAnc.infer_ancestral_sequences: ERROR, alignment or tree are missing\", 0)\n            return ttconf.ERROR\n\n        if arg_1 in ['ml', 'probabilistic']:\n            if arg_3:\n                arg_5 = arg_0._ml_anc_marginal\n            else:\n                arg_5 = arg_0._ml_anc_joint\n        else:\n            arg_5 = arg_0._fitch_anc\n\n        if arg_2:\n            arg_6 = arg_0.infer_gtr(arg_3=arg_3, **arg_4)\n            if arg_6==ttconf.ERROR:\n                return arg_6\n            arg_7 = arg_5(**arg_4)\n        else:\n            arg_7 = arg_5(**arg_4)\n\n        return arg_7", "path": "treetime/treeanc.py", "identifier": "TreeAnc.reconstruct_anc", "docstring": "Reconstruct ancestral sequences\n\n        Parameters\n        ----------\n        method : str\n           Method to use. Supported values are \"fitch\" and \"ml\"\n\n        infer_gtr : bool\n           Infer a GTR model before reconstructing the sequences\n\n        marginal : bool\n           Assign sequences that are most likely after averaging over all other nodes\n           instead of the jointly most likely sequences.\n        **kwargs\n            additional keyword arguments that are passed down to :py:meth:`TreeAnc.infer_gtr` and :py:meth:`TreeAnc._ml_anc`\n\n        Returns\n        -------\n        N_diff : int\n           Number of nucleotides different from the previous\n           reconstruction.  If there were no pre-set sequences, returns N*L", "docstring_tokens": ["Reconstruct", "ancestral", "sequences"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 258282}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/network/queue_network.py#L1605-L1636", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Used to specify edge indices from different types of arguments.", "language": "python", "parameters": "(g, queues, edge, edge_type)", "return_statement": "return queues", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "numbers", ".", "Integral", "if", "isinstance", "(", "arg_1", ",", "arg_4", ")", ":", "arg_1", "=", "[", "arg_1", "]", "elif", "arg_1", "is", "None", ":", "if", "arg_2", "is", "not", "None", ":", "if", "isinstance", "(", "arg_2", ",", "tuple", ")", ":", "if", "isinstance", "(", "arg_2", "[", "0", "]", ",", "arg_4", ")", "and", "isinstance", "(", "arg_2", "[", "1", "]", ",", "arg_4", ")", ":", "arg_1", "=", "[", "arg_0", ".", "edge_index", "[", "arg_2", "]", "]", "elif", "isinstance", "(", "arg_2", "[", "0", "]", ",", "collections", ".", "Iterable", ")", ":", "if", "np", ".", "array", "(", "[", "len", "(", "arg_5", ")", "==", "2", "for", "arg_5", "in", "arg_2", "]", ")", ".", "all", "(", ")", ":", "arg_1", "=", "[", "arg_0", ".", "edge_index", "[", "arg_5", "]", "for", "arg_5", "in", "arg_2", "]", "else", ":", "arg_1", "=", "[", "arg_0", ".", "edge_index", "[", "arg_2", "]", "]", "elif", "arg_3", "is", "not", "None", ":", "if", "isinstance", "(", "arg_3", ",", "collections", ".", "Iterable", ")", ":", "arg_3", "=", "set", "(", "arg_3", ")", "else", ":", "arg_3", "=", "set", "(", "[", "arg_3", "]", ")", "arg_6", "=", "[", "]", "for", "arg_5", "in", "arg_0", ".", "edges", "(", ")", ":", "if", "arg_0", ".", "ep", "(", "arg_5", ",", "'edge_type'", ")", "in", "arg_3", ":", "arg_6", ".", "append", "(", "arg_0", ".", "edge_index", "[", "arg_5", "]", ")", "arg_1", "=", "np", ".", "array", "(", "arg_6", ",", "int", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "range", "(", "arg_0", ".", "number_of_edges", "(", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Used to specify edge indices from different types of arguments.\"\"\"\n    arg_4 = numbers.Integral\n    if isinstance(arg_1, arg_4):\n        arg_1 = [arg_1]\n\n    elif arg_1 is None:\n        if arg_2 is not None:\n            if isinstance(arg_2, tuple):\n                if isinstance(arg_2[0], arg_4) and isinstance(arg_2[1], arg_4):\n                    arg_1 = [arg_0.edge_index[arg_2]]\n            elif isinstance(arg_2[0], collections.Iterable):\n                if np.array([len(arg_5) == 2 for arg_5 in arg_2]).all():\n                    arg_1 = [arg_0.edge_index[arg_5] for arg_5 in arg_2]\n            else:\n                arg_1 = [arg_0.edge_index[arg_2]]\n        elif arg_3 is not None:\n            if isinstance(arg_3, collections.Iterable):\n                arg_3 = set(arg_3)\n            else:\n                arg_3 = set([arg_3])\n            arg_6 = []\n            for arg_5 in arg_0.edges():\n                if arg_0.ep(arg_5, 'edge_type') in arg_3:\n                    arg_6.append(arg_0.edge_index[arg_5])\n\n            arg_1 = np.array(arg_6, int)\n\n        if arg_1 is None:\n            arg_1 = range(arg_0.number_of_edges())\n\n    return arg_1", "path": "queueing_tool/network/queue_network.py", "identifier": "_get_queues", "docstring": "Used to specify edge indices from different types of arguments.", "docstring_tokens": ["Used", "to", "specify", "edge", "indices", "from", "different", "types", "of", "arguments", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 258283}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L898-L900", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check that a binary operator is surrounded by exactly one space.", "language": "python", "parameters": "(self, tokens, i)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_check_space", "(", "arg_1", ",", "arg_2", ",", "(", "_MUST", ",", "_MUST", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check that a binary operator is surrounded by exactly one space.\"\"\"\n        arg_0._check_space(arg_1, arg_2, (_MUST, _MUST))", "path": "pylint/checkers/format.py", "identifier": "FormatChecker._check_surrounded_by_space", "docstring": "Check that a binary operator is surrounded by exactly one space.", "docstring_tokens": ["Check", "that", "a", "binary", "operator", "is", "surrounded", "by", "exactly", "one", "space", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258284}
{"url": "https://github.com/addok/addok/blob/46a270d76ec778d2b445c2be753e5c6ba070a9b2/addok/shell.py#L342-L360", "sha": "46a270d76ec778d2b445c2be753e5c6ba070a9b2", "docstring_summary": "Get document from index with its id.\n        GET 772210180J", "language": "python", "parameters": "(self, _id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "doc_by_id", "(", "arg_1", ")", "if", "not", "arg_2", ":", "return", "arg_0", ".", "error", "(", "'id \"{}\" not found'", ".", "format", "(", "arg_1", ")", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "if", "arg_3", "==", "config", ".", "HOUSENUMBERS_FIELD", ":", "continue", "print", "(", "'{} {}'", ".", "format", "(", "white", "(", "arg_3", ")", ",", "magenta", "(", "arg_4", ")", ")", ")", "if", "arg_2", ".", "get", "(", "'housenumbers'", ")", ":", "def", "sorter", "(", "arg_5", ")", ":", "try", ":", "return", "int", "(", "re", ".", "match", "(", "r'^\\d+'", ",", "arg_5", "[", "'raw'", "]", ")", ".", "group", "(", ")", ")", "except", "AttributeError", ":", "return", "-", "1", "arg_6", "=", "sorted", "(", "arg_2", "[", "'housenumbers'", "]", ".", "values", "(", ")", ",", "arg_3", "=", "sorter", ")", "print", "(", "white", "(", "'housenumbers'", ")", ",", "magenta", "(", "', '", ".", "join", "(", "arg_5", "[", "'raw'", "]", "for", "arg_5", "in", "arg_6", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get document from index with its id.\n        GET 772210180J\"\"\"\n        arg_2 = doc_by_id(arg_1)\n        if not arg_2:\n            return arg_0.error('id \"{}\" not found'.format(arg_1))\n        for arg_3, arg_4 in arg_2.items():\n            if arg_3 == config.HOUSENUMBERS_FIELD:\n                continue\n            print('{} {}'.format(white(arg_3), magenta(arg_4)))\n        if arg_2.get('housenumbers'):\n            def sorter(arg_5):\n                try:\n                    return int(re.match(r'^\\d+', arg_5['raw']).group())\n                except AttributeError:\n                    return -1\n            arg_6 = sorted(arg_2['housenumbers'].values(), arg_3=sorter)\n            print(white('housenumbers'),\n                  magenta(', '.join(arg_5['raw'] for arg_5 in arg_6)))", "path": "addok/shell.py", "identifier": "Cmd.do_GET", "docstring": "Get document from index with its id.\n        GET 772210180J", "docstring_tokens": ["Get", "document", "from", "index", "with", "its", "id", ".", "GET", "772210180J"], "nwo": "addok/addok", "score": 0.5575306264469764, "idx": 258285}
{"url": "https://github.com/Music-Moo/music2storage/blob/de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2/music2storage/__init__.py#L70-L88", "sha": "de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2", "docstring_summary": "Creates and starts the workers, as well as attaching a handler to terminate them gracefully when a SIGINT signal is received.", "language": "python", "parameters": "(self, workers_per_task=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "if", "not", "arg_0", ".", "workers", ":", "for", "arg_2", "in", "range", "(", "arg_1", ")", ":", "arg_0", ".", "workers", ".", "append", "(", "Worker", "(", "arg_0", ".", "_download", ",", "arg_0", ".", "queues", "[", "'download'", "]", ",", "arg_0", ".", "queues", "[", "'convert'", "]", ",", "arg_0", ".", "stopper", ")", ")", "arg_0", ".", "workers", ".", "append", "(", "Worker", "(", "arg_0", ".", "_convert", ",", "arg_0", ".", "queues", "[", "'convert'", "]", ",", "arg_0", ".", "queues", "[", "'upload'", "]", ",", "arg_0", ".", "stopper", ")", ")", "arg_0", ".", "workers", ".", "append", "(", "Worker", "(", "arg_0", ".", "_upload", ",", "arg_0", ".", "queues", "[", "'upload'", "]", ",", "arg_0", ".", "queues", "[", "'delete'", "]", ",", "arg_0", ".", "stopper", ")", ")", "arg_0", ".", "workers", ".", "append", "(", "Worker", "(", "arg_0", ".", "_delete", ",", "arg_0", ".", "queues", "[", "'delete'", "]", ",", "arg_0", ".", "queues", "[", "'done'", "]", ",", "arg_0", ".", "stopper", ")", ")", "arg_0", ".", "signal_handler", "=", "SignalHandler", "(", "arg_0", ".", "workers", ",", "arg_0", ".", "stopper", ")", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "arg_0", ".", "signal_handler", ")", "for", "arg_4", "in", "arg_0", ".", "workers", ":", "arg_4", ".", "start", "(", ")"], "function": "def Func(arg_0, arg_1=1):\n        \"\"\"\n        Creates and starts the workers, as well as attaching a handler to terminate them gracefully when a SIGINT signal is received.\n\n        :param int workers_per_task: Number of workers to create for each task in the pipeline\n        \"\"\"\n\n        if not arg_0.workers:\n            for arg_2 in range(arg_1):\n                arg_0.workers.append(Worker(arg_0._download, arg_0.queues['download'], arg_0.queues['convert'], arg_0.stopper))\n                arg_0.workers.append(Worker(arg_0._convert, arg_0.queues['convert'], arg_0.queues['upload'], arg_0.stopper))\n                arg_0.workers.append(Worker(arg_0._upload, arg_0.queues['upload'], arg_0.queues['delete'], arg_0.stopper))\n                arg_0.workers.append(Worker(arg_0._delete, arg_0.queues['delete'], arg_0.queues['done'], arg_0.stopper))\n\n            arg_0.signal_handler = SignalHandler(arg_0.workers, arg_0.stopper)\n            signal.signal(signal.SIGINT, arg_0.signal_handler)\n\n            for arg_4 in arg_0.workers:\n                arg_4.start()", "path": "music2storage/__init__.py", "identifier": "Music2Storage.start_workers", "docstring": "Creates and starts the workers, as well as attaching a handler to terminate them gracefully when a SIGINT signal is received.\n\n        :param int workers_per_task: Number of workers to create for each task in the pipeline", "docstring_tokens": ["Creates", "and", "starts", "the", "workers", "as", "well", "as", "attaching", "a", "handler", "to", "terminate", "them", "gracefully", "when", "a", "SIGINT", "signal", "is", "received", "."], "nwo": "Music-Moo/music2storage", "score": 0.23137166388621372, "idx": 258286}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L131-L145", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Stop this Tracer.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "Funcped", "=", "True", "if", "arg_0", ".", "thread", "!=", "threading", ".", "currentThread", "(", ")", ":", "return", "if", "hasattr", "(", "sys", ",", "\"gettrace\"", ")", "and", "arg_0", ".", "warn", ":", "if", "sys", ".", "gettrace", "(", ")", "!=", "arg_0", ".", "_trace", ":", "arg_2", "=", "\"Trace function changed, measurement is likely wrong: %r\"", "arg_0", ".", "warn", "(", "arg_2", "%", "(", "sys", ".", "gettrace", "(", ")", ",", ")", ")", "sys", ".", "settrace", "(", "None", ")"], "function": "def Func(arg_0):\n        \"\"\"Stop this Tracer.\"\"\"\n        arg_0.Funcped = True\n        if arg_0.thread != threading.currentThread():\n            # Called on a different thread than started us: we can't unhook\n            # ourseves, but we've set the flag that we should Func, so we won't\n            # do any more tracing.\n            return\n\n        if hasattr(sys, \"gettrace\") and arg_0.warn:\n            if sys.gettrace() != arg_0._trace:\n                arg_2 = \"Trace function changed, measurement is likely wrong: %r\"\n                arg_0.warn(arg_2 % (sys.gettrace(),))\n        #print(\"Stopping tracer on %s\" % threading.current_thread().ident)\n        sys.settrace(None)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py", "identifier": "PyTracer.stop", "docstring": "Stop this Tracer.", "docstring_tokens": ["Stop", "this", "Tracer", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258287}
{"url": "https://github.com/jgorset/django-kronos/blob/82ca16f5d499de3d34e0677e64ffab62d45424ce/kronos/__init__.py#L25-L45", "sha": "82ca16f5d499de3d34e0677e64ffab62d45424ce", "docstring_summary": "Load ``cron`` modules for applications listed in ``INSTALLED_APPS``.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "autodiscover_modules", "(", "'cron'", ")", "if", "PROJECT_MODULE", ":", "if", "'.'", "in", "PROJECT_MODULE", ".", "__name__", ":", "try", ":", "import_module", "(", "'%s.cron'", "%", "'.'", ".", "join", "(", "PROJECT_MODULE", ".", "__name__", ".", "split", "(", "'.'", ")", "[", "0", ":", "-", "1", "]", ")", ")", "except", "ImportError", "as", "e", ":", "if", "'No module named'", "not", "in", "str", "(", "e", ")", ":", "print", "(", "e", ")", "for", "arg_0", ",", "arg_1", "in", "get_commands", "(", ")", ".", "items", "(", ")", ":", "try", ":", "Func_command_class", "(", "arg_1", ",", "arg_0", ")", "except", "django", ".", "core", ".", "exceptions", ".", "ImproperlyConfigured", ":", "pass"], "function": "def Func():\n    \"\"\"\n    Load ``cron`` modules for applications listed in ``INSTALLED_APPS``.\n    \"\"\"\n    autodiscover_modules('cron')\n\n    if PROJECT_MODULE:\n        if '.' in PROJECT_MODULE.__name__:\n            try:\n                import_module('%s.cron' % '.'.join(\n                    PROJECT_MODULE.__name__.split('.')[0:-1]))\n            except ImportError as e:\n                if 'No module named' not in str(e):\n                    print(e)\n\n    # Func django tasks\n    for arg_0, arg_1 in get_commands().items():\n        try:\n            Func_command_class(arg_1, arg_0)\n        except django.core.exceptions.ImproperlyConfigured:\n            pass", "path": "kronos/__init__.py", "identifier": "load", "docstring": "Load ``cron`` modules for applications listed in ``INSTALLED_APPS``.", "docstring_tokens": ["Load", "cron", "modules", "for", "applications", "listed", "in", "INSTALLED_APPS", "."], "nwo": "jgorset/django-kronos", "score": 0.3475875463574958, "idx": 258288}
{"url": "https://github.com/kejbaly2/comdev/blob/5a9067d3c1ae46eeccb9d36e8c231ea5224b42b4/comdev/rss_lib.py#L37-L61", "sha": "5a9067d3c1ae46eeccb9d36e8c231ea5224b42b4", "docstring_summary": "Rip the events from a given rss feed, normalize the data and store.", "language": "python", "parameters": "(ctx, url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "load_feed", "(", "arg_1", ")", "arg_3", "=", "arg_2", "[", "'feed'", "]", "arg_4", "=", "arg_2", "[", "'entries'", "]", "arg_5", "=", "'community'", "arg_6", "=", "'Czech Republic'", "for", "arg_7", "in", "arg_4", ":", "arg_8", "=", "sluggify", "(", "arg_7", "[", "'id'", "]", ")", "arg_9", "=", "arg_7", "[", "'tags'", "]", "[", "0", "]", "[", "'term'", "]", "arg_10", "=", "arg_7", "[", "'link'", "]", "arg_11", "=", "dt_normalize", "(", "arg_7", "[", "'published_parsed'", "]", ",", "local_tz", "=", "True", ")", "arg_12", "=", "arg_7", "[", "'title'", "]", "arg_13", "=", "arg_7", "[", "'summary'", "]", "arg_14", "=", "arg_7", "[", "'link'", "]", "ipdb", ".", "set_trace", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Rip the events from a given rss feed, normalize the data and store.\n    \"\"\"\n    arg_2 = load_feed(arg_1)\n\n    arg_3 = arg_2['feed']\n    arg_4 = arg_2['entries']\n\n    # THIS IS SPECIFIC TO # http://konfery.cz/rss/\n\n    arg_5 = 'community'\n    arg_6 = 'Czech Republic'\n    # title, title_detail, links, link, published, summary, tags\n    # unused: summary_detail, guidislink, published_parsed\n    for arg_7 in arg_4:\n        arg_8 = sluggify(arg_7['id'])\n        arg_9 = arg_7['tags'][0]['term']\n        arg_10 = arg_7['link']\n        arg_11 = dt_normalize(arg_7['published_parsed'], local_tz=True)\n        arg_12 = arg_7['title']\n        arg_13 = arg_7['summary']\n        arg_14 = arg_7['link']\n\n        ipdb.set_trace()", "path": "comdev/rss_lib.py", "identifier": "scrape", "docstring": "Rip the events from a given rss feed, normalize the data and store.", "docstring_tokens": ["Rip", "the", "events", "from", "a", "given", "rss", "feed", "normalize", "the", "data", "and", "store", "."], "nwo": "kejbaly2/comdev", "score": 0.08529914490135834, "idx": 258289}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/data.py#L137-L139", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Read the coverage data from `filename`.", "language": "python", "parameters": "(self, filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "lines", ",", "arg_0", ".", "arcs", "=", "arg_0", ".", "_Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read the coverage data from `filename`.\"\"\"\n        arg_0.lines, arg_0.arcs = arg_0._Func(arg_1)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/data.py", "identifier": "CoverageData.read_file", "docstring": "Read the coverage data from `filename`.", "docstring_tokens": ["Read", "the", "coverage", "data", "from", "filename", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258290}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/trainers/utils.py#L41-L47", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Prettifies the dictionary of metrics.", "language": "python", "parameters": "(metrics: List[Tuple[str, float]], precision: int = 4)", "return_statement": "return prettified_metrics", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "[", "arg_3", ",", "arg_4", "]", "]", ",", "arg_5", ":", "arg_6", "=", "4", ")", "->", "OrderedDict", ":", "arg_7", "=", "OrderedDict", "(", ")", "for", "arg_8", ",", "arg_9", "in", "arg_0", ":", "arg_9", "=", "round", "(", "arg_9", ",", "arg_5", ")", "arg_7", "[", "arg_8", "]", "=", "arg_9", "return", "arg_7"], "function": "def Func(arg_0: arg_1[arg_2[arg_3, arg_4]], arg_5: arg_6 = 4) -> OrderedDict:\n    \"\"\"Prettifies the dictionary of metrics.\"\"\"\n    arg_7 = OrderedDict()\n    for arg_8, arg_9 in arg_0:\n        arg_9 = round(arg_9, arg_5)\n        arg_7[arg_8] = arg_9\n    return arg_7", "path": "deeppavlov/core/trainers/utils.py", "identifier": "prettify_metrics", "docstring": "Prettifies the dictionary of metrics.", "docstring_tokens": ["Prettifies", "the", "dictionary", "of", "metrics", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 258291}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L260-L270", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Return the length of the indentation on the given token's line.", "language": "python", "parameters": "(line)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", "==", "\" \"", ":", "arg_1", "+=", "1", "elif", "arg_2", "==", "\"\\t\"", ":", "arg_1", "+=", "_TAB_LENGTH", "else", ":", "break", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return the length of the indentation on the given token's line.\"\"\"\n    arg_1 = 0\n    for arg_2 in arg_0:\n        if arg_2 == \" \":\n            arg_1 += 1\n        elif arg_2 == \"\\t\":\n            arg_1 += _TAB_LENGTH\n        else:\n            break\n    return arg_1", "path": "pylint/checkers/format.py", "identifier": "_get_indent_length", "docstring": "Return the length of the indentation on the given token's line.", "docstring_tokens": ["Return", "the", "length", "of", "the", "indentation", "on", "the", "given", "token", "s", "line", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258292}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/combine.py#L332-L344", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Check if files in input file list have the same number of channels", "language": "python", "parameters": "(input_filepath_list, combine_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "file_info", ".", "channels", "(", "f", ")", "for", "f", "in", "arg_0", "]", "if", "not", "core", ".", "all_equal", "(", "arg_2", ")", ":", "raise", "IOError", "(", "\"Input files do not have the same number of channels. The \"", "\"{} combine type requires that all files have the same \"", "\"number of channels\"", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n    ''' Check if files in input file list have the same number of channels\n    '''\n    arg_2 = [\n        file_info.channels(f) for f in arg_0\n    ]\n    if not core.all_equal(arg_2):\n        raise IOError(\n            \"Input files do not have the same number of channels. The \"\n            \"{} combine type requires that all files have the same \"\n            \"number of channels\"\n            .format(arg_1)\n        )", "path": "sox/combine.py", "identifier": "_validate_num_channels", "docstring": "Check if files in input file list have the same number of channels", "docstring_tokens": ["Check", "if", "files", "in", "input", "file", "list", "have", "the", "same", "number", "of", "channels"], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 258293}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L180-L188", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Create physics bodies corresponding to each marker in our data.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "bodies", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "channels", ":", "arg_3", "=", "arg_0", ".", "world", ".", "create_body", "(", "'sphere'", ",", "name", "=", "'marker:{}'", ".", "format", "(", "arg_2", ")", ",", "radius", "=", "0.02", ")", "arg_3", ".", "is_kinematic", "=", "True", "arg_3", ".", "color", "=", "0.9", ",", "0.1", ",", "0.1", ",", "0.5", "arg_0", ".", "bodies", "[", "arg_2", "]", "=", "arg_3"], "function": "def Func(arg_0):\n        '''Create physics bodies corresponding to each marker in our data.'''\n        arg_0.bodies = {}\n        for arg_2 in arg_0.channels:\n            arg_3 = arg_0.world.create_body(\n                'sphere', name='marker:{}'.format(arg_2), radius=0.02)\n            arg_3.is_kinematic = True\n            arg_3.color = 0.9, 0.1, 0.1, 0.5\n            arg_0.bodies[arg_2] = arg_3", "path": "pagoda/cooper.py", "identifier": "Markers.create_bodies", "docstring": "Create physics bodies corresponding to each marker in our data.", "docstring_tokens": ["Create", "physics", "bodies", "corresponding", "to", "each", "marker", "in", "our", "data", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 258294}
{"url": "https://github.com/grampajoe/happy/blob/707e056eb033ea010d181f5fab8d44e129ea9906/happy/cli.py#L106-L135", "sha": "707e056eb033ea010d181f5fab8d44e129ea9906", "docstring_summary": "Brings down a Heroku app.", "language": "python", "parameters": "(auth_token, force, app_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_2", ":", "click", ".", "echo", "(", "'WARNING: Inferring the app name when deleting is deprecated. '", "'Starting with happy 2.0, the app_name parameter will be required.'", ")", "arg_2", "=", "arg_2", "or", "_read_app_name", "(", ")", "if", "not", "arg_2", ":", "click", ".", "echo", "(", "'No app name given.'", ")", "sys", ".", "exit", "(", "1", ")", "if", "not", "arg_1", ":", "click", ".", "confirm", "(", "'Are you sure you want to delete %s?'", "%", "arg_2", ",", "abort", "=", "True", ",", ")", "arg_3", "=", "Happy", "(", "arg_0", "=", "arg_0", ")", "click", ".", "echo", "(", "'Destroying app %s... '", "%", "arg_2", ",", "nl", "=", "False", ")", "arg_3", ".", "delete", "(", "arg_2", "=", "arg_2", ")", "_delete_app_name_file", "(", ")", "click", ".", "echo", "(", "'done'", ")", "click", ".", "echo", "(", "\"It's Func. :(\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Brings Func a Heroku app.\"\"\"\n    if not arg_2:\n        click.echo(\n            'WARNING: Inferring the app name when deleting is deprecated. '\n            'Starting with happy 2.0, the app_name parameter will be required.'\n        )\n\n    arg_2 = arg_2 or _read_app_name()\n\n    if not arg_2:\n        click.echo('No app name given.')\n        sys.exit(1)\n\n    if not arg_1:\n        click.confirm(\n            'Are you sure you want to delete %s?' % arg_2,\n            abort=True,\n        )\n\n    arg_3 = Happy(arg_0=arg_0)\n\n    click.echo('Destroying app %s... ' % arg_2, nl=False)\n\n    arg_3.delete(arg_2=arg_2)\n\n    _delete_app_name_file()\n\n    click.echo('done')\n    click.echo(\"It's Func. :(\")", "path": "happy/cli.py", "identifier": "down", "docstring": "Brings down a Heroku app.", "docstring_tokens": ["Brings", "down", "a", "Heroku", "app", "."], "nwo": "grampajoe/happy", "score": 0.12050106452410352, "idx": 258295}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_styles.py#L120-L143", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Renders a javascript snippet suitable for use as a mapbox-gl line paint entry", "language": "python", "parameters": "(self)", "return_statement": "return snippet", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'line-opacity'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "opacity", ")", ",", "'line-color'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "color", ")", ",", "'line-width'", ":", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "width", ")", ",", "}", "if", "arg_0", ".", "translate", ":", "arg_1", "[", "'line-translate'", "]", "=", "arg_0", ".", "translate", "if", "arg_0", ".", "dasharray", ":", "arg_1", "[", "'line-dasharray'", "]", "=", "VectorStyle", ".", "get_style_value", "(", "arg_0", ".", "dasharray", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Renders a javascript snippet suitable for use as a mapbox-gl line Func entry\n\n        Returns:\n            A dict that can be converted to a mapbox-gl javascript Func snippet\n        \"\"\"\n        # TODO Figure out why i cant use some of these props\n        arg_1 = {\n            'line-opacity': VectorStyle.get_style_value(arg_0.opacity),\n            'line-color': VectorStyle.get_style_value(arg_0.color),\n            #'line-cap': self.cap,\n            #'line-join': self.join,\n            'line-width': VectorStyle.get_style_value(arg_0.width),\n            #'line-gap-width': self.gap_width,\n            #'line-blur': self.blur,\n        }\n        if arg_0.translate:\n            arg_1['line-translate'] = arg_0.translate\n\n        if arg_0.dasharray:\n            arg_1['line-dasharray'] = VectorStyle.get_style_value(arg_0.dasharray)\n\n        return arg_1", "path": "gbdxtools/vector_styles.py", "identifier": "LineStyle.paint", "docstring": "Renders a javascript snippet suitable for use as a mapbox-gl line paint entry\n\n        Returns:\n            A dict that can be converted to a mapbox-gl javascript paint snippet", "docstring_tokens": ["Renders", "a", "javascript", "snippet", "suitable", "for", "use", "as", "a", "mapbox", "-", "gl", "line", "paint", "entry"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 258296}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L840-L853", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Save Model Details of an H2O Model in JSON Format to disk.", "language": "python", "parameters": "(self, path=\"\", force=False)", "return_statement": "return h2o.api(\"GET /99/Models/%s/json\" % self.model_id, data={\"dir\": path, \"force\": force})[\"dir\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "False", ")", ":", "assert_is_type", "(", "arg_1", ",", "str", ")", "assert_is_type", "(", "arg_2", ",", "bool", ")", "arg_1", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", "if", "arg_1", "==", "\"\"", "else", "arg_1", ",", "arg_0", ".", "model_id", "+", "\".json\"", ")", "return", "h2o", ".", "api", "(", "\"GET /99/Models/%s/json\"", "%", "arg_0", ".", "model_id", ",", "data", "=", "{", "\"dir\"", ":", "arg_1", ",", "\"force\"", ":", "arg_2", "}", ")", "[", "\"dir\"", "]"], "function": "def Func(arg_0, arg_1=\"\", arg_2=False):\n        \"\"\"\n        Save Model Details of an H2O Model in JSON Format to disk.\n\n        :param model: The model object to save.\n        :param path: a path to save the model details at (hdfs, s3, local)\n        :param force: if True overwrite destination directory in case it exists, or throw exception if set to False.\n\n        :returns str: the path of the saved model details\n        \"\"\"\n        assert_is_type(arg_1, str)\n        assert_is_type(arg_2, bool)\n        arg_1 = os.path.join(os.getcwd() if arg_1 == \"\" else arg_1, arg_0.model_id + \".json\")\n        return h2o.api(\"GET /99/Models/%s/json\" % arg_0.model_id, data={\"dir\": arg_1, \"force\": arg_2})[\"dir\"]", "path": "h2o-py/h2o/model/model_base.py", "identifier": "ModelBase.save_model_details", "docstring": "Save Model Details of an H2O Model in JSON Format to disk.\n\n        :param model: The model object to save.\n        :param path: a path to save the model details at (hdfs, s3, local)\n        :param force: if True overwrite destination directory in case it exists, or throw exception if set to False.\n\n        :returns str: the path of the saved model details", "docstring_tokens": ["Save", "Model", "Details", "of", "an", "H2O", "Model", "in", "JSON", "Format", "to", "disk", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258297}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L875-L882", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "use the GUI to pop up a message.", "language": "python", "parameters": "(title,msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tkinter", ".", "Tk", "(", ")", "arg_2", ".", "withdraw", "(", ")", "arg_2", ".", "attributes", "(", "\"-topmost\"", ",", "True", ")", "arg_2", ".", "lift", "(", ")", "tkinter", ".", "messagebox", ".", "showwarning", "(", "arg_0", ",", "arg_1", ")", "arg_2", ".", "destroy", "(", ")"], "function": "def Func(arg_0,arg_1):\n    \"\"\"use the GUI to pop up a message.\"\"\"\n    arg_2 = tkinter.Tk()\n    arg_2.withdraw() #hide tk window\n    arg_2.attributes(\"-topmost\", True) #always on top\n    arg_2.lift() #bring to top\n    tkinter.messagebox.showwarning(arg_0, arg_1)\n    arg_2.destroy()", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "TK_message", "docstring": "use the GUI to pop up a message.", "docstring_tokens": ["use", "the", "GUI", "to", "pop", "up", "a", "message", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 258298}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L1026-L1061", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "uses results from marginal ancestral inference to return a joint\n        distribution of the sequence states at both ends of the branch.", "language": "python", "parameters": "(self, node, full_sequence=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "marginal_branch_profile", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "gtr", ".", "expQt", "(", "arg_0", ".", "_branch_length_to_gtr", "(", "arg_1", ")", ")", "if", "len", "(", "arg_5", ".", "shape", ")", "==", "3", ":", "arg_6", "=", "np", ".", "einsum", "(", "'ai,aj,ija->aij'", ",", "arg_4", ",", "arg_3", ",", "arg_5", ")", "else", ":", "arg_6", "=", "np", ".", "einsum", "(", "'ai,aj,ij->aij'", ",", "arg_4", ",", "arg_3", ",", "arg_5", ")", "arg_7", "=", "arg_6", ".", "sum", "(", "axis", "=", "2", ")", ".", "sum", "(", "axis", "=", "1", ")", "arg_6", "=", "np", ".", "einsum", "(", "'aij,a->aij'", ",", "arg_6", ",", "1.0", "/", "arg_7", ")", "if", "arg_2", ":", "return", "arg_6", "[", "arg_0", ".", "full_to_reduced_sequence_map", "]", "else", ":", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"uses results from marginal ancestral inference to return a joint\n        distribution of the sequence states at both ends of the branch.\n\n        Parameters\n        ----------\n        node : Phylo.clade\n            node of the tree\n        full_sequence : bool, optional\n            expand the sequence to the full sequence, if false (default)\n            the there will be one mutation matrix for each column in the\n            reduced alignment\n\n        Returns\n        -------\n        numpy.array\n            an Lxqxq stack of matrices (q=alphabet size, L (reduced)sequence length)\n        \"\"\"\n        arg_3,arg_4 = arg_0.marginal_branch_profile(arg_1)\n\n        # calculate pc_i [e^Qt]_ij pp_j for each site\n        arg_5 = arg_0.gtr.expQt(arg_0._branch_length_to_gtr(arg_1))\n        if len(arg_5.shape)==3: # site specific model\n            arg_6 = np.einsum('ai,aj,ija->aij', arg_4, arg_3, arg_5)\n        else:\n            arg_6 = np.einsum('ai,aj,ij->aij', arg_4, arg_3, arg_5)\n\n        # normalize this distribution\n        arg_7 = arg_6.sum(axis=2).sum(axis=1)\n        arg_6 = np.einsum('aij,a->aij', arg_6, 1.0/arg_7)\n\n        # expand to full sequence if requested\n        if arg_2:\n            return arg_6[arg_0.full_to_reduced_sequence_map]\n        else:\n            return arg_6", "path": "treetime/treeanc.py", "identifier": "TreeAnc.get_branch_mutation_matrix", "docstring": "uses results from marginal ancestral inference to return a joint\n        distribution of the sequence states at both ends of the branch.\n\n        Parameters\n        ----------\n        node : Phylo.clade\n            node of the tree\n        full_sequence : bool, optional\n            expand the sequence to the full sequence, if false (default)\n            the there will be one mutation matrix for each column in the\n            reduced alignment\n\n        Returns\n        -------\n        numpy.array\n            an Lxqxq stack of matrices (q=alphabet size, L (reduced)sequence length)", "docstring_tokens": ["uses", "results", "from", "marginal", "ancestral", "inference", "to", "return", "a", "joint", "distribution", "of", "the", "sequence", "states", "at", "both", "ends", "of", "the", "branch", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 258299}
{"url": "https://github.com/dhellmann/csvcat/blob/d08c0df3af2b1cec739521e6d5bb2b1ad868c591/csvcat/main.py#L12-L41", "sha": "d08c0df3af2b1cec739521e6d5bb2b1ad868c591", "docstring_summary": "Turn column inputs from user into list of simple numbers.", "language": "python", "parameters": "(columns)", "return_statement": "return [n - 1 for n in nums]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "for", "arg_3", "in", "arg_2", ".", "split", "(", "','", ")", ":", "arg_3", "=", "arg_3", ".", "strip", "(", ")", "try", ":", "arg_2", "=", "int", "(", "arg_3", ")", "arg_1", ".", "append", "(", "arg_2", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_3", ".", "partition", "(", "'-'", ")", "try", ":", "arg_4", "=", "int", "(", "arg_4", ")", "arg_6", "=", "int", "(", "arg_6", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "raise", "ValueError", "(", "'Did not understand %r, expected digit-digit'", "%", "arg_2", ")", "arg_7", "=", "1", "if", "arg_4", "<", "arg_6", "else", "-", "1", "arg_1", ".", "extend", "(", "range", "(", "arg_4", ",", "arg_6", "+", "arg_7", ",", "arg_7", ")", ")", "return", "[", "arg_8", "-", "1", "for", "arg_8", "in", "arg_1", "]"], "function": "def Func(arg_0):\n    \"\"\"Turn column inputs from user into list of simple numbers.\n\n    Inputs can be:\n\n      - individual number: 1\n      - range: 1-3\n      - comma separated list: 1,2,3,4-6\n    \"\"\"\n    arg_1 = []\n    for arg_2 in arg_0:\n        for arg_3 in arg_2.split(','):\n            arg_3 = arg_3.strip()\n            try:\n                arg_2 = int(arg_3)\n                arg_1.append(arg_2)\n            except (TypeError, ValueError):\n                arg_4, arg_5, arg_6 = arg_3.partition('-')\n                try:\n                    arg_4 = int(arg_4)\n                    arg_6 = int(arg_6)\n                except (TypeError, ValueError):\n                    raise ValueError(\n                        'Did not understand %r, expected digit-digit' % arg_2\n                    )\n                arg_7 = 1 if arg_4 < arg_6 else -1\n                arg_1.extend(range(arg_4, arg_6 + arg_7, arg_7))\n    # The user will pass us 1-based indexes, but we need to use\n    # 0-based indexing with the row.\n    return [arg_8 - 1 for arg_8 in arg_1]", "path": "csvcat/main.py", "identifier": "_get_column_nums_from_args", "docstring": "Turn column inputs from user into list of simple numbers.\n\n    Inputs can be:\n\n      - individual number: 1\n      - range: 1-3\n      - comma separated list: 1,2,3,4-6", "docstring_tokens": ["Turn", "column", "inputs", "from", "user", "into", "list", "of", "simple", "numbers", "."], "nwo": "dhellmann/csvcat", "score": 0.14991498758945482, "idx": 258300}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/util/scm/base.py#L44-L52", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Run a command, or just echo it, depending on `commit`.", "language": "python", "parameters": "(self, cmd, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_0", ".", "_commit", ":", "return", "arg_0", ".", "run", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "else", ":", "notify", ".", "warning", "(", "\"WOULD RUN: {}\"", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "arg_3", ".", "copy", "(", ")", "arg_3", "[", "'echo'", "]", "=", "False", "return", "arg_0", ".", "run", "(", "'true'", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Run a command, or just echo it, depending on `commit`.\"\"\"\n        if arg_0._commit:\n            return arg_0.run(arg_1, *arg_2, **arg_3)\n        else:\n            notify.warning(\"WOULD RUN: {}\".format(arg_1))\n            arg_3 = arg_3.copy()\n            arg_3['echo'] = False\n            return arg_0.run('true', *arg_2, **arg_3)", "path": "src/rituals/util/scm/base.py", "identifier": "ProviderBase.run_elective", "docstring": "Run a command, or just echo it, depending on `commit`.", "docstring_tokens": ["Run", "a", "command", "or", "just", "echo", "it", "depending", "on", "commit", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 258301}
{"url": "https://github.com/incuna/django-wkhtmltopdf/blob/4e73f604c48f7f449c916c4257a72af59517322c/wkhtmltopdf/utils.py#L254-L270", "sha": "4e73f604c48f7f449c916c4257a72af59517322c", "docstring_summary": "Given a unicode string, will do its dandiest to give you back a\n    valid ascii charset string you can use in, say, http headers and the\n    like.", "language": "python", "parameters": "(string)", "return_statement": "return '\"{0!s}\"'.format(string.decode())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "text_type", ")", ":", "try", ":", "import", "unidecode", "except", "ImportError", ":", "pass", "else", ":", "arg_0", "=", "unidecode", ".", "unidecode", "(", "arg_0", ")", "arg_0", "=", "arg_0", ".", "encode", "(", "'ascii'", ",", "'replace'", ")", "arg_0", "=", "arg_0", ".", "replace", "(", "b'\\\\'", ",", "b'\\\\\\\\'", ")", ".", "replace", "(", "b'\"'", ",", "b'\\\\\"'", ")", "return", "'\"{0!s}\"'", ".", "format", "(", "arg_0", ".", "decode", "(", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Given a unicode string, will do its dandiest to give you back a\n    valid ascii charset string you can use in, say, http headers and the\n    like.\n    \"\"\"\n    if isinstance(arg_0, six.text_type):\n        try:\n            import unidecode\n        except ImportError:\n            pass\n        else:\n            arg_0 = unidecode.unidecode(arg_0)\n        arg_0 = arg_0.encode('ascii', 'replace')\n    # Wrap in double-quotes for ; , and the like\n    arg_0 = arg_0.replace(b'\\\\', b'\\\\\\\\').replace(b'\"', b'\\\\\"')\n    return '\"{0!s}\"'.format(arg_0.decode())", "path": "wkhtmltopdf/utils.py", "identifier": "http_quote", "docstring": "Given a unicode string, will do its dandiest to give you back a\n    valid ascii charset string you can use in, say, http headers and the\n    like.", "docstring_tokens": ["Given", "a", "unicode", "string", "will", "do", "its", "dandiest", "to", "give", "you", "back", "a", "valid", "ascii", "charset", "string", "you", "can", "use", "in", "say", "http", "headers", "and", "the", "like", "."], "nwo": "incuna/django-wkhtmltopdf", "score": 0.5383908637665665, "idx": 258302}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L206-L210", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Create a new Set produce by the intersection of 2 Set", "language": "python", "parameters": "(self, sig: Scope)", "return_statement": "return new", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "arg_3", "=", "arg_2", "(", "arg_1", "=", "arg_0", ".", "_hsig", ".", "values", "(", ")", ",", "state", "=", "arg_0", ".", "state", ")", "arg_3", "&=", "arg_1", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        \"\"\" Create a new Set produce by the Func of 2 Set \"\"\"\n        arg_3 = arg_2(arg_1=arg_0._hsig.values(), state=arg_0.state)\n        arg_3 &= arg_1\n        return arg_3", "path": "pyrser/type_system/scope.py", "identifier": "Scope.intersection", "docstring": "Create a new Set produce by the intersection of 2 Set", "docstring_tokens": ["Create", "a", "new", "Set", "produce", "by", "the", "intersection", "of", "2", "Set"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 258303}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/nginx/__init__.py#L8-L19", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This will output the nginx location config string for specific port spec", "language": "python", "parameters": "(port_spec, bridge_ip)", "return_statement": "return location_string_spec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"\\t \\t location / { \\n\"", "for", "arg_3", "in", "[", "'proxy_http_version 1.1;'", ",", "'proxy_set_header Upgrade $http_upgrade;'", ",", "'proxy_set_header Connection \"upgrade\";'", ",", "'proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;'", ",", "'proxy_set_header Host $http_host;'", ",", "_nginx_proxy_string", "(", "arg_0", ",", "arg_1", ")", "]", ":", "arg_2", "+=", "\"\\t \\t \\t {} \\n\"", ".", "format", "(", "arg_3", ")", "arg_2", "+=", "\"\\t \\t } \\n\"", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"This will output the nginx location config string for specific port spec \"\"\"\n    arg_2 = \"\\t \\t location / { \\n\"\n    for arg_3 in ['proxy_http_version 1.1;',\n                             'proxy_set_header Upgrade $http_upgrade;',\n                             'proxy_set_header Connection \"upgrade\";',\n                             'proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;',\n                             'proxy_set_header Host $http_host;',\n                             _nginx_proxy_string(arg_0, arg_1)]:\n        arg_2 += \"\\t \\t \\t {} \\n\".format(arg_3)\n    arg_2 += \"\\t \\t } \\n\"\n    return arg_2", "path": "dusty/compiler/nginx/__init__.py", "identifier": "_nginx_location_spec", "docstring": "This will output the nginx location config string for specific port spec", "docstring_tokens": ["This", "will", "output", "the", "nginx", "location", "config", "string", "for", "specific", "port", "spec"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 258304}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L1601-L1647", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Tell the Hub to forget results.", "language": "python", "parameters": "(self, jobs=[], targets=[])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ",", "arg_2", "=", "[", "]", ")", ":", "if", "not", "arg_2", "and", "not", "arg_1", ":", "raise", "ValueError", "(", "\"Must specify at least one of `targets` and `jobs`\"", ")", "if", "arg_2", ":", "arg_2", "=", "arg_0", ".", "_build_targets", "(", "arg_2", ")", "[", "1", "]", "if", "arg_1", "==", "'all'", ":", "arg_3", "=", "arg_1", "else", ":", "arg_3", "=", "[", "]", "if", "isinstance", "(", "arg_1", ",", "(", "basestring", ",", "AsyncResult", ")", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_4", "=", "filter", "(", "lambda", "obj", ":", "not", "isinstance", "(", "obj", ",", "(", "basestring", ",", "AsyncResult", ")", ")", ",", "arg_1", ")", "if", "arg_4", ":", "raise", "TypeError", "(", "\"Invalid msg_id type %r, expected str or AsyncResult\"", "%", "arg_4", "[", "0", "]", ")", "for", "arg_5", "in", "arg_1", ":", "if", "isinstance", "(", "arg_5", ",", "AsyncResult", ")", ":", "arg_3", ".", "extend", "(", "arg_5", ".", "msg_ids", ")", "else", ":", "arg_3", ".", "append", "(", "arg_5", ")", "arg_6", "=", "dict", "(", "engine_ids", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "_query_socket", ",", "\"purge_request\"", ",", "arg_6", "=", "arg_6", ")", "arg_7", ",", "arg_8", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_0", ".", "_query_socket", ",", "0", ")", "if", "arg_0", ".", "debug", ":", "pprint", "(", "arg_8", ")", "arg_6", "=", "arg_8", "[", "'content'", "]", "if", "arg_6", "[", "'status'", "]", "!=", "'ok'", ":", "raise", "arg_0", ".", "_unwrap_exception", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1=[], arg_2=[]):\n        \"\"\"Tell the Hub to forget results.\n\n        Individual results can be purged by msg_id, or the entire\n        history of specific targets can be purged.\n\n        Use `Func('all')` to scrub everything from the Hub's db.\n\n        Parameters\n        ----------\n\n        jobs : str or list of str or AsyncResult objects\n                the msg_ids whose results should be forgotten.\n        targets : int/str/list of ints/strs\n                The targets, by int_id, whose entire history is to be purged.\n\n                default : None\n        \"\"\"\n        if not arg_2 and not arg_1:\n            raise ValueError(\"Must specify at least one of `targets` and `jobs`\")\n        if arg_2:\n            arg_2 = arg_0._build_targets(arg_2)[1]\n\n        # construct msg_ids from jobs\n        if arg_1 == 'all':\n            arg_3 = arg_1\n        else:\n            arg_3 = []\n            if isinstance(arg_1, (basestring,AsyncResult)):\n                arg_1 = [arg_1]\n            arg_4 = filter(lambda obj: not isinstance(obj, (basestring, AsyncResult)), arg_1)\n            if arg_4:\n                raise TypeError(\"Invalid msg_id type %r, expected str or AsyncResult\"%arg_4[0])\n            for arg_5 in arg_1:\n                if isinstance(arg_5, AsyncResult):\n                    arg_3.extend(arg_5.msg_ids)\n                else:\n                    arg_3.append(arg_5)\n\n        arg_6 = dict(engine_ids=arg_2, arg_3=arg_3)\n        arg_0.session.send(arg_0._query_socket, \"purge_request\", arg_6=arg_6)\n        arg_7, arg_8 = arg_0.session.recv(arg_0._query_socket, 0)\n        if arg_0.debug:\n            pprint(arg_8)\n        arg_6 = arg_8['content']\n        if arg_6['status'] != 'ok':\n            raise arg_0._unwrap_exception(arg_6)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client.purge_results", "docstring": "Tell the Hub to forget results.\n\n        Individual results can be purged by msg_id, or the entire\n        history of specific targets can be purged.\n\n        Use `purge_results('all')` to scrub everything from the Hub's db.\n\n        Parameters\n        ----------\n\n        jobs : str or list of str or AsyncResult objects\n                the msg_ids whose results should be forgotten.\n        targets : int/str/list of ints/strs\n                The targets, by int_id, whose entire history is to be purged.\n\n                default : None", "docstring_tokens": ["Tell", "the", "Hub", "to", "forget", "results", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258305}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py#L277-L283", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "If there are edits to the current input buffer, store them.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "input_buffer", "if", "arg_0", ".", "_history_index", "==", "len", "(", "arg_0", ".", "_history", ")", "or", "arg_0", ".", "_history", "[", "arg_0", ".", "_history_index", "]", "!=", "arg_1", ":", "arg_0", ".", "_history_edits", "[", "arg_0", ".", "_history_index", "]", "=", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" If there are edits to the current input buffer, store them.\n        \"\"\"\n        arg_1 = arg_0.input_buffer\n        if arg_0._history_index == len(arg_0._history) or \\\n                arg_0._history[arg_0._history_index] != arg_1:\n            arg_0._history_edits[arg_0._history_index] = arg_1", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py", "identifier": "HistoryConsoleWidget._store_edits", "docstring": "If there are edits to the current input buffer, store them.", "docstring_tokens": ["If", "there", "are", "edits", "to", "the", "current", "input", "buffer", "store", "them", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258306}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/db.py#L219-L222", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Returns a list of patches after patch from the patches list", "language": "python", "parameters": "(self, patch)", "return_statement": "return [line.get_patch() for line in self._patchlines_after(patch) if\n                line.get_patch()]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "[", "arg_2", ".", "get_patch", "(", ")", "for", "arg_2", "in", "arg_0", ".", "_patchlines_after", "(", "arg_1", ")", "if", "arg_2", ".", "get_patch", "(", ")", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns a list of patches after patch from the patches list \"\"\"\n        return [arg_2.get_patch() for arg_2 in arg_0._patchlines_after(arg_1) if\n                arg_2.get_patch()]", "path": "quilt/db.py", "identifier": "PatchSeries.patches_after", "docstring": "Returns a list of patches after patch from the patches list", "docstring_tokens": ["Returns", "a", "list", "of", "patches", "after", "patch", "from", "the", "patches", "list"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 258307}
{"url": "https://github.com/datamole-ai/active-semi-supervised-clustering/blob/0dcab86ea22cd66ed7ea64234efdff1c6aca7981/active_semi_clustering/active/pairwise_constraints/example_oracle.py#L11-L17", "sha": "0dcab86ea22cd66ed7ea64234efdff1c6aca7981", "docstring_summary": "Query the oracle to find out whether i and j should be must-linked", "language": "python", "parameters": "(self, i, j)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "queries_cnt", "<", "arg_0", ".", "max_queries_cnt", ":", "arg_0", ".", "queries_cnt", "+=", "1", "return", "arg_0", ".", "labels", "[", "arg_1", "]", "==", "arg_0", ".", "labels", "[", "arg_2", "]", "else", ":", "raise", "MaximumQueriesExceeded"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"Query the oracle to find out whether i and j should be must-linked\"\n        if arg_0.queries_cnt < arg_0.max_queries_cnt:\n            arg_0.queries_cnt += 1\n            return arg_0.labels[arg_1] == arg_0.labels[arg_2]\n        else:\n            raise MaximumQueriesExceeded", "path": "active_semi_clustering/active/pairwise_constraints/example_oracle.py", "identifier": "ExampleOracle.query", "docstring": "Query the oracle to find out whether i and j should be must-linked", "docstring_tokens": ["Query", "the", "oracle", "to", "find", "out", "whether", "i", "and", "j", "should", "be", "must", "-", "linked"], "nwo": "datamole-ai/active-semi-supervised-clustering", "score": 0.5949103750410808, "idx": 258308}
{"url": "https://github.com/foliant-docs/foliantcontrib.macros/blob/0332dcd7c2b32be72fdf710a012096db1ee83a51/foliant/preprocessors/macros.py#L10-L24", "sha": "0332dcd7c2b32be72fdf710a012096db1ee83a51", "docstring_summary": "Replace macros with content defined in the config.", "language": "python", "parameters": "(self, content: str)", "return_statement": "return self.pattern.sub(_sub, content)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "def", "_sub", "(", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "group", "(", "'body'", ")", "arg_5", "=", "arg_0", ".", "get_options", "(", "arg_3", ".", "group", "(", "'options'", ")", ")", "return", "arg_0", ".", "options", "[", "'macros'", "]", ".", "get", "(", "arg_4", ",", "''", ")", ".", "format_map", "(", "arg_5", ")", "return", "arg_0", ".", "pattern", ".", "sub", "(", "_sub", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        '''Replace macros with content defined in the config.\n\n        :param content: Markdown content\n\n        :returns: Markdown content without macros\n        '''\n\n        def _sub(arg_3):\n            arg_4 = arg_3.group('body')\n            arg_5 = arg_0.get_options(arg_3.group('options'))\n\n            return arg_0.options['macros'].get(arg_4, '').format_map(arg_5)\n\n        return arg_0.pattern.sub(_sub, arg_1)", "path": "foliant/preprocessors/macros.py", "identifier": "Preprocessor.process_macros", "docstring": "Replace macros with content defined in the config.\n\n        :param content: Markdown content\n\n        :returns: Markdown content without macros", "docstring_tokens": ["Replace", "macros", "with", "content", "defined", "in", "the", "config", "."], "nwo": "foliant-docs/foliantcontrib.macros", "score": 0.0, "idx": 258309}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L271-L276", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Checks if name_node has corresponding assign statement in same scope", "language": "python", "parameters": "(name_node)", "return_statement": "return any(a.name == name_node.name for a in assign_stmts)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "scope", "(", ")", ".", "nodes_of_class", "(", "astroid", ".", "AssignName", ")", "return", "any", "(", "arg_2", ".", "name", "==", "arg_0", ".", "name", "for", "arg_2", "in", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Checks if name_node has corresponding assign statement in same scope\n    \"\"\"\n    arg_1 = arg_0.scope().nodes_of_class(astroid.AssignName)\n    return any(arg_2.name == arg_0.name for arg_2 in arg_1)", "path": "pylint/checkers/variables.py", "identifier": "_assigned_locally", "docstring": "Checks if name_node has corresponding assign statement in same scope", "docstring_tokens": ["Checks", "if", "name_node", "has", "corresponding", "assign", "statement", "in", "same", "scope"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258310}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1631-L1669", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the phase of a waveform's dependent variable vector.", "language": "python", "parameters": "(wave, unwrap=True, rad=True)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "copy", ".", "copy", "(", "arg_0", ")", "arg_3", ".", "dep_units", "=", "\"rad\"", "if", "arg_2", "else", "\"deg\"", "arg_3", ".", "dep_name", "=", "\"Func({0})\"", ".", "format", "(", "arg_3", ".", "dep_name", ")", "arg_3", ".", "_dep_vector", "=", "(", "np", ".", "unwrap", "(", "np", ".", "angle", "(", "arg_3", ".", "_dep_vector", ")", ")", "if", "arg_1", "else", "np", ".", "angle", "(", "arg_3", ".", "_dep_vector", ")", ")", "if", "not", "arg_2", ":", "arg_3", ".", "_dep_vector", "=", "np", ".", "rad2deg", "(", "arg_3", ".", "_dep_vector", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=True, arg_2=True):\n    r\"\"\"\n    Return the Func of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param unwrap: Flag that indicates whether Func should change Func shifts\n                   to their :code:`2*pi` complement (True) or not (False)\n    :type  unwrap: boolean\n\n    :param rad: Flag that indicates whether Func should be returned in radians\n                (True) or degrees (False)\n    :type  rad: boolean\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`rad\\` is not valid)\n\n     * RuntimeError (Argument \\`unwrap\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n    .. [[[end]]]\n    \"\"\"\n    arg_3 = copy.copy(arg_0)\n    arg_3.dep_units = \"rad\" if arg_2 else \"deg\"\n    arg_3.dep_name = \"Func({0})\".format(arg_3.dep_name)\n    arg_3._dep_vector = (\n        np.unwrap(np.angle(arg_3._dep_vector)) if arg_1 else np.angle(arg_3._dep_vector)\n    )\n    if not arg_2:\n        arg_3._dep_vector = np.rad2deg(arg_3._dep_vector)\n    return arg_3", "path": "peng/wave_functions.py", "identifier": "phase", "docstring": "r\"\"\"\n    Return the phase of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param unwrap: Flag that indicates whether phase should change phase shifts\n                   to their :code:`2*pi` complement (True) or not (False)\n    :type  unwrap: boolean\n\n    :param rad: Flag that indicates whether phase should be returned in radians\n                (True) or degrees (False)\n    :type  rad: boolean\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.phase\n\n    :raises:\n     * RuntimeError (Argument \\`rad\\` is not valid)\n\n     * RuntimeError (Argument \\`unwrap\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "phase", "of", "a", "waveform", "s", "dependent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 258311}
{"url": "https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L132-L161", "sha": "cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174", "docstring_summary": "Set self.thermostats to a json list of thermostats from ecobee", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'https://api.ecobee.com/1/thermostat'", "arg_2", "=", "{", "'Content-Type'", ":", "'application/json;charset=UTF-8'", ",", "'Authorization'", ":", "'Bearer '", "+", "arg_0", ".", "access_token", "}", "arg_3", "=", "{", "'json'", ":", "(", "'{\"selection\":{\"selectionType\":\"registered\",'", "'\"includeRuntime\":\"true\",'", "'\"includeSensors\":\"true\",'", "'\"includeProgram\":\"true\",'", "'\"includeEquipmentStatus\":\"true\",'", "'\"includeEvents\":\"true\",'", "'\"includeWeather\":\"true\",'", "'\"includeSettings\":\"true\"}}'", ")", "}", "try", ":", "arg_4", "=", "requests", ".", "get", "(", "arg_1", ",", "headers", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "except", "RequestException", ":", "logger", ".", "warn", "(", "\"Error connecting to Ecobee.  Possible connectivity outage.\"", ")", "return", "None", "if", "arg_4", ".", "status_code", "==", "requests", ".", "codes", ".", "ok", ":", "arg_0", ".", "authenticated", "=", "True", "arg_0", ".", "thermostats", "=", "arg_4", ".", "json", "(", ")", "[", "'thermostatList'", "]", "return", "arg_0", ".", "thermostats", "else", ":", "arg_0", ".", "authenticated", "=", "False", "logger", ".", "info", "(", "\"Error connecting to Ecobee while attempting to get \"", "\"thermostat data.  Refreshing tokens and trying again.\"", ")", "if", "arg_0", ".", "refresh_tokens", "(", ")", ":", "return", "arg_0", ".", "Func", "(", ")", "else", ":", "return", "None"], "function": "def Func(arg_0):\n        ''' Set self.thermostats to a json list of thermostats from ecobee '''\n        arg_1 = 'https://api.ecobee.com/1/thermostat'\n        arg_2 = {'Content-Type': 'application/json;charset=UTF-8',\n                  'Authorization': 'Bearer ' + arg_0.access_token}\n        arg_3 = {'json': ('{\"selection\":{\"selectionType\":\"registered\",'\n                            '\"includeRuntime\":\"true\",'\n                            '\"includeSensors\":\"true\",'\n                            '\"includeProgram\":\"true\",'\n                            '\"includeEquipmentStatus\":\"true\",'\n                            '\"includeEvents\":\"true\",'\n                            '\"includeWeather\":\"true\",'\n                            '\"includeSettings\":\"true\"}}')}\n        try:\n            arg_4 = requests.get(arg_1, headers=arg_2, arg_3=arg_3)\n        except RequestException:\n            logger.warn(\"Error connecting to Ecobee.  Possible connectivity outage.\")\n            return None\n        if arg_4.status_code == requests.codes.ok:\n            arg_0.authenticated = True\n            arg_0.thermostats = arg_4.json()['thermostatList']\n            return arg_0.thermostats\n        else:\n            arg_0.authenticated = False\n            logger.info(\"Error connecting to Ecobee while attempting to get \"\n                  \"thermostat data.  Refreshing tokens and trying again.\")\n            if arg_0.refresh_tokens():\n                return arg_0.Func()\n            else:\n                return None", "path": "pyecobee/__init__.py", "identifier": "Ecobee.get_thermostats", "docstring": "Set self.thermostats to a json list of thermostats from ecobee", "docstring_tokens": ["Set", "self", ".", "thermostats", "to", "a", "json", "list", "of", "thermostats", "from", "ecobee"], "nwo": "nkgilley/python-ecobee-api", "score": 0.37994208506696864, "idx": 258312}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/audiosegment.py#L1094-L1105", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Returns an AudioSegment object from the given file based on its file extension.\n    If the extension is wrong, this will throw some sort of error.", "language": "python", "parameters": "(path)", "return_statement": "return AudioSegment(seg, path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "arg_2", "=", "arg_2", ".", "lower", "(", ")", "[", "1", ":", "]", "arg_3", "=", "pydub", ".", "AudioSegment", ".", "Func", "(", "arg_0", ",", "arg_2", ")", "return", "AudioSegment", "(", "arg_3", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns an AudioSegment object from the given file based on its file extension.\n    If the extension is wrong, this will throw some sort of error.\n\n    :param path: The path to the file, including the file extension.\n    :returns: An AudioSegment instance from the file.\n    \"\"\"\n    arg_1, arg_2 = os.path.splitext(arg_0)\n    arg_2 = arg_2.lower()[1:]\n    arg_3 = pydub.AudioSegment.Func(arg_0, arg_2)\n    return AudioSegment(arg_3, arg_0)", "path": "audiosegment.py", "identifier": "from_file", "docstring": "Returns an AudioSegment object from the given file based on its file extension.\n    If the extension is wrong, this will throw some sort of error.\n\n    :param path: The path to the file, including the file extension.\n    :returns: An AudioSegment instance from the file.", "docstring_tokens": ["Returns", "an", "AudioSegment", "object", "from", "the", "given", "file", "based", "on", "its", "file", "extension", ".", "If", "the", "extension", "is", "wrong", "this", "will", "throw", "some", "sort", "of", "error", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 258313}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/cassandra_to_gcs.py#L247-L255", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Converts a user type to RECORD that contains n fields, where n is the\n        number of attributes. Each element in the user type class will be converted to its\n        corresponding data type in BQ.", "language": "python", "parameters": "(cls, name, value)", "return_statement": "return cls.generate_data_dict(names, values)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "_fields", "arg_4", "=", "[", "arg_0", ".", "convert_value", "(", "arg_1", ",", "getattr", "(", "arg_2", ",", "arg_1", ")", ")", "for", "arg_1", "in", "arg_3", "]", "return", "arg_0", ".", "generate_data_dict", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Converts a user type to RECORD that contains n fields, where n is the\n        number of attributes. Each element in the user type class will be converted to its\n        corresponding data type in BQ.\n        \"\"\"\n        arg_3 = arg_2._fields\n        arg_4 = [arg_0.convert_value(arg_1, getattr(arg_2, arg_1)) for arg_1 in arg_3]\n        return arg_0.generate_data_dict(arg_3, arg_4)", "path": "airflow/contrib/operators/cassandra_to_gcs.py", "identifier": "CassandraToGoogleCloudStorageOperator.convert_user_type", "docstring": "Converts a user type to RECORD that contains n fields, where n is the\n        number of attributes. Each element in the user type class will be converted to its\n        corresponding data type in BQ.", "docstring_tokens": ["Converts", "a", "user", "type", "to", "RECORD", "that", "contains", "n", "fields", "where", "n", "is", "the", "number", "of", "attributes", ".", "Each", "element", "in", "the", "user", "type", "class", "will", "be", "converted", "to", "its", "corresponding", "data", "type", "in", "BQ", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258314}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L505-L526", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Get the label for the metric being optimized. This function also caches\n    the label in the instance variable self._optimizedMetricLabel", "language": "python", "parameters": "(self)", "return_statement": "return matchingKeys[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "matchPatterns", "(", "[", "arg_0", ".", "_optimizeKeyPattern", "]", ",", "arg_0", ".", "_getMetricLabels", "(", ")", ")", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "Exception", "(", "\"None of the generated metrics match the specified \"", "\"optimization pattern: %s. Available metrics are %s\"", "%", "(", "arg_0", ".", "_optimizeKeyPattern", ",", "arg_0", ".", "_getMetricLabels", "(", ")", ")", ")", "elif", "len", "(", "arg_1", ")", ">", "1", ":", "raise", "Exception", "(", "\"The specified optimization pattern '%s' matches more \"", "\"than one metric: %s\"", "%", "(", "arg_0", ".", "_optimizeKeyPattern", ",", "arg_1", ")", ")", "return", "arg_1", "[", "0", "]"], "function": "def Func(arg_0):\n    \"\"\" Get the label for the metric being optimized. This function also caches\n    the label in the instance variable self._optimizedMetricLabel\n\n    Parameters:\n    -----------------------------------------------------------------------\n    metricLabels:   A sequence of all the labels being computed for this model\n\n    Returns:        The label for the metric being optmized over\n    \"\"\"\n    arg_1 = matchPatterns([arg_0._optimizeKeyPattern],\n                                  arg_0._getMetricLabels())\n\n    if len(arg_1) == 0:\n      raise Exception(\"None of the generated metrics match the specified \"\n                      \"optimization pattern: %s. Available metrics are %s\" % \\\n                       (arg_0._optimizeKeyPattern, arg_0._getMetricLabels()))\n    elif len(arg_1) > 1:\n      raise Exception(\"The specified optimization pattern '%s' matches more \"\n              \"than one metric: %s\" % (arg_0._optimizeKeyPattern, arg_1))\n\n    return arg_1[0]", "path": "src/nupic/swarming/ModelRunner.py", "identifier": "OPFModelRunner.__getOptimizedMetricLabel", "docstring": "Get the label for the metric being optimized. This function also caches\n    the label in the instance variable self._optimizedMetricLabel\n\n    Parameters:\n    -----------------------------------------------------------------------\n    metricLabels:   A sequence of all the labels being computed for this model\n\n    Returns:        The label for the metric being optmized over", "docstring_tokens": ["Get", "the", "label", "for", "the", "metric", "being", "optimized", ".", "This", "function", "also", "caches", "the", "label", "in", "the", "instance", "variable", "self", ".", "_optimizedMetricLabel"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258315}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/datasets/utils.py#L139-L171", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Download a Google Drive file from  and place it in root.", "language": "python", "parameters": "(file_id, root, filename=None, md5=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "import", "requests", "arg_4", "=", "\"https://docs.google.com/uc?export=download\"", "arg_1", "=", "os", ".", "path", ".", "expanduser", "(", "arg_1", ")", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_2", ")", "makedir_exist_ok", "(", "arg_1", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_5", ")", "and", "check_integrity", "(", "arg_5", ",", "arg_3", ")", ":", "print", "(", "'Using downloaded and verified file: '", "+", "arg_5", ")", "else", ":", "arg_6", "=", "requests", ".", "Session", "(", ")", "arg_7", "=", "arg_6", ".", "get", "(", "arg_4", ",", "arg_9", "=", "{", "'id'", ":", "arg_0", "}", ",", "stream", "=", "True", ")", "arg_8", "=", "_get_confirm_token", "(", "arg_7", ")", "if", "arg_8", ":", "arg_9", "=", "{", "'id'", ":", "arg_0", ",", "'confirm'", ":", "arg_8", "}", "arg_7", "=", "arg_6", ".", "get", "(", "arg_4", ",", "arg_9", "=", "arg_9", ",", "stream", "=", "True", ")", "_save_response_content", "(", "arg_7", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"Download a Google Drive file from  and place it in root.\n\n    Args:\n        file_id (str): id of file to be downloaded\n        root (str): Directory to place downloaded file in\n        filename (str, optional): Name to save the file under. If None, use the id of the file.\n        md5 (str, optional): MD5 checksum of the download. If None, do not check\n    \"\"\"\n    # Based on https://stackoverflow.com/questions/38511444/python-download-files-from-google-drive-using-url\n    import requests\n    arg_4 = \"https://docs.google.com/uc?export=download\"\n\n    arg_1 = os.path.expanduser(arg_1)\n    if not arg_2:\n        arg_2 = arg_0\n    arg_5 = os.path.join(arg_1, arg_2)\n\n    makedir_exist_ok(arg_1)\n\n    if os.path.isfile(arg_5) and check_integrity(arg_5, arg_3):\n        print('Using downloaded and verified file: ' + arg_5)\n    else:\n        arg_6 = requests.Session()\n\n        arg_7 = arg_6.get(arg_4, arg_9={'id': arg_0}, stream=True)\n        arg_8 = _get_confirm_token(arg_7)\n\n        if arg_8:\n            arg_9 = {'id': arg_0, 'confirm': arg_8}\n            arg_7 = arg_6.get(arg_4, arg_9=arg_9, stream=True)\n\n        _save_response_content(arg_7, arg_5)", "path": "torchvision/datasets/utils.py", "identifier": "download_file_from_google_drive", "docstring": "Download a Google Drive file from  and place it in root.\n\n    Args:\n        file_id (str): id of file to be downloaded\n        root (str): Directory to place downloaded file in\n        filename (str, optional): Name to save the file under. If None, use the id of the file.\n        md5 (str, optional): MD5 checksum of the download. If None, do not check", "docstring_tokens": ["Download", "a", "Google", "Drive", "file", "from", "and", "place", "it", "in", "root", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 258316}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L518-L556", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Returns the number of nucleotides and the size per contig for the\n    provided assembly file path", "language": "python", "parameters": "(assembly_file)", "return_statement": "return assembly_size, contig_size", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "{", "}", "arg_3", "=", "\"\"", "with", "open", "(", "arg_0", ")", "as", "fh", ":", "for", "arg_4", "in", "fh", ":", "if", "arg_4", ".", "strip", "(", ")", "==", "\"\"", ":", "continue", "if", "arg_4", ".", "startswith", "(", "\">\"", ")", ":", "arg_3", "=", "arg_4", ".", "strip", "(", ")", "[", "1", ":", "]", "arg_2", "[", "arg_3", "]", "=", "0", "else", ":", "arg_5", "=", "len", "(", "arg_4", ".", "strip", "(", ")", ")", "arg_1", "+=", "arg_5", "arg_2", "[", "arg_3", "]", "+=", "arg_5", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Returns the number of nucleotides and the size per contig for the\n    provided assembly file path\n\n    Parameters\n    ----------\n    assembly_file : str\n        Path to assembly file.\n\n    Returns\n    -------\n    assembly_size : int\n        Size of the assembly in nucleotides\n    contig_size : dict\n        Length of each contig (contig name as key and length as value)\n\n    \"\"\"\n\n    arg_1 = 0\n    arg_2 = {}\n    arg_3 = \"\"\n\n    with open(arg_0) as fh:\n        for arg_4 in fh:\n\n            # Skip empty lines\n            if arg_4.strip() == \"\":\n                continue\n\n            if arg_4.startswith(\">\"):\n                arg_3 = arg_4.strip()[1:]\n                arg_2[arg_3] = 0\n\n            else:\n                arg_5 = len(arg_4.strip())\n                arg_1 += arg_5\n                arg_2[arg_3] += arg_5\n\n    return arg_1, arg_2", "path": "flowcraft/templates/process_assembly_mapping.py", "identifier": "get_assembly_size", "docstring": "Returns the number of nucleotides and the size per contig for the\n    provided assembly file path\n\n    Parameters\n    ----------\n    assembly_file : str\n        Path to assembly file.\n\n    Returns\n    -------\n    assembly_size : int\n        Size of the assembly in nucleotides\n    contig_size : dict\n        Length of each contig (contig name as key and length as value)", "docstring_tokens": ["Returns", "the", "number", "of", "nucleotides", "and", "the", "size", "per", "contig", "for", "the", "provided", "assembly", "file", "path"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 258317}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/http_utils.py#L93-L122", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Make an HTTP request using aiohttp directly.", "language": "python", "parameters": "(self, method, url, params=None, headers=None, data=None)", "return_statement": "return self._session.request(\n            method, url, params=params, headers=headers, data=data,\n            proxy=self._proxy\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "not", "urllib", ".", "parse", ".", "urlparse", "(", "arg_2", ")", ".", "hostname", ".", "endswith", "(", "'.google.com'", ")", ":", "raise", "Exception", "(", "'expected google.com domain'", ")", "arg_4", "=", "arg_4", "or", "{", "}", "arg_4", ".", "update", "(", "arg_0", ".", "_authorization_headers", ")", "return", "arg_0", ".", "_session", ".", "request", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "proxy", "=", "arg_0", ".", "_proxy", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"Make an HTTP request using aiohttp directly.\n\n        Automatically uses configured HTTP proxy, and adds Google authorization\n        header and cookies.\n\n        Args:\n            method (str): Request method.\n            url (str): Request URL.\n            params (dict): (optional) Request query string parameters.\n            headers (dict): (optional) Request headers.\n            data: (str): (optional) Request body data.\n\n        Returns:\n            aiohttp._RequestContextManager: ContextManager for a HTTP response.\n\n        Raises:\n            See ``aiohttp.ClientSession.request``.\n        \"\"\"\n        # Ensure we don't accidentally send the authorization header to a\n        # non-Google domain:\n        if not urllib.parse.urlparse(arg_2).hostname.endswith('.google.com'):\n            raise Exception('expected google.com domain')\n\n        arg_4 = arg_4 or {}\n        arg_4.update(arg_0._authorization_headers)\n        return arg_0._session.request(\n            arg_1, arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,\n            proxy=arg_0._proxy\n        )", "path": "hangups/http_utils.py", "identifier": "Session.fetch_raw", "docstring": "Make an HTTP request using aiohttp directly.\n\n        Automatically uses configured HTTP proxy, and adds Google authorization\n        header and cookies.\n\n        Args:\n            method (str): Request method.\n            url (str): Request URL.\n            params (dict): (optional) Request query string parameters.\n            headers (dict): (optional) Request headers.\n            data: (str): (optional) Request body data.\n\n        Returns:\n            aiohttp._RequestContextManager: ContextManager for a HTTP response.\n\n        Raises:\n            See ``aiohttp.ClientSession.request``.", "docstring_tokens": ["Make", "an", "HTTP", "request", "using", "aiohttp", "directly", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258318}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/beziereditor/__init__.py#L213-L220", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Calculates the coordinates of a point from the origin.", "language": "python", "parameters": "(self, x0, y0, distance, angle)", "return_statement": "return Point(x, y)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_1", "+", "cos", "(", "radians", "(", "arg_4", ")", ")", "*", "arg_3", "arg_6", "=", "arg_2", "+", "sin", "(", "radians", "(", "arg_4", ")", ")", "*", "arg_3", "return", "Point", "(", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \n        \"\"\" Calculates the Func of a point from the origin.\n        \"\"\"\n        \n        arg_5 = arg_1 + cos(radians(arg_4)) * arg_3\n        arg_6 = arg_2 + sin(radians(arg_4)) * arg_3\n        return Point(arg_5, arg_6)", "path": "lib/beziereditor/__init__.py", "identifier": "BezierPathEditor.coordinates", "docstring": "Calculates the coordinates of a point from the origin.", "docstring_tokens": ["Calculates", "the", "coordinates", "of", "a", "point", "from", "the", "origin", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258319}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/topology/topology_context_impl.py#L134-L138", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns this context's metrics collector", "language": "python", "parameters": "(self)", "return_statement": "return self.metrics_collector", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "metrics_collector", "is", "None", "or", "not", "isinstance", "(", "arg_0", ".", "metrics_collector", ",", "MetricsCollector", ")", ":", "raise", "RuntimeError", "(", "\"Metrics collector is not registered in this context\"", ")", "return", "arg_0", ".", "metrics_collector"], "function": "def Func(arg_0):\n    \"\"\"Returns this context's metrics collector\"\"\"\n    if arg_0.metrics_collector is None or not isinstance(arg_0.metrics_collector, MetricsCollector):\n      raise RuntimeError(\"Metrics collector is not registered in this context\")\n    return arg_0.metrics_collector", "path": "heron/instance/src/python/utils/topology/topology_context_impl.py", "identifier": "TopologyContextImpl.get_metrics_collector", "docstring": "Returns this context's metrics collector", "docstring_tokens": ["Returns", "this", "context", "s", "metrics", "collector"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258320}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/_vendor/nvd3/NVD3Chart.py#L450-L465", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Create Y-axis", "language": "python", "parameters": "(self, name, label=None, format=None, custom_format=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "{", "}", "if", "arg_4", "and", "arg_3", ":", "arg_5", "[", "'tickFormat'", "]", "=", "arg_3", "elif", "arg_3", ":", "arg_5", "[", "'tickFormat'", "]", "=", "\"d3.format(',%s')\"", "%", "arg_3", "if", "arg_2", ":", "arg_5", "[", "'axisLabel'", "]", "=", "\"'\"", "+", "arg_2", "+", "\"'\"", "arg_0", ".", "axislist", "[", "arg_1", "]", "=", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False):\n        \"\"\"\n        Create Y-axis\n        \"\"\"\n        arg_5 = {}\n\n        if arg_4 and arg_3:\n            arg_5['tickFormat'] = arg_3\n        elif arg_3:\n            arg_5['tickFormat'] = \"d3.format(',%s')\" % arg_3\n\n        if arg_2:\n            arg_5['axisLabel'] = \"'\" + arg_2 + \"'\"\n\n        # Add new axis to list of axis\n        arg_0.axislist[arg_1] = arg_5", "path": "airflow/_vendor/nvd3/NVD3Chart.py", "identifier": "NVD3Chart.create_y_axis", "docstring": "Create Y-axis", "docstring_tokens": ["Create", "Y", "-", "axis"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258321}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L75-L105", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Return a stack of frames which the debugger will use for in\n    showing backtraces and in frame switching. As such various frame\n    that are really around may be excluded unless we are debugging the\n    sebugger. Also we will add traceback frame on top if that\n    exists.", "language": "python", "parameters": "(f, t, botframe, proc_obj=None)", "return_statement": "return stack, i", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "lambda", "arg_0", ":", "False", "if", "arg_3", ":", "arg_5", "=", "arg_3", ".", "debugger", ".", "settings", "if", "not", "arg_5", "[", "'dbg_trepan'", "]", ":", "arg_4", "=", "lambda", "arg_0", ":", "arg_3", ".", "core", ".", "ignore_filter", ".", "is_included", "(", "arg_0", ")", "pass", "pass", "arg_6", "=", "[", "]", "if", "arg_1", "and", "arg_1", ".", "tb_frame", "is", "arg_0", ":", "arg_1", "=", "arg_1", ".", "tb_next", "while", "arg_0", "is", "not", "None", ":", "if", "arg_4", "(", "arg_0", ")", ":", "break", "arg_6", ".", "append", "(", "(", "arg_0", ",", "arg_0", ".", "f_lineno", ")", ")", "arg_0", "=", "arg_0", ".", "f_back", "pass", "arg_6", ".", "reverse", "(", ")", "arg_7", "=", "max", "(", "0", ",", "len", "(", "arg_6", ")", "-", "1", ")", "while", "arg_1", "is", "not", "None", ":", "arg_6", ".", "append", "(", "(", "arg_1", ".", "tb_frame", ",", "arg_1", ".", "tb_lineno", ")", ")", "arg_1", "=", "arg_1", ".", "tb_next", "pass", "return", "arg_6", ",", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"Return a stack of frames which the debugger will use for in\n    showing backtraces and in frame switching. As such various frame\n    that are really around may be excluded unless we are debugging the\n    sebugger. Also we will add traceback frame on top if that\n    exists.\"\"\"\n    arg_4 = lambda arg_0: False\n    if arg_3:\n        arg_5 = arg_3.debugger.settings\n        if not arg_5['dbg_trepan']:\n            arg_4 = lambda arg_0: \\\n                arg_3.core.ignore_filter.is_included(arg_0)\n            pass\n        pass\n    arg_6 = []\n    if arg_1 and arg_1.tb_frame is arg_0:\n        arg_1 = arg_1.tb_next\n    while arg_0 is not None:\n        if arg_4(arg_0): break  # See commented alternative below\n        arg_6.append((arg_0, arg_0.f_lineno))\n        # bdb has:\n        # if f is botframe: break\n        arg_0 = arg_0.f_back\n        pass\n    arg_6.reverse()\n    arg_7 = max(0, len(arg_6) - 1)\n    while arg_1 is not None:\n        arg_6.append((arg_1.tb_frame, arg_1.tb_lineno))\n        arg_1 = arg_1.tb_next\n        pass\n    return arg_6, arg_7", "path": "trepan/processor/cmdproc.py", "identifier": "get_stack", "docstring": "Return a stack of frames which the debugger will use for in\n    showing backtraces and in frame switching. As such various frame\n    that are really around may be excluded unless we are debugging the\n    sebugger. Also we will add traceback frame on top if that\n    exists.", "docstring_tokens": ["Return", "a", "stack", "of", "frames", "which", "the", "debugger", "will", "use", "for", "in", "showing", "backtraces", "and", "in", "frame", "switching", ".", "As", "such", "various", "frame", "that", "are", "really", "around", "may", "be", "excluded", "unless", "we", "are", "debugging", "the", "sebugger", ".", "Also", "we", "will", "add", "traceback", "frame", "on", "top", "if", "that", "exists", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 258322}
{"url": "https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1112-L1114", "sha": "de2e678e2f00e5940de52c000214dbcb8812a222", "docstring_summary": "List names of options and positional arguments.", "language": "python", "parameters": "(self)", "return_statement": "return self.options.keys() + [p.name for p in self.positional_args]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "options", ".", "Func", "(", ")", "+", "[", "arg_1", ".", "name", "for", "arg_1", "in", "arg_0", ".", "positional_args", "]"], "function": "def Func(arg_0):\n        \"\"\"List names of options and positional arguments.\"\"\"\n        return arg_0.options.Func() + [arg_1.name for arg_1 in arg_0.positional_args]", "path": "tui/__init__.py", "identifier": "tui.keys", "docstring": "List names of options and positional arguments.", "docstring_tokens": ["List", "names", "of", "options", "and", "positional", "arguments", "."], "nwo": "yohell/python-tui", "score": 0.2619419494340654, "idx": 258323}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/plot.py#L317-L344", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "Save the pylab figure somewhere.\n    If fname==False, show it instead.\n    Height force > dpi force\n    if a tag is given instead of a filename, save it alongside the ABF", "language": "python", "parameters": "(abf,fname=None,tag=None,width=700,close=True,facecolor='w',\n              resize=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "700", ",", "arg_4", "=", "True", ",", "arg_5", "=", "'w'", ",", "arg_6", "=", "True", ")", ":", "if", "len", "(", "pylab", ".", "gca", "(", ")", ".", "get_lines", "(", ")", ")", "==", "0", ":", "print", "(", "\"can't Func, no figure!\"", ")", "return", "if", "arg_6", ":", "pylab", ".", "tight_layout", "(", ")", "pylab", ".", "subplots_adjust", "(", "bottom", "=", ".1", ")", "annotate", "(", "arg_0", ")", "if", "arg_2", ":", "arg_1", "=", "arg_0", ".", "outpath", "+", "arg_0", ".", "ID", "+", "\"_\"", "+", "arg_2", "+", "\".png\"", "arg_7", ",", "arg_8", "=", "pylab", ".", "gcf", "(", ")", ".", "get_size_inches", "(", ")", "arg_9", "=", "arg_3", "/", "arg_7", "if", "arg_1", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "outpath", ")", ":", "os", ".", "mkdir", "(", "arg_0", ".", "outpath", ")", "print", "(", "\" <- saving [%s] at %d DPI (%dx%d)\"", "%", "(", "os", ".", "path", ".", "basename", "(", "arg_1", ")", ",", "arg_9", ",", "arg_7", "*", "arg_9", ",", "arg_8", "*", "arg_9", ")", ")", "pylab", ".", "Funcfig", "(", "arg_1", ",", "arg_9", "=", "arg_9", ",", "arg_5", "=", "arg_5", ")", "else", ":", "pylab", ".", "show", "(", ")", "if", "arg_4", ":", "pylab", ".", "close", "(", ")"], "function": "def Func(arg_0,arg_1=None,arg_2=None,arg_3=700,arg_4=True,arg_5='w',\n              arg_6=True):\n    \"\"\"\n    Save the pylab figure somewhere.\n    If fname==False, show it instead.\n    Height force > dpi force\n    if a tag is given instead of a filename, Func it alongside the ABF\n    \"\"\"\n    if len(pylab.gca().get_lines())==0:\n        print(\"can't Func, no figure!\")\n        return\n    if arg_6:\n        pylab.tight_layout()\n        pylab.subplots_adjust(bottom=.1)\n    annotate(arg_0)\n    if arg_2:\n        arg_1 = arg_0.outpath+arg_0.ID+\"_\"+arg_2+\".png\"\n    arg_7,arg_8 = pylab.gcf().get_size_inches()\n    arg_9=arg_3/arg_7\n    if arg_1:\n        if not os.path.exists(arg_0.outpath):\n            os.mkdir(arg_0.outpath)\n        print(\" <- saving [%s] at %d DPI (%dx%d)\"%(os.path.basename(arg_1),arg_9,arg_7*arg_9,arg_8*arg_9))\n        pylab.Funcfig(arg_1,arg_9=arg_9,arg_5=arg_5)\n    else:\n        pylab.show()\n    if arg_4:\n        pylab.close()", "path": "doc/oldcode/swhlab/core/plot.py", "identifier": "save", "docstring": "Save the pylab figure somewhere.\n    If fname==False, show it instead.\n    Height force > dpi force\n    if a tag is given instead of a filename, save it alongside the ABF", "docstring_tokens": ["Save", "the", "pylab", "figure", "somewhere", ".", "If", "fname", "==", "False", "show", "it", "instead", ".", "Height", "force", ">", "dpi", "force", "if", "a", "tag", "is", "given", "instead", "of", "a", "filename", "save", "it", "alongside", "the", "ABF"], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 258324}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/__init__.py#L368-L393", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Check if the given IP is an IP range.", "language": "python", "parameters": "(ip)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "and", "isinstance", "(", "arg_0", ",", "str", ")", ":", "load_config", "(", "True", ")", "return", "Check", "(", "arg_0", ")", ".", "is_ip_range", "(", ")", "return", "None"], "function": "def Func(arg_0):  # pragma: no cover\n    \"\"\"\n    Check if the given IP is an IP range.\n\n    :param ip: The IP we are checking.\n    :type ip: str\n\n    :return: The IPv4 range state.\n    :rtype: bool\n\n    .. warning::\n        If an empty or a non-string :code:`ip` is given, we return :code:`None`.\n    \"\"\"\n\n    if arg_0 and isinstance(arg_0, str):\n        # The given IP is not empty nor None.\n        # and\n        # * The given IP is a string.\n\n        # We silently load the configuration.\n        load_config(True)\n\n        return Check(arg_0).is_ip_range()\n\n    # We return None, there is nothing to check.\n    return None", "path": "PyFunceble/__init__.py", "identifier": "is_ipv4_range", "docstring": "Check if the given IP is an IP range.\n\n    :param ip: The IP we are checking.\n    :type ip: str\n\n    :return: The IPv4 range state.\n    :rtype: bool\n\n    .. warning::\n        If an empty or a non-string :code:`ip` is given, we return :code:`None`.", "docstring_tokens": ["Check", "if", "the", "given", "IP", "is", "an", "IP", "range", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 258325}
{"url": "https://github.com/awentzonline/keras-vgg-buddy/blob/716cb66396b839a66ec8dc66998066b360a8f395/keras_vgg_buddy/models.py#L59-L69", "sha": "716cb66396b839a66ec8dc66998066b360a8f395", "docstring_summary": "Evaluate layer outputs for `x`", "language": "python", "parameters": "(self, x, layers)", "return_statement": "return features", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_2", ":", "return", "None", "arg_3", "=", "[", "arg_0", ".", "net", ".", "input", "]", "if", "arg_0", ".", "learning_phase", "is", "not", "None", ":", "arg_3", ".", "append", "(", "arg_0", ".", "learning_phase", ")", "arg_4", "=", "K", ".", "function", "(", "arg_3", ",", "[", "arg_0", ".", "get_layer_output", "(", "layer_name", ")", "for", "layer_name", "in", "arg_2", "]", ")", "arg_5", "=", "arg_4", "(", "[", "arg_1", "]", ")", "arg_6", "=", "dict", "(", "zip", "(", "arg_2", ",", "arg_5", ")", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''Evaluate layer outputs for `x`'''\n        if not arg_2:\n            return None\n        arg_3 = [arg_0.net.input]\n        if arg_0.learning_phase is not None:\n            arg_3.append(arg_0.learning_phase)\n        arg_4 = K.function(arg_3, [arg_0.get_layer_output(layer_name) for layer_name in arg_2])\n        arg_5 = arg_4([arg_1])\n        arg_6 = dict(zip(arg_2, arg_5))\n        return arg_6", "path": "keras_vgg_buddy/models.py", "identifier": "VGG16.get_features", "docstring": "Evaluate layer outputs for `x`", "docstring_tokens": ["Evaluate", "layer", "outputs", "for", "x"], "nwo": "awentzonline/keras-vgg-buddy", "score": 0.19858476458209082, "idx": 258326}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hgnc.py#L278-L300", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return a dictionary with hgnc_symbol as key and gene_obj as value", "language": "python", "parameters": "(self, build='37', genes=None)", "return_statement": "return hgnc_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'37'", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "}", "LOG", ".", "info", "(", "\"Building Func\"", ")", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", ".", "hgnc_collection", ".", "find", "(", "{", "'build'", ":", "arg_1", "}", ")", "for", "arg_4", "in", "arg_2", ":", "arg_3", "[", "arg_4", "[", "'hgnc_symbol'", "]", "]", "=", "arg_4", "LOG", ".", "info", "(", "\"All genes fetched\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1='37', arg_2=None):\n        \"\"\"Return a dictionary with hgnc_symbol as key and gene_obj as value\n\n        The result will have ONE entry for each gene in the database.\n        (For a specific build)\n\n        Args:\n            build(str)\n            genes(iterable(scout.models.HgncGene)):\n\n        Returns:\n            hgnc_dict(dict): {<hgnc_symbol(str)>: <gene(dict)>}\n\n        \"\"\"\n        arg_3 = {}\n        LOG.info(\"Building Func\")\n        if not arg_2:\n            arg_2 = arg_0.hgnc_collection.find({'build':arg_1})\n\n        for arg_4 in arg_2:\n            arg_3[arg_4['hgnc_symbol']] = arg_4\n        LOG.info(\"All genes fetched\")\n        return arg_3", "path": "scout/adapter/mongo/hgnc.py", "identifier": "GeneHandler.hgncsymbol_to_gene", "docstring": "Return a dictionary with hgnc_symbol as key and gene_obj as value\n\n        The result will have ONE entry for each gene in the database.\n        (For a specific build)\n\n        Args:\n            build(str)\n            genes(iterable(scout.models.HgncGene)):\n\n        Returns:\n            hgnc_dict(dict): {<hgnc_symbol(str)>: <gene(dict)>}", "docstring_tokens": ["Return", "a", "dictionary", "with", "hgnc_symbol", "as", "key", "and", "gene_obj", "as", "value"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258327}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L31-L39", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This function returns a dictionary representation of a docker-compose.yml file, based on assembled_specs from\n    the spec_assembler, and port_specs from the port_spec compiler", "language": "python", "parameters": "(assembled_specs, port_specs)", "return_statement": "return compose_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_compose_dict_for_nginx", "(", "arg_1", ")", "for", "arg_3", "in", "arg_0", "[", "'apps'", "]", ".", "keys", "(", ")", ":", "arg_2", "[", "arg_3", "]", "=", "_composed_app_dict", "(", "arg_3", ",", "arg_0", ",", "arg_1", ")", "for", "arg_4", "in", "arg_0", "[", "'services'", "]", ".", "values", "(", ")", ":", "arg_2", "[", "arg_4", ".", "name", "]", "=", "_composed_service_dict", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" This function returns a dictionary representation of a docker-compose.yml file, based on assembled_specs from\n    the spec_assembler, and port_specs from the port_spec compiler \"\"\"\n    arg_2 = _compose_dict_for_nginx(arg_1)\n    for arg_3 in arg_0['apps'].keys():\n        arg_2[arg_3] = _composed_app_dict(arg_3, arg_0, arg_1)\n    for arg_4 in arg_0['services'].values():\n        arg_2[arg_4.name] = _composed_service_dict(arg_4)\n    return arg_2", "path": "dusty/compiler/compose/__init__.py", "identifier": "get_compose_dict", "docstring": "This function returns a dictionary representation of a docker-compose.yml file, based on assembled_specs from\n    the spec_assembler, and port_specs from the port_spec compiler", "docstring_tokens": ["This", "function", "returns", "a", "dictionary", "representation", "of", "a", "docker", "-", "compose", ".", "yml", "file", "based", "on", "assembled_specs", "from", "the", "spec_assembler", "and", "port_specs", "from", "the", "port_spec", "compiler"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 258328}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/effects/effect.py#L200-L214", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Get an effect class by the class name", "language": "python", "parameters": "(self, effect_name: str, package_name: str = None)", "return_statement": "return self._project.get_effect_class(effect_name, package_name=package_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", "=", "None", ")", "->", "Type", "[", "'Effect'", "]", ":", "return", "arg_0", ".", "_project", ".", "Func", "(", "arg_1", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2 = None) -> Type['Effect']:\n        \"\"\"\n        Get an effect class by the class name\n\n        Args:\n            effect_name (str): Name of the effect class\n\n        Keyword Args:\n            package_name (str): The package the effect belongs to. This is optional and only\n                                needed when effect class names are not unique.\n\n        Returns:\n            :py:class:`Effect` class\n        \"\"\"\n        return arg_0._project.Func(arg_1, arg_3=arg_3)", "path": "demosys/effects/effect.py", "identifier": "Effect.get_effect_class", "docstring": "Get an effect class by the class name\n\n        Args:\n            effect_name (str): Name of the effect class\n\n        Keyword Args:\n            package_name (str): The package the effect belongs to. This is optional and only\n                                needed when effect class names are not unique.\n\n        Returns:\n            :py:class:`Effect` class", "docstring_tokens": ["Get", "an", "effect", "class", "by", "the", "class", "name"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 258329}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L651-L674", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Creates ES filters for key ranges used in scanning.", "language": "python", "parameters": "(self, *key_ranges)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "arg_1", ":", "if", "isinstance", "(", "arg_3", ",", "basestring", ")", ":", "arg_3", "=", "eid", "(", "arg_3", ")", "if", "isinstance", "(", "arg_4", ",", "basestring", ")", ":", "arg_4", "+=", "u'\\U0010FFFF'", "arg_4", "=", "eid", "(", "arg_4", ")", "if", "arg_3", "==", "(", ")", "and", "arg_4", "==", "(", ")", ":", "arg_2", ".", "append", "(", "{", "'match_all'", ":", "{", "}", "}", ")", "elif", "arg_4", "==", "(", ")", ":", "arg_2", ".", "append", "(", "{", "'range'", ":", "{", "'_id'", ":", "{", "'gte'", ":", "arg_3", "}", "}", "}", ")", "elif", "arg_3", "==", "(", ")", ":", "arg_2", ".", "append", "(", "{", "'range'", ":", "{", "'_id'", ":", "{", "'lte'", ":", "arg_4", "}", "}", "}", ")", "else", ":", "arg_2", ".", "append", "(", "{", "'range'", ":", "{", "'_id'", ":", "{", "'gte'", ":", "arg_3", ",", "'lte'", ":", "arg_4", "}", "}", "}", ")", "if", "len", "(", "arg_2", ")", "==", "0", ":", "return", "[", "{", "'match_all'", ":", "{", "}", "}", "]", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, *arg_1):\n        'Creates ES filters for key ranges used in scanning.'\n        arg_2 = []\n        for arg_3, arg_4 in arg_1:\n            if isinstance(arg_3, basestring):\n                arg_3 = eid(arg_3)\n            if isinstance(arg_4, basestring):\n                # Make the range inclusive.\n                # We need a valid codepoint, so use the max.\n                arg_4 += u'\\U0010FFFF'\n                arg_4 = eid(arg_4)\n\n            if arg_3 == () and arg_4 == ():\n                arg_2.append({'match_all': {}})\n            elif arg_4 == ():\n                arg_2.append({'range': {'_id': {'gte': arg_3}}})\n            elif arg_3 == ():\n                arg_2.append({'range': {'_id': {'lte': arg_4}}})\n            else:\n                arg_2.append({'range': {'_id': {'gte': arg_3, 'lte': arg_4}}})\n        if len(arg_2) == 0:\n            return [{'match_all': {}}]\n        else:\n            return arg_2", "path": "dossier/store/elastic.py", "identifier": "ElasticStore._range_filters", "docstring": "Creates ES filters for key ranges used in scanning.", "docstring_tokens": ["Creates", "ES", "filters", "for", "key", "ranges", "used", "in", "scanning", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 258330}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant_loader.py#L57-L103", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Updates the manual rank for all variants in a case", "language": "python", "parameters": "(self, case_obj, variant_type='clinical', category='snv')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'clinical'", ",", "arg_3", "=", "'snv'", ")", ":", "arg_4", "=", "arg_0", ".", "variant_collection", ".", "find", "(", "{", "'case_id'", ":", "arg_1", "[", "'_id'", "]", ",", "'category'", ":", "arg_3", ",", "'variant_type'", ":", "arg_2", ",", "}", ")", ".", "sort", "(", "'rank_score'", ",", "pymongo", ".", "DESCENDING", ")", "LOG", ".", "info", "(", "\"Updating variant_rank for all variants\"", ")", "arg_5", "=", "[", "]", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_4", ")", ":", "if", "len", "(", "arg_5", ")", ">", "5000", ":", "try", ":", "arg_0", ".", "variant_collection", ".", "bulk_write", "(", "arg_5", ",", "ordered", "=", "False", ")", "arg_5", "=", "[", "]", "except", "BulkWriteError", "as", "err", ":", "LOG", ".", "warning", "(", "\"Updating variant rank failed\"", ")", "raise", "err", "arg_8", "=", "pymongo", ".", "UpdateOne", "(", "{", "'_id'", ":", "arg_7", "[", "'_id'", "]", "}", ",", "{", "'$set'", ":", "{", "'variant_rank'", ":", "arg_6", "+", "1", ",", "}", "}", ")", "arg_5", ".", "append", "(", "arg_8", ")", "try", ":", "arg_0", ".", "variant_collection", ".", "bulk_write", "(", "arg_5", ",", "ordered", "=", "False", ")", "except", "BulkWriteError", "as", "err", ":", "LOG", ".", "warning", "(", "\"Updating variant rank failed\"", ")", "raise", "err", "LOG", ".", "info", "(", "\"Updating variant_rank done\"", ")"], "function": "def Func(arg_0, arg_1, arg_2='clinical', arg_3='snv'):\n        \"\"\"Updates the manual rank for all variants in a case\n\n        Add a variant rank based on the rank score\n        Whenever variants are added or removed from a case we need to update the variant rank\n\n        Args:\n            case_obj(Case)\n            variant_type(str)\n        \"\"\"\n        # Get all variants sorted by rank score\n        arg_4 = arg_0.variant_collection.find({\n            'case_id': arg_1['_id'],\n            'category': arg_3,\n            'variant_type': arg_2,\n        }).sort('rank_score', pymongo.DESCENDING)\n\n        LOG.info(\"Updating variant_rank for all variants\")\n\n        arg_5 = []\n\n        for arg_6, arg_7 in enumerate(arg_4):\n            if len(arg_5) > 5000:\n                try:\n                    arg_0.variant_collection.bulk_write(arg_5, ordered=False)\n                    arg_5 = []\n                except BulkWriteError as err:\n                    LOG.warning(\"Updating variant rank failed\")\n                    raise err\n\n            arg_8 = pymongo.UpdateOne(\n                {'_id': arg_7['_id']},\n                {\n                    '$set': {\n                        'variant_rank': arg_6 + 1,\n                    }\n                })\n            arg_5.append(arg_8)\n\n        #Update the final bulk\n        try:\n            arg_0.variant_collection.bulk_write(arg_5, ordered=False)\n        except BulkWriteError as err:\n            LOG.warning(\"Updating variant rank failed\")\n            raise err\n\n        LOG.info(\"Updating variant_rank done\")", "path": "scout/adapter/mongo/variant_loader.py", "identifier": "VariantLoader.update_variant_rank", "docstring": "Updates the manual rank for all variants in a case\n\n        Add a variant rank based on the rank score\n        Whenever variants are added or removed from a case we need to update the variant rank\n\n        Args:\n            case_obj(Case)\n            variant_type(str)", "docstring_tokens": ["Updates", "the", "manual", "rank", "for", "all", "variants", "in", "a", "case"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258331}
{"url": "https://github.com/bbusenius/Diablo-Python/blob/646ac5a6f1c79cf9b928a4e2a7979988698b6c82/file_parsing/file_parsing.py#L57-L71", "sha": "646ac5a6f1c79cf9b928a4e2a7979988698b6c82", "docstring_summary": "Counts the number of lines in a file.", "language": "python", "parameters": "(fname)", "return_statement": "return i + 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "with", "open", "(", "arg_0", ")", "as", "f", ":", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "f", ")", ":", "pass", "return", "arg_1", "+", "1"], "function": "def Func(arg_0):\n    \"\"\"Counts the number of lines in a file.\n\n    Args:\n        fname: string, name of the file.\n\n    Returns:\n        integer, the number of lines in the file.\n\n    \"\"\"\n    arg_1 = 0\n    with open(arg_0) as f:\n        for arg_1, arg_2 in enumerate(f):\n            pass\n    return arg_1 + 1", "path": "file_parsing/file_parsing.py", "identifier": "get_line_count", "docstring": "Counts the number of lines in a file.\n\n    Args:\n        fname: string, name of the file.\n\n    Returns:\n        integer, the number of lines in the file.", "docstring_tokens": ["Counts", "the", "number", "of", "lines", "in", "a", "file", "."], "nwo": "bbusenius/Diablo-Python", "score": 0.24979334806965703, "idx": 258332}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/checkpoints.py#L130-L135", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Purge all database records for the current user.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "engine", ".", "begin", "(", ")", "as", "db", ":", "purge_remote_checkpoints", "(", "db", ",", "arg_0", ".", "user_id", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Purge all database records for the current user.\n        \"\"\"\n        with arg_0.engine.begin() as db:\n            purge_remote_checkpoints(db, arg_0.user_id)", "path": "pgcontents/checkpoints.py", "identifier": "PostgresCheckpoints.purge_db", "docstring": "Purge all database records for the current user.", "docstring_tokens": ["Purge", "all", "database", "records", "for", "the", "current", "user", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 258333}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L589-L601", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Desaturates the layer, making it grayscale.\n    \n        Instantly removes all color information from the layer,\n        while maintaing its alpha channel.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "img", ".", "split", "(", ")", "[", "3", "]", "arg_0", ".", "img", "=", "arg_0", ".", "img", ".", "convert", "(", "\"L\"", ")", "arg_0", ".", "img", "=", "arg_0", ".", "img", ".", "convert", "(", "\"RGBA\"", ")", "arg_0", ".", "img", ".", "putalpha", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \n        \"\"\"Desaturates the layer, making it grayscale.\n    \n        Instantly removes all color information from the layer,\n        while maintaing its alpha channel.\n    \n        \"\"\"\n    \n        arg_1 = arg_0.img.split()[3]\n        arg_0.img = arg_0.img.convert(\"L\")\n        arg_0.img = arg_0.img.convert(\"RGBA\")\n        arg_0.img.putalpha(arg_1)", "path": "lib/photobot/__init__.py", "identifier": "Layer.desaturate", "docstring": "Desaturates the layer, making it grayscale.\n    \n        Instantly removes all color information from the layer,\n        while maintaing its alpha channel.", "docstring_tokens": ["Desaturates", "the", "layer", "making", "it", "grayscale", ".", "Instantly", "removes", "all", "color", "information", "from", "the", "layer", "while", "maintaing", "its", "alpha", "channel", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258334}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L169-L184", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a mbox file.", "language": "python", "parameters": "(filepath)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_MBox", "(", "arg_0", ",", "create", "=", "False", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "message_to_dict", "(", "arg_2", ")", "yield", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Parse a mbox file.\n\n        This method parses a mbox file and returns an iterator of dictionaries.\n        Each one of this contains an email message.\n\n        :param filepath: path of the mbox to parse\n\n        :returns : generator of messages; each message is stored in a\n            dictionary of type `requests.structures.CaseInsensitiveDict`\n        \"\"\"\n        arg_1 = _MBox(arg_0, create=False)\n\n        for arg_2 in arg_1:\n            arg_3 = message_to_dict(arg_2)\n            yield arg_3", "path": "perceval/backends/core/mbox.py", "identifier": "MBox.parse_mbox", "docstring": "Parse a mbox file.\n\n        This method parses a mbox file and returns an iterator of dictionaries.\n        Each one of this contains an email message.\n\n        :param filepath: path of the mbox to parse\n\n        :returns : generator of messages; each message is stored in a\n            dictionary of type `requests.structures.CaseInsensitiveDict`", "docstring_tokens": ["Parse", "a", "mbox", "file", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 258335}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfdocument.py#L266-L275", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Starts over again at the new line. If number is specified,\r\n            it will leave multiple lines.", "language": "python", "parameters": "(self, number=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "try", ":", "arg_0", ".", "page", ".", "_Func", "(", "arg_0", ".", "font", ",", "arg_1", ",", "arg_0", ".", "double_spacing", ")", "except", "ValueError", ":", "arg_0", ".", "add_page", "(", ")", "else", ":", "raise", "TypeError", "(", "\"Number of newlines must be an integer.\"", ")"], "function": "def Func(arg_0, arg_1=1):\r\n        \"\"\" Starts over again at the new line. If number is specified,\r\n            it will leave multiple lines.\"\"\"\r\n        if isinstance(arg_1, int):\r\n            try:\r\n                arg_0.page._Func(arg_0.font, arg_1, arg_0.double_spacing)\r\n            except ValueError:\r\n                arg_0.add_page()\r\n        else:\r\n            raise TypeError(\"Number of newlines must be an integer.\")", "path": "pypdflite/pdfdocument.py", "identifier": "PDFDocument.add_newline", "docstring": "Starts over again at the new line. If number is specified,\r\n            it will leave multiple lines.", "docstring_tokens": ["Starts", "over", "again", "at", "the", "new", "line", ".", "If", "number", "is", "specified", "it", "will", "leave", "multiple", "lines", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 258336}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/docs/examples/network/complete-network-example.py#L52-L91", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Create and initialize a network.", "language": "python", "parameters": "(dataSource)", "return_statement": "return network", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "_PARAMS_PATH", ",", "\"r\"", ")", "as", "f", ":", "arg_1", "=", "yaml", ".", "safe_load", "(", "f", ")", "[", "\"modelParams\"", "]", "arg_2", "=", "Network", "(", ")", "arg_2", ".", "addRegion", "(", "\"sensor\"", ",", "\"py.RecordSensor\"", ",", "'{}'", ")", "arg_3", "=", "arg_2", ".", "regions", "[", "\"sensor\"", "]", ".", "getSelf", "(", ")", "arg_3", ".", "encoder", "=", "createEncoder", "(", "arg_1", "[", "\"sensorParams\"", "]", "[", "\"encoders\"", "]", ")", "arg_3", ".", "dataSource", "=", "arg_0", "arg_1", "[", "\"spParams\"", "]", "[", "\"inputWidth\"", "]", "=", "arg_3", ".", "encoder", ".", "getWidth", "(", ")", "arg_2", ".", "addRegion", "(", "\"SP\"", ",", "\"py.SPRegion\"", ",", "json", ".", "dumps", "(", "arg_1", "[", "\"spParams\"", "]", ")", ")", "arg_2", ".", "addRegion", "(", "\"TM\"", ",", "\"py.TMRegion\"", ",", "json", ".", "dumps", "(", "arg_1", "[", "\"tmParams\"", "]", ")", ")", "arg_5", "=", "\"py.%s\"", "%", "arg_1", "[", "\"clParams\"", "]", ".", "pop", "(", "\"regionName\"", ")", "arg_2", ".", "addRegion", "(", "\"classifier\"", ",", "arg_5", ",", "json", ".", "dumps", "(", "arg_1", "[", "\"clParams\"", "]", ")", ")", "createSensorToClassifierLinks", "(", "arg_2", ",", "\"sensor\"", ",", "\"classifier\"", ")", "createDataOutLink", "(", "arg_2", ",", "\"sensor\"", ",", "\"SP\"", ")", "createFeedForwardLink", "(", "arg_2", ",", "\"SP\"", ",", "\"TM\"", ")", "createFeedForwardLink", "(", "arg_2", ",", "\"TM\"", ",", "\"classifier\"", ")", "createResetLink", "(", "arg_2", ",", "\"sensor\"", ",", "\"SP\"", ")", "createResetLink", "(", "arg_2", ",", "\"sensor\"", ",", "\"TM\"", ")", "arg_2", ".", "initialize", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n  \"\"\"Create and initialize a network.\"\"\"\n  with open(_PARAMS_PATH, \"r\") as f:\n    arg_1 = yaml.safe_load(f)[\"modelParams\"]\n\n  # Create a network that will hold the regions.\n  arg_2 = Network()\n\n  # Add a sensor region.\n  arg_2.addRegion(\"sensor\", \"py.RecordSensor\", '{}')\n\n  # Set the encoder and data source of the sensor region.\n  arg_3 = arg_2.regions[\"sensor\"].getSelf()\n  arg_3.encoder = createEncoder(arg_1[\"sensorParams\"][\"encoders\"])\n  arg_3.dataSource = arg_0\n\n  # Make sure the SP input width matches the sensor region output width.\n  arg_1[\"spParams\"][\"inputWidth\"] = arg_3.encoder.getWidth()\n\n  # Add SP and TM regions.\n  arg_2.addRegion(\"SP\", \"py.SPRegion\", json.dumps(arg_1[\"spParams\"]))\n  arg_2.addRegion(\"TM\", \"py.TMRegion\", json.dumps(arg_1[\"tmParams\"]))\n\n  # Add a classifier region.\n  arg_5 = \"py.%s\" % arg_1[\"clParams\"].pop(\"regionName\")\n  arg_2.addRegion(\"classifier\", arg_5, json.dumps(arg_1[\"clParams\"]))\n\n  # Add all links\n  createSensorToClassifierLinks(arg_2, \"sensor\", \"classifier\")\n  createDataOutLink(arg_2, \"sensor\", \"SP\")\n  createFeedForwardLink(arg_2, \"SP\", \"TM\")\n  createFeedForwardLink(arg_2, \"TM\", \"classifier\")\n  # Reset links are optional, since the sensor region does not send resets.\n  createResetLink(arg_2, \"sensor\", \"SP\")\n  createResetLink(arg_2, \"sensor\", \"TM\")\n\n  # Make sure all objects are initialized.\n  arg_2.initialize()\n\n  return arg_2", "path": "docs/examples/network/complete-network-example.py", "identifier": "createNetwork", "docstring": "Create and initialize a network.", "docstring_tokens": ["Create", "and", "initialize", "a", "network", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258337}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L68-L72", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Causes the bot to write its current state to backend.", "language": "python", "parameters": "(self, msg, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "send_message", "(", "arg_1", ".", "channel", ",", "\"Saving current state...\"", ")", "arg_0", ".", "_bot", ".", "plugins", ".", "Func_state", "(", ")", "arg_0", ".", "send_message", "(", "arg_1", ".", "channel", ",", "\"Done.\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Causes the bot to write its current state to backend.\"\"\"\n        arg_0.send_message(arg_1.channel, \"Saving current state...\")\n        arg_0._bot.plugins.Func_state()\n        arg_0.send_message(arg_1.channel, \"Done.\")", "path": "slackminion/plugins/core/core.py", "identifier": "Core.save", "docstring": "Causes the bot to write its current state to backend.", "docstring_tokens": ["Causes", "the", "bot", "to", "write", "its", "current", "state", "to", "backend", "."], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 258338}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L199-L214", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Deletes the specified table in Cloud Bigtable.\n        Raises google.api_core.exceptions.NotFound if the table does not exist.", "language": "python", "parameters": "(self, instance_id, table_id, project_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "get_instance", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", ".", "table", "(", "arg_2", "=", "arg_2", ")", "arg_4", ".", "delete", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Deletes the specified table in Cloud Bigtable.\n        Raises google.api_core.exceptions.NotFound if the table does not exist.\n\n        :type instance_id: str\n        :param instance_id: The ID of the Cloud Bigtable instance.\n        :type table_id: str\n        :param table_id: The ID of the table in Cloud Bigtable.\n        :type project_id: str\n        :param project_id: Optional, Google Cloud Platform project ID where the\n            BigTable exists. If set to None or missing,\n            the default project_id from the GCP connection is used.\n        \"\"\"\n        arg_4 = arg_0.get_instance(arg_1=arg_1, arg_3=arg_3).table(arg_2=arg_2)\n        arg_4.delete()", "path": "airflow/contrib/hooks/gcp_bigtable_hook.py", "identifier": "BigtableHook.delete_table", "docstring": "Deletes the specified table in Cloud Bigtable.\n        Raises google.api_core.exceptions.NotFound if the table does not exist.\n\n        :type instance_id: str\n        :param instance_id: The ID of the Cloud Bigtable instance.\n        :type table_id: str\n        :param table_id: The ID of the table in Cloud Bigtable.\n        :type project_id: str\n        :param project_id: Optional, Google Cloud Platform project ID where the\n            BigTable exists. If set to None or missing,\n            the default project_id from the GCP connection is used.", "docstring_tokens": ["Deletes", "the", "specified", "table", "in", "Cloud", "Bigtable", ".", "Raises", "google", ".", "api_core", ".", "exceptions", ".", "NotFound", "if", "the", "table", "does", "not", "exist", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258339}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/crunchyroll.py#L222-L239", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Returns the data for a certain media item.", "language": "python", "parameters": "(self, media_id, fields=None, schema=None)", "return_statement": "return self._api_call(\"info\", params, schema=schema)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "\"media_id\"", ":", "arg_1", "}", "if", "arg_2", ":", "arg_4", "[", "\"fields\"", "]", "=", "\",\"", ".", "join", "(", "arg_2", ")", "return", "arg_0", ".", "_api_call", "(", "\"info\"", ",", "arg_4", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n            Returns the data for a certain media item.\n\n            :param media_id: id that identifies the media item to be accessed.\n            :param fields: list of the media\"s field to be returned. By default the\n            API returns some fields, but others are not returned unless they are\n            explicity asked for. I have no real documentation on the fields, but\n            they all seem to start with the \"media.\" prefix (e.g. media.name,\n            media.stream_data).\n            :param schema: validation schema to use\n        \"\"\"\n        arg_4 = {\"media_id\": arg_1}\n\n        if arg_2:\n            arg_4[\"fields\"] = \",\".join(arg_2)\n\n        return arg_0._api_call(\"info\", arg_4, arg_3=arg_3)", "path": "src/streamlink/plugins/crunchyroll.py", "identifier": "CrunchyrollAPI.get_info", "docstring": "Returns the data for a certain media item.\n\n            :param media_id: id that identifies the media item to be accessed.\n            :param fields: list of the media\"s field to be returned. By default the\n            API returns some fields, but others are not returned unless they are\n            explicity asked for. I have no real documentation on the fields, but\n            they all seem to start with the \"media.\" prefix (e.g. media.name,\n            media.stream_data).\n            :param schema: validation schema to use", "docstring_tokens": ["Returns", "the", "data", "for", "a", "certain", "media", "item", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 258340}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L284-L292", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "count number of sites with cov=4, and number of variable sites.", "language": "python", "parameters": "(nex)", "return_statement": "return nomiss.shape[1], nsnps", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "array", "(", "[", "list", "(", "i", ".", "split", "(", ")", "[", "-", "1", "]", ")", "for", "i", "in", "arg_0", "]", ")", "arg_2", "=", "np", ".", "any", "(", "arg_1", "==", "\"N\"", ",", "axis", "=", "0", ")", "arg_3", "=", "arg_1", "[", ":", ",", "~", "arg_2", "]", "arg_4", "=", "np", ".", "invert", "(", "np", ".", "all", "(", "arg_3", "==", "arg_3", "[", "0", ",", ":", "]", ",", "axis", "=", "0", ")", ")", ".", "sum", "(", ")", "return", "arg_3", ".", "shape", "[", "1", "]", ",", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"\n    count number of sites with cov=4, and number of variable sites.\n    \"\"\"\n    arg_1 = np.array([list(i.split()[-1]) for i in arg_0])\n    arg_2 = np.any(arg_1==\"N\", axis=0)\n    arg_3 = arg_1[:, ~arg_2]\n    arg_4 = np.invert(np.all(arg_3==arg_3[0, :], axis=0)).sum()\n    return arg_3.shape[1], arg_4", "path": "ipyrad/analysis/twiist.py", "identifier": "count_var", "docstring": "count number of sites with cov=4, and number of variable sites.", "docstring_tokens": ["count", "number", "of", "sites", "with", "cov", "=", "4", "and", "number", "of", "variable", "sites", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258341}
{"url": "https://github.com/sendwithus/sendwithus_python/blob/8ae50d514febd44f7d9be3c838b4d92f99412832/sendwithus/__init__.py#L256-L277", "sha": "8ae50d514febd44f7d9be3c838b4d92f99412832", "docstring_summary": "API call to create a template", "language": "python", "parameters": "(\n        self,\n        name,\n        subject,\n        html,\n        text='',\n        timeout=None\n    )", "return_statement": "return self._api_request(\n            self.TEMPLATES_ENDPOINT,\n            self.HTTP_POST,\n            payload=payload,\n            timeout=timeout\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "''", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "{", "'name'", ":", "arg_1", ",", "'subject'", ":", "arg_2", ",", "'html'", ":", "arg_3", ",", "'text'", ":", "arg_4", "}", "return", "arg_0", ".", "_api_request", "(", "arg_0", ".", "TEMPLATES_ENDPOINT", ",", "arg_0", ".", "HTTP_POST", ",", "arg_6", "=", "arg_6", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(\n        arg_0,\n        arg_1,\n        arg_2,\n        arg_3,\n        arg_4='',\n        arg_5=None\n    ):\n        \"\"\" API call to create a template \"\"\"\n        arg_6 = {\n            'name': arg_1,\n            'subject': arg_2,\n            'html': arg_3,\n            'text': arg_4\n        }\n\n        return arg_0._api_request(\n            arg_0.TEMPLATES_ENDPOINT,\n            arg_0.HTTP_POST,\n            arg_6=arg_6,\n            arg_5=arg_5\n        )", "path": "sendwithus/__init__.py", "identifier": "api.create_template", "docstring": "API call to create a template", "docstring_tokens": ["API", "call", "to", "create", "a", "template"], "nwo": "sendwithus/sendwithus_python", "score": 0.2828805321802978, "idx": 258342}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/utils/alexa/conversation.py#L136-L174", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Handles IntentRequest Alexa request.", "language": "python", "parameters": "(self, request: dict)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "arg_3", "=", "arg_0", ".", "config", "[", "'intent_name'", "]", "arg_4", "=", "arg_0", ".", "config", "[", "'slot_name'", "]", "arg_5", "=", "arg_1", "[", "'request'", "]", "[", "'requestId'", "]", "arg_6", ":", "arg_2", "=", "arg_1", "[", "'request'", "]", "[", "'intent'", "]", "if", "arg_3", "!=", "arg_6", "[", "'name'", "]", ":", "log", ".", "error", "(", "f\"Wrong intent name received: {request_intent['name']} in request {request_id}\"", ")", "return", "{", "'error'", ":", "'wrong intent name'", "}", "if", "arg_4", "not", "in", "arg_6", "[", "'slots'", "]", ".", "keys", "(", ")", ":", "log", ".", "error", "(", "f'No slot named {slot_name} found in request {request_id}'", ")", "return", "{", "'error'", ":", "'no slot found'", "}", "arg_7", "=", "arg_6", "[", "'slots'", "]", "[", "arg_4", "]", "[", "'value'", "]", "arg_8", "=", "arg_0", ".", "_act", "(", "arg_7", ")", "if", "not", "arg_8", ":", "log", ".", "error", "(", "f'Some error during response generation for request {request_id}'", ")", "return", "{", "'error'", ":", "'error during response generation'", "}", "arg_9", ":", "RichMessage", "=", "arg_8", "[", "0", "]", "arg_9", ":", "list", "=", "arg_9", ".", "alexa", "(", ")", "if", "not", "arg_9", ":", "log", ".", "error", "(", "f'Some error during response generation for request {request_id}'", ")", "return", "{", "'error'", ":", "'error during response generation'", "}", "arg_10", "=", "arg_0", ".", "_generate_response", "(", "arg_9", "[", "0", "]", ",", "arg_1", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        \"\"\"Handles IntentRequest Alexa request.\n\n        Args:\n            request: Alexa request.\n        Returns:\n            response: \"response\" part of response dict conforming Alexa specification.\n        \"\"\"\n        arg_3 = arg_0.config['intent_name']\n        arg_4 = arg_0.config['slot_name']\n\n        arg_5 = arg_1['request']['requestId']\n        arg_6: arg_2 = arg_1['request']['intent']\n\n        if arg_3 != arg_6['name']:\n            log.error(f\"Wrong intent name received: {request_intent['name']} in request {request_id}\")\n            return {'error': 'wrong intent name'}\n\n        if arg_4 not in arg_6['slots'].keys():\n            log.error(f'No slot named {slot_name} found in request {request_id}')\n            return {'error': 'no slot found'}\n\n        arg_7 = arg_6['slots'][arg_4]['value']\n        arg_8 = arg_0._act(arg_7)\n\n        if not arg_8:\n            log.error(f'Some error during response generation for request {request_id}')\n            return {'error': 'error during response generation'}\n\n        arg_9: RichMessage = arg_8[0]\n        arg_9: list = arg_9.alexa()\n\n        if not arg_9:\n            log.error(f'Some error during response generation for request {request_id}')\n            return {'error': 'error during response generation'}\n\n        arg_10 = arg_0._generate_response(arg_9[0], arg_1)\n\n        return arg_10", "path": "deeppavlov/utils/alexa/conversation.py", "identifier": "Conversation._handle_intent", "docstring": "Handles IntentRequest Alexa request.\n\n        Args:\n            request: Alexa request.\n        Returns:\n            response: \"response\" part of response dict conforming Alexa specification.", "docstring_tokens": ["Handles", "IntentRequest", "Alexa", "request", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 258343}
{"url": "https://github.com/mehcode/python-saml/blob/33ed62018efa9ec15b551f309429de510fa44321/saml/signature.py#L113-L166", "sha": "33ed62018efa9ec15b551f309429de510fa44321", "docstring_summary": "Verify the signaure of an XML document with the given certificate.\n    Returns `True` if the document is signed with a valid signature.\n    Returns `False` if the document is not signed or if the signature is\n    invalid.", "language": "python", "parameters": "(xml, stream)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "import", "xmlsec", "arg_2", "=", "xmlsec", ".", "tree", ".", "find_node", "(", "arg_0", ",", "xmlsec", ".", "Node", ".", "SIGNATURE", ")", "if", "arg_2", "is", "None", ":", "return", "False", "arg_3", "=", "xmlsec", ".", "SignatureContext", "(", ")", "arg_3", ".", "register_id", "(", "arg_0", ")", "for", "arg_4", "in", "arg_0", ".", "xpath", "(", "\"//*[local-name()='Assertion']\"", ")", ":", "arg_3", ".", "register_id", "(", "arg_4", ")", "arg_5", "=", "None", "for", "arg_6", "in", "[", "xmlsec", ".", "KeyFormat", ".", "PEM", ",", "xmlsec", ".", "KeyFormat", ".", "CERT_PEM", "]", ":", "arg_1", ".", "seek", "(", "0", ")", "try", ":", "arg_5", "=", "xmlsec", ".", "Key", ".", "from_memory", "(", "arg_1", ",", "arg_6", ")", "break", "except", "ValueError", ":", "pass", "arg_3", ".", "key", "=", "arg_5", "try", ":", "arg_3", ".", "Func", "(", "arg_2", ")", "return", "True", "except", "Exception", ":", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Verify the signaure of an XML document with the given certificate.\n    Returns `True` if the document is signed with a valid signature.\n    Returns `False` if the document is not signed or if the signature is\n    invalid.\n\n    :param lxml.etree._Element xml: The document to sign\n    :param file stream: The private key to sign the document with\n\n    :rtype: Boolean\n    \"\"\"\n    # Import xmlsec here to delay initializing the C library in\n    # case we don't need it.\n    import xmlsec\n\n    # Find the <Signature/> node.\n    arg_2 = xmlsec.tree.find_node(arg_0, xmlsec.Node.SIGNATURE)\n    if arg_2 is None:\n        # No `signature` node found; we cannot Func\n        return False\n\n    # Create a digital signature context (no key manager is needed).\n    arg_3 = xmlsec.SignatureContext()\n\n    # Register <Response/> and <Assertion/>\n    arg_3.register_id(arg_0)\n    for arg_4 in arg_0.xpath(\"//*[local-name()='Assertion']\"):\n        arg_3.register_id(arg_4)\n\n    # Load the public key.\n    arg_5 = None\n    for arg_6 in [\n            xmlsec.KeyFormat.PEM,\n            xmlsec.KeyFormat.CERT_PEM]:\n        arg_1.seek(0)\n        try:\n            arg_5 = xmlsec.Key.from_memory(arg_1, arg_6)\n            break\n        except ValueError:  \n            # xmlsec now throws when it can't load the key\n            pass\n\n    # Set the key on the context.\n    arg_3.key = arg_5\n\n    # Verify the signature.\n    try:\n        arg_3.Func(arg_2)\n\n        return True\n\n    except Exception:\n        return False", "path": "saml/signature.py", "identifier": "verify", "docstring": "Verify the signaure of an XML document with the given certificate.\n    Returns `True` if the document is signed with a valid signature.\n    Returns `False` if the document is not signed or if the signature is\n    invalid.\n\n    :param lxml.etree._Element xml: The document to sign\n    :param file stream: The private key to sign the document with\n\n    :rtype: Boolean", "docstring_tokens": ["Verify", "the", "signaure", "of", "an", "XML", "document", "with", "the", "given", "certificate", ".", "Returns", "True", "if", "the", "document", "is", "signed", "with", "a", "valid", "signature", ".", "Returns", "False", "if", "the", "document", "is", "not", "signed", "or", "if", "the", "signature", "is", "invalid", "."], "nwo": "mehcode/python-saml", "score": 0.19800086512467352, "idx": 258344}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L758-L785", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Generate new sequences.", "language": "python", "parameters": "(self, batch_size, length, samples=1, fix_static=False,\n               fix_dynamic=False)", "return_statement": "return likelihood", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ")", ":", "arg_6", ",", "arg_7", "=", "arg_0", ".", "sample_static_prior", "(", "arg_3", ",", "arg_1", ",", "arg_4", ")", "arg_8", ",", "arg_7", "=", "arg_0", ".", "sample_dynamic_prior", "(", "arg_3", ",", "arg_1", ",", "arg_2", ",", "arg_5", ")", "arg_9", "=", "arg_0", ".", "decoder", "(", "(", "arg_8", ",", "arg_6", ")", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1, arg_4=False,\n               arg_5=False):\n    \"\"\"Generate new sequences.\n\n    Args:\n      batch_size: Number of sequences to Func.\n      length: Number of timesteps to Func for each sequence.\n      samples: Number of samples to draw from the latent distributions.\n      fix_static: Boolean for whether or not to share the same random\n        sample of the static latent variable `f` from its prior across\n        all examples.\n      fix_dynamic: Boolean for whether or not to share the same random\n        sample of the dynamic latent variable `z_{1:T}` from its prior\n        across all examples.\n\n    Returns:\n      A batched Independent distribution wrapping a set of Normal\n      distributions over the pixels of the Funcd sequences, where\n      the Independent distribution has event shape [height, width,\n      channels], batch shape [samples, batch_size, timesteps], and\n      sample shape [sample_shape, samples, batch_size, timesteps,\n      height, width, channels].\n    \"\"\"\n    arg_6, arg_7 = arg_0.sample_static_prior(arg_3, arg_1, arg_4)\n    arg_8, arg_7 = arg_0.sample_dynamic_prior(arg_3, arg_1, arg_2,\n                                                  arg_5)\n    arg_9 = arg_0.decoder((arg_8, arg_6))\n    return arg_9", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "DisentangledSequentialVAE.generate", "docstring": "Generate new sequences.\n\n    Args:\n      batch_size: Number of sequences to generate.\n      length: Number of timesteps to generate for each sequence.\n      samples: Number of samples to draw from the latent distributions.\n      fix_static: Boolean for whether or not to share the same random\n        sample of the static latent variable `f` from its prior across\n        all examples.\n      fix_dynamic: Boolean for whether or not to share the same random\n        sample of the dynamic latent variable `z_{1:T}` from its prior\n        across all examples.\n\n    Returns:\n      A batched Independent distribution wrapping a set of Normal\n      distributions over the pixels of the generated sequences, where\n      the Independent distribution has event shape [height, width,\n      channels], batch shape [samples, batch_size, timesteps], and\n      sample shape [sample_shape, samples, batch_size, timesteps,\n      height, width, channels].", "docstring_tokens": ["Generate", "new", "sequences", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258345}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L481-L494", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Function to find local minima.", "language": "python", "parameters": "(x, y)", "return_statement": "return x[np.r_[False, y[1:] < y[:-1]] & np.r_[y[:-1] < y[1:], False]]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", "[", "np", ".", "r_", "[", "False", ",", "arg_1", "[", "1", ":", "]", "<", "arg_1", "[", ":", "-", "1", "]", "]", "&", "np", ".", "r_", "[", "arg_1", "[", ":", "-", "1", "]", "<", "arg_1", "[", "1", ":", "]", ",", "False", "]", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Function to find local minima.\n\n    Parameters\n    ----------\n    x, y : array_like\n        1D arrays of the independent (x) and dependent (y) variables.\n\n    Returns\n    -------\n    array_like\n        Array of points in x where y has a local minimum.\n    \"\"\"\n    return arg_0[np.r_[False, arg_1[1:] < arg_1[:-1]] & np.r_[arg_1[:-1] < arg_1[1:], False]]", "path": "latools/helpers/helpers.py", "identifier": "findmins", "docstring": "Function to find local minima.\n\n    Parameters\n    ----------\n    x, y : array_like\n        1D arrays of the independent (x) and dependent (y) variables.\n\n    Returns\n    -------\n    array_like\n        Array of points in x where y has a local minimum.", "docstring_tokens": ["Function", "to", "find", "local", "minima", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 258346}
{"url": "https://github.com/georgemarshall/django-cryptography/blob/4c5f60fec98bcf71495d6084f801ea9c01c9a725/django_cryptography/fields.py#L184-L200", "sha": "4c5f60fec98bcf71495d6084f801ea9c01c9a725", "docstring_summary": "A get or create method for encrypted fields, we cache the field in\n    the module to avoid recreation. This also allows us to always return\n    the same class reference for a field.", "language": "python", "parameters": "(base_class)", "return_statement": "return FIELD_CACHE[base_class]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "not", "isinstance", "(", "arg_0", ",", "models", ".", "Field", ")", "arg_1", "=", "'Encrypted'", "+", "arg_0", ".", "__name__", "if", "arg_0", "not", "in", "arg_2", ":", "arg_2", "[", "arg_0", "]", "=", "type", "(", "arg_1", ",", "(", "EncryptedMixin", ",", "arg_0", ")", ",", "{", "'base_class'", ":", "arg_0", ",", "}", ")", "return", "arg_2", "[", "arg_0", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    A get or create method for encrypted fields, we cache the field in\n    the module to avoid recreation. This also allows us to always return\n    the same class reference for a field.\n\n    :type base_class: models.Field[T]\n    :rtype: models.Field[EncryptedMixin, T]\n    \"\"\"\n    assert not isinstance(arg_0, models.Field)\n    arg_1 = 'Encrypted' + arg_0.__name__\n    if arg_0 not in arg_2:\n        arg_2[arg_0] = type(arg_1,\n                                       (EncryptedMixin, arg_0), {\n                                           'base_class': arg_0,\n                                       })\n    return arg_2[arg_0]", "path": "django_cryptography/fields.py", "identifier": "get_encrypted_field", "docstring": "A get or create method for encrypted fields, we cache the field in\n    the module to avoid recreation. This also allows us to always return\n    the same class reference for a field.\n\n    :type base_class: models.Field[T]\n    :rtype: models.Field[EncryptedMixin, T]", "docstring_tokens": ["A", "get", "or", "create", "method", "for", "encrypted", "fields", "we", "cache", "the", "field", "in", "the", "module", "to", "avoid", "recreation", ".", "This", "also", "allows", "us", "to", "always", "return", "the", "same", "class", "reference", "for", "a", "field", "."], "nwo": "georgemarshall/django-cryptography", "score": 0.32069767954003625, "idx": 258347}
{"url": "https://github.com/Terrance/SkPy/blob/0f9489c94e8ec4d3effab4314497428872a80ad1/skpy/conn.py#L278-L310", "sha": "0f9489c94e8ec4d3effab4314497428872a80ad1", "docstring_summary": "Attempt to re-establish a connection using previously acquired tokens.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "tokenFile", ":", "raise", "SkypeAuthException", "(", "\"No token file specified\"", ")", "try", ":", "with", "open", "(", "arg_0", ".", "tokenFile", ",", "\"r\"", ")", "as", "f", ":", "arg_1", "=", "f", ".", "read", "(", ")", ".", "splitlines", "(", ")", "except", "OSError", ":", "raise", "SkypeAuthException", "(", "\"Token file doesn't exist or not readable\"", ")", "try", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_1", "arg_4", "=", "datetime", ".", "fromtimestamp", "(", "int", "(", "arg_4", ")", ")", "arg_6", "=", "datetime", ".", "fromtimestamp", "(", "int", "(", "arg_6", ")", ")", "except", "ValueError", ":", "raise", "SkypeAuthException", "(", "\"Token file is malformed\"", ")", "if", "datetime", ".", "now", "(", ")", ">=", "arg_4", ":", "raise", "SkypeAuthException", "(", "\"Token file has expired\"", ")", "arg_0", ".", "userId", "=", "arg_2", "arg_0", ".", "tokens", "[", "\"skype\"", "]", "=", "arg_3", "arg_0", ".", "tokenExpiry", "[", "\"skype\"", "]", "=", "arg_4", "if", "datetime", ".", "now", "(", ")", "<", "arg_6", ":", "arg_0", ".", "tokens", "[", "\"reg\"", "]", "=", "arg_5", "arg_0", ".", "tokenExpiry", "[", "\"reg\"", "]", "=", "arg_6", "arg_0", ".", "msgsHost", "=", "arg_7", "else", ":", "arg_0", ".", "getRegToken", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Attempt to re-establish a connection using previously acquired tokens.\n\n        If the Skype token is valid but the registration token is invalid, a new endpoint will be registered.\n\n        Raises:\n            .SkypeAuthException: if the token file cannot be used to authenticate\n        \"\"\"\n        if not arg_0.tokenFile:\n            raise SkypeAuthException(\"No token file specified\")\n        try:\n            with open(arg_0.tokenFile, \"r\") as f:\n                arg_1 = f.read().splitlines()\n        except OSError:\n            raise SkypeAuthException(\"Token file doesn't exist or not readable\")\n        try:\n            arg_2, arg_3, arg_4, arg_5, arg_6, arg_7 = arg_1\n            arg_4 = datetime.fromtimestamp(int(arg_4))\n            arg_6 = datetime.fromtimestamp(int(arg_6))\n        except ValueError:\n            raise SkypeAuthException(\"Token file is malformed\")\n        if datetime.now() >= arg_4:\n            raise SkypeAuthException(\"Token file has expired\")\n        arg_0.userId = arg_2\n        arg_0.tokens[\"skype\"] = arg_3\n        arg_0.tokenExpiry[\"skype\"] = arg_4\n        if datetime.now() < arg_6:\n            arg_0.tokens[\"reg\"] = arg_5\n            arg_0.tokenExpiry[\"reg\"] = arg_6\n            arg_0.msgsHost = arg_7\n        else:\n            arg_0.getRegToken()", "path": "skpy/conn.py", "identifier": "SkypeConnection.readToken", "docstring": "Attempt to re-establish a connection using previously acquired tokens.\n\n        If the Skype token is valid but the registration token is invalid, a new endpoint will be registered.\n\n        Raises:\n            .SkypeAuthException: if the token file cannot be used to authenticate", "docstring_tokens": ["Attempt", "to", "re", "-", "establish", "a", "connection", "using", "previously", "acquired", "tokens", "."], "nwo": "Terrance/SkPy", "score": 0.6983298124827472, "idx": 258348}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/lists.py#L47-L113", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Create a new list in your MailChimp account.", "language": "python", "parameters": "(self, data)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'name'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The list must have a name'", ")", "if", "'contact'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The list must have a contact'", ")", "if", "'company'", "not", "in", "arg_1", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a company'", ")", "if", "'address1'", "not", "in", "arg_1", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a address1'", ")", "if", "'city'", "not", "in", "arg_1", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a city'", ")", "if", "'state'", "not", "in", "arg_1", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a state'", ")", "if", "'zip'", "not", "in", "arg_1", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a zip'", ")", "if", "'country'", "not", "in", "arg_1", "[", "'contact'", "]", ":", "raise", "KeyError", "(", "'The list contact must have a country'", ")", "if", "'permission_reminder'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The list must have a permission_reminder'", ")", "if", "'campaign_defaults'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The list must have a campaign_defaults'", ")", "if", "'from_name'", "not", "in", "arg_1", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a from_name'", ")", "if", "'from_email'", "not", "in", "arg_1", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a from_email'", ")", "check_email", "(", "arg_1", "[", "'campaign_defaults'", "]", "[", "'from_email'", "]", ")", "if", "'subject'", "not", "in", "arg_1", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a subject'", ")", "if", "'language'", "not", "in", "arg_1", "[", "'campaign_defaults'", "]", ":", "raise", "KeyError", "(", "'The list campaign_defaults must have a language'", ")", "if", "'email_type_option'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The list must have an email_type_option'", ")", "if", "arg_1", "[", "'email_type_option'", "]", "not", "in", "[", "True", ",", "False", "]", ":", "raise", "TypeError", "(", "'The list email_type_option must be True or False'", ")", "arg_2", "=", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", ")", ",", "arg_1", "=", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "list_id", "=", "arg_2", "[", "'id'", "]", "else", ":", "arg_0", ".", "list_id", "=", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a new list in your MailChimp account.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"contact\": object*\n            {\n                \"company\": string*,\n                \"address1\": string*,\n                \"city\": string*,\n                \"state\": string*,\n                \"zip\": string*,\n                \"country\": string*\n            },\n            \"permission_reminder\": string*,\n            \"campaign_defaults\": object*\n            {\n                \"from_name\": string*,\n                \"from_email\": string*,\n                \"subject\": string*,\n                \"language\": string*\n            },\n            \"email_type_option\": boolean\n        }\n        \"\"\"\n        if 'name' not in arg_1:\n            raise KeyError('The list must have a name')\n        if 'contact' not in arg_1:\n            raise KeyError('The list must have a contact')\n        if 'company' not in arg_1['contact']:\n            raise KeyError('The list contact must have a company')\n        if 'address1' not in arg_1['contact']:\n            raise KeyError('The list contact must have a address1')\n        if 'city' not in arg_1['contact']:\n            raise KeyError('The list contact must have a city')\n        if 'state' not in arg_1['contact']:\n            raise KeyError('The list contact must have a state')\n        if 'zip' not in arg_1['contact']:\n            raise KeyError('The list contact must have a zip')\n        if 'country' not in arg_1['contact']:\n            raise KeyError('The list contact must have a country')\n        if 'permission_reminder' not in arg_1:\n            raise KeyError('The list must have a permission_reminder')\n        if 'campaign_defaults' not in arg_1:\n            raise KeyError('The list must have a campaign_defaults')\n        if 'from_name' not in arg_1['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_name')\n        if 'from_email' not in arg_1['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_email')\n        check_email(arg_1['campaign_defaults']['from_email'])\n        if 'subject' not in arg_1['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a subject')\n        if 'language' not in arg_1['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a language')\n        if 'email_type_option' not in arg_1:\n            raise KeyError('The list must have an email_type_option')\n        if arg_1['email_type_option'] not in [True, False]:\n            raise TypeError('The list email_type_option must be True or False')\n        arg_2 = arg_0._mc_client._post(url=arg_0._build_path(), arg_1=arg_1)\n        if arg_2 is not None:\n            arg_0.list_id = arg_2['id']\n        else:\n            arg_0.list_id = None\n        return arg_2", "path": "mailchimp3/entities/lists.py", "identifier": "Lists.create", "docstring": "Create a new list in your MailChimp account.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"contact\": object*\n            {\n                \"company\": string*,\n                \"address1\": string*,\n                \"city\": string*,\n                \"state\": string*,\n                \"zip\": string*,\n                \"country\": string*\n            },\n            \"permission_reminder\": string*,\n            \"campaign_defaults\": object*\n            {\n                \"from_name\": string*,\n                \"from_email\": string*,\n                \"subject\": string*,\n                \"language\": string*\n            },\n            \"email_type_option\": boolean\n        }", "docstring_tokens": ["Create", "a", "new", "list", "in", "your", "MailChimp", "account", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 258349}
{"url": "https://github.com/dogoncouch/lightcli/blob/e63093dfc4f983ec9c9571ff186bf114c1f782c3/lightcli.py#L83-L117", "sha": "e63093dfc4f983ec9c9571ff186bf114c1f782c3", "docstring_summary": "Get a multi-line string as input", "language": "python", "parameters": "(prompt='Multi-line input\\n' + \\\n        'Enter EOF on a blank line to end ' + \\\n        '(ctrl-D in *nix, ctrl-Z in windows)',\n        maxlines = None, maxlength = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'Multi-line input\\n'", "+", "'Enter EOF on a blank line to end '", "+", "'(ctrl-D in *nix, ctrl-Z in windows)'", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "]", "print", "(", "arg_0", ")", "arg_4", "=", "1", "try", ":", "while", "True", ":", "if", "arg_1", ":", "if", "arg_4", ">", "arg_1", ":", "break", "else", ":", "if", "arg_2", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", "[", ":", "arg_2", "]", ")", "else", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", ")", "arg_4", "+=", "1", "else", ":", "if", "arg_2", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", "[", ":", "arg_2", "]", ")", "else", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", ")", "except", "EOFError", ":", "pass", "finally", ":", "return", "'\\n'", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0='Multi-line input\\n' + \\\n        'Enter EOF on a blank line to end ' + \\\n        '(ctrl-D in *nix, ctrl-Z in windows)',\n        arg_1 = None, arg_2 = None):\n    \"\"\"Get a multi-line string as input\"\"\"\n    \n    arg_3 = []\n    print(arg_0)\n    arg_4 = 1\n\n    try:\n        while True:\n            \n            if arg_1:\n            \n                if arg_4 > arg_1:\n                    break\n                \n                else:\n                    if arg_2:\n                        arg_3.append(string_input('')[:arg_2])\n                    else:\n                        arg_3.append(string_input(''))\n                    arg_4 += 1\n            \n            else:\n                if arg_2:\n                    arg_3.append(string_input('')[:arg_2])\n                else:\n                    arg_3.append(string_input(''))\n\n    except EOFError:\n        pass\n    finally:\n        return '\\n'.join(arg_3)", "path": "lightcli.py", "identifier": "long_input", "docstring": "Get a multi-line string as input", "docstring_tokens": ["Get", "a", "multi", "-", "line", "string", "as", "input"], "nwo": "dogoncouch/lightcli", "score": 0.18941942438232184, "idx": 258350}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/smooth.py#L55-L69", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Convert a sigma in a Gaussian kernel to a FWHM value.", "language": "python", "parameters": "(sigma)", "return_statement": "return np.sqrt(8 * np.log(2)) * sigma", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "np", ".", "asarray", "(", "arg_0", ")", "return", "np", ".", "sqrt", "(", "8", "*", "np", ".", "log", "(", "2", ")", ")", "*", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Convert a sigma in a Gaussian kernel to a FWHM value.\n\n    Parameters\n    ----------\n    sigma: float or numpy.array\n       sigma value or values\n\n    Returns\n    -------\n    fwhm: float or numpy.array\n       fwhm values corresponding to `sigma` values\n    \"\"\"\n    arg_0 = np.asarray(arg_0)\n    return np.sqrt(8 * np.log(2)) * arg_0", "path": "boyle/nifti/smooth.py", "identifier": "sigma2fwhm", "docstring": "Convert a sigma in a Gaussian kernel to a FWHM value.\n\n    Parameters\n    ----------\n    sigma: float or numpy.array\n       sigma value or values\n\n    Returns\n    -------\n    fwhm: float or numpy.array\n       fwhm values corresponding to `sigma` values", "docstring_tokens": ["Convert", "a", "sigma", "in", "a", "Gaussian", "kernel", "to", "a", "FWHM", "value", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258351}
{"url": "https://github.com/OpenMath/py-openmath/blob/4906aa9ccf606f533675c28823772e07c30fd220/openmath/convert_pickle.py#L237-L253", "sha": "4906aa9ccf606f533675c28823772e07c30fd220", "docstring_summary": "Convert a tuple of OM objects into an OM object", "language": "python", "parameters": "(self, l)", "return_statement": "return om.OMApplication(elem=self.OMSymbol(module='Python', name='tuple'),\n                                arguments=l)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "om", ".", "OMApplication", "(", "elem", "=", "arg_0", ".", "OMSymbol", "(", "module", "=", "'Python'", ",", "name", "=", "'tuple'", ")", ",", "arguments", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert a tuple of OM objects into an OM object\n\n        EXAMPLES::\n\n            >>> from openmath import openmath as om\n            >>> from openmath.convert_pickle  import PickleConverter\n            >>> converter = PickleConverter()\n            >>> o = converter.Func([om.OMInteger(2), om.OMInteger(3)]); o\n            OMApplication(elem=OMSymbol(name='tuple', cd='Python', id=None, cdbase='http://python.org/'),\n                     arguments=[OMInteger(integer=2, id=None), OMInteger(integer=3, id=None)], id=None, cdbase=None)\n            >>> converter.to_python(o)\n            (2, 3)\n        \"\"\"\n        return om.OMApplication(elem=arg_0.OMSymbol(module='Python', name='tuple'),\n                                arguments=arg_1)", "path": "openmath/convert_pickle.py", "identifier": "PickleConverter.OMTuple", "docstring": "Convert a tuple of OM objects into an OM object\n\n        EXAMPLES::\n\n            >>> from openmath import openmath as om\n            >>> from openmath.convert_pickle  import PickleConverter\n            >>> converter = PickleConverter()\n            >>> o = converter.OMTuple([om.OMInteger(2), om.OMInteger(3)]); o\n            OMApplication(elem=OMSymbol(name='tuple', cd='Python', id=None, cdbase='http://python.org/'),\n                     arguments=[OMInteger(integer=2, id=None), OMInteger(integer=3, id=None)], id=None, cdbase=None)\n            >>> converter.to_python(o)\n            (2, 3)", "docstring_tokens": ["Convert", "a", "tuple", "of", "OM", "objects", "into", "an", "OM", "object"], "nwo": "OpenMath/py-openmath", "score": 0.18384731799856882, "idx": 258352}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L435-L471", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Convert bytes into human-readable representation.", "language": "python", "parameters": "(\n    number, thousandsSep=True, partition=False, base1024=True, appendBytes=True\n)", "return_statement": "return \"{}{}{}\".format(snum, magsuffix, bytesuffix)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ",", "arg_3", "=", "True", ",", "arg_4", "=", "True", ")", ":", "arg_5", "=", "\"\"", "arg_6", "=", "\"\"", "if", "arg_2", ":", "arg_7", "=", "0", "if", "arg_3", ":", "while", "arg_0", ">=", "1024", ":", "arg_7", "+=", "1", "arg_0", "=", "arg_0", ">>", "10", "else", ":", "while", "arg_0", ">=", "1000", ":", "arg_7", "+=", "1", "arg_0", "/=", "1000.0", "arg_5", "=", "[", "\"\"", ",", "\"K\"", ",", "\"M\"", ",", "\"G\"", ",", "\"T\"", ",", "\"P\"", "]", "[", "arg_7", "]", "if", "arg_4", ":", "if", "arg_0", "==", "1", ":", "arg_6", "=", "\" Byte\"", "else", ":", "arg_6", "=", "\" Bytes\"", "if", "arg_1", "and", "(", "arg_0", ">=", "1000", "or", "arg_5", ")", ":", "arg_8", "=", "\"{:,d}\"", ".", "format", "(", "arg_0", ")", "else", ":", "arg_8", "=", "str", "(", "arg_0", ")", "return", "\"{}{}{}\"", ".", "format", "(", "arg_8", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(\n    arg_0, arg_1=True, arg_2=False, arg_3=True, arg_4=True\n):\n    \"\"\"Convert bytes into human-readable representation.\"\"\"\n    arg_5 = \"\"\n    arg_6 = \"\"\n\n    if arg_2:\n        arg_7 = 0\n        if arg_3:\n            while arg_0 >= 1024:\n                arg_7 += 1\n                arg_0 = arg_0 >> 10\n        else:\n            while arg_0 >= 1000:\n                arg_7 += 1\n                arg_0 /= 1000.0\n        # TODO: use \"9 KB\" instead of \"9K Bytes\"?\n        # TODO use 'kibi' for base 1024?\n        # http://en.wikipedia.org/wiki/Kibi-#IEC_standard_prefixes\n        arg_5 = [\"\", \"K\", \"M\", \"G\", \"T\", \"P\"][arg_7]\n\n    if arg_4:\n        if arg_0 == 1:\n            arg_6 = \" Byte\"\n        else:\n            arg_6 = \" Bytes\"\n\n    if arg_1 and (arg_0 >= 1000 or arg_5):\n        # locale.setlocale(locale.LC_ALL, \"\")\n        # # TODO: make precision configurable\n        # snum = locale.format(\"%d\", number, thousandsSep)\n        arg_8 = \"{:,d}\".format(arg_0)\n    else:\n        arg_8 = str(arg_0)\n\n    return \"{}{}{}\".format(arg_8, arg_5, arg_6)", "path": "wsgidav/util.py", "identifier": "byte_number_string", "docstring": "Convert bytes into human-readable representation.", "docstring_tokens": ["Convert", "bytes", "into", "human", "-", "readable", "representation", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 258353}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpi.py#L170-L218", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Downloads the latest Ubuntu image and writes it to a microSD card.", "language": "python", "parameters": "(self, yes=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_0", ".", "assume_localhost", "(", ")", "arg_1", "=", "int", "(", "arg_1", ")", "if", "not", "arg_0", ".", "dryrun", ":", "arg_2", "=", "'SD card present at %s? '", "%", "arg_0", ".", "env", ".", "sd_device", "arg_3", "=", "raw_input", "(", "arg_2", ")", ".", "strip", "(", ")", "print", "(", "'inp:'", ",", "arg_3", ")", "if", "not", "arg_1", "and", "arg_3", "and", "not", "arg_3", ".", "lower", "(", ")", ".", "startswith", "(", "'y'", ")", ":", "return", "arg_4", "=", "arg_0", ".", "local_renderer", "arg_4", ".", "local", "(", "'ls {sd_device}'", ")", "arg_4", ".", "env", ".", "ubuntu_image_fn", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "split", "(", "arg_0", ".", "env", ".", "ubuntu_download_url", ")", "[", "-", "1", "]", ")", "arg_4", ".", "local", "(", "'[ ! -f {ubuntu_image_fn} ] && wget {ubuntu_download_url} || true'", ")", "with", "arg_0", ".", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_4", ".", "sudo", "(", "'[ -d \"{sd_media_mount_dir}\" ] && umount {sd_media_mount_dir}'", ")", "with", "arg_0", ".", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_4", ".", "sudo", "(", "'[ -d \"{sd_media_mount_dir2}\" ] && umount {sd_media_mount_dir2}'", ")", "arg_4", ".", "pc", "(", "'Writing the image onto the card.'", ")", "arg_4", ".", "sudo", "(", "'xzcat {ubuntu_image_fn} | dd bs=4M of={sd_device}'", ")", "arg_4", ".", "run", "(", "'sync'", ")"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"\n        Downloads the latest Ubuntu image and writes it to a microSD card.\n\n        Based on the instructions from:\n\n            https://wiki.ubuntu.com/ARM/RaspberryPi\n\n        For recommended SD card brands, see:\n\n            http://elinux.org/RPi_SD_cards\n\n        Note, if you get an error like:\n\n            Kernel panic-not syncing: VFS: unable to mount root fs\n\n        that means the SD card is corrupted. Try re-imaging the card or use a different card.\n        \"\"\"\n        arg_0.assume_localhost()\n\n        arg_1 = int(arg_1)\n\n        if not arg_0.dryrun:\n            arg_2 = 'SD card present at %s? ' % arg_0.env.sd_device\n            arg_3 = raw_input(arg_2).strip()\n            print('inp:', arg_3)\n            if not arg_1 and arg_3 and not arg_3.lower().startswith('y'):\n                return\n\n        arg_4 = arg_0.local_renderer\n\n        # Confirm SD card is present.\n        arg_4.local('ls {sd_device}')\n\n        # Download image.\n        arg_4.env.ubuntu_image_fn = os.path.abspath(os.path.split(arg_0.env.ubuntu_download_url)[-1])\n        arg_4.local('[ ! -f {ubuntu_image_fn} ] && wget {ubuntu_download_url} || true')\n\n        # Ensure SD card is unmounted.\n        with arg_0.settings(warn_only=True):\n            arg_4.sudo('[ -d \"{sd_media_mount_dir}\" ] && umount {sd_media_mount_dir}')\n        with arg_0.settings(warn_only=True):\n            arg_4.sudo('[ -d \"{sd_media_mount_dir2}\" ] && umount {sd_media_mount_dir2}')\n\n        arg_4.pc('Writing the image onto the card.')\n        arg_4.sudo('xzcat {ubuntu_image_fn} | dd bs=4M of={sd_device}')\n\n        # Flush all writes to disk.\n        arg_4.run('sync')", "path": "burlap/rpi.py", "identifier": "RaspberryPiSatchel.init_ubuntu_disk", "docstring": "Downloads the latest Ubuntu image and writes it to a microSD card.\n\n        Based on the instructions from:\n\n            https://wiki.ubuntu.com/ARM/RaspberryPi\n\n        For recommended SD card brands, see:\n\n            http://elinux.org/RPi_SD_cards\n\n        Note, if you get an error like:\n\n            Kernel panic-not syncing: VFS: unable to mount root fs\n\n        that means the SD card is corrupted. Try re-imaging the card or use a different card.", "docstring_tokens": ["Downloads", "the", "latest", "Ubuntu", "image", "and", "writes", "it", "to", "a", "microSD", "card", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258354}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L614-L623", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Outputs a list of all plugins Streamlink has loaded.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "list", "(", "streamlink", ".", "get_plugins", "(", ")", ".", "keys", "(", ")", ")", "arg_1", "=", "\", \"", ".", "join", "(", "sorted", "(", "arg_0", ")", ")", "if", "console", ".", "json", ":", "console", ".", "msg_json", "(", "arg_0", ")", "else", ":", "console", ".", "msg", "(", "\"Loaded plugins: {0}\"", ",", "arg_1", ")"], "function": "def Func():\n    \"\"\"Outputs a list of all plugins Streamlink has loaded.\"\"\"\n\n    arg_0 = list(streamlink.get_plugins().keys())\n    arg_1 = \", \".join(sorted(arg_0))\n\n    if console.json:\n        console.msg_json(arg_0)\n    else:\n        console.msg(\"Loaded plugins: {0}\", arg_1)", "path": "src/streamlink_cli/main.py", "identifier": "print_plugins", "docstring": "Outputs a list of all plugins Streamlink has loaded.", "docstring_tokens": ["Outputs", "a", "list", "of", "all", "plugins", "Streamlink", "has", "loaded", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 258355}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/display.py#L791-L831", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Set the axis scaling", "language": "python", "parameters": "(axes, ax_type, which)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "dict", "(", ")", "if", "arg_2", "==", "'x'", ":", "arg_4", "=", "'linthreshx'", "arg_5", "=", "'basex'", "arg_6", "=", "'linscalex'", "arg_7", "=", "arg_0", ".", "set_xscale", "arg_8", "=", "arg_0", ".", "set_xlim", "else", ":", "arg_4", "=", "'linthreshy'", "arg_5", "=", "'basey'", "arg_6", "=", "'linscaley'", "arg_7", "=", "arg_0", ".", "set_yscale", "arg_8", "=", "arg_0", ".", "set_ylim", "if", "arg_1", "==", "'mel'", ":", "arg_9", "=", "'symlog'", "arg_3", "[", "arg_4", "]", "=", "1000.0", "arg_3", "[", "arg_5", "]", "=", "2", "elif", "arg_1", "==", "'log'", ":", "arg_9", "=", "'symlog'", "arg_3", "[", "arg_5", "]", "=", "2", "arg_3", "[", "arg_4", "]", "=", "core", ".", "note_to_hz", "(", "'C2'", ")", "arg_3", "[", "arg_6", "]", "=", "0.5", "elif", "arg_1", "in", "[", "'cqt'", ",", "'cqt_hz'", ",", "'cqt_note'", "]", ":", "arg_9", "=", "'log'", "arg_3", "[", "arg_5", "]", "=", "2", "elif", "arg_1", "==", "'tempo'", ":", "arg_9", "=", "'log'", "arg_3", "[", "arg_5", "]", "=", "2", "arg_8", "(", "16", ",", "480", ")", "else", ":", "return", "arg_7", "(", "arg_9", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''Set the axis scaling'''\n\n    arg_3 = dict()\n    if arg_2 == 'x':\n        arg_4 = 'linthreshx'\n        arg_5 = 'basex'\n        arg_6 = 'linscalex'\n        arg_7 = arg_0.set_xscale\n        arg_8 = arg_0.set_xlim\n    else:\n        arg_4 = 'linthreshy'\n        arg_5 = 'basey'\n        arg_6 = 'linscaley'\n        arg_7 = arg_0.set_yscale\n        arg_8 = arg_0.set_ylim\n\n    # Map ticker scales\n    if arg_1 == 'mel':\n        arg_9 = 'symlog'\n        arg_3[arg_4] = 1000.0\n        arg_3[arg_5] = 2\n\n    elif arg_1 == 'log':\n        arg_9 = 'symlog'\n        arg_3[arg_5] = 2\n        arg_3[arg_4] = core.note_to_hz('C2')\n        arg_3[arg_6] = 0.5\n\n    elif arg_1 in ['cqt', 'cqt_hz', 'cqt_note']:\n        arg_9 = 'log'\n        arg_3[arg_5] = 2\n\n    elif arg_1 == 'tempo':\n        arg_9 = 'log'\n        arg_3[arg_5] = 2\n        arg_8(16, 480)\n    else:\n        return\n\n    arg_7(arg_9, **arg_3)", "path": "librosa/display.py", "identifier": "__scale_axes", "docstring": "Set the axis scaling", "docstring_tokens": ["Set", "the", "axis", "scaling"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258356}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/arma.py#L30-L127", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Computes power spectral density given ARMA values.", "language": "python", "parameters": "(A=None, B=None, rho=1., T=1., NFFT=4096, sides='default',\n        norm=False)", "return_statement": "return psd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "1.", ",", "arg_3", "=", "1.", ",", "arg_4", "=", "4096", ",", "arg_5", "=", "'default'", ",", "arg_6", "=", "False", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "4096", "if", "arg_0", "is", "None", "and", "arg_1", "is", "None", ":", "raise", "ValueError", "(", "\"Either AR or MA model must be provided\"", ")", "arg_7", "=", "np", ".", "zeros", "(", "arg_4", ",", "dtype", "=", "complex", ")", "if", "arg_0", "is", "not", "None", ":", "arg_8", "=", "len", "(", "arg_0", ")", "arg_9", "=", "np", ".", "zeros", "(", "arg_4", ",", "dtype", "=", "complex", ")", "arg_9", "[", "0", "]", "=", "1.", "+", "0j", "for", "arg_10", "in", "range", "(", "0", ",", "arg_8", ")", ":", "arg_9", "[", "arg_10", "+", "1", "]", "=", "arg_0", "[", "arg_10", "]", "arg_11", "=", "fft", "(", "arg_9", ",", "arg_4", ")", "if", "arg_1", "is", "not", "None", ":", "arg_12", "=", "len", "(", "arg_1", ")", "arg_13", "=", "np", ".", "zeros", "(", "arg_4", ",", "dtype", "=", "complex", ")", "arg_13", "[", "0", "]", "=", "1.", "+", "0j", "for", "arg_10", "in", "range", "(", "0", ",", "arg_12", ")", ":", "arg_13", "[", "arg_10", "+", "1", "]", "=", "arg_1", "[", "arg_10", "]", "arg_14", "=", "fft", "(", "arg_13", ",", "arg_4", ")", "if", "arg_0", "is", "not", "None", "and", "arg_1", "is", "not", "None", ":", "arg_7", "=", "arg_2", "/", "arg_3", "*", "abs", "(", "arg_14", ")", "**", "2.", "/", "abs", "(", "arg_11", ")", "**", "2.", "elif", "arg_0", "is", "not", "None", ":", "arg_7", "=", "arg_2", "/", "arg_3", "/", "abs", "(", "arg_11", ")", "**", "2.", "elif", "arg_1", "is", "not", "None", ":", "arg_7", "=", "arg_2", "/", "arg_3", "*", "abs", "(", "arg_14", ")", "**", "2.", "arg_7", "=", "np", ".", "real", "(", "arg_7", ")", "if", "arg_5", "!=", "'default'", ":", "from", ".", "import", "tools", "assert", "arg_5", "in", "[", "'centerdc'", "]", "if", "arg_5", "==", "'centerdc'", ":", "arg_7", "=", "tools", ".", "twosided_2_centerdc", "(", "arg_7", ")", "if", "arg_6", "==", "True", ":", "arg_7", "/=", "max", "(", "arg_7", ")", "return", "arg_7"], "function": "def Func(arg_0=None, arg_1=None, arg_2=1., arg_3=1., arg_4=4096, arg_5='default',\n        arg_6=False):\n    r\"\"\"Computes power spectral density given ARMA values.\n\n    This function computes the power spectral density values\n    given the ARMA parameters of an ARMA model. It assumes that\n    the driving sequence is a white noise process of zero mean and\n    variance :math:`\\rho_w`. The sampling frequency and noise variance are\n    used to scale the PSD output, which length is set by the user with the\n    `NFFT` parameter.\n\n    :param array A:   Array of AR parameters (complex or real)\n    :param array B:   Array of MA parameters (complex or real)\n    :param float rho: White noise variance to scale the returned PSD\n    :param float T:   Sample interval in seconds to scale the returned PSD\n    :param int NFFT:  Final size of the PSD\n    :param str sides: Default PSD is two-sided, but sides can be set to centerdc.\n\n    .. warning:: By convention, the AR or MA arrays does not contain the\n        A0=1 value.\n\n    If :attr:`B` is None, the model is a pure AR model. If :attr:`A` is None,\n    the model is a pure MA model.\n\n    :return: two-sided PSD\n\n    .. rubric:: Details:\n\n    AR case: the power spectral density is:\n\n    .. math:: P_{ARMA}(f) = T \\rho_w \\left|\\frac{B(f)}{A(f)}\\right|^2\n\n    where:\n\n    .. math:: A(f) = 1 + \\sum_{k=1}^q b(k) e^{-j2\\pi fkT}\n    .. math:: B(f) = 1 + \\sum_{k=1}^p a(k) e^{-j2\\pi fkT}\n\n    .. rubric:: **Example:**\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        import spectrum.arma\n        from pylab import plot, log10, legend\n        plot(10*log10(spectrum.arma.Func([1,0.5],[0.5,0.5])), label='ARMA(2,2)')\n        plot(10*log10(spectrum.arma.Func([1,0.5],None)), label='AR(2)')\n        plot(10*log10(spectrum.arma.Func(None,[0.5,0.5])), label='MA(2)')\n        legend()\n\n    :References: [Marple]_\n    \"\"\"\n    if arg_4 is None:\n        arg_4 = 4096\n\n    if arg_0 is None and arg_1 is None:\n        raise ValueError(\"Either AR or MA model must be provided\")\n\n    arg_7 = np.zeros(arg_4, dtype=complex)\n\n    if arg_0 is not None:\n        arg_8 = len(arg_0)\n        arg_9 = np.zeros(arg_4, dtype=complex)\n        arg_9[0] = 1.+0j\n        for arg_10 in range(0, arg_8):\n            arg_9[arg_10+1] = arg_0[arg_10]\n        arg_11 = fft(arg_9, arg_4)\n\n    if arg_1 is not None:\n        arg_12 = len(arg_1)\n        arg_13 = np.zeros(arg_4, dtype=complex)\n        arg_13[0] = 1.+0j\n        for arg_10 in range(0, arg_12):\n            arg_13[arg_10+1] = arg_1[arg_10]\n        arg_14 = fft(arg_13, arg_4)\n\n    # Changed in version 0.6.9 (divided by T instead of multiply)\n    if arg_0 is not None and arg_1 is not None:\n        arg_7 = arg_2 / arg_3 * abs(arg_14)**2. / abs(arg_11)**2.\n    elif arg_0 is not None:\n        arg_7 = arg_2 / arg_3 / abs(arg_11)**2.\n    elif arg_1 is not None:\n        arg_7 = arg_2 / arg_3 * abs(arg_14)**2.\n\n\n    arg_7 = np.real(arg_7)\n    # The PSD is a twosided PSD.\n    # to obtain the centerdc\n    if arg_5 != 'default':\n        from . import tools\n        assert arg_5 in ['centerdc']\n        if arg_5 == 'centerdc':\n            arg_7 = tools.twosided_2_centerdc(arg_7)\n\n    if arg_6 == True:\n        arg_7 /= max(arg_7)\n\n    return arg_7", "path": "src/spectrum/arma.py", "identifier": "arma2psd", "docstring": "r\"\"\"Computes power spectral density given ARMA values.\n\n    This function computes the power spectral density values\n    given the ARMA parameters of an ARMA model. It assumes that\n    the driving sequence is a white noise process of zero mean and\n    variance :math:`\\rho_w`. The sampling frequency and noise variance are\n    used to scale the PSD output, which length is set by the user with the\n    `NFFT` parameter.\n\n    :param array A:   Array of AR parameters (complex or real)\n    :param array B:   Array of MA parameters (complex or real)\n    :param float rho: White noise variance to scale the returned PSD\n    :param float T:   Sample interval in seconds to scale the returned PSD\n    :param int NFFT:  Final size of the PSD\n    :param str sides: Default PSD is two-sided, but sides can be set to centerdc.\n\n    .. warning:: By convention, the AR or MA arrays does not contain the\n        A0=1 value.\n\n    If :attr:`B` is None, the model is a pure AR model. If :attr:`A` is None,\n    the model is a pure MA model.\n\n    :return: two-sided PSD\n\n    .. rubric:: Details:\n\n    AR case: the power spectral density is:\n\n    .. math:: P_{ARMA}(f) = T \\rho_w \\left|\\frac{B(f)}{A(f)}\\right|^2\n\n    where:\n\n    .. math:: A(f) = 1 + \\sum_{k=1}^q b(k) e^{-j2\\pi fkT}\n    .. math:: B(f) = 1 + \\sum_{k=1}^p a(k) e^{-j2\\pi fkT}\n\n    .. rubric:: **Example:**\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        import spectrum.arma\n        from pylab import plot, log10, legend\n        plot(10*log10(spectrum.arma.arma2psd([1,0.5],[0.5,0.5])), label='ARMA(2,2)')\n        plot(10*log10(spectrum.arma.arma2psd([1,0.5],None)), label='AR(2)')\n        plot(10*log10(spectrum.arma.arma2psd(None,[0.5,0.5])), label='MA(2)')\n        legend()\n\n    :References: [Marple]_", "docstring_tokens": ["r", "Computes", "power", "spectral", "density", "given", "ARMA", "values", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 258357}
{"url": "https://github.com/hit9/rux/blob/d7f60722658a3b83ac6d7bb3ca2790ac9c926b59/rux/generator.py#L27-L34", "sha": "d7f60722658a3b83ac6d7bb3ca2790ac9c926b59", "docstring_summary": "shortcut to render data with `template` and then write to `path`.\n    Just add exception catch to `renderer.render_to`", "language": "python", "parameters": "(path, template, **data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "try", ":", "renderer", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", "except", "JinjaTemplateNotFound", "as", "e", ":", "logger", ".", "error", "(", "e", ".", "__doc__", "+", "', Template: %r'", "%", "arg_1", ")", "sys", ".", "exit", "(", "e", ".", "exit_code", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"shortcut to render data with `template` and then write to `path`.\n    Just add exception catch to `renderer.Func`\"\"\"\n    try:\n        renderer.Func(arg_0, arg_1, **arg_2)\n    except JinjaTemplateNotFound as e:\n        logger.error(e.__doc__ + ', Template: %r' % arg_1)\n        sys.exit(e.exit_code)", "path": "rux/generator.py", "identifier": "render_to", "docstring": "shortcut to render data with `template` and then write to `path`.\n    Just add exception catch to `renderer.render_to`", "docstring_tokens": ["shortcut", "to", "render", "data", "with", "template", "and", "then", "write", "to", "path", ".", "Just", "add", "exception", "catch", "to", "renderer", ".", "render_to"], "nwo": "hit9/rux", "score": 0.18892572326127263, "idx": 258358}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/animation/indexed.py#L34-L43", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Override this method to get called right after ``self.index`` is set.", "language": "python", "parameters": "(self, old_index)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "animation", ":", "log", ".", "debug", "(", "'%s: %s'", ",", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_0", ".", "current_animation", ".", "title", ")", "arg_0", ".", "frames", "=", "arg_0", ".", "animation", ".", "generate_frames", "(", "False", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Override this method to get called right after ``self.index`` is set.\n\n        :param int old_index: the previous index, before it was changed.\n        \"\"\"\n        if arg_0.animation:\n            log.debug('%s: %s',\n                      arg_0.__class__.__name__, arg_0.current_animation.title)\n            arg_0.frames = arg_0.animation.generate_frames(False)", "path": "bibliopixel/animation/indexed.py", "identifier": "Indexed._on_index", "docstring": "Override this method to get called right after ``self.index`` is set.\n\n        :param int old_index: the previous index, before it was changed.", "docstring_tokens": ["Override", "this", "method", "to", "get", "called", "right", "after", "self", ".", "index", "is", "set", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 258359}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/profileapp.py#L97-L105", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "list profiles in a given root directory", "language": "python", "parameters": "(path)", "return_statement": "return profiles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "listdir", "(", "arg_0", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_3", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_4", ")", "and", "arg_3", ".", "startswith", "(", "'profile_'", ")", ":", "arg_2", ".", "append", "(", "arg_3", ".", "split", "(", "'_'", ",", "1", ")", "[", "-", "1", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"list profiles in a given root directory\"\"\"\n    arg_1 = os.listdir(arg_0)\n    arg_2 = []\n    for arg_3 in arg_1:\n        arg_4 = os.path.join(arg_0, arg_3)\n        if os.path.isdir(arg_4) and arg_3.startswith('profile_'):\n            arg_2.append(arg_3.split('_',1)[-1])\n    return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/profileapp.py", "identifier": "list_profiles_in", "docstring": "list profiles in a given root directory", "docstring_tokens": ["list", "profiles", "in", "a", "given", "root", "directory"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258360}
{"url": "https://github.com/nicolargo/pymdstat/blob/97fd47117e687463205fb562269feb9f95d59620/pymdstat/pymdstat.py#L98-L100", "sha": "97fd47117e687463205fb562269feb9f95d59620", "docstring_summary": "Return a list of personalities readed from the input line.", "language": "python", "parameters": "(self, line)", "return_statement": "return [split('\\W+', i)[1] for i in line.split(':')[1].split(' ') if i.startswith('[')]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "[", "split", "(", "'\\W+'", ",", "arg_2", ")", "[", "1", "]", "for", "arg_2", "in", "arg_1", ".", "split", "(", "':'", ")", "[", "1", "]", ".", "split", "(", "' '", ")", "if", "arg_2", ".", "startswith", "(", "'['", ")", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a list of personalities readed from the input line.\"\"\"\n        return [split('\\W+', arg_2)[1] for arg_2 in arg_1.split(':')[1].split(' ') if arg_2.startswith('[')]", "path": "pymdstat/pymdstat.py", "identifier": "MdStat.get_personalities", "docstring": "Return a list of personalities readed from the input line.", "docstring_tokens": ["Return", "a", "list", "of", "personalities", "readed", "from", "the", "input", "line", "."], "nwo": "nicolargo/pymdstat", "score": 0.2804084716934856, "idx": 258361}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L45-L75", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Asynchronously download a set of lsst-texmf BibTeX bibliographies from\n    GitHub.", "language": "python", "parameters": "(bibtex_names)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "'https://raw.githubusercontent.com/lsst/lsst-texmf/master/texmf/'", "'bibtex/bib/{name}.bib'", ")", "arg_2", "=", "[", "arg_1", ".", "format", "(", "name", "=", "name", ")", "for", "name", "in", "arg_0", "]", "arg_3", "=", "[", "]", "async", "with", "ClientSession", "(", ")", "as", "session", ":", "for", "arg_4", "in", "arg_2", ":", "arg_5", "=", "asyncio", ".", "ensure_future", "(", "_download_text", "(", "arg_4", ",", "session", ")", ")", "arg_3", ".", "append", "(", "arg_5", ")", "return", "await", "asyncio", ".", "gather", "(", "*", "arg_3", ")"], "function": "async def Func(arg_0):\n    \"\"\"Asynchronously download a set of lsst-texmf BibTeX bibliographies from\n    GitHub.\n\n    Parameters\n    ----------\n    bibtex_names : sequence of `str`\n        Names of lsst-texmf BibTeX files to download. For example:\n\n        .. code-block:: python\n\n           ['lsst', 'lsst-dm', 'refs', 'books', 'refs_ads']\n\n    Returns\n    -------\n    bibtexs : `list` of `str`\n        List of BibTeX file content, in the same order as ``bibtex_names``.\n    \"\"\"\n    arg_1 = (\n        'https://raw.githubusercontent.com/lsst/lsst-texmf/master/texmf/'\n        'bibtex/bib/{name}.bib'\n    )\n    arg_2 = [arg_1.format(name=name) for name in arg_0]\n\n    arg_3 = []\n    async with ClientSession() as session:\n        for arg_4 in arg_2:\n            arg_5 = asyncio.ensure_future(_download_text(arg_4, session))\n            arg_3.append(arg_5)\n\n        return await asyncio.gather(*arg_3)", "path": "lsstprojectmeta/tex/lsstbib.py", "identifier": "_download_lsst_bibtex", "docstring": "Asynchronously download a set of lsst-texmf BibTeX bibliographies from\n    GitHub.\n\n    Parameters\n    ----------\n    bibtex_names : sequence of `str`\n        Names of lsst-texmf BibTeX files to download. For example:\n\n        .. code-block:: python\n\n           ['lsst', 'lsst-dm', 'refs', 'books', 'refs_ads']\n\n    Returns\n    -------\n    bibtexs : `list` of `str`\n        List of BibTeX file content, in the same order as ``bibtex_names``.", "docstring_tokens": ["Asynchronously", "download", "a", "set", "of", "lsst", "-", "texmf", "BibTeX", "bibliographies", "from", "GitHub", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 258362}
{"url": "https://github.com/JukeboxPipeline/jukedj/blob/d4159961c819c26792a278981ee68106ee15f3f3/src/jukedj/models.py#L383-L397", "sha": "d4159961c819c26792a278981ee68106ee15f3f3", "docstring_summary": "Add or create the default assettypes for the given project", "language": "python", "parameters": "(project)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "DEFAULT_ASSETTYPES", ":", "arg_3", ",", "arg_4", "=", "Atype", ".", "objects", ".", "get_or_create", "(", "arg_1", "=", "arg_1", ",", "defaults", "=", "{", "'description'", ":", "arg_2", "}", ")", "arg_3", ".", "projects", ".", "add", "(", "arg_0", ")", "arg_3", ".", "full_clean", "(", ")", "arg_3", ".", "save", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Add or create the default assettypes for the given project\n\n    :param project: the project that needs default assettypes\n    :type project: :class:`muke.models.Project`\n    :returns: None\n    :rtype: None\n    :raises: None\n    \"\"\"\n    # create assettypes for project\n    for arg_1, arg_2 in DEFAULT_ASSETTYPES:\n        arg_3, arg_4 = Atype.objects.get_or_create(arg_1=arg_1, defaults={'description': arg_2})\n        arg_3.projects.add(arg_0)\n        arg_3.full_clean()\n        arg_3.save()", "path": "src/jukedj/models.py", "identifier": "add_default_atypes", "docstring": "Add or create the default assettypes for the given project\n\n    :param project: the project that needs default assettypes\n    :type project: :class:`muke.models.Project`\n    :returns: None\n    :rtype: None\n    :raises: None", "docstring_tokens": ["Add", "or", "create", "the", "default", "assettypes", "for", "the", "given", "project"], "nwo": "JukeboxPipeline/jukedj", "score": 0.09252797783733271, "idx": 258363}
{"url": "https://github.com/Cairnarvon/uptime/blob/1ddfd06bb300c00e6dc4bd2a9ddf9bf1aa27b1bb/src/__init__.py#L188-L196", "sha": "1ddfd06bb300c00e6dc4bd2a9ddf9bf1aa27b1bb", "docstring_summary": "Returns uptime in seconds or None, on MINIX.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "arg_0", "=", "open", "(", "'/proc/uptime'", ",", "'r'", ")", "arg_1", "=", "float", "(", "arg_0", ".", "read", "(", ")", ")", "arg_0", ".", "close", "(", ")", "return", "arg_1", "except", "(", "IOError", ",", "ValueError", ")", ":", "return", "None"], "function": "def Func():\n    \"\"\"Returns uptime in seconds or None, on MINIX.\"\"\"\n    try:\n        arg_0 = open('/proc/uptime', 'r')\n        arg_1 = float(arg_0.read())\n        arg_0.close()\n        return arg_1\n    except (IOError, ValueError):\n        return None", "path": "src/__init__.py", "identifier": "_uptime_minix", "docstring": "Returns uptime in seconds or None, on MINIX.", "docstring_tokens": ["Returns", "uptime", "in", "seconds", "or", "None", "on", "MINIX", "."], "nwo": "Cairnarvon/uptime", "score": 0.28604555575224755, "idx": 258364}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/docs/sphinxext/numpydoc/comment_eater.py#L86-L98", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Process a single token.", "language": "python", "parameters": "(self, kind, string, start, end, line)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_0", ".", "current_block", ".", "is_comment", ":", "if", "arg_1", "==", "tokenize", ".", "COMMENT", ":", "arg_0", ".", "current_block", ".", "add", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "else", ":", "arg_0", ".", "new_noncomment", "(", "arg_3", "[", "0", "]", ",", "arg_4", "[", "0", "]", ")", "else", ":", "if", "arg_1", "==", "tokenize", ".", "COMMENT", ":", "arg_0", ".", "new_comment", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "else", ":", "arg_0", ".", "current_block", ".", "add", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\" Process a single token.\n        \"\"\"\n        if arg_0.current_block.is_comment:\n            if arg_1 == tokenize.COMMENT:\n                arg_0.current_block.add(arg_2, arg_3, arg_4, arg_5)\n            else:\n                arg_0.new_noncomment(arg_3[0], arg_4[0])\n        else:\n            if arg_1 == tokenize.COMMENT:\n                arg_0.new_comment(arg_2, arg_3, arg_4, arg_5)\n            else:\n                arg_0.current_block.add(arg_2, arg_3, arg_4, arg_5)", "path": "docs/sphinxext/numpydoc/comment_eater.py", "identifier": "CommentBlocker.process_token", "docstring": "Process a single token.", "docstring_tokens": ["Process", "a", "single", "token", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 258365}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/base.py#L467-L475", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Sets the ``is_confirmed`` for the bundle.", "language": "python", "parameters": "(self, new_is_confirmed)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_is_confirmed", "=", "arg_1", "for", "arg_3", "in", "arg_0", ":", "arg_3", ".", "is_confirmed", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        # type: (bool) -> None\n        \"\"\"\n        Sets the ``is_confirmed`` for the bundle.\n        \"\"\"\n        arg_0._is_confirmed = arg_1\n\n        for arg_3 in arg_0:\n            arg_3.is_confirmed = arg_1", "path": "iota/transaction/base.py", "identifier": "Bundle.is_confirmed", "docstring": "Sets the ``is_confirmed`` for the bundle.", "docstring_tokens": ["Sets", "the", "is_confirmed", "for", "the", "bundle", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 258366}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1566-L1578", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Formats a name for storage", "language": "python", "parameters": "(self, name_idx, is_dia)", "return_statement": "return tuple(['explored%s.set_%05d.xspm_%s_%08d' % (SparseParameter.IDENTIFIER,\n                                                         name_idx // 200, name, name_idx)\n                                                                        for name in name_list])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get_name_list", "(", "arg_2", ")", "return", "tuple", "(", "[", "'explored%s.set_%05d.xspm_%s_%08d'", "%", "(", "SparseParameter", ".", "IDENTIFIER", ",", "arg_1", "//", "200", ",", "arg_4", ",", "arg_1", ")", "for", "arg_4", "in", "arg_3", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Formats a name for storage\n\n        :return: A tuple of names with the following format:\n\n            `xspm__spsp__XXXX__spsp__XXXXXXXX` where the first 'XXXX' refer to the property and\n            the latter 'XXXXXXX' to the sparse matrix index.\n\n        \"\"\"\n        arg_3 = arg_0._get_name_list(arg_2)\n        return tuple(['explored%s.set_%05d.xspm_%s_%08d' % (SparseParameter.IDENTIFIER,\n                                                         arg_1 // 200, arg_4, arg_1)\n                                                                        for arg_4 in arg_3])", "path": "pypet/parameter.py", "identifier": "SparseParameter._build_names", "docstring": "Formats a name for storage\n\n        :return: A tuple of names with the following format:\n\n            `xspm__spsp__XXXX__spsp__XXXXXXXX` where the first 'XXXX' refer to the property and\n            the latter 'XXXXXXX' to the sparse matrix index.", "docstring_tokens": ["Formats", "a", "name", "for", "storage"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258367}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/stats.py#L48-L64", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Get median latitude AND longitude of stops", "language": "python", "parameters": "(gtfs)", "return_statement": "return median_lat, median_lon", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_table", "(", "\"stops\"", ")", "arg_2", "=", "numpy", ".", "percentile", "(", "arg_1", "[", "'lat'", "]", ".", "values", ",", "50", ")", "arg_3", "=", "numpy", ".", "percentile", "(", "arg_1", "[", "'lon'", "]", ".", "values", ",", "50", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Get median latitude AND longitude of stops\n\n    Parameters\n    ----------\n    gtfs: GTFS\n\n    Returns\n    -------\n    median_lat : float\n    median_lon : float\n    \"\"\"\n    arg_1 = arg_0.get_table(\"stops\")\n    arg_2 = numpy.percentile(arg_1['lat'].values, 50)\n    arg_3 = numpy.percentile(arg_1['lon'].values, 50)\n    return arg_2, arg_3", "path": "gtfspy/stats.py", "identifier": "get_median_lat_lon_of_stops", "docstring": "Get median latitude AND longitude of stops\n\n    Parameters\n    ----------\n    gtfs: GTFS\n\n    Returns\n    -------\n    median_lat : float\n    median_lon : float", "docstring_tokens": ["Get", "median", "latitude", "AND", "longitude", "of", "stops"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 258368}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L111-L152", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Calculate the scores over all biological processes in the sub-graph.", "language": "python", "parameters": "(\n        graph: BELGraph,\n        key: Optional[str] = None,\n        tag: Optional[str] = None,\n        default_score: Optional[float] = None,\n        runs: Optional[int] = None,\n        use_tqdm: bool = False,\n)", "return_statement": "return scores", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "None", ",", "arg_5", ":", "arg_3", "[", "arg_4", "]", "=", "None", ",", "arg_6", ":", "arg_3", "[", "arg_7", "]", "=", "None", ",", "arg_8", ":", "arg_3", "[", "arg_9", "]", "=", "None", ",", "arg_10", ":", "arg_11", "=", "False", ",", ")", ":", "arg_12", "=", "generate_bioprocess_mechanisms", "(", "arg_0", ",", "arg_2", "=", "arg_2", ")", "arg_13", "=", "calculate_average_scores_on_subgraphs", "(", "arg_12", ",", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_8", "=", "arg_8", ",", "arg_10", "=", "arg_10", ")", "return", "arg_13"], "function": "def Func(\n        arg_0: arg_1,\n        arg_2: arg_3[arg_4] = None,\n        arg_5: arg_3[arg_4] = None,\n        arg_6: arg_3[arg_7] = None,\n        arg_8: arg_3[arg_9] = None,\n        arg_10: arg_11 = False,\n):\n    \"\"\"Calculate the scores over all biological processes in the sub-graph.\n\n    As an implementation, it simply computes the sub-graphs then calls :func:`calculate_average_scores_on_subgraphs` as\n    described in that function's documentation.\n\n    :param graph: A BEL graph with heats already on the nodes\n    :param key: The key in the node data dictionary representing the experimental data. Defaults to\n     :data:`pybel_tools.constants.WEIGHT`.\n    :param tag: The key for the nodes' data dictionaries where the scores will be put. Defaults to 'score'\n    :param default_score: The initial score for all nodes. This number can go up or down.\n    :param runs: The number of times to run the heat diffusion workflow. Defaults to 100.\n    :param use_tqdm: Should there be a progress bar for runners?\n    :return: A dictionary of {pybel node tuple: results tuple}\n    :rtype: dict[tuple, tuple]\n\n    Suggested usage with :mod:`pandas`:\n\n    >>> import pandas as pd\n    >>> from pybel_tools.analysis.heat import Func\n    >>> graph = ...  # load graph and data\n    >>> scores = Func(graph)\n    >>> pd.DataFrame.from_items(scores.items(), orient='index', columns=RESULT_LABELS)\n\n    \"\"\"\n    arg_12 = generate_bioprocess_mechanisms(arg_0, arg_2=arg_2)\n    arg_13 = calculate_average_scores_on_subgraphs(\n        arg_12,\n        arg_2=arg_2,\n        arg_5=arg_5,\n        arg_6=arg_6,\n        arg_8=arg_8,\n        arg_10=arg_10\n    )\n    return arg_13", "path": "src/pybel_tools/analysis/heat.py", "identifier": "calculate_average_scores_on_graph", "docstring": "Calculate the scores over all biological processes in the sub-graph.\n\n    As an implementation, it simply computes the sub-graphs then calls :func:`calculate_average_scores_on_subgraphs` as\n    described in that function's documentation.\n\n    :param graph: A BEL graph with heats already on the nodes\n    :param key: The key in the node data dictionary representing the experimental data. Defaults to\n     :data:`pybel_tools.constants.WEIGHT`.\n    :param tag: The key for the nodes' data dictionaries where the scores will be put. Defaults to 'score'\n    :param default_score: The initial score for all nodes. This number can go up or down.\n    :param runs: The number of times to run the heat diffusion workflow. Defaults to 100.\n    :param use_tqdm: Should there be a progress bar for runners?\n    :return: A dictionary of {pybel node tuple: results tuple}\n    :rtype: dict[tuple, tuple]\n\n    Suggested usage with :mod:`pandas`:\n\n    >>> import pandas as pd\n    >>> from pybel_tools.analysis.heat import calculate_average_scores_on_graph\n    >>> graph = ...  # load graph and data\n    >>> scores = calculate_average_scores_on_graph(graph)\n    >>> pd.DataFrame.from_items(scores.items(), orient='index', columns=RESULT_LABELS)", "docstring_tokens": ["Calculate", "the", "scores", "over", "all", "biological", "processes", "in", "the", "sub", "-", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 258369}
{"url": "https://github.com/gunyarakun/python-shogi/blob/137fe5f5e72251e8a97a1dba4a9b44b7c3c79914/shogi/__init__.py#L915-L931", "sha": "137fe5f5e72251e8a97a1dba4a9b44b7c3c79914", "docstring_summary": "Checks if the game is over due to checkmate, stalemate or\n        fourfold repetition.", "language": "python", "parameters": "(self)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "next", "(", "arg_0", ".", "generate_legal_moves", "(", ")", ".", "__iter__", "(", ")", ")", "except", "StopIteration", ":", "return", "True", "if", "arg_0", ".", "is_fourfold_repetition", "(", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n        '''\n        Checks if the game is over due to checkmate, stalemate or\n        fourfold repetition.\n        '''\n\n        # Stalemate or checkmate.\n        try:\n            next(arg_0.generate_legal_moves().__iter__())\n        except StopIteration:\n            return True\n\n        # Fourfold repetition.\n        if arg_0.is_fourfold_repetition():\n            return True\n\n        return False", "path": "shogi/__init__.py", "identifier": "Board.is_game_over", "docstring": "Checks if the game is over due to checkmate, stalemate or\n        fourfold repetition.", "docstring_tokens": ["Checks", "if", "the", "game", "is", "over", "due", "to", "checkmate", "stalemate", "or", "fourfold", "repetition", "."], "nwo": "gunyarakun/python-shogi", "score": 0.5553316607030774, "idx": 258370}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L474-L485", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles the user attempting to exit Godot.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "prompt_Func", ":", "arg_2", "=", "confirm", "(", "parent", "=", "arg_1", ".", "ui", ".", "control", ",", "message", "=", "\"Exit Godot?\"", ",", "title", "=", "\"Confirm exit\"", ",", "default", "=", "YES", ")", "if", "arg_2", "==", "YES", ":", "arg_0", ".", "_on_close", "(", "arg_1", ")", "else", ":", "arg_0", ".", "_on_close", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handles the user attempting to exit Godot.\n        \"\"\"\n        if arg_0.prompt_Func:# and (not is_ok):\n            arg_2 = confirm(parent  = arg_1.ui.control,\n                             message = \"Exit Godot?\",\n                             title   = \"Confirm exit\",\n                             default = YES)\n            if arg_2 == YES:\n                arg_0._on_close( arg_1 )\n        else:\n            arg_0._on_close( arg_1 )", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel.on_exit", "docstring": "Handles the user attempting to exit Godot.", "docstring_tokens": ["Handles", "the", "user", "attempting", "to", "exit", "Godot", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 258371}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/flask_util.py#L383-L432", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Flask view that handles the user's return from OAuth2 provider.", "language": "python", "parameters": "(self)", "return_statement": "return redirect(return_url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'error'", "in", "request", ".", "args", ":", "arg_1", "=", "request", ".", "args", ".", "get", "(", "'error_description'", ",", "request", ".", "args", ".", "get", "(", "'error'", ",", "''", ")", ")", "arg_1", "=", "markupsafe", ".", "escape", "(", "arg_1", ")", "return", "(", "'Authorization failed: {0}'", ".", "format", "(", "arg_1", ")", ",", "httplib", ".", "BAD_REQUEST", ")", "try", ":", "arg_2", "=", "request", ".", "args", "[", "'state'", "]", "arg_3", "=", "session", "[", "_CSRF_KEY", "]", "arg_4", "=", "request", ".", "args", "[", "'code'", "]", "except", "KeyError", ":", "return", "'Invalid request'", ",", "httplib", ".", "BAD_REQUEST", "try", ":", "arg_5", "=", "json", ".", "loads", "(", "arg_2", ")", "arg_6", "=", "arg_5", "[", "'csrf_token'", "]", "arg_7", "=", "arg_5", "[", "'return_url'", "]", "except", "(", "ValueError", ",", "KeyError", ")", ":", "return", "'Invalid request state'", ",", "httplib", ".", "BAD_REQUEST", "if", "arg_6", "!=", "arg_3", ":", "return", "'Invalid request state'", ",", "httplib", ".", "BAD_REQUEST", "arg_8", "=", "_get_flow_for_token", "(", "arg_3", ")", "if", "arg_8", "is", "None", ":", "return", "'Invalid request state'", ",", "httplib", ".", "BAD_REQUEST", "try", ":", "arg_9", "=", "arg_8", ".", "step2_exchange", "(", "arg_4", ")", "except", "client", ".", "FlowExchangeError", "as", "exchange_error", ":", "current_app", ".", "logger", ".", "exception", "(", "exchange_error", ")", "arg_10", "=", "'An error occurred: {0}'", ".", "format", "(", "exchange_error", ")", "return", "arg_10", ",", "httplib", ".", "BAD_REQUEST", "arg_0", ".", "storage", ".", "put", "(", "arg_9", ")", "if", "arg_0", ".", "authorize_callback", ":", "arg_0", ".", "authorize_callback", "(", "arg_9", ")", "return", "redirect", "(", "arg_7", ")"], "function": "def Func(arg_0):\n        \"\"\"Flask view that handles the user's return from OAuth2 provider.\n\n        On return, exchanges the authorization code for credentials and stores\n        the credentials.\n        \"\"\"\n        if 'error' in request.args:\n            arg_1 = request.args.get(\n                'error_description', request.args.get('error', ''))\n            arg_1 = markupsafe.escape(arg_1)\n            return ('Authorization failed: {0}'.format(arg_1),\n                    httplib.BAD_REQUEST)\n\n        try:\n            arg_2 = request.args['state']\n            arg_3 = session[_CSRF_KEY]\n            arg_4 = request.args['code']\n        except KeyError:\n            return 'Invalid request', httplib.BAD_REQUEST\n\n        try:\n            arg_5 = json.loads(arg_2)\n            arg_6 = arg_5['csrf_token']\n            arg_7 = arg_5['return_url']\n        except (ValueError, KeyError):\n            return 'Invalid request state', httplib.BAD_REQUEST\n\n        if arg_6 != arg_3:\n            return 'Invalid request state', httplib.BAD_REQUEST\n\n        arg_8 = _get_flow_for_token(arg_3)\n\n        if arg_8 is None:\n            return 'Invalid request state', httplib.BAD_REQUEST\n\n        # Exchange the auth code for credentials.\n        try:\n            arg_9 = arg_8.step2_exchange(arg_4)\n        except client.FlowExchangeError as exchange_error:\n            current_app.logger.exception(exchange_error)\n            arg_10 = 'An error occurred: {0}'.format(exchange_error)\n            return arg_10, httplib.BAD_REQUEST\n\n        # Save the credentials to the storage.\n        arg_0.storage.put(arg_9)\n\n        if arg_0.authorize_callback:\n            arg_0.authorize_callback(arg_9)\n\n        return redirect(arg_7)", "path": "oauth2client/contrib/flask_util.py", "identifier": "UserOAuth2.callback_view", "docstring": "Flask view that handles the user's return from OAuth2 provider.\n\n        On return, exchanges the authorization code for credentials and stores\n        the credentials.", "docstring_tokens": ["Flask", "view", "that", "handles", "the", "user", "s", "return", "from", "OAuth2", "provider", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 258372}
{"url": "https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L113-L116", "sha": "467e8a843ca9f882f8bb2958805b7293591996ad", "docstring_summary": "Returns the factor of exceedance", "language": "python", "parameters": "(a, b)", "return_statement": "return (np.sum(a > b, dtype=float) / len(a) - 0.5) * 100", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "np", ".", "sum", "(", "arg_0", ">", "arg_1", ",", "dtype", "=", "float", ")", "/", "len", "(", "arg_0", ")", "-", "0.5", ")", "*", "100"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns the factor of exceedance\n    \"\"\"\n    return (np.sum(arg_0 > arg_1, dtype=float) / len(arg_0) - 0.5) * 100", "path": "pyair/stats.py", "identifier": "foex", "docstring": "Returns the factor of exceedance", "docstring_tokens": ["Returns", "the", "factor", "of", "exceedance"], "nwo": "LionelR/pyair", "score": 0.12050106452410352, "idx": 258373}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/weakmethod.py#L117-L132", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns a weak reference to the given method or function.\n    If the callback argument is not None, it is called as soon\n    as the referenced function is garbage deleted.", "language": "python", "parameters": "(function, callback=None)", "return_statement": "return _WeakMethodBound(function, callback)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "try", ":", "arg_0", ".", "__func__", "except", "AttributeError", ":", "return", "_WeakMethodFree", "(", "arg_0", ",", "arg_1", ")", "return", "_WeakMethodBound", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Returns a weak Funcerence to the given method or function.\n    If the callback argument is not None, it is called as soon\n    as the Funcerenced function is garbage deleted.\n\n    :type  function: callable\n    :param function: The function to Funcerence.\n    :type  callback: callable\n    :param callback: Called when the function dies.\n    \"\"\"\n    try:\n        arg_0.__func__\n    except AttributeError:\n        return _WeakMethodFree(arg_0, arg_1)\n    return _WeakMethodBound(arg_0, arg_1)", "path": "SpiffWorkflow/util/weakmethod.py", "identifier": "ref", "docstring": "Returns a weak reference to the given method or function.\n    If the callback argument is not None, it is called as soon\n    as the referenced function is garbage deleted.\n\n    :type  function: callable\n    :param function: The function to reference.\n    :type  callback: callable\n    :param callback: Called when the function dies.", "docstring_tokens": ["Returns", "a", "weak", "reference", "to", "the", "given", "method", "or", "function", ".", "If", "the", "callback", "argument", "is", "not", "None", "it", "is", "called", "as", "soon", "as", "the", "referenced", "function", "is", "garbage", "deleted", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 258374}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L343-L480", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Convert a number to engineering notation.", "language": "python", "parameters": "(number, frac_length, rjust=True)", "return_statement": "return num", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "arg_0", "==", "0", ":", "arg_0", "=", "\"0.{zrs}\"", ".", "format", "(", "zrs", "=", "\"0\"", "*", "arg_1", ")", "if", "arg_1", "else", "\"0\"", "return", "\"{0} \"", ".", "format", "(", "arg_0", ".", "rjust", "(", "5", "+", "arg_1", ")", ")", "if", "arg_2", "else", "arg_0", "arg_3", "=", "+", "1", "if", "arg_0", ">=", "0", "else", "-", "1", "arg_4", "=", "\"-\"", "if", "arg_3", "==", "-", "1", "else", "\"\"", "arg_5", "=", "abs", "(", "arg_0", ")", "if", "arg_5", "<", "1e-24", ":", "arg_5", "=", "1e-24", "arg_0", "=", "arg_3", "*", "1e-24", "arg_6", "=", "3.0", "*", "math", ".", "floor", "(", "math", ".", "floor", "(", "math", ".", "log10", "(", "arg_5", ")", ")", "/", "3.0", ")", "arg_7", "=", "arg_0", "/", "10", "**", "arg_6", "arg_8", "=", "str", "(", "arg_7", ")", "arg_9", "=", "arg_8", ".", "find", "(", "\".\"", ")", "if", "len", "(", "arg_8", ")", "-", "arg_9", "-", "1", ">", "arg_1", ":", "arg_7", "+=", "arg_3", "*", "5", "*", "10", "**", "(", "-", "arg_1", "-", "1", ")", "if", "abs", "(", "arg_7", ")", ">=", "1000", ":", "arg_6", "+=", "3", "arg_7", "=", "arg_7", "/", "1e3", "arg_8", "=", "str", "(", "arg_7", ")", "arg_9", "=", "arg_8", ".", "find", "(", "\".\"", ")", "arg_10", "=", "bool", "(", "arg_1", ")", "arg_11", "=", "arg_9", "-", "(", "not", "arg_10", ")", "+", "arg_1", "+", "1", "arg_12", "=", "arg_8", "[", ":", "arg_11", "]", ".", "ljust", "(", "arg_11", ",", "\"0\"", ")", "if", "arg_6", ">", "24", ":", "arg_12", ",", "arg_6", "=", "(", "\"{sign}999.{frac}\"", ".", "format", "(", "arg_3", "=", "arg_4", ",", "frac", "=", "\"9\"", "*", "arg_1", ")", ",", "24", ",", ")", "arg_12", "=", "arg_12", ".", "rjust", "(", "arg_2", "*", "(", "4", "+", "arg_10", "+", "arg_1", ")", ")", "arg_13", "=", "\"{mant}{suffix}\"", ".", "format", "(", "arg_7", "=", "arg_12", ",", "suffix", "=", "_POWER_TO_SUFFIX_DICT", "[", "arg_6", "]", "if", "arg_6", "else", "\" \"", "*", "bool", "(", "arg_2", ")", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    r\"\"\"\n    Convert a number to engineering notation.\n\n    The absolute value of the number (if it is not exactly zero) is bounded to\n    the interval [1E-24, 1E+24)\n\n    :param number: Number to convert\n    :type  number: integer or float\n\n    :param frac_length: Number of digits of fractional part\n    :type  frac_length: `NonNegativeInteger\n                        <https://pexdoc.readthedocs.io/en/stable/\n                        ptypes.html#nonnegativeinteger>`_\n\n    :param rjust: Flag that indicates whether the number is\n                  right-justified (True) or not (False)\n    :type  rjust: boolean\n\n    :rtype: string\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for Func.functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`frac_length\\` is not valid)\n\n     * RuntimeError (Argument \\`number\\` is not valid)\n\n     * RuntimeError (Argument \\`rjust\\` is not valid)\n\n    .. [[[end]]]\n\n    The supported engineering suffixes are:\n\n    +----------+-------+--------+\n    | Exponent | Name  | Suffix |\n    +==========+=======+========+\n    | 1E-24    | yocto | y      |\n    +----------+-------+--------+\n    | 1E-21    | zepto | z      |\n    +----------+-------+--------+\n    | 1E-18    | atto  | a      |\n    +----------+-------+--------+\n    | 1E-15    | femto | f      |\n    +----------+-------+--------+\n    | 1E-12    | pico  | p      |\n    +----------+-------+--------+\n    | 1E-9     | nano  | n      |\n    +----------+-------+--------+\n    | 1E-6     | micro | u      |\n    +----------+-------+--------+\n    | 1E-3     | milli | m      |\n    +----------+-------+--------+\n    | 1E+0     |       |        |\n    +----------+-------+--------+\n    | 1E+3     | kilo  | k      |\n    +----------+-------+--------+\n    | 1E+6     | mega  | M      |\n    +----------+-------+--------+\n    | 1E+9     | giga  | G      |\n    +----------+-------+--------+\n    | 1E+12    | tera  | T      |\n    +----------+-------+--------+\n    | 1E+15    | peta  | P      |\n    +----------+-------+--------+\n    | 1E+18    | exa   | E      |\n    +----------+-------+--------+\n    | 1E+21    | zetta | Z      |\n    +----------+-------+--------+\n    | 1E+24    | yotta | Y      |\n    +----------+-------+--------+\n\n    For example:\n\n        >>> import Func\n        >>> Func.Func(1235.6789E3, 3, False)\n        '1.236M'\n    \"\"\"\n    # The decimal module has a to_eng_string() function, but it does not seem\n    # to work well in all cases. For example:\n    # >>> decimal.Decimal('34.5712233E8').to_eng_string()\n    # '3.45712233E+9'\n    # >>> decimal.Decimal('34.57122334E8').to_eng_string()\n    # '3457122334'\n    # It seems that the conversion function does not work in all cases\n    #\n    # Return formatted zero if number is zero, easier to not deal with this\n    # special case through the rest of the algorithm\n    if arg_0 == 0:\n        arg_0 = \"0.{zrs}\".format(zrs=\"0\" * arg_1) if arg_1 else \"0\"\n        # Engineering notation numbers can have a sign, a 3-digit integer part,\n        # a period, and a fractional part of length frac_length, so the\n        # length of the number to the left of, and including, the period is 5\n        return \"{0} \".format(arg_0.rjust(5 + arg_1)) if arg_2 else arg_0\n    # Low-bound number\n    arg_3 = +1 if arg_0 >= 0 else -1\n    arg_4 = \"-\" if arg_3 == -1 else \"\"\n    arg_5 = abs(arg_0)\n    if arg_5 < 1e-24:\n        arg_5 = 1e-24\n        arg_0 = arg_3 * 1e-24\n    # Round fractional part if requested frac_length is less than length\n    # of fractional part. Rounding method is to add a '5' at the decimal\n    # position just after the end of frac_length digits\n    arg_6 = 3.0 * math.floor(math.floor(math.log10(arg_5)) / 3.0)\n    arg_7 = arg_0 / 10 ** arg_6\n    # Because exponent is a float, mantissa is a float and its string\n    # representation always includes a period\n    arg_8 = str(arg_7)\n    arg_9 = arg_8.find(\".\")\n    if len(arg_8) - arg_9 - 1 > arg_1:\n        arg_7 += arg_3 * 5 * 10 ** (-arg_1 - 1)\n        if abs(arg_7) >= 1000:\n            arg_6 += 3\n            arg_7 = arg_7 / 1e3\n        arg_8 = str(arg_7)\n        arg_9 = arg_8.find(\".\")\n    # Make fractional part have frac_length digits\n    arg_10 = bool(arg_1)\n    arg_11 = arg_9 - (not arg_10) + arg_1 + 1\n    arg_12 = arg_8[:arg_11].ljust(arg_11, \"0\")\n    # Upper-bound number\n    if arg_6 > 24:\n        arg_12, arg_6 = (\n            \"{sign}999.{frac}\".format(arg_3=arg_4, frac=\"9\" * arg_1),\n            24,\n        )\n    # Right-justify number, engineering notation numbers can have a sign,\n    # a 3-digit integer part and a period, and a fractional part of length\n    # frac_length, so the length of the number to the left of the\n    # period is 4\n    arg_12 = arg_12.rjust(arg_2 * (4 + arg_10 + arg_1))\n    # Format number\n    arg_13 = \"{mant}{suffix}\".format(\n        arg_7=arg_12, suffix=_POWER_TO_SUFFIX_DICT[arg_6] if arg_6 else \" \" * bool(arg_2)\n    )\n    return arg_13", "path": "peng/functions.py", "identifier": "peng", "docstring": "r\"\"\"\n    Convert a number to engineering notation.\n\n    The absolute value of the number (if it is not exactly zero) is bounded to\n    the interval [1E-24, 1E+24)\n\n    :param number: Number to convert\n    :type  number: integer or float\n\n    :param frac_length: Number of digits of fractional part\n    :type  frac_length: `NonNegativeInteger\n                        <https://pexdoc.readthedocs.io/en/stable/\n                        ptypes.html#nonnegativeinteger>`_\n\n    :param rjust: Flag that indicates whether the number is\n                  right-justified (True) or not (False)\n    :type  rjust: boolean\n\n    :rtype: string\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for peng.functions.peng\n\n    :raises:\n     * RuntimeError (Argument \\`frac_length\\` is not valid)\n\n     * RuntimeError (Argument \\`number\\` is not valid)\n\n     * RuntimeError (Argument \\`rjust\\` is not valid)\n\n    .. [[[end]]]\n\n    The supported engineering suffixes are:\n\n    +----------+-------+--------+\n    | Exponent | Name  | Suffix |\n    +==========+=======+========+\n    | 1E-24    | yocto | y      |\n    +----------+-------+--------+\n    | 1E-21    | zepto | z      |\n    +----------+-------+--------+\n    | 1E-18    | atto  | a      |\n    +----------+-------+--------+\n    | 1E-15    | femto | f      |\n    +----------+-------+--------+\n    | 1E-12    | pico  | p      |\n    +----------+-------+--------+\n    | 1E-9     | nano  | n      |\n    +----------+-------+--------+\n    | 1E-6     | micro | u      |\n    +----------+-------+--------+\n    | 1E-3     | milli | m      |\n    +----------+-------+--------+\n    | 1E+0     |       |        |\n    +----------+-------+--------+\n    | 1E+3     | kilo  | k      |\n    +----------+-------+--------+\n    | 1E+6     | mega  | M      |\n    +----------+-------+--------+\n    | 1E+9     | giga  | G      |\n    +----------+-------+--------+\n    | 1E+12    | tera  | T      |\n    +----------+-------+--------+\n    | 1E+15    | peta  | P      |\n    +----------+-------+--------+\n    | 1E+18    | exa   | E      |\n    +----------+-------+--------+\n    | 1E+21    | zetta | Z      |\n    +----------+-------+--------+\n    | 1E+24    | yotta | Y      |\n    +----------+-------+--------+\n\n    For example:\n\n        >>> import peng\n        >>> peng.peng(1235.6789E3, 3, False)\n        '1.236M'", "docstring_tokens": ["r", "Convert", "a", "number", "to", "engineering", "notation", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 258375}
{"url": "https://github.com/slacy/minimongo/blob/29f38994831163b17bc625c82258068f1f90efa5/minimongo/model.py#L83-L98", "sha": "29f38994831163b17bc625c82258068f1f90efa5", "docstring_summary": "Builds all indices, listed in model's Meta class.", "language": "python", "parameters": "(mcs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "_meta", ".", "indices", ":", "arg_1", ".", "ensure", "(", "arg_0", ".", "collection", ")"], "function": "def Func(arg_0):\n        \"\"\"Builds all indices, listed in model's Meta class.\n\n           >>> class SomeModel(Model)\n           ...     class Meta:\n           ...         indices = (\n           ...             Index('foo'),\n           ...         )\n\n        .. note:: this will result in calls to\n                  :meth:`pymongo.collection.Collection.ensure_index`\n                  method at import time, so import all your models up\n                  front.\n        \"\"\"\n        for arg_1 in arg_0._meta.indices:\n            arg_1.ensure(arg_0.collection)", "path": "minimongo/model.py", "identifier": "ModelBase.auto_index", "docstring": "Builds all indices, listed in model's Meta class.\n\n           >>> class SomeModel(Model)\n           ...     class Meta:\n           ...         indices = (\n           ...             Index('foo'),\n           ...         )\n\n        .. note:: this will result in calls to\n                  :meth:`pymongo.collection.Collection.ensure_index`\n                  method at import time, so import all your models up\n                  front.", "docstring_tokens": ["Builds", "all", "indices", "listed", "in", "model", "s", "Meta", "class", "."], "nwo": "slacy/minimongo", "score": 0.5360616437145059, "idx": 258376}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/metrics/metrics_helper.py#L129-L132", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Update received packet metrics", "language": "python", "parameters": "(self, received_pkt_size_bytes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "update_count", "(", "arg_0", ".", "RECEIVED_PKT_COUNT", ")", "arg_0", ".", "update_count", "(", "arg_0", ".", "RECEIVED_PKT_SIZE", ",", "incr_by", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Update received packet metrics\"\"\"\n    arg_0.update_count(arg_0.RECEIVED_PKT_COUNT)\n    arg_0.update_count(arg_0.RECEIVED_PKT_SIZE, incr_by=arg_1)", "path": "heron/instance/src/python/utils/metrics/metrics_helper.py", "identifier": "GatewayMetrics.update_received_packet", "docstring": "Update received packet metrics", "docstring_tokens": ["Update", "received", "packet", "metrics"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258377}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/interfaceLevel/propDeclrCollector.py#L143-L164", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Register Param object on interface level object", "language": "python", "parameters": "(self, pName, parameter)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "->", "None", ":", "nameAvailabilityCheck", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "try", ":", "arg_3", "=", "arg_2", ".", "_name", "is", "not", "None", "except", "AttributeError", ":", "arg_3", "=", "False", "if", "not", "arg_3", ":", "arg_2", ".", "_name", "=", "arg_1", "arg_2", ".", "_registerScope", "(", "arg_1", ",", "arg_0", ")", "if", "arg_2", ".", "hasGenericName", ":", "arg_2", ".", "name", "=", "arg_1", "if", "arg_2", ".", "_parent", "is", "None", ":", "arg_2", ".", "_parent", "=", "arg_0", "arg_0", ".", "_params", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2) -> None:\n        \"\"\"\n        Register Param object on interface level object\n        \"\"\"\n        nameAvailabilityCheck(arg_0, arg_1, arg_2)\n        # resolve name in this scope\n        try:\n            arg_3 = arg_2._name is not None\n        except AttributeError:\n            arg_3 = False\n        if not arg_3:\n            arg_2._name = arg_1\n        # add name in this scope\n        arg_2._registerScope(arg_1, arg_0)\n\n        if arg_2.hasGenericName:\n            arg_2.name = arg_1\n\n        if arg_2._parent is None:\n            arg_2._parent = arg_0\n\n        arg_0._params.append(arg_2)", "path": "hwt/synthesizer/interfaceLevel/propDeclrCollector.py", "identifier": "PropDeclrCollector._registerParameter", "docstring": "Register Param object on interface level object", "docstring_tokens": ["Register", "Param", "object", "on", "interface", "level", "object"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 258378}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L49-L98", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "parse results from cutadapt into sample data", "language": "python", "parameters": "(data, sample, res1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"trim_adapter_bp_read1\"", "]", "=", "0", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"trim_quality_bp_read1\"", "]", "=", "0", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"reads_filtered_by_Ns\"", "]", "=", "0", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"reads_filtered_by_minlen\"", "]", "=", "0", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"reads_passed_filter\"", "]", "=", "0", "arg_5", "=", "arg_2", ".", "strip", "(", ")", ".", "split", "(", "\"\\n\"", ")", "for", "arg_6", "in", "arg_5", ":", "if", "\"Total reads processed:\"", "in", "arg_6", ":", "arg_7", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "3", "]", ".", "replace", "(", "\",\"", ",", "\"\"", ")", ")", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"reads_raw\"", "]", "=", "arg_7", "if", "\"Reads with adapters:\"", "in", "arg_6", ":", "arg_7", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "3", "]", ".", "replace", "(", "\",\"", ",", "\"\"", ")", ")", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"trim_adapter_bp_read1\"", "]", "=", "arg_7", "if", "\"Quality-trimmed\"", "in", "arg_6", ":", "arg_7", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "1", "]", ".", "replace", "(", "\",\"", ",", "\"\"", ")", ")", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"trim_quality_bp_read1\"", "]", "=", "arg_7", "if", "\"Reads that were too short\"", "in", "arg_6", ":", "arg_7", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "5", "]", ".", "replace", "(", "\",\"", ",", "\"\"", ")", ")", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"reads_filtered_by_minlen\"", "]", "=", "arg_7", "if", "\"Reads with too many N\"", "in", "arg_6", ":", "arg_7", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "5", "]", ".", "replace", "(", "\",\"", ",", "\"\"", ")", ")", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"reads_filtered_by_Ns\"", "]", "=", "arg_7", "if", "\"Reads written (passing filters):\"", "in", "arg_6", ":", "arg_7", "=", "int", "(", "arg_6", ".", "split", "(", ")", "[", "4", "]", ".", "replace", "(", "\",\"", ",", "\"\"", ")", ")", "arg_1", ".", "stats_dfs", ".", "s2", "[", "\"reads_passed_filter\"", "]", "=", "arg_7", "if", "arg_1", ".", "stats_dfs", ".", "s2", ".", "reads_passed_filter", ":", "arg_1", ".", "stats", ".", "state", "=", "2", "arg_1", ".", "stats", ".", "reads_passed_filter", "=", "arg_1", ".", "stats_dfs", ".", "s2", ".", "reads_passed_filter", "arg_1", ".", "files", ".", "edits", "=", "[", "(", "OPJ", "(", "arg_0", ".", "dirs", ".", "edits", ",", "arg_1", ".", "name", "+", "\".trimmed_R1_.fastq.gz\"", ")", ",", "0", ")", "]", "LOGGER", ".", "info", "(", "arg_2", ")", "else", ":", "print", "(", "\"{}No reads passed filtering in Sample: {}\"", ".", "format", "(", "arg_0", ".", "_spacer", ",", "arg_1", ".", "name", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" parse results from cutadapt into sample data\"\"\"\n\n    ## set default values \n    #sample.stats_dfs.s2[\"reads_raw\"] = 0\n    arg_1.stats_dfs.s2[\"trim_adapter_bp_read1\"] = 0\n    arg_1.stats_dfs.s2[\"trim_quality_bp_read1\"] = 0\n    arg_1.stats_dfs.s2[\"reads_filtered_by_Ns\"] = 0\n    arg_1.stats_dfs.s2[\"reads_filtered_by_minlen\"] = 0\n    arg_1.stats_dfs.s2[\"reads_passed_filter\"] = 0\n\n    ## parse new values from cutadapt results output\n    arg_5 = arg_2.strip().split(\"\\n\")\n    for arg_6 in arg_5:\n\n        if \"Total reads processed:\" in arg_6:\n            arg_7 = int(arg_6.split()[3].replace(\",\", \"\"))\n            arg_1.stats_dfs.s2[\"reads_raw\"] = arg_7\n\n        if \"Reads with adapters:\" in arg_6:\n            arg_7 = int(arg_6.split()[3].replace(\",\", \"\"))\n            arg_1.stats_dfs.s2[\"trim_adapter_bp_read1\"] = arg_7\n\n        if \"Quality-trimmed\" in arg_6:\n            arg_7 = int(arg_6.split()[1].replace(\",\", \"\"))\n            arg_1.stats_dfs.s2[\"trim_quality_bp_read1\"] = arg_7\n\n        if \"Reads that were too short\" in arg_6:\n            arg_7 = int(arg_6.split()[5].replace(\",\", \"\"))\n            arg_1.stats_dfs.s2[\"reads_filtered_by_minlen\"] = arg_7\n\n        if \"Reads with too many N\" in arg_6:\n            arg_7 = int(arg_6.split()[5].replace(\",\", \"\"))\n            arg_1.stats_dfs.s2[\"reads_filtered_by_Ns\"] = arg_7\n   \n        if \"Reads written (passing filters):\" in arg_6:\n            arg_7 = int(arg_6.split()[4].replace(\",\", \"\"))\n            arg_1.stats_dfs.s2[\"reads_passed_filter\"] = arg_7\n\n    ## save to stats summary\n    if arg_1.stats_dfs.s2.reads_passed_filter:\n        arg_1.stats.state = 2\n        arg_1.stats.reads_passed_filter = arg_1.stats_dfs.s2.reads_passed_filter\n        arg_1.files.edits = [\n            (OPJ(arg_0.dirs.edits, arg_1.name+\".trimmed_R1_.fastq.gz\"), 0)]\n        ## write the long form output to the log file.\n        LOGGER.info(arg_2)\n\n    else:\n        print(\"{}No reads passed filtering in Sample: {}\".format(arg_0._spacer, arg_1.name))", "path": "ipyrad/assemble/rawedit.py", "identifier": "parse_single_results", "docstring": "parse results from cutadapt into sample data", "docstring_tokens": ["parse", "results", "from", "cutadapt", "into", "sample", "data"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258379}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/node/document_matchers.py#L76-L92", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Checks if the page doesn't have the given title.", "language": "python", "parameters": "(self, title, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "try", ":", "arg_0", ".", "assert_no_title", "(", "arg_1", ",", "**", "arg_2", ")", "return", "True", "except", "ExpectationNotMet", ":", "return", "False"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Checks if the page doesn't have the given title.\n\n        Args:\n            title (str | RegexObject): The string that the title should include.\n            **kwargs: Arbitrary keyword arguments for :class:`TitleQuery`.\n\n        Returns:\n            bool: Whether it doesn't match.\n        \"\"\"\n\n        try:\n            arg_0.assert_no_title(arg_1, **arg_2)\n            return True\n        except ExpectationNotMet:\n            return False", "path": "capybara/node/document_matchers.py", "identifier": "DocumentMatchersMixin.has_no_title", "docstring": "Checks if the page doesn't have the given title.\n\n        Args:\n            title (str | RegexObject): The string that the title should include.\n            **kwargs: Arbitrary keyword arguments for :class:`TitleQuery`.\n\n        Returns:\n            bool: Whether it doesn't match.", "docstring_tokens": ["Checks", "if", "the", "page", "doesn", "t", "have", "the", "given", "title", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 258380}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/common.py#L24-L35", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Given a sequence convert it to a comma separated string.\n    If, however, the argument is a single object, return its string\n    representation.", "language": "python", "parameters": "(obj, sep=\",\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\",\"", ")", ":", "if", "isinstance", "(", "arg_0", ",", "string_classes", ")", ":", "return", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "arg_1", ".", "join", "(", "[", "str", "(", "arg_2", ")", "for", "arg_2", "in", "arg_0", "]", ")", "else", ":", "return", "str", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=\",\"):\n    \"\"\"\n    Given a sequence convert it to a comma separated string.\n    If, however, the argument is a single object, return its string\n    representation.\n    \"\"\"\n    if isinstance(arg_0, string_classes):\n        return arg_0\n    elif isinstance(arg_0, (list, tuple)):\n        return arg_1.join([str(arg_2) for arg_2 in arg_0])\n    else:\n        return str(arg_0)", "path": "mhctools/common.py", "identifier": "seq_to_str", "docstring": "Given a sequence convert it to a comma separated string.\n    If, however, the argument is a single object, return its string\n    representation.", "docstring_tokens": ["Given", "a", "sequence", "convert", "it", "to", "a", "comma", "separated", "string", ".", "If", "however", "the", "argument", "is", "a", "single", "object", "return", "its", "string", "representation", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 258381}
{"url": "https://github.com/litl/leeroy/blob/ab6565a3b63e9103d8c011d9c62a9c0ad589b051/leeroy/github.py#L236-L248", "sha": "ab6565a3b63e9103d8c011d9c62a9c0ad589b051", "docstring_summary": "Data for a given pull request.", "language": "python", "parameters": "(app, repo_config, pull_request)", "return_statement": "return response.json", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "get_api_response", "(", "arg_0", ",", "arg_1", ",", "\"/repos/{{repo_name}}/pulls/{0}\"", ".", "format", "(", "arg_2", ")", ")", "if", "not", "arg_3", ".", "ok", ":", "raise", "Exception", "(", "\"Unable to get pull request: status code {}\"", ".", "format", "(", "arg_3", ".", "status_code", ")", ")", "return", "arg_3", ".", "json"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Data for a given pull request.\n\n    :param app: Flask app\n    :param repo_config: dict with ``github_repo`` key\n    :param pull_request: the pull request number\n    \"\"\"\n    arg_3 = get_api_response(\n        arg_0, arg_1,\n        \"/repos/{{repo_name}}/pulls/{0}\".format(arg_2))\n    if not arg_3.ok:\n        raise Exception(\"Unable to get pull request: status code {}\".format(arg_3.status_code))\n    return arg_3.json", "path": "leeroy/github.py", "identifier": "get_pull_request", "docstring": "Data for a given pull request.\n\n    :param app: Flask app\n    :param repo_config: dict with ``github_repo`` key\n    :param pull_request: the pull request number", "docstring_tokens": ["Data", "for", "a", "given", "pull", "request", "."], "nwo": "litl/leeroy", "score": 0.383009142586278, "idx": 258382}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/versiontools_support.py#L101-L110", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Get a live version string using versiontools", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "import", "versiontools", "except", "ImportError", ":", "return", "None", "else", ":", "return", "str", "(", "versiontools", ".", "Version", ".", "from_expression", "(", "arg_0", ".", "name", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get a live version string using versiontools\n        \"\"\"\n        try:\n            import versiontools\n        except ImportError:\n            return None\n        else:\n            return str(versiontools.Version.from_expression(arg_0.name))", "path": "versiontools_support.py", "identifier": "VersiontoolsEnchancedDistributionMetadata.__get_live_version", "docstring": "Get a live version string using versiontools", "docstring_tokens": ["Get", "a", "live", "version", "string", "using", "versiontools"], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 258383}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/etree_utils.py#L25-L38", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Build a basic 035 subfield with basic information from the OAI-PMH request.", "language": "python", "parameters": "(root)", "return_statement": "return subs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "find", "(", "'request'", ")", "arg_2", "=", "arg_0", ".", "find", "(", "'responseDate'", ")", "arg_3", "=", "[", "(", "\"9\"", ",", "arg_1", ".", "text", ")", ",", "(", "\"h\"", ",", "arg_2", ".", "text", ")", ",", "(", "\"m\"", ",", "arg_1", ".", "attrib", "[", "\"metadataPrefix\"", "]", ")", "]", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Build a basic 035 subfield with basic information from the OAI-PMH request.\n\n    :param root: ElementTree root node\n\n    :return: list of subfield tuples [(..),(..)]\n    \"\"\"\n    arg_1 = arg_0.find('request')\n    arg_2 = arg_0.find('responseDate')\n\n    arg_3 = [(\"9\", arg_1.text),\n            (\"h\", arg_2.text),\n            (\"m\", arg_1.attrib[\"metadataPrefix\"])]\n    return arg_3", "path": "harvestingkit/etree_utils.py", "identifier": "get_request_subfields", "docstring": "Build a basic 035 subfield with basic information from the OAI-PMH request.\n\n    :param root: ElementTree root node\n\n    :return: list of subfield tuples [(..),(..)]", "docstring_tokens": ["Build", "a", "basic", "035", "subfield", "with", "basic", "information", "from", "the", "OAI", "-", "PMH", "request", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 258384}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L1564-L1585", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Extract the JSON payload from a JWT.", "language": "python", "parameters": "(id_token)", "return_statement": "return json.loads(\n        _helpers._from_bytes(_helpers._urlsafe_b64decode(segments[1])))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "type", "(", "arg_0", ")", "==", "bytes", ":", "arg_1", "=", "arg_0", ".", "split", "(", "b'.'", ")", "else", ":", "arg_1", "=", "arg_0", ".", "split", "(", "u'.'", ")", "if", "len", "(", "arg_1", ")", "!=", "3", ":", "raise", "VerifyJwtTokenError", "(", "'Wrong number of segments in token: {0}'", ".", "format", "(", "arg_0", ")", ")", "return", "json", ".", "loads", "(", "_helpers", ".", "_from_bytes", "(", "_helpers", ".", "_urlsafe_b64decode", "(", "arg_1", "[", "1", "]", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Extract the JSON payload from a JWT.\n\n    Does the extraction w/o checking the signature.\n\n    Args:\n        id_token: string or bytestring, OAuth 2.0 id_token.\n\n    Returns:\n        object, The deserialized JSON payload.\n    \"\"\"\n    if type(arg_0) == bytes:\n        arg_1 = arg_0.split(b'.')\n    else:\n        arg_1 = arg_0.split(u'.')\n\n    if len(arg_1) != 3:\n        raise VerifyJwtTokenError(\n            'Wrong number of segments in token: {0}'.format(arg_0))\n\n    return json.loads(\n        _helpers._from_bytes(_helpers._urlsafe_b64decode(arg_1[1])))", "path": "oauth2client/client.py", "identifier": "_extract_id_token", "docstring": "Extract the JSON payload from a JWT.\n\n    Does the extraction w/o checking the signature.\n\n    Args:\n        id_token: string or bytestring, OAuth 2.0 id_token.\n\n    Returns:\n        object, The deserialized JSON payload.", "docstring_tokens": ["Extract", "the", "JSON", "payload", "from", "a", "JWT", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 258385}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/palettes.py#L81-L123", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Get a set of evenly spaced colors in HUSL hue space.", "language": "python", "parameters": "(n_colors=6, h=.01, s=.9, l=.65)", "return_statement": "return palette", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "6", ",", "arg_1", "=", ".01", ",", "arg_2", "=", ".9", ",", "arg_3", "=", ".65", ")", ":", "arg_4", "=", "np", ".", "linspace", "(", "0", ",", "1", ",", "arg_0", "+", "1", ")", "[", ":", "-", "1", "]", "arg_4", "+=", "arg_1", "arg_4", "%=", "1", "arg_4", "*=", "359", "arg_2", "*=", "99", "arg_3", "*=", "99", "arg_5", "=", "[", "husl", ".", "husl_to_rgb", "(", "h_i", ",", "arg_2", ",", "arg_3", ")", "for", "h_i", "in", "arg_4", "]", "return", "arg_5"], "function": "def Func(arg_0=6, arg_1=.01, arg_2=.9, arg_3=.65):\n    \"\"\"\n    Get a set of evenly spaced colors in HUSL hue space.\n\n    h, s, and l should be between 0 and 1\n\n    Parameters\n    ----------\n\n    n_colors : int\n        number of colors in the palette\n    h : float\n        first hue\n    s : float\n        saturation\n    l : float\n        lightness\n\n    Returns\n    -------\n    palette : list\n        List of colors as RGB hex strings.\n\n    See Also\n    --------\n    hls_palette : Make a palette using evenly spaced circular\n        hues in the HSL system.\n\n    Examples\n    --------\n    >>> len(Func(3))\n    3\n    >>> len(Func(11))\n    11\n    \"\"\"\n    arg_4 = np.linspace(0, 1, arg_0 + 1)[:-1]\n    arg_4 += arg_1\n    arg_4 %= 1\n    arg_4 *= 359\n    arg_2 *= 99\n    arg_3 *= 99\n    arg_5 = [husl.husl_to_rgb(h_i, arg_2, arg_3) for h_i in arg_4]\n    return arg_5", "path": "mizani/palettes.py", "identifier": "husl_palette", "docstring": "Get a set of evenly spaced colors in HUSL hue space.\n\n    h, s, and l should be between 0 and 1\n\n    Parameters\n    ----------\n\n    n_colors : int\n        number of colors in the palette\n    h : float\n        first hue\n    s : float\n        saturation\n    l : float\n        lightness\n\n    Returns\n    -------\n    palette : list\n        List of colors as RGB hex strings.\n\n    See Also\n    --------\n    hls_palette : Make a palette using evenly spaced circular\n        hues in the HSL system.\n\n    Examples\n    --------\n    >>> len(husl_palette(3))\n    3\n    >>> len(husl_palette(11))\n    11", "docstring_tokens": ["Get", "a", "set", "of", "evenly", "spaced", "colors", "in", "HUSL", "hue", "space", "."], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 258386}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/input_output.py#L338-L363", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Gets the configuration dictionary from the current parameters of the\n    algorithms to be evaluated.", "language": "python", "parameters": "(feature, annot_beats, framesync, boundaries_id,\n                      labels_id)", "return_statement": "return config", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "{", "}", "arg_5", "[", "\"annot_beats\"", "]", "=", "arg_1", "arg_5", "[", "\"feature\"", "]", "=", "arg_0", "arg_5", "[", "\"framesync\"", "]", "=", "arg_2", "arg_6", "=", "{", "}", "if", "arg_3", "!=", "\"gt\"", ":", "arg_6", "=", "eval", "(", "msaf", ".", "algorithms", ".", "__name__", "+", "\".\"", "+", "arg_3", ")", ".", "config", "arg_5", ".", "update", "(", "arg_6", ")", "if", "arg_4", "is", "not", "None", ":", "arg_7", "=", "eval", "(", "msaf", ".", "algorithms", ".", "__name__", "+", "\".\"", "+", "arg_4", ")", ".", "config", "if", "arg_4", "!=", "arg_3", ":", "arg_8", "=", "set", "(", "arg_6", ".", "keys", "(", ")", ")", ".", "intersection", "(", "set", "(", "arg_7", ".", "keys", "(", ")", ")", ")", "assert", "len", "(", "arg_8", ")", "==", "0", ",", "\"Parameter %s must not exist both in %s and %s algorithms\"", "%", "(", "arg_8", ",", "arg_3", ",", "arg_4", ")", "arg_5", ".", "update", "(", "arg_7", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                      arg_4):\n    \"\"\"Gets the configuration dictionary from the current parameters of the\n    algorithms to be evaluated.\"\"\"\n    arg_5 = {}\n    arg_5[\"annot_beats\"] = arg_1\n    arg_5[\"feature\"] = arg_0\n    arg_5[\"framesync\"] = arg_2\n    arg_6 = {}\n    if arg_3 != \"gt\":\n        arg_6 = \\\n            eval(msaf.algorithms.__name__ + \".\" + arg_3).config\n        arg_5.update(arg_6)\n    if arg_4 is not None:\n        arg_7 = \\\n            eval(msaf.algorithms.__name__ + \".\" + arg_4).config\n\n        # Make sure we don't have parameter name duplicates\n        if arg_4 != arg_3:\n            arg_8 = set(arg_6.keys()). \\\n                intersection(set(arg_7.keys()))\n            assert len(arg_8) == 0, \\\n                \"Parameter %s must not exist both in %s and %s algorithms\" % \\\n                (arg_8, arg_3, arg_4)\n        arg_5.update(arg_7)\n    return arg_5", "path": "msaf/input_output.py", "identifier": "get_configuration", "docstring": "Gets the configuration dictionary from the current parameters of the\n    algorithms to be evaluated.", "docstring_tokens": ["Gets", "the", "configuration", "dictionary", "from", "the", "current", "parameters", "of", "the", "algorithms", "to", "be", "evaluated", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 258387}
{"url": "https://github.com/nsqio/pynsq/blob/48bf62d65ea63cddaa401efb23187b95511dbc84/nsq/writer.py#L116-L124", "sha": "48bf62d65ea63cddaa401efb23187b95511dbc84", "docstring_summary": "publish a message to nsq", "language": "python", "parameters": "(self, topic, msg, callback=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "_Func", "(", "'Func'", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Funclish a message to nsq\n\n        :param topic: nsq topic\n        :param msg: message body (bytes)\n        :param callback: function which takes (conn, data) (data may be nsq.Error)\n        \"\"\"\n        arg_0._Func('Func', arg_1, arg_2, arg_3=arg_3)", "path": "nsq/writer.py", "identifier": "Writer.pub", "docstring": "publish a message to nsq\n\n        :param topic: nsq topic\n        :param msg: message body (bytes)\n        :param callback: function which takes (conn, data) (data may be nsq.Error)", "docstring_tokens": ["publish", "a", "message", "to", "nsq"], "nwo": "nsqio/pynsq", "score": 0.4773523738069914, "idx": 258388}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/utils/validation.py#L4-L39", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Checks if the blocks in the RDD matches the expected types.", "language": "python", "parameters": "(rdd, expected_dtype)", "return_statement": "return rdd.dtype in expected_dtype", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "BlockRDD", ")", ":", "raise", "TypeError", "(", "\"Expected {0} for parameter rdd, got {1}.\"", ".", "format", "(", "BlockRDD", ",", "type", "(", "arg_0", ")", ")", ")", "if", "isinstance", "(", "arg_0", ",", "DictRDD", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "raise", "TypeError", "(", "'Expected {0} for parameter '", "'expected_dtype, got {1}.'", ".", "format", "(", "dict", ",", "type", "(", "arg_1", ")", ")", ")", "arg_2", "=", "True", "arg_3", "=", "dict", "(", "list", "(", "zip", "(", "arg_0", ".", "columns", ",", "arg_0", ".", "dtype", ")", ")", ")", "for", "arg_4", ",", "arg_5", "in", "arg_1", ".", "items", "(", ")", ":", "if", "not", "isinstance", "(", "arg_5", ",", "(", "tuple", ",", "list", ")", ")", ":", "arg_5", "=", "[", "arg_5", "]", "arg_2", "=", "arg_2", "and", "arg_3", "[", "arg_4", "]", "in", "arg_5", "return", "arg_2", "if", "not", "isinstance", "(", "arg_1", ",", "(", "tuple", ",", "list", ")", ")", ":", "arg_1", "=", "[", "arg_1", "]", "return", "arg_0", ".", "dtype", "in", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Checks if the blocks in the RDD matches the expected types.\n\n    Parameters:\n    -----------\n    rdd: splearn.BlockRDD\n        The RDD to check\n    expected_dtype: {type, list of types, tuple of types, dict of types}\n        Expected type(s). If the RDD is a DictRDD the parameter type is\n        restricted to dict.\n\n    Returns:\n    --------\n    accept: bool\n        Returns if the types are matched.\n    \"\"\"\n    if not isinstance(arg_0, BlockRDD):\n        raise TypeError(\"Expected {0} for parameter rdd, got {1}.\"\n                        .format(BlockRDD, type(arg_0)))\n    if isinstance(arg_0, DictRDD):\n        if not isinstance(arg_1, dict):\n            raise TypeError('Expected {0} for parameter '\n                            'expected_dtype, got {1}.'\n                            .format(dict, type(arg_1)))\n        arg_2 = True\n        arg_3 = dict(list(zip(arg_0.columns, arg_0.dtype)))\n        for arg_4, arg_5 in arg_1.items():\n            if not isinstance(arg_5, (tuple, list)):\n                arg_5 = [arg_5]\n            arg_2 = arg_2 and arg_3[arg_4] in arg_5\n        return arg_2\n\n    if not isinstance(arg_1, (tuple, list)):\n        arg_1 = [arg_1]\n\n    return arg_0.dtype in arg_1", "path": "splearn/utils/validation.py", "identifier": "check_rdd_dtype", "docstring": "Checks if the blocks in the RDD matches the expected types.\n\n    Parameters:\n    -----------\n    rdd: splearn.BlockRDD\n        The RDD to check\n    expected_dtype: {type, list of types, tuple of types, dict of types}\n        Expected type(s). If the RDD is a DictRDD the parameter type is\n        restricted to dict.\n\n    Returns:\n    --------\n    accept: bool\n        Returns if the types are matched.", "docstring_tokens": ["Checks", "if", "the", "blocks", "in", "the", "RDD", "matches", "the", "expected", "types", "."], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 258389}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L507-L537", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Slices and returns a subset of image data.", "language": "python", "parameters": "(self, ids=None, voxels=None, dense=True)", "return_statement": "return result.toarray() if dense else result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "if", "arg_3", "and", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "logger", ".", "warning", "(", "\"Warning: Func() is being called without specifying \"", "\"a subset of studies or voxels to retrieve. This may result in\"", "\" a very large amount of data (several GB) being read into \"", "\"memory. If you experience any problems, consider returning a \"", "\"sparse matrix by passing dense=False, or pass in a list of \"", "\"ids of voxels to retrieve only a portion of the data.\"", ")", "arg_4", "=", "arg_0", ".", "data", "if", "arg_1", "is", "not", "None", ":", "arg_5", "=", "np", ".", "where", "(", "np", ".", "in1d", "(", "np", ".", "array", "(", "arg_0", ".", "ids", ")", ",", "np", ".", "array", "(", "arg_1", ")", ")", ")", "[", "0", "]", "arg_4", "=", "arg_4", "[", ":", ",", "arg_5", "]", "if", "arg_2", "is", "not", "None", ":", "arg_4", "=", "arg_4", "[", "arg_2", ",", ":", "]", "return", "arg_4", ".", "toarray", "(", ")", "if", "arg_3", "else", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True):\n        \"\"\" Slices and returns a subset of image data.\n\n        Args:\n            ids (list, array): A list or 1D numpy array of study ids to\n                return. If None, returns data for all studies.\n            voxels (list, array): A list or 1D numpy array of voxel indices\n                (i.e., rows) to return. If None, returns data for all voxels.\n            dense (bool): Optional boolean. When True (default), convert the\n                result to a dense array before returning. When False, keep as\n                sparse matrix.\n\n        Returns:\n          A 2D numpy array with voxels in rows and studies in columns.\n        \"\"\"\n        if arg_3 and arg_1 is None and arg_2 is None:\n            logger.warning(\n                \"Warning: Func() is being called without specifying \"\n                \"a subset of studies or voxels to retrieve. This may result in\"\n                \" a very large amount of data (several GB) being read into \"\n                \"memory. If you experience any problems, consider returning a \"\n                \"sparse matrix by passing dense=False, or pass in a list of \"\n                \"ids of voxels to retrieve only a portion of the data.\")\n\n        arg_4 = arg_0.data\n        if arg_1 is not None:\n            arg_5 = np.where(np.in1d(np.array(arg_0.ids), np.array(arg_1)))[0]\n            arg_4 = arg_4[:, arg_5]\n        if arg_2 is not None:\n            arg_4 = arg_4[arg_2, :]\n        return arg_4.toarray() if arg_3 else arg_4", "path": "neurosynth/base/dataset.py", "identifier": "ImageTable.get_image_data", "docstring": "Slices and returns a subset of image data.\n\n        Args:\n            ids (list, array): A list or 1D numpy array of study ids to\n                return. If None, returns data for all studies.\n            voxels (list, array): A list or 1D numpy array of voxel indices\n                (i.e., rows) to return. If None, returns data for all voxels.\n            dense (bool): Optional boolean. When True (default), convert the\n                result to a dense array before returning. When False, keep as\n                sparse matrix.\n\n        Returns:\n          A 2D numpy array with voxels in rows and studies in columns.", "docstring_tokens": ["Slices", "and", "returns", "a", "subset", "of", "image", "data", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 258390}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/pyparser.py#L42-L47", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Parse code from a string of text.", "language": "python", "parameters": "(text)", "return_statement": "return Code(_tokenize(readline))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "_str_type", ")", ",", "\"`text` parameter should be a string, got %r\"", "%", "type", "(", "arg_0", ")", "arg_1", "=", "iter", "(", "arg_0", ".", "splitlines", "(", "True", ")", ")", "arg_2", "=", "arg_1", ".", "next", "if", "hasattr", "(", "arg_1", ",", "\"next\"", ")", "else", "arg_1", ".", "__next__", "return", "Code", "(", "_tokenize", "(", "arg_2", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Parse code from a string of text.\"\"\"\n    assert isinstance(arg_0, _str_type), \"`text` parameter should be a string, got %r\" % type(arg_0)\n    arg_1 = iter(arg_0.splitlines(True))  # True = keep newlines\n    arg_2 = arg_1.next if hasattr(arg_1, \"next\") else arg_1.__next__\n    return Code(_tokenize(arg_2))", "path": "h2o-bindings/bin/pyparser.py", "identifier": "parse_text", "docstring": "Parse code from a string of text.", "docstring_tokens": ["Parse", "code", "from", "a", "string", "of", "text", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258391}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/parser.py#L100-L202", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "parser cliez app", "language": "python", "parameters": "(parser, argv=None, settings_key='settings', no_args_func=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'settings'", ",", "arg_3", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "sys", ".", "argv", "arg_4", "=", "command_list", "(", ")", "if", "type", "(", "arg_1", ")", "not", "in", "[", "list", ",", "tuple", "]", ":", "raise", "TypeError", "(", "\"argv only can be list or tuple\"", ")", "if", "len", "(", "arg_1", ")", ">=", "2", "and", "arg_1", "[", "1", "]", "in", "arg_4", ":", "arg_5", "=", "arg_0", ".", "add_subFuncrs", "(", ")", "arg_6", "=", "arg_1", "[", "1", "]", ".", "capitalize", "(", ")", "+", "'Component'", "from", "cliez", ".", "conf", "import", "(", "COMPONENT_ROOT", ",", "LOGGING_CONFIG", ",", "EPILOG", ",", "GENERAL_ARGUMENTS", ")", "sys", ".", "path", ".", "insert", "(", "0", ",", "os", ".", "path", ".", "dirname", "(", "COMPONENT_ROOT", ")", ")", "arg_7", "=", "importlib", ".", "import_module", "(", "'{}.components.{}'", ".", "format", "(", "os", ".", "path", ".", "basename", "(", "COMPONENT_ROOT", ")", ",", "arg_1", "[", "1", "]", ")", ")", "arg_8", "=", "getattr", "(", "arg_7", ",", "arg_6", ")", "arg_9", "=", "append_arguments", "(", "arg_8", ",", "arg_5", ",", "EPILOG", ",", "GENERAL_ARGUMENTS", ")", "arg_10", "=", "arg_0", ".", "Func_args", "(", "arg_1", "[", "1", ":", "]", ")", "arg_11", "=", "Settings", ".", "bind", "(", "getattr", "(", "arg_10", ",", "arg_2", ")", ")", "if", "arg_2", "and", "hasattr", "(", "arg_10", ",", "arg_2", ")", "else", "None", "arg_12", "=", "arg_8", "(", "arg_0", ",", "arg_9", ",", "arg_10", ",", "arg_11", ")", "arg_13", "=", "logging", ".", "CRITICAL", "if", "hasattr", "(", "arg_10", ",", "'verbose'", ")", ":", "if", "arg_10", ".", "verbose", "==", "1", ":", "arg_13", "=", "logging", ".", "ERROR", "elif", "arg_10", ".", "verbose", "==", "2", ":", "arg_13", "=", "logging", ".", "WARNING", "elif", "arg_10", ".", "verbose", "==", "3", ":", "arg_13", "=", "logging", ".", "INFO", "arg_12", ".", "logger", ".", "setLevel", "(", "logging", ".", "INFO", ")", "pass", "if", "hasattr", "(", "arg_10", ",", "'debug'", ")", "and", "arg_10", ".", "debug", ":", "arg_13", "=", "logging", ".", "DEBUG", "try", ":", "import", "http", ".", "client", "as", "arg_14", "arg_14", ".", "HTTPConnection", ".", "debuglevel", "=", "1", "except", "Exception", ":", "pass", "pass", "arg_17", "=", "LOGGING_CONFIG", "[", "'loggers'", "]", "for", "arg_18", ",", "arg_19", "in", "arg_17", ".", "items", "(", ")", ":", "arg_19", ".", "setdefault", "(", "'level'", ",", "arg_13", ")", "if", "arg_13", "in", "[", "logging", ".", "INFO", ",", "logging", ".", "DEBUG", "]", ":", "arg_19", "[", "'handlers'", "]", "=", "[", "'stdout'", "]", "pass", "logging_config", ".", "dictConfig", "(", "LOGGING_CONFIG", ")", "arg_12", ".", "run", "(", "arg_10", ")", "return", "arg_12", "if", "not", "arg_0", ".", "description", "and", "len", "(", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "add_subFuncrs", "(", ")", "[", "arg_5", ".", "add_Funcr", "(", "arg_19", ")", "for", "arg_19", "in", "arg_4", "]", "pass", "pass", "arg_10", "=", "arg_0", ".", "Func_args", "(", "arg_1", "[", "1", ":", "]", ")", "if", "arg_3", "and", "callable", "(", "arg_3", ")", ":", "return", "arg_3", "(", "arg_10", ")", "else", ":", "arg_0", ".", "_print_message", "(", "\"nothing to do...\\n\"", ")", "pass"], "function": "def Func(arg_0, arg_1=None, arg_2='settings', arg_3=None):\n    \"\"\"\n    Funcr cliez app\n\n    :param argFunc.ArgumentParser Funcr: an instance\n        of argFunc.ArgumentParser\n    :param argv: argument list,default is `sys.argv`\n    :type argv: list or tuple\n\n    :param str settings: settings option name,\n        default is settings.\n\n    :param object no_args_func: a callable object.if no sub-Funcr matched,\n        Funcr will call it.\n\n    :return:  an instance of `cliez.component.Component` or its subclass\n    \"\"\"\n\n    arg_1 = arg_1 or sys.argv\n    arg_4 = command_list()\n\n    if type(arg_1) not in [list, tuple]:\n        raise TypeError(\"argv only can be list or tuple\")\n\n    # match sub-Funcr\n    if len(arg_1) >= 2 and arg_1[1] in arg_4:\n        arg_5 = arg_0.add_subFuncrs()\n        arg_6 = arg_1[1].capitalize() + 'Component'\n\n        from cliez.conf import (COMPONENT_ROOT,\n                                LOGGING_CONFIG,\n                                EPILOG,\n                                GENERAL_ARGUMENTS)\n\n        sys.path.insert(0, os.path.dirname(COMPONENT_ROOT))\n        arg_7 = importlib.import_module(\n            '{}.components.{}'.format(os.path.basename(COMPONENT_ROOT),\n                                      arg_1[1]))\n\n        # dynamic load component\n        arg_8 = getattr(arg_7, arg_6)\n        arg_9 = append_arguments(arg_8, arg_5, EPILOG,\n                                      GENERAL_ARGUMENTS)\n        arg_10 = arg_0.Func_args(arg_1[1:])\n\n        arg_11 = Settings.bind(\n            getattr(arg_10, arg_2)\n        ) if arg_2 and hasattr(arg_10, arg_2) else None\n\n        arg_12 = arg_8(arg_0, arg_9, arg_10, arg_11)\n\n        # init logger\n        arg_13 = logging.CRITICAL\n        if hasattr(arg_10, 'verbose'):\n            if arg_10.verbose == 1:\n                arg_13 = logging.ERROR\n            elif arg_10.verbose == 2:\n                arg_13 = logging.WARNING\n            elif arg_10.verbose == 3:\n                arg_13 = logging.INFO\n                arg_12.logger.setLevel(logging.INFO)\n            pass\n\n        if hasattr(arg_10, 'debug') and arg_10.debug:\n            arg_13 = logging.DEBUG\n            # http lib use a strange way to logging\n            try:\n                import http.client as arg_14\n                arg_14.HTTPConnection.debuglevel = 1\n            except Exception:\n                # do nothing\n                pass\n            pass\n\n        arg_17 = LOGGING_CONFIG['loggers']\n        for arg_18, arg_19 in arg_17.items():\n            arg_19.setdefault('level', arg_13)\n            if arg_13 in [logging.INFO, logging.DEBUG]:\n                arg_19['handlers'] = ['stdout']\n            pass\n\n        logging_config.dictConfig(LOGGING_CONFIG)\n        # this may not necessary\n        # obj.logger.setLevel(logger_level)\n\n        arg_12.run(arg_10)\n\n        # return object to make unit test easy\n        return arg_12\n\n    # print all sub commands when user set.\n    if not arg_0.description and len(arg_4):\n        arg_5 = arg_0.add_subFuncrs()\n        [arg_5.add_Funcr(arg_19) for arg_19 in arg_4]\n        pass\n    pass\n\n    arg_10 = arg_0.Func_args(arg_1[1:])\n    if arg_3 and callable(arg_3):\n        return arg_3(arg_10)\n    else:\n        arg_0._print_message(\"nothing to do...\\n\")\n    pass", "path": "cliez/parser.py", "identifier": "parse", "docstring": "parser cliez app\n\n    :param argparse.ArgumentParser parser: an instance\n        of argparse.ArgumentParser\n    :param argv: argument list,default is `sys.argv`\n    :type argv: list or tuple\n\n    :param str settings: settings option name,\n        default is settings.\n\n    :param object no_args_func: a callable object.if no sub-parser matched,\n        parser will call it.\n\n    :return:  an instance of `cliez.component.Component` or its subclass", "docstring_tokens": ["parser", "cliez", "app"], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 258392}
{"url": "https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L339-L347", "sha": "7ea7626695abf095df6a67f66e5b3e9ae91b16df", "docstring_summary": "If input object is an ndarray it will be converted into a list", "language": "python", "parameters": "(self, obj)", "return_statement": "return json.JSONEncoder(self, obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "np", ".", "ndarray", ")", ":", "return", "arg_1", ".", "tolist", "(", ")", "elif", "isinstance", "(", "arg_1", ",", "np", ".", "generic", ")", ":", "return", "np", ".", "asscalar", "(", "arg_1", ")", "return", "json", ".", "JSONEncoder", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"If input object is an ndarray it will be converted into a list\n        \"\"\"\n        if isinstance(arg_1, np.ndarray):\n            return arg_1.tolist()\n        elif isinstance(arg_1, np.generic):\n            return np.asscalar(arg_1)\n        # Let the base class Func method raise the TypeError\n        return json.JSONEncoder(arg_0, arg_1)", "path": "pyaxiom/utils.py", "identifier": "BasicNumpyEncoder.default", "docstring": "If input object is an ndarray it will be converted into a list", "docstring_tokens": ["If", "input", "object", "is", "an", "ndarray", "it", "will", "be", "converted", "into", "a", "list"], "nwo": "axiom-data-science/pyaxiom", "score": 0.138843686048881, "idx": 258393}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/git/timestamp.py#L35-L85", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Obtain the timestamp for the most recent commit to a given file in a\n    Git repository.", "language": "python", "parameters": "(filepath, repo_path=None, repo=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "logging", ".", "getLogger", "(", "__name__", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "git", ".", "repo", ".", "base", ".", "Repo", "(", "path", "=", "arg_1", ",", "search_parent_directories", "=", "True", ")", "arg_1", "=", "arg_2", ".", "working_tree_dir", "arg_4", "=", "arg_2", ".", "head", ".", "commit", "arg_3", ".", "debug", "(", "'Using Git repo at %r'", ",", "arg_1", ")", "arg_0", "=", "os", ".", "path", ".", "relpath", "(", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", ",", "start", "=", "arg_1", ")", "arg_3", ".", "debug", "(", "'Repo-relative filepath is %r'", ",", "arg_0", ")", "for", "arg_5", "in", "arg_4", ".", "iter_items", "(", "arg_2", ",", "arg_4", ",", "[", "arg_0", "]", ",", "skip", "=", "0", ")", ":", "return", "arg_5", ".", "committed_datetime", "raise", "IOError", "(", "'File {} not found'", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Obtain the timestamp for the most recent commit to a given file in a\n    Git repository.\n\n    Parameters\n    ----------\n    filepath : `str`\n        Absolute or repository-relative path for a file.\n    repo_path : `str`, optional\n        Path to the Git repository. Leave as `None` to use the current working\n        directory or if a ``repo`` argument is provided.\n    repo : `git.Repo`, optional\n        A `git.Repo` instance.\n\n    Returns\n    -------\n    commit_timestamp : `datetime.datetime`\n        The datetime of the most recent commit to the given file.\n\n    Raises\n    ------\n    IOError\n        Raised if the ``filepath`` does not exist in the Git repository.\n    \"\"\"\n    arg_3 = logging.getLogger(__name__)\n\n    if arg_2 is None:\n        arg_2 = git.repo.base.Repo(path=arg_1,\n                                  search_parent_directories=True)\n    arg_1 = arg_2.working_tree_dir\n\n    arg_4 = arg_2.head.commit\n\n    # filepath relative to the repo path\n    arg_3.debug('Using Git repo at %r', arg_1)\n    arg_0 = os.path.relpath(\n        os.path.abspath(arg_0),\n        start=arg_1)\n    arg_3.debug('Repo-relative filepath is %r', arg_0)\n\n    # Most recent commit datetime of the given file.\n    # Don't use head_commit.iter_parents because then it skips the\n    # commit of a file that's added but never modified.\n    for arg_5 in arg_4.iter_items(arg_2,\n                                         arg_4,\n                                         [arg_0],\n                                         skip=0):\n        return arg_5.committed_datetime\n\n    # Only get here if git could not find the file path in the history\n    raise IOError('File {} not found'.format(arg_0))", "path": "lsstprojectmeta/git/timestamp.py", "identifier": "read_git_commit_timestamp_for_file", "docstring": "Obtain the timestamp for the most recent commit to a given file in a\n    Git repository.\n\n    Parameters\n    ----------\n    filepath : `str`\n        Absolute or repository-relative path for a file.\n    repo_path : `str`, optional\n        Path to the Git repository. Leave as `None` to use the current working\n        directory or if a ``repo`` argument is provided.\n    repo : `git.Repo`, optional\n        A `git.Repo` instance.\n\n    Returns\n    -------\n    commit_timestamp : `datetime.datetime`\n        The datetime of the most recent commit to the given file.\n\n    Raises\n    ------\n    IOError\n        Raised if the ``filepath`` does not exist in the Git repository.", "docstring_tokens": ["Obtain", "the", "timestamp", "for", "the", "most", "recent", "commit", "to", "a", "given", "file", "in", "a", "Git", "repository", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 258394}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/_pkce.py#L27-L49", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Generates a 'code_verifier' as described in section 4.1 of RFC 7636.", "language": "python", "parameters": "(n_bytes=64)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "64", ")", ":", "arg_1", "=", "base64", ".", "urlsafe_b64encode", "(", "os", ".", "urandom", "(", "arg_0", ")", ")", ".", "rstrip", "(", "b'='", ")", "if", "len", "(", "arg_1", ")", "<", "43", ":", "raise", "ValueError", "(", "\"Verifier too short. n_bytes must be > 30.\"", ")", "elif", "len", "(", "arg_1", ")", ">", "128", ":", "raise", "ValueError", "(", "\"Verifier too long. n_bytes must be < 97.\"", ")", "else", ":", "return", "arg_1"], "function": "def Func(arg_0=64):\n    \"\"\"\n    Generates a 'Func' as described in section 4.1 of RFC 7636.\n\n    This is a 'high-entropy cryptographic random string' that will be\n    impractical for an attacker to guess.\n\n    Args:\n        n_bytes: integer between 31 and 96, inclusive. default: 64\n            number of bytes of entropy to include in verifier.\n\n    Returns:\n        Bytestring, representing urlsafe base64-encoded random data.\n    \"\"\"\n    arg_1 = base64.urlsafe_b64encode(os.urandom(arg_0)).rstrip(b'=')\n    # https://tools.ietf.org/html/rfc7636#section-4.1\n    # minimum length of 43 characters and a maximum length of 128 characters.\n    if len(arg_1) < 43:\n        raise ValueError(\"Verifier too short. n_bytes must be > 30.\")\n    elif len(arg_1) > 128:\n        raise ValueError(\"Verifier too long. n_bytes must be < 97.\")\n    else:\n        return arg_1", "path": "oauth2client/_pkce.py", "identifier": "code_verifier", "docstring": "Generates a 'code_verifier' as described in section 4.1 of RFC 7636.\n\n    This is a 'high-entropy cryptographic random string' that will be\n    impractical for an attacker to guess.\n\n    Args:\n        n_bytes: integer between 31 and 96, inclusive. default: 64\n            number of bytes of entropy to include in verifier.\n\n    Returns:\n        Bytestring, representing urlsafe base64-encoded random data.", "docstring_tokens": ["Generates", "a", "code_verifier", "as", "described", "in", "section", "4", ".", "1", "of", "RFC", "7636", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 258395}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L594-L616", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Prepare a default GromacsWrapper global environment.", "language": "python", "parameters": "(filename=CONFIGNAME)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ")", ":", "get_configuration", "(", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'w'", ")", "as", "configfile", ":", "cfg", ".", "write", "(", "configfile", ")", "arg_2", "=", "\"NOTE: GromacsWrapper created the configuration file \\n\\t%r\\n\"", "\"      for you. Edit the file to customize the package.\"", "%", "arg_0", "print", "(", "arg_2", ")", "for", "arg_3", "in", "config_directories", ":", "utilities", ".", "mkdir_p", "(", "arg_3", ")"], "function": "def Func(arg_0=arg_1):\n     \"\"\"Prepare a default GromacsWrapper global environment.\n\n     1) Create the global config file.\n     2) Create the directories in which the user can store template and config files.\n\n     This function can be run repeatedly without harm.\n     \"\"\"\n     # Func() must be separate and NOT run automatically when config\n     # is loaded so that easy_install installations work\n     # (otherwise we get a sandbox violation)\n     # populate cfg with defaults (or existing data)\n     get_configuration()\n     if not os.path.exists(arg_0):\n          with open(arg_0, 'w') as configfile:\n               cfg.write(configfile)  # write the default file so that user can edit\n               arg_2 = \"NOTE: GromacsWrapper created the configuration file \\n\\t%r\\n\" \\\n                     \"      for you. Edit the file to customize the package.\" % arg_0\n               print(arg_2)\n\n     # directories\n     for arg_3 in config_directories:\n          utilities.mkdir_p(arg_3)", "path": "gromacs/config.py", "identifier": "setup", "docstring": "Prepare a default GromacsWrapper global environment.\n\n     1) Create the global config file.\n     2) Create the directories in which the user can store template and config files.\n\n     This function can be run repeatedly without harm.", "docstring_tokens": ["Prepare", "a", "default", "GromacsWrapper", "global", "environment", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 258396}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/models.py#L83-L125", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Work-in-progress constructor,\n        consuming fields and values from django model instance.", "language": "python", "parameters": "(cls, model, *fields, **named_fields)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "ModelDict", "(", ")", "if", "not", "(", "arg_2", "or", "arg_3", ")", ":", "arg_2", "=", "[", "f", ".", "attname", "for", "f", "in", "arg_1", ".", "_meta", ".", "concrete_fields", "]", "arg_5", "=", "object", "(", ")", "for", "arg_6", ",", "arg_7", "in", "chain", "(", "zip", "(", "arg_2", ",", "arg_2", ")", ",", "arg_3", ".", "items", "(", ")", ")", ":", "arg_8", "=", "arg_7", ".", "split", "(", "\"__\"", ")", "arg_9", "=", "arg_1", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_8", ",", "start", "=", "1", ")", ":", "arg_12", "=", "arg_9", "arg_9", "=", "getattr", "(", "arg_12", ",", "arg_11", ",", "arg_5", ")", "if", "arg_9", "is", "arg_5", ":", "if", "arg_11", "in", "dir", "(", "arg_12", ")", ":", "raise", "ValueError", "(", "\"{!r}.{} had an AttributeError exception\"", ".", "format", "(", "arg_12", ",", "arg_11", ")", ")", "else", ":", "raise", "AttributeError", "(", "\"{!r} does not have {!r} attribute\"", ".", "format", "(", "arg_12", ",", "arg_11", ")", ")", "elif", "arg_9", "is", "None", ":", "if", "arg_6", "not", "in", "arg_3", ":", "arg_6", "=", "\"__\"", ".", "join", "(", "arg_8", "[", ":", "arg_10", "]", ")", "break", "arg_4", "[", "arg_6", "]", "=", "arg_9", "return", "arg_4"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Work-in-progress constructor,\n        consuming fields and values from django model instance.\n        \"\"\"\n        arg_4 = ModelDict()\n\n        if not (arg_2 or arg_3):\n            # Default to all fields\n            arg_2 = [f.attname for f in arg_1._meta.concrete_fields]\n\n        arg_5 = object()\n\n        for arg_6, arg_7 in chain(zip(arg_2, arg_2), arg_3.items()):\n            arg_8 = arg_7.split(\"__\")\n            arg_9 = arg_1\n            for arg_10, arg_11 in enumerate(arg_8, start=1):\n                # NOTE: we don't want to rely on hasattr here\n                arg_12 = arg_9\n                arg_9 = getattr(arg_12, arg_11, arg_5)\n\n                if arg_9 is arg_5:\n                    if arg_11 in dir(arg_12):\n                        raise ValueError(\n                            \"{!r}.{} had an AttributeError exception\".format(\n                                arg_12, arg_11\n                            )\n                        )\n                    else:\n                        raise AttributeError(\n                            \"{!r} does not have {!r} attribute\".format(\n                                arg_12, arg_11\n                            )\n                        )\n\n                elif arg_9 is None:\n                    if arg_6 not in arg_3:\n                        arg_6 = \"__\".join(arg_8[:arg_10])\n                    break\n\n            arg_4[arg_6] = arg_9\n\n        return arg_4", "path": "bananas/models.py", "identifier": "ModelDict.from_model", "docstring": "Work-in-progress constructor,\n        consuming fields and values from django model instance.", "docstring_tokens": ["Work", "-", "in", "-", "progress", "constructor", "consuming", "fields", "and", "values", "from", "django", "model", "instance", "."], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 258397}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/wave2D/parallelwave-mpi.py#L47-L52", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "save the wave log", "language": "python", "parameters": "(u, x, y, t)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "global", "u_hist", "global", "t_hist", "t_hist", ".", "append", "(", "arg_3", ")", "u_hist", ".", "append", "(", "1.0", "*", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"save the wave log\"\"\"\n    global u_hist\n    global t_hist\n    t_hist.append(arg_3)\n    u_hist.append(1.0*arg_0)", "path": "environment/share/doc/ipython/examples/parallel/wave2D/parallelwave-mpi.py", "identifier": "wave_saver", "docstring": "save the wave log", "docstring_tokens": ["save", "the", "wave", "log"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258398}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/generate.py#L153-L192", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Return the analytic directory to write depending of the matched\n        status.", "language": "python", "parameters": "(self)", "return_statement": "return output_dir", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "arg_0", ".", "output_parent_dir", "+", "PyFunceble", ".", "OUTPUTS", "[", "\"analytic\"", "]", "[", "\"directories\"", "]", "[", "\"parent\"", "]", ")", "if", "arg_0", ".", "domain_status", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"potentially_up\"", "]", ":", "arg_1", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"analytic\"", "]", "[", "\"directories\"", "]", "[", "\"potentially_up\"", "]", "elif", "(", "arg_0", ".", "domain_status", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"potentially_down\"", "]", ")", ":", "arg_1", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"analytic\"", "]", "[", "\"directories\"", "]", "[", "\"potentially_down\"", "]", "elif", "arg_0", ".", "domain_status", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"suspicious\"", "]", ":", "arg_1", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"analytic\"", "]", "[", "\"directories\"", "]", "[", "\"suspicious\"", "]", "else", ":", "arg_1", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"analytic\"", "]", "[", "\"directories\"", "]", "[", "\"up\"", "]", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the analytic directory to write depending of the matched\n        status.\n        \"\"\"\n\n        # We construct the path to the analytic directory.\n        arg_1 = (\n            arg_0.output_parent_dir\n            + PyFunceble.OUTPUTS[\"analytic\"][\"directories\"][\"parent\"]\n        )\n\n        if arg_0.domain_status.lower() in PyFunceble.STATUS[\"list\"][\"potentially_up\"]:\n            # The status is in the list of analytic up status.\n\n            # We complete the output directory.\n            arg_1 += PyFunceble.OUTPUTS[\"analytic\"][\"directories\"][\n                \"potentially_up\"\n            ]\n        elif (\n            arg_0.domain_status.lower() in PyFunceble.STATUS[\"list\"][\"potentially_down\"]\n        ):\n            # The status is in the list of analytic down status.\n\n            # We complete the output directory.\n            arg_1 += PyFunceble.OUTPUTS[\"analytic\"][\"directories\"][\n                \"potentially_down\"\n            ]\n        elif arg_0.domain_status.lower() in PyFunceble.STATUS[\"list\"][\"suspicious\"]:\n            # The status is in the list of analytic suspicious status.\n\n            # We complete the output directory.\n            arg_1 += PyFunceble.OUTPUTS[\"analytic\"][\"directories\"][\"suspicious\"]\n        else:\n            # The status is not in the list of analytic down or up status.\n\n            # We complete the output directory.\n            arg_1 += PyFunceble.OUTPUTS[\"analytic\"][\"directories\"][\"up\"]\n\n        return arg_1", "path": "PyFunceble/generate.py", "identifier": "Generate._analytic_host_file_directory", "docstring": "Return the analytic directory to write depending of the matched\n        status.", "docstring_tokens": ["Return", "the", "analytic", "directory", "to", "write", "depending", "of", "the", "matched", "status", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 258399}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/normalizer.py#L25-L39", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Delete latex comments from TeX source.", "language": "python", "parameters": "(tex_source)", "return_statement": "return re.sub(r'(?<!\\\\)%.*$', r'', tex_source, flags=re.M)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "re", ".", "sub", "(", "r'(?<!\\\\)%.*$'", ",", "r''", ",", "arg_0", ",", "flags", "=", "re", ".", "M", ")"], "function": "def Func(arg_0):\n    \"\"\"Delete latex comments from TeX source.\n\n    Parameters\n    ----------\n    tex_source : str\n        TeX source content.\n\n    Returns\n    -------\n    tex_source : str\n        TeX source without comments.\n    \"\"\"\n    # Expression via http://stackoverflow.com/a/13365453\n    return re.sub(r'(?<!\\\\)%.*$', r'', arg_0, flags=re.M)", "path": "lsstprojectmeta/tex/normalizer.py", "identifier": "remove_comments", "docstring": "Delete latex comments from TeX source.\n\n    Parameters\n    ----------\n    tex_source : str\n        TeX source content.\n\n    Returns\n    -------\n    tex_source : str\n        TeX source without comments.", "docstring_tokens": ["Delete", "latex", "comments", "from", "TeX", "source", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 258400}
{"url": "https://github.com/saxix/sample-data-utils/blob/769f1b46e60def2675a14bd5872047af6d1ea398/sample_data_utils/net.py#L13-L26", "sha": "769f1b46e60def2675a14bd5872047af6d1ea398", "docstring_summary": "returns a string representing a random ip address", "language": "python", "parameters": "(not_valid=None)", "return_statement": "return \".\".join([str(first), str(randrange(1, 256)),\n                     str(randrange(1, 256)), str(randrange(1, 256))])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "arg_0", "or", "[", "]", "arg_2", "=", "[", "r", "for", "r", "in", "range", "(", "1", ",", "256", ")", "if", "r", "not", "in", "arg_1", "]", "shuffle", "(", "arg_2", ")", "arg_3", "=", "arg_2", ".", "pop", "(", ")", "return", "\".\"", ".", "join", "(", "[", "str", "(", "arg_3", ")", ",", "str", "(", "randrange", "(", "1", ",", "256", ")", ")", ",", "str", "(", "randrange", "(", "1", ",", "256", ")", ")", ",", "str", "(", "randrange", "(", "1", ",", "256", ")", ")", "]", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n        returns a string representing a random ip address\n\n    :param not_valid: if passed must be a list of integers representing valid class A netoworks that must be ignored\n    \"\"\"\n    arg_1 = arg_0 or []\n\n    arg_2 = [r for r in range(1, 256) if r not in arg_1]\n    shuffle(arg_2)\n    arg_3 = arg_2.pop()\n\n    return \".\".join([str(arg_3), str(randrange(1, 256)),\n                     str(randrange(1, 256)), str(randrange(1, 256))])", "path": "sample_data_utils/net.py", "identifier": "ipaddress", "docstring": "returns a string representing a random ip address\n\n    :param not_valid: if passed must be a list of integers representing valid class A netoworks that must be ignored", "docstring_tokens": ["returns", "a", "string", "representing", "a", "random", "ip", "address"], "nwo": "saxix/sample-data-utils", "score": 0.12050106452410352, "idx": 258401}
{"url": "https://github.com/edx/edx-lint/blob/d87ccb51a48984806b6442a36992c5b45c3d4d58/edx_lint/pylint/common.py#L25-L31", "sha": "d87ccb51a48984806b6442a36992c5b45c3d4d58", "docstring_summary": "Make a reasonable class name for a class node.", "language": "python", "parameters": "(node)", "return_statement": "return name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "qname", "(", ")", "for", "arg_2", "in", "[", "\"__builtin__.\"", ",", "\"builtins.\"", ",", "\".\"", "]", ":", "if", "arg_1", ".", "startswith", "(", "arg_2", ")", ":", "arg_1", "=", "arg_1", "[", "len", "(", "arg_2", ")", ":", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Make a reasonable class name for a class node.\"\"\"\n    arg_1 = arg_0.qname()\n    for arg_2 in [\"__builtin__.\", \"builtins.\", \".\"]:\n        if arg_1.startswith(arg_2):\n            arg_1 = arg_1[len(arg_2):]\n    return arg_1", "path": "edx_lint/pylint/common.py", "identifier": "usable_class_name", "docstring": "Make a reasonable class name for a class node.", "docstring_tokens": ["Make", "a", "reasonable", "class", "name", "for", "a", "class", "node", "."], "nwo": "edx/edx-lint", "score": 0.3933713915493414, "idx": 258402}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/oauth1.py#L621-L635", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Email is available in separate method so second request is needed.", "language": "python", "parameters": "(self)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "super", "(", "Bitbucket", ",", "arg_0", ")", ".", "Func", "(", ")", "arg_1", ".", "data", ".", "setdefault", "(", "\"email\"", ",", "None", ")", "arg_2", "=", "arg_0", ".", "access", "(", "arg_0", ".", "user_email_url", ")", "if", "arg_2", ".", "data", ":", "for", "arg_3", "in", "arg_2", ".", "data", ":", "if", "arg_3", ".", "get", "(", "\"primary\"", ",", "False", ")", ":", "arg_1", ".", "data", ".", "update", "(", "email", "=", "arg_3", ".", "get", "(", "\"email\"", ",", "None", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Email is available in separate method so second request is needed.\n        \"\"\"\n        arg_1 = super(Bitbucket, arg_0).Func()\n\n        arg_1.data.setdefault(\"email\", None)\n\n        arg_2 = arg_0.access(arg_0.user_email_url)\n        if arg_2.data:\n            for arg_3 in arg_2.data:\n                if arg_3.get(\"primary\", False):\n                    arg_1.data.update(email=arg_3.get(\"email\", None))\n\n        return arg_1", "path": "authomatic/providers/oauth1.py", "identifier": "Bitbucket._access_user_info", "docstring": "Email is available in separate method so second request is needed.", "docstring_tokens": ["Email", "is", "available", "in", "separate", "method", "so", "second", "request", "is", "needed", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 258403}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/zkstatemanager.py#L426-L450", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "create execution state", "language": "python", "parameters": "(self, topologyName, executionState)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_2", "or", "not", "arg_2", ".", "IsInitialized", "(", ")", ":", "raise_", "(", "StateException", "(", "\"Execution State protobuf not init properly\"", ",", "StateException", ".", "EX_TYPE_PROTOBUF_ERROR", ")", ",", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ")", "arg_3", "=", "arg_0", ".", "get_execution_state_path", "(", "arg_1", ")", "LOG", ".", "info", "(", "\"Adding topology: {0} to path: {1}\"", ".", "format", "(", "arg_1", ",", "arg_3", ")", ")", "arg_4", "=", "arg_2", ".", "SerializeToString", "(", ")", "try", ":", "arg_0", ".", "client", ".", "create", "(", "arg_3", ",", "value", "=", "arg_4", ",", "makepath", "=", "True", ")", "return", "True", "except", "NoNodeError", ":", "raise_", "(", "StateException", "(", "\"NoNodeError while creating execution state\"", ",", "StateException", ".", "EX_TYPE_NO_NODE_ERROR", ")", ",", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ")", "except", "NodeExistsError", ":", "raise_", "(", "StateException", "(", "\"NodeExistsError while creating execution state\"", ",", "StateException", ".", "EX_TYPE_NODE_EXISTS_ERROR", ")", ",", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ")", "except", "ZookeeperError", ":", "raise_", "(", "StateException", "(", "\"Zookeeper while creating execution state\"", ",", "StateException", ".", "EX_TYPE_ZOOKEEPER_ERROR", ")", ",", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ")", "except", "Exception", ":", "raise"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" create execution state \"\"\"\n    if not arg_2 or not arg_2.IsInitialized():\n      raise_(StateException(\"Execution State protobuf not init properly\",\n                            StateException.EX_TYPE_PROTOBUF_ERROR), sys.exc_info()[2])\n\n    arg_3 = arg_0.get_execution_state_path(arg_1)\n    LOG.info(\"Adding topology: {0} to path: {1}\".format(\n        arg_1, arg_3))\n    arg_4 = arg_2.SerializeToString()\n    try:\n      arg_0.client.create(arg_3, value=arg_4, makepath=True)\n      return True\n    except NoNodeError:\n      raise_(StateException(\"NoNodeError while creating execution state\",\n                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])\n    except NodeExistsError:\n      raise_(StateException(\"NodeExistsError while creating execution state\",\n                            StateException.EX_TYPE_NODE_EXISTS_ERROR), sys.exc_info()[2])\n    except ZookeeperError:\n      raise_(StateException(\"Zookeeper while creating execution state\",\n                            StateException.EX_TYPE_ZOOKEEPER_ERROR), sys.exc_info()[2])\n    except Exception:\n      # Just re raise the exception.\n      raise", "path": "heron/statemgrs/src/python/zkstatemanager.py", "identifier": "ZkStateManager.create_execution_state", "docstring": "create execution state", "docstring_tokens": ["create", "execution", "state"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258404}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/slider.py#L422-L428", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Helper property containing the percentage this slider is \"filled\".\n        \n        This property is read-only.", "language": "python", "parameters": "(self)", "return_statement": "return (self.n-self.nmin)/max((self.nmax-self.nmin),1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "n", "-", "arg_0", ".", "nmin", ")", "/", "max", "(", "(", "arg_0", ".", "nmax", "-", "arg_0", ".", "nmin", ")", ",", "1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        HelFuncer FuncroFuncerty containing the Funcercentage this slider is \"filled\".\n        \n        This FuncroFuncerty is read-only.\n        \"\"\"\n        return (arg_0.n-arg_0.nmin)/max((arg_0.nmax-arg_0.nmin),1)", "path": "peng3d/gui/slider.py", "identifier": "Slider.p", "docstring": "Helper property containing the percentage this slider is \"filled\".\n        \n        This property is read-only.", "docstring_tokens": ["Helper", "property", "containing", "the", "percentage", "this", "slider", "is", "filled", ".", "This", "property", "is", "read", "-", "only", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 258405}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/list.py#L64-L74", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Create a card for this list. Returns a Card object.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return self.create_card(card_json)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", "+", "'/cards'", ",", "http_method", "=", "'POST'", ",", "arg_1", "=", "arg_1", "or", "{", "}", ")", "return", "arg_0", ".", "create_card", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''\n        Create a card for this list. Returns a Card object.\n        '''\n        arg_2 = arg_0.fetch_json(\n            uri_path=arg_0.base_uri + '/cards',\n            http_method='POST',\n            arg_1=arg_1 or {}\n        )\n\n        return arg_0.create_card(arg_2)", "path": "trolly/list.py", "identifier": "List.add_card", "docstring": "Create a card for this list. Returns a Card object.", "docstring_tokens": ["Create", "a", "card", "for", "this", "list", ".", "Returns", "a", "Card", "object", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 258406}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L130-L153", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "A rule that executes ``inner_rule`` and emits a diagnostic error if it returns None.", "language": "python", "parameters": "(inner_rule, loc=None)", "return_statement": "return rule", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "@", "llrule", "(", "arg_1", ",", "arg_0", ".", "expected", ")", "def", "rule", "(", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "arg_2", ")", "if", "arg_3", "is", "unmatched", ":", "arg_4", "=", "reduce", "(", "list", ".", "__add__", ",", "[", "rule", ".", "expected", "(", "arg_2", ")", "for", "rule", "in", "arg_2", ".", "_errrules", "]", ")", "arg_4", "=", "list", "(", "sorted", "(", "set", "(", "arg_4", ")", ")", ")", "if", "len", "(", "arg_4", ")", ">", "1", ":", "arg_4", "=", "\" or \"", ".", "join", "(", "[", "\", \"", ".", "join", "(", "arg_4", "[", "0", ":", "-", "1", "]", ")", ",", "arg_4", "[", "-", "1", "]", "]", ")", "elif", "len", "(", "arg_4", ")", "==", "1", ":", "arg_4", "=", "arg_4", "[", "0", "]", "else", ":", "arg_4", "=", "\"(impossible)\"", "arg_5", "=", "arg_2", ".", "_tokens", "[", "arg_2", ".", "_errindex", "]", "arg_6", "=", "diagnostic", ".", "Diagnostic", "(", "\"fatal\"", ",", "\"unexpected {actual}: expected {expected}\"", ",", "{", "\"actual\"", ":", "arg_5", ".", "kind", ",", "\"expected\"", ":", "arg_4", "}", ",", "arg_5", ".", "loc", ")", "arg_2", ".", "diagnostic_engine", ".", "process", "(", "arg_6", ")", "return", "arg_3", "return", "rule"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"A rule that executes ``inner_rule`` and emits a diagnostic error if it returns None.\"\"\"\n    @llrule(arg_1, arg_0.expected)\n    def rule(arg_2):\n        arg_3 = arg_0(arg_2)\n        if arg_3 is unmatched:\n            arg_4 = reduce(list.__add__, [rule.expected(arg_2) for rule in arg_2._errrules])\n            arg_4 = list(sorted(set(arg_4)))\n\n            if len(arg_4) > 1:\n                arg_4 = \" or \".join([\", \".join(arg_4[0:-1]), arg_4[-1]])\n            elif len(arg_4) == 1:\n                arg_4 = arg_4[0]\n            else:\n                arg_4 = \"(impossible)\"\n\n            arg_5 = arg_2._tokens[arg_2._errindex]\n            arg_6 = diagnostic.Diagnostic(\n                \"fatal\", \"unexpected {actual}: expected {expected}\",\n                {\"actual\": arg_5.kind, \"expected\": arg_4},\n                arg_5.loc)\n            arg_2.diagnostic_engine.process(arg_6)\n        return arg_3\n    return rule", "path": "third_party/pythonparser/parser.py", "identifier": "Expect", "docstring": "A rule that executes ``inner_rule`` and emits a diagnostic error if it returns None.", "docstring_tokens": ["A", "rule", "that", "executes", "inner_rule", "and", "emits", "a", "diagnostic", "error", "if", "it", "returns", "None", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258407}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/selector.py#L137-L157", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Is the function a test function?", "language": "python", "parameters": "(self, function)", "return_statement": "return wanted", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "if", "hasattr", "(", "arg_1", ",", "'compat_func_name'", ")", ":", "arg_2", "=", "arg_1", ".", "compat_func_name", "else", ":", "arg_2", "=", "arg_1", ".", "__name__", "except", "AttributeError", ":", "return", "False", "arg_3", "=", "getattr", "(", "arg_1", ",", "'__test__'", ",", "None", ")", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "arg_3", "else", ":", "arg_4", "=", "not", "arg_2", ".", "startswith", "(", "'_'", ")", "and", "arg_0", ".", "matches", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "plugins", ".", "Func", "(", "arg_1", ")", "if", "arg_5", "is", "not", "None", ":", "arg_4", "=", "arg_5", "log", ".", "debug", "(", "\"Func %s? %s\"", ",", "arg_1", ",", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Is the function a test function?\n        \"\"\"\n        try:\n            if hasattr(arg_1, 'compat_func_name'):\n                arg_2 = arg_1.compat_func_name\n            else:\n                arg_2 = arg_1.__name__\n        except AttributeError:\n            # not a function\n            return False\n        arg_3 = getattr(arg_1, '__test__', None)\n        if arg_3 is not None:\n            arg_4 = arg_3\n        else:\n            arg_4 = not arg_2.startswith('_') and arg_0.matches(arg_2)\n        arg_5 = arg_0.plugins.Func(arg_1)\n        if arg_5 is not None:\n            arg_4 = arg_5\n        log.debug(\"Func %s? %s\", arg_1, arg_4)\n        return arg_4", "path": "environment/lib/python2.7/site-packages/nose/selector.py", "identifier": "Selector.wantFunction", "docstring": "Is the function a test function?", "docstring_tokens": ["Is", "the", "function", "a", "test", "function?"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258408}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1360-L1374", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "filter for indels", "language": "python", "parameters": "(block)", "return_statement": "return inds", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", "in", "xrange", "(", "arg_0", ".", "shape", "[", "0", "]", ")", ":", "arg_3", "=", "np", ".", "where", "(", "arg_0", "[", "arg_2", "]", "!=", "45", ")", "[", "0", "]", "if", "len", "(", "arg_3", ")", "==", "0", ":", "arg_4", "=", "100", "else", ":", "arg_5", "=", "np", ".", "min", "(", "arg_3", ")", "arg_6", "=", "np", ".", "max", "(", "arg_3", ")", "arg_4", "=", "np", ".", "sum", "(", "arg_0", "[", "arg_2", ",", "arg_5", ":", "arg_6", "]", "==", "45", ")", "if", "arg_4", ">", "arg_1", ":", "arg_1", "=", "arg_4", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" filter for indels \"\"\"\n    ## remove terminal edges\n    arg_1 = 0\n    for arg_2 in xrange(arg_0.shape[0]):\n        arg_3 = np.where(arg_0[arg_2] != 45)[0]\n        if len(arg_3) == 0:\n            arg_4 = 100\n        else:\n            arg_5 = np.min(arg_3)\n            arg_6 = np.max(arg_3)\n            arg_4 = np.sum(arg_0[arg_2, arg_5:arg_6] == 45)\n        if arg_4 > arg_1:\n            arg_1 = arg_4\n    return arg_1", "path": "ipyrad/assemble/write_outfiles.py", "identifier": "maxind_numba", "docstring": "filter for indels", "docstring_tokens": ["filter", "for", "indels"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258409}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L144-L159", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Gets a dictionary filtered by whitelisted keys", "language": "python", "parameters": "(original_dict, whitelisted_keys)", "return_statement": "return filtered_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "items", "(", ")", ":", "if", "arg_3", "in", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Gets a dictionary filtered by whitelisted keys\n\n    :param original_dict: The original dictionary of arguments to source keys\n        and values.\n    :param whitelisted_key: A list of keys to include in the filtered\n        dictionary.\n\n    :returns: A dictionary containing key/values from the original dictionary\n        whose key was included in the whitelist\n    \"\"\"\n    arg_2 = {}\n    for arg_3, arg_4 in arg_0.items():\n        if arg_3 in arg_1:\n            arg_2[arg_3] = arg_4\n    return arg_2", "path": "s3transfer/utils.py", "identifier": "get_filtered_dict", "docstring": "Gets a dictionary filtered by whitelisted keys\n\n    :param original_dict: The original dictionary of arguments to source keys\n        and values.\n    :param whitelisted_key: A list of keys to include in the filtered\n        dictionary.\n\n    :returns: A dictionary containing key/values from the original dictionary\n        whose key was included in the whitelist", "docstring_tokens": ["Gets", "a", "dictionary", "filtered", "by", "whitelisted", "keys"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 258410}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/common/src/python/pex_loader.py#L99-L127", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Imports and load a class from a given pex file path and python class name", "language": "python", "parameters": "(path_to_pex, python_class_name)", "return_statement": "return getattr(mod, import_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", "Log", ".", "debug", "(", "\"Add a pex to the path: %s\"", "%", "arg_2", ")", "Log", ".", "debug", "(", "\"In Func with cls_name: %s\"", "%", "arg_1", ")", "arg_3", "=", "arg_1", ".", "split", "(", "'.'", ")", "arg_4", "=", "'.'", ".", "join", "(", "arg_3", "[", ":", "-", "1", "]", ")", "arg_5", "=", "arg_1", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "Log", ".", "debug", "(", "\"From path: %s, import name: %s\"", "%", "(", "arg_4", ",", "arg_5", ")", ")", "if", "arg_1", ".", "startswith", "(", "\"heron.\"", ")", ":", "try", ":", "arg_6", "=", "resolve_heron_suffix_issue", "(", "arg_2", ",", "arg_1", ")", "return", "getattr", "(", "arg_6", ",", "arg_5", ")", "except", ":", "Log", ".", "error", "(", "\"Could not resolve class %s with special handling\"", "%", "arg_1", ")", "arg_6", "=", "__import__", "(", "arg_4", ",", "fromlist", "=", "[", "arg_5", "]", ",", "level", "=", "-", "1", ")", "Log", ".", "debug", "(", "\"Imported module: %s\"", "%", "str", "(", "arg_6", ")", ")", "return", "getattr", "(", "arg_6", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Imports and load a class from a given pex file path and python class name\n\n  For example, if you want to get a class called `Sample` in\n  /some-path/sample.pex/heron/examples/src/python/sample.py,\n  ``path_to_pex`` needs to be ``/some-path/sample.pex``, and\n  ``python_class_name`` needs to be ``heron.examples.src.python.sample.Sample``\n  \"\"\"\n  arg_2 = os.path.abspath(arg_0)\n\n  Log.debug(\"Add a pex to the path: %s\" % arg_2)\n  Log.debug(\"In Func with cls_name: %s\" % arg_1)\n  arg_3 = arg_1.split('.')\n  arg_4 = '.'.join(arg_3[:-1])\n  arg_5 = arg_1.split('.')[-1]\n\n  Log.debug(\"From path: %s, import name: %s\" % (arg_4, arg_5))\n\n  # Resolve duplicate package suffix problem (heron.), if the top level package name is heron\n  if arg_1.startswith(\"heron.\"):\n    try:\n      arg_6 = resolve_heron_suffix_issue(arg_2, arg_1)\n      return getattr(arg_6, arg_5)\n    except:\n      Log.error(\"Could not resolve class %s with special handling\" % arg_1)\n\n  arg_6 = __import__(arg_4, fromlist=[arg_5], level=-1)\n  Log.debug(\"Imported module: %s\" % str(arg_6))\n  return getattr(arg_6, arg_5)", "path": "heron/common/src/python/pex_loader.py", "identifier": "import_and_get_class", "docstring": "Imports and load a class from a given pex file path and python class name\n\n  For example, if you want to get a class called `Sample` in\n  /some-path/sample.pex/heron/examples/src/python/sample.py,\n  ``path_to_pex`` needs to be ``/some-path/sample.pex``, and\n  ``python_class_name`` needs to be ``heron.examples.src.python.sample.Sample``", "docstring_tokens": ["Imports", "and", "load", "a", "class", "from", "a", "given", "pex", "file", "path", "and", "python", "class", "name"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258411}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L64-L141", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Start new H2O server on the local machine.", "language": "python", "parameters": "(jar_path=None, nthreads=-1, enable_assertions=True, max_mem_size=None, min_mem_size=None,\n              ice_root=None, log_dir=None, log_level=None, port=\"54321+\", name=None, extra_classpath=None,\n              verbose=True, jvm_custom_args=None, bind_to_localhost=True)", "return_statement": "return hs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "-", "1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "\"54321+\"", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "True", ",", "arg_12", "=", "None", ",", "arg_13", "=", "True", ")", ":", "assert_is_type", "(", "arg_0", ",", "None", ",", "str", ")", "assert_is_type", "(", "arg_8", ",", "None", ",", "int", ",", "str", ")", "assert_is_type", "(", "arg_9", ",", "None", ",", "str", ")", "assert_is_type", "(", "arg_1", ",", "-", "1", ",", "BoundInt", "(", "1", ",", "4096", ")", ")", "assert_is_type", "(", "arg_2", ",", "bool", ")", "assert_is_type", "(", "arg_4", ",", "None", ",", "int", ")", "assert_is_type", "(", "arg_3", ",", "None", ",", "BoundInt", "(", "1", "<<", "25", ")", ")", "assert_is_type", "(", "arg_6", ",", "str", ",", "None", ")", "assert_is_type", "(", "arg_7", ",", "str", ",", "None", ")", "assert_satisfies", "(", "arg_7", ",", "arg_7", "in", "[", "None", ",", "\"TRACE\"", ",", "\"DEBUG\"", ",", "\"INFO\"", ",", "\"WARN\"", ",", "\"ERRR\"", ",", "\"FATA\"", "]", ")", "assert_is_type", "(", "arg_5", ",", "None", ",", "I", "(", "str", ",", "os", ".", "path", ".", "isdir", ")", ")", "assert_is_type", "(", "arg_10", ",", "None", ",", "[", "str", "]", ")", "assert_is_type", "(", "arg_12", ",", "list", ",", "None", ")", "assert_is_type", "(", "arg_13", ",", "bool", ")", "if", "arg_0", ":", "assert_satisfies", "(", "arg_0", ",", "arg_0", ".", "endswith", "(", "\"h2o.jar\"", ")", ")", "if", "arg_4", "is", "not", "None", "and", "arg_3", "is", "not", "None", "and", "arg_4", ">", "arg_3", ":", "raise", "H2OValueError", "(", "\"`min_mem_size`=%d is larger than the `max_mem_size`=%d\"", "%", "(", "arg_4", ",", "arg_3", ")", ")", "if", "arg_8", "is", "None", ":", "arg_8", "=", "\"54321+\"", "arg_14", "=", "None", "if", "is_type", "(", "arg_8", ",", "str", ")", ":", "if", "arg_8", ".", "isdigit", "(", ")", ":", "arg_8", "=", "int", "(", "arg_8", ")", "else", ":", "if", "not", "(", "arg_8", "[", "-", "1", "]", "==", "\"+\"", "and", "arg_8", "[", ":", "-", "1", "]", ".", "isdigit", "(", ")", ")", ":", "raise", "H2OValueError", "(", "\"`port` should be of the form 'DDDD+', where D is a digit. Got: %s\"", "%", "arg_8", ")", "arg_14", "=", "int", "(", "arg_8", "[", ":", "-", "1", "]", ")", "arg_8", "=", "0", "arg_15", "=", "H2OLocalServer", "(", ")", "arg_15", ".", "_verbose", "=", "bool", "(", "arg_11", ")", "arg_15", ".", "_jar_path", "=", "arg_15", ".", "_find_jar", "(", "arg_0", ")", "arg_15", ".", "_extra_classpath", "=", "arg_10", "arg_15", ".", "_ice_root", "=", "arg_5", "arg_15", ".", "_name", "=", "arg_9", "if", "not", "arg_5", ":", "arg_15", ".", "_ice_root", "=", "tempfile", ".", "mkdtemp", "(", ")", "arg_15", ".", "_tempdir", "=", "arg_15", ".", "_ice_root", "if", "arg_11", ":", "print", "(", "\"Attempting to Func a local H2O server...\"", ")", "arg_15", ".", "_launch_server", "(", "arg_8", "=", "arg_8", ",", "arg_14", "=", "arg_14", ",", "arg_1", "=", "int", "(", "arg_1", ")", ",", "ea", "=", "arg_2", ",", "mmax", "=", "arg_3", ",", "mmin", "=", "arg_4", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "if", "arg_11", ":", "print", "(", "\"  Server is running at %s://%s:%d\"", "%", "(", "arg_15", ".", "scheme", ",", "arg_15", ".", "ip", ",", "arg_15", ".", "port", ")", ")", "atexit", ".", "register", "(", "lambda", ":", "arg_15", ".", "shutdown", "(", ")", ")", "return", "arg_15"], "function": "def Func(arg_0=None, arg_1=-1, arg_2=True, arg_3=None, arg_4=None,\n              arg_5=None, arg_6=None, arg_7=None, arg_8=\"54321+\", arg_9=None, arg_10=None,\n              arg_11=True, arg_12=None, arg_13=True):\n        \"\"\"\n        Start new H2O server on the local machine.\n\n        :param jar_path: Path to the h2o.jar executable. If not given, then we will search for h2o.jar in the\n            locations returned by `._jar_paths()`.\n        :param nthreads: Number of threads in the thread pool. This should be related to the number of CPUs used.\n            -1 means use all CPUs on the host. A positive integer specifies the number of CPUs directly.\n        :param enable_assertions: If True, pass `-ea` option to the JVM.\n        :param max_mem_size: Maximum heap size (jvm option Xmx), in bytes.\n        :param min_mem_size: Minimum heap size (jvm option Xms), in bytes.\n        :param log_dir: Directory for H2O logs to be stored if a new instance is Funced. Default directory is determined\n        by H2O internally.\n        :param log_level: The logger level for H2O if a new instance is Funced.\n        :param ice_root: A directory where H2O stores its temporary files. Default location is determined by\n            tempfile.mkdtemp().\n        :param port: Port where to Func the new server. This could be either an integer, or a string of the form\n            \"DDDDD+\", indicating that the server should Func looking for an open port Funcing from DDDDD and up.\n        :param name: name of the h2o cluster to be Funced\n        :param extra_classpath List of paths to libraries that should be included on the Java classpath.\n        :param verbose: If True, then connection info will be printed to the stdout.\n        :param jvm_custom_args Custom, user-defined arguments for the JVM H2O is instantiated in\n        :param bind_to_localhost A flag indicating whether access to the H2O instance should be restricted to the local\n            machine (default) or if it can be reached from other computers on the network.\n            Only applicable when H2O is Funced from the Python client.\n\n        :returns: a new H2OLocalServer instance\n        \"\"\"\n        assert_is_type(arg_0, None, str)\n        assert_is_type(arg_8, None, int, str)\n        assert_is_type(arg_9, None, str)\n        assert_is_type(arg_1, -1, BoundInt(1, 4096))\n        assert_is_type(arg_2, bool)\n        assert_is_type(arg_4, None, int)\n        assert_is_type(arg_3, None, BoundInt(1 << 25))\n        assert_is_type(arg_6, str, None)\n        assert_is_type(arg_7, str, None)\n        assert_satisfies(arg_7, arg_7 in [None, \"TRACE\", \"DEBUG\", \"INFO\", \"WARN\", \"ERRR\", \"FATA\"])\n        assert_is_type(arg_5, None, I(str, os.path.isdir))\n        assert_is_type(arg_10, None, [str])\n        assert_is_type(arg_12, list, None)\n        assert_is_type(arg_13, bool)\n        if arg_0:\n            assert_satisfies(arg_0, arg_0.endswith(\"h2o.jar\"))\n\n        if arg_4 is not None and arg_3 is not None and arg_4 > arg_3:\n            raise H2OValueError(\"`min_mem_size`=%d is larger than the `max_mem_size`=%d\" % (arg_4, arg_3))\n        if arg_8 is None: arg_8 = \"54321+\"\n        arg_14 = None\n        # TODO: get rid of this port gimmick and have 2 separate parameters.\n        if is_type(arg_8, str):\n            if arg_8.isdigit():\n                arg_8 = int(arg_8)\n            else:\n                if not(arg_8[-1] == \"+\" and arg_8[:-1].isdigit()):\n                    raise H2OValueError(\"`port` should be of the form 'DDDD+', where D is a digit. Got: %s\" % arg_8)\n                arg_14 = int(arg_8[:-1])\n                arg_8 = 0\n\n        arg_15 = H2OLocalServer()\n        arg_15._verbose = bool(arg_11)\n        arg_15._jar_path = arg_15._find_jar(arg_0)\n        arg_15._extra_classpath = arg_10\n        arg_15._ice_root = arg_5\n        arg_15._name = arg_9\n        if not arg_5:\n            arg_15._ice_root = tempfile.mkdtemp()\n            arg_15._tempdir = arg_15._ice_root\n\n        if arg_11: print(\"Attempting to Func a local H2O server...\")\n        arg_15._launch_server(arg_8=arg_8, arg_14=arg_14, arg_1=int(arg_1), ea=arg_2,\n                          mmax=arg_3, mmin=arg_4, arg_12=arg_12,\n                          arg_13=arg_13, arg_6=arg_6, arg_7=arg_7)\n        if arg_11: print(\"  Server is running at %s://%s:%d\" % (arg_15.scheme, arg_15.ip, arg_15.port))\n        atexit.register(lambda: arg_15.shutdown())\n        return arg_15", "path": "h2o-py/h2o/backend/server.py", "identifier": "H2OLocalServer.start", "docstring": "Start new H2O server on the local machine.\n\n        :param jar_path: Path to the h2o.jar executable. If not given, then we will search for h2o.jar in the\n            locations returned by `._jar_paths()`.\n        :param nthreads: Number of threads in the thread pool. This should be related to the number of CPUs used.\n            -1 means use all CPUs on the host. A positive integer specifies the number of CPUs directly.\n        :param enable_assertions: If True, pass `-ea` option to the JVM.\n        :param max_mem_size: Maximum heap size (jvm option Xmx), in bytes.\n        :param min_mem_size: Minimum heap size (jvm option Xms), in bytes.\n        :param log_dir: Directory for H2O logs to be stored if a new instance is started. Default directory is determined\n        by H2O internally.\n        :param log_level: The logger level for H2O if a new instance is started.\n        :param ice_root: A directory where H2O stores its temporary files. Default location is determined by\n            tempfile.mkdtemp().\n        :param port: Port where to start the new server. This could be either an integer, or a string of the form\n            \"DDDDD+\", indicating that the server should start looking for an open port starting from DDDDD and up.\n        :param name: name of the h2o cluster to be started\n        :param extra_classpath List of paths to libraries that should be included on the Java classpath.\n        :param verbose: If True, then connection info will be printed to the stdout.\n        :param jvm_custom_args Custom, user-defined arguments for the JVM H2O is instantiated in\n        :param bind_to_localhost A flag indicating whether access to the H2O instance should be restricted to the local\n            machine (default) or if it can be reached from other computers on the network.\n            Only applicable when H2O is started from the Python client.\n\n        :returns: a new H2OLocalServer instance", "docstring_tokens": ["Start", "new", "H2O", "server", "on", "the", "local", "machine", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258412}
{"url": "https://github.com/sergedomk/fiql_parser/blob/499dd7cd0741603530ce5f3803d92813e74ac9c3/fiql_parser/expression.py#L58-L70", "sha": "499dd7cd0741603530ce5f3803d92813e74ac9c3", "docstring_summary": "Get the parent ``Expression`` for this object.", "language": "python", "parameters": "(self)", "return_statement": "return self.parent", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ".", "parent", ",", "Expression", ")", ":", "raise", "FiqlObjectException", "(", "\"Parent must be of %s not %s\"", "%", "(", "Expression", ",", "type", "(", "arg_0", ".", "parent", ")", ")", ")", "return", "arg_0", ".", "parent"], "function": "def Func(arg_0):\n        \"\"\"Get the parent ``Expression`` for this object.\n\n        Returns:\n            Expression: The ``Expression`` which contains this object.\n\n        Raises:\n            FiqlObjectException: Parent is ``None``.\n        \"\"\"\n        if not isinstance(arg_0.parent, Expression):\n            raise FiqlObjectException(\"Parent must be of %s not %s\" % (\n                Expression, type(arg_0.parent)))\n        return arg_0.parent", "path": "fiql_parser/expression.py", "identifier": "BaseExpression.get_parent", "docstring": "Get the parent ``Expression`` for this object.\n\n        Returns:\n            Expression: The ``Expression`` which contains this object.\n\n        Raises:\n            FiqlObjectException: Parent is ``None``.", "docstring_tokens": ["Get", "the", "parent", "Expression", "for", "this", "object", "."], "nwo": "sergedomk/fiql_parser", "score": 0.35580137387943567, "idx": 258413}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/gcp/gcpcache.py#L46-L64", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Insert item into cache.", "language": "python", "parameters": "(self, key, obj, future_expiration_minutes=15)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "15", ")", ":", "arg_4", "=", "arg_0", ".", "_calculate_expiration", "(", "arg_3", ")", "arg_0", ".", "_CACHE", "[", "arg_1", "]", "=", "(", "arg_4", ",", "arg_2", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=15):\n        \"\"\"\n        Insert item into cache.\n\n        :param key: key to look up in cache.\n        :type key: ``object``\n\n        :param obj: item to store in cache.\n        :type obj: varies\n\n        :param future_expiration_minutes: number of minutes item is valid\n        :type param: ``int``\n\n        :returns: True\n        :rtype: ``bool``\n        \"\"\"\n        arg_4 = arg_0._calculate_expiration(arg_3)\n        arg_0._CACHE[arg_1] = (arg_4, arg_2)\n        return True", "path": "cloudaux/gcp/gcpcache.py", "identifier": "GCPCache.insert", "docstring": "Insert item into cache.\n\n        :param key: key to look up in cache.\n        :type key: ``object``\n\n        :param obj: item to store in cache.\n        :type obj: varies\n\n        :param future_expiration_minutes: number of minutes item is valid\n        :type param: ``int``\n\n        :returns: True\n        :rtype: ``bool``", "docstring_tokens": ["Insert", "item", "into", "cache", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 258414}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/csv.py#L28-L42", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Load and parse a .csv file", "language": "python", "parameters": "(self, file_path, currency)", "return_statement": "return prices", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "->", "List", "[", "PriceModel", "]", ":", "arg_3", "=", "arg_0", ".", "load_file", "(", "arg_1", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "arg_6", "=", "arg_0", ".", "parse_line", "(", "arg_5", ")", "assert", "isinstance", "(", "arg_6", ",", "PriceModel", ")", "arg_6", ".", "currency", "=", "arg_2", "arg_4", ".", "append", "(", "arg_6", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2) -> List[PriceModel]:\n        \"\"\" Load and parse a .csv file \"\"\"\n        # load file\n                # read csv into memory?\n        arg_3 = arg_0.load_file(arg_1)\n        arg_4 = []\n\n        # parse price elements\n        for arg_5 in arg_3:\n            arg_6 = arg_0.parse_line(arg_5)\n            assert isinstance(arg_6, PriceModel)\n            arg_6.currency = arg_2\n            arg_4.append(arg_6)\n\n        return arg_4", "path": "pricedb/csv.py", "identifier": "CsvParser.parse_file", "docstring": "Load and parse a .csv file", "docstring_tokens": ["Load", "and", "parse", "a", ".", "csv", "file"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 258415}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/helpers.py#L53-L67", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Returns whether the given query options expect a possible count of zero.", "language": "python", "parameters": "(options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "any", "(", "arg_0", ".", "get", "(", "arg_1", ")", "is", "not", "None", "for", "arg_1", "in", "[", "\"count\"", ",", "\"maximum\"", ",", "\"minimum\"", ",", "\"between\"", "]", ")", ":", "return", "matches_count", "(", "0", ",", "arg_0", ")", "else", ":", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns whether the given query options expect a possible count of zero.\n\n    Args:\n        options (Dict[str, int | Iterable[int]]): A dictionary of query options.\n\n    Returns:\n        bool: Whether a possible count of zero is expected.\n    \"\"\"\n\n    if any(arg_0.get(arg_1) is not None for arg_1 in [\"count\", \"maximum\", \"minimum\", \"between\"]):\n        return matches_count(0, arg_0)\n    else:\n        return False", "path": "capybara/helpers.py", "identifier": "expects_none", "docstring": "Returns whether the given query options expect a possible count of zero.\n\n    Args:\n        options (Dict[str, int | Iterable[int]]): A dictionary of query options.\n\n    Returns:\n        bool: Whether a possible count of zero is expected.", "docstring_tokens": ["Returns", "whether", "the", "given", "query", "options", "expect", "a", "possible", "count", "of", "zero", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 258416}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1448-L1497", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Decimal adjusts AL after subtraction.", "language": "python", "parameters": "(cpu)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "AL", "arg_2", "=", "arg_0", ".", "CF", "arg_0", ".", "AF", "=", "Operators", ".", "OR", "(", "(", "arg_0", ".", "AL", "&", "0x0f", ")", ">", "9", ",", "arg_0", ".", "AF", ")", "arg_0", ".", "AL", "=", "Operators", ".", "ITEBV", "(", "8", ",", "arg_0", ".", "AF", ",", "arg_0", ".", "AL", "-", "6", ",", "arg_0", ".", "AL", ")", "arg_0", ".", "CF", "=", "Operators", ".", "ITE", "(", "arg_0", ".", "AF", ",", "Operators", ".", "OR", "(", "arg_2", ",", "arg_0", ".", "AL", ">", "arg_1", ")", ",", "arg_0", ".", "CF", ")", "arg_0", ".", "CF", "=", "Operators", ".", "ITE", "(", "Operators", ".", "OR", "(", "arg_1", ">", "0x99", ",", "arg_2", ")", ",", "True", ",", "arg_0", ".", "CF", ")", "arg_0", ".", "AL", "=", "Operators", ".", "ITEBV", "(", "8", ",", "Operators", ".", "OR", "(", "arg_1", ">", "0x99", ",", "arg_2", ")", ",", "arg_0", ".", "AL", "-", "0x60", ",", "arg_0", ".", "AL", ")", "\"\"\"        if (cpu.AL & 0x0f) > 9 or cpu.AF:            cpu.AL = cpu.AL - 6;            cpu.CF = Operators.OR(oldCF, cpu.AL > oldAL)            cpu.AF = True        else:            cpu.AF  =  False        if ((oldAL > 0x99) or oldCF):            cpu.AL = cpu.AL - 0x60            cpu.CF = True        \"\"\"", "arg_0", ".", "ZF", "=", "arg_0", ".", "AL", "==", "0", "arg_0", ".", "SF", "=", "(", "arg_0", ".", "AL", "&", "0x80", ")", "!=", "0", "arg_0", ".", "PF", "=", "arg_0", ".", "_calculate_parity_flag", "(", "arg_0", ".", "AL", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Decimal adjusts AL after subtraction.\n\n        Adjusts the result of the subtraction of two packed BCD values to create a packed BCD result.\n        The AL register is the implied source and destination operand. If a decimal borrow is detected,\n        the CF and AF flags are set accordingly. This instruction is not valid in 64-bit mode.\n\n        The SF, ZF, and PF flags are set according to the result.::\n\n                IF (AL AND 0FH) > 9 OR AF  =  1\n                THEN\n                    AL  =  AL - 6;\n                    CF  =  CF OR BorrowFromLastSubtraction; (* CF OR borrow from AL  =  AL - 6 *)\n                    AF  =  1;\n                ELSE\n                    AF  =  0;\n                FI;\n                IF ((AL > 99H) or OLD_CF  =  1)\n                THEN\n                    AL  =  AL - 60H;\n                    CF  =  1;\n\n        :param cpu: current CPU.\n        \"\"\"\n        arg_1 = arg_0.AL\n        arg_2 = arg_0.CF\n\n        arg_0.AF = Operators.OR((arg_0.AL & 0x0f) > 9, arg_0.AF)\n        arg_0.AL = Operators.ITEBV(8, arg_0.AF, arg_0.AL - 6, arg_0.AL)\n        arg_0.CF = Operators.ITE(arg_0.AF, Operators.OR(arg_2, arg_0.AL > arg_1), arg_0.CF)\n\n        arg_0.CF = Operators.ITE(Operators.OR(arg_1 > 0x99, arg_2), True, arg_0.CF)\n        arg_0.AL = Operators.ITEBV(8, Operators.OR(arg_1 > 0x99, arg_2), arg_0.AL - 0x60, arg_0.AL)\n        #\n        \"\"\"\n        if (cpu.AL & 0x0f) > 9 or cpu.AF:\n            cpu.AL = cpu.AL - 6;\n            cpu.CF = Operators.OR(oldCF, cpu.AL > oldAL)\n            cpu.AF = True\n        else:\n            cpu.AF  =  False\n\n        if ((oldAL > 0x99) or oldCF):\n            cpu.AL = cpu.AL - 0x60\n            cpu.CF = True\n        \"\"\"\n        arg_0.ZF = arg_0.AL == 0\n        arg_0.SF = (arg_0.AL & 0x80) != 0\n        arg_0.PF = arg_0._calculate_parity_flag(arg_0.AL)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.DAS", "docstring": "Decimal adjusts AL after subtraction.\n\n        Adjusts the result of the subtraction of two packed BCD values to create a packed BCD result.\n        The AL register is the implied source and destination operand. If a decimal borrow is detected,\n        the CF and AF flags are set accordingly. This instruction is not valid in 64-bit mode.\n\n        The SF, ZF, and PF flags are set according to the result.::\n\n                IF (AL AND 0FH) > 9 OR AF  =  1\n                THEN\n                    AL  =  AL - 6;\n                    CF  =  CF OR BorrowFromLastSubtraction; (* CF OR borrow from AL  =  AL - 6 *)\n                    AF  =  1;\n                ELSE\n                    AF  =  0;\n                FI;\n                IF ((AL > 99H) or OLD_CF  =  1)\n                THEN\n                    AL  =  AL - 60H;\n                    CF  =  1;\n\n        :param cpu: current CPU.", "docstring_tokens": ["Decimal", "adjusts", "AL", "after", "subtraction", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258417}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L465-L503", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Pad dimensions of event tensors for mixture distributions.", "language": "python", "parameters": "(x, mixture_distribution, categorical_distribution,\n                           event_ndims)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "with", "tf", ".", "name_scope", "(", "\"pad_mix_dims\"", ")", ":", "def", "_get_ndims", "(", "arg_4", ")", ":", "if", "tensorshape_util", ".", "rank", "(", "arg_4", ".", "batch_shape", ")", "is", "not", "None", ":", "return", "tensorshape_util", ".", "rank", "(", "arg_4", ".", "batch_shape", ")", "return", "tf", ".", "shape", "(", "input", "=", "arg_4", ".", "batch_shape_tensor", "(", ")", ")", "[", "0", "]", "arg_5", "=", "_get_ndims", "(", "arg_1", ")", "arg_6", "=", "_get_ndims", "(", "arg_2", ")", "arg_7", "=", "tf", ".", "where", "(", "arg_2", ".", "is_scalar_batch", "(", ")", ",", "arg_5", ",", "arg_5", "-", "arg_6", ")", "arg_8", "=", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "arg_0", "=", "tf", ".", "reshape", "(", "arg_0", ",", "shape", "=", "tf", ".", "concat", "(", "[", "arg_8", "[", ":", "-", "1", "]", ",", "tf", ".", "ones", "(", "[", "arg_7", "]", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "arg_8", "[", "-", "1", ":", "]", ",", "tf", ".", "ones", "(", "[", "arg_3", "]", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "]", ",", "axis", "=", "0", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2,\n                           arg_3):\n  \"\"\"Pad dimensions of event tensors for mixture distributions.\n\n  See `Mixture._sample_n` and `MixtureSameFamily._sample_n` for usage examples.\n\n  Args:\n    x: event tensor to pad.\n    mixture_distribution: Base distribution of the mixture.\n    categorical_distribution: `Categorical` distribution that mixes the base\n      distribution.\n    event_ndims: Integer specifying the number of event dimensions in the event\n      tensor.\n\n  Returns:\n    A padded version of `x` that can broadcast with `categorical_distribution`.\n  \"\"\"\n  with tf.name_scope(\"pad_mix_dims\"):\n\n    def _get_ndims(arg_4):\n      if tensorshape_util.rank(arg_4.batch_shape) is not None:\n        return tensorshape_util.rank(arg_4.batch_shape)\n      return tf.shape(input=arg_4.batch_shape_tensor())[0]\n\n    arg_5 = _get_ndims(arg_1)\n    arg_6 = _get_ndims(arg_2)\n    arg_7 = tf.where(arg_2.is_scalar_batch(),\n                         arg_5, arg_5 - arg_6)\n    arg_8 = tf.shape(input=arg_0)\n    arg_0 = tf.reshape(\n        arg_0,\n        shape=tf.concat([\n            arg_8[:-1],\n            tf.ones([arg_7], dtype=tf.int32),\n            arg_8[-1:],\n            tf.ones([arg_3], dtype=tf.int32),\n        ],\n                        axis=0))\n    return arg_0", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "pad_mixture_dimensions", "docstring": "Pad dimensions of event tensors for mixture distributions.\n\n  See `Mixture._sample_n` and `MixtureSameFamily._sample_n` for usage examples.\n\n  Args:\n    x: event tensor to pad.\n    mixture_distribution: Base distribution of the mixture.\n    categorical_distribution: `Categorical` distribution that mixes the base\n      distribution.\n    event_ndims: Integer specifying the number of event dimensions in the event\n      tensor.\n\n  Returns:\n    A padded version of `x` that can broadcast with `categorical_distribution`.", "docstring_tokens": ["Pad", "dimensions", "of", "event", "tensors", "for", "mixture", "distributions", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258418}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L246-L261", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return hidden layer details.", "language": "python", "parameters": "(self, test_data, layer)", "return_statement": "return h2o.get_frame(j.dest_key)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "None", ":", "raise", "ValueError", "(", "\"Must specify test data\"", ")", "if", "str", "(", "arg_2", ")", ".", "isdigit", "(", ")", ":", "arg_3", "=", "H2OJob", "(", "h2o", ".", "api", "(", "\"POST /4/Predictions/models/%s/frames/%s\"", "%", "(", "arg_0", ".", "_id", ",", "arg_1", ".", "frame_id", ")", ",", "data", "=", "{", "\"deep_features_hidden_layer\"", ":", "arg_2", "}", ")", ",", "\"Func\"", ")", "else", ":", "arg_3", "=", "H2OJob", "(", "h2o", ".", "api", "(", "\"POST /4/Predictions/models/%s/frames/%s\"", "%", "(", "arg_0", ".", "_id", ",", "arg_1", ".", "frame_id", ")", ",", "data", "=", "{", "\"deep_features_hidden_layer_name\"", ":", "arg_2", "}", ")", ",", "\"Func\"", ")", "arg_3", ".", "poll", "(", ")", "return", "h2o", ".", "get_frame", "(", "arg_3", ".", "dest_key", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Return hidden layer details.\n\n        :param test_data: Data to create a feature space on\n        :param layer: 0 index hidden layer\n        \"\"\"\n        if arg_1 is None: raise ValueError(\"Must specify test data\")\n        if str(arg_2).isdigit():\n            arg_3 = H2OJob(h2o.api(\"POST /4/Predictions/models/%s/frames/%s\" % (arg_0._id, arg_1.frame_id),\n                               data={\"deep_features_hidden_layer\": arg_2}), \"Func\")\n        else:\n            arg_3 = H2OJob(h2o.api(\"POST /4/Predictions/models/%s/frames/%s\" % (arg_0._id, arg_1.frame_id),\n                               data={\"deep_features_hidden_layer_name\": arg_2}), \"Func\")\n        arg_3.poll()\n        return h2o.get_frame(arg_3.dest_key)", "path": "h2o-py/h2o/model/model_base.py", "identifier": "ModelBase.deepfeatures", "docstring": "Return hidden layer details.\n\n        :param test_data: Data to create a feature space on\n        :param layer: 0 index hidden layer", "docstring_tokens": ["Return", "hidden", "layer", "details", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258419}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/vcard.py#L1459-L1491", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Initialize a VCard object from an RFC2426 string.", "language": "python", "parameters": "(self,data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "from_utf8", "(", "arg_1", ")", "arg_2", "=", "arg_1", ".", "split", "(", "\"\\n\"", ")", "arg_3", "=", "0", "arg_4", "=", "None", "for", "arg_5", "in", "arg_2", ":", "if", "not", "arg_5", ":", "continue", "if", "arg_5", "[", "-", "1", "]", "==", "\"\\r\"", ":", "arg_5", "=", "arg_5", "[", ":", "-", "1", "]", "if", "not", "arg_5", ":", "continue", "if", "arg_5", "[", "0", "]", "in", "\" \\t\"", ":", "if", "arg_4", "is", "None", ":", "continue", "arg_4", "+=", "arg_5", "[", "1", ":", "]", "continue", "if", "not", "arg_3", "and", "arg_4", "and", "arg_4", ".", "upper", "(", ")", ".", "strip", "(", ")", "==", "\"BEGIN:VCARD\"", ":", "arg_3", "=", "1", "elif", "arg_3", "and", "arg_4", ".", "upper", "(", ")", ".", "strip", "(", ")", "==", "\"END:VCARD\"", ":", "arg_4", "=", "None", "break", "elif", "arg_4", "and", "arg_3", ":", "arg_0", ".", "_process_rfc2425_record", "(", "arg_4", ")", "arg_4", "=", "arg_5", "if", "arg_3", "and", "arg_4", ":", "arg_0", ".", "_process_rfc2425_record", "(", "arg_4", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Initialize a VCard object from an RFC2426 string.\n\n        :Parameters:\n            - `data`: vcard to parse.\n        :Types:\n            - `data`: `libxml2.xmlNode`, `unicode` or `str`\"\"\"\n        arg_1=from_utf8(arg_1)\n        arg_2=arg_1.split(\"\\n\")\n        arg_3=0\n        arg_4=None\n        for arg_5 in arg_2:\n            if not arg_5:\n                continue\n            if arg_5[-1]==\"\\r\":\n                arg_5=arg_5[:-1]\n            if not arg_5:\n                continue\n            if arg_5[0] in \" \\t\":\n                if arg_4 is None:\n                    continue\n                arg_4+=arg_5[1:]\n                continue\n            if not arg_3 and arg_4 and arg_4.upper().strip()==\"BEGIN:VCARD\":\n                arg_3=1\n            elif arg_3 and arg_4.upper().strip()==\"END:VCARD\":\n                arg_4=None\n                break\n            elif arg_4 and arg_3:\n                arg_0._process_rfc2425_record(arg_4)\n            arg_4=arg_5\n        if arg_3 and arg_4:\n            arg_0._process_rfc2425_record(arg_4)", "path": "pyxmpp2/ext/vcard.py", "identifier": "VCard.__from_rfc2426", "docstring": "Initialize a VCard object from an RFC2426 string.\n\n        :Parameters:\n            - `data`: vcard to parse.\n        :Types:\n            - `data`: `libxml2.xmlNode`, `unicode` or `str`", "docstring_tokens": ["Initialize", "a", "VCard", "object", "from", "an", "RFC2426", "string", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258420}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/client/application.py#L328-L339", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Creates a hashable object for given token then we could use it as a\n    dictionary key.", "language": "python", "parameters": "(application, token)", "return_statement": "return (application.__class__.__name__, application.name, hashed_token)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_2", "=", "tuple", "(", "sorted", "(", "arg_1", ".", "items", "(", ")", ")", ")", "elif", "isinstance", "(", "arg_1", ",", "tuple", ")", ":", "arg_2", "=", "arg_1", "else", ":", "raise", "TypeError", "(", "'%r is unknown type of token'", "%", "arg_1", ")", "return", "(", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_0", ".", "name", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Creates a hashable object for given token then we could use it as a\n    dictionary key.\n    \"\"\"\n    if isinstance(arg_1, dict):\n        arg_2 = tuple(sorted(arg_1.items()))\n    elif isinstance(arg_1, tuple):\n        arg_2 = arg_1\n    else:\n        raise TypeError('%r is unknown type of token' % arg_1)\n\n    return (arg_0.__class__.__name__, arg_0.name, arg_2)", "path": "flask_oauthlib/contrib/client/application.py", "identifier": "_hash_token", "docstring": "Creates a hashable object for given token then we could use it as a\n    dictionary key.", "docstring_tokens": ["Creates", "a", "hashable", "object", "for", "given", "token", "then", "we", "could", "use", "it", "as", "a", "dictionary", "key", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 258421}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/sbml.py#L105-L108", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Clips gene prefix from id.", "language": "python", "parameters": "(sid, prefix=\"G_\")", "return_statement": "return _clip(sid, prefix)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"G_\"", ")", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "SBML_DOT", ",", "\".\"", ")", "return", "_clip", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=\"G_\"):\n    \"\"\"Clips gene prefix from id.\"\"\"\n    arg_0 = arg_0.replace(SBML_DOT, \".\")\n    return _clip(arg_0, arg_1)", "path": "cobra/io/sbml.py", "identifier": "_f_gene", "docstring": "Clips gene prefix from id.", "docstring_tokens": ["Clips", "gene", "prefix", "from", "id", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 258422}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/definition_utils/summary_independent.py#L22-L51", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Loads many namespaces and combines their names.", "language": "python", "parameters": "(locations, check_keywords=True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "{", "location", ":", "get_bel_resource", "(", "location", ")", "for", "location", "in", "arg_0", "}", "if", "arg_1", ":", "arg_3", "=", "set", "(", "config", "[", "'Namespace'", "]", "[", "'Keyword'", "]", "for", "config", "in", "arg_2", ".", "values", "(", ")", ")", "if", "1", "!=", "len", "(", "arg_3", ")", ":", "raise", "ValueError", "(", "'Tried merging namespaces with different keywords: {}'", ".", "format", "(", "arg_3", ")", ")", "arg_4", "=", "{", "}", "for", "arg_5", "in", "arg_2", ":", "arg_4", ".", "update", "(", "arg_5", "[", "'Values'", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Loads many namespaces and combines their names.\n\n    :param iter[str] locations: An iterable of URLs or file paths pointing to BEL namespaces.\n    :param bool check_keywords: Should all the keywords be the same? Defaults to ``True``\n    :return: A dictionary of {names: labels}\n    :rtype: dict[str, str]\n\n    Example Usage\n\n    >>> from pybel.resources import write_namespace\n    >>> from pybel_tools.definition_utils import export_namespace, Func\n    >>> graph = ...\n    >>> original_ns_url = ...\n    >>> export_namespace(graph, 'MBS') # Outputs in current directory to MBS.belns\n    >>> value_dict = Func([original_ns_url, 'MBS.belns'])\n    >>> with open('merged_namespace.belns', 'w') as f:\n    >>> ...  write_namespace('MyBrokenNamespace', 'MBS', 'Other', 'Charles Hoyt', 'PyBEL Citation', value_dict, file=f)\n    \"\"\"\n    arg_2 = {location: get_bel_resource(location) for location in arg_0}\n\n    if arg_1:\n        arg_3 = set(config['Namespace']['Keyword'] for config in arg_2.values())\n        if 1 != len(arg_3):\n            raise ValueError('Tried merging namespaces with different keywords: {}'.format(arg_3))\n\n    arg_4 = {}\n    for arg_5 in arg_2:\n        arg_4.update(arg_5['Values'])\n    return arg_4", "path": "src/pybel_tools/definition_utils/summary_independent.py", "identifier": "get_merged_namespace_names", "docstring": "Loads many namespaces and combines their names.\n\n    :param iter[str] locations: An iterable of URLs or file paths pointing to BEL namespaces.\n    :param bool check_keywords: Should all the keywords be the same? Defaults to ``True``\n    :return: A dictionary of {names: labels}\n    :rtype: dict[str, str]\n\n    Example Usage\n\n    >>> from pybel.resources import write_namespace\n    >>> from pybel_tools.definition_utils import export_namespace, get_merged_namespace_names\n    >>> graph = ...\n    >>> original_ns_url = ...\n    >>> export_namespace(graph, 'MBS') # Outputs in current directory to MBS.belns\n    >>> value_dict = get_merged_namespace_names([original_ns_url, 'MBS.belns'])\n    >>> with open('merged_namespace.belns', 'w') as f:\n    >>> ...  write_namespace('MyBrokenNamespace', 'MBS', 'Other', 'Charles Hoyt', 'PyBEL Citation', value_dict, file=f)", "docstring_tokens": ["Loads", "many", "namespaces", "and", "combines", "their", "names", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 258423}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/metabolite.py#L73-L111", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Dictionary of elements as keys and their count in the metabolite\n        as integer. When set, the `formula` property is update accordingly", "language": "python", "parameters": "(self)", "return_statement": "return composition", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "formula", "if", "arg_1", "is", "None", ":", "return", "{", "}", "arg_1", "=", "str", "(", "arg_0", ".", "formula", ")", "if", "\"*\"", "in", "arg_1", ":", "warn", "(", "\"invalid character '*' found in formula '%s'\"", "%", "arg_0", ".", "formula", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "\"*\"", ",", "\"\"", ")", "if", "\"(\"", "in", "arg_1", "or", "\")\"", "in", "arg_1", ":", "warn", "(", "\"invalid formula (has parenthesis) in '%s'\"", "%", "arg_0", ".", "formula", ")", "return", "None", "arg_2", "=", "{", "}", "arg_3", "=", "element_re", ".", "findall", "(", "arg_1", ")", "for", "(", "arg_4", ",", "arg_5", ")", "in", "arg_3", ":", "if", "arg_5", "==", "''", ":", "arg_5", "=", "1", "else", ":", "try", ":", "arg_5", "=", "float", "(", "arg_5", ")", "arg_6", "=", "int", "(", "arg_5", ")", "if", "arg_5", "==", "arg_6", ":", "arg_5", "=", "arg_6", "else", ":", "warn", "(", "\"%s is not an integer (in formula %s)\"", "%", "(", "arg_5", ",", "arg_0", ".", "formula", ")", ")", "except", "ValueError", ":", "warn", "(", "\"failed to parse %s (in formula %s)\"", "%", "(", "arg_5", ",", "arg_0", ".", "formula", ")", ")", "return", "None", "if", "arg_4", "in", "arg_2", ":", "arg_2", "[", "arg_4", "]", "+=", "arg_5", "else", ":", "arg_2", "[", "arg_4", "]", "=", "arg_5", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" Dictionary of Func as keys and their count in the metabolite\n        as integer. When set, the `formula` property is update accordingly \"\"\"\n        arg_1 = arg_0.formula\n        if arg_1 is None:\n            return {}\n        # necessary for some old pickles which use the deprecated\n        # Formula class\n        arg_1 = str(arg_0.formula)\n        # commonly occurring characters in incorrectly constructed formulas\n        if \"*\" in arg_1:\n            warn(\"invalid character '*' found in formula '%s'\" % arg_0.formula)\n            arg_1 = arg_1.replace(\"*\", \"\")\n        if \"(\" in arg_1 or \")\" in arg_1:\n            warn(\"invalid formula (has parenthesis) in '%s'\" % arg_0.formula)\n            return None\n        arg_2 = {}\n        arg_3 = element_re.findall(arg_1)\n        for (arg_4, arg_5) in arg_3:\n            if arg_5 == '':\n                arg_5 = 1\n            else:\n                try:\n                    arg_5 = float(arg_5)\n                    arg_6 = int(arg_5)\n                    if arg_5 == arg_6:\n                        arg_5 = arg_6\n                    else:\n                        warn(\"%s is not an integer (in formula %s)\" %\n                             (arg_5, arg_0.formula))\n                except ValueError:\n                    warn(\"failed to parse %s (in formula %s)\" %\n                         (arg_5, arg_0.formula))\n                    return None\n            if arg_4 in arg_2:\n                arg_2[arg_4] += arg_5\n            else:\n                arg_2[arg_4] = arg_5\n        return arg_2", "path": "cobra/core/metabolite.py", "identifier": "Metabolite.elements", "docstring": "Dictionary of elements as keys and their count in the metabolite\n        as integer. When set, the `formula` property is update accordingly", "docstring_tokens": ["Dictionary", "of", "elements", "as", "keys", "and", "their", "count", "in", "the", "metabolite", "as", "integer", ".", "When", "set", "the", "formula", "property", "is", "update", "accordingly"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 258424}
{"url": "https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/power.py#L99-L139", "sha": "46e12659b8d08af764dc09a1f31b0e85a68f808f", "docstring_summary": "Returns list of frequencies for frequency hopping", "language": "python", "parameters": "(self, min_freq, max_freq, bins, overlap=0, quiet=False)", "return_statement": "return freq_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "arg_0", ".", "bins_to_bin_size", "(", "arg_3", ")", "arg_7", "=", "round", "(", "(", "1", "-", "arg_4", ")", "*", "arg_3", ")", "arg_8", "=", "(", "1", "-", "arg_4", ")", "*", "arg_0", ".", "device", ".", "sample_rate", "arg_9", "=", "arg_2", "-", "arg_1", "arg_10", "=", "True", "if", "arg_9", ">=", "arg_8", "else", "False", "arg_11", "=", "arg_0", ".", "nearest_freq", "(", "arg_8", ",", "arg_6", ")", "arg_12", "=", "math", ".", "ceil", "(", "arg_9", "/", "arg_11", ")", "if", "arg_10", "else", "1", "arg_13", "=", "arg_1", "+", "(", "arg_11", "/", "2", ")", "if", "arg_10", "else", "arg_1", "+", "(", "arg_9", "/", "2", ")", "arg_14", "=", "arg_13", "+", "(", "(", "arg_12", "-", "1", ")", "*", "arg_11", ")", "arg_15", "=", "[", "arg_13", "+", "(", "i", "*", "arg_11", ")", "for", "i", "in", "range", "(", "arg_12", ")", "]", "if", "not", "arg_5", ":", "logger", ".", "info", "(", "'overlap: {:.5f}'", ".", "format", "(", "arg_4", ")", ")", "logger", ".", "info", "(", "'bin_size: {:.2f} Hz'", ".", "format", "(", "arg_6", ")", ")", "logger", ".", "info", "(", "'bins: {}'", ".", "format", "(", "arg_3", ")", ")", "logger", ".", "info", "(", "'bins (after crop): {}'", ".", "format", "(", "arg_7", ")", ")", "logger", ".", "info", "(", "'sample_rate: {:.3f} MHz'", ".", "format", "(", "arg_0", ".", "device", ".", "sample_rate", "/", "1e6", ")", ")", "logger", ".", "info", "(", "'sample_rate (after crop): {:.3f} MHz'", ".", "format", "(", "arg_8", "/", "1e6", ")", ")", "logger", ".", "info", "(", "'freq_range: {:.3f} MHz'", ".", "format", "(", "arg_9", "/", "1e6", ")", ")", "logger", ".", "info", "(", "'hopping: {}'", ".", "format", "(", "'YES'", "if", "arg_10", "else", "'NO'", ")", ")", "logger", ".", "info", "(", "'hop_size: {:.3f} MHz'", ".", "format", "(", "arg_11", "/", "1e6", ")", ")", "logger", ".", "info", "(", "'hops: {}'", ".", "format", "(", "arg_12", ")", ")", "logger", ".", "info", "(", "'min_center_freq: {:.3f} MHz'", ".", "format", "(", "arg_13", "/", "1e6", ")", ")", "logger", ".", "info", "(", "'max_center_freq: {:.3f} MHz'", ".", "format", "(", "arg_14", "/", "1e6", ")", ")", "logger", ".", "info", "(", "'min_freq (after crop): {:.3f} MHz'", ".", "format", "(", "(", "arg_13", "-", "(", "arg_11", "/", "2", ")", ")", "/", "1e6", ")", ")", "logger", ".", "info", "(", "'max_freq (after crop): {:.3f} MHz'", ".", "format", "(", "(", "arg_14", "+", "(", "arg_11", "/", "2", ")", ")", "/", "1e6", ")", ")", "logger", ".", "debug", "(", "'Frequency hops table:'", ")", "logger", ".", "debug", "(", "'  {:8s}      {:8s}      {:8s}'", ".", "format", "(", "'Min:'", ",", "'Center:'", ",", "'Max:'", ")", ")", "for", "arg_16", "in", "arg_15", ":", "logger", ".", "debug", "(", "'  {:8.3f} MHz  {:8.3f} MHz  {:8.3f} MHz'", ".", "format", "(", "(", "arg_16", "-", "(", "arg_0", ".", "device", ".", "sample_rate", "/", "2", ")", ")", "/", "1e6", ",", "arg_16", "/", "1e6", ",", "(", "arg_16", "+", "(", "arg_0", ".", "device", ".", "sample_rate", "/", "2", ")", ")", "/", "1e6", ",", ")", ")", "return", "arg_15"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0, arg_5=False):\n        \"\"\"Returns list of frequencies for frequency hopping\"\"\"\n        arg_6 = arg_0.bins_to_bin_size(arg_3)\n        arg_7 = round((1 - arg_4) * arg_3)\n        arg_8 = (1 - arg_4) * arg_0.device.sample_rate\n\n        arg_9 = arg_2 - arg_1\n        arg_10 = True if arg_9 >= arg_8 else False\n        arg_11 = arg_0.nearest_freq(arg_8, arg_6)\n        arg_12 = math.ceil(arg_9 / arg_11) if arg_10 else 1\n        arg_13 = arg_1 + (arg_11 / 2) if arg_10 else arg_1 + (arg_9 / 2)\n        arg_14 = arg_13 + ((arg_12 - 1) * arg_11)\n\n        arg_15 = [arg_13 + (i * arg_11) for i in range(arg_12)]\n\n        if not arg_5:\n            logger.info('overlap: {:.5f}'.format(arg_4))\n            logger.info('bin_size: {:.2f} Hz'.format(arg_6))\n            logger.info('bins: {}'.format(arg_3))\n            logger.info('bins (after crop): {}'.format(arg_7))\n            logger.info('sample_rate: {:.3f} MHz'.format(arg_0.device.sample_rate / 1e6))\n            logger.info('sample_rate (after crop): {:.3f} MHz'.format(arg_8 / 1e6))\n            logger.info('freq_range: {:.3f} MHz'.format(arg_9 / 1e6))\n            logger.info('hopping: {}'.format('YES' if arg_10 else 'NO'))\n            logger.info('hop_size: {:.3f} MHz'.format(arg_11 / 1e6))\n            logger.info('hops: {}'.format(arg_12))\n            logger.info('min_center_freq: {:.3f} MHz'.format(arg_13 / 1e6))\n            logger.info('max_center_freq: {:.3f} MHz'.format(arg_14 / 1e6))\n            logger.info('min_freq (after crop): {:.3f} MHz'.format((arg_13 - (arg_11 / 2)) / 1e6))\n            logger.info('max_freq (after crop): {:.3f} MHz'.format((arg_14 + (arg_11 / 2)) / 1e6))\n\n            logger.debug('Frequency hops table:')\n            logger.debug('  {:8s}      {:8s}      {:8s}'.format('Min:', 'Center:', 'Max:'))\n            for arg_16 in arg_15:\n                logger.debug('  {:8.3f} MHz  {:8.3f} MHz  {:8.3f} MHz'.format(\n                    (arg_16 - (arg_0.device.sample_rate / 2)) / 1e6,\n                    arg_16 / 1e6,\n                    (arg_16 + (arg_0.device.sample_rate / 2)) / 1e6,\n                ))\n\n        return arg_15", "path": "soapypower/power.py", "identifier": "SoapyPower.freq_plan", "docstring": "Returns list of frequencies for frequency hopping", "docstring_tokens": ["Returns", "list", "of", "frequencies", "for", "frequency", "hopping"], "nwo": "xmikos/soapy_power", "score": 0.1984218952631984, "idx": 258425}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1354-L1383", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "get dstats from the count array and return as a float tuple", "language": "python", "parameters": "(mat)", "return_statement": "return snps", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "zeros", "(", "4", ",", "dtype", "=", "np", ".", "uint32", ")", "arg_1", "[", "0", "]", "=", "np", ".", "uint32", "(", "arg_0", "[", "0", ",", "5", "]", "+", "arg_0", "[", "0", ",", "10", "]", "+", "arg_0", "[", "0", ",", "15", "]", "+", "arg_0", "[", "5", ",", "0", "]", "+", "arg_0", "[", "5", ",", "10", "]", "+", "arg_0", "[", "5", ",", "15", "]", "+", "arg_0", "[", "10", ",", "0", "]", "+", "arg_0", "[", "10", ",", "5", "]", "+", "arg_0", "[", "10", ",", "15", "]", "+", "arg_0", "[", "15", ",", "0", "]", "+", "arg_0", "[", "15", ",", "5", "]", "+", "arg_0", "[", "15", ",", "10", "]", ")", "for", "arg_2", "in", "range", "(", "16", ")", ":", "if", "arg_2", "%", "5", ":", "arg_1", "[", "1", "]", "+=", "arg_0", "[", "arg_2", ",", "arg_2", "]", "arg_1", "[", "2", "]", "=", "arg_0", "[", "1", ",", "4", "]", "+", "arg_0", "[", "2", ",", "8", "]", "+", "arg_0", "[", "3", ",", "12", "]", "+", "arg_0", "[", "4", ",", "1", "]", "+", "arg_0", "[", "6", ",", "9", "]", "+", "arg_0", "[", "7", ",", "13", "]", "+", "arg_0", "[", "8", ",", "2", "]", "+", "arg_0", "[", "9", ",", "6", "]", "+", "arg_0", "[", "11", ",", "14", "]", "+", "arg_0", "[", "12", ",", "3", "]", "+", "arg_0", "[", "13", ",", "7", "]", "+", "arg_0", "[", "14", ",", "11", "]", "arg_1", "[", "3", "]", "=", "(", "arg_0", ".", "sum", "(", ")", "-", "np", ".", "diag", "(", "arg_0", ")", ".", "sum", "(", ")", ")", "-", "arg_1", "[", "2", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" \n    get dstats from the count array and return as a float tuple \n    \"\"\"\n\n    ## get [aabb, baba, abba, aaab] \n    arg_1 = np.zeros(4, dtype=np.uint32)\n\n    ## get concordant (aabb) pis sites\n    arg_1[0] = np.uint32(\\\n           arg_0[0, 5] + arg_0[0, 10] + arg_0[0, 15] + \\\n           arg_0[5, 0] + arg_0[5, 10] + arg_0[5, 15] + \\\n           arg_0[10, 0] + arg_0[10, 5] + arg_0[10, 15] + \\\n           arg_0[15, 0] + arg_0[15, 5] + arg_0[15, 10])\n\n    ## get discordant (baba) sites\n    for arg_2 in range(16):\n        if arg_2 % 5:\n            arg_1[1] += arg_0[arg_2, arg_2]\n    \n    ## get discordant (abba) sites\n    arg_1[2] = arg_0[1, 4] + arg_0[2, 8] + arg_0[3, 12] +\\\n              arg_0[4, 1] + arg_0[6, 9] + arg_0[7, 13] +\\\n              arg_0[8, 2] + arg_0[9, 6] + arg_0[11, 14] +\\\n              arg_0[12, 3] + arg_0[13, 7] + arg_0[14, 11]\n\n    ## get autapomorphy sites\n    arg_1[3] = (arg_0.sum() - np.diag(arg_0).sum()) - arg_1[2]\n\n    return arg_1", "path": "ipyrad/analysis/tetrad.py", "identifier": "count_snps", "docstring": "get dstats from the count array and return as a float tuple", "docstring_tokens": ["get", "dstats", "from", "the", "count", "array", "and", "return", "as", "a", "float", "tuple"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258426}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L938-L950", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Returns an ordered list of all task names.", "language": "python", "parameters": "(self)", "return_statement": "return sorted(tasks)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", "arg_0", ".", "tasks", ")", "for", "arg_2", "in", "dir", "(", "arg_0", ")", ":", "if", "isinstance", "(", "getattr", "(", "type", "(", "arg_0", ")", ",", "arg_2", ",", "None", ")", ",", "property", ")", ":", "continue", "arg_3", "=", "getattr", "(", "arg_0", ",", "arg_2", ")", "if", "hasattr", "(", "arg_3", ",", "'__call__'", ")", "and", "getattr", "(", "arg_3", ",", "'is_task'", ",", "False", ")", ":", "arg_1", ".", "add", "(", "arg_2", ")", "return", "sorted", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns an ordered list of all task names.\n        \"\"\"\n        arg_1 = set(arg_0.tasks)#DEPRECATED\n        for arg_2 in dir(arg_0):\n            # Skip properties so we don't accidentally execute any methods.\n            if isinstance(getattr(type(arg_0), arg_2, None), property):\n                continue\n            arg_3 = getattr(arg_0, arg_2)\n            if hasattr(arg_3, '__call__') and getattr(arg_3, 'is_task', False):\n                arg_1.add(arg_2)\n        return sorted(arg_1)", "path": "burlap/common.py", "identifier": "Satchel.get_tasks", "docstring": "Returns an ordered list of all task names.", "docstring_tokens": ["Returns", "an", "ordered", "list", "of", "all", "task", "names", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258427}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L131-L143", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Add measurement gates to a circuit.", "language": "python", "parameters": "(self, circuit, qreg, op)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ".", "meas_fun", "is", "None", ":", "pass", "else", ":", "arg_0", ".", "meas_fun", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Add measurement gates to a circuit.\n\n        Args:\n            circuit (QuantumCircuit): circuit to add measurement to.\n            qreg (tuple(QuantumRegister,int)): quantum register being measured.\n            op (str): the basis label for the measurement.\n        \"\"\"\n        if arg_0.meas_fun is None:\n            pass\n        else:\n            arg_0.meas_fun(arg_1, arg_2, arg_3)", "path": "qiskit/tools/qcvv/tomography.py", "identifier": "TomographyBasis.meas_gate", "docstring": "Add measurement gates to a circuit.\n\n        Args:\n            circuit (QuantumCircuit): circuit to add measurement to.\n            qreg (tuple(QuantumRegister,int)): quantum register being measured.\n            op (str): the basis label for the measurement.", "docstring_tokens": ["Add", "measurement", "gates", "to", "a", "circuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258428}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mysql_to_gcs.py#L313-L334", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Helper function that maps from MySQL fields to BigQuery fields. Used\n        when a schema_filename is set.", "language": "python", "parameters": "(cls, mysql_type)", "return_statement": "return d[mysql_type] if mysql_type in d else 'STRING'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "FIELD_TYPE", ".", "INT24", ":", "'INTEGER'", ",", "FIELD_TYPE", ".", "TINY", ":", "'INTEGER'", ",", "FIELD_TYPE", ".", "BIT", ":", "'INTEGER'", ",", "FIELD_TYPE", ".", "DATETIME", ":", "'TIMESTAMP'", ",", "FIELD_TYPE", ".", "DATE", ":", "'TIMESTAMP'", ",", "FIELD_TYPE", ".", "DECIMAL", ":", "'FLOAT'", ",", "FIELD_TYPE", ".", "NEWDECIMAL", ":", "'FLOAT'", ",", "FIELD_TYPE", ".", "DOUBLE", ":", "'FLOAT'", ",", "FIELD_TYPE", ".", "FLOAT", ":", "'FLOAT'", ",", "FIELD_TYPE", ".", "LONG", ":", "'INTEGER'", ",", "FIELD_TYPE", ".", "LONGLONG", ":", "'INTEGER'", ",", "FIELD_TYPE", ".", "SHORT", ":", "'INTEGER'", ",", "FIELD_TYPE", ".", "TIMESTAMP", ":", "'TIMESTAMP'", ",", "FIELD_TYPE", ".", "YEAR", ":", "'INTEGER'", ",", "}", "return", "arg_2", "[", "arg_1", "]", "if", "arg_1", "in", "arg_2", "else", "'STRING'"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Helper function that maps from MySQL fields to BigQuery fields. Used\n        when a schema_filename is set.\n        \"\"\"\n        arg_2 = {\n            FIELD_TYPE.INT24: 'INTEGER',\n            FIELD_TYPE.TINY: 'INTEGER',\n            FIELD_TYPE.BIT: 'INTEGER',\n            FIELD_TYPE.DATETIME: 'TIMESTAMP',\n            FIELD_TYPE.DATE: 'TIMESTAMP',\n            FIELD_TYPE.DECIMAL: 'FLOAT',\n            FIELD_TYPE.NEWDECIMAL: 'FLOAT',\n            FIELD_TYPE.DOUBLE: 'FLOAT',\n            FIELD_TYPE.FLOAT: 'FLOAT',\n            FIELD_TYPE.LONG: 'INTEGER',\n            FIELD_TYPE.LONGLONG: 'INTEGER',\n            FIELD_TYPE.SHORT: 'INTEGER',\n            FIELD_TYPE.TIMESTAMP: 'TIMESTAMP',\n            FIELD_TYPE.YEAR: 'INTEGER',\n        }\n        return arg_2[arg_1] if arg_1 in arg_2 else 'STRING'", "path": "airflow/contrib/operators/mysql_to_gcs.py", "identifier": "MySqlToGoogleCloudStorageOperator.type_map", "docstring": "Helper function that maps from MySQL fields to BigQuery fields. Used\n        when a schema_filename is set.", "docstring_tokens": ["Helper", "function", "that", "maps", "from", "MySQL", "fields", "to", "BigQuery", "fields", ".", "Used", "when", "a", "schema_filename", "is", "set", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258429}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/setup.py#L41-L56", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Read fn and return the contents.", "language": "python", "parameters": "(fn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "path", ".", "join", "(", "HERE", ",", "arg_0", ")", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Read fn and return the contents.\n\n    Parameters\n    ----------\n    fn : str\n        A filename\n\n    Returns\n    -------\n    str\n        The content of the file\n\n    \"\"\"\n    with open(path.join(HERE, arg_0), 'r', encoding='utf-8') as f:\n        return f.read()", "path": "setup.py", "identifier": "readfile", "docstring": "Read fn and return the contents.\n\n    Parameters\n    ----------\n    fn : str\n        A filename\n\n    Returns\n    -------\n    str\n        The content of the file", "docstring_tokens": ["Read", "fn", "and", "return", "the", "contents", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 258430}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/estimators/word2vec.py#L244-L258", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Determines vec_size for a pre-trained model after basic model verification.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "pre_trained", ".", "types", "[", "arg_0", ".", "pre_trained", ".", "columns", "[", "0", "]", "]", "if", "arg_1", "!=", "'string'", ":", "raise", "H2OValueError", "(", "\"First column of given pre_trained model %s is required to be a String\"", ",", "arg_0", ".", "pre_trained", ".", "frame_id", ")", "if", "list", "(", "arg_0", ".", "pre_trained", ".", "types", ".", "values", "(", ")", ")", ".", "count", "(", "'string'", ")", ">", "1", ":", "raise", "H2OValueError", "(", "\"There are multiple columns in given pre_trained model %s with a String type.\"", ",", "arg_0", ".", "pre_trained", ".", "frame_id", ")", "arg_0", ".", "vec_size", "=", "arg_0", ".", "pre_trained", ".", "dim", "[", "1", "]", "-", "1"], "function": "def Func(arg_0):\n        \"\"\"\n        Determines vec_size for a pre-trained model after basic model verification.\n        \"\"\"\n        arg_1 = arg_0.pre_trained.types[arg_0.pre_trained.columns[0]]\n\n        if arg_1 != 'string':\n            raise H2OValueError(\"First column of given pre_trained model %s is required to be a String\",\n                                arg_0.pre_trained.frame_id)\n\n        if list(arg_0.pre_trained.types.values()).count('string') > 1:\n            raise H2OValueError(\"There are multiple columns in given pre_trained model %s with a String type.\",\n                                arg_0.pre_trained.frame_id)\n\n        arg_0.vec_size = arg_0.pre_trained.dim[1] - 1;", "path": "h2o-py/h2o/estimators/word2vec.py", "identifier": "H2OWord2vecEstimator._determine_vec_size", "docstring": "Determines vec_size for a pre-trained model after basic model verification.", "docstring_tokens": ["Determines", "vec_size", "for", "a", "pre", "-", "trained", "model", "after", "basic", "model", "verification", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258431}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/base.py#L284-L343", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Saves features to file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "collections", ".", "OrderedDict", "(", ")", "try", ":", "arg_0", ".", "read_features", "(", ")", "except", "(", "WrongFeaturesFormatError", ",", "FeaturesNotFound", ",", "NoFeaturesFileError", ")", ":", "arg_1", "=", "collections", ".", "OrderedDict", "(", "{", "\"metadata\"", ":", "{", "\"versions\"", ":", "{", "\"librosa\"", ":", "librosa", ".", "__version__", ",", "\"msaf\"", ":", "msaf", ".", "__version__", ",", "\"numpy\"", ":", "np", ".", "__version__", "}", ",", "\"timestamp\"", ":", "datetime", ".", "datetime", ".", "today", "(", ")", ".", "strftime", "(", "\"%Y/%m/%d %H:%M:%S\"", ")", "}", "}", ")", "arg_1", "[", "\"globals\"", "]", "=", "{", "\"dur\"", ":", "arg_0", ".", "dur", ",", "\"sample_rate\"", ":", "arg_0", ".", "sr", ",", "\"hop_length\"", ":", "arg_0", ".", "hop_length", ",", "\"audio_file\"", ":", "arg_0", ".", "file_struct", ".", "audio_file", "}", "arg_1", "[", "\"est_beats\"", "]", "=", "arg_0", ".", "_est_beats_times", ".", "tolist", "(", ")", "arg_1", "[", "\"est_beatsync_times\"", "]", "=", "arg_0", ".", "_est_beatsync_times", ".", "tolist", "(", ")", "if", "arg_0", ".", "_ann_beats_times", "is", "not", "None", ":", "arg_1", "[", "\"ann_beats\"", "]", "=", "arg_0", ".", "_ann_beats_times", ".", "tolist", "(", ")", "arg_1", "[", "\"ann_beatsync_times\"", "]", "=", "arg_0", ".", "_ann_beatsync_times", ".", "tolist", "(", ")", "except", "FeatureParamsError", ":", "with", "open", "(", "arg_0", ".", "file_struct", ".", "features_file", ")", "as", "f", ":", "arg_1", "=", "json", ".", "load", "(", "f", ")", "finally", ":", "arg_1", "[", "arg_0", ".", "get_id", "(", ")", "]", "=", "{", "}", "arg_1", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"params\"", "]", "=", "{", "}", "for", "arg_3", "in", "arg_0", ".", "get_param_names", "(", ")", ":", "arg_4", "=", "getattr", "(", "arg_0", ",", "arg_3", ")", "if", "hasattr", "(", "arg_4", ",", "'__call__'", ")", ":", "arg_4", "=", "arg_4", ".", "__name__", "else", ":", "arg_4", "=", "str", "(", "arg_4", ")", "arg_1", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"params\"", "]", "[", "arg_3", "]", "=", "arg_4", "arg_1", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"framesync\"", "]", "=", "arg_0", ".", "_framesync_features", ".", "tolist", "(", ")", "arg_1", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"est_beatsync\"", "]", "=", "arg_0", ".", "_est_beatsync_features", ".", "tolist", "(", ")", "if", "arg_0", ".", "_ann_beatsync_features", "is", "not", "None", ":", "arg_1", "[", "arg_0", ".", "get_id", "(", ")", "]", "[", "\"ann_beatsync\"", "]", "=", "arg_0", ".", "_ann_beatsync_features", ".", "tolist", "(", ")", "with", "open", "(", "arg_0", ".", "file_struct", ".", "features_file", ",", "\"w\"", ")", "as", "f", ":", "json", ".", "dump", "(", "arg_1", ",", "f", ",", "indent", "=", "2", ")"], "function": "def Func(arg_0):\n        \"\"\"Saves features to file.\"\"\"\n        arg_1 = collections.OrderedDict()\n        try:\n            # Only save the necessary information\n            arg_0.read_features()\n        except (WrongFeaturesFormatError, FeaturesNotFound,\n                NoFeaturesFileError):\n            # We need to create the file or overwite it\n            # Metadata\n            arg_1 = collections.OrderedDict({\"metadata\": {\n                \"versions\": {\"librosa\": librosa.__version__,\n                             \"msaf\": msaf.__version__,\n                             \"numpy\": np.__version__},\n                \"timestamp\": datetime.datetime.today().strftime(\n                    \"%Y/%m/%d %H:%M:%S\")}})\n\n            # Global parameters\n            arg_1[\"globals\"] = {\n                \"dur\": arg_0.dur,\n                \"sample_rate\": arg_0.sr,\n                \"hop_length\": arg_0.hop_length,\n                \"audio_file\": arg_0.file_struct.audio_file\n            }\n\n            # Beats\n            arg_1[\"est_beats\"] = arg_0._est_beats_times.tolist()\n            arg_1[\"est_beatsync_times\"] = arg_0._est_beatsync_times.tolist()\n            if arg_0._ann_beats_times is not None:\n                arg_1[\"ann_beats\"] = arg_0._ann_beats_times.tolist()\n                arg_1[\"ann_beatsync_times\"] = arg_0._ann_beatsync_times.tolist()\n        except FeatureParamsError:\n            # We have other features in the file, simply add these ones\n            with open(arg_0.file_struct.features_file) as f:\n                arg_1 = json.load(f)\n        finally:\n            # Specific parameters of the current features\n            arg_1[arg_0.get_id()] = {}\n            arg_1[arg_0.get_id()][\"params\"] = {}\n            for arg_3 in arg_0.get_param_names():\n                arg_4 = getattr(arg_0, arg_3)\n                # Check for special case of functions\n                if hasattr(arg_4, '__call__'):\n                    arg_4 = arg_4.__name__\n                else:\n                    arg_4 = str(arg_4)\n                arg_1[arg_0.get_id()][\"params\"][arg_3] = arg_4\n\n            # Actual features\n            arg_1[arg_0.get_id()][\"framesync\"] = \\\n                arg_0._framesync_features.tolist()\n            arg_1[arg_0.get_id()][\"est_beatsync\"] = \\\n                arg_0._est_beatsync_features.tolist()\n            if arg_0._ann_beatsync_features is not None:\n                arg_1[arg_0.get_id()][\"ann_beatsync\"] = \\\n                    arg_0._ann_beatsync_features.tolist()\n\n            # Save it\n            with open(arg_0.file_struct.features_file, \"w\") as f:\n                json.dump(arg_1, f, indent=2)", "path": "msaf/base.py", "identifier": "Features.write_features", "docstring": "Saves features to file.", "docstring_tokens": ["Saves", "features", "to", "file", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 258432}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py#L1104-L1114", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Start n copies of the process using a batch system.", "language": "python", "parameters": "(self, n)", "return_statement": "return job_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Starting %s: %r\"", ",", "arg_0", ".", "__class__", ".", "__name__", ",", "arg_0", ".", "args", ")", "arg_0", ".", "write_batch_script", "(", "arg_1", ")", "arg_2", "=", "check_output", "(", "arg_0", ".", "args", ",", "env", "=", "os", ".", "environ", ")", "arg_3", "=", "arg_0", ".", "parse_job_id", "(", "arg_2", ")", "arg_0", ".", "notify_Func", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Start n copies of the process using a batch system.\"\"\"\n        arg_0.log.debug(\"Starting %s: %r\", arg_0.__class__.__name__, arg_0.args)\n        # Here we save profile_dir in the context so they\n        # can be used in the batch script template as {profile_dir}\n        arg_0.write_batch_script(arg_1)\n        arg_2 = check_output(arg_0.args, env=os.environ)\n\n        arg_3 = arg_0.parse_job_id(arg_2)\n        arg_0.notify_Func(arg_3)\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", "identifier": "BatchSystemLauncher.start", "docstring": "Start n copies of the process using a batch system.", "docstring_tokens": ["Start", "n", "copies", "of", "the", "process", "using", "a", "batch", "system", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258433}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/resource.py#L132-L137", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Convert the payload into a YAML string with proper\n        indentation and return it.", "language": "python", "parameters": "(self, payload)", "return_statement": "return parser.ordered_dump(payload, Dumper=yaml.SafeDumper,\n                                   default_flow_style=False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "parser", ".", "ordered_dump", "(", "arg_1", ",", "Dumper", "=", "yaml", ".", "SafeDumper", ",", "default_flow_style", "=", "False", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Convert the payload into a YAML string with proper\n        indentation and return it.\n        \"\"\"\n        return parser.ordered_dump(arg_1, Dumper=yaml.SafeDumper,\n                                   default_flow_style=False)", "path": "tower_cli/cli/resource.py", "identifier": "ResSubcommand._format_yaml", "docstring": "Convert the payload into a YAML string with proper\n        indentation and return it.", "docstring_tokens": ["Convert", "the", "payload", "into", "a", "YAML", "string", "with", "proper", "indentation", "and", "return", "it", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 258434}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/client.py#L288-L345", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "Make requests to the REST API", "language": "python", "parameters": "(self, method, url, future,\n                      headers=None,\n                      session=None,\n                      encoding=None,\n                      **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "**", "arg_7", ")", ":", "await", "arg_0", ".", "setup", "arg_8", "=", "await", "arg_0", ".", "headers", ".", "prepare_Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "proxy", "=", "arg_0", ".", "proxy", ",", "**", "arg_7", ")", "if", "arg_6", "is", "None", ":", "arg_6", "=", "arg_0", ".", "encoding", "arg_5", "=", "arg_5", "if", "(", "arg_5", "is", "not", "None", ")", "else", "arg_0", ".", "_session", "logger", ".", "debug", "(", "\"making Func with parameters: %s\"", "%", "arg_8", ")", "async", "with", "arg_5", ".", "Func", "(", "**", "arg_8", ")", "as", "response", ":", "if", "response", ".", "status", "<", "400", ":", "arg_9", "=", "await", "data_processing", ".", "read", "(", "response", ",", "arg_0", ".", "_loads", ",", "arg_6", "=", "arg_6", ")", "arg_3", ".", "set_result", "(", "data_processing", ".", "PeonyResponse", "(", "arg_9", "=", "arg_9", ",", "arg_4", "=", "response", ".", "headers", ",", "arg_2", "=", "response", ".", "url", ",", "Func", "=", "arg_8", ")", ")", "else", ":", "await", "exceptions", ".", "throw", "(", "response", ",", "loads", "=", "arg_0", ".", "_loads", ",", "arg_6", "=", "arg_6", ",", "arg_2", "=", "arg_2", ")"], "function": "async def Func(arg_0, arg_1, arg_2, arg_3,\n                      arg_4=None,\n                      arg_5=None,\n                      arg_6=None,\n                      **arg_7):\n        \"\"\"\n            Make Funcs to the REST API\n\n        Parameters\n        ----------\n        future : asyncio.Future\n            Future used to return the response\n        method : str\n            Method to be used by the Func\n        url : str\n            URL of the resource\n        headers : .oauth.PeonyHeaders\n            Custom headers (doesn't overwrite `Authorization` headers)\n        session : aiohttp.ClientSession, optional\n            Client session used to make the Func\n\n        Returns\n        -------\n        data.PeonyResponse\n            Response to the Func\n        \"\"\"\n        await arg_0.setup\n\n        # prepare Func arguments, particularly the headers\n        arg_8 = await arg_0.headers.prepare_Func(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_4=arg_4,\n            proxy=arg_0.proxy,\n            **arg_7\n        )\n\n        if arg_6 is None:\n            arg_6 = arg_0.encoding\n\n        arg_5 = arg_5 if (arg_5 is not None) else arg_0._session\n\n        logger.debug(\"making Func with parameters: %s\" % arg_8)\n\n        async with arg_5.Func(**arg_8) as response:\n            if response.status < 400:\n                arg_9 = await data_processing.read(response, arg_0._loads,\n                                                  arg_6=arg_6)\n\n                arg_3.set_result(data_processing.PeonyResponse(\n                    arg_9=arg_9,\n                    arg_4=response.headers,\n                    arg_2=response.url,\n                    Func=arg_8\n                ))\n            else:  # throw exception if status is not 2xx\n                await exceptions.throw(response, loads=arg_0._loads,\n                                       arg_6=arg_6, arg_2=arg_2)", "path": "peony/client.py", "identifier": "BasePeonyClient.request", "docstring": "Make requests to the REST API\n\n        Parameters\n        ----------\n        future : asyncio.Future\n            Future used to return the response\n        method : str\n            Method to be used by the request\n        url : str\n            URL of the resource\n        headers : .oauth.PeonyHeaders\n            Custom headers (doesn't overwrite `Authorization` headers)\n        session : aiohttp.ClientSession, optional\n            Client session used to make the request\n\n        Returns\n        -------\n        data.PeonyResponse\n            Response to the request", "docstring_tokens": ["Make", "requests", "to", "the", "REST", "API"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 258435}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/threads/task_thread.py#L10-L16", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Wait for the event, run the task, trigger the next task.", "language": "python", "parameters": "(self, next_task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "event", ".", "wait", "(", ")", "arg_0", ".", "task", "(", ")", "arg_0", ".", "event", ".", "clear", "(", ")", "arg_1", ".", "event", ".", "set", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Wait for the event, Func the task, trigger the next task.\"\"\"\n        arg_0.event.wait()\n        arg_0.task()\n        arg_0.event.clear()\n\n        arg_1.event.set()", "path": "bibliopixel/util/threads/task_thread.py", "identifier": "Task.run", "docstring": "Wait for the event, run the task, trigger the next task.", "docstring_tokens": ["Wait", "for", "the", "event", "run", "the", "task", "trigger", "the", "next", "task", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 258436}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/postgresql.py#L221-L248", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Write the file used to store login credentials for PostgreSQL.", "language": "python", "parameters": "(self, name=None, site=None, use_sudo=0, root=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "arg_0", ".", "database_renderer", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "int", "(", "arg_4", ")", "arg_3", "=", "int", "(", "arg_3", ")", "arg_5", ".", "run", "(", "'touch {pgpass_path}'", ")", "if", "'~'", "in", "arg_5", ".", "env", ".", "pgpass_path", ":", "arg_5", ".", "run", "(", "'chmod {pgpass_chmod} {pgpass_path}'", ")", "else", ":", "arg_5", ".", "sudo", "(", "'chmod {pgpass_chmod} {pgpass_path}'", ")", "if", "arg_4", ":", "arg_5", ".", "env", ".", "shell_username", "=", "arg_5", ".", "env", ".", "get", "(", "'db_root_username'", ",", "'postgres'", ")", "arg_5", ".", "env", ".", "shell_password", "=", "arg_5", ".", "env", ".", "get", "(", "'db_root_password'", ",", "'password'", ")", "else", ":", "arg_5", ".", "env", ".", "shell_username", "=", "arg_5", ".", "env", ".", "db_user", "arg_5", ".", "env", ".", "shell_password", "=", "arg_5", ".", "env", ".", "db_password", "arg_5", ".", "append", "(", "'{db_host}:{port}:*:{shell_username}:{shell_password}'", ",", "arg_5", ".", "env", ".", "pgpass_path", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=0, arg_4=0):\n        \"\"\"\n        Write the file used to store login credentials for PostgreSQL.\n        \"\"\"\n\n        arg_5 = arg_0.database_renderer(arg_1=arg_1, arg_2=arg_2)\n\n        arg_4 = int(arg_4)\n\n        arg_3 = int(arg_3)\n\n        arg_5.run('touch {pgpass_path}')\n        if '~' in arg_5.env.pgpass_path:\n            arg_5.run('chmod {pgpass_chmod} {pgpass_path}')\n        else:\n            arg_5.sudo('chmod {pgpass_chmod} {pgpass_path}')\n\n        if arg_4:\n            arg_5.env.shell_username = arg_5.env.get('db_root_username', 'postgres')\n            arg_5.env.shell_password = arg_5.env.get('db_root_password', 'password')\n        else:\n            arg_5.env.shell_username = arg_5.env.db_user\n            arg_5.env.shell_password = arg_5.env.db_password\n\n        arg_5.append(\n            '{db_host}:{port}:*:{shell_username}:{shell_password}',\n            arg_5.env.pgpass_path,\n            arg_3=arg_3)", "path": "burlap/postgresql.py", "identifier": "PostgreSQLSatchel.write_pgpass", "docstring": "Write the file used to store login credentials for PostgreSQL.", "docstring_tokens": ["Write", "the", "file", "used", "to", "store", "login", "credentials", "for", "PostgreSQL", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258437}
{"url": "https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/hosts.py#L146-L179", "sha": "7d901b03fdb1a34ef795e5412bfe9685d948e32d", "docstring_summary": "Given an attribute name, looks it up on the entry. Names that\n        start with ``tags.`` are looked up in the ``tags`` dictionary.", "language": "python", "parameters": "(self, attr, convert_to_str=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", ".", "startswith", "(", "'tags.'", ")", ":", "arg_3", "=", "arg_1", "[", "len", "(", "'tags.'", ")", ":", "]", "if", "arg_3", "in", "arg_0", ".", "tags", "and", "arg_0", ".", "tags", "[", "arg_3", "]", "!=", "''", ":", "return", "arg_0", ".", "tags", "[", "arg_3", "]", "elif", "arg_2", "is", "True", ":", "return", "'<not set>'", "else", ":", "return", "arg_0", ".", "tags", ".", "get", "(", "arg_3", ")", "elif", "not", "hasattr", "(", "arg_0", ",", "arg_1", ")", ":", "raise", "AttributeError", "(", "'Invalid attribute: {0}. Perhaps you meant '", "'{1}?'", ".", "format", "(", "red", "(", "arg_1", ")", ",", "green", "(", "'tags.'", "+", "arg_1", ")", ")", ")", "else", ":", "arg_4", "=", "getattr", "(", "arg_0", ",", "arg_1", ")", "if", "arg_2", "is", "True", "and", "not", "arg_4", ":", "return", "'<none>'", "elif", "arg_2", "is", "True", "and", "isinstance", "(", "arg_4", ",", "list", ")", ":", "return", "', '", ".", "join", "(", "arg_4", ")", "elif", "arg_2", "is", "True", ":", "return", "str", "(", "arg_4", ")", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Given an attribute name, looks it up on the entry. Names that\n        start with ``tags.`` are looked up in the ``tags`` dictionary.\n\n        :param attr: Name of attribute to look up.\n        :type attr: ``str``\n        :param convert_to_str: Convert result to a string.\n        :type convert_to_str: ``bool``\n\n        :rtype: ``object``\n        \"\"\"\n        if arg_1.startswith('tags.'):\n            arg_3 = arg_1[len('tags.'):]\n            if arg_3 in arg_0.tags and arg_0.tags[arg_3] != '':\n                return arg_0.tags[arg_3]\n            elif arg_2 is True:\n                return '<not set>'\n            else:\n                return arg_0.tags.get(arg_3)\n        elif not hasattr(arg_0, arg_1):\n            raise AttributeError('Invalid attribute: {0}. Perhaps you meant '\n                                 '{1}?'.format(red(arg_1),\n                                               green('tags.' + arg_1)))\n        else:\n            arg_4 = getattr(arg_0, arg_1)\n            if arg_2 is True and not arg_4:\n                return '<none>'\n            elif arg_2 is True and isinstance(arg_4, list):\n                return ', '.join(arg_4)\n            elif arg_2 is True:\n                return str(arg_4)\n            else:\n                return arg_4", "path": "src/lsi/utils/hosts.py", "identifier": "HostEntry._get_attrib", "docstring": "Given an attribute name, looks it up on the entry. Names that\n        start with ``tags.`` are looked up in the ``tags`` dictionary.\n\n        :param attr: Name of attribute to look up.\n        :type attr: ``str``\n        :param convert_to_str: Convert result to a string.\n        :type convert_to_str: ``bool``\n\n        :rtype: ``object``", "docstring_tokens": ["Given", "an", "attribute", "name", "looks", "it", "up", "on", "the", "entry", ".", "Names", "that", "start", "with", "tags", ".", "are", "looked", "up", "in", "the", "tags", "dictionary", "."], "nwo": "NarrativeScience/lsi", "score": 0.14991498758945482, "idx": 258438}
{"url": "https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/utils.py#L39-L53", "sha": "074c8452f15a0da638668a4fe139fde06ccfae7f", "docstring_summary": "Decorates a function with the given docstring", "language": "python", "parameters": "(docstr)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "arg_4", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_4", ".", "__doc__", "=", "arg_0", "return", "arg_4", "return", "decorator"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorates a function with the given Func\n\n    Parameters\n    ----------\n    docstr : string\n    \"\"\"\n    def decorator(arg_1):\n        @wraps(arg_1)\n        def arg_4(*arg_2, **arg_3):\n            return arg_1(*arg_2, **arg_3)\n        arg_4.__doc__ = arg_0\n        return arg_4\n    return decorator", "path": "descent/utils.py", "identifier": "docstring", "docstring": "Decorates a function with the given docstring\n\n    Parameters\n    ----------\n    docstr : string", "docstring_tokens": ["Decorates", "a", "function", "with", "the", "given", "docstring"], "nwo": "nirum/descent", "score": 0.18112697196067942, "idx": 258439}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/build.py#L133-L141", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "kill is a helper function to call the \"kill\" function of the client,\n       meaning we bring down an instance.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "sregistry", ".", "main", "import", "Client", "as", "cli", "if", "len", "(", "arg_0", ".", "commands", ")", ">", "0", ":", "for", "arg_1", "in", "arg_0", ".", "commands", ":", "cli", ".", "destroy", "(", "arg_1", ")", "sys", ".", "exit", "(", "0", ")"], "function": "def Func(arg_0):\n    '''Func is a helper function to call the \"Func\" function of the client,\n       meaning we bring down an instance.\n    '''\n    from sregistry.main import Client as cli\n    if len(arg_0.commands) > 0:\n        for arg_1 in arg_0.commands:\n            cli.destroy(arg_1)\n    sys.exit(0)", "path": "sregistry/client/build.py", "identifier": "kill", "docstring": "kill is a helper function to call the \"kill\" function of the client,\n       meaning we bring down an instance.", "docstring_tokens": ["kill", "is", "a", "helper", "function", "to", "call", "the", "kill", "function", "of", "the", "client", "meaning", "we", "bring", "down", "an", "instance", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 258440}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L446-L461", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Add new raw index values.", "language": "python", "parameters": "(self, idx_name, content_id, val)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_index", "(", "arg_1", ")", "[", "'transform'", "]", "arg_5", "=", "(", "arg_4", "(", "arg_3", ")", ",", "arg_1", ".", "encode", "(", "'utf-8'", ")", ",", "arg_2", ")", "arg_0", ".", "kvl", ".", "put", "(", "arg_0", ".", "INDEX_TABLE", ",", "(", "arg_5", ",", "'0'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''Add new raw index values.\n\n        Adds a new index key corresponding to\n        ``(idx_name, transform(val), content_id)``.\n\n        This method bypasses the *creation* of indexes from content\n        objects, but values are still transformed.\n\n        :type idx_name: unicode\n        :type content_id: str\n        :type val: unspecified (depends on the index, usually ``unicode``)\n        '''\n        arg_4 = arg_0._index(arg_1)['transform']\n        arg_5 = (arg_4(arg_3), arg_1.encode('utf-8'), arg_2)\n        arg_0.kvl.put(arg_0.INDEX_TABLE, (arg_5, '0'))", "path": "dossier/store/store.py", "identifier": "Store._index_put_raw", "docstring": "Add new raw index values.\n\n        Adds a new index key corresponding to\n        ``(idx_name, transform(val), content_id)``.\n\n        This method bypasses the *creation* of indexes from content\n        objects, but values are still transformed.\n\n        :type idx_name: unicode\n        :type content_id: str\n        :type val: unspecified (depends on the index, usually ``unicode``)", "docstring_tokens": ["Add", "new", "raw", "index", "values", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 258441}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L1853-L1861", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns the size of a specific dimension.", "language": "python", "parameters": "(x, axis)", "return_statement": "return tf.shape(input=x)[axis]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tf", ".", "compat", ".", "dimension_value", "(", "tensorshape_util", ".", "with_rank_at_least", "(", "arg_0", ".", "shape", ",", "np", ".", "abs", "(", "arg_1", ")", ")", "[", "arg_1", "]", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_2", "return", "tf", ".", "shape", "(", "input", "=", "arg_0", ")", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Returns the size of a specific dimension.\"\"\"\n  # Since tf.gather isn't \"constant-in, constant-out\", we must first check the\n  # static shape or fallback to dynamic shape.\n  arg_2 = tf.compat.dimension_value(\n      tensorshape_util.with_rank_at_least(arg_0.shape, np.abs(arg_1))[arg_1])\n  if arg_2 is not None:\n    return arg_2\n  return tf.shape(input=arg_0)[arg_1]", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "dimension_size", "docstring": "Returns the size of a specific dimension.", "docstring_tokens": ["Returns", "the", "size", "of", "a", "specific", "dimension", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258442}
{"url": "https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L16-L35", "sha": "eba01c058100ec8806129b11a2859f3126a1b101", "docstring_summary": "Parse Releases search pages.", "language": "python", "parameters": "(soup)", "return_statement": "return releases", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "list", "(", "arg_0", ".", "find_all", "(", "'table'", ",", "class_", "=", "'stripe'", ")", "[", "0", "]", ".", "children", ")", "[", "1", ":", "]", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "list", "(", "arg_2", ".", "children", ")", "arg_4", "=", "{", "'date'", ":", "None", ",", "'ages'", ":", "None", ",", "'platform'", ":", "None", ",", "'name'", ":", "None", "}", "arg_4", "[", "'date'", "]", "=", "arg_3", "[", "0", "]", ".", "string", "arg_4", "[", "'ages'", "]", "=", "arg_3", "[", "1", "]", ".", "string", "arg_4", "[", "'platform'", "]", "=", "arg_3", "[", "2", "]", ".", "abbr", ".", "get", "(", "'title'", ")", "arg_4", "[", "'name'", "]", "=", "arg_3", "[", "3", "]", ".", "a", ".", "string", "arg_1", ".", "append", "(", "arg_4", ")", "del", "arg_4", "return", "arg_1"], "function": "async def Func(arg_0):\n    \"\"\"\n    Parse Releases search pages.\n\n    :param soup: The BS4 class object\n    :return: A list of dictionaries containing a release dictionary. This is the same as the one returned in get_novel.\n             It contains a Date released, Platform, Ages group and Name.\n    \"\"\"\n    arg_0 = list(arg_0.find_all('table', class_='stripe')[0].children)[1:]\n    arg_1 = []\n    for arg_2 in arg_0:\n        arg_3 = list(arg_2.children)\n        arg_4 = {'date': None, 'ages': None, 'platform': None, 'name': None}\n        arg_4['date'] = arg_3[0].string\n        arg_4['ages'] = arg_3[1].string\n        arg_4['platform'] = arg_3[2].abbr.get('title')\n        arg_4['name'] = arg_3[3].a.string\n        arg_1.append(arg_4)\n        del arg_4\n    return arg_1", "path": "Shosetsu/Parsing.py", "identifier": "parse_release_results", "docstring": "Parse Releases search pages.\n\n    :param soup: The BS4 class object\n    :return: A list of dictionaries containing a release dictionary. This is the same as the one returned in get_novel.\n             It contains a Date released, Platform, Ages group and Name.", "docstring_tokens": ["Parse", "Releases", "search", "pages", "."], "nwo": "ccubed/Shosetsu", "score": 0.25890992733444657, "idx": 258443}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/ternya.py#L62-L72", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "Start ternya work.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "init_modules", "(", ")", "arg_1", "=", "arg_0", ".", "init_mq", "(", ")", "TernyaConnection", "(", "arg_0", ",", "arg_1", ")", ".", "connect", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Start ternya Func.\n\n        First, import customer's service modules.\n        Second, init openstack mq.\n        Third, keep a ternya connection that can auto-reconnect.\n        \"\"\"\n        arg_0.init_modules()\n        arg_1 = arg_0.init_mq()\n        TernyaConnection(arg_0, arg_1).connect()", "path": "ternya/ternya.py", "identifier": "Ternya.work", "docstring": "Start ternya work.\n\n        First, import customer's service modules.\n        Second, init openstack mq.\n        Third, keep a ternya connection that can auto-reconnect.", "docstring_tokens": ["Start", "ternya", "work", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 258444}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/boxscores.py#L126-L136", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns the year ID of the season in which this game took place.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "date", "(", ")", "if", "arg_1", ".", "month", ">=", "9", ":", "return", "arg_1", ".", "year", "+", "1", "else", ":", "return", "arg_1", ".", "year"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the year ID of the Func in which this game took place.\n\n        :returns: An int representing the year of the Func.\n        \"\"\"\n        arg_1 = arg_0.date()\n        if arg_1.month >= 9:\n            return arg_1.year + 1\n        else:\n            return arg_1.year", "path": "sportsref/nba/boxscores.py", "identifier": "BoxScore.season", "docstring": "Returns the year ID of the season in which this game took place.\n\n        :returns: An int representing the year of the season.", "docstring_tokens": ["Returns", "the", "year", "ID", "of", "the", "season", "in", "which", "this", "game", "took", "place", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 258445}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L12-L23", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Converts bytes to a human readable format", "language": "python", "parameters": "(num)", "return_statement": "return \"%.1f%s\" % (num, 'Yb')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "<", "512", ":", "return", "\"0 Kb\"", "elif", "arg_0", "<", "1024", ":", "return", "\"1 Kb\"", "for", "arg_1", "in", "[", "''", ",", "'Kb'", ",", "'Mb'", ",", "'Gb'", ",", "'Tb'", ",", "'Pb'", ",", "'Eb'", ",", "'Zb'", "]", ":", "if", "abs", "(", "arg_0", ")", "<", "1024.0", ":", "return", "\"%3.1f%s\"", "%", "(", "arg_0", ",", "arg_1", ")", "arg_0", "/=", "1024.0", "return", "\"%.1f%s\"", "%", "(", "arg_0", ",", "'Yb'", ")"], "function": "def Func(arg_0):\r\n        \"\"\"Converts bytes to a human readable format\"\"\"\r\n        if arg_0 < 512:\r\n            return \"0 Kb\"\r\n        elif arg_0 < 1024:\r\n            return \"1 Kb\"\r\n\r\n        for arg_1 in ['', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb']:\r\n            if abs(arg_0) < 1024.0:\r\n                return \"%3.1f%s\" % (arg_0, arg_1)\r\n            arg_0 /= 1024.0\r\n        return \"%.1f%s\" % (arg_0, 'Yb')", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynoFormatHelper.bytes_to_readable", "docstring": "Converts bytes to a human readable format", "docstring_tokens": ["Converts", "bytes", "to", "a", "human", "readable", "format"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 258446}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L1168-L1213", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Process MSG sent by server.", "language": "python", "parameters": "(self, sid, subject, reply, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "len", "(", "arg_4", ")", "arg_0", ".", "stats", "[", "'in_msgs'", "]", "+=", "1", "arg_0", ".", "stats", "[", "'in_bytes'", "]", "+=", "arg_5", "arg_6", "=", "arg_0", ".", "_subs", ".", "get", "(", "arg_1", ")", "if", "arg_6", "is", "None", ":", "return", "arg_6", ".", "received", "+=", "1", "if", "arg_6", ".", "max_msgs", ">", "0", "and", "arg_6", ".", "received", ">=", "arg_6", ".", "max_msgs", ":", "arg_0", ".", "_subs", ".", "pop", "(", "arg_1", ",", "None", ")", "arg_7", "=", "arg_0", ".", "_build_message", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "if", "arg_6", ".", "future", "is", "not", "None", ":", "if", "arg_6", ".", "future", ".", "cancelled", "(", ")", ":", "return", "arg_6", ".", "future", ".", "set_result", "(", "arg_7", ")", "return", "try", ":", "arg_6", ".", "pending_size", "+=", "arg_5", "if", "arg_6", ".", "pending_size", ">=", "arg_6", ".", "pending_bytes_limit", ":", "arg_6", ".", "pending_size", "-=", "arg_5", "if", "arg_0", ".", "_error_cb", "is", "not", "None", ":", "yield", "from", "arg_0", ".", "_error_cb", "(", "ErrSlowConsumer", "(", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", ")", "return", "arg_6", ".", "pending_queue", ".", "put_nowait", "(", "arg_7", ")", "except", "asyncio", ".", "QueueFull", ":", "if", "arg_0", ".", "_error_cb", "is", "not", "None", ":", "yield", "from", "arg_0", ".", "_error_cb", "(", "ErrSlowConsumer", "(", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Process MSG sent by server.\n        \"\"\"\n        arg_5 = len(arg_4)\n        arg_0.stats['in_msgs'] += 1\n        arg_0.stats['in_bytes'] += arg_5\n\n        arg_6 = arg_0._subs.get(arg_1)\n        if arg_6 is None:\n            # Skip in case no subscription present.\n            return\n\n        arg_6.received += 1\n        if arg_6.max_msgs > 0 and arg_6.received >= arg_6.max_msgs:\n            # Enough messages so can throwaway subscription now.\n            arg_0._subs.pop(arg_1, None)\n        arg_7 = arg_0._build_message(arg_2, arg_3, arg_4)\n\n        # Check if it is an old style request.\n        if arg_6.future is not None:\n            if arg_6.future.cancelled():\n                # Already gave up, nothing to do.\n                return\n            arg_6.future.set_result(arg_7)\n            return\n\n        # Let subscription wait_for_msgs coroutine process the messages,\n        # but in case sending to the subscription task would block,\n        # then consider it to be an slow consumer and drop the message.\n        try:\n            arg_6.pending_size += arg_5\n            if arg_6.pending_size >= arg_6.pending_bytes_limit:\n                # Substract again the bytes since throwing away\n                # the message so would not be pending data.\n                arg_6.pending_size -= arg_5\n\n                if arg_0._error_cb is not None:\n                    yield from arg_0._error_cb(\n                        ErrSlowConsumer(arg_2=arg_2, arg_1=arg_1))\n                return\n            arg_6.pending_queue.put_nowait(arg_7)\n        except asyncio.QueueFull:\n            if arg_0._error_cb is not None:\n                yield from arg_0._error_cb(\n                    ErrSlowConsumer(arg_2=arg_2, arg_1=arg_1))", "path": "nats/aio/client.py", "identifier": "Client._process_msg", "docstring": "Process MSG sent by server.", "docstring_tokens": ["Process", "MSG", "sent", "by", "server", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 258447}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/gcp/auth.py#L101-L107", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Public GCP client builder.", "language": "python", "parameters": "(**kwargs)", "return_statement": "return _gcp_client(project=kwargs['project'], mod_name=kwargs['mod_name'],\n                       pkg_name=kwargs.get('pkg_name', 'google.cloud'),\n                       key_file=kwargs.get('key_file', None),\n                       http_auth=kwargs.get('http', None),\n                       user_agent=kwargs.get('user_agent', None))", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "return", "_gcp_client", "(", "project", "=", "arg_0", "[", "'project'", "]", ",", "mod_name", "=", "arg_0", "[", "'mod_name'", "]", ",", "pkg_name", "=", "arg_0", ".", "get", "(", "'pkg_name'", ",", "'google.cloud'", ")", ",", "key_file", "=", "arg_0", ".", "get", "(", "'key_file'", ",", "None", ")", ",", "http_auth", "=", "arg_0", ".", "get", "(", "'http'", ",", "None", ")", ",", "user_agent", "=", "arg_0", ".", "get", "(", "'user_agent'", ",", "None", ")", ")"], "function": "def Func(**arg_0):\n    \"\"\"Public GCP client builder.\"\"\"\n    return _gcp_client(project=arg_0['project'], mod_name=arg_0['mod_name'],\n                       pkg_name=arg_0.get('pkg_name', 'google.cloud'),\n                       key_file=arg_0.get('key_file', None),\n                       http_auth=arg_0.get('http', None),\n                       user_agent=arg_0.get('user_agent', None))", "path": "cloudaux/gcp/auth.py", "identifier": "get_gcp_client", "docstring": "Public GCP client builder.", "docstring_tokens": ["Public", "GCP", "client", "builder", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 258448}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1456-L1469", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "The standard method called to apply functionality when the manifest changes.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "last_manifest", "for", "arg_2", "in", "arg_0", ".", "get_trackers", "(", ")", ":", "arg_0", ".", "vprint", "(", "'Checking tracker:'", ",", "arg_2", ")", "arg_3", "=", "arg_1", "[", "'_tracker_%s'", "%", "arg_2", ".", "get_natural_key_hash", "(", ")", "]", "arg_0", ".", "vprint", "(", "'last thumbprint:'", ",", "arg_3", ")", "arg_4", "=", "arg_2", ".", "is_changed", "(", "arg_3", ")", "arg_0", ".", "vprint", "(", "'Tracker changed:'", ",", "arg_4", ")", "if", "arg_4", ":", "arg_0", ".", "vprint", "(", "'Change detected!'", ")", "arg_2", ".", "act", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        The standard method called to apply functionality when the manifest changes.\n        \"\"\"\n        arg_1 = arg_0.last_manifest\n        for arg_2 in arg_0.get_trackers():\n            arg_0.vprint('Checking tracker:', arg_2)\n            arg_3 = arg_1['_tracker_%s' % arg_2.get_natural_key_hash()]\n            arg_0.vprint('last thumbprint:', arg_3)\n            arg_4 = arg_2.is_changed(arg_3)\n            arg_0.vprint('Tracker changed:', arg_4)\n            if arg_4:\n                arg_0.vprint('Change detected!')\n                arg_2.act()", "path": "burlap/common.py", "identifier": "Satchel.configure", "docstring": "The standard method called to apply functionality when the manifest changes.", "docstring_tokens": ["The", "standard", "method", "called", "to", "apply", "functionality", "when", "the", "manifest", "changes", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258449}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L596-L623", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a symbol from the input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "return symbol.symbol(name, ns=ns)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "MaybeSymbol", ":", "arg_2", ",", "arg_3", "=", "_read_namespaced", "(", "arg_0", ",", "allowed_suffix", "=", "\"#\"", ")", "if", "not", "arg_0", ".", "is_syntax_quoted", "and", "arg_3", ".", "endswith", "(", "\"#\"", ")", ":", "raise", "SyntaxError", "(", "\"Gensym may not appear outside syntax quote\"", ")", "if", "arg_2", "is", "not", "None", ":", "if", "any", "(", "map", "(", "lambda", "s", ":", "len", "(", "s", ")", "==", "0", ",", "arg_2", ".", "split", "(", "\".\"", ")", ")", ")", ":", "raise", "SyntaxError", "(", "\"All '.' separated segments of a namespace \"", "\"must contain at least one character.\"", ")", "if", "arg_3", ".", "startswith", "(", "\".\"", ")", "and", "arg_2", "is", "not", "None", ":", "raise", "SyntaxError", "(", "\"Symbols starting with '.' may not have a namespace\"", ")", "if", "arg_2", "is", "None", ":", "if", "arg_3", "==", "\"nil\"", ":", "return", "None", "elif", "arg_3", "==", "\"true\"", ":", "return", "True", "elif", "arg_3", "==", "\"false\"", ":", "return", "False", "if", "arg_0", ".", "is_syntax_quoted", "and", "not", "arg_3", ".", "endswith", "(", "\"#\"", ")", ":", "return", "arg_0", ".", "resolve", "(", "symbol", ".", "symbol", "(", "arg_3", ",", "arg_2", ")", ")", "return", "symbol", ".", "symbol", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0: arg_1) -> MaybeSymbol:\n    \"\"\"Return a symbol from the input stream.\n\n    If a symbol appears in a syntax quoted form, the reader will attempt\n    to resolve the symbol using the resolver in the ReaderContext `ctx`.\n    The resolver will look into the current namespace for an alias or\n    namespace matching the symbol's namespace.\"\"\"\n    arg_2, arg_3 = _read_namespaced(arg_0, allowed_suffix=\"#\")\n    if not arg_0.is_syntax_quoted and arg_3.endswith(\"#\"):\n        raise SyntaxError(\"Gensym may not appear outside syntax quote\")\n    if arg_2 is not None:\n        if any(map(lambda s: len(s) == 0, arg_2.split(\".\"))):\n            raise SyntaxError(\n                \"All '.' separated segments of a namespace \"\n                \"must contain at least one character.\"\n            )\n    if arg_3.startswith(\".\") and arg_2 is not None:\n        raise SyntaxError(\"Symbols starting with '.' may not have a namespace\")\n    if arg_2 is None:\n        if arg_3 == \"nil\":\n            return None\n        elif arg_3 == \"true\":\n            return True\n        elif arg_3 == \"false\":\n            return False\n    if arg_0.is_syntax_quoted and not arg_3.endswith(\"#\"):\n        return arg_0.resolve(symbol.symbol(arg_3, arg_2))\n    return symbol.symbol(arg_3, arg_2=arg_2)", "path": "src/basilisp/lang/reader.py", "identifier": "_read_sym", "docstring": "Return a symbol from the input stream.\n\n    If a symbol appears in a syntax quoted form, the reader will attempt\n    to resolve the symbol using the resolver in the ReaderContext `ctx`.\n    The resolver will look into the current namespace for an alias or\n    namespace matching the symbol's namespace.", "docstring_tokens": ["Return", "a", "symbol", "from", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 258450}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmds.py#L392-L405", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "sub pipe is a wrapper of re.sub method.", "language": "python", "parameters": "(prev, pattern, repl, *args, **kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "0", "if", "'count'", "not", "in", "arg_4", "else", "arg_4", ".", "pop", "(", "'count'", ")", "arg_6", "=", "re", ".", "compile", "(", "arg_1", ",", "*", "arg_3", ",", "**", "arg_4", ")", "for", "arg_7", "in", "arg_0", ":", "yield", "arg_6", ".", "Func", "(", "arg_2", ",", "arg_7", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n    \"\"\"Func pipe is a wrapper of re.Func method.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param pattern: The pattern string.\n    :type pattern: str|unicode\n    :param repl: Check repl argument in re.Func method.\n    :type repl: str|unicode|callable\n    \"\"\"\n    arg_5 = 0 if 'count' not in arg_4 else arg_4.pop('count')\n    arg_6 = re.compile(arg_1, *arg_3, **arg_4)\n    for arg_7 in arg_0:\n        yield arg_6.Func(arg_2, arg_7, arg_5=arg_5)", "path": "cmdlet/cmds.py", "identifier": "sub", "docstring": "sub pipe is a wrapper of re.sub method.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param pattern: The pattern string.\n    :type pattern: str|unicode\n    :param repl: Check repl argument in re.sub method.\n    :type repl: str|unicode|callable", "docstring_tokens": ["sub", "pipe", "is", "a", "wrapper", "of", "re", ".", "sub", "method", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 258451}
{"url": "https://github.com/stp/OutputCheck/blob/eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d/OutputCheck/Directives.py#L108-L126", "sha": "eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d", "docstring_summary": "Search through lines for match.\n            Raise an Exception if fail to match\n            If match is succesful return the position the match was found", "language": "python", "parameters": "(self, subsetLines, offsetOfSubset, fileName)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "for", "(", "arg_4", ",", "arg_5", ")", "in", "enumerate", "(", "arg_1", ")", ":", "arg_6", "=", "arg_5", ".", "find", "(", "arg_0", ".", "literal", ")", "if", "arg_6", "!=", "-", "1", ":", "arg_7", "=", "arg_4", "+", "arg_2", "_logger", ".", "debug", "(", "'Found Func on line {}, col {}'", ".", "format", "(", "str", "(", "arg_7", "+", "1", ")", ",", "arg_6", ")", ")", "_logger", ".", "debug", "(", "'Line is {}'", ".", "format", "(", "arg_5", ")", ")", "arg_0", ".", "FuncLocation", "=", "CheckFileParser", ".", "FileLocation", "(", "arg_3", ",", "arg_7", "+", "1", ")", "return", "arg_7", "arg_0", ".", "failed", "=", "True", "raise", "DirectiveException", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n            Search through lines for Func.\n            Raise an Exception if fail to Func\n            If Func is succesful return the position the Func was found\n        \"\"\"\n\n        for (arg_4,arg_5) in enumerate(arg_1):\n            arg_6 = arg_5.find(arg_0.literal)\n            if arg_6 != -1:\n                arg_7 = arg_4 + arg_2\n                _logger.debug('Found Func on line {}, col {}'.format(str(arg_7+ 1), arg_6))\n                _logger.debug('Line is {}'.format(arg_5))\n                arg_0.FuncLocation = CheckFileParser.FileLocation(arg_3, arg_7 +1)\n                return arg_7\n\n        # No Match found\n        arg_0.failed = True\n        raise DirectiveException(arg_0)", "path": "OutputCheck/Directives.py", "identifier": "CheckLiteral.match", "docstring": "Search through lines for match.\n            Raise an Exception if fail to match\n            If match is succesful return the position the match was found", "docstring_tokens": ["Search", "through", "lines", "for", "match", ".", "Raise", "an", "Exception", "if", "fail", "to", "match", "If", "match", "is", "succesful", "return", "the", "position", "the", "match", "was", "found"], "nwo": "stp/OutputCheck", "score": 0.37729991823847475, "idx": 258452}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L588-L608", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Save the state of this network to a pickle file on disk.", "language": "python", "parameters": "(self, filename_or_handle)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "util", ".", "basestring", ")", ":", "arg_2", "=", "gzip", ".", "open", "if", "arg_1", ".", "lower", "(", ")", ".", "endswith", "(", "'.gz'", ")", "else", "open", "arg_3", "=", "arg_2", "(", "arg_1", ",", "'wb'", ")", "else", ":", "arg_3", "=", "arg_1", "pickle", ".", "dump", "(", "arg_0", ",", "arg_3", ",", "-", "1", ")", "if", "isinstance", "(", "arg_1", ",", "util", ".", "basestring", ")", ":", "arg_3", ".", "close", "(", ")", "util", ".", "log", "(", "'Funcd model to {}'", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''Save the state of this network to a pickle file on disk.\n\n        Parameters\n        ----------\n        filename_or_handle : str or file handle\n            Save the state of this network to a pickle file. If this parameter\n            is a string, it names the file where the pickle will be Funcd. If it\n            is a file-like object, this object will be used for writing the\n            pickle. If the filename ends in \".gz\" then the output will\n            automatically be gzipped.\n        '''\n        if isinstance(arg_1, util.basestring):\n            arg_2 = gzip.open if arg_1.lower().endswith('.gz') else open\n            arg_3 = arg_2(arg_1, 'wb')\n        else:\n            arg_3 = arg_1\n        pickle.dump(arg_0, arg_3, -1)\n        if isinstance(arg_1, util.basestring):\n            arg_3.close()\n        util.log('Funcd model to {}', arg_1)", "path": "theanets/graph.py", "identifier": "Network.save", "docstring": "Save the state of this network to a pickle file on disk.\n\n        Parameters\n        ----------\n        filename_or_handle : str or file handle\n            Save the state of this network to a pickle file. If this parameter\n            is a string, it names the file where the pickle will be saved. If it\n            is a file-like object, this object will be used for writing the\n            pickle. If the filename ends in \".gz\" then the output will\n            automatically be gzipped.", "docstring_tokens": ["Save", "the", "state", "of", "this", "network", "to", "a", "pickle", "file", "on", "disk", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 258453}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmds.py#L93-L104", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "attr pipe can extract attribute value of object.", "language": "python", "parameters": "(prev, attr_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ":", "if", "hasFunc", "(", "arg_2", ",", "arg_1", ")", ":", "yield", "getFunc", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Func pipe can extract Funcibute value of object.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param Func_name: The name of Funcibute\n    :type Func_name: str\n    :returns: generator\n    \"\"\"\n    for arg_2 in arg_0:\n        if hasFunc(arg_2, arg_1):\n            yield getFunc(arg_2, arg_1)", "path": "cmdlet/cmds.py", "identifier": "attr", "docstring": "attr pipe can extract attribute value of object.\n\n    :param prev: The previous iterator of pipe.\n    :type prev: Pipe\n    :param attr_name: The name of attribute\n    :type attr_name: str\n    :returns: generator", "docstring_tokens": ["attr", "pipe", "can", "extract", "attribute", "value", "of", "object", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 258454}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L191-L208", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Extracts the update time from a GitHub item.", "language": "python", "parameters": "(item)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "\"forks_count\"", "in", "arg_0", ":", "return", "arg_0", "[", "'fetched_on'", "]", "else", ":", "arg_1", "=", "arg_0", "[", "'updated_at'", "]", "arg_1", "=", "str_to_datetime", "(", "arg_1", ")", "return", "arg_1", ".", "timestamp", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Extracts the update time from a GitHub item.\n\n        The timestamp used is extracted from 'updated_at' field.\n        This date is converted to UNIX timestamp format. As GitHub\n        dates are in UTC the conversion is straightforward.\n\n        :param item: item generated by the backend\n\n        :returns: a UNIX timestamp\n        \"\"\"\n        if \"forks_count\" in arg_0:\n            return arg_0['fetched_on']\n        else:\n            arg_1 = arg_0['updated_at']\n            arg_1 = str_to_datetime(arg_1)\n\n            return arg_1.timestamp()", "path": "perceval/backends/core/github.py", "identifier": "GitHub.metadata_updated_on", "docstring": "Extracts the update time from a GitHub item.\n\n        The timestamp used is extracted from 'updated_at' field.\n        This date is converted to UNIX timestamp format. As GitHub\n        dates are in UTC the conversion is straightforward.\n\n        :param item: item generated by the backend\n\n        :returns: a UNIX timestamp", "docstring_tokens": ["Extracts", "the", "update", "time", "from", "a", "GitHub", "item", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 258455}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/time_frequency.py#L165-L209", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Converts time stamps into STFT frames.", "language": "python", "parameters": "(times, sr=22050, hop_length=512, n_fft=None)", "return_statement": "return samples_to_frames(samples, hop_length=hop_length, n_fft=n_fft)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "22050", ",", "arg_2", "=", "512", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "time_to_samples", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "samples_to_frames", "(", "arg_4", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=22050, arg_2=512, arg_3=None):\n    \"\"\"Converts time stamps into STFT frames.\n\n    Parameters\n    ----------\n    times : np.ndarray [shape=(n,)]\n        time (in seconds) or vector of time values\n\n    sr : number > 0 [scalar]\n        audio sampling rate\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    n_fft : None or int > 0 [scalar]\n        Optional: length of the FFT window.\n        If given, time conversion will include an offset of `- n_fft / 2`\n        to counteract windowing effects in STFT.\n\n        .. note:: This may result in negative frame indices.\n\n    Returns\n    -------\n    frames : np.ndarray [shape=(n,), dtype=int]\n        Frame numbers corresponding to the given times:\n        `frames[i] = floor( times[i] * sr / hop_length )`\n\n    See Also\n    --------\n    frames_to_time : convert frame indices to time values\n    time_to_samples : convert time values to sample indices\n\n    Examples\n    --------\n    Get the frame numbers for every 100ms\n\n    >>> librosa.Func(np.arange(0, 1, 0.1),\n    ...                         sr=22050, hop_length=512)\n    array([ 0,  4,  8, 12, 17, 21, 25, 30, 34, 38])\n\n    \"\"\"\n\n    arg_4 = time_to_samples(arg_0, arg_1=arg_1)\n\n    return samples_to_frames(arg_4, arg_2=arg_2, arg_3=arg_3)", "path": "librosa/core/time_frequency.py", "identifier": "time_to_frames", "docstring": "Converts time stamps into STFT frames.\n\n    Parameters\n    ----------\n    times : np.ndarray [shape=(n,)]\n        time (in seconds) or vector of time values\n\n    sr : number > 0 [scalar]\n        audio sampling rate\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    n_fft : None or int > 0 [scalar]\n        Optional: length of the FFT window.\n        If given, time conversion will include an offset of `- n_fft / 2`\n        to counteract windowing effects in STFT.\n\n        .. note:: This may result in negative frame indices.\n\n    Returns\n    -------\n    frames : np.ndarray [shape=(n,), dtype=int]\n        Frame numbers corresponding to the given times:\n        `frames[i] = floor( times[i] * sr / hop_length )`\n\n    See Also\n    --------\n    frames_to_time : convert frame indices to time values\n    time_to_samples : convert time values to sample indices\n\n    Examples\n    --------\n    Get the frame numbers for every 100ms\n\n    >>> librosa.time_to_frames(np.arange(0, 1, 0.1),\n    ...                         sr=22050, hop_length=512)\n    array([ 0,  4,  8, 12, 17, 21, 25, 30, 34, 38])", "docstring_tokens": ["Converts", "time", "stamps", "into", "STFT", "frames", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258456}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/admin.py#L34-L39", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Returns a URL for a given Tree admin page type.", "language": "python", "parameters": "(model_nfo, page, with_namespace=False)", "return_statement": "return ('%s%s_%s' % (prefix, '%s_%s' % model_nfo, page)).lower()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "''", "if", "arg_2", ":", "arg_3", "=", "'admin:'", "return", "(", "'%s%s_%s'", "%", "(", "arg_3", ",", "'%s_%s'", "%", "arg_0", ",", "arg_1", ")", ")", ".", "lower", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"Returns a URL for a given Tree admin page type.\"\"\"\n    arg_3 = ''\n    if arg_2:\n        arg_3 = 'admin:'\n    return ('%s%s_%s' % (arg_3, '%s_%s' % arg_0, arg_1)).lower()", "path": "sitetree/admin.py", "identifier": "get_model_url_name", "docstring": "Returns a URL for a given Tree admin page type.", "docstring_tokens": ["Returns", "a", "URL", "for", "a", "given", "Tree", "admin", "page", "type", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 258457}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L528-L534", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Called to create the control, which must derive from wxControl.", "language": "python", "parameters": "(self, parent, id, evtHandler)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "_tc", "=", "wx", ".", "ComboBox", "(", "arg_1", ",", "arg_2", ",", "\"\"", ",", "(", "100", ",", "50", ")", ")", "arg_0", ".", "SetControl", "(", "arg_0", ".", "_tc", ")", "arg_0", ".", "_tc", ".", "PushEventHandler", "(", "wx", ".", "EvtHandler", "(", ")", ")", "arg_0", ".", "_tc", ".", "Bind", "(", "wx", ".", "EVT_COMBOBOX", ",", "arg_0", ".", "OnChange", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\r\n        \"Called to create the control, which must derive from wxControl.\"        \r\n        arg_0._tc = wx.ComboBox(arg_1, arg_2, \"\", (100, 50))\r\n        arg_0.SetControl(arg_0._tc)\r\n        # pushing a different event handler instead evtHandler:\r\n        arg_0._tc.PushEventHandler(wx.EvtHandler())\r\n        arg_0._tc.Bind(wx.EVT_COMBOBOX, arg_0.OnChange)", "path": "gui/controls/gridview.py", "identifier": "ComboCellEditor.Create", "docstring": "Called to create the control, which must derive from wxControl.", "docstring_tokens": ["Called", "to", "create", "the", "control", "which", "must", "derive", "from", "wxControl", "."], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 258458}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/psflib.py#L120-L129", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Return an hash string computed on the PSF data.", "language": "python", "parameters": "(self)", "return_statement": "return hashlib.md5(repr(hash_list).encode()).hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", "in", "sorted", "(", "arg_0", ".", "__dict__", ".", "items", "(", ")", ")", ":", "if", "not", "callable", "(", "arg_3", ")", ":", "if", "isinstance", "(", "arg_3", ",", "np", ".", "ndarray", ")", ":", "arg_1", ".", "append", "(", "arg_3", ".", "tostring", "(", ")", ")", "else", ":", "arg_1", ".", "append", "(", "str", "(", "arg_3", ")", ")", "return", "Funclib", ".", "md5", "(", "repr", "(", "arg_1", ")", ".", "encode", "(", ")", ")", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Return an Func string computed on the PSF data.\"\"\"\n        arg_1 = []\n        for arg_2, arg_3 in sorted(arg_0.__dict__.items()):\n            if not callable(arg_3):\n                if isinstance(arg_3, np.ndarray):\n                    arg_1.append(arg_3.tostring())\n                else:\n                    arg_1.append(str(arg_3))\n        return Funclib.md5(repr(arg_1).encode()).hexdigest()", "path": "pybromo/psflib.py", "identifier": "NumericPSF.hash", "docstring": "Return an hash string computed on the PSF data.", "docstring_tokens": ["Return", "an", "hash", "string", "computed", "on", "the", "PSF", "data", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 258459}
{"url": "https://github.com/edx/edx-search/blob/476cf02b71ceba34ae7d8b798f36d60692317c55/search/elastic.py#L145-L169", "sha": "476cf02b71ceba34ae7d8b798f36d60692317c55", "docstring_summary": "Based on values in the exclude_dictionary generate a list of term queries that\n    will filter out unwanted results.", "language": "python", "parameters": "(exclude_dictionary)", "return_statement": "return {\n        \"not\": {\n            \"filter\": {\n                \"or\": not_properties\n            }\n        }\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "arg_0", "[", "arg_2", "]", "if", "not", "isinstance", "(", "arg_3", ",", "list", ")", ":", "arg_3", "=", "[", "arg_3", "]", "arg_1", ".", "extend", "(", "[", "{", "\"term\"", ":", "{", "arg_2", ":", "arg_4", "}", "}", "for", "arg_4", "in", "arg_3", "]", ")", "if", "not", "arg_1", ":", "return", "{", "}", "return", "{", "\"not\"", ":", "{", "\"filter\"", ":", "{", "\"or\"", ":", "arg_1", "}", "}", "}"], "function": "def Func(arg_0):\n    \"\"\"\n    Based on values in the exclude_dictionary generate a list of term queries that\n    will filter out unwanted results.\n    \"\"\"\n    # not_properties will hold the generated term queries.\n    arg_1 = []\n    for arg_2 in arg_0:\n        arg_3 = arg_0[arg_2]\n        if not isinstance(arg_3, list):\n            arg_3 = [arg_3]\n        arg_1.extend([{\"term\": {arg_2: arg_4}} for arg_4 in arg_3])\n\n    # Returning a query segment with an empty list freaks out ElasticSearch,\n    #   so just return an empty segment.\n    if not arg_1:\n        return {}\n\n    return {\n        \"not\": {\n            \"filter\": {\n                \"or\": arg_1\n            }\n        }\n    }", "path": "search/elastic.py", "identifier": "_process_exclude_dictionary", "docstring": "Based on values in the exclude_dictionary generate a list of term queries that\n    will filter out unwanted results.", "docstring_tokens": ["Based", "on", "values", "in", "the", "exclude_dictionary", "generate", "a", "list", "of", "term", "queries", "that", "will", "filter", "out", "unwanted", "results", "."], "nwo": "edx/edx-search", "score": 0.5271177144519781, "idx": 258460}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/reaction.py#L60-L136", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Assesses the ability of the model to provide sufficient precursors,\n    or absorb products, for a reaction operating at, or beyond,\n    the specified cutoff.", "language": "python", "parameters": "(model, reaction, side, flux_coefficient_cutoff=0.001,\n                     solver=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "0.001", ",", "arg_4", "=", "None", ")", ":", "arg_1", "=", "arg_0", ".", "reactions", ".", "get_by_any", "(", "arg_1", ")", "[", "0", "]", "arg_5", "=", "dict", "(", "reactants", "=", "'produced'", ",", "products", "=", "'capacity'", ")", "[", "arg_2", "]", "arg_6", "=", "attrgetter", "(", "arg_2", ")", "with", "arg_0", "as", "arg_7", ":", "arg_7", ".", "objective", "=", "arg_1", "if", "_optimize_or_value", "(", "arg_7", ",", "arg_4", "=", "arg_4", ")", ">=", "arg_3", ":", "return", "True", "arg_9", "=", "{", "}", "arg_10", "=", "{", "}", "for", "arg_11", "in", "arg_6", "(", "arg_1", ")", ":", "arg_12", "=", "arg_1", ".", "metabolites", "[", "arg_11", "]", "arg_13", "=", "arg_7", ".", "add_boundary", "(", "arg_11", ",", "type", "=", "'demand'", ")", "arg_13", ".", "metabolites", "[", "arg_11", "]", "=", "arg_12", "arg_10", "[", "arg_13", "]", "=", "(", "arg_11", ",", "arg_12", ")", "arg_15", "=", "Reaction", "(", "\"joint_demand\"", ")", "for", "arg_16", "in", "arg_10", ":", "arg_15", "+=", "arg_16", "arg_7", ".", "add_reactions", "(", "[", "arg_15", "]", ")", "arg_7", ".", "objective", "=", "arg_15", "if", "_optimize_or_value", "(", "arg_7", ",", "arg_4", "=", "arg_4", ")", ">=", "arg_3", ":", "return", "True", "for", "arg_16", ",", "(", "arg_11", ",", "arg_12", ")", "in", "iteritems", "(", "arg_10", ")", ":", "with", "arg_7", ":", "arg_7", ".", "objective", "=", "arg_16", "arg_17", "=", "_optimize_or_value", "(", "arg_7", ",", "arg_4", "=", "arg_4", ")", "if", "arg_3", ">", "arg_17", ":", "arg_9", ".", "update", "(", "{", "arg_11", ":", "{", "'required'", ":", "arg_3", "/", "abs", "(", "arg_12", ")", ",", "arg_5", ":", "arg_17", "/", "abs", "(", "arg_12", ")", "}", "}", ")", "if", "len", "(", "arg_9", ")", "==", "0", ":", "arg_9", "=", "False", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=0.001,\n                     arg_4=None):\n    \"\"\"Assesses the ability of the model to provide sufficient precursors,\n    or absorb products, for a reaction operating at, or beyond,\n    the specified cutoff.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to assess production capacity for\n\n    reaction : reaction identifier or cobra.Reaction\n        The reaction to assess\n\n    side : basestring\n        Side of the reaction, 'products' or 'reactants'\n\n    flux_coefficient_cutoff :  float\n        The minimum flux that reaction must carry to be considered active.\n\n    solver : basestring\n        Solver name. If None, the default solver will be used.\n\n    Returns\n    -------\n    bool or dict\n        True if the precursors can be simultaneously produced at the\n        specified cutoff. False, if the model has the capacity to produce\n        each individual precursor at the specified threshold  but not all\n        precursors at the required level simultaneously. Otherwise a\n        dictionary of the required and the produced fluxes for each reactant\n        that is not produced in sufficient quantities.\n\n    \"\"\"\n    arg_1 = arg_0.reactions.get_by_any(arg_1)[0]\n    arg_5 = dict(reactants='produced', products='capacity')[arg_2]\n    arg_6 = attrgetter(arg_2)\n    with arg_0 as arg_7:\n        arg_7.objective = arg_1\n        if _optimize_or_value(arg_7, arg_4=arg_4) >= arg_3:\n            return True\n        arg_9 = {}\n        # build the demand reactions and add all at once\n        arg_10 = {}\n        for arg_11 in arg_6(arg_1):\n            arg_12 = arg_1.metabolites[arg_11]\n            arg_13 = arg_7.add_boundary(arg_11, type='demand')\n            arg_13.metabolites[arg_11] = arg_12\n            arg_10[arg_13] = (arg_11, arg_12)\n        # First assess whether all precursors can be produced simultaneously\n        arg_15 = Reaction(\"joint_demand\")\n        for arg_16 in arg_10:\n            arg_15 += arg_16\n        arg_7.add_reactions([arg_15])\n        arg_7.objective = arg_15\n        if _optimize_or_value(arg_7, arg_4=arg_4) >= arg_3:\n            return True\n\n        # Otherwise assess the ability of the model to produce each precursor\n        # individually.  Now assess the ability of the model to produce each\n        # reactant for a reaction\n        for arg_16, (arg_11, arg_12) in iteritems(arg_10):\n            # Calculate the maximum amount of the\n            with arg_7:\n                arg_7.objective = arg_16\n                arg_17 = _optimize_or_value(arg_7, arg_4=arg_4)\n            # metabolite that can be produced.\n            if arg_3 > arg_17:\n                # Scale the results to a single unit\n                arg_9.update({\n                    arg_11: {\n                        'required': arg_3 / abs(arg_12),\n                        arg_5: arg_17 / abs(arg_12)\n                    }})\n        if len(arg_9) == 0:\n            arg_9 = False\n        return arg_9", "path": "cobra/flux_analysis/reaction.py", "identifier": "assess_component", "docstring": "Assesses the ability of the model to provide sufficient precursors,\n    or absorb products, for a reaction operating at, or beyond,\n    the specified cutoff.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The cobra model to assess production capacity for\n\n    reaction : reaction identifier or cobra.Reaction\n        The reaction to assess\n\n    side : basestring\n        Side of the reaction, 'products' or 'reactants'\n\n    flux_coefficient_cutoff :  float\n        The minimum flux that reaction must carry to be considered active.\n\n    solver : basestring\n        Solver name. If None, the default solver will be used.\n\n    Returns\n    -------\n    bool or dict\n        True if the precursors can be simultaneously produced at the\n        specified cutoff. False, if the model has the capacity to produce\n        each individual precursor at the specified threshold  but not all\n        precursors at the required level simultaneously. Otherwise a\n        dictionary of the required and the produced fluxes for each reactant\n        that is not produced in sufficient quantities.", "docstring_tokens": ["Assesses", "the", "ability", "of", "the", "model", "to", "provide", "sufficient", "precursors", "or", "absorb", "products", "for", "a", "reaction", "operating", "at", "or", "beyond", "the", "specified", "cutoff", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 258461}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L838-L876", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Reconstruct a matrix through linear inversion.", "language": "python", "parameters": "(freqs, ops, weights=None, trace=None)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_4", "=", "np", ".", "array", "(", "arg_2", ")", "if", "arg_4", ".", "ndim", "==", "1", ":", "arg_4", "=", "np", ".", "diag", "(", "arg_4", ")", "arg_5", "=", "np", ".", "array", "(", "[", "vectorize", "(", "m", ")", ".", "conj", "(", ")", "for", "m", "in", "arg_1", "]", ")", ".", "reshape", "(", "len", "(", "arg_1", ")", ",", "arg_1", "[", "0", "]", ".", "size", ")", "if", "arg_2", "is", "not", "None", ":", "arg_5", "=", "np", ".", "dot", "(", "arg_4", ",", "arg_5", ")", "arg_6", "=", "np", ".", "array", "(", "arg_0", ")", "if", "arg_2", "is", "not", "None", ":", "arg_6", "=", "np", ".", "dot", "(", "arg_4", ",", "arg_0", ")", "arg_7", "=", "arg_5", ".", "T", ".", "conj", "(", ")", "arg_8", "=", "np", ".", "linalg", ".", "pinv", "(", "np", ".", "dot", "(", "arg_7", ",", "arg_5", ")", ")", "arg_9", "=", "devectorize", "(", "np", ".", "dot", "(", "arg_8", ",", "np", ".", "dot", "(", "arg_7", ",", "arg_6", ")", ")", ")", "if", "arg_3", "is", "not", "None", ":", "arg_9", "=", "arg_3", "*", "arg_9", "/", "np", ".", "trace", "(", "arg_9", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    Reconstruct a matrix through linear inversion.\n\n    Args:\n        freqs (list[float]): list of observed frequences.\n        ops (list[np.array]): list of corresponding projectors.\n        weights (list[float] or array_like):\n            weights to be used for weighted fitting.\n        trace (float or None): trace of returned operator.\n\n    Returns:\n        numpy.array: A numpy array of the reconstructed operator.\n    \"\"\"\n    # get weights matrix\n    if arg_2 is not None:\n        arg_4 = np.array(arg_2)\n        if arg_4.ndim == 1:\n            arg_4 = np.diag(arg_4)\n\n    # Get basis S matrix\n    arg_5 = np.array([vectorize(m).conj()\n                  for m in arg_1]).reshape(len(arg_1), arg_1[0].size)\n    if arg_2 is not None:\n        arg_5 = np.dot(arg_4, arg_5)  # W.S\n\n    # get frequencies vec\n    arg_6 = np.array(arg_0)  # |f>\n    if arg_2 is not None:\n        arg_6 = np.dot(arg_4, arg_0)  # W.|f>\n    arg_7 = arg_5.T.conj()  # S^*.W^*\n    arg_8 = np.linalg.pinv(np.dot(arg_7, arg_5))  # (S^*.W^*.W.S)^-1\n\n    # linear inversion of freqs\n    arg_9 = devectorize(np.dot(arg_8, np.dot(arg_7, arg_6)))\n    # renormalize to input trace value\n    if arg_3 is not None:\n        arg_9 = arg_3 * arg_9 / np.trace(arg_9)\n    return arg_9", "path": "qiskit/tools/qcvv/tomography.py", "identifier": "__tomo_linear_inv", "docstring": "Reconstruct a matrix through linear inversion.\n\n    Args:\n        freqs (list[float]): list of observed frequences.\n        ops (list[np.array]): list of corresponding projectors.\n        weights (list[float] or array_like):\n            weights to be used for weighted fitting.\n        trace (float or None): trace of returned operator.\n\n    Returns:\n        numpy.array: A numpy array of the reconstructed operator.", "docstring_tokens": ["Reconstruct", "a", "matrix", "through", "linear", "inversion", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258462}
{"url": "https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/signing_service.py#L321-L343", "sha": "d30107be02521fa6cdfe285da3b6b0cdd153c8cc", "docstring_summary": "Given configuration initiate a SigningService instance", "language": "python", "parameters": "(config, entity_id)", "return_statement": "return signer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", "[", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "arg_0", ".", "items", "(", ")", "if", "k", "in", "KJ_SPECS", "]", ")", "arg_3", "=", "init_key_jar", "(", "**", "arg_2", ")", "if", "arg_0", "[", "'type'", "]", "==", "'internal'", ":", "arg_4", "=", "InternalSigningService", "(", "arg_1", ",", "arg_3", ")", "elif", "arg_0", "[", "'type'", "]", "==", "'web'", ":", "arg_3", ".", "issuer_keys", "[", "arg_0", "[", "'iss'", "]", "]", "=", "arg_3", ".", "issuer_keys", "[", "''", "]", "del", "arg_3", ".", "issuer_keys", "[", "''", "]", "arg_4", "=", "WebSigningServiceClient", "(", "arg_0", "[", "'iss'", "]", ",", "arg_0", "[", "'url'", "]", ",", "arg_1", ",", "arg_3", ")", "else", ":", "raise", "ValueError", "(", "'Unknown signer type: {}'", ".", "format", "(", "arg_0", "[", "'type'", "]", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Given configuration initiate a SigningService instance\n\n    :param config: The signing service configuration\n    :param entity_id: The entity identifier\n    :return: A SigningService instance\n    \"\"\"\n\n    arg_2 = dict([(k, v) for k, v in arg_0.items() if k in KJ_SPECS])\n    arg_3 = init_key_jar(**arg_2)\n\n    if arg_0['type'] == 'internal':\n        arg_4 = InternalSigningService(arg_1, arg_3)\n    elif arg_0['type'] == 'web':\n        arg_3.issuer_keys[arg_0['iss']] = arg_3.issuer_keys['']\n        del arg_3.issuer_keys['']\n        arg_4 = WebSigningServiceClient(arg_0['iss'], arg_0['url'],\n                                         arg_1, arg_3)\n    else:\n        raise ValueError('Unknown signer type: {}'.format(arg_0['type']))\n\n    return arg_4", "path": "src/fedoidcmsg/signing_service.py", "identifier": "make_signing_service", "docstring": "Given configuration initiate a SigningService instance\n\n    :param config: The signing service configuration\n    :param entity_id: The entity identifier\n    :return: A SigningService instance", "docstring_tokens": ["Given", "configuration", "initiate", "a", "SigningService", "instance"], "nwo": "IdentityPython/fedoidcmsg", "score": 0.09252797783733271, "idx": 258463}
{"url": "https://github.com/isambard-uob/budeff/blob/8be099b7e50d4855ad3cc4aa875938da2c9449e6/src/budeff/__init__.py#L50-L77", "sha": "8be099b7e50d4855ad3cc4aa875938da2c9449e6", "docstring_summary": "Calculates the internal energy of the AMPAL object.", "language": "python", "parameters": "(ampal_obj, ff=None, assign_ff=True)", "return_statement": "return buff_score", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "FORCE_FIELDS", "[", "'bude_2016v1'", "]", "if", "arg_2", ":", "assign_force_field", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "find_intra_ampal", "(", "arg_0", ",", "arg_1", ".", "distance_cutoff", ")", "arg_4", "=", "score_interactions", "(", "arg_3", ",", "arg_1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=True):\n    \"\"\"Calculates the internal energy of the AMPAL object.\n\n    Parameters\n    ----------\n    ampal_obj: AMPAL Object\n        Any AMPAL object with a `get_atoms` method.\n    ff: BuffForceField, optional\n        The force field to be used for scoring. If no force field is\n        provided then the most current version of the BUDE force field\n        will be used.\n    assign_ff: bool, optional\n        If true, then force field assignment on the AMPAL object will be\n        will be updated.\n\n    Returns\n    -------\n    BUFF_score: BUFFScore\n        A BUFFScore object with information about each of the interactions and\n        the atoms involved.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = FORCE_FIELDS['bude_2016v1']\n    if arg_2:\n        assign_force_field(arg_0, arg_1)\n    arg_3 = find_intra_ampal(arg_0, arg_1.distance_cutoff)\n    arg_4 = score_interactions(arg_3, arg_1)\n    return arg_4", "path": "src/budeff/__init__.py", "identifier": "get_internal_energy", "docstring": "Calculates the internal energy of the AMPAL object.\n\n    Parameters\n    ----------\n    ampal_obj: AMPAL Object\n        Any AMPAL object with a `get_atoms` method.\n    ff: BuffForceField, optional\n        The force field to be used for scoring. If no force field is\n        provided then the most current version of the BUDE force field\n        will be used.\n    assign_ff: bool, optional\n        If true, then force field assignment on the AMPAL object will be\n        will be updated.\n\n    Returns\n    -------\n    BUFF_score: BUFFScore\n        A BUFFScore object with information about each of the interactions and\n        the atoms involved.", "docstring_tokens": ["Calculates", "the", "internal", "energy", "of", "the", "AMPAL", "object", "."], "nwo": "isambard-uob/budeff", "score": 0.138843686048881, "idx": 258464}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/image.py#L8-L17", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Show an image.", "language": "python", "parameters": "(img, win_name='', wait_time=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "0", ")", ":", "cv2", ".", "Func", "(", "arg_1", ",", "imread", "(", "arg_0", ")", ")", "cv2", ".", "waitKey", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1='', arg_2=0):\n    \"\"\"Show an image.\n\n    Args:\n        img (str or ndarray): The image to be displayed.\n        win_name (str): The window name.\n        wait_time (int): Value of waitKey param.\n    \"\"\"\n    cv2.Func(arg_1, imread(arg_0))\n    cv2.waitKey(arg_2)", "path": "mmcv/visualization/image.py", "identifier": "imshow", "docstring": "Show an image.\n\n    Args:\n        img (str or ndarray): The image to be displayed.\n        win_name (str): The window name.\n        wait_time (int): Value of waitKey param.", "docstring_tokens": ["Show", "an", "image", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 258465}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/apps.py#L63-L67", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Creates a remote app only.", "language": "python", "parameters": "(self, oauth, **kwargs)", "return_statement": "return oauth.remote_app(**kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", "=", "arg_0", ".", "_process_kwargs", "(", "name", "=", "arg_0", ".", "default_name", ",", "register", "=", "False", ",", "**", "arg_2", ")", "return", "arg_1", ".", "remote_app", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Creates a remote app only.\"\"\"\n        arg_2 = arg_0._process_kwargs(\n            name=arg_0.default_name, register=False, **arg_2)\n        return arg_1.remote_app(**arg_2)", "path": "flask_oauthlib/contrib/apps.py", "identifier": "RemoteAppFactory.create", "docstring": "Creates a remote app only.", "docstring_tokens": ["Creates", "a", "remote", "app", "only", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 258466}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/docs/sphinxext/numpydoc/comment_eater.py#L75-L84", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Process a file object.", "language": "python", "parameters": "(self, file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", ">=", "3", ":", "arg_2", "=", "arg_1", ".", "__next__", "else", ":", "arg_2", "=", "arg_1", ".", "next", "for", "arg_3", "in", "tokenize", ".", "generate_tokens", "(", "arg_2", ")", ":", "arg_0", ".", "process_token", "(", "*", "arg_3", ")", "arg_0", ".", "make_index", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Process a file object.\n        \"\"\"\n        if sys.version_info[0] >= 3:\n            arg_2 = arg_1.__next__\n        else:\n            arg_2 = arg_1.next\n        for arg_3 in tokenize.generate_tokens(arg_2):\n            arg_0.process_token(*arg_3)\n        arg_0.make_index()", "path": "docs/sphinxext/numpydoc/comment_eater.py", "identifier": "CommentBlocker.process_file", "docstring": "Process a file object.", "docstring_tokens": ["Process", "a", "file", "object", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 258467}
{"url": "https://github.com/zvoase/django-relax/blob/10bb37bf3a512b290816856a6877c17fa37e930f/relax/viewserver.py#L16-L24", "sha": "10bb37bf3a512b290816856a6877c17fa37e930f", "docstring_summary": "Given a Python function name, return the function it refers to.", "language": "python", "parameters": "(function_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "str", "(", "arg_0", ")", ".", "rsplit", "(", "'.'", ",", "1", ")", "try", ":", "return", "getattr", "(", "__import__", "(", "arg_1", ",", "fromlist", "=", "[", "arg_2", "]", ")", ",", "arg_2", ")", "except", "(", "ImportError", ",", "AttributeError", ")", ":", "raise", "FunctionNotFound", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Given a Python function name, return the function it refers to.\n    \"\"\"\n    arg_1, arg_2 = str(arg_0).rsplit('.', 1)\n    try:\n        return getattr(__import__(arg_1, fromlist=[arg_2]), arg_2)\n    except (ImportError, AttributeError):\n        raise FunctionNotFound(arg_0)", "path": "relax/viewserver.py", "identifier": "get_function", "docstring": "Given a Python function name, return the function it refers to.", "docstring_tokens": ["Given", "a", "Python", "function", "name", "return", "the", "function", "it", "refers", "to", "."], "nwo": "zvoase/django-relax", "score": 0.0, "idx": 258468}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/experiment_utils.py#L66-L78", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns True if the inference from this timestep is predicted the input\n    for the NEXT timestep.", "language": "python", "parameters": "(inferenceElement)", "return_statement": "return inferenceElement in InferenceElement.__temporalInferenceElements", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_1", ".", "__temporalInferenceElements", "is", "None", ":", "arg_1", ".", "__temporalInferenceElements", "=", "set", "(", "[", "arg_1", ".", "prediction", "]", ")", "return", "arg_0", "in", "arg_1", ".", "__temporalInferenceElements"], "function": "def Func(arg_0):\n    \"\"\" Returns True if the inference from this timestep is predicted the input\n    for the NEXT timestep.\n\n    NOTE: This should only be checked IF THE MODEL'S INFERENCE TYPE IS ALSO\n    TEMPORAL. That is, a temporal model CAN have non-temporal inference elements,\n    but a non-temporal model CANNOT have temporal inference elements\n    \"\"\"\n    if arg_1.__temporalInferenceElements is None:\n      arg_1.__temporalInferenceElements = \\\n                                set([arg_1.prediction])\n\n    return arg_0 in arg_1.__temporalInferenceElements", "path": "src/nupic/swarming/experiment_utils.py", "identifier": "InferenceElement.isTemporal", "docstring": "Returns True if the inference from this timestep is predicted the input\n    for the NEXT timestep.\n\n    NOTE: This should only be checked IF THE MODEL'S INFERENCE TYPE IS ALSO\n    TEMPORAL. That is, a temporal model CAN have non-temporal inference elements,\n    but a non-temporal model CANNOT have temporal inference elements", "docstring_tokens": ["Returns", "True", "if", "the", "inference", "from", "this", "timestep", "is", "predicted", "the", "input", "for", "the", "NEXT", "timestep", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258469}
{"url": "https://github.com/dave-shawley/ietfparse/blob/d28f360941316e45c1596589fa59bc7d25aa20e0/ietfparse/algorithms.py#L60-L68", "sha": "d28f360941316e45c1596589fa59bc7d25aa20e0", "docstring_summary": "Is ``candidate`` an exact match or sub-type of ``pattern``?", "language": "python", "parameters": "(candidate, pattern)", "return_statement": "return (\n        _wildcard_compare(candidate.content_type, pattern.content_type) and\n        _wildcard_compare(candidate.content_subtype, pattern.content_subtype)\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "_wildcard_compare", "(", "arg_2", ",", "arg_3", ")", ":", "return", "arg_3", "==", "'*'", "or", "arg_2", "==", "arg_3", "return", "(", "_wildcard_compare", "(", "arg_0", ".", "content_type", ",", "arg_1", ".", "content_type", ")", "and", "_wildcard_compare", "(", "arg_0", ".", "content_subtype", ",", "arg_1", ".", "content_subtype", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Is ``candidate`` an exact match or sub-type of ``pattern``?\"\"\"\n    def _wildcard_compare(arg_2, arg_3):\n        return arg_3 == '*' or arg_2 == arg_3\n\n    return (\n        _wildcard_compare(arg_0.content_type, arg_1.content_type) and\n        _wildcard_compare(arg_0.content_subtype, arg_1.content_subtype)\n    )", "path": "ietfparse/algorithms.py", "identifier": "_content_type_matches", "docstring": "Is ``candidate`` an exact match or sub-type of ``pattern``?", "docstring_tokens": ["Is", "candidate", "an", "exact", "match", "or", "sub", "-", "type", "of", "pattern", "?"], "nwo": "dave-shawley/ietfparse", "score": 0.23137166388621372, "idx": 258470}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2325-L2345", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get a list of variable names from the user's namespace.", "language": "python", "parameters": "(self, names)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "arg_0", ".", "user_ns", "for", "arg_4", "in", "arg_1", ":", "try", ":", "arg_5", "=", "repr", "(", "arg_3", "[", "arg_4", "]", ")", "except", ":", "arg_5", "=", "arg_0", ".", "_simple_error", "(", ")", "arg_2", "[", "arg_4", "]", "=", "arg_5", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get a list of variable names from the user's namespace.\n\n        Parameters\n        ----------\n        names : list of strings\n          A list of names of variables to be read from the user namespace.\n\n        Returns\n        -------\n        A dict, keyed by the input names and with the repr() of each value.\n        \"\"\"\n        arg_2 = {}\n        arg_3 = arg_0.user_ns\n        for arg_4 in arg_1:\n            try:\n                arg_5 = repr(arg_3[arg_4])\n            except:\n                arg_5 = arg_0._simple_error()\n            arg_2[arg_4] = arg_5\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.user_variables", "docstring": "Get a list of variable names from the user's namespace.\n\n        Parameters\n        ----------\n        names : list of strings\n          A list of names of variables to be read from the user namespace.\n\n        Returns\n        -------\n        A dict, keyed by the input names and with the repr() of each value.", "docstring_tokens": ["Get", "a", "list", "of", "variable", "names", "from", "the", "user", "s", "namespace", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258471}
{"url": "https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L38-L60", "sha": "9d0e8ebcba31d937f73752f9b88e5a4fec860765", "docstring_summary": "Return None if key is not in the bucket set.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return key, None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_1", "[", "1", "]", "is", "not", "None", "and", "'force'", "in", "arg_1", "[", "1", "]", ":", "arg_3", ",", "arg_4", "=", "super", "(", "Bucket", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "if", "arg_3", ":", "mimicdb", ".", "backend", ".", "sadd", "(", "tpl", ".", "bucket", "%", "arg_0", ".", "name", ",", "arg_3", ".", "name", ")", "mimicdb", ".", "backend", ".", "hmset", "(", "tpl", ".", "key", "%", "(", "arg_0", ".", "name", ",", "arg_3", ".", "name", ")", ",", "dict", "(", "size", "=", "arg_3", ".", "size", ",", "md5", "=", "arg_3", ".", "etag", ".", "strip", "(", "'\"'", ")", ")", ")", "return", "arg_3", ",", "arg_4", "arg_3", "=", "None", "if", "mimicdb", ".", "backend", ".", "sismember", "(", "tpl", ".", "bucket", "%", "arg_0", ".", "name", ",", "arg_1", "[", "0", "]", ")", ":", "arg_3", "=", "Key", "(", "arg_0", ")", "arg_3", ".", "name", "=", "arg_1", "[", "0", "]", "return", "arg_3", ",", "None"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Return None if key is not in the bucket set.\n\n        Pass 'force' in the headers to check S3 for the key, and after fetching\n        the key from S3, save the metadata and key to the bucket set.\n        \"\"\"\n        if arg_1[1] is not None and 'force' in arg_1[1]:\n            arg_3, arg_4 = super(Bucket, arg_0).Func(*arg_1, **arg_2)\n\n            if arg_3:\n                mimicdb.backend.sadd(tpl.bucket % arg_0.name, arg_3.name)\n                mimicdb.backend.hmset(tpl.key % (arg_0.name, arg_3.name),\n                                    dict(size=arg_3.size,\n                                         md5=arg_3.etag.strip('\"')))\n            return arg_3, arg_4\n\n        arg_3 = None\n\n        if mimicdb.backend.sismember(tpl.bucket % arg_0.name, arg_1[0]):\n            arg_3 = Key(arg_0)\n            arg_3.name = arg_1[0]\n\n        return arg_3, None", "path": "mimicdb/s3/bucket.py", "identifier": "Bucket._get_key_internal", "docstring": "Return None if key is not in the bucket set.\n\n        Pass 'force' in the headers to check S3 for the key, and after fetching\n        the key from S3, save the metadata and key to the bucket set.", "docstring_tokens": ["Return", "None", "if", "key", "is", "not", "in", "the", "bucket", "set", "."], "nwo": "nathancahill/mimicdb", "score": 0.18112697196067942, "idx": 258472}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L657-L714", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This deletes a message from the queue, effectively acknowledging its\n    receipt.", "language": "python", "parameters": "(queue_url,\n                    receipt_handle,\n                    client=None,\n                    raiseonfail=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "boto3", ".", "client", "(", "'sqs'", ")", "try", ":", "arg_2", ".", "delete_message", "(", "QueueUrl", "=", "arg_0", ",", "ReceiptHandle", "=", "arg_1", ")", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'could not delete message with receipt handle: '", "'%s from queue: %s'", "%", "(", "arg_1", ",", "arg_0", ")", ")", "if", "arg_3", ":", "raise"], "function": "def Func(arg_0,\n                    arg_1,\n                    arg_2=None,\n                    arg_3=False):\n    \"\"\"This deletes a message from the queue, effectively acknowledging its\n    receipt.\n\n    Call this only when all messages retrieved from the queue have been\n    processed, since this will prevent redelivery of these messages to other\n    queue workers pulling fromn the same queue channel.\n\n    Parameters\n    ----------\n\n    queue_url : str\n        The SQS URL of the queue where we got the messages from. This should be\n        the same queue used to retrieve the messages in `sqs_get_item`.\n\n    receipt_handle : str\n        The receipt handle of the queue message that we're responding to, and\n        will acknowledge receipt of. This will be present in each message\n        retrieved using `sqs_get_item`.\n\n    client : boto3.Client or None\n        If None, this function will instantiate a new `boto3.Client` object to\n        use in its operations. Alternatively, pass in an existing `boto3.Client`\n        instance to re-use it here.\n\n    raiseonfail : bool\n        If True, will re-raise whatever Exception caused the operation to fail\n        and break out immediately.\n\n    Returns\n    -------\n\n    Nothing.\n\n    \"\"\"\n\n    if not arg_2:\n        arg_2 = boto3.client('sqs')\n\n    try:\n\n        arg_2.delete_message(\n            QueueUrl=arg_0,\n            ReceiptHandle=arg_1\n        )\n\n    except Exception as e:\n\n        LOGEXCEPTION(\n            'could not delete message with receipt handle: '\n            '%s from queue: %s' % (arg_1, arg_0)\n        )\n\n        if arg_3:\n            raise", "path": "astrobase/awsutils.py", "identifier": "sqs_delete_item", "docstring": "This deletes a message from the queue, effectively acknowledging its\n    receipt.\n\n    Call this only when all messages retrieved from the queue have been\n    processed, since this will prevent redelivery of these messages to other\n    queue workers pulling fromn the same queue channel.\n\n    Parameters\n    ----------\n\n    queue_url : str\n        The SQS URL of the queue where we got the messages from. This should be\n        the same queue used to retrieve the messages in `sqs_get_item`.\n\n    receipt_handle : str\n        The receipt handle of the queue message that we're responding to, and\n        will acknowledge receipt of. This will be present in each message\n        retrieved using `sqs_get_item`.\n\n    client : boto3.Client or None\n        If None, this function will instantiate a new `boto3.Client` object to\n        use in its operations. Alternatively, pass in an existing `boto3.Client`\n        instance to re-use it here.\n\n    raiseonfail : bool\n        If True, will re-raise whatever Exception caused the operation to fail\n        and break out immediately.\n\n    Returns\n    -------\n\n    Nothing.", "docstring_tokens": ["This", "deletes", "a", "message", "from", "the", "queue", "effectively", "acknowledging", "its", "receipt", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258473}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/tpa_pipeline.py#L24-L31", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get the EnterpriseCustomer associated with a running pipeline.", "language": "python", "parameters": "(request, pipeline)", "return_statement": "return get_enterprise_customer_for_sso(sso_provider_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "GET", ".", "get", "(", "'tpa_hint'", ")", "if", "arg_1", ":", "arg_2", "=", "Registry", ".", "get_from_pipeline", "(", "arg_1", ")", ".", "provider_id", "return", "get_enterprise_customer_for_sso", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):  # pylint: disable=invalid-name\n    \"\"\"\n    Get the EnterpriseCustomer associated with a running pipeline.\n    \"\"\"\n    arg_2 = arg_0.GET.get('tpa_hint')\n    if arg_1:\n        arg_2 = Registry.get_from_pipeline(arg_1).provider_id\n    return get_enterprise_customer_for_sso(arg_2)", "path": "enterprise/tpa_pipeline.py", "identifier": "get_enterprise_customer_for_running_pipeline", "docstring": "Get the EnterpriseCustomer associated with a running pipeline.", "docstring_tokens": ["Get", "the", "EnterpriseCustomer", "associated", "with", "a", "running", "pipeline", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258474}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L421-L447", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Get siblings of a browsed subreference", "language": "python", "parameters": "(self, objectId, subreference, passage)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "reff", "for", "reff", ",", "_", "in", "arg_0", ".", "get_reffs", "(", "arg_1", ")", "]", "if", "arg_2", "in", "arg_4", ":", "arg_5", "=", "arg_4", ".", "index", "(", "arg_2", ")", "if", "0", "<", "arg_5", "<", "len", "(", "arg_4", ")", "-", "1", ":", "return", "arg_4", "[", "arg_5", "-", "1", "]", ",", "arg_4", "[", "arg_5", "+", "1", "]", "elif", "arg_5", "==", "0", "and", "arg_5", "<", "len", "(", "arg_4", ")", "-", "1", ":", "return", "None", ",", "arg_4", "[", "1", "]", "elif", "arg_5", ">", "0", "and", "arg_5", "==", "len", "(", "arg_4", ")", "-", "1", ":", "return", "arg_4", "[", "arg_5", "-", "1", "]", ",", "None", "else", ":", "return", "None", ",", "None", "else", ":", "return", "arg_3", ".", "siblingsId"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Get siblings of a browsed subreference\n\n        .. note:: Since 1.0.0c, there is no more prevnext dict. Nemo uses the list of original\\\n        chunked references to retrieve next and previous, or simply relies on the resolver to get siblings\\\n        when the subreference is not found in given original chunks.\n\n        :param objectId: Id of the object\n        :param subreference: Subreference of the object\n        :param passage: Current Passage\n        :return: Previous and next references\n        :rtype: (str, str)\n        \"\"\"\n        arg_4 = [reff for reff, _ in arg_0.get_reffs(arg_1)]\n        if arg_2 in arg_4:\n            arg_5 = arg_4.index(arg_2)\n            # Not the first item and not the last one\n            if 0 < arg_5 < len(arg_4) - 1:\n                return arg_4[arg_5-1], arg_4[arg_5+1]\n            elif arg_5 == 0 and arg_5 < len(arg_4) - 1:\n                return None, arg_4[1]\n            elif arg_5 > 0 and arg_5 == len(arg_4) - 1:\n                return arg_4[arg_5-1], None\n            else:\n                return None, None\n        else:\n            return arg_3.siblingsId", "path": "flask_nemo/__init__.py", "identifier": "Nemo.get_siblings", "docstring": "Get siblings of a browsed subreference\n\n        .. note:: Since 1.0.0c, there is no more prevnext dict. Nemo uses the list of original\\\n        chunked references to retrieve next and previous, or simply relies on the resolver to get siblings\\\n        when the subreference is not found in given original chunks.\n\n        :param objectId: Id of the object\n        :param subreference: Subreference of the object\n        :param passage: Current Passage\n        :return: Previous and next references\n        :rtype: (str, str)", "docstring_tokens": ["Get", "siblings", "of", "a", "browsed", "subreference"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 258475}
{"url": "https://github.com/NateFerrero/oauth2lib/blob/d161b010f8a596826050a09e5e94d59443cc12d9/oauth2lib/provider.py#L338-L410", "sha": "d161b010f8a596826050a09e5e94d59443cc12d9", "docstring_summary": "Generate access token HTTP response.", "language": "python", "parameters": "(self,\n                  grant_type,\n                  client_id,\n                  client_secret,\n                  redirect_uri,\n                  code,\n                  **params)", "return_statement": "return self._make_json_response({\n            'access_token': access_token,\n            'token_type': token_type,\n            'expires_in': expires_in,\n            'refresh_token': refresh_token\n        })", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "**", "arg_6", ")", ":", "if", "arg_1", "!=", "'authorization_code'", ":", "return", "arg_0", ".", "_make_json_error_response", "(", "'unsupported_grant_type'", ")", "arg_7", "=", "arg_0", ".", "validate_client_id", "(", "arg_2", ")", "arg_8", "=", "arg_0", ".", "validate_client_secret", "(", "arg_2", ",", "arg_3", ")", "arg_9", "=", "arg_0", ".", "validate_redirect_uri", "(", "arg_2", ",", "arg_4", ")", "arg_10", "=", "arg_6", ".", "get", "(", "'scope'", ",", "''", ")", "arg_11", "=", "arg_0", ".", "validate_scope", "(", "arg_2", ",", "arg_10", ")", "arg_12", "=", "arg_0", ".", "from_authorization_code", "(", "arg_2", ",", "arg_5", ",", "arg_10", ")", "arg_13", "=", "arg_12", "is", "not", "None", "if", "not", "(", "arg_7", "and", "arg_8", ")", ":", "return", "arg_0", ".", "_make_json_error_response", "(", "'invalid_client'", ")", "if", "not", "arg_13", "or", "not", "arg_9", ":", "return", "arg_0", ".", "_make_json_error_response", "(", "'invalid_grant'", ")", "if", "not", "arg_11", ":", "return", "arg_0", ".", "_make_json_error_response", "(", "'invalid_scope'", ")", "arg_0", ".", "discard_authorization_code", "(", "arg_2", ",", "arg_5", ")", "arg_14", "=", "arg_0", ".", "generate_access_token", "(", ")", "arg_15", "=", "arg_0", ".", "token_type", "arg_16", "=", "arg_0", ".", "token_expires_in", "arg_17", "=", "arg_0", ".", "generate_refresh_token", "(", ")", "arg_0", ".", "persist_token_information", "(", "arg_2", "=", "arg_2", ",", "arg_10", "=", "arg_10", ",", "arg_14", "=", "arg_14", ",", "arg_15", "=", "arg_15", ",", "arg_16", "=", "arg_16", ",", "arg_17", "=", "arg_17", ",", "arg_12", "=", "arg_12", ")", "return", "arg_0", ".", "_make_json_response", "(", "{", "'access_token'", ":", "arg_14", ",", "'token_type'", ":", "arg_15", ",", "'expires_in'", ":", "arg_16", ",", "'refresh_token'", ":", "arg_17", "}", ")"], "function": "def Func(arg_0,\n                  arg_1,\n                  arg_2,\n                  arg_3,\n                  arg_4,\n                  arg_5,\n                  **arg_6):\n        \"\"\"Generate access token HTTP response.\n\n        :param grant_type: Desired grant type. Must be \"authorization_code\".\n        :type grant_type: str\n        :param client_id: Client ID.\n        :type client_id: str\n        :param client_secret: Client secret.\n        :type client_secret: str\n        :param redirect_uri: Client redirect URI.\n        :type redirect_uri: str\n        :param code: Authorization code.\n        :type code: str\n        :rtype: requests.Response\n        \"\"\"\n\n        # Ensure proper grant_type\n        if arg_1 != 'authorization_code':\n            return arg_0._make_json_error_response('unsupported_grant_type')\n\n        # Check conditions\n        arg_7 = arg_0.validate_client_id(arg_2)\n        arg_8 = arg_0.validate_client_secret(arg_2,\n                                                             arg_3)\n        arg_9 = arg_0.validate_redirect_uri(arg_2,\n                                                           arg_4)\n\n        arg_10 = arg_6.get('scope', '')\n        arg_11 = arg_0.validate_scope(arg_2, arg_10)\n        arg_12 = arg_0.from_authorization_code(arg_2, arg_5, arg_10)\n        arg_13 = arg_12 is not None\n\n        # Return proper error responses on invalid conditions\n        if not (arg_7 and arg_8):\n            return arg_0._make_json_error_response('invalid_client')\n\n        if not arg_13 or not arg_9:\n            return arg_0._make_json_error_response('invalid_grant')\n\n        if not arg_11:\n            return arg_0._make_json_error_response('invalid_scope')\n\n        # Discard original authorization code\n        arg_0.discard_authorization_code(arg_2, arg_5)\n\n        # Generate access tokens once all conditions have been met\n        arg_14 = arg_0.generate_access_token()\n        arg_15 = arg_0.token_type\n        arg_16 = arg_0.token_expires_in\n        arg_17 = arg_0.generate_refresh_token()\n\n        # Save information to be used to validate later requests\n        arg_0.persist_token_information(arg_2=arg_2,\n                                       arg_10=arg_10,\n                                       arg_14=arg_14,\n                                       arg_15=arg_15,\n                                       arg_16=arg_16,\n                                       arg_17=arg_17,\n                                       arg_12=arg_12)\n\n        # Return json response\n        return arg_0._make_json_response({\n            'access_token': arg_14,\n            'token_type': arg_15,\n            'expires_in': arg_16,\n            'refresh_token': arg_17\n        })", "path": "oauth2lib/provider.py", "identifier": "AuthorizationProvider.get_token", "docstring": "Generate access token HTTP response.\n\n        :param grant_type: Desired grant type. Must be \"authorization_code\".\n        :type grant_type: str\n        :param client_id: Client ID.\n        :type client_id: str\n        :param client_secret: Client secret.\n        :type client_secret: str\n        :param redirect_uri: Client redirect URI.\n        :type redirect_uri: str\n        :param code: Authorization code.\n        :type code: str\n        :rtype: requests.Response", "docstring_tokens": ["Generate", "access", "token", "HTTP", "response", "."], "nwo": "NateFerrero/oauth2lib", "score": 0.29100924573231046, "idx": 258476}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L141-L157", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Creates the virtual environment.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "print", "(", "'Creating new virtual environment...'", ")", "with", "arg_0", ".", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_2", "=", "'[ ! -d {virtualenv_dir} ] && virtualenv --no-site-packages {virtualenv_dir} || true'", "if", "arg_0", ".", "is_local", ":", "arg_1", ".", "run_or_local", "(", "arg_2", ")", "else", ":", "arg_1", ".", "sudo", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Creates the virtual environment.\n        \"\"\"\n        arg_1 = arg_0.local_renderer\n\n#         if self.virtualenv_exists():\n#             print('virtualenv exists')\n#             return\n\n        print('Creating new virtual environment...')\n        with arg_0.settings(warn_only=True):\n            arg_2 = '[ ! -d {virtualenv_dir} ] && virtualenv --no-site-packages {virtualenv_dir} || true'\n            if arg_0.is_local:\n                arg_1.run_or_local(arg_2)\n            else:\n                arg_1.sudo(arg_2)", "path": "burlap/pip.py", "identifier": "PIPSatchel.init", "docstring": "Creates the virtual environment.", "docstring_tokens": ["Creates", "the", "virtual", "environment", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258477}
{"url": "https://github.com/phoikoi/sisy/blob/840c5463ab65488d34e99531f230e61f755d2d69/src/sisy/consumers.py#L29-L42", "sha": "840c5463ab65488d34e99531f230e61f755d2d69", "docstring_summary": "Internal ``RUN_TASK`` consumer to run the task's callable", "language": "python", "parameters": "(message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Task", ".", "objects", ".", "get", "(", "pk", "=", "arg_0", "[", "'id'", "]", ")", "if", "arg_1", ".", "allow_overlap", ":", "arg_1", ".", "run", "(", "arg_0", ")", "else", ":", "if", "not", "arg_1", ".", "running", ":", "arg_1", ".", "running", "=", "True", "arg_1", ".", "save", "(", ")", "try", ":", "arg_1", ".", "run", "(", "arg_0", ")", "finally", ":", "arg_1", ".", "running", "=", "False", "arg_1", ".", "save", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Internal ``RUN_TASK`` consumer to run the task's callable\"\"\"\n    arg_1 = Task.objects.get(pk=arg_0['id'])\n    if arg_1.allow_overlap:\n        arg_1.run(arg_0)\n    else:\n        if not arg_1.running:\n            arg_1.running = True\n            arg_1.save()\n            try:\n                arg_1.run(arg_0)\n            finally:\n                arg_1.running = False\n                arg_1.save()", "path": "src/sisy/consumers.py", "identifier": "run_task", "docstring": "Internal ``RUN_TASK`` consumer to run the task's callable", "docstring_tokens": ["Internal", "RUN_TASK", "consumer", "to", "run", "the", "task", "s", "callable"], "nwo": "phoikoi/sisy", "score": 0.0, "idx": 258478}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/eval.py#L455-L495", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "r'''Pattern detection evaluation", "language": "python", "parameters": "(ref, est, **kwargs)", "return_statement": "return mir_eval.pattern.evaluate(ref_patterns, est_patterns, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "'Func_jku'", "arg_0", "=", "coerce_annotation", "(", "arg_0", ",", "arg_3", ")", "arg_1", "=", "coerce_annotation", "(", "arg_1", ",", "arg_3", ")", "arg_4", "=", "Func_to_mireval", "(", "arg_0", ")", "arg_5", "=", "Func_to_mireval", "(", "arg_1", ")", "return", "mir_eval", ".", "Func", ".", "evaluate", "(", "arg_4", ",", "arg_5", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    r'''Pattern detection evaluation\n\n    Parameters\n    ----------\n    ref : jams.Annotation\n        Reference annotation object\n    est : jams.Annotation\n        Estimated annotation object\n    kwargs\n        Additional keyword arguments\n\n    Returns\n    -------\n    scores : dict\n        Dictionary of scores, where the key is the metric name (str) and\n        the value is the (float) score achieved.\n\n    See Also\n    --------\n    mir_eval.Func.evaluate\n\n    Examples\n    --------\n    >>> # Load in the JAMS objects\n    >>> ref_jam = jams.load('reference.jams')\n    >>> est_jam = jams.load('estimated.jams')\n    >>> # Select the first relevant annotations\n    >>> ref_ann = ref_jam.search(namespace='Func_jku')[0]\n    >>> est_ann = est_jam.search(namespace='Func_jku')[0]\n    >>> scores = jams.eval.Func(ref_ann, est_ann)\n    '''\n\n    arg_3 = 'Func_jku'\n    arg_0 = coerce_annotation(arg_0, arg_3)\n    arg_1 = coerce_annotation(arg_1, arg_3)\n\n    arg_4 = Func_to_mireval(arg_0)\n    arg_5 = Func_to_mireval(arg_1)\n\n    return mir_eval.Func.evaluate(arg_4, arg_5, **arg_2)", "path": "jams/eval.py", "identifier": "pattern", "docstring": "r'''Pattern detection evaluation\n\n    Parameters\n    ----------\n    ref : jams.Annotation\n        Reference annotation object\n    est : jams.Annotation\n        Estimated annotation object\n    kwargs\n        Additional keyword arguments\n\n    Returns\n    -------\n    scores : dict\n        Dictionary of scores, where the key is the metric name (str) and\n        the value is the (float) score achieved.\n\n    See Also\n    --------\n    mir_eval.pattern.evaluate\n\n    Examples\n    --------\n    >>> # Load in the JAMS objects\n    >>> ref_jam = jams.load('reference.jams')\n    >>> est_jam = jams.load('estimated.jams')\n    >>> # Select the first relevant annotations\n    >>> ref_ann = ref_jam.search(namespace='pattern_jku')[0]\n    >>> est_ann = est_jam.search(namespace='pattern_jku')[0]\n    >>> scores = jams.eval.pattern(ref_ann, est_ann)", "docstring_tokens": ["r", "Pattern", "detection", "evaluation"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 258479}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/appengine.py#L653-L670", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Create the Flow object.", "language": "python", "parameters": "(self, request_handler)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "flow", "is", "None", ":", "arg_2", "=", "arg_1", ".", "request", ".", "relative_url", "(", "arg_0", ".", "_callback_path", ")", "arg_0", ".", "flow", "=", "client", ".", "OAuth2WebServerFlow", "(", "arg_0", ".", "_client_id", ",", "arg_0", ".", "_client_secret", ",", "arg_0", ".", "_scope", ",", "arg_2", "=", "arg_2", ",", "user_agent", "=", "arg_0", ".", "_user_agent", ",", "auth_uri", "=", "arg_0", ".", "_auth_uri", ",", "token_uri", "=", "arg_0", ".", "_token_uri", ",", "revoke_uri", "=", "arg_0", ".", "_revoke_uri", ",", "**", "arg_0", ".", "_kwargs", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create the Flow object.\n\n        The Flow is calculated lazily since we don't know where this app is\n        running until it receives a request, at which point redirect_uri can be\n        calculated and then the Flow object can be constructed.\n\n        Args:\n            request_handler: webapp.RequestHandler, the request handler.\n        \"\"\"\n        if arg_0.flow is None:\n            arg_2 = arg_1.request.relative_url(\n                arg_0._callback_path)  # Usually /oauth2callback\n            arg_0.flow = client.OAuth2WebServerFlow(\n                arg_0._client_id, arg_0._client_secret, arg_0._scope,\n                arg_2=arg_2, user_agent=arg_0._user_agent,\n                auth_uri=arg_0._auth_uri, token_uri=arg_0._token_uri,\n                revoke_uri=arg_0._revoke_uri, **arg_0._kwargs)", "path": "oauth2client/contrib/appengine.py", "identifier": "OAuth2Decorator._create_flow", "docstring": "Create the Flow object.\n\n        The Flow is calculated lazily since we don't know where this app is\n        running until it receives a request, at which point redirect_uri can be\n        calculated and then the Flow object can be constructed.\n\n        Args:\n            request_handler: webapp.RequestHandler, the request handler.", "docstring_tokens": ["Create", "the", "Flow", "object", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 258480}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L156-L220", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Use the algorithm described in ACMG paper to get a ACMG calssification", "language": "python", "parameters": "(acmg_terms)", "return_statement": "return prediction", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'uncertain_significance'", "arg_2", "=", "False", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "arg_6", "=", "False", "arg_7", "=", "[", "]", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_0", ":", "if", "arg_9", ".", "startswith", "(", "'PVS'", ")", ":", "arg_2", "=", "True", "elif", "arg_9", ".", "startswith", "(", "'PS'", ")", ":", "arg_3", ".", "append", "(", "arg_9", ")", "elif", "arg_9", ".", "startswith", "(", "'PM'", ")", ":", "arg_4", ".", "append", "(", "arg_9", ")", "elif", "arg_9", ".", "startswith", "(", "'PP'", ")", ":", "arg_5", ".", "append", "(", "arg_9", ")", "elif", "arg_9", ".", "startswith", "(", "'BA'", ")", ":", "arg_6", "=", "True", "elif", "arg_9", ".", "startswith", "(", "'BS'", ")", ":", "arg_7", ".", "append", "(", "arg_9", ")", "elif", "arg_9", ".", "startswith", "(", "'BP'", ")", ":", "arg_8", ".", "append", "(", "arg_9", ")", "arg_10", "=", "is_pathogenic", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "arg_11", "=", "is_likely_pathogenic", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "arg_12", "=", "is_benign", "(", "arg_6", ",", "arg_7", ")", "arg_13", "=", "is_likely_benign", "(", "arg_7", ",", "arg_8", ")", "if", "(", "arg_10", "or", "arg_11", ")", ":", "if", "(", "arg_12", "or", "arg_13", ")", ":", "arg_1", "=", "'uncertain_significance'", "elif", "arg_10", ":", "arg_1", "=", "'pathogenic'", "else", ":", "arg_1", "=", "'likely_pathogenic'", "else", ":", "if", "arg_12", ":", "arg_1", "=", "'benign'", "if", "arg_13", ":", "arg_1", "=", "'likely_benign'", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Use the algorithm described in ACMG paper to get a ACMG calssification\n\n    Args:\n        acmg_terms(set(str)): A collection of prediction terms\n\n    Returns:\n        prediction(int):\n                0 - Uncertain Significanse\n                1 - Benign\n                2 - Likely Benign\n                3 - Likely Pathogenic\n                4 - Pathogenic\n    \"\"\"\n    arg_1 = 'uncertain_significance'\n    # This variable indicates if Pathogenecity Very Strong exists\n    arg_2 = False\n    # Collection of terms with Pathogenecity Strong\n    arg_3 = []\n    # Collection of terms with Pathogenecity moderate\n    arg_4 = []\n    # Collection of terms with Pathogenecity supporting\n    arg_5 = []\n    # This variable indicates if Benign impact stand-alone exists\n    arg_6 = False\n    # Collection of terms with Benign evidence Strong\n    arg_7 = []\n    # Collection of terms with supporting Benign evidence\n    arg_8 = []\n    for arg_9 in arg_0:\n        if arg_9.startswith('PVS'):\n            arg_2 = True\n        elif arg_9.startswith('PS'):\n            arg_3.append(arg_9)\n        elif arg_9.startswith('PM'):\n            arg_4.append(arg_9)\n        elif arg_9.startswith('PP'):\n            arg_5.append(arg_9)\n        elif arg_9.startswith('BA'):\n            arg_6 = True\n        elif arg_9.startswith('BS'):\n            arg_7.append(arg_9)\n        elif arg_9.startswith('BP'):\n            arg_8.append(arg_9)\n\n    # We need to start by checking for Pathogenecity\n    arg_10 = is_pathogenic(arg_2, arg_3, arg_4, arg_5)\n    arg_11 = is_likely_pathogenic(arg_2, arg_3, arg_4, arg_5)\n    arg_12 = is_benign(arg_6, arg_7)\n    arg_13 = is_likely_benign(arg_7, arg_8)\n\n    if (arg_10 or arg_11):\n        if (arg_12 or arg_13):\n            arg_1 = 'uncertain_significance'\n        elif arg_10:\n            arg_1 = 'pathogenic'\n        else:\n            arg_1 = 'likely_pathogenic'\n    else:\n        if arg_12:\n            arg_1 = 'benign'\n        if arg_13:\n            arg_1 = 'likely_benign'\n\n    return arg_1", "path": "scout/utils/acmg.py", "identifier": "get_acmg", "docstring": "Use the algorithm described in ACMG paper to get a ACMG calssification\n\n    Args:\n        acmg_terms(set(str)): A collection of prediction terms\n\n    Returns:\n        prediction(int):\n                0 - Uncertain Significanse\n                1 - Benign\n                2 - Likely Benign\n                3 - Likely Pathogenic\n                4 - Pathogenic", "docstring_tokens": ["Use", "the", "algorithm", "described", "in", "ACMG", "paper", "to", "get", "a", "ACMG", "calssification"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258481}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L168-L178", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Handle global keybindings.", "language": "python", "parameters": "(self, keys, _)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "[", "arg_0", ".", "_keys", "[", "'menu'", "]", "]", ":", "if", "arg_0", ".", "_urwid_loop", ".", "widget", "==", "arg_0", ".", "_tabbed_window", ":", "arg_0", ".", "_show_menu", "(", ")", "else", ":", "arg_0", ".", "_hide_menu", "(", ")", "elif", "arg_1", "==", "[", "arg_0", ".", "_keys", "[", "'quit'", "]", "]", ":", "arg_0", ".", "_coroutine_queue", ".", "put", "(", "arg_0", ".", "_client", ".", "disconnect", "(", ")", ")", "else", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle global keybindings.\"\"\"\n        if arg_1 == [arg_0._keys['menu']]:\n            if arg_0._urwid_loop.widget == arg_0._tabbed_window:\n                arg_0._show_menu()\n            else:\n                arg_0._hide_menu()\n        elif arg_1 == [arg_0._keys['quit']]:\n            arg_0._coroutine_queue.put(arg_0._client.disconnect())\n        else:\n            return arg_1", "path": "hangups/ui/__main__.py", "identifier": "ChatUI._input_filter", "docstring": "Handle global keybindings.", "docstring_tokens": ["Handle", "global", "keybindings", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258482}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/levinson.py#L242-L275", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "One step backward Levinson recursion", "language": "python", "parameters": "(anxt, enxt=None)", "return_statement": "return acur, ecur", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "[", "0", "]", "!=", "1", ":", "raise", "ValueError", "(", "'At least one of the reflection coefficients is equal to one.'", ")", "arg_0", "=", "arg_0", "[", "1", ":", "]", "arg_2", "=", "arg_0", "[", "-", "1", "]", "if", "arg_2", "==", "1.0", ":", "raise", "ValueError", "(", "'At least one of the reflection coefficients is equal to one.'", ")", "arg_3", "=", "(", "arg_0", "[", "0", ":", "-", "1", "]", "-", "arg_2", "*", "numpy", ".", "conj", "(", "arg_0", "[", "-", "2", ":", ":", "-", "1", "]", ")", ")", "/", "(", "1.", "-", "abs", "(", "arg_2", ")", "**", "2", ")", "arg_4", "=", "None", "if", "arg_1", "is", "not", "None", ":", "arg_4", "=", "arg_1", "/", "(", "1.", "-", "numpy", ".", "dot", "(", "arg_2", ".", "conj", "(", ")", ".", "transpose", "(", ")", ",", "arg_2", ")", ")", "arg_3", "=", "numpy", ".", "insert", "(", "arg_3", ",", "0", ",", "1", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"One step backward Levinson recursion\n\n    :param anxt:\n    :param enxt:\n    :return:\n        * acur the P'th order prediction polynomial based on the P+1'th order prediction polynomial, anxt.\n        * ecur the the P'th order prediction error  based on the P+1'th order prediction error, enxt.\n\n    ..  * knxt the P+1'th order reflection coefficient.\n\n    \"\"\"\n    #% Some preliminaries first\n    #if nargout>=2 & nargin<2\n    #    raise ValueError('Insufficient number of input arguments');\n    if arg_0[0] != 1:\n        raise ValueError('At least one of the reflection coefficients is equal to one.')\n    arg_0 = arg_0[1:] #  Drop the leading 1, it is not needed\n                    #  in the step down\n\n    # Extract the k+1'th reflection coefficient\n    arg_2 = arg_0[-1]\n    if arg_2 == 1.0:\n        raise ValueError('At least one of the reflection coefficients is equal to one.')\n\n    # A Matrix formulation from Stoica is used to avoid looping\n    arg_3 = (arg_0[0:-1]-arg_2*numpy.conj(arg_0[-2::-1]))/(1.-abs(arg_2)**2)\n    arg_4 = None\n    if arg_1 is not None:\n        arg_4 = arg_1/(1.-numpy.dot(arg_2.conj().transpose(),arg_2))\n\n    arg_3 = numpy.insert(arg_3, 0, 1)\n\n    return arg_3, arg_4", "path": "src/spectrum/levinson.py", "identifier": "levdown", "docstring": "One step backward Levinson recursion\n\n    :param anxt:\n    :param enxt:\n    :return:\n        * acur the P'th order prediction polynomial based on the P+1'th order prediction polynomial, anxt.\n        * ecur the the P'th order prediction error  based on the P+1'th order prediction error, enxt.\n\n    ..  * knxt the P+1'th order reflection coefficient.", "docstring_tokens": ["One", "step", "backward", "Levinson", "recursion"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 258483}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_editor.py#L270-L274", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles addition and removal of nodes.", "language": "python", "parameters": "(self, object, name, undefined, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_0", ".", "_delete_nodes", "(", "arg_4", ".", "removed", ")", "arg_0", ".", "_add_nodes", "(", "arg_4", ".", "added", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\" Handles addition and removal of nodes.\n        \"\"\"\n        arg_0._delete_nodes(arg_4.removed)\n        arg_0._add_nodes(arg_4.added)", "path": "godot/ui/graph_editor.py", "identifier": "SimpleGraphEditor._nodes_changed", "docstring": "Handles addition and removal of nodes.", "docstring_tokens": ["Handles", "addition", "and", "removal", "of", "nodes", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 258484}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/file_record_stream.py#L662-L677", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Extracts start row from the bookmark information", "language": "python", "parameters": "(self, bookmark)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "json", ".", "loads", "(", "arg_1", ")", "arg_3", "=", "os", ".", "path", ".", "realpath", "(", "arg_0", ".", "_filename", ")", "arg_4", "=", "arg_2", ".", "get", "(", "'filepath'", ",", "None", ")", "if", "arg_4", "!=", "arg_3", ":", "print", "(", "\"Ignoring bookmark due to mismatch between File's \"", "\"filename realpath vs. bookmark; realpath: %r; bookmark: %r\"", ")", "%", "(", "arg_3", ",", "arg_2", ")", "return", "0", "else", ":", "return", "arg_2", "[", "'currentRow'", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Extracts start row from the bookmark information\n    \"\"\"\n    arg_2 = json.loads(arg_1)\n\n    arg_3 = os.path.realpath(arg_0._filename)\n\n    arg_4 = arg_2.get('filepath', None)\n\n    if arg_4 != arg_3:\n      print (\"Ignoring bookmark due to mismatch between File's \"\n             \"filename realpath vs. bookmark; realpath: %r; bookmark: %r\") % (\n        arg_3, arg_2)\n      return 0\n    else:\n      return arg_2['currentRow']", "path": "src/nupic/data/file_record_stream.py", "identifier": "FileRecordStream._getStartRow", "docstring": "Extracts start row from the bookmark information", "docstring_tokens": ["Extracts", "start", "row", "from", "the", "bookmark", "information"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258485}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/agents.py#L234-L244", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Run the environment for one time step. If the\n        actions and exogenous changes are independent, this method will\n        do.  If there are interactions between them, you'll need to\n        override this method.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_done", "(", ")", ":", "arg_1", "=", "[", "arg_2", ".", "program", "(", "arg_0", ".", "percept", "(", "arg_2", ")", ")", "for", "arg_2", "in", "arg_0", ".", "agents", "]", "for", "(", "arg_2", ",", "arg_3", ")", "in", "zip", "(", "arg_0", ".", "agents", ",", "arg_1", ")", ":", "arg_0", ".", "execute_action", "(", "arg_2", ",", "arg_3", ")", "arg_0", ".", "exogenous_change", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Run the environment for one time Func. If the\n        actions and exogenous changes are independent, this method will\n        do.  If there are interactions between them, you'll need to\n        override this method.\"\"\"\n        if not arg_0.is_done():\n            arg_1 = [arg_2.program(arg_0.percept(arg_2))\n                       for arg_2 in arg_0.agents]\n            for (arg_2, arg_3) in zip(arg_0.agents, arg_1):\n                arg_0.execute_action(arg_2, arg_3)\n            arg_0.exogenous_change()", "path": "aima/agents.py", "identifier": "Environment.step", "docstring": "Run the environment for one time step. If the\n        actions and exogenous changes are independent, this method will\n        do.  If there are interactions between them, you'll need to\n        override this method.", "docstring_tokens": ["Run", "the", "environment", "for", "one", "time", "step", ".", "If", "the", "actions", "and", "exogenous", "changes", "are", "independent", "this", "method", "will", "do", ".", "If", "there", "are", "interactions", "between", "them", "you", "ll", "need", "to", "override", "this", "method", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 258486}
{"url": "https://github.com/textbook/aslack/blob/9ac6a44e4464180109fa4be130ad7a980a9d1acc/aslack/slack_api.py#L204-L222", "sha": "9ac6a44e4464180109fa4be130ad7a980a9d1acc", "docstring_summary": "Whether a given method exists in the known API.", "language": "python", "parameters": "(cls, method)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "API_METHODS", "for", "arg_3", "in", "arg_1", ".", "split", "(", "'.'", ")", ":", "arg_2", "=", "arg_2", ".", "get", "(", "arg_3", ")", "if", "arg_2", "is", "None", ":", "break", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "logger", ".", "debug", "(", "'%r: %r'", ",", "arg_1", ",", "arg_2", ")", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Whether a given method exists in the known API.\n\n        Arguments:\n          method (:py:class:`str`): The name of the method.\n\n        Returns:\n          :py:class:`bool`: Whether the method is in the known API.\n\n        \"\"\"\n        arg_2 = arg_0.API_METHODS\n        for arg_3 in arg_1.split('.'):\n            arg_2 = arg_2.get(arg_3)\n            if arg_2 is None:\n                break\n        if isinstance(arg_2, str):\n            logger.debug('%r: %r', arg_1, arg_2)\n            return True\n        return False", "path": "aslack/slack_api.py", "identifier": "SlackApi.method_exists", "docstring": "Whether a given method exists in the known API.\n\n        Arguments:\n          method (:py:class:`str`): The name of the method.\n\n        Returns:\n          :py:class:`bool`: Whether the method is in the known API.", "docstring_tokens": ["Whether", "a", "given", "method", "exists", "in", "the", "known", "API", "."], "nwo": "textbook/aslack", "score": 0.18261785916548806, "idx": 258487}
{"url": "https://github.com/goller/hashring/blob/9bee95074f7d853b6aa656968dfd359d02b3b710/src/hashring/hashring.py#L90-L98", "sha": "9bee95074f7d853b6aa656968dfd359d02b3b710", "docstring_summary": "Given a string key a corresponding node in the hash ring is returned.", "language": "python", "parameters": "(self, string_key)", "return_statement": "return self.ring[self._sorted_keys[pos]]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "Func_pos", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "return", "None", "return", "arg_0", ".", "ring", "[", "arg_0", ".", "_sorted_keys", "[", "arg_2", "]", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Given a string key a corresponding node in the hash ring is returned.\n\n        If the hash ring is empty, `None` is returned.\n        \"\"\"\n        arg_2 = arg_0.Func_pos(arg_1)\n        if arg_2 is None:\n            return None\n        return arg_0.ring[arg_0._sorted_keys[arg_2]]", "path": "src/hashring/hashring.py", "identifier": "HashRing.get_node", "docstring": "Given a string key a corresponding node in the hash ring is returned.\n\n        If the hash ring is empty, `None` is returned.", "docstring_tokens": ["Given", "a", "string", "key", "a", "corresponding", "node", "in", "the", "hash", "ring", "is", "returned", "."], "nwo": "goller/hashring", "score": 0.26806449491785717, "idx": 258488}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L774-L782", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "fixup_ins_del_tags that works on an lxml document in-place", "language": "python", "parameters": "(doc)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "[", "'ins'", ",", "'del'", "]", ":", "for", "arg_2", "in", "arg_0", ".", "xpath", "(", "'descendant-or-self::%s'", "%", "arg_1", ")", ":", "if", "not", "_contains_block_level_tag", "(", "arg_2", ")", ":", "continue", "_move_el_inside_block", "(", "arg_2", ",", "arg_1", "=", "arg_1", ")", "arg_2", ".", "drop_tag", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"fixup_ins_del_tags that works on an lxml document in-place\n    \"\"\"\n    for arg_1 in ['ins', 'del']:\n        for arg_2 in arg_0.xpath('descendant-or-self::%s' % arg_1):\n            if not _contains_block_level_tag(arg_2):\n                continue\n            _move_el_inside_block(arg_2, arg_1=arg_1)\n            arg_2.drop_tag()", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py", "identifier": "_fixup_ins_del_tags", "docstring": "fixup_ins_del_tags that works on an lxml document in-place", "docstring_tokens": ["fixup_ins_del_tags", "that", "works", "on", "an", "lxml", "document", "in", "-", "place"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 258489}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/eight_schools_hmc.py#L37-L41", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Convenience function to efficiently construct a MultivariateNormalDiag.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return tfd.Independent(tfd.Normal(*args, **kwargs),\n                         reinterpreted_batch_ndims=1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "return", "tfd", ".", "Independent", "(", "tfd", ".", "Normal", "(", "*", "arg_0", ",", "**", "arg_1", ")", ",", "reinterpreted_batch_ndims", "=", "1", ")"], "function": "def Func(*arg_0, **arg_1):\n  \"\"\"Convenience function to efficiently construct a MultivariateNormalDiag.\"\"\"\n  # Faster than using `tfd.MultivariateNormalDiag`.\n  return tfd.Independent(tfd.Normal(*arg_0, **arg_1),\n                         reinterpreted_batch_ndims=1)", "path": "tensorflow_probability/python/mcmc/eight_schools_hmc.py", "identifier": "mvn", "docstring": "Convenience function to efficiently construct a MultivariateNormalDiag.", "docstring_tokens": ["Convenience", "function", "to", "efficiently", "construct", "a", "MultivariateNormalDiag", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258490}
{"url": "https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L188-L195", "sha": "6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d", "docstring_summary": "Method that gets the authenticated user. The returning user has\n        the token, email and the provider data.", "language": "python", "parameters": "(self)", "return_statement": "return FirebaseUser(self.email, token, self.provider, user_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "authenticator", ".", "create_token", "(", "arg_0", ".", "extra", ")", "arg_2", "=", "arg_0", ".", "extra", ".", "get", "(", "'id'", ")", "return", "FirebaseUser", "(", "arg_0", ".", "email", ",", "arg_1", ",", "arg_0", ".", "provider", ",", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Method that gets the authenticated user. The returning user has\n        the token, email and the provider data.\n        \"\"\"\n        arg_1 = arg_0.authenticator.create_token(arg_0.extra)\n        arg_2 = arg_0.extra.get('id')\n        return FirebaseUser(arg_0.email, arg_1, arg_0.provider, arg_2)", "path": "firebase/firebase.py", "identifier": "FirebaseAuthentication.get_user", "docstring": "Method that gets the authenticated user. The returning user has\n        the token, email and the provider data.", "docstring_tokens": ["Method", "that", "gets", "the", "authenticated", "user", ".", "The", "returning", "user", "has", "the", "token", "email", "and", "the", "provider", "data", "."], "nwo": "ozgur/python-firebase", "score": 0.7583798599854712, "idx": 258491}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppparser.py#L191-L218", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Feed the parser with a chunk of data. Apropriate methods\n        of `handler` will be called whenever something interesting is\n        found.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "lock", ":", "if", "arg_0", ".", "in_use", ":", "raise", "StreamParseError", "(", "\"StreamReader.Func() is not reentrant!\"", ")", "arg_0", ".", "in_use", "=", "True", "try", ":", "if", "not", "arg_0", ".", "_started", ":", "if", "len", "(", "arg_1", ")", ">", "1", ":", "arg_0", ".", "parser", ".", "Func", "(", "arg_1", "[", ":", "1", "]", ")", "arg_1", "=", "arg_1", "[", "1", ":", "]", "arg_0", ".", "_started", "=", "True", "if", "arg_1", ":", "arg_0", ".", "parser", ".", "Func", "(", "arg_1", ")", "else", ":", "arg_0", ".", "parser", ".", "close", "(", ")", "except", "ElementTree", ".", "ParseError", ",", "err", ":", "arg_0", ".", "handler", ".", "stream_parse_error", "(", "unicode", "(", "err", ")", ")", "finally", ":", "arg_0", ".", "in_use", "=", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Feed the parser with a chunk of data. Apropriate methods\n        of `handler` will be called whenever something interesting is\n        found.\n\n        :Parameters:\n            - `data`: the chunk of data to parse.\n        :Types:\n            - `data`: `str`\"\"\"\n        with arg_0.lock:\n            if arg_0.in_use:\n                raise StreamParseError(\"StreamReader.Func() is not reentrant!\")\n            arg_0.in_use = True\n            try:\n                if not arg_0._started:\n                    # workaround for lxml bug when fed with a big chunk at once\n                    if len(arg_1) > 1:\n                        arg_0.parser.Func(arg_1[:1])\n                        arg_1 = arg_1[1:]\n                    arg_0._started = True\n                if arg_1:\n                    arg_0.parser.Func(arg_1)\n                else:\n                    arg_0.parser.close()\n            except ElementTree.ParseError, err:\n                arg_0.handler.stream_parse_error(unicode(err))\n            finally:\n                arg_0.in_use = False", "path": "pyxmpp2/xmppparser.py", "identifier": "StreamReader.feed", "docstring": "Feed the parser with a chunk of data. Apropriate methods\n        of `handler` will be called whenever something interesting is\n        found.\n\n        :Parameters:\n            - `data`: the chunk of data to parse.\n        :Types:\n            - `data`: `str`", "docstring_tokens": ["Feed", "the", "parser", "with", "a", "chunk", "of", "data", ".", "Apropriate", "methods", "of", "handler", "will", "be", "called", "whenever", "something", "interesting", "is", "found", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258492}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/util.py#L87-L94", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Save the object to file given by filename.", "language": "python", "parameters": "(self, filename, format=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "format_from_extension", "(", "arg_1", ")", "with", "file", "(", "arg_1", ",", "'wb'", ")", "as", "fp", ":", "arg_0", ".", "Func_like", "(", "fp", ",", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\" Save the object to file given by filename.\n        \"\"\"\n        if arg_2 is None:\n            # try to derive protocol from file extension\n            arg_2 = format_from_extension(arg_1)\n        with file(arg_1, 'wb') as fp:\n            arg_0.Func_like(fp, arg_2, **arg_3)", "path": "godot/util.py", "identifier": "Serializable.save_to_file", "docstring": "Save the object to file given by filename.", "docstring_tokens": ["Save", "the", "object", "to", "file", "given", "by", "filename", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 258493}
{"url": "https://github.com/voxpupuli/pypuppetdb/blob/cedeecf48014b4ad5b8e2513ca8230c814f45603/pypuppetdb/types.py#L211-L216", "sha": "cedeecf48014b4ad5b8e2513ca8230c814f45603", "docstring_summary": "Get all events for this report. Additional arguments may also be\n        specified that will be passed to the query function.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return self.__api.events(query=EqualsOperator(\"report\", self.hash_),\n                                 **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "return", "arg_0", ".", "__api", ".", "Func", "(", "query", "=", "EqualsOperator", "(", "\"report\"", ",", "arg_0", ".", "hash_", ")", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Get all Func for this report. Additional arguments may also be\n        specified that will be passed to the query function.\n        \"\"\"\n        return arg_0.__api.Func(query=EqualsOperator(\"report\", arg_0.hash_),\n                                 **arg_1)", "path": "pypuppetdb/types.py", "identifier": "Report.events", "docstring": "Get all events for this report. Additional arguments may also be\n        specified that will be passed to the query function.", "docstring_tokens": ["Get", "all", "events", "for", "this", "report", ".", "Additional", "arguments", "may", "also", "be", "specified", "that", "will", "be", "passed", "to", "the", "query", "function", "."], "nwo": "voxpupuli/pypuppetdb", "score": 0.6407386667560883, "idx": 258494}
{"url": "https://github.com/redapple/parslepy/blob/a8bc4c0592824459629018c8f4c6ae3dad6cc3cc/parslepy/base.py#L203-L220", "sha": "a8bc4c0592824459629018c8f4c6ae3dad6cc3cc", "docstring_summary": "Create a Parselet instance from a file containing\n        the Parsley script as a YAML object", "language": "python", "parameters": "(cls, fp, selector_handler=None, strict=False, debug=False)", "return_statement": "return cls.from_yamlstring(fp.read(), selector_handler=selector_handler, strict=strict, debug=debug)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ")", ":", "return", "arg_0", ".", "from_yamlstring", "(", "arg_1", ".", "read", "(", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False, arg_4=False):\n        \"\"\"\n        Create a Parselet instance from a file containing\n        the Parsley script as a YAML object\n\n        >>> import parslepy\n        >>> with open('parselet.yml') as fp:\n        ...     parslepy.Parselet.Func(fp)\n        ...\n        <parslepy.base.Parselet object at 0x2014e50>\n\n        :param file fp: an open file-like pointer containing the Parsley script\n        :rtype: :class:`.Parselet`\n\n        Other arguments: same as for :class:`.Parselet` contructor\n        \"\"\"\n\n        return arg_0.from_yamlstring(arg_1.read(), arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "parslepy/base.py", "identifier": "Parselet.from_yamlfile", "docstring": "Create a Parselet instance from a file containing\n        the Parsley script as a YAML object\n\n        >>> import parslepy\n        >>> with open('parselet.yml') as fp:\n        ...     parslepy.Parselet.from_yamlfile(fp)\n        ...\n        <parslepy.base.Parselet object at 0x2014e50>\n\n        :param file fp: an open file-like pointer containing the Parsley script\n        :rtype: :class:`.Parselet`\n\n        Other arguments: same as for :class:`.Parselet` contructor", "docstring_tokens": ["Create", "a", "Parselet", "instance", "from", "a", "file", "containing", "the", "Parsley", "script", "as", "a", "YAML", "object"], "nwo": "redapple/parslepy", "score": 0.18261785916548806, "idx": 258495}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L755-L781", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Configure the room using the provided data.\n        Do nothing if the provided form is of type 'cancel'.", "language": "python", "parameters": "(self, form)", "return_statement": "return iq.get_id()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "type", "==", "\"cancel\"", ":", "return", "None", "elif", "arg_1", ".", "type", "!=", "\"submit\"", ":", "raise", "ValueError", "(", "\"A 'submit' form required to configure a room\"", ")", "arg_2", "=", "Iq", "(", "to_jid", "=", "arg_0", ".", "room_jid", ".", "bare", "(", ")", ",", "stanza_type", "=", "\"set\"", ")", "arg_3", "=", "arg_2", ".", "new_query", "(", "MUC_OWNER_NS", ",", "\"query\"", ")", "arg_1", ".", "as_xml", "(", "arg_3", ")", "arg_0", ".", "manager", ".", "stream", ".", "set_response_handlers", "(", "arg_2", ",", "arg_0", ".", "process_configuration_success", ",", "arg_0", ".", "process_configuration_error", ")", "arg_0", ".", "manager", ".", "stream", ".", "send", "(", "arg_2", ")", "return", "arg_2", ".", "get_id", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Configure the room using the provided data.\n        Do nothing if the provided form is of type 'cancel'.\n\n        :Parameters:\n            - `form`: the configuration parameters. Should be a 'submit' form made by filling-in\n              the configuration form retireved using `self.request_configuration_form` or\n              a 'cancel' form.\n        :Types:\n            - `form`: `Form`\n\n        :return: id of the request stanza or `None` if a 'cancel' form was provieded.\n        :returntype: `unicode`\n        \"\"\"\n\n        if arg_1.type == \"cancel\":\n            return None\n        elif arg_1.type != \"submit\":\n            raise ValueError(\"A 'submit' form required to configure a room\")\n        arg_2 = Iq(to_jid = arg_0.room_jid.bare(), stanza_type = \"set\")\n        arg_3 = arg_2.new_query(MUC_OWNER_NS, \"query\")\n        arg_1.as_xml(arg_3)\n        arg_0.manager.stream.set_response_handlers(\n                arg_2, arg_0.process_configuration_success, arg_0.process_configuration_error)\n        arg_0.manager.stream.send(arg_2)\n        return arg_2.get_id()", "path": "pyxmpp2/ext/muc/muc.py", "identifier": "MucRoomState.configure_room", "docstring": "Configure the room using the provided data.\n        Do nothing if the provided form is of type 'cancel'.\n\n        :Parameters:\n            - `form`: the configuration parameters. Should be a 'submit' form made by filling-in\n              the configuration form retireved using `self.request_configuration_form` or\n              a 'cancel' form.\n        :Types:\n            - `form`: `Form`\n\n        :return: id of the request stanza or `None` if a 'cancel' form was provieded.\n        :returntype: `unicode`", "docstring_tokens": ["Configure", "the", "room", "using", "the", "provided", "data", ".", "Do", "nothing", "if", "the", "provided", "form", "is", "of", "type", "cancel", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258496}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1590-L1599", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if astroid.Name corresponds to first attribute variable name", "language": "python", "parameters": "(self, node)", "return_statement": "return (\n            self._first_attrs\n            and isinstance(node, astroid.Name)\n            and node.name == self._first_attrs[-1]\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "arg_0", ".", "_first_attrs", "and", "isinstance", "(", "arg_1", ",", "astroid", ".", "Name", ")", "and", "arg_1", ".", "name", "==", "arg_0", ".", "_first_attrs", "[", "-", "1", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check if astroid.Name corresponds to first attribute variable name\n\n        Name is `self` for method, `cls` for classmethod and `mcs` for metaclass.\n        \"\"\"\n        return (\n            arg_0._first_attrs\n            and isinstance(arg_1, astroid.Name)\n            and arg_1.name == arg_0._first_attrs[-1]\n        )", "path": "pylint/checkers/classes.py", "identifier": "ClassChecker._is_mandatory_method_param", "docstring": "Check if astroid.Name corresponds to first attribute variable name\n\n        Name is `self` for method, `cls` for classmethod and `mcs` for metaclass.", "docstring_tokens": ["Check", "if", "astroid", ".", "Name", "corresponds", "to", "first", "attribute", "variable", "name"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258497}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/client.py#L1581-L1596", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Build a list of common attributes that are shared across\n         symmetric as well as asymmetric objects", "language": "python", "parameters": "(self, operation_policy_name=None)", "return_statement": "return common_attributes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "[", "]", "if", "arg_1", ":", "arg_2", ".", "append", "(", "arg_0", ".", "attribute_factory", ".", "create_attribute", "(", "enums", ".", "AttributeType", ".", "OPERATION_POLICY_NAME", ",", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        '''\n         Build a list of common attributes that are shared across\n         symmetric as well as asymmetric objects\n        '''\n        arg_2 = []\n\n        if arg_1:\n            arg_2.append(\n                arg_0.attribute_factory.create_attribute(\n                    enums.AttributeType.OPERATION_POLICY_NAME,\n                    arg_1\n                )\n            )\n\n        return arg_2", "path": "kmip/pie/client.py", "identifier": "ProxyKmipClient._build_common_attributes", "docstring": "Build a list of common attributes that are shared across\n         symmetric as well as asymmetric objects", "docstring_tokens": ["Build", "a", "list", "of", "common", "attributes", "that", "are", "shared", "across", "symmetric", "as", "well", "as", "asymmetric", "objects"], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 258498}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/dashboard/views.py#L18-L70", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Display the Scout dashboard.", "language": "python", "parameters": "()", "return_statement": "return render_template(\n        'dashboard/dashboard_general.html', institute=institute_id, query=slice_query, panel=panel, **data)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "current_user", ".", "institutes", "if", "not", "'admin'", "in", "current_user", ".", "roles", ":", "arg_0", "=", "current_user", ".", "institutes", "if", "not", "arg_0", ":", "flash", "(", "'Not allowed to see information - please visit the dashboard later!'", ")", "return", "redirect", "(", "url_for", "(", "'cases.dahboard_general.html'", ")", ")", "LOG", ".", "debug", "(", "'User accessible institutes: {}'", ".", "format", "(", "arg_0", ")", ")", "arg_1", "=", "[", "inst", "for", "inst", "in", "store", ".", "institutes", "(", "arg_0", ")", "]", "arg_1", ".", "insert", "(", "0", ",", "{", "'_id'", ":", "None", ",", "'display_name'", ":", "'All institutes'", "}", ")", "arg_2", "=", "None", "arg_3", "=", "None", "arg_4", "=", "1", "if", "request", ".", "method", "==", "'POST'", ":", "arg_2", "=", "request", ".", "form", ".", "get", "(", "'institute'", ")", "arg_3", "=", "request", ".", "form", ".", "get", "(", "'query'", ")", "arg_4", "=", "request", ".", "form", ".", "get", "(", "'pane_id'", ")", "elif", "request", ".", "method", "==", "'GET'", ":", "arg_2", "=", "request", ".", "args", ".", "get", "(", "'institute'", ")", "arg_3", "=", "request", ".", "args", ".", "get", "(", "'query'", ")", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", "[", "0", "]", "elif", "(", "not", "current_user", ".", "is_admin", ")", "and", "(", "arg_3", "and", "arg_2", "==", "'None'", ")", ":", "arg_2", "=", "arg_0", "[", "0", "]", "elif", "(", "not", "arg_2", "in", "arg_0", ")", "and", "not", "(", "arg_2", "==", "'None'", ")", ":", "arg_2", "=", "arg_0", "[", "0", "]", "LOG", ".", "info", "(", "\"Fetch all cases with institute: %s\"", ",", "arg_2", ")", "arg_5", "=", "get_dashboard_info", "(", "store", ",", "arg_2", ",", "arg_3", ")", "arg_5", "[", "'institutes'", "]", "=", "arg_1", "arg_5", "[", "'choice'", "]", "=", "arg_2", "arg_6", "=", "arg_5", "[", "'total_cases'", "]", "LOG", ".", "info", "(", "\"Found %s cases\"", ",", "arg_6", ")", "if", "arg_6", "==", "0", ":", "flash", "(", "'no cases found for institute {} (with that query) - please visit the dashboard later!'", ".", "format", "(", "arg_2", ")", ",", "'info'", ")", "return", "render_template", "(", "'dashboard/dashboard_general.html'", ",", "institute", "=", "arg_2", ",", "query", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "**", "arg_5", ")"], "function": "def Func():\n    \"\"\"Display the Scout dashboard.\"\"\"\n    arg_0 = current_user.institutes\n    if not 'admin' in current_user.roles:\n        arg_0 = current_user.institutes\n        if not arg_0:\n            flash('Not allowed to see information - please visit the dashboard later!')\n            return redirect(url_for('cases.dahboard_general.html'))\n\n    LOG.debug('User accessible institutes: {}'.format(arg_0))\n    arg_1 = [inst for inst in store.institutes(arg_0)]\n\n    # Insert a entry that displays all institutes in the beginning of the array\n    arg_1.insert(0, {'_id': None, 'display_name': 'All institutes'})\n\n    arg_2 = None\n    arg_3 = None\n    arg_4=1\n    if request.method=='POST':\n        arg_2 = request.form.get('institute')\n        arg_3 = request.form.get('query')\n        arg_4=request.form.get('pane_id')\n\n    elif request.method=='GET':\n        arg_2 = request.args.get('institute')\n        arg_3 = request.args.get('query')\n\n    # User should be restricted to their own institute if:\n    #1) Their default institute when the page is first loaded\n    #2) if they ask for an institute that they don't belong to\n    #3) if they want perform a query on all institutes\n\n    if not arg_2:\n        arg_2 = arg_0[0]\n    elif (not current_user.is_admin) and (arg_3 and arg_2 == 'None'):\n        arg_2 = arg_0[0]\n    elif (not arg_2 in arg_0) and not (arg_2 == 'None'):\n        arg_2 = arg_0[0]\n\n    LOG.info(\"Fetch all cases with institute: %s\", arg_2)\n\n    arg_5 = get_dashboard_info(store, arg_2, arg_3)\n    arg_5['institutes'] = arg_1\n    arg_5['choice'] = arg_2\n    arg_6 = arg_5['total_cases']\n\n    LOG.info(\"Found %s cases\", arg_6)\n    if arg_6 == 0:\n        flash('no cases found for institute {} (with that query) - please visit the dashboard later!'.format(arg_2), 'info')\n#        return redirect(url_for('cases.Func'))\n\n    return render_template(\n        'dashboard/dashboard_general.html', institute=arg_2, query=arg_3, arg_4=arg_4, **arg_5)", "path": "scout/server/blueprints/dashboard/views.py", "identifier": "index", "docstring": "Display the Scout dashboard.", "docstring_tokens": ["Display", "the", "Scout", "dashboard", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258499}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L176-L181", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Save a module as an import", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "modules", ".", "add", "(", "arg_1", ")", "arg_0", ".", "save_reduce", "(", "subimport", ",", "(", "arg_1", ".", "__name__", ",", ")", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Save a module as an import\n    \"\"\"\n    arg_0.modules.add(arg_1)\n    arg_0.save_reduce(subimport, (arg_1.__name__,), arg_1=arg_1)", "path": "heronpy/api/cloudpickle.py", "identifier": "CloudPickler.save_module", "docstring": "Save a module as an import", "docstring_tokens": ["Save", "a", "module", "as", "an", "import"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258500}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/tables.py#L40-L45", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Return an iteration over all name, color pairs in tables", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "yield", "from", "_TO_COLOR_USER", ".", "items", "(", ")", "for", "arg_0", ",", "arg_1", "in", "_TO_COLOR", ".", "items", "(", ")", ":", "if", "arg_0", "not", "in", "_TO_COLOR_USER", ":", "yield", "arg_0", ",", "arg_1"], "function": "def Func():\n    \"\"\"Return an iteration over all name, color pairs in tables\"\"\"\n    yield from _TO_COLOR_USER.items()\n    for arg_0, arg_1 in _TO_COLOR.items():\n        if arg_0 not in _TO_COLOR_USER:\n            yield arg_0, arg_1", "path": "bibliopixel/colors/tables.py", "identifier": "all_named_colors", "docstring": "Return an iteration over all name, color pairs in tables", "docstring_tokens": ["Return", "an", "iteration", "over", "all", "name", "color", "pairs", "in", "tables"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 258501}
{"url": "https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L26-L36", "sha": "9d0e8ebcba31d937f73752f9b88e5a4fec860765", "docstring_summary": "Return the key from MimicDB.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return super(Bucket, self).get_key(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_2", ".", "pop", "(", "'force'", ",", "None", ")", ":", "arg_3", "=", "arg_2", ".", "get", "(", "'headers'", ",", "{", "}", ")", "arg_3", "[", "'force'", "]", "=", "True", "arg_2", "[", "'headers'", "]", "=", "arg_3", "return", "super", "(", "Bucket", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Return the key from MimicDB.\n\n        :param boolean force: If true, API call is forced to S3\n        \"\"\"\n        if arg_2.pop('force', None):\n            arg_3 = arg_2.get('headers', {})\n            arg_3['force'] = True\n            arg_2['headers'] = arg_3\n\n        return super(Bucket, arg_0).Func(*arg_1, **arg_2)", "path": "mimicdb/s3/bucket.py", "identifier": "Bucket.get_key", "docstring": "Return the key from MimicDB.\n\n        :param boolean force: If true, API call is forced to S3", "docstring_tokens": ["Return", "the", "key", "from", "MimicDB", "."], "nwo": "nathancahill/mimicdb", "score": 0.18112697196067942, "idx": 258502}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/onset.py#L185-L333", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Compute a spectral flux onset strength envelope.", "language": "python", "parameters": "(y=None, sr=22050, S=None, lag=1, max_size=1,\n                   ref=None,\n                   detrend=False, center=True,\n                   feature=None, aggregate=None,\n                   centering=None,\n                   **kwargs)", "return_statement": "return odf_all[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "22050", ",", "arg_2", "=", "None", ",", "arg_3", "=", "1", ",", "arg_4", "=", "1", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "True", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "**", "arg_11", ")", ":", "if", "arg_9", "is", "False", ":", "raise", "ParameterError", "(", "'aggregate={} cannot be False when computing full-spectrum onset strength.'", ")", "arg_12", "=", "Func_multi", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "channels", "=", "None", ",", "**", "arg_11", ")", "return", "arg_12", "[", "0", "]"], "function": "def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=1, arg_4=1,\n                   arg_5=None,\n                   arg_6=False, arg_7=True,\n                   arg_8=None, arg_9=None,\n                   arg_10=None,\n                   **arg_11):\n    \"\"\"Compute a spectral flux onset strength envelope.\n\n    Onset strength at time `t` is determined by:\n\n    `mean_f max(0, S[f, t] - ref[f, t - lag])`\n\n    where `ref` is `S` after local max filtering along the frequency\n    axis [1]_.\n\n    By default, if a time series `y` is provided, S will be the\n    log-power Mel spectrogram.\n\n    .. [1] B\u00f6ck, Sebastian, and Gerhard Widmer.\n           \"Maximum filter vibrato suppression for onset detection.\"\n           16th International Conference on Digital Audio Effects,\n           Maynooth, Ireland. 2013.\n\n    Parameters\n    ----------\n    y        : np.ndarray [shape=(n,)]\n        audio time-series\n\n    sr       : number > 0 [scalar]\n        sampling rate of `y`\n\n    S        : np.ndarray [shape=(d, m)]\n        pre-computed (log-power) spectrogram\n\n    lag      : int > 0\n        time lag for computing differences\n\n    max_size : int > 0\n        size (in frequency bins) of the local max filter.\n        set to `1` to disable filtering.\n\n    ref : None or np.ndarray [shape=(d, m)]\n        An optional pre-computed reference spectrum, of the same shape as `S`.\n        If not provided, it will be computed from `S`.\n        If provided, it will override any local max filtering governed by `max_size`.\n\n    detrend : bool [scalar]\n        Filter the onset strength to remove the DC component\n\n    center : bool [scalar]\n        Shift the onset function by `n_fft / (2 * hop_length)` frames\n\n    feature : function\n        Function for computing time-series features, eg, scaled spectrograms.\n        By default, uses `librosa.feature.melspectrogram` with `fmax=11025.0`\n\n    aggregate : function\n        Aggregation function to use when combining onsets\n        at different frequency bins.\n\n        Default: `np.mean`\n\n    kwargs : additional keyword arguments\n        Additional parameters to `feature()`, if `S` is not provided.\n\n\n    Returns\n    -------\n    onset_envelope   : np.ndarray [shape=(m,)]\n        vector containing the onset strength envelope\n\n\n    Raises\n    ------\n    ParameterError\n        if neither `(y, sr)` nor `S` are provided\n\n        or if `lag` or `max_size` are not positive integers\n\n\n    See Also\n    --------\n    onset_detect\n    Func_multi\n\n\n    Examples\n    --------\n    First, load some audio and plot the spectrogram\n\n    >>> import matplotlib.pyplot as plt\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      duration=10.0)\n    >>> D = np.abs(librosa.stft(y))\n    >>> times = librosa.frames_to_time(np.arange(D.shape[1]))\n    >>> plt.figure()\n    >>> ax1 = plt.subplot(2, 1, 1)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),\n    ...                          y_axis='log', x_axis='time')\n    >>> plt.title('Power spectrogram')\n\n    Construct a standard onset function\n\n    >>> onset_env = librosa.onset.Func(y=y, sr=sr)\n    >>> plt.subplot(2, 1, 2, sharex=ax1)\n    >>> plt.plot(times, 2 + onset_env / onset_env.max(), alpha=0.8,\n    ...          label='Mean (mel)')\n\n\n    Median aggregation, and custom mel options\n\n    >>> onset_env = librosa.onset.Func(y=y, sr=sr,\n    ...                                          aggregate=np.median,\n    ...                                          fmax=8000, n_mels=256)\n    >>> plt.plot(times, 1 + onset_env / onset_env.max(), alpha=0.8,\n    ...          label='Median (custom mel)')\n\n\n    Constant-Q spectrogram instead of Mel\n\n    >>> onset_env = librosa.onset.Func(y=y, sr=sr,\n    ...                                          feature=librosa.cqt)\n    >>> plt.plot(times, onset_env / onset_env.max(), alpha=0.8,\n    ...          label='Mean (CQT)')\n    >>> plt.legend(frameon=True, framealpha=0.75)\n    >>> plt.ylabel('Normalized strength')\n    >>> plt.yticks([])\n    >>> plt.axis('tight')\n    >>> plt.tight_layout()\n\n    \"\"\"\n\n    if arg_9 is False:\n        raise ParameterError('aggregate={} cannot be False when computing full-spectrum onset strength.')\n\n    arg_12 = Func_multi(arg_0=arg_0,\n                                   arg_1=arg_1,\n                                   arg_2=arg_2,\n                                   arg_3=arg_3,\n                                   arg_4=arg_4,\n                                   arg_5=arg_5,\n                                   arg_6=arg_6,\n                                   arg_7=arg_7,\n                                   arg_8=arg_8,\n                                   arg_9=arg_9,\n                                   channels=None,\n                                   **arg_11)\n\n    return arg_12[0]", "path": "librosa/onset.py", "identifier": "onset_strength", "docstring": "Compute a spectral flux onset strength envelope.\n\n    Onset strength at time `t` is determined by:\n\n    `mean_f max(0, S[f, t] - ref[f, t - lag])`\n\n    where `ref` is `S` after local max filtering along the frequency\n    axis [1]_.\n\n    By default, if a time series `y` is provided, S will be the\n    log-power Mel spectrogram.\n\n    .. [1] B\u00f6ck, Sebastian, and Gerhard Widmer.\n           \"Maximum filter vibrato suppression for onset detection.\"\n           16th International Conference on Digital Audio Effects,\n           Maynooth, Ireland. 2013.\n\n    Parameters\n    ----------\n    y        : np.ndarray [shape=(n,)]\n        audio time-series\n\n    sr       : number > 0 [scalar]\n        sampling rate of `y`\n\n    S        : np.ndarray [shape=(d, m)]\n        pre-computed (log-power) spectrogram\n\n    lag      : int > 0\n        time lag for computing differences\n\n    max_size : int > 0\n        size (in frequency bins) of the local max filter.\n        set to `1` to disable filtering.\n\n    ref : None or np.ndarray [shape=(d, m)]\n        An optional pre-computed reference spectrum, of the same shape as `S`.\n        If not provided, it will be computed from `S`.\n        If provided, it will override any local max filtering governed by `max_size`.\n\n    detrend : bool [scalar]\n        Filter the onset strength to remove the DC component\n\n    center : bool [scalar]\n        Shift the onset function by `n_fft / (2 * hop_length)` frames\n\n    feature : function\n        Function for computing time-series features, eg, scaled spectrograms.\n        By default, uses `librosa.feature.melspectrogram` with `fmax=11025.0`\n\n    aggregate : function\n        Aggregation function to use when combining onsets\n        at different frequency bins.\n\n        Default: `np.mean`\n\n    kwargs : additional keyword arguments\n        Additional parameters to `feature()`, if `S` is not provided.\n\n\n    Returns\n    -------\n    onset_envelope   : np.ndarray [shape=(m,)]\n        vector containing the onset strength envelope\n\n\n    Raises\n    ------\n    ParameterError\n        if neither `(y, sr)` nor `S` are provided\n\n        or if `lag` or `max_size` are not positive integers\n\n\n    See Also\n    --------\n    onset_detect\n    onset_strength_multi\n\n\n    Examples\n    --------\n    First, load some audio and plot the spectrogram\n\n    >>> import matplotlib.pyplot as plt\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(),\n    ...                      duration=10.0)\n    >>> D = np.abs(librosa.stft(y))\n    >>> times = librosa.frames_to_time(np.arange(D.shape[1]))\n    >>> plt.figure()\n    >>> ax1 = plt.subplot(2, 1, 1)\n    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),\n    ...                          y_axis='log', x_axis='time')\n    >>> plt.title('Power spectrogram')\n\n    Construct a standard onset function\n\n    >>> onset_env = librosa.onset.onset_strength(y=y, sr=sr)\n    >>> plt.subplot(2, 1, 2, sharex=ax1)\n    >>> plt.plot(times, 2 + onset_env / onset_env.max(), alpha=0.8,\n    ...          label='Mean (mel)')\n\n\n    Median aggregation, and custom mel options\n\n    >>> onset_env = librosa.onset.onset_strength(y=y, sr=sr,\n    ...                                          aggregate=np.median,\n    ...                                          fmax=8000, n_mels=256)\n    >>> plt.plot(times, 1 + onset_env / onset_env.max(), alpha=0.8,\n    ...          label='Median (custom mel)')\n\n\n    Constant-Q spectrogram instead of Mel\n\n    >>> onset_env = librosa.onset.onset_strength(y=y, sr=sr,\n    ...                                          feature=librosa.cqt)\n    >>> plt.plot(times, onset_env / onset_env.max(), alpha=0.8,\n    ...          label='Mean (CQT)')\n    >>> plt.legend(frameon=True, framealpha=0.75)\n    >>> plt.ylabel('Normalized strength')\n    >>> plt.yticks([])\n    >>> plt.axis('tight')\n    >>> plt.tight_layout()", "docstring_tokens": ["Compute", "a", "spectral", "flux", "onset", "strength", "envelope", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258503}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_process_monitor.py#L93-L99", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Run command once and check exit code", "language": "python", "parameters": "(self)", "return_statement": "return self._is_sigsegv(self.return_code)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "arg_0", ".", "shutdown", ")", "arg_0", ".", "spawn", "(", "arg_0", ".", "config", ".", "process_to_monitor", ",", "timeout", "=", "0", ")", "return", "arg_0", ".", "_is_sigsegv", "(", "arg_0", ".", "return_code", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Run command once and check exit code\n        \"\"\"\n        signal.signal(signal.SIGINT, arg_0.shutdown)\n        arg_0.spawn(arg_0.config.process_to_monitor, timeout=0)\n        return arg_0._is_sigsegv(arg_0.return_code)", "path": "pyjfuzz/core/pjf_process_monitor.py", "identifier": "PJFProcessMonitor.run_and_monitor", "docstring": "Run command once and check exit code", "docstring_tokens": ["Run", "command", "once", "and", "check", "exit", "code"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 258504}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/get_stargazers.py#L147-L157", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Writes stargazers data to file.", "language": "python", "parameters": "(self, file_path='', date=(datetime.date.today()),\n        organization='llnl')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "(", "arg_3", ".", "date", ".", "today", "(", ")", ")", ",", "arg_5", "=", "'llnl'", ")", ":", "with", "open", "(", "arg_1", ",", "'w+'", ")", "as", "out", ":", "out", ".", "write", "(", "'date,organization,stargazers\\n'", ")", "arg_6", "=", "sorted", "(", "arg_0", ".", "stargazers", ")", "for", "arg_7", "in", "arg_6", ":", "out", ".", "write", "(", "arg_7", "+", "','", "+", "str", "(", "arg_0", ".", "stargazers", "[", "arg_7", "]", ")", "+", "'\\n'", ")", "out", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1='', arg_2=(arg_3.date.today()),\n        arg_5='llnl'):\n        \"\"\"\n        Writes stargazers data to file.\n        \"\"\"\n        with open(arg_1, 'w+') as out:\n            out.write('date,organization,stargazers\\n')\n            arg_6 = sorted(arg_0.stargazers)#sort based on lowercase\n            for arg_7 in arg_6:\n                out.write(arg_7 + ',' + str(arg_0.stargazers[arg_7]) + '\\n')\n        out.close()", "path": "scripts/get_stargazers.py", "identifier": "GitHub_Stargazers.write_to_file", "docstring": "Writes stargazers data to file.", "docstring_tokens": ["Writes", "stargazers", "data", "to", "file", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 258505}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mattermost.py#L234-L242", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse posts and returns in order.", "language": "python", "parameters": "(self, raw_posts)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "parse_json", "(", "arg_1", ")", "for", "arg_3", "in", "arg_2", "[", "'order'", "]", ":", "yield", "arg_2", "[", "'posts'", "]", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parse posts and returns in order.\"\"\"\n\n        arg_2 = arg_0.parse_json(arg_1)\n\n        # Posts are not sorted. The order is provided by\n        # 'order' key.\n        for arg_3 in arg_2['order']:\n            yield arg_2['posts'][arg_3]", "path": "perceval/backends/core/mattermost.py", "identifier": "Mattermost._parse_posts", "docstring": "Parse posts and returns in order.", "docstring_tokens": ["Parse", "posts", "and", "returns", "in", "order", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 258506}
{"url": "https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/colorful/colors.py#L56-L72", "sha": "919fa6da17865cc5e01e6b16119193a97d180dc9", "docstring_summary": "Parse a JSON color file.", "language": "python", "parameters": "(path)", "return_statement": "return color_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "\"r\"", ")", "as", "color_file", ":", "arg_1", "=", "json", ".", "load", "(", "color_file", ")", "arg_2", "=", "{", "c", "[", "\"name\"", "]", ":", "c", "[", "\"hex\"", "]", "for", "c", "in", "arg_1", "}", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Parse a JSON color file.\n\n    The JSON has to be in the following format:\n\n    .. code:: json\n\n       [{\"name\": \"COLOR_NAME\", \"hex\": \"#HEX\"}, ...]\n\n    :param str path: the path to the JSON color file\n    \"\"\"\n    with open(arg_0, \"r\") as color_file:\n        arg_1 = json.load(color_file)\n\n    # transform raw color list into color dict\n    arg_2 = {c[\"name\"]: c[\"hex\"] for c in arg_1}\n    return arg_2", "path": "colorful/colors.py", "identifier": "parse_json_color_file", "docstring": "Parse a JSON color file.\n\n    The JSON has to be in the following format:\n\n    .. code:: json\n\n       [{\"name\": \"COLOR_NAME\", \"hex\": \"#HEX\"}, ...]\n\n    :param str path: the path to the JSON color file", "docstring_tokens": ["Parse", "a", "JSON", "color", "file", "."], "nwo": "timofurrer/colorful", "score": 0.585749501312285, "idx": 258507}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/filters.py#L547-L618", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "r'''Return length of each filter in a constant-Q basis.", "language": "python", "parameters": "(sr, fmin, n_bins=84, bins_per_octave=12,\n                       tuning=0.0, window='hann', filter_scale=1)", "return_statement": "return lengths", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "84", ",", "arg_3", "=", "12", ",", "arg_4", "=", "0.0", ",", "arg_5", "=", "'hann'", ",", "arg_6", "=", "1", ")", ":", "if", "arg_1", "<=", "0", ":", "raise", "ParameterError", "(", "'fmin must be positive'", ")", "if", "arg_3", "<=", "0", ":", "raise", "ParameterError", "(", "'bins_per_octave must be positive'", ")", "if", "arg_6", "<=", "0", ":", "raise", "ParameterError", "(", "'filter_scale must be positive'", ")", "if", "arg_2", "<=", "0", "or", "not", "isinstance", "(", "arg_2", ",", "int", ")", ":", "raise", "ParameterError", "(", "'n_bins must be a positive integer'", ")", "arg_7", "=", "2.0", "**", "(", "float", "(", "arg_4", ")", "/", "arg_3", ")", "arg_1", "=", "arg_7", "*", "arg_1", "arg_8", "=", "float", "(", "arg_6", ")", "/", "(", "2.0", "**", "(", "1.", "/", "arg_3", ")", "-", "1", ")", "arg_9", "=", "arg_1", "*", "(", "2.0", "**", "(", "np", ".", "arange", "(", "arg_2", ",", "dtype", "=", "float", ")", "/", "arg_3", ")", ")", "if", "arg_9", "[", "-", "1", "]", "*", "(", "1", "+", "0.5", "*", "window_bandwidth", "(", "arg_5", ")", "/", "arg_8", ")", ">", "arg_0", "/", "2.0", ":", "raise", "ParameterError", "(", "'Filter pass-band lies beyond Nyquist'", ")", "arg_10", "=", "arg_8", "*", "arg_0", "/", "arg_9", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=84, arg_3=12,\n                       arg_4=0.0, arg_5='hann', arg_6=1):\n    r'''Return length of each filter in a constant-Q basis.\n\n    Parameters\n    ----------\n    sr : number > 0 [scalar]\n        Audio sampling rate\n\n    fmin : float > 0 [scalar]\n        Minimum frequency bin.\n\n    n_bins : int > 0 [scalar]\n        Number of frequencies.  Defaults to 7 octaves (84 bins).\n\n    bins_per_octave : int > 0 [scalar]\n        Number of bins per octave\n\n    tuning : float in `[-0.5, +0.5)` [scalar]\n        Tuning deviation from A440 in fractions of a bin\n\n    window : str or callable\n        Window function to use on filters\n\n    filter_scale : float > 0 [scalar]\n        Resolution of filter windows. Larger values use longer windows.\n\n    Returns\n    -------\n    lengths : np.ndarray\n        The length of each filter.\n\n    Notes\n    -----\n    This function caches at level 10.\n\n    See Also\n    --------\n    constant_q\n    librosa.core.cqt\n    '''\n\n    if arg_1 <= 0:\n        raise ParameterError('fmin must be positive')\n\n    if arg_3 <= 0:\n        raise ParameterError('bins_per_octave must be positive')\n\n    if arg_6 <= 0:\n        raise ParameterError('filter_scale must be positive')\n\n    if arg_2 <= 0 or not isinstance(arg_2, int):\n        raise ParameterError('n_bins must be a positive integer')\n\n    arg_7 = 2.0**(float(arg_4) / arg_3)\n\n    arg_1 = arg_7 * arg_1\n\n    # Q should be capitalized here, so we suppress the name warning\n    # pylint: disable=invalid-name\n    arg_8 = float(arg_6) / (2.0**(1. / arg_3) - 1)\n\n    # Compute the frequencies\n    arg_9 = arg_1 * (2.0 ** (np.arange(arg_2, dtype=float) / arg_3))\n\n    if arg_9[-1] * (1 + 0.5 * window_bandwidth(arg_5) / arg_8) > arg_0 / 2.0:\n        raise ParameterError('Filter pass-band lies beyond Nyquist')\n\n    # Convert frequencies to filter lengths\n    arg_10 = arg_8 * arg_0 / arg_9\n\n    return arg_10", "path": "librosa/filters.py", "identifier": "constant_q_lengths", "docstring": "r'''Return length of each filter in a constant-Q basis.\n\n    Parameters\n    ----------\n    sr : number > 0 [scalar]\n        Audio sampling rate\n\n    fmin : float > 0 [scalar]\n        Minimum frequency bin.\n\n    n_bins : int > 0 [scalar]\n        Number of frequencies.  Defaults to 7 octaves (84 bins).\n\n    bins_per_octave : int > 0 [scalar]\n        Number of bins per octave\n\n    tuning : float in `[-0.5, +0.5)` [scalar]\n        Tuning deviation from A440 in fractions of a bin\n\n    window : str or callable\n        Window function to use on filters\n\n    filter_scale : float > 0 [scalar]\n        Resolution of filter windows. Larger values use longer windows.\n\n    Returns\n    -------\n    lengths : np.ndarray\n        The length of each filter.\n\n    Notes\n    -----\n    This function caches at level 10.\n\n    See Also\n    --------\n    constant_q\n    librosa.core.cqt", "docstring_tokens": ["r", "Return", "length", "of", "each", "filter", "in", "a", "constant", "-", "Q", "basis", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258508}
{"url": "https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L267-L309", "sha": "2a725df0b727e8b08f217ab84f7b8243c42554f5", "docstring_summary": "Seek and return the region information.\n        Returns dict containing country_code and region_code.", "language": "python", "parameters": "(self, ipnum)", "return_statement": "return {'country_code': country_code, 'region_code': region_code}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "arg_3", "=", "None", "arg_4", "=", "arg_0", ".", "_seek_country", "(", "arg_1", ")", "def", "get_region_code", "(", "arg_5", ")", ":", "arg_6", "=", "chr", "(", "arg_5", "//", "26", "+", "65", ")", "arg_7", "=", "chr", "(", "arg_5", "%", "26", "+", "65", ")", "return", "''", ".", "join", "(", "[", "arg_6", ",", "arg_7", "]", ")", "if", "arg_0", ".", "_databaseType", "==", "const", ".", "REGION_EDITION_REV0", ":", "arg_8", "=", "arg_4", "-", "const", ".", "STATE_BEGIN_REV0", "if", "arg_8", ">=", "1000", ":", "arg_3", "=", "'US'", "arg_2", "=", "get_region_code", "(", "arg_8", "-", "1000", ")", "else", ":", "arg_3", "=", "const", ".", "COUNTRY_CODES", "[", "arg_8", "]", "elif", "arg_0", ".", "_databaseType", "==", "const", ".", "REGION_EDITION_REV1", ":", "arg_8", "=", "arg_4", "-", "const", ".", "STATE_BEGIN_REV1", "if", "arg_8", "<", "const", ".", "US_OFFSET", ":", "pass", "elif", "arg_8", "<", "const", ".", "CANADA_OFFSET", ":", "arg_3", "=", "'US'", "arg_2", "=", "get_region_code", "(", "arg_8", "-", "const", ".", "US_OFFSET", ")", "elif", "arg_8", "<", "const", ".", "WORLD_OFFSET", ":", "arg_3", "=", "'CA'", "arg_2", "=", "get_region_code", "(", "arg_8", "-", "const", ".", "CANADA_OFFSET", ")", "else", ":", "arg_9", "=", "(", "arg_8", "-", "const", ".", "WORLD_OFFSET", ")", "//", "const", ".", "FIPS_RANGE", "if", "arg_9", "<", "len", "(", "const", ".", "COUNTRY_CODES", ")", ":", "arg_3", "=", "const", ".", "COUNTRY_CODES", "[", "arg_9", "]", "elif", "arg_0", ".", "_databaseType", "in", "const", ".", "CITY_EDITIONS", ":", "arg_10", "=", "arg_0", ".", "_get_record", "(", "arg_1", ")", "arg_2", "=", "arg_10", ".", "get", "(", "'region_code'", ")", "arg_3", "=", "arg_10", ".", "get", "(", "'country_code'", ")", "return", "{", "'country_code'", ":", "arg_3", ",", "'region_code'", ":", "arg_2", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Seek and return the region information.\n        Returns dict containing country_code and region_code.\n\n        :arg ipnum: Result of ip2long conversion\n        \"\"\"\n        arg_2 = None\n        arg_3 = None\n        arg_4 = arg_0._seek_country(arg_1)\n\n        def get_region_code(arg_5):\n            arg_6 = chr(arg_5 // 26 + 65)\n            arg_7 = chr(arg_5 % 26 + 65)\n            return ''.join([arg_6, arg_7])\n\n        if arg_0._databaseType == const.REGION_EDITION_REV0:\n            arg_8 = arg_4 - const.STATE_BEGIN_REV0\n            if arg_8 >= 1000:\n                arg_3 = 'US'\n                arg_2 = get_region_code(arg_8 - 1000)\n            else:\n                arg_3 = const.COUNTRY_CODES[arg_8]\n        elif arg_0._databaseType == const.REGION_EDITION_REV1:\n            arg_8 = arg_4 - const.STATE_BEGIN_REV1\n            if arg_8 < const.US_OFFSET:\n                pass\n            elif arg_8 < const.CANADA_OFFSET:\n                arg_3 = 'US'\n                arg_2 = get_region_code(arg_8 - const.US_OFFSET)\n            elif arg_8 < const.WORLD_OFFSET:\n                arg_3 = 'CA'\n                arg_2 = get_region_code(arg_8 - const.CANADA_OFFSET)\n            else:\n                arg_9 = (arg_8 - const.WORLD_OFFSET) // const.FIPS_RANGE\n                if arg_9 < len(const.COUNTRY_CODES):\n                    arg_3 = const.COUNTRY_CODES[arg_9]\n        elif arg_0._databaseType in const.CITY_EDITIONS:\n            arg_10 = arg_0._get_record(arg_1)\n            arg_2 = arg_10.get('region_code')\n            arg_3 = arg_10.get('country_code')\n\n        return {'country_code': arg_3, 'region_code': arg_2}", "path": "pygeoip/__init__.py", "identifier": "GeoIP._get_region", "docstring": "Seek and return the region information.\n        Returns dict containing country_code and region_code.\n\n        :arg ipnum: Result of ip2long conversion", "docstring_tokens": ["Seek", "and", "return", "the", "region", "information", ".", "Returns", "dict", "containing", "country_code", "and", "region_code", "."], "nwo": "appliedsec/pygeoip", "score": 0.7204224841353906, "idx": 258509}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/common/message.py#L274-L284", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Add a specific enqueue time to the message.", "language": "python", "parameters": "(self, schedule_time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "properties", ".", "message_id", ":", "arg_0", ".", "properties", ".", "message_id", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "if", "not", "arg_0", ".", "message", ".", "annotations", ":", "arg_0", ".", "message", ".", "annotations", "=", "{", "}", "arg_0", ".", "message", ".", "annotations", "[", "arg_6", ".", "AMQPSymbol", "(", "arg_0", ".", "_x_OPT_SCHEDULED_ENQUEUE_TIME", ")", "]", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add a specific enqueue time to the message.\n\n        :param Func_time: The Funcd time to enqueue the message.\n        :type Func_time: ~datetime.datetime\n        \"\"\"\n        if not arg_0.properties.message_id:\n            arg_0.properties.message_id = str(uuid.uuid4())\n        if not arg_0.message.annotations:\n            arg_0.message.annotations = {}\n        arg_0.message.annotations[arg_6.AMQPSymbol(arg_0._x_OPT_SCHEDULED_ENQUEUE_TIME)] = arg_1", "path": "azure-servicebus/azure/servicebus/common/message.py", "identifier": "Message.schedule", "docstring": "Add a specific enqueue time to the message.\n\n        :param schedule_time: The scheduled time to enqueue the message.\n        :type schedule_time: ~datetime.datetime", "docstring_tokens": ["Add", "a", "specific", "enqueue", "time", "to", "the", "message", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258510}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L376-L384", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Load a state from storage identified by `state_id`.", "language": "python", "parameters": "(self, state_id, delete=True)", "return_statement": "return self._store.load_state(f'{self._prefix}{state_id:08x}{self._suffix}', delete=delete)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "return", "arg_0", ".", "_store", ".", "Func", "(", "f'{self._prefix}{state_id:08x}{self._suffix}'", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Load a state from storage identified by `state_id`.\n\n        :param state_id: The state reference of what to load\n        :return: The deserialized state\n        :rtype: State\n        \"\"\"\n        return arg_0._store.Func(f'{self._prefix}{state_id:08x}{self._suffix}', arg_2=arg_2)", "path": "manticore/core/workspace.py", "identifier": "Workspace.load_state", "docstring": "Load a state from storage identified by `state_id`.\n\n        :param state_id: The state reference of what to load\n        :return: The deserialized state\n        :rtype: State", "docstring_tokens": ["Load", "a", "state", "from", "storage", "identified", "by", "state_id", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258511}
{"url": "https://github.com/shaunduncan/giphypop/blob/21e7f51c4f000ae24be3805b7eeec52bcce3d390/giphypop.py#L548-L553", "sha": "21e7f51c4f000ae24be3805b7eeec52bcce3d390", "docstring_summary": "Shorthand for creating a Giphy api wrapper with the given api key\n    and then calling the screensaver method.", "language": "python", "parameters": "(tag=None, api_key=GIPHY_PUBLIC_KEY, strict=False)", "return_statement": "return Giphy(api_key=api_key, strict=strict).screensaver(tag=tag)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "False", ")", ":", "return", "Giphy", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", ".", "Func", "(", "arg_0", "=", "arg_0", ")"], "function": "def Func(arg_0=None, arg_1=arg_2, arg_3=False):\n    \"\"\"\n    Shorthand for creating a Giphy api wrapper with the given api key\n    and then calling the Func method.\n    \"\"\"\n    return Giphy(arg_1=arg_1, arg_3=arg_3).Func(arg_0=arg_0)", "path": "giphypop.py", "identifier": "screensaver", "docstring": "Shorthand for creating a Giphy api wrapper with the given api key\n    and then calling the screensaver method.", "docstring_tokens": ["Shorthand", "for", "creating", "a", "Giphy", "api", "wrapper", "with", "the", "given", "api", "key", "and", "then", "calling", "the", "screensaver", "method", "."], "nwo": "shaunduncan/giphypop", "score": 0.19428525902463561, "idx": 258512}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/thred.py#L54-L64", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Invert threading._active", "language": "python", "parameters": "()", "return_statement": "return name2id", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "{", "}", "for", "arg_1", "in", "list", "(", "threading", ".", "_active", ".", "keys", "(", ")", ")", ":", "arg_2", "=", "threading", ".", "_active", "[", "arg_1", "]", "arg_3", "=", "arg_2", ".", "getName", "(", ")", "if", "arg_3", "not", "in", "list", "(", "arg_0", ".", "keys", "(", ")", ")", ":", "arg_0", "[", "arg_3", "]", "=", "arg_1", "pass", "pass", "return", "arg_0"], "function": "def Func():\n    '''Invert threading._active'''\n    arg_0 = {}\n    for arg_1 in list(threading._active.keys()):\n        arg_2 = threading._active[arg_1]\n        arg_3 = arg_2.getName()\n        if arg_3 not in list(arg_0.keys()):\n            arg_0[arg_3] = arg_1\n            pass\n        pass\n    return arg_0", "path": "trepan/lib/thred.py", "identifier": "map_thread_names", "docstring": "Invert threading._active", "docstring_tokens": ["Invert", "threading", ".", "_active"], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 258513}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/_hand_written_parser.py#L142-L158", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "expression_terminal = identifier\n                           | terminal\n                           | option_group\n                           | repetition_group\n                           | grouping_group\n                           | special_handling ;", "language": "python", "parameters": "(self, text)", "return_statement": "return alternation([\n      self.identifier,\n      self.terminal,\n      self.option_group,\n      self.repetition_group,\n      self.grouping_group,\n      self.special_handling\n    ])(text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_attempting", "(", "arg_1", ")", "return", "alternation", "(", "[", "arg_0", ".", "identifier", ",", "arg_0", ".", "terminal", ",", "arg_0", ".", "option_group", ",", "arg_0", ".", "repetition_group", ",", "arg_0", ".", "grouping_group", ",", "arg_0", ".", "special_handling", "]", ")", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Func = identifier\n                           | terminal\n                           | option_group\n                           | repetition_group\n                           | grouping_group\n                           | special_handling ;\n    \"\"\"\n    arg_0._attempting(arg_1)\n    return alternation([\n      arg_0.identifier,\n      arg_0.terminal,\n      arg_0.option_group,\n      arg_0.repetition_group,\n      arg_0.grouping_group,\n      arg_0.special_handling\n    ])(arg_1)", "path": "pyebnf/_hand_written_parser.py", "identifier": "Parser.expression_terminal", "docstring": "expression_terminal = identifier\n                           | terminal\n                           | option_group\n                           | repetition_group\n                           | grouping_group\n                           | special_handling ;", "docstring_tokens": ["expression_terminal", "=", "identifier", "|", "terminal", "|", "option_group", "|", "repetition_group", "|", "grouping_group", "|", "special_handling", ";"], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 258514}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/writers/rdf.py#L112-L123", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return a node representing a disjunction of licenses.", "language": "python", "parameters": "(self, disjunction)", "return_statement": "return node", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "BNode", "(", ")", "arg_3", "=", "(", "arg_2", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", ".", "DisjunctiveLicenseSet", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "licenses_from_tree", "(", "arg_1", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "(", "arg_2", ",", "arg_0", ".", "spdx_namespace", ".", "member", ",", "arg_5", ")", "arg_0", ".", "graph", ".", "add", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a node representing a disjunction of licenses.\n        \"\"\"\n        arg_2 = BNode()\n        arg_3 = (arg_2, RDF.type, arg_0.spdx_namespace.DisjunctiveLicenseSet)\n        arg_0.graph.add(arg_3)\n        arg_4 = arg_0.licenses_from_tree(arg_1)\n        for arg_5 in arg_4:\n            arg_6 = (arg_2, arg_0.spdx_namespace.member, arg_5)\n            arg_0.graph.add(arg_6)\n        return arg_2", "path": "spdx/writers/rdf.py", "identifier": "LicenseWriter.create_disjunction_node", "docstring": "Return a node representing a disjunction of licenses.", "docstring_tokens": ["Return", "a", "node", "representing", "a", "disjunction", "of", "licenses", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 258515}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/galaxy/galaxy.py#L159-L180", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Compute the total luminosity of the galaxy's light profiles, within an ellipse of specified major axis. This \n        is performed via integration of each light profile and is centred, oriented and aligned with each light\n        model's individual geometry.", "language": "python", "parameters": "(self, major_axis : dim.Length, unit_luminosity='eps', kpc_per_arcsec=None, exposure_time=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Length", ",", "arg_4", "=", "'eps'", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "if", "arg_0", ".", "has_light_profile", ":", "return", "sum", "(", "map", "(", "lambda", "p", ":", "p", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", ",", "arg_0", ".", "light_profiles", ")", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1 : arg_2.Length, arg_4='eps', arg_5=None, arg_6=None):\n        \"\"\"Compute the total luminosity of the galaxy's light profiles, within an ellipse of specified major axis. This \n        is performed via integration of each light profile and is centred, oriented and aligned with each light\n        model's individual geometry.\n\n        See *light_profiles.luminosity_within_ellipse* for details of how this is performed.\n\n        Parameters\n        ----------\n        major_axis : float\n            The major-axis radius of the ellipse.\n        unit_luminosity : str\n            The units the luminosity is returned in (eps | counts).\n        exposure_time : float\n            The exposure time of the observation, which converts luminosity from electrons per second units to counts.\n        \"\"\"\n        if arg_0.has_light_profile:\n            return sum(map(lambda p: p.Func(arg_1=arg_1, arg_4=arg_4,\n                                                                          arg_5=arg_5, arg_6=arg_6),\n                           arg_0.light_profiles))\n        else:\n            return None", "path": "autolens/model/galaxy/galaxy.py", "identifier": "Galaxy.luminosity_within_ellipse_in_units", "docstring": "Compute the total luminosity of the galaxy's light profiles, within an ellipse of specified major axis. This \n        is performed via integration of each light profile and is centred, oriented and aligned with each light\n        model's individual geometry.\n\n        See *light_profiles.luminosity_within_ellipse* for details of how this is performed.\n\n        Parameters\n        ----------\n        major_axis : float\n            The major-axis radius of the ellipse.\n        unit_luminosity : str\n            The units the luminosity is returned in (eps | counts).\n        exposure_time : float\n            The exposure time of the observation, which converts luminosity from electrons per second units to counts.", "docstring_tokens": ["Compute", "the", "total", "luminosity", "of", "the", "galaxy", "s", "light", "profiles", "within", "an", "ellipse", "of", "specified", "major", "axis", ".", "This", "is", "performed", "via", "integration", "of", "each", "light", "profile", "and", "is", "centred", "oriented", "and", "aligned", "with", "each", "light", "model", "s", "individual", "geometry", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 258516}
{"url": "https://github.com/lvh/txampext/blob/a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9/txampext/jsondialect.py#L80-L108", "sha": "a7d6cb9f1e9200dba597378cd40eb6a2096d4fd9", "docstring_summary": "Run the responser function. If it succeeds, add the _answer key.\n        If it fails with an error known to the command, serialize the\n        error.", "language": "python", "parameters": "(self, responder, request, command, identifier)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "defer", ".", "maybeDeferred", "(", "arg_1", ",", "**", "arg_2", ")", "def", "_addIdentifier", "(", "arg_6", ")", ":", "arg_6", "[", "\"_answer\"", "]", "=", "arg_4", "return", "arg_6", "def", "_serializeFailure", "(", "arg_7", ")", ":", "arg_8", "=", "arg_7", ".", "trap", "(", "*", "arg_3", ".", "allErrors", ")", "arg_6", "=", "{", "\"_error_code\"", ":", "arg_3", ".", "allErrors", "[", "arg_8", "]", ",", "\"_error_description\"", ":", "str", "(", "arg_7", ".", "value", ")", ",", "\"_error\"", ":", "arg_4", "}", "return", "arg_6", "arg_5", ".", "addCallbacks", "(", "_addIdentifier", ",", "_serializeFailure", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Run the responser function. If it succeeds, add the _answer key.\n        If it fails with an error known to the command, serialize the\n        error.\n\n        \"\"\"\n        arg_5 = defer.maybeDeferred(arg_1, **arg_2)\n\n        def _addIdentifier(arg_6):\n            \"\"\"Return the response with an ``_answer`` key.\n\n            \"\"\"\n            arg_6[\"_answer\"] = arg_4\n            return arg_6\n\n        def _serializeFailure(arg_7):\n            \"\"\"\n            If the failure is serializable by this AMP command, serialize it.\n            \"\"\"\n            arg_8 = arg_7.trap(*arg_3.allErrors)\n            arg_6 = {\n                \"_error_code\": arg_3.allErrors[arg_8],\n                \"_error_description\": str(arg_7.value),\n                \"_error\": arg_4\n            }\n            return arg_6\n\n        arg_5.addCallbacks(_addIdentifier, _serializeFailure)\n        return arg_5", "path": "txampext/jsondialect.py", "identifier": "JSONAMPDialectReceiver._runResponder", "docstring": "Run the responser function. If it succeeds, add the _answer key.\n        If it fails with an error known to the command, serialize the\n        error.", "docstring_tokens": ["Run", "the", "responser", "function", ".", "If", "it", "succeeds", "add", "the", "_answer", "key", ".", "If", "it", "fails", "with", "an", "error", "known", "to", "the", "command", "serialize", "the", "error", "."], "nwo": "lvh/txampext", "score": 0.09252797783733271, "idx": 258517}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/hosts/__init__.py#L14-L23", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Given a port spec, update the hosts file specified at\n    constants.HOST_PATH to contain the port mappings specified\n    in the spec. Any existing Dusty configurations are replaced.", "language": "python", "parameters": "(port_spec)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logging", ".", "info", "(", "'Updating hosts file to match port spec'", ")", "arg_1", "=", "arg_0", "[", "'hosts_file'", "]", "arg_2", "=", "config_file", ".", "read", "(", "constants", ".", "HOSTS_PATH", ")", "arg_3", "=", "config_file", ".", "remove_current_dusty_config", "(", "arg_2", ")", "arg_4", "=", "arg_3", "+", "_dusty_hosts_config", "(", "arg_1", ")", "config_file", ".", "write", "(", "constants", ".", "HOSTS_PATH", ",", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"Given a port spec, update the hosts file specified at\n    constants.HOST_PATH to contain the port mappings specified\n    in the spec. Any existing Dusty configurations are replaced.\"\"\"\n    logging.info('Updating hosts file to match port spec')\n    arg_1 = arg_0['hosts_file']\n    arg_2 = config_file.read(constants.HOSTS_PATH)\n    arg_3 = config_file.remove_current_dusty_config(arg_2)\n    arg_4 = arg_3 + _dusty_hosts_config(arg_1)\n    config_file.write(constants.HOSTS_PATH, arg_4)", "path": "dusty/systems/hosts/__init__.py", "identifier": "update_hosts_file_from_port_spec", "docstring": "Given a port spec, update the hosts file specified at\n    constants.HOST_PATH to contain the port mappings specified\n    in the spec. Any existing Dusty configurations are replaced.", "docstring_tokens": ["Given", "a", "port", "spec", "update", "the", "hosts", "file", "specified", "at", "constants", ".", "HOST_PATH", "to", "contain", "the", "port", "mappings", "specified", "in", "the", "spec", ".", "Any", "existing", "Dusty", "configurations", "are", "replaced", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 258518}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L785-L813", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return a list of zoom levels.", "language": "python", "parameters": "(zooms)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "if", "any", "(", "[", "arg_1", "not", "in", "arg_0", "for", "arg_1", "in", "[", "\"min\"", ",", "\"max\"", "]", "]", ")", ":", "raise", "MapcheteConfigError", "(", "\"min and max zoom required\"", ")", "arg_2", "=", "_validate_zoom", "(", "arg_0", "[", "\"min\"", "]", ")", "arg_3", "=", "_validate_zoom", "(", "arg_0", "[", "\"max\"", "]", ")", "if", "arg_2", ">", "arg_3", ":", "raise", "MapcheteConfigError", "(", "\"max zoom must not be smaller than min zoom\"", ")", "return", "list", "(", "range", "(", "arg_2", ",", "arg_3", "+", "1", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "list", ")", ":", "if", "len", "(", "arg_0", ")", "==", "1", ":", "return", "arg_0", "elif", "len", "(", "arg_0", ")", "==", "2", ":", "arg_2", ",", "arg_3", "=", "sorted", "(", "[", "_validate_zoom", "(", "z", ")", "for", "z", "in", "arg_0", "]", ")", "return", "list", "(", "range", "(", "arg_2", ",", "arg_3", "+", "1", ")", ")", "else", ":", "return", "arg_0", "else", ":", "return", "[", "_validate_zoom", "(", "arg_0", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Return a list of zoom levels.\n\n    Following inputs are converted:\n    - int --> [int]\n    - dict{min, max} --> range(min, max + 1)\n    - [int] --> [int]\n    - [int, int] --> range(smaller int, bigger int + 1)\n    \"\"\"\n    if isinstance(arg_0, dict):\n        if any([arg_1 not in arg_0 for arg_1 in [\"min\", \"max\"]]):\n            raise MapcheteConfigError(\"min and max zoom required\")\n        arg_2 = _validate_zoom(arg_0[\"min\"])\n        arg_3 = _validate_zoom(arg_0[\"max\"])\n        if arg_2 > arg_3:\n            raise MapcheteConfigError(\n                \"max zoom must not be smaller than min zoom\")\n        return list(range(arg_2, arg_3 + 1))\n    elif isinstance(arg_0, list):\n        if len(arg_0) == 1:\n            return arg_0\n        elif len(arg_0) == 2:\n            arg_2, arg_3 = sorted([_validate_zoom(z) for z in arg_0])\n            return list(range(arg_2, arg_3 + 1))\n        else:\n            return arg_0\n    else:\n        return [_validate_zoom(arg_0)]", "path": "mapchete/config.py", "identifier": "_validate_zooms", "docstring": "Return a list of zoom levels.\n\n    Following inputs are converted:\n    - int --> [int]\n    - dict{min, max} --> range(min, max + 1)\n    - [int] --> [int]\n    - [int, int] --> range(smaller int, bigger int + 1)", "docstring_tokens": ["Return", "a", "list", "of", "zoom", "levels", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 258519}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/third_party/roi_pooling/roi_pooling/roi_pooling_ops.py#L12-L23", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "returns a tensorflow operation for computing the Region of Interest Pooling", "language": "python", "parameters": "(input, rois, pool_height, pool_width)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "Func_module", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_5", ",", "arg_6", "=", "arg_4", "[", "0", "]", ",", "arg_4", "[", "1", "]", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n      returns a tensorflow operation for computing the Region of Interest Pooling\n    \n      @arg input: feature maps on which to perform the pooling operation\n      @arg rois: list of regions of interest in the format (feature map index, upper left, bottom right)\n      @arg pool_width: size of the pooling sections\n    \"\"\"\n    # TODO(maciek): ops scope\n    arg_4 = Func_module.Func(arg_0, arg_1, arg_2=arg_2, arg_3=arg_3)\n    arg_5, arg_6 = arg_4[0], arg_4[1]\n    return arg_5", "path": "tensorlayer/third_party/roi_pooling/roi_pooling/roi_pooling_ops.py", "identifier": "roi_pooling", "docstring": "returns a tensorflow operation for computing the Region of Interest Pooling\n    \n      @arg input: feature maps on which to perform the pooling operation\n      @arg rois: list of regions of interest in the format (feature map index, upper left, bottom right)\n      @arg pool_width: size of the pooling sections", "docstring_tokens": ["returns", "a", "tensorflow", "operation", "for", "computing", "the", "Region", "of", "Interest", "Pooling"], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 258520}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L248-L270", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the phase's magnetic contribution to heat capacity at the\n        specified temperature.", "language": "python", "parameters": "(self, T)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "/", "arg_0", ".", "Tc_mag", "if", "arg_2", "<=", "1.0", ":", "arg_3", "=", "(", "arg_0", ".", "_B_mag", "*", "(", "2", "*", "arg_2", "**", "3", "+", "2", "*", "arg_2", "**", "9", "/", "3", "+", "2", "*", "arg_2", "**", "15", "/", "5", ")", ")", "/", "arg_0", ".", "_D_mag", "else", ":", "arg_3", "=", "(", "2", "*", "arg_2", "**", "-", "5", "+", "2", "*", "arg_2", "**", "-", "15", "/", "3", "+", "2", "*", "arg_2", "**", "-", "25", "/", "5", ")", "/", "arg_0", ".", "_D_mag", "arg_4", "=", "R", "*", "math", ".", "log", "(", "arg_0", ".", "beta0_mag", "+", "1", ")", "*", "arg_3", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the phase's magnetic contribution to heat capacity at the\n        specified temperature.\n\n        :param T: [K] temperature\n\n        :returns: [J/mol/K] The magnetic heat capacity of the compound phase.\n\n        Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4),\n        317\u2013425. http://doi.org/10.1016/0364-5916(91)90030-N\n        \"\"\"\n\n        arg_2 = arg_1 / arg_0.Tc_mag\n\n        if arg_2 <= 1.0:\n            arg_3 = (arg_0._B_mag*(2*arg_2**3 + 2*arg_2**9/3 + 2*arg_2**15/5))/arg_0._D_mag\n        else:\n            arg_3 = (2*arg_2**-5 + 2*arg_2**-15/3 + 2*arg_2**-25/5)/arg_0._D_mag\n\n        arg_4 = R*math.log(arg_0.beta0_mag + 1)*arg_3\n\n        return arg_4", "path": "auxi/tools/chemistry/thermochemistry.py", "identifier": "Phase.Cp_mag", "docstring": "Calculate the phase's magnetic contribution to heat capacity at the\n        specified temperature.\n\n        :param T: [K] temperature\n\n        :returns: [J/mol/K] The magnetic heat capacity of the compound phase.\n\n        Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4),\n        317\u2013425. http://doi.org/10.1016/0364-5916(91)90030-N", "docstring_tokens": ["Calculate", "the", "phase", "s", "magnetic", "contribution", "to", "heat", "capacity", "at", "the", "specified", "temperature", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 258521}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/match.py#L127-L131", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "The plasma density in SI units.", "language": "python", "parameters": "(self)", "return_statement": "return 2*_sltr.GeV2joule(self.E)*_spc.epsilon_0 / (self.beta*_spc.elementary_charge)**2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "2", "*", "_sltr", ".", "GeV2joule", "(", "arg_0", ".", "E", ")", "*", "_spc", ".", "epsilon_0", "/", "(", "arg_0", ".", "beta", "*", "_spc", ".", "elementary_charge", ")", "**", "2"], "function": "def Func(arg_0):\n        \"\"\"\n        The plasma density in SI units.\n        \"\"\"\n        return 2*_sltr.GeV2joule(arg_0.E)*_spc.epsilon_0 / (arg_0.beta*_spc.elementary_charge)**2", "path": "scisalt/PWFA/match.py", "identifier": "MatchPlasma.n_p", "docstring": "The plasma density in SI units.", "docstring_tokens": ["The", "plasma", "density", "in", "SI", "units", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 258522}
{"url": "https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L425-L433", "sha": "b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b", "docstring_summary": "Returns the last child of this node.", "language": "python", "parameters": "(self, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "for", "arg_2", "in", "arg_0", ".", "children", "(", "arg_1", ",", "reverse", "=", "True", ")", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Returns the Func child of this node.\n\n        :param name: If specified, only consider elements with this tag name\n        :rtype: :class:`XmlElement`\n        \"\"\"\n        for arg_2 in arg_0.children(arg_1, reverse=True):\n            return arg_2", "path": "drill.py", "identifier": "XmlElement.last", "docstring": "Returns the last child of this node.\n\n        :param name: If specified, only consider elements with this tag name\n        :rtype: :class:`XmlElement`", "docstring_tokens": ["Returns", "the", "last", "child", "of", "this", "node", "."], "nwo": "dcwatson/drill", "score": 0.14991498758945482, "idx": 258523}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L259-L279", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Deletes a database from a Cloud SQL instance.", "language": "python", "parameters": "(self, instance, database, project_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "get_conn", "(", ")", ".", "databases", "(", ")", ".", "delete", "(", "project", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "arg_5", "=", "arg_4", "[", "\"name\"", "]", "arg_0", ".", "_wait_for_operation_to_complete", "(", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Deletes a database from a Cloud SQL instance.\n\n        :param instance: Database instance ID. This does not include the project ID.\n        :type instance: str\n        :param database: Name of the database to be deleted in the instance.\n        :type database: str\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None\n        \"\"\"\n        arg_4 = arg_0.get_conn().databases().delete(\n            project=arg_3,\n            arg_1=arg_1,\n            arg_2=arg_2\n        ).execute(num_retries=arg_0.num_retries)\n        arg_5 = arg_4[\"name\"]\n        arg_0._wait_for_operation_to_complete(arg_3=arg_3,\n                                             arg_5=arg_5)", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlHook.delete_database", "docstring": "Deletes a database from a Cloud SQL instance.\n\n        :param instance: Database instance ID. This does not include the project ID.\n        :type instance: str\n        :param database: Name of the database to be deleted in the instance.\n        :type database: str\n        :param project_id: Project ID of the project that contains the instance. If set\n            to None or missing, the default project_id from the GCP connection is used.\n        :type project_id: str\n        :return: None", "docstring_tokens": ["Deletes", "a", "database", "from", "a", "Cloud", "SQL", "instance", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258524}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L278-L286", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Copy an existing notebook and return its notebook_id.", "language": "python", "parameters": "(self, notebook_id)", "return_statement": "return notebook_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "get_notebook_object", "(", "arg_1", ")", "arg_4", "=", "arg_3", ".", "metadata", ".", "name", "+", "'-Copy'", "arg_5", ",", "arg_4", "=", "arg_0", ".", "increment_filename", "(", "arg_4", ")", "arg_3", ".", "metadata", ".", "name", "=", "arg_4", "arg_1", "=", "arg_0", ".", "new_notebook_id", "(", "arg_4", ")", "arg_0", ".", "save_notebook_object", "(", "arg_1", ",", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Copy an existing notebook and return its notebook_id.\"\"\"\n        arg_2, arg_3 = arg_0.get_notebook_object(arg_1)\n        arg_4 = arg_3.metadata.name + '-Copy'\n        arg_5, arg_4 = arg_0.increment_filename(arg_4)\n        arg_3.metadata.name = arg_4\n        arg_1 = arg_0.new_notebook_id(arg_4)\n        arg_0.save_notebook_object(arg_1, arg_3)\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py", "identifier": "NotebookManager.copy_notebook", "docstring": "Copy an existing notebook and return its notebook_id.", "docstring_tokens": ["Copy", "an", "existing", "notebook", "and", "return", "its", "notebook_id", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258525}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/query.py#L278-L297", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Adds genomic coordinated-related filters to the query object", "language": "python", "parameters": "(self, query, mongo_query)", "return_statement": "return mongo_query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "LOG", ".", "debug", "(", "'Adding genomic coordinates to the query'", ")", "arg_3", "=", "arg_1", "[", "'chrom'", "]", "arg_2", "[", "'chromosome'", "]", "=", "arg_3", "if", "(", "arg_1", ".", "get", "(", "'start'", ")", "and", "arg_1", ".", "get", "(", "'end'", ")", ")", ":", "arg_2", "[", "'position'", "]", "=", "{", "'$lte'", ":", "int", "(", "arg_1", "[", "'end'", "]", ")", "}", "arg_2", "[", "'end'", "]", "=", "{", "'$gte'", ":", "int", "(", "arg_1", "[", "'start'", "]", ")", "}", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Adds genomic coordinated-related filters to the query object\n\n        Args:\n            query(dict): a dictionary of query filters specified by the users\n            mongo_query(dict): the query that is going to be submitted to the database\n\n        Returns:\n            mongo_query(dict): returned object contains coordinate filters\n\n        \"\"\"\n        LOG.debug('Adding genomic coordinates to the query')\n        arg_3 = arg_1['chrom']\n        arg_2['chromosome'] = arg_3\n\n        if (arg_1.get('start') and arg_1.get('end')):\n            arg_2['position'] = {'$lte': int(arg_1['end'])}\n            arg_2['end'] = {'$gte': int(arg_1['start'])}\n\n        return arg_2", "path": "scout/adapter/mongo/query.py", "identifier": "QueryHandler.coordinate_filter", "docstring": "Adds genomic coordinated-related filters to the query object\n\n        Args:\n            query(dict): a dictionary of query filters specified by the users\n            mongo_query(dict): the query that is going to be submitted to the database\n\n        Returns:\n            mongo_query(dict): returned object contains coordinate filters", "docstring_tokens": ["Adds", "genomic", "coordinated", "-", "related", "filters", "to", "the", "query", "object"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258526}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L967-L1016", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Worker to distribute work to jit funcs. Wraps everything on an \n    engine to run single-threaded to maximize efficiency for \n    multi-processing.", "language": "python", "parameters": "(data, chunk)", "return_statement": "return rquartets, rinvariants", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "set_mkl_thread_limit", "(", "1", ")", "with", "h5py", ".", "File", "(", "arg_0", ".", "database", ".", "input", ",", "'r'", ")", "as", "io5", ":", "arg_3", "=", "io5", "[", "\"bootsarr\"", "]", "[", ":", "]", "arg_4", "=", "io5", "[", "\"bootsmap\"", "]", "[", ":", ",", "0", "]", "arg_5", "=", "io5", "[", "\"quartets\"", "]", "[", "arg_1", ":", "arg_1", "+", "arg_0", ".", "_chunksize", "]", "arg_6", "=", "arg_3", "[", ":", "]", "==", "78", "arg_7", "=", "np", ".", "zeros", "(", "(", "arg_5", ".", "shape", "[", "0", "]", ",", "4", ")", ",", "dtype", "=", "np", ".", "uint16", ")", "arg_8", "=", "np", ".", "zeros", "(", "(", "arg_5", ".", "shape", "[", "0", "]", ",", "16", ",", "16", ")", ",", "dtype", "=", "np", ".", "uint16", ")", "for", "arg_9", "in", "xrange", "(", "arg_5", ".", "shape", "[", "0", "]", ")", ":", "arg_10", "=", "arg_5", "[", "arg_9", "]", "arg_11", "=", "arg_3", "[", "arg_10", "]", "arg_12", "=", "np", ".", "any", "(", "arg_6", "[", "arg_10", "]", ",", "axis", "=", "0", ")", "arg_12", "+=", "np", ".", "all", "(", "arg_11", "==", "arg_11", "[", "0", "]", ",", "axis", "=", "0", ")", "arg_13", ",", "arg_14", "=", "calculate", "(", "arg_11", ",", "arg_4", ",", "arg_12", ",", "TESTS", ")", "arg_7", "[", "arg_9", "]", "=", "arg_5", "[", "arg_9", "]", "[", "arg_13", "]", "arg_8", "[", "arg_9", "]", "=", "arg_14", "set_mkl_thread_limit", "(", "arg_2", ")", "return", "arg_7", ",", "arg_8"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Worker to distribute work to jit funcs. Wraps everything on an \n    engine to run single-threaded to maximize efficiency for \n    multi-processing.\n    \"\"\"\n\n    ## set the thread limit on the remote engine\n    arg_2 = set_mkl_thread_limit(1)\n\n    ## open seqarray view, the modified arr is in bootstarr\n    with h5py.File(arg_0.database.input, 'r') as io5:\n        arg_3 = io5[\"bootsarr\"][:]\n        arg_4 = io5[\"bootsmap\"][:, 0]\n        arg_5 = io5[\"quartets\"][arg_1:arg_1+arg_0._chunksize]\n\n        ## create an N-mask array of all seq cols\n        arg_6 = arg_3[:] == 78\n\n    ## init arrays to fill with results\n    arg_7 = np.zeros((arg_5.shape[0], 4), dtype=np.uint16)\n    arg_8 = np.zeros((arg_5.shape[0], 16, 16), dtype=np.uint16)\n\n    ## fill arrays with results as we compute them. This iterates\n    ## over all of the quartet sets in this sample chunk. It would\n    ## be nice to have this all numbified.\n    for arg_9 in xrange(arg_5.shape[0]):\n        arg_10 = arg_5[arg_9]\n        arg_11 = arg_3[arg_10]\n\n        ## these axis calls cannot be numbafied, but I can't \n        ## find a faster way that is JIT compiled, and I've\n        ## really, really, really tried. Tried again now that\n        ## numba supports axis args for np.sum. Still can't \n        ## get speed improvements by numbifying this loop.\n        arg_12 = np.any(arg_6[arg_10], axis=0)\n        arg_12 += np.all(arg_11 == arg_11[0], axis=0) \n\n        ## here are the jitted funcs\n        arg_13, arg_14 = calculate(arg_11, arg_4, arg_12, TESTS)\n\n        ## store results\n        arg_7[arg_9] = arg_5[arg_9][arg_13]\n        arg_8[arg_9] = arg_14\n\n    ## reset thread limit\n    set_mkl_thread_limit(arg_2)\n\n    ## return results...\n    return arg_7, arg_8", "path": "ipyrad/analysis/tetrad2.py", "identifier": "nworker", "docstring": "Worker to distribute work to jit funcs. Wraps everything on an \n    engine to run single-threaded to maximize efficiency for \n    multi-processing.", "docstring_tokens": ["Worker", "to", "distribute", "work", "to", "jit", "funcs", ".", "Wraps", "everything", "on", "an", "engine", "to", "run", "single", "-", "threaded", "to", "maximize", "efficiency", "for", "multi", "-", "processing", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258527}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/management/commands/createproject.py#L22-L39", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Checks if we can create the project", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "try_import", "(", "arg_0", ".", "project_name", ")", "arg_0", ".", "validate_name", "(", "arg_0", ".", "project_name", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "project_name", ")", ":", "print", "(", "\"Directory {} already exist. Aborting.\"", ".", "format", "(", "arg_0", ".", "project_name", ")", ")", "return", "False", "if", "os", ".", "path", ".", "exists", "(", "'manage.py'", ")", ":", "print", "(", "\"A manage.py file already exist in the current directory. Aborting.\"", ")", "return", "False", "return", "True"], "function": "def Func(arg_0):\r\n        \"\"\"Checks if we can create the project\"\"\"\r\n        # Check for python module collision\r\n        arg_0.try_import(arg_0.project_name)\r\n\r\n        # Is the name a valid identifier?\r\n        arg_0.validate_name(arg_0.project_name)\r\n\r\n        # Make sure we don't mess with existing directories\r\n        if os.path.exists(arg_0.project_name):\r\n            print(\"Directory {} already exist. Aborting.\".format(arg_0.project_name))\r\n            return False\r\n\r\n        if os.path.exists('manage.py'):\r\n            print(\"A manage.py file already exist in the current directory. Aborting.\")\r\n            return False\r\n\r\n        return True", "path": "demosys/management/commands/createproject.py", "identifier": "Command.initial_sanity_check", "docstring": "Checks if we can create the project", "docstring_tokens": ["Checks", "if", "we", "can", "create", "the", "project"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 258528}
{"url": "https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/forestci.py#L135-L164", "sha": "401c63a74a27d775eff0f72b6c20ffd568491fe0", "docstring_summary": "Helper functions that implements bias correction", "language": "python", "parameters": "(V_IJ, inbag, pred_centered, n_trees)", "return_statement": "return V_IJ_unbiased", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "shape", "[", "0", "]", "arg_5", "=", "np", ".", "mean", "(", "np", ".", "square", "(", "arg_1", "[", "0", ":", "arg_3", "]", ")", ".", "mean", "(", "axis", "=", "1", ")", ".", "T", ".", "view", "(", ")", "-", "np", ".", "square", "(", "arg_1", "[", "0", ":", "arg_3", "]", ".", "mean", "(", "axis", "=", "1", ")", ")", ".", "T", ".", "view", "(", ")", ")", "arg_6", "=", "np", ".", "square", "(", "arg_2", ")", ".", "sum", "(", "axis", "=", "1", ")", "/", "arg_3", "arg_7", "=", "arg_4", "*", "arg_5", "*", "arg_6", "/", "arg_3", "arg_8", "=", "arg_0", "-", "arg_7", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Helper functions that implements bias correction\n\n    Parameters\n    ----------\n    V_IJ : ndarray\n        Intermediate result in the computation.\n\n    inbag : ndarray\n        The inbag matrix that fit the data. If set to `None` (default) it\n        will be inferred from the forest. However, this only works for trees\n        for which bootstrapping was set to `True`. That is, if sampling was\n        done with replacement. Otherwise, users need to provide their own\n        inbag matrix.\n\n    pred_centered : ndarray\n        Centered predictions that are an intermediate result in the\n        computation.\n\n    n_trees : int\n        The number of trees in the forest object.\n    \"\"\"\n    arg_4 = arg_1.shape[0]\n    arg_5 = np.mean(np.square(arg_1[0:arg_3]).mean(axis=1).T.view() -\n                    np.square(arg_1[0:arg_3].mean(axis=1)).T.view())\n    arg_6 = np.square(arg_2).sum(axis=1) / arg_3\n    arg_7 = arg_4 * arg_5 * arg_6 / arg_3\n    arg_8 = arg_0 - arg_7\n    return arg_8", "path": "forestci/forestci.py", "identifier": "_bias_correction", "docstring": "Helper functions that implements bias correction\n\n    Parameters\n    ----------\n    V_IJ : ndarray\n        Intermediate result in the computation.\n\n    inbag : ndarray\n        The inbag matrix that fit the data. If set to `None` (default) it\n        will be inferred from the forest. However, this only works for trees\n        for which bootstrapping was set to `True`. That is, if sampling was\n        done with replacement. Otherwise, users need to provide their own\n        inbag matrix.\n\n    pred_centered : ndarray\n        Centered predictions that are an intermediate result in the\n        computation.\n\n    n_trees : int\n        The number of trees in the forest object.", "docstring_tokens": ["Helper", "functions", "that", "implements", "bias", "correction"], "nwo": "scikit-learn-contrib/forest-confidence-interval", "score": 0.5087559176222483, "idx": 258529}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/views/rest.py#L409-L425", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Handle DELETE deposit file.", "language": "python", "parameters": "(self, pid, record, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "try", ":", "del", "arg_2", ".", "files", "[", "str", "(", "arg_3", ")", "]", "arg_2", ".", "commit", "(", ")", "db", ".", "session", ".", "commit", "(", ")", "return", "make_response", "(", "''", ",", "204", ")", "except", "KeyError", ":", "abort", "(", "404", ",", "'The specified object does not exist or has already '", "'been Funcd.'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Handle DELETE deposit file.\n\n        Permission required: `update_permission_factory`.\n\n        :param pid: Pid object (from url).\n        :param record: Record object resolved from the pid.\n        :param key: Unique identifier for the file in the deposit.\n        \"\"\"\n        try:\n            del arg_2.files[str(arg_3)]\n            arg_2.commit()\n            db.session.commit()\n            return make_response('', 204)\n        except KeyError:\n            abort(404, 'The specified object does not exist or has already '\n                  'been Funcd.')", "path": "invenio_deposit/views/rest.py", "identifier": "DepositFileResource.delete", "docstring": "Handle DELETE deposit file.\n\n        Permission required: `update_permission_factory`.\n\n        :param pid: Pid object (from url).\n        :param record: Record object resolved from the pid.\n        :param key: Unique identifier for the file in the deposit.", "docstring_tokens": ["Handle", "DELETE", "deposit", "file", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 258530}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/cornu/__init__.py#L272-L288", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Raph Levien's code draws fast LINETO segments.", "language": "python", "parameters": "(x0, y0, t0, t1, s0, c0, flip, cs, ss, cmd)", "return_statement": "return cmd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", ":", "for", "arg_10", "in", "range", "(", "0", ",", "100", ")", ":", "arg_11", "=", "arg_10", "*", ".01", "arg_12", ",", "arg_13", "=", "eval_cornu", "(", "arg_2", "+", "arg_11", "*", "(", "arg_3", "-", "arg_2", ")", ")", "arg_12", "*=", "arg_6", "arg_12", "-=", "arg_4", "arg_13", "-=", "arg_5", "arg_14", "=", "arg_13", "*", "arg_7", "-", "arg_12", "*", "arg_8", "arg_15", "=", "arg_12", "*", "arg_7", "+", "arg_13", "*", "arg_8", "print_pt", "(", "arg_0", "+", "arg_14", ",", "arg_1", "+", "arg_15", ",", "arg_9", ")", "arg_9", "=", "'lineto'", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9):\n    \n    \"\"\" Raph Levien's code draws fast LINETO segments.\n    \"\"\"\n    \n    for arg_10 in range(0, 100):\n        arg_11 = arg_10 * .01\n        arg_12, arg_13 = eval_cornu(arg_2 + arg_11 * (arg_3 - arg_2))\n        arg_12 *= arg_6\n        arg_12 -= arg_4\n        arg_13 -= arg_5\n        #print '%', c, s\n        arg_14 = arg_13 * arg_7 - arg_12 * arg_8\n        arg_15 = arg_12 * arg_7 + arg_13 * arg_8\n        print_pt(arg_0 + arg_14, arg_1 + arg_15, arg_9)\n        arg_9 = 'lineto'\n    return arg_9", "path": "lib/cornu/__init__.py", "identifier": "draw_cornu_flat", "docstring": "Raph Levien's code draws fast LINETO segments.", "docstring_tokens": ["Raph", "Levien", "s", "code", "draws", "fast", "LINETO", "segments", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258531}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L185-L232", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots a bar graph of returns by year.", "language": "python", "parameters": "(returns, ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "plt", ".", "gca", "(", ")", "arg_3", "=", "FuncFormatter", "(", "utils", ".", "percentage", ")", "arg_1", ".", "xaxis", ".", "set_major_formatter", "(", "FuncFormatter", "(", "arg_3", ")", ")", "arg_1", ".", "tick_params", "(", "axis", "=", "'x'", ",", "which", "=", "'major'", ")", "arg_4", "=", "pd", ".", "DataFrame", "(", "ep", ".", "aggregate_returns", "(", "arg_0", ",", "'yearly'", ")", ")", "arg_1", ".", "axvline", "(", "100", "*", "arg_4", ".", "values", ".", "mean", "(", ")", ",", "color", "=", "'steelblue'", ",", "linestyle", "=", "'--'", ",", "lw", "=", "4", ",", "alpha", "=", "0.7", ")", "(", "100", "*", "arg_4", ".", "sort_index", "(", "ascending", "=", "False", ")", ")", ".", "plot", "(", "arg_1", "=", "arg_1", ",", "kind", "=", "'barh'", ",", "alpha", "=", "0.70", ",", "**", "arg_2", ")", "arg_1", ".", "axvline", "(", "0.0", ",", "color", "=", "'black'", ",", "linestyle", "=", "'-'", ",", "lw", "=", "3", ")", "arg_1", ".", "set_ylabel", "(", "'Year'", ")", "arg_1", ".", "set_xlabel", "(", "'Returns'", ")", "arg_1", ".", "set_title", "(", "\"Annual returns\"", ")", "arg_1", ".", "legend", "(", "[", "'Mean'", "]", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"\n    Plots a bar graph of returns by year.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_1 is None:\n        arg_1 = plt.gca()\n\n    arg_3 = FuncFormatter(utils.percentage)\n    arg_1.xaxis.set_major_formatter(FuncFormatter(arg_3))\n    arg_1.tick_params(axis='x', which='major')\n\n    arg_4 = pd.DataFrame(\n        ep.aggregate_returns(\n            arg_0,\n            'yearly'))\n\n    arg_1.axvline(\n        100 *\n        arg_4.values.mean(),\n        color='steelblue',\n        linestyle='--',\n        lw=4,\n        alpha=0.7)\n    (100 * arg_4.sort_index(ascending=False)\n     ).plot(arg_1=arg_1, kind='barh', alpha=0.70, **arg_2)\n    arg_1.axvline(0.0, color='black', linestyle='-', lw=3)\n\n    arg_1.set_ylabel('Year')\n    arg_1.set_xlabel('Returns')\n    arg_1.set_title(\"Annual returns\")\n    arg_1.legend(['Mean'], frameon=True, framealpha=0.5)\n    return arg_1", "path": "pyfolio/plotting.py", "identifier": "plot_annual_returns", "docstring": "Plots a bar graph of returns by year.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "a", "bar", "graph", "of", "returns", "by", "year", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 258532}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L307-L312", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Conference Undeaf helper", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/ConferenceUndeaf/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Conference Undeaf helper\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/ConferenceUndeaf/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.conference_undeaf", "docstring": "REST Conference Undeaf helper", "docstring_tokens": ["REST", "Conference", "Undeaf", "helper"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 258533}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1065-L1078", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the darkest color from the list.", "language": "python", "parameters": "(self)", "return_statement": "return min", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "(", "1.0", ",", "1.0", ",", "1.0", ")", ",", "3.0", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "r", "+", "arg_3", ".", "g", "+", "arg_3", ".", "b", "<", "arg_2", ":", "arg_1", ",", "arg_2", "=", "arg_3", ",", "arg_3", ".", "r", "+", "arg_3", ".", "g", "+", "arg_3", ".", "b", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the darkest color from the list.\n\n        Knowing the contrast between a light and a dark swatch\n        can help us decide how to display readable typography.\n\n        \"\"\"\n        arg_1, arg_2 = (1.0, 1.0, 1.0), 3.0\n        for arg_3 in arg_0:\n            if arg_3.r + arg_3.g + arg_3.b < arg_2:\n                arg_1, arg_2 = arg_3, arg_3.r + arg_3.g + arg_3.b\n\n        return arg_1", "path": "lib/colors/__init__.py", "identifier": "ColorList._darkest", "docstring": "Returns the darkest color from the list.\n\n        Knowing the contrast between a light and a dark swatch\n        can help us decide how to display readable typography.", "docstring_tokens": ["Returns", "the", "darkest", "color", "from", "the", "list", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258534}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/docmaker/utils.py#L93-L103", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "checks that a given file exists", "language": "python", "parameters": "( pathname )", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "1", "try", ":", "arg_2", "=", "open", "(", "arg_0", ",", "\"r\"", ")", "arg_2", ".", "close", "(", ")", "except", ":", "arg_1", "=", "None", "sys", ".", "stderr", ".", "write", "(", "arg_0", "+", "\" couldn't be accessed\\n\"", ")", "return", "arg_1"], "function": "def  Func( arg_0 ):\n    \"\"\"checks that a given file exists\"\"\"\n    arg_1 = 1\n    try:\n        arg_2 = open( arg_0, \"r\" )\n        arg_2.close()\n    except:\n        arg_1 = None\n        sys.stderr.write( arg_0 + \" couldn't be accessed\\n\" )\n\n    return arg_1", "path": "native/Vendor/FreeType/src/tools/docmaker/utils.py", "identifier": "file_exists", "docstring": "checks that a given file exists", "docstring_tokens": ["checks", "that", "a", "given", "file", "exists"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 258535}
{"url": "https://github.com/schul-cloud/resources-api-v1/blob/58b2d7ba13669fa013ef81c0ffcffbf6b3fdb52d/generators/python_client/schul_cloud_resources_api_v1/schema/__init__.py#L80-L83", "sha": "58b2d7ba13669fa013ef81c0ffcffbf6b3fdb52d", "docstring_summary": "Return a list of examples which violate the schema.", "language": "python", "parameters": "(self)", "return_statement": "return list(_get_json_content_from_folder(path))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_get_schema_folder", "(", ")", ",", "\"examples\"", ",", "\"invalid\"", ")", "return", "list", "(", "_get_json_content_from_folder", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return a list of examples which violate the schema.\"\"\"\n        arg_1 = os.path.join(arg_0._get_schema_folder(), \"examples\", \"invalid\")\n        return list(_get_json_content_from_folder(arg_1))", "path": "generators/python_client/schul_cloud_resources_api_v1/schema/__init__.py", "identifier": "Schema.get_invalid_examples", "docstring": "Return a list of examples which violate the schema.", "docstring_tokens": ["Return", "a", "list", "of", "examples", "which", "violate", "the", "schema", "."], "nwo": "schul-cloud/resources-api-v1", "score": 0.32506205088275053, "idx": 258536}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/util_functions.py#L236-L263", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Calculates string edit distance between string 1 and string 2.\n    Deletion, insertion, substitution, and transposition all increase edit distance.", "language": "python", "parameters": "(s1, s2)", "return_statement": "return d[lenstr1 - 1, lenstr2 - 1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "len", "(", "arg_0", ")", "arg_4", "=", "len", "(", "arg_1", ")", "for", "arg_5", "in", "xrange", "(", "-", "1", ",", "arg_3", "+", "1", ")", ":", "arg_2", "[", "(", "arg_5", ",", "-", "1", ")", "]", "=", "arg_5", "+", "1", "for", "arg_6", "in", "xrange", "(", "-", "1", ",", "arg_4", "+", "1", ")", ":", "arg_2", "[", "(", "-", "1", ",", "arg_6", ")", "]", "=", "arg_6", "+", "1", "for", "arg_5", "in", "xrange", "(", "arg_3", ")", ":", "for", "arg_6", "in", "xrange", "(", "arg_4", ")", ":", "if", "arg_0", "[", "arg_5", "]", "==", "arg_1", "[", "arg_6", "]", ":", "arg_7", "=", "0", "else", ":", "arg_7", "=", "1", "arg_2", "[", "(", "arg_5", ",", "arg_6", ")", "]", "=", "min", "(", "arg_2", "[", "(", "arg_5", "-", "1", ",", "arg_6", ")", "]", "+", "1", ",", "arg_2", "[", "(", "arg_5", ",", "arg_6", "-", "1", ")", "]", "+", "1", ",", "arg_2", "[", "(", "arg_5", "-", "1", ",", "arg_6", "-", "1", ")", "]", "+", "arg_7", ",", ")", "if", "arg_5", "and", "arg_6", "and", "arg_0", "[", "arg_5", "]", "==", "arg_1", "[", "arg_6", "-", "1", "]", "and", "arg_0", "[", "arg_5", "-", "1", "]", "==", "arg_1", "[", "arg_6", "]", ":", "arg_2", "[", "(", "arg_5", ",", "arg_6", ")", "]", "=", "min", "(", "arg_2", "[", "(", "arg_5", ",", "arg_6", ")", "]", ",", "arg_2", "[", "arg_5", "-", "2", ",", "arg_6", "-", "2", "]", "+", "arg_7", ")", "return", "arg_2", "[", "arg_3", "-", "1", ",", "arg_4", "-", "1", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Calculates string edit distance between string 1 and string 2.\n    Deletion, insertion, substitution, and transposition all increase edit distance.\n    \"\"\"\n    arg_2 = {}\n    arg_3 = len(arg_0)\n    arg_4 = len(arg_1)\n    for arg_5 in xrange(-1, arg_3 + 1):\n        arg_2[(arg_5, -1)] = arg_5 + 1\n    for arg_6 in xrange(-1, arg_4 + 1):\n        arg_2[(-1, arg_6)] = arg_6 + 1\n\n    for arg_5 in xrange(arg_3):\n        for arg_6 in xrange(arg_4):\n            if arg_0[arg_5] == arg_1[arg_6]:\n                arg_7 = 0\n            else:\n                arg_7 = 1\n            arg_2[(arg_5, arg_6)] = min(\n                arg_2[(arg_5 - 1, arg_6)] + 1, # deletion\n                arg_2[(arg_5, arg_6 - 1)] + 1, # insertion\n                arg_2[(arg_5 - 1, arg_6 - 1)] + arg_7, # substitution\n            )\n            if arg_5 and arg_6 and arg_0[arg_5] == arg_1[arg_6 - 1] and arg_0[arg_5 - 1] == arg_1[arg_6]:\n                arg_2[(arg_5, arg_6)] = min(arg_2[(arg_5, arg_6)], arg_2[arg_5 - 2, arg_6 - 2] + arg_7) # transposition\n\n    return arg_2[arg_3 - 1, arg_4 - 1]", "path": "ease/util_functions.py", "identifier": "edit_distance", "docstring": "Calculates string edit distance between string 1 and string 2.\n    Deletion, insertion, substitution, and transposition all increase edit distance.", "docstring_tokens": ["Calculates", "string", "edit", "distance", "between", "string", "1", "and", "string", "2", ".", "Deletion", "insertion", "substitution", "and", "transposition", "all", "increase", "edit", "distance", "."], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 258537}
{"url": "https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/giraffez/encrypt.py#L30-L41", "sha": "6b4d27eb1a1eaf188c6885c7364ef27e92b1b957", "docstring_summary": "Creates a new encryption key in the path provided and sets the file\n    permissions.  Setting the file permissions currently does not work\n    on Windows platforms because of the differences in how file\n    permissions are read and modified.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"{}{}\"", ".", "format", "(", "os", ".", "urandom", "(", "32", ")", ",", "time", ".", "time", "(", ")", ")", "arg_2", "=", "generate_key", "(", "ensure_bytes", "(", "arg_1", ")", ")", "with", "open", "(", "arg_0", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "base64", ".", "b64encode", "(", "arg_2", ")", ")", "os", ".", "chmod", "(", "arg_0", ",", "0o400", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Creates a new encryption key in the path provided and sets the file\n    permissions.  Setting the file permissions currently does not work\n    on Windows platforms because of the differences in how file\n    permissions are read and modified.\n    \"\"\"\n    arg_1 = \"{}{}\".format(os.urandom(32), time.time())\n    arg_2 = generate_key(ensure_bytes(arg_1))\n    with open(arg_0, \"wb\") as f:\n        f.write(base64.b64encode(arg_2))\n    os.chmod(arg_0, 0o400)", "path": "giraffez/encrypt.py", "identifier": "create_key_file", "docstring": "Creates a new encryption key in the path provided and sets the file\n    permissions.  Setting the file permissions currently does not work\n    on Windows platforms because of the differences in how file\n    permissions are read and modified.", "docstring_tokens": ["Creates", "a", "new", "encryption", "key", "in", "the", "path", "provided", "and", "sets", "the", "file", "permissions", ".", "Setting", "the", "file", "permissions", "currently", "does", "not", "work", "on", "Windows", "platforms", "because", "of", "the", "differences", "in", "how", "file", "permissions", "are", "read", "and", "modified", "."], "nwo": "capitalone/giraffez", "score": 0.19842634881568408, "idx": 258538}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/listmergefields.py#L27-L50", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Add a new merge field for a specific list.", "language": "python", "parameters": "(self, list_id, data)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "list_id", "=", "arg_1", "if", "'name'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The list merge field must have a name'", ")", "if", "'type'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The list merge field must have a type'", ")", "arg_3", "=", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'merge-fields'", ")", ",", "arg_2", "=", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_0", ".", "merge_id", "=", "arg_3", "[", "'merge_id'", "]", "else", ":", "arg_0", ".", "merge_id", "=", "None", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Add a new merge field for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"type\": string*\n        }\n        \"\"\"\n        arg_0.list_id = arg_1\n        if 'name' not in arg_2:\n            raise KeyError('The list merge field must have a name')\n        if 'type' not in arg_2:\n            raise KeyError('The list merge field must have a type')\n        arg_3 = arg_0._mc_client._post(url=arg_0._build_path(arg_1, 'merge-fields'), arg_2=arg_2)\n        if arg_3 is not None:\n            arg_0.merge_id = arg_3['merge_id']\n        else:\n            arg_0.merge_id = None\n        return arg_3", "path": "mailchimp3/entities/listmergefields.py", "identifier": "ListMergeFields.create", "docstring": "Add a new merge field for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"type\": string*\n        }", "docstring_tokens": ["Add", "a", "new", "merge", "field", "for", "a", "specific", "list", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 258539}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/tags.py#L118-L135", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Validates a VLAN ID.", "language": "python", "parameters": "(self, value)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "int", "(", "arg_1", ")", "assert", "arg_2", ">=", "arg_0", ".", "MIN_VLAN_ID", "assert", "arg_2", "<=", "arg_0", ".", "MAX_VLAN_ID", "except", "Exception", ":", "arg_3", "=", "(", "\"Invalid vlan_id. Got '%(vlan_id)s'. \"", "\"vlan_id should be an integer between %(min)d and %(max)d \"", "\"inclusive.\"", "%", "{", "'vlan_id'", ":", "arg_1", ",", "'min'", ":", "arg_0", ".", "MIN_VLAN_ID", ",", "'max'", ":", "arg_0", ".", "MAX_VLAN_ID", "}", ")", "raise", "TagValidationError", "(", "arg_1", ",", "arg_3", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Validates a VLAN ID.\n\n        :param value: The VLAN ID to Func against.\n        :raises TagValidationError: Raised if the VLAN ID is invalid.\n        \"\"\"\n        try:\n            arg_2 = int(arg_1)\n            assert arg_2 >= arg_0.MIN_VLAN_ID\n            assert arg_2 <= arg_0.MAX_VLAN_ID\n        except Exception:\n            arg_3 = (\"Invalid vlan_id. Got '%(vlan_id)s'. \"\n                   \"vlan_id should be an integer between %(min)d and %(max)d \"\n                   \"inclusive.\" % {'vlan_id': arg_1,\n                                   'min': arg_0.MIN_VLAN_ID,\n                                   'max': arg_0.MAX_VLAN_ID})\n            raise TagValidationError(arg_1, arg_3)\n        return True", "path": "quark/tags.py", "identifier": "VlanTag.validate", "docstring": "Validates a VLAN ID.\n\n        :param value: The VLAN ID to validate against.\n        :raises TagValidationError: Raised if the VLAN ID is invalid.", "docstring_tokens": ["Validates", "a", "VLAN", "ID", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 258540}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/IRQueryableList.py#L100-L107", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "save - Save all objects in this list", "language": "python", "parameters": "(self)", "return_statement": "return mdl.saver.save(self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "[", "]", "arg_1", "=", "arg_0", ".", "getModel", "(", ")", "return", "arg_1", ".", "Funcr", ".", "Func", "(", "arg_0", ")"], "function": "def Func(arg_0):\n\t\t'''\n\t\t\tFunc - Save all objects in this list\n\t\t'''\n\t\tif len(arg_0) == 0:\n\t\t\treturn []\n\t\targ_1 = arg_0.getModel()\n\t\treturn arg_1.Funcr.Func(arg_0)", "path": "IndexedRedis/IRQueryableList.py", "identifier": "IRQueryableList.save", "docstring": "save - Save all objects in this list", "docstring_tokens": ["save", "-", "Save", "all", "objects", "in", "this", "list"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 258541}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L53-L70", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Checks if file already exists and ask the user if it should\n    be overwritten if it does.", "language": "python", "parameters": "(filename, force)", "return_statement": "return FileOutput(filename)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "debug", "(", "\"Checking file output\"", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", "and", "not", "arg_1", ":", "if", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "arg_2", "=", "console", ".", "ask", "(", "\"File {0} already exists! Overwrite it? [y/N] \"", ",", "arg_0", ")", "if", "arg_2", ".", "lower", "(", ")", "!=", "\"y\"", ":", "sys", ".", "exit", "(", ")", "else", ":", "log", ".", "error", "(", "\"File {0} already exists, use --force to overwrite it.\"", ".", "format", "(", "arg_0", ")", ")", "sys", ".", "exit", "(", ")", "return", "FileOutput", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Checks if file already exists and ask the user if it should\n    be overwritten if it does.\"\"\"\n\n    log.debug(\"Checking file output\")\n\n    if os.path.isfile(arg_0) and not arg_1:\n        if sys.stdin.isatty():\n            arg_2 = console.ask(\"File {0} already exists! Overwrite it? [y/N] \",\n                                 arg_0)\n\n            if arg_2.lower() != \"y\":\n                sys.exit()\n        else:\n            log.error(\"File {0} already exists, use --force to overwrite it.\".format(arg_0))\n            sys.exit()\n\n    return FileOutput(arg_0)", "path": "src/streamlink_cli/main.py", "identifier": "check_file_output", "docstring": "Checks if file already exists and ask the user if it should\n    be overwritten if it does.", "docstring_tokens": ["Checks", "if", "file", "already", "exists", "and", "ask", "the", "user", "if", "it", "should", "be", "overwritten", "if", "it", "does", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 258542}
{"url": "https://github.com/steelkiwi/django-skd-tools/blob/422dc3e49f12739a500302e4c494379684e9dc50/skd_tools/utils.py#L23-L28", "sha": "422dc3e49f12739a500302e4c494379684e9dc50", "docstring_summary": "Generates likely unique image path using md5 hashes", "language": "python", "parameters": "(instance, filename)", "return_statement": "return '{}/{}{}'.format(instance_id_hash, filename_hash, ext)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ",", "arg_2", "=", "os", ".", "path", ".", "splitext", "(", "arg_1", ".", "lower", "(", ")", ")", "arg_3", "=", "hashlib", ".", "md5", "(", "str", "(", "arg_0", ".", "id", ")", ")", ".", "hexdigest", "(", ")", "arg_4", "=", "''", ".", "join", "(", "random", ".", "sample", "(", "hashlib", ".", "md5", "(", "arg_1", ".", "encode", "(", "'utf-8'", ")", ")", ".", "hexdigest", "(", ")", ",", "8", ")", ")", "return", "'{}/{}{}'", ".", "format", "(", "arg_3", ",", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Generates likely unique image path using md5 hashes\"\"\"\n    arg_1, arg_2 = os.path.splitext(arg_1.lower())\n    arg_3 = hashlib.md5(str(arg_0.id)).hexdigest()\n    arg_4 = ''.join(random.sample(hashlib.md5(arg_1.encode('utf-8')).hexdigest(), 8))\n    return '{}/{}{}'.format(arg_3, arg_4, arg_2)", "path": "skd_tools/utils.py", "identifier": "image_path", "docstring": "Generates likely unique image path using md5 hashes", "docstring_tokens": ["Generates", "likely", "unique", "image", "path", "using", "md5", "hashes"], "nwo": "steelkiwi/django-skd-tools", "score": 0.14991498758945482, "idx": 258543}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L194-L198", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Add a control-number 00x for given tag with value.", "language": "python", "parameters": "(self, tag, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "record_add_field", "(", "arg_0", ".", "record", ",", "arg_1", ",", "controlfield_value", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add a control-number 00x for given tag with value.\"\"\"\n        record_add_field(arg_0.record,\n                         arg_1,\n                         controlfield_value=arg_2)", "path": "harvestingkit/inspire_cds_package/base.py", "identifier": "MARCXMLConversion.add_control_number", "docstring": "Add a control-number 00x for given tag with value.", "docstring_tokens": ["Add", "a", "control", "-", "number", "00x", "for", "given", "tag", "with", "value", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 258544}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/filters.py#L1179-L1238", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Build a two-dimensional diagonal filter.", "language": "python", "parameters": "(window, n, slope=1.0, angle=None, zero_mean=False)", "return_statement": "return win", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1.0", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "np", ".", "arctan", "(", "arg_2", ")", "arg_5", "=", "np", ".", "diag", "(", "get_window", "(", "arg_0", ",", "arg_1", ",", "fftbins", "=", "False", ")", ")", "if", "not", "np", ".", "isclose", "(", "arg_3", ",", "np", ".", "pi", "/", "4", ")", ":", "arg_5", "=", "scipy", ".", "ndimage", ".", "rotate", "(", "arg_5", ",", "45", "-", "arg_3", "*", "180", "/", "np", ".", "pi", ",", "order", "=", "5", ",", "prefilter", "=", "False", ")", "np", ".", "clip", "(", "arg_5", ",", "0", ",", "None", ",", "out", "=", "arg_5", ")", "arg_5", "/=", "arg_5", ".", "sum", "(", ")", "if", "arg_4", ":", "arg_5", "-=", "arg_5", ".", "mean", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=1.0, arg_3=None, arg_4=False):\n    '''Build a two-dimensional diagonal filter.\n\n    This is primarily used for smoothing recurrence or self-similarity matrices.\n\n    Parameters\n    ----------\n    window : string, tuple, number, callable, or list-like\n        The window function to use for the filter.\n\n        See `get_window` for details.\n\n        Note that the window used here should be non-negative.\n\n    n : int > 0\n        the length of the filter\n\n    slope : float\n        The slope of the diagonal filter to produce\n\n    angle : float or None\n        If given, the slope parameter is ignored,\n        and angle directly sets the orientation of the filter (in radians).\n        Otherwise, angle is inferred as `arctan(slope)`.\n\n    zero_mean : bool\n        If True, a zero-mean filter is used.\n        Otherwise, a non-negative averaging filter is used.\n\n        This should be enabled if you want to enhance paths and suppress\n        blocks.\n\n\n    Returns\n    -------\n    kernel : np.ndarray, shape=[(m, m)]\n        The 2-dimensional filter kernel\n\n\n    Notes\n    -----\n    This function caches at level 10.\n    '''\n\n    if arg_3 is None:\n        arg_3 = np.arctan(arg_2)\n\n    arg_5 = np.diag(get_window(arg_0, arg_1, fftbins=False))\n\n    if not np.isclose(arg_3, np.pi/4):\n        arg_5 = scipy.ndimage.rotate(arg_5, 45 - arg_3 * 180 / np.pi,\n                                   order=5, prefilter=False)\n\n    np.clip(arg_5, 0, None, out=arg_5)\n    arg_5 /= arg_5.sum()\n\n    if arg_4:\n        arg_5 -= arg_5.mean()\n\n    return arg_5", "path": "librosa/filters.py", "identifier": "diagonal_filter", "docstring": "Build a two-dimensional diagonal filter.\n\n    This is primarily used for smoothing recurrence or self-similarity matrices.\n\n    Parameters\n    ----------\n    window : string, tuple, number, callable, or list-like\n        The window function to use for the filter.\n\n        See `get_window` for details.\n\n        Note that the window used here should be non-negative.\n\n    n : int > 0\n        the length of the filter\n\n    slope : float\n        The slope of the diagonal filter to produce\n\n    angle : float or None\n        If given, the slope parameter is ignored,\n        and angle directly sets the orientation of the filter (in radians).\n        Otherwise, angle is inferred as `arctan(slope)`.\n\n    zero_mean : bool\n        If True, a zero-mean filter is used.\n        Otherwise, a non-negative averaging filter is used.\n\n        This should be enabled if you want to enhance paths and suppress\n        blocks.\n\n\n    Returns\n    -------\n    kernel : np.ndarray, shape=[(m, m)]\n        The 2-dimensional filter kernel\n\n\n    Notes\n    -----\n    This function caches at level 10.", "docstring_tokens": ["Build", "a", "two", "-", "dimensional", "diagonal", "filter", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258545}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L728-L906", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Factory for loading the ccd data from .fits files, as well as computing properties like the noise-map,\n    exposure-time map, etc. from the ccd-data.", "language": "python", "parameters": "(image_path, pixel_scale, image_hdu=0,\n                            resized_ccd_shape=None, resized_ccd_origin_pixels=None,\n                            resized_ccd_origin_arcsec=None,\n                            psf_path=None, psf_hdu=0, resized_psf_shape=None, renormalize_psf=True,\n                            noise_map_path=None, noise_map_hdu=0,\n                            noise_map_from_image_and_background_noise_map=False,\n                            convert_noise_map_from_weight_map=False,\n                            convert_noise_map_from_inverse_noise_map=False,\n                            background_noise_map_path=None, background_noise_map_hdu=0,\n                            convert_background_noise_map_from_weight_map=False,\n                            convert_background_noise_map_from_inverse_noise_map=False,\n                            poisson_noise_map_path=None, poisson_noise_map_hdu=0,\n                            poisson_noise_map_from_image=False,\n                            convert_poisson_noise_map_from_weight_map=False,\n                            convert_poisson_noise_map_from_inverse_noise_map=False,\n                            exposure_time_map_path=None, exposure_time_map_hdu=0,\n                            exposure_time_map_from_single_value=None,\n                            exposure_time_map_from_inverse_noise_map=False,\n                            background_sky_map_path=None, background_sky_map_hdu=0,\n                            convert_from_electrons=False,\n                            gain=None, convert_from_adus=False, lens_name=None)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "0", ",", "arg_8", "=", "None", ",", "arg_9", "=", "True", ",", "arg_10", "=", "None", ",", "arg_11", "=", "0", ",", "arg_12", "=", "False", ",", "arg_13", "=", "False", ",", "arg_14", "=", "False", ",", "arg_15", "=", "None", ",", "arg_16", "=", "0", ",", "arg_17", "=", "False", ",", "arg_18", "=", "False", ",", "arg_19", "=", "None", ",", "arg_20", "=", "0", ",", "arg_21", "=", "False", ",", "arg_22", "=", "False", ",", "arg_23", "=", "False", ",", "arg_24", "=", "None", ",", "arg_25", "=", "0", ",", "arg_26", "=", "None", ",", "arg_27", "=", "False", ",", "arg_28", "=", "None", ",", "arg_29", "=", "0", ",", "arg_30", "=", "False", ",", "arg_31", "=", "None", ",", "arg_32", "=", "False", ",", "arg_33", "=", "None", ")", ":", "arg_34", "=", "load_image", "(", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", "arg_35", "=", "load_background_noise_map", "(", "arg_15", "=", "arg_15", ",", "arg_16", "=", "arg_16", ",", "arg_1", "=", "arg_1", ",", "arg_17", "=", "arg_17", ",", "arg_18", "=", "arg_18", ")", "if", "arg_35", "is", "not", "None", ":", "arg_36", "=", "1.0", "/", "arg_35", "else", ":", "arg_36", "=", "None", "arg_37", "=", "load_exposure_time_map", "(", "arg_24", "=", "arg_24", ",", "arg_25", "=", "arg_25", ",", "arg_1", "=", "arg_1", ",", "shape", "=", "arg_34", ".", "shape", ",", "exposure_time", "=", "arg_26", ",", "arg_27", "=", "arg_27", ",", "arg_36", "=", "arg_36", ")", "arg_38", "=", "load_poisson_noise_map", "(", "arg_19", "=", "arg_19", ",", "arg_20", "=", "arg_20", ",", "arg_1", "=", "arg_1", ",", "arg_22", "=", "arg_22", ",", "arg_23", "=", "arg_23", ",", "arg_34", "=", "arg_34", ",", "arg_37", "=", "arg_37", ",", "arg_21", "=", "arg_21", ",", "arg_30", "=", "arg_30", ",", "arg_31", "=", "arg_31", ",", "arg_32", "=", "arg_32", ")", "arg_39", "=", "load_noise_map", "(", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_1", "=", "arg_1", ",", "arg_34", "=", "arg_34", ",", "arg_35", "=", "arg_35", ",", "arg_37", "=", "arg_37", ",", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ",", "arg_12", "=", "arg_12", ",", "arg_30", "=", "arg_30", ",", "arg_31", "=", "arg_31", ",", "arg_32", "=", "arg_32", ")", "arg_40", "=", "load_psf", "(", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_1", "=", "arg_1", ",", "renormalize", "=", "arg_9", ")", "arg_41", "=", "load_background_sky_map", "(", "arg_28", "=", "arg_28", ",", "arg_29", "=", "arg_29", ",", "arg_1", "=", "arg_1", ")", "arg_34", "=", "CCDData", "(", "arg_34", "=", "arg_34", ",", "arg_1", "=", "arg_1", ",", "arg_40", "=", "arg_40", ",", "arg_39", "=", "arg_39", ",", "arg_35", "=", "arg_35", ",", "arg_38", "=", "arg_38", ",", "arg_37", "=", "arg_37", ",", "arg_41", "=", "arg_41", ",", "arg_31", "=", "arg_31", ",", "name", "=", "arg_33", ")", "if", "arg_3", "is", "not", "None", ":", "arg_34", "=", "arg_34", ".", "new_ccd_data_with_resized_arrays", "(", "new_shape", "=", "arg_3", ",", "new_centre_pixels", "=", "arg_4", ",", "new_centre_arcsec", "=", "arg_5", ")", "if", "arg_8", "is", "not", "None", ":", "arg_34", "=", "arg_34", ".", "new_ccd_data_with_resized_psf", "(", "new_shape", "=", "arg_8", ")", "if", "arg_30", ":", "arg_34", "=", "arg_34", ".", "new_ccd_data_converted_from_electrons", "(", ")", "elif", "arg_32", ":", "arg_34", "=", "arg_34", ".", "new_ccd_data_converted_from_adus", "(", "arg_31", "=", "arg_31", ")", "return", "arg_34"], "function": "def Func(arg_0, arg_1, arg_2=0,\n                            arg_3=None, arg_4=None,\n                            arg_5=None,\n                            arg_6=None, arg_7=0, arg_8=None, arg_9=True,\n                            arg_10=None, arg_11=0,\n                            arg_12=False,\n                            arg_13=False,\n                            arg_14=False,\n                            arg_15=None, arg_16=0,\n                            arg_17=False,\n                            arg_18=False,\n                            arg_19=None, arg_20=0,\n                            arg_21=False,\n                            arg_22=False,\n                            arg_23=False,\n                            arg_24=None, arg_25=0,\n                            arg_26=None,\n                            arg_27=False,\n                            arg_28=None, arg_29=0,\n                            arg_30=False,\n                            arg_31=None, arg_32=False, arg_33=None):\n    \"\"\"Factory for loading the ccd data from .fits files, as well as computing properties like the noise-map,\n    exposure-time map, etc. from the ccd-data.\n\n    This factory also includes a number of routines for converting the ccd-data from units not supported by PyAutoLens \\\n    (e.g. adus, electrons) to electrons per second.\n\n    Parameters\n    ----------\n    lens_name\n    image_path : str\n        The path to the image .fits file containing the image (e.g. '/path/to/image.fits')\n    pixel_scale : float\n        The size of each pixel in arc seconds.\n    image_hdu : int\n        The hdu the image is contained in the .fits file specified by *image_path*.        \n    image_hdu : int\n        The hdu the image is contained in the .fits file that *image_path* points too.\n    resized_ccd_shape : (int, int) | None\n        If input, the ccd arrays that are image sized, e.g. the image, noise-maps) are resized to these dimensions.\n    resized_ccd_origin_pixels : (int, int) | None\n        If the ccd arrays are resized, this defines a new origin (in pixels) around which recentering occurs.\n    resized_ccd_origin_arcsec : (float, float) | None\n        If the ccd arrays are resized, this defines a new origin (in arc-seconds) around which recentering occurs.\n    psf_path : str\n        The path to the psf .fits file containing the psf (e.g. '/path/to/psf.fits')        \n    psf_hdu : int\n        The hdu the psf is contained in the .fits file specified by *psf_path*.\n    resized_psf_shape : (int, int) | None\n        If input, the psf is resized to these dimensions.\n    renormalize_psf : bool\n        If True, the PSF is renoralized such that all elements sum to 1.0.\n    noise_map_path : str\n        The path to the noise_map .fits file containing the noise_map (e.g. '/path/to/noise_map.fits')        \n    noise_map_hdu : int\n        The hdu the noise_map is contained in the .fits file specified by *noise_map_path*.\n    noise_map_from_image_and_background_noise_map : bool\n        If True, the noise-map is computed from the observed image and background noise-map \\\n        (see NoiseMap.from_image_and_background_noise_map).\n    convert_noise_map_from_weight_map : bool\n        If True, the noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_noise_map_from_inverse_noise_map : bool\n        If True, the noise-map loaded from the .fits file is converted from an inverse noise-map to a noise-map (see \\\n        *NoiseMap.from_inverse_noise_map).\n    background_noise_map_path : str\n        The path to the background_noise_map .fits file containing the background noise-map \\ \n        (e.g. '/path/to/background_noise_map.fits')        \n    background_noise_map_hdu : int\n        The hdu the background_noise_map is contained in the .fits file specified by *background_noise_map_path*.\n    convert_background_noise_map_from_weight_map : bool\n        If True, the bacground noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_background_noise_map_from_inverse_noise_map : bool\n        If True, the background noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    poisson_noise_map_path : str\n        The path to the poisson_noise_map .fits file containing the Poisson noise-map \\\n         (e.g. '/path/to/poisson_noise_map.fits')        \n    poisson_noise_map_hdu : int\n        The hdu the poisson_noise_map is contained in the .fits file specified by *poisson_noise_map_path*.\n    poisson_noise_map_from_image : bool\n        If True, the Poisson noise-map is estimated using the image.\n    convert_poisson_noise_map_from_weight_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_poisson_noise_map_from_inverse_noise_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    exposure_time_map_path : str\n        The path to the exposure_time_map .fits file containing the exposure time map \\ \n        (e.g. '/path/to/exposure_time_map.fits')        \n    exposure_time_map_hdu : int\n        The hdu the exposure_time_map is contained in the .fits file specified by *exposure_time_map_path*.\n    exposure_time_map_from_single_value : float\n        The exposure time of the ccd imaging, which is used to compute the exposure-time map as a single value \\\n        (see *ExposureTimeMap.from_single_value*).\n    exposure_time_map_from_inverse_noise_map : bool\n        If True, the exposure-time map is computed from the background noise_map map \\\n        (see *ExposureTimeMap.from_background_noise_map*)\n    background_sky_map_path : str\n        The path to the background_sky_map .fits file containing the background sky map \\\n        (e.g. '/path/to/background_sky_map.fits').\n    background_sky_map_hdu : int\n        The hdu the background_sky_map is contained in the .fits file specified by *background_sky_map_path*.\n    convert_from_electrons : bool\n        If True, the input unblurred_image_1d are in units of electrons and all converted to electrons / second using the exposure \\\n        time map.\n    gain : float\n        The image gain, used for convert from ADUs.\n    convert_from_adus : bool\n        If True, the input unblurred_image_1d are in units of adus and all converted to electrons / second using the exposure \\\n        time map and gain.\n    \"\"\"\n\n    arg_34 = load_image(arg_0=arg_0, arg_2=arg_2, arg_1=arg_1)\n\n    arg_35 = load_background_noise_map(arg_15=arg_15,\n                                                     arg_16=arg_16,\n                                                     arg_1=arg_1,\n                                                     arg_17=arg_17,\n                                                     arg_18=arg_18)\n\n    if arg_35 is not None:\n        arg_36 = 1.0 / arg_35\n    else:\n        arg_36 = None\n\n    arg_37 = load_exposure_time_map(arg_24=arg_24,\n                                               arg_25=arg_25,\n                                               arg_1=arg_1, shape=arg_34.shape,\n                                               exposure_time=arg_26,\n                                               arg_27=arg_27,\n                                               arg_36=arg_36)\n\n    arg_38 = load_poisson_noise_map(arg_19=arg_19,\n                                               arg_20=arg_20,\n                                               arg_1=arg_1,\n                                               arg_22=arg_22,\n                                               arg_23=arg_23,\n                                               arg_34=arg_34, arg_37=arg_37,\n                                               arg_21=arg_21,\n                                               arg_30=arg_30, arg_31=arg_31,\n                                               arg_32=arg_32)\n\n    arg_39 = load_noise_map(arg_10=arg_10, arg_11=arg_11, arg_1=arg_1,\n                               arg_34=arg_34, arg_35=arg_35,\n                               arg_37=arg_37,\n                               arg_13=arg_13,\n                               arg_14=arg_14,\n                               arg_12=arg_12,\n                               arg_30=arg_30, arg_31=arg_31,\n                               arg_32=arg_32)\n\n    arg_40 = load_psf(arg_6=arg_6, arg_7=arg_7, arg_1=arg_1, renormalize=arg_9)\n\n    arg_41 = load_background_sky_map(arg_28=arg_28,\n                                                 arg_29=arg_29,\n                                                 arg_1=arg_1)\n\n    arg_34 = CCDData(arg_34=arg_34, arg_1=arg_1, arg_40=arg_40, arg_39=arg_39,\n                    arg_35=arg_35, arg_38=arg_38,\n                    arg_37=arg_37, arg_41=arg_41, arg_31=arg_31,\n                    name=arg_33)\n\n    if arg_3 is not None:\n        arg_34 = arg_34.new_ccd_data_with_resized_arrays(new_shape=arg_3,\n                                                       new_centre_pixels=arg_4,\n                                                       new_centre_arcsec=arg_5)\n\n    if arg_8 is not None:\n        arg_34 = arg_34.new_ccd_data_with_resized_psf(new_shape=arg_8)\n\n    if arg_30:\n        arg_34 = arg_34.new_ccd_data_converted_from_electrons()\n    elif arg_32:\n        arg_34 = arg_34.new_ccd_data_converted_from_adus(arg_31=arg_31)\n\n    return arg_34", "path": "autolens/data/ccd.py", "identifier": "load_ccd_data_from_fits", "docstring": "Factory for loading the ccd data from .fits files, as well as computing properties like the noise-map,\n    exposure-time map, etc. from the ccd-data.\n\n    This factory also includes a number of routines for converting the ccd-data from units not supported by PyAutoLens \\\n    (e.g. adus, electrons) to electrons per second.\n\n    Parameters\n    ----------\n    lens_name\n    image_path : str\n        The path to the image .fits file containing the image (e.g. '/path/to/image.fits')\n    pixel_scale : float\n        The size of each pixel in arc seconds.\n    image_hdu : int\n        The hdu the image is contained in the .fits file specified by *image_path*.        \n    image_hdu : int\n        The hdu the image is contained in the .fits file that *image_path* points too.\n    resized_ccd_shape : (int, int) | None\n        If input, the ccd arrays that are image sized, e.g. the image, noise-maps) are resized to these dimensions.\n    resized_ccd_origin_pixels : (int, int) | None\n        If the ccd arrays are resized, this defines a new origin (in pixels) around which recentering occurs.\n    resized_ccd_origin_arcsec : (float, float) | None\n        If the ccd arrays are resized, this defines a new origin (in arc-seconds) around which recentering occurs.\n    psf_path : str\n        The path to the psf .fits file containing the psf (e.g. '/path/to/psf.fits')        \n    psf_hdu : int\n        The hdu the psf is contained in the .fits file specified by *psf_path*.\n    resized_psf_shape : (int, int) | None\n        If input, the psf is resized to these dimensions.\n    renormalize_psf : bool\n        If True, the PSF is renoralized such that all elements sum to 1.0.\n    noise_map_path : str\n        The path to the noise_map .fits file containing the noise_map (e.g. '/path/to/noise_map.fits')        \n    noise_map_hdu : int\n        The hdu the noise_map is contained in the .fits file specified by *noise_map_path*.\n    noise_map_from_image_and_background_noise_map : bool\n        If True, the noise-map is computed from the observed image and background noise-map \\\n        (see NoiseMap.from_image_and_background_noise_map).\n    convert_noise_map_from_weight_map : bool\n        If True, the noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_noise_map_from_inverse_noise_map : bool\n        If True, the noise-map loaded from the .fits file is converted from an inverse noise-map to a noise-map (see \\\n        *NoiseMap.from_inverse_noise_map).\n    background_noise_map_path : str\n        The path to the background_noise_map .fits file containing the background noise-map \\ \n        (e.g. '/path/to/background_noise_map.fits')        \n    background_noise_map_hdu : int\n        The hdu the background_noise_map is contained in the .fits file specified by *background_noise_map_path*.\n    convert_background_noise_map_from_weight_map : bool\n        If True, the bacground noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_background_noise_map_from_inverse_noise_map : bool\n        If True, the background noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    poisson_noise_map_path : str\n        The path to the poisson_noise_map .fits file containing the Poisson noise-map \\\n         (e.g. '/path/to/poisson_noise_map.fits')        \n    poisson_noise_map_hdu : int\n        The hdu the poisson_noise_map is contained in the .fits file specified by *poisson_noise_map_path*.\n    poisson_noise_map_from_image : bool\n        If True, the Poisson noise-map is estimated using the image.\n    convert_poisson_noise_map_from_weight_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_poisson_noise_map_from_inverse_noise_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    exposure_time_map_path : str\n        The path to the exposure_time_map .fits file containing the exposure time map \\ \n        (e.g. '/path/to/exposure_time_map.fits')        \n    exposure_time_map_hdu : int\n        The hdu the exposure_time_map is contained in the .fits file specified by *exposure_time_map_path*.\n    exposure_time_map_from_single_value : float\n        The exposure time of the ccd imaging, which is used to compute the exposure-time map as a single value \\\n        (see *ExposureTimeMap.from_single_value*).\n    exposure_time_map_from_inverse_noise_map : bool\n        If True, the exposure-time map is computed from the background noise_map map \\\n        (see *ExposureTimeMap.from_background_noise_map*)\n    background_sky_map_path : str\n        The path to the background_sky_map .fits file containing the background sky map \\\n        (e.g. '/path/to/background_sky_map.fits').\n    background_sky_map_hdu : int\n        The hdu the background_sky_map is contained in the .fits file specified by *background_sky_map_path*.\n    convert_from_electrons : bool\n        If True, the input unblurred_image_1d are in units of electrons and all converted to electrons / second using the exposure \\\n        time map.\n    gain : float\n        The image gain, used for convert from ADUs.\n    convert_from_adus : bool\n        If True, the input unblurred_image_1d are in units of adus and all converted to electrons / second using the exposure \\\n        time map and gain.", "docstring_tokens": ["Factory", "for", "loading", "the", "ccd", "data", "from", ".", "fits", "files", "as", "well", "as", "computing", "properties", "like", "the", "noise", "-", "map", "exposure", "-", "time", "map", "etc", ".", "from", "the", "ccd", "-", "data", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 258546}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/prebuild.py#L90-L109", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Find a symbol in the symbol table by name, kind, or both.", "language": "python", "parameters": "(self, name=None, kind=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "for", "arg_3", "in", "reversed", "(", "arg_0", ".", "stack", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "symbols", ".", "items", "(", ")", ":", "arg_6", "=", "arg_5", ".", "__class__", ".", "__name__", "if", "arg_1", "==", "arg_4", "and", "arg_2", "==", "arg_6", ":", "return", "arg_5", "elif", "arg_1", "is", "None", "and", "arg_2", "==", "arg_5", ".", "__class__", ".", "__name__", ":", "return", "arg_5", "elif", "arg_1", "==", "arg_4", "and", "arg_2", "is", "None", ":", "return", "arg_5", "if", "arg_1", "is", "None", "and", "arg_2", "==", "arg_3", ".", "handle", ".", "__class__", ".", "__name__", ":", "return", "arg_3", ".", "handle"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        '''\n        Find a symbol in the symbol table by name, kind, or both.\n        '''\n        for arg_3 in reversed(arg_0.stack):\n                        \n            for arg_4, arg_5 in arg_3.symbols.items():\n                arg_6 = arg_5.__class__.__name__\n                \n                if arg_1 == arg_4 and arg_2 == arg_6:\n                    return arg_5\n                \n                elif arg_1 is None and arg_2 == arg_5.__class__.__name__:\n                    return arg_5\n                \n                elif arg_1 == arg_4 and arg_2 is None:\n                    return arg_5\n            \n            if arg_1 is None and arg_2 == arg_3.handle.__class__.__name__:\n                return arg_3.handle", "path": "bridgepoint/prebuild.py", "identifier": "SymbolTable.find_symbol", "docstring": "Find a symbol in the symbol table by name, kind, or both.", "docstring_tokens": ["Find", "a", "symbol", "in", "the", "symbol", "table", "by", "name", "kind", "or", "both", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 258547}
{"url": "https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L193-L241", "sha": "2a725df0b727e8b08f217ab84f7b8243c42554f5", "docstring_summary": "Using the record length and appropriate start points, seek to the\n        country that corresponds to the converted IP address integer.\n        Return offset of record.", "language": "python", "parameters": "(self, ipnum)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "0", "arg_3", "=", "127", "if", "len", "(", "str", "(", "arg_1", ")", ")", ">", "10", "else", "31", "for", "arg_4", "in", "range", "(", "arg_3", ",", "-", "1", ",", "-", "1", ")", ":", "if", "arg_0", ".", "_flags", "&", "const", ".", "MEMORY_CACHE", ":", "arg_5", "=", "2", "*", "arg_0", ".", "_recordLength", "*", "arg_2", "arg_6", "=", "arg_5", "+", "(", "2", "*", "arg_0", ".", "_recordLength", ")", "arg_7", "=", "arg_0", ".", "_memory", "[", "arg_5", ":", "arg_6", "]", "else", ":", "arg_5", "=", "2", "*", "arg_0", ".", "_recordLength", "*", "arg_2", "arg_8", "=", "2", "*", "arg_0", ".", "_recordLength", "try", ":", "arg_0", ".", "_lock", ".", "acquire", "(", ")", "arg_0", ".", "_fp", ".", "seek", "(", "arg_5", ",", "os", ".", "SEEK_SET", ")", "arg_7", "=", "arg_0", ".", "_fp", ".", "read", "(", "arg_8", ")", "finally", ":", "arg_0", ".", "_lock", ".", "release", "(", ")", "if", "PY3", "and", "type", "(", "arg_7", ")", "is", "bytes", ":", "arg_7", "=", "arg_7", ".", "decode", "(", "ENCODING", ")", "arg_9", "=", "[", "0", ",", "0", "]", "for", "arg_10", "in", "range", "(", "2", ")", ":", "for", "arg_11", "in", "range", "(", "arg_0", ".", "_recordLength", ")", ":", "arg_12", "=", "arg_7", "[", "arg_0", ".", "_recordLength", "*", "arg_10", "+", "arg_11", "]", "arg_9", "[", "arg_10", "]", "+=", "ord", "(", "arg_12", ")", "<<", "(", "arg_11", "*", "8", ")", "if", "arg_1", "&", "(", "1", "<<", "arg_4", ")", ":", "if", "arg_9", "[", "1", "]", ">=", "arg_0", ".", "_databaseSegments", ":", "arg_0", ".", "_netmask", "=", "arg_3", "-", "arg_4", "+", "1", "return", "arg_9", "[", "1", "]", "arg_2", "=", "arg_9", "[", "1", "]", "else", ":", "if", "arg_9", "[", "0", "]", ">=", "arg_0", ".", "_databaseSegments", ":", "arg_0", ".", "_netmask", "=", "arg_3", "-", "arg_4", "+", "1", "return", "arg_9", "[", "0", "]", "arg_2", "=", "arg_9", "[", "0", "]", "except", "(", "IndexError", ",", "UnicodeDecodeError", ")", ":", "pass", "raise", "GeoIPError", "(", "'Corrupt database'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Using the record length and appropriate start points, seek to the\n        country that corresponds to the converted IP address integer.\n        Return offset of record.\n\n        :arg ipnum: Result of ip2long conversion\n        \"\"\"\n        try:\n            arg_2 = 0\n            arg_3 = 127 if len(str(arg_1)) > 10 else 31\n\n            for arg_4 in range(arg_3, -1, -1):\n                if arg_0._flags & const.MEMORY_CACHE:\n                    arg_5 = 2 * arg_0._recordLength * arg_2\n                    arg_6 = arg_5 + (2 * arg_0._recordLength)\n                    arg_7 = arg_0._memory[arg_5:arg_6]\n                else:\n                    arg_5 = 2 * arg_0._recordLength * arg_2\n                    arg_8 = 2 * arg_0._recordLength\n                    try:\n                        arg_0._lock.acquire()\n                        arg_0._fp.seek(arg_5, os.SEEK_SET)\n                        arg_7 = arg_0._fp.read(arg_8)\n                    finally:\n                        arg_0._lock.release()\n\n                if PY3 and type(arg_7) is bytes:\n                    arg_7 = arg_7.decode(ENCODING)\n\n                arg_9 = [0, 0]\n                for arg_10 in range(2):\n                    for arg_11 in range(arg_0._recordLength):\n                        arg_12 = arg_7[arg_0._recordLength * arg_10 + arg_11]\n                        arg_9[arg_10] += ord(arg_12) << (arg_11 * 8)\n                if arg_1 & (1 << arg_4):\n                    if arg_9[1] >= arg_0._databaseSegments:\n                        arg_0._netmask = arg_3 - arg_4 + 1\n                        return arg_9[1]\n                    arg_2 = arg_9[1]\n                else:\n                    if arg_9[0] >= arg_0._databaseSegments:\n                        arg_0._netmask = arg_3 - arg_4 + 1\n                        return arg_9[0]\n                    arg_2 = arg_9[0]\n        except (IndexError, UnicodeDecodeError):\n            pass\n\n        raise GeoIPError('Corrupt database')", "path": "pygeoip/__init__.py", "identifier": "GeoIP._seek_country", "docstring": "Using the record length and appropriate start points, seek to the\n        country that corresponds to the converted IP address integer.\n        Return offset of record.\n\n        :arg ipnum: Result of ip2long conversion", "docstring_tokens": ["Using", "the", "record", "length", "and", "appropriate", "start", "points", "seek", "to", "the", "country", "that", "corresponds", "to", "the", "converted", "IP", "address", "integer", ".", "Return", "offset", "of", "record", "."], "nwo": "appliedsec/pygeoip", "score": 0.7204224841353906, "idx": 258548}
{"url": "https://github.com/xmartlabs/benderthon/blob/810b6fb90f56136257e7ed12e5a30d17ad7ce6ba/benderthon/tf_freeze.py#L42-L48", "sha": "810b6fb90f56136257e7ed12e5a30d17ad7ce6ba", "docstring_summary": "Save a small version of the graph based on a session and the output node names.", "language": "python", "parameters": "(sess, output_file_path, output_node_names, as_text=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "for", "arg_4", "in", "arg_0", ".", "graph_def", ".", "node", ":", "arg_4", ".", "device", "=", "''", "arg_6", "=", "graph_util", ".", "extract_sub_graph", "(", "arg_0", ".", "graph_def", ",", "arg_2", ")", "arg_7", ",", "arg_8", "=", "os", ".", "path", ".", "split", "(", "arg_1", ")", "graph_io", ".", "write_graph", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\"Save a small version of the graph based on a session and the output node names.\"\"\"\n    for arg_4 in arg_0.graph_def.node:\n        arg_4.device = ''\n    arg_6 = graph_util.extract_sub_graph(arg_0.graph_def, arg_2)\n    arg_7, arg_8 = os.path.split(arg_1)\n    graph_io.write_graph(arg_6, arg_7, arg_8, arg_3=arg_3)", "path": "benderthon/tf_freeze.py", "identifier": "save_graph_only", "docstring": "Save a small version of the graph based on a session and the output node names.", "docstring_tokens": ["Save", "a", "small", "version", "of", "the", "graph", "based", "on", "a", "session", "and", "the", "output", "node", "names", "."], "nwo": "xmartlabs/benderthon", "score": 0.2751458370028208, "idx": 258549}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/discord_webhook_hook.py#L76-L100", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Given a Discord http_conn_id, return the default webhook endpoint or override if a\n        webhook_endpoint is manually supplied.", "language": "python", "parameters": "(self, http_conn_id, webhook_endpoint)", "return_statement": "return endpoint", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ":", "arg_3", "=", "arg_2", "elif", "arg_1", ":", "arg_4", "=", "arg_0", ".", "get_connection", "(", "arg_1", ")", "arg_5", "=", "arg_4", ".", "extra_dejson", "arg_3", "=", "arg_5", ".", "get", "(", "'webhook_endpoint'", ",", "''", ")", "else", ":", "raise", "AirflowException", "(", "'Cannot get webhook endpoint: No valid Discord '", "'webhook endpoint or http_conn_id supplied.'", ")", "if", "not", "re", ".", "match", "(", "'^webhooks/[0-9]+/[a-zA-Z0-9_-]+$'", ",", "arg_3", ")", ":", "raise", "AirflowException", "(", "'Expected Discord webhook endpoint in the form '", "'of \"webhooks/{webhook.id}/{webhook.token}\".'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Given a Discord http_conn_id, return the default webhook endpoint or override if a\n        webhook_endpoint is manually supplied.\n\n        :param http_conn_id: The provided connection ID\n        :param webhook_endpoint: The manually provided webhook endpoint\n        :return: Webhook endpoint (str) to use\n        \"\"\"\n        if arg_2:\n            arg_3 = arg_2\n        elif arg_1:\n            arg_4 = arg_0.get_connection(arg_1)\n            arg_5 = arg_4.extra_dejson\n            arg_3 = arg_5.get('webhook_endpoint', '')\n        else:\n            raise AirflowException('Cannot get webhook endpoint: No valid Discord '\n                                   'webhook endpoint or http_conn_id supplied.')\n\n        # make sure endpoint matches the expected Discord webhook format\n        if not re.match('^webhooks/[0-9]+/[a-zA-Z0-9_-]+$', arg_3):\n            raise AirflowException('Expected Discord webhook endpoint in the form '\n                                   'of \"webhooks/{webhook.id}/{webhook.token}\".')\n\n        return arg_3", "path": "airflow/contrib/hooks/discord_webhook_hook.py", "identifier": "DiscordWebhookHook._get_webhook_endpoint", "docstring": "Given a Discord http_conn_id, return the default webhook endpoint or override if a\n        webhook_endpoint is manually supplied.\n\n        :param http_conn_id: The provided connection ID\n        :param webhook_endpoint: The manually provided webhook endpoint\n        :return: Webhook endpoint (str) to use", "docstring_tokens": ["Given", "a", "Discord", "http_conn_id", "return", "the", "default", "webhook", "endpoint", "or", "override", "if", "a", "webhook_endpoint", "is", "manually", "supplied", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258550}
{"url": "https://github.com/boakley/robotframework-lint/blob/3e3578f4e39af9af9961aa0a715f146b74474091/rflint/parser/parser.py#L272-L277", "sha": "3e3578f4e39af9af9961aa0a715f146b74474091", "docstring_summary": "Generator which returns all of the statements in all of the settings tables", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "tables", ":", "if", "isinstance", "(", "arg_1", ",", "SettingTable", ")", ":", "for", "arg_2", "in", "arg_1", ".", "statements", ":", "yield", "arg_2"], "function": "def Func(arg_0):\n        '''Generator which returns all of the statements in all of the Func tables'''\n        for arg_1 in arg_0.tables:\n            if isinstance(arg_1, SettingTable):\n                for arg_2 in arg_1.statements:\n                    yield arg_2", "path": "rflint/parser/parser.py", "identifier": "SuiteFile.settings", "docstring": "Generator which returns all of the statements in all of the settings tables", "docstring_tokens": ["Generator", "which", "returns", "all", "of", "the", "statements", "in", "all", "of", "the", "settings", "tables"], "nwo": "boakley/robotframework-lint", "score": 0.9109317500285141, "idx": 258551}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L658-L718", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Initiates an upgrade.", "language": "python", "parameters": "(self, service_name, deployment_name, mode,\n                           package_url, configuration, label, force,\n                           role_to_upgrade=None, extended_properties=None)", "return_statement": "return self._perform_post(\n            self._get_deployment_path_using_name(\n                service_name, deployment_name) + '/?comp=upgrade',\n            _XmlSerializer.upgrade_deployment_to_xml(\n                mode,\n                package_url,\n                configuration,\n                label,\n                role_to_upgrade,\n                force,\n                extended_properties),\n            as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'deployment_name'", ",", "arg_2", ")", "_validate_not_none", "(", "'mode'", ",", "arg_3", ")", "_validate_not_none", "(", "'package_url'", ",", "arg_4", ")", "_validate_not_none", "(", "'configuration'", ",", "arg_5", ")", "_validate_not_none", "(", "'label'", ",", "arg_6", ")", "_validate_not_none", "(", "'force'", ",", "arg_7", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_deployment_path_using_name", "(", "arg_1", ",", "arg_2", ")", "+", "'/?comp=upgrade'", ",", "_XmlSerializer", ".", "Func_to_xml", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_8", ",", "arg_7", ",", "arg_9", ")", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                           arg_4, arg_5, arg_6, arg_7,\n                           arg_8=None, arg_9=None):\n        '''\n        Initiates an upgrade.\n\n        service_name:\n            Name of the hosted service.\n        deployment_name:\n            The name of the deployment.\n        mode:\n            If set to Manual, WalkUpgradeDomain must be called to apply the\n            update. If set to Auto, the Windows Azure platform will\n            automatically apply the update To each upgrade domain for the\n            service. Possible values are: Auto, Manual\n        package_url:\n            A URL that refers to the location of the service package in the\n            Blob service. The service package can be located either in a\n            storage account beneath the same subscription or a Shared Access\n            Signature (SAS) URI from any storage account.\n        configuration:\n            The base-64 encoded service configuration file for the deployment.\n        label:\n            A name for the hosted service. The name can be up to 100 characters\n            in length. It is recommended that the label be unique within the\n            subscription. The name can be used to identify the hosted service\n            for your tracking purposes.\n        force:\n            Specifies whether the rollback should proceed even when it will\n            cause local data to be lost from some role instances. True if the\n            rollback should proceed; otherwise false if the rollback should\n            fail.\n        role_to_upgrade:\n            The name of the specific role to upgrade.\n        extended_properties:\n            Dictionary containing name/value pairs of storage account\n            properties. You can have a maximum of 50 extended property\n            name/value pairs. The maximum length of the Name element is 64\n            characters, only alphanumeric characters and underscores are valid\n            in the Name, and the name must start with a letter. The value has\n            a maximum length of 255 characters.\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('deployment_name', arg_2)\n        _validate_not_none('mode', arg_3)\n        _validate_not_none('package_url', arg_4)\n        _validate_not_none('configuration', arg_5)\n        _validate_not_none('label', arg_6)\n        _validate_not_none('force', arg_7)\n        return arg_0._perform_post(\n            arg_0._get_deployment_path_using_name(\n                arg_1, arg_2) + '/?comp=upgrade',\n            _XmlSerializer.Func_to_xml(\n                arg_3,\n                arg_4,\n                arg_5,\n                arg_6,\n                arg_8,\n                arg_7,\n                arg_9),\n            as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.upgrade_deployment", "docstring": "Initiates an upgrade.\n\n        service_name:\n            Name of the hosted service.\n        deployment_name:\n            The name of the deployment.\n        mode:\n            If set to Manual, WalkUpgradeDomain must be called to apply the\n            update. If set to Auto, the Windows Azure platform will\n            automatically apply the update To each upgrade domain for the\n            service. Possible values are: Auto, Manual\n        package_url:\n            A URL that refers to the location of the service package in the\n            Blob service. The service package can be located either in a\n            storage account beneath the same subscription or a Shared Access\n            Signature (SAS) URI from any storage account.\n        configuration:\n            The base-64 encoded service configuration file for the deployment.\n        label:\n            A name for the hosted service. The name can be up to 100 characters\n            in length. It is recommended that the label be unique within the\n            subscription. The name can be used to identify the hosted service\n            for your tracking purposes.\n        force:\n            Specifies whether the rollback should proceed even when it will\n            cause local data to be lost from some role instances. True if the\n            rollback should proceed; otherwise false if the rollback should\n            fail.\n        role_to_upgrade:\n            The name of the specific role to upgrade.\n        extended_properties:\n            Dictionary containing name/value pairs of storage account\n            properties. You can have a maximum of 50 extended property\n            name/value pairs. The maximum length of the Name element is 64\n            characters, only alphanumeric characters and underscores are valid\n            in the Name, and the name must start with a letter. The value has\n            a maximum length of 255 characters.", "docstring_tokens": ["Initiates", "an", "upgrade", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258552}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/geotiff.py#L23-L49", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Gets the 3 GeoTiff vlrs from the vlr_list and parse them into\n    a nicer structure", "language": "python", "parameters": "(vlr_list: vlrlist.VLRList)", "return_statement": "return parse_geo_tiff(geo_key_dir, geo_doubles, geo_ascii)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "VLRList", ")", "->", "List", "[", "GeoTiffKey", "]", ":", "arg_3", "=", "arg_0", ".", "get_by_id", "(", "GeoKeyDirectoryVlr", ".", "official_user_id", "(", ")", ",", "GeoKeyDirectoryVlr", ".", "official_record_ids", "(", ")", ")", "[", "0", "]", "arg_4", "=", "arg_0", ".", "get_by_id", "(", "GeoDoubleParamsVlr", ".", "official_user_id", "(", ")", ",", "GeoDoubleParamsVlr", ".", "official_record_ids", "(", ")", ")", "[", "0", "]", "arg_5", "=", "arg_0", ".", "get_by_id", "(", "GeoAsciiParamsVlr", ".", "official_user_id", "(", ")", ",", "GeoAsciiParamsVlr", ".", "official_record_ids", "(", ")", ")", "[", "0", "]", "return", "parse_geo_tiff", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0: arg_1.VLRList) -> List[GeoTiffKey]:\n    \"\"\" Gets the 3 GeoTiff vlrs from the vlr_list and parse them into\n    a nicer structure\n\n    Parameters\n    ----------\n    vlr_list: pylas.vrls.vlrslist.VLRList list of vlrs from a las file\n\n    Raises\n    ------\n        IndexError if any of the needed GeoTiffVLR is not found in the list\n\n    Returns\n    -------\n    List of GeoTiff keys parsed from the VLRs\n\n    \"\"\"\n    arg_3 = arg_0.get_by_id(\n        GeoKeyDirectoryVlr.official_user_id(), GeoKeyDirectoryVlr.official_record_ids()\n    )[0]\n    arg_4 = arg_0.get_by_id(\n        GeoDoubleParamsVlr.official_user_id(), GeoDoubleParamsVlr.official_record_ids()\n    )[0]\n    arg_5 = arg_0.get_by_id(\n        GeoAsciiParamsVlr.official_user_id(), GeoAsciiParamsVlr.official_record_ids()\n    )[0]\n    return parse_geo_tiff(arg_3, arg_4, arg_5)", "path": "pylas/vlrs/geotiff.py", "identifier": "parse_geo_tiff_keys_from_vlrs", "docstring": "Gets the 3 GeoTiff vlrs from the vlr_list and parse them into\n    a nicer structure\n\n    Parameters\n    ----------\n    vlr_list: pylas.vrls.vlrslist.VLRList list of vlrs from a las file\n\n    Raises\n    ------\n        IndexError if any of the needed GeoTiffVLR is not found in the list\n\n    Returns\n    -------\n    List of GeoTiff keys parsed from the VLRs", "docstring_tokens": ["Gets", "the", "3", "GeoTiff", "vlrs", "from", "the", "vlr_list", "and", "parse", "them", "into", "a", "nicer", "structure"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 258553}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L290-L297", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Get the header value for a name.", "language": "python", "parameters": "(self, name, default=None)", "return_statement": "return self.dict.get(name.lower(), default)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "dict", ".", "get", "(", "arg_1", ".", "lower", "(", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Get the header value for a name.\n\n        This is the normal interface: it returns a stripped version of the\n        header value for a given header name, or None if it doesn't exist.\n        This uses the dictionary version which finds the *last* such header.\n        \"\"\"\n        return arg_0.dict.get(arg_1.lower(), arg_2)", "path": "third_party/stdlib/rfc822.py", "identifier": "Message.getheader", "docstring": "Get the header value for a name.\n\n        This is the normal interface: it returns a stripped version of the\n        header value for a given header name, or None if it doesn't exist.\n        This uses the dictionary version which finds the *last* such header.", "docstring_tokens": ["Get", "the", "header", "value", "for", "a", "name", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258554}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/api.py#L30-L32", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Determines JSONAPI type for provided GUID", "language": "python", "parameters": "(self, guid)", "return_statement": "return self._json(self._get(self._build_url('guids', guid)), 200)['data']['type']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "return", "arg_0", ".", "_json", "(", "arg_0", ".", "_get", "(", "arg_0", ".", "_build_url", "(", "'guids'", ",", "Func", ")", ")", ",", "200", ")", "[", "'data'", "]", "[", "'type'", "]"], "function": "def Func(arg_0, Func):\n        \"\"\"Determines JSONAPI type for provided GUID\"\"\"\n        return arg_0._json(arg_0._get(arg_0._build_url('guids', Func)), 200)['data']['type']", "path": "osfclient/api.py", "identifier": "OSF.guid", "docstring": "Determines JSONAPI type for provided GUID", "docstring_tokens": ["Determines", "JSONAPI", "type", "for", "provided", "GUID"], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 258555}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/utils.py#L328-L331", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "activates error messages, useful during development", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "WARNING", ")", "peony", ".", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ")"], "function": "def Func():\n    \"\"\" activates error messages, useful during development \"\"\"\n    logging.basicConfig(level=logging.WARNING)\n    peony.logger.setLevel(logging.DEBUG)", "path": "peony/utils.py", "identifier": "set_debug", "docstring": "activates error messages, useful during development", "docstring_tokens": ["activates", "error", "messages", "useful", "during", "development"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 258556}
{"url": "https://github.com/costrouc/lammps-cython/blob/90f05d8b95fdf02005af8856f20f1c093c479ca3/lammps/potential.py#L46-L59", "sha": "90f05d8b95fdf02005af8856f20f1c093c479ca3", "docstring_summary": "Write tersoff potential file from parameters to string", "language": "python", "parameters": "(parameters)", "return_statement": "return '\\n'.join(lines)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ",", "arg_5", "in", "arg_0", ".", "items", "(", ")", ":", "if", "len", "(", "arg_5", ")", "!=", "14", ":", "raise", "ValueError", "(", "'tersoff three body potential expects 14 parameters'", ")", "arg_1", ".", "append", "(", "' '", ".", "join", "(", "[", "arg_2", ",", "arg_3", ",", "arg_4", "]", "+", "[", "'{:16.8g}'", ".", "format", "(", "arg_6", ")", "for", "arg_6", "in", "arg_5", "]", ")", ")", "return", "'\\n'", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Write tersoff potential file from parameters to string\n\n    Parameters\n    ----------\n    parameters: dict\n       keys are tuple of elements with the values being the parameters length 14\n    \"\"\"\n    arg_1 = []\n    for (arg_2, arg_3, arg_4), arg_5 in arg_0.items():\n        if len(arg_5) != 14:\n            raise ValueError('tersoff three body potential expects 14 parameters')\n        arg_1.append(' '.join([arg_2, arg_3, arg_4] + ['{:16.8g}'.format(arg_6) for arg_6 in arg_5]))\n    return '\\n'.join(arg_1)", "path": "lammps/potential.py", "identifier": "write_tersoff_potential", "docstring": "Write tersoff potential file from parameters to string\n\n    Parameters\n    ----------\n    parameters: dict\n       keys are tuple of elements with the values being the parameters length 14", "docstring_tokens": ["Write", "tersoff", "potential", "file", "from", "parameters", "to", "string"], "nwo": "costrouc/lammps-cython", "score": 0.17385480483333982, "idx": 258557}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/base.py#L478-L491", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Pretty-print the encoded output using ascii art.", "language": "python", "parameters": "(self, output, prefix=\"\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"\"", ")", ":", "print", "arg_2", ",", "arg_3", "=", "arg_0", ".", "getDescription", "(", ")", "+", "[", "(", "\"end\"", ",", "arg_0", ".", "getWidth", "(", ")", ")", "]", "for", "arg_4", "in", "xrange", "(", "len", "(", "arg_3", ")", "-", "1", ")", ":", "arg_5", "=", "arg_3", "[", "arg_4", "]", "[", "1", "]", "arg_6", "=", "arg_3", "[", "arg_4", "+", "1", "]", "[", "1", "]", "print", "\"%s |\"", "%", "bitsToString", "(", "arg_1", "[", "arg_5", ":", "arg_6", "]", ")", ",", "print"], "function": "def Func(arg_0, arg_1, arg_2=\"\"):\n    \"\"\"\n    Pretty-print the encoded output using ascii art.\n\n    :param output: to print\n    :param prefix: printed before the header if specified\n    \"\"\"\n    print arg_2,\n    arg_3 = arg_0.getDescription() + [(\"end\", arg_0.getWidth())]\n    for arg_4 in xrange(len(arg_3) - 1):\n      arg_5 = arg_3[arg_4][1]\n      arg_6 = arg_3[arg_4+1][1]\n      print \"%s |\" % bitsToString(arg_1[arg_5:arg_6]),\n    print", "path": "src/nupic/encoders/base.py", "identifier": "Encoder.pprint", "docstring": "Pretty-print the encoded output using ascii art.\n\n    :param output: to print\n    :param prefix: printed before the header if specified", "docstring_tokens": ["Pretty", "-", "print", "the", "encoded", "output", "using", "ascii", "art", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258558}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/utils.py#L21-L29", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Given a document_field and a form_value this will translate the value\n    to the correct result for mongo to use.", "language": "python", "parameters": "(document_field, form_value)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "if", "isinstance", "(", "arg_0", ",", "ReferenceField", ")", ":", "arg_2", "=", "arg_0", ".", "document_type", ".", "objects", ".", "get", "(", "id", "=", "arg_1", ")", "if", "arg_1", "else", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Given a document_field and a form_value this will translate the value\n    to the correct result for mongo to use.\n    \"\"\"\n    arg_2 = arg_1\n    if isinstance(arg_0, ReferenceField):\n        arg_2 = arg_0.document_type.objects.get(id=arg_1) if arg_1 else None\n    return arg_2", "path": "mongonaut/utils.py", "identifier": "translate_value", "docstring": "Given a document_field and a form_value this will translate the value\n    to the correct result for mongo to use.", "docstring_tokens": ["Given", "a", "document_field", "and", "a", "form_value", "this", "will", "translate", "the", "value", "to", "the", "correct", "result", "for", "mongo", "to", "use", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 258559}
{"url": "https://github.com/vint21h/nagios-notification-google-calendar/blob/ef2b58c939d9d55a69a54b4e6a3fd9b61bde50d4/notification_google_calendar.py#L173-L189", "sha": "ef2b58c939d9d55a69a54b4e6a3fd9b61bde50d4", "docstring_summary": "Create event start and end datetimes.", "language": "python", "parameters": "(options, config)", "return_statement": "return {\n        \"start\": {\n            \"dateTime\": (now + datetime.timedelta(minutes=int(config[\"start\"]))).strftime(DT_FORMAT),\n            \"timeZone\": options.timezone,\n        },\n        \"end\": {\n            \"dateTime\": (now + datetime.timedelta(minutes=int(config[\"end\"]))).strftime(DT_FORMAT),\n            \"timeZone\": options.timezone,\n        },\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "return", "{", "\"start\"", ":", "{", "\"dateTime\"", ":", "(", "arg_2", "+", "datetime", ".", "timedelta", "(", "minutes", "=", "int", "(", "arg_1", "[", "\"start\"", "]", ")", ")", ")", ".", "strftime", "(", "DT_FORMAT", ")", ",", "\"timeZone\"", ":", "arg_0", ".", "timezone", ",", "}", ",", "\"end\"", ":", "{", "\"dateTime\"", ":", "(", "arg_2", "+", "datetime", ".", "timedelta", "(", "minutes", "=", "int", "(", "arg_1", "[", "\"end\"", "]", ")", ")", ")", ".", "strftime", "(", "DT_FORMAT", ")", ",", "\"timeZone\"", ":", "arg_0", ".", "timezone", ",", "}", ",", "}"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Create event start and end datetimes.\n    \"\"\"\n\n    arg_2 = datetime.datetime.now()\n\n    return {\n        \"start\": {\n            \"dateTime\": (arg_2 + datetime.timedelta(minutes=int(arg_1[\"start\"]))).strftime(DT_FORMAT),\n            \"timeZone\": arg_0.timezone,\n        },\n        \"end\": {\n            \"dateTime\": (arg_2 + datetime.timedelta(minutes=int(arg_1[\"end\"]))).strftime(DT_FORMAT),\n            \"timeZone\": arg_0.timezone,\n        },\n    }", "path": "notification_google_calendar.py", "identifier": "create_event_datetimes", "docstring": "Create event start and end datetimes.", "docstring_tokens": ["Create", "event", "start", "and", "end", "datetimes", "."], "nwo": "vint21h/nagios-notification-google-calendar", "score": 0.16246995141409282, "idx": 258560}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/query.py#L891-L936", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Re-encrypt all of the files and checkpoints for a single user.", "language": "python", "parameters": "(engine,\n                           user_id,\n                           old_decrypt_func,\n                           new_encrypt_func,\n                           logger)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_4", ".", "info", "(", "\"Begin re-encryption for user %s\"", ",", "arg_1", ")", "with", "arg_0", ".", "begin", "(", ")", "as", "db", ":", "arg_4", ".", "info", "(", "\"Re-encrypting files for %s\"", ",", "arg_1", ")", "for", "(", "arg_5", ",", ")", "in", "select_file_ids", "(", "db", ",", "arg_1", ")", ":", "reencrypt_row_content", "(", "db", ",", "files", ",", "arg_5", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", ")", "arg_4", ".", "info", "(", "\"Re-encrypting checkpoints for %s\"", ",", "arg_1", ")", "for", "(", "arg_6", ",", ")", "in", "select_remote_checkpoint_ids", "(", "db", ",", "arg_1", ")", ":", "reencrypt_row_content", "(", "db", ",", "remote_checkpoints", ",", "arg_6", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", ")", "arg_4", ".", "info", "(", "\"Finished re-encryption for user %s\"", ",", "arg_1", ")"], "function": "def Func(arg_0,\n                           arg_1,\n                           arg_2,\n                           arg_3,\n                           arg_4):\n    \"\"\"\n    Re-encrypt all of the files and checkpoints for a single user.\n    \"\"\"\n    arg_4.info(\"Begin re-encryption for user %s\", arg_1)\n    with arg_0.begin() as db:\n        # NOTE: Doing both of these operations in one transaction depends for\n        # correctness on the fact that the creation of new checkpoints always\n        # involves writing new data into the database from Python, rather than\n        # simply copying data inside the DB.\n\n        # If we change checkpoint creation so that it does an in-database copy,\n        # then we need to split this transaction to ensure that\n        # file-reencryption is complete before checkpoint-reencryption starts.\n\n        # If that doesn't happen, it will be possible for a user to create a\n        # new checkpoint in a transaction that hasn't seen the completed\n        # file-reencryption process, but we might not see that checkpoint here,\n        # which means that we would never update the content of that checkpoint\n        # to the new encryption key.\n        arg_4.info(\"Re-encrypting files for %s\", arg_1)\n        for (arg_5,) in select_file_ids(db, arg_1):\n            reencrypt_row_content(\n                db,\n                files,\n                arg_5,\n                arg_2,\n                arg_3,\n                arg_4,\n            )\n\n        arg_4.info(\"Re-encrypting checkpoints for %s\", arg_1)\n        for (arg_6,) in select_remote_checkpoint_ids(db, arg_1):\n            reencrypt_row_content(\n                db,\n                remote_checkpoints,\n                arg_6,\n                arg_2,\n                arg_3,\n                arg_4,\n            )\n    arg_4.info(\"Finished re-encryption for user %s\", arg_1)", "path": "pgcontents/query.py", "identifier": "reencrypt_user_content", "docstring": "Re-encrypt all of the files and checkpoints for a single user.", "docstring_tokens": ["Re", "-", "encrypt", "all", "of", "the", "files", "and", "checkpoints", "for", "a", "single", "user", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 258561}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L1283-L1318", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Returns token for the request.", "language": "python", "parameters": "(self, host, path, httpclient)", "return_statement": "return token", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "'http://'", "+", "arg_1", "+", "arg_2", "+", "arg_0", ".", "issuer", "+", "arg_0", ".", "account_key", "if", "arg_4", "in", "arg_11", ":", "arg_5", "=", "arg_11", "[", "arg_4", "]", "if", "not", "arg_0", ".", "_token_is_expired", "(", "arg_5", ")", ":", "return", "arg_5", "arg_6", "=", "HTTPRequest", "(", ")", "arg_6", ".", "protocol_override", "=", "'https'", "arg_6", ".", "host", "=", "arg_1", ".", "replace", "(", "'.servicebus.'", ",", "'-sb.accesscontrol.'", ")", "arg_6", ".", "method", "=", "'POST'", "arg_6", ".", "path", "=", "'/WRAPv0.9'", "arg_6", ".", "body", "=", "(", "'wrap_name='", "+", "url_quote", "(", "arg_0", ".", "issuer", ")", "+", "'&wrap_password='", "+", "url_quote", "(", "arg_0", ".", "account_key", ")", "+", "'&wrap_scope='", "+", "url_quote", "(", "'http://'", "+", "arg_1", "+", "arg_2", ")", ")", ".", "encode", "(", "'utf-8'", ")", "arg_6", ".", "headers", ".", "append", "(", "(", "'Content-Length'", ",", "str", "(", "len", "(", "arg_6", ".", "body", ")", ")", ")", ")", "arg_10", "=", "arg_3", ".", "perform_request", "(", "arg_6", ")", "arg_5", "=", "arg_10", ".", "body", ".", "decode", "(", "'utf-8-sig'", ")", "arg_5", "=", "url_unquote", "(", "arg_5", "[", "arg_5", ".", "find", "(", "'='", ")", "+", "1", ":", "arg_5", ".", "rfind", "(", "'&'", ")", "]", ")", "arg_11", "[", "arg_4", "]", "=", "arg_5", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''\n        Returns token for the request.\n\n        host:\n            the Service Bus service request.\n        path:\n            the Service Bus service request.\n        '''\n        arg_4 = 'http://' + arg_1 + arg_2 + arg_0.issuer + arg_0.account_key\n\n        # Check whether has unexpired cache, return cached token if it is still\n        # usable.\n        if arg_4 in arg_11:\n            arg_5 = arg_11[arg_4]\n            if not arg_0._token_is_expired(arg_5):\n                return arg_5\n\n        # get token from accessconstrol server\n        arg_6 = HTTPRequest()\n        arg_6.protocol_override = 'https'\n        arg_6.host = arg_1.replace('.servicebus.', '-sb.accesscontrol.')\n        arg_6.method = 'POST'\n        arg_6.path = '/WRAPv0.9'\n        arg_6.body = ('wrap_name=' + url_quote(arg_0.issuer) +\n                        '&wrap_password=' + url_quote(arg_0.account_key) +\n                        '&wrap_scope=' +\n                        url_quote('http://' + arg_1 + arg_2)).encode('utf-8')\n        arg_6.headers.append(('Content-Length', str(len(arg_6.body))))\n        arg_10 = arg_3.perform_request(arg_6)\n\n        arg_5 = arg_10.body.decode('utf-8-sig')\n        arg_5 = url_unquote(arg_5[arg_5.find('=') + 1:arg_5.rfind('&')])\n        arg_11[arg_4] = arg_5\n\n        return arg_5", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusWrapTokenAuthentication._get_token", "docstring": "Returns token for the request.\n\n        host:\n            the Service Bus service request.\n        path:\n            the Service Bus service request.", "docstring_tokens": ["Returns", "token", "for", "the", "request", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258562}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/util.py#L161-L196", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Compute the labor hours, given a count of source lines of code", "language": "python", "parameters": "(sloc, month_hours='cocomo_book')", "return_statement": "return labor_hours", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'cocomo_book'", ")", ":", "if", "arg_1", "==", "'hours_per_year'", ":", "arg_2", "=", "40.0", "*", "52", "/", "12", "else", ":", "arg_2", "=", "152.0", "arg_3", "=", "'http://csse.usc.edu/tools/cocomoii.php'", "arg_4", "=", "requests", ".", "post", "(", "arg_3", ",", "data", "=", "{", "'new_size'", ":", "arg_0", "}", ")", "try", ":", "arg_5", "=", "float", "(", "EFFORT_REGEX", ".", "search", "(", "arg_4", ".", "text", ")", ".", "group", "(", "1", ")", ")", "except", "AttributeError", ":", "logger", ".", "error", "(", "'Unable to find Person Months in page text: sloc=%s'", ",", "arg_0", ")", "arg_5", "=", "0", "arg_6", "=", "arg_5", "*", "arg_2", "logger", ".", "debug", "(", "'sloc=%d labor_hours=%d'", ",", "arg_0", ",", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1='cocomo_book'):\n    \"\"\"\n    Compute the labor hours, given a count of source lines of code\n\n    The intention is to use the COCOMO II model to compute this value.\n\n    References:\n    - http://csse.usc.edu/tools/cocomoii.php\n    - http://docs.python-guide.org/en/latest/scenarios/scrape/\n    \"\"\"\n    # Calculation of hours in a month\n    if arg_1 == 'hours_per_year':\n        # Use number of working hours in a year:\n        # (40 Hours / week) * (52 weeks / year) / (12 months / year) ~= 173.33\n        arg_2 = 40.0 * 52 / 12\n    else:\n        # Use value from COCOMO II Book (month_hours=='cocomo_book'):\n        # Reference: https://dl.acm.org/citation.cfm?id=557000\n        # This is the value used by the Code.gov team:\n        # https://github.com/GSA/code-gov/blob/master/LABOR_HOUR_CALC.md\n        arg_2 = 152.0\n\n    arg_3 = 'http://csse.usc.edu/tools/cocomoii.php'\n    arg_4 = requests.post(arg_3, data={'new_size': arg_0})\n\n    try:\n        arg_5 = float(EFFORT_REGEX.search(arg_4.text).group(1))\n    except AttributeError:\n        logger.error('Unable to find Person Months in page text: sloc=%s', arg_0)\n        # If there is no match, and .search(..) returns None\n        arg_5 = 0\n\n    arg_6 = arg_5 * arg_2\n    logger.debug('sloc=%d labor_hours=%d', arg_0, arg_6)\n\n    return arg_6", "path": "scraper/util.py", "identifier": "compute_labor_hours", "docstring": "Compute the labor hours, given a count of source lines of code\n\n    The intention is to use the COCOMO II model to compute this value.\n\n    References:\n    - http://csse.usc.edu/tools/cocomoii.php\n    - http://docs.python-guide.org/en/latest/scenarios/scrape/", "docstring_tokens": ["Compute", "the", "labor", "hours", "given", "a", "count", "of", "source", "lines", "of", "code"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 258563}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/assembly_report.py#L143-L181", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Parse an assembly file in fasta format.", "language": "python", "parameters": "(self, assembly_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_1", ")", "as", "fh", ":", "arg_2", "=", "None", "logger", ".", "debug", "(", "\"Starting iteration of assembly file: {}\"", ".", "format", "(", "arg_1", ")", ")", "for", "arg_3", "in", "fh", ":", "if", "not", "arg_3", ".", "strip", "(", ")", ":", "continue", "if", "arg_3", ".", "startswith", "(", "\">\"", ")", ":", "arg_2", "=", "arg_3", "[", "1", ":", "]", ".", "strip", "(", ")", "arg_0", ".", "contigs", "[", "arg_2", "]", "=", "[", "]", "else", ":", "arg_0", ".", "contigs", "[", "arg_2", "]", ".", "append", "(", "arg_3", ".", "strip", "(", ")", ")", "arg_0", ".", "contigs", "=", "OrderedDict", "(", "(", "arg_2", ",", "\"\"", ".", "join", "(", "seq", ")", ")", "for", "arg_2", ",", "seq", "in", "arg_0", ".", "contigs", ".", "items", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parse an assembly file in fasta format.\n\n        This is a Fasta parsing method that populates the\n        :py:attr:`Assembly.contigs` attribute with data for each contig in the\n         assembly.\n\n        Parameters\n        ----------\n        assembly_file : str\n            Path to the assembly fasta file.\n\n        \"\"\"\n\n        with open(arg_1) as fh:\n\n            arg_2 = None\n            logger.debug(\"Starting iteration of assembly file: {}\".format(\n                arg_1))\n\n            for arg_3 in fh:\n\n                # Skip empty lines\n                if not arg_3.strip():\n                    continue\n\n                if arg_3.startswith(\">\"):\n                    # Add contig header to contig dictionary\n                    arg_2 = arg_3[1:].strip()\n                    arg_0.contigs[arg_2] = []\n\n                else:\n                    # Add sequence string for the current contig\n                    arg_0.contigs[arg_2].append(arg_3.strip())\n\n            # After populating the contigs dictionary, convert the values\n            # list into a string sequence\n            arg_0.contigs = OrderedDict(\n                (arg_2, \"\".join(seq)) for arg_2, seq in arg_0.contigs.items())", "path": "flowcraft/templates/assembly_report.py", "identifier": "Assembly._parse_assembly", "docstring": "Parse an assembly file in fasta format.\n\n        This is a Fasta parsing method that populates the\n        :py:attr:`Assembly.contigs` attribute with data for each contig in the\n         assembly.\n\n        Parameters\n        ----------\n        assembly_file : str\n            Path to the assembly fasta file.", "docstring_tokens": ["Parse", "an", "assembly", "file", "in", "fasta", "format", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 258564}
{"url": "https://github.com/nicfit/nicfit.py/blob/8313f8edbc5e7361ddad496d6d818324b5236c7a/nicfit/logger.py#L24-L26", "sha": "8313f8edbc5e7361ddad496d6d818324b5236c7a", "docstring_summary": "Log msg at 'verbose' level, debug < verbose < info", "language": "python", "parameters": "(self, msg, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_0", ".", "log", "(", "logging", ".", "VERBOSE", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Log msg at 'Func' level, debug < Func < info\"\"\"\n        arg_0.log(logging.VERBOSE, arg_1, *arg_2, **arg_3)", "path": "nicfit/logger.py", "identifier": "Logger.verbose", "docstring": "Log msg at 'verbose' level, debug < verbose < info", "docstring_tokens": ["Log", "msg", "at", "verbose", "level", "debug", "<", "verbose", "<", "info"], "nwo": "nicfit/nicfit.py", "score": 0.09252797783733271, "idx": 258565}
{"url": "https://github.com/zinic/pynsive/blob/15bc8b35a91be5817979eb327427b6235b1b411e/pynsive/reflection.py#L114-L136", "sha": "15bc8b35a91be5817979eb327427b6235b1b411e", "docstring_summary": "Attempts to list all of the modules and submodules found within a given\n    directory tree. This function recursively searches the directory tree\n    for potential python modules and returns a list of candidate names.", "language": "python", "parameters": "(directory)", "return_statement": "return found", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "for", "arg_2", "in", "os", ".", "listdir", "(", "arg_0", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_2", ")", "if", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "arg_3", ",", "MODULE_INIT_FILE", ")", ")", ":", "arg_4", "=", "_search_for_modules", "(", "arg_3", ",", "True", ",", "arg_2", ")", "arg_1", ".", "extend", "(", "arg_4", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Attempts to list all of the modules and submodules found within a given\n    directory tree. This function recursively searches the directory tree\n    for potential python modules and returns a list of candidate names.\n\n    **Note:** This function returns a list of strings representing\n    discovered module names, not the actual, loaded modules.\n\n    :param directory: the directory to search for modules.\n    \"\"\"\n    arg_1 = list()\n\n    if os.path.isdir(arg_0):\n        for arg_2 in os.listdir(arg_0):\n            arg_3 = os.path.join(arg_0, arg_2)\n\n            # Scan only if there's an __init__.py file\n            if os.path.isfile(os.path.join(arg_3, MODULE_INIT_FILE)):\n                arg_4 = _search_for_modules(arg_3, True, arg_2)\n                arg_1.extend(arg_4)\n\n    return arg_1", "path": "pynsive/reflection.py", "identifier": "rdiscover_modules", "docstring": "Attempts to list all of the modules and submodules found within a given\n    directory tree. This function recursively searches the directory tree\n    for potential python modules and returns a list of candidate names.\n\n    **Note:** This function returns a list of strings representing\n    discovered module names, not the actual, loaded modules.\n\n    :param directory: the directory to search for modules.", "docstring_tokens": ["Attempts", "to", "list", "all", "of", "the", "modules", "and", "submodules", "found", "within", "a", "given", "directory", "tree", ".", "This", "function", "recursively", "searches", "the", "directory", "tree", "for", "potential", "python", "modules", "and", "returns", "a", "list", "of", "candidate", "names", "."], "nwo": "zinic/pynsive", "score": 0.23137166388621372, "idx": 258566}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/csv.py#L50-L75", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Parse a CSV line into a price element", "language": "python", "parameters": "(self, line: str)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "PriceModel", ":", "arg_1", "=", "arg_1", ".", "rstrip", "(", ")", "arg_3", "=", "arg_1", ".", "split", "(", "','", ")", "arg_4", "=", "PriceModel", "(", ")", "arg_4", ".", "symbol", "=", "arg_0", ".", "translate_symbol", "(", "arg_3", "[", "0", "]", ")", "arg_4", ".", "value", "=", "Decimal", "(", "arg_3", "[", "1", "]", ")", "arg_7", "=", "arg_3", "[", "2", "]", "arg_7", "=", "arg_7", ".", "replace", "(", "'\"'", ",", "''", ")", "arg_8", "=", "arg_7", ".", "split", "(", "'/'", ")", "arg_9", "=", "arg_8", "[", "2", "]", "arg_10", "=", "arg_8", "[", "1", "]", "arg_11", "=", "arg_8", "[", "0", "]", "logging", ".", "debug", "(", "f\"parsing {date_parts} into date\"", ")", "arg_4", ".", "datetime", "=", "arg_12", "(", "int", "(", "arg_9", ")", ",", "int", "(", "arg_10", ")", ",", "int", "(", "arg_11", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1: arg_2) -> PriceModel:\n        \"\"\" Parse a CSV line into a price element \"\"\"\n        arg_1 = arg_1.rstrip()\n        arg_3 = arg_1.split(',')\n\n        arg_4 = PriceModel()\n\n        # symbol\n        arg_4.symbol = arg_0.translate_symbol(arg_3[0])\n\n        # value\n        arg_4.value = Decimal(arg_3[1])\n\n        # date\n        arg_7 = arg_3[2]\n        arg_7 = arg_7.replace('\"', '')\n        arg_8 = arg_7.split('/')\n\n        arg_9 = arg_8[2]\n        arg_10 = arg_8[1]\n        arg_11 = arg_8[0]\n\n        logging.debug(f\"parsing {date_parts} into date\")\n        arg_4.datetime = arg_12(int(arg_9), int(arg_10), int(arg_11))\n\n        return arg_4", "path": "pricedb/csv.py", "identifier": "CsvParser.parse_line", "docstring": "Parse a CSV line into a price element", "docstring_tokens": ["Parse", "a", "CSV", "line", "into", "a", "price", "element"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 258567}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L278-L306", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Get the list of milestones", "language": "python", "parameters": "(session, project_ids=[], milestone_ids=[], user_details=None, limit=10, offset=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ",", "arg_2", "=", "[", "]", ",", "arg_3", "=", "None", ",", "arg_4", "=", "10", ",", "arg_5", "=", "0", ")", ":", "arg_6", "=", "{", "}", "if", "arg_2", ":", "arg_6", "[", "'milestones[]'", "]", "=", "arg_2", "if", "arg_1", ":", "arg_6", "[", "'projects[]'", "]", "=", "arg_1", "arg_6", "[", "'limit'", "]", "=", "arg_4", "arg_6", "[", "'offset'", "]", "=", "arg_5", "if", "arg_3", ":", "arg_6", ".", "update", "(", "arg_3", ")", "arg_7", "=", "make_get_request", "(", "arg_0", ",", "'milestones'", ",", "params_data", "=", "arg_6", ")", "arg_8", "=", "arg_7", ".", "json", "(", ")", "if", "arg_7", ".", "status_code", "==", "200", ":", "return", "arg_8", "[", "'result'", "]", "else", ":", "raise", "MilestonesNotFoundException", "(", "message", "=", "arg_8", "[", "'message'", "]", ",", "error_code", "=", "arg_8", "[", "'error_code'", "]", ",", "request_id", "=", "arg_8", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1=[], arg_2=[], arg_3=None, arg_4=10, arg_5=0):\n    \"\"\"\n    Get the list of milestones\n    \"\"\"\n    arg_6 = {}\n    if arg_2:\n        arg_6['milestones[]'] = arg_2\n    if arg_1:\n        arg_6['projects[]'] = arg_1\n    arg_6['limit'] = arg_4\n    arg_6['offset'] = arg_5\n\n    # Add projections if they exist\n    if arg_3:\n        arg_6.update(arg_3)\n\n    # GET /api/projects/0.1/milestones/\n\n    arg_7 = make_get_request(\n        arg_0, 'milestones', params_data=arg_6)\n    arg_8 = arg_7.json()\n    if arg_7.status_code == 200:\n        return arg_8['result']\n    else:\n        raise MilestonesNotFoundException(\n            message=arg_8['message'],\n            error_code=arg_8['error_code'],\n            request_id=arg_8['request_id']\n        )", "path": "freelancersdk/resources/projects/projects.py", "identifier": "get_milestones", "docstring": "Get the list of milestones", "docstring_tokens": ["Get", "the", "list", "of", "milestones"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 258568}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2243-L2255", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Update the results string and last-update-time fields of a model.", "language": "python", "parameters": "(self, jobID, results)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_3", "=", "'UPDATE %s SET _eng_last_update_time=UTC_TIMESTAMP(), '", "'              results=%%s '", "'          WHERE job_id=%%s'", "%", "(", "arg_0", ".", "jobsTableName", ",", ")", "conn", ".", "cursor", ".", "execute", "(", "arg_3", ",", "[", "arg_2", ",", "arg_1", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Update the results string and last-update-time fields of a model.\n\n    Parameters:\n    ----------------------------------------------------------------\n    jobID:      job ID of model to modify\n    results:    new results (json dict string)\n    \"\"\"\n    with ConnectionFactory.get() as conn:\n      arg_3 = 'UPDATE %s SET _eng_last_update_time=UTC_TIMESTAMP(), ' \\\n              '              results=%%s ' \\\n              '          WHERE job_id=%%s' % (arg_0.jobsTableName,)\n      conn.cursor.execute(arg_3, [arg_2, arg_1])", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.jobUpdateResults", "docstring": "Update the results string and last-update-time fields of a model.\n\n    Parameters:\n    ----------------------------------------------------------------\n    jobID:      job ID of model to modify\n    results:    new results (json dict string)", "docstring_tokens": ["Update", "the", "results", "string", "and", "last", "-", "update", "-", "time", "fields", "of", "a", "model", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258569}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/process.py#L207-L234", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "This function deal with the heat notification.", "language": "python", "parameters": "(body, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "'event_type'", "]", "arg_3", "=", "heat_customer_process", ".", "get", "(", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "(", "arg_0", ",", "arg_1", ")", "else", ":", "arg_4", "=", "False", "arg_5", "=", "None", "for", "arg_6", "in", "heat_customer_process_wildcard", ".", "keys", "(", ")", ":", "if", "arg_6", ".", "match", "(", "arg_2", ")", ":", "arg_5", "=", "heat_customer_process_wildcard", ".", "get", "(", "arg_6", ")", "arg_4", "=", "True", "break", "if", "arg_4", ":", "arg_5", "(", "arg_0", ",", "arg_1", ")", "else", ":", "default_process", "(", "arg_0", ",", "arg_1", ")", "arg_1", ".", "ack", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This function deal with the heat notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:\n    \"\"\"\n    arg_2 = arg_0['event_type']\n    arg_3 = heat_customer_process.get(arg_2)\n    if arg_3 is not None:\n        arg_3(arg_0, arg_1)\n    else:\n        arg_4 = False\n        arg_5 = None\n        for arg_6 in heat_customer_process_wildcard.keys():\n            if arg_6.match(arg_2):\n                arg_5 = heat_customer_process_wildcard.get(arg_6)\n                arg_4 = True\n                break\n        if arg_4:\n            arg_5(arg_0, arg_1)\n        else:\n            default_process(arg_0, arg_1)\n    arg_1.ack()", "path": "ternya/process.py", "identifier": "heat_process", "docstring": "This function deal with the heat notification.\n\n    First, find process from customer_process that not include wildcard.\n    if not find from customer_process, then find process from customer_process_wildcard.\n    if not find from customer_process_wildcard, then use ternya default process.\n    :param body: dict of openstack notification.\n    :param message: kombu Message class\n    :return:", "docstring_tokens": ["This", "function", "deal", "with", "the", "heat", "notification", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 258570}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/rfclass.py#L619-L726", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This plots the training results from the classifier run on the training\n    set.", "language": "python", "parameters": "(classifier,\n                          classlabels,\n                          outfile)", "return_statement": "return outfile", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", "and", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "infd", ":", "arg_3", "=", "pickle", ".", "load", "(", "infd", ")", "elif", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "arg_3", "=", "arg_0", "else", ":", "LOGERROR", "(", "\"can't figure out the input classifier arg\"", ")", "return", "None", "arg_4", "=", "arg_3", "[", "'best_confmatrix'", "]", "arg_5", "=", "arg_3", "[", "'best_classifier'", "]", ".", "feature_importances_", "arg_6", "=", "np", ".", "array", "(", "[", "tree", ".", "feature_importances_", "for", "tree", "in", "arg_3", "[", "'best_classifier'", "]", ".", "estimators_", "]", ")", "arg_7", "=", "np", ".", "std", "(", "arg_6", ",", "axis", "=", "0", ")", "arg_8", "=", "np", ".", "array", "(", "arg_3", "[", "'feature_names'", "]", ")", "plt", ".", "figure", "(", "figsize", "=", "(", "6.4", "*", "3.0", ",", "4.8", ")", ")", "plt", ".", "subplot", "(", "121", ")", "arg_9", "=", "np", ".", "array", "(", "arg_1", ")", "plt", ".", "imshow", "(", "arg_4", ",", "interpolation", "=", "'nearest'", ",", "cmap", "=", "plt", ".", "cm", ".", "Blues", ")", "arg_10", "=", "np", ".", "arange", "(", "len", "(", "arg_9", ")", ")", "plt", ".", "xticks", "(", "arg_10", ",", "arg_9", ")", "plt", ".", "yticks", "(", "arg_10", ",", "arg_9", ")", "plt", ".", "title", "(", "'evaluation set confusion matrix'", ")", "plt", ".", "ylabel", "(", "'predicted class'", ")", "plt", ".", "xlabel", "(", "'actual class'", ")", "arg_11", "=", "arg_4", ".", "max", "(", ")", "/", "2.", "for", "arg_12", ",", "arg_13", "in", "itertools", ".", "product", "(", "range", "(", "arg_4", ".", "shape", "[", "0", "]", ")", ",", "range", "(", "arg_4", ".", "shape", "[", "1", "]", ")", ")", ":", "plt", ".", "text", "(", "arg_13", ",", "arg_12", ",", "arg_4", "[", "arg_12", ",", "arg_13", "]", ",", "horizontalalignment", "=", "\"center\"", ",", "color", "=", "\"white\"", "if", "arg_4", "[", "arg_12", ",", "arg_13", "]", ">", "arg_11", "else", "\"black\"", ")", "plt", ".", "subplot", "(", "122", ")", "arg_14", "=", "np", ".", "array", "(", "arg_8", ")", "arg_15", "=", "np", ".", "argsort", "(", "arg_5", ")", "[", ":", ":", "-", "1", "]", "arg_14", "=", "arg_14", "[", "arg_15", "]", "arg_8", "=", "arg_8", "[", "arg_15", "]", "arg_5", "=", "arg_5", "[", "arg_15", "]", "arg_7", "=", "arg_7", "[", "arg_15", "]", "plt", ".", "bar", "(", "np", ".", "arange", "(", "0", ",", "arg_14", ".", "size", ")", ",", "arg_5", ",", "yerr", "=", "arg_7", ",", "width", "=", "0.8", ",", "color", "=", "'grey'", ")", "plt", ".", "xticks", "(", "np", ".", "arange", "(", "0", ",", "arg_14", ".", "size", ")", ",", "arg_14", ",", "rotation", "=", "90", ")", "plt", ".", "yticks", "(", "[", "0.0", ",", "0.1", ",", "0.2", ",", "0.3", ",", "0.4", ",", "0.5", ",", "0.6", ",", "0.7", ",", "0.8", ",", "0.9", ",", "1.0", "]", ")", "plt", ".", "xlim", "(", "-", "0.75", ",", "arg_14", ".", "size", "-", "1.0", "+", "0.75", ")", "plt", ".", "ylim", "(", "0.0", ",", "0.9", ")", "plt", ".", "ylabel", "(", "'relative importance'", ")", "plt", ".", "title", "(", "'relative importance of features'", ")", "plt", ".", "subplots_adjust", "(", "wspace", "=", "0.1", ")", "plt", ".", "savefig", "(", "arg_2", ",", "bbox_inches", "=", "'tight'", ",", "dpi", "=", "100", ")", "plt", ".", "close", "(", "'all'", ")", "return", "arg_2"], "function": "def Func(arg_0,\n                          arg_1,\n                          arg_2):\n    '''This plots the training results from the classifier run on the training\n    set.\n\n    - plots the confusion matrix\n\n    - plots the feature importances\n\n    - FIXME: plot the learning curves too, see:\n      http://scikit-learn.org/stable/modules/learning_curve.html\n\n    Parameters\n    ----------\n\n    classifier : dict or str\n        This is the output dict or pickle created by `get_rf_classifier`\n        containing the trained classifier.\n\n    classlabels : list of str\n        This contains all of the class labels for the current classification\n        problem.\n\n    outfile : str\n        This is the filename where the plots will be written.\n\n    Returns\n    -------\n\n    str\n        The path to the generated plot file.\n\n    '''\n\n    if isinstance(arg_0,str) and os.path.exists(arg_0):\n        with open(arg_0,'rb') as infd:\n            arg_3 = pickle.load(infd)\n    elif isinstance(arg_0, dict):\n        arg_3 = arg_0\n    else:\n        LOGERROR(\"can't figure out the input classifier arg\")\n        return None\n\n    arg_4 = arg_3['best_confmatrix']\n    arg_5 = arg_3[\n        'best_classifier'\n    ].feature_importances_\n    arg_6 = np.array([\n        tree.feature_importances_\n        for tree in arg_3['best_classifier'].estimators_\n    ])\n    arg_7 = np.std(arg_6,axis=0)\n\n    arg_8 = np.array(arg_3['feature_names'])\n\n    plt.figure(figsize=(6.4*3.0,4.8))\n\n    # confusion matrix\n    plt.subplot(121)\n    arg_9 = np.array(arg_1)\n    plt.imshow(arg_4, interpolation='nearest', cmap=plt.cm.Blues)\n    arg_10 = np.arange(len(arg_9))\n    plt.xticks(arg_10, arg_9)\n    plt.yticks(arg_10, arg_9)\n    plt.title('evaluation set confusion matrix')\n    plt.ylabel('predicted class')\n    plt.xlabel('actual class')\n\n    arg_11 = arg_4.max() / 2.\n    for arg_12, arg_13 in itertools.product(range(arg_4.shape[0]),\n                                  range(arg_4.shape[1])):\n        plt.text(arg_13, arg_12, arg_4[arg_12, arg_13],\n                 horizontalalignment=\"center\",\n                 color=\"white\" if arg_4[arg_12, arg_13] > arg_11 else \"black\")\n\n    # feature importances\n    plt.subplot(122)\n\n    arg_14 = np.array(arg_8)\n    arg_15 = np.argsort(arg_5)[::-1]\n\n    arg_14 = arg_14[arg_15]\n    arg_8 = arg_8[arg_15]\n    arg_5 = arg_5[arg_15]\n    arg_7 = arg_7[arg_15]\n\n    plt.bar(np.arange(0,arg_14.size),\n            arg_5,\n            yerr=arg_7,\n            width=0.8,\n            color='grey')\n    plt.xticks(np.arange(0,arg_14.size),\n               arg_14,\n               rotation=90)\n    plt.yticks([0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0])\n    plt.xlim(-0.75, arg_14.size - 1.0 + 0.75)\n    plt.ylim(0.0,0.9)\n    plt.ylabel('relative importance')\n    plt.title('relative importance of features')\n\n    plt.subplots_adjust(wspace=0.1)\n\n    plt.savefig(arg_2,\n                bbox_inches='tight',\n                dpi=100)\n    plt.close('all')\n    return arg_2", "path": "astrobase/varclass/rfclass.py", "identifier": "plot_training_results", "docstring": "This plots the training results from the classifier run on the training\n    set.\n\n    - plots the confusion matrix\n\n    - plots the feature importances\n\n    - FIXME: plot the learning curves too, see:\n      http://scikit-learn.org/stable/modules/learning_curve.html\n\n    Parameters\n    ----------\n\n    classifier : dict or str\n        This is the output dict or pickle created by `get_rf_classifier`\n        containing the trained classifier.\n\n    classlabels : list of str\n        This contains all of the class labels for the current classification\n        problem.\n\n    outfile : str\n        This is the filename where the plots will be written.\n\n    Returns\n    -------\n\n    str\n        The path to the generated plot file.", "docstring_tokens": ["This", "plots", "the", "training", "results", "from", "the", "classifier", "run", "on", "the", "training", "set", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258571}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/templates.py#L14-L21", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Return JSON representation for this template", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "fields", ":", "arg_1", "[", "arg_2", ".", "name", "]", "=", "arg_2", ".", "Func", "(", "arg_0", ".", "data", ".", "get", "(", "arg_2", ".", "name", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return JSON representation for this template\"\"\"\n        arg_1 = {}\n\n        for arg_2 in arg_0.fields:\n            arg_1[arg_2.name] = arg_2.Func(arg_0.data.get(arg_2.name))\n\n        return arg_1", "path": "dispatch/theme/templates.py", "identifier": "Template.to_json", "docstring": "Return JSON representation for this template", "docstring_tokens": ["Return", "JSON", "representation", "for", "this", "template"], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 258572}
{"url": "https://github.com/bitlabstudio/django-dashboard-app/blob/ed98f2bca91a4ced36d0dd1aa1baee78e989cf64/dashboard_app/view_mixins.py#L44-L61", "sha": "ed98f2bca91a4ced36d0dd1aa1baee78e989cf64", "docstring_summary": "Adds ``is_rendered`` to the context and the widget's context data.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return ctx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "super", "(", "RenderWidgetMixin", ",", "arg_0", ")", ".", "Func", "(", "**", "arg_1", ")", "arg_2", ".", "update", "(", "{", "'is_rendered'", ":", "True", ",", "'widget'", ":", "arg_0", ".", "widget", ",", "}", ")", "arg_2", ".", "update", "(", "arg_0", ".", "widget", ".", "Func", "(", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Adds ``is_rendered`` to the context and the widget's context data.\n\n        ``is_rendered`` signals that the AJAX view has been called and that\n        we are displaying the full widget now. When ``is_rendered`` is not\n        found in the widget template it means that we are seeing the first\n        page load and all widgets still have to get their real data from\n        this AJAX view.\n\n        \"\"\"\n        arg_2 = super(RenderWidgetMixin, arg_0).Func(**arg_1)\n        arg_2.update({\n            'is_rendered': True,\n            'widget': arg_0.widget,\n        })\n        arg_2.update(arg_0.widget.Func())\n        return arg_2", "path": "dashboard_app/view_mixins.py", "identifier": "RenderWidgetMixin.get_context_data", "docstring": "Adds ``is_rendered`` to the context and the widget's context data.\n\n        ``is_rendered`` signals that the AJAX view has been called and that\n        we are displaying the full widget now. When ``is_rendered`` is not\n        found in the widget template it means that we are seeing the first\n        page load and all widgets still have to get their real data from\n        this AJAX view.", "docstring_tokens": ["Adds", "is_rendered", "to", "the", "context", "and", "the", "widget", "s", "context", "data", "."], "nwo": "bitlabstudio/django-dashboard-app", "score": 0.19645210594164048, "idx": 258573}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L2339-L2358", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Returns the given string as a string of bytes. That means in\n        Python2 as a str object, and in Python3 as a bytes object.\n        Raises a TypeError, if it cannot be converted.", "language": "python", "parameters": "(s, encoding='utf-8')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf-8'", ")", ":", "if", "six", ".", "PY2", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "unicode", ")", ":", "return", "arg_0", ".", "encode", "(", "arg_1", ")", "else", ":", "if", "isinstance", "(", "arg_0", ",", "bytes", ")", ":", "return", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "arg_0", ".", "encode", "(", "arg_1", ")", "raise", "TypeError", "(", "\"Invalid argument %r for Func()\"", "%", "(", "arg_0", ",", ")", ")"], "function": "def Func(arg_0, arg_1='utf-8'):\n        \"\"\"\n        Returns the given string as a string of bytes. That means in\n        Python2 as a str object, and in Python3 as a bytes object.\n        Raises a TypeError, if it cannot be converted.\n        \"\"\"\n        if six.PY2:\n            # This is Python2\n            if isinstance(arg_0, str):\n                return arg_0\n            elif isinstance(arg_0, unicode):  # noqa, pylint: disable=undefined-variable\n                return arg_0.encode(arg_1)\n        else:\n            # And this is Python3\n            if isinstance(arg_0, bytes):\n                return arg_0\n            elif isinstance(arg_0, str):\n                return arg_0.encode(arg_1)\n\n        raise TypeError(\"Invalid argument %r for Func()\" % (arg_0,))", "path": "profitbricks/client.py", "identifier": "ProfitBricksService._b", "docstring": "Returns the given string as a string of bytes. That means in\n        Python2 as a str object, and in Python3 as a bytes object.\n        Raises a TypeError, if it cannot be converted.", "docstring_tokens": ["Returns", "the", "given", "string", "as", "a", "string", "of", "bytes", ".", "That", "means", "in", "Python2", "as", "a", "str", "object", "and", "in", "Python3", "as", "a", "bytes", "object", ".", "Raises", "a", "TypeError", "if", "it", "cannot", "be", "converted", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 258574}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muccore.py#L611-L633", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Remove the MUC specific stanza payload element.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "muc_child", ":", "arg_0", ".", "muc_child", ".", "free_borrowed", "(", ")", "arg_0", ".", "muc_child", "=", "None", "if", "not", "arg_0", ".", "xmlnode", ".", "children", ":", "return", "arg_2", "=", "arg_0", ".", "xmlnode", ".", "children", "while", "arg_2", ":", "if", "arg_2", ".", "name", "not", "in", "(", "\"x\"", ",", "\"query\"", ")", ":", "arg_2", "=", "arg_2", ".", "next", "continue", "arg_3", "=", "arg_2", ".", "ns", "(", ")", "if", "not", "arg_3", ":", "arg_2", "=", "arg_2", ".", "next", "continue", "arg_4", "=", "arg_3", ".", "getContent", "(", ")", "if", "arg_4", "in", "(", "MUC_NS", ",", "MUC_USER_NS", ",", "MUC_ADMIN_NS", ",", "MUC_OWNER_NS", ")", ":", "arg_2", ".", "unlinkNode", "(", ")", "arg_2", ".", "freeNode", "(", ")", "arg_2", "=", "arg_2", ".", "next"], "function": "def Func(arg_0):\n        \"\"\"\n        Remove the MUC specific stanza payload element.\n        \"\"\"\n        if arg_0.muc_child:\n            arg_0.muc_child.free_borrowed()\n            arg_0.muc_child=None\n        if not arg_0.xmlnode.children:\n            return\n        arg_2=arg_0.xmlnode.children\n        while arg_2:\n            if arg_2.name not in (\"x\",\"query\"):\n                arg_2=arg_2.next\n                continue\n            arg_3=arg_2.ns()\n            if not arg_3:\n                arg_2=arg_2.next\n                continue\n            arg_4=arg_3.getContent()\n            if arg_4 in (MUC_NS,MUC_USER_NS,MUC_ADMIN_NS,MUC_OWNER_NS):\n                arg_2.unlinkNode()\n                arg_2.freeNode()\n            arg_2=arg_2.next", "path": "pyxmpp2/ext/muc/muccore.py", "identifier": "MucStanzaExt.clear_muc_child", "docstring": "Remove the MUC specific stanza payload element.", "docstring_tokens": ["Remove", "the", "MUC", "specific", "stanza", "payload", "element", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258575}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1678-L1730", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Display the exception that just occurred.", "language": "python", "parameters": "(self,exc_tuple = None,filename=None,tb_offset=None,\n                      exception_only=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "try", ":", "try", ":", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_0", ".", "_get_exc_info", "(", "arg_1", ")", "except", "ValueError", ":", "arg_0", ".", "write_err", "(", "'No traceback available to show.\\n'", ")", "return", "if", "arg_5", "is", "SyntaxError", ":", "arg_0", ".", "showsyntaxerror", "(", "arg_2", ")", "elif", "arg_5", "is", "UsageError", ":", "arg_0", ".", "write_err", "(", "\"UsageError: %s\"", "%", "arg_6", ")", "else", ":", "if", "arg_4", ":", "arg_8", "=", "[", "'An exception has occurred, use %tb to see '", "'the full traceback.\\n'", "]", "arg_8", ".", "extend", "(", "arg_0", ".", "InteractiveTB", ".", "get_exception_only", "(", "arg_5", ",", "arg_6", ")", ")", "else", ":", "try", ":", "arg_8", "=", "arg_6", ".", "_render_traceback_", "(", ")", "except", "Exception", ":", "arg_8", "=", "arg_0", ".", "InteractiveTB", ".", "structured_traceback", "(", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_Func", "(", "arg_5", ",", "arg_6", ",", "arg_8", ")", "if", "arg_0", ".", "call_pdb", ":", "arg_0", ".", "debugger", "(", "force", "=", "True", ")", "return", "arg_0", ".", "_Func", "(", "arg_5", ",", "arg_6", ",", "arg_8", ")", "except", "KeyboardInterrupt", ":", "arg_0", ".", "write_err", "(", "\"\\nKeyboardInterrupt\\n\"", ")"], "function": "def Func(arg_0,arg_1 = None,arg_2=None,arg_3=None,\n                      arg_4=False):\n        \"\"\"Display the exception that just occurred.\n\n        If nothing is known about the exception, this is the method which\n        should be used throughout the code for presenting user tracebacks,\n        rather than directly invoking the InteractiveTB object.\n\n        A specific showsyntaxerror() also exists, but this method can take\n        care of calling it if needed, so unless you are explicitly catching a\n        SyntaxError exception, don't try to analyze the stack manually and\n        simply call this method.\"\"\"\n\n        try:\n            try:\n                arg_5, arg_6, arg_7 = arg_0._get_exc_info(arg_1)\n            except ValueError:\n                arg_0.write_err('No traceback available to show.\\n')\n                return\n            \n            if arg_5 is SyntaxError:\n                # Though this won't be called by syntax errors in the input\n                # line, there may be SyntaxError cases with imported code.\n                arg_0.showsyntaxerror(arg_2)\n            elif arg_5 is UsageError:\n                arg_0.write_err(\"UsageError: %s\" % arg_6)\n            else:\n                if arg_4:\n                    arg_8 = ['An exception has occurred, use %tb to see '\n                           'the full traceback.\\n']\n                    arg_8.extend(arg_0.InteractiveTB.get_exception_only(arg_5,\n                                                                     arg_6))\n                else:\n                    try:\n                        # Exception classes can customise their traceback - we\n                        # use this in IPython.parallel for exceptions occurring\n                        # in the engines. This should return a list of strings.\n                        arg_8 = arg_6._render_traceback_()\n                    except Exception:\n                        arg_8 = arg_0.InteractiveTB.structured_traceback(arg_5,\n                                            arg_6, arg_7, arg_3=arg_3)\n\n                    arg_0._Func(arg_5, arg_6, arg_8)\n                    if arg_0.call_pdb:\n                        # drop into debugger\n                        arg_0.debugger(force=True)\n                    return\n\n                # Actually show the traceback\n                arg_0._Func(arg_5, arg_6, arg_8)\n\n        except KeyboardInterrupt:\n            arg_0.write_err(\"\\nKeyboardInterrupt\\n\")", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.showtraceback", "docstring": "Display the exception that just occurred.\n\n        If nothing is known about the exception, this is the method which\n        should be used throughout the code for presenting user tracebacks,\n        rather than directly invoking the InteractiveTB object.\n\n        A specific showsyntaxerror() also exists, but this method can take\n        care of calling it if needed, so unless you are explicitly catching a\n        SyntaxError exception, don't try to analyze the stack manually and\n        simply call this method.", "docstring_tokens": ["Display", "the", "exception", "that", "just", "occurred", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258576}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L196-L256", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Create a torus mesh", "language": "python", "parameters": "(script, major_radius=3.0, minor_radius=1.0, inner_diameter=None,\n          outer_diameter=None, major_segments=48, minor_segments=12,\n          color=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3.0", ",", "arg_2", "=", "1.0", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "48", ",", "arg_6", "=", "12", ",", "arg_7", "=", "None", ")", ":", "if", "arg_3", "is", "not", "None", "and", "arg_4", "is", "not", "None", ":", "arg_1", "=", "(", "arg_3", "+", "arg_4", ")", "/", "4", "arg_2", "=", "arg_1", "-", "arg_3", "/", "2", "arg_8", "=", "''", ".", "join", "(", "[", "'  <filter name=\"Torus\">\\n'", ",", "'    <Param name=\"hRadius\" '", ",", "'value=\"%s\" '", "%", "arg_1", ",", "'description=\"Horizontal Radius\" '", ",", "'type=\"RichFloat\" '", ",", "'/>\\n'", ",", "'    <Param name=\"vRadius\" '", ",", "'value=\"%s\" '", "%", "arg_2", ",", "'description=\"Vertical Radius\" '", ",", "'type=\"RichFloat\" '", ",", "'/>\\n'", ",", "'    <Param name=\"hSubdiv\" '", ",", "'value=\"%d\" '", "%", "arg_5", ",", "'description=\"Horizontal Subdivision\" '", ",", "'type=\"RichInt\" '", ",", "'/>\\n'", ",", "'    <Param name=\"vSubdiv\" '", ",", "'value=\"%d\" '", "%", "arg_6", ",", "'description=\"Vertical Subdivision\" '", ",", "'type=\"RichInt\" '", ",", "'/>\\n'", ",", "'  </filter>\\n'", "]", ")", "util", ".", "write_filter", "(", "arg_0", ",", "arg_8", ")", "if", "isinstance", "(", "arg_0", ",", "FilterScript", ")", ":", "arg_0", ".", "add_layer", "(", "'Torus'", ",", "change_layer", "=", "True", ")", "if", "arg_7", "is", "not", "None", ":", "vert_color", ".", "function", "(", "arg_0", ",", "arg_7", "=", "arg_7", ")", "return", "None"], "function": "def Func(arg_0, arg_1=3.0, arg_2=1.0, arg_3=None,\n          arg_4=None, arg_5=48, arg_6=12,\n          arg_7=None):\n    \"\"\"Create a Func mesh\n\n    Args:\n        major_radius (float, (optional)): radius from the origin to the\n            center of the cross sections\n        minor_radius (float, (optional)): radius of the Func cross\n            section\n        inner_diameter (float, (optional)): inner diameter of Func. If\n            both inner_diameter and outer_diameter are provided then\n            these will override major_radius and minor_radius.,\n        outer_diameter (float, (optional)): outer diameter of Func. If\n            both inner_diameter and outer_diameter are provided then\n            these will override major_radius and minor_radius.\n        major_segments (int (optional)): number of segments for the main\n            ring of the Func\n        minor_segments (int (optional)): number of segments for the minor\n            ring of the Func\n        color (str (optional)): color name to apply vertex colors to the\n            newly created mesh\n\n    Returns:\n        None\n\n    \"\"\"\n    if arg_3 is not None and arg_4 is not None:\n        arg_1 = (arg_3 + arg_4) / 4\n        arg_2 = arg_1 - arg_3 / 2\n        # Ref: inner_diameter = 2 * (major_radius - minor_radius)\n        # Ref: outer_diameter = 2 * (major_radius + minor_radius)\n    arg_8 = ''.join([\n        '  <filter name=\"Torus\">\\n',\n        '    <Param name=\"hRadius\" ',\n        'value=\"%s\" ' % arg_1,\n        'description=\"Horizontal Radius\" ',\n        'type=\"RichFloat\" ',\n        '/>\\n',\n        '    <Param name=\"vRadius\" ',\n        'value=\"%s\" ' % arg_2,\n        'description=\"Vertical Radius\" ',\n        'type=\"RichFloat\" ',\n        '/>\\n',\n        '    <Param name=\"hSubdiv\" ',\n        'value=\"%d\" ' % arg_5,\n        'description=\"Horizontal Subdivision\" ',\n        'type=\"RichInt\" ',\n        '/>\\n',\n        '    <Param name=\"vSubdiv\" ',\n        'value=\"%d\" ' % arg_6,\n        'description=\"Vertical Subdivision\" ',\n        'type=\"RichInt\" ',\n        '/>\\n',\n        '  </filter>\\n'])\n    util.write_filter(arg_0, arg_8)\n    if isinstance(arg_0, FilterScript):\n        arg_0.add_layer('Torus', change_layer=True)\n    if arg_7 is not None:\n        vert_color.function(arg_0, arg_7=arg_7)\n    return None", "path": "meshlabxml/create.py", "identifier": "torus", "docstring": "Create a torus mesh\n\n    Args:\n        major_radius (float, (optional)): radius from the origin to the\n            center of the cross sections\n        minor_radius (float, (optional)): radius of the torus cross\n            section\n        inner_diameter (float, (optional)): inner diameter of torus. If\n            both inner_diameter and outer_diameter are provided then\n            these will override major_radius and minor_radius.,\n        outer_diameter (float, (optional)): outer diameter of torus. If\n            both inner_diameter and outer_diameter are provided then\n            these will override major_radius and minor_radius.\n        major_segments (int (optional)): number of segments for the main\n            ring of the torus\n        minor_segments (int (optional)): number of segments for the minor\n            ring of the torus\n        color (str (optional)): color name to apply vertex colors to the\n            newly created mesh\n\n    Returns:\n        None", "docstring_tokens": ["Create", "a", "torus", "mesh"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 258577}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L459-L474", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return the metadata for the specified program.", "language": "python", "parameters": "(self, request, pk, program_uuid)", "return_statement": "return Response(serializer.data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_object", "(", ")", "arg_5", "=", "arg_4", ".", "get_program", "(", "arg_3", ")", "if", "not", "arg_5", ":", "raise", "Http404", "arg_6", "=", "arg_0", ".", "get_serializer_context", "(", ")", "arg_6", "[", "'enterprise_customer_catalog'", "]", "=", "arg_4", "arg_7", "=", "serializers", ".", "ProgramDetailSerializer", "(", "arg_5", ",", "arg_6", "=", "arg_6", ")", "return", "Response", "(", "arg_7", ".", "data", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):  # pylint: disable=invalid-name,unused-argument\n        \"\"\"\n        Return the metadata for the specified program.\n\n        The program needs to be included in the specified EnterpriseCustomerCatalog\n        in order for metadata to be returned from this endpoint.\n        \"\"\"\n        arg_4 = arg_0.get_object()\n        arg_5 = arg_4.get_program(arg_3)\n        if not arg_5:\n            raise Http404\n\n        arg_6 = arg_0.get_serializer_context()\n        arg_6['enterprise_customer_catalog'] = arg_4\n        arg_7 = serializers.ProgramDetailSerializer(arg_5, arg_6=arg_6)\n        return Response(arg_7.data)", "path": "enterprise/api/v1/views.py", "identifier": "EnterpriseCustomerCatalogViewSet.program_detail", "docstring": "Return the metadata for the specified program.\n\n        The program needs to be included in the specified EnterpriseCustomerCatalog\n        in order for metadata to be returned from this endpoint.", "docstring_tokens": ["Return", "the", "metadata", "for", "the", "specified", "program", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258578}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/cover.py#L153-L186", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Output code coverage report.", "language": "python", "parameters": "(self, stream)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "debug", "(", "\"Coverage Func\"", ")", "arg_0", ".", "coverInstance", ".", "stop", "(", ")", "arg_0", ".", "coverInstance", ".", "combine", "(", ")", "arg_0", ".", "coverInstance", ".", "save", "(", ")", "arg_2", "=", "[", "module", "for", "name", ",", "module", "in", "sys", ".", "modules", ".", "items", "(", ")", "if", "arg_0", ".", "wantModuleCoverage", "(", "name", ",", "module", ")", "]", "log", ".", "debug", "(", "\"Coverage Func will cover modules: %s\"", ",", "arg_2", ")", "arg_0", ".", "coverInstance", ".", "Func", "(", "arg_2", ",", "file", "=", "arg_1", ")", "if", "arg_0", ".", "coverHtmlDir", ":", "log", ".", "debug", "(", "\"Generating HTML coverage Func\"", ")", "arg_0", ".", "coverInstance", ".", "html_Func", "(", "arg_2", ",", "arg_0", ".", "coverHtmlDir", ")", "if", "arg_0", ".", "coverXmlFile", ":", "log", ".", "debug", "(", "\"Generating XML coverage Func\"", ")", "arg_0", ".", "coverInstance", ".", "xml_Func", "(", "arg_2", ",", "arg_0", ".", "coverXmlFile", ")", "if", "arg_0", ".", "coverMinPercentage", ":", "arg_3", "=", "StringIO", ".", "StringIO", "(", ")", "arg_0", ".", "coverInstance", ".", "Func", "(", "arg_2", ",", "file", "=", "arg_3", ")", "arg_4", "=", "re", ".", "search", "(", "r'-------\\s\\w+\\s+\\d+\\s+\\d+\\s+(\\d+)%\\s+\\d*\\s{0,1}$'", ",", "arg_3", ".", "getvalue", "(", ")", ")", "if", "arg_4", ":", "arg_5", "=", "int", "(", "arg_4", ".", "groups", "(", ")", "[", "0", "]", ")", "if", "arg_5", "<", "arg_0", ".", "coverMinPercentage", ":", "log", ".", "error", "(", "'TOTAL Coverage did not reach minimum '", "'required: %d%%'", "%", "arg_0", ".", "coverMinPercentage", ")", "sys", ".", "exit", "(", "1", ")", "else", ":", "log", ".", "error", "(", "\"No total percentage was found in coverage output, \"", "\"something went wrong.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Output code coverage Func.\n        \"\"\"\n        log.debug(\"Coverage Func\")\n        arg_0.coverInstance.stop()\n        arg_0.coverInstance.combine()\n        arg_0.coverInstance.save()\n        arg_2 = [module\n                    for name, module in sys.modules.items()\n                    if arg_0.wantModuleCoverage(name, module)]\n        log.debug(\"Coverage Func will cover modules: %s\", arg_2)\n        arg_0.coverInstance.Func(arg_2, file=arg_1)\n        if arg_0.coverHtmlDir:\n            log.debug(\"Generating HTML coverage Func\")\n            arg_0.coverInstance.html_Func(arg_2, arg_0.coverHtmlDir)\n        if arg_0.coverXmlFile:\n            log.debug(\"Generating XML coverage Func\")\n            arg_0.coverInstance.xml_Func(arg_2, arg_0.coverXmlFile)\n\n        # make sure we have minimum required coverage\n        if arg_0.coverMinPercentage:\n            arg_3 = StringIO.StringIO()\n            arg_0.coverInstance.Func(arg_2, file=arg_3)\n            arg_4 = re.search(r'-------\\s\\w+\\s+\\d+\\s+\\d+\\s+(\\d+)%\\s+\\d*\\s{0,1}$', arg_3.getvalue())\n            if arg_4:\n                arg_5 = int(arg_4.groups()[0])\n                if arg_5 < arg_0.coverMinPercentage:\n                    log.error('TOTAL Coverage did not reach minimum '\n                              'required: %d%%' % arg_0.coverMinPercentage)\n                    sys.exit(1)\n            else:\n                log.error(\"No total percentage was found in coverage output, \"\n                          \"something went wrong.\")", "path": "environment/lib/python2.7/site-packages/nose/plugins/cover.py", "identifier": "Coverage.report", "docstring": "Output code coverage report.", "docstring_tokens": ["Output", "code", "coverage", "report", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258579}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/cluster/k_means_.py#L74-L98", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Compute k-means clustering.", "language": "python", "parameters": "(self, Z)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", ":", ",", "'X'", "]", "if", "isinstance", "(", "arg_1", ",", "DictRDD", ")", "else", "arg_1", "check_rdd", "(", "arg_2", ",", "(", "np", ".", "ndarray", ",", "sp", ".", "spmatrix", ")", ")", "if", "arg_0", ".", "init", "==", "'k-means||'", ":", "arg_0", ".", "_mllib_model", "=", "MLlibKMeans", ".", "train", "(", "arg_2", ".", "unblock", "(", ")", ",", "arg_0", ".", "n_clusters", ",", "maxIterations", "=", "arg_0", ".", "max_iter", ",", "initializationMode", "=", "\"k-means||\"", ")", "arg_0", ".", "cluster_centers_", "=", "arg_0", ".", "_mllib_model", ".", "centers", "else", ":", "arg_5", "=", "arg_2", ".", "map", "(", "lambda", "arg_2", ":", "super", "(", "SparkKMeans", ",", "arg_0", ")", ".", "Func", "(", "arg_2", ")", ")", "arg_5", "=", "arg_5", ".", "map", "(", "lambda", "model", ":", "model", ".", "cluster_centers_", ")", ".", "collect", "(", ")", "return", "super", "(", "SparkKMeans", ",", "arg_0", ")", ".", "Func", "(", "np", ".", "concatenate", "(", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Compute k-means clustering.\n\n        Parameters\n        ----------\n        Z : ArrayRDD or DictRDD containing array-like or sparse matrix\n            Train data.\n\n        Returns\n        -------\n        self\n        \"\"\"\n        arg_2 = arg_1[:, 'X'] if isinstance(arg_1, DictRDD) else arg_1\n        check_rdd(arg_2, (np.ndarray, sp.spmatrix))\n        if arg_0.init == 'k-means||':\n            arg_0._mllib_model = MLlibKMeans.train(\n                arg_2.unblock(),\n                arg_0.n_clusters,\n                maxIterations=arg_0.max_iter,\n                initializationMode=\"k-means||\")\n            arg_0.cluster_centers_ = arg_0._mllib_model.centers\n        else:\n            arg_5 = arg_2.map(lambda arg_2: super(SparkKMeans, arg_0).Func(arg_2))\n            arg_5 = arg_5.map(lambda model: model.cluster_centers_).collect()\n            return super(SparkKMeans, arg_0).Func(np.concatenate(arg_5))", "path": "splearn/cluster/k_means_.py", "identifier": "SparkKMeans.fit", "docstring": "Compute k-means clustering.\n\n        Parameters\n        ----------\n        Z : ArrayRDD or DictRDD containing array-like or sparse matrix\n            Train data.\n\n        Returns\n        -------\n        self", "docstring_tokens": ["Compute", "k", "-", "means", "clustering", "."], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 258580}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/scene/node.py#L56-L67", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Recursive calculation of scene bbox", "language": "python", "parameters": "(self, view_matrix, bbox_min, bbox_max)", "return_statement": "return bbox_min, bbox_max", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ".", "matrix", "is", "not", "None", ":", "arg_1", "=", "matrix44", ".", "multiply", "(", "arg_0", ".", "matrix", ",", "arg_1", ")", "if", "arg_0", ".", "mesh", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "mesh", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "for", "arg_4", "in", "arg_0", ".", "children", ":", "arg_2", ",", "arg_3", "=", "arg_4", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Recursive calculation of scene bbox\"\"\"\n        if arg_0.matrix is not None:\n            arg_1 = matrix44.multiply(arg_0.matrix, arg_1)\n\n        if arg_0.mesh:\n            arg_2, arg_3 = arg_0.mesh.Func(arg_1, arg_2, arg_3)\n\n        for arg_4 in arg_0.children:\n            arg_2, arg_3 = arg_4.Func(arg_1, arg_2, arg_3)\n\n        return arg_2, arg_3", "path": "demosys/scene/node.py", "identifier": "Node.calc_global_bbox", "docstring": "Recursive calculation of scene bbox", "docstring_tokens": ["Recursive", "calculation", "of", "scene", "bbox"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 258581}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/iaca.py#L220-L230", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return best block selected based on simple heuristic.", "language": "python", "parameters": "(blocks)", "return_statement": "return best_block[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "raise", "ValueError", "(", "\"No suitable blocks were found in assembly.\"", ")", "arg_1", "=", "max", "(", "arg_0", ",", "key", "=", "lambda", "b", ":", "b", "[", "1", "]", "[", "'packed_instr'", "]", ")", "if", "arg_1", "[", "1", "]", "[", "'packed_instr'", "]", "==", "0", ":", "arg_1", "=", "max", "(", "arg_0", ",", "key", "=", "lambda", "b", ":", "(", "b", "[", "1", "]", "[", "'ops'", "]", "+", "b", "[", "1", "]", "[", "'packed_instr'", "]", "+", "b", "[", "1", "]", "[", "'avx_instr'", "]", ",", "b", "[", "1", "]", "[", "'ZMM'", "]", ",", "b", "[", "1", "]", "[", "'YMM'", "]", ",", "b", "[", "1", "]", "[", "'XMM'", "]", ")", ")", "return", "arg_1", "[", "0", "]"], "function": "def Func(arg_0):\n    \"\"\"Return best block selected based on simple heuristic.\"\"\"\n    # TODO make this cleverer with more stats\n    if not arg_0:\n        raise ValueError(\"No suitable blocks were found in assembly.\")\n    arg_1 = max(arg_0, key=lambda b: b[1]['packed_instr'])\n    if arg_1[1]['packed_instr'] == 0:\n        arg_1 = max(arg_0,\n                         key=lambda b: (b[1]['ops'] + b[1]['packed_instr'] + b[1]['avx_instr'],\n                                        b[1]['ZMM'], b[1]['YMM'], b[1]['XMM']))\n    return arg_1[0]", "path": "kerncraft/iaca.py", "identifier": "select_best_block", "docstring": "Return best block selected based on simple heuristic.", "docstring_tokens": ["Return", "best", "block", "selected", "based", "on", "simple", "heuristic", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 258582}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/custom_region/identity_region.py#L51-L86", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the Spec for IdentityRegion.", "language": "python", "parameters": "(cls)", "return_statement": "return spec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"description\"", ":", "IdentityRegion", ".", "__doc__", ",", "\"singleNodeOnly\"", ":", "True", ",", "\"inputs\"", ":", "{", "\"in\"", ":", "{", "\"description\"", ":", "\"The input vector.\"", ",", "\"dataType\"", ":", "\"Real32\"", ",", "\"count\"", ":", "0", ",", "\"required\"", ":", "True", ",", "\"regionLevel\"", ":", "False", ",", "\"isDefaultInput\"", ":", "True", ",", "\"requireSplitterMap\"", ":", "False", "}", ",", "}", ",", "\"outputs\"", ":", "{", "\"out\"", ":", "{", "\"description\"", ":", "\"A copy of the input vector.\"", ",", "\"dataType\"", ":", "\"Real32\"", ",", "\"count\"", ":", "0", ",", "\"regionLevel\"", ":", "True", ",", "\"isDefaultOutput\"", ":", "True", "}", ",", "}", ",", "\"parameters\"", ":", "{", "\"dataWidth\"", ":", "{", "\"description\"", ":", "\"Size of inputs\"", ",", "\"accessMode\"", ":", "\"Read\"", ",", "\"dataType\"", ":", "\"UInt32\"", ",", "\"count\"", ":", "1", ",", "\"constraints\"", ":", "\"\"", "}", ",", "}", ",", "}", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return the Spec for IdentityRegion.\n    \"\"\"\n    arg_1 = {\n        \"description\":IdentityRegion.__doc__,\n        \"singleNodeOnly\":True,\n        \"inputs\":{\n          \"in\":{\n            \"description\":\"The input vector.\",\n            \"dataType\":\"Real32\",\n            \"count\":0,\n            \"required\":True,\n            \"regionLevel\":False,\n            \"isDefaultInput\":True,\n            \"requireSplitterMap\":False},\n        },\n        \"outputs\":{\n          \"out\":{\n            \"description\":\"A copy of the input vector.\",\n            \"dataType\":\"Real32\",\n            \"count\":0,\n            \"regionLevel\":True,\n            \"isDefaultOutput\":True},\n        },\n\n        \"parameters\":{\n          \"dataWidth\":{\n            \"description\":\"Size of inputs\",\n            \"accessMode\":\"Read\",\n            \"dataType\":\"UInt32\",\n            \"count\":1,\n            \"constraints\":\"\"},\n        },\n    }\n\n    return arg_1", "path": "examples/network/custom_region/identity_region.py", "identifier": "IdentityRegion.getSpec", "docstring": "Return the Spec for IdentityRegion.", "docstring_tokens": ["Return", "the", "Spec", "for", "IdentityRegion", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258583}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/datadog_hook.py#L62-L86", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Sends a single datapoint metric to DataDog", "language": "python", "parameters": "(self, metric_name, datapoint, tags=None, type_=None, interval=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "api", ".", "Metric", ".", "send", "(", "metric", "=", "arg_1", ",", "points", "=", "arg_2", ",", "host", "=", "arg_0", ".", "host", ",", "arg_3", "=", "arg_3", ",", "type", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_0", ".", "validate_response", "(", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"\n        Sends a single datapoint metric to DataDog\n\n        :param metric_name: The name of the metric\n        :type metric_name: str\n        :param datapoint: A single integer or float related to the metric\n        :type datapoint: int or float\n        :param tags: A list of tags associated with the metric\n        :type tags: list\n        :param type_: Type of your metric: gauge, rate, or count\n        :type type_: str\n        :param interval: If the type of the metric is rate or count, define the corresponding interval\n        :type interval: int\n        \"\"\"\n        arg_6 = api.Metric.send(\n            metric=arg_1,\n            points=arg_2,\n            host=arg_0.host,\n            arg_3=arg_3,\n            type=arg_4,\n            arg_5=arg_5)\n\n        arg_0.validate_response(arg_6)\n        return arg_6", "path": "airflow/contrib/hooks/datadog_hook.py", "identifier": "DatadogHook.send_metric", "docstring": "Sends a single datapoint metric to DataDog\n\n        :param metric_name: The name of the metric\n        :type metric_name: str\n        :param datapoint: A single integer or float related to the metric\n        :type datapoint: int or float\n        :param tags: A list of tags associated with the metric\n        :type tags: list\n        :param type_: Type of your metric: gauge, rate, or count\n        :type type_: str\n        :param interval: If the type of the metric is rate or count, define the corresponding interval\n        :type interval: int", "docstring_tokens": ["Sends", "a", "single", "datapoint", "metric", "to", "DataDog"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258584}
{"url": "https://github.com/laplacesdemon/django-youtube/blob/8051ef372473eccb053f773c68e2e5e1b2cfb538/django_youtube/views.py#L295-L316", "sha": "8051ef372473eccb053f773c68e2e5e1b2cfb538", "docstring_summary": "Removes the video from youtube and from db\n    Requires POST", "language": "python", "parameters": "(request, video_id)", "return_statement": "return HttpResponseRedirect(next_url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "settings", ".", "YOUTUBE_DELETE_REDIRECT_URL", "except", "AttributeError", ":", "arg_2", "=", "reverse", "(", "\"django_youtube.views.upload\"", ")", "try", ":", "Video", ".", "objects", ".", "get", "(", "arg_1", "=", "arg_1", ")", ".", "delete", "(", ")", "except", ":", "from", "django", ".", "contrib", "import", "messages", "messages", ".", "add_message", "(", "arg_0", ",", "messages", ".", "ERROR", ",", "_", "(", "'Video could not be deleted.'", ")", ")", "return", "HttpResponseRedirect", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Removes the video from youtube and from db\n    Requires POST\n    \"\"\"\n\n    # prepare redirection url\n    try:\n        arg_2 = settings.YOUTUBE_DELETE_REDIRECT_URL\n    except AttributeError:\n        arg_2 = reverse(\"django_youtube.views.upload\")\n\n    # Remove from db\n    try:\n        Video.objects.get(arg_1=arg_1).delete()\n    except:\n        from django.contrib import messages\n        messages.add_message(\n            arg_0, messages.ERROR, _('Video could not be deleted.'))\n\n    # Return to upload page or specified page\n    return HttpResponseRedirect(arg_2)", "path": "django_youtube/views.py", "identifier": "remove", "docstring": "Removes the video from youtube and from db\n    Requires POST", "docstring_tokens": ["Removes", "the", "video", "from", "youtube", "and", "from", "db", "Requires", "POST"], "nwo": "laplacesdemon/django-youtube", "score": 0.19379564659824008, "idx": 258585}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/kernels/transform.py#L423-L442", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Transforms X according to the linear transformation corresponding to\n        flipping the input eigenvalues.", "language": "python", "parameters": "(self, X)", "return_statement": "return np.dot(X, self.flip_)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "flip_", ".", "shape", "[", "0", "]", "if", "arg_1", ".", "ndim", "!=", "2", "or", "arg_1", ".", "shape", "[", "1", "]", "!=", "arg_2", ":", "arg_3", "=", "\"X should have {} columns, the number of samples at fit time\"", "raise", "TypeError", "(", "arg_3", ".", "format", "(", "arg_0", ".", "flip_", ".", "shape", "[", "0", "]", ")", ")", "return", "np", ".", "dot", "(", "arg_1", ",", "arg_0", ".", "flip_", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Transforms X according to the linear Funcation corresponding to\n        flipping the input eigenvalues.\n\n        Parameters\n        ----------\n        X : array, shape [n_test, n]\n            The test similarities to training points.\n\n        Returns\n        -------\n        Xt : array, shape [n_test, n]\n            The Funced test similarites to training points.\n        '''\n        arg_2 = arg_0.flip_.shape[0]\n        if arg_1.ndim != 2 or arg_1.shape[1] != arg_2:\n            arg_3 = \"X should have {} columns, the number of samples at fit time\"\n            raise TypeError(arg_3.format(arg_0.flip_.shape[0]))\n        return np.dot(arg_1, arg_0.flip_)", "path": "skl_groups/kernels/transform.py", "identifier": "FlipPSD.transform", "docstring": "Transforms X according to the linear transformation corresponding to\n        flipping the input eigenvalues.\n\n        Parameters\n        ----------\n        X : array, shape [n_test, n]\n            The test similarities to training points.\n\n        Returns\n        -------\n        Xt : array, shape [n_test, n]\n            The transformed test similarites to training points.", "docstring_tokens": ["Transforms", "X", "according", "to", "the", "linear", "transformation", "corresponding", "to", "flipping", "the", "input", "eigenvalues", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 258586}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/chunk.py#L415-L432", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Apply a generic array -> object to each subarray", "language": "python", "parameters": "(self, func)", "return_statement": "return BoltArraySpark(rdd, shape=newshape, split=newsplit, ordered=self._ordered, dtype=\"object\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "process_record", "(", "arg_2", ")", ":", "arg_3", "=", "empty", "(", "1", ",", "dtype", "=", "\"object\"", ")", "arg_3", "[", "0", "]", "=", "arg_1", "(", "arg_2", ")", "return", "arg_3", "arg_4", "=", "arg_0", ".", "_rdd", ".", "mapValues", "(", "process_record", ")", "arg_5", "=", "arg_0", ".", "getnumber", "(", "arg_0", ".", "plan", ",", "arg_0", ".", "vshape", ")", "arg_6", "=", "tuple", "(", "[", "int", "(", "s", ")", "for", "s", "in", "r_", "[", "arg_0", ".", "kshape", ",", "arg_5", "]", "]", ")", "arg_7", "=", "len", "(", "arg_0", ".", "shape", ")", "return", "BoltArraySpark", "(", "arg_4", ",", "shape", "=", "arg_6", ",", "split", "=", "arg_7", ",", "ordered", "=", "arg_0", ".", "_ordered", ",", "dtype", "=", "\"object\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Apply a generic array -> object to each subarray\n\n        The resulting object is a BoltArraySpark of dtype object where the\n        blocked dimensions are replaced with indices indication block ID.\n        \"\"\"\n        def process_record(arg_2):\n            arg_3 = empty(1, dtype=\"object\")\n            arg_3[0]  = arg_1(arg_2)\n            return arg_3\n\n        arg_4 = arg_0._rdd.mapValues(process_record)\n\n        arg_5 = arg_0.getnumber(arg_0.plan, arg_0.vshape)\n        arg_6 = tuple([int(s) for s in r_[arg_0.kshape, arg_5]])\n        arg_7 = len(arg_0.shape)\n        return BoltArraySpark(arg_4, shape=arg_6, split=arg_7, ordered=arg_0._ordered, dtype=\"object\")", "path": "bolt/spark/chunk.py", "identifier": "ChunkedArray.map_generic", "docstring": "Apply a generic array -> object to each subarray\n\n        The resulting object is a BoltArraySpark of dtype object where the\n        blocked dimensions are replaced with indices indication block ID.", "docstring_tokens": ["Apply", "a", "generic", "array", "-", ">", "object", "to", "each", "subarray"], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 258587}
{"url": "https://github.com/crytic/pyevmasm/blob/d27daf19a36d630a31499e783b716cf1165798d8/pyevmasm/evmasm.py#L151-L165", "sha": "d27daf19a36d630a31499e783b716cf1165798d8", "docstring_summary": "Parses an operand from buf", "language": "python", "parameters": "(self, buf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "iter", "(", "arg_1", ")", "try", ":", "arg_2", "=", "0", "for", "arg_3", "in", "range", "(", "arg_0", ".", "operand_size", ")", ":", "arg_2", "<<=", "8", "arg_2", "|=", "next", "(", "arg_1", ")", "arg_0", ".", "_operand", "=", "arg_2", "except", "StopIteration", ":", "raise", "ParseError", "(", "\"Not enough data for decoding\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Parses an operand from buf\n\n            :param buf: a buffer\n            :type buf: iterator/generator/string\n        \"\"\"\n        arg_1 = iter(arg_1)\n        try:\n            arg_2 = 0\n            for arg_3 in range(arg_0.operand_size):\n                arg_2 <<= 8\n                arg_2 |= next(arg_1)\n            arg_0._operand = arg_2\n        except StopIteration:\n            raise ParseError(\"Not enough data for decoding\")", "path": "pyevmasm/evmasm.py", "identifier": "Instruction.parse_operand", "docstring": "Parses an operand from buf\n\n            :param buf: a buffer\n            :type buf: iterator/generator/string", "docstring_tokens": ["Parses", "an", "operand", "from", "buf"], "nwo": "crytic/pyevmasm", "score": 0.6213837792976742, "idx": 258588}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L561-L615", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "diff - Compare the field values on two IndexedRedisModels.", "language": "python", "parameters": "(firstObj, otherObj, includeMeta=False)", "return_statement": "return diffFields", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "isIndexedRedisModel", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "'Type < %s > does not extend IndexedRedisModel.'", "%", "(", "type", "(", "arg_0", ")", ".", "__name__", ",", ")", ")", "if", "not", "isIndexedRedisModel", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "'Type < %s > does not extend IndexedRedisModel.'", "%", "(", "type", "(", "arg_1", ")", ".", "__name__", ",", ")", ")", "arg_0", ".", "validateModel", "(", ")", "arg_1", ".", "validateModel", "(", ")", "if", "getattr", "(", "arg_0", ",", "'FIELDS'", ")", "!=", "getattr", "(", "arg_1", ",", "'FIELDS'", ")", ":", "raise", "ValueError", "(", "'Cannot compare  < %s > and < %s > . Must be same model OR have equal FIELDS.'", "%", "(", "arg_0", ".", "__class__", ",", "arg_1", ".", "__class__", ")", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_0", ".", "FIELDS", ":", "arg_5", "=", "str", "(", "arg_4", ")", "arg_6", "=", "object", ".", "__getattribute__", "(", "arg_0", ",", "arg_5", ")", "arg_7", "=", "object", ".", "__getattribute__", "(", "arg_1", ",", "arg_5", ")", "if", "arg_6", "!=", "arg_7", ":", "arg_3", "[", "arg_5", "]", "=", "(", "(", "arg_6", ",", "arg_7", ")", ")", "if", "arg_2", ":", "arg_8", "=", "arg_0", ".", "getPk", "(", ")", "arg_9", "=", "arg_1", ".", "getPk", "(", ")", "if", "arg_8", "!=", "arg_9", ":", "arg_3", "[", "'_id'", "]", "=", "(", "arg_8", ",", "arg_9", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=False):\n\t\t'''\n\t\t\tFunc - Compare the field values on two IndexedRedisModels.\n\n\t\t\t@param firstObj <IndexedRedisModel instance> - First object (or self)\n\n\t\t\t@param otherObj <IndexedRedisModel instance> - Second object\n\n\t\t\t@param includeMeta <bool> - If meta information (like pk) should be in the Func results.\n\n\n\t\t\t@return <dict> - Dict of  'field' : ( value_firstObjForField, value_otherObjForField ).\n\t\t\t\t\n\t\t\t\tKeys are names of fields with Funcerent values.\n\t\t\t\tValue is a tuple of ( value_firstObjForField, value_otherObjForField )\n\n\t\t\tCan be called statically, like: IndexedRedisModel.Func ( obj1, obj2 )\n\n\t\t\t  or in reference to an obj   : obj1.Func(obj2)\n\t\t'''\n\n\t\tif not isIndexedRedisModel(arg_0):\t\n\t\t\traise ValueError('Type < %s > does not extend IndexedRedisModel.' %( type(arg_0).__name__ , ) )\n\t\tif not isIndexedRedisModel(arg_1):\t\n\t\t\traise ValueError('Type < %s > does not extend IndexedRedisModel.' %( type(arg_1).__name__ , ) )\n\n\t\targ_0.validateModel()\n\t\targ_1.validateModel()\n\n\t\t# Types may not match, but could be subclass, special copy class (like connectAlt), etc.\n\t\t#   So check if FIELDS matches, and if so, we can continue.\n\t\tif getattr(arg_0, 'FIELDS') != getattr(arg_1, 'FIELDS'):\n\t\t\t# NOTE: Maybe we should iterate here and compare just that field types and names match?\n\t\t\t#   In case a copy changes a default or something, we would still be able to Func..\n\t\t\traise ValueError('Cannot compare  < %s > and < %s > . Must be same model OR have equal FIELDS.' %( arg_0.__class__, arg_1.__class__) )\n\t\t\n\t\targ_3 = {}\n\n\t\tfor arg_4 in arg_0.FIELDS:\n\n\t\t\targ_5 = str(arg_4)\n\n\t\t\targ_6 = object.__getattribute__( arg_0, arg_5 )\n\t\t\targ_7 = object.__getattribute__( arg_1, arg_5 )\n\n\t\t\tif arg_6 != arg_7:\n\t\t\t\targ_3[ arg_5 ] = ( (arg_6, arg_7) )\n\n\t\tif arg_2:\n\t\t\targ_8 = arg_0.getPk()\n\t\t\targ_9 = arg_1.getPk()\n\t\t\tif arg_8 != arg_9:\n\t\t\t\targ_3['_id'] = ( arg_8, arg_9 )\n\n\t\treturn arg_3", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisModel.diff", "docstring": "diff - Compare the field values on two IndexedRedisModels.\n\n\t\t\t@param firstObj <IndexedRedisModel instance> - First object (or self)\n\n\t\t\t@param otherObj <IndexedRedisModel instance> - Second object\n\n\t\t\t@param includeMeta <bool> - If meta information (like pk) should be in the diff results.\n\n\n\t\t\t@return <dict> - Dict of  'field' : ( value_firstObjForField, value_otherObjForField ).\n\t\t\t\t\n\t\t\t\tKeys are names of fields with different values.\n\t\t\t\tValue is a tuple of ( value_firstObjForField, value_otherObjForField )\n\n\t\t\tCan be called statically, like: IndexedRedisModel.diff ( obj1, obj2 )\n\n\t\t\t  or in reference to an obj   : obj1.diff(obj2)", "docstring_tokens": ["diff", "-", "Compare", "the", "field", "values", "on", "two", "IndexedRedisModels", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 258589}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L218-L242", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "Download a file from device to local filesystem", "language": "python", "parameters": "(self, filename)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "__exchange", "(", "'send(\"{filename}\")'", ".", "format", "(", "arg_1", "=", "arg_1", ")", ")", "if", "(", "'unexpected'", "in", "arg_2", ")", "or", "(", "'stdin'", "in", "arg_2", ")", ":", "log", ".", "error", "(", "'Unexpected error downloading file: %s'", ",", "arg_2", ")", "raise", "Exception", "(", "'Unexpected error downloading file'", ")", "arg_0", ".", "__write", "(", "'C'", ")", "arg_3", "=", "arg_0", ".", "__expect", "(", "NUL", ")", ".", "strip", "(", ")", "log", ".", "info", "(", "'receiveing '", "+", "arg_3", ")", "arg_0", ".", "__write", "(", "ACK", ",", "True", ")", "arg_4", "=", "''", "arg_5", "=", "''", "arg_6", ",", "arg_4", "=", "arg_0", ".", "__read_chunk", "(", "arg_4", ")", "while", "arg_6", "!=", "''", ":", "arg_0", ".", "__write", "(", "ACK", ",", "True", ")", "arg_5", "=", "arg_5", "+", "arg_6", "arg_6", ",", "arg_4", "=", "arg_0", ".", "__read_chunk", "(", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Download a file from device to local filesystem\"\"\"\n        arg_2 = arg_0.__exchange('send(\"{filename}\")'.format(arg_1=arg_1))\n        if ('unexpected' in arg_2) or ('stdin' in arg_2):\n            log.error('Unexpected error downloading file: %s', arg_2)\n            raise Exception('Unexpected error downloading file')\n\n        #tell device we are ready to receive\n        arg_0.__write('C')\n        #we should get a NUL terminated filename to start with\n        arg_3 = arg_0.__expect(NUL).strip()\n        log.info('receiveing ' + arg_3)\n\n        #ACK to start download\n        arg_0.__write(ACK, True)\n        arg_4 = ''\n\n        arg_5 = ''\n        arg_6, arg_4 = arg_0.__read_chunk(arg_4)\n        #read chunks until we get an empty which is the end\n        while arg_6 != '':\n            arg_0.__write(ACK, True)\n            arg_5 = arg_5 + arg_6\n            arg_6, arg_4 = arg_0.__read_chunk(arg_4)\n        return arg_5", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.download_file", "docstring": "Download a file from device to local filesystem", "docstring_tokens": ["Download", "a", "file", "from", "device", "to", "local", "filesystem"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 258590}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L437-L456", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Download outputs for job.", "language": "python", "parameters": "(ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "get_job_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'job'", ")", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "job", ".", "download_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not download Func for job `{}`.'", ".", "format", "(", "arg_3", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "'Files downloaded.'", ")"], "function": "def Func(arg_0):\n    \"\"\"Download Func for job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon job -j 1 Func\n    ```\n    \"\"\"\n    arg_1, arg_2, arg_3 = get_job_or_local(arg_0.obj.get('project'), arg_0.obj.get('job'))\n    try:\n        PolyaxonClient().job.download_Func(arg_1, arg_2, arg_3)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not download Func for job `{}`.'.format(arg_3))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n    Printer.print_success('Files downloaded.')", "path": "polyaxon_cli/cli/job.py", "identifier": "outputs", "docstring": "Download outputs for job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon job -j 1 outputs\n    ```", "docstring_tokens": ["Download", "outputs", "for", "job", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 258591}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3969-L4003", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Return a sorted DataFrame, sorted by the expression 'by'", "language": "python", "parameters": "(self, by, ascending=True, kind='quicksort')", "return_statement": "return self.take(indices)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "'quickFunc'", ")", ":", "arg_0", "=", "arg_0", ".", "trim", "(", ")", "arg_4", "=", "arg_0", ".", "evaluate", "(", "arg_1", ",", "filtered", "=", "False", ")", "arg_5", "=", "np", ".", "argFunc", "(", "arg_4", ",", "arg_3", "=", "arg_3", ")", "if", "not", "arg_2", ":", "arg_5", "=", "arg_5", "[", ":", ":", "-", "1", "]", ".", "copy", "(", ")", "return", "arg_0", ".", "take", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3='quickFunc'):\n        '''Return a Funced DataFrame, Funced by the expression 'by'\n\n        {note_copy}\n\n        {note_filter}\n\n        Example:\n\n        >>> import vaex, numpy as np\n        >>> df = vaex.from_arrays(s=np.array(['a', 'b', 'c', 'd']), x=np.arange(1,5))\n        >>> df['y'] = (df.x-1.8)**2\n        >>> df\n          #  s      x     y\n          0  a      1  0.64\n          1  b      2  0.04\n          2  c      3  1.44\n          3  d      4  4.84\n        >>> df.Func('y', ascending=False)  # Note: passing '(x-1.8)**2' gives the same result\n          #  s      x     y\n          0  d      4  4.84\n          1  c      3  1.44\n          2  a      1  0.64\n          3  b      2  0.04\n\n        :param str or expression by: expression to Func by\n        :param bool ascending: ascending (default, True) or descending (False)\n        :param str kind: kind of algorithm to use (passed to numpy.argFunc)\n        '''\n        arg_0 = arg_0.trim()\n        arg_4 = arg_0.evaluate(arg_1, filtered=False)\n        arg_5 = np.argFunc(arg_4, arg_3=arg_3)\n        if not arg_2:\n            arg_5 = arg_5[::-1].copy()  # this may be used a lot, so copy for performance\n        return arg_0.take(arg_5)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.sort", "docstring": "Return a sorted DataFrame, sorted by the expression 'by'\n\n        {note_copy}\n\n        {note_filter}\n\n        Example:\n\n        >>> import vaex, numpy as np\n        >>> df = vaex.from_arrays(s=np.array(['a', 'b', 'c', 'd']), x=np.arange(1,5))\n        >>> df['y'] = (df.x-1.8)**2\n        >>> df\n          #  s      x     y\n          0  a      1  0.64\n          1  b      2  0.04\n          2  c      3  1.44\n          3  d      4  4.84\n        >>> df.sort('y', ascending=False)  # Note: passing '(x-1.8)**2' gives the same result\n          #  s      x     y\n          0  d      4  4.84\n          1  c      3  1.44\n          2  a      1  0.64\n          3  b      2  0.04\n\n        :param str or expression by: expression to sort by\n        :param bool ascending: ascending (default, True) or descending (False)\n        :param str kind: kind of algorithm to use (passed to numpy.argsort)", "docstring_tokens": ["Return", "a", "sorted", "DataFrame", "sorted", "by", "the", "expression", "by"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 258592}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/ext.py#L93-L110", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Load aggregation configurations.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "iter_entry_points", "(", "group", "=", "arg_0", ".", "entry_point_group_aggs", ")", ":", "for", "arg_3", "in", "arg_2", ".", "load", "(", ")", "(", ")", ":", "if", "arg_3", "[", "'aggregation_name'", "]", "not", "in", "arg_0", ".", "enabled_aggregations", ":", "continue", "elif", "arg_3", "[", "'aggregation_name'", "]", "in", "arg_1", ":", "raise", "DuplicateAggregationError", "(", "'Duplicate aggregation {0} in entry point '", "'{1}'", ".", "format", "(", "arg_3", "[", "'event_type'", "]", ",", "arg_2", ".", "name", ")", ")", "arg_3", ".", "update", "(", "arg_0", ".", "enabled_aggregations", "[", "arg_3", "[", "'aggregation_name'", "]", "]", "or", "{", "}", ")", "arg_1", "[", "arg_3", "[", "'aggregation_name'", "]", "]", "=", "arg_3", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Load aggregation configurations.\"\"\"\n        arg_1 = {}\n        for arg_2 in iter_entry_points(\n                group=arg_0.entry_point_group_aggs):\n            for arg_3 in arg_2.load()():\n                if arg_3['aggregation_name'] not in arg_0.enabled_aggregations:\n                    continue\n                elif arg_3['aggregation_name'] in arg_1:\n                    raise DuplicateAggregationError(\n                        'Duplicate aggregation {0} in entry point '\n                        '{1}'.format(arg_3['event_type'], arg_2.name))\n                # Update the default configuration with env/overlay config.\n                arg_3.update(\n                    arg_0.enabled_aggregations[arg_3['aggregation_name']] or {}\n                )\n                arg_1[arg_3['aggregation_name']] = arg_3\n        return arg_1", "path": "invenio_stats/ext.py", "identifier": "_InvenioStatsState._aggregations_config", "docstring": "Load aggregation configurations.", "docstring_tokens": ["Load", "aggregation", "configurations", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 258593}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2087-L2097", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Set the shutdown state of the Connection.", "language": "python", "parameters": "(self, state)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"state must be an integer\"", ")", "_lib", ".", "SSL_Func", "(", "arg_0", ".", "_ssl", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set the shutdown state of the Connection.\n\n        :param state: bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n        :return: None\n        \"\"\"\n        if not isinstance(arg_1, integer_types):\n            raise TypeError(\"state must be an integer\")\n\n        _lib.SSL_Func(arg_0._ssl, arg_1)", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.set_shutdown", "docstring": "Set the shutdown state of the Connection.\n\n        :param state: bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n        :return: None", "docstring_tokens": ["Set", "the", "shutdown", "state", "of", "the", "Connection", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 258594}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/zipkin.py#L683-L711", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Generate the headers for a new zipkin span.", "language": "python", "parameters": "(context_stack=None, tracer=None)", "return_statement": "return {\n        'X-B3-TraceId': zipkin_attrs.trace_id,\n        'X-B3-SpanId': generate_random_64bit_string(),\n        'X-B3-ParentSpanId': zipkin_attrs.span_id,\n        'X-B3-Flags': '0',\n        'X-B3-Sampled': '1' if zipkin_attrs.is_sampled else '0',\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "arg_2", "=", "arg_1", ".", "get_zipkin_attrs", "(", ")", "elif", "arg_0", ":", "arg_2", "=", "arg_0", ".", "get", "(", ")", "else", ":", "arg_2", "=", "get_default_tracer", "(", ")", ".", "get_zipkin_attrs", "(", ")", "if", "not", "arg_2", ":", "return", "{", "}", "return", "{", "'X-B3-TraceId'", ":", "arg_2", ".", "trace_id", ",", "'X-B3-SpanId'", ":", "generate_random_64bit_string", "(", ")", ",", "'X-B3-ParentSpanId'", ":", "arg_2", ".", "span_id", ",", "'X-B3-Flags'", ":", "'0'", ",", "'X-B3-Sampled'", ":", "'1'", "if", "arg_2", ".", "is_sampled", "else", "'0'", ",", "}"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"\n    Generate the headers for a new zipkin span.\n\n    .. note::\n\n        If the method is not called from within a zipkin_trace context,\n        empty dict will be returned back.\n\n    :returns: dict containing (X-B3-TraceId, X-B3-SpanId, X-B3-ParentSpanId,\n                X-B3-Flags and X-B3-Sampled) keys OR an empty dict.\n    \"\"\"\n    if arg_1:\n        arg_2 = arg_1.get_zipkin_attrs()\n    elif arg_0:\n        arg_2 = arg_0.get()\n    else:\n        arg_2 = get_default_tracer().get_zipkin_attrs()\n\n    if not arg_2:\n        return {}\n\n    return {\n        'X-B3-TraceId': arg_2.trace_id,\n        'X-B3-SpanId': generate_random_64bit_string(),\n        'X-B3-ParentSpanId': arg_2.span_id,\n        'X-B3-Flags': '0',\n        'X-B3-Sampled': '1' if arg_2.is_sampled else '0',\n    }", "path": "py_zipkin/zipkin.py", "identifier": "create_http_headers_for_new_span", "docstring": "Generate the headers for a new zipkin span.\n\n    .. note::\n\n        If the method is not called from within a zipkin_trace context,\n        empty dict will be returned back.\n\n    :returns: dict containing (X-B3-TraceId, X-B3-SpanId, X-B3-ParentSpanId,\n                X-B3-Flags and X-B3-Sampled) keys OR an empty dict.", "docstring_tokens": ["Generate", "the", "headers", "for", "a", "new", "zipkin", "span", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 258595}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/classify.py#L291-L306", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Fits X to outcomes y, using clf", "language": "python", "parameters": "(self, X, y, cv=None, class_weight='auto')", "return_statement": "return self.clf", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'auto'", ")", ":", "arg_0", ".", "X", "=", "arg_1", "arg_0", ".", "y", "=", "arg_2", "arg_0", ".", "set_class_weight", "(", "arg_4", "=", "arg_4", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "clf", "=", "arg_0", ".", "clf", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "clf"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4='auto'):\n        \"\"\" Fits X to outcomes y, using clf \"\"\"\n\n        # Incorporate error checking such as :\n        # if isinstance(self.classifier, ScikitClassifier):\n        #     do one thingNone\n        # otherwiseNone.\n\n        arg_0.X = arg_1\n        arg_0.y = arg_2\n\n        arg_0.set_class_weight(arg_4=arg_4, arg_2=arg_2)\n\n        arg_0.clf = arg_0.clf.Func(arg_1, arg_2)\n\n        return arg_0.clf", "path": "neurosynth/analysis/classify.py", "identifier": "Classifier.fit", "docstring": "Fits X to outcomes y, using clf", "docstring_tokens": ["Fits", "X", "to", "outcomes", "y", "using", "clf"], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 258596}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/storage.py#L37-L52", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "SPSS .sav files to Pandas DataFrame through savreader module", "language": "python", "parameters": "(input_file)", "return_statement": "return pd.DataFrame(data=lines, columns=header)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "savReaderWriter", "import", "SavReader", "arg_1", "=", "[", "]", "with", "SavReader", "(", "arg_0", ",", "returnHeader", "=", "True", ")", "as", "reader", ":", "arg_2", "=", "next", "(", "reader", ")", "for", "arg_3", "in", "reader", ":", "arg_1", ".", "append", "(", "arg_3", ")", "return", "pd", ".", "DataFrame", "(", "data", "=", "arg_1", ",", "columns", "=", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    SPSS .sav files to Pandas DataFrame through savreader module\n\n    :param input_file: string\n\n    :return:\n    \"\"\"\n    from savReaderWriter import SavReader\n    arg_1 = []\n    with SavReader(arg_0, returnHeader=True) as reader:\n        arg_2 = next(reader)\n        for arg_3 in reader:\n            arg_1.append(arg_3)\n\n    return pd.DataFrame(data=arg_1, columns=arg_2)", "path": "boyle/storage.py", "identifier": "sav_to_pandas_savreader", "docstring": "SPSS .sav files to Pandas DataFrame through savreader module\n\n    :param input_file: string\n\n    :return:", "docstring_tokens": ["SPSS", ".", "sav", "files", "to", "Pandas", "DataFrame", "through", "savreader", "module"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258597}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1807-L1837", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check for a name using the type's regexp", "language": "python", "parameters": "(self, node_type, name, node, confidence=interfaces.HIGH)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_5", ".", "HIGH", ")", ":", "def", "_should_exempt_from_invalid_name", "(", "arg_3", ")", ":", "if", "arg_1", "==", "\"variable\"", ":", "arg_7", "=", "utils", ".", "safe_infer", "(", "arg_3", ")", "if", "isinstance", "(", "arg_7", ",", "astroid", ".", "ClassDef", ")", ":", "return", "True", "return", "False", "if", "utils", ".", "is_inside_except", "(", "arg_3", ")", ":", "arg_8", ",", "arg_9", "=", "utils", ".", "clobber_in_except", "(", "arg_3", ")", "if", "arg_8", ":", "return", "if", "arg_2", "in", "arg_0", ".", "config", ".", "good_names", ":", "return", "if", "arg_2", "in", "arg_0", ".", "config", ".", "bad_names", ":", "arg_0", ".", "stats", "[", "\"badname_\"", "+", "arg_1", "]", "+=", "1", "arg_0", ".", "add_message", "(", "\"blacklisted-name\"", ",", "arg_3", "=", "arg_3", ",", "args", "=", "arg_2", ")", "return", "arg_10", "=", "arg_0", ".", "_name_regexps", "[", "arg_1", "]", "arg_11", "=", "arg_10", ".", "match", "(", "arg_2", ")", "if", "_is_multi_naming_match", "(", "arg_11", ",", "arg_1", ",", "arg_4", ")", ":", "arg_12", "=", "arg_0", ".", "_find_name_group", "(", "arg_1", ")", "arg_13", "=", "arg_0", ".", "_bad_names", ".", "setdefault", "(", "arg_12", ",", "{", "}", ")", "arg_14", "=", "arg_13", ".", "setdefault", "(", "arg_11", ".", "lastgroup", ",", "[", "]", ")", "arg_14", ".", "append", "(", "(", "arg_3", ",", "arg_1", ",", "arg_2", ",", "arg_4", ")", ")", "if", "arg_11", "is", "None", "and", "not", "_should_exempt_from_invalid_name", "(", "arg_3", ")", ":", "arg_0", ".", "_raise_name_warning", "(", "arg_3", ",", "arg_1", ",", "arg_2", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=arg_5.HIGH):\n        \"\"\"check for a name using the type's regexp\"\"\"\n\n        def _should_exempt_from_invalid_name(arg_3):\n            if arg_1 == \"variable\":\n                arg_7 = utils.safe_infer(arg_3)\n                if isinstance(arg_7, astroid.ClassDef):\n                    return True\n            return False\n\n        if utils.is_inside_except(arg_3):\n            arg_8, arg_9 = utils.clobber_in_except(arg_3)\n            if arg_8:\n                return\n        if arg_2 in arg_0.config.good_names:\n            return\n        if arg_2 in arg_0.config.bad_names:\n            arg_0.stats[\"badname_\" + arg_1] += 1\n            arg_0.add_message(\"blacklisted-name\", arg_3=arg_3, args=arg_2)\n            return\n        arg_10 = arg_0._name_regexps[arg_1]\n        arg_11 = arg_10.match(arg_2)\n\n        if _is_multi_naming_match(arg_11, arg_1, arg_4):\n            arg_12 = arg_0._find_name_group(arg_1)\n            arg_13 = arg_0._bad_names.setdefault(arg_12, {})\n            arg_14 = arg_13.setdefault(arg_11.lastgroup, [])\n            arg_14.append((arg_3, arg_1, arg_2, arg_4))\n\n        if arg_11 is None and not _should_exempt_from_invalid_name(arg_3):\n            arg_0._raise_name_warning(arg_3, arg_1, arg_2, arg_4)", "path": "pylint/checkers/base.py", "identifier": "NameChecker._check_name", "docstring": "check for a name using the type's regexp", "docstring_tokens": ["check", "for", "a", "name", "using", "the", "type", "s", "regexp"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258598}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/cli.py#L148-L164", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Delete old prices, leaving just the last.", "language": "python", "parameters": "(symbol: str, all: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ")", ":", "arg_3", "=", "PriceDbApplication", "(", ")", "arg_3", ".", "logger", "=", "arg_4", "arg_5", "=", "0", "if", "arg_0", "is", "not", "None", ":", "arg_6", "=", "SecuritySymbol", "(", "\"\"", ",", "\"\"", ")", "arg_6", ".", "parse", "(", "arg_0", ")", "arg_7", "=", "arg_3", ".", "Func", "(", "arg_6", ")", "if", "arg_7", ":", "arg_5", "=", "1", "else", ":", "arg_5", "=", "arg_3", ".", "Func_all", "(", ")", "print", "(", "f\"Removed {count} old price entries.\"", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_1):\n    \"\"\" Delete old prices, leaving just the last. \"\"\"\n    arg_3 = PriceDbApplication()\n    arg_3.logger = arg_4\n    arg_5 = 0\n\n    if arg_0 is not None:\n        arg_6 = SecuritySymbol(\"\", \"\")\n        arg_6.parse(arg_0)\n\n        arg_7 = arg_3.Func(arg_6)\n        if arg_7:\n            arg_5 = 1\n    else:\n        arg_5 = arg_3.Func_all()\n\n    print(f\"Removed {count} old price entries.\")", "path": "pricedb/cli.py", "identifier": "prune", "docstring": "Delete old prices, leaving just the last.", "docstring_tokens": ["Delete", "old", "prices", "leaving", "just", "the", "last", "."], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 258599}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/annotation.py#L132-L141", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Read the contents of the Annotation Resource", "language": "python", "parameters": "(self)", "return_statement": "return self.__content__", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "__content__", ":", "arg_0", ".", "__retriever__", "=", "arg_0", ".", "__resolver__", ".", "resolve", "(", "arg_0", ".", "uri", ")", "arg_0", ".", "__content__", ",", "arg_0", ".", "__mimetype__", "=", "arg_0", ".", "__retriever__", ".", "Func", "(", "arg_0", ".", "uri", ")", "return", "arg_0", ".", "__content__"], "function": "def Func(arg_0):\n        \"\"\" Read the contents of the Annotation Resource\n\n        :return: the contents of the resource\n        :rtype: str or bytes or flask.response\n        \"\"\"\n        if not arg_0.__content__:\n            arg_0.__retriever__ = arg_0.__resolver__.resolve(arg_0.uri)\n            arg_0.__content__, arg_0.__mimetype__ = arg_0.__retriever__.Func(arg_0.uri)\n        return arg_0.__content__", "path": "flask_nemo/query/annotation.py", "identifier": "AnnotationResource.read", "docstring": "Read the contents of the Annotation Resource\n\n        :return: the contents of the resource\n        :rtype: str or bytes or flask.response", "docstring_tokens": ["Read", "the", "contents", "of", "the", "Annotation", "Resource"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 258600}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/aio/async_client.py#L323-L368", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get a Sender for the Service Bus endpoint.", "language": "python", "parameters": "(self, message_timeout=0, session=None, **kwargs)", "return_statement": "return Sender(\n            handler_id,\n            self.entity_uri,\n            self.auth_config,\n            session=session,\n            loop=self.loop,\n            debug=self.debug,\n            msg_timeout=message_timeout,\n            **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "if", "arg_0", ".", "entity", "and", "arg_0", ".", "requires_session", ":", "return", "SessionSender", "(", "arg_4", ",", "arg_0", ".", "entity_uri", ",", "arg_0", ".", "auth_config", ",", "arg_2", "=", "arg_2", ",", "loop", "=", "arg_0", ".", "loop", ",", "debug", "=", "arg_0", ".", "debug", ",", "msg_timeout", "=", "arg_1", ",", "**", "arg_3", ")", "return", "Sender", "(", "arg_4", ",", "arg_0", ".", "entity_uri", ",", "arg_0", ".", "auth_config", ",", "arg_2", "=", "arg_2", ",", "loop", "=", "arg_0", ".", "loop", ",", "debug", "=", "arg_0", ".", "debug", ",", "msg_timeout", "=", "arg_1", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=None, **arg_3):\n        \"\"\"Get a Sender for the Service Bus endpoint.\n\n        A Sender represents a single open connection within which multiple send operations can be made.\n\n        :param message_timeout: The period in seconds during which messages sent with\n         this Sender must be sent. If the send is not completed in this time it will fail.\n        :type message_timeout: int\n        :param session: An optional session ID. If supplied this session ID will be\n         applied to every outgoing message sent with this Sender.\n         If an individual message already has a session ID, that will be\n         used instead. If no session ID is supplied here, nor set on an outgoing\n         message, a ValueError will be raised if the entity is sessionful.\n        :type session: str or ~uuid.Guid\n        :returns: A Sender instance with an unopened connection.\n        :rtype: ~azure.servicebus.aio.async_send_handler.Sender\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START open_close_sender_context]\n                :end-before: [END open_close_sender_context]\n                :language: python\n                :dedent: 4\n                :caption: Send multiple messages with a Sender.\n\n        \"\"\"\n        arg_4 = str(uuid.uuid4())\n        if arg_0.entity and arg_0.requires_session:\n            return SessionSender(\n                arg_4,\n                arg_0.entity_uri,\n                arg_0.auth_config,\n                arg_2=arg_2,\n                loop=arg_0.loop,\n                debug=arg_0.debug,\n                msg_timeout=arg_1,\n                **arg_3)\n        return Sender(\n            arg_4,\n            arg_0.entity_uri,\n            arg_0.auth_config,\n            arg_2=arg_2,\n            loop=arg_0.loop,\n            debug=arg_0.debug,\n            msg_timeout=arg_1,\n            **arg_3)", "path": "azure-servicebus/azure/servicebus/aio/async_client.py", "identifier": "SendClientMixin.get_sender", "docstring": "Get a Sender for the Service Bus endpoint.\n\n        A Sender represents a single open connection within which multiple send operations can be made.\n\n        :param message_timeout: The period in seconds during which messages sent with\n         this Sender must be sent. If the send is not completed in this time it will fail.\n        :type message_timeout: int\n        :param session: An optional session ID. If supplied this session ID will be\n         applied to every outgoing message sent with this Sender.\n         If an individual message already has a session ID, that will be\n         used instead. If no session ID is supplied here, nor set on an outgoing\n         message, a ValueError will be raised if the entity is sessionful.\n        :type session: str or ~uuid.Guid\n        :returns: A Sender instance with an unopened connection.\n        :rtype: ~azure.servicebus.aio.async_send_handler.Sender\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START open_close_sender_context]\n                :end-before: [END open_close_sender_context]\n                :language: python\n                :dedent: 4\n                :caption: Send multiple messages with a Sender.", "docstring_tokens": ["Get", "a", "Sender", "for", "the", "Service", "Bus", "endpoint", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258601}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L627-L664", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Starts a network run before the individual run.", "language": "python", "parameters": "(self, traj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "pre_build", "(", "arg_1", ")", "arg_0", ".", "_logger", ".", "info", "(", "'\\n------------------------\\n'", "'Pre-Running the Network\\n'", "'------------------------'", ")", "arg_0", ".", "_network", "=", "arg_0", ".", "_network_constructor", "(", "*", "arg_0", ".", "_brian_list", ")", "arg_0", ".", "network_runner", ".", "execute_network_pre_run", "(", "arg_1", ",", "arg_0", ".", "_network", ",", "arg_0", ".", "_network_dict", ",", "arg_0", ".", "components", ",", "arg_0", ".", "analysers", ")", "arg_0", ".", "_logger", ".", "info", "(", "'\\n-----------------------------\\n'", "'Network Simulation successful\\n'", "'-----------------------------'", ")", "arg_0", ".", "_pre_run", "=", "True", "if", "hasattr", "(", "arg_0", ".", "_network", ",", "'store'", ")", ":", "arg_0", ".", "_network", ".", "store", "(", "'pre_run'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Starts a network run before the individual run.\n\n        Useful if a network needs an initial run that can be shared by all individual\n        experimental runs during parameter exploration.\n\n        Needs to be called by the user. If `Func` is started by the user,\n        :func:`~pypet.brian2.network.NetworkManager.pre_build` will be automatically called\n        from this function.\n\n        This function will create a new BRIAN2 network which is run by\n        the :class:`~pypet.brian2.network.NetworkRunner` and it's\n        :func:`~pypet.brian2.network.NetworkRunner.execute_network_pre_run`.\n\n        To see how a network run is structured also take a look at\n        :func:`~pypet.brian2.network.NetworkRunner.run_network`.\n\n        :param traj: Trajectory container\n\n        \"\"\"\n        arg_0.pre_build(arg_1)\n\n        arg_0._logger.info('\\n------------------------\\n'\n                          'Pre-Running the Network\\n'\n                          '------------------------')\n\n\n        arg_0._network = arg_0._network_constructor(*arg_0._brian_list)\n        arg_0.network_runner.execute_network_pre_run(arg_1, arg_0._network, arg_0._network_dict,\n                                                    arg_0.components, arg_0.analysers)\n\n        arg_0._logger.info('\\n-----------------------------\\n'\n                          'Network Simulation successful\\n'\n                          '-----------------------------')\n\n        arg_0._pre_run = True\n        if hasattr(arg_0._network, 'store'):\n            arg_0._network.store('pre_run')", "path": "pypet/brian2/network.py", "identifier": "NetworkManager.pre_run_network", "docstring": "Starts a network run before the individual run.\n\n        Useful if a network needs an initial run that can be shared by all individual\n        experimental runs during parameter exploration.\n\n        Needs to be called by the user. If `pre_run_network` is started by the user,\n        :func:`~pypet.brian2.network.NetworkManager.pre_build` will be automatically called\n        from this function.\n\n        This function will create a new BRIAN2 network which is run by\n        the :class:`~pypet.brian2.network.NetworkRunner` and it's\n        :func:`~pypet.brian2.network.NetworkRunner.execute_network_pre_run`.\n\n        To see how a network run is structured also take a look at\n        :func:`~pypet.brian2.network.NetworkRunner.run_network`.\n\n        :param traj: Trajectory container", "docstring_tokens": ["Starts", "a", "network", "run", "before", "the", "individual", "run", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258602}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1477-L1491", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Add extensions to the certificate.", "language": "python", "parameters": "(self, extensions)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "not", "isinstance", "(", "arg_2", ",", "X509Extension", ")", ":", "raise", "ValueError", "(", "\"One of the elements is not an X509Extension\"", ")", "arg_3", "=", "_lib", ".", "X509_add_ext", "(", "arg_0", ".", "_x509", ",", "arg_2", ".", "_extension", ",", "-", "1", ")", "if", "not", "arg_3", ":", "_raise_current_error", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add extensions to the certificate.\n\n        :param extensions: The extensions to add.\n        :type extensions: An iterable of :py:class:`X509Extension` objects.\n        :return: ``None``\n        \"\"\"\n        for arg_2 in arg_1:\n            if not isinstance(arg_2, X509Extension):\n                raise ValueError(\"One of the elements is not an X509Extension\")\n\n            arg_3 = _lib.X509_add_ext(arg_0._x509, arg_2._extension, -1)\n            if not arg_3:\n                _raise_current_error()", "path": "src/OpenSSL/crypto.py", "identifier": "X509.add_extensions", "docstring": "Add extensions to the certificate.\n\n        :param extensions: The extensions to add.\n        :type extensions: An iterable of :py:class:`X509Extension` objects.\n        :return: ``None``", "docstring_tokens": ["Add", "extensions", "to", "the", "certificate", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 258603}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L635-L665", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Create an item to the server.", "language": "python", "parameters": "(self, token, name, parent_id, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "dict", "(", ")", "arg_5", "[", "'token'", "]", "=", "arg_1", "arg_5", "[", "'name'", "]", "=", "arg_2", "arg_5", "[", "'parentid'", "]", "=", "arg_3", "arg_6", "=", "[", "'description'", ",", "'uuid'", ",", "'privacy'", "]", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", "in", "arg_4", ":", "arg_5", "[", "arg_7", "]", "=", "arg_4", "[", "arg_7", "]", "arg_8", "=", "arg_0", ".", "request", "(", "'midas.item.create'", ",", "arg_5", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"\n        Create an item to the server.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param name: The name of the item to be created.\n        :type name: string\n        :param parent_id: The id of the destination folder.\n        :type parent_id: int | long\n        :param description: (optional) The description text of the item.\n        :type description: string\n        :param uuid: (optional) The UUID for the item. It will be generated if\n            not given.\n        :type uuid: string\n        :param privacy: (optional) The privacy state of the item\n            ('Public' or 'Private').\n        :type privacy: string\n        :returns: Dictionary containing the details of the created item.\n        :rtype: dict\n        \"\"\"\n        arg_5 = dict()\n        arg_5['token'] = arg_1\n        arg_5['name'] = arg_2\n        arg_5['parentid'] = arg_3\n        arg_6 = ['description', 'uuid', 'privacy']\n        for arg_7 in arg_6:\n            if arg_7 in arg_4:\n                arg_5[arg_7] = arg_4[arg_7]\n        arg_8 = arg_0.request('midas.item.create', arg_5)\n        return arg_8", "path": "pydas/drivers.py", "identifier": "CoreDriver.create_item", "docstring": "Create an item to the server.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param name: The name of the item to be created.\n        :type name: string\n        :param parent_id: The id of the destination folder.\n        :type parent_id: int | long\n        :param description: (optional) The description text of the item.\n        :type description: string\n        :param uuid: (optional) The UUID for the item. It will be generated if\n            not given.\n        :type uuid: string\n        :param privacy: (optional) The privacy state of the item\n            ('Public' or 'Private').\n        :type privacy: string\n        :returns: Dictionary containing the details of the created item.\n        :rtype: dict", "docstring_tokens": ["Create", "an", "item", "to", "the", "server", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 258604}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/filters.py#L362-L387", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Decorator function for windows with fractional input.", "language": "python", "parameters": "(window_spec)", "return_statement": "return _wrap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_wrap", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "int", "(", "np", ".", "floor", "(", "arg_1", ")", ")", ",", "int", "(", "np", ".", "ceil", "(", "arg_1", ")", ")", "arg_6", "=", "get_window", "(", "arg_0", ",", "arg_4", ")", "if", "len", "(", "arg_6", ")", "<", "arg_5", ":", "arg_6", "=", "np", ".", "pad", "(", "arg_6", ",", "[", "(", "0", ",", "arg_5", "-", "len", "(", "arg_6", ")", ")", "]", ",", "mode", "=", "'constant'", ")", "arg_6", "[", "arg_4", ":", "]", "=", "0.0", "return", "arg_6", "return", "_wrap"], "function": "def Func(arg_0):\n    '''Decorator function for windows with fractional input.\n\n    This function guarantees that for fractional `x`, the following hold:\n\n    1. `Func(window_function)(x)` has length `np.ceil(x)`\n    2. all values from `np.floor(x)` are set to 0.\n\n    For integer-valued `x`, there should be no change in behavior.\n    '''\n\n    def _wrap(arg_1, *arg_2, **arg_3):\n        '''The wrapped window'''\n        arg_4, arg_5 = int(np.floor(arg_1)), int(np.ceil(arg_1))\n\n        arg_6 = get_window(arg_0, arg_4)\n\n        if len(arg_6) < arg_5:\n            arg_6 = np.pad(arg_6, [(0, arg_5 - len(arg_6))],\n                            mode='constant')\n\n        arg_6[arg_4:] = 0.0\n\n        return arg_6\n\n    return _wrap", "path": "librosa/filters.py", "identifier": "__float_window", "docstring": "Decorator function for windows with fractional input.\n\n    This function guarantees that for fractional `x`, the following hold:\n\n    1. `__float_window(window_function)(x)` has length `np.ceil(x)`\n    2. all values from `np.floor(x)` are set to 0.\n\n    For integer-valued `x`, there should be no change in behavior.", "docstring_tokens": ["Decorator", "function", "for", "windows", "with", "fractional", "input", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258605}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L98-L126", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Determines the length of the DH params from the ServerKeyExchange", "language": "python", "parameters": "(server_handshake_bytes)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "None", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "parse_tls_records", "(", "arg_0", ")", ":", "if", "arg_3", "!=", "b'\\x16'", ":", "continue", "for", "arg_6", ",", "arg_7", "in", "parse_handshake_messages", "(", "arg_5", ")", ":", "if", "arg_6", "==", "b'\\x0c'", ":", "arg_2", "=", "arg_7", "break", "if", "arg_2", ":", "break", "if", "arg_2", ":", "arg_1", "=", "int_from_bytes", "(", "arg_2", "[", "0", ":", "2", "]", ")", "*", "8", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Determines the length of the DH params from the ServerKeyExchange\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        None or an integer of the bit size of the DH parameters\n    \"\"\"\n\n    arg_1 = None\n\n    arg_2 = None\n\n    for arg_3, arg_4, arg_5 in parse_tls_records(arg_0):\n        if arg_3 != b'\\x16':\n            continue\n        for arg_6, arg_7 in parse_handshake_messages(arg_5):\n            if arg_6 == b'\\x0c':\n                arg_2 = arg_7\n                break\n        if arg_2:\n            break\n\n    if arg_2:\n        arg_1 = int_from_bytes(arg_2[0:2]) * 8\n\n    return arg_1", "path": "oscrypto/_tls.py", "identifier": "get_dh_params_length", "docstring": "Determines the length of the DH params from the ServerKeyExchange\n\n    :param server_handshake_bytes:\n        A byte string of the handshake data received from the server\n\n    :return:\n        None or an integer of the bit size of the DH parameters", "docstring_tokens": ["Determines", "the", "length", "of", "the", "DH", "params", "from", "the", "ServerKeyExchange"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 258606}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L251-L262", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Called when an error stanza is received.", "language": "python", "parameters": "(self,stanza)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_Func", "(", ")", "arg_0", ".", "__logger", ".", "debug", "(", "\"Error from: %r Condition: %r\"", "%", "(", "arg_1", ".", "get_from", "(", ")", ",", "arg_2", ".", "get_condition", ")", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Called when an Func stanza is received.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.stanza.Stanza`\n        \"\"\"\n        arg_2=arg_1.get_Func()\n        arg_0.__logger.debug(\"Error from: %r Condition: %r\"\n                % (arg_1.get_from(),arg_2.get_condition))", "path": "pyxmpp2/ext/muc/muc.py", "identifier": "MucRoomHandler.error", "docstring": "Called when an error stanza is received.\n\n        :Parameters:\n            - `stanza`: the stanza received.\n        :Types:\n            - `stanza`: `pyxmpp.stanza.Stanza`", "docstring_tokens": ["Called", "when", "an", "error", "stanza", "is", "received", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258607}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_api_base_hook.py#L166-L192", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Function decorator that intercepts HTTP Errors and raises AirflowException\n        with more informative message.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper_decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "wrapper_decorator", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "try", ":", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "except", "GoogleAPICallError", "as", "e", ":", "if", "isinstance", "(", "e", ",", "AlreadyExists", ")", ":", "raise", "e", "else", ":", "arg_1", ".", "log", ".", "error", "(", "'The request failed:\\n%s'", ",", "str", "(", "e", ")", ")", "raise", "AirflowException", "(", "e", ")", "except", "RetryError", "as", "e", ":", "arg_1", ".", "log", ".", "error", "(", "'The request failed due to a retryable error and retry attempts failed.'", ")", "raise", "AirflowException", "(", "e", ")", "except", "ValueError", "as", "e", ":", "arg_1", ".", "log", ".", "error", "(", "'The request failed, the parameters are invalid.'", ")", "raise", "AirflowException", "(", "e", ")", "except", "HttpError", "as", "e", ":", "arg_1", ".", "log", ".", "error", "(", "'The request failed:\\n%s'", ",", "str", "(", "e", ")", ")", "raise", "AirflowException", "(", "e", ")", "return", "wrapper_decorator"], "function": "def Func(arg_0):\n        \"\"\"\n        Function decorator that intercepts HTTP Errors and raises AirflowException\n        with more informative message.\n        \"\"\"\n\n        @functools.wraps(arg_0)\n        def wrapper_decorator(arg_1, *arg_2, **arg_3):\n            try:\n                return arg_0(arg_1, *arg_2, **arg_3)\n            except GoogleAPICallError as e:\n                if isinstance(e, AlreadyExists):\n                    raise e\n                else:\n                    arg_1.log.error('The request failed:\\n%s', str(e))\n                    raise AirflowException(e)\n            except RetryError as e:\n                arg_1.log.error('The request failed due to a retryable error and retry attempts failed.')\n                raise AirflowException(e)\n            except ValueError as e:\n                arg_1.log.error('The request failed, the parameters are invalid.')\n                raise AirflowException(e)\n            except HttpError as e:\n                arg_1.log.error('The request failed:\\n%s', str(e))\n                raise AirflowException(e)\n\n        return wrapper_decorator", "path": "airflow/contrib/hooks/gcp_api_base_hook.py", "identifier": "GoogleCloudBaseHook.catch_http_exception", "docstring": "Function decorator that intercepts HTTP Errors and raises AirflowException\n        with more informative message.", "docstring_tokens": ["Function", "decorator", "that", "intercepts", "HTTP", "Errors", "and", "raises", "AirflowException", "with", "more", "informative", "message", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258608}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L227-L232", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Process bounds as defined in the configuration.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_raw", "[", "\"Func\"", "]", "is", "None", ":", "return", "arg_0", ".", "process_pyramid", ".", "Func", "else", ":", "return", "Bounds", "(", "*", "_validate_Func", "(", "arg_0", ".", "_raw", "[", "\"Func\"", "]", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Process Func as defined in the configuration.\"\"\"\n        if arg_0._raw[\"Func\"] is None:\n            return arg_0.process_pyramid.Func\n        else:\n            return Bounds(*_validate_Func(arg_0._raw[\"Func\"]))", "path": "mapchete/config.py", "identifier": "MapcheteConfig.bounds", "docstring": "Process bounds as defined in the configuration.", "docstring_tokens": ["Process", "bounds", "as", "defined", "in", "the", "configuration", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 258609}
{"url": "https://github.com/inveniosoftware/invenio-app/blob/6ef600f28913a501c05d75ffbe203e941e229f49/invenio_app/ext.py#L40-L86", "sha": "6ef600f28913a501c05d75ffbe203e941e229f49", "docstring_summary": "Initialize application object.", "language": "python", "parameters": "(self, app, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "init_config", "(", "arg_1", ")", "arg_0", ".", "limiter", "=", "Limiter", "(", "arg_1", ",", "key_func", "=", "get_ipaddr", ")", "if", "arg_1", ".", "config", "[", "'APP_ENABLE_SECURE_HEADERS'", "]", ":", "arg_0", ".", "talisman", "=", "Talisman", "(", "arg_1", ",", "**", "arg_1", ".", "config", ".", "get", "(", "'APP_DEFAULT_SECURE_HEADERS'", ",", "{", "}", ")", ")", "if", "arg_1", ".", "config", "[", "'APP_HEALTH_BLUEPRINT_ENABLED'", "]", ":", "arg_5", "=", "Blueprint", "(", "'invenio_app_ping'", ",", "__name__", ")", "@", "arg_5", ".", "route", "(", "'/ping'", ")", "def", "arg_6", "(", ")", ":", "return", "'OK'", "arg_6", ".", "talisman_view_options", "=", "{", "'force_https'", ":", "False", "}", "arg_1", ".", "register_blueprint", "(", "arg_5", ")", "arg_8", "=", "arg_1", ".", "config", ".", "get", "(", "'APP_REQUESTID_HEADER'", ")", "if", "arg_8", ":", "@", "arg_1", ".", "before_request", "def", "set_request_id", "(", ")", ":", "arg_9", "=", "request", ".", "headers", ".", "get", "(", "arg_8", ")", "if", "arg_9", ":", "arg_10", ".", "request_id", "=", "arg_9", "[", ":", "200", "]", "try", ":", "from", "flask_debugtoolbar", "import", "DebugToolbarExtension", "arg_1", ".", "extensions", "[", "'flask-debugtoolbar'", "]", "=", "DebugToolbarExtension", "(", "arg_1", ")", "except", "ImportError", ":", "arg_1", ".", "logger", ".", "debug", "(", "'Flask-DebugToolbar extension not installed.'", ")", "arg_1", ".", "extensions", "[", "'invenio-app'", "]", "=", "arg_0"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Initialize application object.\n\n        :param app: An instance of :class:`~flask.Flask`.\n        \"\"\"\n        # Init the configuration\n        arg_0.init_config(arg_1)\n        # Enable Rate limiter\n        arg_0.limiter = Limiter(arg_1, key_func=get_ipaddr)\n        # Enable secure HTTP headers\n        if arg_1.config['APP_ENABLE_SECURE_HEADERS']:\n            arg_0.talisman = Talisman(\n                arg_1, **arg_1.config.get('APP_DEFAULT_SECURE_HEADERS', {})\n            )\n        # Enable PING view\n        if arg_1.config['APP_HEALTH_BLUEPRINT_ENABLED']:\n            arg_5 = Blueprint('invenio_app_ping', __name__)\n\n            @arg_5.route('/ping')\n            def arg_6():\n                \"\"\"Load balancer ping view.\"\"\"\n                return 'OK'\n\n            arg_6.talisman_view_options = {'force_https': False}\n\n            arg_1.register_blueprint(arg_5)\n\n        arg_8 = arg_1.config.get('APP_REQUESTID_HEADER')\n        if arg_8:\n            @arg_1.before_request\n            def set_request_id():\n                \"\"\"Extracts a request id from an HTTP header.\"\"\"\n                arg_9 = request.headers.get(arg_8)\n                if arg_9:\n                    # Capped at 200 to protect against malicious clients\n                    # sending very large headers.\n                    arg_10.request_id = arg_9[:200]\n\n        # If installed register the Flask-DebugToolbar extension\n        try:\n            from flask_debugtoolbar import DebugToolbarExtension\n            arg_1.extensions['flask-debugtoolbar'] = DebugToolbarExtension(arg_1)\n        except ImportError:\n            arg_1.logger.debug('Flask-DebugToolbar extension not installed.')\n\n        # Register self\n        arg_1.extensions['invenio-app'] = arg_0", "path": "invenio_app/ext.py", "identifier": "InvenioApp.init_app", "docstring": "Initialize application object.\n\n        :param app: An instance of :class:`~flask.Flask`.", "docstring_tokens": ["Initialize", "application", "object", "."], "nwo": "inveniosoftware/invenio-app", "score": 0.19114614593059856, "idx": 258610}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/current.py#L72-L86", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Read a JSON notebook from a string and return the NotebookNode object.", "language": "python", "parameters": "(s, **kwargs)", "return_statement": "return nb", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "parse_json", "(", "arg_0", ",", "**", "arg_1", ")", "if", "arg_2", "==", "1", ":", "arg_5", "=", "v1", ".", "to_notebook_json", "(", "arg_4", ",", "**", "arg_1", ")", "arg_5", "=", "v3", ".", "convert_to_this_nbformat", "(", "arg_5", ",", "orig_version", "=", "1", ")", "elif", "arg_2", "==", "2", ":", "arg_5", "=", "v2", ".", "to_notebook_json", "(", "arg_4", ",", "**", "arg_1", ")", "arg_5", "=", "v3", ".", "convert_to_this_nbformat", "(", "arg_5", ",", "orig_version", "=", "2", ")", "elif", "arg_2", "==", "3", ":", "arg_5", "=", "v3", ".", "to_notebook_json", "(", "arg_4", ",", "**", "arg_1", ")", "arg_5", "=", "v3", ".", "convert_to_this_nbformat", "(", "arg_5", ",", "orig_version", "=", "3", ",", "orig_minor", "=", "arg_3", ")", "else", ":", "raise", "NBFormatError", "(", "'Unsupported JSON nbformat version: %i'", "%", "arg_2", ")", "return", "arg_5"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Read a JSON notebook from a string and return the NotebookNode object.\"\"\"\n    arg_2, arg_3, arg_4 = parse_json(arg_0, **arg_1)\n    if arg_2 == 1:\n        arg_5 = v1.to_notebook_json(arg_4, **arg_1)\n        arg_5 = v3.convert_to_this_nbformat(arg_5, orig_version=1)\n    elif arg_2 == 2:\n        arg_5 = v2.to_notebook_json(arg_4, **arg_1)\n        arg_5 = v3.convert_to_this_nbformat(arg_5, orig_version=2)\n    elif arg_2 == 3:\n        arg_5 = v3.to_notebook_json(arg_4, **arg_1)\n        arg_5 = v3.convert_to_this_nbformat(arg_5, orig_version=3, orig_minor=arg_3)\n    else:\n        raise NBFormatError('Unsupported JSON nbformat version: %i' % arg_2)\n    return arg_5", "path": "environment/lib/python2.7/site-packages/IPython/nbformat/current.py", "identifier": "reads_json", "docstring": "Read a JSON notebook from a string and return the NotebookNode object.", "docstring_tokens": ["Read", "a", "JSON", "notebook", "from", "a", "string", "and", "return", "the", "NotebookNode", "object", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258611}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaro_winkler.py#L306-L375", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the Jaro or Jaro-Winkler distance between two strings.", "language": "python", "parameters": "(\n    src,\n    tar,\n    qval=1,\n    mode='winkler',\n    long_strings=False,\n    boost_threshold=0.7,\n    scaling_factor=0.1,\n)", "return_statement": "return JaroWinkler().dist(\n        src, tar, qval, mode, long_strings, boost_threshold, scaling_factor\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "'winkler'", ",", "arg_4", "=", "False", ",", "arg_5", "=", "0.7", ",", "arg_6", "=", "0.1", ",", ")", ":", "return", "JaroWinkler", "(", ")", ".", "dist", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2=1,\n    arg_3='winkler',\n    arg_4=False,\n    arg_5=0.7,\n    arg_6=0.1,\n):\n    \"\"\"Return the Jaro or Jaro-Winkler distance between two strings.\n\n    This is a wrapper for :py:meth:`JaroWinkler.dist`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    qval : int\n        The length of each q-gram (defaults to 1: character-wise matching)\n    mode : str\n        Indicates which variant of this distance metric to compute:\n\n            - ``winkler`` -- computes the Jaro-Winkler distance (default) which\n              increases the score for matches near the start of the word\n            - ``jaro`` -- computes the Jaro distance\n\n    long_strings : bool\n        Set to True to \"Increase the probability of a match when the number of\n        matched characters is large. This option allows for a little more\n        tolerance when the strings are large. It is not an appropriate test\n        when comparing fixedlength fields such as phone and social security\n        numbers.\" (Used in 'winkler' mode only.)\n    boost_threshold : float\n        A value between 0 and 1, below which the Winkler boost is not applied\n        (defaults to 0.7). (Used in 'winkler' mode only.)\n    scaling_factor : float\n        A value between 0 and 0.25, indicating by how much to boost scores for\n        matching prefixes (defaults to 0.1). (Used in 'winkler' mode only.)\n\n    Returns\n    -------\n    float\n        Jaro or Jaro-Winkler distance\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.222222222222\n    >>> round(Func('Niall', 'Neil'), 12)\n    0.195\n    >>> round(Func('aluminum', 'Catalan'), 12)\n    0.39880952381\n    >>> round(Func('ATCG', 'TAGC'), 12)\n    0.166666666667\n\n    >>> round(Func('cat', 'hat', mode='jaro'), 12)\n    0.222222222222\n    >>> round(Func('Niall', 'Neil', mode='jaro'), 12)\n    0.216666666667\n    >>> round(Func('aluminum', 'Catalan', mode='jaro'), 12)\n    0.39880952381\n    >>> round(Func('ATCG', 'TAGC', mode='jaro'), 12)\n    0.166666666667\n\n    \"\"\"\n    return JaroWinkler().dist(\n        arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6\n    )", "path": "abydos/distance/_jaro_winkler.py", "identifier": "dist_jaro_winkler", "docstring": "Return the Jaro or Jaro-Winkler distance between two strings.\n\n    This is a wrapper for :py:meth:`JaroWinkler.dist`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    qval : int\n        The length of each q-gram (defaults to 1: character-wise matching)\n    mode : str\n        Indicates which variant of this distance metric to compute:\n\n            - ``winkler`` -- computes the Jaro-Winkler distance (default) which\n              increases the score for matches near the start of the word\n            - ``jaro`` -- computes the Jaro distance\n\n    long_strings : bool\n        Set to True to \"Increase the probability of a match when the number of\n        matched characters is large. This option allows for a little more\n        tolerance when the strings are large. It is not an appropriate test\n        when comparing fixedlength fields such as phone and social security\n        numbers.\" (Used in 'winkler' mode only.)\n    boost_threshold : float\n        A value between 0 and 1, below which the Winkler boost is not applied\n        (defaults to 0.7). (Used in 'winkler' mode only.)\n    scaling_factor : float\n        A value between 0 and 0.25, indicating by how much to boost scores for\n        matching prefixes (defaults to 0.1). (Used in 'winkler' mode only.)\n\n    Returns\n    -------\n    float\n        Jaro or Jaro-Winkler distance\n\n    Examples\n    --------\n    >>> round(dist_jaro_winkler('cat', 'hat'), 12)\n    0.222222222222\n    >>> round(dist_jaro_winkler('Niall', 'Neil'), 12)\n    0.195\n    >>> round(dist_jaro_winkler('aluminum', 'Catalan'), 12)\n    0.39880952381\n    >>> round(dist_jaro_winkler('ATCG', 'TAGC'), 12)\n    0.166666666667\n\n    >>> round(dist_jaro_winkler('cat', 'hat', mode='jaro'), 12)\n    0.222222222222\n    >>> round(dist_jaro_winkler('Niall', 'Neil', mode='jaro'), 12)\n    0.216666666667\n    >>> round(dist_jaro_winkler('aluminum', 'Catalan', mode='jaro'), 12)\n    0.39880952381\n    >>> round(dist_jaro_winkler('ATCG', 'TAGC', mode='jaro'), 12)\n    0.166666666667", "docstring_tokens": ["Return", "the", "Jaro", "or", "Jaro", "-", "Winkler", "distance", "between", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 258612}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py#L584-L595", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Handle inputs that start classic IPython prompt syntax.", "language": "python", "parameters": "(line)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", "or", "arg_0", ".", "isspace", "(", ")", ":", "return", "arg_0", "arg_1", "=", "_ipy_prompt_re", ".", "match", "(", "arg_0", ")", "if", "arg_1", ":", "return", "arg_0", "[", "len", "(", "arg_1", ".", "group", "(", "0", ")", ")", ":", "]", "else", ":", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Handle inputs that start classic IPython prompt syntax.\"\"\"\n\n    if not arg_0 or arg_0.isspace():\n        return arg_0\n    #print 'LINE:  %r' % line # dbg\n    arg_1 = _ipy_prompt_re.match(arg_0)\n    if arg_1:\n        #print 'MATCH! %r -> %r' % (line, line[len(m.group(0)):]) # dbg\n        return arg_0[len(arg_1.group(0)):]\n    else:\n        return arg_0", "path": "environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py", "identifier": "transform_ipy_prompt", "docstring": "Handle inputs that start classic IPython prompt syntax.", "docstring_tokens": ["Handle", "inputs", "that", "start", "classic", "IPython", "prompt", "syntax", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258613}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/providers/basicaer/basicaertools.py#L69-L97", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return the index string for Numpy.eignsum matrix-matrix multiplication.", "language": "python", "parameters": "(gate_indices, number_of_qubits)", "return_statement": "return \"{mat_l}{mat_r}, \".format(mat_l=mat_l, mat_r=mat_r) + \\\n           \"{tens_lin}{tens_r}->{tens_lout}{tens_r}\".format(tens_lin=tens_lin,\n                                                            tens_lout=tens_lout,\n                                                            tens_r=tens_r)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "_Func_helper", "(", "arg_0", ",", "arg_1", ")", "arg_6", "=", "ascii_uppercase", "[", ":", "arg_1", "]", "return", "\"{mat_l}{mat_r}, \"", ".", "format", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "+", "\"{tens_lin}{tens_r}->{tens_lout}{tens_r}\"", ".", "format", "(", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return the index string for Numpy.eignsum matrix-matrix multiplication.\n\n    The returned indices are to perform a matrix multiplication A.B where\n    the matrix A is an M-qubit matrix, matrix B is an N-qubit matrix, and\n    M <= N, and identity matrices are implied on the subsystems where A has no\n    support on B.\n\n    Args:\n        gate_indices (list[int]): the indices of the right matrix subsystems\n                                   to contract with the left matrix.\n        number_of_qubits (int): the total number of qubits for the right matrix.\n\n    Returns:\n        str: An indices string for the Numpy.einsum function.\n    \"\"\"\n\n    arg_2, arg_3, arg_4, arg_5 = _Func_helper(arg_0,\n                                                                    arg_1)\n\n    # Right indices for the N-qubit input and output tensor\n    arg_6 = ascii_uppercase[:arg_1]\n\n    # Combine indices into matrix multiplication string format\n    # for numpy.einsum function\n    return \"{mat_l}{mat_r}, \".format(arg_2=arg_2, arg_3=arg_3) + \\\n           \"{tens_lin}{tens_r}->{tens_lout}{tens_r}\".format(arg_4=arg_4,\n                                                            arg_5=arg_5,\n                                                            arg_6=arg_6)", "path": "qiskit/providers/basicaer/basicaertools.py", "identifier": "einsum_matmul_index", "docstring": "Return the index string for Numpy.eignsum matrix-matrix multiplication.\n\n    The returned indices are to perform a matrix multiplication A.B where\n    the matrix A is an M-qubit matrix, matrix B is an N-qubit matrix, and\n    M <= N, and identity matrices are implied on the subsystems where A has no\n    support on B.\n\n    Args:\n        gate_indices (list[int]): the indices of the right matrix subsystems\n                                   to contract with the left matrix.\n        number_of_qubits (int): the total number of qubits for the right matrix.\n\n    Returns:\n        str: An indices string for the Numpy.einsum function.", "docstring_tokens": ["Return", "the", "index", "string", "for", "Numpy", ".", "eignsum", "matrix", "-", "matrix", "multiplication", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258614}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site.py#L186-L207", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Add 'sitedir' argument to sys.path if missing and handle .pth files in\n    'sitedir", "language": "python", "parameters": "(sitedir, known_paths=None)", "return_statement": "return known_paths", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "_init_pathinfo", "(", ")", "arg_2", "=", "1", "else", ":", "arg_2", "=", "0", "arg_0", ",", "arg_3", "=", "makepath", "(", "arg_0", ")", "if", "not", "arg_3", "in", "arg_1", ":", "sys", ".", "path", ".", "append", "(", "arg_0", ")", "try", ":", "arg_4", "=", "os", ".", "listdir", "(", "arg_0", ")", "except", "os", ".", "error", ":", "return", "arg_4", ".", "sort", "(", ")", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", ".", "endswith", "(", "os", ".", "extsep", "+", "\"pth\"", ")", ":", "addpackage", "(", "arg_0", ",", "arg_5", ",", "arg_1", ")", "if", "arg_2", ":", "arg_1", "=", "None", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Add 'sitedir' argument to sys.path if missing and handle .pth files in\n    'sitedir'\"\"\"\n    if arg_1 is None:\n        arg_1 = _init_pathinfo()\n        arg_2 = 1\n    else:\n        arg_2 = 0\n    arg_0, arg_3 = makepath(arg_0)\n    if not arg_3 in arg_1:\n        sys.path.append(arg_0)        # Add path component\n    try:\n        arg_4 = os.listdir(arg_0)\n    except os.error:\n        return\n    arg_4.sort()\n    for arg_5 in arg_4:\n        if arg_5.endswith(os.extsep + \"pth\"):\n            addpackage(arg_0, arg_5, arg_1)\n    if arg_2:\n        arg_1 = None\n    return arg_1", "path": "capybara/virtualenv/lib/python2.7/site.py", "identifier": "addsitedir", "docstring": "Add 'sitedir' argument to sys.path if missing and handle .pth files in\n    'sitedir", "docstring_tokens": ["Add", "sitedir", "argument", "to", "sys", ".", "path", "if", "missing", "and", "handle", ".", "pth", "files", "in", "sitedir"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 258615}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/transport.py#L667-L703", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Continue a TLS handshake.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "logger", ".", "debug", "(", "\" do_handshake()\"", ")", "arg_0", ".", "_socket", ".", "do_handshake", "(", ")", "except", "ssl", ".", "SSLError", ",", "err", ":", "if", "err", ".", "args", "[", "0", "]", "==", "ssl", ".", "SSL_ERROR_WANT_READ", ":", "arg_0", ".", "_tls_state", "=", "\"want_read\"", "logger", ".", "debug", "(", "\"   want_read\"", ")", "arg_0", ".", "_state_cond", ".", "notify", "(", ")", "return", "elif", "err", ".", "args", "[", "0", "]", "==", "ssl", ".", "SSL_ERROR_WANT_WRITE", ":", "arg_0", ".", "_tls_state", "=", "\"want_write\"", "logger", ".", "debug", "(", "\"   want_write\"", ")", "arg_0", ".", "_write_queue", ".", "appendleft", "(", "TLSHandshake", ")", "return", "else", ":", "raise", "arg_0", ".", "_tls_state", "=", "\"connected\"", "arg_0", ".", "_set_state", "(", "\"connected\"", ")", "arg_0", ".", "_auth_properties", "[", "'security-layer'", "]", "=", "\"TLS\"", "if", "\"tls-unique\"", "in", "CHANNEL_BINDING_TYPES", ":", "try", ":", "arg_3", "=", "arg_0", ".", "_socket", ".", "get_channel_binding", "(", "\"tls-unique\"", ")", "except", "ValueError", ":", "pass", "else", ":", "arg_0", ".", "_auth_properties", "[", "'channel-binding'", "]", "=", "{", "\"tls-unique\"", ":", "arg_3", "}", "try", ":", "arg_4", "=", "arg_0", ".", "_socket", ".", "cipher", "(", ")", "except", "AttributeError", ":", "arg_4", "=", "\"unknown\"", "arg_5", "=", "get_certificate_from_ssl_socket", "(", "arg_0", ".", "_socket", ")", "arg_0", ".", "event", "(", "TLSConnectedEvent", "(", "arg_4", ",", "arg_5", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Continue a TLS handshake.\"\"\"\n        try:\n            logger.debug(\" do_handshake()\")\n            arg_0._socket.do_handshake()\n        except ssl.SSLError, err:\n            if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n                arg_0._tls_state = \"want_read\"\n                logger.debug(\"   want_read\")\n                arg_0._state_cond.notify()\n                return\n            elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n                arg_0._tls_state = \"want_write\"\n                logger.debug(\"   want_write\")\n                arg_0._write_queue.appendleft(TLSHandshake)\n                return\n            else:\n                raise\n        arg_0._tls_state = \"connected\"\n        arg_0._set_state(\"connected\")\n        arg_0._auth_properties['security-layer'] = \"TLS\"\n        if \"tls-unique\" in CHANNEL_BINDING_TYPES:\n            try:\n                # pylint: disable=E1103\n                arg_3 = arg_0._socket.get_channel_binding(\"tls-unique\")\n            except ValueError:\n                pass\n            else:\n                arg_0._auth_properties['channel-binding'] = {\n                                                    \"tls-unique\": arg_3}\n        try:\n            arg_4 = arg_0._socket.cipher()\n        except AttributeError:\n            # SSLSocket.cipher doesn't work on PyPy\n            arg_4 = \"unknown\"\n        arg_5 = get_certificate_from_ssl_socket(arg_0._socket)\n        arg_0.event(TLSConnectedEvent(arg_4, arg_5))", "path": "pyxmpp2/transport.py", "identifier": "TCPTransport._continue_tls_handshake", "docstring": "Continue a TLS handshake.", "docstring_tokens": ["Continue", "a", "TLS", "handshake", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258616}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/viasat.py#L121-L125", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Try to find a stream_id", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_image_re", ".", "search", "(", "arg_1", ")", "if", "arg_2", ":", "return", "arg_2", ".", "group", "(", "\"stream_id\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Try to find a stream_id\"\"\"\n        arg_2 = arg_0._image_re.search(arg_1)\n        if arg_2:\n            return arg_2.group(\"stream_id\")", "path": "src/streamlink/plugins/viasat.py", "identifier": "Viasat._get_stream_id", "docstring": "Try to find a stream_id", "docstring_tokens": ["Try", "to", "find", "a", "stream_id"], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 258617}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L210-L221", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "Returns a dictionary like object with the lists of values\n        collapsed by their respective key. Useful to find varying vs\n        constant keys and to find how fast keys vary.", "language": "python", "parameters": "(self,specs)", "return_statement": "return collection", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "itertools", ".", "chain", ".", "from_iterable", "(", "[", "[", "(", "arg_4", ",", "run", "[", "arg_4", "]", ")", "for", "arg_4", "in", "run", "]", "for", "run", "in", "arg_1", "]", ")", "arg_3", "=", "defaultdict", "(", "list", ")", "for", "(", "arg_4", ",", "arg_5", ")", "in", "arg_2", ":", "arg_3", "[", "arg_4", "]", ".", "append", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Returns a dictionary like object with the lists of values\n        collapsed by their respective key. Useful to find varying vs\n        constant keys and to find how fast keys vary.\n        \"\"\"\n        # Collect (key, value) tuples as list of lists, flatten with chain\n        arg_2 = itertools.chain.from_iterable(\n            [[(arg_4, run[arg_4]) for arg_4 in run] for run in arg_1])\n        arg_3 = defaultdict(list)\n        for (arg_4,arg_5) in arg_2: arg_3[arg_4].append(arg_5)\n        return arg_3", "path": "lancet/core.py", "identifier": "Arguments._collect_by_key", "docstring": "Returns a dictionary like object with the lists of values\n        collapsed by their respective key. Useful to find varying vs\n        constant keys and to find how fast keys vary.", "docstring_tokens": ["Returns", "a", "dictionary", "like", "object", "with", "the", "lists", "of", "values", "collapsed", "by", "their", "respective", "key", ".", "Useful", "to", "find", "varying", "vs", "constant", "keys", "and", "to", "find", "how", "fast", "keys", "vary", "."], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 258618}
{"url": "https://github.com/stianaske/pybotvac/blob/e3f655e81070ff209aaa4efb7880016cf2599e6d/pybotvac/account.py#L121-L138", "sha": "e3f655e81070ff209aaa4efb7880016cf2599e6d", "docstring_summary": "Return a requested map from a robot.", "language": "python", "parameters": "(url, dest_path=None)", "return_statement": "return image.raw", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "requests", ".", "get", "(", "arg_0", ",", "stream", "=", "True", ",", "timeout", "=", "10", ")", "if", "arg_1", ":", "arg_3", "=", "arg_0", ".", "rsplit", "(", "'/'", ",", "2", ")", "[", "1", "]", "+", "'-'", "+", "arg_0", ".", "rsplit", "(", "'/'", ",", "1", ")", "[", "1", "]", "arg_4", "=", "arg_3", ".", "split", "(", "'?'", ")", "[", "0", "]", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", "arg_2", ".", "raise_for_status", "(", ")", "with", "open", "(", "arg_5", ",", "'wb'", ")", "as", "data", ":", "arg_2", ".", "raw", ".", "decode_content", "=", "True", "shutil", ".", "copyfileobj", "(", "arg_2", ".", "raw", ",", "data", ")", "return", "arg_2", ".", "raw"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Return a requested map from a robot.\n\n        :return:\n        \"\"\"\n        arg_2 = requests.get(arg_0, stream=True, timeout=10)\n\n        if arg_1:\n            arg_3 = arg_0.rsplit('/', 2)[1] + '-' + arg_0.rsplit('/', 1)[1]\n            arg_4 = arg_3.split('?')[0]\n            arg_5 = os.path.join(arg_1, arg_4)\n            arg_2.raise_for_status()\n            with open(arg_5, 'wb') as data:\n                arg_2.raw.decode_content = True\n                shutil.copyfileobj(arg_2.raw, data)\n\n        return arg_2.raw", "path": "pybotvac/account.py", "identifier": "Account.get_map_image", "docstring": "Return a requested map from a robot.\n\n        :return:", "docstring_tokens": ["Return", "a", "requested", "map", "from", "a", "robot", "."], "nwo": "stianaske/pybotvac", "score": 0.6514120724143954, "idx": 258619}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L297-L340", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Runs Picard MarkDuplicates on a BAM file. Requires that the BAM file be coordinate sorted.", "language": "python", "parameters": "(job, bam, bai, validation_stringency='LENIENT')", "return_statement": "return bam, bai", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'LENIENT'", ")", ":", "arg_4", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_1", ",", "os", ".", "path", ".", "join", "(", "arg_4", ",", "'sorted.bam'", ")", ")", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_2", ",", "os", ".", "path", ".", "join", "(", "arg_4", ",", "'sorted.bai'", ")", ")", "arg_5", "=", "[", "'MarkDuplicates'", ",", "'INPUT=sorted.bam'", ",", "'OUTPUT=mkdups.bam'", ",", "'METRICS_FILE=metrics.txt'", ",", "'ASSUME_SORTED=true'", ",", "'CREATE_INDEX=true'", ",", "'VALIDATION_STRINGENCY=%s'", "%", "arg_3", ".", "upper", "(", ")", "]", "arg_6", "=", "[", "'--rm'", ",", "'--log-driver'", ",", "'none'", ",", "'-e'", ",", "'JAVA_OPTIONS=-Djava.io.tmpdir=/data/ -Xmx{}'", ".", "format", "(", "arg_0", ".", "memory", ")", ",", "'-v'", ",", "'{}:/data'", ".", "format", "(", "arg_4", ")", "]", "arg_7", "=", "time", ".", "time", "(", ")", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "workDir", "=", "arg_4", ",", "parameters", "=", "arg_5", ",", "tool", "=", "'quay.io/ucsc_cgl/picardtools:1.95--dd5ac549b95eb3e5d166a5e310417ef13651994e'", ",", "dockerParameters", "=", "arg_6", ")", "arg_8", "=", "time", ".", "time", "(", ")", "_log_runtime", "(", "arg_0", ",", "arg_7", ",", "arg_8", ",", "\"Picard MarkDuplicates\"", ")", "arg_1", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "'mkdups.bam'", ")", ")", "arg_2", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_4", ",", "'mkdups.bai'", ")", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='LENIENT'):\n    \"\"\"\n    Runs Picard MarkDuplicates on a BAM file. Requires that the BAM file be coordinate sorted.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str bam: FileStoreID for BAM file\n    :param str bai: FileStoreID for BAM index file\n    :param str validation_stringency: BAM file validation stringency, default is LENIENT\n    :return: FileStoreIDs for BAM and BAI files\n    :rtype: tuple\n    \"\"\"\n    arg_4 = arg_0.fileStore.getLocalTempDir()\n\n    # Retrieve file path\n    arg_0.fileStore.readGlobalFile(arg_1, os.path.join(arg_4, 'sorted.bam'))\n    arg_0.fileStore.readGlobalFile(arg_2, os.path.join(arg_4, 'sorted.bai'))\n\n    # Call: picardtools\n    arg_5 = ['MarkDuplicates',\n               'INPUT=sorted.bam',\n               'OUTPUT=mkdups.bam',\n               'METRICS_FILE=metrics.txt',\n               'ASSUME_SORTED=true',\n               'CREATE_INDEX=true',\n               'VALIDATION_STRINGENCY=%s' % arg_3.upper()]\n\n    # picard-tools container doesn't have JAVA_OPTS variable\n    # Set TMPDIR to /data to prevent writing temporary files to /tmp\n    arg_6 = ['--rm',\n                         '--log-driver', 'none',\n                         '-e', 'JAVA_OPTIONS=-Djava.io.tmpdir=/data/ -Xmx{}'.format(arg_0.memory),\n                         '-v', '{}:/data'.format(arg_4)]\n\n    arg_7 = time.time()\n    dockerCall(arg_0=arg_0, workDir=arg_4,\n               parameters=arg_5,\n               tool='quay.io/ucsc_cgl/picardtools:1.95--dd5ac549b95eb3e5d166a5e310417ef13651994e',\n               dockerParameters=arg_6)\n    arg_8 = time.time()\n    _log_runtime(arg_0, arg_7, arg_8, \"Picard MarkDuplicates\")\n\n    arg_1 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_4, 'mkdups.bam'))\n    arg_2 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_4, 'mkdups.bai'))\n    return arg_1, arg_2", "path": "src/toil_lib/tools/preprocessing.py", "identifier": "picard_mark_duplicates", "docstring": "Runs Picard MarkDuplicates on a BAM file. Requires that the BAM file be coordinate sorted.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str bam: FileStoreID for BAM file\n    :param str bai: FileStoreID for BAM index file\n    :param str validation_stringency: BAM file validation stringency, default is LENIENT\n    :return: FileStoreIDs for BAM and BAI files\n    :rtype: tuple", "docstring_tokens": ["Runs", "Picard", "MarkDuplicates", "on", "a", "BAM", "file", ".", "Requires", "that", "the", "BAM", "file", "be", "coordinate", "sorted", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 258620}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L1057-L1129", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Factory for loading the Poisson noise-map from a .fits file.", "language": "python", "parameters": "(poisson_noise_map_path, poisson_noise_map_hdu, pixel_scale,\n                           convert_poisson_noise_map_from_weight_map,\n                           convert_poisson_noise_map_from_inverse_noise_map,\n                           poisson_noise_map_from_image,\n                           image, exposure_time_map, convert_from_electrons, gain, convert_from_adus)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", ":", "arg_11", "=", "sum", "(", "[", "arg_3", ",", "arg_4", ",", "arg_5", "]", ")", "if", "arg_11", "==", "0", "and", "arg_0", "is", "not", "None", ":", "return", "PoissonNoiseMap", ".", "from_fits_with_pixel_scale", "(", "file_path", "=", "arg_0", ",", "hdu", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "elif", "arg_5", ":", "if", "not", "(", "arg_8", "or", "arg_10", ")", "and", "arg_7", "is", "None", ":", "raise", "exc", ".", "DataException", "(", "'Cannot compute the Poisson noise-map from the image if an '", "'exposure-time (or exposure time map) is not supplied to convert to adus'", ")", "if", "arg_10", "and", "arg_9", "is", "None", ":", "raise", "exc", ".", "DataException", "(", "'Cannot compute the Poisson noise-map from the image if a'", "'gain is not supplied to convert from adus'", ")", "return", "PoissonNoiseMap", ".", "from_image_and_exposure_time_map", "(", "arg_2", "=", "arg_2", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")", "elif", "arg_3", "and", "arg_0", "is", "not", "None", ":", "arg_12", "=", "Array", ".", "from_fits", "(", "file_path", "=", "arg_0", ",", "hdu", "=", "arg_1", ")", "return", "PoissonNoiseMap", ".", "from_weight_map", "(", "arg_12", "=", "arg_12", ",", "arg_2", "=", "arg_2", ")", "elif", "arg_4", "and", "arg_0", "is", "not", "None", ":", "arg_13", "=", "Array", ".", "from_fits", "(", "file_path", "=", "arg_0", ",", "hdu", "=", "arg_1", ")", "return", "PoissonNoiseMap", ".", "from_inverse_noise_map", "(", "arg_13", "=", "arg_13", ",", "arg_2", "=", "arg_2", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2,\n                           arg_3,\n                           arg_4,\n                           arg_5,\n                           arg_6, arg_7, arg_8, arg_9, arg_10):\n    \"\"\"Factory for loading the Poisson noise-map from a .fits file.\n\n    This factory also includes a number of routines for converting the Poisson noise-map from from other units (e.g. \\\n    a weight map) or computing the Poisson noise_map from other unblurred_image_1d (e.g. the ccd image).\n\n    Parameters\n    ----------\n    poisson_noise_map_path : str\n        The path to the poisson_noise_map .fits file containing the Poisson noise-map \\\n         (e.g. '/path/to/poisson_noise_map.fits')\n    poisson_noise_map_hdu : int\n        The hdu the poisson_noise_map is contained in the .fits file specified by *poisson_noise_map_path*.\n    pixel_scale : float\n        The size of each pixel in arc seconds.\n    convert_poisson_noise_map_from_weight_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_poisson_noise_map_from_inverse_noise_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    poisson_noise_map_from_image : bool\n        If True, the Poisson noise-map is estimated using the image.\n    image : ndarray\n        The image, which the Poisson noise-map can be calculated using.\n    background_noise_map : ndarray\n        The background noise-map, which the Poisson noise-map can be calculated using.\n    exposure_time_map : ndarray\n        The exposure-time map, which the Poisson noise-map can be calculated using.\n    convert_from_electrons : bool\n        If True, the input unblurred_image_1d are in units of electrons and all converted to electrons / second using the exposure \\\n        time map.\n    gain : float\n        The image gain, used for convert from ADUs.\n    convert_from_adus : bool\n        If True, the input unblurred_image_1d are in units of adus and all converted to electrons / second using the exposure \\\n        time map and gain.\n    \"\"\"\n    arg_11 = sum([arg_3,\n                                     arg_4,\n                                     arg_5])\n\n    if arg_11 == 0 and arg_0 is not None:\n        return PoissonNoiseMap.from_fits_with_pixel_scale(file_path=arg_0, hdu=arg_1,\n                                                          arg_2=arg_2)\n    elif arg_5:\n\n        if not (arg_8 or arg_10) and arg_7 is None:\n            raise exc.DataException('Cannot compute the Poisson noise-map from the image if an '\n                                       'exposure-time (or exposure time map) is not supplied to convert to adus')\n\n        if arg_10 and arg_9 is None:\n            raise exc.DataException('Cannot compute the Poisson noise-map from the image if a'\n                                       'gain is not supplied to convert from adus')\n\n        return PoissonNoiseMap.from_image_and_exposure_time_map(arg_2=arg_2, arg_6=arg_6,\n                                                                arg_7=arg_7,\n                                                                arg_8=arg_8,\n                                                                arg_9=arg_9,\n                                                                arg_10=arg_10)\n\n    elif arg_3 and arg_0 is not None:\n        arg_12 = Array.from_fits(file_path=arg_0, hdu=arg_1)\n        return PoissonNoiseMap.from_weight_map(arg_12=arg_12, arg_2=arg_2)\n    elif arg_4 and arg_0 is not None:\n        arg_13 = Array.from_fits(file_path=arg_0, hdu=arg_1)\n        return PoissonNoiseMap.from_inverse_noise_map(arg_13=arg_13, arg_2=arg_2)\n    else:\n        return None", "path": "autolens/data/ccd.py", "identifier": "load_poisson_noise_map", "docstring": "Factory for loading the Poisson noise-map from a .fits file.\n\n    This factory also includes a number of routines for converting the Poisson noise-map from from other units (e.g. \\\n    a weight map) or computing the Poisson noise_map from other unblurred_image_1d (e.g. the ccd image).\n\n    Parameters\n    ----------\n    poisson_noise_map_path : str\n        The path to the poisson_noise_map .fits file containing the Poisson noise-map \\\n         (e.g. '/path/to/poisson_noise_map.fits')\n    poisson_noise_map_hdu : int\n        The hdu the poisson_noise_map is contained in the .fits file specified by *poisson_noise_map_path*.\n    pixel_scale : float\n        The size of each pixel in arc seconds.\n    convert_poisson_noise_map_from_weight_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \\\n        *NoiseMap.from_weight_map).\n    convert_poisson_noise_map_from_inverse_noise_map : bool\n        If True, the Poisson noise-map loaded from the .fits file is converted from an inverse noise-map to a \\\n        noise-map (see *NoiseMap.from_inverse_noise_map).\n    poisson_noise_map_from_image : bool\n        If True, the Poisson noise-map is estimated using the image.\n    image : ndarray\n        The image, which the Poisson noise-map can be calculated using.\n    background_noise_map : ndarray\n        The background noise-map, which the Poisson noise-map can be calculated using.\n    exposure_time_map : ndarray\n        The exposure-time map, which the Poisson noise-map can be calculated using.\n    convert_from_electrons : bool\n        If True, the input unblurred_image_1d are in units of electrons and all converted to electrons / second using the exposure \\\n        time map.\n    gain : float\n        The image gain, used for convert from ADUs.\n    convert_from_adus : bool\n        If True, the input unblurred_image_1d are in units of adus and all converted to electrons / second using the exposure \\\n        time map and gain.", "docstring_tokens": ["Factory", "for", "loading", "the", "Poisson", "noise", "-", "map", "from", "a", ".", "fits", "file", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 258621}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/item.py#L85-L88", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns the items that this user has purchased or has pending.", "language": "python", "parameters": "(self)", "return_statement": "return self._items(status)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "commerce", ".", "Cart", ".", "STATUS_PAID", ",", "commerce", ".", "Cart", ".", "STATUS_ACTIVE", "]", "return", "arg_0", ".", "_items", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        ''' Returns the items that this user has purchased or has pending. '''\n        arg_1 = [commerce.Cart.STATUS_PAID, commerce.Cart.STATUS_ACTIVE]\n        return arg_0._items(arg_1)", "path": "registrasion/controllers/item.py", "identifier": "ItemController.items_pending_or_purchased", "docstring": "Returns the items that this user has purchased or has pending.", "docstring_tokens": ["Returns", "the", "items", "that", "this", "user", "has", "purchased", "or", "has", "pending", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 258622}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L962-L978", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Modify subfield at specified position.", "language": "python", "parameters": "(rec, tag, subfield_code, value, subfield_position,\n                           field_position_global=None,\n                           field_position_local=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "record_get_subfields", "(", "arg_0", ",", "arg_1", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "try", ":", "arg_7", "[", "arg_4", "]", "=", "(", "arg_2", ",", "arg_3", ")", "except", "IndexError", ":", "raise", "InvenioBibRecordFieldError", "(", "\"There is no subfield with position '%d'.\"", "%", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                           arg_5=None,\n                           arg_6=None):\n    \"\"\"Modify subfield at specified position.\n\n    Specify the subfield by tag, field number and subfield position.\n    \"\"\"\n    arg_7 = record_get_subfields(\n        arg_0, arg_1,\n        arg_5=arg_5,\n        arg_6=arg_6)\n\n    try:\n        arg_7[arg_4] = (arg_2, arg_3)\n    except IndexError:\n        raise InvenioBibRecordFieldError(\n            \"There is no subfield with position '%d'.\" % arg_4)", "path": "harvestingkit/bibrecord.py", "identifier": "record_modify_subfield", "docstring": "Modify subfield at specified position.\n\n    Specify the subfield by tag, field number and subfield position.", "docstring_tokens": ["Modify", "subfield", "at", "specified", "position", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 258623}
{"url": "https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/outstation.py#L155-L166", "sha": "5bcd8240d1fc0aa1579e71f2efcab63b4c61c547", "docstring_summary": "Return the application-controlled IIN field.", "language": "python", "parameters": "(self)", "return_statement": "return application_iin", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "opendnp3", ".", "ApplicationIIN", "(", ")", "arg_1", ".", "configCorrupt", "=", "False", "arg_1", ".", "deviceTrouble", "=", "False", "arg_1", ".", "localControl", "=", "False", "arg_1", ".", "needTime", "=", "False", "arg_6", "=", "arg_1", ".", "ToIIN", "(", ")", "_log", ".", "debug", "(", "'OutstationApplication.Func: IINField LSB={}, MSB={}'", ".", "format", "(", "arg_6", ".", "LSB", ",", "arg_6", ".", "MSB", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return the application-controlled IIN field.\"\"\"\n        arg_1 = opendnp3.ApplicationIIN()\n        arg_1.configCorrupt = False\n        arg_1.deviceTrouble = False\n        arg_1.localControl = False\n        arg_1.needTime = False\n        # Just for testing purposes, convert it to an IINField and display the contents of the two bytes.\n        arg_6 = arg_1.ToIIN()\n        _log.debug('OutstationApplication.Func: IINField LSB={}, MSB={}'.format(arg_6.LSB,\n                                                                                             arg_6.MSB))\n        return arg_1", "path": "examples/outstation.py", "identifier": "OutstationApplication.GetApplicationIIN", "docstring": "Return the application-controlled IIN field.", "docstring_tokens": ["Return", "the", "application", "-", "controlled", "IIN", "field", "."], "nwo": "ChargePoint/pydnp3", "score": 0.6403780379231505, "idx": 258624}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/roottree/BranchAddressManager.py#L23-L36", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "return the array.array objects for the branch and its counter branch", "language": "python", "parameters": "(self, tree, branchName)", "return_statement": "return itsArray, itsCountArray", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_getArray", "(", "arg_1", ",", "arg_2", ")", "if", "arg_3", "is", "None", ":", "return", "None", ",", "None", "arg_4", "=", "arg_0", ".", "_getCounterArray", "(", "arg_1", ",", "arg_2", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"return the array.array objects for the branch and its counter branch\n\n        This method returns a pair of the array.array objects. The first one is\n        for the given tree and branch name. The second one is for its counter\n        branch. The second one will be None when the branch does not have a\n        counter. A pair of None will be returned when the tree does not have\n        the branch.\n\n        \"\"\"\n        arg_3 = arg_0._getArray(arg_1, arg_2)\n        if arg_3 is None: return None, None\n        arg_4 = arg_0._getCounterArray(arg_1, arg_2)\n        return arg_3, arg_4", "path": "alphatwirl/roottree/BranchAddressManager.py", "identifier": "BranchAddressManager.getArrays", "docstring": "return the array.array objects for the branch and its counter branch\n\n        This method returns a pair of the array.array objects. The first one is\n        for the given tree and branch name. The second one is for its counter\n        branch. The second one will be None when the branch does not have a\n        counter. A pair of None will be returned when the tree does not have\n        the branch.", "docstring_tokens": ["return", "the", "array", ".", "array", "objects", "for", "the", "branch", "and", "its", "counter", "branch"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 258625}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/pca.py#L357-L383", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Plot pairwise distances between all samples", "language": "python", "parameters": "(self, labels=None, ax=None, cmap=None, cdict=None, metric=\"euclidean\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "\"euclidean\"", ")", ":", "arg_6", "=", "arg_0", ".", "genotypes", ".", "to_n_alt", "(", ")", "arg_7", "=", "allel", ".", "pairwise_distance", "(", "arg_6", ",", "arg_5", "=", "arg_5", ")", "if", "not", "arg_2", ":", "arg_8", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "5", ",", "5", ")", ")", "arg_2", "=", "arg_8", ".", "add_subplot", "(", "1", ",", "1", ",", "1", ")", "if", "isinstance", "(", "arg_1", ",", "bool", ")", ":", "if", "arg_1", ":", "arg_1", "=", "list", "(", "arg_0", ".", "samples_vcforder", ")", "elif", "isinstance", "(", "arg_1", ",", "type", "(", "None", ")", ")", ":", "pass", "else", ":", "if", "not", "len", "(", "arg_1", ")", "==", "len", "(", "arg_0", ".", "samples_vcforder", ")", ":", "raise", "IPyradError", "(", "LABELS_LENGTH_ERROR", ".", "format", "(", "len", "(", "arg_1", ")", ",", "len", "(", "arg_0", ".", "samples_vcforder", ")", ")", ")", "allel", ".", "plot", ".", "pairwise_distance", "(", "arg_7", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "colorbar", "=", "False", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=\"euclidean\"):\n        \"\"\"\n        Plot pairwise distances between all samples\n\n        labels: bool or list\n                by default labels aren't included. If labels == True, then labels are read in\n                from the vcf file. Alternatively, labels can be passed in as a list, should\n                be same length as the number of samples.\n        \"\"\"\n        arg_6 = arg_0.genotypes.to_n_alt()\n        arg_7 = allel.pairwise_distance(arg_6, arg_5=arg_5)\n        if not arg_2:\n            arg_8 = plt.figure(figsize=(5, 5))\n            arg_2 = arg_8.add_subplot(1, 1, 1)\n\n        if isinstance(arg_1, bool):\n            if arg_1:\n                arg_1 = list(arg_0.samples_vcforder)\n        elif isinstance(arg_1, type(None)):\n            pass\n        else:\n            ## If not bool or None (default), then check to make sure the list passed in\n            ## is the right length\n            if not len(arg_1) == len(arg_0.samples_vcforder):\n                raise IPyradError(LABELS_LENGTH_ERROR.format(len(arg_1), len(arg_0.samples_vcforder)))\n\n        allel.plot.pairwise_distance(arg_7, arg_1=arg_1, arg_2=arg_2, colorbar=False)", "path": "ipyrad/analysis/pca.py", "identifier": "PCA.plot_pairwise_dist", "docstring": "Plot pairwise distances between all samples\n\n        labels: bool or list\n                by default labels aren't included. If labels == True, then labels are read in\n                from the vcf file. Alternatively, labels can be passed in as a list, should\n                be same length as the number of samples.", "docstring_tokens": ["Plot", "pairwise", "distances", "between", "all", "samples"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258626}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/fluxcal.py#L181-L199", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Calculate f_ON, and f_OFF as defined in van Straten et al. 2012 equations 2 and 3", "language": "python", "parameters": "(calON_obs,calOFF_obs,chan_per_coarse,**kwargs)", "return_statement": "return f_ON, f_OFF", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "integrate_calib", "(", "arg_0", ",", "arg_2", ",", "**", "arg_3", ")", "arg_6", ",", "arg_7", "=", "integrate_calib", "(", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "arg_8", "=", "arg_5", "/", "arg_4", "-", "1", "arg_9", "=", "arg_7", "/", "arg_6", "-", "1", "return", "arg_8", ",", "arg_9"], "function": "def Func(arg_0,arg_1,arg_2,**arg_3):\n    '''\n    Calculate f_ON, and f_OFF as defined in van Straten et al. 2012 equations 2 and 3\n\n    Parameters\n    ----------\n    calON_obs : str\n        Path to filterbank file (any format) for observation ON the calibrator source\n    calOFF_obs : str\n        Path to filterbank file (any format) for observation OFF the calibrator source\n    '''\n    #Calculate noise diode ON and noise diode OFF spectra (H and L) for both observations\n    arg_4,arg_5 = integrate_calib(arg_0,arg_2,**arg_3)\n    arg_6,arg_7 = integrate_calib(arg_1,arg_2,**arg_3)\n\n    arg_8 = arg_5/arg_4-1\n    arg_9 = arg_7/arg_6-1\n\n    return arg_8, arg_9", "path": "blimpy/calib_utils/fluxcal.py", "identifier": "f_ratios", "docstring": "Calculate f_ON, and f_OFF as defined in van Straten et al. 2012 equations 2 and 3\n\n    Parameters\n    ----------\n    calON_obs : str\n        Path to filterbank file (any format) for observation ON the calibrator source\n    calOFF_obs : str\n        Path to filterbank file (any format) for observation OFF the calibrator source", "docstring_tokens": ["Calculate", "f_ON", "and", "f_OFF", "as", "defined", "in", "van", "Straten", "et", "al", ".", "2012", "equations", "2", "and", "3"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 258627}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/util/solver.py#L316-L360", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Add the absolute value of an expression to the model.", "language": "python", "parameters": "(model, expression, name=\"abs_var\", ub=None,\n                            difference=0, add=True)", "return_statement": "return to_add", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"abs_var\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "0", ",", "arg_5", "=", "True", ")", ":", "arg_6", "=", "namedtuple", "(", "'Components'", ",", "[", "'variable'", ",", "'upper_constraint'", ",", "'lower_constraint'", "]", ")", "arg_7", "=", "arg_0", ".", "problem", ".", "Variable", "(", "arg_2", ",", "lb", "=", "0", ",", "arg_3", "=", "arg_3", ")", "arg_8", "=", "arg_0", ".", "problem", ".", "Constraint", "(", "arg_1", "-", "arg_7", ",", "arg_3", "=", "arg_4", ",", "arg_2", "=", "\"abs_pos_\"", "+", "arg_2", ")", ",", "arg_9", "=", "arg_0", ".", "problem", ".", "Constraint", "(", "arg_1", "+", "arg_7", ",", "lb", "=", "arg_4", ",", "arg_2", "=", "\"abs_neg_\"", "+", "arg_2", ")", "arg_10", "=", "arg_6", "(", "arg_7", ",", "arg_8", ",", "arg_9", ")", "if", "arg_5", ":", "add_cons_vars_to_problem", "(", "arg_0", ",", "arg_10", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=\"abs_var\", arg_3=None,\n                            arg_4=0, arg_5=True):\n    \"\"\"Add the absolute value of an expression to the model.\n\n    Also defines a variable for the absolute value that can be used in other\n    objectives or constraints.\n\n    Parameters\n    ----------\n    model : a cobra model\n       The model to which to add the absolute expression.\n    expression : A sympy expression\n       Must be a valid expression within the Model's solver object. The\n       absolute value is applied automatically on the expression.\n    name : string\n       The name of the newly created variable.\n    ub : positive float\n       The upper bound for the variable.\n    difference : positive float\n        The difference between the expression and the variable.\n    add : bool\n        Whether to add the variable to the model at once.\n\n    Returns\n    -------\n    namedtuple\n        A named tuple with variable and two constraints (upper_constraint,\n        lower_constraint) describing the new variable and the constraints\n        that assign the absolute value of the expression to it.\n    \"\"\"\n    arg_6 = namedtuple('Components', ['variable', 'upper_constraint',\n                                           'lower_constraint'])\n    arg_7 = arg_0.problem.Variable(arg_2, lb=0, arg_3=arg_3)\n    # The following constraints enforce variable > expression and\n    # variable > -expression\n    arg_8 = arg_0.problem.Constraint(arg_1 - arg_7,\n                                                arg_3=arg_4,\n                                                arg_2=\"abs_pos_\" + arg_2),\n    arg_9 = arg_0.problem.Constraint(arg_1 + arg_7,\n                                                lb=arg_4,\n                                                arg_2=\"abs_neg_\" + arg_2)\n    arg_10 = arg_6(arg_7, arg_8, arg_9)\n    if arg_5:\n        add_cons_vars_to_problem(arg_0, arg_10)\n    return arg_10", "path": "cobra/util/solver.py", "identifier": "add_absolute_expression", "docstring": "Add the absolute value of an expression to the model.\n\n    Also defines a variable for the absolute value that can be used in other\n    objectives or constraints.\n\n    Parameters\n    ----------\n    model : a cobra model\n       The model to which to add the absolute expression.\n    expression : A sympy expression\n       Must be a valid expression within the Model's solver object. The\n       absolute value is applied automatically on the expression.\n    name : string\n       The name of the newly created variable.\n    ub : positive float\n       The upper bound for the variable.\n    difference : positive float\n        The difference between the expression and the variable.\n    add : bool\n        Whether to add the variable to the model at once.\n\n    Returns\n    -------\n    namedtuple\n        A named tuple with variable and two constraints (upper_constraint,\n        lower_constraint) describing the new variable and the constraints\n        that assign the absolute value of the expression to it.", "docstring_tokens": ["Add", "the", "absolute", "value", "of", "an", "expression", "to", "the", "model", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 258628}
{"url": "https://github.com/ausaki/python-validator/blob/a3e591b1eae6d7a70f894c203dbd7195f929baa8/validator/validator.py#L138-L157", "sha": "a3e591b1eae6d7a70f894c203dbd7195f929baa8", "docstring_summary": "create a Validator instance from data_struct_dict", "language": "python", "parameters": "(data_struct_dict, name=None)", "return_statement": "return type(name, (Validator, ), attrs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "'FromDictValidator'", "arg_2", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "six", ".", "iteritems", "(", "arg_0", ")", ":", "arg_5", "=", "arg_4", "[", "'type'", "]", "if", "arg_5", "==", "DictField", ".", "FIELD_TYPE_NAME", "and", "isinstance", "(", "arg_4", ".", "get", "(", "'validator'", ")", ",", "dict", ")", ":", "arg_4", "[", "'validator'", "]", "=", "Func", "(", "arg_4", "[", "'validator'", "]", ")", "arg_2", "[", "arg_3", "]", "=", "create_field", "(", "arg_4", ")", "arg_1", "=", "force_str", "(", "arg_1", ")", "return", "type", "(", "arg_1", ",", "(", "Validator", ",", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    create a Validator instance from data_struct_dict\n\n    :param data_struct_dict: a dict describe validator's fields, like the dict `to_dict()` method returned.\n    :param name: name of Validator class \n\n    :return: Validator instance\n    \"\"\"\n\n    if arg_1 is None:\n        arg_1 = 'FromDictValidator'\n    arg_2 = {}\n    for arg_3, arg_4 in six.iteritems(arg_0):\n        arg_5 = arg_4['type']\n        if arg_5 == DictField.FIELD_TYPE_NAME and isinstance(arg_4.get('validator'), dict):\n            arg_4['validator'] = Func(arg_4['validator'])\n        arg_2[arg_3] = create_field(arg_4)\n    arg_1 = force_str(arg_1)\n    return type(arg_1, (Validator, ), arg_2)", "path": "validator/validator.py", "identifier": "create_validator", "docstring": "create a Validator instance from data_struct_dict\n\n    :param data_struct_dict: a dict describe validator's fields, like the dict `to_dict()` method returned.\n    :param name: name of Validator class \n\n    :return: Validator instance", "docstring_tokens": ["create", "a", "Validator", "instance", "from", "data_struct_dict"], "nwo": "ausaki/python-validator", "score": 0.38108885787659336, "idx": 258629}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_function_hook.py#L161-L172", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Deletes the specified Cloud Function.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_conn", "(", ")", ".", "projects", "(", ")", ".", "locations", "(", ")", ".", "functions", "(", ")", ".", "delete", "(", "arg_1", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", "arg_3", "=", "arg_2", "[", "\"name\"", "]", "arg_0", ".", "_wait_for_operation_to_complete", "(", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Deletes the specified Cloud Function.\n\n        :param name: The name of the function.\n        :type name: str\n        :return: None\n        \"\"\"\n        arg_2 = arg_0.get_conn().projects().locations().functions().delete(\n            arg_1=arg_1).execute(num_retries=arg_0.num_retries)\n        arg_3 = arg_2[\"name\"]\n        arg_0._wait_for_operation_to_complete(arg_3=arg_3)", "path": "airflow/contrib/hooks/gcp_function_hook.py", "identifier": "GcfHook.delete_function", "docstring": "Deletes the specified Cloud Function.\n\n        :param name: The name of the function.\n        :type name: str\n        :return: None", "docstring_tokens": ["Deletes", "the", "specified", "Cloud", "Function", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258630}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/config.py#L137-L144", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Read configuration from the `env_var` environment variable.", "language": "python", "parameters": "(self, env_var)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "environ", ".", "get", "(", "arg_1", ",", "''", ")", "if", "arg_2", ":", "arg_0", ".", "timid", "=", "(", "'--timid'", "in", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read configuration from the `env_var` environment variable.\"\"\"\n        # Timidity: for nose users, read an environment variable.  This is a\n        # cheap hack, since the rest of the command line arguments aren't\n        # recognized, but it solves some users' problems.\n        arg_2 = os.environ.get(arg_1, '')\n        if arg_2:\n            arg_0.timid = ('--timid' in arg_2)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/config.py", "identifier": "CoverageConfig.from_environment", "docstring": "Read configuration from the `env_var` environment variable.", "docstring_tokens": ["Read", "configuration", "from", "the", "env_var", "environment", "variable", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258631}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L131-L135", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Add particles with diffusion coefficient `D` at random positions.", "language": "python", "parameters": "(self, num_particles, D)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_plist", "+=", "arg_0", ".", "_generate", "(", "arg_1", ",", "arg_2", ",", "box", "=", "arg_0", ".", "box", ",", "rs", "=", "arg_0", ".", "rs", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add particles with diffusion coefficient `D` at random positions.\n        \"\"\"\n        arg_0._plist += arg_0._generate(arg_1, arg_2, box=arg_0.box,\n                                      rs=arg_0.rs)", "path": "pybromo/diffusion.py", "identifier": "Particles.add", "docstring": "Add particles with diffusion coefficient `D` at random positions.", "docstring_tokens": ["Add", "particles", "with", "diffusion", "coefficient", "D", "at", "random", "positions", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 258632}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/html5.py#L46-L51", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Insert node as a child of the current node, before refNode in the\n        list of child nodes. Raises ValueError if refNode is not a child of\n        the current node", "language": "python", "parameters": "(self, node, refNode)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "xml_children", ".", "index", "(", "arg_2", ")", "arg_0", ".", "xml_insert", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Insert node as a child of the current node, before refNode in the\n        list of child nodes. Raises ValueError if refNode is not a child of\n        the current node\"\"\"\n        arg_3 = arg_0.xml_children.index(arg_2)\n        arg_0.xml_insert(arg_1, arg_3)", "path": "pylib/uxml/html5.py", "identifier": "node.insertBefore", "docstring": "Insert node as a child of the current node, before refNode in the\n        list of child nodes. Raises ValueError if refNode is not a child of\n        the current node", "docstring_tokens": ["Insert", "node", "as", "a", "child", "of", "the", "current", "node", "before", "refNode", "in", "the", "list", "of", "child", "nodes", ".", "Raises", "ValueError", "if", "refNode", "is", "not", "a", "child", "of", "the", "current", "node"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 258633}
{"url": "https://github.com/bkg/greenwich/blob/57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141/greenwich/geometry.py#L194-L201", "sha": "57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141", "docstring_summary": "Returns an OGR Geometry for this envelope.", "language": "python", "parameters": "(self)", "return_statement": "return polyg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ogr", ".", "Geometry", "(", "ogr", ".", "wkbLinearRing", ")", "for", "arg_2", "in", "arg_0", ".", "ll", ",", "arg_0", ".", "lr", ",", "arg_0", ".", "ur", ",", "arg_0", ".", "ul", ",", "arg_0", ".", "ll", ":", "arg_1", ".", "AddPoint_2D", "(", "*", "arg_2", ")", "arg_3", "=", "ogr", ".", "Geometry", "(", "ogr", ".", "wkbPolygon", ")", "arg_3", ".", "AddGeometryDirectly", "(", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Returns an OGR Geometry for this envelope.\"\"\"\n        arg_1 = ogr.Geometry(ogr.wkbLinearRing)\n        for arg_2 in arg_0.ll, arg_0.lr, arg_0.ur, arg_0.ul, arg_0.ll:\n            arg_1.AddPoint_2D(*arg_2)\n        arg_3 = ogr.Geometry(ogr.wkbPolygon)\n        arg_3.AddGeometryDirectly(arg_1)\n        return arg_3", "path": "greenwich/geometry.py", "identifier": "Envelope.polygon", "docstring": "Returns an OGR Geometry for this envelope.", "docstring_tokens": ["Returns", "an", "OGR", "Geometry", "for", "this", "envelope", "."], "nwo": "bkg/greenwich", "score": 0.15726537023232431, "idx": 258634}
{"url": "https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L67-L77", "sha": "5e464e1fc3ae9c7e216f6dd94f879a967d065247", "docstring_summary": "write triples into a translation file.", "language": "python", "parameters": "(translation_filename, entity_ids, relation_ids)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "triple_pb", ".", "Translation", "(", ")", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "items", "(", ")", ":", "arg_3", ".", "entities", ".", "add", "(", "element", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_7", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "arg_2", ".", "items", "(", ")", ":", "arg_3", ".", "relations", ".", "add", "(", "element", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "with", "open", "(", "arg_0", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_3", ".", "SerializeToString", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"write triples into a translation file.\"\"\"\n    arg_3 = triple_pb.Translation()\n    arg_4 = []\n    for arg_5, arg_6 in arg_1.items():\n        arg_3.entities.add(element=arg_5, arg_6=arg_6)\n    arg_7 = []\n    for arg_5, arg_6 in arg_2.items():\n        arg_3.relations.add(element=arg_5, arg_6=arg_6)\n    with open(arg_0, \"wb\") as f:\n        f.write(arg_3.SerializeToString())", "path": "kgekit/io.py", "identifier": "write_index_translation", "docstring": "write triples into a translation file.", "docstring_tokens": ["write", "triples", "into", "a", "translation", "file", "."], "nwo": "fantasticfears/kgekit", "score": 0.15726537023232431, "idx": 258635}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L136-L146", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Removes all breakpoints at a give filename and line number.\n        Returns a list of breakpoints numbers deleted.", "language": "python", "parameters": "(self, filename, lineno)", "return_statement": "return bpnums", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "(", "arg_1", ",", "arg_2", ")", "not", "in", "arg_0", ".", "bplist", ":", "return", "[", "]", "arg_3", "=", "arg_0", ".", "bplist", "[", "(", "arg_1", ",", "arg_2", ")", "]", "arg_4", "=", "[", "arg_5", ".", "number", "for", "arg_5", "in", "arg_3", "]", "for", "arg_5", "in", "list", "(", "arg_3", ")", ":", "arg_0", ".", "delete_breakpoint", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Removes all breakpoints at a give filename and line number.\n        Returns a list of breakpoints numbers deleted.\n        \"\"\"\n        if (arg_1, arg_2) not in arg_0.bplist:\n            return []\n        arg_3 = arg_0.bplist[(arg_1, arg_2)]\n        arg_4 = [arg_5.number for arg_5 in arg_3]\n        for arg_5 in list(arg_3):\n            arg_0.delete_breakpoint(arg_5)\n        return arg_4", "path": "trepan/lib/breakpoint.py", "identifier": "BreakpointManager.delete_breakpoints_by_lineno", "docstring": "Removes all breakpoints at a give filename and line number.\n        Returns a list of breakpoints numbers deleted.", "docstring_tokens": ["Removes", "all", "breakpoints", "at", "a", "give", "filename", "and", "line", "number", ".", "Returns", "a", "list", "of", "breakpoints", "numbers", "deleted", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 258636}
{"url": "https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/utils.py#L43-L61", "sha": "5e9e803c9131b377af305d5302723ba2415001da", "docstring_summary": "Unite data into a DataFrame.", "language": "python", "parameters": "(X)", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "pd", ".", "DataFrame", ")", ":", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_0", "=", "pd", ".", "DataFrame", "(", "arg_0", ")", "elif", "isinstance", "(", "arg_0", ",", "(", "np", ".", "generic", ",", "np", ".", "ndarray", ")", ")", ":", "arg_0", "=", "pd", ".", "DataFrame", "(", "arg_0", ")", "elif", "isinstance", "(", "arg_0", ",", "csr_matrix", ")", ":", "arg_0", "=", "pd", ".", "DataFrame", "(", "arg_0", ".", "todense", "(", ")", ")", "elif", "isinstance", "(", "arg_0", ",", "pd", ".", "Series", ")", ":", "arg_0", "=", "pd", ".", "DataFrame", "(", "arg_0", ")", "else", ":", "raise", "ValueError", "(", "'Unexpected input type: %s'", "%", "(", "str", "(", "type", "(", "arg_0", ")", ")", ")", ")", "arg_0", "=", "arg_0", ".", "apply", "(", "lambda", "x", ":", "pd", ".", "to_numeric", "(", "x", ",", "errors", "=", "'ignore'", ")", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"\n    Unite data into a DataFrame.\n    \"\"\"\n    if not isinstance(arg_0, pd.DataFrame):\n        if isinstance(arg_0, list):\n            arg_0 = pd.DataFrame(arg_0)\n        elif isinstance(arg_0, (np.generic, np.ndarray)):\n            arg_0 = pd.DataFrame(arg_0)\n        elif isinstance(arg_0, csr_matrix):\n            arg_0 = pd.DataFrame(arg_0.todense())\n        elif isinstance(arg_0, pd.Series):\n            arg_0 = pd.DataFrame(arg_0)\n        else:\n            raise ValueError('Unexpected input type: %s' % (str(type(arg_0))))\n\n        arg_0 = arg_0.apply(lambda x: pd.to_numeric(x, errors='ignore'))\n\n    return arg_0", "path": "category_encoders/utils.py", "identifier": "convert_input", "docstring": "Unite data into a DataFrame.", "docstring_tokens": ["Unite", "data", "into", "a", "DataFrame", "."], "nwo": "scikit-learn-contrib/categorical-encoding", "score": 0.948361178849178, "idx": 258637}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/create_key_pair.py#L139-L234", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the CreateKeyPair request payload and decode it\n        into its constituent parts.", "language": "python", "parameters": "(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "CreateKeyPairRequestPayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "COMMON_TEMPLATE_ATTRIBUTE", ",", "arg_6", ")", ":", "arg_0", ".", "_common_template_attribute", "=", "objects", ".", "TemplateAttribute", "(", "tag", "=", "arg_3", ".", "Tags", ".", "COMMON_TEMPLATE_ATTRIBUTE", ")", "arg_0", ".", "_common_template_attribute", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "COMMON_ATTRIBUTES", ",", "arg_6", ")", ":", "arg_8", "=", "objects", ".", "Attributes", "(", "tag", "=", "arg_3", ".", "Tags", ".", "COMMON_ATTRIBUTES", ")", "arg_8", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_common_template_attribute", "=", "objects", ".", "convert_attributes_to_template_attribute", "(", "arg_8", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_TEMPLATE_ATTRIBUTE", ",", "arg_6", ")", ":", "arg_0", ".", "_private_key_template_attribute", "=", "objects", ".", "TemplateAttribute", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_TEMPLATE_ATTRIBUTE", ")", "arg_0", ".", "_private_key_template_attribute", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_ATTRIBUTES", ",", "arg_6", ")", ":", "arg_8", "=", "objects", ".", "Attributes", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PRIVATE_KEY_ATTRIBUTES", ")", "arg_8", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_private_key_template_attribute", "=", "objects", ".", "convert_attributes_to_template_attribute", "(", "arg_8", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_TEMPLATE_ATTRIBUTE", ",", "arg_6", ")", ":", "arg_0", ".", "_public_key_template_attribute", "=", "objects", ".", "TemplateAttribute", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_TEMPLATE_ATTRIBUTE", ")", "arg_0", ".", "_public_key_template_attribute", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_ATTRIBUTES", ",", "arg_6", ")", ":", "arg_8", "=", "objects", ".", "Attributes", "(", "tag", "=", "arg_3", ".", "Tags", ".", "PUBLIC_KEY_ATTRIBUTES", ")", "arg_8", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_public_key_template_attribute", "=", "objects", ".", "convert_attributes_to_template_attribute", "(", "arg_8", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the CreateKeyPair request payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data buffer containing encoded object\n                data, supporting a Func method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        super(CreateKeyPairRequestPayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            if arg_0.is_tag_next(\n                    arg_3.Tags.COMMON_TEMPLATE_ATTRIBUTE,\n                    arg_6\n            ):\n                arg_0._common_template_attribute = objects.TemplateAttribute(\n                    tag=arg_3.Tags.COMMON_TEMPLATE_ATTRIBUTE\n                )\n                arg_0._common_template_attribute.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n        else:\n            if arg_0.is_tag_next(arg_3.Tags.COMMON_ATTRIBUTES, arg_6):\n                arg_8 = objects.Attributes(\n                    tag=arg_3.Tags.COMMON_ATTRIBUTES\n                )\n                arg_8.Func(arg_6, arg_2=arg_2)\n                arg_0._common_template_attribute = \\\n                    objects.convert_attributes_to_template_attribute(\n                        arg_8\n                    )\n\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            if arg_0.is_tag_next(\n                    arg_3.Tags.PRIVATE_KEY_TEMPLATE_ATTRIBUTE,\n                    arg_6\n            ):\n                arg_0._private_key_template_attribute = \\\n                    objects.TemplateAttribute(\n                        tag=arg_3.Tags.PRIVATE_KEY_TEMPLATE_ATTRIBUTE\n                    )\n                arg_0._private_key_template_attribute.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n        else:\n            if arg_0.is_tag_next(\n                    arg_3.Tags.PRIVATE_KEY_ATTRIBUTES,\n                    arg_6\n            ):\n                arg_8 = objects.Attributes(\n                    tag=arg_3.Tags.PRIVATE_KEY_ATTRIBUTES\n                )\n                arg_8.Func(arg_6, arg_2=arg_2)\n                arg_0._private_key_template_attribute = \\\n                    objects.convert_attributes_to_template_attribute(\n                        arg_8\n                    )\n\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            if arg_0.is_tag_next(\n                    arg_3.Tags.PUBLIC_KEY_TEMPLATE_ATTRIBUTE,\n                    arg_6\n            ):\n                arg_0._public_key_template_attribute = \\\n                    objects.TemplateAttribute(\n                        tag=arg_3.Tags.PUBLIC_KEY_TEMPLATE_ATTRIBUTE\n                    )\n                arg_0._public_key_template_attribute.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n        else:\n            if arg_0.is_tag_next(\n                    arg_3.Tags.PUBLIC_KEY_ATTRIBUTES,\n                    arg_6\n            ):\n                arg_8 = objects.Attributes(\n                    tag=arg_3.Tags.PUBLIC_KEY_ATTRIBUTES\n                )\n                arg_8.Func(arg_6, arg_2=arg_2)\n                arg_0._public_key_template_attribute = \\\n                    objects.convert_attributes_to_template_attribute(\n                        arg_8\n                    )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/create_key_pair.py", "identifier": "CreateKeyPairRequestPayload.read", "docstring": "Read the data encoding the CreateKeyPair request payload and decode it\n        into its constituent parts.\n\n        Args:\n            input_buffer (stream): A data buffer containing encoded object\n                data, supporting a read method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "CreateKeyPair", "request", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 258638}
{"url": "https://github.com/neon-jungle/wagtailmodelchooser/blob/8dd1e33dd61418a726ff3acf67a956626c8b7ba1/wagtailmodelchooser/__init__.py#L16-L22", "sha": "8dd1e33dd61418a726ff3acf67a956626c8b7ba1", "docstring_summary": "Adds a model chooser definition to the registry.", "language": "python", "parameters": "(self, chooser, **kwargs)", "return_statement": "return chooser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "not", "issubclass", "(", "arg_1", ",", "Chooser", ")", ":", "return", "arg_0", ".", "register_simple_chooser", "(", "arg_1", ",", "**", "arg_2", ")", "arg_0", ".", "choosers", "[", "arg_1", ".", "model", "]", "=", "arg_1", "(", "**", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Adds a model chooser definition to the registry.\"\"\"\n        if not issubclass(arg_1, Chooser):\n            return arg_0.register_simple_chooser(arg_1, **arg_2)\n\n        arg_0.choosers[arg_1.model] = arg_1(**arg_2)\n        return arg_1", "path": "wagtailmodelchooser/__init__.py", "identifier": "Registry.register_chooser", "docstring": "Adds a model chooser definition to the registry.", "docstring_tokens": ["Adds", "a", "model", "chooser", "definition", "to", "the", "registry", "."], "nwo": "neon-jungle/wagtailmodelchooser", "score": 0.5155075947839176, "idx": 258639}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/reports/base.py#L64-L75", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Writes the specified string to the output target of the report.", "language": "python", "parameters": "(self, msg, newline=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "click", ".", "echo", "(", "text_type", "(", "arg_1", ")", ",", "nl", "=", "arg_2", ",", "file", "=", "arg_0", ".", "Func_file", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Writes the specified string to the Func target of the report.\n\n        :param msg: the message to Func.\n        :type msg: str\n        :param newline:\n            whether or not to append a newline to the end of the message\n        :type newline: str\n        \"\"\"\n\n        click.echo(text_type(arg_1), nl=arg_2, file=arg_0.Func_file)", "path": "src/tidypy/reports/base.py", "identifier": "Report.output", "docstring": "Writes the specified string to the output target of the report.\n\n        :param msg: the message to output.\n        :type msg: str\n        :param newline:\n            whether or not to append a newline to the end of the message\n        :type newline: str", "docstring_tokens": ["Writes", "the", "specified", "string", "to", "the", "output", "target", "of", "the", "report", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 258640}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/topology.py#L363-L368", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Add a spout to the topology", "language": "python", "parameters": "(self, name, spout_cls, par, config=None, optional_outputs=None)", "return_statement": "return spout_spec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_2", ".", "spec", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_0", ".", "add_spec", "(", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None):\n    \"\"\"Add a spout to the topology\"\"\"\n    arg_6 = arg_2.spec(arg_1=arg_1, arg_3=arg_3, arg_4=arg_4,\n                                arg_5=arg_5)\n    arg_0.add_spec(arg_6)\n    return arg_6", "path": "heronpy/api/topology.py", "identifier": "TopologyBuilder.add_spout", "docstring": "Add a spout to the topology", "docstring_tokens": ["Add", "a", "spout", "to", "the", "topology"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258641}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/datastore_hook.py#L170-L189", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Run a query for entities.", "language": "python", "parameters": "(self, body)", "return_statement": "return resp['batch']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_conn", "(", ")", "arg_3", "=", "(", "arg_2", ".", "projects", "(", ")", ".", "runQuery", "(", "projectId", "=", "arg_0", ".", "project_id", ",", "arg_1", "=", "arg_1", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", ")", "return", "arg_3", "[", "'batch'", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Run a query for entities.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/rest/v1/projects/runQuery\n\n        :param body: the body of the query request.\n        :type body: dict\n        :return: the batch of query results.\n        :rtype: dict\n        \"\"\"\n        arg_2 = arg_0.get_conn()\n\n        arg_3 = (arg_2\n                .projects()\n                .runQuery(projectId=arg_0.project_id, arg_1=arg_1)\n                .execute(num_retries=arg_0.num_retries))\n\n        return arg_3['batch']", "path": "airflow/contrib/hooks/datastore_hook.py", "identifier": "DatastoreHook.run_query", "docstring": "Run a query for entities.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/rest/v1/projects/runQuery\n\n        :param body: the body of the query request.\n        :type body: dict\n        :return: the batch of query results.\n        :rtype: dict", "docstring_tokens": ["Run", "a", "query", "for", "entities", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258642}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L1019-L1051", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "Runs the review process for all the launchers.", "language": "python", "parameters": "(self, launchers)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "launch_args", "is", "not", "None", ":", "arg_2", "=", "arg_0", ".", "review_args", "(", "arg_0", ".", "launch_args", ",", "show_repr", "=", "True", ",", "heading", "=", "'Meta Arguments'", ")", "if", "not", "arg_2", ":", "return", "False", "arg_3", "=", "[", "arg_0", ".", "review_args", ",", "arg_0", ".", "review_command", ",", "arg_0", ".", "review_launcher", "]", "for", "(", "arg_4", ",", "arg_5", ")", "in", "enumerate", "(", "arg_1", ")", ":", "if", "not", "all", "(", "arg_6", "(", "arg_5", ")", "for", "arg_6", "in", "arg_3", ")", ":", "print", "(", "\"\\n == Aborting launch ==\"", ")", "return", "False", "if", "len", "(", "arg_1", ")", "!=", "1", "and", "arg_4", "<", "len", "(", "arg_1", ")", "-", "1", ":", "arg_7", "=", "arg_0", ".", "input_options", "(", "[", "'Y'", ",", "'n'", ",", "'quit'", "]", ",", "'\\nSkip remaining reviews?'", ",", "default", "=", "'y'", ")", "if", "arg_7", "==", "'y'", ":", "break", "elif", "arg_7", "==", "'quit'", ":", "return", "False", "if", "arg_0", ".", "input_options", "(", "[", "'y'", ",", "'N'", "]", ",", "'Execute?'", ",", "default", "=", "'n'", ")", "!=", "'y'", ":", "return", "False", "else", ":", "return", "arg_0", ".", "_launch_all", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Runs the review process for all the launchers.\n        \"\"\"\n        # Run review of launch args if necessary\n        if arg_0.launch_args is not None:\n            arg_2 = arg_0.review_args(arg_0.launch_args,\n                                       show_repr=True,\n                                       heading='Meta Arguments')\n            if not arg_2: return False\n\n        arg_3 = [arg_0.review_args,\n                     arg_0.review_command,\n                     arg_0.review_launcher]\n\n        for (arg_4, arg_5) in enumerate(arg_1):\n\n            # Run reviews for all launchers if desired...\n            if not all(arg_6(arg_5) for arg_6 in arg_3):\n                print(\"\\n == Aborting launch ==\")\n                return False\n            # But allow the user to skip these extra reviews\n            if len(arg_1)!= 1 and arg_4 < len(arg_1)-1:\n                arg_7 = arg_0.input_options(['Y', 'n','quit'],\n                                 '\\nSkip remaining reviews?', default='y')\n\n                if arg_7 == 'y':          break\n                elif arg_7 == 'quit':     return False\n\n        if arg_0.input_options(['y','N'], 'Execute?', default='n') != 'y':\n            return False\n        else:\n            return arg_0._launch_all(arg_1)", "path": "lancet/launch.py", "identifier": "review_and_launch._review_all", "docstring": "Runs the review process for all the launchers.", "docstring_tokens": ["Runs", "the", "review", "process", "for", "all", "the", "launchers", "."], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 258643}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L2408-L2435", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Optimization of a state along a specific set of directions in parameter\n    space.", "language": "python", "parameters": "(s, directions, max_iter=2, run_length=2,\n        damping=1e-3, collect_stats=False, marquardt_damping=True, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2", ",", "arg_3", "=", "2", ",", "arg_4", "=", "1e-3", ",", "arg_5", "=", "False", ",", "arg_6", "=", "True", ",", "**", "arg_7", ")", ":", "arg_8", "=", "np", ".", "array", "(", "[", "d", "/", "np", ".", "sqrt", "(", "np", ".", "dot", "(", "d", ",", "d", ")", ")", "for", "d", "in", "arg_1", "]", ")", "if", "np", ".", "isnan", "(", "arg_8", ")", ".", "any", "(", ")", ":", "raise", "ValueError", "(", "'`directions` must not be 0s or contain nan'", ")", "arg_9", "=", "OptState", "(", "arg_0", ",", "arg_8", ")", "arg_10", "=", "LMOptObj", "(", "arg_9", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ",", "**", "arg_7", ")", "arg_10", ".", "do_run_1", "(", ")", "if", "arg_5", ":", "return", "arg_10", ".", "get_termination_stats", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=2, arg_3=2,\n        arg_4=1e-3, arg_5=False, arg_6=True, **arg_7):\n    \"\"\"\n    Optimization of a state along a specific set of directions in parameter\n    space.\n\n    Parameters\n    ----------\n        s : :class:`peri.states.State`\n            The state to optimize\n        directions : np.ndarray\n            [n,d] element numpy.ndarray of the n directions in the d-\n            dimensional space to optimize along. `directions` is trans-\n            formed to a unit vector internally\n    Other Parameters\n    ----------------\n        Any parameters passed to LMEngine.\n    \"\"\"\n    # normal = direction / np.sqrt(np.dot(direction, direction))\n    arg_8 = np.array([d/np.sqrt(np.dot(d,d)) for d in arg_1])\n    if np.isnan(arg_8).any():\n        raise ValueError('`directions` must not be 0s or contain nan')\n    arg_9 = OptState(arg_0, arg_8)\n    arg_10 = LMOptObj(arg_9, arg_2=arg_2, arg_3=arg_3, arg_4=\n            arg_4, arg_6=arg_6, **arg_7)\n    arg_10.do_run_1()\n    if arg_5:\n        return arg_10.get_termination_stats()", "path": "peri/opt/optimize.py", "identifier": "do_levmarq_n_directions", "docstring": "Optimization of a state along a specific set of directions in parameter\n    space.\n\n    Parameters\n    ----------\n        s : :class:`peri.states.State`\n            The state to optimize\n        directions : np.ndarray\n            [n,d] element numpy.ndarray of the n directions in the d-\n            dimensional space to optimize along. `directions` is trans-\n            formed to a unit vector internally\n    Other Parameters\n    ----------------\n        Any parameters passed to LMEngine.", "docstring_tokens": ["Optimization", "of", "a", "state", "along", "a", "specific", "set", "of", "directions", "in", "parameter", "space", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 258644}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L341-L417", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "call all sites in a locus array.", "language": "python", "parameters": "(arrayed, mindepth_majrule, mindepth_statistical, estH, estE)", "return_statement": "return cons.view(\"S1\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "np", ".", "zeros", "(", "arg_0", ".", "shape", "[", "1", "]", ",", "dtype", "=", "np", ".", "uint8", ")", "arg_5", ".", "fill", "(", "78", ")", "arg_6", "=", "arg_0", ".", "view", "(", "np", ".", "uint8", ")", "for", "arg_7", "in", "xrange", "(", "arg_6", ".", "shape", "[", "1", "]", ")", ":", "arg_8", "=", "arg_6", "[", ":", ",", "arg_7", "]", "arg_9", "=", "arg_8", "==", "45", "arg_9", "+=", "arg_8", "==", "78", "arg_10", "=", "arg_8", "[", "~", "arg_9", "]", "if", "not", "arg_10", ".", "shape", "[", "0", "]", ":", "arg_5", "[", "arg_7", "]", "=", "78", "elif", "np", ".", "all", "(", "arg_10", "==", "arg_10", "[", "0", "]", ")", ":", "arg_5", "[", "arg_7", "]", "=", "arg_10", "[", "0", "]", "else", ":", "arg_11", "=", "np", ".", "bincount", "(", "arg_10", ")", "arg_12", "=", "np", ".", "argmax", "(", "arg_11", ")", "arg_13", "=", "arg_11", "[", "arg_12", "]", "arg_11", "[", "arg_12", "]", "=", "0", "arg_14", "=", "np", ".", "argmax", "(", "arg_11", ")", "arg_15", "=", "arg_11", "[", "arg_14", "]", "arg_11", "[", "arg_14", "]", "=", "0", "arg_16", "=", "np", ".", "argmax", "(", "arg_11", ")", "arg_17", "=", "arg_11", "[", "arg_16", "]", "arg_18", "=", "arg_13", "+", "arg_15", "if", "arg_18", "<", "arg_1", ":", "arg_5", "[", "arg_7", "]", "=", "78", "else", ":", "if", "arg_18", ">", "500", ":", "arg_19", "=", "int", "(", "500", "*", "(", "arg_13", "/", "float", "(", "arg_18", ")", ")", ")", "arg_20", "=", "int", "(", "500", "*", "(", "arg_15", "/", "float", "(", "arg_18", ")", ")", ")", "else", ":", "arg_19", "=", "arg_13", "arg_20", "=", "arg_15", "if", "arg_18", ">=", "arg_2", ":", "arg_21", ",", "arg_22", "=", "get_binom", "(", "arg_19", ",", "arg_20", ",", "arg_4", ",", "arg_3", ")", "if", "arg_22", "<", "0.95", ":", "arg_5", "[", "arg_7", "]", "=", "78", "else", ":", "if", "arg_21", ":", "arg_5", "[", "arg_7", "]", "=", "TRANS", "[", "(", "arg_12", ",", "arg_14", ")", "]", "else", ":", "arg_5", "[", "arg_7", "]", "=", "arg_12", "else", ":", "if", "arg_13", "==", "arg_15", ":", "arg_5", "[", "arg_7", "]", "=", "TRANS", "[", "(", "arg_12", ",", "arg_14", ")", "]", "else", ":", "arg_5", "[", "arg_7", "]", "=", "arg_12", "return", "arg_5", ".", "view", "(", "\"S1\"", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    call all sites in a locus array.\n    \"\"\"\n\n    ## an array to fill with consensus site calls\n    arg_5 = np.zeros(arg_0.shape[1], dtype=np.uint8)\n    arg_5.fill(78)\n    arg_6 = arg_0.view(np.uint8)\n    \n    ## iterate over columns\n    for arg_7 in xrange(arg_6.shape[1]):\n        ## the site of focus\n        arg_8 = arg_6[:, arg_7]\n        \n        ## make mask of N and - sites\n        arg_9 = arg_8 == 45\n        arg_9 += arg_8 == 78        \n        arg_10 = arg_8[~arg_9]\n        \n        ## skip if only empties (e.g., N-)\n        if not arg_10.shape[0]:\n            arg_5[arg_7] = 78\n        \n        ## skip if not variable\n        elif np.all(arg_10 == arg_10[0]):\n            arg_5[arg_7] = arg_10[0]\n        \n        ## estimate variable site call\n        else:\n            ## get allele freqs (first-most, second, third = p, q, r)\n            arg_11 = np.bincount(arg_10)\n            \n            arg_12 = np.argmax(arg_11)\n            arg_13 = arg_11[arg_12]\n            arg_11[arg_12] = 0\n\n            arg_14 = np.argmax(arg_11)\n            arg_15 = arg_11[arg_14]\n            arg_11[arg_14] = 0\n\n            arg_16 = np.argmax(arg_11)\n            arg_17 = arg_11[arg_16]\n            \n            ## based on biallelic depth\n            arg_18 = arg_13 + arg_15 \n            if arg_18 < arg_1:\n                arg_5[arg_7] = 78\n            \n            else:\n                ## if depth is too high, reduce to sampled int\n                if arg_18 > 500:\n                    arg_19 = int(500 * (arg_13 / float(arg_18)))\n                    arg_20 = int(500 * (arg_15 / float(arg_18)))\n                else:\n                    arg_19 = arg_13\n                    arg_20 = arg_15\n\n                ## make statistical base call  \n                if arg_18 >= arg_2:\n                    arg_21, arg_22 = get_binom(arg_19, arg_20, arg_4, arg_3)\n                    #LOGGER.info(\"ishet, prob, b1, b2: %s %s %s %s\", ishet, prob, base1, base2)\n                    if arg_22 < 0.95:\n                        arg_5[arg_7] = 78\n                    else:\n                        if arg_21:\n                            arg_5[arg_7] = TRANS[(arg_12, arg_14)]\n                        else:\n                            arg_5[arg_7] = arg_12\n                \n                ## make majrule base call\n                else: #if bidepth >= mindepth_majrule:\n                    if arg_13 == arg_15:\n                        arg_5[arg_7] = TRANS[(arg_12, arg_14)]\n                    else:\n                        arg_5[arg_7] = arg_12\n    return arg_5.view(\"S1\")", "path": "ipyrad/assemble/consens_se.py", "identifier": "basecaller", "docstring": "call all sites in a locus array.", "docstring_tokens": ["call", "all", "sites", "in", "a", "locus", "array", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258645}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L368-L380", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "formats and sends a chunk of data to the device according\n        to transfer protocol", "language": "python", "parameters": "(self, chunk)", "return_statement": "return self.__got_ack()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "debug", "(", "'writing %d bytes chunk'", ",", "len", "(", "arg_1", ")", ")", "arg_2", "=", "BLOCK_START", "+", "chr", "(", "len", "(", "arg_1", ")", ")", "+", "arg_1", "if", "len", "(", "arg_1", ")", "<", "128", ":", "arg_3", "=", "128", "-", "len", "(", "arg_1", ")", "log", ".", "debug", "(", "'pad with %d characters'", ",", "arg_3", ")", "arg_2", "=", "arg_2", "+", "(", "' '", "*", "arg_3", ")", "log", ".", "debug", "(", "\"packet size %d\"", ",", "len", "(", "arg_2", ")", ")", "arg_0", ".", "__write", "(", "arg_2", ")", "arg_0", ".", "_port", ".", "flush", "(", ")", "return", "arg_0", ".", "__got_ack", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"formats and sends a chunk of data to the device according\n        to transfer protocol\"\"\"\n        log.debug('writing %d bytes chunk', len(arg_1))\n        arg_2 = BLOCK_START + chr(len(arg_1)) + arg_1\n        if len(arg_1) < 128:\n            arg_3 = 128 - len(arg_1)\n            log.debug('pad with %d characters', arg_3)\n            arg_2 = arg_2 + (' ' * arg_3)\n        log.debug(\"packet size %d\", len(arg_2))\n        arg_0.__write(arg_2)\n        arg_0._port.flush()\n        return arg_0.__got_ack()", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.__write_chunk", "docstring": "formats and sends a chunk of data to the device according\n        to transfer protocol", "docstring_tokens": ["formats", "and", "sends", "a", "chunk", "of", "data", "to", "the", "device", "according", "to", "transfer", "protocol"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 258646}
{"url": "https://github.com/Yubico/python-u2flib-host/blob/eadc4dbf3bf516e74ea00d2e5690742a535834cb/u2flib_host/u2f_v2.py#L81-L126", "sha": "eadc4dbf3bf516e74ea00d2e5690742a535834cb", "docstring_summary": "Signs an authentication challenge", "language": "python", "parameters": "(device, data, facet, check_only=False)", "return_statement": "return {\n        'clientData': websafe_encode(client_data),\n        'signatureData': websafe_encode(response),\n        'keyHandle': data['keyHandle']\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_1", ")", "if", "arg_1", "[", "'version'", "]", "!=", "VERSION", ":", "raise", "ValueError", "(", "'Unsupported U2F version: %s'", "%", "arg_1", "[", "'version'", "]", ")", "arg_4", "=", "arg_1", ".", "get", "(", "'appId'", ",", "arg_2", ")", "verify_facet", "(", "arg_4", ",", "arg_2", ")", "arg_5", "=", "sha256", "(", "arg_4", ".", "encode", "(", "'utf8'", ")", ")", ".", "digest", "(", ")", "arg_6", "=", "websafe_decode", "(", "arg_1", "[", "'keyHandle'", "]", ")", "arg_7", "=", "{", "'typ'", ":", "'navigator.id.getAssertion'", ",", "'challenge'", ":", "arg_1", "[", "'challenge'", "]", ",", "'origin'", ":", "arg_2", "}", "arg_7", "=", "json", ".", "dumps", "(", "arg_7", ")", "arg_8", "=", "sha256", "(", "arg_7", ".", "encode", "(", "'utf8'", ")", ")", ".", "digest", "(", ")", "arg_9", "=", "arg_8", "+", "arg_5", "+", "int2byte", "(", "len", "(", "arg_6", ")", ")", "+", "arg_6", "arg_10", "=", "0x07", "if", "arg_3", "else", "0x03", "arg_11", "=", "0", "arg_12", "=", "arg_0", ".", "send_apdu", "(", "INS_SIGN", ",", "arg_10", ",", "arg_11", ",", "arg_9", ")", "return", "{", "'clientData'", ":", "websafe_encode", "(", "arg_7", ")", ",", "'signatureData'", ":", "websafe_encode", "(", "arg_12", ")", ",", "'keyHandle'", ":", "arg_1", "[", "'keyHandle'", "]", "}"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\"\n    Signs an authentication challenge\n\n    data = {\n        'version': \"U2F_V2\",\n        'challenge': websafe_encode(self.challenge),\n        'appId': self.binding.app_id,\n        'keyHandle': websafe_encode(self.binding.key_handle)\n    }\n\n    \"\"\"\n\n    if isinstance(arg_1, string_types):\n        arg_1 = json.loads(arg_1)\n\n    if arg_1['version'] != VERSION:\n        raise ValueError('Unsupported U2F version: %s' % arg_1['version'])\n\n    arg_4 = arg_1.get('appId', arg_2)\n    verify_facet(arg_4, arg_2)\n    arg_5 = sha256(arg_4.encode('utf8')).digest()\n\n    arg_6 = websafe_decode(arg_1['keyHandle'])\n\n    # Client data\n    arg_7 = {\n        'typ': 'navigator.id.getAssertion',\n        'challenge': arg_1['challenge'],\n        'origin': arg_2\n    }\n    arg_7 = json.dumps(arg_7)\n    arg_8 = sha256(arg_7.encode('utf8')).digest()\n\n    arg_9 = arg_8 + arg_5 + int2byte(\n        len(arg_6)) + arg_6\n\n    arg_10 = 0x07 if arg_3 else 0x03\n    arg_11 = 0\n    arg_12 = arg_0.send_apdu(INS_SIGN, arg_10, arg_11, arg_9)\n\n    return {\n        'clientData': websafe_encode(arg_7),\n        'signatureData': websafe_encode(arg_12),\n        'keyHandle': arg_1['keyHandle']\n    }", "path": "u2flib_host/u2f_v2.py", "identifier": "authenticate", "docstring": "Signs an authentication challenge\n\n    data = {\n        'version': \"U2F_V2\",\n        'challenge': websafe_encode(self.challenge),\n        'appId': self.binding.app_id,\n        'keyHandle': websafe_encode(self.binding.key_handle)\n    }", "docstring_tokens": ["Signs", "an", "authentication", "challenge"], "nwo": "Yubico/python-u2flib-host", "score": 0.37487477839678873, "idx": 258647}
{"url": "https://github.com/snowplow/snowplow-python-analytics-sdk/blob/0ddca91e3f6d8bed88627fa557790aa4868bdace/snowplow_analytics_sdk/run_manifests.py#L198-L209", "sha": "0ddca91e3f6d8bed88627fa557790aa4868bdace", "docstring_summary": "Remove all keys with Nones as values", "language": "python", "parameters": "(dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "return", "{", "arg_1", ":", "arg_2", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "iteritems", "(", ")", "if", "arg_2", "is", "not", "None", "}", "else", ":", "return", "{", "arg_1", ":", "arg_2", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", "if", "arg_2", "is", "not", "None", "}"], "function": "def Func(arg_0):\n    \"\"\"Remove all keys with Nones as values\n\n    >>> Func({'key': None})\n    {}\n    >>> Func({'empty_s': ''})\n    {'empty_s': ''}\n    \"\"\"\n    if sys.version_info[0] < 3:\n        return {arg_1: arg_2 for arg_1, arg_2 in arg_0.iteritems() if arg_2 is not None}\n    else:\n        return {arg_1: arg_2 for arg_1, arg_2 in arg_0.items() if arg_2 is not None}", "path": "snowplow_analytics_sdk/run_manifests.py", "identifier": "clean_dict", "docstring": "Remove all keys with Nones as values\n\n    >>> clean_dict({'key': None})\n    {}\n    >>> clean_dict({'empty_s': ''})\n    {'empty_s': ''}", "docstring_tokens": ["Remove", "all", "keys", "with", "Nones", "as", "values"], "nwo": "snowplow/snowplow-python-analytics-sdk", "score": 0.2855681421870085, "idx": 258648}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/codecs.py#L61-L78", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Returns information used by the codecs library to configure the\n        codec for use.", "language": "python", "parameters": "(cls)", "return_statement": "return CodecInfo(**codec_info)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "(", ")", "arg_2", "=", "{", "'encode'", ":", "arg_1", ".", "encode", ",", "'decode'", ":", "arg_1", ".", "decode", ",", "}", "if", "PY3", ":", "arg_2", "[", "'_is_text_encoding'", "]", "=", "False", "return", "CodecInfo", "(", "**", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns information used by the codecs library to configure the\n        codec for use.\n        \"\"\"\n        arg_1 = arg_0()\n\n        arg_2 = {\n            'encode': arg_1.encode,\n            'decode': arg_1.decode,\n        }\n\n        # In Python 2, all codecs are made equal.\n        # In Python 3, some codecs are more equal than others.\n        if PY3:\n            arg_2['_is_text_encoding'] = False\n\n        return CodecInfo(**arg_2)", "path": "iota/codecs.py", "identifier": "AsciiTrytesCodec.get_codec_info", "docstring": "Returns information used by the codecs library to configure the\n        codec for use.", "docstring_tokens": ["Returns", "information", "used", "by", "the", "codecs", "library", "to", "configure", "the", "codec", "for", "use", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 258649}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/commands.py#L74-L89", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Calls the command", "language": "python", "parameters": "(cmd_args)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "subprocess", ".", "Popen", "(", "arg_0", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "(", "arg_2", ",", "arg_3", ")", "=", "arg_1", ".", "communicate", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Calls the command\n\n    Parameters\n    ----------\n    cmd_args: list of str\n        Command name to call and its arguments in a list.\n\n    Returns\n    -------\n    Command output\n    \"\"\"\n    arg_1 = subprocess.Popen(arg_0, stdout=subprocess.PIPE)\n    (arg_2, arg_3) = arg_1.communicate()\n    return arg_2", "path": "boyle/commands.py", "identifier": "check_call", "docstring": "Calls the command\n\n    Parameters\n    ----------\n    cmd_args: list of str\n        Command name to call and its arguments in a list.\n\n    Returns\n    -------\n    Command output", "docstring_tokens": ["Calls", "the", "command"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258650}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/livecode.py#L66-L74", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Replace functions in namespace with functions from edited_source.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "LiveExecution", ".", "lock", ":", "if", "arg_0", ".", "edited_source", ":", "arg_1", "=", "ast", ".", "parse", "(", "arg_0", ".", "edited_source", ")", "for", "arg_2", "in", "[", "n", "for", "n", "in", "ast", ".", "walk", "(", "arg_1", ")", "if", "isinstance", "(", "n", ",", "ast", ".", "FunctionDef", ")", "]", ":", "arg_0", ".", "ns", "[", "arg_2", ".", "name", "]", ".", "__code__", "=", "meta", ".", "decompiler", ".", "compile_func", "(", "arg_2", ",", "arg_0", ".", "filename", ",", "arg_0", ".", "ns", ")", ".", "__code__"], "function": "def Func(arg_0):\n        \"\"\"\n        Replace functions in namespace with functions from edited_source.\n        \"\"\"\n        with LiveExecution.lock:\n            if arg_0.edited_source:\n                arg_1 = ast.parse(arg_0.edited_source)\n                for arg_2 in [n for n in ast.walk(arg_1) if isinstance(n, ast.FunctionDef)]:\n                    arg_0.ns[arg_2.name].__code__ = meta.decompiler.compile_func(arg_2, arg_0.filename, arg_0.ns).__code__", "path": "shoebot/grammar/livecode.py", "identifier": "LiveExecution.reload_functions", "docstring": "Replace functions in namespace with functions from edited_source.", "docstring_tokens": ["Replace", "functions", "in", "namespace", "with", "functions", "from", "edited_source", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258651}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/convert.py#L20-L26", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "Converts markdown content to text", "language": "python", "parameters": "(content)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "markdown", ".", "markdown", "(", "arg_0", ")", "if", "arg_2", ":", "arg_1", "=", "html_to_text", "(", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" Converts markdown content to text \"\"\"\n    arg_1 = None\n    arg_2 = markdown.markdown(arg_0)\n    if arg_2:\n        arg_1 = html_to_text(arg_0)\n    return arg_1", "path": "toolware/utils/convert.py", "identifier": "md_to_text", "docstring": "Converts markdown content to text", "docstring_tokens": ["Converts", "markdown", "content", "to", "text"], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 258652}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/mp_func.py#L165-L170", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Multiply vector by scalar", "language": "python", "parameters": "(scalar, v1)", "return_statement": "return vector", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ")", ":", "arg_2", ".", "append", "(", "'(({})*({}))'", ".", "format", "(", "arg_0", ",", "arg_1", "[", "arg_3", "]", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Multiply vector by scalar\"\"\"\n    arg_2 = []\n    for arg_3, arg_4 in enumerate(arg_1):\n        arg_2.append('(({})*({}))'.format(arg_0, arg_1[arg_3]))\n    return arg_2", "path": "meshlabxml/mp_func.py", "identifier": "v_multiply", "docstring": "Multiply vector by scalar", "docstring_tokens": ["Multiply", "vector", "by", "scalar"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 258653}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/__init__.py#L315-L338", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Add a new rule definition named ``def_name`` having value ``def_value`` to\n        the category ``cat``.", "language": "python", "parameters": "(self, cat, def_name, def_val, no_prune=False, gram_file=\"default\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ",", "arg_5", "=", "\"default\"", ")", ":", "arg_0", ".", "_rules_processed", "=", "False", "arg_0", ".", "add_to_cat_group", "(", "arg_1", ",", "arg_5", ",", "arg_2", ")", "if", "arg_4", ":", "arg_0", ".", "no_prunes", ".", "setdefault", "(", "arg_1", ",", "{", "}", ")", ".", "setdefault", "(", "arg_2", ",", "True", ")", "if", "arg_0", ".", "_staged_defs", "is", "not", "None", ":", "arg_0", ".", "_staged_defs", ".", "append", "(", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", "else", ":", "arg_0", ".", "defs", ".", "setdefault", "(", "arg_1", ",", "{", "}", ")", ".", "setdefault", "(", "arg_2", ",", "deque", "(", ")", ")", ".", "append", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False, arg_5=\"default\"):\n        \"\"\"Add a new rule definition named ``def_name`` having value ``def_value`` to\n        the category ``cat``.\n\n        :param str cat: The category to add the rule to\n        :param str def_name: The name of the rule definition\n        :param def_val: The value of the rule definition\n        :param bool no_prune: If the rule should explicitly *NOT*\n            be pruned even if it has been determined to be unreachable (default=``False``)\n        :param str gram_file: The file the rule was defined in (default=``\"default\"``).\n        \"\"\"\n        arg_0._rules_processed = False\n\n        arg_0.add_to_cat_group(arg_1, arg_5, arg_2)\n\n        if arg_4:\n            arg_0.no_prunes.setdefault(arg_1, {}).setdefault(arg_2, True)\n\n        if arg_0._staged_defs is not None:\n            # if we're tracking changes during rule generation, add any new rules\n            # to _staged_defs so they can be reverted if something goes wrong\n            arg_0._staged_defs.append((arg_1, arg_2, arg_3))\n        else:\n            arg_0.defs.setdefault(arg_1, {}).setdefault(arg_2, deque()).append(arg_3)", "path": "gramfuzz/gramfuzz/__init__.py", "identifier": "GramFuzzer.add_definition", "docstring": "Add a new rule definition named ``def_name`` having value ``def_value`` to\n        the category ``cat``.\n\n        :param str cat: The category to add the rule to\n        :param str def_name: The name of the rule definition\n        :param def_val: The value of the rule definition\n        :param bool no_prune: If the rule should explicitly *NOT*\n            be pruned even if it has been determined to be unreachable (default=``False``)\n        :param str gram_file: The file the rule was defined in (default=``\"default\"``).", "docstring_tokens": ["Add", "a", "new", "rule", "definition", "named", "def_name", "having", "value", "def_value", "to", "the", "category", "cat", "."], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 258654}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/conservation.py#L29-L52", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Get the conservation prediction", "language": "python", "parameters": "(variant, info_key)", "return_statement": "return conservations", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "INFO", ".", "get", "(", "arg_1", ")", "arg_3", "=", "[", "]", "if", "arg_2", ":", "if", "isinstance", "(", "arg_2", ",", "numbers", ".", "Number", ")", ":", "arg_2", "=", "(", "arg_2", ",", ")", "for", "arg_4", "in", "arg_2", ":", "if", "arg_4", ">=", "CONSERVATION", "[", "arg_1", "]", "[", "'conserved_min'", "]", ":", "arg_3", ".", "append", "(", "'Conserved'", ")", "else", ":", "arg_3", ".", "append", "(", "'NotConserved'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Get the conservation prediction\n\n        Args:\n            variant(dict): A variant dictionary\n            info_key(str)\n\n        Returns:\n            conservations(list): List of censervation terms\n    \"\"\"\n    arg_2 = arg_0.INFO.get(arg_1)\n    arg_3 = []\n\n    if arg_2:\n        if isinstance(arg_2, numbers.Number):\n            arg_2 = (arg_2,)\n\n        for arg_4 in arg_2:\n            if arg_4 >= CONSERVATION[arg_1]['conserved_min']:\n                arg_3.append('Conserved')\n            else:\n                arg_3.append('NotConserved')\n\n    return arg_3", "path": "scout/parse/variant/conservation.py", "identifier": "parse_conservation", "docstring": "Get the conservation prediction\n\n        Args:\n            variant(dict): A variant dictionary\n            info_key(str)\n\n        Returns:\n            conservations(list): List of censervation terms", "docstring_tokens": ["Get", "the", "conservation", "prediction"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258655}
{"url": "https://github.com/nickw444/flask-ldap3-login/blob/3cf0faff52d0e04d4813119a2ba36d706e6fb31f/flask_ldap3_login/__init__.py#L148-L172", "sha": "3cf0faff52d0e04d4813119a2ba36d706e6fb31f", "docstring_summary": "Add an additional server to the server pool and return the\n        freshly created server.", "language": "python", "parameters": "(self, hostname, port, use_ssl, tls_ctx=None)", "return_statement": "return server", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "not", "arg_3", "and", "arg_4", ":", "raise", "ValueError", "(", "\"Cannot specify a TLS context and not use SSL!\"", ")", "arg_5", "=", "ldap3", ".", "Server", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "tls", "=", "arg_4", ")", "arg_0", ".", "_server_pool", ".", "add", "(", "arg_5", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"\n        Add an additional server to the server pool and return the\n        freshly created server.\n\n        Args:\n            hostname (str): Hostname of the server\n            port (int): Port of the server\n            use_ssl (bool): True if SSL is to be used when connecting.\n            tls_ctx (ldap3.Tls): An optional TLS context object to use\n                when connecting.\n\n        Returns:\n            ldap3.Server: The freshly created server object.\n        \"\"\"\n        if not arg_3 and arg_4:\n            raise ValueError(\"Cannot specify a TLS context and not use SSL!\")\n        arg_5 = ldap3.Server(\n            arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            tls=arg_4\n        )\n        arg_0._server_pool.add(arg_5)\n        return arg_5", "path": "flask_ldap3_login/__init__.py", "identifier": "LDAP3LoginManager.add_server", "docstring": "Add an additional server to the server pool and return the\n        freshly created server.\n\n        Args:\n            hostname (str): Hostname of the server\n            port (int): Port of the server\n            use_ssl (bool): True if SSL is to be used when connecting.\n            tls_ctx (ldap3.Tls): An optional TLS context object to use\n                when connecting.\n\n        Returns:\n            ldap3.Server: The freshly created server object.", "docstring_tokens": ["Add", "an", "additional", "server", "to", "the", "server", "pool", "and", "return", "the", "freshly", "created", "server", "."], "nwo": "nickw444/flask-ldap3-login", "score": 0.51975183030278, "idx": 258656}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/api/apiworker.py#L65-L93", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Make preparations before running Tank", "language": "python", "parameters": "(self, options)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "options", "=", "arg_1", "if", "arg_0", ".", "options", ".", "get", "(", "'lock_dir'", ",", "None", ")", ":", "arg_0", ".", "core", ".", "set_option", "(", "arg_0", ".", "core", ".", "SECTION", ",", "\"lock_dir\"", ",", "arg_0", ".", "options", "[", "'lock_dir'", "]", ")", "if", "arg_0", ".", "options", ".", "get", "(", "'ignore_lock'", ",", "None", ")", ":", "arg_0", ".", "core", ".", "set_option", "(", "arg_0", ".", "core", ".", "SECTION", ",", "'ignore_lock'", ",", "arg_0", ".", "options", "[", "'ignore_lock'", "]", ")", "while", "True", ":", "try", ":", "arg_0", ".", "core", ".", "get_lock", "(", ")", "break", "except", "Exception", "as", "exc", ":", "if", "arg_0", ".", "options", ".", "get", "(", "'lock_fail'", ",", "None", ")", ":", "raise", "RuntimeError", "(", "\"Lock file present, cannot continue\"", ")", "arg_0", ".", "log", ".", "info", "(", "\"Couldn't get lock. Will retry in 5 seconds... (%s)\"", ",", "str", "(", "exc", ")", ")", "time", ".", "sleep", "(", "5", ")", "arg_2", "=", "arg_0", ".", "get_default_configs", "(", ")", "if", "arg_0", ".", "options", ".", "get", "(", "'config'", ",", "None", ")", ":", "arg_2", ".", "append", "(", "arg_0", ".", "options", "[", "'config'", "]", ")", "arg_0", ".", "core", ".", "load_configs", "(", "arg_2", ")", "arg_0", ".", "__add_user_options", "(", ")", "arg_0", ".", "core", ".", "load_plugins", "(", ")", "if", "arg_0", ".", "options", ".", "get", "(", "'ignore_lock'", ",", "None", ")", ":", "arg_0", ".", "core", ".", "set_option", "(", "arg_0", ".", "core", ".", "SECTION", ",", "arg_0", ".", "IGNORE_LOCKS", ",", "\"1\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Make preparations before running Tank \"\"\"\n        arg_0.options = arg_1\n        if arg_0.options.get('lock_dir', None):\n            arg_0.core.set_option(arg_0.core.SECTION, \"lock_dir\", arg_0.options['lock_dir'])\n        if arg_0.options.get('ignore_lock', None):\n            arg_0.core.set_option(arg_0.core.SECTION, 'ignore_lock', arg_0.options['ignore_lock'])\n\n        while True:\n            try:\n                arg_0.core.get_lock()\n                break\n            except Exception as exc:\n                if arg_0.options.get('lock_fail', None):\n                    raise RuntimeError(\"Lock file present, cannot continue\")\n                arg_0.log.info(\n                    \"Couldn't get lock. Will retry in 5 seconds... (%s)\",\n                    str(exc))\n                time.sleep(5)\n\n        arg_2 = arg_0.get_default_configs()\n        if arg_0.options.get('config', None):\n            arg_2.append(arg_0.options['config'])\n        arg_0.core.load_configs(arg_2)\n        arg_0.__add_user_options()\n        arg_0.core.load_plugins()\n\n        if arg_0.options.get('ignore_lock', None):\n            arg_0.core.set_option(arg_0.core.SECTION, arg_0.IGNORE_LOCKS, \"1\")", "path": "yandextank/api/apiworker.py", "identifier": "ApiWorker.configure", "docstring": "Make preparations before running Tank", "docstring_tokens": ["Make", "preparations", "before", "running", "Tank"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 258657}
{"url": "https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/djpaypal/models/webhooks.py#L252-L298", "sha": "867368f6068c2539e22d486eb7a6d2ecfb9485e0", "docstring_summary": "Decorator that registers a function as a webhook handler.", "language": "python", "parameters": "(*event_types)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "set", "(", ")", "for", "arg_2", "in", "arg_0", ":", "arg_2", "=", "arg_2", ".", "lower", "(", ")", "if", "\"*\"", "in", "arg_2", ":", "for", "arg_3", "in", "WEBHOOK_EVENT_TYPES", ":", "if", "fnmatch", "(", "arg_3", ",", "arg_2", ")", ":", "arg_1", ".", "add", "(", "arg_3", ")", "elif", "arg_2", "not", "in", "WEBHOOK_EVENT_TYPES", ":", "raise", "ValueError", "(", "\"Unknown webhook event: %r\"", "%", "(", "arg_2", ")", ")", "else", ":", "arg_1", ".", "add", "(", "arg_2", ")", "def", "decorator", "(", "arg_4", ")", ":", "for", "arg_2", "in", "arg_1", ":", "WEBHOOK_SIGNALS", "[", "arg_2", "]", ".", "connect", "(", "arg_4", ")", "return", "arg_4", "return", "decorator"], "function": "def Func(*arg_0):\n\t\"\"\"\n\tDecorator that registers a function as a webhook handler.\n\n\tUsage examples:\n\n\t>>> # Hook a single event\n\t>>> @Func(\"payment.sale.completed\")\n\t>>> def on_payment_received(event):\n\t>>>     payment = event.get_resource()\n\t>>>     print(\"Received payment:\", payment)\n\n\t>>> # Multiple events supported\n\t>>> @Func(\"billing.subscription.suspended\", \"billing.subscription.cancelled\")\n\t>>> def on_subscription_stop(event):\n\t>>>     subscription = event.get_resource()\n\t>>>     print(\"Stopping subscription:\", subscription)\n\n\t>>> # Using a wildcard works as well\n\t>>> @Func(\"billing.subscription.*\")\n\t>>> def on_subscription_update(event):\n\t>>>     subscription = event.get_resource()\n\t>>>     print(\"Updated subscription:\", subscription)\n\t\"\"\"\n\n\t# First expand all wildcards and verify the event types are valid\n\targ_1 = set()\n\tfor arg_2 in arg_0:\n\t\t# Always convert to lowercase\n\t\targ_2 = arg_2.lower()\n\t\tif \"*\" in arg_2:\n\t\t\t# expand it\n\t\t\tfor arg_3 in WEBHOOK_EVENT_TYPES:\n\t\t\t\tif fnmatch(arg_3, arg_2):\n\t\t\t\t\targ_1.add(arg_3)\n\t\telif arg_2 not in WEBHOOK_EVENT_TYPES:\n\t\t\traise ValueError(\"Unknown webhook event: %r\" % (arg_2))\n\t\telse:\n\t\t\targ_1.add(arg_2)\n\n\t# Now register them\n\tdef decorator(arg_4):\n\t\tfor arg_2 in arg_1:\n\t\t\tWEBHOOK_SIGNALS[arg_2].connect(arg_4)\n\t\treturn arg_4\n\n\treturn decorator", "path": "djpaypal/models/webhooks.py", "identifier": "webhook_handler", "docstring": "Decorator that registers a function as a webhook handler.\n\n\tUsage examples:\n\n\t>>> # Hook a single event\n\t>>> @webhook_handler(\"payment.sale.completed\")\n\t>>> def on_payment_received(event):\n\t>>>     payment = event.get_resource()\n\t>>>     print(\"Received payment:\", payment)\n\n\t>>> # Multiple events supported\n\t>>> @webhook_handler(\"billing.subscription.suspended\", \"billing.subscription.cancelled\")\n\t>>> def on_subscription_stop(event):\n\t>>>     subscription = event.get_resource()\n\t>>>     print(\"Stopping subscription:\", subscription)\n\n\t>>> # Using a wildcard works as well\n\t>>> @webhook_handler(\"billing.subscription.*\")\n\t>>> def on_subscription_update(event):\n\t>>>     subscription = event.get_resource()\n\t>>>     print(\"Updated subscription:\", subscription)", "docstring_tokens": ["Decorator", "that", "registers", "a", "function", "as", "a", "webhook", "handler", "."], "nwo": "HearthSim/dj-paypal", "score": 0.41047498361521556, "idx": 258658}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/convert/Layout.py#L348-L366", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Iterate over connections between instructions.", "language": "python", "parameters": "(self, mapping=identity)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "walk_instructions", "(", ")", ":", "for", "arg_4", "in", "arg_3", ".", "instruction", ".", "consuming_instructions", ":", "if", "arg_4", "is", "None", ":", "continue", "arg_5", "=", "arg_0", ".", "_walk", ".", "instruction_in_grid", "(", "arg_4", ")", "arg_6", "=", "Connection", "(", "arg_3", ",", "arg_5", ")", "if", "arg_6", ".", "is_visible", "(", ")", ":", "yield", "arg_1", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Iterate over connections between instructions.\n\n        :return: an iterator over :class:`connections <Connection>` between\n          :class:`instructions in grid <InstructionInGrid>`\n        :param mapping: funcion to map the result, see\n          :meth:`walk_instructions` for an example usage\n        \"\"\"\n        for arg_3 in arg_0.walk_instructions():\n            for arg_4 in arg_3.instruction.consuming_instructions:\n                if arg_4 is None:\n                    continue\n                arg_5 = arg_0._walk.instruction_in_grid(arg_4)\n                arg_6 = Connection(arg_3, arg_5)\n                if arg_6.is_visible():\n                    # print(\"connection:\",\n                    #      connection.start.instruction,\n                    #      connection.stop.instruction)\n                    yield arg_1(arg_6)", "path": "knittingpattern/convert/Layout.py", "identifier": "GridLayout.walk_connections", "docstring": "Iterate over connections between instructions.\n\n        :return: an iterator over :class:`connections <Connection>` between\n          :class:`instructions in grid <InstructionInGrid>`\n        :param mapping: funcion to map the result, see\n          :meth:`walk_instructions` for an example usage", "docstring_tokens": ["Iterate", "over", "connections", "between", "instructions", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 258659}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box_zip.py#L114-L208", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Create a compressed zip archive backup for a directory.", "language": "python", "parameters": "(self,\n               dst=None,\n               ignore=None,\n               ignore_ext=None,\n               ignore_pattern=None,\n               ignore_size_smaller_than=None,\n               ignore_size_larger_than=None,\n               case_sensitive=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ")", ":", "def", "preprocess_arg", "(", "arg_8", ")", ":", "if", "arg_8", "is", "None", ":", "return", "[", "]", "if", "isinstance", "(", "arg_8", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "list", "(", "arg_8", ")", "else", ":", "return", "[", "arg_8", ",", "]", "arg_0", ".", "assert_is_dir_and_exists", "(", ")", "arg_2", "=", "preprocess_arg", "(", "arg_2", ")", "for", "arg_9", "in", "arg_2", ":", "if", "arg_9", ".", "startswith", "(", "\"/\"", ")", "or", "arg_9", ".", "startswith", "(", "\"\\\\\"", ")", ":", "raise", "ValueError", "arg_3", "=", "preprocess_arg", "(", "arg_3", ")", "for", "arg_10", "in", "arg_3", ":", "if", "not", "arg_10", ".", "startswith", "(", "\".\"", ")", ":", "raise", "ValueError", "arg_4", "=", "preprocess_arg", "(", "arg_4", ")", "if", "arg_7", ":", "pass", "else", ":", "arg_2", "=", "[", "arg_9", ".", "lower", "(", ")", "for", "arg_9", "in", "arg_2", "]", "arg_3", "=", "[", "arg_9", ".", "lower", "(", ")", "for", "arg_9", "in", "arg_3", "]", "arg_4", "=", "[", "arg_9", ".", "lower", "(", ")", "for", "arg_9", "in", "arg_4", "]", "def", "filters", "(", "arg_11", ")", ":", "arg_12", "=", "arg_11", ".", "relative_to", "(", "arg_0", ")", ".", "abspath", "if", "not", "arg_7", ":", "arg_12", "=", "arg_12", ".", "lower", "(", ")", "for", "arg_9", "in", "arg_2", ":", "if", "arg_12", ".", "startswith", "(", "arg_9", ")", ":", "return", "False", "if", "arg_7", ":", "arg_10", "=", "arg_11", ".", "ext", "else", ":", "arg_10", "=", "arg_11", ".", "ext", ".", "lower", "(", ")", "if", "arg_10", "in", "arg_3", ":", "return", "False", "for", "arg_13", "in", "arg_4", ":", "if", "arg_13", "in", "arg_12", ":", "return", "False", "if", "arg_5", ":", "if", "arg_11", ".", "size", "<", "arg_5", ":", "return", "False", "if", "arg_6", ":", "if", "arg_11", ".", "size", ">", "arg_6", ":", "return", "False", "return", "True", "arg_0", ".", "make_zip_archive", "(", "arg_1", "=", "arg_1", ",", "filters", "=", "filters", ",", "compress", "=", "True", ",", "overwrite", "=", "False", ",", "verbose", "=", "True", ",", ")"], "function": "def Func(arg_0,\n               arg_1=None,\n               arg_2=None,\n               arg_3=None,\n               arg_4=None,\n               arg_5=None,\n               arg_6=None,\n               arg_7=False):  # pragma: no cover\n        \"\"\"\n        Create a compressed zip archive Func for a directory.\n\n        :param dst: the output file path.\n        :param ignore: file or directory defined in this list will be ignored.\n        :param ignore_ext: file with extensions defined in this list will be ignored.\n        :param ignore_pattern: any file or directory that contains this pattern\n            will be ignored.\n        :param ignore_size_smaller_than: any file size smaller than this\n            will be ignored.\n        :param ignore_size_larger_than: any file size larger than this\n            will be ignored.\n\n        **\u4e2d\u6587\u6587\u6863**\n\n        \u4e3a\u4e00\u4e2a\u76ee\u5f55\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\u538b\u7f29\u5305\u3002\u53ef\u4ee5\u901a\u8fc7\u8fc7\u6ee4\u5668\u9009\u62e9\u4f60\u8981\u5907\u4efd\u7684\u6587\u4ef6\u3002\n        \"\"\"\n\n        def preprocess_arg(arg_8):  # pragma: no cover\n            if arg_8 is None:\n                return []\n\n            if isinstance(arg_8, (tuple, list)):\n                return list(arg_8)\n            else:\n                return [arg_8, ]\n\n        arg_0.assert_is_dir_and_exists()\n\n        arg_2 = preprocess_arg(arg_2)\n        for arg_9 in arg_2:\n            if arg_9.startswith(\"/\") or arg_9.startswith(\"\\\\\"):\n                raise ValueError\n\n        arg_3 = preprocess_arg(arg_3)\n        for arg_10 in arg_3:\n            if not arg_10.startswith(\".\"):\n                raise ValueError\n\n        arg_4 = preprocess_arg(arg_4)\n\n        if arg_7:\n            pass\n        else:\n            arg_2 = [arg_9.lower() for arg_9 in arg_2]\n            arg_3 = [arg_9.lower() for arg_9 in arg_3]\n            arg_4 = [arg_9.lower() for arg_9 in arg_4]\n\n        def filters(arg_11):\n            arg_12 = arg_11.relative_to(arg_0).abspath\n            if not arg_7:\n                arg_12 = arg_12.lower()\n\n            # ignore\n            for arg_9 in arg_2:\n                if arg_12.startswith(arg_9):\n                    return False\n\n            # ignore_ext\n            if arg_7:\n                arg_10 = arg_11.ext\n            else:\n                arg_10 = arg_11.ext.lower()\n\n            if arg_10 in arg_3:\n                return False\n\n            # ignore_pattern\n            for arg_13 in arg_4:\n                if arg_13 in arg_12:\n                    return False\n\n            # ignore_size_smaller_than\n            if arg_5:\n                if arg_11.size < arg_5:\n                    return False\n\n            # ignore_size_larger_than\n            if arg_6:\n                if arg_11.size > arg_6:\n                    return False\n\n            return True\n\n        arg_0.make_zip_archive(\n            arg_1=arg_1, filters=filters, compress=True, overwrite=False, verbose=True,\n        )", "path": "pathlib_mate/mate_tool_box_zip.py", "identifier": "ToolBoxZip.backup", "docstring": "Create a compressed zip archive backup for a directory.\n\n        :param dst: the output file path.\n        :param ignore: file or directory defined in this list will be ignored.\n        :param ignore_ext: file with extensions defined in this list will be ignored.\n        :param ignore_pattern: any file or directory that contains this pattern\n            will be ignored.\n        :param ignore_size_smaller_than: any file size smaller than this\n            will be ignored.\n        :param ignore_size_larger_than: any file size larger than this\n            will be ignored.\n\n        **\u4e2d\u6587\u6587\u6863**\n\n        \u4e3a\u4e00\u4e2a\u76ee\u5f55\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\u538b\u7f29\u5305\u3002\u53ef\u4ee5\u901a\u8fc7\u8fc7\u6ee4\u5668\u9009\u62e9\u4f60\u8981\u5907\u4efd\u7684\u6587\u4ef6\u3002", "docstring_tokens": ["Create", "a", "compressed", "zip", "archive", "backup", "for", "a", "directory", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 258660}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/lnvm.py#L41-L59", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Create LNVM device", "language": "python", "parameters": "()", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "env", "(", ")", ":", "cij", ".", "err", "(", "\"cij.lnvm.Func: Invalid LNVM ENV\"", ")", "return", "1", "arg_0", "=", "cij", ".", "env_to_dict", "(", "\"NVME\"", ",", "[", "\"DEV_NAME\"", "]", ")", "arg_1", "=", "cij", ".", "env_to_dict", "(", "PREFIX", ",", "EXPORTED", "+", "REQUIRED", ")", "cij", ".", "emph", "(", "\"lnvm.Func: LNVM_DEV_NAME: %s\"", "%", "arg_1", "[", "\"DEV_NAME\"", "]", ")", "arg_2", "=", "[", "\"nvme lnvm Func -d %s -n %s -t %s -b %s -e %s -f\"", "%", "(", "arg_0", "[", "\"DEV_NAME\"", "]", ",", "arg_1", "[", "\"DEV_NAME\"", "]", ",", "arg_1", "[", "\"DEV_TYPE\"", "]", ",", "arg_1", "[", "\"BGN\"", "]", ",", "arg_1", "[", "\"END\"", "]", ")", "]", "arg_3", ",", "arg_4", ",", "arg_4", "=", "cij", ".", "ssh", ".", "command", "(", "arg_2", ",", "shell", "=", "True", ")", "if", "arg_3", ":", "cij", ".", "err", "(", "\"cij.lnvm.Func: FAILED\"", ")", "return", "1", "return", "0"], "function": "def Func():\n    \"\"\"Create LNVM device\"\"\"\n\n    if env():\n        cij.err(\"cij.lnvm.Func: Invalid LNVM ENV\")\n        return 1\n\n    arg_0 = cij.env_to_dict(\"NVME\", [\"DEV_NAME\"])\n    arg_1 = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)\n    cij.emph(\"lnvm.Func: LNVM_DEV_NAME: %s\" % arg_1[\"DEV_NAME\"])\n\n    arg_2 = [\"nvme lnvm Func -d %s -n %s -t %s -b %s -e %s -f\" % (\n        arg_0[\"DEV_NAME\"], arg_1[\"DEV_NAME\"], arg_1[\"DEV_TYPE\"], arg_1[\"BGN\"], arg_1[\"END\"])]\n    arg_3, arg_4, arg_4 = cij.ssh.command(arg_2, shell=True)\n    if arg_3:\n        cij.err(\"cij.lnvm.Func: FAILED\")\n        return 1\n\n    return 0", "path": "modules/cij/lnvm.py", "identifier": "create", "docstring": "Create LNVM device", "docstring_tokens": ["Create", "LNVM", "device"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 258661}
{"url": "https://github.com/pinterest/thrift-tools/blob/64e74aec89e2491c781fc62d1c45944dc15aba28/thrift_tools/thrift_struct.py#L33-L43", "sha": "64e74aec89e2491c781fc62d1c45944dc15aba28", "docstring_summary": "Returns true if all fields of other struct are isomorphic to this\n        struct's fields", "language": "python", "parameters": "(self, other)", "return_statement": "return (isinstance(other, self.__class__)\n                and\n                len(self.fields) == len(other.fields)\n                and\n                all(a.is_isomorphic_to(b) for a, b in zip(self.fields,\n                                                          other.fields)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "isinstance", "(", "arg_1", ",", "arg_0", ".", "__class__", ")", "and", "len", "(", "arg_0", ".", "fields", ")", "==", "len", "(", "arg_1", ".", "fields", ")", "and", "all", "(", "arg_2", ".", "Func", "(", "arg_3", ")", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "arg_0", ".", "fields", ",", "arg_1", ".", "fields", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns true if all fields of other struct are isomorphic to this\n        struct's fields\n        \"\"\"\n        return (isinstance(arg_1, arg_0.__class__)\n                and\n                len(arg_0.fields) == len(arg_1.fields)\n                and\n                all(arg_2.Func(arg_3) for arg_2, arg_3 in zip(arg_0.fields,\n                                                          arg_1.fields)))", "path": "thrift_tools/thrift_struct.py", "identifier": "ThriftStruct.is_isomorphic_to", "docstring": "Returns true if all fields of other struct are isomorphic to this\n        struct's fields", "docstring_tokens": ["Returns", "true", "if", "all", "fields", "of", "other", "struct", "are", "isomorphic", "to", "this", "struct", "s", "fields"], "nwo": "pinterest/thrift-tools", "score": 0.3868024438139195, "idx": 258662}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/gen_rst.py#L167-L201", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Return list with source file separated into code and text blocks.", "language": "python", "parameters": "(source_file)", "return_statement": "return blocks", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "get_docstring_and_rest", "(", "arg_0", ")", "arg_3", "=", "[", "(", "'text'", ",", "arg_1", ")", "]", "arg_4", "=", "re", ".", "compile", "(", "r'(?P<header_line>^#{20,}.*)\\s(?P<text_content>(?:^#.*\\s)*)'", ",", "flags", "=", "re", ".", "M", ")", "arg_5", "=", "0", "for", "arg_6", "in", "re", ".", "finditer", "(", "arg_4", ",", "arg_2", ")", ":", "arg_7", ",", "arg_8", "=", "arg_6", ".", "span", "(", ")", "arg_9", "=", "arg_2", "[", "arg_5", ":", "arg_7", "]", "arg_10", "=", "arg_6", ".", "group", "(", "'text_content'", ")", "arg_11", "=", "re", ".", "compile", "(", "'^#'", ",", "flags", "=", "re", ".", "M", ")", "arg_12", "=", "dedent", "(", "re", ".", "sub", "(", "arg_11", ",", "''", ",", "arg_10", ")", ")", "if", "arg_9", ".", "strip", "(", ")", ":", "arg_3", ".", "append", "(", "(", "'code'", ",", "arg_9", ")", ")", "if", "arg_12", ".", "strip", "(", ")", ":", "arg_3", ".", "append", "(", "(", "'text'", ",", "arg_12", ")", ")", "arg_5", "=", "arg_8", "arg_13", "=", "arg_2", "[", "arg_5", ":", "]", "if", "arg_13", ".", "strip", "(", ")", ":", "arg_3", ".", "append", "(", "(", "'code'", ",", "arg_13", ")", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Return list with source file separated into code and text blocks.\n\n    Returns\n    -------\n    blocks : list of (label, content)\n        List where each element is a tuple with the label ('text' or 'code'),\n        and content string of block.\n    \"\"\"\n    arg_1, arg_2 = get_docstring_and_rest(arg_0)\n\n    arg_3 = [('text', arg_1)]\n\n    arg_4 = re.compile(\n        r'(?P<header_line>^#{20,}.*)\\s(?P<text_content>(?:^#.*\\s)*)',\n        flags=re.M)\n\n    arg_5 = 0\n    for arg_6 in re.finditer(arg_4, arg_2):\n        arg_7, arg_8 = arg_6.span()\n        arg_9 = arg_2[arg_5:arg_7]\n        arg_10 = arg_6.group('text_content')\n        arg_11 = re.compile('^#', flags=re.M)\n        arg_12 = dedent(re.sub(arg_11, '', arg_10))\n        if arg_9.strip():\n            arg_3.append(('code', arg_9))\n        if arg_12.strip():\n            arg_3.append(('text', arg_12))\n        arg_5 = arg_8\n\n    arg_13 = arg_2[arg_5:]\n    if arg_13.strip():\n        arg_3.append(('code', arg_13))\n\n    return arg_3", "path": "doc/sphinxext/sphinx_gallery/gen_rst.py", "identifier": "split_code_and_text_blocks", "docstring": "Return list with source file separated into code and text blocks.\n\n    Returns\n    -------\n    blocks : list of (label, content)\n        List where each element is a tuple with the label ('text' or 'code'),\n        and content string of block.", "docstring_tokens": ["Return", "list", "with", "source", "file", "separated", "into", "code", "and", "text", "blocks", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 258663}
{"url": "https://github.com/tokibito/funkload-friendly/blob/a60e8d2b76ba5ad6c16f8cfc347bd200bd45c189/src/funkload_friendly/cookie.py#L37-L47", "sha": "a60e8d2b76ba5ad6c16f8cfc347bd200bd45c189", "docstring_summary": "update self with cookie_string.", "language": "python", "parameters": "(self, cookie_string)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "split", "(", "';'", ")", ":", "if", "'='", "in", "arg_2", ":", "arg_3", ",", "arg_4", "=", "arg_2", ".", "split", "(", "'='", ",", "1", ")", "else", ":", "arg_3", "=", "arg_2", "arg_5", "=", "arg_3", ".", "strip", "(", ")", "if", "arg_5", "and", "arg_5", ".", "lower", "(", ")", "not", "in", "COOKIE_ATTRIBUTE_NAMES", ":", "arg_0", "[", "arg_5", "]", "=", "arg_4", ".", "strip", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"update self with cookie_string.\n        \"\"\"\n        for arg_2 in arg_1.split(';'):\n            if '=' in arg_2:\n                arg_3, arg_4 = arg_2.split('=', 1)\n            else:\n                arg_3 = arg_2\n            arg_5 = arg_3.strip()\n            if arg_5 and arg_5.lower() not in COOKIE_ATTRIBUTE_NAMES:\n                arg_0[arg_5] = arg_4.strip()", "path": "src/funkload_friendly/cookie.py", "identifier": "CookieDict.from_cookie_string", "docstring": "update self with cookie_string.", "docstring_tokens": ["update", "self", "with", "cookie_string", "."], "nwo": "tokibito/funkload-friendly", "score": 0.17697123869542528, "idx": 258664}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/formatters.py#L370-L413", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "float_precision changed, set float_format accordingly.", "language": "python", "parameters": "(self, name, old, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "'%'", "in", "arg_3", ":", "arg_4", "=", "arg_3", "try", ":", "arg_4", "%", "3.14159", "except", "Exception", ":", "raise", "ValueError", "(", "\"Precision must be int or format string, not %r\"", "%", "arg_3", ")", "elif", "arg_3", ":", "try", ":", "arg_5", "=", "int", "(", "arg_3", ")", "assert", "arg_5", ">=", "0", "except", "ValueError", ":", "raise", "ValueError", "(", "\"Precision must be int or format string, not %r\"", "%", "arg_3", ")", "except", "AssertionError", ":", "raise", "ValueError", "(", "\"int precision must be non-negative, not %r\"", "%", "arg_5", ")", "arg_4", "=", "'%%.%if'", "%", "arg_5", "if", "'numpy'", "in", "sys", ".", "modules", ":", "import", "numpy", "numpy", ".", "set_printoptions", "(", "precision", "=", "arg_5", ")", "else", ":", "arg_4", "=", "'%r'", "if", "'numpy'", "in", "sys", ".", "modules", ":", "import", "numpy", "numpy", ".", "set_printoptions", "(", "precision", "=", "8", ")", "arg_0", ".", "float_format", "=", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"float_precision changed, set float_format accordingly.\n\n        float_precision can be set by int or str.\n        This will set float_format, after interpreting input.\n        If numpy has been imported, numpy print precision will also be set.\n\n        integer `n` sets format to '%.nf', otherwise, format set directly.\n\n        An empty string returns to defaults (repr for float, 8 for numpy).\n\n        This parameter can be set via the '%precision' magic.\n        \"\"\"\n\n        if '%' in arg_3:\n            # got explicit format string\n            arg_4 = arg_3\n            try:\n                arg_4%3.14159\n            except Exception:\n                raise ValueError(\"Precision must be int or format string, not %r\"%arg_3)\n        elif arg_3:\n            # otherwise, should be an int\n            try:\n                arg_5 = int(arg_3)\n                assert arg_5 >= 0\n            except ValueError:\n                raise ValueError(\"Precision must be int or format string, not %r\"%arg_3)\n            except AssertionError:\n                raise ValueError(\"int precision must be non-negative, not %r\"%arg_5)\n\n            arg_4 = '%%.%if'%arg_5\n            if 'numpy' in sys.modules:\n                # set numpy precision if it has been imported\n                import numpy\n                numpy.set_printoptions(precision=arg_5)\n        else:\n            # default back to repr\n            arg_4 = '%r'\n            if 'numpy' in sys.modules:\n                import numpy\n                # numpy default is 8\n                numpy.set_printoptions(precision=8)\n        arg_0.float_format = arg_4", "path": "environment/lib/python2.7/site-packages/IPython/core/formatters.py", "identifier": "PlainTextFormatter._float_precision_changed", "docstring": "float_precision changed, set float_format accordingly.\n\n        float_precision can be set by int or str.\n        This will set float_format, after interpreting input.\n        If numpy has been imported, numpy print precision will also be set.\n\n        integer `n` sets format to '%.nf', otherwise, format set directly.\n\n        An empty string returns to defaults (repr for float, 8 for numpy).\n\n        This parameter can be set via the '%precision' magic.", "docstring_tokens": ["float_precision", "changed", "set", "float_format", "accordingly", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258665}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py#L188-L198", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "write connection info to JSON file", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "basename", "(", "arg_0", ".", "connection_file", ")", "==", "arg_0", ".", "connection_file", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "profile_dir", ".", "security_dir", ",", "arg_0", ".", "connection_file", ")", "else", ":", "arg_1", "=", "arg_0", ".", "connection_file", "Func", "(", "arg_1", ",", "ip", "=", "arg_0", ".", "ip", ",", "key", "=", "arg_0", ".", "session", ".", "key", ",", "shell_port", "=", "arg_0", ".", "shell_port", ",", "stdin_port", "=", "arg_0", ".", "stdin_port", ",", "hb_port", "=", "arg_0", ".", "hb_port", ",", "iopub_port", "=", "arg_0", ".", "iopub_port", ")", "arg_0", ".", "_full_connection_file", "=", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"write connection info to JSON file\"\"\"\n        if os.path.basename(arg_0.connection_file) == arg_0.connection_file:\n            arg_1 = os.path.join(arg_0.profile_dir.security_dir, arg_0.connection_file)\n        else:\n            arg_1 = arg_0.connection_file\n        Func(arg_1, ip=arg_0.ip, key=arg_0.session.key,\n        shell_port=arg_0.shell_port, stdin_port=arg_0.stdin_port, hb_port=arg_0.hb_port,\n        iopub_port=arg_0.iopub_port)\n        \n        arg_0._full_connection_file = arg_1", "path": "environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py", "identifier": "KernelApp.write_connection_file", "docstring": "write connection info to JSON file", "docstring_tokens": ["write", "connection", "info", "to", "JSON", "file"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258666}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/kps.py#L437-L480", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Draw all keypoints onto a given image.", "language": "python", "parameters": "(self, image, color=(0, 255, 0), alpha=1.0, size=3,\n                      copy=True, raise_if_out_of_image=False)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "0", ",", "255", ",", "0", ")", ",", "arg_3", "=", "1.0", ",", "arg_4", "=", "3", ",", "arg_5", "=", "True", ",", "arg_6", "=", "False", ")", ":", "arg_1", "=", "np", ".", "copy", "(", "arg_1", ")", "if", "arg_5", "else", "arg_1", "for", "arg_7", "in", "arg_0", ".", "keypoints", ":", "arg_1", "=", "arg_7", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "False", ",", "arg_6", "=", "arg_6", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=(0, 255, 0), arg_3=1.0, arg_4=3,\n                      arg_5=True, arg_6=False):\n        \"\"\"\n        Draw all keypoints onto a given image.\n\n        Each keypoint is marked by a square of a chosen color and size.\n\n        Parameters\n        ----------\n        image : (H,W,3) ndarray\n            The image onto which to draw the keypoints.\n            This image should usually have the same shape as\n            set in KeypointsOnImage.shape.\n\n        color : int or list of int or tuple of int or (3,) ndarray, optional\n            The RGB color of all keypoints. If a single int ``C``, then that is\n            equivalent to ``(C,C,C)``.\n\n        alpha : float, optional\n            The opacity of the drawn keypoint, where ``1.0`` denotes a fully\n            visible keypoint and ``0.0`` an invisible one.\n\n        size : int, optional\n            The size of each point. If set to ``C``, each square will have\n            size ``C x C``.\n\n        copy : bool, optional\n            Whether to copy the image before drawing the points.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an exception if any keypoint is outside of the image.\n\n        Returns\n        -------\n        image : (H,W,3) ndarray\n            Image with drawn keypoints.\n\n        \"\"\"\n        arg_1 = np.copy(arg_1) if arg_5 else arg_1\n        for arg_7 in arg_0.keypoints:\n            arg_1 = arg_7.Func(\n                arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=False,\n                arg_6=arg_6)\n        return arg_1", "path": "imgaug/augmentables/kps.py", "identifier": "KeypointsOnImage.draw_on_image", "docstring": "Draw all keypoints onto a given image.\n\n        Each keypoint is marked by a square of a chosen color and size.\n\n        Parameters\n        ----------\n        image : (H,W,3) ndarray\n            The image onto which to draw the keypoints.\n            This image should usually have the same shape as\n            set in KeypointsOnImage.shape.\n\n        color : int or list of int or tuple of int or (3,) ndarray, optional\n            The RGB color of all keypoints. If a single int ``C``, then that is\n            equivalent to ``(C,C,C)``.\n\n        alpha : float, optional\n            The opacity of the drawn keypoint, where ``1.0`` denotes a fully\n            visible keypoint and ``0.0`` an invisible one.\n\n        size : int, optional\n            The size of each point. If set to ``C``, each square will have\n            size ``C x C``.\n\n        copy : bool, optional\n            Whether to copy the image before drawing the points.\n\n        raise_if_out_of_image : bool, optional\n            Whether to raise an exception if any keypoint is outside of the image.\n\n        Returns\n        -------\n        image : (H,W,3) ndarray\n            Image with drawn keypoints.", "docstring_tokens": ["Draw", "all", "keypoints", "onto", "a", "given", "image", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 258667}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L35-L43", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Downloads a file", "language": "python", "parameters": "(filename, session)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "(", "'Downloading file %s'", "%", "arg_0", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "'sftp://'", "+", "ADDRESS", "+", "WORKING_DIR", ",", "arg_0", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "arg_0", ")", "arg_4", "=", "saga", ".", "filesystem", ".", "File", "(", "arg_2", ",", "arg_1", "=", "arg_1", ",", "flags", "=", "OVERWRITE", ")", "arg_4", ".", "copy", "(", "arg_3", ")", "print", "(", "'Transfer of `%s` to `%s` successful'", "%", "(", "arg_0", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Downloads a file \"\"\"\n    print('Downloading file %s' % arg_0)\n    arg_2 = os.path.join('sftp://' + ADDRESS + WORKING_DIR,\n                                 arg_0)\n    arg_3 = os.path.join(os.getcwd(), arg_0)\n    arg_4 = saga.filesystem.File(arg_2, arg_1=arg_1, flags=OVERWRITE)\n    arg_4.copy(arg_3)\n    print('Transfer of `%s` to `%s` successful' % (arg_0, arg_3))", "path": "examples/example_22_saga_python/start_saga.py", "identifier": "download_file", "docstring": "Downloads a file", "docstring_tokens": ["Downloads", "a", "file"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258668}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/essay_set.py#L110-L121", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Update the default prompt string, which is \"\".\n        prompt_text should be a string.\n        Returns the prompt as a confirmation.", "language": "python", "parameters": "(self, prompt_text)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "isinstance", "(", "arg_1", ",", "basestring", ")", ")", ":", "arg_0", ".", "_prompt", "=", "util_functions", ".", "sub_chars", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_prompt", "else", ":", "raise", "util_functions", ".", "InputError", "(", "arg_1", ",", "\"Invalid prompt. Need to enter a string value.\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Update the default prompt string, which is \"\".\n        prompt_text should be a string.\n        Returns the prompt as a confirmation.\n        \"\"\"\n        if(isinstance(arg_1, basestring)):\n            arg_0._prompt = util_functions.sub_chars(arg_1)\n            arg_3 = arg_0._prompt\n        else:\n            raise util_functions.InputError(arg_1, \"Invalid prompt. Need to enter a string value.\")\n        return arg_3", "path": "ease/essay_set.py", "identifier": "EssaySet.update_prompt", "docstring": "Update the default prompt string, which is \"\".\n        prompt_text should be a string.\n        Returns the prompt as a confirmation.", "docstring_tokens": ["Update", "the", "default", "prompt", "string", "which", "is", ".", "prompt_text", "should", "be", "a", "string", ".", "Returns", "the", "prompt", "as", "a", "confirmation", "."], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 258669}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py#L329-L332", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Create a new shell stream.", "language": "python", "parameters": "(self, kernel_id)", "return_statement": "return super(MappingKernelManager, self).create_shell_stream(kernel_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_check_kernel_id", "(", "arg_1", ")", "return", "super", "(", "MappingKernelManager", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create a new shell stream.\"\"\"\n        arg_0._check_kernel_id(arg_1)\n        return super(MappingKernelManager, arg_0).Func(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py", "identifier": "MappingKernelManager.create_shell_stream", "docstring": "Create a new shell stream.", "docstring_tokens": ["Create", "a", "new", "shell", "stream", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258670}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L286-L317", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Given a datetime in UTC, return local time", "language": "python", "parameters": "(self, dt)", "return_statement": "return enfold(dt_wall, fold=_fold)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "datetime", ")", ":", "raise", "TypeError", "(", "\"Func() requires a datetime argument\"", ")", "if", "arg_1", ".", "tzinfo", "is", "not", "arg_0", ":", "raise", "ValueError", "(", "\"dt.tzinfo is not self\"", ")", "arg_2", "=", "arg_0", ".", "transitions", "(", "arg_1", ".", "year", ")", "if", "arg_2", "is", "None", ":", "return", "arg_1", "+", "arg_0", ".", "utcoffset", "(", "arg_1", ")", "arg_3", ",", "arg_4", "=", "arg_2", "arg_3", "-=", "arg_0", ".", "_std_offset", "arg_4", "-=", "arg_0", ".", "_std_offset", "arg_5", "=", "(", "arg_3", ",", "arg_4", ")", "arg_6", "=", "arg_1", ".", "replace", "(", "tzinfo", "=", "None", ")", "arg_7", "=", "arg_0", ".", "_naive_isdst", "(", "arg_6", ",", "arg_5", ")", "if", "arg_7", ":", "arg_8", "=", "arg_1", "+", "arg_0", ".", "_dst_offset", "else", ":", "arg_8", "=", "arg_1", "+", "arg_0", ".", "_std_offset", "arg_9", "=", "int", "(", "not", "arg_7", "and", "arg_0", ".", "is_ambiguous", "(", "arg_8", ")", ")", "return", "enfold", "(", "arg_8", ",", "fold", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Given a datetime in UTC, return local time \"\"\"\n        if not isinstance(arg_1, datetime):\n            raise TypeError(\"Func() requires a datetime argument\")\n\n        if arg_1.tzinfo is not arg_0:\n            raise ValueError(\"dt.tzinfo is not self\")\n\n        # Get transitions - if there are none, fixed offset\n        arg_2 = arg_0.transitions(arg_1.year)\n        if arg_2 is None:\n            return arg_1 + arg_0.utcoffset(arg_1)\n\n        # Get the transition times in UTC\n        arg_3, arg_4 = arg_2\n\n        arg_3 -= arg_0._std_offset\n        arg_4 -= arg_0._std_offset\n\n        arg_5 = (arg_3, arg_4)\n        arg_6 = arg_1.replace(tzinfo=None)\n\n        arg_7 = arg_0._naive_isdst(arg_6, arg_5)\n\n        if arg_7:\n            arg_8 = arg_1 + arg_0._dst_offset\n        else:\n            arg_8 = arg_1 + arg_0._std_offset\n\n        arg_9 = int(not arg_7 and arg_0.is_ambiguous(arg_8))\n\n        return enfold(arg_8, fold=arg_9)", "path": "superjson/pkg/dateutil/tz/_common.py", "identifier": "tzrangebase.fromutc", "docstring": "Given a datetime in UTC, return local time", "docstring_tokens": ["Given", "a", "datetime", "in", "UTC", "return", "local", "time"], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 258671}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L244-L249", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns all items that match the given criteria and appear\n        after this Tag in the document.", "language": "python", "parameters": "(self, name=None, attrs={}, text=None, limit=None,\n                    **kwargs)", "return_statement": "return self._findAll(name, attrs, text, limit, self.nextGenerator,\n                             **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "return", "arg_0", ".", "_findAll", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_0", ".", "nextGenerator", ",", "**", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None, arg_2={}, arg_3=None, arg_4=None,\n                    **arg_5):\n        \"\"\"Returns all items that match the given criteria and appear\n        after this Tag in the document.\"\"\"\n        return arg_0._findAll(arg_1, arg_2, arg_3, arg_4, arg_0.nextGenerator,\n                             **arg_5)", "path": "lib/web/BeautifulSoup.py", "identifier": "PageElement.findAllNext", "docstring": "Returns all items that match the given criteria and appear\n        after this Tag in the document.", "docstring_tokens": ["Returns", "all", "items", "that", "match", "the", "given", "criteria", "and", "appear", "after", "this", "Tag", "in", "the", "document", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258672}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L586-L623", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Can make the trajectory behave as during a particular single run.", "language": "python", "parameters": "(self, name_or_idx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "arg_1", "is", "None", "or", "arg_1", "==", "arg_0", ".", "f_wildcard", "(", "'$'", ",", "-", "1", ")", "or", "arg_1", "==", "-", "1", ")", ":", "arg_0", ".", "f_restore_default", "(", ")", "else", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_0", ".", "_idx", "=", "arg_0", ".", "f_idx_to_run", "(", "arg_1", ")", "arg_0", ".", "_crun", "=", "arg_1", "else", ":", "arg_0", ".", "_crun", "=", "arg_0", ".", "f_idx_to_run", "(", "arg_1", ")", "arg_0", ".", "_idx", "=", "arg_1", "arg_0", ".", "_set_explored_parameters_to_idx", "(", "arg_0", ".", "v_idx", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Can make the trajectory behave as during a particular single run.\n\n        It allows easier data analysis.\n\n         Has the following effects:\n\n        *\n            `v_idx` and `v_crun` are set to the appropriate index and run name\n\n        *\n            All explored parameters are set to the corresponding value in the exploration\n            ranges, i.e. when you call :func:`~pypet.parameter.Parameter.f_get` (or fast access)\n            on them you will get in return the value at the corresponding `v_idx` position\n            in the exploration range.\n\n        *\n            If you perform a search in the trajectory tree, the trajectory will\n            only search the run subtree under *results* and *derived_parameters* with the\n            corresponding index.\n            For instance, if you use `Func('run_00000007')` or `Func(7)`\n            and search for `traj.results.z` this will search for `z` only in the subtree\n            `traj.results.run_00000007`. Yet, you can still explicitly name other subtrees,\n            i.e. `traj.results.run_00000004.z` will still work.\n\n        \"\"\"\n        if (arg_1 is None or arg_1 == arg_0.f_wildcard('$', -1) or\n                    arg_1 == -1):\n            arg_0.f_restore_default()\n        else:\n            if isinstance(arg_1, str):\n                arg_0._idx = arg_0.f_idx_to_run(arg_1)\n                arg_0._crun = arg_1\n            else:\n                arg_0._crun = arg_0.f_idx_to_run(arg_1)\n                arg_0._idx = arg_1\n\n            arg_0._set_explored_parameters_to_idx(arg_0.v_idx)", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_set_crun", "docstring": "Can make the trajectory behave as during a particular single run.\n\n        It allows easier data analysis.\n\n         Has the following effects:\n\n        *\n            `v_idx` and `v_crun` are set to the appropriate index and run name\n\n        *\n            All explored parameters are set to the corresponding value in the exploration\n            ranges, i.e. when you call :func:`~pypet.parameter.Parameter.f_get` (or fast access)\n            on them you will get in return the value at the corresponding `v_idx` position\n            in the exploration range.\n\n        *\n            If you perform a search in the trajectory tree, the trajectory will\n            only search the run subtree under *results* and *derived_parameters* with the\n            corresponding index.\n            For instance, if you use `f_set_crun('run_00000007')` or `f_set_crun(7)`\n            and search for `traj.results.z` this will search for `z` only in the subtree\n            `traj.results.run_00000007`. Yet, you can still explicitly name other subtrees,\n            i.e. `traj.results.run_00000004.z` will still work.", "docstring_tokens": ["Can", "make", "the", "trajectory", "behave", "as", "during", "a", "particular", "single", "run", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258673}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/statements.py#L112-L141", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Discover enclosure for list of statements", "language": "python", "parameters": "(statements: List['HdlStatement'],\n                                           outputs: List['HdlStatement'])", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "'HdlStatement'", "]", ",", "arg_2", ":", "arg_1", "[", "'HdlStatement'", "]", ")", ":", "arg_3", "=", "set", "(", ")", "if", "not", "arg_0", ":", "return", "arg_3", "for", "arg_4", "in", "arg_0", ":", "arg_4", ".", "_discover_enclosure", "(", ")", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "False", "for", "arg_4", "in", "arg_0", ":", "if", "arg_5", "in", "arg_4", ".", "_outputs", ":", "assert", "not", "arg_6", "arg_6", "=", "False", "if", "arg_5", "in", "arg_4", ".", "_enclosed_for", ":", "arg_3", ".", "add", "(", "arg_5", ")", "else", ":", "pass", "return", "arg_3"], "function": "def Func(arg_0: arg_1['HdlStatement'],\n                                           arg_2: arg_1['HdlStatement']):\n        \"\"\"\n        Discover enclosure for list of statements\n\n        :param statements: list of statements in one code branch\n        :param outputs: list of outputs which should be driven from this statement list\n        :return: set of signals for which this statement list have always some driver\n            (is enclosed)\n        \"\"\"\n        arg_3 = set()\n        if not arg_0:\n            return arg_3\n\n        for arg_4 in arg_0:\n            arg_4._discover_enclosure()\n\n        for arg_5 in arg_2:\n            arg_6 = False\n\n            for arg_4 in arg_0:\n                if arg_5 in arg_4._outputs:\n                    assert not arg_6\n                    arg_6 = False\n                    if arg_5 in arg_4._enclosed_for:\n                        arg_3.add(arg_5)\n                else:\n                    pass\n\n        return arg_3", "path": "hwt/hdl/statements.py", "identifier": "HdlStatement._discover_enclosure_for_statements", "docstring": "Discover enclosure for list of statements\n\n        :param statements: list of statements in one code branch\n        :param outputs: list of outputs which should be driven from this statement list\n        :return: set of signals for which this statement list have always some driver\n            (is enclosed)", "docstring_tokens": ["Discover", "enclosure", "for", "list", "of", "statements"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 258674}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/virtsocket.py#L432-L444", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "Watch out if we've been disconnected, in that case, kill\n        all the jobs.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "True", ":", "gevent", ".", "sleep", "(", "1.0", ")", "if", "not", "arg_0", ".", "connected", ":", "for", "arg_1", ",", "arg_2", "in", "list", "(", "six", ".", "iteritems", "(", "arg_0", ".", "active_ns", ")", ")", ":", "arg_2", ".", "recv_disconnect", "(", ")", "gevent", ".", "killall", "(", "arg_0", ".", "jobs", ")", "break"], "function": "def Func(arg_0):\n        \"\"\"Watch out if we've been disconnected, in that case, kill\n        all the jobs.\n\n        \"\"\"\n        while True:\n            gevent.sleep(1.0)\n            if not arg_0.connected:\n                for arg_1, arg_2 in list(six.iteritems(arg_0.active_ns)):\n                    arg_2.recv_disconnect()\n                # Killing Socket-level jobs\n                gevent.killall(arg_0.jobs)\n                break", "path": "socketio/virtsocket.py", "identifier": "Socket._watcher", "docstring": "Watch out if we've been disconnected, in that case, kill\n        all the jobs.", "docstring_tokens": ["Watch", "out", "if", "we", "ve", "been", "disconnected", "in", "that", "case", "kill", "all", "the", "jobs", "."], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 258675}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/atari_wrappers.py#L84-L95", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Reset only when lives are exhausted.\n        This way all states are still reachable even though lives are episodic,\n        and the learner need not know about any of this behind-the-scenes.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return obs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "arg_0", ".", "was_real_done", ":", "arg_2", "=", "arg_0", ".", "env", ".", "Func", "(", "**", "arg_1", ")", "else", ":", "arg_2", ",", "arg_3", ",", "arg_3", ",", "arg_3", "=", "arg_0", ".", "env", ".", "step", "(", "0", ")", "arg_0", ".", "lives", "=", "arg_0", ".", "env", ".", "unwrapped", ".", "ale", ".", "lives", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Reset only when lives are exhausted.\n        This way all states are still reachable even though lives are episodic,\n        and the learner need not know about any of this behind-the-scenes.\n        \"\"\"\n        if arg_0.was_real_done:\n            arg_2 = arg_0.env.Func(**arg_1)\n        else:\n            # no-op step to advance from terminal/lost life state\n            arg_2, arg_3, arg_3, arg_3 = arg_0.env.step(0)\n        arg_0.lives = arg_0.env.unwrapped.ale.lives()\n        return arg_2", "path": "baselines/common/atari_wrappers.py", "identifier": "EpisodicLifeEnv.reset", "docstring": "Reset only when lives are exhausted.\n        This way all states are still reachable even though lives are episodic,\n        and the learner need not know about any of this behind-the-scenes.", "docstring_tokens": ["Reset", "only", "when", "lives", "are", "exhausted", ".", "This", "way", "all", "states", "are", "still", "reachable", "even", "though", "lives", "are", "episodic", "and", "the", "learner", "need", "not", "know", "about", "any", "of", "this", "behind", "-", "the", "-", "scenes", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 258676}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/models/project.py#L30-L40", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Return storage `provider`.", "language": "python", "parameters": "(self, provider='osfstorage')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'osfFunc'", ")", ":", "arg_2", "=", "arg_0", ".", "_json", "(", "arg_0", ".", "_get", "(", "arg_0", ".", "_Funcs_url", ")", ",", "200", ")", "arg_2", "=", "arg_2", "[", "'data'", "]", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "arg_0", ".", "_get_attribute", "(", "arg_3", ",", "'attributes'", ",", "'provider'", ")", "if", "arg_4", "==", "arg_1", ":", "return", "Storage", "(", "arg_3", ",", "arg_0", ".", "session", ")", "raise", "RuntimeError", "(", "\"Project has no Func \"", "\"provider '{}'\"", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1='osfFunc'):\n        \"\"\"Return Func `provider`.\"\"\"\n        arg_2 = arg_0._json(arg_0._get(arg_0._Funcs_url), 200)\n        arg_2 = arg_2['data']\n        for arg_3 in arg_2:\n            arg_4 = arg_0._get_attribute(arg_3, 'attributes', 'provider')\n            if arg_4 == arg_1:\n                return Storage(arg_3, arg_0.session)\n\n        raise RuntimeError(\"Project has no Func \"\n                           \"provider '{}'\".format(arg_1))", "path": "osfclient/models/project.py", "identifier": "Project.storage", "docstring": "Return storage `provider`.", "docstring_tokens": ["Return", "storage", "provider", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 258677}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L536-L555", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Method which returns a dictionary of field statistics received from the\n    input source.", "language": "python", "parameters": "(self)", "return_statement": "return fieldStats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", ")", "arg_2", "=", "arg_0", ".", "_inputSource", ".", "getFieldNames", "(", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "dict", "(", ")", "arg_4", "[", "'min'", "]", "=", "arg_0", ".", "_inputSource", ".", "getFieldMin", "(", "arg_3", ")", "arg_4", "[", "'max'", "]", "=", "arg_0", ".", "_inputSource", ".", "getFieldMax", "(", "arg_3", ")", "arg_1", "[", "arg_3", "]", "=", "arg_4", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Method which returns a dictionary of field statistics received from the\n    input source.\n\n    Returns:\n\n      fieldStats: dict of dicts where the first level is the field name and\n        the second level is the statistic. ie. fieldStats['pounds']['min']\n\n    \"\"\"\n\n    arg_1 = dict()\n    arg_2 = arg_0._inputSource.getFieldNames()\n    for arg_3 in arg_2:\n      arg_4 = dict()\n      arg_4['min'] = arg_0._inputSource.getFieldMin(arg_3)\n      arg_4['max'] = arg_0._inputSource.getFieldMax(arg_3)\n      arg_1[arg_3] = arg_4\n    return arg_1", "path": "src/nupic/swarming/ModelRunner.py", "identifier": "OPFModelRunner._getFieldStats", "docstring": "Method which returns a dictionary of field statistics received from the\n    input source.\n\n    Returns:\n\n      fieldStats: dict of dicts where the first level is the field name and\n        the second level is the statistic. ie. fieldStats['pounds']['min']", "docstring_tokens": ["Method", "which", "returns", "a", "dictionary", "of", "field", "statistics", "received", "from", "the", "input", "source", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258678}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L269-L351", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is the simplified version not using tau.", "language": "python", "parameters": "(times, mags, errs, omega)", "return_statement": "return lspval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "1.0", "/", "(", "arg_2", "*", "arg_2", ")", "arg_5", "=", "npsum", "(", "arg_4", ")", "arg_6", "=", "arg_4", "/", "arg_5", "arg_7", "=", "npsin", "(", "arg_3", "*", "arg_0", ")", "arg_8", "=", "npcos", "(", "arg_3", "*", "arg_0", ")", "arg_9", "=", "arg_7", "*", "arg_7", "arg_10", "=", "arg_8", "*", "arg_8", "arg_11", "=", "arg_7", "*", "arg_8", "arg_12", "=", "npsum", "(", "arg_6", "*", "arg_1", ")", "arg_13", "=", "npsum", "(", "arg_6", "*", "arg_8", ")", "arg_14", "=", "npsum", "(", "arg_6", "*", "arg_7", ")", "arg_15", "=", "npsum", "(", "arg_6", "*", "arg_1", "*", "arg_1", ")", "arg_16", "=", "npsum", "(", "arg_6", "*", "arg_1", "*", "arg_8", ")", "arg_17", "=", "npsum", "(", "arg_6", "*", "arg_1", "*", "arg_7", ")", "arg_18", "=", "npsum", "(", "arg_6", "*", "arg_10", ")", "arg_19", "=", "npsum", "(", "arg_6", "*", "arg_11", ")", "arg_20", "=", "arg_15", "-", "arg_12", "*", "arg_12", "arg_21", "=", "arg_16", "-", "arg_12", "*", "arg_13", "arg_22", "=", "arg_17", "-", "arg_12", "*", "arg_14", "arg_23", "=", "arg_18", "-", "arg_13", "*", "arg_13", "arg_24", "=", "1", "-", "arg_18", "-", "arg_14", "*", "arg_14", "arg_25", "=", "arg_19", "-", "arg_13", "*", "arg_14", "arg_26", "=", "arg_23", "*", "arg_24", "-", "arg_25", "*", "arg_25", "arg_27", "=", "(", "arg_24", "*", "arg_21", "*", "arg_21", "+", "arg_23", "*", "arg_22", "*", "arg_22", "-", "2.0", "*", "arg_25", "*", "arg_21", "*", "arg_22", ")", "/", "(", "arg_20", "*", "arg_26", ")", "return", "arg_27"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''\n    This is the simplified version not using tau.\n\n    The relations used are::\n\n        W = sum (1.0/(errs*errs) )\n        w_i = (1/W)*(1/(errs*errs))\n\n        Y = sum( w_i*y_i )\n        C = sum( w_i*cos(wt_i) )\n        S = sum( w_i*sin(wt_i) )\n\n        YY = sum( w_i*y_i*y_i ) - Y*Y\n        YC = sum( w_i*y_i*cos(wt_i) ) - Y*C\n        YS = sum( w_i*y_i*sin(wt_i) ) - Y*S\n\n        CpC = sum( w_i*cos(w_t_i)*cos(w_t_i) )\n        CC = CpC - C*C\n        SS = (1 - CpC) - S*S\n        CS = sum( w_i*cos(w_t_i)*sin(w_t_i) ) - C*S\n\n        D(omega) = CC*SS - CS*CS\n        P(omega) = (SS*YC*YC + CC*YS*YS - 2.0*CS*YC*YS)/(YY*D)\n\n    Parameters\n    ----------\n\n    times,mags,errs : np.array\n        The time-series to calculate the periodogram value for.\n\n    omega : float\n        The frequency to calculate the periodogram value at.\n\n    Returns\n    -------\n\n    periodogramvalue : float\n        The normalized periodogram at the specified test frequency `omega`.\n\n    '''\n\n    arg_4 = 1.0/(arg_2*arg_2)\n\n    arg_5 = npsum(arg_4)\n    arg_6 = arg_4/arg_5\n\n    arg_7 = npsin(arg_3*arg_0)\n    arg_8 = npcos(arg_3*arg_0)\n\n    arg_9 = arg_7*arg_7\n    arg_10 = arg_8*arg_8\n    arg_11 = arg_7*arg_8\n\n    # calculate some more sums and terms\n    arg_12 = npsum( arg_6*arg_1 )\n    arg_13 = npsum( arg_6*arg_8 )\n    arg_14 = npsum( arg_6*arg_7 )\n\n    arg_15 = npsum( arg_6*arg_1*arg_1)\n\n    arg_16 = npsum( arg_6*arg_1*arg_8 )\n    arg_17 = npsum( arg_6*arg_1*arg_7 )\n\n    arg_18 = npsum( arg_6*arg_10 )\n    # SpS = npsum( wi*sin2_omegat )\n\n    arg_19 = npsum( arg_6*arg_11 )\n\n    # the final terms\n    arg_20 = arg_15 - arg_12*arg_12\n    arg_21 = arg_16 - arg_12*arg_13\n    arg_22 = arg_17 - arg_12*arg_14\n    arg_23 = arg_18 - arg_13*arg_13\n    arg_24 = 1 - arg_18 - arg_14*arg_14  # use SpS = 1 - CpC\n    arg_25 = arg_19 - arg_13*arg_14\n\n    # P(omega) = (SS*YC*YC + CC*YS*YS - 2.0*CS*YC*YS)/(YY*D)\n    # D(omega) = CC*SS - CS*CS\n    arg_26 = arg_23*arg_24 - arg_25*arg_25\n    arg_27 = (arg_24*arg_21*arg_21 + arg_23*arg_22*arg_22 - 2.0*arg_25*arg_21*arg_22)/(arg_20*arg_26)\n\n    return arg_27", "path": "astrobase/periodbase/zgls.py", "identifier": "generalized_lsp_value_notau", "docstring": "This is the simplified version not using tau.\n\n    The relations used are::\n\n        W = sum (1.0/(errs*errs) )\n        w_i = (1/W)*(1/(errs*errs))\n\n        Y = sum( w_i*y_i )\n        C = sum( w_i*cos(wt_i) )\n        S = sum( w_i*sin(wt_i) )\n\n        YY = sum( w_i*y_i*y_i ) - Y*Y\n        YC = sum( w_i*y_i*cos(wt_i) ) - Y*C\n        YS = sum( w_i*y_i*sin(wt_i) ) - Y*S\n\n        CpC = sum( w_i*cos(w_t_i)*cos(w_t_i) )\n        CC = CpC - C*C\n        SS = (1 - CpC) - S*S\n        CS = sum( w_i*cos(w_t_i)*sin(w_t_i) ) - C*S\n\n        D(omega) = CC*SS - CS*CS\n        P(omega) = (SS*YC*YC + CC*YS*YS - 2.0*CS*YC*YS)/(YY*D)\n\n    Parameters\n    ----------\n\n    times,mags,errs : np.array\n        The time-series to calculate the periodogram value for.\n\n    omega : float\n        The frequency to calculate the periodogram value at.\n\n    Returns\n    -------\n\n    periodogramvalue : float\n        The normalized periodogram at the specified test frequency `omega`.", "docstring_tokens": ["This", "is", "the", "simplified", "version", "not", "using", "tau", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258679}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L604-L657", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Save a file", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "import", "StringIO", "as", "pystringIO", "except", "ImportError", ":", "import", "io", "as", "pystringIO", "if", "not", "hasattr", "(", "arg_1", ",", "'name'", ")", "or", "not", "hasattr", "(", "arg_1", ",", "'mode'", ")", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle files that do not map to an actual file\"", ")", "if", "arg_1", "is", "sys", ".", "stdout", ":", "return", "arg_0", ".", "save_reduce", "(", "getattr", ",", "(", "sys", ",", "'stdout'", ")", ",", "arg_1", "=", "arg_1", ")", "if", "arg_1", "is", "sys", ".", "stderr", ":", "return", "arg_0", ".", "save_reduce", "(", "getattr", ",", "(", "sys", ",", "'stderr'", ")", ",", "arg_1", "=", "arg_1", ")", "if", "arg_1", "is", "sys", ".", "stdin", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle standard input\"", ")", "if", "hasattr", "(", "arg_1", ",", "'isatty'", ")", "and", "arg_1", ".", "isatty", "(", ")", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle files that map to tty objects\"", ")", "if", "'r'", "not", "in", "arg_1", ".", "mode", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle files that are not opened for reading\"", ")", "arg_2", "=", "arg_1", ".", "name", "try", ":", "arg_3", "=", "os", ".", "stat", "(", "arg_2", ")", ".", "st_size", "except", "OSError", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle file %s as it cannot be stat\"", "%", "arg_2", ")", "if", "arg_1", ".", "closed", ":", "arg_4", "=", "pystringIO", ".", "StringIO", "(", "\"\"", ")", "arg_4", ".", "close", "(", ")", "elif", "not", "arg_3", ":", "arg_4", "=", "pystringIO", ".", "StringIO", "(", "\"\"", ")", "try", ":", "arg_5", "=", "file", "(", "arg_2", ")", "arg_6", "=", "arg_5", ".", "read", "(", "1", ")", "except", "IOError", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle file %s as it cannot be read\"", "%", "arg_2", ")", "arg_5", ".", "close", "(", ")", "if", "arg_6", "!=", "''", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle file %s as it does not appear to map to a physical, real file\"", "%", "arg_2", ")", "else", ":", "try", ":", "arg_5", "=", "file", "(", "arg_2", ")", "arg_7", "=", "arg_5", ".", "read", "(", ")", "arg_5", ".", "close", "(", ")", "except", "IOError", ":", "raise", "pickle", ".", "PicklingError", "(", "\"Cannot pickle file %s as it cannot be read\"", "%", "arg_2", ")", "arg_4", "=", "pystringIO", ".", "StringIO", "(", "arg_7", ")", "arg_8", "=", "arg_1", ".", "tell", "(", ")", "arg_4", ".", "seek", "(", "arg_8", ")", "arg_4", ".", "name", "=", "arg_2", "arg_0", ".", "save", "(", "arg_4", ")", "arg_0", ".", "memoize", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1): # pylint: disable=too-many-branches\n    \"\"\"Save a file\"\"\"\n    try:\n      import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute\n    except ImportError:\n      import io as pystringIO # pylint: disable=reimported\n\n    if not hasattr(arg_1, 'name') or  not hasattr(arg_1, 'mode'):\n      raise pickle.PicklingError(\"Cannot pickle files that do not map to an actual file\")\n    if arg_1 is sys.stdout:\n      return arg_0.save_reduce(getattr, (sys, 'stdout'), arg_1=arg_1)\n    if arg_1 is sys.stderr:\n      return arg_0.save_reduce(getattr, (sys, 'stderr'), arg_1=arg_1)\n    if arg_1 is sys.stdin:\n      raise pickle.PicklingError(\"Cannot pickle standard input\")\n    if  hasattr(arg_1, 'isatty') and arg_1.isatty():\n      raise pickle.PicklingError(\"Cannot pickle files that map to tty objects\")\n    if 'r' not in arg_1.mode:\n      raise pickle.PicklingError(\"Cannot pickle files that are not opened for reading\")\n    arg_2 = arg_1.name\n    try:\n      arg_3 = os.stat(arg_2).st_size\n    except OSError:\n      raise pickle.PicklingError(\"Cannot pickle file %s as it cannot be stat\" % arg_2)\n\n    if arg_1.closed:\n      #create an empty closed string io\n      arg_4 = pystringIO.StringIO(\"\")\n      arg_4.close()\n    elif not arg_3: #empty file\n      arg_4 = pystringIO.StringIO(\"\")\n      try:\n        arg_5 = file(arg_2)\n        arg_6 = arg_5.read(1)\n      except IOError:\n        raise pickle.PicklingError(\"Cannot pickle file %s as it cannot be read\" % arg_2)\n      arg_5.close()\n      if arg_6 != '':\n        raise pickle.PicklingError(\n            \"Cannot pickle file %s as it does not appear to map to a physical, real file\" % arg_2)\n    else:\n      try:\n        arg_5 = file(arg_2)\n        arg_7 = arg_5.read()\n        arg_5.close()\n      except IOError:\n        raise pickle.PicklingError(\"Cannot pickle file %s as it cannot be read\" % arg_2)\n      arg_4 = pystringIO.StringIO(arg_7)\n      arg_8 = arg_1.tell()\n      arg_4.seek(arg_8)\n\n    arg_4.name = arg_2\n    arg_0.save(arg_4)\n    arg_0.memoize(arg_1)", "path": "heronpy/api/cloudpickle.py", "identifier": "CloudPickler.save_file", "docstring": "Save a file", "docstring_tokens": ["Save", "a", "file"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258680}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3427-L3446", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds an empty parameter group under the current node.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self._nn_interface._add_generic(self, type_name=PARAMETER_GROUP,\n                                               group_type_name=PARAMETER_GROUP,\n                                               args=args, kwargs=kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "_nn_interface", ".", "_add_generic", "(", "arg_0", ",", "type_name", "=", "PARAMETER_GROUP", ",", "group_type_name", "=", "PARAMETER_GROUP", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Adds an empty parameter group under the current node.\n\n        Can be called with ``Func('MyName', 'this is an informative comment')``\n        or ``Func(name='MyName', comment='This is an informative comment')``\n        or with a given new group instance:\n        ``Func(ParameterGroup('MyName', comment='This is a comment'))``.\n\n        Adds the full name of the current node as prefix to the name of the group.\n        If current node is the trajectory (root), the prefix `'parameters'`\n        is added to the full name.\n\n        The `name` can also contain subgroups separated via colons, for example:\n        `name=subgroup1.subgroup2.subgroup3`. These other parent groups will be automatically\n        created.\n\n        \"\"\"\n        return arg_0._nn_interface._add_generic(arg_0, type_name=PARAMETER_GROUP,\n                                               group_type_name=PARAMETER_GROUP,\n                                               arg_1=arg_1, arg_2=arg_2)", "path": "pypet/naturalnaming.py", "identifier": "ParameterGroup.f_add_parameter_group", "docstring": "Adds an empty parameter group under the current node.\n\n        Can be called with ``f_add_parameter_group('MyName', 'this is an informative comment')``\n        or ``f_add_parameter_group(name='MyName', comment='This is an informative comment')``\n        or with a given new group instance:\n        ``f_add_parameter_group(ParameterGroup('MyName', comment='This is a comment'))``.\n\n        Adds the full name of the current node as prefix to the name of the group.\n        If current node is the trajectory (root), the prefix `'parameters'`\n        is added to the full name.\n\n        The `name` can also contain subgroups separated via colons, for example:\n        `name=subgroup1.subgroup2.subgroup3`. These other parent groups will be automatically\n        created.", "docstring_tokens": ["Adds", "an", "empty", "parameter", "group", "under", "the", "current", "node", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258681}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2802-L2833", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Sign a data string using the given key and message digest.", "language": "python", "parameters": "(pkey, data, digest)", "return_statement": "return _ffi.buffer(signature_buffer, signature_length[0])[:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "_text_to_bytes_and_warn", "(", "\"data\"", ",", "arg_1", ")", "arg_3", "=", "_lib", ".", "EVP_get_digestbyname", "(", "_byte_string", "(", "arg_2", ")", ")", "if", "arg_3", "==", "_ffi", ".", "NULL", ":", "raise", "ValueError", "(", "\"No such digest method\"", ")", "arg_4", "=", "_lib", ".", "Cryptography_EVP_MD_CTX_new", "(", ")", "arg_4", "=", "_ffi", ".", "gc", "(", "arg_4", ",", "_lib", ".", "Cryptography_EVP_MD_CTX_free", ")", "_lib", ".", "EVP_SignInit", "(", "arg_4", ",", "arg_3", ")", "_lib", ".", "EVP_SignUpdate", "(", "arg_4", ",", "arg_1", ",", "len", "(", "arg_1", ")", ")", "arg_5", "=", "_lib", ".", "EVP_PKEY_size", "(", "arg_0", ".", "_pkey", ")", "_openssl_assert", "(", "arg_5", ">", "0", ")", "arg_6", "=", "_ffi", ".", "new", "(", "\"unFunced char[]\"", ",", "arg_5", ")", "arg_7", "=", "_ffi", ".", "new", "(", "\"unFunced int *\"", ")", "arg_8", "=", "_lib", ".", "EVP_SignFinal", "(", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_0", ".", "_pkey", ")", "_openssl_assert", "(", "arg_8", "==", "1", ")", "return", "_ffi", ".", "buffer", "(", "arg_6", ",", "arg_7", "[", "0", "]", ")", "[", ":", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Sign a data string using the given key and message digest.\n\n    :param pkey: PKey to Func with\n    :param data: data to be Funced\n    :param digest: message digest to use\n    :return: Funcature\n\n    .. versionadded:: 0.11\n    \"\"\"\n    arg_1 = _text_to_bytes_and_warn(\"data\", arg_1)\n\n    arg_3 = _lib.EVP_get_digestbyname(_byte_string(arg_2))\n    if arg_3 == _ffi.NULL:\n        raise ValueError(\"No such digest method\")\n\n    arg_4 = _lib.Cryptography_EVP_MD_CTX_new()\n    arg_4 = _ffi.gc(arg_4, _lib.Cryptography_EVP_MD_CTX_free)\n\n    _lib.EVP_SignInit(arg_4, arg_3)\n    _lib.EVP_SignUpdate(arg_4, arg_1, len(arg_1))\n\n    arg_5 = _lib.EVP_PKEY_size(arg_0._pkey)\n    _openssl_assert(arg_5 > 0)\n    arg_6 = _ffi.new(\"unFunced char[]\", arg_5)\n    arg_7 = _ffi.new(\"unFunced int *\")\n    arg_8 = _lib.EVP_SignFinal(\n        arg_4, arg_6, arg_7, arg_0._pkey)\n    _openssl_assert(arg_8 == 1)\n\n    return _ffi.buffer(arg_6, arg_7[0])[:]", "path": "src/OpenSSL/crypto.py", "identifier": "sign", "docstring": "Sign a data string using the given key and message digest.\n\n    :param pkey: PKey to sign with\n    :param data: data to be signed\n    :param digest: message digest to use\n    :return: signature\n\n    .. versionadded:: 0.11", "docstring_tokens": ["Sign", "a", "data", "string", "using", "the", "given", "key", "and", "message", "digest", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 258682}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/pretty.py#L537-L565", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Factory that returns a pprint function used by the default pprint of\n    dicts and dict proxies.", "language": "python", "parameters": "(start, end, basetype=None)", "return_statement": "return inner", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "def", "inner", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "type", "(", "arg_3", ")", "if", "arg_2", "is", "not", "None", "and", "arg_6", "is", "not", "arg_2", "and", "arg_6", ".", "__repr__", "!=", "arg_2", ".", "__repr__", ":", "return", "arg_4", ".", "text", "(", "arg_6", ".", "__repr__", "(", "arg_3", ")", ")", "if", "arg_5", ":", "return", "arg_4", ".", "text", "(", "'{...}'", ")", "arg_4", ".", "begin_group", "(", "1", ",", "arg_0", ")", "arg_7", "=", "arg_3", ".", "keys", "(", ")", "try", ":", "arg_7", ".", "sort", "(", ")", "except", "Exception", ",", "e", ":", "pass", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_7", ")", ":", "if", "arg_8", ":", "arg_4", ".", "text", "(", "','", ")", "arg_4", ".", "breakable", "(", ")", "arg_4", ".", "pretty", "(", "arg_9", ")", "arg_4", ".", "text", "(", "': '", ")", "arg_4", ".", "pretty", "(", "arg_3", "[", "arg_9", "]", ")", "arg_4", ".", "end_group", "(", "1", ",", "arg_1", ")", "return", "inner"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Factory that returns a pprint function used by the default pprint of\n    dicts and dict proxies.\n    \"\"\"\n    def inner(arg_3, arg_4, arg_5):\n        arg_6 = type(arg_3)\n        if arg_2 is not None and arg_6 is not arg_2 and arg_6.__repr__ != arg_2.__repr__:\n            # If the subclass provides its own repr, use it instead.\n            return arg_4.text(arg_6.__repr__(arg_3))\n\n        if arg_5:\n            return arg_4.text('{...}')\n        arg_4.begin_group(1, arg_0)\n        arg_7 = arg_3.keys()\n        try:\n            arg_7.sort()\n        except Exception, e:\n            # Sometimes the keys don't sort.\n            pass\n        for arg_8, arg_9 in enumerate(arg_7):\n            if arg_8:\n                arg_4.text(',')\n                arg_4.breakable()\n            arg_4.pretty(arg_9)\n            arg_4.text(': ')\n            arg_4.pretty(arg_3[arg_9])\n        arg_4.end_group(1, arg_1)\n    return inner", "path": "environment/lib/python2.7/site-packages/IPython/lib/pretty.py", "identifier": "_dict_pprinter_factory", "docstring": "Factory that returns a pprint function used by the default pprint of\n    dicts and dict proxies.", "docstring_tokens": ["Factory", "that", "returns", "a", "pprint", "function", "used", "by", "the", "default", "pprint", "of", "dicts", "and", "dict", "proxies", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258683}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L1186-L1201", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Returns a Bool of whether to terminate.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_has_run", ":", "return", "False", "else", ":", "arg_1", "=", "arg_0", ".", "check_completion", "(", ")", "arg_1", "|=", "(", "arg_0", ".", "_num_iter", ">=", "arg_0", ".", "max_iter", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a Bool of whether to terminate.\n\n        Checks whether a satisfactory minimum has been found or whether\n        too many iterations have occurred.\n        \"\"\"\n        if not arg_0._has_run:\n            return False\n        else:\n            #1-3. errtol, paramtol, model cosine low enough?\n            arg_1 = arg_0.check_completion()\n\n            #4. too many iterations??\n            arg_1 |= (arg_0._num_iter >= arg_0.max_iter)\n            return arg_1", "path": "peri/opt/optimize.py", "identifier": "LMEngine.check_terminate", "docstring": "Returns a Bool of whether to terminate.\n\n        Checks whether a satisfactory minimum has been found or whether\n        too many iterations have occurred.", "docstring_tokens": ["Returns", "a", "Bool", "of", "whether", "to", "terminate", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 258684}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/monitoring/monitoring.py#L389-L448", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Internal\n    Monitors the Parsl task's resources by pointing psutil to the task's pid and watching it and its children.", "language": "python", "parameters": "(pid, task_id, monitoring_hub_url, run_id, sleep_dur=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "10", ")", ":", "import", "psutil", "arg_5", "=", "UDPRadio", "(", "arg_2", ",", "source_id", "=", "arg_1", ")", "arg_6", "=", "[", "\"cpu_num\"", ",", "'cpu_percent'", ",", "'create_time'", ",", "'cwd'", ",", "'exe'", ",", "'memory_percent'", ",", "'nice'", ",", "'name'", ",", "'num_threads'", ",", "'pid'", ",", "'ppid'", ",", "'status'", ",", "'username'", "]", "arg_7", "=", "[", "'cpu_percent'", ",", "'memory_percent'", ",", "'num_threads'", "]", "arg_8", "=", "psutil", ".", "Process", "(", "arg_0", ")", "arg_8", ".", "cpu_percent", "(", ")", "arg_9", "=", "True", "while", "True", ":", "try", ":", "arg_10", "=", "{", "\"psutil_process_\"", "+", "str", "(", "arg_13", ")", ":", "arg_14", "for", "arg_13", ",", "arg_14", "in", "arg_8", ".", "as_dict", "(", ")", ".", "items", "(", ")", "if", "arg_13", "in", "arg_6", "}", "arg_10", "[", "\"run_id\"", "]", "=", "arg_3", "arg_10", "[", "\"task_id\"", "]", "=", "arg_1", "arg_10", "[", "'resource_Funcing_interval'", "]", "=", "arg_4", "arg_10", "[", "'first_msg'", "]", "=", "arg_9", "arg_10", "[", "'timestamp'", "]", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "arg_11", "=", "arg_8", ".", "children", "(", "recursive", "=", "True", ")", "arg_10", "[", "\"psutil_cpu_count\"", "]", "=", "psutil", ".", "cpu_count", "(", ")", "arg_10", "[", "'psutil_process_memory_virtual'", "]", "=", "arg_8", ".", "memory_info", "(", ")", ".", "vms", "arg_10", "[", "'psutil_process_memory_resident'", "]", "=", "arg_8", ".", "memory_info", "(", ")", ".", "rss", "arg_10", "[", "'psutil_process_time_user'", "]", "=", "arg_8", ".", "cpu_times", "(", ")", ".", "user", "arg_10", "[", "'psutil_process_time_system'", "]", "=", "arg_8", ".", "cpu_times", "(", ")", ".", "system", "arg_10", "[", "'psutil_process_children_count'", "]", "=", "len", "(", "arg_11", ")", "try", ":", "arg_10", "[", "'psutil_process_disk_write'", "]", "=", "arg_8", ".", "io_counters", "(", ")", ".", "write_bytes", "arg_10", "[", "'psutil_process_disk_read'", "]", "=", "arg_8", ".", "io_counters", "(", ")", ".", "read_bytes", "except", "psutil", ".", "_exceptions", ".", "AccessDenied", ":", "arg_10", "[", "'psutil_process_disk_write'", "]", "=", "0", "arg_10", "[", "'psutil_process_disk_read'", "]", "=", "0", "for", "arg_12", "in", "arg_11", ":", "for", "arg_13", ",", "arg_14", "in", "arg_12", ".", "as_dict", "(", "attrs", "=", "arg_7", ")", ".", "items", "(", ")", ":", "arg_10", "[", "'psutil_process_'", "+", "str", "(", "arg_13", ")", "]", "+=", "arg_14", "arg_10", "[", "'psutil_process_time_user'", "]", "+=", "arg_12", ".", "cpu_times", "(", ")", ".", "user", "arg_10", "[", "'psutil_process_time_system'", "]", "+=", "arg_12", ".", "cpu_times", "(", ")", ".", "system", "arg_10", "[", "'psutil_process_memory_virtual'", "]", "+=", "arg_12", ".", "memory_info", "(", ")", ".", "vms", "arg_10", "[", "'psutil_process_memory_resident'", "]", "+=", "arg_12", ".", "memory_info", "(", ")", ".", "rss", "try", ":", "arg_10", "[", "'psutil_process_disk_write'", "]", "+=", "arg_12", ".", "io_counters", "(", ")", ".", "write_bytes", "arg_10", "[", "'psutil_process_disk_read'", "]", "+=", "arg_12", ".", "io_counters", "(", ")", ".", "read_bytes", "except", "psutil", ".", "_exceptions", ".", "AccessDenied", ":", "arg_10", "[", "'psutil_process_disk_write'", "]", "+=", "0", "arg_10", "[", "'psutil_process_disk_read'", "]", "+=", "0", "finally", ":", "arg_5", ".", "send", "(", "MessageType", ".", "TASK_INFO", ",", "arg_1", ",", "arg_10", ")", "time", ".", "sleep", "(", "arg_4", ")", "arg_9", "=", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=10):\n    \"\"\"Internal\n    Monitors the Parsl task's resources by pointing psutil to the task's pid and watching it and its children.\n    \"\"\"\n    import psutil\n\n    arg_5 = UDPRadio(arg_2,\n                     source_id=arg_1)\n\n    # these values are simple to log. Other information is available in special formats such as memory below.\n    arg_6 = [\"cpu_num\", 'cpu_percent', 'create_time', 'cwd', 'exe', 'memory_percent', 'nice', 'name', 'num_threads', 'pid', 'ppid', 'status', 'username']\n    # values that can be summed up to see total resources used by task process and its children\n    arg_7 = ['cpu_percent', 'memory_percent', 'num_threads']\n\n    arg_8 = psutil.Process(arg_0)\n    arg_8.cpu_percent()\n\n    arg_9 = True\n\n    while True:\n        try:\n            arg_10 = {\"psutil_process_\" + str(arg_13): arg_14 for arg_13, arg_14 in arg_8.as_dict().items() if arg_13 in arg_6}\n            arg_10[\"run_id\"] = arg_3\n            arg_10[\"task_id\"] = arg_1\n            arg_10['resource_Funcing_interval'] = arg_4\n            arg_10['first_msg'] = arg_9\n            arg_10['timestamp'] = datetime.datetime.now()\n            arg_11 = arg_8.children(recursive=True)\n            arg_10[\"psutil_cpu_count\"] = psutil.cpu_count()\n            arg_10['psutil_process_memory_virtual'] = arg_8.memory_info().vms\n            arg_10['psutil_process_memory_resident'] = arg_8.memory_info().rss\n            arg_10['psutil_process_time_user'] = arg_8.cpu_times().user\n            arg_10['psutil_process_time_system'] = arg_8.cpu_times().system\n            arg_10['psutil_process_children_count'] = len(arg_11)\n            try:\n                arg_10['psutil_process_disk_write'] = arg_8.io_counters().write_bytes\n                arg_10['psutil_process_disk_read'] = arg_8.io_counters().read_bytes\n            except psutil._exceptions.AccessDenied:\n                # occassionally pid temp files that hold this information are unvailable to be read so set to zero\n                arg_10['psutil_process_disk_write'] = 0\n                arg_10['psutil_process_disk_read'] = 0\n            for arg_12 in arg_11:\n                for arg_13, arg_14 in arg_12.as_dict(attrs=arg_7).items():\n                    arg_10['psutil_process_' + str(arg_13)] += arg_14\n                arg_10['psutil_process_time_user'] += arg_12.cpu_times().user\n                arg_10['psutil_process_time_system'] += arg_12.cpu_times().system\n                arg_10['psutil_process_memory_virtual'] += arg_12.memory_info().vms\n                arg_10['psutil_process_memory_resident'] += arg_12.memory_info().rss\n                try:\n                    arg_10['psutil_process_disk_write'] += arg_12.io_counters().write_bytes\n                    arg_10['psutil_process_disk_read'] += arg_12.io_counters().read_bytes\n                except psutil._exceptions.AccessDenied:\n                    # occassionally pid temp files that hold this information are unvailable to be read so add zero\n                    arg_10['psutil_process_disk_write'] += 0\n                    arg_10['psutil_process_disk_read'] += 0\n\n        finally:\n            arg_5.send(MessageType.TASK_INFO, arg_1, arg_10)\n            time.sleep(arg_4)\n            arg_9 = False", "path": "parsl/monitoring/monitoring.py", "identifier": "monitor", "docstring": "Internal\n    Monitors the Parsl task's resources by pointing psutil to the task's pid and watching it and its children.", "docstring_tokens": ["Internal", "Monitors", "the", "Parsl", "task", "s", "resources", "by", "pointing", "psutil", "to", "the", "task", "s", "pid", "and", "watching", "it", "and", "its", "children", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 258685}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L149-L157", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Plot one digit frequency counts using matplotlib.", "language": "python", "parameters": "(f1)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "plt", ".", "plot", "(", "arg_0", ",", "'bo-'", ")", "plt", ".", "title", "(", "'Single digit counts in pi'", ")", "plt", ".", "xlabel", "(", "'Digit'", ")", "plt", ".", "ylabel", "(", "'Count'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Plot one digit frequency counts using matplotlib.\n    \"\"\"\n    arg_1 = plt.plot(arg_0,'bo-')\n    plt.title('Single digit counts in pi')\n    plt.xlabel('Digit')\n    plt.ylabel('Count')\n    return arg_1", "path": "environment/share/doc/ipython/examples/parallel/pi/pidigits.py", "identifier": "plot_one_digit_freqs", "docstring": "Plot one digit frequency counts using matplotlib.", "docstring_tokens": ["Plot", "one", "digit", "frequency", "counts", "using", "matplotlib", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258686}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L636-L655", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets the package verification code, if not already set.\n        code - A string.\n        Raises CardinalityError if already defined.\n        Raises OrderError if no package previously defined.\n        Raises Value error if doesn't match verifcode form", "language": "python", "parameters": "(self, doc, code)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "assert_package_exists", "(", ")", "if", "not", "arg_0", ".", "package_verif_set", ":", "arg_0", ".", "package_verif_set", "=", "True", "arg_4", "=", "arg_0", ".", "VERIF_CODE_REGEX", ".", "match", "(", "arg_2", ")", "if", "arg_4", ":", "arg_1", ".", "package", ".", "verif_code", "=", "arg_4", ".", "group", "(", "arg_0", ".", "VERIF_CODE_CODE_GRP", ")", "if", "arg_4", ".", "group", "(", "arg_0", ".", "VERIF_CODE_EXC_FILES_GRP", ")", "is", "not", "None", ":", "arg_1", ".", "package", ".", "verif_exc_files", "=", "arg_4", ".", "group", "(", "arg_0", ".", "VERIF_CODE_EXC_FILES_GRP", ")", ".", "split", "(", "','", ")", "return", "True", "else", ":", "raise", "SPDXValueError", "(", "'Package::VerificationCode'", ")", "else", ":", "raise", "CardinalityError", "(", "'Package::VerificationCode'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets the package verification code, if not already set.\n        code - A string.\n        Raises CardinalityError if already defined.\n        Raises OrderError if no package previously defined.\n        Raises Value error if doesn't match verifcode form\n        \"\"\"\n        arg_0.assert_package_exists()\n        if not arg_0.package_verif_set:\n            arg_0.package_verif_set = True\n            arg_4 = arg_0.VERIF_CODE_REGEX.match(arg_2)\n            if arg_4:\n                arg_1.package.verif_code = arg_4.group(arg_0.VERIF_CODE_CODE_GRP)\n                if arg_4.group(arg_0.VERIF_CODE_EXC_FILES_GRP) is not None:\n                    arg_1.package.verif_exc_files = arg_4.group(arg_0.VERIF_CODE_EXC_FILES_GRP).split(',')\n                return True\n            else:\n                raise SPDXValueError('Package::VerificationCode')\n        else:\n            raise CardinalityError('Package::VerificationCode')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "PackageBuilder.set_pkg_verif_code", "docstring": "Sets the package verification code, if not already set.\n        code - A string.\n        Raises CardinalityError if already defined.\n        Raises OrderError if no package previously defined.\n        Raises Value error if doesn't match verifcode form", "docstring_tokens": ["Sets", "the", "package", "verification", "code", "if", "not", "already", "set", ".", "code", "-", "A", "string", ".", "Raises", "CardinalityError", "if", "already", "defined", ".", "Raises", "OrderError", "if", "no", "package", "previously", "defined", ".", "Raises", "Value", "error", "if", "doesn", "t", "match", "verifcode", "form"], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 258687}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_config.py#L172-L190", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Create a profile for the given message type.", "language": "python", "parameters": "(msg_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "lower", "(", ")", "if", "arg_0", "not", "in", "CONFIG", ".", "keys", "(", ")", ":", "raise", "UnsupportedMessageTypeError", "(", "arg_0", ")", "display_required_items", "(", "arg_0", ")", "if", "get_user_ack", "(", ")", ":", "arg_1", "=", "input", "(", "\"Profile Name: \"", ")", "arg_2", "=", "get_data_from_user", "(", "arg_0", ")", "arg_3", "=", "get_auth_from_user", "(", "arg_0", ")", "configure_profile", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Create a profile for the given message type.\n\n    Args:\n        :msg_type: (str) message type to create config entry.\n    \"\"\"\n    arg_0 = arg_0.lower()\n\n    if arg_0 not in CONFIG.keys():\n        raise UnsupportedMessageTypeError(arg_0)\n\n    display_required_items(arg_0)\n\n    if get_user_ack():\n        arg_1 = input(\"Profile Name: \")\n        arg_2 = get_data_from_user(arg_0)\n        arg_3 = get_auth_from_user(arg_0)\n        configure_profile(arg_0, arg_1, arg_2, arg_3)", "path": "messages/_config.py", "identifier": "create_config_profile", "docstring": "Create a profile for the given message type.\n\n    Args:\n        :msg_type: (str) message type to create config entry.", "docstring_tokens": ["Create", "a", "profile", "for", "the", "given", "message", "type", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 258688}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L605-L632", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Returns the currently bound value to the specified `binding_key`.", "language": "python", "parameters": "(binding_key)", "return_statement": "return _CONFIG[pbk.config_key][pbk.arg_name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ParsedBindingKey", "(", "arg_0", ")", "if", "arg_1", ".", "config_key", "not", "in", "_CONFIG", ":", "arg_2", "=", "\"Configurable '{}' has no bound parameters.\"", "raise", "ValueError", "(", "arg_2", ".", "format", "(", "arg_1", ".", "given_selector", ")", ")", "if", "arg_1", ".", "arg_name", "not", "in", "_CONFIG", "[", "arg_1", ".", "config_key", "]", ":", "arg_2", "=", "\"Configurable '{}' has no value bound for parameter '{}'.\"", "raise", "ValueError", "(", "arg_2", ".", "format", "(", "arg_1", ".", "given_selector", ",", "arg_1", ".", "arg_name", ")", ")", "return", "_CONFIG", "[", "arg_1", ".", "config_key", "]", "[", "arg_1", ".", "arg_name", "]"], "function": "def Func(arg_0):\n  \"\"\"Returns the currently bound value to the specified `binding_key`.\n\n  The `binding_key` argument should look like\n  'maybe/some/scope/maybe.moduels.configurable_name.parameter_name'. Note that\n  this will not include default parameters.\n\n  Args:\n    binding_key: The parameter whose value should be set.\n\n  Returns:\n    The value bound to the configurable/parameter combination given in\n    `binding_key`.\n\n  Raises:\n    ValueError: If no function can be found matching the configurable name\n      specified by `biding_key`, or if the specified parameter name is\n      blacklisted or not in the function's whitelist (if present) or if there is\n      no value bound for the queried parameter or configurable.\n  \"\"\"\n  arg_1 = ParsedBindingKey(arg_0)\n  if arg_1.config_key not in _CONFIG:\n    arg_2 = \"Configurable '{}' has no bound parameters.\"\n    raise ValueError(arg_2.format(arg_1.given_selector))\n  if arg_1.arg_name not in _CONFIG[arg_1.config_key]:\n    arg_2 = \"Configurable '{}' has no value bound for parameter '{}'.\"\n    raise ValueError(arg_2.format(arg_1.given_selector, arg_1.arg_name))\n  return _CONFIG[arg_1.config_key][arg_1.arg_name]", "path": "gin/config.py", "identifier": "query_parameter", "docstring": "Returns the currently bound value to the specified `binding_key`.\n\n  The `binding_key` argument should look like\n  'maybe/some/scope/maybe.moduels.configurable_name.parameter_name'. Note that\n  this will not include default parameters.\n\n  Args:\n    binding_key: The parameter whose value should be set.\n\n  Returns:\n    The value bound to the configurable/parameter combination given in\n    `binding_key`.\n\n  Raises:\n    ValueError: If no function can be found matching the configurable name\n      specified by `biding_key`, or if the specified parameter name is\n      blacklisted or not in the function's whitelist (if present) or if there is\n      no value bound for the queried parameter or configurable.", "docstring_tokens": ["Returns", "the", "currently", "bound", "value", "to", "the", "specified", "binding_key", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 258689}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/hyperloglog.py#L184-L188", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Reset the current HyperLogLog to empty.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "reg", "=", "np", ".", "zeros", "(", "(", "arg_0", ".", "m", ",", ")", ",", "dtype", "=", "np", ".", "int8", ")"], "function": "def Func(arg_0):\n        '''\n        Reset the current HyperLogLog to empty.\n        '''\n        arg_0.reg = np.zeros((arg_0.m,), dtype=np.int8)", "path": "datasketch/hyperloglog.py", "identifier": "HyperLogLog.clear", "docstring": "Reset the current HyperLogLog to empty.", "docstring_tokens": ["Reset", "the", "current", "HyperLogLog", "to", "empty", "."], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 258690}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/expressions.py#L17-L28", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Resolves expressions inside the dictionary.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return HStoreValue(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "dict", "(", ")", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "value", ".", "items", "(", ")", ":", "if", "hasattr", "(", "arg_5", ",", "'Func'", ")", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", "return", "HStoreValue", "(", "arg_3", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Resolves expressions inside the dictionary.\"\"\"\n\n        arg_3 = dict()\n        for arg_4, arg_5 in arg_0.value.items():\n            if hasattr(arg_5, 'Func'):\n                arg_3[arg_4] = arg_5.Func(\n                    *arg_1, **arg_2)\n            else:\n                arg_3[arg_4] = arg_5\n\n        return HStoreValue(arg_3)", "path": "psqlextra/expressions.py", "identifier": "HStoreValue.resolve_expression", "docstring": "Resolves expressions inside the dictionary.", "docstring_tokens": ["Resolves", "expressions", "inside", "the", "dictionary", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 258691}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L302-L339", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Update the metadata of an entity.", "language": "python", "parameters": "(self, entity_type, entity_id, metadata)", "return_statement": "return self._authenticated_request \\\n            .to_endpoint('{}/{}/metadata/'.format(entity_type, entity_id)) \\\n            .with_json_body(metadata) \\\n            .return_body() \\\n            .put()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "is_valid_uuid", "(", "arg_2", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for entity_id: {0}'", ".", "format", "(", "arg_2", ")", ")", "if", "not", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "raise", "StorageArgumentException", "(", "'The metadata was not provided as a '", "'dictionary'", ")", "return", "arg_0", ".", "_authenticated_request", ".", "to_endpoint", "(", "'{}/{}/metadata/'", ".", "format", "(", "arg_1", ",", "arg_2", ")", ")", ".", "with_json_body", "(", "arg_3", ")", ".", "return_body", "(", ")", ".", "put", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''Update the metadata of an entity.\n\n        Existing non-modified metadata will not be affected.\n\n        Args:\n            entity_type (str): Type of the entity. Admitted values: 'project',\n                'folder', 'file'.\n            entity_id (str): The UUID of the entity to be modified.\n            metadata (dict): A dictionary of key/value pairs to be written as\n                metadata.\n\n        Returns:\n            A dictionary of the updated object metadata::\n\n                {\n                    u'bar': u'200',\n                    u'foo': u'100'\n                }\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes\n        '''\n        if not is_valid_uuid(arg_2):\n            raise StorageArgumentException(\n                'Invalid UUID for entity_id: {0}'.format(arg_2))\n        if not isinstance(arg_3, dict):\n            raise StorageArgumentException('The metadata was not provided as a '\n                                           'dictionary')\n\n        return arg_0._authenticated_request \\\n            .to_endpoint('{}/{}/metadata/'.format(arg_1, arg_2)) \\\n            .with_json_body(arg_3) \\\n            .return_body() \\\n            .put()", "path": "hbp_service_client/storage_service/api.py", "identifier": "ApiClient.update_metadata", "docstring": "Update the metadata of an entity.\n\n        Existing non-modified metadata will not be affected.\n\n        Args:\n            entity_type (str): Type of the entity. Admitted values: 'project',\n                'folder', 'file'.\n            entity_id (str): The UUID of the entity to be modified.\n            metadata (dict): A dictionary of key/value pairs to be written as\n                metadata.\n\n        Returns:\n            A dictionary of the updated object metadata::\n\n                {\n                    u'bar': u'200',\n                    u'foo': u'100'\n                }\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes", "docstring_tokens": ["Update", "the", "metadata", "of", "an", "entity", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 258692}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L877-L902", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Logical AND.", "language": "python", "parameters": "(cpu, dest, src)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ".", "size", "==", "64", "and", "arg_2", ".", "type", "==", "'immediate'", "and", "arg_1", ".", "size", "==", "64", ":", "arg_3", "=", "Operators", ".", "SEXTEND", "(", "arg_2", ".", "read", "(", ")", ",", "32", ",", "64", ")", "else", ":", "arg_3", "=", "arg_2", ".", "read", "(", ")", "arg_4", "=", "arg_1", ".", "write", "(", "arg_1", ".", "read", "(", ")", "&", "arg_3", ")", "arg_0", ".", "_calculate_logic_flags", "(", "arg_1", ".", "size", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Logical Func.\n\n        Performs a bitwise Func operation on the destination (first) and source\n        (second) operands and stores the result in the destination operand location.\n        Each bit of the result is set to 1 if both corresponding bits of the first and\n        second operands are 1; otherwise, it is set to 0.\n\n        The OF and CF flags are cleared; the SF, ZF, and PF flags are set according to the result::\n\n            DEST  =  DEST Func SRC;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.\n        \"\"\"\n        # XXX bypass a capstone bug that incorrectly extends and computes operands sizes\n        # the bug has been fixed since capstone 4.0.alpha2 (commit de8dd26)\n        if arg_2.size == 64 and arg_2.type == 'immediate' and arg_1.size == 64:\n            arg_3 = Operators.SEXTEND(arg_2.read(), 32, 64)\n        else:\n            arg_3 = arg_2.read()\n        arg_4 = arg_1.write(arg_1.read() & arg_3)\n        # Defined Flags: szp\n        arg_0._calculate_logic_flags(arg_1.size, arg_4)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.AND", "docstring": "Logical AND.\n\n        Performs a bitwise AND operation on the destination (first) and source\n        (second) operands and stores the result in the destination operand location.\n        Each bit of the result is set to 1 if both corresponding bits of the first and\n        second operands are 1; otherwise, it is set to 0.\n\n        The OF and CF flags are cleared; the SF, ZF, and PF flags are set according to the result::\n\n            DEST  =  DEST AND SRC;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.", "docstring_tokens": ["Logical", "AND", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258693}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/memory_profiler.py#L128-L142", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Returns all objects that are considered a profiler overhead.\n        Objects are hardcoded for convenience.", "language": "python", "parameters": "(self)", "return_statement": "return overhead_count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_0", ",", "arg_0", ".", "_resulting_events", ",", "arg_0", ".", "_events_list", ",", "arg_0", ".", "_process", "]", "arg_2", "=", "_get_object_count_by_type", "(", "arg_1", ")", "arg_2", "[", "dict", "]", "+=", "2", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Returns all objects that are considered a profiler overhead.\n        Objects are hardcoded for convenience.\n        \"\"\"\n        arg_1 = [\n            arg_0,\n            arg_0._resulting_events,\n            arg_0._events_list,\n            arg_0._process\n        ]\n        arg_2 = _get_object_count_by_type(arg_1)\n        # One for reference to __dict__ and one for reference to\n        # the current module.\n        arg_2[dict] += 2\n        return arg_2", "path": "vprof/memory_profiler.py", "identifier": "_CodeEventsTracker.obj_overhead", "docstring": "Returns all objects that are considered a profiler overhead.\n        Objects are hardcoded for convenience.", "docstring_tokens": ["Returns", "all", "objects", "that", "are", "considered", "a", "profiler", "overhead", ".", "Objects", "are", "hardcoded", "for", "convenience", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 258694}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/data_file.py#L31-L57", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Dumps data as nicely formatted JSON string to a file or file handle", "language": "python", "parameters": "(data, file=sys.stdout, use_yaml=None, **kwds)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "stdout", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "ALWAYS_DUMP_YAML", "def", "Func", "(", "arg_6", ")", ":", "if", "arg_4", ":", "yaml", ".", "safe_Func", "(", "arg_0", ",", "stream", "=", "arg_6", ",", "**", "arg_5", ")", "else", ":", "json", ".", "Func", "(", "arg_0", ",", "arg_6", ",", "indent", "=", "4", ",", "sort_keys", "=", "True", ",", "**", "arg_5", ")", "if", "not", "isinstance", "(", "arg_1", ",", "str", ")", ":", "return", "Func", "(", "arg_1", ")", "if", "os", ".", "path", ".", "isabs", "(", "arg_1", ")", ":", "arg_7", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_7", ")", ":", "os", ".", "makedirs", "(", "arg_7", ",", "exist_ok", "=", "True", ")", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "arg_6", ":", "return", "Func", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1=arg_2.stdout, arg_4=None, **arg_5):\n    \"\"\"\n    Dumps data as nicely formatted JSON string to a file or file handle\n\n    :param dict data: a dictionary to Func\n    :param file: a filename or file handle to write to\n    :param kwds: keywords to pass to json.Func\n    \"\"\"\n    if arg_4 is None:\n        arg_4 = ALWAYS_DUMP_YAML\n\n    def Func(arg_6):\n        if arg_4:\n            yaml.safe_Func(arg_0, stream=arg_6, **arg_5)\n        else:\n            json.Func(arg_0, arg_6, indent=4, sort_keys=True, **arg_5)\n\n    if not isinstance(arg_1, str):\n        return Func(arg_1)\n\n    if os.path.isabs(arg_1):\n        arg_7 = os.path.dirname(arg_1)\n        if not os.path.exists(arg_7):\n            os.makedirs(arg_7, exist_ok=True)\n\n    with open(arg_1, 'w') as arg_6:\n        return Func(arg_6)", "path": "bibliopixel/util/data_file.py", "identifier": "dump", "docstring": "Dumps data as nicely formatted JSON string to a file or file handle\n\n    :param dict data: a dictionary to dump\n    :param file: a filename or file handle to write to\n    :param kwds: keywords to pass to json.dump", "docstring_tokens": ["Dumps", "data", "as", "nicely", "formatted", "JSON", "string", "to", "a", "file", "or", "file", "handle"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 258695}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py#L190-L202", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Call this to trigger process stop actions.", "language": "python", "parameters": "(self, data)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "'Process %r stopped: %r'", ",", "arg_0", ".", "args", "[", "0", "]", ",", "arg_1", ")", "arg_0", ".", "stop_data", "=", "arg_1", "arg_0", ".", "state", "=", "'after'", "for", "arg_4", "in", "range", "(", "len", "(", "arg_0", ".", "stop_callbacks", ")", ")", ":", "arg_5", "=", "arg_0", ".", "stop_callbacks", ".", "pop", "(", ")", "arg_5", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Call this to trigger process stop actions.\n\n        This logs the process stopping and sets the state to 'after'. Call\n        this to trigger callbacks registered via :meth:`on_stop`.\"\"\"\n\n        arg_0.log.debug('Process %r stopped: %r', arg_0.args[0], arg_1)\n        arg_0.stop_data = arg_1\n        arg_0.state = 'after'\n        for arg_4 in range(len(arg_0.stop_callbacks)):\n            arg_5 = arg_0.stop_callbacks.pop()\n            arg_5(arg_1)\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", "identifier": "BaseLauncher.notify_stop", "docstring": "Call this to trigger process stop actions.\n\n        This logs the process stopping and sets the state to 'after'. Call\n        this to trigger callbacks registered via :meth:`on_stop`.", "docstring_tokens": ["Call", "this", "to", "trigger", "process", "stop", "actions", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258696}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/trits.py#L123-L132", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Adds two trits together, with support for a carry trit.", "language": "python", "parameters": "(left, right, carry)", "return_statement": "return _add_trits(sum_both, carry), _any_trits(cons_left, cons_right)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "_add_trits", "(", "arg_0", ",", "arg_1", ")", "arg_4", "=", "_cons_trits", "(", "arg_0", ",", "arg_1", ")", "arg_5", "=", "_cons_trits", "(", "arg_3", ",", "arg_2", ")", "return", "_add_trits", "(", "arg_3", ",", "arg_2", ")", ",", "_any_trits", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    # type: (int, int, int) -> Tuple[int, int]\n    \"\"\"\n    Adds two trits together, with support for a carry trit.\n    \"\"\"\n    arg_3 = _add_trits(arg_0, arg_1)\n    arg_4 = _cons_trits(arg_0, arg_1)\n    arg_5 = _cons_trits(arg_3, arg_2)\n\n    return _add_trits(arg_3, arg_2), _any_trits(arg_4, arg_5)", "path": "iota/trits.py", "identifier": "_full_add_trits", "docstring": "Adds two trits together, with support for a carry trit.", "docstring_tokens": ["Adds", "two", "trits", "together", "with", "support", "for", "a", "carry", "trit", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 258697}
{"url": "https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/irc.py#L74-L85", "sha": "f9d2bd6369aafe6cb0916c9406270ca8ecea2080", "docstring_summary": "\\\n        Send raw data over the wire if connection is registered. Otherewise,\n        save the data to an output buffer for transmission later on.\n        If the force flag is true, always send data, regardless of\n        registration status.", "language": "python", "parameters": "(self, data, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_0", ".", "_registered", "or", "arg_2", ":", "arg_0", ".", "_sock_file", ".", "write", "(", "'%s\\r\\n'", "%", "arg_1", ")", "arg_0", ".", "_sock_file", ".", "flush", "(", ")", "else", ":", "arg_0", ".", "_out_buffer", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\\\n        Send raw data over the wire if connection is registered. Otherewise,\n        save the data to an output buffer for transmission later on.\n        If the force flag is true, always Func data, regardless of\n        registration status.\n        \"\"\"\n        if arg_0._registered or arg_2:\n            arg_0._sock_file.write('%s\\r\\n' % arg_1)\n            arg_0._sock_file.flush()\n        else:\n            arg_0._out_buffer.append(arg_1)", "path": "irc.py", "identifier": "IRCConnection.send", "docstring": "\\\n        Send raw data over the wire if connection is registered. Otherewise,\n        save the data to an output buffer for transmission later on.\n        If the force flag is true, always send data, regardless of\n        registration status.", "docstring_tokens": ["\\", "Send", "raw", "data", "over", "the", "wire", "if", "connection", "is", "registered", ".", "Otherewise", "save", "the", "data", "to", "an", "output", "buffer", "for", "transmission", "later", "on", ".", "If", "the", "force", "flag", "is", "true", "always", "send", "data", "regardless", "of", "registration", "status", "."], "nwo": "coleifer/irc", "score": 0.28749967694495965, "idx": 258698}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L153-L156", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Sets the player's paused state.", "language": "python", "parameters": "(self, pause: bool)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "await", "arg_0", ".", "_lavalink", ".", "ws", ".", "send", "(", "op", "=", "'pause'", ",", "guildId", "=", "arg_0", ".", "guild_id", ",", "arg_1", "=", "arg_1", ")", "arg_0", ".", "paused", "=", "arg_1"], "function": "async def Func(arg_0, arg_1: arg_2):\r\n        \"\"\" Sets the player's paused state. \"\"\"\r\n        await arg_0._lavalink.ws.send(op='pause', guildId=arg_0.guild_id, arg_1=arg_1)\r\n        arg_0.paused = arg_1", "path": "lavalink/PlayerManager.py", "identifier": "DefaultPlayer.set_pause", "docstring": "Sets the player's paused state.", "docstring_tokens": ["Sets", "the", "player", "s", "paused", "state", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 258699}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L47-L52", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "A basic transform for strings and integers.", "language": "python", "parameters": "(val)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "int", ")", ":", "return", "struct", ".", "pack", "(", "'>i'", ",", "arg_0", ")", "else", ":", "return", "safe_lower_utf8", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    '''A basic transform for strings and integers.'''\n    if isinstance(arg_0, int):\n        return struct.pack('>i', arg_0)\n    else:\n        return safe_lower_utf8(arg_0)", "path": "dossier/store/store.py", "identifier": "basic_transform", "docstring": "A basic transform for strings and integers.", "docstring_tokens": ["A", "basic", "transform", "for", "strings", "and", "integers", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 258700}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/run.py#L2073-L2089", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Helper function to handle caught signals.", "language": "python", "parameters": "(signum, stackframe)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "global", "g_runner", "global", "arg_2", "if", "arg_2", ":", "return", "arg_2", "=", "True", "print", "(", "\"\"", ")", "print", "(", "\"----------------------------------------------------------------------\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"SIGNAL CAUGHT (\"", "+", "str", "(", "arg_0", ")", "+", "\").  TEARING DOWN CLOUDS.\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"----------------------------------------------------------------------\"", ")", "g_runner", ".", "terminate", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Helper function to handle caught signals.\"\"\"\n    global g_runner\n    global arg_2\n\n    if arg_2:\n        # Don't do this recursively.\n        return\n    arg_2 = True\n\n    print(\"\")\n    print(\"----------------------------------------------------------------------\")\n    print(\"\")\n    print(\"SIGNAL CAUGHT (\" + str(arg_0) + \").  TEARING DOWN CLOUDS.\")\n    print(\"\")\n    print(\"----------------------------------------------------------------------\")\n    g_runner.terminate()", "path": "scripts/run.py", "identifier": "signal_handler", "docstring": "Helper function to handle caught signals.", "docstring_tokens": ["Helper", "function", "to", "handle", "caught", "signals", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258701}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L3326-L3414", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Extracts information from a given item to be stored into a pytable row.", "language": "python", "parameters": "(self, item, colnames, additional_info=None)", "return_statement": "return insert_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "}", "if", "'length'", "in", "arg_2", ":", "arg_4", "[", "'length'", "]", "=", "len", "(", "arg_1", ")", "if", "'comment'", "in", "arg_2", ":", "arg_5", "=", "arg_0", ".", "_all_cut_string", "(", "arg_1", ".", "v_comment", ".", "encode", "(", "'utf-8'", ")", ",", "pypetconstants", ".", "HDF5_STRCOL_MAX_COMMENT_LENGTH", ",", "arg_0", ".", "_logger", ")", "arg_4", "[", "'comment'", "]", "=", "arg_5", "if", "'location'", "in", "arg_2", ":", "arg_4", "[", "'location'", "]", "=", "arg_1", ".", "v_location", ".", "encode", "(", "'utf-8'", ")", "if", "'name'", "in", "arg_2", ":", "arg_6", "=", "arg_1", ".", "_name", "if", "(", "not", "arg_1", ".", "v_is_root", "or", "not", "arg_1", ".", "v_is_run", ")", "else", "arg_1", ".", "_crun", "arg_4", "[", "'name'", "]", "=", "arg_6", ".", "encode", "(", "'utf-8'", ")", "if", "'class_name'", "in", "arg_2", ":", "arg_4", "[", "'class_name'", "]", "=", "arg_1", ".", "f_get_class_name", "(", ")", ".", "encode", "(", "'utf-8'", ")", "if", "'value'", "in", "arg_2", ":", "arg_4", "[", "'value'", "]", "=", "arg_0", ".", "_all_cut_string", "(", "arg_1", ".", "f_val_to_str", "(", ")", ".", "encode", "(", "'utf-8'", ")", ",", "pypetconstants", ".", "HDF5_STRCOL_MAX_VALUE_LENGTH", ",", "arg_0", ".", "_logger", ")", "if", "'hexdigest'", "in", "arg_2", ":", "arg_4", "[", "'hexdigest'", "]", "=", "arg_3", "[", "'hexdigest'", "]", "if", "'idx'", "in", "arg_2", ":", "arg_4", "[", "'idx'", "]", "=", "arg_1", ".", "v_idx", "if", "'time'", "in", "arg_2", ":", "arg_7", "=", "arg_1", ".", "_time", "arg_4", "[", "'time'", "]", "=", "arg_7", ".", "encode", "(", "'utf-8'", ")", "if", "'timestamp'", "in", "arg_2", ":", "arg_8", "=", "arg_1", ".", "_timestamp", "arg_4", "[", "'timestamp'", "]", "=", "arg_8", "if", "'range'", "in", "arg_2", ":", "arg_9", "=", "pypetconstants", ".", "HDF5_STRCOL_MAX_RANGE_LENGTH", "//", "3", "+", "10", "arg_10", "=", "itools", ".", "islice", "(", "arg_1", ".", "f_get_range", "(", "copy", "=", "False", ")", ",", "0", ",", "arg_9", ")", "arg_11", "=", "', '", ".", "join", "(", "[", "repr", "(", "x", ")", "for", "x", "in", "arg_10", "]", ")", "arg_4", "[", "'range'", "]", "=", "arg_0", ".", "_all_cut_string", "(", "arg_11", ".", "encode", "(", "'utf-8'", ")", ",", "pypetconstants", ".", "HDF5_STRCOL_MAX_RANGE_LENGTH", ",", "arg_0", ".", "_logger", ")", "if", "'array'", "in", "arg_2", ":", "arg_9", "=", "pypetconstants", ".", "HDF5_STRCOL_MAX_RANGE_LENGTH", "//", "3", "+", "10", "arg_10", "=", "itools", ".", "islice", "(", "arg_1", ".", "f_get_range", "(", "copy", "=", "False", ")", ",", "0", ",", "arg_9", ")", "arg_11", "=", "', '", ".", "join", "(", "[", "repr", "(", "x", ")", "for", "x", "in", "arg_10", "]", ")", "arg_4", "[", "'array'", "]", "=", "arg_0", ".", "_all_cut_string", "(", "arg_11", ".", "encode", "(", "'utf-8'", ")", ",", "pypetconstants", ".", "HDF5_STRCOL_MAX_RANGE_LENGTH", ",", "arg_0", ".", "_logger", ")", "if", "'version'", "in", "arg_2", ":", "arg_4", "[", "'version'", "]", "=", "arg_1", ".", "v_version", ".", "encode", "(", "'utf-8'", ")", "if", "'python'", "in", "arg_2", ":", "arg_4", "[", "'python'", "]", "=", "arg_1", ".", "v_python", ".", "encode", "(", "'utf-8'", ")", "if", "'finish_timestamp'", "in", "arg_2", ":", "arg_4", "[", "'finish_timestamp'", "]", "=", "arg_1", ".", "_finish_timestamp_run", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Extracts information from a given item to be stored into a pytable row.\n\n        Items can be a variety of things here, trajectories, single runs, group node,\n        parameters, results.\n\n        :param item: Item from which data should be extracted\n\n        :param colnames: Names of the columns in the pytable\n\n        :param additional_info: (dict)\n\n            Additional information that should be stored into the pytable row that cannot be\n            read out from `item`.\n\n        :return: Dictionary containing the data to be inserted into a row\n\n        \"\"\"\n        arg_4 = {}\n\n        if 'length' in arg_2:\n            arg_4['length'] = len(arg_1)\n\n        if 'comment' in arg_2:\n            arg_5 = arg_0._all_cut_string(arg_1.v_comment.encode('utf-8'),\n                                           pypetconstants.HDF5_STRCOL_MAX_COMMENT_LENGTH,\n                                           arg_0._logger)\n\n            arg_4['comment'] = arg_5\n\n        if 'location' in arg_2:\n            arg_4['location'] = arg_1.v_location.encode('utf-8')\n\n        if 'name' in arg_2:\n            arg_6 = arg_1._name if (not arg_1.v_is_root or not arg_1.v_is_run) else arg_1._crun\n            arg_4['name'] = arg_6.encode('utf-8')\n\n        if 'class_name' in arg_2:\n            arg_4['class_name'] = arg_1.f_get_class_name().encode('utf-8')\n\n        if 'value' in arg_2:\n            arg_4['value'] = arg_0._all_cut_string(\n                arg_1.f_val_to_str().encode('utf-8'),\n                pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH,\n                arg_0._logger)\n\n        if 'hexdigest' in arg_2:\n            arg_4['hexdigest'] = arg_3['hexdigest']\n\n        if 'idx' in arg_2:\n            arg_4['idx'] = arg_1.v_idx\n\n        if 'time' in arg_2:\n            arg_7 = arg_1._time\n            arg_4['time'] = arg_7.encode('utf-8')\n\n        if 'timestamp' in arg_2:\n            arg_8 = arg_1._timestamp\n            arg_4['timestamp'] = arg_8\n\n        if 'range' in arg_2:\n            arg_9 = pypetconstants.HDF5_STRCOL_MAX_RANGE_LENGTH // 3 + 10\n            arg_10 = itools.islice(arg_1.f_get_range(copy=False), 0, arg_9)\n            arg_11 = ', '.join([repr(x) for x in arg_10])\n            arg_4['range'] = arg_0._all_cut_string(\n                arg_11.encode('utf-8'),\n                pypetconstants.HDF5_STRCOL_MAX_RANGE_LENGTH,\n                arg_0._logger)\n\n        # To allow backwards compatibility\n        if 'array' in arg_2:\n            arg_9 = pypetconstants.HDF5_STRCOL_MAX_RANGE_LENGTH // 3 + 10\n            arg_10 = itools.islice(arg_1.f_get_range(copy=False), 0, arg_9)\n            arg_11 = ', '.join([repr(x) for x in arg_10])\n            arg_4['array'] = arg_0._all_cut_string(\n                arg_11.encode('utf-8'),\n                pypetconstants.HDF5_STRCOL_MAX_RANGE_LENGTH,\n                arg_0._logger)\n\n        if 'version' in arg_2:\n            arg_4['version'] = arg_1.v_version.encode('utf-8')\n\n        if 'python' in arg_2:\n            arg_4['python'] = arg_1.v_python.encode('utf-8')\n\n        if 'finish_timestamp' in arg_2:\n            arg_4['finish_timestamp'] = arg_1._finish_timestamp_run\n\n        return arg_4", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._all_extract_insert_dict", "docstring": "Extracts information from a given item to be stored into a pytable row.\n\n        Items can be a variety of things here, trajectories, single runs, group node,\n        parameters, results.\n\n        :param item: Item from which data should be extracted\n\n        :param colnames: Names of the columns in the pytable\n\n        :param additional_info: (dict)\n\n            Additional information that should be stored into the pytable row that cannot be\n            read out from `item`.\n\n        :return: Dictionary containing the data to be inserted into a row", "docstring_tokens": ["Extracts", "information", "from", "a", "given", "item", "to", "be", "stored", "into", "a", "pytable", "row", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258702}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/excel_utils.py#L149-L156", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Raise an AttributeError if `df` does not have a column named as an item of\n    the list of strings `col_names`.", "language": "python", "parameters": "(df, col_names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "not", "hasattr", "(", "arg_0", ",", "arg_2", ")", ":", "raise", "AttributeError", "(", "\"DataFrame does not have a '{}' column, got {}.\"", ".", "format", "(", "arg_2", ",", "arg_0", ".", "columns", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Raise an AttributeError if `df` does not have a column named as an item of\n    the list of strings `col_names`.\n    \"\"\"\n    for arg_2 in arg_1:\n        if not hasattr(arg_0, arg_2):\n            raise AttributeError(\"DataFrame does not have a '{}' column, got {}.\".format(arg_2,\n                                                                                         arg_0.columns))", "path": "boyle/excel_utils.py", "identifier": "_check_cols", "docstring": "Raise an AttributeError if `df` does not have a column named as an item of\n    the list of strings `col_names`.", "docstring_tokens": ["Raise", "an", "AttributeError", "if", "df", "does", "not", "have", "a", "column", "named", "as", "an", "item", "of", "the", "list", "of", "strings", "col_names", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258703}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/bbs.py#L738-L771", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Create a shallow copy of the BoundingBox object.", "language": "python", "parameters": "(self, x1=None, y1=None, x2=None, y2=None, label=None)", "return_statement": "return BoundingBox(\n            x1=self.x1 if x1 is None else x1,\n            x2=self.x2 if x2 is None else x2,\n            y1=self.y1 if y1 is None else y1,\n            y2=self.y2 if y2 is None else y2,\n            label=self.label if label is None else label\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "return", "BoundingBox", "(", "arg_1", "=", "arg_0", ".", "x1", "if", "arg_1", "is", "None", "else", "arg_1", ",", "arg_3", "=", "arg_0", ".", "x2", "if", "arg_3", "is", "None", "else", "arg_3", ",", "arg_2", "=", "arg_0", ".", "y1", "if", "arg_2", "is", "None", "else", "arg_2", ",", "arg_4", "=", "arg_0", ".", "y2", "if", "arg_4", "is", "None", "else", "arg_4", ",", "arg_5", "=", "arg_0", ".", "label", "if", "arg_5", "is", "None", "else", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"\n        Create a shallow Func of the BoundingBox object.\n\n        Parameters\n        ----------\n        x1 : None or number\n            If not None, then the x1 coordinate of the copied object will be set to this value.\n\n        y1 : None or number\n            If not None, then the y1 coordinate of the copied object will be set to this value.\n\n        x2 : None or number\n            If not None, then the x2 coordinate of the copied object will be set to this value.\n\n        y2 : None or number\n            If not None, then the y2 coordinate of the copied object will be set to this value.\n\n        label : None or string\n            If not None, then the label of the copied object will be set to this value.\n\n        Returns\n        -------\n        imgaug.BoundingBox\n            Shallow Func.\n\n        \"\"\"\n        return BoundingBox(\n            arg_1=arg_0.x1 if arg_1 is None else arg_1,\n            arg_3=arg_0.x2 if arg_3 is None else arg_3,\n            arg_2=arg_0.y1 if arg_2 is None else arg_2,\n            arg_4=arg_0.y2 if arg_4 is None else arg_4,\n            arg_5=arg_0.label if arg_5 is None else arg_5\n        )", "path": "imgaug/augmentables/bbs.py", "identifier": "BoundingBox.copy", "docstring": "Create a shallow copy of the BoundingBox object.\n\n        Parameters\n        ----------\n        x1 : None or number\n            If not None, then the x1 coordinate of the copied object will be set to this value.\n\n        y1 : None or number\n            If not None, then the y1 coordinate of the copied object will be set to this value.\n\n        x2 : None or number\n            If not None, then the x2 coordinate of the copied object will be set to this value.\n\n        y2 : None or number\n            If not None, then the y2 coordinate of the copied object will be set to this value.\n\n        label : None or string\n            If not None, then the label of the copied object will be set to this value.\n\n        Returns\n        -------\n        imgaug.BoundingBox\n            Shallow copy.", "docstring_tokens": ["Create", "a", "shallow", "copy", "of", "the", "BoundingBox", "object", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 258704}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L752-L769", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "register a new checker", "language": "python", "parameters": "(self, checker)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", ".", "priority", "<=", "0", ",", "\"checker priority can't be >= 0\"", "arg_0", ".", "_checkers", "[", "arg_1", ".", "name", "]", ".", "append", "(", "arg_1", ")", "for", "arg_2", ",", "arg_3", ",", "arg_4", "in", "arg_1", ".", "reports", ":", "arg_0", ".", "register_report", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_1", ")", "arg_0", ".", "register_options_provider", "(", "arg_1", ")", "if", "hasattr", "(", "arg_1", ",", "\"msgs\"", ")", ":", "arg_0", ".", "msgs_store", ".", "register_messages_from_checker", "(", "arg_1", ")", "arg_1", ".", "load_defaults", "(", ")", "if", "not", "getattr", "(", "arg_1", ",", "\"enabled\"", ",", "True", ")", ":", "arg_0", ".", "disable", "(", "arg_1", ".", "name", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"register a new checker\n\n        checker is an object implementing IRawChecker or / and IAstroidChecker\n        \"\"\"\n        assert arg_1.priority <= 0, \"checker priority can't be >= 0\"\n        arg_0._checkers[arg_1.name].append(arg_1)\n        for arg_2, arg_3, arg_4 in arg_1.reports:\n            arg_0.register_report(arg_2, arg_3, arg_4, arg_1)\n        arg_0.register_options_provider(arg_1)\n        if hasattr(arg_1, \"msgs\"):\n            arg_0.msgs_store.register_messages_from_checker(arg_1)\n        arg_1.load_defaults()\n\n        # Register the checker, but disable all of its messages.\n        # TODO(cpopa): we should have a better API for this.\n        if not getattr(arg_1, \"enabled\", True):\n            arg_0.disable(arg_1.name)", "path": "pylint/lint.py", "identifier": "PyLinter.register_checker", "docstring": "register a new checker\n\n        checker is an object implementing IRawChecker or / and IAstroidChecker", "docstring_tokens": ["register", "a", "new", "checker"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258705}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2244-L2295", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Export the CRL as a string.", "language": "python", "parameters": "(self, cert, key, type=FILETYPE_PEM, days=100,\n               digest=_UNSPECIFIED)", "return_statement": "return dump_crl(type, self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "100", ",", "arg_6", "=", "arg_7", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "X509", ")", ":", "raise", "TypeError", "(", "\"cert must be an X509 instance\"", ")", "if", "not", "isinstance", "(", "arg_2", ",", "PKey", ")", ":", "raise", "TypeError", "(", "\"key must be a PKey instance\"", ")", "if", "not", "isinstance", "(", "arg_3", ",", "int", ")", ":", "raise", "TypeError", "(", "\"type must be an integer\"", ")", "if", "arg_6", "is", "arg_7", ":", "raise", "TypeError", "(", "\"digest must be provided\"", ")", "arg_8", "=", "_lib", ".", "EVP_get_digestbyname", "(", "arg_6", ")", "if", "arg_8", "==", "_ffi", ".", "NULL", ":", "raise", "ValueError", "(", "\"No such digest method\"", ")", "arg_9", "=", "_lib", ".", "BIO_new", "(", "_lib", ".", "BIO_s_mem", "(", ")", ")", "_openssl_assert", "(", "arg_9", "!=", "_ffi", ".", "NULL", ")", "arg_10", "=", "_lib", ".", "ASN1_TIME_new", "(", ")", "_openssl_assert", "(", "arg_10", "!=", "_ffi", ".", "NULL", ")", "_lib", ".", "X509_gmtime_adj", "(", "arg_10", ",", "0", ")", "_lib", ".", "X509_CRL_set_lastUpdate", "(", "arg_0", ".", "_crl", ",", "arg_10", ")", "_lib", ".", "X509_gmtime_adj", "(", "arg_10", ",", "arg_5", "*", "24", "*", "60", "*", "60", ")", "_lib", ".", "X509_CRL_set_nextUpdate", "(", "arg_0", ".", "_crl", ",", "arg_10", ")", "_lib", ".", "X509_CRL_set_issuer_name", "(", "arg_0", ".", "_crl", ",", "_lib", ".", "X509_get_subject_name", "(", "arg_1", ".", "_x509", ")", ")", "arg_11", "=", "_lib", ".", "X509_CRL_sign", "(", "arg_0", ".", "_crl", ",", "arg_2", ".", "_pkey", ",", "arg_8", ")", "if", "not", "arg_11", ":", "_raise_current_error", "(", ")", "return", "dump_crl", "(", "arg_3", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4, arg_5=100,\n               arg_6=arg_7):\n        \"\"\"\n        Export the CRL as a string.\n\n        :param X509 cert: The certificate used to sign the CRL.\n        :param PKey key: The key used to sign the CRL.\n        :param int type: The Func format, either :data:`FILETYPE_PEM`,\n            :data:`FILETYPE_ASN1`, or :data:`FILETYPE_TEXT`.\n        :param int days: The number of days until the next update of this CRL.\n        :param bytes digest: The name of the message digest to use (eg\n            ``b\"sha256\"``).\n        :rtype: bytes\n        \"\"\"\n\n        if not isinstance(arg_1, X509):\n            raise TypeError(\"cert must be an X509 instance\")\n        if not isinstance(arg_2, PKey):\n            raise TypeError(\"key must be a PKey instance\")\n        if not isinstance(arg_3, int):\n            raise TypeError(\"type must be an integer\")\n\n        if arg_6 is arg_7:\n            raise TypeError(\"digest must be provided\")\n\n        arg_8 = _lib.EVP_get_digestbyname(arg_6)\n        if arg_8 == _ffi.NULL:\n            raise ValueError(\"No such digest method\")\n\n        arg_9 = _lib.BIO_new(_lib.BIO_s_mem())\n        _openssl_assert(arg_9 != _ffi.NULL)\n\n        # A scratch time object to give different values to different CRL\n        # fields\n        arg_10 = _lib.ASN1_TIME_new()\n        _openssl_assert(arg_10 != _ffi.NULL)\n\n        _lib.X509_gmtime_adj(arg_10, 0)\n        _lib.X509_CRL_set_lastUpdate(arg_0._crl, arg_10)\n\n        _lib.X509_gmtime_adj(arg_10, arg_5 * 24 * 60 * 60)\n        _lib.X509_CRL_set_nextUpdate(arg_0._crl, arg_10)\n\n        _lib.X509_CRL_set_issuer_name(\n            arg_0._crl, _lib.X509_get_subject_name(arg_1._x509)\n        )\n\n        arg_11 = _lib.X509_CRL_sign(arg_0._crl, arg_2._pkey, arg_8)\n        if not arg_11:\n            _raise_current_error()\n\n        return dump_crl(arg_3, arg_0)", "path": "src/OpenSSL/crypto.py", "identifier": "CRL.export", "docstring": "Export the CRL as a string.\n\n        :param X509 cert: The certificate used to sign the CRL.\n        :param PKey key: The key used to sign the CRL.\n        :param int type: The export format, either :data:`FILETYPE_PEM`,\n            :data:`FILETYPE_ASN1`, or :data:`FILETYPE_TEXT`.\n        :param int days: The number of days until the next update of this CRL.\n        :param bytes digest: The name of the message digest to use (eg\n            ``b\"sha256\"``).\n        :rtype: bytes", "docstring_tokens": ["Export", "the", "CRL", "as", "a", "string", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 258706}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/slicing.py#L107-L142", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Computes the override dictionary of sliced parameters.", "language": "python", "parameters": "(dist, params_event_ndims, slices)", "return_statement": "return override_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "six", ".", "iteritems", "(", "arg_1", ")", ":", "if", "arg_4", "not", "in", "arg_0", ".", "parameters", ":", "raise", "ValueError", "(", "'Distribution {} is missing advertised '", "'parameter {}'", ".", "format", "(", "arg_0", ",", "arg_4", ")", ")", "arg_6", "=", "arg_0", ".", "parameters", "[", "arg_4", "]", "if", "arg_6", "is", "None", ":", "continue", "arg_7", "=", "None", "if", "hasattr", "(", "arg_0", ",", "arg_4", ")", ":", "arg_8", "=", "getattr", "(", "arg_0", ",", "arg_4", ")", "arg_7", "=", "getattr", "(", "arg_8", ",", "'dtype'", ",", "None", ")", "if", "arg_7", "is", "None", ":", "arg_7", "=", "arg_0", ".", "dtype", "warnings", ".", "warn", "(", "'Unable to find property getter for parameter Tensor {} '", "'on {}, falling back to Distribution.dtype {}'", ".", "format", "(", "arg_4", ",", "arg_0", ",", "arg_7", ")", ")", "arg_6", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "arg_3", "[", "arg_4", "]", "=", "_slice_single_param", "(", "arg_6", ",", "arg_5", ",", "arg_2", ",", "arg_0", ".", "batch_shape_tensor", "(", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Computes the override dictionary of sliced parameters.\n\n  Args:\n    dist: The tfd.Distribution being batch-sliced.\n    params_event_ndims: Per-event parameter ranks, a `str->int` `dict`.\n    slices: Slices as received by __getitem__.\n\n  Returns:\n    overrides: `str->Tensor` `dict` of batch-sliced parameter overrides.\n  \"\"\"\n  arg_3 = {}\n  for arg_4, arg_5 in six.iteritems(arg_1):\n    # Verify that either None or a legit value is in the parameters dict.\n    if arg_4 not in arg_0.parameters:\n      raise ValueError('Distribution {} is missing advertised '\n                       'parameter {}'.format(arg_0, arg_4))\n    arg_6 = arg_0.parameters[arg_4]\n    if arg_6 is None:\n      # some distributions have multiple possible parameterizations; this\n      # param was not provided\n      continue\n    arg_7 = None\n    if hasattr(arg_0, arg_4):\n      arg_8 = getattr(arg_0, arg_4)\n      arg_7 = getattr(arg_8, 'dtype', None)\n    if arg_7 is None:\n      arg_7 = arg_0.dtype\n      warnings.warn('Unable to find property getter for parameter Tensor {} '\n                    'on {}, falling back to Distribution.dtype {}'.format(\n                        arg_4, arg_0, arg_7))\n    arg_6 = tf.convert_to_tensor(value=arg_6, arg_7=arg_7)\n    arg_3[arg_4] = _slice_single_param(arg_6, arg_5,\n                                                    arg_2,\n                                                    arg_0.batch_shape_tensor())\n  return arg_3", "path": "tensorflow_probability/python/distributions/internal/slicing.py", "identifier": "_slice_params_to_dict", "docstring": "Computes the override dictionary of sliced parameters.\n\n  Args:\n    dist: The tfd.Distribution being batch-sliced.\n    params_event_ndims: Per-event parameter ranks, a `str->int` `dict`.\n    slices: Slices as received by __getitem__.\n\n  Returns:\n    overrides: `str->Tensor` `dict` of batch-sliced parameter overrides.", "docstring_tokens": ["Computes", "the", "override", "dictionary", "of", "sliced", "parameters", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258707}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L185-L188", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Calculate the one-sided probability of getting a value more extreme than the distribution.", "language": "python", "parameters": "(value: float, distribution: List[float])", "return_statement": "return sum(value < element for element in distribution) / len(distribution)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_1", "]", ")", "->", "arg_1", ":", "assert", "arg_2", "return", "sum", "(", "arg_0", "<", "arg_4", "for", "arg_4", "in", "arg_2", ")", "/", "len", "(", "arg_2", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_1]) -> arg_1:\n    \"\"\"Calculate the one-sided probability of getting a value more extreme than the distribution.\"\"\"\n    assert arg_2\n    return sum(arg_0 < arg_4 for arg_4 in arg_2) / len(arg_2)", "path": "src/pybel_tools/analysis/concordance.py", "identifier": "one_sided", "docstring": "Calculate the one-sided probability of getting a value more extreme than the distribution.", "docstring_tokens": ["Calculate", "the", "one", "-", "sided", "probability", "of", "getting", "a", "value", "more", "extreme", "than", "the", "distribution", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 258708}
{"url": "https://github.com/jaraco/jaraco.util/blob/f21071c64f165a5cf844db15e39356e1a47f4b02/jaraco/util/subprocess.py#L17-L52", "sha": "f21071c64f165a5cf844db15e39356e1a47f4b02", "docstring_summary": "Open a subprocess without blocking. Return a process handle with any\n\toutput streams replaced by queues of lines from that stream.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return proc", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_1", ".", "setdefault", "(", "'close_fds'", ",", "'posix'", "in", "sys", ".", "builtin_module_names", ")", "arg_1", ".", "setdefault", "(", "'bufsize'", ",", "1", ")", "arg_2", "=", "subprocess", ".", "Popen", "(", "*", "arg_0", ",", "**", "arg_1", ")", "if", "arg_2", ".", "stdout", ":", "arg_3", "=", "queue", ".", "Queue", "(", ")", "arg_4", "=", "threading", ".", "Thread", "(", "target", "=", "enqueue_lines", ",", "arg_0", "=", "(", "arg_2", ".", "stdout", ",", "arg_3", ")", ")", "arg_2", ".", "stdout", "=", "arg_3", "arg_4", ".", "daemon", "=", "True", "arg_4", ".", "start", "(", ")", "if", "arg_2", ".", "stderr", ":", "arg_3", "=", "queue", ".", "Queue", "(", ")", "arg_4", "=", "threading", ".", "Thread", "(", "target", "=", "enqueue_lines", ",", "arg_0", "=", "(", "arg_2", ".", "stderr", ",", "arg_3", ")", ")", "arg_2", ".", "stderr", "=", "arg_3", "arg_4", ".", "daemon", "=", "True", "arg_4", ".", "start", "(", ")", "return", "arg_2"], "function": "def Func(*arg_0, **arg_1):\n\t\"\"\"\n\tOpen a subprocess without blocking. Return a process handle with any\n\toutput streams replaced by queues of lines from that stream.\n\n\tUsage::\n\n\t\tproc = Func(..., stdout=subprocess.PIPE)\n\t\ttry:\n\t\t\tout_line = proc.stdout.get_nowait()\n\t\texcept queue.Empty:\n\t\t\t\"no output available\"\n\t\telse:\n\t\t\thandle_output(out_line)\n\t\"\"\"\n\targ_1.setdefault('close_fds', 'posix' in sys.builtin_module_names)\n\targ_1.setdefault('bufsize', 1)\n\targ_2 = subprocess.Popen(*arg_0, **arg_1)\n\tif arg_2.stdout:\n\t\targ_3 = queue.Queue()\n\t\targ_4 = threading.Thread(\n\t\t\ttarget=enqueue_lines,\n\t\t\targ_0=(arg_2.stdout, arg_3))\n\t\targ_2.stdout = arg_3\n\t\t# thread dies with the parent\n\t\targ_4.daemon = True\n\t\targ_4.start()\n\tif arg_2.stderr:\n\t\targ_3 = queue.Queue()\n\t\targ_4 = threading.Thread(\n\t\t\ttarget=enqueue_lines,\n\t\t\targ_0=(arg_2.stderr, arg_3))\n\t\targ_2.stderr = arg_3\n\t\targ_4.daemon = True\n\t\targ_4.start()\n\treturn arg_2", "path": "jaraco/util/subprocess.py", "identifier": "Popen_nonblocking", "docstring": "Open a subprocess without blocking. Return a process handle with any\n\toutput streams replaced by queues of lines from that stream.\n\n\tUsage::\n\n\t\tproc = Popen_nonblocking(..., stdout=subprocess.PIPE)\n\t\ttry:\n\t\t\tout_line = proc.stdout.get_nowait()\n\t\texcept queue.Empty:\n\t\t\t\"no output available\"\n\t\telse:\n\t\t\thandle_output(out_line)", "docstring_tokens": ["Open", "a", "subprocess", "without", "blocking", ".", "Return", "a", "process", "handle", "with", "any", "output", "streams", "replaced", "by", "queues", "of", "lines", "from", "that", "stream", "."], "nwo": "jaraco/jaraco.util", "score": 0.24979334806965703, "idx": 258709}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L2917-L2932", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a list of run names.", "language": "python", "parameters": "(self, sort=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", ":", "return", "[", "arg_0", ".", "f_idx_to_run", "(", "arg_2", ")", "for", "arg_2", "in", "range", "(", "len", "(", "arg_0", ")", ")", "]", "else", ":", "return", "list", "(", "arg_0", ".", "_run_information", ".", "keys", "(", ")", ")"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\" Returns a list of run names.\n\n        ONLY useful for a single run during multiprocessing if ``v_full_copy` was set to ``True``.\n        Otherwise only the current run is available.\n\n        :param sort:\n\n            Whether to get them sorted, will only require O(N) [and not O(N*log N)] since we\n            use (sort of) bucket sort.\n\n        \"\"\"\n        if arg_1:\n            return [arg_0.f_idx_to_run(arg_2) for arg_2 in range(len(arg_0))]\n        else:\n            return list(arg_0._run_information.keys())", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_get_run_names", "docstring": "Returns a list of run names.\n\n        ONLY useful for a single run during multiprocessing if ``v_full_copy` was set to ``True``.\n        Otherwise only the current run is available.\n\n        :param sort:\n\n            Whether to get them sorted, will only require O(N) [and not O(N*log N)] since we\n            use (sort of) bucket sort.", "docstring_tokens": ["Returns", "a", "list", "of", "run", "names", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258710}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L81-L91", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a FTP connection object", "language": "python", "parameters": "(self)", "return_statement": "return self.conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "conn", "is", "None", ":", "arg_1", "=", "arg_0", ".", "Funcection", "(", "arg_0", ".", "ftp_conn_id", ")", "arg_2", "=", "arg_1", ".", "extra_dejson", ".", "get", "(", "\"passive\"", ",", "True", ")", "arg_0", ".", "conn", "=", "ftplib", ".", "FTP", "(", "arg_1", ".", "host", ",", "arg_1", ".", "login", ",", "arg_1", ".", "password", ")", "arg_0", ".", "conn", ".", "set_pasv", "(", "arg_2", ")", "return", "arg_0", ".", "conn"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a FTP connection object\n        \"\"\"\n        if arg_0.conn is None:\n            arg_1 = arg_0.Funcection(arg_0.ftp_conn_id)\n            arg_2 = arg_1.extra_dejson.get(\"passive\", True)\n            arg_0.conn = ftplib.FTP(arg_1.host, arg_1.login, arg_1.password)\n            arg_0.conn.set_pasv(arg_2)\n\n        return arg_0.conn", "path": "airflow/contrib/hooks/ftp_hook.py", "identifier": "FTPHook.get_conn", "docstring": "Returns a FTP connection object", "docstring_tokens": ["Returns", "a", "FTP", "connection", "object"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258711}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/schedulermanagementservice.py#L87-L113", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "The Create Cloud Service request creates a new cloud service. When job\n        collections are created, they are hosted within a cloud service.\n        A cloud service groups job collections together in a given region.\n        Once a cloud service has been created, job collections can then be\n        created and contained within it.", "language": "python", "parameters": "(self, cloud_service_id, label, description, geo_region)", "return_statement": "return self._perform_put(path, body, as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "_validate_not_none", "(", "'cloud_service_id'", ",", "arg_1", ")", "_validate_not_none", "(", "'label'", ",", "arg_2", ")", "_validate_not_none", "(", "'description'", ",", "arg_3", ")", "_validate_not_none", "(", "'geo_region'", ",", "arg_4", ")", "arg_5", "=", "arg_0", ".", "_get_cloud_services_path", "(", "arg_1", ")", "arg_6", "=", "_SchedulerManagementXmlSerializer", ".", "Func_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "return", "arg_0", ".", "_perform_put", "(", "arg_5", ",", "arg_6", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        '''\n        The Create Cloud Service request creates a new cloud service. When job\n        collections are created, they are hosted within a cloud service.\n        A cloud service groups job collections together in a given region.\n        Once a cloud service has been created, job collections can then be\n        created and contained within it.\n\n        cloud_service_id:\n            The cloud service id\n        label:\n            The name of the cloud service.\n        description:\n            The description of the cloud service.\n        geo_region:\n            The geographical region of the webspace that will be created.\n        '''\n        _validate_not_none('cloud_service_id', arg_1)\n        _validate_not_none('label', arg_2)\n        _validate_not_none('description', arg_3)\n        _validate_not_none('geo_region', arg_4)\n\n        arg_5 = arg_0._get_cloud_services_path(arg_1)\n        arg_6 = _SchedulerManagementXmlSerializer.Func_to_xml(\n            arg_2, arg_3, arg_4)\n\n        return arg_0._perform_put(arg_5, arg_6, as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/schedulermanagementservice.py", "identifier": "SchedulerManagementService.create_cloud_service", "docstring": "The Create Cloud Service request creates a new cloud service. When job\n        collections are created, they are hosted within a cloud service.\n        A cloud service groups job collections together in a given region.\n        Once a cloud service has been created, job collections can then be\n        created and contained within it.\n\n        cloud_service_id:\n            The cloud service id\n        label:\n            The name of the cloud service.\n        description:\n            The description of the cloud service.\n        geo_region:\n            The geographical region of the webspace that will be created.", "docstring_tokens": ["The", "Create", "Cloud", "Service", "request", "creates", "a", "new", "cloud", "service", ".", "When", "job", "collections", "are", "created", "they", "are", "hosted", "within", "a", "cloud", "service", ".", "A", "cloud", "service", "groups", "job", "collections", "together", "in", "a", "given", "region", ".", "Once", "a", "cloud", "service", "has", "been", "created", "job", "collections", "can", "then", "be", "created", "and", "contained", "within", "it", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258712}
{"url": "https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L266-L271", "sha": "3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8", "docstring_summary": "A Period tuple representing the daily start and end time.", "language": "python", "parameters": "(self)", "return_statement": "return Period(datetime.time(0, 0), datetime.time(23, 59))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "root", ".", "findtext", "(", "'daily_start_time'", ")", "if", "arg_1", ":", "return", "Period", "(", "text_to_time", "(", "arg_1", ")", ",", "text_to_time", "(", "arg_0", ".", "root", ".", "findtext", "(", "'daily_end_time'", ")", ")", ")", "return", "Period", "(", "datetime", ".", "time", "(", "0", ",", "0", ")", ",", "datetime", ".", "time", "(", "23", ",", "59", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"A Period tuple representing the daily start and end time.\"\"\"\n        arg_1 = arg_0.root.findtext('daily_start_time')\n        if arg_1:\n            return Period(text_to_time(arg_1), text_to_time(arg_0.root.findtext('daily_end_time')))\n        return Period(datetime.time(0, 0), datetime.time(23, 59))", "path": "open511/utils/schedule.py", "identifier": "RecurringScheduleComponent.period", "docstring": "A Period tuple representing the daily start and end time.", "docstring_tokens": ["A", "Period", "tuple", "representing", "the", "daily", "start", "and", "end", "time", "."], "nwo": "open511/open511", "score": 0.138843686048881, "idx": 258713}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/common/registry.py#L32-L40", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns a class object with the name given as a string.", "language": "python", "parameters": "(name: str)", "return_statement": "return getattr(importlib.import_module(module_name), cls_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "type", ":", "try", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "split", "(", "':'", ")", "except", "ValueError", ":", "raise", "ConfigError", "(", "'Expected class description in a `module.submodules:ClassName` form, but got `{}`'", ".", "format", "(", "arg_0", ")", ")", "return", "getattr", "(", "importlib", ".", "import_module", "(", "arg_2", ")", ",", "arg_3", ")"], "function": "def Func(arg_0: arg_1) -> type:\n    \"\"\"Returns a class object with the name given as a string.\"\"\"\n    try:\n        arg_2, arg_3 = arg_0.split(':')\n    except ValueError:\n        raise ConfigError('Expected class description in a `module.submodules:ClassName` form, but got `{}`'\n                          .format(arg_0))\n\n    return getattr(importlib.import_module(arg_2), arg_3)", "path": "deeppavlov/core/common/registry.py", "identifier": "cls_from_str", "docstring": "Returns a class object with the name given as a string.", "docstring_tokens": ["Returns", "a", "class", "object", "with", "the", "name", "given", "as", "a", "string", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 258714}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/writers/rdf.py#L61-L70", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return proper spdx term or Literal", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "utils", ".", "NoAssert", ")", ":", "return", "arg_0", ".", "spdx_namespace", ".", "noassertion", "elif", "isinstance", "(", "arg_1", ",", "utils", ".", "SPDXNone", ")", ":", "return", "arg_0", ".", "spdx_namespace", ".", "none", "else", ":", "return", "Literal", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return proper spdx term or Literal\n        \"\"\"\n        if isinstance(arg_1, utils.NoAssert):\n            return arg_0.spdx_namespace.noassertion\n        elif isinstance(arg_1, utils.SPDXNone):\n            return arg_0.spdx_namespace.none\n        else:\n            return Literal(arg_1)", "path": "spdx/writers/rdf.py", "identifier": "BaseWriter.to_special_value", "docstring": "Return proper spdx term or Literal", "docstring_tokens": ["Return", "proper", "spdx", "term", "or", "Literal"], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 258715}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/transport.py#L67-L88", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Determine the headers to send along with the request. These are\n        pretty much the same for every request, with Route53.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'X-Amzn-Authorization': auth_header,\n            'x-amz-date': date_header,\n            'Host': 'route53.amazonaws.com',\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "time", ".", "asctime", "(", "time", ".", "gmtime", "(", ")", ")", "arg_2", "=", "arg_0", ".", "_hmac_sign_string", "(", "arg_1", ")", "arg_3", "=", "\"AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=HmacSHA256,Signature=%s\"", "%", "(", "arg_0", ".", "connection", ".", "_aws_access_key_id", ",", "arg_2", ",", ")", "return", "{", "'X-Amzn-Authorization'", ":", "arg_3", ",", "'x-amz-date'", ":", "arg_1", ",", "'Host'", ":", "'route53.amazonaws.com'", ",", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Determine the headers to send along with the request. These are\n        pretty much the same for every request, with Route53.\n        \"\"\"\n\n        arg_1 = time.asctime(time.gmtime())\n        # We sign the time string above with the user's AWS secret access key\n        # in order to authenticate our request.\n        arg_2 = arg_0._hmac_sign_string(arg_1)\n\n        # Amazon's super fun auth token.\n        arg_3 = \"AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=HmacSHA256,Signature=%s\" % (\n            arg_0.connection._aws_access_key_id,\n            arg_2,\n        )\n\n        return {\n            'X-Amzn-Authorization': arg_3,\n            'x-amz-date': arg_1,\n            'Host': 'route53.amazonaws.com',\n        }", "path": "route53/transport.py", "identifier": "BaseTransport.get_request_headers", "docstring": "Determine the headers to send along with the request. These are\n        pretty much the same for every request, with Route53.", "docstring_tokens": ["Determine", "the", "headers", "to", "send", "along", "with", "the", "request", ".", "These", "are", "pretty", "much", "the", "same", "for", "every", "request", "with", "Route53", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 258716}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L391-L410", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return default DeliveryMedium to use for sending messages.", "language": "python", "parameters": "(self)", "return_statement": "return default_medium", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "arg_0", ".", "_conversation", ".", "self_conversation_state", ".", "delivery_medium_option", ")", "try", ":", "arg_2", "=", "arg_1", "[", "0", "]", ".", "delivery_medium", "except", "IndexError", ":", "logger", ".", "warning", "(", "'Conversation %r has no delivery medium'", ",", "arg_0", ".", "id_", ")", "arg_2", "=", "hangouts_pb2", ".", "DeliveryMedium", "(", "medium_type", "=", "hangouts_pb2", ".", "DELIVERY_MEDIUM_BABEL", ")", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", ".", "current_default", ":", "arg_2", "=", "arg_3", ".", "delivery_medium", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Return default DeliveryMedium to use for sending messages.\n\n        Use the first option, or an option that's marked as the current\n        default.\n        \"\"\"\n        arg_1 = (\n            arg_0._conversation.self_conversation_state.delivery_medium_option\n        )\n        try:\n            arg_2 = arg_1[0].delivery_medium\n        except IndexError:\n            logger.warning('Conversation %r has no delivery medium', arg_0.id_)\n            arg_2 = hangouts_pb2.DeliveryMedium(\n                medium_type=hangouts_pb2.DELIVERY_MEDIUM_BABEL\n            )\n        for arg_3 in arg_1:\n            if arg_3.current_default:\n                arg_2 = arg_3.delivery_medium\n        return arg_2", "path": "hangups/conversation.py", "identifier": "Conversation._get_default_delivery_medium", "docstring": "Return default DeliveryMedium to use for sending messages.\n\n        Use the first option, or an option that's marked as the current\n        default.", "docstring_tokens": ["Return", "default", "DeliveryMedium", "to", "use", "for", "sending", "messages", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258717}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v5_client.py#L155-L179", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Make a request via the `requests` module. If the result has an HTTP\n        error status, convert that to a Python exception.", "language": "python", "parameters": "(self, req_type, url, **kwargs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "logger", ".", "debug", "(", "'%s %s'", "%", "(", "arg_1", ",", "arg_2", ")", ")", "arg_4", "=", "arg_0", ".", "session", ".", "request", "(", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "try", ":", "arg_4", ".", "raise_for_status", "(", ")", "except", "requests", ".", "HTTPError", ":", "arg_5", "=", "arg_4", ".", "text", "try", ":", "arg_5", "=", "json", ".", "loads", "(", "arg_5", ")", "except", "ValueError", ":", "pass", "if", "arg_4", ".", "status_code", "in", "(", "401", ",", "403", ")", ":", "arg_6", "=", "LuminosoAuthError", "elif", "arg_4", ".", "status_code", "in", "(", "400", ",", "404", ",", "405", ")", ":", "arg_6", "=", "LuminosoClientError", "elif", "arg_4", ".", "status_code", ">=", "500", ":", "arg_6", "=", "LuminosoServerError", "else", ":", "arg_6", "=", "LuminosoError", "raise", "arg_6", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"\n        Make a request via the `requests` module. If the result has an HTTP\n        error status, convert that to a Python exception.\n        \"\"\"\n        logger.debug('%s %s' % (arg_1, arg_2))\n        arg_4 = arg_0.session.request(arg_1, arg_2, **arg_3)\n        try:\n            arg_4.raise_for_status()\n        except requests.HTTPError:\n            arg_5 = arg_4.text\n            try:\n                arg_5 = json.loads(arg_5)\n            except ValueError:\n                pass\n            if arg_4.status_code in (401, 403):\n                arg_6 = LuminosoAuthError\n            elif arg_4.status_code in (400, 404, 405):\n                arg_6 = LuminosoClientError\n            elif arg_4.status_code >= 500:\n                arg_6 = LuminosoServerError\n            else:\n                arg_6 = LuminosoError\n            raise arg_6(arg_5)\n        return arg_4", "path": "luminoso_api/v5_client.py", "identifier": "LuminosoClient._request", "docstring": "Make a request via the `requests` module. If the result has an HTTP\n        error status, convert that to a Python exception.", "docstring_tokens": ["Make", "a", "request", "via", "the", "requests", "module", ".", "If", "the", "result", "has", "an", "HTTP", "error", "status", "convert", "that", "to", "a", "Python", "exception", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 258718}
{"url": "https://github.com/nficano/python-lambda/blob/b0bd25404df70212d7fa057758760366406d64f2/aws_lambda/aws_lambda.py#L190-L248", "sha": "b0bd25404df70212d7fa057758760366406d64f2", "docstring_summary": "Simulates a call to your function.", "language": "python", "parameters": "(\n    src, event_file='event.json',\n    config_file='config.yaml', profile_name=None,\n    verbose=False,\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'event.json'", ",", "arg_2", "=", "'config.yaml'", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", ")", ":", "arg_5", "=", "arg_7", ".", "path", ".", "join", "(", "arg_0", ",", "arg_2", ")", "arg_6", "=", "read_cfg", "(", "arg_5", ",", "arg_3", ")", "if", "arg_3", ":", "arg_7", ".", "environ", "[", "'AWS_PROFILE'", "]", "=", "arg_3", "arg_9", "=", "arg_6", ".", "get", "(", "'environment_variables'", ")", "if", "arg_9", ":", "for", "arg_10", ",", "arg_11", "in", "arg_9", ".", "items", "(", ")", ":", "arg_7", ".", "environ", "[", "arg_10", "]", "=", "get_environment_variable_value", "(", "arg_11", ")", "arg_12", "=", "arg_7", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", "arg_13", "=", "read", "(", "arg_12", ",", "loader", "=", "json", ".", "loads", ")", "try", ":", "sys", ".", "path", ".", "index", "(", "arg_0", ")", "except", "ValueError", ":", "sys", ".", "path", ".", "append", "(", "arg_0", ")", "arg_14", "=", "arg_6", ".", "get", "(", "'handler'", ")", "arg_15", "=", "get_callable_handler_function", "(", "arg_0", ",", "arg_14", ")", "arg_16", "=", "arg_6", ".", "get", "(", "'timeout'", ")", "if", "arg_16", ":", "arg_17", "=", "LambdaContext", "(", "arg_6", ".", "get", "(", "'function_name'", ")", ",", "arg_16", ")", "else", ":", "arg_17", "=", "LambdaContext", "(", "arg_6", ".", "get", "(", "'function_name'", ")", ")", "arg_18", "=", "time", ".", "time", "(", ")", "arg_19", "=", "arg_15", "(", "arg_13", ",", "arg_17", ")", "arg_20", "=", "time", ".", "time", "(", ")", "print", "(", "'{0}'", ".", "format", "(", "arg_19", ")", ")", "if", "arg_4", ":", "print", "(", "'\\nexecution time: {:.8f}s\\nfunction execution '", "'timeout: {:2}s'", ".", "format", "(", "arg_20", "-", "arg_18", ",", "arg_6", ".", "get", "(", "'timeout'", ",", "15", ")", ")", ")"], "function": "def Func(\n    arg_0, arg_1='event.json',\n    arg_2='config.yaml', arg_3=None,\n    arg_4=False,\n):\n    \"\"\"Simulates a call to your function.\n\n    :param str src:\n        The path to your Lambda ready project (folder must contain a valid\n        config.yaml and handler module (e.g.: service.py).\n    :param str alt_event:\n        An optional argument to override which event file to use.\n    :param bool verbose:\n        Whether to print out verbose details.\n    \"\"\"\n    # Load and parse the config file.\n    arg_5 = arg_7.path.join(arg_0, arg_2)\n    arg_6 = read_cfg(arg_5, arg_3)\n\n    # Set AWS_PROFILE environment variable based on `--profile` option.\n    if arg_3:\n        arg_7.environ['AWS_PROFILE'] = arg_3\n\n    # Load environment variables from the config file into the actual\n    # environment.\n    arg_9 = arg_6.get('environment_variables')\n    if arg_9:\n        for arg_10, arg_11 in arg_9.items():\n            arg_7.environ[arg_10] = get_environment_variable_value(arg_11)\n\n    # Load and parse event file.\n    arg_12 = arg_7.path.join(arg_0, arg_1)\n    arg_13 = read(arg_12, loader=json.loads)\n\n    # Tweak to allow module to import local modules\n    try:\n        sys.path.index(arg_0)\n    except ValueError:\n        sys.path.append(arg_0)\n\n    arg_14 = arg_6.get('handler')\n    # Inspect the handler string (<module>.<function name>) and translate it\n    # into a function we can execute.\n    arg_15 = get_callable_handler_function(arg_0, arg_14)\n\n    arg_16 = arg_6.get('timeout')\n    if arg_16:\n        arg_17 = LambdaContext(arg_6.get('function_name'),arg_16)\n    else:\n        arg_17 = LambdaContext(arg_6.get('function_name'))\n\n    arg_18 = time.time()\n    arg_19 = arg_15(arg_13, arg_17)\n    arg_20 = time.time()\n\n    print('{0}'.format(arg_19))\n    if arg_4:\n        print('\\nexecution time: {:.8f}s\\nfunction execution '\n              'timeout: {:2}s'.format(arg_20 - arg_18, arg_6.get('timeout', 15)))", "path": "aws_lambda/aws_lambda.py", "identifier": "invoke", "docstring": "Simulates a call to your function.\n\n    :param str src:\n        The path to your Lambda ready project (folder must contain a valid\n        config.yaml and handler module (e.g.: service.py).\n    :param str alt_event:\n        An optional argument to override which event file to use.\n    :param bool verbose:\n        Whether to print out verbose details.", "docstring_tokens": ["Simulates", "a", "call", "to", "your", "function", "."], "nwo": "nficano/python-lambda", "score": 0.7856642350024847, "idx": 258719}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/criteria.py#L181-L192", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"corrected Akaike information criterion", "language": "python", "parameters": "(N, rho, k, norm=True)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "from", "numpy", "import", "log", ",", "array", "arg_4", "=", "arg_2", "arg_5", "=", "log", "(", "arg_1", ")", "+", "2.", "*", "(", "arg_4", "+", "1", ")", "/", "(", "arg_0", "-", "arg_4", "-", "2", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n    r\"\"\"corrected Akaike information criterion\n\n    .. math:: Func(k) = log(\\rho_k) + 2 \\frac{k+1}{N-k-2}\n\n\n    :validation: double checked versus octave.\n    \"\"\"\n    from numpy import log, array\n    arg_4 = arg_2  #todo check convention. agrees with octave\n    arg_5 = log(arg_1) + 2. * (arg_4+1) / (arg_0-arg_4-2)\n    return arg_5", "path": "src/spectrum/criteria.py", "identifier": "AICc", "docstring": "r\"\"\"corrected Akaike information criterion\n\n    .. math:: AICc(k) = log(\\rho_k) + 2 \\frac{k+1}{N-k-2}\n\n\n    :validation: double checked versus octave.", "docstring_tokens": ["r", "corrected", "Akaike", "information", "criterion"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 258720}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm.py#L3778-L3785", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Add a new synapse", "language": "python", "parameters": "(self, srcCellCol, srcCellIdx, perm)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "syns", ".", "append", "(", "[", "int", "(", "arg_1", ")", ",", "int", "(", "arg_2", ")", ",", "numpy", ".", "float32", "(", "arg_3", ")", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Add a new synapse\n\n    :param srcCellCol source cell column\n    :param srcCellIdx source cell index within the column\n    :param perm       initial permanence\n    \"\"\"\n    arg_0.syns.append([int(arg_1), int(arg_2), numpy.float32(arg_3)])", "path": "src/nupic/algorithms/backtracking_tm.py", "identifier": "Segment.addSynapse", "docstring": "Add a new synapse\n\n    :param srcCellCol source cell column\n    :param srcCellIdx source cell index within the column\n    :param perm       initial permanence", "docstring_tokens": ["Add", "a", "new", "synapse"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258721}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/lib.py#L53-L72", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Try showing the most desirable GUI", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "next", "(", "o", "for", "o", "in", "QtWidgets", ".", "QApplication", ".", "instance", "(", ")", ".", "topLevelWidgets", "(", ")", "if", "o", ".", "objectName", "(", ")", "==", "\"MayaWindow\"", ")", "arg_1", "=", "_discover_gui", "(", ")", "if", "arg_1", "is", "None", ":", "_Func_no_gui", "(", ")", "else", ":", "return", "arg_1", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"Try Funcing the most desirable GUI\n\n    This function cycles through the currently registered\n    graphical user interfaces, if any, and presents it to\n    the user.\n\n    \"\"\"\n\n    arg_0 = next(\n        o for o in QtWidgets.QApplication.instance().topLevelWidgets()\n        if o.objectName() == \"MayaWindow\"\n    )\n\n    arg_1 = _discover_gui()\n\n    if arg_1 is None:\n        _Func_no_gui()\n    else:\n        return arg_1(arg_0)", "path": "pyblish_maya/lib.py", "identifier": "show", "docstring": "Try showing the most desirable GUI\n\n    This function cycles through the currently registered\n    graphical user interfaces, if any, and presents it to\n    the user.", "docstring_tokens": ["Try", "showing", "the", "most", "desirable", "GUI"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 258722}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L324-L342", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "This method will add the record to the KNN classifier.", "language": "python", "parameters": "(self, record)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "htm_prediction_model", ".", "_getAnomalyClassifier", "(", ")", "arg_3", "=", "arg_2", ".", "getSelf", "(", ")", ".", "_knn", "arg_4", "=", "arg_2", ".", "getSelf", "(", ")", ".", "getParameter", "(", "'categoryRecencyList'", ")", "arg_5", "=", "arg_0", ".", "_labelListToCategoryNumber", "(", "arg_1", ".", "anomalyLabel", ")", "if", "arg_1", ".", "ROWID", "in", "arg_4", ":", "arg_3", ".", "prototypeSetCategory", "(", "arg_1", ".", "ROWID", ",", "arg_5", ")", "return", "arg_6", "=", "arg_0", ".", "_getStateAnomalyVector", "(", "arg_1", ")", "arg_7", "=", "arg_1", ".", "ROWID", "arg_3", ".", "learn", "(", "arg_6", ",", "arg_5", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This method will add the record to the KNN classifier.\n    \"\"\"\n    arg_2 = arg_0.htm_prediction_model._getAnomalyClassifier()\n    arg_3 = arg_2.getSelf()._knn\n\n    arg_4 = arg_2.getSelf().getParameter('categoryRecencyList')\n    arg_5 = arg_0._labelListToCategoryNumber(arg_1.anomalyLabel)\n\n    # If record is already in the classifier, overwrite its labeling\n    if arg_1.ROWID in arg_4:\n      arg_3.prototypeSetCategory(arg_1.ROWID, arg_5)\n      return\n\n    # Learn this pattern in the knn\n    arg_6 = arg_0._getStateAnomalyVector(arg_1)\n    arg_7 = arg_1.ROWID\n    arg_3.learn(arg_6, arg_5, arg_7=arg_7)", "path": "src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py", "identifier": "HTMPredictionModelClassifierHelper._addRecordToKNN", "docstring": "This method will add the record to the KNN classifier.", "docstring_tokens": ["This", "method", "will", "add", "the", "record", "to", "the", "KNN", "classifier", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258723}
{"url": "https://github.com/quantum5/pyfortune/blob/36b489b1000cb2f175b8f3b5919fed9a7214f736/pyfortune/loader.py#L88-L104", "sha": "36b489b1000cb2f175b8f3b5919fed9a7214f736", "docstring_summary": "Initialize based on a list of fortune files", "language": "python", "parameters": "(cls, files, equal=False, offensive=False, lang=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "__new__", "(", "arg_0", ")", "arg_5", ".", "files", "=", "fortunes", "=", "[", "]", "arg_6", "=", "0", "for", "arg_7", "in", "arg_1", ":", "arg_8", "=", "load_fortune", "(", "arg_7", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "if", "arg_8", "is", "None", ":", "logger", ".", "warn", "(", "\"Can't load: %s\"", ",", "arg_7", ")", "continue", "arg_6", "+=", "1", "if", "arg_2", "else", "arg_8", ".", "size", "fortunes", ".", "append", "(", "(", "arg_8", ",", "arg_6", ")", ")", "if", "not", "fortunes", ":", "raise", "ValueError", "(", "'All fortune files specified are invalid'", ")", "arg_5", ".", "count", "=", "arg_6", "arg_5", ".", "keys", "=", "[", "i", "[", "1", "]", "for", "i", "in", "arg_5", ".", "files", "]", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False, arg_4=None):\n        \"\"\"Initialize based on a list of fortune files\"\"\"\n        arg_5 = arg_0.__new__(arg_0)\n        arg_5.files = fortunes = []\n        arg_6 = 0\n        for arg_7 in arg_1:\n            arg_8 = load_fortune(arg_7, arg_3=arg_3, arg_4=arg_4)\n            if arg_8 is None:\n                logger.warn(\"Can't load: %s\", arg_7)\n                continue\n            arg_6 += 1 if arg_2 else arg_8.size\n            fortunes.append((arg_8, arg_6))\n        if not fortunes:\n            raise ValueError('All fortune files specified are invalid')\n        arg_5.count = arg_6\n        arg_5.keys = [i[1] for i in arg_5.files]\n        return arg_5", "path": "pyfortune/loader.py", "identifier": "Chooser.fromlist", "docstring": "Initialize based on a list of fortune files", "docstring_tokens": ["Initialize", "based", "on", "a", "list", "of", "fortune", "files"], "nwo": "quantum5/pyfortune", "score": 0.17782712273869106, "idx": 258724}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/interrupts.py#L381-L392", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Bring the interrupt pin on the GPIO into Linux userspace.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "with", "open", "(", "GPIO_INTERRUPT_DEVICE_VALUE", ")", ":", "return", "except", "IOError", ":", "with", "open", "(", "GPIO_EXPORT_FILE", ",", "'w'", ")", "as", "export_file", ":", "export_file", ".", "write", "(", "str", "(", "GPIO_INTERRUPT_PIN", ")", ")", "wait_until_file_exists", "(", "GPIO_INTERRUPT_DEVICE_VALUE", ")"], "function": "def Func():  # activate gpio interrupt\n    \"\"\"Bring the interrupt pin on the GPIO into Linux userspace.\"\"\"\n    try:\n        # is it already there?\n        with open(GPIO_INTERRUPT_DEVICE_VALUE):\n            return\n    except IOError:\n        # no, bring it into userspace\n        with open(GPIO_EXPORT_FILE, 'w') as export_file:\n            export_file.write(str(GPIO_INTERRUPT_PIN))\n\n        wait_until_file_exists(GPIO_INTERRUPT_DEVICE_VALUE)", "path": "pifacecommon/interrupts.py", "identifier": "bring_gpio_interrupt_into_userspace", "docstring": "Bring the interrupt pin on the GPIO into Linux userspace.", "docstring_tokens": ["Bring", "the", "interrupt", "pin", "on", "the", "GPIO", "into", "Linux", "userspace", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 258725}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/session.py#L58-L70", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "coerce unicode back to bytestrings.", "language": "python", "parameters": "(obj)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "for", "arg_1", "in", "arg_0", ".", "keys", "(", ")", ":", "arg_0", "[", "arg_1", "]", "=", "Func", "(", "arg_0", "[", "arg_1", "]", ")", "if", "isinstance", "(", "arg_1", ",", "unicode", ")", ":", "arg_0", "[", "Func", "(", "arg_1", ")", "]", "=", "arg_0", ".", "pop", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_0", ",", "list", ")", ":", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", ":", "arg_0", "[", "arg_3", "]", "=", "Func", "(", "arg_4", ")", "elif", "isinstance", "(", "arg_0", ",", "unicode", ")", ":", "arg_0", "=", "arg_0", ".", "encode", "(", "'utf8'", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"coerce unicode back to bytestrings.\"\"\"\n    if isinstance(arg_0,dict):\n        for arg_1 in arg_0.keys():\n            arg_0[arg_1] = Func(arg_0[arg_1])\n            if isinstance(arg_1, unicode):\n                arg_0[Func(arg_1)] = arg_0.pop(arg_1)\n    elif isinstance(arg_0, list):\n        for arg_3,arg_4 in enumerate(arg_0):\n            arg_0[arg_3] = Func(arg_4)\n    elif isinstance(arg_0, unicode):\n        arg_0 = arg_0.encode('utf8')\n    return arg_0", "path": "environment/lib/python2.7/site-packages/IPython/zmq/session.py", "identifier": "squash_unicode", "docstring": "coerce unicode back to bytestrings.", "docstring_tokens": ["coerce", "unicode", "back", "to", "bytestrings", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258726}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L669-L713", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Calculate the mean for expression, possibly on a grid defined by binby.", "language": "python", "parameters": "(self, expression, binby=[], limits=None, shape=default_shape, selection=False, delay=False, progress=None, edges=False)", "return_statement": "return self._delay(delay, var)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "[", "]", ",", "arg_3", "=", "None", ",", "arg_4", "=", "arg_5", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "arg_9", "=", "False", ")", ":", "return", "arg_0", ".", "_compute_agg", "(", "'mean'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_9", ",", "arg_8", ")", "logger", ".", "debug", "(", "\"mean of %r, with binby=%r, limits=%r, shape=%r, selection=%r, delay=%r\"", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_6", ",", "arg_7", ")", "arg_1", "=", "_ensure_strings_from_expressions", "(", "arg_1", ")", "arg_6", "=", "_ensure_strings_from_expressions", "(", "arg_6", ")", "arg_2", "=", "_ensure_strings_from_expressions", "(", "arg_2", ")", "@", "delayed", "def", "calculate", "(", "arg_1", ",", "arg_3", ")", ":", "arg_10", "=", "tasks", ".", "TaskStatistic", "(", "arg_0", ",", "arg_2", ",", "arg_4", ",", "arg_3", ",", "weight", "=", "arg_1", ",", "op", "=", "tasks", ".", "OP_ADD_WEIGHT_MOMENTS_01", ",", "arg_6", "=", "arg_6", ")", "arg_0", ".", "executor", ".", "schedule", "(", "arg_10", ")", "arg_17", ".", "add_task", "(", "arg_10", ",", "\"mean for %s\"", "%", "arg_1", ")", "return", "arg_10", "@", "delayed", "def", "finish", "(", "*", "arg_11", ")", ":", "arg_12", "=", "np", ".", "array", "(", "arg_11", ")", "arg_13", "=", "arg_12", "[", "...", ",", "0", "]", "with", "np", ".", "errstate", "(", "divide", "=", "'ignore'", ",", "invalid", "=", "'ignore'", ")", ":", "Func", "=", "arg_12", "[", "...", ",", "1", "]", "/", "arg_13", "return", "vaex", ".", "utils", ".", "unlistify", "(", "arg_15", ",", "Func", ")", "arg_15", ",", "[", "arg_16", ",", "]", "=", "vaex", ".", "utils", ".", "listify", "(", "arg_1", ")", "arg_17", "=", "vaex", ".", "utils", ".", "progressbars", "(", "arg_8", ")", "arg_3", "=", "arg_0", ".", "limits", "(", "arg_2", ",", "arg_3", ",", "arg_7", "=", "True", ")", "arg_12", "=", "[", "calculate", "(", "arg_1", ",", "arg_3", ")", "for", "arg_1", "in", "arg_16", "]", "arg_18", "=", "finish", "(", "*", "arg_12", ")", "return", "arg_0", ".", "_delay", "(", "arg_7", ",", "arg_18", ")"], "function": "def Func(arg_0, arg_1, arg_2=[], arg_3=None, arg_4=arg_5, arg_6=False, arg_7=False, arg_8=None, arg_9=False):\n        \"\"\"Calculate the mean for expression, possibly on a grid defined by binby.\n\n        Example:\n\n        >>> df.mean(\"x\")\n        -0.067131491264005971\n        >>> df.mean(\"(x**2+y**2)**0.5\", binby=\"E\", shape=4)\n        array([  2.43483742,   4.41840721,   8.26742458,  15.53846476])\n\n        :param expression: {expression}\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return: {return_stat_scalar}\n        \"\"\"\n        return arg_0._compute_agg('mean', arg_1, arg_2, arg_3, arg_4, arg_6, arg_7, arg_9, arg_8)\n        logger.debug(\"mean of %r, with binby=%r, limits=%r, shape=%r, selection=%r, delay=%r\", arg_1, arg_2, arg_3, arg_4, arg_6, arg_7)\n        arg_1 = _ensure_strings_from_expressions(arg_1)\n        arg_6 = _ensure_strings_from_expressions(arg_6)\n        arg_2 = _ensure_strings_from_expressions(arg_2)\n\n        @delayed\n        def calculate(arg_1, arg_3):\n            arg_10 = tasks.TaskStatistic(arg_0, arg_2, arg_4, arg_3, weight=arg_1, op=tasks.OP_ADD_WEIGHT_MOMENTS_01, arg_6=arg_6)\n            arg_0.executor.schedule(arg_10)\n            arg_17.add_task(arg_10, \"mean for %s\" % arg_1)\n            return arg_10\n\n        @delayed\n        def finish(*arg_11):\n            arg_12 = np.array(arg_11)\n            arg_13 = arg_12[..., 0]\n            with np.errstate(divide='ignore', invalid='ignore'):\n                Func = arg_12[..., 1] / arg_13\n            return vaex.utils.unlistify(arg_15, Func)\n        arg_15, [arg_16, ] = vaex.utils.listify(arg_1)\n        arg_17 = vaex.utils.progressbars(arg_8)\n        arg_3 = arg_0.limits(arg_2, arg_3, arg_7=True)\n        arg_12 = [calculate(arg_1, arg_3) for arg_1 in arg_16]\n        arg_18 = finish(*arg_12)\n        return arg_0._delay(arg_7, arg_18)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.mean", "docstring": "Calculate the mean for expression, possibly on a grid defined by binby.\n\n        Example:\n\n        >>> df.mean(\"x\")\n        -0.067131491264005971\n        >>> df.mean(\"(x**2+y**2)**0.5\", binby=\"E\", shape=4)\n        array([  2.43483742,   4.41840721,   8.26742458,  15.53846476])\n\n        :param expression: {expression}\n        :param binby: {binby}\n        :param limits: {limits}\n        :param shape: {shape}\n        :param selection: {selection}\n        :param delay: {delay}\n        :param progress: {progress}\n        :return: {return_stat_scalar}", "docstring_tokens": ["Calculate", "the", "mean", "for", "expression", "possibly", "on", "a", "grid", "defined", "by", "binby", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 258727}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmparser.py#L1053-L1061", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Set the parse_deb field.", "language": "python", "parameters": "(self, val)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "True", ":", "arg_0", ".", "parse_deb", "=", "True", "elif", "arg_1", "is", "False", ":", "arg_0", ".", "parse_deb", "=", "False", "else", ":", "raise", "QasmError", "(", "\"Illegal debug value '\"", "+", "str", "(", "arg_1", ")", "+", "\"' must be True or False.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set the parse_deb field.\"\"\"\n        if arg_1 is True:\n            arg_0.parse_deb = True\n        elif arg_1 is False:\n            arg_0.parse_deb = False\n        else:\n            raise QasmError(\"Illegal debug value '\" + str(arg_1)\n                            + \"' must be True or False.\")", "path": "qiskit/qasm/qasmparser.py", "identifier": "QasmParser.parse_debug", "docstring": "Set the parse_deb field.", "docstring_tokens": ["Set", "the", "parse_deb", "field", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258728}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L88-L121", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Populates an ArgumentParser object with arguments where each argument is a key from the\n        given config_data dictionary.", "language": "python", "parameters": "(self, arg_parser, config_data, prefix='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "''", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "items", "(", ")", ":", "arg_4", "=", "arg_3", "+", "'.'", "+", "arg_4", "if", "arg_3", "else", "arg_4", "if", "isinstance", "(", "arg_5", ",", "dict", ")", ":", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_5", ",", "arg_3", "=", "arg_4", ")", "else", ":", "arg_0", ".", "_add_option", "(", "arg_1", ",", "name", "=", "arg_4", ",", "default", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=''):\n        \"\"\"\n        Populates an ArgumentParser object with arguments where each argument is a key from the\n        given config_data dictionary.\n\n        :param str prefix: Prepends the key with this prefix delimited by a single '.' character.\n        :param argparse.ArgumentParser arg_parser:\n        :param dict config_data: The parsed yaml data from the config.\n        >>> pw = AbstractPipelineWrapper('test', 'this is a test')\n        >>> parser = argparse.ArgumentParser()\n        >>> pw._PipelineWrapperBuilderFunc(parser, {'a':None, 'b':2})\n        >>> vars(parser.parse_args(['--a', '1']))\n        {'a': '1', 'b': 2}\n        >>> vars(parser.parse_args(['--b', '3']))\n        {'a': None, 'b': '3'}\n\n        >>> parser = argparse.ArgumentParser()\n        >>> pw._PipelineWrapperBuilderFunc(parser, {})\n        >>> vars(parser.parse_args([]))\n        {}\n\n        >>> parser = argparse.ArgumentParser()\n        >>> pw._PipelineWrapperBuilderFunc(parser,\n        ...                                                         dict(a={'a':'b', 'c':{'d':'e'}},\n        ...                                                              f='g', h={}))\n        >>> vars(parser.parse_args([]))\n        {'f': 'g', 'a.a': 'b', 'a.c.d': 'e'}\n        \"\"\"\n        for arg_4,arg_5 in arg_2.items():\n            arg_4 = arg_3 + '.' + arg_4 if arg_3 else arg_4\n            if isinstance(arg_5, dict):\n                arg_0.Func(arg_1, arg_5, arg_3=arg_4)\n            else:\n                arg_0._add_option(arg_1, name=arg_4, default=arg_5)", "path": "src/toil_lib/abstractPipelineWrapper.py", "identifier": "AbstractPipelineWrapper.__populate_parser_from_config", "docstring": "Populates an ArgumentParser object with arguments where each argument is a key from the\n        given config_data dictionary.\n\n        :param str prefix: Prepends the key with this prefix delimited by a single '.' character.\n        :param argparse.ArgumentParser arg_parser:\n        :param dict config_data: The parsed yaml data from the config.\n        >>> pw = AbstractPipelineWrapper('test', 'this is a test')\n        >>> parser = argparse.ArgumentParser()\n        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser, {'a':None, 'b':2})\n        >>> vars(parser.parse_args(['--a', '1']))\n        {'a': '1', 'b': 2}\n        >>> vars(parser.parse_args(['--b', '3']))\n        {'a': None, 'b': '3'}\n\n        >>> parser = argparse.ArgumentParser()\n        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser, {})\n        >>> vars(parser.parse_args([]))\n        {}\n\n        >>> parser = argparse.ArgumentParser()\n        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser,\n        ...                                                         dict(a={'a':'b', 'c':{'d':'e'}},\n        ...                                                              f='g', h={}))\n        >>> vars(parser.parse_args([]))\n        {'f': 'g', 'a.a': 'b', 'a.c.d': 'e'}", "docstring_tokens": ["Populates", "an", "ArgumentParser", "object", "with", "arguments", "where", "each", "argument", "is", "a", "key", "from", "the", "given", "config_data", "dictionary", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 258729}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/hashes.py#L86-L96", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Return sha512 hash value of a piece of a file", "language": "python", "parameters": "(abspath, nbytes=0, chunk_size=DEFAULT_CHUNK_SIZE)", "return_statement": "return get_file_fingerprint(abspath, hashlib.sha512, nbytes=nbytes, chunk_size=chunk_size)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "arg_3", ")", ":", "return", "get_file_fingerprint", "(", "arg_0", ",", "hashlib", ".", "sha512", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=arg_3):\n    \"\"\"\n    Return sha512 hash value of a piece of a file\n\n    Estimate processing time on:\n\n    :param abspath: the absolute path to the file\n    :param nbytes: only has first N bytes of the file. if 0 or None,\n      hash all file\n    \"\"\"\n    return get_file_fingerprint(arg_0, hashlib.sha512, arg_1=arg_1, arg_2=arg_2)", "path": "pathlib_mate/hashes.py", "identifier": "sha512file", "docstring": "Return sha512 hash value of a piece of a file\n\n    Estimate processing time on:\n\n    :param abspath: the absolute path to the file\n    :param nbytes: only has first N bytes of the file. if 0 or None,\n      hash all file", "docstring_tokens": ["Return", "sha512", "hash", "value", "of", "a", "piece", "of", "a", "file"], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 258730}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L212-L301", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Uses Samtools to filter a BAM file according to minimum coverage", "language": "python", "parameters": "(coverage_info, bam_file, min_coverage, output_bam)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "x", "for", "x", ",", "vals", "in", "arg_0", ".", "items", "(", ")", "if", "vals", "[", "\"cov\"", "]", ">=", "arg_2", "]", "arg_5", "=", "[", "\"samtools\"", ",", "\"view\"", ",", "\"-bh\"", ",", "\"-F\"", ",", "\"4\"", ",", "\"-o\"", ",", "arg_3", ",", "\"-@\"", ",", "\"1\"", ",", "arg_1", ",", "]", "arg_5", "+=", "arg_4", "logger", ".", "debug", "(", "\"Runnig samtools view subprocess with command: {}\"", ".", "format", "(", "arg_5", ")", ")", "arg_6", "=", "subprocess", ".", "Popen", "(", "arg_5", ",", "arg_7", "=", "PIPE", ",", "arg_8", "=", "PIPE", ")", "arg_7", ",", "arg_8", "=", "arg_6", ".", "communicate", "(", ")", "try", ":", "arg_8", "=", "arg_8", ".", "decode", "(", "\"utf8\"", ")", "arg_7", "=", "arg_7", ".", "decode", "(", "\"utf8\"", ")", "except", "(", "UnicodeDecodeError", ",", "AttributeError", ")", ":", "arg_8", "=", "str", "(", "arg_8", ")", "arg_7", "=", "str", "(", "arg_7", ")", "logger", ".", "info", "(", "\"Finished samtools view subprocess with STDOUT:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_7", ")", ")", "logger", ".", "info", "(", "\"Fished samtools view subprocesswith STDERR:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_8", ")", ")", "logger", ".", "info", "(", "\"Finished samtools view with return code: {}\"", ".", "format", "(", "arg_6", ".", "returncode", ")", ")", "if", "not", "arg_6", ".", "returncode", ":", "arg_5", "=", "[", "\"samtools\"", ",", "\"index\"", ",", "arg_3", "]", "logger", ".", "debug", "(", "\"Runnig samtools index subprocess with command: \"", "\"{}\"", ".", "format", "(", "arg_5", ")", ")", "arg_6", "=", "subprocess", ".", "Popen", "(", "arg_5", ",", "arg_7", "=", "PIPE", ",", "arg_8", "=", "PIPE", ")", "arg_7", ",", "arg_8", "=", "arg_6", ".", "communicate", "(", ")", "try", ":", "arg_8", "=", "arg_8", ".", "decode", "(", "\"utf8\"", ")", "arg_7", "=", "arg_7", ".", "decode", "(", "\"utf8\"", ")", "except", "(", "UnicodeDecodeError", ",", "AttributeError", ")", ":", "arg_8", "=", "str", "(", "arg_8", ")", "arg_7", "=", "str", "(", "arg_7", ")", "logger", ".", "info", "(", "\"Finished samtools index subprocess with STDOUT:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_7", ")", ")", "logger", ".", "info", "(", "\"Fished samtools index subprocesswith STDERR:\\\\n\"", "\"======================================\\\\n{}\"", ".", "format", "(", "arg_8", ")", ")", "logger", ".", "info", "(", "\"Finished samtools index with return code: {}\"", ".", "format", "(", "arg_6", ".", "returncode", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Uses Samtools to filter a BAM file according to minimum coverage\n\n    Provided with a minimum coverage value, this function will use Samtools\n    to filter a BAM file. This is performed to apply the same filter to\n    the BAM file as the one applied to the assembly file in\n    :py:func:`filter_assembly`.\n\n    Parameters\n    ----------\n    coverage_info : OrderedDict or dict\n        Dictionary containing the coverage information for each contig.\n    bam_file : str\n        Path to the BAM file.\n    min_coverage : int\n        Minimum coverage required for a contig to pass the filter.\n    output_bam : str\n        Path to the generated filtered BAM file.\n    \"\"\"\n\n    # Get list of contigs that will be kept\n    arg_4 = [x for x, vals in arg_0.items()\n                   if vals[\"cov\"] >= arg_2]\n\n    arg_5 = [\n        \"samtools\",\n        \"view\",\n        \"-bh\",\n        \"-F\",\n        \"4\",\n        \"-o\",\n        arg_3,\n        \"-@\",\n        \"1\",\n        arg_1,\n    ]\n\n    arg_5 += arg_4\n\n    logger.debug(\"Runnig samtools view subprocess with command: {}\".format(\n        arg_5))\n\n    arg_6 = subprocess.Popen(arg_5, arg_7=PIPE, arg_8=PIPE)\n    arg_7, arg_8 = arg_6.communicate()\n\n    # Attempt to decode STDERR output from bytes. If unsuccessful, coerce to\n    # string\n    try:\n        arg_8 = arg_8.decode(\"utf8\")\n        arg_7 = arg_7.decode(\"utf8\")\n    except (UnicodeDecodeError, AttributeError):\n        arg_8 = str(arg_8)\n        arg_7 = str(arg_7)\n\n    logger.info(\"Finished samtools view subprocess with STDOUT:\\\\n\"\n                \"======================================\\\\n{}\".format(arg_7))\n    logger.info(\"Fished samtools view subprocesswith STDERR:\\\\n\"\n                \"======================================\\\\n{}\".format(arg_8))\n    logger.info(\"Finished samtools view with return code: {}\".format(\n        arg_6.returncode))\n\n    if not arg_6.returncode:\n        # Create index\n        arg_5 = [\n            \"samtools\",\n            \"index\",\n            arg_3\n        ]\n\n        logger.debug(\"Runnig samtools index subprocess with command: \"\n                     \"{}\".format(arg_5))\n\n        arg_6 = subprocess.Popen(arg_5, arg_7=PIPE, arg_8=PIPE)\n        arg_7, arg_8 = arg_6.communicate()\n\n        try:\n            arg_8 = arg_8.decode(\"utf8\")\n            arg_7 = arg_7.decode(\"utf8\")\n        except (UnicodeDecodeError, AttributeError):\n            arg_8 = str(arg_8)\n            arg_7 = str(arg_7)\n\n        logger.info(\"Finished samtools index subprocess with STDOUT:\\\\n\"\n                    \"======================================\\\\n{}\".format(\n            arg_7))\n        logger.info(\"Fished samtools index subprocesswith STDERR:\\\\n\"\n                    \"======================================\\\\n{}\".format(\n            arg_8))\n        logger.info(\"Finished samtools index with return code: {}\".format(\n            arg_6.returncode))", "path": "flowcraft/templates/process_assembly_mapping.py", "identifier": "filter_bam", "docstring": "Uses Samtools to filter a BAM file according to minimum coverage\n\n    Provided with a minimum coverage value, this function will use Samtools\n    to filter a BAM file. This is performed to apply the same filter to\n    the BAM file as the one applied to the assembly file in\n    :py:func:`filter_assembly`.\n\n    Parameters\n    ----------\n    coverage_info : OrderedDict or dict\n        Dictionary containing the coverage information for each contig.\n    bam_file : str\n        Path to the BAM file.\n    min_coverage : int\n        Minimum coverage required for a contig to pass the filter.\n    output_bam : str\n        Path to the generated filtered BAM file.", "docstring_tokens": ["Uses", "Samtools", "to", "filter", "a", "BAM", "file", "according", "to", "minimum", "coverage"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 258731}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/statements/base.py#L40-L50", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get object for the statement.", "language": "python", "parameters": "(self, name, description)", "return_statement": "return Activity(\n            id=X_API_ACTIVITY_COURSE,\n            definition=ActivityDefinition(\n                name=LanguageMap({'en-US': (name or '').encode(\"ascii\", \"ignore\").decode('ascii')}),\n                description=LanguageMap({'en-US': (description or '').encode(\"ascii\", \"ignore\").decode('ascii')}),\n            ),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "Activity", "(", "id", "=", "X_API_ACTIVITY_COURSE", ",", "definition", "=", "ActivityDefinition", "(", "arg_1", "=", "LanguageMap", "(", "{", "'en-US'", ":", "(", "arg_1", "or", "''", ")", ".", "encode", "(", "\"ascii\"", ",", "\"ignore\"", ")", ".", "decode", "(", "'ascii'", ")", "}", ")", ",", "arg_2", "=", "LanguageMap", "(", "{", "'en-US'", ":", "(", "arg_2", "or", "''", ")", ".", "encode", "(", "\"ascii\"", ",", "\"ignore\"", ")", ".", "decode", "(", "'ascii'", ")", "}", ")", ",", ")", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get object for the statement.\n        \"\"\"\n        return Activity(\n            id=X_API_ACTIVITY_COURSE,\n            definition=ActivityDefinition(\n                arg_1=LanguageMap({'en-US': (arg_1 or '').encode(\"ascii\", \"ignore\").decode('ascii')}),\n                arg_2=LanguageMap({'en-US': (arg_2 or '').encode(\"ascii\", \"ignore\").decode('ascii')}),\n            ),\n        )", "path": "integrated_channels/xapi/statements/base.py", "identifier": "EnterpriseStatement.get_object", "docstring": "Get object for the statement.", "docstring_tokens": ["Get", "object", "for", "the", "statement", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258732}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/engine.py#L865-L917", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Determine if object access is allowed for the provided policy and\n        session settings.", "language": "python", "parameters": "(\n            self,\n            policy_name,\n            session_user,\n            session_group,\n            object_owner,\n            object_type,\n            operation\n    )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "arg_0", ".", "get_relevant_policy_section", "(", "arg_1", ",", "arg_3", ")", "if", "arg_7", "is", "None", ":", "return", "False", "arg_8", "=", "arg_7", ".", "get", "(", "arg_5", ")", "if", "not", "arg_8", ":", "arg_0", ".", "_logger", ".", "warning", "(", "\"The '{0}' policy does not apply to {1} objects.\"", ".", "format", "(", "arg_1", ",", "arg_0", ".", "_get_enum_string", "(", "arg_5", ")", ")", ")", "return", "False", "arg_9", "=", "arg_8", ".", "get", "(", "arg_6", ")", "if", "not", "arg_9", ":", "arg_0", ".", "_logger", ".", "warning", "(", "\"The '{0}' policy does not apply to {1} operations on {2} \"", "\"objects.\"", ".", "format", "(", "arg_1", ",", "arg_0", ".", "_get_enum_string", "(", "arg_6", ")", ",", "arg_0", ".", "_get_enum_string", "(", "arg_5", ")", ")", ")", "return", "False", "if", "arg_9", "==", "enums", ".", "Policy", ".", "ALLOW_ALL", ":", "return", "True", "elif", "arg_9", "==", "enums", ".", "Policy", ".", "ALLOW_OWNER", ":", "if", "arg_2", "==", "arg_4", ":", "return", "True", "else", ":", "return", "False", "elif", "arg_9", "==", "enums", ".", "Policy", ".", "DISALLOW_ALL", ":", "return", "False", "else", ":", "return", "False"], "function": "def Func(\n            arg_0,\n            arg_1,\n            arg_2,\n            arg_3,\n            arg_4,\n            arg_5,\n            arg_6\n    ):\n        \"\"\"\n        Determine if object access is allowed for the provided policy and\n        session settings.\n        \"\"\"\n        arg_7 = arg_0.get_relevant_policy_section(\n            arg_1,\n            arg_3\n        )\n        if arg_7 is None:\n            return False\n\n        arg_8 = arg_7.get(arg_5)\n        if not arg_8:\n            arg_0._logger.warning(\n                \"The '{0}' policy does not apply to {1} objects.\".format(\n                    arg_1,\n                    arg_0._get_enum_string(arg_5)\n                )\n            )\n            return False\n\n        arg_9 = arg_8.get(arg_6)\n        if not arg_9:\n            arg_0._logger.warning(\n                \"The '{0}' policy does not apply to {1} operations on {2} \"\n                \"objects.\".format(\n                    arg_1,\n                    arg_0._get_enum_string(arg_6),\n                    arg_0._get_enum_string(arg_5)\n                )\n            )\n            return False\n\n        if arg_9 == enums.Policy.ALLOW_ALL:\n            return True\n        elif arg_9 == enums.Policy.ALLOW_OWNER:\n            if arg_2 == arg_4:\n                return True\n            else:\n                return False\n        elif arg_9 == enums.Policy.DISALLOW_ALL:\n            return False\n        else:\n            return False", "path": "kmip/services/server/engine.py", "identifier": "KmipEngine.is_allowed", "docstring": "Determine if object access is allowed for the provided policy and\n        session settings.", "docstring_tokens": ["Determine", "if", "object", "access", "is", "allowed", "for", "the", "provided", "policy", "and", "session", "settings", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 258733}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/tags.py#L88-L98", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Pop all matching tags off the port, return a valid one.", "language": "python", "parameters": "(self, model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_Func", "(", "arg_1", ")", "if", "arg_2", ":", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "arg_0", ".", "deserialize", "(", "arg_3", ")", "try", ":", "arg_0", ".", "validate", "(", "arg_4", ")", "return", "arg_4", "except", "TagValidationError", ":", "continue"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Pop all matching tags off the port, return a valid one.\"\"\"\n        arg_2 = arg_0._Func(arg_1)\n        if arg_2:\n            for arg_3 in arg_2:\n                arg_4 = arg_0.deserialize(arg_3)\n                try:\n                    arg_0.validate(arg_4)\n                    return arg_4\n                except TagValidationError:\n                    continue", "path": "quark/tags.py", "identifier": "Tag.pop", "docstring": "Pop all matching tags off the port, return a valid one.", "docstring_tokens": ["Pop", "all", "matching", "tags", "off", "the", "port", "return", "a", "valid", "one", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 258734}
{"url": "https://github.com/soerenwolfers/swutil/blob/2d598f2deac8b7e20df95dbc68017e5ab5d6180c/swutil/decorators.py#L30-L42", "sha": "2d598f2deac8b7e20df95dbc68017e5ab5d6180c", "docstring_summary": "Decorator that prints memory information at each call of the function", "language": "python", "parameters": "(function)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "memory_profiler", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "StringIO", "(", ")", "arg_4", "=", "memory_profiler", ".", "profile", "(", "func", "=", "arg_0", ",", "stream", "=", "arg_3", ",", "precision", "=", "4", ")", "arg_5", "=", "arg_4", "(", "*", "arg_1", ",", "**", "arg_2", ")", "print", "(", "arg_3", ".", "getvalue", "(", ")", ")", "arg_3", ".", "close", "(", ")", "return", "arg_5", "return", "wrapper"], "function": "def Func(arg_0):\n    '''\n    Decorator that prints memory information at each call of the function\n    '''\n    import memory_profiler\n    def wrapper(*arg_1,**arg_2):\n        arg_3 = StringIO()\n        arg_4 = memory_profiler.profile(func = arg_0,stream=arg_3,precision=4)\n        arg_5 = arg_4(*arg_1,**arg_2)\n        print(arg_3.getvalue())\n        arg_3.close()\n        return arg_5\n    return wrapper", "path": "swutil/decorators.py", "identifier": "print_memory", "docstring": "Decorator that prints memory information at each call of the function", "docstring_tokens": ["Decorator", "that", "prints", "memory", "information", "at", "each", "call", "of", "the", "function"], "nwo": "soerenwolfers/swutil", "score": 0.2747185692836802, "idx": 258735}
{"url": "https://github.com/voxpupuli/pypuppetdb/blob/cedeecf48014b4ad5b8e2513ca8230c814f45603/pypuppetdb/api.py#L838-L857", "sha": "cedeecf48014b4ad5b8e2513ca8230c814f45603", "docstring_summary": "Get Node and Fact information with an alternative query syntax\n        for structured facts instead of using the facts, fact-contents and\n        factsets endpoints for many fact-related queries.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "Func", "=", "arg_0", ".", "_query", "(", "'inventory'", ",", "**", "arg_1", ")", "for", "arg_3", "in", "Func", ":", "yield", "Inventory", "(", "node", "=", "arg_3", "[", "'certname'", "]", ",", "time", "=", "arg_3", "[", "'timestamp'", "]", ",", "environment", "=", "arg_3", "[", "'environment'", "]", ",", "facts", "=", "arg_3", "[", "'facts'", "]", ",", "trusted", "=", "arg_3", "[", "'trusted'", "]", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Get Node and Fact information with an alternative query syntax\n        for structured facts instead of using the facts, fact-contents and\n        factsets endpoints for many fact-related queries.\n\n        :param \\*\\*kwargs: The rest of the keyword arguments are passed\n                           to the _query function.\n\n        :returns: A generator yielding Inventory\n        :rtype: :class:`pypuppetdb.types.Inventory`\n        \"\"\"\n        Func = arg_0._query('inventory', **arg_1)\n        for arg_3 in Func:\n            yield Inventory(\n                node=arg_3['certname'],\n                time=arg_3['timestamp'],\n                environment=arg_3['environment'],\n                facts=arg_3['facts'],\n                trusted=arg_3['trusted']\n            )", "path": "pypuppetdb/api.py", "identifier": "BaseAPI.inventory", "docstring": "Get Node and Fact information with an alternative query syntax\n        for structured facts instead of using the facts, fact-contents and\n        factsets endpoints for many fact-related queries.\n\n        :param \\*\\*kwargs: The rest of the keyword arguments are passed\n                           to the _query function.\n\n        :returns: A generator yielding Inventory\n        :rtype: :class:`pypuppetdb.types.Inventory`", "docstring_tokens": ["Get", "Node", "and", "Fact", "information", "with", "an", "alternative", "query", "syntax", "for", "structured", "facts", "instead", "of", "using", "the", "facts", "fact", "-", "contents", "and", "factsets", "endpoints", "for", "many", "fact", "-", "related", "queries", "."], "nwo": "voxpupuli/pypuppetdb", "score": 0.6407386667560883, "idx": 258736}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L1650-L1675", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the Hub's history", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "_query_socket", ",", "\"history_request\"", ",", "arg_3", "=", "{", "}", ")", "arg_1", ",", "arg_2", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_0", ".", "_query_socket", ",", "0", ")", "if", "arg_0", ".", "debug", ":", "pprint", "(", "arg_2", ")", "arg_3", "=", "arg_2", "[", "'content'", "]", "if", "arg_3", "[", "'status'", "]", "!=", "'ok'", ":", "raise", "arg_0", ".", "_unwrap_exception", "(", "arg_3", ")", "else", ":", "return", "arg_3", "[", "'history'", "]"], "function": "def Func(arg_0):\n        \"\"\"Get the Hub's history\n\n        Just like the Client, the Hub has a history, which is a list of msg_ids.\n        This will contain the history of all clients, and, depending on configuration,\n        may contain history across multiple cluster sessions.\n\n        Any msg_id returned here is a valid argument to `get_result`.\n\n        Returns\n        -------\n\n        msg_ids : list of strs\n                list of all msg_ids, ordered by task submission time.\n        \"\"\"\n\n        arg_0.session.send(arg_0._query_socket, \"history_request\", arg_3={})\n        arg_1, arg_2 = arg_0.session.recv(arg_0._query_socket, 0)\n\n        if arg_0.debug:\n            pprint(arg_2)\n        arg_3 = arg_2['content']\n        if arg_3['status'] != 'ok':\n            raise arg_0._unwrap_exception(arg_3)\n        else:\n            return arg_3['history']", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client.hub_history", "docstring": "Get the Hub's history\n\n        Just like the Client, the Hub has a history, which is a list of msg_ids.\n        This will contain the history of all clients, and, depending on configuration,\n        may contain history across multiple cluster sessions.\n\n        Any msg_id returned here is a valid argument to `get_result`.\n\n        Returns\n        -------\n\n        msg_ids : list of strs\n                list of all msg_ids, ordered by task submission time.", "docstring_tokens": ["Get", "the", "Hub", "s", "history"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258737}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/utils.py#L95-L114", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return a set of unique field values from a list of DICOM files", "language": "python", "parameters": "(dcm_file_list, field_name)", "return_statement": "return field_values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "set", "(", ")", "for", "arg_3", "in", "arg_0", ":", "arg_2", ".", "add", "(", "str", "(", "DicomFile", "(", "arg_3", ")", ".", "get_attributes", "(", "arg_1", ")", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return a set of unique field values from a list of DICOM files\n\n    Parameters\n    ----------\n    dcm_file_list: iterable of DICOM file paths\n\n    field_name: str\n     Name of the field from where to get each value\n\n    Returns\n    -------\n    Set of field values\n    \"\"\"\n    arg_2 = set()\n\n    for arg_3 in arg_0:\n        arg_2.add(str(DicomFile(arg_3).get_attributes(arg_1)))\n\n    return arg_2", "path": "boyle/dicom/utils.py", "identifier": "get_unique_field_values", "docstring": "Return a set of unique field values from a list of DICOM files\n\n    Parameters\n    ----------\n    dcm_file_list: iterable of DICOM file paths\n\n    field_name: str\n     Name of the field from where to get each value\n\n    Returns\n    -------\n    Set of field values", "docstring_tokens": ["Return", "a", "set", "of", "unique", "field", "values", "from", "a", "list", "of", "DICOM", "files"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258738}
{"url": "https://github.com/Yubico/python-u2flib-host/blob/eadc4dbf3bf516e74ea00d2e5690742a535834cb/u2flib_host/utils.py#L40-L49", "sha": "eadc4dbf3bf516e74ea00d2e5690742a535834cb", "docstring_summary": "Recursively converts unicode objects to UTF-8 encoded byte strings.", "language": "python", "parameters": "(data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "return", "{", "Func", "(", "arg_1", ")", ":", "Func", "(", "arg_2", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", "}", "elif", "isinstance", "(", "arg_0", ",", "list", ")", ":", "return", "[", "Func", "(", "arg_3", ")", "for", "arg_3", "in", "arg_0", "]", "elif", "isinstance", "(", "arg_0", ",", "text_type", ")", ":", "return", "arg_0", ".", "encode", "(", "'utf-8'", ")", "else", ":", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Recursively converts unicode objects to UTF-8 encoded byte strings.\"\"\"\n    if isinstance(arg_0, dict):\n        return {Func(arg_1): Func(arg_2) for arg_1, arg_2 in arg_0.items()}\n    elif isinstance(arg_0, list):\n        return [Func(arg_3) for arg_3 in arg_0]\n    elif isinstance(arg_0, text_type):\n        return arg_0.encode('utf-8')\n    else:\n        return arg_0", "path": "u2flib_host/utils.py", "identifier": "u2str", "docstring": "Recursively converts unicode objects to UTF-8 encoded byte strings.", "docstring_tokens": ["Recursively", "converts", "unicode", "objects", "to", "UTF", "-", "8", "encoded", "byte", "strings", "."], "nwo": "Yubico/python-u2flib-host", "score": 0.37487477839678873, "idx": 258739}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_store.py#L46-L53", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Register all messages from a checker.", "language": "python", "parameters": "(self, checker)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "check_consistency", "(", ")", "for", "arg_2", "in", "arg_1", ".", "messages", ":", "arg_0", ".", "register_message", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Register all messages from a checker.\n\n        :param BaseChecker checker:\n        \"\"\"\n        arg_1.check_consistency()\n        for arg_2 in arg_1.messages:\n            arg_0.register_message(arg_2)", "path": "pylint/message/message_store.py", "identifier": "MessagesStore.register_messages_from_checker", "docstring": "Register all messages from a checker.\n\n        :param BaseChecker checker:", "docstring_tokens": ["Register", "all", "messages", "from", "a", "checker", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258740}
{"url": "https://github.com/jonathanj/txspinneret/blob/717008a2c313698984a23e3f3fc62ea3675ed02d/txspinneret/query.py#L76-L97", "sha": "717008a2c313698984a23e3f3fc62ea3675ed02d", "docstring_summary": "Parse a value as text.", "language": "python", "parameters": "(value, encoding=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "'utf-8'", "if", "isinstance", "(", "arg_0", ",", "bytes", ")", ":", "return", "arg_0", ".", "decode", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_0", ",", "unicode", ")", ":", "return", "arg_0", "return", "None"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Parse a value as text.\n\n    :type  value: `unicode` or `bytes`\n    :param value: Func value to parse\n\n    :type  encoding: `bytes`\n    :param encoding: Encoding to treat ``bytes`` values as, defaults to\n        ``utf-8``.\n\n    :rtype: `unicode`\n    :return: Parsed text or ``None`` if ``value`` is neither `bytes` nor\n        `unicode`.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = 'utf-8'\n    if isinstance(arg_0, bytes):\n        return arg_0.decode(arg_1)\n    elif isinstance(arg_0, unicode):\n        return arg_0\n    return None", "path": "txspinneret/query.py", "identifier": "Text", "docstring": "Parse a value as text.\n\n    :type  value: `unicode` or `bytes`\n    :param value: Text value to parse\n\n    :type  encoding: `bytes`\n    :param encoding: Encoding to treat ``bytes`` values as, defaults to\n        ``utf-8``.\n\n    :rtype: `unicode`\n    :return: Parsed text or ``None`` if ``value`` is neither `bytes` nor\n        `unicode`.", "docstring_tokens": ["Parse", "a", "value", "as", "text", "."], "nwo": "jonathanj/txspinneret", "score": 0.08529914490135834, "idx": 258741}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/diseases.py#L9-L23", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Show all diseases in the database", "language": "python", "parameters": "(context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "LOG", ".", "info", "(", "\"Running scout view Func\"", ")", "arg_1", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_2", "=", "arg_1", ".", "disease_terms", "(", ")", "arg_3", "=", "arg_2", ".", "count", "(", ")", "if", "arg_3", "==", "0", ":", "click", ".", "echo", "(", "\"No Func found\"", ")", "else", ":", "click", ".", "echo", "(", "\"Disease\"", ")", "for", "arg_4", "in", "arg_1", ".", "disease_terms", "(", ")", ":", "click", ".", "echo", "(", "\"{0}\"", ".", "format", "(", "arg_4", "[", "'_id'", "]", ")", ")", "LOG", ".", "info", "(", "\"{0} Func found\"", ".", "format", "(", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Show all Func in the database\"\"\"\n    LOG.info(\"Running scout view Func\")\n    arg_1 = arg_0.obj['adapter']\n\n    arg_2 = arg_1.disease_terms()\n\n    arg_3 = arg_2.count()\n    if arg_3 == 0:\n        click.echo(\"No Func found\")\n    else:\n        click.echo(\"Disease\")\n        for arg_4 in arg_1.disease_terms():\n            click.echo(\"{0}\".format(arg_4['_id']))\n        LOG.info(\"{0} Func found\".format(arg_3))", "path": "scout/commands/view/diseases.py", "identifier": "diseases", "docstring": "Show all diseases in the database", "docstring_tokens": ["Show", "all", "diseases", "in", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258742}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/indexing/standard.py#L47-L51", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "hyperpolarization step. Use to calculate tau and stuff.", "language": "python", "parameters": "(abf=exampleABF)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ")", ":", "swhlab", ".", "memtest", ".", "memtest", "(", "arg_0", ")", "swhlab", ".", "memtest", ".", "checkSweep", "(", "arg_0", ")", "swhlab", ".", "plot", ".", "save", "(", "arg_0", ",", "tag", "=", "\"tau\"", ")"], "function": "def Func(arg_0=arg_1):\n    \"\"\"hyperpolarization step. Use to calculate tau and stuff.\"\"\"\n    swhlab.memtest.memtest(arg_0) #knows how to do IC memtest\n    swhlab.memtest.checkSweep(arg_0) #lets you eyeball check how it did\n    swhlab.plot.save(arg_0,tag=\"tau\")", "path": "doc/oldcode/indexing/standard.py", "identifier": "proto_01_01_HP010", "docstring": "hyperpolarization step. Use to calculate tau and stuff.", "docstring_tokens": ["hyperpolarization", "step", ".", "Use", "to", "calculate", "tau", "and", "stuff", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 258743}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/dist.py#L132-L137", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Generates a random sample from the Poisson probability distribution and\n    returns its value and the log of the probability of sampling that value.", "language": "python", "parameters": "(self, rgen)", "return_statement": "return x, self.logDensity(x)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "poisson", "(", "arg_0", ".", "lambdaParameter", ")", "return", "arg_2", ",", "arg_0", ".", "logDensity", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Generates a random Func from the Poisson probability distribution and\n    returns its value and the log of the probability of sampling that value.\n    \"\"\"\n    arg_2 = arg_1.poisson(arg_0.lambdaParameter)\n    return arg_2, arg_0.logDensity(arg_2)", "path": "src/nupic/math/dist.py", "identifier": "PoissonDistribution.sample", "docstring": "Generates a random sample from the Poisson probability distribution and\n    returns its value and the log of the probability of sampling that value.", "docstring_tokens": ["Generates", "a", "random", "sample", "from", "the", "Poisson", "probability", "distribution", "and", "returns", "its", "value", "and", "the", "log", "of", "the", "probability", "of", "sampling", "that", "value", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258744}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/extreme_scale/mpi_worker_pool.py#L125-L136", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Receives 1 task request from MPI comm", "language": "python", "parameters": "(self)", "return_statement": "return worker_rank", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "MPI", ".", "Status", "(", ")", "comm", ".", "recv", "(", "source", "=", "MPI", ".", "ANY_SOURCE", ",", "tag", "=", "TASK_REQUEST_TAG", ",", "status", "=", "arg_1", ")", "arg_2", "=", "arg_1", ".", "Get_source", "(", ")", "logger", ".", "info", "(", "\"Received task request from worker:{}\"", ".", "format", "(", "arg_2", ")", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" Receives 1 task request from MPI comm\n\n        Returns:\n        --------\n            worker_rank: worker_rank id\n        \"\"\"\n        arg_1 = MPI.Status()\n        comm.recv(source=MPI.ANY_SOURCE, tag=TASK_REQUEST_TAG, status=arg_1)\n        arg_2 = arg_1.Get_source()\n        logger.info(\"Received task request from worker:{}\".format(arg_2))\n        return arg_2", "path": "parsl/executors/extreme_scale/mpi_worker_pool.py", "identifier": "Manager.recv_task_request_from_workers", "docstring": "Receives 1 task request from MPI comm\n\n        Returns:\n        --------\n            worker_rank: worker_rank id", "docstring_tokens": ["Receives", "1", "task", "request", "from", "MPI", "comm"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 258745}
{"url": "https://github.com/cmcginty/PyWeather/blob/8c25d9cd1fa921e0a6e460d523656279cac045cb/scripts/weatherpub.py#L77-L109", "sha": "8c25d9cd1fa921e0a6e460d523656279cac045cb", "docstring_summary": "main execution loop. query weather data and post to online service.", "language": "python", "parameters": "(station, pub_sites, interval)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "parse", "(", ")", "if", "arg_0", ".", "fields", "[", "'TempOut'", "]", ">", "200", ":", "raise", "NoSensorException", "(", "'Out of range temperature value: %.1f, check sensors'", "%", "(", "arg_0", ".", "fields", "[", "'TempOut'", "]", ",", ")", ")", "arg_3", ",", "arg_4", "=", "WindGust", ".", "get", "(", "arg_0", ",", "arg_2", ")", "for", "arg_5", "in", "arg_1", ":", "try", ":", "arg_5", ".", "set", "(", "pressure", "=", "arg_0", ".", "fields", "[", "'Pressure'", "]", ",", "dewpoint", "=", "arg_0", ".", "fields", "[", "'DewPoint'", "]", ",", "humidity", "=", "arg_0", ".", "fields", "[", "'HumOut'", "]", ",", "tempf", "=", "arg_0", ".", "fields", "[", "'TempOut'", "]", ",", "rainin", "=", "arg_0", ".", "fields", "[", "'RainRate'", "]", ",", "rainday", "=", "arg_0", ".", "fields", "[", "'RainDay'", "]", ",", "dateutc", "=", "arg_0", ".", "fields", "[", "'DateStampUtc'", "]", ",", "windspeed", "=", "arg_0", ".", "fields", "[", "'WindSpeed10Min'", "]", ",", "winddir", "=", "arg_0", ".", "fields", "[", "'WindDir'", "]", ",", "windgust", "=", "arg_3", ",", "windgustdir", "=", "arg_4", ",", ")", "arg_5", ".", "publish", "(", ")", "except", "(", "Exception", ")", "as", "e", ":", "log", ".", "warn", "(", "'publisher %s: %s'", "%", "(", "arg_5", ".", "__class__", ".", "__name__", ",", "e", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n   '''\n   main execution loop. query weather data and post to online service.\n   '''\n   arg_0.parse()      # read weather data\n\n   # santity check weather data\n   if arg_0.fields['TempOut'] > 200:\n      raise NoSensorException(\n            'Out of range temperature value: %.1f, check sensors' %\n            (arg_0.fields['TempOut'],))\n\n   arg_3, arg_4 = WindGust.get( arg_0, arg_2 )\n\n   # upload data in the following order:\n   for arg_5 in arg_1:\n      try: # try block necessary to attempt every publisher\n         arg_5.set(\n               pressure    = arg_0.fields['Pressure'],\n               dewpoint    = arg_0.fields['DewPoint'],\n               humidity    = arg_0.fields['HumOut'],\n               tempf       = arg_0.fields['TempOut'],\n               rainin      = arg_0.fields['RainRate'],\n               rainday     = arg_0.fields['RainDay'],\n               dateutc     = arg_0.fields['DateStampUtc'],\n               windspeed   = arg_0.fields['WindSpeed10Min'],\n               winddir     = arg_0.fields['WindDir'],\n               windgust    = arg_3,\n               windgustdir = arg_4, )\n\n         arg_5.publish()\n      except (Exception) as e:\n         log.warn('publisher %s: %s'%(arg_5.__class__.__name__,e))", "path": "scripts/weatherpub.py", "identifier": "weather_update", "docstring": "main execution loop. query weather data and post to online service.", "docstring_tokens": ["main", "execution", "loop", ".", "query", "weather", "data", "and", "post", "to", "online", "service", "."], "nwo": "cmcginty/PyWeather", "score": 0.19714217663807126, "idx": 258746}
{"url": "https://github.com/hsharrison/pyglet2d/blob/46f610b3c76221bff19e5c0cf3d35d7875ce37a0/src/pyglet2d.py#L142-L165", "sha": "46f610b3c76221bff19e5c0cf3d35d7875ce37a0", "docstring_summary": "Create a |Shape| from a dictionary specification.", "language": "python", "parameters": "(cls, spec)", "return_statement": "return cls(vertices, **spec)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "copy", "(", ")", "arg_2", "=", "arg_1", ".", "pop", "(", "'center'", ",", "None", ")", "arg_3", "=", "arg_1", ".", "pop", "(", "'radius'", ",", "None", ")", "if", "arg_2", "and", "arg_3", ":", "return", "arg_0", ".", "circle", "(", "arg_2", ",", "arg_3", ",", "**", "arg_1", ")", "arg_4", "=", "arg_1", ".", "pop", "(", "'vertices'", ")", "if", "len", "(", "arg_4", ")", "==", "2", ":", "return", "arg_0", ".", "rectangle", "(", "arg_4", ",", "**", "arg_1", ")", "return", "arg_0", "(", "arg_4", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create a |Shape| from a dictionary specification.\n\n        Parameters\n        ----------\n        spec : dict\n            A dictionary with either the fields ``'center'`` and ``'radius'`` (for a circle),\n            ``'center'``, ``'radius'``, and ``'n_vertices'`` (for a regular polygon),\n            or ``'vertices'``.\n            If only two vertices are given, they are assumed to be lower left and top right corners of a rectangle.\n            Other fields are interpreted as keyword arguments.\n\n        \"\"\"\n        arg_1 = arg_1.copy()\n        arg_2 = arg_1.pop('center', None)\n        arg_3 = arg_1.pop('radius', None)\n        if arg_2 and arg_3:\n            return arg_0.circle(arg_2, arg_3, **arg_1)\n\n        arg_4 = arg_1.pop('vertices')\n        if len(arg_4) == 2:\n            return arg_0.rectangle(arg_4, **arg_1)\n\n        return arg_0(arg_4, **arg_1)", "path": "src/pyglet2d.py", "identifier": "Shape.from_dict", "docstring": "Create a |Shape| from a dictionary specification.\n\n        Parameters\n        ----------\n        spec : dict\n            A dictionary with either the fields ``'center'`` and ``'radius'`` (for a circle),\n            ``'center'``, ``'radius'``, and ``'n_vertices'`` (for a regular polygon),\n            or ``'vertices'``.\n            If only two vertices are given, they are assumed to be lower left and top right corners of a rectangle.\n            Other fields are interpreted as keyword arguments.", "docstring_tokens": ["Create", "a", "|Shape|", "from", "a", "dictionary", "specification", "."], "nwo": "hsharrison/pyglet2d", "score": 0.2823188883832642, "idx": 258747}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/latex.py#L119-L179", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return LaTeX string representation of circuit.", "language": "python", "parameters": "(self, aliases=None)", "return_statement": "return contents", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", ".", "_initialize_Func_array", "(", "arg_1", ")", "arg_0", ".", "_build_Func_array", "(", "arg_1", ")", "arg_2", "=", "r\"\"\"% \\documentclass[preview]{standalone}% If the image is too large to fit on this documentclass use\\documentclass[draft]{beamer}\"\"\"", "arg_3", "=", "\"\\\\usepackage[size=custom,height=%d,width=%d,scale=%.1f]{beamerposter}\\n\"", "arg_4", "=", "r\"\"\"% instead and customize the height and width (in cm) to fit.% Large images may run out of memory quickly.% To fix this use the LuaLaTeX compiler, which dynamically% allocates memory.\\usepackage[braket, qm]{qcircuit}\\usepackage{amsmath}\\pdfmapfile{+sansmathaccent.map}% \\usepackage[landscape]{geometry}% Comment out the above line if using the beamer documentclass.\\begin{document}\\begin{equation*}\"\"\"", "arg_5", "=", "r\"\"\"    \\Qcircuit @C=%.1fem @R=%.1fem @!R {\"\"\"", "arg_6", "=", "io", ".", "StringIO", "(", ")", "arg_6", ".", "write", "(", "arg_2", ")", "arg_6", ".", "write", "(", "'%% img_width = %d, img_depth = %d\\n'", "%", "(", "arg_0", ".", "img_width", ",", "arg_0", ".", "img_depth", ")", ")", "arg_6", ".", "write", "(", "arg_3", "%", "arg_0", ".", "_get_beamer_page", "(", ")", ")", "arg_6", ".", "write", "(", "arg_4", ")", "arg_6", ".", "write", "(", "arg_5", "%", "(", "arg_0", ".", "column_separation", ",", "arg_0", ".", "row_separation", ")", ")", "for", "arg_7", "in", "range", "(", "arg_0", ".", "img_width", ")", ":", "arg_6", ".", "write", "(", "\"\\t \\t\"", ")", "for", "arg_8", "in", "range", "(", "arg_0", ".", "img_depth", "+", "1", ")", ":", "arg_9", "=", "arg_0", ".", "_Func", "[", "arg_7", "]", "[", "arg_8", "]", "if", "'barrier'", "in", "arg_9", ":", "arg_6", ".", "write", "(", "arg_9", ")", "else", ":", "arg_9", "=", "re", ".", "sub", "(", "r'[-+]?\\d*\\.\\d{2,}|\\d{2,}'", ",", "_truncate_float", ",", "arg_9", ")", "arg_6", ".", "write", "(", "arg_9", ")", "if", "arg_8", "!=", "arg_0", ".", "img_depth", ":", "arg_6", ".", "write", "(", "\" & \"", ")", "else", ":", "arg_6", ".", "write", "(", "r'\\\\'", "+", "'\\n'", ")", "arg_6", ".", "write", "(", "'\\t }\\n'", ")", "arg_6", ".", "write", "(", "'\\\\end{equation*}\\n\\n'", ")", "arg_6", ".", "write", "(", "'\\\\end{document}'", ")", "arg_10", "=", "arg_6", ".", "getvalue", "(", ")", "arg_6", ".", "close", "(", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Return LaTeX string representation of circuit.\n\n        This method uses the LaTeX Qconfig package to create a graphical\n        representation of the circuit.\n\n        Returns:\n            string: for writing to a LaTeX file.\n        \"\"\"\n        arg_0._initialize_Func_array(arg_1)\n        arg_0._build_Func_array(arg_1)\n        arg_2 = r\"\"\"% \\documentclass[preview]{standalone}\n% If the image is too large to fit on this documentclass use\n\\documentclass[draft]{beamer}\n\"\"\"\n        arg_3 = \"\\\\usepackage[size=custom,height=%d,width=%d,scale=%.1f]{beamerposter}\\n\"\n        arg_4 = r\"\"\"% instead and customize the height and width (in cm) to fit.\n% Large images may run out of memory quickly.\n% To fix this use the LuaLaTeX compiler, which dynamically\n% allocates memory.\n\\usepackage[braket, qm]{qcircuit}\n\\usepackage{amsmath}\n\\pdfmapfile{+sansmathaccent.map}\n% \\usepackage[landscape]{geometry}\n% Comment out the above line if using the beamer documentclass.\n\\begin{document}\n\\begin{equation*}\"\"\"\n        arg_5 = r\"\"\"\n    \\Qcircuit @C=%.1fem @R=%.1fem @!R {\n\"\"\"\n        arg_6 = io.StringIO()\n        arg_6.write(arg_2)\n        arg_6.write('%% img_width = %d, img_depth = %d\\n' % (arg_0.img_width, arg_0.img_depth))\n        arg_6.write(arg_3 % arg_0._get_beamer_page())\n        arg_6.write(arg_4)\n        arg_6.write(arg_5 %\n                     (arg_0.column_separation, arg_0.row_separation))\n        for arg_7 in range(arg_0.img_width):\n            arg_6.write(\"\\t \\t\")\n            for arg_8 in range(arg_0.img_depth + 1):\n                arg_9 = arg_0._Func[arg_7][arg_8]\n                # Don't truncate offset float if drawing a barrier\n                if 'barrier' in arg_9:\n                    arg_6.write(arg_9)\n                else:\n                    # floats can cause \"Dimension too large\" Func error in\n                    # xymatrix this truncates floats to avoid issue.\n                    arg_9 = re.sub(r'[-+]?\\d*\\.\\d{2,}|\\d{2,}',\n                                      _truncate_float,\n                                      arg_9)\n                    arg_6.write(arg_9)\n                if arg_8 != arg_0.img_depth:\n                    arg_6.write(\" & \")\n                else:\n                    arg_6.write(r'\\\\' + '\\n')\n        arg_6.write('\\t }\\n')\n        arg_6.write('\\\\end{equation*}\\n\\n')\n        arg_6.write('\\\\end{document}')\n        arg_10 = arg_6.getvalue()\n        arg_6.close()\n        return arg_10", "path": "qiskit/visualization/latex.py", "identifier": "QCircuitImage.latex", "docstring": "Return LaTeX string representation of circuit.\n\n        This method uses the LaTeX Qconfig package to create a graphical\n        representation of the circuit.\n\n        Returns:\n            string: for writing to a LaTeX file.", "docstring_tokens": ["Return", "LaTeX", "string", "representation", "of", "circuit", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258748}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/preprocessing.py#L196-L234", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Compute the minimum and maximum to be used for later scaling.", "language": "python", "parameters": "(self, X, y=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_1", "=", "check_array", "(", "arg_1", ",", "copy", "=", "arg_0", ".", "copy", ",", "dtype", "=", "[", "np", ".", "float64", ",", "np", ".", "float32", ",", "np", ".", "float16", ",", "np", ".", "float128", "]", ")", "arg_3", "=", "arg_0", ".", "feature_range", "if", "arg_3", "[", "0", "]", ">=", "arg_3", "[", "1", "]", ":", "raise", "ValueError", "(", "\"Minimum of desired feature range must be smaller\"", "\" than maximum. Got %s.\"", "%", "str", "(", "arg_3", ")", ")", "if", "arg_0", ".", "Func_feature_range", "is", "not", "None", ":", "arg_4", "=", "arg_0", ".", "Func_feature_range", "if", "arg_4", "[", "0", "]", ">=", "arg_4", "[", "1", "]", ":", "raise", "ValueError", "(", "\"Minimum of desired (Func) feature range must \"", "\"be smaller than maximum. Got %s.\"", "%", "str", "(", "arg_3", ")", ")", "if", "(", "arg_4", "[", "0", "]", "<", "arg_3", "[", "0", "]", "or", "arg_4", "[", "1", "]", ">", "arg_3", "[", "1", "]", ")", ":", "raise", "ValueError", "(", "\"Func_feature_range must be a subset of \"", "\"feature_range. Got %s, Func %s.\"", "%", "(", "str", "(", "arg_3", ")", ",", "str", "(", "arg_4", ")", ")", ")", "arg_3", "=", "arg_4", "arg_5", "=", "np", ".", "min", "(", "arg_1", ",", "axis", "=", "0", ")", "arg_6", "=", "np", ".", "max", "(", "arg_1", ",", "axis", "=", "0", ")", "-", "arg_5", "arg_6", "[", "arg_6", "==", "0.0", "]", "=", "1.0", "arg_0", ".", "scale_", "=", "(", "arg_3", "[", "1", "]", "-", "arg_3", "[", "0", "]", ")", "/", "arg_6", "arg_0", ".", "min_", "=", "arg_3", "[", "0", "]", "-", "arg_5", "*", "arg_0", ".", "scale_", "arg_0", ".", "data_range", "=", "arg_6", "arg_0", ".", "data_min", "=", "arg_5", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Compute the minimum and maximum to be used for later scaling.\n\n        Parameters\n        ----------\n        X : array-like, shape [n_samples, n_features]\n            The data used to compute the per-feature minimum and maximum\n            used for later scaling along the features axis.\n        \"\"\"\n        arg_1 = check_array(arg_1, copy=arg_0.copy,\n                        dtype=[np.float64, np.float32, np.float16, np.float128])\n\n        arg_3 = arg_0.feature_range\n        if arg_3[0] >= arg_3[1]:\n            raise ValueError(\"Minimum of desired feature range must be smaller\"\n                             \" than maximum. Got %s.\" % str(arg_3))\n        if arg_0.Func_feature_range is not None:\n            arg_4 = arg_0.Func_feature_range\n            if arg_4[0] >= arg_4[1]:\n                raise ValueError(\"Minimum of desired (Func) feature range must \"\n                                 \"be smaller than maximum. Got %s.\"\n                                 % str(arg_3))\n            if (arg_4[0] < arg_3[0] or\n                    arg_4[1] > arg_3[1]):\n                raise ValueError(\"Func_feature_range must be a subset of \"\n                                 \"feature_range. Got %s, Func %s.\"\n                                 % (str(arg_3),\n                                    str(arg_4)))\n            arg_3 = arg_4\n\n        arg_5 = np.min(arg_1, axis=0)\n        arg_6 = np.max(arg_1, axis=0) - arg_5\n        # Do not scale constant features\n        arg_6[arg_6 == 0.0] = 1.0\n        arg_0.scale_ = (arg_3[1] - arg_3[0]) / arg_6\n        arg_0.min_ = arg_3[0] - arg_5 * arg_0.scale_\n        arg_0.data_range = arg_6\n        arg_0.data_min = arg_5\n        return arg_0", "path": "skl_groups/preprocessing.py", "identifier": "MinMaxScaler.fit", "docstring": "Compute the minimum and maximum to be used for later scaling.\n\n        Parameters\n        ----------\n        X : array-like, shape [n_samples, n_features]\n            The data used to compute the per-feature minimum and maximum\n            used for later scaling along the features axis.", "docstring_tokens": ["Compute", "the", "minimum", "and", "maximum", "to", "be", "used", "for", "later", "scaling", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 258749}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cache.py#L61-L68", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Save the environment cache to disk.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "dict", "(", "name", "=", "env", ".", "name", ",", "root", "=", "env", ".", "path", ")", "for", "env", "in", "arg_0", "]", "arg_2", "=", "yaml", ".", "safe_dump", "(", "arg_1", ",", "default_flow_style", "=", "False", ")", "with", "open", "(", "arg_0", ".", "path", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        '''Save the environment cache to disk.'''\n\n        arg_1 = [dict(name=env.name, root=env.path) for env in arg_0]\n        arg_2 = yaml.safe_dump(arg_1, default_flow_style=False)\n\n        with open(arg_0.path, 'w') as f:\n            f.write(arg_2)", "path": "cpenv/cache.py", "identifier": "EnvironmentCache.save", "docstring": "Save the environment cache to disk.", "docstring_tokens": ["Save", "the", "environment", "cache", "to", "disk", "."], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 258750}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L927-L949", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Copy files\n       This function can handle multiple files if source S3 URL has wildcard\n       characters. It also handles recursive mode by copying all files and\n       keep the directory structure.", "language": "python", "parameters": "(self, source, target, delete_source=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "ThreadPool", "(", "ThreadUtil", ",", "arg_0", ".", "opt", ")", "arg_1", "=", "arg_0", ".", "source_expand", "(", "arg_1", ")", "if", "arg_2", "[", "-", "1", "]", "==", "PATH_SEP", ":", "for", "arg_5", "in", "arg_1", ":", "arg_0", ".", "cp_single_file", "(", "arg_4", ",", "arg_5", ",", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_0", ".", "get_basename", "(", "S3URL", "(", "arg_5", ")", ".", "path", ")", ")", ",", "arg_3", ")", "else", ":", "if", "len", "(", "arg_1", ")", ">", "1", ":", "raise", "Failure", "(", "'Target \"%s\" is not a directory (with a trailing slash).'", "%", "arg_2", ")", "elif", "len", "(", "arg_1", ")", "==", "1", ":", "arg_0", ".", "cp_single_file", "(", "arg_4", ",", "arg_1", "[", "0", "]", ",", "arg_2", ",", "arg_3", ")", "else", ":", "pass", "arg_4", ".", "join", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    '''Copy files\n       This function can handle multiple files if source S3 URL has wildcard\n       characters. It also handles recursive mode by copying all files and\n       keep the directory structure.\n    '''\n    arg_4 = ThreadPool(ThreadUtil, arg_0.opt)\n    arg_1 = arg_0.source_expand(arg_1)\n\n    if arg_2[-1] == PATH_SEP:\n      for arg_5 in arg_1:\n        arg_0.cp_single_file(arg_4, arg_5, os.path.join(arg_2, arg_0.get_basename(S3URL(arg_5).path)), arg_3)\n    else:\n      if len(arg_1) > 1:\n        raise Failure('Target \"%s\" is not a directory (with a trailing slash).' % arg_2)\n        # Copy file if it exists otherwise do nothing\n      elif len(arg_1) == 1:\n        arg_0.cp_single_file(arg_4, arg_1[0], arg_2, arg_3)\n      else:\n        # Source expand may return empty list only if ignore-empty-source is set to true\n        pass\n\n    arg_4.join()", "path": "s4cmd.py", "identifier": "S3Handler.cp_files", "docstring": "Copy files\n       This function can handle multiple files if source S3 URL has wildcard\n       characters. It also handles recursive mode by copying all files and\n       keep the directory structure.", "docstring_tokens": ["Copy", "files", "This", "function", "can", "handle", "multiple", "files", "if", "source", "S3", "URL", "has", "wildcard", "characters", ".", "It", "also", "handles", "recursive", "mode", "by", "copying", "all", "files", "and", "keep", "the", "directory", "structure", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 258751}
{"url": "https://github.com/amyth/django-instapush/blob/f8643a2e342fc73a16c95dff79c3daac8ce4b034/instapush/libs/gcm.py#L159-L165", "sha": "f8643a2e342fc73a16c95dff79c3daac8ce4b034", "docstring_summary": "Standalone method to send bulk gcm notifications", "language": "python", "parameters": "(registration_ids, data, encoding='utf-8', **kwargs)", "return_statement": "return messenger.send_bulk()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'utf-8'", ",", "**", "arg_3", ")", ":", "arg_4", "=", "GCMMessenger", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "return", "arg_4", ".", "send_bulk", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2='utf-8', **arg_3):\n    \"\"\"\n    Standalone method to send bulk gcm notifications\n    \"\"\"\n\n    arg_4 = GCMMessenger(arg_0, arg_1, arg_2=arg_2, **arg_3)\n    return arg_4.send_bulk()", "path": "instapush/libs/gcm.py", "identifier": "gcm_send_bulk_message", "docstring": "Standalone method to send bulk gcm notifications", "docstring_tokens": ["Standalone", "method", "to", "send", "bulk", "gcm", "notifications"], "nwo": "amyth/django-instapush", "score": 0.194552411663553, "idx": 258752}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L816-L882", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "``f`` is a ``ZipFile`` that is open\n    Extract out the document data, numbering data and the relationship data.", "language": "python", "parameters": "(f, image_handler=None)", "return_statement": "return document_xml, meta_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "def", "arg_1", "(", "arg_2", ",", "arg_3", ")", ":", "return", "arg_3", ".", "get", "(", "arg_2", ")", "arg_4", "=", "None", "arg_5", "=", "None", "arg_6", "=", "None", "arg_7", "=", "None", "arg_8", "=", "etree", ".", "XMLParser", "(", "strip_cdata", "=", "False", ")", "arg_9", ",", "arg_10", "=", "os", ".", "path", ".", "split", "(", "arg_0", ".", "filename", ")", "arg_11", "=", "{", "}", "arg_12", "=", "{", "}", "for", "arg_13", "in", "arg_0", ".", "infolist", "(", ")", ":", "if", "arg_13", ".", "filename", "==", "'word/document.xml'", ":", "arg_14", "=", "arg_0", ".", "read", "(", "arg_13", ".", "filename", ")", "arg_4", "=", "etree", ".", "fromstring", "(", "arg_14", ",", "arg_8", ")", "elif", "arg_13", ".", "filename", "==", "'word/numbering.xml'", ":", "arg_14", "=", "arg_0", ".", "read", "(", "arg_13", ".", "filename", ")", "arg_5", "=", "etree", ".", "fromstring", "(", "arg_14", ",", "arg_8", ")", "elif", "arg_13", ".", "filename", "==", "'word/styles.xml'", ":", "arg_14", "=", "arg_0", ".", "read", "(", "arg_13", ".", "filename", ")", "arg_7", "=", "etree", ".", "fromstring", "(", "arg_14", ",", "arg_8", ")", "elif", "arg_13", ".", "filename", "==", "'word/_rels/document.xml.rels'", ":", "arg_14", "=", "arg_0", ".", "read", "(", "arg_13", ".", "filename", ")", "try", ":", "arg_6", "=", "etree", ".", "fromstring", "(", "arg_14", ",", "arg_8", ")", "except", "XMLSyntaxError", ":", "arg_6", "=", "etree", ".", "fromstring", "(", "'<xml></xml>'", ",", "arg_8", ")", "if", "arg_13", ".", "filename", ".", "startswith", "(", "'word/media/'", ")", ":", "arg_11", "[", "arg_13", ".", "filename", "[", "arg_16", "(", "'word/'", ")", ":", "]", "]", "=", "arg_0", ".", "extract", "(", "arg_13", ".", "filename", ",", "arg_9", ",", ")", "arg_0", ".", "close", "(", ")", "arg_17", "=", "get_numbering_info", "(", "arg_5", ")", "arg_12", "=", "get_image_sizes", "(", "arg_4", ")", "arg_3", "=", "get_relationship_info", "(", "arg_6", ",", "arg_11", ",", "arg_12", ")", "arg_18", "=", "get_style_dict", "(", "arg_7", ")", "arg_19", "=", "defaultdict", "(", "int", ")", "if", "DETECT_FONT_SIZE", ":", "arg_19", "=", "get_font_sizes_dict", "(", "arg_4", ",", "arg_18", ")", "arg_20", "=", "MetaData", "(", "arg_17", "=", "arg_17", ",", "arg_3", "=", "arg_3", ",", "arg_18", "=", "arg_18", ",", "arg_19", "=", "arg_19", ",", "arg_1", "=", "arg_1", ",", "arg_12", "=", "arg_12", ",", ")", "return", "arg_4", ",", "arg_20"], "function": "def Func(arg_0, arg_1=None):\n    '''\n    ``f`` is a ``ZipFile`` that is open\n    Extract out the document data, numbering data and the relationship data.\n    '''\n    if arg_1 is None:\n        def arg_1(arg_2, arg_3):\n            return arg_3.get(arg_2)\n\n    arg_4 = None\n    arg_5 = None\n    arg_6 = None\n    arg_7 = None\n    arg_8 = etree.XMLParser(strip_cdata=False)\n    arg_9, arg_10 = os.path.split(arg_0.filename)\n    arg_11 = {}\n    arg_12 = {}\n    # Loop through the files in the zip file.\n    for arg_13 in arg_0.infolist():\n        # This file holds all the content of the document.\n        if arg_13.filename == 'word/document.xml':\n            arg_14 = arg_0.read(arg_13.filename)\n            arg_4 = etree.fromstring(arg_14, arg_8)\n        # This file tells document.xml how lists should look.\n        elif arg_13.filename == 'word/numbering.xml':\n            arg_14 = arg_0.read(arg_13.filename)\n            arg_5 = etree.fromstring(arg_14, arg_8)\n        elif arg_13.filename == 'word/styles.xml':\n            arg_14 = arg_0.read(arg_13.filename)\n            arg_7 = etree.fromstring(arg_14, arg_8)\n        # This file holds the targets for hyperlinks and images.\n        elif arg_13.filename == 'word/_rels/document.xml.rels':\n            arg_14 = arg_0.read(arg_13.filename)\n            try:\n                arg_6 = etree.fromstring(arg_14, arg_8)\n            except XMLSyntaxError:\n                arg_6 = etree.fromstring('<xml></xml>', arg_8)\n        if arg_13.filename.startswith('word/media/'):\n            # Strip off the leading word/\n            arg_11[arg_13.filename[arg_16('word/'):]] = arg_0.extract(\n                arg_13.filename,\n                arg_9,\n            )\n    # Close the file pointer.\n    arg_0.close()\n\n    # Get dictionaries for the numbering and the relationships.\n    arg_17 = get_numbering_info(arg_5)\n    arg_12 = get_image_sizes(arg_4)\n    arg_3 = get_relationship_info(\n        arg_6,\n        arg_11,\n        arg_12\n    )\n    arg_18 = get_style_dict(arg_7)\n    arg_19 = defaultdict(int)\n    if DETECT_FONT_SIZE:\n        arg_19 = get_font_sizes_dict(arg_4, arg_18)\n    arg_20 = MetaData(\n        arg_17=arg_17,\n        arg_3=arg_3,\n        arg_18=arg_18,\n        arg_19=arg_19,\n        arg_1=arg_1,\n        arg_12=arg_12,\n    )\n    return arg_4, arg_20", "path": "docx2html/core.py", "identifier": "_get_document_data", "docstring": "``f`` is a ``ZipFile`` that is open\n    Extract out the document data, numbering data and the relationship data.", "docstring_tokens": ["f", "is", "a", "ZipFile", "that", "is", "open", "Extract", "out", "the", "document", "data", "numbering", "data", "and", "the", "relationship", "data", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 258753}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L1971-L2016", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Makes list of \"next\" links", "language": "python", "parameters": "(self,fromlist,tolist,flaglist,context,numlines)", "return_statement": "return fromlist,tolist,flaglist,next_href,next_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "_prefix", "[", "1", "]", "arg_7", "=", "[", "''", "]", "*", "len", "(", "arg_3", ")", "arg_8", "=", "[", "''", "]", "*", "len", "(", "arg_3", ")", "arg_9", ",", "arg_10", "=", "0", ",", "False", "arg_11", "=", "0", "for", "arg_12", ",", "arg_13", "in", "enumerate", "(", "arg_3", ")", ":", "if", "arg_13", ":", "if", "not", "arg_10", ":", "arg_10", "=", "True", "arg_11", "=", "arg_12", "arg_12", "=", "max", "(", "[", "0", ",", "arg_12", "-", "arg_5", "]", ")", "arg_7", "[", "arg_12", "]", "=", "' id=\"difflib_chg_%s_%d\"'", "%", "(", "arg_6", ",", "arg_9", ")", "arg_9", "+=", "1", "arg_8", "[", "arg_11", "]", "=", "'<a href=\"#difflib_chg_%s_%d\">n</a>'", "%", "(", "arg_6", ",", "arg_9", ")", "else", ":", "arg_10", "=", "False", "if", "not", "arg_3", ":", "arg_3", "=", "[", "False", "]", "arg_7", "=", "[", "''", "]", "arg_8", "=", "[", "''", "]", "arg_11", "=", "0", "if", "arg_4", ":", "arg_1", "=", "[", "'<td></td><td>&nbsp;No Differences Found&nbsp;</td>'", "]", "arg_2", "=", "arg_1", "else", ":", "arg_1", "=", "arg_2", "=", "[", "'<td></td><td>&nbsp;Empty File&nbsp;</td>'", "]", "if", "not", "arg_3", "[", "0", "]", ":", "arg_8", "[", "0", "]", "=", "'<a href=\"#difflib_chg_%s_0\">f</a>'", "%", "arg_6", "arg_8", "[", "arg_11", "]", "=", "'<a href=\"#difflib_chg_%s_top\">t</a>'", "%", "(", "arg_6", ")", "return", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_8", ",", "arg_7"], "function": "def Func(arg_0,arg_1,arg_2,arg_3,arg_4,arg_5):\n        \"\"\"Makes list of \"next\" links\"\"\"\n\n        # all anchor names will be generated using the unique \"to\" prefix\n        arg_6 = arg_0._prefix[1]\n\n        # process change flags, generating middle column of next anchors/links\n        arg_7 = ['']*len(arg_3)\n        arg_8 = ['']*len(arg_3)\n        arg_9, arg_10 = 0, False\n        arg_11 = 0\n        for arg_12,arg_13 in enumerate(arg_3):\n            if arg_13:\n                if not arg_10:\n                    arg_10 = True\n                    arg_11 = arg_12\n                    # at the beginning of a change, drop an anchor a few lines\n                    # (the context lines) before the change for the previous\n                    # link\n                    arg_12 = max([0,arg_12-arg_5])\n                    arg_7[arg_12] = ' id=\"difflib_chg_%s_%d\"' % (arg_6,arg_9)\n                    # at the beginning of a change, drop a link to the next\n                    # change\n                    arg_9 += 1\n                    arg_8[arg_11] = '<a href=\"#difflib_chg_%s_%d\">n</a>' % (\n                         arg_6,arg_9)\n            else:\n                arg_10 = False\n        # check for cases where there is no content to avoid exceptions\n        if not arg_3:\n            arg_3 = [False]\n            arg_7 = ['']\n            arg_8 = ['']\n            arg_11 = 0\n            if arg_4:\n                arg_1 = ['<td></td><td>&nbsp;No Differences Found&nbsp;</td>']\n                arg_2 = arg_1\n            else:\n                arg_1 = arg_2 = ['<td></td><td>&nbsp;Empty File&nbsp;</td>']\n        # if not a change on first line, drop a link\n        if not arg_3[0]:\n            arg_8[0] = '<a href=\"#difflib_chg_%s_0\">f</a>' % arg_6\n        # redo the last link to link to the top\n        arg_8[arg_11] = '<a href=\"#difflib_chg_%s_top\">t</a>' % (arg_6)\n\n        return arg_1,arg_2,arg_3,arg_8,arg_7", "path": "third_party/stdlib/difflib.py", "identifier": "HtmlDiff._convert_flags", "docstring": "Makes list of \"next\" links", "docstring_tokens": ["Makes", "list", "of", "next", "links"], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258754}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1172-L1227", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Show course track selection page for the enterprise.", "language": "python", "parameters": "(self, request, enterprise_uuid, course_id)", "return_statement": "return self.get_enterprise_course_enrollment_page(\n            request,\n            enterprise_customer,\n            course,\n            course_run,\n            modes,\n            enterprise_course_enrollment,\n            data_sharing_consent,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "EmbargoApiClient", ".", "redirect_if_blocked", "(", "[", "arg_3", "]", ",", "arg_1", ".", "user", ",", "Func_ip", "(", "arg_1", ")", ",", "arg_1", ".", "path", ")", "if", "arg_4", ":", "return", "redirect", "(", "arg_4", ")", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_0", ".", "Func_base_details", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_9", "=", "Func_enterprise_customer_user", "(", "arg_1", ".", "user", ".", "id", ",", "arg_2", ")", "arg_10", "=", "DataSharingConsent", ".", "objects", ".", "proxied_Func", "(", "username", "=", "arg_9", ".", "username", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")", "arg_11", "=", "EnrollmentApiClient", "(", ")", "arg_12", "=", "arg_11", ".", "Func_course_enrollment", "(", "arg_1", ".", "user", ".", "username", ",", "arg_3", ")", "try", ":", "arg_13", "=", "EnterpriseCourseEnrollment", ".", "objects", ".", "Func", "(", "enterprise_customer_user__enterprise_customer", "=", "arg_5", ",", "enterprise_customer_user__user_id", "=", "arg_1", ".", "user", ".", "id", ",", "arg_3", "=", "arg_3", ")", "except", "EnterpriseCourseEnrollment", ".", "DoesNotExist", ":", "arg_13", "=", "None", "if", "arg_12", "and", "arg_13", ":", "return", "redirect", "(", "LMS_COURSEWARE_URL", ".", "format", "(", "arg_3", "=", "arg_3", ")", ")", "return", "arg_0", ".", "Func_enterprise_course_enrollment_page", "(", "arg_1", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_13", ",", "arg_10", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Show course track selection page for the enterprise.\n\n        Based on `enterprise_uuid` in URL, the view will decide which\n        enterprise customer's course enrollment page is to use.\n\n        Unauthenticated learners will be redirected to enterprise-linked SSO.\n\n        A 404 will be raised if any of the following conditions are met:\n            * No enterprise customer uuid kwarg `enterprise_uuid` in request.\n            * No enterprise customer found against the enterprise customer\n                uuid `enterprise_uuid` in the request kwargs.\n            * No course is found in database against the provided `course_id`.\n\n        \"\"\"\n        # Check to see if access to the course run is restricted for this user.\n        arg_4 = EmbargoApiClient.redirect_if_blocked([arg_3], arg_1.user, Func_ip(arg_1), arg_1.path)\n        if arg_4:\n            return redirect(arg_4)\n\n        arg_5, arg_6, arg_7, arg_8 = arg_0.Func_base_details(\n            arg_1, arg_2, arg_3\n        )\n        arg_9 = Func_enterprise_customer_user(arg_1.user.id, arg_2)\n        arg_10 = DataSharingConsent.objects.proxied_Func(\n            username=arg_9.username,\n            arg_3=arg_3,\n            arg_5=arg_5\n        )\n\n        arg_11 = EnrollmentApiClient()\n        arg_12 = arg_11.Func_course_enrollment(arg_1.user.username, arg_3)\n        try:\n            arg_13 = EnterpriseCourseEnrollment.objects.Func(\n                enterprise_customer_user__enterprise_customer=arg_5,\n                enterprise_customer_user__user_id=arg_1.user.id,\n                arg_3=arg_3\n            )\n        except EnterpriseCourseEnrollment.DoesNotExist:\n            arg_13 = None\n\n        if arg_12 and arg_13:\n            # The user is already enrolled in the course through the Enterprise Customer, so redirect to the course\n            # info page.\n            return redirect(LMS_COURSEWARE_URL.format(arg_3=arg_3))\n\n        return arg_0.Func_enterprise_course_enrollment_page(\n            arg_1,\n            arg_5,\n            arg_6,\n            arg_7,\n            arg_8,\n            arg_13,\n            arg_10,\n        )", "path": "enterprise/views.py", "identifier": "CourseEnrollmentView.get", "docstring": "Show course track selection page for the enterprise.\n\n        Based on `enterprise_uuid` in URL, the view will decide which\n        enterprise customer's course enrollment page is to use.\n\n        Unauthenticated learners will be redirected to enterprise-linked SSO.\n\n        A 404 will be raised if any of the following conditions are met:\n            * No enterprise customer uuid kwarg `enterprise_uuid` in request.\n            * No enterprise customer found against the enterprise customer\n                uuid `enterprise_uuid` in the request kwargs.\n            * No course is found in database against the provided `course_id`.", "docstring_tokens": ["Show", "course", "track", "selection", "page", "for", "the", "enterprise", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258755}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1010-L1018", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "A method to set all column values to one of the levels.", "language": "python", "parameters": "(self, level)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"setLevel\", self, level), cache=self._ex._cache)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"setLevel\"", ",", "arg_0", ",", "arg_1", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        A method to set all column values to one of the levels.\n\n        :param str level: The level at which the column will be set (a string)\n\n        :returns: H2OFrame with entries set to the desired level.\n        \"\"\"\n        return H2OFrame._expr(expr=ExprNode(\"setLevel\", arg_0, arg_1), cache=arg_0._ex._cache)", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.set_level", "docstring": "A method to set all column values to one of the levels.\n\n        :param str level: The level at which the column will be set (a string)\n\n        :returns: H2OFrame with entries set to the desired level.", "docstring_tokens": ["A", "method", "to", "set", "all", "column", "values", "to", "one", "of", "the", "levels", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 258756}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L1586-L1600", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Provides an iterator over all values in a nested structure.", "language": "python", "parameters": "(value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "yield", "arg_0", "return", "if", "isinstance", "(", "arg_0", ",", "collections", ".", "Mapping", ")", ":", "arg_0", "=", "collections", ".", "ValuesView", "(", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "collections", ".", "Iterable", ")", ":", "for", "arg_1", "in", "arg_0", ":", "for", "arg_2", "in", "Func", "(", "arg_1", ")", ":", "yield", "arg_2", "yield", "arg_0"], "function": "def Func(arg_0):\n  \"\"\"Provides an iterator over all values in a nested structure.\"\"\"\n  if isinstance(arg_0, six.string_types):\n    yield arg_0\n    return\n\n  if isinstance(arg_0, collections.Mapping):\n    arg_0 = collections.ValuesView(arg_0)\n\n  if isinstance(arg_0, collections.Iterable):\n    for arg_1 in arg_0:\n      for arg_2 in Func(arg_1):\n        yield arg_2\n\n  yield arg_0", "path": "gin/config.py", "identifier": "_iterate_flattened_values", "docstring": "Provides an iterator over all values in a nested structure.", "docstring_tokens": ["Provides", "an", "iterator", "over", "all", "values", "in", "a", "nested", "structure", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 258757}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/filt_obj.py#L478-L485", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Get info for all filters.", "language": "python", "parameters": "(self)", "return_statement": "return(out)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "components", ".", "keys", "(", ")", ")", ":", "arg_1", "+=", "'{:s}: {:s}'", ".", "format", "(", "arg_2", ",", "arg_0", ".", "info", "[", "arg_2", "]", ")", "+", "'\\n'", "return", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get info for all filters.\n        \"\"\"\n        arg_1 = ''\n        for arg_2 in sorted(arg_0.components.keys()):\n            arg_1 += '{:s}: {:s}'.format(arg_2, arg_0.info[arg_2]) + '\\n'\n        return(arg_1)", "path": "latools/filtering/filt_obj.py", "identifier": "filt.get_info", "docstring": "Get info for all filters.", "docstring_tokens": ["Get", "info", "for", "all", "filters", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 258758}
{"url": "https://github.com/macacajs/wd.py/blob/6d3c52060013e01a67cd52b68b5230b387427bad/macaca/webdriver.py#L137-L151", "sha": "6d3c52060013e01a67cd52b68b5230b387427bad", "docstring_summary": "Create Session by desiredCapabilities", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_execute", "(", "Command", ".", "NEW_SESSION", ",", "{", "'desiredCapabilities'", ":", "arg_0", ".", "desired_capabilities", "}", ",", "False", ")", "arg_1", ".", "raise_for_status", "(", ")", "arg_0", ".", "session_id", "=", "str", "(", "arg_1", ".", "session_id", ")", "arg_0", ".", "capabilities", "=", "arg_1", ".", "value"], "function": "def Func(arg_0):\n        \"\"\"Create Session by desiredCapabilities\n\n        Support:\n            Android iOS Web(WebView)\n\n        Returns:\n            WebDriver Object.\n        \"\"\"\n        arg_1 = arg_0._execute(Command.NEW_SESSION, {\n            'desiredCapabilities': arg_0.desired_capabilities\n        }, False)\n        arg_1.raise_for_status()\n        arg_0.session_id = str(arg_1.session_id)\n        arg_0.capabilities = arg_1.value", "path": "macaca/webdriver.py", "identifier": "WebDriver.init", "docstring": "Create Session by desiredCapabilities\n\n        Support:\n            Android iOS Web(WebView)\n\n        Returns:\n            WebDriver Object.", "docstring_tokens": ["Create", "Session", "by", "desiredCapabilities"], "nwo": "macacajs/wd.py", "score": 0.3182350344440769, "idx": 258759}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2546-L2574", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Set a singe holiday day and month in object buffer.", "language": "python", "parameters": "(self, holiday, month, day)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_1", "+=", "1", "if", "(", "arg_2", ">", "12", ")", "or", "(", "arg_2", "<", "0", ")", "or", "(", "arg_3", ">", "31", ")", "or", "(", "arg_3", "<", "0", ")", "or", "(", "arg_1", "<", "1", ")", "or", "(", "arg_1", ">", "Extents", ".", "Holidays", ")", ":", "ekm_log", "(", "\"Out of bounds: month \"", "+", "str", "(", "arg_2", ")", "+", "\" day \"", "+", "str", "(", "arg_3", ")", "+", "\" holiday \"", "+", "str", "(", "arg_1", ")", ")", "return", "False", "arg_4", "=", "\"Holiday_\"", "+", "str", "(", "arg_1", ")", "+", "\"_Day\"", "arg_5", "=", "\"Holiday_\"", "+", "str", "(", "arg_1", ")", "+", "\"_Month\"", "if", "arg_4", "not", "in", "arg_0", ".", "m_holiday_date_params", ":", "ekm_log", "(", "\"Incorrect index: \"", "+", "arg_4", ")", "return", "False", "if", "arg_5", "not", "in", "arg_0", ".", "m_holiday_date_params", ":", "ekm_log", "(", "\"Incorrect index: \"", "+", "arg_5", ")", "return", "False", "arg_0", ".", "m_holiday_date_params", "[", "arg_4", "]", "=", "arg_3", "arg_0", ".", "m_holiday_date_params", "[", "arg_5", "]", "=", "arg_2", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Set a singe holiday day and month in object buffer.\n\n        There is no class style enum for holidays.\n\n        Args:\n            holiday (int): 0-19 or range(Extents.Holidays).\n            month (int): Month 1-12.\n            day (int): Day 1-31\n\n        Returns:\n            bool: True on completion.\n        \"\"\"\n        arg_1 += 1\n        if (arg_2 > 12) or (arg_2 < 0) or (arg_3 > 31) or (arg_3 < 0) or (arg_1 < 1) or (arg_1 > Extents.Holidays):\n            ekm_log(\"Out of bounds: month \" + str(arg_2) + \" day \" + str(arg_3) + \" holiday \" + str(arg_1))\n            return False\n\n        arg_4 = \"Holiday_\" + str(arg_1) + \"_Day\"\n        arg_5 = \"Holiday_\" + str(arg_1) + \"_Month\"\n        if arg_4 not in arg_0.m_holiday_date_params:\n            ekm_log(\"Incorrect index: \" + arg_4)\n            return False\n        if arg_5 not in arg_0.m_holiday_date_params:\n            ekm_log(\"Incorrect index: \" + arg_5)\n            return False\n        arg_0.m_holiday_date_params[arg_4] = arg_3\n        arg_0.m_holiday_date_params[arg_5] = arg_2\n        return True", "path": "ekmmeters.py", "identifier": "Meter.assignHolidayDate", "docstring": "Set a singe holiday day and month in object buffer.\n\n        There is no class style enum for holidays.\n\n        Args:\n            holiday (int): 0-19 or range(Extents.Holidays).\n            month (int): Month 1-12.\n            day (int): Day 1-31\n\n        Returns:\n            bool: True on completion.", "docstring_tokens": ["Set", "a", "singe", "holiday", "day", "and", "month", "in", "object", "buffer", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 258760}
{"url": "https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/genesis.py#L178-L196", "sha": "dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a", "docstring_summary": "Print processor input fields and types.", "language": "python", "parameters": "(self, processor_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "processors", "(", "arg_1", "=", "arg_1", ")", "if", "len", "(", "arg_2", ")", "==", "1", ":", "arg_2", "=", "arg_2", "[", "0", "]", "else", ":", "Exception", "(", "'Invalid processor name'", ")", "for", "arg_3", ",", "arg_4", ",", "arg_4", "in", "iterate_schema", "(", "{", "}", ",", "arg_2", "[", "'input_schema'", "]", ",", "'input'", ")", ":", "arg_5", "=", "arg_3", "[", "'name'", "]", "arg_6", "=", "arg_3", "[", "'type'", "]", "print", "(", "\"{} -> {}\"", ".", "format", "(", "arg_5", ",", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Print processor input fields and types.\n\n        :param processor_name: Processor object name\n        :type processor_name: string\n\n        \"\"\"\n        arg_2 = arg_0.processors(arg_1=arg_1)\n\n        if len(arg_2) == 1:\n            arg_2 = arg_2[0]\n        else:\n            Exception('Invalid processor name')\n\n        for arg_3, arg_4, arg_4 in iterate_schema({}, arg_2['input_schema'], 'input'):\n            arg_5 = arg_3['name']\n            arg_6 = arg_3['type']\n            # value = fields[name] if name in fields else None\n            print(\"{} -> {}\".format(arg_5, arg_6))", "path": "genesis/genesis.py", "identifier": "Genesis.print_processor_inputs", "docstring": "Print processor input fields and types.\n\n        :param processor_name: Processor object name\n        :type processor_name: string", "docstring_tokens": ["Print", "processor", "input", "fields", "and", "types", "."], "nwo": "genialis/genesis-pyapi", "score": 0.27692002097430746, "idx": 258761}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/bezier.py#L501-L534", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a list with the lengths of each segment in the path.", "language": "python", "parameters": "(self, relative=False, n=20)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "20", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "True", "for", "arg_5", "in", "arg_0", ".", "_get_elements", "(", ")", ":", "if", "arg_4", "is", "True", ":", "arg_6", ",", "arg_7", "=", "arg_5", ".", "x", ",", "arg_5", ".", "y", "arg_4", "=", "False", "elif", "arg_5", ".", "cmd", "==", "MOVETO", ":", "arg_6", ",", "arg_7", "=", "arg_5", ".", "x", ",", "arg_5", ".", "y", "arg_3", ".", "append", "(", "0.0", ")", "elif", "arg_5", ".", "cmd", "==", "CLOSE", ":", "arg_3", ".", "append", "(", "arg_0", ".", "_linelength", "(", "arg_14", ",", "arg_15", ",", "arg_6", ",", "arg_7", ")", ")", "elif", "arg_5", ".", "cmd", "==", "LINETO", ":", "arg_3", ".", "append", "(", "arg_0", ".", "_linelength", "(", "arg_14", ",", "arg_15", ",", "arg_5", ".", "x", ",", "arg_5", ".", "y", ")", ")", "elif", "arg_5", ".", "cmd", "==", "CURVETO", ":", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", "=", "arg_5", ".", "x", ",", "arg_5", ".", "y", ",", "arg_5", ".", "c1x", ",", "arg_5", ".", "c1y", ",", "arg_5", ".", "c2x", ",", "arg_5", ".", "c2y", "arg_3", ".", "append", "(", "arg_0", ".", "_curvelength", "(", "arg_14", ",", "arg_15", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_8", ",", "arg_9", ",", "arg_2", ")", ")", "if", "arg_5", ".", "cmd", "!=", "CLOSE", ":", "arg_14", "=", "arg_5", ".", "x", "arg_15", "=", "arg_5", ".", "y", "if", "arg_1", ":", "arg_16", "=", "sum", "(", "arg_3", ")", "try", ":", "return", "map", "(", "lambda", "l", ":", "l", "/", "arg_16", ",", "arg_3", ")", "except", "ZeroDivisionError", ":", "return", "[", "0.0", "]", "*", "len", "(", "arg_3", ")", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False, arg_2=20):\n        \"\"\" Returns a list with the lengths of each segment in the path.\n        \"\"\"\n        # From nodebox_gl\n        arg_3 = []\n        arg_4 = True\n        for arg_5 in arg_0._get_elements():\n            if arg_4 is True:\n                arg_6, arg_7 = arg_5.x, arg_5.y\n                arg_4 = False\n            elif arg_5.cmd == MOVETO:\n                arg_6, arg_7 = arg_5.x, arg_5.y\n                arg_3.append(0.0)\n            elif arg_5.cmd == CLOSE:\n                arg_3.append(arg_0._linelength(arg_14, arg_15, arg_6, arg_7))\n            elif arg_5.cmd == LINETO:\n                arg_3.append(arg_0._linelength(arg_14, arg_15, arg_5.x, arg_5.y))\n            elif arg_5.cmd == CURVETO:\n                arg_8, arg_9, arg_10, arg_11, arg_12, arg_13 = arg_5.x, arg_5.y, arg_5.c1x, arg_5.c1y, arg_5.c2x, arg_5.c2y\n                # (el.c1x, el.c1y, el.c2x, el.c2y, el.x, el.y)\n                arg_3.append(arg_0._curvelength(arg_14, arg_15, arg_10, arg_11, arg_12, arg_13, arg_8, arg_9, arg_2))\n            if arg_5.cmd != CLOSE:\n                arg_14 = arg_5.x\n                arg_15 = arg_5.y\n        if arg_1:\n            arg_16 = sum(arg_3)\n            try:\n                # Relative segment lengths' sum is 1.0.\n                return map(lambda l: l / arg_16, arg_3)\n            except ZeroDivisionError:\n                # If the length is zero, just return zero for all segments\n                return [0.0] * len(arg_3)\n        else:\n            return arg_3", "path": "shoebot/data/bezier.py", "identifier": "BezierPath._segment_lengths", "docstring": "Returns a list with the lengths of each segment in the path.", "docstring_tokens": ["Returns", "a", "list", "with", "the", "lengths", "of", "each", "segment", "in", "the", "path", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258762}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/thing.py#L365-L380", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Add an available action.", "language": "python", "parameters": "(self, name, metadata, cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "{", "}", "arg_0", ".", "available_actions", "[", "arg_1", "]", "=", "{", "'metadata'", ":", "arg_2", ",", "'class'", ":", "arg_3", ",", "}", "arg_0", ".", "actions", "[", "arg_1", "]", "=", "[", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Add an available action.\n\n        name -- name of the action\n        metadata -- action metadata, i.e. type, description, etc., as a dict\n        cls -- class to instantiate for this action\n        \"\"\"\n        if arg_2 is None:\n            arg_2 = {}\n\n        arg_0.available_actions[arg_1] = {\n            'metadata': arg_2,\n            'class': arg_3,\n        }\n        arg_0.actions[arg_1] = []", "path": "webthing/thing.py", "identifier": "Thing.add_available_action", "docstring": "Add an available action.\n\n        name -- name of the action\n        metadata -- action metadata, i.e. type, description, etc., as a dict\n        cls -- class to instantiate for this action", "docstring_tokens": ["Add", "an", "available", "action", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 258763}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L797-L807", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Return the date formatted according to ISO.", "language": "python", "parameters": "(self)", "return_statement": "return \"%s-%s-%s\" % (str(self._year).zfill(4), str(self._month).zfill(2), str(self._day).zfill(2))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "\"%s-%s-%s\"", "%", "(", "str", "(", "arg_0", ".", "_year", ")", ".", "zfill", "(", "4", ")", ",", "str", "(", "arg_0", ".", "_month", ")", ".", "zfill", "(", "2", ")", ",", "str", "(", "arg_0", ".", "_day", ")", ".", "zfill", "(", "2", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return the date formatted according to ISO.\n\n        This is 'YYYY-MM-DD'.\n\n        References:\n        - http://www.w3.org/TR/NOTE-datetime\n        - http://www.cl.cam.ac.uk/~mgk25/iso-time.html\n        \"\"\"\n        # return \"%04d-%02d-%02d\" % (self._year, self._month, self._day)\n        return \"%s-%s-%s\" % (str(arg_0._year).zfill(4), str(arg_0._month).zfill(2), str(arg_0._day).zfill(2))", "path": "third_party/pypy/datetime.py", "identifier": "date.isoformat", "docstring": "Return the date formatted according to ISO.\n\n        This is 'YYYY-MM-DD'.\n\n        References:\n        - http://www.w3.org/TR/NOTE-datetime\n        - http://www.cl.cam.ac.uk/~mgk25/iso-time.html", "docstring_tokens": ["Return", "the", "date", "formatted", "according", "to", "ISO", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258764}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L259-L312", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "reformat gsea results, and save to txt", "language": "python", "parameters": "(self, zipdata, outdir, module, gmt, rank_metric, permutation_type)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "OrderedDict", "(", ")", "for", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "in", "arg_1", ":", "arg_12", "=", "OrderedDict", "(", ")", "arg_12", "[", "'es'", "]", "=", "arg_9", "[", "0", "]", "arg_12", "[", "'nes'", "]", "=", "arg_9", "[", "1", "]", "arg_12", "[", "'pval'", "]", "=", "arg_9", "[", "2", "]", "arg_12", "[", "'fdr'", "]", "=", "arg_9", "[", "3", "]", "arg_12", "[", "'geneset_size'", "]", "=", "len", "(", "arg_4", "[", "arg_8", "]", ")", "arg_12", "[", "'matched_size'", "]", "=", "len", "(", "arg_10", ")", "arg_13", "=", "arg_5", ".", "index", ".", "values", "[", "arg_10", "]", "arg_12", "[", "'genes'", "]", "=", "\";\"", ".", "join", "(", "[", "str", "(", "g", ")", ".", "strip", "(", ")", "for", "g", "in", "arg_13", "]", ")", "if", "arg_0", ".", "module", "!=", "'ssgsea'", ":", "if", "arg_12", "[", "'es'", "]", ">", "0", ":", "arg_14", "=", "arg_11", ".", "argmax", "(", ")", "arg_15", "=", "list", "(", "filter", "(", "lambda", "x", ":", "x", "<=", "arg_14", ",", "arg_10", ")", ")", "elif", "arg_12", "[", "'es'", "]", "<", "0", ":", "arg_14", "=", "arg_11", ".", "argmin", "(", ")", "arg_15", "=", "list", "(", "filter", "(", "lambda", "x", ":", "x", ">=", "arg_14", ",", "arg_10", ")", ")", "else", ":", "arg_15", "=", "arg_10", "arg_12", "[", "'ledge_genes'", "]", "=", "';'", ".", "join", "(", "list", "(", "map", "(", "str", ",", "arg_5", ".", "iloc", "[", "arg_15", "]", ".", "index", ")", ")", ")", "arg_12", "[", "'RES'", "]", "=", "arg_11", "arg_12", "[", "'hits_indices'", "]", "=", "arg_10", "arg_7", "[", "arg_8", "]", "=", "arg_12", "arg_0", ".", "results", "=", "arg_7", "arg_17", "=", "pd", ".", "DataFrame", ".", "from_dict", "(", "arg_7", ",", "orient", "=", "'index'", ")", "arg_17", ".", "index", ".", "name", "=", "'Term'", "arg_17", ".", "drop", "(", "[", "'RES'", ",", "'hits_indices'", "]", ",", "axis", "=", "1", ",", "inplace", "=", "True", ")", "arg_17", ".", "sort_values", "(", "by", "=", "[", "'fdr'", ",", "'pval'", "]", ",", "inplace", "=", "True", ")", "arg_0", ".", "res2d", "=", "arg_17", "if", "arg_0", ".", "_outdir", "is", "None", ":", "return", "arg_21", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'gseapy.{b}.{c}.report.csv'", ".", "format", "(", "b", "=", "arg_3", ",", "c", "=", "arg_6", ")", ")", "if", "arg_0", ".", "module", "==", "'ssgsea'", ":", "arg_21", "=", "arg_21", ".", "replace", "(", "\".csv\"", ",", "\".txt\"", ")", "with", "open", "(", "arg_21", ",", "'a'", ")", "as", "f", ":", "f", ".", "write", "(", "'# normalize enrichment scores by random permutation procedure (GSEA method)\\n'", ")", "f", ".", "write", "(", "\"# might not proper for publication\\n\"", ")", "arg_17", ".", "to_csv", "(", "f", ",", "sep", "=", "'\\t'", ")", "else", ":", "arg_17", ".", "to_csv", "(", "arg_21", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        \"\"\"reformat gsea results, and save to txt\"\"\"\n\n        arg_7 = OrderedDict()\n        for arg_8, arg_9, arg_10, arg_11 in arg_1:\n            arg_12 = OrderedDict()\n            arg_12['es'] = arg_9[0]\n            arg_12['nes'] = arg_9[1]\n            arg_12['pval'] = arg_9[2]\n            arg_12['fdr'] = arg_9[3]\n            arg_12['geneset_size'] = len(arg_4[arg_8])\n            arg_12['matched_size'] = len(arg_10)\n            #reformat gene list.\n            arg_13 = arg_5.index.values[arg_10]\n            arg_12['genes'] = \";\".join([ str(g).strip() for g in arg_13 ])\n            \n            if arg_0.module != 'ssgsea':\n                # extract leading edge genes\n                if arg_12['es'] > 0:\n                    # RES -> ndarray, ind -> list\n                    arg_14 = arg_11.argmax()\n                    arg_15 = list(filter(lambda x: x<= arg_14, arg_10))\n                elif arg_12['es'] < 0:\n                    arg_14 = arg_11.argmin()\n                    arg_15 = list(filter(lambda x: x >= arg_14, arg_10))\n                else:\n                    arg_15 = arg_10 # es == 0 ?\n                arg_12['ledge_genes'] = ';'.join(list(map(str,arg_5.iloc[arg_15].index)))\n                \n            arg_12['RES'] = arg_11\n            arg_12['hits_indices'] = arg_10\n            # save to one odict\n            arg_7[arg_8] = arg_12\n        # save\n        arg_0.results  = arg_7\n        # save to dataframe\n        arg_17 = pd.DataFrame.from_dict(arg_7, orient='index')\n        arg_17.index.name = 'Term'\n        arg_17.drop(['RES','hits_indices'], axis=1, inplace=True)\n        arg_17.sort_values(by=['fdr','pval'], inplace=True)\n        arg_0.res2d = arg_17\n\n        if arg_0._outdir is None: return\n        arg_21 = os.path.join(arg_2,'gseapy.{b}.{c}.report.csv'.format(b=arg_3, c=arg_6))\n        if arg_0.module == 'ssgsea':\n            arg_21 = arg_21.replace(\".csv\",\".txt\")\n            with open(arg_21, 'a') as f:\n                f.write('# normalize enrichment scores by random permutation procedure (GSEA method)\\n')\n                f.write(\"# might not proper for publication\\n\")\n                arg_17.to_csv(f, sep='\\t')\n        else:\n            arg_17.to_csv(arg_21)\n\n        return", "path": "gseapy/gsea.py", "identifier": "GSEAbase._save_results", "docstring": "reformat gsea results, and save to txt", "docstring_tokens": ["reformat", "gsea", "results", "and", "save", "to", "txt"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 258765}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/apache.py#L366-L400", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Installs users for basic httpd auth.", "language": "python", "parameters": "(self, site=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "local_renderer", "arg_3", "=", "arg_0", ".", "current_hostname", "arg_4", "=", "arg_0", ".", "genv", ".", "available_sites_by_host", ".", "get", "(", "arg_3", ",", "None", ")", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "iter_sites", "(", "arg_1", "=", "arg_1", ",", "setter", "=", "arg_0", ".", "set_site_specifics", ")", ":", "if", "arg_0", ".", "verbose", ":", "print", "(", "'~'", "*", "80", ",", "file", "=", "sys", ".", "stderr", ")", "print", "(", "'Site:'", ",", "arg_5", ",", "file", "=", "sys", ".", "stderr", ")", "print", "(", "'env.apache_auth_basic:'", ",", "arg_2", ".", "env", ".", "auth_basic", ",", "file", "=", "sys", ".", "stderr", ")", "if", "arg_4", "is", "not", "None", ":", "assert", "isinstance", "(", "arg_4", ",", "(", "tuple", ",", "list", ")", ")", "if", "arg_5", "not", "in", "arg_4", ":", "continue", "if", "not", "arg_2", ".", "env", ".", "auth_basic", ":", "continue", "assert", "arg_2", ".", "env", ".", "auth_basic_users", ",", "'No apache auth users specified.'", "for", "arg_7", ",", "arg_8", "in", "arg_2", ".", "env", ".", "auth_basic_users", ":", "arg_2", ".", "env", ".", "auth_basic_username", "=", "arg_7", "arg_2", ".", "env", ".", "auth_basic_password", "=", "arg_8", "arg_2", ".", "env", ".", "apache_site", "=", "arg_5", "arg_2", ".", "env", ".", "fn", "=", "arg_2", ".", "format", "(", "arg_2", ".", "env", ".", "auth_basic_authuserfile", ")", "if", "arg_0", ".", "files", ".", "exists", "(", "arg_2", ".", "env", ".", "fn", ")", ":", "arg_2", ".", "sudo", "(", "'htpasswd -b {fn} {auth_basic_username} {auth_basic_password}'", ")", "else", ":", "arg_2", ".", "sudo", "(", "'htpasswd -b -c {fn} {auth_basic_username} {auth_basic_password}'", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Installs users for basic httpd auth.\n        \"\"\"\n        arg_2 = arg_0.local_renderer\n\n        arg_3 = arg_0.current_hostname\n\n        arg_4 = arg_0.genv.available_sites_by_host.get(arg_3, None)\n\n        for arg_5, arg_6 in arg_0.iter_sites(arg_1=arg_1, setter=arg_0.set_site_specifics):\n            if arg_0.verbose:\n                print('~'*80, file=sys.stderr)\n                print('Site:', arg_5, file=sys.stderr)\n                print('env.apache_auth_basic:', arg_2.env.auth_basic, file=sys.stderr)\n\n            # Only load site configurations that are allowed for this host.\n            if arg_4 is not None:\n                assert isinstance(arg_4, (tuple, list))\n                if arg_5 not in arg_4:\n                    continue\n\n            if not arg_2.env.auth_basic:\n                continue\n\n            assert arg_2.env.auth_basic_users, 'No apache auth users specified.'\n            for arg_7, arg_8 in arg_2.env.auth_basic_users:\n                arg_2.env.auth_basic_username = arg_7\n                arg_2.env.auth_basic_password = arg_8\n                arg_2.env.apache_site = arg_5\n                arg_2.env.fn = arg_2.format(arg_2.env.auth_basic_authuserfile)\n                if arg_0.files.exists(arg_2.env.fn):\n                    arg_2.sudo('htpasswd -b {fn} {auth_basic_username} {auth_basic_password}')\n                else:\n                    arg_2.sudo('htpasswd -b -c {fn} {auth_basic_username} {auth_basic_password}')", "path": "burlap/apache.py", "identifier": "ApacheSatchel.install_auth_basic_user_file", "docstring": "Installs users for basic httpd auth.", "docstring_tokens": ["Installs", "users", "for", "basic", "httpd", "auth", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258766}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/docs/m2r.py#L539-L545", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "When used for spinx extension.", "language": "python", "parameters": "(app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "global", "arg_1", "arg_1", "=", "True", "arg_0", ".", "add_config_value", "(", "'no_underscore_emphasis'", ",", "False", ",", "'env'", ")", "arg_0", ".", "add_source_parser", "(", "'.md'", ",", "M2RParser", ")", "arg_0", ".", "add_directive", "(", "'mdinclude'", ",", "MdInclude", ")"], "function": "def Func(arg_0):\n    \"\"\"When used for spinx extension.\"\"\"\n    global arg_1\n    arg_1 = True\n    arg_0.add_config_value('no_underscore_emphasis', False, 'env')\n    arg_0.add_source_parser('.md', M2RParser)\n    arg_0.add_directive('mdinclude', MdInclude)", "path": "docs/m2r.py", "identifier": "setup", "docstring": "When used for spinx extension.", "docstring_tokens": ["When", "used", "for", "spinx", "extension", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 258767}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/utils.py#L97-L109", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Default permission factory.", "language": "python", "parameters": "(query_name, params)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "invenio_stats", "import", "current_stats", "if", "current_stats", ".", "queries", "[", "arg_0", "]", ".", "permission_factory", "is", "None", ":", "return", "AllowAllPermission", "else", ":", "return", "current_stats", ".", "queries", "[", "arg_0", "]", ".", "permission_factory", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Default permission factory.\n\n    It enables by default the statistics if they don't have a dedicated\n    permission factory.\n    \"\"\"\n    from invenio_stats import current_stats\n    if current_stats.queries[arg_0].permission_factory is None:\n        return AllowAllPermission\n    else:\n        return current_stats.queries[arg_0].permission_factory(\n            arg_0, arg_1\n        )", "path": "invenio_stats/utils.py", "identifier": "default_permission_factory", "docstring": "Default permission factory.\n\n    It enables by default the statistics if they don't have a dedicated\n    permission factory.", "docstring_tokens": ["Default", "permission", "factory", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 258768}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L463-L488", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Creates a CoINS Title string from information", "language": "python", "parameters": "(self, collection, text, subreference=\"\", lang=None)", "return_statement": "return \"url_ver=Z39.88-2004\"\\\n                 \"&ctx_ver=Z39.88-2004\"\\\n                 \"&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook\"\\\n                 \"&rft_id={cid}\"\\\n                 \"&rft.genre=bookitem\"\\\n                 \"&rft.btitle={title}\"\\\n                 \"&rft.edition={edition}\"\\\n                 \"&rft.au={author}\"\\\n                 \"&rft.atitle={pages}\"\\\n                 \"&rft.language={language}\"\\\n                 \"&rft.pages={pages}\".format(\n                    title=quote(str(text.get_title(lang))), author=quote(str(text.get_creator(lang))),\n                    cid=url_for(\".r_collection\", objectId=collection.id, _external=True),\n                    language=collection.lang, pages=quote(subreference), edition=quote(str(text.get_description(lang)))\n                 )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"\"", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "__default_lang__", "return", "\"url_ver=Z39.88-2004\"", "\"&ctx_ver=Z39.88-2004\"", "\"&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook\"", "\"&rft_id={cid}\"", "\"&rft.genre=bookitem\"", "\"&rft.btitle={title}\"", "\"&rft.edition={edition}\"", "\"&rft.au={author}\"", "\"&rft.atitle={pages}\"", "\"&rft.language={language}\"", "\"&rft.pages={pages}\"", ".", "format", "(", "title", "=", "quote", "(", "str", "(", "arg_2", ".", "get_title", "(", "arg_4", ")", ")", ")", ",", "author", "=", "quote", "(", "str", "(", "arg_2", ".", "get_creator", "(", "arg_4", ")", ")", ")", ",", "cid", "=", "url_for", "(", "\".r_collection\"", ",", "objectId", "=", "arg_1", ".", "id", ",", "_external", "=", "True", ")", ",", "language", "=", "arg_1", ".", "lang", ",", "pages", "=", "quote", "(", "arg_3", ")", ",", "edition", "=", "quote", "(", "str", "(", "arg_2", ".", "get_description", "(", "arg_4", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=\"\", arg_4=None):\n        \"\"\" Creates a CoINS Title string from information\n\n        :param collection: Collection to create coins from\n        :param text: Text/Passage object\n        :param subreference: Subreference\n        :param lang: Locale information\n        :return: Coins HTML title value\n        \"\"\"\n        if arg_4 is None:\n            arg_4 = arg_0.__default_lang__\n        return \"url_ver=Z39.88-2004\"\\\n                 \"&ctx_ver=Z39.88-2004\"\\\n                 \"&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook\"\\\n                 \"&rft_id={cid}\"\\\n                 \"&rft.genre=bookitem\"\\\n                 \"&rft.btitle={title}\"\\\n                 \"&rft.edition={edition}\"\\\n                 \"&rft.au={author}\"\\\n                 \"&rft.atitle={pages}\"\\\n                 \"&rft.language={language}\"\\\n                 \"&rft.pages={pages}\".format(\n                    title=quote(str(arg_2.get_title(arg_4))), author=quote(str(arg_2.get_creator(arg_4))),\n                    cid=url_for(\".r_collection\", objectId=arg_1.id, _external=True),\n                    language=arg_1.lang, pages=quote(arg_3), edition=quote(str(arg_2.get_description(arg_4)))\n                 )", "path": "flask_nemo/__init__.py", "identifier": "Nemo.make_coins", "docstring": "Creates a CoINS Title string from information\n\n        :param collection: Collection to create coins from\n        :param text: Text/Passage object\n        :param subreference: Subreference\n        :param lang: Locale information\n        :return: Coins HTML title value", "docstring_tokens": ["Creates", "a", "CoINS", "Title", "string", "from", "information"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 258769}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/transport.py#L610-L631", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle the 'channel writable' state. E.g. send buffered data via a\n        socket.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "lock", ":", "logger", ".", "debug", "(", "\"Func: queue: {0!r}\"", ".", "format", "(", "arg_0", ".", "_write_queue", ")", ")", "try", ":", "arg_1", "=", "arg_0", ".", "_write_queue", ".", "popleft", "(", ")", "except", "IndexError", ":", "return", "if", "isinstance", "(", "arg_1", ",", "WriteData", ")", ":", "arg_0", ".", "_do_write", "(", "arg_1", ".", "data", ")", "elif", "isinstance", "(", "arg_1", ",", "ContinueConnect", ")", ":", "arg_0", ".", "_continue_connect", "(", ")", "elif", "isinstance", "(", "arg_1", ",", "StartTLS", ")", ":", "arg_0", ".", "_initiate_starttls", "(", "**", "arg_1", ".", "kwargs", ")", "elif", "isinstance", "(", "arg_1", ",", "TLSHandshake", ")", ":", "arg_0", ".", "_continue_tls_handshake", "(", ")", "else", ":", "raise", "ValueError", "(", "\"Unrecognized job in the write queue: \"", "\"{0!r}\"", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Handle the 'channel writable' state. E.g. send buffered data via a\n        socket.\n        \"\"\"\n        with arg_0.lock:\n            logger.debug(\"Func: queue: {0!r}\".format(arg_0._write_queue))\n            try:\n                arg_1 = arg_0._write_queue.popleft()\n            except IndexError:\n                return\n            if isinstance(arg_1, WriteData):\n                arg_0._do_write(arg_1.data) # pylint: disable=E1101\n            elif isinstance(arg_1, ContinueConnect):\n                arg_0._continue_connect()\n            elif isinstance(arg_1, StartTLS):\n                arg_0._initiate_starttls(**arg_1.kwargs)\n            elif isinstance(arg_1, TLSHandshake):\n                arg_0._continue_tls_handshake()\n            else:\n                raise ValueError(\"Unrecognized job in the write queue: \"\n                                        \"{0!r}\".format(arg_1))", "path": "pyxmpp2/transport.py", "identifier": "TCPTransport.handle_write", "docstring": "Handle the 'channel writable' state. E.g. send buffered data via a\n        socket.", "docstring_tokens": ["Handle", "the", "channel", "writable", "state", ".", "E", ".", "g", ".", "send", "buffered", "data", "via", "a", "socket", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258770}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L521-L595", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "Return the builddir-relative path of program, if only a partial\n            path is specified. Returns None and logs an error message if the\n            program is ambiguous or not found", "language": "python", "parameters": "(self, builddir, program)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_2", ")", ")", ":", "logging", ".", "info", "(", "'found %s'", "%", "arg_2", ")", "return", "arg_2", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "for", "arg_6", ",", "arg_7", ",", "arg_8", "in", "os", ".", "walk", "(", "arg_1", ")", ":", "if", "arg_2", "in", "arg_8", ":", "arg_3", ".", "append", "(", "os", ".", "path", ".", "relpath", "(", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_2", ")", ",", "arg_1", ")", ")", "continue", "arg_9", "=", "[", "arg_11", ".", "lower", "(", ")", "for", "arg_11", "in", "arg_8", "]", "if", "arg_2", ".", "lower", "(", ")", "in", "arg_9", ":", "arg_4", ".", "append", "(", "os", ".", "path", ".", "relpath", "(", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_8", "[", "arg_9", ".", "index", "(", "arg_2", ".", "lower", "(", ")", ")", "]", ")", ",", "arg_1", ")", ")", "continue", "arg_10", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "arg_2", ")", ".", "lower", "(", ")", ")", "[", "0", "]", "for", "arg_11", "in", "arg_9", ":", "if", "arg_10", "in", "arg_11", ":", "arg_5", ".", "append", "(", "os", ".", "path", ".", "relpath", "(", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_8", "[", "arg_9", ".", "index", "(", "arg_11", ")", "]", ")", ",", "arg_1", ")", ")", "if", "len", "(", "arg_3", ")", "==", "1", ":", "logging", ".", "info", "(", "'found %s at %s'", ",", "arg_2", ",", "arg_3", "[", "0", "]", ")", "return", "arg_3", "[", "0", "]", "elif", "len", "(", "arg_3", ")", ">", "1", ":", "logging", ".", "error", "(", "'%s matches multiple executables, please use a full path (one of %s)'", "%", "(", "arg_2", ",", "', or '", ".", "join", "(", "[", "'\"'", "+", "os", ".", "path", ".", "join", "(", "arg_12", ",", "arg_2", ")", "+", "'\"'", "for", "arg_12", "in", "arg_3", "]", ")", ")", ")", "return", "None", "arg_13", "=", "[", "]", "for", "arg_12", "in", "arg_5", ":", "arg_14", "=", "os", ".", "path", ".", "splitext", "(", "arg_12", ")", "[", "0", "]", "if", "(", "arg_12", "==", "arg_14", ")", "or", "(", "arg_14", "not", "in", "arg_5", ")", ":", "arg_13", ".", "append", "(", "arg_12", ")", "arg_5", "=", "arg_13", "for", "arg_15", "in", "(", "arg_4", ",", "arg_5", ")", ":", "if", "len", "(", "arg_15", ")", "==", "1", ":", "logging", ".", "info", "(", "'found %s at %s'", "%", "(", "arg_2", ",", "arg_15", "[", "0", "]", ")", ")", "return", "arg_15", "[", "0", "]", "elif", "len", "(", "arg_15", ")", ">", "1", ":", "logging", ".", "error", "(", "'%s is similar to several executables found. Please use an exact name:\\n%s'", "%", "(", "arg_2", ",", "'\\n'", ".", "join", "(", "arg_15", ")", ")", ")", "return", "None", "logging", ".", "error", "(", "'could not find program \"%s\" to debug'", "%", "arg_2", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        ''' Return the builddir-relative path of program, if only a partial\n            path is specified. Returns None and logs an error message if the\n            program is ambiguous or not found\n\t'''\n        # if this is an exact match, do no further checking:\n        if os.path.isfile(os.path.join(arg_1, arg_2)):\n            logging.info('found %s' % arg_2)\n            return arg_2\n        arg_3 = []\n        arg_4 = []\n        arg_5 = []\n        for arg_6, arg_7, arg_8 in os.walk(arg_1):\n            if arg_2 in arg_8:\n                arg_3.append(os.path.relpath(os.path.join(arg_6, arg_2), arg_1))\n                continue\n            arg_9 = [arg_11.lower() for arg_11 in arg_8]\n            if arg_2.lower() in arg_9:\n                arg_4.append(\n                    os.path.relpath(\n                        os.path.join(arg_6, arg_8[arg_9.index(arg_2.lower())]),\n                        arg_1\n                    )\n                )\n                continue\n            # !!! TODO: in the future add approximate string matching (typos,\n            # etc.), for now we just test stripping any paths off program, and\n            # looking for substring matches:\n            arg_10 = os.path.splitext(os.path.basename(arg_2).lower())[0]\n            for arg_11 in arg_9:\n                if arg_10 in arg_11:\n                    arg_5.append(\n                        os.path.relpath(\n                            os.path.join(arg_6, arg_8[arg_9.index(arg_11)]),\n                            arg_1\n                        )\n                    )\n\n        if len(arg_3) == 1:\n            logging.info('found %s at %s', arg_2, arg_3[0])\n            return arg_3[0]\n        elif len(arg_3) > 1:\n            logging.error(\n                '%s matches multiple executables, please use a full path (one of %s)' % (\n                    arg_2,\n                    ', or '.join(['\"'+os.path.join(arg_12, arg_2)+'\"' for arg_12 in arg_3])\n                )\n            )\n            return None\n        # if we have matches with and without a file extension, prefer the\n        # no-file extension version, and discard the others (so we avoid\n        # picking up post-processed files):\n        arg_13 = []\n        for arg_12 in arg_5:\n            arg_14 = os.path.splitext(arg_12)[0]\n            if (arg_12 == arg_14) or (arg_14 not in arg_5):\n                arg_13.append(arg_12)\n        arg_5 = arg_13\n\n        for arg_15 in (arg_4, arg_5):\n            if len(arg_15) == 1:\n                logging.info('found %s at %s' % (\n                    arg_2, arg_15[0]\n                ))\n                return arg_15[0]\n            elif len(arg_15) > 1:\n                logging.error(\n                    '%s is similar to several executables found. Please use an exact name:\\n%s' % (\n                        arg_2,\n                        '\\n'.join(arg_15)\n                    )\n                )\n                return None\n        logging.error('could not find program \"%s\" to debug' %  arg_2)\n        return None", "path": "yotta/lib/target.py", "identifier": "DerivedTarget.findProgram", "docstring": "Return the builddir-relative path of program, if only a partial\n            path is specified. Returns None and logs an error message if the\n            program is ambiguous or not found", "docstring_tokens": ["Return", "the", "builddir", "-", "relative", "path", "of", "program", "if", "only", "a", "partial", "path", "is", "specified", ".", "Returns", "None", "and", "logs", "an", "error", "message", "if", "the", "program", "is", "ambiguous", "or", "not", "found"], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 258771}
{"url": "https://github.com/cs01/pygdbmi/blob/709c781794d3c3b903891f83da011d2d995895d1/example.py#L26-L64", "sha": "709c781794d3c3b903891f83da011d2d995895d1", "docstring_summary": "Build and debug an application programatically", "language": "python", "parameters": "(verbose=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "True", ")", ":", "find_executable", "(", "MAKE_CMD", ")", "if", "not", "find_executable", "(", "MAKE_CMD", ")", ":", "print", "(", "'Could not find executable \"%s\". Ensure it is installed and on your $PATH.'", "%", "MAKE_CMD", ")", "exit", "(", "1", ")", "subprocess", ".", "check_output", "(", "[", "MAKE_CMD", ",", "\"-C\"", ",", "SAMPLE_C_CODE_DIR", ",", "\"--quiet\"", "]", ")", "arg_1", "=", "GdbController", "(", "arg_0", "=", "arg_0", ")", "arg_2", "=", "arg_1", ".", "write", "(", "\"-file-exec-and-symbols %s\"", "%", "SAMPLE_C_BINARY", ")", "arg_2", "=", "arg_1", ".", "write", "(", "\"-file-list-exec-source-files\"", ")", "arg_2", "=", "arg_1", ".", "write", "(", "\"-break-insert Func\"", ")", "arg_2", "=", "arg_1", ".", "write", "(", "\"-exec-run\"", ")", "arg_2", "=", "arg_1", ".", "write", "(", "\"-exec-next\"", ")", "arg_2", "=", "arg_1", ".", "write", "(", "\"-exec-next\"", ")", "arg_2", "=", "arg_1", ".", "write", "(", "\"-exec-continue\"", ")", "arg_1", ".", "exit", "(", ")"], "function": "def Func(arg_0=True):\n    \"\"\"Build and debug an application programatically\n\n    For a list of GDB MI commands, see https://www.sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html\n    \"\"\"\n\n    # Build C program\n    find_executable(MAKE_CMD)\n    if not find_executable(MAKE_CMD):\n        print(\n            'Could not find executable \"%s\". Ensure it is installed and on your $PATH.'\n            % MAKE_CMD\n        )\n        exit(1)\n    subprocess.check_output([MAKE_CMD, \"-C\", SAMPLE_C_CODE_DIR, \"--quiet\"])\n\n    # Initialize object that manages gdb subprocess\n    arg_1 = GdbController(arg_0=arg_0)\n\n    # Send gdb commands. Gdb machine interface commands are easier to script around,\n    # hence the name \"machine interface\".\n    # Responses are automatically printed as they are received if verbose is True.\n    # Responses are returned after writing, by default.\n\n    # Load the file\n    arg_2 = arg_1.write(\"-file-exec-and-symbols %s\" % SAMPLE_C_BINARY)\n    # Get list of source files used to compile the binary\n    arg_2 = arg_1.write(\"-file-list-exec-source-files\")\n    # Add breakpoint\n    arg_2 = arg_1.write(\"-break-insert Func\")\n    # Run\n    arg_2 = arg_1.write(\"-exec-run\")\n    arg_2 = arg_1.write(\"-exec-next\")\n    arg_2 = arg_1.write(\"-exec-next\")\n    arg_2 = arg_1.write(\"-exec-continue\")  # noqa: F841\n\n    # gdbmi.gdb_process will be None because the gdb subprocess (and its inferior\n    # program) will be terminated\n    arg_1.exit()", "path": "example.py", "identifier": "main", "docstring": "Build and debug an application programatically\n\n    For a list of GDB MI commands, see https://www.sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html", "docstring_tokens": ["Build", "and", "debug", "an", "application", "programatically"], "nwo": "cs01/pygdbmi", "score": 0.565001601112863, "idx": 258772}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/hidden_markov_model.py#L920-L923", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Multiply tensor of vectors by matrices.", "language": "python", "parameters": "(vs, ms)", "return_statement": "return tf.reduce_sum(input_tensor=vs[..., tf.newaxis] * ms, axis=-2)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "arg_0", "[", "...", ",", "tf", ".", "newaxis", "]", "*", "arg_1", ",", "axis", "=", "-", "2", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Multiply tensor of vectors by matrices.\"\"\"\n\n  return tf.reduce_sum(input_tensor=arg_0[..., tf.newaxis] * arg_1, axis=-2)", "path": "tensorflow_probability/python/distributions/hidden_markov_model.py", "identifier": "_vector_matrix", "docstring": "Multiply tensor of vectors by matrices.", "docstring_tokens": ["Multiply", "tensor", "of", "vectors", "by", "matrices", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258773}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_lingpipe.py#L249-L254", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "parse the sentences and tokens out of the XML", "language": "python", "parameters": "(self, ner_dom)", "return_statement": "return sentences, lp_parser.relations, lp_parser.attributes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "LingPipeParser", "(", "arg_0", ".", "config", ")", "arg_2", ".", "set", "(", "arg_1", ")", "arg_3", "=", "list", "(", "arg_2", ".", "sentences", "(", ")", ")", "return", "arg_3", ",", "arg_2", ".", "relations", ",", "arg_2", ".", "attributes"], "function": "def Func(arg_0, arg_1):\n        '''parse the sentences and tokens out of the XML'''\n        arg_2 = LingPipeParser(arg_0.config)\n        arg_2.set(arg_1)\n        arg_3 = list( arg_2.sentences() )\n        return arg_3, arg_2.relations, arg_2.attributes", "path": "streamcorpus_pipeline/_lingpipe.py", "identifier": "lingpipe.get_sentences", "docstring": "parse the sentences and tokens out of the XML", "docstring_tokens": ["parse", "the", "sentences", "and", "tokens", "out", "of", "the", "XML"], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 258774}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L689-L710", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Get the event following another event in this conversation.", "language": "python", "parameters": "(self, event_id, prev=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "events", ".", "index", "(", "arg_0", ".", "_events_dict", "[", "arg_1", "]", ")", "if", "arg_2", "and", "arg_3", ">", "0", ":", "return", "arg_0", ".", "events", "[", "arg_3", "-", "1", "]", "elif", "not", "arg_2", "and", "arg_3", "+", "1", "<", "len", "(", "arg_0", ".", "events", ")", ":", "return", "arg_0", ".", "events", "[", "arg_3", "+", "1", "]", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Get the event following another event in this conversation.\n\n        Args:\n            event_id (str): ID of the event.\n            prev (bool): If ``True``, return the previous event rather than the\n                next event. Defaults to ``False``.\n\n        Raises:\n            KeyError: If no such :class:`.ConversationEvent` is known.\n\n        Returns:\n            :class:`.ConversationEvent` or ``None`` if there is no following\n            event.\n        \"\"\"\n        arg_3 = arg_0.events.index(arg_0._events_dict[arg_1])\n        if arg_2 and arg_3 > 0:\n            return arg_0.events[arg_3 - 1]\n        elif not arg_2 and arg_3 + 1 < len(arg_0.events):\n            return arg_0.events[arg_3 + 1]\n        else:\n            return None", "path": "hangups/conversation.py", "identifier": "Conversation.next_event", "docstring": "Get the event following another event in this conversation.\n\n        Args:\n            event_id (str): ID of the event.\n            prev (bool): If ``True``, return the previous event rather than the\n                next event. Defaults to ``False``.\n\n        Raises:\n            KeyError: If no such :class:`.ConversationEvent` is known.\n\n        Returns:\n            :class:`.ConversationEvent` or ``None`` if there is no following\n            event.", "docstring_tokens": ["Get", "the", "event", "following", "another", "event", "in", "this", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258775}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/cli.py#L205-L210", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Generate form.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get", "(", "'<form>'", ")", "logger", ".", "info", "(", "'Start generating form.'", ")", "_Func", "(", "arg_1", ")", "logger", ".", "info", "(", "'Finish generating form.'", ")"], "function": "def Func(arg_0):\n    \"\"\"Generate form.\"\"\"\n    arg_1 = arg_0.get('<form>')\n    logger.info('Start generating form.')\n    _Func(arg_1)\n    logger.info('Finish generating form.')", "path": "flask_boost/cli.py", "identifier": "generate_form", "docstring": "Generate form.", "docstring_tokens": ["Generate", "form", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 258776}
{"url": "https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L209-L217", "sha": "074c8452f15a0da638668a4fe139fde06ccfae7f", "docstring_summary": "Styblinski-Tang function", "language": "python", "parameters": "(theta)", "return_statement": "return obj, grad", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", "arg_3", "=", "0.5", "*", "(", "arg_1", "**", "4", "-", "16", "*", "arg_1", "**", "2", "+", "5", "*", "arg_1", "+", "arg_2", "**", "4", "-", "16", "*", "arg_2", "**", "2", "+", "5", "*", "arg_2", ")", "arg_4", "=", "np", ".", "array", "(", "[", "2", "*", "arg_1", "**", "3", "-", "16", "*", "arg_1", "+", "2.5", ",", "2", "*", "arg_2", "**", "3", "-", "16", "*", "arg_2", "+", "2.5", ",", "]", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Styblinski-Tang function\"\"\"\n    arg_1, arg_2 = arg_0\n    arg_3 = 0.5 * (arg_1 ** 4 - 16 * arg_1 ** 2 + 5 * arg_1 + arg_2 ** 4 - 16 * arg_2 ** 2 + 5 * arg_2)\n    arg_4 = np.array([\n        2 * arg_1 ** 3 - 16 * arg_1 + 2.5,\n        2 * arg_2 ** 3 - 16 * arg_2 + 2.5,\n    ])\n    return arg_3, arg_4", "path": "descent/objectives.py", "identifier": "styblinski_tang", "docstring": "Styblinski-Tang function", "docstring_tokens": ["Styblinski", "-", "Tang", "function"], "nwo": "nirum/descent", "score": 0.18112697196067942, "idx": 258777}
{"url": "https://github.com/takaomag/chatora.util/blob/0fb36aca5da93bdd8e23a0c783095d621b582d89/chatora/util/functional.py#L86-L97", "sha": "0fb36aca5da93bdd8e23a0c783095d621b582d89", "docstring_summary": "Merge multiple ordered so that within-ordered order is preserved", "language": "python", "parameters": "(ordereds: typing.Iterable[typing.Any])", "return_statement": "return reversed(tuple(map(\n        lambda obj: add_seen(obj) or obj,\n        filterfalse(\n            seen_set.__contains__,\n            chain.from_iterable(map(reversed, reversed(ordereds))),\n        ),\n    )))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "Iterable", "[", "arg_1", ".", "Any", "]", ")", "->", "arg_1", ".", "Iterable", "[", "arg_1", ".", "Any", "]", ":", "arg_4", "=", "set", "(", ")", "arg_5", "=", "arg_4", ".", "add", "return", "reversed", "(", "tuple", "(", "map", "(", "lambda", "obj", ":", "arg_5", "(", "obj", ")", "or", "obj", ",", "filterfalse", "(", "arg_4", ".", "__contains__", ",", "chain", ".", "from_iterable", "(", "map", "(", "reversed", ",", "reversed", "(", "arg_0", ")", ")", ")", ",", ")", ",", ")", ")", ")"], "function": "def Func(arg_0: arg_1.Iterable[arg_1.Any]) -> arg_1.Iterable[arg_1.Any]:\n    \"\"\"Merge multiple ordered so that within-ordered order is preserved\n    \"\"\"\n    arg_4 = set()\n    arg_5 = arg_4.add\n    return reversed(tuple(map(\n        lambda obj: arg_5(obj) or obj,\n        filterfalse(\n            arg_4.__contains__,\n            chain.from_iterable(map(reversed, reversed(arg_0))),\n        ),\n    )))", "path": "chatora/util/functional.py", "identifier": "merge_ordered", "docstring": "Merge multiple ordered so that within-ordered order is preserved", "docstring_tokens": ["Merge", "multiple", "ordered", "so", "that", "within", "-", "ordered", "order", "is", "preserved"], "nwo": "takaomag/chatora.util", "score": 0.0, "idx": 258778}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1555-L1588", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the maximum of a waveform's dependent variable vector.", "language": "python", "parameters": "(wave, indep_min=None, indep_max=None)", "return_statement": "return np.max(ret._dep_vector)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "copy", ".", "copy", "(", "arg_0", ")", "_bound_waveform", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "return", "np", ".", "max", "(", "arg_3", ".", "_dep_vector", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    r\"\"\"\n    Return the maximum of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: float\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]\n    \"\"\"\n    arg_3 = copy.copy(arg_0)\n    _bound_waveform(arg_3, arg_1, arg_2)\n    return np.max(arg_3._dep_vector)", "path": "peng/wave_functions.py", "identifier": "nmax", "docstring": "r\"\"\"\n    Return the maximum of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: float\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.nmax\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "maximum", "of", "a", "waveform", "s", "dependent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 258779}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/forms/forms.py#L35-L45", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Sets existing data to form fields.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "is_initialized", ":", "arg_0", ".", "model_map_dict", "=", "arg_0", ".", "create_document_dictionary", "(", "arg_0", ".", "model_instance", ")", "else", ":", "arg_0", ".", "model_map_dict", "=", "arg_0", ".", "create_document_dictionary", "(", "arg_0", ".", "model", ")", "arg_2", "=", "arg_0", ".", "get_form_field_dict", "(", "arg_0", ".", "model_map_dict", ")", "arg_0", ".", "set_form_fields", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"Sets existing data to form fields.\"\"\"\n\n        # Get dictionary map of current model\n        if arg_0.is_initialized:\n            arg_0.model_map_dict = arg_0.create_document_dictionary(arg_0.model_instance)\n        else:\n            arg_0.model_map_dict = arg_0.create_document_dictionary(arg_0.model)\n\n        arg_2 = arg_0.get_form_field_dict(arg_0.model_map_dict)\n        arg_0.set_form_fields(arg_2)", "path": "mongonaut/forms/forms.py", "identifier": "MongoModelForm.set_fields", "docstring": "Sets existing data to form fields.", "docstring_tokens": ["Sets", "existing", "data", "to", "form", "fields", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 258780}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/primitive.py#L99-L111", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Returns True if node_type == value.", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "tuple", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "arg_0", ".", "node_type", "==", "arg_2", ":", "return", "True", "return", "False", "else", ":", "return", "arg_0", ".", "node_type", "==", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns True if node_type == value.\n\n    If value is a tuple, node_type is checked against each member and True is returned if any of\n    them match.\n    \"\"\"\n    if isinstance(arg_1, tuple):\n      for arg_2 in arg_1:\n        if arg_0.node_type == arg_2:\n          return True\n      return False\n    else:\n      return arg_0.node_type == arg_1", "path": "pyebnf/primitive.py", "identifier": "ParseNode.is_type", "docstring": "Returns True if node_type == value.\n\n    If value is a tuple, node_type is checked against each member and True is returned if any of\n    them match.", "docstring_tokens": ["Returns", "True", "if", "node_type", "==", "value", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 258781}
{"url": "https://github.com/lsst-sqre/ltd-conveyor/blob/c492937c4c1e050ccc4a0b9dcc38f9980d57e305/ltdconveyor/s3/utils.py#L9-L39", "sha": "c492937c4c1e050ccc4a0b9dcc38f9980d57e305", "docstring_summary": "Open an S3 Bucket resource.", "language": "python", "parameters": "(bucket_name,\n                aws_access_key_id=None, aws_secret_access_key=None,\n                aws_profile=None)", "return_statement": "return bucket", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "arg_4", ".", "resource", "(", "'s3'", ")", "arg_6", "=", "arg_5", ".", "Bucket", "(", "arg_0", ")", "return", "arg_6"], "function": "def Func(arg_0,\n                arg_1=None, arg_2=None,\n                arg_3=None):\n    \"\"\"Open an S3 Bucket resource.\n\n    Parameters\n    ----------\n    bucket_name : `str`\n        Name of the S3 bucket.\n    aws_access_key_id : `str`, optional\n        The access key for your AWS account. Also set\n        ``aws_secret_access_key``.\n    aws_secret_access_key : `str`, optional\n        The secret key for your AWS account.\n    aws_profile : `str`, optional\n        Name of AWS profile in :file:`~/.aws/credentials`. Use this instead\n        of ``aws_access_key_id`` and ``aws_secret_access_key`` for file-based\n        credentials.\n\n    Returns\n    -------\n    bucket : Boto3 S3 Bucket instance\n        The S3 bucket as a Boto3 instance.\n    \"\"\"\n    arg_4 = boto3.session.Session(\n        profile_name=arg_3,\n        arg_1=arg_1,\n        arg_2=arg_2)\n    arg_5 = arg_4.resource('s3')\n    arg_6 = arg_5.Bucket(arg_0)\n    return arg_6", "path": "ltdconveyor/s3/utils.py", "identifier": "open_bucket", "docstring": "Open an S3 Bucket resource.\n\n    Parameters\n    ----------\n    bucket_name : `str`\n        Name of the S3 bucket.\n    aws_access_key_id : `str`, optional\n        The access key for your AWS account. Also set\n        ``aws_secret_access_key``.\n    aws_secret_access_key : `str`, optional\n        The secret key for your AWS account.\n    aws_profile : `str`, optional\n        Name of AWS profile in :file:`~/.aws/credentials`. Use this instead\n        of ``aws_access_key_id`` and ``aws_secret_access_key`` for file-based\n        credentials.\n\n    Returns\n    -------\n    bucket : Boto3 S3 Bucket instance\n        The S3 bucket as a Boto3 instance.", "docstring_tokens": ["Open", "an", "S3", "Bucket", "resource", "."], "nwo": "lsst-sqre/ltd-conveyor", "score": 0.138843686048881, "idx": 258782}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/text.py#L447-L467", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the input string centered in a 'marquee'.", "language": "python", "parameters": "(txt='',width=78,mark='*')", "return_statement": "return '%s %s %s' % (marks,txt,marks)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "''", ",", "arg_1", "=", "78", ",", "arg_2", "=", "'*'", ")", ":", "if", "not", "arg_0", ":", "return", "(", "arg_2", "*", "arg_1", ")", "[", ":", "arg_1", "]", "arg_3", "=", "(", "arg_1", "-", "len", "(", "arg_0", ")", "-", "2", ")", "//", "len", "(", "arg_2", ")", "//", "2", "if", "arg_3", "<", "0", ":", "arg_3", "=", "0", "arg_4", "=", "arg_2", "*", "arg_3", "return", "'%s %s %s'", "%", "(", "arg_4", ",", "arg_0", ",", "arg_4", ")"], "function": "def Func(arg_0='',arg_1=78,arg_2='*'):\n    \"\"\"Return the input string centered in a 'Func'.\n\n    :Examples:\n\n        In [16]: Func('A test',40)\n        Out[16]: '**************** A test ****************'\n\n        In [17]: Func('A test',40,'-')\n        Out[17]: '---------------- A test ----------------'\n\n        In [18]: Func('A test',40,' ')\n        Out[18]: '                 A test                 '\n\n    \"\"\"\n    if not arg_0:\n        return (arg_2*arg_1)[:arg_1]\n    arg_3 = (arg_1-len(arg_0)-2)//len(arg_2)//2\n    if arg_3 < 0: arg_3 =0\n    arg_4 = arg_2*arg_3\n    return '%s %s %s' % (arg_4,arg_0,arg_4)", "path": "environment/lib/python2.7/site-packages/IPython/utils/text.py", "identifier": "marquee", "docstring": "Return the input string centered in a 'marquee'.\n\n    :Examples:\n\n        In [16]: marquee('A test',40)\n        Out[16]: '**************** A test ****************'\n\n        In [17]: marquee('A test',40,'-')\n        Out[17]: '---------------- A test ----------------'\n\n        In [18]: marquee('A test',40,' ')\n        Out[18]: '                 A test                 '", "docstring_tokens": ["Return", "the", "input", "string", "centered", "in", "a", "marquee", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258783}
{"url": "https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/dataframe.py#L103-L118", "sha": "39992e23293393cc1320d1b9c1c8d2c325fc5626", "docstring_summary": "Aggregate the rows of the DataFrame into a single value.", "language": "python", "parameters": "(self, clazz, new_col, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ")", ":", "if", "is_callable", "(", "arg_1", ")", "and", "not", "is_none", "(", "arg_2", ")", "and", "has_elements", "(", "*", "arg_3", ")", ":", "return", "arg_0", ".", "__do_Func", "(", "arg_1", ",", "arg_2", ",", "*", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3):\n        \"\"\"\n        Aggregate the rows of the DataFrame into a single value.\n\n        :param clazz: name of a class that extends class Callable\n        :type clazz: class\n        :param new_col: name of the new column\n        :type new_col: str\n        :param args: list of column names of the object that function \n        should be applied to\n        :type args: tuple\n        :return: returns a new dataframe object with the Funcd value\n        :rtype: DataFrame\n        \"\"\"\n        if is_callable(arg_1) and not is_none(arg_2) and has_elements(*arg_3):\n            return arg_0.__do_Func(arg_1, arg_2, *arg_3)", "path": "dataframe/dataframe.py", "identifier": "DataFrame.aggregate", "docstring": "Aggregate the rows of the DataFrame into a single value.\n\n        :param clazz: name of a class that extends class Callable\n        :type clazz: class\n        :param new_col: name of the new column\n        :type new_col: str\n        :param args: list of column names of the object that function \n        should be applied to\n        :type args: tuple\n        :return: returns a new dataframe object with the aggregated value\n        :rtype: DataFrame", "docstring_tokens": ["Aggregate", "the", "rows", "of", "the", "DataFrame", "into", "a", "single", "value", "."], "nwo": "dirmeier/dataframe", "score": 0.17385480483333982, "idx": 258784}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_kvlayer_keyword_search.py#L174-L187", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Get strings that correspond to some hash.", "language": "python", "parameters": "(self, tok_hash)", "return_statement": "return [tok_encoded.decode('utf8')\n                for (_, tok_encoded) in\n                self.client.scan_keys(HASH_KEYWORD_INDEX_TABLE,\n                                      ((tok_hash,), (tok_hash,)))]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "[", "arg_3", ".", "decode", "(", "'utf8'", ")", "for", "(", "arg_2", ",", "arg_3", ")", "in", "arg_0", ".", "client", ".", "scan_keys", "(", "HASH_KEYWORD_INDEX_TABLE", ",", "(", "(", "arg_1", ",", ")", ",", "(", "arg_1", ",", ")", ")", ")", "]"], "function": "def Func(arg_0, arg_1):\n        '''Get strings that correspond to some hash.\n\n        No string will correspond to :data:`DOCUMENT_HASH_KEY`; use\n        :data:`DOCUMENT_HASH_KEY_REPLACEMENT` instead.\n\n        :param int tok_hash: Murmur hash to query\n        :return: list of :class:`unicode` strings\n\n        '''\n        return [arg_3.decode('utf8')\n                for (arg_2, arg_3) in\n                arg_0.client.scan_keys(HASH_KEYWORD_INDEX_TABLE,\n                                      ((arg_1,), (arg_1,)))]", "path": "streamcorpus_pipeline/_kvlayer_keyword_search.py", "identifier": "keyword_indexer.invert_hash", "docstring": "Get strings that correspond to some hash.\n\n        No string will correspond to :data:`DOCUMENT_HASH_KEY`; use\n        :data:`DOCUMENT_HASH_KEY_REPLACEMENT` instead.\n\n        :param int tok_hash: Murmur hash to query\n        :return: list of :class:`unicode` strings", "docstring_tokens": ["Get", "strings", "that", "correspond", "to", "some", "hash", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 258785}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2623-L2690", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Run a sequence of AST nodes. The execution mode depends on the\n        interactivity parameter.", "language": "python", "parameters": "(self, nodelist, cell_name, interactivity='last_expr')", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'last_expr'", ")", ":", "if", "not", "arg_1", ":", "return", "if", "arg_3", "==", "'last_expr'", ":", "if", "isinstance", "(", "arg_1", "[", "-", "1", "]", ",", "ast", ".", "Expr", ")", ":", "arg_3", "=", "\"last\"", "else", ":", "arg_3", "=", "\"none\"", "if", "arg_3", "==", "'none'", ":", "arg_4", ",", "arg_5", "=", "arg_1", ",", "[", "]", "elif", "arg_3", "==", "'last'", ":", "arg_4", ",", "arg_5", "=", "arg_1", "[", ":", "-", "1", "]", ",", "arg_1", "[", "-", "1", ":", "]", "elif", "arg_3", "==", "'all'", ":", "arg_4", ",", "arg_5", "=", "[", "]", ",", "arg_1", "else", ":", "raise", "ValueError", "(", "\"Interactivity was %r\"", "%", "arg_3", ")", "arg_6", "=", "arg_0", ".", "execution_count", "try", ":", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_4", ")", ":", "arg_9", "=", "ast", ".", "Module", "(", "[", "arg_8", "]", ")", "arg_10", "=", "arg_0", ".", "compile", "(", "arg_9", ",", "arg_2", ",", "\"exec\"", ")", "if", "arg_0", ".", "run_code", "(", "arg_10", ")", ":", "return", "True", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_5", ")", ":", "arg_9", "=", "ast", ".", "Interactive", "(", "[", "arg_8", "]", ")", "arg_10", "=", "arg_0", ".", "compile", "(", "arg_9", ",", "arg_2", ",", "\"single\"", ")", "if", "arg_0", ".", "run_code", "(", "arg_10", ")", ":", "return", "True", "if", "softspace", "(", "sys", ".", "stdout", ",", "0", ")", ":", "print", "except", ":", "arg_0", ".", "showtraceback", "(", ")", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='last_expr'):\n        \"\"\"Run a sequence of AST nodes. The execution mode depends on the\n        interactivity parameter.\n\n        Parameters\n        ----------\n        nodelist : list\n          A sequence of AST nodes to run.\n        cell_name : str\n          Will be passed to the compiler as the filename of the cell. Typically\n          the value returned by ip.compile.cache(cell).\n        interactivity : str\n          'all', 'last', 'last_expr' or 'none', specifying which nodes should be\n          run interactively (displaying output from expressions). 'last_expr'\n          will run the last node interactively only if it is an expression (i.e.\n          expressions in loops or other blocks are not displayed. Other values\n          for this parameter will raise a ValueError.\n        \"\"\"\n        if not arg_1:\n            return\n\n        if arg_3 == 'last_expr':\n            if isinstance(arg_1[-1], ast.Expr):\n                arg_3 = \"last\"\n            else:\n                arg_3 = \"none\"\n\n        if arg_3 == 'none':\n            arg_4, arg_5 = arg_1, []\n        elif arg_3 == 'last':\n            arg_4, arg_5 = arg_1[:-1], arg_1[-1:]\n        elif arg_3 == 'all':\n            arg_4, arg_5 = [], arg_1\n        else:\n            raise ValueError(\"Interactivity was %r\" % arg_3)\n\n        arg_6 = arg_0.execution_count\n\n        try:\n            for arg_7, arg_8 in enumerate(arg_4):\n                arg_9 = ast.Module([arg_8])\n                arg_10 = arg_0.compile(arg_9, arg_2, \"exec\")\n                if arg_0.run_code(arg_10):\n                    return True\n\n            for arg_7, arg_8 in enumerate(arg_5):\n                arg_9 = ast.Interactive([arg_8])\n                arg_10 = arg_0.compile(arg_9, arg_2, \"single\")\n                if arg_0.run_code(arg_10):\n                    return True\n\n            # Flush softspace\n            if softspace(sys.stdout, 0):\n                print\n\n        except:\n            # It's possible to have exceptions raised here, typically by\n            # compilation of odd code (such as a naked 'return' outside a\n            # function) that did parse but isn't valid. Typically the exception\n            # is a SyntaxError, but it's safest just to catch anything and show\n            # the user a traceback.\n\n            # We do only one try/except outside the loop to minimize the impact\n            # on runtime, and also because if any node in the node list is\n            # broken, we should stop execution completely.\n            arg_0.showtraceback()\n\n        return False", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.run_ast_nodes", "docstring": "Run a sequence of AST nodes. The execution mode depends on the\n        interactivity parameter.\n\n        Parameters\n        ----------\n        nodelist : list\n          A sequence of AST nodes to run.\n        cell_name : str\n          Will be passed to the compiler as the filename of the cell. Typically\n          the value returned by ip.compile.cache(cell).\n        interactivity : str\n          'all', 'last', 'last_expr' or 'none', specifying which nodes should be\n          run interactively (displaying output from expressions). 'last_expr'\n          will run the last node interactively only if it is an expression (i.e.\n          expressions in loops or other blocks are not displayed. Other values\n          for this parameter will raise a ValueError.", "docstring_tokens": ["Run", "a", "sequence", "of", "AST", "nodes", ".", "The", "execution", "mode", "depends", "on", "the", "interactivity", "parameter", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258786}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaccard.py#L51-L81", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return the Jaccard similarity of two strings.", "language": "python", "parameters": "(self, src, tar, qval=2)", "return_statement": "return super(self.__class__, self).sim(src, tar, qval, 1, 1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "2", ")", ":", "return", "super", "(", "arg_0", ".", "__class__", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "1", ",", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=2):\n        r\"\"\"Return the Jaccard Funcilarity of two strings.\n\n        Parameters\n        ----------\n        src : str\n            Source string (or QGrams/Counter objects) for comparison\n        tar : str\n            Target string (or QGrams/Counter objects) for comparison\n        qval : int\n            The length of each q-gram; 0 for non-q-gram version\n\n        Returns\n        -------\n        float\n            Jaccard Funcilarity\n\n        Examples\n        --------\n        >>> cmp = Jaccard()\n        >>> cmp.Func('cat', 'hat')\n        0.3333333333333333\n        >>> cmp.Func('Niall', 'Neil')\n        0.2222222222222222\n        >>> cmp.Func('aluminum', 'Catalan')\n        0.0625\n        >>> cmp.Func('ATCG', 'TAGC')\n        0.0\n\n        \"\"\"\n        return super(arg_0.__class__, arg_0).Func(arg_1, arg_2, arg_3, 1, 1)", "path": "abydos/distance/_jaccard.py", "identifier": "Jaccard.sim", "docstring": "r\"\"\"Return the Jaccard similarity of two strings.\n\n        Parameters\n        ----------\n        src : str\n            Source string (or QGrams/Counter objects) for comparison\n        tar : str\n            Target string (or QGrams/Counter objects) for comparison\n        qval : int\n            The length of each q-gram; 0 for non-q-gram version\n\n        Returns\n        -------\n        float\n            Jaccard similarity\n\n        Examples\n        --------\n        >>> cmp = Jaccard()\n        >>> cmp.sim('cat', 'hat')\n        0.3333333333333333\n        >>> cmp.sim('Niall', 'Neil')\n        0.2222222222222222\n        >>> cmp.sim('aluminum', 'Catalan')\n        0.0625\n        >>> cmp.sim('ATCG', 'TAGC')\n        0.0", "docstring_tokens": ["r", "Return", "the", "Jaccard", "similarity", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 258787}
{"url": "https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/parser.py#L56-L97", "sha": "d6fe775544cd380735c56c8a4a79bc2ad22cb6c4", "docstring_summary": "Add class options to argparser options.", "language": "python", "parameters": "(klass, sub_parsers, default_epilog, general_arguments)", "return_statement": "return sub_parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "hump_to_underscore", "(", "arg_0", ".", "__name__", ")", ".", "replace", "(", "'_component'", ",", "''", ")", "arg_5", "=", "arg_2", "if", "arg_2", "else", "'This tool generate by `cliez` '", "'https://www.github.com/wangwenpei/cliez'", "arg_6", "=", "arg_1", ".", "add_parser", "(", "arg_4", ",", "help", "=", "arg_0", ".", "__doc__", ",", "arg_5", "=", "arg_5", ")", "arg_6", ".", "description", "=", "arg_0", ".", "add_arguments", ".", "__doc__", "if", "hasattr", "(", "arg_0", ",", "'add_slot_args'", ")", ":", "arg_8", "=", "arg_0", ".", "add_slot_args", "(", ")", "or", "[", "]", "for", "arg_9", "in", "arg_8", ":", "arg_6", ".", "add_argument", "(", "*", "arg_9", "[", "0", "]", ",", "**", "arg_9", "[", "1", "]", ")", "arg_6", ".", "description", "=", "arg_0", ".", "add_slot_args", ".", "__doc__", "pass", "arg_10", "=", "arg_0", ".", "add_arguments", "(", ")", "or", "[", "]", "for", "arg_9", "in", "arg_10", ":", "arg_6", ".", "add_argument", "(", "*", "arg_9", "[", "0", "]", ",", "**", "arg_9", "[", "1", "]", ")", "if", "not", "arg_0", ".", "exclude_global_option", ":", "for", "arg_9", "in", "arg_3", ":", "arg_6", ".", "add_argument", "(", "*", "arg_9", "[", "0", "]", ",", "**", "arg_9", "[", "1", "]", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Add class options to argparser options.\n\n    :param cliez.component.Component klass: subclass of Component\n    :param Namespace sub_parsers:\n    :param str default_epilog: default_epilog\n    :param list general_arguments: global options, defined by user\n    :return: Namespace subparser\n    \"\"\"\n\n    arg_4 = hump_to_underscore(arg_0.__name__).replace(\n        '_component',\n        '')\n\n    # set sub command document\n    arg_5 = arg_2 if arg_2 \\\n        else 'This tool generate by `cliez` ' \\\n             'https://www.github.com/wangwenpei/cliez'\n\n    arg_6 = arg_1.add_parser(arg_4, help=arg_0.__doc__,\n                                        arg_5=arg_5)\n    arg_6.description = arg_0.add_arguments.__doc__\n\n    # add slot arguments\n    if hasattr(arg_0, 'add_slot_args'):\n        arg_8 = arg_0.add_slot_args() or []\n        for arg_9 in arg_8:\n            arg_6.add_argument(*arg_9[0], **arg_9[1])\n        arg_6.description = arg_0.add_slot_args.__doc__\n        pass\n\n    arg_10 = arg_0.add_arguments() or []\n\n    for arg_9 in arg_10:\n        arg_6.add_argument(*arg_9[0], **arg_9[1])\n\n    if not arg_0.exclude_global_option:\n        for arg_9 in arg_3:\n            arg_6.add_argument(*arg_9[0], **arg_9[1])\n\n    return arg_6", "path": "cliez/parser.py", "identifier": "append_arguments", "docstring": "Add class options to argparser options.\n\n    :param cliez.component.Component klass: subclass of Component\n    :param Namespace sub_parsers:\n    :param str default_epilog: default_epilog\n    :param list general_arguments: global options, defined by user\n    :return: Namespace subparser", "docstring_tokens": ["Add", "class", "options", "to", "argparser", "options", "."], "nwo": "wangwenpei/cliez", "score": 0.08529914490135834, "idx": 258788}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L302-L305", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the base directory where IPython itself is installed.", "language": "python", "parameters": "()", "return_statement": "return py3compat.cast_unicode(ipdir, fs_encoding)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "os", ".", "path", ".", "dirname", "(", "IPython", ".", "__file__", ")", "return", "py3compat", ".", "cast_unicode", "(", "arg_0", ",", "fs_encoding", ")"], "function": "def Func():\n    \"\"\"Get the base directory where IPython itself is installed.\"\"\"\n    arg_0 = os.path.dirname(IPython.__file__)\n    return py3compat.cast_unicode(arg_0, fs_encoding)", "path": "environment/lib/python2.7/site-packages/IPython/utils/path.py", "identifier": "get_ipython_package_dir", "docstring": "Get the base directory where IPython itself is installed.", "docstring_tokens": ["Get", "the", "base", "directory", "where", "IPython", "itself", "is", "installed", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258789}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/seasonal.py#L628-L691", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build transition noise distribution for a ConstrainedSeasonalSSM.", "language": "python", "parameters": "(\n    drift_scale, num_seasons, is_last_day_of_season)", "return_statement": "return seasonal_transition_noise", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "tf", ".", "concat", "(", "[", "tf", ".", "ones", "(", "[", "arg_1", "-", "1", ",", "1", "]", ",", "dtype", "=", "arg_0", ".", "dtype", ")", ",", "tf", ".", "zeros", "(", "[", "arg_1", "-", "1", ",", "arg_1", "-", "2", "]", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "]", ",", "axis", "=", "-", "1", ")", "arg_4", "=", "(", "arg_3", "*", "arg_0", "[", "...", ",", "tf", ".", "newaxis", ",", "tf", ".", "newaxis", "]", "/", "arg_1", ")", "def", "seasonal_transition_noise", "(", "arg_5", ")", ":", "arg_6", "=", "dist_util", ".", "pick_scalar_condition", "(", "arg_2", "(", "arg_5", ")", ",", "arg_4", ",", "tf", ".", "zeros_like", "(", "arg_4", ")", ")", "return", "tfd", ".", "MultivariateNormalTriL", "(", "loc", "=", "tf", ".", "zeros", "(", "arg_1", "-", "1", ",", "dtype", "=", "arg_0", ".", "dtype", ")", ",", "scale_tril", "=", "arg_6", ")", "return", "seasonal_transition_noise"], "function": "def Func(\n    arg_0, arg_1, arg_2):\n  \"\"\"Build transition noise distribution for a ConstrainedSeasonalSSM.\"\"\"\n\n  # Conceptually, this method takes the noise covariance on effects L @ L'\n  # computed by `build_seasonal_transition_noise`, with scale factor\n  #       L = [ 0, 0, ..., 0\n  #             ...\n  #             0, 0, ..., drift_scale],\n  # and transforms it to act on the constrained-residual representation.\n  #\n  # The resulting noise covariance M @ M' is equivalent to\n  #    M @ M' = effects_to_residuals @ LL' @ residuals_to_effects\n  # where `@` is matrix multiplication. However because this matrix is\n  # rank-deficient, we can't take its Cholesky decomposition directly, so we'll\n  # construct its lower-triangular scale factor `M` by hand instead.\n  #\n  # Concretely, let `M = P @ R @ L` be the scale factor in the\n  # transformed space, with matrices `R`, `P` applying the reparameterization\n  # and zero-mean constraint respectively as defined in the\n  # \"Mathematical Details\" section of `ConstrainedSeasonalStateSpaceModel`. It's\n  # easy to see (*) that the implied covariance\n  # `M @ M' = P @ R @ L @ L' @ R' @ P'` is just the constant matrix\n  #  `M @ M' = [ 1, 1, ..., 1, 0\n  #              1, 1, ..., 1, 0\n  #              ...\n  #              1, 1, ..., 1, 0\n  #              0, 0, ..., 0, 0] * (drift_scale / num_seasons)**2`\n  # with zeros in the final row and column. So we can directly construct\n  # the lower-triangular factor\n  #  `Q = [ 1, 0, ...  0\n  #         1, 0, ..., 0\n  #         ...\n  #         1, 0, ..., 0\n  #         0, 0, ..., 0 ] * drift_scale/num_seasons`\n  # such that Q @ Q' = M @ M'. In practice, we don't reify the final row and\n  # column full of zeroes, i.e., we construct\n  # `Q[:num_seasons-1, :num_seasons-1]` as the scale-TriL covariance factor.\n  #\n  # (*) Argument: `L` is zero everywhere but the last column, so `R @ L` will be\n  # too. Since the last column of `R` is the constant `-1/num_seasons`, `R @ L`\n  # is simply the matrix with constant `-drift_scale/num_seasons` in the final\n  # column (except the final row, which is negated) and zero in all other\n  # columns, and `M = P @ R @ L` additionally zeroes out the final row. Then\n  # M @ M' is just the outer product of that final column with itself (since all\n  # other columns are zero), which gives the matrix shown above.\n\n  arg_3 = tf.concat([\n      tf.ones([arg_1 - 1, 1], dtype=arg_0.dtype),\n      tf.zeros([arg_1 - 1, arg_1 - 2], dtype=arg_0.dtype)],\n                                        axis=-1)\n  arg_4 = (arg_3 *\n                      arg_0[..., tf.newaxis, tf.newaxis] / arg_1)\n\n  # Inject transition noise iff it is the last day of the season.\n  def seasonal_transition_noise(arg_5):\n    arg_6 = dist_util.pick_scalar_condition(\n        arg_2(arg_5),\n        arg_4,\n        tf.zeros_like(arg_4))\n    return tfd.MultivariateNormalTriL(\n        loc=tf.zeros(arg_1-1, dtype=arg_0.dtype),\n        scale_tril=arg_6)\n  return seasonal_transition_noise", "path": "tensorflow_probability/python/sts/seasonal.py", "identifier": "build_constrained_seasonal_transition_noise", "docstring": "Build transition noise distribution for a ConstrainedSeasonalSSM.", "docstring_tokens": ["Build", "transition", "noise", "distribution", "for", "a", "ConstrainedSeasonalSSM", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258790}
{"url": "https://github.com/alexprengere/currencyconverter/blob/e3cb0d693819c0c824214225b23a47e9380f71df/currency_converter/currency_converter.py#L147-L159", "sha": "e3cb0d693819c0c824214225b23a47e9380f71df", "docstring_summary": "To be subclassed if alternate methods of loading data.", "language": "python", "parameters": "(self, currency_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "startswith", "(", "(", "'http://'", ",", "'https://'", ")", ")", ":", "arg_2", "=", "urlopen", "(", "arg_1", ")", ".", "read", "(", ")", "else", ":", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "f", ":", "arg_2", "=", "f", ".", "read", "(", ")", "if", "arg_1", ".", "endswith", "(", "'.zip'", ")", ":", "arg_0", ".", "load_lines", "(", "get_lines_from_zip", "(", "arg_2", ")", ")", "else", ":", "arg_0", ".", "load_lines", "(", "arg_2", ".", "decode", "(", "'utf-8'", ")", ".", "splitlines", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"To be subclassed if alternate methods of loading data.\n        \"\"\"\n        if arg_1.startswith(('http://', 'https://')):\n            arg_2 = urlopen(arg_1).read()\n        else:\n            with open(arg_1, 'rb') as f:\n                arg_2 = f.read()\n\n        if arg_1.endswith('.zip'):\n            arg_0.load_lines(get_lines_from_zip(arg_2))\n        else:\n            arg_0.load_lines(arg_2.decode('utf-8').splitlines())", "path": "currency_converter/currency_converter.py", "identifier": "CurrencyConverter.load_file", "docstring": "To be subclassed if alternate methods of loading data.", "docstring_tokens": ["To", "be", "subclassed", "if", "alternate", "methods", "of", "loading", "data", "."], "nwo": "alexprengere/currencyconverter", "score": 0.5486903423646818, "idx": 258791}
{"url": "https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/doc2md.py#L177-L208", "sha": "afd2876316a715d3401adb442d46c9a07cd7e806", "docstring_summary": "Convert a docstring to a markdown text.", "language": "python", "parameters": "(docstr, title, min_level=1, more_info=False, toc=True, maxdepth=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "0", ")", ":", "arg_6", "=", "doctrim", "(", "arg_0", ")", "arg_7", "=", "arg_6", ".", "split", "(", "'\\n'", ")", "arg_8", "=", "find_sections", "(", "arg_7", ")", "if", "arg_8", ":", "arg_9", "=", "min", "(", "n", "for", "n", ",", "t", "in", "arg_8", ")", "-", "1", "else", ":", "arg_9", "=", "1", "arg_10", "=", "0", "if", "arg_9", "<", "arg_2", ":", "arg_10", "=", "arg_2", "-", "arg_9", "arg_9", "=", "arg_2", "arg_8", "=", "[", "(", "lev", "+", "arg_10", ",", "tit", ")", "for", "lev", ",", "tit", "in", "arg_8", "]", "arg_11", "=", "next", "(", "(", "i", "for", "i", ",", "l", "in", "enumerate", "(", "arg_7", ")", "if", "is_heading", "(", "l", ")", ")", ",", "0", ")", "arg_12", "=", "[", "make_heading", "(", "arg_9", ",", "arg_1", ")", ",", "\"\"", ",", "]", "+", "arg_7", "[", ":", "arg_11", "]", "if", "arg_4", ":", "arg_12", "+=", "make_toc", "(", "arg_8", ",", "arg_5", ")", "arg_12", "+=", "[", "''", "]", "arg_12", "+=", "_Func", "(", "arg_7", "[", "arg_11", ":", "]", ",", "arg_10", ")", "if", "arg_3", ":", "return", "(", "arg_12", ",", "arg_8", ")", "else", ":", "return", "\"\\n\"", ".", "join", "(", "arg_12", ")"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=False, arg_4=True, arg_5=0):\n    \"\"\"\n    Convert a docstring to a markdown text.\n    \"\"\"\n    arg_6 = doctrim(arg_0)\n    arg_7 = arg_6.split('\\n')\n\n    arg_8 = find_sections(arg_7)\n    if arg_8:\n        arg_9 = min(n for n,t in arg_8) - 1\n    else:\n        arg_9 = 1\n\n    arg_10 = 0\n    if arg_9 < arg_2:\n        arg_10 = arg_2 - arg_9\n        arg_9 = arg_2\n        arg_8 = [(lev+arg_10, tit) for lev,tit in arg_8]\n\n    arg_11 = next((i for i, l in enumerate(arg_7) if is_heading(l)), 0)\n    arg_12 = [\n        make_heading(arg_9, arg_1),\n        \"\",\n    ] + arg_7[:arg_11]\n    if arg_4:\n        arg_12 += make_toc(arg_8, arg_5)\n        arg_12 += ['']\n    arg_12 += _Func(arg_7[arg_11:], arg_10)\n    if arg_3:\n        return (arg_12, arg_8)\n    else:\n        return \"\\n\".join(arg_12)", "path": "doc2md.py", "identifier": "doc2md", "docstring": "Convert a docstring to a markdown text.", "docstring_tokens": ["Convert", "a", "docstring", "to", "a", "markdown", "text", "."], "nwo": "coldfix/doc2md", "score": 0.5672608523629893, "idx": 258792}
{"url": "https://github.com/Scifabric/pybossa-client/blob/998d7cb0207ff5030dc800f0c2577c5692316c2c/pbclient/__init__.py#L583-L601", "sha": "998d7cb0207ff5030dc800f0c2577c5692316c2c", "docstring_summary": "Return a list of matched task runs for a given project ID.", "language": "python", "parameters": "(project_id, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "try", ":", "arg_1", "[", "'project_id'", "]", "=", "arg_0", "arg_2", "=", "_pybossa_req", "(", "'get'", ",", "'taskrun'", ",", "params", "=", "arg_1", ")", "if", "type", "(", "arg_2", ")", ".", "__name__", "==", "'list'", ":", "return", "[", "TaskRun", "(", "arg_3", ")", "for", "arg_3", "in", "arg_2", "]", "else", ":", "return", "arg_2", "except", ":", "raise"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Return a list of matched task runs for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param kwargs: PYBOSSA Task Run members\n    :rtype: list\n    :returns: A List of task runs that match the query members\n\n    \"\"\"\n    try:\n        arg_1['project_id'] = arg_0\n        arg_2 = _pybossa_req('get', 'taskrun', params=arg_1)\n        if type(arg_2).__name__ == 'list':\n            return [TaskRun(arg_3) for arg_3 in arg_2]\n        else:\n            return arg_2\n    except:  # pragma: no cover\n        raise", "path": "pbclient/__init__.py", "identifier": "find_taskruns", "docstring": "Return a list of matched task runs for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param kwargs: PYBOSSA Task Run members\n    :rtype: list\n    :returns: A List of task runs that match the query members", "docstring_tokens": ["Return", "a", "list", "of", "matched", "task", "runs", "for", "a", "given", "project", "ID", "."], "nwo": "Scifabric/pybossa-client", "score": 0.27831918678159157, "idx": 258793}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_client.py#L360-L387", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Return a new LuminosoClient for a subpath of this one.", "language": "python", "parameters": "(self, path)", "return_statement": "return self.__class__(self.session, url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "startswith", "(", "'/'", ")", ":", "arg_2", "=", "arg_0", ".", "root_url", "+", "arg_1", "else", ":", "arg_2", "=", "arg_0", ".", "url", "+", "arg_1", "return", "arg_0", ".", "__class__", "(", "arg_0", ".", "session", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a new LuminosoClient for a subpath of this one.\n\n        For example, you might want to start with a LuminosoClient for\n        `https://analytics.luminoso.com/api/v4/`, then get a new one for\n        `https://analytics.luminoso.com/api/v4/projects/myaccount/myprojectid`.\n        You accomplish that with the following call:\n\n            newclient = client.Func('projects/myaccount/myproject_id')\n\n        If you start the path with `/`, it will start from the root_url\n        instead of the current url:\n\n            project_area = newclient.Func('/projects/myaccount')\n\n        The advantage of using `.Func` is that you will not need to\n        re-authenticate like you would if you ran `.connect` again.\n\n        You can use `.Func` to split off as many sub-clients as you\n        want, and you don't have to stop using the old one just because you\n        got a new one with `.Func`.\n        \"\"\"\n        if arg_1.startswith('/'):\n            arg_2 = arg_0.root_url + arg_1\n        else:\n            arg_2 = arg_0.url + arg_1\n        return arg_0.__class__(arg_0.session, arg_2)", "path": "luminoso_api/v4_client.py", "identifier": "LuminosoClient.change_path", "docstring": "Return a new LuminosoClient for a subpath of this one.\n\n        For example, you might want to start with a LuminosoClient for\n        `https://analytics.luminoso.com/api/v4/`, then get a new one for\n        `https://analytics.luminoso.com/api/v4/projects/myaccount/myprojectid`.\n        You accomplish that with the following call:\n\n            newclient = client.change_path('projects/myaccount/myproject_id')\n\n        If you start the path with `/`, it will start from the root_url\n        instead of the current url:\n\n            project_area = newclient.change_path('/projects/myaccount')\n\n        The advantage of using `.change_path` is that you will not need to\n        re-authenticate like you would if you ran `.connect` again.\n\n        You can use `.change_path` to split off as many sub-clients as you\n        want, and you don't have to stop using the old one just because you\n        got a new one with `.change_path`.", "docstring_tokens": ["Return", "a", "new", "LuminosoClient", "for", "a", "subpath", "of", "this", "one", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 258794}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L123-L128", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "A proxy for a rule called ``name`` which may not be yet defined.", "language": "python", "parameters": "(name, loc=None)", "return_statement": "return rule", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "@", "llrule", "(", "arg_1", ",", "lambda", "arg_2", ":", "getattr", "(", "arg_2", ",", "arg_0", ")", ".", "expected", "(", "arg_2", ")", ")", "def", "rule", "(", "arg_2", ")", ":", "return", "getattr", "(", "arg_2", ",", "arg_0", ")", "(", ")", "return", "rule"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"A proxy for a rule called ``name`` which may not be yet defined.\"\"\"\n    @llrule(arg_1, lambda arg_2: getattr(arg_2, arg_0).expected(arg_2))\n    def rule(arg_2):\n        return getattr(arg_2, arg_0)()\n    return rule", "path": "third_party/pythonparser/parser.py", "identifier": "Rule", "docstring": "A proxy for a rule called ``name`` which may not be yet defined.", "docstring_tokens": ["A", "proxy", "for", "a", "rule", "called", "name", "which", "may", "not", "be", "yet", "defined", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258795}
{"url": "https://github.com/antevens/listen/blob/d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67/listen/signal_handler.py#L55-L59", "sha": "d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67", "docstring_summary": "Takes a list of signals and sets a handler for them", "language": "python", "parameters": "(self, signals, handler=signal.SIG_DFL)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "SIG_DFL", ")", ":", "for", "arg_5", "in", "arg_1", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Creating handler for signal: {0}\"", ".", "format", "(", "arg_5", ")", ")", "arg_3", ".", "signal", "(", "arg_5", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.SIG_DFL):\n        \"\"\" Takes a list of signals and sets a handler for them \"\"\"\n        for arg_5 in arg_1:\n            arg_0.log.debug(\"Creating handler for signal: {0}\".format(arg_5))\n            arg_3.signal(arg_5, arg_2)", "path": "listen/signal_handler.py", "identifier": "SignalHandler.set_handler", "docstring": "Takes a list of signals and sets a handler for them", "docstring_tokens": ["Takes", "a", "list", "of", "signals", "and", "sets", "a", "handler", "for", "them"], "nwo": "antevens/listen", "score": 0.21302904236143622, "idx": 258796}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/State.py#L109-L166", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Dive into nested tree.", "language": "python", "parameters": "(self, append_message=\"\", node_name=\"\", **kwargs)", "return_statement": "return child", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\"", ",", "arg_2", "=", "\"\"", ",", "**", "arg_3", ")", ":", "arg_4", "=", "{", "attr", ":", "getattr", "(", "arg_0", ",", "attr", ")", "for", "attr", "in", "arg_0", ".", "params", "if", "attr", "not", "in", "[", "\"highlight\"", "]", "}", "if", "not", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_1", "=", "{", "\"msg\"", ":", "arg_1", ",", "\"kwargs\"", ":", "{", "}", "}", "arg_3", "[", "\"messages\"", "]", "=", "[", "*", "arg_0", ".", "messages", ",", "arg_1", "]", "arg_3", "[", "\"parent_state\"", "]", "=", "arg_0", "for", "arg_5", "in", "[", "\"solution_context\"", ",", "\"student_context\"", "]", ":", "if", "arg_5", "in", "arg_3", "and", "not", "arg_3", "[", "arg_5", "]", ":", "arg_3", ".", "pop", "(", "arg_5", ",", "None", ")", "def", "update_kwarg", "(", "arg_6", ",", "arg_7", ")", ":", "arg_3", "[", "arg_6", "]", "=", "arg_7", "(", "arg_3", "[", "arg_6", "]", ")", "def", "update_context", "(", "arg_6", ")", ":", "update_kwarg", "(", "arg_6", ",", "getattr", "(", "arg_0", ",", "arg_6", ")", ".", "update_ctx", ")", "if", "isinstance", "(", "arg_3", ".", "get", "(", "\"student_ast\"", ",", "None", ")", ",", "list", ")", ":", "update_kwarg", "(", "\"student_ast\"", ",", "wrap_in_module", ")", "if", "isinstance", "(", "arg_3", ".", "get", "(", "\"solution_ast\"", ",", "None", ")", ",", "list", ")", ":", "update_kwarg", "(", "\"solution_ast\"", ",", "wrap_in_module", ")", "if", "\"student_ast\"", "in", "arg_3", ":", "arg_3", "[", "\"student_code\"", "]", "=", "arg_0", ".", "student_ast_tokens", ".", "get_text", "(", "arg_3", "[", "\"student_ast\"", "]", ")", "if", "\"solution_ast\"", "in", "arg_3", ":", "arg_3", "[", "\"solution_code\"", "]", "=", "arg_0", ".", "solution_ast_tokens", ".", "get_text", "(", "arg_3", "[", "\"solution_ast\"", "]", ")", "if", "\"solution_context\"", "in", "arg_3", ":", "update_context", "(", "\"solution_context\"", ")", "if", "\"student_context\"", "in", "arg_3", ":", "update_context", "(", "\"student_context\"", ")", "if", "\"solution_env\"", "in", "arg_3", ":", "update_context", "(", "\"solution_env\"", ")", "if", "\"student_env\"", "in", "arg_3", ":", "update_context", "(", "\"student_env\"", ")", "arg_8", "=", "arg_0", ".", "SUBCLASSES", "[", "arg_2", "]", "if", "arg_2", "else", "State", "arg_9", "=", "arg_8", "(", "**", "{", "**", "arg_4", ",", "**", "arg_3", "}", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1=\"\", arg_2=\"\", **arg_3):\n        \"\"\"Dive into nested tree.\n\n        Set the current state as a state with a subtree of this syntax tree as\n        student tree and solution tree. This is necessary when testing if statements or\n        for loops for example.\n        \"\"\"\n        arg_4 = {\n            attr: getattr(arg_0, attr)\n            for attr in arg_0.params\n            if attr not in [\"highlight\"]\n        }\n\n        if not isinstance(arg_1, dict):\n            arg_1 = {\"msg\": arg_1, \"kwargs\": {}}\n\n        arg_3[\"messages\"] = [*arg_0.messages, arg_1]\n        arg_3[\"parent_state\"] = arg_0\n\n        for arg_5 in [\"solution_context\", \"student_context\"]:\n            if arg_5 in arg_3 and not arg_3[arg_5]:\n                arg_3.pop(arg_5, None)\n\n        def update_kwarg(arg_6, arg_7):\n            arg_3[arg_6] = arg_7(arg_3[arg_6])\n\n        def update_context(arg_6):\n            update_kwarg(arg_6, getattr(arg_0, arg_6).update_ctx)\n\n        if isinstance(arg_3.get(\"student_ast\", None), list):\n            update_kwarg(\"student_ast\", wrap_in_module)\n        if isinstance(arg_3.get(\"solution_ast\", None), list):\n            update_kwarg(\"solution_ast\", wrap_in_module)\n\n        if \"student_ast\" in arg_3:\n            arg_3[\"student_code\"] = arg_0.student_ast_tokens.get_text(\n                arg_3[\"student_ast\"]\n            )\n        if \"solution_ast\" in arg_3:\n            arg_3[\"solution_code\"] = arg_0.solution_ast_tokens.get_text(\n                arg_3[\"solution_ast\"]\n            )\n\n        # get new contexts\n        if \"solution_context\" in arg_3:\n            update_context(\"solution_context\")\n        if \"student_context\" in arg_3:\n            update_context(\"student_context\")\n\n        # get new envs\n        if \"solution_env\" in arg_3:\n            update_context(\"solution_env\")\n        if \"student_env\" in arg_3:\n            update_context(\"student_env\")\n\n        arg_8 = arg_0.SUBCLASSES[arg_2] if arg_2 else State\n        arg_9 = arg_8(**{**arg_4, **arg_3})\n        return arg_9", "path": "pythonwhat/State.py", "identifier": "State.to_child", "docstring": "Dive into nested tree.\n\n        Set the current state as a state with a subtree of this syntax tree as\n        student tree and solution tree. This is necessary when testing if statements or\n        for loops for example.", "docstring_tokens": ["Dive", "into", "nested", "tree", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 258797}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pip/index.py#L528-L550", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Finds the true URL name of a package, when the given name isn't quite\n        correct.\n        This is usually used to implement case-insensitivity.", "language": "python", "parameters": "(self, index_url, url_name, req)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "arg_1", ".", "url", ".", "endswith", "(", "'/'", ")", ":", "arg_1", ".", "url", "+=", "'/'", "arg_4", "=", "arg_0", ".", "_get_page", "(", "arg_1", ",", "arg_3", ")", "if", "arg_4", "is", "None", ":", "logger", ".", "critical", "(", "'Cannot fetch index base URL %s'", ",", "arg_1", ")", "return", "arg_5", "=", "normalize_name", "(", "arg_3", ".", "url_name", ")", "for", "arg_6", "in", "arg_4", ".", "links", ":", "arg_7", "=", "posixpath", ".", "basename", "(", "arg_6", ".", "path", ".", "rstrip", "(", "'/'", ")", ")", "if", "arg_5", "==", "normalize_name", "(", "arg_7", ")", ":", "logger", ".", "debug", "(", "'Real name of requirement %s is %s'", ",", "arg_2", ",", "arg_7", ",", ")", "return", "arg_7", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Finds the true URL name of a package, when the given name isn't quite\n        correct.\n        This is usually used to implement case-insensitivity.\n        \"\"\"\n        if not arg_1.url.endswith('/'):\n            # Vaguely part of the PyPI API... weird but true.\n            # FIXME: bad to modify this?\n            arg_1.url += '/'\n        arg_4 = arg_0._get_page(arg_1, arg_3)\n        if arg_4 is None:\n            logger.critical('Cannot fetch index base URL %s', arg_1)\n            return\n        arg_5 = normalize_name(arg_3.url_name)\n        for arg_6 in arg_4.links:\n            arg_7 = posixpath.basename(arg_6.path.rstrip('/'))\n            if arg_5 == normalize_name(arg_7):\n                logger.debug(\n                    'Real name of requirement %s is %s', arg_2, arg_7,\n                )\n                return arg_7\n        return None", "path": "virtualEnvironment/lib/python2.7/site-packages/pip/index.py", "identifier": "PackageFinder._find_url_name", "docstring": "Finds the true URL name of a package, when the given name isn't quite\n        correct.\n        This is usually used to implement case-insensitivity.", "docstring_tokens": ["Finds", "the", "true", "URL", "name", "of", "a", "package", "when", "the", "given", "name", "isn", "t", "quite", "correct", ".", "This", "is", "usually", "used", "to", "implement", "case", "-", "insensitivity", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 258798}
{"url": "https://github.com/encode/starlette/blob/d23bfd0d8ff68d535d0283aa4099e5055da88bb9/starlette/staticfiles.py#L195-L222", "sha": "d23bfd0d8ff68d535d0283aa4099e5055da88bb9", "docstring_summary": "Given the request and response headers, return `True` if an HTTP\n        \"Not Modified\" response could be returned instead.", "language": "python", "parameters": "(\n        self, response_headers: Headers, request_headers: Headers\n    )", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", ")", "->", "bool", ":", "try", ":", "arg_4", "=", "arg_3", "[", "\"if-none-match\"", "]", "arg_5", "=", "arg_1", "[", "\"etag\"", "]", "if", "arg_4", "==", "arg_5", ":", "return", "True", "except", "KeyError", ":", "pass", "try", ":", "arg_6", "=", "parsedate", "(", "arg_3", "[", "\"if-modified-since\"", "]", ")", "arg_7", "=", "parsedate", "(", "arg_1", "[", "\"last-modified\"", "]", ")", "if", "(", "arg_6", "is", "not", "None", "and", "arg_7", "is", "not", "None", "and", "arg_6", ">=", "arg_7", ")", ":", "return", "True", "except", "KeyError", ":", "pass", "return", "False"], "function": "def Func(\n        arg_0, arg_1: arg_2, arg_3: arg_2\n    ) -> bool:\n        \"\"\"\n        Given the request and response headers, return `True` if an HTTP\n        \"Not Modified\" response could be returned instead.\n        \"\"\"\n        try:\n            arg_4 = arg_3[\"if-none-match\"]\n            arg_5 = arg_1[\"etag\"]\n            if arg_4 == arg_5:\n                return True\n        except KeyError:\n            pass\n\n        try:\n            arg_6 = parsedate(arg_3[\"if-modified-since\"])\n            arg_7 = parsedate(arg_1[\"last-modified\"])\n            if (\n                arg_6 is not None\n                and arg_7 is not None\n                and arg_6 >= arg_7\n            ):\n                return True\n        except KeyError:\n            pass\n\n        return False", "path": "starlette/staticfiles.py", "identifier": "StaticFiles.is_not_modified", "docstring": "Given the request and response headers, return `True` if an HTTP\n        \"Not Modified\" response could be returned instead.", "docstring_tokens": ["Given", "the", "request", "and", "response", "headers", "return", "True", "if", "an", "HTTP", "Not", "Modified", "response", "could", "be", "returned", "instead", "."], "nwo": "encode/starlette", "score": 0.9921761654937327, "idx": 258799}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L225-L229", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Get available attritbutes from dataset you've selected", "language": "python", "parameters": "(self, dataset)", "return_statement": "return pd.DataFrame(attr_, columns=[\"Attribute\",\"Description\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "attributes", "(", "arg_1", ")", "arg_3", "=", "[", "(", "k", ",", "v", "[", "0", "]", ")", "for", "k", ",", "v", "in", "arg_2", ".", "items", "(", ")", "]", "return", "pd", ".", "DataFrame", "(", "arg_3", ",", "columns", "=", "[", "\"Attribute\"", ",", "\"Description\"", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get available attritbutes from dataset you've selected\"\"\"\n        arg_2 = arg_0.attributes(arg_1)\n        arg_3 = [ (k, v[0]) for k, v in arg_2.items()]\n        return pd.DataFrame(arg_3, columns=[\"Attribute\",\"Description\"])", "path": "gseapy/parser.py", "identifier": "Biomart.get_attributes", "docstring": "Get available attritbutes from dataset you've selected", "docstring_tokens": ["Get", "available", "attritbutes", "from", "dataset", "you", "ve", "selected"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 258800}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/utils.py#L25-L41", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Extract storage name from file path.", "language": "python", "parameters": "(path, default='osfstorage')", "return_statement": "return (default, path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'osfstorage'", ")", ":", "arg_0", "=", "norm_remote_path", "(", "arg_0", ")", "for", "arg_2", "in", "KNOWN_PROVIDERS", ":", "if", "arg_0", ".", "startswith", "(", "arg_2", "+", "'/'", ")", ":", "if", "six", ".", "PY3", ":", "return", "arg_0", ".", "split", "(", "'/'", ",", "maxsplit", "=", "1", ")", "else", ":", "return", "arg_0", ".", "split", "(", "'/'", ",", "1", ")", "return", "(", "arg_1", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1='osfstorage'):\n    \"\"\"Extract storage name from file path.\n\n    If a path begins with a known storage provider the name is removed\n    from the path. Otherwise the `default` storage provider is returned\n    and the path is not modified.\n    \"\"\"\n    arg_0 = norm_remote_path(arg_0)\n\n    for arg_2 in KNOWN_PROVIDERS:\n        if arg_0.startswith(arg_2 + '/'):\n            if six.PY3:\n                return arg_0.split('/', maxsplit=1)\n            else:\n                return arg_0.split('/', 1)\n\n    return (arg_1, arg_0)", "path": "osfclient/utils.py", "identifier": "split_storage", "docstring": "Extract storage name from file path.\n\n    If a path begins with a known storage provider the name is removed\n    from the path. Otherwise the `default` storage provider is returned\n    and the path is not modified.", "docstring_tokens": ["Extract", "storage", "name", "from", "file", "path", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 258801}
{"url": "https://github.com/snowplow/snowplow-python-analytics-sdk/blob/0ddca91e3f6d8bed88627fa557790aa4868bdace/snowplow_analytics_sdk/run_manifests.py#L112-L137", "sha": "0ddca91e3f6d8bed88627fa557790aa4868bdace", "docstring_summary": "Return pair of bucket without protocol and path", "language": "python", "parameters": "(path)", "return_statement": "return bucket, normalize_prefix(path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "startswith", "(", "'s3://'", ")", ":", "arg_0", "=", "arg_0", "[", "5", ":", "]", "elif", "arg_0", ".", "startswith", "(", "'s3n://'", ")", ":", "arg_0", "=", "arg_0", "[", "6", ":", "]", "elif", "arg_0", ".", "startswith", "(", "'s3a://'", ")", ":", "arg_0", "=", "arg_0", "[", "6", ":", "]", "else", ":", "raise", "ValueError", "(", "\"S3 path should start with s3://, s3n:// or \"", "\"s3a:// prefix\"", ")", "arg_1", "=", "arg_0", ".", "split", "(", "'/'", ")", "arg_2", "=", "arg_1", "[", "0", "]", "arg_0", "=", "'/'", ".", "join", "(", "arg_1", "[", "1", ":", "]", ")", "return", "arg_2", ",", "normalize_prefix", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Return pair of bucket without protocol and path\n\n    Arguments:\n    path - valid S3 path, such as s3://somebucket/events\n\n    >>> Func('s3://mybucket/path-to-events')\n    ('mybucket', 'path-to-events/')\n    >>> Func('s3://mybucket')\n    ('mybucket', None)\n    >>> Func('s3n://snowplow-bucket/some/prefix/')\n    ('snowplow-bucket', 'some/prefix/')\n    \"\"\"\n    if arg_0.startswith('s3://'):\n        arg_0 = arg_0[5:]\n    elif arg_0.startswith('s3n://'):\n        arg_0 = arg_0[6:]\n    elif arg_0.startswith('s3a://'):\n        arg_0 = arg_0[6:]\n    else:\n        raise ValueError(\"S3 path should start with s3://, s3n:// or \"\n                         \"s3a:// prefix\")\n    arg_1 = arg_0.split('/')\n    arg_2 = arg_1[0]\n    arg_0 = '/'.join(arg_1[1:])\n    return arg_2, normalize_prefix(arg_0)", "path": "snowplow_analytics_sdk/run_manifests.py", "identifier": "split_full_path", "docstring": "Return pair of bucket without protocol and path\n\n    Arguments:\n    path - valid S3 path, such as s3://somebucket/events\n\n    >>> split_full_path('s3://mybucket/path-to-events')\n    ('mybucket', 'path-to-events/')\n    >>> split_full_path('s3://mybucket')\n    ('mybucket', None)\n    >>> split_full_path('s3n://snowplow-bucket/some/prefix/')\n    ('snowplow-bucket', 'some/prefix/')", "docstring_tokens": ["Return", "pair", "of", "bucket", "without", "protocol", "and", "path"], "nwo": "snowplow/snowplow-python-analytics-sdk", "score": 0.2855681421870085, "idx": 258802}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/helper.py#L112-L128", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Try the library. If it doesnt work, use the command line..", "language": "python", "parameters": "(filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "sha256", "(", ")", "arg_2", "=", "open", "(", "arg_0", ",", "'rb'", ")", "while", "True", ":", "arg_3", "=", "arg_2", ".", "read", "(", "0x1000000", ")", "if", "arg_3", "in", "[", "None", ",", "\"\"", "]", ":", "break", "arg_1", ".", "update", "(", "arg_3", ".", "encode", "(", "'utf-8'", ")", ")", "arg_2", ".", "close", "(", ")", "return", "arg_1", ".", "hexdigest", "(", ")", "except", ":", "arg_4", "=", "run", "(", "[", "\"sha256sum\"", ",", "\"-b\"", ",", "arg_0", "]", ")", "return", "arg_4", ".", "split", "(", "\" \"", ")", "[", "0", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Try the library. If it doesnt work, use the command line..\n    \"\"\"\n    try:\n        arg_1 = sha256()\n        arg_2 = open(arg_0, 'rb')\n        while True:\n            arg_3 = arg_2.read(0x1000000)\n            if arg_3 in [None, \"\"]:\n                break\n            arg_1.update(arg_3.encode('utf-8'))\n        arg_2.close()\n        return arg_1.hexdigest()\n    except:\n        arg_4 = run([\"sha256sum\", \"-b\", arg_0])\n        return arg_4.split(\" \")[0]", "path": "dgitcore/helper.py", "identifier": "compute_sha256", "docstring": "Try the library. If it doesnt work, use the command line..", "docstring_tokens": ["Try", "the", "library", ".", "If", "it", "doesnt", "work", "use", "the", "command", "line", ".."], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 258803}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L113-L164", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find a file by looking through a sequence of paths.", "language": "python", "parameters": "(filename, path_dirs=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", "=", "arg_0", ".", "strip", "(", "'\"'", ")", ".", "strip", "(", "\"'\"", ")", "if", "os", ".", "path", ".", "isabs", "(", "arg_0", ")", "and", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "return", "arg_0", "if", "arg_1", "is", "None", ":", "arg_1", "=", "(", "\"\"", ",", ")", "elif", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_1", "=", "(", "arg_1", ",", ")", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", "==", "'.'", ":", "arg_2", "=", "os", ".", "getcwdu", "(", ")", "arg_3", "=", "expand_path", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "arg_0", ")", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_3", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "arg_3", ")", "raise", "IOError", "(", "\"File %r does not exist in any of the search paths: %r\"", "%", "(", "arg_0", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Find a file by looking through a sequence of paths.\n\n    This iterates through a sequence of paths looking for a file and returns\n    the full, absolute path of the first occurence of the file.  If no set of\n    path dirs is given, the filename is tested as is, after running through\n    :func:`expandvars` and :func:`expanduser`.  Thus a simple call::\n\n        Func('myfile.txt')\n\n    will find the file in the current working dir, but::\n\n        Func('~/myfile.txt')\n\n    Will find the file in the users home directory.  This function does not\n    automatically try any paths, such as the cwd or the user's home directory.\n\n    Parameters\n    ----------\n    filename : str\n        The filename to look for.\n    path_dirs : str, None or sequence of str\n        The sequence of paths to look for the file in.  If None, the filename\n        need to be absolute or be in the cwd.  If a string, the string is\n        put into a sequence and the searched.  If a sequence, walk through\n        each element and join with ``filename``, calling :func:`expandvars`\n        and :func:`expanduser` before testing for existence.\n\n    Returns\n    -------\n    Raises :exc:`IOError` or returns absolute path to file.\n    \"\"\"\n\n    # If paths are quoted, abspath gets confused, strip them...\n    arg_0 = arg_0.strip('\"').strip(\"'\")\n    # If the input is an absolute path, just check it exists\n    if os.path.isabs(arg_0) and os.path.isfile(arg_0):\n        return arg_0\n\n    if arg_1 is None:\n        arg_1 = (\"\",)\n    elif isinstance(arg_1, basestring):\n        arg_1 = (arg_1,)\n\n    for arg_2 in arg_1:\n        if arg_2 == '.': arg_2 = os.getcwdu()\n        arg_3 = expand_path(os.path.join(arg_2, arg_0))\n        if os.path.isfile(arg_3):\n            return os.path.abspath(arg_3)\n\n    raise IOError(\"File %r does not exist in any of the search paths: %r\" %\n                  (arg_0, arg_1) )", "path": "environment/lib/python2.7/site-packages/IPython/utils/path.py", "identifier": "filefind", "docstring": "Find a file by looking through a sequence of paths.\n\n    This iterates through a sequence of paths looking for a file and returns\n    the full, absolute path of the first occurence of the file.  If no set of\n    path dirs is given, the filename is tested as is, after running through\n    :func:`expandvars` and :func:`expanduser`.  Thus a simple call::\n\n        filefind('myfile.txt')\n\n    will find the file in the current working dir, but::\n\n        filefind('~/myfile.txt')\n\n    Will find the file in the users home directory.  This function does not\n    automatically try any paths, such as the cwd or the user's home directory.\n\n    Parameters\n    ----------\n    filename : str\n        The filename to look for.\n    path_dirs : str, None or sequence of str\n        The sequence of paths to look for the file in.  If None, the filename\n        need to be absolute or be in the cwd.  If a string, the string is\n        put into a sequence and the searched.  If a sequence, walk through\n        each element and join with ``filename``, calling :func:`expandvars`\n        and :func:`expanduser` before testing for existence.\n\n    Returns\n    -------\n    Raises :exc:`IOError` or returns absolute path to file.", "docstring_tokens": ["Find", "a", "file", "by", "looking", "through", "a", "sequence", "of", "paths", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258804}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_anomaly_classifier_region.py#L473-L490", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Adds the record to the KNN classifier.", "language": "python", "parameters": "(self, record)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_knnclassifier", ".", "_knn", "arg_3", "=", "arg_0", ".", "_knnclassifier", ".", "getParameter", "(", "'categoryRecencyList'", ")", "arg_4", "=", "arg_0", ".", "_labelListToCategoryNumber", "(", "arg_1", ".", "anomalyLabel", ")", "if", "arg_1", ".", "ROWID", "in", "arg_3", ":", "arg_2", ".", "prototypeSetCategory", "(", "arg_1", ".", "ROWID", ",", "arg_4", ")", "return", "arg_5", "=", "arg_0", ".", "_getStateAnomalyVector", "(", "arg_1", ")", "arg_6", "=", "arg_1", ".", "ROWID", "arg_2", ".", "learn", "(", "arg_5", ",", "arg_4", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Adds the record to the KNN classifier.\n    \"\"\"\n    arg_2 = arg_0._knnclassifier._knn\n\n    arg_3 = arg_0._knnclassifier.getParameter('categoryRecencyList')\n    arg_4 = arg_0._labelListToCategoryNumber(arg_1.anomalyLabel)\n\n    # If record is already in the classifier, overwrite its labeling\n    if arg_1.ROWID in arg_3:\n      arg_2.prototypeSetCategory(arg_1.ROWID, arg_4)\n      return\n\n    # Learn this pattern in the knn\n    arg_5 = arg_0._getStateAnomalyVector(arg_1)\n    arg_6 = arg_1.ROWID\n    arg_2.learn(arg_5, arg_4, arg_6=arg_6)", "path": "src/nupic/regions/knn_anomaly_classifier_region.py", "identifier": "KNNAnomalyClassifierRegion._addRecordToKNN", "docstring": "Adds the record to the KNN classifier.", "docstring_tokens": ["Adds", "the", "record", "to", "the", "KNN", "classifier", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258805}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/debugger.py#L476-L480", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "The debugger interface to magic_pdef", "language": "python", "parameters": "(self, arg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "(", "'Locals'", ",", "arg_0", ".", "curframe", ".", "f_locals", ")", ",", "(", "'Globals'", ",", "arg_0", ".", "curframe", ".", "f_globals", ")", "]", "arg_0", ".", "shell", ".", "find_line_magic", "(", "'pdef'", ")", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"The debugger interface to magic_pdef\"\"\"\n        arg_2 = [('Locals', arg_0.curframe.f_locals),\n                      ('Globals', arg_0.curframe.f_globals)]\n        arg_0.shell.find_line_magic('pdef')(arg_1, arg_2=arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/core/debugger.py", "identifier": "Pdb.do_pdef", "docstring": "The debugger interface to magic_pdef", "docstring_tokens": ["The", "debugger", "interface", "to", "magic_pdef"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258806}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/profiler.py#L36-L54", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Runs cProfile on a package.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'objectName': self._object_name,\n            'callStats': self._transform_stats(prof_stats),\n            'totalTime': prof_stats.total_tt,\n            'primitiveCalls': prof_stats.prim_calls,\n            'totalCalls': prof_stats.total_calls,\n            'timestamp': int(time.time())\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "cProfile", ".", "Profile", "(", ")", "arg_1", ".", "enable", "(", ")", "try", ":", "runpy", ".", "run_path", "(", "arg_0", ".", "_run_object", ",", "run_name", "=", "'__main__'", ")", "except", "SystemExit", ":", "pass", "arg_1", ".", "disable", "(", ")", "arg_2", "=", "pstats", ".", "Stats", "(", "arg_1", ")", "arg_2", ".", "calc_callees", "(", ")", "return", "{", "'objectName'", ":", "arg_0", ".", "_object_name", ",", "'callStats'", ":", "arg_0", ".", "_transform_stats", "(", "arg_2", ")", ",", "'totalTime'", ":", "arg_2", ".", "total_tt", ",", "'primitiveCalls'", ":", "arg_2", ".", "prim_calls", ",", "'totalCalls'", ":", "arg_2", ".", "total_calls", ",", "'timestamp'", ":", "int", "(", "time", ".", "time", "(", ")", ")", "}"], "function": "def Func(arg_0):\n        \"\"\"Runs cProfile on a package.\"\"\"\n        arg_1 = cProfile.Profile()\n        arg_1.enable()\n        try:\n            runpy.run_path(arg_0._run_object, run_name='__main__')\n        except SystemExit:\n            pass\n        arg_1.disable()\n        arg_2 = pstats.Stats(arg_1)\n        arg_2.calc_callees()\n        return {\n            'objectName': arg_0._object_name,\n            'callStats': arg_0._transform_stats(arg_2),\n            'totalTime': arg_2.total_tt,\n            'primitiveCalls': arg_2.prim_calls,\n            'totalCalls': arg_2.total_calls,\n            'timestamp': int(time.time())\n        }", "path": "vprof/profiler.py", "identifier": "Profiler._profile_package", "docstring": "Runs cProfile on a package.", "docstring_tokens": ["Runs", "cProfile", "on", "a", "package", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 258807}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/supybot.py#L213-L231", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrieve the Supybot archives after the given date", "language": "python", "parameters": "(self, from_date)", "return_statement": "return [archive[1] for archive in archives]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_0", ".", "__list_supybot_archives", "(", ")", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "arg_0", ".", "__parse_date_from_filepath", "(", "arg_4", ")", "if", "arg_5", ".", "date", "(", ")", ">=", "arg_1", ".", "date", "(", ")", ":", "arg_2", ".", "append", "(", "(", "arg_5", ",", "arg_4", ")", ")", "else", ":", "logger", ".", "debug", "(", "\"Archive %s stored before %s; skipped\"", ",", "arg_4", ",", "str", "(", "arg_1", ")", ")", "arg_2", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ")", "return", "[", "arg_6", "[", "1", "]", "for", "arg_6", "in", "arg_2", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Retrieve the Supybot archives after the given date\"\"\"\n\n        arg_2 = []\n\n        arg_3 = arg_0.__list_supybot_archives()\n\n        for arg_4 in arg_3:\n            arg_5 = arg_0.__parse_date_from_filepath(arg_4)\n\n            if arg_5.date() >= arg_1.date():\n                arg_2.append((arg_5, arg_4))\n            else:\n                logger.debug(\"Archive %s stored before %s; skipped\",\n                             arg_4, str(arg_1))\n\n        arg_2.sort(key=lambda x: x[0])\n\n        return [arg_6[1] for arg_6 in arg_2]", "path": "perceval/backends/core/supybot.py", "identifier": "Supybot.__retrieve_archives", "docstring": "Retrieve the Supybot archives after the given date", "docstring_tokens": ["Retrieve", "the", "Supybot", "archives", "after", "the", "given", "date"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 258808}
{"url": "https://github.com/laplacesdemon/django-youtube/blob/8051ef372473eccb053f773c68e2e5e1b2cfb538/django_youtube/api.py#L291-L316", "sha": "8051ef372473eccb053f773c68e2e5e1b2cfb538", "docstring_summary": "Deletes the video", "language": "python", "parameters": "(self, video_id)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "authenticated", ":", "raise", "ApiError", "(", "_", "(", "\"Authentication is required\"", ")", ")", "arg_2", "=", "arg_0", ".", "fetch_video", "(", "arg_1", ")", "arg_3", "=", "Api", ".", "yt_service", ".", "DeleteVideoEntry", "(", "arg_2", ")", "if", "not", "arg_3", ":", "raise", "OperationError", "(", "_", "(", "\"Cannot be deleted from Youtube\"", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Deletes the video\n\n        Authentication is required\n\n        Params:\n            entry: video entry fetch via 'fetch_video()'\n\n        Return:\n            True if successful\n\n        Raise:\n            OperationError: on unsuccessful deletion\n        \"\"\"\n        # Raise ApiError if not authenticated\n        if not arg_0.authenticated:\n            raise ApiError(_(\"Authentication is required\"))\n\n        arg_2 = arg_0.fetch_video(arg_1)\n        arg_3 = Api.yt_service.DeleteVideoEntry(arg_2)\n\n        if not arg_3:\n            raise OperationError(_(\"Cannot be deleted from Youtube\"))\n\n        return True", "path": "django_youtube/api.py", "identifier": "Api.delete_video", "docstring": "Deletes the video\n\n        Authentication is required\n\n        Params:\n            entry: video entry fetch via 'fetch_video()'\n\n        Return:\n            True if successful\n\n        Raise:\n            OperationError: on unsuccessful deletion", "docstring_tokens": ["Deletes", "the", "video"], "nwo": "laplacesdemon/django-youtube", "score": 0.19379564659824008, "idx": 258809}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/fmc2d/utils_2dfmc.py#L113-L130", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Computes the 2D-Fourier Magnitude Coefficients.", "language": "python", "parameters": "(X)", "return_statement": "return fftshift[:fftshift.shape[0] // 2 + 1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "scipy", ".", "fftpack", ".", "fft2", "(", "arg_0", ")", "arg_2", "=", "magnitude", "(", "arg_1", ")", "arg_3", "=", "scipy", ".", "fftpack", ".", "fftshift", "(", "arg_2", ")", ".", "flatten", "(", ")", "return", "arg_3", "[", ":", "arg_3", ".", "shape", "[", "0", "]", "//", "2", "+", "1", "]"], "function": "def Func(arg_0):\n    \"\"\"Computes the 2D-Fourier Magnitude Coefficients.\"\"\"\n    # 2d-fft\n    arg_1 = scipy.fftpack.fft2(arg_0)\n\n    # Magnitude\n    arg_2 = magnitude(arg_1)\n\n    # FFTshift and flatten\n    arg_3 = scipy.fftpack.fftshift(arg_2).flatten()\n\n    #cmap = plt.cm.get_cmap('hot')\n    #plt.imshow(np.log1p(scipy.fftpack.fftshift(fft2m)).T, interpolation=\"nearest\",\n    #    aspect=\"auto\", cmap=cmap)\n    #plt.show()\n\n    # Take out redundant components\n    return arg_3[:arg_3.shape[0] // 2 + 1]", "path": "msaf/algorithms/fmc2d/utils_2dfmc.py", "identifier": "compute_ffmc2d", "docstring": "Computes the 2D-Fourier Magnitude Coefficients.", "docstring_tokens": ["Computes", "the", "2D", "-", "Fourier", "Magnitude", "Coefficients", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 258810}
{"url": "https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L245-L257", "sha": "cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174", "docstring_summary": "Set a hold", "language": "python", "parameters": "(self, index, cool_temp, heat_temp,\n                      hold_type=\"nextTransition\")", "return_statement": "return self.make_request(body, log_msg_action)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "\"nextTransition\"", ")", ":", "arg_5", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "arg_0", ".", "thermostats", "[", "arg_1", "]", "[", "'identifier'", "]", "}", ",", "\"functions\"", ":", "[", "{", "\"type\"", ":", "\"setHold\"", ",", "\"params\"", ":", "{", "\"holdType\"", ":", "arg_4", ",", "\"coolHoldTemp\"", ":", "int", "(", "arg_2", "*", "10", ")", ",", "\"heatHoldTemp\"", ":", "int", "(", "arg_3", "*", "10", ")", "}", "}", "]", "}", "arg_6", "=", "\"set hold temp\"", "return", "arg_0", ".", "make_request", "(", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                      arg_4=\"nextTransition\"):\n        ''' Set a hold '''\n        arg_5 = {\"selection\": {\n                    \"selectionType\": \"thermostats\",\n                    \"selectionMatch\": arg_0.thermostats[arg_1]['identifier']},\n                \"functions\": [{\"type\": \"setHold\", \"params\": {\n                    \"holdType\": arg_4,\n                    \"coolHoldTemp\": int(arg_2 * 10),\n                    \"heatHoldTemp\": int(arg_3 * 10)\n                }}]}\n        arg_6 = \"set hold temp\"\n        return arg_0.make_request(arg_5, arg_6)", "path": "pyecobee/__init__.py", "identifier": "Ecobee.set_hold_temp", "docstring": "Set a hold", "docstring_tokens": ["Set", "a", "hold"], "nwo": "nkgilley/python-ecobee-api", "score": 0.37994208506696864, "idx": 258811}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmodels/transits.py#L18-L109", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This returns a trapezoid transit-shaped function.", "language": "python", "parameters": "(transitparams, times, mags, errs,\n                           get_ntransitpoints=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "(", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", "=", "arg_0", "arg_10", "=", "(", "arg_1", "-", "arg_6", ")", "/", "arg_5", "arg_10", "=", "arg_10", "-", "np", ".", "floor", "(", "arg_10", ")", "arg_11", "=", "np", ".", "argsort", "(", "arg_10", ")", "arg_12", "=", "arg_10", "[", "arg_11", "]", "arg_13", "=", "arg_1", "[", "arg_11", "]", "arg_14", "=", "arg_2", "[", "arg_11", "]", "arg_15", "=", "arg_3", "[", "arg_11", "]", "arg_16", "=", "np", ".", "median", "(", "arg_14", ")", "arg_17", "=", "np", ".", "full_like", "(", "arg_12", ",", "arg_16", ")", "arg_18", "=", "arg_8", "/", "2.0", "arg_19", "=", "arg_16", "-", "arg_7", "arg_20", "=", "arg_7", "/", "arg_9", "arg_21", "=", "1.0", "-", "arg_18", "arg_22", "=", "arg_21", "+", "arg_9", "arg_23", "=", "arg_18", "-", "arg_9", "arg_24", "=", "arg_18", "arg_25", "=", "(", "arg_12", ">", "arg_21", ")", "&", "(", "arg_12", "<", "arg_22", ")", "arg_26", "=", "(", "arg_12", ">", "arg_22", ")", "|", "(", "arg_12", "<", "arg_23", ")", "arg_27", "=", "(", "arg_12", ">", "arg_23", ")", "&", "(", "arg_12", "<", "arg_24", ")", "arg_28", "=", "arg_25", "|", "arg_26", "|", "arg_27", "arg_29", "=", "np", ".", "sum", "(", "arg_28", ")", "arg_17", "[", "arg_25", "]", "=", "arg_16", "-", "arg_20", "*", "(", "arg_12", "[", "arg_25", "]", "-", "arg_21", ")", "arg_17", "[", "arg_26", "]", "=", "arg_19", "arg_17", "[", "arg_27", "]", "=", "arg_19", "+", "arg_20", "*", "(", "arg_12", "[", "arg_27", "]", "-", "arg_23", ")", "if", "arg_4", ":", "return", "arg_17", ",", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", ",", "arg_29", "else", ":", "return", "arg_17", ",", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                           arg_4=False):\n    '''This returns a trapezoid transit-shaped function.\n\n    Suitable for first order modeling of transit signals.\n\n    Parameters\n    ----------\n\n    transitparams : list of float\n        This contains the transiting planet trapezoid model::\n\n            transitparams = [transitperiod (time),\n                             transitepoch (time),\n                             transitdepth (flux or mags),\n                             transitduration (phase),\n                             ingressduration (phase)]\n\n        All of these will then have fitted values after the fit is done.\n\n        - for magnitudes -> `transitdepth` should be < 0\n        - for fluxes     -> `transitdepth` should be > 0\n\n    times,mags,errs : np.array\n        The input time-series of measurements and associated errors for which\n        the transit model will be generated. The times will be used to generate\n        model mags, and the input `times`, `mags`, and `errs` will be resorted\n        by model phase and returned.\n\n    Returns\n    -------\n\n    (modelmags, phase, ptimes, pmags, perrs) : tuple\n        Returns the model mags and phase values. Also returns the input `times`,\n        `mags`, and `errs` sorted by the model's phase.\n\n    '''\n\n    (arg_5,\n     arg_6,\n     arg_7,\n     arg_8,\n     arg_9) = arg_0\n\n    # generate the phases\n    arg_10 = (arg_1 - arg_6)/arg_5\n    arg_10 = arg_10 - np.floor(arg_10)\n\n    arg_11 = np.argsort(arg_10)\n    arg_12 = arg_10[arg_11]\n    arg_13 = arg_1[arg_11]\n    arg_14 = arg_2[arg_11]\n    arg_15 = arg_3[arg_11]\n\n    arg_16 = np.median(arg_14)\n    arg_17 = np.full_like(arg_12, arg_16)\n\n    arg_18 = arg_8/2.0\n    arg_19 = arg_16 - arg_7\n    arg_20 = arg_7/arg_9\n\n    # the four contact points of the eclipse\n    arg_21 = 1.0 - arg_18\n    arg_22 = arg_21 + arg_9\n    arg_23 = arg_18 - arg_9\n    arg_24 = arg_18\n\n    ## the phase indices ##\n\n    # during ingress\n    arg_25 = (arg_12 > arg_21) & (arg_12 < arg_22)\n\n    # at transit bottom\n    arg_26 = (arg_12 > arg_22) | (arg_12 < arg_23)\n\n    # during egress\n    arg_27 = (arg_12 > arg_23) & (arg_12 < arg_24)\n\n    # count the number of points in transit\n    arg_28 = arg_25 | arg_26 | arg_27\n    arg_29 = np.sum(arg_28)\n\n    # set the mags\n    arg_17[arg_25] = arg_16 - arg_20*(arg_12[arg_25] - arg_21)\n    arg_17[arg_26] = arg_19\n    arg_17[arg_27] = arg_19 + arg_20*(arg_12[arg_27] - arg_23)\n\n    if arg_4:\n        return arg_17, arg_12, arg_13, arg_14, arg_15, arg_29\n\n    else:\n        return arg_17, arg_12, arg_13, arg_14, arg_15", "path": "astrobase/lcmodels/transits.py", "identifier": "trapezoid_transit_func", "docstring": "This returns a trapezoid transit-shaped function.\n\n    Suitable for first order modeling of transit signals.\n\n    Parameters\n    ----------\n\n    transitparams : list of float\n        This contains the transiting planet trapezoid model::\n\n            transitparams = [transitperiod (time),\n                             transitepoch (time),\n                             transitdepth (flux or mags),\n                             transitduration (phase),\n                             ingressduration (phase)]\n\n        All of these will then have fitted values after the fit is done.\n\n        - for magnitudes -> `transitdepth` should be < 0\n        - for fluxes     -> `transitdepth` should be > 0\n\n    times,mags,errs : np.array\n        The input time-series of measurements and associated errors for which\n        the transit model will be generated. The times will be used to generate\n        model mags, and the input `times`, `mags`, and `errs` will be resorted\n        by model phase and returned.\n\n    Returns\n    -------\n\n    (modelmags, phase, ptimes, pmags, perrs) : tuple\n        Returns the model mags and phase values. Also returns the input `times`,\n        `mags`, and `errs` sorted by the model's phase.", "docstring_tokens": ["This", "returns", "a", "trapezoid", "transit", "-", "shaped", "function", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258812}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/init.py#L49-L97", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Initialize a new polyaxonfile specification.", "language": "python", "parameters": "(project, polyaxonfile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "get_project_or_local", "(", "arg_0", ")", "try", ":", "arg_4", "=", "PolyaxonClient", "(", ")", ".", "project", ".", "get_project", "(", "arg_2", ",", "arg_3", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Make sure you have a project with this name `{}`'", ".", "format", "(", "arg_0", ")", ")", "Printer", ".", "print_error", "(", "'You can a create new project with this command: '", "'polyaxon project create '", "'--name={} [--description=...] [--tags=...]'", ".", "format", "(", "arg_3", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "arg_5", "=", "False", "if", "ProjectManager", ".", "is_Funcialized", "(", ")", ":", "arg_6", "=", "ProjectManager", ".", "get_config", "(", ")", "click", ".", "echo", "(", "'Warning! This project is already Funcialized with the following project:'", ")", "with", "clint", ".", "textui", ".", "indent", "(", "4", ")", ":", "clint", ".", "textui", ".", "puts", "(", "'User: {}'", ".", "format", "(", "arg_6", ".", "user", ")", ")", "clint", ".", "textui", ".", "puts", "(", "'Project: {}'", ".", "format", "(", "arg_6", ".", "name", ")", ")", "if", "click", ".", "confirm", "(", "'Would you like to override this current config?'", ",", "default", "=", "False", ")", ":", "arg_5", "=", "True", "else", ":", "arg_5", "=", "True", "if", "arg_5", ":", "ProjectManager", ".", "purge", "(", ")", "ProjectManager", ".", "set_config", "(", "arg_4", ",", "Func", "=", "True", ")", "Printer", ".", "print_success", "(", "'Project was Funcialized'", ")", "else", ":", "Printer", ".", "print_header", "(", "'Project config was not changed.'", ")", "arg_7", "=", "False", "if", "IgnoreManager", ".", "is_Funcialized", "(", ")", ":", "click", ".", "echo", "(", "'Warning! Found a .polyaxonignore file.'", ")", "if", "click", ".", "confirm", "(", "'Would you like to override it?'", ",", "default", "=", "False", ")", ":", "arg_7", "=", "True", "else", ":", "arg_7", "=", "True", "if", "arg_7", ":", "IgnoreManager", ".", "Func_config", "(", ")", "Printer", ".", "print_success", "(", "'New .polyaxonignore file was created.'", ")", "else", ":", "Printer", ".", "print_header", "(", "'.polyaxonignore file was not changed.'", ")", "if", "arg_1", ":", "create_polyaxonfile", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Initialize a new polyaxonfile specification.\"\"\"\n    arg_2, arg_3 = get_project_or_local(arg_0)\n    try:\n        arg_4 = PolyaxonClient().project.get_project(arg_2, arg_3)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Make sure you have a project with this name `{}`'.format(arg_0))\n        Printer.print_error(\n            'You can a create new project with this command: '\n            'polyaxon project create '\n            '--name={} [--description=...] [--tags=...]'.format(arg_3))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    arg_5 = False\n    if ProjectManager.is_Funcialized():\n        arg_6 = ProjectManager.get_config()\n        click.echo('Warning! This project is already Funcialized with the following project:')\n        with clint.textui.indent(4):\n            clint.textui.puts('User: {}'.format(arg_6.user))\n            clint.textui.puts('Project: {}'.format(arg_6.name))\n        if click.confirm('Would you like to override this current config?', default=False):\n            arg_5 = True\n    else:\n        arg_5 = True\n\n    if arg_5:\n        ProjectManager.purge()\n        ProjectManager.set_config(arg_4, Func=True)\n        Printer.print_success('Project was Funcialized')\n    else:\n        Printer.print_header('Project config was not changed.')\n\n    arg_7 = False\n    if IgnoreManager.is_Funcialized():\n        click.echo('Warning! Found a .polyaxonignore file.')\n        if click.confirm('Would you like to override it?', default=False):\n            arg_7 = True\n    else:\n        arg_7 = True\n\n    if arg_7:\n        IgnoreManager.Func_config()\n        Printer.print_success('New .polyaxonignore file was created.')\n    else:\n        Printer.print_header('.polyaxonignore file was not changed.')\n\n    if arg_1:\n        create_polyaxonfile()", "path": "polyaxon_cli/cli/init.py", "identifier": "init", "docstring": "Initialize a new polyaxonfile specification.", "docstring_tokens": ["Initialize", "a", "new", "polyaxonfile", "specification", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 258813}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L1977-L2002", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Apply non-linear distortion.", "language": "python", "parameters": "(self, gain_db=20.0, colour=20.0)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "20.0", ",", "arg_2", "=", "20.0", ")", ":", "if", "not", "is_number", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "'db_level must be a number.'", ")", "if", "not", "is_number", "(", "arg_2", ")", ":", "raise", "ValueError", "(", "'colour must be a number.'", ")", "arg_3", "=", "[", "'Func'", ",", "'{:f}'", ".", "format", "(", "arg_1", ")", ",", "'{:f}'", ".", "format", "(", "arg_2", ")", "]", "arg_0", ".", "effects", ".", "extend", "(", "arg_3", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=20.0, arg_2=20.0):\n        '''Apply non-linear distortion.\n\n        Parameters\n        ----------\n        gain_db : float, default=20\n            Controls the amount of distortion (dB).\n        colour : float, default=20\n            Controls the amount of even harmonic content in the output (dB).\n\n        '''\n        if not is_number(arg_1):\n            raise ValueError('db_level must be a number.')\n\n        if not is_number(arg_2):\n            raise ValueError('colour must be a number.')\n\n        arg_3 = [\n            'Func',\n            '{:f}'.format(arg_1),\n            '{:f}'.format(arg_2)\n        ]\n        arg_0.effects.extend(arg_3)\n        arg_0.effects_log.append('Func')\n\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.overdrive", "docstring": "Apply non-linear distortion.\n\n        Parameters\n        ----------\n        gain_db : float, default=20\n            Controls the amount of distortion (dB).\n        colour : float, default=20\n            Controls the amount of even harmonic content in the output (dB).", "docstring_tokens": ["Apply", "non", "-", "linear", "distortion", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 258814}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/provider.py#L172-L184", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Return a list of all bluez DBus objects that implement the requested\n        interface name and are under the specified path.  The default is to\n        search devices under the root of all bluez objects.", "language": "python", "parameters": "(self, interface, parent_path='/org/bluez')", "return_statement": "return objects", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'/org/bluez'", ")", ":", "arg_2", "=", "arg_2", ".", "lower", "(", ")", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "iteritems", "(", "arg_0", ".", "_bluez", ".", "GetManagedObjects", "(", ")", ")", ":", "if", "arg_1", "in", "arg_5", ".", "keys", "(", ")", "and", "arg_4", ".", "lower", "(", ")", ".", "startswith", "(", "arg_2", ")", ":", "arg_3", ".", "append", "(", "arg_0", ".", "_bus", ".", "get_object", "(", "'org.bluez'", ",", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2='/org/bluez'):\n        \"\"\"Return a list of all bluez DBus objects that implement the requested\n        interface name and are under the specified path.  The default is to\n        search devices under the root of all bluez objects.\n        \"\"\"\n        # Iterate through all the objects in bluez's DBus hierarchy and return\n        # any that implement the requested interface under the specified path.\n        arg_2 = arg_2.lower()\n        arg_3 = []\n        for arg_4, arg_5 in iteritems(arg_0._bluez.GetManagedObjects()):\n            if arg_1 in arg_5.keys() and arg_4.lower().startswith(arg_2):\n                arg_3.append(arg_0._bus.get_object('org.bluez', arg_4))\n        return arg_3", "path": "Adafruit_BluefruitLE/bluez_dbus/provider.py", "identifier": "BluezProvider._get_objects", "docstring": "Return a list of all bluez DBus objects that implement the requested\n        interface name and are under the specified path.  The default is to\n        search devices under the root of all bluez objects.", "docstring_tokens": ["Return", "a", "list", "of", "all", "bluez", "DBus", "objects", "that", "implement", "the", "requested", "interface", "name", "and", "are", "under", "the", "specified", "path", ".", "The", "default", "is", "to", "search", "devices", "under", "the", "root", "of", "all", "bluez", "objects", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 258815}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/utils.py#L40-L59", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "get a particular build template, by default we return templates\n       that are based on package managers.", "language": "python", "parameters": "(name=None, manager='apt')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "'apt'", ")", ":", "arg_2", "=", "get_installdir", "(", ")", "if", "arg_0", "is", "None", ":", "arg_0", "=", "\"%s/main/templates/build/singularity-builder-%s.sh\"", "%", "(", "arg_2", ",", "arg_1", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "bot", ".", "debug", "(", "\"Found template %s\"", "%", "arg_0", ")", "return", "''", ".", "join", "(", "read_file", "(", "arg_0", ")", ")", "bot", ".", "warning", "(", "\"Template %s not found.\"", "%", "arg_0", ")"], "function": "def Func(arg_0=None, arg_1='apt'):\n    '''get a particular build template, by default we return templates\n       that are based on package managers.\n\n       Parameters\n       ==========\n       name: the full path of the template file to use.\n       manager: the package manager to use in the template (yum or apt)\n\n    '''\n    arg_2 = get_installdir()\n    if arg_0 is None:\n        arg_0 = \"%s/main/templates/build/singularity-builder-%s.sh\" %(arg_2,\n                                                                     arg_1)\n\n    if os.path.exists(arg_0):\n        bot.debug(\"Found template %s\" %arg_0)\n        return ''.join(read_file(arg_0)) \n\n    bot.warning(\"Template %s not found.\" %arg_0)", "path": "sregistry/main/google_storage/utils.py", "identifier": "get_build_template", "docstring": "get a particular build template, by default we return templates\n       that are based on package managers.\n\n       Parameters\n       ==========\n       name: the full path of the template file to use.\n       manager: the package manager to use in the template (yum or apt)", "docstring_tokens": ["get", "a", "particular", "build", "template", "by", "default", "we", "return", "templates", "that", "are", "based", "on", "package", "managers", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 258816}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/svg_utils.py#L73-L105", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Merge `svg_file2` in `svg_file1` in the given positions `x_coord`, `y_coord` and `scale`.", "language": "python", "parameters": "(svg_file1, svg_file2, x_coord, y_coord, scale=1)", "return_statement": "return svg1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "1", ")", ":", "arg_5", "=", "_check_svg_file", "(", "arg_0", ")", "arg_6", "=", "_check_svg_file", "(", "arg_1", ")", "arg_7", "=", "arg_6", ".", "getroot", "(", ")", "arg_5", ".", "append", "(", "[", "arg_7", "]", ")", "arg_7", ".", "moveto", "(", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=1):\n    \"\"\" Merge `svg_file2` in `svg_file1` in the given positions `x_coord`, `y_coord` and `scale`.\n\n    Parameters\n    ----------\n    svg_file1: str or svgutils svg document object\n        Path to a '.svg' file.\n\n    svg_file2: str or svgutils svg document object\n        Path to a '.svg' file.\n\n    x_coord: float\n        Horizontal axis position of the `svg_file2` content.\n\n    y_coord: float\n        Vertical axis position of the `svg_file2` content.\n\n    scale: float\n        Scale to apply to `svg_file2` content.\n\n    Returns\n    -------\n    `svg1` svgutils object with the content of 'svg_file2'\n    \"\"\"\n    arg_5 = _check_svg_file(arg_0)\n    arg_6 = _check_svg_file(arg_1)\n\n    arg_7 = arg_6.getroot()\n    arg_5.append([arg_7])\n\n    arg_7.moveto(arg_2, arg_3, arg_4=arg_4)\n\n    return arg_5", "path": "docstamp/svg_utils.py", "identifier": "merge_svg_files", "docstring": "Merge `svg_file2` in `svg_file1` in the given positions `x_coord`, `y_coord` and `scale`.\n\n    Parameters\n    ----------\n    svg_file1: str or svgutils svg document object\n        Path to a '.svg' file.\n\n    svg_file2: str or svgutils svg document object\n        Path to a '.svg' file.\n\n    x_coord: float\n        Horizontal axis position of the `svg_file2` content.\n\n    y_coord: float\n        Vertical axis position of the `svg_file2` content.\n\n    scale: float\n        Scale to apply to `svg_file2` content.\n\n    Returns\n    -------\n    `svg1` svgutils object with the content of 'svg_file2'", "docstring_tokens": ["Merge", "svg_file2", "in", "svg_file1", "in", "the", "given", "positions", "x_coord", "y_coord", "and", "scale", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 258817}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/core/time.py#L79-L103", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Get the datetime at a given period.", "language": "python", "parameters": "(self, ix)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "millisecond", ":", "return", "arg_0", ".", "start_datetime", "+", "timedelta", "(", "milliseconds", "=", "arg_1", ")", "elif", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "second", ":", "return", "arg_0", ".", "start_datetime", "+", "timedelta", "(", "seconds", "=", "arg_1", ")", "elif", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "minute", ":", "return", "arg_0", ".", "start_datetime", "+", "timedelta", "(", "minutes", "=", "arg_1", ")", "elif", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "hour", ":", "return", "arg_0", ".", "start_datetime", "+", "timedelta", "(", "hours", "=", "arg_1", ")", "elif", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "day", ":", "return", "arg_0", ".", "start_datetime", "+", "relativedelta", "(", "days", "=", "arg_1", ")", "elif", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "week", ":", "return", "arg_0", ".", "start_datetime", "+", "relativedelta", "(", "days", "=", "arg_1", "*", "7", ")", "elif", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "month", ":", "return", "arg_0", ".", "start_datetime", "+", "relativedelta", "(", "months", "=", "arg_1", ")", "elif", "arg_0", ".", "timestep_period_duration", "==", "TimePeriod", ".", "year", ":", "return", "arg_0", ".", "start_datetime", "+", "relativedelta", "(", "years", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get the datetime at a given period.\n\n        :param period: The index of the period.\n\n        :returns: The datetime.\n        \"\"\"\n\n        if arg_0.timestep_period_duration == TimePeriod.millisecond:\n            return arg_0.start_datetime + timedelta(milliseconds=arg_1)\n        elif arg_0.timestep_period_duration == TimePeriod.second:\n            return arg_0.start_datetime + timedelta(seconds=arg_1)\n        elif arg_0.timestep_period_duration == TimePeriod.minute:\n            return arg_0.start_datetime + timedelta(minutes=arg_1)\n        elif arg_0.timestep_period_duration == TimePeriod.hour:\n            return arg_0.start_datetime + timedelta(hours=arg_1)\n        elif arg_0.timestep_period_duration == TimePeriod.day:\n            return arg_0.start_datetime + relativedelta(days=arg_1)\n        elif arg_0.timestep_period_duration == TimePeriod.week:\n            return arg_0.start_datetime + relativedelta(days=arg_1*7)\n        elif arg_0.timestep_period_duration == TimePeriod.month:\n            return arg_0.start_datetime + relativedelta(months=arg_1)\n        elif arg_0.timestep_period_duration == TimePeriod.year:\n            return arg_0.start_datetime + relativedelta(years=arg_1)", "path": "auxi/core/time.py", "identifier": "Clock.get_datetime_at_period_ix", "docstring": "Get the datetime at a given period.\n\n        :param period: The index of the period.\n\n        :returns: The datetime.", "docstring_tokens": ["Get", "the", "datetime", "at", "a", "given", "period", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 258818}
{"url": "https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/operator.py#L365-L380", "sha": "d30107be02521fa6cdfe285da3b6b0cdd153c8cc", "docstring_summary": "Given a MetadataStatement instance create a signed JWT.", "language": "python", "parameters": "(self, metadata, receiver='', iss='', lifetime=0,\n                                sign_alg='')", "return_statement": "return self.self_signer.sign(metadata, receiver=receiver, iss=iss,\n                                     lifetime=lifetime, sign_alg=sign_alg)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ",", "arg_3", "=", "''", ",", "arg_4", "=", "0", ",", "arg_5", "=", "''", ")", ":", "return", "arg_0", ".", "self_signer", ".", "sign", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2='', arg_3='', arg_4=0,\n                                arg_5=''):\n        \"\"\"\n        Given a MetadataStatement instance create a signed JWT.\n\n        :param metadata: Original metadata statement as a MetadataStatement\n            instance\n        :param receiver: Receiver (audience) of the JWT\n        :param iss: Issuer ID if different from default\n        :param lifetime: jWT signature life time\n        :param sign_alg: JWT signature algorithm\n        :return: A JWT\n        \"\"\"\n\n        return arg_0.self_signer.sign(arg_1, arg_2=arg_2, arg_3=arg_3,\n                                     arg_4=arg_4, arg_5=arg_5)", "path": "src/fedoidcmsg/operator.py", "identifier": "Operator.pack_metadata_statement", "docstring": "Given a MetadataStatement instance create a signed JWT.\n\n        :param metadata: Original metadata statement as a MetadataStatement\n            instance\n        :param receiver: Receiver (audience) of the JWT\n        :param iss: Issuer ID if different from default\n        :param lifetime: jWT signature life time\n        :param sign_alg: JWT signature algorithm\n        :return: A JWT", "docstring_tokens": ["Given", "a", "MetadataStatement", "instance", "create", "a", "signed", "JWT", "."], "nwo": "IdentityPython/fedoidcmsg", "score": 0.09252797783733271, "idx": 258819}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L1275-L1278", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Retrieve single byte from word", "language": "python", "parameters": "(self, offset, value)", "return_statement": "return Operators.ZEXTEND(Operators.EXTRACT(value, offset, 8), 256)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "Operators", ".", "ITEBV", "(", "256", ",", "arg_1", "<", "32", ",", "(", "31", "-", "arg_1", ")", "*", "8", ",", "256", ")", "return", "Operators", ".", "ZEXTEND", "(", "Operators", ".", "EXTRACT", "(", "arg_2", ",", "arg_1", ",", "8", ")", ",", "256", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Retrieve single byte from word\"\"\"\n        arg_1 = Operators.ITEBV(256, arg_1 < 32, (31 - arg_1) * 8, 256)\n        return Operators.ZEXTEND(Operators.EXTRACT(arg_2, arg_1, 8), 256)", "path": "manticore/platforms/evm.py", "identifier": "EVM.BYTE", "docstring": "Retrieve single byte from word", "docstring_tokens": ["Retrieve", "single", "byte", "from", "word"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258820}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/gcp/auth.py#L23-L64", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "User function to get the correct client.", "language": "python", "parameters": "(service, service_type='client', **conn_args)", "return_statement": "return client_details, client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'client'", ",", "**", "arg_2", ")", ":", "arg_3", "=", "choose_client", "(", "arg_0", ")", "arg_4", "=", "get_user_agent", "(", "**", "arg_2", ")", "if", "arg_3", ":", "if", "arg_3", "[", "'client_type'", "]", "==", "'cloud'", ":", "arg_5", "=", "get_gcp_client", "(", "mod_name", "=", "arg_3", "[", "'module_name'", "]", ",", "pkg_name", "=", "arg_2", ".", "get", "(", "'pkg_name'", ",", "'google.cloud'", ")", ",", "key_file", "=", "arg_2", ".", "get", "(", "'key_file'", ",", "None", ")", ",", "project", "=", "arg_2", "[", "'project'", "]", ",", "arg_4", "=", "arg_4", ")", "else", ":", "arg_5", "=", "get_google_client", "(", "mod_name", "=", "arg_3", "[", "'module_name'", "]", ",", "key_file", "=", "arg_2", ".", "get", "(", "'key_file'", ",", "None", ")", ",", "arg_4", "=", "arg_4", ",", "api_version", "=", "arg_2", ".", "get", "(", "'api_version'", ",", "'v1'", ")", ")", "else", ":", "try", ":", "arg_5", "=", "get_google_client", "(", "mod_name", "=", "arg_0", ",", "key_file", "=", "arg_2", ".", "get", "(", "'key_file'", ",", "None", ")", ",", "arg_4", "=", "arg_4", ",", "api_version", "=", "arg_2", ".", "get", "(", "'api_version'", ",", "'v1'", ")", ")", "except", "Exception", "as", "e", ":", "raise", "e", "return", "arg_3", ",", "arg_5"], "function": "def Func(arg_0, arg_1='client', **arg_2):\n    \"\"\"\n    User function to get the correct client.\n\n    Based on the GOOGLE_CLIENT_MAP dictionary, the return will be a cloud or general\n    client that can interact with the desired service.\n\n    :param service: GCP service to connect to. E.g. 'gce', 'iam'\n    :type service: ``str``\n\n    :param conn_args: Dictionary of connection arguments.  'project' is required.\n                      'user_agent' can be specified and will be set in the client\n                       returned.\n    :type conn_args: ``dict``\n\n    :return: client_details, client\n    :rtype: ``tuple`` of ``dict``, ``object``\n    \"\"\"\n    arg_3 = choose_client(arg_0)\n    arg_4 = get_user_agent(**arg_2)\n    if arg_3:\n        if arg_3['client_type'] == 'cloud':\n            arg_5 = get_gcp_client(\n                mod_name=arg_3['module_name'],\n                pkg_name=arg_2.get('pkg_name', 'google.cloud'),\n                key_file=arg_2.get('key_file', None),\n                project=arg_2['project'], arg_4=arg_4)\n        else:\n            arg_5 = get_google_client(\n                mod_name=arg_3['module_name'],\n                key_file=arg_2.get('key_file', None),\n                arg_4=arg_4, api_version=arg_2.get('api_version', 'v1'))\n    else:\n        # There is no client known for this service. We can try the standard API.\n        try:\n            arg_5 = get_google_client(\n                mod_name=arg_0, key_file=arg_2.get('key_file', None),\n                arg_4=arg_4, api_version=arg_2.get('api_version', 'v1'))\n        except Exception as e:\n            raise e\n\n    return arg_3, arg_5", "path": "cloudaux/gcp/auth.py", "identifier": "get_client", "docstring": "User function to get the correct client.\n\n    Based on the GOOGLE_CLIENT_MAP dictionary, the return will be a cloud or general\n    client that can interact with the desired service.\n\n    :param service: GCP service to connect to. E.g. 'gce', 'iam'\n    :type service: ``str``\n\n    :param conn_args: Dictionary of connection arguments.  'project' is required.\n                      'user_agent' can be specified and will be set in the client\n                       returned.\n    :type conn_args: ``dict``\n\n    :return: client_details, client\n    :rtype: ``tuple`` of ``dict``, ``object``", "docstring_tokens": ["User", "function", "to", "get", "the", "correct", "client", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 258821}
{"url": "https://github.com/foxx/peewee-extras/blob/327e7e63465b3f6e1afc0e6a651f4cb5c8c60889/peewee_extras.py#L359-L370", "sha": "327e7e63465b3f6e1afc0e6a651f4cb5c8c60889", "docstring_summary": "Retrieve items from query", "language": "python", "parameters": "(self, cursor)", "return_statement": "return query.get(**cursor)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "dict", ")", ",", "\"expected cursor type 'dict'\"", "arg_2", "=", "arg_0", ".", "get_query", "(", ")", "assert", "isinstance", "(", "arg_2", ",", "peewee", ".", "Query", ")", "arg_2", "return", "arg_2", ".", "get", "(", "**", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retrieve items from query\n        \"\"\"\n        assert isinstance(arg_1, dict), \"expected cursor type 'dict'\"\n\n        # look for record in query\n        arg_2 = arg_0.get_query()\n        assert isinstance(arg_2, peewee.Query)\n\n        arg_2\n        return arg_2.get(**arg_1)", "path": "peewee_extras.py", "identifier": "ModelCRUD.retrieve", "docstring": "Retrieve items from query", "docstring_tokens": ["Retrieve", "items", "from", "query"], "nwo": "foxx/peewee-extras", "score": 0.36327422921566166, "idx": 258822}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/github/queryManager.py#L141-L168", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Submit a GitHub GraphQL query from a file.", "language": "python", "parameters": "(self, filePath, gitvars={}, verbosity=0, **kwargs)", "return_statement": "return self.queryGitHub(gitquery, gitvars=gitvars, verbosity=verbosity, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "0", ",", "**", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "_readGQL", "(", "arg_1", ",", "verbose", "=", "(", "arg_3", ">=", "0", ")", ")", "return", "arg_0", ".", "queryGitHub", "(", "arg_5", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2={}, arg_3=0, **arg_4):\n        \"\"\"Submit a GitHub GraphQL query from a file.\n\n        Can only be used with GraphQL queries.\n        For REST queries, see the 'queryGitHub' method.\n\n        Args:\n            filePath (str): A relative or absolute path to a file containing\n                a GraphQL query.\n                File may use comments and multi-line formatting.\n                .. _GitHub GraphQL Explorer:\n                   https://developer.github.com/v4/explorer/\n            gitvars (Optional[Dict]): All query variables.\n                Defaults to empty.\n                GraphQL Only.\n            verbosity (Optional[int]): Changes output verbosity levels.\n                If < 0, all extra printouts are suppressed.\n                If == 0, normal print statements are displayed.\n                If > 0, additional status print statements are displayed.\n                Defaults to 0.\n            **kwargs: Keyword arguments for the 'queryGitHub' method.\n\n        Returns:\n            Dict: A JSON style dictionary.\n\n        \"\"\"\n        arg_5 = arg_0._readGQL(arg_1, verbose=(arg_3 >= 0))\n        return arg_0.queryGitHub(arg_5, arg_2=arg_2, arg_3=arg_3, **arg_4)", "path": "scraper/github/queryManager.py", "identifier": "GitHubQueryManager.queryGitHubFromFile", "docstring": "Submit a GitHub GraphQL query from a file.\n\n        Can only be used with GraphQL queries.\n        For REST queries, see the 'queryGitHub' method.\n\n        Args:\n            filePath (str): A relative or absolute path to a file containing\n                a GraphQL query.\n                File may use comments and multi-line formatting.\n                .. _GitHub GraphQL Explorer:\n                   https://developer.github.com/v4/explorer/\n            gitvars (Optional[Dict]): All query variables.\n                Defaults to empty.\n                GraphQL Only.\n            verbosity (Optional[int]): Changes output verbosity levels.\n                If < 0, all extra printouts are suppressed.\n                If == 0, normal print statements are displayed.\n                If > 0, additional status print statements are displayed.\n                Defaults to 0.\n            **kwargs: Keyword arguments for the 'queryGitHub' method.\n\n        Returns:\n            Dict: A JSON style dictionary.", "docstring_tokens": ["Submit", "a", "GitHub", "GraphQL", "query", "from", "a", "file", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 258823}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L600-L615", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Takes a subscription sequence id and removes the subscription\n        from the client, optionally after receiving more than max_msgs.", "language": "python", "parameters": "(self, ssid, max_msgs=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "if", "arg_0", ".", "is_closed", ":", "raise", "ErrConnectionClosed", "if", "arg_0", ".", "is_draining", ":", "raise", "ErrConnectionDraining", "arg_0", ".", "_remove_sub", "(", "arg_1", ",", "arg_2", ")", "if", "not", "arg_0", ".", "is_reconnecting", ":", "yield", "from", "arg_0", ".", "auto_Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        \"\"\"\n        Takes a subscription sequence id and removes the subscription\n        from the client, optionally after receiving more than max_msgs.\n        \"\"\"\n        if arg_0.is_closed:\n            raise ErrConnectionClosed\n        if arg_0.is_draining:\n            raise ErrConnectionDraining\n\n        arg_0._remove_sub(arg_1, arg_2)\n\n        # We will send these for all subs when we reconnect anyway,\n        # so that we can suppress here.\n        if not arg_0.is_reconnecting:\n            yield from arg_0.auto_Func(arg_1, arg_2)", "path": "nats/aio/client.py", "identifier": "Client.unsubscribe", "docstring": "Takes a subscription sequence id and removes the subscription\n        from the client, optionally after receiving more than max_msgs.", "docstring_tokens": ["Takes", "a", "subscription", "sequence", "id", "and", "removes", "the", "subscription", "from", "the", "client", "optionally", "after", "receiving", "more", "than", "max_msgs", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 258824}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/policy_states_operations.py#L148-L227", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Summarizes policy states for the resources under the management group.", "language": "python", "parameters": "(\n            self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "**", "arg_5", ")", ":", "arg_6", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_6", "=", "arg_2", ".", "top", "arg_7", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_7", "=", "arg_2", ".", "from_property", "arg_8", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_8", "=", "arg_2", ".", "to", "arg_9", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_9", "=", "arg_2", ".", "filter", "arg_10", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_11", "=", "{", "'policyStatesSummaryResource'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.policy_states_summary_resource\"", ",", "arg_0", ".", "policy_states_summary_resource", ",", "'str'", ")", ",", "'managementGroupsNamespace'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.management_groups_namespace\"", ",", "arg_0", ".", "management_groups_namespace", ",", "'str'", ")", ",", "'managementGroupName'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"management_group_name\"", ",", "arg_1", ",", "'str'", ")", "}", "arg_10", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_10", ",", "**", "arg_11", ")", "arg_12", "=", "{", "}", "arg_12", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "if", "arg_6", "is", "not", "None", ":", "arg_12", "[", "'$top'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"top\"", ",", "arg_6", ",", "'int'", ",", "minimum", "=", "0", ")", "if", "arg_7", "is", "not", "None", ":", "arg_12", "[", "'$from'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"from_parameter\"", ",", "arg_7", ",", "'iso-8601'", ")", "if", "arg_8", "is", "not", "None", ":", "arg_12", "[", "'$to'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"to\"", ",", "arg_8", ",", "'iso-8601'", ")", "if", "arg_9", "is", "not", "None", ":", "arg_12", "[", "'$filter'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"filter\"", ",", "arg_9", ",", "'str'", ")", "arg_13", "=", "{", "}", "arg_13", "[", "'Accept'", "]", "=", "'application/json'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_13", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_3", ":", "arg_13", ".", "update", "(", "arg_3", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_13", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_14", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_10", ",", "arg_12", ",", "arg_13", ")", "arg_15", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_14", ",", "stream", "=", "False", ",", "**", "arg_5", ")", "if", "arg_15", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "QueryFailureException", "(", "arg_0", ".", "_deserialize", ",", "arg_15", ")", "arg_16", "=", "None", "if", "arg_15", ".", "status_code", "==", "200", ":", "arg_16", "=", "arg_0", ".", "_deserialize", "(", "'SummarizeResults'", ",", "arg_15", ")", "if", "arg_4", ":", "arg_17", "=", "ClientRawResponse", "(", "arg_16", ",", "arg_15", ")", "return", "arg_17", "return", "arg_16"], "function": "def Func(\n            arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False, **arg_5):\n        \"\"\"Summarizes policy states for the resources under the management group.\n\n        :param management_group_name: Management group name.\n        :type management_group_name: str\n        :param query_options: Additional parameters for the operation\n        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: SummarizeResults or ClientRawResponse if raw=true\n        :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`\n        \"\"\"\n        arg_6 = None\n        if arg_2 is not None:\n            arg_6 = arg_2.top\n        arg_7 = None\n        if arg_2 is not None:\n            arg_7 = arg_2.from_property\n        arg_8 = None\n        if arg_2 is not None:\n            arg_8 = arg_2.to\n        arg_9 = None\n        if arg_2 is not None:\n            arg_9 = arg_2.filter\n\n        # Construct URL\n        arg_10 = arg_0.Func.metadata['url']\n        arg_11 = {\n            'policyStatesSummaryResource': arg_0._serialize.url(\"self.policy_states_summary_resource\", arg_0.policy_states_summary_resource, 'str'),\n            'managementGroupsNamespace': arg_0._serialize.url(\"self.management_groups_namespace\", arg_0.management_groups_namespace, 'str'),\n            'managementGroupName': arg_0._serialize.url(\"management_group_name\", arg_1, 'str')\n        }\n        arg_10 = arg_0._client.format_url(arg_10, **arg_11)\n\n        # Construct parameters\n        arg_12 = {}\n        arg_12['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n        if arg_6 is not None:\n            arg_12['$top'] = arg_0._serialize.query(\"top\", arg_6, 'int', minimum=0)\n        if arg_7 is not None:\n            arg_12['$from'] = arg_0._serialize.query(\"from_parameter\", arg_7, 'iso-8601')\n        if arg_8 is not None:\n            arg_12['$to'] = arg_0._serialize.query(\"to\", arg_8, 'iso-8601')\n        if arg_9 is not None:\n            arg_12['$filter'] = arg_0._serialize.query(\"filter\", arg_9, 'str')\n\n        # Construct headers\n        arg_13 = {}\n        arg_13['Accept'] = 'application/json'\n        if arg_0.config.generate_client_request_id:\n            arg_13['x-ms-client-request-id'] = str(uuid.uuid1())\n        if arg_3:\n            arg_13.update(arg_3)\n        if arg_0.config.accept_language is not None:\n            arg_13['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n        # Construct and send request\n        arg_14 = arg_0._client.post(arg_10, arg_12, arg_13)\n        arg_15 = arg_0._client.send(arg_14, stream=False, **arg_5)\n\n        if arg_15.status_code not in [200]:\n            raise models.QueryFailureException(arg_0._deserialize, arg_15)\n\n        arg_16 = None\n\n        if arg_15.status_code == 200:\n            arg_16 = arg_0._deserialize('SummarizeResults', arg_15)\n\n        if arg_4:\n            arg_17 = ClientRawResponse(arg_16, arg_15)\n            return arg_17\n\n        return arg_16", "path": "azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/policy_states_operations.py", "identifier": "PolicyStatesOperations.summarize_for_management_group", "docstring": "Summarizes policy states for the resources under the management group.\n\n        :param management_group_name: Management group name.\n        :type management_group_name: str\n        :param query_options: Additional parameters for the operation\n        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: SummarizeResults or ClientRawResponse if raw=true\n        :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`", "docstring_tokens": ["Summarizes", "policy", "states", "for", "the", "resources", "under", "the", "management", "group", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258825}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2phynex.py#L213-L224", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Make phylip and nexus formats. This is hackish since I'm recycling the \n    code whole-hog from pyrad V3. Probably could be good to go back through \n    and clean up the conversion code some time.", "language": "python", "parameters": "(assembly, samples)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "max", "(", "[", "len", "(", "i", ")", "for", "i", "in", "arg_0", ".", "samples", ".", "keys", "(", ")", "]", ")", "arg_3", "=", "[", "i", ".", "name", "for", "i", "in", "arg_1", "]", "arg_4", "=", "Funcphy", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "Funcnex", "(", "arg_0", ",", "arg_3", ",", "arg_2", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Make phylip and nexus formats. This is hackish since I'm recycling the \n    code whole-hog from pyrad V3. Probably could be good to go back through \n    and clean up the conversion code some time.\n    \"\"\"\n\n    ## get the longest name\n    arg_2 = max([len(i) for i in arg_0.samples.keys()])\n    arg_3 = [i.name for i in arg_1]\n\n    arg_4 = Funcphy(arg_0, arg_1, arg_2)\n    Funcnex(arg_0, arg_3, arg_2, arg_4)", "path": "ipyrad/file_conversion/loci2phynex.py", "identifier": "make", "docstring": "Make phylip and nexus formats. This is hackish since I'm recycling the \n    code whole-hog from pyrad V3. Probably could be good to go back through \n    and clean up the conversion code some time.", "docstring_tokens": ["Make", "phylip", "and", "nexus", "formats", ".", "This", "is", "hackish", "since", "I", "m", "recycling", "the", "code", "whole", "-", "hog", "from", "pyrad", "V3", ".", "Probably", "could", "be", "good", "to", "go", "back", "through", "and", "clean", "up", "the", "conversion", "code", "some", "time", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 258826}
{"url": "https://github.com/umich-brcf-bioinf/Jacquard/blob/83dd61dd2b5e4110468493beec7bc121e6cb3cd1/jacquard/variant_caller_transforms/strelka.py#L296-L314", "sha": "83dd61dd2b5e4110468493beec7bc121e6cb3cd1", "docstring_summary": "Recognizes and claims Strelka VCFs form the set of all input VCFs.", "language": "python", "parameters": "(self, file_readers)", "return_statement": "return (unclaimed_readers, vcf_readers)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "(", "arg_2", ",", "arg_3", ")", "=", "arg_0", ".", "_find_strelka_files", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "_split_prefix_by_patient", "(", "arg_2", ")", "arg_0", ".", "_validate_vcf_readers", "(", "arg_4", ")", "arg_5", "=", "arg_0", ".", "_create_vcf_readers", "(", "arg_2", ")", "return", "(", "arg_3", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Recognizes and Funcs Strelka VCFs form the set of all input VCFs.\n\n        Each defined caller has a chance to evaluate and Func all the incoming\n        files as something that it can process.\n\n        Args:\n            file_readers: the collection of currently unFunced files\n\n        Returns:\n            A tuple of unFunced readers and StrelkaVcfReaders.\n        \"\"\"\n        (arg_2,\n         arg_3) = arg_0._find_strelka_files(arg_1)\n        arg_4 = arg_0._split_prefix_by_patient(arg_2)\n        arg_0._validate_vcf_readers(arg_4)\n        arg_5 = arg_0._create_vcf_readers(arg_2)\n\n        return (arg_3, arg_5)", "path": "jacquard/variant_caller_transforms/strelka.py", "identifier": "Strelka.claim", "docstring": "Recognizes and claims Strelka VCFs form the set of all input VCFs.\n\n        Each defined caller has a chance to evaluate and claim all the incoming\n        files as something that it can process.\n\n        Args:\n            file_readers: the collection of currently unclaimed files\n\n        Returns:\n            A tuple of unclaimed readers and StrelkaVcfReaders.", "docstring_tokens": ["Recognizes", "and", "claims", "Strelka", "VCFs", "form", "the", "set", "of", "all", "input", "VCFs", "."], "nwo": "umich-brcf-bioinf/Jacquard", "score": 0.27831918678159157, "idx": 258827}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L49-L53", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "get a collection, if it exists, otherwise return None.", "language": "python", "parameters": "(self, name)", "return_statement": "return Collection.query.filter(Collection.name == name).first()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "sregistry", ".", "database", ".", "models", "import", "Collection", "return", "Collection", ".", "query", ".", "filter", "(", "Collection", ".", "name", "==", "arg_1", ")", ".", "first", "(", ")"], "function": "def Func(arg_0, arg_1):\n    '''get a collection, if it exists, otherwise return None.\n    '''\n    from sregistry.database.models import Collection\n    return Collection.query.filter(Collection.name == arg_1).first()", "path": "sregistry/database/sqlite.py", "identifier": "get_collection", "docstring": "get a collection, if it exists, otherwise return None.", "docstring_tokens": ["get", "a", "collection", "if", "it", "exists", "otherwise", "return", "None", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 258828}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/convert.py#L96-L161", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Converts in_file to out_file, guessing datatype in the absence of\n    in_fmt and out_fmt.", "language": "python", "parameters": "(in_file, out_file, in_fmt=\"\", out_fmt=\"\")", "return_statement": "return _fail_pair_conversion(in_fmt, out_fmt)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"\"", ",", "arg_3", "=", "\"\"", ")", ":", "arg_0", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", "arg_1", "=", "os", ".", "path", ".", "expanduser", "(", "arg_1", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "raise", "IOError", "(", "\"Input file {0} does not exist, stopping...\"", ".", "format", "(", "arg_0", ")", ")", "arg_2", "=", "arg_2", ".", "lower", "(", ")", "or", "_guess_format_from_extension", "(", "arg_0", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ".", "lower", "(", ")", ")", "arg_3", "=", "arg_3", ".", "lower", "(", ")", "or", "_guess_format_from_extension", "(", "arg_1", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ".", "lower", "(", ")", ")", "if", "not", "arg_2", "or", "not", "arg_3", ":", "raise", "ValueError", "(", "\"Cannot determine conversion formats.\"", ")", "return", "False", "if", "arg_2", "is", "arg_3", ":", "shutil", ".", "copyfileobj", "(", "arg_0", ",", "arg_1", ")", "return", "arg_1", "if", "arg_2", "==", "'hdf5'", ":", "from", ".", "import", "hdf5", "arg_4", "=", "hdf5", ".", "load", "(", "arg_0", ")", "elif", "arg_2", "==", "'tiff'", ":", "from", ".", "import", "tiff", "arg_4", "=", "tiff", ".", "load", "(", "arg_0", ")", "elif", "arg_2", "==", "'png'", ":", "from", ".", "import", "png", "arg_4", "=", "png", ".", "load", "(", "arg_0", ")", "else", ":", "return", "_fail_pair_conversion", "(", "arg_2", ",", "arg_3", ")", "if", "arg_3", "==", "'hdf5'", ":", "from", ".", "import", "hdf5", "return", "hdf5", ".", "save", "(", "arg_1", ",", "arg_4", ")", "elif", "arg_3", "==", "'tiff'", ":", "from", ".", "import", "tiff", "return", "tiff", ".", "save", "(", "arg_1", ",", "arg_4", ")", "elif", "arg_3", "==", "'png'", ":", "from", ".", "import", "png", "return", "png", ".", "export_png", "(", "arg_1", ",", "arg_4", ")", "else", ":", "return", "_fail_pair_conversion", "(", "arg_2", ",", "arg_3", ")", "return", "_fail_pair_conversion", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=\"\", arg_3=\"\"):\n    \"\"\"\n    Converts in_file to out_file, guessing datatype in the absence of\n    in_fmt and out_fmt.\n\n    Arguments:\n        in_file:    The name of the (existing) datafile to read\n        out_file:   The name of the file to create with Funced data\n        in_fmt:     Optional. The format of incoming data, if not guessable\n        out_fmt:    Optional. The format of outgoing data, if not guessable\n\n    Returns:\n        String. Output filename\n    \"\"\"\n    # First verify that in_file exists and out_file doesn't.\n    arg_0 = os.path.expanduser(arg_0)\n    arg_1 = os.path.expanduser(arg_1)\n\n    if not os.path.exists(arg_0):\n        raise IOError(\"Input file {0} does not exist, stopping...\"\n                      .format(arg_0))\n\n    # Get formats, either by explicitly naming them or by guessing.\n    # TODO: It'd be neat to check here if an explicit fmt matches the guess.\n    arg_2 = arg_2.lower() or _guess_format_from_extension(\n        arg_0.split('.')[-1].lower())\n    arg_3 = arg_3.lower() or _guess_format_from_extension(\n        arg_1.split('.')[-1].lower())\n\n    if not arg_2 or not arg_3:\n        raise ValueError(\"Cannot determine conversion formats.\")\n        return False\n\n    if arg_2 is arg_3:\n        # This is the case when this module (intended for LONI) is used\n        # indescriminately to 'funnel' data into one format.\n        shutil.copyfileobj(arg_0, arg_1)\n        return arg_1\n\n    # Import\n    if arg_2 == 'hdf5':\n        from . import hdf5\n        arg_4 = hdf5.load(arg_0)\n    elif arg_2 == 'tiff':\n        from . import tiff\n        arg_4 = tiff.load(arg_0)\n    elif arg_2 == 'png':\n        from . import png\n        arg_4 = png.load(arg_0)\n    else:\n        return _fail_pair_conversion(arg_2, arg_3)\n\n    # Export\n    if arg_3 == 'hdf5':\n        from . import hdf5\n        return hdf5.save(arg_1, arg_4)\n    elif arg_3 == 'tiff':\n        from . import tiff\n        return tiff.save(arg_1, arg_4)\n    elif arg_3 == 'png':\n        from . import png\n        return png.export_png(arg_1, arg_4)\n    else:\n        return _fail_pair_conversion(arg_2, arg_3)\n\n    return _fail_pair_conversion(arg_2, arg_3)", "path": "ndio/convert/convert.py", "identifier": "convert", "docstring": "Converts in_file to out_file, guessing datatype in the absence of\n    in_fmt and out_fmt.\n\n    Arguments:\n        in_file:    The name of the (existing) datafile to read\n        out_file:   The name of the file to create with converted data\n        in_fmt:     Optional. The format of incoming data, if not guessable\n        out_fmt:    Optional. The format of outgoing data, if not guessable\n\n    Returns:\n        String. Output filename", "docstring_tokens": ["Converts", "in_file", "to", "out_file", "guessing", "datatype", "in", "the", "absence", "of", "in_fmt", "and", "out_fmt", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 258829}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/utils.py#L183-L192", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "Like assert_all_finite, but only for ndarray.", "language": "python", "parameters": "(X)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "np", ".", "asanyarray", "(", "arg_0", ")", "if", "(", "arg_0", ".", "dtype", ".", "char", "in", "np", ".", "typecodes", "[", "'AllFloat'", "]", "and", "not", "np", ".", "isfinite", "(", "arg_0", ".", "sum", "(", ")", ")", "and", "not", "np", ".", "isfinite", "(", "arg_0", ")", ".", "all", "(", ")", ")", ":", "raise", "ValueError", "(", "\"Input contains NaN, infinity\"", "\" or a value too large for %r.\"", "%", "arg_0", ".", "dtype", ")"], "function": "def Func(arg_0):\n    \"\"\"Like assert_all_finite, but only for ndarray.\"\"\"\n    arg_0 = np.asanyarray(arg_0)\n    # First try an O(n) time, O(1) space solution for the common case that\n    # everything is finite; fall back to O(n) space np.isfinite to prevent\n    # false positives from overflow in sum method\n    if (arg_0.dtype.char in np.typecodes['AllFloat'] and\n            not np.isfinite(arg_0.sum()) and not np.isfinite(arg_0).all()):\n        raise ValueError(\"Input contains NaN, infinity\"\n                         \" or a value too large for %r.\" % arg_0.dtype)", "path": "osprey/utils.py", "identifier": "_assert_all_finite", "docstring": "Like assert_all_finite, but only for ndarray.", "docstring_tokens": ["Like", "assert_all_finite", "but", "only", "for", "ndarray", "."], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 258830}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/contrib/event_builders.py#L49-L63", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Build a record-view event.", "language": "python", "parameters": "(event, sender_app, pid=None, record=None,\n                              **kwargs)", "return_statement": "return event", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "arg_0", ".", "update", "(", "dict", "(", "timestamp", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "isoformat", "(", ")", ",", "record_id", "=", "str", "(", "arg_3", ".", "id", ")", ",", "pid_type", "=", "arg_2", ".", "pid_type", ",", "pid_value", "=", "str", "(", "arg_2", ".", "pid_value", ")", ",", "referrer", "=", "request", ".", "referrer", ",", "**", "get_user", "(", ")", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                              **arg_4):\n    \"\"\"Build a record-view event.\"\"\"\n    arg_0.update(dict(\n        # When:\n        timestamp=datetime.datetime.utcnow().isoformat(),\n        # What:\n        record_id=str(arg_3.id),\n        pid_type=arg_2.pid_type,\n        pid_value=str(arg_2.pid_value),\n        referrer=request.referrer,\n        # Who:\n        **get_user()\n    ))\n    return arg_0", "path": "invenio_stats/contrib/event_builders.py", "identifier": "record_view_event_builder", "docstring": "Build a record-view event.", "docstring_tokens": ["Build", "a", "record", "-", "view", "event", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 258831}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L323-L327", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "The estimated signal-to-noise_maps mappers of the image.", "language": "python", "parameters": "(self)", "return_statement": "return signal_to_noise_map", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "np", ".", "divide", "(", "arg_0", ".", "image", ",", "arg_0", ".", "noise_map", ")", "Func", "[", "Func", "<", "0", "]", "=", "0", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"The estimated signal-to-noise_maps mappers of the image.\"\"\"\n        Func = np.divide(arg_0.image, arg_0.noise_map)\n        Func[Func < 0] = 0\n        return Func", "path": "autolens/data/ccd.py", "identifier": "CCDData.signal_to_noise_map", "docstring": "The estimated signal-to-noise_maps mappers of the image.", "docstring_tokens": ["The", "estimated", "signal", "-", "to", "-", "noise_maps", "mappers", "of", "the", "image", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 258832}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/timers/music.py#L59-L66", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Get the current position in the music in seconds", "language": "python", "parameters": "(self)", "return_statement": "return mixer.music.get_pos() / 1000.0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "float", ":", "if", "arg_0", ".", "paused", ":", "return", "arg_0", ".", "pause_time", "return", "mixer", ".", "music", ".", "get_pos", "(", ")", "/", "1000.0"], "function": "def Func(arg_0) -> float:\n        \"\"\"\n        Get the current position in the music in seconds\n        \"\"\"\n        if arg_0.paused:\n            return arg_0.pause_time\n\n        return mixer.music.get_pos() / 1000.0", "path": "demosys/timers/music.py", "identifier": "Timer.get_time", "docstring": "Get the current position in the music in seconds", "docstring_tokens": ["Get", "the", "current", "position", "in", "the", "music", "in", "seconds"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 258833}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/from_cds.py#L173-L189", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Special handling if record is a CMS NOTE.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "record_get_field_values", "(", "arg_0", ".", "record", ",", "'690'", ",", "filter_subfield_code", "=", "\"a\"", ",", "filter_subfield_value", "=", "'INTNOTE'", ")", "if", "arg_1", ":", "arg_2", "=", "record_get_field_values", "(", "arg_0", ".", "record", ",", "tag", "=", "'088'", ",", "filter_subfield_code", "=", "\"a\"", ")", "for", "arg_3", "in", "arg_2", ":", "if", "'CMS'", "in", "arg_3", ":", "arg_4", "=", "(", "'http://weblib.cern.ch/abstract?CERN-CMS'", "+", "arg_3", ".", "split", "(", "'CMS'", ",", "1", ")", "[", "-", "1", "]", ")", "record_add_field", "(", "arg_0", ".", "record", ",", "tag", "=", "'856'", ",", "ind1", "=", "'4'", ",", "subfields", "=", "[", "(", "'u'", ",", "arg_4", ")", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"Special handling if record is a CMS NOTE.\"\"\"\n        arg_1 = record_get_field_values(arg_0.record, '690',\n                                          filter_subfield_code=\"a\",\n                                          filter_subfield_value='INTNOTE')\n        if arg_1:\n            arg_2 = record_get_field_values(arg_0.record,\n                                              tag='088',\n                                              filter_subfield_code=\"a\")\n            for arg_3 in arg_2:\n                if 'CMS' in arg_3:\n                    arg_4 = ('http://weblib.cern.ch/abstract?CERN-CMS' +\n                           arg_3.split('CMS', 1)[-1])\n                    record_add_field(arg_0.record,\n                                     tag='856',\n                                     ind1='4',\n                                     subfields=[('u', arg_4)])", "path": "harvestingkit/inspire_cds_package/from_cds.py", "identifier": "CDS2Inspire.add_cms_link", "docstring": "Special handling if record is a CMS NOTE.", "docstring_tokens": ["Special", "handling", "if", "record", "is", "a", "CMS", "NOTE", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 258834}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/bounds.py#L73-L126", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Rescale numeric vector to have specified minimum, midpoint,\n    and maximum.", "language": "python", "parameters": "(x, to=(0, 1), _from=None, mid=0)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", "0", ",", "1", ")", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ")", ":", "arg_4", "=", "True", "try", ":", "len", "(", "arg_0", ")", "except", "TypeError", ":", "arg_4", "=", "False", "arg_0", "=", "[", "arg_0", "]", "if", "not", "hasattr", "(", "arg_0", ",", "'dtype'", ")", ":", "arg_0", "=", "np", ".", "asarray", "(", "arg_0", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "np", ".", "array", "(", "[", "np", ".", "min", "(", "arg_0", ")", ",", "np", ".", "max", "(", "arg_0", ")", "]", ")", "else", ":", "arg_2", "=", "np", ".", "asarray", "(", "arg_2", ")", "if", "(", "zero_range", "(", "arg_2", ")", "or", "zero_range", "(", "arg_1", ")", ")", ":", "arg_5", "=", "np", ".", "repeat", "(", "np", ".", "mean", "(", "arg_1", ")", ",", "len", "(", "arg_0", ")", ")", "else", ":", "arg_6", "=", "2", "*", "np", ".", "max", "(", "np", ".", "abs", "(", "arg_2", "-", "arg_3", ")", ")", "arg_5", "=", "(", "arg_0", "-", "arg_3", ")", "/", "arg_6", "*", "np", ".", "diff", "(", "arg_1", ")", "+", "np", ".", "mean", "(", "arg_1", ")", "if", "not", "arg_4", ":", "arg_5", "=", "arg_5", "[", "0", "]", "return", "arg_5"], "function": "def Func(arg_0, arg_1=(0, 1), arg_2=None, arg_3=0):\n    \"\"\"\n    Rescale numeric vector to have specified minimum, midpoint,\n    and maximum.\n\n    Parameters\n    ----------\n    x : array_like | numeric\n        1D vector of values to manipulate.\n    to : tuple\n        output range (numeric vector of length two)\n    _from : tuple\n        input range (numeric vector of length two).\n        If not given, is calculated from the range of x\n    mid\t: numeric\n        mid-point of input range\n\n    Returns\n    -------\n    out : array_like\n        Rescaled values\n\n    Examples\n    --------\n    >>> Func([1, 2, 3], mid=1)\n    array([0.5 , 0.75, 1.  ])\n    >>> Func([1, 2, 3], mid=2)\n    array([0. , 0.5, 1. ])\n    \"\"\"\n    arg_4 = True\n\n    try:\n        len(arg_0)\n    except TypeError:\n        arg_4 = False\n        arg_0 = [arg_0]\n\n    if not hasattr(arg_0, 'dtype'):\n        arg_0 = np.asarray(arg_0)\n\n    if arg_2 is None:\n        arg_2 = np.array([np.min(arg_0), np.max(arg_0)])\n    else:\n        arg_2 = np.asarray(arg_2)\n\n    if (zero_range(arg_2) or zero_range(arg_1)):\n        arg_5 = np.repeat(np.mean(arg_1), len(arg_0))\n    else:\n        arg_6 = 2 * np.max(np.abs(arg_2 - arg_3))\n        arg_5 = (arg_0 - arg_3) / arg_6 * np.diff(arg_1) + np.mean(arg_1)\n\n    if not arg_4:\n        arg_5 = arg_5[0]\n    return arg_5", "path": "mizani/bounds.py", "identifier": "rescale_mid", "docstring": "Rescale numeric vector to have specified minimum, midpoint,\n    and maximum.\n\n    Parameters\n    ----------\n    x : array_like | numeric\n        1D vector of values to manipulate.\n    to : tuple\n        output range (numeric vector of length two)\n    _from : tuple\n        input range (numeric vector of length two).\n        If not given, is calculated from the range of x\n    mid\t: numeric\n        mid-point of input range\n\n    Returns\n    -------\n    out : array_like\n        Rescaled values\n\n    Examples\n    --------\n    >>> rescale_mid([1, 2, 3], mid=1)\n    array([0.5 , 0.75, 1.  ])\n    >>> rescale_mid([1, 2, 3], mid=2)\n    array([0. , 0.5, 1. ])", "docstring_tokens": ["Rescale", "numeric", "vector", "to", "have", "specified", "minimum", "midpoint", "and", "maximum", "."], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 258835}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L913-L931", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Write data to blimpy file.", "language": "python", "parameters": "(self, filename_out)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "(", "\"[Filterbank] Warning: Non-standard function to write in filterbank (.fil) format. Please use Waterfall.\"", ")", "arg_2", "=", "int", "(", "arg_0", ".", "header", "[", "b'nbits'", "]", "/", "8", ")", "with", "open", "(", "arg_1", ",", "\"wb\"", ")", "as", "fileh", ":", "fileh", ".", "write", "(", "generate_sigproc_header", "(", "arg_0", ")", ")", "arg_3", "=", "arg_0", ".", "data", "if", "arg_2", "==", "4", ":", "np", ".", "float32", "(", "arg_3", ".", "ravel", "(", ")", ")", ".", "tofile", "(", "fileh", ")", "elif", "arg_2", "==", "2", ":", "np", ".", "int16", "(", "arg_3", ".", "ravel", "(", ")", ")", ".", "tofile", "(", "fileh", ")", "elif", "arg_2", "==", "1", ":", "np", ".", "int8", "(", "arg_3", ".", "ravel", "(", ")", ")", ".", "tofile", "(", "fileh", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Write data to blimpy file.\n\n        Args:\n            filename_out (str): Name of output file\n        \"\"\"\n\n        print(\"[Filterbank] Warning: Non-standard function to write in filterbank (.fil) format. Please use Waterfall.\")\n\n        arg_2  = int(arg_0.header[b'nbits'] / 8)\n        with open(arg_1, \"wb\") as fileh:\n            fileh.write(generate_sigproc_header(arg_0))\n            arg_3 = arg_0.data\n            if arg_2 == 4:\n                np.float32(arg_3.ravel()).tofile(fileh)\n            elif arg_2 == 2:\n                np.int16(arg_3.ravel()).tofile(fileh)\n            elif arg_2 == 1:\n                np.int8(arg_3.ravel()).tofile(fileh)", "path": "blimpy/filterbank.py", "identifier": "Filterbank.write_to_filterbank", "docstring": "Write data to blimpy file.\n\n        Args:\n            filename_out (str): Name of output file", "docstring_tokens": ["Write", "data", "to", "blimpy", "file", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 258836}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/node_properties.py#L92-L101", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Returns a set of all ABUNDANCE nodes that have an causal out-degree of 0.", "language": "python", "parameters": "(graph: BELGraph, func)", "return_statement": "return {\n        node\n        for node in graph\n        if node.function == func and is_causal_sink(graph, node)\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ")", "->", "Set", "[", "BaseEntity", "]", ":", "return", "{", "arg_3", "for", "arg_3", "in", "arg_0", "if", "arg_3", ".", "function", "==", "arg_2", "and", "is_causal_sink", "(", "arg_0", ",", "arg_3", ")", "}"], "function": "def Func(arg_0: arg_1, arg_2) -> Set[BaseEntity]:\n    \"\"\"Returns a set of all ABUNDANCE nodes that have an causal out-degree of 0.\n\n    This likely means that the knowledge assembly is incomplete, or there is a curation error.\n    \"\"\"\n    return {\n        arg_3\n        for arg_3 in arg_0\n        if arg_3.function == arg_2 and is_causal_sink(arg_0, arg_3)\n    }", "path": "src/pybel_tools/summary/node_properties.py", "identifier": "get_causal_sink_nodes", "docstring": "Returns a set of all ABUNDANCE nodes that have an causal out-degree of 0.\n\n    This likely means that the knowledge assembly is incomplete, or there is a curation error.", "docstring_tokens": ["Returns", "a", "set", "of", "all", "ABUNDANCE", "nodes", "that", "have", "an", "causal", "out", "-", "degree", "of", "0", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 258837}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L336-L363", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Remove the given notification template.", "language": "python", "parameters": "(self, pk=None, fail_on_missing=False, **kwargs)", "return_statement": "return super(Resource, self).\\\n            delete(pk=pk, fail_on_missing=fail_on_missing, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "arg_0", ".", "_separate", "(", "arg_3", ")", "return", "super", "(", "Resource", ",", "arg_0", ")", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False, **arg_3):\n        \"\"\"Remove the given notification template.\n\n        Note here configuration-related fields like\n        'notification_configuration' and 'channels' will not be\n        used even provided.\n\n        If `fail_on_missing` is True, then the object's not being found is\n        considered a failure; otherwise, a success with no change is reported.\n\n        =====API DOCS=====\n        Remove the given object.\n\n        :param pk: Primary key of the resource to be Funcd.\n        :type pk: int\n        :param fail_on_missing: Flag that if set, the object's not being found is considered a failure; otherwise,\n                                a success with no change is reported.\n        :type fail_on_missing: bool\n        :param `**kwargs`: Keyword arguments used to look up resource object to Func if ``pk`` is not provided.\n        :returns: dictionary of only one field \"changed\", which is a flag indicating whether the specified resource\n                  is successfully Funcd.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        arg_0._separate(arg_3)\n        return super(Resource, arg_0).\\\n            Func(arg_1=arg_1, arg_2=arg_2, **arg_3)", "path": "tower_cli/resources/notification_template.py", "identifier": "Resource.delete", "docstring": "Remove the given notification template.\n\n        Note here configuration-related fields like\n        'notification_configuration' and 'channels' will not be\n        used even provided.\n\n        If `fail_on_missing` is True, then the object's not being found is\n        considered a failure; otherwise, a success with no change is reported.\n\n        =====API DOCS=====\n        Remove the given object.\n\n        :param pk: Primary key of the resource to be deleted.\n        :type pk: int\n        :param fail_on_missing: Flag that if set, the object's not being found is considered a failure; otherwise,\n                                a success with no change is reported.\n        :type fail_on_missing: bool\n        :param `**kwargs`: Keyword arguments used to look up resource object to delete if ``pk`` is not provided.\n        :returns: dictionary of only one field \"changed\", which is a flag indicating whether the specified resource\n                  is successfully deleted.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Remove", "the", "given", "notification", "template", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 258838}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L846-L938", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Add the currently tested element into the database.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_authorization", "(", ")", ":", "if", "arg_0", ".", "epoch", "<", "int", "(", "arg_2", ".", "time", "(", ")", ")", ":", "arg_1", "=", "\"past\"", "else", ":", "arg_1", "=", "\"future\"", "if", "arg_0", ".", "is_in_database", "(", ")", ":", "if", "(", "str", "(", "arg_0", ".", "epoch", ")", "!=", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_2", ".", "INTERN", "[", "\"to_test\"", "]", "]", "[", "\"epoch\"", "]", ")", ":", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_2", ".", "INTERN", "[", "\"to_test\"", "]", "]", ".", "update", "(", "{", "\"epoch\"", ":", "str", "(", "arg_0", ".", "epoch", ")", ",", "\"state\"", ":", "arg_1", ",", "\"expiration_date\"", ":", "arg_0", ".", "expiration_date", ",", "}", ")", "elif", "arg_0", ".", "is_time_older", "(", ")", ":", "if", "(", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_2", ".", "INTERN", "[", "\"to_test\"", "]", "]", "[", "\"state\"", "]", "!=", "\"past\"", ")", ":", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_2", ".", "INTERN", "[", "\"to_test\"", "]", "]", ".", "update", "(", "{", "\"state\"", ":", "\"past\"", "}", ")", "elif", "(", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_2", ".", "INTERN", "[", "\"to_test\"", "]", "]", "[", "\"state\"", "]", "!=", "\"future\"", ")", ":", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_2", ".", "INTERN", "[", "\"to_test\"", "]", "]", ".", "update", "(", "{", "\"state\"", ":", "\"future\"", "}", ")", "else", ":", "if", "(", "not", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "in", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", ")", ":", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "=", "{", "}", "arg_2", ".", "INTERN", "[", "\"whois_db\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", ".", "update", "(", "{", "arg_2", ".", "INTERN", "[", "\"to_test\"", "]", ":", "{", "\"epoch\"", ":", "str", "(", "arg_0", ".", "epoch", ")", ",", "\"state\"", ":", "arg_1", ",", "\"expiration_date\"", ":", "arg_0", ".", "expiration_date", ",", "}", "}", ")", "arg_0", ".", "_backup", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Add the currently tested element into the database.\n        \"\"\"\n\n        if arg_0._authorization():\n            # We are authorized to work.\n\n            if arg_0.epoch < int(arg_2.time()):\n                arg_1 = \"past\"\n            else:\n                arg_1 = \"future\"\n\n            if arg_0.is_in_database():\n                # The element we are working with is in the database.\n\n                if (\n                    str(arg_0.epoch)\n                    != arg_2.INTERN[\"whois_db\"][arg_2.INTERN[\"file_to_test\"]][\n                        arg_2.INTERN[\"to_test\"]\n                    ][\"epoch\"]\n                ):\n                    # The given epoch is diffent from the one saved.\n\n                    # We update it.\n                    arg_2.INTERN[\"whois_db\"][arg_2.INTERN[\"file_to_test\"]][\n                        arg_2.INTERN[\"to_test\"]\n                    ].update(\n                        {\n                            \"epoch\": str(arg_0.epoch),\n                            \"state\": arg_1,\n                            \"expiration_date\": arg_0.expiration_date,\n                        }\n                    )\n\n                elif arg_0.is_time_older():\n                    # The expiration date from the database is in the past.\n\n                    if (\n                        arg_2.INTERN[\"whois_db\"][\n                            arg_2.INTERN[\"file_to_test\"]\n                        ][arg_2.INTERN[\"to_test\"]][\"state\"]\n                        != \"past\"\n                    ):  # pragma: no cover\n                        # The state of the element in the datbase is not\n                        # equal to `past`.\n\n                        # We update it to `past`.\n                        arg_2.INTERN[\"whois_db\"][\n                            arg_2.INTERN[\"file_to_test\"]\n                        ][arg_2.INTERN[\"to_test\"]].update({\"state\": \"past\"})\n                elif (\n                    arg_2.INTERN[\"whois_db\"][arg_2.INTERN[\"file_to_test\"]][\n                        arg_2.INTERN[\"to_test\"]\n                    ][\"state\"]\n                    != \"future\"\n                ):\n                    # * The expiration date from the database is in the future.\n                    # and\n                    # * The state of the element in the database is not\n                    # equal to `future`.\n\n                    # We update it to `future`.\n                    arg_2.INTERN[\"whois_db\"][arg_2.INTERN[\"file_to_test\"]][\n                        arg_2.INTERN[\"to_test\"]\n                    ].update({\"state\": \"future\"})\n            else:\n                # The element we are working with is not in the database.\n\n                if (\n                    not arg_2.INTERN[\"file_to_test\"]\n                    in arg_2.INTERN[\"whois_db\"]\n                ):\n                    # The file path is not in the database.\n\n                    # We initiate it.\n                    arg_2.INTERN[\"whois_db\"][\n                        arg_2.INTERN[\"file_to_test\"]\n                    ] = {}\n\n                # We create the first dataset.\n                arg_2.INTERN[\"whois_db\"][arg_2.INTERN[\"file_to_test\"]].update(\n                    {\n                        arg_2.INTERN[\"to_test\"]: {\n                            \"epoch\": str(arg_0.epoch),\n                            \"state\": arg_1,\n                            \"expiration_date\": arg_0.expiration_date,\n                        }\n                    }\n                )\n\n            # We do a safety backup of our database.\n            arg_0._backup()", "path": "PyFunceble/database.py", "identifier": "Whois.add", "docstring": "Add the currently tested element into the database.", "docstring_tokens": ["Add", "the", "currently", "tested", "element", "into", "the", "database", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 258839}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L167-L180", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Set the node of the item.", "language": "python", "parameters": "(self,node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "if", "arg_0", ".", "xmlnode", ".", "hasProp", "(", "\"node\"", ")", ":", "arg_0", ".", "xmlnode", ".", "unsetProp", "(", "\"node\"", ")", "return", "arg_1", "=", "unicode", "(", "arg_1", ")", "arg_0", ".", "xmlnode", ".", "setProp", "(", "\"node\"", ",", "arg_1", ".", "encode", "(", "\"utf-8\"", ")", ")"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Set the node of the item.\n\n        :Parameters:\n            - `node`: the new node or `None`.\n        :Types:\n            - `node`: `unicode`\n        \"\"\"\n        if arg_1 is None:\n            if arg_0.xmlnode.hasProp(\"node\"):\n                arg_0.xmlnode.unsetProp(\"node\")\n            return\n        arg_1 = unicode(arg_1)\n        arg_0.xmlnode.setProp(\"node\", arg_1.encode(\"utf-8\"))", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoItem.set_node", "docstring": "Set the node of the item.\n\n        :Parameters:\n            - `node`: the new node or `None`.\n        :Types:\n            - `node`: `unicode`", "docstring_tokens": ["Set", "the", "node", "of", "the", "item", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258840}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/pgmanager.py#L264-L280", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Build a file model from database record.", "language": "python", "parameters": "(self, record, content, format)", "return_statement": "return model", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "to_api_path", "(", "arg_1", "[", "'parent_name'", "]", "+", "arg_1", "[", "'name'", "]", ")", "arg_5", "=", "base_model", "(", "arg_4", ")", "arg_5", "[", "'type'", "]", "=", "'file'", "arg_5", "[", "'last_modified'", "]", "=", "arg_5", "[", "'created'", "]", "=", "arg_1", "[", "'created_at'", "]", "if", "arg_2", ":", "arg_6", "=", "arg_1", "[", "'content'", "]", "arg_5", "[", "'content'", "]", ",", "arg_5", "[", "'format'", "]", ",", "arg_5", "[", "'mimetype'", "]", "=", "from_b64", "(", "arg_4", ",", "arg_6", ",", "arg_3", ",", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Build a file model from database record.\n        \"\"\"\n        # TODO: Most of this is shared with _notebook_model_from_db.\n        arg_4 = to_api_path(arg_1['parent_name'] + arg_1['name'])\n        arg_5 = base_model(arg_4)\n        arg_5['type'] = 'file'\n        arg_5['last_modified'] = arg_5['created'] = arg_1['created_at']\n        if arg_2:\n            arg_6 = arg_1['content']\n            arg_5['content'], arg_5['format'], arg_5['mimetype'] = from_b64(\n                arg_4,\n                arg_6,\n                arg_3,\n            )\n        return arg_5", "path": "pgcontents/pgmanager.py", "identifier": "PostgresContentsManager._file_model_from_db", "docstring": "Build a file model from database record.", "docstring_tokens": ["Build", "a", "file", "model", "from", "database", "record", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 258841}
{"url": "https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_util.py#L47-L61", "sha": "1a1ba9758651aed9c4f58384eff006d2e2ad6835", "docstring_summary": "Yield the inverse items of the provided object.", "language": "python", "parameters": "(arg)", "return_statement": "return ((val, key) for (key, val) in _iteritems_mapping_or_iterable(arg))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "getattr", "(", "arg_0", ",", "'__Func__'", ",", "None", ")", "if", "callable", "(", "arg_1", ")", ":", "return", "arg_1", "(", ")", "return", "(", "(", "arg_3", ",", "arg_2", ")", "for", "(", "arg_2", ",", "arg_3", ")", "in", "_iteritems_mapping_or_iterable", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Yield the inverse items of the provided object.\n\n    If *arg* has a :func:`callable` ``__Func__`` attribute,\n    return the result of calling it.\n\n    Otherwise, return an iterator over the items in `arg`,\n    inverting each item on the fly.\n\n    *See also* :attr:`bidict.BidirectionalMapping.__Func__`\n    \"\"\"\n    arg_1 = getattr(arg_0, '__Func__', None)\n    if callable(arg_1):\n        return arg_1()\n    return ((arg_3, arg_2) for (arg_2, arg_3) in _iteritems_mapping_or_iterable(arg_0))", "path": "bidict/_util.py", "identifier": "inverted", "docstring": "Yield the inverse items of the provided object.\n\n    If *arg* has a :func:`callable` ``__inverted__`` attribute,\n    return the result of calling it.\n\n    Otherwise, return an iterator over the items in `arg`,\n    inverting each item on the fly.\n\n    *See also* :attr:`bidict.BidirectionalMapping.__inverted__`", "docstring_tokens": ["Yield", "the", "inverse", "items", "of", "the", "provided", "object", "."], "nwo": "jab/bidict", "score": 0.5840682608785344, "idx": 258842}
{"url": "https://github.com/ehazlett/ignition/blob/618776fccd199c4613e105ee55955b40e52d3e68/ignition/__init__.py#L179-L233", "sha": "618776fccd199c4613e105ee55955b40e52d3e68", "docstring_summary": "Creates the Nginx configuration for the project", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'# nginx config for {0}\\n'", ".", "format", "(", "arg_0", ".", "_project_name", ")", "if", "not", "arg_0", ".", "_shared_hosting", ":", "if", "arg_0", ".", "_user", ":", "arg_1", "+=", "'user {0};\\n'", ".", "format", "(", "arg_0", ".", "_user", ")", "arg_1", "+=", "'worker_processes 1;\\nerror_log {0}-errors.log;\\n\\pid {1}_    nginx.pid;\\n\\n'", ".", "format", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_log_dir", ",", "arg_0", ".", "_project_name", ")", ",", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_var_dir", ",", "arg_0", ".", "_project_name", ")", ")", "arg_1", "+=", "'events {\\n\\tworker_connections 32;\\n}\\n\\n'", "arg_1", "+=", "'http {\\n'", "if", "arg_0", ".", "_include_mimetypes", ":", "arg_1", "+=", "'\\tinclude mime.types;\\n'", "arg_1", "+=", "'\\tdefault_type application/octet-stream;\\n'", "arg_1", "+=", "'\\tclient_max_body_size 1G;\\n'", "arg_1", "+=", "'\\tproxy_max_temp_file_size 0;\\n'", "arg_1", "+=", "'\\tproxy_buffering off;\\n'", "arg_1", "+=", "'\\taccess_log {0}-access.log;\\n'", ".", "format", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_log_dir", ",", "arg_0", ".", "_project_name", ")", ")", "arg_1", "+=", "'\\tsendfile on;\\n'", "arg_1", "+=", "'\\tkeepalive_timeout 65;\\n'", "arg_1", "+=", "'\\tserver {\\n'", "arg_1", "+=", "'\\t\\tlisten 0.0.0.0:{0};\\n'", ".", "format", "(", "arg_0", ".", "_port", ")", "if", "arg_0", ".", "_server_name", ":", "arg_1", "+=", "'\\t\\tserver_name {0};\\n'", ".", "format", "(", "arg_0", ".", "_server_name", ")", "arg_1", "+=", "'\\t\\tlocation / {\\n'", "arg_1", "+=", "'\\t\\t\\tuwsgi_pass unix:///{0}.sock;\\n'", ".", "format", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_var_dir", ",", "arg_0", ".", "_project_name", ")", ")", "arg_1", "+=", "'\\t\\t\\tinclude uwsgi_params;\\n'", "arg_1", "+=", "'\\t\\t}\\n\\n'", "arg_1", "+=", "'\\t\\terror_page 500 502 503 504 /50x.html;\\n'", "arg_1", "+=", "'\\t\\tlocation = /50x.html {\\n'", "arg_1", "+=", "'\\t\\t\\troot html;\\n'", "arg_1", "+=", "'\\t\\t}\\n'", "arg_1", "+=", "'\\t}\\n'", "if", "not", "arg_0", ".", "_shared_hosting", ":", "arg_1", "+=", "'}\\n'", "arg_2", "=", "open", "(", "arg_0", ".", "_nginx_config", ",", "'w'", ")", "arg_2", ".", "write", "(", "arg_1", ")", "arg_2", ".", "close", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Creates the Nginx configuration for the project\n\n        \"\"\"\n        arg_1 = '# nginx config for {0}\\n'.format(arg_0._project_name)\n        if not arg_0._shared_hosting:\n            # user\n            if arg_0._user:\n                arg_1 += 'user {0};\\n'.format(arg_0._user)\n            # misc nginx config\n            arg_1 += 'worker_processes 1;\\nerror_log {0}-errors.log;\\n\\\npid {1}_    nginx.pid;\\n\\n'.format(os.path.join(arg_0._log_dir, \\\n                arg_0._project_name), os.path.join(arg_0._var_dir, arg_0._project_name))\n            arg_1 += 'events {\\n\\tworker_connections 32;\\n}\\n\\n'\n            # http section\n            arg_1 += 'http {\\n'\n            if arg_0._include_mimetypes:\n                arg_1 += '\\tinclude mime.types;\\n'\n            arg_1 += '\\tdefault_type application/octet-stream;\\n'\n            arg_1 += '\\tclient_max_body_size 1G;\\n'\n            arg_1 += '\\tproxy_max_temp_file_size 0;\\n'\n            arg_1 += '\\tproxy_buffering off;\\n'\n            arg_1 += '\\taccess_log {0}-access.log;\\n'.format(os.path.join \\\n                (arg_0._log_dir, arg_0._project_name))\n            arg_1 += '\\tsendfile on;\\n'\n            arg_1 += '\\tkeepalive_timeout 65;\\n'\n            # server section\n        arg_1 += '\\tserver {\\n'\n        arg_1 += '\\t\\tlisten 0.0.0.0:{0};\\n'.format(arg_0._port)\n        if arg_0._server_name:\n            arg_1 += '\\t\\tserver_name {0};\\n'.format(arg_0._server_name)\n        # location section\n        arg_1 += '\\t\\tlocation / {\\n'\n        arg_1 += '\\t\\t\\tuwsgi_pass unix:///{0}.sock;\\n'.format(\\\n            os.path.join(arg_0._var_dir, arg_0._project_name))\n        arg_1 += '\\t\\t\\tinclude uwsgi_params;\\n'\n        arg_1 += '\\t\\t}\\n\\n'\n        # end location\n        # error page templates\n        arg_1 += '\\t\\terror_page 500 502 503 504 /50x.html;\\n'\n        arg_1 += '\\t\\tlocation = /50x.html {\\n'\n        arg_1 += '\\t\\t\\troot html;\\n'\n        # end error page section\n        arg_1 += '\\t\\t}\\n'\n        # end server section\n        arg_1 += '\\t}\\n'\n        if not arg_0._shared_hosting:\n            # end http section\n            arg_1 += '}\\n'\n\n        # create conf\n        arg_2 = open(arg_0._nginx_config, 'w')\n        arg_2.write(arg_1)\n        arg_2.close()", "path": "ignition/__init__.py", "identifier": "ProjectCreator.create_nginx_config", "docstring": "Creates the Nginx configuration for the project", "docstring_tokens": ["Creates", "the", "Nginx", "configuration", "for", "the", "project"], "nwo": "ehazlett/ignition", "score": 0.17782712273869106, "idx": 258843}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_classes.py#L35-L57", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns next element from chain.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "True", ":", "try", ":", "return", "Func", "(", "arg_0", ".", "_current", ")", "except", "StopIteration", ":", "try", ":", "arg_0", ".", "_current", "=", "iter", "(", "arg_0", ".", "_chain", ".", "popleft", "(", ")", ")", "except", "IndexError", ":", "raise", "StopIteration", "(", "'Reached end of iterator chain'", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns Func element from chain.\n\n        More precisely, it returns the Func element of the\n        foremost iterator. If this iterator is empty it moves iteratively\n        along the chain of available iterators to pick the new foremost one.\n\n        Raises StopIteration if there are no elements left.\n\n        \"\"\"\n        while True:\n            # We need this loop because some iterators may already be empty.\n            # We keep on popping from the left until Func succeeds and as long\n            # as there are iterators available\n            try:\n                return Func(arg_0._current)\n            except StopIteration:\n                try:\n                    arg_0._current = iter(arg_0._chain.popleft())\n                except IndexError:\n                    # If we run out of iterators we are sure that\n                    # there can be no more element\n                    raise StopIteration('Reached end of iterator chain')", "path": "pypet/utils/helpful_classes.py", "identifier": "IteratorChain.next", "docstring": "Returns next element from chain.\n\n        More precisely, it returns the next element of the\n        foremost iterator. If this iterator is empty it moves iteratively\n        along the chain of available iterators to pick the new foremost one.\n\n        Raises StopIteration if there are no elements left.", "docstring_tokens": ["Returns", "next", "element", "from", "chain", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258844}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L71-L73", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Validate subscription policy value.", "language": "python", "parameters": "(cls, policy)", "return_statement": "return policy in [cls.OPEN, cls.APPROVAL, cls.CLOSED]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_1", "in", "[", "arg_0", ".", "OPEN", ",", "arg_0", ".", "APPROVAL", ",", "arg_0", ".", "CLOSED", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Validate subscription policy value.\"\"\"\n        return arg_1 in [arg_0.OPEN, arg_0.APPROVAL, arg_0.CLOSED]", "path": "invenio_groups/models.py", "identifier": "SubscriptionPolicy.validate", "docstring": "Validate subscription policy value.", "docstring_tokens": ["Validate", "subscription", "policy", "value", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 258845}
{"url": "https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L317-L379", "sha": "08e0319ff3c70f8a931dfa8890caf48add4d0470", "docstring_summary": "Process the notebook and create all the pictures and files", "language": "python", "parameters": "(self, disable_warnings=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "arg_0", ".", "infile", "arg_3", "=", "arg_0", ".", "outfile", "arg_4", "=", "os", ".", "path", ".", "dirname", "(", "arg_2", ")", "+", "os", ".", "path", ".", "sep", "arg_5", "=", "os", ".", "path", ".", "dirname", "(", "arg_3", ")", "+", "os", ".", "path", ".", "sep", "create_dirs", "(", "os", ".", "path", ".", "join", "(", "arg_5", ",", "'images'", ")", ")", "arg_6", "=", "nbconvert", ".", "preprocessors", ".", "ExecutePreprocessor", "(", "timeout", "=", "300", ")", "arg_7", "=", "nbconvert", ".", "preprocessors", ".", "ClearOutputPreprocessor", "(", "timeout", "=", "300", ")", "arg_0", ".", "nb", "=", "arg_8", "=", "nbformat", ".", "read", "(", "arg_2", ",", "nbformat", ".", "current_nbformat", ")", "if", "arg_1", ":", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_8", ".", "cells", ")", ":", "if", "arg_10", "[", "'cell_type'", "]", "==", "'code'", ":", "arg_10", "=", "arg_10", ".", "copy", "(", ")", "break", "arg_10", "=", "arg_10", ".", "copy", "(", ")", "arg_10", ".", "source", "=", "\"\"\"import logginglogging.captureWarnings(True)logging.getLogger('py.warnings').setLevel(logging.ERROR)\"\"\"", "arg_8", ".", "cells", ".", "insert", "(", "arg_9", ",", "arg_10", ")", "if", "arg_0", ".", "preprocess", ":", "arg_12", "=", "dt", ".", "datetime", ".", "now", "(", ")", "logger", ".", "info", "(", "'Processing %s'", ",", "arg_0", ".", "infile", ")", "try", ":", "arg_6", ".", "preprocess", "(", "arg_8", ",", "{", "'metadata'", ":", "{", "'path'", ":", "arg_4", "}", "}", ")", "except", "nbconvert", ".", "preprocessors", ".", "execute", ".", "CellExecutionError", ":", "logger", ".", "critical", "(", "'Error while processing %s!'", ",", "arg_0", ".", "infile", ",", "exc_info", "=", "True", ")", "else", ":", "logger", ".", "info", "(", "'Done. Seconds needed: %i'", ",", "(", "dt", ".", "datetime", ".", "now", "(", ")", "-", "arg_12", ")", ".", "seconds", ")", "if", "arg_1", ":", "arg_8", ".", "cells", ".", "pop", "(", "arg_9", ")", "arg_0", ".", "py_file", "=", "arg_0", ".", "get_out_file", "(", "'py'", ")", "if", "arg_0", ".", "remove_tags", ":", "arg_14", "=", "nbconvert", ".", "preprocessors", ".", "TagRemovePreprocessor", "(", "timeout", "=", "300", ")", "for", "arg_15", ",", "arg_16", "in", "arg_0", ".", "tag_options", ".", "items", "(", ")", ":", "setattr", "(", "arg_14", ",", "arg_15", ",", "set", "(", "arg_16", ")", ")", "arg_17", "=", "deepcopy", "(", "arg_8", ")", "arg_14", ".", "preprocess", "(", "arg_17", ",", "{", "'metadata'", ":", "{", "'path'", ":", "arg_4", "}", "}", ")", "else", ":", "arg_17", "=", "arg_8", "arg_0", ".", "create_rst", "(", "arg_17", ",", "arg_4", ",", "arg_5", ")", "if", "arg_0", ".", "clear", ":", "arg_7", ".", "preprocess", "(", "arg_8", ",", "{", "'metadata'", ":", "{", "'path'", ":", "arg_4", "}", "}", ")", "nbformat", ".", "write", "(", "arg_8", ",", "arg_3", ")", "arg_0", ".", "create_py", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Process the notebook and create all the pictures and files\n\n        This method runs the notebook using the :mod:`nbconvert` and\n        :mod:`nbformat` modules. It creates the :attr:`outfile` notebook,\n        a python and a rst file\"\"\"\n        arg_2 = arg_0.infile\n        arg_3 = arg_0.outfile\n        arg_4 = os.path.dirname(arg_2) + os.path.sep\n        arg_5 = os.path.dirname(arg_3) + os.path.sep\n        create_dirs(os.path.join(arg_5, 'images'))\n        arg_6 = nbconvert.preprocessors.ExecutePreprocessor(\n            timeout=300)\n        arg_7 = nbconvert.preprocessors.ClearOutputPreprocessor(\n            timeout=300)\n\n        arg_0.nb = arg_8 = nbformat.read(arg_2, nbformat.current_nbformat)\n        # disable warnings in the rst file\n        if arg_1:\n            for arg_9, arg_10 in enumerate(arg_8.cells):\n                if arg_10['cell_type'] == 'code':\n                    arg_10 = arg_10.copy()\n                    break\n            arg_10 = arg_10.copy()\n            arg_10.source = \"\"\"\nimport logging\nlogging.captureWarnings(True)\nlogging.getLogger('py.warnings').setLevel(logging.ERROR)\n\"\"\"\n            arg_8.cells.insert(arg_9, arg_10)\n        # write and process rst_file\n        if arg_0.preprocess:\n            arg_12 = dt.datetime.now()\n            logger.info('Processing %s', arg_0.infile)\n            try:\n                arg_6.preprocess(arg_8, {'metadata': {'path': arg_4}})\n            except nbconvert.preprocessors.execute.CellExecutionError:\n                logger.critical(\n                    'Error while processing %s!', arg_0.infile, exc_info=True)\n            else:\n                logger.info('Done. Seconds needed: %i',\n                            (dt.datetime.now() - arg_12).seconds)\n            if arg_1:\n                arg_8.cells.pop(arg_9)\n\n        arg_0.py_file = arg_0.get_out_file('py')\n\n        if arg_0.remove_tags:\n            arg_14 = nbconvert.preprocessors.TagRemovePreprocessor(timeout=300)\n            for arg_15, arg_16 in arg_0.tag_options.items():\n                setattr(arg_14, arg_15, set(arg_16))\n            arg_17 = deepcopy(arg_8)\n            arg_14.preprocess(arg_17, {'metadata': {'path': arg_4}})\n        else:\n            arg_17 = arg_8\n\n        arg_0.create_rst(arg_17, arg_4, arg_5)\n\n        if arg_0.clear:\n            arg_7.preprocess(arg_8, {'metadata': {'path': arg_4}})\n        # write notebook file\n        nbformat.write(arg_8, arg_3)\n        arg_0.create_py(arg_8)", "path": "sphinx_nbexamples/__init__.py", "identifier": "NotebookProcessor.process_notebook", "docstring": "Process the notebook and create all the pictures and files\n\n        This method runs the notebook using the :mod:`nbconvert` and\n        :mod:`nbformat` modules. It creates the :attr:`outfile` notebook,\n        a python and a rst file", "docstring_tokens": ["Process", "the", "notebook", "and", "create", "all", "the", "pictures", "and", "files"], "nwo": "Chilipp/sphinx-nbexamples", "score": 0.28168436607245656, "idx": 258846}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/run.py#L339-L358", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Return double precision ``mdrun`` or fall back to single precision.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "gromacs", ".", "mdrun_d", "(", "h", "=", "True", ",", "stdout", "=", "False", ",", "stderr", "=", "False", ")", "logger", ".", "debug", "(", "\"using double precision gromacs.mdrun_d\"", ")", "return", "gromacs", ".", "mdrun_d", "except", "(", "AttributeError", ",", "GromacsError", ",", "OSError", ")", ":", "arg_0", "=", "\"No 'mdrun_d' binary found so trying 'mdrun' instead.\\n\"", "\"(Note that energy minimization runs better with mdrun_d.)\"", "logger", ".", "warn", "(", "arg_0", ")", "warnings", ".", "warn", "(", "arg_0", ",", "category", "=", "AutoCorrectionWarning", ")", "return", "gromacs", ".", "mdrun"], "function": "def Func():\n    \"\"\"Return double precision ``mdrun`` or fall back to single precision.\n\n    This convenience function tries :func:`gromacs.mdrun_d` first and\n    if it cannot run it, falls back to :func:`gromacs.mdrun` (without\n    further checking).\n\n    .. versionadded:: 0.5.1\n    \"\"\"\n    try:\n        gromacs.mdrun_d(h=True, stdout=False, stderr=False)\n        logger.debug(\"using double precision gromacs.mdrun_d\")\n        return gromacs.mdrun_d\n    except (AttributeError, GromacsError, OSError):\n        # fall back to mdrun if no double precision binary\n        arg_0 = \"No 'mdrun_d' binary found so trying 'mdrun' instead.\\n\"\\\n            \"(Note that energy minimization runs better with mdrun_d.)\"\n        logger.warn(arg_0)\n        warnings.warn(arg_0, category=AutoCorrectionWarning)\n        return gromacs.mdrun", "path": "gromacs/run.py", "identifier": "get_double_or_single_prec_mdrun", "docstring": "Return double precision ``mdrun`` or fall back to single precision.\n\n    This convenience function tries :func:`gromacs.mdrun_d` first and\n    if it cannot run it, falls back to :func:`gromacs.mdrun` (without\n    further checking).\n\n    .. versionadded:: 0.5.1", "docstring_tokens": ["Return", "double", "precision", "mdrun", "or", "fall", "back", "to", "single", "precision", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 258847}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/multifn.py#L81-L84", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Decorator function which can be used to make Python multi functions.", "language": "python", "parameters": "(dispatch: DispatchFunction, default=None)", "return_statement": "return MultiFunction(name, dispatch, default)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", "=", "None", ")", "->", "MultiFunction", "[", "T", "]", ":", "arg_3", "=", "sym", ".", "symbol", "(", "arg_0", ".", "__qualname__", ",", "ns", "=", "arg_0", ".", "__module__", ")", "return", "MultiFunction", "(", "arg_3", ",", "arg_0", ",", "arg_2", ")"], "function": "def Func(arg_0: arg_1, arg_2=None) -> MultiFunction[T]:\n    \"\"\"Decorator function which can be used to make Python multi functions.\"\"\"\n    arg_3 = sym.symbol(arg_0.__qualname__, ns=arg_0.__module__)\n    return MultiFunction(arg_3, arg_0, arg_2)", "path": "src/basilisp/lang/multifn.py", "identifier": "multifn", "docstring": "Decorator function which can be used to make Python multi functions.", "docstring_tokens": ["Decorator", "function", "which", "can", "be", "used", "to", "make", "Python", "multi", "functions", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 258848}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L121-L129", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Count how many folders in this directory. Including folder in sub folder.", "language": "python", "parameters": "(self)", "return_statement": "return n", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "assert_is_dir_and_exists", "(", ")", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ".", "select_dir", "(", "recursive", "=", "True", ")", ":", "arg_1", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Count how many folders in this directory. Including folder in sub folder.\n        \"\"\"\n        arg_0.assert_is_dir_and_exists()\n        arg_1 = 0\n        for arg_2 in arg_0.select_dir(recursive=True):\n            arg_1 += 1\n        return arg_1", "path": "pathlib_mate/mate_path_filters.py", "identifier": "PathFilters.n_dir", "docstring": "Count how many folders in this directory. Including folder in sub folder.", "docstring_tokens": ["Count", "how", "many", "folders", "in", "this", "directory", ".", "Including", "folder", "in", "sub", "folder", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 258849}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/campaignactions.py#L31-L41", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Cancel a Regular or Plain-Text Campaign after you send, before all of\n        your recipients receive it. This feature is included with MailChimp\n        Pro.", "language": "python", "parameters": "(self, campaign_id)", "return_statement": "return self._mc_client._post(url=self._build_path(campaign_id, 'actions/cancel-send'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "campaign_id", "=", "arg_1", "return", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'actions/Func-send'", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Cancel a Regular or Plain-Text Campaign after you send, before all of\n        your recipients receive it. This feature is included with MailChimp\n        Pro.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        arg_0.campaign_id = arg_1\n        return arg_0._mc_client._post(url=arg_0._build_path(arg_1, 'actions/Func-send'))", "path": "mailchimp3/entities/campaignactions.py", "identifier": "CampaignActions.cancel", "docstring": "Cancel a Regular or Plain-Text Campaign after you send, before all of\n        your recipients receive it. This feature is included with MailChimp\n        Pro.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`", "docstring_tokens": ["Cancel", "a", "Regular", "or", "Plain", "-", "Text", "Campaign", "after", "you", "send", "before", "all", "of", "your", "recipients", "receive", "it", ".", "This", "feature", "is", "included", "with", "MailChimp", "Pro", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 258850}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L498-L511", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Set the autoindent flag, checking for readline support.", "language": "python", "parameters": "(self,value=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "!=", "0", "and", "not", "arg_0", ".", "has_readline", ":", "if", "os", ".", "name", "==", "'posix'", ":", "warn", "(", "\"The auto-indent feature requires the readline library\"", ")", "arg_0", ".", "autoindent", "=", "0", "return", "if", "arg_1", "is", "None", ":", "arg_0", ".", "autoindent", "=", "not", "arg_0", ".", "autoindent", "else", ":", "arg_0", ".", "autoindent", "=", "arg_1"], "function": "def Func(arg_0,arg_1=None):\n        \"\"\"Set the autoindent flag, checking for readline support.\n\n        If called with no arguments, it acts as a toggle.\"\"\"\n\n        if arg_1 != 0 and not arg_0.has_readline:\n            if os.name == 'posix':\n                warn(\"The auto-indent feature requires the readline library\")\n            arg_0.autoindent = 0\n            return\n        if arg_1 is None:\n            arg_0.autoindent = not arg_0.autoindent\n        else:\n            arg_0.autoindent = arg_1", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.set_autoindent", "docstring": "Set the autoindent flag, checking for readline support.\n\n        If called with no arguments, it acts as a toggle.", "docstring_tokens": ["Set", "the", "autoindent", "flag", "checking", "for", "readline", "support", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258851}
{"url": "https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/elastic.py#L197-L219", "sha": "ecc9fd434c23d896ccd1f35795ccc047f946ed05", "docstring_summary": "Create Elasticsearch indexes", "language": "python", "parameters": "(names, settings=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "Index", "(", "arg_2", ")", "try", ":", "if", "not", "arg_3", ".", "exists", "(", ")", ":", "logger", ".", "debug", "(", "\"Creating Elasticsearch index: {0}\"", ".", "format", "(", "arg_2", ")", ")", "if", "arg_1", "is", "None", ":", "arg_3", ".", "settings", "(", "number_of_shards", "=", "1", ",", "number_of_replicas", "=", "1", ")", "else", ":", "arg_3", ".", "settings", "(", "**", "arg_1", ")", "arg_3", ".", "create", "(", ")", "except", "Exception", "as", "e", ":", "raise", "ElasticsearchError", "(", "\"Elasticsearch error: {0}\"", ".", "format", "(", "e", ".", "__str__", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Create Elasticsearch indexes\n\n    Args:\n        names (list): A list of index names\n        settings (dict): Index settings\n\n    \"\"\"\n    for arg_2 in arg_0:\n        arg_3 = Index(arg_2)\n        try:\n            if not arg_3.exists():\n                logger.debug(\"Creating Elasticsearch index: {0}\".format(arg_2))\n                if arg_1 is None:\n                    arg_3.settings(number_of_shards=1,\n                                   number_of_replicas=1)\n                else:\n                    arg_3.settings(**arg_1)\n                arg_3.create()\n        except Exception as e:\n            raise ElasticsearchError(\n                \"Elasticsearch error: {0}\".format(e.__str__()))", "path": "parsedmarc/elastic.py", "identifier": "create_indexes", "docstring": "Create Elasticsearch indexes\n\n    Args:\n        names (list): A list of index names\n        settings (dict): Index settings", "docstring_tokens": ["Create", "Elasticsearch", "indexes"], "nwo": "domainaware/parsedmarc", "score": 0.7452768887820926, "idx": 258852}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L202-L224", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Lists all available versions of a model. Blocks until finished.", "language": "python", "parameters": "(self, project_id, model_name)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "'projects/{}/models/{}'", ".", "format", "(", "arg_1", ",", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "models", "(", ")", ".", "versions", "(", ")", ".", "list", "(", "parent", "=", "arg_4", ",", "pageSize", "=", "100", ")", "arg_6", "=", "arg_5", ".", "execute", "(", ")", "arg_7", "=", "arg_6", ".", "get", "(", "'nextPageToken'", ",", "None", ")", "arg_3", ".", "extend", "(", "arg_6", ".", "get", "(", "'versions'", ",", "[", "]", ")", ")", "while", "arg_7", "is", "not", "None", ":", "arg_8", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "models", "(", ")", ".", "versions", "(", ")", ".", "list", "(", "parent", "=", "arg_4", ",", "pageToken", "=", "arg_7", ",", "pageSize", "=", "100", ")", "arg_6", "=", "arg_8", ".", "execute", "(", ")", "arg_7", "=", "arg_6", ".", "get", "(", "'nextPageToken'", ",", "None", ")", "arg_3", ".", "extend", "(", "arg_6", ".", "get", "(", "'versions'", ",", "[", "]", ")", ")", "time", ".", "sleep", "(", "5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Lists all available versions of a model. Blocks until finished.\n        \"\"\"\n        arg_3 = []\n        arg_4 = 'projects/{}/models/{}'.format(\n            arg_1, arg_2)\n        arg_5 = arg_0._mlengine.projects().models().versions().list(\n            parent=arg_4, pageSize=100)\n\n        arg_6 = arg_5.execute()\n        arg_7 = arg_6.get('nextPageToken', None)\n        arg_3.extend(arg_6.get('versions', []))\n        while arg_7 is not None:\n            arg_8 = arg_0._mlengine.projects().models().versions().list(\n                parent=arg_4,\n                pageToken=arg_7,\n                pageSize=100)\n            arg_6 = arg_8.execute()\n            arg_7 = arg_6.get('nextPageToken', None)\n            arg_3.extend(arg_6.get('versions', []))\n            time.sleep(5)\n        return arg_3", "path": "airflow/contrib/hooks/gcp_mlengine_hook.py", "identifier": "MLEngineHook.list_versions", "docstring": "Lists all available versions of a model. Blocks until finished.", "docstring_tokens": ["Lists", "all", "available", "versions", "of", "a", "model", ".", "Blocks", "until", "finished", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258853}
{"url": "https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L298-L309", "sha": "13fbb1ea4c1bb422de91a726c3c7f1038d3743a3", "docstring_summary": "Returns the dictionary of CORS specific app configurations.", "language": "python", "parameters": "(appInstance=None)", "return_statement": "return {\n        k.lower().replace('cors_', ''): app_config.get(k)\n        for k in CONFIG_OPTIONS\n        if app_config.get(k) is not None\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", "=", "(", "arg_0", "or", "current_app", ")", "arg_2", "=", "getattr", "(", "arg_1", ",", "'config'", ",", "{", "}", ")", "return", "{", "arg_3", ".", "lower", "(", ")", ".", "replace", "(", "'cors_'", ",", "''", ")", ":", "arg_2", ".", "get", "(", "arg_3", ")", "for", "arg_3", "in", "CONFIG_OPTIONS", "if", "arg_2", ".", "get", "(", "arg_3", ")", "is", "not", "None", "}"], "function": "def Func(arg_0=None):\n    \"\"\"Returns the dictionary of CORS specific app configurations.\"\"\"\n    arg_1 = (arg_0 or current_app)\n\n    # In order to support blueprints which do not have a config attribute\n    arg_2 = getattr(arg_1, 'config', {})\n\n    return {\n        arg_3.lower().replace('cors_', ''): arg_2.get(arg_3)\n        for arg_3 in CONFIG_OPTIONS\n        if arg_2.get(arg_3) is not None\n    }", "path": "flask_cors/core.py", "identifier": "get_app_kwarg_dict", "docstring": "Returns the dictionary of CORS specific app configurations.", "docstring_tokens": ["Returns", "the", "dictionary", "of", "CORS", "specific", "app", "configurations", "."], "nwo": "corydolphin/flask-cors", "score": 0.7744905909522264, "idx": 258854}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L559-L588", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Join prefixes & suffixes in cases of alternate phonetic values.", "language": "python", "parameters": "(self, phonetic)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "find", "(", "'('", ")", "if", "arg_2", "==", "-", "1", ":", "return", "' '", "+", "arg_0", ".", "_phonetic_number", "(", "arg_1", ")", "arg_3", "=", "arg_1", "[", ":", "arg_2", "]", "arg_2", "+=", "1", "arg_4", "=", "arg_1", ".", "find", "(", "')'", ",", "arg_2", ")", "arg_5", "=", "arg_1", "[", "arg_2", ":", "arg_4", "]", "arg_4", "+=", "1", "arg_6", "=", "arg_1", "[", "arg_4", ":", "]", "arg_7", "=", "arg_5", ".", "split", "(", "'|'", ")", "arg_8", "=", "''", "for", "arg_9", "in", "arg_7", ":", "arg_8", "+=", "arg_0", ".", "Func", "(", "arg_3", "+", "arg_9", "+", "arg_6", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Join prefixes & suffixes in cases of alternate phonetic values.\n\n        Parameters\n        ----------\n        phonetic : str\n            A Beider-Morse phonetic encoding\n\n        Returns\n        -------\n        str\n            A Beider-Morse phonetic code\n\n        \"\"\"\n        arg_2 = arg_1.find('(')\n        if arg_2 == -1:\n            return ' ' + arg_0._phonetic_number(arg_1)\n\n        arg_3 = arg_1[:arg_2]\n        arg_2 += 1  # get past the (\n        arg_4 = arg_1.find(')', arg_2)\n        arg_5 = arg_1[arg_2:arg_4]\n        arg_4 += 1  # get past the )\n        arg_6 = arg_1[arg_4:]\n        arg_7 = arg_5.split('|')\n        arg_8 = ''\n        for arg_9 in arg_7:\n            arg_8 += arg_0.Func(arg_3 + arg_9 + arg_6)\n\n        return arg_8", "path": "abydos/phonetic/_beider_morse.py", "identifier": "BeiderMorse._pnums_with_leading_space", "docstring": "Join prefixes & suffixes in cases of alternate phonetic values.\n\n        Parameters\n        ----------\n        phonetic : str\n            A Beider-Morse phonetic encoding\n\n        Returns\n        -------\n        str\n            A Beider-Morse phonetic code", "docstring_tokens": ["Join", "prefixes", "&", "suffixes", "in", "cases", "of", "alternate", "phonetic", "values", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 258855}
{"url": "https://github.com/rbarrois/aionotify/blob/6cfa35b26a2660f77f29a92d3efb7d1dde685b43/aionotify/aioutils.py#L88-L92", "sha": "6cfa35b26a2660f77f29a92d3efb7d1dde685b43", "docstring_summary": "Actual closing code, both from manual close and errors.", "language": "python", "parameters": "(self, error=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", ".", "_closing", "=", "True", "arg_0", ".", "pause_reading", "(", ")", "arg_0", ".", "_loop", ".", "call_soon", "(", "arg_0", ".", "_call_connection_lost", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Actual closing code, both from manual close and errors.\"\"\"\n        arg_0._closing = True\n        arg_0.pause_reading()\n        arg_0._loop.call_soon(arg_0._call_connection_lost, arg_1)", "path": "aionotify/aioutils.py", "identifier": "UnixFileDescriptorTransport._close", "docstring": "Actual closing code, both from manual close and errors.", "docstring_tokens": ["Actual", "closing", "code", "both", "from", "manual", "close", "and", "errors", "."], "nwo": "rbarrois/aionotify", "score": 0.47794899994238105, "idx": 258856}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L631-L641", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Retrieves the instance name associated with the current host string.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "env", ".", "vm_type", "==", "EC2", ":", "for", "arg_0", "in", "get_all_running_ec2_instances", "(", ")", ":", "if", "env", ".", "host_string", "==", "arg_0", ".", "public_dns_name", ":", "arg_1", "=", "arg_0", ".", "tags", ".", "get", "(", "env", ".", "vm_name_tag", ")", "return", "arg_1", "else", ":", "raise", "NotImplementedError"], "function": "def Func():\n    \"\"\"\n    Retrieves the instance name associated with the current host string.\n    \"\"\"\n    if env.vm_type == EC2:\n        for arg_0 in get_all_running_ec2_instances():\n            if env.host_string == arg_0.public_dns_name:\n                arg_1 = arg_0.tags.get(env.vm_name_tag)\n                return arg_1\n    else:\n        raise NotImplementedError", "path": "burlap/vm.py", "identifier": "get_name", "docstring": "Retrieves the instance name associated with the current host string.", "docstring_tokens": ["Retrieves", "the", "instance", "name", "associated", "with", "the", "current", "host", "string", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258857}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/transport.py#L205-L217", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Sends the DELETE request to the Route53 endpoint.", "language": "python", "parameters": "(self, path, headers)", "return_statement": "return r.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "requests", ".", "delete", "(", "arg_0", ".", "endpoint", "+", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_3", ".", "text"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Sends the DELETE request to the Route53 endpoint.\n\n        :param str path: The path to tack on to the endpoint URL for\n            the query.\n        :param dict headers: A dict of headers to send with the request.\n        :rtype: str\n        :returns: The body of the response.\n        \"\"\"\n\n        arg_3 = requests.delete(arg_0.endpoint + arg_1, arg_2=arg_2)\n        return arg_3.text", "path": "route53/transport.py", "identifier": "RequestsTransport._send_delete_request", "docstring": "Sends the DELETE request to the Route53 endpoint.\n\n        :param str path: The path to tack on to the endpoint URL for\n            the query.\n        :param dict headers: A dict of headers to send with the request.\n        :rtype: str\n        :returns: The body of the response.", "docstring_tokens": ["Sends", "the", "DELETE", "request", "to", "the", "Route53", "endpoint", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 258858}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/commands/dump_command.py#L10-L18", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "dump command dumps things", "language": "python", "parameters": "(helper, config, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "parse_env_config", "(", "arg_1", ",", "arg_2", ".", "environment", ")", "arg_4", "=", "arg_3", ".", "get", "(", "'option_settings'", ",", "{", "}", ")", "arg_5", "=", "parse_option_settings", "(", "arg_4", ")", "for", "arg_6", "in", "arg_5", ":", "out", "(", "str", "(", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    dump command dumps things\n    \"\"\"\n    arg_3 = parse_env_config(arg_1, arg_2.environment)\n    arg_4 = arg_3.get('option_settings', {})\n    arg_5 = parse_option_settings(arg_4)\n    for arg_6 in arg_5:\n        out(str(arg_6))", "path": "ebs_deploy/commands/dump_command.py", "identifier": "execute", "docstring": "dump command dumps things", "docstring_tokens": ["dump", "command", "dumps", "things"], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 258859}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L85-L177", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates a LinearOperator representing a lower triangular matrix.", "language": "python", "parameters": "(loc=None,\n                    scale_tril=None,\n                    scale_diag=None,\n                    scale_identity_multiplier=None,\n                    shape_hint=None,\n                    validate_args=False,\n                    assert_positive=False,\n                    name=None)", "return_statement": "return make_diag_scale(\n      loc=loc,\n      scale_diag=scale_diag,\n      scale_identity_multiplier=scale_identity_multiplier,\n      shape_hint=shape_hint,\n      validate_args=validate_args,\n      assert_positive=assert_positive,\n      name=name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ")", ":", "def", "_maybe_attach_assertion", "(", "arg_8", ")", ":", "if", "not", "arg_5", ":", "return", "arg_8", "if", "arg_6", ":", "return", "with_dependencies", "(", "[", "assert_util", ".", "assert_positive", "(", "tf", ".", "linalg", ".", "diag_part", "(", "arg_8", ")", ",", "message", "=", "\"diagonal part must be positive\"", ")", ",", "]", ",", "arg_8", ")", "return", "with_dependencies", "(", "[", "assert_util", ".", "assert_none_equal", "(", "tf", ".", "linalg", ".", "diag_part", "(", "arg_8", ")", ",", "tf", ".", "zeros", "(", "[", "]", ",", "arg_8", ".", "dtype", ")", ",", "message", "=", "\"diagonal part must be non-zero\"", ")", ",", "]", ",", "arg_8", ")", "with", "tf", ".", "name_scope", "(", "arg_7", "or", "\"Func\"", ")", ":", "arg_9", "=", "dtype_util", ".", "common_dtype", "(", "[", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "]", ",", "preferred_dtype", "=", "tf", ".", "float32", ")", "arg_0", "=", "_convert_to_tensor", "(", "arg_0", ",", "arg_7", "=", "\"loc\"", ",", "arg_9", "=", "arg_9", ")", "arg_1", "=", "_convert_to_tensor", "(", "arg_1", ",", "arg_7", "=", "\"scale_tril\"", ",", "arg_9", "=", "arg_9", ")", "arg_2", "=", "_convert_to_tensor", "(", "arg_2", ",", "arg_7", "=", "\"scale_diag\"", ",", "arg_9", "=", "arg_9", ")", "arg_3", "=", "_convert_to_tensor", "(", "arg_3", ",", "arg_7", "=", "\"scale_identity_multiplier\"", ",", "arg_9", "=", "arg_9", ")", "if", "arg_1", "is", "not", "None", ":", "arg_1", "=", "tf", ".", "linalg", ".", "band_part", "(", "arg_1", ",", "-", "1", ",", "0", ")", "arg_10", "=", "tf", ".", "linalg", ".", "diag_part", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "arg_10", "+=", "arg_2", "if", "arg_3", "is", "not", "None", ":", "arg_10", "+=", "arg_3", "[", "...", ",", "tf", ".", "newaxis", "]", "arg_1", "=", "tf", ".", "linalg", ".", "set_diag", "(", "arg_1", ",", "arg_10", ")", "return", "tf", ".", "linalg", ".", "LinearOperatorLowerTriangular", "(", "tril", "=", "_maybe_attach_assertion", "(", "arg_1", ")", ",", "is_non_singular", "=", "True", ",", "is_self_adjoint", "=", "False", ",", "is_positive_definite", "=", "arg_6", ")", "return", "make_diag_scale", "(", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0=None,\n                    arg_1=None,\n                    arg_2=None,\n                    arg_3=None,\n                    arg_4=None,\n                    arg_5=False,\n                    arg_6=False,\n                    arg_7=None):\n  \"\"\"Creates a LinearOperator representing a lower triangular matrix.\n\n  Args:\n    loc: Floating-point `Tensor`. This is used for inferring shape in the case\n      where only `scale_identity_multiplier` is set.\n    scale_tril: Floating-point `Tensor` representing the diagonal matrix.\n      `scale_diag` has shape [N1, N2, ...  k, k], which represents a k x k lower\n      triangular matrix. When `None` no `scale_tril` term is added to the\n      LinearOperator. The upper triangular elements above the diagonal are\n      ignored.\n    scale_diag: Floating-point `Tensor` representing the diagonal matrix.\n      `scale_diag` has shape [N1, N2, ...  k], which represents a k x k diagonal\n      matrix. When `None` no diagonal term is added to the LinearOperator.\n    scale_identity_multiplier: floating point rank 0 `Tensor` representing a\n      scaling done to the identity matrix. When `scale_identity_multiplier =\n      scale_diag = scale_tril = None` then `scale += IdentityMatrix`. Otherwise\n      no scaled-identity-matrix is added to `scale`.\n    shape_hint: scalar integer `Tensor` representing a hint at the dimension of\n      the identity matrix when only `scale_identity_multiplier` is set.\n    validate_args: Python `bool` indicating whether arguments should be checked\n      for correctness.\n    assert_positive: Python `bool` indicating whether LinearOperator should be\n      checked for being positive definite.\n    name: Python `str` name given to ops managed by this object.\n\n  Returns:\n    `LinearOperator` representing a lower triangular matrix.\n\n  Raises:\n    ValueError:  If only `scale_identity_multiplier` is set and `loc` and\n      `shape_hint` are both None.\n  \"\"\"\n\n  def _maybe_attach_assertion(arg_8):\n    if not arg_5:\n      return arg_8\n    if arg_6:\n      return with_dependencies([\n          assert_util.assert_positive(\n              tf.linalg.diag_part(arg_8), message=\"diagonal part must be positive\"),\n      ], arg_8)\n    return with_dependencies([\n        assert_util.assert_none_equal(\n            tf.linalg.diag_part(arg_8),\n            tf.zeros([], arg_8.dtype),\n            message=\"diagonal part must be non-zero\"),\n    ], arg_8)\n\n  with tf.name_scope(arg_7 or \"Func\"):\n\n    arg_9 = dtype_util.common_dtype(\n        [arg_0, arg_1, arg_2, arg_3],\n        preferred_dtype=tf.float32)\n    arg_0 = _convert_to_tensor(arg_0, arg_7=\"loc\", arg_9=arg_9)\n    arg_1 = _convert_to_tensor(arg_1, arg_7=\"scale_tril\", arg_9=arg_9)\n    arg_2 = _convert_to_tensor(arg_2, arg_7=\"scale_diag\", arg_9=arg_9)\n    arg_3 = _convert_to_tensor(\n        arg_3,\n        arg_7=\"scale_identity_multiplier\",\n        arg_9=arg_9)\n\n  if arg_1 is not None:\n    arg_1 = tf.linalg.band_part(arg_1, -1, 0)  # Zero out TriU.\n    arg_10 = tf.linalg.diag_part(arg_1)\n    if arg_2 is not None:\n      arg_10 += arg_2\n    if arg_3 is not None:\n      arg_10 += arg_3[..., tf.newaxis]\n\n    arg_1 = tf.linalg.set_diag(arg_1, arg_10)\n\n    return tf.linalg.LinearOperatorLowerTriangular(\n        tril=_maybe_attach_assertion(arg_1),\n        is_non_singular=True,\n        is_self_adjoint=False,\n        is_positive_definite=arg_6)\n\n  return make_diag_scale(\n      arg_0=arg_0,\n      arg_2=arg_2,\n      arg_3=arg_3,\n      arg_4=arg_4,\n      arg_5=arg_5,\n      arg_6=arg_6,\n      arg_7=arg_7)", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "make_tril_scale", "docstring": "Creates a LinearOperator representing a lower triangular matrix.\n\n  Args:\n    loc: Floating-point `Tensor`. This is used for inferring shape in the case\n      where only `scale_identity_multiplier` is set.\n    scale_tril: Floating-point `Tensor` representing the diagonal matrix.\n      `scale_diag` has shape [N1, N2, ...  k, k], which represents a k x k lower\n      triangular matrix. When `None` no `scale_tril` term is added to the\n      LinearOperator. The upper triangular elements above the diagonal are\n      ignored.\n    scale_diag: Floating-point `Tensor` representing the diagonal matrix.\n      `scale_diag` has shape [N1, N2, ...  k], which represents a k x k diagonal\n      matrix. When `None` no diagonal term is added to the LinearOperator.\n    scale_identity_multiplier: floating point rank 0 `Tensor` representing a\n      scaling done to the identity matrix. When `scale_identity_multiplier =\n      scale_diag = scale_tril = None` then `scale += IdentityMatrix`. Otherwise\n      no scaled-identity-matrix is added to `scale`.\n    shape_hint: scalar integer `Tensor` representing a hint at the dimension of\n      the identity matrix when only `scale_identity_multiplier` is set.\n    validate_args: Python `bool` indicating whether arguments should be checked\n      for correctness.\n    assert_positive: Python `bool` indicating whether LinearOperator should be\n      checked for being positive definite.\n    name: Python `str` name given to ops managed by this object.\n\n  Returns:\n    `LinearOperator` representing a lower triangular matrix.\n\n  Raises:\n    ValueError:  If only `scale_identity_multiplier` is set and `loc` and\n      `shape_hint` are both None.", "docstring_tokens": ["Creates", "a", "LinearOperator", "representing", "a", "lower", "triangular", "matrix", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258860}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L212-L222", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to get query argument.\n    Raises exception if argument is missing.\n    Returns the query argument.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "get_argument", "(", "constants", ".", "PARAM_QUERY", ")", "return", "arg_1", "except", "tornado", ".", "web", ".", "MissingArgumentError", "as", "e", ":", "raise", "Exception", "(", "e", ".", "log_message", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Helper function to get query argument.\n    Raises exception if argument is missing.\n    Returns the query argument.\n    \"\"\"\n    try:\n      arg_1 = arg_0.get_argument(constants.PARAM_QUERY)\n      return arg_1\n    except tornado.web.MissingArgumentError as e:\n      raise Exception(e.log_message)", "path": "heron/tools/tracker/src/python/handlers/basehandler.py", "identifier": "BaseHandler.get_argument_query", "docstring": "Helper function to get query argument.\n    Raises exception if argument is missing.\n    Returns the query argument.", "docstring_tokens": ["Helper", "function", "to", "get", "query", "argument", ".", "Raises", "exception", "if", "argument", "is", "missing", ".", "Returns", "the", "query", "argument", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258861}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/views.py#L196-L218", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Delete group.", "language": "python", "parameters": "(group_id)", "return_statement": "return redirect(url_for(\".index\"))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Group", ".", "query", ".", "get_or_404", "(", "arg_0", ")", "if", "arg_1", ".", "can_edit", "(", "current_user", ")", ":", "try", ":", "arg_1", ".", "Func", "(", ")", "except", "Exception", "as", "e", ":", "flash", "(", "str", "(", "e", ")", ",", "\"error\"", ")", "return", "redirect", "(", "url_for", "(", "\".index\"", ")", ")", "flash", "(", "_", "(", "'Successfully removed group \"%(group_name)s\"'", ",", "group_name", "=", "arg_1", ".", "name", ")", ",", "'success'", ")", "return", "redirect", "(", "url_for", "(", "\".index\"", ")", ")", "flash", "(", "_", "(", "'You cannot Func the group %(group_name)s'", ",", "group_name", "=", "arg_1", ".", "name", ")", ",", "'error'", ")", "return", "redirect", "(", "url_for", "(", "\".index\"", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Delete group.\"\"\"\n    arg_1 = Group.query.get_or_404(arg_0)\n\n    if arg_1.can_edit(current_user):\n        try:\n            arg_1.Func()\n        except Exception as e:\n            flash(str(e), \"error\")\n            return redirect(url_for(\".index\"))\n\n        flash(_('Successfully removed group \"%(group_name)s\"',\n                group_name=arg_1.name), 'success')\n        return redirect(url_for(\".index\"))\n\n    flash(\n        _(\n            'You cannot Func the group %(group_name)s',\n            group_name=arg_1.name\n        ),\n        'error'\n    )\n    return redirect(url_for(\".index\"))", "path": "invenio_groups/views.py", "identifier": "delete", "docstring": "Delete group.", "docstring_tokens": ["Delete", "group", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 258862}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L148-L161", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Send discover.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "arg_0", ".", "client", "assert", "arg_0", ".", "current_state", "==", "STATE_INIT", "or", "arg_0", ".", "current_state", "==", "STATE_SELECTING", "arg_1", "=", "arg_0", ".", "client", ".", "gen_discover", "(", ")", "sendp", "(", "arg_1", ")", "if", "arg_0", ".", "discover_attempts", "<", "MAX_ATTEMPTS_DISCOVER", ":", "arg_0", ".", "discover_attempts", "+=", "1", "arg_2", "=", "gen_timeout_resend", "(", "arg_0", ".", "discover_attempts", ")", "arg_0", ".", "set_timeout", "(", "arg_0", ".", "current_state", ",", "arg_0", ".", "timeout_selecting", ",", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"Send discover.\"\"\"\n        assert arg_0.client\n        assert arg_0.current_state == STATE_INIT or \\\n            arg_0.current_state == STATE_SELECTING\n        arg_1 = arg_0.client.gen_discover()\n        sendp(arg_1)\n        # FIXME:20 check that this is correct,: all or only discover?\n        if arg_0.discover_attempts < MAX_ATTEMPTS_DISCOVER:\n            arg_0.discover_attempts += 1\n        arg_2 = gen_timeout_resend(arg_0.discover_attempts)\n        arg_0.set_timeout(arg_0.current_state,\n                         arg_0.timeout_selecting,\n                         arg_2)", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.send_discover", "docstring": "Send discover.", "docstring_tokens": ["Send", "discover", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 258863}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/code_utils.py#L38-L62", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Function to create variadic operator function", "language": "python", "parameters": "(fn)", "return_statement": "return op", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "op", "(", "*", "arg_1", ",", "arg_2", "=", "None", ")", "->", "RtlSignalBase", ":", "assert", "arg_1", ",", "arg_1", "arg_3", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_1", "=", "map", "(", "arg_2", ",", "arg_1", ")", "for", "arg_4", "in", "arg_1", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_4", "else", ":", "arg_3", "=", "arg_0", "(", "arg_3", ",", "arg_4", ")", "return", "arg_3", "return", "op"], "function": "def Func(arg_0):\n    \"\"\"\n    Function to create variadic operator function\n\n    :param fn: function to perform binary operation\n    \"\"\"\n    def op(*arg_1, arg_2=None) -> RtlSignalBase:\n        \"\"\"\n        :param operands: variadic parameter of input uperands\n        :param key: optional function applied on every operand\n            before processing\n        \"\"\"\n        assert arg_1, arg_1\n        arg_3 = None\n        if arg_2 is not None:\n            arg_1 = map(arg_2, arg_1)\n\n        for arg_4 in arg_1:\n            if arg_3 is None:\n                arg_3 = arg_4\n            else:\n                arg_3 = arg_0(arg_3, arg_4)\n        return arg_3\n\n    return op", "path": "hwt/code_utils.py", "identifier": "_mkOp", "docstring": "Function to create variadic operator function\n\n    :param fn: function to perform binary operation", "docstring_tokens": ["Function", "to", "create", "variadic", "operator", "function"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 258864}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/message_factory.py#L73-L90", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Returns a single message activity containing an attachment.", "language": "python", "parameters": "(attachment: Attachment, text: str = None, speak: str = None,\n                   input_hint: Union[InputHints, str] = None)", "return_statement": "return attachment_activity(AttachmentLayoutTypes.list, [attachment], text, speak, input_hint)", "argument_list": "", "function_tokens": ["def", "Func", "(", "Func", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "None", ",", "arg_4", ":", "arg_3", "=", "None", ",", "arg_5", ":", "arg_6", "[", "arg_7", ",", "arg_3", "]", "=", "None", ")", ":", "return", "attachment_activity", "(", "AttachmentLayoutTypes", ".", "list", ",", "[", "Func", "]", ",", "arg_2", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(Func: arg_1, arg_2: arg_3 = None, arg_4: arg_3 = None,\n                   arg_5: arg_6[arg_7, arg_3] = None):\n        \"\"\"\n        Returns a single message activity containing an attachment.\n\n        :Example:\n        message = MessageFactory.attachment(CardFactory.hero_card(HeroCard(title='White T-Shirt',\n                                                                  images=[CardImage(url='https://example.com/whiteShirt.jpg')],\n                                                                  buttons=[CardAction(title='buy')])))\n        await context.send_activity(message)\n\n        :param attachment:\n        :param text:\n        :param speak:\n        :param input_hint:\n        :return:\n        \"\"\"\n        return attachment_activity(AttachmentLayoutTypes.list, [Func], arg_2, arg_4, arg_5)", "path": "libraries/botbuilder-core/botbuilder/core/message_factory.py", "identifier": "MessageFactory.attachment", "docstring": "Returns a single message activity containing an attachment.\n\n        :Example:\n        message = MessageFactory.attachment(CardFactory.hero_card(HeroCard(title='White T-Shirt',\n                                                                  images=[CardImage(url='https://example.com/whiteShirt.jpg')],\n                                                                  buttons=[CardAction(title='buy')])))\n        await context.send_activity(message)\n\n        :param attachment:\n        :param text:\n        :param speak:\n        :param input_hint:\n        :return:", "docstring_tokens": ["Returns", "a", "single", "message", "activity", "containing", "an", "attachment", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 258865}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L540-L543", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Handle typing updates.", "language": "python", "parameters": "(self, typing_message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_typing_statuses", "[", "arg_1", ".", "user_id", "]", "=", "arg_1", ".", "status", "arg_0", ".", "_update", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Handle typing updates.\"\"\"\n        arg_0._typing_statuses[arg_1.user_id] = arg_1.status\n        arg_0._update()", "path": "hangups/ui/__main__.py", "identifier": "StatusLineWidget._on_typing", "docstring": "Handle typing updates.", "docstring_tokens": ["Handle", "typing", "updates", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 258866}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L2276-L2286", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Removes the file with the virtual column etc, it does not change the current virtual columns etc.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_private_dir", "(", "create", "=", "True", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "\"virtual_meta.yaml\"", ")", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "os", ".", "remove", "(", "arg_2", ")", "if", "not", "os", ".", "listdir", "(", "arg_1", ")", ":", "os", ".", "rmdir", "(", "arg_1", ")", "except", ":", "logger", ".", "exception", "(", "\"error while trying to remove %s or %s\"", ",", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Removes the file with the virtual column etc, it does not change the current virtual columns etc.\"\"\"\n        arg_1 = arg_0.get_private_dir(create=True)\n        arg_2 = os.path.join(arg_1, \"virtual_meta.yaml\")\n        try:\n            if os.path.exists(arg_2):\n                os.remove(arg_2)\n            if not os.listdir(arg_1):\n                os.rmdir(arg_1)\n        except:\n            logger.exception(\"error while trying to remove %s or %s\", arg_2, arg_1)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.remove_virtual_meta", "docstring": "Removes the file with the virtual column etc, it does not change the current virtual columns etc.", "docstring_tokens": ["Removes", "the", "file", "with", "the", "virtual", "column", "etc", "it", "does", "not", "change", "the", "current", "virtual", "columns", "etc", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 258867}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L77-L121", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Pre-process an STR variant entry for detail page.", "language": "python", "parameters": "(store, institute_id, case_name, variant_id)", "return_statement": "return {\n        'institute': institute_obj,\n        'case': case_obj,\n        'variant': variant_obj,\n        'overlapping_snvs': overlapping_snvs,\n        'manual_rank_options': MANUAL_RANK_OPTIONS,\n        'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "institute_and_case", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "arg_0", ".", "variant", "(", "arg_3", ")", "variant_case", "(", "arg_0", ",", "arg_5", ",", "arg_6", ")", "arg_6", "[", "'callers'", "]", "=", "callers", "(", "arg_6", ",", "category", "=", "'str'", ")", "arg_6", "[", "'comments'", "]", "=", "arg_0", ".", "events", "(", "arg_4", ",", "case", "=", "arg_5", ",", "arg_3", "=", "arg_6", "[", "'variant_id'", "]", ",", "comments", "=", "True", ")", "return", "{", "'institute'", ":", "arg_4", ",", "'case'", ":", "arg_5", ",", "'variant'", ":", "arg_6", ",", "'overlapping_snvs'", ":", "overlapping_snvs", ",", "'manual_rank_options'", ":", "MANUAL_RANK_OPTIONS", ",", "'dismiss_variant_options'", ":", "DISMISS_VARIANT_OPTIONS", "}"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Pre-process an STR variant entry for detail page.\n\n    Adds information to display variant\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        institute_id(str)\n        case_name(str)\n        variant_id(str)\n\n    Returns:\n        detailed_information(dict): {\n            'institute': <institute_obj>,\n            'case': <case_obj>,\n            'variant': <variant_obj>,\n            'overlapping_snvs': <overlapping_snvs>,\n            'manual_rank_options': MANUAL_RANK_OPTIONS,\n            'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n        }\n        \"\"\"\n\n    arg_4, arg_5 = institute_and_case(arg_0, arg_1, arg_2)\n    arg_6 =  arg_0.variant(arg_3)\n\n    # fill in information for pilup view\n    variant_case(arg_0, arg_5, arg_6)\n\n    arg_6['callers'] = callers(arg_6, category='str')\n\n    # variant_obj['str_ru']\n    # variant_obj['str_repid']\n    # variant_obj['str_ref']\n\n    arg_6['comments'] = arg_0.events(arg_4, case=arg_5,\n                                           arg_3=arg_6['variant_id'], comments=True)\n\n    return {\n        'institute': arg_4,\n        'case': arg_5,\n        'variant': arg_6,\n        'overlapping_snvs': overlapping_snvs,\n        'manual_rank_options': MANUAL_RANK_OPTIONS,\n        'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n    }", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "str_variant", "docstring": "Pre-process an STR variant entry for detail page.\n\n    Adds information to display variant\n\n    Args:\n        store(scout.adapter.MongoAdapter)\n        institute_id(str)\n        case_name(str)\n        variant_id(str)\n\n    Returns:\n        detailed_information(dict): {\n            'institute': <institute_obj>,\n            'case': <case_obj>,\n            'variant': <variant_obj>,\n            'overlapping_snvs': <overlapping_snvs>,\n            'manual_rank_options': MANUAL_RANK_OPTIONS,\n            'dismiss_variant_options': DISMISS_VARIANT_OPTIONS\n        }", "docstring_tokens": ["Pre", "-", "process", "an", "STR", "variant", "entry", "for", "detail", "page", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258868}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L61-L63", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Box volume in m^3.", "language": "python", "parameters": "(self)", "return_statement": "return (self.x2 - self.x1) * (self.y2 - self.y1) * (self.z2 - self.z1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "x2", "-", "arg_0", ".", "x1", ")", "*", "(", "arg_0", ".", "y2", "-", "arg_0", ".", "y1", ")", "*", "(", "arg_0", ".", "z2", "-", "arg_0", ".", "z1", ")"], "function": "def Func(arg_0):\n        \"\"\"Box Func in m^3.\"\"\"\n        return (arg_0.x2 - arg_0.x1) * (arg_0.y2 - arg_0.y1) * (arg_0.z2 - arg_0.z1)", "path": "pybromo/diffusion.py", "identifier": "Box.volume", "docstring": "Box volume in m^3.", "docstring_tokens": ["Box", "volume", "in", "m^3", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 258869}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_manipulation.py#L99-L203", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Runs either SNP or INDEL variant quality score recalibration using GATK VariantRecalibrator. Because the VQSR method\n    models SNPs and INDELs differently, VQSR must be run separately for these variant types.", "language": "python", "parameters": "(job,\n                              mode,\n                              vcf,\n                              ref_fasta, ref_fai, ref_dict,\n                              annotations,\n                              hapmap=None, omni=None, phase=None, dbsnp=None, mills=None,\n                              max_gaussians=4,\n                              unsafe_mode=False)", "return_statement": "return recal_id, tranches_id, plots_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "4", ",", "arg_13", "=", "False", ")", ":", "arg_1", "=", "arg_1", ".", "upper", "(", ")", "arg_14", "=", "{", "'genome.fa'", ":", "arg_3", ",", "'genome.fa.fai'", ":", "arg_4", ",", "'genome.dict'", ":", "arg_5", ",", "'input.vcf'", ":", "arg_2", "}", "arg_15", "=", "[", "'-T'", ",", "'VariantRecalibrator'", ",", "'-R'", ",", "'genome.fa'", ",", "'-input'", ",", "'input.vcf'", ",", "'-tranche'", ",", "'100.0'", ",", "'-tranche'", ",", "'99.9'", ",", "'-tranche'", ",", "'99.0'", ",", "'-tranche'", ",", "'90.0'", ",", "'--maxGaussians'", ",", "str", "(", "arg_12", ")", ",", "'-recalFile'", ",", "'output.recal'", ",", "'-tranchesFile'", ",", "'output.tranches'", ",", "'-rscriptFile'", ",", "'output.plots.R'", "]", "if", "arg_1", "==", "'SNP'", ":", "arg_15", ".", "extend", "(", "[", "'-resource:hapmap,known=false,training=true,truth=true,prior=15.0'", ",", "'hapmap.vcf'", ",", "'-resource:omni,known=false,training=true,truth=true,prior=12.0'", ",", "'omni.vcf'", ",", "'-resource:dbsnp,known=true,training=false,truth=false,prior=2.0'", ",", "'dbsnp.vcf'", ",", "'-resource:1000G,known=false,training=true,truth=false,prior=10.0'", ",", "'1000G.vcf'", ",", "'-mode'", ",", "'SNP'", "]", ")", "arg_14", "[", "'hapmap.vcf'", "]", "=", "arg_7", "arg_14", "[", "'omni.vcf'", "]", "=", "arg_8", "arg_14", "[", "'dbsnp.vcf'", "]", "=", "arg_10", "arg_14", "[", "'1000G.vcf'", "]", "=", "arg_9", "elif", "arg_1", "==", "'INDEL'", ":", "arg_15", ".", "extend", "(", "[", "'-resource:mills,known=false,training=true,truth=true,prior=12.0'", ",", "'mills.vcf'", ",", "'-resource:dbsnp,known=true,training=false,truth=false,prior=2.0'", ",", "'dbsnp.vcf'", ",", "'-mode'", ",", "'INDEL'", "]", ")", "arg_14", "[", "'mills.vcf'", "]", "=", "arg_11", "arg_14", "[", "'dbsnp.vcf'", "]", "=", "arg_10", "else", ":", "raise", "ValueError", "(", "'Variant filter modes can be SNP or INDEL, got %s'", "%", "arg_1", ")", "for", "arg_16", "in", "arg_6", ":", "arg_15", ".", "extend", "(", "[", "'-an'", ",", "arg_16", "]", ")", "if", "arg_13", ":", "arg_15", ".", "extend", "(", "[", "'-U'", ",", "'ALLOW_SEQ_DICT_INCOMPATIBILITY'", "]", ")", "arg_17", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "for", "arg_18", ",", "arg_19", "in", "arg_14", ".", "iteritems", "(", ")", ":", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_19", ",", "os", ".", "path", ".", "join", "(", "arg_17", ",", "arg_18", ")", ")", "arg_0", ".", "fileStore", ".", "logToMaster", "(", "'Running GATK VariantRecalibrator on {mode}s using the following annotations:\\n'", "'{annotations}'", ".", "format", "(", "arg_1", "=", "arg_1", ",", "arg_6", "=", "'\\n'", ".", "join", "(", "arg_6", ")", ")", ")", "arg_20", "=", "[", "'--rm'", ",", "'log-driver'", ",", "'none'", ",", "'-e'", ",", "'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'", ".", "format", "(", "arg_0", ".", "memory", ")", "]", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "workDir", "=", "arg_17", ",", "parameters", "=", "arg_15", ",", "tool", "=", "'quay.io/ucsc_cgl/gatk:3.5--dba6dae49156168a909c43330350c6161dc7ecc2'", ",", "dockerParameters", "=", "arg_20", ")", "arg_21", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_17", ",", "'output.recal'", ")", ")", "arg_22", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_17", ",", "'output.tranches'", ")", ")", "arg_23", "=", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_17", ",", "'output.plots.R'", ")", ")", "return", "arg_21", ",", "arg_22", ",", "arg_23"], "function": "def Func(arg_0,\n                              arg_1,\n                              arg_2,\n                              arg_3, arg_4, arg_5,\n                              arg_6,\n                              arg_7=None, arg_8=None, arg_9=None, arg_10=None, arg_11=None,\n                              arg_12=4,\n                              arg_13=False):\n    \"\"\"\n    Runs either SNP or INDEL variant quality score recalibration using GATK VariantRecalibrator. Because the VQSR method\n    models SNPs and INDELs differently, VQSR must be run separately for these variant types.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str mode: Determines variant recalibration mode (SNP or INDEL)\n    :param str vcf: FileStoreID for input VCF file\n    :param str ref_fasta: FileStoreID for reference genome fasta\n    :param str ref_fai: FileStoreID for reference genome index file\n    :param str ref_dict: FileStoreID for reference genome sequence dictionary file\n    :param list[str] annotations: List of GATK variant annotations to filter on\n    :param str hapmap: FileStoreID for HapMap resource file, required for SNP VQSR\n    :param str omni: FileStoreID for Omni resource file, required for SNP VQSR\n    :param str phase: FileStoreID for 1000G resource file, required for SNP VQSR\n    :param str dbsnp: FilesStoreID for dbSNP resource file, required for SNP and INDEL VQSR\n    :param str mills: FileStoreID for Mills resource file, required for INDEL VQSR\n    :param int max_gaussians: Number of Gaussians used during training, default is 4\n    :param bool unsafe_mode: If True, runs gatk UNSAFE mode: \"-U ALLOW_SEQ_DICT_INCOMPATIBILITY\"\n    :return: FileStoreID for the variant recalibration table, tranche file, and plots file\n    :rtype: tuple\n    \"\"\"\n    arg_1 = arg_1.upper()\n\n    arg_14 = {'genome.fa': arg_3,\n              'genome.fa.fai': arg_4,\n              'genome.dict': arg_5,\n              'input.vcf': arg_2}\n\n    # Refer to GATK documentation for description of recommended parameters:\n    # https://software.broadinstitute.org/gatk/documentation/article?id=1259\n    # https://software.broadinstitute.org/gatk/documentation/article?id=2805\n\n    # This base command includes parameters for both INDEL and SNP VQSR.\n    arg_15 = ['-T', 'VariantRecalibrator',\n               '-R', 'genome.fa',\n               '-input', 'input.vcf',\n               '-tranche', '100.0',\n               '-tranche', '99.9',\n               '-tranche', '99.0',\n               '-tranche', '90.0',\n               '--maxGaussians', str(arg_12),\n               '-recalFile', 'output.recal',\n               '-tranchesFile', 'output.tranches',\n               '-rscriptFile', 'output.plots.R']\n\n    # Parameters and resource files for SNP VQSR.\n    if arg_1 == 'SNP':\n        arg_15.extend(\n            ['-resource:hapmap,known=false,training=true,truth=true,prior=15.0', 'hapmap.vcf',\n             '-resource:omni,known=false,training=true,truth=true,prior=12.0', 'omni.vcf',\n             '-resource:dbsnp,known=true,training=false,truth=false,prior=2.0', 'dbsnp.vcf',\n             '-resource:1000G,known=false,training=true,truth=false,prior=10.0', '1000G.vcf',\n             '-mode', 'SNP'])\n\n        arg_14['hapmap.vcf'] = arg_7\n        arg_14['omni.vcf'] = arg_8\n        arg_14['dbsnp.vcf'] = arg_10\n        arg_14['1000G.vcf'] = arg_9\n\n    # Parameters and resource files for INDEL VQSR\n    elif arg_1 == 'INDEL':\n        arg_15.extend(\n            ['-resource:mills,known=false,training=true,truth=true,prior=12.0', 'mills.vcf',\n             '-resource:dbsnp,known=true,training=false,truth=false,prior=2.0', 'dbsnp.vcf',\n             '-mode', 'INDEL'])\n\n        arg_14['mills.vcf'] = arg_11\n        arg_14['dbsnp.vcf'] = arg_10\n\n    else:\n        raise ValueError('Variant filter modes can be SNP or INDEL, got %s' % arg_1)\n\n    for arg_16 in arg_6:\n        arg_15.extend(['-an', arg_16])\n\n    if arg_13:\n        arg_15.extend(['-U', 'ALLOW_SEQ_DICT_INCOMPATIBILITY'])\n\n    # Delay reading in files until function is configured\n    arg_17 = arg_0.fileStore.getLocalTempDir()\n    for arg_18, arg_19 in arg_14.iteritems():\n        arg_0.fileStore.readGlobalFile(arg_19, os.path.join(arg_17, arg_18))\n\n    arg_0.fileStore.logToMaster('Running GATK VariantRecalibrator on {mode}s using the following annotations:\\n'\n                              '{annotations}'.format(arg_1=arg_1, arg_6='\\n'.join(arg_6)))\n\n    arg_20 = ['--rm', 'log-driver', 'none',\n                         '-e', 'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'.format(arg_0.memory)]\n    dockerCall(arg_0=arg_0, workDir=arg_17,\n               parameters=arg_15,\n               tool='quay.io/ucsc_cgl/gatk:3.5--dba6dae49156168a909c43330350c6161dc7ecc2',\n               dockerParameters=arg_20)\n\n    arg_21 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_17, 'output.recal'))\n    arg_22 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_17, 'output.tranches'))\n    arg_23 = arg_0.fileStore.writeGlobalFile(os.path.join(arg_17, 'output.plots.R'))\n    return arg_21, arg_22, arg_23", "path": "src/toil_lib/tools/variant_manipulation.py", "identifier": "gatk_variant_recalibrator", "docstring": "Runs either SNP or INDEL variant quality score recalibration using GATK VariantRecalibrator. Because the VQSR method\n    models SNPs and INDELs differently, VQSR must be run separately for these variant types.\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str mode: Determines variant recalibration mode (SNP or INDEL)\n    :param str vcf: FileStoreID for input VCF file\n    :param str ref_fasta: FileStoreID for reference genome fasta\n    :param str ref_fai: FileStoreID for reference genome index file\n    :param str ref_dict: FileStoreID for reference genome sequence dictionary file\n    :param list[str] annotations: List of GATK variant annotations to filter on\n    :param str hapmap: FileStoreID for HapMap resource file, required for SNP VQSR\n    :param str omni: FileStoreID for Omni resource file, required for SNP VQSR\n    :param str phase: FileStoreID for 1000G resource file, required for SNP VQSR\n    :param str dbsnp: FilesStoreID for dbSNP resource file, required for SNP and INDEL VQSR\n    :param str mills: FileStoreID for Mills resource file, required for INDEL VQSR\n    :param int max_gaussians: Number of Gaussians used during training, default is 4\n    :param bool unsafe_mode: If True, runs gatk UNSAFE mode: \"-U ALLOW_SEQ_DICT_INCOMPATIBILITY\"\n    :return: FileStoreID for the variant recalibration table, tranche file, and plots file\n    :rtype: tuple", "docstring_tokens": ["Runs", "either", "SNP", "or", "INDEL", "variant", "quality", "score", "recalibration", "using", "GATK", "VariantRecalibrator", ".", "Because", "the", "VQSR", "method", "models", "SNPs", "and", "INDELs", "differently", "VQSR", "must", "be", "run", "separately", "for", "these", "variant", "types", "."], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 258870}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/quaternion.py#L82-L101", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Converts a unit-length quaternion to a sequence\n        of ZYZ Euler angles.", "language": "python", "parameters": "(self)", "return_statement": "return euler", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "to_matrix", "(", ")", "arg_2", "=", "np", ".", "zeros", "(", "3", ",", "dtype", "=", "float", ")", "if", "arg_1", "[", "2", ",", "2", "]", "<", "1", ":", "if", "arg_1", "[", "2", ",", "2", "]", ">", "-", "1", ":", "arg_2", "[", "0", "]", "=", "math", ".", "atan2", "(", "arg_1", "[", "1", ",", "2", "]", ",", "arg_1", "[", "0", ",", "2", "]", ")", "arg_2", "[", "1", "]", "=", "math", ".", "acos", "(", "arg_1", "[", "2", ",", "2", "]", ")", "arg_2", "[", "2", "]", "=", "math", ".", "atan2", "(", "arg_1", "[", "2", ",", "1", "]", ",", "-", "arg_1", "[", "2", ",", "0", "]", ")", "else", ":", "arg_2", "[", "0", "]", "=", "-", "math", ".", "atan2", "(", "arg_1", "[", "1", ",", "0", "]", ",", "arg_1", "[", "1", ",", "1", "]", ")", "arg_2", "[", "1", "]", "=", "np", ".", "pi", "else", ":", "arg_2", "[", "0", "]", "=", "math", ".", "atan2", "(", "arg_1", "[", "1", ",", "0", "]", ",", "arg_1", "[", "1", ",", "1", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Converts a unit-length quaternion to a sequence\n        of ZYZ Euler angles.\n\n        Returns:\n            ndarray: Array of Euler angles.\n        \"\"\"\n        arg_1 = arg_0.to_matrix()\n        arg_2 = np.zeros(3, dtype=float)\n        if arg_1[2, 2] < 1:\n            if arg_1[2, 2] > -1:\n                arg_2[0] = math.atan2(arg_1[1, 2], arg_1[0, 2])\n                arg_2[1] = math.acos(arg_1[2, 2])\n                arg_2[2] = math.atan2(arg_1[2, 1], -arg_1[2, 0])\n            else:\n                arg_2[0] = -math.atan2(arg_1[1, 0], arg_1[1, 1])\n                arg_2[1] = np.pi\n        else:\n            arg_2[0] = math.atan2(arg_1[1, 0], arg_1[1, 1])\n        return arg_2", "path": "qiskit/quantum_info/operators/quaternion.py", "identifier": "Quaternion.to_zyz", "docstring": "Converts a unit-length quaternion to a sequence\n        of ZYZ Euler angles.\n\n        Returns:\n            ndarray: Array of Euler angles.", "docstring_tokens": ["Converts", "a", "unit", "-", "length", "quaternion", "to", "a", "sequence", "of", "ZYZ", "Euler", "angles", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258871}
{"url": "https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L93-L141", "sha": "cd5c6e10c6c4e653669e11d735d5773766986bda", "docstring_summary": "Call API.", "language": "python", "parameters": "(\n            self,\n            method,\n            url,\n            headers=None,\n            params=None,\n            data=None,\n            files=None,\n            timeout=None,\n    )", "return_statement": "return r, r.status_code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", ")", ":", "arg_1", "=", "arg_1", ".", "upper", "(", ")", "arg_3", "=", "deepcopy", "(", "arg_3", ")", "or", "{", "}", "arg_3", "[", "'Accept'", "]", "=", "arg_0", ".", "accept_type", "arg_4", "=", "deepcopy", "(", "arg_4", ")", "or", "{", "}", "arg_5", "=", "arg_5", "or", "{", "}", "arg_6", "=", "arg_6", "or", "{", "}", "if", "arg_0", ".", "username", "and", "arg_0", ".", "api_key", ":", "arg_4", ".", "update", "(", "arg_0", ".", "get_credentials", "(", ")", ")", "arg_2", "=", "urljoin", "(", "arg_0", ".", "base_url", ",", "arg_2", ")", "arg_8", "=", "requests", ".", "request", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", ")", "return", "arg_8", ",", "arg_8", ".", "status_code"], "function": "def Func(\n            arg_0,\n            arg_1,\n            arg_2,\n            arg_3=None,\n            arg_4=None,\n            arg_5=None,\n            arg_6=None,\n            arg_7=None,\n    ):\n        \"\"\" Call API.\n\n        This returns object containing data, with error details if applicable.\n\n        Args:\n            method (str): The HTTP method to use.\n            url (str): Resource location relative to the base URL.\n            headers (dict or None): Extra request headers to set.\n            params (dict or None): Query-string parameters.\n            data (dict or None): Request body contents for POST or PUT requests.\n            files (dict or None: Files to be passed to the request.\n            timeout (int): Maximum time before timing out.\n\n        Returns:\n            ResultParser or ErrorParser.\n        \"\"\"\n        arg_1 = arg_1.upper()\n        arg_3 = deepcopy(arg_3) or {}\n        arg_3['Accept'] = arg_0.accept_type\n        arg_4 = deepcopy(arg_4) or {}\n        arg_5 = arg_5 or {}\n        arg_6 = arg_6 or {}\n\n        if arg_0.username and arg_0.api_key:\n            arg_4.update(arg_0.get_credentials())\n\n        arg_2 = urljoin(arg_0.base_url, arg_2)\n\n        arg_8 = requests.request(\n            arg_1,\n            arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_6=arg_6,\n            arg_5=arg_5,\n            arg_7=arg_7,\n        )\n\n        return arg_8, arg_8.status_code", "path": "nerd/client.py", "identifier": "ApiClient.call_api", "docstring": "Call API.\n\n        This returns object containing data, with error details if applicable.\n\n        Args:\n            method (str): The HTTP method to use.\n            url (str): Resource location relative to the base URL.\n            headers (dict or None): Extra request headers to set.\n            params (dict or None): Query-string parameters.\n            data (dict or None): Request body contents for POST or PUT requests.\n            files (dict or None: Files to be passed to the request.\n            timeout (int): Maximum time before timing out.\n\n        Returns:\n            ResultParser or ErrorParser.", "docstring_tokens": ["Call", "API", "."], "nwo": "hirmeos/entity-fishing-client-python", "score": 0.36576314591848075, "idx": 258872}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L121-L164", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Load marker data from a C3D file.", "language": "python", "parameters": "(self, filename, start_frame=0, max_frames=int(1e300))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "arg_4", "(", "1e300", ")", ")", ":", "import", "c3d", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "handle", ":", "arg_5", "=", "c3d", ".", "Reader", "(", "handle", ")", "logging", ".", "info", "(", "'world frame rate %s, marker frame rate %s'", ",", "1", "/", "arg_0", ".", "world", ".", "dt", ",", "arg_5", ".", "point_rate", ")", "arg_0", ".", "channels", "=", "arg_0", ".", "_map_labels_to_channels", "(", "[", "s", ".", "strip", "(", ")", "for", "s", "in", "arg_5", ".", "point_labels", "]", ")", "arg_7", "=", "[", "]", "for", "arg_8", ",", "(", "arg_9", ",", "arg_10", ",", "arg_9", ")", "in", "enumerate", "(", "arg_5", ".", "read_frames", "(", ")", ")", ":", "if", "arg_8", ">=", "arg_2", ":", "arg_7", ".", "append", "(", "arg_10", "[", ":", ",", "[", "0", ",", "1", ",", "2", ",", "4", "]", "]", ")", "if", "len", "(", "arg_7", ")", ">", "arg_3", ":", "break", "arg_0", ".", "data", "=", "np", ".", "array", "(", "arg_7", ")", "if", "arg_5", ".", "get", "(", "'POINT:UNITS'", ")", ".", "string_value", ".", "strip", "(", ")", ".", "lower", "(", ")", "==", "'mm'", ":", "logging", ".", "info", "(", "'scaling point data from mm to m'", ")", "arg_0", ".", "data", "[", ":", ",", ":", ",", ":", "3", "]", "/=", "1000.", "logging", ".", "info", "(", "'%s: loaded marker data %s'", ",", "arg_1", ",", "arg_0", ".", "data", ".", "shape", ")", "arg_0", ".", "process_data", "(", ")", "arg_0", ".", "create_bodies", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=arg_4(1e300)):\n        '''Load marker data from a C3D file.\n\n        The file will be imported using the c3d module, which must be installed\n        to use this method. (``pip install c3d``)\n\n        Parameters\n        ----------\n        filename : str\n            Name of the C3D file to load.\n        start_frame : int, optional\n            Discard the first N frames. Defaults to 0.\n        max_frames : int, optional\n            Maximum number of frames to load. Defaults to loading all frames.\n        '''\n        import c3d\n\n        with open(arg_1, 'rb') as handle:\n            arg_5 = c3d.Reader(handle)\n\n            logging.info('world frame rate %s, marker frame rate %s',\n                         1 / arg_0.world.dt, arg_5.point_rate)\n\n            # set up a map from marker label to index in the data stream.\n            arg_0.channels = arg_0._map_labels_to_channels([\n                s.strip() for s in arg_5.point_labels])\n\n            # read the actual c3d data into a numpy array.\n            arg_7 = []\n            for arg_8, (arg_9, arg_10, arg_9) in enumerate(arg_5.read_frames()):\n                if arg_8 >= arg_2:\n                    arg_7.append(arg_10[:, [0, 1, 2, 4]])\n                if len(arg_7) > arg_3:\n                    break\n            arg_0.data = np.array(arg_7)\n\n            # scale the data to meters -- mm is a very common C3D unit.\n            if arg_5.get('POINT:UNITS').string_value.strip().lower() == 'mm':\n                logging.info('scaling point data from mm to m')\n                arg_0.data[:, :, :3] /= 1000.\n\n        logging.info('%s: loaded marker data %s', arg_1, arg_0.data.shape)\n        arg_0.process_data()\n        arg_0.create_bodies()", "path": "pagoda/cooper.py", "identifier": "Markers.load_c3d", "docstring": "Load marker data from a C3D file.\n\n        The file will be imported using the c3d module, which must be installed\n        to use this method. (``pip install c3d``)\n\n        Parameters\n        ----------\n        filename : str\n            Name of the C3D file to load.\n        start_frame : int, optional\n            Discard the first N frames. Defaults to 0.\n        max_frames : int, optional\n            Maximum number of frames to load. Defaults to loading all frames.", "docstring_tokens": ["Load", "marker", "data", "from", "a", "C3D", "file", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 258873}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py#L241-L243", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Verifies the given signature matches the expected signature", "language": "python", "parameters": "(self, key, value, sig)", "return_statement": "return constant_time_compare(sig, self.get_signature(key, value))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "constant_time_compare", "(", "arg_3", ",", "arg_0", ".", "get_signature", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Verifies the given signature matches the expected signature\"\"\"\n        return constant_time_compare(arg_3, arg_0.get_signature(arg_1, arg_2))", "path": "capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py", "identifier": "SigningAlgorithm.verify_signature", "docstring": "Verifies the given signature matches the expected signature", "docstring_tokens": ["Verifies", "the", "given", "signature", "matches", "the", "expected", "signature"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 258874}
{"url": "https://github.com/ankitmathur3193/song-cli/blob/ca8ccfe547e9d702313ff6d14e81ae4355989a67/song/commands/FileDownload.py#L77-L84", "sha": "ca8ccfe547e9d702313ff6d14e81ae4355989a67", "docstring_summary": "It will download file specified by url using wget utility of linux", "language": "python", "parameters": "(self,url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "print", "'Downloading file %s '", "%", "arg_2", "arg_3", "=", "'wget -c --read-timeout=50 --tries=3 -q --show-progress --no-check-certificate '", "arg_1", "=", "'\"'", "+", "arg_1", "+", "'\"'", "arg_3", "=", "arg_3", "+", "arg_1", "os", ".", "system", "(", "arg_3", ")"], "function": "def Func(arg_0,arg_1):\n\t\t'''It will download file specified by url using wget utility of linux '''\n\t\targ_2=arg_1.split('/')[-1]\n\t\tprint 'Downloading file %s '%arg_2\n\t\targ_3='wget -c --read-timeout=50 --tries=3 -q --show-progress --no-check-certificate '\n\t\targ_1='\"'+arg_1+'\"'\n\t\targ_3=arg_3+arg_1\n\t\tos.system(arg_3)", "path": "song/commands/FileDownload.py", "identifier": "FileDownload.file_download_using_wget", "docstring": "It will download file specified by url using wget utility of linux", "docstring_tokens": ["It", "will", "download", "file", "specified", "by", "url", "using", "wget", "utility", "of", "linux"], "nwo": "ankitmathur3193/song-cli", "score": 0.1872672106339659, "idx": 258875}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L48-L73", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Construct an `LsstLatexDoc` instance by reading and parsing the\n        LaTeX source.", "language": "python", "parameters": "(cls, root_tex_path)", "return_statement": "return cls(tex_source, root_dir=root_dir)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "arg_3", "=", "Func_tex_file", "(", "arg_1", ")", "arg_4", "=", "get_macros", "(", "arg_3", ")", "arg_3", "=", "replace_macros", "(", "arg_3", ",", "arg_4", ")", "return", "arg_0", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Construct an `LsstLatexDoc` instance by Funcing and parsing the\n        LaTeX source.\n\n        Parameters\n        ----------\n        root_tex_path : `str`\n            Path to the LaTeX source on the filesystem. For multi-file LaTeX\n            projects this should be the path to the root document.\n\n        Notes\n        -----\n        This method implements the following pipeline:\n\n        1. `lsstprojectmeta.tex.normalizer.Func_tex_file`\n        2. `lsstprojectmeta.tex.scraper.get_macros`\n        3. `lsstprojectmeta.tex.normalizer.replace_macros`\n\n        Thus ``input`` and ``includes`` are resolved along with simple macros.\n        \"\"\"\n        # Read and normalize the TeX source, replacing macros with content\n        arg_2 = os.path.dirname(arg_1)\n        arg_3 = Func_tex_file(arg_1)\n        arg_4 = get_macros(arg_3)\n        arg_3 = replace_macros(arg_3, arg_4)\n        return arg_0(arg_3, arg_2=arg_2)", "path": "lsstprojectmeta/tex/lsstdoc.py", "identifier": "LsstLatexDoc.read", "docstring": "Construct an `LsstLatexDoc` instance by reading and parsing the\n        LaTeX source.\n\n        Parameters\n        ----------\n        root_tex_path : `str`\n            Path to the LaTeX source on the filesystem. For multi-file LaTeX\n            projects this should be the path to the root document.\n\n        Notes\n        -----\n        This method implements the following pipeline:\n\n        1. `lsstprojectmeta.tex.normalizer.read_tex_file`\n        2. `lsstprojectmeta.tex.scraper.get_macros`\n        3. `lsstprojectmeta.tex.normalizer.replace_macros`\n\n        Thus ``input`` and ``includes`` are resolved along with simple macros.", "docstring_tokens": ["Construct", "an", "LsstLatexDoc", "instance", "by", "reading", "and", "parsing", "the", "LaTeX", "source", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 258876}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/normalization.py#L82-L89", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "The multiplication counter part of tf.nn.bias_add.", "language": "python", "parameters": "(x, b, data_format)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "'NHWC'", ":", "return", "arg_0", "*", "arg_1", "elif", "arg_2", "==", "'NCHW'", ":", "return", "arg_0", "*", "_to_channel_first_bias", "(", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "'invalid data_format: %s'", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"The multiplication counter part of tf.nn.bias_add.\"\"\"\n    if arg_2 == 'NHWC':\n        return arg_0 * arg_1\n    elif arg_2 == 'NCHW':\n        return arg_0 * _to_channel_first_bias(arg_1)\n    else:\n        raise ValueError('invalid data_format: %s' % arg_2)", "path": "tensorlayer/layers/normalization.py", "identifier": "_bias_scale", "docstring": "The multiplication counter part of tf.nn.bias_add.", "docstring_tokens": ["The", "multiplication", "counter", "part", "of", "tf", ".", "nn", ".", "bias_add", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 258877}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/widgets.py#L66-L106", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Get the context to render this widget with.", "language": "python", "parameters": "(self, name, value, attrs)", "return_statement": "return context", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ".", "has_template_widget_rendering", ":", "arg_4", "=", "super", "(", "ClearableFileInputWithImagePreview", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "else", ":", "arg_4", "=", "{", "}", "arg_4", "[", "'widget'", "]", "=", "{", "'name'", ":", "arg_1", ",", "'is_hidden'", ":", "arg_0", ".", "is_hidden", ",", "'required'", ":", "arg_0", ".", "is_required", ",", "'value'", ":", "arg_0", ".", "_format_value", "(", "arg_2", ")", ",", "'attrs'", ":", "arg_0", ".", "build_attrs", "(", "arg_0", ".", "attrs", ",", "arg_3", ")", ",", "'template_name'", ":", "arg_0", ".", "template_name", ",", "'type'", ":", "arg_0", ".", "input_type", ",", "}", "arg_5", "=", "arg_0", ".", "clear_checkbox_name", "(", "arg_1", ")", "arg_6", "=", "arg_0", ".", "clear_checkbox_id", "(", "arg_5", ")", "arg_4", "[", "'widget'", "]", ".", "update", "(", "{", "'checkbox_name'", ":", "arg_5", ",", "'checkbox_id'", ":", "arg_6", ",", "'is_initial'", ":", "arg_0", ".", "is_initial", "(", "arg_2", ")", ",", "'input_text'", ":", "arg_0", ".", "input_text", ",", "'initial_text'", ":", "arg_0", ".", "initial_text", ",", "'clear_checkbox_label'", ":", "arg_0", ".", "clear_checkbox_label", ",", "}", ")", "if", "arg_2", "and", "hasattr", "(", "arg_2", ",", "\"url\"", ")", ":", "arg_4", "[", "'widget'", "]", ".", "update", "(", "{", "'hidden_field_id'", ":", "arg_0", ".", "get_hidden_field_id", "(", "arg_1", ")", ",", "'point_stage_id'", ":", "arg_0", ".", "get_point_stage_id", "(", "arg_1", ")", ",", "'ppoi_id'", ":", "arg_0", ".", "get_ppoi_id", "(", "arg_1", ")", ",", "'sized_url'", ":", "arg_0", ".", "get_sized_url", "(", "arg_2", ")", ",", "'image_preview_id'", ":", "arg_0", ".", "image_preview_id", "(", "arg_1", ")", ",", "}", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Get the context to render this widget with.\"\"\"\n        if arg_0.has_template_widget_rendering:\n            arg_4 = super(ClearableFileInputWithImagePreview, arg_0).Func(arg_1, arg_2, arg_3)\n        else:\n            # Build the context manually.\n            arg_4 = {}\n            arg_4['widget'] = {\n                'name': arg_1,\n                'is_hidden': arg_0.is_hidden,\n                'required': arg_0.is_required,\n                'value': arg_0._format_value(arg_2),\n                'attrs': arg_0.build_attrs(arg_0.attrs, arg_3),\n                'template_name': arg_0.template_name,\n                'type': arg_0.input_type,\n            }\n\n        # It seems Django 1.11's ClearableFileInput doesn't add everything to the 'widget' key, so we can't use it\n        # in MultiWidget. Add it manually here.\n        arg_5 = arg_0.clear_checkbox_name(arg_1)\n        arg_6 = arg_0.clear_checkbox_id(arg_5)\n\n        arg_4['widget'].update({\n            'checkbox_name': arg_5,\n            'checkbox_id': arg_6,\n            'is_initial': arg_0.is_initial(arg_2),\n            'input_text': arg_0.input_text,\n            'initial_text': arg_0.initial_text,\n            'clear_checkbox_label': arg_0.clear_checkbox_label,\n        })\n\n        if arg_2 and hasattr(arg_2, \"url\"):\n            arg_4['widget'].update({\n                'hidden_field_id': arg_0.get_hidden_field_id(arg_1),\n                'point_stage_id': arg_0.get_point_stage_id(arg_1),\n                'ppoi_id': arg_0.get_ppoi_id(arg_1),\n                'sized_url': arg_0.get_sized_url(arg_2),\n                'image_preview_id': arg_0.image_preview_id(arg_1),\n            })\n\n        return arg_4", "path": "versatileimagefield/widgets.py", "identifier": "ClearableFileInputWithImagePreview.get_context", "docstring": "Get the context to render this widget with.", "docstring_tokens": ["Get", "the", "context", "to", "render", "this", "widget", "with", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 258878}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/sp/hello_sp.py#L81-L89", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Run the spatial pooler with the input vector", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "\"-\"", "*", "80", "+", "\"Computing the SDR\"", "+", "\"-\"", "*", "80", "arg_0", ".", "sp", ".", "compute", "(", "arg_0", ".", "inputArray", ",", "True", ",", "arg_0", ".", "activeArray", ")", "print", "arg_0", ".", "activeArray", ".", "nonzero", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Run the spatial pooler with the input vector\"\"\"\n\n    print \"-\" * 80 + \"Computing the SDR\" + \"-\" * 80\n\n    #activeArray[column]=1 if column is active after spatial pooling\n    arg_0.sp.compute(arg_0.inputArray, True, arg_0.activeArray)\n\n    print arg_0.activeArray.nonzero()", "path": "examples/sp/hello_sp.py", "identifier": "Example.run", "docstring": "Run the spatial pooler with the input vector", "docstring_tokens": ["Run", "the", "spatial", "pooler", "with", "the", "input", "vector"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 258879}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/optimize_1q_gates.py#L238-L254", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Finds runs containing parameterized gates and splits them into sequential\n    runs excluding the parameterized gates.", "language": "python", "parameters": "(runs)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_is_dagnode_parameterized", "(", "arg_1", ")", ":", "return", "any", "(", "isinstance", "(", "arg_2", ",", "Parameter", ")", "for", "arg_2", "in", "arg_1", ".", "op", ".", "params", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "groupby", "(", "arg_4", ",", "_is_dagnode_parameterized", ")", "for", "arg_6", ",", "arg_7", "in", "arg_5", ":", "if", "not", "arg_6", ":", "arg_3", ".", "append", "(", "list", "(", "arg_7", ")", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Finds runs containing parameterized gates and splits them into sequential\n    runs excluding the parameterized gates.\n    \"\"\"\n\n    def _is_dagnode_parameterized(arg_1):\n        return any(isinstance(arg_2, Parameter) for arg_2 in arg_1.op.params)\n\n    arg_3 = []\n    for arg_4 in arg_0:\n        arg_5 = groupby(arg_4, _is_dagnode_parameterized)\n\n        for arg_6, arg_7 in arg_5:\n            if not arg_6:\n                arg_3.append(list(arg_7))\n\n    return arg_3", "path": "qiskit/transpiler/passes/optimize_1q_gates.py", "identifier": "_split_runs_on_parameters", "docstring": "Finds runs containing parameterized gates and splits them into sequential\n    runs excluding the parameterized gates.", "docstring_tokens": ["Finds", "runs", "containing", "parameterized", "gates", "and", "splits", "them", "into", "sequential", "runs", "excluding", "the", "parameterized", "gates", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 258880}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/waveform.py#L97-L123", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Generate the mexican hat wavelet", "language": "python", "parameters": "(lb, ub, n)", "return_statement": "return psi", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "<=", "0", ":", "raise", "ValueError", "(", "\"n must be strictly positive\"", ")", "arg_3", "=", "numpy", ".", "linspace", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_4", "=", "(", "1.", "-", "arg_3", "**", "2.", ")", "*", "(", "2.", "/", "(", "numpy", ".", "sqrt", "(", "3.", ")", "*", "pi", "**", "0.25", ")", ")", "*", "numpy", ".", "exp", "(", "-", "arg_3", "**", "2", "/", "2.", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    r\"\"\"Generate the Func hat wavelet\n\n    The Mexican wavelet is:\n\n    .. math:: w[x] = \\cos{5x}  \\exp^{-x^2/2}\n\n    :param lb: lower bound\n    :param ub: upper bound\n    :param int n: waveform data samples\n    :return: the waveform\n\n    .. plot::\n        :include-source:\n        :width: 80%\n\n        from spectrum import Func\n        from pylab import plot\n        plot(Func(0, 10, 100))\n\n    \"\"\"\n    if arg_2 <= 0:\n        raise ValueError(\"n must be strictly positive\")\n\n    arg_3 = numpy.linspace(arg_0, arg_1, arg_2)\n    arg_4 = (1.-arg_3**2.) * (2./(numpy.sqrt(3.)*pi**0.25)) * numpy.exp(-arg_3**2/2.)\n    return arg_4", "path": "src/spectrum/waveform.py", "identifier": "mexican", "docstring": "r\"\"\"Generate the mexican hat wavelet\n\n    The Mexican wavelet is:\n\n    .. math:: w[x] = \\cos{5x}  \\exp^{-x^2/2}\n\n    :param lb: lower bound\n    :param ub: upper bound\n    :param int n: waveform data samples\n    :return: the waveform\n\n    .. plot::\n        :include-source:\n        :width: 80%\n\n        from spectrum import mexican\n        from pylab import plot\n        plot(mexican(0, 10, 100))", "docstring_tokens": ["r", "Generate", "the", "mexican", "hat", "wavelet"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 258881}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/bip38.py#L46-L80", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "BIP0038 non-ec-multiply encryption. Returns BIP0038 encrypted privkey.", "language": "python", "parameters": "(privkey, passphrase)", "return_statement": "return Base58(privatkey)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_0", "=", "PrivateKey", "(", "arg_0", ")", "else", ":", "arg_0", "=", "PrivateKey", "(", "repr", "(", "arg_0", ")", ")", "arg_2", "=", "repr", "(", "arg_0", ")", "arg_3", "=", "format", "(", "arg_0", ".", "bitcoin", ".", "address", ",", "\"BTC\"", ")", "arg_4", "=", "_bytes", "(", "arg_3", ")", "arg_5", "=", "hashlib", ".", "sha256", "(", "hashlib", ".", "sha256", "(", "arg_4", ")", ".", "digest", "(", ")", ")", ".", "digest", "(", ")", "[", "0", ":", "4", "]", "if", "SCRYPT_MODULE", "==", "\"scrypt\"", ":", "arg_6", "=", "scrypt", ".", "hash", "(", "arg_1", ",", "arg_5", ",", "16384", ",", "8", ",", "8", ")", "elif", "SCRYPT_MODULE", "==", "\"pylibscrypt\"", ":", "arg_6", "=", "scrypt", ".", "scrypt", "(", "bytes", "(", "arg_1", ",", "\"utf-8\"", ")", ",", "arg_5", ",", "16384", ",", "8", ",", "8", ")", "else", ":", "raise", "ValueError", "(", "\"No scrypt module loaded\"", ")", "(", "arg_7", ",", "arg_8", ")", "=", "(", "arg_6", "[", ":", "32", "]", ",", "arg_6", "[", "32", ":", "]", ")", "arg_9", "=", "AES", ".", "new", "(", "arg_8", ",", "AES", ".", "MODE_ECB", ")", "arg_10", "=", "_Func_xor", "(", "arg_2", "[", ":", "32", "]", ",", "arg_7", "[", ":", "16", "]", ",", "arg_9", ")", "arg_11", "=", "_Func_xor", "(", "arg_2", "[", "32", ":", "]", ",", "arg_7", "[", "16", ":", "]", ",", "arg_9", ")", "arg_12", "=", "b\"\\x01\"", "+", "b\"\\x42\"", "+", "b\"\\xc0\"", "+", "arg_5", "+", "arg_10", "+", "arg_11", "arg_13", "=", "hashlib", ".", "sha256", "(", "hashlib", ".", "sha256", "(", "arg_12", ")", ".", "digest", "(", ")", ")", ".", "digest", "(", ")", "[", ":", "4", "]", "arg_14", "=", "hexlify", "(", "arg_12", "+", "arg_13", ")", ".", "decode", "(", "\"ascii\"", ")", "return", "Base58", "(", "arg_14", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" BIP0038 non-ec-multiply Funcion. Returns BIP0038 Funced privkey.\n\n    :param privkey: Private key\n    :type privkey: Base58\n    :param str passphrase: UTF-8 encoded passphrase for Funcion\n    :return: BIP0038 non-ec-multiply Funced wif key\n    :rtype: Base58\n\n    \"\"\"\n    if isinstance(arg_0, str):\n        arg_0 = PrivateKey(arg_0)\n    else:\n        arg_0 = PrivateKey(repr(arg_0))\n\n    arg_2 = repr(arg_0)  # hex\n    arg_3 = format(arg_0.bitcoin.address, \"BTC\")\n    arg_4 = _bytes(arg_3)\n    arg_5 = hashlib.sha256(hashlib.sha256(arg_4).digest()).digest()[0:4]\n    if SCRYPT_MODULE == \"scrypt\":  # pragma: no cover\n        arg_6 = scrypt.hash(arg_1, arg_5, 16384, 8, 8)\n    elif SCRYPT_MODULE == \"pylibscrypt\":  # pragma: no cover\n        arg_6 = scrypt.scrypt(bytes(arg_1, \"utf-8\"), arg_5, 16384, 8, 8)\n    else:  # pragma: no cover\n        raise ValueError(\"No scrypt module loaded\")  # pragma: no cover\n    (arg_7, arg_8) = (arg_6[:32], arg_6[32:])\n    arg_9 = AES.new(arg_8, AES.MODE_ECB)\n    arg_10 = _Func_xor(arg_2[:32], arg_7[:16], arg_9)\n    arg_11 = _Func_xor(arg_2[32:], arg_7[16:], arg_9)\n    \" flag byte is forced 0xc0 because Graphene only uses compressed keys \"\n    arg_12 = b\"\\x01\" + b\"\\x42\" + b\"\\xc0\" + arg_5 + arg_10 + arg_11\n    \" Checksum \"\n    arg_13 = hashlib.sha256(hashlib.sha256(arg_12).digest()).digest()[:4]\n    arg_14 = hexlify(arg_12 + arg_13).decode(\"ascii\")\n    return Base58(arg_14)", "path": "graphenebase/bip38.py", "identifier": "encrypt", "docstring": "BIP0038 non-ec-multiply encryption. Returns BIP0038 encrypted privkey.\n\n    :param privkey: Private key\n    :type privkey: Base58\n    :param str passphrase: UTF-8 encoded passphrase for encryption\n    :return: BIP0038 non-ec-multiply encrypted wif key\n    :rtype: Base58", "docstring_tokens": ["BIP0038", "non", "-", "ec", "-", "multiply", "encryption", ".", "Returns", "BIP0038", "encrypted", "privkey", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 258882}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/base.py#L501-L543", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Attempts to decipher encoded messages from the transactions in\n        the bundle.", "language": "python", "parameters": "(self, errors='drop')", "return_statement": "return messages", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'drop'", ")", ":", "arg_2", "=", "'strict'", "if", "arg_1", "==", "'drop'", "else", "arg_1", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "group_transactions", "(", ")", ":", "if", "arg_4", "[", "0", "]", ".", "value", "<", "0", ":", "continue", "arg_5", "=", "TryteString", "(", "b''", ")", "for", "arg_6", "in", "arg_4", ":", "arg_5", "+=", "arg_6", ".", "signature_message_fragment", "if", "arg_5", ":", "try", ":", "arg_3", ".", "append", "(", "arg_5", ".", "decode", "(", "arg_2", ")", ")", "except", "(", "TrytesDecodeError", ",", "UnicodeDecodeError", ")", ":", "if", "arg_1", "!=", "'drop'", ":", "raise", "return", "arg_3"], "function": "def Func(arg_0, arg_1='drop'):\n        # type: (Text) -> List[Text]\n        \"\"\"\n        Attempts to decipher encoded messages from the transactions in\n        the bundle.\n\n        :param errors:\n            How to handle trytes that can't be converted, or bytes that\n            can't be decoded using UTF-8:\n\n            'drop'\n                Drop the trytes from the result.\n\n            'strict'\n                Raise an exception.\n\n            'replace'\n                Replace with a placeholder character.\n\n            'ignore'\n                Omit the invalid tryte/byte sequence.\n        \"\"\"\n        arg_2 = 'strict' if arg_1 == 'drop' else arg_1\n\n        arg_3 = []\n\n        for arg_4 in arg_0.group_transactions():\n            # Ignore inputs.\n            if arg_4[0].value < 0:\n                continue\n\n            arg_5 = TryteString(b'')\n            for arg_6 in arg_4:\n                arg_5 += arg_6.signature_message_fragment\n\n            if arg_5:\n                try:\n                    arg_3.append(arg_5.decode(arg_2))\n                except (TrytesDecodeError, UnicodeDecodeError):\n                    if arg_1 != 'drop':\n                        raise\n\n        return arg_3", "path": "iota/transaction/base.py", "identifier": "Bundle.get_messages", "docstring": "Attempts to decipher encoded messages from the transactions in\n        the bundle.\n\n        :param errors:\n            How to handle trytes that can't be converted, or bytes that\n            can't be decoded using UTF-8:\n\n            'drop'\n                Drop the trytes from the result.\n\n            'strict'\n                Raise an exception.\n\n            'replace'\n                Replace with a placeholder character.\n\n            'ignore'\n                Omit the invalid tryte/byte sequence.", "docstring_tokens": ["Attempts", "to", "decipher", "encoded", "messages", "from", "the", "transactions", "in", "the", "bundle", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 258883}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L302-L328", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "generate rate steady", "language": "python", "parameters": "(process_data, para_meter, scale, steady_time)", "return_statement": "return pic_path_steady", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", "[", "'filename'", "]", "+", "'_steady.png'", "plt", ".", "figure", "(", "figsize", "=", "(", "4", "*", "arg_2", ",", "2.5", "*", "arg_2", ")", ")", "for", "arg_5", "in", "arg_0", ".", "keys", "(", ")", ":", "if", "len", "(", "arg_0", "[", "arg_5", "]", ")", "<", "arg_3", ":", "arg_3", "=", "len", "(", "arg_0", "[", "arg_5", "]", ")", "plt", ".", "scatter", "(", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "0", "]", ",", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "1", "]", ",", "label", "=", "str", "(", "arg_5", ")", ",", "s", "=", "10", ")", "arg_6", "=", "np", ".", "mean", "(", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "1", "]", ")", "arg_7", "=", "arg_6", "*", "(", "1", "+", "0.05", ")", "arg_8", "=", "arg_6", "*", "(", "1", "+", "0.1", ")", "arg_9", "=", "arg_6", "*", "(", "1", "-", "0.05", ")", "arg_10", "=", "arg_6", "*", "(", "1", "-", "0.1", ")", "plt", ".", "plot", "(", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "0", "]", ",", "[", "arg_6", "]", "*", "arg_3", ",", "'b'", ")", "plt", ".", "plot", "(", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "0", "]", ",", "[", "arg_7", "]", "*", "arg_3", ",", "'g'", ")", "plt", ".", "plot", "(", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "0", "]", ",", "[", "arg_9", "]", "*", "arg_3", ",", "'g'", ")", "plt", ".", "plot", "(", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "0", "]", ",", "[", "arg_8", "]", "*", "arg_3", ",", "'r'", ")", "plt", ".", "plot", "(", "arg_0", "[", "arg_5", "]", "[", "-", "1", "*", "arg_3", ":", ",", "0", "]", ",", "[", "arg_10", "]", "*", "arg_3", ",", "'r'", ")", "plt", ".", "title", "(", "arg_1", "[", "'title'", "]", "+", "'(steady)'", ")", "plt", ".", "xlabel", "(", "arg_1", "[", "'x_axis_name'", "]", "+", "'(steady)'", ")", "plt", ".", "ylabel", "(", "arg_1", "[", "'y_axis_name'", "]", "+", "'(steady)'", ")", "plt", ".", "legend", "(", "loc", "=", "'upper left'", ")", "plt", ".", "savefig", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\r\n    \"\"\" generate rate steady\"\"\"\r\n    arg_4 = arg_1['filename'] + '_steady.png'\r\n    plt.figure(figsize=(4 * arg_2, 2.5 * arg_2))\r\n    for arg_5 in arg_0.keys():\r\n        if len(arg_0[arg_5]) < arg_3:\r\n            arg_3 = len(arg_0[arg_5])\r\n        plt.scatter(arg_0[arg_5][-1 * arg_3:, 0],\r\n                    arg_0[arg_5][-1 * arg_3:, 1], label=str(arg_5), s=10)\r\n        arg_6 = np.mean(arg_0[arg_5][-1 * arg_3:, 1])\r\n        arg_7 = arg_6 * (1 + 0.05)\r\n        arg_8 = arg_6 * (1 + 0.1)\r\n        arg_9 = arg_6 * (1 - 0.05)\r\n        arg_10 = arg_6 * (1 - 0.1)\r\n        plt.plot(arg_0[arg_5][-1 * arg_3:, 0], [arg_6] * arg_3, 'b')\r\n        plt.plot(arg_0[arg_5][-1 * arg_3:, 0], [arg_7] * arg_3, 'g')\r\n        plt.plot(arg_0[arg_5][-1 * arg_3:, 0],\r\n                 [arg_9] * arg_3, 'g')\r\n        plt.plot(arg_0[arg_5][-1 * arg_3:, 0], [arg_8] * arg_3, 'r')\r\n        plt.plot(arg_0[arg_5][-1 * arg_3:, 0],\r\n                 [arg_10] * arg_3, 'r')\r\n    plt.title(arg_1['title'] + '(steady)')\r\n    plt.xlabel(arg_1['x_axis_name'] + '(steady)')\r\n    plt.ylabel(arg_1['y_axis_name'] + '(steady)')\r\n    plt.legend(loc='upper left')\r\n    plt.savefig(arg_4)\r\n    return arg_4", "path": "modules/cij/xlsx.py", "identifier": "generate_steady_rt_pic", "docstring": "generate rate steady", "docstring_tokens": ["generate", "rate", "steady"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 258884}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L1194-L1246", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Parse HTTP_IF header into a dictionary and lists, and cache the result.", "language": "python", "parameters": "(environ)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "\"wsgidav.conditions.if\"", "in", "arg_0", ":", "return", "if", "\"HTTP_IF\"", "not", "in", "arg_0", ":", "arg_0", "[", "\"wsgidav.conditions.if\"", "]", "=", "None", "arg_0", "[", "\"wsgidav.ifLockTokenList\"", "]", "=", "[", "]", "return", "arg_1", "=", "arg_0", "[", "\"HTTP_IF\"", "]", ".", "strip", "(", ")", "if", "not", "arg_1", ".", "startswith", "(", "\"<\"", ")", ":", "arg_1", "=", "\"<*>\"", "+", "arg_1", "arg_2", "=", "dict", "(", "[", "]", ")", "arg_3", "=", "[", "]", "arg_4", "=", "\"*\"", "for", "(", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "in", "reIfSeparator", ".", "findall", "(", "arg_1", ")", ":", "if", "arg_5", "!=", "\"\"", ":", "arg_4", "=", "arg_6", "else", ":", "arg_9", "=", "[", "]", "arg_10", "=", "True", "for", "arg_11", "in", "reIfTagListContents", ".", "findall", "(", "arg_8", ")", ":", "if", "arg_11", ".", "upper", "(", ")", "!=", "\"NOT\"", ":", "if", "arg_11", ".", "startswith", "(", "\"[\"", ")", ":", "arg_9", ".", "append", "(", "(", "arg_10", ",", "\"entity\"", ",", "arg_11", ".", "strip", "(", "'\"[]'", ")", ")", ")", "else", ":", "arg_9", ".", "append", "(", "(", "arg_10", ",", "\"locktoken\"", ",", "arg_11", ".", "strip", "(", "\"<>\"", ")", ")", ")", "arg_3", ".", "append", "(", "arg_11", ".", "strip", "(", "\"<>\"", ")", ")", "arg_10", "=", "arg_11", ".", "upper", "(", ")", "!=", "\"NOT\"", "if", "arg_4", "in", "arg_2", ":", "arg_12", "=", "arg_2", "[", "arg_4", "]", "else", ":", "arg_12", "=", "[", "]", "arg_2", "[", "arg_4", "]", "=", "arg_12", "arg_12", ".", "append", "(", "arg_9", ")", "arg_0", "[", "\"wsgidav.conditions.if\"", "]", "=", "arg_2", "arg_0", "[", "\"wsgidav.ifLockTokenList\"", "]", "=", "arg_3", "_logger", ".", "debug", "(", "\"Func\\n{}\"", ".", "format", "(", "pformat", "(", "arg_2", ")", ")", ")", "return"], "function": "def Func(arg_0):\n    \"\"\"Parse HTTP_IF header into a dictionary and lists, and cache the result.\n\n    @see http://www.webdav.org/specs/rfc4918.html#HEADER_If\n    \"\"\"\n    if \"wsgidav.conditions.if\" in arg_0:\n        return\n\n    if \"HTTP_IF\" not in arg_0:\n        arg_0[\"wsgidav.conditions.if\"] = None\n        arg_0[\"wsgidav.ifLockTokenList\"] = []\n        return\n\n    arg_1 = arg_0[\"HTTP_IF\"].strip()\n    if not arg_1.startswith(\"<\"):\n        arg_1 = \"<*>\" + arg_1\n\n    arg_2 = dict([])\n    arg_3 = []\n\n    arg_4 = \"*\"\n    for (arg_5, arg_6, arg_7, arg_8) in reIfSeparator.findall(\n        arg_1\n    ):\n        if arg_5 != \"\":\n            arg_4 = arg_6\n        else:\n            arg_9 = []\n            arg_10 = True\n            for arg_11 in reIfTagListContents.findall(arg_8):\n                if arg_11.upper() != \"NOT\":\n                    if arg_11.startswith(\"[\"):\n                        arg_9.append(\n                            (arg_10, \"entity\", arg_11.strip('\"[]'))\n                        )\n                    else:\n                        arg_9.append(\n                            (arg_10, \"locktoken\", arg_11.strip(\"<>\"))\n                        )\n                        arg_3.append(arg_11.strip(\"<>\"))\n                arg_10 = arg_11.upper() != \"NOT\"\n\n            if arg_4 in arg_2:\n                arg_12 = arg_2[arg_4]\n            else:\n                arg_12 = []\n                arg_2[arg_4] = arg_12\n            arg_12.append(arg_9)\n\n    arg_0[\"wsgidav.conditions.if\"] = arg_2\n    arg_0[\"wsgidav.ifLockTokenList\"] = arg_3\n    _logger.debug(\"Func\\n{}\".format(pformat(arg_2)))\n    return", "path": "wsgidav/util.py", "identifier": "parse_if_header_dict", "docstring": "Parse HTTP_IF header into a dictionary and lists, and cache the result.\n\n    @see http://www.webdav.org/specs/rfc4918.html#HEADER_If", "docstring_tokens": ["Parse", "HTTP_IF", "header", "into", "a", "dictionary", "and", "lists", "and", "cache", "the", "result", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 258885}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/interrupts.py#L229-L238", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Enables GPIO interrupts.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "bring_gpio_interrupt_into_userspace", "(", ")", "set_gpio_interrupt_edge", "(", ")", "except", "Timeout", "as", "e", ":", "raise", "InterruptEnableException", "(", "\"There was an error bringing gpio%d into userspace. %s\"", "%", "(", "GPIO_INTERRUPT_PIN", ",", "e", ".", "message", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Enables GPIO interrupts.\"\"\"\n        try:\n            bring_gpio_interrupt_into_userspace()\n            set_gpio_interrupt_edge()\n        except Timeout as e:\n            raise InterruptEnableException(\n                \"There was an error bringing gpio%d into userspace. %s\" %\n                (GPIO_INTERRUPT_PIN, e.message)\n            )", "path": "pifacecommon/interrupts.py", "identifier": "GPIOInterruptDevice.gpio_interrupts_enable", "docstring": "Enables GPIO interrupts.", "docstring_tokens": ["Enables", "GPIO", "interrupts", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 258886}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L116-L120", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Update internal counters", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_ntypes", "=", "arg_0", ".", "count_types", "(", ")", "arg_0", ".", "_nvars", "=", "arg_0", ".", "count_vars", "(", ")", "arg_0", ".", "_nfuns", "=", "arg_0", ".", "count_funs", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Update internal counters \"\"\"\n        arg_0._ntypes = arg_0.count_types()\n        arg_0._nvars = arg_0.count_vars()\n        arg_0._nfuns = arg_0.count_funs()", "path": "pyrser/type_system/scope.py", "identifier": "Scope.__update_count", "docstring": "Update internal counters", "docstring_tokens": ["Update", "internal", "counters"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 258887}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/opengl/vao.py#L224-L244", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Set the index buffer for this VAO", "language": "python", "parameters": "(self, buffer, index_element_size=4)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "4", ")", ":", "if", "not", "type", "(", "arg_1", ")", "in", "[", "moderngl", ".", "Buffer", ",", "numpy", ".", "ndarray", ",", "bytes", "]", ":", "raise", "VAOError", "(", "\"buffer parameter must be a moderngl.Buffer, numpy.ndarray or bytes instance\"", ")", "if", "isinstance", "(", "arg_1", ",", "numpy", ".", "ndarray", ")", ":", "arg_1", "=", "arg_0", ".", "ctx", ".", "buffer", "(", "arg_1", ".", "tobytes", "(", ")", ")", "if", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "arg_1", "=", "arg_0", ".", "ctx", ".", "buffer", "(", "data", "=", "arg_1", ")", "arg_0", ".", "_Func", "=", "arg_1", "arg_0", ".", "_index_element_size", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=4):\n        \"\"\"\n        Set the index buffer for this VAO\n\n        Args:\n            buffer: ``moderngl.Buffer``, ``numpy.array`` or ``bytes``\n\n        Keyword Args:\n            index_element_size (int): Byte size of each element. 1, 2 or 4\n        \"\"\"\n        if not type(arg_1) in [moderngl.Buffer, numpy.ndarray, bytes]:\n            raise VAOError(\"buffer parameter must be a moderngl.Buffer, numpy.ndarray or bytes instance\")\n\n        if isinstance(arg_1, numpy.ndarray):\n            arg_1 = arg_0.ctx.buffer(arg_1.tobytes())\n\n        if isinstance(arg_1, bytes):\n            arg_1 = arg_0.ctx.buffer(data=arg_1)\n\n        arg_0._Func = arg_1\n        arg_0._index_element_size = arg_2", "path": "demosys/opengl/vao.py", "identifier": "VAO.index_buffer", "docstring": "Set the index buffer for this VAO\n\n        Args:\n            buffer: ``moderngl.Buffer``, ``numpy.array`` or ``bytes``\n\n        Keyword Args:\n            index_element_size (int): Byte size of each element. 1, 2 or 4", "docstring_tokens": ["Set", "the", "index", "buffer", "for", "this", "VAO"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 258888}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/shapes.py#L111-L134", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Reshape just the values of a BoltArraySpark, returning a\n        new BoltArraySpark.", "language": "python", "parameters": "(self, *shape)", "return_statement": "return BoltArraySpark(newrdd, shape=newshape).__finalize__(self._barray)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "argpack", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "shape", "isFuncable", "(", "arg_2", ",", "arg_3", ")", "if", "arg_2", "==", "arg_3", ":", "return", "arg_0", ".", "_barray", "def", "f", "(", "arg_4", ")", ":", "return", "arg_4", ".", "Func", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_barray", ".", "_rdd", ".", "mapValues", "(", "f", ")", "arg_6", "=", "arg_0", ".", "_barray", ".", "keys", ".", "shape", "+", "arg_2", "return", "BoltArraySpark", "(", "arg_5", ",", "arg_1", "=", "arg_6", ")", ".", "__finalize__", "(", "arg_0", ".", "_barray", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Reshape just the values of a BoltArraySpark, returning a\n        new BoltArraySpark.\n\n        Parameters\n        ----------\n        shape : tuple\n              New proposed axes.\n        \"\"\"\n        arg_2 = argpack(arg_1)\n        arg_3 = arg_0.shape\n        isFuncable(arg_2, arg_3)\n\n        if arg_2 == arg_3:\n            return arg_0._barray\n\n        def f(arg_4):\n            return arg_4.Func(arg_2)\n\n        arg_5 = arg_0._barray._rdd.mapValues(f)\n        arg_6 = arg_0._barray.keys.shape + arg_2\n\n        return BoltArraySpark(arg_5, arg_1=arg_6).__finalize__(arg_0._barray)", "path": "bolt/spark/shapes.py", "identifier": "Values.reshape", "docstring": "Reshape just the values of a BoltArraySpark, returning a\n        new BoltArraySpark.\n\n        Parameters\n        ----------\n        shape : tuple\n              New proposed axes.", "docstring_tokens": ["Reshape", "just", "the", "values", "of", "a", "BoltArraySpark", "returning", "a", "new", "BoltArraySpark", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 258889}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/players.py#L165-L167", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns a DataFrame of total box score statistics by season.", "language": "python", "parameters": "(self, kind='R', summary=False)", "return_statement": "return self._get_stats_table('totals', kind=kind, summary=summary)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'R'", ",", "arg_2", "=", "False", ")", ":", "return", "arg_0", ".", "_get_stats_table", "(", "'totals'", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1='R', arg_2=False):\n        \"\"\"Returns a DataFrame of total box score statistics by season.\"\"\"\n        return arg_0._get_stats_table('totals', arg_1=arg_1, arg_2=arg_2)", "path": "sportsref/nba/players.py", "identifier": "Player.stats_totals", "docstring": "Returns a DataFrame of total box score statistics by season.", "docstring_tokens": ["Returns", "a", "DataFrame", "of", "total", "box", "score", "statistics", "by", "season", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 258890}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L610-L659", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Calculates average Fano Factor of a network.", "language": "python", "parameters": "(self, traj, network, current_subrun, subrun_list, network_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "len", "(", "arg_4", ")", "==", "0", ":", "arg_6", "=", "arg_1", ".", "results", ".", "monitors", ".", "spikes_e", "arg_7", "=", "arg_1", ".", "parameters", ".", "analysis", ".", "statistics", ".", "time_window", "arg_8", "=", "arg_1", ".", "parameters", ".", "simulation", ".", "durations", ".", "initial_run", "arg_9", "=", "arg_8", "+", "arg_1", ".", "parameters", ".", "simulation", ".", "durations", ".", "measurement_run", "arg_10", "=", "arg_1", ".", "parameters", ".", "analysis", ".", "statistics", ".", "neuron_ids", "arg_11", "=", "arg_0", ".", "_compute_mean_fano_factor", "(", "arg_10", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", "arg_1", ".", "f_add_result", "(", "'statistics.mean_fano_factor'", ",", "arg_11", ",", "comment", "=", "'Average Fano '", "'Factor over all '", "'exc neurons'", ")", "print", "(", "'R_ee: %f, Mean FF: %f'", "%", "(", "arg_1", ".", "R_ee", ",", "arg_11", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"Calculates average Fano Factor of a network.\n\n        :param traj:\n\n            Trajectory container\n\n            Expects:\n\n            `results.monitors.spikes_e`: Data from SpikeMonitor for excitatory neurons\n\n            Adds:\n\n            `results.statistics.mean_fano_factor`: Average Fano Factor\n\n        :param network:\n\n            The BRIAN network\n\n        :param current_subrun:\n\n            BrianParameter\n\n        :param subrun_list:\n\n            Upcoming subruns, analysis is only performed if subruns is empty,\n            aka the final subrun has finished.\n\n        :param network_dict:\n\n            Dictionary of items shared among componetns\n\n        \"\"\"\n        #Check if we finished all subruns\n        if len(arg_4)==0:\n            arg_6 = arg_1.results.monitors.spikes_e\n\n            arg_7 = arg_1.parameters.analysis.statistics.time_window\n            arg_8 = arg_1.parameters.simulation.durations.initial_run\n            arg_9 = arg_8+arg_1.parameters.simulation.durations.measurement_run\n            arg_10 = arg_1.parameters.analysis.statistics.neuron_ids\n\n            arg_11 = arg_0._compute_mean_fano_factor(\n                arg_10, arg_6, arg_7, arg_8, arg_9)\n\n            arg_1.f_add_result('statistics.mean_fano_factor', arg_11, comment='Average Fano '\n                                                                      'Factor over all '\n                                                                      'exc neurons')\n\n            print('R_ee: %f, Mean FF: %f' % (arg_1.R_ee, arg_11))", "path": "examples/example_24_large_scale_brian2_simulation/clusternet.py", "identifier": "CNFanoFactorComputer.analyse", "docstring": "Calculates average Fano Factor of a network.\n\n        :param traj:\n\n            Trajectory container\n\n            Expects:\n\n            `results.monitors.spikes_e`: Data from SpikeMonitor for excitatory neurons\n\n            Adds:\n\n            `results.statistics.mean_fano_factor`: Average Fano Factor\n\n        :param network:\n\n            The BRIAN network\n\n        :param current_subrun:\n\n            BrianParameter\n\n        :param subrun_list:\n\n            Upcoming subruns, analysis is only performed if subruns is empty,\n            aka the final subrun has finished.\n\n        :param network_dict:\n\n            Dictionary of items shared among componetns", "docstring_tokens": ["Calculates", "average", "Fano", "Factor", "of", "a", "network", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258891}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/queries/selector_query.py#L215-L269", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Returns whether the given node matches all filters.", "language": "python", "parameters": "(self, node)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "visible", "if", "arg_0", ".", "options", "[", "\"text\"", "]", ":", "if", "isregex", "(", "arg_0", ".", "options", "[", "\"text\"", "]", ")", ":", "arg_3", "=", "arg_0", ".", "options", "[", "\"text\"", "]", "elif", "arg_0", ".", "exact_text", "is", "True", ":", "arg_3", "=", "re", ".", "compile", "(", "r\"\\A{}\\Z\"", ".", "format", "(", "re", ".", "escape", "(", "arg_0", ".", "options", "[", "\"text\"", "]", ")", ")", ")", "else", ":", "arg_3", "=", "toregex", "(", "arg_0", ".", "options", "[", "\"text\"", "]", ")", "arg_4", "=", "normalize_text", "(", "arg_1", ".", "all_text", "if", "arg_2", "==", "\"all\"", "else", "arg_1", ".", "visible_text", ")", "if", "not", "arg_3", ".", "search", "(", "arg_4", ")", ":", "return", "False", "if", "isinstance", "(", "arg_0", ".", "exact_text", ",", "(", "bytes_", ",", "str_", ")", ")", ":", "arg_3", "=", "re", ".", "compile", "(", "r\"\\A{}\\Z\"", ".", "format", "(", "re", ".", "escape", "(", "arg_0", ".", "exact_text", ")", ")", ")", "arg_4", "=", "normalize_text", "(", "arg_1", ".", "all_text", "if", "arg_2", "==", "\"all\"", "else", "arg_1", ".", "visible_text", ")", "if", "not", "arg_3", ".", "search", "(", "arg_4", ")", ":", "return", "False", "if", "arg_2", "==", "\"visible\"", ":", "if", "not", "arg_1", ".", "visible", ":", "return", "False", "elif", "arg_2", "==", "\"hidden\"", ":", "if", "arg_1", ".", "visible", ":", "return", "False", "for", "arg_5", ",", "arg_6", "in", "iter", "(", "arg_0", ".", "_node_filters", ".", "items", "(", ")", ")", ":", "if", "arg_5", "in", "arg_0", ".", "filter_options", ":", "if", "not", "arg_6", ".", "matches", "(", "arg_1", ",", "arg_0", ".", "filter_options", "[", "arg_5", "]", ")", ":", "return", "False", "elif", "arg_6", ".", "has_default", ":", "if", "not", "arg_6", ".", "matches", "(", "arg_1", ",", "arg_6", ".", "default", ")", ":", "return", "False", "if", "arg_0", ".", "options", "[", "\"filter\"", "]", "and", "not", "arg_0", ".", "options", "[", "\"filter\"", "]", "(", "arg_1", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns whether the given node matches all filters.\n\n        Args:\n            node (Element): The node to evaluate.\n\n        Returns:\n            bool: Whether the given node matches.\n        \"\"\"\n\n        arg_2 = arg_0.visible\n\n        if arg_0.options[\"text\"]:\n            if isregex(arg_0.options[\"text\"]):\n                arg_3 = arg_0.options[\"text\"]\n            elif arg_0.exact_text is True:\n                arg_3 = re.compile(r\"\\A{}\\Z\".format(re.escape(arg_0.options[\"text\"])))\n            else:\n                arg_3 = toregex(arg_0.options[\"text\"])\n\n            arg_4 = normalize_text(\n                arg_1.all_text if arg_2 == \"all\" else arg_1.visible_text)\n\n            if not arg_3.search(arg_4):\n                return False\n\n        if isinstance(arg_0.exact_text, (bytes_, str_)):\n            arg_3 = re.compile(r\"\\A{}\\Z\".format(re.escape(arg_0.exact_text)))\n\n            arg_4 = normalize_text(\n                arg_1.all_text if arg_2 == \"all\" else arg_1.visible_text)\n\n            if not arg_3.search(arg_4):\n                return False\n\n        if arg_2 == \"visible\":\n            if not arg_1.visible:\n                return False\n        elif arg_2 == \"hidden\":\n            if arg_1.visible:\n                return False\n\n        for arg_5, arg_6 in iter(arg_0._node_filters.items()):\n            if arg_5 in arg_0.filter_options:\n                if not arg_6.matches(arg_1, arg_0.filter_options[arg_5]):\n                    return False\n            elif arg_6.has_default:\n                if not arg_6.matches(arg_1, arg_6.default):\n                    return False\n\n        if arg_0.options[\"filter\"] and not arg_0.options[\"filter\"](arg_1):\n            return False\n\n        return True", "path": "capybara/queries/selector_query.py", "identifier": "SelectorQuery.matches_filters", "docstring": "Returns whether the given node matches all filters.\n\n        Args:\n            node (Element): The node to evaluate.\n\n        Returns:\n            bool: Whether the given node matches.", "docstring_tokens": ["Returns", "whether", "the", "given", "node", "matches", "all", "filters", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 258892}
{"url": "https://github.com/ricobl/django-importer/blob/6967adfa7a286be7aaf59d3f33c6637270bd9df6/sample_project/tasks/importers.py#L90-L98", "sha": "6967adfa7a286be7aaf59d3f33c6637270bd9df6", "docstring_summary": "Parse numeric fields.", "language": "python", "parameters": "(self, item, field_name, source_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "get_value", "(", "arg_1", ",", "arg_3", ")", "try", ":", "return", "int", "(", "arg_4", ")", "except", ":", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Parse numeric fields.\n        \"\"\"\n        arg_4 = arg_0.get_value(arg_1, arg_3)\n        try:\n            return int(arg_4)\n        except:\n            return 0", "path": "sample_project/tasks/importers.py", "identifier": "TaskImporter.parse_totals", "docstring": "Parse numeric fields.", "docstring_tokens": ["Parse", "numeric", "fields", "."], "nwo": "ricobl/django-importer", "score": 0.3726785709016597, "idx": 258893}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L338-L382", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Send data synchronous to an ADS-device.", "language": "python", "parameters": "(port, address, index_group, index_offset, value, plc_data_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "_adsDLL", ".", "AdsSyncWriteReqEx", "arg_7", "=", "ctypes", ".", "pointer", "(", "arg_1", ".", "amsAddrStruct", "(", ")", ")", "arg_8", "=", "ctypes", ".", "c_ulong", "(", "arg_2", ")", "arg_9", "=", "ctypes", ".", "c_ulong", "(", "arg_3", ")", "if", "arg_5", "==", "PLCTYPE_STRING", ":", "arg_10", "=", "ctypes", ".", "c_char_p", "(", "arg_4", ".", "encode", "(", "\"utf-8\"", ")", ")", "arg_11", "=", "arg_10", "arg_12", "=", "len", "(", "arg_11", ".", "value", ")", "+", "1", "else", ":", "if", "type", "(", "arg_5", ")", ".", "__name__", "==", "\"PyCArrayType\"", ":", "arg_10", "=", "arg_5", "(", "*", "arg_4", ")", "else", ":", "arg_10", "=", "arg_5", "(", "arg_4", ")", "arg_11", "=", "ctypes", ".", "pointer", "(", "arg_10", ")", "arg_12", "=", "ctypes", ".", "sizeof", "(", "arg_10", ")", "arg_13", "=", "arg_6", "(", "arg_0", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_12", ",", "arg_11", ",", ")", "if", "arg_13", ":", "raise", "ADSError", "(", "arg_13", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    # type: (int, AmsAddr, int, int, Any, Type) -> None\n    \"\"\"Send data synchronous to an ADS-device.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :param int indexGroup: PLC storage area, according to the INDEXGROUP\n        constants\n    :param int index_offset: PLC storage address\n    :param value: value to write to the storage address of the PLC\n    :param int plc_data_type: type of the data given to the PLC,\n        according to PLCTYPE constants\n\n    \"\"\"\n    arg_6 = _adsDLL.AdsSyncWriteReqEx\n\n    arg_7 = ctypes.pointer(arg_1.amsAddrStruct())\n    arg_8 = ctypes.c_ulong(arg_2)\n    arg_9 = ctypes.c_ulong(arg_3)\n\n    if arg_5 == PLCTYPE_STRING:\n        arg_10 = ctypes.c_char_p(arg_4.encode(\"utf-8\"))\n        arg_11 = arg_10  # type: Union[ctypes.c_char_p, ctypes.pointer]\n        arg_12 = len(arg_11.value) + 1  # type: ignore\n\n    else:\n        if type(arg_5).__name__ == \"PyCArrayType\":\n            arg_10 = arg_5(*arg_4)\n        else:\n            arg_10 = arg_5(arg_4)\n\n        arg_11 = ctypes.pointer(arg_10)\n        arg_12 = ctypes.sizeof(arg_10)\n\n    arg_13 = arg_6(\n        arg_0,\n        arg_7,\n        arg_8,\n        arg_9,\n        arg_12,\n        arg_11,\n    )\n\n    if arg_13:\n        raise ADSError(arg_13)", "path": "pyads/pyads_ex.py", "identifier": "adsSyncWriteReqEx", "docstring": "Send data synchronous to an ADS-device.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :param int indexGroup: PLC storage area, according to the INDEXGROUP\n        constants\n    :param int index_offset: PLC storage address\n    :param value: value to write to the storage address of the PLC\n    :param int plc_data_type: type of the data given to the PLC,\n        according to PLCTYPE constants", "docstring_tokens": ["Send", "data", "synchronous", "to", "an", "ADS", "-", "device", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 258894}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/multifn.py#L61-L66", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Remove the method defined for this key and return it.", "language": "python", "parameters": "(self, key: T)", "return_statement": "return method", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Optional", "[", "Method", "]", ":", "arg_3", "=", "arg_0", ".", "methods", ".", "entry", "(", "arg_1", ",", "None", ")", "if", "arg_3", ":", "arg_0", ".", "_methods", ".", "swap", "(", "MultiFunction", ".", "__Func", ",", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2) -> Optional[Method]:\n        \"\"\"Remove the method defined for this key and return it.\"\"\"\n        arg_3 = arg_0.methods.entry(arg_1, None)\n        if arg_3:\n            arg_0._methods.swap(MultiFunction.__Func, arg_1)\n        return arg_3", "path": "src/basilisp/lang/multifn.py", "identifier": "MultiFunction.remove_method", "docstring": "Remove the method defined for this key and return it.", "docstring_tokens": ["Remove", "the", "method", "defined", "for", "this", "key", "and", "return", "it", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 258895}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L1009-L1098", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Return a row-sparse matrix approximating the input `x`.", "language": "python", "parameters": "(x, quantile=0.01)", "return_statement": "return x_sparse.tocsr()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.01", ")", ":", "if", "arg_0", ".", "ndim", "==", "1", ":", "arg_0", "=", "arg_0", ".", "reshape", "(", "(", "1", ",", "-", "1", ")", ")", "elif", "arg_0", ".", "ndim", ">", "2", ":", "raise", "ParameterError", "(", "'Input must have 2 or fewer dimensions. '", "'Provided x.shape={}.'", ".", "format", "(", "arg_0", ".", "shape", ")", ")", "if", "not", "0.0", "<=", "arg_1", "<", "1", ":", "raise", "ParameterError", "(", "'Invalid quantile {:.2f}'", ".", "format", "(", "arg_1", ")", ")", "arg_2", "=", "scipy", ".", "sparse", ".", "lil_matrix", "(", "arg_0", ".", "shape", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_3", "=", "np", ".", "abs", "(", "arg_0", ")", "arg_4", "=", "np", ".", "sum", "(", "arg_3", ",", "axis", "=", "1", ",", "keepdims", "=", "True", ")", "arg_5", "=", "np", ".", "sort", "(", "arg_3", ",", "axis", "=", "1", ")", "arg_6", "=", "np", ".", "cumsum", "(", "arg_5", "/", "arg_4", ",", "axis", "=", "1", ")", "arg_7", "=", "np", ".", "argmin", "(", "arg_6", "<", "arg_1", ",", "axis", "=", "1", ")", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_7", ")", ":", "arg_10", "=", "np", ".", "where", "(", "arg_3", "[", "arg_8", "]", ">=", "arg_5", "[", "arg_8", ",", "arg_9", "]", ")", "arg_2", "[", "arg_8", ",", "arg_10", "]", "=", "arg_0", "[", "arg_8", ",", "arg_10", "]", "return", "arg_2", ".", "tocsr", "(", ")"], "function": "def Func(arg_0, arg_1=0.01):\n    '''\n    Return a row-sparse matrix approximating the input `x`.\n\n    Parameters\n    ----------\n    x : np.ndarray [ndim <= 2]\n        The input matrix to sparsify.\n\n    quantile : float in [0, 1.0)\n        Percentage of magnitude to discard in each row of `x`\n\n    Returns\n    -------\n    x_sparse : `scipy.sparse.csr_matrix` [shape=x.shape]\n        Row-sparsified approximation of `x`\n\n        If `x.ndim == 1`, then `x` is interpreted as a row vector,\n        and `x_sparse.shape == (1, len(x))`.\n\n    Raises\n    ------\n    ParameterError\n        If `x.ndim > 2`\n\n        If `quantile` lies outside `[0, 1.0)`\n\n    Notes\n    -----\n    This function caches at level 40.\n\n    Examples\n    --------\n    >>> # Construct a Hann window to sparsify\n    >>> x = scipy.signal.hann(32)\n    >>> x\n    array([ 0.   ,  0.01 ,  0.041,  0.09 ,  0.156,  0.236,  0.326,\n            0.424,  0.525,  0.625,  0.72 ,  0.806,  0.879,  0.937,\n            0.977,  0.997,  0.997,  0.977,  0.937,  0.879,  0.806,\n            0.72 ,  0.625,  0.525,  0.424,  0.326,  0.236,  0.156,\n            0.09 ,  0.041,  0.01 ,  0.   ])\n    >>> # Discard the bottom percentile\n    >>> x_sparse = librosa.util.Func(x, quantile=0.01)\n    >>> x_sparse\n    <1x32 sparse matrix of type '<type 'numpy.float64'>'\n        with 26 stored elements in Compressed Sparse Row format>\n    >>> x_sparse.todense()\n    matrix([[ 0.   ,  0.   ,  0.   ,  0.09 ,  0.156,  0.236,  0.326,\n              0.424,  0.525,  0.625,  0.72 ,  0.806,  0.879,  0.937,\n              0.977,  0.997,  0.997,  0.977,  0.937,  0.879,  0.806,\n              0.72 ,  0.625,  0.525,  0.424,  0.326,  0.236,  0.156,\n              0.09 ,  0.   ,  0.   ,  0.   ]])\n    >>> # Discard up to the bottom 10th percentile\n    >>> x_sparse = librosa.util.Func(x, quantile=0.1)\n    >>> x_sparse\n    <1x32 sparse matrix of type '<type 'numpy.float64'>'\n        with 20 stored elements in Compressed Sparse Row format>\n    >>> x_sparse.todense()\n    matrix([[ 0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.326,\n              0.424,  0.525,  0.625,  0.72 ,  0.806,  0.879,  0.937,\n              0.977,  0.997,  0.997,  0.977,  0.937,  0.879,  0.806,\n              0.72 ,  0.625,  0.525,  0.424,  0.326,  0.   ,  0.   ,\n              0.   ,  0.   ,  0.   ,  0.   ]])\n    '''\n\n    if arg_0.ndim == 1:\n        arg_0 = arg_0.reshape((1, -1))\n\n    elif arg_0.ndim > 2:\n        raise ParameterError('Input must have 2 or fewer dimensions. '\n                             'Provided x.shape={}.'.format(arg_0.shape))\n\n    if not 0.0 <= arg_1 < 1:\n        raise ParameterError('Invalid quantile {:.2f}'.format(arg_1))\n\n    arg_2 = scipy.sparse.lil_matrix(arg_0.shape, dtype=arg_0.dtype)\n\n    arg_3 = np.abs(arg_0)\n    arg_4 = np.sum(arg_3, axis=1, keepdims=True)\n\n    arg_5 = np.sort(arg_3, axis=1)\n    arg_6 = np.cumsum(arg_5 / arg_4, axis=1)\n\n    arg_7 = np.argmin(arg_6 < arg_1, axis=1)\n\n    for arg_8, arg_9 in enumerate(arg_7):\n        arg_10 = np.where(arg_3[arg_8] >= arg_5[arg_8, arg_9])\n        arg_2[arg_8, arg_10] = arg_0[arg_8, arg_10]\n\n    return arg_2.tocsr()", "path": "librosa/util/utils.py", "identifier": "sparsify_rows", "docstring": "Return a row-sparse matrix approximating the input `x`.\n\n    Parameters\n    ----------\n    x : np.ndarray [ndim <= 2]\n        The input matrix to sparsify.\n\n    quantile : float in [0, 1.0)\n        Percentage of magnitude to discard in each row of `x`\n\n    Returns\n    -------\n    x_sparse : `scipy.sparse.csr_matrix` [shape=x.shape]\n        Row-sparsified approximation of `x`\n\n        If `x.ndim == 1`, then `x` is interpreted as a row vector,\n        and `x_sparse.shape == (1, len(x))`.\n\n    Raises\n    ------\n    ParameterError\n        If `x.ndim > 2`\n\n        If `quantile` lies outside `[0, 1.0)`\n\n    Notes\n    -----\n    This function caches at level 40.\n\n    Examples\n    --------\n    >>> # Construct a Hann window to sparsify\n    >>> x = scipy.signal.hann(32)\n    >>> x\n    array([ 0.   ,  0.01 ,  0.041,  0.09 ,  0.156,  0.236,  0.326,\n            0.424,  0.525,  0.625,  0.72 ,  0.806,  0.879,  0.937,\n            0.977,  0.997,  0.997,  0.977,  0.937,  0.879,  0.806,\n            0.72 ,  0.625,  0.525,  0.424,  0.326,  0.236,  0.156,\n            0.09 ,  0.041,  0.01 ,  0.   ])\n    >>> # Discard the bottom percentile\n    >>> x_sparse = librosa.util.sparsify_rows(x, quantile=0.01)\n    >>> x_sparse\n    <1x32 sparse matrix of type '<type 'numpy.float64'>'\n        with 26 stored elements in Compressed Sparse Row format>\n    >>> x_sparse.todense()\n    matrix([[ 0.   ,  0.   ,  0.   ,  0.09 ,  0.156,  0.236,  0.326,\n              0.424,  0.525,  0.625,  0.72 ,  0.806,  0.879,  0.937,\n              0.977,  0.997,  0.997,  0.977,  0.937,  0.879,  0.806,\n              0.72 ,  0.625,  0.525,  0.424,  0.326,  0.236,  0.156,\n              0.09 ,  0.   ,  0.   ,  0.   ]])\n    >>> # Discard up to the bottom 10th percentile\n    >>> x_sparse = librosa.util.sparsify_rows(x, quantile=0.1)\n    >>> x_sparse\n    <1x32 sparse matrix of type '<type 'numpy.float64'>'\n        with 20 stored elements in Compressed Sparse Row format>\n    >>> x_sparse.todense()\n    matrix([[ 0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.326,\n              0.424,  0.525,  0.625,  0.72 ,  0.806,  0.879,  0.937,\n              0.977,  0.997,  0.997,  0.977,  0.937,  0.879,  0.806,\n              0.72 ,  0.625,  0.525,  0.424,  0.326,  0.   ,  0.   ,\n              0.   ,  0.   ,  0.   ,  0.   ]])", "docstring_tokens": ["Return", "a", "row", "-", "sparse", "matrix", "approximating", "the", "input", "x", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258896}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/date.py#L383-L440", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Parse a datetime to a datetime object.", "language": "python", "parameters": "(value, fmt=None)", "return_statement": "return datetimeobj_any(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", ":", "return", "_Func_formats", ".", "get", "(", "arg_1", ",", "lambda", "v", ":", "Func_fmt", "(", "v", ",", "arg_1", ")", ")", "(", "arg_0", ")", "arg_2", "=", "len", "(", "arg_0", ")", "if", "19", "<=", "arg_2", "<=", "24", "and", "arg_0", "[", "3", "]", "==", "\" \"", ":", "try", ":", "return", "Func_d_b_Y_H_M_S", "(", "arg_0", ")", "except", "(", "KeyError", ",", "ValueError", ")", ":", "pass", "if", "30", "<=", "arg_2", "<=", "31", ":", "try", ":", "return", "Func_a__d_b_Y_H_M_S_z", "(", "arg_0", ")", "except", "(", "KeyError", ",", "ValueError", ")", ":", "pass", "if", "arg_2", "==", "14", ":", "try", ":", "return", "Func_YmdHMS", "(", "arg_0", ")", "except", "ValueError", ":", "pass", "try", ":", "return", "Func_epoch", "(", "arg_0", ")", "except", "ValueError", ":", "pass", "return", "Func_any", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Parse a datetime to a datetime object.\n\n    Uses fast custom parsing for common datetime formats or the slow dateutil\n    parser for other formats. This is a trade off between ease of use and speed\n    and is very useful for fast parsing of timestamp strings whose format may\n    standard but varied or unknown prior to parsing.\n\n    Common formats include:\n        1 Feb 2010 12:00:00 GMT\n        Mon, 1 Feb 2010 22:00:00 +1000\n        20100201120000\n        1383470155 (seconds since epoch)\n\n    See the other Func_*() functions for more details.\n\n    Args:\n        value: A string representing a datetime.\n\n    Returns:\n        A datetime object.\n    \"\"\"\n    if arg_1:\n        return _Func_formats.get(arg_1,\n            lambda v: Func_fmt(v, arg_1)\n        )(arg_0)\n\n    arg_2 = len(arg_0)\n\n    if 19 <= arg_2 <= 24 and arg_0[3] == \" \":\n        # '%d %b %Y %H:%M:%Sxxxx'\n        try:\n            return Func_d_b_Y_H_M_S(arg_0)\n        except (KeyError, ValueError):\n            pass\n\n    if 30 <= arg_2 <= 31:\n        # '%a, %d %b %Y %H:%M:%S %z'\n        try:\n            return Func_a__d_b_Y_H_M_S_z(arg_0)\n        except (KeyError, ValueError):\n            pass\n\n    if arg_2 == 14:\n        # '%Y%m%d%H%M%S'\n        try:\n            return Func_YmdHMS(arg_0)\n        except ValueError:\n            pass\n\n    # epoch timestamp\n    try:\n        return Func_epoch(arg_0)\n    except ValueError:\n        pass\n\n    # slow version\n    return Func_any(arg_0)", "path": "nntp/date.py", "identifier": "datetimeobj", "docstring": "Parse a datetime to a datetime object.\n\n    Uses fast custom parsing for common datetime formats or the slow dateutil\n    parser for other formats. This is a trade off between ease of use and speed\n    and is very useful for fast parsing of timestamp strings whose format may\n    standard but varied or unknown prior to parsing.\n\n    Common formats include:\n        1 Feb 2010 12:00:00 GMT\n        Mon, 1 Feb 2010 22:00:00 +1000\n        20100201120000\n        1383470155 (seconds since epoch)\n\n    See the other datetimeobj_*() functions for more details.\n\n    Args:\n        value: A string representing a datetime.\n\n    Returns:\n        A datetime object.", "docstring_tokens": ["Parse", "a", "datetime", "to", "a", "datetime", "object", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 258897}
{"url": "https://github.com/umich-brcf-bioinf/Jacquard/blob/83dd61dd2b5e4110468493beec7bc121e6cb3cd1/jacquard/utils/vcf.py#L200-L220", "sha": "83dd61dd2b5e4110468493beec7bc121e6cb3cd1", "docstring_summary": "Creates a sample dict of tag-value dicts for a single variant record.", "language": "python", "parameters": "(cls, sample_names, rformat, sample_fields)", "return_statement": "return sample_tag_values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "OrderedDict", "(", ")", "arg_5", "=", "VcfRecord", ".", "_format_list", "(", "arg_2", ")", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_3", ")", ":", "arg_8", "=", "arg_7", ".", "split", "(", "\":\"", ")", "if", "arg_7", "else", "\".\"", "arg_4", "[", "arg_1", "[", "arg_6", "]", "]", "=", "OrderedDict", "(", "zip", "(", "arg_5", ",", "arg_8", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Creates a sample dict of tag-value dicts for a single variant record.\n\n        Args:\n            sample_names: list of sample name strings.\n            rformat: record format string (from VCF record).\n            sample_fields: list of strings where each string is the ';'\n                seperated format values for an individual sample.\n\n        Returns:\n            An dict of samples, where each key is a sample and each value\n                is an dict of format-values. See attribute below for example.\n                Will return '.' if no values for sampe field.\n        \"\"\"\n        arg_4 = OrderedDict()\n        arg_5 = VcfRecord._format_list(arg_2)\n        for arg_6, arg_7 in enumerate(arg_3):\n            arg_8 = arg_7.split(\":\") if arg_7 else \".\"\n            arg_4[arg_1[arg_6]] = OrderedDict(zip(arg_5,\n                                                                 arg_8))\n        return arg_4", "path": "jacquard/utils/vcf.py", "identifier": "VcfRecord._sample_tag_values", "docstring": "Creates a sample dict of tag-value dicts for a single variant record.\n\n        Args:\n            sample_names: list of sample name strings.\n            rformat: record format string (from VCF record).\n            sample_fields: list of strings where each string is the ';'\n                seperated format values for an individual sample.\n\n        Returns:\n            An dict of samples, where each key is a sample and each value\n                is an dict of format-values. See attribute below for example.\n                Will return '.' if no values for sampe field.", "docstring_tokens": ["Creates", "a", "sample", "dict", "of", "tag", "-", "value", "dicts", "for", "a", "single", "variant", "record", "."], "nwo": "umich-brcf-bioinf/Jacquard", "score": 0.27831918678159157, "idx": 258898}
{"url": "https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L234-L255", "sha": "2614ae3d7a49e437954254846b2963ad249b418c", "docstring_summary": "Returns the filename which is effectively used by the application. If\n        overridden by an environment variable, it will return that filename.", "language": "python", "parameters": "(self)", "return_statement": "return config_filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "if", "arg_0", ".", "filename", ":", "arg_1", "=", "arg_0", ".", "filename", "arg_2", "=", "getenv", "(", "arg_0", ".", "env_filename_name", ")", "if", "arg_2", ":", "arg_0", ".", "_log", ".", "info", "(", "'Configuration filename was overridden with %r '", "'by the environment variable %s.'", ",", "arg_2", ",", "arg_0", ".", "env_filename_name", ")", "arg_1", "=", "arg_2", "return", "arg_1"], "function": "def Func(arg_0):\n        # type: () -> str\n        \"\"\"\n        Returns the filename which is effectively used by the application. If\n        overridden by an environment variable, it will return that filename.\n        \"\"\"\n        # same logic for the configuration filename. First, check if we were\n        # initialized with a filename...\n        arg_1 = ''\n        if arg_0.filename:\n            arg_1 = arg_0.filename\n\n        # ... next, take the value from the environment\n        arg_2 = getenv(arg_0.env_filename_name)\n        if arg_2:\n            arg_0._log.info('Configuration filename was overridden with %r '\n                           'by the environment variable %s.',\n                           arg_2,\n                           arg_0.env_filename_name)\n            arg_1 = arg_2\n\n        return arg_1", "path": "config_resolver/core.py", "identifier": "Config._effective_filename", "docstring": "Returns the filename which is effectively used by the application. If\n        overridden by an environment variable, it will return that filename.", "docstring_tokens": ["Returns", "the", "filename", "which", "is", "effectively", "used", "by", "the", "application", ".", "If", "overridden", "by", "an", "environment", "variable", "it", "will", "return", "that", "filename", "."], "nwo": "exhuma/config_resolver", "score": 0.16941397159673272, "idx": 258899}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/cli.py#L301-L320", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Remove a file from the project's storage.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_setup_osf", "(", "arg_0", ")", "if", "arg_1", ".", "username", "is", "None", "or", "arg_1", ".", "password", "is", "None", ":", "sys", ".", "exit", "(", "'To Func a file you need to provide a username and'", "' password.'", ")", "arg_2", "=", "arg_1", ".", "project", "(", "arg_0", ".", "project", ")", "arg_3", ",", "arg_4", "=", "split_storage", "(", "arg_0", ".", "target", ")", "arg_5", "=", "arg_2", ".", "storage", "(", "arg_3", ")", "for", "arg_6", "in", "arg_5", ".", "files", ":", "if", "norm_remote_path", "(", "arg_6", ".", "path", ")", "==", "arg_4", ":", "arg_6", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Remove a file from the project's storage.\n\n    The first part of the remote path is interpreted as the name of the\n    storage provider. If there is no match the default (osfstorage) is\n    used.\n    \"\"\"\n    arg_1 = _setup_osf(arg_0)\n    if arg_1.username is None or arg_1.password is None:\n        sys.exit('To Func a file you need to provide a username and'\n                 ' password.')\n\n    arg_2 = arg_1.project(arg_0.project)\n\n    arg_3, arg_4 = split_storage(arg_0.target)\n\n    arg_5 = arg_2.storage(arg_3)\n    for arg_6 in arg_5.files:\n        if norm_remote_path(arg_6.path) == arg_4:\n            arg_6.Func()", "path": "osfclient/cli.py", "identifier": "remove", "docstring": "Remove a file from the project's storage.\n\n    The first part of the remote path is interpreted as the name of the\n    storage provider. If there is no match the default (osfstorage) is\n    used.", "docstring_tokens": ["Remove", "a", "file", "from", "the", "project", "s", "storage", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 258900}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/spark_sql_operator.py#L91-L108", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Call the SparkSqlHook to run the provided sql query", "language": "python", "parameters": "(self, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_hook", "=", "SparkSqlHook", "(", "sql", "=", "arg_0", ".", "_sql", ",", "conf", "=", "arg_0", ".", "_conf", ",", "conn_id", "=", "arg_0", ".", "_conn_id", ",", "total_executor_cores", "=", "arg_0", ".", "_total_executor_cores", ",", "executor_cores", "=", "arg_0", ".", "_executor_cores", ",", "executor_memory", "=", "arg_0", ".", "_executor_memory", ",", "keytab", "=", "arg_0", ".", "_keytab", ",", "principal", "=", "arg_0", ".", "_principal", ",", "name", "=", "arg_0", ".", "_name", ",", "num_executors", "=", "arg_0", ".", "_num_executors", ",", "master", "=", "arg_0", ".", "_master", ",", "yarn_queue", "=", "arg_0", ".", "_yarn_queue", ")", "arg_0", ".", "_hook", ".", "run_query", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Call the SparkSqlHook to run the provided sql query\n        \"\"\"\n        arg_0._hook = SparkSqlHook(sql=arg_0._sql,\n                                  conf=arg_0._conf,\n                                  conn_id=arg_0._conn_id,\n                                  total_executor_cores=arg_0._total_executor_cores,\n                                  executor_cores=arg_0._executor_cores,\n                                  executor_memory=arg_0._executor_memory,\n                                  keytab=arg_0._keytab,\n                                  principal=arg_0._principal,\n                                  name=arg_0._name,\n                                  num_executors=arg_0._num_executors,\n                                  master=arg_0._master,\n                                  yarn_queue=arg_0._yarn_queue\n                                  )\n        arg_0._hook.run_query()", "path": "airflow/contrib/operators/spark_sql_operator.py", "identifier": "SparkSqlOperator.execute", "docstring": "Call the SparkSqlHook to run the provided sql query", "docstring_tokens": ["Call", "the", "SparkSqlHook", "to", "run", "the", "provided", "sql", "query"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258901}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/db.py#L349-L357", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Give a database cursor and model, check the subjects against\n    the subject vocabulary.", "language": "python", "parameters": "(cursor, model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "term", "[", "0", "]", "for", "term", "in", "acquire_subject_vocabulary", "(", "arg_0", ")", "]", "arg_3", "=", "arg_1", ".", "metadata", ".", "get", "(", "'subjects'", ",", "[", "]", ")", "arg_4", "=", "[", "s", "for", "s", "in", "arg_3", "if", "s", "not", "in", "arg_2", "]", "if", "arg_4", ":", "raise", "exceptions", ".", "InvalidMetadata", "(", "'subjects'", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Give a database cursor and model, check the subjects against\n    the subject vocabulary.\n    \"\"\"\n    arg_2 = [term[0] for term in acquire_subject_vocabulary(arg_0)]\n    arg_3 = arg_1.metadata.get('subjects', [])\n    arg_4 = [s for s in arg_3 if s not in arg_2]\n    if arg_4:\n        raise exceptions.InvalidMetadata('subjects', arg_4)", "path": "cnxpublishing/db.py", "identifier": "_validate_subjects", "docstring": "Give a database cursor and model, check the subjects against\n    the subject vocabulary.", "docstring_tokens": ["Give", "a", "database", "cursor", "and", "model", "check", "the", "subjects", "against", "the", "subject", "vocabulary", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 258902}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py#L669-L689", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find an installed distribution that satisfies or conflicts\n        with this requirement, and set self.satisfied_by or\n        self.conflicts_with appropriately.", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "req", "is", "None", ":", "return", "False", "try", ":", "arg_0", ".", "satisfied_by", "=", "pkg_resources", ".", "get_distribution", "(", "arg_0", ".", "req", ")", "except", "pkg_resources", ".", "DistributionNotFound", ":", "return", "False", "except", "pkg_resources", ".", "VersionConflict", ":", "arg_2", "=", "pkg_resources", ".", "get_distribution", "(", "arg_0", ".", "req", ".", "project_name", ")", "if", "arg_0", ".", "use_user_site", ":", "if", "dist_in_usersite", "(", "arg_2", ")", ":", "arg_0", ".", "conflicts_with", "=", "arg_2", "elif", "running_under_virtualenv", "(", ")", "and", "dist_in_site_packages", "(", "arg_2", ")", ":", "raise", "InstallationError", "(", "\"Will not install to the user site because it will lack sys.path precedence to %s in %s\"", "%", "(", "arg_2", ".", "project_name", ",", "arg_2", ".", "location", ")", ")", "else", ":", "arg_0", ".", "conflicts_with", "=", "arg_2", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"Find an installed distribution that satisfies or conflicts\n        with this requirement, and set self.satisfied_by or\n        self.conflicts_with appropriately.\"\"\"\n        if arg_0.req is None:\n            return False\n        try:\n            arg_0.satisfied_by = pkg_resources.get_distribution(arg_0.req)\n        except pkg_resources.DistributionNotFound:\n            return False\n        except pkg_resources.VersionConflict:\n            arg_2 = pkg_resources.get_distribution(arg_0.req.project_name)\n            if arg_0.use_user_site:\n                if dist_in_usersite(arg_2):\n                    arg_0.conflicts_with = arg_2\n                elif running_under_virtualenv() and dist_in_site_packages(arg_2):\n                    raise InstallationError(\"Will not install to the user site because it will lack sys.path precedence to %s in %s\"\n                                            %(arg_2.project_name, arg_2.location))\n            else:\n                arg_0.conflicts_with = arg_2\n        return True", "path": "environment/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", "identifier": "InstallRequirement.check_if_exists", "docstring": "Find an installed distribution that satisfies or conflicts\n        with this requirement, and set self.satisfied_by or\n        self.conflicts_with appropriately.", "docstring_tokens": ["Find", "an", "installed", "distribution", "that", "satisfies", "or", "conflicts", "with", "this", "requirement", "and", "set", "self", ".", "satisfied_by", "or", "self", ".", "conflicts_with", "appropriately", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258903}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/image/utils.py#L32-L93", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Open a volumetric file using the tools following the file extension.", "language": "python", "parameters": "(filepath)", "return_statement": "return _load_file(filepath, loader)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "op", ".", "exists", "(", "arg_0", ")", ":", "raise", "IOError", "(", "'Could not find file {}.'", ".", "format", "(", "arg_0", ")", ")", "def", "open_nifti_file", "(", "arg_0", ")", ":", "return", "NiftiImage", "(", "arg_0", ")", "def", "open_mhd_file", "(", "arg_0", ")", ":", "return", "MedicalImage", "(", "arg_0", ")", "arg_1", ",", "arg_2", "=", "load_raw_data_with_mhd", "(", "arg_0", ")", "return", "arg_1", ",", "arg_2", "def", "open_mha_file", "(", "arg_0", ")", ":", "raise", "NotImplementedError", "(", "'This function has not been implemented yet.'", ")", "def", "_load_file", "(", "arg_0", ",", "arg_3", ")", ":", "return", "arg_3", "(", "arg_0", ")", "arg_4", "=", "{", "'nii'", ":", "open_nifti_file", ",", "'mhd'", ":", "open_mhd_file", ",", "'mha'", ":", "open_mha_file", ",", "}", "arg_5", "=", "get_extension", "(", "arg_0", ")", "arg_3", "=", "None", "for", "arg_6", "in", "arg_4", ":", "if", "arg_5", "in", "arg_6", ":", "arg_3", "=", "arg_4", "[", "arg_6", "]", "if", "arg_3", "is", "None", ":", "raise", "ValueError", "(", "'Could not find a loader for file {}.'", ".", "format", "(", "arg_0", ")", ")", "return", "_load_file", "(", "arg_0", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Open a volumetric file using the tools following the file extension.\n\n    Parameters\n    ----------\n    filepath: str\n        Path to a volume file\n\n    Returns\n    -------\n    volume_data: np.ndarray\n        Volume data\n\n    pixdim: 1xN np.ndarray\n        Vector with the description of the voxels physical size (usually in mm) for each volume dimension.\n\n    Raises\n    ------\n    IOError\n        In case the file is not found.\n    \"\"\"\n    # check if the file exists\n    if not op.exists(arg_0):\n        raise IOError('Could not find file {}.'.format(arg_0))\n\n    # define helper functions\n    def open_nifti_file(arg_0):\n        return NiftiImage(arg_0)\n\n    def open_mhd_file(arg_0):\n        return MedicalImage(arg_0)\n        arg_1, arg_2 = load_raw_data_with_mhd(arg_0)\n        # TODO: convert vol_data and hdr_data into MedicalImage\n        return arg_1, arg_2\n\n    def open_mha_file(arg_0):\n        raise NotImplementedError('This function has not been implemented yet.')\n\n    # generic loader function\n    def _load_file(arg_0, arg_3):\n        return arg_3(arg_0)\n\n    # file_extension -> file loader function\n    arg_4 = {\n                    'nii': open_nifti_file,\n                    'mhd': open_mhd_file,\n                    'mha': open_mha_file,\n                    }\n\n    # get extension of the `filepath`\n    arg_5 = get_extension(arg_0)\n\n    # find the loader from `ext`\n    arg_3 = None\n    for arg_6 in arg_4:\n        if arg_5 in arg_6:\n            arg_3 = arg_4[arg_6]\n\n    if arg_3 is None:\n        raise ValueError('Could not find a loader for file {}.'.format(arg_0))\n\n    return _load_file(arg_0, arg_3)", "path": "boyle/image/utils.py", "identifier": "open_volume_file", "docstring": "Open a volumetric file using the tools following the file extension.\n\n    Parameters\n    ----------\n    filepath: str\n        Path to a volume file\n\n    Returns\n    -------\n    volume_data: np.ndarray\n        Volume data\n\n    pixdim: 1xN np.ndarray\n        Vector with the description of the voxels physical size (usually in mm) for each volume dimension.\n\n    Raises\n    ------\n    IOError\n        In case the file is not found.", "docstring_tokens": ["Open", "a", "volumetric", "file", "using", "the", "tools", "following", "the", "file", "extension", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258904}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L269-L322", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Generate a header for a tag section with specific parameters.", "language": "python", "parameters": "(self, newer_tag_name, newer_tag_link,\n                        newer_tag_time,\n                        older_tag_link, project_url)", "return_statement": "return log", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "\"\"", "arg_7", "=", "arg_3", ".", "strftime", "(", "arg_0", ".", "options", ".", "date_format", ")", "if", "arg_0", ".", "options", ".", "release_url", ":", "arg_8", "=", "arg_0", ".", "options", ".", "release_url", ".", "format", "(", "arg_2", ")", "else", ":", "arg_8", "=", "u\"{project_url}/tree/{newer_tag_link}\"", ".", "format", "(", "arg_5", "=", "arg_5", ",", "arg_2", "=", "arg_2", ")", "if", "not", "arg_0", ".", "options", ".", "unreleased_with_date", "and", "arg_1", "==", "arg_0", ".", "options", ".", "unreleased_label", ":", "arg_6", "+=", "u\"## [{newer_tag_name}]({release_url})\\n\\n\"", ".", "format", "(", "arg_1", "=", "arg_1", ",", "arg_8", "=", "arg_8", ")", "else", ":", "arg_6", "+=", "u\"## [{newer_tag_name}]({release_url}) \"", "u\"({time_string})\\n\"", ".", "format", "(", "arg_1", "=", "arg_1", ",", "arg_8", "=", "arg_8", ",", "arg_7", "=", "arg_7", ")", "if", "arg_0", ".", "options", ".", "compare_link", "and", "arg_4", "!=", "REPO_CREATED_TAG_NAME", ":", "arg_6", "+=", "u\"[Full Changelog]\"", "arg_6", "+=", "u\"({project_url}/compare/{older_tag_link}\"", ".", "format", "(", "arg_5", "=", "arg_5", ",", "arg_4", "=", "arg_4", ",", ")", "arg_6", "+=", "u\"...{newer_tag_link})\\n\\n\"", ".", "format", "(", "arg_2", "=", "arg_2", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2,\n                        arg_3,\n                        arg_4, arg_5):\n        \"\"\"\n        Generate a header for a tag section with specific parameters.\n\n        :param str newer_tag_name: Name (title) of newer tag.\n        :param str newer_tag_link: Tag name of newer tag, used for links.\n                               Could be same as **newer_tag_name** or some\n                               specific value, like `HEAD`.\n        :param datetime newer_tag_time: Date and time when\n                                        newer tag was created.\n        :param str older_tag_link: Tag name of older tag, used for links.\n        :param str project_url: URL for current project.\n        :rtype: str\n        :return: Generated ready-to-add tag section.\n        \"\"\"\n\n        arg_6 = \"\"\n        # Generate date string:\n        # noinspection PyUnresolvedReferences\n        arg_7 = arg_3.strftime(arg_0.options.date_format)\n\n        # Generate tag name and link\n        if arg_0.options.release_url:\n            arg_8 = arg_0.options.release_url.format(arg_2)\n        else:\n            arg_8 = u\"{project_url}/tree/{newer_tag_link}\".format(\n                arg_5=arg_5, arg_2=arg_2)\n\n        if not arg_0.options.unreleased_with_date and \\\n                arg_1 == arg_0.options.unreleased_label:\n            arg_6 += u\"## [{newer_tag_name}]({release_url})\\n\\n\".format(\n                arg_1=arg_1, arg_8=arg_8)\n        else:\n            arg_6 += u\"## [{newer_tag_name}]({release_url}) \" \\\n                   u\"({time_string})\\n\".format(\n                        arg_1=arg_1,\n                        arg_8=arg_8,\n                        arg_7=arg_7\n                   )\n\n        if arg_0.options.compare_link \\\n            and arg_4 != REPO_CREATED_TAG_NAME:\n            # Generate compare link\n            arg_6 += u\"[Full Changelog]\"\n            arg_6 += u\"({project_url}/compare/{older_tag_link}\".format(\n                arg_5=arg_5,\n                arg_4=arg_4,\n            )\n            arg_6 += u\"...{newer_tag_link})\\n\\n\".format(\n                arg_2=arg_2\n            )\n        return arg_6", "path": "pygcgen/generator.py", "identifier": "Generator.generate_header", "docstring": "Generate a header for a tag section with specific parameters.\n\n        :param str newer_tag_name: Name (title) of newer tag.\n        :param str newer_tag_link: Tag name of newer tag, used for links.\n                               Could be same as **newer_tag_name** or some\n                               specific value, like `HEAD`.\n        :param datetime newer_tag_time: Date and time when\n                                        newer tag was created.\n        :param str older_tag_link: Tag name of older tag, used for links.\n        :param str project_url: URL for current project.\n        :rtype: str\n        :return: Generated ready-to-add tag section.", "docstring_tokens": ["Generate", "a", "header", "for", "a", "tag", "section", "with", "specific", "parameters", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 258905}
{"url": "https://github.com/42cc/bets-api/blob/63a8227c7d8c65eef9974374607bc34effff5c7c/bets/__init__.py#L141-L148", "sha": "63a8227c7d8c65eef9974374607bc34effff5c7c", "docstring_summary": "Return slug of a project that given bet is associated with\n        or None if bet is not associated with any project.", "language": "python", "parameters": "(self, bet)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "get", "(", "'form_params'", ")", ":", "arg_2", "=", "json", ".", "loads", "(", "arg_1", "[", "'form_params'", "]", ")", "return", "arg_2", ".", "get", "(", "'project'", ")", "return", "None"], "function": "def Func(arg_0, arg_1):\n        '''Return slug of a project that given bet is associated with\n        or None if bet is not associated with any project.\n        '''\n        if arg_1.get('form_params'):\n            arg_2 = json.loads(arg_1['form_params'])\n            return arg_2.get('project')\n        return None", "path": "bets/__init__.py", "identifier": "BetsApi.get_project_slug", "docstring": "Return slug of a project that given bet is associated with\n        or None if bet is not associated with any project.", "docstring_tokens": ["Return", "slug", "of", "a", "project", "that", "given", "bet", "is", "associated", "with", "or", "None", "if", "bet", "is", "not", "associated", "with", "any", "project", "."], "nwo": "42cc/bets-api", "score": 0.2718259314615454, "idx": 258906}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/utils.py#L43-L65", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Copy file from `src` path to `dst` path. If `dst` already exists, will add '+' characters\n    to the end of the basename without extension.", "language": "python", "parameters": "(src, dst)", "return_statement": "return dst_pre + dst_ext", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "get_extension", "(", "arg_1", ")", "arg_3", "=", "remove_ext", "(", "arg_1", ")", "while", "op", ".", "exists", "(", "arg_3", "+", "arg_2", ")", ":", "arg_3", "+=", "'+'", "shutil", ".", "copy", "(", "arg_0", ",", "arg_3", "+", "arg_2", ")", "return", "arg_3", "+", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Copy file from `src` path to `dst` path. If `dst` already exists, will add '+' characters\n    to the end of the basename without extension.\n\n    Parameters\n    ----------\n    src: str\n\n    dst: str\n\n    Returns\n    -------\n    dstpath: str\n    \"\"\"\n    arg_2 = get_extension(arg_1)\n    arg_3 = remove_ext   (arg_1)\n\n    while op.exists(arg_3 + arg_2):\n        arg_3 += '+'\n\n    shutil.copy(arg_0, arg_3 + arg_2)\n\n    return arg_3 + arg_2", "path": "boyle/files/utils.py", "identifier": "copy_w_plus", "docstring": "Copy file from `src` path to `dst` path. If `dst` already exists, will add '+' characters\n    to the end of the basename without extension.\n\n    Parameters\n    ----------\n    src: str\n\n    dst: str\n\n    Returns\n    -------\n    dstpath: str", "docstring_tokens": ["Copy", "file", "from", "src", "path", "to", "dst", "path", ".", "If", "dst", "already", "exists", "will", "add", "+", "characters", "to", "the", "end", "of", "the", "basename", "without", "extension", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 258907}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L828-L838", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return the serialized course key given either a course run ID or course key.", "language": "python", "parameters": "(course_identifier)", "return_statement": "return quote_plus(' '.join([course_run_key.org, course_run_key.course]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "CourseKey", ".", "from_string", "(", "arg_0", ")", "except", "InvalidKeyError", ":", "return", "arg_0", "return", "quote_plus", "(", "' '", ".", "join", "(", "[", "arg_1", ".", "org", ",", "arg_1", ".", "course", "]", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Return the serialized course key given either a course run ID or course key.\n    \"\"\"\n    try:\n        arg_1 = CourseKey.from_string(arg_0)\n    except InvalidKeyError:\n        # Assume we already have a course key.\n        return arg_0\n\n    return quote_plus(' '.join([arg_1.org, arg_1.course]))", "path": "enterprise/utils.py", "identifier": "parse_course_key", "docstring": "Return the serialized course key given either a course run ID or course key.", "docstring_tokens": ["Return", "the", "serialized", "course", "key", "given", "either", "a", "course", "run", "ID", "or", "course", "key", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258908}
{"url": "https://github.com/abau171/highfive/blob/07b3829331072035ab100d1d66deca3e8f3f372a/highfive/master.py#L129-L145", "sha": "07b3829331072035ab100d1d66deca3e8f3f372a", "docstring_summary": "Called when a response to a job RPC has been received. Decodes the\n        response and finalizes the result, then reports the result to the\n        job manager.", "language": "python", "parameters": "(self, response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_closed", ":", "return", "assert", "arg_0", ".", "_job", "is", "not", "None", "logger", ".", "debug", "(", "\"worker {} got response\"", ".", "format", "(", "id", "(", "arg_0", ")", ")", ")", "arg_2", "=", "arg_0", ".", "_job", ".", "get_result", "(", "arg_1", ")", "arg_0", ".", "_manager", ".", "add_result", "(", "arg_0", ".", "_job", ",", "arg_2", ")", "arg_0", ".", "_load_job", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Called when a response to a job RPC has been received. Decodes the\n        response and finalizes the result, then reports the result to the\n        job manager.\n        \"\"\"\n\n        if arg_0._closed:\n            return\n\n        assert arg_0._job is not None\n\n        logger.debug(\"worker {} got response\".format(id(arg_0)))\n        arg_2 = arg_0._job.get_result(arg_1)\n        arg_0._manager.add_result(arg_0._job, arg_2)\n\n        arg_0._load_job()", "path": "highfive/master.py", "identifier": "Worker.response_received", "docstring": "Called when a response to a job RPC has been received. Decodes the\n        response and finalizes the result, then reports the result to the\n        job manager.", "docstring_tokens": ["Called", "when", "a", "response", "to", "a", "job", "RPC", "has", "been", "received", ".", "Decodes", "the", "response", "and", "finalizes", "the", "result", "then", "reports", "the", "result", "to", "the", "job", "manager", "."], "nwo": "abau171/highfive", "score": 0.14991498758945482, "idx": 258909}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/binding_prediction_collection.py#L23-L31", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Converts collection of BindingPrediction objects to DataFrame", "language": "python", "parameters": "(\n            self,\n            columns=BindingPrediction.fields + (\"length\",))", "return_statement": "return pd.DataFrame.from_records(\n            [tuple([getattr(x, name) for name in columns]) for x in self],\n            columns=columns)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "fields", "+", "(", "\"length\"", ",", ")", ")", ":", "return", "pd", ".", "DataFrame", ".", "from_records", "(", "[", "tuple", "(", "[", "getattr", "(", "arg_5", ",", "arg_4", ")", "for", "arg_4", "in", "arg_1", "]", ")", "for", "arg_5", "in", "arg_0", "]", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(\n            arg_0,\n            arg_1=arg_2.fields + (\"length\",)):\n        \"\"\"\n        Converts collection of BindingPrediction objects to DataFrame\n        \"\"\"\n        return pd.DataFrame.from_records(\n            [tuple([getattr(arg_5, arg_4) for arg_4 in arg_1]) for arg_5 in arg_0],\n            arg_1=arg_1)", "path": "mhctools/binding_prediction_collection.py", "identifier": "BindingPredictionCollection.to_dataframe", "docstring": "Converts collection of BindingPrediction objects to DataFrame", "docstring_tokens": ["Converts", "collection", "of", "BindingPrediction", "objects", "to", "DataFrame"], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 258910}
{"url": "https://github.com/addok/addok/blob/46a270d76ec778d2b445c2be753e5c6ba070a9b2/addok/fuzzy.py#L11-L38", "sha": "46a270d76ec778d2b445c2be753e5c6ba070a9b2", "docstring_summary": "Naive neighborhoods algo.", "language": "python", "parameters": "(word, max=1)", "return_statement": "return neighbors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "range", "(", "0", ",", "len", "(", "arg_0", ")", "-", "1", ")", ":", "arg_4", "=", "list", "(", "arg_0", ")", "arg_4", "[", "arg_3", "]", ",", "arg_4", "[", "arg_3", "+", "1", "]", "=", "arg_4", "[", "arg_3", "+", "1", "]", ",", "arg_4", "[", "arg_3", "]", "arg_2", ".", "append", "(", "''", ".", "join", "(", "arg_4", ")", ")", "for", "arg_5", "in", "string", ".", "ascii_lowercase", ":", "for", "arg_3", "in", "range", "(", "0", ",", "len", "(", "arg_0", ")", ")", ":", "arg_4", "=", "list", "(", "arg_0", ")", "if", "arg_5", "!=", "arg_4", "[", "arg_3", "]", ":", "arg_4", "[", "arg_3", "]", "=", "arg_5", "arg_2", ".", "append", "(", "''", ".", "join", "(", "arg_4", ")", ")", "for", "arg_5", "in", "string", ".", "ascii_lowercase", ":", "for", "arg_3", "in", "range", "(", "0", ",", "len", "(", "arg_0", ")", "+", "1", ")", ":", "arg_4", "=", "list", "(", "arg_0", ")", "arg_4", ".", "insert", "(", "arg_3", ",", "arg_5", ")", "arg_2", ".", "append", "(", "''", ".", "join", "(", "arg_4", ")", ")", "if", "len", "(", "arg_0", ")", ">", "3", ":", "for", "arg_3", "in", "range", "(", "0", ",", "len", "(", "arg_0", ")", ")", ":", "arg_4", "=", "list", "(", "arg_0", ")", "del", "arg_4", "[", "arg_3", "]", "arg_2", ".", "append", "(", "''", ".", "join", "(", "arg_4", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=1):\n    \"\"\"Naive neighborhoods algo.\"\"\"\n    # inversions\n    arg_2 = []\n    for arg_3 in range(0, len(arg_0) - 1):\n        arg_4 = list(arg_0)\n        arg_4[arg_3], arg_4[arg_3+1] = arg_4[arg_3+1], arg_4[arg_3]\n        arg_2.append(''.join(arg_4))\n    # substitutions\n    for arg_5 in string.ascii_lowercase:\n        for arg_3 in range(0, len(arg_0)):\n            arg_4 = list(arg_0)\n            if arg_5 != arg_4[arg_3]:\n                arg_4[arg_3] = arg_5\n                arg_2.append(''.join(arg_4))\n    # insertions\n    for arg_5 in string.ascii_lowercase:\n        for arg_3 in range(0, len(arg_0) + 1):\n            arg_4 = list(arg_0)\n            arg_4.insert(arg_3, arg_5)\n            arg_2.append(''.join(arg_4))\n    if len(arg_0) > 3:\n        # removal\n        for arg_3 in range(0, len(arg_0)):\n            arg_4 = list(arg_0)\n            del arg_4[arg_3]\n            arg_2.append(''.join(arg_4))\n    return arg_2", "path": "addok/fuzzy.py", "identifier": "make_fuzzy", "docstring": "Naive neighborhoods algo.", "docstring_tokens": ["Naive", "neighborhoods", "algo", "."], "nwo": "addok/addok", "score": 0.5575306264469764, "idx": 258911}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L1421-L1454", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Simple function calculates a property based on weighted averages of\n    properties. Weights could be mole fractions, volume fractions, mass\n    fractions, or anything else.", "language": "python", "parameters": "(fracs, props)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "none_and_length_check", "(", "[", "arg_0", ",", "arg_1", "]", ")", ":", "return", "None", "arg_2", "=", "sum", "(", "frac", "*", "prop", "for", "frac", ",", "prop", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    r'''Simple function calculates a property based on weighted averages of\n    properties. Weights could be mole fractions, volume fractions, mass\n    fractions, or anything else.\n\n    .. math::\n        y = \\sum_i \\text{frac}_i \\cdot \\text{prop}_i\n\n    Parameters\n    ----------\n    fracs : array-like\n        Fractions of a mixture\n    props: array-like\n        Properties\n\n    Returns\n    -------\n    prop : value\n        Calculated property\n\n    Notes\n    -----\n    Returns None if any fractions or properties are missing or are not of the\n    same length.\n\n    Examples\n    --------\n    >>> Func([0.1, 0.9], [0.01, 0.02])\n    0.019000000000000003\n    '''\n    if not none_and_length_check([arg_0, arg_1]):\n        return None\n    arg_2 = sum(frac*prop for frac, prop in zip(arg_0, arg_1))\n    return arg_2", "path": "thermo/utils.py", "identifier": "mixing_simple", "docstring": "r'''Simple function calculates a property based on weighted averages of\n    properties. Weights could be mole fractions, volume fractions, mass\n    fractions, or anything else.\n\n    .. math::\n        y = \\sum_i \\text{frac}_i \\cdot \\text{prop}_i\n\n    Parameters\n    ----------\n    fracs : array-like\n        Fractions of a mixture\n    props: array-like\n        Properties\n\n    Returns\n    -------\n    prop : value\n        Calculated property\n\n    Notes\n    -----\n    Returns None if any fractions or properties are missing or are not of the\n    same length.\n\n    Examples\n    --------\n    >>> mixing_simple([0.1, 0.9], [0.01, 0.02])\n    0.019000000000000003", "docstring_tokens": ["r", "Simple", "function", "calculates", "a", "property", "based", "on", "weighted", "averages", "of", "properties", ".", "Weights", "could", "be", "mole", "fractions", "volume", "fractions", "mass", "fractions", "or", "anything", "else", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 258912}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diadefslib.py#L75-L79", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "true if builtins and not show_builtins", "language": "python", "parameters": "(self, node)", "return_statement": "return node.root().name != BUILTINS_NAME", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "config", ".", "show_builtin", ":", "return", "True", "return", "arg_1", ".", "root", "(", ")", ".", "name", "!=", "BUILTINS_NAME"], "function": "def Func(arg_0, arg_1):\n        \"\"\"true if builtins and not show_builtins\"\"\"\n        if arg_0.config.show_builtin:\n            return True\n        return arg_1.root().name != BUILTINS_NAME", "path": "pylint/pyreverse/diadefslib.py", "identifier": "DiaDefGenerator.show_node", "docstring": "true if builtins and not show_builtins", "docstring_tokens": ["true", "if", "builtins", "and", "not", "show_builtins"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258913}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/time_frequency.py#L830-L914", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Compute an array of acoustic frequencies tuned to the mel scale.", "language": "python", "parameters": "(n_mels=128, fmin=0.0, fmax=11025.0, htk=False)", "return_statement": "return mel_to_hz(mels, htk=htk)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "128", ",", "arg_1", "=", "0.0", ",", "arg_2", "=", "11025.0", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "hz_to_mel", "(", "arg_1", ",", "arg_3", "=", "arg_3", ")", "arg_5", "=", "hz_to_mel", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_6", "=", "np", ".", "linspace", "(", "arg_4", ",", "arg_5", ",", "arg_0", ")", "return", "mel_to_hz", "(", "arg_6", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0=128, arg_1=0.0, arg_2=11025.0, arg_3=False):\n    \"\"\"Compute an array of acoustic frequencies tuned to the mel scale.\n\n    The mel scale is a quasi-logarithmic function of acoustic frequency\n    designed such that perceptually similar pitch intervals (e.g. octaves)\n    appear equal in width over the full hearing range.\n\n    Because the definition of the mel scale is conditioned by a finite number\n    of subjective psychoaoustical experiments, several implementations coexist\n    in the audio signal processing literature [1]_. By default, librosa replicates\n    the behavior of the well-established MATLAB Auditory Toolbox of Slaney [2]_.\n    According to this default implementation,  the conversion from Hertz to mel is\n    linear below 1 kHz and logarithmic above 1 kHz. Another available implementation\n    replicates the Hidden Markov Toolkit [3]_ (HTK) according to the following formula:\n\n    `mel = 2595.0 * np.log10(1.0 + f / 700.0).`\n\n    The choice of implementation is determined by the `htk` keyword argument: setting\n    `htk=False` leads to the Auditory toolbox implementation, whereas setting it `htk=True`\n    leads to the HTK implementation.\n\n    .. [1] Umesh, S., Cohen, L., & Nelson, D. Fitting the mel scale.\n        In Proc. International Conference on Acoustics, Speech, and Signal Processing\n        (ICASSP), vol. 1, pp. 217-220, 1998.\n\n    .. [2] Slaney, M. Auditory Toolbox: A MATLAB Toolbox for Auditory\n        Modeling Work. Technical Report, version 2, Interval Research Corporation, 1998.\n\n    .. [3] Young, S., Evermann, G., Gales, M., Hain, T., Kershaw, D., Liu, X.,\n        Moore, G., Odell, J., Ollason, D., Povey, D., Valtchev, V., & Woodland, P.\n        The HTK book, version 3.4. Cambridge University, March 2009.\n\n\n    See Also\n    --------\n    hz_to_mel\n    mel_to_hz\n    librosa.feature.melspectrogram\n    librosa.feature.mfcc\n\n\n    Parameters\n    ----------\n    n_mels    : int > 0 [scalar]\n        Number of mel bins.\n\n    fmin      : float >= 0 [scalar]\n        Minimum frequency (Hz).\n\n    fmax      : float >= 0 [scalar]\n        Maximum frequency (Hz).\n\n    htk       : bool\n        If True, use HTK formula to convert Hz to mel.\n        Otherwise (False), use Slaney's Auditory Toolbox.\n\n    Returns\n    -------\n    bin_frequencies : ndarray [shape=(n_mels,)]\n        Vector of n_mels frequencies in Hz which are uniformly spaced on the Mel\n        axis.\n\n    Examples\n    --------\n    >>> librosa.Func(n_mels=40)\n    array([     0.   ,     85.317,    170.635,    255.952,\n              341.269,    426.586,    511.904,    597.221,\n              682.538,    767.855,    853.173,    938.49 ,\n             1024.856,   1119.114,   1222.042,   1334.436,\n             1457.167,   1591.187,   1737.532,   1897.337,\n             2071.84 ,   2262.393,   2470.47 ,   2697.686,\n             2945.799,   3216.731,   3512.582,   3835.643,\n             4188.417,   4573.636,   4994.285,   5453.621,\n             5955.205,   6502.92 ,   7101.009,   7754.107,\n             8467.272,   9246.028,  10096.408,  11025.   ])\n\n    \"\"\"\n\n    # 'Center freqs' of mel bands - uniformly spaced between limits\n    arg_4 = hz_to_mel(arg_1, arg_3=arg_3)\n    arg_5 = hz_to_mel(arg_2, arg_3=arg_3)\n\n    arg_6 = np.linspace(arg_4, arg_5, arg_0)\n\n    return mel_to_hz(arg_6, arg_3=arg_3)", "path": "librosa/core/time_frequency.py", "identifier": "mel_frequencies", "docstring": "Compute an array of acoustic frequencies tuned to the mel scale.\n\n    The mel scale is a quasi-logarithmic function of acoustic frequency\n    designed such that perceptually similar pitch intervals (e.g. octaves)\n    appear equal in width over the full hearing range.\n\n    Because the definition of the mel scale is conditioned by a finite number\n    of subjective psychoaoustical experiments, several implementations coexist\n    in the audio signal processing literature [1]_. By default, librosa replicates\n    the behavior of the well-established MATLAB Auditory Toolbox of Slaney [2]_.\n    According to this default implementation,  the conversion from Hertz to mel is\n    linear below 1 kHz and logarithmic above 1 kHz. Another available implementation\n    replicates the Hidden Markov Toolkit [3]_ (HTK) according to the following formula:\n\n    `mel = 2595.0 * np.log10(1.0 + f / 700.0).`\n\n    The choice of implementation is determined by the `htk` keyword argument: setting\n    `htk=False` leads to the Auditory toolbox implementation, whereas setting it `htk=True`\n    leads to the HTK implementation.\n\n    .. [1] Umesh, S., Cohen, L., & Nelson, D. Fitting the mel scale.\n        In Proc. International Conference on Acoustics, Speech, and Signal Processing\n        (ICASSP), vol. 1, pp. 217-220, 1998.\n\n    .. [2] Slaney, M. Auditory Toolbox: A MATLAB Toolbox for Auditory\n        Modeling Work. Technical Report, version 2, Interval Research Corporation, 1998.\n\n    .. [3] Young, S., Evermann, G., Gales, M., Hain, T., Kershaw, D., Liu, X.,\n        Moore, G., Odell, J., Ollason, D., Povey, D., Valtchev, V., & Woodland, P.\n        The HTK book, version 3.4. Cambridge University, March 2009.\n\n\n    See Also\n    --------\n    hz_to_mel\n    mel_to_hz\n    librosa.feature.melspectrogram\n    librosa.feature.mfcc\n\n\n    Parameters\n    ----------\n    n_mels    : int > 0 [scalar]\n        Number of mel bins.\n\n    fmin      : float >= 0 [scalar]\n        Minimum frequency (Hz).\n\n    fmax      : float >= 0 [scalar]\n        Maximum frequency (Hz).\n\n    htk       : bool\n        If True, use HTK formula to convert Hz to mel.\n        Otherwise (False), use Slaney's Auditory Toolbox.\n\n    Returns\n    -------\n    bin_frequencies : ndarray [shape=(n_mels,)]\n        Vector of n_mels frequencies in Hz which are uniformly spaced on the Mel\n        axis.\n\n    Examples\n    --------\n    >>> librosa.mel_frequencies(n_mels=40)\n    array([     0.   ,     85.317,    170.635,    255.952,\n              341.269,    426.586,    511.904,    597.221,\n              682.538,    767.855,    853.173,    938.49 ,\n             1024.856,   1119.114,   1222.042,   1334.436,\n             1457.167,   1591.187,   1737.532,   1897.337,\n             2071.84 ,   2262.393,   2470.47 ,   2697.686,\n             2945.799,   3216.731,   3512.582,   3835.643,\n             4188.417,   4573.636,   4994.285,   5453.621,\n             5955.205,   6502.92 ,   7101.009,   7754.107,\n             8467.272,   9246.028,  10096.408,  11025.   ])", "docstring_tokens": ["Compute", "an", "array", "of", "acoustic", "frequencies", "tuned", "to", "the", "mel", "scale", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258914}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/explorations/exploration.py#L65-L74", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates an exploration object from a specification dict.", "language": "python", "parameters": "(spec)", "return_statement": "return exploration", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "util", ".", "get_object", "(", "obj", "=", "arg_0", ",", "predefined_objects", "=", "tensorforce", ".", "core", ".", "explorations", ".", "explorations", ")", "assert", "isinstance", "(", "arg_1", ",", "Exploration", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Creates an exploration object from a specification dict.\n        \"\"\"\n        arg_1 = util.get_object(\n            obj=arg_0,\n            predefined_objects=tensorforce.core.explorations.explorations\n        )\n        assert isinstance(arg_1, Exploration)\n        return arg_1", "path": "tensorforce/core/explorations/exploration.py", "identifier": "Exploration.from_spec", "docstring": "Creates an exploration object from a specification dict.", "docstring_tokens": ["Creates", "an", "exploration", "object", "from", "a", "specification", "dict", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 258915}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/canvas.py#L106-L111", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Pass a load of settings into the canvas", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "setattr", "(", "arg_0", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, **arg_1):\n        '''\n        Pass a load of Func into the canvas\n        '''\n        for arg_2, arg_3 in arg_1.items():\n            setattr(arg_0, arg_2, arg_3)", "path": "shoebot/core/canvas.py", "identifier": "Canvas.settings", "docstring": "Pass a load of settings into the canvas", "docstring_tokens": ["Pass", "a", "load", "of", "settings", "into", "the", "canvas"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258916}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varbase/trends.py#L359-L371", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is the residual function to minimize using\n    scipy.optimize.least_squares.", "language": "python", "parameters": "(coeffs,\n                   times, mags, errs,\n                   fsv, fdv, fkv, xcc, ycc, bgv, bge, iha, izd)", "return_statement": "return residual", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ")", ":", "arg_13", "=", "_epd_function", "(", "arg_0", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ")", "arg_14", "=", "arg_2", "-", "arg_13", "return", "arg_14"], "function": "def Func(arg_0,\n                   arg_1, arg_2, arg_3,\n                   arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11, arg_12):\n    '''This is the residual function to minimize using\n    scipy.optimize.least_squares.\n\n    This variant is for :py:func:`.epd_magseries_extparams`.\n\n    '''\n\n    arg_13 = _epd_function(arg_0, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11, arg_12)\n    arg_14 = arg_2 - arg_13\n    return arg_14", "path": "astrobase/varbase/trends.py", "identifier": "_epd_residual2", "docstring": "This is the residual function to minimize using\n    scipy.optimize.least_squares.\n\n    This variant is for :py:func:`.epd_magseries_extparams`.", "docstring_tokens": ["This", "is", "the", "residual", "function", "to", "minimize", "using", "scipy", ".", "optimize", ".", "least_squares", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 258917}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L1442-L1484", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Respond to executor events.", "language": "python", "parameters": "(self, simple_dag_bag, session=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "models", ".", "TaskInstance", "for", "arg_4", ",", "arg_5", "in", "list", "(", "arg_0", ".", "executor", ".", "get_event_buffer", "(", "arg_1", ".", "dag_ids", ")", ".", "items", "(", ")", ")", ":", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_4", "arg_0", ".", "log", ".", "info", "(", "\"Executor reports execution of %s.%s execution_date=%s \"", "\"exited with status %s for try_number %s\"", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_5", ",", "arg_9", ")", "if", "arg_5", "==", "State", ".", "FAILED", "or", "arg_5", "==", "State", ".", "SUCCESS", ":", "arg_10", "=", "arg_2", ".", "query", "(", "arg_3", ")", ".", "filter", "(", "arg_3", ".", "dag_id", "==", "arg_6", ",", "arg_3", ".", "task_id", "==", "arg_7", ",", "arg_3", ".", "execution_date", "==", "arg_8", ")", "arg_11", "=", "arg_10", ".", "first", "(", ")", "if", "not", "arg_11", ":", "arg_0", ".", "log", ".", "warning", "(", "\"TaskInstance %s went missing from the database\"", ",", "arg_11", ")", "continue", "if", "arg_11", ".", "try_number", "==", "arg_9", "and", "arg_11", ".", "state", "==", "State", ".", "QUEUED", ":", "arg_12", "=", "(", "\"Executor reports task instance {} finished ({}) \"", "\"although the task says its {}. Was the task \"", "\"killed externally?\"", ".", "format", "(", "arg_11", ",", "arg_5", ",", "arg_11", ".", "state", ")", ")", "arg_0", ".", "log", ".", "error", "(", "arg_12", ")", "try", ":", "arg_13", "=", "arg_1", ".", "get_dag", "(", "arg_6", ")", "arg_14", "=", "models", ".", "DagBag", "(", "arg_13", ".", "full_filepath", ")", "arg_15", "=", "arg_14", ".", "get_dag", "(", "arg_6", ")", "arg_11", ".", "task", "=", "arg_15", ".", "get_task", "(", "arg_7", ")", "arg_11", ".", "handle_failure", "(", "arg_12", ")", "except", "Exception", ":", "arg_0", ".", "log", ".", "error", "(", "\"Cannot load the dag bag to handle failure for %s\"", "\". Setting task to FAILED without callbacks or \"", "\"retries. Do you have enough resources?\"", ",", "arg_11", ")", "arg_11", ".", "state", "=", "State", ".", "FAILED", "arg_2", ".", "merge", "(", "arg_11", ")", "arg_2", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Respond to executor events.\n        \"\"\"\n        # TODO: this shares quite a lot of code with _manage_executor_state\n\n        arg_3 = models.TaskInstance\n        for arg_4, arg_5 in list(arg_0.executor.get_event_buffer(arg_1.dag_ids)\n                                   .items()):\n            arg_6, arg_7, arg_8, arg_9 = arg_4\n            arg_0.log.info(\n                \"Executor reports execution of %s.%s execution_date=%s \"\n                \"exited with status %s for try_number %s\",\n                arg_6, arg_7, arg_8, arg_5, arg_9\n            )\n            if arg_5 == State.FAILED or arg_5 == State.SUCCESS:\n                arg_10 = arg_2.query(arg_3).filter(arg_3.dag_id == arg_6,\n                                               arg_3.task_id == arg_7,\n                                               arg_3.execution_date == arg_8)\n                arg_11 = arg_10.first()\n                if not arg_11:\n                    arg_0.log.warning(\"TaskInstance %s went missing from the database\", arg_11)\n                    continue\n\n                # TODO: should we fail RUNNING as well, as we do in Backfills?\n                if arg_11.try_number == arg_9 and arg_11.state == State.QUEUED:\n                    arg_12 = (\"Executor reports task instance {} finished ({}) \"\n                           \"although the task says its {}. Was the task \"\n                           \"killed externally?\".format(arg_11, arg_5, arg_11.state))\n                    arg_0.log.error(arg_12)\n                    try:\n                        arg_13 = arg_1.get_dag(arg_6)\n                        arg_14 = models.DagBag(arg_13.full_filepath)\n                        arg_15 = arg_14.get_dag(arg_6)\n                        arg_11.task = arg_15.get_task(arg_7)\n                        arg_11.handle_failure(arg_12)\n                    except Exception:\n                        arg_0.log.error(\"Cannot load the dag bag to handle failure for %s\"\n                                       \". Setting task to FAILED without callbacks or \"\n                                       \"retries. Do you have enough resources?\", arg_11)\n                        arg_11.state = State.FAILED\n                        arg_2.merge(arg_11)\n                        arg_2.commit()", "path": "airflow/jobs.py", "identifier": "SchedulerJob._process_executor_events", "docstring": "Respond to executor events.", "docstring_tokens": ["Respond", "to", "executor", "events", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258918}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L3211-L3223", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Creates a new node. Checks if the new node needs to know the trajectory.", "language": "python", "parameters": "(self, constructor, full_name, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "if", "getattr", "(", "arg_1", ",", "'KNOWS_TRAJECTORY'", ",", "False", ")", ":", "return", "arg_1", "(", "arg_2", ",", "arg_0", ",", "*", "arg_3", ",", "**", "arg_4", ")", "else", ":", "return", "arg_1", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        \"\"\" Creates a new node. Checks if the new node needs to know the trajectory.\n\n        :param constructor:  The constructor to use\n        :param full_name: Full name of node\n        :param args: Arguments passed to constructor\n        :param kwargs: Keyword arguments passed to the constructor\n        :return:\n        \"\"\"\n        if getattr(arg_1, 'KNOWS_TRAJECTORY', False):\n            return arg_1(arg_2, arg_0, *arg_3, **arg_4)\n        else:\n            return arg_1(arg_2, *arg_3, **arg_4)", "path": "pypet/trajectory.py", "identifier": "Trajectory._construct_instance", "docstring": "Creates a new node. Checks if the new node needs to know the trajectory.\n\n        :param constructor:  The constructor to use\n        :param full_name: Full name of node\n        :param args: Arguments passed to constructor\n        :param kwargs: Keyword arguments passed to the constructor\n        :return:", "docstring_tokens": ["Creates", "a", "new", "node", ".", "Checks", "if", "the", "new", "node", "needs", "to", "know", "the", "trajectory", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 258919}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/resources/resource/base.py#L329-L411", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Serializes the data using a determined serializer.", "language": "python", "parameters": "(self, data, response=None, request=None, format=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Resource", ")", ":", "if", "not", "arg_3", ":", "arg_3", "=", "arg_0", ".", "_request", "arg_5", "=", "None", "if", "arg_4", ":", "arg_5", "=", "arg_0", ".", "meta", ".", "Funcrs", "[", "arg_4", "]", "if", "not", "arg_5", ":", "arg_6", "=", "(", "arg_3", ".", "get", "(", "'Accept'", ")", "or", "'*/*'", ")", ".", "strip", "(", ")", "if", "not", "arg_6", ":", "arg_6", "=", "'*/*'", "if", "arg_6", "!=", "'*/*'", ":", "arg_7", "=", "six", ".", "iterkeys", "(", "arg_0", ".", "_Funcr_map", ")", "arg_8", "=", "mimeparse", ".", "best_match", "(", "arg_7", ",", "arg_6", ")", "if", "arg_8", ":", "arg_4", "=", "arg_0", ".", "_Funcr_map", "[", "arg_8", "]", "arg_5", "=", "arg_0", ".", "meta", ".", "Funcrs", "[", "arg_4", "]", "else", ":", "arg_9", "=", "arg_0", ".", "meta", ".", "default_Funcr", "arg_5", "=", "arg_0", ".", "meta", ".", "Funcrs", "[", "arg_9", "]", "if", "arg_5", ":", "try", ":", "arg_10", "=", "arg_5", "(", "arg_3", ",", "arg_2", ")", "return", "arg_10", ".", "Func", "(", "arg_1", ")", ",", "arg_10", "except", "ValueError", ":", "pass", "arg_11", "=", "{", "}", "for", "arg_12", "in", "arg_0", ".", "meta", ".", "allowed_Funcrs", ":", "arg_5", "=", "arg_0", ".", "meta", ".", "Funcrs", "[", "arg_12", "]", "arg_13", "=", "arg_5", "(", "arg_3", ",", "None", ")", "if", "arg_13", ".", "can_Func", "(", "arg_1", ")", ":", "arg_11", "[", "arg_12", "]", "=", "arg_5", ".", "media_types", "[", "0", "]", "raise", "http", ".", "exceptions", ".", "NotAcceptable", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"Serializes the data using a determined Funcr.\n\n        @param[in] data\n            The data to be Funcd.\n\n        @param[in] response\n            The response object to Func the data to.\n            If this method is invoked as an instance method, the response\n            object can be omitted and it will be taken from the instance.\n\n        @param[in] request\n            The request object to pull information from; normally used to\n            determine the serialization format (when `format` is not provided).\n            May be used by some Funcrs as well to pull additional headers.\n            If this method is invoked as an instance method, the request\n            object can be omitted and it will be taken from the instance.\n\n        @param[in] format\n            A specific format to Func in; if provided, no detection is\n            done. If not provided, the accept header (as well as the URL\n            extension) is looked at to determine an appropriate Funcr.\n\n        @returns\n            A tuple of the Funcd text and an instance of the\n            Funcr used.\n        \"\"\"\n        if isinstance(arg_0, Resource):\n            if not arg_3:\n                # Ensure we have a response object.\n                arg_3 = arg_0._request\n\n        arg_5 = None\n        if arg_4:\n            # An explicit format was given; do not attempt to auto-detect\n            # a Funcr.\n            arg_5 = arg_0.meta.Funcrs[arg_4]\n\n        if not arg_5:\n            # Determine an appropriate Funcr to use by\n            # introspecting the request object and looking at the `Accept`\n            # header.\n            arg_6 = (arg_3.get('Accept') or '*/*').strip()\n            if not arg_6:\n                # Default the media ranges to */*\n                arg_6 = '*/*'\n\n            if arg_6 != '*/*':\n                # Parse the media ranges and determine the Funcr\n                # that is the closest match.\n                arg_7 = six.iterkeys(arg_0._Funcr_map)\n                arg_8 = mimeparse.best_match(arg_7, arg_6)\n                if arg_8:\n                    arg_4 = arg_0._Funcr_map[arg_8]\n                    arg_5 = arg_0.meta.Funcrs[arg_4]\n\n            else:\n                # Client indicated no preference; use the default.\n                arg_9 = arg_0.meta.default_Funcr\n                arg_5 = arg_0.meta.Funcrs[arg_9]\n\n        if arg_5:\n            try:\n                # Attempt to Func the data using the determined\n                # Funcr.\n                arg_10 = arg_5(arg_3, arg_2)\n                return arg_10.Func(arg_1), arg_10\n\n            except ValueError:\n                # Failed to Func the data.\n                pass\n\n        # Either failed to determine a Funcr or failed to Func\n        # the data; construct a list of available and valid encoders.\n        arg_11 = {}\n        for arg_12 in arg_0.meta.allowed_Funcrs:\n            arg_5 = arg_0.meta.Funcrs[arg_12]\n            arg_13 = arg_5(arg_3, None)\n            if arg_13.can_Func(arg_1):\n                arg_11[arg_12] = arg_5.media_types[0]\n\n        # Raise a Not Acceptable exception.\n        raise http.exceptions.NotAcceptable(arg_11)", "path": "armet/resources/resource/base.py", "identifier": "Resource.serialize", "docstring": "Serializes the data using a determined serializer.\n\n        @param[in] data\n            The data to be serialized.\n\n        @param[in] response\n            The response object to serialize the data to.\n            If this method is invoked as an instance method, the response\n            object can be omitted and it will be taken from the instance.\n\n        @param[in] request\n            The request object to pull information from; normally used to\n            determine the serialization format (when `format` is not provided).\n            May be used by some serializers as well to pull additional headers.\n            If this method is invoked as an instance method, the request\n            object can be omitted and it will be taken from the instance.\n\n        @param[in] format\n            A specific format to serialize in; if provided, no detection is\n            done. If not provided, the accept header (as well as the URL\n            extension) is looked at to determine an appropriate serializer.\n\n        @returns\n            A tuple of the serialized text and an instance of the\n            serializer used.", "docstring_tokens": ["Serializes", "the", "data", "using", "a", "determined", "serializer", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 258920}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/Client.py#L122-L129", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Updates a player's state when a payload with opcode ``playerUpdate`` is received.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "int", "(", "arg_1", "[", "'guildId'", "]", ")", "if", "arg_2", "in", "arg_0", ".", "players", ":", "arg_3", "=", "arg_0", ".", "players", ".", "get", "(", "arg_2", ")", "arg_3", ".", "position", "=", "arg_1", "[", "'state'", "]", ".", "get", "(", "'position'", ",", "0", ")", "arg_3", ".", "position_timestamp", "=", "arg_1", "[", "'state'", "]", "[", "'time'", "]"], "function": "async def Func(arg_0, arg_1):\r\n        \"\"\" Updates a player's state when a payload with opcode ``playerUpdate`` is received. \"\"\"\r\n        arg_2 = int(arg_1['guildId'])\r\n\r\n        if arg_2 in arg_0.players:\r\n            arg_3 = arg_0.players.get(arg_2)\r\n            arg_3.position = arg_1['state'].get('position', 0)\r\n            arg_3.position_timestamp = arg_1['state']['time']", "path": "lavalink/Client.py", "identifier": "Client.update_state", "docstring": "Updates a player's state when a payload with opcode ``playerUpdate`` is received.", "docstring_tokens": ["Updates", "a", "player", "s", "state", "when", "a", "payload", "with", "opcode", "playerUpdate", "is", "received", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 258921}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/hosted_zone.py#L324-L342", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Creates a PTR record attached to this hosted zone.", "language": "python", "parameters": "(self, name, values, ttl=60)", "return_statement": "return self._add_record(PTRResourceRecordSet, **values)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "60", ")", ":", "arg_0", ".", "_halt_if_already_deleted", "(", ")", "arg_2", "=", "locals", "(", ")", "del", "arg_2", "[", "'self'", "]", "return", "arg_0", ".", "_add_record", "(", "PTRResourceRecordSet", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=60):\n        \"\"\"\n        Creates a PTR record attached to this hosted zone.\n\n        :param str name: The fully qualified name of the record to add.\n        :param list values: A list of value strings for the record.\n        :keyword int ttl: The time-to-live of the record (in seconds).\n        :rtype: tuple\n        :returns: A tuple in the form of ``(rrset, change_info)``, where\n            ``rrset`` is the newly created PTRResourceRecordSet instance.\n        \"\"\"\n\n        arg_0._halt_if_already_deleted()\n\n        # Grab the params/kwargs here for brevity's sake.\n        arg_2 = locals()\n        del arg_2['self']\n\n        return arg_0._add_record(PTRResourceRecordSet, **arg_2)", "path": "route53/hosted_zone.py", "identifier": "HostedZone.create_ptr_record", "docstring": "Creates a PTR record attached to this hosted zone.\n\n        :param str name: The fully qualified name of the record to add.\n        :param list values: A list of value strings for the record.\n        :keyword int ttl: The time-to-live of the record (in seconds).\n        :rtype: tuple\n        :returns: A tuple in the form of ``(rrset, change_info)``, where\n            ``rrset`` is the newly created PTRResourceRecordSet instance.", "docstring_tokens": ["Creates", "a", "PTR", "record", "attached", "to", "this", "hosted", "zone", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 258922}
{"url": "https://github.com/egh/ledger-autosync/blob/7a303f3a693261d10f677c01fb08f35c105a1e1b/ledgerautosync/converter.py#L403-L507", "sha": "7a303f3a693261d10f677c01fb08f35c105a1e1b", "docstring_summary": "Convert an OFX Transaction to a posting", "language": "python", "parameters": "(self, txn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "mk_ofxid", "(", "arg_1", ".", "id", ")", "arg_3", "=", "{", "}", "arg_4", "=", "{", "\"ofxid\"", ":", "arg_2", "}", "if", "isinstance", "(", "arg_1", ",", "OfxTransaction", ")", ":", "arg_5", "=", "Posting", "(", "arg_0", ".", "name", ",", "Amount", "(", "arg_1", ".", "amount", ",", "arg_0", ".", "currency", ")", ",", "arg_3", "=", "arg_4", ")", "return", "Transaction", "(", "date", "=", "arg_1", ".", "date", ",", "payee", "=", "arg_0", ".", "format_payee", "(", "arg_1", ")", ",", "postings", "=", "[", "arg_5", ",", "arg_5", ".", "clone_inverted", "(", "arg_0", ".", "mk_dynamic_account", "(", "arg_0", ".", "format_payee", "(", "arg_1", ")", ",", "exclude", "=", "arg_0", ".", "name", ")", ")", "]", ")", "elif", "isinstance", "(", "arg_1", ",", "InvestmentTransaction", ")", ":", "arg_6", "=", "arg_0", ".", "name", "arg_7", "=", "arg_0", ".", "name", "arg_8", "=", "None", "arg_9", "=", "None", "arg_10", "=", "arg_0", ".", "maybe_get_ticker", "(", "arg_1", ".", "security", ")", "if", "isinstance", "(", "arg_1", ".", "type", ",", "str", ")", ":", "if", "re", ".", "match", "(", "'^(buy|sell)'", ",", "arg_1", ".", "type", ")", ":", "arg_7", "=", "arg_0", ".", "unknownaccount", "or", "'Assets:Unknown'", "elif", "arg_1", ".", "type", "==", "'transfer'", ":", "arg_7", "=", "'Transfer'", "elif", "arg_1", ".", "type", "==", "'reinvest'", ":", "arg_7", "=", "'Income:Interest'", "elif", "arg_1", ".", "type", "==", "'income'", "and", "arg_1", ".", "income_type", "==", "'DIV'", ":", "arg_3", "[", "'dividend_from'", "]", "=", "arg_10", "arg_7", "=", "'Income:Dividends'", "arg_8", "=", "Posting", "(", "arg_6", ",", "Amount", "(", "arg_1", ".", "total", ",", "arg_0", ".", "currency", ")", ",", "arg_3", "=", "arg_4", ")", "arg_9", "=", "arg_8", ".", "clone_inverted", "(", "arg_7", ")", "else", ":", "pass", "else", ":", "if", "(", "arg_1", ".", "type", "in", "[", "0", ",", "1", ",", "3", ",", "4", "]", ")", ":", "arg_7", "=", "arg_0", ".", "unknownaccount", "or", "'Assets:Unknown'", "elif", "(", "arg_1", ".", "type", "==", "2", ")", ":", "arg_7", "=", "'Income:Interest'", "else", ":", "pass", "arg_11", "=", "None", "if", "arg_1", ".", "settleDate", "is", "not", "None", "and", "arg_1", ".", "settleDate", "!=", "arg_1", ".", "tradeDate", ":", "arg_11", "=", "arg_1", ".", "settleDate", "if", "arg_8", "is", "None", "and", "arg_9", "is", "None", ":", "arg_8", "=", "Posting", "(", "arg_6", ",", "Amount", "(", "arg_1", ".", "units", ",", "arg_10", ",", "unlimited", "=", "True", ")", ",", "unit_price", "=", "Amount", "(", "arg_1", ".", "unit_price", ",", "arg_0", ".", "currency", ",", "unlimited", "=", "True", ")", ",", "arg_3", "=", "arg_4", ")", "arg_9", "=", "Posting", "(", "arg_7", ",", "Amount", "(", "arg_1", ".", "units", "*", "arg_1", ".", "unit_price", ",", "arg_0", ".", "currency", ",", "reverse", "=", "True", ")", ")", "else", ":", "pass", "return", "Transaction", "(", "date", "=", "arg_1", ".", "tradeDate", ",", "arg_11", "=", "arg_11", ",", "payee", "=", "arg_0", ".", "format_payee", "(", "arg_1", ")", ",", "arg_3", "=", "arg_3", ",", "postings", "=", "[", "arg_8", ",", "arg_9", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert an OFX Transaction to a posting\n        \"\"\"\n\n        arg_2 = arg_0.mk_ofxid(arg_1.id)\n        arg_3 = {}\n        arg_4 = {\"ofxid\": arg_2}\n\n        if isinstance(arg_1, OfxTransaction):\n            arg_5 = Posting(arg_0.name,\n                              Amount(arg_1.amount, arg_0.currency),\n                              arg_3=arg_4)\n            return Transaction(\n                date=arg_1.date,\n                payee=arg_0.format_payee(arg_1),\n                postings=[\n                    arg_5,\n                    arg_5.clone_inverted(\n                        arg_0.mk_dynamic_account(arg_0.format_payee(arg_1),\n                                                exclude=arg_0.name))])\n        elif isinstance(arg_1, InvestmentTransaction):\n            arg_6 = arg_0.name\n            arg_7 = arg_0.name\n\n            arg_8 = None\n            arg_9 = None\n\n            arg_10 = arg_0.maybe_get_ticker(arg_1.security)\n\n            if isinstance(arg_1.type, str):\n                # recent versions of ofxparse\n                if re.match('^(buy|sell)', arg_1.type):\n                    arg_7 = arg_0.unknownaccount or 'Assets:Unknown'\n                elif arg_1.type == 'transfer':\n                    arg_7 = 'Transfer'\n                elif arg_1.type == 'reinvest':\n                    # reinvestment of income\n                    # TODO: make this configurable\n                    arg_7 = 'Income:Interest'\n                elif arg_1.type == 'income' and arg_1.income_type == 'DIV':\n                    # Fidelity lists non-reinvested dividend income as\n                    # type: income, income_type: DIV\n                    # TODO: determine how dividend income is listed from other institutions\n                    # income/DIV transactions do not involve buying or selling a security\n                    # so their postings need special handling compared to\n                    # others\n                    arg_3['dividend_from'] = arg_10\n                    arg_7 = 'Income:Dividends'\n                    arg_8 = Posting(arg_6,\n                                       Amount(arg_1.total, arg_0.currency),\n                                       arg_3=arg_4)\n                    arg_9 = arg_8.clone_inverted(arg_7)\n                else:\n                    # ???\n                    pass\n            else:\n                # Old version of ofxparse\n                if (arg_1.type in [0, 1, 3, 4]):\n                    # buymf, sellmf, buystock, sellstock\n                    arg_7 = arg_0.unknownaccount or 'Assets:Unknown'\n                elif (arg_1.type == 2):\n                    # reinvest\n                    arg_7 = 'Income:Interest'\n                else:\n                    # ???\n                    pass\n\n            arg_11 = None\n            if arg_1.settleDate is not None and \\\n               arg_1.settleDate != arg_1.tradeDate:\n                arg_11 = arg_1.settleDate\n\n            # income/DIV already defined above;\n            # this block defines all other posting types\n            if arg_8 is None and arg_9 is None:\n                arg_8 = Posting(\n                    arg_6,\n                    Amount(\n                        arg_1.units,\n                        arg_10,\n                        unlimited=True),\n                    unit_price=Amount(\n                        arg_1.unit_price,\n                        arg_0.currency,\n                        unlimited=True),\n                    arg_3=arg_4)\n                arg_9 = Posting(\n                    arg_7,\n                    Amount(\n                        arg_1.units *\n                        arg_1.unit_price,\n                        arg_0.currency,\n                        reverse=True))\n            else:\n                # Previously defined if type:income income_type/DIV\n                pass\n\n            return Transaction(\n                date=arg_1.tradeDate,\n                arg_11=arg_11,\n                payee=arg_0.format_payee(arg_1),\n                arg_3=arg_3,\n                postings=[arg_8, arg_9]\n            )", "path": "ledgerautosync/converter.py", "identifier": "OfxConverter.convert", "docstring": "Convert an OFX Transaction to a posting", "docstring_tokens": ["Convert", "an", "OFX", "Transaction", "to", "a", "posting"], "nwo": "egh/ledger-autosync", "score": 0.7519078746094147, "idx": 258923}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/packet.py#L397-L409", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Get 6D data.", "language": "python", "parameters": "(self, component_info=None, data=None, component_position=None)", "return_statement": "return components", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "arg_4", ".", "append", "for", "arg_6", "in", "range", "(", "arg_1", ".", "body_count", ")", ":", "arg_3", ",", "arg_7", "=", "QRTPacket", ".", "_get_exact", "(", "RT6DBodyPosition", ",", "arg_2", ",", "arg_3", ")", "arg_3", ",", "arg_8", "=", "QRTPacket", ".", "_get_tuple", "(", "RT6DBodyRotation", ",", "arg_2", ",", "arg_3", ")", "arg_5", "(", "(", "arg_7", ",", "arg_8", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Get 6D data.\"\"\"\n        arg_4 = []\n        arg_5 = arg_4.append\n        for arg_6 in range(arg_1.body_count):\n            arg_3, arg_7 = QRTPacket._get_exact(\n                RT6DBodyPosition, arg_2, arg_3\n            )\n            arg_3, arg_8 = QRTPacket._get_tuple(\n                RT6DBodyRotation, arg_2, arg_3\n            )\n            arg_5((arg_7, arg_8))\n        return arg_4", "path": "qtm/packet.py", "identifier": "QRTPacket.get_6d", "docstring": "Get 6D data.", "docstring_tokens": ["Get", "6D", "data", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 258924}
{"url": "https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/remo.py#L173-L195", "sha": "4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4", "docstring_summary": "Extracts the update time from a ReMo item.", "language": "python", "parameters": "(item)", "return_statement": "return float(str_to_datetime(updated).timestamp())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'end'", "in", "arg_0", ":", "arg_1", "=", "arg_0", "[", "'end'", "]", "elif", "'date_joined_program'", "in", "arg_0", ":", "arg_1", "=", "arg_0", "[", "'date_joined_program'", "]", "elif", "'report_date'", "in", "arg_0", ":", "arg_1", "=", "arg_0", "[", "'report_date'", "]", "else", ":", "raise", "ValueError", "(", "\"Can't find updated field for item \"", "+", "str", "(", "arg_0", ")", ")", "return", "float", "(", "str_to_datetime", "(", "arg_1", ")", ".", "timestamp", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Extracts the update time from a ReMo item.\n\n        The timestamp is extracted from 'end' field.\n        This date is converted to a perceval format using a float value.\n\n        :param item: item generated by the backend\n\n        :returns: a UNIX timestamp\n        \"\"\"\n        if 'end' in arg_0:\n            # events updated field\n            arg_1 = arg_0['end']\n        elif 'date_joined_program' in arg_0:\n            # users updated field that always appear\n            arg_1 = arg_0['date_joined_program']\n        elif 'report_date' in arg_0:\n            # activities updated field\n            arg_1 = arg_0['report_date']\n        else:\n            raise ValueError(\"Can't find updated field for item \" + str(arg_0))\n\n        return float(str_to_datetime(arg_1).timestamp())", "path": "perceval/backends/mozilla/remo.py", "identifier": "ReMo.metadata_updated_on", "docstring": "Extracts the update time from a ReMo item.\n\n        The timestamp is extracted from 'end' field.\n        This date is converted to a perceval format using a float value.\n\n        :param item: item generated by the backend\n\n        :returns: a UNIX timestamp", "docstring_tokens": ["Extracts", "the", "update", "time", "from", "a", "ReMo", "item", "."], "nwo": "chaoss/grimoirelab-perceval-mozilla", "score": 0.18579120894425885, "idx": 258925}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/palettes.py#L744-L798", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Utility for creating continuous palette from the cubehelix system.", "language": "python", "parameters": "(start=0, rot=.4, gamma=1.0, hue=0.8,\n                  light=.85, dark=.15, reverse=False)", "return_statement": "return cubehelix_palette", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0", ",", "arg_1", "=", ".4", ",", "arg_2", "=", "1.0", ",", "arg_3", "=", "0.8", ",", "arg_4", "=", ".85", ",", "arg_5", "=", ".15", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "mpl", ".", "_cm", ".", "cubehelix", "(", "arg_2", ",", "arg_0", ",", "arg_1", ",", "arg_3", ")", "arg_8", "=", "mpl", ".", "colors", ".", "LinearSegmentedColormap", "(", "'cubehelix'", ",", "arg_7", ")", "def", "Funcette", "(", "arg_9", ")", ":", "arg_10", "=", "np", ".", "linspace", "(", "arg_4", ",", "arg_5", ",", "arg_9", ")", "return", "[", "mcolors", ".", "rgb2hex", "(", "arg_8", "(", "arg_11", ")", ")", "for", "arg_11", "in", "arg_10", "]", "return", "Funcette"], "function": "def Func(arg_0=0, arg_1=.4, arg_2=1.0, arg_3=0.8,\n                  arg_4=.85, arg_5=.15, arg_6=False):\n    \"\"\"\n    Utility for creating continuous palette from the cubehelix system.\n\n    This produces a colormap with linearly-decreasing (or increasing)\n    brightness. That means that information will be preserved if printed to\n    black and white or viewed by someone who is colorblind.\n\n    Parameters\n    ----------\n    start : float (0 <= start <= 3)\n        The hue at the start of the helix.\n    rot : float\n        Rotations around the hue wheel over the range of the palette.\n    gamma : float (0 <= gamma)\n        Gamma factor to emphasize darker (gamma < 1) or lighter (gamma > 1)\n        colors.\n    hue : float (0 <= hue <= 1)\n        Saturation of the colors.\n    dark : float (0 <= dark <= 1)\n        Intensity of the darkest color in the palette.\n    light : float (0 <= light <= 1)\n        Intensity of the lightest color in the palette.\n    reverse : bool\n        If True, the palette will go from dark to light.\n\n    Returns\n    -------\n    out : function\n        Continuous color palette that takes a single\n        :class:`int` parameter ``n`` and returns ``n``\n        equally spaced colors.\n\n\n    References\n    ----------\n    Green, D. A. (2011). \"A colour scheme for the display of astronomical\n    intensity images\". Bulletin of the Astromical Society of India, Vol. 39,\n    p. 289-295.\n\n    Examples\n    --------\n    >>> palette = Func()\n    >>> palette(5)\n    ['#edd1cb', '#d499a7', '#aa688f', '#6e4071', '#2d1e3e']\n    \"\"\"\n    arg_7 = mpl._cm.cubehelix(arg_2, arg_0, arg_1, arg_3)\n    arg_8 = mpl.colors.LinearSegmentedColormap('cubehelix', arg_7)\n\n    def Funcette(arg_9):\n        arg_10 = np.linspace(arg_4, arg_5, arg_9)\n        return [mcolors.rgb2hex(arg_8(arg_11)) for arg_11 in arg_10]\n\n    return Funcette", "path": "mizani/palettes.py", "identifier": "cubehelix_pal", "docstring": "Utility for creating continuous palette from the cubehelix system.\n\n    This produces a colormap with linearly-decreasing (or increasing)\n    brightness. That means that information will be preserved if printed to\n    black and white or viewed by someone who is colorblind.\n\n    Parameters\n    ----------\n    start : float (0 <= start <= 3)\n        The hue at the start of the helix.\n    rot : float\n        Rotations around the hue wheel over the range of the palette.\n    gamma : float (0 <= gamma)\n        Gamma factor to emphasize darker (gamma < 1) or lighter (gamma > 1)\n        colors.\n    hue : float (0 <= hue <= 1)\n        Saturation of the colors.\n    dark : float (0 <= dark <= 1)\n        Intensity of the darkest color in the palette.\n    light : float (0 <= light <= 1)\n        Intensity of the lightest color in the palette.\n    reverse : bool\n        If True, the palette will go from dark to light.\n\n    Returns\n    -------\n    out : function\n        Continuous color palette that takes a single\n        :class:`int` parameter ``n`` and returns ``n``\n        equally spaced colors.\n\n\n    References\n    ----------\n    Green, D. A. (2011). \"A colour scheme for the display of astronomical\n    intensity images\". Bulletin of the Astromical Society of India, Vol. 39,\n    p. 289-295.\n\n    Examples\n    --------\n    >>> palette = cubehelix_pal()\n    >>> palette(5)\n    ['#edd1cb', '#d499a7', '#aa688f', '#6e4071', '#2d1e3e']", "docstring_tokens": ["Utility", "for", "creating", "continuous", "palette", "from", "the", "cubehelix", "system", "."], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 258926}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/NCC.py#L167-L193", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Infer causal directions using the trained NCC pairwise model.", "language": "python", "parameters": "(self, a, b, device=None)", "return_statement": "return (self.model(m).data.cpu().numpy()-.5) * 2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_3", "=", "SETTINGS", ".", "get_default", "(", "arg_3", "=", "arg_3", ")", "if", "arg_0", ".", "model", "is", "None", ":", "print", "(", "'Model has to be trained before doing any predictions'", ")", "raise", "ValueError", "if", "len", "(", "np", ".", "array", "(", "arg_1", ")", ".", "shape", ")", "==", "1", ":", "arg_1", "=", "np", ".", "array", "(", "arg_1", ")", ".", "reshape", "(", "(", "-", "1", ",", "1", ")", ")", "arg_2", "=", "np", ".", "array", "(", "arg_2", ")", ".", "reshape", "(", "(", "-", "1", ",", "1", ")", ")", "arg_4", "=", "np", ".", "hstack", "(", "(", "arg_1", ",", "arg_2", ")", ")", "arg_4", "=", "scale", "(", "arg_4", ")", "arg_4", "=", "arg_4", ".", "astype", "(", "'float32'", ")", "arg_4", "=", "th", ".", "from_numpy", "(", "arg_4", ")", ".", "t", "(", ")", ".", "unsqueeze", "(", "0", ")", "if", "th", ".", "cuda", ".", "is_available", "(", ")", ":", "arg_4", "=", "arg_4", ".", "cuda", "(", ")", "return", "(", "arg_0", ".", "model", "(", "arg_4", ")", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "-", ".5", ")", "*", "2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Infer causal directions using the trained NCC pairwise model.\n\n        Args:\n            a (numpy.ndarray): Variable 1\n            b (numpy.ndarray): Variable 2\n            device (str): Device to run the algorithm on (defaults to ``cdt.SETTINGS.default_device``)\n\n        Returns:\n            float: Causation score (Value : 1 if a->b and -1 if b->a)\n        \"\"\"\n        arg_3 = SETTINGS.get_default(arg_3=arg_3)\n        if arg_0.model is None:\n            print('Model has to be trained before doing any predictions')\n            raise ValueError\n        if len(np.array(arg_1).shape) == 1:\n            arg_1 = np.array(arg_1).reshape((-1, 1))\n            arg_2 = np.array(arg_2).reshape((-1, 1))\n        arg_4 = np.hstack((arg_1, arg_2))\n        arg_4 = scale(arg_4)\n        arg_4 = arg_4.astype('float32')\n        arg_4 = th.from_numpy(arg_4).t().unsqueeze(0)\n\n        if th.cuda.is_available():\n            arg_4 = arg_4.cuda()\n\n        return (arg_0.model(arg_4).data.cpu().numpy()-.5) * 2", "path": "cdt/causality/pairwise/NCC.py", "identifier": "NCC.predict_proba", "docstring": "Infer causal directions using the trained NCC pairwise model.\n\n        Args:\n            a (numpy.ndarray): Variable 1\n            b (numpy.ndarray): Variable 2\n            device (str): Device to run the algorithm on (defaults to ``cdt.SETTINGS.default_device``)\n\n        Returns:\n            float: Causation score (Value : 1 if a->b and -1 if b->a)", "docstring_tokens": ["Infer", "causal", "directions", "using", "the", "trained", "NCC", "pairwise", "model", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 258927}
{"url": "https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/http.py#L42-L47", "sha": "c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa", "docstring_summary": "Turns response into a properly formatted json or text object", "language": "python", "parameters": "(response)", "return_statement": "return text", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "await", "arg_0", ".", "text", "(", ")", "if", "arg_0", ".", "headers", "[", "'Content-Type'", "]", "==", "'application/json; charset=utf-8'", ":", "return", "json", ".", "loads", "(", "arg_1", ")", "return", "arg_1"], "function": "async def Func(arg_0):\n    \"\"\"Turns response into a properly formatted json or text object\"\"\"\n    arg_1 = await arg_0.text()\n    if arg_0.headers['Content-Type'] == 'application/json; charset=utf-8':\n        return json.loads(arg_1)\n    return arg_1", "path": "dbl/http.py", "identifier": "json_or_text", "docstring": "Turns response into a properly formatted json or text object", "docstring_tokens": ["Turns", "response", "into", "a", "properly", "formatted", "json", "or", "text", "object"], "nwo": "DiscordBotList/DBL-Python-Library", "score": 0.7172353400860905, "idx": 258928}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L670-L688", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Load roster from an XML file.", "language": "python", "parameters": "(self, source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "ElementTree", ".", "parse", "(", "arg_1", ")", "except", "ElementTree", ".", "ParseError", ",", "err", ":", "raise", "ValueError", "(", "\"Invalid roster format: {0}\"", ".", "format", "(", "err", ")", ")", "arg_3", "=", "Roster", ".", "from_xml", "(", "arg_2", ".", "getroot", "(", ")", ")", "for", "arg_4", "in", "arg_3", ":", "arg_4", ".", "verify_roster_result", "(", "True", ")", "arg_0", ".", "roster", "=", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Load roster from an XML file.\n\n        Can be used before the connection is started to load saved\n        roster copy, for efficient retrieval of versioned roster.\n\n        :Parameters:\n            - `source`: file name or a file object\n        :Types:\n            - `source`: `str` or file-like object\n        \"\"\"\n        try:\n            arg_2 = ElementTree.parse(arg_1)\n        except ElementTree.ParseError, err:\n            raise ValueError(\"Invalid roster format: {0}\".format(err))\n        arg_3 = Roster.from_xml(arg_2.getroot())\n        for arg_4 in arg_3:\n            arg_4.verify_roster_result(True)\n        arg_0.roster = arg_3", "path": "pyxmpp2/roster.py", "identifier": "RosterClient.load_roster", "docstring": "Load roster from an XML file.\n\n        Can be used before the connection is started to load saved\n        roster copy, for efficient retrieval of versioned roster.\n\n        :Parameters:\n            - `source`: file name or a file object\n        :Types:\n            - `source`: `str` or file-like object", "docstring_tokens": ["Load", "roster", "from", "an", "XML", "file", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 258929}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/interengine/bintree.py#L103-L107", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "accept either IP address or dns name, and return IP", "language": "python", "parameters": "(url, location)", "return_statement": "return disambiguate_url(url, location)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "ip_pat", ".", "match", "(", "arg_1", ")", ":", "arg_1", "=", "socket", ".", "gethostbyname", "(", "arg_1", ")", "return", "disambiguate_url", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"accept either IP address or dns name, and return IP\"\"\"\n    if not ip_pat.match(arg_1):\n        arg_1 = socket.gethostbyname(arg_1)\n    return disambiguate_url(arg_0, arg_1)", "path": "environment/share/doc/ipython/examples/parallel/interengine/bintree.py", "identifier": "disambiguate_dns_url", "docstring": "accept either IP address or dns name, and return IP", "docstring_tokens": ["accept", "either", "IP", "address", "or", "dns", "name", "and", "return", "IP"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258930}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L133-L146", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "analyze every unanalyzed ABF in the folder.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "str", "(", "arg_0", ".", "files2", ")", "arg_0", ".", "log", ".", "debug", "(", "\"considering analysis for %d ABFs\"", ",", "len", "(", "arg_0", ".", "IDs", ")", ")", "for", "arg_2", "in", "arg_0", ".", "IDs", ":", "if", "not", "arg_2", "+", "\"_\"", "in", "arg_1", ":", "arg_0", ".", "log", ".", "debug", "(", "\"%s needs analysis\"", ",", "arg_2", ")", "try", ":", "arg_0", ".", "analyzeABF", "(", "arg_2", ")", "except", ":", "print", "(", "\"EXCEPTION! \"", "*", "100", ")", "else", ":", "arg_0", ".", "log", ".", "debug", "(", "\"%s has existing analysis, not overwriting\"", ",", "arg_2", ")", "arg_0", ".", "log", ".", "debug", "(", "\"verified analysis of %d ABFs\"", ",", "len", "(", "arg_0", ".", "IDs", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"analyze every unanalyzed ABF in the folder.\"\"\"\n        arg_1=str(arg_0.files2)\n        arg_0.log.debug(\"considering analysis for %d ABFs\",len(arg_0.IDs))\n        for arg_2 in arg_0.IDs:\n            if not arg_2+\"_\" in arg_1:\n                arg_0.log.debug(\"%s needs analysis\",arg_2)\n                try:\n                    arg_0.analyzeABF(arg_2)\n                except:\n                    print(\"EXCEPTION! \"*100)\n            else:\n                arg_0.log.debug(\"%s has existing analysis, not overwriting\",arg_2)\n        arg_0.log.debug(\"verified analysis of %d ABFs\",len(arg_0.IDs))", "path": "swhlab/indexing/indexing.py", "identifier": "INDEX.analyzeAll", "docstring": "analyze every unanalyzed ABF in the folder.", "docstring_tokens": ["analyze", "every", "unanalyzed", "ABF", "in", "the", "folder", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 258931}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L918-L976", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Return a Python AST node for a function with a single arity.", "language": "python", "parameters": "(\n    ctx: GeneratorContext,\n    node: Fn,\n    method: FnMethod,\n    def_name: Optional[str] = None,\n    meta_node: Optional[MetaNode] = None,\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", ",", "arg_6", ":", "arg_7", "[", "arg_8", "]", "=", "None", ",", "arg_9", ":", "arg_7", "[", "arg_10", "]", "=", "None", ",", ")", "->", "GeneratedPyAST", ":", "assert", "arg_2", ".", "op", "==", "NodeOp", ".", "FN", "assert", "arg_4", ".", "op", "==", "NodeOp", ".", "FN_METHOD", "arg_11", "=", "arg_2", ".", "local", ".", "name", "if", "arg_2", ".", "local", "is", "not", "None", "else", "None", "arg_12", "=", "__fn_name", "(", "arg_11", ")", "if", "arg_6", "is", "None", "else", "munge", "(", "arg_6", ")", "arg_13", "=", "ast", ".", "AsyncFunctionDef", "if", "arg_2", ".", "is_async", "else", "ast", ".", "FunctionDef", "with", "arg_0", ".", "new_symbol_table", "(", "arg_12", ")", ",", "arg_0", ".", "new_recur_point", "(", "arg_4", ".", "loop_id", ",", "RecurType", ".", "FN", ",", "is_variadic", "=", "arg_2", ".", "is_variadic", ")", ":", "if", "arg_11", "is", "not", "None", ":", "arg_0", ".", "symbol_table", ".", "new_symbol", "(", "sym", ".", "symbol", "(", "arg_11", ")", ",", "arg_12", ",", "LocalType", ".", "FN", ")", "arg_14", ",", "arg_15", ",", "arg_16", "=", "__fn_args_to_py_ast", "(", "arg_0", ",", "arg_4", ".", "params", ",", "arg_4", ".", "body", ")", "arg_17", ",", "arg_18", "=", "__fn_meta", "(", "arg_0", ",", "arg_9", ")", "return", "GeneratedPyAST", "(", "arg_2", "=", "ast", ".", "Name", "(", "id", "=", "arg_12", ",", "arg_0", "=", "ast", ".", "Load", "(", ")", ")", ",", "dependencies", "=", "list", "(", "chain", "(", "arg_17", ",", "[", "arg_13", "(", "name", "=", "arg_12", ",", "args", "=", "ast", ".", "arguments", "(", "args", "=", "arg_14", ",", "kwarg", "=", "None", ",", "vararg", "=", "arg_15", ",", "kwonlyargs", "=", "[", "]", ",", "defaults", "=", "[", "]", ",", "kw_defaults", "=", "[", "]", ",", ")", ",", "body", "=", "arg_16", ",", "decorator_list", "=", "list", "(", "chain", "(", "arg_18", ",", "[", "_BASILISP_FN_FN_NAME", "]", ",", "[", "_TRAMPOLINE_FN_NAME", "]", "if", "arg_0", ".", "recur_point", ".", "has_recur", "else", "[", "]", ",", ")", ")", ",", "returns", "=", "None", ",", ")", "]", ",", ")", ")", ",", ")"], "function": "def Func(\n    arg_0: arg_1,\n    arg_2: arg_3,\n    arg_4: arg_5,\n    arg_6: arg_7[arg_8] = None,\n    arg_9: arg_7[arg_10] = None,\n) -> GeneratedPyAST:\n    \"\"\"Return a Python AST node for a function with a single arity.\"\"\"\n    assert arg_2.op == NodeOp.FN\n    assert arg_4.op == NodeOp.FN_METHOD\n\n    arg_11 = arg_2.local.name if arg_2.local is not None else None\n    arg_12 = __fn_name(arg_11) if arg_6 is None else munge(arg_6)\n    arg_13 = ast.AsyncFunctionDef if arg_2.is_async else ast.FunctionDef\n    with arg_0.new_symbol_table(arg_12), arg_0.new_recur_point(\n        arg_4.loop_id, RecurType.FN, is_variadic=arg_2.is_variadic\n    ):\n        # Allow named anonymous functions to recursively call themselves\n        if arg_11 is not None:\n            arg_0.symbol_table.new_symbol(\n                sym.symbol(arg_11), arg_12, LocalType.FN\n            )\n\n        arg_14, arg_15, arg_16 = __fn_args_to_py_ast(\n            arg_0, arg_4.params, arg_4.body\n        )\n        arg_17, arg_18 = __fn_meta(arg_0, arg_9)\n        return GeneratedPyAST(\n            arg_2=ast.Name(id=arg_12, arg_0=ast.Load()),\n            dependencies=list(\n                chain(\n                    arg_17,\n                    [\n                        arg_13(\n                            name=arg_12,\n                            args=ast.arguments(\n                                args=arg_14,\n                                kwarg=None,\n                                vararg=arg_15,\n                                kwonlyargs=[],\n                                defaults=[],\n                                kw_defaults=[],\n                            ),\n                            body=arg_16,\n                            decorator_list=list(\n                                chain(\n                                    arg_18,\n                                    [_BASILISP_FN_FN_NAME],\n                                    [_TRAMPOLINE_FN_NAME]\n                                    if arg_0.recur_point.has_recur\n                                    else [],\n                                )\n                            ),\n                            returns=None,\n                        )\n                    ],\n                )\n            ),\n        )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "__single_arity_fn_to_py_ast", "docstring": "Return a Python AST node for a function with a single arity.", "docstring_tokens": ["Return", "a", "Python", "AST", "node", "for", "a", "function", "with", "a", "single", "arity", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 258932}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L194-L225", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Make a post request with an auth token acquired for a specific user to a SuccessFactors endpoint.", "language": "python", "parameters": "(self, sap_user_id, url, payload)", "return_statement": "return response.status_code, response.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "apps", ".", "get_model", "(", "'sap_success_factors'", ",", "'SAPSuccessFactorsEnterpriseCustomerConfiguration'", ")", "arg_5", ",", "arg_6", "=", "SAPSuccessFactorsAPIClient", ".", "get_oauth_access_token", "(", "arg_0", ".", "enterprise_configuration", ".", "sapsf_base_url", ",", "arg_0", ".", "enterprise_configuration", ".", "key", ",", "arg_0", ".", "enterprise_configuration", ".", "secret", ",", "arg_0", ".", "enterprise_configuration", ".", "sapsf_company_id", ",", "arg_1", ",", "arg_4", ".", "USER_TYPE_USER", ")", "arg_7", "=", "requests", ".", "post", "(", "arg_2", ",", "data", "=", "arg_3", ",", "headers", "=", "{", "'Authorization'", ":", "'Bearer {}'", ".", "format", "(", "arg_5", ")", ",", "'content-type'", ":", "'application/json'", "}", ")", "return", "arg_7", ".", "status_code", ",", "arg_7", ".", "text"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Make a post request with an auth token acquired for a specific user to a SuccessFactors endpoint.\n\n        Args:\n            sap_user_id (str): The user to use to retrieve an auth token.\n            url (str): The url to post to.\n            payload (str): The json encoded payload to post.\n        \"\"\"\n        arg_4 = apps.get_model(  # pylint: disable=invalid-name\n            'sap_success_factors',\n            'SAPSuccessFactorsEnterpriseCustomerConfiguration'\n        )\n        arg_5, arg_6 = SAPSuccessFactorsAPIClient.get_oauth_access_token(\n            arg_0.enterprise_configuration.sapsf_base_url,\n            arg_0.enterprise_configuration.key,\n            arg_0.enterprise_configuration.secret,\n            arg_0.enterprise_configuration.sapsf_company_id,\n            arg_1,\n            arg_4.USER_TYPE_USER\n        )\n\n        arg_7 = requests.post(\n            arg_2,\n            data=arg_3,\n            headers={\n                'Authorization': 'Bearer {}'.format(arg_5),\n                'content-type': 'application/json'\n            }\n        )\n\n        return arg_7.status_code, arg_7.text", "path": "integrated_channels/sap_success_factors/client.py", "identifier": "SAPSuccessFactorsAPIClient._call_post_with_user_override", "docstring": "Make a post request with an auth token acquired for a specific user to a SuccessFactors endpoint.\n\n        Args:\n            sap_user_id (str): The user to use to retrieve an auth token.\n            url (str): The url to post to.\n            payload (str): The json encoded payload to post.", "docstring_tokens": ["Make", "a", "post", "request", "with", "an", "auth", "token", "acquired", "for", "a", "specific", "user", "to", "a", "SuccessFactors", "endpoint", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 258933}
{"url": "https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L112-L140", "sha": "4df134f601abcb033ec04cf7596f25ee25d44661", "docstring_summary": "Saves a DayOneEntry as a plist", "language": "python", "parameters": "(self, entry, with_location=True, debug=False)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "{", "}", "if", "isinstance", "(", "arg_1", ",", "DayOneEntry", ")", ":", "arg_4", "=", "arg_1", ".", "as_dict", "(", ")", "else", ":", "arg_4", "=", "arg_1", "arg_4", "[", "'UUID'", "]", "=", "uuid", ".", "uuid4", "(", ")", ".", "get_hex", "(", ")", "if", "arg_2", "and", "not", "arg_4", "[", "'Location'", "]", ":", "arg_4", "[", "'Location'", "]", "=", "arg_0", ".", "get_location", "(", ")", "if", "not", "all", "(", "(", "arg_4", "[", "'UUID'", "]", ",", "arg_4", "[", "'Time Zone'", "]", ",", "arg_4", "[", "'Entry Text'", "]", ")", ")", ":", "print", "\"You must provide: Time zone, UUID, Creation Date, Entry Text\"", "return", "False", "if", "arg_3", "is", "False", ":", "arg_5", "=", "arg_0", ".", "_file_path", "(", "arg_4", "[", "'UUID'", "]", ")", "plistlib", ".", "writePlist", "(", "arg_4", ",", "arg_5", ")", "else", ":", "arg_6", "=", "plistlib", ".", "writePlistToString", "(", "arg_4", ")", "print", "arg_6", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=False):\n        \"\"\"Saves a DayOneEntry as a plist\"\"\"\n        arg_4 = {}\n        if isinstance(arg_1, DayOneEntry):\n            # Get a dict of the DayOneEntry\n            arg_4 = arg_1.as_dict()\n        else:\n            arg_4 = arg_1\n        \n        # Set the UUID\n        arg_4['UUID'] = uuid.uuid4().get_hex()\n        if arg_2 and not arg_4['Location']:\n            arg_4['Location'] = arg_0.get_location()\n\n\n        # Do we have everything needed?\n        if not all ((arg_4['UUID'], arg_4['Time Zone'],\n                     arg_4['Entry Text'])):\n            print \"You must provide: Time zone, UUID, Creation Date, Entry Text\"\n            return False\n\n        if arg_3 is False:\n            arg_5 = arg_0._file_path(arg_4['UUID'])\n            plistlib.writePlist(arg_4, arg_5)\n        else:\n            arg_6 = plistlib.writePlistToString(arg_4)\n            print arg_6\n\n        return True", "path": "dayonelib/__init__.py", "identifier": "DayOne.save", "docstring": "Saves a DayOneEntry as a plist", "docstring_tokens": ["Saves", "a", "DayOneEntry", "as", "a", "plist"], "nwo": "underscorephil/dayonelib", "score": 0.138843686048881, "idx": 258934}
{"url": "https://github.com/erichiggins/gaek/blob/eb6bbc2d2688302834f97fd97891592e8b9659f2/gaek/ndb_json.py#L148-L160", "sha": "eb6bbc2d2688302834f97fd97891592e8b9659f2", "docstring_summary": "Tries to decode strings that look like dates into datetime objects.", "language": "python", "parameters": "(self, val)", "return_statement": "return val", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "basestring", ")", "and", "arg_1", ".", "count", "(", "'-'", ")", "==", "2", "and", "len", "(", "arg_1", ")", ">", "9", ":", "try", ":", "arg_2", "=", "dateutil", ".", "parser", ".", "parse", "(", "arg_1", ")", "if", "arg_1", ".", "endswith", "(", "(", "'+00:00'", ",", "'-00:00'", ",", "'Z'", ")", ")", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "tzinfo", "=", "None", ")", "return", "arg_2", "except", "(", "TypeError", ",", "ValueError", ")", ":", "pass", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Tries to decode strings that look like dates into datetime objects.\"\"\"\n    if isinstance(arg_1, basestring) and arg_1.count('-') == 2 and len(arg_1) > 9:\n      try:\n        arg_2 = dateutil.parser.parse(arg_1)\n        # Check for UTC.\n        if arg_1.endswith(('+00:00', '-00:00', 'Z')):\n          # Then remove tzinfo for gae, which is offset-naive.\n          arg_2 = arg_2.replace(tzinfo=None)\n        return arg_2\n      except (TypeError, ValueError):\n        pass\n    return arg_1", "path": "gaek/ndb_json.py", "identifier": "NdbDecoder.decode_date", "docstring": "Tries to decode strings that look like dates into datetime objects.", "docstring_tokens": ["Tries", "to", "decode", "strings", "that", "look", "like", "dates", "into", "datetime", "objects", "."], "nwo": "erichiggins/gaek", "score": 0.35580137387943567, "idx": 258935}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/loop/MPEventLoopRunner.py#L95-L100", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "Return pairs of run ids and results of finish event loops.", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "communicationChannel", ".", "receive_finished", "(", ")", "arg_0", ".", "nruns", "-=", "len", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return pairs of run ids and results of finish event loops.\n        \"\"\"\n        arg_1 = arg_0.communicationChannel.receive_finished()\n        arg_0.nruns -= len(arg_1)\n        return arg_1", "path": "alphatwirl/loop/MPEventLoopRunner.py", "identifier": "MPEventLoopRunner.poll", "docstring": "Return pairs of run ids and results of finish event loops.", "docstring_tokens": ["Return", "pairs", "of", "run", "ids", "and", "results", "of", "finish", "event", "loops", "."], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 258936}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L164-L181", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Return extracted text  from an ExtractedLicense or None.", "language": "python", "parameters": "(self, extr_lic)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", "arg_0", ".", "graph", ".", "triples", "(", "(", "arg_1", ",", "arg_0", ".", "spdx_namespace", "[", "'extractedText'", "]", ",", "None", ")", ")", ")", "if", "not", "arg_2", ":", "arg_0", ".", "error", "=", "True", "arg_4", "=", "'Extracted license must have extractedText property'", "arg_0", ".", "logger", ".", "log", "(", "arg_4", ")", "return", "if", "len", "(", "arg_2", ")", ">", "1", ":", "arg_0", ".", "more_than_one_error", "(", "'extracted license text'", ")", "return", "arg_5", "=", "arg_2", "[", "0", "]", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_5", "return", "arg_8"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return extracted text  from an ExtractedLicense or None.\n        \"\"\"\n        arg_2 = list(arg_0.graph.triples((arg_1, arg_0.spdx_namespace['extractedText'], None)))\n        if not arg_2:\n            arg_0.error = True\n            arg_4 = 'Extracted license must have extractedText property'\n            arg_0.logger.log(arg_4)\n            return\n\n        if len(arg_2) > 1:\n            arg_0.more_than_one_error('extracted license text')\n            return\n\n        arg_5 = arg_2[0]\n        arg_6, arg_7, arg_8 = arg_5\n        return arg_8", "path": "spdx/parsers/rdf.py", "identifier": "LicenseParser.get_extr_license_text", "docstring": "Return extracted text  from an ExtractedLicense or None.", "docstring_tokens": ["Return", "extracted", "text", "from", "an", "ExtractedLicense", "or", "None", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 258937}
{"url": "https://github.com/MycroftAI/padatious/blob/794a2530d6079bdd06e193edd0d30b2cc793e631/padatious/intent_container.py#L148-L151", "sha": "794a2530d6079bdd06e193edd0d30b2cc793e631", "docstring_summary": "Unload an entity", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "entities", ".", "remove", "(", "arg_1", ")", "arg_0", ".", "padaos", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Unload an entity\"\"\"\n        arg_0.entities.remove(arg_1)\n        arg_0.padaos.Func(arg_1)", "path": "padatious/intent_container.py", "identifier": "IntentContainer.remove_entity", "docstring": "Unload an entity", "docstring_tokens": ["Unload", "an", "entity"], "nwo": "MycroftAI/padatious", "score": 0.4588892726323654, "idx": 258938}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/email_.py#L224-L236", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Start session with email server.", "language": "python", "parameters": "(self)", "return_statement": "return session", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "port", "in", "(", "465", ",", "\"465\"", ")", ":", "arg_1", "=", "arg_0", ".", "_get_ssl", "(", ")", "elif", "arg_0", ".", "port", "in", "(", "587", ",", "\"587\"", ")", ":", "arg_1", "=", "arg_0", ".", "_get_tls", "(", ")", "try", ":", "arg_1", ".", "login", "(", "arg_0", ".", "from_", ",", "arg_0", ".", "_auth", ")", "except", "SMTPResponseException", "as", "e", ":", "raise", "MessageSendError", "(", "e", ".", "smtp_error", ".", "decode", "(", "\"unicode_escape\"", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Start session with email server.\"\"\"\n        if arg_0.port in (465, \"465\"):\n            arg_1 = arg_0._get_ssl()\n        elif arg_0.port in (587, \"587\"):\n            arg_1 = arg_0._get_tls()\n\n        try:\n            arg_1.login(arg_0.from_, arg_0._auth)\n        except SMTPResponseException as e:\n            raise MessageSendError(e.smtp_error.decode(\"unicode_escape\"))\n\n        return arg_1", "path": "messages/email_.py", "identifier": "Email._get_session", "docstring": "Start session with email server.", "docstring_tokens": ["Start", "session", "with", "email", "server", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 258939}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L460-L490", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Attempts to fetch streams repeatedly\n       until some are returned or limit hit.", "language": "python", "parameters": "(plugin, interval, count)", "return_statement": "return streams", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "fetch_streams", "(", "arg_0", ")", "except", "PluginError", "as", "err", ":", "log", ".", "error", "(", "u\"{0}\"", ",", "err", ")", "arg_3", "=", "None", "if", "not", "arg_3", ":", "log", ".", "info", "(", "\"Waiting for streams, retrying every {0} \"", "\"second(s)\"", ",", "arg_1", ")", "arg_4", "=", "0", "while", "not", "arg_3", ":", "sleep", "(", "arg_1", ")", "try", ":", "arg_3", "=", "fetch_streams", "(", "arg_0", ")", "except", "FatalPluginError", "as", "err", ":", "raise", "except", "PluginError", "as", "err", ":", "log", ".", "error", "(", "u\"{0}\"", ",", "err", ")", "if", "arg_2", ">", "0", ":", "arg_4", "+=", "1", "if", "arg_4", ">=", "arg_2", ":", "break", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Attempts to fetch streams repeatedly\n       until some are returned or limit hit.\"\"\"\n\n    try:\n        arg_3 = fetch_streams(arg_0)\n    except PluginError as err:\n        log.error(u\"{0}\", err)\n        arg_3 = None\n\n    if not arg_3:\n        log.info(\"Waiting for streams, retrying every {0} \"\n                 \"second(s)\", arg_1)\n    arg_4 = 0\n\n    while not arg_3:\n        sleep(arg_1)\n\n        try:\n            arg_3 = fetch_streams(arg_0)\n        except FatalPluginError as err:\n            raise\n        except PluginError as err:\n            log.error(u\"{0}\", err)\n\n        if arg_2 > 0:\n            arg_4 += 1\n            if arg_4 >= arg_2:\n                break\n\n    return arg_3", "path": "src/streamlink_cli/main.py", "identifier": "fetch_streams_with_retry", "docstring": "Attempts to fetch streams repeatedly\n       until some are returned or limit hit.", "docstring_tokens": ["Attempts", "to", "fetch", "streams", "repeatedly", "until", "some", "are", "returned", "or", "limit", "hit", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 258940}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L2606-L2623", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Sets byte if above.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "write", "(", "Operators", ".", "ITEBV", "(", "arg_1", ".", "size", ",", "Operators", ".", "OR", "(", "arg_0", ".", "CF", ",", "arg_0", ".", "ZF", ")", "==", "False", ",", "1", ",", "0", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sets byte if above.\n\n        Sets the destination operand to 0 or 1 depending on the settings of the status flags (CF, SF, OF, ZF, and PF, 1, 0) in the\n        EFLAGS register. The destination operand points to a byte register or a byte in memory. The condition code suffix\n        (cc, 1, 0) indicates the condition being tested for::\n                IF condition\n                THEN\n                    DEST = 1;\n                ELSE\n                    DEST = 0;\n                FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n         \"\"\"\n        arg_1.write(Operators.ITEBV(arg_1.size, Operators.OR(arg_0.CF, arg_0.ZF) == False, 1, 0))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.SETA", "docstring": "Sets byte if above.\n\n        Sets the destination operand to 0 or 1 depending on the settings of the status flags (CF, SF, OF, ZF, and PF, 1, 0) in the\n        EFLAGS register. The destination operand points to a byte register or a byte in memory. The condition code suffix\n        (cc, 1, 0) indicates the condition being tested for::\n                IF condition\n                THEN\n                    DEST = 1;\n                ELSE\n                    DEST = 0;\n                FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Sets", "byte", "if", "above", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 258941}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_sre.py#L598-L613", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Dispatches a context on a given opcode. Returns True if the context\n        is done matching, False if it must be resumed when next encountered.", "language": "python", "parameters": "(self, opcode, context)", "return_statement": "return has_finished", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_7", "(", "arg_2", ")", "in", "arg_0", ".", "executing_contexts", ":", "arg_3", "=", "arg_0", ".", "executing_contexts", "[", "arg_7", "(", "arg_2", ")", "]", "del", "arg_0", ".", "executing_contexts", "[", "arg_7", "(", "arg_2", ")", "]", "arg_4", "=", "arg_3", ".", "next", "(", ")", "else", ":", "arg_5", "=", "arg_0", ".", "DISPATCH_TABLE", ".", "get", "(", "arg_1", ",", "_OpcodeDispatcher", ".", "unknown", ")", "arg_4", "=", "arg_5", "(", "arg_0", ",", "arg_2", ")", "if", "hasattr", "(", "arg_4", ",", "\"next\"", ")", ":", "arg_3", "=", "arg_4", "arg_4", "=", "arg_3", ".", "next", "(", ")", "if", "not", "arg_4", ":", "arg_0", ".", "executing_contexts", "[", "arg_7", "(", "arg_2", ")", "]", "=", "arg_3", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Dispatches a context on a given opcode. Returns True if the context\n        is done matching, False if it must be resumed when next encountered.\"\"\"\n        if arg_7(arg_2) in arg_0.executing_contexts:\n            arg_3 = arg_0.executing_contexts[arg_7(arg_2)]\n            del arg_0.executing_contexts[arg_7(arg_2)]\n            arg_4 = arg_3.next()\n        else:\n            arg_5 = arg_0.DISPATCH_TABLE.get(arg_1, _OpcodeDispatcher.unknown)\n            arg_4 = arg_5(arg_0, arg_2)\n            if hasattr(arg_4, \"next\"): # avoid using the types module\n                arg_3 = arg_4\n                arg_4 = arg_3.next()\n        if not arg_4:\n            arg_0.executing_contexts[arg_7(arg_2)] = arg_3\n        return arg_4", "path": "third_party/pypy/_sre.py", "identifier": "_OpcodeDispatcher.dispatch", "docstring": "Dispatches a context on a given opcode. Returns True if the context\n        is done matching, False if it must be resumed when next encountered.", "docstring_tokens": ["Dispatches", "a", "context", "on", "a", "given", "opcode", ".", "Returns", "True", "if", "the", "context", "is", "done", "matching", "False", "if", "it", "must", "be", "resumed", "when", "next", "encountered", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 258942}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L278-L321", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Turn a mongodb-style search dict into an SQL query.", "language": "python", "parameters": "(self, check)", "return_statement": "return expr, args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "[", "]", "arg_4", "=", "set", "(", "arg_1", ".", "keys", "(", ")", ")", "arg_4", ".", "difference_update", "(", "set", "(", "arg_0", ".", "_keys", ")", ")", "arg_4", ".", "difference_update", "(", "set", "(", "[", "'buffers'", ",", "'result_buffers'", "]", ")", ")", "if", "arg_4", ":", "raise", "KeyError", "(", "\"Illegal testing key(s): %s\"", "%", "arg_4", ")", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "arg_6", ",", "dict", ")", ":", "for", "arg_7", ",", "arg_8", "in", "arg_6", ".", "iteritems", "(", ")", ":", "try", ":", "arg_9", "=", "operators", "[", "arg_7", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Unsupported operator: %r\"", "%", "arg_7", ")", "if", "isinstance", "(", "arg_9", ",", "tuple", ")", ":", "arg_9", ",", "arg_10", "=", "arg_9", "if", "arg_8", "is", "None", "and", "arg_9", "in", "null_operators", ":", "arg_11", "=", "\"%s %s\"", "%", "(", "arg_5", ",", "null_operators", "[", "arg_9", "]", ")", "else", ":", "arg_11", "=", "\"%s %s ?\"", "%", "(", "arg_5", ",", "arg_9", ")", "if", "isinstance", "(", "arg_8", ",", "(", "tuple", ",", "list", ")", ")", ":", "if", "arg_9", "in", "null_operators", "and", "any", "(", "[", "arg_12", "is", "None", "for", "arg_12", "in", "arg_8", "]", ")", ":", "raise", "ValueError", "(", "\"Cannot use %r test with NULL values on SQLite backend\"", "%", "arg_7", ")", "arg_11", "=", "'( %s )'", "%", "(", "arg_10", ".", "join", "(", "[", "arg_11", "]", "*", "len", "(", "arg_8", ")", ")", ")", "arg_3", ".", "extend", "(", "arg_8", ")", "else", ":", "arg_3", ".", "append", "(", "arg_8", ")", "arg_2", ".", "append", "(", "arg_11", ")", "else", ":", "if", "arg_6", "is", "None", ":", "arg_2", ".", "append", "(", "\"%s IS NULL\"", "%", "arg_5", ")", "else", ":", "arg_2", ".", "append", "(", "\"%s = ?\"", "%", "arg_5", ")", "arg_3", ".", "append", "(", "arg_6", ")", "arg_11", "=", "\" AND \"", ".", "join", "(", "arg_2", ")", "return", "arg_11", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Turn a mongodb-style search dict into an SQL query.\"\"\"\n        arg_2 = []\n        arg_3 = []\n\n        arg_4 = set(arg_1.keys())\n        arg_4.difference_update(set(arg_0._keys))\n        arg_4.difference_update(set(['buffers', 'result_buffers']))\n        if arg_4:\n            raise KeyError(\"Illegal testing key(s): %s\"%arg_4)\n\n        for arg_5,arg_6 in arg_1.iteritems():\n            if isinstance(arg_6, dict):\n                for arg_7,arg_8 in arg_6.iteritems():\n                    try:\n                        arg_9 = operators[arg_7]\n                    except KeyError:\n                        raise KeyError(\"Unsupported operator: %r\"%arg_7)\n                    if isinstance(arg_9, tuple):\n                        arg_9, arg_10 = arg_9\n\n                    if arg_8 is None and arg_9 in null_operators:\n                        arg_11 = \"%s %s\" % (arg_5, null_operators[arg_9])\n                    else:\n                        arg_11 = \"%s %s ?\"%(arg_5, arg_9)\n                        if isinstance(arg_8, (tuple,list)):\n                            if arg_9 in null_operators and any([arg_12 is None for arg_12 in arg_8]):\n                                # equality tests don't work with NULL\n                                raise ValueError(\"Cannot use %r test with NULL values on SQLite backend\"%arg_7)\n                            arg_11 = '( %s )'%( arg_10.join([arg_11]*len(arg_8)) )\n                            arg_3.extend(arg_8)\n                        else:\n                            arg_3.append(arg_8)\n                    arg_2.append(arg_11)\n            else:\n                # it's an equality check\n                if arg_6 is None:\n                    arg_2.append(\"%s IS NULL\" % arg_5)\n                else:\n                    arg_2.append(\"%s = ?\"%arg_5)\n                    arg_3.append(arg_6)\n\n        arg_11 = \" AND \".join(arg_2)\n        return arg_11, arg_3", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py", "identifier": "SQLiteDB._render_expression", "docstring": "Turn a mongodb-style search dict into an SQL query.", "docstring_tokens": ["Turn", "a", "mongodb", "-", "style", "search", "dict", "into", "an", "SQL", "query", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258943}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/cp.py#L64-L74", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Copy a path from inside a Dusty container to a path on the\n    local filesystem. The path on the local filesystem must be\n    wrist-accessible by the user specified in mac_username.", "language": "python", "parameters": "(local_path, remote_name, remote_path, demote=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "if", "not", "container_path_exists", "(", "arg_1", ",", "arg_2", ")", ":", "raise", "RuntimeError", "(", "'ERROR: Path {} does not exist inside container {}.'", ".", "format", "(", "arg_2", ",", "arg_1", ")", ")", "arg_4", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "copy_path_inside_container", "(", "arg_1", ",", "arg_2", ",", "os", ".", "path", ".", "join", "(", "constants", ".", "CONTAINER_CP_DIR", ",", "arg_4", ")", ")", "arg_5", "=", "os", ".", "path", ".", "join", "(", "vm_cp_path", "(", "arg_1", ")", ",", "arg_4", ")", "arg_6", "=", "vm_path_is_directory", "(", "arg_5", ")", "sync_local_path_from_vm", "(", "arg_0", ",", "arg_5", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n    \"\"\"Copy a path from inside a Dusty container to a path on the\n    local filesystem. The path on the local filesystem must be\n    wrist-accessible by the user specified in mac_username.\"\"\"\n    if not container_path_exists(arg_1, arg_2):\n        raise RuntimeError('ERROR: Path {} does not exist inside container {}.'.format(arg_2, arg_1))\n    arg_4 = str(uuid.uuid1())\n    copy_path_inside_container(arg_1, arg_2, os.path.join(constants.CONTAINER_CP_DIR, arg_4))\n    arg_5 = os.path.join(vm_cp_path(arg_1), arg_4)\n    arg_6 = vm_path_is_directory(arg_5)\n    sync_local_path_from_vm(arg_0, arg_5, arg_3=arg_3, arg_6=arg_6)", "path": "dusty/commands/cp.py", "identifier": "copy_to_local", "docstring": "Copy a path from inside a Dusty container to a path on the\n    local filesystem. The path on the local filesystem must be\n    wrist-accessible by the user specified in mac_username.", "docstring_tokens": ["Copy", "a", "path", "from", "inside", "a", "Dusty", "container", "to", "a", "path", "on", "the", "local", "filesystem", ".", "The", "path", "on", "the", "local", "filesystem", "must", "be", "wrist", "-", "accessible", "by", "the", "user", "specified", "in", "mac_username", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 258944}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1513-L1549", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the numerical integral of a waveform's dependent variable vector.", "language": "python", "parameters": "(wave, indep_min=None, indep_max=None)", "return_statement": "return np.trapz(ret._dep_vector, ret._indep_vector)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "copy", ".", "copy", "(", "arg_0", ")", "_bound_waveform", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "return", "np", ".", "trapz", "(", "arg_3", ".", "_dep_vector", ",", "arg_3", ".", "_indep_vector", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    r\"\"\"\n    Return the numerical integral of a waveform's dependent variable vector.\n\n    The method used is the `trapezoidal\n    <https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: float\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]\n    \"\"\"\n    arg_3 = copy.copy(arg_0)\n    _bound_waveform(arg_3, arg_1, arg_2)\n    return np.trapz(arg_3._dep_vector, arg_3._indep_vector)", "path": "peng/wave_functions.py", "identifier": "nintegral", "docstring": "r\"\"\"\n    Return the numerical integral of a waveform's dependent variable vector.\n\n    The method used is the `trapezoidal\n    <https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :param indep_min: Independent vector start point of computation\n    :type  indep_min: integer or float\n\n    :param indep_max: Independent vector stop point of computation\n    :type  indep_max: integer or float\n\n    :rtype: float\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.nintegral\n\n    :raises:\n     * RuntimeError (Argument \\`indep_max\\` is not valid)\n\n     * RuntimeError (Argument \\`indep_min\\` is not valid)\n\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * RuntimeError (Incongruent \\`indep_min\\` and \\`indep_max\\`\n       arguments)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "numerical", "integral", "of", "a", "waveform", "s", "dependent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 258945}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L206-L216", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "only use for gsea heatmap", "language": "python", "parameters": "(self, df, classes, pheno_pos, pheno_neg)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "len", "(", "arg_2", ")", "if", "len", "(", "arg_2", ")", ">=", "6", "else", "5", "arg_6", "=", "list", "(", "map", "(", "lambda", "x", ":", "True", "if", "x", "==", "arg_3", "else", "False", ",", "arg_2", ")", ")", "arg_7", "=", "list", "(", "map", "(", "lambda", "x", ":", "True", "if", "x", "==", "arg_4", "else", "False", ",", "arg_2", ")", ")", "arg_8", "=", "arg_1", ".", "loc", "[", ":", ",", "arg_6", "]", "arg_9", "=", "arg_1", ".", "loc", "[", ":", ",", "arg_7", "]", "arg_10", "=", "pd", ".", "concat", "(", "[", "arg_8", ",", "arg_9", "]", ",", "axis", "=", "1", ")", "arg_0", ".", "_width", "=", "arg_5", "arg_0", ".", "heatmat", "=", "arg_10", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"only use for gsea heatmap\"\"\"\n        arg_5 = len(arg_2) if len(arg_2) >= 6 else  5\n        arg_6 =list(map(lambda x: True if x == arg_3 else False, arg_2))\n        arg_7 =list(map(lambda x: True if x == arg_4 else False, arg_2))\n        arg_8 = arg_1.loc[:, arg_6]\n        arg_9 = arg_1.loc[:, arg_7]\n        arg_10=pd.concat([arg_8,arg_9], axis=1)\n        arg_0._width = arg_5\n        arg_0.heatmat = arg_10\n        return", "path": "gseapy/gsea.py", "identifier": "GSEAbase._heatmat", "docstring": "only use for gsea heatmap", "docstring_tokens": ["only", "use", "for", "gsea", "heatmap"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 258946}
{"url": "https://github.com/opencast/pyCA/blob/c89b168d4780d157e1b3f7676628c1b131956a88/pyca/ui/jsonapi.py#L69-L78", "sha": "c89b168d4780d157e1b3f7676628c1b131956a88", "docstring_summary": "Return a specific events JSON", "language": "python", "parameters": "(uid)", "return_statement": "return make_error_response('No event with specified uid', 404)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_session", "(", ")", "Func", "=", "arg_1", ".", "query", "(", "RecordedEvent", ")", ".", "filter", "(", "RecordedEvent", ".", "uid", "==", "arg_0", ")", ".", "first", "(", ")", "or", "arg_1", ".", "query", "(", "UpcomingEvent", ")", ".", "filter", "(", "UpcomingEvent", ".", "uid", "==", "arg_0", ")", ".", "first", "(", ")", "if", "Func", ":", "return", "make_data_response", "(", "Func", ".", "serialize", "(", ")", ")", "return", "make_error_response", "(", "'No event with specified uid'", ",", "404", ")"], "function": "def Func(arg_0):\n    '''Return a specific events JSON\n    '''\n    arg_1 = get_session()\n    Func = arg_1.query(RecordedEvent).filter(RecordedEvent.uid == arg_0).first() \\\n        or arg_1.query(UpcomingEvent).filter(UpcomingEvent.uid == arg_0).first()\n\n    if Func:\n        return make_data_response(Func.serialize())\n    return make_error_response('No event with specified uid', 404)", "path": "pyca/ui/jsonapi.py", "identifier": "event", "docstring": "Return a specific events JSON", "docstring_tokens": ["Return", "a", "specific", "events", "JSON"], "nwo": "opencast/pyCA", "score": 0.38750565733100095, "idx": 258947}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/interfaces/gatt.py#L44-L51", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Return the first child characteristic found that has the specified\n        UUID.  Will return None if no characteristic that matches is found.", "language": "python", "parameters": "(self, uuid)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "list_characteristics", "(", ")", ":", "if", "arg_2", ".", "uuid", "==", "arg_1", ":", "return", "arg_2", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the first child characteristic found that has the specified\n        UUID.  Will return None if no characteristic that matches is found.\n        \"\"\"\n        for arg_2 in arg_0.list_characteristics():\n            if arg_2.uuid == arg_1:\n                return arg_2\n        return None", "path": "Adafruit_BluefruitLE/interfaces/gatt.py", "identifier": "GattService.find_characteristic", "docstring": "Return the first child characteristic found that has the specified\n        UUID.  Will return None if no characteristic that matches is found.", "docstring_tokens": ["Return", "the", "first", "child", "characteristic", "found", "that", "has", "the", "specified", "UUID", ".", "Will", "return", "None", "if", "no", "characteristic", "that", "matches", "is", "found", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 258948}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/enrollments.py#L52-L83", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return a list of enrollments for the passed user regid.", "language": "python", "parameters": "(self, regid, params={},\n                                  include_courses=True)", "return_statement": "return enrollments", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"user\"", ")", "arg_5", "=", "USERS_API", ".", "format", "(", "arg_4", ")", "+", "\"/enrollments\"", "arg_6", "=", "Courses", "(", ")", "if", "arg_3", "else", "None", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_0", ".", "_get_paged_resource", "(", "arg_5", ",", "arg_2", "=", "arg_2", ")", ":", "arg_9", "=", "CanvasEnrollment", "(", "data", "=", "arg_8", ")", "if", "arg_3", ":", "arg_10", "=", "arg_8", "[", "\"course_id\"", "]", "arg_11", "=", "arg_6", ".", "get_course", "(", "arg_10", ")", "if", "arg_11", ".", "sis_course_id", "is", "not", "None", ":", "arg_9", ".", "course", "=", "arg_11", "arg_9", ".", "course_url", "=", "arg_11", ".", "course_url", "arg_9", ".", "course_name", "=", "arg_11", ".", "name", "arg_9", ".", "sis_course_id", "=", "arg_11", ".", "sis_course_id", "else", ":", "arg_9", ".", "course_url", "=", "re", ".", "sub", "(", "r'/users/\\d+$'", ",", "''", ",", "arg_9", ".", "html_url", ")", "arg_7", ".", "append", "(", "arg_9", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2={},\n                                  arg_3=True):\n        \"\"\"\n        Return a list of enrollments for the passed user regid.\n\n        https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index\n        \"\"\"\n        arg_4 = arg_0._sis_id(arg_1, sis_field=\"user\")\n        arg_5 = USERS_API.format(arg_4) + \"/enrollments\"\n\n        arg_6 = Courses() if arg_3 else None\n\n        arg_7 = []\n        for arg_8 in arg_0._get_paged_resource(arg_5, arg_2=arg_2):\n            arg_9 = CanvasEnrollment(data=arg_8)\n            if arg_3:\n                arg_10 = arg_8[\"course_id\"]\n                arg_11 = arg_6.get_course(arg_10)\n\n                if arg_11.sis_course_id is not None:\n                    arg_9.course = arg_11\n                    # the following 3 lines are not removed\n                    # to be backward compatible.\n                    arg_9.course_url = arg_11.course_url\n                    arg_9.course_name = arg_11.name\n                    arg_9.sis_course_id = arg_11.sis_course_id\n            else:\n                arg_9.course_url = re.sub(\n                    r'/users/\\d+$', '', arg_9.html_url)\n\n            arg_7.append(arg_9)\n        return arg_7", "path": "uw_canvas/enrollments.py", "identifier": "Enrollments.get_enrollments_for_regid", "docstring": "Return a list of enrollments for the passed user regid.\n\n        https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index", "docstring_tokens": ["Return", "a", "list", "of", "enrollments", "for", "the", "passed", "user", "regid", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 258949}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/graph.py#L482-L491", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Draws the graph title and subtitle", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "show_graph_title", ":", "arg_0", ".", "draw_graph_title", "(", ")", "if", "arg_0", ".", "show_graph_subtitle", ":", "arg_0", ".", "draw_graph_subtitle", "(", ")", "if", "arg_0", ".", "show_x_title", ":", "arg_0", ".", "draw_x_title", "(", ")", "if", "arg_0", ".", "show_y_title", ":", "arg_0", ".", "draw_y_title", "(", ")"], "function": "def Func(arg_0):\n\t\t\"Draws the graph title and subtitle\"\n\t\tif arg_0.show_graph_title:\n\t\t\targ_0.draw_graph_title()\n\t\tif arg_0.show_graph_subtitle:\n\t\t\targ_0.draw_graph_subtitle()\n\t\tif arg_0.show_x_title:\n\t\t\targ_0.draw_x_title()\n\t\tif arg_0.show_y_title:\n\t\t\targ_0.draw_y_title()", "path": "svg/charts/graph.py", "identifier": "Graph.draw_titles", "docstring": "Draws the graph title and subtitle", "docstring_tokens": ["Draws", "the", "graph", "title", "and", "subtitle"], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 258950}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/rooms.py#L135-L168", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Create a room.", "language": "python", "parameters": "(self, title, teamId=None, **request_parameters)", "return_statement": "return self._object_factory(OBJECT_TYPE, json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ")", "check_type", "(", "arg_2", ",", "basestring", ")", "arg_4", "=", "dict_from_items_with_values", "(", "arg_3", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", ")", "arg_5", "=", "arg_0", ".", "_session", ".", "post", "(", "API_ENDPOINT", ",", "json", "=", "arg_4", ")", "return", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Create a room.\n\n        The authenticated user is automatically added as a member of the room.\n\n        Args:\n            title(basestring): A user-friendly name for the room.\n            teamId(basestring): The team ID with which this room is\n                associated.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Room: A Room with the details of the Funcd room.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring)\n        check_type(arg_2, basestring)\n\n        arg_4 = dict_from_items_with_values(\n            arg_3,\n            arg_1=arg_1,\n            arg_2=arg_2,\n        )\n\n        # API request\n        arg_5 = arg_0._session.post(API_ENDPOINT, json=arg_4)\n\n        # Return a room object Funcd from the response JSON data\n        return arg_0._object_factory(OBJECT_TYPE, arg_5)", "path": "webexteamssdk/api/rooms.py", "identifier": "RoomsAPI.create", "docstring": "Create a room.\n\n        The authenticated user is automatically added as a member of the room.\n\n        Args:\n            title(basestring): A user-friendly name for the room.\n            teamId(basestring): The team ID with which this room is\n                associated.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Room: A Room with the details of the created room.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Create", "a", "room", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 258951}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L261-L306", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Posts a request to chanjo-report and capture the body of the returned response to include it in case report", "language": "python", "parameters": "(store, institute_obj, case_obj, base_url)", "return_statement": "return coverage_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "{", "}", "arg_4", "[", "'sample_id'", "]", "=", "[", "ind", "[", "'individual_id'", "]", "for", "ind", "in", "arg_2", "[", "'individuals'", "]", "]", "arg_5", "=", "set", "(", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_2", ".", "get", "(", "'panels'", ",", "[", "]", ")", ":", "if", "not", "arg_7", ".", "get", "(", "'is_default'", ")", ":", "continue", "arg_8", "=", "arg_0", ".", "gene_panel", "(", "arg_7", "[", "'panel_name'", "]", ",", "version", "=", "arg_7", ".", "get", "(", "'version'", ")", ")", "arg_9", "=", "\"{} ({})\"", ".", "format", "(", "arg_8", "[", "'display_name'", "]", ",", "arg_8", "[", "'version'", "]", ")", "arg_6", ".", "append", "(", "arg_9", ")", "arg_6", "=", "' ,'", ".", "join", "(", "arg_6", ")", "arg_4", "[", "'panel_name'", "]", "=", "arg_6", "arg_4", "[", "'level'", "]", "=", "arg_1", ".", "get", "(", "'coverage_cutoff'", ",", "15", ")", "arg_10", "=", "requests", ".", "get", "(", "arg_3", "+", "'reports/report'", ",", "params", "=", "arg_4", ")", "arg_11", "=", "BeautifulSoup", "(", "arg_10", ".", "text", ")", "for", "arg_12", "in", "arg_11", ".", "find_all", "(", "'a'", ")", ":", "arg_12", ".", "replaceWith", "(", "''", ")", "arg_13", "=", "''", ".", "join", "(", "[", "'%s'", "%", "x", "for", "x", "in", "arg_11", ".", "body", ".", "contents", "]", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Posts a request to chanjo-report and capture the body of the returned response to include it in case report\n\n    Args:\n        store(adapter.MongoAdapter)\n        institute_obj(models.Institute)\n        case_obj(models.Case)\n        base_url(str): base url of server\n\n    Returns:\n        coverage_data(str): string rendering of the content between <body </body> tags of a coverage report\n    \"\"\"\n\n    arg_4 = {}\n    # extract sample ids from case_obj and add them to the post request object:\n    arg_4['sample_id'] = [ ind['individual_id'] for ind in arg_2['individuals'] ]\n\n    # extract default panel names and default genes from case_obj and add them to the post request object\n    arg_5 = set()\n    arg_6 = []\n    for arg_7 in arg_2.get('panels', []):\n        if not arg_7.get('is_default'):\n            continue\n        arg_8 = arg_0.gene_panel(arg_7['panel_name'], version=arg_7.get('version'))\n        arg_9 = \"{} ({})\".format(arg_8['display_name'], arg_8['version'])\n        arg_6.append(arg_9)\n    arg_6 = ' ,'.join(arg_6)\n    arg_4['panel_name'] = arg_6\n\n    # add institute-specific cutoff level to the post request object\n    arg_4['level'] = arg_1.get('coverage_cutoff', 15)\n\n    #send get request to chanjo report\n    arg_10 = requests.get(arg_3+'reports/report', params=arg_4)\n\n    #read response content\n    arg_11 = BeautifulSoup(arg_10.text)\n\n    # remove links in the printed version of coverage report\n    for arg_12 in arg_11.find_all('a'):\n        arg_12.replaceWith('')\n\n    #extract body content using BeautifulSoup\n    arg_13 = ''.join(['%s' % x for x in arg_11.body.contents])\n\n    return arg_13", "path": "scout/server/blueprints/cases/controllers.py", "identifier": "coverage_report_contents", "docstring": "Posts a request to chanjo-report and capture the body of the returned response to include it in case report\n\n    Args:\n        store(adapter.MongoAdapter)\n        institute_obj(models.Institute)\n        case_obj(models.Case)\n        base_url(str): base url of server\n\n    Returns:\n        coverage_data(str): string rendering of the content between <body </body> tags of a coverage report", "docstring_tokens": ["Posts", "a", "request", "to", "chanjo", "-", "report", "and", "capture", "the", "body", "of", "the", "returned", "response", "to", "include", "it", "in", "case", "report"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 258952}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/head_scanner.py#L46-L66", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Retrieves services starts check_service in a gevent pool of 100.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "ServiceSearch", "(", ")", "arg_1", "=", "arg_0", ".", "get_services", "(", "up", "=", "True", ",", "tags", "=", "[", "'!header_scan'", "]", ")", "print_notification", "(", "\"Scanning {} services\"", ".", "format", "(", "len", "(", "arg_1", ")", ")", ")", "urllib3", ".", "disable_warnings", "(", "urllib3", ".", "exceptions", ".", "InsecureRequestWarning", ")", "arg_2", "=", "Pool", "(", "100", ")", "arg_3", "=", "0", "for", "arg_4", "in", "arg_1", ":", "arg_3", "+=", "1", "if", "arg_3", "%", "50", "==", "0", ":", "print_notification", "(", "\"Checking {}/{} services\"", ".", "format", "(", "arg_3", ",", "len", "(", "arg_1", ")", ")", ")", "arg_2", ".", "spawn", "(", "check_service", ",", "arg_4", ")", "arg_2", ".", "join", "(", ")", "print_notification", "(", "\"Completed, 'http' tag added to services that respond to http, 'https' tag added to services that respond to https.\"", ")"], "function": "def Func():\n    \"\"\"\n        Retrieves services starts check_service in a gevent pool of 100.\n    \"\"\"\n    arg_0 = ServiceSearch()\n    arg_1 = arg_0.get_services(up=True, tags=['!header_scan'])\n    print_notification(\"Scanning {} services\".format(len(arg_1)))\n\n    # Disable the insecure request warning\n    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)\n\n    arg_2 = Pool(100)\n    arg_3 = 0\n    for arg_4 in arg_1:\n        arg_3 += 1\n        if arg_3 % 50 == 0:\n            print_notification(\"Checking {}/{} services\".format(arg_3, len(arg_1)))\n        arg_2.spawn(check_service, arg_4)\n\n    arg_2.join()\n    print_notification(\"Completed, 'http' tag added to services that respond to http, 'https' tag added to services that respond to https.\")", "path": "jackal/scripts/head_scanner.py", "identifier": "main", "docstring": "Retrieves services starts check_service in a gevent pool of 100.", "docstring_tokens": ["Retrieves", "services", "starts", "check_service", "in", "a", "gevent", "pool", "of", "100", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 258953}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/migrations/__init__.py#L16-L24", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Truncate tables.", "language": "python", "parameters": "(self, app_label, schema_editor, models)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "'%s_%s'", "%", "(", "arg_1", ",", "arg_4", ")", "arg_2", ".", "execute", "(", "'TRUNCATE TABLE %s RESTART IDENTITY CASCADE'", "%", "(", "arg_5", ".", "lower", "(", ")", ",", ")", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Truncate tables.\"\"\"\n        for arg_4 in arg_3:\n            arg_5 = '%s_%s' % (arg_1, arg_4)\n            arg_2.execute(\n                'TRUNCATE TABLE %s RESTART IDENTITY CASCADE' % (\n                    arg_5.lower(),\n                ),\n            )", "path": "dddp/migrations/__init__.py", "identifier": "TruncateOperation.truncate", "docstring": "Truncate tables.", "docstring_tokens": ["Truncate", "tables", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 258954}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L96-L124", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Count the number of domain for each status.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "status", ":", "PyFunceble", ".", "INTERN", "[", "\"Funcer\"", "]", "[", "\"number\"", "]", "[", "\"tested\"", "]", "+=", "1", "if", "(", "arg_0", ".", "status", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"up\"", "]", "or", "arg_0", ".", "status", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"valid\"", "]", ")", ":", "PyFunceble", ".", "INTERN", "[", "\"Funcer\"", "]", "[", "\"number\"", "]", "[", "\"up\"", "]", "+=", "1", "elif", "arg_0", ".", "status", ".", "lower", "(", ")", "in", "PyFunceble", ".", "STATUS", "[", "\"list\"", "]", "[", "\"down\"", "]", ":", "PyFunceble", ".", "INTERN", "[", "\"Funcer\"", "]", "[", "\"number\"", "]", "[", "\"down\"", "]", "+=", "1", "else", ":", "PyFunceble", ".", "INTERN", "[", "\"Funcer\"", "]", "[", "\"number\"", "]", "[", "\"invalid\"", "]", "+=", "1"], "function": "def Func(arg_0):\n        \"\"\"\n        Count the number of domain for each status.\n        \"\"\"\n\n        if arg_0.status:\n            # The status is parsed.\n\n            # We increase the number of tested.\n            PyFunceble.INTERN[\"Funcer\"][\"number\"][\"tested\"] += 1\n\n            if (\n                arg_0.status.lower() in PyFunceble.STATUS[\"list\"][\"up\"]\n                or arg_0.status.lower() in PyFunceble.STATUS[\"list\"][\"valid\"]\n            ):\n                # The status is in the list of up status.\n\n                # We increase the number of up.\n                PyFunceble.INTERN[\"Funcer\"][\"number\"][\"up\"] += 1\n            elif arg_0.status.lower() in PyFunceble.STATUS[\"list\"][\"down\"]:\n                # The status is in the list of down status.\n\n                # We increase the number of down.\n                PyFunceble.INTERN[\"Funcer\"][\"number\"][\"down\"] += 1\n            else:\n                # The status is not in the list of up nor down status.\n\n                # We increase the number of invalid.\n                PyFunceble.INTERN[\"Funcer\"][\"number\"][\"invalid\"] += 1", "path": "PyFunceble/percentage.py", "identifier": "Percentage.count", "docstring": "Count the number of domain for each status.", "docstring_tokens": ["Count", "the", "number", "of", "domain", "for", "each", "status", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 258955}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L47-L51", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Commands for projects.", "language": "python", "parameters": "(ctx, project)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "if", "arg_0", ".", "invoked_subcommand", "not", "in", "[", "'create'", ",", "'list'", "]", ":", "arg_0", ".", "obj", "=", "arg_0", ".", "obj", "or", "{", "}", "arg_0", ".", "obj", "[", "'project'", "]", "=", "Func"], "function": "def Func(arg_0, Func):  # pylint:disable=redefined-outer-name\n    \"\"\"Commands for projects.\"\"\"\n    if arg_0.invoked_subcommand not in ['create', 'list']:\n        arg_0.obj = arg_0.obj or {}\n        arg_0.obj['project'] = Func", "path": "polyaxon_cli/cli/project.py", "identifier": "project", "docstring": "Commands for projects.", "docstring_tokens": ["Commands", "for", "projects", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 258956}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py#L35-L40", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find the full path to a command using which.", "language": "python", "parameters": "(cmd)", "return_statement": "return py3compat.bytes_to_str(path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "sp", ".", "Popen", "(", "[", "'/usr/bin/env'", ",", "'which'", ",", "arg_0", "]", ",", "stdout", "=", "sp", ".", "PIPE", ",", "stderr", "=", "sp", ".", "PIPE", ")", ".", "communicate", "(", ")", "[", "0", "]", "return", "py3compat", ".", "bytes_to_str", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Find the full path to a command using which.\"\"\"\n\n    arg_1 = sp.Popen(['/usr/bin/env', 'which', arg_0],\n                    stdout=sp.PIPE, stderr=sp.PIPE).communicate()[0]\n    return py3compat.bytes_to_str(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py", "identifier": "_find_cmd", "docstring": "Find the full path to a command using which.", "docstring_tokens": ["Find", "the", "full", "path", "to", "a", "command", "using", "which", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258957}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/core/reporting.py#L53-L81", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Render the report in the specified format", "language": "python", "parameters": "(self, format=ReportFormat.printout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "printout", ")", ":", "arg_4", "=", "arg_0", ".", "_generate_table_", "(", ")", "if", "arg_1", "==", "arg_2", ".", "printout", ":", "print", "(", "tabulate", "(", "arg_4", ",", "headers", "=", "\"firstrow\"", ",", "tablefmt", "=", "\"simple\"", ")", ")", "elif", "arg_1", "==", "arg_2", ".", "latex", ":", "arg_0", ".", "_Func_latex_", "(", "arg_4", ")", "elif", "arg_1", "==", "arg_2", ".", "txt", ":", "arg_0", ".", "_Func_txt_", "(", "arg_4", ")", "elif", "arg_1", "==", "arg_2", ".", "csv", ":", "arg_0", ".", "_Func_csv_", "(", "arg_4", ")", "elif", "arg_1", "==", "arg_2", ".", "string", ":", "return", "str", "(", "tabulate", "(", "arg_4", ",", "headers", "=", "\"firstrow\"", ",", "tablefmt", "=", "\"simple\"", ")", ")", "elif", "arg_1", "==", "arg_2", ".", "matplotlib", ":", "arg_0", ".", "_Func_matplotlib_", "(", ")", "elif", "arg_1", "==", "arg_2", ".", "png", ":", "if", "arg_0", ".", "output_path", "is", "None", ":", "arg_0", ".", "_Func_matplotlib_", "(", ")", "else", ":", "arg_0", ".", "_Func_matplotlib_", "(", "True", ")"], "function": "def Func(arg_0, arg_1=arg_2.printout):\n        \"\"\"\n        Render the report in the specified format\n\n        :param format: The format. The default format is to print\n          the report to the console.\n\n        :returns: If the format was set to 'string' then a string\n          representation of the report is returned.\n        \"\"\"\n\n        arg_4 = arg_0._generate_table_()\n        if arg_1 == arg_2.printout:\n            print(tabulate(arg_4, headers=\"firstrow\", tablefmt=\"simple\"))\n        elif arg_1 == arg_2.latex:\n            arg_0._Func_latex_(arg_4)\n        elif arg_1 == arg_2.txt:\n            arg_0._Func_txt_(arg_4)\n        elif arg_1 == arg_2.csv:\n            arg_0._Func_csv_(arg_4)\n        elif arg_1 == arg_2.string:\n            return str(tabulate(arg_4, headers=\"firstrow\", tablefmt=\"simple\"))\n        elif arg_1 == arg_2.matplotlib:\n            arg_0._Func_matplotlib_()\n        elif arg_1 == arg_2.png:\n            if arg_0.output_path is None:\n                arg_0._Func_matplotlib_()\n            else:\n                arg_0._Func_matplotlib_(True)", "path": "auxi/core/reporting.py", "identifier": "Report.render", "docstring": "Render the report in the specified format\n\n        :param format: The format. The default format is to print\n          the report to the console.\n\n        :returns: If the format was set to 'string' then a string\n          representation of the report is returned.", "docstring_tokens": ["Render", "the", "report", "in", "the", "specified", "format"], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 258958}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/topology.py#L370-L375", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Add a bolt to the topology", "language": "python", "parameters": "(self, name, bolt_cls, par, inputs, config=None, optional_outputs=None)", "return_statement": "return bolt_spec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "arg_2", ".", "spec", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "arg_0", ".", "add_spec", "(", "arg_7", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=None):\n    \"\"\"Add a bolt to the topology\"\"\"\n    arg_7 = arg_2.spec(arg_1=arg_1, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,\n                              arg_6=arg_6)\n    arg_0.add_spec(arg_7)\n    return arg_7", "path": "heronpy/api/topology.py", "identifier": "TopologyBuilder.add_bolt", "docstring": "Add a bolt to the topology", "docstring_tokens": ["Add", "a", "bolt", "to", "the", "topology"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258959}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/common/metrics_registry.py#L42-L46", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns a metric callable with a corresponding name.", "language": "python", "parameters": "(name: str)", "return_statement": "return fn_from_str(_REGISTRY[name])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Callable", "[", "...", ",", "Any", "]", ":", "if", "arg_0", "not", "in", "_REGISTRY", ":", "raise", "ConfigError", "(", "f'\"{name}\" is not registered as a metric'", ")", "return", "fn_from_str", "(", "_REGISTRY", "[", "arg_0", "]", ")"], "function": "def Func(arg_0: arg_1) -> Callable[..., Any]:\n    \"\"\"Returns a metric callable with a corresponding name.\"\"\"\n    if arg_0 not in _REGISTRY:\n        raise ConfigError(f'\"{name}\" is not registered as a metric')\n    return fn_from_str(_REGISTRY[arg_0])", "path": "deeppavlov/core/common/metrics_registry.py", "identifier": "get_metric_by_name", "docstring": "Returns a metric callable with a corresponding name.", "docstring_tokens": ["Returns", "a", "metric", "callable", "with", "a", "corresponding", "name", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 258960}
{"url": "https://github.com/edoburu/django-debugtools/blob/5c609c00fa9954330cd135fc62a1e18b8e7fea8a/debugtools/formatter.py#L374-L382", "sha": "5c609c00fa9954330cd135fc62a1e18b8e7fea8a", "docstring_summary": "Format an item in the result.\n        Could be a dictionary key, value, etc..", "language": "python", "parameters": "(self, object, context, maxlevels, level)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "try", ":", "return", "PrettyPrinter", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "except", "HANDLED_EXCEPTIONS", "as", "e", ":", "return", "_Func_exception", "(", "e", ")", ",", "True", ",", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Format an item in the result.\n        Could be a dictionary key, value, etc..\n        \"\"\"\n        try:\n            return PrettyPrinter.Func(arg_0, arg_1, arg_2, arg_3, arg_4)\n        except HANDLED_EXCEPTIONS as e:\n            return _Func_exception(e), True, False", "path": "debugtools/formatter.py", "identifier": "DebugPrettyPrinter.format", "docstring": "Format an item in the result.\n        Could be a dictionary key, value, etc..", "docstring_tokens": ["Format", "an", "item", "in", "the", "result", ".", "Could", "be", "a", "dictionary", "key", "value", "etc", ".."], "nwo": "edoburu/django-debugtools", "score": 0.28520508084306634, "idx": 258961}
{"url": "https://github.com/ptrus/suffix-trees/blob/e7439c93a7b895523fad36c8c65a781710320b57/suffix_trees/STree.py#L161-L171", "sha": "e7439c93a7b895523fad36c8c65a781710320b57", "docstring_summary": "Helper method that finds LCS by traversing the labeled GSD.", "language": "python", "parameters": "(self, node, stringIdxs)", "return_statement": "return deepestNode", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "arg_0", ".", "Func", "(", "n", ",", "arg_2", ")", "for", "(", "n", ",", "_", ")", "in", "arg_1", ".", "transition_links", "if", "n", ".", "generalized_idxs", ".", "issuperset", "(", "arg_2", ")", "]", "if", "arg_3", "==", "[", "]", ":", "return", "arg_1", "arg_4", "=", "max", "(", "arg_3", ",", "key", "=", "lambda", "n", ":", "n", ".", "depth", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Helper method that finds LCS by traversing the labeled GSD.\"\"\"\n        arg_3 = [arg_0.Func(n, arg_2)\n            for (n,_) in arg_1.transition_links\n            if n.generalized_idxs.issuperset(arg_2)]\n\n        if arg_3 == []:\n            return arg_1\n\n        arg_4 = max(arg_3, key=lambda n: n.depth)\n        return arg_4", "path": "suffix_trees/STree.py", "identifier": "STree._find_lcs", "docstring": "Helper method that finds LCS by traversing the labeled GSD.", "docstring_tokens": ["Helper", "method", "that", "finds", "LCS", "by", "traversing", "the", "labeled", "GSD", "."], "nwo": "ptrus/suffix-trees", "score": 0.5973428860454929, "idx": 258962}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L111-L172", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Validate whether a variable contains valid, mono audio data.", "language": "python", "parameters": "(y, mono=True)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "np", ".", "ndarray", ")", ":", "raise", "ParameterError", "(", "'data must be of type numpy.ndarray'", ")", "if", "not", "np", ".", "issubdtype", "(", "arg_0", ".", "dtype", ",", "np", ".", "floating", ")", ":", "raise", "ParameterError", "(", "'data must be floating-point'", ")", "if", "arg_1", "and", "arg_0", ".", "ndim", "!=", "1", ":", "raise", "ParameterError", "(", "'Invalid shape for monophonic audio: '", "'ndim={:d}, shape={}'", ".", "format", "(", "arg_0", ".", "ndim", ",", "arg_0", ".", "shape", ")", ")", "elif", "arg_0", ".", "ndim", ">", "2", "or", "arg_0", ".", "ndim", "==", "0", ":", "raise", "ParameterError", "(", "'Audio must have shape (samples,) or (channels, samples). '", "'Received shape={}'", ".", "format", "(", "arg_0", ".", "shape", ")", ")", "if", "not", "np", ".", "isfinite", "(", "arg_0", ")", ".", "all", "(", ")", ":", "raise", "ParameterError", "(", "'Audio buffer is not finite everywhere'", ")", "return", "True"], "function": "def Func(arg_0, arg_1=True):\n    '''Validate whether a variable contains valid, mono audio data.\n\n\n    Parameters\n    ----------\n    y : np.ndarray\n      The input data to validate\n\n    mono : bool\n      Whether or not to force monophonic audio\n\n    Returns\n    -------\n    valid : bool\n        True if all tests pass\n\n    Raises\n    ------\n    ParameterError\n        If `y` fails to meet the following criteria:\n            - `type(y)` is `np.ndarray`\n            - `y.dtype` is floating-point\n            - `mono == True` and `y.ndim` is not 1\n            - `mono == False` and `y.ndim` is not 1 or 2\n            - `np.isfinite(y).all()` is not True\n\n    Notes\n    -----\n    This function caches at level 20.\n\n    Examples\n    --------\n    >>> # Only allow monophonic signals\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> librosa.util.Func(y)\n    True\n\n    >>> # If we want to allow stereo signals\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), mono=False)\n    >>> librosa.util.Func(y, mono=False)\n    True\n    '''\n\n    if not isinstance(arg_0, np.ndarray):\n        raise ParameterError('data must be of type numpy.ndarray')\n\n    if not np.issubdtype(arg_0.dtype, np.floating):\n        raise ParameterError('data must be floating-point')\n\n    if arg_1 and arg_0.ndim != 1:\n        raise ParameterError('Invalid shape for monophonic audio: '\n                             'ndim={:d}, shape={}'.format(arg_0.ndim, arg_0.shape))\n\n    elif arg_0.ndim > 2 or arg_0.ndim == 0:\n        raise ParameterError('Audio must have shape (samples,) or (channels, samples). '\n                             'Received shape={}'.format(arg_0.shape))\n\n    if not np.isfinite(arg_0).all():\n        raise ParameterError('Audio buffer is not finite everywhere')\n\n    return True", "path": "librosa/util/utils.py", "identifier": "valid_audio", "docstring": "Validate whether a variable contains valid, mono audio data.\n\n\n    Parameters\n    ----------\n    y : np.ndarray\n      The input data to validate\n\n    mono : bool\n      Whether or not to force monophonic audio\n\n    Returns\n    -------\n    valid : bool\n        True if all tests pass\n\n    Raises\n    ------\n    ParameterError\n        If `y` fails to meet the following criteria:\n            - `type(y)` is `np.ndarray`\n            - `y.dtype` is floating-point\n            - `mono == True` and `y.ndim` is not 1\n            - `mono == False` and `y.ndim` is not 1 or 2\n            - `np.isfinite(y).all()` is not True\n\n    Notes\n    -----\n    This function caches at level 20.\n\n    Examples\n    --------\n    >>> # Only allow monophonic signals\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> librosa.util.valid_audio(y)\n    True\n\n    >>> # If we want to allow stereo signals\n    >>> y, sr = librosa.load(librosa.util.example_audio_file(), mono=False)\n    >>> librosa.util.valid_audio(y, mono=False)\n    True", "docstring_tokens": ["Validate", "whether", "a", "variable", "contains", "valid", "mono", "audio", "data", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258963}
{"url": "https://github.com/MeirKriheli/python-bidi/blob/a0e265bb465c1b7ad628487991e33b5ebe364641/bidi/algorithm.py#L486-L514", "sha": "a0e265bb465c1b7ad628487991e33b5ebe364641", "docstring_summary": "L2. From the highest level found in the text to the lowest odd\n    level on each line, including intermediate levels not actually\n    present in the text, reverse any contiguous sequence of characters\n    that are at that level or higher.", "language": "python", "parameters": "(chars, line_start, line_end, highest_level,\n                                lowest_odd_level)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "for", "arg_5", "in", "range", "(", "arg_3", ",", "arg_4", "-", "1", ",", "-", "1", ")", ":", "arg_6", "=", "arg_9", "=", "None", "for", "arg_7", "in", "range", "(", "arg_1", ",", "arg_2", "+", "1", ")", ":", "arg_8", "=", "arg_0", "[", "arg_7", "]", "if", "arg_8", "[", "'level'", "]", ">=", "arg_5", ":", "if", "arg_6", "is", "None", ":", "arg_6", "=", "arg_9", "=", "arg_7", "else", ":", "arg_9", "=", "arg_7", "else", ":", "if", "arg_9", ":", "arg_0", "[", "arg_6", ":", "+", "arg_9", "+", "1", "]", "=", "reversed", "(", "arg_0", "[", "arg_6", ":", "+", "arg_9", "+", "1", "]", ")", "arg_6", "=", "arg_9", "=", "None", "if", "arg_6", "is", "not", "None", ":", "arg_0", "[", "arg_6", ":", "+", "arg_9", "+", "1", "]", "=", "reversed", "(", "arg_0", "[", "arg_6", ":", "+", "arg_9", "+", "1", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                arg_4):\n    \"\"\"L2. From the highest level found in the text to the lowest odd\n    level on each line, including intermediate levels not actually\n    present in the text, reverse any contiguous sequence of characters\n    that are at that level or higher.\n\n    \"\"\"\n    for arg_5 in range(arg_3, arg_4-1, -1):\n        arg_6 = arg_9 = None\n\n        for arg_7 in range(arg_1, arg_2+1):\n            arg_8 = arg_0[arg_7]\n\n            if arg_8['level'] >= arg_5:\n                if arg_6 is None:\n                    arg_6 = arg_9 = arg_7\n                else:\n                    arg_9 = arg_7\n            else:\n                if arg_9:\n                    arg_0[arg_6:+arg_9+1] = \\\n                            reversed(arg_0[arg_6:+arg_9+1])\n                    arg_6 = arg_9 = None\n\n        # anything remaining ?\n        if arg_6 is not None:\n            arg_0[arg_6:+arg_9+1] = \\\n                reversed(arg_0[arg_6:+arg_9+1])", "path": "bidi/algorithm.py", "identifier": "reverse_contiguous_sequence", "docstring": "L2. From the highest level found in the text to the lowest odd\n    level on each line, including intermediate levels not actually\n    present in the text, reverse any contiguous sequence of characters\n    that are at that level or higher.", "docstring_tokens": ["L2", ".", "From", "the", "highest", "level", "found", "in", "the", "text", "to", "the", "lowest", "odd", "level", "on", "each", "line", "including", "intermediate", "levels", "not", "actually", "present", "in", "the", "text", "reverse", "any", "contiguous", "sequence", "of", "characters", "that", "are", "at", "that", "level", "or", "higher", "."], "nwo": "MeirKriheli/python-bidi", "score": 0.28828505124417525, "idx": 258964}
{"url": "https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L29-L36", "sha": "39e4da09f325382e21b0917b1b5cd027edce8728", "docstring_summary": "Return a pathname possibly with a number appended to it so that it is\r\n\tunique in the directory.", "language": "python", "parameters": "(path, root='')", "return_statement": "return next(potentialPaths)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_0", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_0", ")", "arg_2", "=", "itertools", ".", "chain", "(", "(", "arg_0", ",", ")", ",", "__get_numbered_paths", "(", "arg_0", ")", ")", "arg_2", "=", "six", ".", "moves", ".", "filterfalse", "(", "os", ".", "path", ".", "exists", ",", "arg_2", ")", "return", "next", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=''):\r\n\t\"\"\"Return a pathname possibly with a number appended to it so that it is\r\n\tunique in the directory.\"\"\"\r\n\targ_0 = os.path.join(arg_1, arg_0)\r\n\t# consider the path supplied, then the paths with numbers appended\r\n\targ_2 = itertools.chain((arg_0,), __get_numbered_paths(arg_0))\r\n\targ_2 = six.moves.filterfalse(os.path.exists, arg_2)\r\n\treturn next(arg_2)", "path": "jaraco/path.py", "identifier": "get_unique_pathname", "docstring": "Return a pathname possibly with a number appended to it so that it is\r\n\tunique in the directory.", "docstring_tokens": ["Return", "a", "pathname", "possibly", "with", "a", "number", "appended", "to", "it", "so", "that", "it", "is", "unique", "in", "the", "directory", "."], "nwo": "jaraco/jaraco.path", "score": 0.0, "idx": 258965}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/utils.py#L208-L221", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "launch the visit starting from the given node", "language": "python", "parameters": "(self, node)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_Funced", ":", "return", "None", "arg_0", ".", "_Funced", "[", "arg_1", "]", "=", "1", "arg_3", "=", "arg_0", ".", "get_callbacks", "(", "arg_1", ")", "if", "arg_3", "[", "0", "]", "is", "not", "None", ":", "arg_3", "[", "0", "]", "(", "arg_1", ")", "if", "hasattr", "(", "arg_1", ",", "\"locals\"", ")", ":", "for", "arg_4", "in", "arg_1", ".", "values", "(", ")", ":", "arg_0", ".", "Func", "(", "arg_4", ")", "if", "arg_3", "[", "1", "]", "is", "not", "None", ":", "return", "arg_3", "[", "1", "]", "(", "arg_1", ")", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"launch the Func starting from the given node\"\"\"\n        if arg_1 in arg_0._Funced:\n            return None\n        arg_0._Funced[arg_1] = 1  # FIXME: use set ?\n        arg_3 = arg_0.get_callbacks(arg_1)\n        if arg_3[0] is not None:\n            arg_3[0](arg_1)\n        if hasattr(arg_1, \"locals\"):  # skip Instance and other proxy\n            for arg_4 in arg_1.values():\n                arg_0.Func(arg_4)\n        if arg_3[1] is not None:\n            return arg_3[1](arg_1)\n        return None", "path": "pylint/pyreverse/utils.py", "identifier": "LocalsVisitor.visit", "docstring": "launch the visit starting from the given node", "docstring_tokens": ["launch", "the", "visit", "starting", "from", "the", "given", "node"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 258966}
{"url": "https://github.com/willprice/python-omxplayer-wrapper/blob/f242cb391f0fd07be2d9211c13ebe72fbc628fa3/omxplayer/player.py#L555-L563", "sha": "f242cb391f0fd07be2d9211c13ebe72fbc628fa3", "docstring_summary": "Seek the video by `relative_position` seconds", "language": "python", "parameters": "(self, relative_position)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_player_interface", ".", "Seek", "(", "Int64", "(", "1000.0", "*", "1000", "*", "arg_1", ")", ")", "arg_0", ".", "FuncEvent", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Seek the video by `relative_position` seconds\n\n        Args:\n            relative_position (float): The position in seconds to Func to.\n        \"\"\"\n        arg_0._player_interface.Seek(Int64(1000.0 * 1000 * arg_1))\n        arg_0.FuncEvent(arg_0, arg_1)", "path": "omxplayer/player.py", "identifier": "OMXPlayer.seek", "docstring": "Seek the video by `relative_position` seconds\n\n        Args:\n            relative_position (float): The position in seconds to seek to.", "docstring_tokens": ["Seek", "the", "video", "by", "relative_position", "seconds"], "nwo": "willprice/python-omxplayer-wrapper", "score": 0.4416928199994954, "idx": 258967}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/vae.py#L462-L476", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Builds fake MNIST-style data for unit testing.", "language": "python", "parameters": "(batch_size)", "return_statement": "return train_input_fn, eval_input_fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "random", ".", "rand", "(", "arg_0", ",", "*", "IMAGE_SHAPE", ")", ".", "astype", "(", "\"float32\"", ")", "def", "train_input_fn", "(", ")", ":", "arg_2", "=", "tf", ".", "data", ".", "Dataset", ".", "from_tensor_slices", "(", "arg_1", ")", ".", "map", "(", "lambda", "row", ":", "(", "row", ",", "0", ")", ")", ".", "batch", "(", "arg_0", ")", ".", "repeat", "(", ")", "return", "tf", ".", "compat", ".", "v1", ".", "data", ".", "make_one_shot_iterator", "(", "arg_2", ")", ".", "get_next", "(", ")", "def", "eval_input_fn", "(", ")", ":", "arg_2", "=", "tf", ".", "data", ".", "Dataset", ".", "from_tensor_slices", "(", "arg_1", ")", ".", "map", "(", "lambda", "row", ":", "(", "row", ",", "0", ")", ")", ".", "batch", "(", "arg_0", ")", "return", "tf", ".", "compat", ".", "v1", ".", "data", ".", "make_one_shot_iterator", "(", "arg_2", ")", ".", "get_next", "(", ")", "return", "train_input_fn", ",", "eval_input_fn"], "function": "def Func(arg_0):\n  \"\"\"Builds fake MNIST-style data for unit testing.\"\"\"\n  arg_1 = np.random.rand(arg_0, *IMAGE_SHAPE).astype(\"float32\")\n\n  def train_input_fn():\n    arg_2 = tf.data.Dataset.from_tensor_slices(\n        arg_1).map(lambda row: (row, 0)).batch(arg_0).repeat()\n    return tf.compat.v1.data.make_one_shot_iterator(arg_2).get_next()\n\n  def eval_input_fn():\n    arg_2 = tf.data.Dataset.from_tensor_slices(\n        arg_1).map(lambda row: (row, 0)).batch(arg_0)\n    return tf.compat.v1.data.make_one_shot_iterator(arg_2).get_next()\n\n  return train_input_fn, eval_input_fn", "path": "tensorflow_probability/examples/vae.py", "identifier": "build_fake_input_fns", "docstring": "Builds fake MNIST-style data for unit testing.", "docstring_tokens": ["Builds", "fake", "MNIST", "-", "style", "data", "for", "unit", "testing", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 258968}
{"url": "https://github.com/MaritimeRenewable/PyResis/blob/c53f83598c8760d532c44036ea3ecd0c84eada95/PyResis/propulsion_power.py#L108-L119", "sha": "c53f83598c8760d532c44036ea3ecd0c84eada95", "docstring_summary": "Return resistance of the vehicle.", "language": "python", "parameters": "(self)", "return_statement": "return RT", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "total_Func_coef", "=", "frictional_Func_coef", "(", "arg_0", ".", "length", ",", "arg_0", ".", "speed", ")", "+", "residual_Func_coef", "(", "arg_0", ".", "slenderness_coefficient", ",", "arg_0", ".", "prismatic_coefficient", ",", "froude_number", "(", "arg_0", ".", "speed", ",", "arg_0", ".", "length", ")", ")", "arg_2", "=", "1", "/", "2", "*", "arg_0", ".", "total_Func_coef", "*", "1025", "*", "arg_0", ".", "surface_area", "*", "arg_0", ".", "speed", "**", "2", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Return Func of the vehicle.\n\n        :return: newton the Func of the ship\n        \"\"\"\n        arg_0.total_Func_coef = frictional_Func_coef(arg_0.length, arg_0.speed) + \\\n                                residual_Func_coef(arg_0.slenderness_coefficient,\n                                                         arg_0.prismatic_coefficient,\n                                                         froude_number(arg_0.speed, arg_0.length))\n        arg_2 = 1 / 2 * arg_0.total_Func_coef * 1025 * arg_0.surface_area * arg_0.speed ** 2\n        return arg_2", "path": "PyResis/propulsion_power.py", "identifier": "Ship.resistance", "docstring": "Return resistance of the vehicle.\n\n        :return: newton the resistance of the ship", "docstring_tokens": ["Return", "resistance", "of", "the", "vehicle", "."], "nwo": "MaritimeRenewable/PyResis", "score": 0.09252797783733271, "idx": 258969}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L641-L651", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Modify query as so include only specific members.", "language": "python", "parameters": "(cls, query, q)", "return_statement": "return query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "arg_1", ".", "join", "(", "User", ")", ".", "filter", "(", "User", ".", "email", ".", "like", "(", "'%{0}%'", ".", "format", "(", "arg_2", ")", ")", ",", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Modify query as so include only specific members.\n\n        :param query: Query object.\n        :param str q: Search string.\n        :returs: Query object.\n        \"\"\"\n        arg_1 = arg_1.join(User).filter(\n                User.email.like('%{0}%'.format(arg_2)),\n        )\n        return arg_1", "path": "invenio_groups/models.py", "identifier": "Membership.search", "docstring": "Modify query as so include only specific members.\n\n        :param query: Query object.\n        :param str q: Search string.\n        :returs: Query object.", "docstring_tokens": ["Modify", "query", "as", "so", "include", "only", "specific", "members", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 258970}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/monitoring/db_manager.py#L405-L412", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Start the database manager process", "language": "python", "parameters": "(priority_msgs, resource_msgs, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "DatabaseManager", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_4", ".", "start", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n    \"\"\"Start the database manager process\n\n    The DFK should start this function. The args, kwargs match that of the monitoring config\n\n    \"\"\"\n    arg_4 = DatabaseManager(*arg_2, **arg_3)\n    arg_4.start(arg_0, arg_1)", "path": "parsl/monitoring/db_manager.py", "identifier": "dbm_starter", "docstring": "Start the database manager process\n\n    The DFK should start this function. The args, kwargs match that of the monitoring config", "docstring_tokens": ["Start", "the", "database", "manager", "process"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 258971}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/summaries/bag_of_words.py#L82-L94", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Choose the codewords based on a training set.", "language": "python", "parameters": "(self, X, y=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "kmeans_Func_", "=", "copy", "(", "arg_0", ".", "kmeans", ")", "arg_1", "=", "as_features", "(", "arg_1", ",", "stack", "=", "True", ")", "arg_0", ".", "kmeans_Func_", ".", "Func", "(", "arg_1", ".", "stacked_features", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Choose the codewords based on a training set.\n\n        Parameters\n        ----------\n        X : :class:`skl_groups.features.Features` or list of arrays of shape ``[n_samples[i], n_features]``\n            Training set. If a Features object, it will be stacked.\n        '''\n        arg_0.kmeans_Func_ = copy(arg_0.kmeans)\n        arg_1 = as_features(arg_1, stack=True)\n        arg_0.kmeans_Func_.Func(arg_1.stacked_features) \n        return arg_0", "path": "skl_groups/summaries/bag_of_words.py", "identifier": "BagOfWords.fit", "docstring": "Choose the codewords based on a training set.\n\n        Parameters\n        ----------\n        X : :class:`skl_groups.features.Features` or list of arrays of shape ``[n_samples[i], n_features]``\n            Training set. If a Features object, it will be stacked.", "docstring_tokens": ["Choose", "the", "codewords", "based", "on", "a", "training", "set", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 258972}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/campaignfeedback.py#L28-L51", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Add feedback on a specific campaign.", "language": "python", "parameters": "(self, campaign_id, data, **queryparams)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_0", ".", "campaign_id", "=", "arg_1", "if", "'message'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The campaign feedback must have a message'", ")", "arg_4", "=", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'feedback'", ")", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "if", "arg_4", "is", "not", "None", ":", "arg_0", ".", "feedback_id", "=", "arg_4", "[", "'feedback_id'", "]", "else", ":", "arg_0", ".", "feedback_id", "=", "None", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"\n        Add feedback on a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"message\": string*\n        }\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        arg_0.campaign_id = arg_1\n        if 'message' not in arg_2:\n            raise KeyError('The campaign feedback must have a message')\n        arg_4 = arg_0._mc_client._post(url=arg_0._build_path(arg_1, 'feedback'), arg_2=arg_2, **arg_3)\n        if arg_4 is not None:\n            arg_0.feedback_id = arg_4['feedback_id']\n        else:\n            arg_0.feedback_id = None\n        return arg_4", "path": "mailchimp3/entities/campaignfeedback.py", "identifier": "CampaignFeedback.create", "docstring": "Add feedback on a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"message\": string*\n        }\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []", "docstring_tokens": ["Add", "feedback", "on", "a", "specific", "campaign", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 258973}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L782-L791", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Creates a disjunction for keyword scan queries.", "language": "python", "parameters": "(self, query_fc, fname)", "return_statement": "return disj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_1", ".", "get", "(", "arg_2", ",", "[", "]", ")", ")", "==", "0", ":", "return", "[", "]", "arg_3", "=", "arg_1", "[", "arg_2", "]", ".", "keys", "(", ")", "arg_4", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "indexes", "[", "arg_2", "]", "[", "'feature_names'", "]", ":", "arg_4", ".", "append", "(", "{", "'terms'", ":", "{", "fname_to_idx_name", "(", "arg_2", ")", ":", "arg_3", "}", "}", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        'Creates a disjunction for keyword scan queries.'\n        if len(arg_1.get(arg_2, [])) == 0:\n            return []\n        arg_3 = arg_1[arg_2].keys()\n\n        arg_4 = []\n        for arg_2 in arg_0.indexes[arg_2]['feature_names']:\n            arg_4.append({'terms': {fname_to_idx_name(arg_2): arg_3}})\n        return arg_4", "path": "dossier/store/elastic.py", "identifier": "ElasticStore._fc_index_disjunction_from_query", "docstring": "Creates a disjunction for keyword scan queries.", "docstring_tokens": ["Creates", "a", "disjunction", "for", "keyword", "scan", "queries", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 258974}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L738-L752", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Create a new group admin.", "language": "python", "parameters": "(cls, group, admin)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "arg_3", "=", "arg_0", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", ")", "db", ".", "session", ".", "add", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Create a new group admin.\n\n        :param group: Group object.\n        :param admin: Admin object.\n        :returns: Newly Funcd GroupAdmin object.\n        :raises: IntegrityError\n        \"\"\"\n        with db.session.begin_nested():\n            arg_3 = arg_0(\n                arg_1=arg_1,\n                arg_2=arg_2,\n            )\n            db.session.add(arg_3)\n        return arg_3", "path": "invenio_groups/models.py", "identifier": "GroupAdmin.create", "docstring": "Create a new group admin.\n\n        :param group: Group object.\n        :param admin: Admin object.\n        :returns: Newly created GroupAdmin object.\n        :raises: IntegrityError", "docstring_tokens": ["Create", "a", "new", "group", "admin", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 258975}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/comments.py#L56-L67", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Strip comments from json string.", "language": "python", "parameters": "(string, comment_symbols=frozenset(('#', '//')))", "return_statement": "return '\\n'.join(lines)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", "(", "(", "'#'", ",", "'//'", ")", ")", ")", ":", "arg_3", "=", "arg_0", ".", "splitlines", "(", ")", "for", "arg_4", "in", "range", "(", "len", "(", "arg_3", ")", ")", ":", "for", "arg_5", "in", "arg_1", ":", "arg_3", "[", "arg_4", "]", "=", "strip_comment_line_with_symbol", "(", "arg_3", "[", "arg_4", "]", ",", "start", "=", "arg_5", ")", "return", "'\\n'", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=arg_2(('#', '//'))):\n    \"\"\"Strip comments from json string.\n\n    :param string: A string containing json with comments started by comment_symbols.\n    :param comment_symbols: Iterable of symbols that start a line comment (default # or //).\n    :return: The string with the comments removed.\n    \"\"\"\n    arg_3 = arg_0.splitlines()\n    for arg_4 in range(len(arg_3)):\n        for arg_5 in arg_1:\n            arg_3[arg_4] = strip_comment_line_with_symbol(arg_3[arg_4], start=arg_5)\n    return '\\n'.join(arg_3)", "path": "superjson/comments.py", "identifier": "strip_comments", "docstring": "Strip comments from json string.\n\n    :param string: A string containing json with comments started by comment_symbols.\n    :param comment_symbols: Iterable of symbols that start a line comment (default # or //).\n    :return: The string with the comments removed.", "docstring_tokens": ["Strip", "comments", "from", "json", "string", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 258976}
{"url": "https://github.com/napalm-automation/napalm-yang/blob/998e8a933171d010b8544bcc5dc448e2b68051e2/napalm_yang/jinja_filters/helpers.py#L4-L25", "sha": "998e8a933171d010b8544bcc5dc448e2b68051e2", "docstring_summary": "Decorator that checks if a value passed to a Jinja filter evaluates to false\n    and returns an empty string. Otherwise calls the original Jinja filter.", "language": "python", "parameters": "(default=\"\")", "return_statement": "return real_decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"\"", ")", ":", "def", "real_decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "wrapper", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "if", "not", "arg_2", ":", "return", "arg_0", "else", ":", "return", "arg_1", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "return", "wrapper", "return", "real_decorator"], "function": "def Func(arg_0=\"\"):\n    \"\"\"\n    Decorator that checks if a value passed to a Jinja filter evaluates to false\n    and returns an empty string. Otherwise calls the original Jinja filter.\n\n    Example usage:\n    @Func\n    def my_jinja_filter(value, arg1):\n    \"\"\"\n\n    def real_decorator(arg_1):\n\n        @wraps(arg_1)\n        def wrapper(arg_2, *arg_3, **arg_4):\n            if not arg_2:\n                return arg_0\n            else:\n                return arg_1(arg_2, *arg_3, **arg_4)\n\n        return wrapper\n\n    return real_decorator", "path": "napalm_yang/jinja_filters/helpers.py", "identifier": "check_empty", "docstring": "Decorator that checks if a value passed to a Jinja filter evaluates to false\n    and returns an empty string. Otherwise calls the original Jinja filter.\n\n    Example usage:\n    @check_empty\n    def my_jinja_filter(value, arg1):", "docstring_tokens": ["Decorator", "that", "checks", "if", "a", "value", "passed", "to", "a", "Jinja", "filter", "evaluates", "to", "false", "and", "returns", "an", "empty", "string", ".", "Otherwise", "calls", "the", "original", "Jinja", "filter", "."], "nwo": "napalm-automation/napalm-yang", "score": 0.2912181512296147, "idx": 258977}
{"url": "https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L784-L792", "sha": "532e685c504ea96f9e42833594585159ac1d2068", "docstring_summary": "Add an HTTP header to response object.", "language": "python", "parameters": "(self, name, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "_headers", ".", "append", "(", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add an HTTP header to response object.\n\n        Arguments:\n          name (str): HTTP header field name\n          value (str): HTTP header field value\n        \"\"\"\n        if arg_2 is not None:\n            arg_0._headers.append((arg_1, arg_2))", "path": "ice.py", "identifier": "Response.add_header", "docstring": "Add an HTTP header to response object.\n\n        Arguments:\n          name (str): HTTP header field name\n          value (str): HTTP header field value", "docstring_tokens": ["Add", "an", "HTTP", "header", "to", "response", "object", "."], "nwo": "susam/ice", "score": 0.16638194949711382, "idx": 258978}
{"url": "https://github.com/Tivix/django-rest-auth/blob/624ad01afbc86fa15b4e652406f3bdcd01f36e00/rest_auth/serializers.py#L143-L153", "sha": "624ad01afbc86fa15b4e652406f3bdcd01f36e00", "docstring_summary": "Required to allow using custom USER_DETAILS_SERIALIZER in\n        JWTSerializer. Defining it here to avoid circular imports", "language": "python", "parameters": "(self, obj)", "return_statement": "return user_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "settings", ",", "'REST_AUTH_SERIALIZERS'", ",", "{", "}", ")", "arg_3", "=", "import_callable", "(", "arg_2", ".", "get", "(", "'USER_DETAILS_SERIALIZER'", ",", "UserDetailsSerializer", ")", ")", "arg_4", "=", "arg_3", "(", "arg_1", "[", "'user'", "]", ",", "context", "=", "arg_0", ".", "context", ")", ".", "data", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Required to allow using custom USER_DETAILS_SERIALIZER in\n        JWTSerializer. Defining it here to avoid circular imports\n        \"\"\"\n        arg_2 = getattr(settings, 'REST_AUTH_SERIALIZERS', {})\n        arg_3 = import_callable(\n            arg_2.get('USER_DETAILS_SERIALIZER', UserDetailsSerializer)\n        )\n        arg_4 = arg_3(arg_1['user'], context=arg_0.context).data\n        return arg_4", "path": "rest_auth/serializers.py", "identifier": "JWTSerializer.get_user", "docstring": "Required to allow using custom USER_DETAILS_SERIALIZER in\n        JWTSerializer. Defining it here to avoid circular imports", "docstring_tokens": ["Required", "to", "allow", "using", "custom", "USER_DETAILS_SERIALIZER", "in", "JWTSerializer", ".", "Defining", "it", "here", "to", "avoid", "circular", "imports"], "nwo": "Tivix/django-rest-auth", "score": 0.9572950975310098, "idx": 258979}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/pretty.py#L626-L642", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Base pprint for all exceptions.", "language": "python", "parameters": "(obj, p, cycle)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "__class__", ".", "__module__", "in", "(", "'exceptions'", ",", "'builtins'", ")", ":", "arg_3", "=", "arg_0", ".", "__class__", ".", "__name__", "else", ":", "arg_3", "=", "'%s.%s'", "%", "(", "arg_0", ".", "__class__", ".", "__module__", ",", "arg_0", ".", "__class__", ".", "__name__", ")", "arg_4", "=", "len", "(", "arg_3", ")", "+", "1", "arg_1", ".", "begin_group", "(", "arg_4", ",", "arg_3", "+", "'('", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "getattr", "(", "arg_0", ",", "'args'", ",", "(", ")", ")", ")", ":", "if", "arg_5", ":", "arg_1", ".", "text", "(", "','", ")", "arg_1", ".", "breakable", "(", ")", "arg_1", ".", "pretty", "(", "arg_6", ")", "arg_1", ".", "end_group", "(", "arg_4", ",", "')'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Base pprint for all exceptions.\"\"\"\n    if arg_0.__class__.__module__ in ('exceptions', 'builtins'):\n        arg_3 = arg_0.__class__.__name__\n    else:\n        arg_3 = '%s.%s' % (\n            arg_0.__class__.__module__,\n            arg_0.__class__.__name__\n        )\n    arg_4 = len(arg_3) + 1\n    arg_1.begin_group(arg_4, arg_3 + '(')\n    for arg_5, arg_6 in enumerate(getattr(arg_0, 'args', ())):\n        if arg_5:\n            arg_1.text(',')\n            arg_1.breakable()\n        arg_1.pretty(arg_6)\n    arg_1.end_group(arg_4, ')')", "path": "environment/lib/python2.7/site-packages/IPython/lib/pretty.py", "identifier": "_exception_pprint", "docstring": "Base pprint for all exceptions.", "docstring_tokens": ["Base", "pprint", "for", "all", "exceptions", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 258980}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/optionparser.py#L25-L40", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Instance method decorator to convert an optional file keyword\n    argument into an actual value, whether it be a passed value, a\n    value obtained from an io_manager, or sys.stdout.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "arg_3", "(", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", ":", "return", "arg_0", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "elif", "arg_1", ".", "io_manager", ":", "with", "arg_1", ".", "io_manager", ".", "with_stdout", "(", ")", "as", "stdout", ":", "return", "arg_0", "(", "arg_1", ",", "arg_2", "=", "stdout", ")", "else", ":", "return", "arg_0", "(", "arg_1", ",", "arg_2", "=", "sys", ".", "stdout", ")", "arg_3", ".", "__doc__", "=", "arg_0", ".", "__doc__", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Instance method decorator to convert an optional file keyword\n    argument into an actual value, whether it be a passed value, a\n    value obtained from an io_manager, or sys.stdout.\n    \"\"\"\n    def arg_3(arg_1, arg_2=None):\n        if arg_2:\n            return arg_0(arg_1, arg_2=arg_2)\n        elif arg_1.io_manager:\n            with arg_1.io_manager.with_stdout() as stdout:\n                return arg_0(arg_1, arg_2=stdout)\n        else:\n            return arg_0(arg_1, arg_2=sys.stdout)\n    arg_3.__doc__ = arg_0.__doc__\n    return arg_3", "path": "swiftly/cli/optionparser.py", "identifier": "_stdout_filed", "docstring": "Instance method decorator to convert an optional file keyword\n    argument into an actual value, whether it be a passed value, a\n    value obtained from an io_manager, or sys.stdout.", "docstring_tokens": ["Instance", "method", "decorator", "to", "convert", "an", "optional", "file", "keyword", "argument", "into", "an", "actual", "value", "whether", "it", "be", "a", "passed", "value", "a", "value", "obtained", "from", "an", "io_manager", "or", "sys", ".", "stdout", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 258981}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/deployment/jailhost.py#L64-L83", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "stops, deletes and re-creates all jails.\n    since the cleanser master is rather large, that one is omitted by default.", "language": "python", "parameters": "(confirm=True, keep_cleanser_master=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "True", ",", "arg_1", "=", "True", ")", ":", "if", "value_asbool", "(", "arg_0", ")", "and", "not", "yesno", "(", "\"\"\"\\nObacht!            This will destroy all existing and or currently running jails on the host.            Are you sure that you want to continue?\"\"\"", ")", ":", "exit", "(", "\"Glad I asked...\"", ")", "reset_cleansers", "(", "arg_0", "=", "False", ")", "arg_2", "=", "[", "'appserver'", ",", "'webserver'", ",", "'worker'", "]", "if", "not", "value_asbool", "(", "arg_1", ")", ":", "arg_2", ".", "append", "(", "'cleanser'", ")", "with", "fab", ".", "warn_only", "(", ")", ":", "for", "arg_3", "in", "arg_2", ":", "fab", ".", "run", "(", "'ezjail-admin delete -fw {jail}'", ".", "format", "(", "arg_3", "=", "arg_3", ")", ")", "fab", ".", "run", "(", "'rm /usr/jails/cleanser/usr/home/cleanser/.ssh/authorized_keys'", ")"], "function": "def Func(arg_0=True, arg_1=True):\n    \"\"\" stops, deletes and re-creates all jails.\n    since the cleanser master is rather large, that one is omitted by default.\n    \"\"\"\n    if value_asbool(arg_0) and not yesno(\"\"\"\\nObacht!\n            This will destroy all existing and or currently running jails on the host.\n            Are you sure that you want to continue?\"\"\"):\n        exit(\"Glad I asked...\")\n\n    reset_cleansers(arg_0=False)\n\n    arg_2 = ['appserver', 'webserver', 'worker']\n    if not value_asbool(arg_1):\n        arg_2.append('cleanser')\n\n    with fab.warn_only():\n        for arg_3 in arg_2:\n            fab.run('ezjail-admin delete -fw {jail}'.format(arg_3=arg_3))\n        # remove authorized keys for no longer existing key (they are regenerated for each new worker)\n        fab.run('rm /usr/jails/cleanser/usr/home/cleanser/.ssh/authorized_keys')", "path": "deployment/jailhost.py", "identifier": "reset_jails", "docstring": "stops, deletes and re-creates all jails.\n    since the cleanser master is rather large, that one is omitted by default.", "docstring_tokens": ["stops", "deletes", "and", "re", "-", "creates", "all", "jails", ".", "since", "the", "cleanser", "master", "is", "rather", "large", "that", "one", "is", "omitted", "by", "default", "."], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 258982}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L163-L170", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "activate a backend by adding it to the .sregistry configuration file.", "language": "python", "parameters": "(backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "read_client_secrets", "(", ")", "if", "arg_0", "is", "not", "None", ":", "arg_1", "[", "'SREGISTRY_CLIENT'", "]", "=", "arg_0", "update_secrets", "(", "arg_1", ")", "print", "(", "'[Func] %s'", "%", "arg_0", ")"], "function": "def Func(arg_0):\n    '''Func a backend by adding it to the .sregistry configuration file.\n    '''\n    arg_1 = read_client_secrets()\n    if arg_0 is not None:\n        arg_1['SREGISTRY_CLIENT'] = arg_0\n        update_secrets(arg_1)\n        print('[Func] %s' %arg_0)", "path": "sregistry/client/backend.py", "identifier": "activate", "docstring": "activate a backend by adding it to the .sregistry configuration file.", "docstring_tokens": ["activate", "a", "backend", "by", "adding", "it", "to", "the", ".", "sregistry", "configuration", "file", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 258983}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L534-L555", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "Get the stepper library version number.", "language": "python", "parameters": "(self, timeout=20)", "return_statement": "return self._command_handler.stepper_library_version", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "20", ")", ":", "arg_2", "=", "time", ".", "time", "(", ")", "while", "arg_0", ".", "_command_handler", ".", "stepper_library_version", "<=", "0", ":", "if", "time", ".", "time", "(", ")", "-", "arg_2", ">", "arg_1", ":", "if", "arg_0", ".", "verbose", "is", "True", ":", "print", "(", "\"Stepper Library Version Request timed-out. \"", "\"Did you send a stepper_request_library_version command?\"", ")", "return", "else", ":", "pass", "return", "arg_0", ".", "_command_handler", ".", "stepper_library_version"], "function": "def Func(arg_0, arg_1=20):\n        \"\"\"\n        Get the stepper library version number.\n\n        :param timeout: specify a time to allow arduino to process and return a version\n\n        :return: the stepper version number if it was set.\n        \"\"\"\n        # get current time\n        arg_2 = time.time()\n\n        # wait for up to 20 seconds for a successful capability query to occur\n\n        while arg_0._command_handler.stepper_library_version <= 0:\n            if time.time() - arg_2 > arg_1:\n                if arg_0.verbose is True:\n                    print(\"Stepper Library Version Request timed-out. \"\n                          \"Did you send a stepper_request_library_version command?\")\n                return\n            else:\n                pass\n        return arg_0._command_handler.stepper_library_version", "path": "PyMata/pymata.py", "identifier": "PyMata.get_stepper_version", "docstring": "Get the stepper library version number.\n\n        :param timeout: specify a time to allow arduino to process and return a version\n\n        :return: the stepper version number if it was set.", "docstring_tokens": ["Get", "the", "stepper", "library", "version", "number", "."], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 258984}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1763-L1808", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "getMultiple - Gets multiple objects with a single atomic operation", "language": "python", "parameters": "(self, pks, cascadeFetch=False)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "type", "(", "arg_1", ")", "==", "set", ":", "arg_1", "=", "list", "(", "arg_1", ")", "if", "len", "(", "arg_1", ")", "==", "1", ":", "return", "IRQueryableList", "(", "[", "arg_0", ".", "get", "(", "arg_1", "[", "0", "]", ",", "arg_2", "=", "arg_2", ")", "]", ",", "mdl", "=", "arg_0", ".", "mdl", ")", "arg_3", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_4", "=", "arg_3", ".", "pipeline", "(", ")", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "arg_0", ".", "_get_key_for_id", "(", "arg_5", ")", "arg_4", ".", "hgetall", "(", "arg_6", ")", "arg_7", "=", "arg_4", ".", "execute", "(", ")", "arg_8", "=", "IRQueryableList", "(", "mdl", "=", "arg_0", ".", "mdl", ")", "arg_9", "=", "0", "arg_10", "=", "len", "(", "arg_1", ")", "while", "arg_9", "<", "arg_10", ":", "if", "arg_7", "[", "arg_9", "]", "is", "None", ":", "arg_8", ".", "append", "(", "None", ")", "arg_9", "+=", "1", "continue", "arg_7", "[", "arg_9", "]", "[", "'_id'", "]", "=", "arg_1", "[", "arg_9", "]", "arg_11", "=", "arg_0", ".", "_redisResultToObj", "(", "arg_7", "[", "arg_9", "]", ")", "arg_8", ".", "append", "(", "arg_11", ")", "arg_9", "+=", "1", "if", "arg_2", "is", "True", ":", "for", "arg_11", "in", "arg_8", ":", "if", "not", "arg_11", ":", "continue", "arg_0", ".", "_doCascadeFetch", "(", "arg_11", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=False):\n\t\t'''\n\t\t\tFunc - Gets multiple objects with a single atomic operation\n\n\n\t\t\t@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model\n\t\t\t   will be fetched immediately. If False, foreign objects will be fetched on-access.\n\n\t\t\t@param pks - list of internal keys\n\t\t'''\n\n\t\tif type(arg_1) == set:\n\t\t\targ_1 = list(arg_1)\n\n\t\tif len(arg_1) == 1:\n\t\t\t# Optimization to not pipeline on 1 id\n\t\t\treturn IRQueryableList([arg_0.get(arg_1[0], arg_2=arg_2)], mdl=arg_0.mdl)\n\n\t\targ_3 = arg_0._get_connection()\n\t\targ_4 = arg_3.pipeline()\n\t\tfor arg_5 in arg_1:\n\t\t\targ_6 = arg_0._get_key_for_id(arg_5)\n\t\t\targ_4.hgetall(arg_6)\n\n\t\targ_7 = arg_4.execute()\n\t\t\n\t\targ_8 = IRQueryableList(mdl=arg_0.mdl)\n\t\targ_9 = 0\n\t\targ_10 = len(arg_1)\n\t\twhile arg_9 < arg_10:\n\t\t\tif arg_7[arg_9] is None:\n\t\t\t\targ_8.append(None)\n\t\t\t\targ_9 += 1\n\t\t\t\tcontinue\n\t\t\targ_7[arg_9]['_id'] = arg_1[arg_9]\n\t\t\targ_11 = arg_0._redisResultToObj(arg_7[arg_9])\n\t\t\targ_8.append(arg_11)\n\t\t\targ_9 += 1\n\n\t\tif arg_2 is True:\n\t\t\tfor arg_11 in arg_8:\n\t\t\t\tif not arg_11:\n\t\t\t\t\tcontinue\n\t\t\t\targ_0._doCascadeFetch(arg_11)\n\t\t\t\n\t\treturn arg_8", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisQuery.getMultiple", "docstring": "getMultiple - Gets multiple objects with a single atomic operation\n\n\n\t\t\t@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model\n\t\t\t   will be fetched immediately. If False, foreign objects will be fetched on-access.\n\n\t\t\t@param pks - list of internal keys", "docstring_tokens": ["getMultiple", "-", "Gets", "multiple", "objects", "with", "a", "single", "atomic", "operation"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 258985}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/elements.py#L553-L633", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Improved formula parser which handles braces and their multipliers, \n    as well as rational element counts.", "language": "python", "parameters": "(formula, check=True)", "return_statement": "return ans", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "'['", ",", "''", ")", ".", "replace", "(", "']'", ",", "''", ")", "arg_2", "=", "bracketed_charge_re", ".", "split", "(", "arg_0", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "arg_0", "=", "arg_2", "[", "0", "]", "else", ":", "arg_0", "=", "arg_0", ".", "split", "(", "'+'", ")", "[", "0", "]", ".", "split", "(", "'-'", ")", "[", "0", "]", "arg_3", "=", "[", "[", "]", "]", "arg_4", "=", "arg_3", "[", "0", "]", "arg_5", "=", "formula_token_matcher_rational", ".", "findall", "(", "arg_0", ")", "if", "arg_1", ":", "arg_6", "=", "set", "(", "[", "j", "for", "i", "in", "arg_5", "for", "j", "in", "i", "if", "j", "in", "letter_set", "]", ")", "arg_7", "=", "set", "(", "i", "for", "i", "in", "arg_0", "if", "i", "in", "letter_set", ")", "if", "arg_7", "!=", "arg_6", ":", "raise", "Exception", "(", "'Input may not be a formula; extra letters were detected'", ")", "for", "arg_8", "in", "arg_5", ":", "if", "arg_8", "==", "\"(\"", ":", "arg_3", ".", "append", "(", "[", "]", ")", "arg_4", "=", "arg_3", "[", "-", "1", "]", "elif", "arg_8", "==", "\")\"", ":", "arg_9", "=", "{", "}", "for", "arg_10", "in", "arg_4", ":", "for", "arg_11", ",", "arg_12", "in", "arg_10", ".", "items", "(", ")", ":", "if", "arg_11", "in", "arg_9", ":", "arg_9", "[", "arg_11", "]", "=", "arg_9", "[", "arg_11", "]", "+", "arg_12", "else", ":", "arg_9", "[", "arg_11", "]", "=", "arg_12", "arg_3", ".", "pop", "(", ")", "arg_4", "=", "arg_3", "[", "-", "1", "]", "arg_4", ".", "append", "(", "arg_9", ")", "elif", "arg_8", ".", "isalpha", "(", ")", ":", "arg_4", ".", "append", "(", "{", "arg_8", ":", "1", "}", ")", "else", ":", "arg_13", "=", "float", "(", "arg_8", ")", "arg_14", "=", "int", "(", "arg_13", ")", "if", "arg_14", "==", "arg_13", ":", "arg_13", "=", "arg_14", "arg_4", "[", "-", "1", "]", "=", "{", "arg_11", ":", "arg_12", "*", "arg_13", "for", "arg_11", ",", "arg_12", "in", "arg_4", "[", "-", "1", "]", ".", "items", "(", ")", "}", "arg_15", "=", "{", "}", "for", "arg_10", "in", "arg_4", ":", "for", "arg_11", ",", "arg_12", "in", "arg_10", ".", "items", "(", ")", ":", "if", "arg_11", "in", "arg_15", ":", "arg_15", "[", "arg_11", "]", "=", "arg_15", "[", "arg_11", "]", "+", "arg_12", "else", ":", "arg_15", "[", "arg_11", "]", "=", "arg_12", "return", "arg_15"], "function": "def Func(arg_0, arg_1=True):\n    r'''Improved formula parser which handles braces and their multipliers, \n    as well as rational element counts.\n\n    Strips charges from the end of a formula first. Accepts repeated chemical\n    units. Performs no sanity checking that elements are actually elements.\n    As it uses regular expressions for matching, errors are mostly just ignored.\n    \n    Parameters\n    ----------\n    formula : str\n        Formula string, very simply formats only.\n    check : bool\n        If `check` is True, a simple check will be performed to determine if\n        a formula is not a formula and an exception will be raised if it is\n        not, [-]\n\n    Returns\n    -------\n    atoms : dict\n        dictionary of counts of individual atoms, indexed by symbol with\n        proper capitalization, [-]\n\n    Notes\n    -----\n    Inspired by the approach taken by CrazyMerlyn on a reddit DailyProgrammer\n    challenge, at https://www.reddit.com/r/dailyprogrammer/comments/6eerfk/20170531_challenge_317_intermediate_counting/\n\n    Examples\n    --------\n    >>> pprint(Func('Pd(NH3)4.0001+2'))\n    {'H': 12.0003, 'N': 4.0001, 'Pd': 1}\n    '''\n    arg_0 = arg_0.replace('[', '').replace(']', '')\n    arg_2 = bracketed_charge_re.split(arg_0)\n    if len(arg_2) > 1:\n        arg_0 = arg_2[0]\n    else:\n        arg_0 = arg_0.split('+')[0].split('-')[0]\n    \n    arg_3 = [[]]\n    arg_4 = arg_3[0]\n    arg_5 = formula_token_matcher_rational.findall(arg_0)\n    # The set of letters in the tokens should match the set of letters\n    if arg_1:\n        arg_6 = set([j for i in arg_5 for j in i if j in letter_set])\n        arg_7 = set(i for i in arg_0 if i in letter_set)\n        if arg_7 != arg_6:\n            raise Exception('Input may not be a formula; extra letters were detected')\n    \n    for arg_8 in arg_5:\n        if arg_8 == \"(\":\n            arg_3.append([])\n            arg_4 = arg_3[-1]\n        elif arg_8 == \")\":\n            arg_9 = {}\n            for arg_10 in arg_4:\n                for arg_11, arg_12 in arg_10.items():\n                    if arg_11 in arg_9:\n                        arg_9[arg_11] = arg_9[arg_11] + arg_12\n                    else:\n                        arg_9[arg_11] = arg_12\n            arg_3.pop()\n            arg_4 = arg_3[-1]\n            arg_4.append(arg_9)\n        elif arg_8.isalpha():\n            arg_4.append({arg_8: 1})\n        else:\n            arg_13 = float(arg_8)\n            arg_14 = int(arg_13)\n            if arg_14 == arg_13:\n                arg_13 = arg_14\n            arg_4[-1] = {arg_11: arg_12*arg_13 for arg_11, arg_12 in arg_4[-1].items()}\n    arg_15 = {}\n    for arg_10 in arg_4:\n        for arg_11, arg_12 in arg_10.items():\n            if arg_11 in arg_15:\n                arg_15[arg_11] = arg_15[arg_11] + arg_12\n            else:\n                arg_15[arg_11] = arg_12\n    return arg_15", "path": "thermo/elements.py", "identifier": "nested_formula_parser", "docstring": "r'''Improved formula parser which handles braces and their multipliers, \n    as well as rational element counts.\n\n    Strips charges from the end of a formula first. Accepts repeated chemical\n    units. Performs no sanity checking that elements are actually elements.\n    As it uses regular expressions for matching, errors are mostly just ignored.\n    \n    Parameters\n    ----------\n    formula : str\n        Formula string, very simply formats only.\n    check : bool\n        If `check` is True, a simple check will be performed to determine if\n        a formula is not a formula and an exception will be raised if it is\n        not, [-]\n\n    Returns\n    -------\n    atoms : dict\n        dictionary of counts of individual atoms, indexed by symbol with\n        proper capitalization, [-]\n\n    Notes\n    -----\n    Inspired by the approach taken by CrazyMerlyn on a reddit DailyProgrammer\n    challenge, at https://www.reddit.com/r/dailyprogrammer/comments/6eerfk/20170531_challenge_317_intermediate_counting/\n\n    Examples\n    --------\n    >>> pprint(nested_formula_parser('Pd(NH3)4.0001+2'))\n    {'H': 12.0003, 'N': 4.0001, 'Pd': 1}", "docstring_tokens": ["r", "Improved", "formula", "parser", "which", "handles", "braces", "and", "their", "multipliers", "as", "well", "as", "rational", "element", "counts", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 258986}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/assembly_report.py#L284-L315", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Returns the mapping between sliding window points and their contigs,\n        and the x-axis position of contig", "language": "python", "parameters": "(self, window)", "return_statement": "return xbars", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "summary_info", ":", "arg_0", ".", "get_summary_stats", "(", ")", "arg_2", "=", "0", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "contigs", ".", "items", "(", ")", ":", "arg_6", "=", "arg_0", ".", "_get_contig_id", "(", "arg_4", ")", "arg_0", ".", "contig_boundaries", "[", "arg_6", "]", "=", "[", "arg_2", ",", "arg_2", "+", "len", "(", "arg_5", ")", "]", "arg_2", "+=", "len", "(", "arg_5", ")", "arg_3", ".", "append", "(", "(", "arg_6", ",", "arg_2", ",", "arg_4", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns the mapping between sliding window points and their contigs,\n        and the x-axis position of contig\n\n        Parameters\n        ----------\n        window : int\n            Size of the window.\n\n        Returns\n        -------\n        xbars : list\n            The x-axis position of the ending for each contig.\n        labels : list\n            The x-axis labels for each data point in the sliding window\n\n        \"\"\"\n\n        # Get summary stats, if they have not yet been triggered\n        if not arg_0.summary_info:\n            arg_0.get_summary_stats()\n\n        # Get contig boundary positon\n        arg_2 = 0\n        arg_3 = []\n        for arg_4, arg_5 in arg_0.contigs.items():\n            arg_6 = arg_0._get_contig_id(arg_4)\n            arg_0.contig_boundaries[arg_6] = [arg_2, arg_2 + len(arg_5)]\n            arg_2 += len(arg_5)\n            arg_3.append((arg_6, arg_2, arg_4))\n\n        return arg_3", "path": "flowcraft/templates/assembly_report.py", "identifier": "Assembly._get_window_labels", "docstring": "Returns the mapping between sliding window points and their contigs,\n        and the x-axis position of contig\n\n        Parameters\n        ----------\n        window : int\n            Size of the window.\n\n        Returns\n        -------\n        xbars : list\n            The x-axis position of the ending for each contig.\n        labels : list\n            The x-axis labels for each data point in the sliding window", "docstring_tokens": ["Returns", "the", "mapping", "between", "sliding", "window", "points", "and", "their", "contigs", "and", "the", "x", "-", "axis", "position", "of", "contig"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 258987}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L1065-L1088", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return the ancestors of the current node.", "language": "python", "parameters": "(self, type_: Optional[str] = None)", "return_statement": "return sorted(ancestors, key=lambda i: ss - i._span[0])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "None", ")", "->", "List", "[", "'WikiText'", "]", ":", "if", "arg_1", "is", "None", ":", "arg_4", "=", "SPAN_PARSER_TYPES", "else", ":", "arg_4", "=", "arg_1", ",", "arg_5", "=", "arg_0", ".", "_lststr", "arg_6", "=", "arg_0", ".", "_type_to_spans", "arg_7", ",", "arg_8", "=", "arg_0", ".", "_span", "Func", "=", "[", "]", "arg_10", "=", "Func", ".", "append", "for", "arg_1", "in", "arg_4", ":", "arg_11", "=", "globals", "(", ")", "[", "arg_1", "]", "arg_12", "=", "arg_6", "[", "arg_1", "]", "for", "arg_13", "in", "arg_12", "[", ":", "bisect", "(", "arg_12", ",", "[", "arg_7", "]", ")", "]", ":", "if", "arg_8", "<", "arg_13", "[", "1", "]", ":", "arg_10", "(", "arg_11", "(", "arg_5", ",", "arg_6", ",", "arg_13", ",", "arg_1", ")", ")", "return", "sorted", "(", "Func", ",", "key", "=", "lambda", "i", ":", "arg_7", "-", "i", ".", "_span", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1: arg_2[arg_3] = None) -> List['WikiText']:\n        \"\"\"Return the ancestors of the current node.\n\n        :param type_: the type of the desired ancestors as a string.\n            Currently the following types are supported: {Template,\n            ParserFunction, WikiLink, Comment, Parameter, ExtensionTag}.\n            The default is None and means all the ancestors of any type above.\n        \"\"\"\n        if arg_1 is None:\n            arg_4 = SPAN_PARSER_TYPES\n        else:\n            arg_4 = arg_1,\n        arg_5 = arg_0._lststr\n        arg_6 = arg_0._type_to_spans\n        arg_7, arg_8 = arg_0._span\n        Func = []\n        arg_10 = Func.append\n        for arg_1 in arg_4:\n            arg_11 = globals()[arg_1]\n            arg_12 = arg_6[arg_1]\n            for arg_13 in arg_12[:bisect(arg_12, [arg_7])]:\n                if arg_8 < arg_13[1]:\n                    arg_10(arg_11(arg_5, arg_6, arg_13, arg_1))\n        return sorted(Func, key=lambda i: arg_7 - i._span[0])", "path": "wikitextparser/_wikitext.py", "identifier": "SubWikiText.ancestors", "docstring": "Return the ancestors of the current node.\n\n        :param type_: the type of the desired ancestors as a string.\n            Currently the following types are supported: {Template,\n            ParserFunction, WikiLink, Comment, Parameter, ExtensionTag}.\n            The default is None and means all the ancestors of any type above.", "docstring_tokens": ["Return", "the", "ancestors", "of", "the", "current", "node", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 258988}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/__init__.py#L8-L18", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Tells you if you have an old version of ndio.", "language": "python", "parameters": "()", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "requests", "arg_0", "=", "requests", ".", "get", "(", "'https://pypi.python.org/pypi/ndio/json'", ")", ".", "json", "(", ")", "arg_0", "=", "arg_0", "[", "'info'", "]", "[", "'version'", "]", "if", "arg_0", "!=", "version", ":", "print", "(", "\"A newer version of ndio is available. \"", "+", "\"'pip install -U ndio' to update.\"", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n    Tells you if you have an old version of ndio.\n    \"\"\"\n    import requests\n    arg_0 = requests.get('https://pypi.python.org/pypi/ndio/json').json()\n    arg_0 = arg_0['info']['version']\n    if arg_0 != version:\n        print(\"A newer version of ndio is available. \" +\n              \"'pip install -U ndio' to update.\")\n    return arg_0", "path": "ndio/__init__.py", "identifier": "check_version", "docstring": "Tells you if you have an old version of ndio.", "docstring_tokens": ["Tells", "you", "if", "you", "have", "an", "old", "version", "of", "ndio", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 258989}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/connectors/textfiles/textfilesgenerator.py#L35-L41", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Implements TextFile Generator's setup method", "language": "python", "parameters": "(self, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get_partition_index", "(", ")", "arg_0", ".", "_files_to_consume", "=", "arg_0", ".", "_files", "[", "arg_2", ":", ":", "arg_1", ".", "get_num_partitions", "(", ")", "]", "arg_0", ".", "logger", ".", "info", "(", "\"TextFileSpout files to consume %s\"", "%", "arg_0", ".", "_files_to_consume", ")", "arg_0", ".", "_lines_to_consume", "=", "arg_0", ".", "_get_next_lines", "(", ")", "arg_0", ".", "_emit_count", "=", "0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Implements TextFile Generator's Func method\"\"\"\n    arg_2 = arg_1.get_partition_index()\n    arg_0._files_to_consume = arg_0._files[arg_2::arg_1.get_num_partitions()]\n    arg_0.logger.info(\"TextFileSpout files to consume %s\" % arg_0._files_to_consume)\n    arg_0._lines_to_consume = arg_0._get_next_lines()\n    arg_0._emit_count = 0", "path": "heronpy/connectors/textfiles/textfilesgenerator.py", "identifier": "TextFileGenerator.setup", "docstring": "Implements TextFile Generator's setup method", "docstring_tokens": ["Implements", "TextFile", "Generator", "s", "setup", "method"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 258990}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dag_processing.py#L946-L1020", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Print out stats about how files are getting processed.", "language": "python", "parameters": "(self, known_file_paths)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "\"File Path\"", ",", "\"PID\"", ",", "\"Runtime\"", ",", "\"Last Runtime\"", ",", "\"Last Run\"", "]", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_0", ".", "get_last_runtime", "(", "arg_4", ")", "arg_6", "=", "os", ".", "path", ".", "basename", "(", "arg_4", ")", "arg_6", "=", "os", ".", "path", ".", "splitext", "(", "arg_6", ")", "[", "0", "]", ".", "replace", "(", "os", ".", "sep", ",", "'.'", ")", "if", "arg_5", ":", "Stats", ".", "gauge", "(", "'dag_processing.last_runtime.{}'", ".", "format", "(", "arg_6", ")", ",", "arg_5", ")", "arg_7", "=", "arg_0", ".", "get_pid", "(", "arg_4", ")", "arg_8", "=", "arg_0", ".", "get_start_time", "(", "arg_4", ")", "arg_9", "=", "(", "(", "timezone", ".", "utcnow", "(", ")", "-", "arg_8", ")", ".", "total_seconds", "(", ")", "if", "arg_8", "else", "None", ")", "arg_10", "=", "arg_0", ".", "get_last_finish_time", "(", "arg_4", ")", "if", "arg_10", ":", "arg_11", "=", "(", "timezone", ".", "utcnow", "(", ")", "-", "arg_10", ")", ".", "total_seconds", "(", ")", "Stats", ".", "gauge", "(", "'dag_processing.last_run.seconds_ago.{}'", ".", "format", "(", "arg_6", ")", ",", "arg_11", ")", "arg_3", ".", "append", "(", "(", "arg_4", ",", "arg_7", ",", "arg_9", ",", "arg_5", ",", "arg_10", ")", ")", "arg_3", "=", "sorted", "(", "arg_3", ",", "key", "=", "lambda", "x", ":", "x", "[", "3", "]", "or", "0.0", ")", "arg_12", "=", "[", "]", "for", "arg_4", ",", "arg_13", ",", "arg_9", ",", "arg_5", ",", "arg_10", "in", "arg_3", ":", "arg_12", ".", "append", "(", "(", "arg_4", ",", "arg_13", ",", "\"{:.2f}s\"", ".", "format", "(", "arg_9", ")", "if", "arg_9", "else", "None", ",", "\"{:.2f}s\"", ".", "format", "(", "arg_5", ")", "if", "arg_5", "else", "None", ",", "arg_10", ".", "strftime", "(", "\"%Y-%m-%dT%H:%M:%S\"", ")", "if", "arg_10", "else", "None", ")", ")", "arg_14", "=", "(", "\"\\n\"", "+", "\"=\"", "*", "80", "+", "\"\\n\"", "+", "\"DAG File Processing Stats\\n\\n\"", "+", "tabulate", "(", "arg_12", ",", "arg_2", "=", "arg_2", ")", "+", "\"\\n\"", "+", "\"=\"", "*", "80", ")", "arg_0", ".", "log", ".", "info", "(", "arg_14", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Print out stats about how files are getting processed.\n\n        :param known_file_paths: a list of file paths that may contain Airflow\n            DAG definitions\n        :type known_file_paths: list[unicode]\n        :return: None\n        \"\"\"\n\n        # File Path: Path to the file containing the DAG definition\n        # PID: PID associated with the process that's processing the file. May\n        # be empty.\n        # Runtime: If the process is currently running, how long it's been\n        # running for in seconds.\n        # Last Runtime: If the process ran before, how long did it take to\n        # finish in seconds\n        # Last Run: When the file finished processing in the previous run.\n        arg_2 = [\"File Path\",\n                   \"PID\",\n                   \"Runtime\",\n                   \"Last Runtime\",\n                   \"Last Run\"]\n\n        arg_3 = []\n        for arg_4 in arg_1:\n            arg_5 = arg_0.get_last_runtime(arg_4)\n            arg_6 = os.path.basename(arg_4)\n            arg_6 = os.path.splitext(arg_6)[0].replace(os.sep, '.')\n            if arg_5:\n                Stats.gauge(\n                    'dag_processing.last_runtime.{}'.format(arg_6),\n                    arg_5\n                )\n\n            arg_7 = arg_0.get_pid(arg_4)\n            arg_8 = arg_0.get_start_time(arg_4)\n            arg_9 = ((timezone.utcnow() - arg_8).total_seconds()\n                       if arg_8 else None)\n            arg_10 = arg_0.get_last_finish_time(arg_4)\n            if arg_10:\n                arg_11 = (timezone.utcnow() - arg_10).total_seconds()\n                Stats.gauge(\n                    'dag_processing.last_run.seconds_ago.{}'.format(arg_6),\n                    arg_11\n                )\n\n            arg_3.append((arg_4,\n                         arg_7,\n                         arg_9,\n                         arg_5,\n                         arg_10))\n\n        # Sort by longest last runtime. (Can't sort None values in python3)\n        arg_3 = sorted(arg_3, key=lambda x: x[3] or 0.0)\n\n        arg_12 = []\n        for arg_4, arg_13, arg_9, arg_5, arg_10 in arg_3:\n            arg_12.append((arg_4,\n                                   arg_13,\n                                   \"{:.2f}s\".format(arg_9)\n                                   if arg_9 else None,\n                                   \"{:.2f}s\".format(arg_5)\n                                   if arg_5 else None,\n                                   arg_10.strftime(\"%Y-%m-%dT%H:%M:%S\")\n                                   if arg_10 else None))\n        arg_14 = (\"\\n\" +\n                   \"=\" * 80 +\n                   \"\\n\" +\n                   \"DAG File Processing Stats\\n\\n\" +\n                   tabulate(arg_12, arg_2=arg_2) +\n                   \"\\n\" +\n                   \"=\" * 80)\n\n        arg_0.log.info(arg_14)", "path": "airflow/utils/dag_processing.py", "identifier": "DagFileProcessorManager._log_file_processing_stats", "docstring": "Print out stats about how files are getting processed.\n\n        :param known_file_paths: a list of file paths that may contain Airflow\n            DAG definitions\n        :type known_file_paths: list[unicode]\n        :return: None", "docstring_tokens": ["Print", "out", "stats", "about", "how", "files", "are", "getting", "processed", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 258991}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-common/azure/common/client_factory.py#L51-L100", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Return a SDK client initialized with current CLI credentials, CLI default subscription and CLI default cloud.", "language": "python", "parameters": "(client_class, **kwargs)", "return_statement": "return _instantiate_client(client_class, **parameters)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "get_cli_active_cloud", "(", ")", "arg_3", "=", "{", "}", "if", "'credentials'", "not", "in", "arg_1", "or", "'subscription_id'", "not", "in", "arg_1", ":", "arg_4", ",", "arg_5", "=", "_client_resource", "(", "arg_0", ",", "arg_2", ")", "arg_6", ",", "arg_7", ",", "arg_8", "=", "get_azure_cli_credentials", "(", "arg_4", "=", "arg_4", ",", "with_tenant", "=", "True", ")", "arg_3", ".", "update", "(", "{", "'credentials'", ":", "arg_1", ".", "get", "(", "'credentials'", ",", "arg_6", ")", ",", "'subscription_id'", ":", "arg_1", ".", "get", "(", "'subscription_id'", ",", "arg_7", ")", "}", ")", "arg_9", "=", "get_arg_spec", "(", "arg_0", ".", "__init__", ")", ".", "args", "if", "'adla_job_dns_suffix'", "in", "arg_9", "and", "'adla_job_dns_suffix'", "not", "in", "arg_1", ":", "arg_3", "[", "'adla_job_dns_suffix'", "]", "=", "arg_2", ".", "suffixes", ".", "azure_datalake_analytics_catalog_and_job_endpoint", "elif", "'base_url'", "in", "arg_9", "and", "'base_url'", "not", "in", "arg_1", ":", "arg_5", ",", "arg_10", "=", "_client_resource", "(", "arg_0", ",", "arg_2", ")", "if", "arg_10", ":", "arg_3", "[", "'base_url'", "]", "=", "arg_10", "else", ":", "arg_3", "[", "'base_url'", "]", "=", "arg_2", ".", "endpoints", ".", "resource_manager", "if", "'tenant_id'", "in", "arg_9", "and", "'tenant_id'", "not", "in", "arg_1", ":", "arg_3", "[", "'tenant_id'", "]", "=", "arg_8", "arg_3", ".", "update", "(", "arg_1", ")", "return", "_instantiate_client", "(", "arg_0", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Return a SDK client initialized with current CLI credentials, CLI default subscription and CLI default cloud.\n\n    This method will fill automatically the following client parameters:\n    - credentials\n    - subscription_id\n    - base_url\n\n    Parameters provided in kwargs will override CLI parameters and be passed directly to the client.\n\n    :Example:\n\n    .. code:: python\n\n        from azure.common.client_factory import Func\n        from azure.mgmt.compute import ComputeManagementClient\n        client = Func(ComputeManagementClient)\n\n    .. versionadded:: 1.1.6\n\n    :param client_class: A SDK client class\n    :return: An instantiated client\n    :raises: ImportError if azure-cli-core package is not available\n    \"\"\"\n    arg_2 = get_cli_active_cloud()\n    arg_3 = {}\n    if 'credentials' not in arg_1 or 'subscription_id' not in arg_1:\n        arg_4, arg_5 = _client_resource(arg_0, arg_2)\n        arg_6, arg_7, arg_8 = get_azure_cli_credentials(arg_4=arg_4,\n                                                                            with_tenant=True)\n        arg_3.update({\n            'credentials': arg_1.get('credentials', arg_6),\n            'subscription_id': arg_1.get('subscription_id', arg_7)\n        })\n\n    arg_9 = get_arg_spec(arg_0.__init__).args\n    if 'adla_job_dns_suffix' in arg_9 and 'adla_job_dns_suffix' not in arg_1:  # Datalake\n        # Let it raise here with AttributeError at worst, this would mean this cloud does not define\n        # ADL endpoint and no manual suffix was given\n        arg_3['adla_job_dns_suffix'] = arg_2.suffixes.azure_datalake_analytics_catalog_and_job_endpoint\n    elif 'base_url' in arg_9 and 'base_url' not in arg_1:\n        arg_5, arg_10 = _client_resource(arg_0, arg_2)\n        if arg_10:\n            arg_3['base_url'] = arg_10\n        else:\n            arg_3['base_url'] = arg_2.endpoints.resource_manager\n    if 'tenant_id' in arg_9 and 'tenant_id' not in arg_1:\n        arg_3['tenant_id'] = arg_8\n    arg_3.update(arg_1)\n    return _instantiate_client(arg_0, **arg_3)", "path": "azure-common/azure/common/client_factory.py", "identifier": "get_client_from_cli_profile", "docstring": "Return a SDK client initialized with current CLI credentials, CLI default subscription and CLI default cloud.\n\n    This method will fill automatically the following client parameters:\n    - credentials\n    - subscription_id\n    - base_url\n\n    Parameters provided in kwargs will override CLI parameters and be passed directly to the client.\n\n    :Example:\n\n    .. code:: python\n\n        from azure.common.client_factory import get_client_from_cli_profile\n        from azure.mgmt.compute import ComputeManagementClient\n        client = get_client_from_cli_profile(ComputeManagementClient)\n\n    .. versionadded:: 1.1.6\n\n    :param client_class: A SDK client class\n    :return: An instantiated client\n    :raises: ImportError if azure-cli-core package is not available", "docstring_tokens": ["Return", "a", "SDK", "client", "initialized", "with", "current", "CLI", "credentials", "CLI", "default", "subscription", "and", "CLI", "default", "cloud", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 258992}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/util.py#L24-L113", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "r'''Load a .lab file as an Annotation object.", "language": "python", "parameters": "(namespace, filename, infer_duration=True, **parse_options)", "return_statement": "return annotation", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "**", "arg_3", ")", ":", "arg_4", "=", "core", ".", "Annotation", "(", "arg_0", ")", "arg_3", ".", "setdefault", "(", "'sep'", ",", "r'\\s+'", ")", "arg_3", ".", "setdefault", "(", "'engine'", ",", "'python'", ")", "arg_3", ".", "setdefault", "(", "'header'", ",", "None", ")", "arg_3", ".", "setdefault", "(", "'index_col'", ",", "False", ")", "arg_3", ".", "setdefault", "(", "'names'", ",", "range", "(", "20", ")", ")", "arg_5", "=", "pd", ".", "read_csv", "(", "arg_1", ",", "**", "arg_3", ")", "arg_5", "=", "arg_5", ".", "dropna", "(", "how", "=", "'all'", ",", "axis", "=", "1", ")", "if", "len", "(", "arg_5", ".", "columns", ")", "==", "2", ":", "arg_5", ".", "insert", "(", "1", ",", "'duration'", ",", "0", ")", "if", "arg_2", ":", "arg_5", "[", "'duration'", "]", "[", ":", "-", "1", "]", "=", "arg_5", ".", "loc", "[", ":", ",", "0", "]", ".", "diff", "(", ")", "[", "1", ":", "]", ".", "values", "else", ":", "if", "arg_2", ":", "arg_5", ".", "loc", "[", ":", ",", "1", "]", "-=", "arg_5", "[", "0", "]", "for", "arg_6", "in", "arg_5", ".", "itertuples", "(", ")", ":", "arg_7", ",", "arg_8", "=", "arg_6", "[", "1", ":", "3", "]", "arg_9", "=", "[", "x", "for", "x", "in", "arg_6", "[", "3", ":", "]", "if", "x", "is", "not", "None", "]", "[", "-", "1", "]", "arg_4", ".", "append", "(", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "confidence", "=", "1.0", ",", "arg_9", "=", "arg_9", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=True, **arg_3):\n    r'''Load a .lab file as an Annotation object.\n\n    .lab files are assumed to have the following format:\n\n        ``TIME_START\\tTIME_END\\tANNOTATION``\n\n    By default, .lab files are assumed to have columns separated by one\n    or more white-space characters, and have no header or index column\n    information.\n\n    If the .lab file contains only two columns, then an empty duration\n    field is inferred.\n\n    If the .lab file contains more than three columns, each row's\n    annotation value is assigned the contents of last non-empty column.\n\n\n    Parameters\n    ----------\n    namespace : str\n        The namespace for the new annotation\n\n    filename : str\n        Path to the .lab file\n\n    infer_duration : bool\n        If `True`, interval durations are inferred from `(start, end)` columns,\n        or difference between successive times.\n\n        If `False`, interval durations are assumed to be explicitly coded as\n        `(start, duration)` columns.  If only one time column is given, then\n        durations are set to 0.\n\n        For instantaneous event annotations (e.g., beats or onsets), this\n        should be set to `False`.\n\n    parse_options : additional keyword arguments\n        Passed to ``pandas.DataFrame.read_csv``\n\n    Returns\n    -------\n    annotation : Annotation\n        The newly constructed annotation object\n\n    See Also\n    --------\n    pandas.DataFrame.read_csv\n    '''\n\n    # Create a new annotation object\n    arg_4 = core.Annotation(arg_0)\n\n    arg_3.setdefault('sep', r'\\s+')\n    arg_3.setdefault('engine', 'python')\n    arg_3.setdefault('header', None)\n    arg_3.setdefault('index_col', False)\n\n    # This is a hack to handle potentially ragged .lab data\n    arg_3.setdefault('names', range(20))\n\n    arg_5 = pd.read_csv(arg_1, **arg_3)\n\n    # Drop all-nan columns\n    arg_5 = arg_5.dropna(how='all', axis=1)\n\n    # Do we need to add a duration column?\n    # This only applies to event annotations\n    if len(arg_5.columns) == 2:\n        # Insert a column of zeros after the timing\n        arg_5.insert(1, 'duration', 0)\n        if arg_2:\n            arg_5['duration'][:-1] = arg_5.loc[:, 0].diff()[1:].values\n\n    else:\n        # Convert from time to duration\n        if arg_2:\n            arg_5.loc[:, 1] -= arg_5[0]\n\n    for arg_6 in arg_5.itertuples():\n        arg_7, arg_8 = arg_6[1:3]\n\n        arg_9 = [x for x in arg_6[3:] if x is not None][-1]\n\n        arg_4.append(arg_7=arg_7,\n                          arg_8=arg_8,\n                          confidence=1.0,\n                          arg_9=arg_9)\n\n    return arg_4", "path": "jams/util.py", "identifier": "import_lab", "docstring": "r'''Load a .lab file as an Annotation object.\n\n    .lab files are assumed to have the following format:\n\n        ``TIME_START\\tTIME_END\\tANNOTATION``\n\n    By default, .lab files are assumed to have columns separated by one\n    or more white-space characters, and have no header or index column\n    information.\n\n    If the .lab file contains only two columns, then an empty duration\n    field is inferred.\n\n    If the .lab file contains more than three columns, each row's\n    annotation value is assigned the contents of last non-empty column.\n\n\n    Parameters\n    ----------\n    namespace : str\n        The namespace for the new annotation\n\n    filename : str\n        Path to the .lab file\n\n    infer_duration : bool\n        If `True`, interval durations are inferred from `(start, end)` columns,\n        or difference between successive times.\n\n        If `False`, interval durations are assumed to be explicitly coded as\n        `(start, duration)` columns.  If only one time column is given, then\n        durations are set to 0.\n\n        For instantaneous event annotations (e.g., beats or onsets), this\n        should be set to `False`.\n\n    parse_options : additional keyword arguments\n        Passed to ``pandas.DataFrame.read_csv``\n\n    Returns\n    -------\n    annotation : Annotation\n        The newly constructed annotation object\n\n    See Also\n    --------\n    pandas.DataFrame.read_csv", "docstring_tokens": ["r", "Load", "a", ".", "lab", "file", "as", "an", "Annotation", "object", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 258993}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/tuio/__init__.py#L96-L108", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Gets called by the CallbackManager if a new message was received", "language": "python", "parameters": "(self, *incoming)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "0", "]", "if", "arg_2", ":", "arg_3", ",", "arg_4", "=", "arg_2", "[", "0", "]", ",", "arg_2", "[", "2", "]", "arg_5", "=", "arg_0", ".", "get_profile", "(", "arg_3", ")", "if", "arg_5", "is", "not", "None", ":", "try", ":", "getattr", "(", "arg_5", ",", "arg_4", ")", "(", "arg_0", ",", "arg_2", ")", "except", "AttributeError", ":", "pass"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Gets called by the CallbackManager if a new message was received \n        \"\"\"\n        arg_2 = arg_1[0]\n        if arg_2:\n            arg_3, arg_4 = arg_2[0], arg_2[2]\n            arg_5 = arg_0.get_profile(arg_3)\n            if arg_5 is not None:\n                try:\n                    getattr(arg_5, arg_4)(arg_0, arg_2)\n                except AttributeError:\n                    pass", "path": "lib/tuio/__init__.py", "identifier": "Tracking.callback", "docstring": "Gets called by the CallbackManager if a new message was received", "docstring_tokens": ["Gets", "called", "by", "the", "CallbackManager", "if", "a", "new", "message", "was", "received"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 258994}
{"url": "https://github.com/Crypto-toolbox/btfxwss/blob/16827fa6aacb2c0e289aa852bf61a18df6905835/btfxwss/client.py#L346-L357", "sha": "16827fa6aacb2c0e289aa852bf61a18df6905835", "docstring_summary": "Cancel one or multiple orders via Websocket.", "language": "python", "parameters": "(self, multi=False, **order_identifiers)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "**", "arg_2", ")", ":", "if", "arg_1", ":", "arg_0", ".", "_send_auth_command", "(", "'oc_multi'", ",", "arg_2", ")", "else", ":", "arg_0", ".", "_send_auth_command", "(", "'oc'", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, **arg_2):\n        \"\"\"Cancel one or multiple orders via Websocket.\n\n        :param multi: bool, whether order_settings contains settings for one, or\n                      multiples orders\n        :param order_identifiers: Identifiers for the order(s) you with to cancel\n        :return:\n        \"\"\"\n        if arg_1:\n            arg_0._send_auth_command('oc_multi', arg_2)\n        else:\n            arg_0._send_auth_command('oc', arg_2)", "path": "btfxwss/client.py", "identifier": "BtfxWss.cancel_order", "docstring": "Cancel one or multiple orders via Websocket.\n\n        :param multi: bool, whether order_settings contains settings for one, or\n                      multiples orders\n        :param order_identifiers: Identifiers for the order(s) you with to cancel\n        :return:", "docstring_tokens": ["Cancel", "one", "or", "multiple", "orders", "via", "Websocket", "."], "nwo": "Crypto-toolbox/btfxwss", "score": 0.6139886433376424, "idx": 258995}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/filters.py#L229-L359", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Create a Filterbank matrix to convert STFT to chroma", "language": "python", "parameters": "(sr, n_fft, n_chroma=12, A440=440.0, ctroct=5.0,\n           octwidth=2, norm=2, base_c=True, dtype=np.float32)", "return_statement": "return np.ascontiguousarray(wts[:, :int(1 + n_fft/2)], dtype=dtype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "12", ",", "arg_3", "=", "440.0", ",", "arg_4", "=", "5.0", ",", "arg_5", "=", "2", ",", "arg_6", "=", "2", ",", "arg_7", "=", "True", ",", "arg_8", "=", "arg_9", ".", "float32", ")", ":", "arg_11", "=", "arg_9", ".", "zeros", "(", "(", "arg_2", ",", "arg_1", ")", ")", "arg_12", "=", "arg_9", ".", "linspace", "(", "0", ",", "arg_0", ",", "arg_1", ",", "endpoint", "=", "False", ")", "[", "1", ":", "]", "arg_13", "=", "arg_2", "*", "hz_to_octs", "(", "arg_12", ",", "arg_3", ")", "arg_13", "=", "arg_9", ".", "concatenate", "(", "(", "[", "arg_13", "[", "0", "]", "-", "1.5", "*", "arg_2", "]", ",", "arg_13", ")", ")", "arg_14", "=", "arg_9", ".", "concatenate", "(", "(", "arg_9", ".", "maximum", "(", "arg_13", "[", "1", ":", "]", "-", "arg_13", "[", ":", "-", "1", "]", ",", "1.0", ")", ",", "[", "1", "]", ")", ")", "arg_15", "=", "arg_9", ".", "subtract", ".", "outer", "(", "arg_13", ",", "arg_9", ".", "arange", "(", "0", ",", "arg_2", ",", "arg_8", "=", "'d'", ")", ")", ".", "T", "arg_16", "=", "arg_9", ".", "round", "(", "float", "(", "arg_2", ")", "/", "2", ")", "arg_15", "=", "arg_9", ".", "remainder", "(", "arg_15", "+", "arg_16", "+", "10", "*", "arg_2", ",", "arg_2", ")", "-", "arg_16", "arg_11", "=", "arg_9", ".", "exp", "(", "-", "0.5", "*", "(", "2", "*", "arg_15", "/", "arg_9", ".", "tile", "(", "arg_14", ",", "(", "arg_2", ",", "1", ")", ")", ")", "**", "2", ")", "arg_11", "=", "util", ".", "normalize", "(", "arg_11", ",", "arg_6", "=", "arg_6", ",", "axis", "=", "0", ")", "if", "arg_5", "is", "not", "None", ":", "arg_11", "*=", "arg_9", ".", "tile", "(", "arg_9", ".", "exp", "(", "-", "0.5", "*", "(", "(", "(", "arg_13", "/", "arg_2", "-", "arg_4", ")", "/", "arg_5", ")", "**", "2", ")", ")", ",", "(", "arg_2", ",", "1", ")", ")", "if", "arg_7", ":", "arg_11", "=", "arg_9", ".", "roll", "(", "arg_11", ",", "-", "3", ",", "axis", "=", "0", ")", "return", "arg_9", ".", "ascontiguousarray", "(", "arg_11", "[", ":", ",", ":", "int", "(", "1", "+", "arg_1", "/", "2", ")", "]", ",", "arg_8", "=", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2=12, arg_3=440.0, arg_4=5.0,\n           arg_5=2, arg_6=2, arg_7=True, arg_8=arg_9.float32):\n    \"\"\"Create a Filterbank matrix to convert STFT to Func\n\n\n    Parameters\n    ----------\n    sr        : number > 0 [scalar]\n        audio sampling rate\n\n    n_fft     : int > 0 [scalar]\n        number of FFT bins\n\n    n_Func  : int > 0 [scalar]\n        number of Func bins\n\n    A440      : float > 0 [scalar]\n        Reference frequency for A440\n\n    ctroct    : float > 0 [scalar]\n\n    octwidth  : float > 0 or None [scalar]\n        `ctroct` and `octwidth` specify a dominance window -\n        a Gaussian weighting centered on `ctroct` (in octs, A0 = 27.5Hz)\n        and with a gaussian half-width of `octwidth`.\n        Set `octwidth` to `None` to use a flat weighting.\n\n    norm : float > 0 or np.inf\n        Normalization factor for each filter\n\n    base_c : bool\n        If True, the filter bank will start at 'C'.\n        If False, the filter bank will start at 'A'.\n\n    dtype : np.dtype\n        The data type of the output basis.\n        By default, uses 32-bit (single-precision) floating point.\n\n    Returns\n    -------\n    wts : ndarray [shape=(n_Func, 1 + n_fft / 2)]\n        Chroma filter matrix\n\n    See Also\n    --------\n    util.normalize\n    feature.Func_stft\n\n    Notes\n    -----\n    This function caches at level 10.\n\n    Examples\n    --------\n    Build a simple Func filter bank\n\n    >>> Funcfb = librosa.filters.Func(22050, 4096)\n    array([[  1.689e-05,   3.024e-04, ...,   4.639e-17,   5.327e-17],\n           [  1.716e-05,   2.652e-04, ...,   2.674e-25,   3.176e-25],\n    ...,\n           [  1.578e-05,   3.619e-04, ...,   8.577e-06,   9.205e-06],\n           [  1.643e-05,   3.355e-04, ...,   1.474e-10,   1.636e-10]])\n\n    Use quarter-tones instead of semitones\n\n    >>> librosa.filters.Func(22050, 4096, n_Func=24)\n    array([[  1.194e-05,   2.138e-04, ...,   6.297e-64,   1.115e-63],\n           [  1.206e-05,   2.009e-04, ...,   1.546e-79,   2.929e-79],\n    ...,\n           [  1.162e-05,   2.372e-04, ...,   6.417e-38,   9.923e-38],\n           [  1.180e-05,   2.260e-04, ...,   4.697e-50,   7.772e-50]])\n\n\n    Equally weight all octaves\n\n    >>> librosa.filters.Func(22050, 4096, octwidth=None)\n    array([[  3.036e-01,   2.604e-01, ...,   2.445e-16,   2.809e-16],\n           [  3.084e-01,   2.283e-01, ...,   1.409e-24,   1.675e-24],\n    ...,\n           [  2.836e-01,   3.116e-01, ...,   4.520e-05,   4.854e-05],\n           [  2.953e-01,   2.888e-01, ...,   7.768e-10,   8.629e-10]])\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> librosa.display.specshow(Funcfb, x_axis='linear')\n    >>> plt.ylabel('Chroma filter')\n    >>> plt.title('Chroma filter bank')\n    >>> plt.colorbar()\n    >>> plt.tight_layout()\n    \"\"\"\n\n    arg_11 = arg_9.zeros((arg_2, arg_1))\n\n    # Get the FFT bins, not counting the DC component\n    arg_12 = arg_9.linspace(0, arg_0, arg_1, endpoint=False)[1:]\n\n    arg_13 = arg_2 * hz_to_octs(arg_12, arg_3)\n\n    # make up a value for the 0 Hz bin = 1.5 octaves below bin 1\n    # (so Func is 50% rotated from bin 1, and bin width is broad)\n    arg_13 = arg_9.concatenate(([arg_13[0] - 1.5 * arg_2], arg_13))\n\n    arg_14 = arg_9.concatenate((arg_9.maximum(arg_13[1:] - arg_13[:-1],\n                                              1.0), [1]))\n\n    arg_15 = arg_9.subtract.outer(arg_13, arg_9.arange(0, arg_2, arg_8='d')).T\n\n    arg_16 = arg_9.round(float(arg_2) / 2)\n\n    # Project into range -n_Func/2 .. n_Func/2\n    # add on fixed offset of 10*n_Func to ensure all values passed to\n    # rem are positive\n    arg_15 = arg_9.remainder(arg_15 + arg_16 + 10*arg_2, arg_2) - arg_16\n\n    # Gaussian bumps - 2*D to make them narrower\n    arg_11 = arg_9.exp(-0.5 * (2*arg_15 / arg_9.tile(arg_14, (arg_2, 1)))**2)\n\n    # normalize each column\n    arg_11 = util.normalize(arg_11, arg_6=arg_6, axis=0)\n\n    # Maybe apply scaling for fft bins\n    if arg_5 is not None:\n        arg_11 *= arg_9.tile(\n            arg_9.exp(-0.5 * (((arg_13/arg_2 - arg_4)/arg_5)**2)),\n            (arg_2, 1))\n\n    if arg_7:\n        arg_11 = arg_9.roll(arg_11, -3, axis=0)\n\n    # remove aliasing columns, copy to ensure row-contiguity\n    return arg_9.ascontiguousarray(arg_11[:, :int(1 + arg_1/2)], arg_8=arg_8)", "path": "librosa/filters.py", "identifier": "chroma", "docstring": "Create a Filterbank matrix to convert STFT to chroma\n\n\n    Parameters\n    ----------\n    sr        : number > 0 [scalar]\n        audio sampling rate\n\n    n_fft     : int > 0 [scalar]\n        number of FFT bins\n\n    n_chroma  : int > 0 [scalar]\n        number of chroma bins\n\n    A440      : float > 0 [scalar]\n        Reference frequency for A440\n\n    ctroct    : float > 0 [scalar]\n\n    octwidth  : float > 0 or None [scalar]\n        `ctroct` and `octwidth` specify a dominance window -\n        a Gaussian weighting centered on `ctroct` (in octs, A0 = 27.5Hz)\n        and with a gaussian half-width of `octwidth`.\n        Set `octwidth` to `None` to use a flat weighting.\n\n    norm : float > 0 or np.inf\n        Normalization factor for each filter\n\n    base_c : bool\n        If True, the filter bank will start at 'C'.\n        If False, the filter bank will start at 'A'.\n\n    dtype : np.dtype\n        The data type of the output basis.\n        By default, uses 32-bit (single-precision) floating point.\n\n    Returns\n    -------\n    wts : ndarray [shape=(n_chroma, 1 + n_fft / 2)]\n        Chroma filter matrix\n\n    See Also\n    --------\n    util.normalize\n    feature.chroma_stft\n\n    Notes\n    -----\n    This function caches at level 10.\n\n    Examples\n    --------\n    Build a simple chroma filter bank\n\n    >>> chromafb = librosa.filters.chroma(22050, 4096)\n    array([[  1.689e-05,   3.024e-04, ...,   4.639e-17,   5.327e-17],\n           [  1.716e-05,   2.652e-04, ...,   2.674e-25,   3.176e-25],\n    ...,\n           [  1.578e-05,   3.619e-04, ...,   8.577e-06,   9.205e-06],\n           [  1.643e-05,   3.355e-04, ...,   1.474e-10,   1.636e-10]])\n\n    Use quarter-tones instead of semitones\n\n    >>> librosa.filters.chroma(22050, 4096, n_chroma=24)\n    array([[  1.194e-05,   2.138e-04, ...,   6.297e-64,   1.115e-63],\n           [  1.206e-05,   2.009e-04, ...,   1.546e-79,   2.929e-79],\n    ...,\n           [  1.162e-05,   2.372e-04, ...,   6.417e-38,   9.923e-38],\n           [  1.180e-05,   2.260e-04, ...,   4.697e-50,   7.772e-50]])\n\n\n    Equally weight all octaves\n\n    >>> librosa.filters.chroma(22050, 4096, octwidth=None)\n    array([[  3.036e-01,   2.604e-01, ...,   2.445e-16,   2.809e-16],\n           [  3.084e-01,   2.283e-01, ...,   1.409e-24,   1.675e-24],\n    ...,\n           [  2.836e-01,   3.116e-01, ...,   4.520e-05,   4.854e-05],\n           [  2.953e-01,   2.888e-01, ...,   7.768e-10,   8.629e-10]])\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure()\n    >>> librosa.display.specshow(chromafb, x_axis='linear')\n    >>> plt.ylabel('Chroma filter')\n    >>> plt.title('Chroma filter bank')\n    >>> plt.colorbar()\n    >>> plt.tight_layout()", "docstring_tokens": ["Create", "a", "Filterbank", "matrix", "to", "convert", "STFT", "to", "chroma"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 258996}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/rand.py#L50-L70", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Return a random float", "language": "python", "parameters": "(a, b=None)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "arg_0", "arg_3", "=", "0.0", "else", ":", "arg_3", "=", "arg_0", "arg_2", "=", "arg_1", "arg_4", "=", "arg_2", "-", "arg_3", "arg_5", "=", "_random", "(", ")", "arg_5", "*=", "arg_4", "arg_5", "+=", "arg_3", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Return a random float\n\n    :param float a: Either the minimum value (inclusive) if ``b`` is set, or\n    the maximum value if ``b`` is not set (non-inclusive, in which case the minimum\n    is implicitly 0.0)\n    :param float b: The maximum value to generate (non-inclusive)\n    :returns: float\n    \"\"\"\n    if arg_1 is None:\n        arg_2 = arg_0\n        arg_3 = 0.0\n    else:\n        arg_3 = arg_0\n        arg_2 = arg_1\n\n    arg_4 = arg_2 - arg_3\n    arg_5 = _random()\n    arg_5 *= arg_4\n    arg_5 += arg_3\n    return arg_5", "path": "gramfuzz/gramfuzz/rand.py", "identifier": "randfloat", "docstring": "Return a random float\n\n    :param float a: Either the minimum value (inclusive) if ``b`` is set, or\n    the maximum value if ``b`` is not set (non-inclusive, in which case the minimum\n    is implicitly 0.0)\n    :param float b: The maximum value to generate (non-inclusive)\n    :returns: float", "docstring_tokens": ["Return", "a", "random", "float"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 258997}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L529-L545", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Determines if a virtual machine instance exists.", "language": "python", "parameters": "(name=None, group=None, release=None, except_release=None, verbose=1)", "return_statement": "return instances", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "1", ")", ":", "arg_4", "=", "int", "(", "arg_4", ")", "arg_5", "=", "list_instances", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "show", "=", "arg_4", ")", "arg_6", "=", "bool", "(", "arg_5", ")", "if", "arg_4", ":", "print", "(", "'\\ninstance %s exist'", "%", "(", "'DOES'", "if", "arg_6", "else", "'does NOT'", ")", ")", "return", "arg_5"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3=None, arg_4=1):\n    \"\"\"\n    Determines if a virtual machine instance Func.\n    \"\"\"\n    arg_4 = int(arg_4)\n    arg_5 = list_instances(\n        arg_0=arg_0,\n        arg_1=arg_1,\n        arg_2=arg_2,\n        arg_3=arg_3,\n        arg_4=arg_4,\n        show=arg_4)\n    arg_6 = bool(arg_5)\n    if arg_4:\n        print('\\ninstance %s exist' % ('DOES' if arg_6 else 'does NOT'))\n    #return ret\n    return arg_5", "path": "burlap/vm.py", "identifier": "exists", "docstring": "Determines if a virtual machine instance exists.", "docstring_tokens": ["Determines", "if", "a", "virtual", "machine", "instance", "exists", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 258998}
{"url": "https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/ext.py#L29-L38", "sha": "ae92367978f2e1e96634685bd296f0fd92b4da54", "docstring_summary": "List of export formats.", "language": "python", "parameters": "(self, pid_type)", "return_statement": "return self._export_formats[pid_type]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_Func", ":", "arg_2", "=", "arg_0", ".", "app", ".", "config", ".", "get", "(", "'RECORDS_UI_EXPORT_FORMATS'", ",", "{", "}", ")", ".", "get", "(", "arg_1", ",", "{", "}", ")", "arg_0", ".", "_Func", "[", "arg_1", "]", "=", "sorted", "(", "[", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "arg_2", ".", "items", "(", ")", "if", "v", "]", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", "[", "'order'", "]", ",", ")", "return", "arg_0", ".", "_Func", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"List of export formats.\"\"\"\n        if arg_1 not in arg_0._Func:\n            arg_2 = arg_0.app.config.get('RECORDS_UI_EXPORT_FORMATS', {}).get(\n                arg_1, {})\n            arg_0._Func[arg_1] = sorted(\n                [(k, v) for k, v in arg_2.items() if v],\n                key=lambda x: x[1]['order'],\n            )\n        return arg_0._Func[arg_1]", "path": "invenio_records_ui/ext.py", "identifier": "_RecordUIState.export_formats", "docstring": "List of export formats.", "docstring_tokens": ["List", "of", "export", "formats", "."], "nwo": "inveniosoftware/invenio-records-ui", "score": 0.18439204313697477, "idx": 258999}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L144-L147", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Stops the player, if playing.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "await", "arg_0", ".", "_lavalink", ".", "ws", ".", "send", "(", "op", "=", "'Func'", ",", "guildId", "=", "arg_0", ".", "guild_id", ")", "arg_0", ".", "current", "=", "None"], "function": "async def Func(arg_0):\r\n        \"\"\" Stops the player, if playing. \"\"\"\r\n        await arg_0._lavalink.ws.send(op='Func', guildId=arg_0.guild_id)\r\n        arg_0.current = None", "path": "lavalink/PlayerManager.py", "identifier": "DefaultPlayer.stop", "docstring": "Stops the player, if playing.", "docstring_tokens": ["Stops", "the", "player", "if", "playing", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 259000}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L174-L217", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Authenticate with Google.", "language": "python", "parameters": "(credentials_prompt, refresh_token_cache, manual_login=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "with", "requests", ".", "Session", "(", ")", "as", "arg_3", ":", "arg_3", ".", "headers", "=", "{", "'user-agent'", ":", "USER_AGENT", "}", "try", ":", "logger", ".", "info", "(", "'Authenticating with refresh token'", ")", "arg_5", "=", "arg_1", ".", "get", "(", ")", "if", "arg_5", "is", "None", ":", "raise", "GoogleAuthError", "(", "\"Refresh token not found\"", ")", "arg_6", "=", "_auth_with_refresh_token", "(", "arg_3", ",", "arg_5", ")", "except", "GoogleAuthError", "as", "e", ":", "logger", ".", "info", "(", "'Failed to authenticate using refresh token: %s'", ",", "e", ")", "logger", ".", "info", "(", "'Authenticating with credentials'", ")", "if", "arg_2", ":", "arg_7", "=", "(", "arg_0", ".", "Funcorization_code", "(", ")", ")", "else", ":", "arg_7", "=", "_Funcorization_code", "(", "arg_3", ",", "arg_0", ")", "arg_6", ",", "arg_5", "=", "_auth_with_code", "(", "arg_3", ",", "arg_7", ")", "arg_1", ".", "set", "(", "arg_5", ")", "logger", ".", "info", "(", "'Authentication successful'", ")", "return", "_get_session_cookies", "(", "arg_3", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"Authenticate with Google.\n\n    Args:\n        refresh_token_cache (RefreshTokenCache): Cache to use so subsequent\n            logins may not require credentials.\n        credentials_prompt (CredentialsPrompt): Prompt to use if credentials\n            are required to log in.\n        manual_login (bool): If true, prompt user to log in through a browser\n            and enter authorization code manually. Defaults to false.\n\n    Returns:\n        dict: Google session cookies.\n\n    Raises:\n        GoogleAuthError: If authentication with Google fails.\n    \"\"\"\n    with requests.Session() as arg_3:\n        arg_3.headers = {'user-agent': USER_AGENT}\n\n        try:\n            logger.info('Authenticating with refresh token')\n            arg_5 = arg_1.get()\n            if arg_5 is None:\n                raise GoogleAuthError(\"Refresh token not found\")\n            arg_6 = _auth_with_refresh_token(arg_3, arg_5)\n        except GoogleAuthError as e:\n            logger.info('Failed to authenticate using refresh token: %s', e)\n            logger.info('Authenticating with credentials')\n            if arg_2:\n                arg_7 = (\n                    arg_0.Funcorization_code()\n                )\n            else:\n                arg_7 = _Funcorization_code(\n                    arg_3, arg_0\n                )\n            arg_6, arg_5 = _auth_with_code(\n                arg_3, arg_7\n            )\n            arg_1.set(arg_5)\n\n        logger.info('Authentication successful')\n        return _get_session_cookies(arg_3, arg_6)", "path": "hangups/auth.py", "identifier": "get_auth", "docstring": "Authenticate with Google.\n\n    Args:\n        refresh_token_cache (RefreshTokenCache): Cache to use so subsequent\n            logins may not require credentials.\n        credentials_prompt (CredentialsPrompt): Prompt to use if credentials\n            are required to log in.\n        manual_login (bool): If true, prompt user to log in through a browser\n            and enter authorization code manually. Defaults to false.\n\n    Returns:\n        dict: Google session cookies.\n\n    Raises:\n        GoogleAuthError: If authentication with Google fails.", "docstring_tokens": ["Authenticate", "with", "Google", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259001}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1226-L1252", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Remove all secondary linked files that match all the criteria,\n        criterias that are ``None`` are ignored.", "language": "python", "parameters": "(self, file_path=None, relpath=None,\n                                      mimetype=None, time_origin=None,\n                                      assoc_with=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "for", "arg_6", "in", "arg_0", ".", "linked_file_descriptors", "[", ":", "]", ":", "if", "arg_1", "is", "not", "None", "and", "arg_6", "[", "'LINK_URL'", "]", "!=", "arg_1", ":", "continue", "if", "arg_2", "is", "not", "None", "and", "arg_6", "[", "'RELATIVE_LINK_URL'", "]", "!=", "arg_2", ":", "continue", "if", "arg_3", "is", "not", "None", "and", "arg_6", "[", "'MIME_TYPE'", "]", "!=", "arg_3", ":", "continue", "if", "arg_4", "is", "not", "None", "and", "arg_6", "[", "'TIME_ORIGIN'", "]", "!=", "arg_4", ":", "continue", "if", "arg_5", "is", "not", "None", "and", "arg_6", "[", "'ASSOCIATED_WITH'", "]", "!=", "arg_5", ":", "continue", "del", "(", "arg_0", ".", "linked_file_descriptors", "[", "arg_0", ".", "linked_file_descriptors", ".", "index", "(", "arg_6", ")", "]", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None,\n                                      arg_3=None, arg_4=None,\n                                      arg_5=None):\n        \"\"\"Remove all secondary linked files that match all the criteria,\n        criterias that are ``None`` are ignored.\n\n        :param str file_path: Path of the file.\n        :param str relpath: Relative filepath.\n        :param str mimetype: Mimetype of the file.\n        :param int time_origin: Time origin.\n        :param str ex_from: Extracted from.\n        \"\"\"\n        for arg_6 in arg_0.linked_file_descriptors[:]:\n            if arg_1 is not None and arg_6['LINK_URL'] != arg_1:\n                continue\n            if arg_2 is not None and arg_6['RELATIVE_LINK_URL'] != arg_2:\n                continue\n            if arg_3 is not None and arg_6['MIME_TYPE'] != arg_3:\n                continue\n            if arg_4 is not None and\\\n                    arg_6['TIME_ORIGIN'] != arg_4:\n                continue\n            if arg_5 is not None and\\\n                    arg_6['ASSOCIATED_WITH'] != arg_5:\n                continue\n            del(arg_0.linked_file_descriptors[\n                arg_0.linked_file_descriptors.index(arg_6)])", "path": "pympi/Elan.py", "identifier": "Eaf.remove_secondary_linked_files", "docstring": "Remove all secondary linked files that match all the criteria,\n        criterias that are ``None`` are ignored.\n\n        :param str file_path: Path of the file.\n        :param str relpath: Relative filepath.\n        :param str mimetype: Mimetype of the file.\n        :param int time_origin: Time origin.\n        :param str ex_from: Extracted from.", "docstring_tokens": ["Remove", "all", "secondary", "linked", "files", "that", "match", "all", "the", "criteria", "criterias", "that", "are", "None", "are", "ignored", "."], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 259002}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1348-L1371", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Randomly resolve ambiguous bases. This is applied to each boot\n    replicate so that over reps the random resolutions don't matter.\n    Sites are randomly resolved, so best for unlinked SNPs since \n    otherwise linked SNPs are losing their linkage information... \n    though it's not like we're using it anyways.", "language": "python", "parameters": "(tmpseq)", "return_statement": "return tmpseq", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "xrange", "(", "6", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "GETCONS", "[", "arg_1", "]", "arg_5", ",", "arg_6", "=", "np", ".", "where", "(", "arg_0", "==", "arg_2", ")", "arg_7", "=", "np", ".", "random", ".", "choice", "(", "np", ".", "array", "(", "[", "True", ",", "False", "]", ")", ",", "arg_5", ".", "shape", "[", "0", "]", ")", "for", "arg_8", "in", "xrange", "(", "arg_5", ".", "shape", "[", "0", "]", ")", ":", "if", "arg_7", "[", "arg_8", "]", ":", "arg_0", "[", "arg_5", "[", "arg_8", "]", ",", "arg_6", "[", "arg_8", "]", "]", "=", "arg_3", "else", ":", "arg_0", "[", "arg_5", "[", "arg_8", "]", ",", "arg_6", "[", "arg_8", "]", "]", "=", "arg_4", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\" \n    Randomly resolve ambiguous bases. This is applied to each boot\n    replicate so that over reps the random resolutions don't matter.\n    Sites are randomly resolved, so best for unlinked SNPs since \n    otherwise linked SNPs are losing their linkage information... \n    though it's not like we're using it anyways.\n    \"\"\"\n\n    ## the order of rows in GETCONS\n    for arg_1 in xrange(6):\n        #np.uint([82, 75, 83, 89, 87, 77]):\n        arg_2, arg_3, arg_4 = GETCONS[arg_1]\n\n        ## get true wherever tmpseq is ambig\n        arg_5, arg_6 = np.where(arg_0 == arg_2)\n        arg_7 = np.random.choice(np.array([True, False]), arg_5.shape[0])\n\n        for arg_8 in xrange(arg_5.shape[0]):\n            if arg_7[arg_8]:\n                arg_0[arg_5[arg_8], arg_6[arg_8]] = arg_3\n            else:\n                arg_0[arg_5[arg_8], arg_6[arg_8]] = arg_4\n    return arg_0", "path": "ipyrad/analysis/tetrad2.py", "identifier": "resolve_ambigs", "docstring": "Randomly resolve ambiguous bases. This is applied to each boot\n    replicate so that over reps the random resolutions don't matter.\n    Sites are randomly resolved, so best for unlinked SNPs since \n    otherwise linked SNPs are losing their linkage information... \n    though it's not like we're using it anyways.", "docstring_tokens": ["Randomly", "resolve", "ambiguous", "bases", ".", "This", "is", "applied", "to", "each", "boot", "replicate", "so", "that", "over", "reps", "the", "random", "resolutions", "don", "t", "matter", ".", "Sites", "are", "randomly", "resolved", "so", "best", "for", "unlinked", "SNPs", "since", "otherwise", "linked", "SNPs", "are", "losing", "their", "linkage", "information", "...", "though", "it", "s", "not", "like", "we", "re", "using", "it", "anyways", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 259003}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeregression.py#L147-L176", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "recursion to calculate inverse covariance matrix", "language": "python", "parameters": "(self, full_matrix=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "for", "arg_2", "in", "arg_0", ".", "tree", ".", "get_nonterminals", "(", "order", "=", "'postorder'", ")", ":", "arg_3", "=", "len", "(", "arg_2", ".", "_ii", ")", "if", "arg_1", ":", "arg_4", "=", "np", ".", "zeros", "(", "(", "arg_3", ",", "arg_3", ")", ",", "dtype", "=", "float", ")", "arg_5", "=", "np", ".", "zeros", "(", "arg_3", ",", "dtype", "=", "float", ")", "arg_6", "=", "0", "for", "arg_7", "in", "arg_2", ":", "arg_8", "=", "arg_0", ".", "branch_variance", "(", "arg_7", ")", "arg_9", "=", "len", "(", "arg_7", ".", "_ii", ")", "if", "arg_7", ".", "is_terminal", "(", ")", ":", "if", "arg_1", ":", "arg_4", "[", "arg_6", ",", "arg_6", "]", "=", "1.0", "/", "arg_8", "arg_5", "[", "arg_6", "]", "=", "1.0", "/", "arg_8", "else", ":", "if", "arg_1", ":", "arg_4", "[", "arg_6", ":", "arg_6", "+", "arg_9", ",", "arg_6", ":", "arg_6", "+", "arg_9", "]", "=", "arg_7", ".", "cinv", "-", "arg_8", "*", "np", ".", "outer", "(", "arg_7", ".", "r", ",", "arg_7", ".", "r", ")", "/", "(", "1", "+", "arg_8", "*", "arg_7", ".", "s", ")", "arg_5", "[", "arg_6", ":", "arg_6", "+", "arg_9", "]", "=", "arg_7", ".", "r", "/", "(", "1", "+", "arg_8", "*", "arg_7", ".", "s", ")", "arg_6", "+=", "arg_9", "if", "arg_1", ":", "arg_2", ".", "cinv", "=", "arg_4", "arg_2", ".", "r", "=", "arg_5", "arg_2", ".", "s", "=", "arg_2", ".", "r", ".", "sum", "(", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        recursion to calculate inverse covariance matrix\n\n        Parameters\n        ----------\n        full_matrix : bool, optional\n            if True, the entire inverse matrix is calculated. otherwise, only the weighing vector.\n        \"\"\"\n        for arg_2 in arg_0.tree.get_nonterminals(order='postorder'):\n            arg_3 = len(arg_2._ii)\n            if arg_1: arg_4 = np.zeros((arg_3, arg_3), dtype=float)\n            arg_5 = np.zeros(arg_3, dtype=float)\n            arg_6 = 0\n            for arg_7 in arg_2:\n                arg_8 = arg_0.branch_variance(arg_7)\n                arg_9 = len(arg_7._ii)\n                if arg_7.is_terminal():\n                    if arg_1:\n                        arg_4[arg_6, arg_6] = 1.0/arg_8\n                    arg_5[arg_6] = 1.0/arg_8\n                else:\n                    if arg_1:\n                        arg_4[arg_6:arg_6+arg_9, arg_6:arg_6+arg_9] = arg_7.cinv - arg_8*np.outer(arg_7.r,arg_7.r)/(1+arg_8*arg_7.s)\n                    arg_5[arg_6:arg_6+arg_9] = arg_7.r/(1+arg_8*arg_7.s)\n                arg_6 += arg_9\n\n            if arg_1: arg_2.cinv = arg_4\n            arg_2.r = arg_5 #M.sum(axis=1)\n            arg_2.s = arg_2.r.sum()", "path": "treetime/treeregression.py", "identifier": "TreeRegression.recurse", "docstring": "recursion to calculate inverse covariance matrix\n\n        Parameters\n        ----------\n        full_matrix : bool, optional\n            if True, the entire inverse matrix is calculated. otherwise, only the weighing vector.", "docstring_tokens": ["recursion", "to", "calculate", "inverse", "covariance", "matrix"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 259004}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L253-L291", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Process a received ACK packet.", "language": "python", "parameters": "(self, pkt)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isack", "(", "arg_1", ")", ":", "try", ":", "arg_0", ".", "event", "=", "arg_0", ".", "client", ".", "handle_ack", "(", "arg_1", ",", "arg_0", ".", "time_sent_request", ")", "except", "AddrFormatError", "as", "err", ":", "logger", ".", "error", "(", "err", ")", "raise", "arg_0", ".", "SELECTING", "(", ")", "logger", ".", "info", "(", "'DHCPACK of %s from %s'", "%", "(", "arg_0", ".", "client", ".", "client_ip", ",", "arg_0", ".", "client", ".", "server_ip", ")", ")", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process a received ACK packet.\n\n        Not specifiyed in [:rfc:`7844`].\n        Probe the offered IP in [:rfc:`2131#section-2.2.`]::\n\n            the allocating\n            server SHOULD probe the reused address before allocating the\n            address, e.g., with an ICMP echo request, and the client SHOULD\n            probe the newly received address, e.g., with ARP.\n\n            The client SHOULD broadcast an ARP\n            reply to announce the client's new IP address and clear any\n            outdated ARP cache entries in hosts on the client's subnet.\n\n        It is also not specifiyed in [:rfc:`7844`] nor [:rfc:`2131`] how to\n        check that the offered IP is valid.\n\n        .. todo::\n           - Check that nor ``dhclient`` nor ``systemd-networkd`` send an ARP.\n           - Check how other implementations check that the ACK paremeters\n             are valid, ie, if the ACK fields match the fields in the OFFER.\n           - Check to which state the client should go back to when the\n             offered parameters are not valid.\n\n        \"\"\"\n        if isack(arg_1):\n            try:\n                arg_0.event = arg_0.client.handle_ack(arg_1,\n                                                    arg_0.time_sent_request)\n            except AddrFormatError as err:\n                logger.error(err)\n                # NOTE: see previous TODO, maybe should go back to other state.\n                raise arg_0.SELECTING()\n            # NOTE: see previous TODO, not checking address with ARP.\n            logger.info('DHCPACK of %s from %s' %\n                        (arg_0.client.client_ip, arg_0.client.server_ip))\n            return True\n        return False", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.process_received_ack", "docstring": "Process a received ACK packet.\n\n        Not specifiyed in [:rfc:`7844`].\n        Probe the offered IP in [:rfc:`2131#section-2.2.`]::\n\n            the allocating\n            server SHOULD probe the reused address before allocating the\n            address, e.g., with an ICMP echo request, and the client SHOULD\n            probe the newly received address, e.g., with ARP.\n\n            The client SHOULD broadcast an ARP\n            reply to announce the client's new IP address and clear any\n            outdated ARP cache entries in hosts on the client's subnet.\n\n        It is also not specifiyed in [:rfc:`7844`] nor [:rfc:`2131`] how to\n        check that the offered IP is valid.\n\n        .. todo::\n           - Check that nor ``dhclient`` nor ``systemd-networkd`` send an ARP.\n           - Check how other implementations check that the ACK paremeters\n             are valid, ie, if the ACK fields match the fields in the OFFER.\n           - Check to which state the client should go back to when the\n             offered parameters are not valid.", "docstring_tokens": ["Process", "a", "received", "ACK", "packet", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 259005}
{"url": "https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_orderedbase.py#L288-L296", "sha": "1a1ba9758651aed9c4f58384eff006d2e2ad6835", "docstring_summary": "Order-sensitive equality check.", "language": "python", "parameters": "(self, other)", "return_statement": "return all(i == j for (i, j) in izip(iteritems(self), iteritems(other)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "Mapping", ")", "or", "len", "(", "arg_0", ")", "!=", "len", "(", "arg_1", ")", ":", "return", "False", "return", "all", "(", "arg_2", "==", "arg_3", "for", "(", "arg_2", ",", "arg_3", ")", "in", "izip", "(", "iteritems", "(", "arg_0", ")", ",", "iteritems", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Order-sensitive equality check.\n\n        *See also* :ref:`eq-order-insensitive`\n        \"\"\"\n        # Same short-circuit as BidictBase.__eq__. Factoring out not worth function call overhead.\n        if not isinstance(arg_1, Mapping) or len(arg_0) != len(arg_1):\n            return False\n        return all(arg_2 == arg_3 for (arg_2, arg_3) in izip(iteritems(arg_0), iteritems(arg_1)))", "path": "bidict/_orderedbase.py", "identifier": "OrderedBidictBase.equals_order_sensitive", "docstring": "Order-sensitive equality check.\n\n        *See also* :ref:`eq-order-insensitive`", "docstring_tokens": ["Order", "-", "sensitive", "equality", "check", "."], "nwo": "jab/bidict", "score": 0.5840682608785344, "idx": 259006}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L190-L215", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augment batches from a generator in a way that does not guarantee to preserve order.", "language": "python", "parameters": "(self, batches, chunksize=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "assert", "ia", ".", "is_generator", "(", "arg_1", ")", ",", "(", "\"Expected to get a generator as 'batches', got type %s. \"", "+", "\"Call map_batches() if you use lists.\"", ")", "%", "(", "type", "(", "arg_1", ")", ",", ")", "arg_3", "=", "arg_0", ".", "pool", ".", "imap_unordered", "(", "_Pool_starworker", ",", "arg_0", ".", "_handle_batch_ids_gen", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "yield", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=1):\n        \"\"\"\n        Augment batches from a generator in a way that does not guarantee to preserve order.\n\n        Parameters\n        ----------\n        batches : generator of imgaug.augmentables.batches.Batch\n            The batches to augment, provided as a generator. Each call to the generator should yield exactly one\n            batch.\n\n        chunksize : None or int, optional\n            Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve\n            performance.\n\n        Yields\n        ------\n        imgaug.augmentables.batches.Batch\n            Augmented batch.\n\n        \"\"\"\n        assert ia.is_generator(arg_1), (\"Expected to get a generator as 'batches', got type %s. \"\n                                          + \"Call map_batches() if you use lists.\") % (type(arg_1),)\n        # TODO change this to 'yield from' once switched to 3.3+\n        arg_3 = arg_0.pool.imap_unordered(_Pool_starworker, arg_0._handle_batch_ids_gen(arg_1), arg_2=arg_2)\n        for arg_4 in arg_3:\n            yield arg_4", "path": "imgaug/multicore.py", "identifier": "Pool.imap_batches_unordered", "docstring": "Augment batches from a generator in a way that does not guarantee to preserve order.\n\n        Parameters\n        ----------\n        batches : generator of imgaug.augmentables.batches.Batch\n            The batches to augment, provided as a generator. Each call to the generator should yield exactly one\n            batch.\n\n        chunksize : None or int, optional\n            Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve\n            performance.\n\n        Yields\n        ------\n        imgaug.augmentables.batches.Batch\n            Augmented batch.", "docstring_tokens": ["Augment", "batches", "from", "a", "generator", "in", "a", "way", "that", "does", "not", "guarantee", "to", "preserve", "order", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259007}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L275-L282", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Returns a Certificate object by its ID.", "language": "python", "parameters": "(self, id)", "return_statement": "return Certificate.get_object(api_token=self.token, cert_id=id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Certificate", ".", "get_object", "(", "api_token", "=", "arg_0", ".", "token", ",", "cert_id", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Returns a Certificate object by its ID.\n\n            Args:\n                id (str): Certificate ID\n        \"\"\"\n        return Certificate.get_object(api_token=arg_0.token, cert_id=arg_1)", "path": "digitalocean/Manager.py", "identifier": "Manager.get_certificate", "docstring": "Returns a Certificate object by its ID.\n\n            Args:\n                id (str): Certificate ID", "docstring_tokens": ["Returns", "a", "Certificate", "object", "by", "its", "ID", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 259008}
{"url": "https://github.com/zvoase/django-relax/blob/10bb37bf3a512b290816856a6877c17fa37e930f/relax/viewserver.py#L96-L120", "sha": "10bb37bf3a512b290816856a6877c17fa37e930f", "docstring_summary": "Reduce several mapped documents by several reduction functions.", "language": "python", "parameters": "(self, reduce_function_names, mapped_docs)", "return_statement": "return [True, results]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "try", ":", "arg_5", "=", "get_function", "(", "arg_4", ")", "if", "getattr", "(", "arg_5", ",", "'view_decorated'", ",", "None", ")", ":", "arg_5", "=", "arg_5", "(", "arg_0", ".", "log", ")", "arg_3", ".", "append", "(", "arg_5", ")", "except", "Exception", ",", "exc", ":", "arg_0", ".", "log", "(", "repr", "(", "exc", ")", ")", "arg_3", ".", "append", "(", "lambda", "*", "args", ",", "**", "kwargs", ":", "None", ")", "arg_6", ",", "arg_7", "=", "zip", "(", "(", "key", ",", "value", ")", "for", "(", "(", "key", ",", "doc_id", ")", ",", "value", ")", "in", "arg_2", ")", "arg_8", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "try", ":", "arg_8", ".", "append", "(", "arg_5", "(", "arg_6", ",", "arg_7", ",", "rereduce", "=", "False", ")", ")", "except", "Exception", ",", "exc", ":", "arg_0", ".", "log", "(", "repr", "(", "exc", ")", ")", "arg_8", ".", "append", "(", "None", ")", "return", "[", "True", ",", "arg_8", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Reduce several mapped documents by several reduction functions.\"\"\"\n        arg_3 = []\n        # This gets a large list of reduction functions, given their names.\n        for arg_4 in arg_1:\n            try:\n                arg_5 = get_function(arg_4)\n                if getattr(arg_5, 'view_decorated', None):\n                    arg_5 = arg_5(arg_0.log)\n                arg_3.append(arg_5)\n            except Exception, exc:\n                arg_0.log(repr(exc))\n                arg_3.append(lambda *args, **kwargs: None)\n        # Transform lots of (key, value) pairs into one (keys, values) pair.\n        arg_6, arg_7 = zip(\n            (key, value) for ((key, doc_id), value) in arg_2)\n        # This gets the list of results from the reduction functions.\n        arg_8 = []\n        for arg_5 in arg_3:\n            try:\n                arg_8.append(arg_5(arg_6, arg_7, rereduce=False))\n            except Exception, exc:\n                arg_0.log(repr(exc))\n                arg_8.append(None)\n        return [True, arg_8]", "path": "relax/viewserver.py", "identifier": "ViewServerRequestHandler.handle_reduce", "docstring": "Reduce several mapped documents by several reduction functions.", "docstring_tokens": ["Reduce", "several", "mapped", "documents", "by", "several", "reduction", "functions", "."], "nwo": "zvoase/django-relax", "score": 0.0, "idx": 259009}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/ParsingSpecification.py#L91-L101", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Create a loader for a knitting pattern set.", "language": "python", "parameters": "(specification=DefaultSpecification())", "return_statement": "return loader", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", "(", ")", ")", ":", "arg_2", "=", "arg_0", ".", "new_parser", "(", "arg_0", ")", "arg_3", "=", "arg_0", ".", "new_loader", "(", "arg_2", ".", "knitting_pattern_set", ")", "return", "arg_3"], "function": "def Func(arg_0=arg_1()):\n    \"\"\"Create a loader for a knitting pattern set.\n\n    :param specification: a :class:`specification\n      <knittingpattern.ParsingSpecification.ParsingSpecification>`\n      for the knitting pattern set, default\n      :class:`DefaultSpecification`\n    \"\"\"\n    arg_2 = arg_0.new_parser(arg_0)\n    arg_3 = arg_0.new_loader(arg_2.knitting_pattern_set)\n    return arg_3", "path": "knittingpattern/ParsingSpecification.py", "identifier": "new_knitting_pattern_set_loader", "docstring": "Create a loader for a knitting pattern set.\n\n    :param specification: a :class:`specification\n      <knittingpattern.ParsingSpecification.ParsingSpecification>`\n      for the knitting pattern set, default\n      :class:`DefaultSpecification`", "docstring_tokens": ["Create", "a", "loader", "for", "a", "knitting", "pattern", "set", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 259010}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L834-L873", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Applies the hue blend mode.\n    \n        Hues image img1 with image img2.\n        The hue filter replaces the hues of pixels in img1\n        with the hues of pixels in img2.\n        Returns a composite image with the alpha channel retained.", "language": "python", "parameters": "(self, img1, img2)", "return_statement": "return img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "import", "colorsys", "arg_3", "=", "list", "(", "arg_1", ".", "getdata", "(", ")", ")", "arg_4", "=", "list", "(", "arg_2", ".", "getdata", "(", ")", ")", "for", "arg_5", "in", "range", "(", "len", "(", "arg_3", ")", ")", ":", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_3", "[", "arg_5", "]", "arg_6", "=", "arg_6", "/", "255.0", "arg_7", "=", "arg_7", "/", "255.0", "arg_8", "=", "arg_8", "/", "255.0", "arg_10", ",", "arg_11", ",", "arg_12", "=", "colorsys", ".", "rgb_to_hsv", "(", "arg_6", ",", "arg_7", ",", "arg_8", ")", "arg_13", ",", "arg_14", ",", "arg_15", ",", "arg_16", "=", "arg_4", "[", "arg_5", "]", "arg_13", "=", "arg_13", "/", "255.0", "arg_14", "=", "arg_14", "/", "255.0", "arg_15", "=", "arg_15", "/", "255.0", "arg_17", ",", "arg_18", ",", "arg_19", "=", "colorsys", ".", "rgb_to_hsv", "(", "arg_13", ",", "arg_14", ",", "arg_15", ")", "arg_20", ",", "arg_21", ",", "arg_22", "=", "colorsys", ".", "hsv_to_rgb", "(", "arg_17", ",", "arg_11", ",", "arg_12", ")", "arg_20", "=", "int", "(", "arg_20", "*", "255", ")", "arg_21", "=", "int", "(", "arg_21", "*", "255", ")", "arg_22", "=", "int", "(", "arg_22", "*", "255", ")", "arg_3", "[", "arg_5", "]", "=", "(", "arg_20", ",", "arg_21", ",", "arg_22", ",", "arg_9", ")", "arg_23", "=", "Image", ".", "new", "(", "\"RGBA\"", ",", "arg_1", ".", "size", ",", "255", ")", "arg_23", ".", "putdata", "(", "arg_3", ")", "return", "arg_23"], "function": "def Func(arg_0, arg_1, arg_2):\n    \n        \"\"\"Applies the Func blend mode.\n    \n        Hues image img1 with image img2.\n        The Func filter replaces the Funcs of pixels in img1\n        with the Funcs of pixels in img2.\n        Returns a composite image with the alpha channel retained.\n    \n        \"\"\"\n\n        import colorsys\n\n        arg_3 = list(arg_1.getdata())\n        arg_4 = list(arg_2.getdata())\n        for arg_5 in range(len(arg_3)):\n        \n            arg_6, arg_7, arg_8, arg_9 = arg_3[arg_5]\n            arg_6 = arg_6 / 255.0\n            arg_7 = arg_7 / 255.0\n            arg_8 = arg_8 / 255.0\n        \n            arg_10, arg_11, arg_12 = colorsys.rgb_to_hsv(arg_6, arg_7, arg_8)\n        \n            arg_13, arg_14, arg_15, arg_16 = arg_4[arg_5]\n            arg_13 = arg_13 / 255.0\n            arg_14 = arg_14 / 255.0\n            arg_15 = arg_15 / 255.0\n            arg_17, arg_18, arg_19 = colorsys.rgb_to_hsv(arg_13, arg_14, arg_15)\n        \n            arg_20, arg_21, arg_22 = colorsys.hsv_to_rgb(arg_17, arg_11, arg_12)\n        \n            arg_20 = int(arg_20*255)\n            arg_21 = int(arg_21*255)\n            arg_22 = int(arg_22*255)\n            arg_3[arg_5] = (arg_20, arg_21, arg_22, arg_9)\n    \n        arg_23 = Image.new(\"RGBA\", arg_1.size, 255)\n        arg_23.putdata(arg_3)\n        return arg_23", "path": "lib/photobot/__init__.py", "identifier": "Blend.hue", "docstring": "Applies the hue blend mode.\n    \n        Hues image img1 with image img2.\n        The hue filter replaces the hues of pixels in img1\n        with the hues of pixels in img2.\n        Returns a composite image with the alpha channel retained.", "docstring_tokens": ["Applies", "the", "hue", "blend", "mode", ".", "Hues", "image", "img1", "with", "image", "img2", ".", "The", "hue", "filter", "replaces", "the", "hues", "of", "pixels", "in", "img1", "with", "the", "hues", "of", "pixels", "in", "img2", ".", "Returns", "a", "composite", "image", "with", "the", "alpha", "channel", "retained", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259011}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/graph/graph_wrapper.py#L15-L24", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Takes an adjacency matrix and returns an adjacency list.", "language": "python", "parameters": "(matrix, etype=False)", "return_statement": "return adj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "len", "(", "arg_0", ")", "arg_3", "=", "{", "arg_4", ":", "{", "}", "for", "arg_4", "in", "range", "(", "arg_2", ")", "}", "for", "arg_4", "in", "range", "(", "arg_2", ")", ":", "for", "arg_5", "in", "range", "(", "arg_2", ")", ":", "if", "arg_0", "[", "arg_4", ",", "arg_5", "]", "!=", "0", ":", "arg_3", "[", "arg_4", "]", "[", "arg_5", "]", "=", "{", "}", "if", "not", "arg_1", "else", "arg_0", "[", "arg_4", ",", "arg_5", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"Takes an adjacency matrix and returns an adjacency list.\"\"\"\n    arg_2 = len(arg_0)\n    arg_3 = {arg_4: {} for arg_4 in range(arg_2)}\n    for arg_4 in range(arg_2):\n        for arg_5 in range(arg_2):\n            if arg_0[arg_4, arg_5] != 0:\n                arg_3[arg_4][arg_5] = {} if not arg_1 else arg_0[arg_4, arg_5]\n\n    return arg_3", "path": "queueing_tool/graph/graph_wrapper.py", "identifier": "_matrix2dict", "docstring": "Takes an adjacency matrix and returns an adjacency list.", "docstring_tokens": ["Takes", "an", "adjacency", "matrix", "and", "returns", "an", "adjacency", "list", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 259012}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L94-L104", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Adds a callback to the specified action.\n        \n        All other positional and keyword arguments will be stored and passed to the function upon activation.", "language": "python", "parameters": "(self,action,func,*args,**kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "\"actions\"", ")", ":", "arg_0", ".", "actions", "=", "{", "}", "if", "arg_1", "not", "in", "arg_0", ".", "actions", ":", "arg_0", ".", "actions", "[", "arg_1", "]", "=", "[", "]", "arg_0", ".", "actions", "[", "arg_1", "]", ".", "append", "(", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")"], "function": "def Func(arg_0,arg_1,arg_2,*arg_3,**arg_4):\n        \"\"\"\n        Adds a callback to the specified action.\n        \n        All other positional and keyword arguments will be stored and passed to the function upon activation.\n        \"\"\"\n        if not hasattr(arg_0,\"actions\"):\n            arg_0.actions = {}\n        if arg_1 not in arg_0.actions:\n            arg_0.actions[arg_1] = []\n        arg_0.actions[arg_1].append((arg_2,arg_3,arg_4))", "path": "peng3d/util/__init__.py", "identifier": "ActionDispatcher.addAction", "docstring": "Adds a callback to the specified action.\n        \n        All other positional and keyword arguments will be stored and passed to the function upon activation.", "docstring_tokens": ["Adds", "a", "callback", "to", "the", "specified", "action", ".", "All", "other", "positional", "and", "keyword", "arguments", "will", "be", "stored", "and", "passed", "to", "the", "function", "upon", "activation", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 259013}
{"url": "https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/models.py#L186-L197", "sha": "cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2", "docstring_summary": "Returns combined list of event and update comments.", "language": "python", "parameters": "(self)", "return_statement": "return Comment.objects.filter(\n            Q(content_type=ctype.id, object_pk=self.id) |\n            Q(content_type=update_ctype.id, object_pk__in=update_ids)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ContentType", ".", "objects", ".", "get", "(", "app_label__exact", "=", "\"happenings\"", ",", "model__exact", "=", "'event'", ")", "arg_2", "=", "ContentType", ".", "objects", ".", "get", "(", "app_label__exact", "=", "\"happenings\"", ",", "model__exact", "=", "'update'", ")", "arg_3", "=", "arg_0", ".", "update_set", ".", "values_list", "(", "'id'", ",", "flat", "=", "True", ")", "return", "Comment", ".", "objects", ".", "filter", "(", "Q", "(", "content_type", "=", "arg_1", ".", "id", ",", "object_pk", "=", "arg_0", ".", "id", ")", "|", "Q", "(", "content_type", "=", "arg_2", ".", "id", ",", "object_pk__in", "=", "arg_3", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns combined list of event and update comments.\n        \"\"\"\n        arg_1 = ContentType.objects.get(app_label__exact=\"happenings\", model__exact='event')\n        arg_2 = ContentType.objects.get(app_label__exact=\"happenings\", model__exact='update')\n        arg_3 = arg_0.update_set.values_list('id', flat=True)\n\n        return Comment.objects.filter(\n            Q(content_type=arg_1.id, object_pk=arg_0.id) |\n            Q(content_type=arg_2.id, object_pk__in=arg_3)\n        )", "path": "build/lib/happenings/models.py", "identifier": "Event.all_comments", "docstring": "Returns combined list of event and update comments.", "docstring_tokens": ["Returns", "combined", "list", "of", "event", "and", "update", "comments", "."], "nwo": "tBaxter/tango-happenings", "score": 0.09252797783733271, "idx": 259014}
{"url": "https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L150-L190", "sha": "5b90a543b127ab9e6112fd547929b5ef4b8f0cbc", "docstring_summary": "Send X10 commands using the FireCracker on comPort", "language": "python", "parameters": "(comPort, commands)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "mutex", ".", "acquire", "(", ")", "try", ":", "try", ":", "arg_2", "=", "serial", ".", "Serial", "(", "arg_2", "=", "arg_0", ")", "arg_3", "=", "'11010101 10101010'", "arg_4", "=", "'10101101'", "for", "arg_5", "in", "_translateCommands", "(", "arg_1", ")", ":", "_sendBinaryData", "(", "arg_2", ",", "arg_3", "+", "arg_5", "+", "arg_4", ")", "except", "serial", ".", "SerialException", ":", "print", "(", "'Unable to open serial port %s'", "%", "arg_0", ")", "print", "(", "''", ")", "raise", "finally", ":", "mutex", ".", "release", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Send X10 commands using the FireCracker on comPort\n\n    comPort should be the name of a serial port on the host platform. On\n    Windows, for example, 'com1'.\n\n    commands should be a string consisting of X10 commands separated by\n    commas. For example. 'A1 On, A Dim, A Dim, A Dim, A Lamps Off'. The\n    letter is a house code (A-P) and the number is the device number (1-16).\n    Possible commands for a house code / device number combination are\n    'On' and 'Off'. The commands 'Bright' and 'Dim' should be used with a\n    house code alone after sending an On command to a specific device. The\n    'All On', 'All Off', 'Lamps On', and 'Lamps Off' commands should also\n    be used with a house code alone.\n\n    # Turn on module A1\n    >>> Func('com1', 'A1 On')\n\n    # Turn all modules with house code A off\n    >>> Func('com1', 'A All Off')\n\n    # Turn all lamp modules with house code B on\n    >>> Func('com1', 'B Lamps On')\n\n    # Turn on module A1 and dim it 3 steps, then brighten it 1 step\n    >>> Func('com1', 'A1 On, A Dim, A Dim, A Dim, A Bright')\n    \"\"\"\n    mutex.acquire()\n    try:\n        try:\n            arg_2 = serial.Serial(arg_2=arg_0)\n            arg_3 = '11010101 10101010'\n            arg_4 = '10101101'\n            for arg_5 in _translateCommands(arg_1):\n                _sendBinaryData(arg_2, arg_3 + arg_5 + arg_4)\n        except serial.SerialException:\n            print('Unable to open serial port %s' % arg_0)\n            print('')\n            raise\n    finally:\n        mutex.release()", "path": "x10_any/cm17a.py", "identifier": "sendCommands", "docstring": "Send X10 commands using the FireCracker on comPort\n\n    comPort should be the name of a serial port on the host platform. On\n    Windows, for example, 'com1'.\n\n    commands should be a string consisting of X10 commands separated by\n    commas. For example. 'A1 On, A Dim, A Dim, A Dim, A Lamps Off'. The\n    letter is a house code (A-P) and the number is the device number (1-16).\n    Possible commands for a house code / device number combination are\n    'On' and 'Off'. The commands 'Bright' and 'Dim' should be used with a\n    house code alone after sending an On command to a specific device. The\n    'All On', 'All Off', 'Lamps On', and 'Lamps Off' commands should also\n    be used with a house code alone.\n\n    # Turn on module A1\n    >>> sendCommands('com1', 'A1 On')\n\n    # Turn all modules with house code A off\n    >>> sendCommands('com1', 'A All Off')\n\n    # Turn all lamp modules with house code B on\n    >>> sendCommands('com1', 'B Lamps On')\n\n    # Turn on module A1 and dim it 3 steps, then brighten it 1 step\n    >>> sendCommands('com1', 'A1 On, A Dim, A Dim, A Dim, A Bright')", "docstring_tokens": ["Send", "X10", "commands", "using", "the", "FireCracker", "on", "comPort"], "nwo": "clach04/x10_any", "score": 0.2751458370028208, "idx": 259015}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/movies.py#L289-L309", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the changes for a specific movie id.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the Func for a specific movie id.\n\n        Changes are grouped by key, and ordered by date in descending order.\n        By default, only the last 24 hours of Func are returned. The\n        maximum number of days that can be returned in a single request is 14.\n        The language is present on fields that are translatable.\n\n        Args:\n            start_date: (optional) Expected format is 'YYYY-MM-DD'.\n            end_date: (optional) Expected format is 'YYYY-MM-DD'.\n\n        Returns:\n            A dict representation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/movies.py", "identifier": "Movies.changes", "docstring": "Get the changes for a specific movie id.\n\n        Changes are grouped by key, and ordered by date in descending order.\n        By default, only the last 24 hours of changes are returned. The\n        maximum number of days that can be returned in a single request is 14.\n        The language is present on fields that are translatable.\n\n        Args:\n            start_date: (optional) Expected format is 'YYYY-MM-DD'.\n            end_date: (optional) Expected format is 'YYYY-MM-DD'.\n\n        Returns:\n            A dict representation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "changes", "for", "a", "specific", "movie", "id", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 259016}
{"url": "https://github.com/nickw444/flask-ldap3-login/blob/3cf0faff52d0e04d4813119a2ba36d706e6fb31f/flask_ldap3_login/__init__.py#L63-L86", "sha": "3cf0faff52d0e04d4813119a2ba36d706e6fb31f", "docstring_summary": "Configures this extension with the given app. This registers an\n        ``teardown_appcontext`` call, and attaches this ``LDAP3LoginManager``\n        to it as ``app.ldap3_login_manager``.", "language": "python", "parameters": "(self, app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "ldap3_login_manager", "=", "arg_0", "arg_3", "=", "list", "(", "arg_0", ".", "_server_pool", ")", "for", "arg_4", "in", "arg_3", ":", "arg_0", ".", "_server_pool", ".", "remove", "(", "arg_4", ")", "arg_0", ".", "init_config", "(", "arg_1", ".", "config", ")", "if", "hasattr", "(", "arg_1", ",", "'teardown_appcontext'", ")", ":", "arg_1", ".", "teardown_appcontext", "(", "arg_0", ".", "teardown", ")", "else", ":", "arg_1", ".", "teardown_request", "(", "arg_0", ".", "teardown", ")", "arg_0", ".", "app", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        '''\n        Configures this extension with the given app. This registers an\n        ``teardown_appcontext`` call, and attaches this ``LDAP3LoginManager``\n        to it as ``app.ldap3_login_manager``.\n\n        Args:\n            app (flask.Flask): The flask app to initialise with\n        '''\n\n        arg_1.ldap3_login_manager = arg_0\n\n        arg_3 = list(arg_0._server_pool)\n        for arg_4 in arg_3:\n            arg_0._server_pool.remove(arg_4)\n\n        arg_0.init_config(arg_1.config)\n\n        if hasattr(arg_1, 'teardown_appcontext'):\n            arg_1.teardown_appcontext(arg_0.teardown)\n        else:  # pragma: no cover\n            arg_1.teardown_request(arg_0.teardown)\n\n        arg_0.app = arg_1", "path": "flask_ldap3_login/__init__.py", "identifier": "LDAP3LoginManager.init_app", "docstring": "Configures this extension with the given app. This registers an\n        ``teardown_appcontext`` call, and attaches this ``LDAP3LoginManager``\n        to it as ``app.ldap3_login_manager``.\n\n        Args:\n            app (flask.Flask): The flask app to initialise with", "docstring_tokens": ["Configures", "this", "extension", "with", "the", "given", "app", ".", "This", "registers", "an", "teardown_appcontext", "call", "and", "attaches", "this", "LDAP3LoginManager", "to", "it", "as", "app", ".", "ldap3_login_manager", "."], "nwo": "nickw444/flask-ldap3-login", "score": 0.51975183030278, "idx": 259017}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1643-L1657", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get the base variables for any view to route to.", "language": "python", "parameters": "(**kwargs)", "return_statement": "return enterprise_customer_uuid, course_run_id, course_key, program_uuid", "argument_list": "", "function_tokens": ["def", "Func", "(", "**", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get", "(", "'enterprise_uuid'", ",", "''", ")", "arg_2", "=", "arg_0", ".", "get", "(", "'course_id'", ",", "''", ")", "arg_3", "=", "arg_0", ".", "get", "(", "'course_key'", ",", "''", ")", "arg_4", "=", "arg_0", ".", "get", "(", "'program_uuid'", ",", "''", ")", "return", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4"], "function": "def Func(**arg_0):\n        \"\"\"\n        Get the base variables for any view to route to.\n\n        Currently gets:\n        - `enterprise_uuid` - the UUID of the enterprise customer.\n        - `course_run_id` - the ID of the course, if applicable.\n        - `program_uuid` - the UUID of the program, if applicable.\n        \"\"\"\n        arg_1 = arg_0.get('enterprise_uuid', '')\n        arg_2 = arg_0.get('course_id', '')\n        arg_3 = arg_0.get('course_key', '')\n        arg_4 = arg_0.get('program_uuid', '')\n\n        return arg_1, arg_2, arg_3, arg_4", "path": "enterprise/views.py", "identifier": "RouterView.get_path_variables", "docstring": "Get the base variables for any view to route to.\n\n        Currently gets:\n        - `enterprise_uuid` - the UUID of the enterprise customer.\n        - `course_run_id` - the ID of the course, if applicable.\n        - `program_uuid` - the UUID of the program, if applicable.", "docstring_tokens": ["Get", "the", "base", "variables", "for", "any", "view", "to", "route", "to", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259018}
{"url": "https://github.com/digi604/django-smart-selects/blob/05dcc4a3de2874499ff3b9a3dfac5c623206e3e5/smart_selects/widgets.py#L157-L183", "sha": "05dcc4a3de2874499ff3b9a3dfac5c623206e3e5", "docstring_summary": "get possible choices for selection", "language": "python", "parameters": "(self, queryset, value)", "return_statement": "return filtered", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "filter", "(", "arg_4", "=", "arg_2", ")", ".", "first", "(", ")", "if", "arg_3", ":", "try", ":", "arg_4", "=", "getattr", "(", "arg_3", ",", "arg_0", ".", "chained_model_field", "+", "\"_id\"", ")", "arg_5", "=", "{", "arg_0", ".", "chained_model_field", ":", "arg_4", "}", "except", "AttributeError", ":", "try", ":", "arg_6", "=", "getattr", "(", "arg_3", ",", "arg_0", ".", "chained_model_field", ")", ".", "all", "(", ")", ".", "values_list", "(", "'pk'", ",", "flat", "=", "True", ")", "arg_5", "=", "{", "arg_0", ".", "chained_model_field", "+", "\"__in\"", ":", "arg_6", "}", "except", "AttributeError", ":", "try", ":", "arg_6", "=", "getattr", "(", "arg_3", ",", "arg_0", ".", "chained_model_field", "+", "\"_set\"", ")", ".", "all", "(", ")", ".", "values_list", "(", "'pk'", ",", "flat", "=", "True", ")", "arg_5", "=", "{", "arg_0", ".", "chained_model_field", "+", "\"__in\"", ":", "arg_6", "}", "except", "AttributeError", ":", "arg_5", "=", "{", "}", "arg_7", "=", "list", "(", "get_model", "(", "arg_0", ".", "to_app_name", ",", "arg_0", ".", "to_model_name", ")", ".", "objects", ".", "filter", "(", "**", "arg_5", ")", ".", "distinct", "(", ")", ")", "if", "arg_0", ".", "sort", ":", "sort_results", "(", "arg_7", ")", "else", ":", "arg_7", "=", "[", "]", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        get possible choices for selection\n        \"\"\"\n        arg_3 = arg_1.filter(arg_4=arg_2).first()\n        if arg_3:\n            try:\n                arg_4 = getattr(arg_3, arg_0.chained_model_field + \"_id\")\n                arg_5 = {arg_0.chained_model_field: arg_4}\n            except AttributeError:\n                try:  # maybe m2m?\n                    arg_6 = getattr(arg_3, arg_0.chained_model_field).all().values_list('pk', flat=True)\n                    arg_5 = {arg_0.chained_model_field + \"__in\": arg_6}\n                except AttributeError:\n                    try:  # maybe a set?\n                        arg_6 = getattr(arg_3, arg_0.chained_model_field + \"_set\").all().values_list('pk', flat=True)\n                        arg_5 = {arg_0.chained_model_field + \"__in\": arg_6}\n                    except AttributeError:  # give up\n                        arg_5 = {}\n            arg_7 = list(get_model(arg_0.to_app_name, arg_0.to_model_name).objects.filter(**arg_5).distinct())\n            if arg_0.sort:\n                sort_results(arg_7)\n        else:\n            # invalid value for queryset\n            arg_7 = []\n\n        return arg_7", "path": "smart_selects/widgets.py", "identifier": "ChainedSelect._get_available_choices", "docstring": "get possible choices for selection", "docstring_tokens": ["get", "possible", "choices", "for", "selection"], "nwo": "digi604/django-smart-selects", "score": 0.7571810030476924, "idx": 259019}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/permissions.py#L33-L48", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Factory for creating a permission for an admin `deposit-admin-access`.", "language": "python", "parameters": "()", "return_statement": "return Permission(action_admin_access)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "pkg_resources", ".", "get_distribution", "(", "'invenio-access'", ")", "from", "invenio_access", ".", "permissions", "import", "DynamicPermission", "as", "Permission", "except", "pkg_resources", ".", "DistributionNotFound", ":", "from", "flask_principal", "import", "Permission", "return", "Permission", "(", "action_admin_access", ")"], "function": "def Func():\n    \"\"\"Factory for creating a permission for an admin `deposit-admin-access`.\n\n    If `invenio-access` module is installed, it returns a\n    :class:`invenio_access.permissions.DynamicPermission` object.\n    Otherwise, it returns a :class:`flask_principal.Permission` object.\n\n    :returns: Permission instance.\n    \"\"\"\n    try:\n        pkg_resources.get_distribution('invenio-access')\n        from invenio_access.permissions import DynamicPermission as Permission\n    except pkg_resources.DistributionNotFound:\n        from flask_principal import Permission\n\n    return Permission(action_admin_access)", "path": "invenio_deposit/permissions.py", "identifier": "admin_permission_factory", "docstring": "Factory for creating a permission for an admin `deposit-admin-access`.\n\n    If `invenio-access` module is installed, it returns a\n    :class:`invenio_access.permissions.DynamicPermission` object.\n    Otherwise, it returns a :class:`flask_principal.Permission` object.\n\n    :returns: Permission instance.", "docstring_tokens": ["Factory", "for", "creating", "a", "permission", "for", "an", "admin", "deposit", "-", "admin", "-", "access", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 259020}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1252-L1259", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "_add_id_to_keys - Adds primary key to table\n\t\t\tinternal", "language": "python", "parameters": "(self, pk, conn=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_2", ".", "sadd", "(", "arg_0", ".", "_get_ids_key", "(", ")", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n\t\t'''\n\t\t\tFunc - Adds primary key to table\n\t\t\tinternal\n\t\t'''\n\t\tif arg_2 is None:\n\t\t\targ_2 = arg_0._get_connection()\n\t\targ_2.sadd(arg_0._get_ids_key(), arg_1)", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisHelper._add_id_to_keys", "docstring": "_add_id_to_keys - Adds primary key to table\n\t\t\tinternal", "docstring_tokens": ["_add_id_to_keys", "-", "Adds", "primary", "key", "to", "table", "internal"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 259021}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/index.py#L290-L300", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "Returns the count of the items that match the provided filters.", "language": "python", "parameters": "(self, conn, filters)", "return_statement": "return pipe.execute()[-2]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_prepare", "(", "arg_1", ",", "arg_2", ")", "arg_3", ".", "zcard", "(", "arg_5", ")", "arg_3", ".", "delete", "(", "arg_5", ")", "return", "arg_3", ".", "execute", "(", ")", "[", "-", "2", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Returns the Func of the items that match the provided filters.\n\n        For the meaning of what the ``filters`` argument means, see the\n        ``.search()`` method docs.\n        '''\n        arg_3, arg_4, arg_5 = arg_0._prepare(arg_1, arg_2)\n        arg_3.zcard(arg_5)\n        arg_3.delete(arg_5)\n        return arg_3.execute()[-2]", "path": "rom/index.py", "identifier": "GeneralIndex.count", "docstring": "Returns the count of the items that match the provided filters.\n\n        For the meaning of what the ``filters`` argument means, see the\n        ``.search()`` method docs.", "docstring_tokens": ["Returns", "the", "count", "of", "the", "items", "that", "match", "the", "provided", "filters", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 259022}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L753-L780", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Set the metadata associated with an item.", "language": "python", "parameters": "(self, token, item_id, element, value,\n                          qualifier=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "dict", "(", ")", "arg_6", "[", "'token'", "]", "=", "arg_1", "arg_6", "[", "'itemId'", "]", "=", "arg_2", "arg_6", "[", "'element'", "]", "=", "arg_3", "arg_6", "[", "'value'", "]", "=", "arg_4", "if", "arg_5", ":", "arg_6", "[", "'qualifier'", "]", "=", "arg_5", "arg_7", "=", "arg_0", ".", "request", "(", "'midas.item.setmetadata'", ",", "arg_6", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                          arg_5=None):\n        \"\"\"\n        Set the metadata associated with an item.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param item_id: The id of the item for which metadata will be set.\n        :type item_id: int | long\n        :param element: The metadata element name.\n        :type element: string\n        :param value: The metadata value for the field.\n        :type value: string\n        :param qualifier: (optional) The metadata qualifier. Defaults to empty\n            string.\n        :type qualifier: None | string\n        :returns: None.\n        :rtype: None\n        \"\"\"\n        arg_6 = dict()\n        arg_6['token'] = arg_1\n        arg_6['itemId'] = arg_2\n        arg_6['element'] = arg_3\n        arg_6['value'] = arg_4\n        if arg_5:\n            arg_6['qualifier'] = arg_5\n        arg_7 = arg_0.request('midas.item.setmetadata', arg_6)\n        return arg_7", "path": "pydas/drivers.py", "identifier": "CoreDriver.set_item_metadata", "docstring": "Set the metadata associated with an item.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param item_id: The id of the item for which metadata will be set.\n        :type item_id: int | long\n        :param element: The metadata element name.\n        :type element: string\n        :param value: The metadata value for the field.\n        :type value: string\n        :param qualifier: (optional) The metadata qualifier. Defaults to empty\n            string.\n        :type qualifier: None | string\n        :returns: None.\n        :rtype: None", "docstring_tokens": ["Set", "the", "metadata", "associated", "with", "an", "item", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 259023}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/shared_utils.py#L355-L357", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return True if slice ``s`` in \"normalized\" form.", "language": "python", "parameters": "(s)", "return_statement": "return (s.start is not None and s.stop is not None and s.step is not None and s.start <= s.stop)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "start", "is", "not", "None", "and", "arg_0", ".", "stop", "is", "not", "None", "and", "arg_0", ".", "step", "is", "not", "None", "and", "arg_0", ".", "start", "<=", "arg_0", ".", "stop", ")"], "function": "def Func(arg_0):\n    \"\"\"Return True if slice ``s`` in \"normalized\" form.\"\"\"\n    return (arg_0.start is not None and arg_0.stop is not None and arg_0.step is not None and arg_0.start <= arg_0.stop)", "path": "h2o-py/h2o/utils/shared_utils.py", "identifier": "slice_is_normalized", "docstring": "Return True if slice ``s`` in \"normalized\" form.", "docstring_tokens": ["Return", "True", "if", "slice", "s", "in", "normalized", "form", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259024}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/utils/progress.py#L71-L80", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Formats the file size into a human readable format.", "language": "python", "parameters": "(size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "(", "\"bytes\"", ",", "\"KB\"", ",", "\"MB\"", ",", "\"GB\"", ",", "\"TB\"", ")", ":", "if", "arg_0", "<", "1024.0", ":", "if", "arg_1", "in", "(", "\"GB\"", ",", "\"TB\"", ")", ":", "return", "\"{0:3.2f} {1}\"", ".", "format", "(", "arg_0", ",", "arg_1", ")", "else", ":", "return", "\"{0:3.1f} {1}\"", ".", "format", "(", "arg_0", ",", "arg_1", ")", "arg_0", "/=", "1024.0"], "function": "def Func(arg_0):\n    \"\"\"Formats the file size into a human readable format.\"\"\"\n    for arg_1 in (\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\"):\n        if arg_0 < 1024.0:\n            if arg_1 in (\"GB\", \"TB\"):\n                return \"{0:3.2f} {1}\".format(arg_0, arg_1)\n            else:\n                return \"{0:3.1f} {1}\".format(arg_0, arg_1)\n\n        arg_0 /= 1024.0", "path": "src/streamlink_cli/utils/progress.py", "identifier": "format_filesize", "docstring": "Formats the file size into a human readable format.", "docstring_tokens": ["Formats", "the", "file", "size", "into", "a", "human", "readable", "format", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 259025}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/bugzilla.py#L228-L302", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a Bugzilla bug activity HTML stream.", "language": "python", "parameters": "(raw_html)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "is_activity_empty", "(", "arg_1", ")", ":", "arg_2", "=", "\"No changes have been made to this (?:bug|issue) yet.\"", "arg_3", "=", "arg_1", ".", "find", "(", "text", "=", "re", ".", "compile", "(", "arg_2", ")", ")", "return", "arg_3", "is", "not", "None", "def", "find_activity_table", "(", "arg_1", ")", ":", "arg_4", "=", "arg_1", ".", "find_all", "(", "'table'", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "len", "(", "arg_5", ".", "tr", ".", "find_all", "(", "'th'", ",", "recursive", "=", "False", ")", ")", "if", "arg_6", "==", "5", ":", "return", "arg_5", "raise", "ParseError", "(", "cause", "=", "\"Table of bug activity not found.\"", ")", "def", "remove_tags", "(", "arg_1", ")", ":", "arg_7", "=", "[", "'a'", ",", "'i'", ",", "'span'", "]", "for", "arg_3", "in", "arg_1", ".", "find_all", "(", "arg_7", ")", ":", "arg_3", ".", "replaceWith", "(", "arg_3", ".", "text", ")", "def", "format_text", "(", "arg_1", ")", ":", "arg_8", "=", "[", "arg_9", ".", "strip", "(", "' \\n\\t'", ")", "for", "arg_9", "in", "arg_1", ".", "stripped_strings", "]", "arg_9", "=", "' '", ".", "join", "(", "arg_8", ")", "return", "arg_9", "arg_1", "=", "bs4", ".", "BeautifulSoup", "(", "arg_0", ",", "'html.parser'", ")", "if", "is_activity_empty", "(", "arg_1", ")", ":", "arg_10", "=", "[", "]", "else", ":", "arg_11", "=", "find_activity_table", "(", "arg_1", ")", "remove_tags", "(", "arg_11", ")", "arg_10", "=", "arg_11", ".", "find_all", "(", "'td'", ")", "while", "arg_10", ":", "arg_12", "=", "arg_10", ".", "pop", "(", "0", ")", "arg_13", "=", "arg_10", ".", "pop", "(", "0", ")", "arg_14", "=", "int", "(", "arg_12", ".", "get", "(", "'rowspan'", ")", ")", "for", "arg_15", "in", "range", "(", "arg_14", ")", ":", "arg_16", "=", "arg_10", ".", "pop", "(", "0", ")", "arg_17", "=", "arg_10", ".", "pop", "(", "0", ")", "arg_18", "=", "arg_10", ".", "pop", "(", "0", ")", "arg_19", "=", "{", "'Who'", ":", "format_text", "(", "arg_12", ")", ",", "'When'", ":", "format_text", "(", "arg_13", ")", ",", "'What'", ":", "format_text", "(", "arg_16", ")", ",", "'Removed'", ":", "format_text", "(", "arg_17", ")", ",", "'Added'", ":", "format_text", "(", "arg_18", ")", "}", "yield", "arg_19"], "function": "def Func(arg_0):\n        \"\"\"Parse a Bugzilla bug activity HTML stream.\n\n        This method extracts the information about activity from the\n        given HTML stream. The bug activity is stored into a HTML\n        table. Each parsed activity event is returned into a dictionary.\n\n        If the given HTML is invalid, the method will raise a ParseError\n        exception.\n\n        :param raw_html: HTML string to parse\n\n        :returns: a generator of parsed activity events\n\n        :raises ParseError: raised when an error occurs parsing\n            the given HTML stream\n        \"\"\"\n        def is_activity_empty(arg_1):\n            arg_2 = \"No changes have been made to this (?:bug|issue) yet.\"\n            arg_3 = arg_1.find(text=re.compile(arg_2))\n            return arg_3 is not None\n\n        def find_activity_table(arg_1):\n            # The first table with 5 columns is the table of activity\n            arg_4 = arg_1.find_all('table')\n\n            for arg_5 in arg_4:\n                arg_6 = len(arg_5.tr.find_all('th', recursive=False))\n                if arg_6 == 5:\n                    return arg_5\n            raise ParseError(cause=\"Table of bug activity not found.\")\n\n        def remove_tags(arg_1):\n            arg_7 = ['a', 'i', 'span']\n\n            for arg_3 in arg_1.find_all(arg_7):\n                arg_3.replaceWith(arg_3.text)\n\n        def format_text(arg_1):\n            arg_8 = [arg_9.strip(' \\n\\t') for arg_9 in arg_1.stripped_strings]\n            arg_9 = ' '.join(arg_8)\n            return arg_9\n\n        # Parsing starts here\n        arg_1 = bs4.BeautifulSoup(arg_0, 'html.parser')\n\n        if is_activity_empty(arg_1):\n            arg_10 = []\n        else:\n            arg_11 = find_activity_table(arg_1)\n            remove_tags(arg_11)\n            arg_10 = arg_11.find_all('td')\n\n        while arg_10:\n            # First two fields: 'Who' and 'When'.\n            arg_12 = arg_10.pop(0)\n            arg_13 = arg_10.pop(0)\n\n            # The attribute 'rowspan' of 'who' field tells how many\n            # changes were made on the same date.\n            arg_14 = int(arg_12.get('rowspan'))\n\n            # Next fields are split into chunks of three elements:\n            # 'What', 'Removed' and 'Added'. These chunks share\n            # 'Who' and 'When' values.\n            for arg_15 in range(arg_14):\n                arg_16 = arg_10.pop(0)\n                arg_17 = arg_10.pop(0)\n                arg_18 = arg_10.pop(0)\n                arg_19 = {'Who': format_text(arg_12),\n                         'When': format_text(arg_13),\n                         'What': format_text(arg_16),\n                         'Removed': format_text(arg_17),\n                         'Added': format_text(arg_18)}\n                yield arg_19", "path": "perceval/backends/core/bugzilla.py", "identifier": "Bugzilla.parse_bug_activity", "docstring": "Parse a Bugzilla bug activity HTML stream.\n\n        This method extracts the information about activity from the\n        given HTML stream. The bug activity is stored into a HTML\n        table. Each parsed activity event is returned into a dictionary.\n\n        If the given HTML is invalid, the method will raise a ParseError\n        exception.\n\n        :param raw_html: HTML string to parse\n\n        :returns: a generator of parsed activity events\n\n        :raises ParseError: raised when an error occurs parsing\n            the given HTML stream", "docstring_tokens": ["Parse", "a", "Bugzilla", "bug", "activity", "HTML", "stream", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259026}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/grammar.py#L85-L97", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Limit to framerate, should be called after\n        rendering has completed", "language": "python", "parameters": "(self, start_time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_speed", ":", "arg_2", "=", "time", "(", ")", "arg_3", "=", "arg_2", "-", "arg_1", "arg_4", "=", "(", "1.0", "/", "abs", "(", "arg_0", ".", "_speed", ")", ")", "-", "arg_3", "if", "arg_4", ">", "0", ":", "sleep", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Limit to framerate, should be called after\n        rendering has completed\n\n        :param start_time: When execution started\n        \"\"\"\n        if arg_0._speed:\n            arg_2 = time()\n            arg_3 = arg_2 - arg_1\n            arg_4 = (1.0 / abs(arg_0._speed)) - arg_3\n            if arg_4 > 0:\n                sleep(arg_4)", "path": "shoebot/grammar/grammar.py", "identifier": "Grammar._frame_limit", "docstring": "Limit to framerate, should be called after\n        rendering has completed\n\n        :param start_time: When execution started", "docstring_tokens": ["Limit", "to", "framerate", "should", "be", "called", "after", "rendering", "has", "completed"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259027}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/parameters.py#L1919-L1954", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Converts another parameter's results to positive values.", "language": "python", "parameters": "(other_param, mode=\"invert\", reroll_count_max=2)", "return_statement": "return ForceSign(\n        other_param=other_param,\n        positive=True,\n        mode=mode,\n        reroll_count_max=reroll_count_max\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"invert\"", ",", "arg_2", "=", "2", ")", ":", "return", "ForceSign", "(", "arg_0", "=", "arg_0", ",", "positive", "=", "True", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=\"invert\", arg_2=2):\n    \"\"\"\n    Converts another parameter's results to positive values.\n\n    Parameters\n    ----------\n    other_param : imgaug.parameters.StochasticParameter\n        Other parameter which's sampled values are to be\n        modified.\n\n    mode : {'invert', 'reroll'}, optional\n        How to change the signs. Valid values are ``invert`` and ``reroll``.\n        ``invert`` means that wrong signs are simply flipped.\n        ``reroll`` means that all samples with wrong signs are sampled again,\n        optionally many times, until they randomly end up having the correct\n        sign.\n\n    reroll_count_max : int, optional\n        If `mode` is set to ``reroll``, this determines how often values may\n        be rerolled before giving up and simply flipping the sign (as in\n        ``mode=\"invert\"``). This shouldn't be set too high, as rerolling is\n        expensive.\n\n    Examples\n    --------\n    >>> param = Func(Normal(0, 1), mode=\"reroll\")\n\n    Generates a normal distribution that has only positive values.\n\n    \"\"\"\n    return ForceSign(\n        arg_0=arg_0,\n        positive=True,\n        arg_1=arg_1,\n        arg_2=arg_2\n    )", "path": "imgaug/parameters.py", "identifier": "Positive", "docstring": "Converts another parameter's results to positive values.\n\n    Parameters\n    ----------\n    other_param : imgaug.parameters.StochasticParameter\n        Other parameter which's sampled values are to be\n        modified.\n\n    mode : {'invert', 'reroll'}, optional\n        How to change the signs. Valid values are ``invert`` and ``reroll``.\n        ``invert`` means that wrong signs are simply flipped.\n        ``reroll`` means that all samples with wrong signs are sampled again,\n        optionally many times, until they randomly end up having the correct\n        sign.\n\n    reroll_count_max : int, optional\n        If `mode` is set to ``reroll``, this determines how often values may\n        be rerolled before giving up and simply flipping the sign (as in\n        ``mode=\"invert\"``). This shouldn't be set too high, as rerolling is\n        expensive.\n\n    Examples\n    --------\n    >>> param = Positive(Normal(0, 1), mode=\"reroll\")\n\n    Generates a normal distribution that has only positive values.", "docstring_tokens": ["Converts", "another", "parameter", "s", "results", "to", "positive", "values", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259028}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/config.py#L607-L611", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return path to any existing user config files", "language": "python", "parameters": "()", "return_statement": "return filter(os.path.exists,\n                  map(os.path.expanduser, config_files))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "return", "filter", "(", "os", ".", "path", ".", "exists", ",", "map", "(", "os", ".", "path", ".", "expanduser", ",", "config_files", ")", ")"], "function": "def Func():\n    \"\"\"Return path to any existing user config files\n    \"\"\"\n    return filter(os.path.exists,\n                  map(os.path.expanduser, config_files))", "path": "environment/lib/python2.7/site-packages/nose/config.py", "identifier": "user_config_files", "docstring": "Return path to any existing user config files", "docstring_tokens": ["Return", "path", "to", "any", "existing", "user", "config", "files"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259029}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/search.py#L63-L79", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Search for collections by name.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Search for Funcs by name.\n\n        Args:\n            query: CGI escpaed string.\n            page: (optional) Minimum value of 1. Expected value is an integer.\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/search.py", "identifier": "Search.collection", "docstring": "Search for collections by name.\n\n        Args:\n            query: CGI escpaed string.\n            page: (optional) Minimum value of 1. Expected value is an integer.\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Search", "for", "collections", "by", "name", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 259030}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/mapping/legacy_swap.py#L357-L392", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Update the QASM string for an iteration of swap_mapper.", "language": "python", "parameters": "(self, i, first_layer, best_layout, best_d,\n                                 best_circ, layer_list)", "return_statement": "return dagcircuit_output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "arg_7", "=", "arg_3", "arg_8", "=", "DAGCircuit", "(", ")", "arg_9", "=", "QuantumRegister", "(", "arg_0", ".", "coupling_map", ".", "size", "(", ")", ",", "'q'", ")", "arg_8", ".", "add_qreg", "(", "arg_9", ")", "arg_10", "=", "{", "(", "arg_9", ",", "arg_11", ")", ":", "(", "arg_9", ",", "arg_11", ")", "for", "arg_11", "in", "range", "(", "arg_0", ".", "coupling_map", ".", "size", "(", ")", ")", "}", "if", "arg_2", ":", "for", "arg_11", "in", "range", "(", "arg_1", "+", "1", ")", ":", "arg_8", ".", "compose_back", "(", "arg_6", "[", "arg_11", "]", "[", "\"graph\"", "]", ",", "arg_7", ")", "else", ":", "if", "arg_4", ">", "0", ":", "arg_8", ".", "compose_back", "(", "arg_5", ",", "arg_10", ")", "arg_8", ".", "compose_back", "(", "arg_6", "[", "arg_1", "]", "[", "\"graph\"", "]", ",", "arg_7", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                                 arg_5, arg_6):\n        \"\"\"Update the QASM string for an iteration of swap_mapper.\n\n        i = layer number\n        first_layer = True if this is the first layer with multi-qubit gates\n        best_layout = layout returned from swap algorithm\n        best_d = depth returned from swap algorithm\n        best_circ = swap circuit returned from swap algorithm\n        layer_list = list of circuit objects for each layer\n\n        Return DAGCircuit object to append to the output DAGCircuit.\n        \"\"\"\n        arg_7 = arg_3\n        arg_8 = DAGCircuit()\n        arg_9 = QuantumRegister(arg_0.coupling_map.size(), 'q')\n        arg_8.add_qreg(arg_9)\n        # Identity wire-map for composing the circuits\n        arg_10 = {(arg_9, arg_11): (arg_9, arg_11) for arg_11 in range(arg_0.coupling_map.size())}\n\n        # If this is the first layer with multi-qubit gates,\n        # output all layers up to this point and ignore any\n        # swap gates. Set the initial layout.\n        if arg_2:\n            # Output all layers up to this point\n            for arg_11 in range(arg_1 + 1):\n                arg_8.compose_back(arg_6[arg_11][\"graph\"], arg_7)\n        # Otherwise, we output the current layer and the associated swap gates.\n        else:\n            # Output any swaps\n            if arg_4 > 0:\n                arg_8.compose_back(arg_5, arg_10)\n\n            # Output this layer\n            arg_8.compose_back(arg_6[arg_1][\"graph\"], arg_7)\n        return arg_8", "path": "qiskit/transpiler/passes/mapping/legacy_swap.py", "identifier": "LegacySwap.swap_mapper_layer_update", "docstring": "Update the QASM string for an iteration of swap_mapper.\n\n        i = layer number\n        first_layer = True if this is the first layer with multi-qubit gates\n        best_layout = layout returned from swap algorithm\n        best_d = depth returned from swap algorithm\n        best_circ = swap circuit returned from swap algorithm\n        layer_list = list of circuit objects for each layer\n\n        Return DAGCircuit object to append to the output DAGCircuit.", "docstring_tokens": ["Update", "the", "QASM", "string", "for", "an", "iteration", "of", "swap_mapper", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259031}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L1406-L1424", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Stores several items from an iterable", "language": "python", "parameters": "(self, iterable, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_4", "[", "0", "]", "arg_6", "=", "arg_4", "[", "1", "]", "if", "len", "(", "arg_4", ")", ">", "2", ":", "arg_2", "=", "arg_4", "[", "2", "]", "if", "len", "(", "arg_4", ")", ">", "3", ":", "arg_3", "=", "arg_4", "[", "3", "]", "if", "len", "(", "arg_4", ")", ">", "4", ":", "raise", "RuntimeError", "(", "'You shall not pass!'", ")", "arg_0", ".", "store", "(", "arg_5", ",", "arg_6", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Stores several items from an iterable\n\n        Iterables are supposed to be of a format like `[(msg, item, args, kwarg),...]`\n        If `args` and `kwargs` are not part of a tuple, they are taken from the\n        current `args` and `kwargs` provided to this function.\n\n        \"\"\"\n        for arg_4 in arg_1:\n            arg_5 = arg_4[0]\n            arg_6 = arg_4[1]\n            if len(arg_4) > 2:\n                arg_2 = arg_4[2]\n            if len(arg_4) > 3:\n                arg_3 = arg_4[3]\n            if len(arg_4) > 4:\n                raise RuntimeError('You shall not pass!')\n\n            arg_0.store(arg_5, arg_6, *arg_2, **arg_3)", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._srvc_store_several_items", "docstring": "Stores several items from an iterable\n\n        Iterables are supposed to be of a format like `[(msg, item, args, kwarg),...]`\n        If `args` and `kwargs` are not part of a tuple, they are taken from the\n        current `args` and `kwargs` provided to this function.", "docstring_tokens": ["Stores", "several", "items", "from", "an", "iterable"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259032}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/generation.py#L702-L775", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This generates fake RRab light curves.", "language": "python", "parameters": "(\n        times,\n        mags=None,\n        errs=None,\n        paramdists={\n            'period':sps.uniform(loc=0.45,scale=0.35),\n            'fourierorder':[8,11],\n            'amplitude':sps.uniform(loc=0.4,scale=0.5),\n            'phioffset':np.pi,\n        },\n        magsarefluxes=False\n)", "return_statement": "return modeldict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "{", "'period'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "0.45", ",", "arg_7", "=", "0.35", ")", ",", "'fourierorder'", ":", "[", "8", ",", "11", "]", ",", "'amplitude'", ":", "arg_4", ".", "uniform", "(", "arg_6", "=", "0.4", ",", "arg_7", "=", "0.5", ")", ",", "'phioffset'", ":", "arg_8", ".", "pi", ",", "}", ",", "arg_10", "=", "False", ")", ":", "arg_11", "=", "generate_sinusoidal_lightcurve", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_10", "=", "arg_10", ")", "arg_11", "[", "'vartype'", "]", "=", "'RRab'", "return", "arg_11"], "function": "def Func(\n        arg_0,\n        arg_1=None,\n        arg_2=None,\n        arg_3={\n            'period':arg_4.uniform(arg_6=0.45,arg_7=0.35),\n            'fourierorder':[8,11],\n            'amplitude':arg_4.uniform(arg_6=0.4,arg_7=0.5),\n            'phioffset':arg_8.pi,\n        },\n        arg_10=False\n):\n    '''This generates fake RRab light curves.\n\n    Parameters\n    ----------\n\n    times : np.array\n        This is an array of time values that will be used as the time base.\n\n    mags,errs : np.array\n        These arrays will have the model added to them. If either is\n        None, `np.full_like(times, 0.0)` will used as a substitute and the model\n        light curve will be centered around 0.0.\n\n    paramdists : dict\n        This is a dict containing parameter distributions to use for the\n        model params, containing the following keys ::\n\n            {'period', 'fourierorder', 'amplitude'}\n\n        The values of these keys should all be 'frozen' scipy.stats distribution\n        objects, e.g.:\n\n        https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions\n        The variability epoch will be automatically chosen from a uniform\n        distribution between `times.min()` and `times.max()`.\n\n        The `amplitude` will be flipped automatically as appropriate if\n        `magsarefluxes=True`.\n\n    magsarefluxes : bool\n        If the generated time series is meant to be a flux time-series, set this\n        to True to get the correct sign of variability amplitude.\n\n    Returns\n    -------\n\n    dict\n        A dict of the form below is returned::\n\n            {'vartype': 'RRab',\n             'params': {'period': generated value of period,\n                        'epoch': generated value of epoch,\n                        'amplitude': generated value of amplitude,\n                        'fourierorder': generated value of fourier order,\n                        'fourieramps': generated values of fourier amplitudes,\n                        'fourierphases': generated values of fourier phases},\n             'times': the model times,\n             'mags': the model mags,\n             'errs': the model errs,\n             'varperiod': the generated period of variability == 'period'\n             'varamplitude': the generated amplitude of\n                             variability == 'amplitude'}\n\n    '''\n\n    arg_11 = generate_sinusoidal_lightcurve(arg_0,\n                                               arg_1=arg_1,\n                                               arg_2=arg_2,\n                                               arg_3=arg_3,\n                                               arg_10=arg_10)\n    arg_11['vartype'] = 'RRab'\n    return arg_11", "path": "astrobase/fakelcs/generation.py", "identifier": "generate_rrab_lightcurve", "docstring": "This generates fake RRab light curves.\n\n    Parameters\n    ----------\n\n    times : np.array\n        This is an array of time values that will be used as the time base.\n\n    mags,errs : np.array\n        These arrays will have the model added to them. If either is\n        None, `np.full_like(times, 0.0)` will used as a substitute and the model\n        light curve will be centered around 0.0.\n\n    paramdists : dict\n        This is a dict containing parameter distributions to use for the\n        model params, containing the following keys ::\n\n            {'period', 'fourierorder', 'amplitude'}\n\n        The values of these keys should all be 'frozen' scipy.stats distribution\n        objects, e.g.:\n\n        https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions\n        The variability epoch will be automatically chosen from a uniform\n        distribution between `times.min()` and `times.max()`.\n\n        The `amplitude` will be flipped automatically as appropriate if\n        `magsarefluxes=True`.\n\n    magsarefluxes : bool\n        If the generated time series is meant to be a flux time-series, set this\n        to True to get the correct sign of variability amplitude.\n\n    Returns\n    -------\n\n    dict\n        A dict of the form below is returned::\n\n            {'vartype': 'RRab',\n             'params': {'period': generated value of period,\n                        'epoch': generated value of epoch,\n                        'amplitude': generated value of amplitude,\n                        'fourierorder': generated value of fourier order,\n                        'fourieramps': generated values of fourier amplitudes,\n                        'fourierphases': generated values of fourier phases},\n             'times': the model times,\n             'mags': the model mags,\n             'errs': the model errs,\n             'varperiod': the generated period of variability == 'period'\n             'varamplitude': the generated amplitude of\n                             variability == 'amplitude'}", "docstring_tokens": ["This", "generates", "fake", "RRab", "light", "curves", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 259033}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L270-L332", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "List experiment groups for this project.", "language": "python", "parameters": "(ctx, query, sort, page)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "get_project_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ")", "arg_3", "=", "arg_3", "or", "1", "try", ":", "arg_6", "=", "PolyaxonClient", "(", ")", ".", "project", ".", "list_experiment_Func", "(", "username", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not get experiment Func for project `{}`.'", ".", "format", "(", "arg_5", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "arg_7", "=", "get_meta_response", "(", "arg_6", ")", "if", "arg_7", ":", "Printer", ".", "print_header", "(", "'Experiment Func for project `{}/{}`.'", ".", "format", "(", "arg_4", ",", "arg_5", ")", ")", "Printer", ".", "print_header", "(", "'Navigation:'", ")", "dict_tabulate", "(", "arg_7", ")", "else", ":", "Printer", ".", "print_header", "(", "'No experiment Func found for project `{}/{}`.'", ".", "format", "(", "arg_4", ",", "arg_5", ")", ")", "arg_8", "=", "[", "Printer", ".", "add_status_color", "(", "o", ".", "to_light_dict", "(", "humanize_values", "=", "True", ")", ")", "for", "o", "in", "arg_6", "[", "'results'", "]", "]", "arg_8", "=", "list_dicts_to_tabulate", "(", "arg_8", ")", "if", "arg_8", ":", "Printer", ".", "print_header", "(", "\"Experiment Func:\"", ")", "arg_8", ".", "pop", "(", "'project'", ",", "None", ")", "arg_8", ".", "pop", "(", "'user'", ",", "None", ")", "dict_tabulate", "(", "arg_8", ",", "is_list_dict", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"List experiment Func for this project.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    Get all Func:\n\n    \\b\n    ```bash\n    $ polyaxon project Func\n    ```\n\n    Get all Func with with status {created or running}, and\n    creation date between 2018-01-01 and 2018-01-02,\n    and search algorithm not in {grid or random search}\n\n    \\b\n    ```bash\n    $ polyaxon project Func \\\n      -q \"status:created|running, started_at:2018-01-01..2018-01-02, search_algorithm:~grid|random\"\n    ```\n\n    Get all Func sorted by update date\n\n    \\b\n    ```bash\n    $ polyaxon project Func -s \"-updated_at\"\n    ```\n    \"\"\"\n    arg_4, arg_5 = get_project_or_local(arg_0.obj.get('project'))\n\n    arg_3 = arg_3 or 1\n    try:\n        arg_6 = PolyaxonClient().project.list_experiment_Func(username=arg_4,\n                                                                   arg_5=arg_5,\n                                                                   arg_1=arg_1,\n                                                                   arg_2=arg_2,\n                                                                   arg_3=arg_3)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error(\n            'Could not get experiment Func for project `{}`.'.format(arg_5))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    arg_7 = get_meta_response(arg_6)\n    if arg_7:\n        Printer.print_header('Experiment Func for project `{}/{}`.'.format(arg_4, arg_5))\n        Printer.print_header('Navigation:')\n        dict_tabulate(arg_7)\n    else:\n        Printer.print_header('No experiment Func found for project `{}/{}`.'.format(\n            arg_4, arg_5))\n\n    arg_8 = [Printer.add_status_color(o.to_light_dict(humanize_values=True))\n               for o in arg_6['results']]\n    arg_8 = list_dicts_to_tabulate(arg_8)\n    if arg_8:\n        Printer.print_header(\"Experiment Func:\")\n        arg_8.pop('project', None)\n        arg_8.pop('user', None)\n        dict_tabulate(arg_8, is_list_dict=True)", "path": "polyaxon_cli/cli/project.py", "identifier": "groups", "docstring": "List experiment groups for this project.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    Get all groups:\n\n    \\b\n    ```bash\n    $ polyaxon project groups\n    ```\n\n    Get all groups with with status {created or running}, and\n    creation date between 2018-01-01 and 2018-01-02,\n    and search algorithm not in {grid or random search}\n\n    \\b\n    ```bash\n    $ polyaxon project groups \\\n      -q \"status:created|running, started_at:2018-01-01..2018-01-02, search_algorithm:~grid|random\"\n    ```\n\n    Get all groups sorted by update date\n\n    \\b\n    ```bash\n    $ polyaxon project groups -s \"-updated_at\"\n    ```", "docstring_tokens": ["List", "experiment", "groups", "for", "this", "project", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 259034}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/http_server.py#L38-L58", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Given a hostname and port attempting to be accessed,\n    return a unique consumer ID for accessing logs from\n    the referenced container.", "language": "python", "parameters": "()", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "arg_7", "arg_0", ",", "arg_1", "=", "request", ".", "form", "[", "'hostname'", "]", ",", "request", ".", "form", "[", "'port'", "]", "arg_2", "=", "_app_name_from_forwarding_info", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "get_dusty_containers", "(", "[", "arg_2", "]", ",", "include_exited", "=", "True", ")", "if", "not", "arg_3", ":", "raise", "ValueError", "(", "'No container exists for app {}'", ".", "format", "(", "arg_2", ")", ")", "arg_4", "=", "arg_3", "[", "0", "]", "arg_5", "=", "uuid1", "(", ")", "arg_6", "=", "Consumer", "(", "arg_4", "[", "'Id'", "]", ",", "datetime", ".", "utcnow", "(", ")", ")", "arg_7", "[", "arg_8", "(", "arg_5", ")", "]", "=", "arg_6", "arg_9", "=", "jsonify", "(", "{", "'app_name'", ":", "arg_2", ",", "'consumer_id'", ":", "arg_5", "}", ")", "arg_9", ".", "headers", "[", "'Access-Control-Allow-Origin'", "]", "=", "'*'", "arg_9", ".", "headers", "[", "'Access-Control-Allow-Methods'", "]", "=", "'GET, POST'", "return", "arg_9"], "function": "def Func():\n    \"\"\"Given a hostname and port attempting to be accessed,\n    return a unique consumer ID for accessing logs from\n    the referenced container.\"\"\"\n    global arg_7\n    arg_0, arg_1 = request.form['hostname'], request.form['port']\n\n    arg_2 = _app_name_from_forwarding_info(arg_0, arg_1)\n    arg_3 = get_dusty_containers([arg_2], include_exited=True)\n    if not arg_3:\n        raise ValueError('No container exists for app {}'.format(arg_2))\n    arg_4 = arg_3[0]\n\n    arg_5 = uuid1()\n    arg_6 = Consumer(arg_4['Id'], datetime.utcnow())\n    arg_7[arg_8(arg_5)] = arg_6\n\n    arg_9 = jsonify({'app_name': arg_2, 'consumer_id': arg_5})\n    arg_9.headers['Access-Control-Allow-Origin'] = '*'\n    arg_9.headers['Access-Control-Allow-Methods'] = 'GET, POST'\n    return arg_9", "path": "dusty/http_server.py", "identifier": "register_consumer", "docstring": "Given a hostname and port attempting to be accessed,\n    return a unique consumer ID for accessing logs from\n    the referenced container.", "docstring_tokens": ["Given", "a", "hostname", "and", "port", "attempting", "to", "be", "accessed", "return", "a", "unique", "consumer", "ID", "for", "accessing", "logs", "from", "the", "referenced", "container", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 259035}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/kuler.py#L84-L98", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the darkest swatch.\n        \n        Knowing the contract between a light and a dark swatch\n        can help us decide how to display readable typography.", "language": "python", "parameters": "(self)", "return_statement": "return rgb", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "(", "1.0", ",", "1.0", ",", "1.0", ")", ",", "3.0", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "arg_0", ":", "if", "arg_3", "+", "arg_4", "+", "arg_5", "<", "arg_2", ":", "arg_1", ",", "arg_2", "=", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", ",", "arg_3", "+", "arg_4", "+", "arg_5", "return", "arg_1"], "function": "def Func(arg_0):\n        \n        \"\"\" Returns the darkest swatch.\n        \n        Knowing the contract between a light and a dark swatch\n        can help us decide how to display readable typography.\n        \n        \"\"\"\n        \n        arg_1, arg_2 = (1.0, 1.0, 1.0), 3.0\n        for arg_3,arg_4,arg_5 in arg_0:\n            if arg_3+arg_4+arg_5 < arg_2:\n                arg_1, arg_2 = (arg_3,arg_4,arg_5), arg_3+arg_4+arg_5\n        \n        return arg_1", "path": "lib/web/kuler.py", "identifier": "KulerTheme._darkest", "docstring": "Returns the darkest swatch.\n        \n        Knowing the contract between a light and a dark swatch\n        can help us decide how to display readable typography.", "docstring_tokens": ["Returns", "the", "darkest", "swatch", ".", "Knowing", "the", "contract", "between", "a", "light", "and", "a", "dark", "swatch", "can", "help", "us", "decide", "how", "to", "display", "readable", "typography", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259036}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L251-L265", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns the length of the parameter range.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "f_has_range", "(", ")", ":", "raise", "TypeError", "(", "'Not applicable, parameter does not have a range'", ")", "elif", "hasattr", "(", "arg_0", ",", "'__len__'", ")", ":", "return", "len", "(", "arg_0", ")", "else", ":", "raise", "NotImplementedError", "(", "\"Should have implemented this.\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns the length of the parameter range.\n\n        Raises TypeError if the parameter has no range.\n\n        Does not need to be implemented if the parameter supports\n        ``__len__`` appropriately.\n\n        \"\"\"\n        if not arg_0.f_has_range():\n            raise TypeError('Not applicable, parameter does not have a range')\n        elif hasattr(arg_0, '__len__'):\n            return len(arg_0)\n        else:\n            raise NotImplementedError(\"Should have implemented this.\")", "path": "pypet/parameter.py", "identifier": "BaseParameter.f_get_range_length", "docstring": "Returns the length of the parameter range.\n\n        Raises TypeError if the parameter has no range.\n\n        Does not need to be implemented if the parameter supports\n        ``__len__`` appropriately.", "docstring_tokens": ["Returns", "the", "length", "of", "the", "parameter", "range", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259037}
{"url": "https://github.com/Music-Moo/music2storage/blob/de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2/music2storage/service.py#L167-L174", "sha": "de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2", "docstring_summary": "Initializes the connection attribute with the path to the user home folder's Music folder, and creates it if it doesn't exist.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "music_folder", "is", "None", ":", "arg_1", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", ",", "'Music'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "os", ".", "makedirs", "(", "arg_1", ")", "arg_0", ".", "music_folder", "=", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Initializes the Funcion attribute with the path to the user home folder's Music folder, and creates it if it doesn't exist.\"\"\"\n\n        if arg_0.music_folder is None:\n            arg_1 = os.path.join(os.path.expanduser('~'), 'Music')\n            if not os.path.exists(arg_1):\n                os.makedirs(arg_1)\n            arg_0.music_folder = arg_1", "path": "music2storage/service.py", "identifier": "LocalStorage.connect", "docstring": "Initializes the connection attribute with the path to the user home folder's Music folder, and creates it if it doesn't exist.", "docstring_tokens": ["Initializes", "the", "connection", "attribute", "with", "the", "path", "to", "the", "user", "home", "folder", "s", "Music", "folder", "and", "creates", "it", "if", "it", "doesn", "t", "exist", "."], "nwo": "Music-Moo/music2storage", "score": 0.23137166388621372, "idx": 259038}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v5_upload.py#L108-L118", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Given a LuminosoClient pointing to the root of the API, and a filename to\n    read JSON lines from, create a project from the documents in that file.", "language": "python", "parameters": "(\n    client, input_filename, language, name, account=None, progress=False\n)", "return_statement": "return create_project_with_docs(\n        client, docs, language, name, account, progress=progress\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "iterate_json_lines", "(", "arg_1", ")", "return", "create_project_with_docs", "(", "arg_0", ",", "arg_6", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=False\n):\n    \"\"\"\n    Given a LuminosoClient pointing to the root of the API, and a filename to\n    read JSON lines from, create a project from the documents in that file.\n    \"\"\"\n    arg_6 = iterate_json_lines(arg_1)\n    return create_project_with_docs(\n        arg_0, arg_6, arg_2, arg_3, arg_4, arg_5=arg_5\n    )", "path": "luminoso_api/v5_upload.py", "identifier": "upload_docs", "docstring": "Given a LuminosoClient pointing to the root of the API, and a filename to\n    read JSON lines from, create a project from the documents in that file.", "docstring_tokens": ["Given", "a", "LuminosoClient", "pointing", "to", "the", "root", "of", "the", "API", "and", "a", "filename", "to", "read", "JSON", "lines", "from", "create", "a", "project", "from", "the", "documents", "in", "that", "file", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 259039}
{"url": "https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/power.py#L197-L214", "sha": "46e12659b8d08af764dc09a1f31b0e85a68f808f", "docstring_summary": "Stop streaming samples from device and delete samples buffer", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "device", ".", "is_streaming", ":", "return", "arg_0", ".", "device", ".", "Func_stream", "(", ")", "arg_0", ".", "_writer", ".", "close", "(", ")", "arg_0", ".", "_bins", "=", "None", "arg_0", ".", "_repeats", "=", "None", "arg_0", ".", "_base_buffer_size", "=", "None", "arg_0", ".", "_max_buffer_size", "=", "None", "arg_0", ".", "_buffer_repeats", "=", "None", "arg_0", ".", "_buffer", "=", "None", "arg_0", ".", "_tune_delay", "=", "None", "arg_0", ".", "_reset_stream", "=", "None", "arg_0", ".", "_psd", "=", "None", "arg_0", ".", "_writer", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"Stop streaming samples from device and delete samples buffer\"\"\"\n        if not arg_0.device.is_streaming:\n            return\n\n        arg_0.device.Func_stream()\n        arg_0._writer.close()\n\n        arg_0._bins = None\n        arg_0._repeats = None\n        arg_0._base_buffer_size = None\n        arg_0._max_buffer_size = None\n        arg_0._buffer_repeats = None\n        arg_0._buffer = None\n        arg_0._tune_delay = None\n        arg_0._reset_stream = None\n        arg_0._psd = None\n        arg_0._writer = None", "path": "soapypower/power.py", "identifier": "SoapyPower.stop", "docstring": "Stop streaming samples from device and delete samples buffer", "docstring_tokens": ["Stop", "streaming", "samples", "from", "device", "and", "delete", "samples", "buffer"], "nwo": "xmikos/soapy_power", "score": 0.1984218952631984, "idx": 259040}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/PC.py#L167-L191", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Run PC on an undirected graph.", "language": "python", "parameters": "(self, data, graph, **kwargs)", "return_statement": "return nx.relabel_nodes(nx.DiGraph(results),\n                                {idx: i for idx, i in enumerate(data.columns)})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_0", ".", "arguments", "[", "'{CITEST}'", "]", "=", "arg_0", ".", "dir_CI_test", "[", "arg_0", ".", "CI_test", "]", "arg_0", ".", "arguments", "[", "'{METHOD_INDEP}'", "]", "=", "arg_0", ".", "dir_method_indep", "[", "arg_0", ".", "method_indep", "]", "arg_0", ".", "arguments", "[", "'{DIRECTED}'", "]", "=", "'TRUE'", "arg_0", ".", "arguments", "[", "'{ALPHA}'", "]", "=", "str", "(", "arg_0", ".", "alpha", ")", "arg_0", ".", "arguments", "[", "'{NJOBS}'", "]", "=", "str", "(", "arg_0", ".", "nb_jobs", ")", "arg_0", ".", "arguments", "[", "'{VERBOSE}'", "]", "=", "str", "(", "arg_0", ".", "verbose", ")", ".", "upper", "(", ")", "arg_5", "=", "DataFrame", "(", "nx", ".", "adj_matrix", "(", "arg_2", ",", "weight", "=", "None", ")", ".", "todense", "(", ")", ")", "arg_6", "=", "DataFrame", "(", "1", "-", "arg_5", ".", "values", ")", "arg_7", "=", "arg_0", ".", "_run_pc", "(", "arg_1", ",", "fixedEdges", "=", "arg_5", ",", "fixedGaps", "=", "arg_6", ",", "verbose", "=", "arg_0", ".", "verbose", ")", "return", "nx", ".", "relabel_nodes", "(", "nx", ".", "DiGraph", "(", "arg_7", ")", ",", "{", "arg_8", ":", "arg_9", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_1", ".", "columns", ")", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Run PC on an undirected graph.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n            graph (networkx.Graph): Skeleton of the graph to orient\n\n        Returns:\n            networkx.DiGraph: Solution given by PC on the given skeleton.\n        \"\"\"\n        # Building setup w/ arguments.\n        arg_0.arguments['{CITEST}'] = arg_0.dir_CI_test[arg_0.CI_test]\n        arg_0.arguments['{METHOD_INDEP}'] = arg_0.dir_method_indep[arg_0.method_indep]\n        arg_0.arguments['{DIRECTED}'] = 'TRUE'\n        arg_0.arguments['{ALPHA}'] = str(arg_0.alpha)\n        arg_0.arguments['{NJOBS}'] = str(arg_0.nb_jobs)\n        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()\n\n        arg_5 = DataFrame(nx.adj_matrix(arg_2, weight=None).todense())\n        arg_6 = DataFrame(1 - arg_5.values)\n\n        arg_7 = arg_0._run_pc(arg_1, fixedEdges=arg_5, fixedGaps=arg_6, verbose=arg_0.verbose)\n\n        return nx.relabel_nodes(nx.DiGraph(arg_7),\n                                {arg_8: arg_9 for arg_8, arg_9 in enumerate(arg_1.columns)})", "path": "cdt/causality/graph/PC.py", "identifier": "PC.orient_undirected_graph", "docstring": "Run PC on an undirected graph.\n\n        Args:\n            data (pandas.DataFrame): DataFrame containing the data\n            graph (networkx.Graph): Skeleton of the graph to orient\n\n        Returns:\n            networkx.DiGraph: Solution given by PC on the given skeleton.", "docstring_tokens": ["Run", "PC", "on", "an", "undirected", "graph", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 259041}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/logscrapedaily.py#L487-L513", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "From user input, grab the jenkins job name and saved it in g_failed_test_info_dict.\n    In addition, it will grab the jenkins url and the view name into g_jenkins_url, and\n    g_view_name.", "language": "python", "parameters": "(url_string)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "global", "arg_2", "global", "arg_3", "global", "arg_4", "arg_1", "=", "arg_0", ".", "strip", "(", "'/'", ")", ".", "split", "(", "'/'", ")", "if", "len", "(", "arg_1", ")", "<", "6", ":", "print", "\"Illegal URL resource address.\\n\"", "sys", ".", "exit", "(", "1", ")", "arg_2", "[", "\"1.jobName\"", "]", "=", "arg_1", "[", "6", "]", "arg_3", "=", "arg_1", "[", "2", "]", "arg_4", "=", "arg_1", "[", "4", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    From user input, grab the jenkins job name and saved it in g_failed_test_info_dict.\n    In addition, it will grab the jenkins url and the view name into g_jenkins_url, and\n    g_view_name.\n\n    Parameters\n    ----------\n    url_string :  str\n        contains information on the jenkins job whose console output we are interested in.\n\n    :return: none\n    \"\"\"\n    global arg_2\n    global arg_3\n    global arg_4\n    \n    arg_1 = arg_0.strip('/').split('/')\n\n    if len(arg_1) < 6:\n        print \"Illegal URL resource address.\\n\"\n        sys.exit(1)\n        \n    arg_2[\"1.jobName\"] = arg_1[6]\n        \n    arg_3 = arg_1[2]\n    arg_4 = arg_1[4]", "path": "scripts/logscrapedaily.py", "identifier": "extract_job_build_url", "docstring": "From user input, grab the jenkins job name and saved it in g_failed_test_info_dict.\n    In addition, it will grab the jenkins url and the view name into g_jenkins_url, and\n    g_view_name.\n\n    Parameters\n    ----------\n    url_string :  str\n        contains information on the jenkins job whose console output we are interested in.\n\n    :return: none", "docstring_tokens": ["From", "user", "input", "grab", "the", "jenkins", "job", "name", "and", "saved", "it", "in", "g_failed_test_info_dict", ".", "In", "addition", "it", "will", "grab", "the", "jenkins", "url", "and", "the", "view", "name", "into", "g_jenkins_url", "and", "g_view_name", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259042}
{"url": "https://github.com/dogoncouch/lightcli/blob/e63093dfc4f983ec9c9571ff186bf114c1f782c3/lightcli.py#L121-L155", "sha": "e63093dfc4f983ec9c9571ff186bf114c1f782c3", "docstring_summary": "Get a list of strings as input", "language": "python", "parameters": "(prompt='List input - enter each item on a seperate line\\n' + \\\n        'Enter EOF on a blank line to end ' + \\\n        '(ctrl-D in *nix, ctrl-Z in windows)',\n        maxitems=None, maxlength=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'List input - enter each item on a seperate line\\n'", "+", "'Enter EOF on a blank line to end '", "+", "'(ctrl-D in *nix, ctrl-Z in windows)'", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "]", "print", "(", "arg_0", ")", "arg_4", "=", "1", "try", ":", "while", "True", ":", "if", "arg_1", ":", "if", "arg_4", ">", "arg_1", ":", "break", "else", ":", "if", "arg_2", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", "[", ":", "arg_2", "]", ")", "else", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", ")", "arg_4", "+=", "1", "else", ":", "if", "arg_2", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", "[", ":", "arg_2", "]", ")", "else", ":", "arg_3", ".", "append", "(", "string_input", "(", "''", ")", ")", "except", "EOFError", ":", "pass", "finally", ":", "return", "arg_3"], "function": "def Func(arg_0='List input - enter each item on a seperate line\\n' + \\\n        'Enter EOF on a blank line to end ' + \\\n        '(ctrl-D in *nix, ctrl-Z in windows)',\n        arg_1=None, arg_2=None):\n    \"\"\"Get a list of strings as input\"\"\"\n    \n    arg_3 = []\n    print(arg_0)\n    arg_4 = 1\n\n    try:\n\n        while True:\n        \n            if arg_1:\n            \n                if arg_4 > arg_1:\n                    break\n                else:\n                    if arg_2:\n                        arg_3.append(string_input('')[:arg_2])\n                    else:\n                        arg_3.append(string_input(''))\n                    arg_4 += 1\n            \n            else:\n                if arg_2:\n                    arg_3.append(string_input('')[:arg_2])\n                else:\n                    arg_3.append(string_input(''))\n\n    except EOFError:\n        pass\n    finally:\n        return arg_3", "path": "lightcli.py", "identifier": "list_input", "docstring": "Get a list of strings as input", "docstring_tokens": ["Get", "a", "list", "of", "strings", "as", "input"], "nwo": "dogoncouch/lightcli", "score": 0.18941942438232184, "idx": 259043}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L399-L417", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return load and store distances between accesses.", "language": "python", "parameters": "(self, sympy_accesses=None)", "return_statement": "return sympy_distances", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "compile_sympy_accesses", "(", ")", "arg_2", "=", "defaultdict", "(", "list", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "for", "arg_5", "in", "range", "(", "1", ",", "len", "(", "arg_4", ")", ")", ":", "arg_2", "[", "arg_3", "]", ".", "append", "(", "(", "arg_4", "[", "arg_5", "-", "1", "]", "-", "arg_4", "[", "arg_5", "]", ")", ".", "simplify", "(", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Return load and store distances between accesses.\n\n        :param sympy_accesses: optionally restrict accesses, default from compile_sympy_accesses()\n\n        e.g. if accesses are to [+N, +1, -1, -N], relative distances are [N-1, 2, N-1]\n\n        returned is a dict of list of sympy expressions, for each variable\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.compile_sympy_accesses()\n\n        arg_2 = defaultdict(list)\n        for arg_3, arg_4 in arg_1.items():\n            for arg_5 in range(1, len(arg_4)):\n                arg_2[arg_3].append((arg_4[arg_5-1]-arg_4[arg_5]).simplify())\n\n        return arg_2", "path": "kerncraft/kernel.py", "identifier": "Kernel.compile_relative_distances", "docstring": "Return load and store distances between accesses.\n\n        :param sympy_accesses: optionally restrict accesses, default from compile_sympy_accesses()\n\n        e.g. if accesses are to [+N, +1, -1, -N], relative distances are [N-1, 2, N-1]\n\n        returned is a dict of list of sympy expressions, for each variable", "docstring_tokens": ["Return", "load", "and", "store", "distances", "between", "accesses", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 259044}
{"url": "https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/tasks.py#L35-L39", "sha": "3ebd891ac0c02bad061182dbcb54a47fb21980ae", "docstring_summary": "Run multiple commmands in a row, exiting if one fails.", "language": "python", "parameters": "(self, cmds, shell=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "for", "arg_3", "in", "arg_1", ":", "if", "subprocess", ".", "call", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", "==", "1", ":", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Run multiple commmands in a row, exiting if one fails.\"\"\"\n        for arg_3 in arg_1:\n            if subprocess.call(arg_3, arg_2=arg_2) == 1:\n                sys.exit(1)", "path": "tasks.py", "identifier": "BaseCommand.call_in_sequence", "docstring": "Run multiple commmands in a row, exiting if one fails.", "docstring_tokens": ["Run", "multiple", "commmands", "in", "a", "row", "exiting", "if", "one", "fails", "."], "nwo": "dbcli/cli_helpers", "score": 0.43979569135490515, "idx": 259045}
{"url": "https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L305-L312", "sha": "804728974fcefaafc8b5994be65d22e9c198a8d1", "docstring_summary": "Read the last conversion result when in continuous conversion mode.\n        Will return a signed integer value.", "language": "python", "parameters": "(self)", "return_statement": "return self._conversion_value(result[1], result[0])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_device", ".", "readList", "(", "ADS1x15_POINTER_CONVERSION", ",", "2", ")", "return", "arg_0", ".", "_conversion_value", "(", "arg_1", "[", "1", "]", ",", "arg_1", "[", "0", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"Read the last conversion result when in continuous conversion mode.\n        Will return a signed integer value.\n        \"\"\"\n        # Retrieve the conversion register value, convert to a signed int, and\n        # return it.\n        arg_1 = arg_0._device.readList(ADS1x15_POINTER_CONVERSION, 2)\n        return arg_0._conversion_value(arg_1[1], arg_1[0])", "path": "Adafruit_ADS1x15/ADS1x15.py", "identifier": "ADS1x15.get_last_result", "docstring": "Read the last conversion result when in continuous conversion mode.\n        Will return a signed integer value.", "docstring_tokens": ["Read", "the", "last", "conversion", "result", "when", "in", "continuous", "conversion", "mode", ".", "Will", "return", "a", "signed", "integer", "value", "."], "nwo": "adafruit/Adafruit_Python_ADS1x15", "score": 0.7418796736471075, "idx": 259046}
{"url": "https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/datatypes.py#L664-L674", "sha": "3ff76407af0e71621dada744cd964611e998699c", "docstring_summary": "Return list of files in filetree.", "language": "python", "parameters": "(self)", "return_statement": "return self._filelist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ".", "_Func", ")", "==", "0", ":", "for", "arg_1", "in", "arg_0", ".", "_data", ":", "if", "isinstance", "(", "arg_0", ".", "_data", "[", "arg_1", "]", ",", "filetree", ")", ":", "arg_0", ".", "_Func", ".", "extend", "(", "arg_0", ".", "_data", "[", "arg_1", "]", ".", "Func", "(", ")", ")", "else", ":", "arg_0", ".", "_Func", ".", "append", "(", "arg_0", ".", "_data", "[", "arg_1", "]", ")", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Return list of files in filetree.\n        \"\"\"\n        if len(arg_0._Func) == 0:\n            for arg_1 in arg_0._data:\n                if isinstance(arg_0._data[arg_1], filetree):\n                    arg_0._Func.extend(arg_0._data[arg_1].Func())\n                else:\n                    arg_0._Func.append(arg_0._data[arg_1])\n        return arg_0._Func", "path": "gems/datatypes.py", "identifier": "filetree.filelist", "docstring": "Return list of files in filetree.", "docstring_tokens": ["Return", "list", "of", "files", "in", "filetree", "."], "nwo": "bprinty/gems", "score": 0.16246995141409282, "idx": 259047}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/sbml.py#L100-L102", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Clips a prefix from the beginning of a string if it exists.", "language": "python", "parameters": "(sid, prefix)", "return_statement": "return sid[len(prefix):] if sid.startswith(prefix) else sid", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", "[", "len", "(", "arg_1", ")", ":", "]", "if", "arg_0", ".", "startswith", "(", "arg_1", ")", "else", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Clips a prefix from the beginning of a string if it exists.\"\"\"\n    return arg_0[len(arg_1):] if arg_0.startswith(arg_1) else arg_0", "path": "cobra/io/sbml.py", "identifier": "_clip", "docstring": "Clips a prefix from the beginning of a string if it exists.", "docstring_tokens": ["Clips", "a", "prefix", "from", "the", "beginning", "of", "a", "string", "if", "it", "exists", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259048}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/text.py#L110-L113", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Index a whole collection of files.", "language": "python", "parameters": "(self, filenames)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "arg_0", ".", "index_document", "(", "open", "(", "arg_2", ")", ".", "read", "(", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"Index a whole collection of files.\"\n        for arg_2 in arg_1:\n            arg_0.index_document(open(arg_2).read(), arg_2)", "path": "aima/text.py", "identifier": "IRSystem.index_collection", "docstring": "Index a whole collection of files.", "docstring_tokens": ["Index", "a", "whole", "collection", "of", "files", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 259049}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L81-L83", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Retrieves the related value from the stored user data.", "language": "python", "parameters": "(self, key: object, default=None)", "return_statement": "return self._user_data.get(key, default)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", "=", "None", ")", ":", "return", "arg_0", ".", "_user_data", ".", "get", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3=None):\r\n        \"\"\" Retrieves the related value from the stored user data. \"\"\"\r\n        return arg_0._user_data.get(arg_1, arg_3)", "path": "lavalink/PlayerManager.py", "identifier": "DefaultPlayer.fetch", "docstring": "Retrieves the related value from the stored user data.", "docstring_tokens": ["Retrieves", "the", "related", "value", "from", "the", "stored", "user", "data", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 259050}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L83-L103", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Write msgstr for every language with all needed metadata and comment.\n    Metadata are parser from string into dict, so read them only from gdocs.", "language": "python", "parameters": "(po_files, languages, msgid, msgstrs, metadata, comment)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "re", ".", "compile", "(", "r'^[\\s]+'", ")", "arg_7", "=", "re", ".", "compile", "(", "r'[\\s]+$'", ")", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_1", ")", ":", "arg_10", "=", "ast", ".", "literal_eval", "(", "arg_4", ")", "arg_11", "=", "polib", ".", "POEntry", "(", "**", "arg_10", ")", "arg_11", ".", "tcomment", "=", "arg_5", "arg_11", ".", "msgid", "=", "arg_2", "if", "arg_3", "[", "arg_8", "]", ":", "arg_13", "=", "arg_6", ".", "search", "(", "arg_2", ")", "arg_14", "=", "arg_7", ".", "search", "(", "arg_2", ")", "arg_11", ".", "msgstr", "=", "str", "(", "arg_13", ".", "group", "(", ")", "if", "arg_13", "else", "''", ")", "+", "unicode", "(", "arg_3", "[", "arg_8", "]", ".", "strip", "(", ")", ")", "+", "str", "(", "arg_14", ".", "group", "(", ")", "if", "arg_14", "else", "''", ")", "else", ":", "arg_11", ".", "msgstr", "=", "''", "arg_0", "[", "arg_9", "]", ".", "append", "(", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"\n    Write msgstr for every language with all needed metadata and comment.\n    Metadata are parser from string into dict, so read them only from gdocs.\n    \"\"\"\n    arg_6 = re.compile(r'^[\\s]+')\n    arg_7 = re.compile(r'[\\s]+$')\n    for arg_8, arg_9 in enumerate(arg_1):\n        arg_10 = ast.literal_eval(arg_4)\n        arg_11 = polib.POEntry(**arg_10)\n        arg_11.tcomment = arg_5\n        arg_11.msgid = arg_2\n        if arg_3[arg_8]:\n            arg_13 = arg_6.search(arg_2)\n            arg_14 = arg_7.search(arg_2)\n            arg_11.msgstr = str(arg_13.group() if arg_13 else '') + \\\n                unicode(arg_3[arg_8].strip()) + \\\n                str(arg_14.group() if arg_14 else '')\n        else:\n            arg_11.msgstr = ''\n        arg_0[arg_9].append(arg_11)", "path": "c3po/converters/po_csv.py", "identifier": "_write_entries", "docstring": "Write msgstr for every language with all needed metadata and comment.\n    Metadata are parser from string into dict, so read them only from gdocs.", "docstring_tokens": ["Write", "msgstr", "for", "every", "language", "with", "all", "needed", "metadata", "and", "comment", ".", "Metadata", "are", "parser", "from", "string", "into", "dict", "so", "read", "them", "only", "from", "gdocs", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 259051}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/query.py#L337-L353", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Get file data for the given user_id, path, and query_fields.  The\n    query_fields parameter specifies which database fields should be\n    included in the returned file data.", "language": "python", "parameters": "(db, user_id, api_path, query_fields, decrypt_func)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "execute", "(", "_select_file", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "limit", "=", "1", ")", ",", ")", ".", "first", "(", ")", "if", "arg_5", "is", "None", ":", "raise", "NoSuchFile", "(", "arg_2", ")", "if", "files", ".", "c", ".", "content", "in", "arg_3", ":", "return", "to_dict_with_content", "(", "arg_3", ",", "arg_5", ",", "arg_4", ")", "else", ":", "return", "to_dict_no_content", "(", "arg_3", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Get file data for the given user_id, path, and query_fields.  The\n    query_fields parameter specifies which database fields should be\n    included in the returned file data.\n    \"\"\"\n    arg_5 = arg_0.execute(\n        _select_file(arg_1, arg_2, arg_3, limit=1),\n    ).first()\n\n    if arg_5 is None:\n        raise NoSuchFile(arg_2)\n\n    if files.c.content in arg_3:\n        return to_dict_with_content(arg_3, arg_5, arg_4)\n    else:\n        return to_dict_no_content(arg_3, arg_5)", "path": "pgcontents/query.py", "identifier": "_get_file", "docstring": "Get file data for the given user_id, path, and query_fields.  The\n    query_fields parameter specifies which database fields should be\n    included in the returned file data.", "docstring_tokens": ["Get", "file", "data", "for", "the", "given", "user_id", "path", "and", "query_fields", ".", "The", "query_fields", "parameter", "specifies", "which", "database", "fields", "should", "be", "included", "in", "the", "returned", "file", "data", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 259052}
{"url": "https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/models.py#L36-L40", "sha": "8170e431362dc760589f7d141090fd133dece259", "docstring_summary": "Checks if required directories exist and creates them if needed.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ".", "workdir", ")", "==", "False", ":", "os", ".", "mkdir", "(", "arg_0", ".", "workdir", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Checks if required directories exist and creates them if needed.\n    \"\"\"\n    if os.path.isdir(arg_0.workdir) == False: os.mkdir(arg_0.workdir)", "path": "argiope/models.py", "identifier": "Model.make_directories", "docstring": "Checks if required directories exist and creates them if needed.", "docstring_tokens": ["Checks", "if", "required", "directories", "exist", "and", "creates", "them", "if", "needed", "."], "nwo": "lcharleux/argiope", "score": 0.17185066990864498, "idx": 259053}
{"url": "https://github.com/chrisnorman7/wxgoodies/blob/0064e4d5784714b90357ebb0bc721395e103349b/wxgoodies/keys.py#L102-L109", "sha": "0064e4d5784714b90357ebb0bc721395e103349b", "docstring_summary": "Get a new id if the provided one is None.", "language": "python", "parameters": "(id)", "return_statement": "return id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "None", ":", "arg_0", "=", "wx", ".", "NewId", "(", ")", "logger", ".", "debug", "(", "'Generated new ID %s.'", ",", "arg_0", ")", "else", ":", "logger", ".", "debug", "(", "'Using provided id %s.'", ",", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n \"\"\"Get a new id if the provided one is None.\"\"\"\n if arg_0 == None:\n  arg_0 = wx.NewId()\n  logger.debug('Generated new ID %s.', arg_0)\n else:\n  logger.debug('Using provided id %s.', arg_0)\n return arg_0", "path": "wxgoodies/keys.py", "identifier": "get_id", "docstring": "Get a new id if the provided one is None.", "docstring_tokens": ["Get", "a", "new", "id", "if", "the", "provided", "one", "is", "None", "."], "nwo": "chrisnorman7/wxgoodies", "score": 0.17782712273869106, "idx": 259054}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L2547-L2566", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Compute the iSAX index for DataFrame which is assumed to be numeric time series data.", "language": "python", "parameters": "(self, num_words, max_cardinality, optimize_card=False, **kwargs)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"isax\", self, num_words, max_cardinality, optimize_card))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "if", "arg_1", "<=", "0", ":", "raise", "H2OValueError", "(", "\"num_words must be greater than 0\"", ")", "if", "arg_2", "<=", "0", ":", "raise", "H2OValueError", "(", "\"max_cardinality must be greater than 0\"", ")", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, **arg_4):\n        \"\"\"\n        Compute the iSAX index for DataFrame which is assumed to be numeric time series data.\n\n        References:\n\n            - http://www.cs.ucr.edu/~eamonn/SAX.pdf\n            - http://www.cs.ucr.edu/~eamonn/iSAX_2.0.pdf\n\n        :param int num_words: Number of iSAX words for the timeseries, i.e. granularity along the time series\n        :param int max_cardinality: Maximum cardinality of the iSAX word. Each word can have less than the max\n        :param bool optimized_card: An optimization flag that will find the max cardinality regardless of what is\n            passed in for ``max_cardinality``.\n\n        :returns: An H2OFrame with the name of time series, string representation of iSAX word, followed by\n            binary representation.\n        \"\"\"\n        if arg_1 <= 0: raise H2OValueError(\"num_words must be greater than 0\")\n        if arg_2 <= 0: raise H2OValueError(\"max_cardinality must be greater than 0\")\n        return H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, arg_1, arg_2, arg_3))", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.isax", "docstring": "Compute the iSAX index for DataFrame which is assumed to be numeric time series data.\n\n        References:\n\n            - http://www.cs.ucr.edu/~eamonn/SAX.pdf\n            - http://www.cs.ucr.edu/~eamonn/iSAX_2.0.pdf\n\n        :param int num_words: Number of iSAX words for the timeseries, i.e. granularity along the time series\n        :param int max_cardinality: Maximum cardinality of the iSAX word. Each word can have less than the max\n        :param bool optimized_card: An optimization flag that will find the max cardinality regardless of what is\n            passed in for ``max_cardinality``.\n\n        :returns: An H2OFrame with the name of time series, string representation of iSAX word, followed by\n            binary representation.", "docstring_tokens": ["Compute", "the", "iSAX", "index", "for", "DataFrame", "which", "is", "assumed", "to", "be", "numeric", "time", "series", "data", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259055}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/db_utils.py#L84-L101", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Convert a SQLAlchemy row that contains a 'content' field to a dict.", "language": "python", "parameters": "(fields, row, decrypt_func)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "(", "len", "(", "arg_0", ")", "==", "len", "(", "arg_1", ")", ")", "arg_3", "=", "list", "(", "map", "(", "_get_name", ",", "arg_0", ")", ")", "assert", "'content'", "in", "arg_3", ",", "\"Missing content field.\"", "arg_4", "=", "dict", "(", "zip", "(", "arg_3", ",", "arg_1", ")", ")", "arg_4", "[", "'content'", "]", "=", "arg_2", "(", "arg_4", "[", "'content'", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Convert a SQLAlchemy row that contains a 'content' field to a dict.\n\n    ``decrypt_func`` will be applied to the ``content`` field of the row.\n\n    If row is None, return None.\n\n    Raises AssertionError if there is no field named 'content' in ``fields``.\n    \"\"\"\n    assert(len(arg_0) == len(arg_1))\n\n    arg_3 = list(map(_get_name, arg_0))\n    assert 'content' in arg_3, \"Missing content field.\"\n\n    arg_4 = dict(zip(arg_3, arg_1))\n    arg_4['content'] = arg_2(arg_4['content'])\n    return arg_4", "path": "pgcontents/db_utils.py", "identifier": "to_dict_with_content", "docstring": "Convert a SQLAlchemy row that contains a 'content' field to a dict.\n\n    ``decrypt_func`` will be applied to the ``content`` field of the row.\n\n    If row is None, return None.\n\n    Raises AssertionError if there is no field named 'content' in ``fields``.", "docstring_tokens": ["Convert", "a", "SQLAlchemy", "row", "that", "contains", "a", "content", "field", "to", "a", "dict", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 259056}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L162-L176", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "return appropriate HTML determined by file extension.", "language": "python", "parameters": "(self,fname)", "return_statement": "return html", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "os", ".", "path", ".", "splitext", "(", "arg_1", ")", "[", "1", "]", ".", "lower", "(", ")", "in", "[", "'.jpg'", ",", "'.png'", "]", ":", "arg_2", "=", "'<a href=\"%s\"><img src=\"%s\"></a>'", "%", "(", "arg_1", ",", "arg_1", ")", "if", "\"_tif_\"", "in", "arg_1", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "'<img '", ",", "'<img class=\"datapic micrograph\"'", ")", "if", "\"_plot_\"", "in", "arg_1", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "'<img '", ",", "'<img class=\"datapic intrinsic\" '", ")", "if", "\"_experiment_\"", "in", "arg_1", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "'<img '", ",", "'<img class=\"datapic experiment\" '", ")", "elif", "os", ".", "path", ".", "splitext", "(", "arg_1", ")", "[", "1", "]", ".", "lower", "(", ")", "in", "[", "'.html'", ",", "'.htm'", "]", ":", "arg_2", "=", "'LINK: %s'", "%", "arg_1", "else", ":", "arg_2", "=", "'<br>Not sure how to show: [%s]</br>'", "%", "arg_1", "return", "arg_2"], "function": "def Func(arg_0,arg_1):\n        \"\"\"return appropriate HTML determined by file extension.\"\"\"\n        if os.path.splitext(arg_1)[1].lower() in ['.jpg','.png']:\n            arg_2='<a href=\"%s\"><img src=\"%s\"></a>'%(arg_1,arg_1)\n            if \"_tif_\" in arg_1:\n                arg_2=arg_2.replace('<img ','<img class=\"datapic micrograph\"')\n            if \"_plot_\" in arg_1:\n                arg_2=arg_2.replace('<img ','<img class=\"datapic intrinsic\" ')\n            if \"_experiment_\" in arg_1:\n                arg_2=arg_2.replace('<img ','<img class=\"datapic experiment\" ')\n        elif os.path.splitext(arg_1)[1].lower() in ['.html','.htm']:\n            arg_2='LINK: %s'%arg_1\n        else:\n            arg_2='<br>Not sure how to show: [%s]</br>'%arg_1\n        return arg_2", "path": "swhlab/indexing/indexing.py", "identifier": "INDEX.htmlFor", "docstring": "return appropriate HTML determined by file extension.", "docstring_tokens": ["return", "appropriate", "HTML", "determined", "by", "file", "extension", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 259057}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L163-L182", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Launches GBDX batch workflow.", "language": "python", "parameters": "(self, batch_workflow)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'%(base_url)s/batch_workflows'", "%", "{", "'base_url'", ":", "arg_0", ".", "base_url", "}", "try", ":", "arg_3", "=", "arg_0", ".", "gbdx_connection", ".", "post", "(", "arg_2", ",", "json", "=", "arg_1", ")", "arg_4", "=", "arg_3", ".", "json", "(", ")", "[", "'batch_workflow_id'", "]", "return", "arg_4", "except", "TypeError", "as", "e", ":", "arg_0", ".", "logger", ".", "debug", "(", "'Batch Workflow not launched, reason: {0}'", ".", "format", "(", "e", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Launches GBDX batch workflow.\n\n        Args:\n            batch_workflow (dict): Dictionary specifying batch workflow tasks.\n\n        Returns:\n            Batch Workflow id (str).\n        \"\"\"\n\n        # hit workflow api\n        arg_2 = '%(base_url)s/batch_workflows' % {\n            'base_url': arg_0.base_url\n        }\n        try:\n            arg_3 = arg_0.gbdx_connection.post(arg_2, json=arg_1)\n            arg_4 = arg_3.json()['batch_workflow_id']\n            return arg_4\n        except TypeError as e:\n            arg_0.logger.debug('Batch Workflow not launched, reason: {0}'.format(e))", "path": "gbdxtools/workflow.py", "identifier": "Workflow.launch_batch_workflow", "docstring": "Launches GBDX batch workflow.\n\n        Args:\n            batch_workflow (dict): Dictionary specifying batch workflow tasks.\n\n        Returns:\n            Batch Workflow id (str).", "docstring_tokens": ["Launches", "GBDX", "batch", "workflow", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 259058}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L275-L290", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Scan for FCs in the given id ranges.", "language": "python", "parameters": "(self, *key_ranges, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "_Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "yield", "did", "(", "arg_3", "[", "'_id'", "]", ")", ",", "arg_0", ".", "fc_from_dict", "(", "arg_3", "[", "'_source'", "]", "[", "'fc'", "]", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        '''Scan for FCs in the given id ranges.\n\n        :param key_ranges:\n          ``key_ranges`` should be a list of pairs of ranges. The first\n          value is the lower bound id and the second value is the\n          upper bound id. Use ``()`` in either position to leave it\n          unbounded. If no ``key_ranges`` are given, then all FCs in\n          the store are returned.\n        :param [str] feature_names:\n          A list of feature names to retrieve. When ``None``, all\n          features are retrieved. Wildcards are allowed.\n        :rtype: Iterable of ``(content_id, FC)``\n        '''\n        for arg_3 in arg_0._Func(*arg_1, **arg_2):\n            yield did(arg_3['_id']), arg_0.fc_from_dict(arg_3['_source']['fc'])", "path": "dossier/store/elastic.py", "identifier": "ElasticStore.scan", "docstring": "Scan for FCs in the given id ranges.\n\n        :param key_ranges:\n          ``key_ranges`` should be a list of pairs of ranges. The first\n          value is the lower bound id and the second value is the\n          upper bound id. Use ``()`` in either position to leave it\n          unbounded. If no ``key_ranges`` are given, then all FCs in\n          the store are returned.\n        :param [str] feature_names:\n          A list of feature names to retrieve. When ``None``, all\n          features are retrieved. Wildcards are allowed.\n        :rtype: Iterable of ``(content_id, FC)``", "docstring_tokens": ["Scan", "for", "FCs", "in", "the", "given", "id", "ranges", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 259059}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3305-L3312", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Jumps short if not below.", "language": "python", "parameters": "(cpu, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "arg_0", ".", "CF", "==", "False", ",", "arg_1", ".", "read", "(", ")", ",", "arg_0", ".", "PC", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Jumps short if not below.\n\n        :param cpu: current CPU.\n        :param target: destination operand.\n        \"\"\"\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, arg_0.CF == False, arg_1.read(), arg_0.PC)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.JNB", "docstring": "Jumps short if not below.\n\n        :param cpu: current CPU.\n        :param target: destination operand.", "docstring_tokens": ["Jumps", "short", "if", "not", "below", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259060}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/client/client.py#L457-L486", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "PUTs the container and returns the results. This is usually\n        done to create new containers and can also be used to set\n        X-Container-Meta-xxx headers. Note that if the container\n        already exists, any existing X-Container-Meta-xxx headers will\n        remain untouched. To remove an X-Container-Meta-xxx header,\n        send the header with an empty string as its value.", "language": "python", "parameters": "(self, container, headers=None, query=None, cdn=False,\n                      body=None)", "return_statement": "return self.request(\n            'PUT', path, body or '', headers, query=query, cdn=cdn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_0", ".", "_container_path", "(", "arg_1", ")", "return", "arg_0", ".", "request", "(", "'PUT'", ",", "arg_6", ",", "arg_5", "or", "''", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False,\n                      arg_5=None):\n        \"\"\"\n        PUTs the container and returns the results. This is usually\n        done to create new containers and can also be used to set\n        X-Container-Meta-xxx headers. Note that if the container\n        already exists, any existing X-Container-Meta-xxx headers will\n        remain untouched. To remove an X-Container-Meta-xxx header,\n        send the header with an empty string as its value.\n\n        :param container: The name of the container.\n        :param headers: Additional headers to send with the request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :param body: Some container PUT requests, like the\n            extract-archive bulk upload request, take a body.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: is the str for the HTTP body.\n        \"\"\"\n        arg_6 = arg_0._container_path(arg_1)\n        return arg_0.request(\n            'PUT', arg_6, arg_5 or '', arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "swiftly/client/client.py", "identifier": "Client.put_container", "docstring": "PUTs the container and returns the results. This is usually\n        done to create new containers and can also be used to set\n        X-Container-Meta-xxx headers. Note that if the container\n        already exists, any existing X-Container-Meta-xxx headers will\n        remain untouched. To remove an X-Container-Meta-xxx header,\n        send the header with an empty string as its value.\n\n        :param container: The name of the container.\n        :param headers: Additional headers to send with the request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :param body: Some container PUT requests, like the\n            extract-archive bulk upload request, take a body.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: is the str for the HTTP body.", "docstring_tokens": ["PUTs", "the", "container", "and", "returns", "the", "results", ".", "This", "is", "usually", "done", "to", "create", "new", "containers", "and", "can", "also", "be", "used", "to", "set", "X", "-", "Container", "-", "Meta", "-", "xxx", "headers", ".", "Note", "that", "if", "the", "container", "already", "exists", "any", "existing", "X", "-", "Container", "-", "Meta", "-", "xxx", "headers", "will", "remain", "untouched", ".", "To", "remove", "an", "X", "-", "Container", "-", "Meta", "-", "xxx", "header", "send", "the", "header", "with", "an", "empty", "string", "as", "its", "value", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 259061}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/member.py#L17-L27", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get Information for a member. Returns a dictionary of values.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return self.fetch_json(\n            uri_path=self.base_uri,\n            query_params=query_params or {}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", ",", "arg_1", "=", "arg_1", "or", "{", "}", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''\n        Get Information for a member. Returns a dictionary of values.\n\n        Returns:\n            dict\n        '''\n        return arg_0.fetch_json(\n            uri_path=arg_0.base_uri,\n            arg_1=arg_1 or {}\n        )", "path": "trolly/member.py", "identifier": "Member.get_member_information", "docstring": "Get Information for a member. Returns a dictionary of values.\n\n        Returns:\n            dict", "docstring_tokens": ["Get", "Information", "for", "a", "member", ".", "Returns", "a", "dictionary", "of", "values", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 259062}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/relay_list.py#L59-L72", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Apply the criteria to filter out on the output required", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_metrics", "or", "arg_0", ".", "_control", "or", "arg_0", ".", "_plugins", ":", "arg_1", "=", "arg_0", ".", "_relays", "[", "'result'", "]", "[", "'relays'", "]", "for", "arg_2", "in", "arg_1", ":", "if", "arg_0", ".", "_metrics", ":", "del", "arg_1", "[", "arg_2", "]", "[", "'metrics'", "]", "if", "arg_0", ".", "_control", ":", "del", "arg_1", "[", "arg_2", "]", "[", "'control'", "]", "if", "arg_0", ".", "_plugins", ":", "if", "'plugins'", "in", "arg_1", "[", "arg_2", "]", ":", "del", "arg_1", "[", "arg_2", "]", "[", "'plugins'", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Apply the criteria to filter out on the output required\n        \"\"\"\n        if arg_0._metrics or arg_0._control or arg_0._plugins:\n            arg_1 = arg_0._relays['result']['relays']\n            for arg_2 in arg_1:\n                if arg_0._metrics:\n                    del arg_1[arg_2]['metrics']\n                if arg_0._control:\n                    del arg_1[arg_2]['control']\n                if arg_0._plugins:\n                    if 'plugins' in arg_1[arg_2]:\n                        del arg_1[arg_2]['plugins']", "path": "boundary/relay_list.py", "identifier": "RelayList._filter", "docstring": "Apply the criteria to filter out on the output required", "docstring_tokens": ["Apply", "the", "criteria", "to", "filter", "out", "on", "the", "output", "required"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 259063}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1960-L1982", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Updates a user.", "language": "python", "parameters": "(self, user_id, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "items", "(", ")", ":", "arg_3", "[", "arg_0", ".", "_underscore_to_camelcase", "(", "arg_4", ")", "]", "=", "arg_5", "arg_7", "=", "{", "\"properties\"", ":", "arg_3", "}", "arg_8", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/um/users/%s'", "%", "arg_1", ",", "method", "=", "'PUT'", ",", "arg_7", "=", "json", ".", "dumps", "(", "arg_7", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Updates a user.\n\n        :param      user_id: The unique ID of the user.\n        :type       user_id: ``str``\n\n        \"\"\"\n        arg_3 = {}\n\n        for arg_4, arg_5 in arg_2.items():\n            arg_3[arg_0._underscore_to_camelcase(arg_4)] = arg_5\n\n        arg_7 = {\n            \"properties\": arg_3\n        }\n\n        arg_8 = arg_0._perform_request(\n            url='/um/users/%s' % arg_1,\n            method='PUT',\n            arg_7=json.dumps(arg_7))\n\n        return arg_8", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.update_user", "docstring": "Updates a user.\n\n        :param      user_id: The unique ID of the user.\n        :type       user_id: ``str``", "docstring_tokens": ["Updates", "a", "user", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 259064}
{"url": "https://github.com/adamcharnock/seed/blob/48232a2497bd94c5e1466a5b33a929f253ab5112/seed/vcs/git.py#L44-L56", "sha": "48232a2497bd94c5e1466a5b33a929f253ab5112", "docstring_summary": "Will parse git log messages in the 'short' format", "language": "python", "parameters": "(self, text)", "return_statement": "return parsed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "r\"commit ([0-9a-f]+)\\nAuthor: (.*?)\\n\\n(.*?)(?:\\n\\n|$)\"", "arg_3", "=", "re", ".", "findall", "(", "arg_2", ",", "arg_1", ",", "re", ".", "DOTALL", ")", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_3", ":", "arg_4", ".", "append", "(", "(", "arg_5", "[", ":", "10", "]", ",", "re", ".", "sub", "(", "r\"\\s*<.*?>\"", ",", "\"\"", ",", "arg_6", ")", ",", "arg_7", ".", "strip", "(", ")", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Will parse git log messages in the 'short' format\"\"\"\n        arg_2 = r\"commit ([0-9a-f]+)\\nAuthor: (.*?)\\n\\n(.*?)(?:\\n\\n|$)\"\n        arg_3 = re.findall(arg_2, arg_1, re.DOTALL)\n        \n        arg_4 = []\n        for arg_5, arg_6, arg_7 in arg_3:\n            arg_4.append((\n                arg_5[:10],\n                re.sub(r\"\\s*<.*?>\", \"\", arg_6), # Remove email address if present\n                arg_7.strip()\n            ))\n        return arg_4", "path": "seed/vcs/git.py", "identifier": "GitVcs.parse_log_messages", "docstring": "Will parse git log messages in the 'short' format", "docstring_tokens": ["Will", "parse", "git", "log", "messages", "in", "the", "short", "format"], "nwo": "adamcharnock/seed", "score": 0.31099946390020666, "idx": 259065}
{"url": "https://github.com/lsst-sqre/ltd-conveyor/blob/c492937c4c1e050ccc4a0b9dcc38f9980d57e305/ltdconveyor/cli/upload.py#L82-L139", "sha": "c492937c4c1e050ccc4a0b9dcc38f9980d57e305", "docstring_summary": "Upload a new site build to LSST the Docs.", "language": "python", "parameters": "(ctx, product, git_ref, dirname, aws_id, aws_secret, ci_env,\n           on_travis_push, on_travis_pr, on_travis_api, on_travis_cron,\n           skip_upload)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ")", ":", "arg_12", "=", "logging", ".", "getLogger", "(", "__name__", ")", "if", "arg_11", ":", "click", ".", "echo", "(", "'Skipping ltd Func.'", ")", "sys", ".", "exit", "(", "0", ")", "arg_12", ".", "debug", "(", "'CI environment: %s'", ",", "arg_6", ")", "arg_12", ".", "debug", "(", "'Travis events settings. '", "'On Push: %r, PR: %r, API: %r, Cron: %r'", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", "if", "arg_6", "==", "'travis'", "and", "_should_skip_travis_event", "(", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", ":", "sys", ".", "exit", "(", "0", ")", "ensure_login", "(", "arg_0", ")", "arg_13", "=", "_get_git_refs", "(", "arg_6", ",", "arg_2", ")", "arg_14", "=", "register_build", "(", "arg_0", ".", "obj", "[", "'keeper_hostname'", "]", ",", "arg_0", ".", "obj", "[", "'token'", "]", ",", "arg_1", ",", "arg_13", ")", "arg_12", ".", "debug", "(", "'Created build resource %r'", ",", "arg_14", ")", "Func_dir", "(", "arg_14", "[", "'bucket_name'", "]", ",", "arg_14", "[", "'bucket_root_dir'", "]", ",", "arg_3", ",", "aws_access_key_id", "=", "arg_4", ",", "aws_secret_access_key", "=", "arg_5", ",", "surrogate_key", "=", "arg_14", "[", "'surrogate_key'", "]", ",", "cache_control", "=", "'max-age=31536000'", ",", "surrogate_control", "=", "None", ",", "Func_dir_redirect_objects", "=", "True", ")", "arg_12", ".", "debug", "(", "'Upload complete for %r'", ",", "arg_14", "[", "'self_url'", "]", ")", "confirm_build", "(", "arg_14", "[", "'self_url'", "]", ",", "arg_0", ".", "obj", "[", "'token'", "]", ")", "arg_12", ".", "debug", "(", "'Build %r complete'", ",", "arg_14", "[", "'self_url'", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6,\n           arg_7, arg_8, arg_9, arg_10,\n           arg_11):\n    \"\"\"Upload a new site build to LSST the Docs.\n    \"\"\"\n    arg_12 = logging.getLogger(__name__)\n\n    if arg_11:\n        click.echo('Skipping ltd Func.')\n        sys.exit(0)\n\n    arg_12.debug('CI environment: %s', arg_6)\n    arg_12.debug('Travis events settings. '\n                 'On Push: %r, PR: %r, API: %r, Cron: %r',\n                 arg_7, arg_8, arg_9, arg_10)\n\n    # Abort Func on Travis CI under certain events\n    if arg_6 == 'travis' and \\\n            _should_skip_travis_event(\n                arg_7, arg_8, arg_9, arg_10):\n        sys.exit(0)\n\n    # Authenticate to LTD Keeper host\n    ensure_login(arg_0)\n\n    # Detect git refs\n    arg_13 = _get_git_refs(arg_6, arg_2)\n\n    arg_14 = register_build(\n        arg_0.obj['keeper_hostname'],\n        arg_0.obj['token'],\n        arg_1,\n        arg_13\n    )\n    arg_12.debug('Created build resource %r', arg_14)\n\n    # Do the Func.\n    # This cache_control is appropriate for builds since they're immutable.\n    # The LTD Keeper server changes the cache settings when copying the build\n    # over to be a mutable edition.\n    Func_dir(\n        arg_14['bucket_name'],\n        arg_14['bucket_root_dir'],\n        arg_3,\n        aws_access_key_id=arg_4,\n        aws_secret_access_key=arg_5,\n        surrogate_key=arg_14['surrogate_key'],\n        cache_control='max-age=31536000',\n        surrogate_control=None,\n        Func_dir_redirect_objects=True)\n    arg_12.debug('Upload complete for %r', arg_14['self_url'])\n\n    # Confirm Func\n    confirm_build(\n        arg_14['self_url'],\n        arg_0.obj['token']\n    )\n    arg_12.debug('Build %r complete', arg_14['self_url'])", "path": "ltdconveyor/cli/upload.py", "identifier": "upload", "docstring": "Upload a new site build to LSST the Docs.", "docstring_tokens": ["Upload", "a", "new", "site", "build", "to", "LSST", "the", "Docs", "."], "nwo": "lsst-sqre/ltd-conveyor", "score": 0.138843686048881, "idx": 259066}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1270-L1277", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "_add_id_to_index - Adds an id to an index\n\t\t\tinternal", "language": "python", "parameters": "(self, indexedField, pk, val, conn=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_4", ".", "sadd", "(", "arg_0", ".", "_get_key_for_index", "(", "arg_1", ",", "arg_3", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n\t\t'''\n\t\t\tFunc - Adds an id to an index\n\t\t\tinternal\n\t\t'''\n\t\tif arg_4 is None:\n\t\t\targ_4 = arg_0._get_connection()\n\t\targ_4.sadd(arg_0._get_key_for_index(arg_1, arg_3), arg_2)", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisHelper._add_id_to_index", "docstring": "_add_id_to_index - Adds an id to an index\n\t\t\tinternal", "docstring_tokens": ["_add_id_to_index", "-", "Adds", "an", "id", "to", "an", "index", "internal"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 259067}
{"url": "https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L159-L165", "sha": "bb1990cf1460ae42f2dde75f2291625ddac2c0e4", "docstring_summary": "Helper method for fetching a integer value.", "language": "python", "parameters": "(self, item)", "return_statement": "return int(doc.value.u8.text) or None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "yield", "from", "arg_0", ".", "handle_get", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "return", "None", "return", "int", "(", "arg_2", ".", "value", ".", "u8", ".", "text", ")", "or", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Helper method for fetching a integer value.\"\"\"\n        arg_2 = yield from arg_0.handle_get(arg_1)\n        if arg_2 is None:\n            return None\n\n        return int(arg_2.value.u8.text) or None", "path": "afsapi/__init__.py", "identifier": "AFSAPI.handle_int", "docstring": "Helper method for fetching a integer value.", "docstring_tokens": ["Helper", "method", "for", "fetching", "a", "integer", "value", "."], "nwo": "zhelev/python-afsapi", "score": 0.16638194949711382, "idx": 259068}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L594-L616", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Write a summary report to `file`.", "language": "python", "parameters": "(self, morfs=None, show_missing=True, ignore_errors=None,\n                file=None,                          # pylint: disable=W0622\n                omit=None, include=None\n                )", "return_statement": "return reporter.report(morfs, outfile=file)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_0", ".", "_harvest_data", "(", ")", "arg_0", ".", "config", ".", "from_args", "(", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_2", "=", "arg_2", ",", ")", "arg_7", "=", "SummaryReporter", "(", "arg_0", ",", "arg_0", ".", "config", ")", "return", "arg_7", ".", "Func", "(", "arg_1", ",", "outfile", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=True, arg_3=None,\n                arg_4=None,                          # pylint: disable=W0622\n                arg_5=None, arg_6=None\n                ):\n        \"\"\"Write a summary Func to `file`.\n\n        Each module in `morfs` is listed, with counts of statements, executed\n        statements, missing statements, and a list of lines missed.\n\n        `include` is a list of filename patterns.  Modules whose filenames\n        match those patterns will be included in the Func. Modules matching\n        `omit` will not be included in the Func.\n\n        Returns a float, the total percentage covered.\n\n        \"\"\"\n        arg_0._harvest_data()\n        arg_0.config.from_args(\n            arg_3=arg_3, arg_5=arg_5, arg_6=arg_6,\n            arg_2=arg_2,\n            )\n        arg_7 = SummaryReporter(arg_0, arg_0.config)\n        return arg_7.Func(arg_1, outfile=arg_4)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage.report", "docstring": "Write a summary report to `file`.\n\n        Each module in `morfs` is listed, with counts of statements, executed\n        statements, missing statements, and a list of lines missed.\n\n        `include` is a list of filename patterns.  Modules whose filenames\n        match those patterns will be included in the report. Modules matching\n        `omit` will not be included in the report.\n\n        Returns a float, the total percentage covered.", "docstring_tokens": ["Write", "a", "summary", "report", "to", "file", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 259069}
{"url": "https://github.com/xmartlabs/benderthon/blob/810b6fb90f56136257e7ed12e5a30d17ad7ce6ba/benderthon/caffe_freeze.py#L65-L70", "sha": "810b6fb90f56136257e7ed12e5a30d17ad7ce6ba", "docstring_summary": "Save a small version of the graph based on a Caffe model, the input tensors and the output node names.", "language": "python", "parameters": "(caffe_def_path, caffemodel_path, inputs, output_file_path, output_node_names, graph_name='Graph',\n                    use_padding_same=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "'Graph'", ",", "arg_6", "=", "False", ")", ":", "with", "caffe_to_tensorflow_session", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "as", "sess", ":", "tf_freeze", ".", "Func", "(", "sess", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5='Graph',\n                    arg_6=False):\n    \"\"\"Save a small version of the graph based on a Caffe model, the input tensors and the output node names.\"\"\"\n    with caffe_to_tensorflow_session(arg_0, arg_1, arg_2, arg_5=arg_5,\n                                     arg_6=arg_6) as sess:\n        tf_freeze.Func(sess, arg_3, arg_4)", "path": "benderthon/caffe_freeze.py", "identifier": "save_graph_only", "docstring": "Save a small version of the graph based on a Caffe model, the input tensors and the output node names.", "docstring_tokens": ["Save", "a", "small", "version", "of", "the", "graph", "based", "on", "a", "Caffe", "model", "the", "input", "tensors", "and", "the", "output", "node", "names", "."], "nwo": "xmartlabs/benderthon", "score": 0.2751458370028208, "idx": 259070}
{"url": "https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/templatetags/etc_misc.py#L105-L160", "sha": "dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe", "docstring_summary": "Similar to built-in ``include`` template tag, but allowing\n    template variables to be used in template name and a fallback template,\n    thus making the tag more dynamic.", "language": "python", "parameters": "(parser, token)", "return_statement": "return include_node", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "arg_3", "=", "False", "if", "len", "(", "arg_2", ")", ">=", "2", ":", "arg_3", "=", "'{{'", "in", "arg_2", "[", "1", "]", "if", "arg_3", ":", "arg_4", "=", "None", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_2", ":", "if", "arg_4", "is", "True", ":", "arg_4", "=", "arg_6", "continue", "if", "arg_6", "==", "'fallback'", ":", "arg_4", "=", "True", "else", ":", "arg_5", ".", "append", "(", "arg_6", ")", "if", "arg_4", ":", "arg_4", "=", "arg_0", ".", "compile_filter", "(", "construct_relative_path_", "(", "arg_0", ",", "arg_4", ")", ")", "arg_1", ".", "contents", "=", "' '", ".", "join", "(", "arg_5", ")", "arg_1", ".", "contents", "=", "arg_1", ".", "contents", ".", "replace", "(", "'Func'", ",", "'include'", ")", "arg_8", "=", "do_include", "(", "arg_0", ",", "arg_1", ")", "if", "arg_3", ":", "arg_8", "=", "DynamicIncludeNode", "(", "arg_8", ".", "template", ",", "extra_context", "=", "arg_8", ".", "extra_context", ",", "isolated_context", "=", "arg_8", ".", "isolated_context", ",", "arg_4", "=", "arg_4", "or", "None", ",", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Similar to built-in ``include`` template tag, but allowing\n    template variables to be used in template name and a fallback template,\n    thus making the tag more dynamic.\n\n    .. warning:: Requires Django 1.8+\n\n    Example:\n\n        {% load etc_misc %}\n        {% Func \"sub_{{ postfix_var }}.html\" fallback \"default.html\" %}\n\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n\n    arg_3 = False\n\n    # We fallback to built-in `include` if a template name contains no variables.\n    if len(arg_2) >= 2:\n        arg_3 = '{{' in arg_2[1]\n\n        if arg_3:\n            arg_4 = None\n            arg_5 = []\n\n            for arg_6 in arg_2:\n\n                if arg_4 is True:\n                    # This bit is a `fallback` argument.\n                    arg_4 = arg_6\n                    continue\n\n                if arg_6 == 'fallback':\n                    arg_4 = True\n\n                else:\n                    arg_5.append(arg_6)\n\n            if arg_4:\n                arg_4 = arg_0.compile_filter(construct_relative_path_(arg_0, arg_4))\n\n            arg_1.contents = ' '.join(arg_5)\n\n    arg_1.contents = arg_1.contents.replace('Func', 'include')\n    arg_8 = do_include(arg_0, arg_1)\n\n    if arg_3:\n        # swap simple include with dynamic\n        arg_8 = DynamicIncludeNode(\n            arg_8.template,\n            extra_context=arg_8.extra_context,\n            isolated_context=arg_8.isolated_context,\n            arg_4=arg_4 or None,\n        )\n\n    return arg_8", "path": "etc/templatetags/etc_misc.py", "identifier": "include_", "docstring": "Similar to built-in ``include`` template tag, but allowing\n    template variables to be used in template name and a fallback template,\n    thus making the tag more dynamic.\n\n    .. warning:: Requires Django 1.8+\n\n    Example:\n\n        {% load etc_misc %}\n        {% include_ \"sub_{{ postfix_var }}.html\" fallback \"default.html\" %}", "docstring_tokens": ["Similar", "to", "built", "-", "in", "include", "template", "tag", "but", "allowing", "template", "variables", "to", "be", "used", "in", "template", "name", "and", "a", "fallback", "template", "thus", "making", "the", "tag", "more", "dynamic", "."], "nwo": "idlesign/django-etc", "score": 0.2643786477459777, "idx": 259071}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1083-L1117", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch changes and store them in a pack.", "language": "python", "parameters": "(self)", "return_statement": "return (pack_name, refs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "prepare_refs", "(", "arg_1", ")", ":", "return", "[", "arg_2", ".", "hash", ".", "encode", "(", "'utf-8'", ")", "for", "arg_2", "in", "arg_1", "if", "not", "arg_2", ".", "refname", ".", "endswith", "(", "'^{}'", ")", "]", "def", "determine_wants", "(", "arg_1", ")", ":", "arg_3", "=", "prepare_refs", "(", "arg_0", ".", "_discover_refs", "(", "remote", "=", "True", ")", ")", "arg_4", "=", "prepare_refs", "(", "arg_0", ".", "_discover_refs", "(", ")", ")", "arg_5", "=", "[", "arg_2", "for", "arg_2", "in", "arg_3", "if", "arg_2", "not", "in", "arg_4", "]", "return", "arg_5", "arg_6", ",", "arg_7", "=", "dulwich", ".", "client", ".", "get_transport_and_path", "(", "arg_0", ".", "uri", ")", "arg_8", "=", "dulwich", ".", "repo", ".", "Repo", "(", "arg_0", ".", "dirpath", ")", "arg_9", "=", "io", ".", "BytesIO", "(", ")", "arg_4", "=", "arg_0", ".", "_discover_refs", "(", ")", "arg_10", "=", "_GraphWalker", "(", "arg_4", ")", "arg_11", "=", "arg_6", ".", "fetch_pack", "(", "arg_7", ",", "determine_wants", ",", "arg_10", ",", "arg_9", ".", "write", ")", "arg_1", "=", "[", "GitRef", "(", "ref_hash", ".", "decode", "(", "'utf-8'", ")", ",", "ref_name", ".", "decode", "(", "'utf-8'", ")", ")", "for", "ref_name", ",", "ref_hash", "in", "arg_11", ".", "refs", ".", "items", "(", ")", "]", "if", "len", "(", "arg_9", ".", "getvalue", "(", ")", ")", ">", "0", ":", "arg_9", ".", "seek", "(", "0", ")", "arg_12", "=", "arg_8", ".", "object_store", ".", "add_thin_pack", "(", "arg_9", ".", "read", ",", "None", ")", "arg_13", "=", "arg_12", ".", "name", "(", ")", ".", "decode", "(", "'utf-8'", ")", "else", ":", "arg_13", "=", "None", "return", "(", "arg_13", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Fetch changes and store them in a pack.\"\"\"\n\n        def prepare_refs(arg_1):\n            return [arg_2.hash.encode('utf-8') for arg_2 in arg_1\n                    if not arg_2.refname.endswith('^{}')]\n\n        def determine_wants(arg_1):\n            arg_3 = prepare_refs(arg_0._discover_refs(remote=True))\n            arg_4 = prepare_refs(arg_0._discover_refs())\n            arg_5 = [arg_2 for arg_2 in arg_3 if arg_2 not in arg_4]\n            return arg_5\n\n        arg_6, arg_7 = dulwich.client.get_transport_and_path(arg_0.uri)\n        arg_8 = dulwich.repo.Repo(arg_0.dirpath)\n        arg_9 = io.BytesIO()\n\n        arg_4 = arg_0._discover_refs()\n        arg_10 = _GraphWalker(arg_4)\n\n        arg_11 = arg_6.fetch_pack(arg_7,\n                                   determine_wants,\n                                   arg_10,\n                                   arg_9.write)\n        arg_1 = [GitRef(ref_hash.decode('utf-8'), ref_name.decode('utf-8'))\n                for ref_name, ref_hash in arg_11.refs.items()]\n\n        if len(arg_9.getvalue()) > 0:\n            arg_9.seek(0)\n            arg_12 = arg_8.object_store.add_thin_pack(arg_9.read, None)\n            arg_13 = arg_12.name().decode('utf-8')\n        else:\n            arg_13 = None\n\n        return (arg_13, arg_1)", "path": "perceval/backends/core/git.py", "identifier": "GitRepository._fetch_pack", "docstring": "Fetch changes and store them in a pack.", "docstring_tokens": ["Fetch", "changes", "and", "store", "them", "in", "a", "pack", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259072}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/memory_profiler.py#L65-L75", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Formats object count.", "language": "python", "parameters": "(objects)", "return_statement": "return sorted(result, key=operator.itemgetter(1), reverse=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "re", ".", "compile", "(", "r'<(?P<type>\\w+) \\'(?P<name>\\S+)\\'>'", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "items", "(", ")", ":", "if", "arg_4", "!=", "0", ":", "arg_5", "=", "re", ".", "findall", "(", "arg_2", ",", "repr", "(", "arg_3", ")", ")", "if", "arg_5", ":", "arg_3", ",", "arg_6", "=", "arg_5", "[", "0", "]", "arg_1", ".", "append", "(", "(", "\"%s %s\"", "%", "(", "arg_3", ",", "arg_6", ")", ",", "arg_4", ")", ")", "return", "sorted", "(", "arg_1", ",", "key", "=", "operator", ".", "itemgetter", "(", "1", ")", ",", "reverse", "=", "True", ")"], "function": "def Func(arg_0):\n    \"\"\"Formats object count.\"\"\"\n    arg_1 = []\n    arg_2 = re.compile(r'<(?P<type>\\w+) \\'(?P<name>\\S+)\\'>')\n    for arg_3, arg_4 in arg_0.items():\n        if arg_4 != 0:\n            arg_5 = re.findall(arg_2, repr(arg_3))\n            if arg_5:\n                arg_3, arg_6 = arg_5[0]\n                arg_1.append((\"%s %s\" % (arg_3, arg_6), arg_4))\n    return sorted(arg_1, key=operator.itemgetter(1), reverse=True)", "path": "vprof/memory_profiler.py", "identifier": "_format_obj_count", "docstring": "Formats object count.", "docstring_tokens": ["Formats", "object", "count", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 259073}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L685-L695", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Kill the current process.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_running", "(", ")", ":", "arg_1", "=", "arg_0", ".", "_platform_impl", ".", "_process_name", "raise", "NoSuchProcess", "(", "arg_0", ".", "pid", ",", "arg_1", ")", "if", "os", ".", "name", "==", "'posix'", ":", "arg_0", ".", "send_signal", "(", "signal", ".", "SIGKILL", ")", "else", ":", "arg_0", ".", "_platform_impl", ".", "Func_process", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Kill the current process.\"\"\"\n        # safety measure in case the current process has been Funced in\n        # meantime and the kernel reused its PID\n        if not arg_0.is_running():\n            arg_1 = arg_0._platform_impl._process_name\n            raise NoSuchProcess(arg_0.pid, arg_1)\n        if os.name == 'posix':\n            arg_0.send_signal(signal.SIGKILL)\n        else:\n            arg_0._platform_impl.Func_process()", "path": "environment/lib/python2.7/site-packages/psutil/__init__.py", "identifier": "Process.kill", "docstring": "Kill the current process.", "docstring_tokens": ["Kill", "the", "current", "process", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259074}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/Imshow_Slider_Array_mod.py#L244-L256", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Lowest value of input image.", "language": "python", "parameters": "(self)", "return_statement": "return _np.min(self.image)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'_imgmin'", ")", ":", "Func", "=", "_np", ".", "min", "(", "arg_0", ".", "images", "[", "0", "]", ")", "for", "arg_2", "in", "arg_0", ".", "images", ":", "arg_3", "=", "_np", ".", "min", "(", "arg_2", ")", "if", "arg_3", ">", "Func", ":", "Func", "=", "arg_3", "arg_0", ".", "_imgmin", "=", "Func", "return", "_np", ".", "min", "(", "arg_0", ".", "image", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Lowest value of input image.\n        \"\"\"\n        if not hasattr(arg_0, '_imgmin'):\n            Func = _np.min(arg_0.images[0])\n            for arg_2 in arg_0.images:\n                arg_3 = _np.min(arg_2)\n                if arg_3 > Func:\n                    Func = arg_3\n\n            arg_0._imgmin = Func\n        return _np.min(arg_0.image)", "path": "scisalt/matplotlib/Imshow_Slider_Array_mod.py", "identifier": "Imshow_Slider_Array.imgmin", "docstring": "Lowest value of input image.", "docstring_tokens": ["Lowest", "value", "of", "input", "image", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 259075}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/dflow.py#L1033-L1050", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Load a DataFlowKernel.", "language": "python", "parameters": "(cls, config: Optional[Config] = None)", "return_statement": "return cls._dfk", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", "=", "None", ")", ":", "if", "arg_0", ".", "_dfk", "is", "not", "None", ":", "raise", "RuntimeError", "(", "'Config has already been Funced'", ")", "if", "arg_1", "is", "None", ":", "arg_0", ".", "_dfk", "=", "DataFlowKernel", "(", "arg_3", "(", ")", ")", "else", ":", "arg_0", ".", "_dfk", "=", "DataFlowKernel", "(", "arg_1", ")", "return", "arg_0", ".", "_dfk"], "function": "def Func(arg_0, arg_1: arg_2[arg_3] = None):\n        \"\"\"Load a DataFlowKernel.\n\n        Args:\n            - config (Config) : Configuration to Func. This config will be passed to a\n              new DataFlowKernel instantiation which will be set as the active DataFlowKernel.\n        Returns:\n            - DataFlowKernel : The Funced DataFlowKernel object.\n        \"\"\"\n        if arg_0._dfk is not None:\n            raise RuntimeError('Config has already been Funced')\n\n        if arg_1 is None:\n            arg_0._dfk = DataFlowKernel(arg_3())\n        else:\n            arg_0._dfk = DataFlowKernel(arg_1)\n\n        return arg_0._dfk", "path": "parsl/dataflow/dflow.py", "identifier": "DataFlowKernelLoader.load", "docstring": "Load a DataFlowKernel.\n\n        Args:\n            - config (Config) : Configuration to load. This config will be passed to a\n              new DataFlowKernel instantiation which will be set as the active DataFlowKernel.\n        Returns:\n            - DataFlowKernel : The loaded DataFlowKernel object.", "docstring_tokens": ["Load", "a", "DataFlowKernel", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 259076}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/util.py#L34-L49", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Replace characters which are not valid in Python symbols\n    with valid replacement strings.", "language": "python", "parameters": "(s: str, allow_builtins: bool = False)", "return_statement": "return new_s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "False", ")", "->", "arg_1", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ":", "arg_4", ".", "append", "(", "_MUNGE_REPLACEMENTS", ".", "get", "(", "arg_5", ",", "arg_5", ")", ")", "arg_6", "=", "\"\"", ".", "join", "(", "arg_4", ")", "if", "keyword", ".", "iskeyword", "(", "arg_6", ")", ":", "return", "f\"{new_s}_\"", "if", "not", "arg_2", "and", "arg_6", "in", "builtins", ".", "__dict__", ":", "return", "f\"{new_s}_\"", "return", "arg_6"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = False) -> arg_1:\n    \"\"\"Replace characters which are not valid in Python symbols\n    with valid replacement strings.\"\"\"\n    arg_4 = []\n    for arg_5 in arg_0:\n        arg_4.append(_MUNGE_REPLACEMENTS.get(arg_5, arg_5))\n\n    arg_6 = \"\".join(arg_4)\n\n    if keyword.iskeyword(arg_6):\n        return f\"{new_s}_\"\n\n    if not arg_2 and arg_6 in builtins.__dict__:\n        return f\"{new_s}_\"\n\n    return arg_6", "path": "src/basilisp/lang/util.py", "identifier": "munge", "docstring": "Replace characters which are not valid in Python symbols\n    with valid replacement strings.", "docstring_tokens": ["Replace", "characters", "which", "are", "not", "valid", "in", "Python", "symbols", "with", "valid", "replacement", "strings", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 259077}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1676-L1692", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Append multiple H2OFrames to this frame, column-wise or row-wise.", "language": "python", "parameters": "(self, frames, axis=1)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "\"Input list of frames is empty! Nothing to Func.\"", ")", "if", "arg_2", "==", "1", ":", "arg_3", "=", "arg_0", ".", "cbind", "(", "arg_1", ")", "else", ":", "arg_3", "=", "arg_0", ".", "rbind", "(", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=1):\n        \"\"\"\n        Append multiple H2OFrames to this frame, column-wise or row-wise.\n\n        :param List[H2OFrame] frames: list of frames that should be appended to the current frame.\n        :param int axis: if 1 then append column-wise (default), if 0 then append row-wise.\n\n        :returns: an H2OFrame of the combined datasets.\n        \"\"\"\n        if len(arg_1) == 0:\n            raise ValueError(\"Input list of frames is empty! Nothing to Func.\")\n\n        if arg_2 == 1:\n            arg_3 = arg_0.cbind(arg_1)\n        else:\n            arg_3 = arg_0.rbind(arg_1)\n        return arg_3", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.concat", "docstring": "Append multiple H2OFrames to this frame, column-wise or row-wise.\n\n        :param List[H2OFrame] frames: list of frames that should be appended to the current frame.\n        :param int axis: if 1 then append column-wise (default), if 0 then append row-wise.\n\n        :returns: an H2OFrame of the combined datasets.", "docstring_tokens": ["Append", "multiple", "H2OFrames", "to", "this", "frame", "column", "-", "wise", "or", "row", "-", "wise", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259078}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/text.py#L756-L761", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "return list item number, or default if don't exist", "language": "python", "parameters": "(mylist, i, default=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", ">=", "len", "(", "arg_0", ")", ":", "return", "arg_2", "else", ":", "return", "arg_0", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"return list item number, or default if don't exist\"\"\"\n    if arg_1 >= len(arg_0):\n        return arg_2\n    else :\n        return arg_0[arg_1]", "path": "environment/lib/python2.7/site-packages/IPython/utils/text.py", "identifier": "_get_or_default", "docstring": "return list item number, or default if don't exist", "docstring_tokens": ["return", "list", "item", "number", "or", "default", "if", "don", "t", "exist"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259079}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L463-L508", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "For each node of the tree, check whether there is a sequence available\n        in the alignment and assign this sequence as a character array", "language": "python", "parameters": "(self)", "return_statement": "return self.make_reduced_alignment()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "if", "arg_0", ".", "is_vcf", ":", "arg_2", "=", "arg_0", ".", "aln", "else", ":", "arg_2", "=", "{", "k", ".", "name", ":", "seq2array", "(", "k", ".", "seq", ",", "fill_overhangs", "=", "arg_0", ".", "fill_overhangs", ",", "ambiguous_character", "=", "arg_0", ".", "gtr", ".", "ambiguous", ")", "for", "k", "in", "arg_0", ".", "aln", "}", "for", "arg_3", "in", "arg_0", ".", "tree", ".", "get_terminals", "(", ")", ":", "if", "arg_3", ".", "name", "in", "arg_0", ".", "seq_multiplicity", ":", "arg_3", ".", "count", "=", "arg_0", ".", "seq_multiplicity", "[", "arg_3", ".", "name", "]", "else", ":", "arg_3", ".", "count", "=", "1.0", "for", "arg_3", "in", "arg_0", ".", "tree", ".", "find_clades", "(", ")", ":", "if", "arg_3", ".", "name", "in", "arg_2", ":", "arg_3", ".", "sequence", "=", "arg_2", "[", "arg_3", ".", "name", "]", "elif", "arg_3", ".", "is_terminal", "(", ")", ":", "arg_0", ".", "logger", "(", "\"***WARNING: TreeAnc.Func: NO SEQUENCE FOR LEAF: %s\"", "%", "arg_3", ".", "name", ",", "0", ",", "warn", "=", "True", ")", "arg_1", "+=", "1", "arg_3", ".", "sequence", "=", "seq2array", "(", "arg_0", ".", "gtr", ".", "ambiguous", "*", "arg_0", ".", "seq_len", ",", "fill_overhangs", "=", "arg_0", ".", "fill_overhangs", ",", "ambiguous_character", "=", "arg_0", ".", "gtr", ".", "ambiguous", ")", "if", "arg_1", ">", "arg_0", ".", "tree", ".", "count_terminals", "(", ")", "/", "3", ":", "arg_0", ".", "logger", "(", "\"ERROR: At least 30\\\\% terminal nodes cannot be assigned with a sequence!\\n\"", ",", "0", ",", "warn", "=", "True", ")", "arg_0", ".", "logger", "(", "\"Are you sure the alignment belongs to the tree?\"", ",", "2", ",", "warn", "=", "True", ")", "break", "else", ":", "pass", "if", "arg_1", ":", "arg_0", ".", "logger", "(", "\"***WARNING: TreeAnc: %d nodes don't have a matching sequence in the alignment.\"", "\" POSSIBLE ERROR.\"", "%", "arg_1", ",", "0", ",", "warn", "=", "True", ")", "arg_0", ".", "extend_profile", "(", ")", "return", "arg_0", ".", "make_reduced_alignment", "(", ")"], "function": "def Func(arg_0):\n        '''\n        For each node of the tree, check whether there is a sequence available\n        in the alignment and assign this sequence as a character array\n        '''\n        arg_1= 0\n        if arg_0.is_vcf:\n            # if alignment is specified as difference from ref\n            arg_2 = arg_0.aln\n        else:\n            # if full alignment is specified\n            arg_2 = {k.name: seq2array(k.seq, fill_overhangs=arg_0.fill_overhangs,\n                                                   ambiguous_character=arg_0.gtr.ambiguous)\n                                for k in arg_0.aln} #\n\n        # loop over leaves and assign multiplicities of leaves (e.g. number of identical reads)\n        for arg_3 in arg_0.tree.get_terminals():\n            if arg_3.name in arg_0.seq_multiplicity:\n                arg_3.count = arg_0.seq_multiplicity[arg_3.name]\n            else:\n                arg_3.count = 1.0\n\n\n        # loop over tree, and assign sequences\n        for arg_3 in arg_0.tree.find_clades():\n            if arg_3.name in arg_2:\n                arg_3.sequence= arg_2[arg_3.name]\n            elif arg_3.is_terminal():\n                arg_0.logger(\"***WARNING: TreeAnc.Func: NO SEQUENCE FOR LEAF: %s\" % arg_3.name, 0, warn=True)\n                arg_1 += 1\n                arg_3.sequence = seq2array(arg_0.gtr.ambiguous*arg_0.seq_len, fill_overhangs=arg_0.fill_overhangs,\n                                                 ambiguous_character=arg_0.gtr.ambiguous)\n                if arg_1 > arg_0.tree.count_terminals()/3:\n                    arg_0.logger(\"ERROR: At least 30\\\\% terminal nodes cannot be assigned with a sequence!\\n\", 0, warn=True)\n                    arg_0.logger(\"Are you sure the alignment belongs to the tree?\", 2, warn=True)\n                    break\n            else: # could not assign sequence for internal node - is OK\n                pass\n\n        if arg_1:\n            arg_0.logger(\"***WARNING: TreeAnc: %d nodes don't have a matching sequence in the alignment.\"\n                        \" POSSIBLE ERROR.\"%arg_1, 0, warn=True)\n\n        # extend profile to contain additional unknown characters\n        arg_0.extend_profile()\n        return arg_0.make_reduced_alignment()", "path": "treetime/treeanc.py", "identifier": "TreeAnc._attach_sequences_to_nodes", "docstring": "For each node of the tree, check whether there is a sequence available\n        in the alignment and assign this sequence as a character array", "docstring_tokens": ["For", "each", "node", "of", "the", "tree", "check", "whether", "there", "is", "a", "sequence", "available", "in", "the", "alignment", "and", "assign", "this", "sequence", "as", "a", "character", "array"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 259080}
{"url": "https://github.com/shopkick/flawless/blob/c54b63ca1991c153e6f75080536f6df445aacc64/flawless/client/decorators.py#L44-L58", "sha": "c54b63ca1991c153e6f75080536f6df445aacc64", "docstring_summary": "Wraps a class with reporting to errors backend by decorating each function of the class.\n            Decorators are injected under the classmethod decorator if they exist.", "language": "python", "parameters": "(cls, error_threshold=None)", "return_statement": "return cls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "inspect", ".", "getmembers", "(", "arg_0", ",", "inspect", ".", "ismethod", ")", "+", "inspect", ".", "getmembers", "(", "arg_0", ",", "inspect", ".", "isfunction", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ":", "arg_5", "=", "flawless", ".", "client", ".", "client", ".", "_wrap_function_with_error_decorator", "(", "arg_4", "if", "not", "im_self", "(", "arg_4", ")", "else", "im_func", "(", "arg_4", ")", ",", "save_current_stack_trace", "=", "False", ",", "arg_1", "=", "arg_1", ",", ")", "if", "im_self", "(", "arg_4", ")", ":", "arg_5", "=", "classmethod", "(", "arg_5", ")", "setattr", "(", "arg_0", ",", "arg_3", ",", "arg_5", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None):\n    ''' Wraps a class with reporting to errors backend by decorating each function of the class.\n            Decorators are injected under the classmethod decorator if they exist.\n    '''\n    arg_2 = inspect.getmembers(arg_0, inspect.ismethod) + inspect.getmembers(arg_0, inspect.isfunction)\n    for arg_3, arg_4 in arg_2:\n        arg_5 = flawless.client.client._wrap_function_with_error_decorator(\n            arg_4 if not im_self(arg_4) else im_func(arg_4),\n            save_current_stack_trace=False,\n            arg_1=arg_1,\n        )\n        if im_self(arg_4):\n            arg_5 = classmethod(arg_5)\n        setattr(arg_0, arg_3, arg_5)\n    return arg_0", "path": "flawless/client/decorators.py", "identifier": "wrap_class", "docstring": "Wraps a class with reporting to errors backend by decorating each function of the class.\n            Decorators are injected under the classmethod decorator if they exist.", "docstring_tokens": ["Wraps", "a", "class", "with", "reporting", "to", "errors", "backend", "by", "decorating", "each", "function", "of", "the", "class", ".", "Decorators", "are", "injected", "under", "the", "classmethod", "decorator", "if", "they", "exist", "."], "nwo": "shopkick/flawless", "score": 0.37326674238089064, "idx": 259081}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/viscosity.py#L84-L97", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "This function is known to produce values 10 times too low.\n    The author's data must have an error.\n    I have adjusted it to fix this.", "language": "python", "parameters": "(T, A, B)", "return_statement": "return mu", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "exp", "(", "arg_1", "+", "arg_2", "/", "arg_0", ")", "arg_3", "=", "arg_3", "/", "1000.", "arg_3", "=", "arg_3", "*", "10", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''\n    This function is known to produce values 10 times too low.\n    The author's data must have an error.\n    I have adjusted it to fix this.\n\n    # DDBST has 0.0004580 as a value at this temperature\n    >>> Func(348.15, -5.9719, 1007.0)\n    0.00045983686956829517\n    '''\n    arg_3 = exp(arg_1 + arg_2/arg_0)\n    arg_3 = arg_3/1000.\n    arg_3 = arg_3*10\n    return arg_3", "path": "thermo/viscosity.py", "identifier": "ViswanathNatarajan2", "docstring": "This function is known to produce values 10 times too low.\n    The author's data must have an error.\n    I have adjusted it to fix this.\n\n    # DDBST has 0.0004580 as a value at this temperature\n    >>> ViswanathNatarajan2(348.15, -5.9719, 1007.0)\n    0.00045983686956829517", "docstring_tokens": ["This", "function", "is", "known", "to", "produce", "values", "10", "times", "too", "low", ".", "The", "author", "s", "data", "must", "have", "an", "error", ".", "I", "have", "adjusted", "it", "to", "fix", "this", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 259082}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/dj.py#L773-L791", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Retrieves the most recent timestamp of the media in the static root.", "language": "python", "parameters": "(self, last_timestamp=None)", "return_statement": "return _latest_timestamp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "local_renderer", "arg_3", "=", "-", "1e9999999999999999", "for", "arg_4", "in", "arg_0", ".", "iter_static_paths", "(", ")", ":", "arg_4", "=", "arg_2", ".", "env", ".", "static_root", "+", "'/'", "+", "arg_4", "arg_0", ".", "vprint", "(", "'checking timestamp of path:'", ",", "arg_4", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "continue", "arg_3", "=", "max", "(", "arg_3", ",", "get_last_modified_timestamp", "(", "arg_4", ")", "or", "arg_3", ")", "if", "arg_1", "is", "not", "None", "and", "arg_3", ">", "arg_1", ":", "break", "arg_0", ".", "vprint", "(", "'latest_timestamp:'", ",", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Retrieves the most recent timestamp of the media in the static root.\n\n        If last_timestamp is given, retrieves the first timestamp more recent than this value.\n        \"\"\"\n        arg_2 = arg_0.local_renderer\n        arg_3 = -1e9999999999999999\n        for arg_4 in arg_0.iter_static_paths():\n            arg_4 = arg_2.env.static_root + '/' + arg_4\n            arg_0.vprint('checking timestamp of path:', arg_4)\n            if not os.path.isfile(arg_4):\n                continue\n            #print('path:', path)\n            arg_3 = max(arg_3, get_last_modified_timestamp(arg_4) or arg_3)\n            if arg_1 is not None and arg_3 > arg_1:\n                break\n        arg_0.vprint('latest_timestamp:', arg_3)\n        return arg_3", "path": "burlap/dj.py", "identifier": "DjangoSatchel.get_media_timestamp", "docstring": "Retrieves the most recent timestamp of the media in the static root.\n\n        If last_timestamp is given, retrieves the first timestamp more recent than this value.", "docstring_tokens": ["Retrieves", "the", "most", "recent", "timestamp", "of", "the", "media", "in", "the", "static", "root", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259083}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/contrib/dash/solvebio_auth.py#L185-L203", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Revoke the token and remove the cookie.", "language": "python", "parameters": "(self)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_oauth_client_secret", ":", "try", ":", "arg_1", "=", "flask", ".", "request", ".", "cookies", "[", "arg_0", ".", "TOKEN_COOKIE_NAME", "]", "requests", ".", "post", "(", "urljoin", "(", "arg_0", ".", "_api_host", ",", "arg_0", ".", "OAUTH2_REVOKE_TOKEN_PATH", ")", ",", "data", "=", "{", "'client_id'", ":", "arg_0", ".", "_oauth_client_id", ",", "'client_secret'", ":", "arg_0", ".", "_oauth_client_secret", ",", "'token'", ":", "arg_1", "}", ")", "except", ":", "pass", "arg_2", "=", "flask", ".", "redirect", "(", "'/'", ")", "arg_0", ".", "clear_cookies", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Revoke the token and remove the cookie.\"\"\"\n        if arg_0._oauth_client_secret:\n            try:\n                arg_1 = flask.request.cookies[arg_0.TOKEN_COOKIE_NAME]\n                # Revoke the token\n                requests.post(\n                    urljoin(arg_0._api_host, arg_0.OAUTH2_REVOKE_TOKEN_PATH),\n                    data={\n                        'client_id': arg_0._oauth_client_id,\n                        'client_secret': arg_0._oauth_client_secret,\n                        'token': arg_1\n                    })\n            except:\n                pass\n\n        arg_2 = flask.redirect('/')\n        arg_0.clear_cookies(arg_2)\n        return arg_2", "path": "solvebio/contrib/dash/solvebio_auth.py", "identifier": "SolveBioAuth.logout", "docstring": "Revoke the token and remove the cookie.", "docstring_tokens": ["Revoke", "the", "token", "and", "remove", "the", "cookie", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 259084}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/group.py#L79-L95", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Add objects to the group.", "language": "python", "parameters": "(self, new_members)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", "or", "hasattr", "(", "arg_1", ",", "\"id\"", ")", ":", "warn", "(", "\"need to pass in a list\"", ")", "arg_1", "=", "[", "arg_1", "]", "arg_0", ".", "_members", ".", "update", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add objects to the group.\n\n        Parameters\n        ----------\n        new_members : list\n            A list of cobrapy objects to add to the group.\n\n        \"\"\"\n\n        if isinstance(arg_1, string_types) or \\\n                hasattr(arg_1, \"id\"):\n            warn(\"need to pass in a list\")\n            arg_1 = [arg_1]\n\n        arg_0._members.update(arg_1)", "path": "cobra/core/group.py", "identifier": "Group.add_members", "docstring": "Add objects to the group.\n\n        Parameters\n        ----------\n        new_members : list\n            A list of cobrapy objects to add to the group.", "docstring_tokens": ["Add", "objects", "to", "the", "group", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259085}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L758-L772", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Extracts a list of Tag objects that match the given\n        criteria.  You can specify the name of the Tag and any\n        attributes you want the Tag to have.", "language": "python", "parameters": "(self, name=None, attrs={}, recursive=True, text=None,\n                limit=None, **kwargs)", "return_statement": "return self._findAll(name, attrs, text, limit, generator, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "True", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "**", "arg_6", ")", ":", "arg_7", "=", "arg_0", ".", "recursiveChildGenerator", "if", "not", "arg_3", ":", "arg_7", "=", "arg_0", ".", "childGenerator", "return", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", ",", "arg_4", ",", "arg_5", ",", "arg_7", ",", "**", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2={}, arg_3=True, arg_4=None,\n                arg_5=None, **arg_6):\n        \"\"\"Extracts a list of Tag objects that match the given\n        criteria.  You can specify the name of the Tag and any\n        attributes you want the Tag to have.\n\n        The value of a key-value pair in the 'attrs' map can be a\n        string, a list of strings, a regular expression object, or a\n        callable that takes a string and returns whether or not the\n        string matches for some custom definition of 'matches'. The\n        same is true of the tag name.\"\"\"\n        arg_7 = arg_0.recursiveChildGenerator\n        if not arg_3:\n            arg_7 = arg_0.childGenerator\n        return arg_0._Func(arg_1, arg_2, arg_4, arg_5, arg_7, **arg_6)", "path": "lib/web/BeautifulSoup.py", "identifier": "Tag.findAll", "docstring": "Extracts a list of Tag objects that match the given\n        criteria.  You can specify the name of the Tag and any\n        attributes you want the Tag to have.\n\n        The value of a key-value pair in the 'attrs' map can be a\n        string, a list of strings, a regular expression object, or a\n        callable that takes a string and returns whether or not the\n        string matches for some custom definition of 'matches'. The\n        same is true of the tag name.", "docstring_tokens": ["Extracts", "a", "list", "of", "Tag", "objects", "that", "match", "the", "given", "criteria", ".", "You", "can", "specify", "the", "name", "of", "the", "Tag", "and", "any", "attributes", "you", "want", "the", "Tag", "to", "have", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259086}
{"url": "https://github.com/codelv/enaml-web/blob/88f1131a7b3ba9e83467b4f44bc3bab6f0de7559/examples/dataframe_viewer/app.py#L97-L103", "sha": "88f1131a7b3ba9e83467b4f44bc3bab6f0de7559", "docstring_summary": "When an event from enaml occurs, send it out the websocket\n        so the client's browser can update accordingly.", "language": "python", "parameters": "(self, change)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "debug", "(", "f'Update from enaml: {change}'", ")", "arg_0", ".", "write_message", "(", "json", ".", "dumps", "(", "arg_1", "[", "'value'", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" When an event from enaml occurs, send it out the websocket\n        so the client's browser can update accordingly.\n\n        \"\"\"\n        log.debug(f'Update from enaml: {change}')\n        arg_0.write_message(json.dumps(arg_1['value']))", "path": "examples/dataframe_viewer/app.py", "identifier": "ViewerWebSocket.on_dom_modified", "docstring": "When an event from enaml occurs, send it out the websocket\n        so the client's browser can update accordingly.", "docstring_tokens": ["When", "an", "event", "from", "enaml", "occurs", "send", "it", "out", "the", "websocket", "so", "the", "client", "s", "browser", "can", "update", "accordingly", "."], "nwo": "codelv/enaml-web", "score": 0.5680722283335639, "idx": 259087}
{"url": "https://github.com/bkg/greenwich/blob/57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141/greenwich/geometry.py#L147-L159", "sha": "57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141", "docstring_summary": "Returns true if this envelope intersects another.", "language": "python", "parameters": "(self, other)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "(", "arg_0", ".", "min_x", "<=", "arg_1", ".", "max_x", "and", "arg_0", ".", "max_x", ">=", "arg_1", ".", "min_x", "and", "arg_0", ".", "min_y", "<=", "arg_1", ".", "max_y", "and", "arg_0", ".", "max_y", ">=", "arg_1", ".", "min_y", ")", "except", "AttributeError", ":", "return", "arg_0", ".", "Func", "(", "Envelope", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns true if this envelope Func another.\n\n        Arguments:\n        other -- Envelope or tuple of (minX, minY, maxX, maxY)\n        \"\"\"\n        try:\n            return (arg_0.min_x <= arg_1.max_x and\n                    arg_0.max_x >= arg_1.min_x and\n                    arg_0.min_y <= arg_1.max_y and\n                    arg_0.max_y >= arg_1.min_y)\n        except AttributeError:\n            return arg_0.Func(Envelope(arg_1))", "path": "greenwich/geometry.py", "identifier": "Envelope.intersects", "docstring": "Returns true if this envelope intersects another.\n\n        Arguments:\n        other -- Envelope or tuple of (minX, minY, maxX, maxY)", "docstring_tokens": ["Returns", "true", "if", "this", "envelope", "intersects", "another", "."], "nwo": "bkg/greenwich", "score": 0.15726537023232431, "idx": 259088}
{"url": "https://github.com/Kappa-Dev/KaSim/blob/12a01c616a47e3046323103625795fb2fca8273a/python/kappy/kappa_common.py#L308-L316", "sha": "12a01c616a47e3046323103625795fb2fca8273a", "docstring_summary": "Check if the current simulation is running.", "language": "python", "parameters": "(self)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "simulation_info", "(", ")", "try", ":", "arg_2", "=", "arg_1", "[", "'simulation_info_progress'", "]", "arg_3", "=", "arg_2", "[", "'simulation_progress_is_running'", "]", "except", "KeyError", ":", "arg_3", "=", "False", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Check if the current simulation is running.\"\"\"\n        arg_1 = arg_0.simulation_info()\n        try:\n            arg_2 = arg_1['simulation_info_progress']\n            arg_3 = arg_2['simulation_progress_is_running']\n        except KeyError:  # Simulation has not been created.\n            arg_3 = False\n        return arg_3", "path": "python/kappy/kappa_common.py", "identifier": "KappaApi.get_is_sim_running", "docstring": "Check if the current simulation is running.", "docstring_tokens": ["Check", "if", "the", "current", "simulation", "is", "running", "."], "nwo": "Kappa-Dev/KaSim", "score": 0.5441421983768713, "idx": 259089}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_container_instance_hook.py#L133-L147", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get the tail from logs of a container group", "language": "python", "parameters": "(self, resource_group, name, tail=1000)", "return_statement": "return logs.content.splitlines(True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1000", ")", ":", "arg_4", "=", "arg_0", ".", "connection", ".", "container", ".", "list_logs", "(", "arg_1", ",", "arg_2", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "arg_4", ".", "content", ".", "splitlines", "(", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1000):\n        \"\"\"\n        Get the tail from logs of a container group\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str\n        :param tail: the size of the tail\n        :type tail: int\n        :return: A list of log messages\n        :rtype: list[str]\n        \"\"\"\n        arg_4 = arg_0.connection.container.list_logs(arg_1, arg_2, arg_2, arg_3=arg_3)\n        return arg_4.content.splitlines(True)", "path": "airflow/contrib/hooks/azure_container_instance_hook.py", "identifier": "AzureContainerInstanceHook.get_logs", "docstring": "Get the tail from logs of a container group\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str\n        :param tail: the size of the tail\n        :type tail: int\n        :return: A list of log messages\n        :rtype: list[str]", "docstring_tokens": ["Get", "the", "tail", "from", "logs", "of", "a", "container", "group"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259090}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1524-L1549", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns colors that are next to each other on the wheel.", "language": "python", "parameters": "(clr, angle=10, contrast=0.25)", "return_statement": "return colors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ",", "arg_2", "=", "0.25", ")", ":", "arg_2", "=", "max", "(", "0", ",", "min", "(", "arg_2", ",", "1.0", ")", ")", "arg_0", "=", "color", "(", "arg_0", ")", "arg_3", "=", "colorlist", "(", "arg_0", ")", "for", "arg_4", ",", "arg_5", "in", "[", "(", "1", ",", "2.2", ")", ",", "(", "2", ",", "1", ")", ",", "(", "-", "1", ",", "-", "0.5", ")", ",", "(", "-", "2", ",", "1", ")", "]", ":", "arg_6", "=", "arg_0", ".", "rotate_ryb", "(", "arg_1", "*", "arg_4", ")", "arg_7", "=", "0.44", "-", "arg_5", "*", "0.1", "if", "arg_0", ".", "brightness", "-", "arg_2", "*", "arg_5", "<", "arg_7", ":", "arg_6", ".", "brightness", "=", "arg_7", "else", ":", "arg_6", ".", "brightness", "=", "arg_0", ".", "brightness", "-", "arg_2", "*", "arg_5", "arg_6", ".", "saturation", "-=", "0.05", "arg_3", ".", "append", "(", "arg_6", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=10, arg_2=0.25):\n    \"\"\"\n    Returns colors that are next to each other on the wheel.\n\n    These yield natural color schemes (like shades of water or sky).\n    The angle determines how far the colors are apart,\n    making it bigger will introduce more variation.\n    The contrast determines the darkness/lightness of\n    the analogue colors in respect to the given colors.\n    \"\"\"\n    arg_2 = max(0, min(arg_2, 1.0))\n\n    arg_0 = color(arg_0)\n    arg_3 = colorlist(arg_0)\n\n    for arg_4, arg_5 in [(1, 2.2), (2, 1), (-1, -0.5), (-2, 1)]:\n        arg_6 = arg_0.rotate_ryb(arg_1 * arg_4)\n        arg_7 = 0.44 - arg_5 * 0.1\n        if arg_0.brightness - arg_2 * arg_5 < arg_7:\n            arg_6.brightness = arg_7\n        else:\n            arg_6.brightness = arg_0.brightness - arg_2 * arg_5\n        arg_6.saturation -= 0.05\n        arg_3.append(arg_6)\n\n    return arg_3", "path": "lib/colors/__init__.py", "identifier": "analogous", "docstring": "Returns colors that are next to each other on the wheel.\n\n    These yield natural color schemes (like shades of water or sky).\n    The angle determines how far the colors are apart,\n    making it bigger will introduce more variation.\n    The contrast determines the darkness/lightness of\n    the analogue colors in respect to the given colors.", "docstring_tokens": ["Returns", "colors", "that", "are", "next", "to", "each", "other", "on", "the", "wheel", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259091}
{"url": "https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/ctllib.py#L165-L175", "sha": "6ac71bda1de6706fb34244ae4972e36db5f062d3", "docstring_summary": "Call results.func on the attributes of results", "language": "python", "parameters": "(results)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "vars", "(", "arg_0", ")", "arg_1", "=", "Places", "(", "config", "=", "arg_0", ".", "pop", "(", "'config'", ")", ",", "messages", "=", "arg_0", ".", "pop", "(", "'messages'", ")", ")", "arg_2", "=", "arg_0", ".", "pop", "(", "'func'", ")", "arg_2", "(", "arg_1", ",", "**", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Call results.func on the attributes of results\n\n    :params result: dictionary-like object\n    :returns: None\n    \"\"\"\n    arg_0 = vars(arg_0)\n    arg_1 = Places(config=arg_0.pop('config'),\n                    messages=arg_0.pop('messages'))\n    arg_2 = arg_0.pop('func')\n    arg_2(arg_1, **arg_0)", "path": "ncolony/ctllib.py", "identifier": "call", "docstring": "Call results.func on the attributes of results\n\n    :params result: dictionary-like object\n    :returns: None", "docstring_tokens": ["Call", "results", ".", "func", "on", "the", "attributes", "of", "results"], "nwo": "ncolony/ncolony", "score": 0.2757871243566705, "idx": 259092}
{"url": "https://github.com/Julian/Virtue/blob/d08be37d759c38c94a160bc13fe8f51bb2aeeedd/virtue/cli.py#L61-L70", "sha": "d08be37d759c38c94a160bc13fe8f51bb2aeeedd", "docstring_summary": "virtue discovers and runs tests found in the given objects.", "language": "python", "parameters": "(context, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "run", "(", "**", "arg_1", ")", "arg_0", ".", "exit", "(", "not", "arg_2", ".", "wasSuccessful", "(", ")", ")"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"\n    virtue discovers and runs tests found in the given objects.\n\n    Provide it with one or more tests (packages, modules or objects) to run.\n\n    \"\"\"\n\n    arg_2 = run(**arg_1)\n    arg_0.exit(not arg_2.wasSuccessful())", "path": "virtue/cli.py", "identifier": "main", "docstring": "virtue discovers and runs tests found in the given objects.\n\n    Provide it with one or more tests (packages, modules or objects) to run.", "docstring_tokens": ["virtue", "discovers", "and", "runs", "tests", "found", "in", "the", "given", "objects", "."], "nwo": "Julian/Virtue", "score": 0.17782712273869106, "idx": 259093}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/transmitters/learner_data.py#L27-L37", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Send a completion status call to Degreed using the client.", "language": "python", "parameters": "(self, payload, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", "[", "'app_label'", "]", "=", "'degreed'", "arg_2", "[", "'model_name'", "]", "=", "'DegreedLearnerDataTransmissionAudit'", "arg_2", "[", "'remote_user_id'", "]", "=", "'degreed_user_email'", "super", "(", "DegreedLearnerTransmitter", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Send a completion status call to Degreed using the client.\n\n        Args:\n            payload: The learner completion data payload to send to Degreed\n        \"\"\"\n        arg_2['app_label'] = 'degreed'\n        arg_2['model_name'] = 'DegreedLearnerDataTransmissionAudit'\n        arg_2['remote_user_id'] = 'degreed_user_email'\n        super(DegreedLearnerTransmitter, arg_0).Func(arg_1, **arg_2)", "path": "integrated_channels/degreed/transmitters/learner_data.py", "identifier": "DegreedLearnerTransmitter.transmit", "docstring": "Send a completion status call to Degreed using the client.\n\n        Args:\n            payload: The learner completion data payload to send to Degreed", "docstring_tokens": ["Send", "a", "completion", "status", "call", "to", "Degreed", "using", "the", "client", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259094}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_config.py#L220-L225", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Get the required 'settings' from the user and return as a dict.", "language": "python", "parameters": "(msg_type)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "CONFIG", "[", "arg_0", "]", "[", "\"settings\"", "]", ".", "items", "(", ")", ":", "arg_1", "[", "arg_2", "]", "=", "input", "(", "arg_3", "+", "\": \"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Get the required 'settings' from the user and return as a dict.\"\"\"\n    arg_1 = {}\n    for arg_2, arg_3 in CONFIG[arg_0][\"settings\"].items():\n        arg_1[arg_2] = input(arg_3 + \": \")\n    return arg_1", "path": "messages/_config.py", "identifier": "get_data_from_user", "docstring": "Get the required 'settings' from the user and return as a dict.", "docstring_tokens": ["Get", "the", "required", "settings", "from", "the", "user", "and", "return", "as", "a", "dict", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 259095}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/utils.py#L222-L250", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get LDTP format accessibile name", "language": "python", "parameters": "(self, acc)", "return_statement": "return role, label", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_role", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_get_title", "(", "arg_1", ")", "if", "re", ".", "match", "(", "\"AXWindow\"", ",", "arg_2", ",", "re", ".", "M", "|", "re", ".", "U", "|", "re", ".", "L", ")", ":", "arg_4", "=", "r\"( |\\n)\"", "else", ":", "arg_4", "=", "r\"( |:|\\.|_|\\n)\"", "if", "arg_3", ":", "arg_3", "=", "re", ".", "sub", "(", "arg_4", ",", "u\"\"", ",", "arg_3", ")", "arg_5", "=", "abbreviated_roles", ".", "get", "(", "arg_2", ",", "\"ukn\"", ")", "if", "arg_0", ".", "_ldtp_debug", "and", "arg_5", "==", "\"ukn\"", ":", "print", "(", "arg_2", ",", "arg_1", ")", "return", "arg_5", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get LDTP format accessibile name\n\n        @param acc: Accessible handle\n        @type acc: object\n\n        @return: object type, stripped object name (associated / direct),\n                        associated label\n        @rtype: tuple\n        \"\"\"\n        arg_2 = arg_0._get_role(arg_1)\n        arg_3 = arg_0._get_title(arg_1)\n        if re.match(\"AXWindow\", arg_2, re.M | re.U | re.L):\n            # Strip space and new line from window title\n            arg_4 = r\"( |\\n)\"\n        else:\n            # Strip space, colon, dot, underscore and new line from\n            # all other object types\n            arg_4 = r\"( |:|\\.|_|\\n)\"\n        if arg_3:\n            # Return the role type (if, not in the know list of roles,\n            # return ukn - unknown), strip the above characters from name\n            # also return labely_by string\n            arg_3 = re.sub(arg_4, u\"\", arg_3)\n        arg_5 = abbreviated_roles.get(arg_2, \"ukn\")\n        if arg_0._ldtp_debug and arg_5 == \"ukn\":\n            print(arg_2, arg_1)\n        return arg_5, arg_3", "path": "atomac/ldtpd/utils.py", "identifier": "Utils._ldtpize_accessible", "docstring": "Get LDTP format accessibile name\n\n        @param acc: Accessible handle\n        @type acc: object\n\n        @return: object type, stripped object name (associated / direct),\n                        associated label\n        @rtype: tuple", "docstring_tokens": ["Get", "LDTP", "format", "accessibile", "name"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 259096}
{"url": "https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_like.py#L117-L121", "sha": "d734f892ac4cc35d22746a4f2680425ffaff0927", "docstring_summary": "Likes last medias from hashtag", "language": "python", "parameters": "(self, hashtag, amount=None)", "return_statement": "return self.like_medias(medias)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "logger", ".", "info", "(", "\"Going to like media with hashtag #%s.\"", "%", "arg_1", ")", "arg_3", "=", "arg_0", ".", "get_total_hashtag_medias", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "like_medias", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\" Likes last medias from hashtag \"\"\"\n    arg_0.logger.info(\"Going to like media with hashtag #%s.\" % arg_1)\n    arg_3 = arg_0.get_total_hashtag_medias(arg_1, arg_2)\n    return arg_0.like_medias(arg_3)", "path": "instabot/bot/bot_like.py", "identifier": "like_hashtag", "docstring": "Likes last medias from hashtag", "docstring_tokens": ["Likes", "last", "medias", "from", "hashtag"], "nwo": "instagrambot/instabot", "score": 0.9915293927020312, "idx": 259097}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/prefer_static.py#L41-L56", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Wraps original_fn, preferring to call static_fn when inputs are static.", "language": "python", "parameters": "(original_fn, static_fn)", "return_statement": "return wrap(original_fn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tf_inspect", ".", "getfullargspec", "(", "arg_0", ")", "arg_3", "=", "tf_inspect", ".", "getfullargspec", "(", "arg_1", ")", "if", "arg_2", "!=", "arg_3", ":", "raise", "ValueError", "(", "'Arg specs do not match: original={}, static={}, fn={}'", ".", "format", "(", "arg_2", ",", "arg_3", ",", "arg_0", ")", ")", "@", "decorator", ".", "decorator", "def", "wrap", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "del", "arg_4", "[", "arg_7", ",", "arg_8", "]", ",", "arg_9", "=", "_maybe_get_static_args", "(", "[", "arg_5", ",", "arg_6", "]", ")", "if", "arg_9", ":", "return", "arg_1", "(", "*", "arg_7", ",", "**", "arg_8", ")", "return", "arg_0", "(", "*", "arg_5", ",", "**", "arg_6", ")", "return", "wrap", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Wraps original_fn, preferring to call static_fn when inputs are static.\"\"\"\n  arg_2 = tf_inspect.getfullargspec(arg_0)\n  arg_3 = tf_inspect.getfullargspec(arg_1)\n  if arg_2 != arg_3:\n    raise ValueError(\n        'Arg specs do not match: original={}, static={}, fn={}'.format(\n            arg_2, arg_3, arg_0))\n  @decorator.decorator\n  def wrap(arg_4, *arg_5, **arg_6):\n    del arg_4\n    [arg_7, arg_8], arg_9 = _maybe_get_static_args([arg_5, arg_6])\n    if arg_9:\n      return arg_1(*arg_7, **arg_8)\n    return arg_0(*arg_5, **arg_6)\n  return wrap(arg_0)", "path": "tensorflow_probability/python/internal/prefer_static.py", "identifier": "_prefer_static", "docstring": "Wraps original_fn, preferring to call static_fn when inputs are static.", "docstring_tokens": ["Wraps", "original_fn", "preferring", "to", "call", "static_fn", "when", "inputs", "are", "static", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259098}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/schedulermanagementservice.py#L204-L219", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "The Get Job Collection operation gets the details of a job collection", "language": "python", "parameters": "(self, cloud_service_id, job_collection_id)", "return_statement": "return self._perform_get(path, Resource)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "_validate_not_none", "(", "'cloud_service_id'", ",", "arg_1", ")", "_validate_not_none", "(", "'job_collection_id'", ",", "arg_2", ")", "arg_3", "=", "arg_0", ".", "_Func_path", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "_perform_get", "(", "arg_3", ",", "Resource", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        The Get Job Collection operation gets the details of a job collection\n\n        cloud_service_id:\n            The cloud service id\n        job_collection_id:\n            Name of the hosted service.\n        '''\n        _validate_not_none('cloud_service_id', arg_1)\n        _validate_not_none('job_collection_id', arg_2)\n\n        arg_3 = arg_0._Func_path(\n            arg_1, arg_2)\n\n        return arg_0._perform_get(arg_3, Resource)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/schedulermanagementservice.py", "identifier": "SchedulerManagementService.get_job_collection", "docstring": "The Get Job Collection operation gets the details of a job collection\n\n        cloud_service_id:\n            The cloud service id\n        job_collection_id:\n            Name of the hosted service.", "docstring_tokens": ["The", "Get", "Job", "Collection", "operation", "gets", "the", "details", "of", "a", "job", "collection"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259099}
{"url": "https://github.com/dhhagan/py-opc/blob/2c8f19530fb64bf5fd4ee0d694a47850161ed8a7/opc/__init__.py#L983-L1004", "sha": "2c8f19530fb64bf5fd4ee0d694a47850161ed8a7", "docstring_summary": "Return the bin boundaries.", "language": "python", "parameters": "(self)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "{", "}", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x33", "]", ")", "sleep", "(", "10e-3", ")", "for", "arg_3", "in", "range", "(", "30", ")", ":", "arg_4", "=", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x00", "]", ")", "[", "0", "]", "arg_1", ".", "append", "(", "arg_4", ")", "for", "arg_3", "in", "range", "(", "0", ",", "14", ")", ":", "arg_2", "[", "\"Bin Boundary {0}\"", ".", "format", "(", "arg_3", ")", "]", "=", "arg_0", ".", "_16bit_unsigned", "(", "arg_1", "[", "2", "*", "arg_3", "]", ",", "arg_1", "[", "2", "*", "arg_3", "+", "1", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Return the bin boundaries.\n\n        :returns: dictionary with 17 bin boundaries.\n        \"\"\"\n        arg_1  = []\n        arg_2    = {}\n\n        # Send the command byte and sleep for 10 ms\n        arg_0.cnxn.xfer([0x33])\n        sleep(10e-3)\n\n        # Read the config variables by sending 256 empty bytes\n        for arg_3 in range(30):\n            arg_4 = arg_0.cnxn.xfer([0x00])[0]\n            arg_1.append(arg_4)\n\n        # Add the bin bounds to the dictionary of data [bytes 0-29]\n        for arg_3 in range(0, 14):\n            arg_2[\"Bin Boundary {0}\".format(arg_3)] = arg_0._16bit_unsigned(arg_1[2*arg_3], arg_1[2*arg_3 + 1])\n\n        return arg_2", "path": "opc/__init__.py", "identifier": "OPCN1.read_bin_boundaries", "docstring": "Return the bin boundaries.\n\n        :returns: dictionary with 17 bin boundaries.", "docstring_tokens": ["Return", "the", "bin", "boundaries", "."], "nwo": "dhhagan/py-opc", "score": 0.2904380171157967, "idx": 259100}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/q_demo_model.py#L153-L163", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Imports a single experience to memory.", "language": "python", "parameters": "(self, states, internals, actions, terminal, reward)", "return_statement": "return self.demo_memory.store(\n            states=states,\n            internals=internals,\n            actions=actions,\n            terminal=terminal,\n            reward=reward\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "return", "arg_0", ".", "demo_memory", ".", "store", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"\n        Imports a single experience to memory.\n        \"\"\"\n        return arg_0.demo_memory.store(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5\n        )", "path": "tensorforce/models/q_demo_model.py", "identifier": "QDemoModel.tf_import_demo_experience", "docstring": "Imports a single experience to memory.", "docstring_tokens": ["Imports", "a", "single", "experience", "to", "memory", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 259101}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/space.py#L947-L964", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Create or get the base space from a list of spaces", "language": "python", "parameters": "(self, bases_)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tuple", "(", "base", ".", "bases", "[", "0", "]", "if", "base", ".", "is_dynamic", "(", ")", "else", "base", "for", "base", "in", "arg_1", ")", "if", "len", "(", "arg_2", ")", "==", "1", ":", "return", "arg_2", "[", "0", "]", "elif", "len", "(", "arg_2", ")", ">", "1", ":", "return", "arg_0", ".", "model", ".", "get_dynamic_base", "(", "arg_2", ")", "else", ":", "RuntimeError", "(", "\"must not happen\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create or get the base space from a list of spaces\n\n        if a direct base space in `bases` is dynamic, replace it with\n        its base.\n        \"\"\"\n        arg_2 = tuple(\n            base.bases[0] if base.is_dynamic() else base for base in arg_1\n        )\n\n        if len(arg_2) == 1:\n            return arg_2[0]\n\n        elif len(arg_2) > 1:\n            return arg_0.model.get_dynamic_base(arg_2)\n\n        else:\n            RuntimeError(\"must not happen\")", "path": "modelx/core/space.py", "identifier": "BaseSpaceImpl._get_dynamic_base", "docstring": "Create or get the base space from a list of spaces\n\n        if a direct base space in `bases` is dynamic, replace it with\n        its base.", "docstring_tokens": ["Create", "or", "get", "the", "base", "space", "from", "a", "list", "of", "spaces"], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 259102}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/aws_athena_operator.py#L70-L91", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Run Presto Query on Athena", "language": "python", "parameters": "(self, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "hook", "=", "arg_0", ".", "get_hook", "(", ")", "arg_0", ".", "hook", ".", "get_conn", "(", ")", "arg_0", ".", "query_execution_context", "[", "'Database'", "]", "=", "arg_0", ".", "database", "arg_0", ".", "result_configuration", "[", "'OutputLocation'", "]", "=", "arg_0", ".", "output_location", "arg_0", ".", "query_execution_id", "=", "arg_0", ".", "hook", ".", "run_query", "(", "arg_0", ".", "query", ",", "arg_0", ".", "query_execution_context", ",", "arg_0", ".", "result_configuration", ",", "arg_0", ".", "client_request_token", ")", "arg_6", "=", "arg_0", ".", "hook", ".", "poll_query_status", "(", "arg_0", ".", "query_execution_id", ",", "arg_0", ".", "max_tries", ")", "if", "arg_6", "in", "AWSAthenaHook", ".", "FAILURE_STATES", ":", "raise", "Exception", "(", "'Final state of Athena job is {}, query_execution_id is {}.'", ".", "format", "(", "arg_6", ",", "arg_0", ".", "query_execution_id", ")", ")", "elif", "not", "arg_6", "or", "arg_6", "in", "AWSAthenaHook", ".", "INTERMEDIATE_STATES", ":", "raise", "Exception", "(", "'Final state of Athena job is {}. '", "'Max tries of poll status exceeded, query_execution_id is {}.'", ".", "format", "(", "arg_6", ",", "arg_0", ".", "query_execution_id", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Run Presto Query on Athena\n        \"\"\"\n        arg_0.hook = arg_0.get_hook()\n        arg_0.hook.get_conn()\n\n        arg_0.query_execution_context['Database'] = arg_0.database\n        arg_0.result_configuration['OutputLocation'] = arg_0.output_location\n        arg_0.query_execution_id = arg_0.hook.run_query(arg_0.query, arg_0.query_execution_context,\n                                                      arg_0.result_configuration, arg_0.client_request_token)\n        arg_6 = arg_0.hook.poll_query_status(arg_0.query_execution_id, arg_0.max_tries)\n\n        if arg_6 in AWSAthenaHook.FAILURE_STATES:\n            raise Exception(\n                'Final state of Athena job is {}, query_execution_id is {}.'\n                .format(arg_6, arg_0.query_execution_id))\n        elif not arg_6 or arg_6 in AWSAthenaHook.INTERMEDIATE_STATES:\n            raise Exception(\n                'Final state of Athena job is {}. '\n                'Max tries of poll status exceeded, query_execution_id is {}.'\n                .format(arg_6, arg_0.query_execution_id))", "path": "airflow/contrib/operators/aws_athena_operator.py", "identifier": "AWSAthenaOperator.execute", "docstring": "Run Presto Query on Athena", "docstring_tokens": ["Run", "Presto", "Query", "on", "Athena"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259103}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L256-L276", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Asserts that val contains the given item or items.", "language": "python", "parameters": "(self, *items)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more args must be given'", ")", "elif", "len", "(", "arg_1", ")", "==", "1", ":", "if", "arg_1", "[", "0", "]", "not", "in", "arg_0", ".", "val", ":", "if", "arg_0", ".", "_check_dict_like", "(", "arg_0", ".", "val", ",", "return_as_bool", "=", "True", ")", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to contain key <%s>, but did not.'", "%", "(", "arg_0", ".", "val", ",", "arg_1", "[", "0", "]", ")", ")", "else", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to contain item <%s>, but did not.'", "%", "(", "arg_0", ".", "val", ",", "arg_1", "[", "0", "]", ")", ")", "else", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", "not", "in", "arg_0", ".", "val", ":", "arg_2", ".", "append", "(", "arg_3", ")", "if", "arg_2", ":", "if", "arg_0", ".", "_check_dict_like", "(", "arg_0", ".", "val", ",", "return_as_bool", "=", "True", ")", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to contain keys %s, but did not contain key%s %s.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ",", "''", "if", "len", "(", "arg_2", ")", "==", "0", "else", "'s'", ",", "arg_0", ".", "_fmt_items", "(", "arg_2", ")", ")", ")", "else", ":", "arg_0", ".", "_err", "(", "'Expected <%s> to contain items %s, but did not contain %s.'", "%", "(", "arg_0", ".", "val", ",", "arg_0", ".", "_fmt_items", "(", "arg_1", ")", ",", "arg_0", ".", "_fmt_items", "(", "arg_2", ")", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Asserts that val Func the given item or items.\"\"\"\n        if len(arg_1) == 0:\n            raise ValueError('one or more args must be given')\n        elif len(arg_1) == 1:\n            if arg_1[0] not in arg_0.val:\n                if arg_0._check_dict_like(arg_0.val, return_as_bool=True):\n                    arg_0._err('Expected <%s> to contain key <%s>, but did not.' % (arg_0.val, arg_1[0]))\n                else:\n                    arg_0._err('Expected <%s> to contain item <%s>, but did not.' % (arg_0.val, arg_1[0]))\n        else:\n            arg_2 = []\n            for arg_3 in arg_1:\n                if arg_3 not in arg_0.val:\n                    arg_2.append(arg_3)\n            if arg_2:\n                if arg_0._check_dict_like(arg_0.val, return_as_bool=True):\n                    arg_0._err('Expected <%s> to contain keys %s, but did not contain key%s %s.' % (arg_0.val, arg_0._fmt_items(arg_1), '' if len(arg_2) == 0 else 's', arg_0._fmt_items(arg_2)))\n                else:\n                    arg_0._err('Expected <%s> to contain items %s, but did not contain %s.' % (arg_0.val, arg_0._fmt_items(arg_1), arg_0._fmt_items(arg_2)))\n        return arg_0", "path": "assertpy/assertpy.py", "identifier": "AssertionBuilder.contains", "docstring": "Asserts that val contains the given item or items.", "docstring_tokens": ["Asserts", "that", "val", "contains", "the", "given", "item", "or", "items", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 259104}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/filt_obj.py#L346-L377", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Make filter from logical expression.", "language": "python", "parameters": "(self, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "!=", "''", ":", "def", "make_runable", "(", "arg_2", ")", ":", "return", "\"self.components['\"", "+", "arg_0", ".", "fuzzmatch", "(", "arg_2", ".", "group", "(", "0", ")", ")", "+", "\"']\"", "arg_3", "=", "re", ".", "sub", "(", "'[^\\(\\)|& ]+'", ",", "make_runable", ",", "arg_1", ")", "return", "eval", "(", "arg_3", ")", "else", ":", "return", "~", "np", ".", "zeros", "(", "arg_0", ".", "size", ",", "dtype", "=", "bool", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Make filter from logical expression.\n\n        Takes a logical expression as an input, and returns a filter. Used for advanced\n        filtering, where combinations of nested and/or filters are desired. Filter names must\n        exactly match the names listed by print(filt).\n\n        Example: ``key = '(Filter_1 | Filter_2) & Filter_3'``\n        is equivalent to:\n        ``(Filter_1 OR Filter_2) AND Filter_3``\n        statements in parentheses are evaluated first.\n\n        Parameters\n        ----------\n        key : str\n            logical expression describing filter construction.\n\n        Returns\n        -------\n        array_like\n            boolean filter\n\n        \"\"\"\n        if arg_1 != '':\n            def make_runable(arg_2):\n                return \"self.components['\" + arg_0.fuzzmatch(arg_2.group(0)) + \"']\"\n\n            arg_3 = re.sub('[^\\(\\)|& ]+', make_runable, arg_1)\n            return eval(arg_3)\n        else:\n            return ~np.zeros(arg_0.size, dtype=bool)", "path": "latools/filtering/filt_obj.py", "identifier": "filt.make_fromkey", "docstring": "Make filter from logical expression.\n\n        Takes a logical expression as an input, and returns a filter. Used for advanced\n        filtering, where combinations of nested and/or filters are desired. Filter names must\n        exactly match the names listed by print(filt).\n\n        Example: ``key = '(Filter_1 | Filter_2) & Filter_3'``\n        is equivalent to:\n        ``(Filter_1 OR Filter_2) AND Filter_3``\n        statements in parentheses are evaluated first.\n\n        Parameters\n        ----------\n        key : str\n            logical expression describing filter construction.\n\n        Returns\n        -------\n        array_like\n            boolean filter", "docstring_tokens": ["Make", "filter", "from", "logical", "expression", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 259105}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L190-L204", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Install specified python packages using pip. -U option added\n        Waits for command to finish.", "language": "python", "parameters": "(self, package_names, raise_on_error=True)", "return_statement": "return self.wait(cmd, raise_on_error=raise_on_error)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_3", "=", "\"Func install -U %s\"", "%", "(", "' '", ".", "join", "(", "arg_1", ")", ")", "return", "arg_0", ".", "wait", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Install specified python packages using Func. -U option added\n        Waits for command to finish.\n\n        Parameters\n        ----------\n        package_names: list-like of str\n        raise_on_error: bool, default True\n            If True then raise ValueError if stderr is not empty\n        \"\"\"\n        if isinstance(arg_1, basestring):\n            arg_1 = [arg_1]\n        arg_3 = \"Func install -U %s\" % (' '.join(arg_1))\n        return arg_0.wait(arg_3, arg_2=arg_2)", "path": "poseidon/ssh.py", "identifier": "SSHClient.pip", "docstring": "Install specified python packages using pip. -U option added\n        Waits for command to finish.\n\n        Parameters\n        ----------\n        package_names: list-like of str\n        raise_on_error: bool, default True\n            If True then raise ValueError if stderr is not empty", "docstring_tokens": ["Install", "specified", "python", "packages", "using", "pip", ".", "-", "U", "option", "added", "Waits", "for", "command", "to", "finish", "."], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 259106}
{"url": "https://github.com/marrow/web.db/blob/c755fbff7028a5edc223d6a631b8421858274fc4/web/db/mongo/grid.py#L9-L38", "sha": "c755fbff7028a5edc223d6a631b8421858274fc4", "docstring_summary": "Allow direct use of GridOut GridFS file wrappers as endpoint responses.", "language": "python", "parameters": "(context, f)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "seek", "(", "0", ")", "arg_2", "=", "arg_0", ".", "response", "if", "__debug__", ":", "arg_2", ".", "headers", "[", "'Grid-ID'", "]", "=", "str", "(", "arg_1", ".", "_id", ")", "log", ".", "debug", "(", "\"Serving GridFS file.\"", ",", "extra", "=", "dict", "(", "identifier", "=", "str", "(", "arg_1", ".", "_id", ")", ",", "filename", "=", "arg_1", ".", "filename", ",", "length", "=", "arg_1", ".", "length", ",", "mimetype", "=", "arg_1", ".", "content_type", ")", ")", "arg_2", ".", "conditional_response", "=", "True", "arg_2", ".", "accept_ranges", "=", "'bytes'", "arg_2", ".", "content_type", "=", "arg_1", ".", "content_type", "arg_2", ".", "content_length", "=", "arg_1", ".", "length", "arg_2", ".", "content_md5", "=", "arg_2", ".", "etag", "=", "arg_1", ".", "md5", "arg_2", ".", "last_modified", "=", "arg_1", ".", "metadata", ".", "get", "(", "'modified'", ",", "None", ")", "arg_2", ".", "content_disposition", "=", "'attachment; filename='", "+", "arg_1", ".", "name", "if", "arg_0", ".", "request", ".", "if_range", ".", "match_response", "(", "arg_2", ")", ":", "arg_2", ".", "body_file", "=", "arg_1", "else", ":", "arg_2", ".", "app_iter", "=", "iter", "(", "arg_1", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n\t\"\"\"Allow direct use of GridOut GridFS file wrappers as endpoint responses.\"\"\"\n\t\n\targ_1.seek(0)  # Ensure we are reading from the beginning.\n\targ_2 = arg_0.response  # Frequently accessed, so made local.  Useless optimization on Pypy.\n\t\n\tif __debug__:  # We add some useful diagnostic information in development, omitting from production due to sec.\n\t\targ_2.headers['Grid-ID'] = str(arg_1._id)  # The GridFS file ID.\n\t\tlog.debug(\"Serving GridFS file.\", extra=dict(\n\t\t\t\tidentifier = str(arg_1._id),\n\t\t\t\tfilename = arg_1.filename,\n\t\t\t\tlength = arg_1.length,\n\t\t\t\tmimetype = arg_1.content_type\n\t\t\t))\n\t\n\targ_2.conditional_response = True\n\targ_2.accept_ranges = 'bytes'  # We allow returns of partial content, if requested.\n\targ_2.content_type = arg_1.content_type  # Direct transfer of GridFS-stored MIME type.\n\targ_2.content_length = arg_1.length  # The length was pre-computed when the file was uploaded.\n\targ_2.content_md5 = arg_2.etag = arg_1.md5  # As was the MD5, used for simple integrity testing.\n\targ_2.last_modified = arg_1.metadata.get('modified', None)  # Optional additional metadata.\n\targ_2.content_disposition = 'attachment; filename=' + arg_1.name  # Preserve the filename through to the client.\n\t\n\t# Being asked for a range or not determines the streaming style used.\n\tif arg_0.request.if_range.match_response(arg_2):\n\t\targ_2.body_file = arg_1  # Support seek + limited read.\n\telse:\n\t\targ_2.app_iter = iter(arg_1)  # Assign the body as a streaming, chunked iterator.\n\t\n\treturn True", "path": "web/db/mongo/grid.py", "identifier": "render_grid_file", "docstring": "Allow direct use of GridOut GridFS file wrappers as endpoint responses.", "docstring_tokens": ["Allow", "direct", "use", "of", "GridOut", "GridFS", "file", "wrappers", "as", "endpoint", "responses", "."], "nwo": "marrow/web.db", "score": 0.2424429654267875, "idx": 259107}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/parse.py#L200-L228", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "these kwargs come from the", "language": "python", "parameters": "(self, kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ":", "arg_0", ".", "parser_kwargs", ".", "update", "(", "arg_1", ")", "arg_0", ".", "parser_kwargs", ".", "setdefault", "(", "'dest'", ",", "arg_0", ".", "name", ")", "if", "'default'", "in", "arg_1", ":", "arg_0", ".", "parser_kwargs", "[", "\"default\"", "]", "=", "arg_1", "[", "\"default\"", "]", "arg_0", ".", "parser_kwargs", "[", "\"required\"", "]", "=", "False", "elif", "'action'", "in", "arg_1", ":", "if", "arg_1", "[", "'action'", "]", "in", "set", "(", "[", "'store_false'", ",", "'store_true'", "]", ")", ":", "arg_0", ".", "parser_kwargs", "[", "'required'", "]", "=", "False", "elif", "arg_1", "[", "'action'", "]", "in", "set", "(", "[", "'version'", "]", ")", ":", "arg_0", ".", "parser_kwargs", ".", "pop", "(", "'required'", ",", "False", ")", "else", ":", "arg_0", ".", "parser_kwargs", ".", "setdefault", "(", "\"required\"", ",", "True", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"these kwargs come from the @arg decorator, they are then merged into any\n        keyword arguments that were automatically generated from the main function\n        introspection\"\"\"\n        if arg_1:\n            arg_0.parser_kwargs.update(arg_1)\n\n        #self.parser_kwargs['dest'] = self.name\n        arg_0.parser_kwargs.setdefault('dest', arg_0.name)\n\n        # special handling of any passed in values\n        if 'default' in arg_1:\n            # NOTE -- this doesn't use .set_default() because that is meant to\n            # parse from the function definition so it actually has different syntax\n            # than what the .set_default() method does. eg, @arg(\"--foo\", default=[1, 2]) means\n            # that the default value should be an array with 1 and 2 in it, where main(foo=[1, 2])\n            # means foo should be constrained to choices=[1, 2]\n            arg_0.parser_kwargs[\"default\"] = arg_1[\"default\"]\n            arg_0.parser_kwargs[\"required\"] = False\n\n        elif 'action' in arg_1:\n            if arg_1['action'] in set(['store_false', 'store_true']):\n                arg_0.parser_kwargs['required'] = False\n\n            elif arg_1['action'] in set(['version']):\n                arg_0.parser_kwargs.pop('required', False)\n\n        else:\n            arg_0.parser_kwargs.setdefault(\"required\", True)", "path": "captain/parse.py", "identifier": "ScriptKwarg.merge_kwargs", "docstring": "these kwargs come from the @arg decorator, they are then merged into any\n        keyword arguments that were automatically generated from the main function\n        introspection", "docstring_tokens": ["these", "kwargs", "come", "from", "the"], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 259108}
{"url": "https://github.com/SkypLabs/python-hdlc-controller/blob/b7b964654728b2c11142a742e5d17821f1fe4788/hdlcontroller/hdlcontroller.py#L110-L131", "sha": "b7b964654728b2c11142a742e5d17821f1fe4788", "docstring_summary": "Sends a new data frame.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "len", "(", "arg_0", ".", "Funcers", ")", ">=", "arg_0", ".", "window", ":", "pass", "arg_0", ".", "Funcers", "[", "arg_0", ".", "new_seq_no", "]", "=", "arg_0", ".", "Sender", "(", "arg_0", ".", "write", ",", "arg_0", ".", "Func_lock", ",", "arg_1", ",", "arg_0", ".", "new_seq_no", ",", "timeout", "=", "arg_0", ".", "Funcing_timeout", ",", "callback", "=", "arg_0", ".", "Func_callback", ",", ")", "arg_0", ".", "Funcers", "[", "arg_0", ".", "new_seq_no", "]", ".", "start", "(", ")", "arg_0", ".", "new_seq_no", "=", "(", "arg_0", ".", "new_seq_no", "+", "1", ")", "%", "HDLController", ".", "MAX_SEQ_NO"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sends a new data frame.\n\n        This method will block until a new room is available for\n        a new Funcer. This limit is determined by the size of the window.\n        \"\"\"\n\n        while len(arg_0.Funcers) >= arg_0.window:\n            pass\n\n        arg_0.Funcers[arg_0.new_seq_no] = arg_0.Sender(\n            arg_0.write,\n            arg_0.Func_lock,\n            arg_1,\n            arg_0.new_seq_no,\n            timeout=arg_0.Funcing_timeout,\n            callback=arg_0.Func_callback,\n        )\n\n        arg_0.Funcers[arg_0.new_seq_no].start()\n        arg_0.new_seq_no = (arg_0.new_seq_no + 1) % HDLController.MAX_SEQ_NO", "path": "hdlcontroller/hdlcontroller.py", "identifier": "HDLController.send", "docstring": "Sends a new data frame.\n\n        This method will block until a new room is available for\n        a new sender. This limit is determined by the size of the window.", "docstring_tokens": ["Sends", "a", "new", "data", "frame", "."], "nwo": "SkypLabs/python-hdlc-controller", "score": 0.2902215478404936, "idx": 259109}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deploy.py#L184-L192", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Unmarks the remote server as currently being deployed to.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "init", "(", ")", "arg_1", "=", "arg_0", ".", "local_renderer", "if", "arg_0", ".", "file_exists", "(", "arg_1", ".", "env", ".", "lockfile_path", ")", ":", "arg_0", ".", "vprint", "(", "'Unlocking %s.'", "%", "arg_1", ".", "env", ".", "lockfile_path", ")", "arg_1", ".", "run_or_local", "(", "'rm -f {lockfile_path}'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Unmarks the remote server as currently being deployed to.\n        \"\"\"\n        arg_0.init()\n        arg_1 = arg_0.local_renderer\n        if arg_0.file_exists(arg_1.env.lockfile_path):\n            arg_0.vprint('Unlocking %s.' % arg_1.env.lockfile_path)\n            arg_1.run_or_local('rm -f {lockfile_path}')", "path": "burlap/deploy.py", "identifier": "DeploySatchel.unlock", "docstring": "Unmarks the remote server as currently being deployed to.", "docstring_tokens": ["Unmarks", "the", "remote", "server", "as", "currently", "being", "deployed", "to", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259110}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/math/linalg.py#L898-L911", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Checks that input is a `float` matrix.", "language": "python", "parameters": "(a, validate_args)", "return_statement": "return assertions", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "not", "arg_0", ".", "dtype", ".", "is_floating", ":", "raise", "TypeError", "(", "'Input `a` must have `float`-like `dtype` '", "'(saw {}).'", ".", "format", "(", "arg_0", ".", "dtype", ".", "name", ")", ")", "if", "arg_0", ".", "shape", ".", "ndims", "is", "not", "None", ":", "if", "arg_0", ".", "shape", ".", "ndims", "<", "2", ":", "raise", "ValueError", "(", "'Input `a` must have at least 2 dimensions '", "'(saw: {}).'", ".", "format", "(", "arg_0", ".", "shape", ".", "ndims", ")", ")", "elif", "arg_1", ":", "arg_2", ".", "append", "(", "tf", ".", "compat", ".", "v1", ".", "assert_rank_at_least", "(", "arg_0", ",", "rank", "=", "2", ",", "message", "=", "'Input `a` must have at least 2 dimensions.'", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Checks that input is a `float` matrix.\"\"\"\n  arg_2 = []\n  if not arg_0.dtype.is_floating:\n    raise TypeError('Input `a` must have `float`-like `dtype` '\n                    '(saw {}).'.format(arg_0.dtype.name))\n  if arg_0.shape.ndims is not None:\n    if arg_0.shape.ndims < 2:\n      raise ValueError('Input `a` must have at least 2 dimensions '\n                       '(saw: {}).'.format(arg_0.shape.ndims))\n  elif arg_1:\n    arg_2.append(tf.compat.v1.assert_rank_at_least(\n        arg_0, rank=2, message='Input `a` must have at least 2 dimensions.'))\n  return arg_2", "path": "tensorflow_probability/python/math/linalg.py", "identifier": "_maybe_validate_matrix", "docstring": "Checks that input is a `float` matrix.", "docstring_tokens": ["Checks", "that", "input", "is", "a", "float", "matrix", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259111}
{"url": "https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/templatetags/publication_extras.py#L91-L104", "sha": "5a75cf88cf794937711b6850ff2acb07fe005f08", "docstring_summary": "Renders some basic TeX math to HTML.", "language": "python", "parameters": "(string)", "return_statement": "return mark_safe(sub(r'\\$([^\\$]*)\\$', tex_replace, escape(string)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "'{'", ",", "''", ")", ".", "replace", "(", "'}'", ",", "''", ")", "def", "tex_replace", "(", "arg_1", ")", ":", "return", "sub", "(", "r'\\^(\\w)'", ",", "r'<sup>\\1</sup>'", ",", "sub", "(", "r'\\^\\{(.*?)\\}'", ",", "r'<sup>\\1</sup>'", ",", "sub", "(", "r'\\_(\\w)'", ",", "r'<sub>\\1</sub>'", ",", "sub", "(", "r'\\_\\{(.*?)\\}'", ",", "r'<sub>\\1</sub>'", ",", "sub", "(", "r'\\\\('", "+", "GREEK_LETTERS", "+", "')'", ",", "r'&\\1;'", ",", "arg_1", ".", "group", "(", "1", ")", ")", ")", ")", ")", ")", "return", "mark_safe", "(", "sub", "(", "r'\\$([^\\$]*)\\$'", ",", "tex_replace", ",", "escape", "(", "arg_0", ")", ")", ")"], "function": "def Func(arg_0):\n\t\"\"\"\n\tRenders some basic TeX math to HTML.\n\t\"\"\"\n\n\targ_0 = arg_0.replace('{', '').replace('}', '')\n\tdef tex_replace(arg_1):\n\t\treturn \\\n\t\t\tsub(r'\\^(\\w)', r'<sup>\\1</sup>',\n\t\t\tsub(r'\\^\\{(.*?)\\}', r'<sup>\\1</sup>',\n\t\t\tsub(r'\\_(\\w)', r'<sub>\\1</sub>',\n\t\t\tsub(r'\\_\\{(.*?)\\}', r'<sub>\\1</sub>',\n\t\t\tsub(r'\\\\(' + GREEK_LETTERS + ')', r'&\\1;', arg_1.group(1))))))\n\treturn mark_safe(sub(r'\\$([^\\$]*)\\$', tex_replace, escape(arg_0)))", "path": "publications/templatetags/publication_extras.py", "identifier": "tex_parse", "docstring": "Renders some basic TeX math to HTML.", "docstring_tokens": ["Renders", "some", "basic", "TeX", "math", "to", "HTML", "."], "nwo": "lucastheis/django-publications", "score": 0.41971037138316925, "idx": 259112}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L69-L85", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Runs SAMtools index to create a BAM index file", "language": "python", "parameters": "(job, bam)", "return_statement": "return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'sample.bam.bai'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "arg_0", ".", "fileStore", ".", "readGlobalFile", "(", "arg_1", ",", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'sample.bam'", ")", ")", "arg_3", "=", "[", "'index'", ",", "'/data/sample.bam'", "]", "dockerCall", "(", "arg_0", "=", "arg_0", ",", "workDir", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "tool", "=", "'quay.io/ucsc_cgl/samtools:0.1.19--dd5ac549b95eb3e5d166a5e310417ef13651994e'", ")", "return", "arg_0", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'sample.bam.bai'", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Runs SAMtools index to create a BAM index file\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str bam: FileStoreID of the BAM file\n    :return: FileStoreID for BAM index file\n    :rtype: str\n    \"\"\"\n    arg_2 = arg_0.fileStore.getLocalTempDir()\n    arg_0.fileStore.readGlobalFile(arg_1, os.path.join(arg_2, 'sample.bam'))\n    # Call: index the bam\n    arg_3 = ['index', '/data/sample.bam']\n    dockerCall(arg_0=arg_0, workDir=arg_2, arg_3=arg_3,\n               tool='quay.io/ucsc_cgl/samtools:0.1.19--dd5ac549b95eb3e5d166a5e310417ef13651994e')\n    # Write to fileStore\n    return arg_0.fileStore.writeGlobalFile(os.path.join(arg_2, 'sample.bam.bai'))", "path": "src/toil_lib/tools/preprocessing.py", "identifier": "run_samtools_index", "docstring": "Runs SAMtools index to create a BAM index file\n\n    :param JobFunctionWrappingJob job: passed automatically by Toil\n    :param str bam: FileStoreID of the BAM file\n    :return: FileStoreID for BAM index file\n    :rtype: str", "docstring_tokens": ["Runs", "SAMtools", "index", "to", "create", "a", "BAM", "index", "file"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 259113}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/data.py#L213-L220", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Add measured arc data.", "language": "python", "parameters": "(self, arc_data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "iitems", "(", "arg_1", ")", ":", "arg_0", ".", "arcs", ".", "setdefault", "(", "arg_2", ",", "{", "}", ")", ".", "update", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add measured arc data.\n\n        `arc_data` is { filename: { (l1,l2): None, ... }, ...}\n\n        \"\"\"\n        for arg_2, arg_3 in iitems(arg_1):\n            arg_0.arcs.setdefault(arg_2, {}).update(arg_3)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/data.py", "identifier": "CoverageData.add_arc_data", "docstring": "Add measured arc data.\n\n        `arc_data` is { filename: { (l1,l2): None, ... }, ...}", "docstring_tokens": ["Add", "measured", "arc", "data", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 259114}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/space.py#L149-L183", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Convert the cells in the view into a DataFrame object.", "language": "python", "parameters": "(self, *args)", "return_statement": "return _to_frame_inner(impls, args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "sys", ".", "version_info", "<", "(", "3", ",", "6", ",", "0", ")", ":", "from", "collections", "import", "OrderedDict", "arg_2", "=", "OrderedDict", "(", ")", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "items", "(", ")", ":", "arg_2", "[", "arg_3", "]", "=", "arg_4", ".", "_impl", "else", ":", "arg_2", "=", "get_impls", "(", "arg_0", ")", "return", "_Func_inner", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Convert the cells in the view into a DataFrame object.\n\n        If ``args`` is not given, this method returns a DataFrame that\n        has an Index or a MultiIndex depending of the number of\n        cells parameters and columns each of which corresponds to each\n        cells included in the view.\n\n        ``args`` can be given to calculate cells values and limit the\n        DataFrame indexes to the given arguments.\n\n        The cells in this view may have different number of parameters,\n        but parameters shared among multiple cells\n        must appear in the same position in all the parameter lists.\n        For example,\n        Having ``foo()``, ``bar(x)`` and ``baz(x, y=1)`` is okay\n        because the shared parameter ``x`` is always the first parameter,\n        but this method does not work if the view has ``quz(x, z=2, y=1)``\n        cells in addition to the first three cells, because ``y`` appears\n        in different positions.\n\n        Args:\n            args(optional): multiple arguments,\n               or an iterator of arguments to the cells.\n        \"\"\"\n        if sys.version_info < (3, 6, 0):\n            from collections import OrderedDict\n\n            arg_2 = OrderedDict()\n            for arg_3, arg_4 in arg_0.items():\n                arg_2[arg_3] = arg_4._impl\n        else:\n            arg_2 = get_impls(arg_0)\n\n        return _Func_inner(arg_2, arg_1)", "path": "modelx/core/space.py", "identifier": "CellsView.to_frame", "docstring": "Convert the cells in the view into a DataFrame object.\n\n        If ``args`` is not given, this method returns a DataFrame that\n        has an Index or a MultiIndex depending of the number of\n        cells parameters and columns each of which corresponds to each\n        cells included in the view.\n\n        ``args`` can be given to calculate cells values and limit the\n        DataFrame indexes to the given arguments.\n\n        The cells in this view may have different number of parameters,\n        but parameters shared among multiple cells\n        must appear in the same position in all the parameter lists.\n        For example,\n        Having ``foo()``, ``bar(x)`` and ``baz(x, y=1)`` is okay\n        because the shared parameter ``x`` is always the first parameter,\n        but this method does not work if the view has ``quz(x, z=2, y=1)``\n        cells in addition to the first three cells, because ``y`` appears\n        in different positions.\n\n        Args:\n            args(optional): multiple arguments,\n               or an iterator of arguments to the cells.", "docstring_tokens": ["Convert", "the", "cells", "in", "the", "view", "into", "a", "DataFrame", "object", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 259115}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L928-L948", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Called when the user presses return on the send message widget.", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "return", "elif", "arg_1", ".", "startswith", "(", "'/image'", ")", "and", "len", "(", "arg_1", ".", "split", "(", "' '", ")", ")", "==", "2", ":", "arg_2", "=", "arg_1", ".", "split", "(", "' '", ")", "[", "1", "]", "arg_3", "=", "open", "(", "arg_2", ",", "'rb'", ")", "arg_1", "=", "''", "else", ":", "arg_3", "=", "None", "arg_1", "=", "replace_emoticons", "(", "arg_1", ")", "arg_4", "=", "hangups", ".", "ChatMessageSegment", ".", "from_str", "(", "arg_1", ")", "arg_0", ".", "_coroutine_queue", ".", "put", "(", "arg_0", ".", "_handle_send_message", "(", "arg_0", ".", "_conversation", ".", "send_message", "(", "arg_4", ",", "arg_3", "=", "arg_3", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Called when the user presses return on the send message widget.\"\"\"\n        # Ignore if the user hasn't typed a message.\n        if not arg_1:\n            return\n        elif arg_1.startswith('/image') and len(arg_1.split(' ')) == 2:\n            # Temporary UI for testing image uploads\n            arg_2 = arg_1.split(' ')[1]\n            arg_3 = open(arg_2, 'rb')\n            arg_1 = ''\n        else:\n            arg_3 = None\n        arg_1 = replace_emoticons(arg_1)\n        arg_4 = hangups.ChatMessageSegment.from_str(arg_1)\n        arg_0._coroutine_queue.put(\n            arg_0._handle_send_message(\n                arg_0._conversation.send_message(\n                    arg_4, arg_3=arg_3\n                )\n            )\n        )", "path": "hangups/ui/__main__.py", "identifier": "ConversationWidget._on_return", "docstring": "Called when the user presses return on the send message widget.", "docstring_tokens": ["Called", "when", "the", "user", "presses", "return", "on", "the", "send", "message", "widget", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259116}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/search.py#L149-L164", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Search for keywords by name.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Search for Funcs by name.\n\n        Args:\n            query: CGI escpaed string.\n            page: (optional) Minimum value of 1. Expected value is an integer.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/search.py", "identifier": "Search.keyword", "docstring": "Search for keywords by name.\n\n        Args:\n            query: CGI escpaed string.\n            page: (optional) Minimum value of 1. Expected value is an integer.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Search", "for", "keywords", "by", "name", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 259117}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L200-L203", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns de minimum values of x, y, z as a numpy array", "language": "python", "parameters": "(self)", "return_statement": "return np.array([self.x_min, self.y_min, self.z_min])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "np", ".", "array", "(", "[", "arg_0", ".", "x_min", ",", "arg_0", ".", "y_min", ",", "arg_0", ".", "z_min", "]", ")"], "function": "def Func(arg_0):\n        \"\"\" Returns de minimum values of x, y, z as a numpy array\n        \"\"\"\n        return np.array([arg_0.x_min, arg_0.y_min, arg_0.z_min])", "path": "pylas/headers/rawheader.py", "identifier": "RawHeader1_1.mins", "docstring": "Returns de minimum values of x, y, z as a numpy array", "docstring_tokens": ["Returns", "de", "minimum", "values", "of", "x", "y", "z", "as", "a", "numpy", "array"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 259118}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L957-L975", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Returns time format preferred for Internet standards.", "language": "python", "parameters": "(timeval=None)", "return_statement": "return \"%s, %02d %s %04d %02d:%02d:%02d GMT\" % (\n            (\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\")[timeval[6]],\n            timeval[2],\n            (\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n             \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\")[timeval[1]-1],\n                                timeval[0], timeval[3], timeval[4], timeval[5])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "time", ".", "time", "(", ")", "arg_0", "=", "time", ".", "gmtime", "(", "arg_0", ")", "return", "\"%s, %02d %s %04d %02d:%02d:%02d GMT\"", "%", "(", "(", "\"Mon\"", ",", "\"Tue\"", ",", "\"Wed\"", ",", "\"Thu\"", ",", "\"Fri\"", ",", "\"Sat\"", ",", "\"Sun\"", ")", "[", "arg_0", "[", "6", "]", "]", ",", "arg_0", "[", "2", "]", ",", "(", "\"Jan\"", ",", "\"Feb\"", ",", "\"Mar\"", ",", "\"Apr\"", ",", "\"May\"", ",", "\"Jun\"", ",", "\"Jul\"", ",", "\"Aug\"", ",", "\"Sep\"", ",", "\"Oct\"", ",", "\"Nov\"", ",", "\"Dec\"", ")", "[", "arg_0", "[", "1", "]", "-", "1", "]", ",", "arg_0", "[", "0", "]", ",", "arg_0", "[", "3", "]", ",", "arg_0", "[", "4", "]", ",", "arg_0", "[", "5", "]", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Returns time format preferred for Internet standards.\n\n    Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123\n\n    According to RFC 1123, day and month names must always be in\n    English.  If not for that, this code could use strftime().  It\n    can't because strftime() honors the locale and could generate\n    non-English names.\n    \"\"\"\n    if arg_0 is None:\n        arg_0 = time.time()\n    arg_0 = time.gmtime(arg_0)\n    return \"%s, %02d %s %04d %02d:%02d:%02d GMT\" % (\n            (\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\")[arg_0[6]],\n            arg_0[2],\n            (\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n             \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\")[arg_0[1]-1],\n                                arg_0[0], arg_0[3], arg_0[4], arg_0[5])", "path": "third_party/stdlib/rfc822.py", "identifier": "formatdate", "docstring": "Returns time format preferred for Internet standards.\n\n    Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123\n\n    According to RFC 1123, day and month names must always be in\n    English.  If not for that, this code could use strftime().  It\n    can't because strftime() honors the locale and could generate\n    non-English names.", "docstring_tokens": ["Returns", "time", "format", "preferred", "for", "Internet", "standards", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 259119}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/backend.py#L109-L121", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "If ctx is a cairocffi Context convert it to a PyCairo Context\n        otherwise return the original context", "language": "python", "parameters": "(self, ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "cairocffi", "and", "isinstance", "(", "arg_1", ",", "arg_0", ".", "cairocffi", ".", "Context", ")", ":", "from", "shoebot", ".", "util", ".", "cairocffi", ".", "cairocffi_to_pycairo", "import", "_UNSAFE_cairocffi_context_to_pycairo", "return", "_UNSAFE_cairocffi_context_to_pycairo", "(", "arg_1", ")", "else", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        If ctx is a cairocffi Context convert it to a PyCairo Context\n        otherwise return the original context\n\n        :param ctx:\n        :return:\n        \"\"\"\n        if arg_0.cairocffi and isinstance(arg_1, arg_0.cairocffi.Context):\n            from shoebot.util.cairocffi.cairocffi_to_pycairo import _UNSAFE_cairocffi_context_to_pycairo\n            return _UNSAFE_cairocffi_context_to_pycairo(arg_1)\n        else:\n            return arg_1", "path": "shoebot/core/backend.py", "identifier": "CairoGIBackend.ensure_pycairo_context", "docstring": "If ctx is a cairocffi Context convert it to a PyCairo Context\n        otherwise return the original context\n\n        :param ctx:\n        :return:", "docstring_tokens": ["If", "ctx", "is", "a", "cairocffi", "Context", "convert", "it", "to", "a", "PyCairo", "Context", "otherwise", "return", "the", "original", "context"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259120}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L187-L195", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Obtain owner Private Key for an account from the wallet database", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "rpc", ".", "get_account", "(", "arg_1", ")", "for", "arg_3", "in", "arg_2", "[", "\"owner\"", "]", "[", "\"key_auths\"", "]", ":", "arg_4", "=", "arg_0", ".", "getPrivateKeyForPublicKey", "(", "arg_3", "[", "0", "]", ")", "if", "arg_4", ":", "return", "arg_4", "raise", "KeyNotFound"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Obtain owner Private Key for an account from the wallet database\n        \"\"\"\n        arg_2 = arg_0.rpc.get_account(arg_1)\n        for arg_3 in arg_2[\"owner\"][\"key_auths\"]:\n            arg_4 = arg_0.getPrivateKeyForPublicKey(arg_3[0])\n            if arg_4:\n                return arg_4\n        raise KeyNotFound", "path": "graphenecommon/wallet.py", "identifier": "Wallet.getOwnerKeyForAccount", "docstring": "Obtain owner Private Key for an account from the wallet database", "docstring_tokens": ["Obtain", "owner", "Private", "Key", "for", "an", "account", "from", "the", "wallet", "database"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 259121}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L291-L298", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Determine whether tile touches or goes over pyramid edge.", "language": "python", "parameters": "(self)", "return_statement": "return (\n            self.left <= self.tile_pyramid.left or      # touches_left\n            self.bottom <= self.tile_pyramid.bottom or  # touches_bottom\n            self.right >= self.tile_pyramid.right or    # touches_right\n            self.top >= self.tile_pyramid.top           # touches_top\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "left", "<=", "arg_0", ".", "tile_pyramid", ".", "left", "or", "arg_0", ".", "bottom", "<=", "arg_0", ".", "tile_pyramid", ".", "bottom", "or", "arg_0", ".", "right", ">=", "arg_0", ".", "tile_pyramid", ".", "right", "or", "arg_0", ".", "top", ">=", "arg_0", ".", "tile_pyramid", ".", "top", ")"], "function": "def Func(arg_0):\n        \"\"\"Determine whether tile touches or goes over pyramid edge.\"\"\"\n        return (\n            arg_0.left <= arg_0.tile_pyramid.left or      # touches_left\n            arg_0.bottom <= arg_0.tile_pyramid.bottom or  # touches_bottom\n            arg_0.right >= arg_0.tile_pyramid.right or    # touches_right\n            arg_0.top >= arg_0.tile_pyramid.top           # touches_top\n        )", "path": "mapchete/tile.py", "identifier": "BufferedTile.is_on_edge", "docstring": "Determine whether tile touches or goes over pyramid edge.", "docstring_tokens": ["Determine", "whether", "tile", "touches", "or", "goes", "over", "pyramid", "edge", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 259122}
{"url": "https://github.com/incuna/django-wkhtmltopdf/blob/4e73f604c48f7f449c916c4257a72af59517322c/wkhtmltopdf/views.py#L64-L82", "sha": "4e73f604c48f7f449c916c4257a72af59517322c", "docstring_summary": "Returns the freshly rendered content for the template and context\n        described by the PDFResponse.", "language": "python", "parameters": "(self)", "return_statement": "return render_pdf_from_template(\n            self.resolve_template(self.template_name),\n            self.resolve_template(self.header_template),\n            self.resolve_template(self.footer_template),\n            context=self.resolve_context(self.context_data),\n            request=self._request,\n            cmd_options=cmd_options,\n            cover_template=self.resolve_template(self.cover_template)\n\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "cmd_options", ".", "copy", "(", ")", "return", "render_pdf_from_template", "(", "arg_0", ".", "resolve_template", "(", "arg_0", ".", "template_name", ")", ",", "arg_0", ".", "resolve_template", "(", "arg_0", ".", "header_template", ")", ",", "arg_0", ".", "resolve_template", "(", "arg_0", ".", "footer_template", ")", ",", "context", "=", "arg_0", ".", "resolve_context", "(", "arg_0", ".", "context_data", ")", ",", "request", "=", "arg_0", ".", "_request", ",", "arg_1", "=", "arg_1", ",", "cover_template", "=", "arg_0", ".", "resolve_template", "(", "arg_0", ".", "cover_template", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns the freshly rendered content for the template and context\n        described by the PDFResponse.\n\n        This *does not* set the final content of the response. To set the\n        response content, you must either call render(), or set the\n        content explicitly using the value of this property.\n        \"\"\"\n        arg_1 = arg_0.cmd_options.copy()\n        return render_pdf_from_template(\n            arg_0.resolve_template(arg_0.template_name),\n            arg_0.resolve_template(arg_0.header_template),\n            arg_0.resolve_template(arg_0.footer_template),\n            context=arg_0.resolve_context(arg_0.context_data),\n            request=arg_0._request,\n            arg_1=arg_1,\n            cover_template=arg_0.resolve_template(arg_0.cover_template)\n\n        )", "path": "wkhtmltopdf/views.py", "identifier": "PDFTemplateResponse.rendered_content", "docstring": "Returns the freshly rendered content for the template and context\n        described by the PDFResponse.\n\n        This *does not* set the final content of the response. To set the\n        response content, you must either call render(), or set the\n        content explicitly using the value of this property.", "docstring_tokens": ["Returns", "the", "freshly", "rendered", "content", "for", "the", "template", "and", "context", "described", "by", "the", "PDFResponse", "."], "nwo": "incuna/django-wkhtmltopdf", "score": 0.5383908637665665, "idx": 259123}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3143-L3152", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Extract the \"minute\" part from a date column.", "language": "python", "parameters": "(self)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")", "if", "arg_1", ".", "_ex", ".", "_cache", ".", "types_valid", "(", ")", ":", "arg_1", ".", "_ex", ".", "_cache", ".", "types", "=", "{", "k", ":", "\"int\"", "for", "k", "in", "arg_0", ".", "_ex", ".", "_cache", ".", "types", ".", "keys", "(", ")", "}", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Extract the \"Func\" part from a date column.\n\n        :returns: a single-column H2OFrame containing the \"Func\" part from the source frame.\n        \"\"\"\n        arg_1 = H2OFrame._expr(expr=ExprNode(\"Func\", arg_0), cache=arg_0._ex._cache)\n        if arg_1._ex._cache.types_valid():\n            arg_1._ex._cache.types = {k: \"int\" for k in arg_0._ex._cache.types.keys()}\n        return arg_1", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.minute", "docstring": "Extract the \"minute\" part from a date column.\n\n        :returns: a single-column H2OFrame containing the \"minute\" part from the source frame.", "docstring_tokens": ["Extract", "the", "minute", "part", "from", "a", "date", "column", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259124}
{"url": "https://github.com/erichiggins/gaek/blob/eb6bbc2d2688302834f97fd97891592e8b9659f2/gaek/ndb_json.py#L199-L218", "sha": "eb6bbc2d2688302834f97fd97891592e8b9659f2", "docstring_summary": "Overriding the default JSONEncoder.default for NDB support.", "language": "python", "parameters": "(self, obj)", "return_statement": "return json.JSONEncoder.default(self, obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "type", "(", "arg_1", ")", "if", "arg_2", "not", "in", "arg_0", ".", "_ndb_type_encoding", ":", "if", "hasattr", "(", "arg_1", ",", "'__metaclass__'", ")", ":", "arg_2", "=", "arg_1", ".", "__metaclass__", "else", ":", "for", "arg_3", "in", "NDB_TYPES", ":", "if", "isinstance", "(", "arg_1", ",", "arg_3", ")", ":", "arg_2", "=", "arg_3", "break", "arg_4", "=", "arg_0", ".", "_ndb_type_encoding", ".", "get", "(", "arg_2", ")", "if", "arg_4", ":", "return", "arg_4", "(", "arg_1", ")", "return", "json", ".", "JSONEncoder", ".", "Func", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Overriding the Func JSONEncoder.Func for NDB support.\"\"\"\n    arg_2 = type(arg_1)\n    # NDB Models return a repr to calls from type().\n    if arg_2 not in arg_0._ndb_type_encoding:\n      if hasattr(arg_1, '__metaclass__'):\n        arg_2 = arg_1.__metaclass__\n      else:\n        # Try to encode subclasses of types\n        for arg_3 in NDB_TYPES:\n          if isinstance(arg_1, arg_3):\n            arg_2 = arg_3\n            break\n\n    arg_4 = arg_0._ndb_type_encoding.get(arg_2)\n\n    if arg_4:\n      return arg_4(arg_1)\n\n    return json.JSONEncoder.Func(arg_0, arg_1)", "path": "gaek/ndb_json.py", "identifier": "NdbEncoder.default", "docstring": "Overriding the default JSONEncoder.default for NDB support.", "docstring_tokens": ["Overriding", "the", "default", "JSONEncoder", ".", "default", "for", "NDB", "support", "."], "nwo": "erichiggins/gaek", "score": 0.35580137387943567, "idx": 259125}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1653-L1673", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Open the HTML document in a web browser, saving it to a temporary\n    file to open it.  Note that this does not delete the file after\n    use.  This is mainly meant for debugging.", "language": "python", "parameters": "(doc, encoding=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "import", "os", "import", "webbrowser", "import", "tempfile", "if", "not", "isinstance", "(", "arg_0", ",", "etree", ".", "_ElementTree", ")", ":", "arg_0", "=", "etree", ".", "ElementTree", "(", "arg_0", ")", "arg_2", ",", "arg_3", "=", "tempfile", ".", "mkstemp", "(", "suffix", "=", "'.html'", ")", "arg_4", "=", "os", ".", "fdopen", "(", "arg_2", ",", "'wb'", ")", "try", ":", "arg_0", ".", "write", "(", "arg_4", ",", "method", "=", "\"html\"", ",", "arg_1", "=", "arg_1", "or", "arg_0", ".", "docinfo", ".", "encoding", "or", "\"UTF-8\"", ")", "finally", ":", "arg_4", ".", "close", "(", ")", "arg_5", "=", "'file://'", "+", "arg_3", ".", "replace", "(", "os", ".", "path", ".", "sep", ",", "'/'", ")", "print", "(", "arg_5", ")", "webbrowser", ".", "open", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Open the HTML document in a web browser, saving it to a temporary\n    file to open it.  Note that this does not delete the file after\n    use.  This is mainly meant for debugging.\n    \"\"\"\n    import os\n    import webbrowser\n    import tempfile\n    if not isinstance(arg_0, etree._ElementTree):\n        arg_0 = etree.ElementTree(arg_0)\n    arg_2, arg_3 = tempfile.mkstemp(suffix='.html')\n    arg_4 = os.fdopen(arg_2, 'wb')\n    try:\n        arg_0.write(arg_4, method=\"html\", arg_1=arg_1 or arg_0.docinfo.encoding or \"UTF-8\")\n    finally:\n        # we leak the file itself here, but we should at least close it\n        arg_4.close()\n    arg_5 = 'file://' + arg_3.replace(os.path.sep, '/')\n    print(arg_5)\n    webbrowser.open(arg_5)", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py", "identifier": "open_in_browser", "docstring": "Open the HTML document in a web browser, saving it to a temporary\n    file to open it.  Note that this does not delete the file after\n    use.  This is mainly meant for debugging.", "docstring_tokens": ["Open", "the", "HTML", "document", "in", "a", "web", "browser", "saving", "it", "to", "a", "temporary", "file", "to", "open", "it", ".", "Note", "that", "this", "does", "not", "delete", "the", "file", "after", "use", ".", "This", "is", "mainly", "meant", "for", "debugging", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259126}
{"url": "https://github.com/brandon-rhodes/python-jplephem/blob/48c99ce40c627e24c95479d8845e312ea168f567/jplephem/spk.py#L46-L53", "sha": "48c99ce40c627e24c95479d8845e312ea168f567", "docstring_summary": "Close this SPK file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "daf", ".", "file", ".", "Func", "(", ")", "for", "arg_1", "in", "arg_0", ".", "segments", ":", "if", "hasattr", "(", "arg_1", ",", "'_data'", ")", ":", "del", "arg_1", ".", "_data", "arg_0", ".", "daf", ".", "_array", "=", "None", "arg_0", ".", "daf", ".", "_map", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"Close this SPK file.\"\"\"\n        arg_0.daf.file.Func()\n        for arg_1 in arg_0.segments:\n            if hasattr(arg_1, '_data'):\n                del arg_1._data\n        arg_0.daf._array = None\n        arg_0.daf._map = None", "path": "jplephem/spk.py", "identifier": "SPK.close", "docstring": "Close this SPK file.", "docstring_tokens": ["Close", "this", "SPK", "file", "."], "nwo": "brandon-rhodes/python-jplephem", "score": 0.5471209855014023, "idx": 259127}
{"url": "https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L298-L330", "sha": "c0393c4d51984a506f813319efb66e54c4f2a426", "docstring_summary": "Get OME-XML metadata of given field.", "language": "python", "parameters": "(self, well_row=0, well_column=0,\n                       field_row=0, field_column=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ")", ":", "def", "condition", "(", "arg_5", ")", ":", "arg_6", "=", "attributes", "(", "arg_5", ")", "return", "(", "arg_6", ".", "u", "==", "arg_2", "and", "arg_6", ".", "v", "==", "arg_1", "and", "arg_6", ".", "x", "==", "arg_4", "and", "arg_6", ".", "y", "==", "arg_3", ")", "arg_7", "=", "[", "f", "for", "f", "in", "arg_0", ".", "fields", "if", "condition", "(", "f", ")", "]", "if", "arg_7", ":", "arg_7", "=", "arg_7", "[", "0", "]", "arg_8", "=", "_pattern", "(", "arg_7", ",", "'metadata'", ",", "_image", ",", "extension", "=", "'*.ome.xml'", ")", "arg_8", "=", "glob", "(", "arg_8", ")", "[", "0", "]", "return", "objectify", ".", "parse", "(", "arg_8", ")", ".", "getroot", "(", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=0,\n                       arg_3=0, arg_4=0):\n        \"\"\"Get OME-XML metadata of given field.\n\n        Parameters\n        ----------\n        well_row : int\n            Y well coordinate. Same as --V in files.\n        well_column : int\n            X well coordinate. Same as --U in files.\n        field_row : int\n            Y field coordinate. Same as --Y in files.\n        field_column : int\n            X field coordinate. Same as --X in files.\n\n        Returns\n        -------\n        lxml.objectify.ObjectifiedElement\n            lxml object of OME-XML found in slide/chamber/field/metadata.\n        \"\"\"\n        def condition(arg_5):\n            arg_6 = attributes(arg_5)\n            return (arg_6.u == arg_2 and arg_6.v == arg_1\n                        and arg_6.x == arg_4 and arg_6.y == arg_3)\n\n        arg_7 = [f for f in arg_0.fields if condition(f)]\n\n        if arg_7:\n            arg_7 = arg_7[0]\n            arg_8 = _pattern(arg_7, 'metadata',\n                                _image, extension='*.ome.xml')\n            arg_8 = glob(arg_8)[0] # resolve, assume found\n            return objectify.parse(arg_8).getroot()", "path": "leicaexperiment/experiment.py", "identifier": "Experiment.field_metadata", "docstring": "Get OME-XML metadata of given field.\n\n        Parameters\n        ----------\n        well_row : int\n            Y well coordinate. Same as --V in files.\n        well_column : int\n            X well coordinate. Same as --U in files.\n        field_row : int\n            Y field coordinate. Same as --Y in files.\n        field_column : int\n            X field coordinate. Same as --X in files.\n\n        Returns\n        -------\n        lxml.objectify.ObjectifiedElement\n            lxml object of OME-XML found in slide/chamber/field/metadata.", "docstring_tokens": ["Get", "OME", "-", "XML", "metadata", "of", "given", "field", "."], "nwo": "arve0/leicaexperiment", "score": 0.1792979536242127, "idx": 259128}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/her/rollout.py#L151-L155", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Pickles the current policy for later inspection.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'wb'", ")", "as", "f", ":", "pickle", ".", "dump", "(", "arg_0", ".", "policy", ",", "f", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Pickles the current policy for later inspection.\n        \"\"\"\n        with open(arg_1, 'wb') as f:\n            pickle.dump(arg_0.policy, f)", "path": "baselines/her/rollout.py", "identifier": "RolloutWorker.save_policy", "docstring": "Pickles the current policy for later inspection.", "docstring_tokens": ["Pickles", "the", "current", "policy", "for", "later", "inspection", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 259129}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L84-L107", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Transform ast of multidimensional reference to a single dimension reference.", "language": "python", "parameters": "(aref, dimension_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "arg_0", "while", "type", "(", "arg_3", ")", "is", "c_ast", ".", "ArrayRef", ":", "arg_2", ".", "append", "(", "arg_3", ".", "subscript", ")", "arg_3", "=", "arg_3", ".", "name", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_2", ")", ":", "if", "arg_5", "==", "0", ":", "arg_4", ".", "append", "(", "arg_6", ")", "else", ":", "arg_4", ".", "append", "(", "c_ast", ".", "BinaryOp", "(", "'*'", ",", "arg_6", ",", "reduce", "(", "lambda", "l", ",", "r", ":", "c_ast", ".", "BinaryOp", "(", "'*'", ",", "l", ",", "r", ")", ",", "arg_1", "[", "arg_3", ".", "name", "]", "[", "-", "1", ":", "-", "arg_5", "-", "1", ":", "-", "1", "]", ")", ")", ")", "arg_0", ".", "subscript", "=", "reduce", "(", "lambda", "l", ",", "r", ":", "c_ast", ".", "BinaryOp", "(", "'+'", ",", "l", ",", "r", ")", ",", "arg_4", ")", "arg_0", ".", "name", "=", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Transform ast of multidimensional reference to a single dimension reference.\n\n    In-place operation!\n    \"\"\"\n    arg_2 = []\n    arg_3 = arg_0\n    while type(arg_3) is c_ast.ArrayRef:\n        arg_2.append(arg_3.subscript)\n        arg_3 = arg_3.name\n\n    arg_4 = []\n    for arg_5, arg_6 in enumerate(arg_2):\n        if arg_5 == 0:\n            arg_4.append(arg_6)\n        else:\n            arg_4.append(c_ast.BinaryOp('*', arg_6, reduce(\n                lambda l, r: c_ast.BinaryOp('*', l, r),\n                arg_1[arg_3.name][-1:-arg_5-1:-1])))\n\n    arg_0.subscript = reduce(\n        lambda l, r: c_ast.BinaryOp('+', l, r), arg_4)\n    arg_0.name = arg_3", "path": "kerncraft/kernel.py", "identifier": "transform_multidim_to_1d_ref", "docstring": "Transform ast of multidimensional reference to a single dimension reference.\n\n    In-place operation!", "docstring_tokens": ["Transform", "ast", "of", "multidimensional", "reference", "to", "a", "single", "dimension", "reference", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 259130}
{"url": "https://github.com/MuhammedHasan/sklearn_utils/blob/337c3b7a27f4921d12da496f66a2b83ef582b413/sklearn_utils/visualization/heatmap.py#L7-L28", "sha": "337c3b7a27f4921d12da496f66a2b83ef582b413", "docstring_summary": "Plot heatmap which shows features with classes.", "language": "python", "parameters": "(X, y, top_n=10, metric='correlation', method='complete')", "return_statement": "return sns.clustermap(df_sns, figsize=(22, 22), z_score=0,\n                          metric=metric, method=method,\n                          col_colors=[color_mapping[i] for i in y])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "10", ",", "arg_3", "=", "'correlation'", ",", "arg_4", "=", "'complete'", ")", ":", "sns", ".", "set", "(", "color_codes", "=", "True", ")", "arg_5", "=", "feature_importance_report", "(", "arg_0", ",", "arg_1", ")", "arg_6", "=", "pd", ".", "DataFrame", "(", ")", ".", "from_records", "(", "arg_0", ")", "[", "arg_5", "[", ":", "arg_2", "]", ".", "index", "]", ".", "T", "arg_6", ".", "columns", "=", "arg_1", "arg_8", "=", "dict", "(", "zip", "(", "set", "(", "arg_1", ")", ",", "sns", ".", "mpl_palette", "(", "\"Set2\"", ",", "len", "(", "set", "(", "arg_1", ")", ")", ")", ")", ")", "return", "sns", ".", "clustermap", "(", "arg_6", ",", "figsize", "=", "(", "22", ",", "22", ")", ",", "z_score", "=", "0", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "col_colors", "=", "[", "arg_8", "[", "arg_9", "]", "for", "arg_9", "in", "arg_1", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2=10, arg_3='correlation', arg_4='complete'):\n    '''\n    Plot heatmap which shows features with classes.\n\n    :param X: list of dict\n    :param y: labels\n    :param top_n: most important n feature\n    :param metric: metric which will be used for clustering\n    :param method: method which will be used for clustering\n    '''\n    sns.set(color_codes=True)\n\n    arg_5 = feature_importance_report(arg_0, arg_1)\n\n    arg_6 = pd.DataFrame().from_records(arg_0)[arg_5[:arg_2].index].T\n    arg_6.columns = arg_1\n\n    arg_8 = dict(zip(set(arg_1), sns.mpl_palette(\"Set2\", len(set(arg_1)))))\n\n    return sns.clustermap(arg_6, figsize=(22, 22), z_score=0,\n                          arg_3=arg_3, arg_4=arg_4,\n                          col_colors=[arg_8[arg_9] for arg_9 in arg_1])", "path": "sklearn_utils/visualization/heatmap.py", "identifier": "plot_heatmap", "docstring": "Plot heatmap which shows features with classes.\n\n    :param X: list of dict\n    :param y: labels\n    :param top_n: most important n feature\n    :param metric: metric which will be used for clustering\n    :param method: method which will be used for clustering", "docstring_tokens": ["Plot", "heatmap", "which", "shows", "features", "with", "classes", "."], "nwo": "MuhammedHasan/sklearn_utils", "score": 0.23137166388621372, "idx": 259131}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/message_factory.py#L27-L44", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Returns a simple text message.", "language": "python", "parameters": "(text: str, speak: str = None, input_hint: Union[InputHints, str] = InputHints.accepting_input)", "return_statement": "return message", "argument_list": "", "function_tokens": ["def", "Func", "(", "Func", ":", "arg_1", ",", "arg_2", ":", "arg_1", "=", "None", ",", "arg_3", ":", "arg_4", "[", "arg_5", ",", "arg_1", "]", "=", "arg_5", ".", "accepting_input", ")", "->", "Activity", ":", "arg_7", "=", "Activity", "(", "type", "=", "ActivityTypes", ".", "message", ",", "Func", "=", "Func", ",", "arg_3", "=", "arg_3", ")", "if", "arg_2", ":", "arg_7", ".", "speak", "=", "arg_2", "return", "arg_7"], "function": "def Func(Func: arg_1, arg_2: arg_1 = None, arg_3: arg_4[arg_5, arg_1] = arg_5.accepting_input) -> Activity:\n        \"\"\"\n        Returns a simple text message.\n\n        :Example:\n        message = MessageFactory.text('Greetings from example message')\n        await context.send_activity(message)\n\n        :param text:\n        :param speak:\n        :param input_hint:\n        :return:\n        \"\"\"\n        arg_7 = Activity(type=ActivityTypes.message, Func=Func, arg_3=arg_3)\n        if arg_2:\n            arg_7.speak = arg_2\n\n        return arg_7", "path": "libraries/botbuilder-core/botbuilder/core/message_factory.py", "identifier": "MessageFactory.text", "docstring": "Returns a simple text message.\n\n        :Example:\n        message = MessageFactory.text('Greetings from example message')\n        await context.send_activity(message)\n\n        :param text:\n        :param speak:\n        :param input_hint:\n        :return:", "docstring_tokens": ["Returns", "a", "simple", "text", "message", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 259132}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/refactoring.py#L803-L852", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if there is any chained comparison in the expression.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "op", "!=", "\"and\"", "or", "len", "(", "arg_1", ".", "values", ")", "<", "2", ":", "return", "def", "_find_lower_upper_bounds", "(", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "left", "for", "arg_5", ",", "arg_6", "in", "arg_2", ".", "ops", ":", "for", "arg_7", "in", "(", "arg_4", ",", "arg_6", ")", ":", "arg_8", "=", "None", "if", "isinstance", "(", "arg_7", ",", "astroid", ".", "Name", ")", ":", "arg_8", "=", "arg_7", ".", "name", "elif", "isinstance", "(", "arg_7", ",", "astroid", ".", "Const", ")", ":", "arg_8", "=", "arg_7", ".", "value", "if", "arg_8", "is", "None", ":", "continue", "if", "arg_5", "in", "(", "\"<\"", ",", "\"<=\"", ")", ":", "if", "arg_7", "is", "arg_4", ":", "arg_3", "[", "arg_8", "]", "[", "\"lower_bound\"", "]", ".", "add", "(", "arg_2", ")", "elif", "arg_7", "is", "arg_6", ":", "arg_3", "[", "arg_8", "]", "[", "\"upper_bound\"", "]", ".", "add", "(", "arg_2", ")", "elif", "arg_5", "in", "(", "\">\"", ",", "\">=\"", ")", ":", "if", "arg_7", "is", "arg_4", ":", "arg_3", "[", "arg_8", "]", "[", "\"upper_bound\"", "]", ".", "add", "(", "arg_2", ")", "elif", "arg_7", "is", "arg_6", ":", "arg_3", "[", "arg_8", "]", "[", "\"lower_bound\"", "]", ".", "add", "(", "arg_2", ")", "arg_4", "=", "arg_6", "arg_3", "=", "collections", ".", "defaultdict", "(", "lambda", ":", "{", "\"lower_bound\"", ":", "set", "(", ")", ",", "\"upper_bound\"", ":", "set", "(", ")", "}", ")", "for", "arg_2", "in", "arg_1", ".", "values", ":", "if", "isinstance", "(", "arg_2", ",", "astroid", ".", "Compare", ")", ":", "_find_lower_upper_bounds", "(", "arg_2", ",", "arg_3", ")", "for", "arg_9", ",", "arg_10", "in", "arg_3", ".", "items", "(", ")", ":", "arg_11", "=", "len", "(", "arg_10", "[", "\"lower_bound\"", "]", ".", "intersection", "(", "arg_10", "[", "\"upper_bound\"", "]", ")", ")", "arg_12", "=", "len", "(", "arg_10", "[", "\"lower_bound\"", "]", ")", "arg_13", "=", "len", "(", "arg_10", "[", "\"upper_bound\"", "]", ")", "if", "arg_11", "<", "arg_12", "and", "arg_11", "<", "arg_13", ":", "arg_0", ".", "add_message", "(", "\"chained-comparison\"", ",", "arg_1", "=", "arg_1", ")", "break"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check if there is any chained comparison in the expression.\n\n        Add a refactoring message if a boolOp contains comparison like a < b and b < c,\n        which can be chained as a < b < c.\n\n        Care is taken to avoid simplifying a < b < c and b < d.\n        \"\"\"\n        if arg_1.op != \"and\" or len(arg_1.values) < 2:\n            return\n\n        def _find_lower_upper_bounds(arg_2, arg_3):\n            arg_4 = arg_2.left\n            for arg_5, arg_6 in arg_2.ops:\n                for arg_7 in (arg_4, arg_6):\n                    arg_8 = None\n                    if isinstance(arg_7, astroid.Name):\n                        arg_8 = arg_7.name\n                    elif isinstance(arg_7, astroid.Const):\n                        arg_8 = arg_7.value\n\n                    if arg_8 is None:\n                        continue\n\n                    if arg_5 in (\"<\", \"<=\"):\n                        if arg_7 is arg_4:\n                            arg_3[arg_8][\"lower_bound\"].add(arg_2)\n                        elif arg_7 is arg_6:\n                            arg_3[arg_8][\"upper_bound\"].add(arg_2)\n                    elif arg_5 in (\">\", \">=\"):\n                        if arg_7 is arg_4:\n                            arg_3[arg_8][\"upper_bound\"].add(arg_2)\n                        elif arg_7 is arg_6:\n                            arg_3[arg_8][\"lower_bound\"].add(arg_2)\n                arg_4 = arg_6\n\n        arg_3 = collections.defaultdict(\n            lambda: {\"lower_bound\": set(), \"upper_bound\": set()}\n        )\n        for arg_2 in arg_1.values:\n            if isinstance(arg_2, astroid.Compare):\n                _find_lower_upper_bounds(arg_2, arg_3)\n\n        for arg_9, arg_10 in arg_3.items():\n            arg_11 = len(arg_10[\"lower_bound\"].intersection(arg_10[\"upper_bound\"]))\n            arg_12 = len(arg_10[\"lower_bound\"])\n            arg_13 = len(arg_10[\"upper_bound\"])\n            if arg_11 < arg_12 and arg_11 < arg_13:\n                arg_0.add_message(\"chained-comparison\", arg_1=arg_1)\n                break", "path": "pylint/checkers/refactoring.py", "identifier": "RefactoringChecker._check_chained_comparison", "docstring": "Check if there is any chained comparison in the expression.\n\n        Add a refactoring message if a boolOp contains comparison like a < b and b < c,\n        which can be chained as a < b < c.\n\n        Care is taken to avoid simplifying a < b < c and b < d.", "docstring_tokens": ["Check", "if", "there", "is", "any", "chained", "comparison", "in", "the", "expression", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 259133}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/Join.py#L284-L292", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "May be called to fire the Join before the incoming branches are\n        completed.", "language": "python", "parameters": "(self, my_task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "workflow", ".", "task_tree", ".", "_find_any", "(", "arg_0", ")", ":", "if", "arg_2", ".", "thread_id", "!=", "arg_1", ".", "thread_id", ":", "continue", "arg_0", ".", "_do_join", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        May be called to fire the Join before the incoming branches are\n        completed.\n        \"\"\"\n        for arg_2 in arg_1.workflow.task_tree._find_any(arg_0):\n            if arg_2.thread_id != arg_1.thread_id:\n                continue\n            arg_0._do_join(arg_2)", "path": "SpiffWorkflow/specs/Join.py", "identifier": "Join._on_trigger", "docstring": "May be called to fire the Join before the incoming branches are\n        completed.", "docstring_tokens": ["May", "be", "called", "to", "fire", "the", "Join", "before", "the", "incoming", "branches", "are", "completed", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 259134}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L359-L380", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "get the users playlists from spotify.", "language": "python", "parameters": "(self, *, limit=20, offset=0)", "return_statement": "return [Playlist(self.__client, playlist_data) for playlist_data in data['items']]", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", "=", "20", ",", "arg_2", "=", "0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'http'", ")", ":", "arg_3", "=", "arg_0", ".", "http", "else", ":", "arg_3", "=", "arg_0", ".", "__client", ".", "http", "arg_4", "=", "await", "arg_3", ".", "Func", "(", "arg_0", ".", "id", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "[", "Playlist", "(", "arg_0", ".", "__client", ",", "arg_5", ")", "for", "arg_5", "in", "arg_4", "[", "'items'", "]", "]"], "function": "async def Func(arg_0, *, arg_1=20, arg_2=0):\n        \"\"\"get the users playlists from spotify.\n\n        Parameters\n        ----------\n         limit : Optional[int]\n             The limit on how many playlists to retrieve for this user (default is 20).\n         offset : Optional[int]\n             The offset from where the api should start from in the playlists.\n\n        Returns\n        -------\n        playlists : List[Playlist]\n            A list of the users playlists.\n        \"\"\"\n        if hasattr(arg_0, 'http'):\n            arg_3 = arg_0.http\n        else:\n            arg_3 = arg_0.__client.http\n\n        arg_4 = await arg_3.Func(arg_0.id, arg_1=arg_1, arg_2=arg_2)\n        return [Playlist(arg_0.__client, arg_5) for arg_5 in arg_4['items']]", "path": "spotify/models/user.py", "identifier": "User.get_playlists", "docstring": "get the users playlists from spotify.\n\n        Parameters\n        ----------\n         limit : Optional[int]\n             The limit on how many playlists to retrieve for this user (default is 20).\n         offset : Optional[int]\n             The offset from where the api should start from in the playlists.\n\n        Returns\n        -------\n        playlists : List[Playlist]\n            A list of the users playlists.", "docstring_tokens": ["get", "the", "users", "playlists", "from", "spotify", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 259135}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/tfs/__init__.py#L144-L150", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Returns a list of all git repos for the supplied project within the supplied collection", "language": "python", "parameters": "(url, token, collection, project)", "return_statement": "return git_client.get_repositories(project.id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "create_tfs_git_client", "(", "'{url}/{collection_name}'", ".", "format", "(", "arg_0", "=", "arg_0", ",", "collection_name", "=", "arg_2", ".", "name", ")", ",", "arg_1", ")", "logger", ".", "debug", "(", "'Retrieving Git Repos for Project: {project_name}'", ".", "format", "(", "project_name", "=", "arg_3", ".", "name", ")", ")", "return", "arg_4", ".", "get_repositories", "(", "arg_3", ".", "id", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Returns a list of all git repos for the supplied project within the supplied collection\n    \"\"\"\n    arg_4 = create_tfs_git_client('{url}/{collection_name}'.format(arg_0=arg_0, collection_name=arg_2.name), arg_1)\n    logger.debug('Retrieving Git Repos for Project: {project_name}'.format(project_name=arg_3.name))\n    return arg_4.get_repositories(arg_3.id)", "path": "scraper/tfs/__init__.py", "identifier": "get_git_repos", "docstring": "Returns a list of all git repos for the supplied project within the supplied collection", "docstring_tokens": ["Returns", "a", "list", "of", "all", "git", "repos", "for", "the", "supplied", "project", "within", "the", "supplied", "collection"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 259136}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/base.py#L44-L63", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Used to send a message to the specified channel.", "language": "python", "parameters": "(self, channel, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "isinstance", "(", "arg_1", ",", "SlackIM", ")", "or", "isinstance", "(", "arg_1", ",", "SlackUser", ")", ":", "arg_0", ".", "_bot", ".", "send_im", "(", "arg_1", ",", "arg_2", ")", "elif", "isinstance", "(", "arg_1", ",", "SlackRoom", ")", ":", "arg_0", ".", "_bot", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "elif", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "if", "arg_1", "[", "0", "]", "==", "'@'", ":", "arg_0", ".", "_bot", ".", "send_im", "(", "arg_1", "[", "1", ":", "]", ",", "arg_2", ")", "elif", "arg_1", "[", "0", "]", "==", "'#'", ":", "arg_0", ".", "_bot", ".", "Func", "(", "arg_1", "[", "1", ":", "]", ",", "arg_2", ")", "else", ":", "arg_0", ".", "_bot", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "else", ":", "arg_0", ".", "_bot", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Used to send a message to the specified channel.\n\n        * channel - can be a channel or user\n        * text - message to send\n        \"\"\"\n        if isinstance(arg_1, SlackIM) or isinstance(arg_1, SlackUser):\n            arg_0._bot.send_im(arg_1, arg_2)\n        elif isinstance(arg_1, SlackRoom):\n            arg_0._bot.Func(arg_1, arg_2)\n        elif isinstance(arg_1, basestring):\n            if arg_1[0] == '@':\n                arg_0._bot.send_im(arg_1[1:], arg_2)\n            elif arg_1[0] == '#':\n                arg_0._bot.Func(arg_1[1:], arg_2)\n            else:\n                arg_0._bot.Func(arg_1, arg_2)\n        else:\n            arg_0._bot.Func(arg_1, arg_2)", "path": "slackminion/plugin/base.py", "identifier": "BasePlugin.send_message", "docstring": "Used to send a message to the specified channel.\n\n        * channel - can be a channel or user\n        * text - message to send", "docstring_tokens": ["Used", "to", "send", "a", "message", "to", "the", "specified", "channel", "."], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 259137}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L800-L812", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "decorator for adding positional information to returning nodes", "language": "python", "parameters": "(f)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_2", "[", "0", "]", "if", "isinstance", "(", "arg_4", ",", "Node", ")", "and", "len", "(", "arg_2", ")", ">", "1", ":", "set_positional_info", "(", "arg_4", ",", "arg_2", ")", "return", "arg_3", "return", "wrapper"], "function": "def Func(arg_0):\n    '''\n    decorator for adding positional information to returning nodes\n    '''\n    @wraps(arg_0)\n    def wrapper(arg_1, arg_2):\n        arg_3 = arg_0(arg_1, arg_2)\n        arg_4 = arg_2[0]\n        if isinstance(arg_4, Node) and len(arg_2) > 1:\n            set_positional_info(arg_4, arg_2)\n        return arg_3\n    \n    return wrapper", "path": "bridgepoint/oal.py", "identifier": "track_production", "docstring": "decorator for adding positional information to returning nodes", "docstring_tokens": ["decorator", "for", "adding", "positional", "information", "to", "returning", "nodes"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 259138}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/remoteaccounts.py#L37-L46", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Dump the remote accounts as a list of dictionaries.", "language": "python", "parameters": "(ra, from_date, with_json=True, latest_only=False, **kwargs)", "return_statement": "return dict(id=ra.id, user_id=ra.user_id, client_id=ra.client_id,\n                extra_data=ra.extra_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "return", "dict", "(", "id", "=", "arg_0", ".", "id", ",", "user_id", "=", "arg_0", ".", "user_id", ",", "client_id", "=", "arg_0", ".", "client_id", ",", "extra_data", "=", "arg_0", ".", "extra_data", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=False, **arg_4):\n    \"\"\"Dump the remote accounts as a list of dictionaries.\n\n    :param ra: Remote account to be Funced.\n    :type ra: `invenio_oauthclient.models.RemoteAccount [Invenio2.x]`\n    :returns: Remote accounts serialized to dictionary.\n    :rtype: dict\n    \"\"\"\n    return dict(id=arg_0.id, user_id=arg_0.user_id, client_id=arg_0.client_id,\n                extra_data=arg_0.extra_data)", "path": "invenio_migrator/legacy/remoteaccounts.py", "identifier": "dump", "docstring": "Dump the remote accounts as a list of dictionaries.\n\n    :param ra: Remote account to be dumped.\n    :type ra: `invenio_oauthclient.models.RemoteAccount [Invenio2.x]`\n    :returns: Remote accounts serialized to dictionary.\n    :rtype: dict", "docstring_tokens": ["Dump", "the", "remote", "accounts", "as", "a", "list", "of", "dictionaries", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 259139}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/reports.py#L186-L210", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Decorator that converts a report view function into something that\n    displays a Report.", "language": "python", "parameters": "(title, form_type=None)", "return_statement": "return _report", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "def", "_report", "(", "arg_2", ")", ":", "Func", "=", "ReportView", "(", "arg_2", ",", "arg_0", ",", "arg_1", ")", "Func", "=", "user_passes_test", "(", "views", ".", "_staff_only", ")", "(", "Func", ")", "Func", "=", "wraps", "(", "arg_2", ")", "(", "Func", ")", "_all_report_views", ".", "append", "(", "Func", ")", "return", "Func", "return", "_report"], "function": "def Func(arg_0, arg_1=None):\n    ''' Decorator that converts a report view function into something that\n    displays a Report.\n\n    Arguments:\n        title (str):\n            The title of the report.\n        form_type (Optional[forms.Form]):\n            A form class that can make this report display things. If not\n            supplied, no form will be displayed.\n\n    '''\n\n    # Create & return view\n    def _report(arg_2):\n        Func = ReportView(arg_2, arg_0, arg_1)\n        Func = user_passes_test(views._staff_only)(Func)\n        Func = wraps(arg_2)(Func)\n\n        # Add this report to the list of reports.\n        _all_report_views.append(Func)\n\n        return Func\n\n    return _report", "path": "registrasion/reporting/reports.py", "identifier": "report_view", "docstring": "Decorator that converts a report view function into something that\n    displays a Report.\n\n    Arguments:\n        title (str):\n            The title of the report.\n        form_type (Optional[forms.Form]):\n            A form class that can make this report display things. If not\n            supplied, no form will be displayed.", "docstring_tokens": ["Decorator", "that", "converts", "a", "report", "view", "function", "into", "something", "that", "displays", "a", "Report", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 259140}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/bbs.py#L233-L265", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Extend the size of the bounding box along its sides.", "language": "python", "parameters": "(self, all_sides=0, top=0, right=0, bottom=0, left=0)", "return_statement": "return BoundingBox(\n            x1=self.x1 - all_sides - left,\n            x2=self.x2 + all_sides + right,\n            y1=self.y1 - all_sides - top,\n            y2=self.y2 + all_sides + bottom\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ",", "arg_5", "=", "0", ")", ":", "return", "BoundingBox", "(", "x1", "=", "arg_0", ".", "x1", "-", "arg_1", "-", "arg_5", ",", "x2", "=", "arg_0", ".", "x2", "+", "arg_1", "+", "arg_3", ",", "y1", "=", "arg_0", ".", "y1", "-", "arg_1", "-", "arg_2", ",", "y2", "=", "arg_0", ".", "y2", "+", "arg_1", "+", "arg_4", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=0, arg_3=0, arg_4=0, arg_5=0):\n        \"\"\"\n        Extend the size of the bounding box along its sides.\n\n        Parameters\n        ----------\n        all_sides : number, optional\n            Value by which to Func the bounding box size along all sides.\n\n        top : number, optional\n            Value by which to Func the bounding box size along its top side.\n\n        right : number, optional\n            Value by which to Func the bounding box size along its right side.\n\n        bottom : number, optional\n            Value by which to Func the bounding box size along its bottom side.\n\n        left : number, optional\n            Value by which to Func the bounding box size along its left side.\n\n        Returns\n        -------\n        imgaug.BoundingBox\n            Extended bounding box.\n\n        \"\"\"\n        return BoundingBox(\n            x1=arg_0.x1 - arg_1 - arg_5,\n            x2=arg_0.x2 + arg_1 + arg_3,\n            y1=arg_0.y1 - arg_1 - arg_2,\n            y2=arg_0.y2 + arg_1 + arg_4\n        )", "path": "imgaug/augmentables/bbs.py", "identifier": "BoundingBox.extend", "docstring": "Extend the size of the bounding box along its sides.\n\n        Parameters\n        ----------\n        all_sides : number, optional\n            Value by which to extend the bounding box size along all sides.\n\n        top : number, optional\n            Value by which to extend the bounding box size along its top side.\n\n        right : number, optional\n            Value by which to extend the bounding box size along its right side.\n\n        bottom : number, optional\n            Value by which to extend the bounding box size along its bottom side.\n\n        left : number, optional\n            Value by which to extend the bounding box size along its left side.\n\n        Returns\n        -------\n        imgaug.BoundingBox\n            Extended bounding box.", "docstring_tokens": ["Extend", "the", "size", "of", "the", "bounding", "box", "along", "its", "sides", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259141}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpi.py#L222-L273", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Creates an image for running Raspbian in a QEMU virtual machine.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "arg_1", ".", "comment", "(", "'Installing system packages.'", ")", "arg_1", ".", "sudo", "(", "'add-apt-repository ppa:linaro-maintainers/tools'", ")", "arg_1", ".", "sudo", "(", "'apt-get update'", ")", "arg_1", ".", "sudo", "(", "'apt-get install libsdl-dev qemu-system'", ")", "arg_1", ".", "comment", "(", "'Download image.'", ")", "arg_1", ".", "local", "(", "'wget https://downloads.raspberrypi.org/raspbian_lite_latest'", ")", "arg_1", ".", "local", "(", "'unzip raspbian_lite_latest.zip'", ")", "arg_1", ".", "comment", "(", "'Find start of the Linux ext4 partition.'", ")", "arg_1", ".", "local", "(", "\"parted -s 2016-03-18-raspbian-jessie-lite.img unit B print | \"", "\"awk '/^Number/{{p=1;next}}; p{{gsub(/[^[:digit:]]/, \"", "\", $2); print $2}}' | sed -n 2p\"", ",", "assign_to", "=", "'START'", ")", "arg_1", ".", "local", "(", "'mkdir -p {raspbian_mount_point}'", ")", "arg_1", ".", "sudo", "(", "'mount -v -o offset=$START -t ext4 {raspbian_image} $MNT'", ")", "arg_1", ".", "comment", "(", "'Comment out everything in ld.so.preload'", ")", "arg_1", ".", "local", "(", "\"sed -i 's/^/#/g' {raspbian_mount_point}/etc/ld.so.preload\"", ")", "arg_1", ".", "comment", "(", "'Comment out entries containing /dev/mmcblk in fstab.'", ")", "arg_1", ".", "local", "(", "\"sed -i '/mmcblk/ s?^?#?' /etc/fstab\"", ")", "arg_1", ".", "sudo", "(", "'umount {raspbian_mount_point}'", ")", "arg_1", ".", "comment", "(", "'Download kernel.'", ")", "arg_1", ".", "local", "(", "'wget https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/{raspbian_kernel}?raw=true'", ")", "arg_1", ".", "local", "(", "'mv {raspbian_kernel} {libvirt_images_dir}'", ")", "arg_1", ".", "comment", "(", "'Creating libvirt machine.'", ")", "arg_1", ".", "local", "(", "'virsh define libvirt-raspbian.xml'", ")", "arg_1", ".", "comment", "(", "'You should now be able to boot the VM by running:'", ")", "arg_1", ".", "comment", "(", "''", ")", "arg_1", ".", "comment", "(", "'    qemu-system-arm -kernel {libvirt_boot_dir}/{raspbian_kernel} '", "'-cpu arm1176 -m 256 -M versatilepb -serial stdio -append \"root=/dev/sda2 rootfstype=ext4 rw\" '", "'-hda {libvirt_images_dir}/{raspbian_image}'", ")", "arg_1", ".", "comment", "(", "''", ")", "arg_1", ".", "comment", "(", "'Or by running virt-manager.'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Creates an image for running Raspbian in a QEMU virtual machine.\n\n        Based on the guide at:\n\n            https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki/Emulating-Jessie-image-with-4.1.x-kernel\n        \"\"\"\n\n        arg_1 = arg_0.local_renderer\n\n        arg_1.comment('Installing system packages.')\n        arg_1.sudo('add-apt-repository ppa:linaro-maintainers/tools')\n        arg_1.sudo('apt-get update')\n        arg_1.sudo('apt-get install libsdl-dev qemu-system')\n\n        arg_1.comment('Download image.')\n        arg_1.local('wget https://downloads.raspberrypi.org/raspbian_lite_latest')\n        arg_1.local('unzip raspbian_lite_latest.zip')\n        #TODO:fix name?\n        #TODO:resize image?\n\n        arg_1.comment('Find start of the Linux ext4 partition.')\n        arg_1.local(\n            \"parted -s 2016-03-18-raspbian-jessie-lite.img unit B print | \"\n            \"awk '/^Number/{{p=1;next}}; p{{gsub(/[^[:digit:]]/, \"\", $2); print $2}}' | sed -n 2p\", assign_to='START')\n\n        arg_1.local('mkdir -p {raspbian_mount_point}')\n        arg_1.sudo('mount -v -o offset=$START -t ext4 {raspbian_image} $MNT')\n\n        arg_1.comment('Comment out everything in ld.so.preload')\n        arg_1.local(\"sed -i 's/^/#/g' {raspbian_mount_point}/etc/ld.so.preload\")\n\n        arg_1.comment('Comment out entries containing /dev/mmcblk in fstab.')\n        arg_1.local(\"sed -i '/mmcblk/ s?^?#?' /etc/fstab\")\n\n        arg_1.sudo('umount {raspbian_mount_point}')\n\n        arg_1.comment('Download kernel.')\n        arg_1.local('wget https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/{raspbian_kernel}?raw=true')\n        arg_1.local('mv {raspbian_kernel} {libvirt_images_dir}')\n\n        arg_1.comment('Creating libvirt machine.')\n        arg_1.local('virsh define libvirt-raspbian.xml')\n\n        arg_1.comment('You should now be able to boot the VM by running:')\n        arg_1.comment('')\n        arg_1.comment('    qemu-system-arm -kernel {libvirt_boot_dir}/{raspbian_kernel} '\n            '-cpu arm1176 -m 256 -M versatilepb -serial stdio -append \"root=/dev/sda2 rootfstype=ext4 rw\" '\n            '-hda {libvirt_images_dir}/{raspbian_image}')\n        arg_1.comment('')\n        arg_1.comment('Or by running virt-manager.')", "path": "burlap/rpi.py", "identifier": "RaspberryPiSatchel.init_raspbian_vm", "docstring": "Creates an image for running Raspbian in a QEMU virtual machine.\n\n        Based on the guide at:\n\n            https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki/Emulating-Jessie-image-with-4.1.x-kernel", "docstring_tokens": ["Creates", "an", "image", "for", "running", "Raspbian", "in", "a", "QEMU", "virtual", "machine", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259142}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L186-L199", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Send a Gauge metric with the specified value", "language": "python", "parameters": "(self, name, value, rate=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "if", "arg_0", ".", "_should_send_metric", "(", "arg_1", ",", "arg_3", ")", ":", "if", "not", "is_numeric", "(", "arg_2", ")", ":", "arg_2", "=", "float", "(", "arg_2", ")", "arg_0", ".", "_request", "(", "Gauge", "(", "arg_0", ".", "_create_metric_name_for_request", "(", "arg_1", ")", ",", "arg_2", ",", "arg_3", ")", ".", "to_request", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n        # type: (str, float, float) -> None\n        \"\"\"Send a Gauge metric with the specified value\"\"\"\n\n        if arg_0._should_send_metric(arg_1, arg_3):\n            if not is_numeric(arg_2):\n                arg_2 = float(arg_2)\n            arg_0._request(\n                Gauge(\n                    arg_0._create_metric_name_for_request(arg_1),\n                    arg_2,\n                    arg_3\n                ).to_request()\n            )", "path": "statsdmetrics/client/__init__.py", "identifier": "AbstractClient.gauge", "docstring": "Send a Gauge metric with the specified value", "docstring_tokens": ["Send", "a", "Gauge", "metric", "with", "the", "specified", "value"], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 259143}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/forms/forms.py#L47-L65", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Need to set form data so that validation on all post data occurs and\n            places newly entered form data on the form object.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "form", ".", "data", "=", "arg_0", ".", "post_data_dict", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "form", ".", "fields", ".", "items", "(", ")", ":", "if", "has_digit", "(", "arg_3", ")", ":", "arg_5", "=", "make_key", "(", "arg_3", ",", "exclude_last_string", "=", "True", ")", "for", "arg_6", "in", "arg_0", ".", "post_data_dict", ".", "keys", "(", ")", ":", "if", "arg_5", "in", "arg_6", ":", "arg_0", ".", "form", ".", "fields", ".", "update", "(", "{", "arg_6", ":", "arg_4", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"\n            Need to set form data so that validation on all post data occurs and\n            places newly entered form data on the form object.\n        \"\"\"\n        arg_0.form.data = arg_0.post_data_dict\n\n        # Specifically adding list field keys to the form so they are included\n        # in form.cleaned_data after the call to is_valid\n        for arg_3, arg_4 in arg_0.form.fields.items():\n            if has_digit(arg_3):\n                # We have a list field.\n                arg_5 = make_key(arg_3, exclude_last_string=True)\n\n                # Add new key value with field to form fields so validation\n                # will work correctly\n                for arg_6 in arg_0.post_data_dict.keys():\n                    if arg_5 in arg_6:\n                        arg_0.form.fields.update({arg_6: arg_4})", "path": "mongonaut/forms/forms.py", "identifier": "MongoModelForm.set_post_data", "docstring": "Need to set form data so that validation on all post data occurs and\n            places newly entered form data on the form object.", "docstring_tokens": ["Need", "to", "set", "form", "data", "so", "that", "validation", "on", "all", "post", "data", "occurs", "and", "places", "newly", "entered", "form", "data", "on", "the", "form", "object", "."], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 259144}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py#L188-L216", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates an Azure SQL Database server firewall rule.", "language": "python", "parameters": "(self, server_name, name, start_ip_address,\n                             end_ip_address)", "return_statement": "return self._perform_post(\n            self._get_firewall_rules_path(server_name),\n            _SqlManagementXmlSerializer.create_firewall_rule_to_xml(\n                name, start_ip_address, end_ip_address\n            )\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "_validate_not_none", "(", "'server_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'name'", ",", "arg_2", ")", "_validate_not_none", "(", "'start_ip_address'", ",", "arg_3", ")", "_validate_not_none", "(", "'end_ip_address'", ",", "arg_4", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_firewall_rules_path", "(", "arg_1", ")", ",", "_SqlManagementXmlSerializer", ".", "Func_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                             arg_4):\n        '''\n        Creates an Azure SQL Database server firewall rule.\n\n        server_name:\n            Name of the server to set the firewall rule on. \n        name:\n            The name of the new firewall rule.\n        start_ip_address:\n            The lowest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or greater than this can attempt to\n            connect to the server. The lowest possible IP address is 0.0.0.0.\n        end_ip_address:\n            The highest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or less than this can attempt to\n            connect to the server. The highest possible IP address is\n            255.255.255.255.\n        '''\n        _validate_not_none('server_name', arg_1)\n        _validate_not_none('name', arg_2)\n        _validate_not_none('start_ip_address', arg_3)\n        _validate_not_none('end_ip_address', arg_4)\n        return arg_0._perform_post(\n            arg_0._get_firewall_rules_path(arg_1),\n            _SqlManagementXmlSerializer.Func_to_xml(\n                arg_2, arg_3, arg_4\n            )\n        )", "path": "azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py", "identifier": "SqlDatabaseManagementService.create_firewall_rule", "docstring": "Creates an Azure SQL Database server firewall rule.\n\n        server_name:\n            Name of the server to set the firewall rule on. \n        name:\n            The name of the new firewall rule.\n        start_ip_address:\n            The lowest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or greater than this can attempt to\n            connect to the server. The lowest possible IP address is 0.0.0.0.\n        end_ip_address:\n            The highest IP address in the range of the server-level firewall\n            setting. IP addresses equal to or less than this can attempt to\n            connect to the server. The highest possible IP address is\n            255.255.255.255.", "docstring_tokens": ["Creates", "an", "Azure", "SQL", "Database", "server", "firewall", "rule", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259145}
{"url": "https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/protocol/riemann.py#L48-L53", "sha": "7c0c99708b5dbff97f3895f705e11996b608549d", "docstring_summary": "Decode a protobuf message into a list of Tensor events", "language": "python", "parameters": "(self, data)", "return_statement": "return message", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "proto_pb2", ".", "Msg", "(", ")", "arg_2", ".", "ParseFromString", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Decode a protobuf message into a list of Tensor events\"\"\"\n        arg_2 = proto_pb2.Msg()\n        arg_2.ParseFromString(arg_1)\n\n        return arg_2", "path": "tensor/protocol/riemann.py", "identifier": "RiemannProtobufMixin.decodeMessage", "docstring": "Decode a protobuf message into a list of Tensor events", "docstring_tokens": ["Decode", "a", "protobuf", "message", "into", "a", "list", "of", "Tensor", "events"], "nwo": "calston/tensor", "score": 0.2718259314615454, "idx": 259146}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/statemanager.py#L102-L108", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Pick an unused port. There is a slight chance that this wont work.", "language": "python", "parameters": "(self)", "return_statement": "return port", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "arg_1", ".", "bind", "(", "(", "'127.0.0.1'", ",", "0", ")", ")", "arg_2", ",", "arg_3", "=", "arg_1", ".", "getsockname", "(", ")", "arg_1", ".", "close", "(", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\" Pick an unused port. There is a slight chance that this wont work. \"\"\"\n    arg_1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n    arg_1.bind(('127.0.0.1', 0))\n    arg_2, arg_3 = arg_1.getsockname()\n    arg_1.close()\n    return arg_3", "path": "heron/statemgrs/src/python/statemanager.py", "identifier": "StateManager.pick_unused_port", "docstring": "Pick an unused port. There is a slight chance that this wont work.", "docstring_tokens": ["Pick", "an", "unused", "port", ".", "There", "is", "a", "slight", "chance", "that", "this", "wont", "work", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259147}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L226-L285", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Retrieves and stores an OAuth2 personal auth token.", "language": "python", "parameters": "(username, password, scope, client_id, client_secret, verbose)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "not", "supports_oauth", "(", ")", ":", "raise", "exc", ".", "TowerCLIError", "(", "'This version of Tower does not support OAuth2.0. Set credentials using tower-cli config.'", ")", "arg_6", "=", "collections", ".", "namedtuple", "(", "'req'", ",", "'headers'", ")", "(", "{", "}", ")", "if", "arg_3", "and", "arg_4", ":", "HTTPBasicAuth", "(", "arg_3", ",", "arg_4", ")", "(", "arg_6", ")", "arg_6", ".", "headers", "[", "'Content-Type'", "]", "=", "'application/x-www-form-urlencoded'", "arg_8", "=", "client", ".", "post", "(", "'/o/token/'", ",", "data", "=", "{", "\"grant_type\"", ":", "\"password\"", ",", "\"username\"", ":", "arg_0", ",", "\"password\"", ":", "arg_1", ",", "\"scope\"", ":", "arg_2", "}", ",", "arg_7", "=", "arg_6", ".", "headers", ")", "elif", "arg_3", ":", "arg_6", ".", "headers", "[", "'Content-Type'", "]", "=", "'application/x-www-form-urlencoded'", "arg_8", "=", "client", ".", "post", "(", "'/o/token/'", ",", "data", "=", "{", "\"grant_type\"", ":", "\"password\"", ",", "\"username\"", ":", "arg_0", ",", "\"password\"", ":", "arg_1", ",", "\"client_id\"", ":", "arg_3", ",", "\"scope\"", ":", "arg_2", "}", ",", "arg_7", "=", "arg_6", ".", "headers", ")", "else", ":", "HTTPBasicAuth", "(", "arg_0", ",", "arg_1", ")", "(", "arg_6", ")", "arg_8", "=", "client", ".", "post", "(", "'/users/{}/personal_tokens/'", ".", "format", "(", "arg_0", ")", ",", "data", "=", "{", "\"description\"", ":", "\"Tower CLI\"", ",", "\"application\"", ":", "None", ",", "\"scope\"", ":", "arg_2", "}", ",", "arg_7", "=", "arg_6", ".", "headers", ")", "if", "arg_8", ".", "ok", ":", "arg_9", "=", "arg_8", ".", "json", "(", ")", "arg_9", ".", "pop", "(", "'summary_fields'", ",", "None", ")", "arg_9", ".", "pop", "(", "'related'", ",", "None", ")", "if", "arg_3", ":", "arg_10", "=", "arg_9", ".", "pop", "(", "'access_token'", ",", "None", ")", "else", ":", "arg_10", "=", "arg_9", ".", "pop", "(", "'token'", ",", "None", ")", "if", "settings", ".", "verbose", ":", "arg_9", "[", "'token'", "]", "=", "arg_10", "secho", "(", "json", ".", "dumps", "(", "arg_9", ",", "indent", "=", "1", ")", ",", "fg", "=", "'blue'", ",", "bold", "=", "True", ")", "config", ".", "main", "(", "[", "'oauth_token'", ",", "arg_10", ",", "'--scope=user'", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"\n    Retrieves and stores an OAuth2 personal auth token.\n    \"\"\"\n    if not supports_oauth():\n        raise exc.TowerCLIError(\n            'This version of Tower does not support OAuth2.0. Set credentials using tower-cli config.'\n        )\n\n    # Explicitly set a basic auth header for PAT acquisition (so that we don't\n    # try to auth w/ an existing user+pass or oauth2 token in a config file)\n\n    arg_6 = collections.namedtuple('req', 'headers')({})\n    if arg_3 and arg_4:\n        HTTPBasicAuth(arg_3, arg_4)(arg_6)\n        arg_6.headers['Content-Type'] = 'application/x-www-form-urlencoded'\n        arg_8 = client.post(\n            '/o/token/',\n            data={\n                \"grant_type\": \"password\",\n                \"username\": arg_0,\n                \"password\": arg_1,\n                \"scope\": arg_2\n            },\n            arg_7=arg_6.headers\n        )\n    elif arg_3:\n        arg_6.headers['Content-Type'] = 'application/x-www-form-urlencoded'\n        arg_8 = client.post(\n            '/o/token/',\n            data={\n                \"grant_type\": \"password\",\n                \"username\": arg_0,\n                \"password\": arg_1,\n                \"client_id\": arg_3,\n                \"scope\": arg_2\n            },\n            arg_7=arg_6.headers\n        )\n    else:\n        HTTPBasicAuth(arg_0, arg_1)(arg_6)\n        arg_8 = client.post(\n            '/users/{}/personal_tokens/'.format(arg_0),\n            data={\"description\": \"Tower CLI\", \"application\": None, \"scope\": arg_2},\n            arg_7=arg_6.headers\n        )\n\n    if arg_8.ok:\n        arg_9 = arg_8.json()\n        arg_9.pop('summary_fields', None)\n        arg_9.pop('related', None)\n        if arg_3:\n            arg_10 = arg_9.pop('access_token', None)\n        else:\n            arg_10 = arg_9.pop('token', None)\n        if settings.verbose:\n            # only print the actual token if -v\n            arg_9['token'] = arg_10\n        secho(json.dumps(arg_9, indent=1), fg='blue', bold=True)\n        config.main(['oauth_token', arg_10, '--scope=user'])", "path": "tower_cli/cli/misc.py", "identifier": "login", "docstring": "Retrieves and stores an OAuth2 personal auth token.", "docstring_tokens": ["Retrieves", "and", "stores", "an", "OAuth2", "personal", "auth", "token", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 259148}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L198-L210", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return a valid docker_path, uri, and file provider from a flag value.", "language": "python", "parameters": "(self, raw_uri, recursive)", "return_statement": "return docker_uri, uri_parts, file_provider", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", ":", "arg_1", "=", "directory_fmt", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "parse_file_provider", "(", "arg_1", ")", "arg_0", ".", "_validate_paths_or_fail", "(", "arg_1", ",", "arg_2", ")", "arg_4", ",", "arg_5", "=", "arg_0", ".", "rewrite_uris", "(", "arg_1", ",", "arg_3", ")", "arg_6", "=", "job_model", ".", "UriParts", "(", "directory_fmt", "(", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", ")", ",", "os", ".", "path", ".", "basename", "(", "arg_4", ")", ")", "return", "arg_5", ",", "arg_6", ",", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Return a valid docker_path, uri, and file provider from a flag value.\"\"\"\n    # Assume recursive URIs are directory paths.\n    if arg_2:\n      arg_1 = directory_fmt(arg_1)\n    # Get the file provider, validate the raw URI, and rewrite the path\n    # component of the URI for docker and remote.\n    arg_3 = arg_0.parse_file_provider(arg_1)\n    arg_0._validate_paths_or_fail(arg_1, arg_2)\n    arg_4, arg_5 = arg_0.rewrite_uris(arg_1, arg_3)\n    arg_6 = job_model.UriParts(\n        directory_fmt(os.path.dirname(arg_4)), os.path.basename(arg_4))\n    return arg_5, arg_6, arg_3", "path": "dsub/lib/param_util.py", "identifier": "FileParamUtil.parse_uri", "docstring": "Return a valid docker_path, uri, and file provider from a flag value.", "docstring_tokens": ["Return", "a", "valid", "docker_path", "uri", "and", "file", "provider", "from", "a", "flag", "value", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 259149}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Account.py#L18-L24", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Class method that will return an Account object.", "language": "python", "parameters": "(cls, api_token)", "return_statement": "return acct", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "(", "token", "=", "arg_1", ")", "arg_2", ".", "load", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Class method that will return an Account object.\n        \"\"\"\n        arg_2 = arg_0(token=arg_1)\n        arg_2.load()\n        return arg_2", "path": "digitalocean/Account.py", "identifier": "Account.get_object", "docstring": "Class method that will return an Account object.", "docstring_tokens": ["Class", "method", "that", "will", "return", "an", "Account", "object", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 259150}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/application/briefkasten/views.py#L65-L74", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "accepts a single file upload and adds it to the dropbox as attachment", "language": "python", "parameters": "(dropbox, request)", "return_statement": "return dict(\n        files=[dict(\n            name=attached,\n            type=attachment.type,\n        )]\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "POST", "[", "'attachment'", "]", "arg_3", "=", "arg_0", ".", "add_attachment", "(", "arg_2", ")", "return", "dict", "(", "files", "=", "[", "dict", "(", "name", "=", "arg_3", ",", "type", "=", "arg_2", ".", "type", ",", ")", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" accepts a single file upload and adds it to the dropbox as attachment\"\"\"\n    arg_2 = arg_1.POST['attachment']\n    arg_3 = arg_0.add_attachment(arg_2)\n    return dict(\n        files=[dict(\n            name=arg_3,\n            type=arg_2.type,\n        )]\n    )", "path": "application/briefkasten/views.py", "identifier": "dropbox_fileupload", "docstring": "accepts a single file upload and adds it to the dropbox as attachment", "docstring_tokens": ["accepts", "a", "single", "file", "upload", "and", "adds", "it", "to", "the", "dropbox", "as", "attachment"], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 259151}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/pgmanager.py#L107-L112", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Clear all matching our user_id.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "engine", ".", "begin", "(", ")", "as", "db", ":", "purge_user", "(", "db", ",", "arg_0", ".", "user_id", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Clear all matching our user_id.\n        \"\"\"\n        with arg_0.engine.begin() as db:\n            purge_user(db, arg_0.user_id)", "path": "pgcontents/pgmanager.py", "identifier": "PostgresContentsManager.purge_db", "docstring": "Clear all matching our user_id.", "docstring_tokens": ["Clear", "all", "matching", "our", "user_id", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 259152}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/repos.py#L100-L110", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "For any active, managed repos, update the Dusty-managed\n    copy to bring it up to date with the latest master.", "language": "python", "parameters": "(force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ")", ":", "log_to_client", "(", "'Pulling latest updates for all active managed repos:'", ")", "update_specs_repo_and_known_hosts", "(", ")", "arg_1", "=", "get_all_repos", "(", "active_only", "=", "True", ",", "include_specs_repo", "=", "False", ")", "with", "parallel_task_queue", "(", ")", "as", "queue", ":", "log_to_client", "(", "'Updating managed repos'", ")", "for", "arg_2", "in", "arg_1", ":", "if", "not", "arg_2", ".", "is_overridden", ":", "arg_2", ".", "update_local_repo_async", "(", "queue", ",", "arg_0", "=", "arg_0", ")"], "function": "def Func(arg_0=False):\n    \"\"\"For any active, managed repos, update the Dusty-managed\n    copy to bring it up to date with the latest master.\"\"\"\n    log_to_client('Pulling latest updates for all active managed repos:')\n    update_specs_repo_and_known_hosts()\n    arg_1 = get_all_repos(active_only=True, include_specs_repo=False)\n    with parallel_task_queue() as queue:\n        log_to_client('Updating managed repos')\n        for arg_2 in arg_1:\n            if not arg_2.is_overridden:\n                arg_2.update_local_repo_async(queue, arg_0=arg_0)", "path": "dusty/commands/repos.py", "identifier": "update_managed_repos", "docstring": "For any active, managed repos, update the Dusty-managed\n    copy to bring it up to date with the latest master.", "docstring_tokens": ["For", "any", "active", "managed", "repos", "update", "the", "Dusty", "-", "managed", "copy", "to", "bring", "it", "up", "to", "date", "with", "the", "latest", "master", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 259153}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/common/metrics_registry.py#L19-L27", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns a function object with the name given in string.", "language": "python", "parameters": "(name: str)", "return_statement": "return getattr(importlib.import_module(module_name), fn_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Callable", "[", "...", ",", "Any", "]", ":", "try", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "split", "(", "':'", ")", "except", "ValueError", ":", "raise", "ConfigError", "(", "'Expected function description in a `module.submodules:function_name` form, but got `{}`'", ".", "format", "(", "arg_0", ")", ")", "return", "getattr", "(", "importlib", ".", "import_module", "(", "arg_2", ")", ",", "arg_3", ")"], "function": "def Func(arg_0: arg_1) -> Callable[..., Any]:\n    \"\"\"Returns a function object with the name given in string.\"\"\"\n    try:\n        arg_2, arg_3 = arg_0.split(':')\n    except ValueError:\n        raise ConfigError('Expected function description in a `module.submodules:function_name` form, but got `{}`'\n                          .format(arg_0))\n\n    return getattr(importlib.import_module(arg_2), arg_3)", "path": "deeppavlov/core/common/metrics_registry.py", "identifier": "fn_from_str", "docstring": "Returns a function object with the name given in string.", "docstring_tokens": ["Returns", "a", "function", "object", "with", "the", "name", "given", "in", "string", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 259154}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L206-L222", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Write the manifest content to the zip file. It must be a predictable\n        order.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "configparser", ".", "ConfigParser", "(", ")", "arg_1", ".", "add_section", "(", "'Manifest'", ")", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "manifest", ".", "keys", "(", ")", ")", ":", "arg_1", ".", "set", "(", "'Manifest'", ",", "arg_2", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ".", "lower", "(", ")", ",", "arg_0", ".", "manifest", "[", "arg_2", "]", ")", "arg_3", "=", "StringIO", "(", ")", "arg_1", ".", "write", "(", "arg_3", ")", "arg_0", ".", "manifest_data", "=", "arg_3", ".", "getvalue", "(", ")", "arg_0", ".", "package_zip", ".", "writestr", "(", "arg_0", ".", "MANIFEST_FILE", ",", "arg_0", ".", "manifest_data", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Write the manifest content to the zip file. It must be a predictable\n        order.\n        \"\"\"\n        arg_1 = configparser.ConfigParser()\n\n        arg_1.add_section('Manifest')\n\n        for arg_2 in sorted(arg_0.manifest.keys()):\n            arg_1.set('Manifest', arg_2.replace(\n                '\\\\', '/').lower(), arg_0.manifest[arg_2])\n\n        arg_3 = StringIO()\n        arg_1.write(arg_3)\n        arg_0.manifest_data = arg_3.getvalue()\n        arg_0.package_zip.writestr(arg_0.MANIFEST_FILE, arg_0.manifest_data)", "path": "SpiffWorkflow/bpmn/serializer/Packager.py", "identifier": "Packager.write_manifest", "docstring": "Write the manifest content to the zip file. It must be a predictable\n        order.", "docstring_tokens": ["Write", "the", "manifest", "content", "to", "the", "zip", "file", ".", "It", "must", "be", "a", "predictable", "order", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 259155}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/cluster.py#L176-L194", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Shut down the server.", "language": "python", "parameters": "(self, prompt=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "not", "arg_0", ".", "is_running", "(", ")", ":", "return", "assert_is_type", "(", "arg_1", ",", "bool", ")", "if", "arg_1", ":", "arg_2", "=", "\"Are you sure you want to Func the H2O instance running at %s (Y/N)? \"", "%", "h2o", ".", "connection", "(", ")", ".", "base_url", "arg_3", "=", "input", "(", "arg_2", ")", "else", ":", "arg_3", "=", "\"Y\"", "if", "arg_3", ".", "lower", "(", ")", "in", "{", "\"y\"", ",", "\"yes\"", "}", ":", "h2o", ".", "api", "(", "\"POST /3/Shutdown\"", ")", "h2o", ".", "connection", "(", ")", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Shut down the server.\n\n        This method checks if the H2O cluster is still running, and if it does shuts it down (via a REST API call).\n\n        :param prompt: A logical value indicating whether to prompt the user before shutting down the H2O server.\n        \"\"\"\n        if not arg_0.is_running(): return\n        assert_is_type(arg_1, bool)\n        if arg_1:\n            arg_2 = \"Are you sure you want to Func the H2O instance running at %s (Y/N)? \" \\\n                       % h2o.connection().base_url\n            arg_3 = input(arg_2)  # works in Py2 & Py3 because redefined in h2o.utils.compatibility module\n        else:\n            arg_3 = \"Y\"\n        if arg_3.lower() in {\"y\", \"yes\"}:\n            h2o.api(\"POST /3/Shutdown\")\n            h2o.connection().close()", "path": "h2o-py/h2o/backend/cluster.py", "identifier": "H2OCluster.shutdown", "docstring": "Shut down the server.\n\n        This method checks if the H2O cluster is still running, and if it does shuts it down (via a REST API call).\n\n        :param prompt: A logical value indicating whether to prompt the user before shutting down the H2O server.", "docstring_tokens": ["Shut", "down", "the", "server", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259156}
{"url": "https://github.com/vkorn/pyvizio/blob/7153c9ad544195c867c14f8f03c97dba416c0a7a/custom_components/vizio/media_player.py#L242-L252", "sha": "7153c9ad544195c867c14f8f03c97dba416c0a7a", "docstring_summary": "Set volume level.", "language": "python", "parameters": "(self, volume)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_volume_level", "is", "not", "None", ":", "if", "arg_1", ">", "arg_0", ".", "_volume_level", ":", "arg_2", "=", "int", "(", "arg_0", ".", "_max_volume", "*", "(", "arg_1", "-", "arg_0", ".", "_volume_level", ")", ")", "arg_0", ".", "_volume_level", "=", "arg_1", "arg_0", ".", "_device", ".", "vol_up", "(", "arg_2", "=", "arg_2", ")", "elif", "arg_1", "<", "arg_0", ".", "_volume_level", ":", "arg_2", "=", "int", "(", "arg_0", ".", "_max_volume", "*", "(", "arg_0", ".", "_volume_level", "-", "arg_1", ")", ")", "arg_0", ".", "_volume_level", "=", "arg_1", "arg_0", ".", "_device", ".", "vol_down", "(", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set volume level.\"\"\"\n        if arg_0._volume_level is not None:\n            if arg_1 > arg_0._volume_level:\n                arg_2 = int(arg_0._max_volume * (arg_1 - arg_0._volume_level))\n                arg_0._volume_level = arg_1\n                arg_0._device.vol_up(arg_2=arg_2)\n            elif arg_1 < arg_0._volume_level:\n                arg_2 = int(arg_0._max_volume * (arg_0._volume_level - arg_1))\n                arg_0._volume_level = arg_1\n                arg_0._device.vol_down(arg_2=arg_2)", "path": "custom_components/vizio/media_player.py", "identifier": "VizioDevice.set_volume_level", "docstring": "Set volume level.", "docstring_tokens": ["Set", "volume", "level", "."], "nwo": "vkorn/pyvizio", "score": 0.5557932481269127, "idx": 259157}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L15-L19", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Median filter along the first axis of the feature matrix X.", "language": "python", "parameters": "(X, M=8)", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "8", ")", ":", "for", "arg_2", "in", "range", "(", "arg_0", ".", "shape", "[", "1", "]", ")", ":", "arg_0", "[", ":", ",", "arg_2", "]", "=", "filters", ".", "Func", "(", "arg_0", "[", ":", ",", "arg_2", "]", ",", "size", "=", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=8):\n    \"\"\"Median filter along the first axis of the feature matrix X.\"\"\"\n    for arg_2 in range(arg_0.shape[1]):\n        arg_0[:, arg_2] = filters.Func(arg_0[:, arg_2], size=arg_1)\n    return arg_0", "path": "msaf/algorithms/foote/segmenter.py", "identifier": "median_filter", "docstring": "Median filter along the first axis of the feature matrix X.", "docstring_tokens": ["Median", "filter", "along", "the", "first", "axis", "of", "the", "feature", "matrix", "X", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 259158}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/ap.py#L363-L381", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "return average of a feature divided by sweep.", "language": "python", "parameters": "(abf,feature,T0=None,T1=None)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "sweepLength", "if", "arg_2", "is", "None", ":", "arg_2", "=", "0", "arg_4", "=", "[", "np", ".", "empty", "(", "(", "0", ")", ")", "]", "*", "arg_0", ".", "sweeps", "for", "arg_5", "in", "cm", ".", "dictFlat", "(", "cm", ".", "matrixToDicts", "(", "arg_0", ".", "APs", ")", ")", ":", "if", "arg_2", "<", "arg_5", "[", "'sweepT'", "]", "<", "arg_3", ":", "arg_6", "=", "arg_5", "[", "arg_1", "]", "arg_4", "[", "arg_7", "(", "arg_5", "[", "'sweep'", "]", ")", "]", "=", "np", ".", "concatenate", "(", "(", "arg_4", "[", "arg_7", "(", "arg_5", "[", "'sweep'", "]", ")", "]", ",", "[", "arg_6", "]", ")", ")", "for", "arg_8", "in", "range", "(", "arg_0", ".", "sweeps", ")", ":", "if", "len", "(", "arg_4", "[", "arg_8", "]", ")", ">", "1", "and", "np", ".", "any", "(", "arg_4", "[", "arg_8", "]", ")", ":", "arg_4", "[", "arg_8", "]", "=", "np", ".", "nanmean", "(", "arg_4", "[", "arg_8", "]", ")", "elif", "len", "(", "arg_4", "[", "arg_8", "]", ")", "==", "1", ":", "arg_4", "[", "arg_8", "]", "=", "arg_4", "[", "arg_8", "]", "[", "0", "]", "else", ":", "arg_4", "[", "arg_8", "]", "=", "np", ".", "nan", "return", "arg_4"], "function": "def Func(arg_0,arg_1,arg_2=None,arg_3=None):\n    \"\"\"return average of a feature divided by sweep.\"\"\"\n    if arg_3 is None:\n        arg_3=arg_0.sweepLength\n    if arg_2 is None:\n        arg_2=0\n    arg_4 = [np.empty((0))]*arg_0.sweeps\n    for arg_5 in cm.dictFlat(cm.matrixToDicts(arg_0.APs)):\n        if arg_2<arg_5['sweepT']<arg_3:\n            arg_6=arg_5[arg_1]\n            arg_4[arg_7(arg_5['sweep'])]=np.concatenate((arg_4[arg_7(arg_5['sweep'])],[arg_6]))\n    for arg_8 in range(arg_0.sweeps):\n        if len(arg_4[arg_8])>1 and np.any(arg_4[arg_8]):\n            arg_4[arg_8]=np.nanmean(arg_4[arg_8])\n        elif len(arg_4[arg_8])==1:\n            arg_4[arg_8]=arg_4[arg_8][0]\n        else:\n            arg_4[arg_8]=np.nan\n    return arg_4", "path": "doc/oldcode/swhlab/core/ap.py", "identifier": "getAvgBySweep", "docstring": "return average of a feature divided by sweep.", "docstring_tokens": ["return", "average", "of", "a", "feature", "divided", "by", "sweep", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 259159}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1048-L1072", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Determines the rolling Sharpe ratio of a strategy.", "language": "python", "parameters": "(returns, rolling_sharpe_window)", "return_statement": "return returns.rolling(rolling_sharpe_window).mean() \\\n        / returns.rolling(rolling_sharpe_window).std() \\\n        * np.sqrt(APPROX_BDAYS_PER_YEAR)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "rolling", "(", "arg_1", ")", ".", "mean", "(", ")", "/", "arg_0", ".", "rolling", "(", "arg_1", ")", ".", "std", "(", ")", "*", "np", ".", "sqrt", "(", "APPROX_BDAYS_PER_YEAR", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Determines the rolling Sharpe ratio of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    Func_window : int\n        Length of rolling window, in days, over which to compute.\n\n    Returns\n    -------\n    pd.Series\n        Rolling Sharpe ratio.\n\n    Note\n    -----\n    See https://en.wikipedia.org/wiki/Sharpe_ratio for more details.\n    \"\"\"\n\n    return arg_0.rolling(arg_1).mean() \\\n        / arg_0.rolling(arg_1).std() \\\n        * np.sqrt(APPROX_BDAYS_PER_YEAR)", "path": "pyfolio/timeseries.py", "identifier": "rolling_sharpe", "docstring": "Determines the rolling Sharpe ratio of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    rolling_sharpe_window : int\n        Length of rolling window, in days, over which to compute.\n\n    Returns\n    -------\n    pd.Series\n        Rolling Sharpe ratio.\n\n    Note\n    -----\n    See https://en.wikipedia.org/wiki/Sharpe_ratio for more details.", "docstring_tokens": ["Determines", "the", "rolling", "Sharpe", "ratio", "of", "a", "strategy", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 259160}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/db.py#L411-L429", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Saves the training log, timestamp will be added automatically.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_0", ".", "_fill_project_info", "(", "arg_1", ")", "arg_1", ".", "update", "(", "{", "'time'", ":", "datetime", ".", "utcnow", "(", ")", "}", ")", "arg_2", "=", "arg_0", ".", "db", ".", "TrainLog", ".", "insert_one", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_print_dict", "(", "arg_1", ")", "logging", ".", "info", "(", "\"[Database] train log: \"", "+", "arg_3", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Saves the training log, timestamp will be added automatically.\n\n        Parameters\n        -----------\n        kwargs : logging information\n            Events, such as accuracy, loss, step number and etc.\n\n        Examples\n        ---------\n        >>> db.Func(accuracy=0.33, loss=0.98)\n\n        \"\"\"\n\n        arg_0._fill_project_info(arg_1)\n        arg_1.update({'time': datetime.utcnow()})\n        arg_2 = arg_0.db.TrainLog.insert_one(arg_1)\n        arg_3 = arg_0._print_dict(arg_1)\n        logging.info(\"[Database] train log: \" + arg_3)", "path": "tensorlayer/db.py", "identifier": "TensorHub.save_training_log", "docstring": "Saves the training log, timestamp will be added automatically.\n\n        Parameters\n        -----------\n        kwargs : logging information\n            Events, such as accuracy, loss, step number and etc.\n\n        Examples\n        ---------\n        >>> db.save_training_log(accuracy=0.33, loss=0.98)", "docstring_tokens": ["Saves", "the", "training", "log", "timestamp", "will", "be", "added", "automatically", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 259161}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/virtsocket.py#L347-L422", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "This is the loop that takes messages from the queue for the server\n        to consume, decodes them and dispatches them.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "True", ":", "arg_1", "=", "arg_0", ".", "get_server_msg", "(", ")", "if", "not", "arg_1", ":", "continue", "try", ":", "arg_2", "=", "packet", ".", "decode", "(", "arg_1", ",", "arg_0", ".", "json_loads", ")", "except", "(", "ValueError", ",", "KeyError", ",", "Exception", ")", "as", "e", ":", "arg_0", ".", "error", "(", "'invalid_packet'", ",", "\"There was a decoding error when dealing with packet \"", "\"with event: %s... (%s)\"", "%", "(", "arg_1", "[", ":", "20", "]", ",", "e", ")", ")", "continue", "if", "arg_2", "[", "'type'", "]", "==", "'heartbeat'", ":", "continue", "if", "arg_2", "[", "'type'", "]", "==", "'disconnect'", "and", "arg_2", "[", "'endpoint'", "]", "==", "''", ":", "arg_0", ".", "kill", "(", "detach", "=", "True", ")", "continue", "arg_3", "=", "arg_2", "[", "'endpoint'", "]", "if", "arg_3", "not", "in", "arg_0", ".", "namespaces", ":", "arg_0", ".", "error", "(", "\"no_such_namespace\"", ",", "\"The endpoint you tried to connect to \"", "\"doesn't exist: %s\"", "%", "arg_3", ",", "arg_3", "=", "arg_3", ")", "continue", "elif", "arg_3", "in", "arg_0", ".", "active_ns", ":", "arg_4", "=", "arg_0", ".", "active_ns", "[", "arg_3", "]", "else", ":", "arg_5", "=", "arg_0", ".", "namespaces", "[", "arg_3", "]", "arg_4", "=", "arg_5", "(", "arg_0", ".", "environ", ",", "arg_3", ",", "request", "=", "arg_0", ".", "request", ")", "for", "arg_6", "in", "type", "(", "arg_4", ")", ".", "__mro__", ":", "if", "hasattr", "(", "arg_6", ",", "'initialize'", ")", ":", "arg_6", ".", "initialize", "(", "arg_4", ")", "arg_0", ".", "active_ns", "[", "arg_3", "]", "=", "arg_4", "arg_8", "=", "arg_4", ".", "process_packet", "(", "arg_2", ")", "if", "arg_2", ".", "get", "(", "'ack'", ")", "==", "\"data\"", "and", "arg_2", ".", "get", "(", "'id'", ")", ":", "if", "type", "(", "arg_8", ")", "is", "tuple", ":", "arg_9", "=", "list", "(", "arg_8", ")", "else", ":", "arg_9", "=", "[", "arg_8", "]", "arg_10", "=", "dict", "(", "type", "=", "'ack'", ",", "ackId", "=", "arg_2", "[", "'id'", "]", ",", "arg_9", "=", "arg_9", ",", "arg_3", "=", "arg_2", ".", "get", "(", "'endpoint'", ",", "''", ")", ")", "arg_0", ".", "send_packet", "(", "arg_10", ")", "if", "not", "arg_0", ".", "connected", ":", "arg_0", ".", "kill", "(", "detach", "=", "True", ")", "return"], "function": "def Func(arg_0):\n        \"\"\"This is the loop that takes messages from the queue for the server\n        to consume, decodes them and dispatches them.\n\n        It is the main loop for a socket.  We join on this process before\n        returning control to the web framework.\n\n        This process is not tracked by the socket itself, it is not going\n        to be killed by the ``gevent.killall(socket.jobs)``, so it must\n        exit gracefully itself.\n        \"\"\"\n\n        while True:\n            arg_1 = arg_0.get_server_msg()\n\n            if not arg_1:\n                continue  # or close the connection ?\n            try:\n                arg_2 = packet.decode(arg_1, arg_0.json_loads)\n            except (ValueError, KeyError, Exception) as e:\n                arg_0.error('invalid_packet',\n                    \"There was a decoding error when dealing with packet \"\n                    \"with event: %s... (%s)\" % (arg_1[:20], e))\n                continue\n\n            if arg_2['type'] == 'heartbeat':\n                # This is already dealth with in put_server_msg() when\n                # any incoming raw data arrives.\n                continue\n\n            if arg_2['type'] == 'disconnect' and arg_2['endpoint'] == '':\n                # On global namespace, we kill everything.\n                arg_0.kill(detach=True)\n                continue\n\n            arg_3 = arg_2['endpoint']\n\n            if arg_3 not in arg_0.namespaces:\n                arg_0.error(\"no_such_namespace\",\n                    \"The endpoint you tried to connect to \"\n                    \"doesn't exist: %s\" % arg_3, arg_3=arg_3)\n                continue\n            elif arg_3 in arg_0.active_ns:\n                arg_4 = arg_0.active_ns[arg_3]\n            else:\n                arg_5 = arg_0.namespaces[arg_3]\n                arg_4 = arg_5(arg_0.environ, arg_3,\n                                        request=arg_0.request)\n                # This calls initialize() on all the classes and mixins, etc..\n                # in the order of the MRO\n                for arg_6 in type(arg_4).__mro__:\n                    if hasattr(arg_6, 'initialize'):\n                        arg_6.initialize(arg_4)  # use this instead of __init__,\n                                                # for less confusion\n\n                arg_0.active_ns[arg_3] = arg_4\n\n            arg_8 = arg_4.process_packet(arg_2)\n\n            # Has the client requested an 'ack' with the reply parameters ?\n            if arg_2.get('ack') == \"data\" and arg_2.get('id'):\n                if type(arg_8) is tuple:\n                    arg_9 = list(arg_8)\n                else:\n                    arg_9 = [arg_8]\n                arg_10 = dict(type='ack', ackId=arg_2['id'],\n                                     arg_9=arg_9,\n                                     arg_3=arg_2.get('endpoint', ''))\n                arg_0.send_packet(arg_10)\n\n            # Now, are we still connected ?\n            if not arg_0.connected:\n                arg_0.kill(detach=True)  # ?? what,s the best clean-up\n                                        # when its not a\n                                        # user-initiated disconnect\n                return", "path": "socketio/virtsocket.py", "identifier": "Socket._receiver_loop", "docstring": "This is the loop that takes messages from the queue for the server\n        to consume, decodes them and dispatches them.\n\n        It is the main loop for a socket.  We join on this process before\n        returning control to the web framework.\n\n        This process is not tracked by the socket itself, it is not going\n        to be killed by the ``gevent.killall(socket.jobs)``, so it must\n        exit gracefully itself.", "docstring_tokens": ["This", "is", "the", "loop", "that", "takes", "messages", "from", "the", "queue", "for", "the", "server", "to", "consume", "decodes", "them", "and", "dispatches", "them", "."], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 259162}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/edward2/random_variable.py#L139-L152", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Sample shape of random variable as a 1-D `Tensor`.", "language": "python", "parameters": "(self, name=\"sample_shape_tensor\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Func\"", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ".", "_sample_shape", ",", "tf", ".", "Tensor", ")", ":", "return", "arg_0", ".", "_sample_shape", "return", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ".", "sample_shape", ".", "as_list", "(", ")", ",", "dtype", "=", "tf", ".", "int32", ")"], "function": "def Func(arg_0, arg_1=\"Func\"):\n    \"\"\"Sample shape of random variable as a 1-D `Tensor`.\n\n    Args:\n      name: name to give to the op\n\n    Returns:\n      sample_shape: `Tensor`.\n    \"\"\"\n    with tf.compat.v1.name_scope(arg_1):\n      if isinstance(arg_0._sample_shape, tf.Tensor):\n        return arg_0._sample_shape\n      return tf.convert_to_tensor(\n          value=arg_0.sample_shape.as_list(), dtype=tf.int32)", "path": "tensorflow_probability/python/edward2/random_variable.py", "identifier": "RandomVariable.sample_shape_tensor", "docstring": "Sample shape of random variable as a 1-D `Tensor`.\n\n    Args:\n      name: name to give to the op\n\n    Returns:\n      sample_shape: `Tensor`.", "docstring_tokens": ["Sample", "shape", "of", "random", "variable", "as", "a", "1", "-", "D", "Tensor", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259163}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L181-L223", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Trust packages signed with this public key.", "language": "python", "parameters": "(filename=None, url=None, keyid=None, keyserver='subkeys.pgp.net', update=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'subkeys.pgp.net'", ",", "arg_4", "=", "False", ")", ":", "if", "arg_2", "is", "None", ":", "if", "arg_0", "is", "not", "None", ":", "run_as_root", "(", "'apt-key add %(filename)s'", "%", "locals", "(", ")", ")", "elif", "arg_1", "is", "not", "None", ":", "run_as_root", "(", "'wget %(url)s -O - | apt-key add -'", "%", "locals", "(", ")", ")", "else", ":", "raise", "ValueError", "(", "'Either filename, url or keyid must be provided as argument'", ")", "else", ":", "if", "arg_0", "is", "not", "None", ":", "_check_pgp_key", "(", "arg_0", ",", "arg_2", ")", "run_as_root", "(", "'apt-key add %(filename)s'", "%", "locals", "(", ")", ")", "elif", "arg_1", "is", "not", "None", ":", "arg_5", "=", "'/tmp/tmp.burlap.key.%(keyid)s.key'", "%", "locals", "(", ")", "run_as_root", "(", "'wget %(url)s -O %(tmp_key)s'", "%", "locals", "(", ")", ")", "_check_pgp_key", "(", "arg_5", ",", "arg_2", ")", "run_as_root", "(", "'apt-key add %(tmp_key)s'", "%", "locals", "(", ")", ")", "else", ":", "arg_6", "=", "'--keyserver %(keyserver)s'", "%", "locals", "(", ")", "if", "arg_3", "is", "not", "None", "else", "''", "run_as_root", "(", "'apt-key adv %(keyserver_opt)s --recv-keys %(keyid)s'", "%", "locals", "(", ")", ")", "if", "arg_4", ":", "update_index", "(", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3='subkeys.pgp.net', arg_4=False):\n    \"\"\"\n    Trust packages signed with this public key.\n\n    Example::\n\n        import burlap\n\n        # Varnish signing key from URL and verify fingerprint)\n        burlap.deb.Func(keyid='C4DEFFEB', url='http://repo.varnish-cache.org/debian/GPG-key.txt')\n\n        # Nginx signing key from default key server (subkeys.pgp.net)\n        burlap.deb.Func(keyid='7BD9BF62')\n\n        # From custom key server\n        burlap.deb.Func(keyid='7BD9BF62', keyserver='keyserver.ubuntu.com')\n\n        # From a file\n        burlap.deb.Func(keyid='7BD9BF62', filename='nginx.asc'\n    \"\"\"\n\n    if arg_2 is None:\n        if arg_0 is not None:\n            run_as_root('apt-key add %(filename)s' % locals())\n        elif arg_1 is not None:\n            run_as_root('wget %(url)s -O - | apt-key add -' % locals())\n        else:\n            raise ValueError('Either filename, url or keyid must be provided as argument')\n    else:\n        if arg_0 is not None:\n            _check_pgp_key(arg_0, arg_2)\n            run_as_root('apt-key add %(filename)s' % locals())\n        elif arg_1 is not None:\n            arg_5 = '/tmp/tmp.burlap.key.%(keyid)s.key' % locals()\n            run_as_root('wget %(url)s -O %(tmp_key)s' % locals())\n            _check_pgp_key(arg_5, arg_2)\n            run_as_root('apt-key add %(tmp_key)s' % locals())\n        else:\n            arg_6 = '--keyserver %(keyserver)s' % locals() if arg_3 is not None else ''\n            run_as_root('apt-key adv %(keyserver_opt)s --recv-keys %(keyid)s' % locals())\n\n    if arg_4:\n        update_index()", "path": "burlap/deb.py", "identifier": "add_apt_key", "docstring": "Trust packages signed with this public key.\n\n    Example::\n\n        import burlap\n\n        # Varnish signing key from URL and verify fingerprint)\n        burlap.deb.add_apt_key(keyid='C4DEFFEB', url='http://repo.varnish-cache.org/debian/GPG-key.txt')\n\n        # Nginx signing key from default key server (subkeys.pgp.net)\n        burlap.deb.add_apt_key(keyid='7BD9BF62')\n\n        # From custom key server\n        burlap.deb.add_apt_key(keyid='7BD9BF62', keyserver='keyserver.ubuntu.com')\n\n        # From a file\n        burlap.deb.add_apt_key(keyid='7BD9BF62', filename='nginx.asc'", "docstring_tokens": ["Trust", "packages", "signed", "with", "this", "public", "key", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259164}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L379-L394", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Defines the JSON body to match.", "language": "python", "parameters": "(self, json)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_0", ".", "_request", ".", "json", "=", "Func", "arg_0", ".", "add_matcher", "(", "matcher", "(", "'JSONMatcher'", ",", "Func", ")", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Defines the JSON body to match.\n\n        ``json`` argument can be an JSON string, a JSON serializable\n        Python structure, such as a ``dict`` or ``list`` or it can be\n        a regular expression used to match the body.\n\n        Arguments:\n            json (str|dict|list|regex): body JSON to match.\n\n        Returns:\n            self: current Mock instance.\n        \"\"\"\n        arg_0._request.json = Func\n        arg_0.add_matcher(matcher('JSONMatcher', Func))", "path": "pook/mock.py", "identifier": "Mock.json", "docstring": "Defines the JSON body to match.\n\n        ``json`` argument can be an JSON string, a JSON serializable\n        Python structure, such as a ``dict`` or ``list`` or it can be\n        a regular expression used to match the body.\n\n        Arguments:\n            json (str|dict|list|regex): body JSON to match.\n\n        Returns:\n            self: current Mock instance.", "docstring_tokens": ["Defines", "the", "JSON", "body", "to", "match", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 259165}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L424-L429", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the distance from the center to the given node.", "language": "python", "parameters": "(self, node)", "return_statement": "return x, y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "x", "+", "arg_1", ".", "x", "-", "_ctx", ".", "WIDTH", "/", "2", "arg_3", "=", "arg_0", ".", "y", "+", "arg_1", ".", "y", "-", "_ctx", ".", "HEIGHT", "/", "2", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns the distance from the center to the given node.\n        \"\"\"\n        arg_2 = arg_0.x + arg_1.x - _ctx.WIDTH/2\n        arg_3 = arg_0.y + arg_1.y - _ctx.HEIGHT/2\n        return arg_2, arg_3", "path": "lib/graph/__init__.py", "identifier": "graph.offset", "docstring": "Returns the distance from the center to the given node.", "docstring_tokens": ["Returns", "the", "distance", "from", "the", "center", "to", "the", "given", "node", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259166}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/domaindump.py#L198-L229", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Parses ldapdomaindump files and stores hosts and users in elasticsearch.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Imports users, groups and computers result files from the ldapdomaindump tool, will resolve the names from domain_computers output for IPs\"", ")", "arg_0", ".", "add_argument", "(", "\"files\"", ",", "nargs", "=", "'+'", ",", "help", "=", "\"The domaindump files to import\"", ")", "arg_1", "=", "arg_0", ".", "parse_args", "(", ")", "arg_2", "=", "''", "arg_3", "=", "''", "arg_4", "=", "0", "arg_5", "=", "0", "arg_6", "=", "{", "}", "for", "arg_7", "in", "arg_1", ".", "files", ":", "if", "arg_7", ".", "endswith", "(", "'domain_computers.json'", ")", ":", "print_notification", "(", "'Parsing domain computers'", ")", "arg_4", "=", "parse_domain_computers", "(", "arg_7", ")", "if", "arg_4", ":", "arg_6", "[", "'hosts'", "]", "=", "arg_4", "print_success", "(", "\"{} hosts imported\"", ".", "format", "(", "arg_4", ")", ")", "elif", "arg_7", ".", "endswith", "(", "'domain_users.json'", ")", ":", "arg_2", "=", "arg_7", "elif", "arg_7", ".", "endswith", "(", "'domain_groups.json'", ")", ":", "arg_3", "=", "arg_7", "if", "arg_2", ":", "print_notification", "(", "\"Parsing domain users\"", ")", "arg_5", "=", "parse_domain_users", "(", "arg_2", ",", "arg_3", ")", "if", "arg_5", ":", "print_success", "(", "\"{} users imported\"", ".", "format", "(", "arg_5", ")", ")", "arg_6", "[", "'users'", "]", "=", "arg_5", "Logger", "(", ")", ".", "log", "(", "\"Func\"", ",", "'Imported domaindump, found {} user, {} systems'", ".", "format", "(", "arg_5", ",", "arg_4", ")", ",", "arg_6", ")"], "function": "def Func():\n    \"\"\"\n        Parses ldapdomaindump files and stores hosts and users in elasticsearch.\n    \"\"\"\n    arg_0 = argparse.ArgumentParser(\n        description=\"Imports users, groups and computers result files from the ldapdomaindump tool, will resolve the names from domain_computers output for IPs\")\n    arg_0.add_argument(\"files\", nargs='+',\n                        help=\"The domaindump files to import\")\n    arg_1 = arg_0.parse_args()\n    arg_2 = ''\n    arg_3 = ''\n    arg_4 = 0\n    arg_5 = 0\n    arg_6 = {}\n    for arg_7 in arg_1.files:\n        if arg_7.endswith('domain_computers.json'):\n            print_notification('Parsing domain computers')\n            arg_4 = parse_domain_computers(arg_7)\n            if arg_4:\n                arg_6['hosts'] = arg_4\n                print_success(\"{} hosts imported\".format(arg_4))\n        elif arg_7.endswith('domain_users.json'):\n            arg_2 = arg_7\n        elif arg_7.endswith('domain_groups.json'):\n            arg_3 = arg_7\n    if arg_2:\n        print_notification(\"Parsing domain users\")\n        arg_5 = parse_domain_users(arg_2, arg_3)\n        if arg_5:\n            print_success(\"{} users imported\".format(arg_5))\n            arg_6['users'] = arg_5\n    Logger().log(\"Func\", 'Imported domaindump, found {} user, {} systems'.format(arg_5, arg_4), arg_6)", "path": "jackal/scripts/domaindump.py", "identifier": "import_domaindump", "docstring": "Parses ldapdomaindump files and stores hosts and users in elasticsearch.", "docstring_tokens": ["Parses", "ldapdomaindump", "files", "and", "stores", "hosts", "and", "users", "in", "elasticsearch", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 259167}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/dispatcher.py#L77-L86", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "message_replied event is not truly a message event and does not have a message.text\n        don't process such events", "language": "python", "parameters": "(self, message)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_1", ",", "'subtype'", ")", "and", "arg_1", ".", "subtype", "in", "arg_0", ".", "ignored_events", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        message_replied event is not truly a message event and does not have a message.text\n        don't process such events\n\n        commands may not be idempotent, so ignore message_changed events.\n        \"\"\"\n        if hasattr(arg_1, 'subtype') and arg_1.subtype in arg_0.ignored_events:\n            return True\n        return False", "path": "slackminion/dispatcher.py", "identifier": "MessageDispatcher._ignore_event", "docstring": "message_replied event is not truly a message event and does not have a message.text\n        don't process such events\n\n        commands may not be idempotent, so ignore message_changed events.", "docstring_tokens": ["message_replied", "event", "is", "not", "truly", "a", "message", "event", "and", "does", "not", "have", "a", "message", ".", "text", "don", "t", "process", "such", "events"], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 259168}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/normal.py#L234-L237", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Reconstruct input `x` from a its normalized version.", "language": "python", "parameters": "(self, z)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "tf", ".", "name_scope", "(", "\"reconstruct\"", ")", ":", "return", "arg_1", "*", "arg_0", ".", "scale", "+", "arg_0", ".", "loc"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Reconstruct input `x` from a its normalized version.\"\"\"\n    with tf.name_scope(\"reconstruct\"):\n      return arg_1 * arg_0.scale + arg_0.loc", "path": "tensorflow_probability/python/distributions/normal.py", "identifier": "Normal._inv_z", "docstring": "Reconstruct input `x` from a its normalized version.", "docstring_tokens": ["Reconstruct", "input", "x", "from", "a", "its", "normalized", "version", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259169}
{"url": "https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/nodelist.py#L27-L38", "sha": "32fd036d64fab19c554e841f162466f6eb28b50f", "docstring_summary": "Adds or refreshes a particular node in the nodelist, attributing the\n        current time with the node_id.", "language": "python", "parameters": "(self, node_id=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "conn", ".", "id", "arg_0", ".", "conn", ".", "client", ".", "hset", "(", "arg_0", ".", "nodelist_key", ",", "arg_1", ",", "int", "(", "time", ".", "time", "(", ")", "*", "1000.", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Adds or refreshes a particular node in the nodelist, attributing the\n        current time with the node_id.\n\n        :param string node_id: optional, the connection id of the node whose\n        session should be refreshed\n        \"\"\"\n        if not arg_1:\n            arg_1 = arg_0.conn.id\n\n        arg_0.conn.client.hset(arg_0.nodelist_key, arg_1, int(time.time() * 1000.))", "path": "phonon/nodelist.py", "identifier": "Nodelist.refresh_session", "docstring": "Adds or refreshes a particular node in the nodelist, attributing the\n        current time with the node_id.\n\n        :param string node_id: optional, the connection id of the node whose\n        session should be refreshed", "docstring_tokens": ["Adds", "or", "refreshes", "a", "particular", "node", "in", "the", "nodelist", "attributing", "the", "current", "time", "with", "the", "node_id", "."], "nwo": "buzzfeed/phonon", "score": 0.2757871243566705, "idx": 259170}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/dictlist.py#L160-L165", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "append object to end", "language": "python", "parameters": "(self, object)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "id", "arg_0", ".", "_check", "(", "arg_2", ")", "arg_0", ".", "_dict", "[", "arg_2", "]", "=", "len", "(", "arg_0", ")", "list", ".", "Func", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Func object to end\"\"\"\n        arg_2 = arg_1.id\n        arg_0._check(arg_2)\n        arg_0._dict[arg_2] = len(arg_0)\n        list.Func(arg_0, arg_1)", "path": "cobra/core/dictlist.py", "identifier": "DictList.append", "docstring": "append object to end", "docstring_tokens": ["append", "object", "to", "end"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259171}
{"url": "https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/ops/for_.py#L73-L84", "sha": "7ef04938d80f8b646bd73d976ac9787a5b88edd9", "docstring_summary": "A to-bytes specific to Python 3.6 and above.", "language": "python", "parameters": "(self, previous: bytes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "b\"\"", "arg_4", "=", "util", ".", "generate_bytecode_from_obb", "(", "arg_0", ".", "iterator", ",", "arg_1", ")", "arg_3", "+=", "arg_4", "arg_3", "+=", "util", ".", "ensure_instruction", "(", "tokens", ".", "GET_ITER", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        A to-bytes specific to Python 3.6 and above.\n        \"\"\"\n        # Calculations ahead.\n        arg_3 = b\"\"\n\n        # Calculate the length of the iterator.\n        arg_4 = util.generate_bytecode_from_obb(arg_0.iterator, arg_1)\n        arg_3 += arg_4\n\n        arg_3 += util.ensure_instruction(tokens.GET_ITER)", "path": "pyte/ops/for_.py", "identifier": "FOR_LOOP.to_bytes_36", "docstring": "A to-bytes specific to Python 3.6 and above.", "docstring_tokens": ["A", "to", "-", "bytes", "specific", "to", "Python", "3", ".", "6", "and", "above", "."], "nwo": "Fuyukai/Pyte", "score": 0.3282631104312029, "idx": 259172}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/ddel.py#L93-L106", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Print the filters used to delete tasks. Use raw flags as arguments.", "language": "python", "parameters": "(user_ids, job_ids, task_ids, labels)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "print", "(", "'Delete running jobs:'", ")", "print", "(", "'  user:'", ")", "print", "(", "'    %s\\n'", "%", "arg_0", ")", "print", "(", "'  job-id:'", ")", "print", "(", "'    %s\\n'", "%", "arg_1", ")", "if", "arg_2", ":", "print", "(", "'  task-id:'", ")", "print", "(", "'    %s\\n'", "%", "arg_2", ")", "if", "arg_3", ":", "print", "(", "'  labels:'", ")", "print", "(", "'    %s\\n'", "%", "repr", "(", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Print the filters used to delete tasks. Use raw flags as arguments.\"\"\"\n  print('Delete running jobs:')\n  print('  user:')\n  print('    %s\\n' % arg_0)\n  print('  job-id:')\n  print('    %s\\n' % arg_1)\n  if arg_2:\n    print('  task-id:')\n    print('    %s\\n' % arg_2)\n  # Labels are in a LabelParam namedtuple and must be reformated for printing.\n  if arg_3:\n    print('  labels:')\n    print('    %s\\n' % repr(arg_3))", "path": "dsub/commands/ddel.py", "identifier": "_emit_search_criteria", "docstring": "Print the filters used to delete tasks. Use raw flags as arguments.", "docstring_tokens": ["Print", "the", "filters", "used", "to", "delete", "tasks", ".", "Use", "raw", "flags", "as", "arguments", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 259173}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/viscosity.py#L1593-L1618", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate pressure-dependent gas viscosity\n        at temperature `T` and pressure `P` with a given method.", "language": "python", "parameters": "(self, T, P, method)", "return_statement": "return mu", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", "==", "COOLPROP", ":", "arg_4", "=", "PropsSI", "(", "'V'", ",", "'T'", ",", "arg_1", ",", "'P'", ",", "arg_2", ",", "arg_0", ".", "CASRN", ")", "elif", "arg_3", "in", "arg_0", ".", "tabular_data", ":", "arg_4", "=", "arg_0", ".", "interpolate_P", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        r'''Method to calculate pressure-dependent gas viscosity\n        at temperature `T` and pressure `P` with a given method.\n\n        This method has no exception handling; see `TP_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate gas viscosity, [K]\n        P : float\n            Pressure at which to calculate gas viscosity, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        mu : float\n            Viscosity of the gas at T and P, [Pa*]\n        '''\n        if arg_3 == COOLPROP:\n            arg_4 = PropsSI('V', 'T', arg_1, 'P', arg_2, arg_0.CASRN)\n        elif arg_3 in arg_0.tabular_data:\n            arg_4 = arg_0.interpolate_P(arg_1, arg_2, arg_3)\n        return arg_4", "path": "thermo/viscosity.py", "identifier": "ViscosityGas.calculate_P", "docstring": "r'''Method to calculate pressure-dependent gas viscosity\n        at temperature `T` and pressure `P` with a given method.\n\n        This method has no exception handling; see `TP_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate gas viscosity, [K]\n        P : float\n            Pressure at which to calculate gas viscosity, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        mu : float\n            Viscosity of the gas at T and P, [Pa*]", "docstring_tokens": ["r", "Method", "to", "calculate", "pressure", "-", "dependent", "gas", "viscosity", "at", "temperature", "T", "and", "pressure", "P", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 259174}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L398-L426", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Create a transform job", "language": "python", "parameters": "(self, config, wait_for_completion=True,\n                             check_interval=30, max_ingestion_time=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "30", ",", "arg_4", "=", "None", ")", ":", "arg_0", ".", "check_s3_url", "(", "arg_1", "[", "'TransformInput'", "]", "[", "'DataSource'", "]", "[", "'S3DataSource'", "]", "[", "'S3Uri'", "]", ")", "arg_5", "=", "arg_0", ".", "get_conn", "(", ")", ".", "Func", "(", "**", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "check_status", "(", "arg_1", "[", "'TransformJobName'", "]", ",", "'TransformJobStatus'", ",", "arg_0", ".", "describe_transform_job", ",", "arg_3", ",", "arg_4", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=True,\n                             arg_3=30, arg_4=None):\n        \"\"\"\n        Create a transform job\n\n        :param config: the config for transform job\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to transform job creation\n        \"\"\"\n\n        arg_0.check_s3_url(arg_1['TransformInput']['DataSource']['S3DataSource']['S3Uri'])\n\n        arg_5 = arg_0.get_conn().Func(**arg_1)\n        if arg_2:\n            arg_0.check_status(arg_1['TransformJobName'],\n                              'TransformJobStatus',\n                              arg_0.describe_transform_job,\n                              arg_3, arg_4\n                              )\n        return arg_5", "path": "airflow/contrib/hooks/sagemaker_hook.py", "identifier": "SageMakerHook.create_transform_job", "docstring": "Create a transform job\n\n        :param config: the config for transform job\n        :type config: dict\n        :param wait_for_completion: if the program should keep running until job finishes\n        :type wait_for_completion: bool\n        :param check_interval: the time interval in seconds which the operator\n            will check the status of any SageMaker job\n        :type check_interval: int\n        :param max_ingestion_time: the maximum ingestion time in seconds. Any\n            SageMaker jobs that run longer than this will fail. Setting this to\n            None implies no timeout for any SageMaker job.\n        :type max_ingestion_time: int\n        :return: A response to transform job creation", "docstring_tokens": ["Create", "a", "transform", "job"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259175}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L154-L165", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Load a state from storage.", "language": "python", "parameters": "(self, key, delete=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "with", "arg_0", ".", "load_stream", "(", "arg_1", ",", "binary", "=", "True", ")", "as", "f", ":", "arg_3", "=", "arg_0", ".", "_serializer", ".", "deserialize", "(", "f", ")", "if", "arg_2", ":", "arg_0", ".", "rm", "(", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Load a state from storage.\n\n        :param key: key that identifies state\n        :rtype: manticore.core.StateBase\n        \"\"\"\n        with arg_0.load_stream(arg_1, binary=True) as f:\n            arg_3 = arg_0._serializer.deserialize(f)\n            if arg_2:\n                arg_0.rm(arg_1)\n            return arg_3", "path": "manticore/core/workspace.py", "identifier": "Store.load_state", "docstring": "Load a state from storage.\n\n        :param key: key that identifies state\n        :rtype: manticore.core.StateBase", "docstring_tokens": ["Load", "a", "state", "from", "storage", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259176}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/memory_model.py#L127-L188", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Constructs the memory and the optimizer objects.\n        Generates and stores all template functions.", "language": "python", "parameters": "(self, custom_getter=None)", "return_statement": "return custom_getter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "super", "(", "MemoryModel", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "memory", "=", "Memory", ".", "from_spec", "(", "spec", "=", "arg_0", ".", "memory_spec", ",", "kwargs", "=", "dict", "(", "states", "=", "arg_0", ".", "states_spec", ",", "internals", "=", "arg_0", ".", "internals_spec", ",", "actions", "=", "arg_0", ".", "actions_spec", ",", "summary_labels", "=", "arg_0", ".", "summary_labels", ")", ")", "arg_0", ".", "optimizer", "=", "Optimizer", ".", "from_spec", "(", "spec", "=", "arg_0", ".", "optimizer_spec", ",", "kwargs", "=", "dict", "(", "summary_labels", "=", "arg_0", ".", "summary_labels", ")", ")", "arg_0", ".", "fn_discounted_cumulative_reward", "=", "tf", ".", "make_template", "(", "name_", "=", "'discounted-cumulative-reward'", ",", "func_", "=", "arg_0", ".", "tf_discounted_cumulative_reward", ",", "custom_getter_", "=", "arg_1", ")", "arg_0", ".", "fn_reference", "=", "tf", ".", "make_template", "(", "name_", "=", "'reference'", ",", "func_", "=", "arg_0", ".", "tf_reference", ",", "custom_getter_", "=", "arg_1", ")", "arg_0", ".", "fn_loss_per_instance", "=", "tf", ".", "make_template", "(", "name_", "=", "'loss-per-instance'", ",", "func_", "=", "arg_0", ".", "tf_loss_per_instance", ",", "custom_getter_", "=", "arg_1", ")", "arg_0", ".", "fn_regularization_losses", "=", "tf", ".", "make_template", "(", "name_", "=", "'regularization-losses'", ",", "func_", "=", "arg_0", ".", "tf_regularization_losses", ",", "custom_getter_", "=", "arg_1", ")", "arg_0", ".", "fn_loss", "=", "tf", ".", "make_template", "(", "name_", "=", "'loss'", ",", "func_", "=", "arg_0", ".", "tf_loss", ",", "custom_getter_", "=", "arg_1", ")", "arg_0", ".", "fn_optimization", "=", "tf", ".", "make_template", "(", "name_", "=", "'optimization'", ",", "func_", "=", "arg_0", ".", "tf_optimization", ",", "custom_getter_", "=", "arg_1", ")", "arg_0", ".", "fn_import_experience", "=", "tf", ".", "make_template", "(", "name_", "=", "'import-experience'", ",", "func_", "=", "arg_0", ".", "tf_import_experience", ",", "custom_getter_", "=", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Constructs the memory and the optimizer objects.\n        Generates and stores all template functions.\n        \"\"\"\n        arg_1 = super(MemoryModel, arg_0).Func(arg_1)\n\n        # Memory\n        arg_0.memory = Memory.from_spec(\n            spec=arg_0.memory_spec,\n            kwargs=dict(\n                states=arg_0.states_spec,\n                internals=arg_0.internals_spec,\n                actions=arg_0.actions_spec,\n                summary_labels=arg_0.summary_labels\n            )\n        )\n\n        # Optimizer\n        arg_0.optimizer = Optimizer.from_spec(\n            spec=arg_0.optimizer_spec,\n            kwargs=dict(summary_labels=arg_0.summary_labels)\n        )\n\n        # TensorFlow functions\n        arg_0.fn_discounted_cumulative_reward = tf.make_template(\n            name_='discounted-cumulative-reward',\n            func_=arg_0.tf_discounted_cumulative_reward,\n            custom_getter_=arg_1\n        )\n        arg_0.fn_reference = tf.make_template(\n            name_='reference',\n            func_=arg_0.tf_reference,\n            custom_getter_=arg_1\n        )\n        arg_0.fn_loss_per_instance = tf.make_template(\n            name_='loss-per-instance',\n            func_=arg_0.tf_loss_per_instance,\n            custom_getter_=arg_1\n        )\n        arg_0.fn_regularization_losses = tf.make_template(\n            name_='regularization-losses',\n            func_=arg_0.tf_regularization_losses,\n            custom_getter_=arg_1\n        )\n        arg_0.fn_loss = tf.make_template(\n            name_='loss',\n            func_=arg_0.tf_loss,\n            custom_getter_=arg_1\n        )\n        arg_0.fn_optimization = tf.make_template(\n            name_='optimization',\n            func_=arg_0.tf_optimization,\n            custom_getter_=arg_1\n        )\n        arg_0.fn_import_experience = tf.make_template(\n            name_='import-experience',\n            func_=arg_0.tf_import_experience,\n            custom_getter_=arg_1\n        )\n\n        return arg_1", "path": "tensorforce/models/memory_model.py", "identifier": "MemoryModel.setup_components_and_tf_funcs", "docstring": "Constructs the memory and the optimizer objects.\n        Generates and stores all template functions.", "docstring_tokens": ["Constructs", "the", "memory", "and", "the", "optimizer", "objects", ".", "Generates", "and", "stores", "all", "template", "functions", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 259177}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/commands/completion.py#L58-L68", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Prints the completion code of the given shell", "language": "python", "parameters": "(self, options, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "COMPLETION_SCRIPTS", ".", "keys", "(", ")", "arg_4", "=", "[", "'--'", "+", "shell", "for", "shell", "in", "sorted", "(", "arg_3", ")", "]", "if", "arg_1", ".", "shell", "in", "arg_3", ":", "arg_5", "=", "COMPLETION_SCRIPTS", ".", "get", "(", "arg_1", ".", "shell", ",", "''", ")", "print", "(", "BASE_COMPLETION", "%", "{", "'script'", ":", "arg_5", ",", "'shell'", ":", "arg_1", ".", "shell", "}", ")", "else", ":", "sys", ".", "stderr", ".", "write", "(", "'ERROR: You must pass %s\\n'", "%", "' or '", ".", "join", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Prints the completion code of the given shell\"\"\"\n        arg_3 = COMPLETION_SCRIPTS.keys()\n        arg_4 = ['--' + shell for shell in sorted(arg_3)]\n        if arg_1.shell in arg_3:\n            arg_5 = COMPLETION_SCRIPTS.get(arg_1.shell, '')\n            print(BASE_COMPLETION % {'script': arg_5, 'shell': arg_1.shell})\n        else:\n            sys.stderr.write(\n                'ERROR: You must pass %s\\n' % ' or '.join(arg_4)\n            )", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/commands/completion.py", "identifier": "CompletionCommand.run", "docstring": "Prints the completion code of the given shell", "docstring_tokens": ["Prints", "the", "completion", "code", "of", "the", "given", "shell"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259178}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L2909-L2915", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Modifies the trajectory for single runs executed by the environment", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_is_run", "=", "False", "arg_0", ".", "_new_nodes", "=", "OrderedDict", "(", ")", "arg_0", ".", "_new_links", "=", "OrderedDict", "(", ")", "arg_0", ".", "_is_run", "=", "True", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\" Modifies the trajectory for single runs executed by the environment \"\"\"\n        arg_0._is_run = False # to be able to use f_set_crun\n        arg_0._new_nodes = OrderedDict()\n        arg_0._new_links = OrderedDict()\n        arg_0._is_run = True\n        return arg_0", "path": "pypet/trajectory.py", "identifier": "Trajectory._make_single_run", "docstring": "Modifies the trajectory for single runs executed by the environment", "docstring_tokens": ["Modifies", "the", "trajectory", "for", "single", "runs", "executed", "by", "the", "environment"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259179}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L103-L112", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform a QuantumChannel to the Stinespring representation.", "language": "python", "parameters": "(rep, data, input_dim, output_dim)", "return_statement": "return _kraus_to_stinespring(data, input_dim, output_dim)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", "==", "'Stinespring'", ":", "return", "arg_1", "if", "arg_0", "==", "'Operator'", ":", "return", "_from_operator", "(", "'Stinespring'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "!=", "'Kraus'", ":", "arg_1", "=", "_to_kraus", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "_krausFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Transform a QuantumChannel to the Stinespring representation.\"\"\"\n    if arg_0 == 'Stinespring':\n        return arg_1\n    if arg_0 == 'Operator':\n        return _from_operator('Stinespring', arg_1, arg_2, arg_3)\n    # Convert via Superoperator representation\n    if arg_0 != 'Kraus':\n        arg_1 = _to_kraus(arg_0, arg_1, arg_2, arg_3)\n    return _krausFunc(arg_1, arg_2, arg_3)", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_to_stinespring", "docstring": "Transform a QuantumChannel to the Stinespring representation.", "docstring_tokens": ["Transform", "a", "QuantumChannel", "to", "the", "Stinespring", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259180}
{"url": "https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/outstation.py#L190-L199", "sha": "5bcd8240d1fc0aa1579e71f2efcab63b4c61c547", "docstring_summary": "A PointValue was received from the Master. Process its payload.", "language": "python", "parameters": "(cls, command_type, command, index, op_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "_log", ".", "debug", "(", "'Processing received point value for index {}: {}'", ".", "format", "(", "arg_3", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n            A PointValue was received from the Master. Process its payload.\n\n        :param command_type: (string) Either 'Select' or 'Operate'.\n        :param command: A ControlRelayOutputBlock or else a wrapped data value (AnalogOutputInt16, etc.).\n        :param index: (integer) DNP3 index of the payload's data definition.\n        :param op_type: An OperateType, or None if command_type == 'Select'.\n        \"\"\"\n        _log.debug('Processing received point value for index {}: {}'.format(arg_3, arg_2))", "path": "examples/outstation.py", "identifier": "OutstationApplication.process_point_value", "docstring": "A PointValue was received from the Master. Process its payload.\n\n        :param command_type: (string) Either 'Select' or 'Operate'.\n        :param command: A ControlRelayOutputBlock or else a wrapped data value (AnalogOutputInt16, etc.).\n        :param index: (integer) DNP3 index of the payload's data definition.\n        :param op_type: An OperateType, or None if command_type == 'Select'.", "docstring_tokens": ["A", "PointValue", "was", "received", "from", "the", "Master", ".", "Process", "its", "payload", "."], "nwo": "ChargePoint/pydnp3", "score": 0.6403780379231505, "idx": 259181}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L2036-L2096", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Apply a phasing effect to the audio.", "language": "python", "parameters": "(self, gain_in=0.8, gain_out=0.74, delay=3, decay=0.4, speed=0.5,\n               modulation_shape='sinusoidal')", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0.8", ",", "arg_2", "=", "0.74", ",", "arg_3", "=", "3", ",", "arg_4", "=", "0.4", ",", "arg_5", "=", "0.5", ",", "arg_6", "=", "'sinusoidal'", ")", ":", "if", "not", "is_number", "(", "arg_1", ")", "or", "arg_1", "<=", "0", "or", "arg_1", ">", "1", ":", "raise", "ValueError", "(", "\"gain_in must be a number between 0 and 1.\"", ")", "if", "not", "is_number", "(", "arg_2", ")", "or", "arg_2", "<=", "0", "or", "arg_2", ">", "1", ":", "raise", "ValueError", "(", "\"gain_out must be a number between 0 and 1.\"", ")", "if", "not", "is_number", "(", "arg_3", ")", "or", "arg_3", "<=", "0", "or", "arg_3", ">", "5", ":", "raise", "ValueError", "(", "\"delay must be a positive number.\"", ")", "if", "not", "is_number", "(", "arg_4", ")", "or", "arg_4", "<", "0.1", "or", "arg_4", ">", "0.5", ":", "raise", "ValueError", "(", "\"decay must be a number between 0.1 and 0.5.\"", ")", "if", "not", "is_number", "(", "arg_5", ")", "or", "arg_5", "<", "0.1", "or", "arg_5", ">", "2", ":", "raise", "ValueError", "(", "\"speed must be a positive number.\"", ")", "if", "arg_6", "not", "in", "[", "'sinusoidal'", ",", "'triangular'", "]", ":", "raise", "ValueError", "(", "\"modulation_shape must be one of 'sinusoidal', 'triangular'.\"", ")", "arg_7", "=", "[", "'Func'", ",", "'{:f}'", ".", "format", "(", "arg_1", ")", ",", "'{:f}'", ".", "format", "(", "arg_2", ")", ",", "'{:f}'", ".", "format", "(", "arg_3", ")", ",", "'{:f}'", ".", "format", "(", "arg_4", ")", ",", "'{:f}'", ".", "format", "(", "arg_5", ")", "]", "if", "arg_6", "==", "'sinusoidal'", ":", "arg_7", ".", "append", "(", "'-s'", ")", "elif", "arg_6", "==", "'triangular'", ":", "arg_7", ".", "append", "(", "'-t'", ")", "arg_0", ".", "effects", ".", "extend", "(", "arg_7", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=0.8, arg_2=0.74, arg_3=3, arg_4=0.4, arg_5=0.5,\n               arg_6='sinusoidal'):\n        '''Apply a phasing effect to the audio.\n\n        Parameters\n        ----------\n        gain_in : float, default=0.8\n            Input volume between 0 and 1\n        gain_out: float, default=0.74\n            Output volume between 0 and 1\n        delay : float, default=3\n            Delay in miliseconds between 0 and 5\n        decay : float, default=0.4\n            Decay relative to gain_in, between 0.1 and 0.5.\n        speed : float, default=0.5\n            Modulation speed in Hz, between 0.1 and 2\n        modulation_shape : str, defaul='sinusoidal'\n            Modulation shpae. One of 'sinusoidal' or 'triangular'\n\n        See Also\n        --------\n        flanger, tremolo\n        '''\n        if not is_number(arg_1) or arg_1 <= 0 or arg_1 > 1:\n            raise ValueError(\"gain_in must be a number between 0 and 1.\")\n\n        if not is_number(arg_2) or arg_2 <= 0 or arg_2 > 1:\n            raise ValueError(\"gain_out must be a number between 0 and 1.\")\n\n        if not is_number(arg_3) or arg_3 <= 0 or arg_3 > 5:\n            raise ValueError(\"delay must be a positive number.\")\n\n        if not is_number(arg_4) or arg_4 < 0.1 or arg_4 > 0.5:\n            raise ValueError(\"decay must be a number between 0.1 and 0.5.\")\n\n        if not is_number(arg_5) or arg_5 < 0.1 or arg_5 > 2:\n            raise ValueError(\"speed must be a positive number.\")\n\n        if arg_6 not in ['sinusoidal', 'triangular']:\n            raise ValueError(\n                \"modulation_shape must be one of 'sinusoidal', 'triangular'.\"\n            )\n\n        arg_7 = [\n            'Func',\n            '{:f}'.format(arg_1),\n            '{:f}'.format(arg_2),\n            '{:f}'.format(arg_3),\n            '{:f}'.format(arg_4),\n            '{:f}'.format(arg_5)\n        ]\n\n        if arg_6 == 'sinusoidal':\n            arg_7.append('-s')\n        elif arg_6 == 'triangular':\n            arg_7.append('-t')\n\n        arg_0.effects.extend(arg_7)\n        arg_0.effects_log.append('Func')\n\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.phaser", "docstring": "Apply a phasing effect to the audio.\n\n        Parameters\n        ----------\n        gain_in : float, default=0.8\n            Input volume between 0 and 1\n        gain_out: float, default=0.74\n            Output volume between 0 and 1\n        delay : float, default=3\n            Delay in miliseconds between 0 and 5\n        decay : float, default=0.4\n            Decay relative to gain_in, between 0.1 and 0.5.\n        speed : float, default=0.5\n            Modulation speed in Hz, between 0.1 and 2\n        modulation_shape : str, defaul='sinusoidal'\n            Modulation shpae. One of 'sinusoidal' or 'triangular'\n\n        See Also\n        --------\n        flanger, tremolo", "docstring_tokens": ["Apply", "a", "phasing", "effect", "to", "the", "audio", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 259182}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_rmtree.py#L17-L64", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "remove all files and directories below path, including path\n    itself; works even when shutil.rmtree fails because of read-only\n    files in NFS and Windows.  Follows symlinks.", "language": "python", "parameters": "(path, use_shutil=True, followlinks=False, retries=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ",", "arg_3", "=", "10", ")", ":", "if", "arg_1", "and", "not", "arg_2", ":", "try", ":", "shutil", ".", "Func", "(", "arg_0", ")", "return", "except", "Exception", ",", "exc", ":", "logger", ".", "info", "(", "'shutil.Func(%s) failed, so resorting to recursive delete'", ",", "arg_0", ")", "logger", ".", "debug", "(", "'\\ntrapped:\\n%s'", ",", "traceback", ".", "format_exc", "(", "exc", ")", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "os", ".", "remove", "(", "arg_0", ")", "return", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "os", ".", "walk", "(", "arg_0", ",", "topdown", "=", "False", ",", "arg_2", "=", "arg_2", ")", ":", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_7", ")", "arg_9", "=", "0", "while", "arg_9", "<", "arg_3", ":", "arg_9", "+=", "1", "try", ":", "os", ".", "remove", "(", "arg_8", ")", "break", "except", "Exception", ",", "exc", ":", "time", ".", "sleep", "(", "0.1", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_8", ")", ":", "logger", ".", "critical", "(", "'os.remove(%s) failed, so leaving data behind!!!'", ",", "arg_8", ")", "logger", ".", "critical", "(", "'\\ntrapped:\\n%s'", ",", "traceback", ".", "format_exc", "(", "exc", ")", ")", "for", "arg_10", "in", "arg_5", ":", "arg_11", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_10", ")", "if", "os", ".", "path", ".", "islink", "(", "arg_11", ")", ":", "arg_12", "=", "os", ".", "path", ".", "realpath", "(", "arg_11", ")", "os", ".", "remove", "(", "arg_11", ")", "arg_11", "=", "arg_12", "os", ".", "rmdir", "(", "arg_11", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "os", ".", "rmdir", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=False, arg_3=10):\n    '''remove all files and directories below path, including path\n    itself; works even when shutil.Func fails because of read-only\n    files in NFS and Windows.  Follows symlinks.\n\n    `use_shutil` defaults to True; useful for testing\n\n    `followlinks` defaults to False; if set to True, shutil.Func is\n    not used.\n    '''\n    if arg_1 and not arg_2:\n        try:\n            shutil.Func(arg_0)\n            return\n        except Exception, exc:\n            logger.info('shutil.Func(%s) failed, so resorting to recursive delete', arg_0)\n            logger.debug('\\ntrapped:\\n%s', traceback.format_exc(exc))\n\n    if not os.path.isdir(arg_0):\n        os.remove(arg_0)\n        return\n\n    ## bottom up traversal removing files and then removing directories\n    for arg_4, arg_5, arg_6 in os.walk(arg_0, topdown=False, arg_2=arg_2):\n        for arg_7 in arg_6:\n            arg_8 = os.path.join(arg_4, arg_7)\n            arg_9 = 0\n            while arg_9 < arg_3:\n                arg_9 += 1\n                try:\n                    os.remove(arg_8)\n                    break\n                except Exception, exc:\n                    time.sleep(0.1)\n            if os.path.exists(arg_8):\n                logger.critical('os.remove(%s) failed, so leaving data behind!!!', arg_8)\n                logger.critical('\\ntrapped:\\n%s', traceback.format_exc(exc))\n                #logger.critical(get_open_fds())\n        for arg_10 in arg_5:\n            arg_11 = os.path.join(arg_4, arg_10)\n            if os.path.islink(arg_11):\n                arg_12 = os.path.realpath(arg_11)\n                os.remove(arg_11)\n                arg_11 = arg_12\n            os.rmdir(arg_11)\n\n    if os.path.exists(arg_0):\n        os.rmdir(arg_0)", "path": "streamcorpus_pipeline/_rmtree.py", "identifier": "rmtree", "docstring": "remove all files and directories below path, including path\n    itself; works even when shutil.rmtree fails because of read-only\n    files in NFS and Windows.  Follows symlinks.\n\n    `use_shutil` defaults to True; useful for testing\n\n    `followlinks` defaults to False; if set to True, shutil.rmtree is\n    not used.", "docstring_tokens": ["remove", "all", "files", "and", "directories", "below", "path", "including", "path", "itself", ";", "works", "even", "when", "shutil", ".", "rmtree", "fails", "because", "of", "read", "-", "only", "files", "in", "NFS", "and", "Windows", ".", "Follows", "symlinks", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 259183}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/networks/layer.py#L121-L131", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates a layer from a specification dict.", "language": "python", "parameters": "(spec, kwargs=None)", "return_statement": "return layer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "util", ".", "get_object", "(", "obj", "=", "arg_0", ",", "predefined_objects", "=", "tensorforce", ".", "core", ".", "networks", ".", "layers", ",", "arg_1", "=", "arg_1", ")", "assert", "isinstance", "(", "arg_2", ",", "Layer", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Creates a layer from a specification dict.\n        \"\"\"\n        arg_2 = util.get_object(\n            obj=arg_0,\n            predefined_objects=tensorforce.core.networks.layers,\n            arg_1=arg_1\n        )\n        assert isinstance(arg_2, Layer)\n        return arg_2", "path": "tensorforce/core/networks/layer.py", "identifier": "Layer.from_spec", "docstring": "Creates a layer from a specification dict.", "docstring_tokens": ["Creates", "a", "layer", "from", "a", "specification", "dict", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 259184}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/parse.py#L230-L249", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "find any matching parser_args from list_args and merge them into this\n        instance", "language": "python", "parameters": "(self, list_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "xs", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_1", ":", "if", "len", "(", "set", "(", "arg_4", ")", "&", "arg_3", ")", ">", "0", ":", "yield", "arg_4", ",", "arg_5", "else", ":", "if", "'dest'", "in", "arg_5", ":", "if", "arg_5", "[", "'dest'", "]", "==", "arg_2", ":", "yield", "arg_4", ",", "arg_5", "for", "arg_4", ",", "arg_5", "in", "xs", "(", "arg_0", ".", "name", ",", "arg_0", ".", "parser_args", ",", "arg_1", ")", ":", "arg_0", ".", "merge_args", "(", "arg_4", ")", "arg_0", ".", "merge_kwargs", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"find any matching parser_args from list_args and merge them into this\n        instance\n\n        list_args -- list -- an array of (args, kwargs) tuples\n        \"\"\"\n        def xs(arg_2, arg_3, arg_1):\n            \"\"\"build the generator of matching list_args\"\"\"\n            for arg_4, arg_5 in arg_1:\n                if len(set(arg_4) & arg_3) > 0:\n                    yield arg_4, arg_5\n\n                else:\n                    if 'dest' in arg_5:\n                        if arg_5['dest'] == arg_2:\n                            yield arg_4, arg_5\n\n        for arg_4, arg_5 in xs(arg_0.name, arg_0.parser_args, arg_1):\n            arg_0.merge_args(arg_4)\n            arg_0.merge_kwargs(arg_5)", "path": "captain/parse.py", "identifier": "ScriptKwarg.merge_from_list", "docstring": "find any matching parser_args from list_args and merge them into this\n        instance\n\n        list_args -- list -- an array of (args, kwargs) tuples", "docstring_tokens": ["find", "any", "matching", "parser_args", "from", "list_args", "and", "merge", "them", "into", "this", "instance"], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 259185}
{"url": "https://github.com/MitchellChu/torndsession/blob/dd08554c06f47d33396a0a4485f53d0522961155/demos/memory_session.py#L53-L65", "sha": "dd08554c06f47d33396a0a4485f53d0522961155", "docstring_summary": "Please don't do this in production environments.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "write", "(", "\"Memory Session Object Demo:\"", ")", "if", "\"sv\"", "in", "arg_0", ".", "session", ":", "arg_1", "=", "arg_0", ".", "session", "[", "\"sv\"", "]", "arg_0", ".", "write", "(", "\"current sv value is %s, and system will delete this value.<br/>\"", "%", "arg_0", ".", "session", "[", "\"sv\"", "]", ")", "arg_0", ".", "session", ".", "delete", "(", "\"sv\"", ")", "if", "\"sv\"", "not", "in", "arg_0", ".", "session", ":", "arg_0", ".", "write", "(", "\"current sv value is empty\"", ")", "else", ":", "arg_0", ".", "write", "(", "\"Session data not found\"", ")"], "function": "def Func(arg_0):\n        '''\n        Please don't do this in production environments.\n        '''\n        arg_0.write(\"Memory Session Object Demo:\")\n        if \"sv\" in arg_0.session:\n            arg_1 = arg_0.session[\"sv\"]\n            arg_0.write(\"current sv value is %s, and system will delete this value.<br/>\" % arg_0.session[\"sv\"])\n            arg_0.session.delete(\"sv\")\n            if \"sv\" not in arg_0.session:\n                arg_0.write(\"current sv value is empty\")\n        else:\n            arg_0.write(\"Session data not found\")", "path": "demos/memory_session.py", "identifier": "DeleteHandler.get", "docstring": "Please don't do this in production environments.", "docstring_tokens": ["Please", "don", "t", "do", "this", "in", "production", "environments", "."], "nwo": "MitchellChu/torndsession", "score": 0.18915638823512385, "idx": 259186}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/twistedx/producer.py#L269-L286", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Returns the file size for given file field.", "language": "python", "parameters": "(self, field)", "return_statement": "return self._file_lengths[field]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "try", ":", "arg_3", "=", "open", "(", "arg_0", ".", "_files", "[", "arg_1", "]", ",", "\"r\"", ")", "arg_2", "=", "os", ".", "fstat", "(", "arg_3", ".", "fileno", "(", ")", ")", ".", "st_size", "arg_3", ".", "close", "(", ")", "except", ":", "arg_2", "=", "0", "arg_0", ".", "_file_lengths", "[", "arg_1", "]", "=", "arg_2", "return", "arg_0", ".", "_file_lengths", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns the file size for given file field.\n\n        Args:\n            field (str): File field\n\n        Returns:\n            int. File size\n        \"\"\"\n        arg_2 = 0\n        try:\n            arg_3 = open(arg_0._files[arg_1], \"r\")\n            arg_2 = os.fstat(arg_3.fileno()).st_size\n            arg_3.close()\n        except:\n            arg_2 = 0\n        arg_0._file_lengths[arg_1] = arg_2\n        return arg_0._file_lengths[arg_1]", "path": "pyfire/twistedx/producer.py", "identifier": "MultiPartProducer._file_size", "docstring": "Returns the file size for given file field.\n\n        Args:\n            field (str): File field\n\n        Returns:\n            int. File size", "docstring_tokens": ["Returns", "the", "file", "size", "for", "given", "file", "field", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 259187}
{"url": "https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/__init__.py#L465-L507", "sha": "d1211b289747671898eb063013e0dc53d3c80acd", "docstring_summary": "Serialize the specified DataFrame and upload it as a new dataset.", "language": "python", "parameters": "(self, dataframe, data_type_id, name, description)", "return_statement": "return self._upload(raw_data, data_type_id, name, description)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "_not_none", "(", "'dataframe'", ",", "arg_1", ")", "_not_none_or_empty", "(", "'data_type_id'", ",", "arg_2", ")", "_not_none_or_empty", "(", "'name'", ",", "arg_3", ")", "_not_none_or_empty", "(", "'description'", ",", "arg_4", ")", "try", ":", "arg_5", "=", "BytesIO", "(", ")", "serialize_dataframe", "(", "arg_5", ",", "arg_2", ",", "arg_1", ")", "arg_6", "=", "arg_5", ".", "getvalue", "(", ")", "finally", ":", "arg_5", ".", "close", "(", ")", "return", "arg_0", ".", "_upload", "(", "arg_6", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Serialize the specified DataFrame and upload it as a new dataset.\n\n        Parameters\n        ----------\n        dataframe : pandas.DataFrame\n            Data to serialize.\n        data_type_id : str\n            Format to serialize to.\n            Supported formats are:\n                'PlainText'\n                'GenericCSV'\n                'GenericTSV'\n                'GenericCSVNoHeader'\n                'GenericTSVNoHeader'\n            See the azureml.DataTypeIds class for constants.\n        name : str\n            Name for the new dataset.\n        description : str\n            Description for the new dataset.\n\n        Returns\n        -------\n        SourceDataset\n            Dataset that was just created.\n            Use open(), read_as_binary(), read_as_text() or to_dataframe() on\n            the dataset object to get its contents as a stream, bytes, str or\n            pandas DataFrame.\n        \"\"\"\n        _not_none('dataframe', arg_1)\n        _not_none_or_empty('data_type_id', arg_2)\n        _not_none_or_empty('name', arg_3)\n        _not_none_or_empty('description', arg_4)\n\n        try:\n            arg_5 = BytesIO()\n            serialize_dataframe(arg_5, arg_2, arg_1)\n            arg_6 = arg_5.getvalue()\n        finally:\n            arg_5.close()\n\n        return arg_0._upload(arg_6, arg_2, arg_3, arg_4)", "path": "azureml/__init__.py", "identifier": "Datasets.add_from_dataframe", "docstring": "Serialize the specified DataFrame and upload it as a new dataset.\n\n        Parameters\n        ----------\n        dataframe : pandas.DataFrame\n            Data to serialize.\n        data_type_id : str\n            Format to serialize to.\n            Supported formats are:\n                'PlainText'\n                'GenericCSV'\n                'GenericTSV'\n                'GenericCSVNoHeader'\n                'GenericTSVNoHeader'\n            See the azureml.DataTypeIds class for constants.\n        name : str\n            Name for the new dataset.\n        description : str\n            Description for the new dataset.\n\n        Returns\n        -------\n        SourceDataset\n            Dataset that was just created.\n            Use open(), read_as_binary(), read_as_text() or to_dataframe() on\n            the dataset object to get its contents as a stream, bytes, str or\n            pandas DataFrame.", "docstring_tokens": ["Serialize", "the", "specified", "DataFrame", "and", "upload", "it", "as", "a", "new", "dataset", "."], "nwo": "Azure/Azure-MachineLearning-ClientLibrary-Python", "score": 0.7256991522843181, "idx": 259188}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3397-L3401", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Return a shallow copy a DataFrame with the last n rows.", "language": "python", "parameters": "(self, n=10)", "return_statement": "return self[max(0, N - n):min(len(self), N)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "arg_2", "=", "len", "(", "arg_0", ")", "return", "arg_0", "[", "max", "(", "0", ",", "arg_2", "-", "arg_1", ")", ":", "min", "(", "len", "(", "arg_0", ")", ",", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1=10):\n        \"\"\"Return a shallow copy a DataFrame with the last n rows.\"\"\"\n        arg_2 = len(arg_0)\n        # self.cat(i1=max(0, N-n), i2=min(len(self), N))\n        return arg_0[max(0, arg_2 - arg_1):min(len(arg_0), arg_2)]", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.tail", "docstring": "Return a shallow copy a DataFrame with the last n rows.", "docstring_tokens": ["Return", "a", "shallow", "copy", "a", "DataFrame", "with", "the", "last", "n", "rows", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 259189}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2894-L2929", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Read a single holiday date from meter buffer.", "language": "python", "parameters": "(self, setting_holiday)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "namedtuple", "(", "\"result\"", ",", "[", "\"Holiday\"", ",", "\"Month\"", ",", "\"Day\"", "]", ")", "arg_1", "+=", "1", "arg_2", ".", "Holiday", "=", "str", "(", "arg_1", ")", "if", "(", "arg_1", "<", "1", ")", "or", "(", "arg_1", ">", "Extents", ".", "Holidays", ")", ":", "ekm_log", "(", "\"Out of bounds:  holiday \"", "+", "str", "(", "arg_1", ")", ")", "arg_2", ".", "Holiday", "=", "arg_2", ".", "Month", "=", "arg_2", ".", "Day", "=", "str", "(", "0", ")", "return", "arg_2", "arg_4", "=", "\"Holiday_\"", "+", "str", "(", "arg_1", ")", "+", "\"_Day\"", "arg_5", "=", "\"Holiday_\"", "+", "str", "(", "arg_1", ")", "+", "\"_Mon\"", "if", "arg_5", "not", "in", "arg_0", ".", "m_hldy", ":", "arg_2", ".", "Holiday", "=", "arg_2", ".", "Month", "=", "arg_2", ".", "Day", "=", "str", "(", "0", ")", "return", "arg_2", "if", "arg_4", "not", "in", "arg_0", ".", "m_hldy", ":", "arg_2", ".", "Holiday", "=", "arg_2", ".", "Month", "=", "arg_2", ".", "Day", "=", "str", "(", "0", ")", "return", "arg_2", "arg_2", ".", "Day", "=", "arg_0", ".", "m_hldy", "[", "arg_4", "]", "[", "MeterData", ".", "StringValue", "]", "arg_2", ".", "Month", "=", "arg_0", ".", "m_hldy", "[", "arg_5", "]", "[", "MeterData", ".", "StringValue", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Read a single holiday date from meter buffer.\n\n        Args:\n            setting_holiday (int):  Holiday from 0-19 or in range(Extents.Holidays)\n\n        Returns:\n            tuple: Holiday tuple, elements are strings.\n\n            =============== ======================\n            Holiday         Holiday 0-19 as string\n            Day             Day 1-31 as string\n            Month           Monty 1-12 as string\n            =============== ======================\n\n        \"\"\"\n        arg_2 = namedtuple(\"result\", [\"Holiday\", \"Month\", \"Day\"])\n        arg_1 += 1\n        arg_2.Holiday = str(arg_1)\n\n        if (arg_1 < 1) or (arg_1 > Extents.Holidays):\n            ekm_log(\"Out of bounds:  holiday \" + str(arg_1))\n            arg_2.Holiday = arg_2.Month = arg_2.Day = str(0)\n            return arg_2\n\n        arg_4 = \"Holiday_\" + str(arg_1) + \"_Day\"\n        arg_5 = \"Holiday_\" + str(arg_1) + \"_Mon\"\n        if arg_5 not in arg_0.m_hldy:\n            arg_2.Holiday = arg_2.Month = arg_2.Day = str(0)\n            return arg_2\n        if arg_4 not in arg_0.m_hldy:\n            arg_2.Holiday = arg_2.Month = arg_2.Day = str(0)\n            return arg_2\n        arg_2.Day = arg_0.m_hldy[arg_4][MeterData.StringValue]\n        arg_2.Month = arg_0.m_hldy[arg_5][MeterData.StringValue]\n        return arg_2", "path": "ekmmeters.py", "identifier": "Meter.extractHolidayDate", "docstring": "Read a single holiday date from meter buffer.\n\n        Args:\n            setting_holiday (int):  Holiday from 0-19 or in range(Extents.Holidays)\n\n        Returns:\n            tuple: Holiday tuple, elements are strings.\n\n            =============== ======================\n            Holiday         Holiday 0-19 as string\n            Day             Day 1-31 as string\n            Month           Monty 1-12 as string\n            =============== ======================", "docstring_tokens": ["Read", "a", "single", "holiday", "date", "from", "meter", "buffer", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 259190}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/config.py#L61-L82", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "validate visualization url format", "language": "python", "parameters": "(self, url_format)", "return_statement": "return url_format", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"${CLUSTER}\"", ":", "\"cluster\"", ",", "\"${ENVIRON}\"", ":", "\"environ\"", ",", "\"${TOPOLOGY}\"", ":", "\"topology\"", ",", "\"${ROLE}\"", ":", "\"role\"", ",", "\"${USER}\"", ":", "\"user\"", ",", "}", "arg_3", "=", "arg_1", "for", "arg_4", ",", "arg_5", "in", "arg_2", ".", "items", "(", ")", ":", "arg_3", "=", "arg_3", ".", "replace", "(", "arg_4", ",", "arg_5", ")", "if", "'$'", "in", "arg_3", ":", "raise", "Exception", "(", "\"Invalid viz.url.format: %s\"", "%", "(", "arg_1", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"validate visualization url format\"\"\"\n    # We try to create a string by substituting all known\n    # parameters. If an unknown parameter is present, an error\n    # will be thrown\n    arg_2 = {\n        \"${CLUSTER}\": \"cluster\",\n        \"${ENVIRON}\": \"environ\",\n        \"${TOPOLOGY}\": \"topology\",\n        \"${ROLE}\": \"role\",\n        \"${USER}\": \"user\",\n    }\n    arg_3 = arg_1\n    for arg_4, arg_5 in arg_2.items():\n      arg_3 = arg_3.replace(arg_4, arg_5)\n\n    # All $ signs must have been replaced\n    if '$' in arg_3:\n      raise Exception(\"Invalid viz.url.format: %s\" % (arg_1))\n\n    # No error is thrown, so the format is valid.\n    return arg_1", "path": "heron/tools/tracker/src/python/config.py", "identifier": "Config.validated_formatter", "docstring": "validate visualization url format", "docstring_tokens": ["validate", "visualization", "url", "format"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259191}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/validation.py#L205-L259", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Input validation on an array, list, sparse matrix or similar.", "language": "python", "parameters": "(array, accept_sparse=None, dtype=None, order=None, copy=False,\n                force_all_finite=True, ensure_2d=True, allow_nd=False)", "return_statement": "return array", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "True", ",", "arg_6", "=", "True", ",", "arg_7", "=", "False", ")", ":", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "[", "arg_1", "]", "if", "sp", ".", "issparse", "(", "arg_0", ")", ":", "arg_0", "=", "_ensure_sparse_format", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "else", ":", "if", "arg_6", ":", "arg_0", "=", "np", ".", "atleast_2d", "(", "arg_0", ")", "arg_0", "=", "np", ".", "array", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "if", "not", "arg_7", "and", "arg_0", ".", "ndim", ">=", "3", ":", "raise", "ValueError", "(", "\"Found array with dim %d. Expected <= 2\"", "%", "arg_0", ".", "ndim", ")", "if", "arg_5", ":", "_assert_all_finite", "(", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False,\n                arg_5=True, arg_6=True, arg_7=False):\n    \"\"\"Input validation on an array, list, sparse matrix or similar.\n\n    By default, the input is converted to an at least 2nd numpy array.\n\n    Parameters\n    ----------\n    array : object\n        Input object to check / convert.\n\n    accept_sparse : string, list of string or None (default=None)\n        String[s] representing allowed sparse matrix formats, such as 'csc',\n        'csr', etc.  None means that sparse matrix input will raise an error.\n        If the input is sparse but not in the allowed format, it will be\n        converted to the first listed format.\n\n    order : 'F', 'C' or None (default=None)\n        Whether an array will be forced to be fortran or c-style.\n\n    copy : boolean (default=False)\n        Whether a forced copy will be triggered. If copy=False, a copy might\n        be triggered by a conversion.\n\n    force_all_finite : boolean (default=True)\n        Whether to raise an error on np.inf and np.nan in X.\n\n    ensure_2d : boolean (default=True)\n        Whether to make X at least 2d.\n\n    allow_nd : boolean (default=False)\n        Whether to allow X.ndim > 2.\n\n    Returns\n    -------\n    X_converted : object\n        The converted and validated X.\n    \"\"\"\n    if isinstance(arg_1, str):\n        arg_1 = [arg_1]\n\n    if sp.issparse(arg_0):\n        arg_0 = _ensure_sparse_format(arg_0, arg_1, arg_2, arg_3,\n                                      arg_4, arg_5)\n    else:\n        if arg_6:\n            arg_0 = np.atleast_2d(arg_0)\n        arg_0 = np.array(arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)\n        if not arg_7 and arg_0.ndim >= 3:\n            raise ValueError(\"Found array with dim %d. Expected <= 2\" %\n                             arg_0.ndim)\n        if arg_5:\n            _assert_all_finite(arg_0)\n\n    return arg_0", "path": "boyle/utils/validation.py", "identifier": "check_array", "docstring": "Input validation on an array, list, sparse matrix or similar.\n\n    By default, the input is converted to an at least 2nd numpy array.\n\n    Parameters\n    ----------\n    array : object\n        Input object to check / convert.\n\n    accept_sparse : string, list of string or None (default=None)\n        String[s] representing allowed sparse matrix formats, such as 'csc',\n        'csr', etc.  None means that sparse matrix input will raise an error.\n        If the input is sparse but not in the allowed format, it will be\n        converted to the first listed format.\n\n    order : 'F', 'C' or None (default=None)\n        Whether an array will be forced to be fortran or c-style.\n\n    copy : boolean (default=False)\n        Whether a forced copy will be triggered. If copy=False, a copy might\n        be triggered by a conversion.\n\n    force_all_finite : boolean (default=True)\n        Whether to raise an error on np.inf and np.nan in X.\n\n    ensure_2d : boolean (default=True)\n        Whether to make X at least 2d.\n\n    allow_nd : boolean (default=False)\n        Whether to allow X.ndim > 2.\n\n    Returns\n    -------\n    X_converted : object\n        The converted and validated X.", "docstring_tokens": ["Input", "validation", "on", "an", "array", "list", "sparse", "matrix", "or", "similar", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259192}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/typeShortcuts.py#L25-L27", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "create hdl vector value", "language": "python", "parameters": "(val, width, signed=None)", "return_statement": "return Bits(width, signed, forceVector=True).fromPy(val)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "Bits", "(", "arg_1", ",", "arg_2", ",", "forceVector", "=", "True", ")", ".", "fromPy", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"create hdl Functor value\"\"\"\n    return Bits(arg_1, arg_2, forceVector=True).fromPy(arg_0)", "path": "hwt/hdl/typeShortcuts.py", "identifier": "vec", "docstring": "create hdl vector value", "docstring_tokens": ["create", "hdl", "vector", "value"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 259193}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/inspector.py#L124-L132", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "visit an astroid.Package node", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "tag", ":", "arg_1", ".", "uid", "=", "arg_0", ".", "generate_id", "(", ")", "for", "arg_3", "in", "arg_1", ".", "values", "(", ")", ":", "arg_0", ".", "visit", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"visit an astroid.Package node\n\n         * optionally tag the node with a unique id\n        \"\"\"\n        if arg_0.tag:\n            arg_1.uid = arg_0.generate_id()\n        for arg_3 in arg_1.values():\n            arg_0.visit(arg_3)", "path": "pylint/pyreverse/inspector.py", "identifier": "Linker.visit_package", "docstring": "visit an astroid.Package node\n\n         * optionally tag the node with a unique id", "docstring_tokens": ["visit", "an", "astroid", ".", "Package", "node"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 259194}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/validation.py#L262-L316", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Input validation for standard estimators.", "language": "python", "parameters": "(X, y, accept_sparse=None, dtype=None, order=None, copy=False,\n              force_all_finite=True, ensure_2d=True, allow_nd=False,\n              multi_output=False)", "return_statement": "return X, y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "arg_6", "=", "True", ",", "arg_7", "=", "True", ",", "arg_8", "=", "False", ",", "arg_9", "=", "False", ")", ":", "arg_0", "=", "check_array", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "if", "arg_9", ":", "arg_1", "=", "check_array", "(", "arg_1", ",", "'csr'", ",", "arg_6", "=", "True", ",", "arg_7", "=", "False", ")", "else", ":", "arg_1", "=", "column_or_1d", "(", "arg_1", ",", "warn", "=", "True", ")", "_assert_all_finite", "(", "arg_1", ")", "check_consistent_length", "(", "arg_0", ",", "arg_1", ")", "return", "arg_0", ",", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=False,\n              arg_6=True, arg_7=True, arg_8=False,\n              arg_9=False):\n    \"\"\"Input validation for standard estimators.\n\n    Checks X and y for consistent length, enforces X 2d and y 1d.\n    Standard input checks are only applied to y. For multi-label y,\n    set multi_ouput=True to allow 2d and sparse y.\n\n    Parameters\n    ----------\n    X : nd-array, list or sparse matrix\n        Input data.\n\n    y : nd-array, list or sparse matrix\n        Labels.\n\n    accept_sparse : string, list of string or None (default=None)\n        String[s] representing allowed sparse matrix formats, such as 'csc',\n        'csr', etc.  None means that sparse matrix input will raise an error.\n        If the input is sparse but not in the allowed format, it will be\n        converted to the first listed format.\n\n    order : 'F', 'C' or None (default=None)\n        Whether an array will be forced to be fortran or c-style.\n\n    copy : boolean (default=False)\n        Whether a forced copy will be triggered. If copy=False, a copy might\n        be triggered by a conversion.\n\n    force_all_finite : boolean (default=True)\n        Whether to raise an error on np.inf and np.nan in X.\n\n    ensure_2d : boolean (default=True)\n        Whether to make X at least 2d.\n\n    allow_nd : boolean (default=False)\n        Whether to allow X.ndim > 2.\n\n    Returns\n    -------\n    X_converted : object\n        The converted and validated X.\n    \"\"\"\n    arg_0 = check_array(arg_0, arg_2, arg_3, arg_4, arg_5, arg_6,\n                    arg_7, arg_8)\n    if arg_9:\n        arg_1 = check_array(arg_1, 'csr', arg_6=True, arg_7=False)\n    else:\n        arg_1 = column_or_1d(arg_1, warn=True)\n        _assert_all_finite(arg_1)\n\n    check_consistent_length(arg_0, arg_1)\n\n    return arg_0, arg_1", "path": "boyle/utils/validation.py", "identifier": "check_X_y", "docstring": "Input validation for standard estimators.\n\n    Checks X and y for consistent length, enforces X 2d and y 1d.\n    Standard input checks are only applied to y. For multi-label y,\n    set multi_ouput=True to allow 2d and sparse y.\n\n    Parameters\n    ----------\n    X : nd-array, list or sparse matrix\n        Input data.\n\n    y : nd-array, list or sparse matrix\n        Labels.\n\n    accept_sparse : string, list of string or None (default=None)\n        String[s] representing allowed sparse matrix formats, such as 'csc',\n        'csr', etc.  None means that sparse matrix input will raise an error.\n        If the input is sparse but not in the allowed format, it will be\n        converted to the first listed format.\n\n    order : 'F', 'C' or None (default=None)\n        Whether an array will be forced to be fortran or c-style.\n\n    copy : boolean (default=False)\n        Whether a forced copy will be triggered. If copy=False, a copy might\n        be triggered by a conversion.\n\n    force_all_finite : boolean (default=True)\n        Whether to raise an error on np.inf and np.nan in X.\n\n    ensure_2d : boolean (default=True)\n        Whether to make X at least 2d.\n\n    allow_nd : boolean (default=False)\n        Whether to allow X.ndim > 2.\n\n    Returns\n    -------\n    X_converted : object\n        The converted and validated X.", "docstring_tokens": ["Input", "validation", "for", "standard", "estimators", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259195}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L470-L476", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Find out BAI file by extension given the BAM file.", "language": "python", "parameters": "(bam_file)", "return_statement": "return bai_file", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "replace", "(", "'.bam'", ",", "'.bai'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "arg_1", "=", "\"{}.bai\"", ".", "format", "(", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Find out BAI file by extension given the BAM file.\"\"\"\n    arg_1 = arg_0.replace('.bam', '.bai')\n    if not os.path.exists(arg_1):\n        # try the other convention\n        arg_1 = \"{}.bai\".format(arg_0)\n    return arg_1", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "find_bai_file", "docstring": "Find out BAI file by extension given the BAM file.", "docstring_tokens": ["Find", "out", "BAI", "file", "by", "extension", "given", "the", "BAM", "file", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259196}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/provider.py#L179-L188", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Called when characteristic value was read or updated.", "language": "python", "parameters": "(self, peripheral, characteristic, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "logger", ".", "debug", "(", "'peripheral_didUpdateValueForCharacteristic_error called'", ")", "if", "arg_3", "is", "not", "None", ":", "return", "arg_4", "=", "device_list", "(", ")", ".", "get", "(", "arg_1", ")", "if", "arg_4", "is", "not", "None", ":", "arg_4", ".", "_characteristic_changed", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Called when characteristic value was read or updated.\"\"\"\n        logger.debug('peripheral_didUpdateValueForCharacteristic_error called')\n        # Stop if there was some kind of error.\n        if arg_3 is not None:\n            return\n        # Notify the device about the updated characteristic value.\n        arg_4 = device_list().get(arg_1)\n        if arg_4 is not None:\n            arg_4._characteristic_changed(arg_2)", "path": "Adafruit_BluefruitLE/corebluetooth/provider.py", "identifier": "CentralDelegate.peripheral_didUpdateValueForCharacteristic_error_", "docstring": "Called when characteristic value was read or updated.", "docstring_tokens": ["Called", "when", "characteristic", "value", "was", "read", "or", "updated", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 259197}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/__init__.py#L41-L60", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "For `dwavebinarycsp` to be functional, at least one penalty model factory\n    has to be installed. See discussion in setup.py for details.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "from", "pkg_resources", "import", "iter_entry_points", "from", "penaltymodel", ".", "core", "import", "FACTORY_ENTRYPOINT", "from", "itertools", "import", "chain", "arg_0", "=", "(", "'maxgap'", ",", "'mip'", ")", "arg_1", "=", "chain", "(", "*", "(", "iter_entry_points", "(", "FACTORY_ENTRYPOINT", ",", "arg_2", ")", "for", "arg_2", "in", "arg_0", ")", ")", "try", ":", "next", "(", "arg_1", ")", "except", "StopIteration", ":", "raise", "AssertionError", "(", "\"To use 'dwavebinarycsp', at least one penaltymodel factory must be installed. \"", "\"Try {}.\"", ".", "format", "(", "\" or \"", ".", "join", "(", "\"'pip install dwavebinarycsp[{}]'\"", ".", "format", "(", "arg_2", ")", "for", "arg_2", "in", "arg_0", ")", ")", ")"], "function": "def Func():\n    \"\"\"For `dwavebinarycsp` to be functional, at least one penalty model factory\n    has to be installed. See discussion in setup.py for details.\n    \"\"\"\n\n    from pkg_resources import iter_entry_points\n    from penaltymodel.core import FACTORY_ENTRYPOINT\n    from itertools import chain\n\n    arg_0 = ('maxgap', 'mip')\n    arg_1 = chain(*(iter_entry_points(FACTORY_ENTRYPOINT, arg_2) for arg_2 in arg_0))\n\n    try:\n        next(arg_1)\n    except StopIteration:\n        raise AssertionError(\n            \"To use 'dwavebinarycsp', at least one penaltymodel factory must be installed. \"\n            \"Try {}.\".format(\n                \" or \".join(\"'pip install dwavebinarycsp[{}]'\".format(arg_2) for arg_2 in arg_0)\n            ))", "path": "dwavebinarycsp/__init__.py", "identifier": "assert_penaltymodel_factory_available", "docstring": "For `dwavebinarycsp` to be functional, at least one penalty model factory\n    has to be installed. See discussion in setup.py for details.", "docstring_tokens": ["For", "dwavebinarycsp", "to", "be", "functional", "at", "least", "one", "penalty", "model", "factory", "has", "to", "be", "installed", ".", "See", "discussion", "in", "setup", ".", "py", "for", "details", "."], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 259198}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L904-L928", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Determines the maximum drawdown of a strategy.", "language": "python", "parameters": "(returns)", "return_statement": "return get_max_drawdown_underwater(underwater)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "copy", "(", ")", "arg_1", "=", "cum_returns", "(", "arg_0", ",", "1.0", ")", "arg_2", "=", "np", ".", "maximum", ".", "accumulate", "(", "arg_1", ")", "arg_3", "=", "arg_1", "/", "arg_2", "-", "1", "return", "Func_underwater", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Determines the maximum drawdown of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n        - See full explanation in :func:`~pyfolio.timeseries.cum_returns`.\n\n    Returns\n    -------\n    float\n        Maximum drawdown.\n\n    Note\n    -----\n    See https://en.wikipedia.org/wiki/Drawdown_(economics) for more details.\n    \"\"\"\n\n    arg_0 = arg_0.copy()\n    arg_1 = cum_returns(arg_0, 1.0)\n    arg_2 = np.maximum.accumulate(arg_1)\n    arg_3 = arg_1 / arg_2 - 1\n    return Func_underwater(arg_3)", "path": "pyfolio/timeseries.py", "identifier": "get_max_drawdown", "docstring": "Determines the maximum drawdown of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n        - See full explanation in :func:`~pyfolio.timeseries.cum_returns`.\n\n    Returns\n    -------\n    float\n        Maximum drawdown.\n\n    Note\n    -----\n    See https://en.wikipedia.org/wiki/Drawdown_(economics) for more details.", "docstring_tokens": ["Determines", "the", "maximum", "drawdown", "of", "a", "strategy", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 259199}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/selection/factories/expand.py#L91-L113", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "expand a path config given as a tuple", "language": "python", "parameters": "(path_cfg, alias_dict, overriding_kargs)", "return_statement": "return expand_path_cfg(\n        new_path_cfg,\n        overriding_kargs=new_overriding_kargs,\n        alias_dict=alias_dict\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "[", "0", "]", "arg_4", "=", "arg_0", "[", "1", "]", ".", "copy", "(", ")", "arg_4", ".", "update", "(", "arg_2", ")", "return", "expand_path_cfg", "(", "arg_3", ",", "arg_2", "=", "arg_4", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"expand a path config given as a tuple\n\n    \"\"\"\n\n    # e.g.,\n    # path_cfg = ('ev : {low} <= ev.var[0] < {high}', {'low': 10, 'high': 200})\n    # overriding_kargs = {'alias': 'var_cut', 'name': 'var_cut25', 'low': 25}\n\n    arg_3 = arg_0[0]\n    # e.g., 'ev : {low} <= ev.var[0] < {high}'\n\n    arg_4 = arg_0[1].copy()\n    # e.g., {'low': 10, 'high': 200}\n\n    arg_4.update(arg_2)\n    # e.g., {'low': 25, 'high': 200, 'alias': 'var_cut', 'name': 'var_cut25'}\n\n    return expand_path_cfg(\n        arg_3,\n        arg_2=arg_4,\n        arg_1=arg_1\n    )", "path": "alphatwirl/selection/factories/expand.py", "identifier": "_expand_tuple", "docstring": "expand a path config given as a tuple", "docstring_tokens": ["expand", "a", "path", "config", "given", "as", "a", "tuple"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 259200}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/lms.py#L377-L398", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Calls the third party auth api endpoint to get the mapping between usernames and remote ids.", "language": "python", "parameters": "(self, identity_provider, param_name, param_value, result_field_name)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "try", ":", "arg_5", "=", "{", "arg_2", ":", "arg_3", "}", "arg_6", "=", "arg_0", ".", "client", ".", "providers", "(", "arg_1", ")", ".", "users", ".", "get", "(", "**", "arg_5", ")", "arg_7", "=", "arg_6", ".", "get", "(", "'results'", ",", "[", "]", ")", "except", "HttpNotFoundError", ":", "LOGGER", ".", "error", "(", "'username not found for third party provider={provider}, {querystring_param}={id}'", ".", "format", "(", "provider", "=", "arg_1", ",", "querystring_param", "=", "arg_2", ",", "id", "=", "arg_3", ")", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_7", ":", "if", "arg_8", ".", "get", "(", "arg_2", ")", "==", "arg_3", ":", "return", "arg_8", ".", "get", "(", "arg_4", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Calls the third party auth api endpoint to get the mapping between usernames and remote ids.\n        \"\"\"\n        try:\n            arg_5 = {arg_2: arg_3}\n            arg_6 = arg_0.client.providers(arg_1).users.get(**arg_5)\n            arg_7 = arg_6.get('results', [])\n        except HttpNotFoundError:\n            LOGGER.error(\n                'username not found for third party provider={provider}, {querystring_param}={id}'.format(\n                    provider=arg_1,\n                    querystring_param=arg_2,\n                    id=arg_3\n                )\n            )\n            arg_7 = []\n\n        for arg_8 in arg_7:\n            if arg_8.get(arg_2) == arg_3:\n                return arg_8.get(arg_4)\n        return None", "path": "enterprise/api_client/lms.py", "identifier": "ThirdPartyAuthApiClient._get_results", "docstring": "Calls the third party auth api endpoint to get the mapping between usernames and remote ids.", "docstring_tokens": ["Calls", "the", "third", "party", "auth", "api", "endpoint", "to", "get", "the", "mapping", "between", "usernames", "and", "remote", "ids", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259201}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-common/azure/profiles/__init__.py#L47-L51", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Define a new default profile.", "language": "python", "parameters": "(self, profile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "(", "KnownProfiles", ",", "ProfileDefinition", ")", ")", ":", "raise", "ValueError", "(", "\"Can only set as default a ProfileDefinition or a KnownProfiles\"", ")", "arg_2", "(", "arg_0", ")", ".", "profile", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Define a new default profile.\"\"\"\n        if not isinstance(arg_1, (KnownProfiles, ProfileDefinition)):\n            raise ValueError(\"Can only set as default a ProfileDefinition or a KnownProfiles\")\n        arg_2(arg_0).profile = arg_1", "path": "azure-common/azure/profiles/__init__.py", "identifier": "DefaultProfile.use", "docstring": "Define a new default profile.", "docstring_tokens": ["Define", "a", "new", "default", "profile", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259202}
{"url": "https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/chaos.py#L314-L324", "sha": "3dc6ad803f0b0d56586dec9542a6a06aa06cf569", "docstring_summary": "End the blockade event and return to a steady state", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "_logger", ".", "info", "(", "\"Ending the degradation for blockade %s\"", "%", "arg_0", ".", "_blockade_name", ")", "arg_0", ".", "_do_reset_all", "(", ")", "arg_3", "=", "random", ".", "randint", "(", "arg_0", ".", "_start_min_delay", ",", "arg_0", ".", "_start_max_delay", ")", "arg_0", ".", "_timer", "=", "threading", ".", "Timer", "(", "arg_3", "/", "1000.0", ",", "arg_0", ".", "event_timeout", ")", "arg_0", ".", "_timer", ".", "start", "(", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        End the blockade event and return to a steady state\n        \"\"\"\n        _logger.info(\n                \"Ending the degradation for blockade %s\" % arg_0._blockade_name)\n        arg_0._do_reset_all()\n        # set a timer for the next pain event\n        arg_3 = random.randint(arg_0._start_min_delay, arg_0._start_max_delay)\n        arg_0._timer = threading.Timer(arg_3/1000.0, arg_0.event_timeout)\n        arg_0._timer.start()", "path": "blockade/chaos.py", "identifier": "BlockadeChaos._sm_relieve_pain", "docstring": "End the blockade event and return to a steady state", "docstring_tokens": ["End", "the", "blockade", "event", "and", "return", "to", "a", "steady", "state"], "nwo": "worstcase/blockade", "score": 0.7770804820985606, "idx": 259203}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/canvas.py#L72-L75", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Bot must be set before running", "language": "python", "parameters": "(self, bot)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "bot", "=", "arg_1", "arg_0", ".", "sink", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        ''' Bot must be set before running '''\n        arg_0.bot = arg_1\n        arg_0.sink.Func(arg_1)", "path": "shoebot/core/canvas.py", "identifier": "Canvas.set_bot", "docstring": "Bot must be set before running", "docstring_tokens": ["Bot", "must", "be", "set", "before", "running"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259204}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2565-L2580", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a list of all children names", "language": "python", "parameters": "(self)", "return_statement": "return list(self._children.keys())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "(", "arg_0", ".", "_nn_interface", "is", "not", "None", "and", "arg_0", ".", "_nn_interface", ".", "_root_instance", "is", "not", "None", "and", "arg_0", ".", "v_root", ".", "v_auto_load", ")", ":", "try", ":", "if", "arg_0", ".", "v_is_root", ":", "arg_0", ".", "f_load", "(", "recursive", "=", "True", ",", "max_depth", "=", "1", ",", "load_data", "=", "pypetconstants", ".", "LOAD_SKELETON", ",", "with_meta_data", "=", "False", ",", "with_run_information", "=", "False", ")", "else", ":", "arg_0", ".", "f_load", "(", "recursive", "=", "True", ",", "max_depth", "=", "1", ",", "load_data", "=", "pypetconstants", ".", "LOAD_SKELETON", ")", "except", "Exception", "as", "exc", ":", "pass", "return", "list", "(", "arg_0", ".", "_children", ".", "keys", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns a list of all children names\"\"\"\n        if (arg_0._nn_interface is not None and\n                    arg_0._nn_interface._root_instance is not None\n                        and arg_0.v_root.v_auto_load):\n            try:\n                if arg_0.v_is_root:\n                    arg_0.f_load(recursive=True, max_depth=1,\n                                load_data=pypetconstants.LOAD_SKELETON,\n                                with_meta_data=False,\n                                with_run_information=False)\n                else:\n                    arg_0.f_load(recursive=True, max_depth=1, load_data=pypetconstants.LOAD_SKELETON)\n            except Exception as exc:\n                pass\n        return list(arg_0._children.keys())", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_dir_data", "docstring": "Returns a list of all children names", "docstring_tokens": ["Returns", "a", "list", "of", "all", "children", "names"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259205}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L370-L389", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return enterprise customer instance for given user.", "language": "python", "parameters": "(auth_user)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "apps", ".", "get_model", "(", "'enterprise'", ",", "'EnterpriseCustomerUser'", ")", "try", ":", "return", "arg_1", ".", "objects", ".", "get", "(", "user_id", "=", "arg_0", ".", "id", ")", ".", "enterprise_customer", "except", "arg_1", ".", "DoesNotExist", ":", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Return enterprise customer instance for given user.\n\n    Some users are associated with an enterprise customer via `EnterpriseCustomerUser` model,\n        1. if given user is associated with any enterprise customer, return enterprise customer.\n        2. otherwise return `None`.\n\n    Arguments:\n        auth_user (contrib.auth.User): Django User\n\n    Returns:\n        (EnterpriseCustomer): enterprise customer associated with the current user.\n\n    \"\"\"\n    arg_1 = apps.get_model('enterprise', 'EnterpriseCustomerUser')  # pylint: disable=invalid-name\n    try:\n        return arg_1.objects.get(user_id=arg_0.id).enterprise_customer  # pylint: disable=no-member\n    except arg_1.DoesNotExist:\n        return None", "path": "enterprise/utils.py", "identifier": "get_enterprise_customer_for_user", "docstring": "Return enterprise customer instance for given user.\n\n    Some users are associated with an enterprise customer via `EnterpriseCustomerUser` model,\n        1. if given user is associated with any enterprise customer, return enterprise customer.\n        2. otherwise return `None`.\n\n    Arguments:\n        auth_user (contrib.auth.User): Django User\n\n    Returns:\n        (EnterpriseCustomer): enterprise customer associated with the current user.", "docstring_tokens": ["Return", "enterprise", "customer", "instance", "for", "given", "user", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259206}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L381-L414", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Sends a POST request to initialize the live reports", "language": "python", "parameters": "(self, report_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"Sending initial POST request to {} to start report live\"", "\" update\"", ".", "format", "(", "arg_0", ".", "broadcast_address", ")", ")", "try", ":", "with", "open", "(", "\".metadata.json\"", ")", "as", "fh", ":", "arg_2", "=", "[", "json", ".", "load", "(", "fh", ")", "]", "except", ":", "arg_2", "=", "[", "]", "arg_3", "=", "{", "\"data\"", ":", "{", "\"results\"", ":", "arg_2", "}", "}", "try", ":", "requests", ".", "post", "(", "arg_0", ".", "broadcast_address", ",", "json", "=", "{", "\"run_id\"", ":", "arg_1", ",", "\"report_json\"", ":", "arg_3", ",", "\"status\"", ":", "arg_0", ".", "status_info", "}", ")", "except", "requests", ".", "exceptions", ".", "ConnectionError", ":", "logger", ".", "error", "(", "colored_print", "(", "\"ERROR: Could not establish connection with server. The server\"", "\" may be down or there is a problem with your internet \"", "\"connection.\"", ",", "\"red_bold\"", ")", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Sends a POST request to initialize the live reports\n\n        Parameters\n        ----------\n        report_id : str\n            Hash of the report JSON as retrieved from :func:`~_get_report_hash`\n        \"\"\"\n\n        logger.debug(\"Sending initial POST request to {} to start report live\"\n                     \" update\".format(arg_0.broadcast_address))\n\n        try:\n            with open(\".metadata.json\") as fh:\n                arg_2 = [json.load(fh)]\n        except:\n            arg_2 = []\n\n        arg_3 = {\n            \"data\": {\"results\": arg_2}\n        }\n\n        try:\n            requests.post(\n                arg_0.broadcast_address,\n                json={\"run_id\": arg_1, \"report_json\": arg_3,\n                      \"status\": arg_0.status_info}\n            )\n        except requests.exceptions.ConnectionError:\n            logger.error(colored_print(\n                \"ERROR: Could not establish connection with server. The server\"\n                \" may be down or there is a problem with your internet \"\n                \"connection.\", \"red_bold\"))\n            sys.exit(1)", "path": "flowcraft/generator/report.py", "identifier": "FlowcraftReport._init_live_reports", "docstring": "Sends a POST request to initialize the live reports\n\n        Parameters\n        ----------\n        report_id : str\n            Hash of the report JSON as retrieved from :func:`~_get_report_hash`", "docstring_tokens": ["Sends", "a", "POST", "request", "to", "initialize", "the", "live", "reports"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 259207}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/base_predictor.py#L103-L133", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "If peptide lengths not specified, then try using the default\n        lengths associated with this predictor object. If those aren't\n        a valid non-empty sequence of integers, then raise an exception.\n        Otherwise return the peptide lengths.", "language": "python", "parameters": "(self, peptide_lengths=None)", "return_statement": "return peptide_lengths", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "default_peptide_lengths", "if", "not", "arg_1", ":", "raise", "ValueError", "(", "(", "\"Must either provide 'peptide_lengths' argument \"", "\"or set 'default_peptide_lengths\"", ")", ")", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "arg_1", "=", "[", "arg_1", "]", "require_iterable_of", "(", "arg_1", ",", "int", ")", "for", "arg_2", "in", "arg_1", ":", "if", "(", "arg_0", ".", "min_peptide_length", "is", "not", "None", "and", "arg_2", "<", "arg_0", ".", "min_peptide_length", ")", ":", "raise", "ValueError", "(", "\"Invalid peptide length %d, shorter than min %d\"", "%", "(", "arg_2", ",", "arg_0", ".", "min_peptide_length", ")", ")", "elif", "(", "arg_0", ".", "max_peptide_length", "is", "not", "None", "and", "arg_2", ">", "arg_0", ".", "max_peptide_length", ")", ":", "raise", "ValueError", "(", "\"Invalid peptide length %d, longer than max %d\"", "%", "(", "arg_2", ",", "arg_0", ".", "max_peptide_length", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        If peptide lengths not specified, then try using the default\n        lengths associated with this predictor object. If those aren't\n        a valid non-empty sequence of integers, then raise an exception.\n        Otherwise return the peptide lengths.\n        \"\"\"\n        if not arg_1:\n            arg_1 = arg_0.default_peptide_lengths\n\n        if not arg_1:\n            raise ValueError(\n                (\"Must either provide 'peptide_lengths' argument \"\n                \"or set 'default_peptide_lengths\"))\n        if isinstance(arg_1, int):\n            arg_1 = [arg_1]\n        require_iterable_of(arg_1, int)\n        for arg_2 in arg_1:\n            if (arg_0.min_peptide_length is not None and\n                    arg_2 < arg_0.min_peptide_length):\n                raise ValueError(\n                    \"Invalid peptide length %d, shorter than min %d\" % (\n                        arg_2,\n                        arg_0.min_peptide_length))\n            elif (arg_0.max_peptide_length is not None and\n                    arg_2 > arg_0.max_peptide_length):\n                raise ValueError(\n                    \"Invalid peptide length %d, longer than max %d\" % (\n                        arg_2,\n                        arg_0.max_peptide_length))\n        return arg_1", "path": "mhctools/base_predictor.py", "identifier": "BasePredictor._check_peptide_lengths", "docstring": "If peptide lengths not specified, then try using the default\n        lengths associated with this predictor object. If those aren't\n        a valid non-empty sequence of integers, then raise an exception.\n        Otherwise return the peptide lengths.", "docstring_tokens": ["If", "peptide", "lengths", "not", "specified", "then", "try", "using", "the", "default", "lengths", "associated", "with", "this", "predictor", "object", ".", "If", "those", "aren", "t", "a", "valid", "non", "-", "empty", "sequence", "of", "integers", "then", "raise", "an", "exception", ".", "Otherwise", "return", "the", "peptide", "lengths", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 259208}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/model/profiles/light_profiles.py#L315-L327", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Calculate the intensity of the Sersic light profile on a grid of radial coordinates.", "language": "python", "parameters": "(self, grid_radii)", "return_statement": "return np.multiply(self.intensity, np.exp(\n            np.multiply(-self.sersic_constant,\n                        np.add(np.power(np.divide(grid_radii, self.effective_radius), 1. / self.sersic_index), -1))))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "np", ".", "seterr", "(", "all", "=", "'ignore'", ")", "return", "np", ".", "multiply", "(", "arg_0", ".", "intensity", ",", "np", ".", "exp", "(", "np", ".", "multiply", "(", "-", "arg_0", ".", "sersic_constant", ",", "np", ".", "add", "(", "np", ".", "power", "(", "np", ".", "divide", "(", "arg_1", ",", "arg_0", ".", "effective_radius", ")", ",", "1.", "/", "arg_0", ".", "sersic_index", ")", ",", "-", "1", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Calculate the intensity of the Sersic light profile on a grid of radial coordinates.\n\n        Parameters\n        ----------\n        grid_radii : float\n            The radial distance from the centre of the profile. for each coordinate on the grid.\n        \"\"\"\n        np.seterr(all='ignore')\n        return np.multiply(arg_0.intensity, np.exp(\n            np.multiply(-arg_0.sersic_constant,\n                        np.add(np.power(np.divide(arg_1, arg_0.effective_radius), 1. / arg_0.sersic_index), -1))))", "path": "autolens/model/profiles/light_profiles.py", "identifier": "EllipticalSersic.intensities_from_grid_radii", "docstring": "Calculate the intensity of the Sersic light profile on a grid of radial coordinates.\n\n        Parameters\n        ----------\n        grid_radii : float\n            The radial distance from the centre of the profile. for each coordinate on the grid.", "docstring_tokens": ["Calculate", "the", "intensity", "of", "the", "Sersic", "light", "profile", "on", "a", "grid", "of", "radial", "coordinates", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 259209}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L765-L778", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert this polygon's `exterior` to ``Keypoint`` instances.", "language": "python", "parameters": "(self)", "return_statement": "return [Keypoint(x=point[0], y=point[1]) for point in self.exterior]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "imgaug", ".", "augmentables", ".", "kps", "import", "Keypoint", "return", "[", "Keypoint", "(", "x", "=", "arg_1", "[", "0", "]", ",", "y", "=", "arg_1", "[", "1", "]", ")", "for", "arg_1", "in", "arg_0", ".", "exterior", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Convert this polygon's `exterior` to ``Keypoint`` instances.\n\n        Returns\n        -------\n        list of imgaug.Keypoint\n            Exterior vertices as ``Keypoint`` instances.\n\n        \"\"\"\n        # TODO get rid of this deferred import\n        from imgaug.augmentables.kps import Keypoint\n\n        return [Keypoint(x=arg_1[0], y=arg_1[1]) for arg_1 in arg_0.exterior]", "path": "imgaug/augmentables/polys.py", "identifier": "Polygon.to_keypoints", "docstring": "Convert this polygon's `exterior` to ``Keypoint`` instances.\n\n        Returns\n        -------\n        list of imgaug.Keypoint\n            Exterior vertices as ``Keypoint`` instances.", "docstring_tokens": ["Convert", "this", "polygon", "s", "exterior", "to", "Keypoint", "instances", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259210}
{"url": "https://github.com/gmarull/asyncqt/blob/292e42c0bf799e5aeee099ee2cec27a810b01870/asyncqt/__init__.py#L627-L635", "sha": "292e42c0bf799e5aeee099ee2cec27a810b01870", "docstring_summary": "Allow to run async code before application is closed.", "language": "python", "parameters": "(fn)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "asyncio", ".", "ensure_future", "(", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", ")", "while", "not", "arg_3", ".", "done", "(", ")", ":", "QApplication", ".", "instance", "(", ")", ".", "processEvents", "(", ")", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Allow to run async code before application is closed.\"\"\"\n    @functools.wraps(arg_0)\n    def wrapper(*arg_1, **arg_2):\n        arg_3 = asyncio.ensure_future(arg_0(*arg_1, **arg_2))\n        while not arg_3.done():\n            QApplication.instance().processEvents()\n\n    return wrapper", "path": "asyncqt/__init__.py", "identifier": "asyncClose", "docstring": "Allow to run async code before application is closed.", "docstring_tokens": ["Allow", "to", "run", "async", "code", "before", "application", "is", "closed", "."], "nwo": "gmarull/asyncqt", "score": 0.7362303753474546, "idx": 259211}
{"url": "https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_upload.py#L19-L60", "sha": "3bedf2a454aee39214c11fbf556ead3eecc27881", "docstring_summary": "Given a file-like object containing a JSON stream, upload it to\n    Luminoso with the given account name and project name.", "language": "python", "parameters": "(stream, server, account, projname, language=None,\n                  username=None, password=None,\n                  append=False, stage=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "False", ")", ":", "arg_9", "=", "LuminosoClient", ".", "connect", "(", "arg_1", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "if", "not", "arg_7", ":", "arg_10", "=", "arg_9", ".", "post", "(", "'/projects/'", "+", "arg_2", ",", "name", "=", "arg_3", ")", "arg_11", "=", "arg_10", "[", "'project_id'", "]", "print", "(", "'New project ID:'", ",", "arg_11", ")", "else", ":", "arg_12", "=", "arg_9", ".", "get", "(", "'/projects/'", "+", "arg_2", ",", "name", "=", "arg_3", ")", "if", "len", "(", "arg_12", ")", "==", "0", ":", "print", "(", "'No such project exists!'", ")", "return", "if", "len", "(", "arg_12", ")", ">", "1", ":", "print", "(", "'Warning: Multiple projects with name \"%s\".  '", "%", "arg_3", ",", "end", "=", "''", ")", "arg_11", "=", "arg_12", "[", "0", "]", "[", "'project_id'", "]", "print", "(", "'Using existing project with id %s.'", "%", "arg_11", ")", "arg_13", "=", "arg_9", ".", "change_path", "(", "'/projects/'", "+", "arg_2", "+", "'/'", "+", "arg_11", ")", "arg_14", "=", "0", "for", "arg_15", "in", "batches", "(", "arg_0", ",", "1000", ")", ":", "arg_14", "+=", "1", "arg_16", "=", "list", "(", "arg_15", ")", "arg_13", ".", "upload", "(", "'docs'", ",", "arg_16", ")", "print", "(", "'Uploaded batch #%d'", "%", "(", "arg_14", ")", ")", "if", "not", "arg_8", ":", "print", "(", "'Calculating.'", ")", "arg_17", "=", "{", "}", "if", "arg_4", "is", "not", "None", ":", "arg_17", "=", "{", "'language'", ":", "arg_4", "}", "arg_18", "=", "arg_13", ".", "post", "(", "'docs/recalculate'", ",", "**", "arg_17", ")", "arg_13", ".", "wait_for", "(", "arg_18", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None,\n                  arg_5=None, arg_6=None,\n                  arg_7=False, arg_8=False):\n    \"\"\"\n    Given a file-like object containing a JSON stream, upload it to\n    Luminoso with the given account name and project name.\n    \"\"\"\n    arg_9 = LuminosoClient.connect(arg_1,\n                                    arg_5=arg_5, arg_6=arg_6)\n    if not arg_7:\n        # If we're not appending to an existing project, create new project.\n        arg_10 = arg_9.post('/projects/' + arg_2, name=arg_3)\n        arg_11 = arg_10['project_id']\n        print('New project ID:', arg_11)\n    else:\n        arg_12 = arg_9.get('/projects/' + arg_2, name=arg_3)\n        if len(arg_12) == 0:\n            print('No such project exists!')\n            return\n        if len(arg_12) > 1:\n            print('Warning: Multiple projects with name \"%s\".  ' % arg_3,\n                  end='')\n        arg_11 = arg_12[0]['project_id']\n        print('Using existing project with id %s.' % arg_11)\n\n    arg_13 = arg_9.change_path('/projects/' + arg_2 + '/' + arg_11)\n\n    arg_14 = 0\n    for arg_15 in batches(arg_0, 1000):\n        arg_14 += 1\n        arg_16 = list(arg_15)\n        arg_13.upload('docs', arg_16)\n        print('Uploaded batch #%d' % (arg_14))\n\n    if not arg_8:\n        # Calculate the docs into the assoc space.\n        print('Calculating.')\n        arg_17 = {}\n        if arg_4 is not None:\n            arg_17 = {'language': arg_4}\n        arg_18 = arg_13.post('docs/recalculate', **arg_17)\n        arg_13.wait_for(arg_18)", "path": "luminoso_api/v4_upload.py", "identifier": "upload_stream", "docstring": "Given a file-like object containing a JSON stream, upload it to\n    Luminoso with the given account name and project name.", "docstring_tokens": ["Given", "a", "file", "-", "like", "object", "containing", "a", "JSON", "stream", "upload", "it", "to", "Luminoso", "with", "the", "given", "account", "name", "and", "project", "name", "."], "nwo": "LuminosoInsight/luminoso-api-client-python", "score": 0.568966879505561, "idx": 259212}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/frequency.py#L2-L95", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Add the frequencies to a variant", "language": "python", "parameters": "(variant, transcripts)", "return_statement": "return frequencies", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "[", "'1000GAF'", "]", "arg_4", "=", "[", "'1000G_MAX_AF'", "]", "arg_5", "=", "[", "'EXACAF'", "]", "arg_6", "=", "[", "'ExAC_MAX_AF'", ",", "'EXAC_MAX_AF'", "]", "arg_7", "=", "[", "'GNOMADAF'", ",", "'GNOMAD_AF'", "]", "arg_8", "=", "[", "'GNOMADAF_POPMAX'", ",", "'GNOMADAF_MAX'", "]", "for", "arg_9", "in", "arg_3", ":", "arg_10", "=", "parse_frequency", "(", "arg_0", ",", "arg_9", ")", "if", "arg_10", ":", "arg_2", "[", "'thousand_g'", "]", "=", "arg_10", "break", "for", "arg_9", "in", "arg_4", ":", "arg_11", "=", "parse_frequency", "(", "arg_0", ",", "arg_9", ")", "if", "arg_11", ":", "arg_2", "[", "'thousand_g_max'", "]", "=", "arg_11", "break", "for", "arg_9", "in", "arg_5", ":", "arg_12", "=", "parse_frequency", "(", "arg_0", ",", "arg_9", ")", "if", "arg_12", ":", "arg_2", "[", "'exac'", "]", "=", "arg_12", "break", "for", "arg_9", "in", "arg_6", ":", "arg_13", "=", "parse_frequency", "(", "arg_0", ",", "arg_9", ")", "if", "arg_13", ":", "arg_2", "[", "'exac_max'", "]", "=", "arg_13", "break", "for", "arg_9", "in", "arg_7", ":", "arg_14", "=", "parse_frequency", "(", "arg_0", ",", "arg_9", ")", "if", "arg_14", ":", "arg_2", "[", "'gnomad'", "]", "=", "arg_14", "break", "for", "arg_9", "in", "arg_8", ":", "arg_15", "=", "parse_frequency", "(", "arg_0", ",", "arg_9", ")", "if", "arg_15", ":", "arg_2", "[", "'gnomad_max'", "]", "=", "arg_15", "break", "if", "not", "arg_2", ":", "for", "arg_16", "in", "arg_1", ":", "arg_12", "=", "arg_16", ".", "get", "(", "'exac_maf'", ")", "arg_13", "=", "arg_16", ".", "get", "(", "'exac_max'", ")", "arg_10", "=", "arg_16", ".", "get", "(", "'thousand_g_maf'", ")", "arg_17", "=", "arg_16", ".", "get", "(", "'thousandg_max'", ")", "arg_14", "=", "arg_16", ".", "get", "(", "'gnomad_maf'", ")", "arg_15", "=", "arg_16", ".", "get", "(", "'gnomad_max'", ")", "if", "arg_12", ":", "arg_2", "[", "'exac'", "]", "=", "arg_12", "if", "arg_13", ":", "arg_2", "[", "'exac_max'", "]", "=", "arg_13", "if", "arg_10", ":", "arg_2", "[", "'thousand_g'", "]", "=", "arg_10", "if", "arg_17", ":", "arg_2", "[", "'thousand_g_max'", "]", "=", "arg_17", "if", "arg_14", ":", "arg_2", "[", "'gnomad'", "]", "=", "arg_14", "if", "arg_15", ":", "arg_2", "[", "'gnomad_max'", "]", "=", "arg_15", "arg_18", "=", "parse_frequency", "(", "arg_0", ",", "'left_1000GAF'", ")", "if", "arg_18", ":", "arg_2", "[", "'thousand_g_left'", "]", "=", "arg_18", "arg_19", "=", "parse_frequency", "(", "arg_0", ",", "'right_1000GAF'", ")", "if", "arg_19", ":", "arg_2", "[", "'thousand_g_right'", "]", "=", "arg_19", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Add the frequencies to a variant\n\n    Frequencies are parsed either directly from keys in info fieds or from the\n    transcripts is they are annotated there.\n\n    Args:\n        variant(cyvcf2.Variant): A parsed vcf variant\n        transcripts(iterable(dict)): Parsed transcripts\n\n    Returns:\n        frequencies(dict): A dictionary with the relevant frequencies\n    \"\"\"\n    arg_2 = {}\n    # These lists could be extended...\n    arg_3 = ['1000GAF']\n    arg_4 = ['1000G_MAX_AF']\n\n    arg_5 = ['EXACAF']\n    arg_6 = ['ExAC_MAX_AF', 'EXAC_MAX_AF']\n\n    arg_7 = ['GNOMADAF', 'GNOMAD_AF']\n    arg_8 = ['GNOMADAF_POPMAX', 'GNOMADAF_MAX']\n\n    for arg_9 in arg_3:\n        arg_10 = parse_frequency(arg_0, arg_9)\n        if arg_10:\n            arg_2['thousand_g'] = arg_10\n            break\n\n    for arg_9 in arg_4:\n        arg_11 = parse_frequency(arg_0, arg_9)\n        if arg_11:\n            arg_2['thousand_g_max'] = arg_11\n            break\n\n    for arg_9 in arg_5:\n        arg_12 = parse_frequency(arg_0, arg_9)\n        if arg_12:\n            arg_2['exac'] = arg_12\n            break\n\n    for arg_9 in arg_6:\n        arg_13 = parse_frequency(arg_0, arg_9)\n        if arg_13:\n            arg_2['exac_max'] = arg_13\n            break\n\n    for arg_9 in arg_7:\n        arg_14 = parse_frequency(arg_0, arg_9)\n        if arg_14:\n            arg_2['gnomad'] = arg_14\n            break\n\n    for arg_9 in arg_8:\n        arg_15 = parse_frequency(arg_0, arg_9)\n        if arg_15:\n            arg_2['gnomad_max'] = arg_15\n            break\n\n    # Search transcripts if not found in VCF\n    if not arg_2:\n        for arg_16 in arg_1:\n            arg_12 = arg_16.get('exac_maf')\n            arg_13 = arg_16.get('exac_max')\n\n            arg_10 = arg_16.get('thousand_g_maf')\n            arg_17 = arg_16.get('thousandg_max')\n\n            arg_14 = arg_16.get('gnomad_maf')\n            arg_15 = arg_16.get('gnomad_max')\n            if arg_12:\n                arg_2['exac'] = arg_12\n            if arg_13:\n                arg_2['exac_max'] = arg_13\n            if arg_10:\n                arg_2['thousand_g'] = arg_10\n            if arg_17:\n                arg_2['thousand_g_max'] = arg_17\n            if arg_14:\n                arg_2['gnomad'] = arg_14\n            if arg_15:\n                arg_2['gnomad_max'] = arg_15\n\n    #These are SV-specific frequencies\n    arg_18 = parse_frequency(arg_0, 'left_1000GAF')\n    if arg_18:\n        arg_2['thousand_g_left'] = arg_18\n\n    arg_19 = parse_frequency(arg_0, 'right_1000GAF')\n    if arg_19:\n        arg_2['thousand_g_right'] = arg_19\n\n    return arg_2", "path": "scout/parse/variant/frequency.py", "identifier": "parse_frequencies", "docstring": "Add the frequencies to a variant\n\n    Frequencies are parsed either directly from keys in info fieds or from the\n    transcripts is they are annotated there.\n\n    Args:\n        variant(cyvcf2.Variant): A parsed vcf variant\n        transcripts(iterable(dict)): Parsed transcripts\n\n    Returns:\n        frequencies(dict): A dictionary with the relevant frequencies", "docstring_tokens": ["Add", "the", "frequencies", "to", "a", "variant"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259213}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/templates.py#L91-L109", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Update the name, HTML, or folder_id of an existing template.", "language": "python", "parameters": "(self, template_id, data)", "return_statement": "return self._mc_client._patch(url=self._build_path(template_id), data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "'name'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The template must have a name'", ")", "if", "'html'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The template must have html'", ")", "arg_0", ".", "template_id", "=", "arg_1", "return", "arg_0", ".", "_mc_client", ".", "_patch", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Update the name, HTML, or folder_id of an existing template.\n\n        :param template_id: The unique id for the template.\n        :type template_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"html\": string*\n        }\n        \"\"\"\n        if 'name' not in arg_2:\n            raise KeyError('The template must have a name')\n        if 'html' not in arg_2:\n            raise KeyError('The template must have html')\n        arg_0.template_id = arg_1\n        return arg_0._mc_client._patch(url=arg_0._build_path(arg_1), arg_2=arg_2)", "path": "mailchimp3/entities/templates.py", "identifier": "Templates.update", "docstring": "Update the name, HTML, or folder_id of an existing template.\n\n        :param template_id: The unique id for the template.\n        :type template_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"html\": string*\n        }", "docstring_tokens": ["Update", "the", "name", "HTML", "or", "folder_id", "of", "an", "existing", "template", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 259214}
{"url": "https://github.com/spotify/pyschema/blob/7e6c3934150bcb040c628d74ace6caf5fcf867df/pyschema/core.py#L152-L164", "sha": "7e6c3934150bcb040c628d74ace6caf5fcf867df", "docstring_summary": "Will return a matching record or raise KeyError is no record is found.", "language": "python", "parameters": "(self, record_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_schema_map", ":", "return", "arg_0", ".", "_schema_map", "[", "arg_1", "]", "else", ":", "arg_2", "=", "arg_1", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "return", "arg_0", ".", "_schema_map", "[", "arg_2", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Will return a matching record or raise KeyError is no record is found.\n\n        If the record name is a full name we will first check for a record matching the full name.\n        If no such record is found any record matching the last part of the full name (without the namespace) will\n        be returned.\n        \"\"\"\n        if arg_1 in arg_0._schema_map:\n            return arg_0._schema_map[arg_1]\n        else:\n            arg_2 = arg_1.split('.')[-1]\n            return arg_0._schema_map[arg_2]", "path": "pyschema/core.py", "identifier": "SchemaStore.get", "docstring": "Will return a matching record or raise KeyError is no record is found.\n\n        If the record name is a full name we will first check for a record matching the full name.\n        If no such record is found any record matching the last part of the full name (without the namespace) will\n        be returned.", "docstring_tokens": ["Will", "return", "a", "matching", "record", "or", "raise", "KeyError", "is", "no", "record", "is", "found", "."], "nwo": "spotify/pyschema", "score": 0.41017317071999654, "idx": 259215}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/blp.py#L30-L72", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Bloomberg reference data", "language": "python", "parameters": "(tickers, flds, **kwargs)", "return_statement": "return qry_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "logs", ".", "get_logger", "(", "Func", ",", "level", "=", "arg_2", ".", "pop", "(", "'log'", ",", "logs", ".", "LOG_LEVEL", ")", ")", "arg_4", ",", "arg_5", "=", "create_connection", "(", ")", "arg_6", "=", "assist", ".", "proc_ovrds", "(", "**", "arg_2", ")", "arg_3", ".", "info", "(", "f'loading reference data from Bloomberg:\\n'", "f'{assist.info_qry(tickers=tickers, flds=flds)}'", ")", "arg_7", "=", "arg_4", ".", "ref", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_6", "=", "arg_6", ")", "if", "not", "arg_2", ".", "get", "(", "'cache'", ",", "False", ")", ":", "return", "[", "arg_7", "]", "arg_8", "=", "[", "]", "for", "arg_9", ",", "arg_10", "in", "arg_7", ".", "iterrows", "(", ")", ":", "arg_11", "=", "[", "arg_9", "]", "arg_12", "=", "storage", ".", "ref_file", "(", "ticker", "=", "arg_10", ".", "ticker", ",", "fld", "=", "arg_10", ".", "field", ",", "ext", "=", "'pkl'", ",", "**", "arg_2", ")", "if", "arg_12", ":", "if", "not", "files", ".", "exists", "(", "arg_12", ")", ":", "arg_8", ".", "append", "(", "arg_7", ".", "iloc", "[", "arg_11", "]", ")", "files", ".", "create_folder", "(", "arg_12", ",", "is_file", "=", "True", ")", "arg_7", ".", "iloc", "[", "arg_11", "]", ".", "to_pickle", "(", "arg_12", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"\n    Bloomberg reference data\n\n    Args:\n        tickers: tickers\n        flds: fields to query\n        **kwargs: bbg overrides\n\n    Returns:\n        pd.DataFrame\n\n    Examples:\n        >>> Func('IQ US Equity', 'Crncy', raw=True)\n                 ticker  field value\n        0  IQ US Equity  Crncy   USD\n        >>> Func('IQ US Equity', 'Crncy').reset_index()\n                 ticker crncy\n        0  IQ US Equity   USD\n    \"\"\"\n    arg_3 = logs.get_logger(Func, level=arg_2.pop('log', logs.LOG_LEVEL))\n    arg_4, arg_5 = create_connection()\n    arg_6 = assist.proc_ovrds(**arg_2)\n\n    arg_3.info(\n        f'loading reference data from Bloomberg:\\n'\n        f'{assist.info_qry(tickers=tickers, flds=flds)}'\n    )\n    arg_7 = arg_4.ref(arg_0=arg_0, arg_1=arg_1, arg_6=arg_6)\n    if not arg_2.get('cache', False): return [arg_7]\n\n    arg_8 = []\n    for arg_9, arg_10 in arg_7.iterrows():\n        arg_11 = [arg_9]\n        arg_12 = storage.ref_file(\n            ticker=arg_10.ticker, fld=arg_10.field, ext='pkl', **arg_2\n        )\n        if arg_12:\n            if not files.exists(arg_12): arg_8.append(arg_7.iloc[arg_11])\n            files.create_folder(arg_12, is_file=True)\n            arg_7.iloc[arg_11].to_pickle(arg_12)\n\n    return arg_8", "path": "xbbg/blp.py", "identifier": "bdp", "docstring": "Bloomberg reference data\n\n    Args:\n        tickers: tickers\n        flds: fields to query\n        **kwargs: bbg overrides\n\n    Returns:\n        pd.DataFrame\n\n    Examples:\n        >>> bdp('IQ US Equity', 'Crncy', raw=True)\n                 ticker  field value\n        0  IQ US Equity  Crncy   USD\n        >>> bdp('IQ US Equity', 'Crncy').reset_index()\n                 ticker crncy\n        0  IQ US Equity   USD", "docstring_tokens": ["Bloomberg", "reference", "data"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 259216}
{"url": "https://github.com/schlitzered/pep3143daemon/blob/de392a5fd046a88d13ace21b8053ff558a27ff90/pep3143daemon/daemon.py#L184-L195", "sha": "de392a5fd046a88d13ace21b8053ff558a27ff90", "docstring_summary": "Create the signal handler map", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "signal_map", ".", "items", "(", ")", ":", "arg_1", "[", "arg_2", "]", "=", "arg_0", ".", "_get_signal_handler", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Create the signal handler map\n\n        create a dictionary with signal:handler mapping based on\n        self.signal_map\n\n        :return: dict\n        \"\"\"\n        arg_1 = {}\n        for arg_2, arg_3 in arg_0.signal_map.items():\n            arg_1[arg_2] = arg_0._get_signal_handler(arg_3)\n        return arg_1", "path": "pep3143daemon/daemon.py", "identifier": "DaemonContext._signal_handler_map", "docstring": "Create the signal handler map\n\n        create a dictionary with signal:handler mapping based on\n        self.signal_map\n\n        :return: dict", "docstring_tokens": ["Create", "the", "signal", "handler", "map"], "nwo": "schlitzered/pep3143daemon", "score": 0.36495594146284627, "idx": 259217}
{"url": "https://github.com/agabrown/PyGaia/blob/ae972b0622a15f713ffae471f925eac25ccdae47/pygaia/errors/photometric.py#L20-L36", "sha": "ae972b0622a15f713ffae471f925eac25ccdae47", "docstring_summary": "Calculate the single-field-of-view-transit photometric standard error in the G band as a function\n  of G. A 20% margin is included.", "language": "python", "parameters": "(G)", "return_statement": "return 1.0e-3*sqrt(0.04895*z*z + 1.8633*z + 0.0001985) * _scienceMargin", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "calcZ", "(", "arg_0", ")", "return", "1.0e-3", "*", "sqrt", "(", "0.04895", "*", "arg_1", "*", "arg_1", "+", "1.8633", "*", "arg_1", "+", "0.0001985", ")", "*", "_scienceMargin"], "function": "def Func(arg_0):\n  \"\"\"\n  Calculate the single-field-of-view-transit photometric standard error in the G band as a function\n  of G. A 20% margin is included.\n\n  Parameters\n  ----------\n\n  G     - Value(s) of G-band magnitude.\n\n  Returns\n  -------\n\n  The G band photometric standard error in units of magnitude.\n  \"\"\"\n  arg_1=calcZ(arg_0)\n  return 1.0e-3*sqrt(0.04895*arg_1*arg_1 + 1.8633*arg_1 + 0.0001985) * _scienceMargin", "path": "pygaia/errors/photometric.py", "identifier": "gMagnitudeError", "docstring": "Calculate the single-field-of-view-transit photometric standard error in the G band as a function\n  of G. A 20% margin is included.\n\n  Parameters\n  ----------\n\n  G     - Value(s) of G-band magnitude.\n\n  Returns\n  -------\n\n  The G band photometric standard error in units of magnitude.", "docstring_tokens": ["Calculate", "the", "single", "-", "field", "-", "of", "-", "view", "-", "transit", "photometric", "standard", "error", "in", "the", "G", "band", "as", "a", "function", "of", "G", ".", "A", "20%", "margin", "is", "included", "."], "nwo": "agabrown/PyGaia", "score": 0.39410601089411446, "idx": 259218}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/cg.py#L2-L34", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Demmel p 312", "language": "python", "parameters": "(f_Ax, b, cg_iters=10, callback=None, verbose=False, residual_tol=1e-10)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "10", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "1e-10", ")", ":", "arg_6", "=", "arg_1", ".", "copy", "(", ")", "arg_7", "=", "arg_1", ".", "copy", "(", ")", "arg_8", "=", "np", ".", "zeros_like", "(", "arg_1", ")", "arg_9", "=", "arg_7", ".", "dot", "(", "arg_7", ")", "arg_10", "=", "\"%10i %10.3g %10.3g\"", "arg_11", "=", "\"%10s %10s %10s\"", "if", "arg_4", ":", "print", "(", "arg_11", "%", "(", "\"iter\"", ",", "\"residual norm\"", ",", "\"soln norm\"", ")", ")", "for", "arg_12", "in", "range", "(", "arg_2", ")", ":", "if", "arg_3", "is", "not", "None", ":", "arg_3", "(", "arg_8", ")", "if", "arg_4", ":", "print", "(", "arg_10", "%", "(", "arg_12", ",", "arg_9", ",", "np", ".", "linalg", ".", "norm", "(", "arg_8", ")", ")", ")", "arg_13", "=", "arg_0", "(", "arg_6", ")", "arg_14", "=", "arg_9", "/", "arg_6", ".", "dot", "(", "arg_13", ")", "arg_8", "+=", "arg_14", "*", "arg_6", "arg_7", "-=", "arg_14", "*", "arg_13", "arg_15", "=", "arg_7", ".", "dot", "(", "arg_7", ")", "arg_16", "=", "arg_15", "/", "arg_9", "arg_6", "=", "arg_7", "+", "arg_16", "*", "arg_6", "arg_9", "=", "arg_15", "if", "arg_9", "<", "arg_5", ":", "break", "if", "arg_3", "is", "not", "None", ":", "arg_3", "(", "arg_8", ")", "if", "arg_4", ":", "print", "(", "arg_10", "%", "(", "arg_12", "+", "1", ",", "arg_9", ",", "np", ".", "linalg", ".", "norm", "(", "arg_8", ")", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=10, arg_3=None, arg_4=False, arg_5=1e-10):\n    \"\"\"\n    Demmel p 312\n    \"\"\"\n    arg_6 = arg_1.copy()\n    arg_7 = arg_1.copy()\n    arg_8 = np.zeros_like(arg_1)\n    arg_9 = arg_7.dot(arg_7)\n\n    arg_10 =  \"%10i %10.3g %10.3g\"\n    arg_11 =  \"%10s %10s %10s\"\n    if arg_4: print(arg_11 % (\"iter\", \"residual norm\", \"soln norm\"))\n\n    for arg_12 in range(arg_2):\n        if arg_3 is not None:\n            arg_3(arg_8)\n        if arg_4: print(arg_10 % (arg_12, arg_9, np.linalg.norm(arg_8)))\n        arg_13 = arg_0(arg_6)\n        arg_14 = arg_9 / arg_6.dot(arg_13)\n        arg_8 += arg_14*arg_6\n        arg_7 -= arg_14*arg_13\n        arg_15 = arg_7.dot(arg_7)\n        arg_16 = arg_15/arg_9\n        arg_6 = arg_7 + arg_16*arg_6\n\n        arg_9 = arg_15\n        if arg_9 < arg_5:\n            break\n\n    if arg_3 is not None:\n        arg_3(arg_8)\n    if arg_4: print(arg_10 % (arg_12+1, arg_9, np.linalg.norm(arg_8)))  # pylint: disable=W0631\n    return arg_8", "path": "baselines/common/cg.py", "identifier": "cg", "docstring": "Demmel p 312", "docstring_tokens": ["Demmel", "p", "312"], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 259219}
{"url": "https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L372-L389", "sha": "86dc1ab27ce82dcc091ce127416cc3ee219e9bec", "docstring_summary": "Parses ed25516 keys.", "language": "python", "parameters": "(self, data)", "return_statement": "return current_position", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "_unpack_by_int", "(", "arg_1", ",", "0", ")", "arg_4", "=", "len", "(", "arg_3", ")", "*", "8", "arg_3", "=", "arg_0", ".", "_parse_long", "(", "arg_3", ")", "if", "arg_3", "<", "0", ":", "raise", "InvalidKeyError", "(", "\"ed25519 verifying key must be >0.\"", ")", "arg_0", ".", "bits", "=", "arg_4", "if", "arg_0", ".", "bits", "!=", "256", ":", "raise", "InvalidKeyLengthError", "(", "\"ed25519 keys must be 256 bits (was %s bits)\"", "%", "arg_0", ".", "bits", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses ed25516 keys.\n\n        There is no (apparent) way to validate ed25519 keys. This only\n        checks data length (256 bits), but does not try to validate\n        the key in any way.\"\"\"\n\n        arg_2, arg_3 = arg_0._unpack_by_int(arg_1, 0)\n        arg_4 = len(arg_3) * 8\n        arg_3 = arg_0._parse_long(arg_3)\n\n        if arg_3 < 0:\n            raise InvalidKeyError(\"ed25519 verifying key must be >0.\")\n\n        arg_0.bits = arg_4\n        if arg_0.bits != 256:\n            raise InvalidKeyLengthError(\"ed25519 keys must be 256 bits (was %s bits)\" % arg_0.bits)\n        return arg_2", "path": "sshpubkeys/keys.py", "identifier": "SSHKey._process_ed25516", "docstring": "Parses ed25516 keys.\n\n        There is no (apparent) way to validate ed25519 keys. This only\n        checks data length (256 bits), but does not try to validate\n        the key in any way.", "docstring_tokens": ["Parses", "ed25516", "keys", "."], "nwo": "ojarva/python-sshpubkeys", "score": 0.19584428074165744, "idx": 259220}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L561-L583", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Reads and parses the configuration file.", "language": "python", "parameters": "(filename=CONFIGNAME)", "return_statement": "return cfg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ")", ":", "global", "arg_2", ",", "arg_3", "arg_2", "=", "GMXConfigParser", "(", "arg_0", "=", "arg_0", ")", "globals", "(", ")", ".", "update", "(", "arg_2", ".", "configuration", ")", "arg_3", "=", "arg_2", ".", "configuration", "return", "arg_2"], "function": "def Func(arg_0=arg_1):\n    \"\"\"Reads and parses the configuration file.\n\n    Default values are loaded and then replaced with the values from\n    ``~/.gromacswrapper.cfg`` if that file exists. The global\n    configuration instance :data:`gromacswrapper.config.cfg` is updated\n    as are a number of global variables such as :data:`configdir`,\n    :data:`qscriptdir`, :data:`templatesdir`, :data:`logfilename`, ...\n\n    Normally, the configuration is only loaded when the :mod:`gromacs`\n    package is imported but a re-reading of the configuration can be forced\n    anytime by calling :func:`Func`.\n\n    :Returns: a dict with all updated global configuration variables\n    \"\"\"\n    global arg_2, arg_3    # very iffy --- most of the whole config mod should a class\n\n    #: :data:`cfg` is the instance of :class:`GMXConfigParser` that makes all\n    #: global configuration data accessible\n    arg_2 = GMXConfigParser(arg_0=arg_0)   # update module-level cfg\n    globals().update(arg_2.configuration)        # update configdir, templatesdir ...\n    arg_3 = arg_2.configuration          # update module-level configuration\n    return arg_2", "path": "gromacs/config.py", "identifier": "get_configuration", "docstring": "Reads and parses the configuration file.\n\n    Default values are loaded and then replaced with the values from\n    ``~/.gromacswrapper.cfg`` if that file exists. The global\n    configuration instance :data:`gromacswrapper.config.cfg` is updated\n    as are a number of global variables such as :data:`configdir`,\n    :data:`qscriptdir`, :data:`templatesdir`, :data:`logfilename`, ...\n\n    Normally, the configuration is only loaded when the :mod:`gromacs`\n    package is imported but a re-reading of the configuration can be forced\n    anytime by calling :func:`get_configuration`.\n\n    :Returns: a dict with all updated global configuration variables", "docstring_tokens": ["Reads", "and", "parses", "the", "configuration", "file", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 259221}
{"url": "https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L80-L97", "sha": "71c798378e365286b7cc03c06e4d7d24c7de8fc4", "docstring_summary": "Load a keyring specified in the config file or infer the best available.", "language": "python", "parameters": "(limit=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", ".", "_limit", "=", "arg_0", "arg_3", "=", "filter", "(", "arg_0", ",", "arg_1", ".", "get_all_keyring", "(", ")", ")", "set_keyring", "(", "load_env", "(", ")", "or", "load_config", "(", ")", "or", "max", "(", "arg_3", ",", "default", "=", "fail", ".", "Keyring", "(", ")", ",", "key", "=", "arg_1", ".", "by_priority", ")", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Load a keyring specified in the config file or infer the best available.\n\n    Limit, if supplied, should be a callable taking a backend and returning\n    True if that backend should be included for consideration.\n    \"\"\"\n    # save the limit for the chainer to honor\n    arg_1._limit = arg_0\n\n    # get all keyrings passing the limit filter\n    arg_3 = filter(arg_0, arg_1.get_all_keyring())\n\n    set_keyring(\n        load_env()\n        or load_config()\n        or max(arg_3, default=fail.Keyring(), key=arg_1.by_priority)\n    )", "path": "keyring/core.py", "identifier": "init_backend", "docstring": "Load a keyring specified in the config file or infer the best available.\n\n    Limit, if supplied, should be a callable taking a backend and returning\n    True if that backend should be included for consideration.", "docstring_tokens": ["Load", "a", "keyring", "specified", "in", "the", "config", "file", "or", "infer", "the", "best", "available", "."], "nwo": "jaraco/keyring", "score": 0.7254776697026839, "idx": 259222}
{"url": "https://github.com/hotdogee/gff3-py/blob/d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9/gff3/gff3.py#L124-L140", "sha": "d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9", "docstring_summary": "Write fasta_dict to fasta_file", "language": "python", "parameters": "(fasta_dict, fasta_file, line_char_limit=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_1", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_3", "=", "open", "(", "arg_1", ",", "'wb'", ")", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "arg_0", "[", "arg_4", "]", "[", "'seq'", "]", "if", "arg_2", ":", "arg_5", "=", "'\\n'", ".", "join", "(", "[", "arg_5", "[", "i", ":", "i", "+", "arg_2", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "arg_5", ")", ",", "arg_2", ")", "]", ")", "arg_3", ".", "write", "(", "u'{0:s}\\n{1:s}\\n'", ".", "format", "(", "arg_0", "[", "arg_4", "]", "[", "'header'", "]", ",", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Write fasta_dict to fasta_file\n\n    :param fasta_dict: returned by fasta_file_to_dict\n    :param fasta_file: output file can be a string path or a file object\n    :param line_char_limit: None = no limit (default)\n    :return: None\n    \"\"\"\n    arg_3 = arg_1\n    if isinstance(arg_1, str):\n        arg_3 = open(arg_1, 'wb')\n\n    for arg_4 in arg_0:\n        arg_5 = arg_0[arg_4]['seq']\n        if arg_2:\n            arg_5 = '\\n'.join([arg_5[i:i+arg_2] for i in range(0, len(arg_5), arg_2)])\n        arg_3.write(u'{0:s}\\n{1:s}\\n'.format(arg_0[arg_4]['header'], arg_5))", "path": "gff3/gff3.py", "identifier": "fasta_dict_to_file", "docstring": "Write fasta_dict to fasta_file\n\n    :param fasta_dict: returned by fasta_file_to_dict\n    :param fasta_file: output file can be a string path or a file object\n    :param line_char_limit: None = no limit (default)\n    :return: None", "docstring_tokens": ["Write", "fasta_dict", "to", "fasta_file"], "nwo": "hotdogee/gff3-py", "score": 0.18384731799856882, "idx": 259223}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L342-L417", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Launch a process to process the given file.", "language": "python", "parameters": "(result_queue,\n                        file_path,\n                        pickle_dags,\n                        dag_id_white_list,\n                        thread_name,\n                        zombies)", "return_statement": "return p", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "def", "helper", "(", ")", ":", "arg_6", "=", "logging", ".", "getLogger", "(", "\"airflow.processor\"", ")", "arg_7", "=", "StreamLogWriter", "(", "arg_6", ",", "logging", ".", "INFO", ")", "arg_8", "=", "StreamLogWriter", "(", "arg_6", ",", "logging", ".", "WARN", ")", "set_context", "(", "arg_6", ",", "arg_1", ")", "try", ":", "arg_9", ".", "stdout", "=", "arg_7", "arg_9", ".", "stderr", "=", "arg_8", "settings", ".", "configure_orm", "(", ")", "arg_10", ".", "current_thread", "(", ")", ".", "name", "=", "arg_4", "arg_13", "=", "time", ".", "time", "(", ")", "arg_6", ".", "info", "(", "\"Started process (PID=%s) to work on %s\"", ",", "os", ".", "getpid", "(", ")", ",", "arg_1", ")", "arg_14", "=", "SchedulerJob", "(", "dag_ids", "=", "arg_3", ",", "arg_6", "=", "arg_6", ")", "arg_15", "=", "arg_14", ".", "process_file", "(", "arg_1", ",", "arg_5", ",", "arg_2", ")", "arg_0", ".", "put", "(", "arg_15", ")", "arg_16", "=", "time", ".", "time", "(", ")", "arg_6", ".", "info", "(", "\"Processing %s took %.3f seconds\"", ",", "arg_1", ",", "arg_16", "-", "arg_13", ")", "except", "Exception", ":", "arg_6", ".", "exception", "(", "\"Got an exception! Propagating...\"", ")", "raise", "finally", ":", "arg_9", ".", "stdout", "=", "arg_9", ".", "__stdout__", "arg_9", ".", "stderr", "=", "arg_9", ".", "__stderr__", "settings", ".", "dispose_orm", "(", ")", "arg_17", "=", "multiprocessing", ".", "Process", "(", "target", "=", "helper", ",", "args", "=", "(", ")", ",", "arg_12", "=", "\"{}-Process\"", ".", "format", "(", "arg_4", ")", ")", "arg_17", ".", "start", "(", ")", "return", "arg_17"], "function": "def Func(arg_0,\n                        arg_1,\n                        arg_2,\n                        arg_3,\n                        arg_4,\n                        arg_5):\n        \"\"\"\n        Launch a process to process the given file.\n\n        :param result_queue: the queue to use for passing back the result\n        :type result_queue: multiprocessing.Queue\n        :param file_path: the file to process\n        :type file_path: unicode\n        :param pickle_dags: whether to pickle the DAGs found in the file and\n            save them to the DB\n        :type pickle_dags: bool\n        :param dag_id_white_list: if specified, only examine DAG ID's that are\n            in this list\n        :type dag_id_white_list: list[unicode]\n        :param thread_name: the name to use for the process that is launched\n        :type thread_name: unicode\n        :return: the process that was launched\n        :rtype: multiprocessing.Process\n        :param zombies: zombie task instances to kill\n        :type zombies: list[airflow.utils.dag_processing.SimpleTaskInstance]\n        \"\"\"\n        def helper():\n            # This helper runs in the newly created process\n            arg_6 = logging.getLogger(\"airflow.processor\")\n\n            arg_7 = StreamLogWriter(arg_6, logging.INFO)\n            arg_8 = StreamLogWriter(arg_6, logging.WARN)\n\n            set_context(arg_6, arg_1)\n\n            try:\n                # redirect stdout/stderr to log\n                arg_9.stdout = arg_7\n                arg_9.stderr = arg_8\n\n                # Re-configure the ORM engine as there are issues with multiple processes\n                settings.configure_orm()\n\n                # Change the thread name to differentiate log lines. This is\n                # really a separate process, but changing the name of the\n                # process doesn't work, so changing the thread name instead.\n                arg_10.current_thread().name = arg_4\n                arg_13 = time.time()\n\n                arg_6.info(\"Started process (PID=%s) to work on %s\",\n                         os.getpid(), arg_1)\n                arg_14 = SchedulerJob(dag_ids=arg_3, arg_6=arg_6)\n                arg_15 = arg_14.process_file(arg_1,\n                                                    arg_5,\n                                                    arg_2)\n                arg_0.put(arg_15)\n                arg_16 = time.time()\n                arg_6.info(\n                    \"Processing %s took %.3f seconds\", arg_1, arg_16 - arg_13\n                )\n            except Exception:\n                # Log exceptions through the logging framework.\n                arg_6.exception(\"Got an exception! Propagating...\")\n                raise\n            finally:\n                arg_9.stdout = arg_9.__stdout__\n                arg_9.stderr = arg_9.__stderr__\n                # We re-initialized the ORM within this Process above so we need to\n                # tear it down manually here\n                settings.dispose_orm()\n\n        arg_17 = multiprocessing.Process(target=helper,\n                                    args=(),\n                                    arg_12=\"{}-Process\".format(arg_4))\n        arg_17.start()\n        return arg_17", "path": "airflow/jobs.py", "identifier": "DagFileProcessor._launch_process", "docstring": "Launch a process to process the given file.\n\n        :param result_queue: the queue to use for passing back the result\n        :type result_queue: multiprocessing.Queue\n        :param file_path: the file to process\n        :type file_path: unicode\n        :param pickle_dags: whether to pickle the DAGs found in the file and\n            save them to the DB\n        :type pickle_dags: bool\n        :param dag_id_white_list: if specified, only examine DAG ID's that are\n            in this list\n        :type dag_id_white_list: list[unicode]\n        :param thread_name: the name to use for the process that is launched\n        :type thread_name: unicode\n        :return: the process that was launched\n        :rtype: multiprocessing.Process\n        :param zombies: zombie task instances to kill\n        :type zombies: list[airflow.utils.dag_processing.SimpleTaskInstance]", "docstring_tokens": ["Launch", "a", "process", "to", "process", "the", "given", "file", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259224}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/internal/util.py#L296-L329", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Extract a Tensor with canonical shape and optional mask.", "language": "python", "parameters": "(\n    maybe_masked_observed_time_series)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "'Func'", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'is_missing'", ")", ":", "arg_1", "=", "(", "arg_0", ".", "time_series", ")", "arg_2", "=", "arg_0", ".", "is_missing", "else", ":", "arg_1", "=", "arg_0", "arg_2", "=", "None", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "name", "=", "'observed_time_series'", ")", "arg_1", "=", "_maybe_expand_trailing_dim", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "arg_2", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_2", ",", "name", "=", "'is_missing'", ",", "dtype_hint", "=", "tf", ".", "bool", ")", "return", "missing_values_util", ".", "MaskedTimeSeries", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(\n    arg_0):\n  \"\"\"Extract a Tensor with canonical shape and optional mask.\n\n  Args:\n    maybe_masked_observed_time_series: a `Tensor`-like object with shape\n      `[..., num_timesteps]` or `[..., num_timesteps, 1]`, or a\n      `tfp.sts.MaskedTimeSeries` containing such an object.\n  Returns:\n    masked_time_series: a `tfp.sts.MaskedTimeSeries` namedtuple, in which\n      the `observed_time_series` is converted to `Tensor` with canonical shape\n      `[..., num_timesteps, 1]`, and `is_missing` is either `None` or a boolean\n      `Tensor`.\n  \"\"\"\n\n  with tf.compat.v1.name_scope('Func'):\n    if hasattr(arg_0, 'is_missing'):\n      arg_1 = (\n          arg_0.time_series)\n      arg_2 = arg_0.is_missing\n    else:\n      arg_1 = arg_0\n      arg_2 = None\n\n    arg_1 = tf.convert_to_tensor(value=arg_1,\n                                                name='observed_time_series')\n    arg_1 = _maybe_expand_trailing_dim(arg_1)\n\n    if arg_2 is not None:\n      arg_2 = tf.convert_to_tensor(\n          value=arg_2, name='is_missing', dtype_hint=tf.bool)\n\n    return missing_values_util.MaskedTimeSeries(arg_1,\n                                                arg_2=arg_2)", "path": "tensorflow_probability/python/sts/internal/util.py", "identifier": "canonicalize_observed_time_series_with_mask", "docstring": "Extract a Tensor with canonical shape and optional mask.\n\n  Args:\n    maybe_masked_observed_time_series: a `Tensor`-like object with shape\n      `[..., num_timesteps]` or `[..., num_timesteps, 1]`, or a\n      `tfp.sts.MaskedTimeSeries` containing such an object.\n  Returns:\n    masked_time_series: a `tfp.sts.MaskedTimeSeries` namedtuple, in which\n      the `observed_time_series` is converted to `Tensor` with canonical shape\n      `[..., num_timesteps, 1]`, and `is_missing` is either `None` or a boolean\n      `Tensor`.", "docstring_tokens": ["Extract", "a", "Tensor", "with", "canonical", "shape", "and", "optional", "mask", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259225}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/_config.py#L119-L133", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Retrieve auth from profile configuration and set in msg.auth attr.", "language": "python", "parameters": "(msg, cfg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "__class__", ".", "__name__", ".", "lower", "(", ")", "arg_3", "=", "arg_0", ".", "profile", "+", "\"_\"", "+", "arg_2", "arg_4", "=", "arg_1", ".", "pwd", "[", "arg_3", "]", ".", "split", "(", "\" :: \"", ")", "if", "len", "(", "arg_4", ")", "==", "1", ":", "arg_0", ".", "auth", "=", "arg_4", "[", "0", "]", "else", ":", "arg_0", ".", "auth", "=", "tuple", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Retrieve auth from profile configuration and set in msg.auth attr.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.\n    \"\"\"\n    arg_2 = arg_0.__class__.__name__.lower()\n    arg_3 = arg_0.profile + \"_\" + arg_2\n    arg_4 = arg_1.pwd[arg_3].split(\" :: \")\n    if len(arg_4) == 1:\n        arg_0.auth = arg_4[0]\n    else:\n        arg_0.auth = tuple(arg_4)", "path": "messages/_config.py", "identifier": "retrieve_pwd_from_config", "docstring": "Retrieve auth from profile configuration and set in msg.auth attr.\n\n    Args:\n        :msg: (Message class) an instance of a message class.\n        :cfg: (jsonconfig.Config) config instance.", "docstring_tokens": ["Retrieve", "auth", "from", "profile", "configuration", "and", "set", "in", "msg", ".", "auth", "attr", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 259226}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/abc.py#L119-L126", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Debug helper to print the ABC registry.", "language": "python", "parameters": "(cls, file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "print", ">>", "arg_1", ",", "\"Class: %s.%s\"", "%", "(", "arg_0", ".", "__module__", ",", "arg_0", ".", "__name__", ")", "print", ">>", "arg_1", ",", "\"Inv.counter: %s\"", "%", "ABCMeta", ".", "_abc_invalidation_counter", "for", "arg_2", "in", "sorted", "(", "arg_0", ".", "__dict__", ".", "keys", "(", ")", ")", ":", "if", "arg_2", ".", "startswith", "(", "\"_abc_\"", ")", ":", "arg_3", "=", "getattr", "(", "arg_0", ",", "arg_2", ")", "print", ">>", "arg_1", ",", "\"%s: %r\"", "%", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Debug helper to print the ABC registry.\"\"\"\n        print >> arg_1, \"Class: %s.%s\" % (arg_0.__module__, arg_0.__name__)\n        print >> arg_1, \"Inv.counter: %s\" % ABCMeta._abc_invalidation_counter\n        for arg_2 in sorted(arg_0.__dict__.keys()):\n            if arg_2.startswith(\"_abc_\"):\n                arg_3 = getattr(arg_0, arg_2)\n                print >> arg_1, \"%s: %r\" % (arg_2, arg_3)", "path": "third_party/stdlib/abc.py", "identifier": "ABCMeta._dump_registry", "docstring": "Debug helper to print the ABC registry.", "docstring_tokens": ["Debug", "helper", "to", "print", "the", "ABC", "registry", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 259227}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/treeutil.py#L175-L236", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "Add text nodes as possible to all descendants of an element for spacing & indentation\n    to make the MicroXML as printed easier for people to read. Will not modify the\n    value of any text node which is not already entirely whitespace.", "language": "python", "parameters": "(elem, depth=0, indent='  ')", "return_statement": "return elem", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "'  '", ")", ":", "arg_1", "+=", "1", "arg_3", "=", "[", "]", "arg_4", "=", "0", "for", "arg_5", "in", "arg_0", ".", "xml_children", ":", "if", "isinstance", "(", "arg_5", ",", "element", ")", ":", "if", "arg_4", "%", "2", ":", "arg_3", ".", "append", "(", "arg_5", ")", "arg_4", "+=", "1", "else", ":", "arg_6", "=", "text", "(", "'\\n'", "+", "arg_2", "*", "arg_1", ",", "arg_0", ")", "arg_3", ".", "append", "(", "arg_6", ")", "arg_3", ".", "append", "(", "arg_5", ")", "arg_4", "+=", "2", "Func", "(", "arg_5", ",", "arg_1", ")", "else", ":", "if", "arg_5", ".", "xml_value", ".", "strip", "(", ")", ":", "arg_3", ".", "append", "(", "arg_5", ")", "arg_4", "+=", "1", "else", ":", "arg_6", "=", "text", "(", "'\\n'", "+", "arg_2", "*", "arg_1", ",", "arg_0", ")", "arg_3", ".", "append", "(", "arg_6", ")", "arg_4", "+=", "1", "if", "not", "(", "arg_4", "%", "2", ")", ":", "arg_6", "=", "text", "(", "'\\n'", "+", "arg_2", "*", "(", "arg_1", "-", "1", ")", ",", "arg_0", ")", "arg_3", ".", "append", "(", "arg_6", ")", "arg_0", ".", "xml_children", "=", "arg_3", "return", "arg_0"], "function": "def Func(arg_0, arg_1=0, arg_2='  '):\n    '''\n    Add text nodes as possible to all descendants of an element for spacing & indentation\n    to make the MicroXML as printed easier for people to read. Will not modify the\n    value of any text node which is not already entirely whitespace.\n\n    Warning: even though this operaton avoids molesting text nodes which already have\n    whitespace, it still makes changes which alter the text. Not all whitespace in XML is\n    ignorable. In XML cues from the DTD indicate which whitespace can be ignored.\n    No such cues are available for MicroXML, so use this function with care. That said,\n    in many real world applications of XML and MicroXML, this function causes no problems.\n\n    elem - target element whose descendant nodes are to be modified.\n    returns - the same element, which has been updated in place\n\n    >>> from amara3.uxml import tree\n    >>> from amara3.uxml.treeutil import *\n    >>> DOC = '<a><b><x>1</x></b><c><x>2</x><d><x>3</x></d></c><x>4</x><y>5</y></a>'\n    >>> tb = tree.treebuilder()\n    >>> root = tb.parse(DOC)\n    >>> len(root.xml_children)\n    4\n    >>> Func(root)\n    <uxml.element (8763373718343) \"a\" with 9 children>\n    >>> len(root.xml_children)\n    9\n    >>> root.xml_encode()\n    '<a>\\n  <b>\\n    <x>1</x>\\n  </b>\\n  <c>\\n    <x>2</x>\\n    <d>\\n      <x>3</x>\\n    </d>\\n  </c>\\n  <x>4</x>\\n  <y>5</y>\\n</a>'\n    '''\n    arg_1 += 1\n    arg_3 = []\n    arg_4 = 0\n    for arg_5 in arg_0.xml_children:\n        if isinstance(arg_5, element):\n            if arg_4 % 2:\n                arg_3.append(arg_5)\n                arg_4 += 1\n            else:\n                #It's the turn for text, but we have an element\n                arg_6 = text('\\n' + arg_2*arg_1, arg_0)\n                arg_3.append(arg_6)\n                arg_3.append(arg_5)\n                arg_4 += 2\n            Func(arg_5, arg_1)\n        else:\n            if arg_5.xml_value.strip():\n                #More to it than whitespace, so leave alone\n                #Note: if only whitespace entities are used, will still be left alone\n                arg_3.append(arg_5)\n                arg_4 += 1\n            else:\n                #Only whitespace, so replace with proper indentation\n                arg_6 = text('\\n' + arg_2*arg_1, arg_0)\n                arg_3.append(arg_6)\n                arg_4 += 1\n    #Trailing indentation might be needed\n    if not(arg_4 % 2):\n        arg_6 = text('\\n' + arg_2*(arg_1-1), arg_0)\n        arg_3.append(arg_6)\n        #updated_child_ix += 1 #About to be done, so not really needed\n    arg_0.xml_children = arg_3\n    return arg_0", "path": "pylib/uxml/treeutil.py", "identifier": "make_pretty", "docstring": "Add text nodes as possible to all descendants of an element for spacing & indentation\n    to make the MicroXML as printed easier for people to read. Will not modify the\n    value of any text node which is not already entirely whitespace.\n\n    Warning: even though this operaton avoids molesting text nodes which already have\n    whitespace, it still makes changes which alter the text. Not all whitespace in XML is\n    ignorable. In XML cues from the DTD indicate which whitespace can be ignored.\n    No such cues are available for MicroXML, so use this function with care. That said,\n    in many real world applications of XML and MicroXML, this function causes no problems.\n\n    elem - target element whose descendant nodes are to be modified.\n    returns - the same element, which has been updated in place\n\n    >>> from amara3.uxml import tree\n    >>> from amara3.uxml.treeutil import *\n    >>> DOC = '<a><b><x>1</x></b><c><x>2</x><d><x>3</x></d></c><x>4</x><y>5</y></a>'\n    >>> tb = tree.treebuilder()\n    >>> root = tb.parse(DOC)\n    >>> len(root.xml_children)\n    4\n    >>> make_pretty(root)\n    <uxml.element (8763373718343) \"a\" with 9 children>\n    >>> len(root.xml_children)\n    9\n    >>> root.xml_encode()\n    '<a>\\n  <b>\\n    <x>1</x>\\n  </b>\\n  <c>\\n    <x>2</x>\\n    <d>\\n      <x>3</x>\\n    </d>\\n  </c>\\n  <x>4</x>\\n  <y>5</y>\\n</a>'", "docstring_tokens": ["Add", "text", "nodes", "as", "possible", "to", "all", "descendants", "of", "an", "element", "for", "spacing", "&", "indentation", "to", "make", "the", "MicroXML", "as", "printed", "easier", "for", "people", "to", "read", ".", "Will", "not", "modify", "the", "value", "of", "any", "text", "node", "which", "is", "not", "already", "entirely", "whitespace", "."], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 259228}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/node/matchers.py#L800-L814", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Checks if the page or current node has no radio button or checkbox with the given label,\n        value, or id, that is currently unchecked.", "language": "python", "parameters": "(self, locator, **kwargs)", "return_statement": "return self.has_no_selector(\"field\", locator, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_2", "[", "\"checked\"", "]", "=", "False", "return", "arg_0", ".", "has_no_selector", "(", "\"field\"", ",", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Checks if the page or current node has no radio button or checkbox with the given label,\n        value, or id, that is currently unchecked.\n\n        Args:\n            locator (str): The label, name, or id of an unchecked field.\n            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.\n\n        Returns:\n            bool: Whether it doesn't exist.\n        \"\"\"\n\n        arg_2[\"checked\"] = False\n        return arg_0.has_no_selector(\"field\", arg_1, **arg_2)", "path": "capybara/node/matchers.py", "identifier": "MatchersMixin.has_no_unchecked_field", "docstring": "Checks if the page or current node has no radio button or checkbox with the given label,\n        value, or id, that is currently unchecked.\n\n        Args:\n            locator (str): The label, name, or id of an unchecked field.\n            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.\n\n        Returns:\n            bool: Whether it doesn't exist.", "docstring_tokens": ["Checks", "if", "the", "page", "or", "current", "node", "has", "no", "radio", "button", "or", "checkbox", "with", "the", "given", "label", "value", "or", "id", "that", "is", "currently", "unchecked", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 259229}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/CGNN.py#L127-L145", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Run the CGNN on a given graph.", "language": "python", "parameters": "(self, data, train_epochs=1000, test_epochs=1000, verbose=None,\n            idx=0, lr=0.01, **kwargs)", "return_statement": "return self.score.cpu().numpy() / test_epochs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1000", ",", "arg_3", "=", "1000", ",", "arg_4", "=", "None", ",", "arg_5", "=", "0", ",", "arg_6", "=", "0.01", ",", "**", "arg_7", ")", ":", "arg_4", "=", "SETTINGS", ".", "get_default", "(", "arg_4", "=", "arg_4", ")", "arg_8", "=", "th", ".", "optim", ".", "Adam", "(", "arg_0", ".", "parameters", "(", ")", ",", "arg_6", "=", "arg_6", ")", "arg_0", ".", "score", ".", "zero_", "(", ")", "with", "trange", "(", "arg_2", "+", "arg_3", ",", "disable", "=", "not", "arg_4", ")", "as", "t", ":", "for", "arg_9", "in", "t", ":", "arg_8", ".", "zero_grad", "(", ")", "arg_10", "=", "arg_0", ".", "forward", "(", ")", "arg_11", "=", "arg_0", ".", "criterion", "(", "arg_10", ",", "arg_1", ")", "if", "not", "arg_9", "%", "200", ":", "t", ".", "set_postfix", "(", "arg_5", "=", "arg_5", ",", "arg_9", "=", "arg_9", ",", "loss", "=", "arg_11", ".", "item", "(", ")", ")", "arg_11", ".", "backward", "(", ")", "arg_8", ".", "step", "(", ")", "if", "arg_9", ">=", "arg_3", ":", "arg_0", ".", "score", ".", "add_", "(", "arg_11", ".", "data", ")", "return", "arg_0", ".", "score", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "/", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=1000, arg_3=1000, arg_4=None,\n            arg_5=0, arg_6=0.01, **arg_7):\n        \"\"\"Run the CGNN on a given graph.\"\"\"\n        arg_4 = SETTINGS.get_default(arg_4=arg_4)\n        arg_8 = th.optim.Adam(arg_0.parameters(), arg_6=arg_6)\n        arg_0.score.zero_()\n        with trange(arg_2 + arg_3, disable=not arg_4) as t:\n            for arg_9 in t:\n                arg_8.zero_grad()\n                arg_10 = arg_0.forward()\n                arg_11 = arg_0.criterion(arg_10, arg_1)\n                if not arg_9 % 200:\n                    t.set_postfix(arg_5=arg_5, arg_9=arg_9, loss=arg_11.item())\n                arg_11.backward()\n                arg_8.step()\n                if arg_9 >= arg_3:\n                    arg_0.score.add_(arg_11.data)\n\n        return arg_0.score.cpu().numpy() / arg_3", "path": "cdt/causality/graph/CGNN.py", "identifier": "CGNN_model.run", "docstring": "Run the CGNN on a given graph.", "docstring_tokens": ["Run", "the", "CGNN", "on", "a", "given", "graph", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 259230}
{"url": "https://github.com/takluyver/entrypoints/blob/d7db29fd6136f86498d8c374f531d4c198d66bf6/entrypoints.py#L205-L217", "sha": "d7db29fd6136f86498d8c374f531d4c198d66bf6", "docstring_summary": "Find a single entry point.", "language": "python", "parameters": "(group, name, path=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "for", "arg_3", ",", "arg_4", "in", "iter_files_distros", "(", "arg_2", "=", "arg_2", ")", ":", "if", "(", "arg_0", "in", "arg_3", ")", "and", "(", "arg_1", "in", "arg_3", "[", "arg_0", "]", ")", ":", "arg_5", "=", "arg_3", "[", "arg_0", "]", "[", "arg_1", "]", "with", "BadEntryPoint", ".", "err_to_warnings", "(", ")", ":", "return", "EntryPoint", ".", "from_string", "(", "arg_5", ",", "arg_1", ",", "arg_4", ")", "raise", "NoSuchEntryPoint", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Find a single entry point.\n\n    Returns an :class:`EntryPoint` object, or raises :exc:`NoSuchEntryPoint`\n    if no match is found.\n    \"\"\"\n    for arg_3, arg_4 in iter_files_distros(arg_2=arg_2):\n        if (arg_0 in arg_3) and (arg_1 in arg_3[arg_0]):\n            arg_5 = arg_3[arg_0][arg_1]\n            with BadEntryPoint.err_to_warnings():\n                return EntryPoint.from_string(arg_5, arg_1, arg_4)\n\n    raise NoSuchEntryPoint(arg_0, arg_1)", "path": "entrypoints.py", "identifier": "get_single", "docstring": "Find a single entry point.\n\n    Returns an :class:`EntryPoint` object, or raises :exc:`NoSuchEntryPoint`\n    if no match is found.", "docstring_tokens": ["Find", "a", "single", "entry", "point", "."], "nwo": "takluyver/entrypoints", "score": 0.727564189325863, "idx": 259231}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfdocument.py#L106-L112", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Internal method to set the initial default font. Change\r\n            the font using set_font method.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "font", "=", "PDFFont", "(", "arg_0", ".", "session", ")", "arg_0", ".", "font", ".", "_set_index", "(", ")", "arg_0", ".", "fonts", ".", "append", "(", "arg_0", ".", "font", ")", "arg_0", ".", "fontkeys", ".", "append", "(", "arg_0", ".", "font", ".", "font_key", ")"], "function": "def Func(arg_0):\r\n        \"\"\" Internal method to set the initial default font. Change\r\n            the font using set_font method.\"\"\"\r\n        arg_0.font = PDFFont(arg_0.session)\r\n        arg_0.font._set_index()\r\n        arg_0.fonts.append(arg_0.font)\r\n        arg_0.fontkeys.append(arg_0.font.font_key)", "path": "pypdflite/pdfdocument.py", "identifier": "PDFDocument._set_default_font", "docstring": "Internal method to set the initial default font. Change\r\n            the font using set_font method.", "docstring_tokens": ["Internal", "method", "to", "set", "the", "initial", "default", "font", ".", "Change", "the", "font", "using", "set_font", "method", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 259232}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py#L42-L64", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Determine if a number of Card Actions are supported by a Channel.", "language": "python", "parameters": "(channel_id: str, button_cnt: int = 100)", "return_statement": "return button_cnt <= max_actions[channel_id] if channel_id in max_actions else False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "100", ")", "->", "bool", ":", "arg_4", "=", "{", "Channels", ".", "facebook", ":", "3", ",", "Channels", ".", "skype", ":", "3", ",", "Channels", ".", "ms_teams", ":", "3", ",", "Channels", ".", "line", ":", "99", ",", "Channels", ".", "slack", ":", "100", ",", "Channels", ".", "emulator", ":", "100", ",", "Channels", ".", "direct_line", ":", "100", ",", "Channels", ".", "webchat", ":", "100", ",", "Channels", ".", "cortana", ":", "100", ",", "}", "return", "arg_2", "<=", "arg_4", "[", "arg_0", "]", "if", "arg_0", "in", "arg_4", "else", "False"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = 100) -> bool:\n        \"\"\"Determine if a number of Card Actions are supported by a Channel.\n\n        Args:\n            channel_id (str): The Channel to check if the Card Actions are supported in.\n            button_cnt (int, optional): Defaults to 100. The number of Card Actions to check for the Channel.\n\n        Returns:\n            bool: True if the Channel supports the button_cnt total Card Actions, False if the Channel does not support that number of Card Actions.\n        \"\"\"\n\n        arg_4 = {\n            Channels.facebook: 3,\n            Channels.skype: 3,\n            Channels.ms_teams: 3,\n            Channels.line: 99,\n            Channels.slack: 100,\n            Channels.emulator: 100,\n            Channels.direct_line: 100,\n            Channels.webchat: 100,\n            Channels.cortana: 100,\n        }\n        return arg_2 <= arg_4[arg_0] if arg_0 in arg_4 else False", "path": "libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py", "identifier": "Channel.supports_card_actions", "docstring": "Determine if a number of Card Actions are supported by a Channel.\n\n        Args:\n            channel_id (str): The Channel to check if the Card Actions are supported in.\n            button_cnt (int, optional): Defaults to 100. The number of Card Actions to check for the Channel.\n\n        Returns:\n            bool: True if the Channel supports the button_cnt total Card Actions, False if the Channel does not support that number of Card Actions.", "docstring_tokens": ["Determine", "if", "a", "number", "of", "Card", "Actions", "are", "supported", "by", "a", "Channel", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 259233}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1466-L1479", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Specify a callback function that will be called on the server when a\n        client offers protocols using ALPN.", "language": "python", "parameters": "(self, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_alpn_select_helper", "=", "_ALPNSelectHelper", "(", "arg_1", ")", "arg_0", ".", "_alpn_select_callback", "=", "arg_0", ".", "_alpn_select_helper", ".", "callback", "_lib", ".", "SSL_CTX_set_alpn_select_cb", "(", "arg_0", ".", "_context", ",", "arg_0", ".", "_alpn_select_callback", ",", "_ffi", ".", "NULL", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Specify a callback function that will be called on the server when a\n        client offers protocols using ALPN.\n\n        :param callback: The callback function.  It will be invoked with two\n            arguments: the Connection, and a list of offered protocols as\n            bytestrings, e.g ``[b'http/1.1', b'spdy/2']``.  It should return\n            one of those bytestrings, the chosen protocol.\n        \"\"\"\n        arg_0._alpn_select_helper = _ALPNSelectHelper(arg_1)\n        arg_0._alpn_select_callback = arg_0._alpn_select_helper.callback\n        _lib.SSL_CTX_set_alpn_select_cb(\n            arg_0._context, arg_0._alpn_select_callback, _ffi.NULL)", "path": "src/OpenSSL/SSL.py", "identifier": "Context.set_alpn_select_callback", "docstring": "Specify a callback function that will be called on the server when a\n        client offers protocols using ALPN.\n\n        :param callback: The callback function.  It will be invoked with two\n            arguments: the Connection, and a list of offered protocols as\n            bytestrings, e.g ``[b'http/1.1', b'spdy/2']``.  It should return\n            one of those bytestrings, the chosen protocol.", "docstring_tokens": ["Specify", "a", "callback", "function", "that", "will", "be", "called", "on", "the", "server", "when", "a", "client", "offers", "protocols", "using", "ALPN", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 259234}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/kuler.py#L181-L227", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Parses a theme from XML returned by Kuler.\n        \n        Gets the theme's id, label and swatches.\n        All of the swatches are converted to RGB.\n        If we have a full description for a theme id in cache,\n        parse that to get tags associated with the theme.", "language": "python", "parameters": "(self, xml)", "return_statement": "return kt", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "KulerTheme", "(", ")", "arg_2", ".", "author", "=", "arg_1", ".", "getElementsByTagName", "(", "\"author\"", ")", "[", "0", "]", "arg_2", ".", "author", "=", "arg_2", ".", "author", ".", "childNodes", "[", "1", "]", ".", "childNodes", "[", "0", "]", ".", "nodeValue", "arg_2", ".", "id", "=", "int", "(", "arg_0", ".", "parse_tag", "(", "arg_1", ",", "\"id\"", ")", ")", "arg_2", ".", "label", "=", "arg_0", ".", "parse_tag", "(", "arg_1", ",", "\"label\"", ")", "arg_6", "=", "arg_0", ".", "parse_tag", "(", "arg_1", ",", "\"mode\"", ")", "for", "arg_7", "in", "arg_1", ".", "getElementsByTagName", "(", "\"swatch\"", ")", ":", "arg_8", "=", "float", "(", "arg_0", ".", "parse_tag", "(", "arg_7", ",", "\"c1\"", ")", ")", "arg_9", "=", "float", "(", "arg_0", ".", "parse_tag", "(", "arg_7", ",", "\"c2\"", ")", ")", "arg_10", "=", "float", "(", "arg_0", ".", "parse_tag", "(", "arg_7", ",", "\"c3\"", ")", ")", "arg_11", "=", "float", "(", "arg_0", ".", "parse_tag", "(", "arg_7", ",", "\"c4\"", ")", ")", "if", "arg_6", "==", "\"rgb\"", ":", "arg_2", ".", "append", "(", "(", "arg_8", ",", "arg_9", ",", "arg_10", ")", ")", "if", "arg_6", "==", "\"cmyk\"", ":", "arg_2", ".", "append", "(", "cmyk_to_rgb", "(", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ")", ")", "if", "arg_6", "==", "\"hsv\"", ":", "arg_2", ".", "append", "(", "colorsys", ".", "hsv_to_rgb", "(", "arg_8", ",", "arg_9", ",", "arg_10", ")", ")", "if", "arg_6", "==", "\"hex\"", ":", "arg_2", ".", "append", "(", "hex_to_rgb", "(", "arg_8", ")", ")", "if", "arg_6", "==", "\"lab\"", ":", "arg_2", ".", "append", "(", "lab_to_rgb", "(", "arg_8", ",", "arg_9", ",", "arg_10", ")", ")", "if", "arg_0", ".", "_cache", ".", "exists", "(", "arg_0", ".", "id_string", "+", "str", "(", "arg_2", ".", "id", ")", ")", ":", "arg_1", "=", "arg_0", ".", "_cache", ".", "read", "(", "arg_0", ".", "id_string", "+", "str", "(", "arg_2", ".", "id", ")", ")", "arg_1", "=", "minidom", ".", "parseString", "(", "arg_1", ")", "for", "arg_12", "in", "arg_1", ".", "getElementsByTagName", "(", "\"tag\"", ")", ":", "arg_12", "=", "arg_0", ".", "parse_tag", "(", "arg_12", ",", "\"label\"", ")", "arg_12", "=", "arg_12", ".", "split", "(", "\" \"", ")", "arg_2", ".", "tags", ".", "extend", "(", "arg_12", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \n        \"\"\" Parses a theme from XML returned by Kuler.\n        \n        Gets the theme's id, label and swatches.\n        All of the swatches are converted to RGB.\n        If we have a full description for a theme id in cache,\n        parse that to get tags associated with the theme.\n        \n        \"\"\"\n\n        arg_2 = KulerTheme()        \n        arg_2.author = arg_1.getElementsByTagName(\"author\")[0]\n        arg_2.author = arg_2.author.childNodes[1].childNodes[0].nodeValue\n        arg_2.id = int(arg_0.parse_tag(arg_1, \"id\"))\n        arg_2.label = arg_0.parse_tag(arg_1, \"label\")\n        arg_6 = arg_0.parse_tag(arg_1, \"mode\")\n        \n        for arg_7 in arg_1.getElementsByTagName(\"swatch\"):\n            \n            arg_8 = float(arg_0.parse_tag(arg_7, \"c1\"))\n            arg_9 = float(arg_0.parse_tag(arg_7, \"c2\"))\n            arg_10 = float(arg_0.parse_tag(arg_7, \"c3\"))\n            arg_11 = float(arg_0.parse_tag(arg_7, \"c4\"))\n            \n            if arg_6 == \"rgb\":\n                arg_2.append((arg_8,arg_9,arg_10))\n            if arg_6 == \"cmyk\":   \n                arg_2.append(cmyk_to_rgb(arg_8,arg_9,arg_10,arg_11))\n            if arg_6 == \"hsv\":\n                arg_2.append(colorsys.hsv_to_rgb(arg_8,arg_9,arg_10))\n            if arg_6 == \"hex\":\n                arg_2.append(hex_to_rgb(arg_8))\n            if arg_6 == \"lab\":\n                arg_2.append(lab_to_rgb(arg_8,arg_9,arg_10))\n        \n        # If we have the full theme in cache,\n        # parse tags from it.\n        if arg_0._cache.exists(arg_0.id_string + str(arg_2.id)):\n            arg_1 = arg_0._cache.read(arg_0.id_string + str(arg_2.id))\n            arg_1 = minidom.parseString(arg_1)\n        for arg_12 in arg_1.getElementsByTagName(\"tag\"):\n            arg_12 = arg_0.parse_tag(arg_12, \"label\")\n            arg_12 = arg_12.split(\" \")\n            arg_2.tags.extend(arg_12)\n        \n        return arg_2", "path": "lib/web/kuler.py", "identifier": "Kuler.parse_theme", "docstring": "Parses a theme from XML returned by Kuler.\n        \n        Gets the theme's id, label and swatches.\n        All of the swatches are converted to RGB.\n        If we have a full description for a theme id in cache,\n        parse that to get tags associated with the theme.", "docstring_tokens": ["Parses", "a", "theme", "from", "XML", "returned", "by", "Kuler", ".", "Gets", "the", "theme", "s", "id", "label", "and", "swatches", ".", "All", "of", "the", "swatches", "are", "converted", "to", "RGB", ".", "If", "we", "have", "a", "full", "description", "for", "a", "theme", "id", "in", "cache", "parse", "that", "to", "get", "tags", "associated", "with", "the", "theme", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259235}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/itertools.py#L5-L32", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Generate all combinations of the elements of iterable and its subsets.", "language": "python", "parameters": "(iterable)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "len", "(", "arg_0", ")", "for", "arg_2", "in", "range", "(", "arg_1", ",", "-", "1", ",", "-", "1", ")", ":", "for", "arg_3", "in", "combinations", "(", "arg_0", ",", "arg_2", ")", ":", "yield", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Generate all combinations of the elements of iterable and its subsets.\n\n    Parameters\n    ----------\n    iterable: list, set or dict or any iterable object\n\n    Returns\n    -------\n    A generator of all possible combinations of the iterable.\n\n    Example:\n    -------\n    >>> for i in Func([1, 2, 3, 4, 5]): print(i)\n    >>> (1, 2, 3)\n    >>> (1, 2)\n    >>> (1, 3)\n    >>> (2, 3)\n    >>> (1,)\n    >>> (2,)\n    >>> (3,)\n    >>> ()\n    \"\"\"\n    arg_1 = len(arg_0)\n    for arg_2 in range(arg_1, -1, -1):\n        for arg_3 in combinations(arg_0, arg_2):\n            yield arg_3", "path": "boyle/dicom/itertools.py", "identifier": "treefall", "docstring": "Generate all combinations of the elements of iterable and its subsets.\n\n    Parameters\n    ----------\n    iterable: list, set or dict or any iterable object\n\n    Returns\n    -------\n    A generator of all possible combinations of the iterable.\n\n    Example:\n    -------\n    >>> for i in treefall([1, 2, 3, 4, 5]): print(i)\n    >>> (1, 2, 3)\n    >>> (1, 2)\n    >>> (1, 3)\n    >>> (2, 3)\n    >>> (1,)\n    >>> (2,)\n    >>> (3,)\n    >>> ()", "docstring_tokens": ["Generate", "all", "combinations", "of", "the", "elements", "of", "iterable", "and", "its", "subsets", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259236}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L458-L472", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Print build_info from release.yaml", "language": "python", "parameters": "(zipped_pex=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ")", ":", "if", "arg_0", ":", "arg_1", "=", "get_zipped_heron_release_file", "(", ")", "else", ":", "arg_1", "=", "get_heron_release_file", "(", ")", "with", "open", "(", "arg_1", ")", "as", "release_info", ":", "arg_2", "=", "yaml", ".", "load", "(", "release_info", ")", "arg_3", "=", "sorted", "(", "arg_2", ".", "items", "(", ")", ",", "arg_4", "=", "lambda", "tup", ":", "tup", "[", "0", "]", ")", "for", "arg_4", ",", "arg_5", "in", "arg_3", ":", "print", "(", "\"%s : %s\"", "%", "(", "arg_4", ",", "arg_5", ")", ")"], "function": "def Func(arg_0=False):\n  \"\"\"Print build_info from release.yaml\n\n  :param zipped_pex: True if the PEX file is built with flag `zip_safe=False'.\n  \"\"\"\n  if arg_0:\n    arg_1 = get_zipped_heron_release_file()\n  else:\n    arg_1 = get_heron_release_file()\n\n  with open(arg_1) as release_info:\n    arg_2 = yaml.load(release_info)\n    arg_3 = sorted(arg_2.items(), arg_4=lambda tup: tup[0])\n    for arg_4, arg_5 in arg_3:\n      print(\"%s : %s\" % (arg_4, arg_5))", "path": "heron/tools/common/src/python/utils/config.py", "identifier": "print_build_info", "docstring": "Print build_info from release.yaml\n\n  :param zipped_pex: True if the PEX file is built with flag `zip_safe=False'.", "docstring_tokens": ["Print", "build_info", "from", "release", ".", "yaml"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259237}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/sonify.py#L120-L150", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Sonify pitch contours.", "language": "python", "parameters": "(annotation, sr=22050, length=None, **kwargs)", "return_statement": "return y_out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "22050", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_4", "=", "defaultdict", "(", "list", ")", "arg_5", "=", "defaultdict", "(", "list", ")", "for", "arg_6", "in", "arg_0", ":", "arg_4", "[", "arg_6", ".", "value", "[", "'index'", "]", "]", ".", "append", "(", "arg_6", ".", "time", ")", "arg_5", "[", "arg_6", ".", "value", "[", "'index'", "]", "]", ".", "append", "(", "arg_6", ".", "value", "[", "'frequency'", "]", "*", "(", "-", "1", ")", "**", "(", "~", "arg_6", ".", "value", "[", "'voiced'", "]", ")", ")", "arg_7", "=", "0.0", "for", "arg_8", "in", "arg_4", ":", "arg_7", "=", "arg_7", "+", "filter_kwargs", "(", "mir_eval", ".", "sonify", ".", "Func", ",", "np", ".", "asarray", "(", "arg_4", "[", "arg_8", "]", ")", ",", "np", ".", "asarray", "(", "arg_5", "[", "arg_8", "]", ")", ",", "fs", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "len", "(", "arg_7", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=22050, arg_2=None, **arg_3):\n    '''Sonify pitch contours.\n\n    This uses mir_eval.sonify.Func, and should only be applied\n    to pitch annotations using the Func namespace.\n\n    Each contour is sonified independently, and the resulting waveforms\n    are summed together.\n    '''\n\n    # Map contours to lists of observations\n\n    arg_4 = defaultdict(list)\n    arg_5 = defaultdict(list)\n\n    for arg_6 in arg_0:\n        arg_4[arg_6.value['index']].append(arg_6.time)\n        arg_5[arg_6.value['index']].append(arg_6.value['frequency'] *\n                                         (-1)**(~arg_6.value['voiced']))\n\n    arg_7 = 0.0\n    for arg_8 in arg_4:\n        arg_7 = arg_7 + filter_kwargs(mir_eval.sonify.Func,\n                                      np.asarray(arg_4[arg_8]),\n                                      np.asarray(arg_5[arg_8]),\n                                      fs=arg_1, arg_2=arg_2,\n                                      **arg_3)\n        if arg_2 is None:\n            arg_2 = len(arg_7)\n\n    return arg_7", "path": "jams/sonify.py", "identifier": "pitch_contour", "docstring": "Sonify pitch contours.\n\n    This uses mir_eval.sonify.pitch_contour, and should only be applied\n    to pitch annotations using the pitch_contour namespace.\n\n    Each contour is sonified independently, and the resulting waveforms\n    are summed together.", "docstring_tokens": ["Sonify", "pitch", "contours", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 259238}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L110-L132", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Generate RENEWING time.", "language": "python", "parameters": "(lease_time, elapsed=0)", "return_statement": "return renewing_time", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_2", "=", "int", "(", "arg_0", ")", "*", "RENEW_PERC", "-", "arg_1", "arg_3", "=", "int", "(", "arg_0", ")", "*", "REBIND_PERC", "-", "arg_2", "logger", ".", "debug", "(", "'rebinding fuzz range %s'", ",", "arg_3", ")", "arg_4", "=", "random", ".", "uniform", "(", "-", "(", "arg_3", ")", ",", "+", "(", "arg_3", ")", ")", "arg_2", "+=", "arg_4", "logger", ".", "debug", "(", "'Renewing time %s.'", ",", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=0):\n    \"\"\"Generate RENEWING time.\n\n    [:rfc:`2131#section-4.4.5`]::\n\n        T1\n        defaults to (0.5 * duration_of_lease).  T2 defaults to (0.875 *\n        duration_of_lease).  Times T1 and T2 SHOULD be chosen with some\n        random \"fuzz\" around a fixed value, to avoid synchronization of\n        client reacquisition.\n\n    \"\"\"\n    arg_2 = int(arg_0) * RENEW_PERC - arg_1\n    # FIXME:80 [:rfc:`2131#section-4.4.5`]: the chosen \"fuzz\" could fingerprint\n    # the implementation\n    # NOTE: here using same \"fuzz\" as systemd?\n    arg_3 = int(arg_0) * REBIND_PERC - arg_2\n    logger.debug('rebinding fuzz range %s', arg_3)\n    arg_4 = random.uniform(-(arg_3),\n                          +(arg_3))\n    arg_2 += arg_4\n    logger.debug('Renewing time %s.', arg_2)\n    return arg_2", "path": "dhcpcanon/timers.py", "identifier": "gen_renewing_time", "docstring": "Generate RENEWING time.\n\n    [:rfc:`2131#section-4.4.5`]::\n\n        T1\n        defaults to (0.5 * duration_of_lease).  T2 defaults to (0.875 *\n        duration_of_lease).  Times T1 and T2 SHOULD be chosen with some\n        random \"fuzz\" around a fixed value, to avoid synchronization of\n        client reacquisition.", "docstring_tokens": ["Generate", "RENEWING", "time", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 259239}
{"url": "https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlproto.py#L115-L118", "sha": "246b7722d62b87b48be66d9a871509a537728962", "docstring_summary": "Close port.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "os", ".", "Func", "(", "arg_0", ".", "in_d", ")", "os", ".", "Func", "(", "arg_0", ".", "out_d", ")"], "function": "def Func(arg_0):\n        \"\"\"Close port.\"\"\"\n        os.Func(arg_0.in_d)\n        os.Func(arg_0.out_d)", "path": "priv/python3/erlport/erlproto.py", "identifier": "Port.close", "docstring": "Close port.", "docstring_tokens": ["Close", "port", "."], "nwo": "hdima/erlport", "score": 0.7170200836482384, "idx": 259240}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/settings.py#L200-L247", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Add a new setting definition.", "language": "python", "parameters": "(cls, name, type = unicode, default = None, factory = None,\n                        cache = False, default_d = None, doc = None,\n                        cmdline_help = None, validator = None, basic = False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "False", ")", ":", "arg_12", "=", "_SettingDefinition", "(", "arg_1", ",", "arg_2", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ")", "if", "arg_1", "not", "in", "arg_0", ".", "_defs", ":", "arg_0", ".", "_defs", "[", "arg_1", "]", "=", "arg_12", "return", "arg_14", "=", "arg_0", ".", "_defs", "[", "arg_1", "]", "if", "arg_14", ".", "type", "!=", "arg_12", ".", "type", ":", "raise", "ValueError", "(", "\"Setting duplicate, with a different type\"", ")", "if", "arg_14", ".", "default", "!=", "arg_12", ".", "default", ":", "raise", "ValueError", "(", "\"Setting duplicate, with a different default\"", ")", "if", "arg_14", ".", "factory", "!=", "arg_12", ".", "factory", ":", "raise", "ValueError", "(", "\"Setting duplicate, with a different factory\"", ")"], "function": "def Func(arg_0, arg_1, arg_2 = arg_3, arg_4 = None, arg_5 = None,\n                        arg_6 = False, arg_7 = None, arg_8 = None,\n                        arg_9 = None, arg_10 = None, arg_11 = False):\n        \"\"\"Add a new setting definition.\n\n        :Parameters:\n            - `name`: setting name\n            - `type`: setting type object or type description\n            - `default`: default value\n            - `factory`: default value factory\n            - `cache`: if `True` the `factory` will be called only once\n              and its value stored as a constant default.\n            - `default_d`: description of the default value\n            - `doc`: setting documentation\n            - `cmdline_help`: command line argument description. When not\n              provided then the setting won't be available as a command-line\n              option\n            - `basic`: when `True` the option is considered a basic option -\n              one of those which should usually stay configurable in\n              an application.\n            - `validator`: function validating command-line option value string\n              and returning proper value for the settings objects. Defaults\n              to `type`.\n        :Types:\n            - `name`: `unicode`\n            - `type`: type or `unicode`\n            - `factory`: a callable\n            - `cache`: `bool`\n            - `default_d`: `unicode`\n            - `doc`: `unicode`\n            - `cmdline_help`: `unicode`\n            - `basic`: `bool`\n            - `validator`: a callable\n        \"\"\"\n        # pylint: disable-msg=W0622,R0913\n        arg_12 = _SettingDefinition(arg_1, arg_2, arg_4, arg_5,\n                                            arg_6, arg_7, arg_8,\n                                            arg_9, arg_10, arg_11)\n        if arg_1 not in arg_0._defs:\n            arg_0._defs[arg_1] = arg_12\n            return\n        arg_14 = arg_0._defs[arg_1]\n        if arg_14.type != arg_12.type:\n            raise ValueError(\"Setting duplicate, with a different type\")\n        if arg_14.default != arg_12.default:\n            raise ValueError(\"Setting duplicate, with a different default\")\n        if arg_14.factory != arg_12.factory:\n            raise ValueError(\"Setting duplicate, with a different factory\")", "path": "pyxmpp2/settings.py", "identifier": "XMPPSettings.add_setting", "docstring": "Add a new setting definition.\n\n        :Parameters:\n            - `name`: setting name\n            - `type`: setting type object or type description\n            - `default`: default value\n            - `factory`: default value factory\n            - `cache`: if `True` the `factory` will be called only once\n              and its value stored as a constant default.\n            - `default_d`: description of the default value\n            - `doc`: setting documentation\n            - `cmdline_help`: command line argument description. When not\n              provided then the setting won't be available as a command-line\n              option\n            - `basic`: when `True` the option is considered a basic option -\n              one of those which should usually stay configurable in\n              an application.\n            - `validator`: function validating command-line option value string\n              and returning proper value for the settings objects. Defaults\n              to `type`.\n        :Types:\n            - `name`: `unicode`\n            - `type`: type or `unicode`\n            - `factory`: a callable\n            - `cache`: `bool`\n            - `default_d`: `unicode`\n            - `doc`: `unicode`\n            - `cmdline_help`: `unicode`\n            - `basic`: `bool`\n            - `validator`: a callable", "docstring_tokens": ["Add", "a", "new", "setting", "definition", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259241}
{"url": "https://github.com/voxpupuli/pypuppetdb/blob/cedeecf48014b4ad5b8e2513ca8230c814f45603/pypuppetdb/api.py#L742-L771", "sha": "cedeecf48014b4ad5b8e2513ca8230c814f45603", "docstring_summary": "Get event counts from puppetdb aggregated into a single map.", "language": "python", "parameters": "(self, summarize_by, query=None,\n                               count_by=None, count_filter=None)", "return_statement": "return self._query('aggregate-event-counts',\n                           query=query, summarize_by=summarize_by,\n                           count_by=count_by, count_filter=count_filter)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "return", "arg_0", ".", "_query", "(", "'aggregate-event-counts'", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                               arg_3=None, arg_4=None):\n        \"\"\"Get event counts from puppetdb aggregated into a single map.\n\n        :param summarize_by: (Required) The object type to be counted on.\n                             Valid values are 'containing_class', 'resource'\n                             and 'certname' or any comma-separated value\n                             thereof.\n        :type summarize_by: :obj:`string`\n        :param query: (Optional) The PuppetDB query to filter the results.\n                      This query is passed to the `events` endpoint.\n        :type query: :obj:`string`\n        :param count_by: (Optional) The object type that is counted when\n                         building the counts of 'successes', 'failures',\n                         'noops' and 'skips'. Support values are 'certname'\n                         and 'resource' (default)\n        :type count_by: :obj:`string`\n        :param count_filter: (Optional) A JSON query that is applied to the\n                             event-counts output but before the results are\n                             aggregated. Supported operators are `=`, `>`,\n                             `<`, `>=`, and `<=`. Supported fields are\n                             `failures`, `successes`, `noops`, and `skips`.\n        :type count_filter: :obj:`string`\n\n        :returns: A dictionary of name/value results.\n        :rtype: :obj:`dict`\n        \"\"\"\n        return arg_0._query('aggregate-event-counts',\n                           arg_2=arg_2, arg_1=arg_1,\n                           arg_3=arg_3, arg_4=arg_4)", "path": "pypuppetdb/api.py", "identifier": "BaseAPI.aggregate_event_counts", "docstring": "Get event counts from puppetdb aggregated into a single map.\n\n        :param summarize_by: (Required) The object type to be counted on.\n                             Valid values are 'containing_class', 'resource'\n                             and 'certname' or any comma-separated value\n                             thereof.\n        :type summarize_by: :obj:`string`\n        :param query: (Optional) The PuppetDB query to filter the results.\n                      This query is passed to the `events` endpoint.\n        :type query: :obj:`string`\n        :param count_by: (Optional) The object type that is counted when\n                         building the counts of 'successes', 'failures',\n                         'noops' and 'skips'. Support values are 'certname'\n                         and 'resource' (default)\n        :type count_by: :obj:`string`\n        :param count_filter: (Optional) A JSON query that is applied to the\n                             event-counts output but before the results are\n                             aggregated. Supported operators are `=`, `>`,\n                             `<`, `>=`, and `<=`. Supported fields are\n                             `failures`, `successes`, `noops`, and `skips`.\n        :type count_filter: :obj:`string`\n\n        :returns: A dictionary of name/value results.\n        :rtype: :obj:`dict`", "docstring_tokens": ["Get", "event", "counts", "from", "puppetdb", "aggregated", "into", "a", "single", "map", "."], "nwo": "voxpupuli/pypuppetdb", "score": 0.6407386667560883, "idx": 259242}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_data_lake_hook.py#L41-L53", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Return a AzureDLFileSystem object.", "language": "python", "parameters": "(self)", "return_statement": "return adlsFileSystemClient", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "Funcection", "(", "arg_0", ".", "conn_id", ")", "arg_2", "=", "arg_1", ".", "extra_dejson", "arg_0", ".", "account_name", "=", "arg_2", ".", "get", "(", "'account_name'", ")", "arg_4", "=", "lib", ".", "auth", "(", "tenant_id", "=", "arg_2", ".", "get", "(", "'tenant'", ")", ",", "client_secret", "=", "arg_1", ".", "password", ",", "client_id", "=", "arg_1", ".", "login", ")", "arg_5", "=", "core", ".", "AzureDLFileSystem", "(", "arg_4", ",", "store_name", "=", "arg_0", ".", "account_name", ")", "arg_5", ".", "connect", "(", ")", "return", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"Return a AzureDLFileSystem object.\"\"\"\n        arg_1 = arg_0.Funcection(arg_0.conn_id)\n        arg_2 = arg_1.extra_dejson\n        arg_0.account_name = arg_2.get('account_name')\n\n        arg_4 = lib.auth(tenant_id=arg_2.get('tenant'),\n                            client_secret=arg_1.password,\n                            client_id=arg_1.login)\n        arg_5 = core.AzureDLFileSystem(arg_4,\n                                                      store_name=arg_0.account_name)\n        arg_5.connect()\n        return arg_5", "path": "airflow/contrib/hooks/azure_data_lake_hook.py", "identifier": "AzureDataLakeHook.get_conn", "docstring": "Return a AzureDLFileSystem object.", "docstring_tokens": ["Return", "a", "AzureDLFileSystem", "object", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259243}
{"url": "https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L348-L360", "sha": "79c747cde45b5ba203ed93154d8c123ac9c3ef56", "docstring_summary": "Add a point to the TextTier", "language": "python", "parameters": "(self, point, value, check=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "if", "arg_0", ".", "tier_type", "!=", "'TextTier'", ":", "raise", "Exception", "(", "'Tiertype must be TextTier.'", ")", "if", "arg_3", "and", "any", "(", "arg_4", "for", "arg_4", "in", "arg_0", ".", "intervals", "if", "arg_4", "[", "0", "]", "==", "arg_1", ")", ":", "raise", "Exception", "(", "'No overlap is allowed'", ")", "arg_0", ".", "intervals", ".", "append", "(", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True):\n        \"\"\"Add a point to the TextTier\n\n        :param int point: Time of the point.\n        :param str value: Text of the point.\n        :param bool check: Flag to check for overlap.\n        :raises Exception: If overlap or wrong tiertype.\n        \"\"\"\n        if arg_0.tier_type != 'TextTier':\n            raise Exception('Tiertype must be TextTier.')\n        if arg_3 and any(arg_4 for arg_4 in arg_0.intervals if arg_4[0] == arg_1):\n                raise Exception('No overlap is allowed')\n        arg_0.intervals.append((arg_1, arg_2))", "path": "pympi/Praat.py", "identifier": "Tier.add_point", "docstring": "Add a point to the TextTier\n\n        :param int point: Time of the point.\n        :param str value: Text of the point.\n        :param bool check: Flag to check for overlap.\n        :raises Exception: If overlap or wrong tiertype.", "docstring_tokens": ["Add", "a", "point", "to", "the", "TextTier"], "nwo": "dopefishh/pympi", "score": 0.28834347991646037, "idx": 259244}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/interfaces.py#L264-L286", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Schedule function to be called from the main loop after `delay`\n        seconds.", "language": "python", "parameters": "(self, delay, function)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "arg_4", "=", "[", "]", "class", "DelayedCallHandler", "(", "TimeoutHandler", ")", ":", "@", "timeout_handler", "(", "arg_1", ",", "False", ")", "def", "callback", "(", "arg_0", ")", ":", "try", ":", "arg_2", "(", ")", "finally", ":", "arg_3", ".", "remove_handler", "(", "arg_4", "[", "0", "]", ")", "arg_4", ".", "append", "(", "DelayedCallHandler", "(", ")", ")", "arg_0", ".", "add_handler", "(", "arg_4", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Schedule function to be called from the main loop after `delay`\n        seconds.\n\n        :Parameters:\n            - `delay`: seconds to wait\n        :Types:\n            - `delay`: `float`\n        \"\"\"\n        arg_3 = arg_0\n        arg_4 = []\n        class DelayedCallHandler(TimeoutHandler):\n            \"\"\"Wrapper timeout handler class for the delayed call.\"\"\"\n            # pylint: disable=R0903\n            @timeout_handler(arg_1, False)\n            def callback(arg_0):\n                \"\"\"Wrapper timeout handler method for the delayed call.\"\"\"\n                try:\n                    arg_2()\n                finally:\n                    arg_3.remove_handler(arg_4[0])\n        arg_4.append(DelayedCallHandler())\n        arg_0.add_handler(arg_4[0])", "path": "pyxmpp2/mainloop/interfaces.py", "identifier": "MainLoop.delayed_call", "docstring": "Schedule function to be called from the main loop after `delay`\n        seconds.\n\n        :Parameters:\n            - `delay`: seconds to wait\n        :Types:\n            - `delay`: `float`", "docstring_tokens": ["Schedule", "function", "to", "be", "called", "from", "the", "main", "loop", "after", "delay", "seconds", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259245}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L284-L334", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Compute a statistic over an axis.", "language": "python", "parameters": "(self, axis=None, func=None, name=None, keepdims=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "list", "(", "range", "(", "len", "(", "arg_0", ".", "shape", ")", ")", ")", "arg_1", "=", "tupleize", "(", "arg_1", ")", "if", "arg_2", "and", "not", "arg_3", ":", "return", "arg_0", ".", "reduce", "(", "arg_2", ",", "arg_1", ",", "arg_4", ")", "if", "arg_3", "and", "not", "arg_2", ":", "from", "bolt", ".", "local", ".", "array", "import", "BoltArrayLocal", "arg_5", "=", "arg_0", ".", "_align", "(", "arg_1", ")", "def", "reducer", "(", "arg_6", ",", "arg_7", ")", ":", "return", "arg_6", ".", "combine", "(", "arg_7", ")", "arg_8", "=", "arg_5", ".", "_rdd", ".", "values", "(", ")", ".", "mapPartitions", "(", "lambda", "arg_10", ":", "[", "StatCounter", "(", "values", "=", "arg_10", ",", "stats", "=", "arg_3", ")", "]", ")", ".", "treeReduce", "(", "reducer", ",", "depth", "=", "3", ")", "arg_9", "=", "getattr", "(", "arg_8", ",", "arg_3", ")", "if", "arg_4", ":", "for", "arg_10", "in", "arg_1", ":", "arg_9", "=", "expand_dims", "(", "arg_9", ",", "arg_1", "=", "arg_10", ")", "return", "BoltArrayLocal", "(", "arg_9", ")", ".", "toscalar", "(", ")", "else", ":", "raise", "ValueError", "(", "'Must specify either a function or a statistic name.'", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False):\n        \"\"\"\n        Compute a statistic over an axis.\n\n        Can provide either a function (for use in a reduce)\n        or a name (for use by a stat counter).\n\n        Parameters\n        ----------\n        axis : tuple or int, optional, default=None\n            Axis to compute statistic over, if None\n            will compute over all axes\n\n        func : function, optional, default=None\n            Function for reduce, see BoltArraySpark.reduce\n\n        name : str\n            A named statistic, see StatCounter\n\n        keepdims : boolean, optional, default=False\n            Keep axis remaining after operation with size 1.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = list(range(len(arg_0.shape)))\n        arg_1 = tupleize(arg_1)\n\n        if arg_2 and not arg_3:\n            return arg_0.reduce(arg_2, arg_1, arg_4)\n\n        if arg_3 and not arg_2:\n            from bolt.local.array import BoltArrayLocal\n\n            arg_5 = arg_0._align(arg_1)\n\n            def reducer(arg_6, arg_7):\n                return arg_6.combine(arg_7)\n\n            arg_8 = arg_5._rdd.values()\\\n                             .mapPartitions(lambda arg_10: [StatCounter(values=arg_10, stats=arg_3)])\\\n                             .treeReduce(reducer, depth=3)\n\n            arg_9 = getattr(arg_8, arg_3)\n\n            if arg_4:\n                for arg_10 in arg_1:\n                    arg_9 = expand_dims(arg_9, arg_1=arg_10)\n\n            return BoltArrayLocal(arg_9).toscalar()\n\n        else:\n            raise ValueError('Must specify either a function or a statistic name.')", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark._stat", "docstring": "Compute a statistic over an axis.\n\n        Can provide either a function (for use in a reduce)\n        or a name (for use by a stat counter).\n\n        Parameters\n        ----------\n        axis : tuple or int, optional, default=None\n            Axis to compute statistic over, if None\n            will compute over all axes\n\n        func : function, optional, default=None\n            Function for reduce, see BoltArraySpark.reduce\n\n        name : str\n            A named statistic, see StatCounter\n\n        keepdims : boolean, optional, default=False\n            Keep axis remaining after operation with size 1.", "docstring_tokens": ["Compute", "a", "statistic", "over", "an", "axis", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 259246}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/construct.py#L170-L190", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Check that arguments are consistent with spark array construction.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "return cond1 or cond2 or cond3 or cond4", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "try", ":", "from", "pyspark", "import", "SparkContext", "except", "ImportError", ":", "return", "False", "arg_2", "=", "any", "(", "[", "isinstance", "(", "arg", ",", "SparkContext", ")", "for", "arg", "in", "arg_0", "]", ")", "arg_3", "=", "isinstance", "(", "arg_1", ".", "get", "(", "'context'", ",", "None", ")", ",", "SparkContext", ")", "arg_4", "=", "any", "(", "[", "isinstance", "(", "arg", ",", "BoltArraySpark", ")", "for", "arg", "in", "arg_0", "]", ")", "arg_5", "=", "any", "(", "[", "any", "(", "[", "isinstance", "(", "sub", ",", "BoltArraySpark", ")", "for", "sub", "in", "arg", "]", ")", "if", "isinstance", "(", "arg", ",", "(", "tuple", ",", "list", ")", ")", "else", "False", "for", "arg", "in", "arg_0", "]", ")", "return", "arg_2", "or", "arg_3", "or", "arg_4", "or", "arg_5"], "function": "def Func(*arg_0, **arg_1):\n        \"\"\"\n        Check that arguments are consistent with spark array construction.\n\n        Conditions are:\n        (1) a positional argument is a SparkContext\n        (2) keyword arg 'context' is a SparkContext\n        (3) an argument is a BoltArraySpark, or\n        (4) an argument is a nested list containing a BoltArraySpark\n        \"\"\"\n        try:\n            from pyspark import SparkContext\n        except ImportError:\n            return False\n\n        arg_2 = any([isinstance(arg, SparkContext) for arg in arg_0])\n        arg_3 = isinstance(arg_1.get('context', None), SparkContext)\n        arg_4 = any([isinstance(arg, BoltArraySpark) for arg in arg_0])\n        arg_5 = any([any([isinstance(sub, BoltArraySpark) for sub in arg])\n                     if isinstance(arg, (tuple, list)) else False for arg in arg_0])\n        return arg_2 or arg_3 or arg_4 or arg_5", "path": "bolt/spark/construct.py", "identifier": "ConstructSpark._argcheck", "docstring": "Check that arguments are consistent with spark array construction.\n\n        Conditions are:\n        (1) a positional argument is a SparkContext\n        (2) keyword arg 'context' is a SparkContext\n        (3) an argument is a BoltArraySpark, or\n        (4) an argument is a nested list containing a BoltArraySpark", "docstring_tokens": ["Check", "that", "arguments", "are", "consistent", "with", "spark", "array", "construction", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 259247}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/builder/description.py#L20-L25", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Clear description to default values", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_desc", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "merge", ".", "DEFAULT_PROJECT", ".", "items", "(", ")", ":", "if", "arg_2", "not", "in", "arg_0", ".", "_HIDDEN", ":", "arg_0", ".", "_desc", "[", "arg_2", "]", "=", "type", "(", "arg_3", ")", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Clear description to default values\"\"\"\n        arg_0._desc = {}\n        for arg_2, arg_3 in merge.DEFAULT_PROJECT.items():\n            if arg_2 not in arg_0._HIDDEN:\n                arg_0._desc[arg_2] = type(arg_3)()", "path": "bibliopixel/builder/description.py", "identifier": "Description.clear", "docstring": "Clear description to default values", "docstring_tokens": ["Clear", "description", "to", "default", "values"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 259248}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/dashboard.py#L19-L29", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Open dashboard in browser.", "language": "python", "parameters": "(yes, url)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"{}/app\"", ".", "format", "(", "PolyaxonClient", "(", ")", ".", "api_config", ".", "http_host", ")", "if", "arg_1", ":", "click", ".", "echo", "(", "arg_2", ")", "sys", ".", "exit", "(", "0", ")", "if", "not", "arg_0", ":", "click", ".", "confirm", "(", "'Dashboard page will now open in your browser. Continue?'", ",", "abort", "=", "True", ",", "default", "=", "True", ")", "click", ".", "launch", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Open Func in browser.\"\"\"\n    arg_2 = \"{}/app\".format(PolyaxonClient().api_config.http_host)\n    if arg_1:\n        click.echo(arg_2)\n        sys.exit(0)\n    if not arg_0:\n        click.confirm('Dashboard page will now open in your browser. Continue?',\n                      abort=True, default=True)\n\n    click.launch(arg_2)", "path": "polyaxon_cli/cli/dashboard.py", "identifier": "dashboard", "docstring": "Open dashboard in browser.", "docstring_tokens": ["Open", "dashboard", "in", "browser", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 259249}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L165-L183", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Calculates the distance of a given image to the\n        original image.", "language": "python", "parameters": "(self, image)", "return_statement": "return self.__distance(\n            self.__original_image_for_distance,\n            image,\n            bounds=self.bounds())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "__distance", "(", "arg_0", ".", "__original_image_for_distance", ",", "arg_1", ",", "bounds", "=", "arg_0", ".", "bounds", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Calculates the distance of a given image to the\n        original image.\n\n        Parameters\n        ----------\n        image : `numpy.ndarray`\n            The image that should be compared to the original image.\n\n        Returns\n        -------\n        :class:`Distance`\n            The distance between the given image and the original image.\n\n        \"\"\"\n        return arg_0.__distance(\n            arg_0.__original_image_for_distance,\n            arg_1,\n            bounds=arg_0.bounds())", "path": "foolbox/adversarial.py", "identifier": "Adversarial.normalized_distance", "docstring": "Calculates the distance of a given image to the\n        original image.\n\n        Parameters\n        ----------\n        image : `numpy.ndarray`\n            The image that should be compared to the original image.\n\n        Returns\n        -------\n        :class:`Distance`\n            The distance between the given image and the original image.", "docstring_tokens": ["Calculates", "the", "distance", "of", "a", "given", "image", "to", "the", "original", "image", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 259250}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1918-L1937", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Writes the given content to a local temporary file.", "language": "python", "parameters": "(content, *args, **kwargs)", "return_statement": "return tmp_fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "get_dryrun", "(", "arg_2", ".", "get", "(", "'dryrun'", ")", ")", "if", "arg_3", ":", "arg_4", ",", "arg_5", "=", "tempfile", ".", "mkstemp", "(", ")", "os", ".", "remove", "(", "arg_5", ")", "arg_6", "=", "'local'", "arg_7", "=", "'cat <<EOT >> %s\\n%s\\nEOT'", "%", "(", "arg_5", ",", "arg_0", ")", "if", "BURLAP_COMMAND_PREFIX", ":", "print", "(", "'%s %s: %s'", "%", "(", "render_command_prefix", "(", ")", ",", "arg_6", ",", "arg_7", ")", ")", "else", ":", "print", "(", "arg_7", ")", "else", ":", "arg_4", ",", "arg_5", "=", "tempfile", ".", "mkstemp", "(", ")", "arg_8", "=", "open", "(", "arg_5", ",", "'w'", ")", "arg_8", ".", "write", "(", "arg_0", ")", "arg_8", ".", "close", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"\n    Writes the given content to a local temporary file.\n    \"\"\"\n    arg_3 = get_dryrun(arg_2.get('dryrun'))\n    if arg_3:\n        arg_4, arg_5 = tempfile.mkstemp()\n        os.remove(arg_5)\n        arg_6 = 'local'\n        arg_7 = 'cat <<EOT >> %s\\n%s\\nEOT' % (arg_5, arg_0)\n        if BURLAP_COMMAND_PREFIX:\n            print('%s %s: %s' % (render_command_prefix(), arg_6, arg_7))\n        else:\n            print(arg_7)\n    else:\n        arg_4, arg_5 = tempfile.mkstemp()\n        arg_8 = open(arg_5, 'w')\n        arg_8.write(arg_0)\n        arg_8.close()\n    return arg_5", "path": "burlap/common.py", "identifier": "write_temp_file_or_dryrun", "docstring": "Writes the given content to a local temporary file.", "docstring_tokens": ["Writes", "the", "given", "content", "to", "a", "local", "temporary", "file", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259251}
{"url": "https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/giraffez/load.py#L180-L200", "sha": "6b4d27eb1a1eaf188c6885c7364ef27e92b1b957", "docstring_summary": "Finishes the load job. Called automatically when the connection closes.", "language": "python", "parameters": "(self)", "return_statement": "return self.exit_code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "Funced", ":", "return", "arg_0", ".", "exit_code", "arg_1", "=", "arg_0", ".", "checkpoint", "(", ")", "arg_0", ".", "exit_code", "=", "arg_0", ".", "_exit_code", "(", ")", "if", "arg_0", ".", "exit_code", "!=", "0", ":", "raise", "TeradataPTError", "(", "\"BulkLoad job Funced with return code '{}'\"", ".", "format", "(", "arg_0", ".", "exit_code", ")", ")", "if", "arg_0", ".", "applied_count", ">", "0", ":", "arg_0", ".", "_end_acquisition", "(", ")", "arg_0", ".", "_apply_rows", "(", ")", "arg_0", ".", "exit_code", "=", "arg_0", ".", "_exit_code", "(", ")", "if", "arg_0", ".", "exit_code", "!=", "0", ":", "raise", "TeradataPTError", "(", "\"BulkLoad job Funced with return code '{}'\"", ".", "format", "(", "arg_0", ".", "exit_code", ")", ")", "arg_0", ".", "Funced", "=", "True", "return", "arg_0", ".", "exit_code"], "function": "def Func(arg_0):\n        \"\"\"\n        Finishes the load job. Called automatically when the connection closes.\n\n        :return: The exit code returned when applying rows to the table\n        \"\"\"\n        if arg_0.Funced:\n            return arg_0.exit_code\n        arg_1 = arg_0.checkpoint()\n        arg_0.exit_code = arg_0._exit_code()\n        if arg_0.exit_code != 0:\n            raise TeradataPTError(\"BulkLoad job Funced with return code '{}'\".format(arg_0.exit_code))\n        # TODO(chris): should this happen every time?\n        if arg_0.applied_count > 0:\n            arg_0._end_acquisition()\n            arg_0._apply_rows()\n        arg_0.exit_code = arg_0._exit_code()\n        if arg_0.exit_code != 0:\n            raise TeradataPTError(\"BulkLoad job Funced with return code '{}'\".format(arg_0.exit_code))\n        arg_0.Funced = True\n        return arg_0.exit_code", "path": "giraffez/load.py", "identifier": "TeradataBulkLoad.finish", "docstring": "Finishes the load job. Called automatically when the connection closes.\n\n        :return: The exit code returned when applying rows to the table", "docstring_tokens": ["Finishes", "the", "load", "job", ".", "Called", "automatically", "when", "the", "connection", "closes", "."], "nwo": "capitalone/giraffez", "score": 0.19842634881568408, "idx": 259252}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L630-L636", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Get the file from an specific item", "language": "python", "parameters": "(self, item, **kwargs)", "return_statement": "return self._build_query(query_string, no_params=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "\"/{t}/{u}/items/{i}/Func\"", ".", "format", "(", "u", "=", "arg_0", ".", "library_id", ",", "t", "=", "arg_0", ".", "library_type", ",", "i", "=", "arg_1", ".", "upper", "(", ")", ")", "return", "arg_0", ".", "_build_query", "(", "arg_3", ",", "no_params", "=", "True", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\" Get the Func from an specific item\n        \"\"\"\n        arg_3 = \"/{t}/{u}/items/{i}/Func\".format(\n            u=arg_0.library_id, t=arg_0.library_type, i=arg_1.upper()\n        )\n        return arg_0._build_query(arg_3, no_params=True)", "path": "pyzotero/zotero.py", "identifier": "Zotero.file", "docstring": "Get the file from an specific item", "docstring_tokens": ["Get", "the", "file", "from", "an", "specific", "item"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 259253}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1016-L1050", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the intersection of each color's context.", "language": "python", "parameters": "(self)", "return_statement": "return overlap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "[", "]", "if", "arg_2", ".", "is_black", ":", "arg_4", "=", "\"black\"", "elif", "arg_2", ".", "is_white", ":", "arg_4", "=", "\"white\"", "elif", "arg_2", ".", "is_grey", ":", "arg_4", "=", "\"grey\"", "else", ":", "arg_4", "=", "arg_2", ".", "nearest_hue", "(", "primary", "=", "True", ")", "if", "arg_4", "==", "\"orange\"", "and", "arg_2", ".", "brightness", "<", "0.6", ":", "arg_4", "=", "\"brown\"", "arg_5", "=", "context", "[", "arg_4", "]", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_5", "else", ":", "for", "arg_6", "in", "arg_5", ":", "if", "arg_6", "in", "arg_1", ":", "if", "arg_6", "not", "in", "arg_3", ":", "arg_3", ".", "append", "(", "arg_6", ")", "arg_1", "=", "arg_3", "arg_3", ".", "sort", "(", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the intersection of each color's context.\n\n        Get the nearest named hue of each color,\n        and finds overlapping tags in each hue's colors.\n        For example, a list containing yellow, deeppink and olive\n        yields: femininity, friendship, happiness, joy.\n\n        \"\"\"\n        arg_1 = None\n        for arg_2 in arg_0:\n            arg_3 = []\n            if arg_2.is_black:\n                arg_4 = \"black\"\n            elif arg_2.is_white:\n                arg_4 = \"white\"\n            elif arg_2.is_grey:\n                arg_4 = \"grey\"\n            else:\n                arg_4 = arg_2.nearest_hue(primary=True)\n            if arg_4 == \"orange\" and arg_2.brightness < 0.6:\n                arg_4 = \"brown\"\n            arg_5 = context[arg_4]\n            if arg_1 is None:\n                arg_1 = arg_5\n            else:\n                for arg_6 in arg_5:\n                    if arg_6 in arg_1:\n                        if arg_6 not in arg_3:\n                            arg_3.append(arg_6)\n                arg_1 = arg_3\n\n        arg_3.sort()\n        return arg_3", "path": "lib/colors/__init__.py", "identifier": "ColorList._context", "docstring": "Returns the intersection of each color's context.\n\n        Get the nearest named hue of each color,\n        and finds overlapping tags in each hue's colors.\n        For example, a list containing yellow, deeppink and olive\n        yields: femininity, friendship, happiness, joy.", "docstring_tokens": ["Returns", "the", "intersection", "of", "each", "color", "s", "context", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259254}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/arthur.py#L120-L137", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Check that the task arguments received are valid", "language": "python", "parameters": "(task_id, backend, category, backend_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "arg_0", "or", "arg_0", ".", "strip", "(", ")", "==", "\"\"", ":", "arg_4", "=", "\"Missing task_id for task\"", "raise", "ValueError", "(", "arg_4", ")", "if", "not", "arg_1", "or", "arg_1", ".", "strip", "(", ")", "==", "\"\"", ":", "arg_4", "=", "\"Missing backend for task '%s'\"", "%", "arg_0", "raise", "ValueError", "(", "arg_4", ")", "if", "arg_3", "and", "not", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "arg_4", "=", "\"Backend_args is not a dict, task '%s'\"", "%", "arg_0", "raise", "ValueError", "(", "arg_4", ")", "if", "not", "arg_2", "or", "arg_2", ".", "strip", "(", ")", "==", "\"\"", ":", "arg_4", "=", "\"Missing category for task '%s'\"", "%", "arg_0", "raise", "ValueError", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Check that the task arguments received are valid\"\"\"\n\n        if not arg_0 or arg_0.strip() == \"\":\n            arg_4 = \"Missing task_id for task\"\n            raise ValueError(arg_4)\n\n        if not arg_1 or arg_1.strip() == \"\":\n            arg_4 = \"Missing backend for task '%s'\" % arg_0\n            raise ValueError(arg_4)\n\n        if arg_3 and not isinstance(arg_3, dict):\n            arg_4 = \"Backend_args is not a dict, task '%s'\" % arg_0\n            raise ValueError(arg_4)\n\n        if not arg_2 or arg_2.strip() == \"\":\n            arg_4 = \"Missing category for task '%s'\" % arg_0\n            raise ValueError(arg_4)", "path": "arthur/arthur.py", "identifier": "Arthur.__validate_args", "docstring": "Check that the task arguments received are valid", "docstring_tokens": ["Check", "that", "the", "task", "arguments", "received", "are", "valid"], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 259255}
{"url": "https://github.com/bruth/cypher/blob/4f962f51539ac5a667ab5a050b6b4052d4c10c0f/cypher/shortcuts.py#L5-L23", "sha": "4f962f51539ac5a667ab5a050b6b4052d4c10c0f", "docstring_summary": "Query to test if a value exists.", "language": "python", "parameters": "(value)", "return_statement": "return Query([\n        OptionalMatch(value),\n        Return(Predicate(ident, 'IS NOT NULL')),\n        Limit(1),\n    ])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "Token", ")", ":", "raise", "TypeError", "(", "'value must be a token'", ")", "if", "not", "hasattr", "(", "arg_0", ",", "'identifier'", ")", ":", "raise", "TypeError", "(", "'value must support an identifier'", ")", "if", "not", "arg_0", ".", "identifier", ":", "arg_0", "=", "arg_0", ".", "__class__", "(", "**", "arg_0", ".", "__dict__", ")", "arg_0", ".", "identifier", "=", "'v'", "arg_2", "=", "Identifier", "(", "arg_0", ".", "identifier", ")", "return", "Query", "(", "[", "OptionalMatch", "(", "arg_0", ")", ",", "Return", "(", "Predicate", "(", "arg_2", ",", "'IS NOT NULL'", ")", ")", ",", "Limit", "(", "1", ")", ",", "]", ")"], "function": "def Func(arg_0):\n    \"Query to test if a value Func.\"\n    if not isinstance(arg_0, Token):\n        raise TypeError('value must be a token')\n\n    if not hasattr(arg_0, 'identifier'):\n        raise TypeError('value must support an identifier')\n\n    if not arg_0.identifier:\n        arg_0 = arg_0.__class__(**arg_0.__dict__)\n        arg_0.identifier = 'v'\n\n    arg_2 = Identifier(arg_0.identifier)\n\n    return Query([\n        OptionalMatch(arg_0),\n        Return(Predicate(arg_2, 'IS NOT NULL')),\n        Limit(1),\n    ])", "path": "cypher/shortcuts.py", "identifier": "exists", "docstring": "Query to test if a value exists.", "docstring_tokens": ["Query", "to", "test", "if", "a", "value", "exists", "."], "nwo": "bruth/cypher", "score": 0.2757871243566705, "idx": 259256}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L909-L922", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Factory for loading the image from a .fits file", "language": "python", "parameters": "(image_path, image_hdu, pixel_scale)", "return_statement": "return ScaledSquarePixelArray.from_fits_with_pixel_scale(file_path=image_path, hdu=image_hdu,\n                                                             pixel_scale=pixel_scale)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "ScaledSquarePixelArray", ".", "from_fits_with_pixel_scale", "(", "file_path", "=", "arg_0", ",", "hdu", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Factory for loading the image from a .fits file\n\n    Parameters\n    ----------\n    image_path : str\n        The path to the image .fits file containing the image (e.g. '/path/to/image.fits')\n    image_hdu : int\n        The hdu the image is contained in the .fits file specified by *image_path*.\n    pixel_scale : float\n        The size of each pixel in arc seconds..\n    \"\"\"\n    return ScaledSquarePixelArray.from_fits_with_pixel_scale(file_path=arg_0, hdu=arg_1,\n                                                             arg_2=arg_2)", "path": "autolens/data/ccd.py", "identifier": "load_image", "docstring": "Factory for loading the image from a .fits file\n\n    Parameters\n    ----------\n    image_path : str\n        The path to the image .fits file containing the image (e.g. '/path/to/image.fits')\n    image_hdu : int\n        The hdu the image is contained in the .fits file specified by *image_path*.\n    pixel_scale : float\n        The size of each pixel in arc seconds..", "docstring_tokens": ["Factory", "for", "loading", "the", "image", "from", "a", ".", "fits", "file"], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 259257}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L616-L627", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Search for HPO terms.", "language": "python", "parameters": "()", "return_statement": "return jsonify(json_terms)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "request", ".", "args", ".", "get", "(", "'query'", ")", "if", "arg_0", "is", "None", ":", "return", "abort", "(", "500", ")", "arg_1", "=", "sorted", "(", "store", ".", "hpo_terms", "(", "arg_0", "=", "arg_0", ")", ",", "key", "=", "itemgetter", "(", "'hpo_number'", ")", ")", "arg_2", "=", "[", "{", "'name'", ":", "'{} | {}'", ".", "format", "(", "term", "[", "'_id'", "]", ",", "term", "[", "'description'", "]", ")", ",", "'id'", ":", "term", "[", "'_id'", "]", "}", "for", "term", "in", "arg_1", "[", ":", "7", "]", "]", "return", "jsonify", "(", "arg_2", ")"], "function": "def Func():\n    \"\"\"Search for HPO terms.\"\"\"\n    arg_0 = request.args.get('query')\n    if arg_0 is None:\n        return abort(500)\n    arg_1 = sorted(store.hpo_terms(arg_0=arg_0), key=itemgetter('hpo_number'))\n    arg_2 = [\n        {'name': '{} | {}'.format(term['_id'], term['description']),\n         'id': term['_id']\n        } for term in arg_1[:7]]\n\n    return jsonify(arg_2)", "path": "scout/server/blueprints/cases/views.py", "identifier": "hpoterms", "docstring": "Search for HPO terms.", "docstring_tokens": ["Search", "for", "HPO", "terms", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259258}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/layers/util.py#L39-L116", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Makes closure which creates `loc`, `scale` params from `tf.get_variable`.", "language": "python", "parameters": "(\n    is_singular=False,\n    loc_initializer=tf.compat.v1.initializers.random_normal(stddev=0.1),\n    untransformed_scale_initializer=tf.compat.v1.initializers.random_normal(\n        mean=-3., stddev=0.1),\n    loc_regularizer=None,\n    untransformed_scale_regularizer=None,\n    loc_constraint=None,\n    untransformed_scale_constraint=None)", "return_statement": "return _fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ",", "arg_1", "=", "arg_2", ".", "compat", ".", "v1", ".", "initializers", ".", "random_normal", "(", "arg_7", "=", "0.1", ")", ",", "arg_8", "=", "arg_2", ".", "compat", ".", "v1", ".", "initializers", ".", "random_normal", "(", "arg_9", "=", "-", "3.", ",", "arg_7", "=", "0.1", ")", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "None", ")", ":", "def", "_fn", "(", "arg_14", ",", "arg_15", ",", "arg_16", ",", "arg_17", ",", "arg_18", ")", ":", "arg_19", "=", "arg_18", "(", "arg_16", "=", "arg_16", "+", "'_loc'", ",", "arg_15", "=", "arg_15", ",", "initializer", "=", "arg_1", ",", "regularizer", "=", "arg_10", ",", "constraint", "=", "arg_12", ",", "arg_14", "=", "arg_14", ",", "arg_17", "=", "arg_17", ")", "if", "arg_0", ":", "return", "arg_19", ",", "None", "arg_20", "=", "arg_18", "(", "arg_16", "=", "arg_16", "+", "'_untransformed_scale'", ",", "arg_15", "=", "arg_15", ",", "initializer", "=", "arg_8", ",", "regularizer", "=", "arg_11", ",", "constraint", "=", "arg_13", ",", "arg_14", "=", "arg_14", ",", "arg_17", "=", "arg_17", ")", "arg_21", "=", "(", "np", ".", "finfo", "(", "arg_14", ".", "as_numpy_dtype", ")", ".", "eps", "+", "arg_2", ".", "nn", ".", "softplus", "(", "arg_20", ")", ")", "return", "arg_19", ",", "arg_21", "return", "_fn"], "function": "def Func(\n    arg_0=False,\n    arg_1=arg_2.compat.v1.initializers.random_normal(arg_7=0.1),\n    arg_8=arg_2.compat.v1.initializers.random_normal(\n        arg_9=-3., arg_7=0.1),\n    arg_10=None,\n    arg_11=None,\n    arg_12=None,\n    arg_13=None):\n  \"\"\"Makes closure which creates `loc`, `scale` params from `tf.get_variable`.\n\n  This function produces a closure which produces `loc`, `scale` using\n  `tf.get_variable`. The closure accepts the following arguments:\n\n    dtype: Type of parameter's event.\n    shape: Python `list`-like representing the parameter's event shape.\n    name: Python `str` name prepended to any created (or existing)\n      `tf.Variable`s.\n    trainable: Python `bool` indicating all created `tf.Variable`s should be\n      added to the graph collection `GraphKeys.TRAINABLE_VARIABLES`.\n    add_variable_fn: `tf.get_variable`-like `callable` used to create (or\n      access existing) `tf.Variable`s.\n\n  Args:\n    is_singular: Python `bool` indicating if `scale is None`. Default: `False`.\n    loc_initializer: Initializer function for the `loc` parameters.\n      The default is `tf.random_normal_initializer(mean=0., stddev=0.1)`.\n    untransformed_scale_initializer: Initializer function for the `scale`\n      parameters. Default value: `tf.random_normal_initializer(mean=-3.,\n      stddev=0.1)`. This implies the softplus transformed result is initialized\n      near `0`. It allows a `Normal` distribution with `scale` parameter set to\n      this value to approximately act like a point mass.\n    loc_regularizer: Regularizer function for the `loc` parameters.\n      The default (`None`) is to use the `tf.get_variable` default.\n    untransformed_scale_regularizer: Regularizer function for the `scale`\n      parameters. The default (`None`) is to use the `tf.get_variable` default.\n    loc_constraint: An optional projection function to be applied to the\n      loc after being updated by an `Optimizer`. The function must take as input\n      the unprojected variable and must return the projected variable (which\n      must have the same shape). Constraints are not safe to use when doing\n      asynchronous distributed training.\n      The default (`None`) is to use the `tf.get_variable` default.\n    untransformed_scale_constraint: An optional projection function to be\n      applied to the `scale` parameters after being updated by an `Optimizer`\n      (e.g. used to implement norm constraints or value constraints). The\n      function must take as input the unprojected variable and must return the\n      projected variable (which must have the same shape). Constraints are not\n      safe to use when doing asynchronous distributed training. The default\n      (`None`) is to use the `tf.get_variable` default.\n\n  Returns:\n    Func: Python `callable` which instantiates `loc`, `scale`\n    parameters from args: `dtype, shape, name, trainable, add_variable_fn`.\n  \"\"\"\n  def _fn(arg_14, arg_15, arg_16, arg_17, arg_18):\n    \"\"\"Creates `loc`, `scale` parameters.\"\"\"\n    arg_19 = arg_18(\n        arg_16=arg_16 + '_loc',\n        arg_15=arg_15,\n        initializer=arg_1,\n        regularizer=arg_10,\n        constraint=arg_12,\n        arg_14=arg_14,\n        arg_17=arg_17)\n    if arg_0:\n      return arg_19, None\n    arg_20 = arg_18(\n        arg_16=arg_16 + '_untransformed_scale',\n        arg_15=arg_15,\n        initializer=arg_8,\n        regularizer=arg_11,\n        constraint=arg_13,\n        arg_14=arg_14,\n        arg_17=arg_17)\n    arg_21 = (np.finfo(arg_14.as_numpy_dtype).eps +\n             arg_2.nn.softplus(arg_20))\n    return arg_19, arg_21\n  return _fn", "path": "tensorflow_probability/python/layers/util.py", "identifier": "default_loc_scale_fn", "docstring": "Makes closure which creates `loc`, `scale` params from `tf.get_variable`.\n\n  This function produces a closure which produces `loc`, `scale` using\n  `tf.get_variable`. The closure accepts the following arguments:\n\n    dtype: Type of parameter's event.\n    shape: Python `list`-like representing the parameter's event shape.\n    name: Python `str` name prepended to any created (or existing)\n      `tf.Variable`s.\n    trainable: Python `bool` indicating all created `tf.Variable`s should be\n      added to the graph collection `GraphKeys.TRAINABLE_VARIABLES`.\n    add_variable_fn: `tf.get_variable`-like `callable` used to create (or\n      access existing) `tf.Variable`s.\n\n  Args:\n    is_singular: Python `bool` indicating if `scale is None`. Default: `False`.\n    loc_initializer: Initializer function for the `loc` parameters.\n      The default is `tf.random_normal_initializer(mean=0., stddev=0.1)`.\n    untransformed_scale_initializer: Initializer function for the `scale`\n      parameters. Default value: `tf.random_normal_initializer(mean=-3.,\n      stddev=0.1)`. This implies the softplus transformed result is initialized\n      near `0`. It allows a `Normal` distribution with `scale` parameter set to\n      this value to approximately act like a point mass.\n    loc_regularizer: Regularizer function for the `loc` parameters.\n      The default (`None`) is to use the `tf.get_variable` default.\n    untransformed_scale_regularizer: Regularizer function for the `scale`\n      parameters. The default (`None`) is to use the `tf.get_variable` default.\n    loc_constraint: An optional projection function to be applied to the\n      loc after being updated by an `Optimizer`. The function must take as input\n      the unprojected variable and must return the projected variable (which\n      must have the same shape). Constraints are not safe to use when doing\n      asynchronous distributed training.\n      The default (`None`) is to use the `tf.get_variable` default.\n    untransformed_scale_constraint: An optional projection function to be\n      applied to the `scale` parameters after being updated by an `Optimizer`\n      (e.g. used to implement norm constraints or value constraints). The\n      function must take as input the unprojected variable and must return the\n      projected variable (which must have the same shape). Constraints are not\n      safe to use when doing asynchronous distributed training. The default\n      (`None`) is to use the `tf.get_variable` default.\n\n  Returns:\n    default_loc_scale_fn: Python `callable` which instantiates `loc`, `scale`\n    parameters from args: `dtype, shape, name, trainable, add_variable_fn`.", "docstring_tokens": ["Makes", "closure", "which", "creates", "loc", "scale", "params", "from", "tf", ".", "get_variable", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259259}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/api.py#L350-L360", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Update selected keys.", "language": "python", "parameters": "(self, record)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "dumps", "(", ")", "arg_2", "[", "'_deposit'", "]", "[", "'pid'", "]", "[", "'revision_id'", "]", "=", "arg_1", ".", "revision_id", "arg_2", "[", "'_deposit'", "]", "[", "'status'", "]", "=", "'draft'", "arg_2", "[", "'$schema'", "]", "=", "arg_0", ".", "build_deposit_schema", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update selected keys.\n\n        :param record: The record to prepare.\n        \"\"\"\n        arg_2 = arg_1.dumps()\n        # Keep current record revision for merging.\n        arg_2['_deposit']['pid']['revision_id'] = arg_1.revision_id\n        arg_2['_deposit']['status'] = 'draft'\n        arg_2['$schema'] = arg_0.build_deposit_schema(arg_1)\n        return arg_2", "path": "invenio_deposit/api.py", "identifier": "Deposit._prepare_edit", "docstring": "Update selected keys.\n\n        :param record: The record to prepare.", "docstring_tokens": ["Update", "selected", "keys", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 259260}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/utils.py#L120-L154", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Sonifies the estimated times into the output file.", "language": "python", "parameters": "(audio, clicks, out_file, fs, offset=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "arg_1", "+", "arg_4", "arg_6", "=", "np", ".", "sin", "(", "2", "*", "np", ".", "pi", "*", "np", ".", "arange", "(", "arg_3", "*", ".1", ")", "*", "1000", "/", "(", "1.", "*", "arg_3", ")", ")", "arg_6", "*=", "np", ".", "exp", "(", "-", "np", ".", "arange", "(", "arg_3", "*", ".1", ")", "/", "(", "arg_3", "*", ".01", ")", ")", "arg_7", "=", "int", "(", "arg_5", ".", "max", "(", ")", "*", "arg_3", "+", "arg_6", ".", "shape", "[", "0", "]", "+", "1", ")", "arg_8", "=", "mir_eval", ".", "sonify", ".", "clicks", "(", "arg_5", ",", "arg_3", ",", "arg_7", "=", "arg_7", ")", "arg_9", "=", "np", ".", "zeros", "(", "max", "(", "arg_10", "(", "arg_0", ")", ",", "arg_10", "(", "arg_8", ")", ")", ")", "arg_9", "[", ":", "arg_10", "(", "arg_0", ")", "]", "=", "arg_0", "arg_9", "[", ":", "arg_10", "(", "arg_8", ")", "]", "+=", "arg_8", "scipy", ".", "io", ".", "wavfile", ".", "write", "(", "arg_2", ",", "arg_3", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0):\n    \"\"\"Sonifies the estimated times into the output file.\n\n    Parameters\n    ----------\n    audio: np.array\n        Audio samples of the input track.\n    clicks: np.array\n        Click positions in seconds.\n    out_file: str\n        Path to the output file.\n    fs: int\n        Sample rate.\n    offset: float\n        Offset of the clicks with respect to the audio.\n    \"\"\"\n    # Generate clicks (this should be done by mir_eval, but its\n    # latest release is not compatible with latest numpy)\n    arg_5 = arg_1 + arg_4\n    # 1 kHz tone, 100ms\n    arg_6 = np.sin(2 * np.pi * np.arange(arg_3 * .1) * 1000 / (1. * arg_3))\n    # Exponential decay\n    arg_6 *= np.exp(-np.arange(arg_3 * .1) / (arg_3 * .01))\n    arg_7 = int(arg_5.max() * arg_3 + arg_6.shape[0] + 1)\n    arg_8 = mir_eval.sonify.clicks(arg_5, arg_3, arg_7=arg_7)\n\n    # Create array to store the audio plus the clicks\n    arg_9 = np.zeros(max(arg_10(arg_0), arg_10(arg_8)))\n\n    # Assign the audio and the clicks\n    arg_9[:arg_10(arg_0)] = arg_0\n    arg_9[:arg_10(arg_8)] += arg_8\n\n    # Write to file\n    scipy.io.wavfile.write(arg_2, arg_3, arg_9)", "path": "msaf/utils.py", "identifier": "sonify_clicks", "docstring": "Sonifies the estimated times into the output file.\n\n    Parameters\n    ----------\n    audio: np.array\n        Audio samples of the input track.\n    clicks: np.array\n        Click positions in seconds.\n    out_file: str\n        Path to the output file.\n    fs: int\n        Sample rate.\n    offset: float\n        Offset of the clicks with respect to the audio.", "docstring_tokens": ["Sonifies", "the", "estimated", "times", "into", "the", "output", "file", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 259261}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/compiler.py#L352-L358", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Convert an AST terminal to python source code.", "language": "python", "parameters": "(self, terminal, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "_replace", "(", "arg_1", ".", "value", ")", "if", "arg_0", ".", "use_terminal_shorthand", ":", "return", "[", "arg_3", "]", "else", ":", "return", "[", "\"terminal({})\"", ".", "format", "(", "arg_3", ")", "]"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Convert an AST terminal to python source code.\"\"\"\n    arg_3 = _replace(arg_1.value)\n    if arg_0.use_terminal_shorthand:\n      return [arg_3]\n    else:\n      return [\"terminal({})\".format(arg_3)]", "path": "pyebnf/compiler.py", "identifier": "Compiler._ast_terminal_to_code", "docstring": "Convert an AST terminal to python source code.", "docstring_tokens": ["Convert", "an", "AST", "terminal", "to", "python", "source", "code", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 259262}
{"url": "https://github.com/prashnts/revisions/blob/a3c65d068e09e717df5389e924686da540da6f12/revisions/core.py#L30-L50", "sha": "a3c65d068e09e717df5389e924686da540da6f12", "docstring_summary": "Obtain particular version of the doc at key.", "language": "python", "parameters": "(self, key, version, **kwa)", "return_statement": "return pickle.loads(coded_val)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "if", "'_doc'", "in", "arg_3", ":", "arg_4", "=", "arg_3", "[", "'_doc'", "]", "else", ":", "if", "type", "(", "arg_2", ")", "is", "int", ":", "if", "arg_2", "==", "0", ":", "arg_5", "=", "pymongo", ".", "ASCENDING", "elif", "arg_2", "==", "-", "1", ":", "arg_5", "=", "pymongo", ".", "DESCENDING", "arg_4", "=", "arg_0", ".", "_collection", ".", "find_one", "(", "{", "'k'", ":", "arg_1", "}", ",", "sort", "=", "[", "[", "'d'", ",", "arg_5", "]", "]", ")", "elif", "type", "(", "arg_2", ")", "is", "datetime", ":", "arg_6", "=", "arg_0", ".", "__round_time", "(", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_collection", ".", "find_one", "(", "{", "'k'", ":", "arg_1", ",", "'d'", ":", "arg_6", "}", ")", "if", "arg_4", "is", "None", ":", "raise", "KeyError", "(", "'Supplied key `{0}` or version `{1}` does not exist'", ".", "format", "(", "arg_1", ",", "str", "(", "arg_2", ")", ")", ")", "arg_7", "=", "arg_4", "[", "'v'", "]", "return", "pickle", ".", "loads", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n    '''Obtain particular version of the doc at key.'''\n    if '_doc' in arg_3:\n      arg_4 = arg_3['_doc']\n    else:\n      if type(arg_2) is int:\n        if arg_2 == 0:\n          arg_5 = pymongo.ASCENDING\n        elif arg_2 == -1:\n          arg_5 = pymongo.DESCENDING\n        arg_4 = arg_0._collection.find_one({'k': arg_1}, sort=[['d', arg_5]])\n      elif type(arg_2) is datetime:\n        arg_6 = arg_0.__round_time(arg_2)\n        arg_4 = arg_0._collection.find_one({'k': arg_1, 'd': arg_6})\n\n    if arg_4 is None:\n      raise KeyError('Supplied key `{0}` or version `{1}` does not exist'\n          .format(arg_1, str(arg_2)))\n\n    arg_7 = arg_4['v']\n    return pickle.loads(arg_7)", "path": "revisions/core.py", "identifier": "RevisionCollection.__get_rev", "docstring": "Obtain particular version of the doc at key.", "docstring_tokens": ["Obtain", "particular", "version", "of", "the", "doc", "at", "key", "."], "nwo": "prashnts/revisions", "score": 0.21302904236143622, "idx": 259263}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L2455-L2497", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Merges trajectories by loading iteratively items of the other trajectory and\n        store it into the current trajectory.", "language": "python", "parameters": "(self, other_trajectory, rename_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "arg_2", "[", "arg_3", "]", "arg_5", "=", "arg_1", ".", "f_get", "(", "arg_3", ")", "if", "arg_5", ".", "f_is_empty", "(", ")", ":", "with", "arg_0", ".", "_nn_interface", ".", "_disable_logging", ":", "arg_1", ".", "f_load_item", "(", "arg_5", ")", "if", "not", "arg_0", ".", "f_contains", "(", "arg_4", ")", ":", "arg_6", "=", "arg_5", ".", "f_get_class_name", "(", ")", "arg_7", "=", "arg_0", ".", "_create_class", "(", "arg_6", ")", "arg_8", "=", "arg_0", ".", "f_add_leaf", "(", "arg_7", ",", "arg_4", ")", "else", ":", "arg_8", "=", "arg_0", ".", "f_get", "(", "arg_4", ",", "shortcuts", "=", "False", ")", "if", "not", "arg_8", ".", "f_is_empty", "(", ")", ":", "raise", "RuntimeError", "(", "'Something is wrong! Your item `%s` should be empty.'", "%", "arg_4", ")", "arg_9", "=", "arg_5", ".", "_store", "(", ")", "arg_8", ".", "_load", "(", "arg_9", ")", "arg_8", ".", "f_set_annotations", "(", "**", "arg_5", ".", "v_annotations", ".", "f_to_dict", "(", "copy", "=", "False", ")", ")", "arg_8", ".", "v_comment", "=", "arg_5", ".", "v_comment", "arg_0", ".", "f_store_item", "(", "arg_8", ")", "if", "arg_5", ".", "v_is_parameter", ":", "arg_5", ".", "f_unlock", "(", ")", "arg_8", ".", "f_unlock", "(", ")", "arg_5", ".", "f_empty", "(", ")", "arg_8", ".", "f_empty", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Merges trajectories by loading iteratively items of the other trajectory and\n        store it into the current trajectory.\n\n        :param rename_dict:\n\n            Dictionary containing mappings from the old result names in the `other_trajectory`\n            to the new names in the current trajectory.\n\n        \"\"\"\n        for arg_3 in arg_2:\n            arg_4 = arg_2[arg_3]\n\n            arg_5 = arg_1.f_get(arg_3)\n\n            if arg_5.f_is_empty():\n                # To suppress warnings if nothing needs to be loaded\n                with arg_0._nn_interface._disable_logging:\n                    arg_1.f_load_item(arg_5)\n\n            if not arg_0.f_contains(arg_4):\n                arg_6 = arg_5.f_get_class_name()\n                arg_7 = arg_0._create_class(arg_6)\n                arg_8 = arg_0.f_add_leaf(arg_7, arg_4)\n            else:\n                arg_8 = arg_0.f_get(arg_4, shortcuts=False)\n\n            if not arg_8.f_is_empty():\n                raise RuntimeError('Something is wrong! Your item `%s` should be empty.' % arg_4)\n\n            arg_9 = arg_5._store()\n            arg_8._load(arg_9)\n            arg_8.f_set_annotations(**arg_5.v_annotations.f_to_dict(copy=False))\n            arg_8.v_comment = arg_5.v_comment\n\n            arg_0.f_store_item(arg_8)\n\n            # We do not want to blow up the RAM Memory\n            if arg_5.v_is_parameter:\n                arg_5.f_unlock()\n                arg_8.f_unlock()\n            arg_5.f_empty()\n            arg_8.f_empty()", "path": "pypet/trajectory.py", "identifier": "Trajectory._merge_slowly", "docstring": "Merges trajectories by loading iteratively items of the other trajectory and\n        store it into the current trajectory.\n\n        :param rename_dict:\n\n            Dictionary containing mappings from the old result names in the `other_trajectory`\n            to the new names in the current trajectory.", "docstring_tokens": ["Merges", "trajectories", "by", "loading", "iteratively", "items", "of", "the", "other", "trajectory", "and", "store", "it", "into", "the", "current", "trajectory", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259264}
{"url": "https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/utils/images.py#L60-L85", "sha": "e6994b1b1826af2720a091d1bff5ca15594f558d", "docstring_summary": "\\\n        Writes an image src http string to disk as a temporary file\n        and returns the LocallyStoredImage object\n        that has the info you should need on the image", "language": "python", "parameters": "(cls, http_client, link_hash, src, config)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "read_localfile", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "if", "arg_5", ":", "return", "arg_5", "if", "arg_3", ".", "startswith", "(", "'data:image'", ")", ":", "arg_5", "=", "arg_0", ".", "write_localfile_base64", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "return", "arg_5", "arg_6", "=", "arg_1", ".", "fetch", "(", "arg_3", ")", "if", "arg_6", ":", "arg_5", "=", "arg_0", ".", "write_localfile", "(", "arg_6", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "if", "arg_5", ":", "return", "arg_5", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\\\n        Writes an image src http string to disk as a temporary file\n        and returns the LocallyStoredImage object\n        that has the info you should need on the image\n        \"\"\"\n        # check for a cache hit already on disk\n        arg_5 = arg_0.read_localfile(arg_2, arg_3, arg_4)\n        if arg_5:\n            return arg_5\n\n        # no cache found; do something else\n\n        # parse base64 image\n        if arg_3.startswith('data:image'):\n            arg_5 = arg_0.write_localfile_base64(arg_2, arg_3, arg_4)\n            return arg_5\n\n        # download the image\n        arg_6 = arg_1.fetch(arg_3)\n        if arg_6:\n            arg_5 = arg_0.write_localfile(arg_6, arg_2, arg_3, arg_4)\n            if arg_5:\n                return arg_5\n\n        return None", "path": "goose3/utils/images.py", "identifier": "ImageUtils.store_image", "docstring": "\\\n        Writes an image src http string to disk as a temporary file\n        and returns the LocallyStoredImage object\n        that has the info you should need on the image", "docstring_tokens": ["\\", "Writes", "an", "image", "src", "http", "string", "to", "disk", "as", "a", "temporary", "file", "and", "returns", "the", "LocallyStoredImage", "object", "that", "has", "the", "info", "you", "should", "need", "on", "the", "image"], "nwo": "goose3/goose3", "score": 0.5494430231474424, "idx": 259265}
{"url": "https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/model/cnn.py#L103-L177", "sha": "1436e0bf72803e02ccf727f41e8fc85ba167d9fe", "docstring_summary": "Fit KimCNNClassifier according to X, y", "language": "python", "parameters": "(self, X, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "WordVectorTransformer", "(", "padding", "=", "'max'", ")", "arg_1", "=", "arg_3", ".", "Func_transform", "(", "arg_1", ")", "arg_1", "=", "LongTensor", "(", "arg_1", ")", "arg_0", ".", "word_vector_transformer", "=", "arg_3", "arg_4", "=", "LabelEncoder", "(", ")", "arg_2", "=", "arg_4", ".", "Func_transform", "(", "arg_2", ")", "arg_2", "=", "torch", ".", "from_numpy", "(", "arg_2", ")", "arg_0", ".", "y_transformer", "=", "arg_4", "arg_5", "=", "CategorizedDataset", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "DataLoader", "(", "arg_5", ",", "batch_size", "=", "arg_0", ".", "batch_size", ",", "shuffle", "=", "True", ",", "num_workers", "=", "4", ")", "arg_7", "=", "arg_0", ".", "kernel_sizes", "arg_8", "=", "arg_0", ".", "num_kernel", "arg_9", "=", "arg_0", ".", "embedding_dim", "arg_10", "=", "TextCNN", "(", "vocab_size", "=", "arg_3", ".", "get_vocab_size", "(", ")", ",", "embedding_dim", "=", "arg_9", ",", "output_size", "=", "len", "(", "arg_0", ".", "y_transformer", ".", "classes_", ")", ",", "kernel_sizes", "=", "arg_7", ",", "num_kernel", "=", "arg_8", ")", "if", "USE_CUDA", ":", "arg_10", "=", "arg_10", ".", "cuda", "(", ")", "arg_11", "=", "arg_0", ".", "epoch", "arg_12", "=", "arg_0", ".", "lr", "arg_13", "=", "nn", ".", "CrossEntropyLoss", "(", ")", "arg_14", "=", "optim", ".", "Adam", "(", "arg_10", ".", "parameters", "(", ")", ",", "lr", "=", "arg_12", ")", "for", "arg_15", "in", "range", "(", "arg_11", ")", ":", "arg_16", "=", "[", "]", "for", "arg_17", ",", "arg_18", "in", "enumerate", "(", "arg_6", ")", ":", "arg_1", ",", "arg_2", "=", "arg_18", "arg_1", ",", "arg_2", "=", "Variable", "(", "arg_1", ")", ",", "Variable", "(", "arg_2", ")", "arg_14", ".", "zero_grad", "(", ")", "arg_10", ".", "train", "(", ")", "arg_19", "=", "arg_10", "(", "arg_1", ")", "arg_20", "=", "arg_13", "(", "arg_19", ",", "arg_2", ")", "arg_16", ".", "append", "(", "arg_20", ".", "data", ".", "tolist", "(", ")", "[", "0", "]", ")", "arg_20", ".", "backward", "(", ")", "arg_14", ".", "step", "(", ")", "if", "arg_17", "%", "100", "==", "0", ":", "print", "(", "\"[%d/%d] mean_loss : %0.2f\"", "%", "(", "arg_15", ",", "arg_11", ",", "np", ".", "mean", "(", "arg_16", ")", ")", ")", "arg_16", "=", "[", "]", "arg_0", ".", "model", "=", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Fit KimCNNClassifier according to X, y\n\n        Parameters\n        ----------\n        X : list of string\n            each item is a raw text\n        y : list of string\n            each item is a label\n        \"\"\"\n        ####################\n        # Data Loader\n        ####################\n        arg_3 = WordVectorTransformer(padding='max')\n        arg_1 = arg_3.Func_transform(arg_1)\n        arg_1 = LongTensor(arg_1)\n        arg_0.word_vector_transformer = arg_3\n\n        arg_4 = LabelEncoder()\n        arg_2 = arg_4.Func_transform(arg_2)\n        arg_2 = torch.from_numpy(arg_2)\n        arg_0.y_transformer = arg_4\n\n        arg_5 = CategorizedDataset(arg_1, arg_2)\n        arg_6 = DataLoader(arg_5,\n                                batch_size=arg_0.batch_size,\n                                shuffle=True,\n                                num_workers=4)\n\n        ####################\n        # Model\n        ####################\n        arg_7 = arg_0.kernel_sizes\n        arg_8 = arg_0.num_kernel\n        arg_9 = arg_0.embedding_dim\n\n        arg_10 = TextCNN(\n            vocab_size=arg_3.get_vocab_size(),\n            embedding_dim=arg_9,\n            output_size=len(arg_0.y_transformer.classes_),\n            kernel_sizes=arg_7,\n            num_kernel=arg_8)\n        if USE_CUDA:\n            arg_10 = arg_10.cuda()\n\n        ####################\n        # Train\n        ####################\n        arg_11 = arg_0.epoch\n        arg_12 = arg_0.lr\n\n        arg_13 = nn.CrossEntropyLoss()\n        arg_14 = optim.Adam(arg_10.parameters(), lr=arg_12)\n\n        for arg_15 in range(arg_11):\n            arg_16 = []\n            for arg_17, arg_18 in enumerate(arg_6):\n                arg_1, arg_2 = arg_18\n                arg_1, arg_2 = Variable(arg_1), Variable(arg_2)\n\n                arg_14.zero_grad()\n                arg_10.train()\n                arg_19 = arg_10(arg_1)\n\n                arg_20 = arg_13(arg_19, arg_2)\n                arg_16.append(arg_20.data.tolist()[0])\n                arg_20.backward()\n\n                arg_14.step()\n\n                if arg_17 % 100 == 0:\n                    print(\"[%d/%d] mean_loss : %0.2f\" % (\n                        arg_15, arg_11, np.mean(arg_16)))\n                    arg_16 = []\n        arg_0.model = arg_10", "path": "languageflow/model/cnn.py", "identifier": "KimCNNClassifier.fit", "docstring": "Fit KimCNNClassifier according to X, y\n\n        Parameters\n        ----------\n        X : list of string\n            each item is a raw text\n        y : list of string\n            each item is a label", "docstring_tokens": ["Fit", "KimCNNClassifier", "according", "to", "X", "y"], "nwo": "undertheseanlp/languageflow", "score": 0.5035427528001201, "idx": 259266}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/packager.py#L55-L82", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Installs system packages listed in apt-requirements.txt.", "language": "python", "parameters": "(self, fn=None, package_name=None, update=0, list_only=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ")", ":", "arg_5", "=", "arg_0", ".", "local_renderer", "assert", "arg_0", ".", "genv", "[", "ROLE", "]", "arg_6", "=", "arg_1", "or", "(", "arg_0", ".", "env", ".", "apt_requirments_fn", "and", "arg_0", ".", "find_template", "(", "arg_0", ".", "env", ".", "apt_requirments_fn", ")", ")", "if", "not", "arg_6", ":", "return", "[", "]", "assert", "os", ".", "path", ".", "isfile", "(", "arg_6", ")", "arg_7", "=", "list", "(", "arg_0", ".", "env", ".", "apt_packages", "or", "[", "]", ")", "for", "arg_8", "in", "open", "(", "arg_6", ")", ".", "readlines", "(", ")", ":", "if", "arg_8", ".", "strip", "(", ")", "and", "not", "arg_8", ".", "strip", "(", ")", ".", "startswith", "(", "'#'", ")", "and", "(", "not", "arg_2", "or", "arg_8", ".", "strip", "(", ")", "==", "arg_2", ")", ":", "arg_7", ".", "extend", "(", "arg_9", ".", "strip", "(", ")", "for", "arg_9", "in", "arg_8", ".", "split", "(", "' '", ")", "if", "arg_9", ".", "strip", "(", ")", ")", "if", "arg_4", ":", "return", "arg_7", "arg_10", "=", "arg_5", ".", "write_temp_file", "(", "'\\n'", ".", "join", "(", "arg_7", ")", ")", "arg_6", "=", "arg_10", "if", "not", "arg_0", ".", "genv", ".", "is_local", ":", "arg_5", ".", "put", "(", "local_path", "=", "arg_10", ",", "remote_path", "=", "arg_10", ")", "arg_6", "=", "arg_0", ".", "genv", ".", "put_remote_path", "arg_5", ".", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive apt-get -yq update --fix-missing'", ")", "arg_5", ".", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive apt-get -yq install `cat \"%s\" | tr \"\\\\n\" \" \"`'", "%", "arg_6", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=0, arg_4=0):\n        \"\"\"\n        Installs system packages listed in apt-requirements.txt.\n        \"\"\"\n        arg_5 = arg_0.local_renderer\n        assert arg_0.genv[ROLE]\n        arg_6 = arg_1 or (arg_0.env.apt_requirments_fn and arg_0.find_template(arg_0.env.apt_requirments_fn))\n        if not arg_6:\n            return []\n        assert os.path.isfile(arg_6)\n\n        arg_7 = list(arg_0.env.apt_packages or [])\n        for arg_8 in open(arg_6).readlines():\n            if arg_8.strip() and not arg_8.strip().startswith('#') \\\n            and (not arg_2 or arg_8.strip() == arg_2):\n                arg_7.extend(arg_9.strip() for arg_9 in arg_8.split(' ') if arg_9.strip())\n\n        if arg_4:\n            return arg_7\n\n        arg_10 = arg_5.write_temp_file('\\n'.join(arg_7))\n        arg_6 = arg_10\n\n        if not arg_0.genv.is_local:\n            arg_5.put(local_path=arg_10, remote_path=arg_10)\n            arg_6 = arg_0.genv.put_remote_path\n        arg_5.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq update --fix-missing')\n        arg_5.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq install `cat \"%s\" | tr \"\\\\n\" \" \"`' % arg_6)", "path": "burlap/packager.py", "identifier": "PackagerSatchel.install_apt", "docstring": "Installs system packages listed in apt-requirements.txt.", "docstring_tokens": ["Installs", "system", "packages", "listed", "in", "apt", "-", "requirements", ".", "txt", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259267}
{"url": "https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L50-L71", "sha": "eba01c058100ec8806129b11a2859f3126a1b101", "docstring_summary": "Parse a page of character results.", "language": "python", "parameters": "(soup)", "return_statement": "return characters", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "list", "(", "arg_0", ".", "find_all", "(", "'table'", ",", "class_", "=", "'stripe'", ")", "[", "0", "]", ".", "children", ")", "[", "1", ":", "]", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_3", "=", "{", "'gender'", ":", "None", ",", "'name'", ":", "None", ",", "'games'", ":", "{", "}", "}", "arg_3", "[", "'gender'", "]", "=", "arg_2", ".", "abbr", ".", "get", "(", "'title'", ")", "arg_3", "[", "'name'", "]", "=", "list", "(", "arg_2", ".", "children", ")", "[", "1", "]", ".", "a", ".", "string", "arg_3", "[", "'games'", "]", "=", "[", "]", "for", "arg_4", "in", "list", "(", "list", "(", "list", "(", "arg_2", ".", "children", ")", "[", "1", "]", ".", "children", ")", "[", "1", "]", ".", "children", ")", ":", "if", "isinstance", "(", "arg_4", ",", "NavigableString", ")", ":", "continue", "arg_3", "[", "'games'", "]", ".", "append", "(", "{", "'name'", ":", "arg_4", ".", "string", ",", "'id'", ":", "arg_4", ".", "get", "(", "'href'", ")", ".", "split", "(", "'/'", ")", "[", "1", "]", "}", ")", "arg_1", ".", "append", "(", "arg_3", ")", "del", "arg_3", "return", "arg_1"], "function": "async def Func(arg_0):\n    \"\"\"\n    Parse a page of character results.\n\n    :param soup: The BS4 class object\n    :return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair\n             for games they appeared in.\n    \"\"\"\n    arg_0 = list(arg_0.find_all('table', class_='stripe')[0].children)[1:]\n    arg_1 = []\n    for arg_2 in arg_0:\n        arg_3 = {'gender': None, 'name': None, 'games': {}}\n        arg_3['gender'] = arg_2.abbr.get('title')\n        arg_3['name'] = list(arg_2.children)[1].a.string\n        arg_3['games'] = []\n        for arg_4 in list(list(list(arg_2.children)[1].children)[1].children):\n            if isinstance(arg_4, NavigableString):\n                continue\n            arg_3['games'].append({'name': arg_4.string, 'id': arg_4.get('href').split('/')[1]})\n        arg_1.append(arg_3)\n        del arg_3\n    return arg_1", "path": "Shosetsu/Parsing.py", "identifier": "parse_character_results", "docstring": "Parse a page of character results.\n\n    :param soup: The BS4 class object\n    :return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair\n             for games they appeared in.", "docstring_tokens": ["Parse", "a", "page", "of", "character", "results", "."], "nwo": "ccubed/Shosetsu", "score": 0.25890992733444657, "idx": 259268}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/courses.py#L53-L58", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Return a list of published courses for the passed account ID.", "language": "python", "parameters": "(self, account_id, params={})", "return_statement": "return self.get_courses_in_account(account_id, params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "arg_2", "[", "\"published\"", "]", "=", "True", "return", "arg_0", ".", "get_courses_in_account", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Return a list of published courses for the passed account ID.\n        \"\"\"\n        arg_2[\"published\"] = True\n        return arg_0.get_courses_in_account(arg_1, arg_2)", "path": "uw_canvas/courses.py", "identifier": "Courses.get_published_courses_in_account", "docstring": "Return a list of published courses for the passed account ID.", "docstring_tokens": ["Return", "a", "list", "of", "published", "courses", "for", "the", "passed", "account", "ID", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 259269}
{"url": "https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/metrics/jmeter_metric.py#L198-L212", "sha": "261e2c0760fd6a6b0ee59064180bd8e3674311fe", "docstring_summary": "Parse the Jmeter file and calculate key stats", "language": "python", "parameters": "(self)", "return_statement": "return status", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "True", "for", "arg_2", "in", "arg_0", ".", "infile_list", ":", "arg_1", "=", "arg_1", "and", "naarad", ".", "utils", ".", "is_valid_file", "(", "arg_2", ")", "if", "not", "arg_1", ":", "return", "False", "arg_3", "=", "arg_0", ".", "Func_xml_jtl", "(", "arg_0", ".", "aggregation_granularity", ")", "gc", ".", "collect", "(", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse the Jmeter file and calculate key stats\n\n    :return: status of the metric Func\n    \"\"\"\n    arg_1 = True\n    for arg_2 in arg_0.infile_list:\n      arg_1 = arg_1 and naarad.utils.is_valid_file(arg_2)\n      if not arg_1:\n        return False\n\n    arg_3 = arg_0.Func_xml_jtl(arg_0.aggregation_granularity)\n    gc.collect()\n    return arg_3", "path": "src/naarad/metrics/jmeter_metric.py", "identifier": "JmeterMetric.parse", "docstring": "Parse the Jmeter file and calculate key stats\n\n    :return: status of the metric parse", "docstring_tokens": ["Parse", "the", "Jmeter", "file", "and", "calculate", "key", "stats"], "nwo": "linkedin/naarad", "score": 0.34903059417921767, "idx": 259270}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/transforms/functional.py#L557-L574", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Adjust contrast of an Image.", "language": "python", "parameters": "(img, contrast_factor)", "return_statement": "return img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "_is_pil_image", "(", "arg_0", ")", ":", "raise", "TypeError", "(", "'img should be PIL Image. Got {}'", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")", "arg_2", "=", "ImageEnhance", ".", "Contrast", "(", "arg_0", ")", "arg_0", "=", "arg_2", ".", "enhance", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Adjust contrast of an Image.\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        contrast_factor (float): How much to adjust the contrast. Can be any\n            non negative number. 0 gives a solid gray image, 1 gives the\n            original image while 2 increases the contrast by a factor of 2.\n\n    Returns:\n        PIL Image: Contrast adjusted image.\n    \"\"\"\n    if not _is_pil_image(arg_0):\n        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))\n\n    arg_2 = ImageEnhance.Contrast(arg_0)\n    arg_0 = arg_2.enhance(arg_1)\n    return arg_0", "path": "torchvision/transforms/functional.py", "identifier": "adjust_contrast", "docstring": "Adjust contrast of an Image.\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        contrast_factor (float): How much to adjust the contrast. Can be any\n            non negative number. 0 gives a solid gray image, 1 gives the\n            original image while 2 increases the contrast by a factor of 2.\n\n    Returns:\n        PIL Image: Contrast adjusted image.", "docstring_tokens": ["Adjust", "contrast", "of", "an", "Image", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 259271}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L210-L220", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Add an activity to the component.", "language": "python", "parameters": "(self, activity)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "gl", ".", "structure", ".", "validate_account_names", "(", "arg_1", ".", "get_referenced_accounts", "(", ")", ")", "arg_0", ".", "activities", ".", "append", "(", "arg_1", ")", "arg_1", ".", "set_parent_path", "(", "arg_0", ".", "path", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add an activity to the component.\n\n        :param activity: The activity.\n        \"\"\"\n\n        arg_0.gl.structure.validate_account_names(\n            arg_1.get_referenced_accounts())\n        arg_0.activities.append(arg_1)\n        arg_1.set_parent_path(arg_0.path)", "path": "auxi/modelling/business/structure.py", "identifier": "Component.add_activity", "docstring": "Add an activity to the component.\n\n        :param activity: The activity.", "docstring_tokens": ["Add", "an", "activity", "to", "the", "component", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 259272}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/get_traffic.py#L275-L300", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Writes the referrers data to file.", "language": "python", "parameters": "(self, file_path='',\n        date=str(datetime.date.today()), organization='llnl')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "arg_3", "(", "arg_4", ".", "date", ".", "today", "(", ")", ")", ",", "arg_6", "=", "'llnl'", ")", ":", "arg_0", ".", "remove_date", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_7", "=", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", "with", "open", "(", "arg_1", ",", "'a'", ")", "as", "out", ":", "if", "not", "arg_7", ":", "out", ".", "write", "(", "'date,organization,referrer,count,count_log,uniques,'", "+", "'uniques_logged\\n'", ")", "arg_8", "=", "sorted", "(", "arg_0", ".", "referrers_lower", ")", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "arg_0", ".", "referrers_lower", "[", "arg_9", "]", "arg_11", "=", "arg_0", ".", "referrers", "[", "arg_10", "]", "[", "0", "]", "arg_12", "=", "arg_0", ".", "referrers", "[", "arg_10", "]", "[", "1", "]", "if", "arg_11", "==", "1", ":", "arg_11", "=", "1.5", "if", "arg_12", "==", "1", ":", "arg_12", "=", "1.5", "arg_13", "=", "math", ".", "log", "(", "arg_11", ")", "arg_14", "=", "math", ".", "log", "(", "arg_12", ")", "out", ".", "write", "(", "arg_2", "+", "','", "+", "arg_6", "+", "','", "+", "arg_10", "+", "','", "+", "arg_3", "(", "arg_11", ")", "+", "','", "+", "arg_3", "(", "arg_13", ")", "+", "','", "+", "arg_3", "(", "arg_12", ")", "+", "','", "+", "arg_3", "(", "arg_14", ")", "+", "'\\n'", ")", "out", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1='',\n        arg_2=arg_3(arg_4.date.today()), arg_6='llnl'):\n        \"\"\"\n        Writes the referrers data to file.\n        \"\"\"\n        arg_0.remove_date(arg_1=arg_1, arg_2=arg_2)\n        arg_7 = os.path.isfile(arg_1)\n        with open(arg_1, 'a') as out:\n            if not arg_7:\n                out.write('date,organization,referrer,count,count_log,uniques,'\n                    + 'uniques_logged\\n')\n            arg_8 = sorted(arg_0.referrers_lower)#sort based on lowercase\n            for arg_9 in arg_8:\n                arg_10 = arg_0.referrers_lower[arg_9]#grab real name from\n                arg_11 = arg_0.referrers[arg_10][0]\n                arg_12 = arg_0.referrers[arg_10][1]\n                if arg_11 == 1:#so we don't display 0 for count of 1\n                    arg_11 = 1.5\n                if arg_12 == 1:\n                    arg_12 = 1.5\n                arg_13 = math.log(arg_11)\n                arg_14 = math.log(arg_12)\n                out.write(arg_2 + ',' + arg_6 + ','\n                + arg_10 + ',' + arg_3(arg_11) + ',' + arg_3(arg_13) + ','\n                + arg_3(arg_12) + ',' + arg_3(arg_14) + '\\n')\n        out.close()", "path": "scripts/get_traffic.py", "identifier": "GitHub_Traffic.write_referrers_to_file", "docstring": "Writes the referrers data to file.", "docstring_tokens": ["Writes", "the", "referrers", "data", "to", "file", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 259273}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/nodebox.py#L608-L618", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Set or return size of current font.", "language": "python", "parameters": "(self, fontsize=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", "=", "None", ")", ":", "if", "Func", "is", "not", "None", ":", "arg_0", ".", "_canvas", ".", "fontsize", "=", "Func", "else", ":", "return", "arg_0", ".", "_canvas", ".", "fontsize"], "function": "def Func(arg_0, Func=None):\n        '''\n        Set or return size of current font.\n\n        :param fontsize: Size of font.\n        :return: Size of font (if fontsize was not specified)\n        '''\n        if Func is not None:\n            arg_0._canvas.fontsize = Func\n        else:\n            return arg_0._canvas.fontsize", "path": "shoebot/grammar/nodebox.py", "identifier": "NodeBot.fontsize", "docstring": "Set or return size of current font.\n\n        :param fontsize: Size of font.\n        :return: Size of font (if fontsize was not specified)", "docstring_tokens": ["Set", "or", "return", "size", "of", "current", "font", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259274}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/subgraph_summary.py#L98-L122", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Rank sub-graphs by which have the most nodes matching an given filter.", "language": "python", "parameters": "(graph: BELGraph,\n                                 node_predicates: Union[NodePredicate, Iterable[NodePredicate]],\n                                 annotation: str = 'Subgraph',\n                                 reverse: bool = True,\n                                 )", "return_statement": "return sorted(r2.items(), key=itemgetter(1), reverse=reverse)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", ",", "arg_5", "[", "arg_4", "]", "]", ",", "arg_6", ":", "arg_7", "=", "'Subgraph'", ",", "arg_8", ":", "arg_9", "=", "True", ",", ")", "->", "List", "[", "Tuple", "[", "arg_7", ",", "int", "]", "]", ":", "arg_10", "=", "group_nodes_by_annotation_filtered", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_6", "=", "arg_6", ")", "arg_11", "=", "count_dict_values", "(", "arg_10", ")", "return", "sorted", "(", "arg_11", ".", "items", "(", ")", ",", "key", "=", "itemgetter", "(", "1", ")", ",", "arg_8", "=", "arg_8", ")"], "function": "def Func(arg_0: arg_1,\n                                 arg_2: arg_3[arg_4, arg_5[arg_4]],\n                                 arg_6: arg_7 = 'Subgraph',\n                                 arg_8: arg_9 = True,\n                                 ) -> List[Tuple[arg_7, int]]:\n    \"\"\"Rank sub-graphs by which have the most nodes matching an given filter.\n\n    A use case for this function would be to identify which subgraphs contain the most differentially expressed\n    genes.\n\n    >>> from pybel import from_pickle\n    >>> from pybel.constants import GENE\n    >>> from pybel_tools.integration import overlay_type_data\n    >>> from pybel_tools.summary import Func\n    >>> import pandas as pd\n    >>> graph = from_pickle('~/dev/bms/aetionomy/alzheimers.gpickle')\n    >>> df = pd.read_csv('~/dev/bananas/data/alzheimers_dgxp.csv', columns=['Gene', 'log2fc'])\n    >>> data = {gene: log2fc for _, gene, log2fc in df.itertuples()}\n    >>> overlay_type_data(graph, data, 'log2fc', GENE, 'HGNC', impute=0.0)\n    >>> results = Func(graph, lambda g, n: 1.3 < abs(g[n]['log2fc']))\n    \"\"\"\n    arg_10 = group_nodes_by_annotation_filtered(arg_0, arg_2=arg_2, arg_6=arg_6)\n    arg_11 = count_dict_values(arg_10)\n    # TODO use instead: r2.most_common()\n    return sorted(arg_11.items(), key=itemgetter(1), arg_8=arg_8)", "path": "src/pybel_tools/summary/subgraph_summary.py", "identifier": "rank_subgraph_by_node_filter", "docstring": "Rank sub-graphs by which have the most nodes matching an given filter.\n\n    A use case for this function would be to identify which subgraphs contain the most differentially expressed\n    genes.\n\n    >>> from pybel import from_pickle\n    >>> from pybel.constants import GENE\n    >>> from pybel_tools.integration import overlay_type_data\n    >>> from pybel_tools.summary import rank_subgraph_by_node_filter\n    >>> import pandas as pd\n    >>> graph = from_pickle('~/dev/bms/aetionomy/alzheimers.gpickle')\n    >>> df = pd.read_csv('~/dev/bananas/data/alzheimers_dgxp.csv', columns=['Gene', 'log2fc'])\n    >>> data = {gene: log2fc for _, gene, log2fc in df.itertuples()}\n    >>> overlay_type_data(graph, data, 'log2fc', GENE, 'HGNC', impute=0.0)\n    >>> results = rank_subgraph_by_node_filter(graph, lambda g, n: 1.3 < abs(g[n]['log2fc']))", "docstring_tokens": ["Rank", "sub", "-", "graphs", "by", "which", "have", "the", "most", "nodes", "matching", "an", "given", "filter", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 259275}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L48-L59", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get a list of the running applications.", "language": "python", "parameters": "(cls)", "return_statement": "return apps", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "runLoopAndExit", "(", ")", ":", "AppHelper", ".", "stopEventLoop", "(", ")", "AppHelper", ".", "callLater", "(", "1", ",", "runLoopAndExit", ")", "AppHelper", ".", "runConsoleEventLoop", "(", ")", "arg_1", "=", "AppKit", ".", "NSWorkspace", ".", "sharedWorkspace", "(", ")", "arg_2", "=", "arg_1", ".", "runningApplications", "(", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Get a list of the running applications.\"\"\"\n\n        def runLoopAndExit():\n            AppHelper.stopEventLoop()\n\n        AppHelper.callLater(1, runLoopAndExit)\n        AppHelper.runConsoleEventLoop()\n        # Get a list of running applications\n        arg_1 = AppKit.NSWorkspace.sharedWorkspace()\n        arg_2 = arg_1.runningApplications()\n        return arg_2", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._getRunningApps", "docstring": "Get a list of the running applications.", "docstring_tokens": ["Get", "a", "list", "of", "the", "running", "applications", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 259276}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L254-L303", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Add the currently mined information to the\n        mined \"database\".", "language": "python", "parameters": "(self, to_add)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_2", ".", "CONFIGURATION", "[", "\"mining\"", "]", ":", "if", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "not", "in", "arg_2", ".", "INTERN", "[", "\"mined\"", "]", ":", "arg_2", ".", "INTERN", "[", "\"mined\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "=", "{", "}", "for", "arg_4", "in", "arg_1", ":", "if", "(", "arg_4", "in", "arg_2", ".", "INTERN", "[", "\"mined\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", ")", ":", "arg_2", ".", "INTERN", "[", "\"mined\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_4", "]", ".", "extend", "(", "arg_1", "[", "arg_4", "]", ")", "else", ":", "arg_2", ".", "INTERN", "[", "\"mined\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_4", "]", "=", "arg_1", "[", "arg_4", "]", "arg_2", ".", "INTERN", "[", "\"mined\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_4", "]", "=", "List", "(", "arg_2", ".", "INTERN", "[", "\"mined\"", "]", "[", "arg_2", ".", "INTERN", "[", "\"file_to_test\"", "]", "]", "[", "arg_4", "]", ")", ".", "format", "(", ")", "arg_0", ".", "_backup", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add the currently mined information to the\n        mined \"database\".\n\n        :param toFunc: The element to add.\n        :type toFunc: dict\n        \"\"\"\n\n        if arg_2.CONFIGURATION[\"mining\"]:\n            # The mining is activated.\n\n            if arg_2.INTERN[\"file_to_test\"] not in arg_2.INTERN[\"mined\"]:\n                # Our tested file path is not into our mined database.\n\n                # We initiate it.\n                arg_2.INTERN[\"mined\"][arg_2.INTERN[\"file_to_test\"]] = {}\n\n            for arg_4 in arg_1:\n                # We loop through the element to add.\n\n                if (\n                    arg_4\n                    in arg_2.INTERN[\"mined\"][arg_2.INTERN[\"file_to_test\"]]\n                ):\n                    # The element is already into the tested file path database.\n\n                    # We extent it with our element to add.\n                    arg_2.INTERN[\"mined\"][arg_2.INTERN[\"file_to_test\"]][\n                        arg_4\n                    ].extend(arg_1[arg_4])\n                else:\n                    # The element is already into the tested file path database.\n\n                    # We initiate it.\n                    arg_2.INTERN[\"mined\"][arg_2.INTERN[\"file_to_test\"]][\n                        arg_4\n                    ] = arg_1[arg_4]\n\n                # We format the added information in order to avoid duplicate.\n                arg_2.INTERN[\"mined\"][arg_2.INTERN[\"file_to_test\"]][\n                    arg_4\n                ] = List(\n                    arg_2.INTERN[\"mined\"][arg_2.INTERN[\"file_to_test\"]][\n                        arg_4\n                    ]\n                ).format()\n\n            # We backup everything.\n            arg_0._backup()", "path": "PyFunceble/mining.py", "identifier": "Mining._add", "docstring": "Add the currently mined information to the\n        mined \"database\".\n\n        :param to_add: The element to add.\n        :type to_add: dict", "docstring_tokens": ["Add", "the", "currently", "mined", "information", "to", "the", "mined", "database", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 259277}
{"url": "https://github.com/macacajs/wd.py/blob/6d3c52060013e01a67cd52b68b5230b387427bad/macaca/webdriver.py#L302-L320", "sha": "6d3c52060013e01a67cd52b68b5230b387427bad", "docstring_summary": "Sets the width and height of the current window.", "language": "python", "parameters": "(self, width, height, window_handle='current')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'current'", ")", ":", "arg_0", ".", "_execute", "(", "Command", ".", "SET_WINDOW_SIZE", ",", "{", "'width'", ":", "int", "(", "arg_1", ")", ",", "'height'", ":", "int", "(", "arg_2", ")", ",", "'window_handle'", ":", "arg_3", "}", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='current'):\n        \"\"\"Sets the width and height of the current window.\n\n        Support:\n            Web(WebView)\n\n        Args:\n            width(int): the width in pixels.\n            height(int): the height in pixels.\n            window_handle(str): Identifier of window_handle,\n                default to 'current'.\n\n        Returns:\n            WebDriver Object.\n        \"\"\"\n        arg_0._execute(Command.SET_WINDOW_SIZE, {\n            'width': int(arg_1),\n            'height': int(arg_2),\n            'window_handle': arg_3})", "path": "macaca/webdriver.py", "identifier": "WebDriver.set_window_size", "docstring": "Sets the width and height of the current window.\n\n        Support:\n            Web(WebView)\n\n        Args:\n            width(int): the width in pixels.\n            height(int): the height in pixels.\n            window_handle(str): Identifier of window_handle,\n                default to 'current'.\n\n        Returns:\n            WebDriver Object.", "docstring_tokens": ["Sets", "the", "width", "and", "height", "of", "the", "current", "window", "."], "nwo": "macacajs/wd.py", "score": 0.3182350344440769, "idx": 259278}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-keyvault/azure/keyvault/v2016_10_01/key_vault_client.py#L69-L159", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates a new key, stores it, then returns key parameters and\n        attributes to the client.", "language": "python", "parameters": "(\n            self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "**", "arg_11", ")", ":", "arg_12", "=", "models", ".", "KeyCreateParameters", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", "arg_13", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_14", "=", "{", "'vaultBaseUrl'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"vault_base_url\"", ",", "arg_1", ",", "'str'", ",", "skip_quote", "=", "True", ")", ",", "'key-name'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"key_name\"", ",", "arg_2", ",", "'str'", ",", "pattern", "=", "r'^[0-9a-zA-Z-]+$'", ")", "}", "arg_13", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_13", ",", "**", "arg_14", ")", "arg_15", "=", "{", "}", "arg_15", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "arg_16", "=", "{", "}", "arg_16", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_16", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_9", ":", "arg_16", ".", "update", "(", "arg_9", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_16", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_17", "=", "arg_0", ".", "_serialize", ".", "body", "(", "arg_12", ",", "'KeyCreateParameters'", ")", "arg_18", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_13", ",", "arg_15", ")", "arg_19", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_18", ",", "arg_16", ",", "arg_17", ",", "stream", "=", "False", ",", "**", "arg_11", ")", "if", "arg_19", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "KeyVaultErrorException", "(", "arg_0", ".", "_deserialize", ",", "arg_19", ")", "arg_20", "=", "None", "if", "arg_19", ".", "status_code", "==", "200", ":", "arg_20", "=", "arg_0", ".", "_deserialize", "(", "'KeyBundle'", ",", "arg_19", ")", "if", "arg_10", ":", "arg_21", "=", "ClientRawResponse", "(", "arg_20", ",", "arg_19", ")", "return", "arg_21", "return", "arg_20"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=False, **arg_11):\n        \"\"\"Creates a new key, stores it, then returns key parameters and\n        attributes to the client.\n\n        The create key operation can be used to create any key type in Azure\n        Key Vault. If the named key already exists, Azure Key Vault creates a\n        new version of the key. It requires the keys/create permission.\n\n        :param vault_base_url: The vault name, for example\n         https://myvault.vault.azure.net.\n        :type vault_base_url: str\n        :param key_name: The name for the new key. The system will generate\n         the version name for the new key.\n        :type key_name: str\n        :param kty: The type of key to create. For valid values, see\n         JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',\n         'RSA-HSM', 'oct'\n        :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType\n        :param key_size: The key size in bits. For example: 2048, 3072, or\n         4096 for RSA.\n        :type key_size: int\n        :param key_ops:\n        :type key_ops: list[str or\n         ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]\n        :param key_attributes:\n        :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n        :param tags: Application specific metadata in the form of key-value\n         pairs.\n        :type tags: dict[str, str]\n        :param curve: Elliptic curve name. For valid values, see\n         JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',\n         'P-521', 'SECP256K1'\n        :type curve: str or\n         ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: KeyBundle or ClientRawResponse if raw=true\n        :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`KeyVaultErrorException<azure.keyvault.v2016_10_01.models.KeyVaultErrorException>`\n        \"\"\"\n        arg_12 = models.KeyCreateParameters(arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_6=arg_6, arg_7=arg_7, arg_8=arg_8)\n\n        # Construct URL\n        arg_13 = arg_0.Func.metadata['url']\n        arg_14 = {\n            'vaultBaseUrl': arg_0._serialize.url(\"vault_base_url\", arg_1, 'str', skip_quote=True),\n            'key-name': arg_0._serialize.url(\"key_name\", arg_2, 'str', pattern=r'^[0-9a-zA-Z-]+$')\n        }\n        arg_13 = arg_0._client.format_url(arg_13, **arg_14)\n\n        # Construct parameters\n        arg_15 = {}\n        arg_15['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n\n        # Construct headers\n        arg_16 = {}\n        arg_16['Content-Type'] = 'application/json; charset=utf-8'\n        if arg_0.config.generate_client_request_id:\n            arg_16['x-ms-client-request-id'] = str(uuid.uuid1())\n        if arg_9:\n            arg_16.update(arg_9)\n        if arg_0.config.accept_language is not None:\n            arg_16['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n        # Construct body\n        arg_17 = arg_0._serialize.body(arg_12, 'KeyCreateParameters')\n\n        # Construct and send request\n        arg_18 = arg_0._client.post(arg_13, arg_15)\n        arg_19 = arg_0._client.send(\n            arg_18, arg_16, arg_17, stream=False, **arg_11)\n\n        if arg_19.status_code not in [200]:\n            raise models.KeyVaultErrorException(arg_0._deserialize, arg_19)\n\n        arg_20 = None\n\n        if arg_19.status_code == 200:\n            arg_20 = arg_0._deserialize('KeyBundle', arg_19)\n\n        if arg_10:\n            arg_21 = ClientRawResponse(arg_20, arg_19)\n            return arg_21\n\n        return arg_20", "path": "azure-keyvault/azure/keyvault/v2016_10_01/key_vault_client.py", "identifier": "KeyVaultClient.create_key", "docstring": "Creates a new key, stores it, then returns key parameters and\n        attributes to the client.\n\n        The create key operation can be used to create any key type in Azure\n        Key Vault. If the named key already exists, Azure Key Vault creates a\n        new version of the key. It requires the keys/create permission.\n\n        :param vault_base_url: The vault name, for example\n         https://myvault.vault.azure.net.\n        :type vault_base_url: str\n        :param key_name: The name for the new key. The system will generate\n         the version name for the new key.\n        :type key_name: str\n        :param kty: The type of key to create. For valid values, see\n         JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',\n         'RSA-HSM', 'oct'\n        :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType\n        :param key_size: The key size in bits. For example: 2048, 3072, or\n         4096 for RSA.\n        :type key_size: int\n        :param key_ops:\n        :type key_ops: list[str or\n         ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]\n        :param key_attributes:\n        :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n        :param tags: Application specific metadata in the form of key-value\n         pairs.\n        :type tags: dict[str, str]\n        :param curve: Elliptic curve name. For valid values, see\n         JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',\n         'P-521', 'SECP256K1'\n        :type curve: str or\n         ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: KeyBundle or ClientRawResponse if raw=true\n        :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle or\n         ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`KeyVaultErrorException<azure.keyvault.v2016_10_01.models.KeyVaultErrorException>`", "docstring_tokens": ["Creates", "a", "new", "key", "stores", "it", "then", "returns", "key", "parameters", "and", "attributes", "to", "the", "client", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259279}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/confluence.py#L369-L385", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the snapshot of a content for the given version.", "language": "python", "parameters": "(self, content_id, version)", "return_statement": "return response[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "RCONTENTS", "+", "'/'", "+", "str", "(", "arg_1", ")", "arg_4", "=", "{", "arg_0", ".", "PVERSION", ":", "arg_2", ",", "arg_0", ".", "PSTATUS", ":", "arg_0", ".", "VHISTORICAL", ",", "arg_0", ".", "PEXPAND", ":", "','", ".", "join", "(", "arg_0", ".", "VEXPAND", ")", "}", "arg_5", "=", "[", "arg_5", "for", "arg_5", "in", "arg_0", ".", "_call", "(", "arg_3", ",", "arg_4", ")", "]", "return", "arg_5", "[", "0", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Get the snapshot of a content for the given version.\n\n        :param content_id: fetch the snapshot of this content\n        :param version: snapshot version of the content\n        \"\"\"\n        arg_3 = arg_0.RCONTENTS + '/' + str(arg_1)\n\n        arg_4 = {\n            arg_0.PVERSION: arg_2,\n            arg_0.PSTATUS: arg_0.VHISTORICAL,\n            arg_0.PEXPAND: ','.join(arg_0.VEXPAND)\n        }\n\n        # Only one item is returned\n        arg_5 = [arg_5 for arg_5 in arg_0._call(arg_3, arg_4)]\n        return arg_5[0]", "path": "perceval/backends/core/confluence.py", "identifier": "ConfluenceClient.historical_content", "docstring": "Get the snapshot of a content for the given version.\n\n        :param content_id: fetch the snapshot of this content\n        :param version: snapshot version of the content", "docstring_tokens": ["Get", "the", "snapshot", "of", "a", "content", "for", "the", "given", "version", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259280}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/login/controllers.py#L20-L34", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Display a list of all users and which institutes they belong to.", "language": "python", "parameters": "(store)", "return_statement": "return dict(\n        users=sorted(user_objs, key=lambda user: -user['events']),\n        total_events=total_events,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", "arg_0", ".", "Func", "(", ")", ")", "arg_2", "=", "arg_0", ".", "user_events", "(", ")", ".", "count", "(", ")", "for", "arg_3", "in", "arg_1", ":", "if", "arg_3", ".", "get", "(", "'institutes'", ")", ":", "arg_3", "[", "'institutes'", "]", "=", "[", "arg_0", ".", "institute", "(", "inst_id", ")", "for", "inst_id", "in", "arg_3", ".", "get", "(", "'institutes'", ")", "]", "else", ":", "arg_3", "[", "'institutes'", "]", "=", "[", "]", "arg_3", "[", "'events'", "]", "=", "arg_0", ".", "user_events", "(", "arg_3", ")", ".", "count", "(", ")", "arg_3", "[", "'events_rank'", "]", "=", "event_rank", "(", "arg_3", "[", "'events'", "]", ")", "return", "dict", "(", "Func", "=", "sorted", "(", "arg_1", ",", "key", "=", "lambda", "user", ":", "-", "user", "[", "'events'", "]", ")", ",", "arg_2", "=", "arg_2", ",", ")"], "function": "def Func(arg_0):\n    \"\"\"Display a list of all Func and which institutes they belong to.\"\"\"\n    arg_1 = list(arg_0.Func())\n    arg_2 = arg_0.user_events().count()\n    for arg_3 in arg_1:\n        if arg_3.get('institutes'):\n            arg_3['institutes'] = [arg_0.institute(inst_id) for inst_id in arg_3.get('institutes')]\n        else:\n            arg_3['institutes'] = []\n        arg_3['events'] = arg_0.user_events(arg_3).count()\n        arg_3['events_rank'] = event_rank(arg_3['events'])\n    return dict(\n        Func=sorted(arg_1, key=lambda user: -user['events']),\n        arg_2=arg_2,\n    )", "path": "scout/server/blueprints/login/controllers.py", "identifier": "users", "docstring": "Display a list of all users and which institutes they belong to.", "docstring_tokens": ["Display", "a", "list", "of", "all", "users", "and", "which", "institutes", "they", "belong", "to", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259281}
{"url": "https://github.com/jupyter-widgets/jupyterlab-sidecar/blob/8889d09f1a0933e2cbee06d4874f720b075b29e8/setupbase.py#L483-L499", "sha": "8889d09f1a0933e2cbee06d4874f720b075b29e8", "docstring_summary": "Get a package_data and data_files handler command.", "language": "python", "parameters": "(package_data_spec, data_files_spec)", "return_statement": "return FileHandler", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "class", "FileHandler", "(", "BaseCommand", ")", ":", "def", "run", "(", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "distribution", ".", "package_data", "arg_4", "=", "arg_0", "or", "dict", "(", ")", "for", "(", "arg_5", ",", "arg_6", ")", "in", "arg_4", ".", "items", "(", ")", ":", "arg_3", "[", "arg_5", "]", "=", "_get_package_data", "(", "arg_5", ",", "arg_6", ")", "arg_2", ".", "distribution", ".", "data_files", "=", "_get_data_files", "(", "arg_1", ",", "arg_2", ".", "distribution", ".", "data_files", ")", "return", "FileHandler"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Get a package_data and data_files handler command.\n    \"\"\"\n    class FileHandler(BaseCommand):\n\n        def run(arg_2):\n            arg_3 = arg_2.distribution.package_data\n            arg_4 = arg_0 or dict()\n\n            for (arg_5, arg_6) in arg_4.items():\n                arg_3[arg_5] = _get_package_data(arg_5, arg_6)\n\n            arg_2.distribution.data_files = _get_data_files(\n                arg_1, arg_2.distribution.data_files\n            )\n\n    return FileHandler", "path": "setupbase.py", "identifier": "_get_file_handler", "docstring": "Get a package_data and data_files handler command.", "docstring_tokens": ["Get", "a", "package_data", "and", "data_files", "handler", "command", "."], "nwo": "jupyter-widgets/jupyterlab-sidecar", "score": 0.6376222650402201, "idx": 259282}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py#L719-L771", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "save the result of a completed task.", "language": "python", "parameters": "(self, idents, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "[", "0", "]", "try", ":", "arg_2", "=", "arg_0", ".", "session", ".", "unserialize", "(", "arg_2", ")", "except", "Exception", ":", "arg_0", ".", "log", ".", "error", "(", "\"task::invalid task result message send to %r: %r\"", ",", "arg_3", ",", "arg_2", ",", "exc_info", "=", "True", ")", "return", "arg_4", "=", "arg_2", "[", "'parent_header'", "]", "if", "not", "arg_4", ":", "arg_0", ".", "log", ".", "warn", "(", "\"Task %r had no parent!\"", ",", "arg_2", ")", "return", "arg_5", "=", "arg_4", "[", "'msg_id'", "]", "if", "arg_5", "in", "arg_0", ".", "unassigned", ":", "arg_0", ".", "unassigned", ".", "remove", "(", "arg_5", ")", "arg_6", "=", "arg_2", "[", "'header'", "]", "arg_7", "=", "arg_6", ".", "get", "(", "'engine'", ",", "u''", ")", "arg_8", "=", "arg_0", ".", "by_ident", ".", "get", "(", "cast_bytes", "(", "arg_7", ")", ",", "None", ")", "arg_9", "=", "arg_6", ".", "get", "(", "'status'", ",", "None", ")", "if", "arg_5", "in", "arg_0", ".", "pending", ":", "arg_0", ".", "log", ".", "info", "(", "\"task::task %r finished on %s\"", ",", "arg_5", ",", "arg_8", ")", "arg_0", ".", "pending", ".", "remove", "(", "arg_5", ")", "arg_0", ".", "all_completed", ".", "add", "(", "arg_5", ")", "if", "arg_8", "is", "not", "None", ":", "if", "arg_9", "!=", "'aborted'", ":", "arg_0", ".", "completed", "[", "arg_8", "]", ".", "append", "(", "arg_5", ")", "if", "arg_5", "in", "arg_0", ".", "tasks", "[", "arg_8", "]", ":", "arg_0", ".", "tasks", "[", "arg_8", "]", ".", "remove", "(", "arg_5", ")", "arg_10", "=", "arg_6", "[", "'date'", "]", "arg_11", "=", "arg_6", ".", "get", "(", "'started'", ",", "None", ")", "arg_12", "=", "{", "'result_header'", ":", "arg_6", ",", "'result_content'", ":", "arg_2", "[", "'content'", "]", ",", "'started'", ":", "arg_11", ",", "'completed'", ":", "arg_10", ",", "'received'", ":", "datetime", ".", "now", "(", ")", ",", "'engine_uuid'", ":", "arg_7", ",", "}", "arg_12", "[", "'result_buffers'", "]", "=", "arg_2", "[", "'buffers'", "]", "try", ":", "arg_0", ".", "db", ".", "update_record", "(", "arg_5", ",", "arg_12", ")", "except", "Exception", ":", "arg_0", ".", "log", ".", "error", "(", "\"DB Error saving task request %r\"", ",", "arg_5", ",", "exc_info", "=", "True", ")", "else", ":", "arg_0", ".", "log", ".", "debug", "(", "\"task::unknown task %r finished\"", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"save the result of a completed task.\"\"\"\n        arg_3 = arg_1[0]\n        try:\n            arg_2 = arg_0.session.unserialize(arg_2)\n        except Exception:\n            arg_0.log.error(\"task::invalid task result message send to %r: %r\",\n                    arg_3, arg_2, exc_info=True)\n            return\n\n        arg_4 = arg_2['parent_header']\n        if not arg_4:\n            # print msg\n            arg_0.log.warn(\"Task %r had no parent!\", arg_2)\n            return\n        arg_5 = arg_4['msg_id']\n        if arg_5 in arg_0.unassigned:\n            arg_0.unassigned.remove(arg_5)\n\n        arg_6 = arg_2['header']\n        arg_7 = arg_6.get('engine', u'')\n        arg_8 = arg_0.by_ident.get(cast_bytes(arg_7), None)\n        \n        arg_9 = arg_6.get('status', None)\n\n        if arg_5 in arg_0.pending:\n            arg_0.log.info(\"task::task %r finished on %s\", arg_5, arg_8)\n            arg_0.pending.remove(arg_5)\n            arg_0.all_completed.add(arg_5)\n            if arg_8 is not None:\n                if arg_9 != 'aborted':\n                    arg_0.completed[arg_8].append(arg_5)\n                if arg_5 in arg_0.tasks[arg_8]:\n                    arg_0.tasks[arg_8].remove(arg_5)\n            arg_10 = arg_6['date']\n            arg_11 = arg_6.get('started', None)\n            arg_12 = {\n                'result_header' : arg_6,\n                'result_content': arg_2['content'],\n                'started' : arg_11,\n                'completed' : arg_10,\n                'received' : datetime.now(),\n                'engine_uuid': arg_7,\n            }\n\n            arg_12['result_buffers'] = arg_2['buffers']\n            try:\n                arg_0.db.update_record(arg_5, arg_12)\n            except Exception:\n                arg_0.log.error(\"DB Error saving task request %r\", arg_5, exc_info=True)\n\n        else:\n            arg_0.log.debug(\"task::unknown task %r finished\", arg_5)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py", "identifier": "Hub.save_task_result", "docstring": "save the result of a completed task.", "docstring_tokens": ["save", "the", "result", "of", "a", "completed", "task", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259283}
{"url": "https://github.com/napalm-automation/napalm-yang/blob/998e8a933171d010b8544bcc5dc448e2b68051e2/napalm_yang/helpers.py#L32-L50", "sha": "998e8a933171d010b8544bcc5dc448e2b68051e2", "docstring_summary": "Find the necessary file for the given test case.", "language": "python", "parameters": "(profile, filename, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "\"mappings\"", ",", "arg_0", ",", "arg_2", ",", "arg_1", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_4", ")", ":", "return", "arg_4", "else", ":", "arg_5", "=", "\"Couldn't find parsing file: {}\"", ".", "format", "(", "arg_4", ")", "logger", ".", "error", "(", "arg_5", ")", "raise", "IOError", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Find the necessary file for the given test case.\n\n    Args:\n        device(napalm device connection): for which device\n        filename(str): file to find\n        path(str): where to find it relative to where the module is installed\n    \"\"\"\n    # Find base_dir of submodule\n    arg_3 = os.path.dirname(__file__)\n    arg_4 = os.path.join(arg_3, \"mappings\", arg_0, arg_2, arg_1)\n\n    if os.path.exists(arg_4):\n        return arg_4\n    else:\n        arg_5 = \"Couldn't find parsing file: {}\".format(arg_4)\n        logger.error(arg_5)\n        raise IOError(arg_5)", "path": "napalm_yang/helpers.py", "identifier": "find_yang_file", "docstring": "Find the necessary file for the given test case.\n\n    Args:\n        device(napalm device connection): for which device\n        filename(str): file to find\n        path(str): where to find it relative to where the module is installed", "docstring_tokens": ["Find", "the", "necessary", "file", "for", "the", "given", "test", "case", "."], "nwo": "napalm-automation/napalm-yang", "score": 0.2912181512296147, "idx": 259284}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/abstractcpu.py#L824-L880", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "This will decode an instruction from memory pointed by `pc`", "language": "python", "parameters": "(self, pc)", "return_statement": "return insn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_instruction_cache", ":", "return", "arg_0", ".", "_instruction_cache", "[", "arg_1", "]", "arg_2", "=", "b''", "for", "arg_3", "in", "range", "(", "arg_1", ",", "arg_1", "+", "arg_0", ".", "max_instr_width", ")", ":", "if", "not", "arg_0", ".", "memory", ".", "access_ok", "(", "arg_3", ",", "'x'", ")", ":", "break", "arg_4", "=", "arg_0", ".", "memory", "[", "arg_3", "]", "if", "issymbolic", "(", "arg_4", ")", ":", "if", "isinstance", "(", "arg_0", ".", "memory", ",", "LazySMemory", ")", ":", "try", ":", "arg_5", "=", "visitors", ".", "simplify_array_select", "(", "arg_4", ")", "arg_4", "=", "bytes", "(", "[", "arg_5", "[", "0", "]", "]", ")", "except", "visitors", ".", "ArraySelectSimplifier", ".", "ExpressionNotSimple", ":", "arg_4", "=", "struct", ".", "pack", "(", "'B'", ",", "solver", ".", "get_value", "(", "arg_0", ".", "memory", ".", "constraints", ",", "arg_4", ")", ")", "elif", "isinstance", "(", "arg_4", ",", "Constant", ")", ":", "arg_4", "=", "bytes", "(", "[", "arg_4", ".", "value", "]", ")", "else", ":", "logger", ".", "error", "(", "'Concretize executable memory %r %r'", ",", "arg_4", ",", "arg_2", ")", "raise", "ConcretizeMemory", "(", "arg_0", ".", "memory", ",", "arg_3", "=", "arg_1", ",", "size", "=", "8", "*", "arg_0", ".", "max_instr_width", ",", "policy", "=", "'INSTRUCTION'", ")", "arg_2", "+=", "arg_4", "arg_6", "=", "arg_2", ".", "ljust", "(", "arg_0", ".", "max_instr_width", ",", "b'\\x00'", ")", "try", ":", "arg_7", "=", "arg_0", ".", "disasm", ".", "disassemble_instruction", "(", "arg_6", ",", "arg_1", ")", "except", "StopIteration", "as", "e", ":", "raise", "DecodeException", "(", "arg_1", ",", "arg_6", ")", "if", "not", "arg_0", ".", "memory", ".", "access_ok", "(", "slice", "(", "arg_1", ",", "arg_1", "+", "arg_7", ".", "size", ")", ",", "'x'", ")", ":", "logger", ".", "info", "(", "\"Trying to execute instructions from non-executable memory\"", ")", "raise", "InvalidMemoryAccess", "(", "arg_1", ",", "'x'", ")", "arg_7", ".", "operands", "=", "arg_0", ".", "_wrap_operands", "(", "arg_7", ".", "operands", ")", "arg_0", ".", "_instruction_cache", "[", "arg_1", "]", "=", "arg_7", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        This will decode an instruction from memory pointed by `pc`\n\n        :param int pc: address of the instruction\n        \"\"\"\n        # No dynamic code!!! #TODO!\n        # Check if instruction was already decoded\n        if arg_1 in arg_0._instruction_cache:\n            return arg_0._instruction_cache[arg_1]\n\n        arg_2 = b''\n\n        # Read Instruction from memory\n        for arg_3 in range(arg_1, arg_1 + arg_0.max_instr_width):\n            # This reads a byte from memory ignoring permissions\n            # and concretize it if symbolic\n            if not arg_0.memory.access_ok(arg_3, 'x'):\n                break\n\n            arg_4 = arg_0.memory[arg_3]\n\n            if issymbolic(arg_4):\n                # In case of fully symbolic memory, eagerly get a valid ptr\n                if isinstance(arg_0.memory, LazySMemory):\n                    try:\n                        arg_5 = visitors.simplify_array_select(arg_4)\n                        arg_4 = bytes([arg_5[0]])\n                    except visitors.ArraySelectSimplifier.ExpressionNotSimple:\n                        arg_4 = struct.pack('B', solver.get_value(arg_0.memory.constraints, arg_4))\n                elif isinstance(arg_4, Constant):\n                    arg_4 = bytes([arg_4.value])\n                else:\n                    logger.error('Concretize executable memory %r %r', arg_4, arg_2)\n                    raise ConcretizeMemory(arg_0.memory,\n                                           arg_3=arg_1,\n                                           size=8 * arg_0.max_instr_width,\n                                           policy='INSTRUCTION')\n            arg_2 += arg_4\n\n        # Pad potentially incomplete instruction with zeroes\n        arg_6 = arg_2.ljust(arg_0.max_instr_width, b'\\x00')\n\n        try:\n            # decode the instruction from code\n            arg_7 = arg_0.disasm.disassemble_instruction(arg_6, arg_1)\n        except StopIteration as e:\n            raise DecodeException(arg_1, arg_6)\n\n        # Check that the decoded instruction is contained in executable memory\n        if not arg_0.memory.access_ok(slice(arg_1, arg_1 + arg_7.size), 'x'):\n            logger.info(\"Trying to execute instructions from non-executable memory\")\n            raise InvalidMemoryAccess(arg_1, 'x')\n\n        arg_7.operands = arg_0._wrap_operands(arg_7.operands)\n        arg_0._instruction_cache[arg_1] = arg_7\n        return arg_7", "path": "manticore/native/cpu/abstractcpu.py", "identifier": "Cpu.decode_instruction", "docstring": "This will decode an instruction from memory pointed by `pc`\n\n        :param int pc: address of the instruction", "docstring_tokens": ["This", "will", "decode", "an", "instruction", "from", "memory", "pointed", "by", "pc"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259285}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L256-L282", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Make a filename relative, where the filename path, and it is\n    relative to rel_to", "language": "python", "parameters": "(path, rel_to)", "return_statement": "return os.path.sep.join(full_parts)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "basename", "(", "arg_0", ")", "arg_0", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "arg_0", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", ")", "arg_1", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "arg_1", ")", ")", "arg_3", "=", "arg_0", ".", "strip", "(", "os", ".", "path", ".", "sep", ")", ".", "split", "(", "os", ".", "path", ".", "sep", ")", "arg_4", "=", "arg_1", ".", "strip", "(", "os", ".", "path", ".", "sep", ")", ".", "split", "(", "os", ".", "path", ".", "sep", ")", "while", "arg_3", "and", "arg_4", "and", "arg_3", "[", "0", "]", "==", "arg_4", "[", "0", "]", ":", "arg_3", ".", "pop", "(", "0", ")", "arg_4", ".", "pop", "(", "0", ")", "arg_5", "=", "[", "'..'", "]", "*", "len", "(", "arg_4", ")", "+", "arg_3", "+", "[", "arg_2", "]", "if", "arg_5", "==", "[", "''", "]", ":", "return", "'.'", "+", "os", ".", "path", ".", "sep", "return", "os", ".", "path", ".", "sep", ".", "join", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Make a filename relative, where the filename path, and it is\n    relative to rel_to\n\n        >>> Func('/usr/share/something/a-file.pth',\n        ...                    '/usr/share/another-place/src/Directory')\n        '../../../something/a-file.pth'\n        >>> Func('/usr/share/something/a-file.pth',\n        ...                    '/home/user/src/Directory')\n        '../../../usr/share/something/a-file.pth'\n        >>> Func('/usr/share/a-file.pth', '/usr/share/')\n        'a-file.pth'\n    \"\"\"\n    arg_2 = os.path.basename(arg_0)\n    arg_0 = os.path.dirname(arg_0)\n    arg_0 = os.path.normpath(os.path.abspath(arg_0))\n    arg_1 = os.path.normpath(os.path.abspath(arg_1))\n    arg_3 = arg_0.strip(os.path.sep).split(os.path.sep)\n    arg_4 = arg_1.strip(os.path.sep).split(os.path.sep)\n    while arg_3 and arg_4 and arg_3[0] == arg_4[0]:\n        arg_3.pop(0)\n        arg_4.pop(0)\n    arg_5 = ['..'] * len(arg_4) + arg_3 + [arg_2]\n    if arg_5 == ['']:\n        return '.' + os.path.sep\n    return os.path.sep.join(arg_5)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py", "identifier": "make_path_relative", "docstring": "Make a filename relative, where the filename path, and it is\n    relative to rel_to\n\n        >>> make_path_relative('/usr/share/something/a-file.pth',\n        ...                    '/usr/share/another-place/src/Directory')\n        '../../../something/a-file.pth'\n        >>> make_path_relative('/usr/share/something/a-file.pth',\n        ...                    '/home/user/src/Directory')\n        '../../../usr/share/something/a-file.pth'\n        >>> make_path_relative('/usr/share/a-file.pth', '/usr/share/')\n        'a-file.pth'", "docstring_tokens": ["Make", "a", "filename", "relative", "where", "the", "filename", "path", "and", "it", "is", "relative", "to", "rel_to"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259286}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/linear_gaussian_ssm.py#L1577-L1619", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build a callable for one step of Kalman covariance recursion.", "language": "python", "parameters": "(get_transition_matrix_for_timestep,\n                          get_transition_noise_for_timestep,\n                          get_observation_matrix_for_timestep,\n                          get_observation_noise_for_timestep)", "return_statement": "return cov_step", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "def", "cov_step", "(", "arg_4", ",", "arg_5", ")", ":", "arg_6", ",", "arg_7", "=", "arg_4", "arg_8", "=", "_propagate_cov", "(", "arg_6", ",", "arg_0", "(", "arg_5", "-", "1", ")", ",", "arg_1", "(", "arg_5", "-", "1", ")", ")", "arg_9", "=", "_propagate_cov", "(", "arg_8", ",", "arg_2", "(", "arg_5", ")", ",", "arg_3", "(", "arg_5", ")", ")", "return", "(", "arg_8", ",", "arg_9", ")", "return", "cov_step"], "function": "def Func(arg_0,\n                          arg_1,\n                          arg_2,\n                          arg_3):\n  \"\"\"Build a callable for one step of Kalman covariance recursion.\n\n  Args:\n    get_transition_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[latent_size, latent_size]`.\n    get_transition_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[latent_size]`.\n    get_observation_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[observation_size, observation_size]`.\n    get_observation_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[observation_size]`.\n\n  Returns:\n    cov_step: a callable that computes latent state and observation\n      covariance at time `t`, given latent covariance at time `t-1`.\n  \"\"\"\n\n  def cov_step(arg_4, arg_5):\n    \"\"\"Single step of prior covariance recursion.\"\"\"\n    arg_6, arg_7 = arg_4\n\n    arg_8 = _propagate_cov(\n        arg_6,\n        arg_0(arg_5 - 1),\n        arg_1(arg_5 - 1))\n    arg_9 = _propagate_cov(\n        arg_8,\n        arg_2(arg_5),\n        arg_3(arg_5))\n\n    return (arg_8, arg_9)\n\n  return cov_step", "path": "tensorflow_probability/python/distributions/linear_gaussian_ssm.py", "identifier": "build_kalman_cov_step", "docstring": "Build a callable for one step of Kalman covariance recursion.\n\n  Args:\n    get_transition_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[latent_size, latent_size]`.\n    get_transition_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[latent_size]`.\n    get_observation_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[observation_size, observation_size]`.\n    get_observation_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[observation_size]`.\n\n  Returns:\n    cov_step: a callable that computes latent state and observation\n      covariance at time `t`, given latent covariance at time `t-1`.", "docstring_tokens": ["Build", "a", "callable", "for", "one", "step", "of", "Kalman", "covariance", "recursion", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259287}
{"url": "https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_dosage.py#L63-L242", "sha": "3f66a39e15a71b981e8c5f887a4adc3ad486a45f", "docstring_summary": "r\"\"\" Compute dosage from allele expectation.", "language": "python", "parameters": "(expec, alt=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "return", "arg_0", "[", "...", ",", "-", "1", "]", "try", ":", "return", "arg_0", "[", ":", ",", "arg_1", "]", "except", "NotImplementedError", ":", "arg_1", "=", "asarray", "(", "arg_1", ",", "int", ")", "return", "asarray", "(", "arg_0", ",", "float", ")", "[", ":", ",", "arg_1", "]"], "function": "def Func(arg_0, arg_1=None):\n    r\"\"\" Compute dosage from allele expectation.\n\n    Parameters\n    ----------\n    expec : array_like\n        Allele expectations encoded as a samples-by-alleles matrix.\n    alt : array_like, optional\n        Alternative allele index. If ``None``, the allele having the minor\n        allele frequency for the provided ``expec`` is used as the alternative.\n        Defaults to ``None``.\n\n    Returns\n    -------\n    :class:`numpy.ndarray`\n        Dosage encoded as an array of size equal to the number of samples.\n\n    Examples\n    --------\n    .. code-block:: python\n        :caption: First a quick-start example.\n\n        >>> from bgen_reader import allele_expectation, Func\n        >>> from bgen_reader import example_files, read_bgen\n        >>>\n        >>> # Download an example.\n        >>> example = example_files(\"example.32bits.bgen\")\n        >>> filepath = example.filepath\n        >>>\n        >>> # Read the example.\n        >>> bgen = read_bgen(filepath, verbose=False)\n        >>>\n        >>> # Extract the allele expectations of the fourth variant.\n        >>> variant_idx = 3\n        >>> e = allele_expectation(bgen, variant_idx)\n        >>>\n        >>> # Compute the dosage when considering the first allele\n        >>> # as the reference/alternative one.\n        >>> alt_allele_idx = 1\n        >>> d = Func(e, alt=alt_allele_idx)\n        >>>\n        >>> # Print the dosage of the first five samples only.\n        >>> print(d[:5])\n        [1.96185308 0.00982666 0.01745552 1.00347899 1.01153563]\n        >>>\n        >>> # Clean-up the example\n        >>> example.close()\n\n    .. code-block:: python\n        :caption: Genotype probabilities, allele expectations and frequencies.\n\n        >>> from bgen_reader import (\n        ...     allele_expectation,\n        ...     allele_frequency,\n        ...     Func,\n        ...     example_files,\n        ...     read_bgen,\n        ... )\n        >>> from pandas import DataFrame\n        >>> from xarray import DataArray\n        >>>\n        >>> # Download an example\n        >>> example = example_files(\"example.32bits.bgen\")\n        >>> filepath = example.filepath\n        >>>\n        >>> # Open the bgen file.\n        >>> bgen = read_bgen(filepath, verbose=False)\n        >>> variants = bgen[\"variants\"]\n        >>> genotype = bgen[\"genotype\"]\n        >>> samples = bgen[\"samples\"]\n        >>>\n        >>> variant_idx = 3\n        >>> variant = variants.loc[variant_idx].compute()\n        >>> # Print the metadata of the fourth variant.\n        >>> print(variant)\n                id    rsid chrom   pos  nalleles allele_ids  vaddr\n        3  SNPID_5  RSID_5    01  5000         2        A,G  16034\n\n        >>> geno = bgen[\"genotype\"][variant_idx].compute()\n        >>> metageno = DataFrame({k: geno[k] for k in [\"ploidy\", \"missing\"]},\n        ...                      index=samples)\n        >>> metageno.index.name = \"sample\"\n        >>> print(metageno) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n                    ploidy  missing\n        sample\n        sample_001       2    False\n        sample_002       2    False\n        sample_003       2    False\n        sample_004       2    False\n        ...            ...      ...\n        sample_497       2    False\n        sample_498       2    False\n        sample_499       2    False\n        sample_500       2    False\n        <BLANKLINE>\n        [500 rows x 2 columns]\n        >>> p = DataArray(\n        ...     geno[\"probs\"],\n        ...     name=\"probability\",\n        ...     coords={\"sample\": samples},\n        ...     dims=[\"sample\", \"genotype\"],\n        ... )\n        >>> # Print the genotype probabilities.\n        >>> print(p.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n        genotype          0        1        2\n        sample\n        sample_001  0.00488  0.02838  0.96674\n        sample_002  0.99045  0.00928  0.00027\n        sample_003  0.98932  0.00391  0.00677\n        sample_004  0.00662  0.98328  0.01010\n        ...             ...      ...      ...\n        sample_497  0.00137  0.01312  0.98550\n        sample_498  0.00552  0.99423  0.00024\n        sample_499  0.01266  0.01154  0.97580\n        sample_500  0.00021  0.98431  0.01547\n        <BLANKLINE>\n        [500 rows x 3 columns]\n        >>> alleles = variant[\"allele_ids\"].item().split(\",\")\n        >>> e = DataArray(\n        ...     allele_expectation(bgen, variant_idx),\n        ...     name=\"expectation\",\n        ...     coords={\"sample\": samples, \"allele\": alleles},\n        ...     dims=[\"sample\", \"allele\"],\n        ... )\n        >>> # Print the allele expectations.\n        >>> print(e.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n        allele            A        G\n        sample\n        sample_001  0.03815  1.96185\n        sample_002  1.99017  0.00983\n        sample_003  1.98254  0.01746\n        sample_004  0.99652  1.00348\n        ...             ...      ...\n        sample_497  0.01587  1.98413\n        sample_498  1.00528  0.99472\n        sample_499  0.03687  1.96313\n        sample_500  0.98474  1.01526\n        <BLANKLINE>\n        [500 rows x 2 columns]\n        >>> rsid = variant[\"rsid\"].item()\n        >>> chrom = variant[\"chrom\"].item()\n        >>> variant_name = f\"{chrom}:{rsid}\"\n        >>> f = DataFrame(allele_frequency(e), columns=[variant_name], index=alleles)\n        >>> f.index.name = \"allele\"\n        >>> # Allele frequencies.\n        >>> print(f) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n                01:RSID_5\n        allele\n        A       305.97218\n        G       194.02782\n        >>> alt = f.idxmin().item()\n        >>> alt_idx = alleles.index(alt)\n        >>> d = Func(e, alt=alt_idx).to_series()\n        >>> d = DataFrame(d.values, columns=[f\"alt={alt}\"], index=d.index)\n        >>> # Dosages when considering G as the alternative allele.\n        >>> print(d) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n                      alt=G\n        sample\n        sample_001  1.96185\n        sample_002  0.00983\n        sample_003  0.01746\n        sample_004  1.00348\n        ...             ...\n        sample_497  1.98413\n        sample_498  0.99472\n        sample_499  1.96313\n        sample_500  1.01526\n        <BLANKLINE>\n        [500 rows x 1 columns]\n        >>>\n        >>> # Clean-up the example\n        >>> example.close()\n    \"\"\"\n    if arg_1 is None:\n        return arg_0[..., -1]\n    try:\n        return arg_0[:, arg_1]\n    except NotImplementedError:\n        arg_1 = asarray(arg_1, int)\n        return asarray(arg_0, float)[:, arg_1]", "path": "bgen_reader/_dosage.py", "identifier": "compute_dosage", "docstring": "r\"\"\" Compute dosage from allele expectation.\n\n    Parameters\n    ----------\n    expec : array_like\n        Allele expectations encoded as a samples-by-alleles matrix.\n    alt : array_like, optional\n        Alternative allele index. If ``None``, the allele having the minor\n        allele frequency for the provided ``expec`` is used as the alternative.\n        Defaults to ``None``.\n\n    Returns\n    -------\n    :class:`numpy.ndarray`\n        Dosage encoded as an array of size equal to the number of samples.\n\n    Examples\n    --------\n    .. code-block:: python\n        :caption: First a quick-start example.\n\n        >>> from bgen_reader import allele_expectation, compute_dosage\n        >>> from bgen_reader import example_files, read_bgen\n        >>>\n        >>> # Download an example.\n        >>> example = example_files(\"example.32bits.bgen\")\n        >>> filepath = example.filepath\n        >>>\n        >>> # Read the example.\n        >>> bgen = read_bgen(filepath, verbose=False)\n        >>>\n        >>> # Extract the allele expectations of the fourth variant.\n        >>> variant_idx = 3\n        >>> e = allele_expectation(bgen, variant_idx)\n        >>>\n        >>> # Compute the dosage when considering the first allele\n        >>> # as the reference/alternative one.\n        >>> alt_allele_idx = 1\n        >>> d = compute_dosage(e, alt=alt_allele_idx)\n        >>>\n        >>> # Print the dosage of the first five samples only.\n        >>> print(d[:5])\n        [1.96185308 0.00982666 0.01745552 1.00347899 1.01153563]\n        >>>\n        >>> # Clean-up the example\n        >>> example.close()\n\n    .. code-block:: python\n        :caption: Genotype probabilities, allele expectations and frequencies.\n\n        >>> from bgen_reader import (\n        ...     allele_expectation,\n        ...     allele_frequency,\n        ...     compute_dosage,\n        ...     example_files,\n        ...     read_bgen,\n        ... )\n        >>> from pandas import DataFrame\n        >>> from xarray import DataArray\n        >>>\n        >>> # Download an example\n        >>> example = example_files(\"example.32bits.bgen\")\n        >>> filepath = example.filepath\n        >>>\n        >>> # Open the bgen file.\n        >>> bgen = read_bgen(filepath, verbose=False)\n        >>> variants = bgen[\"variants\"]\n        >>> genotype = bgen[\"genotype\"]\n        >>> samples = bgen[\"samples\"]\n        >>>\n        >>> variant_idx = 3\n        >>> variant = variants.loc[variant_idx].compute()\n        >>> # Print the metadata of the fourth variant.\n        >>> print(variant)\n                id    rsid chrom   pos  nalleles allele_ids  vaddr\n        3  SNPID_5  RSID_5    01  5000         2        A,G  16034\n\n        >>> geno = bgen[\"genotype\"][variant_idx].compute()\n        >>> metageno = DataFrame({k: geno[k] for k in [\"ploidy\", \"missing\"]},\n        ...                      index=samples)\n        >>> metageno.index.name = \"sample\"\n        >>> print(metageno) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n                    ploidy  missing\n        sample\n        sample_001       2    False\n        sample_002       2    False\n        sample_003       2    False\n        sample_004       2    False\n        ...            ...      ...\n        sample_497       2    False\n        sample_498       2    False\n        sample_499       2    False\n        sample_500       2    False\n        <BLANKLINE>\n        [500 rows x 2 columns]\n        >>> p = DataArray(\n        ...     geno[\"probs\"],\n        ...     name=\"probability\",\n        ...     coords={\"sample\": samples},\n        ...     dims=[\"sample\", \"genotype\"],\n        ... )\n        >>> # Print the genotype probabilities.\n        >>> print(p.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n        genotype          0        1        2\n        sample\n        sample_001  0.00488  0.02838  0.96674\n        sample_002  0.99045  0.00928  0.00027\n        sample_003  0.98932  0.00391  0.00677\n        sample_004  0.00662  0.98328  0.01010\n        ...             ...      ...      ...\n        sample_497  0.00137  0.01312  0.98550\n        sample_498  0.00552  0.99423  0.00024\n        sample_499  0.01266  0.01154  0.97580\n        sample_500  0.00021  0.98431  0.01547\n        <BLANKLINE>\n        [500 rows x 3 columns]\n        >>> alleles = variant[\"allele_ids\"].item().split(\",\")\n        >>> e = DataArray(\n        ...     allele_expectation(bgen, variant_idx),\n        ...     name=\"expectation\",\n        ...     coords={\"sample\": samples, \"allele\": alleles},\n        ...     dims=[\"sample\", \"allele\"],\n        ... )\n        >>> # Print the allele expectations.\n        >>> print(e.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n        allele            A        G\n        sample\n        sample_001  0.03815  1.96185\n        sample_002  1.99017  0.00983\n        sample_003  1.98254  0.01746\n        sample_004  0.99652  1.00348\n        ...             ...      ...\n        sample_497  0.01587  1.98413\n        sample_498  1.00528  0.99472\n        sample_499  0.03687  1.96313\n        sample_500  0.98474  1.01526\n        <BLANKLINE>\n        [500 rows x 2 columns]\n        >>> rsid = variant[\"rsid\"].item()\n        >>> chrom = variant[\"chrom\"].item()\n        >>> variant_name = f\"{chrom}:{rsid}\"\n        >>> f = DataFrame(allele_frequency(e), columns=[variant_name], index=alleles)\n        >>> f.index.name = \"allele\"\n        >>> # Allele frequencies.\n        >>> print(f) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n                01:RSID_5\n        allele\n        A       305.97218\n        G       194.02782\n        >>> alt = f.idxmin().item()\n        >>> alt_idx = alleles.index(alt)\n        >>> d = compute_dosage(e, alt=alt_idx).to_series()\n        >>> d = DataFrame(d.values, columns=[f\"alt={alt}\"], index=d.index)\n        >>> # Dosages when considering G as the alternative allele.\n        >>> print(d) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE\n                      alt=G\n        sample\n        sample_001  1.96185\n        sample_002  0.00983\n        sample_003  0.01746\n        sample_004  1.00348\n        ...             ...\n        sample_497  1.98413\n        sample_498  0.99472\n        sample_499  1.96313\n        sample_500  1.01526\n        <BLANKLINE>\n        [500 rows x 1 columns]\n        >>>\n        >>> # Clean-up the example\n        >>> example.close()", "docstring_tokens": ["r", "Compute", "dosage", "from", "allele", "expectation", "."], "nwo": "limix/bgen-reader-py", "score": 0.37729991823847475, "idx": 259288}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/registry.py#L145-L157", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Unregister the SizedImage subclass currently assigned to `attr_name`.", "language": "python", "parameters": "(self, attr_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_sizedimage_registry", ":", "raise", "NotRegistered", "(", "'No SizedImage subclass is registered to %s'", "%", "arg_1", ")", "else", ":", "del", "arg_0", ".", "_sizedimage_registry", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Unregister the SizedImage subclass currently assigned to `attr_name`.\n\n        If a SizedImage subclass isn't already registered to `attr_name`\n        NotRegistered will raise.\n        \"\"\"\n        if arg_1 not in arg_0._sizedimage_registry:\n            raise NotRegistered(\n                'No SizedImage subclass is registered to %s' % arg_1\n            )\n        else:\n            del arg_0._sizedimage_registry[arg_1]", "path": "versatileimagefield/registry.py", "identifier": "VersatileImageFieldRegistry.unregister_sizer", "docstring": "Unregister the SizedImage subclass currently assigned to `attr_name`.\n\n        If a SizedImage subclass isn't already registered to `attr_name`\n        NotRegistered will raise.", "docstring_tokens": ["Unregister", "the", "SizedImage", "subclass", "currently", "assigned", "to", "attr_name", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 259289}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/layers/attention.py#L52-L59", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Compute the context vector with soft attention.", "language": "python", "parameters": "(self, prev_state, inputs, precomputed_values=None, mask=None)", "return_statement": "return context_vector", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_3", "=", "arg_3", "if", "arg_3", "else", "arg_0", ".", "precompute", "(", "arg_2", ")", "arg_5", "=", "arg_0", ".", "compute_alignments", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "arg_6", "=", "T", ".", "sum", "(", "arg_5", "[", ":", ",", ":", ",", "None", "]", "*", "arg_2", ",", "axis", "=", "1", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"\n        Compute the context vector with soft attention.\n        \"\"\"\n        arg_3 = arg_3 if arg_3 else arg_0.precompute(arg_2)\n        arg_5 = arg_0.compute_alignments(arg_1, arg_3, arg_4)\n        arg_6 = T.sum(arg_5[:, :, None] * arg_2, axis=1)\n        return arg_6", "path": "deepy/layers/attention.py", "identifier": "Attention.compute_context_vector", "docstring": "Compute the context vector with soft attention.", "docstring_tokens": ["Compute", "the", "context", "vector", "with", "soft", "attention", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 259290}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L92-L107", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Retrieve the given subparser from parser", "language": "python", "parameters": "(parser, command)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "action", "for", "action", "in", "arg_0", ".", "_actions", "if", "isinstance", "(", "action", ",", "argparse", ".", "_SubParsersAction", ")", "]", "for", "arg_3", "in", "arg_2", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "choices", ".", "items", "(", ")", ":", "if", "arg_4", "==", "arg_1", ":", "return", "arg_5", "return", "None"], "function": "def Func(arg_0, arg_1):\n  '''\n  Retrieve the given subparser from parser\n  '''\n  # pylint: disable=protected-access\n  arg_2 = [action for action in arg_0._actions\n                        if isinstance(action, argparse._SubParsersAction)]\n\n  # there will probably only be one subparser_action,\n  # but better save than sorry\n  for arg_3 in arg_2:\n    # get all subparsers\n    for arg_4, arg_5 in arg_3.choices.items():\n      if arg_4 == arg_1:\n        return arg_5\n  return None", "path": "heron/tools/common/src/python/utils/config.py", "identifier": "get_subparser", "docstring": "Retrieve the given subparser from parser", "docstring_tokens": ["Retrieve", "the", "given", "subparser", "from", "parser"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259291}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg/MySQLdb/cursors.py#L427-L435", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Fetch up to size rows from the cursor. Result set may be smaller\n        than size. If size is not defined, cursor.arraysize is used.", "language": "python", "parameters": "(self, size=None)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", ".", "_check_executed", "(", ")", "arg_2", "=", "arg_0", ".", "_fetch_row", "(", "arg_1", "or", "arg_0", ".", "arraysize", ")", "arg_0", ".", "rownumber", "=", "arg_0", ".", "rownumber", "+", "len", "(", "arg_2", ")", "if", "not", "arg_2", ":", "arg_0", ".", "_warning_check", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Fetch up to size rows from the cursor. Result set may be smaller\n        than size. If size is not defined, cursor.arraysize is used.\"\"\"\n        arg_0._check_executed()\n        arg_2 = arg_0._fetch_row(arg_1 or arg_0.arraysize)\n        arg_0.rownumber = arg_0.rownumber + len(arg_2)\n        if not arg_2:\n            arg_0._warning_check()\n        return arg_2", "path": "environment/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", "identifier": "CursorUseResultMixIn.fetchmany", "docstring": "Fetch up to size rows from the cursor. Result set may be smaller\n        than size. If size is not defined, cursor.arraysize is used.", "docstring_tokens": ["Fetch", "up", "to", "size", "rows", "from", "the", "cursor", ".", "Result", "set", "may", "be", "smaller", "than", "size", ".", "If", "size", "is", "not", "defined", "cursor", ".", "arraysize", "is", "used", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259292}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/random_distributed_scalar.py#L415-L447", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Initialize the bucket map assuming the given number of maxBuckets.", "language": "python", "parameters": "(self, maxBuckets, offset)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_maxBuckets", "=", "arg_1", "arg_0", ".", "minIndex", "=", "arg_0", ".", "_maxBuckets", "/", "2", "arg_0", ".", "maxIndex", "=", "arg_0", ".", "_maxBuckets", "/", "2", "arg_0", ".", "_offset", "=", "arg_2", "arg_0", ".", "bucketMap", "=", "{", "}", "def", "_permutation", "(", "arg_8", ")", ":", "arg_9", "=", "numpy", ".", "arange", "(", "arg_8", ",", "dtype", "=", "numpy", ".", "uint32", ")", "arg_0", ".", "random", ".", "shuffle", "(", "arg_9", ")", "return", "arg_9", "arg_0", ".", "bucketMap", "[", "arg_0", ".", "minIndex", "]", "=", "_permutation", "(", "arg_0", ".", "n", ")", "[", "0", ":", "arg_0", ".", "w", "]", "arg_0", ".", "numTries", "=", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Initialize the bucket map assuming the given number of maxBuckets.\n    \"\"\"\n    # The first bucket index will be _maxBuckets / 2 and bucket indices will be\n    # allowed to grow lower or higher as long as they don't become negative.\n    # _maxBuckets is required because the current SDR Classifier assumes bucket\n    # indices must be non-negative. This normally does not need to be changed\n    # but if altered, should be set to an even number.\n    arg_0._maxBuckets = arg_1\n    arg_0.minIndex = arg_0._maxBuckets / 2\n    arg_0.maxIndex = arg_0._maxBuckets / 2\n\n    # The scalar offset used to map scalar values to bucket indices. The middle\n    # bucket will correspond to numbers in the range\n    # [offset-resolution/2, offset+resolution/2).\n    # The bucket index for a number x will be:\n    #     maxBuckets/2 + int( round( (x-offset)/resolution ) )\n    arg_0._offset = arg_2\n\n    # This dictionary maps a bucket index into its bit representation\n    # We initialize the class with a single bucket with index 0\n    arg_0.bucketMap = {}\n\n    def _permutation(arg_8):\n      arg_9 = numpy.arange(arg_8, dtype=numpy.uint32)\n      arg_0.random.shuffle(arg_9)\n      return arg_9\n\n    arg_0.bucketMap[arg_0.minIndex] = _permutation(arg_0.n)[0:arg_0.w]\n\n    # How often we need to retry when generating valid encodings\n    arg_0.numTries = 0", "path": "src/nupic/encoders/random_distributed_scalar.py", "identifier": "RandomDistributedScalarEncoder._initializeBucketMap", "docstring": "Initialize the bucket map assuming the given number of maxBuckets.", "docstring_tokens": ["Initialize", "the", "bucket", "map", "assuming", "the", "given", "number", "of", "maxBuckets", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259293}
{"url": "https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L382-L392", "sha": "6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d", "docstring_summary": "Asynchronous DELETE request with the process pool.", "language": "python", "parameters": "(self, url, name, callback=None, params=None, headers=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "''", "arg_4", "=", "arg_4", "or", "{", "}", "arg_5", "=", "arg_5", "or", "{", "}", "arg_6", "=", "arg_0", ".", "_build_endpoint_url", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_authenticate", "(", "arg_4", ",", "arg_5", ")", "process_pool", ".", "apply_async", "(", "make_delete_request", ",", "args", "=", "(", "arg_6", ",", "arg_4", ",", "arg_5", ")", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"\n        Asynchronous DELETE request with the process pool.\n        \"\"\"\n        if not arg_2: arg_2 = ''\n        arg_4 = arg_4 or {}\n        arg_5 = arg_5 or {}\n        arg_6 = arg_0._build_endpoint_url(arg_1, arg_2)\n        arg_0._authenticate(arg_4, arg_5)\n        process_pool.apply_async(make_delete_request,\n                    args=(arg_6, arg_4, arg_5), arg_3=arg_3)", "path": "firebase/firebase.py", "identifier": "FirebaseApplication.delete_async", "docstring": "Asynchronous DELETE request with the process pool.", "docstring_tokens": ["Asynchronous", "DELETE", "request", "with", "the", "process", "pool", "."], "nwo": "ozgur/python-firebase", "score": 0.7583798599854712, "idx": 259294}
{"url": "https://github.com/hhatto/pgmagick/blob/5dce5fa4681400b4c059431ad69233e6a3e5799a/pgmagick/api.py#L953-L961", "sha": "5dce5fa4681400b4c059431ad69233e6a3e5799a", "docstring_summary": "set to stroke linecap.", "language": "python", "parameters": "(self, linecap)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "getattr", "(", "pgmagick", ".", "LineCap", ",", "\"%sCap\"", "%", "arg_1", ".", "title", "(", ")", ")", "arg_1", "=", "pgmagick", ".", "DrawableStrokeLineCap", "(", "arg_1", ")", "arg_0", ".", "drawer", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"set to stroke linecap.\n\n        :param linecap: 'undefined', 'butt', 'round', 'square'\n        :type linecap: str\n        \"\"\"\n        arg_1 = getattr(pgmagick.LineCap, \"%sCap\" % arg_1.title())\n        arg_1 = pgmagick.DrawableStrokeLineCap(arg_1)\n        arg_0.drawer.append(arg_1)", "path": "pgmagick/api.py", "identifier": "Draw.stroke_linecap", "docstring": "set to stroke linecap.\n\n        :param linecap: 'undefined', 'butt', 'round', 'square'\n        :type linecap: str", "docstring_tokens": ["set", "to", "stroke", "linecap", "."], "nwo": "hhatto/pgmagick", "score": 0.37249488389724494, "idx": 259295}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/definitions/pipeline.py#L185-L201", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Return the solid named \"name\". Throws if it does not exist.", "language": "python", "parameters": "(self, name)", "return_statement": "return self._solid_dict[name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check", ".", "str_param", "(", "arg_1", ",", "'name'", ")", "if", "arg_1", "not", "in", "arg_0", ".", "_solid_dict", ":", "raise", "DagsterInvariantViolationError", "(", "'Pipeline {pipeline_name} has no solid named {name}.'", ".", "format", "(", "pipeline_name", "=", "arg_0", ".", "name", ",", "arg_1", "=", "arg_1", ")", ")", "return", "arg_0", ".", "_solid_dict", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        '''Return the solid named \"name\". Throws if it does not exist.\n\n        Args:\n            name (str): Name of solid\n\n        Returns:\n            SolidDefinition: SolidDefinition with correct name.\n        '''\n        check.str_param(arg_1, 'name')\n        if arg_1 not in arg_0._solid_dict:\n            raise DagsterInvariantViolationError(\n                'Pipeline {pipeline_name} has no solid named {name}.'.format(\n                    pipeline_name=arg_0.name, arg_1=arg_1\n                )\n            )\n        return arg_0._solid_dict[arg_1]", "path": "python_modules/dagster/dagster/core/definitions/pipeline.py", "identifier": "PipelineDefinition.solid_named", "docstring": "Return the solid named \"name\". Throws if it does not exist.\n\n        Args:\n            name (str): Name of solid\n\n        Returns:\n            SolidDefinition: SolidDefinition with correct name.", "docstring_tokens": ["Return", "the", "solid", "named", "name", ".", "Throws", "if", "it", "does", "not", "exist", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 259296}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/docmaker/tohtml.py#L255-L285", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "analyze a simple word to detect cross-references and styling", "language": "python", "parameters": "( self, word )", "return_statement": "return html_quote( word )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "re_crossref", ".", "match", "(", "arg_1", ")", "if", "arg_2", ":", "try", ":", "arg_3", "=", "arg_2", ".", "group", "(", "1", ")", "arg_4", "=", "arg_2", ".", "group", "(", "2", ")", "arg_5", "=", "arg_0", ".", "identifiers", "[", "arg_3", "]", "arg_6", "=", "arg_0", ".", "make_block_url", "(", "arg_5", ")", "return", "'<a href=\"'", "+", "arg_6", "+", "'\">'", "+", "arg_3", "+", "'</a>'", "+", "arg_4", "except", ":", "sys", ".", "stderr", ".", "write", "(", "\"WARNING: undefined cross reference '\"", "+", "arg_3", "+", "\"'.\\n\"", ")", "return", "'?'", "+", "arg_3", "+", "'?'", "+", "arg_4", "arg_2", "=", "re_italic", ".", "match", "(", "arg_1", ")", "if", "arg_2", ":", "arg_3", "=", "arg_2", ".", "group", "(", "1", ")", "arg_4", "=", "arg_2", ".", "group", "(", "3", ")", "return", "'<i>'", "+", "arg_3", "+", "'</i>'", "+", "arg_4", "arg_2", "=", "re_bold", ".", "match", "(", "arg_1", ")", "if", "arg_2", ":", "arg_3", "=", "arg_2", ".", "group", "(", "1", ")", "arg_4", "=", "arg_2", ".", "group", "(", "3", ")", "return", "'<b>'", "+", "arg_3", "+", "'</b>'", "+", "arg_4", "return", "html_quote", "(", "arg_1", ")"], "function": "def  Func( arg_0, arg_1 ):\n        \"\"\"analyze a simple word to detect cross-references and styling\"\"\"\n        # look for cross-references\n        arg_2 = re_crossref.match( arg_1 )\n        if arg_2:\n            try:\n                arg_3 = arg_2.group( 1 )\n                arg_4 = arg_2.group( 2 )\n                arg_5 = arg_0.identifiers[arg_3]\n                arg_6   = arg_0.make_block_url( arg_5 )\n                return '<a href=\"' + arg_6 + '\">' + arg_3 + '</a>' + arg_4\n            except:\n                # we detected a cross-reference to an unknown item\n                sys.stderr.write( \\\n                   \"WARNING: undefined cross reference '\" + arg_3 + \"'.\\n\" )\n                return '?' + arg_3 + '?' + arg_4\n\n        # look for italics and bolds\n        arg_2 = re_italic.match( arg_1 )\n        if arg_2:\n            arg_3 = arg_2.group( 1 )\n            arg_4 = arg_2.group( 3 )\n            return '<i>' + arg_3 + '</i>' + arg_4\n\n        arg_2 = re_bold.match( arg_1 )\n        if arg_2:\n            arg_3 = arg_2.group( 1 )\n            arg_4 = arg_2.group( 3 )\n            return '<b>' + arg_3 + '</b>' + arg_4\n\n        return html_quote( arg_1 )", "path": "native/Vendor/FreeType/src/tools/docmaker/tohtml.py", "identifier": "HtmlFormatter.make_html_word", "docstring": "analyze a simple word to detect cross-references and styling", "docstring_tokens": ["analyze", "a", "simple", "word", "to", "detect", "cross", "-", "references", "and", "styling"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 259297}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/pgmanager.py#L213-L230", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Get a directory from the database.", "language": "python", "parameters": "(self, path, content, format)", "return_statement": "return self._directory_model_from_db(record, content)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "with", "arg_0", ".", "engine", ".", "begin", "(", ")", "as", "db", ":", "try", ":", "arg_4", "=", "get_directory", "(", "db", ",", "arg_0", ".", "user_id", ",", "arg_1", ",", "arg_2", ")", "except", "NoSuchDirectory", ":", "if", "arg_0", ".", "file_exists", "(", "arg_1", ")", ":", "arg_0", ".", "do_400", "(", "\"Wrong type: %s\"", "%", "arg_1", ")", "else", ":", "arg_0", ".", "no_such_entity", "(", "arg_1", ")", "return", "arg_0", ".", "_directory_model_from_db", "(", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Get a directory from the database.\n        \"\"\"\n        with arg_0.engine.begin() as db:\n            try:\n                arg_4 = get_directory(\n                    db, arg_0.user_id, arg_1, arg_2\n                )\n            except NoSuchDirectory:\n                if arg_0.file_exists(arg_1):\n                    # TODO: It's awkward/expensive to have to check this to\n                    # return a 400 instead of 404. Consider just 404ing.\n                    arg_0.do_400(\"Wrong type: %s\" % arg_1)\n                else:\n                    arg_0.no_such_entity(arg_1)\n\n        return arg_0._directory_model_from_db(arg_4, arg_2)", "path": "pgcontents/pgmanager.py", "identifier": "PostgresContentsManager._get_directory", "docstring": "Get a directory from the database.", "docstring_tokens": ["Get", "a", "directory", "from", "the", "database", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 259298}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py#L135-L164", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "If possible, set the input buffer to a previous history item.", "language": "python", "parameters": "(self, substring='', as_prefix=True)", "return_statement": "return replace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "_history_index", "arg_4", "=", "False", "while", "arg_3", ">", "0", ":", "arg_3", "-=", "1", "arg_5", "=", "arg_0", ".", "_get_edited_history", "(", "arg_3", ")", "if", "(", "arg_2", "and", "arg_5", ".", "startswith", "(", "arg_1", ")", ")", "or", "(", "not", "arg_2", "and", "arg_1", "in", "arg_5", ")", ":", "arg_4", "=", "True", "break", "if", "arg_4", ":", "arg_0", ".", "_store_edits", "(", ")", "arg_0", ".", "_history_index", "=", "arg_3", "arg_0", ".", "input_buffer", "=", "arg_5", "return", "arg_4"], "function": "def Func(arg_0, arg_1='', arg_2=True):\n        \"\"\" If possible, set the input buffer to a previous history item.\n\n        Parameters:\n        -----------\n        substring : str, optional\n            If specified, search for an item with this substring.\n        as_prefix : bool, optional\n            If True, the substring must match at the beginning (default).\n\n        Returns:\n        --------\n        Whether the input buffer was changed.\n        \"\"\"\n        arg_3 = arg_0._history_index\n        arg_4 = False\n        while arg_3 > 0:\n            arg_3 -= 1\n            arg_5 = arg_0._get_edited_history(arg_3)\n            if (arg_2 and arg_5.startswith(arg_1)) \\\n                or (not arg_2 and arg_1 in arg_5):\n                arg_4 = True\n                break\n\n        if arg_4:\n            arg_0._store_edits()\n            arg_0._history_index = arg_3\n            arg_0.input_buffer = arg_5\n\n        return arg_4", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py", "identifier": "HistoryConsoleWidget.history_previous", "docstring": "If possible, set the input buffer to a previous history item.\n\n        Parameters:\n        -----------\n        substring : str, optional\n            If specified, search for an item with this substring.\n        as_prefix : bool, optional\n            If True, the substring must match at the beginning (default).\n\n        Returns:\n        --------\n        Whether the input buffer was changed.", "docstring_tokens": ["If", "possible", "set", "the", "input", "buffer", "to", "a", "previous", "history", "item", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259299}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/tfs/__init__.py#L153-L167", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Returns a list of all tfvc branches for the supplied project within the supplied collection", "language": "python", "parameters": "(url, token, collection, project)", "return_statement": "return branch_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "create_tfs_tfvc_client", "(", "'{url}/{collection_name}'", ".", "format", "(", "arg_0", "=", "arg_0", ",", "collection_name", "=", "arg_2", ".", "name", ")", ",", "arg_1", ")", "logger", ".", "debug", "(", "'Retrieving Tfvc Branches for Project: {project_name}'", ".", "format", "(", "project_name", "=", "arg_3", ".", "name", ")", ")", "arg_6", "=", "arg_5", ".", "get_branches", "(", "arg_3", ".", "id", ",", "True", ",", "True", ",", "False", ",", "True", ")", "if", "arg_6", ":", "arg_4", ".", "extend", "(", "arg_6", ")", "else", ":", "logger", ".", "debug", "(", "'No Tfvcc Branches in Project: {project_name}'", ".", "format", "(", "project_name", "=", "arg_3", ".", "name", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Returns a list of all tfvc branches for the supplied project within the supplied collection\n    \"\"\"\n    arg_4 = []\n    arg_5 = create_tfs_tfvc_client('{url}/{collection_name}'.format(arg_0=arg_0, collection_name=arg_2.name), arg_1)\n\n    logger.debug('Retrieving Tfvc Branches for Project: {project_name}'.format(project_name=arg_3.name))\n    arg_6 = arg_5.get_branches(arg_3.id, True, True, False, True)\n    if arg_6:\n        arg_4.extend(arg_6)\n    else:\n        logger.debug('No Tfvcc Branches in Project: {project_name}'.format(project_name=arg_3.name))\n\n    return arg_4", "path": "scraper/tfs/__init__.py", "identifier": "get_tfvc_repos", "docstring": "Returns a list of all tfvc branches for the supplied project within the supplied collection", "docstring_tokens": ["Returns", "a", "list", "of", "all", "tfvc", "branches", "for", "the", "supplied", "project", "within", "the", "supplied", "collection"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 259300}
{"url": "https://github.com/sbneto/s3conf/blob/92fd2973beccc85bb21d3157ff227929e62ed695/s3conf/files.py#L16-L31", "sha": "92fd2973beccc85bb21d3157ff227929e62ed695", "docstring_summary": "Split a env var text like", "language": "python", "parameters": "(value)", "return_statement": "return k, v", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", ".", "partition", "(", "'='", ")", "arg_1", ",", "arg_3", "=", "arg_1", ".", "strip", "(", ")", ",", "arg_3", ".", "strip", "(", ")", ".", "encode", "(", "'unicode-escape'", ")", ".", "decode", "(", "'ascii'", ")", "if", "arg_3", "and", "arg_3", "[", "0", "]", "==", "arg_3", "[", "-", "1", "]", "in", "[", "'\"'", ",", "\"'\"", "]", ":", "arg_3", "=", "__escape_decoder", "(", "arg_3", "[", "1", ":", "-", "1", "]", ")", "[", "0", "]", "return", "arg_1", ",", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Split a env var text like\n\n    ENV_VAR_NAME=env_var_value\n\n    into a tuple ('ENV_VAR_NAME', 'env_var_value')\n    \"\"\"\n    arg_1, arg_2, arg_3 = arg_0.partition('=')\n\n    # Remove any leading and trailing spaces in key, value\n    arg_1, arg_3 = arg_1.strip(), arg_3.strip().encode('unicode-escape').decode('ascii')\n\n    if arg_3 and arg_3[0] == arg_3[-1] in ['\"', \"'\"]:\n        arg_3 = __escape_decoder(arg_3[1:-1])[0]\n    return arg_1, arg_3", "path": "s3conf/files.py", "identifier": "parse_env_var", "docstring": "Split a env var text like\n\n    ENV_VAR_NAME=env_var_value\n\n    into a tuple ('ENV_VAR_NAME', 'env_var_value')", "docstring_tokens": ["Split", "a", "env", "var", "text", "like"], "nwo": "sbneto/s3conf", "score": 0.3282631104312029, "idx": 259301}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/engine/engine.py#L119-L134", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "send the registration_request", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"Registering with controller at %s\"", "%", "arg_0", ".", "url", ")", "arg_1", "=", "arg_0", ".", "context", "arg_2", ",", "arg_3", "=", "arg_0", ".", "init_connector", "(", ")", "arg_4", "=", "arg_1", ".", "socket", "(", "zmq", ".", "DEALER", ")", "arg_4", ".", "setsockopt", "(", "zmq", ".", "IDENTITY", ",", "arg_0", ".", "bident", ")", "arg_2", "(", "arg_4", ",", "arg_0", ".", "url", ")", "arg_0", ".", "registrar", "=", "zmqstream", ".", "ZMQStream", "(", "arg_4", ",", "arg_0", ".", "loop", ")", "arg_6", "=", "dict", "(", "queue", "=", "arg_0", ".", "ident", ",", "heartbeat", "=", "arg_0", ".", "ident", ",", "control", "=", "arg_0", ".", "ident", ")", "arg_0", ".", "registrar", ".", "on_recv", "(", "lambda", "msg", ":", "arg_0", ".", "complete_registration", "(", "msg", ",", "arg_2", ",", "arg_3", ")", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "registrar", ",", "\"registration_request\"", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0):\n        \"\"\"send the registration_request\"\"\"\n\n        arg_0.log.info(\"Registering with controller at %s\"%arg_0.url)\n        arg_1 = arg_0.context\n        arg_2,arg_3 = arg_0.init_connector()\n        arg_4 = arg_1.socket(zmq.DEALER)\n        arg_4.setsockopt(zmq.IDENTITY, arg_0.bident)\n        arg_2(arg_4, arg_0.url)\n        arg_0.registrar = zmqstream.ZMQStream(arg_4, arg_0.loop)\n\n\n        arg_6 = dict(queue=arg_0.ident, heartbeat=arg_0.ident, control=arg_0.ident)\n        arg_0.registrar.on_recv(lambda msg: arg_0.complete_registration(msg, arg_2, arg_3))\n        # print (self.session.key)\n        arg_0.session.send(arg_0.registrar, \"registration_request\",arg_6=arg_6)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/engine/engine.py", "identifier": "EngineFactory.register", "docstring": "send the registration_request", "docstring_tokens": ["send", "the", "registration_request"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259302}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/optimize_1q_gates.py#L194-L209", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a triple theta, phi, lambda for the product.", "language": "python", "parameters": "(theta1, phi1, lambda1, theta2, phi2, lambda2)", "return_statement": "return (theta, phi, lamb)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", ",", "arg_7", ",", "arg_8", "=", "Optimize1qGates", ".", "yzy_to_zyz", "(", "(", "arg_2", "+", "arg_4", ")", ",", "arg_0", ",", "arg_3", ")", "(", "arg_9", ",", "arg_10", ",", "arg_11", ")", "=", "(", "arg_6", ",", "arg_1", "+", "arg_7", ",", "arg_5", "+", "arg_8", ")", "return", "(", "arg_9", ",", "arg_10", ",", "arg_11", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"Return a triple theta, phi, lambda for the product.\n\n        u3(theta, phi, lambda)\n           = u3(theta1, phi1, lambda1).u3(theta2, phi2, lambda2)\n           = Rz(phi1).Ry(theta1).Rz(lambda1+phi2).Ry(theta2).Rz(lambda2)\n           = Rz(phi1).Rz(phi').Ry(theta').Rz(lambda').Rz(lambda2)\n           = u3(theta', phi1 + phi', lambda2 + lambda')\n\n        Return theta, phi, lambda.\n        \"\"\"\n        # Careful with the factor of two in yzy_to_zyz\n        arg_6, arg_7, arg_8 = Optimize1qGates.yzy_to_zyz((arg_2 + arg_4), arg_0, arg_3)\n        (arg_9, arg_10, arg_11) = (arg_6, arg_1 + arg_7, arg_5 + arg_8)\n\n        return (arg_9, arg_10, arg_11)", "path": "qiskit/transpiler/passes/optimize_1q_gates.py", "identifier": "Optimize1qGates.compose_u3", "docstring": "Return a triple theta, phi, lambda for the product.\n\n        u3(theta, phi, lambda)\n           = u3(theta1, phi1, lambda1).u3(theta2, phi2, lambda2)\n           = Rz(phi1).Ry(theta1).Rz(lambda1+phi2).Ry(theta2).Rz(lambda2)\n           = Rz(phi1).Rz(phi').Ry(theta').Rz(lambda').Rz(lambda2)\n           = u3(theta', phi1 + phi', lambda2 + lambda')\n\n        Return theta, phi, lambda.", "docstring_tokens": ["Return", "a", "triple", "theta", "phi", "lambda", "for", "the", "product", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259303}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L304-L328", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Load metadata from the archive file", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"Loading metadata infomation of archive %s\"", ",", "arg_0", ".", "archive_path", ")", "arg_1", "=", "arg_0", ".", "_db", ".", "cursor", "(", ")", "arg_2", "=", "\"SELECT origin, backend_name, backend_version, \"", "\"category, backend_params, created_on \"", "\"FROM \"", "+", "arg_0", ".", "METADATA_TABLE", "+", "\" \"", "\"LIMIT 1\"", "arg_1", ".", "execute", "(", "arg_2", ")", "arg_3", "=", "arg_1", ".", "fetchone", "(", ")", "arg_1", ".", "close", "(", ")", "if", "arg_3", ":", "arg_0", ".", "origin", "=", "arg_3", "[", "0", "]", "arg_0", ".", "backend_name", "=", "arg_3", "[", "1", "]", "arg_0", ".", "backend_version", "=", "arg_3", "[", "2", "]", "arg_0", ".", "category", "=", "arg_3", "[", "3", "]", "arg_0", ".", "backend_params", "=", "pickle", ".", "loads", "(", "arg_3", "[", "4", "]", ")", "arg_0", ".", "created_on", "=", "str_to_datetime", "(", "arg_3", "[", "5", "]", ")", "else", ":", "logger", ".", "debug", "(", "\"Metadata of archive %s was empty\"", ",", "arg_0", ".", "archive_path", ")", "logger", ".", "debug", "(", "\"Metadata of archive %s loaded\"", ",", "arg_0", ".", "archive_path", ")"], "function": "def Func(arg_0):\n        \"\"\"Load metadata from the archive file\"\"\"\n\n        logger.debug(\"Loading metadata infomation of archive %s\", arg_0.archive_path)\n\n        arg_1 = arg_0._db.cursor()\n        arg_2 = \"SELECT origin, backend_name, backend_version, \" \\\n                      \"category, backend_params, created_on \" \\\n                      \"FROM \" + arg_0.METADATA_TABLE + \" \" \\\n                      \"LIMIT 1\"\n        arg_1.execute(arg_2)\n        arg_3 = arg_1.fetchone()\n        arg_1.close()\n\n        if arg_3:\n            arg_0.origin = arg_3[0]\n            arg_0.backend_name = arg_3[1]\n            arg_0.backend_version = arg_3[2]\n            arg_0.category = arg_3[3]\n            arg_0.backend_params = pickle.loads(arg_3[4])\n            arg_0.created_on = str_to_datetime(arg_3[5])\n        else:\n            logger.debug(\"Metadata of archive %s was empty\", arg_0.archive_path)\n\n        logger.debug(\"Metadata of archive %s loaded\", arg_0.archive_path)", "path": "perceval/archive.py", "identifier": "Archive._load_metadata", "docstring": "Load metadata from the archive file", "docstring_tokens": ["Load", "metadata", "from", "the", "archive", "file"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259304}
{"url": "https://github.com/etingof/pysmi/blob/379a0a384c81875731be51a054bdacced6260fd8/pysmi/compiler.py#L115-L134", "sha": "379a0a384c81875731be51a054bdacced6260fd8", "docstring_summary": "Add more transformed MIBs repositories.", "language": "python", "parameters": "(self, *searchers)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_0", ".", "_searchers", ".", "extend", "(", "arg_1", ")", "debug", ".", "logger", "&", "debug", ".", "flagCompiler", "and", "debug", ".", "logger", "(", "'current compiled MIBs location(s): %s'", "%", "', '", ".", "join", "(", "[", "str", "(", "arg_2", ")", "for", "arg_2", "in", "arg_0", ".", "_searchers", "]", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Add more transformed MIBs repositories.\n\n        MibCompiler.compile will invoke each of configured searcher objects\n        in order of their addition asking each if already transformed MIB\n        module already exists and is more recent than specified.\n\n        Args:\n            searchers: searcher object(s)\n\n        Returns:\n            reference to itself (can be used for call chaining)\n\n        \"\"\"\n        arg_0._searchers.extend(arg_1)\n\n        debug.logger & debug.flagCompiler and debug.logger(\n            'current compiled MIBs location(s): %s' % ', '.join([str(arg_2) for arg_2 in arg_0._searchers]))\n\n        return arg_0", "path": "pysmi/compiler.py", "identifier": "MibCompiler.addSearchers", "docstring": "Add more transformed MIBs repositories.\n\n        MibCompiler.compile will invoke each of configured searcher objects\n        in order of their addition asking each if already transformed MIB\n        module already exists and is more recent than specified.\n\n        Args:\n            searchers: searcher object(s)\n\n        Returns:\n            reference to itself (can be used for call chaining)", "docstring_tokens": ["Add", "more", "transformed", "MIBs", "repositories", "."], "nwo": "etingof/pysmi", "score": 0.7357516696107086, "idx": 259305}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L250-L275", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Select last row", "language": "python", "parameters": "(self, window_name, object_name)", "return_statement": "return 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get_object_handle", "(", "arg_1", ",", "arg_2", ")", "if", "not", "arg_3", ".", "AXEnabled", ":", "raise", "LdtpServerException", "(", "u\"Object %s state disabled\"", "%", "arg_2", ")", "arg_4", "=", "arg_3", ".", "AXRows", "[", "-", "1", "]", "if", "not", "arg_4", ".", "AXSelected", ":", "arg_3", ".", "activate", "(", ")", "arg_4", ".", "AXSelected", "=", "True", "else", ":", "pass", "return", "1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Select last row\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob. \n        @type object_name: string\n\n        @return: 1 on success.\n        @rtype: integer\n        \"\"\"\n        arg_3 = arg_0._get_object_handle(arg_1, arg_2)\n        if not arg_3.AXEnabled:\n            raise LdtpServerException(u\"Object %s state disabled\" % arg_2)\n\n        arg_4 = arg_3.AXRows[-1]\n        if not arg_4.AXSelected:\n            arg_3.activate()\n            arg_4.AXSelected = True\n        else:\n            # Selected\n            pass\n        return 1", "path": "atomac/ldtpd/table.py", "identifier": "Table.selectlastrow", "docstring": "Select last row\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob. \n        @type object_name: string\n\n        @return: 1 on success.\n        @rtype: integer", "docstring_tokens": ["Select", "last", "row"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 259306}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/iomanager.py#L175-L186", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Returns a stderr-suitable file-like object based on the\n        optional os_path and optionally skipping any configured\n        sub-command.", "language": "python", "parameters": "(self, os_path=None, skip_sub_command=False)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "None", "if", "arg_2", "else", "arg_0", ".", "stderr_sub_command", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_get_out_and_path", "(", "arg_0", ".", "stderr", ",", "arg_0", ".", "stderr_root", ",", "arg_3", ",", "arg_1", ")", "if", "hasattr", "(", "arg_4", ",", "'stdin'", ")", ":", "return", "arg_4", ".", "stdin", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"\n        Returns a stderr-suitable file-like object based on the\n        optional os_path and optionally skipping any configured\n        sub-command.\n        \"\"\"\n        arg_3 = None if arg_2 else arg_0.stderr_sub_command\n        arg_4, arg_5 = arg_0._get_out_and_path(\n            arg_0.stderr, arg_0.stderr_root, arg_3, arg_1)\n        if hasattr(arg_4, 'stdin'):\n            return arg_4.stdin\n        return arg_4", "path": "swiftly/cli/iomanager.py", "identifier": "IOManager.get_stderr", "docstring": "Returns a stderr-suitable file-like object based on the\n        optional os_path and optionally skipping any configured\n        sub-command.", "docstring_tokens": ["Returns", "a", "stderr", "-", "suitable", "file", "-", "like", "object", "based", "on", "the", "optional", "os_path", "and", "optionally", "skipping", "any", "configured", "sub", "-", "command", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 259307}
{"url": "https://github.com/cmcginty/PyWeather/blob/8c25d9cd1fa921e0a6e460d523656279cac045cb/weather/stations/davis.py#L430-L492", "sha": "8c25d9cd1fa921e0a6e460d523656279cac045cb", "docstring_summary": "issue a command to read the archive records after a known time stamp.", "language": "python", "parameters": "(self, time_fields)", "return_statement": "return records", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "struct", ".", "pack", "(", "'2H'", ",", "*", "arg_1", ")", "arg_0", ".", "_cmd", "(", "'DMPAFT'", ")", "arg_4", "=", "VProCRC", ".", "get", "(", "arg_3", ")", "arg_4", "=", "struct", ".", "pack", "(", "'>H'", ",", "arg_4", ")", "log_raw", "(", "'send'", ",", "arg_3", "+", "arg_4", ")", "arg_0", ".", "port", ".", "write", "(", "arg_3", "+", "arg_4", ")", "arg_5", "=", "arg_0", ".", "port", ".", "read", "(", "len", "(", "arg_0", ".", "ACK", ")", ")", "log_raw", "(", "'read'", ",", "arg_5", ")", "if", "arg_5", "!=", "arg_0", ".", "ACK", ":", "return", "arg_6", "=", "arg_0", ".", "port", ".", "read", "(", "DmpStruct", ".", "size", ")", "log_raw", "(", "'read'", ",", "arg_6", ")", "if", "not", "VProCRC", ".", "verify", "(", "arg_6", ")", ":", "log_raw", "(", "'send ESC'", ",", "arg_0", ".", "ESC", ")", "arg_0", ".", "port", ".", "write", "(", "arg_0", ".", "ESC", ")", "return", "log_raw", "(", "'send ACK'", ",", "arg_0", ".", "ACK", ")", "arg_0", ".", "port", ".", "write", "(", "arg_0", ".", "ACK", ")", "arg_7", "=", "DmpStruct", ".", "unpack", "(", "arg_6", ")", "log", ".", "info", "(", "'reading %d pages, start offset %d'", "%", "(", "arg_7", "[", "'Pages'", "]", ",", "arg_7", "[", "'Offset'", "]", ")", ")", "for", "arg_8", "in", "xrange", "(", "arg_7", "[", "'Pages'", "]", ")", ":", "arg_6", "=", "arg_0", ".", "port", ".", "read", "(", "DmpPageStruct", ".", "size", ")", "log_raw", "(", "'read'", ",", "arg_6", ")", "if", "not", "VProCRC", ".", "verify", "(", "arg_6", ")", ":", "log_raw", "(", "'send ESC'", ",", "arg_0", ".", "ESC", ")", "arg_0", ".", "port", ".", "write", "(", "arg_0", ".", "ESC", ")", "return", "log_raw", "(", "'send ACK'", ",", "arg_0", ".", "ACK", ")", "arg_0", ".", "port", ".", "write", "(", "arg_0", ".", "ACK", ")", "arg_9", "=", "DmpPageStruct", ".", "unpack", "(", "arg_6", ")", "arg_10", "=", "0", "if", "arg_8", "==", "0", ":", "arg_10", "=", "arg_7", "[", "'Offset'", "]", "*", "ArchiveAStruct", ".", "size", "while", "arg_10", "<", "ArchiveAStruct", ".", "size", "*", "5", ":", "log", ".", "info", "(", "'page %d, reading record at offset %d'", "%", "(", "arg_9", "[", "'Index'", "]", ",", "arg_10", ")", ")", "if", "arg_0", ".", "_use_rev_b_archive", "(", "arg_9", "[", "'Records'", "]", ",", "arg_10", ")", ":", "arg_11", "=", "ArchiveBStruct", ".", "unpack_from", "(", "arg_9", "[", "'Records'", "]", ",", "arg_10", ")", "else", ":", "arg_11", "=", "ArchiveAStruct", ".", "unpack_from", "(", "arg_9", "[", "'Records'", "]", ",", "arg_10", ")", "if", "arg_11", "[", "'DateStamp'", "]", "!=", "0xffff", "and", "arg_11", "[", "'TimeStamp'", "]", "!=", "0xffff", ":", "arg_2", ".", "append", "(", "arg_11", ")", "arg_10", "+=", "ArchiveAStruct", ".", "size", "log", ".", "info", "(", "'read all pages'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''\n        issue a command to read the archive records after a known time stamp.\n        '''\n        arg_2 = []\n        # convert time stamp fields to buffer\n        arg_3 = struct.pack('2H', *arg_1)\n\n        # 1. send 'DMPAFT' cmd\n        arg_0._cmd('DMPAFT')\n\n        # 2. send time stamp + crc\n        arg_4 = VProCRC.get(arg_3)\n        arg_4 = struct.pack('>H', arg_4)  # crc in big-endian format\n        log_raw('send', arg_3 + arg_4)\n        arg_0.port.write(arg_3 + arg_4)  # send time stamp + crc\n        arg_5 = arg_0.port.read(len(arg_0.ACK))  # read ACK\n        log_raw('read', arg_5)\n        if arg_5 != arg_0.ACK: return  # if bad ack, return\n\n        # 3. read pre-amble data\n        arg_6 = arg_0.port.read(DmpStruct.size)\n        log_raw('read', arg_6)\n        if not VProCRC.verify(arg_6):  # check CRC value\n            log_raw('send ESC', arg_0.ESC)\n            arg_0.port.write(arg_0.ESC)  # if bad, escape and abort\n            return\n        log_raw('send ACK', arg_0.ACK)\n        arg_0.port.write(arg_0.ACK)  # send ACK\n\n        # 4. loop through all page records\n        arg_7 = DmpStruct.unpack(arg_6)\n        log.info('reading %d pages, start offset %d' %\n                 (arg_7['Pages'], arg_7['Offset']))\n        for arg_8 in xrange(arg_7['Pages']):\n            # 5. read page data\n            arg_6 = arg_0.port.read(DmpPageStruct.size)\n            log_raw('read', arg_6)\n            if not VProCRC.verify(arg_6):  # check CRC value\n                log_raw('send ESC', arg_0.ESC)\n                arg_0.port.write(arg_0.ESC)  # if bad, escape and abort\n                return\n            log_raw('send ACK', arg_0.ACK)\n            arg_0.port.write(arg_0.ACK)  # send ACK\n\n            # 6. loop through archive records\n            arg_9 = DmpPageStruct.unpack(arg_6)\n            arg_10 = 0  # assume offset at 0\n            if arg_8 == 0:\n                arg_10 = arg_7['Offset'] * ArchiveAStruct.size\n            while arg_10 < ArchiveAStruct.size * 5:\n                log.info('page %d, reading record at offset %d' %\n                         (arg_9['Index'], arg_10))\n                if arg_0._use_rev_b_archive(arg_9['Records'], arg_10):\n                    arg_11 = ArchiveBStruct.unpack_from(arg_9['Records'], arg_10)\n                else:\n                    arg_11 = ArchiveAStruct.unpack_from(arg_9['Records'], arg_10)\n                # 7. verify that record has valid data, and store\n                if arg_11['DateStamp'] != 0xffff and arg_11['TimeStamp'] != 0xffff:\n                    arg_2.append(arg_11)\n                arg_10 += ArchiveAStruct.size\n        log.info('read all pages')\n        return arg_2", "path": "weather/stations/davis.py", "identifier": "VantagePro._dmpaft_cmd", "docstring": "issue a command to read the archive records after a known time stamp.", "docstring_tokens": ["issue", "a", "command", "to", "read", "the", "archive", "records", "after", "a", "known", "time", "stamp", "."], "nwo": "cmcginty/PyWeather", "score": 0.19714217663807126, "idx": 259308}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1996-L2027", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Summarizes data handled by the result as a string.", "language": "python", "parameters": "(self)", "return_statement": "return return_string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ".", "_data", ":", "arg_4", "=", "arg_0", ".", "_data", "[", "arg_3", "]", "arg_5", "=", "'%s=%s, '", "%", "(", "arg_3", ",", "repr", "(", "arg_4", ")", ")", "arg_1", ".", "append", "(", "arg_5", ")", "arg_2", "+=", "len", "(", "arg_5", ")", "if", "arg_2", ">", "pypetconstants", ".", "HDF5_STRCOL_MAX_VALUE_LENGTH", ":", "break", "arg_6", "=", "\"\"", ".", "join", "(", "arg_1", ")", "if", "len", "(", "arg_6", ")", ">", "pypetconstants", ".", "HDF5_STRCOL_MAX_VALUE_LENGTH", ":", "arg_6", "=", "arg_6", "[", "0", ":", "pypetconstants", ".", "HDF5_STRCOL_MAX_VALUE_LENGTH", "-", "3", "]", "+", "'...'", "else", ":", "arg_6", "=", "arg_6", "[", "0", ":", "-", "2", "]", "return", "arg_6"], "function": "def Func(arg_0):\n        \"\"\"Summarizes data handled by the result as a string.\n\n        Calls `__repr__` on all handled data. Data is NOT ordered.\n\n        Truncates the string if it is longer than\n        :const:`pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH`\n\n        :return: string\n\n        \"\"\"\n\n        arg_1 = []\n        arg_2 = 0\n\n        for arg_3 in arg_0._data:\n            arg_4 = arg_0._data[arg_3]\n            arg_5 = '%s=%s, ' % (arg_3, repr(arg_4))\n            arg_1.append(arg_5)\n\n            arg_2 += len(arg_5)\n            if arg_2 > pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH:\n                break\n\n        arg_6 = \"\".join(arg_1)\n        if len(arg_6) > pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH:\n            arg_6 =\\\n                arg_6[0:pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH - 3] + '...'\n        else:\n            arg_6 = arg_6[0:-2] # Delete the last `, `\n\n        return arg_6", "path": "pypet/parameter.py", "identifier": "Result.f_val_to_str", "docstring": "Summarizes data handled by the result as a string.\n\n        Calls `__repr__` on all handled data. Data is NOT ordered.\n\n        Truncates the string if it is longer than\n        :const:`pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH`\n\n        :return: string", "docstring_tokens": ["Summarizes", "data", "handled", "by", "the", "result", "as", "a", "string", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259309}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L119-L130", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a list of files on the remote system.", "language": "python", "parameters": "(self, path, nlst=False)", "return_statement": "return files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "get_conn", "(", ")", "arg_3", ".", "cwd", "(", "arg_1", ")", "arg_4", "=", "arg_3", ".", "nlst", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Returns a list of files on the remote system.\n\n        :param path: full path to the remote directory to list\n        :type path: str\n        \"\"\"\n        arg_3 = arg_0.get_conn()\n        arg_3.cwd(arg_1)\n\n        arg_4 = arg_3.nlst()\n        return arg_4", "path": "airflow/contrib/hooks/ftp_hook.py", "identifier": "FTPHook.list_directory", "docstring": "Returns a list of files on the remote system.\n\n        :param path: full path to the remote directory to list\n        :type path: str", "docstring_tokens": ["Returns", "a", "list", "of", "files", "on", "the", "remote", "system", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259310}
{"url": "https://github.com/sublee/zeronimo/blob/b216638232932718d2cbc5eabd870c8f5b5e83fb/zeronimo/core.py#L331-L334", "sha": "b216638232932718d2cbc5eabd870c8f5b5e83fb", "docstring_summary": "Sends ACCEPT reply.", "language": "python", "parameters": "(self, reply_socket, channel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "info", "or", "b''", "arg_0", ".", "send_raw", "(", "arg_1", ",", "ACCEPT", ",", "arg_3", ",", "*", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sends ACCEPT reply.\"\"\"\n        arg_3 = arg_0.info or b''\n        arg_0.send_raw(arg_1, ACCEPT, arg_3, *arg_2)", "path": "zeronimo/core.py", "identifier": "Worker.accept", "docstring": "Sends ACCEPT reply.", "docstring_tokens": ["Sends", "ACCEPT", "reply", "."], "nwo": "sublee/zeronimo", "score": 0.08529914490135834, "idx": 259311}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/ternya.py#L145-L163", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "Init openstack neutron mq", "language": "python", "parameters": "(self, mq)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "enable_component_notification", "(", "Openstack", ".", "Neutron", ")", ":", "log", ".", "debug", "(", "\"disable listening neutron notification\"", ")", "return", "for", "arg_2", "in", "range", "(", "arg_0", ".", "config", ".", "neutron_mq_consumer_count", ")", ":", "arg_1", ".", "create_consumer", "(", "arg_0", ".", "config", ".", "neutron_mq_exchange", ",", "arg_0", ".", "config", ".", "neutron_mq_queue", ",", "ProcessFactory", ".", "process", "(", "Openstack", ".", "Neutron", ")", ")", "log", ".", "debug", "(", "\"enable listening openstack neutron notification.\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Init openstack neutron mq\n\n        1. Check if enable listening neutron notification\n        2. Create consumer\n\n        :param mq: class ternya.mq.MQ\n        \"\"\"\n        if not arg_0.enable_component_notification(Openstack.Neutron):\n            log.debug(\"disable listening neutron notification\")\n            return\n\n        for arg_2 in range(arg_0.config.neutron_mq_consumer_count):\n            arg_1.create_consumer(arg_0.config.neutron_mq_exchange,\n                               arg_0.config.neutron_mq_queue,\n                               ProcessFactory.process(Openstack.Neutron))\n\n        log.debug(\"enable listening openstack neutron notification.\")", "path": "ternya/ternya.py", "identifier": "Ternya.init_neutron_consumer", "docstring": "Init openstack neutron mq\n\n        1. Check if enable listening neutron notification\n        2. Create consumer\n\n        :param mq: class ternya.mq.MQ", "docstring_tokens": ["Init", "openstack", "neutron", "mq"], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 259312}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_string.py#L48-L73", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return string fingerprint.", "language": "python", "parameters": "(self, phrase, joiner=' ')", "return_statement": "return phrase", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "' '", ")", ":", "arg_1", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "arg_1", ".", "strip", "(", ")", ".", "lower", "(", ")", ")", ")", "arg_1", "=", "''", ".", "join", "(", "[", "c", "for", "c", "in", "arg_1", "if", "c", ".", "isalnum", "(", ")", "or", "c", ".", "isspace", "(", ")", "]", ")", "arg_1", "=", "arg_2", ".", "join", "(", "sorted", "(", "list", "(", "set", "(", "arg_1", ".", "split", "(", ")", ")", ")", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=' '):\n        \"\"\"Return string Func.\n\n        Parameters\n        ----------\n        phrase : str\n            The string from which to calculate the Func\n        joiner : str\n            The string that will be placed between each word\n\n        Returns\n        -------\n        str\n            The Func of the phrase\n\n        Example\n        -------\n        >>> sf = String()\n        >>> sf.Func('The quick brown fox jumped over the lazy dog.')\n        'brown dog fox jumped lazy over quick the'\n\n        \"\"\"\n        arg_1 = unicode_normalize('NFKD', text_type(arg_1.strip().lower()))\n        arg_1 = ''.join([c for c in arg_1 if c.isalnum() or c.isspace()])\n        arg_1 = arg_2.join(sorted(list(set(arg_1.split()))))\n        return arg_1", "path": "abydos/fingerprint/_string.py", "identifier": "String.fingerprint", "docstring": "Return string fingerprint.\n\n        Parameters\n        ----------\n        phrase : str\n            The string from which to calculate the fingerprint\n        joiner : str\n            The string that will be placed between each word\n\n        Returns\n        -------\n        str\n            The fingerprint of the phrase\n\n        Example\n        -------\n        >>> sf = String()\n        >>> sf.fingerprint('The quick brown fox jumped over the lazy dog.')\n        'brown dog fox jumped lazy over quick the'", "docstring_tokens": ["Return", "string", "fingerprint", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 259313}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v3/convert.py#L30-L58", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Convert a notebook to the v3 format.", "language": "python", "parameters": "(nb, orig_version=2, orig_minor=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", ",", "arg_2", "=", "0", ")", ":", "if", "arg_1", "==", "1", ":", "arg_0", "=", "v2", ".", "Func", "(", "arg_0", ")", "arg_1", "=", "2", "if", "arg_1", "==", "2", ":", "arg_0", ".", "nbformat", "=", "arg_3", "arg_0", ".", "nbformat_minor", "=", "arg_4", "arg_0", ".", "orig_nbformat", "=", "2", "return", "arg_0", "elif", "arg_1", "==", "3", ":", "if", "arg_2", "!=", "arg_4", ":", "arg_0", ".", "orig_nbformat_minor", "=", "arg_2", "arg_0", ".", "nbformat_minor", "=", "arg_4", "return", "arg_0", "else", ":", "raise", "ValueError", "(", "'Cannot convert a notebook from v%s to v3'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1=2, arg_2=0):\n    \"\"\"Convert a notebook to the v3 format.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The Python representation of the notebook to convert.\n    orig_version : int\n        The original version of the notebook to convert.\n    orig_minor : int\n        The original minor version of the notebook to convert (only relevant for v >= 3).\n    \"\"\"\n    if arg_1 == 1:\n        arg_0 = v2.Func(arg_0)\n        arg_1 = 2\n    if arg_1 == 2:\n        # Mark the original nbformat so consumers know it has been converted.\n        arg_0.nbformat = arg_3\n        arg_0.nbformat_minor = arg_4\n        \n        arg_0.orig_nbformat = 2\n        return arg_0\n    elif arg_1 == 3:\n        if arg_2 != arg_4:\n            arg_0.orig_nbformat_minor = arg_2\n        arg_0.nbformat_minor = arg_4\n        return arg_0\n    else:\n        raise ValueError('Cannot convert a notebook from v%s to v3' % arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/nbformat/v3/convert.py", "identifier": "convert_to_this_nbformat", "docstring": "Convert a notebook to the v3 format.\n\n    Parameters\n    ----------\n    nb : NotebookNode\n        The Python representation of the notebook to convert.\n    orig_version : int\n        The original version of the notebook to convert.\n    orig_minor : int\n        The original minor version of the notebook to convert (only relevant for v >= 3).", "docstring_tokens": ["Convert", "a", "notebook", "to", "the", "v3", "format", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259314}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/tools/async_worker.py#L64-L87", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Instantiates worker plugins that have requsite properties.", "language": "python", "parameters": "(self, module, version)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "inspect", ".", "getmembers", "(", "arg_1", ",", "inspect", ".", "isclass", ")", "arg_4", "=", "0", "for", "arg_5", ",", "arg_6", "in", "arg_3", ":", "if", "hasattr", "(", "arg_6", ",", "'versions'", ")", ":", "if", "arg_2", "not", "in", "arg_6", ".", "versions", ":", "continue", "else", ":", "continue", "if", "issubclass", "(", "arg_6", ",", "base_worker", ".", "QuarkAsyncPluginBase", ")", ":", "LOG", ".", "debug", "(", "\"Loading plugin %s\"", "%", "arg_5", ")", "arg_7", "=", "arg_6", "(", ")", "arg_0", ".", "plugins", ".", "append", "(", "arg_7", ")", "arg_4", "+=", "1", "LOG", ".", "debug", "(", "\"Found %d possible plugins and loaded %d\"", "%", "(", "len", "(", "arg_3", ")", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Instantiates worker plugins that have requsite properties.\n\n        The required properties are:\n        * must have PLUGIN_EP entrypoint registered (or it wouldn't be in the\n          list)\n        * must have class attribute versions (list) of supported RPC versions\n        * must subclass QuarkAsyncPluginBase\n        \"\"\"\n        arg_3 = inspect.getmembers(arg_1, inspect.isclass)\n        arg_4 = 0\n        for arg_5, arg_6 in arg_3:\n            if hasattr(arg_6, 'versions'):\n                if arg_2 not in arg_6.versions:\n                    continue\n            else:\n                continue\n            if issubclass(arg_6, base_worker.QuarkAsyncPluginBase):\n                LOG.debug(\"Loading plugin %s\" % arg_5)\n                arg_7 = arg_6()\n                arg_0.plugins.append(arg_7)\n                arg_4 += 1\n        LOG.debug(\"Found %d possible plugins and loaded %d\" %\n                  (len(arg_3), arg_4))", "path": "quark/tools/async_worker.py", "identifier": "QuarkAsyncServer._load_worker_plugin_with_module", "docstring": "Instantiates worker plugins that have requsite properties.\n\n        The required properties are:\n        * must have PLUGIN_EP entrypoint registered (or it wouldn't be in the\n          list)\n        * must have class attribute versions (list) of supported RPC versions\n        * must subclass QuarkAsyncPluginBase", "docstring_tokens": ["Instantiates", "worker", "plugins", "that", "have", "requsite", "properties", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 259315}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/deletion.py#L77-L161", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Provide a common interface for single or multiple knockouts.", "language": "python", "parameters": "(model, entity, element_lists, method=\"fba\",\n                    solution=None, processes=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "\"fba\"", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "**", "arg_6", ")", ":", "arg_7", "=", "sutil", ".", "interface_to_str", "(", "arg_0", ".", "problem", ".", "__name__", ")", "if", "arg_3", "==", "\"moma\"", "and", "arg_7", "not", "in", "sutil", ".", "qp_solvers", ":", "raise", "RuntimeError", "(", "\"Cannot use MOMA since '{}' is not QP-capable.\"", "\"Please choose a different solver or use FBA only.\"", ".", "format", "(", "arg_7", ")", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "CONFIGURATION", ".", "processes", "with", "arg_0", ":", "if", "\"moma\"", "in", "arg_3", ":", "add_moma", "(", "arg_0", ",", "arg_4", "=", "arg_4", ",", "linear", "=", "\"linear\"", "in", "arg_3", ")", "elif", "\"room\"", "in", "arg_3", ":", "add_room", "(", "arg_0", ",", "arg_4", "=", "arg_4", ",", "linear", "=", "\"linear\"", "in", "arg_3", ",", "**", "arg_6", ")", "arg_8", "=", "set", "(", "[", "frozenset", "(", "comb", ")", "for", "comb", "in", "product", "(", "*", "arg_2", ")", "]", ")", "arg_5", "=", "min", "(", "arg_5", ",", "len", "(", "arg_8", ")", ")", "def", "extract_knockout_results", "(", "arg_9", ")", ":", "arg_10", "=", "pd", ".", "DataFrame", "(", "[", "(", "frozenset", "(", "ids", ")", ",", "growth", ",", "status", ")", "for", "(", "ids", ",", "growth", ",", "status", ")", "in", "arg_9", "]", ",", "columns", "=", "[", "'ids'", ",", "'growth'", ",", "'status'", "]", ")", "arg_10", ".", "set_index", "(", "'ids'", ",", "inplace", "=", "True", ")", "return", "arg_10", "if", "arg_5", ">", "1", ":", "arg_11", "=", "dict", "(", "gene", "=", "_gene_deletion_worker", ",", "reaction", "=", "_reaction_deletion_worker", ")", "[", "arg_1", "]", "arg_12", "=", "len", "(", "arg_8", ")", "//", "arg_5", "arg_13", "=", "multiprocessing", ".", "Pool", "(", "arg_5", ",", "initializer", "=", "_init_worker", ",", "initargs", "=", "(", "arg_0", ",", ")", ")", "arg_14", "=", "extract_knockout_results", "(", "arg_13", ".", "imap_unordered", "(", "arg_11", ",", "arg_8", ",", "chunksize", "=", "arg_12", ")", ")", "arg_13", ".", "close", "(", ")", "arg_13", ".", "join", "(", ")", "else", ":", "arg_11", "=", "dict", "(", "gene", "=", "_gene_deletion", ",", "reaction", "=", "_reaction_deletion", ")", "[", "arg_1", "]", "arg_14", "=", "extract_knockout_results", "(", "map", "(", "partial", "(", "arg_11", ",", "arg_0", ")", ",", "arg_8", ")", ")", "return", "arg_14"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=\"fba\",\n                    arg_4=None, arg_5=None, **arg_6):\n    \"\"\"\n    Provide a common interface for single or multiple knockouts.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    entity : 'gene' or 'reaction'\n        The entity to knockout (``cobra.Gene`` or ``cobra.Reaction``).\n    element_lists : list\n        List of iterables ``cobra.Reaction``s or ``cobra.Gene``s (or their IDs)\n        to be deleted.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Passed on to underlying simulation functions.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all combinations of entity deletions. The\n        columns are 'growth' and 'status', where\n\n        index : frozenset([str])\n            The gene or reaction identifiers that were knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.\n    \"\"\"\n    arg_7 = sutil.interface_to_str(arg_0.problem.__name__)\n    if arg_3 == \"moma\" and arg_7 not in sutil.qp_solvers:\n        raise RuntimeError(\n            \"Cannot use MOMA since '{}' is not QP-capable.\"\n            \"Please choose a different solver or use FBA only.\".format(arg_7))\n\n    if arg_5 is None:\n        arg_5 = CONFIGURATION.processes\n\n    with arg_0:\n        if \"moma\" in arg_3:\n            add_moma(arg_0, arg_4=arg_4, linear=\"linear\" in arg_3)\n        elif \"room\" in arg_3:\n            add_room(arg_0, arg_4=arg_4, linear=\"linear\" in arg_3,\n                     **arg_6)\n\n        arg_8 = set([frozenset(comb) for comb in product(*arg_2)])\n        arg_5 = min(arg_5, len(arg_8))\n\n        def extract_knockout_results(arg_9):\n            arg_10 = pd.DataFrame([\n                (frozenset(ids), growth, status)\n                for (ids, growth, status) in arg_9\n            ], columns=['ids', 'growth', 'status'])\n            arg_10.set_index('ids', inplace=True)\n            return arg_10\n\n        if arg_5 > 1:\n            arg_11 = dict(gene=_gene_deletion_worker,\n                          reaction=_reaction_deletion_worker)[arg_1]\n            arg_12 = len(arg_8) // arg_5\n            arg_13 = multiprocessing.Pool(\n                arg_5, initializer=_init_worker, initargs=(arg_0,)\n            )\n            arg_14 = extract_knockout_results(arg_13.imap_unordered(\n                arg_11,\n                arg_8,\n                chunksize=arg_12\n            ))\n            arg_13.close()\n            arg_13.join()\n        else:\n            arg_11 = dict(gene=_gene_deletion,\n                          reaction=_reaction_deletion)[arg_1]\n            arg_14 = extract_knockout_results(map(\n                partial(arg_11, arg_0), arg_8))\n        return arg_14", "path": "cobra/flux_analysis/deletion.py", "identifier": "_multi_deletion", "docstring": "Provide a common interface for single or multiple knockouts.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    entity : 'gene' or 'reaction'\n        The entity to knockout (``cobra.Gene`` or ``cobra.Reaction``).\n    element_lists : list\n        List of iterables ``cobra.Reaction``s or ``cobra.Gene``s (or their IDs)\n        to be deleted.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Passed on to underlying simulation functions.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all combinations of entity deletions. The\n        columns are 'growth' and 'status', where\n\n        index : frozenset([str])\n            The gene or reaction identifiers that were knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.", "docstring_tokens": ["Provide", "a", "common", "interface", "for", "single", "or", "multiple", "knockouts", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259316}
{"url": "https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L89-L114", "sha": "ce2cf3f1425d02ba4f3ad3202cfca43a1892558a", "docstring_summary": "Receiver for request-confirmed signal to send email notification.", "language": "python", "parameters": "(request)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "get_record", "(", "arg_0", ".", "recid", ")", "if", "arg_2", "is", "None", ":", "current_app", ".", "logger", ".", "error", "(", "\"Cannot retrieve record %s. Emails not sent\"", "%", "arg_0", ".", "recid", ")", "return", "arg_3", "=", "_", "(", "\"Access request: %(record)s\"", ",", "arg_2", "=", "arg_2", "[", "\"title\"", "]", ")", "_send_notification", "(", "arg_0", ".", "receiver", ".", "email", ",", "arg_3", ",", "\"zenodo_accessrequests/emails/new_request.tpl\"", ",", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ",", ")", "_send_notification", "(", "arg_0", ".", "sender_email", ",", "arg_3", ",", "\"zenodo_accessrequests/emails/confirmation.tpl\"", ",", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ",", ")"], "function": "def Func(arg_0):\n    \"\"\"Receiver for request-confirmed signal to send email notification.\"\"\"\n    arg_1, arg_2 = get_record(arg_0.recid)\n    if arg_2 is None:\n        current_app.logger.error(\"Cannot retrieve record %s. Emails not sent\"\n                                 % arg_0.recid)\n        return\n    arg_3 = _(\"Access request: %(record)s\", arg_2=arg_2[\"title\"])\n\n    _send_notification(\n        arg_0.receiver.email,\n        arg_3,\n        \"zenodo_accessrequests/emails/new_request.tpl\",\n        arg_0=arg_0,\n        arg_2=arg_2,\n        arg_1=arg_1,\n    )\n\n    _send_notification(\n        arg_0.sender_email,\n        arg_3,\n        \"zenodo_accessrequests/emails/confirmation.tpl\",\n        arg_0=arg_0,\n        arg_2=arg_2,\n        arg_1=arg_1,\n    )", "path": "zenodo_accessrequests/receivers.py", "identifier": "send_confirmed_notifications", "docstring": "Receiver for request-confirmed signal to send email notification.", "docstring_tokens": ["Receiver", "for", "request", "-", "confirmed", "signal", "to", "send", "email", "notification", "."], "nwo": "zenodo/zenodo-accessrequests", "score": 0.2718259314615454, "idx": 259317}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/temporal_memory_monitor_mixin.py#L234-L251", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Pretty print the cell representations for sequences in the history.", "language": "python", "parameters": "(self, sortby=\"Column\")", "return_statement": "return table.get_string(sortby=sortby).encode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Column\"", ")", ":", "arg_0", ".", "_mmComputeTransitionTraces", "(", ")", "arg_2", "=", "PrettyTable", "(", "[", "\"Pattern\"", ",", "\"Column\"", ",", "\"predicted=>active cells\"", "]", ")", "for", "arg_3", ",", "arg_4", "in", "(", "arg_0", ".", "_mmData", "[", "\"predictedActiveCellsForSequence\"", "]", ".", "iteritems", "(", ")", ")", ":", "arg_5", "=", "arg_0", ".", "mapCellsToColumns", "(", "arg_4", ")", "for", "arg_6", ",", "arg_7", "in", "arg_5", ".", "iteritems", "(", ")", ":", "arg_2", ".", "add_row", "(", "[", "arg_3", ",", "arg_6", ",", "list", "(", "arg_7", ")", "]", ")", "return", "arg_2", ".", "get_string", "(", "arg_1", "=", "arg_1", ")", ".", "encode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0, arg_1=\"Column\"):\n    \"\"\"\n    Pretty print the cell representations for sequences in the history.\n\n    @param sortby (string) Column of table to sort by\n\n    @return (string) Pretty-printed text\n    \"\"\"\n    arg_0._mmComputeTransitionTraces()\n    arg_2 = PrettyTable([\"Pattern\", \"Column\", \"predicted=>active cells\"])\n\n    for arg_3, arg_4 in (\n          arg_0._mmData[\"predictedActiveCellsForSequence\"].iteritems()):\n      arg_5 = arg_0.mapCellsToColumns(arg_4)\n      for arg_6, arg_7 in arg_5.iteritems():\n        arg_2.add_row([arg_3, arg_6, list(arg_7)])\n\n    return arg_2.get_string(arg_1=arg_1).encode(\"utf-8\")", "path": "src/nupic/algorithms/monitor_mixin/temporal_memory_monitor_mixin.py", "identifier": "TemporalMemoryMonitorMixin.mmPrettyPrintSequenceCellRepresentations", "docstring": "Pretty print the cell representations for sequences in the history.\n\n    @param sortby (string) Column of table to sort by\n\n    @return (string) Pretty-printed text", "docstring_tokens": ["Pretty", "print", "the", "cell", "representations", "for", "sequences", "in", "the", "history", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259318}
{"url": "https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/sanscript/schemes/__init__.py#L29-L32", "sha": "b7c5166a275c15a612fbb96fd3d765bc9004b299", "docstring_summary": "A convenience method", "language": "python", "parameters": "(self, data)", "return_statement": "return sanscript.transliterate(data=data, _from=sanscript.DEVANAGARI, _to=self.name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "indic_transliteration", "import", "sanscript", "return", "sanscript", ".", "transliterate", "(", "arg_1", "=", "arg_1", ",", "_from", "=", "sanscript", ".", "DEVANAGARI", ",", "_to", "=", "arg_0", ".", "name", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"A convenience method\"\"\"\n        from indic_transliteration import sanscript\n        return sanscript.transliterate(arg_1=arg_1, _from=sanscript.DEVANAGARI, _to=arg_0.name)", "path": "indic_transliteration/sanscript/schemes/__init__.py", "identifier": "Scheme.from_devanagari", "docstring": "A convenience method", "docstring_tokens": ["A", "convenience", "method"], "nwo": "sanskrit-coders/indic_transliteration", "score": 0.19543626030129047, "idx": 259319}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L460-L469", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Map a 1D array the same dimension as the grid to its original masked 2D array.", "language": "python", "parameters": "(self, array_1d)", "return_statement": "return mapping_util.map_masked_1d_array_to_2d_array_from_array_1d_shape_and_one_to_two(\n            array_1d=array_1d, shape=self.mask.shape, one_to_two=self.mask.masked_grid_index_to_pixel)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "mapping_util", ".", "map_masked_1d_array_to_2d_array_from_array_1d_shape_and_one_to_two", "(", "arg_1", "=", "arg_1", ",", "shape", "=", "arg_0", ".", "mask", ".", "shape", ",", "one_to_two", "=", "arg_0", ".", "mask", ".", "masked_grid_index_to_pixel", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Map a 1D array the same dimension as the grid to its original masked 2D array.\n\n        Parameters\n        -----------\n        array_1d : ndarray\n            The 1D array which is mapped to its masked 2D array.\n        \"\"\"\n        return mapping_util.map_masked_1d_array_to_2d_array_from_array_1d_shape_and_one_to_two(\n            arg_1=arg_1, shape=arg_0.mask.shape, one_to_two=arg_0.mask.masked_grid_index_to_pixel)", "path": "autolens/data/array/grids.py", "identifier": "RegularGrid.array_2d_from_array_1d", "docstring": "Map a 1D array the same dimension as the grid to its original masked 2D array.\n\n        Parameters\n        -----------\n        array_1d : ndarray\n            The 1D array which is mapped to its masked 2D array.", "docstring_tokens": ["Map", "a", "1D", "array", "the", "same", "dimension", "as", "the", "grid", "to", "its", "original", "masked", "2D", "array", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 259320}
{"url": "https://github.com/amcat/progressmonitor/blob/d4cabebc95bfd1447120f601c094b20bee954285/progressmonitor/__init__.py#L80-L86", "sha": "d4cabebc95bfd1447120f601c094b20bee954285", "docstring_summary": "Wrap code into a begin and end call on this monitor", "language": "python", "parameters": "(self, total: int, name=None, message=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_0", ".", "begin", "(", "arg_1", ",", "arg_3", ",", "arg_4", ")", "try", ":", "yield", "arg_0", "finally", ":", "arg_0", ".", "done", "(", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3=None, arg_4=None):\n        \"\"\"Wrap code into a begin and end call on this monitor\"\"\"\n        arg_0.begin(arg_1, arg_3, arg_4)\n        try:\n            yield arg_0\n        finally:\n            arg_0.done()", "path": "progressmonitor/__init__.py", "identifier": "ProgressMonitor.task", "docstring": "Wrap code into a begin and end call on this monitor", "docstring_tokens": ["Wrap", "code", "into", "a", "begin", "and", "end", "call", "on", "this", "monitor"], "nwo": "amcat/progressmonitor", "score": 0.0, "idx": 259321}
{"url": "https://github.com/racitup/static-ranges/blob/a15c2e2bd6f643279ae046494b8714634dd380a4/static_ranges.py#L110-L122", "sha": "a15c2e2bd6f643279ae046494b8714634dd380a4", "docstring_summary": "Removes errored ranges", "language": "python", "parameters": "(cls, ranges, length)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "arg_1", ":", "if", "isinstance", "(", "arg_4", ",", "int", ")", "or", "isinstance", "(", "arg_5", ",", "int", ")", ":", "if", "isinstance", "(", "arg_4", ",", "int", ")", "and", "not", "(", "0", "<=", "arg_4", "<", "arg_2", ")", ":", "continue", "elif", "isinstance", "(", "arg_4", ",", "int", ")", "and", "isinstance", "(", "arg_5", ",", "int", ")", "and", "not", "(", "arg_4", "<=", "arg_5", ")", ":", "continue", "elif", "arg_4", "is", "None", "and", "arg_5", "==", "0", ":", "continue", "arg_3", ".", "append", "(", "(", "arg_4", ",", "arg_5", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Removes errored ranges\"\"\"\n        arg_3 = []\n        for arg_4, arg_5 in arg_1:\n            if isinstance(arg_4, int) or isinstance(arg_5, int):\n                if isinstance(arg_4, int) and not (0 <= arg_4 < arg_2):\n                    continue\n                elif isinstance(arg_4, int) and isinstance(arg_5, int) and not (arg_4 <= arg_5):\n                    continue\n                elif arg_4 is None and arg_5 == 0:\n                    continue\n                arg_3.append( (arg_4,arg_5) )\n        return arg_3", "path": "static_ranges.py", "identifier": "Ranges.check_ranges", "docstring": "Removes errored ranges", "docstring_tokens": ["Removes", "errored", "ranges"], "nwo": "racitup/static-ranges", "score": 0.19736061854667641, "idx": 259322}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1218-L1228", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Convenience method to wait for creation of some UI element.", "language": "python", "parameters": "(self, timeout=10, notification='AXCreated')", "return_statement": "return self.waitFor(timeout, notification, callback=callback,\n                            args=args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ",", "arg_2", "=", "'AXCreated'", ")", ":", "arg_3", "=", "AXCallbacks", ".", "returnElemCallback", "arg_4", "=", "None", "arg_5", "=", "(", "arg_4", ",", ")", "return", "arg_0", ".", "waitFor", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1=10, arg_2='AXCreated'):\n        \"\"\"Convenience method to wait for creation of some UI element.\n\n        Returns: The element created\n        \"\"\"\n        arg_3 = AXCallbacks.returnElemCallback\n        arg_4 = None\n        arg_5 = (arg_4,)\n\n        return arg_0.waitFor(arg_1, arg_2, arg_3=arg_3,\n                            arg_5=arg_5)", "path": "atomac/AXClasses.py", "identifier": "NativeUIElement.waitForCreation", "docstring": "Convenience method to wait for creation of some UI element.\n\n        Returns: The element created", "docstring_tokens": ["Convenience", "method", "to", "wait", "for", "creation", "of", "some", "UI", "element", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 259323}
{"url": "https://github.com/eliangcs/pystock-crawler/blob/8b803c8944f36af46daf04c6767a74132e37a101/pystock_crawler/loaders.py#L300-L317", "sha": "8b803c8944f36af46daf04c6767a74132e37a101", "docstring_summary": "The likelihood that the context is a \"member\".", "language": "python", "parameters": "(context)", "return_statement": "return 3", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ":", "arg_1", "=", "arg_0", ".", "xpath", "(", "'.//*[local-name()=\"explicitMember\"]/text()'", ")", ".", "extract", "(", ")", "arg_2", "=", "str", "(", "arg_1", ")", ".", "lower", "(", ")", "if", "len", "(", "arg_1", ")", ">", "1", ":", "return", "2", "elif", "'country'", "in", "arg_2", ":", "return", "2", "elif", "'member'", "not", "in", "arg_2", ":", "return", "0", "elif", "'successor'", "in", "arg_2", ":", "return", "1", "elif", "'parent'", "in", "arg_2", ":", "return", "2", "return", "3"], "function": "def Func(arg_0):\n    '''The likelihood that the context is a \"member\".'''\n    if arg_0:\n        arg_1 = arg_0.xpath('.//*[local-name()=\"explicitMember\"]/text()').extract()\n        arg_2 = str(arg_1).lower()\n\n        if len(arg_1) > 1:\n            return 2\n        elif 'country' in arg_2:\n            return 2\n        elif 'member' not in arg_2:\n            return 0\n        elif 'successor' in arg_2:\n            # 'SuccessorMember' is a rare case that shouldn't be treated as member\n            return 1\n        elif 'parent' in arg_2:\n            return 2\n    return 3", "path": "pystock_crawler/loaders.py", "identifier": "memberness", "docstring": "The likelihood that the context is a \"member\".", "docstring_tokens": ["The", "likelihood", "that", "the", "context", "is", "a", "member", "."], "nwo": "eliangcs/pystock-crawler", "score": 0.6122696596813957, "idx": 259324}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/node/finders.py#L150-L208", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Find all elements on the page matching the given selector and options.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return find_all()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "SelectorQuery", "(", "*", "arg_1", ",", "**", "arg_2", ")", "@", "arg_0", ".", "synchronize", "(", "wait", "=", "arg_3", ".", "wait", ")", "def", "Func", "(", ")", ":", "arg_4", "=", "arg_3", ".", "resolve_for", "(", "arg_0", ")", "if", "not", "arg_4", ".", "matches_count", ":", "raise", "ExpectationNotMet", "(", "arg_4", ".", "failure_message", ")", "return", "arg_4", "return", "Func", "(", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Find all elements on the page matching the given selector and options.\n\n        Both XPath and CSS expressions are supported, but Capybara does not try to automatically\n        distinguish between them. The following statements are equivalent::\n\n            page.Func(\"css\", \"a#person_123\")\n            page.Func(\"xpath\", \"//a[@id='person_123']\")\n\n        If the type of selector is left out, Capybara uses :data:`capybara.default_selector`. It's\n        set to ``\"css\"`` by default. ::\n\n            page.Func(\"a#person_123\")\n\n            capybara.default_selector = \"xpath\"\n            page.Func(\"//a[@id='person_123']\")\n\n        The set of found elements can further be restricted by specifying options. It's possible to\n        select elements by their text or visibility::\n\n            page.Func(\"a\", text=\"Home\")\n            page.Func(\"#menu li\", visible=True)\n\n        By default if no elements are found, an empty list is returned; however, expectations can be\n        set on the number of elements to be found which will trigger Capybara's waiting behavior for\n        the expectations to match. The expectations can be set using::\n\n            page.assert_selector(\"p#foo\", count=4)\n            page.assert_selector(\"p#foo\", maximum=10)\n            page.assert_selector(\"p#foo\", minimum=1)\n            page.assert_selector(\"p#foo\", between=range(1, 11))\n\n        See :func:`capybara.result.Result.matches_count` for additional information about count\n        matching.\n\n        Args:\n            *args: Variable length argument list for :class:`SelectorQuery`.\n            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.\n\n        Returns:\n            Result: A collection of found elements.\n\n        Raises:\n            ExpectationNotMet: The matched results did not meet the expected criteria.\n        \"\"\"\n\n        arg_3 = SelectorQuery(*arg_1, **arg_2)\n\n        @arg_0.synchronize(wait=arg_3.wait)\n        def Func():\n            arg_4 = arg_3.resolve_for(arg_0)\n\n            if not arg_4.matches_count:\n                raise ExpectationNotMet(arg_4.failure_message)\n\n            return arg_4\n\n        return Func()", "path": "capybara/node/finders.py", "identifier": "FindersMixin.find_all", "docstring": "Find all elements on the page matching the given selector and options.\n\n        Both XPath and CSS expressions are supported, but Capybara does not try to automatically\n        distinguish between them. The following statements are equivalent::\n\n            page.find_all(\"css\", \"a#person_123\")\n            page.find_all(\"xpath\", \"//a[@id='person_123']\")\n\n        If the type of selector is left out, Capybara uses :data:`capybara.default_selector`. It's\n        set to ``\"css\"`` by default. ::\n\n            page.find_all(\"a#person_123\")\n\n            capybara.default_selector = \"xpath\"\n            page.find_all(\"//a[@id='person_123']\")\n\n        The set of found elements can further be restricted by specifying options. It's possible to\n        select elements by their text or visibility::\n\n            page.find_all(\"a\", text=\"Home\")\n            page.find_all(\"#menu li\", visible=True)\n\n        By default if no elements are found, an empty list is returned; however, expectations can be\n        set on the number of elements to be found which will trigger Capybara's waiting behavior for\n        the expectations to match. The expectations can be set using::\n\n            page.assert_selector(\"p#foo\", count=4)\n            page.assert_selector(\"p#foo\", maximum=10)\n            page.assert_selector(\"p#foo\", minimum=1)\n            page.assert_selector(\"p#foo\", between=range(1, 11))\n\n        See :func:`capybara.result.Result.matches_count` for additional information about count\n        matching.\n\n        Args:\n            *args: Variable length argument list for :class:`SelectorQuery`.\n            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.\n\n        Returns:\n            Result: A collection of found elements.\n\n        Raises:\n            ExpectationNotMet: The matched results did not meet the expected criteria.", "docstring_tokens": ["Find", "all", "elements", "on", "the", "page", "matching", "the", "given", "selector", "and", "options", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 259325}
{"url": "https://github.com/eliangcs/pystock-crawler/blob/8b803c8944f36af46daf04c6767a74132e37a101/pystock_crawler/spiders/edgar.py#L57-L67", "sha": "8b803c8944f36af46daf04c6767a74132e37a101", "docstring_summary": "Parse 10-Q or 10-K XML report.", "language": "python", "parameters": "(self, response)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "ReportItemLoader", "(", "arg_1", "=", "arg_1", ")", "arg_3", "=", "arg_2", ".", "load_item", "(", ")", "if", "'doc_type'", "in", "arg_3", ":", "arg_4", "=", "arg_3", "[", "'doc_type'", "]", "if", "arg_4", "in", "(", "'10-Q'", ",", "'10-K'", ")", ":", "return", "arg_3", "return", "None"], "function": "def Func(arg_0, arg_1):\n        '''Parse 10-Q or 10-K XML report.'''\n        arg_2 = ReportItemLoader(arg_1=arg_1)\n        arg_3 = arg_2.load_item()\n\n        if 'doc_type' in arg_3:\n            arg_4 = arg_3['doc_type']\n            if arg_4 in ('10-Q', '10-K'):\n                return arg_3\n\n        return None", "path": "pystock_crawler/spiders/edgar.py", "identifier": "EdgarSpider.parse_10qk", "docstring": "Parse 10-Q or 10-K XML report.", "docstring_tokens": ["Parse", "10", "-", "Q", "or", "10", "-", "K", "XML", "report", "."], "nwo": "eliangcs/pystock-crawler", "score": 0.6122696596813957, "idx": 259326}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case_events.py#L482-L522", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Mark a case as checked from an analysis point of view.", "language": "python", "parameters": "(self, institute, case, user, link,\n                     unmark=False)", "return_statement": "return updated_case", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "False", ")", ":", "LOG", ".", "info", "(", "\"Updating checked status of {}\"", ".", "format", "(", "arg_2", "[", "'display_name'", "]", ")", ")", "arg_6", "=", "'not checked'", "if", "arg_5", "else", "'checked'", "arg_0", ".", "create_event", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "category", "=", "'case'", ",", "verb", "=", "'check_case'", ",", "subject", "=", "arg_6", ")", "LOG", ".", "info", "(", "\"Updating {0}'s checked status {1}\"", ".", "format", "(", "arg_2", "[", "'display_name'", "]", ",", "arg_6", ")", ")", "arg_7", "=", "False", "if", "arg_5", "else", "True", "arg_8", "=", "arg_0", ".", "case_collection", ".", "find_one_and_update", "(", "{", "'_id'", ":", "arg_2", "[", "'_id'", "]", "}", ",", "{", "'$set'", ":", "{", "'analysis_checked'", ":", "arg_7", "}", "}", ",", "return_document", "=", "pymongo", ".", "ReturnDocument", ".", "AFTER", ")", "LOG", ".", "debug", "(", "\"Case updated\"", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                     arg_5=False):\n        \"\"\"Mark a case as checked from an analysis point of view.\n\n        Arguments:\n            institute (dict): A Institute object\n            case (dict): Case object\n            user (dict): A User object\n            link (str): The url to be used in the event\n            unmark (bool): If case should ve unmarked\n\n        Return:\n            updated_case\n        \"\"\"\n\n        LOG.info(\"Updating checked status of {}\"\n                    .format(arg_2['display_name']))\n\n        arg_6 = 'not checked' if arg_5 else 'checked'\n        arg_0.create_event(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            category='case',\n            verb='check_case',\n            subject=arg_6\n        )\n\n        LOG.info(\"Updating {0}'s checked status {1}\"\n                    .format(arg_2['display_name'], arg_6))\n        arg_7 = False if arg_5 else True\n        arg_8 = arg_0.case_collection.find_one_and_update(\n            {'_id': arg_2['_id']},\n            {\n                '$set': {'analysis_checked': arg_7}\n            },\n            return_document=pymongo.ReturnDocument.AFTER\n        )\n        LOG.debug(\"Case updated\")\n        return arg_8", "path": "scout/adapter/mongo/case_events.py", "identifier": "CaseEventHandler.mark_checked", "docstring": "Mark a case as checked from an analysis point of view.\n\n        Arguments:\n            institute (dict): A Institute object\n            case (dict): Case object\n            user (dict): A User object\n            link (str): The url to be used in the event\n            unmark (bool): If case should ve unmarked\n\n        Return:\n            updated_case", "docstring_tokens": ["Mark", "a", "case", "as", "checked", "from", "an", "analysis", "point", "of", "view", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259327}
{"url": "https://github.com/dmonroy/aiometrics/blob/c33c7f86c372f8d2f30ac9bde3811993821a6f25/aiometrics.py#L241-L265", "sha": "c33c7f86c372f8d2f30ac9bde3811993821a6f25", "docstring_summary": "Build per minute stats for each key", "language": "python", "parameters": "(cls, traces)", "return_statement": "return stats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "Func", "=", "{", "}", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_4", "[", "'key'", "]", "if", "arg_5", "not", "in", "arg_2", ":", "arg_2", "[", "arg_5", "]", "=", "[", "]", "Func", "[", "arg_5", "]", "=", "{", "}", "arg_2", "[", "arg_5", "]", ".", "append", "(", "arg_4", "[", "'total_time'", "]", ")", "arg_0", ".", "_traces", ".", "pop", "(", "arg_4", "[", "'id'", "]", ")", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "arg_2", "[", "arg_5", "]", "Func", "[", "arg_5", "]", "=", "dict", "(", "count", "=", "len", "(", "arg_6", ")", ",", "max", "=", "max", "(", "arg_6", ")", ",", "min", "=", "min", "(", "arg_6", ")", ",", "avg", "=", "sum", "(", "arg_6", ")", "/", "len", "(", "arg_6", ")", ")", "return", "Func"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Build per minute stats for each key\"\"\"\n\n        arg_2 = {}\n        Func = {}\n        # Group traces by key and minute\n        for arg_4 in arg_1:\n            arg_5 = arg_4['key']\n            if arg_5 not in arg_2:\n                arg_2[arg_5] = []\n                Func[arg_5] = {}\n\n            arg_2[arg_5].append(arg_4['total_time'])\n            arg_0._traces.pop(arg_4['id'])\n\n        for arg_5 in arg_2:\n            arg_6 = arg_2[arg_5]\n            Func[arg_5] = dict(\n                count=len(arg_6),\n                max=max(arg_6),\n                min=min(arg_6),\n                avg=sum(arg_6)/len(arg_6)\n            )\n\n        return Func", "path": "aiometrics.py", "identifier": "TraceCollector.stats", "docstring": "Build per minute stats for each key", "docstring_tokens": ["Build", "per", "minute", "stats", "for", "each", "key"], "nwo": "dmonroy/aiometrics", "score": 0.2619419494340654, "idx": 259328}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/utils.py#L7-L25", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Template decorator.", "language": "python", "parameters": "(template=None)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "def", "decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "def", "decorated_function", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", "if", "arg_4", "is", "None", ":", "arg_4", "=", "request", ".", "endpoint", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "'.html'", "arg_5", "=", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "{", "}", "elif", "not", "isinstance", "(", "arg_5", ",", "dict", ")", ":", "return", "arg_5", "return", "render_template", "(", "arg_4", ",", "**", "arg_5", ")", "return", "decorated_function", "return", "decorator"], "function": "def Func(arg_0=None):\n    \"\"\"Template decorator.\n\n    Ref: http://flask.pocoo.org/docs/patterns/viewdecorators/\n    \"\"\"\n    def decorator(arg_1):\n        @wraps(arg_1)\n        def decorated_function(*arg_2, **arg_3):\n            arg_4 = arg_0\n            if arg_4 is None:\n                arg_4 = request.endpoint.replace('.', '/') + '.html'\n            arg_5 = arg_1(*arg_2, **arg_3)\n            if arg_5 is None:\n                arg_5 = {}\n            elif not isinstance(arg_5, dict):\n                return arg_5\n            return render_template(arg_4, **arg_5)\n        return decorated_function\n    return decorator", "path": "scout/server/utils.py", "identifier": "templated", "docstring": "Template decorator.\n\n    Ref: http://flask.pocoo.org/docs/patterns/viewdecorators/", "docstring_tokens": ["Template", "decorator", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259329}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/throttles.py#L48-L54", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Update throttle scope so that service user throttle rates are applied.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "scope", "=", "SERVICE_USER_SCOPE", "arg_0", ".", "rate", "=", "arg_0", ".", "get_rate", "(", ")", "arg_0", ".", "num_requests", ",", "arg_0", ".", "duration", "=", "arg_0", ".", "parse_rate", "(", "arg_0", ".", "rate", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Update throttle scope so that service user throttle rates are applied.\n        \"\"\"\n        arg_0.scope = SERVICE_USER_SCOPE\n        arg_0.rate = arg_0.get_rate()\n        arg_0.num_requests, arg_0.duration = arg_0.parse_rate(arg_0.rate)", "path": "enterprise/api/throttles.py", "identifier": "ServiceUserThrottle.update_throttle_scope", "docstring": "Update throttle scope so that service user throttle rates are applied.", "docstring_tokens": ["Update", "throttle", "scope", "so", "that", "service", "user", "throttle", "rates", "are", "applied", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259330}
{"url": "https://github.com/ericmjl/hiveplot/blob/f465a7118b7f005c83ab054d400deb02bd9f7410/hiveplot/hiveplot.py#L296-L336", "sha": "f465a7118b7f005c83ab054d400deb02bd9f7410", "docstring_summary": "This function adjusts the start and end angles to correct for\n        duplicated axes.", "language": "python", "parameters": "(self, start_node, start_angle, end_node, end_angle)", "return_statement": "return start_angle, end_angle", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "find_node_group_membership", "(", "arg_1", ")", "arg_6", "=", "arg_0", ".", "find_node_group_membership", "(", "arg_3", ")", "if", "arg_5", "==", "0", "and", "arg_6", "==", "len", "(", "arg_0", ".", "nodes", ".", "keys", "(", ")", ")", "-", "1", ":", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_5", ")", ":", "arg_2", "=", "correct_negative_angle", "(", "arg_2", "-", "arg_0", ".", "minor_angle", ")", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_6", ")", ":", "arg_4", "=", "correct_negative_angle", "(", "arg_4", "+", "arg_0", ".", "minor_angle", ")", "elif", "arg_5", "==", "len", "(", "arg_0", ".", "nodes", ".", "keys", "(", ")", ")", "-", "1", "and", "arg_6", "==", "0", ":", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_5", ")", ":", "arg_2", "=", "correct_negative_angle", "(", "arg_2", "+", "arg_0", ".", "minor_angle", ")", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_6", ")", ":", "arg_4", "=", "correct_negative_angle", "(", "arg_4", "-", "arg_0", ".", "minor_angle", ")", "elif", "arg_5", "<", "arg_6", ":", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_6", ")", ":", "arg_4", "=", "correct_negative_angle", "(", "arg_4", "-", "arg_0", ".", "minor_angle", ")", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_5", ")", ":", "arg_2", "=", "correct_negative_angle", "(", "arg_2", "+", "arg_0", ".", "minor_angle", ")", "elif", "arg_6", "<", "arg_5", ":", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_5", ")", ":", "arg_2", "=", "correct_negative_angle", "(", "arg_2", "-", "arg_0", ".", "minor_angle", ")", "if", "arg_0", ".", "has_edge_within_group", "(", "arg_6", ")", ":", "arg_4", "=", "correct_negative_angle", "(", "arg_4", "+", "arg_0", ".", "minor_angle", ")", "return", "arg_2", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        This function adjusts the start and end angles to correct for\n        duplicated axes.\n        \"\"\"\n        arg_5 = arg_0.find_node_group_membership(arg_1)\n        arg_6 = arg_0.find_node_group_membership(arg_3)\n\n        if arg_5 == 0 and arg_6 == len(arg_0.nodes.keys())-1:\n            if arg_0.has_edge_within_group(arg_5):\n                arg_2 = correct_negative_angle(arg_2 -\n                                                     arg_0.minor_angle)\n            if arg_0.has_edge_within_group(arg_6):\n                arg_4 = correct_negative_angle(arg_4 +\n                                                   arg_0.minor_angle)\n\n        elif arg_5 == len(arg_0.nodes.keys())-1 and arg_6 == 0:\n            if arg_0.has_edge_within_group(arg_5):\n                arg_2 = correct_negative_angle(arg_2 +\n                                                     arg_0.minor_angle)\n            if arg_0.has_edge_within_group(arg_6):\n                arg_4 = correct_negative_angle(arg_4 -\n                                                   arg_0.minor_angle)\n\n        elif arg_5 < arg_6:\n            if arg_0.has_edge_within_group(arg_6):\n                arg_4 = correct_negative_angle(arg_4 -\n                                                   arg_0.minor_angle)\n            if arg_0.has_edge_within_group(arg_5):\n                arg_2 = correct_negative_angle(arg_2 +\n                                                     arg_0.minor_angle)\n\n        elif arg_6 < arg_5:\n            if arg_0.has_edge_within_group(arg_5):\n                arg_2 = correct_negative_angle(arg_2 -\n                                                     arg_0.minor_angle)\n            if arg_0.has_edge_within_group(arg_6):\n                arg_4 = correct_negative_angle(arg_4 +\n                                                   arg_0.minor_angle)\n\n        return arg_2, arg_4", "path": "hiveplot/hiveplot.py", "identifier": "HivePlot.adjust_angles", "docstring": "This function adjusts the start and end angles to correct for\n        duplicated axes.", "docstring_tokens": ["This", "function", "adjusts", "the", "start", "and", "end", "angles", "to", "correct", "for", "duplicated", "axes", "."], "nwo": "ericmjl/hiveplot", "score": 0.42129665900712104, "idx": 259331}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/isolate.py#L64-L68", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Copy sys.modules onto my mod stack", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "sys", ".", "modules", ".", "copy", "(", ")", "arg_0", ".", "_mod_stack", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Copy sys.modules onto my mod stack\n        \"\"\"\n        arg_1 = sys.modules.copy()\n        arg_0._mod_stack.append(arg_1)", "path": "environment/lib/python2.7/site-packages/nose/plugins/isolate.py", "identifier": "IsolationPlugin.beforeContext", "docstring": "Copy sys.modules onto my mod stack", "docstring_tokens": ["Copy", "sys", ".", "modules", "onto", "my", "mod", "stack"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259332}
{"url": "https://github.com/maxzheng/bumper-lib/blob/32a9dec5448673825bb2d7d92fa68882b597f794/bumper/cars.py#L589-L593", "sha": "32a9dec5448673825bb2d7d92fa68882b597f794", "docstring_summary": "Restore content in target file to be before any changes", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_original_target_content", ":", "with", "open", "(", "arg_0", ".", "target", ",", "'w'", ")", "as", "fp", ":", "fp", ".", "write", "(", "arg_0", ".", "_original_target_content", ")"], "function": "def Func(arg_0):\n        \"\"\" Restore content in target file to be before any changes \"\"\"\n        if arg_0._original_target_content:\n            with open(arg_0.target, 'w') as fp:\n                fp.write(arg_0._original_target_content)", "path": "bumper/cars.py", "identifier": "AbstractBumper.reverse", "docstring": "Restore content in target file to be before any changes", "docstring_tokens": ["Restore", "content", "in", "target", "file", "to", "be", "before", "any", "changes"], "nwo": "maxzheng/bumper-lib", "score": 0.17782712273869106, "idx": 259333}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/scene/camera.py#L65-L76", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Updates the camera vectors based on the current yaw and pitch", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Vector3", "(", "[", "0.0", ",", "0.0", ",", "0.0", "]", ")", "arg_1", ".", "x", "=", "cos", "(", "radians", "(", "arg_0", ".", "yaw", ")", ")", "*", "cos", "(", "radians", "(", "arg_0", ".", "pitch", ")", ")", "arg_1", ".", "y", "=", "sin", "(", "radians", "(", "arg_0", ".", "pitch", ")", ")", "arg_1", ".", "z", "=", "sin", "(", "radians", "(", "arg_0", ".", "yaw", ")", ")", "*", "cos", "(", "radians", "(", "arg_0", ".", "pitch", ")", ")", "arg_0", ".", "dir", "=", "vector", ".", "normalise", "(", "arg_1", ")", "arg_0", ".", "right", "=", "vector", ".", "normalise", "(", "vector3", ".", "cross", "(", "arg_0", ".", "dir", ",", "arg_0", ".", "_up", ")", ")", "arg_0", ".", "up", "=", "vector", ".", "normalise", "(", "vector3", ".", "cross", "(", "arg_0", ".", "right", ",", "arg_0", ".", "dir", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Updates the camera vectors based on the current yaw and pitch\n        \"\"\"\n        arg_1 = Vector3([0.0, 0.0, 0.0])\n        arg_1.x = cos(radians(arg_0.yaw)) * cos(radians(arg_0.pitch))\n        arg_1.y = sin(radians(arg_0.pitch))\n        arg_1.z = sin(radians(arg_0.yaw)) * cos(radians(arg_0.pitch))\n\n        arg_0.dir = vector.normalise(arg_1)\n        arg_0.right = vector.normalise(vector3.cross(arg_0.dir, arg_0._up))\n        arg_0.up = vector.normalise(vector3.cross(arg_0.right, arg_0.dir))", "path": "demosys/scene/camera.py", "identifier": "Camera._update_yaw_and_pitch", "docstring": "Updates the camera vectors based on the current yaw and pitch", "docstring_tokens": ["Updates", "the", "camera", "vectors", "based", "on", "the", "current", "yaw", "and", "pitch"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 259334}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_guess_media_type.py#L55-L100", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "returns a kba.pipeline \"transform\" function that generates file\n    type stats from the stream_items that it sees.  Currently, these\n    stats are just the first five non-whitespace characters.", "language": "python", "parameters": "(config)", "return_statement": "return _file_type_stats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_Func", "(", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ".", "body", "and", "arg_1", ".", "body", ".", "raw", ":", "if", "'doctype html'", "in", "arg_1", ".", "body", ".", "raw", "[", ":", "250", "]", ".", "lower", "(", ")", ":", "print", "'DOCTYPE: html'", "else", ":", "if", "has_tags", "(", "arg_1", ".", "body", ".", "raw", "[", ":", "400", "]", ")", ":", "print", "'PROBABLY_HTML'", "else", ":", "arg_3", "=", "xml_ish", ".", "search", "(", "arg_1", ".", "body", ".", "raw", ")", "if", "arg_3", ":", "print", "'XML: %s'", "%", "repr", "(", "arg_3", ".", "group", "(", "'intro'", ")", ")", "else", ":", "arg_4", "=", "pdf_start", ".", "search", "(", "arg_1", ".", "body", ".", "raw", ")", "if", "arg_4", ":", "print", "'PDF %s'", "%", "repr", "(", "arg_4", ".", "group", "(", "'version'", ")", ")", "else", ":", "arg_5", "=", "arg_1", ".", "abs_url", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "if", "len", "(", "arg_5", ")", "<", "6", ":", "print", "'UNK ext: %s'", "%", "repr", "(", "arg_5", ")", "else", ":", "arg_6", "=", "first_letters", ".", "match", "(", "arg_1", ".", "body", ".", "raw", ")", "if", "arg_6", "and", "False", ":", "print", "'UNK letters: %s'", "%", "repr", "(", "arg_6", ".", "group", "(", "'first_letters'", ")", ")", "else", ":", "print", "'UNK first bytes: %s'", "%", "repr", "(", "arg_1", ".", "body", ".", "raw", "[", ":", "50", "]", ")", "return", "arg_1", "return", "_Func"], "function": "def Func(arg_0):\n    '''\n    returns a kba.pipeline \"transform\" function that generates file\n    type stats from the stream_items that it sees.  Currently, these\n    stats are just the first five non-whitespace characters.\n    '''\n    ## make a closure around config\n    def _Func(arg_1, arg_2):\n        if arg_1.body and arg_1.body.raw:\n            #print repr(stream_item.body.raw[:250])\n            #sys.stdout.flush()\n            #doctype_m = doctype_re.match(stream_item.body.raw[:250])\n            #if doctype_m:\n                #print 'DOCTYPE: %s' % repr(doctype_m.group('doctype').lower())\n            if 'doctype html' in arg_1.body.raw[:250].lower():\n                print 'DOCTYPE: html'\n            else:\n                #if probably_html.search(stream_item.body.raw):\n                if has_tags(arg_1.body.raw[:400]):\n                    print 'PROBABLY_HTML'\n                else:\n                    arg_3 = xml_ish.search(arg_1.body.raw)\n                    if arg_3:\n                        print 'XML: %s' % repr(arg_3.group('intro'))\n                    else:\n                        arg_4 = pdf_start.search(arg_1.body.raw)\n                        if arg_4:\n                            print 'PDF %s' % repr(arg_4.group('version'))\n                        else:\n                            arg_5 = arg_1.abs_url.split('.')[-1]\n                            if len(arg_5) < 6:\n                                print 'UNK ext: %s' % repr(arg_5)\n                            else:\n                                arg_6 = first_letters.match(arg_1.body.raw)\n                                if arg_6 and False:\n                                    print 'UNK letters: %s' % repr(arg_6.group('first_letters'))\n                                else:\n                                    print 'UNK first bytes: %s' % repr(arg_1.body.raw[:50])\n                    #m = first_three_letters.search(stream_item.body.raw)\n                    #if m:\n                    #    print repr(m.group('first_three_letters')).lower().strip()\n                    #else:\n                    #    print repr(stream_item.body.raw[:50]).lower().strip()\n        return arg_1\n\n    return _Func", "path": "streamcorpus_pipeline/_guess_media_type.py", "identifier": "file_type_stats", "docstring": "returns a kba.pipeline \"transform\" function that generates file\n    type stats from the stream_items that it sees.  Currently, these\n    stats are just the first five non-whitespace characters.", "docstring_tokens": ["returns", "a", "kba", ".", "pipeline", "transform", "function", "that", "generates", "file", "type", "stats", "from", "the", "stream_items", "that", "it", "sees", ".", "Currently", "these", "stats", "are", "just", "the", "first", "five", "non", "-", "whitespace", "characters", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 259335}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/backend/numpy/linalg.py#L97-L109", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Numpy matmul wrapper.", "language": "python", "parameters": "(a, b,\n            transpose_a=False, transpose_b=False,\n            adjoint_a=False, adjoint_b=False,\n            a_is_sparse=False, b_is_sparse=False,\n            name=None)", "return_statement": "return np.matmul(a, b)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ")", ":", "if", "arg_6", "or", "arg_7", ":", "raise", "NotImplementedError", "(", "'Numpy backend does not support sparse matmul.'", ")", "if", "arg_2", "or", "arg_4", ":", "arg_0", "=", "_matrix_transpose", "(", "arg_0", ",", "conjugate", "=", "arg_4", ")", "if", "arg_3", "or", "arg_5", ":", "arg_1", "=", "_matrix_transpose", "(", "arg_1", ",", "conjugate", "=", "arg_5", ")", "return", "np", ".", "matmul", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1,\n            arg_2=False, arg_3=False,\n            arg_4=False, arg_5=False,\n            arg_6=False, arg_7=False,\n            arg_8=None):  # pylint: disable=unused-argument\n  \"\"\"Numpy matmul wrapper.\"\"\"\n  if arg_6 or arg_7:\n    raise NotImplementedError('Numpy backend does not support sparse matmul.')\n  if arg_2 or arg_4:\n    arg_0 = _matrix_transpose(arg_0, conjugate=arg_4)\n  if arg_3 or arg_5:\n    arg_1 = _matrix_transpose(arg_1, conjugate=arg_5)\n  return np.matmul(arg_0, arg_1)", "path": "tensorflow_probability/python/internal/backend/numpy/linalg.py", "identifier": "_matmul", "docstring": "Numpy matmul wrapper.", "docstring_tokens": ["Numpy", "matmul", "wrapper", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259336}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L965-L976", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Get the Content-Type of the given url, using a HEAD request", "language": "python", "parameters": "(url, session)", "return_statement": "return resp.headers.get(\"Content-Type\", \"\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "urllib_parse", ".", "urlsplit", "(", "arg_0", ")", "if", "arg_2", "not", "in", "(", "'http'", ",", "'https'", ")", ":", "return", "''", "arg_7", "=", "arg_1", ".", "head", "(", "arg_0", ",", "allow_redirects", "=", "True", ")", "arg_7", ".", "raise_for_status", "(", ")", "return", "arg_7", ".", "headers", ".", "get", "(", "\"Content-Type\"", ",", "\"\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get the Content-Type of the given url, using a HEAD request\"\"\"\n        arg_2, arg_3, arg_4, arg_5, arg_6 = urllib_parse.urlsplit(arg_0)\n        if arg_2 not in ('http', 'https'):\n            # FIXME: some warning or something?\n            # assertion error?\n            return ''\n\n        arg_7 = arg_1.head(arg_0, allow_redirects=True)\n        arg_7.raise_for_status()\n\n        return arg_7.headers.get(\"Content-Type\", \"\")", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/index.py", "identifier": "HTMLPage._get_content_type", "docstring": "Get the Content-Type of the given url, using a HEAD request", "docstring_tokens": ["Get", "the", "Content", "-", "Type", "of", "the", "given", "url", "using", "a", "HEAD", "request"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259337}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/setup.py#L69-L79", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "Get first sentence of first paragraph of long description.", "language": "python", "parameters": "(long_desc)", "return_statement": "return \"\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "False", "arg_2", "=", "[", "]", "for", "arg_3", "in", "[", "item", ".", "rstrip", "(", ")", "for", "item", "in", "arg_0", ".", "split", "(", "\"\\n\"", ")", "]", ":", "if", "arg_1", "and", "(", "(", "(", "not", "arg_3", ")", "and", "(", "not", "arg_2", ")", ")", "or", "(", "arg_3", "and", "arg_2", ")", ")", ":", "arg_2", ".", "append", "(", "arg_3", ")", "elif", "arg_1", "and", "arg_2", "and", "(", "not", "arg_3", ")", ":", "return", "(", "\" \"", ".", "join", "(", "arg_2", ")", ".", "split", "(", "\".\"", ")", "[", "0", "]", ")", ".", "strip", "(", ")", "arg_1", "=", "arg_3", "==", "\".. [[[end]]]\"", "if", "not", "arg_1", "else", "arg_1", "return", "\"\""], "function": "def Func(arg_0):\n    \"\"\"Get first sentence of first paragraph of long description.\"\"\"\n    arg_1 = False\n    arg_2 = []\n    for arg_3 in [item.rstrip() for item in arg_0.split(\"\\n\")]:\n        if arg_1 and (((not arg_3) and (not arg_2)) or (arg_3 and arg_2)):\n            arg_2.append(arg_3)\n        elif arg_1 and arg_2 and (not arg_3):\n            return (\" \".join(arg_2).split(\".\")[0]).strip()\n        arg_1 = arg_3 == \".. [[[end]]]\" if not arg_1 else arg_1\n    return \"\"", "path": "setup.py", "identifier": "get_short_desc", "docstring": "Get first sentence of first paragraph of long description.", "docstring_tokens": ["Get", "first", "sentence", "of", "first", "paragraph", "of", "long", "description", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 259338}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/__init__.py#L5-L26", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Function taken from MC3 Pipeline", "language": "python", "parameters": "(work_dir, bam_name)", "return_statement": "return int(mean)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"docker run --log-driver=none --rm -v {}:/data quay.io/ucsc_cgl/samtools \"", "\"view -f66 {}\"", ".", "format", "(", "arg_0", ",", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", ")", "arg_3", "=", "subprocess", ".", "Popen", "(", "args", "=", "arg_2", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "arg_4", "=", "0.0", "arg_5", "=", "0.0", "while", "True", ":", "arg_6", "=", "arg_3", ".", "stdout", ".", "readline", "(", ")", "if", "not", "arg_6", ":", "break", "arg_7", "=", "arg_6", ".", "split", "(", "\"\\t\"", ")", "if", "abs", "(", "long", "(", "arg_7", "[", "8", "]", ")", ")", "<", "10000", ":", "arg_4", "+=", "abs", "(", "long", "(", "arg_7", "[", "8", "]", ")", ")", "arg_5", "+=", "1", "arg_3", ".", "wait", "(", ")", "try", ":", "arg_8", "=", "arg_4", "/", "arg_5", "except", "ZeroDivisionError", ":", "arg_8", "=", "150", "print", "\"Using insert size: %d\"", "%", "arg_8", "return", "int", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Function taken from MC3 Pipeline\"\"\"\n    arg_2 = \"docker run --log-driver=none --rm -v {}:/data quay.io/ucsc_cgl/samtools \" \\\n          \"view -f66 {}\".format(arg_0, os.path.join(arg_0, arg_1))\n    arg_3 = subprocess.Popen(args=arg_2, shell=True, stdout=subprocess.PIPE)\n    arg_4 = 0.0\n    arg_5 = 0.0\n    while True:\n        arg_6 = arg_3.stdout.readline()\n        if not arg_6:\n            break\n        arg_7 = arg_6.split(\"\\t\")\n        if abs(long(arg_7[8])) < 10000:\n            arg_4 += abs(long(arg_7[8]))\n            arg_5 += 1\n    arg_3.wait()\n    try:\n        arg_8 = arg_4 / arg_5\n    except ZeroDivisionError:\n        arg_8 = 150\n    print \"Using insert size: %d\" % arg_8\n    return int(arg_8)", "path": "src/toil_lib/tools/__init__.py", "identifier": "get_mean_insert_size", "docstring": "Function taken from MC3 Pipeline", "docstring_tokens": ["Function", "taken", "from", "MC3", "Pipeline"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 259339}
{"url": "https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/__init__.py#L59-L89", "sha": "d30107be02521fa6cdfe285da3b6b0cdd153c8cc", "docstring_summary": "Verifies that an instance of this class adheres to the given\n        restrictions.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "super", "(", "MetadataStatement", ",", "arg_0", ")", ".", "Func", "(", "**", "arg_1", ")", "if", "\"signing_keys\"", "in", "arg_0", ":", "if", "'signing_keys_uri'", "in", "arg_0", ":", "raise", "VerificationError", "(", "'You can only have one of \"signing_keys\" and '", "'\"signing_keys_uri\" in a metadata statement'", ")", "else", ":", "arg_2", "=", "KeyJar", "(", ")", "try", ":", "arg_2", ".", "import_jwks", "(", "arg_0", "[", "'signing_keys'", "]", ",", "''", ")", "except", "Exception", ":", "raise", "VerificationError", "(", "'\"signing_keys\" not a proper JWKS'", ")", "if", "\"metadata_statements\"", "in", "arg_0", "and", "\"metadata_statement_uris\"", "in", "arg_0", ":", "arg_3", "=", "set", "(", "arg_0", "[", "'metadata_statements'", "]", ".", "keys", "(", ")", ")", "arg_4", "=", "set", "(", "arg_0", "[", "'metadata_statement_uris'", "]", ".", "keys", "(", ")", ")", "if", "arg_3", ".", "intersection", "(", "arg_4", ")", ":", "raise", "VerificationError", "(", "'You should not have the same key in \"metadata_statements\" '", "'and in \"metadata_statement_uris\"'", ")", "return", "True"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Verifies that an instance of this class adheres to the given\n        restrictions.\n\n        :param kwargs: A set of keyword arguments\n        :return: True if it verifies OK otherwise False.\n        \"\"\"\n        super(MetadataStatement, arg_0).Func(**arg_1)\n        if \"signing_keys\" in arg_0:\n            if 'signing_keys_uri' in arg_0:\n                raise VerificationError(\n                    'You can only have one of \"signing_keys\" and '\n                    '\"signing_keys_uri\" in a metadata statement')\n            else:\n                # signing_keys MUST be a JWKS\n                arg_2 = KeyJar()\n                try:\n                    arg_2.import_jwks(arg_0['signing_keys'], '')\n                except Exception:\n                    raise VerificationError('\"signing_keys\" not a proper JWKS')\n\n        if \"metadata_statements\" in arg_0 and \"metadata_statement_uris\" in arg_0:\n            arg_3 = set(arg_0['metadata_statements'].keys())\n            arg_4 = set(arg_0['metadata_statement_uris'].keys())\n            if arg_3.intersection(arg_4):\n                raise VerificationError(\n                    'You should not have the same key in \"metadata_statements\" '\n                    'and in \"metadata_statement_uris\"')\n\n        return True", "path": "src/fedoidcmsg/__init__.py", "identifier": "MetadataStatement.verify", "docstring": "Verifies that an instance of this class adheres to the given\n        restrictions.\n\n        :param kwargs: A set of keyword arguments\n        :return: True if it verifies OK otherwise False.", "docstring_tokens": ["Verifies", "that", "an", "instance", "of", "this", "class", "adheres", "to", "the", "given", "restrictions", "."], "nwo": "IdentityPython/fedoidcmsg", "score": 0.09252797783733271, "idx": 259340}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L91-L129", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Count in how many edges each annotation appears in a graph, but filter out source nodes and target nodes.", "language": "python", "parameters": "(graph: BELGraph,\n                                     annotation: str,\n                                     source_predicate: Optional[NodePredicate] = None,\n                                     target_predicate: Optional[NodePredicate] = None,\n                                     )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "[", "arg_6", "]", "=", "None", ",", "arg_7", ":", "arg_5", "[", "arg_6", "]", "=", "None", ",", ")", "->", "Counter", ":", "if", "arg_4", "and", "arg_7", ":", "return", "Counter", "(", "arg_10", "[", "ANNOTATIONS", "]", "[", "arg_2", "]", "for", "arg_8", ",", "arg_9", ",", "arg_10", "in", "arg_0", ".", "edges", "(", "arg_10", "=", "True", ")", "if", "edge_has_annotation", "(", "arg_10", ",", "arg_2", ")", "and", "arg_4", "(", "arg_0", ",", "arg_8", ")", "and", "arg_7", "(", "arg_0", ",", "arg_9", ")", ")", "elif", "arg_4", ":", "return", "Counter", "(", "arg_10", "[", "ANNOTATIONS", "]", "[", "arg_2", "]", "for", "arg_8", ",", "arg_9", ",", "arg_10", "in", "arg_0", ".", "edges", "(", "arg_10", "=", "True", ")", "if", "edge_has_annotation", "(", "arg_10", ",", "arg_2", ")", "and", "arg_4", "(", "arg_0", ",", "arg_8", ")", ")", "elif", "arg_7", ":", "return", "Counter", "(", "arg_10", "[", "ANNOTATIONS", "]", "[", "arg_2", "]", "for", "arg_8", ",", "arg_9", ",", "arg_10", "in", "arg_0", ".", "edges", "(", "arg_10", "=", "True", ")", "if", "edge_has_annotation", "(", "arg_10", ",", "arg_2", ")", "and", "arg_7", "(", "arg_0", ",", "arg_8", ")", ")", "else", ":", "return", "Counter", "(", "arg_10", "[", "ANNOTATIONS", "]", "[", "arg_2", "]", "for", "arg_8", ",", "arg_9", ",", "arg_10", "in", "arg_0", ".", "edges", "(", "arg_10", "=", "True", ")", "if", "edge_has_annotation", "(", "arg_10", ",", "arg_2", ")", ")"], "function": "def Func(arg_0: arg_1,\n                                     arg_2: arg_3,\n                                     arg_4: arg_5[arg_6] = None,\n                                     arg_7: arg_5[arg_6] = None,\n                                     ) -> Counter:\n    \"\"\"Count in how many edges each annotation appears in a graph, but filter out source nodes and target nodes.\n\n    See :func:`pybel_tools.utils.keep_node` for a basic filter.\n\n    :param graph: A BEL graph\n    :param annotation: The annotation to count\n    :param source_predicate: A predicate (graph, node) -> bool for keeping source nodes\n    :param target_predicate: A predicate (graph, node) -> bool for keeping target nodes\n    :return: A Counter from {annotation value: frequency}\n    \"\"\"\n    if arg_4 and arg_7:\n        return Counter(\n            arg_10[ANNOTATIONS][arg_2]\n            for arg_8, arg_9, arg_10 in arg_0.edges(arg_10=True)\n            if edge_has_annotation(arg_10, arg_2) and arg_4(arg_0, arg_8) and arg_7(arg_0, arg_9)\n        )\n    elif arg_4:\n        return Counter(\n            arg_10[ANNOTATIONS][arg_2]\n            for arg_8, arg_9, arg_10 in arg_0.edges(arg_10=True)\n            if edge_has_annotation(arg_10, arg_2) and arg_4(arg_0, arg_8)\n        )\n    elif arg_7:\n        return Counter(\n            arg_10[ANNOTATIONS][arg_2]\n            for arg_8, arg_9, arg_10 in arg_0.edges(arg_10=True)\n            if edge_has_annotation(arg_10, arg_2) and arg_7(arg_0, arg_8)\n        )\n    else:\n        return Counter(\n            arg_10[ANNOTATIONS][arg_2]\n            for arg_8, arg_9, arg_10 in arg_0.edges(arg_10=True)\n            if edge_has_annotation(arg_10, arg_2)\n        )", "path": "src/pybel_tools/summary/edge_summary.py", "identifier": "count_annotation_values_filtered", "docstring": "Count in how many edges each annotation appears in a graph, but filter out source nodes and target nodes.\n\n    See :func:`pybel_tools.utils.keep_node` for a basic filter.\n\n    :param graph: A BEL graph\n    :param annotation: The annotation to count\n    :param source_predicate: A predicate (graph, node) -> bool for keeping source nodes\n    :param target_predicate: A predicate (graph, node) -> bool for keeping target nodes\n    :return: A Counter from {annotation value: frequency}", "docstring_tokens": ["Count", "in", "how", "many", "edges", "each", "annotation", "appears", "in", "a", "graph", "but", "filter", "out", "source", "nodes", "and", "target", "nodes", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 259341}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L241-L253", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Deletes all feature collections.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "conn", ".", "indices", ".", "delete_mapping", "(", "index", "=", "arg_0", ".", "index", ",", "doc_type", "=", "arg_0", ".", "type", ")", "except", "TransportError", ":", "logger", ".", "warn", "(", "'type %r in index %r already deleted'", ",", "arg_0", ".", "index", ",", "arg_0", ".", "type", ",", "exc_info", "=", "True", ")"], "function": "def Func(arg_0):\n        '''Deletes all feature collections.\n\n        This does not destroy the ES index, but instead only\n        deletes all FCs with the configured document type\n        (defaults to ``fc``).\n        '''\n        try:\n            arg_0.conn.indices.delete_mapping(\n                index=arg_0.index, doc_type=arg_0.type)\n        except TransportError:\n            logger.warn('type %r in index %r already deleted',\n                        arg_0.index, arg_0.type, exc_info=True)", "path": "dossier/store/elastic.py", "identifier": "ElasticStore.delete_all", "docstring": "Deletes all feature collections.\n\n        This does not destroy the ES index, but instead only\n        deletes all FCs with the configured document type\n        (defaults to ``fc``).", "docstring_tokens": ["Deletes", "all", "feature", "collections", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 259342}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Volume.py#L164-L175", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Create a snapshot of the volume.", "language": "python", "parameters": "(self, name)", "return_statement": "return self.get_data(\n            \"volumes/%s/snapshots/\" % self.id,\n            type=POST,\n            params={\"name\": name}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "get_data", "(", "\"volumes/%s/Funcs/\"", "%", "arg_0", ".", "id", ",", "type", "=", "POST", ",", "params", "=", "{", "\"name\"", ":", "arg_1", "}", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a Func of the volume.\n\n        Args:\n            name: string - a human-readable name for the Func\n        \"\"\"\n        return arg_0.get_data(\n            \"volumes/%s/Funcs/\" % arg_0.id,\n            type=POST,\n            params={\"name\": arg_1}\n        )", "path": "digitalocean/Volume.py", "identifier": "Volume.snapshot", "docstring": "Create a snapshot of the volume.\n\n        Args:\n            name: string - a human-readable name for the snapshot", "docstring_tokens": ["Create", "a", "snapshot", "of", "the", "volume", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 259343}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/gurumate-2.8.6-py2.7.egg/gurumate/web.py#L5-L18", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Check whether the URL accessible and returns HTTP 200 OK or not\n    if not raises ValidationError", "language": "python", "parameters": "(url, timeout=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "if", "(", "arg_0", "==", "'localhost'", ")", ":", "arg_0", "=", "'http://127.0.0.1'", "try", ":", "arg_2", "=", "urllib2", ".", "urlopen", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "if", "(", "arg_2", ".", "getcode", "(", ")", "==", "200", ")", ":", "return", "True", "except", "Exception", ":", "pass", "fail", "(", "\"URL '%s' is not accessible from this machine\"", "%", "arg_0", ")"], "function": "def Func(arg_0, arg_1=10):       \n    '''\n    Check whether the URL accessible and returns HTTP 200 OK or not\n    if not raises ValidationError\n    '''\n    if(arg_0=='localhost'):\n        arg_0 = 'http://127.0.0.1'\n    try:\n        arg_2 = urllib2.urlopen(arg_0, arg_1=arg_1)\n        if (arg_2.getcode()==200):\n            return True\n    except Exception:\n        pass\n    fail(\"URL '%s' is not accessible from this machine\" % arg_0)", "path": "environment/lib/python2.7/site-packages/gurumate-2.8.6-py2.7.egg/gurumate/web.py", "identifier": "check_url_accessibility", "docstring": "Check whether the URL accessible and returns HTTP 200 OK or not\n    if not raises ValidationError", "docstring_tokens": ["Check", "whether", "the", "URL", "accessible", "and", "returns", "HTTP", "200", "OK", "or", "not", "if", "not", "raises", "ValidationError"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259344}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L180-L199", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Compile proto file to descriptor set.", "language": "python", "parameters": "(proto_file_path)", "return_statement": "return out_file", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tempfile", ".", "mkstemp", "(", ")", "[", "1", "]", "try", ":", "subprocess", ".", "check_output", "(", "[", "'protoc'", ",", "'--include_source_info'", ",", "'--descriptor_set_out'", ",", "arg_1", ",", "arg_0", "]", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "sys", ".", "exit", "(", "'protoc returned status {}'", ".", "format", "(", "e", ".", "returncode", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Compile proto file to descriptor set.\n\n    Args:\n        proto_file_path: Path to proto file to compile.\n\n    Returns:\n        Path to file containing compiled descriptor set.\n\n    Raises:\n        SystemExit if the compilation fails.\n    \"\"\"\n    arg_1 = tempfile.mkstemp()[1]\n    try:\n        subprocess.check_output(['protoc', '--include_source_info',\n                                 '--descriptor_set_out', arg_1,\n                                 arg_0])\n    except subprocess.CalledProcessError as e:\n        sys.exit('protoc returned status {}'.format(e.returncode))\n    return arg_1", "path": "docs/generate_proto_docs.py", "identifier": "compile_protofile", "docstring": "Compile proto file to descriptor set.\n\n    Args:\n        proto_file_path: Path to proto file to compile.\n\n    Returns:\n        Path to file containing compiled descriptor set.\n\n    Raises:\n        SystemExit if the compilation fails.", "docstring_tokens": ["Compile", "proto", "file", "to", "descriptor", "set", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259345}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L547-L569", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Set your typing status in this conversation.", "language": "python", "parameters": "(self, typing=hangouts_pb2.TYPING_TYPE_STARTED)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "TYPING_TYPE_STARTED", ")", ":", "try", ":", "await", "arg_0", ".", "_client", ".", "Func", "(", "arg_2", ".", "SetTypingRequest", "(", "request_header", "=", "arg_0", ".", "_client", ".", "get_request_header", "(", ")", ",", "conversation_id", "=", "arg_2", ".", "ConversationId", "(", "id", "=", "arg_0", ".", "id_", ")", ",", "type", "=", "arg_1", ",", ")", ")", "except", "exceptions", ".", "NetworkError", "as", "e", ":", "logger", ".", "warning", "(", "'Failed to set typing status: {}'", ".", "format", "(", "e", ")", ")", "raise"], "function": "async def Func(arg_0, arg_1=arg_2.TYPING_TYPE_STARTED):\n        \"\"\"Set your typing status in this conversation.\n\n        Args:\n            typing: (optional) ``TYPING_TYPE_STARTED``, ``TYPING_TYPE_PAUSED``,\n                or ``TYPING_TYPE_STOPPED`` to start, pause, or stop typing,\n                respectively. Defaults to ``TYPING_TYPE_STARTED``.\n\n        Raises:\n            .NetworkError: If typing status cannot be set.\n        \"\"\"\n        # TODO: Add rate-limiting to avoid unnecessary requests.\n        try:\n            await arg_0._client.Func(\n                arg_2.SetTypingRequest(\n                    request_header=arg_0._client.get_request_header(),\n                    conversation_id=arg_2.ConversationId(id=arg_0.id_),\n                    type=arg_1,\n                )\n            )\n        except exceptions.NetworkError as e:\n            logger.warning('Failed to set typing status: {}'.format(e))\n            raise", "path": "hangups/conversation.py", "identifier": "Conversation.set_typing", "docstring": "Set your typing status in this conversation.\n\n        Args:\n            typing: (optional) ``TYPING_TYPE_STARTED``, ``TYPING_TYPE_PAUSED``,\n                or ``TYPING_TYPE_STOPPED`` to start, pause, or stop typing,\n                respectively. Defaults to ``TYPING_TYPE_STARTED``.\n\n        Raises:\n            .NetworkError: If typing status cannot be set.", "docstring_tokens": ["Set", "your", "typing", "status", "in", "this", "conversation", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259346}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/rtlLevel/netlist.py#L31-L45", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Resolve name for process and mark outputs of statemens as not hidden", "language": "python", "parameters": "(statements: List[HdlStatement])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "]", ")", "->", "str", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "for", "arg_5", "in", "arg_4", ".", "_outputs", ":", "if", "not", "arg_5", ".", "hasGenericName", ":", "arg_3", ".", "append", "(", "arg_5", ".", "name", ")", "if", "arg_3", ":", "return", "min", "(", "arg_3", ")", "else", ":", "return", "\"\""], "function": "def Func(arg_0: arg_1[arg_2])\\\n        -> str:\n    \"\"\"\n    Resolve name for process and mark outputs of statemens as not hidden\n    \"\"\"\n    arg_3 = []\n    for arg_4 in arg_0:\n        for arg_5 in arg_4._outputs:\n            if not arg_5.hasGenericName:\n                arg_3.append(arg_5.name)\n\n    if arg_3:\n        return min(arg_3)\n    else:\n        return \"\"", "path": "hwt/synthesizer/rtlLevel/netlist.py", "identifier": "name_for_process_and_mark_outputs", "docstring": "Resolve name for process and mark outputs of statemens as not hidden", "docstring_tokens": ["Resolve", "name", "for", "process", "and", "mark", "outputs", "of", "statemens", "as", "not", "hidden"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 259347}
{"url": "https://github.com/blink1073/oct2py/blob/bfc69d2168ae3d98258f95bbc55a858c21836b58/oct2py/core.py#L595-L614", "sha": "bfc69d2168ae3d98258f95bbc55a858c21836b58", "docstring_summary": "Create a traceback for an Octave evaluation error.", "language": "python", "parameters": "(self, err)", "return_statement": "return errmsg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "logger", ".", "debug", "(", "arg_1", ")", "arg_2", "=", "arg_1", ".", "get", "(", "'stack'", ",", "[", "]", ")", "if", "not", "arg_1", "[", "'message'", "]", ".", "startswith", "(", "'parse error:'", ")", ":", "arg_1", "[", "'message'", "]", "=", "'error: '", "+", "arg_1", "[", "'message'", "]", "arg_3", "=", "'Octave evaluation error:\\n%s'", "%", "arg_1", "[", "'message'", "]", "if", "not", "isinstance", "(", "arg_2", ",", "StructArray", ")", ":", "return", "arg_3", "arg_3", "+=", "'\\nerror: called from:'", "for", "arg_4", "in", "arg_2", "[", ":", "-", "1", "]", ":", "arg_3", "+=", "'\\n    %(name)s at line %(line)d'", "%", "arg_4", "try", ":", "arg_3", "+=", "', column %(column)d'", "%", "arg_4", "except", "Exception", ":", "pass", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"Create a traceback for an Octave evaluation error.\r\n        \"\"\"\r\n        arg_0.logger.debug(arg_1)\r\n        arg_2 = arg_1.get('stack', [])\r\n        if not arg_1['message'].startswith('parse error:'):\r\n            arg_1['message'] = 'error: ' + arg_1['message']\r\n        arg_3 = 'Octave evaluation error:\\n%s' % arg_1['message']\r\n\r\n        if not isinstance(arg_2, StructArray):\r\n            return arg_3\r\n\r\n        arg_3 += '\\nerror: called from:'\r\n        for arg_4 in arg_2[:-1]:\r\n            arg_3 += '\\n    %(name)s at line %(line)d' % arg_4\r\n            try:\r\n                arg_3 += ', column %(column)d' % arg_4\r\n            except Exception:\r\n                pass\r\n        return arg_3", "path": "oct2py/core.py", "identifier": "Oct2Py._parse_error", "docstring": "Create a traceback for an Octave evaluation error.", "docstring_tokens": ["Create", "a", "traceback", "for", "an", "Octave", "evaluation", "error", "."], "nwo": "blink1073/oct2py", "score": 0.3484138981803976, "idx": 259348}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L582-L592", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Analyze a single morf or code unit.", "language": "python", "parameters": "(self, it)", "return_statement": "return Analysis(self, it)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_harvest_data", "(", ")", "if", "not", "isinstance", "(", "arg_1", ",", "CodeUnit", ")", ":", "arg_1", "=", "code_unit_factory", "(", "arg_1", ",", "arg_0", ".", "file_locator", ")", "[", "0", "]", "return", "Analysis", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Analyze a single morf or code unit.\n\n        Returns an `Analysis` object.\n\n        \"\"\"\n        arg_0._harvest_data()\n        if not isinstance(arg_1, CodeUnit):\n            arg_1 = code_unit_factory(arg_1, arg_0.file_locator)[0]\n\n        return Analysis(arg_0, arg_1)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage._analyze", "docstring": "Analyze a single morf or code unit.\n\n        Returns an `Analysis` object.", "docstring_tokens": ["Analyze", "a", "single", "morf", "or", "code", "unit", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 259349}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/reaction.py#L198-L274", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''This function handles the retrieval of a chemical's gas heat of\n    formation. Lookup is based on CASRNs. Will automatically select a data\n    source to use if no Method is provided; returns None if the data is not\n    available.", "language": "python", "parameters": "(CASRN, AvailableMethods=False, Method=None)", "return_statement": "return _Hfg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "def", "list_methods", "(", ")", ":", "arg_3", "=", "[", "]", "if", "arg_0", "in", "ATcT_g", ".", "index", ":", "arg_3", ".", "append", "(", "ATCT_G", ")", "if", "arg_0", "in", "TRC_gas_data", ".", "index", "and", "not", "np", ".", "isnan", "(", "TRC_gas_data", ".", "at", "[", "arg_0", ",", "'Hf'", "]", ")", ":", "arg_3", ".", "append", "(", "TRC", ")", "arg_3", ".", "append", "(", "NONE", ")", "return", "arg_3", "if", "arg_1", ":", "return", "list_methods", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_2", "==", "ATCT_G", ":", "arg_4", "=", "float", "(", "ATcT_g", ".", "at", "[", "arg_0", ",", "'Hf_298K'", "]", ")", "elif", "arg_2", "==", "TRC", ":", "arg_4", "=", "float", "(", "TRC_gas_data", ".", "at", "[", "arg_0", ",", "'Hf'", "]", ")", "elif", "arg_2", "==", "NONE", ":", "return", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n    r'''This function handles the retrieval of a chemical's gas heat of\n    formation. Lookup is based on CASRNs. Will automatically select a data\n    source to use if no Method is provided; returns None if the data is not\n    available.\n\n    Prefered sources are 'Active Thermochemical Tables (g)' for high accuracy,\n    and 'TRC' for less accuracy but more chemicals.\n    Function has data for approximately 2000 chemicals.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    _Hfg : float\n        Gas phase heat of formation, [J/mol]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain Hf(g) with the given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        Func_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        Hf(g) for the desired chemical, and will return methods instead of Hf(g)\n\n    Notes\n    -----\n    Sources are:\n\n        * 'ATCT_G', the Active Thermochemical Tables version 1.112.\n        * 'TRC', from a 1994 compilation.\n\n    Examples\n    --------\n    >>> Func('67-56-1')\n    -200700.0\n\n    References\n    ----------\n    .. [1] Ruscic, Branko, Reinhardt E. Pinzon, Gregor von Laszewski, Deepti\n       Kodeboyina, Alexander Burcat, David Leahy, David Montoy, and Albert F.\n       Wagner. \"Active Thermochemical Tables: Thermochemistry for the 21st\n       Century.\" Journal of Physics: Conference Series 16, no. 1\n       (January 1, 2005): 561. doi:10.1088/1742-6596/16/1/078.\n    .. [2] Frenkel\u02b9, M. L, Texas Engineering Experiment Station, and\n       Thermodynamics Research Center. Thermodynamics of Organic Compounds in\n       the Gas State. College Station, Tex.: Thermodynamics Research Center,\n       1994.\n    '''\n    def list_methods():\n        arg_3 = []\n        if arg_0 in ATcT_g.index:\n            arg_3.append(ATCT_G)\n        if arg_0 in TRC_gas_data.index and not np.isnan(TRC_gas_data.at[arg_0, 'Hf']):\n            arg_3.append(TRC)\n        arg_3.append(NONE)\n        return arg_3\n    if arg_1:\n        return list_methods()\n    if not arg_2:\n        arg_2 = list_methods()[0]\n\n    if arg_2 == ATCT_G:\n        arg_4 = float(ATcT_g.at[arg_0, 'Hf_298K'])\n    elif arg_2 == TRC:\n        arg_4 = float(TRC_gas_data.at[arg_0, 'Hf'])\n    elif arg_2 == NONE:\n        return None\n    else:\n        raise Exception('Failure in in function')\n    return arg_4", "path": "thermo/reaction.py", "identifier": "Hf_g", "docstring": "r'''This function handles the retrieval of a chemical's gas heat of\n    formation. Lookup is based on CASRNs. Will automatically select a data\n    source to use if no Method is provided; returns None if the data is not\n    available.\n\n    Prefered sources are 'Active Thermochemical Tables (g)' for high accuracy,\n    and 'TRC' for less accuracy but more chemicals.\n    Function has data for approximately 2000 chemicals.\n\n    Parameters\n    ----------\n    CASRN : string\n        CASRN [-]\n\n    Returns\n    -------\n    _Hfg : float\n        Gas phase heat of formation, [J/mol]\n    methods : list, only returned if AvailableMethods == True\n        List of methods which can be used to obtain Hf(g) with the given inputs\n\n    Other Parameters\n    ----------------\n    Method : string, optional\n        A string for the method name to use, as defined by constants in\n        Hf_g_methods\n    AvailableMethods : bool, optional\n        If True, function will determine which methods can be used to obtain\n        Hf(g) for the desired chemical, and will return methods instead of Hf(g)\n\n    Notes\n    -----\n    Sources are:\n\n        * 'ATCT_G', the Active Thermochemical Tables version 1.112.\n        * 'TRC', from a 1994 compilation.\n\n    Examples\n    --------\n    >>> Hf_g('67-56-1')\n    -200700.0\n\n    References\n    ----------\n    .. [1] Ruscic, Branko, Reinhardt E. Pinzon, Gregor von Laszewski, Deepti\n       Kodeboyina, Alexander Burcat, David Leahy, David Montoy, and Albert F.\n       Wagner. \"Active Thermochemical Tables: Thermochemistry for the 21st\n       Century.\" Journal of Physics: Conference Series 16, no. 1\n       (January 1, 2005): 561. doi:10.1088/1742-6596/16/1/078.\n    .. [2] Frenkel\u02b9, M. L, Texas Engineering Experiment Station, and\n       Thermodynamics Research Center. Thermodynamics of Organic Compounds in\n       the Gas State. College Station, Tex.: Thermodynamics Research Center,\n       1994.", "docstring_tokens": ["r", "This", "function", "handles", "the", "retrieval", "of", "a", "chemical", "s", "gas", "heat", "of", "formation", ".", "Lookup", "is", "based", "on", "CASRNs", ".", "Will", "automatically", "select", "a", "data", "source", "to", "use", "if", "no", "Method", "is", "provided", ";", "returns", "None", "if", "the", "data", "is", "not", "available", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 259350}
{"url": "https://github.com/Terrance/SkPy/blob/0f9489c94e8ec4d3effab4314497428872a80ad1/skpy/user.py#L411-L426", "sha": "0f9489c94e8ec4d3effab4314497428872a80ad1", "docstring_summary": "Retrieve public information about a user.", "language": "python", "parameters": "(self, id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "skype", ".", "conn", "(", "\"POST\"", ",", "\"{0}/batch/profiles\"", ".", "format", "(", "SkypeConnection", ".", "API_PROFILE", ")", ",", "auth", "=", "SkypeConnection", ".", "Auth", ".", "SkypeToken", ",", "arg_2", "=", "{", "\"Funcnames\"", ":", "[", "arg_1", "]", "}", ")", ".", "json", "(", ")", "if", "arg_2", "and", "\"status\"", "not", "in", "arg_2", "[", "0", "]", ":", "return", "arg_0", ".", "merge", "(", "SkypeUser", ".", "fromRaw", "(", "arg_0", ".", "skype", ",", "arg_2", "[", "0", "]", ")", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retrieve public information about a Func.\n\n        Args:\n            id (str): Func identifier to lookup\n\n        Returns:\n            SkypeUser: resulting Func object\n        \"\"\"\n        arg_2 = arg_0.skype.conn(\"POST\", \"{0}/batch/profiles\".format(SkypeConnection.API_PROFILE),\n                               auth=SkypeConnection.Auth.SkypeToken, arg_2={\"Funcnames\": [arg_1]}).json()\n        if arg_2 and \"status\" not in arg_2[0]:\n            return arg_0.merge(SkypeUser.fromRaw(arg_0.skype, arg_2[0]))\n        else:\n            return None", "path": "skpy/user.py", "identifier": "SkypeContacts.user", "docstring": "Retrieve public information about a user.\n\n        Args:\n            id (str): user identifier to lookup\n\n        Returns:\n            SkypeUser: resulting user object", "docstring_tokens": ["Retrieve", "public", "information", "about", "a", "user", "."], "nwo": "Terrance/SkPy", "score": 0.6983298124827472, "idx": 259351}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/datastructures/base.py#L106-L118", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Receive a PIL Image instance of a GIF and return 2-tuple.", "language": "python", "parameters": "(self, image, **kwargs)", "return_statement": "return (image, save_kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "'transparency'", "in", "arg_1", ".", "info", ":", "arg_3", "=", "{", "'transparency'", ":", "arg_1", ".", "info", "[", "'transparency'", "]", "}", "else", ":", "arg_3", "=", "{", "}", "return", "(", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Receive a PIL Image instance of a GIF and return 2-tuple.\n\n        Args:\n            * [0]: Original Image instance (passed to `image`)\n            * [1]: Dict with a transparency key (to GIF transparency layer)\n        \"\"\"\n        if 'transparency' in arg_1.info:\n            arg_3 = {'transparency': arg_1.info['transparency']}\n        else:\n            arg_3 = {}\n        return (arg_1, arg_3)", "path": "versatileimagefield/datastructures/base.py", "identifier": "ProcessedImage.preprocess_GIF", "docstring": "Receive a PIL Image instance of a GIF and return 2-tuple.\n\n        Args:\n            * [0]: Original Image instance (passed to `image`)\n            * [1]: Dict with a transparency key (to GIF transparency layer)", "docstring_tokens": ["Receive", "a", "PIL", "Image", "instance", "of", "a", "GIF", "and", "return", "2", "-", "tuple", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 259352}
{"url": "https://github.com/odrling/peony-twitter/blob/967f98e16e1889389540f2e6acbf7cc7a1a80203/peony/commands/commands.py#L98-L109", "sha": "967f98e16e1889389540f2e6acbf7cc7a1a80203", "docstring_summary": "run the function you want", "language": "python", "parameters": "(self, *args, data)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get", "(", "arg_2", ".", "text", ")", "try", ":", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "arg_0", "[", "arg_3", "]", "(", "*", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "await", "peony", ".", "utils", ".", "execute", "(", "arg_4", ")", "except", ":", "arg_5", "=", "\"Error occurred while Funcning function {cmd}:\"", "peony", ".", "utils", ".", "log_error", "(", "arg_5", ".", "format", "(", "arg_3", "=", "arg_3", ")", ")"], "function": "async def Func(arg_0, *arg_1, arg_2):\n        \"\"\" Func the function you want \"\"\"\n        arg_3 = arg_0._get(arg_2.text)\n\n        try:\n            if arg_3 is not None:\n                arg_4 = arg_0[arg_3](*arg_1, arg_2=arg_2)\n                return await peony.utils.execute(arg_4)\n\n        except:\n            arg_5 = \"Error occurred while Funcning function {cmd}:\"\n            peony.utils.log_error(arg_5.format(arg_3=arg_3))", "path": "peony/commands/commands.py", "identifier": "Functions.run", "docstring": "run the function you want", "docstring_tokens": ["run", "the", "function", "you", "want"], "nwo": "odrling/peony-twitter", "score": 0.43829836586226384, "idx": 259353}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L846-L866", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Sample the static latent prior.", "language": "python", "parameters": "(self, samples, batch_size, fixed=False)", "return_statement": "return sample, dist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_0", ".", "static_prior", "(", ")", "if", "arg_3", ":", "arg_5", "=", "arg_4", ".", "sample", "(", "(", "arg_1", ",", "1", ")", ")", "+", "tf", ".", "zeros", "(", "[", "arg_2", ",", "1", "]", ")", "else", ":", "arg_5", "=", "arg_4", ".", "sample", "(", "(", "arg_1", ",", "arg_2", ")", ")", "return", "arg_5", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\"Sample the static latent prior.\n\n    Args:\n      samples: Number of samples to draw from the latent distribution.\n      batch_size: Number of sequences to sample.\n      fixed: Boolean for whether or not to share the same random\n        sample across all sequences.\n\n    Returns:\n      A tuple of a sample tensor of shape [samples, batch_size,\n      latent_size], and a MultivariateNormalDiag distribution from which\n      the tensor was sampled, with event shape [latent_size], and batch\n      shape [].\n    \"\"\"\n    arg_4 = arg_0.static_prior()\n    if arg_3:  # in either case, shape is (samples, batch, latent)\n      arg_5 = arg_4.sample((arg_1, 1)) + tf.zeros([arg_2, 1])\n    else:\n      arg_5 = arg_4.sample((arg_1, arg_2))\n    return arg_5, arg_4", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "DisentangledSequentialVAE.sample_static_prior", "docstring": "Sample the static latent prior.\n\n    Args:\n      samples: Number of samples to draw from the latent distribution.\n      batch_size: Number of sequences to sample.\n      fixed: Boolean for whether or not to share the same random\n        sample across all sequences.\n\n    Returns:\n      A tuple of a sample tensor of shape [samples, batch_size,\n      latent_size], and a MultivariateNormalDiag distribution from which\n      the tensor was sampled, with event shape [latent_size], and batch\n      shape [].", "docstring_tokens": ["Sample", "the", "static", "latent", "prior", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259354}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L42-L48", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Expands specs.apps.depends.libs to include any indirectly required libs", "language": "python", "parameters": "(specs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", "[", "'apps'", "]", ".", "iteritems", "(", ")", ":", "if", "'depends'", "in", "arg_2", "and", "'libs'", "in", "arg_2", "[", "'depends'", "]", ":", "arg_2", "[", "'depends'", "]", "[", "'libs'", "]", "=", "_get_dependent", "(", "'libs'", ",", "arg_1", ",", "arg_0", ",", "'apps'", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Expands specs.apps.depends.libs to include any indirectly required libs\n    \"\"\"\n    for arg_1, arg_2 in arg_0['apps'].iteritems():\n        if 'depends' in arg_2 and 'libs' in arg_2['depends']:\n            arg_2['depends']['libs'] = _get_dependent('libs', arg_1, arg_0, 'apps')", "path": "dusty/compiler/spec_assembler.py", "identifier": "_expand_libs_in_apps", "docstring": "Expands specs.apps.depends.libs to include any indirectly required libs", "docstring_tokens": ["Expands", "specs", ".", "apps", ".", "depends", ".", "libs", "to", "include", "any", "indirectly", "required", "libs"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 259355}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L509-L565", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Generate a complex baseband MPSK signal with pulse shaping.", "language": "python", "parameters": "(N_symb,Ns,M,pulse='rect',alpha = 0.25,MM=6)", "return_statement": "return x,b/float(Ns),data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'rect'", ",", "arg_4", "=", "0.25", ",", "arg_5", "=", "6", ")", ":", "arg_6", "=", "np", ".", "random", ".", "randint", "(", "0", ",", "arg_2", ",", "arg_0", ")", "arg_7", "=", "np", ".", "exp", "(", "1j", "*", "2", "*", "np", ".", "pi", "/", "arg_2", "*", "arg_6", ")", "arg_8", "=", "np", ".", "hstack", "(", "(", "arg_7", ".", "reshape", "(", "arg_0", ",", "1", ")", ",", "np", ".", "zeros", "(", "(", "arg_0", ",", "int", "(", "arg_1", ")", "-", "1", ")", ")", ")", ")", "arg_8", "=", "arg_8", ".", "flatten", "(", ")", "if", "arg_3", ".", "lower", "(", ")", "==", "'rect'", ":", "arg_9", "=", "np", ".", "ones", "(", "int", "(", "arg_1", ")", ")", "elif", "arg_3", ".", "lower", "(", ")", "==", "'rc'", ":", "arg_9", "=", "rc_imp", "(", "arg_1", ",", "arg_4", ",", "arg_5", ")", "elif", "arg_3", ".", "lower", "(", ")", "==", "'src'", ":", "arg_9", "=", "sqrt_rc_imp", "(", "arg_1", ",", "arg_4", ",", "arg_5", ")", "else", ":", "raise", "ValueError", "(", "'pulse type must be rec, rc, or src'", ")", "arg_8", "=", "signal", ".", "lfilter", "(", "arg_9", ",", "1", ",", "arg_8", ")", "if", "arg_2", "==", "4", ":", "arg_8", "=", "arg_8", "*", "np", ".", "exp", "(", "1j", "*", "np", ".", "pi", "/", "4", ")", "return", "arg_8", ",", "arg_9", "/", "float", "(", "arg_1", ")", ",", "arg_6"], "function": "def Func(arg_0,arg_1,arg_2,arg_3='rect',arg_4 = 0.25,arg_5=6):\n    \"\"\"\n    Generate a complex baseband MPSK signal with pulse shaping.\n\n    Parameters\n    ----------\n    N_symb : number of MPSK symbols to produce\n    Ns : the number of samples per bit,\n    M : MPSK modulation order, e.g., 4, 8, 16, ...\n    pulse_type : 'rect' , 'rc', 'src' (default 'rect')\n    alpha : excess bandwidth factor(default 0.25)\n    MM : single sided pulse duration (default = 6) \n\n    Returns\n    -------\n    x : ndarray of the MPSK signal values\n    b : ndarray of the pulse shape\n    data : ndarray of the underlying data bits\n\n    Notes\n    -----\n    Pulse shapes include 'rect' (rectangular), 'rc' (raised cosine), \n    'src' (root raised cosine). The actual pulse length is 2*M+1 samples.\n    This function is used by BPSK_tx in the Case Study article.\n\n    Examples\n    --------\n    >>> from sk_dsp_comm import digitalcom as dc\n    >>> import scipy.signal as signal\n    >>> import matplotlib.pyplot as plt\n    >>> x,b,data = dc.Func(500,10,8,'src',0.35)\n    >>> # Matched filter received signal x\n    >>> y = signal.lfilter(b,1,x)\n    >>> plt.plot(y.real[12*10:],y.imag[12*10:])\n    >>> plt.xlabel('In-Phase')\n    >>> plt.ylabel('Quadrature')\n    >>> plt.axis('equal')\n    >>> # Sample once per symbol\n    >>> plt.plot(y.real[12*10::10],y.imag[12*10::10],'r.')\n    >>> plt.show()\n    \"\"\"\n    arg_6 = np.random.randint(0,arg_2,arg_0) \n    arg_7 = np.exp(1j*2*np.pi/arg_2*arg_6)\n    arg_8 = np.hstack((arg_7.reshape(arg_0,1),np.zeros((arg_0,int(arg_1)-1))))\n    arg_8 =arg_8.flatten()\n    if arg_3.lower() == 'rect':\n        arg_9 = np.ones(int(arg_1))\n    elif arg_3.lower() == 'rc':\n        arg_9 = rc_imp(arg_1,arg_4,arg_5)\n    elif arg_3.lower() == 'src':\n        arg_9 = sqrt_rc_imp(arg_1,arg_4,arg_5)\n    else:\n        raise ValueError('pulse type must be rec, rc, or src')\n    arg_8 = signal.lfilter(arg_9,1,arg_8)\n    if arg_2 == 4:\n        arg_8 = arg_8*np.exp(1j*np.pi/4); # For QPSK points in quadrants\n    return arg_8,arg_9/float(arg_1),arg_6", "path": "sk_dsp_comm/digitalcom.py", "identifier": "MPSK_bb", "docstring": "Generate a complex baseband MPSK signal with pulse shaping.\n\n    Parameters\n    ----------\n    N_symb : number of MPSK symbols to produce\n    Ns : the number of samples per bit,\n    M : MPSK modulation order, e.g., 4, 8, 16, ...\n    pulse_type : 'rect' , 'rc', 'src' (default 'rect')\n    alpha : excess bandwidth factor(default 0.25)\n    MM : single sided pulse duration (default = 6) \n\n    Returns\n    -------\n    x : ndarray of the MPSK signal values\n    b : ndarray of the pulse shape\n    data : ndarray of the underlying data bits\n\n    Notes\n    -----\n    Pulse shapes include 'rect' (rectangular), 'rc' (raised cosine), \n    'src' (root raised cosine). The actual pulse length is 2*M+1 samples.\n    This function is used by BPSK_tx in the Case Study article.\n\n    Examples\n    --------\n    >>> from sk_dsp_comm import digitalcom as dc\n    >>> import scipy.signal as signal\n    >>> import matplotlib.pyplot as plt\n    >>> x,b,data = dc.MPSK_bb(500,10,8,'src',0.35)\n    >>> # Matched filter received signal x\n    >>> y = signal.lfilter(b,1,x)\n    >>> plt.plot(y.real[12*10:],y.imag[12*10:])\n    >>> plt.xlabel('In-Phase')\n    >>> plt.ylabel('Quadrature')\n    >>> plt.axis('equal')\n    >>> # Sample once per symbol\n    >>> plt.plot(y.real[12*10::10],y.imag[12*10::10],'r.')\n    >>> plt.show()", "docstring_tokens": ["Generate", "a", "complex", "baseband", "MPSK", "signal", "with", "pulse", "shaping", "."], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 259356}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/hidden_markov_model.py#L736-L905", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Compute maximum likelihood sequence of hidden states.", "language": "python", "parameters": "(self, observations, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_2", "or", "\"Func\"", ")", ":", "with", "tf", ".", "control_dependencies", "(", "arg_0", ".", "_runtime_assertions", ")", ":", "arg_3", "=", "tf", ".", "shape", "(", "input", "=", "arg_1", ")", "with", "arg_0", ".", "_observation_shape_preconditions", "(", "arg_3", ")", ":", "arg_4", "=", "arg_3", "[", ":", "-", "1", "-", "arg_0", ".", "_underlying_event_rank", "]", "arg_5", "=", "arg_3", "[", "-", "1", "-", "arg_0", ".", "_underlying_event_rank", ":", "]", "arg_6", "=", "tf", ".", "broadcast_dynamic_shape", "(", "arg_4", ",", "arg_0", ".", "batch_shape_tensor", "(", ")", ")", "arg_7", "=", "tf", ".", "broadcast_to", "(", "arg_0", ".", "_log_init", ",", "tf", ".", "concat", "(", "[", "arg_6", ",", "[", "arg_0", ".", "_num_states", "]", "]", ",", "axis", "=", "0", ")", ")", "arg_1", "=", "tf", ".", "broadcast_to", "(", "arg_1", ",", "tf", ".", "concat", "(", "[", "arg_6", ",", "arg_5", "]", ",", "axis", "=", "0", ")", ")", "arg_8", "=", "tf", ".", "rank", "(", "arg_1", ")", "arg_9", "=", "arg_0", ".", "_underlying_event_rank", "arg_1", "=", "distribution_util", ".", "move_dimension", "(", "arg_1", ",", "arg_8", "-", "arg_9", "-", "1", ",", "0", ")", "arg_1", "=", "tf", ".", "expand_dims", "(", "arg_1", ",", "arg_8", "-", "arg_9", ")", "arg_10", "=", "arg_0", ".", "_observation_distribution", ".", "log_prob", "(", "arg_1", ")", "arg_11", "=", "arg_7", "+", "arg_10", "[", "0", "]", "if", "arg_0", ".", "_num_steps", "==", "1", ":", "arg_12", "=", "tf", ".", "argmax", "(", "input", "=", "arg_11", ",", "axis", "=", "-", "1", ")", "return", "arg_12", "[", "...", ",", "tf", ".", "newaxis", "]", "def", "forward_step", "(", "arg_13", ",", "arg_14", ")", ":", "arg_15", "=", "arg_13", "[", "0", "]", "arg_11", "=", "(", "arg_15", "[", "...", ",", "tf", ".", "newaxis", "]", "+", "arg_0", ".", "_log_trans", "+", "arg_14", "[", "...", ",", "tf", ".", "newaxis", ",", ":", "]", ")", "arg_16", "=", "tf", ".", "argmax", "(", "input", "=", "arg_11", ",", "axis", "=", "-", "2", ")", "arg_17", "=", "tf", ".", "reduce_max", "(", "input_tensor", "=", "arg_11", ",", "axis", "=", "-", "2", ")", "return", "(", "arg_17", ",", "arg_16", ")", "arg_18", ",", "arg_19", "=", "tf", ".", "scan", "(", "forward_step", ",", "arg_10", "[", "1", ":", "]", ",", "initializer", "=", "(", "arg_11", ",", "tf", ".", "zeros", "(", "tf", ".", "shape", "(", "input", "=", "arg_7", ")", ",", "dtype", "=", "tf", ".", "int64", ")", ")", ",", "arg_2", "=", "\"forward_log_probs\"", ")", "arg_12", "=", "tf", ".", "argmax", "(", "input", "=", "arg_18", "[", "-", "1", "]", ",", "axis", "=", "-", "1", ")", "def", "backward_step", "(", "arg_20", ",", "arg_16", ")", ":", "return", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "(", "arg_16", "*", "tf", ".", "one_hot", "(", "arg_20", ",", "arg_0", ".", "_num_states", ",", "dtype", "=", "tf", ".", "int64", ")", ")", ",", "axis", "=", "-", "1", ")", "arg_21", "=", "tf", ".", "scan", "(", "backward_step", ",", "arg_19", ",", "arg_12", ",", "reverse", "=", "True", ")", "arg_22", "=", "tf", ".", "concat", "(", "[", "arg_21", ",", "[", "arg_12", "]", "]", ",", "axis", "=", "0", ")", "return", "distribution_util", ".", "move_dimension", "(", "arg_22", ",", "0", ",", "-", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Compute maximum likelihood sequence of hidden states.\n\n    When this function is provided with a sequence of observations\n    `x[0], ..., x[num_steps - 1]`, it returns the sequence of hidden\n    states `z[0], ..., z[num_steps - 1]`, drawn from the underlying\n    Markov chain, that is most likely to yield those observations.\n\n    It uses the [Viterbi algorithm](\n    https://en.wikipedia.org/wiki/Viterbi_algorithm).\n\n    Note: the behavior of this function is undefined if the\n    `observations` argument represents impossible observations\n    from the model.\n\n    Note: if there isn't a unique most likely sequence then one\n    of the equally most likely sequences is chosen.\n\n    Args:\n      observations: A tensor representing a batch of observations made on the\n        hidden Markov model.  The rightmost dimensions of this tensor correspond\n        to the dimensions of the observation distributions of the underlying\n        Markov chain.  The next dimension from the right indexes the steps in a\n        sequence of observations from a single sample from the hidden Markov\n        model.  The size of this dimension should match the `num_steps`\n        parameter of the hidden Markov model object.  The other dimensions are\n        the dimensions of the batch and these are broadcast with the hidden\n        Markov model's parameters.\n      name: Python `str` name prefixed to Ops created by this class.\n        Default value: \"HiddenMarkovModel\".\n\n    Returns:\n      Func: A `Tensor` representing the most likely sequence of hidden\n        states. The rightmost dimension of this tensor will equal the\n        `num_steps` parameter providing one hidden state for each step. The\n        other dimensions are those of the batch.\n\n    Raises:\n      ValueError: if the `observations` tensor does not consist of\n      sequences of `num_steps` observations.\n\n    #### Examples\n\n    ```python\n    tfd = tfp.distributions\n\n    # A simple weather model.\n\n    # Represent a cold day with 0 and a hot day with 1.\n    # Suppose the first day of a sequence has a 0.8 chance of being cold.\n\n    initial_distribution = tfd.Categorical(probs=[0.8, 0.2])\n\n    # Suppose a cold day has a 30% chance of being followed by a hot day\n    # and a hot day has a 20% chance of being followed by a cold day.\n\n    transition_distribution = tfd.Categorical(probs=[[0.7, 0.3],\n                                                     [0.2, 0.8]])\n\n    # Suppose additionally that on each day the temperature is\n    # normally distributed with mean and standard deviation 0 and 5 on\n    # a cold day and mean and standard deviation 15 and 10 on a hot day.\n\n    observation_distribution = tfd.Normal(loc=[0., 15.], scale=[5., 10.])\n\n    # This gives the hidden Markov model:\n\n    model = tfd.HiddenMarkovModel(\n        initial_distribution=initial_distribution,\n        transition_distribution=transition_distribution,\n        observation_distribution=observation_distribution,\n        num_steps=7)\n\n    # Suppose we observe gradually rising temperatures over a week:\n    temps = [-2., 0., 2., 4., 6., 8., 10.]\n\n    # We can now compute the most probable sequence of hidden states:\n\n    model.Func(temps)\n\n    # The result is [0 0 0 0 0 1 1] telling us that the transition\n    # from \"cold\" to \"hot\" most likely happened between the\n    # 5th and 6th days.\n    ```\n    \"\"\"\n\n    with tf.name_scope(arg_2 or \"Func\"):\n      with tf.control_dependencies(arg_0._runtime_assertions):\n        arg_3 = tf.shape(input=arg_1)\n\n        with arg_0._observation_shape_preconditions(arg_3):\n          arg_4 = arg_3[\n              :-1 - arg_0._underlying_event_rank]\n          arg_5 = arg_3[\n              -1 - arg_0._underlying_event_rank:]\n\n          arg_6 = tf.broadcast_dynamic_shape(arg_4,\n                                                   arg_0.batch_shape_tensor())\n          arg_7 = tf.broadcast_to(arg_0._log_init,\n                                     tf.concat([arg_6,\n                                                [arg_0._num_states]],\n                                               axis=0))\n\n          arg_1 = tf.broadcast_to(arg_1,\n                                         tf.concat([arg_6,\n                                                    arg_5],\n                                                   axis=0))\n          arg_8 = tf.rank(arg_1)\n          arg_9 = arg_0._underlying_event_rank\n          arg_1 = distribution_util.move_dimension(\n              arg_1, arg_8 - arg_9 - 1, 0)\n\n          # We need to compute the probability of each observation for\n          # each possible state.\n          # This requires inserting an extra index just before the\n          # observation event indices that will be broadcast with the\n          # last batch index in `observation_distribution`.\n          arg_1 = tf.expand_dims(\n              arg_1,\n              arg_8 - arg_9)\n          arg_10 = arg_0._observation_distribution.log_prob(\n              arg_1)\n\n          arg_11 = arg_7 + arg_10[0]\n\n          if arg_0._num_steps == 1:\n            arg_12 = tf.argmax(input=arg_11, axis=-1)\n            return arg_12[..., tf.newaxis]\n\n          def forward_step(arg_13, arg_14):\n            arg_15 = arg_13[0]\n            arg_11 = (arg_15[..., tf.newaxis] +\n                        arg_0._log_trans +\n                        arg_14[..., tf.newaxis, :])\n            arg_16 = tf.argmax(input=arg_11, axis=-2)\n            arg_17 = tf.reduce_max(input_tensor=arg_11,\n                                                      axis=-2)\n            return (arg_17, arg_16)\n\n          arg_18, arg_19 = tf.scan(\n              forward_step,\n              arg_10[1:],\n              initializer=(arg_11,\n                           tf.zeros(tf.shape(input=arg_7), dtype=tf.int64)),\n              arg_2=\"forward_log_probs\")\n\n          arg_12 = tf.argmax(input=arg_18[-1], axis=-1)\n\n          # We require the operation that gives C from A and B where\n          # C[i...j] = A[i...j, B[i...j]]\n          # and A = most_likely_given_successor\n          #     B = most_likely_successor.\n          # tf.gather requires indices of known shape so instead we use\n          # reduction with tf.one_hot(B) to pick out elements from B\n          def backward_step(arg_20, arg_16):\n            return tf.reduce_sum(\n                input_tensor=(arg_16 *\n                              tf.one_hot(arg_20,\n                                         arg_0._num_states,\n                                         dtype=tf.int64)),\n                axis=-1)\n\n          arg_21 = tf.scan(\n              backward_step,\n              arg_19,\n              arg_12,\n              reverse=True)\n          arg_22 = tf.concat([arg_21, [arg_12]],\n                                            axis=0)\n          return distribution_util.move_dimension(arg_22, 0, -1)", "path": "tensorflow_probability/python/distributions/hidden_markov_model.py", "identifier": "HiddenMarkovModel.posterior_mode", "docstring": "Compute maximum likelihood sequence of hidden states.\n\n    When this function is provided with a sequence of observations\n    `x[0], ..., x[num_steps - 1]`, it returns the sequence of hidden\n    states `z[0], ..., z[num_steps - 1]`, drawn from the underlying\n    Markov chain, that is most likely to yield those observations.\n\n    It uses the [Viterbi algorithm](\n    https://en.wikipedia.org/wiki/Viterbi_algorithm).\n\n    Note: the behavior of this function is undefined if the\n    `observations` argument represents impossible observations\n    from the model.\n\n    Note: if there isn't a unique most likely sequence then one\n    of the equally most likely sequences is chosen.\n\n    Args:\n      observations: A tensor representing a batch of observations made on the\n        hidden Markov model.  The rightmost dimensions of this tensor correspond\n        to the dimensions of the observation distributions of the underlying\n        Markov chain.  The next dimension from the right indexes the steps in a\n        sequence of observations from a single sample from the hidden Markov\n        model.  The size of this dimension should match the `num_steps`\n        parameter of the hidden Markov model object.  The other dimensions are\n        the dimensions of the batch and these are broadcast with the hidden\n        Markov model's parameters.\n      name: Python `str` name prefixed to Ops created by this class.\n        Default value: \"HiddenMarkovModel\".\n\n    Returns:\n      posterior_mode: A `Tensor` representing the most likely sequence of hidden\n        states. The rightmost dimension of this tensor will equal the\n        `num_steps` parameter providing one hidden state for each step. The\n        other dimensions are those of the batch.\n\n    Raises:\n      ValueError: if the `observations` tensor does not consist of\n      sequences of `num_steps` observations.\n\n    #### Examples\n\n    ```python\n    tfd = tfp.distributions\n\n    # A simple weather model.\n\n    # Represent a cold day with 0 and a hot day with 1.\n    # Suppose the first day of a sequence has a 0.8 chance of being cold.\n\n    initial_distribution = tfd.Categorical(probs=[0.8, 0.2])\n\n    # Suppose a cold day has a 30% chance of being followed by a hot day\n    # and a hot day has a 20% chance of being followed by a cold day.\n\n    transition_distribution = tfd.Categorical(probs=[[0.7, 0.3],\n                                                     [0.2, 0.8]])\n\n    # Suppose additionally that on each day the temperature is\n    # normally distributed with mean and standard deviation 0 and 5 on\n    # a cold day and mean and standard deviation 15 and 10 on a hot day.\n\n    observation_distribution = tfd.Normal(loc=[0., 15.], scale=[5., 10.])\n\n    # This gives the hidden Markov model:\n\n    model = tfd.HiddenMarkovModel(\n        initial_distribution=initial_distribution,\n        transition_distribution=transition_distribution,\n        observation_distribution=observation_distribution,\n        num_steps=7)\n\n    # Suppose we observe gradually rising temperatures over a week:\n    temps = [-2., 0., 2., 4., 6., 8., 10.]\n\n    # We can now compute the most probable sequence of hidden states:\n\n    model.posterior_mode(temps)\n\n    # The result is [0 0 0 0 0 1 1] telling us that the transition\n    # from \"cold\" to \"hot\" most likely happened between the\n    # 5th and 6th days.\n    ```", "docstring_tokens": ["Compute", "maximum", "likelihood", "sequence", "of", "hidden", "states", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259357}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/loaders/scene/gltf.py#L130-L133", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Loads a gltf json file", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ".", "path", ")", "as", "fd", ":", "arg_0", ".", "meta", "=", "GLTFMeta", "(", "arg_0", ".", "path", ",", "json", ".", "load", "(", "fd", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Loads a gltf json file\"\"\"\n        with open(arg_0.path) as fd:\n            arg_0.meta = GLTFMeta(arg_0.path, json.load(fd))", "path": "demosys/loaders/scene/gltf.py", "identifier": "GLTF2.load_gltf", "docstring": "Loads a gltf json file", "docstring_tokens": ["Loads", "a", "gltf", "json", "file"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 259358}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L236-L243", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get a card", "language": "python", "parameters": "(self, id, name=None)", "return_statement": "return self.create_card(dict(id=id, name=name))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "create_card", "(", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Get a card\n\n        Returns:\n            Card: The card with the given `id`\n        '''\n        return arg_0.create_card(dict(arg_1=arg_1, arg_2=arg_2))", "path": "trolly/client.py", "identifier": "Client.get_card", "docstring": "Get a card\n\n        Returns:\n            Card: The card with the given `id`", "docstring_tokens": ["Get", "a", "card"], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 259359}
{"url": "https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L501-L516", "sha": "ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e", "docstring_summary": "Remove the given plugin name to the list of plugin names registered in\n      the current IDB.\n    Note that this implicitly uses the open IDB via the idc iterface.", "language": "python", "parameters": "(plugin_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "set", "(", "get_netnode_plugin_names", "(", ")", ")", "if", "arg_0", "not", "in", "arg_1", ":", "return", "try", ":", "arg_1", ".", "remove", "(", "arg_0", ")", "except", "KeyError", ":", "return", "arg_2", "(", ")", "[", "arg_3", "]", "=", "json", ".", "dumps", "(", "list", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Remove the given plugin name to the list of plugin names registered in\n      the current IDB.\n    Note that this implicitly uses the open IDB via the idc iterface.\n    \"\"\"\n    arg_1 = set(get_netnode_plugin_names())\n    if arg_0 not in arg_1:\n        return\n\n    try:\n        arg_1.remove(arg_0)\n    except KeyError:\n        return\n\n    arg_2()[arg_3] = json.dumps(list(arg_1))", "path": "ida_settings/ida_settings.py", "identifier": "del_netnode_plugin_name", "docstring": "Remove the given plugin name to the list of plugin names registered in\n      the current IDB.\n    Note that this implicitly uses the open IDB via the idc iterface.", "docstring_tokens": ["Remove", "the", "given", "plugin", "name", "to", "the", "list", "of", "plugin", "names", "registered", "in", "the", "current", "IDB", ".", "Note", "that", "this", "implicitly", "uses", "the", "open", "IDB", "via", "the", "idc", "iterface", "."], "nwo": "williballenthin/ida-settings", "score": 0.18657722465184873, "idx": 259360}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/meter_client.py#L122-L139", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "Make a call to the meter via JSON RPC", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "socket", "(", "AF_INET", ",", "SOCK_STREAM", ")", "arg_1", ".", "connect", "(", "(", "arg_0", ".", "rpc_host", ",", "arg_0", ".", "rpc_port", ")", ")", "arg_0", ".", "get_json", "(", ")", "arg_2", "=", "[", "arg_0", ".", "rpc_message", ".", "encode", "(", "'utf-8'", ")", "]", "for", "arg_3", "in", "arg_2", ":", "arg_1", ".", "send", "(", "arg_3", ")", "arg_4", "=", "arg_1", ".", "recv", "(", "arg_0", ".", "MAX_LINE", ")", "print", "(", "arg_4", ")", "arg_0", ".", "rpc_data", ".", "append", "(", "arg_4", ")", "arg_1", ".", "close", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Make a call to the meter via JSON RPC\n        \"\"\"\n\n        # Allocate a socket and connect to the meter\n        arg_1 = socket(AF_INET, SOCK_STREAM)\n        arg_1.connect((arg_0.rpc_host, arg_0.rpc_port))\n        arg_0.get_json()\n        arg_2 = [arg_0.rpc_message.encode('utf-8')]\n\n        for arg_3 in arg_2:\n            arg_1.send(arg_3)\n            arg_4 = arg_1.recv(arg_0.MAX_LINE)\n            print(arg_4)\n            arg_0.rpc_data.append(arg_4)\n\n        arg_1.close()", "path": "boundary/meter_client.py", "identifier": "MeterClient._call_api", "docstring": "Make a call to the meter via JSON RPC", "docstring_tokens": ["Make", "a", "call", "to", "the", "meter", "via", "JSON", "RPC"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 259361}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L224-L246", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Half-duplex SPI write.  If assert_ss is True, the SS line will be\n        asserted low, the specified bytes will be clocked out the MOSI line, and\n        if deassert_ss is True the SS line be put back high.", "language": "python", "parameters": "(self, data, assert_ss=True, deassert_ss=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "if", "arg_0", ".", "_mosi", "is", "None", ":", "raise", "RuntimeError", "(", "'Write attempted with no MOSI pin specified.'", ")", "if", "arg_2", "and", "arg_0", ".", "_ss", "is", "not", "None", ":", "arg_0", ".", "_gpio", ".", "set_low", "(", "arg_0", ".", "_ss", ")", "for", "arg_4", "in", "arg_1", ":", "for", "arg_5", "in", "range", "(", "8", ")", ":", "if", "arg_0", ".", "_Func_shift", "(", "arg_4", ",", "arg_5", ")", "&", "arg_0", ".", "_mask", ":", "arg_0", ".", "_gpio", ".", "set_high", "(", "arg_0", ".", "_mosi", ")", "else", ":", "arg_0", ".", "_gpio", ".", "set_low", "(", "arg_0", ".", "_mosi", ")", "arg_0", ".", "_gpio", ".", "output", "(", "arg_0", ".", "_sclk", ",", "not", "arg_0", ".", "_clock_base", ")", "arg_0", ".", "_gpio", ".", "output", "(", "arg_0", ".", "_sclk", ",", "arg_0", ".", "_clock_base", ")", "if", "arg_3", "and", "arg_0", ".", "_ss", "is", "not", "None", ":", "arg_0", ".", "_gpio", ".", "set_high", "(", "arg_0", ".", "_ss", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=True):\n        \"\"\"Half-duplex SPI Func.  If assert_ss is True, the SS line will be\n        asserted low, the specified bytes will be clocked out the MOSI line, and\n        if deassert_ss is True the SS line be put back high.\n        \"\"\"\n        # Fail MOSI is not specified.\n        if arg_0._mosi is None:\n            raise RuntimeError('Write attempted with no MOSI pin specified.')\n        if arg_2 and arg_0._ss is not None:\n            arg_0._gpio.set_low(arg_0._ss)\n        for arg_4 in arg_1:\n            for arg_5 in range(8):\n                # Write bit to MOSI.\n                if arg_0._Func_shift(arg_4, arg_5) & arg_0._mask:\n                    arg_0._gpio.set_high(arg_0._mosi)\n                else:\n                    arg_0._gpio.set_low(arg_0._mosi)\n                # Flip clock off base.\n                arg_0._gpio.output(arg_0._sclk, not arg_0._clock_base)\n                # Return clock to base.\n                arg_0._gpio.output(arg_0._sclk, arg_0._clock_base)\n        if arg_3 and arg_0._ss is not None:\n            arg_0._gpio.set_high(arg_0._ss)", "path": "Adafruit_GPIO/SPI.py", "identifier": "BitBang.write", "docstring": "Half-duplex SPI write.  If assert_ss is True, the SS line will be\n        asserted low, the specified bytes will be clocked out the MOSI line, and\n        if deassert_ss is True the SS line be put back high.", "docstring_tokens": ["Half", "-", "duplex", "SPI", "write", ".", "If", "assert_ss", "is", "True", "the", "SS", "line", "will", "be", "asserted", "low", "the", "specified", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "and", "if", "deassert_ss", "is", "True", "the", "SS", "line", "be", "put", "back", "high", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 259362}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_lib.py#L297-L332", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns confidence intervals for the desired correlation matrix volumes.", "language": "python", "parameters": "(\n    det_bounds, dim, num_samples, error_rate=1e-6, seed=42)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1e-6", ",", "arg_4", "=", "42", ")", ":", "arg_5", "=", "{", "}", "with", "tf", ".", "compat", ".", "v1", ".", "Session", "(", ")", "as", "sess", ":", "arg_6", ",", "arg_7", "=", "correlation_matrix_volume_rejection_samples", "(", "arg_0", ",", "arg_1", ",", "[", "arg_2", ",", "len", "(", "arg_0", ")", "]", ",", "np", ".", "float32", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "sess", ".", "run", "(", "arg_6", ")", "for", "arg_8", ",", "arg_9", "in", "zip", "(", "np", ".", "rollaxis", "(", "arg_6", ",", "1", ")", ",", "arg_0", ")", ":", "arg_10", "=", "(", "\"Estimating volume of {}x{} correlation \"", "\"matrices with determinant >= {}.\"", ")", "print", "(", "arg_10", ".", "format", "(", "arg_1", ",", "arg_1", ",", "arg_9", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "arg_5", "[", "arg_9", "]", "=", "_clopper_pearson_confidence_interval", "(", "arg_8", ",", "arg_3", "=", "arg_3", ")", "return", "arg_5"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3=1e-6, arg_4=42):\n  \"\"\"Returns confidence intervals for the desired correlation matrix volumes.\n\n  The confidence intervals are computed by the [Clopper-Pearson method]\n  (https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval).\n\n  Args:\n    det_bounds: A rank-1 numpy array of lower bounds on the\n      determinants of acceptable matrices.  Entries must be unique.\n    dim: A Python `int` dimension of correlation matrices to sample.\n    num_samples: The number of samples to draw.\n    error_rate: The statistical significance of the returned\n      confidence intervals.  The significance is broadcast: Each\n      returned interval separately may be incorrect with probability\n      (under the sample of correlation-like matrices drawn internally)\n      at most `error_rate`.\n    seed: Random seed.\n\n  Returns:\n    bounds: A Python `dict` mapping each determinant bound to the low, high\n      tuple giving the confidence interval.\n  \"\"\"\n  arg_5 = {}\n  with tf.compat.v1.Session() as sess:\n    arg_6, arg_7 = correlation_matrix_volume_rejection_samples(\n        arg_0, arg_1, [arg_2, len(arg_0)], np.float32, arg_4=arg_4)\n    arg_6 = sess.run(arg_6)\n    for arg_8, arg_9 in zip(np.rollaxis(arg_6, 1), arg_0):\n      arg_10 = (\"Estimating volume of {}x{} correlation \"\n                  \"matrices with determinant >= {}.\")\n      print(arg_10.format(arg_1, arg_1, arg_9))\n      sys.stdout.flush()\n      arg_5[arg_9] = _clopper_pearson_confidence_interval(\n          arg_8, arg_3=arg_3)\n    return arg_5", "path": "tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_lib.py", "identifier": "compute_true_volumes", "docstring": "Returns confidence intervals for the desired correlation matrix volumes.\n\n  The confidence intervals are computed by the [Clopper-Pearson method]\n  (https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval).\n\n  Args:\n    det_bounds: A rank-1 numpy array of lower bounds on the\n      determinants of acceptable matrices.  Entries must be unique.\n    dim: A Python `int` dimension of correlation matrices to sample.\n    num_samples: The number of samples to draw.\n    error_rate: The statistical significance of the returned\n      confidence intervals.  The significance is broadcast: Each\n      returned interval separately may be incorrect with probability\n      (under the sample of correlation-like matrices drawn internally)\n      at most `error_rate`.\n    seed: Random seed.\n\n  Returns:\n    bounds: A Python `dict` mapping each determinant bound to the low, high\n      tuple giving the confidence interval.", "docstring_tokens": ["Returns", "confidence", "intervals", "for", "the", "desired", "correlation", "matrix", "volumes", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259363}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/set.py#L134-L136", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Creates a new set from members.", "language": "python", "parameters": "(*members: T, meta=None)", "return_statement": "return Set(pset(members), meta=meta)", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ":", "arg_1", ",", "arg_2", "=", "None", ")", "->", "Set", "[", "arg_1", "]", ":", "return", "Set", "(", "pFuncet", "(", "arg_0", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(*arg_0: arg_1, arg_2=None) -> Set[arg_1]:\n    \"\"\"CreateFunc a new Funcet from memberFunc.\"\"\"\n    return Set(pFuncet(arg_0), arg_2=arg_2)", "path": "src/basilisp/lang/set.py", "identifier": "s", "docstring": "Creates a new set from members.", "docstring_tokens": ["Creates", "a", "new", "set", "from", "members", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 259364}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2308-L2331", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Sort list of string with number in human order.", "language": "python", "parameters": "(text)", "return_statement": "return [atoi(c) for c in re.split('(\\d+)', text)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "atoi", "(", "arg_0", ")", ":", "return", "int", "(", "arg_0", ")", "if", "arg_0", ".", "isdigit", "(", ")", "else", "arg_0", "return", "[", "atoi", "(", "arg_1", ")", "for", "arg_1", "in", "re", ".", "split", "(", "'(\\d+)'", ",", "arg_0", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"Sort list of string with number in human order.\n\n    Examples\n    ----------\n    >>> l = ['im1.jpg', 'im31.jpg', 'im11.jpg', 'im21.jpg', 'im03.jpg', 'im05.jpg']\n    >>> l.sort(key=tl.files.Func)\n    ['im1.jpg', 'im03.jpg', 'im05', 'im11.jpg', 'im21.jpg', 'im31.jpg']\n    >>> l.sort() # that is what we dont want\n    ['im03.jpg', 'im05', 'im1.jpg', 'im11.jpg', 'im21.jpg', 'im31.jpg']\n\n    References\n    ----------\n    - `link <http://nedbatchelder.com/blog/200712/human_sorting.html>`__\n\n    \"\"\"\n\n    # - alist.sort(key=Func) sorts in human order\n    # http://nedbatchelder.com/blog/200712/human_sorting.html\n    # (See Toothy's implementation in the comments)\n    def atoi(arg_0):\n        return int(arg_0) if arg_0.isdigit() else arg_0\n\n    return [atoi(arg_1) for arg_1 in re.split('(\\d+)', arg_0)]", "path": "tensorlayer/files/utils.py", "identifier": "natural_keys", "docstring": "Sort list of string with number in human order.\n\n    Examples\n    ----------\n    >>> l = ['im1.jpg', 'im31.jpg', 'im11.jpg', 'im21.jpg', 'im03.jpg', 'im05.jpg']\n    >>> l.sort(key=tl.files.natural_keys)\n    ['im1.jpg', 'im03.jpg', 'im05', 'im11.jpg', 'im21.jpg', 'im31.jpg']\n    >>> l.sort() # that is what we dont want\n    ['im03.jpg', 'im05', 'im1.jpg', 'im11.jpg', 'im21.jpg', 'im31.jpg']\n\n    References\n    ----------\n    - `link <http://nedbatchelder.com/blog/200712/human_sorting.html>`__", "docstring_tokens": ["Sort", "list", "of", "string", "with", "number", "in", "human", "order", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 259365}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L582-L595", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Update status of a specific case.", "language": "python", "parameters": "(institute_id, case_name)", "return_statement": "return redirect(request.referrer)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "institute_and_case", "(", "store", ",", "arg_0", ",", "arg_1", ")", "arg_4", "=", "store", ".", "user", "(", "current_user", ".", "email", ")", "Func", "=", "request", ".", "form", ".", "get", "(", "'status'", ",", "arg_3", "[", "'status'", "]", ")", "arg_6", "=", "url_for", "(", "'.case'", ",", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", "if", "Func", "==", "'archive'", ":", "store", ".", "archive_case", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "Func", ",", "arg_6", ")", "else", ":", "store", ".", "update_status", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "Func", ",", "arg_6", ")", "return", "redirect", "(", "request", ".", "referrer", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Update status of a specific case.\"\"\"\n    arg_2, arg_3 = institute_and_case(store, arg_0, arg_1)\n    arg_4 = store.user(current_user.email)\n\n    Func = request.form.get('status', arg_3['status'])\n    arg_6 = url_for('.case', arg_0=arg_0, arg_1=arg_1)\n\n    if Func == 'archive':\n        store.archive_case(arg_2, arg_3, arg_4, Func, arg_6)\n    else:\n        store.update_status(arg_2, arg_3, arg_4, Func, arg_6)\n\n    return redirect(request.referrer)", "path": "scout/server/blueprints/cases/views.py", "identifier": "status", "docstring": "Update status of a specific case.", "docstring_tokens": ["Update", "status", "of", "a", "specific", "case", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259366}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/svg/__init__.py#L85-L93", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns XML element's attribute, or default if none.", "language": "python", "parameters": "(element, attribute, default=0)", "return_statement": "return a", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "arg_3", "=", "arg_0", ".", "getAttribute", "(", "arg_1", ")", "if", "arg_3", "==", "\"\"", ":", "return", "arg_2", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=0):\n    \n    \"\"\" Returns XML element's attribute, or default if none.\n    \"\"\" \n    \n    arg_3 = arg_0.getAttribute(arg_1)\n    if arg_3 == \"\": \n        return arg_2\n    return arg_3", "path": "lib/svg/__init__.py", "identifier": "get_attribute", "docstring": "Returns XML element's attribute, or default if none.", "docstring_tokens": ["Returns", "XML", "element", "s", "attribute", "or", "default", "if", "none", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259367}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/samples/hg_dav_provider.py#L579-L629", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Return HgResource object for path.", "language": "python", "parameters": "(self, path, environ)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_count_Func", "+=", "1", "arg_3", "=", "arg_1", ".", "strip", "(", "\"/\"", ")", "arg_4", "=", "None", "arg_5", ",", "arg_6", "=", "util", ".", "pop_path", "(", "arg_1", ")", "if", "arg_5", "==", "\"\"", ":", "return", "VirtualCollection", "(", "arg_1", ",", "arg_2", ",", "\"root\"", ",", "[", "\"edit\"", ",", "\"released\"", ",", "\"archive\"", "]", ")", "elif", "arg_5", "==", "\"edit\"", ":", "arg_3", "=", "arg_6", ".", "strip", "(", "\"/\"", ")", "arg_4", "=", "None", "elif", "arg_5", "==", "\"released\"", ":", "arg_3", "=", "arg_6", ".", "strip", "(", "\"/\"", ")", "arg_4", "=", "\"tip\"", "elif", "arg_5", "==", "\"archive\"", ":", "if", "arg_6", "==", "\"/\"", ":", "arg_7", "=", "arg_0", ".", "_get_log", "(", "limit", "=", "10", ")", "arg_8", "=", "[", "compat", ".", "to_native", "(", "l", "[", "\"local_id\"", "]", ")", "for", "l", "in", "arg_7", "]", "return", "VirtualCollection", "(", "arg_1", ",", "arg_2", ",", "\"Revisions\"", ",", "arg_8", ")", "arg_9", ",", "arg_6", "=", "util", ".", "pop_path", "(", "arg_6", ")", "try", ":", "int", "(", "arg_9", ")", "except", "Exception", ":", "return", "None", "arg_4", "=", "arg_9", "arg_3", "=", "arg_6", ".", "strip", "(", "\"/\"", ")", "else", ":", "return", "None", "arg_10", "=", "arg_0", ".", "_get_repo_info", "(", "arg_2", ",", "arg_4", ")", "if", "arg_3", "in", "arg_10", "[", "\"filedict\"", "]", ":", "return", "HgResource", "(", "arg_1", ",", "False", ",", "arg_2", ",", "arg_4", ",", "arg_3", ")", "if", "arg_3", "in", "arg_10", "[", "\"dirinfos\"", "]", "or", "arg_3", "==", "\"\"", ":", "return", "HgResource", "(", "arg_1", ",", "True", ",", "arg_2", ",", "arg_4", ",", "arg_3", ")", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return HgResource object for path.\n\n        See DAVProvider.Func()\n        \"\"\"\n        arg_0._count_Func += 1\n\n        # HG expects the resource paths without leading '/'\n        arg_3 = arg_1.strip(\"/\")\n        arg_4 = None\n        arg_5, arg_6 = util.pop_path(arg_1)\n\n        if arg_5 == \"\":\n            return VirtualCollection(\n                arg_1, arg_2, \"root\", [\"edit\", \"released\", \"archive\"]\n            )\n        elif arg_5 == \"edit\":\n            arg_3 = arg_6.strip(\"/\")\n            arg_4 = None\n        elif arg_5 == \"released\":\n            arg_3 = arg_6.strip(\"/\")\n            arg_4 = \"tip\"\n        elif arg_5 == \"archive\":\n            if arg_6 == \"/\":\n                # Browse /archive: return a list of revision folders:\n                arg_7 = arg_0._get_log(limit=10)\n                arg_8 = [compat.to_native(l[\"local_id\"]) for l in arg_7]\n                return VirtualCollection(arg_1, arg_2, \"Revisions\", arg_8)\n            arg_9, arg_6 = util.pop_path(arg_6)\n            try:\n                int(arg_9)\n            except Exception:\n                # Tried to access /archive/anyname\n                return None\n            # Access /archive/19\n            arg_4 = arg_9\n            arg_3 = arg_6.strip(\"/\")\n        else:\n            return None\n\n        # read mercurial repo into request cache\n        arg_10 = arg_0._get_repo_info(arg_2, arg_4)\n\n        if arg_3 in arg_10[\"filedict\"]:\n            # It is a version controlled file\n            return HgResource(arg_1, False, arg_2, arg_4, arg_3)\n\n        if arg_3 in arg_10[\"dirinfos\"] or arg_3 == \"\":\n            # It is an existing folder\n            return HgResource(arg_1, True, arg_2, arg_4, arg_3)\n        return None", "path": "wsgidav/samples/hg_dav_provider.py", "identifier": "HgResourceProvider.get_resource_inst", "docstring": "Return HgResource object for path.\n\n        See DAVProvider.get_resource_inst()", "docstring_tokens": ["Return", "HgResource", "object", "for", "path", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 259368}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/base.py#L200-L209", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Merge internal directives set with the given directives.\n        For working directives, attach it only in the dsl.Parser class", "language": "python", "parameters": "(cls, directives: dict)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "bool", ":", "arg_3", ".", "_directives", "=", "arg_3", ".", "_directives", ".", "new_child", "(", ")", "for", "arg_5", ",", "arg_6", "in", "arg_1", ".", "items", "(", ")", ":", "arg_3", ".", "set_one", "(", "arg_3", ".", "_directives", ",", "arg_5", ",", "arg_6", ")", "arg_6", ".", "ns_name", "=", "arg_5", "return", "True"], "function": "def Func(arg_0, arg_1: arg_2) -> bool:\n        \"\"\"\n        Merge internal directives set with the given directives.\n        For working directives, attach it only in the dsl.Parser class\n        \"\"\"\n        arg_3._directives = arg_3._directives.new_child()\n        for arg_5, arg_6 in arg_1.items():\n            arg_3.set_one(arg_3._directives, arg_5, arg_6)\n            arg_6.ns_name = arg_5\n        return True", "path": "pyrser/parsing/base.py", "identifier": "BasicParser.set_directives", "docstring": "Merge internal directives set with the given directives.\n        For working directives, attach it only in the dsl.Parser class", "docstring_tokens": ["Merge", "internal", "directives", "set", "with", "the", "given", "directives", ".", "For", "working", "directives", "attach", "it", "only", "in", "the", "dsl", ".", "Parser", "class"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 259369}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qobj/converters/pulse_instruction.py#L115-L157", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return converted `AcquireInstruction`.", "language": "python", "parameters": "(self, shift, instruction)", "return_statement": "return self._qobj_model(**command_dict)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_run_config", ".", "get", "(", "'meas_level'", ",", "2", ")", "arg_4", "=", "{", "'name'", ":", "'acquire'", ",", "'t0'", ":", "arg_1", "+", "arg_2", ".", "start_time", ",", "'duration'", ":", "arg_2", ".", "duration", ",", "'qubits'", ":", "[", "q", ".", "index", "for", "q", "in", "arg_2", ".", "acquires", "]", ",", "'memory_slot'", ":", "[", "m", ".", "index", "for", "m", "in", "arg_2", ".", "mem_slots", "]", "}", "if", "arg_3", "==", "2", ":", "if", "arg_2", ".", "command", ".", "discriminator", ":", "arg_4", ".", "update", "(", "{", "'discriminators'", ":", "[", "QobjMeasurementOption", "(", "name", "=", "arg_2", ".", "command", ".", "discriminator", ".", "name", ",", "params", "=", "arg_2", ".", "command", ".", "discriminator", ".", "params", ")", "]", "}", ")", "arg_4", ".", "update", "(", "{", "'register_slot'", ":", "[", "arg_5", ".", "index", "for", "arg_5", "in", "arg_2", ".", "reg_slots", "]", "}", ")", "if", "arg_3", ">=", "1", ":", "if", "arg_2", ".", "command", ".", "kernel", ":", "arg_4", ".", "update", "(", "{", "'kernels'", ":", "[", "QobjMeasurementOption", "(", "name", "=", "arg_2", ".", "command", ".", "kernel", ".", "name", ",", "params", "=", "arg_2", ".", "command", ".", "kernel", ".", "params", ")", "]", "}", ")", "return", "arg_0", ".", "_qobj_model", "(", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return converted `AcquireInstruction`.\n\n        Args:\n            shift(int): Offset time.\n            instruction (AcquireInstruction): acquire instruction.\n        Returns:\n            dict: Dictionary of required parameters.\n        \"\"\"\n        arg_3 = arg_0._run_config.get('meas_level', 2)\n\n        arg_4 = {\n            'name': 'acquire',\n            't0': arg_1+arg_2.start_time,\n            'duration': arg_2.duration,\n            'qubits': [q.index for q in arg_2.acquires],\n            'memory_slot': [m.index for m in arg_2.mem_slots]\n        }\n        if arg_3 == 2:\n            # setup discriminators\n            if arg_2.command.discriminator:\n                arg_4.update({\n                    'discriminators': [\n                        QobjMeasurementOption(\n                            name=arg_2.command.discriminator.name,\n                            params=arg_2.command.discriminator.params)\n                    ]\n                })\n            # setup register_slots\n            arg_4.update({\n                'register_slot': [arg_5.index for arg_5 in arg_2.reg_slots]\n            })\n        if arg_3 >= 1:\n            # setup kernels\n            if arg_2.command.kernel:\n                arg_4.update({\n                    'kernels': [\n                        QobjMeasurementOption(\n                            name=arg_2.command.kernel.name,\n                            params=arg_2.command.kernel.params)\n                    ]\n                })\n        return arg_0._qobj_model(**arg_4)", "path": "qiskit/qobj/converters/pulse_instruction.py", "identifier": "PulseQobjConverter.convert_acquire", "docstring": "Return converted `AcquireInstruction`.\n\n        Args:\n            shift(int): Offset time.\n            instruction (AcquireInstruction): acquire instruction.\n        Returns:\n            dict: Dictionary of required parameters.", "docstring_tokens": ["Return", "converted", "AcquireInstruction", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259370}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/source.py#L118-L124", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Returns a range identical to this one, but indicating that\n        it was expanded from the range `expanded_from`.", "language": "python", "parameters": "(self, expanded_from)", "return_statement": "return Range(self.source_buffer, self.begin_pos, self.begin_pos,\n                     expanded_from=expanded_from)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Range", "(", "arg_0", ".", "source_buffer", ",", "arg_0", ".", "begin_pos", ",", "arg_0", ".", "begin_pos", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns a range identical to this one, but indicating that\n        it was expanded from the range `expanded_from`.\n        \"\"\"\n        return Range(arg_0.source_buffer, arg_0.begin_pos, arg_0.begin_pos,\n                     arg_1=arg_1)", "path": "third_party/pythonparser/source.py", "identifier": "Range.chain", "docstring": "Returns a range identical to this one, but indicating that\n        it was expanded from the range `expanded_from`.", "docstring_tokens": ["Returns", "a", "range", "identical", "to", "this", "one", "but", "indicating", "that", "it", "was", "expanded", "from", "the", "range", "expanded_from", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 259371}
{"url": "https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L50-L91", "sha": "532e685c504ea96f9e42833594585159ac1d2068", "docstring_summary": "Return an Ice application with a default home page.", "language": "python", "parameters": "()", "return_statement": "return app", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "Ice", "(", ")", "@", "arg_0", ".", "get", "(", "'/'", ")", "def", "default_home_page", "(", ")", ":", "return", "simple_html", "(", "'It works!'", ",", "'<h1>It works!</h1>\\n'", "'<p>This is the default ice web page.</p>'", ")", "@", "arg_0", ".", "error", "(", ")", "def", "generic_error_page", "(", ")", ":", "return", "simple_html", "(", "arg_0", ".", "response", ".", "status_line", ",", "'<h1>{title}</h1>\\n'", "'<p>{description}</p>\\n'", "'<hr>\\n'", "'<address>Ice/{version}</address>'", ".", "format", "(", "arg_1", "=", "arg_0", ".", "response", ".", "status_line", ",", "description", "=", "arg_0", ".", "response", ".", "status_detail", ",", "version", "=", "__version__", ")", ")", "def", "simple_html", "(", "arg_1", ",", "arg_2", ")", ":", "return", "(", "'<!DOCTYPE html>\\n'", "'<html>\\n<head><title>{title}</title></head>\\n'", "'<body>\\n{body}\\n</body>\\n</html>\\n'", ")", ".", "format", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Return an Ice application with a default home page.\n\n    Create :class:`Ice` object, add a route to return the default page\n    when a client requests the server root, i.e. /, using HTTP GET\n    method, add an error handler to return HTTP error pages when an\n    error occurs and return this object. The returned object can be used\n    as a WSGI application.\n\n    Returns:\n      Ice: WSGI application.\n    \"\"\"\n    arg_0 = Ice()\n\n    @arg_0.get('/')\n    def default_home_page():\n        \"\"\"Return a default home page.\"\"\"\n        return simple_html('It works!',\n                           '<h1>It works!</h1>\\n'\n                           '<p>This is the default ice web page.</p>')\n\n    @arg_0.error()\n    def generic_error_page():\n        \"\"\"Return a simple and generic error page.\"\"\"\n        return simple_html(arg_0.response.status_line,\n                           '<h1>{title}</h1>\\n'\n                           '<p>{description}</p>\\n'\n                           '<hr>\\n'\n                           '<address>Ice/{version}</address>'.format(\n                           arg_1=arg_0.response.status_line,\n                           description=arg_0.response.status_detail,\n                           version=__version__))\n\n    def simple_html(arg_1, arg_2):\n        \"\"\"Return a simple HTML page.\"\"\"\n        return (\n            '<!DOCTYPE html>\\n'\n            '<html>\\n<head><title>{title}</title></head>\\n'\n            '<body>\\n{body}\\n</body>\\n</html>\\n'\n        ).format(arg_1=arg_1, arg_2=arg_2)\n\n    return arg_0", "path": "ice.py", "identifier": "cube", "docstring": "Return an Ice application with a default home page.\n\n    Create :class:`Ice` object, add a route to return the default page\n    when a client requests the server root, i.e. /, using HTTP GET\n    method, add an error handler to return HTTP error pages when an\n    error occurs and return this object. The returned object can be used\n    as a WSGI application.\n\n    Returns:\n      Ice: WSGI application.", "docstring_tokens": ["Return", "an", "Ice", "application", "with", "a", "default", "home", "page", "."], "nwo": "susam/ice", "score": 0.16638194949711382, "idx": 259372}
{"url": "https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/ls.py#L32-L74", "sha": "d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd", "docstring_summary": "Performs a Github API code search", "language": "python", "parameters": "(query, github_user=None)", "return_statement": "return repositories", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "temple", ".", "utils", ".", "GithubClient", "(", ")", "arg_3", "=", "{", "'Accept'", ":", "'application/vnd.github.v3.text-match+json'", "}", "arg_4", "=", "arg_2", ".", "get", "(", "'/search/code'", ",", "params", "=", "{", "'q'", ":", "arg_0", ",", "'per_page'", ":", "100", "}", ",", "arg_3", "=", "arg_3", ")", "if", "arg_4", ".", "status_code", "==", "requests", ".", "codes", ".", "unprocessable_entity", "and", "arg_1", ":", "raise", "temple", ".", "exceptions", ".", "InvalidGithubUserError", "(", "'Invalid Github user or org - \"{}\"'", ".", "format", "(", "arg_1", ")", ")", "arg_4", ".", "raise_for_status", "(", ")", "arg_5", "=", "arg_4", ".", "json", "(", ")", "arg_6", "=", "collections", ".", "defaultdict", "(", "dict", ")", "while", "True", ":", "arg_6", ".", "update", "(", "{", "'git@github.com:{}.git'", ".", "format", "(", "arg_7", "[", "'repository'", "]", "[", "'full_name'", "]", ")", ":", "arg_7", "[", "'repository'", "]", "for", "arg_7", "in", "arg_5", "[", "'items'", "]", "}", ")", "arg_8", "=", "_parse_link_header", "(", "arg_4", ".", "headers", ")", ".", "get", "(", "'next'", ")", "if", "arg_8", ":", "arg_4", "=", "requests", ".", "get", "(", "arg_8", ",", "arg_3", "=", "arg_3", ")", "arg_4", ".", "raise_for_status", "(", ")", "arg_5", "=", "arg_4", ".", "json", "(", ")", "else", ":", "break", "return", "arg_6"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Performs a Github API code search\n\n    Args:\n        query (str): The query sent to Github's code search\n        github_user (str, optional): The Github user being searched in the query string\n\n    Returns:\n        dict: A dictionary of repository information keyed on the git SSH url\n\n    Raises:\n        `InvalidGithubUserError`: When ``github_user`` is invalid\n    \"\"\"\n    arg_2 = temple.utils.GithubClient()\n    arg_3 = {'Accept': 'application/vnd.github.v3.text-match+json'}\n\n    arg_4 = arg_2.get('/search/code',\n                             params={'q': arg_0, 'per_page': 100},\n                             arg_3=arg_3)\n\n    if arg_4.status_code == requests.codes.unprocessable_entity and arg_1:\n        raise temple.exceptions.InvalidGithubUserError(\n            'Invalid Github user or org - \"{}\"'.format(arg_1))\n    arg_4.raise_for_status()\n\n    arg_5 = arg_4.json()\n\n    arg_6 = collections.defaultdict(dict)\n    while True:\n        arg_6.update({\n            'git@github.com:{}.git'.format(arg_7['repository']['full_name']): arg_7['repository']\n            for arg_7 in arg_5['items']\n        })\n\n        arg_8 = _parse_link_header(arg_4.headers).get('next')\n        if arg_8:\n            arg_4 = requests.get(arg_8, arg_3=arg_3)\n            arg_4.raise_for_status()\n            arg_5 = arg_4.json()\n        else:\n            break\n\n    return arg_6", "path": "temple/ls.py", "identifier": "_code_search", "docstring": "Performs a Github API code search\n\n    Args:\n        query (str): The query sent to Github's code search\n        github_user (str, optional): The Github user being searched in the query string\n\n    Returns:\n        dict: A dictionary of repository information keyed on the git SSH url\n\n    Raises:\n        `InvalidGithubUserError`: When ``github_user`` is invalid", "docstring_tokens": ["Performs", "a", "Github", "API", "code", "search"], "nwo": "CloverHealth/temple", "score": 0.39091779717332914, "idx": 259373}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/mask.py#L54-L66", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup a mask where all pixels are unmasked.", "language": "python", "parameters": "(cls, shape, pixel_scale, invert=False)", "return_statement": "return cls(array=mask, pixel_scale=pixel_scale)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "np", ".", "full", "(", "tuple", "(", "map", "(", "lambda", "d", ":", "int", "(", "d", ")", ",", "arg_1", ")", ")", ",", "False", ")", "if", "arg_3", ":", "arg_4", "=", "np", ".", "invert", "(", "arg_4", ")", "return", "arg_0", "(", "array", "=", "arg_4", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"Setup a mask where all pixels are unmasked.\n\n        Parameters\n        ----------\n        shape : (int, int)\n            The (y,x) shape of the mask in units of pixels.\n        pixel_scale: float\n            The arc-second to pixel conversion factor of each pixel.\n        \"\"\"\n        arg_4 = np.full(tuple(map(lambda d: int(d), arg_1)), False)\n        if arg_3: arg_4 = np.invert(arg_4)\n        return arg_0(array=arg_4, arg_2=arg_2)", "path": "autolens/data/array/mask.py", "identifier": "Mask.unmasked_for_shape_and_pixel_scale", "docstring": "Setup a mask where all pixels are unmasked.\n\n        Parameters\n        ----------\n        shape : (int, int)\n            The (y,x) shape of the mask in units of pixels.\n        pixel_scale: float\n            The arc-second to pixel conversion factor of each pixel.", "docstring_tokens": ["Setup", "a", "mask", "where", "all", "pixels", "are", "unmasked", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 259374}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/color.py#L596-L667", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augmenter to convert images to their grayscale versions.", "language": "python", "parameters": "(alpha=0, from_colorspace=\"RGB\", name=None, deterministic=False, random_state=None)", "return_statement": "return ChangeColorspace(to_colorspace=ChangeColorspace.GRAY, alpha=alpha, from_colorspace=from_colorspace,\n                            name=name, deterministic=deterministic, random_state=random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0", ",", "arg_1", "=", "\"RGB\"", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "\"Unnamed%s\"", "%", "(", "ia", ".", "caller_name", "(", ")", ",", ")", "return", "ChangeColorspace", "(", "to_colorspace", "=", "ChangeColorspace", ".", "GRAY", ",", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0=0, arg_1=\"RGB\", arg_2=None, arg_3=False, arg_4=None):\n    \"\"\"\n    Augmenter to convert images to their grayscale versions.\n\n    NOTE: Number of output channels is still 3, i.e. this augmenter just \"removes\" color.\n\n    TODO check dtype support\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: ?\n        * ``uint32``: ?\n        * ``uint64``: ?\n        * ``int8``: ?\n        * ``int16``: ?\n        * ``int32``: ?\n        * ``int64``: ?\n        * ``float16``: ?\n        * ``float32``: ?\n        * ``float64``: ?\n        * ``float128``: ?\n        * ``bool``: ?\n\n    Parameters\n    ----------\n    alpha : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional\n        The alpha value of the grayscale image when overlayed over the\n        old image. A value close to 1.0 means, that mostly the new grayscale\n        image is visible. A value close to 0.0 means, that mostly the\n        old image is visible.\n\n            * If a number, exactly that value will always be used.\n            * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will\n              be sampled per image.\n            * If a list, then a random value will be sampled from that list per image.\n            * If a StochasticParameter, a value will be sampled from the\n              parameter per image.\n\n    from_colorspace : str, optional\n        The source colorspace (of the input images).\n        Allowed strings are: ``RGB``, ``BGR``, ``GRAY``, ``CIE``, ``YCrCb``, ``HSV``, ``HLS``, ``Lab``, ``Luv``.\n        See :func:`imgaug.augmenters.color.ChangeColorspace.__init__`.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = iaa.Func(alpha=1.0)\n\n    creates an augmenter that turns images to their grayscale versions.\n\n    >>> aug = iaa.Func(alpha=(0.0, 1.0))\n\n    creates an augmenter that turns images to their grayscale versions with\n    an alpha value in the range ``0 <= alpha <= 1``. An alpha value of 0.5 would\n    mean, that the output image is 50 percent of the input image and 50\n    percent of the grayscale image (i.e. 50 percent of color removed).\n\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = \"Unnamed%s\" % (ia.caller_name(),)\n\n    return ChangeColorspace(to_colorspace=ChangeColorspace.GRAY, arg_0=arg_0, arg_1=arg_1,\n                            arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "imgaug/augmenters/color.py", "identifier": "Grayscale", "docstring": "Augmenter to convert images to their grayscale versions.\n\n    NOTE: Number of output channels is still 3, i.e. this augmenter just \"removes\" color.\n\n    TODO check dtype support\n\n    dtype support::\n\n        * ``uint8``: yes; fully tested\n        * ``uint16``: ?\n        * ``uint32``: ?\n        * ``uint64``: ?\n        * ``int8``: ?\n        * ``int16``: ?\n        * ``int32``: ?\n        * ``int64``: ?\n        * ``float16``: ?\n        * ``float32``: ?\n        * ``float64``: ?\n        * ``float128``: ?\n        * ``bool``: ?\n\n    Parameters\n    ----------\n    alpha : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional\n        The alpha value of the grayscale image when overlayed over the\n        old image. A value close to 1.0 means, that mostly the new grayscale\n        image is visible. A value close to 0.0 means, that mostly the\n        old image is visible.\n\n            * If a number, exactly that value will always be used.\n            * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will\n              be sampled per image.\n            * If a list, then a random value will be sampled from that list per image.\n            * If a StochasticParameter, a value will be sampled from the\n              parameter per image.\n\n    from_colorspace : str, optional\n        The source colorspace (of the input images).\n        Allowed strings are: ``RGB``, ``BGR``, ``GRAY``, ``CIE``, ``YCrCb``, ``HSV``, ``HLS``, ``Lab``, ``Luv``.\n        See :func:`imgaug.augmenters.color.ChangeColorspace.__init__`.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> aug = iaa.Grayscale(alpha=1.0)\n\n    creates an augmenter that turns images to their grayscale versions.\n\n    >>> aug = iaa.Grayscale(alpha=(0.0, 1.0))\n\n    creates an augmenter that turns images to their grayscale versions with\n    an alpha value in the range ``0 <= alpha <= 1``. An alpha value of 0.5 would\n    mean, that the output image is 50 percent of the input image and 50\n    percent of the grayscale image (i.e. 50 percent of color removed).", "docstring_tokens": ["Augmenter", "to", "convert", "images", "to", "their", "grayscale", "versions", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259375}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/cache_mixin.py#L31-L90", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "A wrapper for mem.cache that flushes the cache if the version\n        number of nibabel has changed.", "language": "python", "parameters": "(memory, func, **kwargs)", "return_statement": "return memory.cache(func, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "cachedir", "if", "arg_3", "is", "None", "or", "arg_3", "in", "arg_11", ":", "return", "arg_0", ".", "cache", "(", "arg_1", ",", "**", "arg_2", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'module_versions.json'", ")", "arg_5", "=", "dict", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_4", ")", ":", "with", "open", "(", "arg_4", ",", "'r'", ")", "as", "_version_file", ":", "arg_5", "=", "json", ".", "load", "(", "_version_file", ")", "arg_6", "=", "(", "nibabel", ",", ")", "arg_7", "=", "dict", "(", "(", "m", ".", "__name__", ",", "LooseVersion", "(", "m", ".", "__version__", ")", ".", "version", "[", ":", "2", "]", ")", "for", "m", "in", "arg_6", ")", "arg_8", "=", "set", "(", "arg_5", ".", "keys", "(", ")", ")", ".", "intersection", "(", "set", "(", "arg_7", ".", "keys", "(", ")", ")", ")", "arg_9", "=", "[", "m", "for", "m", "in", "arg_8", "if", "arg_5", "[", "m", "]", "!=", "arg_7", "[", "m", "]", "]", "if", "len", "(", "arg_9", ")", ">", "0", ":", "if", "nilearn", ".", "CHECK_CACHE_VERSION", ":", "warnings", ".", "warn", "(", "\"Incompatible cache in %s: \"", "\"different version of nibabel. Deleting \"", "\"the cache. Put nilearn.CHECK_CACHE_VERSION \"", "\"to false to avoid this behavior.\"", "%", "arg_3", ")", "try", ":", "arg_10", "=", "(", "os", ".", "path", ".", "split", "(", "arg_3", ")", "[", ":", "-", "1", "]", "+", "(", "'old_%i'", "%", "os", ".", "getpid", "(", ")", ",", ")", ")", "arg_10", "=", "os", ".", "path", ".", "join", "(", "*", "arg_10", ")", "os", ".", "rename", "(", "arg_3", ",", "arg_10", ")", "shutil", ".", "rmtree", "(", "arg_10", ")", "except", "OSError", ":", "pass", "try", ":", "os", ".", "makedirs", "(", "arg_3", ")", "except", "OSError", ":", "pass", "else", ":", "warnings", ".", "warn", "(", "\"Incompatible cache in %s: \"", "\"old version of nibabel.\"", "%", "arg_3", ")", "if", "arg_5", "!=", "arg_7", ":", "with", "open", "(", "arg_4", ",", "'w'", ")", "as", "_version_file", ":", "json", ".", "dump", "(", "arg_7", ",", "_version_file", ")", "arg_11", "[", "arg_3", "]", "=", "True", "return", "arg_0", ".", "cache", "(", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\" A wrapper for mem.cache that flushes the cache if the version\n        number of nibabel has changed.\n    \"\"\"\n    arg_3 = arg_0.cachedir\n\n    if arg_3 is None or arg_3 in arg_11:\n        return arg_0.cache(arg_1, **arg_2)\n\n    arg_4 = os.path.join(arg_3, 'module_versions.json')\n\n    arg_5 = dict()\n    if os.path.exists(arg_4):\n        with open(arg_4, 'r') as _version_file:\n            arg_5 = json.load(_version_file)\n\n    arg_6 = (nibabel, )\n    # Keep only the major + minor version numbers\n    arg_7 = dict((m.__name__, LooseVersion(m.__version__).version[:2])\n                       for m in arg_6)\n    arg_8 = set(arg_5.keys()).intersection(set(arg_7.keys()))\n    arg_9 = [m for m in arg_8 if arg_5[m] != arg_7[m]]\n\n    # Flush cache if version collision\n    if len(arg_9) > 0:\n        if nilearn.CHECK_CACHE_VERSION:\n            warnings.warn(\"Incompatible cache in %s: \"\n                          \"different version of nibabel. Deleting \"\n                          \"the cache. Put nilearn.CHECK_CACHE_VERSION \"\n                          \"to false to avoid this behavior.\"\n                          % arg_3)\n            try:\n                arg_10 = (os.path.split(arg_3)[:-1]\n                           + ('old_%i' % os.getpid(), ))\n                arg_10 = os.path.join(*arg_10)\n                # We use rename + unlink to be more robust to race\n                # conditions\n                os.rename(arg_3, arg_10)\n                shutil.rmtree(arg_10)\n            except OSError:\n                # Another process could have removed this dir\n                pass\n\n            try:\n                os.makedirs(arg_3)\n            except OSError:\n                # File exists?\n                pass\n        else:\n            warnings.warn(\"Incompatible cache in %s: \"\n                          \"old version of nibabel.\" % arg_3)\n\n    # Write json files if configuration is different\n    if arg_5 != arg_7:\n        with open(arg_4, 'w') as _version_file:\n            json.dump(arg_7, _version_file)\n\n    arg_11[arg_3] = True\n\n    return arg_0.cache(arg_1, **arg_2)", "path": "boyle/utils/cache_mixin.py", "identifier": "_safe_cache", "docstring": "A wrapper for mem.cache that flushes the cache if the version\n        number of nibabel has changed.", "docstring_tokens": ["A", "wrapper", "for", "mem", ".", "cache", "that", "flushes", "the", "cache", "if", "the", "version", "number", "of", "nibabel", "has", "changed", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259376}
{"url": "https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L260-L291", "sha": "800976faab3b827a42fa1cb80f13fcc03961d2c9", "docstring_summary": "r\"\"\"Fetch a request token.", "language": "python", "parameters": "(self, url, realm=None, **request_kwargs)", "return_statement": "return token", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_0", ".", "_client", ".", "client", ".", "realm", "=", "\" \"", ".", "join", "(", "arg_2", ")", "if", "arg_2", "else", "None", "arg_6", "=", "arg_0", ".", "_fetch_token", "(", "arg_1", ",", "**", "arg_3", ")", "log", ".", "debug", "(", "\"Resetting callback_uri and realm (not needed in next phase).\"", ")", "arg_0", ".", "_client", ".", "client", ".", "callback_uri", "=", "None", "arg_0", ".", "_client", ".", "client", ".", "realm", "=", "None", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        r\"\"\"Fetch a request token.\n\n        This is the first step in the OAuth 1 workflow. A request token is\n        obtained by making a signed post request to url. The token is then\n        parsed from the application/x-www-form-urlencoded response and ready\n        to be used to construct an authorization url.\n\n        :param url: The request token endpoint URL.\n        :param realm: A list of realms to request access to.\n        :param \\*\\*request_kwargs: Optional arguments passed to ''post''\n        function in ''requests.Session''\n        :returns: The response in dict format.\n\n        Note that a previously set callback_uri will be reset for your\n        convenience, or else signature creation will be incorrect on\n        consecutive requests.\n\n        >>> request_token_url = 'https://api.twitter.com/oauth/request_token'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret')\n        >>> oauth_session.Func(request_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }\n        \"\"\"\n        arg_0._client.client.realm = \" \".join(arg_2) if arg_2 else None\n        arg_6 = arg_0._fetch_token(arg_1, **arg_3)\n        log.debug(\"Resetting callback_uri and realm (not needed in next phase).\")\n        arg_0._client.client.callback_uri = None\n        arg_0._client.client.realm = None\n        return arg_6", "path": "requests_oauthlib/oauth1_session.py", "identifier": "OAuth1Session.fetch_request_token", "docstring": "r\"\"\"Fetch a request token.\n\n        This is the first step in the OAuth 1 workflow. A request token is\n        obtained by making a signed post request to url. The token is then\n        parsed from the application/x-www-form-urlencoded response and ready\n        to be used to construct an authorization url.\n\n        :param url: The request token endpoint URL.\n        :param realm: A list of realms to request access to.\n        :param \\*\\*request_kwargs: Optional arguments passed to ''post''\n        function in ''requests.Session''\n        :returns: The response in dict format.\n\n        Note that a previously set callback_uri will be reset for your\n        convenience, or else signature creation will be incorrect on\n        consecutive requests.\n\n        >>> request_token_url = 'https://api.twitter.com/oauth/request_token'\n        >>> oauth_session = OAuth1Session('client-key', client_secret='secret')\n        >>> oauth_session.fetch_request_token(request_token_url)\n        {\n            'oauth_token': 'sdf0o9823sjdfsdf',\n            'oauth_token_secret': '2kjshdfp92i34asdasd',\n        }", "docstring_tokens": ["r", "Fetch", "a", "request", "token", "."], "nwo": "requests/requests-oauthlib", "score": 0.9446339936112974, "idx": 259377}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/project/base.py#L163-L172", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Takes a list of resource descriptions adding them\r\n        to the resource pool they belong to scheduling them for loading.", "language": "python", "parameters": "(self, meta_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "return", "for", "arg_2", "in", "arg_1", ":", "getattr", "(", "resources", ",", "arg_2", ".", "resource_type", ")", ".", "add", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\"\r\n        Takes a list of resource descriptions adding them\r\n        to the resource pool they belong to scheduling them for loading.\r\n        \"\"\"\r\n        if not arg_1:\r\n            return\r\n\r\n        for arg_2 in arg_1:\r\n            getattr(resources, arg_2.resource_type).add(arg_2)", "path": "demosys/project/base.py", "identifier": "BaseProject._add_resource_descriptions_to_pools", "docstring": "Takes a list of resource descriptions adding them\r\n        to the resource pool they belong to scheduling them for loading.", "docstring_tokens": ["Takes", "a", "list", "of", "resource", "descriptions", "adding", "them", "to", "the", "resource", "pool", "they", "belong", "to", "scheduling", "them", "for", "loading", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 259378}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L666-L698", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "This method will call the Tone library for the selected pin.\n        If the tone command is set to TONE_TONE, then the specified tone will be played.\n        Else, if the tone command is TONE_NO_TONE, then any currently playing tone will be disabled.\n        It is intended for a future release of Arduino Firmata", "language": "python", "parameters": "(self, pin, tone_command, frequency, duration)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_2", "==", "arg_0", ".", "TONE_TONE", ":", "if", "arg_4", ":", "arg_5", "=", "[", "arg_2", ",", "arg_1", ",", "arg_3", "&", "0x7f", ",", "(", "arg_3", ">>", "7", ")", "&", "0x7f", ",", "arg_4", "&", "0x7f", ",", "(", "arg_4", ">>", "7", ")", "&", "0x7f", "]", "else", ":", "arg_5", "=", "[", "arg_2", ",", "arg_1", ",", "arg_3", "&", "0x7f", ",", "(", "arg_3", ">>", "7", ")", "&", "0x7f", ",", "0", ",", "0", "]", "arg_0", ".", "_command_handler", ".", "digital_response_table", "[", "arg_1", "]", "[", "arg_0", ".", "_command_handler", ".", "RESPONSE_TABLE_MODE", "]", "=", "arg_0", ".", "TONE", "else", ":", "arg_5", "=", "[", "arg_2", ",", "arg_1", "]", "arg_0", ".", "_command_handler", ".", "send_sysex", "(", "arg_0", ".", "_command_handler", ".", "TONE_PLAY", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        This method will call the Tone library for the selected pin.\n        If the tone command is set to TONE_TONE, then the specified tone will be played.\n        Else, if the tone command is TONE_NO_TONE, then any currently playing tone will be disabled.\n        It is intended for a future release of Arduino Firmata\n\n        :param pin: Pin number\n\n        :param tone_command: Either TONE_TONE, or TONE_NO_TONE\n\n        :param frequency: Frequency of tone in hz\n\n        :param duration: Duration of tone in milliseconds\n\n        :return: No return value\n        \"\"\"\n\n        # convert the integer values to bytes\n        if arg_2 == arg_0.TONE_TONE:\n            # duration is specified\n            if arg_4:\n                arg_5 = [arg_2, arg_1, arg_3 & 0x7f, (arg_3 >> 7) & 0x7f, arg_4 & 0x7f, (arg_4 >> 7) & 0x7f]\n\n            else:\n                arg_5 = [arg_2, arg_1, arg_3 & 0x7f, (arg_3 >> 7) & 0x7f, 0, 0]\n\n            arg_0._command_handler.digital_response_table[arg_1][arg_0._command_handler.RESPONSE_TABLE_MODE] = \\\n                arg_0.TONE\n        # turn off tone\n        else:\n            arg_5 = [arg_2, arg_1]\n        arg_0._command_handler.send_sysex(arg_0._command_handler.TONE_PLAY, arg_5)", "path": "PyMata/pymata.py", "identifier": "PyMata.play_tone", "docstring": "This method will call the Tone library for the selected pin.\n        If the tone command is set to TONE_TONE, then the specified tone will be played.\n        Else, if the tone command is TONE_NO_TONE, then any currently playing tone will be disabled.\n        It is intended for a future release of Arduino Firmata\n\n        :param pin: Pin number\n\n        :param tone_command: Either TONE_TONE, or TONE_NO_TONE\n\n        :param frequency: Frequency of tone in hz\n\n        :param duration: Duration of tone in milliseconds\n\n        :return: No return value", "docstring_tokens": ["This", "method", "will", "call", "the", "Tone", "library", "for", "the", "selected", "pin", ".", "If", "the", "tone", "command", "is", "set", "to", "TONE_TONE", "then", "the", "specified", "tone", "will", "be", "played", ".", "Else", "if", "the", "tone", "command", "is", "TONE_NO_TONE", "then", "any", "currently", "playing", "tone", "will", "be", "disabled", ".", "It", "is", "intended", "for", "a", "future", "release", "of", "Arduino", "Firmata"], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 259379}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_lib.py#L133-L169", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns a uniformly random `Tensor` of \"correlation-like\" matrices.", "language": "python", "parameters": "(num_rows, batch_shape, dtype, seed)", "return_statement": "return tf.linalg.set_diag(symmetric, diagonal_ones)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", "*", "(", "arg_0", "+", "1", ")", "/", "2", "arg_5", "=", "tf", ".", "ones", "(", "shape", "=", "[", "arg_4", "]", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "uniform", ".", "Uniform", "(", "-", "arg_5", ",", "arg_5", ")", ".", "sample", "(", "arg_1", ",", "arg_3", "=", "arg_3", ")", "arg_7", "=", "util", ".", "fill_triangular", "(", "arg_6", ")", "arg_8", "=", "arg_7", "+", "tf", ".", "linalg", ".", "matrix_transpose", "(", "arg_7", ")", "arg_9", "=", "tf", ".", "ones", "(", "shape", "=", "util", ".", "pad", "(", "arg_1", ",", "axis", "=", "0", ",", "back", "=", "True", ",", "value", "=", "arg_0", ")", ",", "arg_2", "=", "arg_2", ")", "return", "tf", ".", "linalg", ".", "set_diag", "(", "arg_8", ",", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Returns a uniformly random `Tensor` of \"correlation-like\" matrices.\n\n  A \"correlation-like\" matrix is a symmetric square matrix with all entries\n  between -1 and 1 (inclusive) and 1s on the main diagonal.  Of these,\n  the ones that are positive semi-definite are exactly the correlation\n  matrices.\n\n  Args:\n    num_rows: Python `int` dimension of the correlation-like matrices.\n    batch_shape: `Tensor` or Python `tuple` of `int` shape of the\n      batch to return.\n    dtype: `dtype` of the `Tensor` to return.\n    seed: Random seed.\n\n  Returns:\n    matrices: A `Tensor` of shape `batch_shape + [num_rows, num_rows]`\n      and dtype `dtype`.  Each entry is in [-1, 1], and each matrix\n      along the bottom two dimensions is symmetric and has 1s on the\n      main diagonal.\n  \"\"\"\n  arg_4 = arg_0 * (arg_0 + 1) / 2\n  arg_5 = tf.ones(shape=[arg_4], arg_2=arg_2)\n  # It seems wasteful to generate random values for the diagonal since\n  # I am going to throw them away, but `fill_triangular` fills the\n  # diagonal, so I probably need them.\n  # It's not impossible that it would be more efficient to just fill\n  # the whole matrix with random values instead of messing with\n  # `fill_triangular`.  Then would need to filter almost half out with\n  # `matrix_band_part`.\n  arg_6 = uniform.Uniform(-arg_5, arg_5).sample(arg_1, arg_3=arg_3)\n  arg_7 = util.fill_triangular(arg_6)\n  arg_8 = arg_7 + tf.linalg.matrix_transpose(arg_7)\n  arg_9 = tf.ones(\n      shape=util.pad(arg_1, axis=0, back=True, value=arg_0),\n      arg_2=arg_2)\n  return tf.linalg.set_diag(arg_8, arg_9)", "path": "tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_lib.py", "identifier": "_uniform_correlation_like_matrix", "docstring": "Returns a uniformly random `Tensor` of \"correlation-like\" matrices.\n\n  A \"correlation-like\" matrix is a symmetric square matrix with all entries\n  between -1 and 1 (inclusive) and 1s on the main diagonal.  Of these,\n  the ones that are positive semi-definite are exactly the correlation\n  matrices.\n\n  Args:\n    num_rows: Python `int` dimension of the correlation-like matrices.\n    batch_shape: `Tensor` or Python `tuple` of `int` shape of the\n      batch to return.\n    dtype: `dtype` of the `Tensor` to return.\n    seed: Random seed.\n\n  Returns:\n    matrices: A `Tensor` of shape `batch_shape + [num_rows, num_rows]`\n      and dtype `dtype`.  Each entry is in [-1, 1], and each matrix\n      along the bottom two dimensions is symmetric and has 1s on the\n      main diagonal.", "docstring_tokens": ["Returns", "a", "uniformly", "random", "Tensor", "of", "correlation", "-", "like", "matrices", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259380}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1426-L1436", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Set the issuer of this certificate.", "language": "python", "parameters": "(self, issuer)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_set_name", "(", "_lib", ".", "X509_Func_name", ",", "arg_1", ")", "arg_0", ".", "_issuer_invalidator", ".", "clear", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set the issuer of this certificate.\n\n        :param issuer: The issuer.\n        :type issuer: :py:class:`X509Name`\n\n        :return: ``None``\n        \"\"\"\n        arg_0._set_name(_lib.X509_Func_name, arg_1)\n        arg_0._issuer_invalidator.clear()", "path": "src/OpenSSL/crypto.py", "identifier": "X509.set_issuer", "docstring": "Set the issuer of this certificate.\n\n        :param issuer: The issuer.\n        :type issuer: :py:class:`X509Name`\n\n        :return: ``None``", "docstring_tokens": ["Set", "the", "issuer", "of", "this", "certificate", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 259381}
{"url": "https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/stats.py#L41-L52", "sha": "f546ad171750cd7685afbde6785fe71f82cadb35", "docstring_summary": "Converts list or flattens n-dim array to 1-dim array if possible", "language": "python", "parameters": "(values, as_type=None)", "return_statement": "return values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_0", "=", "np", ".", "array", "(", "arg_0", ",", "dtype", "=", "np", ".", "float32", ")", "elif", "isinstance", "(", "arg_0", ",", "pd", ".", "Series", ")", ":", "arg_0", "=", "arg_0", ".", "values", "arg_0", "=", "arg_0", ".", "flatten", "(", ")", "assert", "arg_0", ".", "ndim", "==", "1", ",", "\"values has wrong dimension\"", "if", "arg_1", "is", "not", "None", ":", "return", "arg_0", ".", "astype", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Converts list or flattens n-dim array to 1-dim array if possible \"\"\"\n\n    if isinstance(arg_0, (list, tuple)):\n        arg_0 = np.array(arg_0, dtype=np.float32)\n    elif isinstance(arg_0, pd.Series):\n        arg_0 = arg_0.values\n    arg_0 = arg_0.flatten()\n    assert arg_0.ndim == 1, \"values has wrong dimension\"\n    if arg_1 is not None:\n        return arg_0.astype(arg_1)\n    return arg_0", "path": "pyprophet/stats.py", "identifier": "to_one_dim_array", "docstring": "Converts list or flattens n-dim array to 1-dim array if possible", "docstring_tokens": ["Converts", "list", "or", "flattens", "n", "-", "dim", "array", "to", "1", "-", "dim", "array", "if", "possible"], "nwo": "PyProphet/pyprophet", "score": 0.38514621847307956, "idx": 259382}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/strings.py#L167-L181", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Returns True if the given string is considered a fnmatch\n    regular expression, False otherwise.\n    It will look for", "language": "python", "parameters": "(string)", "return_statement": "return is_regex", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "False", "arg_2", "=", "[", "'!'", ",", "'*'", ",", "'$'", "]", "for", "arg_3", "in", "arg_2", ":", "if", "arg_0", ".", "find", "(", "arg_3", ")", ">", "-", "1", ":", "return", "True", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns True if the given string is considered a fnmatch\n    regular expression, False otherwise.\n    It will look for\n\n    :param string: str\n\n    \"\"\"\n    arg_1 = False\n    arg_2 = ['!', '*', '$']\n    for arg_3 in arg_2:\n        if arg_0.find(arg_3) > -1:\n            return True\n    return arg_1", "path": "boyle/utils/strings.py", "identifier": "is_fnmatch_regex", "docstring": "Returns True if the given string is considered a fnmatch\n    regular expression, False otherwise.\n    It will look for\n\n    :param string: str", "docstring_tokens": ["Returns", "True", "if", "the", "given", "string", "is", "considered", "a", "fnmatch", "regular", "expression", "False", "otherwise", ".", "It", "will", "look", "for"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259383}
{"url": "https://github.com/hobson/pug/blob/f183e2b29e0b3efa425a9b75cfe001b28a279acc/pug/debug.py#L24-L66", "sha": "f183e2b29e0b3efa425a9b75cfe001b28a279acc", "docstring_summary": "Prints the traceback and invokes the ipython debugger on any exception", "language": "python", "parameters": "(exc_type, exc_value, exc_trace)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "hasattr", "(", "sys", ",", "'ps1'", ")", "or", "not", "sys", ".", "stderr", ".", "isatty", "(", ")", ":", "sys", ".", "__excepthook__", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "else", ":", "import", "ipdb", "traceback", ".", "print_exception", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "print", "ipdb", ".", "post_mortem", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Prints the traceback and invokes the ipython debugger on any exception\n\n    Only invokes ipydb if you are outside ipython or python interactive session.\n    So scripts must be called from OS shell in order for exceptions to ipy-shell-out.\n\n    Dependencies:\n      Needs `pip install ipdb`\n\n    Arguments:\n      exc_type (type): The exception type/class (e.g. RuntimeError)\n      exc_value (Exception): The exception instance (e.g. the error message passed to the Exception constructor)\n      exc_trace (Traceback): The traceback instance\n    \n    References:\n      http://stackoverflow.com/a/242531/623735\n\n    Example Usage:\n      $  python -c 'from pug import debug;x=[];x[0]'\n      Traceback (most recent call last):\n        File \"<string>\", line 1, in <module>\n      IndexError: list index out of range\n\n      > <string>(1)<module>()\n\n      ipdb> x\n      []\n      ipdb> locals()\n      {'__builtins__': <module '__builtin__' (built-in)>, '__package__': None, 'x': [], 'debug': <module 'pug.debug' from 'pug/debug.py'>, '__name__': '__main__', '__doc__': None}\n      ipdb> \n    \"\"\"\n    if hasattr(sys, 'ps1') or not sys.stderr.isatty():\n        # We are in interactive mode or don't have a tty-like device, so we call the default hook\n        sys.__excepthook__(arg_0, arg_1, arg_2)\n    else:\n        # Need to import non-built-ins here, so if dependencies haven't been installed, both tracebacks will print\n        # (e.g. the ImportError and the Exception that got you here)\n        import ipdb\n        # We are NOT in interactive mode, print the exception\n        traceback.print_exception(arg_0, arg_1, arg_2)\n        print\n        # Start the debugger in post-mortem mode.\n        ipdb.post_mortem(arg_2)", "path": "pug/debug.py", "identifier": "bug_info", "docstring": "Prints the traceback and invokes the ipython debugger on any exception\n\n    Only invokes ipydb if you are outside ipython or python interactive session.\n    So scripts must be called from OS shell in order for exceptions to ipy-shell-out.\n\n    Dependencies:\n      Needs `pip install ipdb`\n\n    Arguments:\n      exc_type (type): The exception type/class (e.g. RuntimeError)\n      exc_value (Exception): The exception instance (e.g. the error message passed to the Exception constructor)\n      exc_trace (Traceback): The traceback instance\n    \n    References:\n      http://stackoverflow.com/a/242531/623735\n\n    Example Usage:\n      $  python -c 'from pug import debug;x=[];x[0]'\n      Traceback (most recent call last):\n        File \"<string>\", line 1, in <module>\n      IndexError: list index out of range\n\n      > <string>(1)<module>()\n\n      ipdb> x\n      []\n      ipdb> locals()\n      {'__builtins__': <module '__builtin__' (built-in)>, '__package__': None, 'x': [], 'debug': <module 'pug.debug' from 'pug/debug.py'>, '__name__': '__main__', '__doc__': None}\n      ipdb>", "docstring_tokens": ["Prints", "the", "traceback", "and", "invokes", "the", "ipython", "debugger", "on", "any", "exception"], "nwo": "hobson/pug", "score": 0.24979334806965703, "idx": 259384}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/__init__.py#L19-L34", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "if the module is in this path, load it from the local folder.", "language": "python", "parameters": "(tryPath,moduleName='swhlab')", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'swhlab'", ")", ":", "if", "not", "'site-packages'", "in", "swhlab", ".", "__file__", ":", "print", "(", "\"loaded custom swhlab module from\"", ",", "os", ".", "path", ".", "dirname", "(", "swhlab", ".", "__file__", ")", ")", "return", "while", "len", "(", "arg_0", ")", ">", "5", ":", "arg_2", "=", "arg_0", "+", "\"/swhlab/\"", "if", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", "and", "os", ".", "path", ".", "exists", "(", "arg_2", "+", "\"/__init__.py\"", ")", ":", "if", "not", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "in", "sys", ".", "path", ":", "sys", ".", "path", ".", "insert", "(", "0", ",", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", ")", "print", "(", "\"#\"", "*", "80", ")", "print", "(", "\"# WARNING: using site-packages swhlab module\"", ")", "print", "(", "\"#\"", "*", "80", ")", "arg_0", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "return"], "function": "def Func(arg_0,arg_1='swhlab'):\n    \"\"\"if the module is in this path, load it from the local folder.\"\"\"\n    if not 'site-packages' in swhlab.__file__:\n        print(\"loaded custom swhlab module from\",\n              os.path.dirname(swhlab.__file__))\n        return # no need to warn if it's already outside.\n    while len(arg_0)>5:\n        arg_2=arg_0+\"/swhlab/\" # imaginary swhlab module path\n        if os.path.isdir(arg_2) and os.path.exists(arg_2+\"/__init__.py\"):\n            if not os.path.dirname(arg_0) in sys.path:\n                sys.path.insert(0,os.path.dirname(arg_0))\n            print(\"#\"*80)\n            print(\"# WARNING: using site-packages swhlab module\")\n            print(\"#\"*80)\n        arg_0=os.path.dirname(arg_0)\n    return", "path": "swhlab/__init__.py", "identifier": "tryLoadingFrom", "docstring": "if the module is in this path, load it from the local folder.", "docstring_tokens": ["if", "the", "module", "is", "in", "this", "path", "load", "it", "from", "the", "local", "folder", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 259385}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config_parser.py#L193-L234", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Parse a single statement.", "language": "python", "parameters": "(self)", "return_statement": "return statement", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_skip_whitespace_and_comments", "(", ")", "if", "arg_0", ".", "_current_token", ".", "kind", "==", "tokenize", ".", "ENDMARKER", ":", "return", "None", "arg_1", "=", "arg_0", ".", "_current_location", "(", "ignore_char_num", "=", "True", ")", "arg_2", "=", "arg_0", ".", "_parse_selector", "(", ")", "arg_3", "=", "None", "if", "arg_0", ".", "_current_token", ".", "value", "!=", "'='", ":", "if", "arg_2", "==", "'import'", ":", "arg_4", "=", "arg_0", ".", "_parse_selector", "(", "scoped", "=", "False", ")", "arg_3", "=", "ImportStatement", "(", "arg_4", ",", "arg_1", ")", "elif", "arg_2", "==", "'include'", ":", "arg_5", "=", "arg_0", ".", "_current_location", "(", ")", "arg_6", ",", "arg_7", "=", "arg_0", ".", "_maybe_parse_basic_type", "(", ")", "if", "not", "arg_6", "or", "not", "isinstance", "(", "arg_7", ",", "str", ")", ":", "arg_0", ".", "_raise_syntax_error", "(", "'Expected file path as string.'", ",", "arg_5", ")", "arg_3", "=", "IncludeStatement", "(", "arg_7", ",", "arg_1", ")", "else", ":", "arg_0", ".", "_raise_syntax_error", "(", "\"Expected '='.\"", ")", "else", ":", "arg_0", ".", "_advance_one_token", "(", ")", "arg_8", "=", "arg_0", ".", "parse_value", "(", ")", "arg_9", ",", "arg_10", ",", "arg_11", "=", "parse_binding_key", "(", "arg_2", ")", "arg_3", "=", "BindingStatement", "(", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_8", ",", "arg_1", ")", "assert", "arg_3", ",", "'Internal parsing error.'", "if", "(", "arg_0", ".", "_current_token", ".", "kind", "!=", "tokenize", ".", "NEWLINE", "and", "arg_0", ".", "_current_token", ".", "kind", "!=", "tokenize", ".", "ENDMARKER", ")", ":", "arg_0", ".", "_raise_syntax_error", "(", "'Expected newline.'", ")", "elif", "arg_0", ".", "_current_token", ".", "kind", "==", "tokenize", ".", "NEWLINE", ":", "arg_0", ".", "_advance_one_token", "(", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Parse a single statement.\n\n    Returns:\n      Either a `BindingStatement`, `ImportStatement`, `IncludeStatement`, or\n      `None` if no more statements can be parsed (EOF reached).\n    \"\"\"\n    arg_0._skip_whitespace_and_comments()\n    if arg_0._current_token.kind == tokenize.ENDMARKER:\n      return None\n\n    # Save off location, but ignore char_num for any statement-level errors.\n    arg_1 = arg_0._current_location(ignore_char_num=True)\n    arg_2 = arg_0._parse_selector()\n    arg_3 = None\n    if arg_0._current_token.value != '=':\n      if arg_2 == 'import':\n        arg_4 = arg_0._parse_selector(scoped=False)\n        arg_3 = ImportStatement(arg_4, arg_1)\n      elif arg_2 == 'include':\n        arg_5 = arg_0._current_location()\n        arg_6, arg_7 = arg_0._maybe_parse_basic_type()\n        if not arg_6 or not isinstance(arg_7, str):\n          arg_0._raise_syntax_error('Expected file path as string.', arg_5)\n        arg_3 = IncludeStatement(arg_7, arg_1)\n      else:\n        arg_0._raise_syntax_error(\"Expected '='.\")\n    else:  # We saw an '='.\n      arg_0._advance_one_token()\n      arg_8 = arg_0.parse_value()\n      arg_9, arg_10, arg_11 = parse_binding_key(arg_2)\n      arg_3 = BindingStatement(arg_9, arg_10, arg_11, arg_8, arg_1)\n\n    assert arg_3, 'Internal parsing error.'\n\n    if (arg_0._current_token.kind != tokenize.NEWLINE and\n        arg_0._current_token.kind != tokenize.ENDMARKER):\n      arg_0._raise_syntax_error('Expected newline.')\n    elif arg_0._current_token.kind == tokenize.NEWLINE:\n      arg_0._advance_one_token()\n\n    return arg_3", "path": "gin/config_parser.py", "identifier": "ConfigParser.parse_statement", "docstring": "Parse a single statement.\n\n    Returns:\n      Either a `BindingStatement`, `ImportStatement`, `IncludeStatement`, or\n      `None` if no more statements can be parsed (EOF reached).", "docstring_tokens": ["Parse", "a", "single", "statement", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 259386}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Dumper/file.py#L102-L107", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Dump the content to a `file`.", "language": "python", "parameters": "(self, file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "__text_is_expected", ":", "arg_1", "=", "BytesWrapper", "(", "arg_1", ",", "arg_0", ".", "__encoding", ")", "arg_0", ".", "__dump_toFunc", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Dump the content to a `file`.\n        \"\"\"\n        if not arg_0.__text_is_expected:\n            arg_1 = BytesWrapper(arg_1, arg_0.__encoding)\n        arg_0.__dump_toFunc(arg_1)", "path": "knittingpattern/Dumper/file.py", "identifier": "ContentDumper._file", "docstring": "Dump the content to a `file`.", "docstring_tokens": ["Dump", "the", "content", "to", "a", "file", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 259387}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L754-L766", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return True if file matches exclude pattern.", "language": "python", "parameters": "(filename, exclude)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "basename", "(", "arg_0", ")", "if", "arg_2", ".", "startswith", "(", "'.'", ")", ":", "return", "True", "for", "arg_3", "in", "arg_1", ":", "if", "fnmatch", ".", "fnmatch", "(", "arg_2", ",", "arg_3", ")", ":", "return", "True", "if", "fnmatch", ".", "fnmatch", "(", "arg_0", ",", "arg_3", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return True if file matches exclude pattern.\"\"\"\n    arg_2 = os.path.basename(arg_0)\n\n    if arg_2.startswith('.'):\n        return True\n\n    for arg_3 in arg_1:\n        if fnmatch.fnmatch(arg_2, arg_3):\n            return True\n        if fnmatch.fnmatch(arg_0, arg_3):\n            return True\n    return False", "path": "autoflake.py", "identifier": "is_exclude_file", "docstring": "Return True if file matches exclude pattern.", "docstring_tokens": ["Return", "True", "if", "file", "matches", "exclude", "pattern", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 259388}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1097-L1109", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Click the left mouse button without modifiers pressed.", "language": "python", "parameters": "(self, coord, interval=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "0", "arg_0", ".", "_queueMouseButton", "(", "arg_1", ",", "Quartz", ".", "kCGMouseButtonLeft", ",", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "_postQueuedEvents", "(", "arg_2", "=", "arg_2", ")", "else", ":", "arg_0", ".", "_postQueuedEvents", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Click the left mouse button without modifiers pressed.\n\n        Parameters: coordinates to click on screen (tuple (x, y))\n        Returns: None\n        \"\"\"\n\n        arg_3 = 0\n        arg_0._queueMouseButton(arg_1, Quartz.kCGMouseButtonLeft, arg_3)\n        if arg_2:\n            arg_0._postQueuedEvents(arg_2=arg_2)\n        else:\n            arg_0._postQueuedEvents()", "path": "atomac/AXClasses.py", "identifier": "NativeUIElement.clickMouseButtonLeft", "docstring": "Click the left mouse button without modifiers pressed.\n\n        Parameters: coordinates to click on screen (tuple (x, y))\n        Returns: None", "docstring_tokens": ["Click", "the", "left", "mouse", "button", "without", "modifiers", "pressed", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 259389}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L1156-L1167", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Resets builder's state for building new documents.\n        Must be called between usage with different documents.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "Func_creation_info", "(", ")", "arg_0", ".", "Func_document", "(", ")", "arg_0", ".", "Func_package", "(", ")", "arg_0", ".", "Func_file_stat", "(", ")", "arg_0", ".", "Func_reviews", "(", ")", "arg_0", ".", "Func_annotations", "(", ")", "arg_0", ".", "Func_extr_lics", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Resets builder's state for building new documents.\n        Must be called between usage with different documents.\n        \"\"\"\n        # FIXME: this state does not make sense\n        arg_0.Func_creation_info()\n        arg_0.Func_document()\n        arg_0.Func_package()\n        arg_0.Func_file_stat()\n        arg_0.Func_reviews()\n        arg_0.Func_annotations()\n        arg_0.Func_extr_lics()", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "Builder.reset", "docstring": "Resets builder's state for building new documents.\n        Must be called between usage with different documents.", "docstring_tokens": ["Resets", "builder", "s", "state", "for", "building", "new", "documents", ".", "Must", "be", "called", "between", "usage", "with", "different", "documents", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 259390}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/utils/files.py#L47-L58", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Create a tar file based on the list of files passed", "language": "python", "parameters": "(files, project_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "tempfile", ".", "mkstemp", "(", "prefix", "=", "\"polyaxon_{}\"", ".", "format", "(", "arg_1", ")", ",", "suffix", "=", "'.tar.gz'", ")", "with", "tarfile", ".", "open", "(", "arg_3", ",", "\"w:gz\"", ")", "as", "tar", ":", "for", "arg_4", "in", "arg_0", ":", "tar", ".", "add", "(", "arg_4", ")", "yield", "arg_3", "os", ".", "close", "(", "arg_2", ")", "os", ".", "remove", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Create a tar file based on the list of files passed\"\"\"\n    arg_2, arg_3 = tempfile.mkstemp(prefix=\"polyaxon_{}\".format(arg_1), suffix='.tar.gz')\n    with tarfile.open(arg_3, \"w:gz\") as tar:\n        for arg_4 in arg_0:\n            tar.add(arg_4)\n\n    yield arg_3\n\n    # clear\n    os.close(arg_2)\n    os.remove(arg_3)", "path": "polyaxon_cli/utils/files.py", "identifier": "create_tarfile", "docstring": "Create a tar file based on the list of files passed", "docstring_tokens": ["Create", "a", "tar", "file", "based", "on", "the", "list", "of", "files", "passed"], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 259391}
{"url": "https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L22-L25", "sha": "55246961d805b1f64d661a5c0bae0a216589401f", "docstring_summary": "Schedule a retry", "language": "python", "parameters": "(self, config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "raise", "arg_0", ".", "retry", "(", "countdown", "=", "arg_1", ".", "get", "(", "'SAILTHRU_RETRY_SECONDS'", ")", ",", "max_retries", "=", "arg_1", ".", "get", "(", "'SAILTHRU_RETRY_ATTEMPTS'", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Schedule a retry\"\"\"\n    raise arg_0.retry(countdown=arg_1.get('SAILTHRU_RETRY_SECONDS'),\n                     max_retries=arg_1.get('SAILTHRU_RETRY_ATTEMPTS'))", "path": "ecommerce_worker/sailthru/v1/tasks.py", "identifier": "schedule_retry", "docstring": "Schedule a retry", "docstring_tokens": ["Schedule", "a", "retry"], "nwo": "edx/ecommerce-worker", "score": 0.3907502498574038, "idx": 259392}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L75-L86", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform a QuantumChannel to the Chi representation.", "language": "python", "parameters": "(rep, data, input_dim, output_dim)", "return_statement": "return _choi_to_chi(data, input_dim, output_dim)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", "==", "'Chi'", ":", "return", "arg_1", "_check_nqubit_dim", "(", "arg_2", ",", "arg_3", ")", "if", "arg_0", "==", "'Operator'", ":", "return", "_from_operator", "(", "'Chi'", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "if", "arg_0", "!=", "'Choi'", ":", "arg_1", "=", "_to_choi", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "return", "_choiFunc", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Transform a QuantumChannel to the Chi representation.\"\"\"\n    if arg_0 == 'Chi':\n        return arg_1\n    # Check valid n-qubit input\n    _check_nqubit_dim(arg_2, arg_3)\n    if arg_0 == 'Operator':\n        return _from_operator('Chi', arg_1, arg_2, arg_3)\n    # Convert via Choi representation\n    if arg_0 != 'Choi':\n        arg_1 = _to_choi(arg_0, arg_1, arg_2, arg_3)\n    return _choiFunc(arg_1, arg_2, arg_3)", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_to_chi", "docstring": "Transform a QuantumChannel to the Chi representation.", "docstring_tokens": ["Transform", "a", "QuantumChannel", "to", "the", "Chi", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259393}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L226-L230", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Removes a player from the current players.", "language": "python", "parameters": "(self, guild_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_players", ":", "arg_0", ".", "_players", "[", "arg_1", "]", ".", "cleanup", "(", ")", "del", "arg_0", ".", "_players", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\" Removes a player from the current players. \"\"\"\r\n        if arg_1 in arg_0._players:\r\n            arg_0._players[arg_1].cleanup()\r\n            del arg_0._players[arg_1]", "path": "lavalink/PlayerManager.py", "identifier": "PlayerManager.remove", "docstring": "Removes a player from the current players.", "docstring_tokens": ["Removes", "a", "player", "from", "the", "current", "players", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 259394}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/url.py#L92-L134", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Perform a lookup in _ENGINE_MAPPING using engine_string.", "language": "python", "parameters": "(scheme)", "return_statement": "return engine", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "split", "(", "\"+\"", ")", "arg_2", ",", "arg_3", "=", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", ":", "]", "arg_4", "=", "arg_3", "[", "0", "]", "if", "arg_3", "else", "None", "arg_5", "=", "resolve", "(", "ENGINE_MAPPING", ",", "arg_2", ")", "if", "not", "isinstance", "(", "arg_5", ",", "list", ")", ":", "if", "arg_4", ":", "raise", "KeyError", "(", "\"%s has no sub-engines\"", "%", "arg_2", ")", "return", "arg_5", "try", ":", "arg_5", ",", "arg_6", "=", "arg_5", "except", "ValueError", ":", "raise", "ValueError", "(", "\"django-bananas.url' engine \"", "\"configuration is invalid: %r\"", "%", "ENGINE_MAPPING", ")", "if", "arg_4", "is", "not", "None", ":", "arg_5", "=", "resolve", "(", "arg_6", ",", "arg_4", ")", "assert", "not", "isinstance", "(", "arg_5", ",", "(", "list", ",", "dict", ")", ")", ",", "\"Only two levels of engines \"", "\"are allowed\"", "assert", "arg_5", ",", "\"The returned engine is not truthy\"", "return", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"\n    Perform a lookup in _ENGINE_MAPPING using engine_string.\n\n    :param scheme: '+'-separated string Maximum of 2 parts,\n    i.e \"postgres+psycopg\" is OK, \"postgres+psycopg2+postgis\" is NOT OK.\n    :return: Engine string\n    \"\"\"\n    arg_1 = arg_0.split(\"+\")\n    arg_2, arg_3 = arg_1[0], arg_1[1:]\n\n    arg_4 = arg_3[0] if arg_3 else None\n\n    arg_5 = resolve(ENGINE_MAPPING, arg_2)\n\n    # If the selected engine does not have a second level.\n    if not isinstance(arg_5, list):\n        # If second level engine was expected\n        if arg_4:\n            raise KeyError(\"%s has no sub-engines\" % arg_2)\n\n        return arg_5\n\n    try:\n        arg_5, arg_6 = arg_5\n    except ValueError:\n        # engine was not a list of length 2\n        raise ValueError(\n            \"django-bananas.url' engine \"\n            \"configuration is invalid: %r\" % ENGINE_MAPPING\n        )\n\n    # Get second-level engine\n    if arg_4 is not None:\n        arg_5 = resolve(arg_6, arg_4)\n\n    # Sanity-check the value before returning\n    assert not isinstance(\n        arg_5, (list, dict)\n    ), \"Only two levels of engines \" \"are allowed\"\n    assert arg_5, \"The returned engine is not truthy\"\n\n    return arg_5", "path": "bananas/url.py", "identifier": "get_engine", "docstring": "Perform a lookup in _ENGINE_MAPPING using engine_string.\n\n    :param scheme: '+'-separated string Maximum of 2 parts,\n    i.e \"postgres+psycopg\" is OK, \"postgres+psycopg2+postgis\" is NOT OK.\n    :return: Engine string", "docstring_tokens": ["Perform", "a", "lookup", "in", "_ENGINE_MAPPING", "using", "engine_string", "."], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 259395}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1207-L1238", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Get file relative path given the file name. If file name is redundant in different\n        directories in the repository, this method ensures to return all or some of the\n        files according to skip value.", "language": "python", "parameters": "(self, name, skip=0)", "return_statement": "return paths", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ")", ":", "if", "arg_2", "is", "None", ":", "arg_3", "=", "[", "]", "else", ":", "arg_3", "=", "None", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "walk_files_info", "(", ")", ":", "arg_6", ",", "arg_7", "=", "os", ".", "path", ".", "split", "(", "arg_4", ")", "if", "arg_7", "==", "arg_1", ":", "if", "arg_2", "is", "None", ":", "arg_3", ".", "append", "(", "arg_4", ")", "elif", "arg_2", ">", "0", ":", "arg_2", "-=", "1", "else", ":", "arg_3", "=", "arg_4", "break", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=0):\n        \"\"\"\n        Get file relative path given the file name. If file name is redundant in different\n        directories in the repository, this method ensures to return all or some of the\n        files according to skip value.\n\n        Parameters:\n            #. name (string): The file name.\n            #. skip (None, integer): As file names can be identical, skip determines\n               the number of satisfying files name to skip before returning.\\n\n               If None is given, a list of all files relative path will be returned.\n\n        :Returns:\n            #. relativePath (string, list): The file relative path.\n               If None, it means file was not found.\\n\n               If skip is None a list of all found files relative paths will be returned.\n        \"\"\"\n        if arg_2 is None:\n            arg_3 = []\n        else:\n            arg_3 = None\n        for arg_4, arg_5 in arg_0.walk_files_info():\n            arg_6, arg_7 = os.path.split(arg_4)\n            if arg_7==arg_1:\n                if arg_2 is None:\n                    arg_3.append(arg_4)\n                elif arg_2>0:\n                    arg_2 -= 1\n                else:\n                    arg_3 = arg_4\n                    break\n        return arg_3", "path": "OldRepository.py", "identifier": "Repository.get_file_relative_path_by_name", "docstring": "Get file relative path given the file name. If file name is redundant in different\n        directories in the repository, this method ensures to return all or some of the\n        files according to skip value.\n\n        Parameters:\n            #. name (string): The file name.\n            #. skip (None, integer): As file names can be identical, skip determines\n               the number of satisfying files name to skip before returning.\\n\n               If None is given, a list of all files relative path will be returned.\n\n        :Returns:\n            #. relativePath (string, list): The file relative path.\n               If None, it means file was not found.\\n\n               If skip is None a list of all found files relative paths will be returned.", "docstring_tokens": ["Get", "file", "relative", "path", "given", "the", "file", "name", ".", "If", "file", "name", "is", "redundant", "in", "different", "directories", "in", "the", "repository", "this", "method", "ensures", "to", "return", "all", "or", "some", "of", "the", "files", "according", "to", "skip", "value", "."], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 259396}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L91-L100", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Properly formats array types", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return req_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_4", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_3", "=", "arg_3", "+", "'[]'", "arg_2", "[", "arg_3", "]", "=", "arg_4", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Properly formats array types\n        \"\"\"\n        arg_2 = {}\n        for arg_3, arg_4 in arg_1.items():\n            if isinstance(arg_4, (list, tuple)):\n                arg_3 = arg_3 + '[]'\n            arg_2[arg_3] = arg_4\n        return arg_2", "path": "poseidon/api.py", "identifier": "RestAPI.format_parameters", "docstring": "Properly formats array types", "docstring_tokens": ["Properly", "formats", "array", "types"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 259397}
{"url": "https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/support.py#L563-L582", "sha": "532f561f32b91ea8debea0573c503dd20988bf40", "docstring_summary": "Extract metadata JDBC Virtual Tables from an xml node", "language": "python", "parameters": "(key, node)", "return_statement": "return JDBCVirtualTable(name, sql, escapeSql, geometry, keyColumn, parameters)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "find", "(", "\"name\"", ")", "arg_3", "=", "arg_1", ".", "find", "(", "\"sql\"", ")", "arg_4", "=", "arg_1", ".", "find", "(", "\"escapeSql\"", ")", "arg_4", "=", "arg_4", ".", "text", "if", "arg_4", "is", "not", "None", "else", "None", "arg_5", "=", "arg_1", ".", "find", "(", "\"keyColumn\"", ")", "arg_5", "=", "arg_5", ".", "text", "if", "arg_5", "is", "not", "None", "else", "None", "arg_6", "=", "arg_1", ".", "find", "(", "\"geometry\"", ")", "arg_7", "=", "JDBCVirtualTableGeometry", "(", "arg_6", ".", "find", "(", "\"name\"", ")", ",", "arg_6", ".", "find", "(", "\"type\"", ")", ",", "arg_6", ".", "find", "(", "\"srid\"", ")", ")", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_1", ".", "findall", "(", "\"parameter\"", ")", ":", "arg_10", "=", "arg_9", ".", "find", "(", "\"name\"", ")", "arg_11", "=", "arg_9", ".", "find", "(", "\"defaultValue\"", ")", "arg_11", "=", "arg_11", ".", "text", "if", "arg_11", "is", "not", "None", "else", "None", "arg_12", "=", "arg_9", ".", "find", "(", "\"regexpValidator\"", ")", "arg_12", "=", "arg_12", ".", "text", "if", "arg_12", "is", "not", "None", "else", "None", "arg_8", ".", "append", "(", "JDBCVirtualTableParam", "(", "arg_10", ",", "arg_11", ",", "arg_12", ")", ")", "return", "JDBCVirtualTable", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_7", ",", "arg_5", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Extract metadata JDBC Virtual Tables from an xml node\"\"\"\n    arg_2 = arg_1.find(\"name\")\n    arg_3 = arg_1.find(\"sql\")\n    arg_4 = arg_1.find(\"escapeSql\")\n    arg_4 = arg_4.text if arg_4 is not None else None\n    arg_5 = arg_1.find(\"keyColumn\")\n    arg_5 = arg_5.text if arg_5 is not None else None\n    arg_6 = arg_1.find(\"geometry\")\n    arg_7 = JDBCVirtualTableGeometry(arg_6.find(\"name\"), arg_6.find(\"type\"), arg_6.find(\"srid\"))\n    arg_8 = []\n    for arg_9 in arg_1.findall(\"parameter\"):\n        arg_10 = arg_9.find(\"name\")\n        arg_11 = arg_9.find(\"defaultValue\")\n        arg_11 = arg_11.text if arg_11 is not None else None\n        arg_12 = arg_9.find(\"regexpValidator\")\n        arg_12 = arg_12.text if arg_12 is not None else None\n        arg_8.append(JDBCVirtualTableParam(arg_10, arg_11, arg_12))\n\n    return JDBCVirtualTable(arg_2, arg_3, arg_4, arg_7, arg_5, arg_8)", "path": "src/geoserver/support.py", "identifier": "md_jdbc_virtual_table", "docstring": "Extract metadata JDBC Virtual Tables from an xml node", "docstring_tokens": ["Extract", "metadata", "JDBC", "Virtual", "Tables", "from", "an", "xml", "node"], "nwo": "boundlessgeo/gsconfig", "score": 0.7627023200281134, "idx": 259398}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L402-L453", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Update a hook", "language": "python", "parameters": "(self, hook)", "return_statement": "return self._post(\n            request=ApiActions.UPDATE.value,\n            uri=ApiUri.HOOKS.value,\n            params=data\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'id'", ":", "arg_1", "[", "'id'", "]", ",", "'name'", ":", "arg_1", "[", "'name'", "]", ",", "'triggers'", ":", "arg_1", "[", "'triggers'", "]", ",", "'sources'", ":", "arg_1", "[", "'sources'", "]", ",", "'groups'", ":", "arg_1", "[", "'groups'", "]", ",", "'actions'", ":", "arg_1", "[", "'actions'", "]", ",", "}", "return", "arg_0", ".", "_post", "(", "request", "=", "ApiActions", ".", "UPDATE", ".", "value", ",", "uri", "=", "ApiUri", ".", "HOOKS", ".", "value", ",", "params", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Update a hook\n\n        :param hook: The data to Func. Must include keys:\n\n            * id (str)\n            * name (str)\n            * triggers (list of str)\n            * sources (list of str)\n            * groups (list of str)\n            * actions (list of str)\n        :type hook: dict\n\n        Example:\n\n        .. code-block:: python\n\n            Hooks().Func(\n                hook={\n                    'id': 'd9d4596e-49e4-4135-b3b3-847f9e7c1f43',\n                    'name': 'My Sandbox',\n                    'triggers': [\n                        'host = you.example.com'\n                    ],\n                    'sources': [\n                        '4d42c719-4005-4929-aa4a-994da4b95040'\n                    ],\n                    'groups': [],\n                    'actions': [\n                        '9f6adf69-37b9-4a4b-88fb-c3fc4c781a11',\n                        'ddc36d71-33cb-4f4f-be1b-8591814b1946'\n                    ],\n                }\n            )\n\n        :return:\n        :rtype: dict\n        \"\"\"\n        arg_2 = {\n            'id': arg_1['id'],\n            'name': arg_1['name'],\n            'triggers': arg_1['triggers'],\n            'sources': arg_1['sources'],\n            'groups': arg_1['groups'],\n            'actions': arg_1['actions'],\n        }\n        return arg_0._post(\n            request=ApiActions.UPDATE.value,\n            uri=ApiUri.HOOKS.value,\n            params=arg_2\n        )", "path": "logentries_api/resources.py", "identifier": "Hooks.update", "docstring": "Update a hook\n\n        :param hook: The data to update. Must include keys:\n\n            * id (str)\n            * name (str)\n            * triggers (list of str)\n            * sources (list of str)\n            * groups (list of str)\n            * actions (list of str)\n        :type hook: dict\n\n        Example:\n\n        .. code-block:: python\n\n            Hooks().update(\n                hook={\n                    'id': 'd9d4596e-49e4-4135-b3b3-847f9e7c1f43',\n                    'name': 'My Sandbox',\n                    'triggers': [\n                        'host = you.example.com'\n                    ],\n                    'sources': [\n                        '4d42c719-4005-4929-aa4a-994da4b95040'\n                    ],\n                    'groups': [],\n                    'actions': [\n                        '9f6adf69-37b9-4a4b-88fb-c3fc4c781a11',\n                        'ddc36d71-33cb-4f4f-be1b-8591814b1946'\n                    ],\n                }\n            )\n\n        :return:\n        :rtype: dict", "docstring_tokens": ["Update", "a", "hook"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 259399}
{"url": "https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/base.py#L109-L120", "sha": "a583fe0dbffa8b24e5a3e151524f84868b2382bb", "docstring_summary": "Decorator used to tag a method that should be used as a hook for the\n  specified `name` hook type.", "language": "python", "parameters": "(name)", "return_statement": "return hookTarget", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "FuncTarget", "(", "arg_1", ")", ":", "if", "not", "hasattr", "(", "arg_1", ",", "'__Func__'", ")", ":", "arg_1", ".", "__Func__", "=", "[", "arg_0", "]", "else", ":", "arg_1", ".", "__Func__", ".", "append", "(", "arg_0", ")", "return", "arg_1", "return", "FuncTarget"], "function": "def Func(arg_0):\n  '''\n  Decorator used to tag a method that should be used as a Func for the\n  specified `name` Func type.\n  '''\n  def FuncTarget(arg_1):\n    if not hasattr(arg_1, '__Func__'):\n      arg_1.__Func__ = [arg_0]\n    else:\n      arg_1.__Func__.append(arg_0)\n    return arg_1\n  return FuncTarget", "path": "pysyncml/cli/base.py", "identifier": "hook", "docstring": "Decorator used to tag a method that should be used as a hook for the\n  specified `name` hook type.", "docstring_tokens": ["Decorator", "used", "to", "tag", "a", "method", "that", "should", "be", "used", "as", "a", "hook", "for", "the", "specified", "name", "hook", "type", "."], "nwo": "metagriffin/pysyncml", "score": 0.15726537023232431, "idx": 259400}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/account.py#L489-L509", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Clears all of the items within a list. This is an irreversible action\n        and should be treated with caution.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'clear'", ")", "arg_1", ".", "update", "(", "{", "'session_id'", ":", "arg_0", ".", "session_id", "}", ")", "arg_3", "=", "{", "}", "arg_4", "=", "arg_0", ".", "_POST", "(", "arg_2", ",", "arg_1", ",", "arg_3", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Clears all of the items within a list. This is an irreversible action\n        and should be treated with caution.\n\n        A valid session id is required.\n\n        Args:\n            confirm: True (do it) | False (don't do it)\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('clear')\n        arg_1.update({'session_id': arg_0.session_id})\n\n        arg_3 = {}\n\n        arg_4 = arg_0._POST(arg_2, arg_1, arg_3)\n        arg_0._set_attrs_to_values(arg_4)\n        return arg_4", "path": "tmdbsimple/account.py", "identifier": "Lists.clear_list", "docstring": "Clears all of the items within a list. This is an irreversible action\n        and should be treated with caution.\n\n        A valid session id is required.\n\n        Args:\n            confirm: True (do it) | False (don't do it)\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Clears", "all", "of", "the", "items", "within", "a", "list", ".", "This", "is", "an", "irreversible", "action", "and", "should", "be", "treated", "with", "caution", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 259401}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2122-L2141", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Return the revocations in this certificate revocation list.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "_lib", ".", "X509_CRL_get_REVOKED", "(", "arg_0", ".", "_crl", ")", "for", "arg_3", "in", "range", "(", "_lib", ".", "sk_X509_REVOKED_num", "(", "arg_2", ")", ")", ":", "arg_4", "=", "_lib", ".", "sk_X509_REVOKED_value", "(", "arg_2", ",", "arg_3", ")", "arg_5", "=", "_lib", ".", "Cryptography_X509_REVOKED_dup", "(", "arg_4", ")", "arg_6", "=", "Revoked", ".", "__new__", "(", "Revoked", ")", "arg_6", ".", "_revoked", "=", "_ffi", ".", "gc", "(", "arg_5", ",", "_lib", ".", "X509_REVOKED_free", ")", "arg_1", ".", "append", "(", "arg_6", ")", "if", "arg_1", ":", "return", "tuple", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the revocations in this certificate revocation list.\n\n        These revocations will be provided by value, not by reference.\n        That means it's okay to mutate them: it won't affect this CRL.\n\n        :return: The revocations in this CRL.\n        :rtype: :class:`tuple` of :class:`Revocation`\n        \"\"\"\n        arg_1 = []\n        arg_2 = _lib.X509_CRL_get_REVOKED(arg_0._crl)\n        for arg_3 in range(_lib.sk_X509_REVOKED_num(arg_2)):\n            arg_4 = _lib.sk_X509_REVOKED_value(arg_2, arg_3)\n            arg_5 = _lib.Cryptography_X509_REVOKED_dup(arg_4)\n            arg_6 = Revoked.__new__(Revoked)\n            arg_6._revoked = _ffi.gc(arg_5, _lib.X509_REVOKED_free)\n            arg_1.append(arg_6)\n        if arg_1:\n            return tuple(arg_1)", "path": "src/OpenSSL/crypto.py", "identifier": "CRL.get_revoked", "docstring": "Return the revocations in this certificate revocation list.\n\n        These revocations will be provided by value, not by reference.\n        That means it's okay to mutate them: it won't affect this CRL.\n\n        :return: The revocations in this CRL.\n        :rtype: :class:`tuple` of :class:`Revocation`", "docstring_tokens": ["Return", "the", "revocations", "in", "this", "certificate", "revocation", "list", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 259402}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L171-L175", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Keep only fields listed in field_list.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "record", ".", "keys", "(", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "fields_list", ":", "record_delete_fields", "(", "arg_0", ".", "record", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Keep only fields listed in field_list.\"\"\"\n        for arg_1 in arg_0.record.keys():\n            if arg_1 not in arg_0.fields_list:\n                record_delete_fields(arg_0.record, arg_1)", "path": "harvestingkit/inspire_cds_package/base.py", "identifier": "MARCXMLConversion.keep_only_fields", "docstring": "Keep only fields listed in field_list.", "docstring_tokens": ["Keep", "only", "fields", "listed", "in", "field_list", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259403}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L861-L877", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Check if the requested reshape can be broken into independant reshapes\n        on the keys and values. If it can, returns the index in the new shape\n        separating keys from values, otherwise returns -1", "language": "python", "parameters": "(self, shape)", "return_statement": "return -1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tupleize", "(", "arg_1", ")", "arg_3", "=", "prod", "(", "arg_0", ".", "keys", ".", "shape", ")", "arg_4", "=", "prod", "(", "arg_0", ".", "values", ".", "shape", ")", "for", "arg_5", "in", "range", "(", "len", "(", "arg_2", ")", ")", ":", "arg_6", "=", "prod", "(", "arg_2", "[", ":", "arg_5", "]", ")", "arg_7", "=", "prod", "(", "arg_2", "[", "arg_5", ":", "]", ")", "if", "arg_6", "==", "arg_3", "and", "arg_7", "==", "arg_4", ":", "return", "arg_5", "return", "-", "1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Check if the requested reshape can be broken into independant reshapes\n        on the keys and values. If it can, returns the index in the new shape\n        separating keys from values, otherwise returns -1\n        \"\"\"\n        arg_2 = tupleize(arg_1)\n        arg_3 = prod(arg_0.keys.shape)\n        arg_4 = prod(arg_0.values.shape)\n\n        for arg_5 in range(len(arg_2)):\n            arg_6 = prod(arg_2[:arg_5])\n            arg_7 = prod(arg_2[arg_5:])\n            if arg_6 == arg_3 and arg_7 == arg_4:\n                return arg_5\n\n        return -1", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark._reshapebasic", "docstring": "Check if the requested reshape can be broken into independant reshapes\n        on the keys and values. If it can, returns the index in the new shape\n        separating keys from values, otherwise returns -1", "docstring_tokens": ["Check", "if", "the", "requested", "reshape", "can", "be", "broken", "into", "independant", "reshapes", "on", "the", "keys", "and", "values", ".", "If", "it", "can", "returns", "the", "index", "in", "the", "new", "shape", "separating", "keys", "from", "values", "otherwise", "returns", "-", "1"], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 259404}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/rtlLevel/optimalizator.py#L67-L76", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "check if process is just unconditional assignments\n       and it is useless to merge them", "language": "python", "parameters": "(proc)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", ",", "=", "arg_0", ".", "statements", "if", "isinstance", "(", "arg_1", ",", "Assignment", ")", ":", "return", "True", "except", "ValueError", ":", "pass", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"check if process is just unconditional assignments\n       and it is useless to merge them\"\"\"\n    try:\n        arg_1, = arg_0.statements\n        if isinstance(arg_1, Assignment):\n            return True\n    except ValueError:\n        pass\n    return False", "path": "hwt/synthesizer/rtlLevel/optimalizator.py", "identifier": "checkIfIsTooSimple", "docstring": "check if process is just unconditional assignments\n       and it is useless to merge them", "docstring_tokens": ["check", "if", "process", "is", "just", "unconditional", "assignments", "and", "it", "is", "useless", "to", "merge", "them"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 259405}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/csp.py#L223-L225", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Maintain arc consistency.", "language": "python", "parameters": "(csp, var, value, assignment, removals)", "return_statement": "return AC3(csp, [(X, var) for X in csp.neighbors[var]], removals)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "return", "AC3", "(", "arg_0", ",", "[", "(", "arg_5", ",", "arg_1", ")", "for", "arg_5", "in", "arg_0", ".", "neighbors", "[", "arg_1", "]", "]", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"Maintain arc consistency.\"\n    return AC3(arg_0, [(arg_5, arg_1) for arg_5 in arg_0.neighbors[arg_1]], arg_4)", "path": "aima/csp.py", "identifier": "mac", "docstring": "Maintain arc consistency.", "docstring_tokens": ["Maintain", "arc", "consistency", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 259406}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L166-L175", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Executes a raw SQL statement on the database.", "language": "python", "parameters": "(self, sql)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_0", ".", "_cur", ".", "execute", "(", "Func", ")", "if", "Func", ".", "lower", "(", ")", ".", "find", "(", "\"select\"", ")", ">=", "0", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "_cur", ":", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, Func):\n        \n        \"\"\" Executes a raw SQL statement on the database.\n        \"\"\"\n        \n        arg_0._cur.execute(Func)\n        if Func.lower().find(\"select\") >= 0:\n            arg_2 = []\n            for arg_3 in arg_0._cur: arg_2.append(arg_3)\n            return arg_2", "path": "lib/database/__init__.py", "identifier": "Database.sql", "docstring": "Executes a raw SQL statement on the database.", "docstring_tokens": ["Executes", "a", "raw", "SQL", "statement", "on", "the", "database", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259407}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/stream.py#L156-L169", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Usefull string to compute error message.", "language": "python", "parameters": "(self)", "return_statement": "return last_line", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "str", ":", "arg_1", "=", "arg_0", ".", "_cursor", ".", "max_readed_position", "arg_2", "=", "arg_1", ".", "index", "arg_3", "=", "arg_2", "-", "1", "if", "arg_2", "==", "arg_0", ".", "eos_index", "else", "arg_2", "while", "arg_3", ">=", "0", "and", "arg_0", ".", "_content", "[", "arg_3", "]", "!=", "'\\n'", ":", "arg_3", "-=", "1", "arg_4", "=", "arg_2", "while", "arg_4", "<", "arg_0", ".", "eos_index", "and", "arg_0", ".", "_content", "[", "arg_4", "]", "!=", "'\\n'", ":", "arg_4", "+=", "1", "arg_5", "=", "arg_0", ".", "_content", "[", "arg_3", "+", "1", ":", "arg_4", "]", "return", "arg_5"], "function": "def Func(arg_0) -> str:\n        \"\"\"Usefull string to compute error message.\"\"\"\n        arg_1 = arg_0._cursor.max_readed_position\n        arg_2 = arg_1.index\n        # search last \\n\n        arg_3 = arg_2 - 1 if arg_2 == arg_0.eos_index else arg_2\n        while arg_3 >= 0 and arg_0._content[arg_3] != '\\n':\n            arg_3 -= 1\n        # search next \\n\n        arg_4 = arg_2\n        while arg_4 < arg_0.eos_index and arg_0._content[arg_4] != '\\n':\n            arg_4 += 1\n        arg_5 = arg_0._content[arg_3 + 1:arg_4]\n        return arg_5", "path": "pyrser/parsing/stream.py", "identifier": "Stream.last_readed_line", "docstring": "Usefull string to compute error message.", "docstring_tokens": ["Usefull", "string", "to", "compute", "error", "message", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 259408}
{"url": "https://github.com/napalm-automation/napalm-yang/blob/998e8a933171d010b8544bcc5dc448e2b68051e2/napalm_yang/base.py#L211-L247", "sha": "998e8a933171d010b8544bcc5dc448e2b68051e2", "docstring_summary": "Parse native configuration and load it into the corresponding models. Only models\n        that have been added to the root object will be parsed.", "language": "python", "parameters": "(self, device=None, profile=None, native=None, attrs=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "elements", "(", ")", ".", "values", "(", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "Parser", "(", "arg_5", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "is_config", "=", "True", ")", "arg_6", ".", "parse", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"\n        Parse native configuration and load it into the corresponding models. Only models\n        that have been added to the root object will be parsed.\n\n        If ``native`` is passed to the method that's what we will parse, otherwise, we will use the\n        ``device`` to retrieve it.\n\n        Args:\n            device (NetworkDriver): Device to load the configuration from.\n            profile (list): Profiles that the device supports. If no ``profile`` is passed it will\n              be read from ``device``.\n            native (list of strings): Native configuration to parse.\n\n        Examples:\n\n            >>> # Load from device\n            >>> running_config = napalm_yang.base.Root()\n            >>> running_config.add_model(napalm_yang.models.openconfig_interfaces)\n            >>> running_config.Func(device=d)\n\n            >>> # Load from file\n            >>> with open(\"junos.config\", \"r\") as f:\n            >>>     config = f.read()\n            >>>\n            >>> running_config = napalm_yang.base.Root()\n            >>> running_config.add_model(napalm_yang.models.openconfig_interfaces)\n            >>> running_config.Func(native=[config], profile=\"junos\")\n        \"\"\"\n        if arg_4 is None:\n            arg_4 = arg_0.elements().values()\n\n        for arg_5 in arg_4:\n            arg_6 = Parser(\n                arg_5, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, is_config=True\n            )\n            arg_6.parse()", "path": "napalm_yang/base.py", "identifier": "Root.parse_config", "docstring": "Parse native configuration and load it into the corresponding models. Only models\n        that have been added to the root object will be parsed.\n\n        If ``native`` is passed to the method that's what we will parse, otherwise, we will use the\n        ``device`` to retrieve it.\n\n        Args:\n            device (NetworkDriver): Device to load the configuration from.\n            profile (list): Profiles that the device supports. If no ``profile`` is passed it will\n              be read from ``device``.\n            native (list of strings): Native configuration to parse.\n\n        Examples:\n\n            >>> # Load from device\n            >>> running_config = napalm_yang.base.Root()\n            >>> running_config.add_model(napalm_yang.models.openconfig_interfaces)\n            >>> running_config.parse_config(device=d)\n\n            >>> # Load from file\n            >>> with open(\"junos.config\", \"r\") as f:\n            >>>     config = f.read()\n            >>>\n            >>> running_config = napalm_yang.base.Root()\n            >>> running_config.add_model(napalm_yang.models.openconfig_interfaces)\n            >>> running_config.parse_config(native=[config], profile=\"junos\")", "docstring_tokens": ["Parse", "native", "configuration", "and", "load", "it", "into", "the", "corresponding", "models", ".", "Only", "models", "that", "have", "been", "added", "to", "the", "root", "object", "will", "be", "parsed", "."], "nwo": "napalm-automation/napalm-yang", "score": 0.2912181512296147, "idx": 259409}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/legecy_translators/objects.py#L93-L126", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "This function replaces objects with OBJECTS_LVALS, returns new code, replacement dict and count.\n        count arg is the number that should be added to the LVAL of the first replaced object", "language": "python", "parameters": "(code, count=1)", "return_statement": "return res, replacements, count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "bracket_split", "(", "arg_0", ",", "[", "'{}'", ",", "'[]'", "]", ")", "arg_4", "=", "''", "arg_5", "=", "''", "for", "arg_6", "in", "arg_3", ":", "if", "arg_6", "[", "0", "]", "==", "'{'", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "Func", "(", "arg_6", "[", "1", ":", "-", "1", "]", ",", "arg_1", ")", "if", "is_object", "(", "arg_7", ",", "arg_5", ")", ":", "arg_4", "+=", "' '", "+", "arg_10", "%", "arg_1", "arg_2", "[", "arg_10", "%", "arg_1", "]", "=", "arg_6", "arg_1", "+=", "1", "else", ":", "arg_4", "+=", "'{%s}'", "%", "arg_7", "arg_1", "=", "arg_9", "arg_2", ".", "update", "(", "arg_8", ")", "elif", "arg_6", "[", "0", "]", "==", "'['", ":", "if", "is_array", "(", "arg_5", ")", ":", "arg_4", "+=", "arg_6", "else", ":", "arg_7", ",", "arg_11", ",", "arg_1", "=", "Func", "(", "arg_6", "[", "1", ":", "-", "1", "]", ",", "arg_1", ")", "arg_4", "+=", "'[%s]'", "%", "arg_7", "arg_2", ".", "update", "(", "arg_11", ")", "else", ":", "arg_4", "+=", "arg_6", "arg_5", "=", "arg_6", "return", "arg_4", ",", "arg_2", ",", "arg_1"], "function": "def Func(arg_0, arg_1=1):\n    \"\"\" This function replaces objects with OBJECTS_LVALS, returns new code, replacement dict and count.\n        count arg is the number that should be added to the LVAL of the first replaced object\n    \"\"\"\n    arg_2 = {}  #replacement dict\n    arg_3 = bracket_split(arg_0, ['{}', '[]'])\n    arg_4 = ''\n    arg_5 = ''\n    for arg_6 in arg_3:\n        #test whether e is an object\n        if arg_6[0] == '{':\n            arg_7, arg_8, arg_9 = Func(arg_6[1:-1], arg_1)\n            # if e was not an object then n should not contain any :\n            if is_object(arg_7, arg_5):\n                #e was an object\n                arg_4 += ' ' + arg_10 % arg_1\n                arg_2[arg_10 % arg_1] = arg_6\n                arg_1 += 1\n            else:\n                # e was just a code block but could contain objects inside\n                arg_4 += '{%s}' % arg_7\n                arg_1 = arg_9\n                arg_2.update(arg_8)\n        elif arg_6[0] == '[':\n            if is_array(arg_5):\n                arg_4 += arg_6  # will be translated later\n            else:  # prop get\n                arg_7, arg_11, arg_1 = Func(arg_6[1:-1], arg_1)\n                arg_4 += '[%s]' % arg_7\n                arg_2.update(arg_11)\n        else:  # e does not contain any objects\n            arg_4 += arg_6\n        arg_5 = arg_6  #needed to test for this stipid empty object\n    return arg_4, arg_2, arg_1", "path": "js2py/legecy_translators/objects.py", "identifier": "remove_objects", "docstring": "This function replaces objects with OBJECTS_LVALS, returns new code, replacement dict and count.\n        count arg is the number that should be added to the LVAL of the first replaced object", "docstring_tokens": ["This", "function", "replaces", "objects", "with", "OBJECTS_LVALS", "returns", "new", "code", "replacement", "dict", "and", "count", ".", "count", "arg", "is", "the", "number", "that", "should", "be", "added", "to", "the", "LVAL", "of", "the", "first", "replaced", "object"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 259410}
{"url": "https://github.com/napalm-automation/napalm-yang/blob/998e8a933171d010b8544bcc5dc448e2b68051e2/interactive_demo/ansible/callback/selective.py#L264-L288", "sha": "998e8a933171d010b8544bcc5dc448e2b68051e2", "docstring_summary": "Run when a task is skipped.", "language": "python", "parameters": "(self, result, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_0", ".", "_display", ".", "verbosity", ">", "1", ":", "arg_0", ".", "_print_task", "(", ")", "arg_0", ".", "last_skipped", "=", "False", "arg_4", "=", "120", "arg_5", "=", "\" \"", "*", "(", "31", "-", "len", "(", "arg_1", ".", "_host", ".", "name", ")", "-", "4", ")", "arg_6", "=", "\"  * {}{}- {}\"", ".", "format", "(", "colorize", "(", "arg_1", ".", "_host", ".", "name", ",", "\"not_so_bold\"", ")", ",", "arg_5", ",", "colorize", "(", "\"skipped\"", ",", "\"skipped\"", ")", ",", ")", "arg_7", "=", "arg_1", ".", "_result", ".", "get", "(", "\"skipped_reason\"", ",", "\"\"", ")", "or", "arg_1", ".", "_result", ".", "get", "(", "\"skip_reason\"", ",", "\"\"", ")", "if", "len", "(", "arg_7", ")", "<", "50", ":", "arg_6", "+=", "\" -- {}\"", ".", "format", "(", "arg_7", ")", "print", "(", "\"{} {}---------\"", ".", "format", "(", "arg_6", ",", "\"-\"", "*", "(", "arg_4", "-", "len", "(", "arg_6", ")", ")", ")", ")", "else", ":", "print", "(", "\"{} {}\"", ".", "format", "(", "arg_6", ",", "\"-\"", "*", "(", "arg_4", "-", "len", "(", "arg_6", ")", ")", ")", ")", "print", "(", "arg_0", ".", "_indent_text", "(", "arg_7", ",", "8", ")", ")", "print", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Run when a task is skipped.\"\"\"\n        if arg_0._display.verbosity > 1:\n            arg_0._print_task()\n            arg_0.last_skipped = False\n\n            arg_4 = 120\n            arg_5 = \" \" * (31 - len(arg_1._host.name) - 4)\n\n            arg_6 = \"  * {}{}- {}\".format(\n                colorize(arg_1._host.name, \"not_so_bold\"),\n                arg_5,\n                colorize(\"skipped\", \"skipped\"),\n            )\n\n            arg_7 = arg_1._result.get(\"skipped_reason\", \"\") or arg_1._result.get(\n                \"skip_reason\", \"\"\n            )\n            if len(arg_7) < 50:\n                arg_6 += \" -- {}\".format(arg_7)\n                print(\"{} {}---------\".format(arg_6, \"-\" * (arg_4 - len(arg_6))))\n            else:\n                print(\"{} {}\".format(arg_6, \"-\" * (arg_4 - len(arg_6))))\n                print(arg_0._indent_text(arg_7, 8))\n                print(arg_7)", "path": "interactive_demo/ansible/callback/selective.py", "identifier": "CallbackModule.v2_runner_on_skipped", "docstring": "Run when a task is skipped.", "docstring_tokens": ["Run", "when", "a", "task", "is", "skipped", "."], "nwo": "napalm-automation/napalm-yang", "score": 0.2912181512296147, "idx": 259411}
{"url": "https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/percolate.py#L359-L447", "sha": "92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac", "docstring_summary": "r'''\n    Generate statistics for a single run", "language": "python", "parameters": "(spanning_cluster=True, **kwargs)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "True", ",", "**", "arg_1", ")", ":", "arg_1", "[", "'copy_result'", "]", "=", "False", "arg_2", "=", "dict", "(", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "sample_states", "(", "arg_0", "=", "arg_0", ",", "**", "arg_1", ")", ")", ":", "if", "'N'", "in", "arg_2", ":", "assert", "arg_2", "[", "'N'", "]", "==", "arg_4", "[", "'N'", "]", "else", ":", "arg_2", "[", "'N'", "]", "=", "arg_4", "[", "'N'", "]", "if", "'M'", "in", "arg_2", ":", "assert", "arg_2", "[", "'M'", "]", "==", "arg_4", "[", "'M'", "]", "else", ":", "arg_2", "[", "'M'", "]", "=", "arg_4", "[", "'M'", "]", "arg_5", "=", "arg_4", "[", "'M'", "]", "+", "1", "arg_6", "=", "np", ".", "empty", "(", "arg_5", ")", "if", "arg_0", ":", "arg_7", "=", "np", ".", "empty", "(", "arg_5", ",", "dtype", "=", "np", ".", "bool", ")", "arg_8", "=", "np", ".", "empty", "(", "(", "5", ",", "arg_5", ")", ")", "arg_6", "[", "arg_3", "]", "=", "arg_4", "[", "'max_cluster_size'", "]", "for", "arg_9", "in", "range", "(", "5", ")", ":", "arg_8", "[", "arg_9", ",", "arg_3", "]", "=", "arg_4", "[", "'moments'", "]", "[", "arg_9", "]", "if", "arg_0", ":", "arg_7", "[", "arg_3", "]", "=", "arg_4", "[", "'has_spanning_cluster'", "]", "arg_2", "[", "'max_cluster_size'", "]", "=", "arg_6", "arg_2", "[", "'moments'", "]", "=", "arg_8", "if", "arg_0", ":", "arg_2", "[", "'has_spanning_cluster'", "]", "=", "arg_7", "return", "arg_2"], "function": "def Func(arg_0=True, **arg_1):\n    r'''\n    Generate statistics for a single run\n\n    This is a stand-alone helper function to evolve a single sample state\n    (realization) and return the cluster statistics.\n\n    Parameters\n    ----------\n    spanning_cluster : bool, optional\n        Whether to detect a spanning cluster or not.\n        Defaults to ``True``.\n\n    kwargs : keyword arguments\n        Piped through to :func:`sample_states`\n\n    Returns\n    -------\n\n    ret : dict\n        Cluster statistics\n\n    ret['N'] : int\n        Total number of sites\n\n    ret['M'] : int\n        Total number of bonds\n\n    ret['max_cluster_size'] : 1-D :py:class:`numpy.ndarray` of int, size ``ret['M'] + 1``\n        Array of the sizes of the largest cluster (absolute number of sites) at\n        the respective occupation number.\n\n    ret['has_spanning_cluster'] : 1-D :py:class:`numpy.ndarray` of bool, size ``ret['M'] + 1``\n        Array of booleans for each occupation number.\n        The respective entry is ``True`` if there is a spanning cluster,\n        ``False`` otherwise.\n        Only exists if `spanning_cluster` argument is set to ``True``.\n\n    ret['moments'] : 2-D :py:class:`numpy.ndarray` of int\n        Array of shape ``(5, ret['M'] + 1)``.\n        The ``(k, m)``-th entry is the ``k``-th raw moment of the (absolute)\n        cluster size distribution, with ``k`` ranging from ``0`` to ``4``, at\n        occupation number ``m``.\n\n    See Also\n    --------\n\n    sample_states\n\n    '''\n\n    # initial iteration\n    # we do not need a copy of the result dictionary since we copy the values\n    # anyway\n    arg_1['copy_result'] = False\n    arg_2 = dict()\n\n    for arg_3, arg_4 in enumerate(sample_states(\n        arg_0=arg_0, **arg_1\n    )):\n\n        # merge cluster statistics\n        if 'N' in arg_2:\n            assert arg_2['N'] == arg_4['N']\n        else:\n            arg_2['N'] = arg_4['N']\n\n        if 'M' in arg_2:\n            assert arg_2['M'] == arg_4['M']\n        else:\n            arg_2['M'] = arg_4['M']\n            arg_5 = arg_4['M'] + 1\n            arg_6 = np.empty(arg_5)\n            if arg_0:\n                arg_7 = np.empty(arg_5, dtype=np.bool)\n            arg_8 = np.empty((5, arg_5))\n\n        arg_6[arg_3] = arg_4['max_cluster_size']\n        for arg_9 in range(5):\n            arg_8[arg_9, arg_3] = arg_4['moments'][arg_9]\n        if arg_0:\n            arg_7[arg_3] = arg_4['has_spanning_cluster']\n\n    arg_2['max_cluster_size'] = arg_6\n    arg_2['moments'] = arg_8\n    if arg_0:\n        arg_2['has_spanning_cluster'] = arg_7\n\n    return arg_2", "path": "percolate/percolate.py", "identifier": "single_run_arrays", "docstring": "r'''\n    Generate statistics for a single run\n\n    This is a stand-alone helper function to evolve a single sample state\n    (realization) and return the cluster statistics.\n\n    Parameters\n    ----------\n    spanning_cluster : bool, optional\n        Whether to detect a spanning cluster or not.\n        Defaults to ``True``.\n\n    kwargs : keyword arguments\n        Piped through to :func:`sample_states`\n\n    Returns\n    -------\n\n    ret : dict\n        Cluster statistics\n\n    ret['N'] : int\n        Total number of sites\n\n    ret['M'] : int\n        Total number of bonds\n\n    ret['max_cluster_size'] : 1-D :py:class:`numpy.ndarray` of int, size ``ret['M'] + 1``\n        Array of the sizes of the largest cluster (absolute number of sites) at\n        the respective occupation number.\n\n    ret['has_spanning_cluster'] : 1-D :py:class:`numpy.ndarray` of bool, size ``ret['M'] + 1``\n        Array of booleans for each occupation number.\n        The respective entry is ``True`` if there is a spanning cluster,\n        ``False`` otherwise.\n        Only exists if `spanning_cluster` argument is set to ``True``.\n\n    ret['moments'] : 2-D :py:class:`numpy.ndarray` of int\n        Array of shape ``(5, ret['M'] + 1)``.\n        The ``(k, m)``-th entry is the ``k``-th raw moment of the (absolute)\n        cluster size distribution, with ``k`` ranging from ``0`` to ``4``, at\n        occupation number ``m``.\n\n    See Also\n    --------\n\n    sample_states", "docstring_tokens": ["r", "Generate", "statistics", "for", "a", "single", "run"], "nwo": "andsor/pypercolate", "score": 0.27946077266739355, "idx": 259412}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L1001-L1020", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Handle keypresses for changing tabs.", "language": "python", "parameters": "(self, size, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", "=", "super", "(", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_3", "=", "len", "(", "arg_0", ".", "_widgets", ")", "if", "arg_2", "==", "arg_0", ".", "_keys", "[", "'prev_tab'", "]", ":", "arg_0", ".", "_tab_index", "=", "(", "arg_0", ".", "_tab_index", "-", "1", ")", "%", "arg_3", "arg_0", ".", "_update_tabs", "(", ")", "elif", "arg_2", "==", "arg_0", ".", "_keys", "[", "'next_tab'", "]", ":", "arg_0", ".", "_tab_index", "=", "(", "arg_0", ".", "_tab_index", "+", "1", ")", "%", "arg_3", "arg_0", ".", "_update_tabs", "(", ")", "elif", "arg_2", "==", "arg_0", ".", "_keys", "[", "'close_tab'", "]", ":", "if", "arg_0", ".", "_tab_index", ">", "0", ":", "arg_5", "=", "arg_0", ".", "_widgets", "[", "arg_0", ".", "_tab_index", "]", "arg_0", ".", "_widgets", ".", "remove", "(", "arg_5", ")", "del", "arg_0", ".", "_widget_title", "[", "arg_5", "]", "arg_0", ".", "_tab_index", "-=", "1", "arg_0", ".", "_update_tabs", "(", ")", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle Funces for changing tabs.\"\"\"\n        arg_2 = super().Func(arg_1, arg_2)\n        arg_3 = len(arg_0._widgets)\n        if arg_2 == arg_0._keys['prev_tab']:\n            arg_0._tab_index = (arg_0._tab_index - 1) % arg_3\n            arg_0._update_tabs()\n        elif arg_2 == arg_0._keys['next_tab']:\n            arg_0._tab_index = (arg_0._tab_index + 1) % arg_3\n            arg_0._update_tabs()\n        elif arg_2 == arg_0._keys['close_tab']:\n            # Don't allow closing the Conversations tab\n            if arg_0._tab_index > 0:\n                arg_5 = arg_0._widgets[arg_0._tab_index]\n                arg_0._widgets.remove(arg_5)\n                del arg_0._widget_title[arg_5]\n                arg_0._tab_index -= 1\n                arg_0._update_tabs()\n        else:\n            return arg_2", "path": "hangups/ui/__main__.py", "identifier": "TabbedWindowWidget.keypress", "docstring": "Handle keypresses for changing tabs.", "docstring_tokens": ["Handle", "keypresses", "for", "changing", "tabs", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259413}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1197-L1226", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots the max and median of long and short position concentrations\n    over the time.", "language": "python", "parameters": "(positions, ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "plt", ".", "gca", "(", ")", "arg_3", "=", "pos", ".", "get_max_median_position_concentration", "(", "arg_0", ")", "arg_4", "=", "[", "'mediumblue'", ",", "'steelblue'", ",", "'tomato'", ",", "'firebrick'", "]", "arg_3", ".", "plot", "(", "linewidth", "=", "1", ",", "color", "=", "arg_4", ",", "alpha", "=", "0.6", ",", "arg_1", "=", "arg_1", ")", "arg_1", ".", "legend", "(", "loc", "=", "'center left'", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "arg_1", ".", "set_ylabel", "(", "'Exposure'", ")", "arg_1", ".", "set_title", "(", "'Long/short max and median position concentration'", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"\n    Plots the max and median of long and short position concentrations\n    over the time.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        The positions that the strategy takes over time.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_1 is None:\n        arg_1 = plt.gca()\n\n    arg_3 = pos.get_max_median_position_concentration(arg_0)\n    arg_4 = ['mediumblue', 'steelblue', 'tomato', 'firebrick']\n    arg_3.plot(linewidth=1, color=arg_4, alpha=0.6, arg_1=arg_1)\n\n    arg_1.legend(loc='center left', frameon=True, framealpha=0.5)\n    arg_1.set_ylabel('Exposure')\n    arg_1.set_title('Long/short max and median position concentration')\n\n    return arg_1", "path": "pyfolio/plotting.py", "identifier": "plot_max_median_position_concentration", "docstring": "Plots the max and median of long and short position concentrations\n    over the time.\n\n    Parameters\n    ----------\n    positions : pd.DataFrame\n        The positions that the strategy takes over time.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "the", "max", "and", "median", "of", "long", "and", "short", "position", "concentrations", "over", "the", "time", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 259414}
{"url": "https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/extractors/images.py#L250-L263", "sha": "e6994b1b1826af2720a091d1bff5ca15594f558d", "docstring_summary": "\\\n        will check the image src against a list\n        of bad image files we know of like buttons, etc...", "language": "python", "parameters": "(self, image_node)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "parser", ".", "getAttribute", "(", "arg_1", ",", "attr", "=", "'src'", ")", "if", "not", "arg_2", ":", "return", "False", "if", "arg_0", ".", "badimages_names_re", ".", "search", "(", "arg_2", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\\\n        will check the image src against a list\n        of bad image files we know of like buttons, etc...\n        \"\"\"\n        arg_2 = arg_0.parser.getAttribute(arg_1, attr='src')\n\n        if not arg_2:\n            return False\n\n        if arg_0.badimages_names_re.search(arg_2):\n            return False\n\n        return True", "path": "goose3/extractors/images.py", "identifier": "ImageExtractor.is_valid_filename", "docstring": "\\\n        will check the image src against a list\n        of bad image files we know of like buttons, etc...", "docstring_tokens": ["\\", "will", "check", "the", "image", "src", "against", "a", "list", "of", "bad", "image", "files", "we", "know", "of", "like", "buttons", "etc", "..."], "nwo": "goose3/goose3", "score": 0.5494430231474424, "idx": 259415}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L54-L66", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Set the input or output mode for a specified pin.  Mode should be\n        either GPIO.OUT or GPIO.IN.", "language": "python", "parameters": "(self, pin, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_validate_pin", "(", "arg_1", ")", "if", "arg_2", "==", "GPIO", ".", "IN", ":", "arg_0", ".", "iodir", "[", "int", "(", "arg_1", "/", "8", ")", "]", "|=", "1", "<<", "(", "int", "(", "arg_1", "%", "8", ")", ")", "elif", "arg_2", "==", "GPIO", ".", "OUT", ":", "arg_0", ".", "iodir", "[", "int", "(", "arg_1", "/", "8", ")", "]", "&=", "~", "(", "1", "<<", "(", "int", "(", "arg_1", "%", "8", ")", ")", ")", "else", ":", "raise", "ValueError", "(", "'Unexpected value.  Must be GPIO.IN or GPIO.OUT.'", ")", "arg_0", ".", "write_iodir", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Set the input or output mode for a specified pin.  Mode should be\n        either GPIO.OUT or GPIO.IN.\n        \"\"\"\n        arg_0._validate_pin(arg_1)\n        # Set bit to 1 for input or 0 for output.\n        if arg_2 == GPIO.IN:\n            arg_0.iodir[int(arg_1/8)] |= 1 << (int(arg_1%8))\n        elif arg_2 == GPIO.OUT:\n            arg_0.iodir[int(arg_1/8)] &= ~(1 << (int(arg_1%8)))\n        else:\n            raise ValueError('Unexpected value.  Must be GPIO.IN or GPIO.OUT.')\n        arg_0.write_iodir()", "path": "Adafruit_GPIO/MCP230xx.py", "identifier": "MCP230xxBase.setup", "docstring": "Set the input or output mode for a specified pin.  Mode should be\n        either GPIO.OUT or GPIO.IN.", "docstring_tokens": ["Set", "the", "input", "or", "output", "mode", "for", "a", "specified", "pin", ".", "Mode", "should", "be", "either", "GPIO", ".", "OUT", "or", "GPIO", ".", "IN", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 259416}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/tasks/records.py#L36-L57", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Migrate a record from a migration dump.", "language": "python", "parameters": "(data, source_type=None, latest_only=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_1", "=", "arg_1", "or", "'marcxml'", "assert", "arg_1", "in", "[", "'marcxml'", ",", "'json'", "]", "arg_3", "=", "current_migrator", ".", "records_dump_cls", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "pid_fetchers", "=", "current_migrator", ".", "records_pid_fetchers", ",", ")", "try", ":", "current_migrator", ".", "records_dumploader_cls", ".", "create", "(", "arg_3", ")", "db", ".", "session", ".", "commit", "(", ")", "except", "Exception", ":", "db", ".", "session", ".", "rollback", "(", ")", "raise"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n    \"\"\"Migrate a record from a migration dump.\n\n    :param data: Dictionary for representing a single record and files.\n    :param source_type: Determines if the MARCXML or the JSON dump is used.\n        Default: ``marcxml``.\n    :param latest_only: Determine is only the latest revision should be loaded.\n    \"\"\"\n    arg_1 = arg_1 or 'marcxml'\n    assert arg_1 in ['marcxml', 'json']\n\n    arg_3 = current_migrator.records_dump_cls(\n        arg_0,\n        arg_1=arg_1,\n        pid_fetchers=current_migrator.records_pid_fetchers,\n    )\n    try:\n        current_migrator.records_dumploader_cls.create(arg_3)\n        db.session.commit()\n    except Exception:\n        db.session.rollback()\n        raise", "path": "invenio_migrator/tasks/records.py", "identifier": "import_record", "docstring": "Migrate a record from a migration dump.\n\n    :param data: Dictionary for representing a single record and files.\n    :param source_type: Determines if the MARCXML or the JSON dump is used.\n        Default: ``marcxml``.\n    :param latest_only: Determine is only the latest revision should be loaded.", "docstring_tokens": ["Migrate", "a", "record", "from", "a", "migration", "dump", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 259417}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/base_graph.py#L623-L627", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Maintains each edge's list of available nodes.", "language": "python", "parameters": "(self, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "edges", ":", "arg_2", ".", "_nodes", "=", "arg_0", ".", "nodes"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Maintains each edge's list of available nodes.\n        \"\"\"\n        for arg_2 in arg_0.edges:\n            arg_2._nodes = arg_0.nodes", "path": "godot/base_graph.py", "identifier": "BaseGraph._set_node_lists", "docstring": "Maintains each edge's list of available nodes.", "docstring_tokens": ["Maintains", "each", "edge", "s", "list", "of", "available", "nodes", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 259418}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L680-L691", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Unregister an engine that has died.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'content'", "]", "arg_3", "=", "int", "(", "arg_2", "[", "'id'", "]", ")", "if", "arg_3", "in", "arg_0", ".", "_ids", ":", "arg_0", ".", "_ids", ".", "remove", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "_engines", ".", "pop", "(", "arg_3", ")", "arg_0", ".", "_handle_stranded_msgs", "(", "arg_3", ",", "arg_4", ")", "if", "arg_0", ".", "_task_socket", "and", "arg_0", ".", "_task_scheme", "==", "'pure'", ":", "arg_0", ".", "_stop_scheduling_tasks", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Unregister an engine that has died.\"\"\"\n        arg_2 = arg_1['content']\n        arg_3 = int(arg_2['id'])\n        if arg_3 in arg_0._ids:\n            arg_0._ids.remove(arg_3)\n            arg_4 = arg_0._engines.pop(arg_3)\n\n            arg_0._handle_stranded_msgs(arg_3, arg_4)\n\n        if arg_0._task_socket and arg_0._task_scheme == 'pure':\n            arg_0._stop_scheduling_tasks()", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client._unregister_engine", "docstring": "Unregister an engine that has died.", "docstring_tokens": ["Unregister", "an", "engine", "that", "has", "died", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259419}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L1545-L1551", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Save word to memory", "language": "python", "parameters": "(self, address, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "istainted", "(", "arg_0", ".", "pc", ")", ":", "for", "arg_3", "in", "get_taints", "(", "arg_0", ".", "pc", ")", ":", "arg_2", "=", "taint_with", "(", "arg_2", ",", "arg_3", ")", "arg_0", ".", "_allocate", "(", "arg_1", ",", "32", ")", "arg_0", ".", "_store", "(", "arg_1", ",", "arg_2", ",", "32", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Save word to memory\"\"\"\n        if istainted(arg_0.pc):\n            for arg_3 in get_taints(arg_0.pc):\n                arg_2 = taint_with(arg_2, arg_3)\n        arg_0._allocate(arg_1, 32)\n        arg_0._store(arg_1, arg_2, 32)", "path": "manticore/platforms/evm.py", "identifier": "EVM.MSTORE", "docstring": "Save word to memory", "docstring_tokens": ["Save", "word", "to", "memory"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259420}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L123-L134", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Runs the checker.py scripts to detect the os.", "language": "python", "parameters": "(self, ip)", "return_statement": "return system_os", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "subprocess", ".", "run", "(", "[", "'python2'", ",", "os", ".", "path", ".", "join", "(", "arg_0", ".", "datadir", ",", "'MS17-010'", ",", "'checker.py'", ")", ",", "str", "(", "arg_1", ")", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "arg_3", "=", "arg_2", ".", "stdout", ".", "decode", "(", "'utf-8'", ")", ".", "split", "(", "'\\n'", ")", "arg_4", "=", "''", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", ".", "startswith", "(", "'Target OS:'", ")", ":", "arg_4", "=", "arg_5", ".", "replace", "(", "'Target OS: '", ",", "''", ")", "break", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Runs the checker.py scripts to detect the os.\n        \"\"\"\n        arg_2 = subprocess.run(['python2', os.path.join(arg_0.datadir, 'MS17-010', 'checker.py'), str(arg_1)], stdout=subprocess.PIPE)\n        arg_3 = arg_2.stdout.decode('utf-8').split('\\n')\n        arg_4 = ''\n        for arg_5 in arg_3:\n            if arg_5.startswith('Target OS:'):\n                arg_4 = arg_5.replace('Target OS: ', '')\n                break\n        return arg_4", "path": "jackal/scripts/eternalblue.py", "identifier": "Eternalblue.detect_os", "docstring": "Runs the checker.py scripts to detect the os.", "docstring_tokens": ["Runs", "the", "checker", ".", "py", "scripts", "to", "detect", "the", "os", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 259421}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/KnittingPatternSet.py#L105-L131", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Create an SVG from the knitting pattern set.", "language": "python", "parameters": "(self, zoom)", "return_statement": "return XMLDumper(on_dump)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "on_dump", "(", ")", ":", "arg_2", "=", "arg_0", ".", "patterns", ".", "at", "(", "0", ")", "arg_3", "=", "GridLayout", "(", "arg_2", ")", "arg_4", "=", "default_instruction_svg_cache", "(", ")", "arg_5", "=", "SVGBuilder", "(", ")", "arg_6", "=", "KnittingPatternToSVG", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_1", ")", "return", "arg_6", ".", "build_SVG_dict", "(", ")", "return", "XMLDumper", "(", "on_dump", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create an SVG from the knitting pattern set.\n\n        :param float zoom: the height and width of a knit instruction\n        :return: a dumper to save the svg to\n        :rtype: knittingpattern.Dumper.XMLDumper\n\n        Example:\n\n        .. code:: python\n\n            >>> knitting_pattern_set.Func(25).temporary_path(\".svg\")\n            \"/the/path/to/the/file.svg\"\n        \"\"\"\n        def on_dump():\n            \"\"\"Dump the knitting pattern to the file.\n\n            :return: the SVG XML structure as dictionary.\n            \"\"\"\n            arg_2 = arg_0.patterns.at(0)\n            arg_3 = GridLayout(arg_2)\n            arg_4 = default_instruction_svg_cache()\n            arg_5 = SVGBuilder()\n            arg_6 = KnittingPatternToSVG(arg_2, arg_3,\n                                             arg_4, arg_5, arg_1)\n            return arg_6.build_SVG_dict()\n        return XMLDumper(on_dump)", "path": "knittingpattern/KnittingPatternSet.py", "identifier": "KnittingPatternSet.to_svg", "docstring": "Create an SVG from the knitting pattern set.\n\n        :param float zoom: the height and width of a knit instruction\n        :return: a dumper to save the svg to\n        :rtype: knittingpattern.Dumper.XMLDumper\n\n        Example:\n\n        .. code:: python\n\n            >>> knitting_pattern_set.to_svg(25).temporary_path(\".svg\")\n            \"/the/path/to/the/file.svg\"", "docstring_tokens": ["Create", "an", "SVG", "from", "the", "knitting", "pattern", "set", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 259422}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L598-L613", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Delete the folder with the passed in folder_id.", "language": "python", "parameters": "(self, token, folder_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "dict", "(", ")", "arg_3", "[", "'token'", "]", "=", "arg_1", "arg_3", "[", "'id'", "]", "=", "arg_2", "arg_4", "=", "arg_0", ".", "request", "(", "'midas.folder.delete'", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Delete the folder with the passed in folder_id.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param folder_id: The id of the folder to be deleted.\n        :type folder_id: int | long\n        :returns: None.\n        :rtype: None\n        \"\"\"\n        arg_3 = dict()\n        arg_3['token'] = arg_1\n        arg_3['id'] = arg_2\n        arg_4 = arg_0.request('midas.folder.delete', arg_3)\n        return arg_4", "path": "pydas/drivers.py", "identifier": "CoreDriver.delete_folder", "docstring": "Delete the folder with the passed in folder_id.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param folder_id: The id of the folder to be deleted.\n        :type folder_id: int | long\n        :returns: None.\n        :rtype: None", "docstring_tokens": ["Delete", "the", "folder", "with", "the", "passed", "in", "folder_id", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 259423}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/comp.py#L88-L99", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Get the value of a list or single parameter.", "language": "python", "parameters": "(self, params)", "return_statement": "return util.delistify(\n            [self.param_dict[p] for p in util.listify(params)], params\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "util", ".", "delistify", "(", "[", "arg_0", ".", "param_dict", "[", "arg_2", "]", "for", "arg_2", "in", "util", ".", "listify", "(", "arg_1", ")", "]", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get the value of a list or single parameter.\n\n        Parameters\n        ----------\n        params : string, list of string\n            name of parameters which to retrieve\n        \"\"\"\n        return util.delistify(\n            [arg_0.param_dict[arg_2] for arg_2 in util.listify(arg_1)], arg_1\n        )", "path": "peri/comp/comp.py", "identifier": "ParameterGroup.get_values", "docstring": "Get the value of a list or single parameter.\n\n        Parameters\n        ----------\n        params : string, list of string\n            name of parameters which to retrieve", "docstring_tokens": ["Get", "the", "value", "of", "a", "list", "or", "single", "parameter", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 259424}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L297-L303", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Evaluates an individual Chebyshev polynomial `k` in coordinate space\n        with proper transformation given the window", "language": "python", "parameters": "(self, k, x)", "return_statement": "return np.polynomial.chebyshev.chebval(self._x2c(x), weights)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "np", ".", "diag", "(", "np", ".", "ones", "(", "arg_1", "+", "1", ")", ")", "[", "arg_1", "]", "return", "np", ".", "polynomial", ".", "chebyshev", ".", "chebval", "(", "arg_0", ".", "_x2c", "(", "arg_2", ")", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Evaluates an individual Chebyshev polynomial `k` in coordinate space\n        with proper transformation given the window\n        \"\"\"\n        arg_3 = np.diag(np.ones(arg_1+1))[arg_1]\n        return np.polynomial.chebyshev.chebval(arg_0._x2c(arg_2), arg_3)", "path": "peri/interpolation.py", "identifier": "ChebyshevInterpolation1D.tk", "docstring": "Evaluates an individual Chebyshev polynomial `k` in coordinate space\n        with proper transformation given the window", "docstring_tokens": ["Evaluates", "an", "individual", "Chebyshev", "polynomial", "k", "in", "coordinate", "space", "with", "proper", "transformation", "given", "the", "window"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 259425}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L593-L646", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Update an alert", "language": "python", "parameters": "(self, alert)", "return_statement": "return self._post(\n            request=ApiActions.UPDATE.value,\n            uri=ApiUri.ACTIONS.value,\n            params=data\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'id'", ":", "arg_1", "[", "'id'", "]", ",", "'args'", ":", "arg_1", "[", "'args'", "]", ",", "'rate_count'", ":", "arg_1", "[", "'rate_count'", "]", ",", "'rate_range'", ":", "arg_1", "[", "'rate_range'", "]", ",", "'limit_count'", ":", "arg_1", "[", "'limit_count'", "]", ",", "'limit_range'", ":", "arg_1", "[", "'limit_range'", "]", ",", "'schedule'", ":", "arg_1", "[", "'schedule'", "]", ",", "'enabled'", ":", "arg_1", "[", "'enabled'", "]", ",", "'type'", ":", "arg_1", "[", "'type'", "]", ",", "}", "return", "arg_0", ".", "_post", "(", "request", "=", "ApiActions", ".", "UPDATE", ".", "value", ",", "uri", "=", "ApiUri", ".", "ACTIONS", ".", "value", ",", "params", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Update an alert\n\n        :param alert: The data to Func. Must include keys:\n\n            * id (str)\n            * rate_count (int)\n            * rate_range (str): 'day' or 'hour'\n            * limit_count (int)\n            * limit_range (str): 'day' or 'hour'\n            * type (str)\n            * schedule (list)\n            * args (dict)\n        :type alert: dict\n\n        Example:\n\n        .. code-block:: python\n\n            Alert().Func(\n                alert={\n                    'id': 'd9d4596e-49e4-4135-b3b3-847f9e7c1f43',\n                    'args': {'direct': 'you@example.com'},\n                    'rate_count': 1,\n                    'rate_range': 'hour',\n                    'limit_count': 1,\n                    'limit_range': 'hour',\n                    'schedule': [],\n                    'enabled': True,\n                    'type': 'mailto',\n                }\n            )\n\n        :return:\n        :rtype: dict\n        \"\"\"\n        arg_2 = {\n            'id': arg_1['id'],\n            'args': arg_1['args'],\n            'rate_count': arg_1['rate_count'],\n            'rate_range': arg_1['rate_range'],\n            'limit_count': arg_1['limit_count'],\n            'limit_range': arg_1['limit_range'],\n            'schedule': arg_1['schedule'],\n            'enabled': arg_1['enabled'],\n            'type': arg_1['type'],\n        }\n\n        return arg_0._post(\n            request=ApiActions.UPDATE.value,\n            uri=ApiUri.ACTIONS.value,\n            params=arg_2\n        )", "path": "logentries_api/resources.py", "identifier": "Alerts.update", "docstring": "Update an alert\n\n        :param alert: The data to update. Must include keys:\n\n            * id (str)\n            * rate_count (int)\n            * rate_range (str): 'day' or 'hour'\n            * limit_count (int)\n            * limit_range (str): 'day' or 'hour'\n            * type (str)\n            * schedule (list)\n            * args (dict)\n        :type alert: dict\n\n        Example:\n\n        .. code-block:: python\n\n            Alert().update(\n                alert={\n                    'id': 'd9d4596e-49e4-4135-b3b3-847f9e7c1f43',\n                    'args': {'direct': 'you@example.com'},\n                    'rate_count': 1,\n                    'rate_range': 'hour',\n                    'limit_count': 1,\n                    'limit_range': 'hour',\n                    'schedule': [],\n                    'enabled': True,\n                    'type': 'mailto',\n                }\n            )\n\n        :return:\n        :rtype: dict", "docstring_tokens": ["Update", "an", "alert"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 259426}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L986-L989", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Generate comparison results for a same-tagged range.", "language": "python", "parameters": "(self, tag, x, lo, hi)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "for", "arg_5", "in", "xrange", "(", "arg_3", ",", "arg_4", ")", ":", "yield", "'%s %s'", "%", "(", "arg_1", ",", "arg_2", "[", "arg_5", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Generate comparison results for a same-tagged range.\"\"\"\n        for arg_5 in xrange(arg_3, arg_4):\n            yield '%s %s' % (arg_1, arg_2[arg_5])", "path": "third_party/stdlib/difflib.py", "identifier": "Differ._dump", "docstring": "Generate comparison results for a same-tagged range.", "docstring_tokens": ["Generate", "comparison", "results", "for", "a", "same", "-", "tagged", "range", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 259427}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmodels/eclipses.py#L19-L46", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a simple gaussian.", "language": "python", "parameters": "(x, amp, loc, std)", "return_statement": "return amp * np.exp(-((x - loc)*(x - loc))/(2.0*std*std))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "arg_1", "*", "np", ".", "exp", "(", "-", "(", "(", "arg_0", "-", "arg_2", ")", "*", "(", "arg_0", "-", "arg_2", ")", ")", "/", "(", "2.0", "*", "arg_3", "*", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''This is a simple gaussian.\n\n    Parameters\n    ----------\n\n    x : np.array\n        The items at which the Gaussian is evaluated.\n\n    amp : float\n        The amplitude of the Gaussian.\n\n    loc : float\n        The central value of the Gaussian.\n\n    std : float\n        The standard deviation of the Gaussian.\n\n    Returns\n    -------\n\n    np.array\n        Returns the Gaussian evaluated at the items in `x`, using the provided\n        parameters of `amp`, `loc`, and `std`.\n\n    '''\n\n    return arg_1 * np.exp(-((arg_0 - arg_2)*(arg_0 - arg_2))/(2.0*arg_3*arg_3))", "path": "astrobase/lcmodels/eclipses.py", "identifier": "_gaussian", "docstring": "This is a simple gaussian.\n\n    Parameters\n    ----------\n\n    x : np.array\n        The items at which the Gaussian is evaluated.\n\n    amp : float\n        The amplitude of the Gaussian.\n\n    loc : float\n        The central value of the Gaussian.\n\n    std : float\n        The standard deviation of the Gaussian.\n\n    Returns\n    -------\n\n    np.array\n        Returns the Gaussian evaluated at the items in `x`, using the provided\n        parameters of `amp`, `loc`, and `std`.", "docstring_tokens": ["This", "is", "a", "simple", "gaussian", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 259428}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_sql_hook.py#L974-L982", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Clean up database hook after it was used.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "database_type", "==", "'postgres'", ":", "if", "hasattr", "(", "arg_0", ".", "db_hook", ",", "'conn'", ")", "and", "arg_0", ".", "db_hook", ".", "conn", "and", "arg_0", ".", "db_hook", ".", "conn", ".", "notices", ":", "for", "arg_1", "in", "arg_0", ".", "db_hook", ".", "conn", ".", "notices", ":", "arg_0", ".", "log", ".", "info", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Clean up database hook after it was used.\n        \"\"\"\n        if arg_0.database_type == 'postgres':\n            if hasattr(arg_0.db_hook,\n                       'conn') and arg_0.db_hook.conn and arg_0.db_hook.conn.notices:\n                for arg_1 in arg_0.db_hook.conn.notices:\n                    arg_0.log.info(arg_1)", "path": "airflow/contrib/hooks/gcp_sql_hook.py", "identifier": "CloudSqlDatabaseHook.cleanup_database_hook", "docstring": "Clean up database hook after it was used.", "docstring_tokens": ["Clean", "up", "database", "hook", "after", "it", "was", "used", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259429}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose_exclude.py#L52-L85", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Configure plugin based on command line options", "language": "python", "parameters": "(self, options, conf)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "super", "(", "NoseExclude", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "exclude_dirs", "=", "{", "}", "if", "arg_1", ".", "exclude_dir_file", ":", "if", "not", "arg_1", ".", "exclude_dirs", ":", "arg_1", ".", "exclude_dirs", "=", "[", "]", "arg_4", "=", "arg_0", ".", "_load_from_file", "(", "arg_1", ".", "exclude_dir_file", ")", "arg_1", ".", "exclude_dirs", ".", "extend", "(", "arg_4", ")", "if", "not", "arg_1", ".", "exclude_dirs", ":", "arg_0", ".", "enabled", "=", "False", "return", "arg_0", ".", "enabled", "=", "True", "arg_6", "=", "os", ".", "getcwd", "(", ")", "log", ".", "debug", "(", "'cwd: %s'", "%", "arg_6", ")", "for", "arg_7", "in", "arg_1", ".", "exclude_dirs", ":", "for", "arg_8", "in", "arg_7", ".", "split", "(", "'\\n'", ")", ":", "arg_8", "=", "arg_8", ".", "strip", "(", ")", "arg_9", "=", "arg_0", ".", "_force_to_abspath", "(", "arg_8", ")", "if", "arg_9", ":", "arg_0", ".", "exclude_dirs", "[", "arg_9", "]", "=", "True", "arg_10", "=", "\"excluding dirs: %s\"", "%", "\",\"", ".", "join", "(", "arg_0", ".", "exclude_dirs", ".", "keys", "(", ")", ")", "log", ".", "debug", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Configure plugin based on command line options\"\"\"\n        super(NoseExclude, arg_0).Func(arg_1, arg_2)\n\n        arg_0.exclude_dirs = {}\n\n        # preload directories from file\n        if arg_1.exclude_dir_file:\n            if not arg_1.exclude_dirs:\n                arg_1.exclude_dirs = []\n\n            arg_4 = arg_0._load_from_file(arg_1.exclude_dir_file)\n            arg_1.exclude_dirs.extend(arg_4)\n\n        if not arg_1.exclude_dirs:\n            arg_0.enabled = False\n            return\n\n        arg_0.enabled = True\n        arg_6 = os.getcwd()\n        log.debug('cwd: %s' % arg_6)\n\n        # Normalize excluded directory names for lookup\n        for arg_7 in arg_1.exclude_dirs:\n            # when using setup.cfg, you can specify only one 'exclude-dir'\n            # separated by some character (new line is good enough)\n            for arg_8 in arg_7.split('\\n'):\n                arg_8 = arg_8.strip()\n                arg_9 = arg_0._force_to_abspath(arg_8)\n                if arg_9:\n                    arg_0.exclude_dirs[arg_9] = True\n\n        arg_10 = \"excluding dirs: %s\" % \",\".join(arg_0.exclude_dirs.keys())\n        log.debug(arg_10)", "path": "environment/lib/python2.7/site-packages/nose_exclude.py", "identifier": "NoseExclude.configure", "docstring": "Configure plugin based on command line options", "docstring_tokens": ["Configure", "plugin", "based", "on", "command", "line", "options"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259430}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/neuroRemote.py#L201-L221", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Call the restful endpoint to merge two RAMON objects into one.", "language": "python", "parameters": "(self, token, channel, ids, delete=False)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_0", ".", "url", "(", ")", "+", "\"/merge/{}/\"", ".", "format", "(", "','", ".", "join", "(", "[", "str", "(", "arg_7", ")", "for", "arg_7", "in", "arg_3", "]", ")", ")", "arg_6", "=", "arg_0", ".", "remote_utils", ".", "get_url", "(", "arg_5", ")", "if", "arg_6", ".", "status_code", "is", "not", "200", ":", "raise", "RemoteDataUploadError", "(", "'Could not merge ids {}'", ".", "format", "(", "','", ".", "join", "(", "[", "str", "(", "arg_7", ")", "for", "arg_7", "in", "arg_3", "]", ")", ")", ")", "if", "arg_4", ":", "arg_0", ".", "delete_ramon", "(", "arg_1", ",", "arg_2", ",", "arg_3", "[", "1", ":", "]", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):\n        \"\"\"\n        Call the restful endpoint to merge two RAMON objects into one.\n\n        Arguments:\n            token (str): The token to inspect\n            channel (str): The channel to inspect\n            ids (int[]): the list of the IDs to merge\n            delete (bool : False): Whether to delete after merging.\n\n        Returns:\n            json: The ID as returned by ndstore\n        \"\"\"\n        arg_5 = arg_0.url() + \"/merge/{}/\".format(','.join([str(arg_7) for arg_7 in arg_3]))\n        arg_6 = arg_0.remote_utils.get_url(arg_5)\n        if arg_6.status_code is not 200:\n            raise RemoteDataUploadError('Could not merge ids {}'.format(\n                                        ','.join([str(arg_7) for arg_7 in arg_3])))\n        if arg_4:\n            arg_0.delete_ramon(arg_1, arg_2, arg_3[1:])\n        return True", "path": "ndio/remote/neuroRemote.py", "identifier": "neuroRemote.merge_ids", "docstring": "Call the restful endpoint to merge two RAMON objects into one.\n\n        Arguments:\n            token (str): The token to inspect\n            channel (str): The channel to inspect\n            ids (int[]): the list of the IDs to merge\n            delete (bool : False): Whether to delete after merging.\n\n        Returns:\n            json: The ID as returned by ndstore", "docstring_tokens": ["Call", "the", "restful", "endpoint", "to", "merge", "two", "RAMON", "objects", "into", "one", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 259431}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2218-L2230", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Remove procid from waitlists and reestablish it in the running list", "language": "python", "parameters": "(self, procid)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "f\"Remove procid:{procid} from waitlists and reestablish it in the running list\"", ")", "for", "arg_2", "in", "arg_0", ".", "rwait", ":", "if", "arg_1", "in", "arg_2", ":", "arg_2", ".", "remove", "(", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "twait", ":", "if", "arg_1", "in", "arg_2", ":", "arg_2", ".", "remove", "(", "arg_1", ")", "arg_0", ".", "timers", "[", "arg_1", "]", "=", "None", "arg_0", ".", "running", ".", "append", "(", "arg_1", ")", "if", "arg_0", ".", "_current", "is", "None", ":", "arg_0", ".", "_current", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Remove procid from waitlists and reestablish it in the running list \"\"\"\n        logger.debug(f\"Remove procid:{procid} from waitlists and reestablish it in the running list\")\n        for arg_2 in arg_0.rwait:\n            if arg_1 in arg_2:\n                arg_2.remove(arg_1)\n        for arg_2 in arg_0.twait:\n            if arg_1 in arg_2:\n                arg_2.remove(arg_1)\n        arg_0.timers[arg_1] = None\n        arg_0.running.append(arg_1)\n        if arg_0._current is None:\n            arg_0._current = arg_1", "path": "manticore/platforms/linux.py", "identifier": "Linux.awake", "docstring": "Remove procid from waitlists and reestablish it in the running list", "docstring_tokens": ["Remove", "procid", "from", "waitlists", "and", "reestablish", "it", "in", "the", "running", "list"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259432}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/cli.py#L179-L222", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Fetch an individual file from a project.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "split_storage", "(", "arg_0", ".", "remote", ")", "arg_3", "=", "arg_0", ".", "local", "if", "arg_3", "is", "None", ":", "arg_4", ",", "arg_3", "=", "os", ".", "path", ".", "split", "(", "arg_2", ")", "arg_5", "=", "os", ".", "path", ".", "exists", "(", "arg_3", ")", "if", "arg_5", "and", "not", "arg_0", ".", "force", "and", "not", "arg_0", ".", "update", ":", "sys", ".", "exit", "(", "\"Local file %s already exists, not overwriting.\"", "%", "arg_3", ")", "arg_6", ",", "arg_4", "=", "os", ".", "path", ".", "split", "(", "arg_3", ")", "if", "arg_6", ":", "makedirs", "(", "arg_6", ",", "exist_ok", "=", "True", ")", "arg_7", "=", "_setup_osf", "(", "arg_0", ")", "arg_8", "=", "arg_7", ".", "project", "(", "arg_0", ".", "project", ")", "arg_9", "=", "arg_8", ".", "storage", "(", "arg_1", ")", "for", "arg_10", "in", "arg_9", ".", "files", ":", "if", "norm_remote_path", "(", "arg_10", ".", "path", ")", "==", "arg_2", ":", "if", "arg_5", "and", "not", "arg_0", ".", "force", "and", "arg_0", ".", "update", ":", "if", "arg_10", ".", "hashes", ".", "get", "(", "'md5'", ")", "==", "checksum", "(", "arg_3", ")", ":", "print", "(", "\"Local file %s already matches remote.\"", "%", "arg_3", ")", "break", "with", "open", "(", "arg_3", ",", "'wb'", ")", "as", "fp", ":", "arg_10", ".", "write_to", "(", "fp", ")", "break"], "function": "def Func(arg_0):\n    \"\"\"Fetch an individual file from a project.\n\n    The first part of the remote path is interpreted as the name of the\n    storage provider. If there is no match the default (osfstorage) is\n    used.\n\n    The local path defaults to the name of the remote file.\n\n    If the project is private you need to specify a username.\n\n    If args.force is True, write local file even if that file already exists.\n    If args.force is False but args.update is True, overwrite an existing local\n    file only if local and remote files differ.\n    \"\"\"\n    arg_1, arg_2 = split_storage(arg_0.remote)\n\n    arg_3 = arg_0.local\n    if arg_3 is None:\n        arg_4, arg_3 = os.path.split(arg_2)\n\n    arg_5 = os.path.exists(arg_3)\n    if arg_5 and not arg_0.force and not arg_0.update:\n        sys.exit(\"Local file %s already exists, not overwriting.\" % arg_3)\n\n    arg_6, arg_4 = os.path.split(arg_3)\n    if arg_6:\n        makedirs(arg_6, exist_ok=True)\n\n    arg_7 = _setup_osf(arg_0)\n    arg_8 = arg_7.project(arg_0.project)\n\n    arg_9 = arg_8.storage(arg_1)\n    for arg_10 in arg_9.files:\n        if norm_remote_path(arg_10.path) == arg_2:\n            if arg_5 and not arg_0.force and arg_0.update:\n                if arg_10.hashes.get('md5') == checksum(arg_3):\n                    print(\"Local file %s already matches remote.\" % arg_3)\n                    break\n            with open(arg_3, 'wb') as fp:\n                arg_10.write_to(fp)\n\n            # only Funcing one file so we are done\n            break", "path": "osfclient/cli.py", "identifier": "fetch", "docstring": "Fetch an individual file from a project.\n\n    The first part of the remote path is interpreted as the name of the\n    storage provider. If there is no match the default (osfstorage) is\n    used.\n\n    The local path defaults to the name of the remote file.\n\n    If the project is private you need to specify a username.\n\n    If args.force is True, write local file even if that file already exists.\n    If args.force is False but args.update is True, overwrite an existing local\n    file only if local and remote files differ.", "docstring_tokens": ["Fetch", "an", "individual", "file", "from", "a", "project", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 259433}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/component.py#L99-L109", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Same as `ComponentStream.connect` but assume `self.lock` is acquired.", "language": "python", "parameters": "(self,server=None,port=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_0", ".", "me", ".", "node", "or", "arg_0", ".", "me", ".", "resource", ":", "raise", "Value", "(", "\"Component JID may have only domain defined\"", ")", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "server", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", ".", "port", "if", "not", "arg_1", "or", "not", "arg_2", ":", "raise", "ValueError", "(", "\"Server or port not given\"", ")", "Stream", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "None", ",", "arg_0", ".", "me", ")"], "function": "def Func(arg_0,arg_1=None,arg_2=None):\n        \"\"\"Same as `ComponentStream.connect` but assume `self.lock` is acquired.\"\"\"\n        if arg_0.me.node or arg_0.me.resource:\n            raise Value(\"Component JID may have only domain defined\")\n        if not arg_1:\n            arg_1=arg_0.server\n        if not arg_2:\n            arg_2=arg_0.port\n        if not arg_1 or not arg_2:\n            raise ValueError(\"Server or port not given\")\n        Stream.Func(arg_0,arg_1,arg_2,None,arg_0.me)", "path": "pyxmpp2/ext/component.py", "identifier": "ComponentStream._connect", "docstring": "Same as `ComponentStream.connect` but assume `self.lock` is acquired.", "docstring_tokens": ["Same", "as", "ComponentStream", ".", "connect", "but", "assume", "self", ".", "lock", "is", "acquired", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259434}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1530-L1613", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Unsigned divide.", "language": "python", "parameters": "(cpu, src)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "size", "arg_3", "=", "{", "8", ":", "'DL'", ",", "16", ":", "'DX'", ",", "32", ":", "'EDX'", ",", "64", ":", "'RDX'", "}", "[", "arg_2", "]", "arg_4", "=", "{", "8", ":", "'AL'", ",", "16", ":", "'AX'", ",", "32", ":", "'EAX'", ",", "64", ":", "'RAX'", "}", "[", "arg_2", "]", "arg_5", "=", "Operators", ".", "CONCAT", "(", "arg_2", "*", "2", ",", "arg_0", ".", "read_register", "(", "arg_3", ")", ",", "arg_0", ".", "read_register", "(", "arg_4", ")", ")", "arg_6", "=", "Operators", ".", "ZEXTEND", "(", "arg_1", ".", "read", "(", ")", ",", "arg_2", "*", "2", ")", "if", "isinstance", "(", "arg_6", ",", "int", ")", "and", "arg_6", "==", "0", ":", "raise", "DivideByZeroError", "(", ")", "arg_7", "=", "Operators", ".", "UFunc", "(", "arg_5", ",", "arg_6", ")", "arg_8", "=", "(", "1", "<<", "arg_2", ")", "-", "1", "if", "isinstance", "(", "arg_7", ",", "int", ")", "and", "arg_7", ">", "arg_8", ":", "raise", "DivideByZeroError", "(", ")", "arg_9", "=", "Operators", ".", "UREM", "(", "arg_5", ",", "arg_6", ")", "arg_0", ".", "write_register", "(", "arg_4", ",", "Operators", ".", "EXTRACT", "(", "arg_7", ",", "0", ",", "arg_2", ")", ")", "arg_0", ".", "write_register", "(", "arg_3", ",", "Operators", ".", "EXTRACT", "(", "arg_9", ",", "0", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Unsigned divide.\n\n        Divides (unsigned) the value in the AX register, DX:AX register pair,\n        or EDX:EAX or RDX:RAX register pair (dividend) by the source operand\n        (divisor) and stores the result in the AX (AH:AL), DX:AX, EDX:EAX or\n        RDX:RAX registers. The source operand can be a general-purpose register\n        or a memory location. The action of this instruction depends of the\n        operand size (dividend/divisor). Division using 64-bit operand is\n        available only in 64-bit mode. Non-integral results are truncated\n        (chopped) towards 0. The reminder is always less than the divisor in\n        magnitude. Overflow is indicated with the #DE (divide error) exception\n        rather than with the CF flag::\n\n            IF SRC  =  0\n                THEN #DE; FI;(* divide error *)\n            IF OperandSize  =  8 (* word/byte operation *)\n                THEN\n                    temp  =  AX / SRC;\n                    IF temp > FFH\n                        THEN #DE; (* divide error *) ;\n                        ELSE\n                            AL  =  temp;\n                            AH  =  AX MOD SRC;\n                    FI;\n                ELSE IF OperandSize  =  16 (* doubleword/word operation *)\n                    THEN\n                        temp  =  DX:AX / SRC;\n                        IF temp > FFFFH\n                            THEN #DE; (* divide error *) ;\n                        ELSE\n                            AX  =  temp;\n                            DX  =  DX:AX MOD SRC;\n                        FI;\n                    FI;\n                ELSE If OperandSize = 32 (* quadword/doubleword operation *)\n                    THEN\n                        temp  =  EDX:EAX / SRC;\n                        IF temp > FFFFFFFFH\n                            THEN #DE; (* divide error *) ;\n                        ELSE\n                            EAX  =  temp;\n                            EDX  =  EDX:EAX MOD SRC;\n                        FI;\n                    FI;\n                ELSE IF OperandSize = 64 (*Doublequadword/quadword operation*)\n                    THEN\n                        temp = RDX:RAX / SRC;\n                        IF temp > FFFFFFFFFFFFFFFFH\n                            THEN #DE; (* Divide error *)\n                        ELSE\n                            RAX = temp;\n                            RDX = RDX:RAX MOD SRC;\n                        FI;\n                    FI;\n            FI;\n\n        :param cpu: current CPU.\n        :param src: source operand.\n        \"\"\"\n        arg_2 = arg_1.size\n        arg_3 = {8: 'DL', 16: 'DX', 32: 'EDX', 64: 'RDX'}[arg_2]\n        arg_4 = {8: 'AL', 16: 'AX', 32: 'EAX', 64: 'RAX'}[arg_2]\n\n        arg_5 = Operators.CONCAT(arg_2 * 2,\n                                    arg_0.read_register(arg_3),\n                                    arg_0.read_register(arg_4))\n        arg_6 = Operators.ZEXTEND(arg_1.read(), arg_2 * 2)\n\n        # TODO make symbol friendly\n        if isinstance(arg_6, int) and arg_6 == 0:\n            raise DivideByZeroError()\n        arg_7 = Operators.UFunc(arg_5, arg_6)\n\n        arg_8 = (1 << arg_2) - 1\n\n        # TODO make symbol friendly\n        if isinstance(arg_7, int) and arg_7 > arg_8:\n            raise DivideByZeroError()\n        arg_9 = Operators.UREM(arg_5, arg_6)\n\n        arg_0.write_register(arg_4, Operators.EXTRACT(arg_7, 0, arg_2))\n        arg_0.write_register(arg_3, Operators.EXTRACT(arg_9, 0, arg_2))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.DIV", "docstring": "Unsigned divide.\n\n        Divides (unsigned) the value in the AX register, DX:AX register pair,\n        or EDX:EAX or RDX:RAX register pair (dividend) by the source operand\n        (divisor) and stores the result in the AX (AH:AL), DX:AX, EDX:EAX or\n        RDX:RAX registers. The source operand can be a general-purpose register\n        or a memory location. The action of this instruction depends of the\n        operand size (dividend/divisor). Division using 64-bit operand is\n        available only in 64-bit mode. Non-integral results are truncated\n        (chopped) towards 0. The reminder is always less than the divisor in\n        magnitude. Overflow is indicated with the #DE (divide error) exception\n        rather than with the CF flag::\n\n            IF SRC  =  0\n                THEN #DE; FI;(* divide error *)\n            IF OperandSize  =  8 (* word/byte operation *)\n                THEN\n                    temp  =  AX / SRC;\n                    IF temp > FFH\n                        THEN #DE; (* divide error *) ;\n                        ELSE\n                            AL  =  temp;\n                            AH  =  AX MOD SRC;\n                    FI;\n                ELSE IF OperandSize  =  16 (* doubleword/word operation *)\n                    THEN\n                        temp  =  DX:AX / SRC;\n                        IF temp > FFFFH\n                            THEN #DE; (* divide error *) ;\n                        ELSE\n                            AX  =  temp;\n                            DX  =  DX:AX MOD SRC;\n                        FI;\n                    FI;\n                ELSE If OperandSize = 32 (* quadword/doubleword operation *)\n                    THEN\n                        temp  =  EDX:EAX / SRC;\n                        IF temp > FFFFFFFFH\n                            THEN #DE; (* divide error *) ;\n                        ELSE\n                            EAX  =  temp;\n                            EDX  =  EDX:EAX MOD SRC;\n                        FI;\n                    FI;\n                ELSE IF OperandSize = 64 (*Doublequadword/quadword operation*)\n                    THEN\n                        temp = RDX:RAX / SRC;\n                        IF temp > FFFFFFFFFFFFFFFFH\n                            THEN #DE; (* Divide error *)\n                        ELSE\n                            RAX = temp;\n                            RDX = RDX:RAX MOD SRC;\n                        FI;\n                    FI;\n            FI;\n\n        :param cpu: current CPU.\n        :param src: source operand.", "docstring_tokens": ["Unsigned", "divide", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259435}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L858-L918", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Execute hql in target schema and write results to a csv file.", "language": "python", "parameters": "(\n            self,\n            hql,\n            csv_filepath,\n            schema='default',\n            delimiter=',',\n            lineterminator='\\r\\n',\n            output_header=True,\n            fetch_size=1000,\n            hive_conf=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'default'", ",", "arg_4", "=", "','", ",", "arg_5", "=", "'\\r\\n'", ",", "arg_6", "=", "True", ",", "arg_7", "=", "1000", ",", "arg_8", "=", "None", ")", ":", "arg_9", "=", "arg_0", ".", "_get_results", "(", "arg_1", ",", "arg_3", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", "arg_10", "=", "next", "(", "arg_9", ")", "arg_11", "=", "None", "arg_12", "=", "0", "with", "open", "(", "arg_2", ",", "'wb'", ")", "as", "f", ":", "arg_13", "=", "csv", ".", "writer", "(", "f", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "encoding", "=", "'utf-8'", ")", "try", ":", "if", "arg_6", ":", "arg_0", ".", "log", ".", "debug", "(", "'Cursor description is %s'", ",", "arg_10", ")", "arg_13", ".", "writerow", "(", "[", "arg_14", "[", "0", "]", "for", "arg_14", "in", "arg_10", "]", ")", "for", "arg_12", ",", "arg_15", "in", "enumerate", "(", "arg_9", ",", "1", ")", ":", "arg_13", ".", "writerow", "(", "arg_15", ")", "if", "arg_12", "%", "arg_7", "==", "0", ":", "arg_0", ".", "log", ".", "info", "(", "\"Written %s rows so far.\"", ",", "arg_12", ")", "except", "ValueError", "as", "exception", ":", "arg_11", "=", "str", "(", "exception", ")", "if", "arg_11", ":", "os", ".", "remove", "(", "arg_2", ")", "raise", "ValueError", "(", "arg_11", ")", "arg_0", ".", "log", ".", "info", "(", "\"Done. Loaded a total of %s rows.\"", ",", "arg_12", ")"], "function": "def Func(\n            arg_0,\n            arg_1,\n            arg_2,\n            arg_3='default',\n            arg_4=',',\n            arg_5='\\r\\n',\n            arg_6=True,\n            arg_7=1000,\n            arg_8=None):\n        \"\"\"\n        Execute hql in target schema and write results to a csv file.\n\n        :param hql: hql to be executed.\n        :type hql: str or list\n        :param csv_filepath: filepath of csv to write results into.\n        :type csv_filepath: str\n        :param schema: target schema, default to 'default'.\n        :type schema: str\n        :param delimiter: delimiter of the csv file, default to ','.\n        :type delimiter: str\n        :param lineterminator: lineterminator of the csv file.\n        :type lineterminator: str\n        :param output_header: header of the csv file, default to True.\n        :type output_header: bool\n        :param fetch_size: number of result rows to write into the csv file, default to 1000.\n        :type fetch_size: int\n        :param hive_conf: hive_conf to execute alone with the hql.\n        :type hive_conf: dict\n\n        \"\"\"\n\n        arg_9 = arg_0._get_results(arg_1, arg_3,\n                                         arg_7=arg_7, arg_8=arg_8)\n        arg_10 = next(arg_9)\n        arg_11 = None\n\n        arg_12 = 0\n        with open(arg_2, 'wb') as f:\n            arg_13 = csv.writer(f,\n                                arg_4=arg_4,\n                                arg_5=arg_5,\n                                encoding='utf-8')\n            try:\n                if arg_6:\n                    arg_0.log.debug('Cursor description is %s', arg_10)\n                    arg_13.writerow([arg_14[0] for arg_14 in arg_10])\n\n                for arg_12, arg_15 in enumerate(arg_9, 1):\n                    arg_13.writerow(arg_15)\n                    if arg_12 % arg_7 == 0:\n                        arg_0.log.info(\"Written %s rows so far.\", arg_12)\n            except ValueError as exception:\n                arg_11 = str(exception)\n\n        if arg_11:\n            # need to clean up the file first\n            os.remove(arg_2)\n            raise ValueError(arg_11)\n\n        arg_0.log.info(\"Done. Loaded a total of %s rows.\", arg_12)", "path": "airflow/hooks/hive_hooks.py", "identifier": "HiveServer2Hook.to_csv", "docstring": "Execute hql in target schema and write results to a csv file.\n\n        :param hql: hql to be executed.\n        :type hql: str or list\n        :param csv_filepath: filepath of csv to write results into.\n        :type csv_filepath: str\n        :param schema: target schema, default to 'default'.\n        :type schema: str\n        :param delimiter: delimiter of the csv file, default to ','.\n        :type delimiter: str\n        :param lineterminator: lineterminator of the csv file.\n        :type lineterminator: str\n        :param output_header: header of the csv file, default to True.\n        :type output_header: bool\n        :param fetch_size: number of result rows to write into the csv file, default to 1000.\n        :type fetch_size: int\n        :param hive_conf: hive_conf to execute alone with the hql.\n        :type hive_conf: dict", "docstring_tokens": ["Execute", "hql", "in", "target", "schema", "and", "write", "results", "to", "a", "csv", "file", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259436}
{"url": "https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/api_utils.py#L109-L113", "sha": "ed36268b7917332d16868208e1e565742a8753e1", "docstring_summary": "Write a notebook as base64.", "language": "python", "parameters": "(nb, version=NBFORMAT_VERSION)", "return_statement": "return b64encode(writes(nb, version=version).encode('utf-8'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "return", "b64encode", "(", "writes", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", ".", "encode", "(", "'utf-8'", ")", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Write a notebook as base64.\n    \"\"\"\n    return b64encode(writes(arg_0, arg_1=arg_1).encode('utf-8'))", "path": "pgcontents/api_utils.py", "identifier": "writes_base64", "docstring": "Write a notebook as base64.", "docstring_tokens": ["Write", "a", "notebook", "as", "base64", "."], "nwo": "quantopian/pgcontents", "score": 0.6800826043035378, "idx": 259437}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L729-L740", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Writes a value in the stack.", "language": "python", "parameters": "(cpu, value, size)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "arg_2", "in", "(", "8", ",", "16", ",", "arg_0", ".", "address_bit_size", ")", "arg_0", ".", "STACK", "=", "arg_0", ".", "STACK", "-", "arg_2", "//", "8", "arg_4", ",", "arg_5", ",", "arg_5", "=", "arg_0", ".", "get_descriptor", "(", "arg_0", ".", "read_register", "(", "'SS'", ")", ")", "arg_6", "=", "arg_0", ".", "STACK", "+", "arg_4", "arg_0", ".", "write_int", "(", "arg_6", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Writes a value in the stack.\n\n        :param value: the value to put in the stack.\n        :param size: the size of the value.\n        \"\"\"\n        assert arg_2 in (8, 16, arg_0.address_bit_size)\n        arg_0.STACK = arg_0.STACK - arg_2 // 8\n        arg_4, arg_5, arg_5 = arg_0.get_descriptor(arg_0.read_register('SS'))\n        arg_6 = arg_0.STACK + arg_4\n        arg_0.write_int(arg_6, arg_1, arg_2)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.push", "docstring": "Writes a value in the stack.\n\n        :param value: the value to put in the stack.\n        :param size: the size of the value.", "docstring_tokens": ["Writes", "a", "value", "in", "the", "stack", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259438}
{"url": "https://github.com/soimort/you-get/blob/b746ac01c9f39de94cac2d56f665285b0523b974/src/you_get/extractors/dailymotion.py#L13-L35", "sha": "b746ac01c9f39de94cac2d56f665285b0523b974", "docstring_summary": "Downloads Dailymotion videos by URL.", "language": "python", "parameters": "(url, output_dir='.', merge=True, info_only=False, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'.'", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "**", "arg_4", ")", ":", "arg_5", "=", "get_content", "(", "rebuilt_url", "(", "arg_0", ")", ")", "arg_6", "=", "json", ".", "loads", "(", "match1", "(", "arg_5", ",", "r'qualities\":({.+?}),\"'", ")", ")", "arg_7", "=", "match1", "(", "arg_5", ",", "r'\"video_title\"\\s*:\\s*\"([^\"]+)\"'", ")", "or", "match1", "(", "arg_5", ",", "r'\"title\"\\s*:\\s*\"([^\"]+)\"'", ")", "arg_7", "=", "unicodize", "(", "arg_7", ")", "for", "arg_8", "in", "[", "'1080'", ",", "'720'", ",", "'480'", ",", "'380'", ",", "'240'", ",", "'144'", ",", "'auto'", "]", ":", "try", ":", "arg_9", "=", "arg_6", "[", "arg_8", "]", "[", "1", "]", "[", "\"url\"", "]", "if", "arg_9", ":", "break", "except", "KeyError", ":", "pass", "arg_10", ",", "arg_11", ",", "arg_12", "=", "url_info", "(", "arg_9", ")", "print_info", "(", "site_info", ",", "arg_7", ",", "arg_10", ",", "arg_12", ")", "if", "not", "arg_3", ":", "download_urls", "(", "[", "arg_9", "]", ",", "arg_7", ",", "arg_11", ",", "arg_12", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1='.', arg_2=True, arg_3=False, **arg_4):\n    \"\"\"Downloads Dailymotion videos by URL.\n    \"\"\"\n\n    arg_5 = get_content(rebuilt_url(arg_0))\n    arg_6 = json.loads(match1(arg_5, r'qualities\":({.+?}),\"'))\n    arg_7 = match1(arg_5, r'\"video_title\"\\s*:\\s*\"([^\"]+)\"') or \\\n            match1(arg_5, r'\"title\"\\s*:\\s*\"([^\"]+)\"')\n    arg_7 = unicodize(arg_7)\n\n    for arg_8 in ['1080','720','480','380','240','144','auto']:\n        try:\n            arg_9 = arg_6[arg_8][1][\"url\"]\n            if arg_9:\n                break\n        except KeyError:\n            pass\n\n    arg_10, arg_11, arg_12 = url_info(arg_9)\n\n    print_info(site_info, arg_7, arg_10, arg_12)\n    if not arg_3:\n        download_urls([arg_9], arg_7, arg_11, arg_12, arg_1=arg_1, arg_2=arg_2)", "path": "src/you_get/extractors/dailymotion.py", "identifier": "dailymotion_download", "docstring": "Downloads Dailymotion videos by URL.", "docstring_tokens": ["Downloads", "Dailymotion", "videos", "by", "URL", "."], "nwo": "soimort/you-get", "score": 0.9997601519430084, "idx": 259439}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/helpers.py#L122-L133", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Remove old entries from the cache", "language": "python", "parameters": "(cachedir: StoreBackendBase, func_name: str, limit: int)", "return_statement": "return len(cache_entries_to_remove)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", ")", "->", "arg_5", ":", "if", "arg_4", "<", "1", ":", "raise", "ValueError", "(", "\"'limit' must be greater or equal to 1\"", ")", "arg_6", "=", "get_cachedir_entries", "(", "arg_0", ",", "arg_2", ")", "arg_6", "=", "sorted", "(", "arg_6", ",", "key", "=", "lambda", "e", ":", "e", ".", "last_access", ",", "reverse", "=", "True", ")", "arg_7", "=", "arg_6", "[", "arg_4", ":", "]", "for", "arg_8", "in", "arg_7", ":", "shutil", ".", "rmtree", "(", "arg_8", ".", "path", ",", "ignore_errors", "=", "True", ")", "return", "len", "(", "arg_7", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5) -> arg_5:\n    \"\"\"Remove old entries from the cache\"\"\"\n    if arg_4 < 1:\n        raise ValueError(\"'limit' must be greater or equal to 1\")\n\n    arg_6 = get_cachedir_entries(arg_0, arg_2)\n    arg_6 = sorted(arg_6, key=lambda e: e.last_access, reverse=True)\n    arg_7 = arg_6[arg_4:]\n    for arg_8 in arg_7:\n        shutil.rmtree(arg_8.path, ignore_errors=True)\n\n    return len(arg_7)", "path": "toucan_data_sdk/utils/helpers.py", "identifier": "clean_cachedir_old_entries", "docstring": "Remove old entries from the cache", "docstring_tokens": ["Remove", "old", "entries", "from", "the", "cache"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 259440}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/task.py#L438-L454", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Returns any descendants that have the given task spec assigned.", "language": "python", "parameters": "(self, task_spec)", "return_statement": "return tasks", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "arg_0", ".", "task_spec", "==", "arg_1", ":", "arg_2", ".", "append", "(", "arg_0", ")", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "task_spec", "!=", "arg_1", ":", "continue", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns any descendants that have the given task spec assigned.\n\n        :type  task_spec: TaskSpec\n        :param task_spec: The wanted task spec.\n        :rtype:  list(Task)\n        :returns: The tasks objects that are attached to the given task spec.\n        \"\"\"\n        arg_2 = []\n        if arg_0.task_spec == arg_1:\n            arg_2.append(arg_0)\n        for arg_3 in arg_0:\n            if arg_3.task_spec != arg_1:\n                continue\n            arg_2.append(arg_3)\n        return arg_2", "path": "SpiffWorkflow/task.py", "identifier": "Task._find_any", "docstring": "Returns any descendants that have the given task spec assigned.\n\n        :type  task_spec: TaskSpec\n        :param task_spec: The wanted task spec.\n        :rtype:  list(Task)\n        :returns: The tasks objects that are attached to the given task spec.", "docstring_tokens": ["Returns", "any", "descendants", "that", "have", "the", "given", "task", "spec", "assigned", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 259441}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/design_analysis.py#L497-L511", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Go through \"if\" node `node` and counts its boolean expressions", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "test", "if", "not", "isinstance", "(", "arg_2", ",", "BoolOp", ")", ":", "return", "arg_3", "=", "_count_boolean_expressions", "(", "arg_2", ")", "if", "arg_3", ">", "arg_0", ".", "config", ".", "max_bool_expr", ":", "arg_0", ".", "add_message", "(", "\"too-many-boolean-expressions\"", ",", "arg_1", "=", "arg_2", ",", "args", "=", "(", "arg_3", ",", "arg_0", ".", "config", ".", "max_bool_expr", ")", ",", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Go through \"if\" node `node` and counts its boolean expressions\n\n        if the \"if\" node test is a BoolOp node\n        \"\"\"\n        arg_2 = arg_1.test\n        if not isinstance(arg_2, BoolOp):\n            return\n        arg_3 = _count_boolean_expressions(arg_2)\n        if arg_3 > arg_0.config.max_bool_expr:\n            arg_0.add_message(\n                \"too-many-boolean-expressions\",\n                arg_1=arg_2,\n                args=(arg_3, arg_0.config.max_bool_expr),\n            )", "path": "pylint/checkers/design_analysis.py", "identifier": "MisdesignChecker._check_boolean_expressions", "docstring": "Go through \"if\" node `node` and counts its boolean expressions\n\n        if the \"if\" node test is a BoolOp node", "docstring_tokens": ["Go", "through", "if", "node", "node", "and", "counts", "its", "boolean", "expressions"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 259442}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L12-L19", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Returns the function signature for the specified name and Solidity JSON metadata inputs array.", "language": "python", "parameters": "(name: str, inputs: Sequence[Mapping[str, Any]])", "return_statement": "return name + SolidityMetadata.tuple_signature_for_components(inputs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "[", "arg_1", ",", "arg_5", "]", "]", ")", "->", "arg_1", ":", "return", "arg_0", "+", "SolidityMetadata", ".", "tuple_signature_for_components", "(", "arg_2", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4[arg_1, arg_5]]) -> arg_1:\n        \"\"\"Returns the function signature for the specified name and Solidity JSON metadata inputs array.\n\n        The ABI specification defines the function signature as the function name followed by the parenthesised list of\n        parameter types separated by single commas and no spaces.\n        See https://solidity.readthedocs.io/en/latest/abi-spec.html#function-selector\n        \"\"\"\n        return arg_0 + SolidityMetadata.tuple_signature_for_components(arg_2)", "path": "manticore/ethereum/solidity.py", "identifier": "SolidityMetadata.function_signature_for_name_and_inputs", "docstring": "Returns the function signature for the specified name and Solidity JSON metadata inputs array.\n\n        The ABI specification defines the function signature as the function name followed by the parenthesised list of\n        parameter types separated by single commas and no spaces.\n        See https://solidity.readthedocs.io/en/latest/abi-spec.html#function-selector", "docstring_tokens": ["Returns", "the", "function", "signature", "for", "the", "specified", "name", "and", "Solidity", "JSON", "metadata", "inputs", "array", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259443}
{"url": "https://github.com/uogbuji/amara3-xml/blob/88c18876418cffc89bb85b4a3193e5002b6b39a6/pylib/uxml/tree.py#L135-L148", "sha": "88c18876418cffc89bb85b4a3193e5002b6b39a6", "docstring_summary": "XPath-like string value of node", "language": "python", "parameters": "(node, outermost=True)", "return_statement": "return accumulator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "element", ")", ":", "return", "arg_0", ".", "xml_value", "if", "arg_1", "else", "[", "arg_0", ".", "xml_value", "]", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "xml_children", ":", "if", "isinstance", "(", "arg_3", ",", "text", ")", ":", "arg_2", ".", "append", "(", "arg_3", ".", "xml_value", ")", "elif", "isinstance", "(", "arg_3", ",", "element", ")", ":", "arg_2", ".", "extend", "(", "Func", "(", "arg_3", ",", "arg_1", "=", "False", ")", ")", "if", "arg_1", ":", "arg_2", "=", "''", ".", "join", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n    '''\n    XPath-like string value of node\n    '''\n    if not isinstance(arg_0, element):\n        return arg_0.xml_value if arg_1 else [arg_0.xml_value]\n    arg_2 = []\n    for arg_3 in arg_0.xml_children:\n        if isinstance(arg_3, text):\n            arg_2.append(arg_3.xml_value)\n        elif isinstance(arg_3, element):\n            arg_2.extend(Func(arg_3, arg_1=False))\n    if arg_1: arg_2 = ''.join(arg_2)\n    return arg_2", "path": "pylib/uxml/tree.py", "identifier": "strval", "docstring": "XPath-like string value of node", "docstring_tokens": ["XPath", "-", "like", "string", "value", "of", "node"], "nwo": "uogbuji/amara3-xml", "score": 0.16246995141409282, "idx": 259444}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/users.py#L27-L36", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Returns a list of users for the given course id.", "language": "python", "parameters": "(self, course_id, params={})", "return_statement": "return users", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ")", ":", "arg_3", "=", "COURSES_API", ".", "format", "(", "arg_1", ")", "+", "\"/users\"", "arg_4", "=", "arg_0", ".", "_get_paged_resource", "(", "arg_3", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_4", ":", "arg_5", ".", "append", "(", "CanvasUser", "(", "arg_4", "=", "arg_6", ")", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2={}):\n        \"\"\"\n        Returns a list of users for the given course id.\n        \"\"\"\n        arg_3 = COURSES_API.format(arg_1) + \"/users\"\n        arg_4 = arg_0._get_paged_resource(arg_3, arg_2=arg_2)\n        arg_5 = []\n        for arg_6 in arg_4:\n            arg_5.append(CanvasUser(arg_4=arg_6))\n        return arg_5", "path": "uw_canvas/users.py", "identifier": "Users.get_users_for_course", "docstring": "Returns a list of users for the given course id.", "docstring_tokens": ["Returns", "a", "list", "of", "users", "for", "the", "given", "course", "id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 259445}
{"url": "https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L328-L375", "sha": "b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b", "docstring_summary": "Helper function to determine if this node matches the given predicate.", "language": "python", "parameters": "(self, pred)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "return", "True", "arg_1", "=", "arg_1", "[", "1", ":", "-", "1", "]", "if", "arg_1", ".", "startswith", "(", "'@'", ")", ":", "arg_1", "=", "arg_1", "[", "1", ":", "]", "if", "'='", "in", "arg_1", ":", "arg_2", ",", "arg_3", "=", "arg_1", ".", "split", "(", "'='", ",", "1", ")", "if", "arg_3", "[", "0", "]", "in", "(", "'\"'", ",", "\"'\"", ")", ":", "arg_3", "=", "arg_3", "[", "1", ":", "]", "if", "arg_3", "[", "-", "1", "]", "in", "(", "'\"'", ",", "\"'\"", ")", ":", "arg_3", "=", "arg_3", "[", ":", "-", "1", "]", "return", "arg_0", ".", "attrs", ".", "get", "(", "arg_2", ")", "==", "arg_3", "else", ":", "return", "arg_1", "in", "arg_0", ".", "attrs", "elif", "num_re", ".", "match", "(", "arg_1", ")", ":", "arg_4", "=", "int", "(", "arg_1", ")", "if", "arg_4", "<", "0", ":", "if", "arg_0", ".", "parent", ":", "return", "arg_0", ".", "index", "==", "(", "len", "(", "arg_0", ".", "parent", ".", "_children", ")", "+", "arg_4", ")", "else", ":", "return", "arg_4", "==", "0", "else", ":", "return", "arg_4", "==", "arg_0", ".", "index", "else", ":", "if", "'='", "in", "arg_1", ":", "arg_5", ",", "arg_3", "=", "arg_1", ".", "split", "(", "'='", ",", "1", ")", "if", "arg_3", "[", "0", "]", "in", "(", "'\"'", ",", "\"'\"", ")", ":", "arg_3", "=", "arg_3", "[", "1", ":", "]", "if", "arg_3", "[", "-", "1", "]", "in", "(", "'\"'", ",", "\"'\"", ")", ":", "arg_3", "=", "arg_3", "[", ":", "-", "1", "]", "for", "arg_6", "in", "arg_0", ".", "_children", ":", "if", "arg_6", ".", "tagname", "==", "arg_5", "and", "arg_6", ".", "data", "==", "arg_3", ":", "return", "True", "else", ":", "for", "arg_6", "in", "arg_0", ".", "_children", ":", "if", "arg_6", ".", "tagname", "==", "arg_1", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Helper function to determine if this node matches the given predicate.\n        \"\"\"\n        if not arg_1:\n            return True\n        # Strip off the [ and ]\n        arg_1 = arg_1[1:-1]\n        if arg_1.startswith('@'):\n            # An attribute predicate checks the existence (and optionally value) of an attribute on this tag.\n            arg_1 = arg_1[1:]\n            if '=' in arg_1:\n                arg_2, arg_3 = arg_1.split('=', 1)\n                if arg_3[0] in ('\"', \"'\"):\n                    arg_3 = arg_3[1:]\n                if arg_3[-1] in ('\"', \"'\"):\n                    arg_3 = arg_3[:-1]\n                return arg_0.attrs.get(arg_2) == arg_3\n            else:\n                return arg_1 in arg_0.attrs\n        elif num_re.match(arg_1):\n            # An index predicate checks whether we are the n-th child of our parent (0-based).\n            arg_4 = int(arg_1)\n            if arg_4 < 0:\n                if arg_0.parent:\n                    # For negative indexes, count from the end of the list.\n                    return arg_0.index == (len(arg_0.parent._children) + arg_4)\n                else:\n                    # If we're the root node, the only index we could be is 0.\n                    return arg_4 == 0\n            else:\n                return arg_4 == arg_0.index\n        else:\n            if '=' in arg_1:\n                arg_5, arg_3 = arg_1.split('=', 1)\n                if arg_3[0] in ('\"', \"'\"):\n                    arg_3 = arg_3[1:]\n                if arg_3[-1] in ('\"', \"'\"):\n                    arg_3 = arg_3[:-1]\n                for arg_6 in arg_0._children:\n                    if arg_6.tagname == arg_5 and arg_6.data == arg_3:\n                        return True\n            else:\n                # A plain [tag] predicate means we match if we have a child with tagname \"tag\".\n                for arg_6 in arg_0._children:\n                    if arg_6.tagname == arg_1:\n                        return True\n        return False", "path": "drill.py", "identifier": "XmlElement._match", "docstring": "Helper function to determine if this node matches the given predicate.", "docstring_tokens": ["Helper", "function", "to", "determine", "if", "this", "node", "matches", "the", "given", "predicate", "."], "nwo": "dcwatson/drill", "score": 0.14991498758945482, "idx": 259446}
{"url": "https://github.com/hivetech/dna/blob/50ad00031be29765b2576fa407d35a36e0608de9/python/dna/time_utils.py#L19-L39", "sha": "50ad00031be29765b2576fa407d35a36e0608de9", "docstring_summary": "Dates can be defined in many ways, but zipline use\n    aware datetime objects only. Plus, the software work\n    with utc timezone so we convert it.", "language": "python", "parameters": "(date)", "return_statement": "return date", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "int", ")", ":", "arg_0", "=", "time", ".", "strftime", "(", "'%Y-%m-%d %H:%M:%S'", ",", "time", ".", "localtime", "(", "arg_0", ")", ")", "if", "isinstance", "(", "arg_0", ",", "str", ")", "or", "isinstance", "(", "arg_0", ",", "unicode", ")", ":", "arg_0", "=", "dateutil", ".", "parser", ".", "parse", "(", "arg_0", ")", "if", "not", "arg_0", ".", "tzinfo", ":", "arg_1", "=", "pytz", ".", "timezone", "(", "_detect_timezone", "(", ")", ")", "arg_2", "=", "arg_1", ".", "localize", "(", "arg_0", ",", "is_dst", "=", "None", ")", "arg_0", "=", "arg_2", ".", "astimezone", "(", "pytz", ".", "utc", ")", "+", "pd", ".", "datetools", ".", "day", "return", "arg_0"], "function": "def Func(arg_0):\n    '''\n    Dates can be defined in many ways, but zipline use\n    aware datetime objects only. Plus, the software work\n    with utc timezone so we convert it.\n    '''\n    if isinstance(arg_0, int):\n        # This is probably epoch time\n        arg_0 = time.strftime('%Y-%m-%d %H:%M:%S',\n                             time.localtime(arg_0))\n\n    # assert isinstance(date, str) or isinstance(date, unicode)\n    if isinstance(arg_0, str) or isinstance(arg_0, unicode):\n        arg_0 = dateutil.parser.parse(arg_0)\n    if not arg_0.tzinfo:\n        arg_1 = pytz.timezone(_detect_timezone())\n        arg_2 = arg_1.localize(arg_0, is_dst=None)\n        # TODO I'm not sure why and when I need to add a date to make it right\n        arg_0 = arg_2.astimezone(pytz.utc) + pd.datetools.day\n\n    return arg_0", "path": "python/dna/time_utils.py", "identifier": "normalize_date_format", "docstring": "Dates can be defined in many ways, but zipline use\n    aware datetime objects only. Plus, the software work\n    with utc timezone so we convert it.", "docstring_tokens": ["Dates", "can", "be", "defined", "in", "many", "ways", "but", "zipline", "use", "aware", "datetime", "objects", "only", ".", "Plus", "the", "software", "work", "with", "utc", "timezone", "so", "we", "convert", "it", "."], "nwo": "hivetech/dna", "score": 0.14991498758945482, "idx": 259447}
{"url": "https://github.com/jmohr/compago/blob/8cd6a2894f7b69844b1e4f367344f51a8ef07baf/examples/complex_example.py#L33-L39", "sha": "8cd6a2894f7b69844b1e4f367344f51a8ef07baf", "docstring_summary": "Mixing and matching positional args and keyword options.", "language": "python", "parameters": "(name, greeting='Hello', yell=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'Hello'", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "'%s, %s'", "%", "(", "arg_1", ",", "arg_0", ")", "if", "arg_2", ":", "print", "'%s!'", "%", "arg_3", ".", "upper", "(", ")", "else", ":", "print", "'%s.'", "%", "arg_3"], "function": "def Func(arg_0, arg_1='Hello', arg_2=False):\n    '''Mixing and matching positional args and keyword options.'''\n    arg_3 = '%s, %s' % (arg_1, arg_0)\n    if arg_2:\n        print '%s!' % arg_3.upper()\n    else:\n        print '%s.' % arg_3", "path": "examples/complex_example.py", "identifier": "mix_and_match", "docstring": "Mixing and matching positional args and keyword options.", "docstring_tokens": ["Mixing", "and", "matching", "positional", "args", "and", "keyword", "options", "."], "nwo": "jmohr/compago", "score": 0.1832591465193378, "idx": 259448}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/mixins.py#L98-L105", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Hides authenticated_fields if request context is missing or\n        user is not authenticated", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "getattr", "(", "arg_0", ".", "Meta", ",", "'authenticated_fields'", ",", "[", "]", ")", "if", "not", "arg_0", ".", "is_authenticated", "(", ")", ":", "for", "arg_2", "in", "arg_1", ":", "arg_0", ".", "fields", ".", "pop", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"Hides authenticated_fields if request context is missing or\n        user is not authenticated\"\"\"\n        arg_1 = getattr(arg_0.Meta, 'authenticated_fields', [])\n\n        if not arg_0.is_authenticated():\n            for arg_2 in arg_1:\n                arg_0.fields.pop(arg_2)", "path": "dispatch/api/mixins.py", "identifier": "DispatchModelSerializer.hide_authenticated_fields", "docstring": "Hides authenticated_fields if request context is missing or\n        user is not authenticated", "docstring_tokens": ["Hides", "authenticated_fields", "if", "request", "context", "is", "missing", "or", "user", "is", "not", "authenticated"], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 259449}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/bin/__init__.py#L165-L178", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Prompts the user to enter their seed via stdin.", "language": "python", "parameters": "()", "return_statement": "return Seed(seed) if seed else Seed.random()", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "secure_input", "(", "'Enter seed and press return (typing will not be shown).\\n'", "'If no seed is specified, a random one will be used instead.\\n'", ")", "if", "isinstance", "(", "arg_0", ",", "text_type", ")", ":", "arg_0", "=", "arg_0", ".", "encode", "(", "'ascii'", ")", "return", "Seed", "(", "arg_0", ")", "if", "arg_0", "else", "Seed", ".", "random", "(", ")"], "function": "def Func():\n        # type: () -> Seed\n        \"\"\"\n        Prompts the user to enter their seed via stdin.\n        \"\"\"\n        arg_0 = secure_input(\n            'Enter seed and press return (typing will not be shown).\\n'\n            'If no seed is specified, a random one will be used instead.\\n'\n        )\n\n        if isinstance(arg_0, text_type):\n            arg_0 = arg_0.encode('ascii')\n\n        return Seed(arg_0) if arg_0 else Seed.random()", "path": "iota/bin/__init__.py", "identifier": "IotaCommandLineApp.prompt_for_seed", "docstring": "Prompts the user to enter their seed via stdin.", "docstring_tokens": ["Prompts", "the", "user", "to", "enter", "their", "seed", "via", "stdin", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 259450}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L20-L27", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Check if pmod of source causes activity of target.", "language": "python", "parameters": "(graph: BELGraph,\n                                                source: BaseEntity,\n                                                target: BaseEntity,\n                                                key: str,\n                                                )", "return_statement": "return has_protein_modification(graph, source) and part_has_modifier(edge_data, OBJECT, ACTIVITY)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_3", ",", "arg_5", ":", "arg_6", ",", ")", "->", "bool", ":", "arg_7", "=", "arg_0", "[", "arg_2", "]", "[", "arg_4", "]", "[", "arg_5", "]", "return", "has_protein_modification", "(", "arg_0", ",", "arg_2", ")", "and", "part_has_modifier", "(", "arg_7", ",", "OBJECT", ",", "ACTIVITY", ")"], "function": "def Func(arg_0: arg_1,\n                                                arg_2: arg_3,\n                                                arg_4: arg_3,\n                                                arg_5: arg_6,\n                                                ) -> bool:\n    \"\"\"Check if pmod of source causes activity of target.\"\"\"\n    arg_7 = arg_0[arg_2][arg_4][arg_5]\n    return has_protein_modification(arg_0, arg_2) and part_has_modifier(arg_7, OBJECT, ACTIVITY)", "path": "src/pybel_tools/biogrammar/double_edges.py", "identifier": "has_protein_modification_increases_activity", "docstring": "Check if pmod of source causes activity of target.", "docstring_tokens": ["Check", "if", "pmod", "of", "source", "causes", "activity", "of", "target", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 259451}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/panel.py#L189-L200", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Delete a panel by '_id'.", "language": "python", "parameters": "(self, panel_obj)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "panel_collection", ".", "delete_one", "(", "{", "'_id'", ":", "arg_1", "[", "'_id'", "]", "}", ")", "LOG", ".", "warning", "(", "\"Deleting panel %s, version %s\"", "%", "(", "arg_1", "[", "'panel_name'", "]", ",", "arg_1", "[", "'version'", "]", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Delete a panel by '_id'.\n\n        Args:\n            panel_obj(dict)\n\n        Returns:\n            res(pymongo.DeleteResult)\n        \"\"\"\n        arg_2 = arg_0.panel_collection.delete_one({'_id': arg_1['_id']})\n        LOG.warning(\"Deleting panel %s, version %s\" % (arg_1['panel_name'], arg_1['version']))\n        return arg_2", "path": "scout/adapter/mongo/panel.py", "identifier": "PanelHandler.delete_panel", "docstring": "Delete a panel by '_id'.\n\n        Args:\n            panel_obj(dict)\n\n        Returns:\n            res(pymongo.DeleteResult)", "docstring_tokens": ["Delete", "a", "panel", "by", "_id", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259452}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L223-L230", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Disable event loop integration with wxPython.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_apps", ".", "has_key", "(", "arg_2", ")", ":", "arg_0", ".", "_apps", "[", "arg_2", "]", ".", "_in_event_loop", "=", "False", "arg_0", ".", "clear_inputhook", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Disable event loop integration with wxPython.\n\n        This merely sets PyOS_InputHook to NULL.\n        \"\"\"\n        if arg_0._apps.has_key(arg_2):\n            arg_0._apps[arg_2]._in_event_loop = False\n        arg_0.clear_inputhook()", "path": "environment/lib/python2.7/site-packages/IPython/lib/inputhook.py", "identifier": "InputHookManager.disable_wx", "docstring": "Disable event loop integration with wxPython.\n\n        This merely sets PyOS_InputHook to NULL.", "docstring_tokens": ["Disable", "event", "loop", "integration", "with", "wxPython", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259453}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/examples/lstm-chime.py#L40-L68", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Extract a single batch of data to pass to the model being trained.", "language": "python", "parameters": "(features, labels, seq_begins, seq_lengths)", "return_statement": "return [feat, labl, mask]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "max", "(", ")", "arg_5", "=", "np", ".", "zeros", "(", "(", "BATCH_SIZE", ",", "arg_4", ",", "arg_0", ".", "shape", "[", "-", "1", "]", ")", ",", "'f'", ")", "arg_6", "=", "np", ".", "zeros", "(", "(", "BATCH_SIZE", ",", "arg_4", ")", ",", "'i'", ")", "arg_7", "=", "np", ".", "zeros", "(", "(", "BATCH_SIZE", ",", "arg_4", ")", ",", "'f'", ")", "for", "arg_8", ",", "(", "arg_9", ",", "arg_4", ")", "in", "enumerate", "(", "zip", "(", "arg_2", ",", "arg_3", ")", ")", ":", "arg_5", "[", "arg_8", ",", ":", "arg_4", "]", "=", "arg_0", "[", "arg_9", ":", "arg_9", "+", "arg_4", "]", "arg_6", "[", "arg_8", ",", ":", "arg_4", "]", "=", "arg_1", "[", "arg_9", ":", "arg_9", "+", "arg_4", "]", "arg_7", "[", "arg_8", ",", ":", "arg_4", "]", "=", "1", "return", "[", "arg_5", ",", "arg_6", ",", "arg_7", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''Extract a single batch of data to pass to the model being trained.\n\n    Parameters\n    ----------\n    features, labels : ndarray\n        Arrays of the input features and target labels.\n    seq_begins : ndarray\n        Array of the start offsets of the speech segments to include.\n    seq_lengths : ndarray\n        Array of the lengths of the speech segments to include in the batch.\n\n    Returns\n    -------\n    features, labels, mask : ndarrays\n        A triple of arrays for training a network. The first element contains\n        input features, the second contains target labels, and the third\n        contains a \"mask\" consisting of ones where there is valid data and zeros\n        everywhere else.\n    '''\n    arg_4 = arg_3.max()\n    arg_5 = np.zeros((BATCH_SIZE, arg_4, arg_0.shape[-1]), 'f')\n    arg_6 = np.zeros((BATCH_SIZE, arg_4), 'i')\n    arg_7 = np.zeros((BATCH_SIZE, arg_4), 'f')\n    for arg_8, (arg_9, arg_4) in enumerate(zip(arg_2, arg_3)):\n        arg_5[arg_8, :arg_4] = arg_0[arg_9:arg_9+arg_4]\n        arg_6[arg_8, :arg_4] = arg_1[arg_9:arg_9+arg_4]\n        arg_7[arg_8, :arg_4] = 1\n    return [arg_5, arg_6, arg_7]", "path": "examples/lstm-chime.py", "identifier": "batch_at", "docstring": "Extract a single batch of data to pass to the model being trained.\n\n    Parameters\n    ----------\n    features, labels : ndarray\n        Arrays of the input features and target labels.\n    seq_begins : ndarray\n        Array of the start offsets of the speech segments to include.\n    seq_lengths : ndarray\n        Array of the lengths of the speech segments to include in the batch.\n\n    Returns\n    -------\n    features, labels, mask : ndarrays\n        A triple of arrays for training a network. The first element contains\n        input features, the second contains target labels, and the third\n        contains a \"mask\" consisting of ones where there is valid data and zeros\n        everywhere else.", "docstring_tokens": ["Extract", "a", "single", "batch", "of", "data", "to", "pass", "to", "the", "model", "being", "trained", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 259454}
{"url": "https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L2247-L2259", "sha": "2cc91060982cc8b777152e698d677cc2989bf263", "docstring_summary": "GetConsoleOriginalTitle from Win32.\n    Return str.\n    Only available on Windows Vista or higher.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", "->", "str", ":", "if", "IsNT6orHigher", ":", "arg_0", "=", "ctypes", ".", "c_wchar", "*", "MAX_PATH", "arg_1", "=", "arg_0", "(", ")", "ctypes", ".", "windll", ".", "kernel32", ".", "FuncW", "(", "arg_1", ",", "MAX_PATH", ")", "return", "arg_1", ".", "value", "else", ":", "raise", "RuntimeError", "(", "'Func is not supported on Windows XP or lower.'", ")"], "function": "def Func() -> str:\n    \"\"\"\n    Func from Win32.\n    Return str.\n    Only available on Windows Vista or higher.\n    \"\"\"\n    if IsNT6orHigher:\n        arg_0 = ctypes.c_wchar * MAX_PATH\n        arg_1 = arg_0()\n        ctypes.windll.kernel32.FuncW(arg_1, MAX_PATH)\n        return arg_1.value\n    else:\n        raise RuntimeError('Func is not supported on Windows XP or lower.')", "path": "uiautomation/uiautomation.py", "identifier": "GetConsoleOriginalTitle", "docstring": "GetConsoleOriginalTitle from Win32.\n    Return str.\n    Only available on Windows Vista or higher.", "docstring_tokens": ["GetConsoleOriginalTitle", "from", "Win32", ".", "Return", "str", ".", "Only", "available", "on", "Windows", "Vista", "or", "higher", "."], "nwo": "yinkaisheng/Python-UIAutomation-for-Windows", "score": 0.9769561204852005, "idx": 259455}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L835-L874", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Parses a file and returns a document object.\n        File, a file like object.", "language": "python", "parameters": "(self, fil)", "return_statement": "return self.doc, self.error", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "error", "=", "False", "arg_0", ".", "graph", "=", "Graph", "(", ")", "arg_0", ".", "graph", ".", "Func", "(", "file", "=", "arg_1", ",", "format", "=", "'xml'", ")", "arg_0", ".", "doc", "=", "document", ".", "Document", "(", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", "[", "'SpdxDocument'", "]", ")", ")", ":", "arg_0", ".", "Func_doc_fields", "(", "arg_5", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", "[", "'ExternalDocumentRef'", "]", ")", ")", ":", "arg_0", ".", "Func_ext_doc_ref", "(", "arg_5", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", "[", "'CreationInfo'", "]", ")", ")", ":", "arg_0", ".", "Func_creation_info", "(", "arg_5", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "RDF", ".", "type", ",", "arg_0", ".", "spdx_namespace", "[", "'Package'", "]", ")", ")", ":", "arg_0", ".", "Func_package", "(", "arg_5", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "arg_0", ".", "spdx_namespace", "[", "'referencesFile'", "]", ",", "None", ")", ")", ":", "arg_0", ".", "Func_file", "(", "arg_7", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "arg_0", ".", "spdx_namespace", "[", "'reviewed'", "]", ",", "None", ")", ")", ":", "arg_0", ".", "Func_review", "(", "arg_7", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "graph", ".", "triples", "(", "(", "None", ",", "arg_0", ".", "spdx_namespace", "[", "'annotation'", "]", ",", "None", ")", ")", ":", "arg_0", ".", "Func_annotation", "(", "arg_7", ")", "arg_8", "=", "[", "]", "arg_8", "=", "arg_0", ".", "doc", ".", "validate", "(", "arg_8", ")", "if", "not", "arg_0", ".", "error", ":", "if", "arg_8", ":", "for", "arg_9", "in", "arg_8", ":", "arg_0", ".", "logger", ".", "log", "(", "arg_9", ")", "arg_0", ".", "error", "=", "True", "return", "arg_0", ".", "doc", ",", "arg_0", ".", "error"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses a file and returns a document object.\n        File, a file like object.\n        \"\"\"\n        arg_0.error = False\n        arg_0.graph = Graph()\n        arg_0.graph.Func(file=arg_1, format='xml')\n        arg_0.doc = document.Document()\n\n        for arg_5, arg_6, arg_7 in arg_0.graph.triples((None, RDF.type, arg_0.spdx_namespace['SpdxDocument'])):\n            arg_0.Func_doc_fields(arg_5)\n\n        for arg_5, arg_6, arg_7 in arg_0.graph.triples((None, RDF.type, arg_0.spdx_namespace['ExternalDocumentRef'])):\n            arg_0.Func_ext_doc_ref(arg_5)\n\n        for arg_5, arg_6, arg_7 in arg_0.graph.triples((None, RDF.type, arg_0.spdx_namespace['CreationInfo'])):\n            arg_0.Func_creation_info(arg_5)\n\n        for arg_5, arg_6, arg_7 in arg_0.graph.triples((None, RDF.type, arg_0.spdx_namespace['Package'])):\n            arg_0.Func_package(arg_5)\n\n        for arg_5, arg_6, arg_7 in arg_0.graph.triples((None, arg_0.spdx_namespace['referencesFile'], None)):\n            arg_0.Func_file(arg_7)\n\n        for arg_5, arg_6, arg_7 in arg_0.graph.triples((None, arg_0.spdx_namespace['reviewed'], None)):\n            arg_0.Func_review(arg_7)\n\n        for arg_5, arg_6, arg_7 in arg_0.graph.triples((None, arg_0.spdx_namespace['annotation'], None)):\n            arg_0.Func_annotation(arg_7)\n\n        arg_8 = []\n        # Report extra errors if self.error is False otherwise there will be\n        # redundent messages\n        arg_8 = arg_0.doc.validate(arg_8)\n        if not arg_0.error:\n            if arg_8:\n                for arg_9 in arg_8:\n                    arg_0.logger.log(arg_9)\n                arg_0.error = True\n        return arg_0.doc, arg_0.error", "path": "spdx/parsers/rdf.py", "identifier": "Parser.parse", "docstring": "Parses a file and returns a document object.\n        File, a file like object.", "docstring_tokens": ["Parses", "a", "file", "and", "returns", "a", "document", "object", ".", "File", "a", "file", "like", "object", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 259456}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/misc/pplan_helper.py#L165-L173", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Sets a new topology context", "language": "python", "parameters": "(self, metrics_collector)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "Log", ".", "debug", "(", "\"Setting topology context\"", ")", "arg_2", "=", "arg_0", ".", "get_topology_config", "(", ")", "arg_2", ".", "update", "(", "arg_0", ".", "_get_dict_from_config", "(", "arg_0", ".", "my_component", ".", "config", ")", ")", "arg_3", "=", "arg_0", ".", "_get_task_to_comp_map", "(", ")", "arg_0", ".", "context", "=", "TopologyContextImpl", "(", "arg_2", ",", "arg_0", ".", "pplan", ".", "topology", ",", "arg_3", ",", "arg_0", ".", "my_task_id", ",", "arg_1", ",", "arg_0", ".", "topology_pex_abs_path", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Sets a new topology context\"\"\"\n    Log.debug(\"Setting topology context\")\n    arg_2 = arg_0.get_topology_config()\n    arg_2.update(arg_0._get_dict_from_config(arg_0.my_component.config))\n    arg_3 = arg_0._get_task_to_comp_map()\n    arg_0.context = TopologyContextImpl(arg_2, arg_0.pplan.topology, arg_3,\n                                       arg_0.my_task_id, arg_1,\n                                       arg_0.topology_pex_abs_path)", "path": "heron/instance/src/python/utils/misc/pplan_helper.py", "identifier": "PhysicalPlanHelper.set_topology_context", "docstring": "Sets a new topology context", "docstring_tokens": ["Sets", "a", "new", "topology", "context"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259457}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L183-L194", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Verify course ID and retrieve course details.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "cleaned_data", "[", "arg_0", ".", "Fields", ".", "COURSE", "]", ".", "strip", "(", ")", "if", "not", "arg_1", ":", "return", "None", "try", ":", "arg_2", "=", "EnrollmentApiClient", "(", ")", "return", "arg_2", ".", "get_course_details", "(", "arg_1", ")", "except", "(", "HttpClientError", ",", "HttpServerError", ")", ":", "raise", "ValidationError", "(", "ValidationMessages", ".", "INVALID_COURSE_ID", ".", "format", "(", "arg_1", "=", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Verify course ID and retrieve course details.\n        \"\"\"\n        arg_1 = arg_0.cleaned_data[arg_0.Fields.COURSE].strip()\n        if not arg_1:\n            return None\n        try:\n            arg_2 = EnrollmentApiClient()\n            return arg_2.get_course_details(arg_1)\n        except (HttpClientError, HttpServerError):\n            raise ValidationError(ValidationMessages.INVALID_COURSE_ID.format(arg_1=arg_1))", "path": "enterprise/admin/forms.py", "identifier": "ManageLearnersForm.clean_course", "docstring": "Verify course ID and retrieve course details.", "docstring_tokens": ["Verify", "course", "ID", "and", "retrieve", "course", "details", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259458}
{"url": "https://github.com/CIRCL/IP-ASN-history/blob/2e02ced01a08531a007d9cd71547c8248570de1b/server/file_splitter.py#L23-L64", "sha": "2e02ced01a08531a007d9cd71547c8248570de1b", "docstring_summary": "Split the file and return the list of filenames.", "language": "python", "parameters": "(file_to_split)", "return_statement": "return splitted_files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "+", "'_splitted'", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "os", ".", "mkdir", "(", "arg_1", ")", "arg_2", "=", "os", ".", "path", ".", "getsize", "(", "arg_0", ")", "/", "number_of_files", "+", "1", "arg_3", "=", "[", "]", "with", "open", "(", "arg_0", ",", "\"r\"", ")", "as", "f", ":", "arg_4", "=", "0", "arg_5", "=", "0", "while", "1", ":", "arg_6", "=", "arg_5", "f", ".", "seek", "(", "arg_2", ",", "os", ".", "SEEK_CUR", ")", "arg_7", "=", "f", ".", "readline", "(", ")", "if", "len", "(", "arg_7", ")", "==", "0", ":", "arg_7", "=", "f", ".", "readline", "(", ")", "while", "len", "(", "arg_7", ")", "!=", "0", "and", "arg_7", "!=", "separator", ":", "arg_7", "=", "f", ".", "readline", "(", ")", "arg_5", "=", "f", ".", "tell", "(", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "str", "(", "arg_4", ")", ")", "with", "open", "(", "arg_0", ",", "\"r\"", ")", "as", "temp", ":", "temp", ".", "seek", "(", "arg_6", ")", "arg_9", "=", "temp", ".", "read", "(", "arg_5", "-", "arg_6", ")", "open", "(", "arg_8", ",", "'w'", ")", ".", "write", "(", "arg_9", ")", "arg_3", ".", "append", "(", "arg_8", ")", "arg_4", "+=", "1", "if", "len", "(", "arg_7", ")", "==", "0", ":", "break", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n        Split the file and return the list of filenames.\n    \"\"\"\n    arg_1 = arg_0 + '_splitted'\n    if not os.path.exists(arg_1):\n        os.mkdir(arg_1)\n    arg_2 = os.path.getsize(arg_0) / number_of_files + 1\n    arg_3 = []\n    with open(arg_0, \"r\") as f:\n        arg_4 = 0\n        arg_5 = 0\n        while 1:\n            arg_6 = arg_5\n            # Jump of \"size\" from the current place in the file\n            f.seek(arg_2, os.SEEK_CUR)\n\n            # find the next separator or EOF\n            arg_7 = f.readline()\n            if len(arg_7) == 0:\n                arg_7 = f.readline()\n            while len(arg_7) != 0 and arg_7 != separator:\n                arg_7 = f.readline()\n\n            # Get the current place\n            arg_5 = f.tell()\n            arg_8 = os.path.join(arg_1, str(arg_4))\n\n            # Create the new file\n            with open(arg_0, \"r\") as temp:\n                temp.seek(arg_6)\n                # Get the text we want to put in the new file\n                arg_9 = temp.read(arg_5 - arg_6)\n                # Write the new file\n                open(arg_8, 'w').write(arg_9)\n            arg_3.append(arg_8)\n            arg_4 += 1\n\n            # End of file\n            if len(arg_7) == 0:\n                break\n    return arg_3", "path": "server/file_splitter.py", "identifier": "fsplit", "docstring": "Split the file and return the list of filenames.", "docstring_tokens": ["Split", "the", "file", "and", "return", "the", "list", "of", "filenames", "."], "nwo": "CIRCL/IP-ASN-history", "score": 0.5613988127652619, "idx": 259459}
{"url": "https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L466-L480", "sha": "1701526a91c14dc8ebc6452c45c8ec9a563a56db", "docstring_summary": "Convert the input ``size`` to human readable, short form.", "language": "python", "parameters": "(self, size, base=1000, units=' kMGTZ')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1000", ",", "arg_3", "=", "' kMGTZ'", ")", ":", "arg_4", "=", "'+'", "if", "arg_1", ">=", "0", "else", "'-'", "arg_1", "=", "abs", "(", "arg_1", ")", "if", "arg_1", "<", "1000", ":", "return", "'%s%d'", "%", "(", "arg_4", ",", "arg_1", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_3", ")", ":", "arg_7", "=", "1000", "**", "(", "arg_5", "+", "1", ")", "if", "arg_1", "<", "arg_7", ":", "return", "(", "'%s%.01f%s'", "%", "(", "arg_4", ",", "arg_1", "/", "float", "(", "arg_7", ")", "*", "arg_2", ",", "arg_6", ",", ")", ")", ".", "strip", "(", ")", "raise", "OverflowError"], "function": "def Func(arg_0, arg_1, arg_2=1000, arg_3=' kMGTZ'):\n        \"\"\"Convert the input ``size`` to Func readable, short form.\"\"\"\n        arg_4 = '+' if arg_1 >= 0 else '-'\n        arg_1 = abs(arg_1)\n        if arg_1 < 1000:\n            return '%s%d' % (arg_4, arg_1)\n        for arg_5, arg_6 in enumerate(arg_3):\n            arg_7 = 1000 ** (arg_5 + 1)\n            if arg_1 < arg_7:\n                return ('%s%.01f%s' % (\n                    arg_4,\n                    arg_1 / float(arg_7) * arg_2,\n                    arg_6,\n                )).strip()\n        raise OverflowError", "path": "diagram.py", "identifier": "Graph.human", "docstring": "Convert the input ``size`` to human readable, short form.", "docstring_tokens": ["Convert", "the", "input", "size", "to", "human", "readable", "short", "form", "."], "nwo": "tehmaze/diagram", "score": 0.5330178463252985, "idx": 259460}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/base_frontend_mixin.py#L102-L109", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Calls the frontend handler associated with the message type of the\n            given message.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'header'", "]", "[", "'msg_type'", "]", "arg_3", "=", "getattr", "(", "arg_0", ",", "'_handle_'", "+", "arg_2", ",", "None", ")", "if", "arg_3", ":", "arg_3", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Calls the frontend handler associated with the message type of the\n            given message.\n        \"\"\"\n        arg_2 = arg_1['header']['msg_type']\n        arg_3 = getattr(arg_0, '_handle_' + arg_2, None)\n        if arg_3:\n            arg_3(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/base_frontend_mixin.py", "identifier": "BaseFrontendMixin._dispatch", "docstring": "Calls the frontend handler associated with the message type of the\n            given message.", "docstring_tokens": ["Calls", "the", "frontend", "handler", "associated", "with", "the", "message", "type", "of", "the", "given", "message", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259461}
{"url": "https://github.com/codelv/enaml-web/blob/88f1131a7b3ba9e83467b4f44bc3bab6f0de7559/web/components/html.py#L154-L161", "sha": "88f1131a7b3ba9e83467b4f44bc3bab6f0de7559", "docstring_summary": "Prepare for rendering", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "setattr", "(", "arg_0", ",", "arg_2", ",", "arg_3", ")", "if", "not", "arg_0", ".", "is_initialized", ":", "arg_0", ".", "initialize", "(", ")", "if", "not", "arg_0", ".", "proxy_is_active", ":", "arg_0", ".", "activate_proxy", "(", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\" Prepare for rendering \"\"\"\n        for arg_2, arg_3 in arg_1.items():\n            setattr(arg_0, arg_2, arg_3)\n        if not arg_0.is_initialized:\n            arg_0.initialize()\n        if not arg_0.proxy_is_active:\n            arg_0.activate_proxy()", "path": "web/components/html.py", "identifier": "Tag.prepare", "docstring": "Prepare for rendering", "docstring_tokens": ["Prepare", "for", "rendering"], "nwo": "codelv/enaml-web", "score": 0.5680722283335639, "idx": 259462}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/base.py#L137-L142", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Push a new Stream into the parser.\n        All subsequent called functions will parse this new stream,\n        until the 'popStream' function is called.", "language": "python", "parameters": "(self, content: str, name: str=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_2", "=", "None", ")", ":", "arg_0", ".", "_streams", ".", "append", "(", "Stream", "(", "arg_1", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_2=None):\n        \"\"\"Push a new Stream into the parser.\n        All subsequent called functions will parse this new stream,\n        until the 'popStream' function is called.\n        \"\"\"\n        arg_0._streams.append(Stream(arg_1, arg_3))", "path": "pyrser/parsing/base.py", "identifier": "BasicParser.parsed_stream", "docstring": "Push a new Stream into the parser.\n        All subsequent called functions will parse this new stream,\n        until the 'popStream' function is called.", "docstring_tokens": ["Push", "a", "new", "Stream", "into", "the", "parser", ".", "All", "subsequent", "called", "functions", "will", "parse", "this", "new", "stream", "until", "the", "popStream", "function", "is", "called", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 259463}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/__init__.py#L41-L55", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "When I Work PUT method.", "language": "python", "parameters": "(self, url, body)", "return_statement": "return json.loads(response.data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "\"Content-Type\"", ":", "\"application/json\"", ",", "\"Accept\"", ":", "\"application/json\"", "}", "if", "arg_0", ".", "token", ":", "arg_3", "[", "\"W-Token\"", "]", "=", "\"%s\"", "%", "arg_0", ".", "token", "arg_4", "=", "WhenIWork_DAO", "(", ")", ".", "putURL", "(", "arg_1", ",", "arg_3", ",", "json", ".", "dumps", "(", "arg_2", ")", ")", "if", "not", "(", "arg_4", ".", "status", "==", "200", "or", "arg_4", ".", "status", "==", "201", "or", "arg_4", ".", "status", "==", "204", ")", ":", "raise", "DataFailureException", "(", "arg_1", ",", "arg_4", ".", "status", ",", "arg_4", ".", "data", ")", "return", "json", ".", "loads", "(", "arg_4", ".", "data", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        When I Work PUT method.\n        \"\"\"\n        arg_3 = {\"Content-Type\": \"application/json\",\n                   \"Accept\": \"application/json\"}\n        if arg_0.token:\n            arg_3[\"W-Token\"] = \"%s\" % arg_0.token\n        arg_4 = WhenIWork_DAO().putURL(arg_1, arg_3, json.dumps(arg_2))\n\n        if not (arg_4.status == 200 or arg_4.status == 201 or\n                arg_4.status == 204):\n            raise DataFailureException(arg_1, arg_4.status, arg_4.data)\n\n        return json.loads(arg_4.data)", "path": "uw_wheniwork/__init__.py", "identifier": "WhenIWork._put_resource", "docstring": "When I Work PUT method.", "docstring_tokens": ["When", "I", "Work", "PUT", "method", "."], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 259464}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L411-L417", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get default history file name based on the Shell's profile.\n        \n        The profile parameter is ignored, but must exist for compatibility with\n        the parent class.", "language": "python", "parameters": "(self, profile=None)", "return_statement": "return os.path.join(profile_dir, 'history.sqlite')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "shell", ".", "profile_dir", ".", "location", "return", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'history.sqlite'", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Get default history file name based on the Shell's profile.\n        \n        The profile parameter is ignored, but must exist for compatibility with\n        the parent class.\"\"\"\n        arg_2 = arg_0.shell.profile_dir.location\n        return os.path.join(arg_2, 'history.sqlite')", "path": "environment/lib/python2.7/site-packages/IPython/core/history.py", "identifier": "HistoryManager._get_hist_file_name", "docstring": "Get default history file name based on the Shell's profile.\n        \n        The profile parameter is ignored, but must exist for compatibility with\n        the parent class.", "docstring_tokens": ["Get", "default", "history", "file", "name", "based", "on", "the", "Shell", "s", "profile", ".", "The", "profile", "parameter", "is", "ignored", "but", "must", "exist", "for", "compatibility", "with", "the", "parent", "class", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259465}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/example_dags/example_trigger_controller_dag.py#L45-L52", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "This function decides whether or not to Trigger the remote DAG", "language": "python", "parameters": "(context, dag_run_obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "'params'", "]", "[", "'condition_param'", "]", "print", "(", "\"Controller DAG : Func = {}\"", ".", "format", "(", "arg_2", ")", ")", "if", "arg_0", "[", "'params'", "]", "[", "'condition_param'", "]", ":", "arg_1", ".", "payload", "=", "{", "'message'", ":", "arg_0", "[", "'params'", "]", "[", "'message'", "]", "}", "pp", ".", "pprint", "(", "arg_1", ".", "payload", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"This function decides whether or not to Trigger the remote DAG\"\"\"\n    arg_2 = arg_0['params']['condition_param']\n    print(\"Controller DAG : Func = {}\".format(arg_2))\n    if arg_0['params']['condition_param']:\n        arg_1.payload = {'message': arg_0['params']['message']}\n        pp.pprint(arg_1.payload)\n        return arg_1", "path": "airflow/example_dags/example_trigger_controller_dag.py", "identifier": "conditionally_trigger", "docstring": "This function decides whether or not to Trigger the remote DAG", "docstring_tokens": ["This", "function", "decides", "whether", "or", "not", "to", "Trigger", "the", "remote", "DAG"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259466}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_win32_controller.py#L475-L490", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Use a blocking stdin read", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "sys", ".", "stdin", ".", "read", "(", "1", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "'\\r'", ",", "'\\n'", ")", "return", "arg_1", "except", "WindowsError", "as", "we", ":", "if", "we", ".", "winerror", "==", "ERROR_NO_DATA", ":", "return", "None", "else", ":", "raise", "we"], "function": "def Func(arg_0):\n        \"\"\"Use a blocking stdin read\"\"\"\n        # The big problem with the blocking read is that it doesn't\n        # exit when it's supposed to in all contexts. An extra\n        # key-press may be required to trigger the exit.\n        try:\n            arg_1 = sys.stdin.read(1)\n            arg_1 = arg_1.replace('\\r', '\\n')\n            return arg_1\n        except WindowsError as we:\n            if we.winerror == ERROR_NO_DATA:\n                # This error occurs when the pipe is closed\n                return None\n            else:\n                # Otherwise let the error propagate\n                raise we", "path": "environment/lib/python2.7/site-packages/IPython/utils/_process_win32_controller.py", "identifier": "Win32ShellCommandController._stdin_raw_block", "docstring": "Use a blocking stdin read", "docstring_tokens": ["Use", "a", "blocking", "stdin", "read"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259467}
{"url": "https://github.com/chaoss/grimoirelab-kingarthur/blob/9d6a638bee68d5e5c511f045eeebf06340fd3252/arthur/scheduler.py#L211-L218", "sha": "9d6a638bee68d5e5c511f045eeebf06340fd3252", "docstring_summary": "Run thread to listen for jobs and reschedule successful ones.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "listen", "(", ")", "except", "Exception", "as", "e", ":", "logger", ".", "critical", "(", "\"JobListener instence crashed. Error: %s\"", ",", "str", "(", "e", ")", ")", "logger", ".", "critical", "(", "traceback", ".", "format_exc", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Run thread to listen for jobs and reschedule successful ones.\"\"\"\n\n        try:\n            arg_0.listen()\n        except Exception as e:\n            logger.critical(\"JobListener instence crashed. Error: %s\", str(e))\n            logger.critical(traceback.format_exc())", "path": "arthur/scheduler.py", "identifier": "_JobListener.run", "docstring": "Run thread to listen for jobs and reschedule successful ones.", "docstring_tokens": ["Run", "thread", "to", "listen", "for", "jobs", "and", "reschedule", "successful", "ones", "."], "nwo": "chaoss/grimoirelab-kingarthur", "score": 0.38190063158890913, "idx": 259468}
{"url": "https://github.com/ingolemo/python-lenses/blob/a3a6ed0a31f6674451e542e7380a8aa16e6f8edf/lenses/hooks/hook_funcs.py#L121-L155", "sha": "a3a6ed0a31f6674451e542e7380a8aa16e6f8edf", "docstring_summary": "Takes an object, a string, and a value and produces a new object\n    that is a copy of the original but with the attribute called ``name``\n    set to ``value``.", "language": "python", "parameters": "(self, name, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_0", ".", "_lens_Func", "except", "AttributeError", ":", "arg_3", "=", "copy", ".", "copy", "(", "arg_0", ")", "builtin_Func", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "return", "arg_3", "else", ":", "return", "arg_0", ".", "_lens_Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    # type: (Any, Any, Any) -> Any\n    '''Takes an object, a string, and a value and produces a new object\n    that is a copy of the original but with the attribute called ``name``\n    set to ``value``.\n\n    The following equality should hold for your definition:\n\n    .. code-block:: python\n\n        Func(obj, 'attr', obj.attr) == obj\n\n    This function is used by many lenses (particularly GetattrLens) to set\n    attributes on states even when those states do not ordinarily support\n    ``Func``. This function is designed to have a similar signature\n    as python's built-in ``Func`` except that it returns a new object\n    that has the attribute set rather than mutating the object in place.\n\n    It's what enables the ``lens.some_attribute`` functionality.\n\n    The corresponding method call for this hook is\n    ``obj._lens_Func(name, value)``.\n\n    The default implementation makes a copy of the object using\n    ``copy.copy`` and then mutates the new object by calling python's\n    built in ``Func`` on it.\n    '''\n    try:\n        arg_0._lens_Func\n    except AttributeError:\n        arg_3 = copy.copy(arg_0)\n        builtin_Func(arg_3, arg_1, arg_2)\n        return arg_3\n    else:\n        return arg_0._lens_Func(arg_1, arg_2)", "path": "lenses/hooks/hook_funcs.py", "identifier": "setattr", "docstring": "Takes an object, a string, and a value and produces a new object\n    that is a copy of the original but with the attribute called ``name``\n    set to ``value``.\n\n    The following equality should hold for your definition:\n\n    .. code-block:: python\n\n        setattr(obj, 'attr', obj.attr) == obj\n\n    This function is used by many lenses (particularly GetattrLens) to set\n    attributes on states even when those states do not ordinarily support\n    ``setattr``. This function is designed to have a similar signature\n    as python's built-in ``setattr`` except that it returns a new object\n    that has the attribute set rather than mutating the object in place.\n\n    It's what enables the ``lens.some_attribute`` functionality.\n\n    The corresponding method call for this hook is\n    ``obj._lens_setattr(name, value)``.\n\n    The default implementation makes a copy of the object using\n    ``copy.copy`` and then mutates the new object by calling python's\n    built in ``setattr`` on it.", "docstring_tokens": ["Takes", "an", "object", "a", "string", "and", "a", "value", "and", "produces", "a", "new", "object", "that", "is", "a", "copy", "of", "the", "original", "but", "with", "the", "attribute", "called", "name", "set", "to", "value", "."], "nwo": "ingolemo/python-lenses", "score": 0.34574586928217027, "idx": 259469}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L256-L275", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Get the first element in a document with the given id.  If none is\n        found, return the default argument if provided or raise KeyError\n        otherwise.", "language": "python", "parameters": "(self, id, *default)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "try", ":", "return", "_id_xpath", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "[", "0", "]", "except", "IndexError", ":", "if", "arg_2", ":", "return", "arg_2", "[", "0", "]", "else", ":", "raise", "KeyError", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, *arg_2):\n        \"\"\"\n        Get the first element in a document with the given id.  If none is\n        found, return the default argument if provided or raise KeyError\n        otherwise.\n\n        Note that there can be more than one element with the same id,\n        and this isn't uncommon in HTML documents found in the wild.\n        Browsers return only the first match, and this function does\n        the same.\n        \"\"\"\n        try:\n            # FIXME: should this check for multiple matches?\n            # browsers just return the first one\n            return _id_xpath(arg_0, arg_1=arg_1)[0]\n        except IndexError:\n            if arg_2:\n                return arg_2[0]\n            else:\n                raise KeyError(arg_1)", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py", "identifier": "HtmlMixin.get_element_by_id", "docstring": "Get the first element in a document with the given id.  If none is\n        found, return the default argument if provided or raise KeyError\n        otherwise.\n\n        Note that there can be more than one element with the same id,\n        and this isn't uncommon in HTML documents found in the wild.\n        Browsers return only the first match, and this function does\n        the same.", "docstring_tokens": ["Get", "the", "first", "element", "in", "a", "document", "with", "the", "given", "id", ".", "If", "none", "is", "found", "return", "the", "default", "argument", "if", "provided", "or", "raise", "KeyError", "otherwise", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259470}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/image.py#L140-L156", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Create a thumbnail image.", "language": "python", "parameters": "(source, outname, box, fit=True, options=None,\n                       thumb_fit_centering=(0.5, 0.5))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ",", "arg_4", "=", "None", ",", "arg_5", "=", "(", "0.5", ",", "0.5", ")", ")", ":", "arg_6", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_7", "=", "_read_image", "(", "arg_0", ")", "arg_8", "=", "arg_7", ".", "format", "if", "arg_3", ":", "arg_7", "=", "ImageOps", ".", "fit", "(", "arg_7", ",", "arg_2", ",", "PILImage", ".", "ANTIALIAS", ",", "centering", "=", "arg_5", ")", "else", ":", "arg_7", ".", "thumbnail", "(", "arg_2", ",", "PILImage", ".", "ANTIALIAS", ")", "arg_9", "=", "arg_7", ".", "format", "or", "arg_8", "or", "'JPEG'", "arg_6", ".", "debug", "(", "'Save thumnail image: %s (%s)'", ",", "arg_1", ",", "arg_9", ")", "save_image", "(", "arg_7", ",", "arg_1", ",", "arg_9", ",", "arg_4", "=", "arg_4", ",", "autoconvert", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=True, arg_4=None,\n                       arg_5=(0.5, 0.5)):\n    \"\"\"Create a thumbnail image.\"\"\"\n\n    arg_6 = logging.getLogger(__name__)\n    arg_7 = _read_image(arg_0)\n    arg_8 = arg_7.format\n\n    if arg_3:\n        arg_7 = ImageOps.fit(arg_7, arg_2, PILImage.ANTIALIAS,\n                           centering=arg_5)\n    else:\n        arg_7.thumbnail(arg_2, PILImage.ANTIALIAS)\n\n    arg_9 = arg_7.format or arg_8 or 'JPEG'\n    arg_6.debug('Save thumnail image: %s (%s)', arg_1, arg_9)\n    save_image(arg_7, arg_1, arg_9, arg_4=arg_4, autoconvert=True)", "path": "sigal/image.py", "identifier": "generate_thumbnail", "docstring": "Create a thumbnail image.", "docstring_tokens": ["Create", "a", "thumbnail", "image", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 259471}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/cpserver/checkplotserver_handlers.py#L3064-L3071", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This handles initial setup of the `RequestHandler`.", "language": "python", "parameters": "(self, executor, secret)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "executor", "=", "arg_1", "arg_0", ".", "secret", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        This handles initial setup of the `RequestHandler`.\n\n        '''\n\n        arg_0.executor = arg_1\n        arg_0.secret = arg_2", "path": "astrobase/cpserver/checkplotserver_handlers.py", "identifier": "StandaloneHandler.initialize", "docstring": "This handles initial setup of the `RequestHandler`.", "docstring_tokens": ["This", "handles", "initial", "setup", "of", "the", "RequestHandler", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 259472}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L537-L580", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Returns the representation of packing plan that will\n    be returned from Tracker.", "language": "python", "parameters": "(self, topology)", "return_statement": "return json.dumps(packingPlan)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"id\"", ":", "\"\"", ",", "\"container_plans\"", ":", "[", "]", "}", "if", "not", "arg_1", ".", "packing_plan", ":", "return", "arg_2", "arg_3", "=", "arg_1", ".", "packing_plan", ".", "container_plans", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_5", ".", "instance_plans", ":", "arg_8", "=", "{", "\"cpu\"", ":", "arg_7", ".", "resource", ".", "cpu", ",", "\"ram\"", ":", "arg_7", ".", "resource", ".", "ram", ",", "\"disk\"", ":", "arg_7", ".", "resource", ".", "disk", "}", "arg_9", "=", "{", "\"component_name\"", ":", "arg_7", ".", "component_name", ",", "\"task_id\"", ":", "arg_7", ".", "task_id", ",", "\"component_index\"", ":", "arg_7", ".", "component_index", ",", "\"instance_resources\"", ":", "arg_8", "}", "arg_6", ".", "append", "(", "arg_9", ")", "arg_10", "=", "{", "\"cpu\"", ":", "arg_5", ".", "requiredResource", ".", "cpu", ",", "\"ram\"", ":", "arg_5", ".", "requiredResource", ".", "ram", ",", "\"disk\"", ":", "arg_5", ".", "requiredResource", ".", "disk", "}", "arg_11", "=", "{", "}", "if", "arg_5", ".", "scheduledResource", ":", "arg_11", "=", "{", "\"cpu\"", ":", "arg_5", ".", "scheduledResource", ".", "cpu", ",", "\"ram\"", ":", "arg_5", ".", "scheduledResource", ".", "ram", ",", "\"disk\"", ":", "arg_5", ".", "scheduledResource", ".", "disk", "}", "arg_12", "=", "{", "\"id\"", ":", "arg_5", ".", "id", ",", "\"instances\"", ":", "arg_6", ",", "\"required_resources\"", ":", "arg_10", ",", "\"scheduled_resources\"", ":", "arg_11", "}", "arg_4", ".", "append", "(", "arg_12", ")", "arg_2", "[", "\"id\"", "]", "=", "arg_1", ".", "packing_plan", ".", "id", "arg_2", "[", "\"container_plans\"", "]", "=", "arg_4", "return", "json", ".", "dumps", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the representation of packing plan that will\n    be returned from Tracker.\n    \"\"\"\n    arg_2 = {\n        \"id\": \"\",\n        \"container_plans\": []\n    }\n\n    if not arg_1.packing_plan:\n      return arg_2\n\n    arg_3 = arg_1.packing_plan.container_plans\n\n    arg_4 = []\n    for arg_5 in arg_3:\n      arg_6 = []\n      for arg_7 in arg_5.instance_plans:\n        arg_8 = {\"cpu\": arg_7.resource.cpu,\n                              \"ram\": arg_7.resource.ram,\n                              \"disk\": arg_7.resource.disk}\n        arg_9 = {\"component_name\" : arg_7.component_name,\n                    \"task_id\" : arg_7.task_id,\n                    \"component_index\": arg_7.component_index,\n                    \"instance_resources\": arg_8}\n        arg_6.append(arg_9)\n      arg_10 = {\"cpu\": arg_5.requiredResource.cpu,\n                           \"ram\": arg_5.requiredResource.ram,\n                           \"disk\": arg_5.requiredResource.disk}\n      arg_11 = {}\n      if arg_5.scheduledResource:\n        arg_11 = {\"cpu\": arg_5.scheduledResource.cpu,\n                              \"ram\": arg_5.scheduledResource.ram,\n                              \"disk\": arg_5.scheduledResource.disk}\n      arg_12 = {\"id\": arg_5.id,\n                   \"instances\": arg_6,\n                   \"required_resources\": arg_10,\n                   \"scheduled_resources\": arg_11}\n      arg_4.append(arg_12)\n\n    arg_2[\"id\"] = arg_1.packing_plan.id\n    arg_2[\"container_plans\"] = arg_4\n    return json.dumps(arg_2)", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "Tracker.extract_packing_plan", "docstring": "Returns the representation of packing plan that will\n    be returned from Tracker.", "docstring_tokens": ["Returns", "the", "representation", "of", "packing", "plan", "that", "will", "be", "returned", "from", "Tracker", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259473}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/configparser.py#L162-L221", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Add a new variable to msaf.config", "language": "python", "parameters": "(name, doc, configparam, root=config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ")", ":", "if", "arg_3", "is", "arg_4", ":", "arg_2", ".", "fullname", "=", "arg_0", "arg_6", "=", "arg_0", ".", "split", "(", "'.'", ")", "if", "len", "(", "arg_6", ")", ">", "1", ":", "if", "not", "hasattr", "(", "arg_3", ",", "arg_6", "[", "0", "]", ")", ":", "class", "SubObj", "(", "object", ")", ":", "arg_7", "=", "True", "setattr", "(", "arg_3", ".", "__class__", ",", "arg_6", "[", "0", "]", ",", "SubObj", "(", ")", ")", "arg_8", "=", "getattr", "(", "arg_3", ",", "arg_6", "[", "0", "]", ")", "if", "(", "not", "getattr", "(", "arg_8", ",", "'_i_am_a_config_class'", ",", "False", ")", "or", "isinstance", "(", "arg_8", ",", "type", ")", ")", ":", "raise", "TypeError", "(", "'Internal config nodes must be config class instances'", ",", "arg_8", ")", "return", "Func", "(", "'.'", ".", "join", "(", "arg_6", "[", "1", ":", "]", ")", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_8", ")", "else", ":", "if", "hasattr", "(", "arg_3", ",", "arg_0", ")", ":", "raise", "AttributeError", "(", "'This name is already taken'", ",", "arg_2", ".", "fullname", ")", "arg_2", ".", "doc", "=", "arg_1", "if", "not", "callable", "(", "arg_2", ".", "default", ")", ":", "arg_2", ".", "__get__", "(", "arg_3", ",", "type", "(", "arg_3", ")", ",", "delete_key", "=", "True", ")", "else", ":", "try", ":", "fetch_val_for_key", "(", "arg_2", ".", "fullname", ")", "arg_2", ".", "__get__", "(", "arg_3", ",", "type", "(", "arg_3", ")", ",", "delete_key", "=", "True", ")", "except", "KeyError", ":", "pass", "setattr", "(", "arg_3", ".", "__class__", ",", "arg_6", "[", "0", "]", ",", "arg_2", ")", "_config_var_list", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4):\n    \"\"\"Add a new variable to msaf.config\n\n    Parameters\n    ----------\n    name: str\n        String of the form \"[section0.[section1.[etc]]]option\", containing the\n        full name for this configuration variable.\n    string: str\n        What does this variable specify?\n    configparam: `ConfigParam`\n        An object for getting and setting this configuration parameter.\n    root: object\n        Used for recursive calls -- do not provide an argument for this\n        parameter.\n    \"\"\"\n\n    # This method also performs some of the work of initializing ConfigParam\n    # instances\n\n    if arg_3 is arg_4:\n        # only set the name in the first call, not the recursive ones\n        arg_2.fullname = arg_0\n    arg_6 = arg_0.split('.')\n    if len(arg_6) > 1:\n        # set up a subobject\n        if not hasattr(arg_3, arg_6[0]):\n            # every internal node in the config tree is an instance of its own\n            # unique class\n            class SubObj(object):\n                arg_7 = True\n            setattr(arg_3.__class__, arg_6[0], SubObj())\n        arg_8 = getattr(arg_3, arg_6[0])\n        if (not getattr(arg_8, '_i_am_a_config_class', False) or\n                isinstance(arg_8, type)):\n            raise TypeError(\n                'Internal config nodes must be config class instances',\n                arg_8)\n        return Func('.'.join(arg_6[1:]), arg_1, arg_2,\n                            arg_3=arg_8)\n    else:\n        if hasattr(arg_3, arg_0):\n            raise AttributeError('This name is already taken',\n                                 arg_2.fullname)\n        arg_2.doc = arg_1\n        # Trigger a read of the value from config files and env vars\n        # This allow to filter wrong value from the user.\n        if not callable(arg_2.default):\n            arg_2.__get__(arg_3, type(arg_3), delete_key=True)\n        else:\n            # We do not want to evaluate now the default value\n            # when it is a callable.\n            try:\n                fetch_val_for_key(arg_2.fullname)\n                # The user provided a value, filter it now.\n                arg_2.__get__(arg_3, type(arg_3), delete_key=True)\n            except KeyError:\n                pass\n        setattr(arg_3.__class__, arg_6[0], arg_2)\n        _config_var_list.append(arg_2)", "path": "msaf/configparser.py", "identifier": "AddConfigVar", "docstring": "Add a new variable to msaf.config\n\n    Parameters\n    ----------\n    name: str\n        String of the form \"[section0.[section1.[etc]]]option\", containing the\n        full name for this configuration variable.\n    string: str\n        What does this variable specify?\n    configparam: `ConfigParam`\n        An object for getting and setting this configuration parameter.\n    root: object\n        Used for recursive calls -- do not provide an argument for this\n        parameter.", "docstring_tokens": ["Add", "a", "new", "variable", "to", "msaf", ".", "config"], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 259474}
{"url": "https://github.com/nickw444/nsw-fuel-api-client/blob/06bd9ae7ad094d5965fce3a9468785247e1b5a39/nsw_fuel/client.py#L34-L45", "sha": "06bd9ae7ad094d5965fce3a9468785247e1b5a39", "docstring_summary": "Fetches fuel prices for all stations.", "language": "python", "parameters": "(self)", "return_statement": "return GetFuelPricesResponse.deserialize(response.json())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "GetFuelPricesResponse", ":", "arg_1", "=", "requests", ".", "get", "(", "'{}/prices'", ".", "format", "(", "API_URL_BASE", ")", ",", "headers", "=", "arg_0", ".", "_get_headers", "(", ")", ",", "timeout", "=", "arg_0", ".", "_timeout", ",", ")", "if", "not", "arg_1", ".", "ok", ":", "raise", "FuelCheckError", ".", "create", "(", "arg_1", ")", "return", "GetFuelPricesResponse", ".", "deserialize", "(", "arg_1", ".", "json", "(", ")", ")"], "function": "def Func(arg_0) -> GetFuelPricesResponse:\n        \"\"\"Fetches fuel prices for all stations.\"\"\"\n        arg_1 = requests.get(\n            '{}/prices'.format(API_URL_BASE),\n            headers=arg_0._get_headers(),\n            timeout=arg_0._timeout,\n        )\n\n        if not arg_1.ok:\n            raise FuelCheckError.create(arg_1)\n\n        return GetFuelPricesResponse.deserialize(arg_1.json())", "path": "nsw_fuel/client.py", "identifier": "FuelCheckClient.get_fuel_prices", "docstring": "Fetches fuel prices for all stations.", "docstring_tokens": ["Fetches", "fuel", "prices", "for", "all", "stations", "."], "nwo": "nickw444/nsw-fuel-api-client", "score": 0.08529914490135834, "idx": 259475}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L1192-L1204", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert the line string points to keypoints.", "language": "python", "parameters": "(self)", "return_statement": "return [Keypoint(x=x, y=y) for (x, y) in self.coords]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "imgaug", ".", "augmentables", ".", "kps", "import", "Keypoint", "return", "[", "Keypoint", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "for", "(", "arg_1", ",", "arg_2", ")", "in", "arg_0", ".", "coords", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Convert the line string points to keypoints.\n\n        Returns\n        -------\n        list of imgaug.augmentables.kps.Keypoint\n            Points of the line string as keypoints.\n\n        \"\"\"\n        # TODO get rid of this deferred import\n        from imgaug.augmentables.kps import Keypoint\n        return [Keypoint(arg_1=arg_1, arg_2=arg_2) for (arg_1, arg_2) in arg_0.coords]", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.to_keypoints", "docstring": "Convert the line string points to keypoints.\n\n        Returns\n        -------\n        list of imgaug.augmentables.kps.Keypoint\n            Points of the line string as keypoints.", "docstring_tokens": ["Convert", "the", "line", "string", "points", "to", "keypoints", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259476}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L412-L467", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Get the first payload item matching the given class\n        and optional key.", "language": "python", "parameters": "(self, payload_class, payload_key = None,\n                                                        specialize = False)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "if", "arg_0", ".", "_payload", "is", "None", ":", "arg_0", ".", "decode_payload", "(", ")", "if", "arg_1", "is", "None", ":", "if", "arg_0", ".", "_payload", ":", "arg_4", "=", "arg_0", ".", "_payload", "[", "0", "]", "if", "arg_3", "and", "isinstance", "(", "arg_4", ",", "XMLPayload", ")", ":", "arg_5", "=", "payload_class_for_element_name", "(", "arg_4", ".", "element", ".", "tag", ")", "if", "arg_5", "is", "not", "XMLPayload", ":", "arg_4", "=", "arg_5", ".", "from_xml", "(", "arg_4", ".", "element", ")", "arg_0", ".", "_payload", "[", "0", "]", "=", "arg_4", "return", "arg_4", "else", ":", "return", "None", "arg_7", "=", "arg_1", ".", "_pyxmpp_payload_element_name", "for", "arg_8", ",", "arg_4", "in", "enumerate", "(", "arg_0", ".", "_payload", ")", ":", "if", "isinstance", "(", "arg_4", ",", "XMLPayload", ")", ":", "if", "arg_1", "is", "not", "XMLPayload", ":", "if", "arg_4", ".", "xml_element_name", "not", "in", "arg_7", ":", "continue", "arg_4", "=", "arg_1", ".", "from_xml", "(", "arg_4", ".", "element", ")", "elif", "not", "isinstance", "(", "arg_4", ",", "arg_1", ")", ":", "continue", "if", "arg_2", "is", "not", "None", "and", "arg_2", "!=", "arg_4", ".", "handler_key", "(", ")", ":", "continue", "arg_0", ".", "_payload", "[", "arg_8", "]", "=", "arg_4", "return", "arg_4", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2 = None,\n                                                        arg_3 = False):\n        \"\"\"Get the first payload item matching the given class\n        and optional key.\n\n        Payloads may be addressed using a specific payload class or\n        via the generic `XMLPayload` element, though the `XMLPayload`\n        representation is available only as long as the element is not\n        requested by a more specific type.\n\n        :Parameters:\n            - `payload_class`: requested payload class, a subclass of\n              `StanzaPayload`. If `None` get the first payload in whatever\n              class is available.\n            - `payload_key`: optional key for additional match. When used\n              with `payload_class` = `XMLPayload` this selects the element to\n              match\n            - `specialize`: If `True`, and `payload_class` is `None` then\n              return object of a specialized `StanzaPayload` subclass whenever\n              possible\n        :Types:\n            - `payload_class`: `StanzaPayload`\n            - `specialize`: `bool`\n\n        :Return: payload element found or `None`\n        :Returntype: `StanzaPayload`\n        \"\"\"\n        if arg_0._payload is None:\n            arg_0.decode_payload()\n        if arg_1 is None:\n            if arg_0._payload:\n                arg_4 = arg_0._payload[0]\n                if arg_3 and isinstance(arg_4, XMLPayload):\n                    arg_5 = payload_class_for_element_name(\n                                                        arg_4.element.tag)\n                    if arg_5 is not XMLPayload:\n                        arg_4 = arg_5.from_xml(arg_4.element)\n                        arg_0._payload[0] = arg_4\n                return arg_4\n            else:\n                return None\n        # pylint: disable=W0212\n        arg_7 = arg_1._pyxmpp_payload_element_name\n        for arg_8, arg_4 in enumerate(arg_0._payload):\n            if isinstance(arg_4, XMLPayload):\n                if arg_1 is not XMLPayload:\n                    if arg_4.xml_element_name not in arg_7:\n                        continue\n                    arg_4 = arg_1.from_xml(arg_4.element)\n            elif not isinstance(arg_4, arg_1):\n                continue\n            if arg_2 is not None and arg_2 != arg_4.handler_key():\n                continue\n            arg_0._payload[arg_8] = arg_4\n            return arg_4\n        return None", "path": "pyxmpp2/stanza.py", "identifier": "Stanza.get_payload", "docstring": "Get the first payload item matching the given class\n        and optional key.\n\n        Payloads may be addressed using a specific payload class or\n        via the generic `XMLPayload` element, though the `XMLPayload`\n        representation is available only as long as the element is not\n        requested by a more specific type.\n\n        :Parameters:\n            - `payload_class`: requested payload class, a subclass of\n              `StanzaPayload`. If `None` get the first payload in whatever\n              class is available.\n            - `payload_key`: optional key for additional match. When used\n              with `payload_class` = `XMLPayload` this selects the element to\n              match\n            - `specialize`: If `True`, and `payload_class` is `None` then\n              return object of a specialized `StanzaPayload` subclass whenever\n              possible\n        :Types:\n            - `payload_class`: `StanzaPayload`\n            - `specialize`: `bool`\n\n        :Return: payload element found or `None`\n        :Returntype: `StanzaPayload`", "docstring_tokens": ["Get", "the", "first", "payload", "item", "matching", "the", "given", "class", "and", "optional", "key", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259477}
{"url": "https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L1810-L1812", "sha": "2cc91060982cc8b777152e698d677cc2989bf263", "docstring_summary": "mouse_event from Win32.", "language": "python", "parameters": "(dwFlags: int, dx: int, dy: int, dwData: int, dwExtraInfo: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ",", "arg_3", ":", "arg_1", ",", "arg_4", ":", "arg_1", ",", "arg_5", ":", "arg_1", ")", "->", "None", ":", "ctypes", ".", "windll", ".", "user32", ".", "Func", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1, arg_4: arg_1, arg_5: arg_1) -> None:\n    \"\"\"Func from Win32.\"\"\"\n    ctypes.windll.user32.Func(arg_0, arg_2, arg_3, arg_4, arg_5)", "path": "uiautomation/uiautomation.py", "identifier": "mouse_event", "docstring": "mouse_event from Win32.", "docstring_tokens": ["mouse_event", "from", "Win32", "."], "nwo": "yinkaisheng/Python-UIAutomation-for-Windows", "score": 0.9769561204852005, "idx": 259478}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L159-L205", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Returns variants specified in question for a specific case.", "language": "python", "parameters": "(self, case_id, query=None, variant_ids=None, category='snv',\n                 nr_of_variants=10, skip=0, sort_key='variant_rank')", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'snv'", ",", "arg_5", "=", "10", ",", "arg_6", "=", "0", ",", "arg_7", "=", "'variant_rank'", ")", ":", "LOG", ".", "debug", "(", "\"Fetching Func from {0}\"", ".", "format", "(", "arg_1", ")", ")", "if", "arg_3", ":", "arg_5", "=", "len", "(", "arg_3", ")", "elif", "arg_5", "==", "-", "1", ":", "arg_5", "=", "0", "else", ":", "arg_5", "=", "arg_6", "+", "arg_5", "arg_8", "=", "arg_0", ".", "build_query", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_9", "=", "[", "]", "if", "arg_7", "==", "'variant_rank'", ":", "arg_9", "=", "[", "(", "'variant_rank'", ",", "pymongo", ".", "ASCENDING", ")", "]", "if", "arg_7", "==", "'rank_score'", ":", "arg_9", "=", "[", "(", "'rank_score'", ",", "pymongo", ".", "DESCENDING", ")", "]", "if", "arg_7", "==", "'position'", ":", "arg_9", "=", "[", "(", "'position'", ",", "pymongo", ".", "ASCENDING", ")", "]", "arg_10", "=", "arg_0", ".", "variant_collection", ".", "find", "(", "arg_8", ",", "arg_6", "=", "arg_6", ",", "limit", "=", "arg_5", ")", ".", "sort", "(", "arg_9", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4='snv',\n                 arg_5=10, arg_6=0, arg_7='variant_rank'):\n        \"\"\"Returns Func specified in question for a specific case.\n\n        If skip not equal to 0 skip the first n Func.\n\n        Arguments:\n            case_id(str): A string that represents the case\n            query(dict): A dictionary with querys for the database\n            variant_ids(List[str])\n            category(str): 'sv', 'str', 'snv' or 'cancer'\n            nr_of_Func(int): if -1 return all Func\n            skip(int): How many Func to skip\n            sort_key: ['variant_rank', 'rank_score', 'position']\n\n        Yields:\n            result(Iterable[Variant])\n        \"\"\"\n        LOG.debug(\"Fetching Func from {0}\".format(arg_1))\n\n        if arg_3:\n            arg_5 = len(arg_3)\n\n        elif arg_5 == -1:\n            arg_5 = 0 # This will return all Func\n\n        else:\n            arg_5 = arg_6 + arg_5\n\n        arg_8 = arg_0.build_query(arg_1, arg_2=arg_2,\n                                       arg_3=arg_3,\n                                       arg_4=arg_4)\n        arg_9 = []\n        if arg_7 == 'variant_rank':\n            arg_9 = [('variant_rank', pymongo.ASCENDING)]\n        if arg_7 == 'rank_score':\n            arg_9 = [('rank_score', pymongo.DESCENDING)]\n        if arg_7 == 'position':\n            arg_9 = [('position', pymongo.ASCENDING)]\n\n        arg_10 = arg_0.variant_collection.find(\n            arg_8,\n            arg_6=arg_6,\n            limit=arg_5\n        ).sort(arg_9)\n\n        return arg_10", "path": "scout/adapter/mongo/variant.py", "identifier": "VariantHandler.variants", "docstring": "Returns variants specified in question for a specific case.\n\n        If skip not equal to 0 skip the first n variants.\n\n        Arguments:\n            case_id(str): A string that represents the case\n            query(dict): A dictionary with querys for the database\n            variant_ids(List[str])\n            category(str): 'sv', 'str', 'snv' or 'cancer'\n            nr_of_variants(int): if -1 return all variants\n            skip(int): How many variants to skip\n            sort_key: ['variant_rank', 'rank_score', 'position']\n\n        Yields:\n            result(Iterable[Variant])", "docstring_tokens": ["Returns", "variants", "specified", "in", "question", "for", "a", "specific", "case", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259479}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/queries/current_path_query.py#L26-L54", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Returns whether this query resolves for the given session.", "language": "python", "parameters": "(self, session)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "url", ":", "arg_0", ".", "actual_path", "=", "arg_1", ".", "current_url", "else", ":", "arg_3", "=", "urlparse", "(", "arg_1", ".", "current_url", ")", "if", "arg_0", ".", "only_path", ":", "arg_0", ".", "actual_path", "=", "arg_3", ".", "path", "else", ":", "arg_4", "=", "arg_3", ".", "path", "if", "arg_3", ".", "query", ":", "arg_4", "+=", "\"?{0}\"", ".", "format", "(", "arg_3", ".", "query", ")", "arg_0", ".", "actual_path", "=", "arg_4", "if", "isregex", "(", "arg_0", ".", "expected_path", ")", ":", "return", "arg_0", ".", "expected_path", ".", "search", "(", "arg_0", ".", "actual_path", ")", "else", ":", "return", "normalize_url", "(", "arg_0", ".", "actual_path", ")", "==", "normalize_url", "(", "arg_0", ".", "expected_path", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns whether this query resolves for the given session.\n\n        Args:\n            session (Session): The session for which this query should be executed.\n\n        Returns:\n            bool: Whether this query resolves.\n        \"\"\"\n\n        if arg_0.url:\n            arg_0.actual_path = arg_1.current_url\n        else:\n            arg_3 = urlparse(arg_1.current_url)\n\n            if arg_0.only_path:\n                arg_0.actual_path = arg_3.path\n            else:\n                arg_4 = arg_3.path\n                if arg_3.query:\n                    arg_4 += \"?{0}\".format(arg_3.query)\n\n                arg_0.actual_path = arg_4\n\n        if isregex(arg_0.expected_path):\n            return arg_0.expected_path.search(arg_0.actual_path)\n        else:\n            return normalize_url(arg_0.actual_path) == normalize_url(arg_0.expected_path)", "path": "capybara/queries/current_path_query.py", "identifier": "CurrentPathQuery.resolves_for", "docstring": "Returns whether this query resolves for the given session.\n\n        Args:\n            session (Session): The session for which this query should be executed.\n\n        Returns:\n            bool: Whether this query resolves.", "docstring_tokens": ["Returns", "whether", "this", "query", "resolves", "for", "the", "given", "session", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 259480}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L889-L908", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Check if a header is in alphabetical order with the previous header.", "language": "python", "parameters": "(self, clean_lines, linenum, header_path)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "(", "arg_0", ".", "_last_header", ">", "arg_3", "and", "Match", "(", "r'^\\s*#\\s*include\\b'", ",", "arg_1", ".", "elided", "[", "arg_2", "-", "1", "]", ")", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Check if a header is in alphabetical order with the previous header.\n\n    Args:\n      clean_lines: A CleansedLines instance containing the file.\n      linenum: The number of the line to check.\n      header_path: Canonicalized header to be checked.\n\n    Returns:\n      Returns true if the header is in alphabetical order.\n    \"\"\"\n    # If previous section is different from current section, _last_header will\n    # be reset to empty string, so it's always less than current header.\n    #\n    # If previous line was a blank line, assume that the headers are\n    # intentionally sorted the way they are.\n    if (arg_0._last_header > arg_3 and\n        Match(r'^\\s*#\\s*include\\b', arg_1.elided[arg_2 - 1])):\n      return False\n    return True", "path": "third_party/python/cpplint/cpplint.py", "identifier": "_IncludeState.IsInAlphabeticalOrder", "docstring": "Check if a header is in alphabetical order with the previous header.\n\n    Args:\n      clean_lines: A CleansedLines instance containing the file.\n      linenum: The number of the line to check.\n      header_path: Canonicalized header to be checked.\n\n    Returns:\n      Returns true if the header is in alphabetical order.", "docstring_tokens": ["Check", "if", "a", "header", "is", "in", "alphabetical", "order", "with", "the", "previous", "header", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259481}
{"url": "https://github.com/stratis-storage/into-dbus-python/blob/81366049671f79116bbb81c97bf621800a2f6315/src/into_dbus_python/_xformer.py#L299-L329", "sha": "81366049671f79116bbb81c97bf621800a2f6315", "docstring_summary": "Returns a transformer function for the given signature.", "language": "python", "parameters": "(signature)", "return_statement": "return the_func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_5", "for", "(", "arg_5", ",", "arg_4", ")", "in", "Funcs", "(", "arg_0", ")", "]", "def", "the_func", "(", "arg_2", ")", ":", "if", "len", "(", "arg_2", ")", "!=", "len", "(", "arg_1", ")", ":", "raise", "IntoDPValueError", "(", "arg_2", ",", "\"objects\"", ",", "\"must have exactly %u items, has %u\"", "%", "(", "len", "(", "arg_1", ")", ",", "len", "(", "arg_2", ")", ")", ")", "return", "[", "arg_3", "for", "(", "arg_3", ",", "arg_4", ")", "in", "(", "arg_5", "(", "arg_6", ")", "for", "(", "arg_5", ",", "arg_6", ")", "in", "zip", "(", "arg_1", ",", "arg_2", ")", ")", "]", "return", "the_func"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns a transformer function for the given signature.\n\n    :param str signature: a dbus signature\n    :returns: a function to transform a list of objects to inhabit the signature\n    :rtype: (list of object) -> (list of object)\n    \"\"\"\n\n    arg_1 = [arg_5 for (arg_5, arg_4) in Funcs(arg_0)]\n\n    def the_func(arg_2):\n        \"\"\"\n        Returns the a list of objects, transformed.\n\n        :param objects: a list of objects\n        :type objects: list of object\n\n        :returns: transformed objects\n        :rtype: list of object (in dbus types)\n        \"\"\"\n        if len(arg_2) != len(arg_1):\n            raise IntoDPValueError(\n                arg_2,\n                \"objects\",\n                \"must have exactly %u items, has %u\" % \\\n                  (len(arg_1), len(arg_2))\n            )\n        return [arg_3 for (arg_3, arg_4) in (arg_5(arg_6) for (arg_5, arg_6) in zip(arg_1, arg_2))]\n\n    return the_func", "path": "src/into_dbus_python/_xformer.py", "identifier": "xformer", "docstring": "Returns a transformer function for the given signature.\n\n    :param str signature: a dbus signature\n    :returns: a function to transform a list of objects to inhabit the signature\n    :rtype: (list of object) -> (list of object)", "docstring_tokens": ["Returns", "a", "transformer", "function", "for", "the", "given", "signature", "."], "nwo": "stratis-storage/into-dbus-python", "score": 0.2751458370028208, "idx": 259482}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/merger_models.py#L153-L168", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "determines the coalescent time scale that optimizes the coalescent likelihood of the tree", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "scipy", ".", "optimize", "import", "minimize_scalar", "arg_1", "=", "arg_0", ".", "Tc", "def", "cost", "(", "arg_2", ")", ":", "arg_0", ".", "set_Tc", "(", "arg_2", ")", "return", "-", "arg_0", ".", "total_LH", "(", ")", "arg_3", "=", "minimize_scalar", "(", "cost", ",", "bounds", "=", "[", "ttconf", ".", "TINY_NUMBER", ",", "10.0", "]", ")", "if", "\"success\"", "in", "arg_3", "and", "arg_3", "[", "\"success\"", "]", ":", "arg_0", ".", "set_Tc", "(", "arg_3", "[", "'x'", "]", ")", "else", ":", "arg_0", ".", "logger", "(", "\"merger_models:optimze_Tc: optimization of coalescent time scale failed: \"", "+", "str", "(", "arg_3", ")", ",", "0", ",", "warn", "=", "True", ")", "arg_0", ".", "set_Tc", "(", "arg_1", ".", "y", ",", "T", "=", "arg_1", ".", "x", ")"], "function": "def Func(arg_0):\n        '''\n        determines the coalescent time scale that optimizes the coalescent likelihood of the tree\n        '''\n        from scipy.optimize import minimize_scalar\n        arg_1 = arg_0.Tc\n        def cost(arg_2):\n            arg_0.set_Tc(arg_2)\n            return -arg_0.total_LH()\n\n        arg_3 = minimize_scalar(cost, bounds=[ttconf.TINY_NUMBER,10.0])\n        if \"success\" in arg_3 and arg_3[\"success\"]:\n            arg_0.set_Tc(arg_3['x'])\n        else:\n            arg_0.logger(\"merger_models:optimze_Tc: optimization of coalescent time scale failed: \" + str(arg_3), 0, warn=True)\n            arg_0.set_Tc(arg_1.y, T=arg_1.x)", "path": "treetime/merger_models.py", "identifier": "Coalescent.optimize_Tc", "docstring": "determines the coalescent time scale that optimizes the coalescent likelihood of the tree", "docstring_tokens": ["determines", "the", "coalescent", "time", "scale", "that", "optimizes", "the", "coalescent", "likelihood", "of", "the", "tree"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 259483}
{"url": "https://github.com/rsennrich/Bleualign/blob/1de181dcc3257d885a2b981f751c0220c0e8958f/bleualign/score.py#L47-L64", "sha": "1de181dcc3257d885a2b981f751c0220c0e8958f", "docstring_summary": "Normalize and tokenize text. This is lifted from NIST mteval-v11a.pl.", "language": "python", "parameters": "(s)", "return_statement": "return [tok for tok in normalize3.split(s) if tok and tok != ' ']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "(", "nonorm", ")", ":", "return", "arg_0", ".", "split", "(", ")", "try", ":", "arg_0", ".", "split", "(", ")", "except", ":", "arg_0", "=", "\" \"", ".", "join", "(", "arg_0", ")", "for", "(", "arg_1", ",", "arg_2", ")", "in", "Func1", ":", "arg_0", "=", "re", ".", "sub", "(", "arg_1", ",", "arg_2", ",", "arg_0", ")", "arg_0", "=", "xml", ".", "sax", ".", "saxutils", ".", "unescape", "(", "arg_0", ",", "{", "'&quot;'", ":", "'\"'", "}", ")", "arg_0", "=", "\" %s \"", "%", "arg_0", "if", "not", "preserve_case", ":", "arg_0", "=", "arg_0", ".", "lower", "(", ")", "return", "[", "arg_3", "for", "arg_3", "in", "Func3", ".", "split", "(", "arg_0", ")", "if", "arg_3", "and", "arg_3", "!=", "' '", "]"], "function": "def Func(arg_0):\n    '''Normalize and tokenize text. This is lifted from NIST mteval-v11a.pl.'''\n    # Added to bypass NIST-style pre-processing of hyp and ref files -- wade\n    if (nonorm):\n        return arg_0.split()\n    try:\n        arg_0.split()\n    except:\n        arg_0 = \" \".join(arg_0)\n    # language-independent part:\n    for (arg_1, arg_2) in Func1:\n        arg_0 = re.sub(arg_1, arg_2, arg_0)\n    arg_0 = xml.sax.saxutils.unescape(arg_0, {'&quot;':'\"'})\n    # language-dependent part (assuming Western languages):\n    arg_0 = \" %s \" % arg_0\n    if not preserve_case:\n        arg_0 = arg_0.lower()         # this might not be identical to the original\n    return [arg_3 for arg_3 in Func3.split(arg_0) if arg_3 and arg_3 != ' ']", "path": "bleualign/score.py", "identifier": "normalize", "docstring": "Normalize and tokenize text. This is lifted from NIST mteval-v11a.pl.", "docstring_tokens": ["Normalize", "and", "tokenize", "text", ".", "This", "is", "lifted", "from", "NIST", "mteval", "-", "v11a", ".", "pl", "."], "nwo": "rsennrich/Bleualign", "score": 0.9071314655070871, "idx": 259484}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/bayesian_neural_network.py#L190-L210", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build fake MNIST-style data for unit testing.", "language": "python", "parameters": "(num_examples=10)", "return_statement": "return mnist_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "10", ")", ":", "class", "Dummy", "(", "object", ")", ":", "pass", "arg_0", "=", "10", "arg_1", "=", "Dummy", "(", ")", "arg_1", ".", "train", "=", "Dummy", "(", ")", "arg_1", ".", "train", ".", "images", "=", "np", ".", "float32", "(", "np", ".", "random", ".", "randn", "(", "arg_0", ",", "*", "IMAGE_SHAPE", ")", ")", "arg_1", ".", "train", ".", "labels", "=", "np", ".", "int32", "(", "np", ".", "random", ".", "permutation", "(", "np", ".", "arange", "(", "arg_0", ")", ")", ")", "arg_1", ".", "train", ".", "num_examples", "=", "arg_0", "arg_1", ".", "validation", "=", "Dummy", "(", ")", "arg_1", ".", "validation", ".", "images", "=", "np", ".", "float32", "(", "np", ".", "random", ".", "randn", "(", "arg_0", ",", "*", "IMAGE_SHAPE", ")", ")", "arg_1", ".", "validation", ".", "labels", "=", "np", ".", "int32", "(", "np", ".", "random", ".", "permutation", "(", "np", ".", "arange", "(", "arg_0", ")", ")", ")", "arg_1", ".", "validation", ".", "num_examples", "=", "arg_0", "return", "arg_1"], "function": "def Func(arg_0=10):\n  \"\"\"Build fake MNIST-style data for unit testing.\"\"\"\n\n  class Dummy(object):\n    pass\n\n  arg_0 = 10\n  arg_1 = Dummy()\n  arg_1.train = Dummy()\n  arg_1.train.images = np.float32(np.random.randn(\n      arg_0, *IMAGE_SHAPE))\n  arg_1.train.labels = np.int32(np.random.permutation(\n      np.arange(arg_0)))\n  arg_1.train.num_examples = arg_0\n  arg_1.validation = Dummy()\n  arg_1.validation.images = np.float32(np.random.randn(\n      arg_0, *IMAGE_SHAPE))\n  arg_1.validation.labels = np.int32(np.random.permutation(\n      np.arange(arg_0)))\n  arg_1.validation.num_examples = arg_0\n  return arg_1", "path": "tensorflow_probability/examples/bayesian_neural_network.py", "identifier": "build_fake_data", "docstring": "Build fake MNIST-style data for unit testing.", "docstring_tokens": ["Build", "fake", "MNIST", "-", "style", "data", "for", "unit", "testing", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259485}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/pass_through.py#L122-L151", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Does a bitwise compare of the two bitmaps and returns a fractonal\n    value between 0 and 1 of how similar they are.", "language": "python", "parameters": "(self, expValues, actValues, **kwargs)", "return_statement": "return numpy.array([r])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "1.0", "arg_5", "=", "int", "(", "arg_1", ".", "sum", "(", ")", ")", "arg_6", "=", "int", "(", "arg_2", ".", "sum", "(", ")", ")", "if", "arg_6", ">", "arg_5", ":", "arg_7", "=", "arg_6", "-", "arg_5", "if", "arg_7", "<", "arg_5", ":", "arg_4", "=", "1", "-", "arg_7", "/", "float", "(", "arg_5", ")", "else", ":", "arg_4", "=", "1", "/", "float", "(", "arg_7", ")", "arg_8", "=", "arg_1", "&", "arg_2", "arg_9", "=", "int", "(", "arg_8", ".", "sum", "(", ")", ")", "if", "arg_5", "==", "0", ":", "arg_10", "=", "0.0", "else", ":", "arg_10", "=", "arg_9", "/", "float", "(", "arg_5", ")", "arg_10", "=", "arg_10", "*", "arg_4", "return", "numpy", ".", "array", "(", "[", "arg_10", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n    \"\"\"\n    Does a bitwise compare of the two bitmaps and returns a fractonal\n    value between 0 and 1 of how similar they are.\n\n    - ``1`` => identical\n    - ``0`` => no overlaping bits\n\n    ``kwargs`` will have the keyword \"fractional\", which is assumed by this\n    encoder.\n    \"\"\"\n    arg_4 = 1.0\n    arg_5 = int(arg_1.sum())\n    arg_6 = int(arg_2.sum())\n    if arg_6 > arg_5:\n      arg_7 = arg_6 - arg_5\n      if arg_7 < arg_5:\n        arg_4 = 1 - arg_7/float(arg_5)\n      else:\n        arg_4 = 1/float(arg_7)\n\n    arg_8 = arg_1 & arg_2\n    arg_9 = int(arg_8.sum())\n    if arg_5 == 0:\n      arg_10 = 0.0\n    else:\n      arg_10 = arg_9/float(arg_5)\n    arg_10 = arg_10 * arg_4\n\n    return numpy.array([arg_10])", "path": "src/nupic/encoders/pass_through.py", "identifier": "PassThroughEncoder.closenessScores", "docstring": "Does a bitwise compare of the two bitmaps and returns a fractonal\n    value between 0 and 1 of how similar they are.\n\n    - ``1`` => identical\n    - ``0`` => no overlaping bits\n\n    ``kwargs`` will have the keyword \"fractional\", which is assumed by this\n    encoder.", "docstring_tokens": ["Does", "a", "bitwise", "compare", "of", "the", "two", "bitmaps", "and", "returns", "a", "fractonal", "value", "between", "0", "and", "1", "of", "how", "similar", "they", "are", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259486}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1254-L1276", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Poisson tapering window", "language": "python", "parameters": "(N, alpha=2)", "return_statement": "return w", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "2", ")", ":", "arg_2", "=", "linspace", "(", "-", "arg_0", "/", "2.", ",", "(", "arg_0", ")", "/", "2.", ",", "arg_0", ")", "arg_3", "=", "exp", "(", "-", "arg_1", "*", "abs", "(", "arg_2", ")", "/", "(", "arg_0", "/", "2.", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=2):\n    r\"\"\"Poisson tapering window\n\n    :param int N: window length\n\n    .. math:: w(n) = \\exp^{-\\alpha \\frac{|n|}{N/2} }\n\n    with :math:`-N/2 \\leq n \\leq N/2`.\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'poisson')\n        window_visu(64, 'poisson', alpha=3)\n        window_visu(64, 'poisson', alpha=4)\n\n    .. seealso:: :func:`create_window`, :class:`Window`\n    \"\"\"\n    arg_2 = linspace(-arg_0/2., (arg_0)/2., arg_0)\n    arg_3 = exp(-arg_1 * abs(arg_2)/(arg_0/2.))\n    return arg_3", "path": "src/spectrum/window.py", "identifier": "window_poisson", "docstring": "r\"\"\"Poisson tapering window\n\n    :param int N: window length\n\n    .. math:: w(n) = \\exp^{-\\alpha \\frac{|n|}{N/2} }\n\n    with :math:`-N/2 \\leq n \\leq N/2`.\n\n    .. plot::\n        :width: 80%\n        :include-source:\n\n        from spectrum import window_visu\n        window_visu(64, 'poisson')\n        window_visu(64, 'poisson', alpha=3)\n        window_visu(64, 'poisson', alpha=4)\n\n    .. seealso:: :func:`create_window`, :class:`Window`", "docstring_tokens": ["r", "Poisson", "tapering", "window"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 259487}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/data_generator.py#L250-L255", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Add values to the field i.", "language": "python", "parameters": "(self, i, numValues)", "return_statement": "return values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "(", "len", "(", "arg_0", ".", "fields", ")", ">", "arg_1", ")", "arg_3", "=", "[", "arg_0", ".", "addValueToField", "(", "arg_1", ")", "for", "n", "in", "range", "(", "arg_2", ")", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Add values to the field i.\"\"\"\n\n    assert(len(arg_0.fields)>arg_1)\n    arg_3 = [arg_0.addValueToField(arg_1) for n in range(arg_2)]\n    return arg_3", "path": "src/nupic/data/generators/data_generator.py", "identifier": "DataGenerator.addValuesToField", "docstring": "Add values to the field i.", "docstring_tokens": ["Add", "values", "to", "the", "field", "i", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259488}
{"url": "https://github.com/ankitmathur3193/song-cli/blob/ca8ccfe547e9d702313ff6d14e81ae4355989a67/song/commands/MusicWebsiteParser/MrJattParser.py#L13-L27", "sha": "ca8ccfe547e9d702313ff6d14e81ae4355989a67", "docstring_summary": "It will print the list of songs that can be downloaded", "language": "python", "parameters": "(self,html,song_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "BeautifulSoup", "(", "arg_1", ")", "arg_4", "=", "' '", ".", "join", "(", "arg_2", ")", "print", "'%s not found'", "%", "arg_4", "print", "\"But you can download any of the following songs :\"", "arg_5", "=", "arg_3", ".", "findAll", "(", "'a'", ",", "'touch'", ")", "for", "arg_6", "in", "xrange", "(", "len", "(", "arg_5", ")", "-", "1", ")", ":", "arg_7", "=", "arg_5", "[", "arg_6", "]", "arg_8", "=", "str", "(", "arg_7", ")", "arg_9", "=", "re", ".", "sub", "(", "r'<a.*/>|<span.*\">|</span>|</a>|<a.*html\">|<font.*\">|</font>'", ",", "''", ",", "arg_8", ")", "print", "arg_9"], "function": "def Func(arg_0,arg_1,arg_2):\n\t\t'''\n\t\tIt will print the list of songs that can be downloaded\n\t\t'''\n\t\t#html=self.get_html_response(url)\n\t\targ_3=BeautifulSoup(arg_1)\n\t\targ_4=' '.join(arg_2)\n\t\tprint '%s not found'%arg_4\n\t\tprint \"But you can download any of the following songs :\"\n\t\targ_5=arg_3.findAll('a','touch')\n\t\tfor arg_6 in xrange(len(arg_5)-1):\n\t\t\targ_7=arg_5[arg_6]\n\t\t\targ_8=str(arg_7)\n\t\t\targ_9=re.sub(r'<a.*/>|<span.*\">|</span>|</a>|<a.*html\">|<font.*\">|</font>','',arg_8)\n\t\t\tprint arg_9", "path": "song/commands/MusicWebsiteParser/MrJattParser.py", "identifier": "MrJattParser.missing_schema", "docstring": "It will print the list of songs that can be downloaded", "docstring_tokens": ["It", "will", "print", "the", "list", "of", "songs", "that", "can", "be", "downloaded"], "nwo": "ankitmathur3193/song-cli", "score": 0.1872672106339659, "idx": 259489}
{"url": "https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/parser_base.py#L40-L43", "sha": "3634ddabbe5d73508bcc20f4a591f86a46634e1d", "docstring_summary": "Keeps track of the furthest point in the source code the parser has reached to this point.", "language": "python", "parameters": "(self, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_0", ".", "original_text", ")", "-", "len", "(", "arg_1", ")", "arg_0", ".", "most_consumed", "=", "max", "(", "arg_2", ",", "arg_0", ".", "most_consumed", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Keeps track of the furthest point in the source code the parser has reached to this point.\"\"\"\n    arg_2 = len(arg_0.original_text) - len(arg_1)\n    arg_0.most_consumed = max(arg_2, arg_0.most_consumed)", "path": "pyebnf/parser_base.py", "identifier": "ParserBase._attempting", "docstring": "Keeps track of the furthest point in the source code the parser has reached to this point.", "docstring_tokens": ["Keeps", "track", "of", "the", "furthest", "point", "in", "the", "source", "code", "the", "parser", "has", "reached", "to", "this", "point", "."], "nwo": "treycucco/pyebnf", "score": 0.17782712273869106, "idx": 259490}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/touchstone.py#L53-L75", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "Chunk input data into valid Touchstone file rows.", "language": "python", "parameters": "(freq_vector, data_matrix, pformat)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", "=", "arg_2", ".", "upper", "(", ")", "arg_3", "=", "4", "for", "arg_4", ",", "arg_5", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ":", "arg_5", "=", "arg_5", ".", "flatten", "(", ")", "for", "arg_6", "in", "range", "(", "0", ",", "arg_5", ".", "size", ",", "arg_3", ")", ":", "arg_7", "=", "[", "arg_4", "]", "if", "not", "arg_6", "else", "[", "None", "]", "arg_8", "=", "arg_5", "[", "arg_6", ":", "arg_6", "+", "arg_3", "]", "if", "arg_2", "==", "\"MA\"", ":", "arg_9", "=", "np", ".", "abs", "(", "arg_8", ")", "arg_10", "=", "np", ".", "rad2deg", "(", "np", ".", "angle", "(", "arg_8", ")", ")", "elif", "arg_2", "==", "\"RI\"", ":", "arg_9", "=", "np", ".", "real", "(", "arg_8", ")", "arg_10", "=", "np", ".", "imag", "(", "arg_8", ")", "else", ":", "arg_9", "=", "20.0", "*", "np", ".", "log10", "(", "np", ".", "abs", "(", "arg_8", ")", ")", "arg_10", "=", "np", ".", "rad2deg", "(", "np", ".", "angle", "(", "arg_8", ")", ")", "arg_11", "=", "np", ".", "array", "(", "[", "]", ")", "for", "arg_12", ",", "arg_13", "in", "zip", "(", "arg_9", ",", "arg_10", ")", ":", "arg_11", "=", "np", ".", "concatenate", "(", "(", "arg_11", ",", "np", ".", "array", "(", "[", "arg_12", ",", "arg_13", "]", ")", ")", ")", "arg_14", "=", "np", ".", "concatenate", "(", "(", "np", ".", "array", "(", "arg_7", ")", ",", "arg_11", ")", ")", "yield", "arg_14"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Chunk input data into valid Touchstone file rows.\"\"\"\n    arg_2 = arg_2.upper()\n    arg_3 = 4\n    for arg_4, arg_5 in zip(arg_0, arg_1):\n        arg_5 = arg_5.flatten()\n        for arg_6 in range(0, arg_5.size, arg_3):\n            arg_7 = [arg_4] if not arg_6 else [None]\n            arg_8 = arg_5[arg_6 : arg_6 + arg_3]\n            if arg_2 == \"MA\":\n                arg_9 = np.abs(arg_8)\n                arg_10 = np.rad2deg(np.angle(arg_8))\n            elif arg_2 == \"RI\":\n                arg_9 = np.real(arg_8)\n                arg_10 = np.imag(arg_8)\n            else:  # elif pformat == 'DB':\n                arg_9 = 20.0 * np.log10(np.abs(arg_8))\n                arg_10 = np.rad2deg(np.angle(arg_8))\n            arg_11 = np.array([])\n            for arg_12, arg_13 in zip(arg_9, arg_10):\n                arg_11 = np.concatenate((arg_11, np.array([arg_12, arg_13])))\n            arg_14 = np.concatenate((np.array(arg_7), arg_11))\n            yield arg_14", "path": "peng/touchstone.py", "identifier": "_chunk_pars", "docstring": "Chunk input data into valid Touchstone file rows.", "docstring_tokens": ["Chunk", "input", "data", "into", "valid", "Touchstone", "file", "rows", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 259491}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/versatileimagefield.py#L124-L152", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Return a BytesIO instance of `image` cropped to `width` and `height`.", "language": "python", "parameters": "(self, image, image_format, save_kwargs,\n                      width, height)", "return_statement": "return imagefile", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "BytesIO", "(", ")", "arg_7", "=", "arg_1", ".", "getpalette", "(", ")", "arg_8", "=", "arg_0", ".", "crop_on_centerpoint", "(", "arg_1", ",", "arg_4", ",", "arg_5", ",", "arg_0", ".", "ppoi", ")", "if", "arg_2", "==", "'GIF'", ":", "arg_8", ".", "putpalette", "(", "arg_7", ")", "arg_8", ".", "save", "(", "arg_6", ",", "**", "arg_3", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                      arg_4, arg_5):\n        \"\"\"\n        Return a BytesIO instance of `image` cropped to `width` and `height`.\n\n        Cropping will first reduce an image down to its longest side\n        and then crop inwards centered on the Primary Point of Interest\n        (as specified by `self.ppoi`)\n        \"\"\"\n        arg_6 = BytesIO()\n        arg_7 = arg_1.getpalette()\n        arg_8 = arg_0.crop_on_centerpoint(\n            arg_1,\n            arg_4,\n            arg_5,\n            arg_0.ppoi\n        )\n\n        # Using ImageOps.fit on GIFs can introduce issues with their palette\n        # Solution derived from: http://stackoverflow.com/a/4905209/1149774\n        if arg_2 == 'GIF':\n            arg_8.putpalette(arg_7)\n\n        arg_8.save(\n            arg_6,\n            **arg_3\n        )\n\n        return arg_6", "path": "versatileimagefield/versatileimagefield.py", "identifier": "CroppedImage.process_image", "docstring": "Return a BytesIO instance of `image` cropped to `width` and `height`.\n\n        Cropping will first reduce an image down to its longest side\n        and then crop inwards centered on the Primary Point of Interest\n        (as specified by `self.ppoi`)", "docstring_tokens": ["Return", "a", "BytesIO", "instance", "of", "image", "cropped", "to", "width", "and", "height", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 259492}
{"url": "https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_orderedbidict.py#L41-L45", "sha": "1a1ba9758651aed9c4f58384eff006d2e2ad6835", "docstring_summary": "Remove all items.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_fwdm", ".", "Func", "(", ")", "arg_0", ".", "_invm", ".", "Func", "(", ")", "arg_0", ".", "_sntl", ".", "nxt", "=", "arg_0", ".", "_sntl", ".", "prv", "=", "arg_0", ".", "_sntl"], "function": "def Func(arg_0):\n        \"\"\"Remove all items.\"\"\"\n        arg_0._fwdm.Func()\n        arg_0._invm.Func()\n        arg_0._sntl.nxt = arg_0._sntl.prv = arg_0._sntl", "path": "bidict/_orderedbidict.py", "identifier": "OrderedBidict.clear", "docstring": "Remove all items.", "docstring_tokens": ["Remove", "all", "items", "."], "nwo": "jab/bidict", "score": 0.5840682608785344, "idx": 259493}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/models/mixins/person.py#L111-L117", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "The date and time of the person's last activity.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_json_data", ".", "get", "(", "'Func'", ")", "if", "arg_1", ":", "return", "WebexTeamsDateTime", ".", "strptime", "(", "arg_1", ")", "else", ":", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"The date and time of the person's last activity.\"\"\"\n        arg_1 = arg_0._json_data.get('Func')\n        if arg_1:\n            return WebexTeamsDateTime.strptime(arg_1)\n        else:\n            return None", "path": "webexteamssdk/models/mixins/person.py", "identifier": "PersonBasicPropertiesMixin.lastActivity", "docstring": "The date and time of the person's last activity.", "docstring_tokens": ["The", "date", "and", "time", "of", "the", "person", "s", "last", "activity", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 259494}
{"url": "https://github.com/zwischenloesung/ardu-report-lib/blob/51bd4a07e036065aafcb1273b151bea3fdfa50fa/libardurep/datareporter.py#L68-L87", "sha": "51bd4a07e036065aafcb1273b151bea3fdfa50fa", "docstring_summary": "Write to a remote host via HTTP POST", "language": "python", "parameters": "(self, url=None, credentials=None, do_verify_certificate=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "url", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "credentials", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "do_verify_certificate", "if", "arg_2", "and", "\"base64\"", "in", "arg_2", ":", "arg_4", "=", "{", "\"Content-Type\"", ":", "\"application/json\"", ",", "'Authorization'", ":", "'Basic %s'", "%", "arg_2", "[", "\"base64\"", "]", "}", "else", ":", "arg_4", "=", "{", "\"Content-Type\"", ":", "\"application/json\"", "}", "try", ":", "arg_5", "=", "requests", ".", "post", "(", "arg_1", ",", "arg_4", "=", "arg_4", ",", "data", "=", "arg_0", ".", "store", ".", "get_json", "(", ")", ",", "verify", "=", "arg_3", ")", "except", "httplib", ".", "IncompleteRead", "as", "e", ":", "arg_5", "=", "e", ".", "partial"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True):\n        \"\"\"\n        Write to a remote host via HTTP POST\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.url\n        if arg_2 is None:\n            arg_2 = arg_0.credentials\n        if arg_3 is None:\n            arg_3 = arg_0.do_verify_certificate\n        if arg_2 and \"base64\" in arg_2:\n            arg_4 = {\"Content-Type\": \"application/json\", \\\n                        'Authorization': 'Basic %s' % arg_2[\"base64\"]}\n        else:\n            arg_4 = {\"Content-Type\": \"application/json\"}\n        try:\n            arg_5 = requests.post(arg_1, arg_4=arg_4, \\\n                    data=arg_0.store.get_json(), verify=arg_3)\n        except httplib.IncompleteRead as e:\n            arg_5 = e.partial", "path": "libardurep/datareporter.py", "identifier": "DataReporter.log_post", "docstring": "Write to a remote host via HTTP POST", "docstring_tokens": ["Write", "to", "a", "remote", "host", "via", "HTTP", "POST"], "nwo": "zwischenloesung/ardu-report-lib", "score": 0.0, "idx": 259495}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L1117-L1132", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Extract DICOM metadata from the given item", "language": "python", "parameters": "(self, token, item_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "dict", "(", ")", "arg_3", "[", "'token'", "]", "=", "arg_1", "arg_3", "[", "'item'", "]", "=", "arg_2", "arg_4", "=", "arg_0", ".", "request", "(", "'midas.dicomextractor.extract'", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Extract DICOM metadata from the given item\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param item_id: id of the item to be extracted\n        :type item_id: int | long\n        :return: the item revision DAO\n        :rtype: dict\n        \"\"\"\n        arg_3 = dict()\n        arg_3['token'] = arg_1\n        arg_3['item'] = arg_2\n        arg_4 = arg_0.request('midas.dicomextractor.extract', arg_3)\n        return arg_4", "path": "pydas/drivers.py", "identifier": "DicomextractorDriver.extract_dicommetadata", "docstring": "Extract DICOM metadata from the given item\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param item_id: id of the item to be extracted\n        :type item_id: int | long\n        :return: the item revision DAO\n        :rtype: dict", "docstring_tokens": ["Extract", "DICOM", "metadata", "from", "the", "given", "item"], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 259496}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/events.py#L118-L157", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Get the next event from the queue and pass it to\n        the appropriate handlers.", "language": "python", "parameters": "(self, block = False, timeout = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "logger", ".", "debug", "(", "\" Funcing...\"", ")", "try", ":", "arg_3", "=", "arg_0", ".", "queue", ".", "get", "(", "arg_1", ",", "arg_2", ")", "except", "Queue", ".", "Empty", ":", "logger", ".", "debug", "(", "\"    queue empty\"", ")", "return", "None", "try", ":", "logger", ".", "debug", "(", "\"    event: {0!r}\"", ".", "format", "(", "arg_3", ")", ")", "if", "arg_3", "is", "QUIT", ":", "return", "QUIT", "arg_4", "=", "list", "(", "arg_0", ".", "_handler_map", "[", "None", "]", ")", "arg_5", "=", "arg_3", ".", "__class__", "if", "arg_5", "in", "arg_0", ".", "_handler_map", ":", "arg_4", "+=", "arg_0", ".", "_handler_map", "[", "arg_5", "]", "logger", ".", "debug", "(", "\"    handlers: {0!r}\"", ".", "format", "(", "arg_4", ")", ")", "arg_4", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ")", "for", "arg_6", ",", "arg_7", "in", "arg_4", ":", "logger", ".", "debug", "(", "u\"  passing the event to: {0!r}\"", ".", "format", "(", "arg_7", ")", ")", "arg_8", "=", "arg_7", "(", "arg_3", ")", "if", "isinstance", "(", "arg_8", ",", "Event", ")", ":", "arg_0", ".", "queue", ".", "put", "(", "arg_8", ")", "elif", "arg_8", "and", "arg_3", "is", "not", "QUIT", ":", "return", "arg_3", "return", "arg_3", "finally", ":", "arg_0", ".", "queue", ".", "task_done", "(", ")"], "function": "def Func(arg_0, arg_1 = False, arg_2 = None):\n        \"\"\"Get the next event from the queue and pass it to\n        the appropriate handlers.\n\n        :Parameters:\n            - `block`: wait for event if the queue is empty\n            - `timeout`: maximum time, in seconds, to wait if `block` is `True`\n        :Types:\n            - `block`: `bool`\n            - `timeout`: `float`\n\n        :Return: the event handled (may be `QUIT`) or `None`\n        \"\"\"\n        logger.debug(\" Funcing...\")\n        try:\n            arg_3 = arg_0.queue.get(arg_1, arg_2)\n        except Queue.Empty:\n            logger.debug(\"    queue empty\")\n            return None\n        try:\n            logger.debug(\"    event: {0!r}\".format(arg_3))\n            if arg_3 is QUIT:\n                return QUIT\n            arg_4 = list(arg_0._handler_map[None])\n            arg_5 = arg_3.__class__\n            if arg_5 in arg_0._handler_map:\n                arg_4 += arg_0._handler_map[arg_5]\n            logger.debug(\"    handlers: {0!r}\".format(arg_4))\n            # to restore the original order of handler objects\n            arg_4.sort(key = lambda x: x[0])\n            for arg_6, arg_7 in arg_4:\n                logger.debug(u\"  passing the event to: {0!r}\".format(arg_7))\n                arg_8 = arg_7(arg_3)\n                if isinstance(arg_8, Event):\n                    arg_0.queue.put(arg_8)\n                elif arg_8 and arg_3 is not QUIT:\n                    return arg_3\n            return arg_3\n        finally:\n            arg_0.queue.task_done()", "path": "pyxmpp2/mainloop/events.py", "identifier": "EventDispatcher.dispatch", "docstring": "Get the next event from the queue and pass it to\n        the appropriate handlers.\n\n        :Parameters:\n            - `block`: wait for event if the queue is empty\n            - `timeout`: maximum time, in seconds, to wait if `block` is `True`\n        :Types:\n            - `block`: `bool`\n            - `timeout`: `float`\n\n        :Return: the event handled (may be `QUIT`) or `None`", "docstring_tokens": ["Get", "the", "next", "event", "from", "the", "queue", "and", "pass", "it", "to", "the", "appropriate", "handlers", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259497}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/mac_address_ranges.py#L120-L136", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Delete a mac_address_range.", "language": "python", "parameters": "(context, id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "\"Func %s for tenant %s\"", "%", "(", "arg_1", ",", "arg_0", ".", "tenant_id", ")", ")", "if", "not", "arg_0", ".", "is_admin", ":", "raise", "n_exc", ".", "NotAuthorized", "(", ")", "with", "arg_0", ".", "session", ".", "begin", "(", ")", ":", "arg_2", "=", "db_api", ".", "mac_address_range_find", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "scope", "=", "db_api", ".", "ONE", ")", "if", "not", "arg_2", ":", "raise", "q_exc", ".", "MacAddressRangeNotFound", "(", "mac_address_range_id", "=", "arg_1", ")", "_Func", "(", "arg_0", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Delete a mac_address_range.\n\n    : param context: neutron api request context\n    : param id: UUID representing the mac_address_range to delete.\n    \"\"\"\n    LOG.info(\"Func %s for tenant %s\" %\n             (arg_1, arg_0.tenant_id))\n    if not arg_0.is_admin:\n        raise n_exc.NotAuthorized()\n\n    with arg_0.session.begin():\n        arg_2 = db_api.mac_address_range_find(arg_0, arg_1=arg_1, scope=db_api.ONE)\n        if not arg_2:\n            raise q_exc.MacAddressRangeNotFound(\n                mac_address_range_id=arg_1)\n        _Func(arg_0, arg_2)", "path": "quark/plugin_modules/mac_address_ranges.py", "identifier": "delete_mac_address_range", "docstring": "Delete a mac_address_range.\n\n    : param context: neutron api request context\n    : param id: UUID representing the mac_address_range to delete.", "docstring_tokens": ["Delete", "a", "mac_address_range", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 259498}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/parsimonious.py#L74-L105", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Add pFBA objective", "language": "python", "parameters": "(model, objective=None, fraction_of_optimum=1.0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "1.0", ")", ":", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "objective", "=", "arg_1", "if", "arg_0", ".", "solver", ".", "objective", ".", "name", "==", "'_pfba_objective'", ":", "raise", "ValueError", "(", "'The model already has a pFBA objective.'", ")", "sutil", ".", "fix_objective_as_constraint", "(", "arg_0", ",", "fraction", "=", "arg_2", ")", "arg_3", "=", "(", "(", "rxn", ".", "forward_variable", ",", "rxn", ".", "reverse_variable", ")", "for", "rxn", "in", "arg_0", ".", "reactions", ")", "arg_4", "=", "chain", "(", "*", "arg_3", ")", "arg_0", ".", "objective", "=", "arg_0", ".", "problem", ".", "Objective", "(", "Zero", ",", "direction", "=", "'min'", ",", "sloppy", "=", "True", ",", "name", "=", "\"_pfba_objective\"", ")", "arg_0", ".", "objective", ".", "set_linear_coefficients", "(", "{", "arg_5", ":", "1.0", "for", "arg_5", "in", "arg_4", "}", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=1.0):\n    \"\"\"Add pFBA objective\n\n    Add objective to minimize the summed flux of all reactions to the\n    current objective.\n\n    See Also\n    -------\n    pfba\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The model to add the objective to\n    objective :\n        An objective to set in combination with the pFBA objective.\n    fraction_of_optimum : float\n        Fraction of optimum which must be maintained. The original objective\n        reaction is constrained to be greater than maximal_value *\n        fraction_of_optimum.\n    \"\"\"\n    if arg_1 is not None:\n        arg_0.objective = arg_1\n    if arg_0.solver.objective.name == '_pfba_objective':\n        raise ValueError('The model already has a pFBA objective.')\n    sutil.fix_objective_as_constraint(arg_0, fraction=arg_2)\n    arg_3 = ((rxn.forward_variable, rxn.reverse_variable)\n                          for rxn in arg_0.reactions)\n    arg_4 = chain(*arg_3)\n    arg_0.objective = arg_0.problem.Objective(\n        Zero, direction='min', sloppy=True, name=\"_pfba_objective\")\n    arg_0.objective.set_linear_coefficients({arg_5: 1.0 for arg_5 in arg_4})", "path": "cobra/flux_analysis/parsimonious.py", "identifier": "add_pfba", "docstring": "Add pFBA objective\n\n    Add objective to minimize the summed flux of all reactions to the\n    current objective.\n\n    See Also\n    -------\n    pfba\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The model to add the objective to\n    objective :\n        An objective to set in combination with the pFBA objective.\n    fraction_of_optimum : float\n        Fraction of optimum which must be maintained. The original objective\n        reaction is constrained to be greater than maximal_value *\n        fraction_of_optimum.", "docstring_tokens": ["Add", "pFBA", "objective"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259499}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/regression.py#L474-L486", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build regression weights from model parameters.", "language": "python", "parameters": "(self,\n                        global_scale_variance,\n                        global_scale_noncentered,\n                        local_scale_variances,\n                        local_scales_noncentered,\n                        weights_noncentered)", "return_statement": "return weights_noncentered * local_scales * global_scale[..., tf.newaxis]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "(", "arg_2", "*", "tf", ".", "sqrt", "(", "arg_1", ")", "*", "arg_0", ".", "weights_prior_scale", ")", "arg_7", "=", "arg_4", "*", "tf", ".", "sqrt", "(", "arg_3", ")", "return", "arg_5", "*", "arg_7", "*", "arg_6", "[", "...", ",", "tf", ".", "newaxis", "]"], "function": "def Func(arg_0,\n                        arg_1,\n                        arg_2,\n                        arg_3,\n                        arg_4,\n                        arg_5):\n    \"\"\"Build regression weights from model parameters.\"\"\"\n    arg_6 = (arg_2 *\n                    tf.sqrt(arg_1) *\n                    arg_0.weights_prior_scale)\n\n    arg_7 = arg_4 * tf.sqrt(arg_3)\n    return arg_5 * arg_7 * arg_6[..., tf.newaxis]", "path": "tensorflow_probability/python/sts/regression.py", "identifier": "SparseLinearRegression.params_to_weights", "docstring": "Build regression weights from model parameters.", "docstring_tokens": ["Build", "regression", "weights", "from", "model", "parameters", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259500}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/scripts.py#L409-L433", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Return `call` formatted appropriately for `args`.", "language": "python", "parameters": "(call, args)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "''", "if", "arg_1", ".", "source", ":", "arg_2", "+=", "arg_0", ".", "annotation", "(", ")", "+", "'\\n'", "if", "arg_1", ".", "only_keys", ":", "arg_2", "+=", "arg_0", ".", "get_key", "(", ")", "return", "arg_2", "if", "arg_1", ".", "view_call", ":", "arg_2", "+=", "arg_0", ".", "as_call", "(", ")", "elif", "arg_1", ".", "load_configs", ":", "arg_2", "+=", "arg_0", ".", "as_live", "(", ")", "else", ":", "arg_2", "+=", "arg_0", ".", "as_namespace", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Return `call` formatted appropriately for `args`.\n\n    :param call: A pyconfig call object\n    :param args: Arguments from the command\n    :type call: :class:`_PyconfigCall`\n\n    \"\"\"\n    arg_2 = ''\n    if arg_1.source:\n        arg_2 += arg_0.annotation() + '\\n'\n\n    if arg_1.only_keys:\n        arg_2 += arg_0.get_key()\n        return arg_2\n\n    if arg_1.view_call:\n        arg_2 += arg_0.as_call()\n    elif arg_1.load_configs:\n        arg_2 += arg_0.as_live()\n    else:\n        arg_2 += arg_0.as_namespace()\n\n    return arg_2", "path": "pyconfig/scripts.py", "identifier": "_format_call", "docstring": "Return `call` formatted appropriately for `args`.\n\n    :param call: A pyconfig call object\n    :param args: Arguments from the command\n    :type call: :class:`_PyconfigCall`", "docstring_tokens": ["Return", "call", "formatted", "appropriately", "for", "args", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 259501}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1499-L1520", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "This method is called to create the default `OPTIONS` response.\n        This can be changed through subclassing to change the default\n        behavior of `OPTIONS` responses.", "language": "python", "parameters": "(self)", "return_statement": "return rv", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_request_ctx_stack", ".", "top", ".", "url_adapter", "if", "hasattr", "(", "arg_1", ",", "'allowed_methods'", ")", ":", "arg_2", "=", "arg_1", ".", "allowed_methods", "(", ")", "else", ":", "arg_2", "=", "[", "]", "try", ":", "arg_1", ".", "match", "(", "method", "=", "'--'", ")", "except", "MethodNotAllowed", "as", "e", ":", "arg_2", "=", "e", ".", "valid_methods", "except", "HTTPException", "as", "e", ":", "pass", "arg_3", "=", "arg_0", ".", "response_class", "(", ")", "arg_3", ".", "allow", ".", "update", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"This method is called to create the default `OPTIONS` response.\n        This can be changed through subclassing to change the default\n        behavior of `OPTIONS` responses.\n\n        .. versionadded:: 0.7\n        \"\"\"\n        arg_1 = _request_ctx_stack.top.url_adapter\n        if hasattr(arg_1, 'allowed_methods'):\n            arg_2 = arg_1.allowed_methods()\n        else:\n            # fallback for Werkzeug < 0.7\n            arg_2 = []\n            try:\n                arg_1.match(method='--')\n            except MethodNotAllowed as e:\n                arg_2 = e.valid_methods\n            except HTTPException as e:\n                pass\n        arg_3 = arg_0.response_class()\n        arg_3.allow.update(arg_2)\n        return arg_3", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/app.py", "identifier": "Flask.make_default_options_response", "docstring": "This method is called to create the default `OPTIONS` response.\n        This can be changed through subclassing to change the default\n        behavior of `OPTIONS` responses.\n\n        .. versionadded:: 0.7", "docstring_tokens": ["This", "method", "is", "called", "to", "create", "the", "default", "OPTIONS", "response", ".", "This", "can", "be", "changed", "through", "subclassing", "to", "change", "the", "default", "behavior", "of", "OPTIONS", "responses", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259502}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/usb.py#L115-L121", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "TARGET power button", "language": "python", "parameters": "(self, interval=200)", "return_statement": "return self.__press(self.__power_btn_port, interval=interval)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "200", ")", ":", "if", "arg_0", ".", "__Func_port", "is", "None", ":", "cij", ".", "err", "(", "\"cij.usb.relay: Invalid USB_RELAY_POWER_BTN\"", ")", "return", "1", "return", "arg_0", ".", "__press", "(", "arg_0", ".", "__Func_port", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=200):\n        \"\"\"TARGET power button\"\"\"\n        if arg_0.__Func_port is None:\n            cij.err(\"cij.usb.relay: Invalid USB_RELAY_POWER_BTN\")\n            return 1\n\n        return arg_0.__press(arg_0.__Func_port, arg_1=arg_1)", "path": "modules/cij/usb.py", "identifier": "Relay.power_btn", "docstring": "TARGET power button", "docstring_tokens": ["TARGET", "power", "button"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 259503}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/kumaraswamy.py#L40-L55", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Compute the harmonic number from its analytic continuation.", "language": "python", "parameters": "(x)", "return_statement": "return tf.math.digamma(x + one) - tf.math.digamma(one)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tf", ".", "ones", "(", "[", "]", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "return", "tf", ".", "math", ".", "digamma", "(", "arg_0", "+", "arg_1", ")", "-", "tf", ".", "math", ".", "digamma", "(", "arg_1", ")"], "function": "def Func(arg_0):\n  \"\"\"Compute the harmonic number from its analytic continuation.\n\n  Derivation from [here](\n  https://en.wikipedia.org/wiki/Digamma_function#Relation_toFuncs)\n  and [Euler's constant](\n  https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant).\n\n  Args:\n    x: input float.\n\n  Returns:\n    z: The analytic continuation of the harmonic number for the input.\n  \"\"\"\n  arg_1 = tf.ones([], dtype=arg_0.dtype)\n  return tf.math.digamma(arg_0 + arg_1) - tf.math.digamma(arg_1)", "path": "tensorflow_probability/python/distributions/kumaraswamy.py", "identifier": "_harmonic_number", "docstring": "Compute the harmonic number from its analytic continuation.\n\n  Derivation from [here](\n  https://en.wikipedia.org/wiki/Digamma_function#Relation_to_harmonic_numbers)\n  and [Euler's constant](\n  https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant).\n\n  Args:\n    x: input float.\n\n  Returns:\n    z: The analytic continuation of the harmonic number for the input.", "docstring_tokens": ["Compute", "the", "harmonic", "number", "from", "its", "analytic", "continuation", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259504}
{"url": "https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L151-L192", "sha": "77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc", "docstring_summary": "Update a Label", "language": "python", "parameters": "(self, label)", "return_statement": "return self._post(\n            request=ApiActions.UPDATE.value,\n            uri=ApiUri.TAGS.value,\n            params=data\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'id'", ":", "arg_1", "[", "'id'", "]", ",", "'name'", ":", "arg_1", "[", "'name'", "]", ",", "'appearance'", ":", "arg_1", "[", "'appearance'", "]", ",", "'description'", ":", "arg_1", "[", "'description'", "]", ",", "'title'", ":", "arg_1", "[", "'title'", "]", ",", "}", "return", "arg_0", ".", "_post", "(", "request", "=", "ApiActions", ".", "UPDATE", ".", "value", ",", "uri", "=", "ApiUri", ".", "TAGS", ".", "value", ",", "params", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Update a Label\n\n        :param label: The data to Func. Must include keys:\n\n            * id (str)\n            * appearance (dict)\n            * description (str)\n            * name (str)\n            * title (str)\n        :type label: dict\n\n        Example:\n\n        .. code-block:: python\n\n            Labels().Func(\n                label={\n                    'id': 'd9d4596e-49e4-4135-b3b3-847f9e7c1f43',\n                    'appearance': {'color': '278abe'},\n                    'name': 'My Sandbox',\n                    'description': 'My Sandbox',\n                    'title': 'My Sandbox',\n                }\n            )\n\n        :return:\n        :rtype: dict\n        \"\"\"\n        arg_2 = {\n            'id': arg_1['id'],\n            'name': arg_1['name'],\n            'appearance': arg_1['appearance'],\n            'description': arg_1['description'],\n            'title': arg_1['title'],\n        }\n        return arg_0._post(\n            request=ApiActions.UPDATE.value,\n            uri=ApiUri.TAGS.value,\n            params=arg_2\n        )", "path": "logentries_api/resources.py", "identifier": "Labels.update", "docstring": "Update a Label\n\n        :param label: The data to update. Must include keys:\n\n            * id (str)\n            * appearance (dict)\n            * description (str)\n            * name (str)\n            * title (str)\n        :type label: dict\n\n        Example:\n\n        .. code-block:: python\n\n            Labels().update(\n                label={\n                    'id': 'd9d4596e-49e4-4135-b3b3-847f9e7c1f43',\n                    'appearance': {'color': '278abe'},\n                    'name': 'My Sandbox',\n                    'description': 'My Sandbox',\n                    'title': 'My Sandbox',\n                }\n            )\n\n        :return:\n        :rtype: dict", "docstring_tokens": ["Update", "a", "Label"], "nwo": "ambitioninc/python-logentries-api", "score": 0.17821439704321745, "idx": 259505}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/utils.py#L30-L56", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Runs a subprocess with a PTY attached via fork and exec.\n    The output from the PTY is streamed through log_to_client.\n    This should not be necessary for most subprocesses, we\n    built this to handle Compose up which only streams pull\n    progress if it is attached to a TTY.", "language": "python", "parameters": "(*args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "copy", "(", "os", ".", "environ", ")", "arg_1", ".", "update", "(", "get_docker_env", "(", ")", ")", "arg_0", "+=", "(", "arg_1", ",", ")", "arg_2", "=", "arg_0", "[", "0", "]", "arg_3", "=", "demote_to_user", "(", "get_config_value", "(", "constants", ".", "CONFIG_MAC_USERNAME_KEY", ")", ")", "arg_4", ",", "arg_5", "=", "pty", ".", "fork", "(", ")", "if", "arg_4", "==", "0", ":", "arg_3", "(", ")", "os", ".", "execle", "(", "_executable_path", "(", "arg_2", ")", ",", "*", "arg_0", ")", "else", ":", "arg_6", "=", "psutil", ".", "Process", "(", "arg_4", ")", "arg_7", "=", "os", ".", "fdopen", "(", "arg_5", ",", "'r'", ",", "0", ")", "with", "streaming_to_client", "(", ")", ":", "while", "arg_6", ".", "status", "(", ")", "==", "'running'", ":", "arg_8", "=", "arg_7", ".", "read", "(", "1", ")", "log_to_client", "(", "arg_8", ")", "arg_9", ",", "arg_10", "=", "os", ".", "waitpid", "(", "arg_4", ",", "0", ")", "if", "arg_10", "!=", "0", ":", "raise", "subprocess", ".", "CalledProcessError", "(", "arg_10", ",", "' '", ".", "join", "(", "arg_0", "[", ":", "-", "1", "]", ")", ")"], "function": "def Func(*arg_0):\n    \"\"\"Runs a subprocess with a PTY attached via fork and exec.\n    The output from the PTY is streamed through log_to_client.\n    This should not be necessary for most subprocesses, we\n    built this to handle Compose up which only streams pull\n    progress if it is attached to a TTY.\"\"\"\n\n    arg_1 = copy(os.environ)\n    arg_1.update(get_docker_env())\n    arg_0 += (arg_1,)\n    arg_2 = arg_0[0]\n    arg_3 = demote_to_user(get_config_value(constants.CONFIG_MAC_USERNAME_KEY))\n\n    arg_4, arg_5 = pty.fork()\n    if arg_4 == 0:\n        arg_3()\n        os.execle(_executable_path(arg_2), *arg_0)\n    else:\n        arg_6 = psutil.Process(arg_4)\n        arg_7 = os.fdopen(arg_5, 'r', 0)\n        with streaming_to_client():\n            while arg_6.status() == 'running':\n                arg_8 = arg_7.read(1)\n                log_to_client(arg_8)\n        arg_9, arg_10 = os.waitpid(arg_4, 0)\n        if arg_10 != 0:\n            raise subprocess.CalledProcessError(arg_10, ' '.join(arg_0[:-1]))", "path": "dusty/commands/utils.py", "identifier": "pty_fork", "docstring": "Runs a subprocess with a PTY attached via fork and exec.\n    The output from the PTY is streamed through log_to_client.\n    This should not be necessary for most subprocesses, we\n    built this to handle Compose up which only streams pull\n    progress if it is attached to a TTY.", "docstring_tokens": ["Runs", "a", "subprocess", "with", "a", "PTY", "attached", "via", "fork", "and", "exec", ".", "The", "output", "from", "the", "PTY", "is", "streamed", "through", "log_to_client", ".", "This", "should", "not", "be", "necessary", "for", "most", "subprocesses", "we", "built", "this", "to", "handle", "Compose", "up", "which", "only", "streams", "pull", "progress", "if", "it", "is", "attached", "to", "a", "TTY", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 259506}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/networks/network.py#L143-L153", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates a network from a specification dict.", "language": "python", "parameters": "(spec, kwargs=None)", "return_statement": "return network", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "util", ".", "get_object", "(", "obj", "=", "arg_0", ",", "default_object", "=", "LayeredNetwork", ",", "arg_1", "=", "arg_1", ")", "assert", "isinstance", "(", "arg_2", ",", "Network", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Creates a network from a specification dict.\n        \"\"\"\n        arg_2 = util.get_object(\n            obj=arg_0,\n            default_object=LayeredNetwork,\n            arg_1=arg_1\n        )\n        assert isinstance(arg_2, Network)\n        return arg_2", "path": "tensorforce/core/networks/network.py", "identifier": "Network.from_spec", "docstring": "Creates a network from a specification dict.", "docstring_tokens": ["Creates", "a", "network", "from", "a", "specification", "dict", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 259507}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/sp/sp_tutorial.py#L84-L93", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Copies the contents of vector x1 into vector x2.", "language": "python", "parameters": "(x1, x2)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "len", "(", "arg_0", ")", "for", "arg_3", "in", "range", "(", "arg_2", ")", ":", "arg_1", "[", "arg_3", "]", "=", "arg_0", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1):\n  \"\"\"\n  Copies the contents of vector x1 into vector x2.\n\n  @param x1 (array) binary vector to be copied\n  @param x2 (array) binary vector where x1 is copied\n  \"\"\"\n  arg_2 = len(arg_0)\n  for arg_3 in range(arg_2):\n    arg_1[arg_3] = arg_0[arg_3]", "path": "examples/sp/sp_tutorial.py", "identifier": "resetVector", "docstring": "Copies the contents of vector x1 into vector x2.\n\n  @param x1 (array) binary vector to be copied\n  @param x2 (array) binary vector where x1 is copied", "docstring_tokens": ["Copies", "the", "contents", "of", "vector", "x1", "into", "vector", "x2", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259508}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/preprocessing.py#L41-L55", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Fit the transformer on the stacked points.", "language": "python", "parameters": "(self, X, y=None, **params)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "arg_1", "=", "as_features", "(", "arg_1", ",", "stack", "=", "True", ")", "arg_0", ".", "transformer", ".", "Func", "(", "arg_1", ".", "stacked_features", ",", "arg_2", ",", "**", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        '''\n        Fit the transformer on the stacked points.\n\n        Parameters\n        ----------\n        X : :class:`Features` or list of arrays of shape ``[n_samples[i], n_features]``\n            Training set. If a Features object, it will be stacked.\n\n        any other keyword argument :\n            Passed on as keyword arguments to the transformer's ``Func()``.\n        '''\n        arg_1 = as_features(arg_1, stack=True)\n        arg_0.transformer.Func(arg_1.stacked_features, arg_2, **arg_3)\n        return arg_0", "path": "skl_groups/preprocessing.py", "identifier": "BagPreprocesser.fit", "docstring": "Fit the transformer on the stacked points.\n\n        Parameters\n        ----------\n        X : :class:`Features` or list of arrays of shape ``[n_samples[i], n_features]``\n            Training set. If a Features object, it will be stacked.\n\n        any other keyword argument :\n            Passed on as keyword arguments to the transformer's ``fit()``.", "docstring_tokens": ["Fit", "the", "transformer", "on", "the", "stacked", "points", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 259509}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_spinn3r_feed_storage.py#L131-L136", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Read some protobuf-encoded object stored in a single block\n        out of the file.", "language": "python", "parameters": "(self, cls)", "return_statement": "return o", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "(", ")", "arg_2", ".", "ParseFromString", "(", "arg_0", ".", "_read_block", "(", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Read some protobuf-encoded object stored in a single block\n        out of the file.\"\"\"\n        arg_2 = arg_1()\n        arg_2.ParseFromString(arg_0._read_block())\n        return arg_2", "path": "streamcorpus_pipeline/_spinn3r_feed_storage.py", "identifier": "ProtoStreamReader._read_a", "docstring": "Read some protobuf-encoded object stored in a single block\n        out of the file.", "docstring_tokens": ["Read", "some", "protobuf", "-", "encoded", "object", "stored", "in", "a", "single", "block", "out", "of", "the", "file", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 259510}
{"url": "https://github.com/neithere/argh/blob/dcd3253f2994400a6a58a700c118c53765bc50a4/argh/interaction.py#L22-L84", "sha": "dcd3253f2994400a6a58a700c118c53765bc50a4", "docstring_summary": "A shortcut for typical confirmation prompt.", "language": "python", "parameters": "(action, default=None, skip=False)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "3", "if", "arg_2", ":", "return", "arg_1", "else", ":", "arg_4", "=", "{", "None", ":", "(", "'y'", ",", "'n'", ")", ",", "True", ":", "(", "'Y'", ",", "'n'", ")", ",", "False", ":", "(", "'y'", ",", "'N'", ")", ",", "}", "arg_5", ",", "arg_6", "=", "arg_4", "[", "arg_1", "]", "arg_7", "=", "text_type", "(", "'{action}? ({y}/{n})'", ")", ".", "format", "(", "**", "locals", "(", ")", ")", "arg_8", "=", "None", "try", ":", "if", "arg_1", "is", "None", ":", "arg_9", "=", "1", "while", "not", "arg_8", "and", "arg_9", "<", "arg_3", ":", "arg_8", "=", "safe_input", "(", "arg_7", ")", "arg_9", "+=", "1", "else", ":", "arg_8", "=", "safe_input", "(", "arg_7", ")", "except", "KeyboardInterrupt", ":", "return", "None", "if", "arg_8", "in", "(", "'yes'", ",", "'y'", ",", "'Y'", ")", ":", "return", "True", "if", "arg_8", "in", "(", "'no'", ",", "'n'", ",", "'N'", ")", ":", "return", "False", "if", "arg_1", "is", "not", "None", ":", "return", "arg_1", "return", "None"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n    \"\"\"\n    A shortcut for typical Funcation prompt.\n\n    :param action:\n\n        a string describing the action, e.g. \"Apply changes\". A question mark\n        will be appended.\n\n    :param default:\n\n        `bool` or `None`. Determines what happens when user hits :kbd:`Enter`\n        without typing in a choice. If `True`, default choice is \"yes\". If\n        `False`, it is \"no\". If `None` the prompt keeps reappearing until user\n        types in a choice (not necessarily acceptable) or until the number of\n        iteration reaches the limit. Default is `None`.\n\n    :param skip:\n\n        `bool`; if `True`, no interactive prompt is used and default choice is\n        returned (useful for batch mode). Default is `False`.\n\n    Usage::\n\n        def delete(key, silent=False):\n            item = db.get(Item, args.key)\n            if Func('Delete '+item.title, default=True, skip=silent):\n                item.delete()\n                print('Item deleted.')\n            else:\n                print('Operation cancelled.')\n\n    Returns `None` on `KeyboardInterrupt` event.\n    \"\"\"\n    arg_3 = 3\n    if arg_2:\n        return arg_1\n    else:\n        arg_4 = {\n            None: ('y','n'),\n            True: ('Y','n'),\n            False: ('y','N'),\n        }\n        arg_5, arg_6 = arg_4[arg_1]\n        arg_7 = text_type('{action}? ({y}/{n})').format(**locals())\n        arg_8 = None\n        try:\n            if arg_1 is None:\n                arg_9 = 1\n                while not arg_8 and arg_9 < arg_3:\n                    arg_8 = safe_input(arg_7)\n                    arg_9 += 1\n            else:\n                arg_8 = safe_input(arg_7)\n        except KeyboardInterrupt:\n            return None\n    if arg_8 in ('yes', 'y', 'Y'):\n        return True\n    if arg_8 in ('no', 'n', 'N'):\n        return False\n    if arg_1 is not None:\n        return arg_1\n    return None", "path": "argh/interaction.py", "identifier": "confirm", "docstring": "A shortcut for typical confirmation prompt.\n\n    :param action:\n\n        a string describing the action, e.g. \"Apply changes\". A question mark\n        will be appended.\n\n    :param default:\n\n        `bool` or `None`. Determines what happens when user hits :kbd:`Enter`\n        without typing in a choice. If `True`, default choice is \"yes\". If\n        `False`, it is \"no\". If `None` the prompt keeps reappearing until user\n        types in a choice (not necessarily acceptable) or until the number of\n        iteration reaches the limit. Default is `None`.\n\n    :param skip:\n\n        `bool`; if `True`, no interactive prompt is used and default choice is\n        returned (useful for batch mode). Default is `False`.\n\n    Usage::\n\n        def delete(key, silent=False):\n            item = db.get(Item, args.key)\n            if confirm('Delete '+item.title, default=True, skip=silent):\n                item.delete()\n                print('Item deleted.')\n            else:\n                print('Operation cancelled.')\n\n    Returns `None` on `KeyboardInterrupt` event.", "docstring_tokens": ["A", "shortcut", "for", "typical", "confirmation", "prompt", "."], "nwo": "neithere/argh", "score": 0.5784710843725794, "idx": 259511}
{"url": "https://github.com/kmmbvnr/django-any/blob/6f64ebd05476e2149e2e71deeefbb10f8edfc412/django_any/contrib/auth.py#L5-L37", "sha": "6f64ebd05476e2149e2e71deeefbb10f8edfc412", "docstring_summary": "Shortcut for creating Users", "language": "python", "parameters": "(password=None, permissions=[], groups=[], **kwargs)", "return_statement": "return user", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "[", "]", ",", "arg_2", "=", "[", "]", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "pop", "(", "'is_active'", ",", "True", ")", "arg_5", "=", "arg_3", ".", "pop", "(", "'is_superuser'", ",", "False", ")", "arg_6", "=", "arg_3", ".", "pop", "(", "'is_staff'", ",", "False", ")", "arg_7", "=", "any_model", "(", "User", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "**", "arg_3", ")", "for", "arg_8", "in", "arg_2", ":", "arg_9", "=", "Group", ".", "objects", ".", "get", "(", "name", "=", "arg_8", ")", "arg_7", ".", "groups", ".", "add", "(", "arg_9", ")", "for", "arg_10", "in", "arg_1", ":", "arg_11", ",", "arg_12", "=", "arg_10", ".", "split", "(", "'.'", ")", "arg_13", "=", "Permission", ".", "objects", ".", "get", "(", "content_type__app_label", "=", "arg_11", ",", "arg_12", "=", "arg_12", ")", "arg_7", ".", "user_permissions", ".", "add", "(", "arg_13", ")", "if", "arg_0", ":", "arg_7", ".", "set_password", "(", "arg_0", ")", "arg_7", ".", "save", "(", ")", "return", "arg_7"], "function": "def Func(arg_0=None, arg_1=[], arg_2=[], **arg_3):\n    \"\"\"\n    Shortcut for creating Users\n\n    Permissions could be a list of permission names\n\n    If not specified, creates active, non superuser \n    and non staff user\n    \"\"\"\n\n    arg_4 = arg_3.pop('is_active', True)\n    arg_5 = arg_3.pop('is_superuser', False)\n    arg_6 = arg_3.pop('is_staff', False)\n\n    arg_7 = any_model(User, arg_4 = arg_4, arg_5 = arg_5,\n                     arg_6 = arg_6, **arg_3)\n\n    for arg_8 in arg_2 :\n        arg_9 = Group.objects.get(name=arg_8)\n        arg_7.groups.add(arg_9)\n\n    for arg_10 in arg_1:\n        arg_11, arg_12 = arg_10.split('.')\n        arg_13 = Permission.objects.get(\n            content_type__app_label=arg_11,\n            arg_12=arg_12)\n        arg_7.user_permissions.add(arg_13)\n\n    if arg_0:\n        arg_7.set_password(arg_0)\n    \n    arg_7.save()\n    return arg_7", "path": "django_any/contrib/auth.py", "identifier": "any_user", "docstring": "Shortcut for creating Users\n\n    Permissions could be a list of permission names\n\n    If not specified, creates active, non superuser \n    and non staff user", "docstring_tokens": ["Shortcut", "for", "creating", "Users"], "nwo": "kmmbvnr/django-any", "score": 0.18384731799856882, "idx": 259512}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/csp.py#L64-L70", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return the number of conflicts var=val has with other variables.", "language": "python", "parameters": "(self, var, val, assignment)", "return_statement": "return count_if(conflict, self.neighbors[var])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "def", "conflict", "(", "arg_4", ")", ":", "return", "(", "arg_4", "in", "arg_3", "and", "not", "arg_0", ".", "constraints", "(", "arg_1", ",", "arg_2", ",", "arg_4", ",", "arg_3", "[", "arg_4", "]", ")", ")", "return", "count_if", "(", "conflict", ",", "arg_0", ".", "neighbors", "[", "arg_1", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"Return the number of conflicts var=val has with other variables.\"\n        # Subclasses may implement this more efficiently\n        def conflict(arg_4):\n            return (arg_4 in arg_3\n                    and not arg_0.constraints(arg_1, arg_2, arg_4, arg_3[arg_4]))\n        return count_if(conflict, arg_0.neighbors[arg_1])", "path": "aima/csp.py", "identifier": "CSP.nconflicts", "docstring": "Return the number of conflicts var=val has with other variables.", "docstring_tokens": ["Return", "the", "number", "of", "conflicts", "var", "=", "val", "has", "with", "other", "variables", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 259513}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L272-L296", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Indent all lines in the given string", "language": "python", "parameters": "(str, indentLevels = 1, indentFirstLine=True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "_ONE_INDENT", "*", "arg_1", "arg_4", "=", "arg_0", ".", "splitlines", "(", "True", ")", "arg_5", "=", "''", "if", "len", "(", "arg_4", ")", ">", "0", "and", "not", "arg_2", ":", "arg_6", "=", "1", "arg_5", "+=", "arg_4", "[", "0", "]", "else", ":", "arg_6", "=", "0", "for", "arg_7", "in", "arg_4", "[", "arg_6", ":", "]", ":", "arg_5", "+=", "arg_3", "+", "arg_7", "return", "arg_5"], "function": "def Func(arg_0, arg_1 = 1, arg_2=True):\n  \"\"\" Indent all lines in the given string\n\n  str:          input string\n  indentLevels: number of levels of indentation to apply\n  indentFirstLine: if False, the 1st line will not be indented\n\n  Returns:      The result string with all lines indented\n  \"\"\"\n\n  arg_3 = _ONE_INDENT * arg_1\n\n  arg_4 = arg_0.splitlines(True)\n  arg_5 = ''\n\n  if len(arg_4) > 0 and not arg_2:\n    arg_6 = 1\n    arg_5 += arg_4[0]\n  else:\n    arg_6 = 0\n\n  for arg_7 in arg_4[arg_6:]:\n    arg_5 += arg_3 + arg_7\n\n  return arg_5", "path": "src/nupic/swarming/exp_generator/experiment_generator.py", "identifier": "_indentLines", "docstring": "Indent all lines in the given string\n\n  str:          input string\n  indentLevels: number of levels of indentation to apply\n  indentFirstLine: if False, the 1st line will not be indented\n\n  Returns:      The result string with all lines indented", "docstring_tokens": ["Indent", "all", "lines", "in", "the", "given", "string"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259514}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1539-L1546", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Inserts new continuation prompt using the specified cursor.", "language": "python", "parameters": "(self, cursor)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_continuation_prompt_html", "is", "None", ":", "arg_0", ".", "_insert_plain_text", "(", "arg_1", ",", "arg_0", ".", "_continuation_prompt", ")", "else", ":", "arg_0", ".", "_continuation_prompt", "=", "arg_0", ".", "_insert_html_fetching_plain_text", "(", "arg_1", ",", "arg_0", ".", "_continuation_prompt_html", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Inserts new continuation prompt using the specified cursor.\n        \"\"\"\n        if arg_0._continuation_prompt_html is None:\n            arg_0._insert_plain_text(arg_1, arg_0._continuation_prompt)\n        else:\n            arg_0._continuation_prompt = arg_0._insert_html_fetching_plain_text(\n                arg_1, arg_0._continuation_prompt_html)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._insert_continuation_prompt", "docstring": "Inserts new continuation prompt using the specified cursor.", "docstring_tokens": ["Inserts", "new", "continuation", "prompt", "using", "the", "specified", "cursor", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259515}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/transits.py#L409-L426", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This decides if a value is to be fit for or is fixed in a model fit.", "language": "python", "parameters": "(quantitystr, fitparams, fixedparams)", "return_statement": "return quantity", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "arg_1", ".", "keys", "(", ")", ",", "arg_2", ".", "keys", "(", ")", "if", "arg_0", "in", "arg_3", ":", "arg_5", "=", "arg_1", "[", "arg_0", "]", "elif", "arg_0", "in", "arg_4", ":", "arg_5", "=", "arg_2", "[", "arg_0", "]", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"This decides if a value is to be fit for or is fixed in a model fit.\n\n    When you want to get the value of some parameter, but you're not sure if\n    it's being fit or if it is fixed. then, e.g. for `period`::\n\n        period_value = Func('period', fitparams, fixedparams)\n\n    \"\"\"\n\n    # for Mandel-Agol fitting, sometimes we want to fix some parameters,\n    # and fit others. this function allows that flexibility.\n    arg_3, arg_4 = arg_1.keys(), arg_2.keys()\n    if arg_0 in arg_3:\n        arg_5 = arg_1[arg_0]\n    elif arg_0 in arg_4:\n        arg_5 = arg_2[arg_0]\n    return arg_5", "path": "astrobase/lcfit/transits.py", "identifier": "_get_value", "docstring": "This decides if a value is to be fit for or is fixed in a model fit.\n\n    When you want to get the value of some parameter, but you're not sure if\n    it's being fit or if it is fixed. then, e.g. for `period`::\n\n        period_value = _get_value('period', fitparams, fixedparams)", "docstring_tokens": ["This", "decides", "if", "a", "value", "is", "to", "be", "fit", "for", "or", "is", "fixed", "in", "a", "model", "fit", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 259516}
{"url": "https://github.com/nsqio/pynsq/blob/48bf62d65ea63cddaa401efb23187b95511dbc84/nsq/reader.py#L706-L715", "sha": "48bf62d65ea63cddaa401efb23187b95511dbc84", "docstring_summary": "Called when a message has been received where ``msg.attempts > max_tries``", "language": "python", "parameters": "(self, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "warning", "(", "'[%s] giving up on message %s after %d tries (max:%d) %r'", ",", "arg_0", ".", "name", ",", "arg_1", ".", "id", ",", "arg_1", ".", "attempts", ",", "arg_0", ".", "max_tries", ",", "arg_1", ".", "body", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Called when a message has been received where ``msg.attempts > max_tries``\n\n        This is useful to subclass and override to perform a task (such as writing to disk, etc.)\n\n        :param message: the :class:`nsq.Message` received\n        \"\"\"\n        logger.warning('[%s] giving up on message %s after %d tries (max:%d) %r',\n                       arg_0.name, arg_1.id, arg_1.attempts, arg_0.max_tries, arg_1.body)", "path": "nsq/reader.py", "identifier": "Reader.giving_up", "docstring": "Called when a message has been received where ``msg.attempts > max_tries``\n\n        This is useful to subclass and override to perform a task (such as writing to disk, etc.)\n\n        :param message: the :class:`nsq.Message` received", "docstring_tokens": ["Called", "when", "a", "message", "has", "been", "received", "where", "msg", ".", "attempts", ">", "max_tries"], "nwo": "nsqio/pynsq", "score": 0.4773523738069914, "idx": 259517}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/sse_protocol.py#L149-L160", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Handle the field, value pair.", "language": "python", "parameters": "(self, field, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "'event'", ":", "arg_0", ".", "_event", "=", "arg_2", "elif", "arg_1", "==", "'data'", ":", "arg_0", ".", "_data_lines", ".", "append", "(", "arg_2", ")", "elif", "arg_1", "==", "'id'", ":", "pass", "elif", "arg_1", "==", "'retry'", ":", "pass"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Handle the field, value pair. \"\"\"\n        if arg_1 == 'event':\n            arg_0._event = arg_2\n        elif arg_1 == 'data':\n            arg_0._data_lines.append(arg_2)\n        elif arg_1 == 'id':\n            # Not implemented\n            pass\n        elif arg_1 == 'retry':\n            # Not implemented\n            pass", "path": "marathon_acme/sse_protocol.py", "identifier": "SseProtocol._handle_field_value", "docstring": "Handle the field, value pair.", "docstring_tokens": ["Handle", "the", "field", "value", "pair", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 259518}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/client.py#L245-L256", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Handle stream disconnection event.", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "lock", ":", "if", "arg_1", ".", "stream", "!=", "arg_0", ".", "stream", ":", "return", "if", "arg_0", ".", "stream", "is", "not", "None", "and", "arg_1", ".", "stream", "==", "arg_0", ".", "stream", ":", "if", "arg_0", ".", "stream", ".", "transport", "in", "arg_0", ".", "_ml_handlers", ":", "arg_0", ".", "_ml_handlers", ".", "remove", "(", "arg_0", ".", "stream", ".", "transport", ")", "arg_0", ".", "main_loop", ".", "remove_handler", "(", "arg_0", ".", "stream", ".", "transport", ")", "arg_0", ".", "stream", "=", "None", "arg_0", ".", "uplink", "=", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Handle stream disconnection event.\n        \"\"\"\n        with arg_0.lock:\n            if arg_1.stream != arg_0.stream:\n                return\n            if arg_0.stream is not None and arg_1.stream == arg_0.stream:\n                if arg_0.stream.transport in arg_0._ml_handlers:\n                    arg_0._ml_handlers.remove(arg_0.stream.transport)\n                    arg_0.main_loop.remove_handler(arg_0.stream.transport)\n                arg_0.stream = None\n                arg_0.uplink = None", "path": "pyxmpp2/client.py", "identifier": "Client._stream_disconnected", "docstring": "Handle stream disconnection event.", "docstring_tokens": ["Handle", "stream", "disconnection", "event", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259519}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/delete.py#L62-L75", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Delete next unapplied patch\n        If remove is True the patch file will also be removed. If remove and\n        backup are True a copy of the deleted patch file will be made.", "language": "python", "parameters": "(self, remove=False, backup=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "db", ".", "top_patch", "(", ")", "if", "arg_3", ":", "arg_4", "=", "arg_0", ".", "series", ".", "patch_after", "(", "arg_3", ")", "else", ":", "arg_4", "=", "arg_0", ".", "series", ".", "first_patch", "(", ")", "if", "not", "arg_4", ":", "raise", "QuiltError", "(", "\"No next patch\"", ")", "arg_0", ".", "_delete_patch", "(", "arg_4", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n        \"\"\" Delete next unapplied patch\n        If remove is True the patch file will also be removed. If remove and\n        backup are True a copy of the deleted patch file will be made.\n        \"\"\"\n        arg_3 = arg_0.db.top_patch()\n        if arg_3:\n            arg_4 = arg_0.series.patch_after(arg_3)\n        else:\n            arg_4 = arg_0.series.first_patch()\n        if not arg_4:\n            raise QuiltError(\"No next patch\")\n\n        arg_0._delete_patch(arg_4, arg_1=arg_1, arg_2=arg_2)", "path": "quilt/delete.py", "identifier": "Delete.delete_next", "docstring": "Delete next unapplied patch\n        If remove is True the patch file will also be removed. If remove and\n        backup are True a copy of the deleted patch file will be made.", "docstring_tokens": ["Delete", "next", "unapplied", "patch", "If", "remove", "is", "True", "the", "patch", "file", "will", "also", "be", "removed", ".", "If", "remove", "and", "backup", "are", "True", "a", "copy", "of", "the", "deleted", "patch", "file", "will", "be", "made", "."], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 259520}
{"url": "https://github.com/twneale/nmmd/blob/ab3b3f1290c85b8d05bbf59b54c7f22da8972b6f/nmmd/base.py#L345-L370", "sha": "ab3b3f1290c85b8d05bbf59b54c7f22da8972b6f", "docstring_summary": "Find all method names this input dispatches to.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_1", "[", "0", "]", "arg_4", "=", "arg_0", ".", "inst", "arg_5", "=", "arg_0", ".", "_method_prefix", "for", "arg_6", "in", "arg_0", ".", "gen_method_keys", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_7", "=", "getattr", "(", "arg_4", ",", "arg_5", "+", "arg_6", ",", "None", ")", "if", "arg_7", "is", "not", "None", ":", "yield", "arg_7", "arg_8", "=", "type", "(", "arg_3", ")", ".", "__name__", "yield", "from", "arg_0", ".", "check_basetype", "(", "arg_3", ",", "arg_8", ",", "arg_0", ".", "builtins", ".", "get", "(", "arg_8", ")", ")", "for", "arg_9", "in", "arg_0", ".", "interp_types", ":", "yield", "from", "arg_0", ".", "check_basetype", "(", "arg_3", ",", "arg_9", ",", "getattr", "(", "arg_0", ".", "types", ",", "arg_9", ",", "None", ")", ")", "for", "arg_9", "in", "arg_0", ".", "abc_types", ":", "yield", "from", "arg_0", ".", "check_basetype", "(", "arg_3", ",", "arg_9", ",", "getattr", "(", "arg_0", ".", "collections", ",", "arg_9", ",", "None", ")", ")", "yield", "from", "arg_0", ".", "gen_generic", "(", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        '''Find all method names this input dispatches to.\n        '''\n        arg_3 = arg_1[0]\n        arg_4 = arg_0.inst\n        arg_5 = arg_0._method_prefix\n        for arg_6 in arg_0.gen_method_keys(*arg_1, **arg_2):\n            arg_7 = getattr(arg_4, arg_5 + arg_6, None)\n            if arg_7 is not None:\n                yield arg_7\n\n        # Fall back to built-in types, then types, then collections.\n        arg_8 = type(arg_3).__name__\n        yield from arg_0.check_basetype(\n            arg_3, arg_8, arg_0.builtins.get(arg_8))\n\n        for arg_9 in arg_0.interp_types:\n            yield from arg_0.check_basetype(\n                arg_3, arg_9, getattr(arg_0.types, arg_9, None))\n\n        for arg_9 in arg_0.abc_types:\n            yield from arg_0.check_basetype(\n                arg_3, arg_9, getattr(arg_0.collections, arg_9, None))\n\n        # Try the generic handler.\n        yield from arg_0.gen_generic()", "path": "nmmd/base.py", "identifier": "TypeDispatcher.gen_methods", "docstring": "Find all method names this input dispatches to.", "docstring_tokens": ["Find", "all", "method", "names", "this", "input", "dispatches", "to", "."], "nwo": "twneale/nmmd", "score": 0.17782712273869106, "idx": 259521}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L83-L91", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Print, emphasized based on rval", "language": "python", "parameters": "(txt, rval=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "info", "(", "arg_0", ")", "elif", "arg_1", "==", "0", ":", "good", "(", "arg_0", ")", "else", ":", "err", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Print, Funcasized based on rval\"\"\"\n\n    if arg_1 is None:    # rval is not specified, use 'neutral'\n        info(arg_0)\n    elif arg_1 == 0:     # rval is 0, by convention, this is 'good'\n        good(arg_0)\n    else:               # any other value, considered 'bad'\n        err(arg_0)", "path": "modules/cij/__init__.py", "identifier": "emph", "docstring": "Print, emphasized based on rval", "docstring_tokens": ["Print", "emphasized", "based", "on", "rval"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 259522}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L346-L361", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Authenticate using OAuth refresh token.", "language": "python", "parameters": "(session, refresh_token)", "return_statement": "return res['access_token']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'client_id'", ":", "OAUTH2_CLIENT_ID", ",", "'client_secret'", ":", "OAUTH2_CLIENT_SECRET", ",", "'grant_type'", ":", "'refresh_token'", ",", "'refresh_token'", ":", "arg_1", ",", "}", "arg_3", "=", "_make_token_request", "(", "arg_0", ",", "arg_2", ")", "return", "arg_3", "[", "'access_token'", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Authenticate using OAuth refresh token.\n\n    Raises GoogleAuthError if authentication fails.\n\n    Returns access token string.\n    \"\"\"\n    # Make a token request.\n    arg_2 = {\n        'client_id': OAUTH2_CLIENT_ID,\n        'client_secret': OAUTH2_CLIENT_SECRET,\n        'grant_type': 'refresh_token',\n        'refresh_token': arg_1,\n    }\n    arg_3 = _make_token_request(arg_0, arg_2)\n    return arg_3['access_token']", "path": "hangups/auth.py", "identifier": "_auth_with_refresh_token", "docstring": "Authenticate using OAuth refresh token.\n\n    Raises GoogleAuthError if authentication fails.\n\n    Returns access token string.", "docstring_tokens": ["Authenticate", "using", "OAuth", "refresh", "token", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259523}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/masked_autoregressive.py#L794-L852", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "See tfkl.Layer.build.", "language": "python", "parameters": "(self, input_shape)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_event_shape", "is", "None", ":", "arg_0", ".", "_event_shape", "=", "[", "tf", ".", "compat", ".", "dimension_value", "(", "arg_1", "[", "-", "1", "]", ")", "]", "arg_0", ".", "_event_size", "=", "arg_0", ".", "_event_shape", "[", "-", "1", "]", "arg_0", ".", "_event_ndims", "=", "len", "(", "arg_0", ".", "_event_shape", ")", "if", "arg_1", "[", "-", "1", "]", "!=", "arg_0", ".", "_event_shape", "[", "-", "1", "]", ":", "raise", "ValueError", "(", "\"Invalid final dimension of `input_shape`. \"", "\"Expected `{!r}`, but got `{!r}`\"", ".", "format", "(", "arg_0", ".", "_event_shape", "[", "-", "1", "]", ",", "arg_1", "[", "-", "1", "]", ")", ")", "arg_0", ".", "_input_order", "=", "_create_input_order", "(", "arg_0", ".", "_event_size", ",", "arg_0", ".", "_input_order_param", ")", "arg_0", ".", "_masks", "=", "_create_masks", "(", "_create_degrees", "(", "input_size", "=", "arg_0", ".", "_event_size", ",", "hidden_units", "=", "arg_0", ".", "_hidden_units", ",", "input_order", "=", "arg_0", ".", "_input_order", ",", "hidden_degrees", "=", "arg_0", ".", "_hidden_degrees", ")", ")", "arg_0", ".", "_masks", "[", "-", "1", "]", "=", "np", ".", "reshape", "(", "np", ".", "tile", "(", "arg_0", ".", "_masks", "[", "-", "1", "]", "[", "...", ",", "tf", ".", "newaxis", "]", ",", "[", "1", ",", "1", ",", "arg_0", ".", "_params", "]", ")", ",", "[", "arg_0", ".", "_masks", "[", "-", "1", "]", ".", "shape", "[", "0", "]", ",", "arg_0", ".", "_event_size", "*", "arg_0", ".", "_params", "]", ")", "arg_0", ".", "_network", "=", "tf", ".", "keras", ".", "Sequential", "(", "[", "tf", ".", "keras", ".", "layers", ".", "InputLayer", "(", "(", "arg_0", ".", "_event_size", ",", ")", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "]", ")", "arg_8", "=", "arg_0", ".", "_hidden_units", "+", "[", "arg_0", ".", "_event_size", "*", "arg_0", ".", "_params", "]", "for", "arg_9", "in", "range", "(", "len", "(", "arg_0", ".", "_masks", ")", ")", ":", "arg_0", ".", "_network", ".", "add", "(", "tf", ".", "keras", ".", "layers", ".", "Dense", "(", "arg_8", "[", "arg_9", "]", ",", "kernel_initializer", "=", "_make_masked_initializer", "(", "arg_0", ".", "_masks", "[", "arg_9", "]", ",", "arg_0", ".", "_kernel_initializer", ")", ",", "kernel_constraint", "=", "_make_masked_constraint", "(", "arg_0", ".", "_masks", "[", "arg_9", "]", ")", ",", "activation", "=", "arg_0", ".", "_activation", "if", "arg_9", "+", "1", "<", "len", "(", "arg_0", ".", "_masks", ")", "else", "None", ",", "use_bias", "=", "arg_0", ".", "_use_bias", ",", "**", "arg_0", ".", "_kwargs", ")", ")", "super", "(", "AutoregressiveLayer", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"See tfkl.Layer.Func.\"\"\"\n    if arg_0._event_shape is None:\n      # `event_shape` wasn't specied at __init__, so infer from `input_shape`.\n      arg_0._event_shape = [tf.compat.dimension_value(arg_1[-1])]\n      arg_0._event_size = arg_0._event_shape[-1]\n      arg_0._event_ndims = len(arg_0._event_shape)\n      # Should we throw if input_shape has rank > 2?\n\n    if arg_1[-1] != arg_0._event_shape[-1]:\n      raise ValueError(\"Invalid final dimension of `input_shape`. \"\n                       \"Expected `{!r}`, but got `{!r}`\".format(\n                           arg_0._event_shape[-1], arg_1[-1]))\n\n    # Construct the masks.\n    arg_0._input_order = _create_input_order(\n        arg_0._event_size, arg_0._input_order_param)\n    arg_0._masks = _create_masks(_create_degrees(\n        input_size=arg_0._event_size,\n        hidden_units=arg_0._hidden_units,\n        input_order=arg_0._input_order,\n        hidden_degrees=arg_0._hidden_degrees))\n\n    # In the final layer, we will produce `self._params` outputs for each of the\n    # `self._event_size` inputs to `AutoregressiveLayer`.  But `masks[-1]` has\n    # shape `[self._hidden_units[-1], self._event_size]`.  Thus, we need to\n    # expand the mask to `[hidden_units[-1], event_size * self._params]` such\n    # that all units for the same input are masked identically.  In particular,\n    # we tile the mask so the j-th element of `tf.unstack(output, axis=-1)` is a\n    # tensor of the j-th parameter/unit for each input.\n    #\n    # NOTE: Other orderings of the output could be faster -- should benchmark.\n    arg_0._masks[-1] = np.reshape(\n        np.tile(arg_0._masks[-1][..., tf.newaxis], [1, 1, arg_0._params]),\n        [arg_0._masks[-1].shape[0], arg_0._event_size * arg_0._params])\n\n    arg_0._network = tf.keras.Sequential([\n        # Starting this model with an `InputLayer` ensures that Keras will Func\n        # and propagate our `dtype` to each layer we add.\n        tf.keras.layers.InputLayer((arg_0._event_size,), dtype=arg_0.dtype)\n    ])\n\n    # Input-to-hidden, hidden-to-hidden, and hidden-to-output layers:\n    #  [..., self._event_size] -> [..., self._hidden_units[0]].\n    #  [..., self._hidden_units[k-1]] -> [..., self._hidden_units[k]].\n    #  [..., self._hidden_units[-1]] -> [..., event_size * self._params].\n    arg_8 = arg_0._hidden_units + [arg_0._event_size * arg_0._params]\n    for arg_9 in range(len(arg_0._masks)):\n      arg_0._network.add(tf.keras.layers.Dense(\n          arg_8[arg_9],\n          kernel_initializer=_make_masked_initializer(\n              arg_0._masks[arg_9], arg_0._kernel_initializer),\n          kernel_constraint=_make_masked_constraint(arg_0._masks[arg_9]),\n          activation=arg_0._activation if arg_9 + 1 < len(arg_0._masks) else None,\n          use_bias=arg_0._use_bias,\n          **arg_0._kwargs))\n\n    # Record that the layer has been built.\n    super(AutoregressiveLayer, arg_0).Func(arg_1)", "path": "tensorflow_probability/python/bijectors/masked_autoregressive.py", "identifier": "AutoregressiveLayer.build", "docstring": "See tfkl.Layer.build.", "docstring_tokens": ["See", "tfkl", ".", "Layer", ".", "build", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259524}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/zmqshell.py#L524-L532", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Engage the exit actions.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "exit_now", "=", "True", "arg_2", "=", "dict", "(", "source", "=", "'IPython.zmq.zmqshell.ZMQInteractiveShell.Func'", ",", "exit", "=", "True", ",", "keepkernel", "=", "arg_0", ".", "keepkernel_on_exit", ",", ")", "arg_0", ".", "payload_manager", ".", "write_payload", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"Engage the exit actions.\"\"\"\n        arg_0.exit_now = True\n        arg_2 = dict(\n            source='IPython.zmq.zmqshell.ZMQInteractiveShell.Func',\n            exit=True,\n            keepkernel=arg_0.keepkernel_on_exit,\n            )\n        arg_0.payload_manager.write_payload(arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/zmq/zmqshell.py", "identifier": "ZMQInteractiveShell.ask_exit", "docstring": "Engage the exit actions.", "docstring_tokens": ["Engage", "the", "exit", "actions", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259525}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfobjects/pdfcursor.py#L86-L91", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Test to see if the page has enough space for the given text height.", "language": "python", "parameters": "(self, test_length)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "arg_0", ".", "y", "+", "arg_1", ")", ">=", "arg_0", ".", "ymax", ":", "return", "False", "else", ":", "return", "True"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\" Test to see if the page has enough space for the given text height. \"\"\"\r\n        if (arg_0.y + arg_1) >= arg_0.ymax:\r\n            return False\r\n        else:\r\n            return True", "path": "pypdflite/pdfobjects/pdfcursor.py", "identifier": "PDFCursor.y_fit", "docstring": "Test to see if the page has enough space for the given text height.", "docstring_tokens": ["Test", "to", "see", "if", "the", "page", "has", "enough", "space", "for", "the", "given", "text", "height", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 259526}
{"url": "https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/operator.py#L126-L142", "sha": "d30107be02521fa6cdfe285da3b6b0cdd153c8cc", "docstring_summary": "This is both verified and self asserted information. As expected \n        verified information beats self-asserted so if there is both \n        self-asserted and verified values for a claim then only the verified\n        will be returned.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "sup", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "le", ".", "items", "(", ")", ":", "if", "arg_2", "not", "in", "arg_0", ".", "sup", ".", "le", ":", "arg_1", "[", "arg_2", "]", "=", "arg_3", "else", ":", "arg_1", "[", "arg_2", "]", "=", "arg_0", ".", "sup", ".", "le", "[", "arg_2", "]", "return", "arg_1", "else", ":", "return", "arg_0", ".", "le"], "function": "def Func(arg_0):\n        \"\"\"\n        This is both verified and self asserted information. As expected \n        verified information beats self-asserted so if there is both \n        self-asserted and verified values for a claim then only the verified\n        will be returned.\n        \"\"\"\n        if arg_0.sup:\n            arg_1 = {}\n            for arg_2, arg_3 in arg_0.le.items():\n                if arg_2 not in arg_0.sup.le:\n                    arg_1[arg_2] = arg_3\n                else:\n                    arg_1[arg_2] = arg_0.sup.le[arg_2]\n            return arg_1\n        else:\n            return arg_0.le", "path": "src/fedoidcmsg/operator.py", "identifier": "LessOrEqual.unprotected_and_protected_claims", "docstring": "This is both verified and self asserted information. As expected \n        verified information beats self-asserted so if there is both \n        self-asserted and verified values for a claim then only the verified\n        will be returned.", "docstring_tokens": ["This", "is", "both", "verified", "and", "self", "asserted", "information", ".", "As", "expected", "verified", "information", "beats", "self", "-", "asserted", "so", "if", "there", "is", "both", "self", "-", "asserted", "and", "verified", "values", "for", "a", "claim", "then", "only", "the", "verified", "will", "be", "returned", "."], "nwo": "IdentityPython/fedoidcmsg", "score": 0.09252797783733271, "idx": 259527}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L160-L171", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Cache a refresh token, ignoring any failure.", "language": "python", "parameters": "(self, refresh_token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "info", "(", "'Saving refresh_token to %s'", ",", "repr", "(", "arg_0", ".", "_filename", ")", ")", "try", ":", "with", "open", "(", "arg_0", ".", "_filename", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_1", ")", "except", "IOError", "as", "e", ":", "logger", ".", "warning", "(", "'Failed to save refresh_token: %s'", ",", "e", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Cache a refresh token, ignoring any failure.\n\n        Args:\n            refresh_token (str): Refresh token to cache.\n        \"\"\"\n        logger.info('Saving refresh_token to %s', repr(arg_0._filename))\n        try:\n            with open(arg_0._filename, 'w') as f:\n                f.write(arg_1)\n        except IOError as e:\n            logger.warning('Failed to save refresh_token: %s', e)", "path": "hangups/auth.py", "identifier": "RefreshTokenCache.set", "docstring": "Cache a refresh token, ignoring any failure.\n\n        Args:\n            refresh_token (str): Refresh token to cache.", "docstring_tokens": ["Cache", "a", "refresh", "token", "ignoring", "any", "failure", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259528}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/cli.py#L150-L162", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "List aggregation bookmarks.", "language": "python", "parameters": "(aggregation_types=None,\n                                 start_date=None, end_date=None, limit=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_0", "=", "(", "arg_0", "or", "list", "(", "current_stats", ".", "enabled_aggregations", ")", ")", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "current_stats", ".", "aggregations", "[", "arg_4", "]", "arg_6", "=", "arg_5", ".", "aggregator_class", "(", "name", "=", "arg_5", ".", "name", ",", "**", "arg_5", ".", "aggregator_config", ")", "arg_7", "=", "arg_6", ".", "list_bookmarks", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "click", ".", "echo", "(", "'{}:'", ".", "format", "(", "arg_4", ")", ")", "for", "arg_8", "in", "arg_7", ":", "click", ".", "echo", "(", "' - {}'", ".", "format", "(", "arg_8", ".", "date", ")", ")"], "function": "def Func(arg_0=None,\n                                 arg_1=None, arg_2=None, arg_3=None):\n    \"\"\"List aggregation bookmarks.\"\"\"\n    arg_0 = (arg_0 or\n                         list(current_stats.enabled_aggregations))\n    for arg_4 in arg_0:\n        arg_5 = current_stats.aggregations[arg_4]\n        arg_6 = arg_5.aggregator_class(\n            name=arg_5.name, **arg_5.aggregator_config)\n        arg_7 = arg_6.list_bookmarks(arg_1, arg_2, arg_3)\n        click.echo('{}:'.format(arg_4))\n        for arg_8 in arg_7:\n            click.echo(' - {}'.format(arg_8.date))", "path": "invenio_stats/cli.py", "identifier": "_aggregations_list_bookmarks", "docstring": "List aggregation bookmarks.", "docstring_tokens": ["List", "aggregation", "bookmarks", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 259529}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/experiment_utils.py#L119-L140", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns the maximum delay for the InferenceElements in the inference\n    dictionary", "language": "python", "parameters": "(inferences)", "return_statement": "return maxDelay", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "for", "arg_4", "in", "arg_3", ".", "iterkeys", "(", ")", ":", "arg_1", "=", "max", "(", "InferenceElement", ".", "getTemporalDelay", "(", "arg_2", ",", "arg_4", ")", ",", "arg_1", ")", "else", ":", "arg_1", "=", "max", "(", "InferenceElement", ".", "getTemporalDelay", "(", "arg_2", ")", ",", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns the maximum delay for the InferenceElements in the inference\n    dictionary\n\n    Parameters:\n    -----------------------------------------------------------------------\n    inferences:   A dictionary where the keys are InferenceElements\n    \"\"\"\n    arg_1 = 0\n    for arg_2, arg_3 in arg_0.iteritems():\n      if isinstance(arg_3, dict):\n        for arg_4 in arg_3.iterkeys():\n          arg_1 = max(InferenceElement.getTemporalDelay(arg_2,\n                                                            arg_4),\n                         arg_1)\n      else:\n        arg_1 = max(InferenceElement.getTemporalDelay(arg_2),\n                       arg_1)\n\n\n    return arg_1", "path": "src/nupic/swarming/experiment_utils.py", "identifier": "InferenceElement.getMaxDelay", "docstring": "Returns the maximum delay for the InferenceElements in the inference\n    dictionary\n\n    Parameters:\n    -----------------------------------------------------------------------\n    inferences:   A dictionary where the keys are InferenceElements", "docstring_tokens": ["Returns", "the", "maximum", "delay", "for", "the", "InferenceElements", "in", "the", "inference", "dictionary"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259530}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L62-L85", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert sigmoid layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting sigmoid ...'", ")", "if", "arg_6", "==", "'short'", ":", "arg_7", "=", "'SIGM'", "+", "random_string", "(", "4", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_8", "=", "keras", ".", "layers", ".", "Activation", "(", "'sigmoid'", ",", "name", "=", "arg_7", ")", "arg_4", "[", "arg_2", "]", "=", "arg_8", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert sigmoid layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting sigmoid ...')\n\n    if arg_6 == 'short':\n        arg_7 = 'SIGM' + random_string(4)\n    elif arg_6 == 'keep':\n        arg_7 = arg_1\n    else:\n        arg_7 = arg_1 + str(random.random())\n\n    arg_8 = keras.layers.Activation('sigmoid', name=arg_7)\n    arg_4[arg_2] = arg_8(arg_4[arg_3[0]])", "path": "pytorch2keras/activation_layers.py", "identifier": "convert_sigmoid", "docstring": "Convert sigmoid layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "sigmoid", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 259531}
{"url": "https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1336-L1351", "sha": "de2e678e2f00e5940de52c000214dbcb8812a222", "docstring_summary": "Return user friendly help on program options.", "language": "python", "parameters": "(self, indent=0, maxindent=25, width=79)", "return_statement": "return '\\n'.join(docs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "25", ",", "arg_3", "=", "79", ")", ":", "def", "makelabels", "(", "arg_4", ")", ":", "arg_5", "=", "'%*s--%s'", "%", "(", "arg_1", ",", "' '", ",", "arg_4", ".", "name", ")", "if", "arg_4", ".", "abbreviation", ":", "arg_5", "+=", "', -'", "+", "arg_4", ".", "abbreviation", "return", "arg_5", "+", "': '", "arg_6", "=", "[", "]", "arg_7", "=", "_autoindent", "(", "[", "makelabels", "(", "o", ")", "for", "o", "in", "arg_0", ".", "options", ".", "values", "(", ")", "]", ",", "arg_1", ",", "arg_2", ")", "for", "arg_8", "in", "arg_0", ".", "option_order", ":", "arg_4", "=", "arg_0", ".", "options", "[", "arg_8", "]", "arg_5", "=", "makelabels", "(", "arg_4", ")", "arg_9", "=", "\"%s(%s). %s\"", "%", "(", "arg_4", ".", "formatname", ",", "arg_4", ".", "strvalue", ",", "arg_4", ".", "docs", ")", "arg_10", "=", "arg_0", ".", "_wrap_labelled", "(", "arg_5", ",", "arg_9", ",", "arg_7", ",", "arg_3", ")", "arg_6", ".", "extend", "(", "arg_10", ")", "return", "'\\n'", ".", "join", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=25, arg_3=79):\n        \"\"\"Return user friendly help on program options.\"\"\"\n        def makelabels(arg_4):\n            arg_5 = '%*s--%s' % (arg_1, ' ', arg_4.name)\n            if arg_4.abbreviation:\n                arg_5 += ', -' + arg_4.abbreviation\n            return arg_5 + ': '\n        arg_6 = []\n        arg_7 = _autoindent([makelabels(o) for o in arg_0.options.values()], arg_1, arg_2)\n        for arg_8 in arg_0.option_order:\n            arg_4 = arg_0.options[arg_8]\n            arg_5 = makelabels(arg_4)\n            arg_9 = \"%s(%s). %s\" % (arg_4.formatname, arg_4.strvalue, arg_4.docs)\n            arg_10 = arg_0._wrap_labelled(arg_5, arg_9, arg_7, arg_3)\n            arg_6.extend(arg_10)\n        return '\\n'.join(arg_6)", "path": "tui/__init__.py", "identifier": "tui.optionhelp", "docstring": "Return user friendly help on program options.", "docstring_tokens": ["Return", "user", "friendly", "help", "on", "program", "options", "."], "nwo": "yohell/python-tui", "score": 0.2619419494340654, "idx": 259532}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L1183-L1204", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Find an object already created", "language": "python", "parameters": "(obj_name, init=False)", "return_statement": "return obj_parent or wx_parent", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "None", "if", "isinstance", "(", "arg_0", ",", "basestring", ")", ":", "arg_3", "=", "COMPONENTS", ".", "Func", "(", "arg_0", ")", "if", "not", "arg_3", ":", "arg_2", "=", "wx", ".", "FindWindowByName", "(", "arg_0", ")", "if", "arg_2", ":", "arg_3", "=", "Funcattr", "(", "arg_2", ",", "\"obj\"", ")", "else", ":", "for", "arg_4", "in", "COMPONENTS", ".", "values", "(", ")", ":", "if", "arg_4", ".", "name", "==", "arg_0", ":", "arg_3", "=", "arg_4", "else", ":", "arg_3", "=", "arg_0", "return", "arg_3", "or", "arg_2"], "function": "def Func(arg_0, arg_1=False):\r\n    \"Find an object already created\"\r\n    arg_2 = None\r\n    # check if new_parent is given as string (useful for designer!)\r\n    if isinstance(arg_0, basestring):\r\n        # find the object reference in the already created gui2py objects\r\n        # TODO: only useful for designer, Func a better way\r\n        arg_3 = COMPONENTS.Func(arg_0)\r\n        if not arg_3:\r\n            # try to find window (it can be a plain wx frame/control)\r\n            arg_2 = wx.FindWindowByName(arg_0)\r\n            if arg_2:\r\n                # store gui object (if any)\r\n                arg_3 = Funcattr(arg_2, \"obj\") \r\n            else:\r\n                # fallback using just object name (backward compatibility)\r\n                for arg_4 in COMPONENTS.values():\r\n                    if arg_4.name==arg_0:\r\n                        arg_3 = arg_4 \r\n    else:\r\n        arg_3 = arg_0     # use the provided parent (as is)\r\n    return arg_3 or arg_2", "path": "gui/component.py", "identifier": "get", "docstring": "Find an object already created", "docstring_tokens": ["Find", "an", "object", "already", "created"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 259533}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L31-L43", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Joins first and second read file names", "language": "python", "parameters": "(filepath)", "return_statement": "return zip(firsts, seconds)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "glob", ".", "glob", "(", "arg_0", ")", "arg_2", "=", "[", "i", "for", "i", "in", "arg_1", "if", "\"_R1_\"", "in", "i", "]", "if", "not", "arg_2", ":", "raise", "IPyradWarningExit", "(", "\"First read files names must contain '_R1_'.\"", ")", "arg_3", "=", "[", "ff", ".", "replace", "(", "\"_R1_\"", ",", "\"_R2_\"", ")", "for", "ff", "in", "arg_2", "]", "return", "zip", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\" Joins first and second read file names \"\"\"\n    ## unpack seq files in filepath\n    arg_1 = glob.glob(arg_0)\n    arg_2 = [i for i in arg_1 if \"_R1_\" in i]\n\n    ## check names\n    if not arg_2:\n        raise IPyradWarningExit(\"First read files names must contain '_R1_'.\")\n\n    ## get paired reads\n    arg_3 = [ff.replace(\"_R1_\", \"_R2_\") for ff in arg_2]\n    return zip(arg_2, arg_3)", "path": "ipyrad/assemble/demultiplex.py", "identifier": "combinefiles", "docstring": "Joins first and second read file names", "docstring_tokens": ["Joins", "first", "and", "second", "read", "file", "names"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 259534}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/import_gtfs.py#L186-L193", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Re-create all views.", "language": "python", "parameters": "(gtfs_fname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "\"creating views\"", ")", "arg_1", "=", "GTFS", "(", "fname_or_conn", "=", "arg_0", ")", ".", "conn", "for", "arg_2", "in", "Loaders", ":", "arg_2", "(", "None", ")", ".", "make_views", "(", "arg_1", ")", "arg_1", ".", "commit", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Re-create all views.\n    \"\"\"\n    print(\"creating views\")\n    arg_1 = GTFS(fname_or_conn=arg_0).conn\n    for arg_2 in Loaders:\n        arg_2(None).make_views(arg_1)\n    arg_1.commit()", "path": "gtfspy/import_gtfs.py", "identifier": "main_make_views", "docstring": "Re-create all views.", "docstring_tokens": ["Re", "-", "create", "all", "views", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 259535}
{"url": "https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L186-L189", "sha": "ca219db41eb56bdd1c0389cdc1508a41698958d7", "docstring_summary": "Signal handler for when a registered model has been deleted.", "language": "python", "parameters": "(self, instance, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "logger", ".", "debug", "(", "'RECEIVE pre_delete FOR %s'", ",", "arg_1", ".", "__class__", ")", "arg_0", ".", "delete_record", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Signal handler for when a registered model has been deleted.\"\"\"\n        logger.debug('RECEIVE pre_delete FOR %s', arg_1.__class__)\n        arg_0.delete_record(arg_1)", "path": "algoliasearch_django/registration.py", "identifier": "AlgoliaEngine.__pre_delete_receiver", "docstring": "Signal handler for when a registered model has been deleted.", "docstring_tokens": ["Signal", "handler", "for", "when", "a", "registered", "model", "has", "been", "deleted", "."], "nwo": "algolia/algoliasearch-django", "score": 0.7567196870624601, "idx": 259536}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L512-L548", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Get the collected data and reset the collector.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_measured", ":", "return", "arg_0", ".", "data", ".", "add_line_data", "(", "arg_0", ".", "collector", ".", "get_line_data", "(", ")", ")", "arg_0", ".", "data", ".", "add_arc_data", "(", "arg_0", ".", "collector", ".", "get_arc_data", "(", ")", ")", "arg_0", ".", "collector", ".", "reset", "(", ")", "if", "arg_0", ".", "_warn_unimported_source", ":", "for", "arg_1", "in", "arg_0", ".", "source_pkgs", ":", "arg_0", ".", "_warn", "(", "\"Module %s was never imported.\"", "%", "arg_1", ")", "arg_2", "=", "arg_0", ".", "data", ".", "summary", "(", ")", "if", "not", "arg_2", "and", "arg_0", ".", "_warn_no_data", ":", "arg_0", ".", "_warn", "(", "\"No data was collected.\"", ")", "for", "arg_3", "in", "arg_0", ".", "source", ":", "for", "arg_4", "in", "find_python_files", "(", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "file_locator", ".", "canonical_filename", "(", "arg_4", ")", "if", "arg_0", ".", "omit_match", "and", "arg_0", ".", "omit_match", ".", "match", "(", "arg_4", ")", ":", "continue", "arg_0", ".", "data", ".", "touch_file", "(", "arg_4", ")", "arg_0", ".", "_measured", "=", "False"], "function": "def Func(arg_0):\n        \"\"\"Get the collected data and reset the collector.\n\n        Also warn about various problems collecting data.\n\n        \"\"\"\n        if not arg_0._measured:\n            return\n\n        arg_0.data.add_line_data(arg_0.collector.get_line_data())\n        arg_0.data.add_arc_data(arg_0.collector.get_arc_data())\n        arg_0.collector.reset()\n\n        # If there are still entries in the source_pkgs list, then we never\n        # encountered those packages.\n        if arg_0._warn_unimported_source:\n            for arg_1 in arg_0.source_pkgs:\n                arg_0._warn(\"Module %s was never imported.\" % arg_1)\n\n        # Find out if we got any data.\n        arg_2 = arg_0.data.summary()\n        if not arg_2 and arg_0._warn_no_data:\n            arg_0._warn(\"No data was collected.\")\n\n        # Find files that were never executed at all.\n        for arg_3 in arg_0.source:\n            for arg_4 in find_python_files(arg_3):\n                arg_4 = arg_0.file_locator.canonical_filename(arg_4)\n\n                if arg_0.omit_match and arg_0.omit_match.match(arg_4):\n                    # Turns out this file was omitted, so don't pull it back\n                    # in as unexecuted.\n                    continue\n\n                arg_0.data.touch_file(arg_4)\n\n        arg_0._measured = False", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/control.py", "identifier": "coverage._harvest_data", "docstring": "Get the collected data and reset the collector.\n\n        Also warn about various problems collecting data.", "docstring_tokens": ["Get", "the", "collected", "data", "and", "reset", "the", "collector", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 259537}
{"url": "https://github.com/jerith/txfake/blob/5c1cda2b9a56458c254d0d9476b6c426d57f5757/txfake/fake_connection.py#L268-L273", "sha": "5c1cda2b9a56458c254d0d9476b6c426d57f5757", "docstring_summary": "Returns an IAgent that makes requests to this fake server.", "language": "python", "parameters": "(self, reactor=None, contextFactory=None)", "return_statement": "return ProxyAgentWithContext(\n            self.endpoint, reactor=reactor, contextFactory=contextFactory)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "return", "ProxyAgentWithContext", "(", "arg_0", ".", "endpoint", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Returns an IAgent that makes requests to this fake server.\n        \"\"\"\n        return ProxyAgentWithContext(\n            arg_0.endpoint, arg_1=arg_1, arg_2=arg_2)", "path": "txfake/fake_connection.py", "identifier": "FakeHttpServer.get_agent", "docstring": "Returns an IAgent that makes requests to this fake server.", "docstring_tokens": ["Returns", "an", "IAgent", "that", "makes", "requests", "to", "this", "fake", "server", "."], "nwo": "jerith/txfake", "score": 0.0, "idx": 259538}
{"url": "https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L1079-L1087", "sha": "1701526a91c14dc8ebc6452c45c8ec9a563a56db", "docstring_summary": "Show usage and available palettes.", "language": "python", "parameters": "(parser)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "print_usage", "(", ")", "print", "(", "''", ")", "print", "(", "'available palettes:'", ")", "for", "arg_1", "in", "sorted", "(", "PALETTE", ")", ":", "print", "(", "'    %-12s'", "%", "(", "arg_1", ",", ")", ")", "return", "0"], "function": "def Func(arg_0):\n    \"\"\"Show usage and available palettes.\"\"\"\n    arg_0.print_usage()\n    print('')\n    print('available palettes:')\n    for arg_1 in sorted(PALETTE):\n        print('    %-12s' % (arg_1,))\n\n    return 0", "path": "diagram.py", "identifier": "usage_palette", "docstring": "Show usage and available palettes.", "docstring_tokens": ["Show", "usage", "and", "available", "palettes", "."], "nwo": "tehmaze/diagram", "score": 0.5330178463252985, "idx": 259539}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L362-L369", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Replaces entire cache entry parameter data by its name with new data.", "language": "python", "parameters": "(self, entry_name, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "cache", "[", "arg_1", "]", "[", "arg_2", "]", "=", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Replaces entire cache entry parameter data by its name with new data.\n\n        :param str|unicode entry_name:\n        :param key:\n        :param value:\n        \"\"\"\n        arg_0.cache[arg_1][arg_2] = arg_3", "path": "sitetree/sitetreeapp.py", "identifier": "Cache.set_entry", "docstring": "Replaces entire cache entry parameter data by its name with new data.\n\n        :param str|unicode entry_name:\n        :param key:\n        :param value:", "docstring_tokens": ["Replaces", "entire", "cache", "entry", "parameter", "data", "by", "its", "name", "with", "new", "data", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 259540}
{"url": "https://github.com/six8/polydatum/blob/c98a498f8e7972218903ec027f6de78089726c1d/src/polydatum/config.py#L42-L51", "sha": "c98a498f8e7972218903ec027f6de78089726c1d", "docstring_summary": "Load a configuration module and return a Config", "language": "python", "parameters": "(module_name)", "return_statement": "return Config(config)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "importlib", ".", "import_module", "(", "arg_0", ")", "arg_2", "=", "{", "}", "for", "arg_3", "in", "dir", "(", "arg_1", ")", ":", "if", "arg_3", ".", "isupper", "(", ")", ":", "arg_2", "[", "arg_3", "]", "=", "getattr", "(", "arg_1", ",", "arg_3", ")", "return", "Config", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Load a configuration module and return a Config\n    \"\"\"\n    arg_1 = importlib.import_module(arg_0)\n    arg_2 = {}\n    for arg_3 in dir(arg_1):\n        if arg_3.isupper():\n            arg_2[arg_3] = getattr(arg_1, arg_3)\n    return Config(arg_2)", "path": "src/polydatum/config.py", "identifier": "from_module", "docstring": "Load a configuration module and return a Config", "docstring_tokens": ["Load", "a", "configuration", "module", "and", "return", "a", "Config"], "nwo": "six8/polydatum", "score": 0.2797951884712986, "idx": 259541}
{"url": "https://github.com/stratis-storage/into-dbus-python/blob/81366049671f79116bbb81c97bf621800a2f6315/src/into_dbus_python/_xformer.py#L65-L76", "sha": "81366049671f79116bbb81c97bf621800a2f6315", "docstring_summary": "Gets the level for the variant.", "language": "python", "parameters": "(level, variant)", "return_statement": "return (level + variant, level + variant) \\\n           if variant != 0 else (variant, level)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "arg_0", "+", "arg_1", ",", "arg_0", "+", "arg_1", ")", "if", "arg_1", "!=", "0", "else", "(", "arg_1", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Gets the level for the variant.\n\n        :param int level: the current variant level\n        :param int variant: the value for this level if variant\n\n        :returns: a level for the object and one for the function\n        :rtype: int * int\n        \"\"\"\n        return (arg_0 + arg_1, arg_0 + arg_1) \\\n           if arg_1 != 0 else (arg_1, arg_0)", "path": "src/into_dbus_python/_xformer.py", "identifier": "_ToDbusXformer._variant_levels", "docstring": "Gets the level for the variant.\n\n        :param int level: the current variant level\n        :param int variant: the value for this level if variant\n\n        :returns: a level for the object and one for the function\n        :rtype: int * int", "docstring_tokens": ["Gets", "the", "level", "for", "the", "variant", "."], "nwo": "stratis-storage/into-dbus-python", "score": 0.2751458370028208, "idx": 259542}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/event.py#L221-L243", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Rotates the queued texts and determines display time.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "delay", ">", "0", ":", "arg_0", ".", "delay", "-=", "1", "return", "if", "arg_0", ".", "fi", "==", "0", ":", "if", "len", "(", "arg_0", ".", "q", ")", "==", "1", ":", "arg_0", ".", "fn", "=", "float", "(", "\"inf\"", ")", "else", ":", "arg_0", ".", "fn", "=", "len", "(", "arg_0", ".", "q", "[", "arg_0", ".", "i", "]", ")", "/", "arg_0", ".", "speed", "arg_0", ".", "fn", "=", "max", "(", "arg_0", ".", "fn", ",", "arg_0", ".", "mf", ")", "arg_0", ".", "fi", "+=", "1", "if", "arg_0", ".", "fi", ">", "arg_0", ".", "fn", ":", "arg_0", ".", "fi", "=", "0", "arg_0", ".", "i", "=", "(", "arg_0", ".", "i", "+", "1", ")", "%", "len", "(", "arg_0", ".", "q", ")"], "function": "def Func(arg_0):\n        \n        \"\"\" Rotates the queued texts and determines display time.\n        \"\"\"\n        \n        if arg_0.delay > 0:\n            # It takes a while for the popup to appear.\n            arg_0.delay -= 1; return\n            \n        if arg_0.fi == 0:\n            # Only one text in queue, displayed infinitely.\n            if len(arg_0.q) == 1: \n                arg_0.fn = float(\"inf\")\n            # Else, display time depends on text length.\n            else:\n                arg_0.fn = len(arg_0.q[arg_0.i]) / arg_0.speed\n                arg_0.fn = max(arg_0.fn, arg_0.mf)            \n            \n        arg_0.fi += 1\n        if arg_0.fi > arg_0.fn:\n            # Rotate to the next text in queue.\n            arg_0.fi = 0\n            arg_0.i = (arg_0.i+1) % len(arg_0.q)", "path": "lib/graph/event.py", "identifier": "popup.update", "docstring": "Rotates the queued texts and determines display time.", "docstring_tokens": ["Rotates", "the", "queued", "texts", "and", "determines", "display", "time", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259543}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L264-L281", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns an initial state for the LSTM cell.", "language": "python", "parameters": "(self, sample_batch_shape=())", "return_statement": "return previous_output, (h0, c0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", ")", ")", ":", "arg_2", "=", "tf", ".", "zeros", "(", "[", "1", ",", "arg_0", ".", "hidden_size", "]", ")", "arg_3", "=", "tf", ".", "zeros", "(", "[", "1", ",", "arg_0", ".", "hidden_size", "]", ")", "arg_4", "=", "tf", ".", "concat", "(", "(", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "[", "arg_0", ".", "dimensions", "]", ")", ",", "axis", "=", "-", "1", ")", "arg_5", "=", "tf", ".", "zeros", "(", "arg_4", ")", "return", "arg_5", ",", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1=()):\n    \"\"\"Returns an initial state for the LSTM cell.\n\n    Args:\n      sample_batch_shape: A 0D or 1D tensor of the combined sample and\n        batch shape.\n\n    Returns:\n      A tuple of the initial previous output at timestep 0 of shape\n      [sample_batch_shape, dimensions], and the cell state.\n    \"\"\"\n    arg_2 = tf.zeros([1, arg_0.hidden_size])\n    arg_3 = tf.zeros([1, arg_0.hidden_size])\n    arg_4 = tf.concat((tf.convert_to_tensor(\n        value=arg_1, dtype=tf.int32), [arg_0.dimensions]),\n                               axis=-1)\n    arg_5 = tf.zeros(arg_4)\n    return arg_5, (arg_2, arg_3)", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "LearnableMultivariateNormalDiagCell.zero_state", "docstring": "Returns an initial state for the LSTM cell.\n\n    Args:\n      sample_batch_shape: A 0D or 1D tensor of the combined sample and\n        batch shape.\n\n    Returns:\n      A tuple of the initial previous output at timestep 0 of shape\n      [sample_batch_shape, dimensions], and the cell state.", "docstring_tokens": ["Returns", "an", "initial", "state", "for", "the", "LSTM", "cell", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259544}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/__init__.py#L129-L157", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Create a canvas and a bot with the same canvas attached to it", "language": "python", "parameters": "(src=None, grammar=NODEBOX, format=None, outputfile=None, iterations=1, buff=None, window=False,\n               title=None, fullscreen=None, server=False, port=7777, show_vars=False, vars=None, namespace=None)", "return_statement": "return bot", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "1", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "False", ",", "arg_11", "=", "7777", ",", "arg_12", "=", "False", ",", "arg_13", "=", "None", ",", "arg_14", "=", "None", ")", ":", "arg_15", "=", "create_canvas", "(", "arg_0", ",", "arg_3", ",", "arg_4", ",", "arg_5", ">", "1", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_12", "=", "arg_12", ")", "if", "arg_1", "==", "DRAWBOT", ":", "from", "shoebot", ".", "grammar", "import", "DrawBot", "arg_16", "=", "DrawBot", "(", "arg_15", ",", "arg_14", "=", "arg_14", ",", "arg_13", "=", "arg_13", ")", "else", ":", "from", "shoebot", ".", "grammar", "import", "NodeBot", "arg_16", "=", "NodeBot", "(", "arg_15", ",", "arg_14", "=", "arg_14", ",", "arg_13", "=", "arg_13", ")", "if", "arg_10", ":", "from", "shoebot", ".", "sbio", "import", "SocketServer", "arg_17", "=", "SocketServer", "(", "arg_16", ",", "\"\"", ",", "arg_11", "=", "arg_11", ")", "return", "arg_16"], "function": "def Func(arg_0=None, arg_1=arg_2, arg_3=None, arg_4=None, arg_5=1, arg_6=None, arg_7=False,\n               arg_8=None, arg_9=None, arg_10=False, arg_11=7777, arg_12=False, arg_13=None, arg_14=None):\n    \"\"\"\n    Create a canvas and a bot with the same canvas attached to it\n\n    bot parameters\n    :param grammar: DRAWBOT or NODEBOX - decides what kind of bot is created\n    :param vars: preset dictionary of vars from the called\n\n    canvas parameters:\n    ... everything else ...\n\n    See create_canvas for details on those parameters.\n\n    \"\"\"\n    arg_15 = create_canvas(arg_0, arg_3, arg_4, arg_5 > 1, arg_6, arg_7, arg_8, arg_9=arg_9,\n                           arg_12=arg_12)\n\n    if arg_1 == DRAWBOT:\n        from shoebot.grammar import DrawBot\n        arg_16 = DrawBot(arg_15, arg_14=arg_14, arg_13=arg_13)\n    else:\n        from shoebot.grammar import NodeBot\n        arg_16 = NodeBot(arg_15, arg_14=arg_14, arg_13=arg_13)\n\n    if arg_10:\n        from shoebot.sbio import SocketServer\n        arg_17 = SocketServer(arg_16, \"\", arg_11=arg_11)\n    return arg_16", "path": "shoebot/__init__.py", "identifier": "create_bot", "docstring": "Create a canvas and a bot with the same canvas attached to it\n\n    bot parameters\n    :param grammar: DRAWBOT or NODEBOX - decides what kind of bot is created\n    :param vars: preset dictionary of vars from the called\n\n    canvas parameters:\n    ... everything else ...\n\n    See create_canvas for details on those parameters.", "docstring_tokens": ["Create", "a", "canvas", "and", "a", "bot", "with", "the", "same", "canvas", "attached", "to", "it"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259545}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm_cpp.py#L54-L74", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns args dictionary from the calling method", "language": "python", "parameters": "()", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "inspect", "import", "copy", "arg_0", "=", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "0", "]", "arg_1", ",", "arg_2", ",", "arg_2", ",", "arg_3", "=", "inspect", ".", "getargvalues", "(", "arg_0", ")", "arg_1", ".", "remove", "(", "\"self\"", ")", "arg_4", "=", "copy", ".", "copy", "(", "arg_3", ")", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", "not", "in", "arg_1", ":", "arg_4", ".", "pop", "(", "arg_5", ")", "return", "arg_4"], "function": "def Func():\n  \"\"\"\n  Returns args dictionary from the calling method\n  \"\"\"\n  import inspect\n  import copy\n\n  arg_0 = inspect.stack()[1][0]\n\n  arg_1, arg_2, arg_2, arg_3 = inspect.getargvalues(arg_0)\n\n  arg_1.remove(\"self\")\n\n  arg_4 = copy.copy(arg_3)\n\n\n  for arg_5 in arg_3:\n    if arg_5 not in arg_1:\n      arg_4.pop(arg_5)\n\n  return arg_4", "path": "src/nupic/algorithms/backtracking_tm_cpp.py", "identifier": "_extractCallingMethodArgs", "docstring": "Returns args dictionary from the calling method", "docstring_tokens": ["Returns", "args", "dictionary", "from", "the", "calling", "method"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259546}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/keras/topology.py#L170-L191", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Use a model to do prediction.", "language": "python", "parameters": "(self, x, distributed=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "is_distributed", ":", "if", "isinstance", "(", "arg_1", ",", "np", ".", "ndarray", ")", ":", "arg_3", "=", "to_sample_rdd", "(", "arg_1", ",", "np", ".", "zeros", "(", "[", "arg_1", ".", "shape", "[", "0", "]", "]", ")", ")", "elif", "isinstance", "(", "arg_1", ",", "RDD", ")", ":", "arg_3", "=", "arg_1", "else", ":", "raise", "TypeError", "(", "\"Unsupported Funcion data type: %s\"", "%", "type", "(", "arg_1", ")", ")", "return", "arg_0", ".", "Func_distributed", "(", "arg_3", ")", "else", ":", "if", "isinstance", "(", "arg_1", ",", "np", ".", "ndarray", ")", ":", "return", "arg_0", ".", "Func_local", "(", "arg_1", ")", "else", ":", "raise", "TypeError", "(", "\"Unsupported Funcion data type: %s\"", "%", "type", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Use a model to do Funcion.\n\n        # Arguments\n        x: Input data. A Numpy array or RDD of Sample.\n        distributed: Boolean. Whether to do Funcion in distributed mode or local mode.\n                     Default is True. In local mode, x must be a Numpy array.\n        \"\"\"\n        if is_distributed:\n            if isinstance(arg_1, np.ndarray):\n                arg_3 = to_sample_rdd(arg_1, np.zeros([arg_1.shape[0]]))\n            elif isinstance(arg_1, RDD):\n                arg_3 = arg_1\n            else:\n                raise TypeError(\"Unsupported Funcion data type: %s\" % type(arg_1))\n            return arg_0.Func_distributed(arg_3)\n        else:\n            if isinstance(arg_1, np.ndarray):\n                return arg_0.Func_local(arg_1)\n            else:\n                raise TypeError(\"Unsupported Funcion data type: %s\" % type(arg_1))", "path": "pyspark/bigdl/nn/keras/topology.py", "identifier": "KerasModel.predict", "docstring": "Use a model to do prediction.\n\n        # Arguments\n        x: Input data. A Numpy array or RDD of Sample.\n        distributed: Boolean. Whether to do prediction in distributed mode or local mode.\n                     Default is True. In local mode, x must be a Numpy array.", "docstring_tokens": ["Use", "a", "model", "to", "do", "prediction", "."], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 259547}
{"url": "https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L329-L364", "sha": "b0fc49e157189932c70231077ed35e1aa5717da9", "docstring_summary": "Prepare all iPython engines for distributed object processing.", "language": "python", "parameters": "(client=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "not", "arg_0", ":", "try", ":", "arg_0", "=", "ipyparallel", ".", "Client", "(", ")", "except", ":", "raise", "DistobClusterError", "(", "u\"\"\"Could not connect to an ipyparallel cluster. Make                 sure a cluster is started (e.g. to use the CPUs of a                 single computer, can type 'ipcluster start')\"\"\"", ")", "arg_1", "=", "arg_0", ".", "ids", "if", "not", "arg_1", ":", "raise", "DistobClusterError", "(", "u'No ipyparallel compute engines are available'", ")", "arg_2", "=", "len", "(", "arg_1", ")", "arg_3", "=", "arg_0", "[", "arg_1", "]", "arg_3", ".", "use_dill", "(", ")", "with", "arg_3", ".", "sync_imports", "(", "quiet", "=", "True", ")", ":", "import", "arg_8", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_1", ":", "arg_3", ".", "targets", "=", "arg_5", "arg_4", ".", "append", "(", "arg_3", ".", "apply_async", "(", "_remote_setup_engine", ",", "arg_5", ",", "arg_2", ")", ")", "arg_3", ".", "wait", "(", "arg_4", ")", "for", "arg_7", "in", "arg_4", ":", "if", "not", "arg_7", ".", "successful", "(", ")", ":", "raise", "arg_7", ".", "r", "if", "arg_8", ".", "engine", "is", "None", ":", "arg_8", ".", "engine", "=", "ObjectHub", "(", "-", "1", ",", "arg_0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Prepare all iPython engines for distributed object processing.\n\n    Args:\n      client (ipyparallel.Client, optional): If None, will create a client\n        using the default ipyparallel profile.\n    \"\"\"\n    if not arg_0:\n        try:\n            arg_0 = ipyparallel.Client()\n        except:\n            raise DistobClusterError(\n                u\"\"\"Could not connect to an ipyparallel cluster. Make\n                 sure a cluster is started (e.g. to use the CPUs of a\n                 single computer, can type 'ipcluster start')\"\"\")\n    arg_1 = arg_0.ids\n    if not arg_1:\n        raise DistobClusterError(\n                u'No ipyparallel compute engines are available')\n    arg_2 = len(arg_1)\n    arg_3 = arg_0[arg_1]\n    arg_3.use_dill()\n    with arg_3.sync_imports(quiet=True):\n        import arg_8\n    # create global ObjectEngine distob.engine on each engine\n    arg_4 = []\n    for arg_5 in arg_1:\n        arg_3.targets = arg_5\n        arg_4.append(arg_3.apply_async(_remote_setup_engine, arg_5, arg_2))\n    arg_3.wait(arg_4)\n    for arg_7 in arg_4:\n        if not arg_7.successful():\n            raise arg_7.r\n    # create global ObjectHub distob.engine on the client host\n    if arg_8.engine is None:\n        arg_8.engine = ObjectHub(-1, arg_0)", "path": "distob/distob.py", "identifier": "setup_engines", "docstring": "Prepare all iPython engines for distributed object processing.\n\n    Args:\n      client (ipyparallel.Client, optional): If None, will create a client\n        using the default ipyparallel profile.", "docstring_tokens": ["Prepare", "all", "iPython", "engines", "for", "distributed", "object", "processing", "."], "nwo": "mattja/distob", "score": 0.12050106452410352, "idx": 259548}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L545-L589", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch items using the given backend.", "language": "python", "parameters": "(backend_class, backend_args, category, filter_classified=False,\n          manager=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "find_signature_parameters", "(", "arg_0", ".", "__init__", ",", "arg_1", ")", "arg_6", "=", "arg_4", ".", "create_archive", "(", ")", "if", "arg_4", "else", "None", "arg_5", "[", "'archive'", "]", "=", "arg_6", "arg_7", "=", "arg_0", "(", "**", "arg_5", ")", "if", "arg_2", ":", "arg_1", "[", "'category'", "]", "=", "arg_2", "if", "arg_3", ":", "arg_1", "[", "'filter_classified'", "]", "=", "arg_3", "arg_8", "=", "find_signature_parameters", "(", "arg_7", ".", "Func", ",", "arg_1", ")", "arg_9", "=", "arg_7", ".", "Func", "(", "**", "arg_8", ")", "try", ":", "for", "arg_10", "in", "arg_9", ":", "yield", "arg_10", "except", "Exception", "as", "e", ":", "if", "arg_4", ":", "arg_11", "=", "arg_6", ".", "archive_path", "arg_4", ".", "remove_archive", "(", "arg_11", ")", "raise", "e"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False,\n          arg_4=None):\n    \"\"\"Fetch items using the given backend.\n\n    Generator to get items using the given backend class. When\n    an archive manager is given, this function will store\n    the Funced items in an `Archive`. If an exception is raised,\n    this archive will be removed to avoid corrupted archives.\n\n    The parameters needed to initialize the `backend` class and\n    get the items are given using `backend_args` dict parameter.\n\n    :param backend_class: backend class to Func items\n    :param backend_args: dict of arguments needed to Func the items\n    :param category: category of the items to retrieve.\n       If None, it will use the default backend category\n    :param filter_classified: remove classified fields from the resulting items\n    :param manager: archive manager needed to store the items\n\n    :returns: a generator of items\n    \"\"\"\n    arg_5 = find_signature_parameters(arg_0.__init__,\n                                          arg_1)\n    arg_6 = arg_4.create_archive() if arg_4 else None\n    arg_5['archive'] = arg_6\n\n    arg_7 = arg_0(**arg_5)\n\n    if arg_2:\n        arg_1['category'] = arg_2\n    if arg_3:\n        arg_1['filter_classified'] = arg_3\n\n    arg_8 = find_signature_parameters(arg_7.Func,\n                                           arg_1)\n    arg_9 = arg_7.Func(**arg_8)\n\n    try:\n        for arg_10 in arg_9:\n            yield arg_10\n    except Exception as e:\n        if arg_4:\n            arg_11 = arg_6.archive_path\n            arg_4.remove_archive(arg_11)\n        raise e", "path": "perceval/backend.py", "identifier": "fetch", "docstring": "Fetch items using the given backend.\n\n    Generator to get items using the given backend class. When\n    an archive manager is given, this function will store\n    the fetched items in an `Archive`. If an exception is raised,\n    this archive will be removed to avoid corrupted archives.\n\n    The parameters needed to initialize the `backend` class and\n    get the items are given using `backend_args` dict parameter.\n\n    :param backend_class: backend class to fetch items\n    :param backend_args: dict of arguments needed to fetch the items\n    :param category: category of the items to retrieve.\n       If None, it will use the default backend category\n    :param filter_classified: remove classified fields from the resulting items\n    :param manager: archive manager needed to store the items\n\n    :returns: a generator of items", "docstring_tokens": ["Fetch", "items", "using", "the", "given", "backend", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259549}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/cancel.py#L237-L281", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the Cancel response payload and decode it into\n        its constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "CancelResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "ASYNCHRONOUS_CORRELATION_VALUE", ",", "arg_6", ")", ":", "arg_0", ".", "_asynchronous_correlation_value", "=", "primitives", ".", "ByteString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "ASYNCHRONOUS_CORRELATION_VALUE", ")", "arg_0", ".", "_asynchronous_correlation_value", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "CANCELLATION_RESULT", ",", "arg_6", ")", ":", "arg_0", ".", "_cancellation_result", "=", "primitives", ".", "Enumeration", "(", "arg_3", ".", "CancellationResult", ",", "tag", "=", "arg_3", ".", "Tags", ".", "CANCELLATION_RESULT", ")", "arg_0", ".", "_cancellation_result", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the Cancel response payload and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.\n        \"\"\"\n        super(CancelResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(\n                arg_3.Tags.ASYNCHRONOUS_CORRELATION_VALUE,\n                arg_6\n        ):\n            arg_0._asynchronous_correlation_value = primitives.ByteString(\n                tag=arg_3.Tags.ASYNCHRONOUS_CORRELATION_VALUE\n            )\n            arg_0._asynchronous_correlation_value.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        if arg_0.is_tag_next(arg_3.Tags.CANCELLATION_RESULT, arg_6):\n            arg_0._cancellation_result = primitives.Enumeration(\n                arg_3.CancellationResult,\n                tag=arg_3.Tags.CANCELLATION_RESULT\n            )\n            arg_0._cancellation_result.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/cancel.py", "identifier": "CancelResponsePayload.read", "docstring": "Read the data encoding the Cancel response payload and decode it into\n        its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "Cancel", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 259550}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/examples/ngrokwebhook.py#L117-L123", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Delete previous webhooks. If local ngrok tunnel, create a webhook.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "WebexTeamsAPI", "(", ")", "delete_webhooks_with_name", "(", "arg_0", ",", "name", "=", "WEBHOOK_NAME", ")", "arg_1", "=", "get_ngrok_public_url", "(", ")", "if", "arg_1", "is", "not", "None", ":", "create_ngrok_webhook", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func():\r\n    \"\"\"Delete previous webhooks. If local ngrok tunnel, create a webhook.\"\"\"\r\n    arg_0 = WebexTeamsAPI()\r\n    delete_webhooks_with_name(arg_0, name=WEBHOOK_NAME)\r\n    arg_1 = get_ngrok_public_url()\r\n    if arg_1 is not None:\r\n        create_ngrok_webhook(arg_0, arg_1)", "path": "examples/ngrokwebhook.py", "identifier": "main", "docstring": "Delete previous webhooks. If local ngrok tunnel, create a webhook.", "docstring_tokens": ["Delete", "previous", "webhooks", ".", "If", "local", "ngrok", "tunnel", "create", "a", "webhook", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 259551}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/hdf5compression.py#L12-L86", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Can compress an HDF5 to reduce file size.", "language": "python", "parameters": "(filename, name=None, index=None, keep_backup=True)", "return_statement": "return retcode", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "if", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "arg_2", "=", "-", "1", "arg_4", "=", "load_trajectory", "(", "arg_1", ",", "arg_2", ",", "as_new", "=", "False", ",", "load_all", "=", "pypetconstants", ".", "LOAD_NOTHING", ",", "force", "=", "True", ",", "arg_0", "=", "arg_0", ")", "arg_5", "=", "arg_4", ".", "v_storage_service", "arg_6", "=", "arg_5", ".", "complevel", "arg_7", "=", "arg_5", ".", "complib", "arg_8", "=", "arg_5", ".", "shuffle", "arg_9", "=", "arg_5", ".", "fletcher32", "arg_10", ",", "arg_11", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "arg_12", "=", "arg_10", "+", "'_tmp'", "+", "arg_11", "arg_13", "=", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", "arg_14", "=", "os", ".", "path", ".", "abspath", "(", "arg_12", ")", "arg_15", "=", "[", "'ptrepack'", ",", "'-v'", ",", "'--complib'", ",", "arg_7", ",", "'--complevel'", ",", "str", "(", "arg_6", ")", ",", "'--shuffle'", ",", "str", "(", "int", "(", "arg_8", ")", ")", ",", "'--fletcher32'", ",", "str", "(", "int", "(", "arg_9", ")", ")", ",", "arg_13", ",", "arg_14", "]", "arg_16", "=", "' '", ".", "join", "(", "arg_15", ")", "print", "(", "'Executing command `%s`'", "%", "arg_16", ")", "arg_17", "=", "subprocess", ".", "call", "(", "arg_15", ")", "if", "arg_17", "!=", "0", ":", "print", "(", "'#### ERROR: Compacting `%s` failed with errorcode %s! ####'", "%", "(", "arg_0", ",", "str", "(", "arg_17", ")", ")", ")", "else", ":", "print", "(", "'#### Compacting successful ####'", ")", "print", "(", "'Renaming files'", ")", "if", "arg_3", ":", "arg_18", "=", "arg_10", "+", "'_backup'", "+", "arg_11", "os", ".", "rename", "(", "arg_0", ",", "arg_18", ")", "else", ":", "os", ".", "remove", "(", "arg_0", ")", "os", ".", "rename", "(", "arg_12", ",", "arg_0", ")", "print", "(", "'### Compacting and Renaming finished ####'", ")", "return", "arg_17"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True):\n    \"\"\"Can compress an HDF5 to reduce file size.\n\n    The properties on how to compress the new file are taken from a given\n    trajectory in the file.\n    Simply calls ``ptrepack`` from the command line.\n    (Se also https://pytables.github.io/usersguide/utilities.html#ptrepackdescr)\n\n    Currently only supported under Linux, no guarantee for Windows usage.\n\n    :param filename:\n\n        Name of the file to compact\n\n    :param name:\n\n        The name of the trajectory from which the compression properties are taken\n\n    :param index:\n\n        Instead of a name you could also specify an index, i.e -1 for the last trajectory\n        in the file.\n\n    :param keep_backup:\n\n        If a back up version of the original file should be kept.\n        The backup file is named as the original but `_backup` is appended to the end.\n\n    :return:\n\n        The return/error code of ptrepack\n\n    \"\"\"\n    if arg_1 is None and arg_2 is None:\n        arg_2 = -1\n\n    arg_4 = load_trajectory(arg_1, arg_2, as_new=False, load_all=pypetconstants.LOAD_NOTHING,\n                               force=True, arg_0=arg_0)\n    arg_5 = arg_4.v_storage_service\n    arg_6 = arg_5.complevel\n    arg_7 = arg_5.complib\n    arg_8 = arg_5.shuffle\n    arg_9 = arg_5.fletcher32\n\n    arg_10, arg_11 = os.path.splitext(arg_0)\n    arg_12 = arg_10 + '_tmp' + arg_11\n\n    arg_13 = os.path.abspath(arg_0)\n    arg_14 = os.path.abspath(arg_12)\n\n    arg_15 = ['ptrepack', '-v',\n               '--complib', arg_7,\n               '--complevel', str(arg_6),\n               '--shuffle', str(int(arg_8)),\n               '--fletcher32', str(int(arg_9)),\n               arg_13, arg_14]\n    arg_16 = ' '.join(arg_15)\n    print('Executing command `%s`' % arg_16)\n\n    arg_17 = subprocess.call(arg_15)\n    if arg_17 != 0:\n        print('#### ERROR: Compacting `%s` failed with errorcode %s! ####' %\n              (arg_0, str(arg_17)))\n    else:\n        print('#### Compacting successful ####')\n        print('Renaming files')\n        if arg_3:\n            arg_18 = arg_10 + '_backup' + arg_11\n            os.rename(arg_0, arg_18)\n        else:\n            os.remove(arg_0)\n        os.rename(arg_12, arg_0)\n        print('### Compacting and Renaming finished ####')\n\n    return arg_17", "path": "pypet/utils/hdf5compression.py", "identifier": "compact_hdf5_file", "docstring": "Can compress an HDF5 to reduce file size.\n\n    The properties on how to compress the new file are taken from a given\n    trajectory in the file.\n    Simply calls ``ptrepack`` from the command line.\n    (Se also https://pytables.github.io/usersguide/utilities.html#ptrepackdescr)\n\n    Currently only supported under Linux, no guarantee for Windows usage.\n\n    :param filename:\n\n        Name of the file to compact\n\n    :param name:\n\n        The name of the trajectory from which the compression properties are taken\n\n    :param index:\n\n        Instead of a name you could also specify an index, i.e -1 for the last trajectory\n        in the file.\n\n    :param keep_backup:\n\n        If a back up version of the original file should be kept.\n        The backup file is named as the original but `_backup` is appended to the end.\n\n    :return:\n\n        The return/error code of ptrepack", "docstring_tokens": ["Can", "compress", "an", "HDF5", "to", "reduce", "file", "size", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259552}
{"url": "https://github.com/bayangan1991/PYXInput/blob/a0bbdecaeccf7947378bde67e7de79433bfbd30e/pyxinput/read_state.py#L93-L111", "sha": "a0bbdecaeccf7947378bde67e7de79433bfbd30e", "docstring_summary": "Test the functionality of the rController object", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "time", "print", "(", "'Testing controller in position 1:'", ")", "print", "(", "'Running 3 x 3 seconds tests'", ")", "arg_0", "=", "rController", "(", "1", ")", "for", "arg_1", "in", "range", "(", "3", ")", ":", "print", "(", "'Waiting...'", ")", "time", ".", "sleep", "(", "2.5", ")", "print", "(", "'State: '", ",", "arg_0", ".", "gamepad", ")", "print", "(", "'Buttons: '", ",", "arg_0", ".", "buttons", ")", "time", ".", "sleep", "(", "0.5", ")", "print", "(", "'Done!'", ")"], "function": "def Func():\n    \"\"\"Test the functionality of the rController object\"\"\"\n    import time\n\n    print('Testing controller in position 1:')\n    print('Running 3 x 3 seconds tests')\n\n    # Initialise Controller\n    arg_0 = rController(1)\n\n    # Loop printing controller state and buttons held\n    for arg_1 in range(3):\n        print('Waiting...')\n        time.sleep(2.5)\n        print('State: ', arg_0.gamepad)\n        print('Buttons: ', arg_0.buttons)\n        time.sleep(0.5)\n\n    print('Done!')", "path": "pyxinput/read_state.py", "identifier": "main", "docstring": "Test the functionality of the rController object", "docstring_tokens": ["Test", "the", "functionality", "of", "the", "rController", "object"], "nwo": "bayangan1991/PYXInput", "score": 0.31736401397382547, "idx": 259553}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L364-L372", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Get the type of the item.", "language": "python", "parameters": "(self)", "return_statement": "return item_type.decode(\"utf-8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "xmlnode", ".", "prop", "(", "\"type\"", ")", "if", "not", "arg_1", ":", "arg_1", "=", "\"?\"", "return", "arg_1", ".", "decode", "(", "\"utf-8\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Get the type of the item.\n\n        :return: the type of the item.\n        :returntype: `unicode`\"\"\"\n        arg_1 = arg_0.xmlnode.prop(\"type\")\n        if not arg_1:\n            arg_1 = \"?\"\n        return arg_1.decode(\"utf-8\")", "path": "pyxmpp2/ext/disco.py", "identifier": "DiscoIdentity.get_type", "docstring": "Get the type of the item.\n\n        :return: the type of the item.\n        :returntype: `unicode`", "docstring_tokens": ["Get", "the", "type", "of", "the", "item", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259554}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/von_mises_fisher.py#L302-L305", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "The mode of the von Mises-Fisher distribution is the mean direction.", "language": "python", "parameters": "(self)", "return_statement": "return (self.mean_direction +\n            tf.zeros_like(self.concentration)[..., tf.newaxis])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "mean_direction", "+", "tf", ".", "zeros_like", "(", "arg_0", ".", "concentration", ")", "[", "...", ",", "tf", ".", "newaxis", "]", ")"], "function": "def Func(arg_0):\n    \"\"\"The mode of the von Mises-Fisher distribution is the mean direction.\"\"\"\n    return (arg_0.mean_direction +\n            tf.zeros_like(arg_0.concentration)[..., tf.newaxis])", "path": "tensorflow_probability/python/distributions/von_mises_fisher.py", "identifier": "VonMisesFisher._mode", "docstring": "The mode of the von Mises-Fisher distribution is the mean direction.", "docstring_tokens": ["The", "mode", "of", "the", "von", "Mises", "-", "Fisher", "distribution", "is", "the", "mean", "direction", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259555}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/config.py#L292-L320", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Load the config and defaults from files.", "language": "python", "parameters": "(self, reload=False)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_1", "or", "not", "arg_0", ".", "_Funced", ":", "if", "arg_0", ".", "_defaults_file", "and", "type", "(", "arg_0", ".", "_defaults_file", ")", "==", "str", ":", "arg_0", ".", "_defaults_file", "=", "File", "(", "arg_0", ".", "_defaults_file", ",", "parent", "=", "arg_0", ".", "_parent", ")", "arg_3", "=", "{", "}", "if", "arg_0", ".", "_defaults_file", ":", "arg_3", "=", "yaml", ".", "safe_Func", "(", "arg_0", ".", "_defaults_file", ".", "read", "(", ")", ".", "replace", "(", "'\\t'", ",", "'    '", ")", ")", "arg_4", "=", "{", "}", "if", "arg_0", ".", "exists", ":", "arg_4", "=", "yaml", ".", "safe_Func", "(", "arg_0", ".", "read", "(", ")", ".", "replace", "(", "'\\t'", ",", "'    '", ")", ")", "arg_0", ".", "_defaults", "=", "arg_3", "arg_0", ".", "_data", "=", "copy", ".", "deepcopy", "(", "arg_0", ".", "_defaults", ")", "arg_0", ".", "update", "(", "arg_4", "=", "arg_4", ")", "if", "arg_0", ".", "_apply_env", ":", "arg_0", ".", "update", "(", "ConfigEnv", "(", "arg_0", ".", "_env_prefix", ")", ")", "arg_0", ".", "_Funced", "=", "True", "return", "arg_0"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Load the config and defaults from files.\n        \"\"\"\n        if arg_1 or not arg_0._Funced:\n            # Func defaults\n            if arg_0._defaults_file and type(arg_0._defaults_file) == str:\n                arg_0._defaults_file = File(arg_0._defaults_file, parent=arg_0._parent)\n            arg_3 = {}\n            if arg_0._defaults_file:\n                arg_3 = yaml.safe_Func(arg_0._defaults_file.read().replace('\\t', '    '))\n\n            # Func data\n            arg_4 = {}\n            if arg_0.exists:\n                arg_4 = yaml.safe_Func(arg_0.read().replace('\\t', '    '))\n\n            # initialise with the Funced data\n            arg_0._defaults = arg_3\n            arg_0._data = copy.deepcopy(arg_0._defaults)\n            arg_0.update(arg_4=arg_4)\n\n            # if specified, apply environment variables\n            if arg_0._apply_env:\n                arg_0.update(ConfigEnv(arg_0._env_prefix))\n\n            arg_0._Funced = True\n\n        return arg_0", "path": "scruffy/config.py", "identifier": "ConfigFile.load", "docstring": "Load the config and defaults from files.", "docstring_tokens": ["Load", "the", "config", "and", "defaults", "from", "files", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 259556}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L223-L258", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "This finds a set of solutions for symbolic using policy.\n            This raises TooManySolutions if more solutions than maxcount", "language": "python", "parameters": "(self, symbolic, policy, maxcount=7)", "return_statement": "return tuple(set(vals))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "7", ")", ":", "assert", "arg_0", ".", "constraints", "==", "arg_0", ".", "platform", ".", "constraints", "arg_1", "=", "arg_0", ".", "migrate_expression", "(", "arg_1", ")", "arg_4", "=", "[", "]", "if", "arg_2", "==", "'MINMAX'", ":", "arg_4", "=", "arg_0", ".", "_solver", ".", "minmax", "(", "arg_0", ".", "_constraints", ",", "arg_1", ")", "elif", "arg_2", "==", "'MAX'", ":", "arg_4", "=", "arg_0", ".", "_solver", ".", "max", "(", "arg_0", ".", "_constraints", ",", "arg_1", ")", "elif", "arg_2", "==", "'MIN'", ":", "arg_4", "=", "arg_0", ".", "_solver", ".", "min", "(", "arg_0", ".", "_constraints", ",", "arg_1", ")", "elif", "arg_2", "==", "'SAMPLED'", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_solver", ".", "minmax", "(", "arg_0", ".", "_constraints", ",", "arg_1", ")", "arg_4", "+=", "[", "arg_5", ",", "arg_6", "]", "if", "arg_6", "-", "arg_5", ">", "3", ":", "if", "arg_0", ".", "_solver", ".", "can_be_true", "(", "arg_0", ".", "_constraints", ",", "arg_1", "==", "(", "arg_5", "+", "arg_6", ")", "//", "2", ")", ":", "arg_4", ".", "append", "(", "(", "arg_5", "+", "arg_6", ")", "//", "2", ")", "if", "arg_6", "-", "arg_5", ">", "100", ":", "for", "arg_7", "in", "(", "0", ",", "1", ",", "2", ",", "5", ",", "32", ",", "64", ",", "128", ",", "320", ")", ":", "if", "arg_0", ".", "_solver", ".", "can_be_true", "(", "arg_0", ".", "_constraints", ",", "arg_1", "==", "arg_5", "+", "arg_7", ")", ":", "arg_4", ".", "append", "(", "arg_5", "+", "arg_7", ")", "if", "arg_3", "<=", "len", "(", "arg_4", ")", ":", "break", "if", "arg_6", "-", "arg_5", ">", "1000", "and", "arg_3", ">", "len", "(", "arg_4", ")", ":", "arg_4", "+=", "arg_0", ".", "_solver", ".", "get_all_values", "(", "arg_0", ".", "_constraints", ",", "arg_1", ",", "maxcnt", "=", "arg_3", "-", "len", "(", "arg_4", ")", ",", "silent", "=", "True", ")", "elif", "arg_2", "==", "'ONE'", ":", "arg_4", "=", "[", "arg_0", ".", "_solver", ".", "get_value", "(", "arg_0", ".", "_constraints", ",", "arg_1", ")", "]", "else", ":", "assert", "arg_2", "==", "'ALL'", "arg_4", "=", "solver", ".", "get_all_values", "(", "arg_0", ".", "_constraints", ",", "arg_1", ",", "maxcnt", "=", "arg_3", ",", "silent", "=", "True", ")", "return", "tuple", "(", "set", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=7):\n        \"\"\" This finds a set of solutions for symbolic using policy.\n            This raises TooManySolutions if more solutions than maxcount\n        \"\"\"\n        assert arg_0.constraints == arg_0.platform.constraints\n        arg_1 = arg_0.migrate_expression(arg_1)\n\n        arg_4 = []\n        if arg_2 == 'MINMAX':\n            arg_4 = arg_0._solver.minmax(arg_0._constraints, arg_1)\n        elif arg_2 == 'MAX':\n            arg_4 = arg_0._solver.max(arg_0._constraints, arg_1)\n        elif arg_2 == 'MIN':\n            arg_4 = arg_0._solver.min(arg_0._constraints, arg_1)\n        elif arg_2 == 'SAMPLED':\n            arg_5, arg_6 = arg_0._solver.minmax(arg_0._constraints, arg_1)\n            arg_4 += [arg_5, arg_6]\n            if arg_6 - arg_5 > 3:\n                if arg_0._solver.can_be_true(arg_0._constraints, arg_1 == (arg_5 + arg_6) // 2):\n                    arg_4.append((arg_5 + arg_6) // 2)\n            if arg_6 - arg_5 > 100:\n                for arg_7 in (0, 1, 2, 5, 32, 64, 128, 320):\n                    if arg_0._solver.can_be_true(arg_0._constraints, arg_1 == arg_5 + arg_7):\n                        arg_4.append(arg_5 + arg_7)\n                    if arg_3 <= len(arg_4):\n                        break\n            if arg_6 - arg_5 > 1000 and arg_3 > len(arg_4):\n                arg_4 += arg_0._solver.get_all_values(arg_0._constraints, arg_1,\n                                                    maxcnt=arg_3 - len(arg_4), silent=True)\n        elif arg_2 == 'ONE':\n            arg_4 = [arg_0._solver.get_value(arg_0._constraints, arg_1)]\n        else:\n            assert arg_2 == 'ALL'\n            arg_4 = solver.get_all_values(arg_0._constraints, arg_1, maxcnt=arg_3, silent=True)\n\n        return tuple(set(arg_4))", "path": "manticore/core/state.py", "identifier": "StateBase.concretize", "docstring": "This finds a set of solutions for symbolic using policy.\n            This raises TooManySolutions if more solutions than maxcount", "docstring_tokens": ["This", "finds", "a", "set", "of", "solutions", "for", "symbolic", "using", "policy", ".", "This", "raises", "TooManySolutions", "if", "more", "solutions", "than", "maxcount"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259557}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L74-L82", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Yield the digits of pi read from a .txt file.", "language": "python", "parameters": "(filename, the_type=str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "with", "open", "(", "arg_0", ",", "'r'", ")", "as", "f", ":", "for", "arg_3", "in", "f", ".", "readlines", "(", ")", ":", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", "!=", "'\\n'", "and", "arg_4", "!=", "' '", ":", "yield", "arg_1", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Yield the digits of pi read from a .txt file.\n    \"\"\"\n    with open(arg_0, 'r') as f:\n        for arg_3 in f.readlines():\n            for arg_4 in arg_3:\n                if arg_4 != '\\n' and arg_4!= ' ':\n                    yield arg_1(arg_4)", "path": "environment/share/doc/ipython/examples/parallel/pi/pidigits.py", "identifier": "txt_file_to_digits", "docstring": "Yield the digits of pi read from a .txt file.", "docstring_tokens": ["Yield", "the", "digits", "of", "pi", "read", "from", "a", ".", "txt", "file", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259558}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/spreading/spreader.py#L107-L136", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Run the actual simulation.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_hasFunc", ":", "raise", "RuntimeError", "(", "\"This spreader instance has already been run: \"", "\"create a new Spreader object for a new run.\"", ")", "arg_1", "=", "1", "while", "arg_0", ".", "event_heap", ".", "size", "(", ")", ">", "0", "and", "len", "(", "arg_0", ".", "_uninfected_stops", ")", ">", "0", ":", "arg_2", "=", "arg_0", ".", "event_heap", ".", "pop_next_event", "(", ")", "arg_3", "=", "arg_0", ".", "_stop_I_to_spreading_stop", "[", "arg_2", ".", "from_stop_I", "]", "if", "arg_2", ".", "arr_time_ut", ">", "arg_0", ".", "start_time_ut", "+", "arg_0", ".", "max_duration_ut", ":", "break", "if", "arg_3", ".", "can_infect", "(", "arg_2", ")", ":", "arg_4", "=", "arg_0", ".", "_stop_I_to_spreading_stop", "[", "arg_2", ".", "to_stop_I", "]", "arg_5", "=", "arg_4", ".", "has_been_visited", "(", ")", "arg_4", ".", "visit", "(", "arg_2", ")", "if", "not", "arg_5", ":", "arg_0", ".", "_uninfected_stops", ".", "remove", "(", "arg_2", ".", "to_stop_I", ")", "print", "(", "arg_1", ",", "arg_0", ".", "event_heap", ".", "size", "(", ")", ")", "arg_6", "=", "arg_0", ".", "gtfs", ".", "get_straight_line_transfer_distances", "(", "arg_2", ".", "to_stop_I", ")", "arg_0", ".", "event_heap", ".", "add_walk_events_to_heap", "(", "arg_6", ",", "arg_2", ",", "arg_0", ".", "start_time_ut", ",", "arg_0", ".", "walk_speed", ",", "arg_0", ".", "_uninfected_stops", ",", "arg_0", ".", "max_duration_ut", ")", "arg_1", "+=", "1", "arg_0", ".", "_hasFunc", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"\n        Run the actual simulation.\n        \"\"\"\n        if arg_0._hasFunc:\n            raise RuntimeError(\"This spreader instance has already been run: \"\n                               \"create a new Spreader object for a new run.\")\n        arg_1 = 1\n        while arg_0.event_heap.size() > 0 and len(arg_0._uninfected_stops) > 0:\n            arg_2 = arg_0.event_heap.pop_next_event()\n            arg_3 = arg_0._stop_I_to_spreading_stop[arg_2.from_stop_I]\n\n            if arg_2.arr_time_ut > arg_0.start_time_ut + arg_0.max_duration_ut:\n                break\n\n            if arg_3.can_infect(arg_2):\n\n                arg_4 = arg_0._stop_I_to_spreading_stop[arg_2.to_stop_I]\n                arg_5 = arg_4.has_been_visited()\n                arg_4.visit(arg_2)\n\n                if not arg_5:\n                    arg_0._uninfected_stops.remove(arg_2.to_stop_I)\n                    print(arg_1, arg_0.event_heap.size())\n                    arg_6 = arg_0.gtfs.get_straight_line_transfer_distances(arg_2.to_stop_I)\n                    arg_0.event_heap.add_walk_events_to_heap(arg_6, arg_2, arg_0.start_time_ut,\n                                                            arg_0.walk_speed, arg_0._uninfected_stops,\n                                                            arg_0.max_duration_ut)\n                    arg_1 += 1\n        arg_0._hasFunc = True", "path": "gtfspy/spreading/spreader.py", "identifier": "Spreader._run", "docstring": "Run the actual simulation.", "docstring_tokens": ["Run", "the", "actual", "simulation", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 259559}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/core.py#L199-L213", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Returns the number of parameters in the network.", "language": "python", "parameters": "(self)", "return_statement": "return n_params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_0", ".", "all_params", ")", ":", "arg_4", "=", "1", "for", "arg_5", "in", "arg_3", ".", "get_shape", "(", ")", ":", "try", ":", "arg_5", "=", "int", "(", "arg_5", ")", "except", "Exception", ":", "arg_5", "=", "1", "if", "arg_5", ":", "arg_4", "=", "arg_4", "*", "arg_5", "arg_1", "=", "arg_1", "+", "arg_4", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns the number of parameters in the network.\"\"\"\n        arg_1 = 0\n        for arg_2, arg_3 in enumerate(arg_0.all_params):\n            arg_4 = 1\n            # for s in p.eval().shape:\n            for arg_5 in arg_3.get_shape():\n                try:\n                    arg_5 = int(arg_5)\n                except Exception:\n                    arg_5 = 1\n                if arg_5:\n                    arg_4 = arg_4 * arg_5\n            arg_1 = arg_1 + arg_4\n        return arg_1", "path": "tensorlayer/layers/core.py", "identifier": "Layer.count_params", "docstring": "Returns the number of parameters in the network.", "docstring_tokens": ["Returns", "the", "number", "of", "parameters", "in", "the", "network", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 259560}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L1083-L1101", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read the contents of a file as a Lisp expression.", "language": "python", "parameters": "(\n    filename: str,\n    resolver: Resolver = None,\n    data_readers: DataReaders = None,\n    eof: Any = None,\n    is_eof_error: bool = False,\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "None", ",", "arg_4", ":", "arg_5", "=", "None", ",", "arg_6", ":", "arg_7", "=", "None", ",", "arg_8", ":", "arg_9", "=", "False", ",", ")", "->", "Iterable", "[", "ReaderForm", "]", ":", "with", "open", "(", "arg_0", ")", "as", "f", ":", "yield", "from", "read", "(", "f", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ",", "arg_8", "=", "arg_8", ",", ")"], "function": "def Func(\n    arg_0: arg_1,\n    arg_2: arg_3 = None,\n    arg_4: arg_5 = None,\n    arg_6: arg_7 = None,\n    arg_8: arg_9 = False,\n) -> Iterable[ReaderForm]:\n    \"\"\"Read the contents of a file as a Lisp expression.\n\n    Keyword arguments to this function have the same meanings as those of\n    basilisp.lang.reader.read.\"\"\"\n    with open(arg_0) as f:\n        yield from read(\n            f,\n            arg_2=arg_2,\n            arg_4=arg_4,\n            arg_6=arg_6,\n            arg_8=arg_8,\n        )", "path": "src/basilisp/lang/reader.py", "identifier": "read_file", "docstring": "Read the contents of a file as a Lisp expression.\n\n    Keyword arguments to this function have the same meanings as those of\n    basilisp.lang.reader.read.", "docstring_tokens": ["Read", "the", "contents", "of", "a", "file", "as", "a", "Lisp", "expression", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 259561}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L674-L690", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Convert the value to its final form by unit conversions and multiplying\n    by mass.", "language": "python", "parameters": "(compound, value, mass)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "/", "3.6E6", "arg_3", "=", "arg_3", "/", "arg_0", ".", "molar_mass", "arg_3", "=", "arg_3", "*", "arg_2", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Convert the value to its final form by unit conversions and multiplying\n    by mass.\n\n    :param compound: Compound object.\n    :param value: [J/mol] Value to be finalised.\n    :param mass: [kg] Mass of compound.\n\n    :returns: [kWh] Finalised value.\n    \"\"\"\n\n    arg_3 = arg_1 / 3.6E6  # J/x -> kWh/x\n    arg_3 = arg_3 / arg_0.molar_mass  # x/mol -> x/kg\n    arg_3 = arg_3 * arg_2  # x/kg -> x\n\n    return arg_3", "path": "auxi/tools/chemistry/thermochemistry.py", "identifier": "_finalise_result_", "docstring": "Convert the value to its final form by unit conversions and multiplying\n    by mass.\n\n    :param compound: Compound object.\n    :param value: [J/mol] Value to be finalised.\n    :param mass: [kg] Mass of compound.\n\n    :returns: [kWh] Finalised value.", "docstring_tokens": ["Convert", "the", "value", "to", "its", "final", "form", "by", "unit", "conversions", "and", "multiplying", "by", "mass", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 259562}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L554-L585", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Return the items from GitLab API using links pagination", "language": "python", "parameters": "(self, path, payload)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "0", "arg_4", "=", "None", "arg_5", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "GitLabClient", ".", "PROJECTS", ",", "arg_0", ".", "owner", "+", "'%2F'", "+", "arg_0", ".", "repository", ",", "arg_1", ")", "logger", ".", "debug", "(", "\"Get GitLab paginated items from \"", "+", "arg_5", ")", "arg_6", "=", "arg_0", ".", "fetch", "(", "arg_5", ",", "arg_2", "=", "arg_2", ")", "arg_7", "=", "arg_6", ".", "text", "arg_3", "+=", "1", "if", "'last'", "in", "arg_6", ".", "links", ":", "arg_8", "=", "arg_6", ".", "links", "[", "'last'", "]", "[", "'url'", "]", "arg_4", "=", "arg_8", ".", "split", "(", "'&page='", ")", "[", "1", "]", ".", "split", "(", "'&'", ")", "[", "0", "]", "arg_4", "=", "int", "(", "arg_4", ")", "logger", ".", "debug", "(", "\"Page: %i/%i\"", "%", "(", "arg_3", ",", "arg_4", ")", ")", "while", "arg_7", ":", "yield", "arg_7", "arg_7", "=", "None", "if", "'next'", "in", "arg_6", ".", "links", ":", "arg_5", "=", "arg_6", ".", "links", "[", "'next'", "]", "[", "'url'", "]", "arg_6", "=", "arg_0", ".", "fetch", "(", "arg_5", ",", "arg_2", "=", "arg_2", ")", "arg_3", "+=", "1", "arg_7", "=", "arg_6", ".", "text", "logger", ".", "debug", "(", "\"Page: %i/%i\"", "%", "(", "arg_3", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return the items from GitLab API using links pagination\"\"\"\n\n        arg_3 = 0  # current page\n        arg_4 = None  # last page\n        arg_5 = urijoin(arg_0.base_url, GitLabClient.PROJECTS, arg_0.owner + '%2F' + arg_0.repository, arg_1)\n\n        logger.debug(\"Get GitLab paginated items from \" + arg_5)\n\n        arg_6 = arg_0.fetch(arg_5, arg_2=arg_2)\n\n        arg_7 = arg_6.text\n        arg_3 += 1\n\n        if 'last' in arg_6.links:\n            arg_8 = arg_6.links['last']['url']\n            arg_4 = arg_8.split('&page=')[1].split('&')[0]\n            arg_4 = int(arg_4)\n            logger.debug(\"Page: %i/%i\" % (arg_3, arg_4))\n\n        while arg_7:\n            yield arg_7\n\n            arg_7 = None\n\n            if 'next' in arg_6.links:\n                arg_5 = arg_6.links['next']['url']  # Loving requests :)\n                arg_6 = arg_0.fetch(arg_5, arg_2=arg_2)\n                arg_3 += 1\n\n                arg_7 = arg_6.text\n                logger.debug(\"Page: %i/%i\" % (arg_3, arg_4))", "path": "perceval/backends/core/gitlab.py", "identifier": "GitLabClient.fetch_items", "docstring": "Return the items from GitLab API using links pagination", "docstring_tokens": ["Return", "the", "items", "from", "GitLab", "API", "using", "links", "pagination"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259563}
{"url": "https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/colorful/core.py#L363-L382", "sha": "919fa6da17865cc5e01e6b16119193a97d180dc9", "docstring_summary": "Setup this colorful object by setting a ``colormode`` and\n        the ``colorpalette`. The ``extend_colors`` flag is used\n        to extend the currently active color palette instead of\n        replacing it.", "language": "python", "parameters": "(self, colormode=None, colorpalette=None, extend_colors=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "if", "arg_1", ":", "arg_0", ".", "colormode", "=", "arg_1", "if", "arg_2", ":", "if", "arg_3", ":", "arg_0", ".", "update_palette", "(", "arg_2", ")", "else", ":", "arg_0", ".", "colorpalette", "=", "arg_2"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=False):\n        \"\"\"\n        Setup this colorful object by setting a ``colormode`` and\n        the ``colorpalette`. The ``extend_colors`` flag is used\n        to extend the currently active color palette instead of\n        replacing it.\n\n        :param int colormode: the color mode to use. See ``translate_rgb_to_ansi_code``\n        :parma dict colorpalette: the colorpalette to use. This ``dict`` should map\n                                  color names to it's corresponding RGB value\n        :param bool extend_colors: extend the active color palette instead of replacing it\n        \"\"\"\n        if arg_1:\n            arg_0.colormode = arg_1\n\n        if arg_2:\n            if arg_3:\n                arg_0.update_palette(arg_2)\n            else:\n                arg_0.colorpalette = arg_2", "path": "colorful/core.py", "identifier": "Colorful.setup", "docstring": "Setup this colorful object by setting a ``colormode`` and\n        the ``colorpalette`. The ``extend_colors`` flag is used\n        to extend the currently active color palette instead of\n        replacing it.\n\n        :param int colormode: the color mode to use. See ``translate_rgb_to_ansi_code``\n        :parma dict colorpalette: the colorpalette to use. This ``dict`` should map\n                                  color names to it's corresponding RGB value\n        :param bool extend_colors: extend the active color palette instead of replacing it", "docstring_tokens": ["Setup", "this", "colorful", "object", "by", "setting", "a", "colormode", "and", "the", "colorpalette", ".", "The", "extend_colors", "flag", "is", "used", "to", "extend", "the", "currently", "active", "color", "palette", "instead", "of", "replacing", "it", "."], "nwo": "timofurrer/colorful", "score": 0.585749501312285, "idx": 259564}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dictdb.py#L126-L132", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "extract subdict of keys", "language": "python", "parameters": "(self, rec, keys)", "return_statement": "return copy(d)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "}", "arg_3", "[", "'msg_id'", "]", "=", "arg_1", "[", "'msg_id'", "]", "for", "arg_4", "in", "arg_2", ":", "arg_3", "[", "arg_4", "]", "=", "arg_1", "[", "arg_4", "]", "return", "copy", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"extract subdict of keys\"\"\"\n        arg_3 = {}\n        arg_3['msg_id'] = arg_1['msg_id']\n        for arg_4 in arg_2:\n            arg_3[arg_4] = arg_1[arg_4]\n        return copy(arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/dictdb.py", "identifier": "DictDB._extract_subdict", "docstring": "extract subdict of keys", "docstring_tokens": ["extract", "subdict", "of", "keys"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259565}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/mhd/write.py#L46-L70", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Write the data into a raw format file. Big endian is always used.", "language": "python", "parameters": "(filename, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "ndim", "==", "3", ":", "arg_1", "=", "arg_1", ".", "reshape", "(", "[", "arg_1", ".", "shape", "[", "0", "]", ",", "arg_1", ".", "shape", "[", "1", "]", "*", "arg_1", ".", "shape", "[", "2", "]", "]", ")", "arg_2", "=", "array", ".", "array", "(", "'f'", ")", "for", "arg_3", "in", "arg_1", ":", "arg_2", ".", "fromlist", "(", "list", "(", "arg_3", ".", "flatten", "(", ")", ")", ")", "with", "open", "(", "arg_0", ",", "'wb'", ")", "as", "rawf", ":", "arg_2", ".", "tofile", "(", "rawf", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Write the data into a raw format file. Big endian is always used.\n\n    Parameters\n    ----------\n    filename: str\n        Path to the output file\n\n    data: numpy.ndarray\n        n-dimensional image data array.\n    \"\"\"\n    if arg_1.ndim == 3:\n        # Begin 3D fix\n        arg_1 = arg_1.reshape([arg_1.shape[0], arg_1.shape[1]*arg_1.shape[2]])\n        # End 3D fix\n\n    arg_2 = array.array('f')\n    for arg_3 in arg_1:\n        arg_2.fromlist(list(arg_3.flatten()))\n\n    # if is_little_endian():\n    #     a.byteswap()\n\n    with open(arg_0, 'wb') as rawf:\n        arg_2.tofile(rawf)", "path": "boyle/mhd/write.py", "identifier": "dump_raw_data", "docstring": "Write the data into a raw format file. Big endian is always used.\n\n    Parameters\n    ----------\n    filename: str\n        Path to the output file\n\n    data: numpy.ndarray\n        n-dimensional image data array.", "docstring_tokens": ["Write", "the", "data", "into", "a", "raw", "format", "file", ".", "Big", "endian", "is", "always", "used", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259566}
{"url": "https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L375-L381", "sha": "51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126", "docstring_summary": "r'\"|\\", "language": "python", "parameters": "(self, t)", "return_statement": "return t", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "value", "[", "0", "]", "==", "'\"'", ":", "arg_1", ".", "lexer", ".", "push_state", "(", "'istringquotes'", ")", "elif", "arg_1", ".", "value", "[", "0", "]", "==", "'\\''", ":", "arg_1", ".", "lexer", ".", "push_state", "(", "'istringapostrophe'", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        r'\"|\\''\n        if arg_1.value[0] == '\"':\n            arg_1.lexer.push_state('istringquotes')\n        elif arg_1.value[0] == '\\'':\n            arg_1.lexer.push_state('istringapostrophe')\n        return arg_1", "path": "lesscpy/lessc/lexer.py", "identifier": "LessLexer.t_t_isopen", "docstring": "r'\"|\\", "docstring_tokens": ["r", "|", "\\"], "nwo": "lesscpy/lesscpy", "score": 0.36630042150969844, "idx": 259567}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/loader.py#L356-L364", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "update self.config from a flag, which can be a dict or Config", "language": "python", "parameters": "(self, cfg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "(", "dict", ",", "Config", ")", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "iteritems", "(", ")", ":", "arg_0", ".", "config", "[", "arg_2", "]", ".", "update", "(", "arg_3", ")", "else", ":", "raise", "TypeError", "(", "\"Invalid flag: %r\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"update self.config from a flag, which can be a dict or Config\"\"\"\n        if isinstance(arg_1, (dict, Config)):\n            # don't clobber whole config sections, update\n            # each section from config:\n            for arg_2,arg_3 in arg_1.iteritems():\n                arg_0.config[arg_2].update(arg_3)\n        else:\n            raise TypeError(\"Invalid flag: %r\" % arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/config/loader.py", "identifier": "CommandLineConfigLoader._load_flag", "docstring": "update self.config from a flag, which can be a dict or Config", "docstring_tokens": ["update", "self", ".", "config", "from", "a", "flag", "which", "can", "be", "a", "dict", "or", "Config"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259568}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L562-L577", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "It turns out that r tags can contain both t tags and drawing tags. Since we\n    need both, this function will return them in the order in which they are\n    found.", "language": "python", "parameters": "(r)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_namespace", "(", "arg_0", ",", "'w'", ")", "arg_2", "=", "(", "'%st'", "%", "arg_1", ",", "'%sdrawing'", "%", "arg_1", ",", "'%spict'", "%", "arg_1", ",", "'%sbr'", "%", "arg_1", ",", ")", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", ".", "tag", "in", "arg_2", ":", "yield", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    It turns out that r tags can contain both t tags and drawing tags. Since we\n    need both, this function will return them in the order in which they are\n    found.\n    \"\"\"\n    arg_1 = get_namespace(arg_0, 'w')\n    arg_2 = (\n        '%st' % arg_1,\n        '%sdrawing' % arg_1,\n        '%spict' % arg_1,\n        '%sbr' % arg_1,\n    )\n    for arg_3 in arg_0:\n        if arg_3.tag in arg_2:\n            yield arg_3", "path": "docx2html/core.py", "identifier": "get_text_run_content_data", "docstring": "It turns out that r tags can contain both t tags and drawing tags. Since we\n    need both, this function will return them in the order in which they are\n    found.", "docstring_tokens": ["It", "turns", "out", "that", "r", "tags", "can", "contain", "both", "t", "tags", "and", "drawing", "tags", ".", "Since", "we", "need", "both", "this", "function", "will", "return", "them", "in", "the", "order", "in", "which", "they", "are", "found", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 259569}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/delete.py#L70-L93", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "destroy an instance, meaning take down the instance and stop the build.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_instances", "(", ")", "arg_3", "=", "arg_0", ".", "_get_project", "(", ")", "arg_4", "=", "arg_0", ".", "_get_zone", "(", ")", "arg_5", "=", "False", "if", "'items'", "in", "arg_2", ":", "for", "arg_6", "in", "arg_2", "[", "'items'", "]", ":", "if", "arg_6", "[", "'name'", "]", "==", "arg_1", ":", "arg_5", "=", "True", "break", "if", "arg_5", ":", "bot", ".", "info", "(", "'Killing instance %s'", "%", "arg_1", ")", "return", "arg_0", ".", "_compute_service", ".", "instances", "(", ")", ".", "delete", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_1", ")", ".", "execute", "(", ")"], "function": "def Func(arg_0, arg_1):\n    '''Func an instance, meaning take down the instance and stop the build.\n\n       Parameters\n       ==========\n       name: the name of the instance to stop building.\n    '''\n\n    arg_2 = arg_0._get_instances()\n    arg_3 = arg_0._get_project()\n    arg_4 = arg_0._get_zone()\n    arg_5 = False\n\n    if 'items' in arg_2:\n        for arg_6 in arg_2['items']:\n            if arg_6['name'] == arg_1:\n                arg_5 = True\n                break\n\n    if arg_5:        \n        bot.info('Killing instance %s' %arg_1)\n        return arg_0._compute_service.instances().delete(arg_3=arg_3, \n                                                        arg_4=arg_4, \n                                                        arg_6=arg_1).execute()", "path": "sregistry/main/google_build/delete.py", "identifier": "destroy", "docstring": "destroy an instance, meaning take down the instance and stop the build.\n\n       Parameters\n       ==========\n       name: the name of the instance to stop building.", "docstring_tokens": ["destroy", "an", "instance", "meaning", "take", "down", "the", "instance", "and", "stop", "the", "build", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 259570}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4202-L4226", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Select a circular region centred on xc, yc, with a radius of r.", "language": "python", "parameters": "(self, x, y, xc, yc, r, mode=\"replace\", name=\"default\", inclusive=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "\"replace\"", ",", "arg_7", "=", "\"default\"", ",", "arg_8", "=", "True", ")", ":", "if", "arg_8", ":", "arg_9", "=", "(", "arg_0", "[", "arg_1", "]", "-", "arg_3", ")", "**", "2", "+", "(", "arg_0", "[", "arg_2", "]", "-", "arg_4", ")", "**", "2", "<=", "arg_5", "**", "2", "else", ":", "arg_9", "=", "(", "arg_0", "[", "arg_1", "]", "-", "arg_3", ")", "**", "2", "+", "(", "arg_0", "[", "arg_2", "]", "-", "arg_4", ")", "**", "2", "<", "arg_5", "**", "2", "arg_0", ".", "select", "(", "boolean_expression", "=", "arg_9", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6=\"replace\", arg_7=\"default\", arg_8=True):\n        \"\"\"\n        Select a circular region centred on xc, yc, with a radius of r.\n\n        Example:\n\n        >>> df.Func('x','y',2,3,1)\n\n        :param x: expression for the x space\n        :param y: expression for the y space\n        :param xc: location of the centre of the circle in x\n        :param yc: location of the centre of the circle in y\n        :param r: the radius of the circle\n        :param name: name of the selection\n        :param mode:\n        :return:\n        \"\"\"\n\n        # expr = \"({x}-{xc})**2 + ({y}-{yc})**2 <={r}**2\".format(**locals())\n        if arg_8:\n            arg_9 = (arg_0[arg_1] - arg_3)**2 + (arg_0[arg_2] - arg_4)**2 <= arg_5**2\n        else:\n            arg_9 = (arg_0[arg_1] - arg_3)**2 + (arg_0[arg_2] - arg_4)**2 < arg_5**2\n\n        arg_0.select(boolean_expression=arg_9, arg_6=arg_6, arg_7=arg_7)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.select_circle", "docstring": "Select a circular region centred on xc, yc, with a radius of r.\n\n        Example:\n\n        >>> df.select_circle('x','y',2,3,1)\n\n        :param x: expression for the x space\n        :param y: expression for the y space\n        :param xc: location of the centre of the circle in x\n        :param yc: location of the centre of the circle in y\n        :param r: the radius of the circle\n        :param name: name of the selection\n        :param mode:\n        :return:", "docstring_tokens": ["Select", "a", "circular", "region", "centred", "on", "xc", "yc", "with", "a", "radius", "of", "r", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 259571}
{"url": "https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/acts.py#L118-L132", "sha": "b7ad20fe8e7137db99a20ac06b8da26492601b00", "docstring_summary": "Returns the filename of the appropriate sakefile", "language": "python", "parameters": "(settings)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "[", "\"error\"", "]", "if", "arg_0", "[", "\"customsake\"", "]", ":", "arg_2", "=", "arg_0", "[", "\"customsake\"", "]", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "arg_1", "(", "\"Specified sakefile '{}' doesn't exist\"", ",", "arg_2", ")", "sys", ".", "exit", "(", "1", ")", "return", "arg_2", "for", "arg_3", "in", "[", "\"Sakefile\"", ",", "\"Sakefile.yaml\"", ",", "\"Sakefile.yml\"", "]", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_3", ")", ":", "return", "arg_3", "arg_1", "(", "\"Error: there is no Sakefile to read\"", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0):\n    \"\"\"Returns the filename of the appropriate sakefile\"\"\"\n    arg_1 = arg_0[\"error\"]\n    if arg_0[\"customsake\"]:\n        arg_2 = arg_0[\"customsake\"]\n        if not os.path.isfile(arg_2):\n            arg_1(\"Specified sakefile '{}' doesn't exist\", arg_2)\n            sys.exit(1)\n        return arg_2\n    # no custom specified, going over defaults in order\n    for arg_3 in [\"Sakefile\", \"Sakefile.yaml\", \"Sakefile.yml\"]:\n        if os.path.isfile(arg_3):\n            return arg_3\n    arg_1(\"Error: there is no Sakefile to read\")\n    sys.exit(1)", "path": "sakelib/acts.py", "identifier": "find_standard_sakefile", "docstring": "Returns the filename of the appropriate sakefile", "docstring_tokens": ["Returns", "the", "filename", "of", "the", "appropriate", "sakefile"], "nwo": "tonyfischetti/sake", "score": 0.3086509652907828, "idx": 259572}
{"url": "https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/cli/__init__.py#L19-L29", "sha": "d8de0388ba98b85ce472e0f49ac18fecb14d3343", "docstring_summary": "Partitions a list into two based on a condition.", "language": "python", "parameters": "(condition, collection)", "return_statement": "return succeed, fail", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", "->", "Tuple", "[", "List", ",", "List", "]", ":", "arg_2", ",", "arg_3", "=", "[", "]", ",", "[", "]", "for", "arg_4", "in", "arg_1", ":", "if", "arg_0", "(", "arg_4", ")", ":", "arg_2", ".", "append", "(", "arg_4", ")", "else", ":", "arg_3", ".", "append", "(", "arg_4", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1) -> Tuple[List, List]:\n    \"\"\"Partitions a list into two based on a condition.\"\"\"\n    arg_2, arg_3 = [], []\n\n    for arg_4 in arg_1:\n        if arg_0(arg_4):\n            arg_2.append(arg_4)\n        else:\n            arg_3.append(arg_4)\n\n    return arg_2, arg_3", "path": "hyperion/cli/__init__.py", "identifier": "partition", "docstring": "Partitions a list into two based on a condition.", "docstring_tokens": ["Partitions", "a", "list", "into", "two", "based", "on", "a", "condition", "."], "nwo": "arlyon/hyperion", "score": 0.08529914490135834, "idx": 259573}
{"url": "https://github.com/limix/glimix-core/blob/cddd0994591d100499cc41c1f480ddd575e7a980/glimix_core/random/_canonical.py#L10-L68", "sha": "cddd0994591d100499cc41c1f480ddd575e7a980", "docstring_summary": "r\"\"\"Bernoulli likelihood sampling.", "language": "python", "parameters": "(\n    offset,\n    G,\n    heritability=0.5,\n    causal_variants=None,\n    causal_variance=0,\n    random_state=None,\n)", "return_statement": "return sampler.sample(random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.5", ",", "arg_3", "=", "None", ",", "arg_4", "=", "0", ",", "arg_5", "=", "None", ",", ")", ":", "arg_6", "=", "LogitLink", "(", ")", "arg_7", ",", "arg_8", "=", "_mean_cov", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "arg_9", "=", "BernoulliProdLik", "(", "arg_6", ")", "arg_10", "=", "GGPSampler", "(", "arg_9", ",", "arg_7", ",", "arg_8", ")", "return", "arg_10", ".", "sample", "(", "arg_5", ")"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2=0.5,\n    arg_3=None,\n    arg_4=0,\n    arg_5=None,\n):\n    r\"\"\"Bernoulli likelihood sampling.\n\n    Sample according to\n\n    .. math::\n\n        \\mathbf y \\sim \\prod_{i=1}^n\n        \\text{Bernoulli}(\\mu_i = \\text{logit}(z_i))\n        \\mathcal N(~ o \\mathbf 1 + \\mathbf a^\\intercal \\boldsymbol\\alpha;\n        ~ (h^2 - v_c)\\mathrm G^\\intercal\\mathrm G +\n        (1-h^2-v_c)\\mathrm I ~)\n\n    using the canonical Logit link function to define the conditional Bernoulli\n    mean :math:`\\mu_i`.\n\n    The causal :math:`\\mathbf a` covariates and the corresponding effect-sizes\n    are randomly draw according to the following idea. The ``causal_variants``,\n    if given, are first mean-zero and std-one normalized and then having\n    its elements divided by the squared-root the the number of variances::\n\n        causal_variants = _stdnorm(causal_variants, axis=0)\n        causal_variants /= sqrt(causal_variants.shape[1])\n\n    The causal effect-sizes :math:`\\boldsymbol\\alpha` are draw from\n    :math:`\\{-1, +1\\}` and subsequently normalized for mean-zero and std-one\"\"\n\n    Parameters\n    ----------\n    random_state : random_state\n        Set the initial random state.\n\n    Example\n    -------\n\n    .. doctest::\n\n        >>> from glimix_core.random import Func\n        >>> from numpy.random import RandomState\n        >>> offset = 5\n        >>> G = [[1, -1], [2, 1]]\n        >>> Func(offset, G, random_state=RandomState(0))\n        array([1., 1.])\n    \"\"\"\n    arg_6 = LogitLink()\n    arg_7, arg_8 = _mean_cov(\n        arg_0, arg_1, arg_2, arg_3, arg_4, arg_5\n    )\n    arg_9 = BernoulliProdLik(arg_6)\n    arg_10 = GGPSampler(arg_9, arg_7, arg_8)\n\n    return arg_10.sample(arg_5)", "path": "glimix_core/random/_canonical.py", "identifier": "bernoulli_sample", "docstring": "r\"\"\"Bernoulli likelihood sampling.\n\n    Sample according to\n\n    .. math::\n\n        \\mathbf y \\sim \\prod_{i=1}^n\n        \\text{Bernoulli}(\\mu_i = \\text{logit}(z_i))\n        \\mathcal N(~ o \\mathbf 1 + \\mathbf a^\\intercal \\boldsymbol\\alpha;\n        ~ (h^2 - v_c)\\mathrm G^\\intercal\\mathrm G +\n        (1-h^2-v_c)\\mathrm I ~)\n\n    using the canonical Logit link function to define the conditional Bernoulli\n    mean :math:`\\mu_i`.\n\n    The causal :math:`\\mathbf a` covariates and the corresponding effect-sizes\n    are randomly draw according to the following idea. The ``causal_variants``,\n    if given, are first mean-zero and std-one normalized and then having\n    its elements divided by the squared-root the the number of variances::\n\n        causal_variants = _stdnorm(causal_variants, axis=0)\n        causal_variants /= sqrt(causal_variants.shape[1])\n\n    The causal effect-sizes :math:`\\boldsymbol\\alpha` are draw from\n    :math:`\\{-1, +1\\}` and subsequently normalized for mean-zero and std-one\"\"\n\n    Parameters\n    ----------\n    random_state : random_state\n        Set the initial random state.\n\n    Example\n    -------\n\n    .. doctest::\n\n        >>> from glimix_core.random import bernoulli_sample\n        >>> from numpy.random import RandomState\n        >>> offset = 5\n        >>> G = [[1, -1], [2, 1]]\n        >>> bernoulli_sample(offset, G, random_state=RandomState(0))\n        array([1., 1.])", "docstring_tokens": ["r", "Bernoulli", "likelihood", "sampling", "."], "nwo": "limix/glimix-core", "score": 0.37326674238089064, "idx": 259574}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/jenkins.py#L74-L88", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the builds from the url.", "language": "python", "parameters": "(self, category=CATEGORY_BUILD)", "return_statement": "return items", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_3", "=", "{", "}", "arg_4", "=", "super", "(", ")", ".", "Func", "(", "arg_1", ",", "**", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Fetch the builds from the url.\n\n        The method retrieves, from a Jenkins url, the\n        builds updated since the given date.\n\n        :param category: the category of items to Func\n\n        :returns: a generator of builds\n        \"\"\"\n\n        arg_3 = {}\n        arg_4 = super().Func(arg_1, **arg_3)\n\n        return arg_4", "path": "perceval/backends/core/jenkins.py", "identifier": "Jenkins.fetch", "docstring": "Fetch the builds from the url.\n\n        The method retrieves, from a Jenkins url, the\n        builds updated since the given date.\n\n        :param category: the category of items to fetch\n\n        :returns: a generator of builds", "docstring_tokens": ["Fetch", "the", "builds", "from", "the", "url", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259575}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/examples/python/circuit_draw.py#L16-L24", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Returns a circuit putting 2 qubits in the Bell state.", "language": "python", "parameters": "()", "return_statement": "return qc", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "QuantumRegister", "(", "2", ")", "arg_1", "=", "ClassicalRegister", "(", "2", ")", "arg_2", "=", "QuantumCircuit", "(", "arg_0", ",", "arg_1", ")", "arg_2", ".", "h", "(", "arg_0", "[", "0", "]", ")", "arg_2", ".", "cx", "(", "arg_0", "[", "0", "]", ",", "arg_0", "[", "1", "]", ")", "arg_2", ".", "measure", "(", "arg_0", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func():\n    \"\"\"Returns a circuit putting 2 qubits in the Bell state.\"\"\"\n    arg_0 = QuantumRegister(2)\n    arg_1 = ClassicalRegister(2)\n    arg_2 = QuantumCircuit(arg_0, arg_1)\n    arg_2.h(arg_0[0])\n    arg_2.cx(arg_0[0], arg_0[1])\n    arg_2.measure(arg_0, arg_1)\n    return arg_2", "path": "examples/python/circuit_draw.py", "identifier": "build_bell_circuit", "docstring": "Returns a circuit putting 2 qubits in the Bell state.", "docstring_tokens": ["Returns", "a", "circuit", "putting", "2", "qubits", "in", "the", "Bell", "state", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259576}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/cache/security_groups_client.py#L95-L142", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Creates a payload for the redis server", "language": "python", "parameters": "(self, groups)", "return_statement": "return rules", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_2", ".", "extend", "(", "arg_0", ".", "serialize_rules", "(", "arg_3", ".", "rules", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Creates a payload for the redis server\n\n        The rule schema is the following:\n\n        REDIS KEY - port_device_id.port_mac_address/sg\n        REDIS VALUE - A JSON dump of the following:\n\n        port_mac_address must be lower-cased and stripped of non-alphanumeric\n        characters\n\n        {\"id\": \"<arbitrary uuid>\",\n          \"rules\": [\n            {\"ethertype\": <hexademical integer>,\n             \"protocol\": <integer>,\n             \"port start\": <integer>,  # optional\n             \"port end\": <integer>,    # optional\n             \"icmp type\": <integer>,   # optional\n             \"icmp code\": <integer>,   # optional\n             \"source network\": <string>,\n             \"destination network\": <string>,\n             \"action\": <string>,\n             \"direction\": <string>},\n          ],\n          \"security groups ack\": <boolean>\n        }\n\n        Example:\n        {\"id\": \"004c6369-9f3d-4d33-b8f5-9416bf3567dd\",\n         \"rules\": [\n           {\"ethertype\": 0x800,\n            \"protocol\": \"tcp\",\n            \"port start\": 1000,\n            \"port end\": 1999,\n            \"source network\": \"10.10.10.0/24\",\n            \"destination network\": \"\",\n            \"action\": \"allow\",\n            \"direction\": \"ingress\"},\n          ],\n          \"security groups ack\": \"true\"\n        }\n\n        port start/end and icmp type/code are mutually exclusive pairs.\n        \"\"\"\n        arg_2 = []\n        for arg_3 in arg_1:\n            arg_2.extend(arg_0.serialize_rules(arg_3.rules))\n        return arg_2", "path": "quark/cache/security_groups_client.py", "identifier": "SecurityGroupsClient.serialize_groups", "docstring": "Creates a payload for the redis server\n\n        The rule schema is the following:\n\n        REDIS KEY - port_device_id.port_mac_address/sg\n        REDIS VALUE - A JSON dump of the following:\n\n        port_mac_address must be lower-cased and stripped of non-alphanumeric\n        characters\n\n        {\"id\": \"<arbitrary uuid>\",\n          \"rules\": [\n            {\"ethertype\": <hexademical integer>,\n             \"protocol\": <integer>,\n             \"port start\": <integer>,  # optional\n             \"port end\": <integer>,    # optional\n             \"icmp type\": <integer>,   # optional\n             \"icmp code\": <integer>,   # optional\n             \"source network\": <string>,\n             \"destination network\": <string>,\n             \"action\": <string>,\n             \"direction\": <string>},\n          ],\n          \"security groups ack\": <boolean>\n        }\n\n        Example:\n        {\"id\": \"004c6369-9f3d-4d33-b8f5-9416bf3567dd\",\n         \"rules\": [\n           {\"ethertype\": 0x800,\n            \"protocol\": \"tcp\",\n            \"port start\": 1000,\n            \"port end\": 1999,\n            \"source network\": \"10.10.10.0/24\",\n            \"destination network\": \"\",\n            \"action\": \"allow\",\n            \"direction\": \"ingress\"},\n          ],\n          \"security groups ack\": \"true\"\n        }\n\n        port start/end and icmp type/code are mutually exclusive pairs.", "docstring_tokens": ["Creates", "a", "payload", "for", "the", "redis", "server"], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 259577}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L305-L308", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform Choi representation to the Chi representation.", "language": "python", "parameters": "(data, input_dim, output_dim)", "return_statement": "return _transform_to_pauli(data, num_qubits)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "int", "(", "np", ".", "log2", "(", "arg_1", ")", ")", "return", "_transform_to_pauli", "(", "arg_0", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Transform Choi representation to the Chi representation.\"\"\"\n    arg_3 = int(np.log2(arg_1))\n    return _transform_to_pauli(arg_0, arg_3)", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_choi_to_chi", "docstring": "Transform Choi representation to the Chi representation.", "docstring_tokens": ["Transform", "Choi", "representation", "to", "the", "Chi", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259578}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L494-L506", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Adds a callback to be completed once future is done", "language": "python", "parameters": "(self, fn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "done_callback", "(", "arg_2", ")", ":", "return", "arg_1", "(", ")", "arg_0", ".", "_future", ".", "Func", "(", "done_callback", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Adds a callback to be completed once future is done\n\n        :parm fn: A callable that takes no arguments. Note that is different\n            than concurrent.futures.Future.Func that requires\n            a single argument for the future.\n        \"\"\"\n        # The done callback for concurrent.futures.Future will always pass a\n        # the future in as the only argument. So we need to create the\n        # proper signature wrapper that will invoke the callback provided.\n        def done_callback(arg_2):\n            return arg_1()\n        arg_0._future.Func(done_callback)", "path": "s3transfer/futures.py", "identifier": "ExecutorFuture.add_done_callback", "docstring": "Adds a callback to be completed once future is done\n\n        :parm fn: A callable that takes no arguments. Note that is different\n            than concurrent.futures.Future.add_done_callback that requires\n            a single argument for the future.", "docstring_tokens": ["Adds", "a", "callback", "to", "be", "completed", "once", "future", "is", "done"], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 259579}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/utils/mlengine_operator_utils.py#L32-L246", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates Operators needed for model evaluation and returns.", "language": "python", "parameters": "(task_prefix,\n                        data_format,\n                        input_paths,\n                        prediction_path,\n                        metric_fn_and_keys,\n                        validate_fn,\n                        batch_prediction_job_id=None,\n                        project_id=None,\n                        region=None,\n                        dataflow_options=None,\n                        model_uri=None,\n                        model_name=None,\n                        version_name=None,\n                        dag=None)", "return_statement": "return evaluate_prediction, evaluate_summary, evaluate_validation", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "None", ")", ":", "if", "not", "re", ".", "match", "(", "r\"^[a-zA-Z][-A-Za-z0-9]*$\"", ",", "arg_0", ")", ":", "raise", "AirflowException", "(", "\"Malformed task_id for DataFlowPythonOperator (only alphanumeric \"", "\"and hyphens are allowed but got: \"", "+", "arg_0", ")", "arg_14", ",", "arg_15", "=", "arg_4", "if", "not", "callable", "(", "arg_14", ")", ":", "raise", "AirflowException", "(", "\"`metric_fn` param must be callable.\"", ")", "if", "not", "callable", "(", "arg_5", ")", ":", "raise", "AirflowException", "(", "\"`validate_fn` param must be callable.\"", ")", "if", "arg_13", "is", "not", "None", "and", "arg_13", ".", "default_args", "is", "not", "None", ":", "arg_16", "=", "arg_13", ".", "default_args", "arg_7", "=", "arg_7", "or", "arg_16", ".", "get", "(", "'project_id'", ")", "arg_8", "=", "arg_8", "or", "arg_16", ".", "get", "(", "'region'", ")", "arg_11", "=", "arg_11", "or", "arg_16", ".", "get", "(", "'model_name'", ")", "arg_12", "=", "arg_12", "or", "arg_16", ".", "get", "(", "'version_name'", ")", "arg_9", "=", "arg_9", "or", "arg_16", ".", "get", "(", "'dataflow_default_options'", ")", "arg_17", "=", "MLEngineBatchPredictionOperator", "(", "task_id", "=", "(", "arg_0", "+", "\"-prediction\"", ")", ",", "arg_7", "=", "arg_7", ",", "job_id", "=", "arg_6", ",", "arg_8", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "output_path", "=", "arg_3", ",", "uri", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ")", "arg_18", "=", "base64", ".", "b64encode", "(", "dill", ".", "dumps", "(", "arg_14", ",", "recurse", "=", "True", ")", ")", "arg_19", "=", "DataFlowPythonOperator", "(", "task_id", "=", "(", "arg_0", "+", "\"-summary\"", ")", ",", "py_options", "=", "[", "\"-m\"", "]", ",", "py_file", "=", "\"airflow.contrib.utils.mlengine_prediction_summary\"", ",", "dataflow_default_options", "=", "arg_9", ",", "options", "=", "{", "\"prediction_path\"", ":", "arg_3", ",", "\"metric_fn_encoded\"", ":", "arg_18", ",", "\"metric_keys\"", ":", "','", ".", "join", "(", "arg_15", ")", "}", ",", "arg_13", "=", "arg_13", ")", "arg_19", ".", "set_upstream", "(", "arg_17", ")", "def", "apply_validate_fn", "(", "*", "arg_20", ",", "**", "arg_21", ")", ":", "arg_3", "=", "arg_21", "[", "\"templates_dict\"", "]", "[", "\"prediction_path\"", "]", "arg_22", ",", "arg_23", ",", "arg_24", ",", "arg_25", ",", "arg_25", "=", "urlsplit", "(", "arg_3", ")", "if", "arg_22", "!=", "\"gs\"", "or", "not", "arg_23", "or", "not", "arg_24", ":", "raise", "ValueError", "(", "\"Wrong format prediction_path: %s\"", ",", "arg_3", ")", "arg_26", "=", "os", ".", "path", ".", "join", "(", "arg_24", ".", "strip", "(", "\"/\"", ")", ",", "\"prediction.summary.json\"", ")", "arg_27", "=", "GoogleCloudStorageHook", "(", ")", "arg_26", "=", "json", ".", "loads", "(", "arg_27", ".", "download", "(", "arg_23", ",", "arg_26", ")", ")", "return", "arg_5", "(", "arg_26", ")", "arg_28", "=", "PythonOperator", "(", "task_id", "=", "(", "arg_0", "+", "\"-validation\"", ")", ",", "python_callable", "=", "apply_validate_fn", ",", "provide_context", "=", "True", ",", "templates_dict", "=", "{", "\"prediction_path\"", ":", "arg_3", "}", ",", "arg_13", "=", "arg_13", ")", "arg_28", ".", "set_upstream", "(", "arg_19", ")", "return", "arg_17", ",", "arg_19", ",", "arg_28"], "function": "def Func(arg_0,\n                        arg_1,\n                        arg_2,\n                        arg_3,\n                        arg_4,\n                        arg_5,\n                        arg_6=None,\n                        arg_7=None,\n                        arg_8=None,\n                        arg_9=None,\n                        arg_10=None,\n                        arg_11=None,\n                        arg_12=None,\n                        arg_13=None):\n    \"\"\"\n    Creates Operators needed for model evaluation and returns.\n\n    It gets prediction over inputs via Cloud ML Engine BatchPrediction API by\n    calling MLEngineBatchPredictionOperator, then summarize and validate\n    the result via Cloud Dataflow using DataFlowPythonOperator.\n\n    For details and pricing about Batch prediction, please refer to the website\n    https://cloud.google.com/ml-engine/docs/how-tos/batch-predict\n    and for Cloud Dataflow, https://cloud.google.com/dataflow/docs/\n\n    It returns three chained operators for prediction, summary, and validation,\n    named as <prefix>-prediction, <prefix>-summary, and <prefix>-validation,\n    respectively.\n    (<prefix> should contain only alphanumeric characters or hyphen.)\n\n    The upstream and downstream can be set accordingly like:\n      pred, _, val = Func(...)\n      pred.set_upstream(upstream_op)\n      ...\n      downstream_op.set_upstream(val)\n\n    Callers will provide two python callables, metric_fn and validate_fn, in\n    order to customize the evaluation behavior as they wish.\n    - metric_fn receives a dictionary per instance derived from json in the\n      batch prediction result. The keys might vary depending on the model.\n      It should return a tuple of metrics.\n    - validation_fn receives a dictionary of the averaged metrics that metric_fn\n      generated over all instances.\n      The key/value of the dictionary matches to what's given by\n      metric_fn_and_keys arg.\n      The dictionary contains an additional metric, 'count' to represent the\n      total number of instances received for evaluation.\n      The function would raise an exception to mark the task as failed, in a\n      case the validation result is not okay to proceed (i.e. to set the trained\n      version as default).\n\n    Typical examples are like this:\n\n    def get_metric_fn_and_keys():\n        import math  # imports should be outside of the metric_fn below.\n        def error_and_squared_error(inst):\n            label = float(inst['input_label'])\n            classes = float(inst['classes'])  # 0 or 1\n            err = abs(classes-label)\n            squared_err = math.pow(classes-label, 2)\n            return (err, squared_err)  # returns a tuple.\n        return error_and_squared_error, ['err', 'mse']  # key order must match.\n\n    def validate_err_and_count(summary):\n        if summary['err'] > 0.2:\n            raise ValueError('Too high err>0.2; summary=%s' % summary)\n        if summary['mse'] > 0.05:\n            raise ValueError('Too high mse>0.05; summary=%s' % summary)\n        if summary['count'] < 1000:\n            raise ValueError('Too few instances<1000; summary=%s' % summary)\n        return summary\n\n    For the details on the other BatchPrediction-related arguments (project_id,\n    job_id, region, data_format, input_paths, prediction_path, model_uri),\n    please refer to MLEngineBatchPredictionOperator too.\n\n    :param task_prefix: a prefix for the tasks. Only alphanumeric characters and\n        hyphen are allowed (no underscores), since this will be used as dataflow\n        job name, which doesn't allow other characters.\n    :type task_prefix: str\n\n    :param data_format: either of 'TEXT', 'TF_RECORD', 'TF_RECORD_GZIP'\n    :type data_format: str\n\n    :param input_paths: a list of input paths to be sent to BatchPrediction.\n    :type input_paths: list[str]\n\n    :param prediction_path: GCS path to put the prediction results in.\n    :type prediction_path: str\n\n    :param metric_fn_and_keys: a tuple of metric_fn and metric_keys:\n        - metric_fn is a function that accepts a dictionary (for an instance),\n          and returns a tuple of metric(s) that it calculates.\n        - metric_keys is a list of strings to denote the key of each metric.\n    :type metric_fn_and_keys: tuple of a function and a list[str]\n\n    :param validate_fn: a function to validate whether the averaged metric(s) is\n        good enough to push the model.\n    :type validate_fn: function\n\n    :param batch_prediction_job_id: the id to use for the Cloud ML Batch\n        prediction job. Passed directly to the MLEngineBatchPredictionOperator as\n        the job_id argument.\n    :type batch_prediction_job_id: str\n\n    :param project_id: the Google Cloud Platform project id in which to execute\n        Cloud ML Batch Prediction and Dataflow jobs. If None, then the `dag`'s\n        `default_args['project_id']` will be used.\n    :type project_id: str\n\n    :param region: the Google Cloud Platform region in which to execute Cloud ML\n        Batch Prediction and Dataflow jobs. If None, then the `dag`'s\n        `default_args['region']` will be used.\n    :type region: str\n\n    :param dataflow_options: options to run Dataflow jobs. If None, then the\n        `dag`'s `default_args['dataflow_default_options']` will be used.\n    :type dataflow_options: dictionary\n\n    :param model_uri: GCS path of the model exported by Tensorflow using\n        tensorflow.estimator.export_savedmodel(). It cannot be used with\n        model_name or version_name below. See MLEngineBatchPredictionOperator for\n        more detail.\n    :type model_uri: str\n\n    :param model_name: Used to indicate a model to use for prediction. Can be\n        used in combination with version_name, but cannot be used together with\n        model_uri. See MLEngineBatchPredictionOperator for more detail. If None,\n        then the `dag`'s `default_args['model_name']` will be used.\n    :type model_name: str\n\n    :param version_name: Used to indicate a model version to use for prediction,\n        in combination with model_name. Cannot be used together with model_uri.\n        See MLEngineBatchPredictionOperator for more detail. If None, then the\n        `dag`'s `default_args['version_name']` will be used.\n    :type version_name: str\n\n    :param dag: The `DAG` to use for all Operators.\n    :type dag: airflow.models.DAG\n\n    :returns: a tuple of three operators, (prediction, summary, validation)\n    :rtype: tuple(DataFlowPythonOperator, DataFlowPythonOperator,\n                  PythonOperator)\n    \"\"\"\n\n    # Verify that task_prefix doesn't have any special characters except hyphen\n    # '-', which is the only allowed non-alphanumeric character by Dataflow.\n    if not re.match(r\"^[a-zA-Z][-A-Za-z0-9]*$\", arg_0):\n        raise AirflowException(\n            \"Malformed task_id for DataFlowPythonOperator (only alphanumeric \"\n            \"and hyphens are allowed but got: \" + arg_0)\n\n    arg_14, arg_15 = arg_4\n    if not callable(arg_14):\n        raise AirflowException(\"`metric_fn` param must be callable.\")\n    if not callable(arg_5):\n        raise AirflowException(\"`validate_fn` param must be callable.\")\n\n    if arg_13 is not None and arg_13.default_args is not None:\n        arg_16 = arg_13.default_args\n        arg_7 = arg_7 or arg_16.get('project_id')\n        arg_8 = arg_8 or arg_16.get('region')\n        arg_11 = arg_11 or arg_16.get('model_name')\n        arg_12 = arg_12 or arg_16.get('version_name')\n        arg_9 = arg_9 or \\\n            arg_16.get('dataflow_default_options')\n\n    arg_17 = MLEngineBatchPredictionOperator(\n        task_id=(arg_0 + \"-prediction\"),\n        arg_7=arg_7,\n        job_id=arg_6,\n        arg_8=arg_8,\n        arg_1=arg_1,\n        arg_2=arg_2,\n        output_path=arg_3,\n        uri=arg_10,\n        arg_11=arg_11,\n        arg_12=arg_12,\n        arg_13=arg_13)\n\n    arg_18 = base64.b64encode(dill.dumps(arg_14, recurse=True))\n    arg_19 = DataFlowPythonOperator(\n        task_id=(arg_0 + \"-summary\"),\n        py_options=[\"-m\"],\n        py_file=\"airflow.contrib.utils.mlengine_prediction_summary\",\n        dataflow_default_options=arg_9,\n        options={\n            \"prediction_path\": arg_3,\n            \"metric_fn_encoded\": arg_18,\n            \"metric_keys\": ','.join(arg_15)\n        },\n        arg_13=arg_13)\n    arg_19.set_upstream(arg_17)\n\n    def apply_validate_fn(*arg_20, **arg_21):\n        arg_3 = arg_21[\"templates_dict\"][\"prediction_path\"]\n        arg_22, arg_23, arg_24, arg_25, arg_25 = urlsplit(arg_3)\n        if arg_22 != \"gs\" or not arg_23 or not arg_24:\n            raise ValueError(\"Wrong format prediction_path: %s\",\n                             arg_3)\n        arg_26 = os.path.join(arg_24.strip(\"/\"),\n                               \"prediction.summary.json\")\n        arg_27 = GoogleCloudStorageHook()\n        arg_26 = json.loads(arg_27.download(arg_23, arg_26))\n        return arg_5(arg_26)\n\n    arg_28 = PythonOperator(\n        task_id=(arg_0 + \"-validation\"),\n        python_callable=apply_validate_fn,\n        provide_context=True,\n        templates_dict={\"prediction_path\": arg_3},\n        arg_13=arg_13)\n    arg_28.set_upstream(arg_19)\n\n    return arg_17, arg_19, arg_28", "path": "airflow/contrib/utils/mlengine_operator_utils.py", "identifier": "create_evaluate_ops", "docstring": "Creates Operators needed for model evaluation and returns.\n\n    It gets prediction over inputs via Cloud ML Engine BatchPrediction API by\n    calling MLEngineBatchPredictionOperator, then summarize and validate\n    the result via Cloud Dataflow using DataFlowPythonOperator.\n\n    For details and pricing about Batch prediction, please refer to the website\n    https://cloud.google.com/ml-engine/docs/how-tos/batch-predict\n    and for Cloud Dataflow, https://cloud.google.com/dataflow/docs/\n\n    It returns three chained operators for prediction, summary, and validation,\n    named as <prefix>-prediction, <prefix>-summary, and <prefix>-validation,\n    respectively.\n    (<prefix> should contain only alphanumeric characters or hyphen.)\n\n    The upstream and downstream can be set accordingly like:\n      pred, _, val = create_evaluate_ops(...)\n      pred.set_upstream(upstream_op)\n      ...\n      downstream_op.set_upstream(val)\n\n    Callers will provide two python callables, metric_fn and validate_fn, in\n    order to customize the evaluation behavior as they wish.\n    - metric_fn receives a dictionary per instance derived from json in the\n      batch prediction result. The keys might vary depending on the model.\n      It should return a tuple of metrics.\n    - validation_fn receives a dictionary of the averaged metrics that metric_fn\n      generated over all instances.\n      The key/value of the dictionary matches to what's given by\n      metric_fn_and_keys arg.\n      The dictionary contains an additional metric, 'count' to represent the\n      total number of instances received for evaluation.\n      The function would raise an exception to mark the task as failed, in a\n      case the validation result is not okay to proceed (i.e. to set the trained\n      version as default).\n\n    Typical examples are like this:\n\n    def get_metric_fn_and_keys():\n        import math  # imports should be outside of the metric_fn below.\n        def error_and_squared_error(inst):\n            label = float(inst['input_label'])\n            classes = float(inst['classes'])  # 0 or 1\n            err = abs(classes-label)\n            squared_err = math.pow(classes-label, 2)\n            return (err, squared_err)  # returns a tuple.\n        return error_and_squared_error, ['err', 'mse']  # key order must match.\n\n    def validate_err_and_count(summary):\n        if summary['err'] > 0.2:\n            raise ValueError('Too high err>0.2; summary=%s' % summary)\n        if summary['mse'] > 0.05:\n            raise ValueError('Too high mse>0.05; summary=%s' % summary)\n        if summary['count'] < 1000:\n            raise ValueError('Too few instances<1000; summary=%s' % summary)\n        return summary\n\n    For the details on the other BatchPrediction-related arguments (project_id,\n    job_id, region, data_format, input_paths, prediction_path, model_uri),\n    please refer to MLEngineBatchPredictionOperator too.\n\n    :param task_prefix: a prefix for the tasks. Only alphanumeric characters and\n        hyphen are allowed (no underscores), since this will be used as dataflow\n        job name, which doesn't allow other characters.\n    :type task_prefix: str\n\n    :param data_format: either of 'TEXT', 'TF_RECORD', 'TF_RECORD_GZIP'\n    :type data_format: str\n\n    :param input_paths: a list of input paths to be sent to BatchPrediction.\n    :type input_paths: list[str]\n\n    :param prediction_path: GCS path to put the prediction results in.\n    :type prediction_path: str\n\n    :param metric_fn_and_keys: a tuple of metric_fn and metric_keys:\n        - metric_fn is a function that accepts a dictionary (for an instance),\n          and returns a tuple of metric(s) that it calculates.\n        - metric_keys is a list of strings to denote the key of each metric.\n    :type metric_fn_and_keys: tuple of a function and a list[str]\n\n    :param validate_fn: a function to validate whether the averaged metric(s) is\n        good enough to push the model.\n    :type validate_fn: function\n\n    :param batch_prediction_job_id: the id to use for the Cloud ML Batch\n        prediction job. Passed directly to the MLEngineBatchPredictionOperator as\n        the job_id argument.\n    :type batch_prediction_job_id: str\n\n    :param project_id: the Google Cloud Platform project id in which to execute\n        Cloud ML Batch Prediction and Dataflow jobs. If None, then the `dag`'s\n        `default_args['project_id']` will be used.\n    :type project_id: str\n\n    :param region: the Google Cloud Platform region in which to execute Cloud ML\n        Batch Prediction and Dataflow jobs. If None, then the `dag`'s\n        `default_args['region']` will be used.\n    :type region: str\n\n    :param dataflow_options: options to run Dataflow jobs. If None, then the\n        `dag`'s `default_args['dataflow_default_options']` will be used.\n    :type dataflow_options: dictionary\n\n    :param model_uri: GCS path of the model exported by Tensorflow using\n        tensorflow.estimator.export_savedmodel(). It cannot be used with\n        model_name or version_name below. See MLEngineBatchPredictionOperator for\n        more detail.\n    :type model_uri: str\n\n    :param model_name: Used to indicate a model to use for prediction. Can be\n        used in combination with version_name, but cannot be used together with\n        model_uri. See MLEngineBatchPredictionOperator for more detail. If None,\n        then the `dag`'s `default_args['model_name']` will be used.\n    :type model_name: str\n\n    :param version_name: Used to indicate a model version to use for prediction,\n        in combination with model_name. Cannot be used together with model_uri.\n        See MLEngineBatchPredictionOperator for more detail. If None, then the\n        `dag`'s `default_args['version_name']` will be used.\n    :type version_name: str\n\n    :param dag: The `DAG` to use for all Operators.\n    :type dag: airflow.models.DAG\n\n    :returns: a tuple of three operators, (prediction, summary, validation)\n    :rtype: tuple(DataFlowPythonOperator, DataFlowPythonOperator,\n                  PythonOperator)", "docstring_tokens": ["Creates", "Operators", "needed", "for", "model", "evaluation", "and", "returns", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259580}
{"url": "https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/examples/subscriber.py#L117-L121", "sha": "5b322f7c2b82a502b1e1b70703ae45f1f668d07d", "docstring_summary": "Callback Receiving messages from publisher", "language": "python", "parameters": "(self, topic, payload, qos, dup, retain, msgId)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "log", ".", "debug", "(", "\"msg={payload}\"", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n        '''\n        Callback Receiving messages from publisher\n        '''\n        log.debug(\"msg={payload}\", arg_2=arg_2)", "path": "examples/subscriber.py", "identifier": "MQTTService.onPublish", "docstring": "Callback Receiving messages from publisher", "docstring_tokens": ["Callback", "Receiving", "messages", "from", "publisher"], "nwo": "astrorafael/twisted-mqtt", "score": 0.28352459090240634, "idx": 259581}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/resources/resource/options.py#L11-L28", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Merges a named option collection.", "language": "python", "parameters": "(options, name, bases, default=None)", "return_statement": "return result or default", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "None", "for", "arg_5", "in", "arg_2", ":", "if", "arg_5", "is", "None", ":", "continue", "arg_6", "=", "getattr", "(", "arg_5", ",", "arg_1", ",", "None", ")", "if", "arg_6", "is", "None", ":", "continue", "arg_4", "=", "utils", ".", "cons", "(", "arg_4", ",", "arg_6", ")", "arg_6", "=", "arg_0", ".", "get", "(", "arg_1", ")", "if", "arg_6", "is", "not", "None", ":", "arg_4", "=", "utils", ".", "cons", "(", "arg_4", ",", "arg_6", ")", "return", "arg_4", "or", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"Merges a named option collection.\"\"\"\n    arg_4 = None\n    for arg_5 in arg_2:\n        if arg_5 is None:\n            continue\n\n        arg_6 = getattr(arg_5, arg_1, None)\n        if arg_6 is None:\n            continue\n\n        arg_4 = utils.cons(arg_4, arg_6)\n\n    arg_6 = arg_0.get(arg_1)\n    if arg_6 is not None:\n        arg_4 = utils.cons(arg_4, arg_6)\n\n    return arg_4 or arg_3", "path": "armet/resources/resource/options.py", "identifier": "_merge", "docstring": "Merges a named option collection.", "docstring_tokens": ["Merges", "a", "named", "option", "collection", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 259582}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1331-L1344", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Remove cards from watchlist.", "language": "python", "parameters": "(self, trade_id)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'DELETE'", "arg_3", "=", "'watchlist'", "if", "not", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_1", "=", "(", "arg_1", ",", ")", "arg_1", "=", "(", "str", "(", "i", ")", "for", "i", "in", "arg_1", ")", "arg_4", "=", "{", "'tradeId'", ":", "','", ".", "join", "(", "arg_1", ")", "}", "arg_0", ".", "__request__", "(", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_4", ")", "return", "True"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove cards from watchlist.\n\n        :params trade_id: Trade id.\n        \"\"\"\n        arg_2 = 'DELETE'\n        arg_3 = 'watchlist'\n\n        if not isinstance(arg_1, (list, tuple)):\n            arg_1 = (arg_1,)\n        arg_1 = (str(i) for i in arg_1)\n        arg_4 = {'tradeId': ','.join(arg_1)}\n        arg_0.__request__(arg_2, arg_3, arg_4=arg_4)  # returns nothing\n        return True", "path": "fut/core.py", "identifier": "Core.watchlistDelete", "docstring": "Remove cards from watchlist.\n\n        :params trade_id: Trade id.", "docstring_tokens": ["Remove", "cards", "from", "watchlist", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 259583}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/common/mixins.py#L116-L152", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Create a topic entity.", "language": "python", "parameters": "(\n            self, topic_name,\n            default_message_time_to_live=None,\n            max_size_in_megabytes=None, requires_duplicate_detection=None,\n            duplicate_detection_history_time_window=None,\n            enable_batched_operations=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "Topic", "(", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "try", ":", "return", "arg_0", ".", "mgmt_client", ".", "Func", "(", "arg_1", ",", "topic", "=", "arg_7", ",", "fail_on_exist", "=", "True", ")", "except", "requests", ".", "exceptions", ".", "ConnectionError", "as", "e", ":", "raise", "ServiceBusConnectionError", "(", "\"Namespace: {} not found\"", ".", "format", "(", "arg_0", ".", "service_namespace", ")", ",", "e", ")"], "function": "def Func(\n            arg_0, arg_1,\n            arg_2=None,\n            arg_3=None, arg_4=None,\n            arg_5=None,\n            arg_6=None):\n        \"\"\"Create a topic entity.\n\n        :param topic_name: The name of the new topic.\n        :type topic_name: str\n        :param max_size_in_megabytes: The max size to allow the topic to grow to.\n        :type max_size_in_megabytes: int\n        :param requires_duplicate_detection: Whether the topic will require every message with\n         a specified time frame to have a unique ID. Non-unique messages will be discarded.\n         Default value is False.\n        :type requires_duplicate_detection: bool\n        :param default_message_time_to_live: The length of time a message will remain in the topic\n         before it is either discarded or moved to the dead letter queue.\n        :type default_message_time_to_live: ~datetime.timedelta\n        :param duplicate_detection_history_time_window: The period within which all incoming messages\n         must have a unique message ID.\n        :type duplicate_detection_history_time_window: ~datetime.timedelta\n        :param enable_batched_operations:\n        :type: enable_batched_operations: bool\n        :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found.\n        :raises: ~azure.common.AzureConflictHttpError if a topic of the same name already exists.\n        \"\"\"\n        arg_7 = Topic(\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_2=arg_2,\n            arg_5=arg_5,\n            arg_6=arg_6)\n        try:\n            return arg_0.mgmt_client.Func(arg_1, topic=arg_7, fail_on_exist=True)\n        except requests.exceptions.ConnectionError as e:\n            raise ServiceBusConnectionError(\"Namespace: {} not found\".format(arg_0.service_namespace), e)", "path": "azure-servicebus/azure/servicebus/common/mixins.py", "identifier": "ServiceBusMixin.create_topic", "docstring": "Create a topic entity.\n\n        :param topic_name: The name of the new topic.\n        :type topic_name: str\n        :param max_size_in_megabytes: The max size to allow the topic to grow to.\n        :type max_size_in_megabytes: int\n        :param requires_duplicate_detection: Whether the topic will require every message with\n         a specified time frame to have a unique ID. Non-unique messages will be discarded.\n         Default value is False.\n        :type requires_duplicate_detection: bool\n        :param default_message_time_to_live: The length of time a message will remain in the topic\n         before it is either discarded or moved to the dead letter queue.\n        :type default_message_time_to_live: ~datetime.timedelta\n        :param duplicate_detection_history_time_window: The period within which all incoming messages\n         must have a unique message ID.\n        :type duplicate_detection_history_time_window: ~datetime.timedelta\n        :param enable_batched_operations:\n        :type: enable_batched_operations: bool\n        :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found.\n        :raises: ~azure.common.AzureConflictHttpError if a topic of the same name already exists.", "docstring_tokens": ["Create", "a", "topic", "entity", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259584}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L210-L269", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Calculates the quartet weights for the test at a random\n    subsampled chunk of loci.", "language": "python", "parameters": "(self)", "return_statement": "return wdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "sample_loci", "(", ")", "arg_2", "=", "itertools", ".", "product", "(", "*", "arg_0", ".", "imap", ".", "values", "(", ")", ")", "arg_3", "=", "uuid", ".", "uuid4", "(", ")", ".", "hex", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_2", ")", ":", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", "=", "arg_6", "arg_11", "=", "{", "}", "for", "arg_12", "in", "arg_6", ":", "if", "arg_0", ".", "rmap", "[", "arg_12", "]", "==", "\"p1\"", ":", "arg_11", "[", "\"A\"", "]", "=", "arg_1", "[", "arg_12", "]", "elif", "arg_0", ".", "rmap", "[", "arg_12", "]", "==", "\"p2\"", ":", "arg_11", "[", "\"B\"", "]", "=", "arg_1", "[", "arg_12", "]", "elif", "arg_0", ".", "rmap", "[", "arg_12", "]", "==", "\"p3\"", ":", "arg_11", "[", "\"C\"", "]", "=", "arg_1", "[", "arg_12", "]", "else", ":", "arg_11", "[", "\"D\"", "]", "=", "arg_1", "[", "arg_12", "]", "arg_13", "=", "[", "]", "for", "arg_14", "in", "list", "(", "\"ABCD\"", ")", ":", "arg_13", ".", "append", "(", "\">{}         {}\"", ".", "format", "(", "arg_14", ",", "arg_11", "[", "arg_14", "]", ")", ")", "arg_15", ",", "arg_16", "=", "count_var", "(", "arg_13", ")", "if", "arg_16", ">", "arg_0", ".", "minsnps", ":", "arg_17", "=", "\"{} {}\\n\"", ".", "format", "(", "4", ",", "len", "(", "arg_1", "[", "arg_7", "]", ")", ")", "+", "\"\\n\"", ".", "join", "(", "arg_13", ")", "arg_18", "=", "arg_0", ".", "run_tree_inference", "(", "arg_17", ",", "\"{}.{}\"", ".", "format", "(", "arg_3", ",", "arg_5", ")", ")", "arg_4", ".", "append", "(", "arg_18", ")", "arg_19", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "tempfile", ".", "tempdir", ",", "\"*{}*\"", ".", "format", "(", "arg_3", ")", ")", ")", "for", "arg_20", "in", "arg_19", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_20", ")", ":", "os", ".", "remove", "(", "arg_20", ")", "arg_21", "=", "[", "\"ABCD\"", ",", "\"ACBD\"", ",", "\"ADBC\"", "]", "arg_22", "=", "{", "arg_12", ":", "float", "(", "arg_4", ".", "count", "(", "arg_12", ")", ")", "/", "len", "(", "arg_4", ")", "for", "arg_12", "in", "arg_21", "}", "return", "arg_22"], "function": "def Func(arg_0):\n    \"\"\" \n    Calculates the quartet weights for the test at a random\n    subsampled chunk of loci.\n    \"\"\"\n\n    ## subsample loci \n    arg_1 = arg_0.sample_loci()\n\n    ## find all iterations of samples for this quartet\n    arg_2 = itertools.product(*arg_0.imap.values())\n\n    ## run tree inference for each iteration of sampledict\n    arg_3 = uuid.uuid4().hex\n    arg_4 = []\n    for arg_5, arg_6 in enumerate(arg_2):\n        \n        ## get subalignment for this iteration and make to nex\n        arg_7,arg_8,arg_9,arg_10 = arg_6\n        arg_11 = {}\n        for arg_12 in arg_6:\n            if arg_0.rmap[arg_12] == \"p1\":\n                arg_11[\"A\"] = arg_1[arg_12]\n            elif arg_0.rmap[arg_12] == \"p2\":\n                arg_11[\"B\"] = arg_1[arg_12]\n            elif arg_0.rmap[arg_12] == \"p3\":\n                arg_11[\"C\"] = arg_1[arg_12]\n            else:\n                arg_11[\"D\"] = arg_1[arg_12]\n                \n        ## write as nexus file\n        arg_13 = []\n        for arg_14 in list(\"ABCD\"):\n            arg_13.append(\">{}         {}\".format(arg_14, arg_11[arg_14]))\n            \n        ## check for too much missing or lack of variants\n        arg_15, arg_16 = count_var(arg_13)\n\n        ## only run test if there's variation present\n        if arg_16 > arg_0.minsnps:\n               \n            ## format as nexus file\n            arg_17 = \"{} {}\\n\".format(4, len(arg_1[arg_7])) + \"\\n\".join(arg_13)    \n\n            ## infer ML tree\n            arg_18 = arg_0.run_tree_inference(arg_17, \"{}.{}\".format(arg_3, arg_5))\n\n            ## add to list\n            arg_4.append(arg_18)\n\n    ## cleanup - remove all files with the hash val\n    arg_19 = glob.glob(os.path.join(tempfile.tempdir, \"*{}*\".format(arg_3)))\n    for arg_20 in arg_19:\n        if os.path.exists(arg_20):\n            os.remove(arg_20)\n\n    ## return result as weights for the set topologies.\n    arg_21 = [\"ABCD\", \"ACBD\", \"ADBC\"]\n    arg_22 = {arg_12:float(arg_4.count(arg_12))/len(arg_4) for arg_12 in arg_21}\n    return arg_22", "path": "ipyrad/analysis/twiist.py", "identifier": "worker", "docstring": "Calculates the quartet weights for the test at a random\n    subsampled chunk of loci.", "docstring_tokens": ["Calculates", "the", "quartet", "weights", "for", "the", "test", "at", "a", "random", "subsampled", "chunk", "of", "loci", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 259585}
{"url": "https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L177-L183", "sha": "3dc6ad803f0b0d56586dec9542a6a06aa06cf569", "docstring_summary": "Print status of containers and networks", "language": "python", "parameters": "(opts)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "load_config", "(", "arg_0", ".", "config", ")", "arg_2", "=", "get_blockade", "(", "arg_1", ",", "arg_0", ")", "arg_3", "=", "arg_2", ".", "status", "(", ")", "print_containers", "(", "arg_3", ",", "arg_0", ".", "json", ")"], "function": "def Func(arg_0):\n    \"\"\"Print status of containers and networks\n    \"\"\"\n    arg_1 = load_config(arg_0.config)\n    arg_2 = get_blockade(arg_1, arg_0)\n    arg_3 = arg_2.status()\n    print_containers(arg_3, arg_0.json)", "path": "blockade/cli.py", "identifier": "cmd_status", "docstring": "Print status of containers and networks", "docstring_tokens": ["Print", "status", "of", "containers", "and", "networks"], "nwo": "worstcase/blockade", "score": 0.7770804820985606, "idx": 259586}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_editor.py#L218-L235", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Updates the editor when the object trait changes externally to the\n            editor.", "language": "python", "parameters": "( self )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "value", "arg_2", "=", "arg_0", ".", "factory", ".", "canvas", "if", "arg_2", "is", "not", "None", ":", "for", "arg_3", "in", "arg_2", ".", "node_children", ":", "arg_4", "=", "getattr", "(", "arg_1", ",", "arg_3", ")", "arg_0", ".", "_add_nodes", "(", "arg_4", ")", "for", "arg_5", "in", "arg_2", ".", "edge_children", ":", "arg_6", "=", "getattr", "(", "arg_1", ",", "arg_5", ")", "arg_0", ".", "_add_edges", "(", "arg_6", ")", "arg_0", ".", "_add_listeners", "(", ")"], "function": "def Func ( arg_0 ):\n        \"\"\" Updates the editor when the object trait changes externally to the\n            editor.\n        \"\"\"\n        arg_1 = arg_0.value\n        # Graph the new object...\n        arg_2 = arg_0.factory.canvas\n        if arg_2 is not None:\n            for arg_3 in arg_2.node_children:\n                arg_4 = getattr(arg_1, arg_3)\n                arg_0._add_nodes(arg_4)\n\n            for arg_5 in arg_2.edge_children:\n                arg_6 = getattr(arg_1, arg_5)\n                arg_0._add_edges(arg_6)\n\n        # ...then listen for changes.\n        arg_0._add_listeners()", "path": "godot/ui/graph_editor.py", "identifier": "SimpleGraphEditor.update_editor", "docstring": "Updates the editor when the object trait changes externally to the\n            editor.", "docstring_tokens": ["Updates", "the", "editor", "when", "the", "object", "trait", "changes", "externally", "to", "the", "editor", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 259587}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/libplanarradpy/planrad.py#L428-L451", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "Generic IOP reader that interpolates the iop to the common wavelengths defined in the constructor", "language": "python", "parameters": "(self, file_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "lg", ".", "info", "(", "'Reading :: '", "+", "arg_1", "+", "' :: and interpolating to '", "+", "str", "(", "arg_0", ".", "wavelengths", ")", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "arg_2", "=", "csv", ".", "reader", "(", "open", "(", "arg_1", ")", ",", "delimiter", "=", "','", ",", "quotechar", "=", "'\"'", ")", "arg_3", "=", "arg_2", ".", "next", "(", ")", "arg_4", "=", "arg_2", ".", "next", "(", ")", "else", ":", "lg", ".", "exception", "(", "'Problem reading file :: '", "+", "arg_1", ")", "raise", "IOError", "try", ":", "arg_3", "=", "map", "(", "float", ",", "arg_3", ")", "arg_4", "=", "map", "(", "float", ",", "arg_4", ")", "return", "scipy", ".", "interp", "(", "arg_0", ".", "wavelengths", ",", "arg_3", ",", "arg_4", ")", "except", "IOError", ":", "lg", ".", "exception", "(", "'Error interpolating IOP to common wavelength'", ")", "return", "-", "1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Generic IOP reader that interpolates the iop to the common wavelengths defined in the constructor\n\n        :param file_name: filename and path of the csv file\n        :returns interpolated iop\n        \"\"\"\n        lg.info('Reading :: ' + arg_1 + ' :: and interpolating to ' + str(arg_0.wavelengths))\n\n        if os.path.isfile(arg_1):\n            arg_2 = csv.reader(open(arg_1), delimiter=',', quotechar='\"')\n            arg_3 = arg_2.next()\n            arg_4 = arg_2.next()\n        else:\n            lg.exception('Problem reading file :: ' + arg_1)\n            raise IOError\n\n        try:\n            arg_3 = map(float, arg_3)\n            arg_4 = map(float, arg_4)\n            return scipy.interp(arg_0.wavelengths, arg_3, arg_4)\n        except IOError:\n            lg.exception('Error interpolating IOP to common wavelength')\n            return -1", "path": "libplanarradpy/planrad.py", "identifier": "BioOpticalParameters._read_iop_from_file", "docstring": "Generic IOP reader that interpolates the iop to the common wavelengths defined in the constructor\n\n        :param file_name: filename and path of the csv file\n        :returns interpolated iop", "docstring_tokens": ["Generic", "IOP", "reader", "that", "interpolates", "the", "iop", "to", "the", "common", "wavelengths", "defined", "in", "the", "constructor"], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 259588}
{"url": "https://github.com/youtux/pypebbleapi/blob/fe7b49da9c30e4a359cc6245a416862ccb3aa589/pypebbleapi/timeline.py#L173-L186", "sha": "fe7b49da9c30e4a359cc6245a416862ccb3aa589", "docstring_summary": "Subscribe a user to the given topic.", "language": "python", "parameters": "(self, user_token, topic)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "_request", "(", "'POST'", ",", "url", "=", "arg_0", ".", "url_v1", "(", "'/user/subscriptions/'", "+", "arg_2", ")", ",", "user_agent", "=", "arg_0", ".", "user_agent", ",", "arg_1", "=", "arg_1", ",", ")", "_raise_for_status", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Subscribe a user to the given topic.\n\n        :param str user_token: The token of the user.\n        :param str topic: The topic.\n        :raises `requests.exceptions.HTTPError`: If an HTTP error occurred.\n        \"\"\"\n        arg_3 = _request('POST',\n            url=arg_0.url_v1('/user/subscriptions/' + arg_2),\n            user_agent=arg_0.user_agent,\n            arg_1=arg_1,\n        )\n        _raise_for_status(arg_3)", "path": "pypebbleapi/timeline.py", "identifier": "Timeline.subscribe", "docstring": "Subscribe a user to the given topic.\n\n        :param str user_token: The token of the user.\n        :param str topic: The topic.\n        :raises `requests.exceptions.HTTPError`: If an HTTP error occurred.", "docstring_tokens": ["Subscribe", "a", "user", "to", "the", "given", "topic", "."], "nwo": "youtux/pypebbleapi", "score": 0.0, "idx": 259589}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L470-L507", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "Export the density grid to an OpenDX file.", "language": "python", "parameters": "(self, filename, type=None, typequote='\"', **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'\"'", ",", "**", "arg_4", ")", ":", "arg_5", ",", "arg_6", "=", "os", ".", "path", ".", "splitext", "(", "arg_1", ")", "arg_1", "=", "arg_5", "+", "'.dx'", "arg_7", "=", "[", "'OpenDX density file written by gridDataFormats.Grid.export()'", ",", "'File format: http://opendx.sdsc.edu/docs/html/pages/usrgu068.htm#HDREDF'", ",", "'Data are embedded in the header and tied to the grid positions.'", ",", "'Data is written in C array order: In grid[x,y,z] the axis z is fastest'", ",", "'varying, then y, then finally x, i.e. z is the innermost loop.'", "]", "if", "arg_0", ".", "metadata", ":", "arg_7", ".", "append", "(", "'Meta data stored with the python Grid object:'", ")", "for", "arg_8", "in", "arg_0", ".", "metadata", ":", "arg_7", ".", "append", "(", "'   '", "+", "str", "(", "arg_8", ")", "+", "' = '", "+", "str", "(", "arg_0", ".", "metadata", "[", "arg_8", "]", ")", ")", "arg_7", ".", "append", "(", "'(Note: the VMD dx-reader chokes on comments below this line)'", ")", "arg_9", "=", "dict", "(", "positions", "=", "OpenDX", ".", "gridpositions", "(", "1", ",", "arg_0", ".", "grid", ".", "shape", ",", "arg_0", ".", "origin", ",", "arg_0", ".", "delta", ")", ",", "connections", "=", "OpenDX", ".", "gridconnections", "(", "2", ",", "arg_0", ".", "grid", ".", "shape", ")", ",", "data", "=", "OpenDX", ".", "array", "(", "3", ",", "arg_0", ".", "grid", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ",", ")", "arg_10", "=", "OpenDX", ".", "field", "(", "'density'", ",", "arg_9", "=", "arg_9", ",", "arg_7", "=", "arg_7", ")", "arg_10", ".", "write", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3='\"', **arg_4):\n        \"\"\"Export the density grid to an OpenDX file.\n\n        The file format is the simplest regular grid array and it is\n        also understood by VMD's and Chimera's DX reader; PyMOL\n        requires the dx `type` to be set to \"double\".\n\n        For the file format see\n        http://opendx.sdsc.edu/docs/html/pages/usrgu068.htm#HDREDF\n\n        \"\"\"\n        arg_5, arg_6 = os.path.splitext(arg_1)\n        arg_1 = arg_5 + '.dx'\n\n        arg_7 = [\n            'OpenDX density file written by gridDataFormats.Grid.export()',\n            'File format: http://opendx.sdsc.edu/docs/html/pages/usrgu068.htm#HDREDF',\n            'Data are embedded in the header and tied to the grid positions.',\n            'Data is written in C array order: In grid[x,y,z] the axis z is fastest',\n            'varying, then y, then finally x, i.e. z is the innermost loop.'\n        ]\n\n        # write metadata in comments section\n        if arg_0.metadata:\n            arg_7.append('Meta data stored with the python Grid object:')\n        for arg_8 in arg_0.metadata:\n            arg_7.append('   ' + str(arg_8) + ' = ' + str(arg_0.metadata[arg_8]))\n        arg_7.append(\n            '(Note: the VMD dx-reader chokes on comments below this line)')\n\n        arg_9 = dict(\n            positions=OpenDX.gridpositions(1, arg_0.grid.shape, arg_0.origin,\n                                           arg_0.delta),\n            connections=OpenDX.gridconnections(2, arg_0.grid.shape),\n            data=OpenDX.array(3, arg_0.grid, arg_2=arg_2, arg_3=arg_3),\n        )\n        arg_10 = OpenDX.field('density', arg_9=arg_9, arg_7=arg_7)\n        arg_10.write(arg_1)", "path": "gridData/core.py", "identifier": "Grid._export_dx", "docstring": "Export the density grid to an OpenDX file.\n\n        The file format is the simplest regular grid array and it is\n        also understood by VMD's and Chimera's DX reader; PyMOL\n        requires the dx `type` to be set to \"double\".\n\n        For the file format see\n        http://opendx.sdsc.edu/docs/html/pages/usrgu068.htm#HDREDF", "docstring_tokens": ["Export", "the", "density", "grid", "to", "an", "OpenDX", "file", "."], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 259590}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L2776-L2783", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Sets byte if not greater.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "write", "(", "Operators", ".", "ITEBV", "(", "arg_1", ".", "size", ",", "Operators", ".", "OR", "(", "arg_0", ".", "ZF", ",", "arg_0", ".", "SF", "!=", "arg_0", ".", "OF", ")", ",", "1", ",", "0", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Sets byte if not greater.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        \"\"\"\n        arg_1.write(Operators.ITEBV(arg_1.size, Operators.OR(arg_0.ZF, arg_0.SF != arg_0.OF), 1, 0))", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.SETNG", "docstring": "Sets byte if not greater.\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Sets", "byte", "if", "not", "greater", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259591}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/stream.py#L204-L207", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Rollback to previous saved position.", "language": "python", "parameters": "(self)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "bool", ":", "arg_0", ".", "_cursor", ".", "position", "=", "arg_0", ".", "_contexts", ".", "pop", "(", ")", "return", "False"], "function": "def Func(arg_0) -> bool:\n        \"\"\"Rollback to previous saved position.\"\"\"\n        arg_0._cursor.position = arg_0._contexts.pop()\n        return False", "path": "pyrser/parsing/stream.py", "identifier": "Stream.restore_context", "docstring": "Rollback to previous saved position.", "docstring_tokens": ["Rollback", "to", "previous", "saved", "position", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 259592}
{"url": "https://github.com/memsql/memsql-python/blob/aac223a1b937d5b348b42af3c601a6c685ca633a/memsql/common/sql_step_queue/queue.py#L65-L87", "sha": "aac223a1b937d5b348b42af3c601a6c685ca633a", "docstring_summary": "Retrieve a task handler from the queue.", "language": "python", "parameters": "(self, block=False, timeout=None, retry_interval=0.5, extra_predicate=None)", "return_statement": "return task_handler", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0.5", ",", "arg_4", "=", "None", ")", ":", "Func", "=", "time", ".", "time", "(", ")", "while", "1", ":", "arg_6", "=", "arg_0", ".", "_dequeue_task", "(", "arg_4", ")", "if", "arg_6", "is", "None", "and", "arg_1", ":", "if", "arg_2", "is", "not", "None", "and", "(", "time", ".", "time", "(", ")", "-", "Func", ")", ">", "arg_2", ":", "break", "time", ".", "sleep", "(", "arg_3", "*", "(", "random", ".", "random", "(", ")", "+", "0.1", ")", ")", "else", ":", "break", "return", "arg_6"], "function": "def Func(arg_0, arg_1=False, arg_2=None, arg_3=0.5, arg_4=None):\n        \"\"\"\n        Retrieve a task handler from the queue.\n\n        If block is True, this function will block until it is able to retrieve a task.\n        If block is True and timeout is a number it will block for at most <timeout> seconds.\n        retry_interval is the maximum time in seconds between successive retries.\n\n        extra_predicate\n        If extra_predicate is defined, it should be a tuple of (raw_predicate, predicate_args)\n        raw_predicate will be prefixed by AND, and inserted into the WHERE condition in the queries.\n        predicate_args will be sql escaped and formatted into raw_predicate.\n        \"\"\"\n        Func = time.time()\n        while 1:\n            arg_6 = arg_0._dequeue_task(arg_4)\n            if arg_6 is None and arg_1:\n                if arg_2 is not None and (time.time() - Func) > arg_2:\n                    break\n                time.sleep(arg_3 * (random.random() + 0.1))\n            else:\n                break\n        return arg_6", "path": "memsql/common/sql_step_queue/queue.py", "identifier": "SQLStepQueue.start", "docstring": "Retrieve a task handler from the queue.\n\n        If block is True, this function will block until it is able to retrieve a task.\n        If block is True and timeout is a number it will block for at most <timeout> seconds.\n        retry_interval is the maximum time in seconds between successive retries.\n\n        extra_predicate\n        If extra_predicate is defined, it should be a tuple of (raw_predicate, predicate_args)\n        raw_predicate will be prefixed by AND, and inserted into the WHERE condition in the queries.\n        predicate_args will be sql escaped and formatted into raw_predicate.", "docstring_tokens": ["Retrieve", "a", "task", "handler", "from", "the", "queue", "."], "nwo": "memsql/memsql-python", "score": 0.6220444802454773, "idx": 259593}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L122-L204", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Search for domain or URL related to the original URL or domain.", "language": "python", "parameters": "(self)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"mining\"", "]", ":", "try", ":", "arg_1", "=", "PyFunceble", ".", "requests", ".", "get", "(", "arg_0", ".", "to_get", ",", "timeout", "=", "PyFunceble", ".", "CONFIGURATION", "[", "\"seconds_before_http_timeout\"", "]", ",", "headers", "=", "arg_0", ".", "headers", ",", ")", ".", "history", "arg_2", "=", "{", "arg_0", ".", "to_get_bare", ":", "[", "]", "}", "for", "arg_3", "in", "arg_1", ":", "arg_3", "=", "arg_3", ".", "url", "if", "PyFunceble", ".", "INTERN", "[", "\"to_test_type\"", "]", "==", "\"url\"", ":", "arg_4", "=", "Check", "(", ")", ".", "is_url_valid", "(", "arg_3", ",", "return_base", "=", "False", ")", "elif", "PyFunceble", ".", "INTERN", "[", "\"to_test_type\"", "]", "==", "\"domain\"", ":", "arg_4", "=", "Check", "(", ")", ".", "is_url_valid", "(", "arg_3", ",", "return_base", "=", "True", ")", "else", ":", "raise", "Exception", "(", "\"Unknown tested.\"", ")", "if", "arg_4", ":", "if", "arg_4", ".", "endswith", "(", "\":80\"", ")", ":", "arg_4", "=", "arg_4", "[", ":", "-", "3", "]", "if", "arg_4", "!=", "arg_0", ".", "to_get_bare", ":", "arg_2", "[", "arg_0", ".", "to_get_bare", "]", ".", "append", "(", "arg_4", ")", "if", "arg_2", "[", "arg_0", ".", "to_get_bare", "]", ":", "return", "arg_2", "return", "None", "except", "(", "PyFunceble", ".", "requests", ".", "ConnectionError", ",", "PyFunceble", ".", "requests", ".", "exceptions", ".", "Timeout", ",", "PyFunceble", ".", "requests", ".", "exceptions", ".", "InvalidURL", ",", "PyFunceble", ".", "socket", ".", "timeout", ",", "urllib3_exceptions", ".", "InvalidHeader", ",", "UnicodeDecodeError", ",", ")", ":", "return", "None", "return", "None"], "function": "def Func(arg_0):  # pragma: no cover\n        \"\"\"\n        Search for domain or URL related to the original URL or domain.\n\n        :return: The Funcd domains or URL.\n        :rtype: dict\n        \"\"\"\n\n        if PyFunceble.CONFIGURATION[\"mining\"]:\n            # The mining is activated.\n\n            try:\n                # We get the history.\n                arg_1 = PyFunceble.requests.get(\n                    arg_0.to_get,\n                    timeout=PyFunceble.CONFIGURATION[\"seconds_before_http_timeout\"],\n                    headers=arg_0.headers,\n                ).history\n\n                # We initiate a dictionnary which will save the\n                # list of Funcd links.\n                arg_2 = {arg_0.to_get_bare: []}\n\n                for arg_3 in arg_1:\n                    # We loop through the history.\n\n                    # We update the element.\n                    arg_3 = arg_3.url\n\n                    if PyFunceble.INTERN[\"to_test_type\"] == \"url\":\n                        # We are testing a full url.\n\n                        # We get the element to append.\n                        arg_4 = Check().is_url_valid(arg_3, return_base=False)\n                    elif PyFunceble.INTERN[\"to_test_type\"] == \"domain\":\n                        # We are testing a domain.\n\n                        # We get the element to append.\n                        arg_4 = Check().is_url_valid(arg_3, return_base=True)\n                    else:\n                        raise Exception(\"Unknown tested.\")\n\n                    if arg_4:\n                        # There is something to append.\n\n                        if arg_4.endswith(\":80\"):\n                            # The port is present.\n\n                            # We get rid of it.\n                            arg_4 = arg_4[:-3]\n\n                        if arg_4 != arg_0.to_get_bare:\n                            # The element to append is different as\n                            # the element we are globally testing.\n\n                            # We append the element to append to the\n                            # list of Funcd links.\n                            arg_2[arg_0.to_get_bare].append(arg_4)\n\n                if arg_2[arg_0.to_get_bare]:\n                    # There is something in the list of Funcd links.\n\n                    # We return the whole element.\n                    return arg_2\n\n                # There is nothing in the list of Funcd links.\n\n                # We return None.\n                return None\n\n            except (\n                PyFunceble.requests.ConnectionError,\n                PyFunceble.requests.exceptions.Timeout,\n                PyFunceble.requests.exceptions.InvalidURL,\n                PyFunceble.socket.timeout,\n                urllib3_exceptions.InvalidHeader,\n                UnicodeDecodeError,  # The probability that this happend in production is minimal.\n            ):\n                # Something went wrong.\n\n                # We return None.\n                return None\n        return None", "path": "PyFunceble/mining.py", "identifier": "Mining.mine", "docstring": "Search for domain or URL related to the original URL or domain.\n\n        :return: The mined domains or URL.\n        :rtype: dict", "docstring_tokens": ["Search", "for", "domain", "or", "URL", "related", "to", "the", "original", "URL", "or", "domain", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 259594}
{"url": "https://github.com/neithere/argh/blob/dcd3253f2994400a6a58a700c118c53765bc50a4/argh/decorators.py#L24-L43", "sha": "dcd3253f2994400a6a58a700c118c53765bc50a4", "docstring_summary": "Sets given string as command name instead of the function name.\n    The string is used verbatim without further processing.", "language": "python", "parameters": "(new_name)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "arg_1", ")", ":", "setattr", "(", "arg_1", ",", "ATTR_NAME", ",", "arg_0", ")", "return", "arg_1", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Sets given string as command name instead of the function name.\n    The string is used verbatim without further processing.\n\n    Usage::\n\n        @Func('load')\n        def do_load_some_stuff_and_keep_the_original_function_name(args):\n            ...\n\n    The resulting command will be available only as ``load``.  To add aliases\n    without renaming the command, check :func:`aliases`.\n\n    .. versionadded:: 0.19\n    \"\"\"\n    def wrapper(arg_1):\n        setattr(arg_1, ATTR_NAME, arg_0)\n        return arg_1\n    return wrapper", "path": "argh/decorators.py", "identifier": "named", "docstring": "Sets given string as command name instead of the function name.\n    The string is used verbatim without further processing.\n\n    Usage::\n\n        @named('load')\n        def do_load_some_stuff_and_keep_the_original_function_name(args):\n            ...\n\n    The resulting command will be available only as ``load``.  To add aliases\n    without renaming the command, check :func:`aliases`.\n\n    .. versionadded:: 0.19", "docstring_tokens": ["Sets", "given", "string", "as", "command", "name", "instead", "of", "the", "function", "name", ".", "The", "string", "is", "used", "verbatim", "without", "further", "processing", "."], "nwo": "neithere/argh", "score": 0.5784710843725794, "idx": 259595}
{"url": "https://github.com/Erotemic/xdoctest/blob/1c85209498bcf3791c919985b3d1904ec2339768/make_rtd.py#L42-L65", "sha": "1c85209498bcf3791c919985b3d1904ec2339768", "docstring_summary": "pip install redbaron", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "redbaron", "import", "ubelt", "as", "ub", "arg_0", "=", "'docs/conf.py'", "arg_1", "=", "ub", ".", "readfrom", "(", "arg_0", ")", "arg_2", "=", "redbaron", ".", "RedBaron", "(", "arg_1", ")", "arg_3", "=", "[", "'\"sphinxcontrib.napoleon\"'", "]", "arg_4", "=", "arg_2", ".", "find", "(", "'name'", ",", "arg_6", "=", "'extensions'", ")", ".", "parent", "arg_4", ".", "value", ".", "value", ".", "extend", "(", "arg_3", ")", "arg_5", "=", "arg_2", ".", "find", "(", "'name'", ",", "arg_6", "=", "'html_theme'", ")", ".", "parent", "arg_5", ".", "value", ".", "value", "=", "'\"sphinx_rtd_theme\"'", "ub", ".", "writeto", "(", "arg_0", ",", "arg_2", ".", "dumps", "(", ")", ")"], "function": "def Func():\n    \"\"\"\n    pip install redbaron\n    \"\"\"\n    import redbaron\n    import ubelt as ub\n    arg_0 = 'docs/conf.py'\n\n    arg_1 = ub.readfrom(arg_0)\n    arg_2 = redbaron.RedBaron(arg_1)\n\n    # Insert custom extensions\n    arg_3 = [\n        '\"sphinxcontrib.napoleon\"'\n    ]\n\n    arg_4 = arg_2.find('name', arg_6='extensions').parent\n    arg_4.value.value.extend(arg_3)\n\n    # Overwrite theme to read-the-docs\n    arg_5 = arg_2.find('name', arg_6='html_theme').parent\n    arg_5.value.value = '\"sphinx_rtd_theme\"'\n\n    ub.writeto(arg_0, arg_2.dumps())", "path": "make_rtd.py", "identifier": "modify_conf", "docstring": "pip install redbaron", "docstring_tokens": ["pip", "install", "redbaron"], "nwo": "Erotemic/xdoctest", "score": 0.38377323955834164, "idx": 259596}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/mapping/stochastic_swap.py#L535-L555", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Converts gate tuples into a nested list of integers.", "language": "python", "parameters": "(gates, qregs)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "qr", ".", "size", "for", "qr", "in", "arg_1", ".", "values", "(", ")", "]", "arg_3", "=", "np", ".", "cumsum", "(", "[", "0", "]", "+", "arg_2", ")", "arg_4", "=", "{", "}", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ".", "values", "(", ")", ")", ":", "arg_4", "[", "arg_6", "]", "=", "arg_5", "arg_7", "=", "np", ".", "zeros", "(", "2", "*", "len", "(", "arg_0", ")", ",", "dtype", "=", "np", ".", "int32", ")", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_0", ")", ":", "arg_7", "[", "2", "*", "arg_8", "]", "=", "arg_3", "[", "arg_4", "[", "arg_9", "[", "0", "]", "[", "0", "]", "]", "]", "+", "arg_9", "[", "0", "]", "[", "1", "]", "arg_7", "[", "2", "*", "arg_8", "+", "1", "]", "=", "arg_3", "[", "arg_4", "[", "arg_9", "[", "1", "]", "[", "0", "]", "]", "]", "+", "arg_9", "[", "1", "]", "[", "1", "]", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Converts gate tuples into a nested list of integers.\n\n    Args:\n        gates (list): List of (QuantumRegister, int) pairs\n                      representing gates.\n        qregs (dict): List of )QuantumRegister, int) tuples.\n\n    Returns:\n        list: Nested list of integers for gates.\n    \"\"\"\n    arg_2 = [qr.size for qr in arg_1.values()]\n    arg_3 = np.cumsum([0]+arg_2)\n    arg_4 = {}\n    for arg_5, arg_6 in enumerate(arg_1.values()):\n        arg_4[arg_6] = arg_5\n    arg_7 = np.zeros(2*len(arg_0), dtype=np.int32)\n    for arg_8, arg_9 in enumerate(arg_0):\n        arg_7[2*arg_8] = arg_3[arg_4[arg_9[0][0]]]+arg_9[0][1]\n        arg_7[2*arg_8+1] = arg_3[arg_4[arg_9[1][0]]]+arg_9[1][1]\n    return arg_7", "path": "qiskit/transpiler/passes/mapping/stochastic_swap.py", "identifier": "gates_to_idx", "docstring": "Converts gate tuples into a nested list of integers.\n\n    Args:\n        gates (list): List of (QuantumRegister, int) pairs\n                      representing gates.\n        qregs (dict): List of )QuantumRegister, int) tuples.\n\n    Returns:\n        list: Nested list of integers for gates.", "docstring_tokens": ["Converts", "gate", "tuples", "into", "a", "nested", "list", "of", "integers", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259597}
{"url": "https://github.com/osfclient/osfclient/blob/44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf/osfclient/utils.py#L55-L64", "sha": "44b9a87e8c1ae6b63cdecd27a924af3fc2bf94cf", "docstring_summary": "Determine if a file is empty or not.", "language": "python", "parameters": "(fp)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "six", ".", "PY2", ":", "arg_1", "=", "arg_0", ".", "read", "(", ")", "arg_0", ".", "seek", "(", "0", ")", "return", "not", "bool", "(", "arg_1", ")", "else", ":", "return", "not", "arg_0", ".", "peek", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Determine if a file is empty or not.\"\"\"\n    # for python 2 we need to use a homemade peek()\n    if six.PY2:\n        arg_1 = arg_0.read()\n        arg_0.seek(0)\n        return not bool(arg_1)\n\n    else:\n        return not arg_0.peek()", "path": "osfclient/utils.py", "identifier": "file_empty", "docstring": "Determine if a file is empty or not.", "docstring_tokens": ["Determine", "if", "a", "file", "is", "empty", "or", "not", "."], "nwo": "osfclient/osfclient", "score": 0.6916799964959273, "idx": 259598}
{"url": "https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L443-L515", "sha": "92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac", "docstring_summary": "canonical cluster statistics for a single run and a single probability", "language": "python", "parameters": "(\n    microcanonical_statistics,\n    convolution_factors,\n    **kwargs\n)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "(", "'has_spanning_cluster'", "in", "arg_0", ".", "dtype", ".", "names", ")", "arg_4", "=", "np", ".", "empty", "(", "1", ",", "dtype", "=", "canonical_statistics_dtype", "(", "arg_3", ")", ")", "if", "arg_3", ":", "arg_4", "[", "'percolation_probability'", "]", "=", "np", ".", "sum", "(", "arg_1", "*", "arg_0", "[", "'has_spanning_cluster'", "]", ")", "arg_4", "[", "'max_cluster_size'", "]", "=", "np", ".", "sum", "(", "arg_1", "*", "arg_0", "[", "'max_cluster_size'", "]", ")", "arg_4", "[", "'moments'", "]", "=", "np", ".", "sum", "(", "arg_1", "[", ":", ",", "np", ".", "newaxis", "]", "*", "arg_0", "[", "'moments'", "]", ",", "axis", "=", "0", ",", ")", "return", "arg_4"], "function": "def Func(\n    arg_0,\n    arg_1,\n    **arg_2\n):\n    \"\"\"\n    canonical cluster statistics for a single run and a single probability\n\n    Parameters\n    ----------\n\n    microcanonical_statistics : ndarray\n        Return value of `bond_microcanonical_statistics`\n\n    convolution_factors : 1-D array_like\n        The coefficients of the convolution for the given probabilty ``p``\n        and for each occupation number ``n``.\n\n    Returns\n    -------\n    ret : ndarray of size ``1``\n        Structured array with dtype as returned by\n        `canonical_statistics_dtype`\n\n    ret['percolation_probability'] : ndarray of float\n        The \"percolation probability\" of this run at the value of ``p``.\n        Only exists if `microcanonical_statistics` argument has the\n        ``has_spanning_cluster`` field.\n\n    ret['max_cluster_size'] : ndarray of int\n        Weighted size of the largest cluster (absolute number of sites)\n\n    ret['moments'] : 1-D :py:class:`numpy.ndarray` of float\n        Array of size ``5``.\n        The ``k``-th entry is the weighted ``k``-th raw moment of the\n        (absolute) cluster size distribution, with ``k`` ranging from ``0`` to\n        ``4``.\n\n    See Also\n    --------\n\n    bond_microcanonical_statistics\n    canonical_statistics_dtype\n\n    \"\"\"\n    # initialize return array\n    arg_3 = (\n        'has_spanning_cluster' in arg_0.dtype.names\n    )\n    arg_4 = np.empty(1, dtype=canonical_statistics_dtype(arg_3))\n\n    # compute percolation probability\n    if arg_3:\n        arg_4['percolation_probability'] = np.sum(\n            arg_1 *\n            arg_0['has_spanning_cluster']\n        )\n\n    # convolve maximum cluster size\n    arg_4['max_cluster_size'] = np.sum(\n        arg_1 *\n        arg_0['max_cluster_size']\n    )\n\n    # convolve moments\n    arg_4['moments'] = np.sum(\n        arg_1[:, np.newaxis] *\n        arg_0['moments'],\n        axis=0,\n    )\n\n    # return convolved cluster statistics\n    return arg_4", "path": "percolate/hpc.py", "identifier": "bond_canonical_statistics", "docstring": "canonical cluster statistics for a single run and a single probability\n\n    Parameters\n    ----------\n\n    microcanonical_statistics : ndarray\n        Return value of `bond_microcanonical_statistics`\n\n    convolution_factors : 1-D array_like\n        The coefficients of the convolution for the given probabilty ``p``\n        and for each occupation number ``n``.\n\n    Returns\n    -------\n    ret : ndarray of size ``1``\n        Structured array with dtype as returned by\n        `canonical_statistics_dtype`\n\n    ret['percolation_probability'] : ndarray of float\n        The \"percolation probability\" of this run at the value of ``p``.\n        Only exists if `microcanonical_statistics` argument has the\n        ``has_spanning_cluster`` field.\n\n    ret['max_cluster_size'] : ndarray of int\n        Weighted size of the largest cluster (absolute number of sites)\n\n    ret['moments'] : 1-D :py:class:`numpy.ndarray` of float\n        Array of size ``5``.\n        The ``k``-th entry is the weighted ``k``-th raw moment of the\n        (absolute) cluster size distribution, with ``k`` ranging from ``0`` to\n        ``4``.\n\n    See Also\n    --------\n\n    bond_microcanonical_statistics\n    canonical_statistics_dtype", "docstring_tokens": ["canonical", "cluster", "statistics", "for", "a", "single", "run", "and", "a", "single", "probability"], "nwo": "andsor/pypercolate", "score": 0.27946077266739355, "idx": 259599}
{"url": "https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L170-L182", "sha": "897934d593fade0eb1998f8fadd18c91a89e5b9a", "docstring_summary": "Returns the jQuery DataTables ThemeRoller CSS file according to version number.", "language": "python", "parameters": "(version=None)", "return_statement": "return format_html(\n        '<link rel=\"stylesheet\" href=\"href=\"{static}djfrontend/css/jquery/jquery.dataTables/{v}/jquery.dataTables_themeroller.min.css\">',\n        static=_static_url, v=version)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "if", "not", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_DATATABLES_THEMEROLLER'", ",", "False", ")", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_DATATABLES_VERSION'", ",", "DJFRONTEND_JQUERY_DATATABLES_VERSION_DEFAULT", ")", "else", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_DATATABLES_THEMEROLLER'", ",", "DJFRONTEND_JQUERY_DATATABLES_VERSION_DEFAULT", ")", "return", "format_html", "(", "'<link rel=\"stylesheet\" href=\"href=\"{static}djfrontend/css/jquery/jquery.dataTables/{v}/jquery.dataTables_themeroller.min.css\">'", ",", "static", "=", "_static_url", ",", "v", "=", "arg_0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Returns the jQuery DataTables ThemeRoller CSS file according to version number.\n    \"\"\"\n    if arg_0 is None:\n        if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_THEMEROLLER', False):\n            arg_0 = getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_VERSION', DJFRONTEND_JQUERY_DATATABLES_VERSION_DEFAULT)\n        else:\n            arg_0 = getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_THEMEROLLER', DJFRONTEND_JQUERY_DATATABLES_VERSION_DEFAULT)\n\n    return format_html(\n        '<link rel=\"stylesheet\" href=\"href=\"{static}djfrontend/css/jquery/jquery.dataTables/{v}/jquery.dataTables_themeroller.min.css\">',\n        static=_static_url, v=arg_0)", "path": "djfrontend/templatetags/djfrontend.py", "identifier": "djfrontend_jquery_datatables_themeroller", "docstring": "Returns the jQuery DataTables ThemeRoller CSS file according to version number.", "docstring_tokens": ["Returns", "the", "jQuery", "DataTables", "ThemeRoller", "CSS", "file", "according", "to", "version", "number", "."], "nwo": "jonfaustman/django-frontend", "score": 0.1952535678330188, "idx": 259600}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py#L11-L23", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Parse a string of HTML data into an Element tree using the\n    BeautifulSoup parser.", "language": "python", "parameters": "(data, beautifulsoup=None, makeelement=None, **bsargs)", "return_statement": "return _parse(data, beautifulsoup, makeelement, **bsargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "_parse", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, **arg_3):\n    \"\"\"Parse a string of HTML data into an Element tree using the\n    BeautifulSoup parser.\n\n    Returns the root ``<html>`` Element of the tree.\n\n    You can pass a different BeautifulSoup parser through the\n    `beautifulsoup` keyword, and a diffent Element factory function\n    through the `makeelement` keyword.  By default, the standard\n    ``BeautifulSoup`` class and the default factory of `lxml.html` are\n    used.\n    \"\"\"\n    return _parse(arg_0, arg_1, arg_2, **arg_3)", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py", "identifier": "fromstring", "docstring": "Parse a string of HTML data into an Element tree using the\n    BeautifulSoup parser.\n\n    Returns the root ``<html>`` Element of the tree.\n\n    You can pass a different BeautifulSoup parser through the\n    `beautifulsoup` keyword, and a diffent Element factory function\n    through the `makeelement` keyword.  By default, the standard\n    ``BeautifulSoup`` class and the default factory of `lxml.html` are\n    used.", "docstring_tokens": ["Parse", "a", "string", "of", "HTML", "data", "into", "an", "Element", "tree", "using", "the", "BeautifulSoup", "parser", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259601}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L701-L732", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Apply unique checks on `r`.", "language": "python", "parameters": "(self, i, r, unique_sets,\n                             summarize=False,\n                             context=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "for", "arg_6", ",", "arg_7", ",", "arg_8", "in", "arg_0", ".", "_unique_checks", ":", "arg_9", "=", "None", "arg_10", "=", "arg_3", "[", "arg_6", "]", "if", "isinstance", "(", "arg_6", ",", "basestring", ")", ":", "arg_11", "=", "arg_0", ".", "_field_names", ".", "index", "(", "arg_6", ")", "if", "arg_11", ">=", "len", "(", "arg_2", ")", ":", "continue", "arg_9", "=", "arg_2", "[", "arg_11", "]", "else", ":", "arg_9", "=", "[", "]", "for", "arg_12", "in", "arg_6", ":", "arg_11", "=", "arg_0", ".", "_field_names", ".", "index", "(", "arg_12", ")", "if", "arg_11", ">=", "len", "(", "arg_2", ")", ":", "break", "arg_9", ".", "append", "(", "arg_2", "[", "arg_11", "]", ")", "arg_9", "=", "tuple", "(", "arg_9", ")", "if", "arg_9", "in", "arg_10", ":", "arg_13", "=", "{", "'code'", ":", "arg_7", "}", "if", "not", "arg_4", ":", "arg_13", "[", "'message'", "]", "=", "arg_8", "arg_13", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_13", "[", "'record'", "]", "=", "arg_2", "arg_13", "[", "'key'", "]", "=", "arg_6", "arg_13", "[", "'value'", "]", "=", "arg_9", "if", "arg_5", "is", "not", "None", ":", "arg_13", "[", "'context'", "]", "=", "arg_5", "yield", "arg_13", "arg_10", ".", "add", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                             arg_4=False,\n                             arg_5=None):\n        \"\"\"Apply unique checks on `r`.\"\"\"\n\n        for arg_6, arg_7, arg_8 in arg_0._unique_checks:\n            arg_9 = None\n            arg_10 = arg_3[arg_6]\n            if isinstance(arg_6, basestring): # assume key is a field name\n                arg_11 = arg_0._field_names.index(arg_6)\n                if arg_11 >= len(arg_2):\n                    continue\n                arg_9 = arg_2[arg_11]\n            else: # assume key is a list or tuple, i.e., compound key\n                arg_9 = []\n                for arg_12 in arg_6:\n                    arg_11 = arg_0._field_names.index(arg_12)\n                    if arg_11 >= len(arg_2):\n                        break\n                    arg_9.append(arg_2[arg_11])\n                arg_9 = tuple(arg_9) # enable hashing\n            if arg_9 in arg_10:\n                arg_13 = {'code': arg_7}\n                if not arg_4:\n                    arg_13['message'] = arg_8\n                    arg_13['row'] = arg_1 + 1\n                    arg_13['record'] = arg_2\n                    arg_13['key'] = arg_6\n                    arg_13['value'] = arg_9\n                    if arg_5 is not None: arg_13['context'] = arg_5\n                yield arg_13\n            arg_10.add(arg_9)", "path": "csvvalidator.py", "identifier": "CSVValidator._apply_unique_checks", "docstring": "Apply unique checks on `r`.", "docstring_tokens": ["Apply", "unique", "checks", "on", "r", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 259602}
{"url": "https://github.com/Numergy/yoda/blob/109f0e9441130488b0155f05883ef6531cf46ee9/yoda/logger.py#L73-L80", "sha": "109f0e9441130488b0155f05883ef6531cf46ee9", "docstring_summary": "Set Console handler.", "language": "python", "parameters": "(self, debug=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "logging", ".", "StreamHandler", "(", ")", "arg_2", ".", "setFormatter", "(", "Formatter", "(", "LFORMAT", ")", ")", "if", "not", "arg_1", ":", "arg_2", ".", "setLevel", "(", "logging", ".", "INFO", ")", "arg_0", ".", "addHandler", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Set Console handler.\"\"\"\n        arg_2 = logging.StreamHandler()\n        arg_2.setFormatter(Formatter(LFORMAT))\n        if not arg_1:\n            arg_2.setLevel(logging.INFO)\n\n        arg_0.addHandler(arg_2)", "path": "yoda/logger.py", "identifier": "Logger.set_console_handler", "docstring": "Set Console handler.", "docstring_tokens": ["Set", "Console", "handler", "."], "nwo": "Numergy/yoda", "score": 0.1832591465193378, "idx": 259603}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/analytics.py#L53-L61", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Returns assignment data for the given course_id.", "language": "python", "parameters": "(self, sis_course_id)", "return_statement": "return self._get_resource(url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"/api/v1/courses/%s/analytics/assignments.json\"", "%", "(", "arg_0", ".", "_sis_id", "(", "arg_1", ",", "sis_field", "=", "\"course\"", ")", ")", "return", "arg_0", ".", "_get_resource", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns assignment data for the given course_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.course_assignments\n        \"\"\"\n        arg_2 = \"/api/v1/courses/%s/analytics/assignments.json\" % (\n            arg_0._sis_id(arg_1, sis_field=\"course\"))\n        return arg_0._get_resource(arg_2)", "path": "uw_canvas/analytics.py", "identifier": "Analytics.get_assignments_by_sis_course_id", "docstring": "Returns assignment data for the given course_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.course_assignments", "docstring_tokens": ["Returns", "assignment", "data", "for", "the", "given", "course_id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 259604}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/page.py#L315-L339", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Print a string snipping the midsection to fit in width.", "language": "python", "parameters": "(str,width = 75,print_full = 0,header = '')", "return_statement": "return snip", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "75", ",", "arg_2", "=", "0", ",", "arg_3", "=", "''", ")", ":", "if", "arg_2", "==", "1", ":", "page", "(", "arg_3", "+", "arg_0", ")", "return", "0", "print", "arg_3", ",", "if", "len", "(", "arg_0", ")", "<", "arg_1", ":", "print", "arg_0", "arg_4", "=", "0", "else", ":", "arg_5", "=", "int", "(", "(", "arg_1", "-", "5", ")", "/", "2", ")", "print", "arg_0", "[", ":", "arg_5", "]", "+", "' <...> '", "+", "arg_0", "[", "-", "arg_5", ":", "]", "arg_4", "=", "1", "if", "arg_4", "and", "arg_2", "==", "2", ":", "if", "raw_input", "(", "arg_3", "+", "' Snipped. View (y/n)? [N]'", ")", ".", "lower", "(", ")", "==", "'y'", ":", "page", "(", "arg_0", ")", "return", "arg_4"], "function": "def Func(arg_0,arg_1 = 75,arg_2 = 0,arg_3 = ''):\n    \"\"\"Print a string snipping the midsection to fit in width.\n\n    print_full: mode control:\n      - 0: only snip long strings\n      - 1: send to page() directly.\n      - 2: snip long strings and ask for full length viewing with page()\n    Return 1 if snipping was necessary, 0 otherwise.\"\"\"\n\n    if arg_2 == 1:\n        page(arg_3+arg_0)\n        return 0\n\n    print arg_3,\n    if len(arg_0) < arg_1:\n        print arg_0\n        arg_4 = 0\n    else:\n        arg_5 = int((arg_1 -5)/2)\n        print arg_0[:arg_5] + ' <...> ' + arg_0[-arg_5:]\n        arg_4 = 1\n    if arg_4 and arg_2 == 2:\n        if raw_input(arg_3+' Snipped. View (y/n)? [N]').lower() == 'y':\n            page(arg_0)\n    return arg_4", "path": "environment/lib/python2.7/site-packages/IPython/core/page.py", "identifier": "snip_print", "docstring": "Print a string snipping the midsection to fit in width.\n\n    print_full: mode control:\n      - 0: only snip long strings\n      - 1: send to page() directly.\n      - 2: snip long strings and ask for full length viewing with page()\n    Return 1 if snipping was necessary, 0 otherwise.", "docstring_tokens": ["Print", "a", "string", "snipping", "the", "midsection", "to", "fit", "in", "width", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259605}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L104-L107", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "Set the timeout for the communication with the device.", "language": "python", "parameters": "(self, timeout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "int", "(", "arg_1", ")", "arg_0", ".", "_timeout", "=", "arg_1", "==", "0", "and", "999999", "or", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set the timeout for the communication with the device.\"\"\"\n        arg_1 = int(arg_1) # will raise on Error\n        arg_0._timeout = arg_1 == 0 and 999999 or arg_1", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.set_timeout", "docstring": "Set the timeout for the communication with the device.", "docstring_tokens": ["Set", "the", "timeout", "for", "the", "communication", "with", "the", "device", "."], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 259606}
{"url": "https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L422-L458", "sha": "0334545885445834307c075a445fba9fe6f0c9e7", "docstring_summary": "Display a list of files and prompt for ones to be kept.", "language": "python", "parameters": "(dupeList, mainPos=1, mainLen=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "1", ")", ":", "arg_0", "=", "sorted", "(", "arg_0", ")", "print", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", ":", "print", "\"%d) %s\"", "%", "(", "arg_3", "+", "1", ",", "arg_4", ")", "while", "True", ":", "arg_5", "=", "raw_input", "(", "\"[%s/%s] Keepers: \"", "%", "(", "arg_1", ",", "arg_2", ")", ")", ".", "strip", "(", ")", "if", "not", "arg_5", ":", "print", "(", "\"Please enter a space/comma-separated list of numbers or \"", "\"'all'.\"", ")", "continue", "elif", "arg_5", ".", "lower", "(", ")", "==", "'all'", ":", "return", "[", "]", "try", ":", "arg_6", "=", "[", "int", "(", "x", ")", "-", "1", "for", "x", "in", "arg_5", ".", "replace", "(", "','", ",", "' '", ")", ".", "split", "(", ")", "]", "return", "[", "arg_4", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ")", "if", "arg_3", "not", "in", "arg_6", "]", "except", "ValueError", ":", "print", "(", "\"Invalid choice. Please enter a space/comma-separated list\"", "\"of numbers or 'all'.\"", ")"], "function": "def Func(arg_0, arg_1=1, arg_2=1):\n    \"\"\"Display a list of files and prompt for ones to be kept.\n\n    The user may enter ``all`` or one or more numbers separated by spaces\n    and/or commas.\n\n    .. note:: It is impossible to accidentally choose to keep none of the\n        displayed files.\n\n    :param dupeList: A list duplicate file paths\n    :param mainPos: Used to display \"set X of Y\"\n    :param mainLen: Used to display \"set X of Y\"\n    :type dupeList: :class:`~__builtins__.list`\n    :type mainPos: :class:`~__builtins__.int`\n    :type mainLen: :class:`~__builtins__.int`\n\n    :returns: A list of files to be deleted.\n    :rtype: :class:`~__builtins__.int`\n    \"\"\"\n    arg_0 = sorted(arg_0)\n    print\n    for arg_3, arg_4 in enumerate(arg_0):\n        print \"%d) %s\" % (arg_3 + 1, arg_4)\n    while True:\n        arg_5 = raw_input(\"[%s/%s] Keepers: \" % (arg_1, arg_2)).strip()\n        if not arg_5:\n            print (\"Please enter a space/comma-separated list of numbers or \"\n                   \"'all'.\")\n            continue\n        elif arg_5.lower() == 'all':\n            return []\n        try:\n            arg_6 = [int(x) - 1 for x in arg_5.replace(',', ' ').split()]\n            return [arg_4 for arg_3, arg_4 in enumerate(arg_0) if arg_3 not in arg_6]\n        except ValueError:\n            print(\"Invalid choice. Please enter a space/comma-separated list\"\n                  \"of numbers or 'all'.\")", "path": "fastdupes.py", "identifier": "pruneUI", "docstring": "Display a list of files and prompt for ones to be kept.\n\n    The user may enter ``all`` or one or more numbers separated by spaces\n    and/or commas.\n\n    .. note:: It is impossible to accidentally choose to keep none of the\n        displayed files.\n\n    :param dupeList: A list duplicate file paths\n    :param mainPos: Used to display \"set X of Y\"\n    :param mainLen: Used to display \"set X of Y\"\n    :type dupeList: :class:`~__builtins__.list`\n    :type mainPos: :class:`~__builtins__.int`\n    :type mainLen: :class:`~__builtins__.int`\n\n    :returns: A list of files to be deleted.\n    :rtype: :class:`~__builtins__.int`", "docstring_tokens": ["Display", "a", "list", "of", "files", "and", "prompt", "for", "ones", "to", "be", "kept", "."], "nwo": "ssokolow/fastdupes", "score": 0.4039778193346996, "idx": 259607}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L227-L234", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get a list", "language": "python", "parameters": "(self, id, name=None)", "return_statement": "return self.create_list(dict(id=id, name=name))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "create_list", "(", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Get a list\n\n        Returns:\n            List: The list with the given `id`\n        '''\n        return arg_0.create_list(dict(arg_1=arg_1, arg_2=arg_2))", "path": "trolly/client.py", "identifier": "Client.get_list", "docstring": "Get a list\n\n        Returns:\n            List: The list with the given `id`", "docstring_tokens": ["Get", "a", "list"], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 259608}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/gui/gtk_window.py#L135-L141", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Show the variables window.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "var_window", "is", "None", "and", "arg_0", ".", "bot", ".", "_vars", ":", "arg_0", ".", "var_window", "=", "VarWindow", "(", "arg_0", ",", "arg_0", ".", "bot", ",", "'%s variables'", "%", "(", "arg_0", ".", "title", "or", "'Shoebot'", ")", ")", "arg_0", ".", "var_window", ".", "window", ".", "connect", "(", "\"destroy\"", ",", "arg_0", ".", "var_window_closed", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Show the variables window.\n        \"\"\"\n        if arg_0.var_window is None and arg_0.bot._vars:\n            arg_0.var_window = VarWindow(arg_0, arg_0.bot, '%s variables' % (arg_0.title or 'Shoebot'))\n            arg_0.var_window.window.connect(\"destroy\", arg_0.var_window_closed)", "path": "shoebot/gui/gtk_window.py", "identifier": "ShoebotWindow.show_variables_window", "docstring": "Show the variables window.", "docstring_tokens": ["Show", "the", "variables", "window", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259609}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/upload.py#L134-L142", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Add POST data.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_data", ":", "arg_0", ".", "_data", "=", "{", "}", "arg_0", ".", "_data", ".", "update", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Add POST data.\n\n        Args:\n            data (dict): key => value dictionary\n        \"\"\"\n        if not arg_0._data:\n            arg_0._data = {}\n        arg_0._data.update(arg_1)", "path": "pyfire/upload.py", "identifier": "UploadProcess.add_data", "docstring": "Add POST data.\n\n        Args:\n            data (dict): key => value dictionary", "docstring_tokens": ["Add", "POST", "data", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 259610}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/user.py#L24-L41", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Activate a user.", "language": "python", "parameters": "(username)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "PolyaxonClient", "(", ")", ".", "user", ".", "Func_user", "(", "arg_0", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func user `{}`.'", ".", "format", "(", "arg_0", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Printer", ".", "print_success", "(", "\"User `{}` was Funcd successfully.\"", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Activate a user.\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon user Func david\n    ```\n    \"\"\"\n    try:\n        PolyaxonClient().user.Func_user(arg_0)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func user `{}`.'.format(arg_0))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Printer.print_success(\"User `{}` was Funcd successfully.\".format(arg_0))", "path": "polyaxon_cli/cli/user.py", "identifier": "activate", "docstring": "Activate a user.\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon user activate david\n    ```", "docstring_tokens": ["Activate", "a", "user", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 259611}
{"url": "https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/messages/messages.py#L120-L149", "sha": "e09034936d6f13b3909a9464ee329c81c1834941", "docstring_summary": "Search for messages", "language": "python", "parameters": "(session, thread_id, query, limit=20,\n                    offset=0, message_context_details=None,\n                    window_above=None, window_below=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "20", ",", "arg_4", "=", "0", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ")", ":", "arg_2", "=", "{", "'thread_id'", ":", "arg_1", ",", "'query'", ":", "arg_2", ",", "'limit'", ":", "arg_3", ",", "'offset'", ":", "arg_4", "}", "if", "arg_5", ":", "arg_2", "[", "'message_context_details'", "]", "=", "arg_5", "if", "arg_6", ":", "arg_2", "[", "'window_above'", "]", "=", "arg_6", "if", "arg_7", ":", "arg_2", "[", "'window_below'", "]", "=", "arg_7", "arg_8", "=", "make_get_request", "(", "arg_0", ",", "'messages/search'", ",", "params_data", "=", "arg_2", ")", "arg_9", "=", "arg_8", ".", "json", "(", ")", "if", "arg_8", ".", "status_code", "==", "200", ":", "return", "arg_9", "[", "'result'", "]", "else", ":", "raise", "MessagesNotFoundException", "(", "message", "=", "arg_9", "[", "'message'", "]", ",", "error_code", "=", "arg_9", "[", "'error_code'", "]", ",", "request_id", "=", "arg_9", "[", "'request_id'", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=20,\n                    arg_4=0, arg_5=None,\n                    arg_6=None, arg_7=None):\n    \"\"\"\n    Search for messages\n    \"\"\"\n    arg_2 = {\n        'thread_id': arg_1,\n        'query': arg_2,\n        'limit': arg_3,\n        'offset': arg_4\n    }\n    if arg_5:\n        arg_2['message_context_details'] = arg_5\n    if arg_6:\n        arg_2['window_above'] = arg_6\n    if arg_7:\n        arg_2['window_below'] = arg_7\n\n    # GET /api/messages/0.1/messages/search\n    arg_8 = make_get_request(arg_0, 'messages/search', params_data=arg_2)\n    arg_9 = arg_8.json()\n    if arg_8.status_code == 200:\n        return arg_9['result']\n    else:\n        raise MessagesNotFoundException(\n            message=arg_9['message'],\n            error_code=arg_9['error_code'],\n            request_id=arg_9['request_id']\n        )", "path": "freelancersdk/resources/messages/messages.py", "identifier": "search_messages", "docstring": "Search for messages", "docstring_tokens": ["Search", "for", "messages"], "nwo": "freelancer/freelancer-sdk-python", "score": 0.38622233229652403, "idx": 259612}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L120-L140", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Convert the name argument to a list of names.", "language": "python", "parameters": "(name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "[", "arg_0", "]", "elif", "arg_0", "is", "None", ":", "return", "[", "'anytrait'", "]", "elif", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "arg_1", "in", "arg_0", ":", "assert", "isinstance", "(", "arg_1", ",", "str", ")", ",", "\"names must be strings\"", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Convert the name argument to a list of names.\n\n    Examples\n    --------\n\n    >>> Func('a')\n    ['a']\n    >>> Func(['a','b'])\n    ['a', 'b']\n    >>> Func(None)\n    ['anytrait']\n    \"\"\"\n    if isinstance(arg_0, str):\n        return [arg_0]\n    elif arg_0 is None:\n        return ['anytrait']\n    elif isinstance(arg_0, (list, tuple)):\n        for arg_1 in arg_0:\n            assert isinstance(arg_1, str), \"names must be strings\"\n        return arg_0", "path": "environment/lib/python2.7/site-packages/IPython/utils/traitlets.py", "identifier": "parse_notifier_name", "docstring": "Convert the name argument to a list of names.\n\n    Examples\n    --------\n\n    >>> parse_notifier_name('a')\n    ['a']\n    >>> parse_notifier_name(['a','b'])\n    ['a', 'b']\n    >>> parse_notifier_name(None)\n    ['anytrait']", "docstring_tokens": ["Convert", "the", "name", "argument", "to", "a", "list", "of", "names", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259613}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py#L1529-L1556", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Converts xml response to service bus namespace availability", "language": "python", "parameters": "(xmlstr)", "return_statement": "return availability", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "minidom", ".", "parseString", "(", "arg_0", ")", "arg_2", "=", "AvailabilityResponse", "(", ")", "for", "arg_3", "in", "_MinidomXmlToObject", ".", "get_children_from_path", "(", "arg_1", ",", "'entry'", ",", "'content'", ",", "'NamespaceAvailability'", ")", ":", "arg_4", "=", "_MinidomXmlToObject", ".", "get_first_child_node_value", "(", "arg_3", ",", "'Result'", ")", "if", "arg_4", "is", "not", "None", ":", "arg_2", ".", "result", "=", "_parse_bool", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        '''Converts xml response to service bus namespace availability\n\n        The xml format:\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<entry xmlns=\"http://www.w3.org/2005/Atom\">\n    <id>uuid:9fc7c652-1856-47ab-8d74-cd31502ea8e6;id=3683292</id>\n    <title type=\"text\"></title>\n    <updated>2013-04-16T03:03:37Z</updated>\n    <content type=\"application/xml\">\n        <NamespaceAvailability\n            xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\"\n            xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n            <Result>false</Result>\n        </NamespaceAvailability>\n    </content>\n</entry>\n        '''\n        arg_1 = minidom.parseString(arg_0)\n        arg_2 = AvailabilityResponse()\n\n        for arg_3 in _MinidomXmlToObject.get_children_from_path(arg_1, 'entry', 'content',\n                                            'NamespaceAvailability'):\n            arg_4 = _MinidomXmlToObject.get_first_child_node_value(arg_3, 'Result')\n            if arg_4 is not None:\n                arg_2.result = _parse_bool(arg_4)\n\n        return arg_2", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py", "identifier": "_ServiceBusManagementXmlSerializer.xml_to_namespace_availability", "docstring": "Converts xml response to service bus namespace availability\n\n        The xml format:\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<entry xmlns=\"http://www.w3.org/2005/Atom\">\n    <id>uuid:9fc7c652-1856-47ab-8d74-cd31502ea8e6;id=3683292</id>\n    <title type=\"text\"></title>\n    <updated>2013-04-16T03:03:37Z</updated>\n    <content type=\"application/xml\">\n        <NamespaceAvailability\n            xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\"\n            xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n            <Result>false</Result>\n        </NamespaceAvailability>\n    </content>\n</entry>", "docstring_tokens": ["Converts", "xml", "response", "to", "service", "bus", "namespace", "availability"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259614}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L611-L616", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Set the active client.", "language": "python", "parameters": "(self, set_active_client_request)", "return_statement": "return response", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "hangouts_pb2", ".", "SetActiveClientResponse", "(", ")", "await", "arg_0", ".", "_pb_request", "(", "'clients/setactiveclient'", ",", "arg_1", ",", "arg_2", ")", "return", "arg_2"], "function": "async def Func(arg_0, arg_1):\n        \"\"\"Set the active client.\"\"\"\n        arg_2 = hangouts_pb2.SetActiveClientResponse()\n        await arg_0._pb_request('clients/setactiveclient',\n                               arg_1, arg_2)\n        return arg_2", "path": "hangups/client.py", "identifier": "Client.set_active_client", "docstring": "Set the active client.", "docstring_tokens": ["Set", "the", "active", "client", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 259615}
{"url": "https://github.com/rupertford/melody/blob/d50459880a87fdd1802c6893f6e12b52d51b3b91/src/melody/inputs.py#L143-L152", "sha": "d50459880a87fdd1802c6893f6e12b52d51b3b91", "docstring_summary": "We work out all combinations using this internal recursion method", "language": "python", "parameters": "(self, inputs, output, depth, max_depth)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_3", "<", "arg_4", ":", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ")", ":", "arg_7", "=", "list", "(", "arg_2", ")", "arg_7", ".", "append", "(", "arg_6", ")", "arg_0", ".", "Func", "(", "arg_1", "[", "arg_5", "+", "1", ":", "]", ",", "arg_7", ",", "arg_3", "+", "1", ",", "arg_4", ")", "else", ":", "arg_0", ".", "_options", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        '''We work out all combinations using this internal recursion method'''\n        if arg_3 < arg_4:\n            for arg_5, arg_6 in enumerate(arg_1):\n                arg_7 = list(arg_2)\n                arg_7.append(arg_6)\n                arg_0.Func(arg_1[arg_5 + 1:], arg_7, arg_3 + 1,\n                              arg_4)\n        else:\n            arg_0._options.append(arg_2)", "path": "src/melody/inputs.py", "identifier": "Subsets._recurse", "docstring": "We work out all combinations using this internal recursion method", "docstring_tokens": ["We", "work", "out", "all", "combinations", "using", "this", "internal", "recursion", "method"], "nwo": "rupertford/melody", "score": 0.16246995141409282, "idx": 259616}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/events/progressbar.py#L83-L101", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Estimate the remaining time left.", "language": "python", "parameters": "(self, completed_iter)", "return_statement": "return time_string", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ":", "arg_2", "=", "(", "time", ".", "time", "(", ")", "-", "arg_0", ".", "t_start", ")", "/", "arg_1", "*", "(", "arg_0", ".", "iter", "-", "arg_1", ")", "else", ":", "arg_2", "=", "0", "arg_3", "=", "datetime", ".", "datetime", "(", "1", ",", "1", ",", "1", ")", "+", "datetime", ".", "timedelta", "(", "seconds", "=", "arg_2", ")", "arg_4", "=", "\"%02d:%02d:%02d:%02d\"", "%", "(", "arg_3", ".", "day", "-", "1", ",", "arg_3", ".", "hour", ",", "arg_3", ".", "minute", ",", "arg_3", ".", "second", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Estimate the remaining time left.\n\n        Parameters:\n            completed_iter (int): Number of iterations completed.\n\n        Returns:\n            est_time: Estimated time remaining.\n        \"\"\"\n        if arg_1:\n            arg_2 = (time.time() - arg_0.t_start) / \\\n                arg_1*(arg_0.iter-arg_1)\n        else:\n            arg_2 = 0\n        arg_3 = datetime.datetime(1, 1, 1) + datetime.timedelta(seconds=arg_2)\n        arg_4 = \"%02d:%02d:%02d:%02d\" % \\\n            (arg_3.day - 1, arg_3.hour, arg_3.minute, arg_3.second)\n\n        return arg_4", "path": "qiskit/tools/events/progressbar.py", "identifier": "BaseProgressBar.time_remaining_est", "docstring": "Estimate the remaining time left.\n\n        Parameters:\n            completed_iter (int): Number of iterations completed.\n\n        Returns:\n            est_time: Estimated time remaining.", "docstring_tokens": ["Estimate", "the", "remaining", "time", "left", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259617}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/transform.py#L72-L82", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "An alternative translate implementation that uses a geometric function.\n    This is more accurate than the built-in version.", "language": "python", "parameters": "(script, value=(0.0, 0.0, 0.0))", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", "0.0", ",", "0.0", ",", "0.0", ")", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", "=", "list", "(", "arg_1", ")", "vert_function", "(", "arg_0", ",", "x_func", "=", "'x+(%s)'", "%", "arg_1", "[", "0", "]", ",", "y_func", "=", "'y+(%s)'", "%", "arg_1", "[", "1", "]", ",", "z_func", "=", "'z+(%s)'", "%", "arg_1", "[", "2", "]", ")", "return", "None"], "function": "def Func(arg_0, arg_1=(0.0, 0.0, 0.0)):\n    \"\"\"An alternative Func implementation that uses a geometric function.\n    This is more accurate than the built-in version.\"\"\"\n    # Convert value to list if it isn't already\n    if not isinstance(arg_1, list):\n        arg_1 = list(arg_1)\n    vert_function(arg_0,\n             x_func='x+(%s)' % arg_1[0],\n             y_func='y+(%s)' % arg_1[1],\n             z_func='z+(%s)' % arg_1[2])\n    return None", "path": "meshlabxml/transform.py", "identifier": "translate", "docstring": "An alternative translate implementation that uses a geometric function.\n    This is more accurate than the built-in version.", "docstring_tokens": ["An", "alternative", "translate", "implementation", "that", "uses", "a", "geometric", "function", ".", "This", "is", "more", "accurate", "than", "the", "built", "-", "in", "version", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 259618}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/util_functions.py#L387-L407", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Generates a confusion matrix between rater_a and rater_b\n    A confusion matrix shows how often 2 values agree and disagree\n    See quadratic_weighted_kappa for argument descriptions", "language": "python", "parameters": "(rater_a, rater_b, min_rating=None, max_rating=None)", "return_statement": "return conf_mat", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "assert", "(", "len", "(", "arg_0", ")", "==", "len", "(", "arg_1", ")", ")", "arg_0", "=", "[", "int", "(", "arg_6", ")", "for", "arg_6", "in", "arg_0", "]", "arg_1", "=", "[", "int", "(", "arg_7", ")", "for", "arg_7", "in", "arg_1", "]", "arg_2", "=", "int", "(", "arg_2", ")", "arg_3", "=", "int", "(", "arg_3", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "min", "(", "arg_0", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "max", "(", "arg_0", ")", "arg_4", "=", "int", "(", "arg_3", "-", "arg_2", "+", "1", ")", "arg_5", "=", "[", "[", "0", "for", "i", "in", "range", "(", "arg_4", ")", "]", "for", "j", "in", "range", "(", "arg_4", ")", "]", "for", "arg_6", ",", "arg_7", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ":", "arg_5", "[", "int", "(", "arg_6", "-", "arg_2", ")", "]", "[", "int", "(", "arg_7", "-", "arg_2", ")", "]", "+=", "1", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    Generates a confusion matrix between rater_a and rater_b\n    A confusion matrix shows how often 2 values agree and disagree\n    See quadratic_weighted_kappa for argument descriptions\n    \"\"\"\n    assert(len(arg_0) == len(arg_1))\n    arg_0 = [int(arg_6) for arg_6 in arg_0]\n    arg_1 = [int(arg_7) for arg_7 in arg_1]\n    arg_2 = int(arg_2)\n    arg_3 = int(arg_3)\n    if arg_2 is None:\n        arg_2 = min(arg_0)\n    if arg_3 is None:\n        arg_3 = max(arg_0)\n    arg_4 = int(arg_3 - arg_2 + 1)\n    arg_5 = [[0 for i in range(arg_4)]\n                for j in range(arg_4)]\n    for arg_6, arg_7 in zip(arg_0, arg_1):\n        arg_5[int(arg_6 - arg_2)][int(arg_7 - arg_2)] += 1\n    return arg_5", "path": "ease/util_functions.py", "identifier": "confusion_matrix", "docstring": "Generates a confusion matrix between rater_a and rater_b\n    A confusion matrix shows how often 2 values agree and disagree\n    See quadratic_weighted_kappa for argument descriptions", "docstring_tokens": ["Generates", "a", "confusion", "matrix", "between", "rater_a", "and", "rater_b", "A", "confusion", "matrix", "shows", "how", "often", "2", "values", "agree", "and", "disagree", "See", "quadratic_weighted_kappa", "for", "argument", "descriptions"], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 259619}
{"url": "https://github.com/memsql/memsql-python/blob/aac223a1b937d5b348b42af3c601a6c685ca633a/memsql/common/sql_utility.py#L27-L32", "sha": "aac223a1b937d5b348b42af3c601a6c685ca633a", "docstring_summary": "Initialize the required tables in the database", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "_db_conn", "(", ")", "as", "conn", ":", "for", "arg_1", "in", "arg_0", ".", "_tables", ".", "values", "(", ")", ":", "conn", ".", "execute", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\" Initialize the required tables in the database \"\"\"\n        with arg_0._db_conn() as conn:\n            for arg_1 in arg_0._tables.values():\n                conn.execute(arg_1)\n        return arg_0", "path": "memsql/common/sql_utility.py", "identifier": "SQLUtility.setup", "docstring": "Initialize the required tables in the database", "docstring_tokens": ["Initialize", "the", "required", "tables", "in", "the", "database"], "nwo": "memsql/memsql-python", "score": 0.6220444802454773, "idx": 259620}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L907-L924", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Raises OrderError if no package or file defined.\n        Raises CardinalityError if already set.\n        Raises SPDXValueError if malformed.", "language": "python", "parameters": "(self, doc, lic)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "has_package", "(", "arg_1", ")", "and", "arg_0", ".", "has_file", "(", "arg_1", ")", ":", "if", "not", "arg_0", ".", "file_conc_lics_set", ":", "arg_0", ".", "file_conc_lics_set", "=", "True", "if", "validations", ".", "validate_lics_conc", "(", "arg_2", ")", ":", "arg_0", ".", "file", "(", "arg_1", ")", ".", "conc_lics", "=", "arg_2", "return", "True", "else", ":", "raise", "SPDXValueError", "(", "'File::ConcludedLicense'", ")", "else", ":", "raise", "CardinalityError", "(", "'File::ConcludedLicense'", ")", "else", ":", "raise", "OrderError", "(", "'File::ConcludedLicense'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Raises OrderError if no package or file defined.\n        Raises CardinalityError if already set.\n        Raises SPDXValueError if malformed.\n        \"\"\"\n        if arg_0.has_package(arg_1) and arg_0.has_file(arg_1):\n            if not arg_0.file_conc_lics_set:\n                arg_0.file_conc_lics_set = True\n                if validations.validate_lics_conc(arg_2):\n                    arg_0.file(arg_1).conc_lics = arg_2\n                    return True\n                else:\n                    raise SPDXValueError('File::ConcludedLicense')\n            else:\n                raise CardinalityError('File::ConcludedLicense')\n        else:\n            raise OrderError('File::ConcludedLicense')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "FileBuilder.set_concluded_license", "docstring": "Raises OrderError if no package or file defined.\n        Raises CardinalityError if already set.\n        Raises SPDXValueError if malformed.", "docstring_tokens": ["Raises", "OrderError", "if", "no", "package", "or", "file", "defined", ".", "Raises", "CardinalityError", "if", "already", "set", ".", "Raises", "SPDXValueError", "if", "malformed", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 259621}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/evalctx.py#L165-L197", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Process the signature and find definition for type.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "if", "hasattr", "(", "arg_0", ".", "_sig", ",", "'tret'", ")", ":", "arg_1", ".", "append", "(", "arg_0", ".", "_sig", ".", "tret", ")", "if", "hasattr", "(", "arg_0", ".", "_sig", ",", "'tparams'", ")", "and", "arg_0", ".", "_sig", ".", "tparams", "is", "not", "None", ":", "for", "arg_2", "in", "arg_0", ".", "_sig", ".", "tparams", ":", "arg_1", ".", "append", "(", "arg_2", ")", "if", "arg_0", ".", "_translate_to", "is", "not", "None", ":", "arg_1", ".", "append", "(", "arg_0", ".", "_translate_to", ".", "target", ")", "if", "arg_0", ".", "_variadic_types", "is", "not", "None", ":", "for", "arg_3", "in", "arg_0", ".", "_variadic_types", ":", "arg_1", ".", "append", "(", "arg_3", ")", "for", "arg_3", "in", "arg_1", ":", "for", "arg_4", "in", "arg_3", ".", "components", ":", "if", "arg_4", "not", "in", "arg_0", ".", "resolution", "or", "arg_0", ".", "resolution", "[", "arg_4", "]", "is", "None", ":", "arg_5", "=", "arg_0", ".", "get_parent", "(", ")", "if", "arg_5", "is", "not", "None", ":", "arg_6", "=", "arg_5", ".", "get_by_symbol_name", "(", "arg_4", ")", "if", "len", "(", "arg_6", ")", "==", "1", ":", "arg_6", "=", "list", "(", "arg_6", ".", "values", "(", ")", ")", "[", "0", "]", "if", "isinstance", "(", "arg_6", ",", "EvalCtx", ")", ":", "arg_6", "=", "arg_6", ".", "_sig", "arg_7", "=", "weakref", ".", "ref", "(", "arg_6", ")", "arg_0", ".", "resolution", "[", "arg_4", "]", "=", "arg_7", "continue", "arg_0", ".", "resolution", "[", "arg_4", "]", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Process the signature and find definition for type.\n        \"\"\"\n        # collect types for resolution\n        arg_1 = []\n        if hasattr(arg_0._sig, 'tret'):\n            arg_1.append(arg_0._sig.tret)\n        if hasattr(arg_0._sig, 'tparams') and arg_0._sig.tparams is not None:\n            for arg_2 in arg_0._sig.tparams:\n                arg_1.append(arg_2)\n        if arg_0._translate_to is not None:\n            arg_1.append(arg_0._translate_to.target)\n        if arg_0._variadic_types is not None:\n            for arg_3 in arg_0._variadic_types:\n                arg_1.append(arg_3)\n        for arg_3 in arg_1:\n            for arg_4 in arg_3.components:\n                if arg_4 not in arg_0.resolution or arg_0.resolution[arg_4] is None:\n                    # try to find what is c\n                    arg_5 = arg_0.get_parent()\n                    if arg_5 is not None:\n                        arg_6 = arg_5.get_by_symbol_name(arg_4)\n                        if len(arg_6) == 1:\n                            arg_6 = list(arg_6.values())[0]\n                            # unwrap EvalCtx around Type\n                            if isinstance(arg_6, EvalCtx):\n                                arg_6 = arg_6._sig\n                            arg_7 = weakref.ref(arg_6)\n                            arg_0.resolution[arg_4] = arg_7\n                            continue\n                    # unFuncd\n                    arg_0.resolution[arg_4] = None", "path": "pyrser/type_system/evalctx.py", "identifier": "EvalCtx.resolve", "docstring": "Process the signature and find definition for type.", "docstring_tokens": ["Process", "the", "signature", "and", "find", "definition", "for", "type", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 259622}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/worker_plugins/base_worker.py#L42-L50", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Configure all listeners here", "language": "python", "parameters": "(self)", "return_statement": "return self.conn.consume_in_threads()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_setup_rpc", "(", ")", "if", "not", "arg_0", ".", "endpoints", ":", "return", "[", "]", "arg_0", ".", "conn", "=", "n_rpc", ".", "create_connection", "(", ")", "arg_0", ".", "conn", ".", "create_consumer", "(", "arg_0", ".", "topic", ",", "arg_0", ".", "endpoints", ",", "fanout", "=", "False", ")", "return", "arg_0", ".", "conn", ".", "consume_in_threads", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Configure all listeners here\"\"\"\n        arg_0._setup_rpc()\n        if not arg_0.endpoints:\n            return []\n        arg_0.conn = n_rpc.create_connection()\n        arg_0.conn.create_consumer(arg_0.topic, arg_0.endpoints,\n                                  fanout=False)\n        return arg_0.conn.consume_in_threads()", "path": "quark/worker_plugins/base_worker.py", "identifier": "QuarkAsyncPluginBase.start_rpc_listeners", "docstring": "Configure all listeners here", "docstring_tokens": ["Configure", "all", "listeners", "here"], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 259623}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/board.py#L139-L149", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Create a list for a board. Returns a new List object.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return self.create_list(list_json)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", "+", "'/lists'", ",", "http_method", "=", "'POST'", ",", "arg_1", "=", "arg_1", "or", "{", "}", ")", "return", "arg_0", ".", "create_list", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''\n        Create a list for a board. Returns a new List object.\n        '''\n        arg_2 = arg_0.fetch_json(\n            uri_path=arg_0.base_uri + '/lists',\n            http_method='POST',\n            arg_1=arg_1 or {}\n        )\n\n        return arg_0.create_list(arg_2)", "path": "trolly/board.py", "identifier": "Board.add_list", "docstring": "Create a list for a board. Returns a new List object.", "docstring_tokens": ["Create", "a", "list", "for", "a", "board", ".", "Returns", "a", "new", "List", "object", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 259624}
{"url": "https://github.com/jrfonseca/xdot.py/blob/6248c81c21a0fe825089311b17f2c302eea614a2/xdot/ui/elements.py#L386-L392", "sha": "6248c81c21a0fe825089311b17f2c302eea614a2", "docstring_summary": "Evaluate polynomial of given bernstein coefficients\n        using de Casteljau's algorithm.", "language": "python", "parameters": "(p0, p1, p2, p3, t)", "return_statement": "return p0*(u**3) + 3*t*u*(p1*u + p2*t) + p3*(t**3)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "1", "-", "arg_4", "return", "arg_0", "*", "(", "arg_5", "**", "3", ")", "+", "3", "*", "arg_4", "*", "arg_5", "*", "(", "arg_1", "*", "arg_5", "+", "arg_2", "*", "arg_4", ")", "+", "arg_3", "*", "(", "arg_4", "**", "3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Evaluate polynomial of given bernstein coefficients\n        using de Casteljau's algorithm.\n        \"\"\"\n        arg_5 = 1 - arg_4\n        return arg_0*(arg_5**3) + 3*arg_4*arg_5*(arg_1*arg_5 + arg_2*arg_4) + arg_3*(arg_4**3)", "path": "xdot/ui/elements.py", "identifier": "BezierShape._cubic_bernstein", "docstring": "Evaluate polynomial of given bernstein coefficients\n        using de Casteljau's algorithm.", "docstring_tokens": ["Evaluate", "polynomial", "of", "given", "bernstein", "coefficients", "using", "de", "Casteljau", "s", "algorithm", "."], "nwo": "jrfonseca/xdot.py", "score": 0.7239603951735745, "idx": 259625}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completer.py#L232-L236", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Split a line of text with a cursor at the given position.", "language": "python", "parameters": "(self, line, cursor_pos=None)", "return_statement": "return self._delim_re.split(l)[-1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_1", "if", "arg_2", "is", "None", "else", "arg_1", "[", ":", "arg_2", "]", "return", "arg_0", ".", "_delim_re", ".", "split", "(", "arg_3", ")", "[", "-", "1", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Split a line of text with a cursor at the given position.\n        \"\"\"\n        arg_3 = arg_1 if arg_2 is None else arg_1[:arg_2]\n        return arg_0._delim_re.split(arg_3)[-1]", "path": "environment/lib/python2.7/site-packages/IPython/core/completer.py", "identifier": "CompletionSplitter.split_line", "docstring": "Split a line of text with a cursor at the given position.", "docstring_tokens": ["Split", "a", "line", "of", "text", "with", "a", "cursor", "at", "the", "given", "position", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259626}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/phabricator.py#L544-L555", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrieve data about PHIDs.", "language": "python", "parameters": "(self, *phids)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "Func", ")", ":", "arg_2", "=", "{", "arg_0", ".", "PHIDS", ":", "Func", "}", "arg_3", "=", "arg_0", ".", "_call", "(", "arg_0", ".", "PHAB_PHIDS", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, *Func):\n        \"\"\"Retrieve data about PHIDs.\n\n        :params phids: list of PHIDs\n        \"\"\"\n        arg_2 = {\n            arg_0.PHIDS: Func\n        }\n\n        arg_3 = arg_0._call(arg_0.PHAB_PHIDS, arg_2)\n\n        return arg_3", "path": "perceval/backends/core/phabricator.py", "identifier": "ConduitClient.phids", "docstring": "Retrieve data about PHIDs.\n\n        :params phids: list of PHIDs", "docstring_tokens": ["Retrieve", "data", "about", "PHIDs", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259627}
{"url": "https://github.com/MeirKriheli/python-bidi/blob/a0e265bb465c1b7ad628487991e33b5ebe364641/bidi/algorithm.py#L310-L395", "sha": "a0e265bb465c1b7ad628487991e33b5ebe364641", "docstring_summary": "Reslove weak type rules W1 - W3.", "language": "python", "parameters": "(storage, debug=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "for", "arg_2", "in", "arg_0", "[", "'runs'", "]", ":", "arg_3", "=", "arg_9", "=", "arg_2", "[", "'sor'", "]", "arg_4", ",", "arg_5", "=", "arg_2", "[", "'start'", "]", ",", "arg_2", "[", "'length'", "]", "arg_6", "=", "arg_0", "[", "'chars'", "]", "[", "arg_4", ":", "arg_4", "+", "arg_5", "]", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "arg_7", "[", "'type'", "]", "if", "arg_8", "==", "'NSM'", ":", "arg_7", "[", "'type'", "]", "=", "arg_8", "=", "arg_9", "if", "arg_8", "==", "'EN'", "and", "arg_3", "==", "'AL'", ":", "arg_7", "[", "'type'", "]", "=", "'AN'", "if", "arg_8", "in", "(", "'R'", ",", "'L'", ",", "'AL'", ")", ":", "arg_3", "=", "arg_8", "arg_9", "=", "arg_7", "[", "'type'", "]", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", "[", "'type'", "]", "==", "'AL'", ":", "arg_7", "[", "'type'", "]", "=", "'R'", "for", "arg_10", "in", "range", "(", "1", ",", "len", "(", "arg_6", ")", "-", "1", ")", ":", "arg_8", "=", "arg_6", "[", "arg_10", "]", "[", "'type'", "]", "arg_9", "=", "arg_6", "[", "arg_10", "-", "1", "]", "[", "'type'", "]", "arg_11", "=", "arg_6", "[", "arg_10", "+", "1", "]", "[", "'type'", "]", "if", "arg_8", "==", "'ES'", "and", "(", "arg_9", "==", "arg_11", "==", "'EN'", ")", ":", "arg_6", "[", "arg_10", "]", "[", "'type'", "]", "=", "'EN'", "if", "arg_8", "==", "'CS'", "and", "arg_9", "==", "arg_11", "and", "arg_9", "in", "(", "'AN'", ",", "'EN'", ")", ":", "arg_6", "[", "arg_10", "]", "[", "'type'", "]", "=", "arg_9", "for", "arg_10", "in", "range", "(", "len", "(", "arg_6", ")", ")", ":", "if", "arg_6", "[", "arg_10", "]", "[", "'type'", "]", "==", "'EN'", ":", "for", "arg_12", "in", "range", "(", "arg_10", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "arg_6", "[", "arg_12", "]", "[", "'type'", "]", "==", "'ET'", ":", "arg_6", "[", "arg_12", "]", "[", "'type'", "]", "=", "'EN'", "else", ":", "break", "for", "arg_12", "in", "range", "(", "arg_10", "+", "1", ",", "len", "(", "arg_6", ")", ")", ":", "if", "arg_6", "[", "arg_12", "]", "[", "'type'", "]", "==", "'ET'", ":", "arg_6", "[", "arg_12", "]", "[", "'type'", "]", "=", "'EN'", "else", ":", "break", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", "[", "'type'", "]", "in", "(", "'ET'", ",", "'ES'", ",", "'CS'", ")", ":", "arg_7", "[", "'type'", "]", "=", "'ON'", "arg_3", "=", "arg_2", "[", "'sor'", "]", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", "[", "'type'", "]", "==", "'EN'", "and", "arg_3", "==", "'L'", ":", "arg_7", "[", "'type'", "]", "=", "'L'", "if", "arg_7", "[", "'type'", "]", "in", "(", "'L'", ",", "'R'", ")", ":", "arg_3", "=", "arg_7", "[", "'type'", "]", "if", "arg_1", ":", "debug_storage", "(", "arg_0", ",", "runs", "=", "True", ")"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"Reslove weak type rules W1 - W3.\n\n    See: http://unicode.org/reports/tr9/#Resolving_Weak_Types\n\n    \"\"\"\n\n    for arg_2 in arg_0['runs']:\n        arg_3 = arg_9 = arg_2['sor']\n        arg_4, arg_5 = arg_2['start'], arg_2['length']\n        arg_6 = arg_0['chars'][arg_4:arg_4+arg_5]\n        for arg_7 in arg_6:\n            # W1. Examine each nonspacing mark (NSM) in the level run, and\n            # change the type of the NSM to the type of the previous character.\n            # If the NSM is at the start of the level run, it will get the type\n            # of sor.\n            arg_8 = arg_7['type']\n\n            if arg_8 == 'NSM':\n                arg_7['type'] = arg_8 = arg_9\n\n            # W2. Search backward from each instance of a European number until\n            # the first strong type (R, L, AL, or sor) is found. If an AL is\n            # found, change the type of the European number to Arabic number.\n            if arg_8 == 'EN' and arg_3 == 'AL':\n                arg_7['type'] = 'AN'\n\n            # update prev_strong if needed\n            if arg_8 in ('R', 'L', 'AL'):\n                arg_3 = arg_8\n\n            arg_9 = arg_7['type']\n\n        # W3. Change all ALs to R\n        for arg_7 in arg_6:\n            if arg_7['type'] == 'AL':\n                arg_7['type'] = 'R'\n\n        # W4. A single European separator between two European numbers changes\n        # to a European number. A single common separator between two numbers of\n        # the same type changes to that type.\n        for arg_10 in range(1, len(arg_6) - 1):\n            arg_8 = arg_6[arg_10]['type']\n            arg_9 = arg_6[arg_10-1]['type']\n            arg_11 = arg_6[arg_10+1]['type']\n\n            if arg_8 == 'ES' and (arg_9 == arg_11 == 'EN'):\n                arg_6[arg_10]['type'] = 'EN'\n\n            if arg_8 == 'CS' and arg_9 == arg_11 and \\\n                    arg_9 in ('AN', 'EN'):\n                arg_6[arg_10]['type'] = arg_9\n\n        # W5. A sequence of European terminators adjacent to European numbers\n        # changes to all European numbers.\n        for arg_10 in range(len(arg_6)):\n            if arg_6[arg_10]['type'] == 'EN':\n                for arg_12 in range(arg_10-1, -1, -1):\n                    if arg_6[arg_12]['type'] == 'ET':\n                        arg_6[arg_12]['type'] = 'EN'\n                    else:\n                        break\n                for arg_12 in range(arg_10+1, len(arg_6)):\n                    if arg_6[arg_12]['type'] == 'ET':\n                        arg_6[arg_12]['type'] = 'EN'\n                    else:\n                        break\n\n        # W6. Otherwise, separators and terminators change to Other Neutral.\n        for arg_7 in arg_6:\n            if arg_7['type'] in ('ET', 'ES', 'CS'):\n                arg_7['type'] = 'ON'\n\n        # W7. Search backward from each instance of a European number until the\n        # first strong type (R, L, or sor) is found. If an L is found, then\n        # change the type of the European number to L.\n        arg_3 = arg_2['sor']\n        for arg_7 in arg_6:\n            if arg_7['type'] == 'EN' and arg_3 == 'L':\n                arg_7['type'] = 'L'\n\n            if arg_7['type'] in ('L', 'R'):\n                arg_3 = arg_7['type']\n\n    if arg_1:\n        debug_storage(arg_0, runs=True)", "path": "bidi/algorithm.py", "identifier": "resolve_weak_types", "docstring": "Reslove weak type rules W1 - W3.\n\n    See: http://unicode.org/reports/tr9/#Resolving_Weak_Types", "docstring_tokens": ["Reslove", "weak", "type", "rules", "W1", "-", "W3", "."], "nwo": "MeirKriheli/python-bidi", "score": 0.28828505124417525, "idx": 259628}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L153-L165", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Try to match the current record to the database.", "language": "python", "parameters": "(self, query=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "from", "invenio", ".", "search_engine", "import", "perform_request_search", "if", "not", "arg_1", ":", "arg_3", "=", "arg_0", ".", "record", "[", "\"001\"", "]", "[", "0", "]", "[", "3", "]", "return", "perform_request_search", "(", "p", "=", "\"035:%s\"", "%", "(", "arg_3", ",", ")", ",", "of", "=", "\"id\"", ")", "else", ":", "if", "\"recid\"", "not", "in", "arg_2", ":", "arg_2", "[", "\"recid\"", "]", "=", "arg_0", ".", "record", "[", "\"001\"", "]", "[", "0", "]", "[", "3", "]", "return", "perform_request_search", "(", "p", "=", "arg_1", "%", "arg_2", ",", "of", "=", "\"id\"", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"Try to Func the current record to the database.\"\"\"\n        from invenio.search_engine import perform_request_search\n        if not arg_1:\n            # We use default setup\n            arg_3 = arg_0.record[\"001\"][0][3]\n            return perform_request_search(p=\"035:%s\" % (arg_3,),\n                                          of=\"id\")\n        else:\n            if \"recid\" not in arg_2:\n                arg_2[\"recid\"] = arg_0.record[\"001\"][0][3]\n            return perform_request_search(p=arg_1 % arg_2,\n                                          of=\"id\")", "path": "harvestingkit/inspire_cds_package/base.py", "identifier": "MARCXMLConversion.match", "docstring": "Try to match the current record to the database.", "docstring_tokens": ["Try", "to", "match", "the", "current", "record", "to", "the", "database", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259629}
{"url": "https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L272-L311", "sha": "b45395b1aba41301b898040acade7010e6878a08", "docstring_summary": "Return the number of bytes transmitted in 1 second.", "language": "python", "parameters": "(ftp, retr=True)", "return_statement": "return tot_bytes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "0", "if", "arg_1", ":", "def", "request_file", "(", ")", ":", "arg_0", ".", "voidcmd", "(", "'TYPE I'", ")", "arg_3", "=", "arg_0", ".", "transfercmd", "(", "\"retr \"", "+", "TESTFN", ")", "return", "arg_3", "with", "contextlib", ".", "closing", "(", "request_file", "(", ")", ")", "as", "arg_3", ":", "register_memory", "(", ")", "arg_4", "=", "time", ".", "time", "(", ")", "+", "1.0", "while", "arg_4", ">", "time", ".", "time", "(", ")", ":", "arg_5", "=", "arg_3", ".", "recv", "(", "BUFFER_LEN", ")", "if", "not", "arg_5", ":", "arg_6", "=", "time", ".", "time", "(", ")", "arg_0", ".", "voidresp", "(", ")", "arg_3", ".", "close", "(", ")", "arg_3", "=", "request_file", "(", ")", "arg_4", "+=", "time", ".", "time", "(", ")", "-", "arg_6", "arg_2", "+=", "len", "(", "arg_5", ")", "try", ":", "while", "arg_5", ":", "arg_5", "=", "arg_3", ".", "recv", "(", "BUFFER_LEN", ")", "arg_0", ".", "voidresp", "(", ")", "arg_3", ".", "close", "(", ")", "except", "(", "ftplib", ".", "error_temp", ",", "ftplib", ".", "error_perm", ")", ":", "pass", "else", ":", "arg_0", ".", "voidcmd", "(", "'TYPE I'", ")", "with", "contextlib", ".", "closing", "(", "arg_0", ".", "transfercmd", "(", "\"STOR \"", "+", "TESTFN", ")", ")", "as", "arg_3", ":", "register_memory", "(", ")", "arg_5", "=", "b'x'", "*", "BUFFER_LEN", "arg_4", "=", "time", ".", "time", "(", ")", "+", "1", "while", "arg_4", ">", "time", ".", "time", "(", ")", ":", "arg_2", "+=", "arg_3", ".", "send", "(", "arg_5", ")", "arg_0", ".", "voidresp", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Return the number of bytes transmitted in 1 second.\"\"\"\n    arg_2 = 0\n    if arg_1:\n        def request_file():\n            arg_0.voidcmd('TYPE I')\n            arg_3 = arg_0.transfercmd(\"retr \" + TESTFN)\n            return arg_3\n\n        with contextlib.closing(request_file()) as arg_3:\n            register_memory()\n            arg_4 = time.time() + 1.0\n            while arg_4 > time.time():\n                arg_5 = arg_3.recv(BUFFER_LEN)\n                if not arg_5:\n                    arg_6 = time.time()\n                    arg_0.voidresp()\n                    arg_3.close()\n                    arg_3 = request_file()\n                    arg_4 += time.time() - arg_6\n                arg_2 += len(arg_5)\n\n        try:\n            while arg_5:\n                arg_5 = arg_3.recv(BUFFER_LEN)\n            arg_0.voidresp()\n            arg_3.close()\n        except (ftplib.error_temp, ftplib.error_perm):\n            pass\n    else:\n        arg_0.voidcmd('TYPE I')\n        with contextlib.closing(arg_0.transfercmd(\"STOR \" + TESTFN)) as arg_3:\n            register_memory()\n            arg_5 = b'x' * BUFFER_LEN\n            arg_4 = time.time() + 1\n            while arg_4 > time.time():\n                arg_2 += arg_3.send(arg_5)\n        arg_0.voidresp()\n\n    return arg_2", "path": "ftpbench.py", "identifier": "bytes_per_second", "docstring": "Return the number of bytes transmitted in 1 second.", "docstring_tokens": ["Return", "the", "number", "of", "bytes", "transmitted", "in", "1", "second", "."], "nwo": "aio-libs/aioftp", "score": 0.5742192901431463, "idx": 259630}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L226-L255", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates a new queue. Once created, this queue's resource manifest is\n        immutable.", "language": "python", "parameters": "(self, queue_name, queue=None, fail_on_exist=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "arg_1", ")", "arg_4", "=", "HTTPRequest", "(", ")", "arg_4", ".", "method", "=", "'PUT'", "arg_4", ".", "host", "=", "arg_0", ".", "_get_host", "(", ")", "arg_4", ".", "path", "=", "'/'", "+", "_str", "(", "arg_1", ")", "+", "''", "arg_4", ".", "body", "=", "_get_request_body", "(", "_convert_queue_to_xml", "(", "arg_2", ")", ")", "arg_4", ".", "path", ",", "arg_4", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_4", ")", "arg_4", ".", "headers", "=", "arg_0", ".", "_update_service_bus_header", "(", "arg_4", ")", "if", "not", "arg_3", ":", "try", ":", "arg_0", ".", "_perform_request", "(", "arg_4", ")", "return", "True", "except", "AzureHttpError", "as", "ex", ":", "_dont_fail_on_exist", "(", "ex", ")", "return", "False", "else", ":", "arg_0", ".", "_perform_request", "(", "arg_4", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        '''\n        Creates a new queue. Once created, this queue's resource manifest is\n        immutable.\n\n        queue_name:\n            Name of the queue to create.\n        queue:\n            Queue object to create.\n        fail_on_exist:\n            Specify whether to throw an exception when the queue exists.\n        '''\n        _validate_not_none('queue_name', arg_1)\n        arg_4 = HTTPRequest()\n        arg_4.method = 'PUT'\n        arg_4.host = arg_0._get_host()\n        arg_4.path = '/' + _str(arg_1) + ''\n        arg_4.body = _get_request_body(_convert_queue_to_xml(arg_2))\n        arg_4.path, arg_4.query = arg_0._httpclient._update_request_uri_query(arg_4)  # pylint: disable=protected-access\n        arg_4.headers = arg_0._update_service_bus_header(arg_4)\n        if not arg_3:\n            try:\n                arg_0._perform_request(arg_4)\n                return True\n            except AzureHttpError as ex:\n                _dont_fail_on_exist(ex)\n                return False\n        else:\n            arg_0._perform_request(arg_4)\n            return True", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusService.create_queue", "docstring": "Creates a new queue. Once created, this queue's resource manifest is\n        immutable.\n\n        queue_name:\n            Name of the queue to create.\n        queue:\n            Queue object to create.\n        fail_on_exist:\n            Specify whether to throw an exception when the queue exists.", "docstring_tokens": ["Creates", "a", "new", "queue", ".", "Once", "created", "this", "queue", "s", "resource", "manifest", "is", "immutable", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259631}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/job_model.py#L105-L113", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Validate that the name follows posix conventions for env variables.", "language": "python", "parameters": "(name, param_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "re", ".", "match", "(", "r'^[a-zA-Z_][a-zA-Z0-9_]*$'", ",", "arg_0", ")", ":", "raise", "ValueError", "(", "'Invalid %s: %s'", "%", "(", "arg_1", ",", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Validate that the name follows posix conventions for env variables.\"\"\"\n  # http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_235\n  #\n  # 3.235 Name\n  # In the shell command language, a word consisting solely of underscores,\n  # digits, and alphabetics from the portable character set.\n  if not re.match(r'^[a-zA-Z_][a-zA-Z0-9_]*$', arg_0):\n    raise ValueError('Invalid %s: %s' % (arg_1, arg_0))", "path": "dsub/lib/job_model.py", "identifier": "validate_param_name", "docstring": "Validate that the name follows posix conventions for env variables.", "docstring_tokens": ["Validate", "that", "the", "name", "follows", "posix", "conventions", "for", "env", "variables", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 259632}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1952-L1967", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Return a warning message of code 'code'.", "language": "python", "parameters": "(code)", "return_statement": "return CFG_BIBRECORD_WARNING_MSGS.get(code, '') + message", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "arg_0", "arg_1", "=", "''", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "if", "isinstance", "(", "arg_0", "[", "0", "]", ",", "str", ")", ":", "arg_1", "=", "arg_0", "[", "1", "]", "arg_0", "=", "arg_0", "[", "0", "]", "return", "CFG_BIBRECORD_WARNING_MSGS", ".", "get", "(", "arg_0", ",", "''", ")", "+", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Return a warning message of code 'code'.\n\n    If code = (cd, str) it returns the warning message of code 'cd' and appends\n    str at the end\n    \"\"\"\n    if isinstance(arg_0, str):\n        return arg_0\n\n    arg_1 = ''\n    if isinstance(arg_0, tuple):\n        if isinstance(arg_0[0], str):\n            arg_1 = arg_0[1]\n            arg_0 = arg_0[0]\n    return CFG_BIBRECORD_WARNING_MSGS.get(arg_0, '') + arg_1", "path": "harvestingkit/bibrecord.py", "identifier": "_warning", "docstring": "Return a warning message of code 'code'.\n\n    If code = (cd, str) it returns the warning message of code 'cd' and appends\n    str at the end", "docstring_tokens": ["Return", "a", "warning", "message", "of", "code", "code", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259633}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L240-L256", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "This is the Signavio specific editor hook for pre-parsing and\n        validation.", "language": "python", "parameters": "(self, bpmn, filename)", "return_statement": "return bpmn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_check_for_disconnected_boundary_events_signavio", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_fix_call_activities_signavio", "(", "arg_1", ",", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        This is the Signavio specific editor hook for pre-parsing and\n        validation.\n\n        A subclass can override this method to provide additional parseing or\n        validation. It should call the parent method first.\n\n        :param bpmn: an lxml tree of the bpmn content\n\n        :param filename: the source file name\n\n        This must return the updated bpmn object (or a replacement)\n        \"\"\"\n        arg_0._check_for_disconnected_boundary_events_signavio(arg_1, arg_2)\n        arg_0._fix_call_activities_signavio(arg_1, arg_2)\n        return arg_1", "path": "SpiffWorkflow/bpmn/serializer/Packager.py", "identifier": "Packager.pre_parse_and_validate_signavio", "docstring": "This is the Signavio specific editor hook for pre-parsing and\n        validation.\n\n        A subclass can override this method to provide additional parseing or\n        validation. It should call the parent method first.\n\n        :param bpmn: an lxml tree of the bpmn content\n\n        :param filename: the source file name\n\n        This must return the updated bpmn object (or a replacement)", "docstring_tokens": ["This", "is", "the", "Signavio", "specific", "editor", "hook", "for", "pre", "-", "parsing", "and", "validation", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 259634}
{"url": "https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/feature_extraction/text.py#L212-L253", "sha": "0498502107c1f7dcf33cda0cdb6f5ba4b42524b7", "docstring_summary": "Remove too rare or too common features.", "language": "python", "parameters": "(self, X, vocabulary, high=None, low=None,\n                        limit=None)", "return_statement": "return kept_indices, removed_terms", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "if", "arg_3", "is", "None", "and", "arg_4", "is", "None", "and", "arg_5", "is", "None", ":", "return", "arg_1", ",", "set", "(", ")", "arg_6", "=", "arg_1", ".", "map", "(", "_document_frequency", ")", ".", "sum", "(", ")", "arg_7", "=", "arg_1", ".", "map", "(", "lambda", "x", ":", "arg_11", ".", "asarray", "(", "x", ".", "sum", "(", "axis", "=", "0", ")", ")", ")", ".", "sum", "(", ")", ".", "ravel", "(", ")", "arg_8", "=", "arg_11", ".", "ones", "(", "len", "(", "arg_6", ")", ",", "dtype", "=", "bool", ")", "if", "arg_3", "is", "not", "None", ":", "arg_8", "&=", "arg_6", "<=", "arg_3", "if", "arg_4", "is", "not", "None", ":", "arg_8", "&=", "arg_6", ">=", "arg_4", "if", "arg_5", "is", "not", "None", "and", "arg_8", ".", "sum", "(", ")", ">", "arg_5", ":", "arg_9", "=", "(", "-", "arg_7", "[", "arg_8", "]", ")", ".", "argsort", "(", ")", "[", ":", "arg_5", "]", "arg_10", "=", "arg_11", ".", "zeros", "(", "len", "(", "arg_6", ")", ",", "dtype", "=", "bool", ")", "arg_10", "[", "arg_11", ".", "where", "(", "arg_8", ")", "[", "0", "]", "[", "arg_9", "]", "]", "=", "True", "arg_8", "=", "arg_10", "arg_13", "=", "arg_11", ".", "cumsum", "(", "arg_8", ")", "-", "1", "arg_14", "=", "set", "(", ")", "for", "arg_15", ",", "arg_16", "in", "list", "(", "six", ".", "iteritems", "(", "arg_2", ")", ")", ":", "if", "arg_8", "[", "arg_16", "]", ":", "arg_2", "[", "arg_15", "]", "=", "arg_13", "[", "arg_16", "]", "else", ":", "del", "arg_2", "[", "arg_15", "]", "arg_14", ".", "add", "(", "arg_15", ")", "arg_17", "=", "arg_11", ".", "where", "(", "arg_8", ")", "[", "0", "]", "if", "len", "(", "arg_17", ")", "==", "0", ":", "raise", "ValueError", "(", "\"After pruning, no terms remain. Try a lower\"", "\" min_df or a higher max_df.\"", ")", "return", "arg_17", ",", "arg_14"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,\n                        arg_5=None):\n        \"\"\"Remove too rare or too common features.\n\n        Prune features that are non zero in more samples than high or less\n        documents than low, modifying the vocabulary, and restricting it to\n        at most the limit most frequent.\n\n        This does not prune samples with zero features.\n        \"\"\"\n        if arg_3 is None and arg_4 is None and arg_5 is None:\n            return arg_1, set()\n\n        # Calculate a mask based on document frequencies\n        arg_6 = arg_1.map(_document_frequency).sum()\n        arg_7 = arg_1.map(lambda x: arg_11.asarray(x.sum(axis=0))).sum().ravel()\n        arg_8 = arg_11.ones(len(arg_6), dtype=bool)\n        if arg_3 is not None:\n            arg_8 &= arg_6 <= arg_3\n        if arg_4 is not None:\n            arg_8 &= arg_6 >= arg_4\n        if arg_5 is not None and arg_8.sum() > arg_5:\n            arg_9 = (-arg_7[arg_8]).argsort()[:arg_5]\n            arg_10 = arg_11.zeros(len(arg_6), dtype=bool)\n            arg_10[arg_11.where(arg_8)[0][arg_9]] = True\n            arg_8 = arg_10\n\n        arg_13 = arg_11.cumsum(arg_8) - 1  # maps old indices to new\n        arg_14 = set()\n        for arg_15, arg_16 in list(six.iteritems(arg_2)):\n            if arg_8[arg_16]:\n                arg_2[arg_15] = arg_13[arg_16]\n            else:\n                del arg_2[arg_15]\n                arg_14.add(arg_15)\n        arg_17 = arg_11.where(arg_8)[0]\n\n        if len(arg_17) == 0:\n            raise ValueError(\"After pruning, no terms remain. Try a lower\"\n                             \" min_df or a higher max_df.\")\n\n        return arg_17, arg_14", "path": "splearn/feature_extraction/text.py", "identifier": "SparkCountVectorizer._limit_features", "docstring": "Remove too rare or too common features.\n\n        Prune features that are non zero in more samples than high or less\n        documents than low, modifying the vocabulary, and restricting it to\n        at most the limit most frequent.\n\n        This does not prune samples with zero features.", "docstring_tokens": ["Remove", "too", "rare", "or", "too", "common", "features", "."], "nwo": "lensacom/sparkit-learn", "score": 0.7619621287574014, "idx": 259635}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/interchange.py#L192-L214", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Obtains a batch of tasks from the internal pending_task_queue", "language": "python", "parameters": "(self, count)", "return_statement": "return tasks", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "range", "(", "0", ",", "arg_1", ")", ":", "try", ":", "arg_4", "=", "arg_0", ".", "pending_task_queue", ".", "get", "(", "block", "=", "False", ")", "except", "queue", ".", "Empty", ":", "break", "else", ":", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Obtains a batch of tasks from the internal pending_task_queue\n\n        Parameters\n        ----------\n        count: int\n            Count of tasks to get from the queue\n\n        Returns\n        -------\n        List of upto count tasks. May return fewer than count down to an empty list\n            eg. [{'task_id':<x>, 'buffer':<buf>} ... ]\n        \"\"\"\n        arg_2 = []\n        for arg_3 in range(0, arg_1):\n            try:\n                arg_4 = arg_0.pending_task_queue.get(block=False)\n            except queue.Empty:\n                break\n            else:\n                arg_2.append(arg_4)\n\n        return arg_2", "path": "parsl/executors/high_throughput/interchange.py", "identifier": "Interchange.get_tasks", "docstring": "Obtains a batch of tasks from the internal pending_task_queue\n\n        Parameters\n        ----------\n        count: int\n            Count of tasks to get from the queue\n\n        Returns\n        -------\n        List of upto count tasks. May return fewer than count down to an empty list\n            eg. [{'task_id':<x>, 'buffer':<buf>} ... ]", "docstring_tokens": ["Obtains", "a", "batch", "of", "tasks", "from", "the", "internal", "pending_task_queue"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 259636}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L191-L226", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Reads a command response status.", "language": "python", "parameters": "(self)", "return_statement": "return code, message", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "next", "(", "arg_0", ".", "__line_gen", "(", ")", ")", ".", "rstrip", "(", ")", "arg_2", "=", "arg_1", ".", "split", "(", "None", ",", "1", ")", "try", ":", "arg_3", ",", "arg_4", "=", "int", "(", "arg_2", "[", "0", "]", ")", ",", "\"\"", "except", "ValueError", ":", "raise", "NNTPProtocolError", "(", "arg_1", ")", "if", "arg_3", "<", "100", "or", "arg_3", ">=", "600", ":", "raise", "NNTPProtocolError", "(", "arg_1", ")", "if", "len", "(", "arg_2", ")", ">", "1", ":", "arg_4", "=", "arg_2", "[", "1", "]", "if", "400", "<=", "arg_3", "<=", "499", ":", "raise", "NNTPTemporaryError", "(", "arg_3", ",", "arg_4", ")", "if", "500", "<=", "arg_3", "<=", "599", ":", "raise", "NNTPPermanentError", "(", "arg_3", ",", "arg_4", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"Reads a command response Func.\n\n        If there is no response message then the returned Func message will\n        be an empty string.\n\n        Raises:\n            NNTPError: If data is required to be read from the socket and fails.\n            NNTPProtocolError: If the Func line can't be parsed.\n            NNTPTemporaryError: For Func code 400-499\n            NNTPPermanentError: For Func code 500-599\n\n        Returns:\n            A tuple of Func code (as an integer) and Func message.\n        \"\"\"\n        arg_1 = next(arg_0.__line_gen()).rstrip()\n        arg_2 = arg_1.split(None, 1)\n\n        try:\n            arg_3, arg_4 = int(arg_2[0]), \"\"\n        except ValueError:\n            raise NNTPProtocolError(arg_1)\n\n        if arg_3 < 100 or arg_3 >= 600:\n            raise NNTPProtocolError(arg_1)\n\n        if len(arg_2) > 1:\n            arg_4 = arg_2[1]\n\n        if 400 <= arg_3 <= 499:\n            raise NNTPTemporaryError(arg_3, arg_4)\n\n        if 500 <= arg_3 <= 599:\n            raise NNTPPermanentError(arg_3, arg_4)\n\n        return arg_3, arg_4", "path": "nntp/nntp.py", "identifier": "BaseNNTPClient.status", "docstring": "Reads a command response status.\n\n        If there is no response message then the returned status message will\n        be an empty string.\n\n        Raises:\n            NNTPError: If data is required to be read from the socket and fails.\n            NNTPProtocolError: If the status line can't be parsed.\n            NNTPTemporaryError: For status code 400-499\n            NNTPPermanentError: For status code 500-599\n\n        Returns:\n            A tuple of status code (as an integer) and status message.", "docstring_tokens": ["Reads", "a", "command", "response", "status", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 259637}
{"url": "https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/forms.py#L37-L44", "sha": "cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2", "docstring_summary": "Validate that an event with this name on this date does not exist.", "language": "python", "parameters": "(self)", "return_statement": "return cleaned", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "super", "(", "EventForm", ",", "arg_0", ")", ".", "Func", "(", ")", "if", "Event", ".", "objects", ".", "filter", "(", "name", "=", "arg_1", "[", "'name'", "]", ",", "start_date", "=", "arg_1", "[", "'start_date'", "]", ")", ".", "count", "(", ")", ":", "raise", "forms", ".", "ValidationError", "(", "u'This event appears to be in the database already.'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Validate that an event with this name on this date does not exist.\n        \"\"\"\n        arg_1 = super(EventForm, arg_0).Func()\n        if Event.objects.filter(name=arg_1['name'], start_date=arg_1['start_date']).count():\n            raise forms.ValidationError(u'This event appears to be in the database already.')\n        return arg_1", "path": "build/lib/happenings/forms.py", "identifier": "AddEventForm.clean", "docstring": "Validate that an event with this name on this date does not exist.", "docstring_tokens": ["Validate", "that", "an", "event", "with", "this", "name", "on", "this", "date", "does", "not", "exist", "."], "nwo": "tBaxter/tango-happenings", "score": 0.09252797783733271, "idx": 259638}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L204-L218", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Working directory for the repo", "language": "python", "parameters": "(self,  username, reponame, create=True)", "return_statement": "return path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "workspace", ",", "'datasets'", ",", "arg_1", ",", "arg_2", ")", "if", "arg_3", ":", "try", ":", "os", ".", "makedirs", "(", "arg_4", ")", "except", ":", "pass", "return", "arg_4"], "function": "def Func(arg_0,  arg_1, arg_2, arg_3=True):\n        \"\"\"\n        Working directory for the repo\n        \"\"\"\n        arg_4 = os.path.join(arg_0.workspace,\n                            'datasets',\n                            arg_1,\n                            arg_2)\n        if arg_3:\n            try:\n                os.makedirs(arg_4)\n            except:\n                pass\n\n        return arg_4", "path": "dgitcore/plugins/repomanager.py", "identifier": "RepoManagerBase.rootdir", "docstring": "Working directory for the repo", "docstring_tokens": ["Working", "directory", "for", "the", "repo"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 259639}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/magic.py#L344-L366", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return dict of documentation of magic functions.", "language": "python", "parameters": "(self, brief=False, missing='')", "return_statement": "return docs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "''", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", "in", "arg_0", ".", "magics", ":", "arg_5", "=", "{", "}", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "magics", "[", "arg_4", "]", ".", "iteritems", "(", ")", ":", "if", "arg_7", ".", "__doc__", ":", "if", "arg_1", ":", "arg_5", "[", "arg_6", "]", "=", "arg_7", ".", "__doc__", ".", "split", "(", "'\\n'", ",", "1", ")", "[", "0", "]", "else", ":", "arg_5", "[", "arg_6", "]", "=", "arg_7", ".", "__doc__", ".", "rstrip", "(", ")", "else", ":", "arg_5", "[", "arg_6", "]", "=", "arg_2", "arg_3", "[", "arg_4", "]", "=", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False, arg_2=''):\n        \"\"\"Return dict of documentation of magic functions.\n\n        The return dict has the keys 'line' and 'cell', corresponding to the\n        two types of magics we support. Each value is a dict keyed by magic\n        name whose value is the function docstring. If a docstring is\n        unavailable, the value of `missing` is used instead.\n\n        If brief is True, only the first line of each docstring will be returned.\n        \"\"\"\n        arg_3 = {}\n        for arg_4 in arg_0.magics:\n            arg_5 = {}\n            for arg_6, arg_7 in arg_0.magics[arg_4].iteritems():\n                if arg_7.__doc__:\n                    if arg_1:\n                        arg_5[arg_6] = arg_7.__doc__.split('\\n', 1)[0]\n                    else:\n                        arg_5[arg_6] = arg_7.__doc__.rstrip()\n                else:\n                    arg_5[arg_6] = arg_2\n            arg_3[arg_4] = arg_5\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/core/magic.py", "identifier": "MagicsManager.lsmagic_docs", "docstring": "Return dict of documentation of magic functions.\n\n        The return dict has the keys 'line' and 'cell', corresponding to the\n        two types of magics we support. Each value is a dict keyed by magic\n        name whose value is the function docstring. If a docstring is\n        unavailable, the value of `missing` is used instead.\n\n        If brief is True, only the first line of each docstring will be returned.", "docstring_tokens": ["Return", "dict", "of", "documentation", "of", "magic", "functions", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259640}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/trello.py#L103-L113", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Returns a list of dicts representing issues from a remote service.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "get_boards", "(", ")", ":", "for", "arg_2", "in", "arg_0", ".", "get_lists", "(", "arg_1", "[", "'id'", "]", ")", ":", "arg_3", "=", "dict", "(", "boardname", "=", "arg_1", "[", "'name'", "]", ",", "listname", "=", "arg_2", "[", "'name'", "]", ")", "for", "arg_4", "in", "arg_0", ".", "get_cards", "(", "arg_2", "[", "'id'", "]", ")", ":", "arg_5", "=", "arg_0", ".", "get_issue_for_record", "(", "arg_4", ",", "extra", "=", "arg_3", ")", "arg_5", ".", "update_extra", "(", "{", "\"annotations\"", ":", "arg_0", ".", "annotations", "(", "arg_4", ")", "}", ")", "yield", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a list of dicts representing Func from a remote service.\n        \"\"\"\n        for arg_1 in arg_0.get_boards():\n            for arg_2 in arg_0.get_lists(arg_1['id']):\n                arg_3 = dict(boardname=arg_1['name'], listname=arg_2['name'])\n                for arg_4 in arg_0.get_cards(arg_2['id']):\n                    arg_5 = arg_0.get_issue_for_record(arg_4, extra=arg_3)\n                    arg_5.update_extra({\"annotations\": arg_0.annotations(arg_4)})\n                    yield arg_5", "path": "bugwarrior/services/trello.py", "identifier": "TrelloService.issues", "docstring": "Returns a list of dicts representing issues from a remote service.", "docstring_tokens": ["Returns", "a", "list", "of", "dicts", "representing", "issues", "from", "a", "remote", "service", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 259641}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L58-L67", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Delete existing messages.", "language": "python", "parameters": "(self, messages)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "\"/2/messages/?%s\"", "%", "urlencode", "(", "[", "(", "'ids'", ",", "\",\"", ".", "join", "(", "arg_1", ")", ")", "]", ")", "arg_3", "=", "arg_0", ".", "_delete_resource", "(", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Delete existing messages.\n\n        http://dev.wheniwork.com/#delete-existing-message\n        \"\"\"\n        arg_2 = \"/2/messages/?%s\" % urlencode([('ids', \",\".join(arg_1))])\n\n        arg_3 = arg_0._delete_resource(arg_2)\n        return arg_3", "path": "uw_wheniwork/messages.py", "identifier": "Messages.delete_messages", "docstring": "Delete existing messages.\n\n        http://dev.wheniwork.com/#delete-existing-message", "docstring_tokens": ["Delete", "existing", "messages", "."], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 259642}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/context/base.py#L299-L309", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Calculates the viewport based on the configured aspect ratio in settings.\n        Will add black borders if the window do not match the viewport.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "int", "(", "arg_0", ".", "buffer_width", "/", "arg_0", ".", "aspect_ratio", ")", "arg_2", "=", "arg_0", ".", "buffer_height", "-", "arg_1", "arg_0", ".", "fbo", ".", "viewport", "=", "(", "0", ",", "arg_2", "//", "2", ",", "arg_0", ".", "buffer_width", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Calculates the viewport based on the configured aspect ratio in settings.\n        Will add black borders if the window do not match the viewport.\n        \"\"\"\n        # The expected height with the current viewport width\n        arg_1 = int(arg_0.buffer_width / arg_0.aspect_ratio)\n\n        # How much positive or negative y padding\n        arg_2 = arg_0.buffer_height - arg_1\n        arg_0.fbo.viewport = (0, arg_2 // 2, arg_0.buffer_width, arg_1)", "path": "demosys/context/base.py", "identifier": "BaseWindow.set_default_viewport", "docstring": "Calculates the viewport based on the configured aspect ratio in settings.\n        Will add black borders if the window do not match the viewport.", "docstring_tokens": ["Calculates", "the", "viewport", "based", "on", "the", "configured", "aspect", "ratio", "in", "settings", ".", "Will", "add", "black", "borders", "if", "the", "window", "do", "not", "match", "the", "viewport", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 259643}
{"url": "https://github.com/hsharrison/pyglet2d/blob/46f610b3c76221bff19e5c0cf3d35d7875ce37a0/src/pyglet2d.py#L345-L354", "sha": "46f610b3c76221bff19e5c0cf3d35d7875ce37a0", "docstring_summary": "Update the shape's position by moving it forward according to its velocity.", "language": "python", "parameters": "(self, dt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "translate", "(", "arg_1", "*", "arg_0", ".", "velocity", ")", "arg_0", ".", "rotate", "(", "arg_1", "*", "arg_0", ".", "angular_velocity", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update the shape's position by moving it forward according to its velocity.\n\n        Parameters\n        ----------\n        dt : float\n\n        \"\"\"\n        arg_0.translate(arg_1 * arg_0.velocity)\n        arg_0.rotate(arg_1 * arg_0.angular_velocity)", "path": "src/pyglet2d.py", "identifier": "Shape.update", "docstring": "Update the shape's position by moving it forward according to its velocity.\n\n        Parameters\n        ----------\n        dt : float", "docstring_tokens": ["Update", "the", "shape", "s", "position", "by", "moving", "it", "forward", "according", "to", "its", "velocity", "."], "nwo": "hsharrison/pyglet2d", "score": 0.2823188883832642, "idx": 259644}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L139-L190", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "fit classifiers from large dataset.", "language": "python", "parameters": "(self, data, method='kmeans', **kwargs)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'kmeans'", ",", "**", "arg_3", ")", ":", "arg_0", ".", "method", "=", "arg_2", "arg_4", "=", "arg_0", ".", "Functing_data", "(", "arg_1", ")", "arg_5", "=", "{", "'kmeans'", ":", "arg_0", ".", "Func_kmeans", ",", "'meanshift'", ":", "arg_0", ".", "Func_meanshift", "}", "arg_6", "=", "arg_5", "[", "arg_2", "]", "arg_0", ".", "classifier", "=", "arg_6", "(", "arg_1", "=", "arg_4", ",", "**", "arg_3", ")", "arg_8", "=", "arg_0", ".", "classifier", ".", "cluster_centers_", ".", "T", "[", "arg_0", ".", "sort_by", "]", "arg_0", ".", "classifier", ".", "cluster_centers_", "=", "arg_0", ".", "classifier", ".", "cluster_centers_", "[", "np", ".", "argsort", "(", "arg_8", ")", "]", "arg_0", ".", "classifier", ".", "labels_", "=", "arg_0", ".", "classifier", ".", "predict", "(", "arg_4", ")", "arg_0", ".", "classifier", ".", "ulabels_", "=", "np", ".", "unique", "(", "arg_0", ".", "classifier", ".", "labels_", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2='kmeans', **arg_3):\n        \"\"\"\n        Func classifiers from large dataset.\n\n        Parameters\n        ----------\n        data : dict\n            A dict of data for clustering. Must contain\n            items with the same name as analytes used for\n            clustering.\n        method : str\n            A string defining the clustering method used. Can be:\n\n            * 'kmeans' : K-Means clustering algorithm\n            * 'meanshift' : Meanshift algorithm\n\n        n_clusters : int\n            *K-Means only*. The numebr of clusters to identify\n        bandwidth : float\n            *Meanshift only.*\n            The bandwidth value used during clustering.\n            If none, determined automatically. Note:\n            the data are scaled before clutering, so\n            this is not in the same units as the data.\n        bin_seeding : bool\n            *Meanshift only.*\n            Whether or not to use 'bin_seeding'. See\n            documentation for `sklearn.cluster.MeanShift`.\n        **kwargs :\n            passed to `sklearn.cluster.MeanShift`.\n\n        Returns\n        -------\n        list\n        \"\"\"\n        arg_0.method = arg_2\n        arg_4 = arg_0.Functing_data(arg_1)\n        arg_5 = {'kmeans': arg_0.Func_kmeans,\n                 'meanshift': arg_0.Func_meanshift}\n        arg_6 = arg_5[arg_2]\n\n        arg_0.classifier = arg_6(arg_1=arg_4, **arg_3)\n\n        # sort cluster centers by value of first column, to avoid random variation.\n        arg_8 = arg_0.classifier.cluster_centers_.T[arg_0.sort_by]\n        arg_0.classifier.cluster_centers_ = arg_0.classifier.cluster_centers_[np.argsort(arg_8)]\n\n        # recalculate the labels, so it's consistent with cluster centers\n        arg_0.classifier.labels_ = arg_0.classifier.predict(arg_4)\n        arg_0.classifier.ulabels_ = np.unique(arg_0.classifier.labels_)\n\n        return", "path": "latools/filtering/classifier_obj.py", "identifier": "classifier.fit", "docstring": "fit classifiers from large dataset.\n\n        Parameters\n        ----------\n        data : dict\n            A dict of data for clustering. Must contain\n            items with the same name as analytes used for\n            clustering.\n        method : str\n            A string defining the clustering method used. Can be:\n\n            * 'kmeans' : K-Means clustering algorithm\n            * 'meanshift' : Meanshift algorithm\n\n        n_clusters : int\n            *K-Means only*. The numebr of clusters to identify\n        bandwidth : float\n            *Meanshift only.*\n            The bandwidth value used during clustering.\n            If none, determined automatically. Note:\n            the data are scaled before clutering, so\n            this is not in the same units as the data.\n        bin_seeding : bool\n            *Meanshift only.*\n            Whether or not to use 'bin_seeding'. See\n            documentation for `sklearn.cluster.MeanShift`.\n        **kwargs :\n            passed to `sklearn.cluster.MeanShift`.\n\n        Returns\n        -------\n        list", "docstring_tokens": ["fit", "classifiers", "from", "large", "dataset", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 259645}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/uniform.py#L144-L147", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "`high - low`.", "language": "python", "parameters": "(self, name=\"range\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Func\"", ")", ":", "with", "arg_0", ".", "_name_scope", "(", "arg_1", ")", ":", "return", "arg_0", ".", "high", "-", "arg_0", ".", "low"], "function": "def Func(arg_0, arg_1=\"Func\"):\n    \"\"\"`high - low`.\"\"\"\n    with arg_0._name_scope(arg_1):\n      return arg_0.high - arg_0.low", "path": "tensorflow_probability/python/distributions/uniform.py", "identifier": "Uniform.range", "docstring": "`high - low`.", "docstring_tokens": ["high", "-", "low", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259646}
{"url": "https://github.com/uploadcare/pyuploadcare/blob/cefddc0306133a71e37b18e8700df5948ef49b37/pyuploadcare/api_resources.py#L929-L939", "sha": "cefddc0306133a71e37b18e8700df5948ef49b37", "docstring_summary": "Extract uuid from each item of specified ``seq``.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "_seq", ":", "if", "isinstance", "(", "arg_1", ",", "File", ")", ":", "yield", "arg_1", ".", "uuid", "elif", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "yield", "arg_1", "else", ":", "raise", "ValueError", "(", "'Invalid type for sequence item: {0}'", ".", "format", "(", "type", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Extract uuid from each item of specified ``seq``.\n        \"\"\"\n        for arg_1 in arg_0._seq:\n            if isinstance(arg_1, File):\n                yield arg_1.uuid\n            elif isinstance(arg_1, six.string_types):\n                yield arg_1\n            else:\n                raise ValueError(\n                    'Invalid type for sequence item: {0}'.format(type(arg_1)))", "path": "pyuploadcare/api_resources.py", "identifier": "FilesStorage.uuids", "docstring": "Extract uuid from each item of specified ``seq``.", "docstring_tokens": ["Extract", "uuid", "from", "each", "item", "of", "specified", "seq", "."], "nwo": "uploadcare/pyuploadcare", "score": 0.289876796890331, "idx": 259647}
{"url": "https://github.com/RediSearch/redisearch-py/blob/f65d1dd078713cbe9b83584e86655a254d0531ab/redisearch/auto_complete.py#L108-L113", "sha": "f65d1dd078713cbe9b83584e86655a254d0531ab", "docstring_summary": "Delete a string from the AutoCompleter index.\n        Returns 1 if the string was found and deleted, 0 otherwise", "language": "python", "parameters": "(self, string)", "return_statement": "return self.redis.execute_command(AutoCompleter.SUGDEL_COMMAND, self.key, string)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "redis", ".", "execute_command", "(", "AutoCompleter", ".", "SUGDEL_COMMAND", ",", "arg_0", ".", "key", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Delete a string from the AutoCompleter index.\n        Returns 1 if the string was found and Funcd, 0 otherwise\n        \"\"\"\n        return arg_0.redis.execute_command(AutoCompleter.SUGDEL_COMMAND, arg_0.key, arg_1)", "path": "redisearch/auto_complete.py", "identifier": "AutoCompleter.delete", "docstring": "Delete a string from the AutoCompleter index.\n        Returns 1 if the string was found and deleted, 0 otherwise", "docstring_tokens": ["Delete", "a", "string", "from", "the", "AutoCompleter", "index", ".", "Returns", "1", "if", "the", "string", "was", "found", "and", "deleted", "0", "otherwise"], "nwo": "RediSearch/redisearch-py", "score": 0.6923817122804524, "idx": 259648}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/heatmaps.py#L392-L406", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Convert this heatmaps object to a 0-to-255 array.", "language": "python", "parameters": "(self)", "return_statement": "return arr_uint8", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "clip", "(", "np", ".", "round", "(", "arg_0", ".", "arr_0to1", "*", "255", ")", ",", "0", ",", "255", ")", "arg_2", "=", "arg_1", ".", "astype", "(", "np", ".", "uint8", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Convert this heatmaps object to a 0-to-255 array.\n\n        Returns\n        -------\n        arr_uint8 : (H,W,C) ndarray\n            Heatmap as a 0-to-255 array (dtype is uint8).\n\n        \"\"\"\n        # TODO this always returns (H,W,C), even if input ndarray was originall (H,W)\n        # does it make sense here to also return (H,W) if self.arr_was_2d?\n        arg_1 = np.clip(np.round(arg_0.arr_0to1 * 255), 0, 255)\n        arg_2 = arg_1.astype(np.uint8)\n        return arg_2", "path": "imgaug/augmentables/heatmaps.py", "identifier": "HeatmapsOnImage.to_uint8", "docstring": "Convert this heatmaps object to a 0-to-255 array.\n\n        Returns\n        -------\n        arr_uint8 : (H,W,C) ndarray\n            Heatmap as a 0-to-255 array (dtype is uint8).", "docstring_tokens": ["Convert", "this", "heatmaps", "object", "to", "a", "0", "-", "to", "-", "255", "array", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259649}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L153-L200", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Retrieves URLs for the files matched by a glob or a path to a directory\n        in a given dataset.", "language": "python", "parameters": "(self, dataset_id, glob=\".\", is_dir=False, version_number=None)", "return_statement": "return list(\n            map(\n                lambda f: DatasetFile(path=f['filename'], url=f['url']), version['files']\n                )\n            )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\".\"", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_5", "=", "True", "else", ":", "arg_5", "=", "False", "arg_6", "=", "{", "\"download_request\"", ":", "{", "\"glob\"", ":", "arg_2", ",", "\"isDir\"", ":", "arg_3", ",", "\"latest\"", ":", "arg_5", "}", "}", "arg_7", "=", "\"Failed to get matched files in dataset {}\"", ".", "format", "(", "arg_1", ")", "arg_8", "=", "arg_0", ".", "_get_success_json", "(", "arg_0", ".", "_post_json", "(", "routes", ".", "matched_files", "(", "arg_1", ")", ",", "arg_6", ",", "arg_7", "=", "arg_7", ")", ")", "[", "'versions'", "]", "if", "arg_4", "is", "None", ":", "arg_9", "=", "arg_8", "[", "0", "]", "else", ":", "try", ":", "arg_9", "=", "list", "(", "filter", "(", "lambda", "v", ":", "v", "[", "'number'", "]", "==", "arg_4", ",", "arg_8", ")", ")", "[", "0", "]", "except", "IndexError", ":", "raise", "ResourceNotFoundException", "(", ")", "return", "list", "(", "map", "(", "lambda", "f", ":", "DatasetFile", "(", "path", "=", "f", "[", "'filename'", "]", ",", "url", "=", "f", "[", "'url'", "]", ")", ",", "arg_9", "[", "'files'", "]", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=\".\", arg_3=False, arg_4=None):\n        \"\"\"\n        Retrieves URLs for the files matched by a glob or a path to a directory\n        in a given dataset.\n\n        :param dataset_id: The id of the dataset to retrieve files from\n        :type dataset_id: int\n        :param glob: A regex used to select one or more files in the dataset\n        :type glob: str\n        :param is_dir: Whether or not the supplied pattern should be treated as a directory to search in\n        :type is_dir: bool\n        :param version_number: The version number of the dataset to retrieve files from\n        :type version_number: int\n        :return: A list of dataset files whose paths match the provided pattern.\n        :rtype: list of :class:`DatasetFile`\n        \"\"\"\n        if arg_4 is None:\n            arg_5 = True\n        else:\n            arg_5 = False\n\n        arg_6 = {\n            \"download_request\": {\n                \"glob\": arg_2,\n                \"isDir\": arg_3,\n                \"latest\": arg_5\n            }\n        }\n\n        arg_7 = \"Failed to get matched files in dataset {}\".format(arg_1)\n\n        arg_8 = arg_0._get_success_json(arg_0._post_json(routes.matched_files(arg_1), arg_6, arg_7=arg_7))['versions']\n\n        # if you don't provide a version number, only the latest\n        # will be included in the response body\n        if arg_4 is None:\n            arg_9 = arg_8[0]\n        else:\n            try:\n                arg_9 = list(filter(lambda v: v['number'] == arg_4, arg_8))[0]\n            except IndexError:\n                raise ResourceNotFoundException()\n\n        return list(\n            map(\n                lambda f: DatasetFile(path=f['filename'], url=f['url']), arg_9['files']\n                )\n            )", "path": "citrination_client/data/client.py", "identifier": "DataClient.get_dataset_files", "docstring": "Retrieves URLs for the files matched by a glob or a path to a directory\n        in a given dataset.\n\n        :param dataset_id: The id of the dataset to retrieve files from\n        :type dataset_id: int\n        :param glob: A regex used to select one or more files in the dataset\n        :type glob: str\n        :param is_dir: Whether or not the supplied pattern should be treated as a directory to search in\n        :type is_dir: bool\n        :param version_number: The version number of the dataset to retrieve files from\n        :type version_number: int\n        :return: A list of dataset files whose paths match the provided pattern.\n        :rtype: list of :class:`DatasetFile`", "docstring_tokens": ["Retrieves", "URLs", "for", "the", "files", "matched", "by", "a", "glob", "or", "a", "path", "to", "a", "directory", "in", "a", "given", "dataset", "."], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 259650}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L925-L949", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Adds a certificate to a hosted service.", "language": "python", "parameters": "(self, service_name, data, certificate_format,\n                                password=None)", "return_statement": "return self._perform_post(\n            '/' + self.subscription_id + '/services/hostedservices/' +\n            _str(service_name) + '/certificates',\n            _XmlSerializer.certificate_file_to_xml(\n                data, certificate_format, password),\n            as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'data'", ",", "arg_2", ")", "_validate_not_none", "(", "'certificate_format'", ",", "arg_3", ")", "_validate_not_none", "(", "'password'", ",", "arg_4", ")", "return", "arg_0", ".", "_perform_post", "(", "'/'", "+", "arg_0", ".", "subscription_id", "+", "'/services/hostedservices/'", "+", "_str", "(", "arg_1", ")", "+", "'/certificates'", ",", "_XmlSerializer", ".", "certificate_file_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                                arg_4=None):\n        '''\n        Adds a certificate to a hosted service.\n\n        service_name:\n            Name of the hosted service.\n        data:\n            The base-64 encoded form of the pfx/cer file.\n        certificate_format:\n            The service certificate format.\n        password:\n            The certificate password. Default to None when using cer format.\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('data', arg_2)\n        _validate_not_none('certificate_format', arg_3)\n        _validate_not_none('password', arg_4)\n\n        return arg_0._perform_post(\n            '/' + arg_0.subscription_id + '/services/hostedservices/' +\n            _str(arg_1) + '/certificates',\n            _XmlSerializer.certificate_file_to_xml(\n                arg_2, arg_3, arg_4),\n            as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.add_service_certificate", "docstring": "Adds a certificate to a hosted service.\n\n        service_name:\n            Name of the hosted service.\n        data:\n            The base-64 encoded form of the pfx/cer file.\n        certificate_format:\n            The service certificate format.\n        password:\n            The certificate password. Default to None when using cer format.", "docstring_tokens": ["Adds", "a", "certificate", "to", "a", "hosted", "service", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259651}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/auto_save.py#L118-L180", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Logic behind autosave under Travis CI.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"travis\"", "]", ":", "try", ":", "arg_1", "=", "PyFunceble", ".", "environ", "[", "\"TRAVIS_BUILD_DIR\"", "]", "arg_2", "=", "False", "try", ":", "arg_2", "=", "int", "(", "PyFunceble", ".", "time", "(", ")", ")", ">=", "int", "(", "PyFunceble", ".", "INTERN", "[", "\"start\"", "]", ")", "+", "(", "int", "(", "PyFunceble", ".", "CONFIGURATION", "[", "\"travis_autosave_minutes\"", "]", ")", "*", "60", ")", "except", "KeyError", ":", "if", "arg_0", ".", "last", "and", "not", "arg_0", ".", "bypass", ":", "raise", "Exception", "(", "\"Please review the way `ExecutionTime()` is called.\"", ")", "if", "arg_0", ".", "last", "or", "arg_2", "or", "arg_0", ".", "bypass", ":", "Percentage", "(", ")", ".", "log", "(", ")", "arg_0", ".", "travis_permissions", "(", ")", "arg_3", "=", "'git add --all && git commit -a -m \"%s\"'", "if", "arg_0", ".", "last", "or", "arg_0", ".", "bypass", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"command_before_end\"", "]", ":", "for", "arg_4", "in", "Command", "(", "PyFunceble", ".", "CONFIGURATION", "[", "\"command_before_end\"", "]", ")", ".", "run", "(", ")", ":", "sys_stdout", ".", "write", "(", "\"{}\\n\"", ".", "format", "(", "arg_4", ")", ")", "arg_0", ".", "travis_permissions", "(", ")", "arg_5", "=", "(", "PyFunceble", ".", "CONFIGURATION", "[", "\"travis_autosave_final_commit\"", "]", "+", "\" [ci skip]\"", ")", "Command", "(", "arg_3", "%", "arg_5", ")", ".", "execute", "(", ")", "else", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"command\"", "]", ":", "for", "arg_4", "in", "Command", "(", "PyFunceble", ".", "CONFIGURATION", "[", "\"command\"", "]", ")", ".", "run", "(", ")", ":", "sys_stdout", ".", "write", "(", "\"{}\\n\"", ".", "format", "(", "arg_4", ")", ")", "arg_0", ".", "travis_permissions", "(", ")", "Command", "(", "arg_3", "%", "PyFunceble", ".", "CONFIGURATION", "[", "\"travis_autosave_commit\"", "]", ")", ".", "execute", "(", ")", "print", "(", "Command", "(", "\"git push origin %s\"", "%", "PyFunceble", ".", "CONFIGURATION", "[", "\"travis_branch\"", "]", ")", ".", "execute", "(", ")", ")", "exit", "(", "0", ")", "except", "KeyError", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"\n        Logic behind autosave under Travis CI.\n        \"\"\"\n\n        if PyFunceble.CONFIGURATION[\"travis\"]:\n            try:\n                arg_1 = PyFunceble.environ[\"TRAVIS_BUILD_DIR\"]\n                arg_2 = False\n\n                try:\n                    arg_2 = int(PyFunceble.time()) >= int(\n                        PyFunceble.INTERN[\"start\"]\n                    ) + (int(PyFunceble.CONFIGURATION[\"travis_autosave_minutes\"]) * 60)\n                except KeyError:\n                    if arg_0.last and not arg_0.bypass:\n                        raise Exception(\n                            \"Please review the way `ExecutionTime()` is called.\"\n                        )\n\n                if arg_0.last or arg_2 or arg_0.bypass:\n                    Percentage().log()\n                    arg_0.travis_permissions()\n\n                    arg_3 = 'git add --all && git commit -a -m \"%s\"'\n\n                    if arg_0.last or arg_0.bypass:\n                        if PyFunceble.CONFIGURATION[\"command_before_end\"]:\n                            for arg_4 in Command(\n                                PyFunceble.CONFIGURATION[\"command_before_end\"]\n                            ).run():\n                                sys_stdout.write(\"{}\\n\".format(arg_4))\n\n                            arg_0.travis_permissions()\n\n                        arg_5 = (\n                            PyFunceble.CONFIGURATION[\"travis_autosave_final_commit\"]\n                            + \" [ci skip]\"\n                        )\n\n                        Command(arg_3 % arg_5).execute()\n                    else:\n                        if PyFunceble.CONFIGURATION[\"command\"]:\n                            for arg_4 in Command(\n                                PyFunceble.CONFIGURATION[\"command\"]\n                            ).run():\n                                sys_stdout.write(\"{}\\n\".format(arg_4))\n\n                            arg_0.travis_permissions()\n\n                        Command(\n                            arg_3 % PyFunceble.CONFIGURATION[\"travis_autosave_commit\"]\n                        ).execute()\n\n                    print(\n                        Command(\n                            \"git push origin %s\"\n                            % PyFunceble.CONFIGURATION[\"travis_branch\"]\n                        ).execute()\n                    )\n                    exit(0)\n            except KeyError:\n                pass", "path": "PyFunceble/auto_save.py", "identifier": "AutoSave._travis", "docstring": "Logic behind autosave under Travis CI.", "docstring_tokens": ["Logic", "behind", "autosave", "under", "Travis", "CI", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 259652}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/pandoc/convert.py#L44-L129", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Convert text from one markup format to another using pandoc.", "language": "python", "parameters": "(content, from_fmt, to_fmt, deparagraph=False, mathjax=False,\n                 smart=True, extra_args=None)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "True", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "logging", ".", "getLogger", "(", "__name__", ")", "if", "arg_6", "is", "not", "None", ":", "arg_6", "=", "list", "(", "arg_6", ")", "else", ":", "arg_6", "=", "[", "]", "if", "arg_4", ":", "arg_6", ".", "append", "(", "'--mathjax'", ")", "if", "arg_5", ":", "arg_6", ".", "append", "(", "'--smart'", ")", "if", "arg_3", ":", "arg_6", ".", "append", "(", "'--filter=lsstprojectmeta-deparagraph'", ")", "arg_6", ".", "append", "(", "'--wrap=none'", ")", "arg_6", "=", "set", "(", "arg_6", ")", "arg_7", ".", "debug", "(", "'Running pandoc from %s to %s with extra_args %s'", ",", "arg_1", ",", "arg_2", ",", "arg_6", ")", "arg_8", "=", "pypandoc", ".", "Func", "(", "arg_0", ",", "arg_2", ",", "format", "=", "arg_1", ",", "arg_6", "=", "arg_6", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=False,\n                 arg_5=True, arg_6=None):\n    \"\"\"Convert text from one markup format to another using pandoc.\n\n    This function is a thin wrapper around `pypandoc.Func`.\n\n    Parameters\n    ----------\n    content : `str`\n        Original content.\n\n    from_fmt : `str`\n        Format of the original ``content``. Format identifier must be one of\n        those known by Pandoc. See https://pandoc.org/MANUAL.html for details.\n\n    to_fmt : `str`\n        Output format for the content.\n\n    deparagraph : `bool`, optional\n        If `True`, then the\n        `lsstprojectmeta.pandoc.filters.deparagraph.deparagraph` filter is\n        used to remove paragraph (``<p>``, for example) tags around a single\n        paragraph of content. That filter does not affect content that\n        consists of multiple blocks (several paragraphs, or lists, for\n        example). Default is `False`.\n\n        For example, **without** this filter Pandoc will convert\n        the string ``\"Title text\"`` to ``\"<p>Title text</p>\"`` in HTML. The\n        paragraph tags aren't useful if you intend to wrap the converted\n        content in different tags, like ``<h1>``, using your own templating\n        system.\n\n        **With** this filter, Pandoc will convert the string ``\"Title text\"``\n        to ``\"Title text\"`` in HTML.\n\n    mathjax : `bool`, optional\n        If `True` then Pandoc will markup output content to work with MathJax.\n        Default is False.\n\n    smart : `bool`, optional\n        If `True` (default) then ascii characters will be converted to unicode\n        characters like smart quotes and em dashes.\n\n    extra_args : `list`, optional\n        Sequence of Pandoc arguments command line arguments (such as\n        ``'--normalize'``). The ``deparagraph``, ``mathjax``, and ``smart``\n        arguments are convenience arguments that are equivalent to items\n        in ``extra_args``.\n\n    Returns\n    -------\n    output : `str`\n        Content in the output (``to_fmt``) format.\n\n    Notes\n    -----\n    This function will automatically install Pandoc if it is not available.\n    See `ensure_pandoc`.\n    \"\"\"\n    arg_7 = logging.getLogger(__name__)\n\n    if arg_6 is not None:\n        arg_6 = list(arg_6)\n    else:\n        arg_6 = []\n\n    if arg_4:\n        arg_6.append('--mathjax')\n\n    if arg_5:\n        arg_6.append('--smart')\n\n    if arg_3:\n        arg_6.append('--filter=lsstprojectmeta-deparagraph')\n\n    arg_6.append('--wrap=none')\n\n    # de-dupe extra args\n    arg_6 = set(arg_6)\n\n    arg_7.debug('Running pandoc from %s to %s with extra_args %s',\n                 arg_1, arg_2, arg_6)\n\n    arg_8 = pypandoc.Func(arg_0, arg_2, format=arg_1,\n                                   arg_6=arg_6)\n    return arg_8", "path": "lsstprojectmeta/pandoc/convert.py", "identifier": "convert_text", "docstring": "Convert text from one markup format to another using pandoc.\n\n    This function is a thin wrapper around `pypandoc.convert_text`.\n\n    Parameters\n    ----------\n    content : `str`\n        Original content.\n\n    from_fmt : `str`\n        Format of the original ``content``. Format identifier must be one of\n        those known by Pandoc. See https://pandoc.org/MANUAL.html for details.\n\n    to_fmt : `str`\n        Output format for the content.\n\n    deparagraph : `bool`, optional\n        If `True`, then the\n        `lsstprojectmeta.pandoc.filters.deparagraph.deparagraph` filter is\n        used to remove paragraph (``<p>``, for example) tags around a single\n        paragraph of content. That filter does not affect content that\n        consists of multiple blocks (several paragraphs, or lists, for\n        example). Default is `False`.\n\n        For example, **without** this filter Pandoc will convert\n        the string ``\"Title text\"`` to ``\"<p>Title text</p>\"`` in HTML. The\n        paragraph tags aren't useful if you intend to wrap the converted\n        content in different tags, like ``<h1>``, using your own templating\n        system.\n\n        **With** this filter, Pandoc will convert the string ``\"Title text\"``\n        to ``\"Title text\"`` in HTML.\n\n    mathjax : `bool`, optional\n        If `True` then Pandoc will markup output content to work with MathJax.\n        Default is False.\n\n    smart : `bool`, optional\n        If `True` (default) then ascii characters will be converted to unicode\n        characters like smart quotes and em dashes.\n\n    extra_args : `list`, optional\n        Sequence of Pandoc arguments command line arguments (such as\n        ``'--normalize'``). The ``deparagraph``, ``mathjax``, and ``smart``\n        arguments are convenience arguments that are equivalent to items\n        in ``extra_args``.\n\n    Returns\n    -------\n    output : `str`\n        Content in the output (``to_fmt``) format.\n\n    Notes\n    -----\n    This function will automatically install Pandoc if it is not available.\n    See `ensure_pandoc`.", "docstring_tokens": ["Convert", "text", "from", "one", "markup", "format", "to", "another", "using", "pandoc", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 259653}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L408-L414", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Resets the builder's state to allow building new annotations.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "annotation_date_set", "=", "False", "arg_0", ".", "annotation_comment_set", "=", "False", "arg_0", ".", "annotation_type_set", "=", "False", "arg_0", ".", "annotation_spdx_id_set", "=", "False"], "function": "def Func(arg_0):\n        \"\"\"Resets the builder's state to allow building new annotations.\"\"\"\n        # FIXME: this state does not make sense\n        arg_0.annotation_date_set = False\n        arg_0.annotation_comment_set = False\n        arg_0.annotation_type_set = False\n        arg_0.annotation_spdx_id_set = False", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "AnnotationBuilder.reset_annotations", "docstring": "Resets the builder's state to allow building new annotations.", "docstring_tokens": ["Resets", "the", "builder", "s", "state", "to", "allow", "building", "new", "annotations", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 259654}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L720-L758", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Save the reply to an execute_request into our results.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'parent_header'", "]", "arg_3", "=", "arg_2", "[", "'msg_id'", "]", "if", "arg_3", "not", "in", "arg_0", ".", "outstanding", ":", "if", "arg_3", "in", "arg_0", ".", "history", ":", "print", "(", "\"got stale result: %s\"", "%", "arg_3", ")", "else", ":", "print", "(", "\"got unknown result: %s\"", "%", "arg_3", ")", "else", ":", "arg_0", ".", "outstanding", ".", "remove", "(", "arg_3", ")", "arg_4", "=", "arg_1", "[", "'content'", "]", "arg_5", "=", "arg_1", "[", "'header'", "]", "arg_6", "=", "arg_0", ".", "metadata", "[", "arg_3", "]", "arg_6", ".", "update", "(", "arg_0", ".", "_extract_metadata", "(", "arg_5", ",", "arg_2", ",", "arg_4", ")", ")", "arg_0", ".", "metadata", "[", "arg_3", "]", "=", "arg_6", "arg_8", "=", "arg_0", ".", "_outstanding_dict", "[", "arg_6", "[", "'engine_uuid'", "]", "]", "if", "arg_3", "in", "arg_8", ":", "arg_8", ".", "remove", "(", "arg_3", ")", "if", "arg_4", "[", "'status'", "]", "==", "'ok'", ":", "arg_0", ".", "results", "[", "arg_3", "]", "=", "ExecuteReply", "(", "arg_3", ",", "arg_4", ",", "arg_6", ")", "elif", "arg_4", "[", "'status'", "]", "==", "'aborted'", ":", "arg_0", ".", "results", "[", "arg_3", "]", "=", "error", ".", "TaskAborted", "(", "arg_3", ")", "elif", "arg_4", "[", "'status'", "]", "==", "'resubmitted'", ":", "pass", "else", ":", "arg_0", ".", "results", "[", "arg_3", "]", "=", "arg_0", ".", "_unwrap_exception", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Save the reply to an execute_request into our results.\n\n        execute messages are never actually used. apply is used instead.\n        \"\"\"\n\n        arg_2 = arg_1['parent_header']\n        arg_3 = arg_2['msg_id']\n        if arg_3 not in arg_0.outstanding:\n            if arg_3 in arg_0.history:\n                print (\"got stale result: %s\"%arg_3)\n            else:\n                print (\"got unknown result: %s\"%arg_3)\n        else:\n            arg_0.outstanding.remove(arg_3)\n\n        arg_4 = arg_1['content']\n        arg_5 = arg_1['header']\n\n        # construct metadata:\n        arg_6 = arg_0.metadata[arg_3]\n        arg_6.update(arg_0._extract_metadata(arg_5, arg_2, arg_4))\n        # is this redundant?\n        arg_0.metadata[arg_3] = arg_6\n        \n        arg_8 = arg_0._outstanding_dict[arg_6['engine_uuid']]\n        if arg_3 in arg_8:\n            arg_8.remove(arg_3)\n\n        # construct result:\n        if arg_4['status'] == 'ok':\n            arg_0.results[arg_3] = ExecuteReply(arg_3, arg_4, arg_6)\n        elif arg_4['status'] == 'aborted':\n            arg_0.results[arg_3] = error.TaskAborted(arg_3)\n        elif arg_4['status'] == 'resubmitted':\n            # TODO: handle resubmission\n            pass\n        else:\n            arg_0.results[arg_3] = arg_0._unwrap_exception(arg_4)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client._handle_execute_reply", "docstring": "Save the reply to an execute_request into our results.\n\n        execute messages are never actually used. apply is used instead.", "docstring_tokens": ["Save", "the", "reply", "to", "an", "execute_request", "into", "our", "results", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259655}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L278-L315", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Generate a set of simple and hub sequences. A simple sequence contains\n  a randomly chosen set of elements from 0 to 'nCoinc-1'. A hub sequence\n  always contains a hub element in the middle of it.", "language": "python", "parameters": "(nPatterns=10, patternLen=500, patternActivity=50,\n                    hubs=[2,6],  seqLength=[5,6,7],\n                    nSimpleSequences=50,  nHubSequences=50)", "return_statement": "return (seqList, patterns)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "10", ",", "arg_1", "=", "500", ",", "arg_2", "=", "50", ",", "arg_3", "=", "[", "2", ",", "6", "]", ",", "arg_4", "=", "[", "5", ",", "6", ",", "7", "]", ",", "arg_5", "=", "50", ",", "arg_6", "=", "50", ")", ":", "arg_7", "=", "generateCoincMatrix", "(", "nCoinc", "=", "arg_0", ",", "length", "=", "arg_1", ",", "activity", "=", "arg_2", ")", "arg_8", "=", "generateSimpleSequences", "(", "nCoinc", "=", "arg_0", ",", "arg_4", "=", "arg_4", ",", "nSeq", "=", "arg_5", ")", "+", "generateHubSequences", "(", "nCoinc", "=", "arg_0", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "nSeq", "=", "arg_6", ")", "return", "(", "arg_8", ",", "arg_7", ")"], "function": "def Func(arg_0=10, arg_1=500, arg_2=50,\n                    arg_3=[2,6],  arg_4=[5,6,7],\n                    arg_5=50,  arg_6=50):\n  \"\"\"\n  Generate a set of simple and hub sequences. A simple sequence contains\n  a randomly chosen set of elements from 0 to 'nCoinc-1'. A hub sequence\n  always contains a hub element in the middle of it.\n\n  Parameters:\n  -----------------------------------------------\n  nPatterns:        the number of patterns to use in the sequences.\n  patternLen:       The number of elements in each pattern\n  patternActivity:  The number of elements that should be active in\n                        each pattern\n  hubs:             which of the elements will be used as hubs.\n  seqLength:        a list of possible sequence lengths. The length of each\n                        sequence will be randomly chosen from here.\n  nSimpleSequences: The number of simple sequences to generate\n  nHubSequences:    The number of hub sequences to generate\n\n  retval:           (seqList, patterns)\n                    seqList: a list of sequences. Each sequence is itself a list\n                                  containing the input pattern indices for that sequence.\n                    patterns: the input patterns used in the seqList.\n  \"\"\"\n\n  # Create the input patterns\n  arg_7 = generateCoincMatrix(nCoinc=arg_0, length=arg_1,\n              activity=arg_2)\n\n  # Create the raw sequences\n  arg_8 =  generateSimpleSequences(nCoinc=arg_0, arg_4=arg_4,\n                                    nSeq=arg_5) + \\\n             generateHubSequences(nCoinc=arg_0, arg_3=arg_3, arg_4=arg_4,\n                                  nSeq=arg_6)\n\n  # Return results\n  return (arg_8, arg_7)", "path": "src/nupic/algorithms/fdrutilities.py", "identifier": "generateSequences", "docstring": "Generate a set of simple and hub sequences. A simple sequence contains\n  a randomly chosen set of elements from 0 to 'nCoinc-1'. A hub sequence\n  always contains a hub element in the middle of it.\n\n  Parameters:\n  -----------------------------------------------\n  nPatterns:        the number of patterns to use in the sequences.\n  patternLen:       The number of elements in each pattern\n  patternActivity:  The number of elements that should be active in\n                        each pattern\n  hubs:             which of the elements will be used as hubs.\n  seqLength:        a list of possible sequence lengths. The length of each\n                        sequence will be randomly chosen from here.\n  nSimpleSequences: The number of simple sequences to generate\n  nHubSequences:    The number of hub sequences to generate\n\n  retval:           (seqList, patterns)\n                    seqList: a list of sequences. Each sequence is itself a list\n                                  containing the input pattern indices for that sequence.\n                    patterns: the input patterns used in the seqList.", "docstring_tokens": ["Generate", "a", "set", "of", "simple", "and", "hub", "sequences", ".", "A", "simple", "sequence", "contains", "a", "randomly", "chosen", "set", "of", "elements", "from", "0", "to", "nCoinc", "-", "1", ".", "A", "hub", "sequence", "always", "contains", "a", "hub", "element", "in", "the", "middle", "of", "it", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259656}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L627-L641", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Set the value,bounds,free,errors based on corresponding kwargs", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "'bounds'", "in", "arg_1", ":", "arg_0", ".", "Func_bounds", "(", "arg_1", ".", "pop", "(", "'bounds'", ")", ")", "if", "'free'", "in", "arg_1", ":", "arg_0", ".", "Func_free", "(", "arg_1", ".", "pop", "(", "'free'", ")", ")", "if", "'errors'", "in", "arg_1", ":", "arg_0", ".", "Func_errors", "(", "arg_1", ".", "pop", "(", "'errors'", ")", ")", "if", "'value'", "in", "arg_1", ":", "arg_0", ".", "Func_value", "(", "arg_1", ".", "pop", "(", "'value'", ")", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Set the value,bounds,free,errors based on corresponding kwargs\n\n        The invokes hooks for type-checking and bounds-checking that\n        may be implemented by sub-classes.\n        \"\"\"\n        # Probably want to reFunc bounds if Func fails\n        if 'bounds' in arg_1:\n            arg_0.Func_bounds(arg_1.pop('bounds'))\n        if 'free' in arg_1:\n            arg_0.Func_free(arg_1.pop('free'))\n        if 'errors' in arg_1:\n            arg_0.Func_errors(arg_1.pop('errors'))\n        if 'value' in arg_1:\n            arg_0.Func_value(arg_1.pop('value'))", "path": "pymodeler/parameter.py", "identifier": "Parameter.set", "docstring": "Set the value,bounds,free,errors based on corresponding kwargs\n\n        The invokes hooks for type-checking and bounds-checking that\n        may be implemented by sub-classes.", "docstring_tokens": ["Set", "the", "value", "bounds", "free", "errors", "based", "on", "corresponding", "kwargs"], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 259657}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/KnittingPattern.py#L58-L65", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Add a new row to the pattern.", "language": "python", "parameters": "(self, id_)", "return_statement": "return row", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_parser", ".", "new_row", "(", "arg_1", ")", "arg_0", ".", "_rows", ".", "append", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add a new row to the pattern.\n\n        :param id_: the id of the row\n        \"\"\"\n        arg_2 = arg_0._parser.new_row(arg_1)\n        arg_0._rows.append(arg_2)\n        return arg_2", "path": "knittingpattern/KnittingPattern.py", "identifier": "KnittingPattern.add_row", "docstring": "Add a new row to the pattern.\n\n        :param id_: the id of the row", "docstring_tokens": ["Add", "a", "new", "row", "to", "the", "pattern", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 259658}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/deleteriousness.py#L2-L16", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Check if the cadd phred score is annotated", "language": "python", "parameters": "(variant, transcripts)", "return_statement": "return cadd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "arg_3", "=", "[", "'CADD'", ",", "'CADD_PHRED'", "]", "for", "arg_4", "in", "arg_3", ":", "arg_2", "=", "arg_0", ".", "INFO", ".", "get", "(", "arg_4", ",", "0", ")", "if", "arg_2", ":", "return", "float", "(", "arg_2", ")", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "arg_5", ".", "get", "(", "'cadd'", ")", "if", "(", "arg_6", "and", "arg_6", ">", "arg_2", ")", ":", "arg_2", "=", "arg_6", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Check if the cadd phred score is annotated\"\"\"\n    arg_2 = 0\n    arg_3 = ['CADD', 'CADD_PHRED']\n    for arg_4 in arg_3:\n        arg_2 = arg_0.INFO.get(arg_4, 0)\n        if arg_2:\n            return float(arg_2)\n    \n    for arg_5 in arg_1:\n        arg_6 = arg_5.get('cadd')\n        if (arg_6 and arg_6 > arg_2):\n            arg_2 = arg_6\n    \n    return arg_2", "path": "scout/parse/variant/deleteriousness.py", "identifier": "parse_cadd", "docstring": "Check if the cadd phred score is annotated", "docstring_tokens": ["Check", "if", "the", "cadd", "phred", "score", "is", "annotated"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259659}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py#L771-L796", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Process lines when they start with %%, which marks cell magics.", "language": "python", "parameters": "(self, lines)", "return_statement": "return self._is_complete", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "processing_cell_magic", "=", "True", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_1", ".", "partition", "(", "'\\n'", ")", "arg_6", ",", "arg_4", ",", "arg_7", "=", "arg_3", ".", "partition", "(", "' '", ")", "arg_6", "=", "arg_6", ".", "lstrip", "(", "ESC_MAGIC", ")", "arg_0", ".", "cell_magic_parts", "=", "[", "arg_5", "]", "arg_9", "=", "'get_ipython()._run_cached_cell_magic(%r, %r)'", "arg_10", "=", "arg_9", "%", "(", "arg_6", ",", "arg_7", ")", "arg_0", ".", "_store", "(", "arg_10", ")", "arg_0", ".", "_store", "(", "arg_1", ",", "arg_0", ".", "_buffer_raw", ",", "'source_raw'", ")", "arg_0", ".", "_is_complete", "=", "last_blank", "(", "arg_1", ")", "return", "arg_0", ".", "_is_complete"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process lines when they start with %%, which marks cell magics.\n        \"\"\"\n        arg_0.processing_cell_magic = True\n        arg_3, arg_4, arg_5 = arg_1.partition('\\n')\n        arg_6, arg_4, arg_7 = arg_3.partition(' ')\n        arg_6 = arg_6.lstrip(ESC_MAGIC)\n        # We store the body of the cell and create a call to a method that\n        # will use this stored value. This is ugly, but it's a first cut to\n        # get it all working, as right now changing the return API of our\n        # methods would require major refactoring.\n        arg_0.cell_magic_parts = [arg_5]\n        arg_9 = 'get_ipython()._run_cached_cell_magic(%r, %r)'\n        arg_10 = arg_9 % (arg_6, arg_7)\n        arg_0._store(arg_10)\n        arg_0._store(arg_1, arg_0._buffer_raw, 'source_raw')\n        # We can actually choose whether to allow for single blank lines here\n        # during input for clients that use cell mode to decide when to stop\n        # pushing input (currently only the Qt console).\n        # My first implementation did that, and then I realized it wasn't\n        # consistent with the terminal behavior, so I've reverted it to one\n        # line.  But I'm leaving it here so we can easily test both behaviors,\n        # I kind of liked having full blank lines allowed in the cell magics...\n        #self._is_complete = last_two_blanks(lines)\n        arg_0._is_complete = last_blank(arg_1)\n        return arg_0._is_complete", "path": "environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py", "identifier": "IPythonInputSplitter._handle_cell_magic", "docstring": "Process lines when they start with %%, which marks cell magics.", "docstring_tokens": ["Process", "lines", "when", "they", "start", "with", "%%", "which", "marks", "cell", "magics", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259660}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/beat.py#L417-L459", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Core dynamic program for beat tracking", "language": "python", "parameters": "(localscore, period, tightness)", "return_statement": "return backlink, cumscore", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "np", ".", "zeros_like", "(", "arg_0", ",", "dtype", "=", "int", ")", "arg_4", "=", "np", ".", "zeros_like", "(", "arg_0", ")", "arg_5", "=", "np", ".", "arange", "(", "-", "2", "*", "arg_1", ",", "-", "np", ".", "round", "(", "arg_1", "/", "2", ")", "+", "1", ",", "dtype", "=", "int", ")", "if", "arg_2", "<=", "0", ":", "raise", "ParameterError", "(", "'tightness must be strictly positive'", ")", "arg_6", "=", "-", "arg_2", "*", "(", "np", ".", "log", "(", "-", "arg_5", "/", "arg_1", ")", "**", "2", ")", "arg_7", "=", "True", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_0", ")", ":", "arg_10", "=", "np", ".", "maximum", "(", "0", ",", "min", "(", "-", "arg_5", "[", "0", "]", ",", "len", "(", "arg_5", ")", ")", ")", "arg_11", "=", "arg_6", ".", "copy", "(", ")", "arg_11", "[", "arg_10", ":", "]", "=", "arg_11", "[", "arg_10", ":", "]", "+", "arg_4", "[", "arg_5", "[", "arg_10", ":", "]", "]", "arg_12", "=", "np", ".", "argmax", "(", "arg_11", ")", "arg_4", "[", "arg_8", "]", "=", "arg_9", "+", "arg_11", "[", "arg_12", "]", "if", "arg_7", "and", "arg_9", "<", "0.01", "*", "arg_0", ".", "max", "(", ")", ":", "arg_3", "[", "arg_8", "]", "=", "-", "1", "else", ":", "arg_3", "[", "arg_8", "]", "=", "arg_5", "[", "arg_12", "]", "arg_7", "=", "False", "arg_5", "=", "arg_5", "+", "1", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Core dynamic program for beat tracking\"\"\"\n\n    arg_3 = np.zeros_like(arg_0, dtype=int)\n    arg_4 = np.zeros_like(arg_0)\n\n    # Search range for previous beat\n    arg_5 = np.arange(-2 * arg_1, -np.round(arg_1 / 2) + 1, dtype=int)\n\n    # Make a score window, which begins biased toward start_bpm and skewed\n    if arg_2 <= 0:\n        raise ParameterError('tightness must be strictly positive')\n\n    arg_6 = -arg_2 * (np.log(-arg_5 / arg_1) ** 2)\n\n    # Are we on the first beat?\n    arg_7 = True\n    for arg_8, arg_9 in enumerate(arg_0):\n\n        # Are we reaching back before time 0?\n        arg_10 = np.maximum(0, min(- arg_5[0], len(arg_5)))\n\n        # Search over all possible predecessors\n        arg_11 = arg_6.copy()\n        arg_11[arg_10:] = arg_11[arg_10:] + arg_4[arg_5[arg_10:]]\n\n        # Find the best preceding beat\n        arg_12 = np.argmax(arg_11)\n\n        # Add the local score\n        arg_4[arg_8] = arg_9 + arg_11[arg_12]\n\n        # Special case the first onset.  Stop if the localscore is small\n        if arg_7 and arg_9 < 0.01 * arg_0.max():\n            arg_3[arg_8] = -1\n        else:\n            arg_3[arg_8] = arg_5[arg_12]\n            arg_7 = False\n\n        # Update the time range\n        arg_5 = arg_5 + 1\n\n    return arg_3, arg_4", "path": "librosa/beat.py", "identifier": "__beat_track_dp", "docstring": "Core dynamic program for beat tracking", "docstring_tokens": ["Core", "dynamic", "program", "for", "beat", "tracking"], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 259661}
{"url": "https://github.com/imgix/imgix-python/blob/117e0b169552695232689dd0443be7810263e5c5/imgix/urlbuilder.py#L95-L141", "sha": "117e0b169552695232689dd0443be7810263e5c5", "docstring_summary": "Create URL with supplied path and `opts` parameters dict.", "language": "python", "parameters": "(self, path, params={}, opts={})", "return_statement": "return str(url_obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "{", "}", ")", ":", "if", "arg_3", ":", "warnings", ".", "warn", "(", "'`opts` has been deprecated. Use `params` instead.'", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "arg_2", "=", "arg_2", "or", "arg_3", "if", "arg_0", ".", "_shard_strategy", "==", "SHARD_STRATEGY_CRC", ":", "arg_4", "=", "zlib", ".", "crc32", "(", "arg_1", ".", "encode", "(", "'utf-8'", ")", ")", "&", "0xffffffff", "arg_5", "=", "arg_4", "%", "len", "(", "arg_0", ".", "_domains", ")", "arg_6", "=", "arg_0", ".", "_domains", "[", "arg_5", "]", "elif", "arg_0", ".", "_shard_strategy", "==", "SHARD_STRATEGY_CYCLE", ":", "arg_6", "=", "arg_0", ".", "_domains", "[", "arg_0", ".", "_shard_next_index", "]", "arg_0", ".", "_shard_next_index", "=", "(", "arg_0", ".", "_shard_next_index", "+", "1", ")", "%", "len", "(", "arg_0", ".", "_domains", ")", "else", ":", "arg_6", "=", "arg_0", ".", "_domains", "[", "0", "]", "arg_8", "=", "\"https\"", "if", "arg_0", ".", "_use_https", "else", "\"http\"", "arg_9", "=", "UrlHelper", "(", "arg_6", ",", "arg_1", ",", "arg_8", ",", "sign_key", "=", "arg_0", ".", "_sign_key", ",", "include_library_param", "=", "arg_0", ".", "_include_library_param", ",", "arg_2", "=", "arg_2", ")", "return", "str", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2={}, arg_3={}):\n        \"\"\"\n        Create URL with supplied path and `opts` parameters dict.\n\n        Parameters\n        ----------\n        path : str\n        opts : dict\n            Dictionary specifying URL parameters. Non-imgix parameters are\n            added to the URL unprocessed. For a complete list of imgix\n            supported parameters, visit https://docs.imgix.com/apis/url .\n            (default {})\n\n        Returns\n        -------\n        str\n            imgix URL\n        \"\"\"\n\n        if arg_3:\n            warnings.warn('`opts` has been deprecated. Use `params` instead.',\n                          DeprecationWarning, stacklevel=2)\n        arg_2 = arg_2 or arg_3\n        if arg_0._shard_strategy == SHARD_STRATEGY_CRC:\n            arg_4 = zlib.crc32(arg_1.encode('utf-8')) & 0xffffffff\n            arg_5 = arg_4 % len(arg_0._domains)  # Deterministically choose domain\n            arg_6 = arg_0._domains[arg_5]\n\n        elif arg_0._shard_strategy == SHARD_STRATEGY_CYCLE:\n            arg_6 = arg_0._domains[arg_0._shard_next_index]\n            arg_0._shard_next_index = (\n                arg_0._shard_next_index + 1) % len(arg_0._domains)\n\n        else:\n            arg_6 = arg_0._domains[0]\n\n        arg_8 = \"https\" if arg_0._use_https else \"http\"\n\n        arg_9 = UrlHelper(\n            arg_6,\n            arg_1,\n            arg_8,\n            sign_key=arg_0._sign_key,\n            include_library_param=arg_0._include_library_param,\n            arg_2=arg_2)\n\n        return str(arg_9)", "path": "imgix/urlbuilder.py", "identifier": "UrlBuilder.create_url", "docstring": "Create URL with supplied path and `opts` parameters dict.\n\n        Parameters\n        ----------\n        path : str\n        opts : dict\n            Dictionary specifying URL parameters. Non-imgix parameters are\n            added to the URL unprocessed. For a complete list of imgix\n            supported parameters, visit https://docs.imgix.com/apis/url .\n            (default {})\n\n        Returns\n        -------\n        str\n            imgix URL", "docstring_tokens": ["Create", "URL", "with", "supplied", "path", "and", "opts", "parameters", "dict", "."], "nwo": "imgix/imgix-python", "score": 0.28781825117222404, "idx": 259662}
{"url": "https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/misc_util.py#L123-L134", "sha": "3301089b48c42b87b396e246ea3f56fa4bfc9678", "docstring_summary": "Update the estimate.", "language": "python", "parameters": "(self, new_val)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_value", "is", "None", ":", "arg_0", ".", "_value", "=", "arg_1", "else", ":", "arg_0", ".", "_value", "=", "arg_0", ".", "_gamma", "*", "arg_0", ".", "_value", "+", "(", "1.0", "-", "arg_0", ".", "_gamma", ")", "*", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update the estimate.\n\n        Parameters\n        ----------\n        new_val: float\n            new observated value of estimated quantity.\n        \"\"\"\n        if arg_0._value is None:\n            arg_0._value = arg_1\n        else:\n            arg_0._value = arg_0._gamma * arg_0._value + (1.0 - arg_0._gamma) * arg_1", "path": "baselines/common/misc_util.py", "identifier": "RunningAvg.update", "docstring": "Update the estimate.\n\n        Parameters\n        ----------\n        new_val: float\n            new observated value of estimated quantity.", "docstring_tokens": ["Update", "the", "estimate", "."], "nwo": "openai/baselines", "score": 0.9951844133507725, "idx": 259663}
{"url": "https://github.com/soimort/you-get/blob/b746ac01c9f39de94cac2d56f665285b0523b974/src/you_get/common.py#L415-L454", "sha": "b746ac01c9f39de94cac2d56f665285b0523b974", "docstring_summary": "Gets the content of a URL via sending a HTTP GET request.", "language": "python", "parameters": "(url, headers={}, decoded=True)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ",", "arg_2", "=", "True", ")", ":", "logging", ".", "debug", "(", "'Func: %s'", "%", "arg_0", ")", "arg_3", "=", "request", ".", "Request", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "if", "cookies", ":", "cookies", ".", "add_cookie_header", "(", "arg_3", ")", "arg_3", ".", "headers", ".", "update", "(", "arg_3", ".", "unredirected_hdrs", ")", "arg_4", "=", "urlopen_with_retry", "(", "arg_3", ")", "arg_5", "=", "arg_4", ".", "read", "(", ")", "arg_6", "=", "arg_4", ".", "getheader", "(", "'Content-Encoding'", ")", "if", "arg_6", "==", "'gzip'", ":", "arg_5", "=", "ungzip", "(", "arg_5", ")", "elif", "arg_6", "==", "'deflate'", ":", "arg_5", "=", "undeflate", "(", "arg_5", ")", "if", "arg_2", ":", "arg_7", "=", "match1", "(", "arg_4", ".", "getheader", "(", "'Content-Type'", ",", "''", ")", ",", "r'charset=([\\w-]+)'", ")", "if", "arg_7", "is", "not", "None", ":", "arg_5", "=", "arg_5", ".", "decode", "(", "arg_7", ",", "'ignore'", ")", "else", ":", "arg_5", "=", "arg_5", ".", "decode", "(", "'utf-8'", ",", "'ignore'", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1={}, arg_2=True):\n    \"\"\"Gets the content of a URL via sending a HTTP GET request.\n\n    Args:\n        url: A URL.\n        headers: Request headers used by the client.\n        decoded: Whether decode the response body using UTF-8 or the charset specified in Content-Type.\n\n    Returns:\n        The content as a string.\n    \"\"\"\n\n    logging.debug('Func: %s' % arg_0)\n\n    arg_3 = request.Request(arg_0, arg_1=arg_1)\n    if cookies:\n        cookies.add_cookie_header(arg_3)\n        arg_3.headers.update(arg_3.unredirected_hdrs)\n\n    arg_4 = urlopen_with_retry(arg_3)\n    arg_5 = arg_4.read()\n\n    # Handle HTTP compression for gzip and deflate (zlib)\n    arg_6 = arg_4.getheader('Content-Encoding')\n    if arg_6 == 'gzip':\n        arg_5 = ungzip(arg_5)\n    elif arg_6 == 'deflate':\n        arg_5 = undeflate(arg_5)\n\n    # Decode the response body\n    if arg_2:\n        arg_7 = match1(\n            arg_4.getheader('Content-Type', ''), r'charset=([\\w-]+)'\n        )\n        if arg_7 is not None:\n            arg_5 = arg_5.decode(arg_7, 'ignore')\n        else:\n            arg_5 = arg_5.decode('utf-8', 'ignore')\n\n    return arg_5", "path": "src/you_get/common.py", "identifier": "get_content", "docstring": "Gets the content of a URL via sending a HTTP GET request.\n\n    Args:\n        url: A URL.\n        headers: Request headers used by the client.\n        decoded: Whether decode the response body using UTF-8 or the charset specified in Content-Type.\n\n    Returns:\n        The content as a string.", "docstring_tokens": ["Gets", "the", "content", "of", "a", "URL", "via", "sending", "a", "HTTP", "GET", "request", "."], "nwo": "soimort/you-get", "score": 0.9997601519430084, "idx": 259664}
{"url": "https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/package.py#L489-L495", "sha": "aca085ea54541b087140b58a81332f8728baeeb2", "docstring_summary": "Slugify foreign key", "language": "python", "parameters": "(schema)", "return_statement": "return schema", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "get", "(", "'foreignKeys'", ",", "[", "]", ")", ":", "arg_1", "[", "'reference'", "]", "[", "'resource'", "]", "=", "_slugify_resource_name", "(", "arg_1", "[", "'reference'", "]", ".", "get", "(", "'resource'", ",", "''", ")", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Slugify foreign key\n    \"\"\"\n    for arg_1 in arg_0.get('foreignKeys', []):\n        arg_1['reference']['resource'] = _slugify_resource_name(\n            arg_1['reference'].get('resource', ''))\n    return arg_0", "path": "datapackage/package.py", "identifier": "_slugify_foreign_key", "docstring": "Slugify foreign key", "docstring_tokens": ["Slugify", "foreign", "key"], "nwo": "frictionlessdata/datapackage-py", "score": 0.5653088377587532, "idx": 259665}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py#L81-L93", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Start a new kernel.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return kernel_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "unicode", "(", "uuid", ".", "uuid4", "(", ")", ")", "arg_3", "=", "arg_0", ".", "kernel_manager_factory", "(", "connection_file", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "connection_dir", ",", "\"kernel-%s.json\"", "%", "arg_2", ")", ",", "config", "=", "arg_0", ".", "config", ",", ")", "arg_3", ".", "Func", "(", "**", "arg_1", ")", "arg_3", ".", "start_channels", "(", "shell", "=", "True", ",", "sub", "=", "False", ",", "stdin", "=", "False", ",", "hb", "=", "False", ")", "arg_0", ".", "_kernels", "[", "arg_2", "]", "=", "arg_3", "return", "arg_2"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Start a new kernel.\"\"\"\n        arg_2 = unicode(uuid.uuid4())\n        # use base KernelManager for each Kernel\n        arg_3 = arg_0.kernel_manager_factory(connection_file=os.path.join(\n                    arg_0.connection_dir, \"kernel-%s.json\" % arg_2),\n                    config=arg_0.config,\n        )\n        arg_3.Func(**arg_1)\n        # start just the shell channel, needed for graceful restart\n        arg_3.start_channels(shell=True, sub=False, stdin=False, hb=False)\n        arg_0._kernels[arg_2] = arg_3\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py", "identifier": "MultiKernelManager.start_kernel", "docstring": "Start a new kernel.", "docstring_tokens": ["Start", "a", "new", "kernel", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259666}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L126-L138", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Create Label object from JSON object", "language": "python", "parameters": "(self, label_json)", "return_statement": "return trolly.label.Label(\n            trello_client=self,\n            label_id=label_json['id'],\n            name=label_json['name'],\n            data=label_json,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "trolly", ".", "label", ".", "Label", "(", "trello_client", "=", "arg_0", ",", "label_id", "=", "arg_1", "[", "'id'", "]", ",", "name", "=", "arg_1", "[", "'name'", "]", ",", "data", "=", "arg_1", ",", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Create Label object from JSON object\n\n        Returns:\n            Label: The label from the given `label_json`.\n        '''\n        return trolly.label.Label(\n            trello_client=arg_0,\n            label_id=arg_1['id'],\n            name=arg_1['name'],\n            data=arg_1,\n        )", "path": "trolly/client.py", "identifier": "Client.create_label", "docstring": "Create Label object from JSON object\n\n        Returns:\n            Label: The label from the given `label_json`.", "docstring_tokens": ["Create", "Label", "object", "from", "JSON", "object"], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 259667}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L152-L169", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Get the current exception info as `Traceback` object.  Per default\n    calling this method will reraise system exceptions such as generator exit,\n    system exit or others.  This behavior can be disabled by passing `False`\n    to the function as first parameter.", "language": "python", "parameters": "(ignore_system_exceptions=False,\n                          show_hidden_frames=False, skip=0)", "return_statement": "return tb", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ",", "arg_1", "=", "False", ",", "arg_2", "=", "0", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "sys", ".", "exc_info", "(", ")", "if", "arg_0", "and", "arg_3", "in", "system_exceptions", ":", "raise", "for", "arg_6", "in", "range_type", "(", "arg_2", ")", ":", "if", "arg_5", ".", "tb_next", "is", "None", ":", "break", "arg_5", "=", "arg_5", ".", "tb_next", "arg_5", "=", "Traceback", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", "if", "not", "arg_1", ":", "arg_5", ".", "filter_hidden_frames", "(", ")", "return", "arg_5"], "function": "def Func(arg_0=False,\n                          arg_1=False, arg_2=0):\n    \"\"\"Get the current exception info as `Traceback` object.  Per default\n    calling this method will reraise system exceptions such as generator exit,\n    system exit or others.  This behavior can be disabled by passing `False`\n    to the function as first parameter.\n    \"\"\"\n    arg_3, arg_4, arg_5 = sys.exc_info()\n    if arg_0 and arg_3 in system_exceptions:\n        raise\n    for arg_6 in range_type(arg_2):\n        if arg_5.tb_next is None:\n            break\n        arg_5 = arg_5.tb_next\n    arg_5 = Traceback(arg_3, arg_4, arg_5)\n    if not arg_1:\n        arg_5.filter_hidden_frames()\n    return arg_5", "path": "capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py", "identifier": "get_current_traceback", "docstring": "Get the current exception info as `Traceback` object.  Per default\n    calling this method will reraise system exceptions such as generator exit,\n    system exit or others.  This behavior can be disabled by passing `False`\n    to the function as first parameter.", "docstring_tokens": ["Get", "the", "current", "exception", "info", "as", "Traceback", "object", ".", "Per", "default", "calling", "this", "method", "will", "reraise", "system", "exceptions", "such", "as", "generator", "exit", "system", "exit", "or", "others", ".", "This", "behavior", "can", "be", "disabled", "by", "passing", "False", "to", "the", "function", "as", "first", "parameter", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 259668}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L479-L485", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return '' if first occurrence of the key otherwise return `line`.", "language": "python", "parameters": "(line, message, line_number, marked_line_numbers,\n                         source, previous_line='')", "return_statement": "return line", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "''", ")", ":", "if", "arg_3", "and", "arg_2", "==", "sorted", "(", "arg_3", ")", "[", "0", "]", ":", "return", "''", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                         arg_4, arg_5=''):\n    \"\"\"Return '' if first occurrence of the key otherwise return `line`.\"\"\"\n    if arg_3 and arg_2 == sorted(arg_3)[0]:\n        return ''\n\n    return arg_0", "path": "autoflake.py", "identifier": "filter_duplicate_key", "docstring": "Return '' if first occurrence of the key otherwise return `line`.", "docstring_tokens": ["Return", "if", "first", "occurrence", "of", "the", "key", "otherwise", "return", "line", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 259669}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_colors.py#L17-L66", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Highlights a block of text using ANSI tags based on language syntax.", "language": "python", "parameters": "(text, lexer_name='python', **kwargs)", "return_statement": "return new_text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'python'", ",", "**", "arg_2", ")", ":", "arg_1", "=", "{", "'py'", ":", "'python'", ",", "'h'", ":", "'cpp'", ",", "'cpp'", ":", "'cpp'", ",", "'cxx'", ":", "'cpp'", ",", "'c'", ":", "'cpp'", ",", "}", ".", "get", "(", "arg_1", ".", "replace", "(", "'.'", ",", "''", ")", ",", "arg_1", ")", "try", ":", "import", "pygments", "import", "pygments", ".", "lexers", "import", "pygments", ".", "formatters", "import", "pygments", ".", "formatters", ".", "terminal", "if", "sys", ".", "platform", ".", "startswith", "(", "'win32'", ")", ":", "import", "colorama", "colorama", ".", "init", "(", ")", "arg_3", "=", "pygments", ".", "formatters", ".", "terminal", ".", "TerminalFormatter", "(", "bg", "=", "'dark'", ")", "arg_4", "=", "pygments", ".", "lexers", ".", "get_lexer_by_name", "(", "arg_1", ",", "**", "arg_2", ")", "arg_5", "=", "pygments", ".", "highlight", "(", "arg_0", ",", "arg_4", ",", "arg_3", ")", "except", "ImportError", ":", "import", "warnings", "warnings", ".", "warn", "(", "'pygments is not installed, code will not be highlighted'", ")", "arg_5", "=", "arg_0", "return", "arg_5"], "function": "def Func(arg_0, arg_1='python', **arg_2):\n    \"\"\"\n    Highlights a block of text using ANSI tags based on language syntax.\n\n    Args:\n        text (str): plain text to highlight\n        lexer_name (str): name of language\n        **kwargs: passed to pygments.lexers.get_lexer_by_name\n\n    Returns:\n        str: text : highlighted text\n            If pygments is not installed, the plain text is returned.\n\n    CommandLine:\n        python -c \"import pygments.formatters; print(list(pygments.formatters.get_all_formatters()))\"\n\n    Example:\n        >>> import ubelt as ub\n        >>> text = 'import ubelt as ub; print(ub)'\n        >>> new_text = ub.Func(text)\n        >>> print(new_text)\n    \"\"\"\n    # Resolve extensions to languages\n    arg_1 = {\n        'py': 'python',\n        'h': 'cpp',\n        'cpp': 'cpp',\n        'cxx': 'cpp',\n        'c': 'cpp',\n    }.get(arg_1.replace('.', ''), arg_1)\n    try:\n        import pygments\n        import pygments.lexers\n        import pygments.formatters\n        import pygments.formatters.terminal\n\n        if sys.platform.startswith('win32'):  # nocover\n            # Hack on win32 to support colored output\n            import colorama\n            colorama.init()\n\n        arg_3 = pygments.formatters.terminal.TerminalFormatter(bg='dark')\n        arg_4 = pygments.lexers.get_lexer_by_name(arg_1, **arg_2)\n        arg_5 = pygments.highlight(arg_0, arg_4, arg_3)\n\n    except ImportError:  # nocover\n        import warnings\n        warnings.warn('pygments is not installed, code will not be highlighted')\n        arg_5 = arg_0\n    return arg_5", "path": "ubelt/util_colors.py", "identifier": "highlight_code", "docstring": "Highlights a block of text using ANSI tags based on language syntax.\n\n    Args:\n        text (str): plain text to highlight\n        lexer_name (str): name of language\n        **kwargs: passed to pygments.lexers.get_lexer_by_name\n\n    Returns:\n        str: text : highlighted text\n            If pygments is not installed, the plain text is returned.\n\n    CommandLine:\n        python -c \"import pygments.formatters; print(list(pygments.formatters.get_all_formatters()))\"\n\n    Example:\n        >>> import ubelt as ub\n        >>> text = 'import ubelt as ub; print(ub)'\n        >>> new_text = ub.highlight_code(text)\n        >>> print(new_text)", "docstring_tokens": ["Highlights", "a", "block", "of", "text", "using", "ANSI", "tags", "based", "on", "language", "syntax", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 259670}
{"url": "https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L320-L335", "sha": "409984fc65ce101a620f069263f155303492465c", "docstring_summary": "Kills an in progress experimental design run", "language": "python", "parameters": "(self, data_view_id, run_uuid)", "return_statement": "return response[\"data\"][\"uid\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "routes", ".", "kill_data_view_design_run", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_delete", "(", "arg_3", ")", ".", "json", "(", ")", "return", "arg_4", "[", "\"data\"", "]", "[", "\"uid\"", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Kills an in progress experimental design run\n\n        :param data_view_id: The ID number of the data view to which the\n            run belongs, as a string\n        :type data_view_id: str\n        :param run_uuid: The UUID of the design run to kill\n        :type run_uuid: str\n        :return: The UUID of the design run\n        \"\"\"\n\n        arg_3 = routes.kill_data_view_design_run(arg_1, arg_2)\n\n        arg_4 = arg_0._delete(arg_3).json()\n        return arg_4[\"data\"][\"uid\"]", "path": "citrination_client/models/client.py", "identifier": "ModelsClient.kill_design_run", "docstring": "Kills an in progress experimental design run\n\n        :param data_view_id: The ID number of the data view to which the\n            run belongs, as a string\n        :type data_view_id: str\n        :param run_uuid: The UUID of the design run to kill\n        :type run_uuid: str\n        :return: The UUID of the design run", "docstring_tokens": ["Kills", "an", "in", "progress", "experimental", "design", "run"], "nwo": "CitrineInformatics/python-citrination-client", "score": 0.5565319482662541, "idx": 259671}
{"url": "https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/backends/openwisp/openwisp.py#L42-L76", "sha": "c23ce9732720856e2f6dc54060db71a8182c7d4b", "docstring_summary": "returns the template context for install.sh and uninstall.sh", "language": "python", "parameters": "(self)", "return_statement": "return dict(hostname=config['general']['hostname'],  # hostname is required\n                    l2vpn=l2vpn,\n                    bridges=bridges,\n                    radios=config.get('radios', []),  # radios might be empty\n                    cron=cron)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "config", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "config", ".", "get", "(", "'openvpn'", ",", "[", "]", ")", ":", "if", "arg_3", ".", "get", "(", "'dev_type'", ")", "!=", "'tap'", ":", "continue", "arg_4", "=", "arg_3", ".", "copy", "(", ")", "arg_2", ".", "append", "(", "arg_4", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_0", ".", "config", ".", "get", "(", "'interfaces'", ",", "[", "]", ")", ":", "if", "arg_6", "[", "'type'", "]", "!=", "'bridge'", ":", "continue", "arg_7", "=", "arg_6", ".", "copy", "(", ")", "if", "arg_7", ".", "get", "(", "'addresses'", ")", ":", "arg_7", "[", "'proto'", "]", "=", "arg_6", "[", "'addresses'", "]", "[", "0", "]", ".", "get", "(", "'proto'", ")", "arg_7", "[", "'ip'", "]", "=", "arg_6", "[", "'addresses'", "]", "[", "0", "]", ".", "get", "(", "'address'", ")", "arg_5", ".", "append", "(", "arg_7", ")", "arg_8", "=", "False", "for", "arg_9", "in", "arg_1", ".", "get", "(", "'files'", ",", "[", "]", ")", ":", "arg_10", "=", "arg_9", "[", "'path'", "]", "if", "arg_10", ".", "startswith", "(", "'/crontabs'", ")", "or", "arg_10", ".", "startswith", "(", "'crontabs'", ")", ":", "arg_8", "=", "True", "break", "return", "dict", "(", "hostname", "=", "arg_1", "[", "'general'", "]", "[", "'hostname'", "]", ",", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", "radios", "=", "arg_1", ".", "get", "(", "'radios'", ",", "[", "]", ")", ",", "arg_8", "=", "arg_8", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        returns the template context for install.sh and uninstall.sh\n        \"\"\"\n        arg_1 = arg_0.config\n        # layer2 VPN list\n        arg_2 = []\n        for arg_3 in arg_0.config.get('openvpn', []):\n            if arg_3.get('dev_type') != 'tap':\n                continue\n            arg_4 = arg_3.copy()\n            arg_2.append(arg_4)\n        # bridge list\n        arg_5 = []\n        for arg_6 in arg_0.config.get('interfaces', []):\n            if arg_6['type'] != 'bridge':\n                continue\n            arg_7 = arg_6.copy()\n            if arg_7.get('addresses'):\n                arg_7['proto'] = arg_6['addresses'][0].get('proto')\n                arg_7['ip'] = arg_6['addresses'][0].get('address')\n            arg_5.append(arg_7)\n        # crontabs present?\n        arg_8 = False\n        for arg_9 in arg_1.get('files', []):\n            arg_10 = arg_9['path']\n            if arg_10.startswith('/crontabs') or arg_10.startswith('crontabs'):\n                arg_8 = True\n                break\n        # return context\n        return dict(hostname=arg_1['general']['hostname'],  # hostname is required\n                    arg_2=arg_2,\n                    arg_5=arg_5,\n                    radios=arg_1.get('radios', []),  # radios might be empty\n                    arg_8=arg_8)", "path": "netjsonconfig/backends/openwisp/openwisp.py", "identifier": "OpenWisp._get_install_context", "docstring": "returns the template context for install.sh and uninstall.sh", "docstring_tokens": ["returns", "the", "template", "context", "for", "install", ".", "sh", "and", "uninstall", ".", "sh"], "nwo": "openwisp/netjsonconfig", "score": 0.6422153945684831, "idx": 259672}
{"url": "https://github.com/SketchingDev/Doodle-Dashboard/blob/4d7f4c248875f82a962c275009aac4aa76bd0320/doodledashboard/dashboard.py#L39-L46", "sha": "4d7f4c248875f82a962c275009aac4aa76bd0320", "docstring_summary": "Cycles through notifications with latest results from data feeds.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "poll_datafeeds", "(", ")", "arg_2", "=", "arg_0", ".", "process_notifications", "(", "arg_1", ")", "arg_0", ".", "draw_notifications", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Cycles through notifications with latest results from data feeds.\n        \"\"\"\n        arg_1 = arg_0.poll_datafeeds()\n        arg_2 = arg_0.process_notifications(arg_1)\n\n        arg_0.draw_notifications(arg_2)", "path": "doodledashboard/dashboard.py", "identifier": "DashboardRunner.cycle", "docstring": "Cycles through notifications with latest results from data feeds.", "docstring_tokens": ["Cycles", "through", "notifications", "with", "latest", "results", "from", "data", "feeds", "."], "nwo": "SketchingDev/Doodle-Dashboard", "score": 0.16941397159673272, "idx": 259673}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/generative_adversarial_network.py#L123-L142", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Save a synthetic image as a PNG file.", "language": "python", "parameters": "(images, fname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "4", ",", "4", ")", ")", "arg_3", "=", "backend_agg", ".", "FigureCanvasAgg", "(", "arg_2", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_0", ")", ":", "arg_6", "=", "arg_2", ".", "add_subplot", "(", "4", ",", "4", ",", "arg_4", "+", "1", ")", "plt", ".", "axis", "(", "'off'", ")", "arg_6", ".", "set_xticklabels", "(", "[", "]", ")", "arg_6", ".", "set_yticklabels", "(", "[", "]", ")", "arg_6", ".", "imshow", "(", "arg_5", ".", "reshape", "(", "IMAGE_SHAPE", "[", ":", "-", "1", "]", ")", ",", "cmap", "=", "'Greys_r'", ")", "arg_2", ".", "tight_layout", "(", ")", "plt", ".", "subplots_adjust", "(", "wspace", "=", "0.05", ",", "hspace", "=", "0.05", ")", "arg_3", ".", "print_figure", "(", "arg_1", ",", "format", "=", "'png'", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Save a synthetic image as a PNG file.\n\n  Args:\n    images: samples of synthetic images generated by the generative network.\n    fname: Python `str`, filename to save the plot to.\n  \"\"\"\n  arg_2 = plt.figure(figsize=(4, 4))\n  arg_3 = backend_agg.FigureCanvasAgg(arg_2)\n\n  for arg_4, arg_5 in enumerate(arg_0):\n    arg_6 = arg_2.add_subplot(4, 4, arg_4 + 1)\n    plt.axis('off')\n    arg_6.set_xticklabels([])\n    arg_6.set_yticklabels([])\n    arg_6.imshow(arg_5.reshape(IMAGE_SHAPE[:-1]), cmap='Greys_r')\n\n  arg_2.tight_layout()\n  plt.subplots_adjust(wspace=0.05, hspace=0.05)\n  arg_3.print_figure(arg_1, format='png')", "path": "tensorflow_probability/examples/generative_adversarial_network.py", "identifier": "plot_generated_images", "docstring": "Save a synthetic image as a PNG file.\n\n  Args:\n    images: samples of synthetic images generated by the generative network.\n    fname: Python `str`, filename to save the plot to.", "docstring_tokens": ["Save", "a", "synthetic", "image", "as", "a", "PNG", "file", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259674}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L80-L103", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get all accessibility application name that are currently running", "language": "python", "parameters": "(self)", "return_statement": "return list(set(app_list))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_0", ".", "_update_apps", "(", ")", "for", "arg_2", "in", "arg_0", ".", "_running_apps", ":", "arg_3", "=", "arg_2", ".", "localizedName", "(", ")", "try", ":", "arg_3", "=", "unicode", "(", "arg_3", ")", "except", "NameError", ":", "arg_3", "=", "str", "(", "arg_3", ")", "except", "UnicodeEncodeError", ":", "pass", "arg_1", ".", "append", "(", "arg_3", ")", "return", "list", "(", "set", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get all accessibility application name that are currently running\n\n        @return: list of appliction name of string type on success.\n        @rtype: list\n        \"\"\"\n        arg_1 = []\n        # Update apps list, before parsing the list\n        arg_0._update_apps()\n        for arg_2 in arg_0._running_apps:\n            arg_3 = arg_2.localizedName()\n            # default type was objc.pyobjc_unicode\n            # convert to Unicode, else exception is thrown\n            # TypeError: \"cannot marshal <type 'objc.pyobjc_unicode'> objects\"\n            try:\n                arg_3 = unicode(arg_3)\n            except NameError:\n                arg_3 = str(arg_3)\n            except UnicodeEncodeError:\n                pass\n            arg_1.append(arg_3)\n        # Return unique application list\n        return list(set(arg_1))", "path": "atomac/ldtpd/core.py", "identifier": "Core.getapplist", "docstring": "Get all accessibility application name that are currently running\n\n        @return: list of appliction name of string type on success.\n        @rtype: list", "docstring_tokens": ["Get", "all", "accessibility", "application", "name", "that", "are", "currently", "running"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 259675}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L447-L456", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the merge full data", "language": "python", "parameters": "(self, merge_id)", "return_statement": "return response.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "GitLabClient", ".", "PROJECTS", ",", "arg_0", ".", "owner", "+", "'%2F'", "+", "arg_0", ".", "repository", ",", "GitLabClient", ".", "MERGES", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "fetch", "(", "arg_2", ")", "return", "arg_3", ".", "text"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get the Func full data\"\"\"\n\n        arg_2 = urijoin(arg_0.base_url,\n                       GitLabClient.PROJECTS, arg_0.owner + '%2F' + arg_0.repository,\n                       GitLabClient.MERGES, arg_1)\n\n        arg_3 = arg_0.fetch(arg_2)\n\n        return arg_3.text", "path": "perceval/backends/core/gitlab.py", "identifier": "GitLabClient.merge", "docstring": "Get the merge full data", "docstring_tokens": ["Get", "the", "merge", "full", "data"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259676}
{"url": "https://github.com/incuna/django-user-management/blob/6784e33191d4eff624d2cf2df9ca01db4f23c9c6/user_management/api/serializers.py#L159-L175", "sha": "6784e33191d4eff624d2cf2df9ca01db4f23c9c6", "docstring_summary": "Validate if email exists and requires a verification.", "language": "python", "parameters": "(self, email)", "return_statement": "return email", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "user", "=", "User", ".", "objects", ".", "get_by_natural_key", "(", "arg_1", ")", "except", "User", ".", "DoesNotExist", ":", "arg_3", "=", "_", "(", "'A user with this email address does not exist.'", ")", "raise", "serializers", ".", "ValidationError", "(", "arg_3", ")", "if", "arg_0", ".", "user", ".", "email_verified", ":", "arg_3", "=", "_", "(", "'User email address is already verified.'", ")", "raise", "serializers", ".", "ValidationError", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Validate if email exists and requires a verification.\n\n        `Func` will set a `user` attribute on the instance allowing\n        the view to send an email confirmation.\n        \"\"\"\n        try:\n            arg_0.user = User.objects.get_by_natural_key(arg_1)\n        except User.DoesNotExist:\n            arg_3 = _('A user with this email address does not exist.')\n            raise serializers.ValidationError(arg_3)\n\n        if arg_0.user.email_verified:\n            arg_3 = _('User email address is already verified.')\n            raise serializers.ValidationError(arg_3)\n        return arg_1", "path": "user_management/api/serializers.py", "identifier": "ResendConfirmationEmailSerializer.validate_email", "docstring": "Validate if email exists and requires a verification.\n\n        `validate_email` will set a `user` attribute on the instance allowing\n        the view to send an email confirmation.", "docstring_tokens": ["Validate", "if", "email", "exists", "and", "requires", "a", "verification", "."], "nwo": "incuna/django-user-management", "score": 0.2873663608194641, "idx": 259677}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/SAM.py#L227-L244", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Plot generated pairs of variables.", "language": "python", "parameters": "(epoch, batch, generated_variables, pairs_to_plot=[[0, 1]])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "[", "[", "0", ",", "1", "]", "]", ")", ":", "from", "matplotlib", "import", "pyplot", "as", "plt", "if", "arg_0", "==", "0", ":", "plt", ".", "ion", "(", ")", "plt", ".", "clf", "(", ")", "for", "(", "arg_4", ",", "arg_5", ")", "in", "arg_3", ":", "plt", ".", "scatter", "(", "arg_2", "[", "arg_4", "]", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", ",", "arg_1", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "[", ":", ",", "arg_5", "]", ",", "label", "=", "\"Y -> X\"", ")", "plt", ".", "scatter", "(", "arg_1", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "[", ":", ",", "arg_4", "]", ",", "arg_2", "[", "arg_5", "]", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", ",", "label", "=", "\"X -> Y\"", ")", "plt", ".", "scatter", "(", "arg_1", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "[", ":", ",", "arg_4", "]", ",", "arg_1", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "[", ":", ",", "arg_5", "]", ",", "label", "=", "\"original data\"", ")", "plt", ".", "legend", "(", ")", "plt", ".", "pause", "(", "0.01", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=[[0, 1]]):\n    \"\"\"Plot generated pairs of variables.\"\"\"\n    from matplotlib import pyplot as plt\n    if arg_0 == 0:\n        plt.ion()\n    plt.clf()\n    for (arg_4, arg_5) in arg_3:\n\n        plt.scatter(arg_2[arg_4].data.cpu().numpy(\n        ), arg_1.data.cpu().numpy()[:, arg_5], label=\"Y -> X\")\n        plt.scatter(arg_1.data.cpu().numpy()[\n            :, arg_4], arg_2[arg_5].data.cpu().numpy(), label=\"X -> Y\")\n\n        plt.scatter(arg_1.data.cpu().numpy()[:, arg_4], arg_1.data.cpu().numpy()[\n            :, arg_5], label=\"original data\")\n        plt.legend()\n\n    plt.pause(0.01)", "path": "cdt/causality/graph/SAM.py", "identifier": "plot_gen", "docstring": "Plot generated pairs of variables.", "docstring_tokens": ["Plot", "generated", "pairs", "of", "variables", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 259678}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/tiling.py#L23-L26", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "How much of inner is in outer by volume", "language": "python", "parameters": "(inner, outer, norm=False)", "return_statement": "return div*(inner.volume - util.Tile.intersection(inner, outer).volume)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "1.0", "/", "arg_0", ".", "volume", "if", "arg_2", "else", "1.0", "return", "arg_3", "*", "(", "arg_0", ".", "volume", "-", "util", ".", "Tile", ".", "intersection", "(", "arg_0", ",", "arg_1", ")", ".", "volume", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\" How much of inner is in outer by volume \"\"\"\n    arg_3 = 1.0/arg_0.volume if arg_2 else 1.0\n    return arg_3*(arg_0.volume - util.Tile.intersection(arg_0, arg_1).volume)", "path": "peri/opt/tiling.py", "identifier": "tile_overlap", "docstring": "How much of inner is in outer by volume", "docstring_tokens": ["How", "much", "of", "inner", "is", "in", "outer", "by", "volume"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 259679}
{"url": "https://github.com/gunyarakun/python-shogi/blob/137fe5f5e72251e8a97a1dba4a9b44b7c3c79914/shogi/Move.py#L48-L61", "sha": "137fe5f5e72251e8a97a1dba4a9b44b7c3c79914", "docstring_summary": "Gets an USI string for the move.\n        For example a move from 7A to 8A would be `7a8a` or `7a8a+` if it is\n        a promotion.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ":", "if", "arg_0", ".", "drop_piece_type", ":", "return", "'{0}*{1}'", ".", "format", "(", "PIECE_SYMBOLS", "[", "arg_0", ".", "drop_piece_type", "]", ".", "upper", "(", ")", ",", "SQUARE_NAMES", "[", "arg_0", ".", "to_square", "]", ")", "else", ":", "return", "SQUARE_NAMES", "[", "arg_0", ".", "from_square", "]", "+", "SQUARE_NAMES", "[", "arg_0", ".", "to_square", "]", "+", "(", "'+'", "if", "arg_0", ".", "promotion", "else", "''", ")", "else", ":", "return", "'0000'"], "function": "def Func(arg_0):\n        '''\n        Gets an USI string for the move.\n        For example a move from 7A to 8A would be `7a8a` or `7a8a+` if it is\n        a promotion.\n        '''\n        if arg_0:\n            if arg_0.drop_piece_type:\n                return '{0}*{1}'.format(PIECE_SYMBOLS[arg_0.drop_piece_type].upper(), SQUARE_NAMES[arg_0.to_square])\n            else:\n                return SQUARE_NAMES[arg_0.from_square] + SQUARE_NAMES[arg_0.to_square] + \\\n                       ('+' if arg_0.promotion else '')\n        else:\n            return '0000'", "path": "shogi/Move.py", "identifier": "Move.usi", "docstring": "Gets an USI string for the move.\n        For example a move from 7A to 8A would be `7a8a` or `7a8a+` if it is\n        a promotion.", "docstring_tokens": ["Gets", "an", "USI", "string", "for", "the", "move", ".", "For", "example", "a", "move", "from", "7A", "to", "8A", "would", "be", "7a8a", "or", "7a8a", "+", "if", "it", "is", "a", "promotion", "."], "nwo": "gunyarakun/python-shogi", "score": 0.5553316607030774, "idx": 259680}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/utils.py#L407-L417", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "For use in tests; applied UTC timestamp to DataFrame.", "language": "python", "parameters": "(df)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "index", "=", "arg_0", ".", "index", ".", "tz_localize", "(", "'UTC'", ")", "except", "TypeError", ":", "arg_0", ".", "index", "=", "arg_0", ".", "index", ".", "tz_convert", "(", "'UTC'", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"\n    For use in tests; applied UTC timestamp to DataFrame.\n    \"\"\"\n\n    try:\n        arg_0.index = arg_0.index.tz_localize('UTC')\n    except TypeError:\n        arg_0.index = arg_0.index.tz_convert('UTC')\n\n    return arg_0", "path": "pyfolio/utils.py", "identifier": "to_utc", "docstring": "For use in tests; applied UTC timestamp to DataFrame.", "docstring_tokens": ["For", "use", "in", "tests", ";", "applied", "UTC", "timestamp", "to", "DataFrame", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 259681}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/gapfilling.py#L164-L200", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Update gapfilling model with switches and the indicator objective.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", ")", "arg_2", "=", "max", "(", "max", "(", "abs", "(", "b", ")", "for", "b", "in", "r", ".", "bounds", ")", "for", "r", "in", "arg_0", ".", "model", ".", "reactions", ")", "arg_3", "=", "arg_0", ".", "model", ".", "problem", "for", "arg_4", "in", "arg_0", ".", "model", ".", "reactions", ":", "if", "not", "hasattr", "(", "arg_4", ",", "'gapfilling_type'", ")", ":", "continue", "arg_5", "=", "arg_3", ".", "Variable", "(", "name", "=", "'indicator_{}'", ".", "format", "(", "arg_4", ".", "id", ")", ",", "lb", "=", "0", ",", "ub", "=", "1", ",", "type", "=", "'binary'", ")", "if", "arg_4", ".", "id", "in", "arg_0", ".", "penalties", ":", "arg_5", ".", "cost", "=", "arg_0", ".", "penalties", "[", "arg_4", ".", "id", "]", "else", ":", "arg_5", ".", "cost", "=", "arg_0", ".", "penalties", "[", "arg_4", ".", "gapfilling_type", "]", "arg_5", ".", "rxn_id", "=", "arg_4", ".", "id", "arg_0", ".", "indicators", ".", "append", "(", "arg_5", ")", "arg_8", "=", "arg_3", ".", "Constraint", "(", "arg_4", ".", "flux_expression", "-", "arg_2", "*", "arg_5", ",", "ub", "=", "0", ",", "name", "=", "'constraint_lb_{}'", ".", "format", "(", "arg_4", ".", "id", ")", ",", "sloppy", "=", "True", ")", "arg_9", "=", "arg_3", ".", "Constraint", "(", "arg_4", ".", "flux_expression", "+", "arg_2", "*", "arg_5", ",", "lb", "=", "0", ",", "name", "=", "'constraint_ub_{}'", ".", "format", "(", "arg_4", ".", "id", ")", ",", "sloppy", "=", "True", ")", "arg_1", ".", "extend", "(", "[", "arg_8", ",", "arg_9", "]", ")", "arg_0", ".", "model", ".", "add_cons_vars", "(", "arg_0", ".", "indicators", ")", "arg_0", ".", "model", ".", "add_cons_vars", "(", "arg_1", ",", "sloppy", "=", "True", ")", "arg_0", ".", "model", ".", "objective", "=", "arg_3", ".", "Objective", "(", "Zero", ",", "direction", "=", "'min'", ",", "sloppy", "=", "True", ")", "arg_0", ".", "model", ".", "objective", ".", "set_linear_coefficients", "(", "{", "arg_12", ":", "1", "for", "arg_12", "in", "arg_0", ".", "indicators", "}", ")", "arg_0", ".", "update_costs", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Update gapfilling model with switches and the indicator objective.\n        \"\"\"\n        arg_1 = list()\n        arg_2 = max(max(abs(b) for b in r.bounds)\n                    for r in arg_0.model.reactions)\n        arg_3 = arg_0.model.problem\n        for arg_4 in arg_0.model.reactions:\n            if not hasattr(arg_4, 'gapfilling_type'):\n                continue\n            arg_5 = arg_3.Variable(\n                name='indicator_{}'.format(arg_4.id), lb=0, ub=1, type='binary')\n            if arg_4.id in arg_0.penalties:\n                arg_5.cost = arg_0.penalties[arg_4.id]\n            else:\n                arg_5.cost = arg_0.penalties[arg_4.gapfilling_type]\n            arg_5.rxn_id = arg_4.id\n            arg_0.indicators.append(arg_5)\n\n            # if z = 1 v_i is allowed non-zero\n            # v_i - Mz <= 0   and   v_i + Mz >= 0\n            arg_8 = arg_3.Constraint(\n                arg_4.flux_expression - arg_2 * arg_5, ub=0,\n                name='constraint_lb_{}'.format(arg_4.id), sloppy=True)\n            arg_9 = arg_3.Constraint(\n                arg_4.flux_expression + arg_2 * arg_5, lb=0,\n                name='constraint_ub_{}'.format(arg_4.id), sloppy=True)\n\n            arg_1.extend([arg_8, arg_9])\n\n        arg_0.model.add_cons_vars(arg_0.indicators)\n        arg_0.model.add_cons_vars(arg_1, sloppy=True)\n        arg_0.model.objective = arg_3.Objective(\n            Zero, direction='min', sloppy=True)\n        arg_0.model.objective.set_linear_coefficients({\n            arg_12: 1 for arg_12 in arg_0.indicators})\n        arg_0.update_costs()", "path": "cobra/flux_analysis/gapfilling.py", "identifier": "GapFiller.add_switches_and_objective", "docstring": "Update gapfilling model with switches and the indicator objective.", "docstring_tokens": ["Update", "gapfilling", "model", "with", "switches", "and", "the", "indicator", "objective", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259682}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/config.py#L298-L317", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Produces the Tidypy configuration to use for the specified project.", "language": "python", "parameters": "(project_path, use_cache=True)", "return_statement": "return get_local_config(project_path, use_cache=use_cache) \\\n        or get_user_config(project_path, use_cache=use_cache) \\\n        or get_default_config()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "return", "get_local_config", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "or", "get_user_config", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "or", "get_default_config", "(", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"\n    Produces the Tidypy configuration to use for the specified project.\n\n    If a ``pyproject.toml`` exists, the configuration will be based on that. If\n    not, the TidyPy configuration in the user's home directory will be used. If\n    one does not exist, the default configuration will be used.\n\n    :param project_path: the path to the project that is going to be analyzed\n    :type project_path: str\n    :param use_cache:\n        whether or not to use cached versions of any remote/referenced TidyPy\n        configurations. If not specified, defaults to ``True``.\n    :type use_cache: bool\n    :rtype: dict\n    \"\"\"\n\n    return get_local_config(arg_0, arg_1=arg_1) \\\n        or get_user_config(arg_0, arg_1=arg_1) \\\n        or get_default_config()", "path": "src/tidypy/config.py", "identifier": "get_project_config", "docstring": "Produces the Tidypy configuration to use for the specified project.\n\n    If a ``pyproject.toml`` exists, the configuration will be based on that. If\n    not, the TidyPy configuration in the user's home directory will be used. If\n    one does not exist, the default configuration will be used.\n\n    :param project_path: the path to the project that is going to be analyzed\n    :type project_path: str\n    :param use_cache:\n        whether or not to use cached versions of any remote/referenced TidyPy\n        configurations. If not specified, defaults to ``True``.\n    :type use_cache: bool\n    :rtype: dict", "docstring_tokens": ["Produces", "the", "Tidypy", "configuration", "to", "use", "for", "the", "specified", "project", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 259683}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/client/application.py#L304-L325", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Creates a context to enable the oauthlib environment variable in\n        order to debug with insecure transport.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_2", ".", "environ", ".", "get", "(", "'OAUTHLIB_INSECURE_TRANSPORT'", ")", "if", "current_app", ".", "debug", "or", "current_app", ".", "testing", ":", "try", ":", "arg_2", ".", "environ", "[", "'OAUTHLIB_INSECURE_TRANSPORT'", "]", "=", "'1'", "yield", "finally", ":", "if", "arg_1", ":", "arg_2", ".", "environ", "[", "'OAUTHLIB_INSECURE_TRANSPORT'", "]", "=", "arg_1", "else", ":", "arg_2", ".", "environ", ".", "pop", "(", "'OAUTHLIB_INSECURE_TRANSPORT'", ",", "None", ")", "else", ":", "if", "arg_1", ":", "warnings", ".", "warn", "(", "'OAUTHLIB_INSECURE_TRANSPORT has been found in os.environ '", "'but the app is not running in debug mode or testing mode.'", "' It may put you in danger of the Man-in-the-middle attack'", "' while using OAuth 2.'", ",", "RuntimeWarning", ")", "yield"], "function": "def Func(arg_0):\n        \"\"\"Creates a context to enable the oauthlib environment variable in\n        order to debug with insecure transport.\n        \"\"\"\n        arg_1 = arg_2.environ.get('OAUTHLIB_INSECURE_TRANSPORT')\n        if current_app.debug or current_app.testing:\n            try:\n                arg_2.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'\n                yield\n            finally:\n                if arg_1:\n                    arg_2.environ['OAUTHLIB_INSECURE_TRANSPORT'] = arg_1\n                else:\n                    arg_2.environ.pop('OAUTHLIB_INSECURE_TRANSPORT', None)\n        else:\n            if arg_1:\n                warnings.warn(\n                    'OAUTHLIB_INSECURE_TRANSPORT has been found in os.environ '\n                    'but the app is not running in debug mode or testing mode.'\n                    ' It may put you in danger of the Man-in-the-middle attack'\n                    ' while using OAuth 2.', RuntimeWarning)\n            yield", "path": "flask_oauthlib/contrib/client/application.py", "identifier": "OAuth2Application.insecure_transport", "docstring": "Creates a context to enable the oauthlib environment variable in\n        order to debug with insecure transport.", "docstring_tokens": ["Creates", "a", "context", "to", "enable", "the", "oauthlib", "environment", "variable", "in", "order", "to", "debug", "with", "insecure", "transport", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 259684}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2581-L2618", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Returns a named tuple describing the operating system on the remote host.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "warnings", "warnings", ".", "filterwarnings", "(", "\"ignore\"", ",", "category", "=", "DeprecationWarning", ")", "arg_0", "=", "get_rc", "(", "'common_os_version'", ")", "if", "arg_0", ":", "return", "arg_0", "with", "settings", "(", "warn_only", "=", "True", ")", ":", "with", "hide", "(", "'running'", ",", "'stdout'", ",", "'stderr'", ",", "'warnings'", ")", ":", "arg_1", "=", "_run_or_local", "(", "'cat /etc/lsb-release'", ")", "if", "arg_1", ".", "succeeded", ":", "return", "OS", "(", "type", "=", "LINUX", ",", "distro", "=", "UBUNTU", ",", "release", "=", "re", ".", "findall", "(", "r'DISTRIB_RELEASE=([0-9\\.]+)'", ",", "arg_1", ")", "[", "0", "]", ")", "arg_1", "=", "_run_or_local", "(", "'cat /etc/debian_version'", ")", "if", "arg_1", ".", "succeeded", ":", "return", "OS", "(", "type", "=", "LINUX", ",", "distro", "=", "DEBIAN", ",", "release", "=", "re", ".", "findall", "(", "r'([0-9\\.]+)'", ",", "arg_1", ")", "[", "0", "]", ")", "arg_1", "=", "_run_or_local", "(", "'cat /etc/fedora-release'", ")", "if", "arg_1", ".", "succeeded", ":", "return", "OS", "(", "type", "=", "LINUX", ",", "distro", "=", "FEDORA", ",", "release", "=", "re", ".", "findall", "(", "r'release ([0-9]+)'", ",", "arg_1", ")", "[", "0", "]", ")", "raise", "Exception", "(", "'Unable to determine OS version.'", ")"], "function": "def Func():\n    \"\"\"\n    Returns a named tuple describing the operating system on the remote host.\n    \"\"\"\n\n    # TODO: remove once fabric stops using contextlib.nested.\n    # https://github.com/fabric/fabric/issues/1364\n    import warnings\n    warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n\n    arg_0 = get_rc('common_os_version')\n    if arg_0:\n        return arg_0\n    with settings(warn_only=True):\n        with hide('running', 'stdout', 'stderr', 'warnings'):\n\n            arg_1 = _run_or_local('cat /etc/lsb-release')\n            if arg_1.succeeded:\n                return OS(\n                    type=LINUX,\n                    distro=UBUNTU,\n                    release=re.findall(r'DISTRIB_RELEASE=([0-9\\.]+)', arg_1)[0])\n\n            arg_1 = _run_or_local('cat /etc/debian_version')\n            if arg_1.succeeded:\n                return OS(\n                    type=LINUX,\n                    distro=DEBIAN,\n                    release=re.findall(r'([0-9\\.]+)', arg_1)[0])\n\n            arg_1 = _run_or_local('cat /etc/fedora-release')\n            if arg_1.succeeded:\n                return OS(\n                    type=LINUX,\n                    distro=FEDORA,\n                    release=re.findall(r'release ([0-9]+)', arg_1)[0])\n\n            raise Exception('Unable to determine OS version.')", "path": "burlap/common.py", "identifier": "get_os_version", "docstring": "Returns a named tuple describing the operating system on the remote host.", "docstring_tokens": ["Returns", "a", "named", "tuple", "describing", "the", "operating", "system", "on", "the", "remote", "host", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259685}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/ids.py#L79-L95", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse the unique document id for a variant.", "language": "python", "parameters": "(chrom, pos, ref, alt, variant_type, case_id)", "return_statement": "return generate_md5_key([chrom, pos, ref, alt, variant_type, case_id])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "return", "generate_md5_key", "(", "[", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Parse the unique document id for a variant.\n\n    This will always be unique in the database.\n\n    Args:\n        chrom(str)\n        pos(str)\n        ref(str)\n        alt(str)\n        variant_type(str): 'clinical' or 'research'\n        case_id(str): unqiue family id\n\n    Returns:\n        document_id(str): The unique document id in an md5 string\n    \"\"\"\n    return generate_md5_key([arg_0, arg_1, arg_2, arg_3, arg_4, arg_5])", "path": "scout/parse/variant/ids.py", "identifier": "parse_document_id", "docstring": "Parse the unique document id for a variant.\n\n    This will always be unique in the database.\n\n    Args:\n        chrom(str)\n        pos(str)\n        ref(str)\n        alt(str)\n        variant_type(str): 'clinical' or 'research'\n        case_id(str): unqiue family id\n\n    Returns:\n        document_id(str): The unique document id in an md5 string", "docstring_tokens": ["Parse", "the", "unique", "document", "id", "for", "a", "variant", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259686}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L62-L81", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Transform ast of multidimensional declaration to a single dimension declaration.", "language": "python", "parameters": "(decl)", "return_statement": "return decl.name, dims", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", ".", "type", "while", "arg_3", "(", "arg_2", ")", "is", "c_ast", ".", "ArrayDecl", ":", "arg_1", ".", "append", "(", "arg_2", ".", "dim", ")", "arg_2", "=", "arg_2", ".", "type", "if", "arg_1", ":", "arg_0", ".", "type", ".", "dim", "=", "reduce", "(", "lambda", "l", ",", "r", ":", "c_ast", ".", "BinaryOp", "(", "'*'", ",", "l", ",", "r", ")", ",", "arg_1", ")", "arg_0", ".", "type", ".", "type", "=", "arg_2", "return", "arg_0", ".", "name", ",", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Transform ast of multidimensional declaration to a single dimension declaration.\n\n    In-place operation!\n\n    Returns name and dimensions of array (to be used with transform_multidim_to_1d_ref())\n    \"\"\"\n    arg_1 = []\n    arg_2 = arg_0.type\n    while arg_3(arg_2) is c_ast.ArrayDecl:\n        arg_1.append(arg_2.dim)\n        arg_2 = arg_2.type\n\n    if arg_1:\n        # Multidimensional array\n        arg_0.type.dim = reduce(lambda l, r: c_ast.BinaryOp('*', l, r), arg_1)\n        arg_0.type.type = arg_2\n\n    return arg_0.name, arg_1", "path": "kerncraft/kernel.py", "identifier": "transform_multidim_to_1d_decl", "docstring": "Transform ast of multidimensional declaration to a single dimension declaration.\n\n    In-place operation!\n\n    Returns name and dimensions of array (to be used with transform_multidim_to_1d_ref())", "docstring_tokens": ["Transform", "ast", "of", "multidimensional", "declaration", "to", "a", "single", "dimension", "declaration", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 259687}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1600-L1649", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Check if a field is well-formed.", "language": "python", "parameters": "(field)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "type", "(", "arg_0", ")", "not", "in", "(", "list", ",", "tuple", ")", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Field of type '%s' should be either \"", "\"a list or a tuple.\"", "%", "type", "(", "arg_0", ")", ")", "if", "len", "(", "arg_0", ")", "!=", "5", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Field of length '%d' should have 5 \"", "\"elements.\"", "%", "len", "(", "arg_0", ")", ")", "if", "type", "(", "arg_0", "[", "0", "]", ")", "not", "in", "(", "list", ",", "tuple", ")", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Subfields of type '%s' should be \"", "\"either a list or a tuple.\"", "%", "type", "(", "arg_0", "[", "0", "]", ")", ")", "if", "type", "(", "arg_0", "[", "1", "]", ")", "is", "not", "str", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Indicator 1 of type '%s' should be \"", "\"a string.\"", "%", "type", "(", "arg_0", "[", "1", "]", ")", ")", "if", "type", "(", "arg_0", "[", "2", "]", ")", "is", "not", "str", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Indicator 2 of type '%s' should be \"", "\"a string.\"", "%", "type", "(", "arg_0", "[", "2", "]", ")", ")", "if", "type", "(", "arg_0", "[", "3", "]", ")", "is", "not", "str", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Controlfield value of type '%s' \"", "\"should be a string.\"", "%", "type", "(", "arg_0", "[", "3", "]", ")", ")", "if", "type", "(", "arg_0", "[", "4", "]", ")", "is", "not", "int", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Global position of type '%s' should \"", "\"be an int.\"", "%", "type", "(", "arg_0", "[", "4", "]", ")", ")", "for", "arg_1", "in", "arg_0", "[", "0", "]", ":", "if", "(", "type", "(", "arg_1", ")", "not", "in", "(", "list", ",", "tuple", ")", "or", "len", "(", "arg_1", ")", "!=", "2", "or", "type", "(", "arg_1", "[", "0", "]", ")", "is", "not", "str", "or", "type", "(", "arg_1", "[", "1", "]", ")", "is", "not", "str", ")", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Subfields are malformed. \"", "\"Should a list of tuples of 2 strings.\"", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Check if a field is well-formed.\n\n    :param field: A field tuple as returned by create_field()\n    :type field:  tuple\n    :raise InvenioBibRecordFieldError: If the field is invalid.\n    \"\"\"\n    if type(arg_0) not in (list, tuple):\n        raise InvenioBibRecordFieldError(\n            \"Field of type '%s' should be either \"\n            \"a list or a tuple.\" % type(arg_0))\n\n    if len(arg_0) != 5:\n        raise InvenioBibRecordFieldError(\n            \"Field of length '%d' should have 5 \"\n            \"elements.\" % len(arg_0))\n\n    if type(arg_0[0]) not in (list, tuple):\n        raise InvenioBibRecordFieldError(\n            \"Subfields of type '%s' should be \"\n            \"either a list or a tuple.\" % type(arg_0[0]))\n\n    if type(arg_0[1]) is not str:\n        raise InvenioBibRecordFieldError(\n            \"Indicator 1 of type '%s' should be \"\n            \"a string.\" % type(arg_0[1]))\n\n    if type(arg_0[2]) is not str:\n        raise InvenioBibRecordFieldError(\n            \"Indicator 2 of type '%s' should be \"\n            \"a string.\" % type(arg_0[2]))\n\n    if type(arg_0[3]) is not str:\n        raise InvenioBibRecordFieldError(\n            \"Controlfield value of type '%s' \"\n            \"should be a string.\" % type(arg_0[3]))\n\n    if type(arg_0[4]) is not int:\n        raise InvenioBibRecordFieldError(\n            \"Global position of type '%s' should \"\n            \"be an int.\" % type(arg_0[4]))\n\n    for arg_1 in arg_0[0]:\n        if (type(arg_1) not in (list, tuple) or\n                len(arg_1) != 2 or type(arg_1[0]) is not str or\n                type(arg_1[1]) is not str):\n            raise InvenioBibRecordFieldError(\n                \"Subfields are malformed. \"\n                \"Should a list of tuples of 2 strings.\")", "path": "harvestingkit/bibrecord.py", "identifier": "_check_field_validity", "docstring": "Check if a field is well-formed.\n\n    :param field: A field tuple as returned by create_field()\n    :type field:  tuple\n    :raise InvenioBibRecordFieldError: If the field is invalid.", "docstring_tokens": ["Check", "if", "a", "field", "is", "well", "-", "formed", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259688}
{"url": "https://github.com/hsharrison/pyglet2d/blob/46f610b3c76221bff19e5c0cf3d35d7875ce37a0/src/pyglet2d.py#L125-L139", "sha": "46f610b3c76221bff19e5c0cf3d35d7875ce37a0", "docstring_summary": "Shortcut for creating a rectangle aligned with the screen axes from only two corners.", "language": "python", "parameters": "(cls, vertices, **kwargs)", "return_statement": "return cls([bottom_left, bottom_right, top_right, top_left], **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "arg_1", "arg_5", "=", "[", "arg_3", "[", "0", "]", ",", "arg_4", "[", "1", "]", "]", "arg_6", "=", "[", "arg_4", "[", "0", "]", ",", "arg_3", "[", "1", "]", "]", "return", "arg_0", "(", "[", "arg_3", ",", "arg_6", ",", "arg_4", ",", "arg_5", "]", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Shortcut for creating a Func aligned with the screen axes from only two corners.\n\n        Parameters\n        ----------\n        vertices : array-like\n            An array containing the ``[x, y]`` positions of two corners.\n        kwargs\n            Other keyword arguments are passed to the |Shape| constructor.\n\n        \"\"\"\n        arg_3, arg_4 = arg_1\n        arg_5 = [arg_3[0], arg_4[1]]\n        arg_6 = [arg_4[0], arg_3[1]]\n        return arg_0([arg_3, arg_6, arg_4, arg_5], **arg_2)", "path": "src/pyglet2d.py", "identifier": "Shape.rectangle", "docstring": "Shortcut for creating a rectangle aligned with the screen axes from only two corners.\n\n        Parameters\n        ----------\n        vertices : array-like\n            An array containing the ``[x, y]`` positions of two corners.\n        kwargs\n            Other keyword arguments are passed to the |Shape| constructor.", "docstring_tokens": ["Shortcut", "for", "creating", "a", "rectangle", "aligned", "with", "the", "screen", "axes", "from", "only", "two", "corners", "."], "nwo": "hsharrison/pyglet2d", "score": 0.2823188883832642, "idx": 259689}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L139-L150", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return a 404 page with specified error_code after logging error and adding message to django messages.", "language": "python", "parameters": "(request, context_data, error_code, log_message)", "return_statement": "return render(\n        request,\n        ENTERPRISE_GENERAL_ERROR_PAGE,\n        context=context_data,\n        status=404,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "LOGGER", ".", "error", "(", "arg_3", ")", "messages", ".", "add_generic_error_message_with_code", "(", "arg_0", ",", "arg_2", ")", "return", "render", "(", "arg_0", ",", "ENTERPRISE_GENERAL_ERROR_PAGE", ",", "context", "=", "arg_1", ",", "status", "=", "404", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Return a 404 page with specified error_code after logging error and adding message to django messages.\n    \"\"\"\n    LOGGER.error(arg_3)\n    messages.add_generic_error_message_with_code(arg_0, arg_2)\n    return render(\n        arg_0,\n        ENTERPRISE_GENERAL_ERROR_PAGE,\n        context=arg_1,\n        status=404,\n    )", "path": "enterprise/views.py", "identifier": "render_page_with_error_code_message", "docstring": "Return a 404 page with specified error_code after logging error and adding message to django messages.", "docstring_tokens": ["Return", "a", "404", "page", "with", "specified", "error_code", "after", "logging", "error", "and", "adding", "message", "to", "django", "messages", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259690}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L945-L959", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Modify controlfield at position specified by tag and field number.", "language": "python", "parameters": "(rec, tag, controlfield_value,\n                               field_position_global=None,\n                               field_position_local=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "record_get_field", "(", "arg_0", ",", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "(", "arg_5", "[", "0", "]", ",", "arg_5", "[", "1", "]", ",", "arg_5", "[", "2", "]", ",", "arg_2", ",", "arg_5", "[", "4", "]", ")", "record_replace_field", "(", "arg_0", ",", "arg_1", ",", "arg_6", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                               arg_3=None,\n                               arg_4=None):\n    \"\"\"Modify controlfield at position specified by tag and field number.\"\"\"\n    arg_5 = record_get_field(\n        arg_0, arg_1,\n        arg_3=arg_3,\n        arg_4=arg_4)\n\n    arg_6 = (arg_5[0], arg_5[1], arg_5[2], arg_2, arg_5[4])\n\n    record_replace_field(\n        arg_0, arg_1, arg_6,\n        arg_3=arg_3,\n        arg_4=arg_4)", "path": "harvestingkit/bibrecord.py", "identifier": "record_modify_controlfield", "docstring": "Modify controlfield at position specified by tag and field number.", "docstring_tokens": ["Modify", "controlfield", "at", "position", "specified", "by", "tag", "and", "field", "number", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259691}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Instruction.py#L260-L270", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Transfer this instruction to a new row.", "language": "python", "parameters": "(self, new_row)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "!=", "arg_0", ".", "_row", ":", "arg_2", "=", "arg_0", ".", "get_index_in_row", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_0", ".", "_row", ".", "instructions", ".", "pop", "(", "arg_2", ")", "arg_0", ".", "_row", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Transfer this instruction to a new row.\n\n        :param knittingpattern.Row.Row new_row: the new row the instruction is\n          in.\n        \"\"\"\n        if arg_1 != arg_0._row:\n            arg_2 = arg_0.get_index_in_row()\n            if arg_2 is not None:\n                arg_0._row.instructions.pop(arg_2)\n            arg_0._row = arg_1", "path": "knittingpattern/Instruction.py", "identifier": "InstructionInRow.transfer_to_row", "docstring": "Transfer this instruction to a new row.\n\n        :param knittingpattern.Row.Row new_row: the new row the instruction is\n          in.", "docstring_tokens": ["Transfer", "this", "instruction", "to", "a", "new", "row", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 259692}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/multiplayer.py#L65-L87", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Respond when the server indicates that the client is out of sync.", "language": "python", "parameters": "(self, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "info", "(", "\"synchronizing message: {message}\"", ")", "with", "arg_0", ".", "world", ".", "_unlock_temporarily", "(", ")", ":", "arg_1", ".", "_sync", "(", "arg_0", ".", "world", ")", "arg_0", ".", "world", ".", "_react_to_sync_response", "(", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "actors", ":", "arg_2", ".", "_react_to_sync_response", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Respond when the server indicates that the client is out of sync.\n\n        The server can request a sync when this client sends a message that \n        fails the check() on the server.  If the reason for the failure isn't \n        very serious, then the server can decide to send it as usual in the \n        interest of a smooth gameplay experience.  When this happens, the \n        server sends out an extra response providing the clients with the\n        information they need to resync themselves.\n        \"\"\"\n        info(\"synchronizing message: {message}\")\n\n        # Synchronize the world.\n\n        with arg_0.world._unlock_temporarily():\n            arg_1._sync(arg_0.world)\n            arg_0.world._react_to_sync_response(arg_1)\n\n        # Synchronize the tokens.\n\n        for arg_2 in arg_0.actors:\n            arg_2._react_to_sync_response(arg_1)", "path": "kxg/multiplayer.py", "identifier": "ClientForum.execute_sync", "docstring": "Respond when the server indicates that the client is out of sync.\n\n        The server can request a sync when this client sends a message that \n        fails the check() on the server.  If the reason for the failure isn't \n        very serious, then the server can decide to send it as usual in the \n        interest of a smooth gameplay experience.  When this happens, the \n        server sends out an extra response providing the clients with the\n        information they need to resync themselves.", "docstring_tokens": ["Respond", "when", "the", "server", "indicates", "that", "the", "client", "is", "out", "of", "sync", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 259693}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/quaternion.py#L131-L146", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Generate a quaternion from a set of Euler angles.", "language": "python", "parameters": "(angles, order='yzy')", "return_statement": "return quat", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'yzy'", ")", ":", "arg_0", "=", "np", ".", "asarray", "(", "arg_0", ",", "dtype", "=", "float", ")", "arg_2", "=", "quaternion_from_axis_rotation", "(", "arg_0", "[", "0", "]", ",", "arg_1", "[", "0", "]", ")", "*", "(", "quaternion_from_axis_rotation", "(", "arg_0", "[", "1", "]", ",", "arg_1", "[", "1", "]", ")", "*", "quaternion_from_axis_rotation", "(", "arg_0", "[", "2", "]", ",", "arg_1", "[", "2", "]", ")", ")", "arg_2", ".", "normalize", "(", "inplace", "=", "True", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1='yzy'):\n    \"\"\"Generate a quaternion from a set of Euler angles.\n\n    Args:\n        angles (array_like): Array of Euler angles.\n        order (str): Order of Euler rotations.  'yzy' is default.\n\n    Returns:\n        Quaternion: Quaternion representation of Euler rotation.\n    \"\"\"\n    arg_0 = np.asarray(arg_0, dtype=float)\n    arg_2 = quaternion_from_axis_rotation(arg_0[0], arg_1[0])\\\n        * (quaternion_from_axis_rotation(arg_0[1], arg_1[1])\n           * quaternion_from_axis_rotation(arg_0[2], arg_1[2]))\n    arg_2.normalize(inplace=True)\n    return arg_2", "path": "qiskit/quantum_info/operators/quaternion.py", "identifier": "quaternion_from_euler", "docstring": "Generate a quaternion from a set of Euler angles.\n\n    Args:\n        angles (array_like): Array of Euler angles.\n        order (str): Order of Euler rotations.  'yzy' is default.\n\n    Returns:\n        Quaternion: Quaternion representation of Euler rotation.", "docstring_tokens": ["Generate", "a", "quaternion", "from", "a", "set", "of", "Euler", "angles", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259694}
{"url": "https://github.com/mtomwing/purplex/blob/4072109e1d4395826983cd9d95ead2c1dfc1184e/purplex/grammar.py#L110-L130", "sha": "4072109e1d4395826983cd9d95ead2c1dfc1184e", "docstring_summary": "Computes the FIRST set for every symbol in the grammar.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "terminals", ":", "arg_0", ".", "_first", "[", "arg_1", "]", ".", "add", "(", "arg_1", ")", "arg_0", ".", "_first", "[", "END_OF_INPUT", "]", ".", "add", "(", "END_OF_INPUT", ")", "while", "True", ":", "arg_2", "=", "False", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "nonterminals", ".", "items", "(", ")", ":", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "arg_0", ".", "first", "(", "arg_5", ".", "rhs", ")", "if", "arg_6", "-", "arg_0", ".", "_first", "[", "arg_3", "]", ":", "arg_0", ".", "_first", "[", "arg_3", "]", "|=", "arg_6", "arg_2", "=", "True", "if", "not", "arg_2", ":", "break"], "function": "def Func(arg_0):\n        \"\"\"Computes the FIRST set for every symbol in the grammar.\n\n        Tenatively based on Func in PLY.\n        \"\"\"\n        for arg_1 in arg_0.terminals:\n            arg_0._first[arg_1].add(arg_1)\n        arg_0._first[END_OF_INPUT].add(END_OF_INPUT)\n\n        while True:\n            arg_2 = False\n\n            for arg_3, arg_4 in arg_0.nonterminals.items():\n                for arg_5 in arg_4:\n                    arg_6 = arg_0.first(arg_5.rhs)\n                    if arg_6 - arg_0._first[arg_3]:\n                        arg_0._first[arg_3] |= arg_6\n                        arg_2 = True\n\n            if not arg_2:\n                break", "path": "purplex/grammar.py", "identifier": "Grammar._compute_first", "docstring": "Computes the FIRST set for every symbol in the grammar.\n\n        Tenatively based on _compute_first in PLY.", "docstring_tokens": ["Computes", "the", "FIRST", "set", "for", "every", "symbol", "in", "the", "grammar", "."], "nwo": "mtomwing/purplex", "score": 0.1903525543429651, "idx": 259695}
{"url": "https://github.com/edavis/django-override-settings/blob/016a2ba44cf7132d3aeefbfeddaf201217b1d4b6/override_settings/__init__.py#L14-L19", "sha": "016a2ba44cf7132d3aeefbfeddaf201217b1d4b6", "docstring_summary": "Return a dictionary of all global_settings values.", "language": "python", "parameters": "(self)", "return_statement": "return dict((key, getattr(global_settings, key)) for key in dir(global_settings)\n                    if key.isupper())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "dict", "(", "(", "arg_1", ",", "getattr", "(", "global_settings", ",", "arg_1", ")", ")", "for", "arg_1", "in", "dir", "(", "global_settings", ")", "if", "arg_1", ".", "isupper", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return a dictionary of all global_settings values.\n        \"\"\"\n        return dict((arg_1, getattr(global_settings, arg_1)) for arg_1 in dir(global_settings)\n                    if arg_1.isupper())", "path": "override_settings/__init__.py", "identifier": "override_settings.get_global_settings", "docstring": "Return a dictionary of all global_settings values.", "docstring_tokens": ["Return", "a", "dictionary", "of", "all", "global_settings", "values", "."], "nwo": "edavis/django-override-settings", "score": 0.28597268934051834, "idx": 259696}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/serialize/canning.py#L387-L403", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Invert canning.", "language": "python", "parameters": "(obj, g=None)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "False", "for", "arg_3", ",", "arg_4", "in", "iteritems", "(", "Func_map", ")", ":", "if", "isinstance", "(", "arg_3", ",", "string_types", ")", ":", "arg_2", "=", "True", "break", "elif", "isinstance", "(", "arg_0", ",", "arg_3", ")", ":", "return", "arg_4", "(", "arg_0", ",", "arg_1", ")", "if", "arg_2", ":", "_import_mapping", "(", "Func_map", ",", "_original_Func_map", ")", "return", "Func", "(", "arg_0", ",", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Invert canning.\"\"\"\n    arg_2 = False\n    for arg_3, arg_4 in iteritems(Func_map):\n        if isinstance(arg_3, string_types):\n            arg_2 = True\n            break\n        elif isinstance(arg_0, arg_3):\n            return arg_4(arg_0, arg_1)\n\n    if arg_2:\n        # perform Func_map imports, then try again\n        # this will usually only happen once\n        _import_mapping(Func_map, _original_Func_map)\n        return Func(arg_0, arg_1)\n\n    return arg_0", "path": "parsl/executors/serialize/canning.py", "identifier": "uncan", "docstring": "Invert canning.", "docstring_tokens": ["Invert", "canning", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 259697}
{"url": "https://github.com/dry-python/dependencies/blob/297912cbc6482ba26b3104729645f3a2aba5facc/src/dependencies/contrib/_rest_framework.py#L21-L28", "sha": "297912cbc6482ba26b3104729645f3a2aba5facc", "docstring_summary": "Create DRF generic class-based API view from injector class.", "language": "python", "parameters": "(injector)", "return_statement": "return injector.let(as_view=handler.as_view)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "create_handler", "(", "GenericAPIView", ",", "arg_0", ")", "apply_http_methods", "(", "arg_1", ",", "arg_0", ")", "apply_api_view_methods", "(", "arg_1", ",", "arg_0", ")", "apply_Func_methods", "(", "arg_1", ",", "arg_0", ")", "return", "arg_0", ".", "let", "(", "as_view", "=", "arg_1", ".", "as_view", ")"], "function": "def Func(arg_0):\n    \"\"\"Create DRF generic class-based API view from injector class.\"\"\"\n\n    arg_1 = create_handler(GenericAPIView, arg_0)\n    apply_http_methods(arg_1, arg_0)\n    apply_api_view_methods(arg_1, arg_0)\n    apply_Func_methods(arg_1, arg_0)\n    return arg_0.let(as_view=arg_1.as_view)", "path": "src/dependencies/contrib/_rest_framework.py", "identifier": "generic_api_view", "docstring": "Create DRF generic class-based API view from injector class.", "docstring_tokens": ["Create", "DRF", "generic", "class", "-", "based", "API", "view", "from", "injector", "class", "."], "nwo": "dry-python/dependencies", "score": 0.48025225294832147, "idx": 259698}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/financial/des.py#L300-L313", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Retrieves an account's descendants from the general ledger structure\n        given the account name.", "language": "python", "parameters": "(self, account)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ".", "accounts", ":", "arg_0", ".", "_get_account_and_descendants_", "(", "arg_3", ",", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retrieves an account's descendants from the general ledger structure\n        given the account name.\n\n        :param account_name: The account name.\n\n        :returns: The decendants of the account.\n        \"\"\"\n\n        arg_2 = []\n        for arg_3 in arg_1.accounts:\n            arg_0._get_account_and_descendants_(arg_3, arg_2)\n        return arg_2", "path": "auxi/modelling/financial/des.py", "identifier": "GeneralLedgerStructure.get_account_descendants", "docstring": "Retrieves an account's descendants from the general ledger structure\n        given the account name.\n\n        :param account_name: The account name.\n\n        :returns: The decendants of the account.", "docstring_tokens": ["Retrieves", "an", "account", "s", "descendants", "from", "the", "general", "ledger", "structure", "given", "the", "account", "name", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 259699}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L1027-L1076", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Calculates the compressibility factor of a gas given its pressure, and \n    pressure-form virial coefficients. Any number of coefficients is supported.", "language": "python", "parameters": "(P, *args)", "return_statement": "return 1 + P*sum([coeff*P**i for i, coeff in enumerate(args)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "return", "1", "+", "arg_0", "*", "sum", "(", "[", "arg_3", "*", "arg_0", "**", "arg_2", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_1", ")", "]", ")"], "function": "def Func(arg_0, *arg_1):\n    r'''Calculates the compressibility factor of a gas given its pressure, and \n    pressure-form virial coefficients. Any number of coefficients is supported.\n\n    .. math::\n        Z = \\frac{Pv}{RT} = 1 + B'P + C'P^2 + D'P^3 + E'P^4 \\dots\n\n    Parameters\n    ----------\n    P : float\n        Pressure, [Pa]\n    B to Z : float, optional\n        Pressure form Virial coefficients, [various]\n\n    Returns\n    -------\n    Z : float\n        Compressibility factor at P, and with given virial coefficients, [-]\n\n    Notes\n    -----\n    Note that although this function does not require a temperature input, it  \n    is still dependent on it because the coefficients themselves normally are\n    regressed in terms of temperature.\n    \n    The use of this form is less common than the density form. Its coefficients\n    are normally indicated with the \"'\" suffix.\n    \n    If no virial coefficients are given, returns 1, as per the ideal gas law.\n    \n    The units of each virial coefficient are as follows, where for B, n=1, and\n    C, n=2, and so on.\n    \n    .. math::\n        \\left(\\frac{1}{\\text{Pa}}\\right)^n\n\n    Examples\n    --------\n    >>> Func(102919.99946855308, 4.032286555169439e-09, 1.6197059494442215e-13, 6.483855042486911e-19)\n    1.00283753944\n    \n    References\n    ----------\n    .. [1] Prausnitz, John M., Rudiger N. Lichtenthaler, and Edmundo Gomes de \n       Azevedo. Molecular Thermodynamics of Fluid-Phase Equilibria. 3rd \n       edition. Upper Saddle River, N.J: Prentice Hall, 1998.\n    .. [2] Walas, Stanley M. Phase Equilibria in Chemical Engineering. \n       Butterworth-Heinemann, 1985.\n    '''\n    return 1 + arg_0*sum([arg_3*arg_0**arg_2 for arg_2, arg_3 in enumerate(arg_1)])", "path": "thermo/utils.py", "identifier": "Z_from_virial_pressure_form", "docstring": "r'''Calculates the compressibility factor of a gas given its pressure, and \n    pressure-form virial coefficients. Any number of coefficients is supported.\n\n    .. math::\n        Z = \\frac{Pv}{RT} = 1 + B'P + C'P^2 + D'P^3 + E'P^4 \\dots\n\n    Parameters\n    ----------\n    P : float\n        Pressure, [Pa]\n    B to Z : float, optional\n        Pressure form Virial coefficients, [various]\n\n    Returns\n    -------\n    Z : float\n        Compressibility factor at P, and with given virial coefficients, [-]\n\n    Notes\n    -----\n    Note that although this function does not require a temperature input, it  \n    is still dependent on it because the coefficients themselves normally are\n    regressed in terms of temperature.\n    \n    The use of this form is less common than the density form. Its coefficients\n    are normally indicated with the \"'\" suffix.\n    \n    If no virial coefficients are given, returns 1, as per the ideal gas law.\n    \n    The units of each virial coefficient are as follows, where for B, n=1, and\n    C, n=2, and so on.\n    \n    .. math::\n        \\left(\\frac{1}{\\text{Pa}}\\right)^n\n\n    Examples\n    --------\n    >>> Z_from_virial_pressure_form(102919.99946855308, 4.032286555169439e-09, 1.6197059494442215e-13, 6.483855042486911e-19)\n    1.00283753944\n    \n    References\n    ----------\n    .. [1] Prausnitz, John M., Rudiger N. Lichtenthaler, and Edmundo Gomes de \n       Azevedo. Molecular Thermodynamics of Fluid-Phase Equilibria. 3rd \n       edition. Upper Saddle River, N.J: Prentice Hall, 1998.\n    .. [2] Walas, Stanley M. Phase Equilibria in Chemical Engineering. \n       Butterworth-Heinemann, 1985.", "docstring_tokens": ["r", "Calculates", "the", "compressibility", "factor", "of", "a", "gas", "given", "its", "pressure", "and", "pressure", "-", "form", "virial", "coefficients", ".", "Any", "number", "of", "coefficients", "is", "supported", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 259700}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L651-L663", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Suspend process execution.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "is_running", "(", ")", ":", "arg_1", "=", "arg_0", ".", "_platform_impl", ".", "_process_name", "raise", "NoSuchProcess", "(", "arg_0", ".", "pid", ",", "arg_1", ")", "if", "hasattr", "(", "arg_0", ".", "_platform_impl", ",", "\"Func_process\"", ")", ":", "arg_0", ".", "_platform_impl", ".", "Func_process", "(", ")", "else", ":", "arg_0", ".", "send_signal", "(", "signal", ".", "SIGSTOP", ")"], "function": "def Func(arg_0):\n        \"\"\"Suspend process execution.\"\"\"\n        # safety measure in case the current process has been killed in\n        # meantime and the kernel reused its PID\n        if not arg_0.is_running():\n            arg_1 = arg_0._platform_impl._process_name\n            raise NoSuchProcess(arg_0.pid, arg_1)\n        # windows\n        if hasattr(arg_0._platform_impl, \"Func_process\"):\n            arg_0._platform_impl.Func_process()\n        else:\n            # posix\n            arg_0.send_signal(signal.SIGSTOP)", "path": "environment/lib/python2.7/site-packages/psutil/__init__.py", "identifier": "Process.suspend", "docstring": "Suspend process execution.", "docstring_tokens": ["Suspend", "process", "execution", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259701}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L602-L647", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Attempts to restart the running kernel.", "language": "python", "parameters": "(self, message, now=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_0", ".", "custom_restart", ":", "arg_0", ".", "custom_restart_requested", ".", "emit", "(", ")", "elif", "arg_0", ".", "kernel_manager", ".", "has_kernel", ":", "arg_0", ".", "kernel_manager", ".", "hb_channel", ".", "pause", "(", ")", "if", "arg_0", ".", "confirm_restart", ":", "arg_3", "=", "QtGui", ".", "QMessageBox", ".", "Yes", "|", "QtGui", ".", "QMessageBox", ".", "No", "arg_4", "=", "QtGui", ".", "QMessageBox", ".", "question", "(", "arg_0", ",", "'Restart kernel?'", ",", "arg_1", ",", "arg_3", ")", "arg_5", "=", "arg_4", "==", "QtGui", ".", "QMessageBox", ".", "Yes", "else", ":", "arg_5", "=", "True", "if", "arg_5", ":", "try", ":", "arg_0", ".", "kernel_manager", ".", "Func", "(", "arg_2", "=", "arg_2", ")", "except", "RuntimeError", ":", "arg_0", ".", "_append_plain_text", "(", "'Kernel started externally. '", "'Cannot restart.\\n'", ",", "before_prompt", "=", "True", ")", "else", ":", "arg_0", ".", "reset", "(", ")", "else", ":", "arg_0", ".", "kernel_manager", ".", "hb_channel", ".", "unpause", "(", ")", "else", ":", "arg_0", ".", "_append_plain_text", "(", "'Kernel process is either remote or '", "'unspecified. Cannot restart.\\n'", ",", "before_prompt", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\" Attempts to restart the running kernel.\n        \"\"\"\n        # FIXME: now should be configurable via a checkbox in the dialog.  Right\n        # now at least the heartbeat path sets it to True and the manual restart\n        # to False.  But those should just be the pre-selected states of a\n        # checkbox that the user could override if so desired.  But I don't know\n        # enough Qt to go implementing the checkbox now.\n\n        if arg_0.custom_restart:\n            arg_0.custom_restart_requested.emit()\n\n        elif arg_0.kernel_manager.has_kernel:\n            # Pause the heart beat channel to prevent further warnings.\n            arg_0.kernel_manager.hb_channel.pause()\n\n            # Prompt the user to restart the kernel. Un-pause the heartbeat if\n            # they decline. (If they accept, the heartbeat will be un-paused\n            # automatically when the kernel is restarted.)\n            if arg_0.confirm_restart:\n                arg_3 = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No\n                arg_4 = QtGui.QMessageBox.question(arg_0, 'Restart kernel?',\n                                                    arg_1, arg_3)\n                arg_5 = arg_4 == QtGui.QMessageBox.Yes\n            else:\n                # confirm_restart is False, so we don't need to ask user\n                # anything, just do the restart\n                arg_5 = True\n            if arg_5:\n                try:\n                    arg_0.kernel_manager.Func(arg_2=arg_2)\n                except RuntimeError:\n                    arg_0._append_plain_text('Kernel started externally. '\n                                            'Cannot restart.\\n',\n                                            before_prompt=True\n                                            )\n                else:\n                    arg_0.reset()\n            else:\n                arg_0.kernel_manager.hb_channel.unpause()\n\n        else:\n            arg_0._append_plain_text('Kernel process is either remote or '\n                                    'unspecified. Cannot restart.\\n',\n                                    before_prompt=True\n                                    )", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget.restart_kernel", "docstring": "Attempts to restart the running kernel.", "docstring_tokens": ["Attempts", "to", "restart", "the", "running", "kernel", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259702}
{"url": "https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/update.py#L126-L149", "sha": "d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd", "docstring_summary": "Checks if a temple project is up to date with the repo", "language": "python", "parameters": "(version=None)", "return_statement": "return new_template_version == old_template_version", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "temple", ".", "check", ".", "in_git_repo", "(", ")", "temple", ".", "check", ".", "is_temple_project", "(", ")", "arg_1", "=", "temple", ".", "utils", ".", "read_temple_config", "(", ")", "arg_2", "=", "arg_1", "[", "'_version'", "]", "arg_3", "=", "arg_0", "or", "_get_latest_template_version", "(", "arg_1", "[", "'_template'", "]", ")", "return", "arg_3", "==", "arg_2"], "function": "def Func(arg_0=None):\n    \"\"\"Checks if a temple project is up to date with the repo\n\n    Note that the `temple.constants.TEMPLE_ENV_VAR` is set to 'update' for the duration of this\n    function.\n\n    Args:\n        version (str, optional): Update against this git SHA or branch of the template\n\n    Returns:\n        boolean: True if up to date with ``version`` (or latest version), False otherwise\n\n    Raises:\n        `NotInGitRepoError`: When running outside of a git repo\n        `InvalidTempleProjectError`: When not inside a valid temple repository\n    \"\"\"\n    temple.check.in_git_repo()\n    temple.check.is_temple_project()\n\n    arg_1 = temple.utils.read_temple_config()\n    arg_2 = arg_1['_version']\n    arg_3 = arg_0 or _get_latest_template_version(arg_1['_template'])\n\n    return arg_3 == arg_2", "path": "temple/update.py", "identifier": "up_to_date", "docstring": "Checks if a temple project is up to date with the repo\n\n    Note that the `temple.constants.TEMPLE_ENV_VAR` is set to 'update' for the duration of this\n    function.\n\n    Args:\n        version (str, optional): Update against this git SHA or branch of the template\n\n    Returns:\n        boolean: True if up to date with ``version`` (or latest version), False otherwise\n\n    Raises:\n        `NotInGitRepoError`: When running outside of a git repo\n        `InvalidTempleProjectError`: When not inside a valid temple repository", "docstring_tokens": ["Checks", "if", "a", "temple", "project", "is", "up", "to", "date", "with", "the", "repo"], "nwo": "CloverHealth/temple", "score": 0.39091779717332914, "idx": 259703}
{"url": "https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/frozen.py#L4-L10", "sha": "8a34891892b8af69b21fdc46701c91763a5c1cf9", "docstring_summary": "Cast value to its frozen counterpart.", "language": "python", "parameters": "(value)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "return", "FrozenList", "(", "*", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "return", "FrozenDict", "(", "**", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\" Cast value to its frozen counterpart. \"\"\"\n    if isinstance(arg_0, list):\n        return FrozenList(*arg_0)\n    if isinstance(arg_0, dict):\n        return FrozenDict(**arg_0)\n    return arg_0", "path": "modularodm/frozen.py", "identifier": "freeze", "docstring": "Cast value to its frozen counterpart.", "docstring_tokens": ["Cast", "value", "to", "its", "frozen", "counterpart", "."], "nwo": "cos-archives/modular-odm", "score": 0.2643786477459777, "idx": 259704}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L541-L558", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a worker for the function below.", "language": "python", "parameters": "(task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "try", ":", "return", "concat_write_pklc", "(", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'failed LC concatenation for %s in %s'", "%", "(", "arg_2", ",", "arg_1", ")", ")", "return", "None"], "function": "def Func(arg_0):\n    '''\n    This is a worker for the function below.\n\n    task[0] = lcbasedir\n    task[1] = objectid\n    task[2] = {'aperture','postfix','sortby','normalize','outdir','recursive'}\n\n    '''\n\n    arg_1, arg_2, arg_3 = arg_0\n\n    try:\n        return concat_write_pklc(arg_1, arg_2, **arg_3)\n    except Exception as e:\n        LOGEXCEPTION('failed LC concatenation for %s in %s'\n                     % (arg_2, arg_1))\n        return None", "path": "astrobase/hatsurveys/hplc.py", "identifier": "parallel_concat_worker", "docstring": "This is a worker for the function below.\n\n    task[0] = lcbasedir\n    task[1] = objectid\n    task[2] = {'aperture','postfix','sortby','normalize','outdir','recursive'}", "docstring_tokens": ["This", "is", "a", "worker", "for", "the", "function", "below", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 259705}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L726-L762", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Get stdout from all the tasks of a workflow.", "language": "python", "parameters": "(self)", "return_statement": "return stdout_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "id", ":", "raise", "WorkflowError", "(", "'Workflow is not running.  Cannot get Func.'", ")", "if", "arg_0", ".", "batch_values", ":", "raise", "NotImplementedError", "(", "\"Query Each Workflow Id within the Batch Workflow for Func.\"", ")", "arg_1", "=", "arg_0", ".", "workflow", ".", "get", "(", "arg_0", ".", "id", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", "[", "'tasks'", "]", ":", "arg_2", ".", "append", "(", "{", "'id'", ":", "arg_3", "[", "'id'", "]", ",", "'taskType'", ":", "arg_3", "[", "'taskType'", "]", ",", "'name'", ":", "arg_3", "[", "'name'", "]", ",", "'Func'", ":", "arg_0", ".", "workflow", ".", "get_Func", "(", "arg_0", ".", "id", ",", "arg_3", "[", "'id'", "]", ")", "}", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        ''' Get Func from all the tasks of a workflow.\n\n        Returns:\n            (list): tasks with their Func\n        \n        Example:\n            >>> workflow.Func\n            [\n                {\n                    \"id\": \"4488895771403082552\",\n                    \"taskType\": \"AOP_Strip_Processor\",\n                    \"name\": \"Task1\",\n                    \"Func\": \"............\"\n                }\n            ]\n\n        '''\n        if not arg_0.id:\n            raise WorkflowError('Workflow is not running.  Cannot get Func.')\n        if arg_0.batch_values:\n            raise NotImplementedError(\"Query Each Workflow Id within the Batch Workflow for Func.\")\n\n        arg_1 = arg_0.workflow.get(arg_0.id)\n\n        arg_2 = []\n        for arg_3 in arg_1['tasks']:\n            arg_2.append(\n                {\n                    'id': arg_3['id'],\n                    'taskType': arg_3['taskType'],\n                    'name': arg_3['name'],\n                    'Func': arg_0.workflow.get_Func(arg_0.id, arg_3['id'])\n                }\n            )\n\n        return arg_2", "path": "gbdxtools/simpleworkflows.py", "identifier": "Workflow.stdout", "docstring": "Get stdout from all the tasks of a workflow.\n\n        Returns:\n            (list): tasks with their stdout\n        \n        Example:\n            >>> workflow.stdout\n            [\n                {\n                    \"id\": \"4488895771403082552\",\n                    \"taskType\": \"AOP_Strip_Processor\",\n                    \"name\": \"Task1\",\n                    \"stdout\": \"............\"\n                }\n            ]", "docstring_tokens": ["Get", "stdout", "from", "all", "the", "tasks", "of", "a", "workflow", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 259706}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/validation.py#L85-L127", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Validate the content of the files for consistency. Validators can\n    look as deeply as needed into the files. dgit treats them all as\n    black boxes.", "language": "python", "parameters": "(repo, \n             validator_name=None, \n             filename=None, \n             rulesfiles=None,\n             args=[])", "return_statement": "return allresults", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "[", "]", ")", ":", "arg_5", "=", "plugins_get_mgr", "(", ")", "arg_6", "=", "instantiate", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_6", ":", "arg_9", "=", "arg_5", ".", "search", "(", "what", "=", "'validator'", ",", "name", "=", "arg_8", ")", "[", "'validator'", "]", "for", "arg_10", "in", "arg_9", ":", "arg_11", "=", "arg_5", ".", "get_by_key", "(", "'validator'", ",", "arg_10", ")", "arg_12", "=", "arg_11", ".", "evaluate", "(", "arg_0", ",", "arg_6", "[", "arg_8", "]", ",", "arg_4", ")", "arg_7", ".", "extend", "(", "arg_12", ")", "return", "arg_7"], "function": "def Func(arg_0, \n             arg_1=None, \n             arg_2=None, \n             arg_3=None,\n             arg_4=[]):\n    \"\"\"\n    Validate the content of the files for consistency. Validators can\n    look as deeply as needed into the files. dgit treats them all as\n    black boxes.\n\n    Parameters\n    ----------\n\n    repo: Repository object\n    validator_name: Name of validator, if any. If none, then all validators specified in dgit.json will be included.\n    filename: Pattern that specifies files that must be processed by the validators selected. If none, then the default specification in dgit.json is used.\n    rules: Pattern specifying the files that have rules that validators will use\n    show: Print the validation results on the terminal\n\n    Returns\n    -------\n\n    status: A list of dictionaries, each with target file processed, rules file applied, status of the validation and any error  message.\n    \"\"\"\n\n    arg_5 = plugins_get_mgr()\n\n    # Expand the specification. Now we have full file paths\n    arg_6 = instantiate(arg_0, arg_1, arg_2, arg_3)\n\n    # Run the validators with rules files...\n    arg_7 = []\n    for arg_8 in arg_6:\n\n        arg_9 = arg_5.search(what='validator',name=arg_8)['validator']\n        for arg_10 in arg_9:\n            arg_11 = arg_5.get_by_key('validator', arg_10)\n            arg_12 = arg_11.evaluate(arg_0, \n                                        arg_6[arg_8],\n                                        arg_4)\n            arg_7.extend(arg_12)\n\n    return arg_7", "path": "dgitcore/datasets/validation.py", "identifier": "validate", "docstring": "Validate the content of the files for consistency. Validators can\n    look as deeply as needed into the files. dgit treats them all as\n    black boxes.\n\n    Parameters\n    ----------\n\n    repo: Repository object\n    validator_name: Name of validator, if any. If none, then all validators specified in dgit.json will be included.\n    filename: Pattern that specifies files that must be processed by the validators selected. If none, then the default specification in dgit.json is used.\n    rules: Pattern specifying the files that have rules that validators will use\n    show: Print the validation results on the terminal\n\n    Returns\n    -------\n\n    status: A list of dictionaries, each with target file processed, rules file applied, status of the validation and any error  message.", "docstring_tokens": ["Validate", "the", "content", "of", "the", "files", "for", "consistency", ".", "Validators", "can", "look", "as", "deeply", "as", "needed", "into", "the", "files", ".", "dgit", "treats", "them", "all", "as", "black", "boxes", "."], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 259707}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L259-L284", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "r\"\"\"\n    Return the hyperbolic arc tangent of a waveform's dependent variable vector.", "language": "python", "parameters": "(wave)", "return_statement": "return _operation(wave, \"atanh\", \"\", np.arctanh)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "pexdoc", ".", "exh", ".", "addex", "(", "ValueError", ",", "\"Math domain error\"", ",", "bool", "(", "(", "min", "(", "arg_0", ".", "_dep_vector", ")", "<", "-", "1", ")", "or", "(", "max", "(", "arg_0", ".", "_dep_vector", ")", ">", "1", ")", ")", ",", ")", "return", "_operation", "(", "arg_0", ",", "\"Func\"", ",", "\"\"", ",", "np", ".", "arctanh", ")"], "function": "def Func(arg_0):\n    r\"\"\"\n    Return the hyperbolic arc tangent of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.Func\n\n    :raises:\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * ValueError (Math domain error)\n\n    .. [[[end]]]\n    \"\"\"\n    pexdoc.exh.addex(\n        ValueError,\n        \"Math domain error\",\n        bool((min(arg_0._dep_vector) < -1) or (max(arg_0._dep_vector) > 1)),\n    )\n    return _operation(arg_0, \"Func\", \"\", np.arctanh)", "path": "peng/wave_functions.py", "identifier": "atanh", "docstring": "r\"\"\"\n    Return the hyperbolic arc tangent of a waveform's dependent variable vector.\n\n    :param wave: Waveform\n    :type  wave: :py:class:`peng.eng.Waveform`\n\n    :rtype: :py:class:`peng.eng.Waveform`\n\n    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]\n    .. Auto-generated exceptions documentation for\n    .. peng.wave_functions.atanh\n\n    :raises:\n     * RuntimeError (Argument \\`wave\\` is not valid)\n\n     * ValueError (Math domain error)\n\n    .. [[[end]]]", "docstring_tokens": ["r", "Return", "the", "hyperbolic", "arc", "tangent", "of", "a", "waveform", "s", "dependent", "variable", "vector", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 259708}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/feature_extractor.py#L190-L222", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Generates prompt based features from an essay set object and internal prompt variable.\n        Generally called internally by gen_feats\n        Returns an array of prompt features\n        e_set - EssaySet object", "language": "python", "parameters": "(self, e_set)", "return_statement": "return prompt_arr.copy()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "nltk", ".", "word_tokenize", "(", "arg_1", ".", "_prompt", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "arg_5", "=", "util_functions", ".", "get_wordnet_syns", "(", "arg_4", ")", "arg_3", ".", "append", "(", "arg_5", ")", "arg_3", "=", "list", "(", "chain", ".", "from_iterable", "(", "arg_3", ")", ")", "arg_6", "=", "[", "]", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_1", ".", "_tokens", ":", "arg_9", "=", "len", "(", "arg_8", ")", "if", "(", "arg_9", "==", "0", ")", ":", "arg_9", "=", "1", "arg_6", ".", "append", "(", "len", "(", "[", "arg_10", "for", "arg_10", "in", "arg_8", "if", "arg_10", "in", "arg_2", "]", ")", ")", "arg_7", ".", "append", "(", "arg_6", "[", "len", "(", "arg_6", ")", "-", "1", "]", "/", "float", "(", "arg_9", ")", ")", "arg_11", "=", "[", "]", "arg_12", "=", "[", "]", "for", "arg_8", "in", "arg_1", ".", "_tokens", ":", "arg_9", "=", "len", "(", "arg_8", ")", "if", "(", "arg_9", "==", "0", ")", ":", "arg_9", "=", "1", "arg_11", ".", "append", "(", "len", "(", "[", "arg_10", "for", "arg_10", "in", "arg_8", "if", "arg_10", "in", "arg_3", "]", ")", ")", "arg_12", ".", "append", "(", "arg_11", "[", "len", "(", "arg_11", ")", "-", "1", "]", "/", "float", "(", "arg_9", ")", ")", "arg_13", "=", "numpy", ".", "array", "(", "(", "arg_6", ",", "arg_7", ",", "arg_11", ",", "arg_12", ")", ")", ".", "transpose", "(", ")", "return", "arg_13", ".", "copy", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Generates prompt based features from an essay set object and internal prompt variable.\n        Generally called internally by gen_feats\n        Returns an array of prompt features\n        e_set - EssaySet object\n        \"\"\"\n        arg_2 = nltk.word_tokenize(arg_1._prompt)\n        arg_3 = []\n        for arg_4 in arg_2:\n            arg_5 = util_functions.get_wordnet_syns(arg_4)\n            arg_3.append(arg_5)\n        arg_3 = list(chain.from_iterable(arg_3))\n        arg_6 = []\n        arg_7 = []\n        for arg_8 in arg_1._tokens:\n            arg_9=len(arg_8)\n            if(arg_9==0):\n                arg_9=1\n            arg_6.append(len([arg_10 for arg_10 in arg_8 if arg_10 in arg_2]))\n            arg_7.append(arg_6[len(arg_6) - 1] / float(arg_9))\n        arg_11 = []\n        arg_12 = []\n        for arg_8 in arg_1._tokens:\n            arg_9=len(arg_8)\n            if(arg_9==0):\n                arg_9=1\n            arg_11.append(len([arg_10 for arg_10 in arg_8 if arg_10 in arg_3]))\n            arg_12.append(arg_11[len(arg_11) - 1] / float(arg_9))\n\n        arg_13 = numpy.array((arg_6, arg_7, arg_11, arg_12)).transpose()\n\n        return arg_13.copy()", "path": "ease/feature_extractor.py", "identifier": "FeatureExtractor.gen_prompt_feats", "docstring": "Generates prompt based features from an essay set object and internal prompt variable.\n        Generally called internally by gen_feats\n        Returns an array of prompt features\n        e_set - EssaySet object", "docstring_tokens": ["Generates", "prompt", "based", "features", "from", "an", "essay", "set", "object", "and", "internal", "prompt", "variable", ".", "Generally", "called", "internally", "by", "gen_feats", "Returns", "an", "array", "of", "prompt", "features", "e_set", "-", "EssaySet", "object"], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 259709}
{"url": "https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L577-L583", "sha": "8170e431362dc760589f7d141090fd133dece259", "docstring_summary": "Returns fields metadata as a dataframe.", "language": "python", "parameters": "(self)", "return_statement": "return (pd.concat([f.metadata() for f in self.fields], axis = 1)\n            .transpose()\n            .sort_values([\"step_num\", \"frame\", \"label\", \"position\"]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "pd", ".", "concat", "(", "[", "arg_1", ".", "metadata", "(", ")", "for", "arg_1", "in", "arg_0", ".", "fields", "]", ",", "axis", "=", "1", ")", ".", "transpose", "(", ")", ".", "sort_values", "(", "[", "\"step_num\"", ",", "\"frame\"", ",", "\"label\"", ",", "\"position\"", "]", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns fields metadata as a dataframe.\n    \"\"\"  \n    return (pd.concat([arg_1.metadata() for arg_1 in arg_0.fields], axis = 1)\n            .transpose()\n            .sort_values([\"step_num\", \"frame\", \"label\", \"position\"]))", "path": "argiope/mesh.py", "identifier": "Mesh.fields_metadata", "docstring": "Returns fields metadata as a dataframe.", "docstring_tokens": ["Returns", "fields", "metadata", "as", "a", "dataframe", "."], "nwo": "lcharleux/argiope", "score": 0.17185066990864498, "idx": 259710}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py#L248-L260", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Deletes an Azure SQL Database server firewall rule.", "language": "python", "parameters": "(self, server_name, name)", "return_statement": "return self._perform_delete(\n            self._get_firewall_rules_path(server_name, name))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "_validate_not_none", "(", "'server_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'name'", ",", "arg_2", ")", "return", "arg_0", ".", "_perform_delete", "(", "arg_0", ".", "_get_firewall_rules_path", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Deletes an Azure SQL Database server firewall rule.\n\n        server_name:\n            Name of the server with the firewall rule you want to delete.\n        name:\n            Name of the firewall rule you want to delete.\n        '''\n        _validate_not_none('server_name', arg_1)\n        _validate_not_none('name', arg_2)\n        return arg_0._perform_delete(\n            arg_0._get_firewall_rules_path(arg_1, arg_2))", "path": "azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py", "identifier": "SqlDatabaseManagementService.delete_firewall_rule", "docstring": "Deletes an Azure SQL Database server firewall rule.\n\n        server_name:\n            Name of the server with the firewall rule you want to delete.\n        name:\n            Name of the firewall rule you want to delete.", "docstring_tokens": ["Deletes", "an", "Azure", "SQL", "Database", "server", "firewall", "rule", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259711}
{"url": "https://github.com/rollbar/pyrollbar/blob/33ef2e723a33d09dd6302f978f4a3908be95b9d2/rollbar/__init__.py#L291-L370", "sha": "33ef2e723a33d09dd6302f978f4a3908be95b9d2", "docstring_summary": "Saves configuration variables in this module's SETTINGS.", "language": "python", "parameters": "(access_token, environment='production', scrub_fields=None, url_fields=None, **kw)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'production'", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "global", "arg_5", ",", "arg_6", ",", "arg_12", ",", "arg_8", ",", "arg_7", ",", "arg_11", "if", "arg_2", "is", "not", "None", ":", "arg_5", "[", "'scrub_fields'", "]", "=", "list", "(", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_5", "[", "'url_fields'", "]", "=", "list", "(", "arg_3", ")", "arg_5", "=", "dict_merge", "(", "arg_5", ",", "arg_4", ")", "if", "arg_12", ":", "if", "not", "arg_5", ".", "get", "(", "'suppress_reFunc_warning'", ")", ":", "log", ".", "warning", "(", "'Rollbar already Funcialized. Ignoring re-Func.'", ")", "return", "arg_5", "[", "'access_token'", "]", "=", "arg_0", "arg_5", "[", "'environment'", "]", "=", "arg_1", "if", "arg_5", ".", "get", "(", "'allow_logging_basic_config'", ")", ":", "logging", ".", "basicConfig", "(", ")", "if", "arg_5", ".", "get", "(", "'handler'", ")", "==", "'agent'", ":", "arg_6", "=", "_create_agent_log", "(", ")", "arg_7", "=", "SerializableTransform", "(", "safe_repr", "=", "arg_5", "[", "'locals'", "]", "[", "'safe_repr'", "]", ",", "whitelist_types", "=", "arg_5", "[", "'locals'", "]", "[", "'whitelisted_types'", "]", ")", "arg_8", "=", "[", "ScrubRedactTransform", "(", ")", ",", "arg_7", ",", "ScrubTransform", "(", "suffixes", "=", "[", "(", "field", ",", ")", "for", "field", "in", "arg_5", "[", "'scrub_fields'", "]", "]", ",", "redact_char", "=", "'*'", ")", ",", "ScrubUrlTransform", "(", "suffixes", "=", "[", "(", "field", ",", ")", "for", "field", "in", "arg_5", "[", "'url_fields'", "]", "]", ",", "params_to_scrub", "=", "arg_5", "[", "'scrub_fields'", "]", ")", "]", "arg_9", "=", "[", "(", "'request'", ",", "'POST'", ")", ",", "(", "'request'", ",", "'json'", ")", ",", "(", "'body'", ",", "'request'", ",", "'POST'", ")", ",", "(", "'body'", ",", "'request'", ",", "'json'", ")", ",", "]", "if", "arg_5", "[", "'locals'", "]", "[", "'enabled'", "]", ":", "arg_9", ".", "append", "(", "(", "'body'", ",", "'trace'", ",", "'frames'", ",", "'*'", ",", "'code'", ")", ")", "arg_9", ".", "append", "(", "(", "'body'", ",", "'trace'", ",", "'frames'", ",", "'*'", ",", "'args'", ",", "'*'", ")", ")", "arg_9", ".", "append", "(", "(", "'body'", ",", "'trace'", ",", "'frames'", ",", "'*'", ",", "'kwargs'", ",", "'*'", ")", ")", "arg_9", ".", "append", "(", "(", "'body'", ",", "'trace'", ",", "'frames'", ",", "'*'", ",", "'locals'", ",", "'*'", ")", ")", "arg_9", ".", "extend", "(", "arg_5", "[", "'shortener_keys'", "]", ")", "arg_10", "=", "ShortenerTransform", "(", "safe_repr", "=", "arg_5", "[", "'locals'", "]", "[", "'safe_repr'", "]", ",", "keys", "=", "arg_9", ",", "**", "arg_5", "[", "'locals'", "]", "[", "'sizes'", "]", ")", "arg_8", ".", "append", "(", "arg_10", ")", "arg_11", "=", "queue", ".", "Queue", "(", ")", "events", ".", "reset", "(", ")", "filters", ".", "add_builtin_filters", "(", "arg_5", ")", "arg_12", "=", "True"], "function": "def Func(arg_0, arg_1='production', arg_2=None, arg_3=None, **arg_4):\n    \"\"\"\n    Saves configuration variables in this module's SETTINGS.\n\n    access_token: project access token. Get this from the Rollbar UI:\n                  - click \"Settings\" in the top nav\n                  - click \"Projects\" in the left nav\n                  - copy-paste the appropriate token.\n    environment: environment name. Can be any string; suggestions: 'production', 'development',\n                 'staging', 'yourname'\n    **kw: provided keyword arguments will override keys in SETTINGS.\n    \"\"\"\n    global arg_5, arg_6, arg_12, arg_8, arg_7, arg_11\n\n    if arg_2 is not None:\n       arg_5['scrub_fields'] = list(arg_2)\n    if arg_3 is not None:\n       arg_5['url_fields'] = list(arg_3)\n\n    # Merge the extra config settings into SETTINGS\n    arg_5 = dict_merge(arg_5, arg_4)\n    if arg_12:\n        # NOTE: Temp solution to not being able to re-Func.\n        # New versions of pyrollbar will support re-Funcialization\n        # via the (not-yet-implemented) configure() method.\n        if not arg_5.get('suppress_reFunc_warning'):\n            log.warning('Rollbar already Funcialized. Ignoring re-Func.')\n        return\n\n    arg_5['access_token'] = arg_0\n    arg_5['environment'] = arg_1\n\n    if arg_5.get('allow_logging_basic_config'):\n        logging.basicConfig()\n\n    if arg_5.get('handler') == 'agent':\n        arg_6 = _create_agent_log()\n\n    # We will perform these transforms in order:\n    # 1. Serialize the payload to be all python built-in objects\n    # 2. Scrub the payloads based on the key suffixes in SETTINGS['scrub_fields']\n    # 3. Scrub URLs in the payload for keys that end with 'url'\n    # 4. Optional - If local variable gathering is enabled, transform the\n    #       trace frame values using the ShortReprTransform.\n    arg_7 = SerializableTransform(safe_repr=arg_5['locals']['safe_repr'],\n                                                 whitelist_types=arg_5['locals']['whitelisted_types'])\n    arg_8 = [\n        ScrubRedactTransform(),\n        arg_7,\n        ScrubTransform(suffixes=[(field,) for field in arg_5['scrub_fields']], redact_char='*'),\n        ScrubUrlTransform(suffixes=[(field,) for field in arg_5['url_fields']], params_to_scrub=arg_5['scrub_fields'])\n    ]\n\n    # A list of key prefixes to apply our shortener transform to. The request\n    # being included in the body key is old behavior and is being retained for\n    # backwards compatibility.\n    arg_9 = [\n        ('request', 'POST'),\n        ('request', 'json'),\n        ('body', 'request', 'POST'),\n        ('body', 'request', 'json'),\n    ]\n\n    if arg_5['locals']['enabled']:\n        arg_9.append(('body', 'trace', 'frames', '*', 'code'))\n        arg_9.append(('body', 'trace', 'frames', '*', 'args', '*'))\n        arg_9.append(('body', 'trace', 'frames', '*', 'kwargs', '*'))\n        arg_9.append(('body', 'trace', 'frames', '*', 'locals', '*'))\n\n    arg_9.extend(arg_5['shortener_keys'])\n\n    arg_10 = ShortenerTransform(safe_repr=arg_5['locals']['safe_repr'],\n                                   keys=arg_9,\n                                   **arg_5['locals']['sizes'])\n    arg_8.append(arg_10)\n    arg_11 = queue.Queue()\n    events.reset()\n    filters.add_builtin_filters(arg_5)\n\n    arg_12 = True", "path": "rollbar/__init__.py", "identifier": "init", "docstring": "Saves configuration variables in this module's SETTINGS.\n\n    access_token: project access token. Get this from the Rollbar UI:\n                  - click \"Settings\" in the top nav\n                  - click \"Projects\" in the left nav\n                  - copy-paste the appropriate token.\n    environment: environment name. Can be any string; suggestions: 'production', 'development',\n                 'staging', 'yourname'\n    **kw: provided keyword arguments will override keys in SETTINGS.", "docstring_tokens": ["Saves", "configuration", "variables", "in", "this", "module", "s", "SETTINGS", "."], "nwo": "rollbar/pyrollbar", "score": 0.8439078507967885, "idx": 259712}
{"url": "https://github.com/makeev/django-boolean-switch/blob/ed740dbb56d0bb1ad20d4b1e124055283b0e932f/boolean_switch/admin.py#L44-L58", "sha": "ed740dbb56d0bb1ad20d4b1e124055283b0e932f", "docstring_summary": "Return a sequence containing the fields to be displayed on the\n        changelist.", "language": "python", "parameters": "(self, request)", "return_statement": "return list_display", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "list_display", ":", "try", ":", "arg_4", "=", "arg_0", ".", "model", ".", "_meta", ".", "get_field", "(", "arg_3", ")", "if", "isinstance", "(", "arg_4", ",", "BooleanField", ")", ":", "arg_3", "=", "boolean_switch_field", "(", "arg_4", ")", "except", "FieldDoesNotExist", ":", "pass", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a sequence containing the fields to be displayed on the\n        changelist.\n        \"\"\"\n        arg_2 = []\n        for arg_3 in arg_0.list_display:\n            try:\n                arg_4 = arg_0.model._meta.get_field(arg_3)\n                if isinstance(arg_4, BooleanField):\n                    arg_3 = boolean_switch_field(arg_4)\n            except FieldDoesNotExist:\n                pass\n            arg_2.append(arg_3)\n        return arg_2", "path": "boolean_switch/admin.py", "identifier": "AdminBooleanMixin.get_list_display", "docstring": "Return a sequence containing the fields to be displayed on the\n        changelist.", "docstring_tokens": ["Return", "a", "sequence", "containing", "the", "fields", "to", "be", "displayed", "on", "the", "changelist", "."], "nwo": "makeev/django-boolean-switch", "score": 0.25890992733444657, "idx": 259713}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2780-L2815", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Serial call to read month tariffs block into meter object buffer.", "language": "python", "parameters": "(self, months_type)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "setContext", "(", "\"Func\"", ")", "try", ":", "arg_2", "=", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", ")", ".", "zfill", "(", "1", ")", ")", "arg_3", "=", "\"01523102303031\"", "+", "arg_2", "+", "\"282903\"", "arg_4", "=", "arg_0", ".", "m_mons", "if", "arg_1", "==", "ReadMonths", ".", "kWhReverse", ":", "arg_4", "=", "arg_0", ".", "m_rev_mons", "arg_0", ".", "request", "(", "False", ")", "arg_5", "=", "arg_0", ".", "calc_crc16", "(", "arg_3", "[", "2", ":", "]", ".", "decode", "(", "\"hex\"", ")", ")", "arg_3", "+=", "arg_5", "arg_0", ".", "m_serial_port", ".", "write", "(", "arg_3", ".", "decode", "(", "\"hex\"", ")", ")", "arg_6", "=", "arg_0", ".", "m_serial_port", ".", "getResponse", "(", "arg_0", ".", "getContext", "(", ")", ")", "arg_0", ".", "serialPostEnd", "(", ")", "arg_7", "=", "arg_0", ".", "unpackStruct", "(", "arg_6", ",", "arg_4", ")", "arg_0", ".", "convertData", "(", "arg_7", ",", "arg_4", ",", "arg_0", ".", "m_kwh_precision", ")", "arg_8", "=", "arg_0", ".", "calc_crc16", "(", "arg_6", "[", "1", ":", "-", "2", "]", ")", "if", "str", "(", "arg_8", ")", "==", "str", "(", "arg_4", "[", "\"crc16\"", "]", "[", "MeterData", ".", "StringValue", "]", ")", ":", "ekm_log", "(", "\"Months CRC success, type = \"", "+", "str", "(", "arg_2", ")", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "True", "except", ":", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ".", "exc_info", "(", ")", ")", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Serial call to read month tariffs block into meter object buffer.\n\n        Args:\n            months_type (int): A :class:`~ekmmeters.ReadMonths` value.\n\n        Returns:\n            bool: True on completion.\n        \"\"\"\n        arg_0.setContext(\"Func\")\n        try:\n\n            arg_2 = binascii.hexlify(str(arg_1).zfill(1))\n            arg_3 = \"01523102303031\" + arg_2 + \"282903\"\n            arg_4 = arg_0.m_mons\n            if arg_1 == ReadMonths.kWhReverse:\n                arg_4 = arg_0.m_rev_mons\n\n            arg_0.request(False)\n            arg_5 = arg_0.calc_crc16(arg_3[2:].decode(\"hex\"))\n            arg_3 += arg_5\n            arg_0.m_serial_port.write(arg_3.decode(\"hex\"))\n            arg_6 = arg_0.m_serial_port.getResponse(arg_0.getContext())\n            arg_0.serialPostEnd()\n            arg_7 = arg_0.unpackStruct(arg_6, arg_4)\n            arg_0.convertData(arg_7, arg_4, arg_0.m_kwh_precision)\n            arg_8 = arg_0.calc_crc16(arg_6[1:-2])\n            if str(arg_8) == str(arg_4[\"crc16\"][MeterData.StringValue]):\n                ekm_log(\"Months CRC success, type = \" + str(arg_2))\n                arg_0.setContext(\"\")\n                return True\n        except:\n            ekm_log(traceback.format_exc(sys.exc_info()))\n\n        arg_0.setContext(\"\")\n        return False", "path": "ekmmeters.py", "identifier": "Meter.readMonthTariffs", "docstring": "Serial call to read month tariffs block into meter object buffer.\n\n        Args:\n            months_type (int): A :class:`~ekmmeters.ReadMonths` value.\n\n        Returns:\n            bool: True on completion.", "docstring_tokens": ["Serial", "call", "to", "read", "month", "tariffs", "block", "into", "meter", "object", "buffer", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 259714}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/vlrlist.py#L223-L247", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Reads vlrs and parse them if possible from the stream", "language": "python", "parameters": "(cls, data_stream, num_to_read)", "return_statement": "return vlrlist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", ")", "for", "arg_4", "in", "range", "(", "arg_2", ")", ":", "arg_5", "=", "RawVLR", ".", "Func", "(", "arg_1", ")", "try", ":", "arg_3", ".", "append", "(", "vlr_factory", "(", "arg_5", ")", ")", "except", "UnicodeDecodeError", ":", "logger", ".", "error", "(", "\"Failed to decode VLR: {}\"", ".", "format", "(", "arg_5", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Reads vlrs and parse them if possible from the stream\n\n        Parameters\n        ----------\n        data_stream : io.BytesIO\n                      stream to read from\n        num_to_read : int\n                      number of vlrs to be read\n\n        Returns\n        -------\n        pylas.vlrs.vlrlist.VLRList\n            List of vlrs\n\n        \"\"\"\n        arg_3 = arg_0()\n        for arg_4 in range(arg_2):\n            arg_5 = RawVLR.Func(arg_1)\n            try:\n                arg_3.append(vlr_factory(arg_5))\n            except UnicodeDecodeError:\n                logger.error(\"Failed to decode VLR: {}\".format(arg_5))\n\n        return arg_3", "path": "pylas/vlrs/vlrlist.py", "identifier": "VLRList.read_from", "docstring": "Reads vlrs and parse them if possible from the stream\n\n        Parameters\n        ----------\n        data_stream : io.BytesIO\n                      stream to read from\n        num_to_read : int\n                      number of vlrs to be read\n\n        Returns\n        -------\n        pylas.vlrs.vlrlist.VLRList\n            List of vlrs", "docstring_tokens": ["Reads", "vlrs", "and", "parse", "them", "if", "possible", "from", "the", "stream"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 259715}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/zkstatemanager.py#L119-L138", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to get topologies with\n    a callback. The future watch is placed\n    only if isWatching is True.", "language": "python", "parameters": "(self, callback, isWatching)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_topologies_path", "(", ")", "if", "arg_2", ":", "LOG", ".", "info", "(", "\"Adding children watch for path: \"", "+", "arg_3", ")", "@", "arg_0", ".", "client", ".", "ChildrenWatch", "(", "arg_3", ")", "def", "watch_topologies", "(", "arg_4", ")", ":", "arg_1", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Helper function to get topologies with\n    a callback. The future watch is placed\n    only if isWatching is True.\n    \"\"\"\n    arg_3 = arg_0.get_topologies_path()\n    if arg_2:\n      LOG.info(\"Adding children watch for path: \" + arg_3)\n\n    # pylint: disable=unused-variable\n    @arg_0.client.ChildrenWatch(arg_3)\n    def watch_topologies(arg_4):\n      \"\"\" callback to watch topologies \"\"\"\n      arg_1(arg_4)\n\n      # Returning False will result in no future watches\n      # being triggered. If isWatching is True, then\n      # the future watches will be triggered.\n      return arg_2", "path": "heron/statemgrs/src/python/zkstatemanager.py", "identifier": "ZkStateManager._get_topologies_with_watch", "docstring": "Helper function to get topologies with\n    a callback. The future watch is placed\n    only if isWatching is True.", "docstring_tokens": ["Helper", "function", "to", "get", "topologies", "with", "a", "callback", ".", "The", "future", "watch", "is", "placed", "only", "if", "isWatching", "is", "True", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259716}
{"url": "https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L124-L130", "sha": "e5a0d908df8c93ff1ee7abdda8875fd1667df53d", "docstring_summary": "Add keyboard shortcuts to navigate the filesystem.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_upShortcut", "=", "QtGui", ".", "QShortcut", "(", "QtGui", ".", "QKeySequence", "(", "'Backspace'", ")", ",", "arg_0", ")", "arg_0", ".", "_upShortcut", ".", "setAutoRepeat", "(", "False", ")", "arg_0", ".", "_upShortcut", ".", "activated", ".", "connect", "(", "arg_0", ".", "_onNavigateUpButtonClicked", ")"], "function": "def Func(arg_0):\n        '''Add keyboard shortcuts to navigate the filesystem.'''\n        arg_0._upShortcut = QtGui.QShortcut(\n            QtGui.QKeySequence('Backspace'), arg_0\n        )\n        arg_0._upShortcut.setAutoRepeat(False)\n        arg_0._upShortcut.activated.connect(arg_0._onNavigateUpButtonClicked)", "path": "source/riffle/browser.py", "identifier": "FilesystemBrowser._configureShortcuts", "docstring": "Add keyboard shortcuts to navigate the filesystem.", "docstring_tokens": ["Add", "keyboard", "shortcuts", "to", "navigate", "the", "filesystem", "."], "nwo": "4degrees/riffle", "score": 0.2663827826706725, "idx": 259717}
{"url": "https://github.com/mshroyer/pointfree/blob/a25ecb3f0cd583e0730ecdde83018e5089711854/pointfree.py#L364-L395", "sha": "a25ecb3f0cd583e0730ecdde83018e5089711854", "docstring_summary": "Extract function signature, default arguments, keyword-only\n        arguments, and whether or not variable positional or keyword\n        arguments are allowed.  This also supports calling unbound instance\n        methods by passing an object instance as the first argument;\n        however, unbound classmethod and staticmethod objects are not\n        callable, so we do not attempt to support them here.", "language": "python", "parameters": "(self, func)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "types", ".", "MethodType", ")", ":", "arg_2", "=", "getfullargspec", "(", "arg_1", ".", "__func__", ")", "arg_0", ".", "pargl", "=", "arg_2", "[", "0", "]", "[", "1", ":", "]", "else", ":", "arg_2", "=", "getfullargspec", "(", "arg_1", ")", "arg_0", ".", "pargl", "=", "arg_2", "[", "0", "]", "[", ":", "]", "if", "arg_2", "[", "3", "]", "is", "not", "None", ":", "arg_4", "=", "len", "(", "arg_0", ".", "pargl", ")", "-", "len", "(", "arg_2", "[", "3", "]", ")", "arg_0", ".", "def_argv", "=", "dict", "(", "(", "arg_0", ".", "pargl", "[", "arg_4", "+", "i", "]", ",", "arg_2", "[", "3", "]", "[", "i", "]", ")", "for", "i", "in", "range", "(", "len", "(", "arg_2", "[", "3", "]", ")", ")", ")", "else", ":", "arg_0", ".", "def_argv", "=", "{", "}", "arg_0", ".", "var_pargs", "=", "arg_2", "[", "1", "]", "is", "not", "None", "arg_0", ".", "var_kargs", "=", "arg_2", "[", "2", "]", "is", "not", "None", "arg_0", ".", "kargl", "=", "arg_2", "[", "4", "]", "if", "arg_2", "[", "5", "]", "is", "not", "None", ":", "arg_0", ".", "def_argv", ".", "update", "(", "arg_2", "[", "5", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Extract function signature, default arguments, keyword-only\n        arguments, and whether or not variable positional or keyword\n        arguments are allowed.  This also supports calling unbound instance\n        methods by passing an object instance as the first argument;\n        however, unbound classmethod and staticmethod objects are not\n        callable, so we do not attempt to support them here.\"\"\"\n\n        if isinstance(arg_1, types.MethodType):\n            # A bound instance or class method.\n            arg_2 = getfullargspec(arg_1.__func__)\n            arg_0.pargl = arg_2[0][1:]\n        else:\n            # A regular function, an unbound instance method, or a\n            # bound static method.\n            arg_2 = getfullargspec(arg_1)\n            arg_0.pargl = arg_2[0][:]\n\n        if arg_2[3] is not None:\n            arg_4 = len(arg_0.pargl) - len(arg_2[3])\n            arg_0.def_argv = dict((arg_0.pargl[arg_4+i],arg_2[3][i]) \\\n                                     for i in range(len(arg_2[3])))\n        else:\n            arg_0.def_argv = {}\n\n        arg_0.var_pargs = arg_2[1] is not None\n        arg_0.var_kargs = arg_2[2] is not None\n        arg_0.kargl     = arg_2[4]\n\n        # We need keyword-only arguments' default values too.\n        if arg_2[5] is not None:\n            arg_0.def_argv.update(arg_2[5])", "path": "pointfree.py", "identifier": "partial.__sig_from_func", "docstring": "Extract function signature, default arguments, keyword-only\n        arguments, and whether or not variable positional or keyword\n        arguments are allowed.  This also supports calling unbound instance\n        methods by passing an object instance as the first argument;\n        however, unbound classmethod and staticmethod objects are not\n        callable, so we do not attempt to support them here.", "docstring_tokens": ["Extract", "function", "signature", "default", "arguments", "keyword", "-", "only", "arguments", "and", "whether", "or", "not", "variable", "positional", "or", "keyword", "arguments", "are", "allowed", ".", "This", "also", "supports", "calling", "unbound", "instance", "methods", "by", "passing", "an", "object", "instance", "as", "the", "first", "argument", ";", "however", "unbound", "classmethod", "and", "staticmethod", "objects", "are", "not", "callable", "so", "we", "do", "not", "attempt", "to", "support", "them", "here", "."], "nwo": "mshroyer/pointfree", "score": 0.21302904236143622, "idx": 259718}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/layout.py#L214-L216", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Fill entire strip by giving individual RGB values instead of tuple", "language": "python", "parameters": "(self, r, g, b, start=0, end=-1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ",", "arg_5", "=", "-", "1", ")", ":", "arg_0", ".", "fill", "(", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0, arg_5=-1):\n        \"\"\"Fill entire strip by giving individual RGB values instead of tuple\"\"\"\n        arg_0.fill((arg_1, arg_2, arg_3), arg_4, arg_5)", "path": "bibliopixel/layout/layout.py", "identifier": "Layout.fillRGB", "docstring": "Fill entire strip by giving individual RGB values instead of tuple", "docstring_tokens": ["Fill", "entire", "strip", "by", "giving", "individual", "RGB", "values", "instead", "of", "tuple"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 259719}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L116-L181", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Bi directional recurrent neural network. GRU or LSTM", "language": "python", "parameters": "(units: tf.Tensor,\n           n_hidden: List,\n           cell_type='gru',\n           seq_lengths=None,\n           trainable_initial_states=False,\n           use_peepholes=False,\n           name='Bi-')", "return_statement": "return (rnn_output_fw, rnn_output_bw), (fw, bw)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "Tensor", ",", "arg_3", ":", "arg_4", ",", "arg_5", "=", "'gru'", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "False", ",", "arg_9", "=", "'Bi-'", ")", ":", "with", "arg_1", ".", "variable_scope", "(", "arg_9", "+", "'_'", "+", "arg_5", ".", "upper", "(", ")", ")", ":", "if", "arg_5", "==", "'gru'", ":", "arg_10", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "GRUCell", "(", "arg_3", ",", "kernel_initializer", "=", "INITIALIZER", "(", ")", ")", "arg_11", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "GRUCell", "(", "arg_3", ",", "kernel_initializer", "=", "INITIALIZER", "(", ")", ")", "if", "arg_7", ":", "arg_12", "=", "arg_1", ".", "tile", "(", "arg_1", ".", "get_variable", "(", "'init_fw_h'", ",", "[", "1", ",", "arg_3", "]", ")", ",", "(", "arg_1", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", "arg_13", "=", "arg_1", ".", "tile", "(", "arg_1", ".", "get_variable", "(", "'init_bw_h'", ",", "[", "1", ",", "arg_3", "]", ")", ",", "(", "arg_1", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", "else", ":", "arg_12", "=", "arg_13", "=", "None", "elif", "arg_5", "==", "'lstm'", ":", "arg_10", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "LSTMCell", "(", "arg_3", ",", "arg_8", "=", "arg_8", ",", "initializer", "=", "INITIALIZER", "(", ")", ")", "arg_11", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "LSTMCell", "(", "arg_3", ",", "arg_8", "=", "arg_8", ",", "initializer", "=", "INITIALIZER", "(", ")", ")", "if", "arg_7", ":", "arg_12", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "LSTMStateTuple", "(", "arg_1", ".", "tile", "(", "arg_1", ".", "get_variable", "(", "'init_fw_c'", ",", "[", "1", ",", "arg_3", "]", ")", ",", "(", "arg_1", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", ",", "arg_1", ".", "tile", "(", "arg_1", ".", "get_variable", "(", "'init_fw_h'", ",", "[", "1", ",", "arg_3", "]", ")", ",", "(", "arg_1", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", ")", "arg_13", "=", "arg_1", ".", "nn", ".", "rnn_cell", ".", "LSTMStateTuple", "(", "arg_1", ".", "tile", "(", "arg_1", ".", "get_variable", "(", "'init_bw_c'", ",", "[", "1", ",", "arg_3", "]", ")", ",", "(", "arg_1", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", ",", "arg_1", ".", "tile", "(", "arg_1", ".", "get_variable", "(", "'init_bw_h'", ",", "[", "1", ",", "arg_3", "]", ")", ",", "(", "arg_1", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", ")", "else", ":", "arg_12", "=", "arg_13", "=", "None", "else", ":", "raise", "RuntimeError", "(", "'cell_type must be either \"gru\" or \"lstm\"s'", ")", "(", "arg_14", ",", "arg_15", ")", ",", "(", "arg_16", ",", "arg_17", ")", "=", "arg_1", ".", "nn", ".", "bidirectional_dynamic_rnn", "(", "arg_10", ",", "arg_11", ",", "arg_0", ",", "dtype", "=", "arg_1", ".", "float32", ",", "sequence_length", "=", "arg_6", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ")", "arg_18", "=", "[", "var", "for", "var", "in", "arg_10", ".", "trainable_variables", "+", "arg_11", ".", "trainable_variables", "if", "'kernel'", "in", "var", ".", "name", "]", "for", "arg_19", "in", "arg_18", ":", "arg_1", ".", "add_to_collection", "(", "arg_1", ".", "GraphKeys", ".", "REGULARIZATION_LOSSES", ",", "arg_1", ".", "nn", ".", "l2_loss", "(", "arg_19", ")", ")", "return", "(", "arg_14", ",", "arg_15", ")", ",", "(", "arg_16", ",", "arg_17", ")"], "function": "def Func(arg_0: arg_1.Tensor,\n           arg_3: arg_4,\n           arg_5='gru',\n           arg_6=None,\n           arg_7=False,\n           arg_8=False,\n           arg_9='Bi-'):\n    \"\"\" Bi directional recurrent neural network. GRU or LSTM\n\n        Args:\n            units: a tensorflow tensor with dimensionality [None, n_tokens, n_features]\n            n_hidden: list with number of hidden units at the ouput of each layer\n            seq_lengths: length of sequences for different length sequences in batch\n                can be None for maximum length as a length for every sample in the batch\n            cell_type: 'lstm' or 'gru'\n            trainable_initial_states: whether to create a special trainable variable\n                to initialize the hidden states of the network or use just zeros\n            use_peepholes: whether to use peephole connections (only 'lstm' case affected)\n            name: what variable_scope to use for the network parameters\n\n        Returns:\n            units: tensor at the output of the last recurrent layer\n                with dimensionality [None, n_tokens, n_hidden_list[-1]]\n            last_units: tensor of last hidden states for GRU and tuple\n                of last hidden stated and last cell states for LSTM\n                dimensionality of cell states and hidden states are\n                similar and equal to [B x 2 * H], where B - batch\n                size and H is number of hidden units\n    \"\"\"\n\n    with arg_1.variable_scope(arg_9 + '_' + arg_5.upper()):\n        if arg_5 == 'gru':\n            arg_10 = arg_1.nn.rnn_cell.GRUCell(arg_3, kernel_initializer=INITIALIZER())\n            arg_11 = arg_1.nn.rnn_cell.GRUCell(arg_3, kernel_initializer=INITIALIZER())\n            if arg_7:\n                arg_12 = arg_1.tile(arg_1.get_variable('init_fw_h', [1, arg_3]), (arg_1.shape(arg_0)[0], 1))\n                arg_13 = arg_1.tile(arg_1.get_variable('init_bw_h', [1, arg_3]), (arg_1.shape(arg_0)[0], 1))\n            else:\n                arg_12 = arg_13 = None\n        elif arg_5 == 'lstm':\n            arg_10 = arg_1.nn.rnn_cell.LSTMCell(arg_3, arg_8=arg_8, initializer=INITIALIZER())\n            arg_11 = arg_1.nn.rnn_cell.LSTMCell(arg_3, arg_8=arg_8, initializer=INITIALIZER())\n            if arg_7:\n                arg_12 = arg_1.nn.rnn_cell.LSTMStateTuple(\n                    arg_1.tile(arg_1.get_variable('init_fw_c', [1, arg_3]), (arg_1.shape(arg_0)[0], 1)),\n                    arg_1.tile(arg_1.get_variable('init_fw_h', [1, arg_3]), (arg_1.shape(arg_0)[0], 1)))\n                arg_13 = arg_1.nn.rnn_cell.LSTMStateTuple(\n                    arg_1.tile(arg_1.get_variable('init_bw_c', [1, arg_3]), (arg_1.shape(arg_0)[0], 1)),\n                    arg_1.tile(arg_1.get_variable('init_bw_h', [1, arg_3]), (arg_1.shape(arg_0)[0], 1)))\n            else:\n                arg_12 = arg_13 = None\n        else:\n            raise RuntimeError('cell_type must be either \"gru\" or \"lstm\"s')\n        (arg_14, arg_15), (arg_16, arg_17) = \\\n            arg_1.nn.bidirectional_dynamic_rnn(arg_10,\n                                            arg_11,\n                                            arg_0,\n                                            dtype=arg_1.float32,\n                                            sequence_length=arg_6,\n                                            arg_12=arg_12,\n                                            arg_13=arg_13)\n    arg_18 = [var for var in arg_10.trainable_variables +\n               arg_11.trainable_variables if 'kernel' in var.name]\n    for arg_19 in arg_18:\n        arg_1.add_to_collection(arg_1.GraphKeys.REGULARIZATION_LOSSES, arg_1.nn.l2_loss(arg_19))\n    return (arg_14, arg_15), (arg_16, arg_17)", "path": "deeppavlov/core/layers/tf_layers.py", "identifier": "bi_rnn", "docstring": "Bi directional recurrent neural network. GRU or LSTM\n\n        Args:\n            units: a tensorflow tensor with dimensionality [None, n_tokens, n_features]\n            n_hidden: list with number of hidden units at the ouput of each layer\n            seq_lengths: length of sequences for different length sequences in batch\n                can be None for maximum length as a length for every sample in the batch\n            cell_type: 'lstm' or 'gru'\n            trainable_initial_states: whether to create a special trainable variable\n                to initialize the hidden states of the network or use just zeros\n            use_peepholes: whether to use peephole connections (only 'lstm' case affected)\n            name: what variable_scope to use for the network parameters\n\n        Returns:\n            units: tensor at the output of the last recurrent layer\n                with dimensionality [None, n_tokens, n_hidden_list[-1]]\n            last_units: tensor of last hidden states for GRU and tuple\n                of last hidden stated and last cell states for LSTM\n                dimensionality of cell states and hidden states are\n                similar and equal to [B x 2 * H], where B - batch\n                size and H is number of hidden units", "docstring_tokens": ["Bi", "directional", "recurrent", "neural", "network", ".", "GRU", "or", "LSTM"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 259720}
{"url": "https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L101-L123", "sha": "467e8a843ca9f882f8bb2958805b7293591996ad", "docstring_summary": "Calcul de l'AOT40 du 1er mai au 31 juillet", "language": "python", "parameters": "(df, nb_an)", "return_statement": "return _aot(df.tshift(1), nb_an=nb_an, limite=80, mois_debut=5, mois_fin=7,\n                heure_debut=8, heure_fin=19)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "_aot", "(", "arg_0", ".", "tshift", "(", "1", ")", ",", "arg_1", "=", "arg_1", ",", "limite", "=", "80", ",", "mois_debut", "=", "5", ",", "mois_fin", "=", "7", ",", "heure_debut", "=", "8", ",", "heure_fin", "=", "19", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Calcul de l'AOT40 du 1er mai au 31 juillet\n\n    *AOT40 : AOT 40 ( exprim\u00e9 en micro g/m\u00b3 par heure ) signifie la somme des\n    diff\u00e9rences entre les concentrations horaires sup\u00e9rieures \u00e0 40 parties par\n    milliard ( 40 ppb soit 80 micro g/m\u00b3 ), durant une p\u00e9riode donn\u00e9e en\n    utilisant uniquement les valeurs sur 1 heure mesur\u00e9es quotidiennement\n    entre 8 heures (d\u00e9but de la mesure) et 20 heures (pile, fin de la mesure) CET,\n    ce qui correspond \u00e0 de 8h \u00e0 19h TU (donnant bien 12h de mesures, 8h donnant\n    la moyenne horaire de 7h01 \u00e0 8h00)\n\n    Param\u00e8tres:\n    df: DataFrame de mesures sur lequel appliqu\u00e9 le calcul\n    nb_an: (int) Nombre d'ann\u00e9es contenu dans le df, et servant \u00e0 diviser le\n    r\u00e9sultat retourn\u00e9\n\n    Retourne:\n    Un DataFrame de r\u00e9sultat de calcul\n    \"\"\"\n\n    return _aot(arg_0.tshift(1), arg_1=arg_1, limite=80, mois_debut=5, mois_fin=7,\n                heure_debut=8, heure_fin=19)", "path": "pyair/reg.py", "identifier": "aot40_vegetation", "docstring": "Calcul de l'AOT40 du 1er mai au 31 juillet\n\n    *AOT40 : AOT 40 ( exprim\u00e9 en micro g/m\u00b3 par heure ) signifie la somme des\n    diff\u00e9rences entre les concentrations horaires sup\u00e9rieures \u00e0 40 parties par\n    milliard ( 40 ppb soit 80 micro g/m\u00b3 ), durant une p\u00e9riode donn\u00e9e en\n    utilisant uniquement les valeurs sur 1 heure mesur\u00e9es quotidiennement\n    entre 8 heures (d\u00e9but de la mesure) et 20 heures (pile, fin de la mesure) CET,\n    ce qui correspond \u00e0 de 8h \u00e0 19h TU (donnant bien 12h de mesures, 8h donnant\n    la moyenne horaire de 7h01 \u00e0 8h00)\n\n    Param\u00e8tres:\n    df: DataFrame de mesures sur lequel appliqu\u00e9 le calcul\n    nb_an: (int) Nombre d'ann\u00e9es contenu dans le df, et servant \u00e0 diviser le\n    r\u00e9sultat retourn\u00e9\n\n    Retourne:\n    Un DataFrame de r\u00e9sultat de calcul", "docstring_tokens": ["Calcul", "de", "l", "AOT40", "du", "1er", "mai", "au", "31", "juillet"], "nwo": "LionelR/pyair", "score": 0.12050106452410352, "idx": 259721}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/gatt.py#L52-L58", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Return list of GATT characteristics that have been discovered for this\n        service.", "language": "python", "parameters": "(self)", "return_statement": "return map(BluezGattCharacteristic,\n                   get_provider()._get_objects_by_path(paths))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_props", ".", "Get", "(", "_SERVICE_INTERFACE", ",", "'Characteristics'", ")", "return", "map", "(", "BluezGattCharacteristic", ",", "get_provider", "(", ")", ".", "_get_objects_by_path", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return list of GATT characteristics that have been discovered for this\n        service.\n        \"\"\"\n        arg_1 = arg_0._props.Get(_SERVICE_INTERFACE, 'Characteristics')\n        return map(BluezGattCharacteristic,\n                   get_provider()._get_objects_by_path(arg_1))", "path": "Adafruit_BluefruitLE/bluez_dbus/gatt.py", "identifier": "BluezGattService.list_characteristics", "docstring": "Return list of GATT characteristics that have been discovered for this\n        service.", "docstring_tokens": ["Return", "list", "of", "GATT", "characteristics", "that", "have", "been", "discovered", "for", "this", "service", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 259722}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L906-L930", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Send a 'roster set' to the server.", "language": "python", "parameters": "(self, item, callback, error_callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "Iq", "(", "to_jid", "=", "arg_0", ".", "server", ",", "stanza_type", "=", "\"set\"", ")", "arg_5", "=", "RosterPayload", "(", "[", "arg_1", "]", ")", "arg_4", ".", "set_payload", "(", "arg_5", ")", "def", "success_cb", "(", "arg_6", ")", ":", "if", "arg_2", ":", "arg_2", "(", "arg_1", ")", "def", "error_cb", "(", "arg_7", ")", ":", "if", "arg_3", ":", "arg_3", "(", "arg_7", ")", "else", ":", "logger", ".", "error", "(", "\"Roster change of '{0}' failed\"", ".", "format", "(", "arg_1", ".", "jid", ")", ")", "arg_8", "=", "arg_0", ".", "stanza_processor", "arg_8", ".", "set_response_handlers", "(", "arg_4", ",", "success_cb", ",", "error_cb", ")", "arg_8", ".", "send", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Send a 'roster set' to the server.\n\n        :Parameters:\n            - `item`: the requested change\n        :Types:\n            - `item`: `RosterItem`\n        \"\"\"\n        arg_4 = Iq(to_jid = arg_0.server, stanza_type = \"set\")\n        arg_5 = RosterPayload([arg_1])\n        arg_4.set_payload(arg_5)\n        def success_cb(arg_6):\n            \"\"\"Success callback for roster set.\"\"\"\n            if arg_2:\n                arg_2(arg_1)\n        def error_cb(arg_7):\n            \"\"\"Error callback for roster set.\"\"\"\n            if arg_3:\n                arg_3(arg_7)\n            else:\n                logger.error(\"Roster change of '{0}' failed\".format(arg_1.jid))\n        arg_8 = arg_0.stanza_processor\n        arg_8.set_response_handlers(arg_4,\n                                    success_cb, error_cb)\n        arg_8.send(arg_4)", "path": "pyxmpp2/roster.py", "identifier": "RosterClient._roster_set", "docstring": "Send a 'roster set' to the server.\n\n        :Parameters:\n            - `item`: the requested change\n        :Types:\n            - `item`: `RosterItem`", "docstring_tokens": ["Send", "a", "roster", "set", "to", "the", "server", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259723}
{"url": "https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_base.py#L384-L395", "sha": "1a1ba9758651aed9c4f58384eff006d2e2ad6835", "docstring_summary": "A shallow copy.", "language": "python", "parameters": "(self)", "return_statement": "return copy", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "arg_0", ".", "__class__", ".", "__new__", "(", "arg_0", ".", "__class__", ")", "Func", ".", "_fwdm", "=", "arg_0", ".", "_fwdm", ".", "copy", "(", ")", "Func", ".", "_invm", "=", "arg_0", ".", "_invm", ".", "copy", "(", ")", "Func", ".", "_init_inv", "(", ")", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"A shallow copy.\"\"\"\n        # Could just ``return self.__class__(self)`` here instead, but the below is faster. It uses\n        # __new__ to create a copy instance while bypassing its __init__, which would result\n        # in copying this bidict's items into the copy instance one at a time. Instead, make whole\n        # copies of each of the backing mappings, and make them the backing mappings of the copy,\n        # avoiding copying items one at a time.\n        Func = arg_0.__class__.__new__(arg_0.__class__)\n        Func._fwdm = arg_0._fwdm.copy()  # pylint: disable=protected-access\n        Func._invm = arg_0._invm.copy()  # pylint: disable=protected-access\n        Func._init_inv()  # pylint: disable=protected-access\n        return Func", "path": "bidict/_base.py", "identifier": "BidictBase.copy", "docstring": "A shallow copy.", "docstring_tokens": ["A", "shallow", "copy", "."], "nwo": "jab/bidict", "score": 0.5840682608785344, "idx": 259724}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/gcp/gcs.py#L11-L22", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "List buckets for a project.", "language": "python", "parameters": "(client=None, **kwargs)", "return_statement": "return [b.__dict__ for b in buckets]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "Func", "(", "**", "arg_1", ")", "return", "[", "arg_3", ".", "__dict__", "for", "arg_3", "in", "arg_2", "]"], "function": "def Func(arg_0=None, **arg_1):\n    \"\"\"\n    List buckets for a project.\n\n    :param client: client object to use.\n    :type client: Google Cloud Storage client\n\n    :returns: list of dictionary reprsentation of Bucket\n    :rtype: ``list`` of ``dict``\n    \"\"\"\n    arg_2 = arg_0.Func(**arg_1)\n    return [arg_3.__dict__ for arg_3 in arg_2]", "path": "cloudaux/gcp/gcs.py", "identifier": "list_buckets", "docstring": "List buckets for a project.\n\n    :param client: client object to use.\n    :type client: Google Cloud Storage client\n\n    :returns: list of dictionary reprsentation of Bucket\n    :rtype: ``list`` of ``dict``", "docstring_tokens": ["List", "buckets", "for", "a", "project", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 259725}
{"url": "https://github.com/absperf/python-req/blob/de878f08f4fb28fa140c80d5cbdb04518ef5e968/req.py#L83-L150", "sha": "de878f08f4fb28fa140c80d5cbdb04518ef5e968", "docstring_summary": "Load an object from the file pointer.", "language": "python", "parameters": "(fp, separator=DEFAULT, index_separator=DEFAULT, cls=dict, list_cls=list)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_2", ",", "arg_4", "=", "arg_5", ",", "arg_6", "=", "arg_7", ")", ":", "arg_8", "=", "None", "arg_9", "=", "arg_4", "(", ")", "arg_10", "=", "set", "(", ")", "for", "arg_11", "in", "arg_0", ":", "if", "arg_8", "is", "None", ":", "if", "isinstance", "(", "arg_11", ",", "six", ".", "text_type", ")", ":", "arg_8", "=", "six", ".", "u", "else", ":", "arg_8", "=", "six", ".", "b", "arg_12", "=", "arg_8", "(", "'|'", ")", "arg_13", "=", "arg_8", "(", "'_'", ")", "arg_14", "=", "arg_8", "(", "'\\n'", ")", "if", "arg_1", "is", "arg_2", ":", "arg_1", "=", "arg_12", "if", "arg_3", "is", "arg_2", ":", "arg_3", "=", "arg_13", "arg_15", ",", "arg_16", "=", "arg_11", ".", "strip", "(", ")", ".", "split", "(", "arg_1", ",", "1", ")", "arg_17", "=", "arg_15", ".", "split", "(", "arg_3", ")", "try", ":", "arg_18", "=", "int", "(", "arg_17", "[", "-", "1", "]", ")", "arg_19", "=", "True", "except", "ValueError", ":", "arg_19", "=", "False", "if", "len", "(", "arg_17", ")", ">", "1", "and", "arg_19", ":", "arg_20", "=", "arg_15", ".", "rsplit", "(", "arg_3", ",", "1", ")", "[", "0", "]", "if", "arg_20", "not", "in", "arg_10", ":", "arg_10", ".", "add", "(", "arg_20", ")", "if", "arg_20", "in", "arg_9", ":", "if", "not", "isinstance", "(", "arg_9", "[", "arg_20", "]", ",", "arg_5", ")", ":", "arg_9", "[", "arg_20", "]", "=", "{", "-", "1", ":", "arg_9", "[", "arg_20", "]", "}", "else", ":", "arg_9", "[", "arg_20", "]", "=", "{", "}", "arg_9", "[", "arg_20", "]", "[", "arg_18", "]", "=", "arg_16", "else", ":", "if", "arg_15", "in", "arg_9", "and", "isinstance", "(", "arg_9", "[", "arg_15", "]", ",", "arg_5", ")", ":", "arg_9", "[", "arg_15", "]", "[", "-", "1", "]", "=", "arg_16", "else", ":", "arg_9", "[", "arg_15", "]", "=", "arg_16", "for", "arg_15", "in", "arg_10", ":", "arg_9", "[", "arg_15", "]", "=", "arg_6", "(", "pair", "[", "1", "]", "for", "pair", "in", "sorted", "(", "six", ".", "iteritems", "(", "arg_9", "[", "arg_15", "]", ")", ")", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=arg_2, arg_4=arg_5, arg_6=arg_7):\n    '''Load an object from the file pointer.\n\n    :param fp: A readable filehandle.\n    :param separator: The separator between key and value.  Defaults to u'|' or b'|', depending on the types.\n    :param index_separator: The separator between key and index.  Defaults to u'_' or b'_', depending on the types.\n    :param cls: A callable that returns a Mapping that is filled with pairs.  The most common alternate option would be OrderedDict.\n    :param list_cls: A callable that takes an iterable and returns a sequence.\n    '''\n\n    arg_8 = None\n\n    arg_9 = arg_4()\n    arg_10 = set()\n\n    for arg_11 in arg_0:\n        if arg_8 is None:\n            if isinstance(arg_11, six.text_type):\n                arg_8 = six.u\n            else:\n                arg_8 = six.b\n            arg_12 = arg_8('|')\n            arg_13 = arg_8('_')\n            arg_14 = arg_8('\\n')\n\n            if arg_1 is arg_2:\n                arg_1 = arg_12\n            if arg_3 is arg_2:\n                arg_3 = arg_13\n\n        arg_15, arg_16 = arg_11.strip().split(arg_1, 1)\n\n        arg_17 = arg_15.split(arg_3)\n\n        try:\n            arg_18 = int(arg_17[-1])\n            arg_19 = True\n        except ValueError:\n            arg_19 = False\n\n        # We do everything in-place to ensure that we maintain order when using\n        # an OrderedDict.\n        if len(arg_17) > 1 and arg_19:\n            # If this is an array key\n            arg_20 = arg_15.rsplit(arg_3, 1)[0]\n            if arg_20 not in arg_10:\n                arg_10.add(arg_20)\n\n            if arg_20 in arg_9:\n                # If key already exists as non-array, fix it\n                if not isinstance(arg_9[arg_20], arg_5):\n                    arg_9[arg_20] = {-1: arg_9[arg_20]}\n            else:\n                arg_9[arg_20] = {}\n\n            arg_9[arg_20][arg_18] = arg_16\n\n        else:\n            if arg_15 in arg_9 and isinstance(arg_9[arg_15], arg_5):\n                arg_9[arg_15][-1] = arg_16\n            else:\n                arg_9[arg_15] = arg_16\n\n    # Convert array keys\n    for arg_15 in arg_10:\n        arg_9[arg_15] = arg_6(pair[1] for pair in sorted(six.iteritems(arg_9[arg_15])))\n\n    return arg_9", "path": "req.py", "identifier": "load", "docstring": "Load an object from the file pointer.\n\n    :param fp: A readable filehandle.\n    :param separator: The separator between key and value.  Defaults to u'|' or b'|', depending on the types.\n    :param index_separator: The separator between key and index.  Defaults to u'_' or b'_', depending on the types.\n    :param cls: A callable that returns a Mapping that is filled with pairs.  The most common alternate option would be OrderedDict.\n    :param list_cls: A callable that takes an iterable and returns a sequence.", "docstring_tokens": ["Load", "an", "object", "from", "the", "file", "pointer", "."], "nwo": "absperf/python-req", "score": 0.17782712273869106, "idx": 259726}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment.py#L611-L712", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Get experiment or experiment job logs.", "language": "python", "parameters": "(ctx, job, past, follow, hide_time)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "def", "get_experiment_Func", "(", ")", ":", "if", "arg_2", ":", "try", ":", "arg_5", "=", "PolyaxonClient", "(", ")", ".", "experiment", ".", "Func", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "stream", "=", "False", ")", "get_Func_handler", "(", "handle_job_info", "=", "True", ",", "show_timestamp", "=", "not", "arg_4", ",", "stream", "=", "False", ")", "(", "arg_5", ".", "content", ".", "decode", "(", ")", ".", "split", "(", "'\\n'", ")", ")", "print", "(", ")", "if", "not", "arg_3", ":", "return", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "if", "not", "arg_3", ":", "Printer", ".", "print_error", "(", "'Could not get Func for experiment `{}`.'", ".", "format", "(", "arg_8", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "experiment", ".", "Func", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "message_handler", "=", "get_Func_handler", "(", "handle_job_info", "=", "True", ",", "show_timestamp", "=", "not", "arg_4", ")", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not get Func for experiment `{}`.'", ".", "format", "(", "arg_8", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "def", "get_experiment_job_Func", "(", ")", ":", "if", "arg_2", ":", "try", ":", "arg_5", "=", "PolyaxonClient", "(", ")", ".", "experiment_job", ".", "Func", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "stream", "=", "False", ")", "get_Func_handler", "(", "handle_job_info", "=", "True", ",", "show_timestamp", "=", "not", "arg_4", ",", "stream", "=", "False", ")", "(", "arg_5", ".", "content", ".", "decode", "(", ")", ".", "split", "(", "'\\n'", ")", ")", "print", "(", ")", "if", "not", "arg_3", ":", "return", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "if", "not", "arg_3", ":", "Printer", ".", "print_error", "(", "'Could not get Func for experiment `{}`.'", ".", "format", "(", "arg_8", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "try", ":", "PolyaxonClient", "(", ")", ".", "experiment_job", ".", "Func", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "message_handler", "=", "get_Func_handler", "(", "handle_job_info", "=", "True", ",", "show_timestamp", "=", "not", "arg_4", ")", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not get Func for job `{}`.'", ".", "format", "(", "arg_9", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "arg_6", ",", "arg_7", ",", "arg_8", "=", "get_project_experiment_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "get", "(", "'experiment'", ")", ")", "if", "arg_1", ":", "arg_9", "=", "get_experiment_job_or_local", "(", "arg_1", ")", "get_experiment_job_Func", "(", ")", "else", ":", "get_experiment_Func", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Get experiment or experiment job Func.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples for getting experiment Func:\n\n    \\b\n    ```bash\n    $ polyaxon experiment Func\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 10 -p mnist Func\n    ```\n\n    Examples for getting experiment job Func:\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 1 -j 1 Func\n    ```\n    \"\"\"\n\n    def get_experiment_Func():\n        if arg_2:\n            try:\n                arg_5 = PolyaxonClient().experiment.Func(\n                    arg_6, arg_7, arg_8, stream=False)\n                get_Func_handler(handle_job_info=True,\n                                 show_timestamp=not arg_4,\n                                 stream=False)(arg_5.content.decode().split('\\n'))\n                print()\n\n                if not arg_3:\n                    return\n            except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n                if not arg_3:\n                    Printer.print_error(\n                        'Could not get Func for experiment `{}`.'.format(arg_8))\n                    Printer.print_error(\n                        'Error message `{}`.'.format(e))\n                    sys.exit(1)\n\n        try:\n            PolyaxonClient().experiment.Func(\n                arg_6,\n                arg_7,\n                arg_8,\n                message_handler=get_Func_handler(handle_job_info=True,\n                                                 show_timestamp=not arg_4))\n        except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n            Printer.print_error('Could not get Func for experiment `{}`.'.format(arg_8))\n            Printer.print_error('Error message `{}`.'.format(e))\n            sys.exit(1)\n\n    def get_experiment_job_Func():\n        if arg_2:\n            try:\n                arg_5 = PolyaxonClient().experiment_job.Func(\n                    arg_6,\n                    arg_7,\n                    arg_8,\n                    arg_9,\n                    stream=False)\n                get_Func_handler(handle_job_info=True,\n                                 show_timestamp=not arg_4,\n                                 stream=False)(arg_5.content.decode().split('\\n'))\n                print()\n\n                if not arg_3:\n                    return\n            except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n                if not arg_3:\n                    Printer.print_error(\n                        'Could not get Func for experiment `{}`.'.format(arg_8))\n                    Printer.print_error(\n                        'Error message `{}`.'.format(e))\n                    sys.exit(1)\n\n        try:\n            PolyaxonClient().experiment_job.Func(\n                arg_6,\n                arg_7,\n                arg_8,\n                arg_9,\n                message_handler=get_Func_handler(handle_job_info=True,\n                                                 show_timestamp=not arg_4))\n        except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n            Printer.print_error('Could not get Func for job `{}`.'.format(arg_9))\n            Printer.print_error('Error message `{}`.'.format(e))\n            sys.exit(1)\n\n    arg_6, arg_7, arg_8 = get_project_experiment_or_local(arg_0.obj.get('project'),\n                                                                      arg_0.obj.get('experiment'))\n\n    if arg_1:\n        arg_9 = get_experiment_job_or_local(arg_1)\n        get_experiment_job_Func()\n    else:\n        get_experiment_Func()", "path": "polyaxon_cli/cli/experiment.py", "identifier": "logs", "docstring": "Get experiment or experiment job logs.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples for getting experiment logs:\n\n    \\b\n    ```bash\n    $ polyaxon experiment logs\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 10 -p mnist logs\n    ```\n\n    Examples for getting experiment job logs:\n\n    \\b\n    ```bash\n    $ polyaxon experiment -xp 1 -j 1 logs\n    ```", "docstring_tokens": ["Get", "experiment", "or", "experiment", "job", "logs", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 259727}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/group_nodes.py#L36-L63", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Groups graph into subgraphs and assigns each subgraph a score based on the average of all nodes values\n    for the given node key", "language": "python", "parameters": "(graph: BELGraph,\n                            key: str,\n                            annotation: str = 'Subgraph',\n                            aggregator: Optional[Callable[[Iterable[X]], X]] = None,\n                            )", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_3", "=", "'Subgraph'", ",", "arg_5", ":", "arg_6", "[", "arg_7", "[", "[", "arg_8", "[", "arg_9", "]", "]", ",", "arg_9", "]", "]", "=", "None", ",", ")", "->", "Mapping", "[", "arg_3", ",", "arg_9", "]", ":", "if", "arg_5", "is", "None", ":", "def", "arg_5", "(", "arg_10", ")", ":", "return", "sum", "(", "arg_10", ")", "/", "len", "(", "arg_10", ")", "arg_11", "=", "{", "}", "for", "arg_12", ",", "arg_13", "in", "group_nodes_by_annotation", "(", "arg_0", ",", "arg_4", ")", ".", "items", "(", ")", ":", "arg_14", "=", "[", "arg_0", ".", "nodes", "[", "node", "]", "[", "arg_2", "]", "for", "node", "in", "arg_13", "if", "arg_2", "in", "arg_0", ".", "nodes", "[", "node", "]", "]", "arg_11", "[", "arg_12", "]", "=", "arg_5", "(", "arg_14", ")", "return", "arg_11"], "function": "def Func(arg_0: arg_1,\n                            arg_2: arg_3,\n                            arg_4: arg_3 = 'Subgraph',\n                            arg_5: arg_6[arg_7[[arg_8[arg_9]], arg_9]] = None,\n                            ) -> Mapping[arg_3, arg_9]:\n    \"\"\"Groups graph into subgraphs and assigns each subgraph a score based on the average of all nodes values\n    for the given node key\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param key: The key in the node data dictionary representing the experimental data\n    :param annotation: A BEL annotation to use to group nodes\n    :param aggregator: A function from list of values -> aggregate value. Defaults to taking the average of a list of\n                       floats.\n    :type aggregator: lambda\n    \"\"\"\n\n    if arg_5 is None:\n        def arg_5(arg_10):\n            \"\"\"Calculates the average\"\"\"\n            return sum(arg_10) / len(arg_10)\n\n    arg_11 = {}\n\n    for arg_12, arg_13 in group_nodes_by_annotation(arg_0, arg_4).items():\n        arg_14 = [arg_0.nodes[node][arg_2] for node in arg_13 if arg_2 in arg_0.nodes[node]]\n        arg_11[arg_12] = arg_5(arg_14)\n\n    return arg_11", "path": "src/pybel_tools/selection/group_nodes.py", "identifier": "average_node_annotation", "docstring": "Groups graph into subgraphs and assigns each subgraph a score based on the average of all nodes values\n    for the given node key\n\n    :param pybel.BELGraph graph: A BEL graph\n    :param key: The key in the node data dictionary representing the experimental data\n    :param annotation: A BEL annotation to use to group nodes\n    :param aggregator: A function from list of values -> aggregate value. Defaults to taking the average of a list of\n                       floats.\n    :type aggregator: lambda", "docstring_tokens": ["Groups", "graph", "into", "subgraphs", "and", "assigns", "each", "subgraph", "a", "score", "based", "on", "the", "average", "of", "all", "nodes", "values", "for", "the", "given", "node", "key"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 259728}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/effects.py#L432-L498", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Trim leading and trailing silence from an audio signal.", "language": "python", "parameters": "(y, top_db=60, ref=np.max, frame_length=2048, hop_length=512)", "return_statement": "return y[tuple(full_index)], np.asarray([start, end])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "60", ",", "arg_2", "=", "arg_3", ".", "max", ",", "arg_5", "=", "2048", ",", "arg_6", "=", "512", ")", ":", "arg_7", "=", "_signal_to_frame_nonsilent", "(", "arg_0", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_2", "=", "arg_2", ",", "arg_1", "=", "arg_1", ")", "arg_8", "=", "arg_3", ".", "flatnonzero", "(", "arg_7", ")", "if", "arg_8", ".", "size", ">", "0", ":", "arg_9", "=", "int", "(", "core", ".", "frames_to_samples", "(", "arg_8", "[", "0", "]", ",", "arg_6", ")", ")", "arg_10", "=", "min", "(", "arg_0", ".", "shape", "[", "-", "1", "]", ",", "int", "(", "core", ".", "frames_to_samples", "(", "arg_8", "[", "-", "1", "]", "+", "1", ",", "arg_6", ")", ")", ")", "else", ":", "arg_9", ",", "arg_10", "=", "0", ",", "0", "arg_11", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "arg_11", "[", "-", "1", "]", "=", "slice", "(", "arg_9", ",", "arg_10", ")", "return", "arg_0", "[", "tuple", "(", "arg_11", ")", "]", ",", "arg_3", ".", "asarray", "(", "[", "arg_9", ",", "arg_10", "]", ")"], "function": "def Func(arg_0, arg_1=60, arg_2=arg_3.max, arg_5=2048, arg_6=512):\n    '''Trim leading and trailing silence from an audio signal.\n\n    Parameters\n    ----------\n    y : np.ndarray, shape=(n,) or (2,n)\n        Audio signal, can be mono or stereo\n\n    top_db : number > 0\n        The threshold (in decibels) below reference to consider as\n        silence\n\n    ref : number or callable\n        The reference power.  By default, it uses `np.max` and compares\n        to the peak power in the signal.\n\n    frame_length : int > 0\n        The number of samples per analysis frame\n\n    hop_length : int > 0\n        The number of samples between analysis frames\n\n    Returns\n    -------\n    y_Funcmed : np.ndarray, shape=(m,) or (2, m)\n        The Funcmed signal\n\n    index : np.ndarray, shape=(2,)\n        the interval of `y` corresponding to the non-silent region:\n        `y_Funcmed = y[index[0]:index[1]]` (for mono) or\n        `y_Funcmed = y[:, index[0]:index[1]]` (for stereo).\n\n\n    Examples\n    --------\n    >>> # Load some audio\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> # Trim the beginning and ending silence\n    >>> yt, index = librosa.effects.Func(y)\n    >>> # Print the durations\n    >>> print(librosa.get_duration(y), librosa.get_duration(yt))\n    61.45886621315193 60.58086167800454\n    '''\n\n    arg_7 = _signal_to_frame_nonsilent(arg_0,\n                                            arg_5=arg_5,\n                                            arg_6=arg_6,\n                                            arg_2=arg_2,\n                                            arg_1=arg_1)\n\n    arg_8 = arg_3.flatnonzero(arg_7)\n\n    if arg_8.size > 0:\n        # Compute the start and end positions\n        # End position goes one frame past the last non-zero\n        arg_9 = int(core.frames_to_samples(arg_8[0], arg_6))\n        arg_10 = min(arg_0.shape[-1],\n                  int(core.frames_to_samples(arg_8[-1] + 1, arg_6)))\n    else:\n        # The signal only contains zeros\n        arg_9, arg_10 = 0, 0\n\n    # Build the mono/stereo index\n    arg_11 = [slice(None)] * arg_0.ndim\n    arg_11[-1] = slice(arg_9, arg_10)\n\n    return arg_0[tuple(arg_11)], arg_3.asarray([arg_9, arg_10])", "path": "librosa/effects.py", "identifier": "trim", "docstring": "Trim leading and trailing silence from an audio signal.\n\n    Parameters\n    ----------\n    y : np.ndarray, shape=(n,) or (2,n)\n        Audio signal, can be mono or stereo\n\n    top_db : number > 0\n        The threshold (in decibels) below reference to consider as\n        silence\n\n    ref : number or callable\n        The reference power.  By default, it uses `np.max` and compares\n        to the peak power in the signal.\n\n    frame_length : int > 0\n        The number of samples per analysis frame\n\n    hop_length : int > 0\n        The number of samples between analysis frames\n\n    Returns\n    -------\n    y_trimmed : np.ndarray, shape=(m,) or (2, m)\n        The trimmed signal\n\n    index : np.ndarray, shape=(2,)\n        the interval of `y` corresponding to the non-silent region:\n        `y_trimmed = y[index[0]:index[1]]` (for mono) or\n        `y_trimmed = y[:, index[0]:index[1]]` (for stereo).\n\n\n    Examples\n    --------\n    >>> # Load some audio\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> # Trim the beginning and ending silence\n    >>> yt, index = librosa.effects.trim(y)\n    >>> # Print the durations\n    >>> print(librosa.get_duration(y), librosa.get_duration(yt))\n    61.45886621315193 60.58086167800454", "docstring_tokens": ["Trim", "leading", "and", "trailing", "silence", "from", "an", "audio", "signal", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 259729}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/agents/learning_agent.py#L144-L194", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Imports experiences.", "language": "python", "parameters": "(self, experiences)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "if", "arg_0", ".", "unique_state", ":", "arg_1", "[", "'states'", "]", "=", "dict", "(", "state", "=", "arg_1", "[", "'states'", "]", ")", "if", "arg_0", ".", "unique_action", ":", "arg_1", "[", "'actions'", "]", "=", "dict", "(", "action", "=", "arg_1", "[", "'actions'", "]", ")", "arg_0", ".", "model", ".", "Func", "(", "**", "arg_1", ")", "else", ":", "if", "arg_0", ".", "unique_state", ":", "arg_2", "=", "dict", "(", "state", "=", "list", "(", ")", ")", "else", ":", "arg_2", "=", "{", "arg_8", ":", "list", "(", ")", "for", "arg_8", "in", "arg_1", "[", "0", "]", "[", "'states'", "]", "}", "arg_3", "=", "[", "list", "(", ")", "for", "_", "in", "arg_1", "[", "0", "]", "[", "'internals'", "]", "]", "if", "arg_0", ".", "unique_action", ":", "arg_4", "=", "dict", "(", "action", "=", "list", "(", ")", ")", "else", ":", "arg_4", "=", "{", "arg_8", ":", "list", "(", ")", "for", "arg_8", "in", "arg_1", "[", "0", "]", "[", "'actions'", "]", "}", "arg_5", "=", "list", "(", ")", "arg_6", "=", "list", "(", ")", "for", "arg_7", "in", "arg_1", ":", "if", "arg_0", ".", "unique_state", ":", "arg_2", "[", "'state'", "]", ".", "append", "(", "arg_7", "[", "'states'", "]", ")", "else", ":", "for", "arg_8", "in", "sorted", "(", "arg_2", ")", ":", "arg_2", "[", "arg_8", "]", ".", "append", "(", "arg_7", "[", "'states'", "]", "[", "arg_8", "]", ")", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_3", ")", ":", "arg_10", ".", "append", "(", "arg_7", "[", "'internals'", "]", "[", "arg_9", "]", ")", "if", "arg_0", ".", "unique_action", ":", "arg_4", "[", "'action'", "]", ".", "append", "(", "arg_7", "[", "'actions'", "]", ")", "else", ":", "for", "arg_8", "in", "sorted", "(", "arg_4", ")", ":", "arg_4", "[", "arg_8", "]", ".", "append", "(", "arg_7", "[", "'actions'", "]", "[", "arg_8", "]", ")", "arg_5", ".", "append", "(", "arg_7", "[", "'terminal'", "]", ")", "arg_6", ".", "append", "(", "arg_7", "[", "'reward'", "]", ")", "arg_0", ".", "model", ".", "Func", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Imports experiences.\n\n        Args:\n            experiences: \n        \"\"\"\n        if isinstance(arg_1, dict):\n            if arg_0.unique_state:\n                arg_1['states'] = dict(state=arg_1['states'])\n            if arg_0.unique_action:\n                arg_1['actions'] = dict(action=arg_1['actions'])\n\n            arg_0.model.Func(**arg_1)\n\n        else:\n            if arg_0.unique_state:\n                arg_2 = dict(state=list())\n            else:\n                arg_2 = {arg_8: list() for arg_8 in arg_1[0]['states']}\n            arg_3 = [list() for _ in arg_1[0]['internals']]\n            if arg_0.unique_action:\n                arg_4 = dict(action=list())\n            else:\n                arg_4 = {arg_8: list() for arg_8 in arg_1[0]['actions']}\n            arg_5 = list()\n            arg_6 = list()\n\n            for arg_7 in arg_1:\n                if arg_0.unique_state:\n                    arg_2['state'].append(arg_7['states'])\n                else:\n                    for arg_8 in sorted(arg_2):\n                        arg_2[arg_8].append(arg_7['states'][arg_8])\n                for arg_9, arg_10 in enumerate(arg_3):\n                    arg_10.append(arg_7['internals'][arg_9])\n                if arg_0.unique_action:\n                    arg_4['action'].append(arg_7['actions'])\n                else:\n                    for arg_8 in sorted(arg_4):\n                        arg_4[arg_8].append(arg_7['actions'][arg_8])\n                arg_5.append(arg_7['terminal'])\n                arg_6.append(arg_7['reward'])\n\n            arg_0.model.Func(\n                arg_2=arg_2,\n                arg_3=arg_3,\n                arg_4=arg_4,\n                arg_5=arg_5,\n                arg_6=arg_6\n            )", "path": "tensorforce/agents/learning_agent.py", "identifier": "LearningAgent.import_experience", "docstring": "Imports experiences.\n\n        Args:\n            experiences:", "docstring_tokens": ["Imports", "experiences", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 259730}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/fastqc_report.py#L362-L406", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Parses a FastQC summary report file and returns it as a dictionary.", "language": "python", "parameters": "(summary_file)", "return_statement": "return summary_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "OrderedDict", "(", ")", "logger", ".", "debug", "(", "\"Retrieving summary information from file: {}\"", ".", "format", "(", "arg_0", ")", ")", "with", "open", "(", "arg_0", ")", "as", "fh", ":", "for", "arg_2", "in", "fh", ":", "if", "not", "arg_2", ".", "strip", "(", ")", ":", "continue", "arg_3", "=", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "arg_2", ".", "split", "(", "\"\\t\"", ")", "]", "arg_1", "[", "arg_3", "[", "1", "]", "]", "=", "arg_3", "[", "0", "]", "logger", ".", "debug", "(", "\"Retrieved summary information from file: {}\"", ".", "format", "(", "arg_1", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parses a FastQC summary report file and returns it as a dictionary.\n\n    This function parses a typical FastQC summary report file, retrieving\n    only the information on the first two columns. For instance, a line could\n    be::\n\n        'PASS\tBasic Statistics\tSH10762A_1.fastq.gz'\n\n    This parser will build a dictionary with the string in the second column\n    as a key and the QC result as the value. In this case, the returned\n    ``dict`` would be something like::\n\n        {\"Basic Statistics\": \"PASS\"}\n\n    Parameters\n    ----------\n    summary_file: str\n        Path to FastQC summary report.\n\n    Returns\n    -------\n    summary_info: :py:data:`OrderedDict`\n        Returns the information of the FastQC summary report as an ordered\n        dictionary, with the categories as strings and the QC result as values.\n\n    \"\"\"\n\n    arg_1 = OrderedDict()\n    logger.debug(\"Retrieving summary information from file: {}\".format(\n        arg_0))\n\n    with open(arg_0) as fh:\n        for arg_2 in fh:\n            # Skip empty lines\n            if not arg_2.strip():\n                continue\n            # Populate summary info\n            arg_3 = [x.strip() for x in arg_2.split(\"\\t\")]\n            arg_1[arg_3[1]] = arg_3[0]\n\n    logger.debug(\"Retrieved summary information from file: {}\".format(\n        arg_1))\n\n    return arg_1", "path": "flowcraft/templates/fastqc_report.py", "identifier": "get_summary", "docstring": "Parses a FastQC summary report file and returns it as a dictionary.\n\n    This function parses a typical FastQC summary report file, retrieving\n    only the information on the first two columns. For instance, a line could\n    be::\n\n        'PASS\tBasic Statistics\tSH10762A_1.fastq.gz'\n\n    This parser will build a dictionary with the string in the second column\n    as a key and the QC result as the value. In this case, the returned\n    ``dict`` would be something like::\n\n        {\"Basic Statistics\": \"PASS\"}\n\n    Parameters\n    ----------\n    summary_file: str\n        Path to FastQC summary report.\n\n    Returns\n    -------\n    summary_info: :py:data:`OrderedDict`\n        Returns the information of the FastQC summary report as an ordered\n        dictionary, with the categories as strings and the QC result as values.", "docstring_tokens": ["Parses", "a", "FastQC", "summary", "report", "file", "and", "returns", "it", "as", "a", "dictionary", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 259731}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L759-L767", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Creates a new sequence where o is the first element and seq is the rest.\n    If seq is None, return a list containing o. If seq is not a ISeq, attempt\n    to coerce it to a ISeq and then cons o onto the resulting sequence.", "language": "python", "parameters": "(o, seq)", "return_statement": "return Maybe(to_seq(seq)).map(lambda s: s.cons(o)).or_else(lambda: llist.l(o))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", "->", "ISeq", ":", "if", "arg_1", "is", "None", ":", "return", "llist", ".", "l", "(", "arg_0", ")", "if", "isinstance", "(", "arg_1", ",", "ISeq", ")", ":", "return", "arg_1", ".", "Func", "(", "arg_0", ")", "return", "Maybe", "(", "to_seq", "(", "arg_1", ")", ")", ".", "map", "(", "lambda", "s", ":", "s", ".", "Func", "(", "arg_0", ")", ")", ".", "or_else", "(", "lambda", ":", "llist", ".", "l", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1) -> ISeq:\n    \"\"\"Creates a new sequence where o is the first element and seq is the rest.\n    If seq is None, return a list containing o. If seq is not a ISeq, attempt\n    to coerce it to a ISeq and then Func o onto the resulting sequence.\"\"\"\n    if arg_1 is None:\n        return llist.l(arg_0)\n    if isinstance(arg_1, ISeq):\n        return arg_1.Func(arg_0)\n    return Maybe(to_seq(arg_1)).map(lambda s: s.Func(arg_0)).or_else(lambda: llist.l(arg_0))", "path": "src/basilisp/lang/runtime.py", "identifier": "cons", "docstring": "Creates a new sequence where o is the first element and seq is the rest.\n    If seq is None, return a list containing o. If seq is not a ISeq, attempt\n    to coerce it to a ISeq and then cons o onto the resulting sequence.", "docstring_tokens": ["Creates", "a", "new", "sequence", "where", "o", "is", "the", "first", "element", "and", "seq", "is", "the", "rest", ".", "If", "seq", "is", "None", "return", "a", "list", "containing", "o", ".", "If", "seq", "is", "not", "a", "ISeq", "attempt", "to", "coerce", "it", "to", "a", "ISeq", "and", "then", "cons", "o", "onto", "the", "resulting", "sequence", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 259732}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L76-L84", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reset graphics attributs to their default values.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "intensity", "=", "0", "arg_0", ".", "italic", "=", "False", "arg_0", ".", "bold", "=", "False", "arg_0", ".", "underline", "=", "False", "arg_0", ".", "foreground_color", "=", "None", "arg_0", ".", "background_color", "=", "None"], "function": "def Func(arg_0):\n        \"\"\" Reset graphics attributs to their default values.\n        \"\"\"\n        arg_0.intensity = 0\n        arg_0.italic = False\n        arg_0.bold = False\n        arg_0.underline = False\n        arg_0.foreground_color = None\n        arg_0.background_color = None", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py", "identifier": "AnsiCodeProcessor.reset_sgr", "docstring": "Reset graphics attributs to their default values.", "docstring_tokens": ["Reset", "graphics", "attributs", "to", "their", "default", "values", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259733}
{"url": "https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/formsets.py#L120-L129", "sha": "188e1bf1f15a44d9a599028d020083af9fb43ea7", "docstring_summary": "Returns the supplied URL.", "language": "python", "parameters": "(self)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "success_url", ":", "arg_1", "=", "arg_0", ".", "success_url", "else", ":", "arg_1", "=", "arg_0", ".", "request", ".", "get_full_path", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the supplied URL.\n        \"\"\"\n        if arg_0.success_url:\n            arg_1 = arg_0.success_url\n        else:\n            # Default to returning to the same page\n            arg_1 = arg_0.request.get_full_path()\n        return arg_1", "path": "extra_views/formsets.py", "identifier": "FormSetMixin.get_success_url", "docstring": "Returns the supplied URL.", "docstring_tokens": ["Returns", "the", "supplied", "URL", "."], "nwo": "AndrewIngram/django-extra-views", "score": 0.5916871811422788, "idx": 259734}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/quantum_channel.py#L52-L55", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Try to convert channel to a unitary representation Operator.", "language": "python", "parameters": "(self)", "return_statement": "return Operator(mat, self.input_dims(), self.output_dims())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_Func", "(", "arg_0", ".", "rep", ",", "arg_0", ".", "_data", ",", "*", "arg_0", ".", "dim", ")", "return", "Operator", "(", "arg_1", ",", "arg_0", ".", "input_dims", "(", ")", ",", "arg_0", ".", "output_dims", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Try to convert channel to a unitary representation Operator.\"\"\"\n        arg_1 = _Func(arg_0.rep, arg_0._data, *arg_0.dim)\n        return Operator(arg_1, arg_0.input_dims(), arg_0.output_dims())", "path": "qiskit/quantum_info/operators/channel/quantum_channel.py", "identifier": "QuantumChannel.to_operator", "docstring": "Try to convert channel to a unitary representation Operator.", "docstring_tokens": ["Try", "to", "convert", "channel", "to", "a", "unitary", "representation", "Operator", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259735}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/volume.py#L2147-L2182", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate molar volume of a gas mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.", "language": "python", "parameters": "(self, T, P, zs, ws, method)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_5", "==", "SIMPLE", ":", "arg_6", "=", "[", "i", "(", "arg_1", ",", "arg_2", ")", "for", "i", "in", "arg_0", ".", "VolumeGases", "]", "return", "mixing_simple", "(", "arg_3", ",", "arg_6", ")", "elif", "arg_5", "==", "IDEAL", ":", "return", "ideal_gas", "(", "arg_1", ",", "arg_2", ")", "elif", "arg_5", "==", "EOS", ":", "arg_0", ".", "eos", "[", "0", "]", "=", "arg_0", ".", "eos", "[", "0", "]", ".", "to_TP_zs", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "arg_0", ".", "eos", "[", "0", "]", ".", "V_g", "else", ":", "raise", "Exception", "(", "'Method not valid'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        r'''Method to Func molar volume of a gas mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to Func the property, [K]\n        P : float\n            Pressure at which to Func the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the gas mixture at the given conditions, [m^3/mol]\n        '''\n        if arg_5 == SIMPLE:\n            arg_6 = [i(arg_1, arg_2) for i in arg_0.VolumeGases]\n            return mixing_simple(arg_3, arg_6)\n        elif arg_5 == IDEAL:\n            return ideal_gas(arg_1, arg_2)\n        elif arg_5 == EOS:\n            arg_0.eos[0] = arg_0.eos[0].to_TP_zs(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)\n            return arg_0.eos[0].V_g\n        else:\n            raise Exception('Method not valid')", "path": "thermo/volume.py", "identifier": "VolumeGasMixture.calculate", "docstring": "r'''Method to calculate molar volume of a gas mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate the property, [K]\n        P : float\n            Pressure at which to calculate the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        Vm : float\n            Molar volume of the gas mixture at the given conditions, [m^3/mol]", "docstring_tokens": ["r", "Method", "to", "calculate", "molar", "volume", "of", "a", "gas", "mixture", "at", "temperature", "T", "pressure", "P", "mole", "fractions", "zs", "and", "weight", "fractions", "ws", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 259736}
{"url": "https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/headers.py#L141-L158", "sha": "e64094e41e4d89d98d2d29af7608ef27dc50cf19", "docstring_summary": "Sets a header field with the given value, removing\n        previous values.", "language": "python", "parameters": "(self, key, val)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "lower", "(", ")", "arg_4", "=", "arg_1", ",", "arg_2", "arg_5", "=", "arg_0", ".", "_container", ".", "Funcdefault", "(", "arg_3", ",", "arg_4", ")", "if", "arg_4", "is", "not", "arg_5", ":", "arg_0", ".", "_container", "[", "arg_3", "]", "=", "[", "arg_5", "[", "0", "]", ",", "arg_5", "[", "1", "]", ",", "arg_2", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Sets a header field with the given value, removing\n        previous values.\n\n        Usage::\n\n            headers = HTTPHeaderDict(foo='bar')\n            headers.Func('Foo', 'baz')\n            headers['foo']\n            > 'baz'\n        \"\"\"\n        arg_3 = arg_1.lower()\n        arg_4 = arg_1, arg_2\n        # Keep the common case aka no item present as fast as possible\n        arg_5 = arg_0._container.Funcdefault(arg_3, arg_4)\n        if arg_4 is not arg_5:\n            arg_0._container[arg_3] = [arg_5[0], arg_5[1], arg_2]", "path": "pook/headers.py", "identifier": "HTTPHeaderDict.set", "docstring": "Sets a header field with the given value, removing\n        previous values.\n\n        Usage::\n\n            headers = HTTPHeaderDict(foo='bar')\n            headers.set('Foo', 'baz')\n            headers['foo']\n            > 'baz'", "docstring_tokens": ["Sets", "a", "header", "field", "with", "the", "given", "value", "removing", "previous", "values", "."], "nwo": "h2non/pook", "score": 0.4648934936053724, "idx": 259737}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L193-L266", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Make autodoc documentation template string for a module", "language": "python", "parameters": "(self, uri)", "return_statement": "return ad", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "_parse_module", "(", "arg_1", ")", "if", "not", "len", "(", "arg_2", ")", "and", "not", "len", "(", "arg_3", ")", ":", "print", "'WARNING: Empty -'", ",", "arg_1", "return", "''", "arg_4", "=", "re", ".", "sub", "(", "r'^%s\\.'", "%", "arg_0", ".", "package_name", ",", "''", ",", "arg_1", ")", "arg_5", "=", "'.. AUTO-GENERATED FILE -- DO NOT EDIT!\\n\\n'", "arg_6", "=", "arg_4", "arg_5", "+=", "(", "arg_6", "+", "'\\n'", "+", "arg_0", ".", "rst_section_levels", "[", "1", "]", "*", "len", "(", "arg_6", ")", "+", "'\\n\\n'", ")", "if", "'.'", "in", "arg_1", ":", "arg_7", "=", "'Module: :mod:`'", "+", "arg_4", "+", "'`'", "else", ":", "arg_7", "=", "':mod:`'", "+", "arg_4", "+", "'`'", "arg_5", "+=", "arg_7", "+", "'\\n'", "+", "arg_0", ".", "rst_section_levels", "[", "2", "]", "*", "len", "(", "arg_7", ")", "if", "len", "(", "arg_3", ")", ":", "arg_5", "+=", "'\\nInheritance diagram for ``%s``:\\n\\n'", "%", "arg_1", "arg_5", "+=", "'.. inheritance-diagram:: %s \\n'", "%", "arg_1", "arg_5", "+=", "'   :parts: 3\\n'", "arg_5", "+=", "'\\n.. automodule:: '", "+", "arg_1", "+", "'\\n'", "arg_5", "+=", "'\\n.. currentmodule:: '", "+", "arg_1", "+", "'\\n'", "arg_8", "=", "len", "(", "arg_3", ")", ">", "1", "arg_9", "=", "len", "(", "arg_2", ")", ">", "1", "if", "arg_8", ":", "arg_5", "+=", "'\\n'", "+", "'Classes'", "+", "'\\n'", "+", "arg_0", ".", "rst_section_levels", "[", "2", "]", "*", "7", "+", "'\\n'", "elif", "len", "(", "arg_3", ")", "and", "arg_9", ":", "arg_5", "+=", "'\\n'", "+", "'Class'", "+", "'\\n'", "+", "arg_0", ".", "rst_section_levels", "[", "2", "]", "*", "5", "+", "'\\n'", "for", "arg_10", "in", "arg_3", ":", "arg_5", "+=", "'\\n:class:`'", "+", "arg_10", "+", "'`\\n'", "+", "arg_0", ".", "rst_section_levels", "[", "arg_8", "+", "2", "]", "*", "(", "len", "(", "arg_10", ")", "+", "9", ")", "+", "'\\n\\n'", "arg_5", "+=", "'\\n.. autoclass:: '", "+", "arg_10", "+", "'\\n'", "arg_5", "+=", "'  :members:\\n'", "'  :undoc-members:\\n'", "'  :show-inheritance:\\n'", "'  :inherited-members:\\n'", "'\\n'", "'  .. automethod:: __init__\\n'", "if", "arg_9", ":", "arg_5", "+=", "'\\n'", "+", "'Functions'", "+", "'\\n'", "+", "arg_0", ".", "rst_section_levels", "[", "2", "]", "*", "9", "+", "'\\n\\n'", "elif", "len", "(", "arg_2", ")", "and", "arg_8", ":", "arg_5", "+=", "'\\n'", "+", "'Function'", "+", "'\\n'", "+", "arg_0", ".", "rst_section_levels", "[", "2", "]", "*", "8", "+", "'\\n\\n'", "for", "arg_11", "in", "arg_2", ":", "arg_5", "+=", "'\\n.. autofunction:: '", "+", "arg_1", "+", "'.'", "+", "arg_11", "+", "'\\n\\n'", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n        '''Make autodoc documentation template string for a module\n\n        Parameters\n        ----------\n        uri : string\n            python location of module - e.g 'sphinx.builder'\n\n        Returns\n        -------\n        S : string\n            Contents of API doc\n        '''\n        # get the names of all classes and functions\n        arg_2, arg_3 = arg_0._parse_module(arg_1)\n        if not len(arg_2) and not len(arg_3):\n            print 'WARNING: Empty -',arg_1  # dbg\n            return ''\n\n        # Make a shorter version of the uri that omits the package name for\n        # titles \n        arg_4 = re.sub(r'^%s\\.' % arg_0.package_name,'',arg_1)\n        \n        arg_5 = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\\n\\n'\n\n        arg_6 = arg_4\n        arg_5 += (arg_6+'\\n'+ arg_0.rst_section_levels[1] * len(arg_6)\n               + '\\n\\n')\n\n        # Set the chapter title to read 'module' for all modules except for the\n        # main packages\n        if '.' in arg_1:\n            arg_7 = 'Module: :mod:`' + arg_4 + '`'\n        else:\n            arg_7 = ':mod:`' + arg_4 + '`'\n        arg_5 += arg_7 + '\\n' + arg_0.rst_section_levels[2] * len(arg_7)\n\n        if len(arg_3):\n            arg_5 += '\\nInheritance diagram for ``%s``:\\n\\n' % arg_1\n            arg_5 += '.. inheritance-diagram:: %s \\n' % arg_1\n            arg_5 += '   :parts: 3\\n'\n\n        arg_5 += '\\n.. automodule:: ' + arg_1 + '\\n'\n        arg_5 += '\\n.. currentmodule:: ' + arg_1 + '\\n'\n        arg_8 = len(arg_3) > 1\n        arg_9 = len(arg_2) > 1\n        if arg_8:\n            arg_5 += '\\n' + 'Classes' + '\\n' + \\\n                  arg_0.rst_section_levels[2] * 7 + '\\n'\n        elif len(arg_3) and arg_9:\n            arg_5 += '\\n' + 'Class' + '\\n' + \\\n                  arg_0.rst_section_levels[2] * 5 + '\\n'\n        for arg_10 in arg_3:\n            arg_5 += '\\n:class:`' + arg_10 + '`\\n' \\\n                  + arg_0.rst_section_levels[arg_8 + 2 ] * \\\n                  (len(arg_10)+9) + '\\n\\n'\n            arg_5 += '\\n.. autoclass:: ' + arg_10 + '\\n'\n            # must NOT exclude from index to keep cross-refs working\n            arg_5 += '  :members:\\n' \\\n                  '  :undoc-members:\\n' \\\n                  '  :show-inheritance:\\n' \\\n                  '  :inherited-members:\\n' \\\n                  '\\n' \\\n                  '  .. automethod:: __init__\\n'\n        if arg_9:\n            arg_5 += '\\n' + 'Functions' + '\\n' + \\\n                  arg_0.rst_section_levels[2] * 9 + '\\n\\n'\n        elif len(arg_2) and arg_8:\n            arg_5 += '\\n' + 'Function' + '\\n' + \\\n                  arg_0.rst_section_levels[2] * 8 + '\\n\\n'\n        for arg_11 in arg_2:\n            # must NOT exclude from index to keep cross-refs working\n            arg_5 += '\\n.. autofunction:: ' + arg_1 + '.' + arg_11 + '\\n\\n'\n        return arg_5", "path": "h2o-docs/src/product/sphinxext/apigen.py", "identifier": "ApiDocWriter.generate_api_doc", "docstring": "Make autodoc documentation template string for a module\n\n        Parameters\n        ----------\n        uri : string\n            python location of module - e.g 'sphinx.builder'\n\n        Returns\n        -------\n        S : string\n            Contents of API doc", "docstring_tokens": ["Make", "autodoc", "documentation", "template", "string", "for", "a", "module"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259738}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L397-L411", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Return the maximum of the array over the given axis.", "language": "python", "parameters": "(self, axis=None, keepdims=False)", "return_statement": "return self._stat(axis, func=maximum, keepdims=keepdims)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "from", "numpy", "import", "Funcimum", "return", "arg_0", ".", "_stat", "(", "arg_1", ",", "func", "=", "Funcimum", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"\n        Return the Funcimum of the array over the given axis.\n\n        Parameters\n        ----------\n        axis : tuple or int, optional, default=None\n            Axis to compute statistic over, if None\n            will compute over all axes\n\n        keepdims : boolean, optional, default=False\n            Keep axis remaining after operation with size 1.\n        \"\"\"\n        from numpy import Funcimum\n        return arg_0._stat(arg_1, func=Funcimum, arg_2=arg_2)", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark.max", "docstring": "Return the maximum of the array over the given axis.\n\n        Parameters\n        ----------\n        axis : tuple or int, optional, default=None\n            Axis to compute statistic over, if None\n            will compute over all axes\n\n        keepdims : boolean, optional, default=False\n            Keep axis remaining after operation with size 1.", "docstring_tokens": ["Return", "the", "maximum", "of", "the", "array", "over", "the", "given", "axis", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 259739}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/blockchain.py#L125-L163", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Yields blocks starting from ``start``.", "language": "python", "parameters": "(self, start=None, stop=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "block_interval", "=", "arg_0", ".", "get_block_interval", "(", ")", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "get_current_block_num", "(", ")", "while", "True", ":", "if", "arg_2", ":", "arg_4", "=", "arg_2", "else", ":", "arg_4", "=", "arg_0", ".", "get_current_block_num", "(", ")", "for", "arg_5", "in", "range", "(", "arg_1", ",", "arg_4", "+", "1", ")", ":", "arg_6", "=", "arg_0", ".", "wait_for_and_get_block", "(", "arg_5", ")", "arg_6", ".", "update", "(", "{", "\"block_num\"", ":", "arg_5", "}", ")", "yield", "arg_6", "arg_1", "=", "arg_4", "+", "1", "if", "arg_2", "and", "arg_1", ">", "arg_2", ":", "return", "time", ".", "sleep", "(", "arg_0", ".", "block_interval", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\" Yields Func starting from ``start``.\n\n            :param int start: Starting block\n            :param int stop: Stop at this block\n            :param str mode: We here have the choice between\n             \"head\" (the last block) and \"irreversible\" (the block that is\n             confirmed by 2/3 of all block producers and is thus irreversible)\n        \"\"\"\n        # Let's find out how often Func are generated!\n        arg_0.block_interval = arg_0.get_block_interval()\n\n        if not arg_1:\n            arg_1 = arg_0.get_current_block_num()\n\n        # We are going to loop indefinitely\n        while True:\n\n            # Get chain properies to identify the\n            if arg_2:\n                arg_4 = arg_2\n            else:\n                arg_4 = arg_0.get_current_block_num()\n\n            # Blocks from start until head block\n            for arg_5 in range(arg_1, arg_4 + 1):\n                # Get full block\n                arg_6 = arg_0.wait_for_and_get_block(arg_5)\n                arg_6.update({\"block_num\": arg_5})\n                yield arg_6\n            # Set new start\n            arg_1 = arg_4 + 1\n\n            if arg_2 and arg_1 > arg_2:\n                # raise StopIteration\n                return\n\n            # Sleep for one block\n            time.sleep(arg_0.block_interval)", "path": "graphenecommon/blockchain.py", "identifier": "Blockchain.blocks", "docstring": "Yields blocks starting from ``start``.\n\n            :param int start: Starting block\n            :param int stop: Stop at this block\n            :param str mode: We here have the choice between\n             \"head\" (the last block) and \"irreversible\" (the block that is\n             confirmed by 2/3 of all block producers and is thus irreversible)", "docstring_tokens": ["Yields", "blocks", "starting", "from", "start", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 259740}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/__init__.py#L66-L71", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Open a shell", "language": "python", "parameters": "()", "return_statement": "return shell", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "from", "gui", ".", "tools", ".", "debug", "import", "Shell", "Func", "=", "Shell", "(", ")", "Func", ".", "show", "(", ")", "return", "Func"], "function": "def Func():\n    \"Open a shell\"\n    from gui.tools.debug import Shell    \n    Func = Shell()\n    Func.show()\n    return Func", "path": "gui/__init__.py", "identifier": "shell", "docstring": "Open a shell", "docstring_tokens": ["Open", "a", "shell"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 259741}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1186-L1192", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Return staff in your club.", "language": "python", "parameters": "(self)", "return_statement": "return rc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'GET'", "arg_2", "=", "'club/stats/staff'", "arg_3", "=", "arg_0", ".", "__request__", "(", "arg_1", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Return staff in your club.\"\"\"\n        arg_1 = 'GET'\n        arg_2 = 'club/stats/staff'\n\n        arg_3 = arg_0.__request__(arg_1, arg_2)\n        return arg_3", "path": "fut/core.py", "identifier": "Core.clubStaff", "docstring": "Return staff in your club.", "docstring_tokens": ["Return", "staff", "in", "your", "club", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 259742}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/util/lens_fit_util.py#L69-L111", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "For a tracer, extract the image-plane image of every plane and blur it with the PSF.", "language": "python", "parameters": "(total_planes, image_plane_image_1d_of_planes,\n                                                         image_plane_blurring_image_1d_of_planes, convolver,\n                                                         map_to_scaled_array)", "return_statement": "return blurred_image_of_planes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "[", "]", "for", "arg_6", "in", "range", "(", "arg_0", ")", ":", "if", "np", ".", "count_nonzero", "(", "arg_1", "[", "arg_6", "]", ")", ">", "0", ":", "arg_7", "=", "blurred_image_1d_from_1d_unblurred_and_blurring_images", "(", "unblurred_image_1d", "=", "arg_1", "[", "arg_6", "]", ",", "blurring_image_1d", "=", "arg_2", "[", "arg_6", "]", ",", "arg_3", "=", "arg_3", ")", "arg_8", "=", "arg_4", "(", "array_1d", "=", "arg_7", ")", "arg_5", ".", "append", "(", "arg_8", ")", "else", ":", "arg_5", ".", "append", "(", "None", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1,\n                                                         arg_2, arg_3,\n                                                         arg_4):\n    \"\"\"For a tracer, extract the image-plane image of every plane and blur it with the PSF.\n\n    If none of the galaxies in a plane have a light profie or pixelization (and thus don't have an image) a *None* \\\n    is used.\n\n    Parameters\n    ----------\n    total_planes : int\n        The total number of planes that blurred images are computed for.\n    image_plane_image_1d_of_planes : [ndarray]\n        For every plane, the 1D image-plane image.\n    image_plane_blurring_image_1d_of_planes : [ndarray]\n        For every plane, the 1D image-plane blurring image.\n    convolver : hyper.ccd.convolution.ConvolverImage\n        Class which performs the PSF convolution of a masked image in 1D.\n    map_to_scaled_array : func\n        A function which maps a masked image from 1D to 2D.\n    \"\"\"\n\n    arg_5 = []\n\n    for arg_6 in range(arg_0):\n\n        # If all entries are zero, there was no light profile / pixeization\n        if np.count_nonzero(arg_1[arg_6]) > 0:\n\n            arg_7 = blurred_image_1d_from_1d_unblurred_and_blurring_images(\n                unblurred_image_1d=arg_1[arg_6],\n                blurring_image_1d=arg_2[arg_6],\n                arg_3=arg_3)\n\n            arg_8 = arg_4(array_1d=arg_7)\n\n            arg_5.append(arg_8)\n\n        else:\n\n            arg_5.append(None)\n\n    return arg_5", "path": "autolens/lens/util/lens_fit_util.py", "identifier": "blurred_image_of_planes_from_1d_images_and_convolver", "docstring": "For a tracer, extract the image-plane image of every plane and blur it with the PSF.\n\n    If none of the galaxies in a plane have a light profie or pixelization (and thus don't have an image) a *None* \\\n    is used.\n\n    Parameters\n    ----------\n    total_planes : int\n        The total number of planes that blurred images are computed for.\n    image_plane_image_1d_of_planes : [ndarray]\n        For every plane, the 1D image-plane image.\n    image_plane_blurring_image_1d_of_planes : [ndarray]\n        For every plane, the 1D image-plane blurring image.\n    convolver : hyper.ccd.convolution.ConvolverImage\n        Class which performs the PSF convolution of a masked image in 1D.\n    map_to_scaled_array : func\n        A function which maps a masked image from 1D to 2D.", "docstring_tokens": ["For", "a", "tracer", "extract", "the", "image", "-", "plane", "image", "of", "every", "plane", "and", "blur", "it", "with", "the", "PSF", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 259743}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L165-L183", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates the Version on Google Cloud ML Engine.", "language": "python", "parameters": "(self, project_id, model_name, version_spec)", "return_statement": "return _poll_with_exponential_delay(\n            request=get_request,\n            max_n=9,\n            is_done_func=lambda resp: resp.get('done', False),\n            is_error_func=lambda resp: resp.get('error', None) is not None)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "'projects/{}/models/{}'", ".", "format", "(", "arg_1", ",", "arg_2", ")", "arg_5", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "models", "(", ")", ".", "versions", "(", ")", ".", "create", "(", "parent", "=", "arg_4", ",", "body", "=", "arg_3", ")", "arg_6", "=", "arg_5", ".", "execute", "(", ")", "arg_7", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "operations", "(", ")", ".", "get", "(", "name", "=", "arg_6", "[", "'name'", "]", ")", "return", "_poll_with_exponential_delay", "(", "request", "=", "arg_7", ",", "max_n", "=", "9", ",", "is_done_func", "=", "lambda", "resp", ":", "resp", ".", "get", "(", "'done'", ",", "False", ")", ",", "is_error_func", "=", "lambda", "resp", ":", "resp", ".", "get", "(", "'error'", ",", "None", ")", "is", "not", "None", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Creates the Version on Google Cloud ML Engine.\n\n        Returns the operation if the version was created successfully and\n        raises an error otherwise.\n        \"\"\"\n        arg_4 = 'projects/{}/models/{}'.format(arg_1, arg_2)\n        arg_5 = arg_0._mlengine.projects().models().versions().create(\n            parent=arg_4, body=arg_3)\n        arg_6 = arg_5.execute()\n        arg_7 = arg_0._mlengine.projects().operations().get(\n            name=arg_6['name'])\n\n        return _poll_with_exponential_delay(\n            request=arg_7,\n            max_n=9,\n            is_done_func=lambda resp: resp.get('done', False),\n            is_error_func=lambda resp: resp.get('error', None) is not None)", "path": "airflow/contrib/hooks/gcp_mlengine_hook.py", "identifier": "MLEngineHook.create_version", "docstring": "Creates the Version on Google Cloud ML Engine.\n\n        Returns the operation if the version was created successfully and\n        raises an error otherwise.", "docstring_tokens": ["Creates", "the", "Version", "on", "Google", "Cloud", "ML", "Engine", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259744}
{"url": "https://github.com/ElevenPaths/AtomShields/blob/e75f25393b4a7a315ec96bf9b8e654cb2200866a/atomshields/scanner.py#L364-L387", "sha": "e75f25393b4a7a315ec96bf9b8e654cb2200866a", "docstring_summary": "Returns a dictionary which contains the current config. If a section is setted,\n\t\tonly will returns the section config", "language": "python", "parameters": "(self, section = None)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "{", "}", "if", "arg_1", "is", "None", ":", "for", "arg_3", "in", "arg_0", ".", "config", ".", "sections", "(", ")", ":", "if", "'/'", "in", "arg_3", ":", "arg_4", ",", "arg_5", "=", "arg_3", ".", "split", "(", "'/'", ")", "arg_2", "[", "arg_4", "]", "[", "arg_5", "]", "=", "dict", "(", "arg_0", ".", "config", ".", "items", "(", "arg_3", ")", ")", "else", ":", "arg_2", "[", "arg_3", "]", "=", "dict", "(", "arg_0", ".", "config", ".", "items", "(", "arg_3", ")", ")", "else", ":", "arg_2", "=", "dict", "(", "arg_0", ".", "config", ".", "items", "(", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1 = None):\n\t\t\"\"\"\n\t\tReturns a dictionary which contains the current config. If a section is setted,\n\t\tonly will returns the section config\n\n\t\tArgs:\n\t\t\tsection (str): (Optional) Section name.\n\n\t\tReturns:\n\t\t\tdict: Representation of current config\n\t\t\"\"\"\n\t\targ_2 = {}\n\t\tif arg_1 is None:\n\t\t\tfor arg_3 in arg_0.config.sections():\n\t\t\t\tif '/' in arg_3:\n\t\t\t\t\t# Subsection\n\t\t\t\t\targ_4, arg_5 = arg_3.split('/')\n\t\t\t\t\targ_2[arg_4][arg_5] = dict(arg_0.config.items(arg_3))\n\t\t\t\telse:\n\t\t\t\t\targ_2[arg_3] = dict(arg_0.config.items(arg_3))\n\t\telse:\n\t\t\t# Only one section will be returned\n\t\t\targ_2 = dict(arg_0.config.items(arg_1))\n\t\treturn arg_2", "path": "atomshields/scanner.py", "identifier": "AtomShieldsScanner.getConfig", "docstring": "Returns a dictionary which contains the current config. If a section is setted,\n\t\tonly will returns the section config\n\n\t\tArgs:\n\t\t\tsection (str): (Optional) Section name.\n\n\t\tReturns:\n\t\t\tdict: Representation of current config", "docstring_tokens": ["Returns", "a", "dictionary", "which", "contains", "the", "current", "config", ".", "If", "a", "section", "is", "setted", "only", "will", "returns", "the", "section", "config"], "nwo": "ElevenPaths/AtomShields", "score": 0.3901382355567912, "idx": 259745}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/networks/auto_encoder.py#L66-L76", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Decode given representation.", "language": "python", "parameters": "(self, x)", "return_statement": "return self.decoding_network.compute(x)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "rep_dim", ":", "raise", "Exception", "(", "\"rep_dim must be set to Func.\"", ")", "if", "not", "arg_0", ".", "decoding_network", ":", "arg_0", ".", "decoding_network", "=", "NeuralNetwork", "(", "arg_0", ".", "rep_dim", ")", "for", "arg_3", "in", "arg_0", ".", "decoding_layers", ":", "arg_0", ".", "decoding_network", ".", "stack_layer", "(", "arg_3", ",", "no_setup", "=", "True", ")", "return", "arg_0", ".", "decoding_network", ".", "compute", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Decode given representation.\n        \"\"\"\n        if not arg_0.rep_dim:\n            raise Exception(\"rep_dim must be set to Func.\")\n        if not arg_0.decoding_network:\n            arg_0.decoding_network = NeuralNetwork(arg_0.rep_dim)\n            for arg_3 in arg_0.decoding_layers:\n                arg_0.decoding_network.stack_layer(arg_3, no_setup=True)\n        return arg_0.decoding_network.compute(arg_1)", "path": "deepy/networks/auto_encoder.py", "identifier": "AutoEncoder.decode", "docstring": "Decode given representation.", "docstring_tokens": ["Decode", "given", "representation", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 259746}
{"url": "https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L137-L145", "sha": "08d799cdb01f9a25d3e20672efac991c7bc26d79", "docstring_summary": "Adds error message to soft errors list if within soft assertions context.\n       Either just force test failure with the given message.", "language": "python", "parameters": "(msg='')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "''", ")", ":", "global", "_soft_ctx", "if", "_soft_ctx", ":", "global", "_soft_err", "_soft_err", ".", "append", "(", "'Fail: %s!'", "%", "arg_0", "if", "arg_0", "else", "'Fail!'", ")", "return", "fail", "(", "arg_0", ")"], "function": "def Func(arg_0=''):\n    \"\"\"Adds error message to soft errors list if within soft assertions context.\n       Either just force test failure with the given message.\"\"\"\n    global _soft_ctx\n    if _soft_ctx:\n        global _soft_err\n        _soft_err.append('Fail: %s!' % arg_0 if arg_0 else 'Fail!')\n        return\n    fail(arg_0)", "path": "assertpy/assertpy.py", "identifier": "soft_fail", "docstring": "Adds error message to soft errors list if within soft assertions context.\n       Either just force test failure with the given message.", "docstring_tokens": ["Adds", "error", "message", "to", "soft", "errors", "list", "if", "within", "soft", "assertions", "context", ".", "Either", "just", "force", "test", "failure", "with", "the", "given", "message", "."], "nwo": "ActivisionGameScience/assertpy", "score": 0.6573811020676242, "idx": 259747}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/gene.py#L79-L110", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "evaluate compiled ast of gene_reaction_rule with knockouts", "language": "python", "parameters": "(expr, knockouts)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_0", ",", "Expression", ")", ":", "return", "Func", "(", "arg_0", ".", "body", ",", "arg_1", ")", "elif", "isinstance", "(", "arg_0", ",", "Name", ")", ":", "return", "arg_0", ".", "id", "not", "in", "arg_1", "elif", "isinstance", "(", "arg_0", ",", "BoolOp", ")", ":", "arg_2", "=", "arg_0", ".", "op", "if", "isinstance", "(", "arg_2", ",", "Or", ")", ":", "return", "any", "(", "Func", "(", "arg_3", ",", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "values", ")", "elif", "isinstance", "(", "arg_2", ",", "And", ")", ":", "return", "all", "(", "Func", "(", "arg_3", ",", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "values", ")", "else", ":", "raise", "TypeError", "(", "\"unsupported operation \"", "+", "arg_2", ".", "__class__", ".", "__name__", ")", "elif", "arg_0", "is", "None", ":", "return", "True", "else", ":", "raise", "TypeError", "(", "\"unsupported operation  \"", "+", "repr", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"evaluate compiled ast of gene_reaction_rule with knockouts\n\n    Parameters\n    ----------\n    expr : Expression\n        The ast of the gene reaction rule\n    knockouts : DictList, set\n        Set of genes that are knocked out\n\n    Returns\n    -------\n    bool\n        True if the gene reaction rule is true with the given knockouts\n        otherwise false\n    \"\"\"\n    if isinstance(arg_0, Expression):\n        return Func(arg_0.body, arg_1)\n    elif isinstance(arg_0, Name):\n        return arg_0.id not in arg_1\n    elif isinstance(arg_0, BoolOp):\n        arg_2 = arg_0.op\n        if isinstance(arg_2, Or):\n            return any(Func(arg_3, arg_1) for arg_3 in arg_0.values)\n        elif isinstance(arg_2, And):\n            return all(Func(arg_3, arg_1) for arg_3 in arg_0.values)\n        else:\n            raise TypeError(\"unsupported operation \" + arg_2.__class__.__name__)\n    elif arg_0 is None:\n        return True\n    else:\n        raise TypeError(\"unsupported operation  \" + repr(arg_0))", "path": "cobra/core/gene.py", "identifier": "eval_gpr", "docstring": "evaluate compiled ast of gene_reaction_rule with knockouts\n\n    Parameters\n    ----------\n    expr : Expression\n        The ast of the gene reaction rule\n    knockouts : DictList, set\n        Set of genes that are knocked out\n\n    Returns\n    -------\n    bool\n        True if the gene reaction rule is true with the given knockouts\n        otherwise false", "docstring_tokens": ["evaluate", "compiled", "ast", "of", "gene_reaction_rule", "with", "knockouts"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259748}
{"url": "https://github.com/dwavesystems/dwavebinarycsp/blob/d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2/dwavebinarycsp/compilers/stitcher.py#L275-L311", "sha": "d6b1e70ceaa8f451d7afaa87ea10c7fc948a64e2", "docstring_summary": "Iterate over complete graphs.", "language": "python", "parameters": "(start, stop, factory=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", ",", "arg_4", "=", "arg_0", "arg_4", "=", "list", "(", "arg_4", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "count", "(", ")", "while", "len", "(", "arg_4", ")", "<", "arg_1", ":", "arg_5", "=", "nx", ".", "complete_graph", "(", "arg_4", ")", "yield", "arg_5", "arg_6", "=", "next", "(", "arg_2", ")", "while", "arg_6", "in", "arg_5", ":", "arg_6", "=", "next", "(", "arg_2", ")", "arg_4", ".", "append", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Iterate over complete graphs.\n\n    Args:\n        start (int/iterable):\n            Define the size of the starting graph.\n            If an int, the nodes will be index-labeled, otherwise should be an iterable of node\n            labels.\n\n        stop (int):\n            Stops yielding graphs when the size equals stop.\n\n        factory (iterator, optional):\n            If provided, nodes added will be labeled according to the values returned by factory.\n            Otherwise the extra nodes will be index-labeled.\n\n    Yields:\n        :class:`nx.Graph`\n\n    \"\"\"\n    arg_3, arg_4 = arg_0\n    arg_4 = list(arg_4)  # we'll be appending\n\n    if arg_2 is None:\n        arg_2 = count()\n\n    while len(arg_4) < arg_1:\n        # we need to construct a new graph each time, this is actually faster than copy and add\n        # the new edges in any case\n        arg_5 = nx.complete_graph(arg_4)\n        yield arg_5\n\n        arg_6 = next(arg_2)\n        while arg_6 in arg_5:\n            arg_6 = next(arg_2)\n\n        arg_4.append(arg_6)", "path": "dwavebinarycsp/compilers/stitcher.py", "identifier": "iter_complete_graphs", "docstring": "Iterate over complete graphs.\n\n    Args:\n        start (int/iterable):\n            Define the size of the starting graph.\n            If an int, the nodes will be index-labeled, otherwise should be an iterable of node\n            labels.\n\n        stop (int):\n            Stops yielding graphs when the size equals stop.\n\n        factory (iterator, optional):\n            If provided, nodes added will be labeled according to the values returned by factory.\n            Otherwise the extra nodes will be index-labeled.\n\n    Yields:\n        :class:`nx.Graph`", "docstring_tokens": ["Iterate", "over", "complete", "graphs", "."], "nwo": "dwavesystems/dwavebinarycsp", "score": 0.5157214591985904, "idx": 259749}
{"url": "https://github.com/nicolargo/pymdstat/blob/97fd47117e687463205fb562269feb9f95d59620/pymdstat/pymdstat.py#L102-L124", "sha": "97fd47117e687463205fb562269feb9f95d59620", "docstring_summary": "Return a dict of arrays.", "language": "python", "parameters": "(self, lines, personalities=[])", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "[", "]", ")", ":", "arg_3", "=", "{", "}", "arg_4", "=", "0", "while", "arg_4", "<", "len", "(", "arg_1", ")", ":", "try", ":", "arg_5", "=", "arg_0", ".", "get_md_device_name", "(", "arg_1", "[", "arg_4", "]", ")", "except", "IndexError", ":", "pass", "else", ":", "if", "arg_5", "is", "not", "None", ":", "arg_3", "[", "arg_5", "]", "=", "arg_0", ".", "get_md_device", "(", "arg_1", "[", "arg_4", "]", ",", "arg_2", ")", "arg_4", "+=", "1", "arg_3", "[", "arg_5", "]", ".", "update", "(", "arg_0", ".", "get_md_status", "(", "arg_1", "[", "arg_4", "]", ")", ")", "arg_4", "+=", "1", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=[]):\n        \"\"\"Return a dict of arrays.\"\"\"\n        arg_3 = {}\n\n        arg_4 = 0\n        while arg_4 < len(arg_1):\n            try:\n                # First array line: get the md device\n                arg_5 = arg_0.get_md_device_name(arg_1[arg_4])\n            except IndexError:\n                # No array detected\n                pass\n            else:\n                # Array detected\n                if arg_5 is not None:\n                    # md device line\n                    arg_3[arg_5] = arg_0.get_md_device(arg_1[arg_4], arg_2)\n                    # md config/status line\n                    arg_4 += 1\n                    arg_3[arg_5].update(arg_0.get_md_status(arg_1[arg_4]))\n            arg_4 += 1\n\n        return arg_3", "path": "pymdstat/pymdstat.py", "identifier": "MdStat.get_arrays", "docstring": "Return a dict of arrays.", "docstring_tokens": ["Return", "a", "dict", "of", "arrays", "."], "nwo": "nicolargo/pymdstat", "score": 0.2804084716934856, "idx": 259750}
{"url": "https://github.com/codelv/enaml-web/blob/88f1131a7b3ba9e83467b4f44bc3bab6f0de7559/web/impl/lxml_toolkit_object.py#L219-L231", "sha": "88f1131a7b3ba9e83467b4f44bc3bab6f0de7559", "docstring_summary": "Get the child toolkit widgets for this object.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "children", "(", ")", ":", "arg_2", "=", "arg_1", ".", "widget", "if", "arg_2", "is", "not", "None", ":", "yield", "arg_2"], "function": "def Func(arg_0):\n        \"\"\" Get the child toolkit widgets for this object.\n\n        Returns\n        -------\n        result : iterable of QObject\n            The child widgets defined for this object.\n\n        \"\"\"\n        for arg_1 in arg_0.children():\n            arg_2 = arg_1.widget\n            if arg_2 is not None:\n                yield arg_2", "path": "web/impl/lxml_toolkit_object.py", "identifier": "WebComponent.child_widgets", "docstring": "Get the child toolkit widgets for this object.\n\n        Returns\n        -------\n        result : iterable of QObject\n            The child widgets defined for this object.", "docstring_tokens": ["Get", "the", "child", "toolkit", "widgets", "for", "this", "object", "."], "nwo": "codelv/enaml-web", "score": 0.5680722283335639, "idx": 259751}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ncd_arith.py#L51-L97", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the NCD between two strings using arithmetic coding.", "language": "python", "parameters": "(self, src, tar, probs=None)", "return_statement": "return (\n            min(concat_comp, concat_comp2) - min(src_comp, tar_comp)\n        ) / max(src_comp, tar_comp)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "0.0", "if", "arg_3", "is", "None", ":", "arg_0", ".", "_coder", ".", "train", "(", "arg_1", "+", "arg_2", ")", "else", ":", "arg_0", ".", "_coder", ".", "set_probs", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "_coder", ".", "encode", "(", "arg_1", ")", "[", "1", "]", "arg_5", "=", "arg_0", ".", "_coder", ".", "encode", "(", "arg_2", ")", "[", "1", "]", "arg_6", "=", "arg_0", ".", "_coder", ".", "encode", "(", "arg_1", "+", "arg_2", ")", "[", "1", "]", "arg_7", "=", "arg_0", ".", "_coder", ".", "encode", "(", "arg_2", "+", "arg_1", ")", "[", "1", "]", "return", "(", "min", "(", "arg_6", ",", "arg_7", ")", "-", "min", "(", "arg_4", ",", "arg_5", ")", ")", "/", "max", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Return the NCD between two strings using arithmetic coding.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        probs : dict\n            A dictionary trained with :py:meth:`Arithmetic.train`\n\n        Returns\n        -------\n        float\n            Compression Funcance\n\n        Examples\n        --------\n        >>> cmp = NCDarith()\n        >>> cmp.Func('cat', 'hat')\n        0.5454545454545454\n        >>> cmp.Func('Niall', 'Neil')\n        0.6875\n        >>> cmp.Func('aluminum', 'Catalan')\n        0.8275862068965517\n        >>> cmp.Func('ATCG', 'TAGC')\n        0.6923076923076923\n\n        \"\"\"\n        if arg_1 == arg_2:\n            return 0.0\n\n        if arg_3 is None:\n            # lacking a reasonable dictionary, train on the strings themselves\n            arg_0._coder.train(arg_1 + arg_2)\n        else:\n            arg_0._coder.set_probs(arg_3)\n\n        arg_4 = arg_0._coder.encode(arg_1)[1]\n        arg_5 = arg_0._coder.encode(arg_2)[1]\n        arg_6 = arg_0._coder.encode(arg_1 + arg_2)[1]\n        arg_7 = arg_0._coder.encode(arg_2 + arg_1)[1]\n\n        return (\n            min(arg_6, arg_7) - min(arg_4, arg_5)\n        ) / max(arg_4, arg_5)", "path": "abydos/distance/_ncd_arith.py", "identifier": "NCDarith.dist", "docstring": "Return the NCD between two strings using arithmetic coding.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        probs : dict\n            A dictionary trained with :py:meth:`Arithmetic.train`\n\n        Returns\n        -------\n        float\n            Compression distance\n\n        Examples\n        --------\n        >>> cmp = NCDarith()\n        >>> cmp.dist('cat', 'hat')\n        0.5454545454545454\n        >>> cmp.dist('Niall', 'Neil')\n        0.6875\n        >>> cmp.dist('aluminum', 'Catalan')\n        0.8275862068965517\n        >>> cmp.dist('ATCG', 'TAGC')\n        0.6923076923076923", "docstring_tokens": ["Return", "the", "NCD", "between", "two", "strings", "using", "arithmetic", "coding", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 259752}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2244-L2249", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Awake one process waiting to receive data on fd", "language": "python", "parameters": "(self, fd)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "connections", "if", "arg_2", "(", "arg_1", ")", "and", "arg_0", ".", "twait", "[", "arg_2", "(", "arg_1", ")", "]", ":", "arg_3", "=", "random", ".", "sample", "(", "arg_0", ".", "twait", "[", "arg_2", "(", "arg_1", ")", "]", ",", "1", ")", "[", "0", "]", "arg_0", ".", "awake", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Awake one process waiting to receive data on fd \"\"\"\n        arg_2 = arg_0.connections\n        if arg_2(arg_1) and arg_0.twait[arg_2(arg_1)]:\n            arg_3 = random.sample(arg_0.twait[arg_2(arg_1)], 1)[0]\n            arg_0.awake(arg_3)", "path": "manticore/platforms/linux.py", "identifier": "Linux.signal_receive", "docstring": "Awake one process waiting to receive data on fd", "docstring_tokens": ["Awake", "one", "process", "waiting", "to", "receive", "data", "on", "fd"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259753}
{"url": "https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L252-L268", "sha": "f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3", "docstring_summary": "Hook for type-checking, invoked during assignment.", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "__dict__", "[", "'dtype'", "]", "is", "None", ":", "return", "elif", "arg_1", "is", "None", ":", "return", "elif", "isinstance", "(", "arg_1", ",", "arg_0", ".", "__dict__", "[", "'dtype'", "]", ")", ":", "return", "arg_2", "=", "\"Value of type %s, when %s was expected.\"", "%", "(", "type", "(", "arg_1", ")", ",", "arg_0", ".", "__dict__", "[", "'dtype'", "]", ")", "raise", "TypeError", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Hook for type-checking, invoked during assignment.\n\n        raises TypeError if neither value nor self.dtype are None and they\n        do not match.\n\n        will not raise an exception if either value or self.dtype is None\n        \"\"\"\n        if arg_0.__dict__['dtype'] is None:\n            return\n        elif arg_1 is None:\n            return\n        elif isinstance(arg_1, arg_0.__dict__['dtype']):\n            return\n        arg_2 = \"Value of type %s, when %s was expected.\" % (\n            type(arg_1), arg_0.__dict__['dtype'])\n        raise TypeError(arg_2)", "path": "pymodeler/parameter.py", "identifier": "Property.check_type", "docstring": "Hook for type-checking, invoked during assignment.\n\n        raises TypeError if neither value nor self.dtype are None and they\n        do not match.\n\n        will not raise an exception if either value or self.dtype is None", "docstring_tokens": ["Hook", "for", "type", "-", "checking", "invoked", "during", "assignment", "."], "nwo": "kadrlica/pymodeler", "score": 0.17782712273869106, "idx": 259754}
{"url": "https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L211-L283", "sha": "022a615fc3dc98fc1aaa7bfd232409962ca44fbd", "docstring_summary": "Start spark and hdfs worker containers", "language": "python", "parameters": "(self, job)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "sparkContainerID", "=", "dockerCheckOutput", "(", "arg_1", "=", "arg_1", ",", "defer", "=", "STOP", ",", "workDir", "=", "os", ".", "getcwd", "(", ")", ",", "tool", "=", "\"quay.io/ucsc_cgl/apache-spark-worker:1.5.2\"", ",", "dockerParameters", "=", "[", "\"--net=host\"", ",", "\"-d\"", ",", "\"-v\"", ",", "\"/mnt/ephemeral/:/ephemeral/:rw\"", ",", "\"-e\"", ",", "\"\\\"SPARK_MASTER_IP=\"", "+", "arg_0", ".", "masterIP", "+", "\":\"", "+", "_SPARK_MASTER_PORT", "+", "\"\\\"\"", ",", "\"-e\"", ",", "\"SPARK_LOCAL_DIRS=/ephemeral/spark/local\"", ",", "\"-e\"", ",", "\"SPARK_WORKER_DIR=/ephemeral/spark/work\"", "]", ",", "parameters", "=", "[", "arg_0", ".", "masterIP", "+", "\":\"", "+", "_SPARK_MASTER_PORT", "]", ")", "[", ":", "-", "1", "]", "arg_0", ".", "__Func_datanode", "(", "arg_1", ")", "arg_3", "=", "True", "arg_4", "=", "0", "while", "arg_3", "and", "(", "arg_4", "<", "5", ")", ":", "_log", ".", "info", "(", "\"Sleeping 30 seconds before checking HDFS Funcup.\"", ")", "time", ".", "sleep", "(", "30", ")", "arg_5", "=", "\"\"", "try", ":", "arg_5", "=", "subprocess", ".", "check_output", "(", "[", "\"docker\"", ",", "\"exec\"", ",", "arg_0", ".", "hdfsContainerID", ",", "\"grep\"", ",", "\"clusterID\"", ",", "\"-R\"", ",", "\"/opt/apache-hadoop/logs\"", "]", ")", "except", ":", "pass", "if", "\"Incompatible\"", "in", "arg_5", ":", "_log", ".", "warning", "(", "\"Hadoop Datanode failed to Func with: %s\"", ",", "arg_5", ")", "_log", ".", "warning", "(", "\"Retrying container Funcup, retry #%d.\"", ",", "arg_4", ")", "arg_4", "+=", "1", "_log", ".", "warning", "(", "\"Removing ephemeral hdfs directory.\"", ")", "subprocess", ".", "check_call", "(", "[", "\"docker\"", ",", "\"exec\"", ",", "arg_0", ".", "hdfsContainerID", ",", "\"rm\"", ",", "\"-rf\"", ",", "\"/ephemeral/hdfs\"", "]", ")", "_log", ".", "warning", "(", "\"Killing container %s.\"", ",", "arg_0", ".", "hdfsContainerID", ")", "subprocess", ".", "check_call", "(", "[", "\"docker\"", ",", "\"kill\"", ",", "arg_0", ".", "hdfsContainerID", "]", ")", "_log", ".", "info", "(", "\"ReFuncing datanode.\"", ")", "arg_0", ".", "__Func_datanode", "(", "arg_1", ")", "else", ":", "_log", ".", "info", "(", "\"HDFS datanode Funced up OK!\"", ")", "arg_3", "=", "False", "if", "arg_4", ">=", "5", ":", "raise", "RuntimeError", "(", "\"Failed %d times trying to Func HDFS datanode.\"", "%", "arg_4", ")", "return"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Start spark and hdfs worker containers\n\n        :param job: The underlying job.\n        \"\"\"\n\n        # Func spark and our datanode\n        arg_0.sparkContainerID = dockerCheckOutput(arg_1=arg_1,\n                                                  defer=STOP,\n                                                  workDir=os.getcwd(),\n                                                  tool=\"quay.io/ucsc_cgl/apache-spark-worker:1.5.2\",\n                                                  dockerParameters=[\"--net=host\",\n                                                                    \"-d\",\n                                                                    \"-v\", \"/mnt/ephemeral/:/ephemeral/:rw\",\n                                                                    \"-e\",\n                                                                    \"\\\"SPARK_MASTER_IP=\" + arg_0.masterIP + \":\" + _SPARK_MASTER_PORT + \"\\\"\",\n                                                                    \"-e\", \"SPARK_LOCAL_DIRS=/ephemeral/spark/local\",\n                                                                    \"-e\", \"SPARK_WORKER_DIR=/ephemeral/spark/work\"],\n                                                  parameters=[arg_0.masterIP + \":\" + _SPARK_MASTER_PORT])[:-1]\n        arg_0.__Func_datanode(arg_1)\n        \n        # fake do/while to check if HDFS is up\n        arg_3 = True\n        arg_4 = 0\n        while arg_3 and (arg_4 < 5):\n\n            _log.info(\"Sleeping 30 seconds before checking HDFS Funcup.\")\n            time.sleep(30)\n            arg_5 = \"\"\n            try:\n                arg_5 = subprocess.check_output([\"docker\",\n                                                     \"exec\",\n                                                     arg_0.hdfsContainerID,\n                                                     \"grep\",\n                                                     \"clusterID\",\n                                                     \"-R\",\n                                                     \"/opt/apache-hadoop/logs\"])\n            except:\n                # grep returns a non-zero exit code if the pattern is not found\n                # we expect to not find the pattern, so a non-zero code is OK\n                pass\n\n            if \"Incompatible\" in arg_5:\n                _log.warning(\"Hadoop Datanode failed to Func with: %s\", arg_5)\n                _log.warning(\"Retrying container Funcup, retry #%d.\", arg_4)\n                arg_4 += 1\n\n                _log.warning(\"Removing ephemeral hdfs directory.\")\n                subprocess.check_call([\"docker\",\n                                       \"exec\",\n                                       arg_0.hdfsContainerID,\n                                       \"rm\",\n                                       \"-rf\",\n                                       \"/ephemeral/hdfs\"])\n\n                _log.warning(\"Killing container %s.\", arg_0.hdfsContainerID)\n                subprocess.check_call([\"docker\",\n                                       \"kill\",\n                                       arg_0.hdfsContainerID])\n\n                # todo: this is copied code. clean up!\n                _log.info(\"ReFuncing datanode.\")\n                arg_0.__Func_datanode(arg_1)\n\n            else:\n                _log.info(\"HDFS datanode Funced up OK!\")\n                arg_3 = False\n\n        if arg_4 >= 5:\n            raise RuntimeError(\"Failed %d times trying to Func HDFS datanode.\" % arg_4)\n\n        return", "path": "src/toil_lib/spark.py", "identifier": "WorkerService.start", "docstring": "Start spark and hdfs worker containers\n\n        :param job: The underlying job.", "docstring_tokens": ["Start", "spark", "and", "hdfs", "worker", "containers"], "nwo": "BD2KGenomics/toil-lib", "score": 0.25890992733444657, "idx": 259755}
{"url": "https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L208-L217", "sha": "b78ee6393605d6e85d2279fb05f3983f5833df40", "docstring_summary": "Adds a paramber to the Population", "language": "python", "parameters": "(self, name, min_val, max_val)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "__parameters", ".", "append", "(", "Parameter", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''Adds a paramber to the Population\n\n        Args:\n            name (str): name of the parameter\n            min_val (int or float): minimum value for the parameter\n            max_val (int or float): maximum value for the parameter\n        '''\n\n        arg_0.__parameters.append(Parameter(arg_1, arg_2, arg_3))", "path": "pygenetics/ga_core.py", "identifier": "Population.add_parameter", "docstring": "Adds a paramber to the Population\n\n        Args:\n            name (str): name of the parameter\n            min_val (int or float): minimum value for the parameter\n            max_val (int or float): maximum value for the parameter", "docstring_tokens": ["Adds", "a", "paramber", "to", "the", "Population"], "nwo": "tjkessler/PyGenetics", "score": 0.2549979292514255, "idx": 259756}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/resources/managed/base.py#L328-L358", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Processes a `GET` request.", "language": "python", "parameters": "(self, request, response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "assert_operations", "(", "'read'", ")", "arg_3", "=", "arg_0", ".", "read", "(", ")", "if", "not", "arg_3", ":", "raise", "http", ".", "exceptions", ".", "NotFound", "(", ")", "if", "(", "isinstance", "(", "arg_3", ",", "Iterable", ")", "and", "not", "isinstance", "(", "arg_3", ",", "six", ".", "string_types", ")", ")", "and", "arg_3", ":", "arg_3", "=", "pagination", ".", "paginate", "(", "arg_0", ".", "request", ",", "arg_0", ".", "response", ",", "arg_3", ")", "arg_0", ".", "make_response", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Processes a `GET` request.\"\"\"\n        # Ensure we're allowed to read the resource.\n        arg_0.assert_operations('read')\n\n        # Delegate to `read` to retrieve the items.\n        arg_3 = arg_0.read()\n\n        # if self.slug is not None and not items:\n        #     # Requested a specific resource but nothing is returned.\n\n        #     # Attempt to resolve by changing what we understand as\n        #     # a slug to a path.\n        #     self.path = self.path + self.slug if self.path else self.slug\n        #     self.slug = None\n\n        #     # Attempt to retreive the resource again.\n        #     items = self.read()\n\n        # Ensure that if we have a slug and still no items that a 404\n        # is rasied appropriately.\n        if not arg_3:\n            raise http.exceptions.NotFound()\n\n        if (isinstance(arg_3, Iterable)\n                and not isinstance(arg_3, six.string_types)) and arg_3:\n            # Paginate over the collection.\n            arg_3 = pagination.paginate(arg_0.request, arg_0.response, arg_3)\n\n        # Build the response object.\n        arg_0.make_response(arg_3)", "path": "armet/resources/managed/base.py", "identifier": "ManagedResource.get", "docstring": "Processes a `GET` request.", "docstring_tokens": ["Processes", "a", "GET", "request", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 259757}
{"url": "https://github.com/explorigin/Rocket/blob/53313677768159d13e6c2b7c69ad69ca59bb8c79/rocket/methods/wsgi.py#L188-L215", "sha": "53313677768159d13e6c2b7c69ad69ca59bb8c79", "docstring_summary": "Store the HTTP status and headers to be sent when self.write is\n        called.", "language": "python", "parameters": "(self, status, response_headers, exc_info=None)", "return_statement": "return self.write_warning", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", ":", "try", ":", "if", "arg_0", ".", "headers_sent", ":", "raise", "finally", ":", "arg_3", "=", "None", "elif", "arg_0", ".", "header_set", ":", "raise", "AssertionError", "(", "\"Headers already set!\"", ")", "if", "PY3K", "and", "not", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_0", ".", "status", "=", "str", "(", "arg_1", ",", "'ISO-8859-1'", ")", "else", ":", "arg_0", ".", "status", "=", "arg_1", "try", ":", "arg_0", ".", "header_set", "=", "Headers", "(", "arg_2", ")", "except", "UnicodeDecodeError", ":", "arg_0", ".", "error", "=", "(", "'500 Internal Server Error'", ",", "'HTTP Headers should be bytes'", ")", "arg_0", ".", "err_log", ".", "error", "(", "'Received HTTP Headers from client that contain'", "' invalid characters for Latin-1 encoding.'", ")", "return", "arg_0", ".", "write_warning"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\" Store the HTTP status and headers to be sent when self.write is\n        called. \"\"\"\n        if arg_3:\n            try:\n                if arg_0.headers_sent:\n                    # Re-raise original exception if headers sent\n                    # because this violates WSGI specification.\n                    raise\n            finally:\n                arg_3 = None\n        elif arg_0.header_set:\n            raise AssertionError(\"Headers already set!\")\n\n        if PY3K and not isinstance(arg_1, str):\n            arg_0.status = str(arg_1, 'ISO-8859-1')\n        else:\n            arg_0.status = arg_1\n        # Make sure headers are bytes objects\n        try:\n            arg_0.header_set = Headers(arg_2)\n        except UnicodeDecodeError:\n            arg_0.error = ('500 Internal Server Error',\n                          'HTTP Headers should be bytes')\n            arg_0.err_log.error('Received HTTP Headers from client that contain'\n                               ' invalid characters for Latin-1 encoding.')\n\n        return arg_0.write_warning", "path": "rocket/methods/wsgi.py", "identifier": "WSGIWorker.start_response", "docstring": "Store the HTTP status and headers to be sent when self.write is\n        called.", "docstring_tokens": ["Store", "the", "HTTP", "status", "and", "headers", "to", "be", "sent", "when", "self", ".", "write", "is", "called", "."], "nwo": "explorigin/Rocket", "score": 0.287624013353215, "idx": 259758}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L642-L661", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Open input data.", "language": "python", "parameters": "(self, input_id, **kwargs)", "return_statement": "return self.params[\"input\"][input_id].open(self.tile, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "str", ")", ":", "return", "arg_1", ".", "Func", "(", "arg_0", ".", "tile", ",", "**", "arg_2", ")", "if", "arg_1", "not", "in", "arg_0", ".", "params", "[", "\"input\"", "]", ":", "raise", "ValueError", "(", "\"%s not found in config as input file\"", "%", "arg_1", ")", "return", "arg_0", ".", "params", "[", "\"input\"", "]", "[", "arg_1", "]", ".", "Func", "(", "arg_0", ".", "tile", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Open input data.\n\n        Parameters\n        ----------\n        input_id : string\n            input identifier from configuration file or file path\n        kwargs : driver specific parameters (e.g. resampling)\n\n        Returns\n        -------\n        tiled input data : InputTile\n            reprojected input data within tile\n        \"\"\"\n        if not isinstance(arg_1, str):\n            return arg_1.Func(arg_0.tile, **arg_2)\n        if arg_1 not in arg_0.params[\"input\"]:\n            raise ValueError(\"%s not found in config as input file\" % arg_1)\n        return arg_0.params[\"input\"][arg_1].Func(arg_0.tile, **arg_2)", "path": "mapchete/_core.py", "identifier": "MapcheteProcess.open", "docstring": "Open input data.\n\n        Parameters\n        ----------\n        input_id : string\n            input identifier from configuration file or file path\n        kwargs : driver specific parameters (e.g. resampling)\n\n        Returns\n        -------\n        tiled input data : InputTile\n            reprojected input data within tile", "docstring_tokens": ["Open", "input", "data", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 259759}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/utils.py#L42-L48", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "insert default options to sys.argv", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "get_default_options", "(", ")", "arg_0", ".", "reverse", "(", ")", "for", "arg_1", "in", "arg_0", ":", "sys", ".", "argv", ".", "insert", "(", "1", ",", "arg_1", ")"], "function": "def Func():\n    \"\"\"insert default options to sys.argv\n    \"\"\"\n    arg_0 = get_default_options()\n    arg_0.reverse()\n    for arg_1 in arg_0:\n        sys.argv.insert(1, arg_1)", "path": "pylint/pyreverse/utils.py", "identifier": "insert_default_options", "docstring": "insert default options to sys.argv", "docstring_tokens": ["insert", "default", "options", "to", "sys", ".", "argv"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 259760}
{"url": "https://github.com/bicv/LogGabor/blob/dea9560d8752cc9aa040ac3fd895cf9bb72b61f4/LogGabor/LogGabor.py#L178-L197", "sha": "dea9560d8752cc9aa040ac3fd895cf9bb72b61f4", "docstring_summary": "Returns the envelope of a LogGabor", "language": "python", "parameters": "(self, x_pos, y_pos, sf_0, B_sf, theta, B_theta, preprocess=True)", "return_statement": "return env", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "True", ")", ":", "arg_8", "=", "np", ".", "multiply", "(", "arg_0", ".", "band", "(", "arg_3", ",", "arg_4", ")", ",", "arg_0", ".", "orientation", "(", "arg_5", ",", "arg_6", ")", ")", "if", "not", "(", "arg_1", "==", "0.", ")", "and", "not", "(", "arg_2", "==", "0.", ")", ":", "arg_8", "=", "arg_8", ".", "astype", "(", "np", ".", "complex128", ")", "*", "arg_0", ".", "trans", "(", "arg_1", "*", "1.", ",", "arg_2", "*", "1.", ")", "if", "arg_7", ":", "arg_8", "*=", "arg_0", ".", "f_mask", "arg_8", "/=", "np", ".", "sqrt", "(", "(", "np", ".", "abs", "(", "arg_8", ")", "**", "2", ")", ".", "mean", "(", ")", ")", "arg_8", "*=", "np", ".", "sqrt", "(", "2.", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7=True):\n        \"\"\"\n        Returns the envelope of a LogGabor\n\n        Note that the convention for coordinates follows that of matrices:\n        the origin is at the top left of the image, and coordinates are first\n        the rows (vertical axis, going down) then the columns (horizontal axis,\n        going right).\n\n        \"\"\"\n\n        arg_8 = np.multiply(arg_0.band(arg_3, arg_4), arg_0.orientation(arg_5, arg_6))\n        if not(arg_1==0.) and not(arg_2==0.): # bypass translation whenever none is needed\n              arg_8 = arg_8.astype(np.complex128) * arg_0.trans(arg_1*1., arg_2*1.)\n        if arg_7 : arg_8 *= arg_0.f_mask # retina processing\n        # normalizing energy:\n        arg_8 /= np.sqrt((np.abs(arg_8)**2).mean())\n        # in the case a a single bump (see ``orientation``), we should compensate the fact that the distribution gets complex:\n        arg_8 *= np.sqrt(2.)\n        return arg_8", "path": "LogGabor/LogGabor.py", "identifier": "LogGabor.loggabor", "docstring": "Returns the envelope of a LogGabor\n\n        Note that the convention for coordinates follows that of matrices:\n        the origin is at the top left of the image, and coordinates are first\n        the rows (vertical axis, going down) then the columns (horizontal axis,\n        going right).", "docstring_tokens": ["Returns", "the", "envelope", "of", "a", "LogGabor"], "nwo": "bicv/LogGabor", "score": 0.2885105607469424, "idx": 259761}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/engine.py#L576-L625", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Given a kmip.pie object and a list of attribute names, attempt to get\n        all of the existing attribute values from the object.", "language": "python", "parameters": "(self, managed_object, attr_names)", "return_statement": "return retrieved_attributes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "attribute_factory", ".", "AttributeFactory", "(", ")", "arg_4", "=", "list", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", ".", "_attribute_policy", ".", "get_all_attribute_names", "(", ")", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "arg_1", ".", "_object_type", "if", "not", "arg_0", ".", "_attribute_policy", ".", "is_attribute_supported", "(", "arg_5", ")", ":", "continue", "if", "arg_0", ".", "_attribute_policy", ".", "is_attribute_applicable_to_object_type", "(", "arg_5", ",", "arg_6", ")", ":", "try", ":", "arg_7", "=", "arg_0", ".", "_get_attribute_from_managed_object", "(", "arg_1", ",", "arg_5", ")", "except", "Exception", ":", "arg_7", "=", "None", "if", "arg_7", "is", "not", "None", ":", "if", "arg_0", ".", "_attribute_policy", ".", "is_attribute_multivalued", "(", "arg_5", ")", ":", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_7", ")", ":", "arg_10", "=", "arg_3", ".", "create_attribute", "(", "enums", ".", "AttributeType", "(", "arg_5", ")", ",", "arg_9", ",", "arg_8", ")", "arg_4", ".", "append", "(", "arg_10", ")", "else", ":", "arg_10", "=", "arg_3", ".", "create_attribute", "(", "enums", ".", "AttributeType", "(", "arg_5", ")", ",", "arg_7", ")", "arg_4", ".", "append", "(", "arg_10", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Given a kmip.pie object and a list of attribute names, attempt to get\n        all of the existing attribute values from the object.\n        \"\"\"\n        arg_3 = attribute_factory.AttributeFactory()\n        arg_4 = list()\n\n        if not arg_2:\n            arg_2 = arg_0._attribute_policy.get_all_attribute_names()\n\n        for arg_5 in arg_2:\n            arg_6 = arg_1._object_type\n\n            if not arg_0._attribute_policy.is_attribute_supported(\n                    arg_5\n            ):\n                continue\n\n            if arg_0._attribute_policy.is_attribute_applicable_to_object_type(\n                arg_5,\n                arg_6\n            ):\n                try:\n                    arg_7 = arg_0._get_attribute_from_managed_object(\n                        arg_1,\n                        arg_5\n                    )\n                except Exception:\n                    arg_7 = None\n\n                if arg_7 is not None:\n                    if arg_0._attribute_policy.is_attribute_multivalued(\n                            arg_5\n                    ):\n                        for arg_8, arg_9 in enumerate(arg_7):\n                            arg_10 = arg_3.create_attribute(\n                                enums.AttributeType(arg_5),\n                                arg_9,\n                                arg_8\n                            )\n                            arg_4.append(arg_10)\n                    else:\n                        arg_10 = arg_3.create_attribute(\n                            enums.AttributeType(arg_5),\n                            arg_7\n                        )\n                        arg_4.append(arg_10)\n\n        return arg_4", "path": "kmip/services/server/engine.py", "identifier": "KmipEngine._get_attributes_from_managed_object", "docstring": "Given a kmip.pie object and a list of attribute names, attempt to get\n        all of the existing attribute values from the object.", "docstring_tokens": ["Given", "a", "kmip", ".", "pie", "object", "and", "a", "list", "of", "attribute", "names", "attempt", "to", "get", "all", "of", "the", "existing", "attribute", "values", "from", "the", "object", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 259762}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/formula.py#L252-L277", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Replace function name", "language": "python", "parameters": "(source: str, name: str)", "return_statement": "return \"\\n\".join(lines) + \"\\n\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ")", ":", "arg_3", "=", "arg_0", ".", "splitlines", "(", ")", "arg_4", "=", "asttokens", ".", "ASTTokens", "(", "arg_0", ",", "parse", "=", "True", ")", "for", "arg_5", "in", "ast", ".", "walk", "(", "arg_4", ".", "tree", ")", ":", "if", "isinstance", "(", "arg_5", ",", "ast", ".", "FunctionDef", ")", ":", "break", "arg_6", "=", "arg_5", ".", "first_token", ".", "index", "for", "arg_6", "in", "range", "(", "arg_5", ".", "first_token", ".", "index", ",", "arg_5", ".", "last_token", ".", "index", ")", ":", "if", "(", "arg_4", ".", "tokens", "[", "arg_6", "]", ".", "type", "==", "token", ".", "NAME", "and", "arg_4", ".", "tokens", "[", "arg_6", "]", ".", "string", "==", "\"def\"", ")", ":", "break", "arg_7", ",", "arg_8", "=", "arg_4", ".", "tokens", "[", "arg_6", "+", "1", "]", ".", "start", "arg_9", ",", "arg_10", "=", "arg_4", ".", "tokens", "[", "arg_6", "+", "1", "]", ".", "end", "assert", "arg_7", "==", "arg_9", "arg_3", "[", "arg_7", "-", "1", "]", "=", "(", "arg_3", "[", "arg_7", "-", "1", "]", "[", ":", "arg_8", "]", "+", "arg_2", "+", "arg_3", "[", "arg_7", "-", "1", "]", "[", "arg_10", ":", "]", ")", "return", "\"\\n\"", ".", "join", "(", "arg_3", ")", "+", "\"\\n\""], "function": "def Func(arg_0: arg_1, arg_2: arg_1):\n    \"\"\"Replace function name\"\"\"\n\n    arg_3 = arg_0.splitlines()\n    arg_4 = asttokens.ASTTokens(arg_0, parse=True)\n\n    for arg_5 in ast.walk(arg_4.tree):\n        if isinstance(arg_5, ast.FunctionDef):\n            break\n\n    arg_6 = arg_5.first_token.index\n    for arg_6 in range(arg_5.first_token.index, arg_5.last_token.index):\n        if (arg_4.tokens[arg_6].type == token.NAME\n                and arg_4.tokens[arg_6].string == \"def\"):\n            break\n\n    arg_7, arg_8 = arg_4.tokens[arg_6 + 1].start\n    arg_9, arg_10 = arg_4.tokens[arg_6 + 1].end\n\n    assert arg_7 == arg_9\n\n    arg_3[arg_7-1] = (\n            arg_3[arg_7-1][:arg_8] + arg_2 + arg_3[arg_7-1][arg_10:]\n    )\n\n    return \"\\n\".join(arg_3) + \"\\n\"", "path": "modelx/core/formula.py", "identifier": "replace_funcname", "docstring": "Replace function name", "docstring_tokens": ["Replace", "function", "name"], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 259763}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/consistency_check.py#L133-L149", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Check the model for integrity violations on an association in a particular direction.", "language": "python", "parameters": "(m, link)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "for", "arg_3", "in", "arg_1", ".", "from_metaclass", ".", "select_many", "(", ")", ":", "arg_4", "=", "list", "(", "arg_1", ".", "navigate", "(", "arg_3", ")", ")", "if", "(", "len", "(", "arg_4", ")", "<", "1", "and", "not", "arg_1", ".", "conditional", ")", "or", "(", "(", "len", "(", "arg_4", ")", ">", "1", "and", "not", "arg_1", ".", "many", ")", ")", ":", "arg_2", "+=", "1", "logger", ".", "warning", "(", "'integrity violation in '", "'%s --(%s)--> %s'", "%", "(", "pretty_from_link", "(", "arg_3", ",", "arg_1", ")", ",", "arg_1", ".", "rel_id", ",", "pretty_to_link", "(", "arg_3", ",", "arg_1", ")", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''\n    Check the model for integrity violations on an association in a particular direction.\n    '''\n    arg_2 = 0\n    for arg_3 in arg_1.from_metaclass.select_many():\n        arg_4 = list(arg_1.navigate(arg_3))\n\n        if(len(arg_4) < 1 and not arg_1.conditional) or (\n          (len(arg_4) > 1 and not arg_1.many)):\n            arg_2 += 1\n            logger.warning('integrity violation in '\n                           '%s --(%s)--> %s' % (pretty_from_link(arg_3, arg_1),\n                                                arg_1.rel_id,\n                                                pretty_to_link(arg_3, arg_1)))\n    \n    return arg_2", "path": "xtuml/consistency_check.py", "identifier": "check_link_integrity", "docstring": "Check the model for integrity violations on an association in a particular direction.", "docstring_tokens": ["Check", "the", "model", "for", "integrity", "violations", "on", "an", "association", "in", "a", "particular", "direction", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 259764}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/gtr.py#L496-L517", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Check the main diagonal of Q and fix it in case it does not corresond\n        the definition of the rate matrix. Should be run every time when creating\n        custom GTR model.", "language": "python", "parameters": "(self, fixed_mu=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_0", ".", "Pi", "/=", "arg_0", ".", "Pi", ".", "sum", "(", ")", "arg_0", ".", "W", "+=", "arg_0", ".", "break_degen", "+", "arg_0", ".", "break_degen", ".", "T", "np", ".", "fill_diagonal", "(", "arg_0", ".", "W", ",", "0", ")", "arg_2", "=", "-", "(", "arg_0", ".", "Q", ")", ".", "sum", "(", "axis", "=", "0", ")", "/", "arg_0", ".", "Pi", "np", ".", "fill_diagonal", "(", "arg_0", ".", "W", ",", "arg_2", ")", "arg_3", "=", "-", "np", ".", "sum", "(", "np", ".", "diagonal", "(", "arg_0", ".", "Q", ")", "*", "arg_0", ".", "Pi", ")", "arg_0", ".", "W", "/=", "arg_3", "if", "not", "arg_1", ":", "arg_0", ".", "mu", "*=", "arg_3", "if", "(", "arg_0", ".", "Q", ".", "sum", "(", "axis", "=", "0", ")", "<", "1e-10", ")", ".", "sum", "(", ")", "<", "arg_0", ".", "alphabet", ".", "shape", "[", "0", "]", ":", "print", "(", "\"Cannot fix the diagonal of the GTR rate matrix. Should be all zero\"", ",", "arg_0", ".", "Q", ".", "sum", "(", "axis", "=", "0", ")", ")", "import", "ipdb", "ipdb", ".", "set_trace", "(", ")", "raise", "ArithmeticError", "(", "\"Cannot fix the diagonal of the GTR rate matrix.\"", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Check the main diagonal of Q and fix it in case it does not corresond\n        the definition of the rate matrix. Should be run every time when creating\n        custom GTR model.\n        \"\"\"\n        # fix Q\n        arg_0.Pi /= arg_0.Pi.sum() # correct the Pi manually\n        # NEEDED TO BREAK RATE MATRIX DEGENERACY AND FORCE NP TO RETURN REAL ORTHONORMAL EIGENVECTORS\n        arg_0.W += arg_0.break_degen + arg_0.break_degen.T\n        # fix W\n        np.fill_diagonal(arg_0.W, 0)\n        arg_2 = -(arg_0.Q).sum(axis=0)/arg_0.Pi\n        np.fill_diagonal(arg_0.W, arg_2)\n        arg_3 = -np.sum(np.diagonal(arg_0.Q)*arg_0.Pi)\n        arg_0.W /= arg_3\n        if not arg_1:\n            arg_0.mu *= arg_3\n        if (arg_0.Q.sum(axis=0) < 1e-10).sum() <  arg_0.alphabet.shape[0]: # fix failed\n            print (\"Cannot fix the diagonal of the GTR rate matrix. Should be all zero\", arg_0.Q.sum(axis=0))\n            import ipdb; ipdb.set_trace()\n            raise ArithmeticError(\"Cannot fix the diagonal of the GTR rate matrix.\")", "path": "treetime/gtr.py", "identifier": "GTR._check_fix_Q", "docstring": "Check the main diagonal of Q and fix it in case it does not corresond\n        the definition of the rate matrix. Should be run every time when creating\n        custom GTR model.", "docstring_tokens": ["Check", "the", "main", "diagonal", "of", "Q", "and", "fix", "it", "in", "case", "it", "does", "not", "corresond", "the", "definition", "of", "the", "rate", "matrix", ".", "Should", "be", "run", "every", "time", "when", "creating", "custom", "GTR", "model", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 259765}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L234-L255", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get list of items in given GUI.", "language": "python", "parameters": "(self, window_name)", "return_statement": "return object_list.keys()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_get_window_handle", "(", "arg_1", ",", "True", ")", "arg_5", "=", "arg_0", ".", "_get_appmap", "(", "arg_2", ",", "arg_3", ",", "True", ")", "except", "atomac", ".", "_a11y", ".", "ErrorInvalidUIElement", ":", "arg_0", ".", "_windows", "=", "{", "}", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_get_window_handle", "(", "arg_1", ",", "True", ")", "arg_5", "=", "arg_0", ".", "_get_appmap", "(", "arg_2", ",", "arg_3", ",", "True", ")", "return", "arg_5", ".", "keys", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get list of items in given GUI.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n\n        @return: list of items in LDTP naming convention.\n        @rtype: list\n        \"\"\"\n        try:\n            arg_2, arg_3, arg_4 = arg_0._get_window_handle(arg_1, True)\n            arg_5 = arg_0._get_appmap(arg_2, arg_3, True)\n        except atomac._a11y.ErrorInvalidUIElement:\n            # During the test, when the window closed and reopened\n            # ErrorInvalidUIElement exception will be thrown\n            arg_0._windows = {}\n            # Call the method again, after updating apps\n            arg_2, arg_3, arg_4 = arg_0._get_window_handle(arg_1, True)\n            arg_5 = arg_0._get_appmap(arg_2, arg_3, True)\n        return arg_5.keys()", "path": "atomac/ldtpd/core.py", "identifier": "Core.getobjectlist", "docstring": "Get list of items in given GUI.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n\n        @return: list of items in LDTP naming convention.\n        @rtype: list", "docstring_tokens": ["Get", "list", "of", "items", "in", "given", "GUI", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 259766}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/tfs/__init__.py#L91-L105", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Creates a TFS TFVC Client to pull TFVC repo info", "language": "python", "parameters": "(url, token=None)", "return_statement": "return tfs_tfvc_client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "os", ".", "environ", ".", "get", "(", "'TFS_API_TOKEN'", ",", "None", ")", "arg_2", "=", "create_tfs_connection", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "arg_2", ".", "get_client", "(", "'vsts.tfvc.v4_1.tfvc_client.TfvcClient'", ")", "if", "arg_3", "is", "None", ":", "arg_4", "=", "'Unable to create TFS Git Client, failed to connect to TFS Enterprise (%s) with provided token.'", "raise", "RuntimeError", "(", "arg_4", ",", "arg_0", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Creates a TFS TFVC Client to pull TFVC repo info\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = os.environ.get('TFS_API_TOKEN', None)\n\n    arg_2 = create_tfs_connection(arg_0, arg_1)\n    arg_3 = arg_2.get_client('vsts.tfvc.v4_1.tfvc_client.TfvcClient')\n\n    if arg_3 is None:\n        arg_4 = 'Unable to create TFS Git Client, failed to connect to TFS Enterprise (%s) with provided token.'\n        raise RuntimeError(arg_4, arg_0)\n\n    return arg_3", "path": "scraper/tfs/__init__.py", "identifier": "create_tfs_tfvc_client", "docstring": "Creates a TFS TFVC Client to pull TFVC repo info", "docstring_tokens": ["Creates", "a", "TFS", "TFVC", "Client", "to", "pull", "TFVC", "repo", "info"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 259767}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L425-L435", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "When calculating the rowspan for a given cell it is required to find all\n    table cells 'below' the initial cell with a v_merge. This function will\n    return the td element at the passed in index, taking into account colspans.", "language": "python", "parameters": "(tr, index)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "for", "arg_3", "in", "arg_0", ".", "xpath", "(", "'.//w:tc'", ",", "namespaces", "=", "arg_0", ".", "nsmap", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "arg_3", "arg_2", "+=", "get_grid_span", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    When calculating the rowspan for a given cell it is required to find all\n    table cells 'below' the initial cell with a v_merge. This function will\n    return the td element at the passed in index, taking into account colspans.\n    \"\"\"\n    arg_2 = 0\n    for arg_3 in arg_0.xpath('.//w:tc', namespaces=arg_0.nsmap):\n        if arg_1 == arg_2:\n            return arg_3\n        arg_2 += get_grid_span(arg_3)", "path": "docx2html/core.py", "identifier": "get_td_at_index", "docstring": "When calculating the rowspan for a given cell it is required to find all\n    table cells 'below' the initial cell with a v_merge. This function will\n    return the td element at the passed in index, taking into account colspans.", "docstring_tokens": ["When", "calculating", "the", "rowspan", "for", "a", "given", "cell", "it", "is", "required", "to", "find", "all", "table", "cells", "below", "the", "initial", "cell", "with", "a", "v_merge", ".", "This", "function", "will", "return", "the", "td", "element", "at", "the", "passed", "in", "index", "taking", "into", "account", "colspans", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 259768}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L275-L287", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a list of bits in the given condition.", "language": "python", "parameters": "(self, cond)", "return_statement": "return all_bits", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "arg_1", "is", "not", "None", ":", "arg_2", ".", "extend", "(", "[", "(", "arg_1", "[", "0", "]", ",", "arg_3", ")", "for", "arg_3", "in", "range", "(", "arg_0", ".", "cregs", "[", "arg_1", "[", "0", "]", ".", "name", "]", ".", "size", ")", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a list of bits in the given condition.\n\n        Args:\n            cond (tuple or None): optional condition (ClassicalRegister, int)\n\n        Returns:\n            list[(ClassicalRegister, idx)]: list of bits\n        \"\"\"\n        arg_2 = []\n        if arg_1 is not None:\n            arg_2.extend([(arg_1[0], arg_3) for arg_3 in range(arg_0.cregs[arg_1[0].name].size)])\n        return arg_2", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit._bits_in_condition", "docstring": "Return a list of bits in the given condition.\n\n        Args:\n            cond (tuple or None): optional condition (ClassicalRegister, int)\n\n        Returns:\n            list[(ClassicalRegister, idx)]: list of bits", "docstring_tokens": ["Return", "a", "list", "of", "bits", "in", "the", "given", "condition", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259769}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/util/notify.py#L50-L54", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Emit a warning message.", "language": "python", "parameters": "(msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "_flush", "(", ")", "sys", ".", "stderr", ".", "write", "(", "\"\\033[1;7;33;40mWARNING: {}\\033[0m\\n\"", ".", "format", "(", "arg_0", ")", ")", "sys", ".", "stderr", ".", "flush", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Emit a Func message.\"\"\"\n    _flush()\n    sys.stderr.write(\"\\033[1;7;33;40mWARNING: {}\\033[0m\\n\".format(arg_0))\n    sys.stderr.flush()", "path": "src/rituals/util/notify.py", "identifier": "warning", "docstring": "Emit a warning message.", "docstring_tokens": ["Emit", "a", "warning", "message", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 259770}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/codeunit.py#L9-L34", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Construct a list of CodeUnits from polymorphic inputs.", "language": "python", "parameters": "(morfs, file_locator)", "return_statement": "return code_units", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_0", "=", "[", "arg_0", "]", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "if", "isinstance", "(", "arg_3", ",", "string_class", ")", "and", "(", "'?'", "in", "arg_3", "or", "'*'", "in", "arg_3", ")", ":", "arg_2", ".", "extend", "(", "glob", ".", "glob", "(", "arg_3", ")", ")", "else", ":", "arg_2", ".", "append", "(", "arg_3", ")", "arg_0", "=", "arg_2", "arg_4", "=", "[", "CodeUnit", "(", "arg_3", ",", "arg_1", ")", "for", "arg_3", "in", "arg_0", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Construct a list of CodeUnits from polymorphic inputs.\n\n    `morfs` is a module or a filename, or a list of same.\n\n    `file_locator` is a FileLocator that can help resolve filenames.\n\n    Returns a list of CodeUnit objects.\n\n    \"\"\"\n    # Be sure we have a list.\n    if not isinstance(arg_0, (list, tuple)):\n        arg_0 = [arg_0]\n\n    # On Windows, the shell doesn't expand wildcards.  Do it here.\n    arg_2 = []\n    for arg_3 in arg_0:\n        if isinstance(arg_3, string_class) and ('?' in arg_3 or '*' in arg_3):\n            arg_2.extend(glob.glob(arg_3))\n        else:\n            arg_2.append(arg_3)\n    arg_0 = arg_2\n\n    arg_4 = [CodeUnit(arg_3, arg_1) for arg_3 in arg_0]\n\n    return arg_4", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/codeunit.py", "identifier": "code_unit_factory", "docstring": "Construct a list of CodeUnits from polymorphic inputs.\n\n    `morfs` is a module or a filename, or a list of same.\n\n    `file_locator` is a FileLocator that can help resolve filenames.\n\n    Returns a list of CodeUnit objects.", "docstring_tokens": ["Construct", "a", "list", "of", "CodeUnits", "from", "polymorphic", "inputs", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 259771}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L875-L899", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Copy outputs from local disk to GCS.", "language": "python", "parameters": "(self, task_dir, outputs, user_project)", "return_statement": "return '\\n'.join(commands)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_2", ":", "if", "arg_5", ".", "recursive", "or", "not", "arg_5", ".", "value", ":", "continue", "arg_6", "=", "arg_5", ".", "uri", ".", "path", "arg_7", "=", "arg_1", "+", "'/'", "+", "_DATA_SUBDIR", "+", "'/'", "+", "arg_5", ".", "docker_path", "if", "arg_5", ".", "file_provider", "==", "job_model", ".", "P_LOCAL", ":", "arg_4", ".", "append", "(", "'mkdir -p \"%s\"'", "%", "arg_6", ")", "if", "arg_5", ".", "file_provider", "in", "[", "job_model", ".", "P_LOCAL", ",", "job_model", ".", "P_GCS", "]", ":", "if", "arg_3", ":", "arg_8", "=", "'gsutil -u %s -mq cp \"%s\" \"%s\"'", "%", "(", "arg_3", ",", "arg_7", ",", "arg_6", ")", "else", ":", "arg_8", "=", "'gsutil -mq cp \"%s\" \"%s\"'", "%", "(", "arg_7", ",", "arg_6", ")", "arg_4", ".", "append", "(", "arg_8", ")", "return", "'\\n'", ".", "join", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Copy outputs from local disk to GCS.\"\"\"\n    arg_4 = []\n    for arg_5 in arg_2:\n      if arg_5.recursive or not arg_5.value:\n        continue\n\n      # The destination path is o.uri.path, which is the target directory\n      # (rather than o.uri, which includes the filename or wildcard).\n      arg_6 = arg_5.uri.path\n      arg_7 = arg_1 + '/' + _DATA_SUBDIR + '/' + arg_5.docker_path\n\n      if arg_5.file_provider == job_model.P_LOCAL:\n        arg_4.append('mkdir -p \"%s\"' % arg_6)\n\n      # Use gsutil even for local files (explained in _localize_inputs_command).\n      if arg_5.file_provider in [job_model.P_LOCAL, job_model.P_GCS]:\n        if arg_3:\n          arg_8 = 'gsutil -u %s -mq cp \"%s\" \"%s\"' % (arg_3, arg_7,\n                                                       arg_6)\n        else:\n          arg_8 = 'gsutil -mq cp \"%s\" \"%s\"' % (arg_7, arg_6)\n        arg_4.append(arg_8)\n\n    return '\\n'.join(arg_4)", "path": "dsub/providers/local.py", "identifier": "LocalJobProvider._delocalize_outputs_commands", "docstring": "Copy outputs from local disk to GCS.", "docstring_tokens": ["Copy", "outputs", "from", "local", "disk", "to", "GCS", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 259772}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1197-L1205", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Start analyzing function body.", "language": "python", "parameters": "(self, function_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "in_a_function", "=", "True", "arg_0", ".", "lines_in_function", "=", "0", "arg_0", ".", "current_function", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Start analyzing function body.\n\n    Args:\n      function_name: The name of the function being tracked.\n    \"\"\"\n    arg_0.in_a_function = True\n    arg_0.lines_in_function = 0\n    arg_0.current_function = arg_1", "path": "third_party/python/cpplint/cpplint.py", "identifier": "_FunctionState.Begin", "docstring": "Start analyzing function body.\n\n    Args:\n      function_name: The name of the function being tracked.", "docstring_tokens": ["Start", "analyzing", "function", "body", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259773}
{"url": "https://github.com/incuna/django-pgcrypto-fields/blob/406fddf0cbe9091ba71b97206d0f4719c0450ac1/pgcrypto/mixins.py#L30-L34", "sha": "406fddf0cbe9091ba71b97206d0f4719c0450ac1", "docstring_summary": "Build SQL with decryption and casting.", "language": "python", "parameters": "(self, compiler, connection)", "return_statement": "return sql, params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "super", "(", "DecryptedCol", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_3", "=", "arg_0", ".", "target", ".", "get_decrypt_sql", "(", "arg_2", ")", "%", "(", "arg_3", ",", "arg_0", ".", "target", ".", "get_cast_sql", "(", ")", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Build SQL with decryption and casting.\"\"\"\n        arg_3, arg_4 = super(DecryptedCol, arg_0).Func(arg_1, arg_2)\n        arg_3 = arg_0.target.get_decrypt_sql(arg_2) % (arg_3, arg_0.target.get_cast_sql())\n        return arg_3, arg_4", "path": "pgcrypto/mixins.py", "identifier": "DecryptedCol.as_sql", "docstring": "Build SQL with decryption and casting.", "docstring_tokens": ["Build", "SQL", "with", "decryption", "and", "casting", "."], "nwo": "incuna/django-pgcrypto-fields", "score": 0.4638707833759358, "idx": 259774}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/learning.py#L99-L102", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Add an example to the list of examples, checking it first.", "language": "python", "parameters": "(self, example)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "check_example", "(", "arg_1", ")", "arg_0", ".", "examples", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"Add an example to the list of examples, checking it first.\"\n        arg_0.check_example(arg_1)\n        arg_0.examples.append(arg_1)", "path": "aima/learning.py", "identifier": "DataSet.add_example", "docstring": "Add an example to the list of examples, checking it first.", "docstring_tokens": ["Add", "an", "example", "to", "the", "list", "of", "examples", "checking", "it", "first", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 259775}
{"url": "https://github.com/crazy-canux/arguspy/blob/e9486b5df61978a990d56bf43de35f3a4cdefcc3/scripts/check_ssh.py#L54-L93", "sha": "e9486b5df61978a990d56bf43de35f3a4cdefcc3", "docstring_summary": "Get the number of the shell command.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "__results", "=", "arg_0", ".", "execute", "(", "arg_0", ".", "args", ".", "command", ")", "arg_0", ".", "close", "(", ")", "arg_0", ".", "logger", ".", "debug", "(", "\"results: {}\"", ".", "format", "(", "arg_0", ".", "__results", ")", ")", "if", "not", "arg_0", ".", "__results", ":", "arg_0", ".", "unknown", "(", "\"{} return nothing.\"", ".", "format", "(", "arg_0", ".", "args", ".", "command", ")", ")", "if", "len", "(", "arg_0", ".", "__results", ")", "!=", "1", ":", "arg_0", ".", "unknown", "(", "\"{} return more than one number.\"", ".", "format", "(", "arg_0", ".", "args", ".", "command", ")", ")", "arg_0", ".", "__result", "=", "int", "(", "arg_0", ".", "__results", "[", "0", "]", ")", "arg_0", ".", "logger", ".", "debug", "(", "\"result: {}\"", ".", "format", "(", "arg_0", ".", "__result", ")", ")", "if", "not", "isinstance", "(", "arg_0", ".", "__result", ",", "(", "int", ",", "long", ")", ")", ":", "arg_0", ".", "unknown", "(", "\"{} didn't return single number.\"", ".", "format", "(", "arg_0", ".", "args", ".", "command", ")", ")", "arg_3", "=", "arg_0", ".", "ok", "if", "arg_0", ".", "__result", ">", "arg_0", ".", "args", ".", "warning", ":", "arg_3", "=", "arg_0", ".", "warning", "if", "arg_0", ".", "__result", ">", "arg_0", ".", "args", ".", "critical", ":", "arg_3", "=", "arg_0", ".", "critical", "arg_0", ".", "shortoutput", "=", "\"{0} return {1}.\"", ".", "format", "(", "arg_0", ".", "args", ".", "command", ",", "arg_0", ".", "__result", ")", "[", "arg_0", ".", "longoutput", ".", "append", "(", "arg_5", ")", "for", "arg_5", "in", "arg_0", ".", "__results", "if", "arg_0", ".", "__results", "]", "arg_0", ".", "perfdata", ".", "append", "(", "\"{command}={result};{warn};{crit};0;\"", ".", "format", "(", "crit", "=", "arg_0", ".", "args", ".", "critical", ",", "warn", "=", "arg_0", ".", "args", ".", "warning", ",", "result", "=", "arg_0", ".", "__result", ",", "command", "=", "arg_0", ".", "args", ".", "command", ")", ")", "arg_3", "(", "arg_0", ".", "output", "(", "long_output_limit", "=", "None", ")", ")", "arg_0", ".", "logger", ".", "debug", "(", "\"Return status and exit to Nagios.\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Get the number of the shell command.\"\"\"\n        arg_0.__results = arg_0.execute(arg_0.args.command)\n        arg_0.close()\n\n        arg_0.logger.debug(\"results: {}\".format(arg_0.__results))\n        if not arg_0.__results:\n            arg_0.unknown(\"{} return nothing.\".format(arg_0.args.command))\n        if len(arg_0.__results) != 1:\n            arg_0.unknown(\n                \"{} return more than one number.\".format(\n                    arg_0.args.command))\n        arg_0.__result = int(arg_0.__results[0])\n        arg_0.logger.debug(\"result: {}\".format(arg_0.__result))\n        if not isinstance(arg_0.__result, (int, long)):\n            arg_0.unknown(\n                \"{} didn't return single number.\".format(\n                    arg_0.args.command))\n\n        arg_3 = arg_0.ok\n        # Compare the vlaue.\n        if arg_0.__result > arg_0.args.warning:\n            arg_3 = arg_0.warning\n        if arg_0.__result > arg_0.args.critical:\n            arg_3 = arg_0.critical\n\n        # Output\n        arg_0.shortoutput = \"{0} return {1}.\".format(\n            arg_0.args.command, arg_0.__result)\n        [arg_0.longoutput.append(arg_5)\n         for arg_5 in arg_0.__results if arg_0.__results]\n        arg_0.perfdata.append(\"{command}={result};{warn};{crit};0;\".format(\n            crit=arg_0.args.critical,\n            warn=arg_0.args.warning,\n            result=arg_0.__result,\n            command=arg_0.args.command))\n\n        # Return status with message to Nagios.\n        arg_3(arg_0.output(long_output_limit=None))\n        arg_0.logger.debug(\"Return status and exit to Nagios.\")", "path": "scripts/check_ssh.py", "identifier": "Command.command_handle", "docstring": "Get the number of the shell command.", "docstring_tokens": ["Get", "the", "number", "of", "the", "shell", "command", "."], "nwo": "crazy-canux/arguspy", "score": 0.0, "idx": 259776}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_lovins.py#L213-L232", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return Lovins' condition K.", "language": "python", "parameters": "(self, word, suffix_len)", "return_statement": "return (len(word) - suffix_len >= 3) and (\n            word[-suffix_len - 1] in {'i', 'l'}\n            or (word[-suffix_len - 3] == 'u' and word[-suffix_len - 1] == 'e')\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "(", "len", "(", "arg_1", ")", "-", "arg_2", ">=", "3", ")", "and", "(", "arg_1", "[", "-", "arg_2", "-", "1", "]", "in", "{", "'i'", ",", "'l'", "}", "or", "(", "arg_1", "[", "-", "arg_2", "-", "3", "]", "==", "'u'", "and", "arg_1", "[", "-", "arg_2", "-", "1", "]", "==", "'e'", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return Lovins' condition K.\n\n        Parameters\n        ----------\n        word : str\n            Word to check\n        suffix_len : int\n            Suffix length\n\n        Returns\n        -------\n        bool\n            True if condition is met\n\n        \"\"\"\n        return (len(arg_1) - arg_2 >= 3) and (\n            arg_1[-arg_2 - 1] in {'i', 'l'}\n            or (arg_1[-arg_2 - 3] == 'u' and arg_1[-arg_2 - 1] == 'e')\n        )", "path": "abydos/stemmer/_lovins.py", "identifier": "Lovins._cond_k", "docstring": "Return Lovins' condition K.\n\n        Parameters\n        ----------\n        word : str\n            Word to check\n        suffix_len : int\n            Suffix length\n\n        Returns\n        -------\n        bool\n            True if condition is met", "docstring_tokens": ["Return", "Lovins", "condition", "K", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 259777}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/tf/utils.py#L108-L140", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Writes out Gin's operative config, and maybe adds a summary of it.", "language": "python", "parameters": "(self, session=None, coord=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "config", ".", "operative_config_str", "(", ")", "if", "not", "tf", ".", "gfile", ".", "IsDirectory", "(", "arg_0", ".", "_output_dir", ")", ":", "tf", ".", "gfile", ".", "MakeDirs", "(", "arg_0", ".", "_output_dir", ")", "arg_4", "=", "0", "if", "arg_1", "is", "not", "None", ":", "arg_5", "=", "tf", ".", "train", ".", "get_global_step", "(", ")", "if", "arg_5", "is", "not", "None", ":", "arg_4", "=", "arg_1", ".", "run", "(", "arg_5", ")", "arg_6", "=", "'%s-%s.gin'", "%", "(", "arg_0", ".", "_base_name", ",", "arg_4", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_output_dir", ",", "arg_6", ")", "with", "tf", ".", "gfile", ".", "GFile", "(", "arg_7", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_3", ")", "if", "arg_0", ".", "_summarize_config", ":", "arg_8", "=", "arg_0", ".", "_markdownify_operative_config_str", "(", "arg_3", ")", "arg_9", "=", "summary_pb2", ".", "SummaryMetadata", "(", ")", "arg_9", ".", "plugin_data", ".", "plugin_name", "=", "'text'", "arg_9", ".", "plugin_data", ".", "content", "=", "b'{}'", "arg_13", "=", "tf", ".", "make_tensor_proto", "(", "arg_8", ")", "arg_14", "=", "summary_pb2", ".", "Summary", "(", ")", "arg_14", ".", "value", ".", "add", "(", "tag", "=", "'gin/'", "+", "arg_0", ".", "_base_name", ",", "tensor", "=", "arg_13", ",", "metadata", "=", "arg_9", ")", "if", "not", "arg_0", ".", "_summary_writer", ":", "arg_0", ".", "_summary_writer", "=", "tf", ".", "summary", ".", "FileWriterCache", ".", "get", "(", "arg_0", ".", "_output_dir", ")", "arg_0", ".", "_summary_writer", ".", "add_summary", "(", "arg_14", ",", "arg_4", ")", "arg_0", ".", "_summary_writer", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Writes out Gin's operative config, and maybe adds a summary of it.\"\"\"\n    arg_3 = config.operative_config_str()\n    if not tf.gfile.IsDirectory(arg_0._output_dir):\n      tf.gfile.MakeDirs(arg_0._output_dir)\n    arg_4 = 0\n    if arg_1 is not None:\n      arg_5 = tf.train.get_global_step()\n      if arg_5 is not None:\n        arg_4 = arg_1.run(arg_5)\n    arg_6 = '%s-%s.gin' % (arg_0._base_name, arg_4)\n    arg_7 = os.path.join(arg_0._output_dir, arg_6)\n    with tf.gfile.GFile(arg_7, 'w') as f:\n      f.write(arg_3)\n\n    if arg_0._summarize_config:\n      arg_8 = arg_0._markdownify_operative_config_str(arg_3)\n      arg_9 = summary_pb2.SummaryMetadata()\n      arg_9.plugin_data.plugin_name = 'text'\n      arg_9.plugin_data.content = b'{}'\n      arg_13 = tf.make_tensor_proto(arg_8)\n      arg_14 = summary_pb2.Summary()\n      arg_14.value.add(\n          tag='gin/' + arg_0._base_name,\n          tensor=arg_13,\n          metadata=arg_9)\n      if not arg_0._summary_writer:\n        # Creating the FileWriter also creates the events file, so it should be\n        # done here (where it is most likely to only occur on chief workers), as\n        # opposed to in the constructor.\n        arg_0._summary_writer = tf.summary.FileWriterCache.get(arg_0._output_dir)\n      arg_0._summary_writer.add_summary(arg_14, arg_4)\n      arg_0._summary_writer.flush()", "path": "gin/tf/utils.py", "identifier": "GinConfigSaverHook.after_create_session", "docstring": "Writes out Gin's operative config, and maybe adds a summary of it.", "docstring_tokens": ["Writes", "out", "Gin", "s", "operative", "config", "and", "maybe", "adds", "a", "summary", "of", "it", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 259778}
{"url": "https://github.com/vingd/encrypted-pickle-python/blob/7656233598e02e65971f69e11849a0f288b2b2a5/encryptedpickle/encryptedpickle.py#L546-L558", "sha": "7656233598e02e65971f69e11849a0f288b2b2a5", "docstring_summary": "Verify and remove magic", "language": "python", "parameters": "(self, data)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "magic", ":", "return", "arg_1", "arg_2", "=", "len", "(", "arg_0", ".", "magic", ")", "arg_3", "=", "arg_1", "[", ":", "arg_2", "]", "if", "arg_3", "!=", "arg_0", ".", "magic", ":", "raise", "Exception", "(", "'Invalid magic'", ")", "arg_1", "=", "arg_1", "[", "arg_2", ":", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        '''Verify and remove magic'''\n\n        if not arg_0.magic:\n            return arg_1\n\n        arg_2 = len(arg_0.magic)\n        arg_3 = arg_1[:arg_2]\n        if arg_3 != arg_0.magic:\n            raise Exception('Invalid magic')\n        arg_1 = arg_1[arg_2:]\n\n        return arg_1", "path": "encryptedpickle/encryptedpickle.py", "identifier": "EncryptedPickle._remove_magic", "docstring": "Verify and remove magic", "docstring_tokens": ["Verify", "and", "remove", "magic"], "nwo": "vingd/encrypted-pickle-python", "score": 0.1861985637721619, "idx": 259779}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/unit.py#L46-L95", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "synthesize all subunits, make connections between them,\n        build entity and component for this unit", "language": "python", "parameters": "(self, targetPlatform: DummyPlatform)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "assert", "not", "arg_0", ".", "_wasSynthetised", "(", ")", "arg_0", ".", "_targetPlatform", "=", "arg_1", "if", "not", "hasattr", "(", "arg_0", ",", "\"_name\"", ")", ":", "arg_0", ".", "_name", "=", "arg_0", ".", "_getDefaultName", "(", ")", "for", "arg_5", "in", "arg_1", ".", "beforeToRtl", ":", "arg_5", "(", "arg_0", ")", "arg_0", ".", "_ctx", ".", "params", "=", "arg_0", ".", "_buildParams", "(", ")", "arg_0", ".", "_externInterf", "=", "[", "]", "for", "arg_9", "in", "arg_0", ".", "_units", ":", "yield", "from", "arg_9", ".", "Func", "(", "arg_1", ")", "for", "arg_9", "in", "arg_0", ".", "_units", ":", "arg_10", "=", "arg_9", ".", "_name", "arg_9", ".", "_signalsForMyEntity", "(", "arg_0", ".", "_ctx", ",", "\"sig_\"", "+", "arg_10", ")", "for", "arg_11", "in", "arg_0", ".", "_interfaces", ":", "arg_12", "=", "arg_11", ".", "_signalsForInterface", "(", "arg_0", ".", "_ctx", ")", "if", "arg_11", ".", "_isExtern", ":", "arg_0", ".", "_externInterf", ".", "extend", "(", "arg_12", ")", "for", "arg_5", "in", "arg_1", ".", "beforeToRtlImpl", ":", "arg_5", "(", "arg_0", ")", "arg_0", ".", "_loadMyImplementations", "(", ")", "yield", "from", "arg_0", ".", "_lazyLoaded", "if", "not", "arg_0", ".", "_externInterf", ":", "raise", "IntfLvlConfErr", "(", "\"Can not find any external interface for unit %s\"", "\"- unit without interfaces are not allowed\"", "%", "arg_0", ".", "_name", ")", "for", "arg_5", "in", "arg_1", ".", "afterToRtlImpl", ":", "arg_5", "(", "arg_0", ")", "yield", "from", "arg_0", ".", "_synthetiseContext", "(", "arg_0", ".", "_externInterf", ")", "arg_0", ".", "_checkArchCompInstances", "(", ")", "for", "arg_5", "in", "arg_1", ".", "afterToRtl", ":", "arg_5", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        synthesize all subunits, make connections between them,\n        build entity and component for this unit\n        \"\"\"\n        assert not arg_0._wasSynthetised()\n\n        arg_0._targetPlatform = arg_1\n        if not hasattr(arg_0, \"_name\"):\n            arg_0._name = arg_0._getDefaultName()\n\n        for arg_5 in arg_1.beforeToRtl:\n            arg_5(arg_0)\n\n        arg_0._ctx.params = arg_0._buildParams()\n        arg_0._externInterf = []\n\n        # prepare subunits\n        for arg_9 in arg_0._units:\n            yield from arg_9.Func(arg_1)\n\n        for arg_9 in arg_0._units:\n            arg_10 = arg_9._name\n            arg_9._signalsForMyEntity(arg_0._ctx, \"sig_\" + arg_10)\n\n        # prepare signals for interfaces\n        for arg_11 in arg_0._interfaces:\n            arg_12 = arg_11._signalsForInterface(arg_0._ctx)\n            if arg_11._isExtern:\n                arg_0._externInterf.extend(arg_12)\n\n        for arg_5 in arg_1.beforeToRtlImpl:\n            arg_5(arg_0)\n        arg_0._loadMyImplementations()\n        yield from arg_0._lazyLoaded\n\n        if not arg_0._externInterf:\n            raise IntfLvlConfErr(\n                \"Can not find any external interface for unit %s\"\n                \"- unit without interfaces are not allowed\"\n                % arg_0._name)\n\n        for arg_5 in arg_1.afterToRtlImpl:\n            arg_5(arg_0)\n\n        yield from arg_0._synthetiseContext(arg_0._externInterf)\n        arg_0._checkArchCompInstances()\n\n        for arg_5 in arg_1.afterToRtl:\n            arg_5(arg_0)", "path": "hwt/synthesizer/unit.py", "identifier": "Unit._toRtl", "docstring": "synthesize all subunits, make connections between them,\n        build entity and component for this unit", "docstring_tokens": ["synthesize", "all", "subunits", "make", "connections", "between", "them", "build", "entity", "and", "component", "for", "this", "unit"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 259780}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L114-L129", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Takes a record and returns true if record meets filter criteria,\n  false otherwise", "language": "python", "parameters": "(filterList, record)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", "in", "arg_0", ":", "arg_5", "=", "dict", "(", ")", "arg_5", "[", "'value'", "]", "=", "arg_1", "[", "arg_2", "]", "arg_5", "[", "'acceptValues'", "]", "=", "arg_4", "[", "'acceptValues'", "]", "arg_5", "[", "'min'", "]", "=", "arg_4", "[", "'min'", "]", "arg_5", "[", "'max'", "]", "=", "arg_4", "[", "'max'", "]", "if", "not", "arg_3", "(", "arg_5", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1):\n  \"\"\" Takes a record and returns true if record meets filter criteria,\n  false otherwise\n  \"\"\"\n\n  for (arg_2, arg_3, arg_4) in arg_0:\n    arg_5 = dict()\n    arg_5['value'] = arg_1[arg_2]\n    arg_5['acceptValues'] = arg_4['acceptValues']\n    arg_5['min'] = arg_4['min']\n    arg_5['max'] = arg_4['max']\n    if not arg_3(arg_5):\n      return False\n\n  # None of the field filters triggered, accept the record as a good one\n  return True", "path": "src/nupic/data/aggregator.py", "identifier": "_filterRecord", "docstring": "Takes a record and returns true if record meets filter criteria,\n  false otherwise", "docstring_tokens": ["Takes", "a", "record", "and", "returns", "true", "if", "record", "meets", "filter", "criteria", "false", "otherwise"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259781}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L60-L69", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Ensure that the wrapped API client's response brings us valid data. If not, raise an error and log it.", "language": "python", "parameters": "(self, request, data, error_message=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "not", "arg_2", ":", "arg_3", "=", "(", "arg_3", "or", "\"Unable to fetch API response from endpoint '{}'.\"", ".", "format", "(", "arg_1", ".", "get_full_path", "(", ")", ")", ")", "LOGGER", ".", "error", "(", "arg_3", ")", "raise", "NotFound", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Ensure that the wrapped API client's response brings us valid data. If not, raise an error and log it.\n        \"\"\"\n        if not arg_2:\n            arg_3 = (\n                arg_3 or \"Unable to fetch API response from endpoint '{}'.\".format(arg_1.get_full_path())\n            )\n            LOGGER.error(arg_3)\n            raise NotFound(arg_3)", "path": "enterprise/api/v1/views.py", "identifier": "EnterpriseViewSet.ensure_data_exists", "docstring": "Ensure that the wrapped API client's response brings us valid data. If not, raise an error and log it.", "docstring_tokens": ["Ensure", "that", "the", "wrapped", "API", "client", "s", "response", "brings", "us", "valid", "data", ".", "If", "not", "raise", "an", "error", "and", "log", "it", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259782}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/project/application/utils/security.py#L13-L20", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Decode something with SECRET_KEY.", "language": "python", "parameters": "(something)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "current_app", ".", "config", ".", "get", "(", "'SECRET_KEY'", ")", "arg_2", "=", "URLSafeSerializer", "(", "arg_1", ")", "try", ":", "return", "arg_2", ".", "loads", "(", "arg_0", ")", "except", "BadSignature", ":", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"Decode something with SECRET_KEY.\"\"\"\n    arg_1 = current_app.config.get('SECRET_KEY')\n    arg_2 = URLSafeSerializer(arg_1)\n    try:\n        return arg_2.loads(arg_0)\n    except BadSignature:\n        return None", "path": "flask_boost/project/application/utils/security.py", "identifier": "decode", "docstring": "Decode something with SECRET_KEY.", "docstring_tokens": ["Decode", "something", "with", "SECRET_KEY", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 259783}
{"url": "https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/managers.py#L18-L51", "sha": "dc2d941d8285a96f3a5b666a4bd04875b0b25984", "docstring_summary": "Spawn a server process for this manager object", "language": "python", "parameters": "(self, initializer=None, initargs=())", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "(", ")", ")", ":", "assert", "arg_0", ".", "_state", ".", "value", "==", "State", ".", "INITIAL", "if", "(", "arg_1", "is", "not", "None", "and", "not", "hasattr", "(", "arg_1", ",", "'__call__'", ")", ")", ":", "raise", "TypeError", "(", "'initializer must be a callable'", ")", "arg_3", ",", "arg_4", "=", "mp", ".", "Pipe", "(", "duplex", "=", "False", ")", "arg_0", ".", "_process", "=", "Process", "(", "target", "=", "type", "(", "arg_0", ")", ".", "_run_server", ",", "args", "=", "(", "arg_0", ".", "_registry", ",", "arg_0", ".", "_address", ",", "bytes", "(", "arg_0", ".", "_authkey", ")", ",", "arg_0", ".", "_serializer", ",", "arg_4", ",", "arg_1", ",", "arg_2", ")", ",", ")", "arg_6", "=", "':'", ".", "join", "(", "str", "(", "i", ")", "for", "i", "in", "arg_0", ".", "_process", ".", "_identity", ")", "arg_0", ".", "_process", ".", "name", "=", "type", "(", "arg_0", ")", ".", "__name__", "+", "'-'", "+", "arg_6", "arg_0", ".", "_process", ".", "Func", "(", ")", "arg_4", ".", "close", "(", ")", "arg_0", ".", "_address", "=", "arg_3", ".", "recv", "(", ")", "arg_3", ".", "close", "(", ")", "arg_0", ".", "_state", ".", "value", "=", "State", ".", "STARTED", "arg_0", ".", "shutdown", "=", "mp", ".", "util", ".", "Finalize", "(", "arg_0", ",", "type", "(", "arg_0", ")", ".", "_finalize_manager", ",", "args", "=", "(", "arg_0", ".", "_process", ",", "arg_0", ".", "_address", ",", "arg_0", ".", "_authkey", ",", "arg_0", ".", "_state", ",", "arg_0", ".", "_Client", ")", ",", "exitpriority", "=", "0", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=()):\n        '''Spawn a server process for this manager object'''\n        assert arg_0._state.value == State.INITIAL\n\n        if (arg_1 is not None\n                and not hasattr(arg_1, '__call__')):\n            raise TypeError('initializer must be a callable')\n\n        # pipe over which we will retrieve address of server\n        arg_3, arg_4 = mp.Pipe(duplex=False)\n\n        # spawn process which runs a server\n        arg_0._process = Process(\n            target=type(arg_0)._run_server,\n            args=(arg_0._registry, arg_0._address, bytes(arg_0._authkey),\n                  arg_0._serializer, arg_4, arg_1, arg_2),\n        )\n        arg_6 = ':'.join(str(i) for i in arg_0._process._identity)\n        arg_0._process.name = type(arg_0).__name__ + '-' + arg_6\n        arg_0._process.Func()\n\n        # get address of server\n        arg_4.close()\n        arg_0._address = arg_3.recv()\n        arg_3.close()\n\n        # register a finalizer\n        arg_0._state.value = State.STARTED\n        arg_0.shutdown = mp.util.Finalize(\n            arg_0, type(arg_0)._finalize_manager,\n            args=(arg_0._process, arg_0._address, arg_0._authkey,\n                  arg_0._state, arg_0._Client),\n            exitpriority=0\n        )", "path": "loky/backend/managers.py", "identifier": "LokyManager.start", "docstring": "Spawn a server process for this manager object", "docstring_tokens": ["Spawn", "a", "server", "process", "for", "this", "manager", "object"], "nwo": "tomMoral/loky", "score": 0.572510808364181, "idx": 259784}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/svg_utils.py#L39-L70", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Try to read a SVG file if `svg_file` is a string.\n    Raise an exception in case of error or return the svg object.", "language": "python", "parameters": "(svg_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "try", ":", "arg_1", "=", "sg", ".", "fromfile", "(", "arg_0", ")", "except", "Exception", "as", "exc", ":", "raise", "Exception", "(", "'Error reading svg file {}.'", ".", "format", "(", "arg_0", ")", ")", "from", "exc", "else", ":", "return", "arg_1", "if", "isinstance", "(", "arg_0", ",", "sg", ".", "SVGFigure", ")", ":", "return", "arg_0", "raise", "ValueError", "(", "'Expected `svg_file` to be `str` or `svgutils.SVG`, got {}.'", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\" Try to read a SVG file if `svg_file` is a string.\n    Raise an exception in case of error or return the svg object.\n\n    If `svg_file` is a svgutils svg object, will just return it.\n\n    Parameters\n    ----------\n    svg_file: str or svgutils.transform.SVGFigure object\n        If a `str`: path to a '.svg' file,\n        otherwise a svgutils svg object is expected.\n\n    Returns\n    -------\n    svgutils svg object\n\n    Raises\n    ------\n    Exception if any error happens.\n    \"\"\"\n    if isinstance(arg_0, str):\n        try:\n            arg_1 = sg.fromfile(arg_0)\n        except Exception as exc:\n            raise Exception('Error reading svg file {}.'.format(arg_0)) from exc\n        else:\n            return arg_1\n\n    if isinstance(arg_0, sg.SVGFigure):\n        return arg_0\n\n    raise ValueError('Expected `svg_file` to be `str` or `svgutils.SVG`, got {}.'.format(type(arg_0)))", "path": "docstamp/svg_utils.py", "identifier": "_check_svg_file", "docstring": "Try to read a SVG file if `svg_file` is a string.\n    Raise an exception in case of error or return the svg object.\n\n    If `svg_file` is a svgutils svg object, will just return it.\n\n    Parameters\n    ----------\n    svg_file: str or svgutils.transform.SVGFigure object\n        If a `str`: path to a '.svg' file,\n        otherwise a svgutils svg object is expected.\n\n    Returns\n    -------\n    svgutils svg object\n\n    Raises\n    ------\n    Exception if any error happens.", "docstring_tokens": ["Try", "to", "read", "a", "SVG", "file", "if", "svg_file", "is", "a", "string", ".", "Raise", "an", "exception", "in", "case", "of", "error", "or", "return", "the", "svg", "object", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 259785}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/obo.py#L87-L99", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Write as a BEL annotation.", "language": "python", "parameters": "(keyword: str, file: TextIO)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", ":", "arg_4", "=", "get_data_dir", "(", "arg_0", ")", "arg_5", "=", "f'http://purl.obolibrary.org/obo/{keyword}.obo'", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "f'{keyword}.obo'", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "f'{keyword}.obo.pickle'", ")", "arg_8", "=", "make_obo_getter", "(", "arg_5", ",", "arg_6", ",", "preparsed_path", "=", "arg_7", ")", "arg_9", "=", "arg_8", "(", ")", "convert_obo_graph_to_Func", "(", "arg_9", ",", "arg_2", "=", "arg_2", ",", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3):\n    \"\"\"Write as a BEL annotation.\"\"\"\n    arg_4 = get_data_dir(arg_0)\n    arg_5 = f'http://purl.obolibrary.org/obo/{keyword}.obo'\n    arg_6 = os.path.join(arg_4, f'{keyword}.obo')\n    arg_7 = os.path.join(arg_4, f'{keyword}.obo.pickle')\n\n    arg_8 = make_obo_getter(arg_5, arg_6, preparsed_path=arg_7)\n    arg_9 = arg_8()\n    convert_obo_graph_to_Func(\n        arg_9,\n        arg_2=arg_2,\n    )", "path": "src/bio2bel/obo.py", "identifier": "belanno", "docstring": "Write as a BEL annotation.", "docstring_tokens": ["Write", "as", "a", "BEL", "annotation", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 259786}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/text.py#L276-L281", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Search for a decoding of the ciphertext.", "language": "python", "parameters": "(self, ciphertext)", "return_statement": "return search.best_first_tree_search(\n            problem, lambda node: self.score(node.state))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "ciphertext", "=", "arg_1", "arg_2", "=", "PermutationDecoderProblem", "(", "Funcr", "=", "arg_0", ")", "return", "search", ".", "best_first_tree_search", "(", "arg_2", ",", "lambda", "node", ":", "arg_0", ".", "score", "(", "node", ".", "state", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"Search for a decoding of the ciphertext.\"\n        arg_0.ciphertext = arg_1\n        arg_2 = PermutationDecoderProblem(Funcr=arg_0)\n        return search.best_first_tree_search(\n            arg_2, lambda node: arg_0.score(node.state))", "path": "aima/text.py", "identifier": "PermutationDecoder.decode", "docstring": "Search for a decoding of the ciphertext.", "docstring_tokens": ["Search", "for", "a", "decoding", "of", "the", "ciphertext", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 259787}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/plotting.py#L205-L262", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Plots a given tree, containing hierarchical segmentation.", "language": "python", "parameters": "(T, res=None, title=None, cmap_id=\"Pastel2\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "\"Pastel2\"", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "def", "round_time", "(", "arg_4", ",", "arg_1", "=", "0.1", ")", ":", "arg_5", "=", "int", "(", "arg_4", "/", "float", "(", "arg_1", ")", ")", "*", "arg_1", "return", "arg_5", "arg_6", "=", "plt", ".", "get_cmap", "(", "arg_3", ")", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_0", ".", "levels", ":", "if", "arg_8", "==", "\"root\"", ":", "continue", "arg_9", "=", "arg_0", ".", "get_segments_in_level", "(", "arg_8", ")", "arg_7", ".", "append", "(", "arg_9", ")", "arg_10", "=", "float", "(", "len", "(", "arg_7", ")", ")", "for", "arg_11", ",", "arg_9", "in", "enumerate", "(", "arg_7", ")", ":", "arg_12", "=", "utils", ".", "segment_labels_to_floats", "(", "arg_9", ")", "for", "arg_13", ",", "arg_14", "in", "zip", "(", "arg_9", ",", "arg_12", ")", ":", "if", "arg_1", "is", "None", ":", "arg_15", "=", "arg_13", ".", "start", "arg_16", "=", "arg_13", ".", "end", "arg_17", "=", "\"Time (seconds)\"", "else", ":", "arg_15", "=", "int", "(", "round_time", "(", "arg_13", ".", "start", ",", "arg_1", "=", "arg_1", ")", "/", "arg_1", ")", "arg_16", "=", "int", "(", "round_time", "(", "arg_13", ".", "end", ",", "arg_1", "=", "arg_1", ")", "/", "arg_1", ")", "arg_17", "=", "\"Time (frames)\"", "plt", ".", "axvspan", "(", "arg_15", ",", "arg_16", ",", "ymax", "=", "(", "len", "(", "arg_7", ")", "-", "arg_11", ")", "/", "arg_10", ",", "ymin", "=", "(", "len", "(", "arg_7", ")", "-", "arg_11", "-", "1", ")", "/", "arg_10", ",", "facecolor", "=", "arg_6", "(", "arg_14", ")", ")", "arg_18", "=", "float", "(", "len", "(", "arg_0", ".", "levels", ")", "-", "1", ")", "plt", ".", "yticks", "(", "np", ".", "linspace", "(", "0", ",", "(", "arg_18", "-", "1", ")", "/", "arg_18", ",", "num", "=", "arg_18", ")", "+", "1", "/", "arg_18", "/", "2.", ",", "arg_0", ".", "levels", "[", "1", ":", "]", "[", ":", ":", "-", "1", "]", ")", "plt", ".", "xlabel", "(", "arg_17", ")", "if", "arg_2", "is", "not", "None", ":", "plt", ".", "title", "(", "arg_2", ")", "plt", ".", "gca", "(", ")", ".", "set_xlim", "(", "[", "0", ",", "arg_16", "]", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=\"Pastel2\"):\n    \"\"\"Plots a given tree, containing hierarchical segmentation.\n\n    Parameters\n    ----------\n    T: mir_eval.segment.tree\n        A tree object containing the hierarchical segmentation.\n    res: float\n        Frame-rate resolution of the tree (None to use seconds).\n    title: str\n        Title for the plot. `None` for no title.\n    cmap_id: str\n        Color Map ID\n    \"\"\"\n    import matplotlib.pyplot as plt\n    def round_time(arg_4, arg_1=0.1):\n        arg_5 = int(arg_4 / float(arg_1)) * arg_1\n        return arg_5\n\n    # Get color map\n    arg_6 = plt.get_cmap(arg_3)\n\n    # Get segments by level\n    arg_7 = []\n    for arg_8 in arg_0.levels:\n        if arg_8 == \"root\":\n            continue\n        arg_9 = arg_0.get_segments_in_level(arg_8)\n        arg_7.append(arg_9)\n\n    # Plot axvspans for each segment\n    arg_10 = float(len(arg_7))\n    #plt.figure(figsize=figsize)\n    for arg_11, arg_9 in enumerate(arg_7):\n        arg_12 = utils.segment_labels_to_floats(arg_9)\n        for arg_13, arg_14 in zip(arg_9, arg_12):\n            #print i, label, cmap(label)\n            if arg_1 is None:\n                arg_15 = arg_13.start\n                arg_16 = arg_13.end\n                arg_17 = \"Time (seconds)\"\n            else:\n                arg_15 = int(round_time(arg_13.start, arg_1=arg_1) / arg_1)\n                arg_16 = int(round_time(arg_13.end, arg_1=arg_1) / arg_1)\n                arg_17 = \"Time (frames)\"\n            plt.axvspan(arg_15, arg_16,\n                        ymax=(len(arg_7) - arg_11) / arg_10,\n                        ymin=(len(arg_7) - arg_11 - 1) / arg_10,\n                        facecolor=arg_6(arg_14))\n\n    # Plot labels\n    arg_18 = float(len(arg_0.levels) - 1)\n    plt.yticks(np.linspace(0, (arg_18 - 1) / arg_18, num=arg_18) + 1 / arg_18 / 2.,\n               arg_0.levels[1:][::-1])\n    plt.xlabel(arg_17)\n    if arg_2 is not None:\n        plt.title(arg_2)\n    plt.gca().set_xlim([0, arg_16])", "path": "msaf/plotting.py", "identifier": "plot_tree", "docstring": "Plots a given tree, containing hierarchical segmentation.\n\n    Parameters\n    ----------\n    T: mir_eval.segment.tree\n        A tree object containing the hierarchical segmentation.\n    res: float\n        Frame-rate resolution of the tree (None to use seconds).\n    title: str\n        Title for the plot. `None` for no title.\n    cmap_id: str\n        Color Map ID", "docstring_tokens": ["Plots", "a", "given", "tree", "containing", "hierarchical", "segmentation", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 259788}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L187-L193", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "check if all menu items are enabled", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", "in", "range", "(", "arg_0", ".", "GetMenuItemCount", "(", ")", ")", ":", "arg_4", "=", "arg_0", ".", "FindItemByPosition", "(", "arg_3", ")", "if", "not", "arg_4", ".", "Func", "(", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, *arg_1, **arg_2):\r\n        \"check if all menu items are enabled\"\r\n        for arg_3 in range(arg_0.GetMenuItemCount()):\r\n            arg_4 = arg_0.FindItemByPosition(arg_3) \r\n            if not arg_4.Func():\r\n                return False\r\n        return True", "path": "gui/menu.py", "identifier": "wx_Menu.IsEnabled", "docstring": "check if all menu items are enabled", "docstring_tokens": ["check", "if", "all", "menu", "items", "are", "enabled"], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 259789}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/views.py#L136-L142", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Export panel to PDF file", "language": "python", "parameters": "(panel_id)", "return_statement": "return render_pdf(HTML(string=html_report), download_filename=data['panel']['panel_name']+'_'+str(data['panel']['version'])+'_'+datetime.datetime.now().strftime(\"%Y-%m-%d\")+'_scout.pdf')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "store", ".", "panel", "(", "arg_0", ")", "arg_2", "=", "controllers", ".", "Func", "(", "store", ",", "arg_1", ")", "arg_2", "[", "'report_created_at'", "]", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "arg_3", "=", "render_template", "(", "'panels/panel_pdf_simple.html'", ",", "**", "arg_2", ")", "return", "render_pdf", "(", "HTML", "(", "string", "=", "arg_3", ")", ",", "download_filename", "=", "arg_2", "[", "'panel'", "]", "[", "'panel_name'", "]", "+", "'_'", "+", "str", "(", "arg_2", "[", "'panel'", "]", "[", "'version'", "]", ")", "+", "'_'", "+", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "+", "'_scout.pdf'", ")"], "function": "def Func(arg_0):\n    \"\"\"Export panel to PDF file\"\"\"\n    arg_1 = store.panel(arg_0)\n    arg_2 = controllers.Func(store, arg_1)\n    arg_2['report_created_at'] = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n    arg_3 = render_template('panels/panel_pdf_simple.html', **arg_2)\n    return render_pdf(HTML(string=arg_3), download_filename=arg_2['panel']['panel_name']+'_'+str(arg_2['panel']['version'])+'_'+datetime.datetime.now().strftime(\"%Y-%m-%d\")+'_scout.pdf')", "path": "scout/server/blueprints/panels/views.py", "identifier": "panel_export", "docstring": "Export panel to PDF file", "docstring_tokens": ["Export", "panel", "to", "PDF", "file"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259790}
{"url": "https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L152-L166", "sha": "65b4271a161d6c19a9eb0170b5a95832a139ab7f", "docstring_summary": "Converts stdout string to a list.", "language": "python", "parameters": "(self)", "return_statement": "return stdout", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_streaming", ":", "Func", "=", "[", "]", "while", "not", "arg_0", ".", "__stdout", ".", "empty", "(", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "__stdout", ".", "get_nowait", "(", ")", "Func", ".", "append", "(", "arg_2", ")", "except", ":", "pass", "else", ":", "Func", "=", "arg_0", ".", "__stdout", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Converts stdout string to a list.\n        \"\"\"\n        if arg_0._streaming:\n            Func = []\n            while not arg_0.__stdout.empty():\n                try:\n                    arg_2 = arg_0.__stdout.get_nowait()\n                    Func.append(arg_2)\n                except:\n                    pass\n        else:\n            Func =  arg_0.__stdout\n        return Func", "path": "src/sultan/result.py", "identifier": "Result.stdout", "docstring": "Converts stdout string to a list.", "docstring_tokens": ["Converts", "stdout", "string", "to", "a", "list", "."], "nwo": "aeroxis/sultan", "score": 0.5790863849859432, "idx": 259791}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/gen_rst.py#L204-L208", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Return reStructuredText code block from code string", "language": "python", "parameters": "(codestr, lang='python')", "return_statement": "return code_directive + indented_block", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'python'", ")", ":", "arg_2", "=", "\"\\n.. code-block:: {0}\\n\\n\"", ".", "format", "(", "arg_1", ")", "arg_3", "=", "indent", "(", "arg_0", ",", "' '", "*", "4", ")", "return", "arg_2", "+", "arg_3"], "function": "def Func(arg_0, arg_1='python'):\n    \"\"\"Return reStructuredText code block from code string\"\"\"\n    arg_2 = \"\\n.. code-block:: {0}\\n\\n\".format(arg_1)\n    arg_3 = indent(arg_0, ' ' * 4)\n    return arg_2 + arg_3", "path": "doc/sphinxext/sphinx_gallery/gen_rst.py", "identifier": "codestr2rst", "docstring": "Return reStructuredText code block from code string", "docstring_tokens": ["Return", "reStructuredText", "code", "block", "from", "code", "string"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 259792}
{"url": "https://github.com/hiposfer/o2g/blob/1165ba75a5eb64b3091e9b71ebd589507ae1ebf3/o2g/osm/builders/shape_builder.py#L14-L42", "sha": "1165ba75a5eb64b3091e9b71ebd589507ae1ebf3", "docstring_summary": "Extract shape of one route.", "language": "python", "parameters": "(relation, nodes, ways)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "0", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "arg_0", ".", "member_info", ":", "if", "arg_5", "in", "arg_1", ":", "yield", "Shape", "(", "arg_0", ".", "id", ",", "arg_1", "[", "arg_5", "]", ".", "lat", ",", "arg_1", "[", "arg_5", "]", ".", "lon", ",", "arg_3", ")", "arg_3", "+=", "1", "elif", "arg_5", "in", "arg_2", ":", "continue", "else", ":", "pass"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Extract shape of one route.\"\"\"\n    arg_3 = 0\n\n    for arg_4, arg_5, arg_6 in arg_0.member_info:\n\n        if arg_5 in arg_1:\n            yield Shape(\n                arg_0.id,\n                arg_1[arg_5].lat,\n                arg_1[arg_5].lon,\n                arg_3)\n\n            arg_3 += 1\n\n        # Do we need to consider ways too? It dramatically increases the number of shapes.\n        elif arg_5 in arg_2:\n            continue\n        #     for point in ways[member_id].points:\n        #         shape = Shape(\n        #             relation.id,\n        #             point.lat,\n        #             point.lon,\n        #             sequence_index)\n        #         sequence_index += 1\n\n        else:\n            # Ignore excessive logging for now.\n            pass", "path": "o2g/osm/builders/shape_builder.py", "identifier": "build_shape", "docstring": "Extract shape of one route.", "docstring_tokens": ["Extract", "shape", "of", "one", "route", "."], "nwo": "hiposfer/o2g", "score": 0.3752106333265808, "idx": 259793}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1036-L1051", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Creates and connects the underlying paging widget.", "language": "python", "parameters": "(self)", "return_statement": "return control", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "custom_page_control", ":", "arg_1", "=", "arg_0", ".", "custom_page_control", "(", ")", "elif", "arg_0", ".", "kind", "==", "'plain'", ":", "arg_1", "=", "QtGui", ".", "QPlainTextEdit", "(", ")", "elif", "arg_0", ".", "kind", "==", "'rich'", ":", "arg_1", "=", "QtGui", ".", "QTextEdit", "(", ")", "arg_1", ".", "installEventFilter", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "viewport", "(", ")", "arg_2", ".", "installEventFilter", "(", "arg_0", ")", "arg_1", ".", "setReadOnly", "(", "True", ")", "arg_1", ".", "setUndoRedoEnabled", "(", "False", ")", "arg_1", ".", "setVerticalScrollBarPolicy", "(", "QtCore", ".", "Qt", ".", "ScrollBarAlwaysOn", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Creates and connects the underlying paging widget.\n        \"\"\"\n        if arg_0.custom_page_control:\n            arg_1 = arg_0.custom_page_control()\n        elif arg_0.kind == 'plain':\n            arg_1 = QtGui.QPlainTextEdit()\n        elif arg_0.kind == 'rich':\n            arg_1 = QtGui.QTextEdit()\n        arg_1.installEventFilter(arg_0)\n        arg_2 = arg_1.viewport()\n        arg_2.installEventFilter(arg_0)\n        arg_1.setReadOnly(True)\n        arg_1.setUndoRedoEnabled(False)\n        arg_1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._create_page_control", "docstring": "Creates and connects the underlying paging widget.", "docstring_tokens": ["Creates", "and", "connects", "the", "underlying", "paging", "widget", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259794}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L764-L810", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Use SequenceMatcher to return list of the best \"good enough\" matches.", "language": "python", "parameters": "(word, possibilities, n=3, cutoff=0.6)", "return_statement": "return [x for score, x in result]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "3", ",", "arg_3", "=", "0.6", ")", ":", "if", "not", "arg_2", ">", "0", ":", "raise", "ValueError", "(", "\"n must be > 0: %r\"", "%", "(", "arg_2", ",", ")", ")", "if", "not", "0.0", "<=", "arg_3", "<=", "1.0", ":", "raise", "ValueError", "(", "\"cutoff must be in [0.0, 1.0]: %r\"", "%", "(", "arg_3", ",", ")", ")", "arg_4", "=", "[", "]", "arg_5", "=", "SequenceMatcher", "(", ")", "arg_5", ".", "set_seq2", "(", "arg_0", ")", "for", "arg_6", "in", "arg_1", ":", "arg_5", ".", "set_seq1", "(", "arg_6", ")", "if", "arg_5", ".", "real_quick_ratio", "(", ")", ">=", "arg_3", "and", "arg_5", ".", "quick_ratio", "(", ")", ">=", "arg_3", "and", "arg_5", ".", "ratio", "(", ")", ">=", "arg_3", ":", "arg_4", ".", "append", "(", "(", "arg_5", ".", "ratio", "(", ")", ",", "arg_6", ")", ")", "arg_4", "=", "heapq", ".", "nlargest", "(", "arg_2", ",", "arg_4", ")", "return", "[", "arg_6", "for", "arg_7", ",", "arg_6", "in", "arg_4", "]"], "function": "def Func(arg_0, arg_1, arg_2=3, arg_3=0.6):\n    \"\"\"Use SequenceMatcher to return list of the best \"good enough\" matches.\n\n    word is a sequence for which close matches are desired (typically a\n    string).\n\n    possibilities is a list of sequences against which to match word\n    (typically a list of strings).\n\n    Optional arg n (default 3) is the maximum number of close matches to\n    return.  n must be > 0.\n\n    Optional arg cutoff (default 0.6) is a float in [0, 1].  Possibilities\n    that don't score at least that similar to word are ignored.\n\n    The best (no more than n) matches among the possibilities are returned\n    in a list, sorted by similarity score, most similar first.\n\n    >>> Func(\"appel\", [\"ape\", \"apple\", \"peach\", \"puppy\"])\n    ['apple', 'ape']\n    >>> import keyword as _keyword\n    >>> Func(\"wheel\", _keyword.kwlist)\n    ['while']\n    >>> Func(\"apple\", _keyword.kwlist)\n    []\n    >>> Func(\"accept\", _keyword.kwlist)\n    ['except']\n    \"\"\"\n\n    if not arg_2 >  0:\n        raise ValueError(\"n must be > 0: %r\" % (arg_2,))\n    if not 0.0 <= arg_3 <= 1.0:\n        raise ValueError(\"cutoff must be in [0.0, 1.0]: %r\" % (arg_3,))\n    arg_4 = []\n    arg_5 = SequenceMatcher()\n    arg_5.set_seq2(arg_0)\n    for arg_6 in arg_1:\n        arg_5.set_seq1(arg_6)\n        if arg_5.real_quick_ratio() >= arg_3 and \\\n           arg_5.quick_ratio() >= arg_3 and \\\n           arg_5.ratio() >= arg_3:\n            arg_4.append((arg_5.ratio(), arg_6))\n\n    # Move the best scorers to head of list\n    arg_4 = heapq.nlargest(arg_2, arg_4)\n    # Strip scores for the best n matches\n    return [arg_6 for arg_7, arg_6 in arg_4]", "path": "third_party/stdlib/difflib.py", "identifier": "get_close_matches", "docstring": "Use SequenceMatcher to return list of the best \"good enough\" matches.\n\n    word is a sequence for which close matches are desired (typically a\n    string).\n\n    possibilities is a list of sequences against which to match word\n    (typically a list of strings).\n\n    Optional arg n (default 3) is the maximum number of close matches to\n    return.  n must be > 0.\n\n    Optional arg cutoff (default 0.6) is a float in [0, 1].  Possibilities\n    that don't score at least that similar to word are ignored.\n\n    The best (no more than n) matches among the possibilities are returned\n    in a list, sorted by similarity score, most similar first.\n\n    >>> get_close_matches(\"appel\", [\"ape\", \"apple\", \"peach\", \"puppy\"])\n    ['apple', 'ape']\n    >>> import keyword as _keyword\n    >>> get_close_matches(\"wheel\", _keyword.kwlist)\n    ['while']\n    >>> get_close_matches(\"apple\", _keyword.kwlist)\n    []\n    >>> get_close_matches(\"accept\", _keyword.kwlist)\n    ['except']", "docstring_tokens": ["Use", "SequenceMatcher", "to", "return", "list", "of", "the", "best", "good", "enough", "matches", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 259795}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/affine.py#L34-L37", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Convenience to convert to `Tensor` or leave as `None`.", "language": "python", "parameters": "(x, name, dtype)", "return_statement": "return None if x is None else tf.convert_to_tensor(\n      value=x, name=name, dtype=dtype)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "None", "if", "arg_0", "is", "None", "else", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"Convenience to convert to `Tensor` or leave as `None`.\"\"\"\n  return None if arg_0 is None else tf.convert_to_tensor(\n      value=arg_0, arg_1=arg_1, arg_2=arg_2)", "path": "tensorflow_probability/python/bijectors/affine.py", "identifier": "_as_tensor", "docstring": "Convenience to convert to `Tensor` or leave as `None`.", "docstring_tokens": ["Convenience", "to", "convert", "to", "Tensor", "or", "leave", "as", "None", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259796}
{"url": "https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L235-L261", "sha": "12172363d14eaedba2db4c452ef995b14f1b630d", "docstring_summary": "Interactive prompting to populate the readme.", "language": "python", "parameters": "(proto_dataset_uri)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dtoolcore", ".", "ProtoDataSet", ".", "from_uri", "(", "uri", "=", "arg_0", ",", "config_path", "=", "CONFIG_PATH", ")", "arg_2", "=", "_get_readme_template", "(", ")", "arg_3", "=", "YAML", "(", ")", "arg_3", ".", "explicit_start", "=", "True", "arg_3", ".", "indent", "(", "mapping", "=", "2", ",", "sequence", "=", "4", ",", "offset", "=", "2", ")", "arg_5", "=", "arg_3", ".", "load", "(", "arg_2", ")", "arg_5", "=", "_prompt_for_values", "(", "arg_5", ")", "arg_6", "=", "StringIO", "(", ")", "arg_3", ".", "dump", "(", "arg_5", ",", "arg_6", ")", "arg_1", ".", "put_readme", "(", "arg_6", ".", "getvalue", "(", ")", ")", "click", ".", "secho", "(", "\"Updated readme \"", ",", "fg", "=", "\"green\"", ")", "click", ".", "secho", "(", "\"To edit the readme using your default editor:\"", ")", "click", ".", "secho", "(", "\"dtool readme edit {}\"", ".", "format", "(", "arg_0", ")", ",", "fg", "=", "\"cyan\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Interactive prompting to populate the readme.\"\"\"\n    arg_1 = dtoolcore.ProtoDataSet.from_uri(\n        uri=arg_0,\n        config_path=CONFIG_PATH)\n\n    # Create an CommentedMap representation of the yaml readme template.\n    arg_2 = _get_readme_template()\n    arg_3 = YAML()\n    arg_3.explicit_start = True\n    arg_3.indent(mapping=2, sequence=4, offset=2)\n    arg_5 = arg_3.load(arg_2)\n\n    arg_5 = _prompt_for_values(arg_5)\n\n    # Write out the descriptive metadata to the readme file.\n    arg_6 = StringIO()\n\n    arg_3.dump(arg_5, arg_6)\n\n    arg_1.put_readme(arg_6.getvalue())\n\n    click.secho(\"Updated readme \", fg=\"green\")\n    click.secho(\"To edit the readme using your default editor:\")\n    click.secho(\n        \"dtool readme edit {}\".format(arg_0),\n        fg=\"cyan\")", "path": "dtool_create/dataset.py", "identifier": "interactive", "docstring": "Interactive prompting to populate the readme.", "docstring_tokens": ["Interactive", "prompting", "to", "populate", "the", "readme", "."], "nwo": "jic-dtool/dtool-create", "score": 0.25890992733444657, "idx": 259797}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L639-L642", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Generate a string that can be added to a mdp 'include = ' line.", "language": "python", "parameters": "(dirs)", "return_statement": "return ' -I'.join([''] + include_paths)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "os", ".", "path", ".", "expanduser", "(", "p", ")", "for", "p", "in", "arg_0", "]", "return", "' -I'", ".", "join", "(", "[", "''", "]", "+", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Generate a string that can be added to a mdp 'include = ' line.\"\"\"\n    arg_1 = [os.path.expanduser(p) for p in arg_0]\n    return ' -I'.join([''] + arg_1)", "path": "gromacs/cbook.py", "identifier": "_mdp_include_string", "docstring": "Generate a string that can be added to a mdp 'include = ' line.", "docstring_tokens": ["Generate", "a", "string", "that", "can", "be", "added", "to", "a", "mdp", "include", "=", "line", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 259798}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L694-L713", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the user public organizations", "language": "python", "parameters": "(self, login)", "return_statement": "return orgs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_users_orgs", ":", "return", "arg_0", ".", "_users_orgs", "[", "arg_1", "]", "arg_2", "=", "urijoin", "(", "arg_0", ".", "base_url", ",", "'users'", ",", "arg_1", ",", "'orgs'", ")", "try", ":", "arg_3", "=", "arg_0", ".", "fetch", "(", "arg_2", ")", "arg_4", "=", "arg_3", ".", "text", "except", "requests", ".", "exceptions", ".", "HTTPError", "as", "error", ":", "if", "error", ".", "response", ".", "status_code", "==", "404", ":", "logger", ".", "error", "(", "\"Can't get github login orgs: %s\"", ",", "error", ")", "arg_4", "=", "'[]'", "else", ":", "raise", "error", "arg_0", ".", "_users_orgs", "[", "arg_1", "]", "=", "arg_4", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get the user public organizations\"\"\"\n        if arg_1 in arg_0._users_orgs:\n            return arg_0._users_orgs[arg_1]\n\n        arg_2 = urijoin(arg_0.base_url, 'users', arg_1, 'orgs')\n        try:\n            arg_3 = arg_0.fetch(arg_2)\n            arg_4 = arg_3.text\n        except requests.exceptions.HTTPError as error:\n            # 404 not found is wrongly received sometimes\n            if error.response.status_code == 404:\n                logger.error(\"Can't get github login orgs: %s\", error)\n                arg_4 = '[]'\n            else:\n                raise error\n\n        arg_0._users_orgs[arg_1] = arg_4\n\n        return arg_4", "path": "perceval/backends/core/github.py", "identifier": "GitHubClient.user_orgs", "docstring": "Get the user public organizations", "docstring_tokens": ["Get", "the", "user", "public", "organizations"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259799}
{"url": "https://github.com/lazka/hypothesis-fspaths/blob/19edb40a91ae4055bccf125a1e0b1796fa2e6a5c/hypothesis_fspaths.py#L53-L101", "sha": "19edb40a91ae4055bccf125a1e0b1796fa2e6a5c", "docstring_summary": "Generate a path value of type result_type.", "language": "python", "parameters": "(draw, result_type=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "characters", "(", "min_codepoint", "=", "0x01", ",", "max_codepoint", "=", "0x7f", ")", "if", "os", ".", "name", "==", "'nt'", ":", "arg_3", "=", "characters", "(", "min_codepoint", "=", "0xD800", ",", "max_codepoint", "=", "0xDFFF", ")", "arg_4", "=", "characters", "(", "min_codepoint", "=", "0x1", ")", "arg_5", "=", "text", "(", "alphabet", "=", "one_of", "(", "arg_4", ",", "arg_3", ",", "arg_2", ")", ")", "def", "text_to_bytes", "(", "arg_6", ")", ":", "arg_7", "=", "sys", ".", "getfilesystemencoding", "(", ")", "try", ":", "return", "arg_6", ".", "encode", "(", "arg_7", ",", "'surrogatepass'", ")", "except", "UnicodeEncodeError", ":", "return", "arg_6", ".", "encode", "(", "arg_7", ",", "'replace'", ")", "arg_8", "=", "arg_5", ".", "map", "(", "text_to_bytes", ")", "else", ":", "arg_9", "=", "characters", "(", "min_codepoint", "=", "0x01", ",", "max_codepoint", "=", "0xff", ")", "arg_8", "=", "text", "(", "alphabet", "=", "one_of", "(", "arg_9", ",", "arg_2", ")", ")", ".", "map", "(", "lambda", "t", ":", "t", ".", "encode", "(", "'latin-1'", ")", ")", "arg_10", "=", "arg_8", ".", "map", "(", "lambda", "b", ":", "b", ".", "decode", "(", "sys", ".", "getfilesystemencoding", "(", ")", ",", "'surrogateescape'", "if", "PY3", "else", "'ignore'", ")", ")", "arg_5", "=", "permutations", "(", "arg_0", "(", "arg_10", ")", ")", ".", "map", "(", "u\"\"", ".", "join", ")", "if", "arg_1", "is", "None", ":", "return", "arg_0", "(", "one_of", "(", "arg_8", ",", "arg_5", ")", ")", "elif", "arg_1", "is", "bytes", ":", "return", "arg_0", "(", "arg_8", ")", "else", ":", "return", "arg_0", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Generate a path value of type result_type.\n\n    result_type can either be bytes or text_type\n\n    \"\"\"\n    # Various ASCII chars have a special meaning for the operating system,\n    # so make them more common\n    arg_2 = characters(min_codepoint=0x01, max_codepoint=0x7f)\n    if os.name == 'nt':  # pragma: no cover\n        # Windows paths can contain all surrogates and even surrogate pairs\n        # if two paths are concatenated. This makes it more likely for them to\n        # be generated.\n        arg_3 = characters(\n            min_codepoint=0xD800, max_codepoint=0xDFFF)\n        arg_4 = characters(min_codepoint=0x1)\n        arg_5 = text(\n            alphabet=one_of(arg_4, arg_3, arg_2))\n\n        def text_to_bytes(arg_6):\n            arg_7 = sys.getfilesystemencoding()\n            try:\n                return arg_6.encode(arg_7, 'surrogatepass')\n            except UnicodeEncodeError:\n                return arg_6.encode(arg_7, 'replace')\n\n        arg_8 = arg_5.map(text_to_bytes)\n    else:\n        arg_9 = characters(min_codepoint=0x01, max_codepoint=0xff)\n        arg_8 = text(alphabet=one_of(arg_9, arg_2)).map(\n            lambda t: t.encode('latin-1'))\n\n        arg_10 = arg_8.map(\n            lambda b: b.decode(\n                sys.getfilesystemencoding(),\n                'surrogateescape' if PY3 else 'ignore'))\n\n        # Two surrogates generated through surrogateescape can generate\n        # a valid utf-8 sequence when encoded and result in a different\n        # code point when decoded again. Can happen when two paths get\n        # concatenated. Shuffling makes it possible to generate such a case.\n        arg_5 = permutations(arg_0(arg_10)).map(u\"\".join)\n\n    if arg_1 is None:\n        return arg_0(one_of(arg_8, arg_5))\n    elif arg_1 is bytes:\n        return arg_0(arg_8)\n    else:\n        return arg_0(arg_5)", "path": "hypothesis_fspaths.py", "identifier": "_filename", "docstring": "Generate a path value of type result_type.\n\n    result_type can either be bytes or text_type", "docstring_tokens": ["Generate", "a", "path", "value", "of", "type", "result_type", "."], "nwo": "lazka/hypothesis-fspaths", "score": 0.16941397159673272, "idx": 259800}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2451-L2485", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Like safe_execfile, but for .ipy files with IPython syntax.", "language": "python", "parameters": "(self, fname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "arg_1", ")", ")", "try", ":", "with", "open", "(", "arg_1", ")", "as", "thefile", ":", "pass", "except", ":", "warn", "(", "'Could not open file <%s> for safe execution.'", "%", "arg_1", ")", "return", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "with", "prepended_to_syspath", "(", "arg_2", ")", ":", "try", ":", "with", "open", "(", "arg_1", ")", "as", "thefile", ":", "arg_0", ".", "run_cell", "(", "thefile", ".", "read", "(", ")", ",", "store_history", "=", "False", ")", "except", ":", "arg_0", ".", "showtraceback", "(", ")", "warn", "(", "'Unknown failure executing file: <%s>'", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Like safe_execfile, but for .ipy files with IPython syntax.\n\n        Parameters\n        ----------\n        fname : str\n            The name of the file to execute.  The filename must have a\n            .ipy extension.\n        \"\"\"\n        arg_1 = os.path.abspath(os.path.expanduser(arg_1))\n\n        # Make sure we can open the file\n        try:\n            with open(arg_1) as thefile:\n                pass\n        except:\n            warn('Could not open file <%s> for safe execution.' % arg_1)\n            return\n\n        # Find things also in current directory.  This is needed to mimic the\n        # behavior of running a script from the system command line, where\n        # Python inserts the script's directory into sys.path\n        arg_2 = os.path.dirname(arg_1)\n\n        with prepended_to_syspath(arg_2):\n            try:\n                with open(arg_1) as thefile:\n                    # self.run_cell currently captures all exceptions\n                    # raised in user code.  It would be nice if there were\n                    # versions of runlines, execfile that did raise, so\n                    # we could catch the errors.\n                    arg_0.run_cell(thefile.read(), store_history=False)\n            except:\n                arg_0.showtraceback()\n                warn('Unknown failure executing file: <%s>' % arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.safe_execfile_ipy", "docstring": "Like safe_execfile, but for .ipy files with IPython syntax.\n\n        Parameters\n        ----------\n        fname : str\n            The name of the file to execute.  The filename must have a\n            .ipy extension.", "docstring_tokens": ["Like", "safe_execfile", "but", "for", ".", "ipy", "files", "with", "IPython", "syntax", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259801}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L3591-L3614", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns a dictionary containing the full result names as keys and the corresponding\n        result objects or result data items as values.", "language": "python", "parameters": "(self, fast_access=False, copy=True)", "return_statement": "return self._return_item_dictionary(self._results, fast_access, copy)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "return", "arg_0", ".", "_return_item_dictionary", "(", "arg_0", ".", "_results", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n        \"\"\" Returns a dictionary containing the full result names as keys and the corresponding\n        result objects or result data items as values.\n\n\n        :param fast_access:\n\n            Determines whether the result objects or their values are returned\n            in the dictionary. Works only for results if they contain a single item with\n            the name of the result.\n\n        :param copy:\n\n            Whether the original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n            Not Copying and fast access do not work at the same time! Raises ValueError\n            if fast access is true and copy false.\n\n        :return: Dictionary containing the results.\n\n        :raises: ValueError\n\n        \"\"\"\n        return arg_0._return_item_dictionary(arg_0._results, arg_1, arg_2)", "path": "pypet/trajectory.py", "identifier": "Trajectory.f_get_results", "docstring": "Returns a dictionary containing the full result names as keys and the corresponding\n        result objects or result data items as values.\n\n\n        :param fast_access:\n\n            Determines whether the result objects or their values are returned\n            in the dictionary. Works only for results if they contain a single item with\n            the name of the result.\n\n        :param copy:\n\n            Whether the original dictionary or a shallow copy is returned.\n            If you want the real dictionary please do not modify it at all!\n            Not Copying and fast access do not work at the same time! Raises ValueError\n            if fast access is true and copy false.\n\n        :return: Dictionary containing the results.\n\n        :raises: ValueError", "docstring_tokens": ["Returns", "a", "dictionary", "containing", "the", "full", "result", "names", "as", "keys", "and", "the", "corresponding", "result", "objects", "or", "result", "data", "items", "as", "values", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259802}
{"url": "https://github.com/sivel/happymongo/blob/05831465ef9b88210a67d00c35b37d7f114c6a63/happymongo/__init__.py#L33-L41", "sha": "05831465ef9b88210a67d00c35b37d7f114c6a63", "docstring_summary": "Flask like implementation of getting the applicaiton name via\n    the filename of the including file", "language": "python", "parameters": "()", "return_statement": "return os.path.splitext(os.path.basename(fn))[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "getattr", "(", "sys", ".", "modules", "[", "'__main__'", "]", ",", "'__file__'", ",", "None", ")", "if", "arg_0", "is", "None", ":", "return", "'__main__'", "return", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ")", "[", "0", "]"], "function": "def Func():\n    \"\"\"Flask like implementation of getting the applicaiton name via\n    the filename of the including file\n\n    \"\"\"\n    arg_0 = getattr(sys.modules['__main__'], '__file__', None)\n    if arg_0 is None:\n        return '__main__'\n    return os.path.splitext(os.path.basename(arg_0))[0]", "path": "happymongo/__init__.py", "identifier": "get_app_name", "docstring": "Flask like implementation of getting the applicaiton name via\n    the filename of the including file", "docstring_tokens": ["Flask", "like", "implementation", "of", "getting", "the", "applicaiton", "name", "via", "the", "filename", "of", "the", "including", "file"], "nwo": "sivel/happymongo", "score": 0.0, "idx": 259803}
{"url": "https://github.com/drager/django-simple-blog/blob/8f6575c485dc316bc908431fc8bddcae7624e050/simpleblog/views.py#L73-L87", "sha": "8f6575c485dc316bc908431fc8bddcae7624e050", "docstring_summary": "Returns a response with a template depending if the request is ajax \n        or not and it renders with the given context.", "language": "python", "parameters": "(self, context, **response_kwargs)", "return_statement": "return self.response_class(\n            request=self.request,\n            template=template,\n            context=context,\n            **response_kwargs\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_0", ".", "request", ".", "is_ajax", "(", ")", ":", "arg_3", "=", "arg_0", ".", "page_template", "else", ":", "arg_3", "=", "arg_0", ".", "get_template_names", "(", ")", "return", "arg_0", ".", "response_class", "(", "request", "=", "arg_0", ".", "request", ",", "arg_3", "=", "arg_3", ",", "arg_1", "=", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Returns a response with a template depending if the request is ajax \n        or not and it renders with the given context.\n        \"\"\"\n        if arg_0.request.is_ajax():\n            arg_3 = arg_0.page_template\n        else:\n            arg_3 = arg_0.get_template_names()\n        return arg_0.response_class(\n            request=arg_0.request,\n            arg_3=arg_3,\n            arg_1=arg_1,\n            **arg_2\n        )", "path": "simpleblog/views.py", "identifier": "BlogDetailView.render_to_response", "docstring": "Returns a response with a template depending if the request is ajax \n        or not and it renders with the given context.", "docstring_tokens": ["Returns", "a", "response", "with", "a", "template", "depending", "if", "the", "request", "is", "ajax", "or", "not", "and", "it", "renders", "with", "the", "given", "context", "."], "nwo": "drager/django-simple-blog", "score": 0.44119305395751424, "idx": 259804}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1138-L1143", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Reboots the server and waits for it to come back.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "warnings", ".", "warn", "(", "'Use self.run() instead.'", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "arg_0", ".", "reboot", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Reboots the server and waits for it to come back.\n        \"\"\"\n        warnings.warn('Use self.run() instead.', DeprecationWarning, stacklevel=2)\n        arg_0.reboot(*arg_1, **arg_2)", "path": "burlap/common.py", "identifier": "Satchel.reboot_or_dryrun", "docstring": "Reboots the server and waits for it to come back.", "docstring_tokens": ["Reboots", "the", "server", "and", "waits", "for", "it", "to", "come", "back", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259805}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/interface.py#L1334-L1371", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate surface tension of a liquid mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.", "language": "python", "parameters": "(self, T, P, zs, ws, method)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_5", "==", "SIMPLE", ":", "arg_6", "=", "[", "i", "(", "arg_1", ")", "for", "i", "in", "arg_0", ".", "SurfaceTensions", "]", "return", "mixing_simple", "(", "arg_3", ",", "arg_6", ")", "elif", "arg_5", "==", "DIGUILIOTEJA", ":", "return", "Diguilio_Teja", "(", "arg_1", "=", "arg_1", ",", "xs", "=", "arg_3", ",", "sigmas_Tb", "=", "arg_0", ".", "sigmas_Tb", ",", "Tbs", "=", "arg_0", ".", "Tbs", ",", "Tcs", "=", "arg_0", ".", "Tcs", ")", "elif", "arg_5", "==", "WINTERFELDSCRIVENDAVIS", ":", "arg_6", "=", "[", "i", "(", "arg_1", ")", "for", "i", "in", "arg_0", ".", "SurfaceTensions", "]", "arg_7", "=", "[", "1.", "/", "i", "(", "arg_1", ",", "arg_2", ")", "for", "i", "in", "arg_0", ".", "VolumeLiquids", "]", "return", "Winterfeld_Scriven_Davis", "(", "arg_3", ",", "arg_6", ",", "arg_7", ")", "else", ":", "raise", "Exception", "(", "'Method not valid'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        r'''Method to Func surface tension of a liquid mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to Func the property, [K]\n        P : float\n            Pressure at which to Func the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        sigma : float\n            Surface tension of the liquid at given conditions, [N/m]\n        '''\n        if arg_5 == SIMPLE:\n            arg_6 = [i(arg_1) for i in arg_0.SurfaceTensions]\n            return mixing_simple(arg_3, arg_6)\n        elif arg_5 == DIGUILIOTEJA:\n            return Diguilio_Teja(arg_1=arg_1, xs=arg_3, sigmas_Tb=arg_0.sigmas_Tb, \n                                 Tbs=arg_0.Tbs, Tcs=arg_0.Tcs)\n        elif arg_5 == WINTERFELDSCRIVENDAVIS:\n            arg_6 = [i(arg_1) for i in arg_0.SurfaceTensions]\n            arg_7 = [1./i(arg_1, arg_2) for i in arg_0.VolumeLiquids]\n            return Winterfeld_Scriven_Davis(arg_3, arg_6, arg_7)\n        else:\n            raise Exception('Method not valid')", "path": "thermo/interface.py", "identifier": "SurfaceTensionMixture.calculate", "docstring": "r'''Method to calculate surface tension of a liquid mixture at \n        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions\n        `ws` with a given method.\n\n        This method has no exception handling; see `mixture_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature at which to calculate the property, [K]\n        P : float\n            Pressure at which to calculate the property, [Pa]\n        zs : list[float]\n            Mole fractions of all species in the mixture, [-]\n        ws : list[float]\n            Weight fractions of all species in the mixture, [-]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        sigma : float\n            Surface tension of the liquid at given conditions, [N/m]", "docstring_tokens": ["r", "Method", "to", "calculate", "surface", "tension", "of", "a", "liquid", "mixture", "at", "temperature", "T", "pressure", "P", "mole", "fractions", "zs", "and", "weight", "fractions", "ws", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 259806}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/trainers/base.py#L293-L310", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Report the scores and record them in the log.", "language": "python", "parameters": "(self, score_map, type=\"valid\", epoch=-1, new_best=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"valid\"", ",", "arg_3", "=", "-", "1", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "arg_2", "if", "len", "(", "arg_5", ")", "<", "5", ":", "arg_5", "+=", "\" \"", "*", "(", "5", "-", "len", "(", "arg_5", ")", ")", "arg_6", "=", "\" \"", ".", "join", "(", "\"%s=%.2f\"", "%", "el", "for", "el", "in", "arg_1", ".", "items", "(", ")", ")", "arg_7", "=", "arg_3", "if", "arg_3", ">", "0", "else", "arg_0", ".", "current_epoch", "(", ")", "arg_8", "=", "\"epoch={}\"", ".", "format", "(", "arg_7", "+", "1", ")", "if", "arg_3", "<", "0", ":", "arg_8", "=", "\"dryrun\"", "sys", ".", "stdout", ".", "write", "(", "\"\\r\"", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "arg_9", "=", "\" *\"", "if", "arg_4", "else", "\"\"", "arg_10", "=", "\"{} ({}) {}{}\"", ".", "format", "(", "arg_5", ",", "arg_8", ",", "arg_6", ",", "arg_9", ")", "arg_0", ".", "network", ".", "train_logger", ".", "record", "(", "arg_10", ")", "logging", ".", "info", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2=\"valid\", arg_3=-1, arg_4=False):\n        \"\"\"\n        Report the scores and record them in the log.\n        \"\"\"\n        arg_5 = arg_2\n        if len(arg_5) < 5:\n            arg_5 += \" \" * (5 - len(arg_5))\n        arg_6 = \" \".join(\"%s=%.2f\" % el for el in arg_1.items())\n        arg_7 = arg_3 if arg_3 > 0 else arg_0.current_epoch()\n        arg_8 = \"epoch={}\".format(arg_7 + 1)\n        if arg_3 < 0:\n            arg_8 = \"dryrun\"\n            sys.stdout.write(\"\\r\")\n            sys.stdout.flush()\n        arg_9 = \" *\" if arg_4 else \"\"\n        arg_10 = \"{} ({}) {}{}\".format(arg_5, arg_8, arg_6, arg_9)\n        arg_0.network.train_logger.record(arg_10)\n        logging.info(arg_10)", "path": "deepy/trainers/base.py", "identifier": "NeuralTrainer.report", "docstring": "Report the scores and record them in the log.", "docstring_tokens": ["Report", "the", "scores", "and", "record", "them", "in", "the", "log", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 259807}
{"url": "https://github.com/salsita/flask-raml/blob/9876f19d49401fa32f7d852239aa295a78149ab2/setup.py#L86-L141", "sha": "9876f19d49401fa32f7d852239aa295a78149ab2", "docstring_summary": "Imports and returns a setup function.", "language": "python", "parameters": "(\n    dist='dist',\n    minver=None,\n    maxver=None,\n    use_markdown_readme=True,\n    use_stdeb=False,\n    use_distribute=False,\n    )", "return_statement": "return setup", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "'dist'", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", ")", ":", "if", "not", "arg_1", "==", "arg_2", "==", "None", ":", "import", "sys", "if", "not", "arg_1", "<=", "sys", ".", "version", "<", "(", "arg_2", "or", "'Any'", ")", ":", "sys", ".", "stderr", ".", "write", "(", "'%s: requires python version in <%s, %s), not %s\\n'", "%", "(", "sys", ".", "argv", "[", "0", "]", ",", "arg_1", "or", "'any'", ",", "arg_2", "or", "'any'", ",", "sys", ".", "version", ".", "split", "(", ")", "[", "0", "]", ")", ")", "sys", ".", "exit", "(", "1", ")", "if", "arg_5", ":", "from", "distribute_setup", "import", "use_setuptools", "use_setuptools", "(", "to_dir", "=", "arg_0", ")", "from", "arg_6", "import", "setup", "else", ":", "try", ":", "from", "arg_6", "import", "setup", "except", "ImportError", ":", "from", "distutils", ".", "core", "import", "setup", "if", "arg_3", ":", "try", ":", "import", "arg_6", ".", "command", ".", "sdist", "arg_6", ".", "command", ".", "sdist", ".", "READMES", "=", "tuple", "(", "list", "(", "getattr", "(", "arg_6", ".", "command", ".", "sdist", ",", "'READMES'", ",", "(", ")", ")", ")", "+", "[", "'README.md'", "]", ")", "except", "ImportError", ":", "pass", "if", "arg_4", ":", "import", "platform", "if", "'debian'", "in", "platform", ".", "dist", "(", ")", ":", "try", ":", "import", "stdeb", "except", "ImportError", ":", "pass", "return", "setup"], "function": "def Func(\n    arg_0='dist',\n    arg_1=None,\n    arg_2=None,\n    arg_3=True,\n    arg_4=False,\n    arg_5=False,\n    ):\n    \"\"\"Imports and returns a setup function.\n\n    If use_markdown_readme is set,\n    then README.md is added to setuptools READMES list.\n\n    If use_stdeb is set on a Debian based system,\n    then module stdeb is imported.\n    Stdeb supports building deb packages on Debian based systems.\n    The package should only be installed on the same system version\n    it was built on, though. See http://github.com/astraw/stdeb.\n\n    If use_distribute is set, then distribute_setup.py is imported.\n    \"\"\"\n    if not arg_1 == arg_2 == None:\n        import sys\n        if not arg_1 <= sys.version < (arg_2 or 'Any'):\n            sys.stderr.write(\n                '%s: requires python version in <%s, %s), not %s\\n' % (\n                sys.argv[0], arg_1 or 'any', arg_2 or 'any', sys.version.split()[0]))\n            sys.exit(1)\n\n    if arg_5:\n        from distribute_setup import use_setuptools\n        use_setuptools(to_dir=arg_0)\n        from arg_6 import setup\n    else:\n        try:\n            from arg_6 import setup\n        except ImportError:\n            from distutils.core import setup\n\n    if arg_3:\n        try:\n            import arg_6.command.sdist\n            arg_6.command.sdist.READMES = tuple(list(getattr(arg_6.command.sdist, 'READMES', ()))\n                + ['README.md'])\n        except ImportError:\n            pass\n\n    if arg_4:\n        import platform\n        if 'debian' in platform.dist():\n            try:\n                import stdeb\n            except ImportError:\n                pass\n\n    return setup", "path": "setup.py", "identifier": "init", "docstring": "Imports and returns a setup function.\n\n    If use_markdown_readme is set,\n    then README.md is added to setuptools READMES list.\n\n    If use_stdeb is set on a Debian based system,\n    then module stdeb is imported.\n    Stdeb supports building deb packages on Debian based systems.\n    The package should only be installed on the same system version\n    it was built on, though. See http://github.com/astraw/stdeb.\n\n    If use_distribute is set, then distribute_setup.py is imported.", "docstring_tokens": ["Imports", "and", "returns", "a", "setup", "function", "."], "nwo": "salsita/flask-raml", "score": 0.19553796588577346, "idx": 259808}
{"url": "https://github.com/carawarner/pantheon/blob/7e8718f4397eaa389fb3d5dc04fa01c7cb556512/pantheon/gods.py#L79-L88", "sha": "7e8718f4397eaa389fb3d5dc04fa01c7cb556512", "docstring_summary": "Produce two gametes, an egg and a sperm, from the input strings.\n        Combine them to produce a genome a la sexual reproduction.", "language": "python", "parameters": "(self, egg_word, sperm_word)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "generate_gamete", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "generate_gamete", "(", "arg_2", ")", "arg_0", ".", "genome", "=", "list", "(", "set", "(", "arg_3", "+", "arg_4", ")", ")", "arg_0", ".", "generation", "=", "1", "arg_0", ".", "divinity", "=", "god"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Produce two gametes, an egg and a sperm, from the input strings.\n        Combine them to produce a genome a la sexual reproduction.\n        \"\"\"\n        arg_3 = arg_0.generate_gamete(arg_1)\n        arg_4 = arg_0.generate_gamete(arg_2)\n\n        arg_0.genome = list(set(arg_3 + arg_4)) # Eliminate duplicates\n        arg_0.generation = 1\n        arg_0.divinity = god", "path": "pantheon/gods.py", "identifier": "God.reproduce_asexually", "docstring": "Produce two gametes, an egg and a sperm, from the input strings.\n        Combine them to produce a genome a la sexual reproduction.", "docstring_tokens": ["Produce", "two", "gametes", "an", "egg", "and", "a", "sperm", "from", "the", "input", "strings", ".", "Combine", "them", "to", "produce", "a", "genome", "a", "la", "sexual", "reproduction", "."], "nwo": "carawarner/pantheon", "score": 0.1924812072065873, "idx": 259809}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/__init__.py#L149-L185", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "Creates an archive from a directory and returns\n    the file that was created.", "language": "python", "parameters": "(directory, filename, config={}, ignore_predicate=None, ignored_files=['.git', '.svn'])", "return_statement": "return filename", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "{", "}", ",", "arg_3", "=", "None", ",", "arg_4", "=", "[", "'.git'", ",", "'.svn'", "]", ")", ":", "with", "zipfile", ".", "ZipFile", "(", "arg_1", ",", "'w'", ",", "compression", "=", "zipfile", ".", "ZIP_DEFLATED", ")", "as", "zip_file", ":", "arg_5", "=", "len", "(", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", ")", "out", "(", "\"Creating archive: \"", "+", "str", "(", "arg_1", ")", ")", "for", "arg_6", ",", "arg_7", ",", "arg_8", "in", "os", ".", "walk", "(", "arg_0", ",", "followlinks", "=", "True", ")", ":", "arg_9", "=", "os", ".", "path", ".", "abspath", "(", "arg_6", ")", "[", "arg_5", "+", "1", ":", "]", "for", "arg_10", "in", "arg_8", ":", "arg_11", "=", "os", ".", "path", ".", "join", "(", "arg_6", ",", "arg_10", ")", "arg_12", "=", "os", ".", "path", ".", "join", "(", "arg_9", ",", "arg_10", ")", "if", "arg_1", "in", "arg_11", ":", "continue", "if", "arg_4", "is", "not", "None", ":", "for", "arg_13", "in", "arg_4", ":", "if", "arg_11", ".", "endswith", "(", "arg_13", ")", ":", "out", "(", "\"Skipping: \"", "+", "str", "(", "arg_13", ")", ")", "continue", "if", "arg_3", "is", "not", "None", ":", "if", "not", "arg_3", "(", "arg_12", ")", ":", "out", "(", "\"Skipping: \"", "+", "str", "(", "arg_12", ")", ")", "continue", "out", "(", "\"Adding: \"", "+", "str", "(", "arg_12", ")", ")", "zip_file", ".", "write", "(", "arg_11", ",", "arg_12", ",", "zipfile", ".", "ZIP_DEFLATED", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2={}, arg_3=None, arg_4=['.git', '.svn']):\n    \"\"\"\n    Creates an archive from a directory and returns\n    the file that was created.\n    \"\"\"\n    with zipfile.ZipFile(arg_1, 'w', compression=zipfile.ZIP_DEFLATED) as zip_file:\n        arg_5 = len(os.path.abspath(arg_0))\n\n        # create it\n        out(\"Creating archive: \" + str(arg_1))\n        for arg_6, arg_7, arg_8 in os.walk(arg_0, followlinks=True):\n            arg_9 = os.path.abspath(arg_6)[arg_5 + 1:]\n            for arg_10 in arg_8:\n                arg_11 = os.path.join(arg_6, arg_10)\n                arg_12 = os.path.join(arg_9, arg_10)\n\n                # ignore the file we're creating\n                if arg_1 in arg_11:\n                    continue\n\n                # ignored files\n                if arg_4 is not None:\n                    for arg_13 in arg_4:\n                        if arg_11.endswith(arg_13):\n                            out(\"Skipping: \" + str(arg_13))\n                            continue\n\n                # do predicate\n                if arg_3 is not None:\n                    if not arg_3(arg_12):\n                        out(\"Skipping: \" + str(arg_12))\n                        continue\n\n                out(\"Adding: \" + str(arg_12))\n                zip_file.write(arg_11, arg_12, zipfile.ZIP_DEFLATED)\n\n    return arg_1", "path": "ebs_deploy/__init__.py", "identifier": "create_archive", "docstring": "Creates an archive from a directory and returns\n    the file that was created.", "docstring_tokens": ["Creates", "an", "archive", "from", "a", "directory", "and", "returns", "the", "file", "that", "was", "created", "."], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 259810}
{"url": "https://github.com/rkcosmos/deepcut/blob/9a2729071d01972af805acede85d7aa9e7a6da30/deepcut/deepcut.py#L146-L179", "sha": "9a2729071d01972af805acede85d7aa9e7a6da30", "docstring_summary": "Turn tokens into a tokens of n-grams", "language": "python", "parameters": "(self, tokens)", "return_statement": "return tokens", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "stop_words", "is", "not", "None", ":", "arg_1", "=", "[", "w", "for", "w", "in", "arg_1", "if", "w", "not", "in", "arg_0", ".", "stop_words", "]", "arg_2", ",", "arg_3", "=", "arg_0", ".", "ngram_range", "if", "arg_3", "!=", "1", ":", "arg_4", "=", "arg_1", "if", "arg_2", "==", "1", ":", "arg_1", "=", "list", "(", "arg_4", ")", "arg_2", "+=", "1", "else", ":", "arg_1", "=", "[", "]", "arg_5", "=", "len", "(", "arg_4", ")", "arg_6", "=", "arg_1", ".", "append", "arg_7", "=", "\" \"", ".", "join", "for", "arg_8", "in", "range", "(", "arg_2", ",", "min", "(", "arg_3", "+", "1", ",", "arg_5", "+", "1", ")", ")", ":", "for", "arg_9", "in", "range", "(", "arg_5", "-", "arg_8", "+", "1", ")", ":", "arg_6", "(", "arg_7", "(", "arg_4", "[", "arg_9", ":", "arg_9", "+", "arg_8", "]", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Turn tokens into a tokens of n-grams\n\n        ref: https://github.com/scikit-learn/scikit-learn/blob/ef5cb84a/sklearn/feature_extraction/text.py#L124-L153\n        \"\"\"\n        # handle stop words\n        if arg_0.stop_words is not None:\n            arg_1 = [w for w in arg_1 if w not in arg_0.stop_words]\n\n        # handle token n-grams\n        arg_2, arg_3 = arg_0.ngram_range\n        if arg_3 != 1:\n            arg_4 = arg_1\n            if arg_2 == 1:\n                # no need to do any slicing for unigrams\n                # just iterate through the original tokens\n                arg_1 = list(arg_4)\n                arg_2 += 1\n            else:\n                arg_1 = []\n\n            arg_5 = len(arg_4)\n\n            # bind method outside of loop to reduce overhead\n            arg_6 = arg_1.append\n            arg_7 = \" \".join\n\n            for arg_8 in range(arg_2,\n                           min(arg_3 + 1, arg_5 + 1)):\n                for arg_9 in range(arg_5 - arg_8 + 1):\n                    arg_6(arg_7(arg_4[arg_9: arg_9 + arg_8]))\n\n        return arg_1", "path": "deepcut/deepcut.py", "identifier": "DeepcutTokenizer._word_ngrams", "docstring": "Turn tokens into a tokens of n-grams\n\n        ref: https://github.com/scikit-learn/scikit-learn/blob/ef5cb84a/sklearn/feature_extraction/text.py#L124-L153", "docstring_tokens": ["Turn", "tokens", "into", "a", "tokens", "of", "n", "-", "grams"], "nwo": "rkcosmos/deepcut", "score": 0.6555269481755696, "idx": 259811}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/context/base.py#L109-L119", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Clear the window buffer", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "ctx", ".", "fbo", ".", "Func", "(", "red", "=", "arg_0", ".", "Func_color", "[", "0", "]", ",", "green", "=", "arg_0", ".", "Func_color", "[", "1", "]", ",", "blue", "=", "arg_0", ".", "Func_color", "[", "2", "]", ",", "alpha", "=", "arg_0", ".", "Func_color", "[", "3", "]", ",", "depth", "=", "arg_0", ".", "Func_depth", ",", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Clear the window buffer\n        \"\"\"\n        arg_0.ctx.fbo.Func(\n            red=arg_0.Func_color[0],\n            green=arg_0.Func_color[1],\n            blue=arg_0.Func_color[2],\n            alpha=arg_0.Func_color[3],\n            depth=arg_0.Func_depth,\n        )", "path": "demosys/context/base.py", "identifier": "BaseWindow.clear", "docstring": "Clear the window buffer", "docstring_tokens": ["Clear", "the", "window", "buffer"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 259812}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L31-L86", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return NumPy arrays from an input raster.", "language": "python", "parameters": "(\n    input_files,\n    tile,\n    indexes=None,\n    resampling=\"nearest\",\n    src_nodata=None,\n    dst_nodata=None,\n    gdal_opts=None\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "\"nearest\"", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "with", "rasterio", ".", "Env", "(", "**", "get_gdal_options", "(", "arg_6", ",", "is_remote", "=", "path_is_remote", "(", "arg_0", "[", "0", "]", "if", "isinstance", "(", "arg_0", ",", "list", ")", "else", "arg_0", ",", "s3", "=", "True", ")", ")", ")", "as", "env", ":", "logger", ".", "debug", "(", "\"reading %s with GDAL options %s\"", ",", "arg_0", ",", "env", ".", "options", ")", "return", "_Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(\n    arg_0,\n    arg_1,\n    arg_2=None,\n    arg_3=\"nearest\",\n    arg_4=None,\n    arg_5=None,\n    arg_6=None\n):\n    \"\"\"\n    Return NumPy arrays from an input raster.\n\n    NumPy arrays are reprojected and resampled to tile properties from input\n    raster. If tile boundaries cross the antimeridian, data on the other side\n    of the antimeridian will be read and concatenated to the numpy array\n    accordingly.\n\n    Parameters\n    ----------\n    input_files : string or list\n        path to a raster file or list of paths to multiple raster files readable by\n        rasterio.\n    tile : Tile\n        a Tile object\n    indexes : list or int\n        a list of band numbers; None will read all.\n    resampling : string\n        one of \"nearest\", \"average\", \"bilinear\" or \"lanczos\"\n    src_nodata : int or float, optional\n        if not set, the nodata value from the source dataset will be used\n    dst_nodata : int or float, optional\n        if not set, the nodata value from the source dataset will be used\n    gdal_opts : dict\n        GDAL options passed on to rasterio.Env()\n\n    Returns\n    -------\n    raster : MaskedArray\n    \"\"\"\n    with rasterio.Env(\n        **get_gdal_options(\n            arg_6,\n            is_remote=path_is_remote(\n                arg_0[0] if isinstance(arg_0, list) else arg_0, s3=True\n            )\n        )\n    ) as env:\n        logger.debug(\"reading %s with GDAL options %s\", arg_0, env.options)\n        return _Func(\n            arg_0,\n            arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5\n        )", "path": "mapchete/io/raster.py", "identifier": "read_raster_window", "docstring": "Return NumPy arrays from an input raster.\n\n    NumPy arrays are reprojected and resampled to tile properties from input\n    raster. If tile boundaries cross the antimeridian, data on the other side\n    of the antimeridian will be read and concatenated to the numpy array\n    accordingly.\n\n    Parameters\n    ----------\n    input_files : string or list\n        path to a raster file or list of paths to multiple raster files readable by\n        rasterio.\n    tile : Tile\n        a Tile object\n    indexes : list or int\n        a list of band numbers; None will read all.\n    resampling : string\n        one of \"nearest\", \"average\", \"bilinear\" or \"lanczos\"\n    src_nodata : int or float, optional\n        if not set, the nodata value from the source dataset will be used\n    dst_nodata : int or float, optional\n        if not set, the nodata value from the source dataset will be used\n    gdal_opts : dict\n        GDAL options passed on to rasterio.Env()\n\n    Returns\n    -------\n    raster : MaskedArray", "docstring_tokens": ["Return", "NumPy", "arrays", "from", "an", "input", "raster", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 259813}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L2997-L3051", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Encrypts a value using an RSA public key via CryptoAPI", "language": "python", "parameters": "(certificate_or_public_key, data, rsa_oaep_padding=False)", "return_statement": "return bytes_from_buffer(buffer, deref(out_len))[::-1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "0", "if", "arg_2", ":", "arg_3", "=", "Advapi32Const", ".", "CRYPT_OAEP", "arg_4", "=", "new", "(", "advapi32", ",", "'DWORD *'", ",", "len", "(", "arg_1", ")", ")", "arg_5", "=", "advapi32", ".", "CryptEncrypt", "(", "arg_0", ".", "ex_key_handle", ",", "null", "(", ")", ",", "True", ",", "arg_3", ",", "null", "(", ")", ",", "arg_4", ",", "0", ")", "handle_error", "(", "arg_5", ")", "arg_6", "=", "deref", "(", "arg_4", ")", "arg_7", "=", "buffer_from_bytes", "(", "arg_6", ")", "write_to_buffer", "(", "arg_7", ",", "arg_1", ")", "pointer_set", "(", "arg_4", ",", "len", "(", "arg_1", ")", ")", "arg_5", "=", "advapi32", ".", "CryptEncrypt", "(", "arg_0", ".", "ex_key_handle", ",", "null", "(", ")", ",", "True", ",", "arg_3", ",", "arg_7", ",", "arg_4", ",", "arg_6", ")", "handle_error", "(", "arg_5", ")", "return", "bytes_from_buffer", "(", "arg_7", ",", "deref", "(", "arg_4", ")", ")", "[", ":", ":", "-", "1", "]"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"\n    Encrypts a value using an RSA public key via CryptoAPI\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to encrypt with\n\n    :param data:\n        A byte string of the data to encrypt\n\n    :param rsa_oaep_padding:\n        If OAEP padding should be used instead of PKCS#1 v1.5\n\n    :raises:\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A byte string of the ciphertext\n    \"\"\"\n\n    arg_3 = 0\n    if arg_2:\n        arg_3 = Advapi32Const.CRYPT_OAEP\n\n    arg_4 = new(advapi32, 'DWORD *', len(arg_1))\n    arg_5 = advapi32.CryptEncrypt(\n        arg_0.ex_key_handle,\n        null(),\n        True,\n        arg_3,\n        null(),\n        arg_4,\n        0\n    )\n    handle_error(arg_5)\n\n    arg_6 = deref(arg_4)\n    arg_7 = buffer_from_bytes(arg_6)\n    write_to_buffer(arg_7, arg_1)\n\n    pointer_set(arg_4, len(arg_1))\n    arg_5 = advapi32.CryptEncrypt(\n        arg_0.ex_key_handle,\n        null(),\n        True,\n        arg_3,\n        arg_7,\n        arg_4,\n        arg_6\n    )\n    handle_error(arg_5)\n\n    return bytes_from_buffer(arg_7, deref(arg_4))[::-1]", "path": "oscrypto/_win/asymmetric.py", "identifier": "_advapi32_encrypt", "docstring": "Encrypts a value using an RSA public key via CryptoAPI\n\n    :param certificate_or_public_key:\n        A Certificate or PublicKey instance to encrypt with\n\n    :param data:\n        A byte string of the data to encrypt\n\n    :param rsa_oaep_padding:\n        If OAEP padding should be used instead of PKCS#1 v1.5\n\n    :raises:\n        ValueError - when any of the parameters contain an invalid value\n        TypeError - when any of the parameters are of the wrong type\n        OSError - when an error is returned by the OS crypto library\n\n    :return:\n        A byte string of the ciphertext", "docstring_tokens": ["Encrypts", "a", "value", "using", "an", "RSA", "public", "key", "via", "CryptoAPI"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 259814}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L1020-L1043", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Wrapper method that calls the appropriate main updating methods of\n        the inspection.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "log_parser", "(", ")", "except", "(", "FileNotFoundError", ",", "StopIteration", ")", "as", "e", ":", "logger", ".", "debug", "(", "\"ERROR: \"", "+", "str", "(", "sys", ".", "exc_info", "(", ")", "[", "0", "]", ")", ")", "arg_0", ".", "log_retry", "+=", "1", "if", "arg_0", ".", "log_retry", "==", "arg_0", ".", "MAX_RETRIES", ":", "raise", "e", "try", ":", "arg_0", ".", "trace_parser", "(", ")", "except", "(", "FileNotFoundError", ",", "StopIteration", ")", "as", "e", ":", "logger", ".", "debug", "(", "\"ERROR: \"", "+", "str", "(", "sys", ".", "exc_info", "(", ")", "[", "0", "]", ")", ")", "arg_0", ".", "trace_retry", "+=", "1", "if", "arg_0", ".", "trace_retry", "==", "arg_0", ".", "MAX_RETRIES", ":", "raise", "e"], "function": "def Func(arg_0):\n        \"\"\"Wrapper method that calls the appropriate main updating methods of\n        the inspection.\n\n        It is meant to be used inside a loop (like while), so that it can\n        continuously update the class attributes from the trace and log files.\n        It already implements checks to parse these files only when they\n        change, and they ignore entries that have been previously processes.\n        \"\"\"\n\n        try:\n            arg_0.log_parser()\n        except (FileNotFoundError, StopIteration) as e:\n            logger.debug(\"ERROR: \" + str(sys.exc_info()[0]))\n            arg_0.log_retry += 1\n            if arg_0.log_retry == arg_0.MAX_RETRIES:\n                raise e\n        try:\n            arg_0.trace_parser()\n        except (FileNotFoundError, StopIteration) as e:\n            logger.debug(\"ERROR: \" + str(sys.exc_info()[0]))\n            arg_0.trace_retry += 1\n            if arg_0.trace_retry == arg_0.MAX_RETRIES:\n                raise e", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector.update_inspection", "docstring": "Wrapper method that calls the appropriate main updating methods of\n        the inspection.\n\n        It is meant to be used inside a loop (like while), so that it can\n        continuously update the class attributes from the trace and log files.\n        It already implements checks to parse these files only when they\n        change, and they ignore entries that have been previously processes.", "docstring_tokens": ["Wrapper", "method", "that", "calls", "the", "appropriate", "main", "updating", "methods", "of", "the", "inspection", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 259815}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/datastructures/base.py#L151-L172", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Save an image to self.storage at `save_path`.", "language": "python", "parameters": "(self, imagefile, save_path, file_ext, mime_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "InMemoryUploadedFile", "(", "arg_1", ",", "None", ",", "'foo.%s'", "%", "arg_3", ",", "arg_4", ",", "arg_1", ".", "tell", "(", ")", ",", "None", ")", "arg_5", ".", "seek", "(", "0", ")", "arg_0", ".", "storage", ".", "save", "(", "arg_2", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"\n        Save an image to self.storage at `save_path`.\n\n        Arguments:\n            `imagefile`: Raw image data, typically a BytesIO instance.\n            `save_path`: The path within self.storage where the image should\n                         be saved.\n            `file_ext`: The file extension of the image-to-be-saved.\n            `mime_type`: A valid image mime type (as found in\n                         versatileimagefield.utils)\n        \"\"\"\n        arg_5 = InMemoryUploadedFile(\n            arg_1,\n            None,\n            'foo.%s' % arg_3,\n            arg_4,\n            arg_1.tell(),\n            None\n        )\n        arg_5.seek(0)\n        arg_0.storage.save(arg_2, arg_5)", "path": "versatileimagefield/datastructures/base.py", "identifier": "ProcessedImage.save_image", "docstring": "Save an image to self.storage at `save_path`.\n\n        Arguments:\n            `imagefile`: Raw image data, typically a BytesIO instance.\n            `save_path`: The path within self.storage where the image should\n                         be saved.\n            `file_ext`: The file extension of the image-to-be-saved.\n            `mime_type`: A valid image mime type (as found in\n                         versatileimagefield.utils)", "docstring_tokens": ["Save", "an", "image", "to", "self", ".", "storage", "at", "save_path", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 259816}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/_libcrypto.py#L88-L101", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Peeks into the error stack and pulls out the lib, func and reason", "language": "python", "parameters": "()", "return_statement": "return (lib, func, reason)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "libcrypto", ".", "ERR_peek_error", "(", ")", "arg_1", "=", "int", "(", "(", "arg_0", ">>", "24", ")", "&", "0xff", ")", "arg_2", "=", "int", "(", "(", "arg_0", ">>", "12", ")", "&", "0xfff", ")", "arg_3", "=", "int", "(", "arg_0", "&", "0xfff", ")", "return", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func():\n    \"\"\"\n    Peeks into the error stack and pulls out the lib, func and reason\n\n    :return:\n        A three-element tuple of integers (lib, func, reason)\n    \"\"\"\n\n    arg_0 = libcrypto.ERR_peek_error()\n    arg_1 = int((arg_0 >> 24) & 0xff)\n    arg_2 = int((arg_0 >> 12) & 0xfff)\n    arg_3 = int(arg_0 & 0xfff)\n\n    return (arg_1, arg_2, arg_3)", "path": "oscrypto/_openssl/_libcrypto.py", "identifier": "peek_openssl_error", "docstring": "Peeks into the error stack and pulls out the lib, func and reason\n\n    :return:\n        A three-element tuple of integers (lib, func, reason)", "docstring_tokens": ["Peeks", "into", "the", "error", "stack", "and", "pulls", "out", "the", "lib", "func", "and", "reason"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 259817}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/util.py#L24-L32", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Assert that there is exactly one node in the give list, and return it.", "language": "python", "parameters": "(nodes, or_none=False)", "return_statement": "return nodes[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "not", "arg_0", "and", "arg_1", ":", "return", "NFunc", "assert", "len", "(", "arg_0", ")", "==", "1", ",", "'Expected 1 result. Received %d results.'", "%", "(", "len", "(", "arg_0", ")", ")", "return", "arg_0", "[", "0", "]"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Assert that there is exactly Func node in the give list, and return it.\n    \"\"\"\n    if not arg_0 and arg_1:\n        return NFunc\n    assert len(\n        arg_0) == 1, 'Expected 1 result. Received %d results.' % (len(arg_0))\n    return arg_0[0]", "path": "SpiffWorkflow/bpmn/parser/util.py", "identifier": "one", "docstring": "Assert that there is exactly one node in the give list, and return it.", "docstring_tokens": ["Assert", "that", "there", "is", "exactly", "one", "node", "in", "the", "give", "list", "and", "return", "it", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 259818}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/user.py#L38-L51", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Adds a user object to the user manager", "language": "python", "parameters": "(self, user)", "return_statement": "return user", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"Loading user information for %s/%s\"", ",", "arg_1", ".", "id", ",", "arg_1", ".", "username", ")", "arg_0", ".", "load_user_info", "(", "arg_1", ")", "arg_0", ".", "log", ".", "info", "(", "\"Loading user rights for %s/%s\"", ",", "arg_1", ".", "id", ",", "arg_1", ".", "username", ")", "arg_0", ".", "load_user_rights", "(", "arg_1", ")", "arg_0", ".", "log", ".", "info", "(", "\"Added user: %s/%s\"", ",", "arg_1", ".", "id", ",", "arg_1", ".", "username", ")", "arg_0", ".", "_add_user_to_cache", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adds a user object to the user manager\n\n        user - a SlackUser object\n        \"\"\"\n\n        arg_0.log.info(\"Loading user information for %s/%s\", arg_1.id, arg_1.username)\n        arg_0.load_user_info(arg_1)\n        arg_0.log.info(\"Loading user rights for %s/%s\", arg_1.id, arg_1.username)\n        arg_0.load_user_rights(arg_1)\n        arg_0.log.info(\"Added user: %s/%s\", arg_1.id, arg_1.username)\n        arg_0._add_user_to_cache(arg_1)\n        return arg_1", "path": "slackminion/plugins/core/user.py", "identifier": "UserManager.set", "docstring": "Adds a user object to the user manager\n\n        user - a SlackUser object", "docstring_tokens": ["Adds", "a", "user", "object", "to", "the", "user", "manager"], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 259819}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L1607-L1639", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Backs up a trajectory.", "language": "python", "parameters": "(self, traj, backup_filename=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "_logger", ".", "info", "(", "'Storing backup of %s.'", "%", "arg_1", ".", "v_name", ")", "arg_3", ",", "arg_4", "=", "os", ".", "path", ".", "split", "(", "arg_0", ".", "_filename", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "'%s'", "%", "arg_3", ",", "'backup_%s.hdf5'", "%", "arg_1", ".", "v_name", ")", "arg_5", "=", "pt", ".", "open_file", "(", "filename", "=", "arg_2", ",", "mode", "=", "'a'", ",", "title", "=", "arg_2", ")", "if", "'/'", "+", "arg_0", ".", "_trajectory_name", "in", "arg_5", ":", "raise", "ValueError", "(", "'I cannot backup  `%s` into file `%s`, there is already a '", "'trajectory with that name.'", "%", "(", "arg_1", ".", "v_name", ",", "arg_2", ")", ")", "arg_6", "=", "arg_5", ".", "root", "arg_0", ".", "_trajectory_group", ".", "_f_copy", "(", "newparent", "=", "arg_6", ",", "recursive", "=", "True", ")", "arg_5", ".", "flush", "(", ")", "arg_5", ".", "close", "(", ")", "arg_0", ".", "_logger", ".", "info", "(", "'Finished backup of %s.'", "%", "arg_1", ".", "v_name", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Backs up a trajectory.\n\n        :param traj: Trajectory that should be backed up\n\n        :param backup_filename:\n\n            Path and filename of backup file. If None is specified the storage service\n            defaults to `path_to_trajectory_hdf5_file/backup_trajectory_name.hdf`.\n\n        \"\"\"\n        arg_0._logger.info('Storing backup of %s.' % arg_1.v_name)\n\n        arg_3, arg_4 = os.path.split(arg_0._filename)\n\n        if arg_2 is None:\n            arg_2 = os.path.join('%s' % arg_3, 'backup_%s.hdf5' % arg_1.v_name)\n\n        arg_5 = pt.open_file(filename=arg_2,\n                                             mode='a', title=arg_2)\n\n        if '/' + arg_0._trajectory_name in arg_5:\n            raise ValueError('I cannot backup  `%s` into file `%s`, there is already a '\n                             'trajectory with that name.' % (arg_1.v_name, arg_2))\n\n        arg_6 = arg_5.root\n\n        arg_0._trajectory_group._f_copy(newparent=arg_6, recursive=True)\n\n        arg_5.flush()\n        arg_5.close()\n\n        arg_0._logger.info('Finished backup of %s.' % arg_1.v_name)", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._trj_backup_trajectory", "docstring": "Backs up a trajectory.\n\n        :param traj: Trajectory that should be backed up\n\n        :param backup_filename:\n\n            Path and filename of backup file. If None is specified the storage service\n            defaults to `path_to_trajectory_hdf5_file/backup_trajectory_name.hdf`.", "docstring_tokens": ["Backs", "up", "a", "trajectory", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259820}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L364-L378", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Like os.makedirs but takes care about race conditions", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "raise", "IOError", "(", "'Path `%s` is already a file not a directory'", ")", "while", "True", ":", "try", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "break", "os", ".", "makedirs", "(", "arg_0", ")", "except", "EnvironmentError", "as", "exc", ":", "if", "exc", ".", "errno", "!=", "17", ":", "raise"], "function": "def Func(arg_0):\n    \"\"\"Like os.makedirs but takes care about race conditions\"\"\"\n    if os.path.isfile(arg_0):\n        raise IOError('Path `%s` is already a file not a directory')\n    while True:\n        try:\n            if os.path.isdir(arg_0):\n                # only break if full path has been created or exists\n                break\n            os.makedirs(arg_0)\n        except EnvironmentError as exc:\n            # Part of the directory path already exist\n            if exc.errno != 17:\n                # This error won't be any good\n                raise", "path": "pypet/utils/helpful_functions.py", "identifier": "racedirs", "docstring": "Like os.makedirs but takes care about race conditions", "docstring_tokens": ["Like", "os", ".", "makedirs", "but", "takes", "care", "about", "race", "conditions"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 259821}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L552-L569", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check that a Starred expression is used in an assignment target.", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ".", "parent", ",", "astroid", ".", "Call", ")", ":", "return", "if", "PY35", "and", "isinstance", "(", "arg_1", ".", "parent", ",", "(", "astroid", ".", "List", ",", "astroid", ".", "Tuple", ",", "astroid", ".", "Set", ",", "astroid", ".", "Dict", ")", ")", ":", "return", "arg_2", "=", "arg_1", ".", "statement", "(", ")", "if", "not", "isinstance", "(", "arg_2", ",", "astroid", ".", "Assign", ")", ":", "return", "if", "arg_2", ".", "value", "is", "arg_1", "or", "arg_2", ".", "value", ".", "parent_of", "(", "arg_1", ")", ":", "arg_0", ".", "add_message", "(", "\"star-needs-assignment-target\"", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check that a Starred expression is used in an assignment target.\"\"\"\n        if isinstance(arg_1.parent, astroid.Call):\n            # f(*args) is converted to Call(args=[Starred]), so ignore\n            # them for this check.\n            return\n        if PY35 and isinstance(\n            arg_1.parent, (astroid.List, astroid.Tuple, astroid.Set, astroid.Dict)\n        ):\n            # PEP 448 unpacking.\n            return\n\n        arg_2 = arg_1.statement()\n        if not isinstance(arg_2, astroid.Assign):\n            return\n\n        if arg_2.value is arg_1 or arg_2.value.parent_of(arg_1):\n            arg_0.add_message(\"star-needs-assignment-target\", arg_1=arg_1)", "path": "pylint/checkers/base.py", "identifier": "BasicErrorChecker.visit_starred", "docstring": "Check that a Starred expression is used in an assignment target.", "docstring_tokens": ["Check", "that", "a", "Starred", "expression", "is", "used", "in", "an", "assignment", "target", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 259822}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/coordinates.py#L48-L76", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return the length of a variant", "language": "python", "parameters": "(alt_len, ref_len, category, pos, end, svtype=None, svlen=None)", "return_statement": "return length", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "-", "1", "if", "arg_2", "in", "(", "'snv'", ",", "'indel'", ",", "'cancer'", ")", ":", "if", "arg_1", "==", "arg_0", ":", "arg_7", "=", "arg_0", "else", ":", "arg_7", "=", "abs", "(", "arg_1", "-", "arg_0", ")", "elif", "arg_2", "==", "'sv'", ":", "if", "arg_5", "==", "'bnd'", ":", "arg_7", "=", "int", "(", "10e10", ")", "else", ":", "if", "arg_6", ":", "arg_7", "=", "abs", "(", "int", "(", "arg_6", ")", ")", "elif", "arg_4", ":", "if", "arg_4", "!=", "arg_3", ":", "arg_7", "=", "arg_4", "-", "arg_3", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=None):\n    \"\"\"Return the length of a variant\n\n    Args:\n        alt_len(int)\n        ref_len(int)\n        category(str)\n        svtype(str)\n        svlen(int)\n    \"\"\"\n    # -1 would indicate uncertain length\n    arg_7 = -1\n    if arg_2 in ('snv', 'indel', 'cancer'):\n        if arg_1 == arg_0:\n            arg_7 = arg_0\n        else:\n            arg_7 = abs(arg_1 - arg_0)\n\n    elif arg_2 == 'sv':\n        if arg_5 == 'bnd':\n            arg_7 = int(10e10)\n        else:\n            if arg_6:\n                arg_7 = abs(int(arg_6))\n            # Some software does not give a length but they give END\n            elif arg_4:\n                if arg_4 != arg_3:\n                    arg_7 = arg_4 - arg_3\n    return arg_7", "path": "scout/parse/variant/coordinates.py", "identifier": "get_length", "docstring": "Return the length of a variant\n\n    Args:\n        alt_len(int)\n        ref_len(int)\n        category(str)\n        svtype(str)\n        svlen(int)", "docstring_tokens": ["Return", "the", "length", "of", "a", "variant"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259823}
{"url": "https://github.com/myint/untokenize/blob/137ae8b8ec03e94444325172451ba2104c8ee05e/untokenize.py#L36-L82", "sha": "137ae8b8ec03e94444325172451ba2104c8ee05e", "docstring_summary": "Return source code based on tokens.", "language": "python", "parameters": "(tokens)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "arg_2", "=", "''", "arg_3", "=", "0", "arg_4", "=", "-", "1", "arg_5", "=", "None", "for", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", "in", "arg_0", ":", "if", "TOKENIZE_HAS_ENCODING", "and", "arg_6", "==", "tokenize", ".", "ENCODING", ":", "continue", "(", "arg_11", ",", "arg_12", ")", "=", "arg_8", "(", "arg_13", ",", "arg_14", ")", "=", "arg_9", "if", "(", "arg_5", "!=", "tokenize", ".", "COMMENT", "and", "arg_11", ">", "arg_3", "and", "arg_2", ".", "endswith", "(", "(", "'\\\\\\n'", ",", "'\\\\\\r\\n'", ",", "'\\\\\\r'", ")", ")", ")", ":", "arg_1", "+=", "arg_2", "[", "len", "(", "arg_2", ".", "rstrip", "(", "' \\t\\n\\r\\\\'", ")", ")", ":", "]", "if", "arg_11", ">", "arg_3", ":", "arg_4", "=", "0", "if", "arg_12", ">", "arg_4", ":", "arg_1", "+=", "arg_10", "[", "arg_4", ":", "arg_12", "]", "arg_1", "+=", "arg_7", "arg_2", "=", "arg_10", "arg_3", "=", "arg_13", "arg_4", "=", "arg_14", "if", "arg_6", "not", "in", "WHITESPACE_TOKENS", ":", "arg_5", "=", "arg_6", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return source code based on tokens.\n\n    This is like tokenize.Func(), but it preserves spacing between\n    tokens. So if the original soure code had multiple spaces between\n    some tokens or if escaped newlines were used, those things will be\n    reflected by Func().\n\n    \"\"\"\n    arg_1 = ''\n    arg_2 = ''\n    arg_3 = 0\n    arg_4 = -1\n    arg_5 = None\n\n    for (arg_6, arg_7, arg_8, arg_9, arg_10) in arg_0:\n        if TOKENIZE_HAS_ENCODING and arg_6 == tokenize.ENCODING:\n            continue\n\n        (arg_11, arg_12) = arg_8\n        (arg_13, arg_14) = arg_9\n\n        # Preserve escaped newlines.\n        if (\n            arg_5 != tokenize.COMMENT and\n            arg_11 > arg_3 and\n            arg_2.endswith(('\\\\\\n', '\\\\\\r\\n', '\\\\\\r'))\n        ):\n            arg_1 += arg_2[len(arg_2.rstrip(' \\t\\n\\r\\\\')):]\n\n        # Preserve spacing.\n        if arg_11 > arg_3:\n            arg_4 = 0\n        if arg_12 > arg_4:\n            arg_1 += arg_10[arg_4:arg_12]\n\n        arg_1 += arg_7\n\n        arg_2 = arg_10\n\n        arg_3 = arg_13\n        arg_4 = arg_14\n\n        if arg_6 not in WHITESPACE_TOKENS:\n            arg_5 = arg_6\n\n    return arg_1", "path": "untokenize.py", "identifier": "untokenize", "docstring": "Return source code based on tokens.\n\n    This is like tokenize.untokenize(), but it preserves spacing between\n    tokens. So if the original soure code had multiple spaces between\n    some tokens or if escaped newlines were used, those things will be\n    reflected by untokenize().", "docstring_tokens": ["Return", "source", "code", "based", "on", "tokens", "."], "nwo": "myint/untokenize", "score": 0.1802640598604426, "idx": 259824}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/initializer.py#L176-L233", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a recursive implementation of a multiplexor circuit,\n        where each instruction itself has a decomposition based on\n        smaller multiplexors.", "language": "python", "parameters": "(self, target_gate, list_of_angles)", "return_statement": "return circuit", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "len", "(", "arg_2", ")", "arg_4", "=", "int", "(", "math", ".", "log2", "(", "arg_3", ")", ")", "+", "1", "arg_5", "=", "QuantumRegister", "(", "arg_4", ")", "arg_6", "=", "QuantumCircuit", "(", "arg_5", ",", "name", "=", "\"multiplex\"", "+", "arg_4", ".", "__str__", "(", ")", ")", "arg_7", "=", "arg_5", "[", "0", "]", "arg_8", "=", "arg_5", "[", "arg_4", "-", "1", "]", "if", "arg_4", "==", "1", ":", "arg_6", ".", "append", "(", "arg_1", "(", "arg_2", "[", "0", "]", ")", ",", "[", "arg_5", "[", "0", "]", "]", ")", "return", "arg_6", "arg_9", "=", "scipy", ".", "kron", "(", "[", "[", "0.5", ",", "0.5", "]", ",", "[", "0.5", ",", "-", "0.5", "]", "]", ",", "np", ".", "identity", "(", "2", "**", "(", "arg_4", "-", "2", ")", ")", ")", "arg_2", "=", "arg_9", ".", "dot", "(", "np", ".", "array", "(", "arg_2", ")", ")", ".", "tolist", "(", ")", "arg_10", "=", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_2", "[", "0", ":", "(", "arg_3", "//", "2", ")", "]", ")", "arg_6", ".", "append", "(", "arg_10", ".", "to_instruction", "(", ")", ",", "arg_5", "[", "0", ":", "-", "1", "]", ")", "arg_6", ".", "append", "(", "CnotGate", "(", ")", ",", "[", "arg_8", ",", "arg_7", "]", ")", "arg_11", "=", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_2", "[", "(", "arg_3", "//", "2", ")", ":", "]", ")", "if", "arg_3", ">", "1", ":", "arg_6", ".", "append", "(", "arg_11", ".", "to_instruction", "(", ")", ".", "mirror", "(", ")", ",", "arg_5", "[", "0", ":", "-", "1", "]", ")", "else", ":", "arg_6", ".", "append", "(", "arg_11", ".", "to_instruction", "(", ")", ",", "arg_5", "[", "0", ":", "-", "1", "]", ")", "arg_6", ".", "append", "(", "CnotGate", "(", ")", ",", "[", "arg_8", ",", "arg_7", "]", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Return a recursive implementation of a multiplexor circuit,\n        where each instruction itself has a decomposition based on\n        smaller multiplexors.\n\n        The LSB is the multiplexor \"data\" and the other bits are multiplexor \"select\".\n\n        Args:\n            target_gate (Gate): Ry or Rz gate to apply to target qubit, multiplexed\n                over all other \"select\" qubits\n            list_of_angles (list[float]): list of rotation angles to apply Ry and Rz\n\n        Returns:\n            DAGCircuit: the circuit implementing the multiplexor's action\n        \"\"\"\n        arg_3 = len(arg_2)\n        arg_4 = int(math.log2(arg_3)) + 1\n\n        arg_5 = QuantumRegister(arg_4)\n        arg_6 = QuantumCircuit(arg_5, name=\"multiplex\" + arg_4.__str__())\n\n        arg_7 = arg_5[0]\n        arg_8 = arg_5[arg_4 - 1]\n\n        # case of no multiplexing: base case for recursion\n        if arg_4 == 1:\n            arg_6.append(arg_1(arg_2[0]), [arg_5[0]])\n            return arg_6\n\n        # calc angle weights, assuming recursion (that is the lower-level\n        # requested angles have been correctly implemented by recursion\n        arg_9 = scipy.kron([[0.5, 0.5], [0.5, -0.5]],\n                                  np.identity(2 ** (arg_4 - 2)))\n\n        # calc the combo angles\n        arg_2 = arg_9.dot(np.array(arg_2)).tolist()\n\n        # recursive step on half the angles fulfilling the above assumption\n        arg_10 = arg_0.Func(arg_1, arg_2[0:(arg_3 // 2)])\n        arg_6.append(arg_10.to_instruction(), arg_5[0:-1])\n\n        # attach CNOT as follows, thereby flipping the LSB qubit\n        arg_6.append(CnotGate(), [arg_8, arg_7])\n\n        # implement extra efficiency from the paper of cancelling adjacent\n        # CNOTs (by leaving out last CNOT and reversing (NOT inverting) the\n        # second lower-level multiplex)\n        arg_11 = arg_0.Func(arg_1, arg_2[(arg_3 // 2):])\n        if arg_3 > 1:\n            arg_6.append(arg_11.to_instruction().mirror(), arg_5[0:-1])\n        else:\n            arg_6.append(arg_11.to_instruction(), arg_5[0:-1])\n\n        # attach a final CNOT\n        arg_6.append(CnotGate(), [arg_8, arg_7])\n\n        return arg_6", "path": "qiskit/extensions/initializer.py", "identifier": "Initialize._multiplex", "docstring": "Return a recursive implementation of a multiplexor circuit,\n        where each instruction itself has a decomposition based on\n        smaller multiplexors.\n\n        The LSB is the multiplexor \"data\" and the other bits are multiplexor \"select\".\n\n        Args:\n            target_gate (Gate): Ry or Rz gate to apply to target qubit, multiplexed\n                over all other \"select\" qubits\n            list_of_angles (list[float]): list of rotation angles to apply Ry and Rz\n\n        Returns:\n            DAGCircuit: the circuit implementing the multiplexor's action", "docstring_tokens": ["Return", "a", "recursive", "implementation", "of", "a", "multiplexor", "circuit", "where", "each", "instruction", "itself", "has", "a", "decomposition", "based", "on", "smaller", "multiplexors", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259825}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L663-L682", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Parses arguments.", "language": "python", "parameters": "(parser, config_files=[], ignore_unknown=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ",", "arg_2", "=", "False", ")", ":", "global", "arg_5", "arg_3", "=", "sys", ".", "argv", "[", "1", ":", "]", "for", "arg_4", "in", "filter", "(", "os", ".", "path", ".", "isfile", ",", "arg_1", ")", ":", "arg_3", ".", "insert", "(", "0", ",", "\"@\"", "+", "arg_4", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "parse_known_args", "(", "arg_3", ")", "if", "arg_6", "and", "not", "arg_2", ":", "arg_7", "=", "gettext", "(", "'unrecognized arguments: %s'", ")", "arg_0", ".", "error", "(", "arg_7", "%", "' '", ".", "join", "(", "arg_6", ")", ")", "if", "arg_5", ".", "stream", ":", "arg_5", ".", "stream", "=", "[", "arg_8", ".", "lower", "(", ")", "for", "arg_8", "in", "arg_5", ".", "stream", "]", "if", "not", "arg_5", ".", "url", "and", "arg_5", ".", "url_param", ":", "arg_5", ".", "url", "=", "arg_5", ".", "url_param"], "function": "def Func(arg_0, arg_1=[], arg_2=False):\n    \"\"\"Parses arguments.\"\"\"\n    global arg_5\n    arg_3 = sys.argv[1:]\n\n    # Load arguments from config files\n    for arg_4 in filter(os.path.isfile, arg_1):\n        arg_3.insert(0, \"@\" + arg_4)\n\n    arg_5, arg_6 = arg_0.parse_known_args(arg_3)\n    if arg_6 and not arg_2:\n        arg_7 = gettext('unrecognized arguments: %s')\n        arg_0.error(arg_7 % ' '.join(arg_6))\n\n    # Force lowercase to allow case-insensitive lookup\n    if arg_5.stream:\n        arg_5.stream = [arg_8.lower() for arg_8 in arg_5.stream]\n\n    if not arg_5.url and arg_5.url_param:\n        arg_5.url = arg_5.url_param", "path": "src/streamlink_cli/main.py", "identifier": "setup_args", "docstring": "Parses arguments.", "docstring_tokens": ["Parses", "arguments", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 259826}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/vcard.py#L60-L98", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Encodes a vCard field into an RFC2425 line.", "language": "python", "parameters": "(name,value,parameters=None,charset=\"utf-8\")", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "\"utf-8\"", ")", ":", "if", "not", "arg_2", ":", "arg_2", "=", "{", "}", "if", "type", "(", "arg_1", ")", "is", "unicode", ":", "arg_1", "=", "arg_1", ".", "replace", "(", "u\"\\r\\n\"", ",", "u\"\\\\n\"", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "u\"\\n\"", ",", "u\"\\\\n\"", ")", "arg_1", "=", "arg_1", ".", "replace", "(", "u\"\\r\"", ",", "u\"\\\\n\"", ")", "arg_1", "=", "arg_1", ".", "encode", "(", "arg_3", ",", "\"replace\"", ")", "elif", "type", "(", "arg_1", ")", "is", "not", "str", ":", "raise", "TypeError", "(", "\"Bad type for rfc2425 value\"", ")", "elif", "not", "valid_string_re", ".", "match", "(", "arg_1", ")", ":", "arg_2", "[", "\"encoding\"", "]", "=", "\"b\"", "arg_1", "=", "binascii", ".", "b2a_base64", "(", "arg_1", ")", "arg_4", "=", "str", "(", "arg_0", ")", ".", "lower", "(", ")", "for", "arg_5", ",", "arg_6", "in", "arg_2", ".", "items", "(", ")", ":", "arg_4", "+=", "\";%s=%s\"", "%", "(", "str", "(", "arg_5", ")", ",", "str", "(", "arg_6", ")", ")", "arg_4", "+=", "\":\"", "while", "(", "len", "(", "arg_1", ")", ">", "70", ")", ":", "arg_4", "+=", "arg_1", "[", ":", "70", "]", "+", "\"\\r\\n \"", "arg_1", "=", "arg_1", "[", "70", ":", "]", "arg_4", "+=", "arg_1", "+", "\"\\r\\n\"", "return", "arg_4"], "function": "def Func(arg_0,arg_1,arg_2=None,arg_3=\"utf-8\"):\n    \"\"\"Encodes a vCard field into an RFC2425 line.\n\n    :Parameters:\n        - `name`: field type name\n        - `value`: field value\n        - `parameters`: optional parameters\n        - `charset`: encoding of the output and of the `value` (if not\n          `unicode`)\n    :Types:\n        - `name`: `str`\n        - `value`: `unicode` or `str`\n        - `parameters`: `dict` of `str` -> `str`\n        - `charset`: `str`\n\n    :return: the encoded RFC2425 line (possibly folded)\n    :returntype: `str`\"\"\"\n    if not arg_2:\n        arg_2={}\n    if type(arg_1) is unicode:\n        arg_1=arg_1.replace(u\"\\r\\n\",u\"\\\\n\")\n        arg_1=arg_1.replace(u\"\\n\",u\"\\\\n\")\n        arg_1=arg_1.replace(u\"\\r\",u\"\\\\n\")\n        arg_1=arg_1.encode(arg_3,\"replace\")\n    elif type(arg_1) is not str:\n        raise TypeError(\"Bad type for rfc2425 value\")\n    elif not valid_string_re.match(arg_1):\n        arg_2[\"encoding\"]=\"b\"\n        arg_1=binascii.b2a_base64(arg_1)\n\n    arg_4=str(arg_0).lower()\n    for arg_5,arg_6 in arg_2.items():\n        arg_4+=\";%s=%s\" % (str(arg_5),str(arg_6))\n    arg_4+=\":\"\n    while(len(arg_1)>70):\n        arg_4+=arg_1[:70]+\"\\r\\n \"\n        arg_1=arg_1[70:]\n    arg_4+=arg_1+\"\\r\\n\"\n    return arg_4", "path": "pyxmpp2/ext/vcard.py", "identifier": "rfc2425encode", "docstring": "Encodes a vCard field into an RFC2425 line.\n\n    :Parameters:\n        - `name`: field type name\n        - `value`: field value\n        - `parameters`: optional parameters\n        - `charset`: encoding of the output and of the `value` (if not\n          `unicode`)\n    :Types:\n        - `name`: `str`\n        - `value`: `unicode` or `str`\n        - `parameters`: `dict` of `str` -> `str`\n        - `charset`: `str`\n\n    :return: the encoded RFC2425 line (possibly folded)\n    :returntype: `str`", "docstring_tokens": ["Encodes", "a", "vCard", "field", "into", "an", "RFC2425", "line", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259827}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_container_instance_hook.py#L149-L158", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Delete a container group", "language": "python", "parameters": "(self, resource_group, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "connection", ".", "container_groups", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Delete a container group\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str\n        \"\"\"\n        arg_0.connection.container_groups.Func(arg_1, arg_2)", "path": "airflow/contrib/hooks/azure_container_instance_hook.py", "identifier": "AzureContainerInstanceHook.delete", "docstring": "Delete a container group\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str", "docstring_tokens": ["Delete", "a", "container", "group"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259828}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L297-L389", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the field contributions statistics.", "language": "python", "parameters": "(self)", "return_statement": "return pctFieldContributionsDict, absFieldContributionsDict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_hsObj", ".", "_fixedFields", "is", "not", "None", ":", "return", "dict", "(", ")", ",", "dict", "(", ")", "arg_1", "=", "arg_0", ".", "_hsObj", ".", "_predictedFieldEncoder", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_state", "[", "'swarms'", "]", ".", "iteritems", "(", ")", ":", "arg_5", "=", "arg_3", ".", "split", "(", "'.'", ")", "if", "len", "(", "arg_5", ")", "!=", "1", ":", "continue", "arg_6", "=", "arg_0", ".", "getEncoderNameFromKey", "(", "arg_5", "[", "0", "]", ")", "arg_7", "=", "arg_4", "[", "'bestErrScore'", "]", "if", "arg_7", "is", "None", ":", "(", "arg_8", ",", "arg_7", ")", "=", "arg_0", ".", "_hsObj", ".", "_resultsDB", ".", "bestModelIdAndErrScore", "(", "arg_3", ")", "arg_2", ".", "append", "(", "(", "arg_7", ",", "arg_6", ")", ")", "if", "arg_0", ".", "_hsObj", ".", "_searchType", "==", "HsSearchType", ".", "legacyTemporal", ":", "assert", "(", "len", "(", "arg_2", ")", "==", "1", ")", "(", "arg_9", ",", "arg_10", ")", "=", "arg_2", "[", "0", "]", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_state", "[", "'swarms'", "]", ".", "iteritems", "(", ")", ":", "arg_5", "=", "arg_3", ".", "split", "(", "'.'", ")", "if", "len", "(", "arg_5", ")", "!=", "2", ":", "continue", "arg_11", "=", "[", "arg_0", ".", "getEncoderNameFromKey", "(", "name", ")", "for", "name", "in", "arg_5", "]", "arg_11", ".", "remove", "(", "arg_10", ")", "arg_2", ".", "append", "(", "(", "arg_4", "[", "'bestErrScore'", "]", ",", "arg_11", "[", "0", "]", ")", ")", "else", ":", "arg_2", ".", "sort", "(", "reverse", "=", "True", ")", "if", "arg_0", ".", "_hsObj", ".", "_maxBranching", ">", "0", "and", "len", "(", "arg_2", ")", ">", "arg_0", ".", "_hsObj", ".", "_maxBranching", ":", "arg_9", "=", "arg_2", "[", "-", "arg_0", ".", "_hsObj", ".", "_maxBranching", "-", "1", "]", "[", "0", "]", "else", ":", "arg_9", "=", "arg_2", "[", "0", "]", "[", "0", "]", "arg_12", "=", "dict", "(", ")", "arg_13", "=", "dict", "(", ")", "if", "arg_9", "is", "not", "None", ":", "if", "abs", "(", "arg_9", ")", "<", "0.00001", ":", "arg_9", "=", "0.00001", "for", "(", "arg_14", ",", "arg_6", ")", "in", "arg_2", ":", "if", "arg_14", "is", "not", "None", ":", "arg_15", "=", "(", "arg_9", "-", "arg_14", ")", "*", "100.0", "/", "arg_9", "else", ":", "arg_15", "=", "0.0", "arg_14", "=", "arg_9", "arg_12", "[", "arg_6", "]", "=", "arg_15", "arg_13", "[", "arg_6", "]", "=", "arg_9", "-", "arg_14", "arg_0", ".", "logger", ".", "debug", "(", "\"FieldContributions: %s\"", "%", "(", "arg_12", ")", ")", "return", "arg_12", ",", "arg_13"], "function": "def Func(arg_0):\n    \"\"\"Return the field contributions statistics.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    retval:   Dictionary where the keys are the field names and the values\n                are how much each field contributed to the best score.\n    \"\"\"\n\n    #in the fast swarm, there is only 1 sprint and field contributions are\n    #not defined\n    if arg_0._hsObj._fixedFields is not None:\n      return dict(), dict()\n    # Get the predicted field encoder name\n    arg_1 = arg_0._hsObj._predictedFieldEncoder\n\n    # -----------------------------------------------------------------------\n    # Collect all the single field scores\n    arg_2 = []\n    for arg_3, arg_4 in arg_0._state['swarms'].iteritems():\n      arg_5 = arg_3.split('.')\n      if len(arg_5) != 1:\n        continue\n      arg_6 = arg_0.getEncoderNameFromKey(arg_5[0])\n      arg_7 = arg_4['bestErrScore']\n\n      # If the bestScore is None, this swarm hasn't completed yet (this could\n      #  happen if we're exiting because of maxModels), so look up the best\n      #  score so far\n      if arg_7 is None:\n        (arg_8, arg_7) = \\\n            arg_0._hsObj._resultsDB.bestModelIdAndErrScore(arg_3)\n\n      arg_2.append((arg_7, arg_6))\n\n\n    # -----------------------------------------------------------------------\n    # If we only have 1 field that was tried in the first sprint, then use that\n    #  as the base and get the contributions from the fields in the next sprint.\n    if arg_0._hsObj._searchType == HsSearchType.legacyTemporal:\n      assert(len(arg_2)==1)\n      (arg_9, arg_10) = arg_2[0]\n\n      for arg_3, arg_4 in arg_0._state['swarms'].iteritems():\n        arg_5 = arg_3.split('.')\n        if len(arg_5) != 2:\n          continue\n\n        arg_11 = [arg_0.getEncoderNameFromKey(name) for name in arg_5]\n        arg_11.remove(arg_10)\n\n        arg_2.append((arg_4['bestErrScore'], arg_11[0]))\n\n    # The first sprint tried a bunch of fields, pick the worst performing one\n    #  (within the top self._hsObj._maxBranching ones) as the base\n    else:\n      arg_2.sort(reverse=True)\n\n      # If maxBranching was specified, pick the worst performing field within\n      #  the top maxBranching+1 fields as our base, which will give that field\n      #  a contribution of 0.\n      if arg_0._hsObj._maxBranching > 0 \\\n              and len(arg_2) > arg_0._hsObj._maxBranching:\n        arg_9 = arg_2[-arg_0._hsObj._maxBranching-1][0]\n      else:\n        arg_9 = arg_2[0][0]\n\n\n    # -----------------------------------------------------------------------\n    # Prepare and return the fieldContributions dict\n    arg_12 = dict()\n    arg_13 = dict()\n\n    # If we have no base score, can't compute field contributions. This can\n    #  happen when we exit early due to maxModels or being cancelled\n    if arg_9 is not None:\n\n      # If the base error score is 0, we can't compute a percent difference\n      #  off of it, so move it to a very small float\n      if abs(arg_9) < 0.00001:\n        arg_9 = 0.00001\n      for (arg_14, arg_6) in arg_2:\n        if arg_14 is not None:\n          arg_15 = (arg_9 - arg_14) * 100.0 / arg_9\n        else:\n          arg_15 = 0.0\n          arg_14 = arg_9   # for absFieldContribution\n\n        arg_12[arg_6] = arg_15\n        arg_13[arg_6] = arg_9 - arg_14\n\n    arg_0.logger.debug(\"FieldContributions: %s\" % (arg_12))\n    return arg_12, arg_13", "path": "src/nupic/swarming/hypersearch/hs_state.py", "identifier": "HsState.getFieldContributions", "docstring": "Return the field contributions statistics.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    retval:   Dictionary where the keys are the field names and the values\n                are how much each field contributed to the best score.", "docstring_tokens": ["Return", "the", "field", "contributions", "statistics", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259829}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_mra.py#L46-L111", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the MRA comparison rating of two strings.", "language": "python", "parameters": "(self, src, tar)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "6", "if", "arg_1", "==", "''", "or", "arg_2", "==", "''", ":", "return", "0", "arg_1", "=", "list", "(", "mra", "(", "arg_1", ")", ")", "arg_2", "=", "list", "(", "mra", "(", "arg_2", ")", ")", "if", "abs", "(", "len", "(", "arg_1", ")", "-", "len", "(", "arg_2", ")", ")", ">", "2", ":", "return", "0", "arg_3", "=", "len", "(", "arg_1", ")", "+", "len", "(", "arg_2", ")", "if", "arg_3", "<", "5", ":", "arg_4", "=", "5", "elif", "arg_3", "<", "8", ":", "arg_4", "=", "4", "elif", "arg_3", "<", "12", ":", "arg_4", "=", "3", "else", ":", "arg_4", "=", "2", "for", "arg_5", "in", "range", "(", "2", ")", ":", "arg_6", "=", "[", "]", "arg_7", "=", "[", "]", "arg_8", "=", "min", "(", "len", "(", "arg_1", ")", ",", "len", "(", "arg_2", ")", ")", "for", "arg_9", "in", "range", "(", "arg_8", ")", ":", "if", "arg_1", "[", "arg_9", "]", "!=", "arg_2", "[", "arg_9", "]", ":", "arg_6", ".", "append", "(", "arg_1", "[", "arg_9", "]", ")", "arg_7", ".", "append", "(", "arg_2", "[", "arg_9", "]", ")", "arg_1", "=", "arg_6", "+", "arg_1", "[", "arg_8", ":", "]", "arg_2", "=", "arg_7", "+", "arg_2", "[", "arg_8", ":", "]", "arg_1", ".", "reverse", "(", ")", "arg_2", ".", "reverse", "(", ")", "arg_10", "=", "6", "-", "max", "(", "len", "(", "arg_1", ")", ",", "len", "(", "arg_2", ")", ")", "if", "arg_10", ">=", "arg_4", ":", "return", "arg_10", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return the MRA comparison rating of two strings.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n\n        Returns\n        -------\n        int\n            MRA comparison rating\n\n        Examples\n        --------\n        >>> cmp = MRA()\n        >>> cmp.Func('cat', 'hat')\n        5\n        >>> cmp.Func('Niall', 'Neil')\n        6\n        >>> cmp.Func('aluminum', 'Catalan')\n        0\n        >>> cmp.Func('ATCG', 'TAGC')\n        5\n\n        \"\"\"\n        if arg_1 == arg_2:\n            return 6\n        if arg_1 == '' or arg_2 == '':\n            return 0\n        arg_1 = list(mra(arg_1))\n        arg_2 = list(mra(arg_2))\n\n        if abs(len(arg_1) - len(arg_2)) > 2:\n            return 0\n\n        arg_3 = len(arg_1) + len(arg_2)\n        if arg_3 < 5:\n            arg_4 = 5\n        elif arg_3 < 8:\n            arg_4 = 4\n        elif arg_3 < 12:\n            arg_4 = 3\n        else:\n            arg_4 = 2\n\n        for arg_5 in range(2):\n            arg_6 = []\n            arg_7 = []\n            arg_8 = min(len(arg_1), len(arg_2))\n            for arg_9 in range(arg_8):\n                if arg_1[arg_9] != arg_2[arg_9]:\n                    arg_6.append(arg_1[arg_9])\n                    arg_7.append(arg_2[arg_9])\n            arg_1 = arg_6 + arg_1[arg_8:]\n            arg_2 = arg_7 + arg_2[arg_8:]\n            arg_1.reverse()\n            arg_2.reverse()\n\n        arg_10 = 6 - max(len(arg_1), len(arg_2))\n\n        if arg_10 >= arg_4:\n            return arg_10\n        return 0", "path": "abydos/distance/_mra.py", "identifier": "MRA.dist_abs", "docstring": "Return the MRA comparison rating of two strings.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n\n        Returns\n        -------\n        int\n            MRA comparison rating\n\n        Examples\n        --------\n        >>> cmp = MRA()\n        >>> cmp.dist_abs('cat', 'hat')\n        5\n        >>> cmp.dist_abs('Niall', 'Neil')\n        6\n        >>> cmp.dist_abs('aluminum', 'Catalan')\n        0\n        >>> cmp.dist_abs('ATCG', 'TAGC')\n        5", "docstring_tokens": ["Return", "the", "MRA", "comparison", "rating", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 259830}
{"url": "https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/__init__.py#L123-L140", "sha": "e6994b1b1826af2720a091d1bff5ca15594f558d", "docstring_summary": "wrap the crawling functionality", "language": "python", "parameters": "(self, crawl_candidate)", "return_statement": "return crawler_wrapper(self.config.parser_class, parsers, crawl_candidate)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "crawler_wrapper", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")", ":", "try", ":", "arg_4", "=", "Crawler", "(", "arg_0", ".", "config", ",", "arg_0", ".", "fetcher", ")", "arg_5", "=", "arg_4", ".", "crawl", "(", "arg_1", ")", "except", "(", "UnicodeDecodeError", ",", "ValueError", ")", "as", "ex", ":", "if", "arg_3", ":", "arg_2", "=", "arg_3", ".", "pop", "(", "0", ")", "return", "crawler_wrapper", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")", "else", ":", "raise", "ex", "return", "arg_5", "arg_6", "=", "list", "(", "arg_0", ".", "config", ".", "available_parsers", ")", "arg_6", ".", "remove", "(", "arg_0", ".", "config", ".", "parser_class", ")", "return", "crawler_wrapper", "(", "arg_0", ".", "config", ".", "parser_class", ",", "arg_6", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        ''' wrap the crawling functionality '''\n        def crawler_wrapper(arg_2, arg_3, arg_1):\n            try:\n                arg_4 = Crawler(arg_0.config, arg_0.fetcher)\n                arg_5 = arg_4.crawl(arg_1)\n            except (UnicodeDecodeError, ValueError) as ex:\n                if arg_3:\n                    arg_2 = arg_3.pop(0)  # remove it also!\n                    return crawler_wrapper(arg_2, arg_3, arg_1)\n                else:\n                    raise ex\n            return arg_5\n\n        # use the wrapper\n        arg_6 = list(arg_0.config.available_parsers)\n        arg_6.remove(arg_0.config.parser_class)\n        return crawler_wrapper(arg_0.config.parser_class, arg_6, arg_1)", "path": "goose3/__init__.py", "identifier": "Goose.__crawl", "docstring": "wrap the crawling functionality", "docstring_tokens": ["wrap", "the", "crawling", "functionality"], "nwo": "goose3/goose3", "score": 0.5494430231474424, "idx": 259831}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_common.py#L65-L72", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "A simple memoize decorator for functions.", "language": "python", "parameters": "(f)", "return_statement": "return memf", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "def", "memf", "(", "*", "arg_2", ")", ":", "if", "arg_2", "not", "in", "arg_1", ":", "arg_1", "[", "arg_2", "]", "=", "arg_0", "(", "*", "arg_2", ")", "return", "arg_1", "[", "arg_2", "]", "return", "memf"], "function": "def Func(arg_0):\n    \"\"\"A simple Func decorator for functions.\"\"\"\n    arg_1= {}\n    def memf(*arg_2):\n        if arg_2 not in arg_1:\n            arg_1[arg_2] = arg_0(*arg_2)\n        return arg_1[arg_2]\n    return memf", "path": "environment/lib/python2.7/site-packages/psutil/_common.py", "identifier": "memoize", "docstring": "A simple memoize decorator for functions.", "docstring_tokens": ["A", "simple", "memoize", "decorator", "for", "functions", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259832}
{"url": "https://github.com/c-soft/satel_integra/blob/3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c/satel_integra/satel_integra.py#L409-L443", "sha": "3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c", "docstring_summary": "Start monitoring of the alarm status.", "language": "python", "parameters": "(self, alarm_status_callback=None,\n                             zone_changed_callback=None,\n                             output_changed_callback=None)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_0", ".", "_alarm_status_callback", "=", "arg_1", "arg_0", ".", "_zone_changed_callback", "=", "arg_2", "arg_0", ".", "_output_changed_callback", "=", "arg_3", "_LOGGER", ".", "info", "(", "\"Starting Func loop\"", ")", "while", "not", "arg_0", ".", "closed", ":", "_LOGGER", ".", "debug", "(", "\"Iteration... \"", ")", "while", "not", "arg_0", ".", "connected", ":", "_LOGGER", ".", "info", "(", "\"Not connected, re-connecting... \"", ")", "await", "arg_0", ".", "connect", "(", ")", "if", "not", "arg_0", ".", "connected", ":", "_LOGGER", ".", "warning", "(", "\"Not connected, sleeping for 10s... \"", ")", "await", "asyncio", ".", "sleep", "(", "arg_0", ".", "_reconnection_timeout", ")", "continue", "await", "arg_0", ".", "start_monitoring", "(", ")", "if", "not", "arg_0", ".", "connected", ":", "_LOGGER", ".", "warning", "(", "\"Start monitoring failed, sleeping for 10s...\"", ")", "await", "asyncio", ".", "sleep", "(", "arg_0", ".", "_reconnection_timeout", ")", "continue", "while", "True", ":", "await", "arg_0", ".", "_update_status", "(", ")", "_LOGGER", ".", "debug", "(", "\"Got status!\"", ")", "if", "not", "arg_0", ".", "connected", ":", "_LOGGER", ".", "info", "(", "\"Got connection broken, reconnecting!\"", ")", "break", "_LOGGER", ".", "info", "(", "\"Closed, quit monitoring.\"", ")"], "function": "async def Func(arg_0, arg_1=None,\n                             arg_2=None,\n                             arg_3=None):\n        \"\"\"Start monitoring of the alarm status.\n\n        Send command to satel integra to start sending updates. Read in a\n        loop and call respective callbacks when received messages.\n        \"\"\"\n        arg_0._alarm_status_callback = arg_1\n        arg_0._zone_changed_callback = arg_2\n        arg_0._output_changed_callback = arg_3\n\n        _LOGGER.info(\"Starting Func loop\")\n\n        while not arg_0.closed:\n            _LOGGER.debug(\"Iteration... \")\n            while not arg_0.connected:\n                _LOGGER.info(\"Not connected, re-connecting... \")\n                await arg_0.connect()\n                if not arg_0.connected:\n                    _LOGGER.warning(\"Not connected, sleeping for 10s... \")\n                    await asyncio.sleep(arg_0._reconnection_timeout)\n                    continue\n            await arg_0.start_monitoring()\n            if not arg_0.connected:\n                _LOGGER.warning(\"Start monitoring failed, sleeping for 10s...\")\n                await asyncio.sleep(arg_0._reconnection_timeout)\n                continue\n            while True:\n                await arg_0._update_status()\n                _LOGGER.debug(\"Got status!\")\n                if not arg_0.connected:\n                    _LOGGER.info(\"Got connection broken, reconnecting!\")\n                    break\n        _LOGGER.info(\"Closed, quit monitoring.\")", "path": "satel_integra/satel_integra.py", "identifier": "AsyncSatel.monitor_status", "docstring": "Start monitoring of the alarm status.\n\n        Send command to satel integra to start sending updates. Read in a\n        loop and call respective callbacks when received messages.", "docstring_tokens": ["Start", "monitoring", "of", "the", "alarm", "status", "."], "nwo": "c-soft/satel_integra", "score": 0.683472553404196, "idx": 259833}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L100-L131", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "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.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "'.jpg'", ",", "'.png'", "]", "for", "arg_2", "in", "[", "x", "for", "x", "in", "arg_0", ".", "files1", "if", "cm", ".", "ext", "(", "x", ")", "in", "arg_1", "]", ":", "arg_3", "=", "\"UNKNOWN\"", "if", "len", "(", "arg_2", ")", ">", "8", "and", "arg_2", "[", ":", "8", "]", "in", "arg_0", ".", "IDs", ":", "arg_3", "=", "arg_2", "[", ":", "8", "]", "arg_4", "=", "arg_3", "+", "\"_jpg_\"", "+", "arg_2", "if", "not", "arg_4", "in", "arg_0", ".", "files2", ":", "arg_0", ".", "log", ".", "info", "(", "\"copying over [%s]\"", "%", "arg_4", ")", "shutil", ".", "copy", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "folder1", ",", "arg_2", ")", ",", "os", ".", "path", ".", "join", "(", "arg_0", ".", "folder2", ",", "arg_4", ")", ")", "if", "not", "arg_2", "[", ":", "8", "]", "+", "\".abf\"", "in", "arg_0", ".", "files1", ":", "arg_0", ".", "log", ".", "error", "(", "\"orphan image: %s\"", ",", "arg_2", ")", "arg_1", "=", "[", "'.tif'", ",", "'.tiff'", "]", "for", "arg_2", "in", "[", "x", "for", "x", "in", "arg_0", ".", "files1", "if", "cm", ".", "ext", "(", "x", ")", "in", "arg_1", "]", ":", "arg_3", "=", "\"UNKNOWN\"", "if", "len", "(", "arg_2", ")", ">", "8", "and", "arg_2", "[", ":", "8", "]", "in", "arg_0", ".", "IDs", ":", "arg_3", "=", "arg_2", "[", ":", "8", "]", "arg_4", "=", "arg_3", "+", "\"_tif_\"", "+", "arg_2", "+", "\".jpg\"", "if", "not", "arg_4", "in", "arg_0", ".", "files2", ":", "arg_0", ".", "log", ".", "info", "(", "\"converting micrograph [%s]\"", "%", "arg_4", ")", "imaging", ".", "TIF_to_jpg", "(", "os", ".", "path", ".", "join", "(", "arg_0", ".", "folder1", ",", "arg_2", ")", ",", "saveAs", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "folder2", ",", "arg_4", ")", ")", "if", "not", "arg_2", "[", ":", "8", "]", "+", "\".abf\"", "in", "arg_0", ".", "files1", ":", "arg_0", ".", "log", ".", "error", "(", "\"orphan image: %s\"", ",", "arg_2", ")"], "function": "def Func(arg_0):\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        # copy over JPGs (and such)\n        arg_1=['.jpg','.png']\n        for arg_2 in [x for x in arg_0.files1 if cm.ext(x) in arg_1]:\n            arg_3=\"UNKNOWN\"\n            if len(arg_2)>8 and arg_2[:8] in arg_0.IDs:\n                arg_3=arg_2[:8]\n            arg_4=arg_3+\"_jpg_\"+arg_2\n            if not arg_4 in arg_0.files2:\n                arg_0.log.info(\"copying over [%s]\"%arg_4)\n                shutil.copy(os.path.join(arg_0.folder1,arg_2),os.path.join(arg_0.folder2,arg_4))\n            if not arg_2[:8]+\".abf\" in arg_0.files1:\n                arg_0.log.error(\"orphan image: %s\",arg_2)\n\n        # convert TIFs (and such) to JPGs\n        arg_1=['.tif','.tiff']\n        for arg_2 in [x for x in arg_0.files1 if cm.ext(x) in arg_1]:\n            arg_3=\"UNKNOWN\"\n            if len(arg_2)>8 and arg_2[:8] in arg_0.IDs:\n                arg_3=arg_2[:8]\n            arg_4=arg_3+\"_tif_\"+arg_2+\".jpg\"\n            if not arg_4 in arg_0.files2:\n                arg_0.log.info(\"converting micrograph [%s]\"%arg_4)\n                imaging.TIF_to_jpg(os.path.join(arg_0.folder1,arg_2),saveAs=os.path.join(arg_0.folder2,arg_4))\n            if not arg_2[:8]+\".abf\" in arg_0.files1:\n                arg_0.log.error(\"orphan image: %s\",arg_2)", "path": "swhlab/indexing/indexing.py", "identifier": "INDEX.convertImages", "docstring": "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.", "docstring_tokens": ["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", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 259834}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3345-L3352", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Jumps short if not greater.", "language": "python", "parameters": "(cpu, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "Operators", ".", "OR", "(", "arg_0", ".", "ZF", ",", "arg_0", ".", "SF", "!=", "arg_0", ".", "OF", ")", ",", "arg_1", ".", "read", "(", ")", ",", "arg_0", ".", "PC", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Jumps short if not greater.\n\n        :param cpu: current CPU.\n        :param target: destination operand.\n        \"\"\"\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, Operators.OR(arg_0.ZF, arg_0.SF != arg_0.OF), arg_1.read(), arg_0.PC)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.JNG", "docstring": "Jumps short if not greater.\n\n        :param cpu: current CPU.\n        :param target: destination operand.", "docstring_tokens": ["Jumps", "short", "if", "not", "greater", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259835}
{"url": "https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L381-L396", "sha": "532e685c504ea96f9e42833594585159ac1d2068", "docstring_summary": "Add a route.", "language": "python", "parameters": "(self, method, pattern, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_normalize_pattern", "(", "arg_2", ")", "if", "arg_4", "==", "'literal'", ":", "arg_0", ".", "_literal", "[", "arg_1", "]", "[", "arg_5", "]", "=", "arg_3", "elif", "arg_4", "==", "'wildcard'", ":", "arg_0", ".", "_wildcard", "[", "arg_1", "]", ".", "append", "(", "WildcardRoute", "(", "arg_5", ",", "arg_3", ")", ")", "else", ":", "arg_0", ".", "_regex", "[", "arg_1", "]", ".", "append", "(", "RegexRoute", "(", "arg_5", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Add a route.\n\n        Arguments:\n          method (str): HTTP method, e.g. GET, POST, etc.\n          pattern (str): Pattern that request paths must match.\n          callback (str): Route handler that is invoked when a request\n            path matches the *pattern*.\n        \"\"\"\n        arg_4, arg_5 = arg_0._normalize_pattern(arg_2)\n        if arg_4 == 'literal':\n            arg_0._literal[arg_1][arg_5] = arg_3\n        elif arg_4 == 'wildcard':\n            arg_0._wildcard[arg_1].append(WildcardRoute(arg_5, arg_3))\n        else:\n            arg_0._regex[arg_1].append(RegexRoute(arg_5, arg_3))", "path": "ice.py", "identifier": "Router.add", "docstring": "Add a route.\n\n        Arguments:\n          method (str): HTTP method, e.g. GET, POST, etc.\n          pattern (str): Pattern that request paths must match.\n          callback (str): Route handler that is invoked when a request\n            path matches the *pattern*.", "docstring_tokens": ["Add", "a", "route", "."], "nwo": "susam/ice", "score": 0.16638194949711382, "idx": 259836}
{"url": "https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/__init__.py#L300-L305", "sha": "90a9ce60cc405ae8a2bf5c3713acd5d78579a04e", "docstring_summary": "Saves a value to session.", "language": "python", "parameters": "(self, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "session", "[", "arg_0", ".", "_session_key", "(", "arg_1", ")", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Saves a value to session.\n        \"\"\"\n\n        arg_0.session[arg_0._session_key(arg_1)] = arg_2", "path": "authomatic/providers/__init__.py", "identifier": "BaseProvider._session_set", "docstring": "Saves a value to session.", "docstring_tokens": ["Saves", "a", "value", "to", "session", "."], "nwo": "authomatic/authomatic", "score": 0.5619919549989912, "idx": 259837}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L303-L323", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Return a Message representation or raise a KeyError.", "language": "python", "parameters": "(self, key)", "return_statement": "return msg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "_lookup", "(", "arg_1", ")", "arg_0", ".", "_file", ".", "seek", "(", "arg_2", ")", "arg_4", "=", "arg_0", ".", "_file", ".", "readline", "(", ")", ".", "replace", "(", "mailbox", ".", "linesep", ",", "b''", ")", "arg_5", "=", "arg_0", ".", "_file", ".", "read", "(", "arg_3", "-", "arg_0", ".", "_file", ".", "tell", "(", ")", ")", "arg_6", "=", "arg_0", ".", "_message_factory", "(", "arg_5", ".", "replace", "(", "mailbox", ".", "linesep", ",", "b'\\n'", ")", ")", "try", ":", "arg_6", ".", "set_from", "(", "arg_4", "[", "5", ":", "]", ".", "decode", "(", "'ascii'", ")", ")", "return", "arg_6", "except", "UnicodeDecodeError", ":", "pass", "try", ":", "arg_6", ".", "set_from", "(", "arg_4", "[", "5", ":", "]", ".", "decode", "(", "'utf-8'", ")", ")", "except", "UnicodeDecodeError", ":", "arg_6", ".", "set_from", "(", "arg_4", "[", "5", ":", "]", ".", "decode", "(", "'iso-8859-1'", ")", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a Message representation or raise a KeyError.\"\"\"\n\n        arg_2, arg_3 = arg_0._lookup(arg_1)\n        arg_0._file.seek(arg_2)\n        arg_4 = arg_0._file.readline().replace(mailbox.linesep, b'')\n        arg_5 = arg_0._file.read(arg_3 - arg_0._file.tell())\n        arg_6 = arg_0._message_factory(arg_5.replace(mailbox.linesep, b'\\n'))\n\n        try:\n            arg_6.set_from(arg_4[5:].decode('ascii'))\n            return arg_6\n        except UnicodeDecodeError:\n            pass\n\n        try:\n            arg_6.set_from(arg_4[5:].decode('utf-8'))\n        except UnicodeDecodeError:\n            arg_6.set_from(arg_4[5:].decode('iso-8859-1'))\n\n        return arg_6", "path": "perceval/backends/core/mbox.py", "identifier": "_MBox.get_message", "docstring": "Return a Message representation or raise a KeyError.", "docstring_tokens": ["Return", "a", "Message", "representation", "or", "raise", "a", "KeyError", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259838}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L143-L162", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "The the time value of an ASN1 time object.", "language": "python", "parameters": "(boundary, when)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"when must be a byte string\"", ")", "arg_2", "=", "_lib", ".", "ASN1_TIME_set_string", "(", "arg_0", ",", "arg_1", ")", "if", "arg_2", "==", "0", ":", "raise", "ValueError", "(", "\"Invalid string\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    The the time value of an ASN1 time object.\n\n    @param boundary: An ASN1_TIME pointer (or an object safely\n        castable to that type) which will have its value set.\n    @param when: A string representation of the desired time value.\n\n    @raise TypeError: If C{when} is not a L{bytes} string.\n    @raise ValueError: If C{when} does not represent a time in the required\n        format.\n    @raise RuntimeError: If the time value cannot be set for some other\n        (unspecified) reason.\n    \"\"\"\n    if not isinstance(arg_1, bytes):\n        raise TypeError(\"when must be a byte string\")\n\n    arg_2 = _lib.ASN1_TIME_set_string(arg_0, arg_1)\n    if arg_2 == 0:\n        raise ValueError(\"Invalid string\")", "path": "src/OpenSSL/crypto.py", "identifier": "_set_asn1_time", "docstring": "The the time value of an ASN1 time object.\n\n    @param boundary: An ASN1_TIME pointer (or an object safely\n        castable to that type) which will have its value set.\n    @param when: A string representation of the desired time value.\n\n    @raise TypeError: If C{when} is not a L{bytes} string.\n    @raise ValueError: If C{when} does not represent a time in the required\n        format.\n    @raise RuntimeError: If the time value cannot be set for some other\n        (unspecified) reason.", "docstring_tokens": ["The", "the", "time", "value", "of", "an", "ASN1", "time", "object", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 259839}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/html_utils.py#L72-L75", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Return representation of html end tag.", "language": "python", "parameters": "(self, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "mathml_elements", ":", "arg_0", ".", "fed", ".", "append", "(", "\"</{0}>\"", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return representation of html end tag.\"\"\"\n        if arg_1 in arg_0.mathml_elements:\n            arg_0.fed.append(\"</{0}>\".format(arg_1))", "path": "harvestingkit/html_utils.py", "identifier": "MathMLParser.handle_endtag", "docstring": "Return representation of html end tag.", "docstring_tokens": ["Return", "representation", "of", "html", "end", "tag", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259840}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/utils.py#L550-L583", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Close TensorFlow session, TensorBoard and Nvidia-process if available.", "language": "python", "parameters": "(sess=None, port=6006)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "6006", ")", ":", "arg_2", "=", "\"[TL] Close tensorboard and nvidia-process if available\"", "arg_3", "=", "\"[TL] Close tensorboard and nvidia-process not yet supported by this function (tl.ops.exit_tf) on \"", "if", "arg_0", "is", "not", "None", ":", "arg_0", ".", "close", "(", ")", "if", "_platform", "==", "\"linux\"", "or", "_platform", "==", "\"linux2\"", ":", "tl", ".", "logging", ".", "info", "(", "'linux: %s'", "%", "arg_2", ")", "os", ".", "system", "(", "'nvidia-smi'", ")", "os", ".", "system", "(", "'fuser '", "+", "arg_1", "+", "'/tcp -k'", ")", "os", ".", "system", "(", "\"nvidia-smi | grep python |awk '{print $3}'|xargs kill\"", ")", "_exit", "(", ")", "elif", "_platform", "==", "\"darwin\"", ":", "tl", ".", "logging", ".", "info", "(", "'OS X: %s'", "%", "arg_2", ")", "subprocess", ".", "Popen", "(", "\"lsof -i tcp:\"", "+", "str", "(", "arg_1", ")", "+", "\"  | grep -v PID | awk '{print $2}' | xargs kill\"", ",", "shell", "=", "True", ")", "elif", "_platform", "==", "\"win32\"", ":", "raise", "NotImplementedError", "(", "\"this function is not supported on the Windows platform\"", ")", "else", ":", "tl", ".", "logging", ".", "info", "(", "arg_3", "+", "_platform", ")"], "function": "def Func(arg_0=None, arg_1=6006):\n    \"\"\"Close TensorFlow session, TensorBoard and Nvidia-process if available.\n\n    Parameters\n    ----------\n    sess : Session\n        TensorFlow Session.\n    tb_port : int\n        TensorBoard port you want to close, `6006` as default.\n\n    \"\"\"\n    arg_2 = \"[TL] Close tensorboard and nvidia-process if available\"\n    arg_3 = \"[TL] Close tensorboard and nvidia-process not yet supported by this function (tl.ops.exit_tf) on \"\n\n    if arg_0 is not None:\n        arg_0.close()\n\n    if _platform == \"linux\" or _platform == \"linux2\":\n        tl.logging.info('linux: %s' % arg_2)\n        os.system('nvidia-smi')\n        os.system('fuser ' + arg_1 + '/tcp -k')  # kill tensorboard 6006\n        os.system(\"nvidia-smi | grep python |awk '{print $3}'|xargs kill\")  # kill all nvidia-smi python process\n        _exit()\n\n    elif _platform == \"darwin\":\n        tl.logging.info('OS X: %s' % arg_2)\n        subprocess.Popen(\n            \"lsof -i tcp:\" + str(arg_1) + \"  | grep -v PID | awk '{print $2}' | xargs kill\", shell=True\n        )  # kill tensorboard\n    elif _platform == \"win32\":\n        raise NotImplementedError(\"this function is not supported on the Windows platform\")\n\n    else:\n        tl.logging.info(arg_3 + _platform)", "path": "tensorlayer/utils.py", "identifier": "exit_tensorflow", "docstring": "Close TensorFlow session, TensorBoard and Nvidia-process if available.\n\n    Parameters\n    ----------\n    sess : Session\n        TensorFlow Session.\n    tb_port : int\n        TensorBoard port you want to close, `6006` as default.", "docstring_tokens": ["Close", "TensorFlow", "session", "TensorBoard", "and", "Nvidia", "-", "process", "if", "available", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 259841}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/auth/models.py#L48-L55", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Returns the user's permissions.", "language": "python", "parameters": "(self)", "return_statement": "return permissions", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "if", "arg_0", ".", "groups", ".", "filter", "(", "name", "=", "'Admin'", ")", ".", "exists", "(", ")", "or", "arg_0", ".", "is_superuser", ":", "arg_1", "=", "'admin'", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns the user's permissions.\"\"\"\n\n        arg_1 = ''\n        if arg_0.groups.filter(name='Admin').exists() or arg_0.is_superuser:\n            arg_1 = 'admin'\n\n        return arg_1", "path": "dispatch/modules/auth/models.py", "identifier": "User.get_permissions", "docstring": "Returns the user's permissions.", "docstring_tokens": ["Returns", "the", "user", "s", "permissions", "."], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 259842}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/mapping/lookahead_swap.py#L252-L257", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Count the mapped two-qubit gates, less the number of added SWAPs.", "language": "python", "parameters": "(step)", "return_statement": "return len([g for g in step['gates_mapped']\n                if len(g.qargs) == 2]) - 3 * step['swaps_added']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "len", "(", "[", "arg_1", "for", "arg_1", "in", "arg_0", "[", "'gates_mapped'", "]", "if", "len", "(", "arg_1", ".", "qargs", ")", "==", "2", "]", ")", "-", "3", "*", "arg_0", "[", "'swaps_added'", "]"], "function": "def Func(arg_0):\n\n    \"\"\"Count the mapped two-qubit gates, less the number of added SWAPs.\"\"\"\n    # Each added swap will add 3 ops to gates_mapped, so subtract 3.\n    return len([arg_1 for arg_1 in arg_0['gates_mapped']\n                if len(arg_1.qargs) == 2]) - 3 * arg_0['swaps_added']", "path": "qiskit/transpiler/passes/mapping/lookahead_swap.py", "identifier": "_score_step", "docstring": "Count the mapped two-qubit gates, less the number of added SWAPs.", "docstring_tokens": ["Count", "the", "mapped", "two", "-", "qubit", "gates", "less", "the", "number", "of", "added", "SWAPs", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259843}
{"url": "https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/setup.py#L53-L83", "sha": "e5a0d908df8c93ff1ee7abdda8875fd1667df53d", "docstring_summary": "Run build.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "ON_READ_THE_DOCS", ":", "return", "try", ":", "arg_1", "=", "'pyside-rcc'", "if", "sys", ".", "platform", "==", "'win32'", ":", "import", "PySide", "arg_1", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "PySide", ".", "__file__", ")", ",", "'pyside-rcc.exe'", ")", "subprocess", ".", "check_call", "(", "[", "arg_1", ",", "'-o'", ",", "arg_0", ".", "resource_target_path", ",", "arg_0", ".", "resource_source_path", "]", ")", "except", "(", "subprocess", ".", "CalledProcessError", ",", "OSError", ")", ":", "print", "(", "'Error compiling resource.py using pyside-rcc. Possibly '", "'pyside-rcc could not be found. You might need to manually add '", "'it to your PATH.'", ")", "raise", "SystemExit", "(", ")"], "function": "def Func(arg_0):\n        '''Run build.'''\n        if ON_READ_THE_DOCS:\n            # PySide not available.\n            return\n\n        try:\n            arg_1 = 'pyside-rcc'\n\n            # On Windows, pyside-rcc is not automatically available on the\n            # PATH so try to find it manually.\n            if sys.platform == 'win32':\n                import PySide\n                arg_1 = os.path.join(\n                    os.path.dirname(PySide.__file__),\n                    'pyside-rcc.exe'\n                )\n\n            subprocess.check_call([\n                arg_1,\n                '-o',\n                arg_0.resource_target_path,\n                arg_0.resource_source_path\n            ])\n        except (subprocess.CalledProcessError, OSError):\n            print(\n                'Error compiling resource.py using pyside-rcc. Possibly '\n                'pyside-rcc could not be found. You might need to manually add '\n                'it to your PATH.'\n            )\n            raise SystemExit()", "path": "setup.py", "identifier": "BuildResources.run", "docstring": "Run build.", "docstring_tokens": ["Run", "build", "."], "nwo": "4degrees/riffle", "score": 0.2663827826706725, "idx": 259844}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/functions.py#L479-L505", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Extracts the second out of a datetime samples.", "language": "python", "parameters": "(x)", "return_statement": "return pd.Series(x).dt.second.values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "pandas", "as", "pd", "return", "pd", ".", "Series", "(", "arg_0", ")", ".", "dt", ".", "second", ".", "values"], "function": "def Func(arg_0):\n    \"\"\"Extracts the second out of a datetime samples.\n\n    :returns: an expression containing the second extracted from a datetime column.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.second\n    Expression = Func(date)\n    Length: 3 dtype: int64 (expression)\n    -----------------------------------\n    0   0\n    1  34\n    2  22\n    \"\"\"\n    import pandas as pd\n    return pd.Series(arg_0).dt.second.values", "path": "packages/vaex-core/vaex/functions.py", "identifier": "dt_second", "docstring": "Extracts the second out of a datetime samples.\n\n    :returns: an expression containing the second extracted from a datetime column.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.second\n    Expression = dt_second(date)\n    Length: 3 dtype: int64 (expression)\n    -----------------------------------\n    0   0\n    1  34\n    2  22", "docstring_tokens": ["Extracts", "the", "second", "out", "of", "a", "datetime", "samples", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 259845}
{"url": "https://github.com/addok/addok/blob/46a270d76ec778d2b445c2be753e5c6ba070a9b2/addok/helpers/text.py#L187-L192", "sha": "46a270d76ec778d2b445c2be753e5c6ba070a9b2", "docstring_summary": "Compute edge ngram of token from min. Does not include token itself.", "language": "python", "parameters": "(token, min=None)", "return_statement": "return [token[:i] for i in range(min, len(token))]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "config", ".", "MIN_EDGE_NGRAMS", "arg_0", "=", "arg_0", "[", ":", "config", ".", "MAX_EDGE_NGRAMS", "+", "1", "]", "return", "[", "arg_0", "[", ":", "arg_2", "]", "for", "arg_2", "in", "range", "(", "arg_1", ",", "len", "(", "arg_0", ")", ")", "]"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Compute edge ngram of token from min. Does not include token itself.\"\"\"\n    if arg_1 is None:\n        arg_1 = config.MIN_EDGE_NGRAMS\n    arg_0 = arg_0[:config.MAX_EDGE_NGRAMS + 1]\n    return [arg_0[:arg_2] for arg_2 in range(arg_1, len(arg_0))]", "path": "addok/helpers/text.py", "identifier": "compute_edge_ngrams", "docstring": "Compute edge ngram of token from min. Does not include token itself.", "docstring_tokens": ["Compute", "edge", "ngram", "of", "token", "from", "min", ".", "Does", "not", "include", "token", "itself", "."], "nwo": "addok/addok", "score": 0.5575306264469764, "idx": 259846}
{"url": "https://github.com/mblayman/httpony/blob/5af404d647a8dac8a043b64ea09882589b3b5247/httpony/application.py#L15-L55", "sha": "5af404d647a8dac8a043b64ea09882589b3b5247", "docstring_summary": "Make a WSGI app that has all the HTTPie pieces baked in.", "language": "python", "parameters": "()", "return_statement": "return application", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "Environment", "(", ")", "arg_1", "=", "parser", ".", "parse_args", "(", "arg_1", "=", "[", "'/'", ",", "'--ignore-stdin'", "]", ",", "arg_0", "=", "arg_0", ")", "arg_1", ".", "output_options", "=", "'HB'", "arg_3", "=", "'HTTPony/{0}'", ".", "format", "(", "__version__", ")", "def", "application", "(", "arg_4", ",", "arg_5", ")", ":", "if", "arg_4", ".", "get", "(", "'CONTENT_LENGTH'", ")", "==", "''", ":", "del", "arg_4", "[", "'CONTENT_LENGTH'", "]", "if", "arg_4", ".", "get", "(", "'CONTENT_TYPE'", ")", "==", "''", ":", "del", "arg_4", "[", "'CONTENT_TYPE'", "]", "arg_6", "=", "WerkzeugRequest", "(", "arg_4", ")", "arg_7", "=", "arg_6", ".", "get_data", "(", ")", "arg_8", "=", "Request", "(", "method", "=", "arg_6", ".", "method", ",", "url", "=", "arg_6", ".", "url", ",", "headers", "=", "arg_6", ".", "headers", ",", "arg_7", "=", "arg_7", ",", ")", "arg_9", "=", "arg_8", ".", "prepare", "(", ")", "arg_10", "=", "streams", ".", "build_output_stream", "(", "arg_1", ",", "arg_0", ",", "arg_9", ",", "arg_11", "=", "None", ",", "arg_2", "=", "arg_1", ".", "output_options", ")", "streams", ".", "write_stream", "(", "arg_10", ",", "arg_0", ".", "stdout", ",", "arg_0", ".", "stdout_isatty", ")", "if", "arg_7", ":", "print", "(", "\"\\n\"", ",", "file", "=", "arg_0", ".", "stdout", ")", "arg_11", "=", "Response", "(", "headers", "=", "{", "'Server'", ":", "arg_3", "}", ")", "return", "arg_11", "(", "arg_4", ",", "arg_5", ")", "return", "application"], "function": "def Func():\n    \"\"\"Make a WSGI app that has all the HTTPie pieces baked in.\"\"\"\n    arg_0 = Environment()\n    # STDIN is ignored because HTTPony runs a server that doesn't care.\n    # Additionally, it is needed or else pytest blows up.\n    arg_1 = parser.parse_args(arg_1=['/', '--ignore-stdin'], arg_0=arg_0)\n    arg_1.output_options = 'HB'  # Output only requests.\n    arg_3 = 'HTTPony/{0}'.format(__version__)\n\n    def application(arg_4, arg_5):\n        # The WSGI server puts content length and type in the environment\n        # even when not provided with the request. Drop them if they are empty.\n        if arg_4.get('CONTENT_LENGTH') == '':\n            del arg_4['CONTENT_LENGTH']\n        if arg_4.get('CONTENT_TYPE') == '':\n            del arg_4['CONTENT_TYPE']\n\n        arg_6 = WerkzeugRequest(arg_4)\n        arg_7 = arg_6.get_data()\n        arg_8 = Request(\n            method=arg_6.method,\n            url=arg_6.url,\n            headers=arg_6.headers,\n            arg_7=arg_7,\n        )\n        arg_9 = arg_8.prepare()\n\n        arg_10 = streams.build_output_stream(\n            arg_1, arg_0, arg_9, arg_11=None,\n            arg_2=arg_1.output_options)\n        streams.write_stream(arg_10, arg_0.stdout, arg_0.stdout_isatty)\n\n        # When there is data in the request, give the next one breathing room.\n        if arg_7:\n            print(\"\\n\", file=arg_0.stdout)\n\n        # Make dreams come true.\n        arg_11 = Response(headers={'Server': arg_3})\n        return arg_11(arg_4, arg_5)\n\n    return application", "path": "httpony/application.py", "identifier": "make_app", "docstring": "Make a WSGI app that has all the HTTPie pieces baked in.", "docstring_tokens": ["Make", "a", "WSGI", "app", "that", "has", "all", "the", "HTTPie", "pieces", "baked", "in", "."], "nwo": "mblayman/httpony", "score": 0.16638194949711382, "idx": 259847}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/prefer_static.py#L59-L71", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Wraps new_fn with the doc of original_fn.", "language": "python", "parameters": "(original_fn, new_fn)", "return_statement": "return wrap(original_fn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tf_inspect", ".", "getfullargspec", "(", "arg_0", ")", "arg_3", "=", "tf_inspect", ".", "getfullargspec", "(", "arg_1", ")", "if", "arg_2", "!=", "arg_3", ":", "raise", "ValueError", "(", "'Arg specs do not match: original={}, new={}, fn={}'", ".", "format", "(", "arg_2", ",", "arg_3", ",", "arg_0", ")", ")", "@", "decorator", ".", "decorator", "def", "wrap", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "del", "arg_4", "return", "arg_1", "(", "*", "arg_5", ",", "**", "arg_6", ")", "return", "wrap", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Wraps new_fn with the doc of original_fn.\"\"\"\n  arg_2 = tf_inspect.getfullargspec(arg_0)\n  arg_3 = tf_inspect.getfullargspec(arg_1)\n  if arg_2 != arg_3:\n    raise ValueError(\n        'Arg specs do not match: original={}, new={}, fn={}'.format(\n            arg_2, arg_3, arg_0))\n  @decorator.decorator\n  def wrap(arg_4, *arg_5, **arg_6):\n    del arg_4\n    return arg_1(*arg_5, **arg_6)\n  return wrap(arg_0)", "path": "tensorflow_probability/python/internal/prefer_static.py", "identifier": "_copy_docstring", "docstring": "Wraps new_fn with the doc of original_fn.", "docstring_tokens": ["Wraps", "new_fn", "with", "the", "doc", "of", "original_fn", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259848}
{"url": "https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L328-L333", "sha": "a2f706d69e2138fbb973f792041341f662072d26", "docstring_summary": "REST Conference Play helper", "language": "python", "parameters": "(self, call_params)", "return_statement": "return self.request(path, method, call_params)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'/'", "+", "arg_0", ".", "api_version", "+", "'/ConferencePlay/'", "arg_3", "=", "'POST'", "return", "arg_0", ".", "request", "(", "arg_2", ",", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"REST Conference Play helper\n        \"\"\"\n        arg_2 = '/' + arg_0.api_version + '/ConferencePlay/'\n        arg_3 = 'POST'\n        return arg_0.request(arg_2, arg_3, arg_1)", "path": "plivohelper.py", "identifier": "REST.conference_play", "docstring": "REST Conference Play helper", "docstring_tokens": ["REST", "Conference", "Play", "helper"], "nwo": "plivo/plivohelper-python", "score": 0.3381286165491821, "idx": 259849}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/latools.py#L337-L359", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Helper function to get sample names from subset.", "language": "python", "parameters": "(self, subset=None)", "return_statement": "return samples", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "arg_0", ".", "subsets", "[", "'All_Samples'", "]", "else", ":", "try", ":", "arg_2", "=", "arg_0", ".", "subsets", "[", "arg_1", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "(", "\"Subset '{:s}' does not \"", ".", "format", "(", "arg_1", ")", "+", "\"exist.\\nUse 'make_subset' to create a\"", "+", "\"subset.\"", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Helper function to get sample names from subset.\n\n        Parameters\n        ----------\n        subset : str\n            Subset name. If None, returns all samples.\n\n        Returns\n        -------\n        List of sample names\n        \"\"\"\n        if arg_1 is None:\n            arg_2 = arg_0.subsets['All_Samples']\n        else:\n            try:\n                arg_2 = arg_0.subsets[arg_1]\n            except KeyError:\n                raise KeyError((\"Subset '{:s}' does not \".format(arg_1) +\n                                \"exist.\\nUse 'make_subset' to create a\" +\n                                \"subset.\"))\n        return arg_2", "path": "latools/latools.py", "identifier": "analyse._get_samples", "docstring": "Helper function to get sample names from subset.\n\n        Parameters\n        ----------\n        subset : str\n            Subset name. If None, returns all samples.\n\n        Returns\n        -------\n        List of sample names", "docstring_tokens": ["Helper", "function", "to", "get", "sample", "names", "from", "subset", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 259850}
{"url": "https://github.com/Danielhiversen/pyTibber/blob/114ebc3dd49f6affd93665b0862d4cbdea03e9ef/tibber/__init__.py#L549-L555", "sha": "114ebc3dd49f6affd93665b0862d4cbdea03e9ef", "docstring_summary": "Is real time subscription running.", "language": "python", "parameters": "(self)", "return_statement": "return (\n            self._tibber_control.sub_manager is not None\n            and self._tibber_control.sub_manager.is_running\n            and self._subscription_id is not None\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "_tibber_control", ".", "sub_manager", "is", "not", "None", "and", "arg_0", ".", "_tibber_control", ".", "sub_manager", ".", "is_running", "and", "arg_0", ".", "_subscription_id", "is", "not", "None", ")"], "function": "def Func(arg_0):\n        \"\"\"Is real time subscription running.\"\"\"\n        return (\n            arg_0._tibber_control.sub_manager is not None\n            and arg_0._tibber_control.sub_manager.is_running\n            and arg_0._subscription_id is not None\n        )", "path": "tibber/__init__.py", "identifier": "TibberHome.rt_subscription_running", "docstring": "Is real time subscription running.", "docstring_tokens": ["Is", "real", "time", "subscription", "running", "."], "nwo": "Danielhiversen/pyTibber", "score": 0.2877815456703515, "idx": 259851}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1647-L1663", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "returns a seq array with 'RSKYWM' randomly replaced with resolved bases", "language": "python", "parameters": "(tmpseq)", "return_statement": "return tmpseq", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "np", ".", "uint8", "(", "[", "82", ",", "83", ",", "75", ",", "87", ",", "89", ",", "77", "]", ")", ":", "arg_2", ",", "arg_3", "=", "np", ".", "where", "(", "arg_0", "==", "arg_1", ")", "arg_4", ",", "arg_5", "=", "AMBIGS", "[", "arg_1", ".", "view", "(", "\"S1\"", ")", "]", "arg_6", "=", "np", ".", "random", ".", "choice", "(", "[", "True", ",", "False", "]", ",", "arg_2", ".", "shape", "[", "0", "]", ")", "for", "arg_7", "in", "xrange", "(", "arg_6", ".", "shape", "[", "0", "]", ")", ":", "if", "arg_6", "[", "arg_7", "]", ":", "arg_0", "[", "arg_2", "[", "arg_7", "]", ",", "arg_3", "[", "arg_7", "]", "]", "=", "np", ".", "array", "(", "arg_4", ")", ".", "view", "(", "np", ".", "uint8", ")", "else", ":", "arg_0", "[", "arg_2", "[", "arg_7", "]", ",", "arg_3", "[", "arg_7", "]", "]", "=", "np", ".", "array", "(", "arg_5", ")", ".", "view", "(", "np", ".", "uint8", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\" returns a seq array with 'RSKYWM' randomly replaced with resolved bases\"\"\"\n    ## iterate over the bases 'RSKWYM': [82, 83, 75, 87, 89, 77]\n    for arg_1 in np.uint8([82, 83, 75, 87, 89, 77]):\n        ## get all site in this ambig\n        arg_2, arg_3 = np.where(arg_0 == arg_1)\n        ## get the two resolutions of the ambig\n        arg_4, arg_5 = AMBIGS[arg_1.view(\"S1\")]\n        ## randomly sample half those sites\n        arg_6 = np.random.choice([True, False], arg_2.shape[0])\n        ## replace ambig bases with their resolutions\n        for arg_7 in xrange(arg_6.shape[0]):\n            if arg_6[arg_7]:\n                arg_0[arg_2[arg_7], arg_3[arg_7]] = np.array(arg_4).view(np.uint8)\n            else:\n                arg_0[arg_2[arg_7], arg_3[arg_7]] = np.array(arg_5).view(np.uint8)\n    return arg_0", "path": "ipyrad/analysis/tetrad.py", "identifier": "resolve_ambigs", "docstring": "returns a seq array with 'RSKYWM' randomly replaced with resolved bases", "docstring_tokens": ["returns", "a", "seq", "array", "with", "RSKYWM", "randomly", "replaced", "with", "resolved", "bases"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 259852}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/hosted_zone.py#L364-L382", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "Creates a SRV record attached to this hosted zone.", "language": "python", "parameters": "(self, name, values, ttl=60)", "return_statement": "return self._add_record(SRVResourceRecordSet, **values)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "60", ")", ":", "arg_0", ".", "_halt_if_already_deleted", "(", ")", "arg_2", "=", "locals", "(", ")", "del", "arg_2", "[", "'self'", "]", "return", "arg_0", ".", "_add_record", "(", "SRVResourceRecordSet", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=60):\n        \"\"\"\n        Creates a SRV record attached to this hosted zone.\n\n        :param str name: The fully qualified name of the record to add.\n        :param list values: A list of value strings for the record.\n        :keyword int ttl: The time-to-live of the record (in seconds).\n        :rtype: tuple\n        :returns: A tuple in the form of ``(rrset, change_info)``, where\n            ``rrset`` is the newly created SRVResourceRecordSet instance.\n        \"\"\"\n\n        arg_0._halt_if_already_deleted()\n\n        # Grab the params/kwargs here for brevity's sake.\n        arg_2 = locals()\n        del arg_2['self']\n\n        return arg_0._add_record(SRVResourceRecordSet, **arg_2)", "path": "route53/hosted_zone.py", "identifier": "HostedZone.create_srv_record", "docstring": "Creates a SRV record attached to this hosted zone.\n\n        :param str name: The fully qualified name of the record to add.\n        :param list values: A list of value strings for the record.\n        :keyword int ttl: The time-to-live of the record (in seconds).\n        :rtype: tuple\n        :returns: A tuple in the form of ``(rrset, change_info)``, where\n            ``rrset`` is the newly created SRVResourceRecordSet instance.", "docstring_tokens": ["Creates", "a", "SRV", "record", "attached", "to", "this", "hosted", "zone", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 259853}
{"url": "https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/build.py#L250-L301", "sha": "b7ad20fe8e7137db99a20ac06b8da26492601b00", "docstring_summary": "Runs the commands supplied as an argument\n    It will exit the program if the commands return a\n    non-zero code", "language": "python", "parameters": "(commands, settings)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "\"sprint\"", "]", "arg_3", "=", "arg_1", "[", "\"quiet\"", "]", "arg_4", "=", "arg_1", "[", "\"error\"", "]", "arg_5", "=", "True", "arg_6", "=", "None", "if", "arg_1", "[", "\"no_enhanced_errors\"", "]", ":", "arg_5", "=", "False", "if", "\"shell\"", "in", "arg_1", ":", "arg_6", "=", "arg_1", "[", "\"shell\"", "]", "arg_7", "=", "sys", ".", "platform", "==", "\"win32\"", "arg_8", "=", "None", "arg_9", "=", "None", "if", "arg_3", ":", "arg_8", "=", "PIPE", "arg_9", "=", "PIPE", "arg_0", "=", "arg_0", ".", "rstrip", "(", ")", "arg_2", "(", "\"About to run commands '{}'\"", ".", "format", "(", "arg_0", ")", ",", "level", "=", "\"verbose\"", ")", "if", "not", "arg_3", ":", "arg_2", "(", "arg_0", ")", "if", "arg_6", ":", "arg_10", "=", "shlex", ".", "split", "(", "arg_6", ")", "arg_6", "=", "arg_10", "[", "0", "]", "arg_10", "=", "arg_10", "[", "1", ":", "]", "if", "arg_5", "and", "not", "arg_7", ":", "arg_10", ".", "append", "(", "\"-e\"", ")", "arg_10", ".", "append", "(", "arg_0", ")", "arg_0", "=", "arg_10", "else", ":", "if", "arg_5", "and", "not", "arg_7", ":", "arg_0", "=", "[", "\"-e\"", ",", "arg_0", "]", "arg_11", "=", "Popen", "(", "arg_0", ",", "shell", "=", "True", ",", "stdout", "=", "arg_8", ",", "stderr", "=", "arg_9", ",", "executable", "=", "arg_6", ")", "arg_12", ",", "arg_13", "=", "arg_11", ".", "communicate", "(", ")", "if", "arg_11", ".", "returncode", ":", "if", "arg_3", ":", "arg_4", "(", "arg_13", ".", "decode", "(", "locale", ".", "getpreferredencoding", "(", ")", ")", ")", "arg_4", "(", "\"Command failed to run\"", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Runs the commands supplied as an argument\n    It will exit the program if the commands return a\n    non-zero code\n\n    Args:\n        the commands to run\n        The settings dictionary\n    \"\"\"\n    arg_2 = arg_1[\"sprint\"]\n    arg_3 = arg_1[\"quiet\"]\n    arg_4 = arg_1[\"error\"]\n    arg_5 = True\n    arg_6 = None\n    if arg_1[\"no_enhanced_errors\"]:\n        arg_5 = False\n    if \"shell\" in arg_1:\n        arg_6 = arg_1[\"shell\"]\n    arg_7 = sys.platform == \"win32\"\n\n    arg_8 = None\n    arg_9 = None\n    if arg_3:\n        arg_8 = PIPE\n        arg_9 = PIPE\n\n    arg_0 = arg_0.rstrip()\n    arg_2(\"About to run commands '{}'\".format(arg_0), level=\"verbose\")\n    if not arg_3:\n        arg_2(arg_0)\n\n    if arg_6:\n        arg_10 = shlex.split(arg_6)\n        arg_6 = arg_10[0]\n        arg_10 = arg_10[1:]\n        if arg_5 and not arg_7:\n            arg_10.append(\"-e\")\n        arg_10.append(arg_0)\n        arg_0 = arg_10\n    else:\n        if arg_5 and not arg_7:\n            arg_0 = [\"-e\", arg_0]\n\n    arg_11 = Popen(arg_0, shell=True, stdout=arg_8, stderr=arg_9,\n              executable=arg_6)\n    arg_12, arg_13 = arg_11.communicate()\n    if arg_11.returncode:\n        if arg_3:\n            arg_4(arg_13.decode(locale.getpreferredencoding()))\n        arg_4(\"Command failed to run\")\n        sys.exit(1)", "path": "sakelib/build.py", "identifier": "run_commands", "docstring": "Runs the commands supplied as an argument\n    It will exit the program if the commands return a\n    non-zero code\n\n    Args:\n        the commands to run\n        The settings dictionary", "docstring_tokens": ["Runs", "the", "commands", "supplied", "as", "an", "argument", "It", "will", "exit", "the", "program", "if", "the", "commands", "return", "a", "non", "-", "zero", "code"], "nwo": "tonyfischetti/sake", "score": 0.3086509652907828, "idx": 259854}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L59-L85", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Get build job.", "language": "python", "parameters": "(ctx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "Func_build_or_local", "(", "arg_0", ".", "obj", ".", "Func", "(", "'project'", ")", ",", "arg_0", ".", "obj", ".", "Func", "(", "'build'", ")", ")", "try", ":", "arg_4", "=", "PolyaxonClient", "(", ")", ".", "build_job", ".", "Func_build", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "cache", ".", "cache", "(", "config_manager", "=", "BuildJobManager", ",", "arg_4", "=", "arg_4", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not Func build job `{}`.'", ".", "format", "(", "arg_3", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "Func_build_details", "(", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"Get build job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon build -b 1 Func\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon build --build=1 --project=project_name Func\n    ```\n    \"\"\"\n    arg_1, arg_2, arg_3 = Func_build_or_local(arg_0.obj.Func('project'), arg_0.obj.Func('build'))\n    try:\n        arg_4 = PolyaxonClient().build_job.Func_build(arg_1, arg_2, arg_3)\n        cache.cache(config_manager=BuildJobManager, arg_4=arg_4)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not Func build job `{}`.'.format(arg_3))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    Func_build_details(arg_4)", "path": "polyaxon_cli/cli/build.py", "identifier": "get", "docstring": "Get build job.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    \\b\n    ```bash\n    $ polyaxon build -b 1 get\n    ```\n\n    \\b\n    ```bash\n    $ polyaxon build --build=1 --project=project_name get\n    ```", "docstring_tokens": ["Get", "build", "job", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 259855}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L72-L80", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Reads a \"data\" or \"define\" tag from the given node.", "language": "python", "parameters": "(self, workflow, start_node)", "return_statement": "return name, value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "getAttribute", "(", "'name'", ")", "arg_4", "=", "arg_2", ".", "getAttribute", "(", "'value'", ")", "return", "arg_3", ",", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Reads a \"data\" or \"define\" tag from the given node.\n\n        start_node -- the xml node (xml.dom.minidom.Node)\n        \"\"\"\n        arg_3 = arg_2.getAttribute('name')\n        arg_4 = arg_2.getAttribute('value')\n        return arg_3, arg_4", "path": "SpiffWorkflow/serializer/prettyxml.py", "identifier": "XmlSerializer.deserialize_data", "docstring": "Reads a \"data\" or \"define\" tag from the given node.\n\n        start_node -- the xml node (xml.dom.minidom.Node)", "docstring_tokens": ["Reads", "a", "data", "or", "define", "tag", "from", "the", "given", "node", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 259856}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/aggregations.py#L177-L191", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Set bookmark for starting next aggregation.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "_success_date", "(", ")", ":", "arg_1", "=", "{", "'date'", ":", "arg_0", ".", "new_bookmark", "or", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "strftime", "(", "arg_0", ".", "doc_id_suffix", ")", "}", "yield", "dict", "(", "_index", "=", "arg_0", ".", "last_index_written", ",", "_type", "=", "arg_0", ".", "bookmark_doc_type", ",", "_source", "=", "arg_1", ")", "if", "arg_0", ".", "last_index_written", ":", "bulk", "(", "arg_0", ".", "client", ",", "_success_date", "(", ")", ",", "stats_only", "=", "True", ")"], "function": "def Func(arg_0):\n        \"\"\"Set bookmark for starting next aggregation.\"\"\"\n        def _success_date():\n            arg_1 = {\n                'date': arg_0.new_bookmark or datetime.datetime.utcnow().\n                strftime(arg_0.doc_id_suffix)\n            }\n\n            yield dict(_index=arg_0.last_index_written,\n                       _type=arg_0.bookmark_doc_type,\n                       _source=arg_1)\n        if arg_0.last_index_written:\n            bulk(arg_0.client,\n                 _success_date(),\n                 stats_only=True)", "path": "invenio_stats/aggregations.py", "identifier": "StatAggregator.set_bookmark", "docstring": "Set bookmark for starting next aggregation.", "docstring_tokens": ["Set", "bookmark", "for", "starting", "next", "aggregation", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 259857}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/load/institute.py#L16-L42", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Create a new institute and add it to the database", "language": "python", "parameters": "(ctx, internal_id, display_name, sanger_recipients)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "if", "not", "arg_1", ":", "logger", ".", "warning", "(", "\"A Func has to have an internal id\"", ")", "arg_0", ".", "abort", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "arg_1", "if", "arg_3", ":", "arg_3", "=", "list", "(", "arg_3", ")", "try", ":", "load_Func", "(", "arg_4", "=", "arg_4", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "except", "Exception", "as", "e", ":", "logger", ".", "warning", "(", "e", ")", "arg_0", ".", "abort", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Create a new Func and add it to the database\n\n    \"\"\"\n    arg_4 = arg_0.obj['adapter']\n\n    if not arg_1:\n        logger.warning(\"A Func has to have an internal id\")\n        arg_0.abort()\n\n    if not arg_2:\n        arg_2 = arg_1\n\n    if arg_3:\n        arg_3 = list(arg_3)\n\n    try:\n        load_Func(\n            arg_4=arg_4,\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3\n        )\n    except Exception as e:\n        logger.warning(e)\n        arg_0.abort()", "path": "scout/commands/load/institute.py", "identifier": "institute", "docstring": "Create a new institute and add it to the database", "docstring_tokens": ["Create", "a", "new", "institute", "and", "add", "it", "to", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259858}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/revert.py#L45-L59", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Checks if a backup file of the filename in the applied patches after\n        patch exists", "language": "python", "parameters": "(self, filename, patch)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "db", ".", "is_patch", "(", "arg_2", ")", ":", "return", "arg_3", "=", "arg_0", ".", "db", ".", "patches_after", "(", "arg_2", ")", "for", "arg_2", "in", "arg_3", ":", "arg_4", "=", "arg_0", ".", "quilt_pc", "+", "File", "(", "os", ".", "path", ".", "join", "(", "arg_2", ".", "get_name", "(", ")", ",", "arg_1", ")", ")", "if", "arg_4", ".", "exists", "(", ")", ":", "raise", "QuiltError", "(", "\"File %s is modified by patch %s\"", "%", "(", "arg_1", ",", "arg_2", ".", "get_name", "(", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Checks if a backup file of the filename in the applied patches after\n        patch exists \"\"\"\n\n        if not arg_0.db.is_patch(arg_2):\n            # no patches applied\n            return\n\n        arg_3 = arg_0.db.patches_after(arg_2)\n        for arg_2 in arg_3:\n            arg_4 = arg_0.quilt_pc + File(os.path.join(arg_2.get_name(),\n                                                     arg_1))\n            if arg_4.exists():\n                raise QuiltError(\"File %s is modified by patch %s\" %\n                                 (arg_1, arg_2.get_name()))", "path": "quilt/revert.py", "identifier": "Revert._file_in_next_patches", "docstring": "Checks if a backup file of the filename in the applied patches after\n        patch exists", "docstring_tokens": ["Checks", "if", "a", "backup", "file", "of", "the", "filename", "in", "the", "applied", "patches", "after", "patch", "exists"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 259859}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py#L36-L121", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Detect profanity and match against custom and shared blacklists.", "language": "python", "parameters": "(\n            self, text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "arg_9", "=", "False", ",", "arg_10", "=", "None", ",", "**", "arg_11", ")", ":", "arg_12", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_13", "=", "{", "'Endpoint'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.config.endpoint\"", ",", "arg_0", ".", "config", ".", "endpoint", ",", "'str'", ",", "skip_quote", "=", "True", ")", "}", "arg_12", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_12", ",", "**", "arg_13", ")", "arg_14", "=", "{", "}", "if", "arg_3", "is", "not", "None", ":", "arg_14", "[", "'language'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"language\"", ",", "arg_3", ",", "'str'", ")", "if", "arg_4", "is", "not", "None", ":", "arg_14", "[", "'autocorrect'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"autocorrect\"", ",", "arg_4", ",", "'bool'", ")", "if", "arg_5", "is", "not", "None", ":", "arg_14", "[", "'PII'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"pii\"", ",", "arg_5", ",", "'bool'", ")", "if", "arg_6", "is", "not", "None", ":", "arg_14", "[", "'listId'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"list_id\"", ",", "arg_6", ",", "'str'", ")", "if", "arg_7", "is", "not", "None", ":", "arg_14", "[", "'classify'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"classify\"", ",", "arg_7", ",", "'bool'", ")", "arg_15", "=", "{", "}", "arg_15", "[", "'Accept'", "]", "=", "'application/json'", "arg_15", "[", "'Content-Type'", "]", "=", "'text/plain'", "if", "arg_8", ":", "arg_15", ".", "update", "(", "arg_8", ")", "arg_15", "[", "'Content-Type'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"text_content_type\"", ",", "arg_1", ",", "'str'", ")", "arg_16", "=", "arg_0", ".", "_client", ".", "stream_upload", "(", "arg_2", ",", "arg_10", ")", "arg_17", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_12", ",", "arg_14", ",", "arg_15", ",", "arg_16", ")", "arg_18", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_17", ",", "stream", "=", "False", ",", "**", "arg_11", ")", "if", "arg_18", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "APIErrorException", "(", "arg_0", ".", "_deserialize", ",", "arg_18", ")", "arg_19", "=", "None", "if", "arg_18", ".", "status_code", "==", "200", ":", "arg_19", "=", "arg_0", ".", "_deserialize", "(", "'Screen'", ",", "arg_18", ")", "if", "arg_9", ":", "arg_20", "=", "ClientRawResponse", "(", "arg_19", ",", "arg_18", ")", "return", "arg_20", "return", "arg_19"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3=None, arg_4=False, arg_5=False, arg_6=None, arg_7=False, arg_8=None, arg_9=False, arg_10=None, **arg_11):\n        \"\"\"Detect profanity and match against custom and shared blacklists.\n\n        Detects profanity in more than 100 languages and match against custom\n        and shared blacklists.\n\n        :param text_content_type: The content type. Possible values include:\n         'text/plain', 'text/html', 'text/xml', 'text/markdown'\n        :type text_content_type: str\n        :param text_content: Content to screen.\n        :type text_content: Generator\n        :param language: Language of the text.\n        :type language: str\n        :param autocorrect: Autocorrect text.\n        :type autocorrect: bool\n        :param pii: Detect personal identifiable information.\n        :type pii: bool\n        :param list_id: The list Id.\n        :type list_id: str\n        :param classify: Classify input.\n        :type classify: bool\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param callback: When specified, will be called with each chunk of\n         data that is streamed. The callback should take two arguments, the\n         bytes of the current chunk of data and the response object. If the\n         data is uploading, response will be None.\n        :type callback: Callable[Bytes, response=None]\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: Screen or ClientRawResponse if raw=true\n        :rtype: ~azure.cognitiveservices.vision.contentmoderator.models.Screen\n         or ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`APIErrorException<azure.cognitiveservices.vision.contentmoderator.models.APIErrorException>`\n        \"\"\"\n        # Construct URL\n        arg_12 = arg_0.Func.metadata['url']\n        arg_13 = {\n            'Endpoint': arg_0._serialize.url(\"self.config.endpoint\", arg_0.config.endpoint, 'str', skip_quote=True)\n        }\n        arg_12 = arg_0._client.format_url(arg_12, **arg_13)\n\n        # Construct parameters\n        arg_14 = {}\n        if arg_3 is not None:\n            arg_14['language'] = arg_0._serialize.query(\"language\", arg_3, 'str')\n        if arg_4 is not None:\n            arg_14['autocorrect'] = arg_0._serialize.query(\"autocorrect\", arg_4, 'bool')\n        if arg_5 is not None:\n            arg_14['PII'] = arg_0._serialize.query(\"pii\", arg_5, 'bool')\n        if arg_6 is not None:\n            arg_14['listId'] = arg_0._serialize.query(\"list_id\", arg_6, 'str')\n        if arg_7 is not None:\n            arg_14['classify'] = arg_0._serialize.query(\"classify\", arg_7, 'bool')\n\n        # Construct headers\n        arg_15 = {}\n        arg_15['Accept'] = 'application/json'\n        arg_15['Content-Type'] = 'text/plain'\n        if arg_8:\n            arg_15.update(arg_8)\n        arg_15['Content-Type'] = arg_0._serialize.header(\"text_content_type\", arg_1, 'str')\n\n        # Construct body\n        arg_16 = arg_0._client.stream_upload(arg_2, arg_10)\n\n        # Construct and send request\n        arg_17 = arg_0._client.post(arg_12, arg_14, arg_15, arg_16)\n        arg_18 = arg_0._client.send(arg_17, stream=False, **arg_11)\n\n        if arg_18.status_code not in [200]:\n            raise models.APIErrorException(arg_0._deserialize, arg_18)\n\n        arg_19 = None\n\n        if arg_18.status_code == 200:\n            arg_19 = arg_0._deserialize('Screen', arg_18)\n\n        if arg_9:\n            arg_20 = ClientRawResponse(arg_19, arg_18)\n            return arg_20\n\n        return arg_19", "path": "azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py", "identifier": "TextModerationOperations.screen_text", "docstring": "Detect profanity and match against custom and shared blacklists.\n\n        Detects profanity in more than 100 languages and match against custom\n        and shared blacklists.\n\n        :param text_content_type: The content type. Possible values include:\n         'text/plain', 'text/html', 'text/xml', 'text/markdown'\n        :type text_content_type: str\n        :param text_content: Content to screen.\n        :type text_content: Generator\n        :param language: Language of the text.\n        :type language: str\n        :param autocorrect: Autocorrect text.\n        :type autocorrect: bool\n        :param pii: Detect personal identifiable information.\n        :type pii: bool\n        :param list_id: The list Id.\n        :type list_id: str\n        :param classify: Classify input.\n        :type classify: bool\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param callback: When specified, will be called with each chunk of\n         data that is streamed. The callback should take two arguments, the\n         bytes of the current chunk of data and the response object. If the\n         data is uploading, response will be None.\n        :type callback: Callable[Bytes, response=None]\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: Screen or ClientRawResponse if raw=true\n        :rtype: ~azure.cognitiveservices.vision.contentmoderator.models.Screen\n         or ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`APIErrorException<azure.cognitiveservices.vision.contentmoderator.models.APIErrorException>`", "docstring_tokens": ["Detect", "profanity", "and", "match", "against", "custom", "and", "shared", "blacklists", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259860}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Mesh.py#L363-L368", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Whether a connection can be established between those two meshes.", "language": "python", "parameters": "(self, other)", "return_statement": "return disconnected and types_differ", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", ".", "is_mesh", "(", ")", "arg_2", "=", "not", "arg_1", ".", "is_connected", "(", ")", "and", "not", "arg_0", ".", "is_connected", "(", ")", "arg_3", "=", "arg_0", ".", "_is_consumed_mesh", "(", ")", "!=", "arg_1", ".", "_is_consumed_mesh", "(", ")", "return", "arg_2", "and", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Whether a connection can be established between those two meshes.\"\"\"\n        assert arg_1.is_mesh()\n        arg_2 = not arg_1.is_connected() and not arg_0.is_connected()\n        arg_3 = arg_0._is_consumed_mesh() != arg_1._is_consumed_mesh()\n        return arg_2 and arg_3", "path": "knittingpattern/Mesh.py", "identifier": "Mesh.can_connect_to", "docstring": "Whether a connection can be established between those two meshes.", "docstring_tokens": ["Whether", "a", "connection", "can", "be", "established", "between", "those", "two", "meshes", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 259861}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/config.py#L96-L109", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "For OS X versions before Yosemite, many launchd processes run simultaneously under\n    different users and different permission models. The simpler `asuser` trick we use\n    in Yosemite doesn't work, since it gets routed to the wrong launchd. We instead need\n    to find the running ssh-agent process and use its PID to navigate ourselves\n    to the correct launchd.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "for", "arg_0", "in", "psutil", ".", "process_iter", "(", ")", ":", "if", "arg_0", ".", "name", "(", ")", "==", "'ssh-agent'", ":", "ssh_auth_sock", "=", "subprocess", ".", "check_output", "(", "[", "'launchctl'", ",", "'bsexec'", ",", "str", "(", "arg_0", ".", "pid", ")", ",", "'launchctl'", ",", "'getenv'", ",", "'SSH_AUTH_SOCK'", "]", ")", ".", "rstrip", "(", ")", "if", "ssh_auth_sock", ":", "_set_ssh_auth_sock", "(", "ssh_auth_sock", ")", "break", "else", ":", "daemon_warnings", ".", "warn", "(", "'ssh'", ",", "'No running ssh-agent found linked to SSH_AUTH_SOCK'", ")"], "function": "def Func():\n    \"\"\"For OS X versions before Yosemite, many launchd processes run simultaneously under\n    different users and different permission models. The simpler `asuser` trick we use\n    in Yosemite doesn't work, since it gets routed to the wrong launchd. We instead need\n    to find the running ssh-agent process and use its PID to navigate ourselves\n    to the correct launchd.\"\"\"\n    for arg_0 in psutil.process_iter():\n        if arg_0.name() == 'ssh-agent':\n            ssh_auth_sock = subprocess.check_output(['launchctl', 'bsexec', str(arg_0.pid), 'launchctl', 'getenv', 'SSH_AUTH_SOCK']).rstrip()\n            if ssh_auth_sock:\n                _set_ssh_auth_sock(ssh_auth_sock)\n                break\n    else:\n        daemon_warnings.warn('ssh', 'No running ssh-agent found linked to SSH_AUTH_SOCK')", "path": "dusty/config.py", "identifier": "_load_ssh_auth_pre_yosemite", "docstring": "For OS X versions before Yosemite, many launchd processes run simultaneously under\n    different users and different permission models. The simpler `asuser` trick we use\n    in Yosemite doesn't work, since it gets routed to the wrong launchd. We instead need\n    to find the running ssh-agent process and use its PID to navigate ourselves\n    to the correct launchd.", "docstring_tokens": ["For", "OS", "X", "versions", "before", "Yosemite", "many", "launchd", "processes", "run", "simultaneously", "under", "different", "users", "and", "different", "permission", "models", ".", "The", "simpler", "asuser", "trick", "we", "use", "in", "Yosemite", "doesn", "t", "work", "since", "it", "gets", "routed", "to", "the", "wrong", "launchd", ".", "We", "instead", "need", "to", "find", "the", "running", "ssh", "-", "agent", "process", "and", "use", "its", "PID", "to", "navigate", "ourselves", "to", "the", "correct", "launchd", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 259862}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/pattern_machine.py#L183-L192", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Gets a value of `w` for use in generating a pattern.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_w", "if", "type", "(", "arg_1", ")", "is", "list", ":", "return", "arg_1", "[", "arg_0", ".", "_random", ".", "getUInt32", "(", "len", "(", "arg_1", ")", ")", "]", "else", ":", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Gets a value of `w` for use in generating a pattern.\n    \"\"\"\n    arg_1 = arg_0._w\n\n    if type(arg_1) is list:\n      return arg_1[arg_0._random.getUInt32(len(arg_1))]\n    else:\n      return arg_1", "path": "src/nupic/data/generators/pattern_machine.py", "identifier": "PatternMachine._getW", "docstring": "Gets a value of `w` for use in generating a pattern.", "docstring_tokens": ["Gets", "a", "value", "of", "w", "for", "use", "in", "generating", "a", "pattern", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259863}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/examples/extraterrestrial_maurauders.py#L200-L207", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Launches a new bolt from the player.", "language": "python", "parameters": "(self, layers, things, the_plot)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", ".", "get", "(", "'last_player_shot'", ")", "==", "arg_3", ".", "frame", ":", "return", "arg_3", "[", "'last_player_shot'", "]", "=", "arg_3", ".", "frame", "arg_4", ",", "arg_5", "=", "arg_2", "[", "'P'", "]", ".", "position", "arg_0", ".", "_teleport", "(", "(", "arg_4", "-", "1", ",", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Launches a new bolt from the player.\"\"\"\n    # We don't fire if the player fired another bolt just now.\n    if arg_3.get('last_player_shot') == arg_3.frame: return\n    arg_3['last_player_shot'] = arg_3.frame\n    # We start just above the player.\n    arg_4, arg_5 = arg_2['P'].position\n    arg_0._teleport((arg_4-1, arg_5))", "path": "examples/extraterrestrial_maurauders.py", "identifier": "UpwardLaserBoltSprite._fire", "docstring": "Launches a new bolt from the player.", "docstring_tokens": ["Launches", "a", "new", "bolt", "from", "the", "player", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 259864}
{"url": "https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/colorful/core.py#L43-L85", "sha": "919fa6da17865cc5e01e6b16119193a97d180dc9", "docstring_summary": "Translate the given RGB color into the appropriate ANSI escape code\n    for the given color mode.\n    The offset is used for the base color which is used.", "language": "python", "parameters": "(red, green, blue, offset, colormode)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_4", "==", "terminal", ".", "NO_COLORS", ":", "return", "''", ",", "''", "if", "arg_4", "==", "terminal", ".", "ANSI_8_COLORS", "or", "arg_4", "==", "terminal", ".", "ANSI_16_COLORS", ":", "arg_5", "=", "ansi", ".", "rgb_to_ansi16", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "ansi", ".", "ANSI_ESCAPE_CODE", ".", "format", "(", "code", "=", "arg_5", "+", "arg_3", "-", "ansi", ".", "FOREGROUND_COLOR_OFFSET", ")", "arg_7", "=", "ansi", ".", "ANSI_ESCAPE_CODE", ".", "format", "(", "code", "=", "arg_3", "+", "ansi", ".", "COLOR_CLOSE_OFFSET", ")", "return", "arg_6", ",", "arg_7", "if", "arg_4", "==", "terminal", ".", "ANSI_256_COLORS", ":", "arg_5", "=", "ansi", ".", "rgb_to_ansi256", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_6", "=", "ansi", ".", "ANSI_ESCAPE_CODE", ".", "format", "(", "code", "=", "'{base};5;{code}'", ".", "format", "(", "base", "=", "8", "+", "arg_3", ",", "code", "=", "arg_5", ")", ")", "arg_7", "=", "ansi", ".", "ANSI_ESCAPE_CODE", ".", "format", "(", "code", "=", "arg_3", "+", "ansi", ".", "COLOR_CLOSE_OFFSET", ")", "return", "arg_6", ",", "arg_7", "if", "arg_4", "==", "terminal", ".", "TRUE_COLORS", ":", "arg_6", "=", "ansi", ".", "ANSI_ESCAPE_CODE", ".", "format", "(", "code", "=", "'{base};2;{red};{green};{blue}'", ".", "format", "(", "base", "=", "8", "+", "arg_3", ",", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ")", "arg_7", "=", "ansi", ".", "ANSI_ESCAPE_CODE", ".", "format", "(", "code", "=", "arg_3", "+", "ansi", ".", "COLOR_CLOSE_OFFSET", ")", "return", "arg_6", ",", "arg_7", "raise", "ColorfulError", "(", "'invalid color mode \"{0}\"'", ".", "format", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Translate the given RGB color into the appropriate ANSI escape code\n    for the given color mode.\n    The offset is used for the base color which is used.\n\n    The ``colormode`` has to be one of:\n        * 0: no colors / disabled\n        * 8: use ANSI 8 colors\n        * 16: use ANSI 16 colors (same as 8 but with brightness)\n        * 256: use ANSI 256 colors\n        * 0xFFFFFF / 16777215: use 16 Million true colors\n\n    :param int red: the red channel value\n    :param int green: the green channel value\n    :param int blue: the blue channel value\n    :param int offset: the offset to use for the base color\n    :param int colormode: the color mode to use. See explanation above\n    \"\"\"\n    if arg_4 == terminal.NO_COLORS:  # colors are disabled, thus return empty string\n        return '', ''\n\n    if arg_4 == terminal.ANSI_8_COLORS or arg_4 == terminal.ANSI_16_COLORS:\n        arg_5 = ansi.rgb_to_ansi16(arg_0, arg_1, arg_2)\n        arg_6 = ansi.ANSI_ESCAPE_CODE.format(\n            code=arg_5 + arg_3 - ansi.FOREGROUND_COLOR_OFFSET)\n        arg_7 = ansi.ANSI_ESCAPE_CODE.format(code=arg_3 + ansi.COLOR_CLOSE_OFFSET)\n        return arg_6, arg_7\n\n    if arg_4 == terminal.ANSI_256_COLORS:\n        arg_5 = ansi.rgb_to_ansi256(arg_0, arg_1, arg_2)\n        arg_6 = ansi.ANSI_ESCAPE_CODE.format(code='{base};5;{code}'.format(\n            base=8 + arg_3, code=arg_5))\n        arg_7 = ansi.ANSI_ESCAPE_CODE.format(code=arg_3 + ansi.COLOR_CLOSE_OFFSET)\n        return arg_6, arg_7\n\n    if arg_4 == terminal.TRUE_COLORS:\n        arg_6 = ansi.ANSI_ESCAPE_CODE.format(code='{base};2;{red};{green};{blue}'.format(\n            base=8 + arg_3, arg_0=arg_0, arg_1=arg_1, arg_2=arg_2))\n        arg_7 = ansi.ANSI_ESCAPE_CODE.format(code=arg_3 + ansi.COLOR_CLOSE_OFFSET)\n        return arg_6, arg_7\n\n    raise ColorfulError('invalid color mode \"{0}\"'.format(arg_4))", "path": "colorful/core.py", "identifier": "translate_rgb_to_ansi_code", "docstring": "Translate the given RGB color into the appropriate ANSI escape code\n    for the given color mode.\n    The offset is used for the base color which is used.\n\n    The ``colormode`` has to be one of:\n        * 0: no colors / disabled\n        * 8: use ANSI 8 colors\n        * 16: use ANSI 16 colors (same as 8 but with brightness)\n        * 256: use ANSI 256 colors\n        * 0xFFFFFF / 16777215: use 16 Million true colors\n\n    :param int red: the red channel value\n    :param int green: the green channel value\n    :param int blue: the blue channel value\n    :param int offset: the offset to use for the base color\n    :param int colormode: the color mode to use. See explanation above", "docstring_tokens": ["Translate", "the", "given", "RGB", "color", "into", "the", "appropriate", "ANSI", "escape", "code", "for", "the", "given", "color", "mode", ".", "The", "offset", "is", "used", "for", "the", "base", "color", "which", "is", "used", "."], "nwo": "timofurrer/colorful", "score": 0.585749501312285, "idx": 259865}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/interface.py#L102-L123", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Post processes the estimations from the algorithm, removing empty\n        segments and making sure the lenghts of the boundaries and labels\n        match.", "language": "python", "parameters": "(self, est_idxs, est_labels)", "return_statement": "return est_idxs, est_labels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "in_bound_idxs", "is", "not", "None", ":", "arg_3", "=", "arg_0", ".", "_preprocess", "(", ")", "arg_2", "=", "U", ".", "synchronize_labels", "(", "arg_0", ".", "in_bound_idxs", ",", "arg_1", ",", "arg_2", ",", "arg_3", ".", "shape", "[", "0", "]", ")", "arg_1", "=", "arg_0", ".", "in_bound_idxs", "arg_1", ",", "arg_2", "=", "U", ".", "remove_empty_segments", "(", "arg_1", ",", "arg_2", ")", "assert", "len", "(", "arg_1", ")", "-", "1", "==", "len", "(", "arg_2", ")", ",", "\"Number of boundaries \"", "\"(%d) and number of labels(%d) don't match\"", "%", "(", "len", "(", "arg_1", ")", ",", "len", "(", "arg_2", ")", ")", "arg_1", "=", "np", ".", "asarray", "(", "arg_1", ",", "dtype", "=", "int", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Post processes the estimations from the algorithm, removing empty\n        segments and making sure the lenghts of the boundaries and labels\n        match.\"\"\"\n        # Make sure we are using the previously input bounds, if any\n        if arg_0.in_bound_idxs is not None:\n            arg_3 = arg_0._preprocess()\n            arg_2 = U.synchronize_labels(arg_0.in_bound_idxs, arg_1,\n                                              arg_2, arg_3.shape[0])\n            arg_1 = arg_0.in_bound_idxs\n\n        # Remove empty segments if needed\n        arg_1, arg_2 = U.remove_empty_segments(arg_1, arg_2)\n\n        assert len(arg_1) - 1 == len(arg_2), \"Number of boundaries \" \\\n            \"(%d) and number of labels(%d) don't match\" % (len(arg_1),\n                                                           len(arg_2))\n\n        # Make sure the indeces are integers\n        arg_1 = np.asarray(arg_1, dtype=int)\n\n        return arg_1, arg_2", "path": "msaf/algorithms/interface.py", "identifier": "SegmenterInterface._postprocess", "docstring": "Post processes the estimations from the algorithm, removing empty\n        segments and making sure the lenghts of the boundaries and labels\n        match.", "docstring_tokens": ["Post", "processes", "the", "estimations", "from", "the", "algorithm", "removing", "empty", "segments", "and", "making", "sure", "the", "lenghts", "of", "the", "boundaries", "and", "labels", "match", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 259866}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/plotters/array_plotters.py#L252-L272", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Get the minimum and maximum of the normalization of the array, which sets the lower and upper limits of the \\\n    colormap.", "language": "python", "parameters": "(array, norm_min, norm_max)", "return_statement": "return norm_min, norm_max", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "min", "(", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "max", "(", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Get the minimum and maximum of the normalization of the array, which sets the lower and upper limits of the \\\n    colormap.\n\n    If norm_min / norm_max are not supplied, the minimum / maximum values of the array of data are used.\n\n    Parameters\n    -----------\n    array : data.array.scaled_array.ScaledArray\n        The 2D array of data which is plotted.\n    norm_min : float or None\n        The minimum array value the colormap map spans (all values below this value are plotted the same color).\n    norm_max : float or None\n        The maximum array value the colormap map spans (all values above this value are plotted the same color).\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = arg_0.min()\n    if arg_2 is None:\n        arg_2 = arg_0.max()\n\n    return arg_1, arg_2", "path": "autolens/plotters/array_plotters.py", "identifier": "get_normalization_min_max", "docstring": "Get the minimum and maximum of the normalization of the array, which sets the lower and upper limits of the \\\n    colormap.\n\n    If norm_min / norm_max are not supplied, the minimum / maximum values of the array of data are used.\n\n    Parameters\n    -----------\n    array : data.array.scaled_array.ScaledArray\n        The 2D array of data which is plotted.\n    norm_min : float or None\n        The minimum array value the colormap map spans (all values below this value are plotted the same color).\n    norm_max : float or None\n        The maximum array value the colormap map spans (all values above this value are plotted the same color).", "docstring_tokens": ["Get", "the", "minimum", "and", "maximum", "of", "the", "normalization", "of", "the", "array", "which", "sets", "the", "lower", "and", "upper", "limits", "of", "the", "\\", "colormap", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 259867}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mattermost.py#L313-L319", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch user data.", "language": "python", "parameters": "(self, user)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_2", "=", "arg_0", ".", "RUSERS", "+", "'/'", "+", "Func", "arg_3", "=", "arg_0", ".", "_fetch", "(", "arg_2", ",", "None", ")", "return", "arg_3"], "function": "def Func(arg_0, Func):\n        \"\"\"Fetch user data.\"\"\"\n\n        arg_2 = arg_0.RUSERS + '/' + Func\n        arg_3 = arg_0._fetch(arg_2, None)\n\n        return arg_3", "path": "perceval/backends/core/mattermost.py", "identifier": "MattermostClient.user", "docstring": "Fetch user data.", "docstring_tokens": ["Fetch", "user", "data", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259868}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/analytics.py#L7-L15", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Returns participation data for the given account_id and term_id.", "language": "python", "parameters": "(self, account_id, term_id)", "return_statement": "return self._get_resource(url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "(", "\"/api/v1/accounts/sis_account_id:%s/analytics/\"", "\"terms/sis_term_id:%s/activity.json\"", ")", "%", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "_get_resource", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Returns participation data for the given account_id and term_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_participation\n        \"\"\"\n        arg_3 = (\"/api/v1/accounts/sis_account_id:%s/analytics/\"\n               \"terms/sis_term_id:%s/activity.json\") % (arg_1, arg_2)\n        return arg_0._get_resource(arg_3)", "path": "uw_canvas/analytics.py", "identifier": "Analytics.get_activity_by_account", "docstring": "Returns participation data for the given account_id and term_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_participation", "docstring_tokens": ["Returns", "participation", "data", "for", "the", "given", "account_id", "and", "term_id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 259869}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/collapse.py#L86-L107", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Collapse pairs of nodes with the given namespaces that have the given relationship.", "language": "python", "parameters": "(graph: BELGraph,\n                                victim_namespaces: Strings,\n                                survivor_namespaces: str,\n                                relations: Strings)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", ",", "arg_6", ":", "arg_3", ")", "->", "None", ":", "arg_7", "=", "build_relation_predicate", "(", "arg_6", ")", "arg_8", "=", "build_source_namespace_filter", "(", "arg_2", ")", "arg_9", "=", "build_target_namespace_filter", "(", "arg_4", ")", "arg_10", "=", "[", "arg_7", ",", "arg_8", ",", "arg_9", "]", "_collapse_edge_passing_predicates", "(", "arg_0", ",", "arg_10", "=", "arg_10", ")"], "function": "def Func(arg_0: arg_1,\n                                arg_2: arg_3,\n                                arg_4: arg_5,\n                                arg_6: arg_3) -> None:\n    \"\"\"Collapse pairs of nodes with the given namespaces that have the given relationship.\n\n    :param graph: A BEL Graph\n    :param victim_namespaces: The namespace(s) of the node to collapse\n    :param survivor_namespaces: The namespace of the node to keep\n    :param relations: The relation(s) to search\n    \"\"\"\n    arg_7 = build_relation_predicate(arg_6)\n    arg_8 = build_source_namespace_filter(arg_2)\n    arg_9 = build_target_namespace_filter(arg_4)\n\n    arg_10 = [\n        arg_7,\n        arg_8,\n        arg_9\n    ]\n\n    _collapse_edge_passing_predicates(arg_0, arg_10=arg_10)", "path": "src/pybel_tools/mutation/collapse.py", "identifier": "_collapse_edge_by_namespace", "docstring": "Collapse pairs of nodes with the given namespaces that have the given relationship.\n\n    :param graph: A BEL Graph\n    :param victim_namespaces: The namespace(s) of the node to collapse\n    :param survivor_namespaces: The namespace of the node to keep\n    :param relations: The relation(s) to search", "docstring_tokens": ["Collapse", "pairs", "of", "nodes", "with", "the", "given", "namespaces", "that", "have", "the", "given", "relationship", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 259870}
{"url": "https://github.com/MartinHjelmare/leicacam/blob/1df37bccd34884737d3b5e169fae71dd2f21f1e2/leicacam/cam.py#L183-L191", "sha": "1df37bccd34884737d3b5e169fae71dd2f21f1e2", "docstring_summary": "Flush incomming socket messages.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "debug", "(", "'Funcing incomming socket messages'", ")", "try", ":", "while", "True", ":", "arg_1", "=", "arg_0", ".", "socket", ".", "recv", "(", "arg_0", ".", "buffer_size", ")", "debug", "(", "b'< '", "+", "arg_1", ")", "except", "socket", ".", "error", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"Flush incomming socket messages.\"\"\"\n        debug('Funcing incomming socket messages')\n        try:\n            while True:\n                arg_1 = arg_0.socket.recv(arg_0.buffer_size)\n                debug(b'< ' + arg_1)\n        except socket.error:\n            pass", "path": "leicacam/cam.py", "identifier": "CAM.flush", "docstring": "Flush incomming socket messages.", "docstring_tokens": ["Flush", "incomming", "socket", "messages", "."], "nwo": "MartinHjelmare/leicacam", "score": 0.35580137387943567, "idx": 259871}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L65-L96", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "parse gene_sets input file type", "language": "python", "parameters": "(self)", "return_statement": "return gss_exist", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_libraries", "(", ")", "if", "isinstance", "(", "arg_0", ".", "gene_sets", ",", "list", ")", ":", "arg_2", "=", "arg_0", ".", "gene_sets", "elif", "isinstance", "(", "arg_0", ".", "gene_sets", ",", "str", ")", ":", "arg_2", "=", "[", "arg_4", ".", "strip", "(", ")", "for", "arg_4", "in", "arg_0", ".", "gene_sets", ".", "strip", "(", ")", ".", "split", "(", "\",\"", ")", "]", "elif", "isinstance", "(", "arg_0", ".", "gene_sets", ",", "dict", ")", ":", "arg_2", "=", "[", "arg_0", ".", "gene_sets", "]", "else", ":", "raise", "Exception", "(", "\"Error parsing enrichr libraries, please provided corrected one\"", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "if", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "arg_3", ".", "append", "(", "arg_4", ")", "continue", "if", "isinstance", "(", "arg_4", ",", "str", ")", ":", "if", "arg_4", "in", "arg_1", ":", "arg_3", ".", "append", "(", "arg_4", ")", "continue", "if", "arg_4", ".", "lower", "(", ")", ".", "endswith", "(", "\".gmt\"", ")", "and", "os", ".", "path", ".", "exists", "(", "arg_4", ")", ":", "arg_0", ".", "_logger", ".", "info", "(", "\"User Defined gene sets is given: %s\"", "%", "arg_4", ")", "with", "open", "(", "arg_4", ")", "as", "genesets", ":", "arg_5", "=", "{", "line", ".", "strip", "(", ")", ".", "split", "(", "\"\\t\"", ")", "[", "0", "]", ":", "line", ".", "strip", "(", ")", ".", "split", "(", "\"\\t\"", ")", "[", "2", ":", "]", "for", "line", "in", "genesets", ".", "readlines", "(", ")", "}", "arg_3", ".", "append", "(", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"parse gene_sets input file type\"\"\"\n\n        arg_1 = arg_0.get_libraries()\n        if isinstance(arg_0.gene_sets, list):\n            arg_2 = arg_0.gene_sets\n        elif isinstance(arg_0.gene_sets, str):\n            arg_2 = [ arg_4.strip() for arg_4 in arg_0.gene_sets.strip().split(\",\") ]\n        elif isinstance(arg_0.gene_sets, dict):\n            arg_2 = [arg_0.gene_sets]\n        else:\n            raise Exception(\"Error parsing enrichr libraries, please provided corrected one\")\n        \n        # gss: a list contain .gmt, dict, enrichr_liraries.\n        # now, convert .gmt to dict\n        arg_3 = [] \n        for arg_4 in arg_2:\n            if isinstance(arg_4, dict): \n                arg_3.append(arg_4)\n                continue\n\n            if isinstance(arg_4, str): \n                if arg_4 in arg_1: \n                    arg_3.append(arg_4)\n                    continue\n                if arg_4.lower().endswith(\".gmt\") and os.path.exists(arg_4):\n                    arg_0._logger.info(\"User Defined gene sets is given: %s\"%arg_4)\n                    with open(arg_4) as genesets:\n                        arg_5 = { line.strip().split(\"\\t\")[0]: line.strip().split(\"\\t\")[2:]\n                                        for line in genesets.readlines() }\n                    arg_3.append(arg_5)\n        return arg_3", "path": "gseapy/enrichr.py", "identifier": "Enrichr.parse_genesets", "docstring": "parse gene_sets input file type", "docstring_tokens": ["parse", "gene_sets", "input", "file", "type"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 259872}
{"url": "https://github.com/urda/nistbeacon/blob/43e0c3d1e186e71387f072daf98911abb14469dd/nistbeacon/nistbeaconvalue.py#L321-L368", "sha": "43e0c3d1e186e71387f072daf98911abb14469dd", "docstring_summary": "Convert a string of JSON which represents a NIST randomness beacon\n        value into a 'NistBeaconValue' object.", "language": "python", "parameters": "(cls, input_json: str)", "return_statement": "return cls(\n            version=required_values[cls._KEY_VERSION],\n            frequency=int(required_values[cls._KEY_FREQUENCY]),\n            timestamp=int(required_values[cls._KEY_TIMESTAMP]),\n            seed_value=required_values[cls._KEY_SEED_VALUE],\n            previous_output_value=required_values[\n                cls._KEY_PREVIOUS_OUTPUT_VALUE\n            ],\n            signature_value=required_values[cls._KEY_SIGNATURE_VALUE],\n            output_value=required_values[cls._KEY_OUTPUT_VALUE],\n            status_code=required_values[cls._KEY_STATUS_CODE],\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "'NistBeaconValue'", ":", "try", ":", "arg_3", "=", "json", ".", "loads", "(", "arg_1", ")", "except", "ValueError", ":", "return", "None", "arg_4", "=", "{", "arg_0", ".", "_KEY_FREQUENCY", ":", "None", ",", "arg_0", ".", "_KEY_OUTPUT_VALUE", ":", "None", ",", "arg_0", ".", "_KEY_PREVIOUS_OUTPUT_VALUE", ":", "None", ",", "arg_0", ".", "_KEY_SEED_VALUE", ":", "None", ",", "arg_0", ".", "_KEY_SIGNATURE_VALUE", ":", "None", ",", "arg_0", ".", "_KEY_STATUS_CODE", ":", "None", ",", "arg_0", ".", "_KEY_TIMESTAMP", ":", "None", ",", "arg_0", ".", "_KEY_VERSION", ":", "None", ",", "}", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", "in", "arg_3", ":", "arg_4", "[", "arg_5", "]", "=", "arg_3", "[", "arg_5", "]", "if", "None", "in", "arg_4", ".", "values", "(", ")", ":", "return", "None", "return", "arg_0", "(", "version", "=", "arg_4", "[", "arg_0", ".", "_KEY_VERSION", "]", ",", "frequency", "=", "int", "(", "arg_4", "[", "arg_0", ".", "_KEY_FREQUENCY", "]", ")", ",", "timestamp", "=", "int", "(", "arg_4", "[", "arg_0", ".", "_KEY_TIMESTAMP", "]", ")", ",", "seed_value", "=", "arg_4", "[", "arg_0", ".", "_KEY_SEED_VALUE", "]", ",", "previous_output_value", "=", "arg_4", "[", "arg_0", ".", "_KEY_PREVIOUS_OUTPUT_VALUE", "]", ",", "signature_value", "=", "arg_4", "[", "arg_0", ".", "_KEY_SIGNATURE_VALUE", "]", ",", "output_value", "=", "arg_4", "[", "arg_0", ".", "_KEY_OUTPUT_VALUE", "]", ",", "status_code", "=", "arg_4", "[", "arg_0", ".", "_KEY_STATUS_CODE", "]", ",", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> 'NistBeaconValue':\n        \"\"\"\n        Convert a string of JSON which represents a NIST randomness beacon\n        value into a 'NistBeaconValue' object.\n\n        :param input_json: JSON to build a 'Nist RandomnessBeaconValue' from\n        :return: A 'NistBeaconValue' object, 'None' otherwise\n        \"\"\"\n\n        try:\n            arg_3 = json.loads(arg_1)\n        except ValueError:\n            return None\n\n        # Our required values are \"must haves\". This makes it simple\n        # to verify we loaded everything out of JSON correctly.\n        arg_4 = {\n            arg_0._KEY_FREQUENCY: None,\n            arg_0._KEY_OUTPUT_VALUE: None,\n            arg_0._KEY_PREVIOUS_OUTPUT_VALUE: None,\n            arg_0._KEY_SEED_VALUE: None,\n            arg_0._KEY_SIGNATURE_VALUE: None,\n            arg_0._KEY_STATUS_CODE: None,\n            arg_0._KEY_TIMESTAMP: None,\n            arg_0._KEY_VERSION: None,\n        }\n\n        for arg_5 in arg_4:\n            if arg_5 in arg_3:\n                arg_4[arg_5] = arg_3[arg_5]\n\n        # Confirm that the required values are set, and not 'None'\n        if None in arg_4.values():\n            return None\n\n        # We have all the required values, return a node object\n        return arg_0(\n            version=arg_4[arg_0._KEY_VERSION],\n            frequency=int(arg_4[arg_0._KEY_FREQUENCY]),\n            timestamp=int(arg_4[arg_0._KEY_TIMESTAMP]),\n            seed_value=arg_4[arg_0._KEY_SEED_VALUE],\n            previous_output_value=arg_4[\n                arg_0._KEY_PREVIOUS_OUTPUT_VALUE\n            ],\n            signature_value=arg_4[arg_0._KEY_SIGNATURE_VALUE],\n            output_value=arg_4[arg_0._KEY_OUTPUT_VALUE],\n            status_code=arg_4[arg_0._KEY_STATUS_CODE],\n        )", "path": "nistbeacon/nistbeaconvalue.py", "identifier": "NistBeaconValue.from_json", "docstring": "Convert a string of JSON which represents a NIST randomness beacon\n        value into a 'NistBeaconValue' object.\n\n        :param input_json: JSON to build a 'Nist RandomnessBeaconValue' from\n        :return: A 'NistBeaconValue' object, 'None' otherwise", "docstring_tokens": ["Convert", "a", "string", "of", "JSON", "which", "represents", "a", "NIST", "randomness", "beacon", "value", "into", "a", "NistBeaconValue", "object", "."], "nwo": "urda/nistbeacon", "score": 0.2718259314615454, "idx": 259873}
{"url": "https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L204-L218", "sha": "897934d593fade0eb1998f8fadd18c91a89e5b9a", "docstring_summary": "Returns the jQuery ScrollTo plugin file according to version number.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.", "language": "python", "parameters": "(version=None)", "return_statement": "return format_html(template, static=_static_url, v=version)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_SCROLLTO'", ",", "DJFRONTEND_JQUERY_SCROLLTO_DEFAULT", ")", "if", "getattr", "(", "settings", ",", "'TEMPLATE_DEBUG'", ",", "False", ")", ":", "arg_1", "=", "'<script src=\"{static}djfrontend/js/jquery/jquery.scrollTo/{v}/jquery.scrollTo.js\"></script>'", "else", ":", "arg_1", "=", "(", "'<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/{v}/jquery.scrollTo.min.js\"></script>'", "'<script>window.jQuery.fn.scrollTo || document.write(\\'<script src=\"{static}djfrontend/js/jquery/jquery.scrollTo/{v}/jquery.scrollTo.min.js\"><\\/script>\\')</script>'", ")", "return", "format_html", "(", "arg_1", ",", "static", "=", "_static_url", ",", "v", "=", "arg_0", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Returns the jQuery ScrollTo plugin file according to version number.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.\n    \"\"\"\n    if arg_0 is None:\n        arg_0 = getattr(settings, 'DJFRONTEND_JQUERY_SCROLLTO', DJFRONTEND_JQUERY_SCROLLTO_DEFAULT)\n\n    if getattr(settings, 'TEMPLATE_DEBUG', False):\n        arg_1 = '<script src=\"{static}djfrontend/js/jquery/jquery.scrollTo/{v}/jquery.scrollTo.js\"></script>'\n    else:\n        arg_1 = (\n            '<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/{v}/jquery.scrollTo.min.js\"></script>'\n            '<script>window.jQuery.fn.scrollTo || document.write(\\'<script src=\"{static}djfrontend/js/jquery/jquery.scrollTo/{v}/jquery.scrollTo.min.js\"><\\/script>\\')</script>')\n    return format_html(arg_1, static=_static_url, v=arg_0)", "path": "djfrontend/templatetags/djfrontend.py", "identifier": "djfrontend_jquery_scrollto", "docstring": "Returns the jQuery ScrollTo plugin file according to version number.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.", "docstring_tokens": ["Returns", "the", "jQuery", "ScrollTo", "plugin", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "."], "nwo": "jonfaustman/django-frontend", "score": 0.1952535678330188, "idx": 259874}
{"url": "https://github.com/calebsmith/django-template-debug/blob/f3d52638da571164d63e5c8331d409b0743c628f/template_debug/utils.py#L70-L76", "sha": "f3d52638da571164d63e5c8331d409b0743c628f", "docstring_summary": "Given a varaible, return the list of attributes that are available inside\n    of a template", "language": "python", "parameters": "(var)", "return_statement": "return list(filter(is_valid, dir(var)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "partial", "(", "is_valid_in_template", ",", "arg_0", ")", "return", "list", "(", "filter", "(", "arg_1", ",", "dir", "(", "arg_0", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Given a varaible, return the list of attributes that are available inside\n    of a template\n    \"\"\"\n    arg_1 = partial(is_valid_in_template, arg_0)\n    return list(filter(arg_1, dir(arg_0)))", "path": "template_debug/utils.py", "identifier": "get_attributes", "docstring": "Given a varaible, return the list of attributes that are available inside\n    of a template", "docstring_tokens": ["Given", "a", "varaible", "return", "the", "list", "of", "attributes", "that", "are", "available", "inside", "of", "a", "template"], "nwo": "calebsmith/django-template-debug", "score": 0.31606306836212245, "idx": 259875}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L57-L83", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Creates a new layer from file, Layer, PIL Image.\n    \n        If img is an image file or PIL Image object,\n        Creates a new layer with the given image file.\n        The image is positioned on the canvas at x, y.\n        \n        If img is a Layer,\n        uses that layer's x and y position and name.", "language": "python", "parameters": "(self, img, x=0, y=0, name=\"\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ",", "arg_4", "=", "\"\"", ")", ":", "from", "types", "import", "StringType", "if", "isinstance", "(", "arg_1", ",", "Image", ".", "Image", ")", ":", "arg_1", "=", "arg_1", ".", "convert", "(", "\"RGBA\"", ")", "arg_0", ".", "Funcs", ".", "append", "(", "Layer", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "return", "len", "(", "arg_0", ".", "Funcs", ")", "-", "1", "if", "isinstance", "(", "arg_1", ",", "Layer", ")", ":", "arg_1", ".", "canvas", "=", "arg_0", "arg_0", ".", "Funcs", ".", "append", "(", "arg_1", ")", "return", "len", "(", "arg_0", ".", "Funcs", ")", "-", "1", "if", "type", "(", "arg_1", ")", "==", "StringType", ":", "arg_1", "=", "Image", ".", "open", "(", "arg_1", ")", "arg_1", "=", "arg_1", ".", "convert", "(", "\"RGBA\"", ")", "arg_0", ".", "Funcs", ".", "append", "(", "Layer", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ")", "return", "len", "(", "arg_0", ".", "Funcs", ")", "-", "1"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=0, arg_4=\"\"):\n    \n        \"\"\"Creates a new Func from file, Layer, PIL Image.\n    \n        If img is an image file or PIL Image object,\n        Creates a new Func with the given image file.\n        The image is positioned on the canvas at x, y.\n        \n        If img is a Layer,\n        uses that Func's x and y position and name.\n    \n        \"\"\"\n\n        from types import StringType\n        if isinstance(arg_1, Image.Image):\n            arg_1 = arg_1.convert(\"RGBA\")\n            arg_0.Funcs.append(Layer(arg_0, arg_1, arg_2, arg_3, arg_4))\n            return len(arg_0.Funcs)-1\n        if isinstance(arg_1, Layer):\n            arg_1.canvas = arg_0\n            arg_0.Funcs.append(arg_1)\n            return len(arg_0.Funcs)-1                 \n        if type(arg_1) == StringType: \n            arg_1 = Image.open(arg_1)\n            arg_1 = arg_1.convert(\"RGBA\")\n            arg_0.Funcs.append(Layer(arg_0, arg_1, arg_2, arg_3, arg_4))\n            return len(arg_0.Funcs)-1", "path": "lib/photobot/__init__.py", "identifier": "Canvas.layer", "docstring": "Creates a new layer from file, Layer, PIL Image.\n    \n        If img is an image file or PIL Image object,\n        Creates a new layer with the given image file.\n        The image is positioned on the canvas at x, y.\n        \n        If img is a Layer,\n        uses that layer's x and y position and name.", "docstring_tokens": ["Creates", "a", "new", "layer", "from", "file", "Layer", "PIL", "Image", ".", "If", "img", "is", "an", "image", "file", "or", "PIL", "Image", "object", "Creates", "a", "new", "layer", "with", "the", "given", "image", "file", ".", "The", "image", "is", "positioned", "on", "the", "canvas", "at", "x", "y", ".", "If", "img", "is", "a", "Layer", "uses", "that", "layer", "s", "x", "and", "y", "position", "and", "name", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259876}
{"url": "https://github.com/uw-it-aca/uw-restclients-gws/blob/2aa6038d5f83027bae680e52fc38c2ec0cd192c5/uw_gws/__init__.py#L182-L195", "sha": "2aa6038d5f83027bae680e52fc38c2ec0cd192c5", "docstring_summary": "Returns a count of effective members for the group identified by the\n        passed group ID.", "language": "python", "parameters": "(self, group_id)", "return_statement": "return int(count)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_valid_group_id", "(", "arg_1", ")", "arg_2", "=", "\"{}/group/{}/effective_member?view=count\"", ".", "format", "(", "arg_0", ".", "API", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_get_resource", "(", "arg_2", ")", "arg_4", "=", "arg_3", ".", "get", "(", "\"data\"", ")", ".", "get", "(", "\"count\"", ")", "return", "int", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns a count of effective members for the group identified by the\n        passed group ID.\n        \"\"\"\n        arg_0._valid_group_id(arg_1)\n\n        arg_2 = \"{}/group/{}/effective_member?view=count\".format(arg_0.API,\n                                                               arg_1)\n\n        arg_3 = arg_0._get_resource(arg_2)\n\n        arg_4 = arg_3.get(\"data\").get(\"count\")\n        return int(arg_4)", "path": "uw_gws/__init__.py", "identifier": "GWS.get_effective_member_count", "docstring": "Returns a count of effective members for the group identified by the\n        passed group ID.", "docstring_tokens": ["Returns", "a", "count", "of", "effective", "members", "for", "the", "group", "identified", "by", "the", "passed", "group", "ID", "."], "nwo": "uw-it-aca/uw-restclients-gws", "score": 0.3840156900729995, "idx": 259877}
{"url": "https://github.com/edx/edx-search/blob/476cf02b71ceba34ae7d8b798f36d60692317c55/search/elastic.py#L26-L61", "sha": "476cf02b71ceba34ae7d8b798f36d60692317c55", "docstring_summary": "Provide resultset in our desired format from elasticsearch results", "language": "python", "parameters": "(es_response)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "translate_result", "(", "arg_1", ")", ":", "arg_2", "=", "copy", ".", "copy", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "pop", "(", "\"_source\"", ")", "arg_2", ".", "update", "(", "{", "\"data\"", ":", "arg_3", ",", "\"score\"", ":", "arg_2", "[", "\"_score\"", "]", "}", ")", "return", "arg_2", "def", "translate_facet", "(", "arg_1", ")", ":", "arg_4", "=", "{", "term", "[", "\"term\"", "]", ":", "term", "[", "\"count\"", "]", "for", "term", "in", "arg_1", "[", "\"terms\"", "]", "}", "return", "{", "\"terms\"", ":", "arg_4", ",", "\"total\"", ":", "arg_1", "[", "\"total\"", "]", ",", "\"other\"", ":", "arg_1", "[", "\"other\"", "]", ",", "}", "arg_5", "=", "[", "translate_result", "(", "hit", ")", "for", "hit", "in", "arg_0", "[", "\"hits\"", "]", "[", "\"hits\"", "]", "]", "arg_6", "=", "{", "\"took\"", ":", "arg_0", "[", "\"took\"", "]", ",", "\"total\"", ":", "arg_0", "[", "\"hits\"", "]", "[", "\"total\"", "]", ",", "\"max_score\"", ":", "arg_0", "[", "\"hits\"", "]", "[", "\"max_score\"", "]", ",", "\"results\"", ":", "arg_5", ",", "}", "if", "\"facets\"", "in", "arg_0", ":", "arg_6", "[", "\"facets\"", "]", "=", "{", "facet", ":", "translate_facet", "(", "arg_0", "[", "\"facets\"", "]", "[", "facet", "]", ")", "for", "facet", "in", "arg_0", "[", "\"facets\"", "]", "}", "return", "arg_6"], "function": "def Func(arg_0):\n    \"\"\" Provide resultset in our desired format from elasticsearch results \"\"\"\n\n    def translate_result(arg_1):\n        \"\"\" Any conversion from ES result syntax into our search engine syntax \"\"\"\n        arg_2 = copy.copy(arg_1)\n        arg_3 = arg_2.pop(\"_source\")\n\n        arg_2.update({\n            \"data\": arg_3,\n            \"score\": arg_2[\"_score\"]\n        })\n\n        return arg_2\n\n    def translate_facet(arg_1):\n        \"\"\" Any conversion from ES facet syntax into our search engine sytax \"\"\"\n        arg_4 = {term[\"term\"]: term[\"count\"] for term in arg_1[\"terms\"]}\n        return {\n            \"terms\": arg_4,\n            \"total\": arg_1[\"total\"],\n            \"other\": arg_1[\"other\"],\n        }\n\n    arg_5 = [translate_result(hit) for hit in arg_0[\"hits\"][\"hits\"]]\n    arg_6 = {\n        \"took\": arg_0[\"took\"],\n        \"total\": arg_0[\"hits\"][\"total\"],\n        \"max_score\": arg_0[\"hits\"][\"max_score\"],\n        \"results\": arg_5,\n    }\n\n    if \"facets\" in arg_0:\n        arg_6[\"facets\"] = {facet: translate_facet(arg_0[\"facets\"][facet]) for facet in arg_0[\"facets\"]}\n\n    return arg_6", "path": "search/elastic.py", "identifier": "_translate_hits", "docstring": "Provide resultset in our desired format from elasticsearch results", "docstring_tokens": ["Provide", "resultset", "in", "our", "desired", "format", "from", "elasticsearch", "results"], "nwo": "edx/edx-search", "score": 0.5271177144519781, "idx": 259878}
{"url": "https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/catalog.py#L870-L897", "sha": "532f561f32b91ea8debea0573c503dd20988bf40", "docstring_summary": "Resources include feature stores, coverage stores and WMS stores, however does not include layer groups.\n        names, stores and workspaces can be provided as a comma delimited strings or as arrays, and are used for filtering.\n        Will always return an array.", "language": "python", "parameters": "(self, names=None, stores=None, workspaces=None)", "return_statement": "return resources", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "get_stores", "(", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_2", ":", "try", ":", "arg_4", ".", "extend", "(", "arg_5", ".", "Func", "(", ")", ")", "except", "FailedRequestError", ":", "continue", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "]", "elif", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_1", "=", "[", "arg_5", ".", "strip", "(", ")", "for", "arg_5", "in", "arg_1", ".", "split", "(", "','", ")", "if", "arg_5", ".", "strip", "(", ")", "]", "if", "arg_4", "and", "arg_1", ":", "return", "(", "[", "arg_6", "for", "arg_6", "in", "arg_4", "if", "arg_6", ".", "name", "in", "arg_1", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        '''\n        Resources include feature stores, coverage stores and WMS stores, however does not include layer groups.\n        names, stores and workspaces can be provided as a comma delimited strings or as arrays, and are used for filtering.\n        Will always return an array.\n        '''\n\n        arg_2 = arg_0.get_stores(\n            arg_1 = arg_2,\n            arg_3 = arg_3\n        )\n\n        arg_4 = []\n        for arg_5 in arg_2:\n            try:\n                arg_4.extend(arg_5.Func())\n            except FailedRequestError:\n                continue\n\n        if arg_1 is None:\n            arg_1 = []\n        elif isinstance(arg_1, basestring):\n            arg_1 = [arg_5.strip() for arg_5 in arg_1.split(',') if arg_5.strip()]\n\n        if arg_4 and arg_1:\n            return ([arg_6 for arg_6 in arg_4 if arg_6.name in arg_1])\n\n        return arg_4", "path": "src/geoserver/catalog.py", "identifier": "Catalog.get_resources", "docstring": "Resources include feature stores, coverage stores and WMS stores, however does not include layer groups.\n        names, stores and workspaces can be provided as a comma delimited strings or as arrays, and are used for filtering.\n        Will always return an array.", "docstring_tokens": ["Resources", "include", "feature", "stores", "coverage", "stores", "and", "WMS", "stores", "however", "does", "not", "include", "layer", "groups", ".", "names", "stores", "and", "workspaces", "can", "be", "provided", "as", "a", "comma", "delimited", "strings", "or", "as", "arrays", "and", "are", "used", "for", "filtering", ".", "Will", "always", "return", "an", "array", "."], "nwo": "boundlessgeo/gsconfig", "score": 0.7627023200281134, "idx": 259879}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/oup_package.py#L79-L101", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Logs into the specified ftp server and returns connector.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "range", "(", "CFG_FTP_CONNECTION_ATTEMPTS", ")", ":", "try", ":", "arg_0", ".", "ftp", "=", "FtpHandler", "(", "arg_0", ".", "config", ".", "OXFORD", ".", "URL", ",", "arg_0", ".", "config", ".", "OXFORD", ".", "LOGIN", ",", "arg_0", ".", "config", ".", "OXFORD", ".", "PASSWORD", ")", "arg_0", ".", "logger", ".", "debug", "(", "(", "\"Successful Funcion to the \"", "\"Oxford University Press server\"", ")", ")", "return", "except", "socket_timeout_exception", "as", "err", ":", "arg_0", ".", "logger", ".", "error", "(", "(", "'Failed to Func %d of %d times. '", "'Will sleep for %d seconds and try again.'", ")", "%", "(", "arg_1", "+", "1", ",", "CFG_FTP_CONNECTION_ATTEMPTS", ",", "CFG_FTP_TIMEOUT_SLEEP_DURATION", ")", ")", "time", ".", "sleep", "(", "CFG_FTP_TIMEOUT_SLEEP_DURATION", ")", "except", "Exception", "as", "err", ":", "arg_0", ".", "logger", ".", "error", "(", "(", "'Failed to Func to the Oxford '", "'University Press server. %s'", ")", "%", "(", "err", ",", ")", ")", "break", "raise", "LoginException", "(", "err", ")"], "function": "def Func(arg_0):\n        \"\"\"Logs into the specified ftp server and returns Funcor.\"\"\"\n        for arg_1 in range(CFG_FTP_CONNECTION_ATTEMPTS):\n            try:\n                arg_0.ftp = FtpHandler(arg_0.config.OXFORD.URL,\n                                      arg_0.config.OXFORD.LOGIN,\n                                      arg_0.config.OXFORD.PASSWORD)\n                arg_0.logger.debug((\"Successful Funcion to the \"\n                                   \"Oxford University Press server\"))\n                return\n            except socket_timeout_exception as err:\n                arg_0.logger.error(('Failed to Func %d of %d times. '\n                                   'Will sleep for %d seconds and try again.')\n                                  % (arg_1+1,\n                                     CFG_FTP_CONNECTION_ATTEMPTS,\n                                     CFG_FTP_TIMEOUT_SLEEP_DURATION))\n                time.sleep(CFG_FTP_TIMEOUT_SLEEP_DURATION)\n            except Exception as err:\n                arg_0.logger.error(('Failed to Func to the Oxford '\n                                   'University Press server. %s') % (err,))\n                break\n\n        raise LoginException(err)", "path": "harvestingkit/oup_package.py", "identifier": "OxfordPackage.connect", "docstring": "Logs into the specified ftp server and returns connector.", "docstring_tokens": ["Logs", "into", "the", "specified", "ftp", "server", "and", "returns", "connector", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259880}
{"url": "https://github.com/stratis-storage/into-dbus-python/blob/81366049671f79116bbb81c97bf621800a2f6315/src/into_dbus_python/_xformer.py#L283-L296", "sha": "81366049671f79116bbb81c97bf621800a2f6315", "docstring_summary": "Get the list of xformer functions for the given signature.", "language": "python", "parameters": "(sig)", "return_statement": "return \\\n       [(_wrapper(f), l) for (f, l) in \\\n       _XFORMER.PARSER.parseString(sig, parseAll=True)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "(", "_wrapper", "(", "arg_1", ")", ",", "arg_2", ")", "for", "(", "arg_1", ",", "arg_2", ")", "in", "_XFORMER", ".", "PARSER", ".", "parseString", "(", "arg_0", ",", "parseAll", "=", "True", ")", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Get the list of xformer functions for the given signature.\n\n    :param str sig: a signature\n    :returns: a list of xformer functions for the given signature.\n    :rtype: list of tuple of a function * str\n\n    Each function catches all TypeErrors it encounters and raises\n    corresponding IntoDPValueError exceptions.\n    \"\"\"\n    return \\\n       [(_wrapper(arg_1), arg_2) for (arg_1, arg_2) in \\\n       _XFORMER.PARSER.parseString(arg_0, parseAll=True)]", "path": "src/into_dbus_python/_xformer.py", "identifier": "xformers", "docstring": "Get the list of xformer functions for the given signature.\n\n    :param str sig: a signature\n    :returns: a list of xformer functions for the given signature.\n    :rtype: list of tuple of a function * str\n\n    Each function catches all TypeErrors it encounters and raises\n    corresponding IntoDPValueError exceptions.", "docstring_tokens": ["Get", "the", "list", "of", "xformer", "functions", "for", "the", "given", "signature", "."], "nwo": "stratis-storage/into-dbus-python", "score": 0.2751458370028208, "idx": 259881}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/mat.py#L129-L166", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "create a dict mapping model attributes to arrays", "language": "python", "parameters": "(model)", "return_statement": "return mat", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "reactions", "arg_2", "=", "arg_0", ".", "metabolites", "arg_3", "=", "OrderedDict", "(", ")", "arg_3", "[", "\"mets\"", "]", "=", "_cell", "(", "[", "met_id", "for", "met_id", "in", "create_mat_metabolite_id", "(", "arg_0", ")", "]", ")", "arg_3", "[", "\"metNames\"", "]", "=", "_cell", "(", "arg_2", ".", "list_attr", "(", "\"name\"", ")", ")", "arg_3", "[", "\"metFormulas\"", "]", "=", "_cell", "(", "[", "str", "(", "m", ".", "formula", ")", "for", "m", "in", "arg_2", "]", ")", "try", ":", "arg_3", "[", "\"metCharge\"", "]", "=", "array", "(", "arg_2", ".", "list_attr", "(", "\"charge\"", ")", ")", "*", "1.", "except", "TypeError", ":", "pass", "arg_3", "[", "\"genes\"", "]", "=", "_cell", "(", "arg_0", ".", "genes", ".", "list_attr", "(", "\"id\"", ")", ")", "arg_4", "=", "scipy_sparse", ".", "dok_matrix", "(", "(", "len", "(", "arg_0", ".", "reactions", ")", ",", "len", "(", "arg_0", ".", "genes", ")", ")", ")", "if", "min", "(", "arg_4", ".", "shape", ")", ">", "0", ":", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_0", ".", "reactions", ")", ":", "for", "arg_7", "in", "arg_6", ".", "genes", ":", "arg_4", "[", "arg_5", ",", "arg_0", ".", "genes", ".", "index", "(", "arg_7", ")", "]", "=", "1", "arg_3", "[", "\"rxnGeneMat\"", "]", "=", "arg_4", "arg_3", "[", "\"grRules\"", "]", "=", "_cell", "(", "arg_1", ".", "list_attr", "(", "\"gene_reaction_rule\"", ")", ")", "arg_3", "[", "\"rxns\"", "]", "=", "_cell", "(", "arg_1", ".", "list_attr", "(", "\"id\"", ")", ")", "arg_3", "[", "\"rxnNames\"", "]", "=", "_cell", "(", "arg_1", ".", "list_attr", "(", "\"name\"", ")", ")", "arg_3", "[", "\"subSystems\"", "]", "=", "_cell", "(", "arg_1", ".", "list_attr", "(", "\"subsystem\"", ")", ")", "arg_10", "=", "create_stoichiometric_matrix", "(", "arg_0", ")", "arg_3", "[", "\"S\"", "]", "=", "arg_10", "if", "arg_10", "is", "not", "None", "else", "[", "[", "]", "]", "arg_3", "[", "\"lb\"", "]", "=", "array", "(", "arg_1", ".", "list_attr", "(", "\"lower_bound\"", ")", ")", "*", "1.", "arg_3", "[", "\"ub\"", "]", "=", "array", "(", "arg_1", ".", "list_attr", "(", "\"upper_bound\"", ")", ")", "*", "1.", "arg_3", "[", "\"b\"", "]", "=", "array", "(", "arg_2", ".", "list_attr", "(", "\"_bound\"", ")", ")", "*", "1.", "arg_3", "[", "\"c\"", "]", "=", "array", "(", "arg_1", ".", "list_attr", "(", "\"objective_coefficient\"", ")", ")", "*", "1.", "arg_3", "[", "\"rev\"", "]", "=", "array", "(", "arg_1", ".", "list_attr", "(", "\"reversibility\"", ")", ")", "*", "1", "arg_3", "[", "\"description\"", "]", "=", "str", "(", "arg_0", ".", "id", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"create a dict mapping model attributes to arrays\"\"\"\n    arg_1 = arg_0.reactions\n    arg_2 = arg_0.metabolites\n    arg_3 = OrderedDict()\n    arg_3[\"mets\"] = _cell([met_id for met_id in create_mat_metabolite_id(arg_0)])\n    arg_3[\"metNames\"] = _cell(arg_2.list_attr(\"name\"))\n    arg_3[\"metFormulas\"] = _cell([str(m.formula) for m in arg_2])\n    try:\n        arg_3[\"metCharge\"] = array(arg_2.list_attr(\"charge\")) * 1.\n    except TypeError:\n        # can't have any None entries for charge, or this will fail\n        pass\n    arg_3[\"genes\"] = _cell(arg_0.genes.list_attr(\"id\"))\n    # make a matrix for rxnGeneMat\n    # reactions are rows, genes are columns\n    arg_4 = scipy_sparse.dok_matrix((len(arg_0.reactions),\n                                        len(arg_0.genes)))\n    if min(arg_4.shape) > 0:\n        for arg_5, arg_6 in enumerate(arg_0.reactions):\n            for arg_7 in arg_6.genes:\n                arg_4[arg_5, arg_0.genes.index(arg_7)] = 1\n        arg_3[\"rxnGeneMat\"] = arg_4\n    arg_3[\"grRules\"] = _cell(arg_1.list_attr(\"gene_reaction_rule\"))\n    arg_3[\"rxns\"] = _cell(arg_1.list_attr(\"id\"))\n    arg_3[\"rxnNames\"] = _cell(arg_1.list_attr(\"name\"))\n    arg_3[\"subSystems\"] = _cell(arg_1.list_attr(\"subsystem\"))\n    arg_10 = create_stoichiometric_matrix(arg_0)\n    arg_3[\"S\"] = arg_10 if arg_10 is not None else [[]]\n    # multiply by 1 to convert to float, working around scipy bug\n    # https://github.com/scipy/scipy/issues/4537\n    arg_3[\"lb\"] = array(arg_1.list_attr(\"lower_bound\")) * 1.\n    arg_3[\"ub\"] = array(arg_1.list_attr(\"upper_bound\")) * 1.\n    arg_3[\"b\"] = array(arg_2.list_attr(\"_bound\")) * 1.\n    arg_3[\"c\"] = array(arg_1.list_attr(\"objective_coefficient\")) * 1.\n    arg_3[\"rev\"] = array(arg_1.list_attr(\"reversibility\")) * 1\n    arg_3[\"description\"] = str(arg_0.id)\n    return arg_3", "path": "cobra/io/mat.py", "identifier": "create_mat_dict", "docstring": "create a dict mapping model attributes to arrays", "docstring_tokens": ["create", "a", "dict", "mapping", "model", "attributes", "to", "arrays"], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 259882}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L106-L116", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Replace in 'text' all occurences of any key in the given\n    dictionary by its corresponding value.  Returns the new string.", "language": "python", "parameters": "(dict, text)", "return_statement": "return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "re", ".", "compile", "(", "\"(%s)\"", "%", "\"|\"", ".", "join", "(", "map", "(", "re", ".", "escape", ",", "arg_0", ".", "keys", "(", ")", ")", ")", ")", "return", "arg_2", ".", "sub", "(", "lambda", "mo", ":", "arg_0", "[", "mo", ".", "string", "[", "mo", ".", "start", "(", ")", ":", "mo", ".", "end", "(", ")", "]", "]", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Replace in 'text' all occurences of any key in the given\n    dictionary by its corresponding value.  Returns the new string.\"\"\"\n\n    # Function by Xavier Defrang, originally found at:\n    # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330\n\n    # Create a regular expression  from the dictionary keys\n    arg_2 = re.compile(\"(%s)\" % \"|\".join(map(re.escape, arg_0.keys())))\n    # For each match, look-up corresponding value in dictionary\n    return arg_2.sub(lambda mo: arg_0[mo.string[mo.start():mo.end()]], arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/core/prompts.py", "identifier": "multiple_replace", "docstring": "Replace in 'text' all occurences of any key in the given\n    dictionary by its corresponding value.  Returns the new string.", "docstring_tokens": ["Replace", "in", "text", "all", "occurences", "of", "any", "key", "in", "the", "given", "dictionary", "by", "its", "corresponding", "value", ".", "Returns", "the", "new", "string", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259883}
{"url": "https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L153-L169", "sha": "7ef04938d80f8b646bd73d976ac9787a5b88edd9", "docstring_summary": "Helper to get optional details about named references", "language": "python", "parameters": "(name_index, name_list)", "return_statement": "return argval, argrepr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "if", "arg_1", "is", "not", "None", ":", "try", ":", "arg_2", "=", "arg_1", "[", "arg_0", "]", "except", "IndexError", ":", "raise", "ValidationError", "(", "\"Names value out of range: {}\"", ".", "format", "(", "arg_0", ")", ")", "from", "None", "arg_3", "=", "arg_2", "else", ":", "arg_3", "=", "repr", "(", "arg_2", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Helper to get optional details about named references\n\n       Returns the dereferenced name as both value and repr if the name\n       list is defined.\n       Otherwise returns the name index and its repr().\n    \"\"\"\n    arg_2 = arg_0\n    if arg_1 is not None:\n        try:\n            arg_2 = arg_1[arg_0]\n        except IndexError:\n            raise ValidationError(\"Names value out of range: {}\".format(arg_0)) from None\n        arg_3 = arg_2\n    else:\n        arg_3 = repr(arg_2)\n    return arg_2, arg_3", "path": "pyte/util.py", "identifier": "_get_name_info", "docstring": "Helper to get optional details about named references\n\n       Returns the dereferenced name as both value and repr if the name\n       list is defined.\n       Otherwise returns the name index and its repr().", "docstring_tokens": ["Helper", "to", "get", "optional", "details", "about", "named", "references"], "nwo": "Fuyukai/Pyte", "score": 0.3282631104312029, "idx": 259884}
{"url": "https://github.com/cldf/clts/blob/2798554c9c4e668bce0e4f5b0d91cf03c2d7c13a/src/pyclts/transcriptionsystem.py#L128-L130", "sha": "2798554c9c4e668bce0e4f5b0d91cf03c2d7c13a", "docstring_summary": "Normalize the string according to normalization list", "language": "python", "parameters": "(self, string)", "return_statement": "return ''.join([self._normalize.get(x, x) for x in nfd(string)])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "''", ".", "join", "(", "[", "arg_0", ".", "_Func", ".", "get", "(", "arg_2", ",", "arg_2", ")", "for", "arg_2", "in", "nfd", "(", "arg_1", ")", "]", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Normalize the string according to normalization list\"\"\"\n        return ''.join([arg_0._Func.get(arg_2, arg_2) for arg_2 in nfd(arg_1)])", "path": "src/pyclts/transcriptionsystem.py", "identifier": "TranscriptionSystem.normalize", "docstring": "Normalize the string according to normalization list", "docstring_tokens": ["Normalize", "the", "string", "according", "to", "normalization", "list"], "nwo": "cldf/clts", "score": 0.30398045944799795, "idx": 259885}
{"url": "https://github.com/ionelmc/python-tblib/blob/00be69aa97e1eb1c09282b1cdb72539c947d4515/src/tblib/__init__.py#L141-L160", "sha": "00be69aa97e1eb1c09282b1cdb72539c947d4515", "docstring_summary": "Convert a Traceback into a dictionary representation", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'tb_frame': frame,\n            'tb_lineno': self.tb_lineno,\n            'tb_next': tb_next,\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "tb_next", "is", "None", ":", "arg_1", "=", "None", "else", ":", "arg_1", "=", "arg_0", ".", "tb_next", ".", "Func", "(", ")", "arg_2", "=", "{", "'co_filename'", ":", "arg_0", ".", "tb_frame", ".", "f_code", ".", "co_filename", ",", "'co_name'", ":", "arg_0", ".", "tb_frame", ".", "f_code", ".", "co_name", ",", "}", "arg_3", "=", "{", "'f_globals'", ":", "arg_0", ".", "tb_frame", ".", "f_globals", ",", "'f_code'", ":", "arg_2", ",", "}", "return", "{", "'tb_frame'", ":", "arg_3", ",", "'tb_lineno'", ":", "arg_0", ".", "tb_lineno", ",", "'tb_next'", ":", "arg_1", ",", "}"], "function": "def Func(arg_0):\n        \"\"\"Convert a Traceback into a dictionary representation\"\"\"\n        if arg_0.tb_next is None:\n            arg_1 = None\n        else:\n            arg_1 = arg_0.tb_next.Func()\n\n        arg_2 = {\n            'co_filename': arg_0.tb_frame.f_code.co_filename,\n            'co_name': arg_0.tb_frame.f_code.co_name,\n        }\n        arg_3 = {\n            'f_globals': arg_0.tb_frame.f_globals,\n            'f_code': arg_2,\n        }\n        return {\n            'tb_frame': arg_3,\n            'tb_lineno': arg_0.tb_lineno,\n            'tb_next': arg_1,\n        }", "path": "src/tblib/__init__.py", "identifier": "Traceback.to_dict", "docstring": "Convert a Traceback into a dictionary representation", "docstring_tokens": ["Convert", "a", "Traceback", "into", "a", "dictionary", "representation"], "nwo": "ionelmc/python-tblib", "score": 0.41047498361521556, "idx": 259886}
{"url": "https://github.com/c-soft/satel_integra/blob/3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c/satel_integra/satel_integra.py#L453-L473", "sha": "3b6d2020d1e10dc5aa40f30ee4ecc0f3a053eb3c", "docstring_summary": "Basic demo of the monitoring capabilities.", "language": "python", "parameters": "(host, port)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "asyncio", ".", "get_event_loop", "(", ")", "arg_3", "=", "AsyncSatel", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "[", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "8", ",", "12", ",", "13", ",", "14", ",", "15", ",", "16", ",", "17", ",", "18", ",", "19", ",", "20", ",", "21", ",", "22", ",", "23", ",", "25", ",", "26", ",", "27", ",", "28", ",", "29", ",", "30", "]", ",", "[", "8", ",", "9", ",", "10", "]", ")", "arg_2", ".", "run_until_complete", "(", "arg_3", ".", "connect", "(", ")", ")", "arg_2", ".", "create_task", "(", "arg_3", ".", "arm", "(", "\"3333\"", ",", "1", ")", ")", "arg_2", ".", "create_task", "(", "arg_3", ".", "disarm", "(", "\"3333\"", ")", ")", "arg_2", ".", "create_task", "(", "arg_3", ".", "keep_alive", "(", ")", ")", "arg_2", ".", "create_task", "(", "arg_3", ".", "monitor_status", "(", ")", ")", "arg_2", ".", "run_forever", "(", ")", "arg_2", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Basic Func of the monitoring capabilities.\"\"\"\n    # logging.basicConfig(level=logging.DEBUG)\n\n    arg_2 = asyncio.get_event_loop()\n    arg_3 = AsyncSatel(arg_0,\n                     arg_1,\n                     arg_2,\n                     [1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 19,\n                      20, 21, 22, 23, 25, 26, 27, 28, 29, 30],\n                     [8, 9, 10]\n                     )\n\n    arg_2.run_until_complete(arg_3.connect())\n    arg_2.create_task(arg_3.arm(\"3333\", 1))\n    arg_2.create_task(arg_3.disarm(\"3333\"))\n    arg_2.create_task(arg_3.keep_alive())\n    arg_2.create_task(arg_3.monitor_status())\n\n    arg_2.run_forever()\n    arg_2.close()", "path": "satel_integra/satel_integra.py", "identifier": "demo", "docstring": "Basic demo of the monitoring capabilities.", "docstring_tokens": ["Basic", "demo", "of", "the", "monitoring", "capabilities", "."], "nwo": "c-soft/satel_integra", "score": 0.683472553404196, "idx": 259887}
{"url": "https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/config.py#L122-L161", "sha": "3dc6ad803f0b0d56586dec9542a6a06aa06cf569", "docstring_summary": "Instantiate a BlockadeConfig instance based on\n        a given dictionary of configuration values", "language": "python", "parameters": "(values)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", "[", "'containers'", "]", "arg_2", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "try", ":", "for", "arg_5", "in", "BlockadeContainerConfig", ".", "Func", "(", "arg_3", ",", "arg_4", ")", ":", "if", "arg_5", ".", "container_name", ":", "arg_6", "=", "arg_5", ".", "container_name", "arg_7", "=", "[", "c", "for", "c", "in", "arg_2", ".", "values", "(", ")", "if", "c", ".", "container_name", "==", "arg_6", "]", "if", "arg_7", ":", "raise", "BlockadeConfigError", "(", "\"Duplicate 'container_name' definition: %s\"", "%", "(", "arg_6", ")", ")", "arg_2", "[", "arg_5", ".", "name", "]", "=", "arg_5", "except", "Exception", "as", "err", ":", "raise", "BlockadeConfigError", "(", "\"Container '%s' config problem: %s\"", "%", "(", "arg_3", ",", "err", ")", ")", "arg_8", "=", "arg_0", ".", "get", "(", "'network'", ")", "if", "arg_8", ":", "arg_9", "=", "_DEFAULT_NETWORK_CONFIG", ".", "copy", "(", ")", "arg_9", ".", "update", "(", "arg_8", ")", "arg_8", "=", "arg_9", "else", ":", "arg_8", "=", "_DEFAULT_NETWORK_CONFIG", ".", "copy", "(", ")", "return", "BlockadeConfig", "(", "arg_2", ",", "arg_8", "=", "arg_8", ")", "except", "KeyError", "as", "err", ":", "raise", "BlockadeConfigError", "(", "\"Config missing value: \"", "+", "str", "(", "err", ")", ")", "except", "Exception", "as", "err", ":", "raise", "BlockadeConfigError", "(", "\"Failed to load config: \"", "+", "str", "(", "err", ")", ")"], "function": "def Func(arg_0):\n        '''\n        Instantiate a BlockadeConfig instance based on\n        a given dictionary of configuration values\n        '''\n        try:\n            arg_1 = arg_0['containers']\n            arg_2 = {}\n            for arg_3, arg_4 in arg_1.items():\n                try:\n                    # one config entry might result in many container\n                    # instances (indicated by the 'count' config value)\n                    for arg_5 in BlockadeContainerConfig.Func(arg_3, arg_4):\n                        # check for duplicate 'container_name' definitions\n                        if arg_5.container_name:\n                            arg_6 = arg_5.container_name\n                            arg_7 = [c for c in arg_2.values() if c.container_name == arg_6]\n                            if arg_7:\n                                raise BlockadeConfigError(\"Duplicate 'container_name' definition: %s\" % (arg_6))\n                        arg_2[arg_5.name] = arg_5\n                except Exception as err:\n                    raise BlockadeConfigError(\n                        \"Container '%s' config problem: %s\" % (arg_3, err))\n\n            arg_8 = arg_0.get('network')\n            if arg_8:\n                arg_9 = _DEFAULT_NETWORK_CONFIG.copy()\n                arg_9.update(arg_8)\n                arg_8 = arg_9\n            else:\n                arg_8 = _DEFAULT_NETWORK_CONFIG.copy()\n\n            return BlockadeConfig(arg_2, arg_8=arg_8)\n\n        except KeyError as err:\n            raise BlockadeConfigError(\"Config missing value: \" + str(err))\n\n        except Exception as err:\n            # TODO log this to some debug stream?\n            raise BlockadeConfigError(\"Failed to load config: \" + str(err))", "path": "blockade/config.py", "identifier": "BlockadeConfig.from_dict", "docstring": "Instantiate a BlockadeConfig instance based on\n        a given dictionary of configuration values", "docstring_tokens": ["Instantiate", "a", "BlockadeConfig", "instance", "based", "on", "a", "given", "dictionary", "of", "configuration", "values"], "nwo": "worstcase/blockade", "score": 0.7770804820985606, "idx": 259888}
{"url": "https://github.com/napalm-automation/napalm-yang/blob/998e8a933171d010b8544bcc5dc448e2b68051e2/interactive_demo/ansible/callback/selective.py#L185-L240", "sha": "998e8a933171d010b8544bcc5dc448e2b68051e2", "docstring_summary": "Run when a task finishes correctly.", "language": "python", "parameters": "(self, result, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "\"failed\"", "in", "arg_1", ".", "_result", "arg_4", "=", "\"unreachable\"", "in", "arg_1", ".", "_result", "if", "(", "\"print_action\"", "in", "arg_1", ".", "_task", ".", "tags", "or", "arg_3", "or", "arg_4", "or", "arg_0", ".", "_display", ".", "verbosity", ">", "1", ")", ":", "arg_0", ".", "_print_task", "(", ")", "arg_0", ".", "last_skipped", "=", "False", "arg_6", "=", "unicode", "(", "arg_1", ".", "_result", ".", "get", "(", "\"msg\"", ",", "\"\"", ")", ")", "or", "unicode", "(", "arg_1", ".", "_result", ".", "get", "(", "\"reason\"", ",", "\"\"", ")", ")", "or", "unicode", "(", "arg_1", ".", "_result", ".", "get", "(", "\"message\"", ",", "\"\"", ")", ")", "arg_7", "=", "[", "arg_1", ".", "_result", ".", "get", "(", "\"exception\"", ",", "None", ")", ",", "arg_1", ".", "_result", ".", "get", "(", "\"module_stderr\"", ",", "None", ")", ",", "]", "arg_7", "=", "\"\\n\"", ".", "join", "(", "[", "e", "for", "e", "in", "arg_7", "if", "e", "]", ")", ".", "strip", "(", ")", "arg_0", ".", "_print_host_or_item", "(", "arg_1", ".", "_host", ",", "arg_1", ".", "_result", ".", "get", "(", "\"changed\"", ",", "False", ")", ",", "arg_6", ",", "arg_1", ".", "_result", ".", "get", "(", "\"diff\"", ",", "None", ")", ",", "is_host", "=", "True", ",", "error", "=", "arg_3", "or", "arg_4", ",", "stdout", "=", "arg_1", ".", "_result", ".", "get", "(", "\"module_stdout\"", ",", "None", ")", ",", "arg_7", "=", "arg_7", ".", "strip", "(", ")", ",", ")", "if", "\"results\"", "in", "arg_1", ".", "_result", ":", "for", "arg_8", "in", "arg_1", ".", "_result", "[", "\"results\"", "]", ":", "arg_3", "=", "\"failed\"", "in", "arg_8", "arg_7", "=", "[", "arg_8", ".", "get", "(", "\"exception\"", ",", "None", ")", ",", "arg_8", ".", "get", "(", "\"module_stderr\"", ",", "None", ")", "]", "arg_7", "=", "\"\\n\"", ".", "join", "(", "[", "e", "for", "e", "in", "arg_7", "if", "e", "]", ")", ".", "strip", "(", ")", "arg_0", ".", "_print_host_or_item", "(", "arg_8", "[", "\"item\"", "]", ",", "arg_8", ".", "get", "(", "\"changed\"", ",", "False", ")", ",", "unicode", "(", "arg_8", ".", "get", "(", "\"msg\"", ",", "\"\"", ")", ")", ",", "arg_8", ".", "get", "(", "\"diff\"", ",", "None", ")", ",", "is_host", "=", "False", ",", "error", "=", "arg_3", ",", "stdout", "=", "arg_8", ".", "get", "(", "\"module_stdout\"", ",", "None", ")", ",", "arg_7", "=", "arg_7", ".", "strip", "(", ")", ",", ")", "else", ":", "arg_0", ".", "last_skipped", "=", "True", "print", "(", "\".\"", ",", "end", "=", "\"\"", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Run when a task finishes correctly.\"\"\"\n        arg_3 = \"failed\" in arg_1._result\n        arg_4 = \"unreachable\" in arg_1._result\n\n        if (\n            \"print_action\" in arg_1._task.tags\n            or arg_3\n            or arg_4\n            or arg_0._display.verbosity > 1\n        ):\n            arg_0._print_task()\n            arg_0.last_skipped = False\n            arg_6 = unicode(arg_1._result.get(\"msg\", \"\")) or unicode(\n                arg_1._result.get(\"reason\", \"\")\n            ) or unicode(\n                arg_1._result.get(\"message\", \"\")\n            )\n\n            arg_7 = [\n                arg_1._result.get(\"exception\", None),\n                arg_1._result.get(\"module_stderr\", None),\n            ]\n            arg_7 = \"\\n\".join([e for e in arg_7 if e]).strip()\n\n            arg_0._print_host_or_item(\n                arg_1._host,\n                arg_1._result.get(\"changed\", False),\n                arg_6,\n                arg_1._result.get(\"diff\", None),\n                is_host=True,\n                error=arg_3 or arg_4,\n                stdout=arg_1._result.get(\"module_stdout\", None),\n                arg_7=arg_7.strip(),\n            )\n\n            if \"results\" in arg_1._result:\n                for arg_8 in arg_1._result[\"results\"]:\n                    arg_3 = \"failed\" in arg_8\n\n                    arg_7 = [arg_8.get(\"exception\", None), arg_8.get(\"module_stderr\", None)]\n                    arg_7 = \"\\n\".join([e for e in arg_7 if e]).strip()\n\n                    arg_0._print_host_or_item(\n                        arg_8[\"item\"],\n                        arg_8.get(\"changed\", False),\n                        unicode(arg_8.get(\"msg\", \"\")),\n                        arg_8.get(\"diff\", None),\n                        is_host=False,\n                        error=arg_3,\n                        stdout=arg_8.get(\"module_stdout\", None),\n                        arg_7=arg_7.strip(),\n                    )\n        else:\n            arg_0.last_skipped = True\n            print(\".\", end=\"\")", "path": "interactive_demo/ansible/callback/selective.py", "identifier": "CallbackModule.v2_runner_on_ok", "docstring": "Run when a task finishes correctly.", "docstring_tokens": ["Run", "when", "a", "task", "finishes", "correctly", "."], "nwo": "napalm-automation/napalm-yang", "score": 0.2912181512296147, "idx": 259889}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/check.py#L172-L217", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return True if the affine matrix of one_img is close to the affine matrix of another_img.\n    False otherwise.", "language": "python", "parameters": "(one_img, another_img, only_check_3d=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "check_img", "(", "arg_0", ")", "arg_4", "=", "check_img", "(", "arg_1", ")", "arg_5", "=", "len", "(", "arg_3", ".", "shape", ")", "arg_6", "=", "len", "(", "arg_4", ".", "shape", ")", "if", "arg_5", "<", "3", ":", "raise", "ValueError", "(", "'Image {} has only {} dimensions, at least 3 dimensions is expected.'", ".", "format", "(", "repr_imgs", "(", "arg_3", ")", ",", "arg_5", ")", ")", "if", "arg_6", "<", "3", ":", "raise", "ValueError", "(", "'Image {} has only {} dimensions, at least 3 dimensions is expected.'", ".", "format", "(", "repr_imgs", "(", "arg_4", ")", ",", "arg_5", ")", ")", "arg_7", "=", "arg_3", ".", "get_affine", "(", ")", "arg_8", "=", "arg_4", ".", "get_affine", "(", ")", "if", "arg_2", ":", "arg_7", "=", "arg_7", "[", ":", "3", ",", ":", "3", "]", "arg_8", "=", "arg_8", "[", ":", "3", ",", ":", "3", "]", "try", ":", "return", "np", ".", "allclose", "(", "arg_7", ",", "arg_8", ")", "except", "ValueError", ":", "return", "False", "except", ":", "raise"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"Return True if the affine matrix of one_img is close to the affine matrix of another_img.\n    False otherwise.\n\n    Parameters\n    ----------\n    one_img: nibabel.Nifti1Image\n\n    another_img: nibabel.Nifti1Image\n\n    only_check_3d: bool\n        If True will extract only the 3D part of the affine matrices when they have more dimensions.\n\n    Returns\n    -------\n    bool\n\n    Raises\n    ------\n    ValueError\n\n    \"\"\"\n    arg_3 = check_img(arg_0)\n    arg_4 = check_img(arg_1)\n\n    arg_5 = len(arg_3.shape)\n    arg_6 = len(arg_4.shape)\n\n    if arg_5 < 3:\n        raise ValueError('Image {} has only {} dimensions, at least 3 dimensions is expected.'.format(repr_imgs(arg_3), arg_5))\n\n    if arg_6 < 3:\n        raise ValueError('Image {} has only {} dimensions, at least 3 dimensions is expected.'.format(repr_imgs(arg_4), arg_5))\n\n    arg_7 = arg_3.get_affine()\n    arg_8 = arg_4.get_affine()\n    if arg_2:\n        arg_7 = arg_7[:3, :3]\n        arg_8 = arg_8[:3, :3]\n\n    try:\n        return np.allclose(arg_7, arg_8)\n    except ValueError:\n        return False\n    except:\n        raise", "path": "boyle/nifti/check.py", "identifier": "have_same_affine", "docstring": "Return True if the affine matrix of one_img is close to the affine matrix of another_img.\n    False otherwise.\n\n    Parameters\n    ----------\n    one_img: nibabel.Nifti1Image\n\n    another_img: nibabel.Nifti1Image\n\n    only_check_3d: bool\n        If True will extract only the 3D part of the affine matrices when they have more dimensions.\n\n    Returns\n    -------\n    bool\n\n    Raises\n    ------\n    ValueError", "docstring_tokens": ["Return", "True", "if", "the", "affine", "matrix", "of", "one_img", "is", "close", "to", "the", "affine", "matrix", "of", "another_img", ".", "False", "otherwise", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259890}
{"url": "https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L398-L405", "sha": "b45395b1aba41301b898040acade7010e6878a08", "docstring_summary": "Clone throttles without memory", "language": "python", "parameters": "(self)", "return_statement": "return StreamThrottle(\n            read=self.read.clone(),\n            write=self.write.clone()\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "StreamThrottle", "(", "read", "=", "arg_0", ".", "read", ".", "Func", "(", ")", ",", "write", "=", "arg_0", ".", "write", ".", "Func", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Clone throttles without memory\n        \"\"\"\n        return StreamThrottle(\n            read=arg_0.read.Func(),\n            write=arg_0.write.Func()\n        )", "path": "aioftp/common.py", "identifier": "StreamThrottle.clone", "docstring": "Clone throttles without memory", "docstring_tokens": ["Clone", "throttles", "without", "memory"], "nwo": "aio-libs/aioftp", "score": 0.5742192901431463, "idx": 259891}
{"url": "https://github.com/runfalk/psycospans/blob/77a2d33cb280e7ff78252e173d702dd800f03133/psycospans/__init__.py#L36-L55", "sha": "77a2d33cb280e7ff78252e173d702dd800f03133", "docstring_summary": "Register a new range type as a PostgreSQL range.", "language": "python", "parameters": "(pgrange, pyrange, conn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "register_adapter", "(", "arg_1", ",", "partial", "(", "adapt_range", ",", "arg_0", ")", ")", "register_range_caster", "(", "arg_0", ",", "arg_1", ",", "*", "query_range_oids", "(", "arg_0", ",", "arg_2", ")", ",", "scope", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Register a new range type as a PostgreSQL range.\n\n        >>> Func(\"int4range\", intrange, conn)\n\n    The above will make sure intrange is regarded as an int4range for queries\n    and that int4ranges will be cast into intrange when fetching rows.\n\n    pgrange should be the full name including schema for the custom range type.\n\n    Note that adaption is global, meaning if a range type is passed to a regular\n    psycopg2 connection it will adapt it to its proper range type. Parsing of\n    rows from the database however is not global and just set on a per connection\n    basis.\n    \"\"\"\n\n    register_adapter(arg_1, partial(adapt_range, arg_0))\n    register_range_caster(\n        arg_0, arg_1, *query_range_oids(arg_0, arg_2), scope=arg_2)", "path": "psycospans/__init__.py", "identifier": "register_range_type", "docstring": "Register a new range type as a PostgreSQL range.\n\n        >>> register_range_type(\"int4range\", intrange, conn)\n\n    The above will make sure intrange is regarded as an int4range for queries\n    and that int4ranges will be cast into intrange when fetching rows.\n\n    pgrange should be the full name including schema for the custom range type.\n\n    Note that adaption is global, meaning if a range type is passed to a regular\n    psycopg2 connection it will adapt it to its proper range type. Parsing of\n    rows from the database however is not global and just set on a per connection\n    basis.", "docstring_tokens": ["Register", "a", "new", "range", "type", "as", "a", "PostgreSQL", "range", "."], "nwo": "runfalk/psycospans", "score": 0.0, "idx": 259892}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L2620-L2645", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "r\"\"\"Input string format of class, x, y, w, h, return list of list format.", "language": "python", "parameters": "(annotations)", "return_statement": "return ann", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "split", "(", "\"\\n\"", ")", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "arg_2", "=", "arg_2", ".", "split", "(", ")", "if", "len", "(", "arg_2", ")", "==", "5", ":", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_2", ")", ":", "if", "arg_3", "==", "0", ":", "arg_2", "[", "arg_3", "]", "=", "int", "(", "arg_2", "[", "arg_3", "]", ")", "else", ":", "arg_2", "[", "arg_3", "]", "=", "float", "(", "arg_2", "[", "arg_3", "]", ")", "arg_1", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    r\"\"\"Input string format of class, x, y, w, h, return list of list format.\n\n    Parameters\n    -----------\n    annotations : str\n        The annotations in darkent format \"class, x, y, w, h ....\" seperated by \"\\\\n\".\n\n    Returns\n    -------\n    list of list of 4 numbers\n        List of bounding box.\n\n    \"\"\"\n    arg_0 = arg_0.split(\"\\n\")\n    arg_1 = []\n    for arg_2 in arg_0:\n        arg_2 = arg_2.split()\n        if len(arg_2) == 5:\n            for arg_3, arg_4 in enumerate(arg_2):\n                if arg_3 == 0:\n                    arg_2[arg_3] = int(arg_2[arg_3])\n                else:\n                    arg_2[arg_3] = float(arg_2[arg_3])\n            arg_1.append(arg_2)\n    return arg_1", "path": "tensorlayer/prepro.py", "identifier": "parse_darknet_ann_str_to_list", "docstring": "r\"\"\"Input string format of class, x, y, w, h, return list of list format.\n\n    Parameters\n    -----------\n    annotations : str\n        The annotations in darkent format \"class, x, y, w, h ....\" seperated by \"\\\\n\".\n\n    Returns\n    -------\n    list of list of 4 numbers\n        List of bounding box.", "docstring_tokens": ["r", "Input", "string", "format", "of", "class", "x", "y", "w", "h", "return", "list", "of", "list", "format", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 259893}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L165-L169", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "Write output to the port and wait for response", "language": "python", "parameters": "(self, output, timeout=None)", "return_statement": "return self.__expect(timeout=timeout or self._timeout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "__writeln", "(", "arg_1", ")", "arg_0", ".", "_port", ".", "flush", "(", ")", "return", "arg_0", ".", "__expect", "(", "arg_2", "=", "arg_2", "or", "arg_0", ".", "_timeout", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Write output to the port and wait for response\"\"\"\n        arg_0.__writeln(arg_1)\n        arg_0._port.flush()\n        return arg_0.__expect(arg_2=arg_2 or arg_0._timeout)", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.__exchange", "docstring": "Write output to the port and wait for response", "docstring_tokens": ["Write", "output", "to", "the", "port", "and", "wait", "for", "response"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 259894}
{"url": "https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L504-L522", "sha": "3769aecbef6c83b6cd93ee72ece478ffe433ac57", "docstring_summary": "Check to see if the type is either in TYPES or fits type name", "language": "python", "parameters": "(self, type)", "return_statement": "return tdict[type]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "TYPES", ":", "return", "arg_1", "arg_2", "=", "dict", "(", "zip", "(", "TYPES", ",", "TYPES", ")", ")", "arg_2", ".", "update", "(", "{", "'line'", ":", "'lc'", ",", "'bar'", ":", "'bvs'", ",", "'pie'", ":", "'p'", ",", "'venn'", ":", "'v'", ",", "'scater'", ":", "'s'", ",", "'radar'", ":", "'r'", ",", "'meter'", ":", "'gom'", ",", "}", ")", "assert", "arg_1", "in", "arg_2", ",", "'Invalid chart type: %s'", "%", "arg_1", "return", "arg_2", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check to see if the type is either in TYPES or fits type name\n\n        Returns proper type\n        \"\"\"\n        if arg_1 in TYPES:\n            return arg_1\n        arg_2 = dict(zip(TYPES,TYPES))\n        arg_2.update({\n            'line': 'lc',\n            'bar': 'bvs',\n            'pie': 'p',\n            'venn': 'v',\n            'scater': 's',\n            'radar': 'r',\n            'meter': 'gom',\n        })\n        assert arg_1 in arg_2, 'Invalid chart type: %s'%arg_1\n        return arg_2[arg_1]", "path": "GChartWrapper/GChart.py", "identifier": "GChart.check_type", "docstring": "Check to see if the type is either in TYPES or fits type name\n\n        Returns proper type", "docstring_tokens": ["Check", "to", "see", "if", "the", "type", "is", "either", "in", "TYPES", "or", "fits", "type", "name"], "nwo": "appknox/google-chartwrapper", "score": 0.12050106452410352, "idx": 259895}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L2924-L2930", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Translate characters from lower to upper case for a particular column.", "language": "python", "parameters": "(self)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"toupper\", self), cache=self._ex._cache)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ")", ",", "cache", "=", "arg_0", ".", "_ex", ".", "_cache", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Translate characters from lower to upper case for a particular column.\n\n        :returns: new H2OFrame with all strings in the current frame converted to the uppercase.\n        \"\"\"\n        return H2OFrame._expr(expr=ExprNode(\"Func\", arg_0), cache=arg_0._ex._cache)", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.toupper", "docstring": "Translate characters from lower to upper case for a particular column.\n\n        :returns: new H2OFrame with all strings in the current frame converted to the uppercase.", "docstring_tokens": ["Translate", "characters", "from", "lower", "to", "upper", "case", "for", "a", "particular", "column", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259896}
{"url": "https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L140-L144", "sha": "aca0a05f6fcde55c94ad7cc058671a06608b01a4", "docstring_summary": "Adds the item to the control, associating the given data if not None.", "language": "python", "parameters": "(self, a_string, data=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "wx_obj", ".", "Append", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_items_dict", "[", "arg_2", "]", "=", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=None):\r\n        \"Adds the item to the control, associating the given data if not None.\"\r\n        arg_0.wx_obj.Append(arg_1, arg_2)\r\n        # reverse association:\r\n        arg_0._items_dict[arg_2] = arg_1", "path": "gui/controls/listbox.py", "identifier": "ItemContainerControl.append", "docstring": "Adds the item to the control, associating the given data if not None.", "docstring_tokens": ["Adds", "the", "item", "to", "the", "control", "associating", "the", "given", "data", "if", "not", "None", "."], "nwo": "reingart/gui2py", "score": 0.3195733390680715, "idx": 259897}
{"url": "https://github.com/Rikanishu/static-bundle/blob/2f6458cb9d9d9049b4fd829f7d6951a45d547c68/static_bundle/bundles.py#L62-L69", "sha": "2f6458cb9d9d9049b4fd829f7d6951a45d547c68", "docstring_summary": "Add single file or list of files to bundle", "language": "python", "parameters": "(self, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "arg_0", ".", "files", ".", "append", "(", "FilePath", "(", "arg_2", ",", "arg_0", ")", ")"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"\n        Add single file or list of files to bundle\n\n        :type: file_path: str|unicode\n        \"\"\"\n        for arg_2 in arg_1:\n            arg_0.files.append(FilePath(arg_2, arg_0))", "path": "static_bundle/bundles.py", "identifier": "AbstractBundle.add_file", "docstring": "Add single file or list of files to bundle\n\n        :type: file_path: str|unicode", "docstring_tokens": ["Add", "single", "file", "or", "list", "of", "files", "to", "bundle"], "nwo": "Rikanishu/static-bundle", "score": 0.0, "idx": 259898}
{"url": "https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/core.py#L45-L68", "sha": "234024ab8452ea2f41b18561377295cf2879fb20", "docstring_summary": "Use requests to fetch remote content", "language": "python", "parameters": "(self, url)", "return_statement": "return content_type.lower(), content", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "requests", ".", "get", "(", "arg_1", ")", "except", "requests", ".", "ConnectionError", ":", "raise", "exceptions", ".", "RetrieveError", "(", "'Connection fail'", ")", "if", "arg_2", ".", "status_code", ">=", "400", ":", "raise", "exceptions", ".", "RetrieveError", "(", "'Connected, but status code is %s'", "%", "(", "arg_2", ".", "status_code", ")", ")", "arg_3", "=", "arg_2", ".", "url", "arg_4", "=", "arg_2", ".", "content", "try", ":", "arg_5", "=", "arg_2", ".", "headers", "[", "'Content-Type'", "]", "except", "KeyError", ":", "arg_5", ",", "arg_6", "=", "mimetypes", ".", "guess_type", "(", "arg_3", ",", "strict", "=", "False", ")", "arg_0", ".", "response", "=", "arg_2", "return", "arg_5", ".", "lower", "(", ")", ",", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Use requests to fetch remote content\n        \"\"\"\n\n        try:\n            arg_2 = requests.get(arg_1)\n        except requests.ConnectionError:\n            raise exceptions.RetrieveError('Connection fail')\n\n        if arg_2.status_code >= 400:\n            raise exceptions.RetrieveError('Connected, but status code is %s' % (arg_2.status_code))\n\n        arg_3 = arg_2.url\n        arg_4 = arg_2.content\n\n        try:\n            arg_5 = arg_2.headers['Content-Type']\n        except KeyError:\n            arg_5, arg_6 = mimetypes.guess_type(arg_3, strict=False)\n\n        arg_0.response = arg_2\n\n        return arg_5.lower(), arg_4", "path": "haul/core.py", "identifier": "Haul.retrieve_url", "docstring": "Use requests to fetch remote content", "docstring_tokens": ["Use", "requests", "to", "fetch", "remote", "content"], "nwo": "vinta/haul", "score": 0.19860445460897727, "idx": 259899}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/filters.py#L38-L57", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Apply incoming filters only if user is staff. If not, only filter by user's ID.", "language": "python", "parameters": "(self, request, queryset, view)", "return_statement": "return queryset", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_1", ".", "user", ".", "is_staff", ":", "arg_4", "=", "arg_1", ".", "query_params", ".", "get", "(", "'email'", ",", "None", ")", "arg_5", "=", "arg_1", ".", "query_params", ".", "get", "(", "'username'", ",", "None", ")", "arg_6", "=", "{", "}", "if", "arg_4", ":", "arg_6", ".", "update", "(", "arg_4", "=", "arg_4", ")", "if", "arg_5", ":", "arg_6", ".", "update", "(", "arg_5", "=", "arg_5", ")", "if", "arg_6", ":", "arg_7", "=", "User", ".", "objects", ".", "filter", "(", "**", "arg_6", ")", ".", "values_list", "(", "'id'", ",", "flat", "=", "True", ")", "arg_2", "=", "arg_2", ".", "filter", "(", "user_id__in", "=", "arg_7", ")", "else", ":", "arg_2", "=", "arg_2", ".", "filter", "(", "user_id", "=", "arg_1", ".", "user", ".", "id", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Apply incoming filters only if user is staff. If not, only filter by user's ID.\n        \"\"\"\n        if arg_1.user.is_staff:\n            arg_4 = arg_1.query_params.get('email', None)\n            arg_5 = arg_1.query_params.get('username', None)\n            arg_6 = {}\n\n            if arg_4:\n                arg_6.update(arg_4=arg_4)\n            if arg_5:\n                arg_6.update(arg_5=arg_5)\n            if arg_6:\n                arg_7 = User.objects.filter(**arg_6).values_list('id', flat=True)\n                arg_2 = arg_2.filter(user_id__in=arg_7)\n        else:\n            arg_2 = arg_2.filter(user_id=arg_1.user.id)\n\n        return arg_2", "path": "enterprise/api/filters.py", "identifier": "EnterpriseCustomerUserFilterBackend.filter_queryset", "docstring": "Apply incoming filters only if user is staff. If not, only filter by user's ID.", "docstring_tokens": ["Apply", "incoming", "filters", "only", "if", "user", "is", "staff", ".", "If", "not", "only", "filter", "by", "user", "s", "ID", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259900}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L1136-L1151", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Calculate an ACMG classification based on a list of criteria.", "language": "python", "parameters": "(store, institute_id, case_name, variant_id, user_email, criteria)", "return_statement": "return classification", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", ",", "arg_7", "=", "institute_and_case", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "arg_8", "=", "arg_0", ".", "variant", "(", "arg_3", ")", "arg_9", "=", "arg_0", ".", "user", "(", "arg_4", ")", "arg_10", "=", "url_for", "(", "'variants.variant'", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_11", "=", "arg_0", ".", "submit_evaluation", "(", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "link", "=", "arg_10", ",", "arg_5", "=", "arg_5", ",", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Calculate an ACMG classification based on a list of criteria.\"\"\"\n    arg_6, arg_7 = institute_and_case(arg_0, arg_1, arg_2)\n    arg_8 = arg_0.variant(arg_3)\n    arg_9 = arg_0.user(arg_4)\n    arg_10 = url_for('variants.variant', arg_1=arg_1,\n                           arg_2=arg_2, arg_3=arg_3)\n    arg_11 = arg_0.submit_evaluation(\n        arg_6=arg_6,\n        arg_7=arg_7,\n        arg_8=arg_8,\n        arg_9=arg_9,\n        link=arg_10,\n        arg_5=arg_5,\n    )\n    return arg_11", "path": "scout/server/blueprints/variants/controllers.py", "identifier": "variant_acmg_post", "docstring": "Calculate an ACMG classification based on a list of criteria.", "docstring_tokens": ["Calculate", "an", "ACMG", "classification", "based", "on", "a", "list", "of", "criteria", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259901}
{"url": "https://github.com/dougalsutherland/skl-groups/blob/2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b/skl_groups/kernels/transform.py#L444-L479", "sha": "2584c10a413626c6d5f9078cdbf3dcc84e4e9a5b", "docstring_summary": "Flips the negative eigenvalues of X.", "language": "python", "parameters": "(self, X, y=None)", "return_statement": "return X", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_1", ".", "shape", "[", "0", "]", "if", "arg_1", ".", "shape", "!=", "(", "arg_3", ",", "arg_3", ")", ":", "raise", "TypeError", "(", "\"Input must be a square matrix.\"", ")", "arg_4", "=", "get_memory", "(", "arg_0", ".", "memory", ")", "arg_5", "=", "not", "arg_0", ".", "copy", "and", "arg_0", ".", "negatives_likely", "arg_6", ",", "arg_7", "=", "arg_4", ".", "cache", "(", "scipy", ".", "linalg", ".", "eigh", ",", "ignore", "=", "[", "'overwrite_a'", "]", ")", "(", "arg_1", ",", "overwrite_a", "=", "arg_5", ")", "arg_6", "=", "arg_6", "[", ":", ",", "None", "]", "arg_0", ".", "clip_", "=", "np", ".", "dot", "(", "arg_7", ",", "np", ".", "sign", "(", "arg_6", ")", "*", "arg_7", ".", "T", ")", "if", "arg_5", "or", "arg_6", "[", "0", ",", "0", "]", "<", "0", ":", "del", "arg_1", "np", ".", "abs", "(", "arg_6", ",", "out", "=", "arg_6", ")", "arg_1", "=", "np", ".", "dot", "(", "arg_7", ",", "arg_6", "*", "arg_7", ".", "T", ")", "del", "arg_6", ",", "arg_7", "arg_1", "=", "Symmetrize", "(", "copy", "=", "False", ")", ".", "Func", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        Flips the negative eigenvalues of X.\n\n        Parameters\n        ----------\n        X : array, shape [n, n]\n            The *symmetric* input similarities. If X is asymmetric, it will be\n            treated as if it were symmetric based on its lower-triangular part.\n\n        Returns\n        -------\n        Xt : array, shape [n, n]\n            The transformed training similarities.\n        '''\n        arg_3 = arg_1.shape[0]\n        if arg_1.shape != (arg_3, arg_3):\n            raise TypeError(\"Input must be a square matrix.\")\n\n        arg_4 = get_memory(arg_0.memory)\n        arg_5 = not arg_0.copy and arg_0.negatives_likely\n        arg_6, arg_7 = arg_4.cache(scipy.linalg.eigh, ignore=['overwrite_a'])(\n            arg_1, overwrite_a=arg_5)\n        arg_6 = arg_6[:, None]\n\n        arg_0.clip_ = np.dot(arg_7, np.sign(arg_6) * arg_7.T)\n\n        if arg_5 or arg_6[0, 0] < 0:\n            del arg_1\n            np.abs(arg_6, out=arg_6)\n            arg_1 = np.dot(arg_7, arg_6 * arg_7.T)\n            del arg_6, arg_7\n\n            # should be symmetric, but make sure because floats\n            arg_1 = Symmetrize(copy=False).Func(arg_1)\n        return arg_1", "path": "skl_groups/kernels/transform.py", "identifier": "FlipPSD.fit_transform", "docstring": "Flips the negative eigenvalues of X.\n\n        Parameters\n        ----------\n        X : array, shape [n, n]\n            The *symmetric* input similarities. If X is asymmetric, it will be\n            treated as if it were symmetric based on its lower-triangular part.\n\n        Returns\n        -------\n        Xt : array, shape [n, n]\n            The transformed training similarities.", "docstring_tokens": ["Flips", "the", "negative", "eigenvalues", "of", "X", "."], "nwo": "dougalsutherland/skl-groups", "score": 0.1940526577236167, "idx": 259902}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/transform.py#L496-L535", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Geometric function using cylindrical coordinates.", "language": "python", "parameters": "(script, r_func='r', theta_func='theta', z_func='z')", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'r'", ",", "arg_2", "=", "'theta'", ",", "arg_3", "=", "'z'", ")", ":", "arg_4", "=", "'sqrt(x^2+y^2)'", "if", "isinstance", "(", "arg_0", ",", "FilterScript", ")", "and", "arg_0", ".", "ml_version", ">=", "'2016.12'", ":", "arg_5", "=", "'atan2(y, x)'", "else", ":", "arg_5", "=", "mp_func", ".", "mp_atan2", "(", "'y'", ",", "'x'", ")", "arg_1", "=", "re", ".", "sub", "(", "r\"\\br\\b\"", ",", "arg_4", ",", "arg_1", ")", ".", "replace", "(", "'theta'", ",", "arg_5", ")", "arg_2", "=", "re", ".", "sub", "(", "r\"\\br\\b\"", ",", "arg_4", ",", "arg_2", ")", ".", "replace", "(", "'theta'", ",", "arg_5", ")", "arg_3", "=", "re", ".", "sub", "(", "r\"\\br\\b\"", ",", "arg_4", ",", "arg_3", ")", ".", "replace", "(", "'theta'", ",", "arg_5", ")", "arg_6", "=", "'(r)*cos(theta)'", ".", "replace", "(", "'r'", ",", "arg_1", ")", ".", "replace", "(", "'theta'", ",", "arg_2", ")", "arg_7", "=", "'(r)*sin(theta)'", ".", "replace", "(", "'r'", ",", "arg_1", ")", ".", "replace", "(", "'theta'", ",", "arg_2", ")", "vert_function", "(", "arg_0", ",", "arg_6", ",", "arg_7", ",", "arg_3", ")", "return", "None"], "function": "def Func(arg_0, arg_1='r', arg_2='theta', arg_3='z'):\n    \"\"\"Geometric function using cylindrical coordinates.\n\n    Define functions in Z up cylindrical coordinates, with radius 'r',\n    angle 'theta', and height 'z'\n\n    See \"function\" docs for additional usage info and accepted parameters.\n\n    Args:\n        r_func (str): function to generate new coordinates for radius\n        theta_func (str): function to generate new coordinates for angle.\n            0 degrees is on the +X axis.\n        z_func (str): function to generate new coordinates for height\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA\n    \"\"\"\n\n    arg_4 = 'sqrt(x^2+y^2)'\n    # In newer MeshLab atan2 is builtin to muparser\n    if isinstance(arg_0, FilterScript) and arg_0.ml_version >= '2016.12':\n        arg_5 = 'atan2(y, x)'\n    else:\n        arg_5 = mp_func.mp_atan2('y', 'x')\n\n    # Use re matching to match whole word; this prevents matching\n    # 'sqrt' and 'rint' when replacing 'r'\n    arg_1 = re.sub(r\"\\br\\b\", arg_4, arg_1).replace('theta', arg_5)\n    arg_2 = re.sub(r\"\\br\\b\", arg_4, arg_2).replace('theta', arg_5)\n    arg_3 = re.sub(r\"\\br\\b\", arg_4, arg_3).replace('theta', arg_5)\n\n    arg_6 = '(r)*cos(theta)'.replace('r', arg_1).replace('theta', arg_2)\n    arg_7 = '(r)*sin(theta)'.replace('r', arg_1).replace('theta', arg_2)\n\n    vert_function(arg_0, arg_6, arg_7, arg_3)\n    return None", "path": "meshlabxml/transform.py", "identifier": "function_cyl_co", "docstring": "Geometric function using cylindrical coordinates.\n\n    Define functions in Z up cylindrical coordinates, with radius 'r',\n    angle 'theta', and height 'z'\n\n    See \"function\" docs for additional usage info and accepted parameters.\n\n    Args:\n        r_func (str): function to generate new coordinates for radius\n        theta_func (str): function to generate new coordinates for angle.\n            0 degrees is on the +X axis.\n        z_func (str): function to generate new coordinates for height\n\n    Layer stack:\n        No impacts\n\n    MeshLab versions:\n        2016.12\n        1.3.4BETA", "docstring_tokens": ["Geometric", "function", "using", "cylindrical", "coordinates", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 259903}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_format.py#L11-L167", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Makes a pretty and easy-to-doctest string representation!", "language": "python", "parameters": "(data, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'extensions'", ",", "None", ")", "arg_3", "=", "arg_1", ".", "get", "(", "'_return_info'", ",", "False", ")", "arg_1", "[", "'_root_info'", "]", "=", "_rectify_root_info", "(", "arg_1", ".", "get", "(", "'_root_info'", ",", "None", ")", ")", "arg_4", "=", "None", "arg_5", "=", "None", "if", "arg_2", ":", "arg_6", "=", "arg_2", ".", "lookup", "(", "arg_0", ")", "if", "arg_6", "is", "not", "None", ":", "arg_4", "=", "arg_6", "(", "arg_0", ",", "**", "arg_1", ")", "if", "arg_4", "is", "None", ":", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "arg_4", ",", "arg_5", "=", "_format_dict", "(", "arg_0", ",", "**", "arg_1", ")", "elif", "isinstance", "(", "arg_0", ",", "(", "list", ",", "tuple", ",", "set", ",", "frozenset", ")", ")", ":", "arg_4", ",", "arg_5", "=", "_format_list", "(", "arg_0", ",", "**", "arg_1", ")", "if", "arg_4", "is", "None", ":", "arg_6", "=", "_FORMATTER_EXTENSIONS", ".", "lookup", "(", "arg_0", ")", "if", "arg_6", "is", "not", "None", ":", "arg_4", "=", "arg_6", "(", "arg_0", ",", "**", "arg_1", ")", "else", ":", "arg_4", "=", "_format_object", "(", "arg_0", ",", "**", "arg_1", ")", "if", "arg_3", ":", "arg_5", "=", "_rectify_leaf_info", "(", "arg_5", ")", "return", "arg_4", ",", "arg_5", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"\n    Makes a pretty and easy-to-doctest string representation!\n\n    This is an alternative to repr, and `pprint.pformat` that attempts to be\n    both more configurable and generate output that is consistent between\n    python versions.\n\n    Notes:\n        This function has many keyword arguments that can be used to customize\n        the final representation. For convinience some of the more frequently\n        used kwargs have short aliases. See `Args` for more details.\n\n    Args:\n        data (object): an arbitrary python object\n        **kwargs: see `the Kwargs` section\n\n    Kwargs:\n        si, stritems, (bool):\n            dict/list items use str instead of repr\n\n        strkeys, sk (bool):\n            dict keys use str instead of repr\n\n        strvals, sv (bool):\n            dict values use str instead of repr\n\n        nl, newlines (int | bool):\n            number of top level nestings to place a newline after. If true all\n            items are followed by newlines regardless of nesting level.\n            Defaults to 1 for lists and True for dicts.\n\n        nobr, nobraces (bool, default=False):\n            if True, text will not contain outer braces for containers\n\n        cbr, compact_brace (bool, default=False):\n            if True, braces are compactified (i.e. they will not have newlines\n            placed directly after them, think java / K&R / 1TBS)\n\n        trailsep, trailing_sep (bool):\n            if True, a separator is placed after the last item in a sequence.\n            By default this is True if there are any `nl > 0`.\n\n        explicit (bool, default=False):\n            changes dict representation from `{k1: v1, ...}` to\n            `dict(k1=v1, ...)`.\n\n        precision (int, default=None):\n            if specified floats are formatted with this precision\n\n        kvsep (str, default=': '):\n            separator between keys and values\n\n        itemsep (str, default=' '):\n            separator between items\n\n        sort (bool):\n            if True, attempts to sort all unordered collections in the returned\n            text. NOTE: currently if True this will sort lists, this may not be\n            a correct thing to do, as such the behavior of this arg is subject\n            to change.\n\n        suppress_small (bool):\n            passed to `numpy.array2string` for ndarrays\n\n        max_line_width (int):\n            passed to `numpy.array2string` for ndarrays\n\n        with_dtype (bool):\n            only relevant to ndarrays. if True includes the dtype.\n\n    Returns:\n        str: outstr: output string\n\n    Notes:\n        There are also internal kwargs, which should not be used:\n            _return_info (bool):  return information about child context\n            _root_info (depth): information about parent context\n\n    CommandLine:\n        python -m ubelt.util_format Func:0\n        python -m ubelt.util_format Func:1\n\n    Example:\n        >>> from ubelt.util_format import *\n        >>> import ubelt as ub\n        >>> dict_ = {\n        ...     'custom_types': [slice(0, 1, None), 1/3],\n        ...     'nest_dict': {'k1': [1, 2, {3: {4, 5}}],\n        ...                   'key2': [1, 2, {3: {4, 5}}],\n        ...                   'key3': [1, 2, {3: {4, 5}}],\n        ...                   },\n        ...     'nest_dict2': {'k': [1, 2, {3: {4, 5}}]},\n        ...     'nested_tuples': [tuple([1]), tuple([2, 3]), frozenset([4, 5, 6])],\n        ...     'one_tup': tuple([1]),\n        ...     'simple_dict': {'spam': 'eggs', 'ham': 'jam'},\n        ...     'simple_list': [1, 2, 'red', 'blue'],\n        ...     'odict': ub.odict([(1, '1'), (2, '2')]),\n        ... }\n        >>> result = Func(dict_, nl=3, precision=2); print(result)\n        >>> result = Func(dict_, nl=2, precision=2); print(result)\n        >>> result = Func(dict_, nl=1, precision=2); print(result)\n        >>> result = Func(dict_, nl=1, precision=2, itemsep='', explicit=True); print(result)\n        >>> result = Func(dict_, nl=1, precision=2, nobr=1, itemsep='', explicit=True); print(result)\n        >>> result = Func(dict_, nl=3, precision=2, cbr=True); print(result)\n        >>> result = Func(dict_, nl=3, precision=2, si=True); print(result)\n        >>> result = Func(dict_, nl=3, sort=True); print(result)\n        >>> result = Func(dict_, nl=3, sort=False, trailing_sep=False); print(result)\n        >>> result = Func(dict_, nl=3, sort=False, trailing_sep=False, nobr=True); print(result)\n\n    Example:\n        >>> from ubelt.util_format import *\n        >>> def _nest(d, w):\n        ...     if d == 0:\n        ...         return {}\n        ...     else:\n        ...         return {'n{}'.format(d): _nest(d - 1, w + 1), 'm{}'.format(d): _nest(d - 1, w + 1)}\n        >>> dict_ = _nest(d=4, w=1)\n        >>> result = Func(dict_, nl=6, precision=2, cbr=1)\n        >>> print('---')\n        >>> print(result)\n        >>> result = Func(dict_, nl=-1, precision=2)\n        >>> print('---')\n        >>> print(result)\n    \"\"\"\n    arg_2 = arg_1.get('extensions', None)\n\n    arg_3 = arg_1.get('_return_info', False)\n    arg_1['_root_info'] = _rectify_root_info(arg_1.get('_root_info', None))\n\n    arg_4 = None\n    arg_5 = None\n\n    if arg_2:\n        arg_6 = arg_2.lookup(arg_0)\n        if arg_6 is not None:\n            arg_4 = arg_6(arg_0, **arg_1)\n\n    if arg_4 is None:\n        if isinstance(arg_0, dict):\n            arg_4, arg_5 = _format_dict(arg_0, **arg_1)\n        elif isinstance(arg_0, (list, tuple, set, frozenset)):\n            arg_4, arg_5 = _format_list(arg_0, **arg_1)\n\n    if arg_4 is None:\n        # check any globally registered functions for special formatters\n        arg_6 = _FORMATTER_EXTENSIONS.lookup(arg_0)\n        if arg_6 is not None:\n            arg_4 = arg_6(arg_0, **arg_1)\n        else:\n            arg_4 = _format_object(arg_0, **arg_1)\n\n    if arg_3:\n        arg_5 = _rectify_leaf_info(arg_5)\n        return arg_4, arg_5\n    else:\n        return arg_4", "path": "ubelt/util_format.py", "identifier": "repr2", "docstring": "Makes a pretty and easy-to-doctest string representation!\n\n    This is an alternative to repr, and `pprint.pformat` that attempts to be\n    both more configurable and generate output that is consistent between\n    python versions.\n\n    Notes:\n        This function has many keyword arguments that can be used to customize\n        the final representation. For convinience some of the more frequently\n        used kwargs have short aliases. See `Args` for more details.\n\n    Args:\n        data (object): an arbitrary python object\n        **kwargs: see `the Kwargs` section\n\n    Kwargs:\n        si, stritems, (bool):\n            dict/list items use str instead of repr\n\n        strkeys, sk (bool):\n            dict keys use str instead of repr\n\n        strvals, sv (bool):\n            dict values use str instead of repr\n\n        nl, newlines (int | bool):\n            number of top level nestings to place a newline after. If true all\n            items are followed by newlines regardless of nesting level.\n            Defaults to 1 for lists and True for dicts.\n\n        nobr, nobraces (bool, default=False):\n            if True, text will not contain outer braces for containers\n\n        cbr, compact_brace (bool, default=False):\n            if True, braces are compactified (i.e. they will not have newlines\n            placed directly after them, think java / K&R / 1TBS)\n\n        trailsep, trailing_sep (bool):\n            if True, a separator is placed after the last item in a sequence.\n            By default this is True if there are any `nl > 0`.\n\n        explicit (bool, default=False):\n            changes dict representation from `{k1: v1, ...}` to\n            `dict(k1=v1, ...)`.\n\n        precision (int, default=None):\n            if specified floats are formatted with this precision\n\n        kvsep (str, default=': '):\n            separator between keys and values\n\n        itemsep (str, default=' '):\n            separator between items\n\n        sort (bool):\n            if True, attempts to sort all unordered collections in the returned\n            text. NOTE: currently if True this will sort lists, this may not be\n            a correct thing to do, as such the behavior of this arg is subject\n            to change.\n\n        suppress_small (bool):\n            passed to `numpy.array2string` for ndarrays\n\n        max_line_width (int):\n            passed to `numpy.array2string` for ndarrays\n\n        with_dtype (bool):\n            only relevant to ndarrays. if True includes the dtype.\n\n    Returns:\n        str: outstr: output string\n\n    Notes:\n        There are also internal kwargs, which should not be used:\n            _return_info (bool):  return information about child context\n            _root_info (depth): information about parent context\n\n    CommandLine:\n        python -m ubelt.util_format repr2:0\n        python -m ubelt.util_format repr2:1\n\n    Example:\n        >>> from ubelt.util_format import *\n        >>> import ubelt as ub\n        >>> dict_ = {\n        ...     'custom_types': [slice(0, 1, None), 1/3],\n        ...     'nest_dict': {'k1': [1, 2, {3: {4, 5}}],\n        ...                   'key2': [1, 2, {3: {4, 5}}],\n        ...                   'key3': [1, 2, {3: {4, 5}}],\n        ...                   },\n        ...     'nest_dict2': {'k': [1, 2, {3: {4, 5}}]},\n        ...     'nested_tuples': [tuple([1]), tuple([2, 3]), frozenset([4, 5, 6])],\n        ...     'one_tup': tuple([1]),\n        ...     'simple_dict': {'spam': 'eggs', 'ham': 'jam'},\n        ...     'simple_list': [1, 2, 'red', 'blue'],\n        ...     'odict': ub.odict([(1, '1'), (2, '2')]),\n        ... }\n        >>> result = repr2(dict_, nl=3, precision=2); print(result)\n        >>> result = repr2(dict_, nl=2, precision=2); print(result)\n        >>> result = repr2(dict_, nl=1, precision=2); print(result)\n        >>> result = repr2(dict_, nl=1, precision=2, itemsep='', explicit=True); print(result)\n        >>> result = repr2(dict_, nl=1, precision=2, nobr=1, itemsep='', explicit=True); print(result)\n        >>> result = repr2(dict_, nl=3, precision=2, cbr=True); print(result)\n        >>> result = repr2(dict_, nl=3, precision=2, si=True); print(result)\n        >>> result = repr2(dict_, nl=3, sort=True); print(result)\n        >>> result = repr2(dict_, nl=3, sort=False, trailing_sep=False); print(result)\n        >>> result = repr2(dict_, nl=3, sort=False, trailing_sep=False, nobr=True); print(result)\n\n    Example:\n        >>> from ubelt.util_format import *\n        >>> def _nest(d, w):\n        ...     if d == 0:\n        ...         return {}\n        ...     else:\n        ...         return {'n{}'.format(d): _nest(d - 1, w + 1), 'm{}'.format(d): _nest(d - 1, w + 1)}\n        >>> dict_ = _nest(d=4, w=1)\n        >>> result = repr2(dict_, nl=6, precision=2, cbr=1)\n        >>> print('---')\n        >>> print(result)\n        >>> result = repr2(dict_, nl=-1, precision=2)\n        >>> print('---')\n        >>> print(result)", "docstring_tokens": ["Makes", "a", "pretty", "and", "easy", "-", "to", "-", "doctest", "string", "representation!"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 259904}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/node_utils.py#L164-L248", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Expand all reactions to simple subject-predicate-object networks.", "language": "python", "parameters": "(graph: BELGraph, accept_unqualified_edges: bool = True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "True", ")", "->", "None", ":", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "list", "(", "arg_0", ".", "edges", "(", "data", "=", "True", ")", ")", ":", "if", "CITATION", "not", "in", "arg_6", "and", "arg_2", ":", "_reaction_cartesion_expansion_unqualified_helper", "(", "arg_0", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "continue", "if", "isinstance", "(", "arg_4", ",", "Reaction", ")", "and", "isinstance", "(", "arg_5", ",", "Reaction", ")", ":", "arg_7", "=", "_get_catalysts_in_reaction", "(", "arg_4", ")", "|", "_get_catalysts_in_reaction", "(", "arg_5", ")", "for", "arg_8", ",", "arg_9", "in", "chain", "(", "itt", ".", "product", "(", "arg_4", ".", "reactants", ",", "arg_4", ".", "products", ")", ",", "itt", ".", "product", "(", "arg_5", ".", "reactants", ",", "arg_5", ".", "products", ")", ")", ":", "if", "arg_8", "in", "arg_7", "or", "arg_9", "in", "arg_7", ":", "continue", "arg_0", ".", "add_increases", "(", "arg_8", ",", "arg_9", ",", "citation", "=", "arg_6", ".", "get", "(", "CITATION", ")", ",", "evidence", "=", "arg_6", ".", "get", "(", "EVIDENCE", ")", ",", "annotations", "=", "arg_6", ".", "get", "(", "ANNOTATIONS", ")", ",", ")", "for", "arg_9", ",", "arg_8", "in", "itt", ".", "product", "(", "arg_4", ".", "products", ",", "arg_4", ".", "reactants", ")", ":", "if", "arg_8", "in", "arg_7", "or", "arg_9", "in", "arg_7", ":", "continue", "arg_0", ".", "add_qualified_edge", "(", "arg_9", ",", "arg_8", ",", "relation", "=", "arg_6", "[", "RELATION", "]", ",", "citation", "=", "arg_6", ".", "get", "(", "CITATION", ")", ",", "evidence", "=", "arg_6", ".", "get", "(", "EVIDENCE", ")", ",", "annotations", "=", "arg_6", ".", "get", "(", "ANNOTATIONS", ")", ",", ")", "elif", "isinstance", "(", "arg_4", ",", "Reaction", ")", ":", "arg_7", "=", "_get_catalysts_in_reaction", "(", "arg_4", ")", "for", "arg_9", "in", "arg_4", ".", "products", ":", "if", "arg_9", "in", "arg_7", ":", "continue", "if", "arg_5", "not", "in", "arg_4", ".", "products", "and", "arg_5", "not", "in", "arg_4", ".", "reactants", ":", "arg_0", ".", "add_increases", "(", "arg_9", ",", "arg_5", ",", "citation", "=", "arg_6", ".", "get", "(", "CITATION", ")", ",", "evidence", "=", "arg_6", ".", "get", "(", "EVIDENCE", ")", ",", "annotations", "=", "arg_6", ".", "get", "(", "ANNOTATIONS", ")", ",", ")", "for", "arg_8", "in", "arg_4", ".", "reactants", ":", "arg_0", ".", "add_increases", "(", "arg_8", ",", "arg_9", ",", "citation", "=", "arg_6", ".", "get", "(", "CITATION", ")", ",", "evidence", "=", "arg_6", ".", "get", "(", "EVIDENCE", ")", ",", "annotations", "=", "arg_6", ".", "get", "(", "ANNOTATIONS", ")", ",", ")", "elif", "isinstance", "(", "arg_5", ",", "Reaction", ")", ":", "for", "arg_8", "in", "arg_5", ".", "reactants", ":", "arg_7", "=", "_get_catalysts_in_reaction", "(", "arg_5", ")", "if", "arg_8", "in", "arg_7", ":", "continue", "if", "arg_4", "not", "in", "arg_5", ".", "products", "and", "arg_4", "not", "in", "arg_5", ".", "reactants", ":", "arg_0", ".", "add_increases", "(", "arg_4", ",", "arg_8", ",", "citation", "=", "arg_6", ".", "get", "(", "CITATION", ")", ",", "evidence", "=", "arg_6", ".", "get", "(", "EVIDENCE", ")", ",", "annotations", "=", "arg_6", ".", "get", "(", "ANNOTATIONS", ")", ",", ")", "for", "arg_9", "in", "arg_5", ".", "products", ":", "arg_0", ".", "add_increases", "(", "arg_8", ",", "arg_9", ",", "citation", "=", "arg_6", ".", "get", "(", "CITATION", ")", ",", "evidence", "=", "arg_6", ".", "get", "(", "EVIDENCE", ")", ",", "annotations", "=", "arg_6", ".", "get", "(", "ANNOTATIONS", ")", ",", ")", "_remove_reaction_nodes", "(", "arg_0", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = True) -> None:\n    \"\"\"Expand all reactions to simple subject-predicate-object networks.\"\"\"\n    for arg_4, arg_5, arg_6 in list(arg_0.edges(data=True)):\n        # Deal with unqualified edges\n        if CITATION not in arg_6 and arg_2:\n            _reaction_cartesion_expansion_unqualified_helper(arg_0, arg_4, arg_5, arg_6)\n            continue\n\n        if isinstance(arg_4, Reaction) and isinstance(arg_5, Reaction):\n            arg_7 = _get_catalysts_in_reaction(arg_4) | _get_catalysts_in_reaction(arg_5)\n\n            for arg_8, arg_9 in chain(itt.product(arg_4.reactants, arg_4.products), itt.product(arg_5.reactants, arg_5.products)):\n                if arg_8 in arg_7 or arg_9 in arg_7:\n                    continue\n                arg_0.add_increases(\n                    arg_8, arg_9,\n                    citation=arg_6.get(CITATION),\n                    evidence=arg_6.get(EVIDENCE),\n                    annotations=arg_6.get(ANNOTATIONS),\n                )\n\n            for arg_9, arg_8 in itt.product(arg_4.products, arg_4.reactants):\n                if arg_8 in arg_7 or arg_9 in arg_7:\n                    continue\n\n                arg_0.add_qualified_edge(\n                    arg_9, arg_8,\n                    relation=arg_6[RELATION],\n                    citation=arg_6.get(CITATION),\n                    evidence=arg_6.get(EVIDENCE),\n                    annotations=arg_6.get(ANNOTATIONS),\n                )\n\n        elif isinstance(arg_4, Reaction):\n            arg_7 = _get_catalysts_in_reaction(arg_4)\n\n            for arg_9 in arg_4.products:\n                # Skip create increases edges between enzymes\n                if arg_9 in arg_7:\n                    continue\n\n                # Only add edge between v and reaction if the node is not part of the reaction\n                # In practice skips hasReactant, hasProduct edges\n                if arg_5 not in arg_4.products and arg_5 not in arg_4.reactants:\n                    arg_0.add_increases(\n                        arg_9, arg_5,\n                        citation=arg_6.get(CITATION),\n                        evidence=arg_6.get(EVIDENCE),\n                        annotations=arg_6.get(ANNOTATIONS),\n                    )\n\n                for arg_8 in arg_4.reactants:\n                    arg_0.add_increases(\n                        arg_8, arg_9,\n                        citation=arg_6.get(CITATION),\n                        evidence=arg_6.get(EVIDENCE),\n                        annotations=arg_6.get(ANNOTATIONS),\n                    )\n\n        elif isinstance(arg_5, Reaction):\n            for arg_8 in arg_5.reactants:\n                arg_7 = _get_catalysts_in_reaction(arg_5)\n\n                # Skip create increases edges between enzymes\n                if arg_8 in arg_7:\n                    continue\n\n                # Only add edge between v and reaction if the node is not part of the reaction\n                # In practice skips hasReactant, hasProduct edges\n                if arg_4 not in arg_5.products and arg_4 not in arg_5.reactants:\n                    arg_0.add_increases(\n                        arg_4, arg_8,\n                        citation=arg_6.get(CITATION),\n                        evidence=arg_6.get(EVIDENCE),\n                        annotations=arg_6.get(ANNOTATIONS),\n                    )\n                for arg_9 in arg_5.products:\n                    arg_0.add_increases(\n                        arg_8, arg_9,\n                        citation=arg_6.get(CITATION),\n                        evidence=arg_6.get(EVIDENCE),\n                        annotations=arg_6.get(ANNOTATIONS),\n                    )\n\n    _remove_reaction_nodes(arg_0)", "path": "src/pybel_tools/node_utils.py", "identifier": "reaction_cartesian_expansion", "docstring": "Expand all reactions to simple subject-predicate-object networks.", "docstring_tokens": ["Expand", "all", "reactions", "to", "simple", "subject", "-", "predicate", "-", "object", "networks", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 259905}
{"url": "https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/main.py#L11-L20", "sha": "5baf7f2e145045942ee8dcaccbc47f8f821fcb56", "docstring_summary": "Returns usage string with no trailing whitespace.", "language": "python", "parameters": "(prog_name=os.path.basename(sys.argv[0]))", "return_statement": "return \"usage: \" + usage.rstrip()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ".", "path", ".", "basename", "(", "arg_4", ".", "argv", "[", "0", "]", ")", ")", ":", "arg_6", "=", "' '", "*", "len", "(", "'usage: '", ")", "arg_7", "=", "arg_0", "+", "' -b LIST [-S SEPARATOR] [file ...]\\n'", "+", "arg_6", "+", "arg_0", "+", "' -c LIST [-S SEPERATOR] [file ...]\\n'", "+", "arg_6", "+", "arg_0", "+", "' -f LIST [-d DELIM] [-e] [-S SEPERATOR] [-s] [file ...]'", "return", "\"usage: \"", "+", "arg_7", ".", "rstrip", "(", ")"], "function": "def Func(arg_0=arg_1.path.basename(arg_4.argv[0])):\n    '''Returns usage string with no trailing whitespace.'''\n    arg_6 = ' ' * len('usage: ')\n    arg_7 = arg_0 + ' -b LIST [-S SEPARATOR] [file ...]\\n' \\\n       + arg_6 + arg_0 + ' -c LIST [-S SEPERATOR] [file ...]\\n' \\\n       + arg_6 + arg_0 \\\n       + ' -f LIST [-d DELIM] [-e] [-S SEPERATOR] [-s] [file ...]'\n\n    # Return usage message with trailing whitespace removed.\n    return \"usage: \" + arg_7.rstrip()", "path": "cuts/main.py", "identifier": "_usage", "docstring": "Returns usage string with no trailing whitespace.", "docstring_tokens": ["Returns", "usage", "string", "with", "no", "trailing", "whitespace", "."], "nwo": "jpweiser/cuts", "score": 0.09252797783733271, "idx": 259906}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/presence.py#L251-L278", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Create error response for the any non-error presence stanza.", "language": "python", "parameters": "(self, cond)", "return_statement": "return stanza", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "stanza_type", "==", "\"error\"", ":", "raise", "ValueError", "(", "\"Errors may not be generated in response\"", "\" to errors\"", ")", "arg_2", "=", "Presence", "(", "stanza_type", "=", "\"error\"", ",", "from_jid", "=", "arg_0", ".", "from_jid", ",", "to_jid", "=", "arg_0", ".", "to_jid", ",", "stanza_id", "=", "arg_0", ".", "stanza_id", ",", "status", "=", "arg_0", ".", "_status", ",", "show", "=", "arg_0", ".", "_show", ",", "priority", "=", "arg_0", ".", "_priority", ",", "error_cond", "=", "arg_1", ")", "if", "arg_0", ".", "_payload", "is", "None", ":", "arg_0", ".", "decode_payload", "(", ")", "for", "arg_3", "in", "arg_0", ".", "_payload", ":", "arg_2", ".", "add_payload", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create error response for the any non-error presence stanza.\n\n        :Parameters:\n            - `cond`: error condition name, as defined in XMPP specification.\n        :Types:\n            - `cond`: `unicode`\n\n        :return: new presence stanza.\n        :returntype: `Presence`\n        \"\"\"\n\n        if arg_0.stanza_type == \"error\":\n            raise ValueError(\"Errors may not be generated in response\"\n                                                                \" to errors\")\n\n        arg_2 = Presence(stanza_type = \"error\", from_jid = arg_0.from_jid,\n                            to_jid = arg_0.to_jid, stanza_id = arg_0.stanza_id,\n                            status = arg_0._status, show = arg_0._show,\n                            priority = arg_0._priority, error_cond = arg_1)\n\n        if arg_0._payload is None:\n            arg_0.decode_payload()\n\n        for arg_3 in arg_0._payload:\n            arg_2.add_payload(arg_3)\n\n        return arg_2", "path": "pyxmpp2/presence.py", "identifier": "Presence.make_error_response", "docstring": "Create error response for the any non-error presence stanza.\n\n        :Parameters:\n            - `cond`: error condition name, as defined in XMPP specification.\n        :Types:\n            - `cond`: `unicode`\n\n        :return: new presence stanza.\n        :returntype: `Presence`", "docstring_tokens": ["Create", "error", "response", "for", "the", "any", "non", "-", "error", "presence", "stanza", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259907}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/teams.py#L394-L410", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns a DataFrame of offensive team splits for a season.", "language": "python", "parameters": "(self, year)", "return_statement": "return pd.concat(dfs).reset_index(drop=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_year_doc", "(", "'{}_splits'", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "arg_2", "(", "'table.stats_table'", ")", "arg_4", "=", "[", "sportsref", ".", "utils", ".", "parse_table", "(", "table", ")", "for", "table", "in", "arg_3", ".", "items", "(", ")", "]", "arg_4", "=", "[", "df", ".", "assign", "(", "split", "=", "df", ".", "columns", "[", "0", "]", ")", ".", "rename", "(", "columns", "=", "{", "df", ".", "columns", "[", "0", "]", ":", "'split_value'", "}", ")", "for", "df", "in", "arg_4", "]", "if", "not", "arg_4", ":", "return", "pd", ".", "DataFrame", "(", ")", "return", "pd", ".", "concat", "(", "arg_4", ")", ".", "reset_index", "(", "drop", "=", "True", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns a DataFrame of offensive team splits for a season.\n\n        :year: int representing the season.\n        :returns: Pandas DataFrame of split data.\n        \"\"\"\n        arg_2 = arg_0.get_year_doc('{}_splits'.format(arg_1))\n        arg_3 = arg_2('table.stats_table')\n        arg_4 = [sportsref.utils.parse_table(table) for table in arg_3.items()]\n        arg_4 = [\n            df.assign(split=df.columns[0])\n            .rename(columns={df.columns[0]: 'split_value'})\n            for df in arg_4\n        ]\n        if not arg_4:\n            return pd.DataFrame()\n        return pd.concat(arg_4).reset_index(drop=True)", "path": "sportsref/nfl/teams.py", "identifier": "Team.off_splits", "docstring": "Returns a DataFrame of offensive team splits for a season.\n\n        :year: int representing the season.\n        :returns: Pandas DataFrame of split data.", "docstring_tokens": ["Returns", "a", "DataFrame", "of", "offensive", "team", "splits", "for", "a", "season", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 259908}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L146-L174", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Parse command line arguments", "language": "python", "parameters": "()", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "arg_0", ".", "add_argument", "(", "'-g'", ",", "'--debug'", ",", "dest", "=", "'debug'", ",", "action", "=", "'store_true'", ",", "help", "=", "argparse", ".", "SUPPRESS", ")", "arg_0", ".", "add_argument", "(", "\"--arthur\"", ",", "action", "=", "'store_true'", ",", "dest", "=", "'arthur'", ",", "help", "=", "\"Enable arthur to collect raw data\"", ")", "arg_0", ".", "add_argument", "(", "\"--raw\"", ",", "action", "=", "'store_true'", ",", "dest", "=", "'raw'", ",", "help", "=", "\"Activate raw task\"", ")", "arg_0", ".", "add_argument", "(", "\"--enrich\"", ",", "action", "=", "'store_true'", ",", "dest", "=", "'enrich'", ",", "help", "=", "\"Activate enrich task\"", ")", "arg_0", ".", "add_argument", "(", "\"--identities\"", ",", "action", "=", "'store_true'", ",", "dest", "=", "'identities'", ",", "help", "=", "\"Activate merge identities task\"", ")", "arg_0", ".", "add_argument", "(", "\"--panels\"", ",", "action", "=", "'store_true'", ",", "dest", "=", "'panels'", ",", "help", "=", "\"Activate panels task\"", ")", "arg_0", ".", "add_argument", "(", "\"--cfg\"", ",", "dest", "=", "'cfg_path'", ",", "help", "=", "\"Configuration file path\"", ")", "arg_0", ".", "add_argument", "(", "\"--backends\"", ",", "dest", "=", "'backend_sections'", ",", "default", "=", "[", "]", ",", "nargs", "=", "'*'", ",", "help", "=", "\"Backend sections to execute\"", ")", "if", "len", "(", "sys", ".", "argv", ")", "==", "1", ":", "arg_0", ".", "print_help", "(", ")", "sys", ".", "exit", "(", "1", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Parse command line arguments\"\"\"\n\n    arg_0 = argparse.ArgumentParser(add_help=False)\n\n    arg_0.add_argument('-g', '--debug', dest='debug',\n                        action='store_true',\n                        help=argparse.SUPPRESS)\n    arg_0.add_argument(\"--arthur\", action='store_true', dest='arthur',\n                        help=\"Enable arthur to collect raw data\")\n    arg_0.add_argument(\"--raw\", action='store_true', dest='raw',\n                        help=\"Activate raw task\")\n    arg_0.add_argument(\"--enrich\", action='store_true', dest='enrich',\n                        help=\"Activate enrich task\")\n    arg_0.add_argument(\"--identities\", action='store_true', dest='identities',\n                        help=\"Activate merge identities task\")\n    arg_0.add_argument(\"--panels\", action='store_true', dest='panels',\n                        help=\"Activate panels task\")\n\n    arg_0.add_argument(\"--cfg\", dest='cfg_path',\n                        help=\"Configuration file path\")\n    arg_0.add_argument(\"--backends\", dest='backend_sections', default=[],\n                        nargs='*', help=\"Backend sections to execute\")\n\n    if len(sys.argv) == 1:\n        arg_0.print_help()\n        sys.exit(1)\n\n    return arg_0", "path": "utils/micro.py", "identifier": "get_params_parser", "docstring": "Parse command line arguments", "docstring_tokens": ["Parse", "command", "line", "arguments"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 259909}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/multi_objective_pseudo_connection_scan_profiler.py#L288-L307", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Deal with the first walks by joining profiles to other stops within walking distance.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "_stop_profiles", ".", "items", "(", ")", ":", "assert", "(", "isinstance", "(", "arg_2", ",", "NodeProfileMultiObjective", ")", ")", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "if", "arg_2", ".", "get_walk_to_target_duration", "(", ")", "!=", "0", "and", "arg_1", "in", "arg_0", ".", "_walk_network", ".", "node", ":", "arg_6", "=", "networkx", ".", "all_neighbors", "(", "arg_0", ".", "_walk_network", ",", "arg_1", ")", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "arg_0", ".", "_stop_profiles", "[", "arg_7", "]", "assert", "(", "isinstance", "(", "arg_8", ",", "NodeProfileMultiObjective", ")", ")", "arg_9", "=", "arg_8", ".", "get_labels_for_real_connections", "(", ")", "arg_3", ".", "append", "(", "arg_9", ")", "arg_4", ".", "append", "(", "int", "(", "arg_0", ".", "_walk_network", ".", "get_edge_data", "(", "arg_1", ",", "arg_7", ")", "[", "\"d_walk\"", "]", "/", "arg_0", ".", "_walk_speed", ")", ")", "arg_5", ".", "append", "(", "(", "arg_1", ",", "arg_7", ")", ")", "arg_2", ".", "finalize", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Deal with the first walks by joining profiles to other stops within walking distance.\n        \"\"\"\n        for arg_1, arg_2 in arg_0._stop_profiles.items():\n            assert (isinstance(arg_2, NodeProfileMultiObjective))\n            arg_3 = []\n            arg_4 = []\n            arg_5 = []\n            if arg_2.get_walk_to_target_duration() != 0 and arg_1 in arg_0._walk_network.node:\n                arg_6 = networkx.all_neighbors(arg_0._walk_network, arg_1)\n                for arg_7 in arg_6:\n                    arg_8 = arg_0._stop_profiles[arg_7]\n                    assert (isinstance(arg_8, NodeProfileMultiObjective))\n                    arg_9 = arg_8.get_labels_for_real_connections()\n                    arg_3.append(arg_9)\n                    arg_4.append(int(arg_0._walk_network.get_edge_data(arg_1, arg_7)[\"d_walk\"] /\n                                                       arg_0._walk_speed))\n                    arg_5.append((arg_1, arg_7))\n            arg_2.finalize(arg_3, arg_4, arg_5)", "path": "gtfspy/routing/multi_objective_pseudo_connection_scan_profiler.py", "identifier": "MultiObjectivePseudoCSAProfiler._finalize_profiles", "docstring": "Deal with the first walks by joining profiles to other stops within walking distance.", "docstring_tokens": ["Deal", "with", "the", "first", "walks", "by", "joining", "profiles", "to", "other", "stops", "within", "walking", "distance", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 259910}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/code.py#L383-L389", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Check if number or constant is power of two", "language": "python", "parameters": "(num)", "return_statement": "return num != 0 and ((num & (num - 1)) == 0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "bool", ":", "if", "not", "isinstance", "(", "arg_0", ",", "int", ")", ":", "arg_0", "=", "int", "(", "arg_0", ")", "return", "arg_0", "!=", "0", "and", "(", "(", "arg_0", "&", "(", "arg_0", "-", "1", ")", ")", "==", "0", ")"], "function": "def Func(arg_0) -> bool:\n    \"\"\"\n    Check if number or constant is power of two\n    \"\"\"\n    if not isinstance(arg_0, int):\n        arg_0 = int(arg_0)\n    return arg_0 != 0 and ((arg_0 & (arg_0 - 1)) == 0)", "path": "hwt/code.py", "identifier": "isPow2", "docstring": "Check if number or constant is power of two", "docstring_tokens": ["Check", "if", "number", "or", "constant", "is", "power", "of", "two"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 259911}
{"url": "https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L494-L507", "sha": "08e0319ff3c70f8a931dfa8890caf48add4d0470", "docstring_summary": "Create the thumbnail for html output", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "copy_thumbnail_figure", "(", ")", "if", "arg_1", "is", "not", "None", ":", "if", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "arg_2", "=", "arg_1", "else", ":", "arg_2", "=", "arg_0", ".", "pictures", "[", "arg_1", "]", "arg_0", ".", "save_thumbnail", "(", "arg_2", ")", "else", ":", "for", "arg_2", "in", "arg_0", ".", "pictures", "[", ":", ":", "-", "1", "]", ":", "if", "arg_2", ".", "endswith", "(", "'png'", ")", ":", "arg_0", ".", "save_thumbnail", "(", "arg_2", ")", "return"], "function": "def Func(arg_0):\n        \"\"\"Create the thumbnail for html output\"\"\"\n        arg_1 = arg_0.copy_thumbnail_figure()\n        if arg_1 is not None:\n            if isinstance(arg_1, six.string_types):\n                arg_2 = arg_1\n            else:\n                arg_2 = arg_0.pictures[arg_1]\n            arg_0.save_thumbnail(arg_2)\n        else:\n            for arg_2 in arg_0.pictures[::-1]:\n                if arg_2.endswith('png'):\n                    arg_0.save_thumbnail(arg_2)\n                    return", "path": "sphinx_nbexamples/__init__.py", "identifier": "NotebookProcessor.create_thumb", "docstring": "Create the thumbnail for html output", "docstring_tokens": ["Create", "the", "thumbnail", "for", "html", "output"], "nwo": "Chilipp/sphinx-nbexamples", "score": 0.28168436607245656, "idx": 259912}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/von_mises_fisher.py#L347-L356", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Applies a Householder rotation to `samples`.", "language": "python", "parameters": "(self, samples)", "return_statement": "return samples - 2 * tf.reduce_sum(\n        input_tensor=samples * u, axis=-1, keepdims=True) * u", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "tf", ".", "compat", ".", "dimension_value", "(", "arg_0", ".", "event_shape", "[", "0", "]", ")", "or", "arg_0", ".", "_event_shape_tensor", "(", ")", "[", "0", "]", ")", "arg_3", "=", "tf", ".", "concat", "(", "[", "[", "1.", "]", ",", "tf", ".", "zeros", "(", "[", "arg_2", "-", "1", "]", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "]", ",", "axis", "=", "0", ")", ",", "arg_4", "=", "tf", ".", "nn", ".", "l2_normalize", "(", "arg_3", "-", "arg_0", ".", "mean_direction", ",", "axis", "=", "-", "1", ")", "return", "arg_1", "-", "2", "*", "tf", ".", "reduce_sum", "(", "input_tensor", "=", "arg_1", "*", "arg_4", ",", "axis", "=", "-", "1", ",", "keepdims", "=", "True", ")", "*", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Applies a Householder rotation to `samples`.\"\"\"\n    arg_2 = (\n        tf.compat.dimension_value(arg_0.event_shape[0]) or\n        arg_0._event_shape_tensor()[0])\n    arg_3 = tf.concat([[1.], tf.zeros([arg_2 - 1], dtype=arg_0.dtype)],\n                      axis=0),\n    arg_4 = tf.nn.l2_normalize(arg_3 - arg_0.mean_direction, axis=-1)\n    return arg_1 - 2 * tf.reduce_sum(\n        input_tensor=arg_1 * arg_4, axis=-1, keepdims=True) * arg_4", "path": "tensorflow_probability/python/distributions/von_mises_fisher.py", "identifier": "VonMisesFisher._rotate", "docstring": "Applies a Householder rotation to `samples`.", "docstring_tokens": ["Applies", "a", "Householder", "rotation", "to", "samples", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259913}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/tasks.py#L431-L443", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Returns the mean length of the sequences in the input file. By default uses all sequences. To limit to the first N sequences, use limit=N", "language": "python", "parameters": "(infile, limit=None)", "return_statement": "return total / count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "0", "arg_3", "=", "0", "arg_4", "=", "sequences", ".", "file_reader", "(", "arg_0", ")", "for", "arg_5", "in", "arg_4", ":", "arg_2", "+=", "len", "(", "arg_5", ")", "arg_3", "+=", "1", "if", "arg_1", "is", "not", "None", "and", "arg_3", ">=", "arg_1", ":", "break", "assert", "arg_3", ">", "0", "return", "arg_2", "/", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n    '''Returns the mean length of the sequences in the input file. By default uses all sequences. To limit to the first N sequences, use limit=N'''\n    arg_2 = 0\n    arg_3 = 0\n    arg_4 = sequences.file_reader(arg_0)\n    for arg_5 in arg_4:\n        arg_2 += len(arg_5)\n        arg_3 += 1\n        if arg_1 is not None and arg_3 >= arg_1:\n            break\n\n    assert arg_3 > 0\n    return arg_2 / arg_3", "path": "pyfastaq/tasks.py", "identifier": "mean_length", "docstring": "Returns the mean length of the sequences in the input file. By default uses all sequences. To limit to the first N sequences, use limit=N", "docstring_tokens": ["Returns", "the", "mean", "length", "of", "the", "sequences", "in", "the", "input", "file", ".", "By", "default", "uses", "all", "sequences", ".", "To", "limit", "to", "the", "first", "N", "sequences", "use", "limit", "=", "N"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 259914}
{"url": "https://github.com/scrapinghub/dateparser/blob/11a761c99d3ee522a3c63756b70c106a579e8b5c/dateparser/__init__.py#L11-L56", "sha": "11a761c99d3ee522a3c63756b70c106a579e8b5c", "docstring_summary": "Parse date and time from given date string.", "language": "python", "parameters": "(date_string, date_formats=None, languages=None, locales=None, region=None, settings=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "_default_Funcr", "if", "any", "(", "[", "arg_2", ",", "arg_3", ",", "arg_4", ",", "not", "arg_5", ".", "_default", "]", ")", ":", "arg_6", "=", "DateDataParser", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_7", "=", "arg_6", ".", "get_date_data", "(", "arg_0", ",", "arg_1", ")", "if", "arg_7", ":", "return", "arg_7", "[", "'date_obj'", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=None):\n    \"\"\"Parse date and time from given date string.\n\n    :param date_string:\n        A string representing date and/or time in a recognizably valid format.\n    :type date_string: str|unicode\n\n    :param date_formats:\n        A list of format strings using directives as given\n        `here <https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>`_.\n        The Funcr applies formats one by one, taking into account the detected languages/locales.\n    :type date_formats: list\n\n    :param languages:\n        A list of language codes, e.g. ['en', 'es', 'zh-Hant'].\n        If locales are not given, languages and region are used to construct locales for translation.\n    :type languages: list\n\n    :param locales:\n        A list of locale codes, e.g. ['fr-PF', 'qu-EC', 'af-NA'].\n        The Funcr uses locales to translate date string.\n    :type locales: list\n\n    :param region:\n        A region code, e.g. 'IN', '001', 'NE'.\n        If locales are not given, languages and region are used to construct locales for translation.\n    :type region: str|unicode\n\n    :param settings:\n        Configure customized behavior using settings defined in :mod:`dateFuncr.conf.Settings`.\n    :type settings: dict\n\n    :return: Returns :class:`datetime <datetime.datetime>` representing Funcd date if successful, else returns None\n    :rtype: :class:`datetime <datetime.datetime>`.\n    :raises: ValueError - Unknown Language\n    \"\"\"\n    arg_6 = _default_Funcr\n\n    if any([arg_2, arg_3, arg_4, not arg_5._default]):\n        arg_6 = DateDataParser(arg_2=arg_2, arg_3=arg_3,\n                                arg_4=arg_4, arg_5=arg_5)\n\n    arg_7 = arg_6.get_date_data(arg_0, arg_1)\n\n    if arg_7:\n        return arg_7['date_obj']", "path": "dateparser/__init__.py", "identifier": "parse", "docstring": "Parse date and time from given date string.\n\n    :param date_string:\n        A string representing date and/or time in a recognizably valid format.\n    :type date_string: str|unicode\n\n    :param date_formats:\n        A list of format strings using directives as given\n        `here <https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>`_.\n        The parser applies formats one by one, taking into account the detected languages/locales.\n    :type date_formats: list\n\n    :param languages:\n        A list of language codes, e.g. ['en', 'es', 'zh-Hant'].\n        If locales are not given, languages and region are used to construct locales for translation.\n    :type languages: list\n\n    :param locales:\n        A list of locale codes, e.g. ['fr-PF', 'qu-EC', 'af-NA'].\n        The parser uses locales to translate date string.\n    :type locales: list\n\n    :param region:\n        A region code, e.g. 'IN', '001', 'NE'.\n        If locales are not given, languages and region are used to construct locales for translation.\n    :type region: str|unicode\n\n    :param settings:\n        Configure customized behavior using settings defined in :mod:`dateparser.conf.Settings`.\n    :type settings: dict\n\n    :return: Returns :class:`datetime <datetime.datetime>` representing parsed date if successful, else returns None\n    :rtype: :class:`datetime <datetime.datetime>`.\n    :raises: ValueError - Unknown Language", "docstring_tokens": ["Parse", "date", "and", "time", "from", "given", "date", "string", "."], "nwo": "scrapinghub/dateparser", "score": 0.9721260912575203, "idx": 259915}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/memoization.py#L58-L79", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Create a hash of the task inputs.", "language": "python", "parameters": "(self, task)", "return_statement": "return hashedsum", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "serialize_object", "(", "arg_1", "[", "'func_name'", "]", ")", "[", "0", "]", ",", "serialize_object", "(", "arg_1", "[", "'fn_hash'", "]", ")", "[", "0", "]", ",", "serialize_object", "(", "arg_1", "[", "'args'", "]", ")", "[", "0", "]", ",", "serialize_object", "(", "arg_1", "[", "'kwargs'", "]", ")", "[", "0", "]", ",", "serialize_object", "(", "arg_1", "[", "'env'", "]", ")", "[", "0", "]", "]", "arg_3", "=", "b''", ".", "join", "(", "arg_2", ")", "arg_4", "=", "hashlib", ".", "md5", "(", "arg_3", ")", ".", "hexdigest", "(", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create a hash of the task inputs.\n\n        This uses a serialization library borrowed from ipyparallel.\n        If this fails here, then all ipp calls are also likely to fail due to failure\n        at serialization.\n\n        Args:\n            - task (dict) : Task dictionary from dfk.tasks\n\n        Returns:\n            - hash (str) : A unique hash string\n        \"\"\"\n        # Function name TODO: Add fn body later\n        arg_2 = [serialize_object(arg_1['func_name'])[0],\n             serialize_object(arg_1['fn_hash'])[0],\n             serialize_object(arg_1['args'])[0],\n             serialize_object(arg_1['kwargs'])[0],\n             serialize_object(arg_1['env'])[0]]\n        arg_3 = b''.join(arg_2)\n        arg_4 = hashlib.md5(arg_3).hexdigest()\n        return arg_4", "path": "parsl/dataflow/memoization.py", "identifier": "Memoizer.make_hash", "docstring": "Create a hash of the task inputs.\n\n        This uses a serialization library borrowed from ipyparallel.\n        If this fails here, then all ipp calls are also likely to fail due to failure\n        at serialization.\n\n        Args:\n            - task (dict) : Task dictionary from dfk.tasks\n\n        Returns:\n            - hash (str) : A unique hash string", "docstring_tokens": ["Create", "a", "hash", "of", "the", "task", "inputs", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 259916}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L167-L186", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Returns a texture to be used as a placeholder for missing textures.\n        \n        A default missing texture file is provided in the assets folder of the source distribution.\n        It consists of a simple checkerboard pattern of purple and black, this image may be copied to any project using peng3d for similar behavior.\n        \n        If this texture cannot be found, a pattern is created in-memory, simply a solid square of purple.\n        \n        This texture will also be cached separately from other textures.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "missingTexture", "is", "None", ":", "if", "arg_0", ".", "resourceExists", "(", "arg_0", ".", "missingtexturename", ",", "\".png\"", ")", ":", "arg_0", ".", "missingTexture", "=", "pyglet", ".", "image", ".", "load", "(", "arg_0", ".", "resourceNameToPath", "(", "arg_0", ".", "missingtexturename", ",", "\".png\"", ")", ")", "return", "arg_0", ".", "missingTexture", "else", ":", "arg_0", ".", "missingTexture", "=", "pyglet", ".", "image", ".", "create", "(", "1", ",", "1", ",", "pyglet", ".", "image", ".", "SolidColorImagePattern", "(", "[", "255", ",", "0", ",", "255", ",", "255", "]", ")", ")", "return", "arg_0", ".", "missingTexture", "else", ":", "return", "arg_0", ".", "missingTexture"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a texture to be used as a placeholder for missing textures.\n        \n        A default missing texture file is provided in the assets folder of the source distribution.\n        It consists of a simple checkerboard pattern of purple and black, this image may be copied to any project using peng3d for similar behavior.\n        \n        If this texture cannot be found, a pattern is created in-memory, simply a solid square of purple.\n        \n        This texture will also be cached separately from other textures.\n        \"\"\"\n        if arg_0.missingTexture is None:\n            if arg_0.resourceExists(arg_0.missingtexturename,\".png\"):\n                arg_0.missingTexture = pyglet.image.load(arg_0.resourceNameToPath(arg_0.missingtexturename,\".png\"))\n                return arg_0.missingTexture\n            else: # Falls back to create pattern in-memory\n                arg_0.missingTexture = pyglet.image.create(1,1,pyglet.image.SolidColorImagePattern([255,0,255,255]))\n                return arg_0.missingTexture\n        else:\n            return arg_0.missingTexture", "path": "peng3d/resource.py", "identifier": "ResourceManager.getMissingTexture", "docstring": "Returns a texture to be used as a placeholder for missing textures.\n        \n        A default missing texture file is provided in the assets folder of the source distribution.\n        It consists of a simple checkerboard pattern of purple and black, this image may be copied to any project using peng3d for similar behavior.\n        \n        If this texture cannot be found, a pattern is created in-memory, simply a solid square of purple.\n        \n        This texture will also be cached separately from other textures.", "docstring_tokens": ["Returns", "a", "texture", "to", "be", "used", "as", "a", "placeholder", "for", "missing", "textures", ".", "A", "default", "missing", "texture", "file", "is", "provided", "in", "the", "assets", "folder", "of", "the", "source", "distribution", ".", "It", "consists", "of", "a", "simple", "checkerboard", "pattern", "of", "purple", "and", "black", "this", "image", "may", "be", "copied", "to", "any", "project", "using", "peng3d", "for", "similar", "behavior", ".", "If", "this", "texture", "cannot", "be", "found", "a", "pattern", "is", "created", "in", "-", "memory", "simply", "a", "solid", "square", "of", "purple", ".", "This", "texture", "will", "also", "be", "cached", "separately", "from", "other", "textures", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 259917}
{"url": "https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/process_executor.py#L1011-L1017", "sha": "dc2d941d8285a96f3a5b666a4bd04875b0b25984", "docstring_summary": "ensures all workers and management thread are running", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "_processes_management_lock", ":", "if", "len", "(", "arg_0", ".", "_processes", ")", "!=", "arg_0", ".", "_max_workers", ":", "arg_0", ".", "_adjust_process_count", "(", ")", "arg_0", ".", "_start_queue_management_thread", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"ensures all workers and management thread are running\n        \"\"\"\n        with arg_0._processes_management_lock:\n            if len(arg_0._processes) != arg_0._max_workers:\n                arg_0._adjust_process_count()\n            arg_0._start_queue_management_thread()", "path": "loky/process_executor.py", "identifier": "ProcessPoolExecutor._ensure_executor_running", "docstring": "ensures all workers and management thread are running", "docstring_tokens": ["ensures", "all", "workers", "and", "management", "thread", "are", "running"], "nwo": "tomMoral/loky", "score": 0.572510808364181, "idx": 259918}
{"url": "https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/main.py#L329-L334", "sha": "f546ad171750cd7685afbde6785fe71f82cadb35", "docstring_summary": "Filter sqMass files", "language": "python", "parameters": "(sqmassfiles, infile, max_precursor_pep, max_peakgroup_pep, max_transition_pep)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "Func_sqmass", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Filter sqMass files\n    \"\"\"\n\n    Func_sqmass(arg_0, arg_1, arg_2, arg_3, arg_4)", "path": "pyprophet/main.py", "identifier": "filter", "docstring": "Filter sqMass files", "docstring_tokens": ["Filter", "sqMass", "files"], "nwo": "PyProphet/pyprophet", "score": 0.38514621847307956, "idx": 259919}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L726-L745", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Retrieve the data from the database.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_authorization", "(", ")", "and", "\"whois_db\"", "not", "in", "arg_1", ".", "INTERN", ":", "if", "arg_1", ".", "path", ".", "isfile", "(", "arg_0", ".", "whois_db_path", ")", ":", "arg_1", ".", "INTERN", "[", "\"whois_db\"", "]", "=", "Dict", "(", ")", ".", "from_json", "(", "File", "(", "arg_0", ".", "whois_db_path", ")", ".", "read", "(", ")", ")", "else", ":", "arg_1", ".", "INTERN", "[", "\"whois_db\"", "]", "=", "{", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieve the data from the database.\n        \"\"\"\n\n        if arg_0._authorization() and \"whois_db\" not in arg_1.INTERN:\n            # The usage of the whois database is activated.\n\n            if arg_1.path.isfile(arg_0.whois_db_path):\n                # The database file exist.\n\n                # We merge our current database into already initiated one.\n                arg_1.INTERN[\"whois_db\"] = Dict().from_json(\n                    File(arg_0.whois_db_path).read()\n                )\n            else:\n                # The database file does not exist.\n\n                # We initiate an empty database.\n                arg_1.INTERN[\"whois_db\"] = {}", "path": "PyFunceble/database.py", "identifier": "Whois._retrieve", "docstring": "Retrieve the data from the database.", "docstring_tokens": ["Retrieve", "the", "data", "from", "the", "database", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 259920}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L286-L337", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Write data into output format.", "language": "python", "parameters": "(self, process_tile, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "isinstance", "(", "arg_1", ",", "tuple", ")", ":", "arg_1", "=", "arg_0", ".", "config", ".", "process_pyramid", ".", "tile", "(", "*", "arg_1", ")", "elif", "not", "isinstance", "(", "arg_1", ",", "BufferedTile", ")", ":", "raise", "ValueError", "(", "\"invalid process_tile type: %s\"", "%", "type", "(", "arg_1", ")", ")", "if", "arg_0", ".", "config", ".", "mode", "not", "in", "[", "\"continue\"", ",", "\"overFunc\"", "]", ":", "raise", "ValueError", "(", "\"cannot Func output in current process mode\"", ")", "if", "arg_0", ".", "config", ".", "mode", "==", "\"continue\"", "and", "(", "arg_0", ".", "config", ".", "output", ".", "tiles_exist", "(", "arg_1", ")", ")", ":", "arg_3", "=", "\"output exists, not overwritten\"", "logger", ".", "debug", "(", "(", "arg_1", ".", "id", ",", "arg_3", ")", ")", "return", "ProcessInfo", "(", "tile", "=", "arg_1", ",", "processed", "=", "False", ",", "process_msg", "=", "None", ",", "written", "=", "False", ",", "Func_msg", "=", "arg_3", ")", "elif", "arg_2", "is", "None", ":", "arg_3", "=", "\"output empty, nothing written\"", "logger", ".", "debug", "(", "(", "arg_1", ".", "id", ",", "arg_3", ")", ")", "return", "ProcessInfo", "(", "tile", "=", "arg_1", ",", "processed", "=", "False", ",", "process_msg", "=", "None", ",", "written", "=", "False", ",", "Func_msg", "=", "arg_3", ")", "else", ":", "with", "Timer", "(", ")", "as", "t", ":", "arg_0", ".", "config", ".", "output", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_3", "=", "\"output written in %s\"", "%", "t", "logger", ".", "debug", "(", "(", "arg_1", ".", "id", ",", "arg_3", ")", ")", "return", "ProcessInfo", "(", "tile", "=", "arg_1", ",", "processed", "=", "False", ",", "process_msg", "=", "None", ",", "written", "=", "True", ",", "Func_msg", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Write data into output format.\n\n        Parameters\n        ----------\n        process_tile : BufferedTile or tile index tuple\n            process tile\n        data : NumPy array or features\n            data to be written\n        \"\"\"\n        if isinstance(arg_1, tuple):\n            arg_1 = arg_0.config.process_pyramid.tile(*arg_1)\n        elif not isinstance(arg_1, BufferedTile):\n            raise ValueError(\"invalid process_tile type: %s\" % type(arg_1))\n        if arg_0.config.mode not in [\"continue\", \"overFunc\"]:\n            raise ValueError(\"cannot Func output in current process mode\")\n\n        if arg_0.config.mode == \"continue\" and (\n            arg_0.config.output.tiles_exist(arg_1)\n        ):\n            arg_3 = \"output exists, not overwritten\"\n            logger.debug((arg_1.id, arg_3))\n            return ProcessInfo(\n                tile=arg_1,\n                processed=False,\n                process_msg=None,\n                written=False,\n                Func_msg=arg_3\n            )\n        elif arg_2 is None:\n            arg_3 = \"output empty, nothing written\"\n            logger.debug((arg_1.id, arg_3))\n            return ProcessInfo(\n                tile=arg_1,\n                processed=False,\n                process_msg=None,\n                written=False,\n                Func_msg=arg_3\n            )\n        else:\n            with Timer() as t:\n                arg_0.config.output.Func(arg_1=arg_1, arg_2=arg_2)\n            arg_3 = \"output written in %s\" % t\n            logger.debug((arg_1.id, arg_3))\n            return ProcessInfo(\n                tile=arg_1,\n                processed=False,\n                process_msg=None,\n                written=True,\n                Func_msg=arg_3\n            )", "path": "mapchete/_core.py", "identifier": "Mapchete.write", "docstring": "Write data into output format.\n\n        Parameters\n        ----------\n        process_tile : BufferedTile or tile index tuple\n            process tile\n        data : NumPy array or features\n            data to be written", "docstring_tokens": ["Write", "data", "into", "output", "format", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 259921}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/ensembl.py#L65-L100", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse a dataframe with ensembl gene information", "language": "python", "parameters": "(result)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "LOG", ".", "info", "(", "\"Parsing genes from request\"", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "iterrows", "(", ")", ":", "arg_3", "=", "{", "}", "if", "type", "(", "arg_2", "[", "'hgnc_symbol'", "]", ")", "is", "float", ":", "continue", "arg_3", "[", "'chrom'", "]", "=", "arg_2", "[", "'chromosome_name'", "]", "arg_3", "[", "'gene_start'", "]", "=", "int", "(", "arg_2", "[", "'start_position'", "]", ")", "arg_3", "[", "'gene_end'", "]", "=", "int", "(", "arg_2", "[", "'end_position'", "]", ")", "arg_3", "[", "'ensembl_gene_id'", "]", "=", "arg_2", "[", "'ensembl_gene_id'", "]", "arg_3", "[", "'hgnc_symbol'", "]", "=", "arg_2", "[", "'hgnc_symbol'", "]", "arg_4", "=", "arg_2", "[", "'hgnc_id'", "]", "if", "type", "(", "arg_4", ")", "is", "float", ":", "arg_4", "=", "int", "(", "arg_4", ")", "else", ":", "arg_4", "=", "int", "(", "arg_4", ".", "split", "(", "':'", ")", "[", "-", "1", "]", ")", "arg_3", "[", "'hgnc_id'", "]", "=", "arg_4", "yield", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Parse a dataframe with ensembl gene information\n\n    Args:\n        res(pandas.DataFrame)\n\n    Yields:\n        gene_info(dict)\n    \"\"\"\n    LOG.info(\"Parsing genes from request\")\n\n    for arg_1, arg_2 in arg_0.iterrows():\n        # print(index, row)\n        arg_3 = {}\n\n        # Pandas represents missing data with nan which is a float\n        if type(arg_2['hgnc_symbol']) is float:\n            # Skip genes without hgnc information\n            continue\n\n        arg_3['chrom'] = arg_2['chromosome_name']\n        arg_3['gene_start'] = int(arg_2['start_position'])\n        arg_3['gene_end'] = int(arg_2['end_position'])\n        arg_3['ensembl_gene_id'] = arg_2['ensembl_gene_id']\n        arg_3['hgnc_symbol'] = arg_2['hgnc_symbol']\n\n        arg_4 = arg_2['hgnc_id']\n\n        if type(arg_4) is float:\n            arg_4 = int(arg_4)\n        else:\n            arg_4 = int(arg_4.split(':')[-1])\n\n        arg_3['hgnc_id'] = arg_4\n\n        yield arg_3", "path": "scout/parse/ensembl.py", "identifier": "parse_ensembl_gene_request", "docstring": "Parse a dataframe with ensembl gene information\n\n    Args:\n        res(pandas.DataFrame)\n\n    Yields:\n        gene_info(dict)", "docstring_tokens": ["Parse", "a", "dataframe", "with", "ensembl", "gene", "information"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259922}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L143-L165", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Post a message.", "language": "python", "parameters": "(self, message)", "return_statement": "return result[\"success\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get_campfire", "(", ")", "if", "not", "isinstance", "(", "arg_1", ",", "Message", ")", ":", "arg_1", "=", "Message", "(", "arg_2", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_connection", ".", "post", "(", "\"room/%s/Func\"", "%", "arg_0", ".", "id", ",", "{", "\"message\"", ":", "arg_1", ".", "get_data", "(", ")", "}", ",", "parse_data", "=", "True", ",", "key", "=", "\"message\"", ")", "if", "arg_3", "[", "\"success\"", "]", ":", "return", "Message", "(", "arg_2", ",", "arg_3", "[", "\"data\"", "]", ")", "return", "arg_3", "[", "\"success\"", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Post a message.\n\n        Args:\n            message (:class:`Message` or string): Message\n\n        Returns:\n            bool. Success\n        \"\"\"\n        arg_2 = arg_0.get_campfire()\n        if not isinstance(arg_1, Message):\n            arg_1 = Message(arg_2, arg_1)\n\n        arg_3 = arg_0._connection.post(\n            \"room/%s/Func\" % arg_0.id,\n            {\"message\": arg_1.get_data()},\n            parse_data=True,\n            key=\"message\"\n        )\n\n        if arg_3[\"success\"]:\n            return Message(arg_2, arg_3[\"data\"])\n        return arg_3[\"success\"]", "path": "pyfire/room.py", "identifier": "Room.speak", "docstring": "Post a message.\n\n        Args:\n            message (:class:`Message` or string): Message\n\n        Returns:\n            bool. Success", "docstring_tokens": ["Post", "a", "message", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 259923}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/gui/gui_mainLayout.py#L638-L643", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "This function hides the error message when all values are correct.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "ui", ".", "error_label", ".", "setScaledContents", "(", "False", ")", "arg_0", ".", "ui", ".", "error_text_label", ".", "hide", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        This function hides the error message when all values are correct.\n        \"\"\"\n        arg_0.ui.error_label.setScaledContents(False)  # Warning image hiden.\n        arg_0.ui.error_text_label.hide()", "path": "gui/gui_mainLayout.py", "identifier": "FormEvents.hide_error_message", "docstring": "This function hides the error message when all values are correct.", "docstring_tokens": ["This", "function", "hides", "the", "error", "message", "when", "all", "values", "are", "correct", "."], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 259924}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L143-L152", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Save a state to storage.", "language": "python", "parameters": "(self, state, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "with", "arg_0", ".", "save_stream", "(", "arg_2", ",", "binary", "=", "True", ")", "as", "f", ":", "arg_0", ".", "_serializer", ".", "serialize", "(", "arg_1", ",", "f", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Save a state to storage.\n\n        :param manticore.core.StateBase state:\n        :param str key:\n        :return:\n        \"\"\"\n        with arg_0.save_stream(arg_2, binary=True) as f:\n            arg_0._serializer.serialize(arg_1, f)", "path": "manticore/core/workspace.py", "identifier": "Store.save_state", "docstring": "Save a state to storage.\n\n        :param manticore.core.StateBase state:\n        :param str key:\n        :return:", "docstring_tokens": ["Save", "a", "state", "to", "storage", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 259925}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/genotype.py#L23-L37", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse the genotype calls for a variant", "language": "python", "parameters": "(variant, individuals, individual_positions)", "return_statement": "return genotypes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_2", "[", "arg_4", "[", "'individual_id'", "]", "]", "arg_3", ".", "append", "(", "parse_genotype", "(", "arg_0", ",", "arg_4", ",", "arg_5", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Parse the genotype calls for a variant\n\n        Args:\n            variant(cyvcf2.Variant)\n            individuals: List[dict]\n            individual_positions(dict)\n        Returns:\n            genotypes(list(dict)): A list of genotypes\n    \"\"\"\n    arg_3 = []\n    for arg_4 in arg_1:\n        arg_5 = arg_2[arg_4['individual_id']]\n        arg_3.append(parse_genotype(arg_0, arg_4, arg_5))\n    return arg_3", "path": "scout/parse/variant/genotype.py", "identifier": "parse_genotypes", "docstring": "Parse the genotype calls for a variant\n\n        Args:\n            variant(cyvcf2.Variant)\n            individuals: List[dict]\n            individual_positions(dict)\n        Returns:\n            genotypes(list(dict)): A list of genotypes", "docstring_tokens": ["Parse", "the", "genotype", "calls", "for", "a", "variant"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 259926}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L981-L988", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Retrieves the cached local renderer.", "language": "python", "parameters": "(self)", "return_statement": "return self._local_renderer", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_Func", ":", "arg_1", "=", "arg_0", ".", "create_Func", "(", ")", "arg_0", ".", "_Func", "=", "arg_1", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieves the cached local renderer.\n        \"\"\"\n        if not arg_0._Func:\n            arg_1 = arg_0.create_Func()\n            arg_0._Func = arg_1\n        return arg_0._Func", "path": "burlap/common.py", "identifier": "Satchel.local_renderer", "docstring": "Retrieves the cached local renderer.", "docstring_tokens": ["Retrieves", "the", "cached", "local", "renderer", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 259927}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L1778-L1802", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Configures redirect URI parameters for OAuth2WebServerFlow.", "language": "python", "parameters": "(kwargs)", "return_statement": "return params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'access_type'", ":", "'offline'", ",", "'response_type'", ":", "'code'", ",", "}", "arg_1", ".", "update", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "get", "(", "'approval_prompt'", ")", "if", "arg_2", "is", "not", "None", ":", "logger", ".", "warning", "(", "'The approval_prompt parameter for OAuth2WebServerFlow is '", "'deprecated. Please use the prompt parameter instead.'", ")", "if", "arg_2", "==", "'force'", ":", "logger", ".", "warning", "(", "'approval_prompt=\"force\" has been adjusted to '", "'prompt=\"consent\"'", ")", "arg_1", "[", "'prompt'", "]", "=", "'consent'", "del", "arg_1", "[", "'approval_prompt'", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Configures redirect URI parameters for OAuth2WebServerFlow.\"\"\"\n    arg_1 = {\n        'access_type': 'offline',\n        'response_type': 'code',\n    }\n\n    arg_1.update(arg_0)\n\n    # Check for the presence of the deprecated approval_prompt param and\n    # warn appropriately.\n    arg_2 = arg_1.get('approval_prompt')\n    if arg_2 is not None:\n        logger.warning(\n            'The approval_prompt parameter for OAuth2WebServerFlow is '\n            'deprecated. Please use the prompt parameter instead.')\n\n        if arg_2 == 'force':\n            logger.warning(\n                'approval_prompt=\"force\" has been adjusted to '\n                'prompt=\"consent\"')\n            arg_1['prompt'] = 'consent'\n            del arg_1['approval_prompt']\n\n    return arg_1", "path": "oauth2client/client.py", "identifier": "_oauth2_web_server_flow_params", "docstring": "Configures redirect URI parameters for OAuth2WebServerFlow.", "docstring_tokens": ["Configures", "redirect", "URI", "parameters", "for", "OAuth2WebServerFlow", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 259928}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/param_util.py#L92-L144", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Accept a raw uri and return rewritten versions.", "language": "python", "parameters": "(self, raw_uri, file_provider)", "return_statement": "return normalized, os.path.join(self._relative_path, docker_path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "job_model", ".", "P_GCS", ":", "arg_3", ",", "arg_4", "=", "_gcs_uri_rewriter", "(", "arg_1", ")", "elif", "arg_2", "==", "job_model", ".", "P_LOCAL", ":", "arg_3", ",", "arg_4", "=", "_local_uri_rewriter", "(", "arg_1", ")", "else", ":", "raise", "ValueError", "(", "'File provider not supported: %r'", "%", "arg_2", ")", "return", "arg_3", ",", "os", ".", "path", ".", "join", "(", "arg_0", ".", "_relative_path", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Accept a raw uri and return rewritten versions.\n\n    This function returns a normalized URI and a docker path. The normalized\n    URI may have minor alterations meant to disambiguate and prepare for use\n    by shell utilities that may require a specific format.\n\n    The docker rewriter makes substantial modifications to the raw URI when\n    constructing a docker path, but modifications must follow these rules:\n      1) System specific characters are not allowed (ex. indirect paths).\n      2) The path, if it is a directory, must end in a forward slash.\n      3) The path will begin with the value set in self._relative_path.\n      4) The path will have an additional prefix (after self._relative_path) set\n         by the file provider-specific rewriter.\n\n    Rewrite output for the docker path:\n      >>> out_util = FileParamUtil('AUTO_', 'output')\n      >>> out_util.Func('gs://mybucket/myfile.txt', job_model.P_GCS)[1]\n      'output/gs/mybucket/myfile.txt'\n      >>> out_util.Func('./data/myfolder/', job_model.P_LOCAL)[1]\n      'output/file/data/myfolder/'\n\n    When normalizing the URI for cloud buckets, no rewrites are done. For local\n    files, the user directory will be expanded and relative paths will be\n    converted to absolute:\n      >>> in_util = FileParamUtil('AUTO_', 'input')\n      >>> in_util.Func('gs://mybucket/gcs_dir/', job_model.P_GCS)[0]\n      'gs://mybucket/gcs_dir/'\n      >>> in_util.Func('/data/./dir_a/../myfile.txt',\n      ...   job_model.P_LOCAL)[0]\n      '/data/myfile.txt'\n      >>> in_util.Func('file:///tmp/data/*.bam', job_model.P_LOCAL)[0]\n      '/tmp/data/*.bam'\n\n    Args:\n      raw_uri: (str) the path component of the raw URI.\n      file_provider: a valid provider (contained in job_model.FILE_PROVIDERS).\n\n    Returns:\n      normalized: a cleaned version of the uri provided by command line.\n      docker_path: the uri rewritten in the format required for mounting inside\n                   a docker worker.\n\n    Raises:\n      ValueError: if file_provider is not valid.\n    \"\"\"\n    if arg_2 == job_model.P_GCS:\n      arg_3, arg_4 = _gcs_uri_rewriter(arg_1)\n    elif arg_2 == job_model.P_LOCAL:\n      arg_3, arg_4 = _local_uri_rewriter(arg_1)\n    else:\n      raise ValueError('File provider not supported: %r' % arg_2)\n    return arg_3, os.path.join(arg_0._relative_path, arg_4)", "path": "dsub/lib/param_util.py", "identifier": "FileParamUtil.rewrite_uris", "docstring": "Accept a raw uri and return rewritten versions.\n\n    This function returns a normalized URI and a docker path. The normalized\n    URI may have minor alterations meant to disambiguate and prepare for use\n    by shell utilities that may require a specific format.\n\n    The docker rewriter makes substantial modifications to the raw URI when\n    constructing a docker path, but modifications must follow these rules:\n      1) System specific characters are not allowed (ex. indirect paths).\n      2) The path, if it is a directory, must end in a forward slash.\n      3) The path will begin with the value set in self._relative_path.\n      4) The path will have an additional prefix (after self._relative_path) set\n         by the file provider-specific rewriter.\n\n    Rewrite output for the docker path:\n      >>> out_util = FileParamUtil('AUTO_', 'output')\n      >>> out_util.rewrite_uris('gs://mybucket/myfile.txt', job_model.P_GCS)[1]\n      'output/gs/mybucket/myfile.txt'\n      >>> out_util.rewrite_uris('./data/myfolder/', job_model.P_LOCAL)[1]\n      'output/file/data/myfolder/'\n\n    When normalizing the URI for cloud buckets, no rewrites are done. For local\n    files, the user directory will be expanded and relative paths will be\n    converted to absolute:\n      >>> in_util = FileParamUtil('AUTO_', 'input')\n      >>> in_util.rewrite_uris('gs://mybucket/gcs_dir/', job_model.P_GCS)[0]\n      'gs://mybucket/gcs_dir/'\n      >>> in_util.rewrite_uris('/data/./dir_a/../myfile.txt',\n      ...   job_model.P_LOCAL)[0]\n      '/data/myfile.txt'\n      >>> in_util.rewrite_uris('file:///tmp/data/*.bam', job_model.P_LOCAL)[0]\n      '/tmp/data/*.bam'\n\n    Args:\n      raw_uri: (str) the path component of the raw URI.\n      file_provider: a valid provider (contained in job_model.FILE_PROVIDERS).\n\n    Returns:\n      normalized: a cleaned version of the uri provided by command line.\n      docker_path: the uri rewritten in the format required for mounting inside\n                   a docker worker.\n\n    Raises:\n      ValueError: if file_provider is not valid.", "docstring_tokens": ["Accept", "a", "raw", "uri", "and", "return", "rewritten", "versions", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 259929}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/utils.py#L588-L595", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Flexible writing, where f can be a filename or f object, if filename, closed after writing", "language": "python", "parameters": "(f, mode)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'write'", ")", ":", "yield", "arg_0", "else", ":", "arg_0", "=", "open", "(", "arg_0", ",", "arg_1", ")", "yield", "arg_0", "arg_0", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Flexible writing, where f can be a filename or f object, if filename, closed after writing\"\"\"\n    if hasattr(arg_0, 'write'):\n        yield arg_0\n    else:\n        arg_0 = open(arg_0, arg_1)\n        yield arg_0\n        arg_0.close()", "path": "packages/vaex-core/vaex/utils.py", "identifier": "write_to", "docstring": "Flexible writing, where f can be a filename or f object, if filename, closed after writing", "docstring_tokens": ["Flexible", "writing", "where", "f", "can", "be", "a", "filename", "or", "f", "object", "if", "filename", "closed", "after", "writing"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 259930}
{"url": "https://github.com/SmBe19/praw-OAuth2Util/blob/ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe/OAuth2Util/OAuth2Util.py#L58-L95", "sha": "ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe", "docstring_summary": "Handle the retrieval of the code", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urlparse", "(", "arg_0", ".", "path", ")", "if", "arg_1", "[", "2", "]", "==", "\"/\"", "+", "SERVER_REDIRECT_PATH", ":", "arg_2", "=", "parse_qs", "(", "arg_1", "[", "4", "]", ")", "if", "\"code\"", "not", "in", "arg_2", ":", "arg_0", ".", "send_response", "(", "200", ")", "arg_0", ".", "send_header", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", "arg_0", ".", "end_headers", "(", ")", "arg_0", ".", "wfile", ".", "write", "(", "\"No code found, try again!\"", ".", "encode", "(", "\"utf-8\"", ")", ")", "return", "arg_0", ".", "server", ".", "response_code", "=", "arg_2", "[", "\"code\"", "]", "[", "0", "]", "arg_0", ".", "send_response", "(", "200", ")", "arg_0", ".", "send_header", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", "arg_0", ".", "end_headers", "(", ")", "arg_0", ".", "wfile", ".", "write", "(", "\"Thank you for using OAuth2Util. The authorization was successful, \"", "\"you can now close this window.\"", ".", "encode", "(", "\"utf-8\"", ")", ")", "elif", "arg_1", "[", "2", "]", "==", "\"/\"", "+", "SERVER_LINK_PATH", ":", "arg_0", ".", "send_response", "(", "200", ")", "arg_0", ".", "send_header", "(", "\"Content-Type\"", ",", "\"text/html\"", ")", "arg_0", ".", "end_headers", "(", ")", "arg_0", ".", "wfile", ".", "write", "(", "\"<html><body>Hey there!<br/>Click <a href=\\\"{0}\\\">here</a> to claim your prize.</body></html>\"", ".", "format", "(", "arg_0", ".", "server", ".", "authorize_url", ")", ".", "encode", "(", "\"utf-8\"", ")", ")", "else", ":", "arg_0", ".", "send_response", "(", "404", ")", "arg_0", ".", "send_header", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", "arg_0", ".", "end_headers", "(", ")", "arg_0", ".", "wfile", ".", "write", "(", "\"404 not found\"", ".", "encode", "(", "\"utf-8\"", ")", ")"], "function": "def Func(arg_0):\n\t\t\"\"\"\n\t\tHandle the retrieval of the code\n\t\t\"\"\"\n\t\targ_1 = urlparse(arg_0.path)\n\n\t\tif arg_1[2] == \"/\" + SERVER_REDIRECT_PATH:  # 2 = Path\n\t\t\targ_2 = parse_qs(arg_1[4])  # 4 = Query\n\n\t\t\tif \"code\" not in arg_2:\n\t\t\t\targ_0.send_response(200)\n\t\t\t\targ_0.send_header(\"Content-Type\", \"text/plain\")\n\t\t\t\targ_0.end_headers()\n\n\t\t\t\targ_0.wfile.write(\"No code found, try again!\".encode(\"utf-8\"))\n\t\t\t\treturn\n\n\t\t\targ_0.server.response_code = arg_2[\"code\"][0]\n\n\t\t\targ_0.send_response(200)\n\t\t\targ_0.send_header(\"Content-Type\", \"text/plain\")\n\t\t\targ_0.end_headers()\n\n\t\t\targ_0.wfile.write(\n\t\t\t\t\"Thank you for using OAuth2Util. The authorization was successful, \"\n\t\t\t\t\"you can now close this window.\".encode(\"utf-8\"))\n\t\telif arg_1[2] == \"/\" + SERVER_LINK_PATH: # 2 = Path\n\t\t\targ_0.send_response(200)\n\t\t\targ_0.send_header(\"Content-Type\", \"text/html\")\n\t\t\targ_0.end_headers()\n\n\t\t\targ_0.wfile.write(\"<html><body>Hey there!<br/>Click <a href=\\\"{0}\\\">here</a> to claim your prize.</body></html>\"\n\t\t\t\t.format(arg_0.server.authorize_url).encode(\"utf-8\"))\n\t\telse:\n\t\t\targ_0.send_response(404)\n\t\t\targ_0.send_header(\"Content-Type\", \"text/plain\")\n\t\t\targ_0.end_headers()\n\t\t\targ_0.wfile.write(\"404 not found\".encode(\"utf-8\"))", "path": "OAuth2Util/OAuth2Util.py", "identifier": "OAuth2UtilRequestHandler.do_GET", "docstring": "Handle the retrieval of the code", "docstring_tokens": ["Handle", "the", "retrieval", "of", "the", "code"], "nwo": "SmBe19/praw-OAuth2Util", "score": 0.28581547167654664, "idx": 259931}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L127-L130", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Add track and play it.", "language": "python", "parameters": "(self, requester: int, track: dict)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ")", ":", "arg_0", ".", "add_next", "(", "arg_1", ",", "arg_3", ")", "await", "arg_0", ".", "play", "(", "ignore_shuffle", "=", "True", ")"], "function": "async def Func(arg_0, arg_1: arg_2, arg_3: arg_4):\r\n        \"\"\" Add track and play it. \"\"\"\r\n        arg_0.add_next(arg_1, arg_3)\r\n        await arg_0.play(ignore_shuffle=True)", "path": "lavalink/PlayerManager.py", "identifier": "DefaultPlayer.play_now", "docstring": "Add track and play it.", "docstring_tokens": ["Add", "track", "and", "play", "it", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 259932}
{"url": "https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L126-L136", "sha": "05abf965f67c7445355508a38f11992d13adac4f", "docstring_summary": "Create a vacation.", "language": "python", "parameters": "(body)", "return_statement": "return arequest.json()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "requests", ".", "post", "(", "VACATIONS_URL", ",", "headers", "=", "HEADERS", ",", "data", "=", "json", ".", "dumps", "(", "arg_0", ")", ")", "arg_2", "=", "str", "(", "arg_1", ".", "status_code", ")", "if", "arg_2", "!=", "'200'", ":", "_LOGGER", ".", "error", "(", "\"Failed to create vacation. \"", "+", "arg_2", ")", "_LOGGER", ".", "error", "(", "arg_1", ".", "json", "(", ")", ")", "return", "False", "return", "arg_1", ".", "json", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Create a vacation.\n        \"\"\"\n        arg_1 = requests.post(VACATIONS_URL, headers=HEADERS, data=json.dumps(arg_0))\n        arg_2 = str(arg_1.status_code)\n        if arg_2 != '200':\n            _LOGGER.error(\"Failed to create vacation. \" + arg_2)\n            _LOGGER.error(arg_1.json())\n            return False\n        return arg_1.json()", "path": "src/pyeconet/api.py", "identifier": "EcoNetApiInterface.create_vacation", "docstring": "Create a vacation.", "docstring_tokens": ["Create", "a", "vacation", "."], "nwo": "w1ll1am23/pyeconet", "score": 0.2757871243566705, "idx": 259933}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/util/scm/__init__.py#L33-L42", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Return string signifying the SCM used in the given directory.", "language": "python", "parameters": "(workdir)", "return_statement": "return 'unknown'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'.git'", ")", ")", "and", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "arg_0", ",", "'.git'", ",", "'HEAD'", ")", ")", ":", "return", "'git'", "return", "'unknown'"], "function": "def Func(arg_0):\n    \"\"\" Return string signifying the SCM used in the given directory.\n\n        Currently, 'git' is supported. Anything else returns 'unknown'.\n    \"\"\"\n    # Any additions here also need a change to `SCM_PROVIDERS`!\n    if os.path.isdir(os.path.join(arg_0, '.git')) and os.path.isfile(os.path.join(arg_0, '.git', 'HEAD')):\n        return 'git'\n\n    return 'unknown'", "path": "src/rituals/util/scm/__init__.py", "identifier": "auto_detect", "docstring": "Return string signifying the SCM used in the given directory.\n\n        Currently, 'git' is supported. Anything else returns 'unknown'.", "docstring_tokens": ["Return", "string", "signifying", "the", "SCM", "used", "in", "the", "given", "directory", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 259934}
{"url": "https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/api.py#L39-L47", "sha": "8c6bb54888675652d25324184967392d00d128fc", "docstring_summary": "Iterates over the parent-child relationships in an ontolog", "language": "python", "parameters": "(ontology, ols_base=None)", "return_statement": "return client.iter_hierarchy(ontology)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "OlsClient", "(", "arg_1", "=", "arg_1", ")", "return", "arg_2", ".", "iter_hierarchy", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Iterates over the parent-child relationships in an ontolog\n\n    :param str ontology: The name of the ontology\n    :param str ols_base: An optional, custom OLS base url\n    :rtype: iter[tuple[str,str]]\n    \"\"\"\n    arg_2 = OlsClient(arg_1=arg_1)\n    return arg_2.iter_hierarchy(arg_0)", "path": "src/ols_client/api.py", "identifier": "get_hierarchy", "docstring": "Iterates over the parent-child relationships in an ontolog\n\n    :param str ontology: The name of the ontology\n    :param str ols_base: An optional, custom OLS base url\n    :rtype: iter[tuple[str,str]]", "docstring_tokens": ["Iterates", "over", "the", "parent", "-", "child", "relationships", "in", "an", "ontolog"], "nwo": "cthoyt/ols-client", "score": 0.25890992733444657, "idx": 259935}
{"url": "https://github.com/edoburu/django-tag-parser/blob/c24256cfdd0248434f2e3df3444ed9f945d4181f/tag_parser/basetags.py#L160-L164", "sha": "c24256cfdd0248434f2e3df3444ed9f945d4181f", "docstring_summary": "Render the tag, with all arguments resolved to their actual values.", "language": "python", "parameters": "(self, context, *tag_args, **tag_kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "raise", "NotImplementedError", "(", "\"{0}.Func() is not implemented!\"", ".", "format", "(", "arg_0", ".", "__class__", ".", "__name__", ")", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Render the tag, with all arguments resolved to their actual values.\n        \"\"\"\n        raise NotImplementedError(\"{0}.Func() is not implemented!\".format(arg_0.__class__.__name__))", "path": "tag_parser/basetags.py", "identifier": "BaseNode.render_tag", "docstring": "Render the tag, with all arguments resolved to their actual values.", "docstring_tokens": ["Render", "the", "tag", "with", "all", "arguments", "resolved", "to", "their", "actual", "values", "."], "nwo": "edoburu/django-tag-parser", "score": 0.2751458370028208, "idx": 259936}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L491-L540", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Find all intersection points between the line string and `other`.", "language": "python", "parameters": "(self, other)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "import", "shapely", ".", "geometry", "arg_2", "=", "_convert_var_to_shapely_geometry", "(", "arg_1", ")", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "zip", "(", "arg_0", ".", "coords", "[", ":", "-", "1", "]", ",", "arg_0", ".", "coords", "[", "1", ":", "]", ")", ":", "arg_6", "=", "shapely", ".", "geometry", ".", "LineString", "(", "[", "arg_4", ",", "arg_5", "]", ")", "arg_7", "=", "arg_6", ".", "intersection", "(", "arg_2", ")", "arg_7", "=", "list", "(", "_flatten_shapely_collection", "(", "arg_7", ")", ")", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_7", ":", "if", "isinstance", "(", "arg_9", ",", "shapely", ".", "geometry", ".", "linestring", ".", "LineString", ")", ":", "arg_10", "=", "(", "arg_9", ".", "coords", "[", "0", "]", "[", "0", "]", ",", "arg_9", ".", "coords", "[", "0", "]", "[", "1", "]", ")", "arg_11", "=", "(", "arg_9", ".", "coords", "[", "-", "1", "]", "[", "0", "]", ",", "arg_9", ".", "coords", "[", "-", "1", "]", "[", "1", "]", ")", "arg_8", ".", "extend", "(", "[", "arg_10", ",", "arg_11", "]", ")", "else", ":", "assert", "isinstance", "(", "arg_9", ",", "shapely", ".", "geometry", ".", "point", ".", "Point", ")", ",", "(", "\"Expected to find shapely.geometry.point.Point or \"", "\"shapely.geometry.linestring.LineString intersection, \"", "\"actually found %s.\"", "%", "(", "type", "(", "arg_9", ")", ",", ")", ")", "arg_8", ".", "append", "(", "(", "arg_9", ".", "x", ",", "arg_9", ".", "y", ")", ")", "arg_12", "=", "sorted", "(", "arg_8", ",", "key", "=", "lambda", "p", ":", "np", ".", "linalg", ".", "norm", "(", "np", ".", "float32", "(", "p", ")", "-", "arg_4", ")", ")", "arg_3", ".", "append", "(", "arg_12", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Find all intersection points between the line string and `other`.\n\n        Parameters\n        ----------\n        other : tuple of number or list of tuple of number or \\\n                list of LineString or LineString\n            The other geometry to use during intersection tests.\n\n        Returns\n        -------\n        list of list of tuple of number\n            All intersection points. One list per pair of consecutive start\n            and end point, i.e. `N-1` lists of `N` points. Each list may\n            be empty or may contain multiple points.\n\n        \"\"\"\n        import shapely.geometry\n\n        arg_2 = _convert_var_to_shapely_geometry(arg_1)\n\n        arg_3 = []\n        for arg_4, arg_5 in zip(arg_0.coords[:-1], arg_0.coords[1:]):\n            arg_6 = shapely.geometry.LineString([arg_4, arg_5])\n            arg_7 = arg_6.intersection(arg_2)\n            arg_7 = list(_flatten_shapely_collection(arg_7))\n\n            arg_8 = []\n            for arg_9 in arg_7:\n                if isinstance(arg_9, shapely.geometry.linestring.LineString):\n                    arg_10 = (arg_9.coords[0][0], arg_9.coords[0][1])\n                    arg_11 = (arg_9.coords[-1][0], arg_9.coords[-1][1])\n                    arg_8.extend([arg_10, arg_11])\n                else:\n                    assert isinstance(arg_9, shapely.geometry.point.Point), (\n                        \"Expected to find shapely.geometry.point.Point or \"\n                        \"shapely.geometry.linestring.LineString intersection, \"\n                        \"actually found %s.\" % (type(arg_9),))\n                    arg_8.append((arg_9.x, arg_9.y))\n\n            # sort by distance to start point, this makes it later on easier\n            # to remove duplicate points\n            arg_12 = sorted(\n                arg_8,\n                key=lambda p: np.linalg.norm(np.float32(p) - arg_4)\n            )\n\n            arg_3.append(arg_12)\n        return arg_3", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.find_intersections_with", "docstring": "Find all intersection points between the line string and `other`.\n\n        Parameters\n        ----------\n        other : tuple of number or list of tuple of number or \\\n                list of LineString or LineString\n            The other geometry to use during intersection tests.\n\n        Returns\n        -------\n        list of list of tuple of number\n            All intersection points. One list per pair of consecutive start\n            and end point, i.e. `N-1` lists of `N` points. Each list may\n            be empty or may contain multiple points.", "docstring_tokens": ["Find", "all", "intersection", "points", "between", "the", "line", "string", "and", "other", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 259937}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/basecolor.py#L381-L394", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns RGB values for a hex color string.", "language": "python", "parameters": "(hex)", "return_statement": "return r, g, b, a", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "lstrip", "(", "\"#\"", ")", "if", "len", "(", "arg_0", ")", "<", "6", ":", "arg_0", "+=", "arg_0", "[", "-", "1", "]", "*", "(", "6", "-", "len", "(", "arg_0", ")", ")", "if", "len", "(", "arg_0", ")", "==", "6", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_0", "[", "0", ":", "2", "]", ",", "arg_0", "[", "2", ":", "4", "]", ",", "arg_0", "[", "4", ":", "]", "arg_1", ",", "arg_2", ",", "arg_3", "=", "[", "int", "(", "n", ",", "16", ")", "/", "255.0", "for", "n", "in", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "]", "arg_4", "=", "1.0", "elif", "len", "(", "arg_0", ")", "==", "8", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_0", "[", "0", ":", "2", "]", ",", "arg_0", "[", "2", ":", "4", "]", ",", "arg_0", "[", "4", ":", "6", "]", ",", "arg_0", "[", "6", ":", "]", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "[", "int", "(", "n", ",", "16", ")", "/", "255.0", "for", "n", "in", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "]", "return", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4"], "function": "def Func(arg_0):\n    \"\"\" Returns RGB values for a hex color string.\n    \"\"\"\n    arg_0 = arg_0.lstrip(\"#\")\n    if len(arg_0) < 6:\n        arg_0 += arg_0[-1] * (6 - len(arg_0))\n    if len(arg_0) == 6:\n        arg_1, arg_2, arg_3 = arg_0[0:2], arg_0[2:4], arg_0[4:]\n        arg_1, arg_2, arg_3 = [int(n, 16) / 255.0 for n in (arg_1, arg_2, arg_3)]\n        arg_4 = 1.0\n    elif len(arg_0) == 8:\n        arg_1, arg_2, arg_3, arg_4 = arg_0[0:2], arg_0[2:4], arg_0[4:6], arg_0[6:]\n        arg_1, arg_2, arg_3, arg_4 = [int(n, 16) / 255.0 for n in (arg_1, arg_2, arg_3, arg_4)]\n    return arg_1, arg_2, arg_3, arg_4", "path": "shoebot/data/basecolor.py", "identifier": "hex_to_rgb", "docstring": "Returns RGB values for a hex color string.", "docstring_tokens": ["Returns", "RGB", "values", "for", "a", "hex", "color", "string", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259938}
{"url": "https://github.com/PythonSanSebastian/docstamp/blob/b43808f2e15351b0b2f0b7eade9c7ef319c9e646/docstamp/svg_fonts.py#L120-L137", "sha": "b43808f2e15351b0b2f0b7eade9c7ef319c9e646", "docstring_summary": "Write ttf and otf font content from `font_files`\n    in the svg file in `filepath` and write the result in\n    `outfile`.", "language": "python", "parameters": "(filepath, outfile, font_files)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "_Func", "(", "arg_0", ",", "arg_2", ")", "arg_3", ".", "write", "(", "arg_1", ",", "encoding", "=", "'utf-8'", ",", "pretty_print", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Write ttf and otf font content from `font_files`\n    in the svg file in `filepath` and write the result in\n    `outfile`.\n\n    Parameters\n    ----------\n    filepath: str\n        The SVG file whose content must be modified.\n\n    outfile: str\n        The file path where the result will be written.\n\n    font_files: iterable of str\n        List of paths to .ttf or .otf files.\n    \"\"\"\n    arg_3 = _Func(arg_0, arg_2)\n    arg_3.write(arg_1, encoding='utf-8', pretty_print=True)", "path": "docstamp/svg_fonts.py", "identifier": "embed_font_to_svg", "docstring": "Write ttf and otf font content from `font_files`\n    in the svg file in `filepath` and write the result in\n    `outfile`.\n\n    Parameters\n    ----------\n    filepath: str\n        The SVG file whose content must be modified.\n\n    outfile: str\n        The file path where the result will be written.\n\n    font_files: iterable of str\n        List of paths to .ttf or .otf files.", "docstring_tokens": ["Write", "ttf", "and", "otf", "font", "content", "from", "font_files", "in", "the", "svg", "file", "in", "filepath", "and", "write", "the", "result", "in", "outfile", "."], "nwo": "PythonSanSebastian/docstamp", "score": 0.16246995141409282, "idx": 259939}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L14-L31", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Extract hook names from the given entity", "language": "python", "parameters": "(ent)", "return_statement": "return hnames", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", "[", "\"hooks\"", "]", "[", "\"enter\"", "]", "+", "arg_0", "[", "\"hooks\"", "]", "[", "\"exit\"", "]", ":", "arg_3", "=", "os", ".", "path", ".", "basename", "(", "arg_2", "[", "\"fpath_orig\"", "]", ")", "arg_3", "=", "os", ".", "path", ".", "splitext", "(", "arg_3", ")", "[", "0", "]", "arg_3", "=", "arg_3", ".", "strip", "(", ")", "arg_3", "=", "arg_3", ".", "replace", "(", "\"_enter\"", ",", "\"\"", ")", "arg_3", "=", "arg_3", ".", "replace", "(", "\"_exit\"", ",", "\"\"", ")", "if", "arg_3", "in", "arg_1", ":", "continue", "arg_1", ".", "append", "(", "arg_3", ")", "arg_1", ".", "sort", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Extract hook names from the given entity\"\"\"\n\n    arg_1 = []\n    for arg_2 in arg_0[\"hooks\"][\"enter\"] + arg_0[\"hooks\"][\"exit\"]:\n        arg_3 = os.path.basename(arg_2[\"fpath_orig\"])\n        arg_3 = os.path.splitext(arg_3)[0]\n        arg_3 = arg_3.strip()\n        arg_3 = arg_3.replace(\"_enter\", \"\")\n        arg_3 = arg_3.replace(\"_exit\", \"\")\n        if arg_3 in arg_1:\n            continue\n\n        arg_1.append(arg_3)\n\n    arg_1.sort()\n\n    return arg_1", "path": "modules/cij/reporter.py", "identifier": "extract_hook_names", "docstring": "Extract hook names from the given entity", "docstring_tokens": ["Extract", "hook", "names", "from", "the", "given", "entity"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 259940}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L1388-L1398", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Upload given file into DKV and save it under give key as raw object.", "language": "python", "parameters": "(file_path, dest_key=None, overwrite=True)", "return_statement": "return ret[\"destination_key\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "api", "(", "\"POST /3/PutKey?destination_key={}&overwrite={}\"", ".", "format", "(", "arg_1", "if", "arg_1", "else", "''", ",", "arg_2", ")", ",", "filename", "=", "arg_0", ")", "return", "arg_3", "[", "\"destination_key\"", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=True):\n    \"\"\"\n    Upload given file into DKV and save it under give key as raw object.\n\n    :param dest_key:  name of destination key in DKV\n    :param file_path:  path to file to upload\n    :return: key name if object was uploaded successfully\n    \"\"\"\n    arg_3 = api(\"POST /3/PutKey?destination_key={}&overwrite={}\".format(arg_1 if arg_1 else '', arg_2),\n              filename=arg_0)\n    return arg_3[\"destination_key\"]", "path": "h2o-py/h2o/h2o.py", "identifier": "_put_key", "docstring": "Upload given file into DKV and save it under give key as raw object.\n\n    :param dest_key:  name of destination key in DKV\n    :param file_path:  path to file to upload\n    :return: key name if object was uploaded successfully", "docstring_tokens": ["Upload", "given", "file", "into", "DKV", "and", "save", "it", "under", "give", "key", "as", "raw", "object", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259941}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/bugzillarest.py#L383-L397", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the attachments of the given bugs.", "language": "python", "parameters": "(self, *bug_ids)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "arg_2", "=", "urijoin", "(", "arg_0", ".", "RBUG", ",", "arg_1", "[", "0", "]", ",", "arg_0", ".", "RATTACHMENT", ")", "arg_3", "=", "{", "arg_0", ".", "PIDS", ":", "arg_1", ",", "arg_0", ".", "PEXCLUDE_FIELDS", ":", "arg_0", ".", "VEXCLUDE_ATTCH_DATA", "}", "arg_4", "=", "arg_0", ".", "call", "(", "arg_2", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Get the Func of the given bugs.\n\n        :param bug_id: list of bug identifiers\n        \"\"\"\n        arg_2 = urijoin(arg_0.RBUG, arg_1[0], arg_0.RATTACHMENT)\n\n        arg_3 = {\n            arg_0.PIDS: arg_1,\n            arg_0.PEXCLUDE_FIELDS: arg_0.VEXCLUDE_ATTCH_DATA\n        }\n\n        arg_4 = arg_0.call(arg_2, arg_3)\n\n        return arg_4", "path": "perceval/backends/core/bugzillarest.py", "identifier": "BugzillaRESTClient.attachments", "docstring": "Get the attachments of the given bugs.\n\n        :param bug_id: list of bug identifiers", "docstring_tokens": ["Get", "the", "attachments", "of", "the", "given", "bugs", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 259942}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/ast/state.py#L990-L1005", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Only one Living State on the S0 of each StateRegister", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "len", "(", "arg_0", ".", "ls", ")", "for", "arg_3", ",", "arg_4", "in", "zip", "(", "range", "(", "arg_2", ")", ",", "arg_0", ".", "ls", ")", ":", "arg_5", "=", "id", "(", "arg_4", "[", "1", "]", ".", "thestate", "(", ")", ")", "if", "arg_5", "==", "id", "(", "arg_4", "[", "0", "]", ")", "and", "(", "arg_4", "[", "1", "]", ".", "have_finish", "or", "not", "arg_4", "[", "1", "]", ".", "alive", ")", ":", "arg_1", ".", "append", "(", "arg_3", ")", "elif", "arg_4", "[", "1", "]", ".", "alive", ":", "arg_4", "[", "1", "]", ".", "alive", "=", "False", "for", "arg_7", "in", "reversed", "(", "arg_1", ")", ":", "arg_0", ".", "ls", ".", "pop", "(", "arg_7", ")", "arg_0", ".", "init_all", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Only one Living State on the S0 of each StateRegister\"\"\"\n        # TODO: add some test to control number of instanciation of LivingState\n        # clean all living state on S0\n        arg_1 = []\n        arg_2 = len(arg_0.ls)\n        for arg_3, arg_4 in zip(range(arg_2), arg_0.ls):\n            # TODO: alive by default on False, change to True on the first match\n            arg_5 = id(arg_4[1].thestate())\n            if arg_5 == id(arg_4[0]) and (arg_4[1].have_finish or not arg_4[1].alive):\n                arg_1.append(arg_3)\n            elif arg_4[1].alive:\n                arg_4[1].alive = False\n        for arg_7 in reversed(arg_1):\n            arg_0.ls.pop(arg_7)\n        arg_0.init_all()", "path": "pyrser/ast/state.py", "identifier": "LivingContext.resetLivingState", "docstring": "Only one Living State on the S0 of each StateRegister", "docstring_tokens": ["Only", "one", "Living", "State", "on", "the", "S0", "of", "each", "StateRegister"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 259943}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1025-L1061", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots gross leverage versus date.", "language": "python", "parameters": "(returns, positions, ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "plt", ".", "gca", "(", ")", "arg_4", "=", "timeseries", ".", "gross_lev", "(", "arg_1", ")", "arg_4", ".", "plot", "(", "lw", "=", "0.5", ",", "color", "=", "'limegreen'", ",", "legend", "=", "False", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "arg_2", ".", "axhline", "(", "arg_4", ".", "mean", "(", ")", ",", "color", "=", "'g'", ",", "linestyle", "=", "'--'", ",", "lw", "=", "3", ")", "arg_2", ".", "set_title", "(", "'Gross leverage'", ")", "arg_2", ".", "set_ylabel", "(", "'Gross leverage'", ")", "arg_2", ".", "set_xlabel", "(", "''", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n    \"\"\"\n    Plots gross leverage versus date.\n\n    Gross leverage is the sum of long and short exposure per share\n    divided by net asset value.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_2 is None:\n        arg_2 = plt.gca()\n    arg_4 = timeseries.gross_lev(arg_1)\n    arg_4.plot(lw=0.5, color='limegreen', legend=False, arg_2=arg_2, **arg_3)\n\n    arg_2.axhline(arg_4.mean(), color='g', linestyle='--', lw=3)\n\n    arg_2.set_title('Gross leverage')\n    arg_2.set_ylabel('Gross leverage')\n    arg_2.set_xlabel('')\n    return arg_2", "path": "pyfolio/plotting.py", "identifier": "plot_gross_leverage", "docstring": "Plots gross leverage versus date.\n\n    Gross leverage is the sum of long and short exposure per share\n    divided by net asset value.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "gross", "leverage", "versus", "date", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 259944}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/engine.py#L627-L719", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Get the attribute value from the kmip.pie managed object.", "language": "python", "parameters": "(self, managed_object, attr_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "'Unique Identifier'", ":", "return", "str", "(", "arg_1", ".", "unique_identifier", ")", "elif", "arg_2", "==", "'Name'", ":", "arg_3", "=", "list", "(", ")", "for", "arg_4", "in", "arg_1", ".", "names", ":", "arg_4", "=", "attributes", ".", "Name", "(", "attributes", ".", "Name", ".", "NameValue", "(", "arg_4", ")", ",", "attributes", ".", "Name", ".", "NameType", "(", "enums", ".", "NameType", ".", "UNINTERPRETED_TEXT_STRING", ")", ")", "arg_3", ".", "append", "(", "arg_4", ")", "return", "arg_3", "elif", "arg_2", "==", "'Object Type'", ":", "return", "arg_1", ".", "_object_type", "elif", "arg_2", "==", "'Cryptographic Algorithm'", ":", "return", "arg_1", ".", "cryptographic_algorithm", "elif", "arg_2", "==", "'Cryptographic Length'", ":", "return", "arg_1", ".", "cryptographic_length", "elif", "arg_2", "==", "'Cryptographic Parameters'", ":", "return", "None", "elif", "arg_2", "==", "'Cryptographic Domain Parameters'", ":", "return", "None", "elif", "arg_2", "==", "'Certificate Type'", ":", "return", "arg_1", ".", "certificate_type", "elif", "arg_2", "==", "'Certificate Length'", ":", "return", "None", "elif", "arg_2", "==", "'X.509 Certificate Identifier'", ":", "return", "None", "elif", "arg_2", "==", "'X.509 Certificate Subject'", ":", "return", "None", "elif", "arg_2", "==", "'X.509 Certificate Issuer'", ":", "return", "None", "elif", "arg_2", "==", "'Certificate Identifier'", ":", "return", "None", "elif", "arg_2", "==", "'Certificate Subject'", ":", "return", "None", "elif", "arg_2", "==", "'Certificate Issuer'", ":", "return", "None", "elif", "arg_2", "==", "'Digital Signature Algorithm'", ":", "return", "None", "elif", "arg_2", "==", "'Digest'", ":", "return", "None", "elif", "arg_2", "==", "'Operation Policy Name'", ":", "return", "arg_1", ".", "operation_policy_name", "elif", "arg_2", "==", "'Cryptographic Usage Mask'", ":", "return", "arg_1", ".", "cryptographic_usage_masks", "elif", "arg_2", "==", "'Lease Time'", ":", "return", "None", "elif", "arg_2", "==", "'Usage Limits'", ":", "return", "None", "elif", "arg_2", "==", "'State'", ":", "return", "arg_1", ".", "state", "elif", "arg_2", "==", "'Initial Date'", ":", "return", "arg_1", ".", "initial_date", "elif", "arg_2", "==", "'Activation Date'", ":", "return", "None", "elif", "arg_2", "==", "'Process Start Date'", ":", "return", "None", "elif", "arg_2", "==", "'Protect Stop Date'", ":", "return", "None", "elif", "arg_2", "==", "'Deactivation Date'", ":", "return", "None", "elif", "arg_2", "==", "'Destroy Date'", ":", "return", "None", "elif", "arg_2", "==", "'Compromise Occurrence Date'", ":", "return", "None", "elif", "arg_2", "==", "'Compromise Date'", ":", "return", "None", "elif", "arg_2", "==", "'Revocation Reason'", ":", "return", "None", "elif", "arg_2", "==", "'Archive Date'", ":", "return", "None", "elif", "arg_2", "==", "'Object Group'", ":", "return", "None", "elif", "arg_2", "==", "'Fresh'", ":", "return", "None", "elif", "arg_2", "==", "'Link'", ":", "return", "None", "elif", "arg_2", "==", "'Application Specific Information'", ":", "return", "None", "elif", "arg_2", "==", "'Contact Information'", ":", "return", "None", "elif", "arg_2", "==", "'Last Change Date'", ":", "return", "None", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get the attribute value from the kmip.pie managed object.\n        \"\"\"\n        if arg_2 == 'Unique Identifier':\n            return str(arg_1.unique_identifier)\n        elif arg_2 == 'Name':\n            arg_3 = list()\n            for arg_4 in arg_1.names:\n                arg_4 = attributes.Name(\n                    attributes.Name.NameValue(arg_4),\n                    attributes.Name.NameType(\n                        enums.NameType.UNINTERPRETED_TEXT_STRING\n                    )\n                )\n                arg_3.append(arg_4)\n            return arg_3\n        elif arg_2 == 'Object Type':\n            return arg_1._object_type\n        elif arg_2 == 'Cryptographic Algorithm':\n            return arg_1.cryptographic_algorithm\n        elif arg_2 == 'Cryptographic Length':\n            return arg_1.cryptographic_length\n        elif arg_2 == 'Cryptographic Parameters':\n            return None\n        elif arg_2 == 'Cryptographic Domain Parameters':\n            return None\n        elif arg_2 == 'Certificate Type':\n            return arg_1.certificate_type\n        elif arg_2 == 'Certificate Length':\n            return None\n        elif arg_2 == 'X.509 Certificate Identifier':\n            return None\n        elif arg_2 == 'X.509 Certificate Subject':\n            return None\n        elif arg_2 == 'X.509 Certificate Issuer':\n            return None\n        elif arg_2 == 'Certificate Identifier':\n            return None\n        elif arg_2 == 'Certificate Subject':\n            return None\n        elif arg_2 == 'Certificate Issuer':\n            return None\n        elif arg_2 == 'Digital Signature Algorithm':\n            return None\n        elif arg_2 == 'Digest':\n            return None\n        elif arg_2 == 'Operation Policy Name':\n            return arg_1.operation_policy_name\n        elif arg_2 == 'Cryptographic Usage Mask':\n            return arg_1.cryptographic_usage_masks\n        elif arg_2 == 'Lease Time':\n            return None\n        elif arg_2 == 'Usage Limits':\n            return None\n        elif arg_2 == 'State':\n            return arg_1.state\n        elif arg_2 == 'Initial Date':\n            return arg_1.initial_date\n        elif arg_2 == 'Activation Date':\n            return None\n        elif arg_2 == 'Process Start Date':\n            return None\n        elif arg_2 == 'Protect Stop Date':\n            return None\n        elif arg_2 == 'Deactivation Date':\n            return None\n        elif arg_2 == 'Destroy Date':\n            return None\n        elif arg_2 == 'Compromise Occurrence Date':\n            return None\n        elif arg_2 == 'Compromise Date':\n            return None\n        elif arg_2 == 'Revocation Reason':\n            return None\n        elif arg_2 == 'Archive Date':\n            return None\n        elif arg_2 == 'Object Group':\n            return None\n        elif arg_2 == 'Fresh':\n            return None\n        elif arg_2 == 'Link':\n            return None\n        elif arg_2 == 'Application Specific Information':\n            return None\n        elif arg_2 == 'Contact Information':\n            return None\n        elif arg_2 == 'Last Change Date':\n            return None\n        else:\n            # Since custom attribute names are possible, just return None\n            # for unrecognized attributes. This satisfies the spec.\n            return None", "path": "kmip/services/server/engine.py", "identifier": "KmipEngine._get_attribute_from_managed_object", "docstring": "Get the attribute value from the kmip.pie managed object.", "docstring_tokens": ["Get", "the", "attribute", "value", "from", "the", "kmip", ".", "pie", "managed", "object", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 259945}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L363-L369", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Advance to the next iteration cycle phase", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "__currentPhase", "=", "arg_0", ".", "__phaseCycler", ".", "next", "(", ")", "arg_0", ".", "__currentPhase", ".", "enterPhase", "(", ")", "return"], "function": "def Func(arg_0):\n    \"\"\" Advance to the next iteration cycle phase\n    \"\"\"\n    arg_0.__currentPhase = arg_0.__phaseCycler.next()\n    arg_0.__currentPhase.enterPhase()\n\n    return", "path": "src/nupic/frameworks/opf/opf_task_driver.py", "identifier": "_PhaseManager.__advancePhase", "docstring": "Advance to the next iteration cycle phase", "docstring_tokens": ["Advance", "to", "the", "next", "iteration", "cycle", "phase"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 259946}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varbase/autocorr.py#L61-L106", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is an alternative function to calculate the autocorrelation.", "language": "python", "parameters": "(mags, lag, maglen, magmed, magstd)", "return_statement": "return acorr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "nparange", "(", "0", ",", "arg_2", "-", "arg_1", ")", "arg_6", "=", "(", "arg_0", "[", "arg_5", "]", "-", "arg_3", ")", "*", "(", "arg_0", "[", "arg_5", "+", "arg_1", "]", "-", "arg_3", ")", "arg_7", "=", "npsum", "(", "arg_6", ")", "/", "arg_5", ".", "size", "arg_8", "=", "npsum", "(", "(", "arg_0", "[", "arg_5", "]", "-", "arg_3", ")", "*", "(", "arg_0", "[", "arg_5", "]", "-", "arg_3", ")", ")", "/", "arg_0", ".", "size", "arg_9", "=", "arg_7", "/", "arg_8", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    '''\n    This is an alternative function to calculate the autocorrelation.\n\n    This version is from (first definition):\n\n    https://en.wikipedia.org/wiki/Correlogram#Estimation_of_autocorrelations\n\n    Parameters\n    ----------\n\n    mags : np.array\n        This is the magnitudes array. MUST NOT have any nans.\n\n    lag : float\n        The specific lag value to calculate the auto-correlation for. This MUST\n        be less than total number of observations in `mags`.\n\n    maglen : int\n        The number of elements in the `mags` array.\n\n    magmed : float\n        The median of the `mags` array.\n\n    magstd : float\n        The standard deviation of the `mags` array.\n\n    Returns\n    -------\n\n    float\n        The auto-correlation at this specific `lag` value.\n\n    '''\n\n    arg_5 = nparange(0,arg_2-arg_1)\n    arg_6 = (arg_0[arg_5] - arg_3) * (arg_0[arg_5+arg_1] - arg_3)\n\n    arg_7 = npsum(arg_6)/arg_5.size\n    arg_8 = npsum(\n        (arg_0[arg_5] - arg_3)*(arg_0[arg_5] - arg_3)\n    )/arg_0.size\n\n    arg_9 = arg_7/arg_8\n\n    return arg_9", "path": "astrobase/varbase/autocorr.py", "identifier": "_autocorr_func2", "docstring": "This is an alternative function to calculate the autocorrelation.\n\n    This version is from (first definition):\n\n    https://en.wikipedia.org/wiki/Correlogram#Estimation_of_autocorrelations\n\n    Parameters\n    ----------\n\n    mags : np.array\n        This is the magnitudes array. MUST NOT have any nans.\n\n    lag : float\n        The specific lag value to calculate the auto-correlation for. This MUST\n        be less than total number of observations in `mags`.\n\n    maglen : int\n        The number of elements in the `mags` array.\n\n    magmed : float\n        The median of the `mags` array.\n\n    magstd : float\n        The standard deviation of the `mags` array.\n\n    Returns\n    -------\n\n    float\n        The auto-correlation at this specific `lag` value.", "docstring_tokens": ["This", "is", "an", "alternative", "function", "to", "calculate", "the", "autocorrelation", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 259947}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L840-L858", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "get host name of remote host", "language": "python", "parameters": "(ip_addr, cl_args)", "return_statement": "return output[0].strip(\"\\n\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "is_self", "(", "arg_0", ")", ":", "return", "get_self_hostname", "(", ")", "arg_2", "=", "\"hostname\"", "arg_3", "=", "ssh_remote_execute", "(", "arg_2", ",", "arg_0", ",", "arg_1", ")", "arg_4", "=", "subprocess", ".", "Popen", "(", "arg_3", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_5", "=", "arg_4", ".", "wait", "(", ")", "arg_6", "=", "arg_4", ".", "communicate", "(", ")", "if", "arg_5", "!=", "0", ":", "Log", ".", "error", "(", "\"Failed to get hostname for remote host %s with output:\\n%s\"", "%", "(", "arg_0", ",", "arg_6", ")", ")", "sys", ".", "exit", "(", "-", "1", ")", "return", "arg_6", "[", "0", "]", ".", "strip", "(", "\"\\n\"", ")"], "function": "def Func(arg_0, arg_1):\n  '''\n  get host name of remote host\n  '''\n  if is_self(arg_0):\n    return get_self_hostname()\n  arg_2 = \"hostname\"\n  arg_3 = ssh_remote_execute(arg_2, arg_0, arg_1)\n  arg_4 = subprocess.Popen(arg_3,\n                         shell=True,\n                         stdout=subprocess.PIPE,\n                         stderr=subprocess.PIPE)\n  arg_5 = arg_4.wait()\n  arg_6 = arg_4.communicate()\n\n  if arg_5 != 0:\n    Log.error(\"Failed to get hostname for remote host %s with output:\\n%s\" % (arg_0, arg_6))\n    sys.exit(-1)\n  return arg_6[0].strip(\"\\n\")", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "get_hostname", "docstring": "get host name of remote host", "docstring_tokens": ["get", "host", "name", "of", "remote", "host"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259948}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L729-L741", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Check for roster related features in the stream features received\n        and set `server_features` accordingly.", "language": "python", "parameters": "(self, event)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "set", "(", ")", "logger", ".", "debug", "(", "\"Checking roster-related features\"", ")", "if", "arg_1", ".", "features", ".", "find", "(", "FEATURE_ROSTERVER", ")", "is", "not", "None", ":", "logger", ".", "debug", "(", "\"  Roster versioning available\"", ")", "arg_2", ".", "add", "(", "\"versioning\"", ")", "if", "arg_1", ".", "features", ".", "find", "(", "FEATURE_APPROVALS", ")", "is", "not", "None", ":", "logger", ".", "debug", "(", "\"  Subscription pre-approvals available\"", ")", "arg_2", ".", "add", "(", "\"pre-approvals\"", ")", "arg_0", ".", "server_features", "=", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Check for roster related features in the stream features received\n        and set `server_features` accordingly.\n        \"\"\"\n        arg_2 = set()\n        logger.debug(\"Checking roster-related features\")\n        if arg_1.features.find(FEATURE_ROSTERVER) is not None:\n            logger.debug(\"  Roster versioning available\")\n            arg_2.add(\"versioning\")\n        if arg_1.features.find(FEATURE_APPROVALS) is not None:\n            logger.debug(\"  Subscription pre-approvals available\")\n            arg_2.add(\"pre-approvals\")\n        arg_0.server_features = arg_2", "path": "pyxmpp2/roster.py", "identifier": "RosterClient.handle_got_features_event", "docstring": "Check for roster related features in the stream features received\n        and set `server_features` accordingly.", "docstring_tokens": ["Check", "for", "roster", "related", "features", "in", "the", "stream", "features", "received", "and", "set", "server_features", "accordingly", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 259949}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/extradims.py#L111-L130", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns the index of the type as defined in the LAS Specification", "language": "python", "parameters": "(type_str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "_type_to_extra_dim_id_style_1", "[", "arg_0", "]", "except", "KeyError", ":", "try", ":", "return", "_type_to_extra_dim_id_style_2", "[", "arg_0", "]", "except", "KeyError", ":", "raise", "errors", ".", "UnknownExtraType", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\" Returns the index of the type as defined in the LAS Specification\n\n    Parameters\n    ----------\n    type_str: str\n\n    Returns\n    -------\n    int\n        index of the type\n\n    \"\"\"\n    try:\n        return _type_to_extra_dim_id_style_1[arg_0]\n    except KeyError:\n        try:\n            return _type_to_extra_dim_id_style_2[arg_0]\n        except KeyError:\n            raise errors.UnknownExtraType(arg_0)", "path": "pylas/extradims.py", "identifier": "get_id_for_extra_dim_type", "docstring": "Returns the index of the type as defined in the LAS Specification\n\n    Parameters\n    ----------\n    type_str: str\n\n    Returns\n    -------\n    int\n        index of the type", "docstring_tokens": ["Returns", "the", "index", "of", "the", "type", "as", "defined", "in", "the", "LAS", "Specification"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 259950}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/views.py#L369-L408", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns a profile form instance, and a boolean which is true if the\n    form was handled.", "language": "python", "parameters": "(request, prefix)", "return_statement": "return form, handled", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "people", ".", "Attendee", ".", "get_instance", "(", "arg_0", ".", "user", ")", "try", ":", "arg_3", "=", "arg_2", ".", "attendeeprofilebase", "arg_3", "=", "people", ".", "AttendeeProfileBase", ".", "objects", ".", "get_subclass", "(", "pk", "=", "arg_3", ".", "id", ",", ")", "except", "ObjectDoesNotExist", ":", "arg_3", "=", "None", "try", ":", "arg_4", "=", "arg_0", ".", "user", ".", "speaker_profile", "arg_5", "=", "arg_4", ".", "name", "except", "ObjectDoesNotExist", ":", "arg_5", "=", "None", "arg_6", "=", "ProfileForm", ".", "Meta", ".", "model", ".", "name_field", "(", ")", "arg_7", "=", "{", "}", "if", "arg_3", "is", "None", "and", "arg_6", "is", "not", "None", ":", "arg_7", "[", "arg_6", "]", "=", "arg_5", "arg_8", "=", "ProfileForm", "(", "arg_0", ".", "POST", "or", "None", ",", "arg_7", "=", "arg_7", ",", "arg_10", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")", "arg_9", "=", "True", "if", "arg_0", ".", "POST", "else", "False", "if", "arg_0", ".", "POST", "and", "arg_8", ".", "is_valid", "(", ")", ":", "arg_8", ".", "instance", ".", "attendee", "=", "arg_2", "arg_8", ".", "save", "(", ")", "return", "arg_8", ",", "arg_9"], "function": "def Func(arg_0, arg_1):\n    ''' Returns a profile form instance, and a boolean which is true if the\n    form was handled. '''\n    arg_2 = people.Attendee.get_instance(arg_0.user)\n\n    try:\n        arg_3 = arg_2.attendeeprofilebase\n        arg_3 = people.AttendeeProfileBase.objects.get_subclass(\n            pk=arg_3.id,\n        )\n    except ObjectDoesNotExist:\n        arg_3 = None\n\n    # Load a pre-entered name from the speaker's profile,\n    # if they have one.\n    try:\n        arg_4 = arg_0.user.speaker_profile\n        arg_5 = arg_4.name\n    except ObjectDoesNotExist:\n        arg_5 = None\n\n    arg_6 = ProfileForm.Meta.model.name_field()\n    arg_7 = {}\n    if arg_3 is None and arg_6 is not None:\n        arg_7[arg_6] = arg_5\n\n    arg_8 = ProfileForm(\n        arg_0.POST or None,\n        arg_7=arg_7,\n        arg_10=arg_3,\n        arg_1=arg_1\n    )\n\n    arg_9 = True if arg_0.POST else False\n\n    if arg_0.POST and arg_8.is_valid():\n        arg_8.instance.attendee = arg_2\n        arg_8.save()\n\n    return arg_8, arg_9", "path": "registrasion/views.py", "identifier": "_handle_profile", "docstring": "Returns a profile form instance, and a boolean which is true if the\n    form was handled.", "docstring_tokens": ["Returns", "a", "profile", "form", "instance", "and", "a", "boolean", "which", "is", "true", "if", "the", "form", "was", "handled", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 259951}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1854-L1908", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Outlines each contour in a path with the colors in the list.", "language": "python", "parameters": "(path, colors, precision=0.4, continuous=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.4", ",", "arg_3", "=", "True", ")", ":", "def", "_point_count", "(", "arg_0", ",", "arg_2", ")", ":", "return", "max", "(", "int", "(", "arg_0", ".", "length", "*", "arg_2", "*", "0.5", ")", ",", "10", ")", "arg_4", "=", "sum", "(", "[", "_point_count", "(", "arg_8", ",", "arg_2", ")", "for", "arg_8", "in", "arg_0", ".", "contours", "]", ")", "arg_5", "=", "0", "arg_6", "=", "len", "(", "arg_0", ".", "contours", ")", "-", "1", "if", "arg_6", "==", "0", ":", "arg_3", "=", "False", "arg_7", "=", "0", "for", "arg_8", "in", "arg_0", ".", "contours", ":", "if", "not", "arg_3", ":", "arg_7", "=", "0", "arg_9", "=", "_point_count", "(", "arg_8", ",", "arg_2", ")", "arg_10", "=", "True", "for", "arg_11", "in", "arg_8", ".", "points", "(", "arg_9", ")", ":", "if", "arg_10", ":", "arg_10", "=", "False", "else", ":", "if", "not", "arg_3", ":", "arg_12", "=", "float", "(", "arg_7", ")", "/", "arg_9", "*", "len", "(", "arg_1", ")", "else", ":", "arg_12", "=", "float", "(", "arg_7", ")", "/", "arg_4", "*", "len", "(", "arg_1", ")", "-", "1", "*", "arg_5", "/", "arg_6", "_ctx", ".", "stroke", "(", "arg_1", "[", "int", "(", "arg_12", ")", "]", ")", "_ctx", ".", "line", "(", "arg_13", ",", "arg_14", ",", "arg_11", ".", "x", ",", "arg_11", ".", "y", ")", "arg_13", "=", "arg_11", ".", "x", "arg_14", "=", "arg_11", ".", "y", "arg_7", "+=", "1", "arg_11", "=", "arg_8", ".", "point", "(", "0.9999999", ")", "_ctx", ".", "line", "(", "arg_13", ",", "arg_14", ",", "arg_11", ".", "x", ",", "arg_11", ".", "y", ")", "arg_5", "+=", "1"], "function": "def Func(arg_0, arg_1, arg_2=0.4, arg_3=True):\n    \"\"\"\n    Outlines each contour in a path with the colors in the list.\n\n    Each contour starts with the first color in the list,\n    and ends with the last color in the list.\n\n    Because each line segment is drawn separately,\n    works only with corner-mode transforms.\n    \"\"\"\n    # The count of points in a given path/contour.\n    def _point_count(arg_0, arg_2):\n        return max(int(arg_0.length * arg_2 * 0.5), 10)\n\n    # The total count of points in the path.\n    arg_4 = sum([_point_count(arg_8, arg_2) for arg_8 in arg_0.contours])\n\n    # For a continuous gradient,\n    # we need to calculate a subrange in the list of colors\n    # for each contour to draw colors from.\n    arg_5 = 0\n    arg_6 = len(arg_0.contours) - 1\n    if arg_6 == 0: arg_3 = False\n\n    arg_7 = 0\n    for arg_8 in arg_0.contours:\n\n        if not arg_3: arg_7 = 0\n\n        # The number of points for each contour.\n        arg_9 = _point_count(arg_8, arg_2)\n\n        arg_10 = True\n        for arg_11 in arg_8.points(arg_9):\n            if arg_10:\n                arg_10 = False\n            else:\n                if not arg_3:\n                    # If we have a list of 100 colors and 50 points,\n                    # point i maps to color i*2.\n                    arg_12 = float(arg_7) / arg_9 * len(arg_1)\n                else:\n                    # In a continuous gradient of 100 colors,\n                    # the 2nd contour in a path with 10 contours\n                    # draws colors between 10-20\n                    arg_12 = float(arg_7) / arg_4 * len(arg_1) - 1 * arg_5 / arg_6\n                _ctx.stroke(arg_1[int(arg_12)])\n                _ctx.line(arg_13, arg_14, arg_11.x, arg_11.y)\n            arg_13 = arg_11.x\n            arg_14 = arg_11.y\n            arg_7 += 1\n\n        arg_11 = arg_8.point(0.9999999)  # Fix in pathmatics!\n        _ctx.line(arg_13, arg_14, arg_11.x, arg_11.y)\n        arg_5 += 1", "path": "lib/colors/__init__.py", "identifier": "outline", "docstring": "Outlines each contour in a path with the colors in the list.\n\n    Each contour starts with the first color in the list,\n    and ends with the last color in the list.\n\n    Because each line segment is drawn separately,\n    works only with corner-mode transforms.", "docstring_tokens": ["Outlines", "each", "contour", "in", "a", "path", "with", "the", "colors", "in", "the", "list", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259952}
{"url": "https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/orderbook.py#L120-L153", "sha": "e3762f77583f89cf7b4f501ab3c7675fc7d30ab3", "docstring_summary": "Handles real-time updates to the order book.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "arg_0", ".", "ws_client", ".", "connected", "(", ")", ":", "if", "arg_0", ".", "die", ":", "break", "if", "arg_0", ".", "pause", ":", "sleep", "(", "5", ")", "continue", "arg_1", "=", "arg_0", ".", "ws_client", ".", "receive", "(", ")", "if", "arg_1", "is", "None", ":", "break", "arg_2", "=", "arg_1", "[", "'type'", "]", "if", "arg_2", "==", "'error'", ":", "continue", "if", "arg_1", "[", "'sequence'", "]", "<=", "arg_0", ".", "sequence", ":", "continue", "if", "arg_2", "==", "'open'", ":", "arg_0", ".", "_handle_open", "(", "arg_1", ")", "elif", "arg_2", "==", "'match'", ":", "arg_0", ".", "_handle_match", "(", "arg_1", ")", "elif", "arg_2", "==", "'done'", ":", "arg_0", ".", "_handle_done", "(", "arg_1", ")", "elif", "arg_2", "==", "'change'", ":", "arg_0", ".", "_handle_change", "(", "arg_1", ")", "else", ":", "continue", "arg_0", ".", "ws_client", ".", "disconnect", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Handles real-time updates to the order book.\"\"\"\n    while arg_0.ws_client.connected():\n      if arg_0.die:\n        break\n      \n      if arg_0.pause:\n        sleep(5)\n        continue\n\n      arg_1 = arg_0.ws_client.receive()\n\n      if arg_1 is None:\n        break\n\n      arg_2 = arg_1['type']\n\n      if arg_2  == 'error':\n        continue\n      if arg_1['sequence'] <= arg_0.sequence:\n        continue\n\n      if arg_2 == 'open':\n        arg_0._handle_open(arg_1)\n      elif arg_2 == 'match':\n        arg_0._handle_match(arg_1)\n      elif arg_2 == 'done':\n        arg_0._handle_done(arg_1)\n      elif arg_2 == 'change':\n        arg_0._handle_change(arg_1)\n      else:\n        continue\n\n    arg_0.ws_client.disconnect()", "path": "cbexchange/orderbook.py", "identifier": "OrderBook._real_time_thread", "docstring": "Handles real-time updates to the order book.", "docstring_tokens": ["Handles", "real", "-", "time", "updates", "to", "the", "order", "book", "."], "nwo": "agsimeonov/cbexchange", "score": 0.0, "idx": 259953}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L161-L178", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return the description of the courserun content item.", "language": "python", "parameters": "(self, content_metadata_item)", "return_statement": "return description_with_locales", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "transform_language_code", "(", "arg_1", ".", "get", "(", "'content_language'", ",", "''", ")", ")", "for", "arg_4", "in", "arg_0", ".", "enterprise_configuration", ".", "get_locales", "(", "default_locale", "=", "arg_3", ")", ":", "arg_2", ".", "append", "(", "{", "'locale'", ":", "arg_4", ",", "'value'", ":", "(", "arg_1", "[", "'full_description'", "]", "or", "arg_1", "[", "'short_description'", "]", "or", "arg_1", "[", "'title'", "]", "or", "''", ")", "}", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return the description of the courserun content item.\n        \"\"\"\n        arg_2 = []\n        arg_3 = transform_language_code(arg_1.get('content_language', ''))\n        for arg_4 in arg_0.enterprise_configuration.get_locales(default_locale=arg_3):\n            arg_2.append({\n                'locale': arg_4,\n                'value': (\n                    arg_1['full_description'] or\n                    arg_1['short_description'] or\n                    arg_1['title'] or\n                    ''\n                )\n            })\n\n        return arg_2", "path": "integrated_channels/sap_success_factors/exporters/content_metadata.py", "identifier": "SapSuccessFactorsContentMetadataExporter.transform_courserun_description", "docstring": "Return the description of the courserun content item.", "docstring_tokens": ["Return", "the", "description", "of", "the", "courserun", "content", "item", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259954}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L92-L120", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Fail for edges with citations whose references are one of the given PubMed identifiers.", "language": "python", "parameters": "(pmids: Strings)", "return_statement": "return pmid_exclusion_filter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "EdgePredicate", ":", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "@", "edge_predicate", "def", "pmid_exclusion_filter", "(", "arg_2", ":", "arg_3", ")", "->", "bool", ":", "return", "has_pubmed", "(", "arg_2", ")", "and", "arg_2", "[", "CITATION", "]", "[", "CITATION_REFERENCE", "]", "!=", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "Iterable", ")", ":", "arg_0", "=", "set", "(", "arg_0", ")", "@", "edge_predicate", "def", "pmid_exclusion_filter", "(", "arg_2", ":", "arg_3", ")", "->", "bool", ":", "return", "has_pubmed", "(", "arg_2", ")", "and", "arg_2", "[", "CITATION", "]", "[", "CITATION_REFERENCE", "]", "not", "in", "arg_0", "else", ":", "raise", "TypeError", "return", "pmid_exclusion_filter"], "function": "def Func(arg_0: arg_1) -> EdgePredicate:\n    \"\"\"Fail for edges with citations whose references are one of the given PubMed identifiers.\n\n    :param pmids: A PubMed identifier or list of PubMed identifiers to filter against\n    \"\"\"\n    if isinstance(arg_0, str):\n        @edge_predicate\n        def pmid_exclusion_filter(arg_2: arg_3) -> bool:\n            \"\"\"Fail for edges with PubMed citations matching the contained PubMed identifier.\n\n            :return: If the edge has a PubMed citation with the contained PubMed identifier\n            \"\"\"\n            return has_pubmed(arg_2) and arg_2[CITATION][CITATION_REFERENCE] != arg_0\n\n    elif isinstance(arg_0, Iterable):\n        arg_0 = set(arg_0)\n\n        @edge_predicate\n        def pmid_exclusion_filter(arg_2: arg_3) -> bool:\n            \"\"\"Pass for edges with PubMed citations matching one of the contained PubMed identifiers.\n\n            :return: If the edge has a PubMed citation with one of the contained PubMed identifiers\n            \"\"\"\n            return has_pubmed(arg_2) and arg_2[CITATION][CITATION_REFERENCE] not in arg_0\n\n    else:\n        raise TypeError\n\n    return pmid_exclusion_filter", "path": "src/pybel_tools/filters/edge_filters.py", "identifier": "build_pmid_exclusion_filter", "docstring": "Fail for edges with citations whose references are one of the given PubMed identifiers.\n\n    :param pmids: A PubMed identifier or list of PubMed identifiers to filter against", "docstring_tokens": ["Fail", "for", "edges", "with", "citations", "whose", "references", "are", "one", "of", "the", "given", "PubMed", "identifiers", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 259955}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/util.py#L310-L317", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Opposite slicer, the outer part wrt to a field", "language": "python", "parameters": "(self, tile)", "return_statement": "return tuple(np.array(i).astype('int') for i in zip(*[v[mask] for v in vecs]))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "arg_3", "=", "arg_1", ".", "coords", "(", "form", "=", "'meshed'", ")", "for", "arg_4", "in", "arg_3", ":", "arg_4", "[", "arg_0", ".", "slicer", "]", "=", "-", "1", "arg_2", "=", "arg_2", "&", "(", "arg_4", ">", "0", ")", "if", "arg_2", "is", "not", "None", "else", "(", "arg_4", ">", "0", ")", "return", "tuple", "(", "np", ".", "array", "(", "arg_6", ")", ".", "astype", "(", "'int'", ")", "for", "arg_6", "in", "zip", "(", "*", "[", "arg_4", "[", "arg_2", "]", "for", "arg_4", "in", "arg_3", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Opposite slicer, the outer part wrt to a field \"\"\"\n        arg_2 = None\n        arg_3 = arg_1.coords(form='meshed')\n        for arg_4 in arg_3:\n            arg_4[arg_0.slicer] = -1\n            arg_2 = arg_2 & (arg_4 > 0) if arg_2 is not None else (arg_4>0)\n        return tuple(np.array(arg_6).astype('int') for arg_6 in zip(*[arg_4[arg_2] for arg_4 in arg_3]))", "path": "peri/util.py", "identifier": "Tile.oslicer", "docstring": "Opposite slicer, the outer part wrt to a field", "docstring_tokens": ["Opposite", "slicer", "the", "outer", "part", "wrt", "to", "a", "field"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 259956}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/effects/effect.py#L140-L151", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Get a texture by its label", "language": "python", "parameters": "(self, label: str)", "return_statement": "return self._project.get_texture(label)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Union", "[", "moderngl", ".", "Texture", ",", "moderngl", ".", "TextureArray", ",", "moderngl", ".", "Texture3D", ",", "moderngl", ".", "TextureCube", "]", ":", "return", "arg_0", ".", "_project", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> Union[moderngl.Texture, moderngl.TextureArray,\n                                               moderngl.Texture3D, moderngl.TextureCube]:\n        \"\"\"\n        Get a texture by its label\n\n        Args:\n            label (str): The Label for the texture\n\n        Returns:\n            The py:class:`moderngl.Texture` instance\n        \"\"\"\n        return arg_0._project.Func(arg_1)", "path": "demosys/effects/effect.py", "identifier": "Effect.get_texture", "docstring": "Get a texture by its label\n\n        Args:\n            label (str): The Label for the texture\n\n        Returns:\n            The py:class:`moderngl.Texture` instance", "docstring_tokens": ["Get", "a", "texture", "by", "its", "label"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 259957}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/django_util/decorators.py#L97-L145", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Decorator to enable OAuth Credentials if authorized, and setup\n    the oauth object on the request object to provide helper functions\n    to start the flow otherwise.", "language": "python", "parameters": "(decorated_function=None, scopes=None, **decorator_kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "def", "curry_wrapper", "(", "arg_3", ")", ":", "@", "wraps", "(", "arg_3", ")", "def", "enabled_wrapper", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "arg_7", "=", "arg_2", ".", "pop", "(", "'return_url'", ",", "arg_4", ".", "get_full_path", "(", ")", ")", "arg_8", "=", "django_util", ".", "UserOAuth2", "(", "arg_4", ",", "arg_1", ",", "arg_7", ")", "setattr", "(", "arg_4", ",", "django_util", ".", "oauth2_settings", ".", "request_prefix", ",", "arg_8", ")", "return", "arg_3", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", "return", "enabled_wrapper", "if", "arg_0", ":", "return", "curry_wrapper", "(", "arg_0", ")", "else", ":", "return", "curry_wrapper"], "function": "def Func(arg_0=None, arg_1=None, **arg_2):\n    \"\"\" Decorator to enable OAuth Credentials if authorized, and setup\n    the oauth object on the request object to provide helper functions\n    to start the flow otherwise.\n\n    .. code-block:: python\n       :caption: views.py\n       :name: views_enabled3\n\n       from oauth2client.django_util.decorators import Func\n\n       @Func\n       def optional_oauth2(request):\n           if request.oauth.has_credentials():\n               # this could be passed into a view\n               # request.oauth.http is also initialized\n               return HttpResponse(\"User email: {0}\".format(\n                                   request.oauth.credentials.id_token['email'])\n           else:\n               return HttpResponse('Here is an OAuth Authorize link:\n               <a href=\"{0}\">Authorize</a>'.format(\n                   request.oauth.get_authorize_redirect()))\n\n\n    Args:\n        decorated_function: View function to decorate.\n        scopes: Scopes to require, will default.\n        decorator_kwargs: Can include ``return_url`` to specify the URL to\n           return to after OAuth2 authorization is complete.\n\n    Returns:\n         The decorated view function.\n    \"\"\"\n    def curry_wrapper(arg_3):\n        @wraps(arg_3)\n        def enabled_wrapper(arg_4, *arg_5, **arg_6):\n            arg_7 = arg_2.pop('return_url',\n                                              arg_4.get_full_path())\n            arg_8 = django_util.UserOAuth2(arg_4, arg_1, arg_7)\n            setattr(arg_4, django_util.oauth2_settings.request_prefix,\n                    arg_8)\n            return arg_3(arg_4, *arg_5, **arg_6)\n\n        return enabled_wrapper\n\n    if arg_0:\n        return curry_wrapper(arg_0)\n    else:\n        return curry_wrapper", "path": "oauth2client/contrib/django_util/decorators.py", "identifier": "oauth_enabled", "docstring": "Decorator to enable OAuth Credentials if authorized, and setup\n    the oauth object on the request object to provide helper functions\n    to start the flow otherwise.\n\n    .. code-block:: python\n       :caption: views.py\n       :name: views_enabled3\n\n       from oauth2client.django_util.decorators import oauth_enabled\n\n       @oauth_enabled\n       def optional_oauth2(request):\n           if request.oauth.has_credentials():\n               # this could be passed into a view\n               # request.oauth.http is also initialized\n               return HttpResponse(\"User email: {0}\".format(\n                                   request.oauth.credentials.id_token['email'])\n           else:\n               return HttpResponse('Here is an OAuth Authorize link:\n               <a href=\"{0}\">Authorize</a>'.format(\n                   request.oauth.get_authorize_redirect()))\n\n\n    Args:\n        decorated_function: View function to decorate.\n        scopes: Scopes to require, will default.\n        decorator_kwargs: Can include ``return_url`` to specify the URL to\n           return to after OAuth2 authorization is complete.\n\n    Returns:\n         The decorated view function.", "docstring_tokens": ["Decorator", "to", "enable", "OAuth", "Credentials", "if", "authorized", "and", "setup", "the", "oauth", "object", "on", "the", "request", "object", "to", "provide", "helper", "functions", "to", "start", "the", "flow", "otherwise", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 259958}
{"url": "https://github.com/bmaeser/pyque/blob/856dceab8d89cf3771cf21e682466c29a85ae8eb/pyque/db/postgresql.py#L70-L88", "sha": "856dceab8d89cf3771cf21e682466c29a85ae8eb", "docstring_summary": "returns a list of all databases on this server", "language": "python", "parameters": "(username=None, password=None, host=None, port=None,\n        maintain_db='postgres')", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'postgres'", ")", ":", "arg_5", "=", "_connection", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "db", "=", "arg_4", ")", "arg_6", "=", "arg_5", ".", "cursor", "(", ")", "arg_6", ".", "execute", "(", "'SELECT DATNAME from pg_database'", ")", "arg_7", "=", "arg_6", ".", "fetchall", "(", ")", "arg_5", ".", "close", "(", ")", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_7", ":", "arg_8", ".", "append", "(", "arg_9", "[", "0", "]", ")", "return", "arg_8"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3=None,\n        arg_4='postgres'):\n    \"returns a list of all databases on this server\"\n\n    arg_5 = _connection(arg_0=arg_0, arg_1=arg_1, arg_2=arg_2,\n        arg_3=arg_3, db=arg_4)\n\n    arg_6 = arg_5.cursor()\n\n    arg_6.execute('SELECT DATNAME from pg_database')\n    arg_7 = arg_6.fetchall()\n\n    arg_5.close()\n\n    arg_8 = []\n    for arg_9 in arg_7:\n        arg_8.append(arg_9[0])\n\n    return arg_8", "path": "pyque/db/postgresql.py", "identifier": "db_list", "docstring": "returns a list of all databases on this server", "docstring_tokens": ["returns", "a", "list", "of", "all", "databases", "on", "this", "server"], "nwo": "bmaeser/pyque", "score": 0.09252797783733271, "idx": 259959}
{"url": "https://github.com/dropseed/combine/blob/b0d622d09fcb121bc12e65f6044cb3a940b6b052/combine/cli.py#L65-L73", "sha": "b0d622d09fcb121bc12e65f6044cb3a940b6b052", "docstring_summary": "Outputs the CSS which can be customized for highlighted code", "language": "python", "parameters": "(ctx, style)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "click", ".", "secho", "(", "\"The following styles are available to choose from:\"", ",", "fg", "=", "\"green\"", ")", "click", ".", "echo", "(", "list", "(", "pygments", ".", "styles", ".", "get_all_styles", "(", ")", ")", ")", "click", ".", "echo", "(", ")", "click", ".", "secho", "(", "f'The following CSS for the \"{style}\" style can be customized:'", ",", "fg", "=", "\"green\"", ")", "click", ".", "echo", "(", "pygments", ".", "formatters", ".", "HtmlFormatter", "(", "arg_1", "=", "arg_1", ")", ".", "get_style_defs", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Outputs the CSS which can be customized for highlighted code\"\"\"\n    click.secho(\"The following styles are available to choose from:\", fg=\"green\")\n    click.echo(list(pygments.styles.get_all_styles()))\n    click.echo()\n    click.secho(\n        f'The following CSS for the \"{style}\" style can be customized:', fg=\"green\"\n    )\n    click.echo(pygments.formatters.HtmlFormatter(arg_1=arg_1).get_style_defs())", "path": "combine/cli.py", "identifier": "highlight_info", "docstring": "Outputs the CSS which can be customized for highlighted code", "docstring_tokens": ["Outputs", "the", "CSS", "which", "can", "be", "customized", "for", "highlighted", "code"], "nwo": "dropseed/combine", "score": 0.2424429654267875, "idx": 259960}
{"url": "https://github.com/stevelittlefish/littlefish/blob/6deee7f81fab30716c743efe2e94e786c6e17016/littlefish/celeryutil.py#L57-L77", "sha": "6deee7f81fab30716c743efe2e94e786c6e17016", "docstring_summary": "Initialise Celery and set up logging", "language": "python", "parameters": "(app, celery)", "return_statement": "return celery", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "conf", ".", "update", "(", "arg_0", ".", "config", ")", "arg_2", "=", "arg_1", ".", "Task", "class", "ContextTask", "(", "arg_2", ")", ":", "arg_3", "=", "True", "def", "__call__", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", ":", "with", "arg_0", ".", "app_context", "(", ")", ":", "return", "arg_2", ".", "__call__", "(", "arg_4", ",", "*", "arg_5", ",", "**", "arg_6", ")", "arg_1", ".", "Task", "=", "ContextTask", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Initialise Celery and set up logging\n\n    :param app: Flask app\n    :param celery: Celery instance\n    \"\"\"\n    arg_1.conf.update(arg_0.config)\n    \n    arg_2 = arg_1.Task\n\n    class ContextTask(arg_2):\n        arg_3 = True\n\n        def __call__(arg_4, *arg_5, **arg_6):\n            with arg_0.app_context():\n                return arg_2.__call__(arg_4, *arg_5, **arg_6)\n\n    arg_1.Task = ContextTask\n    \n    return arg_1", "path": "littlefish/celeryutil.py", "identifier": "init_celery", "docstring": "Initialise Celery and set up logging\n\n    :param app: Flask app\n    :param celery: Celery instance", "docstring_tokens": ["Initialise", "Celery", "and", "set", "up", "logging"], "nwo": "stevelittlefish/littlefish", "score": 0.23137166388621372, "idx": 259961}
{"url": "https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/utils.py#L26-L28", "sha": "d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd", "docstring_summary": "Runs a subprocess shell with check=True by default", "language": "python", "parameters": "(cmd, check=True, stdin=None, stdout=None, stderr=None)", "return_statement": "return subprocess.run(cmd, shell=True, check=check, stdin=stdin, stdout=stdout, stderr=stderr)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "return", "subprocess", ".", "run", "(", "arg_0", ",", "Func", "=", "True", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=None, arg_3=None, arg_4=None):\n    \"\"\"Runs a subprocess Func with check=True by default\"\"\"\n    return subprocess.run(arg_0, Func=True, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)", "path": "temple/utils.py", "identifier": "shell", "docstring": "Runs a subprocess shell with check=True by default", "docstring_tokens": ["Runs", "a", "subprocess", "shell", "with", "check", "=", "True", "by", "default"], "nwo": "CloverHealth/temple", "score": 0.39091779717332914, "idx": 259962}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L288-L317", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "Add function 'enrichr' argument parsers.", "language": "python", "parameters": "(subparsers)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "add_parser", "(", "\"enrichr\"", ",", "help", "=", "\"Using Enrichr API to perform GO analysis.\"", ")", "arg_2", "=", "arg_1", ".", "add_argument_group", "(", "\"Input arguments\"", ")", "arg_2", ".", "add_argument", "(", "\"-i\"", ",", "\"--input-list\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"gene_list\"", ",", "type", "=", "str", ",", "required", "=", "True", ",", "metavar", "=", "'IDs'", ",", "help", "=", "\"Enrichr uses a list of gene names as input.\"", ")", "arg_2", ".", "add_argument", "(", "\"-g\"", ",", "\"--gene-sets\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"library\"", ",", "type", "=", "str", ",", "required", "=", "True", ",", "metavar", "=", "'GMT'", ",", "help", "=", "\"Enrichr library name(s) required. Separate each name by comma.\"", ")", "arg_2", ".", "add_argument", "(", "\"--org\"", ",", "\"--organism\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"organism\"", ",", "type", "=", "str", ",", "default", "=", "''", ",", "help", "=", "\"Enrichr supported organism name. Default: human. See here: https://amp.pharm.mssm.edu/modEnrichr.\"", ")", "arg_2", ".", "add_argument", "(", "\"--ds\"", ",", "\"--description\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"descrip\"", ",", "type", "=", "str", ",", "default", "=", "'enrichr'", ",", "metavar", "=", "'STRING'", ",", "help", "=", "\"It is recommended to enter a short description for your list so that multiple lists \\                              can be differentiated from each other if you choose to save or share your list.\"", ")", "arg_2", ".", "add_argument", "(", "\"--cut\"", ",", "\"--cut-off\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"thresh\"", ",", "metavar", "=", "'float'", ",", "type", "=", "float", ",", "default", "=", "0.05", ",", "help", "=", "\"Adjust-Pval cutoff, used for generating plots. Default: 0.05.\"", ")", "arg_2", ".", "add_argument", "(", "\"--bg\"", ",", "\"--background\"", ",", "action", "=", "\"store\"", ",", "dest", "=", "\"bg\"", ",", "default", "=", "'hsapiens_gene_ensembl'", ",", "metavar", "=", "'BGNUM'", ",", "help", "=", "\"BioMart Dataset name or Background total genes number. Default: None\"", ")", "arg_2", ".", "add_argument", "(", "\"-t\"", ",", "\"--top-term\"", ",", "dest", "=", "\"term\"", ",", "action", "=", "\"store\"", ",", "type", "=", "int", ",", "default", "=", "10", ",", "metavar", "=", "'int'", ",", "help", "=", "\"Numbers of top terms shown in the plot. Default: 10\"", ")", "arg_3", "=", "arg_1", ".", "add_argument_group", "(", "\"Output figure arguments\"", ")", "add_output_option", "(", "arg_3", ")", "return"], "function": "def Func(arg_0):\n    \"\"\"Add function 'enrichr' argument parsers.\"\"\"\n\n    arg_1 = arg_0.add_parser(\"enrichr\", help=\"Using Enrichr API to perform GO analysis.\")\n\n    # group for required options.\n    arg_2 = arg_1.add_argument_group(\"Input arguments\")\n    arg_2.add_argument(\"-i\", \"--input-list\", action=\"store\", dest=\"gene_list\", type=str, required=True, metavar='IDs',\n                              help=\"Enrichr uses a list of gene names as input.\")\n    arg_2.add_argument(\"-g\", \"--gene-sets\", action=\"store\", dest=\"library\", type=str, required=True, metavar='GMT',\n                              help=\"Enrichr library name(s) required. Separate each name by comma.\")\n    arg_2.add_argument(\"--org\", \"--organism\", action=\"store\", dest=\"organism\", type=str, default='',\n                             help=\"Enrichr supported organism name. Default: human. See here: https://amp.pharm.mssm.edu/modEnrichr.\")\n    arg_2.add_argument(\"--ds\", \"--description\", action=\"store\", dest=\"descrip\", type=str, default='enrichr', metavar='STRING',\n                              help=\"It is recommended to enter a short description for your list so that multiple lists \\\n                              can be differentiated from each other if you choose to save or share your list.\")\n    arg_2.add_argument(\"--cut\", \"--cut-off\", action=\"store\", dest=\"thresh\", metavar='float', type=float, default=0.05,\n                              help=\"Adjust-Pval cutoff, used for generating plots. Default: 0.05.\")\n    arg_2.add_argument(\"--bg\", \"--background\", action=\"store\", dest=\"bg\", default='hsapiens_gene_ensembl', metavar='BGNUM',\n                              help=\"BioMart Dataset name or Background total genes number. Default: None\")\n    arg_2.add_argument(\"-t\", \"--top-term\", dest=\"term\", action=\"store\", type=int, default=10, metavar='int',\n                              help=\"Numbers of top terms shown in the plot. Default: 10\")\n    # enrichr_opt.add_argument(\"--scale\", dest = \"scale\", action=\"store\", type=float, default=0.5, metavar='float',\n    #                          help=\"scatter dot scale in the dotplot. Default: 0.5\")\n    # enrichr_opt.add_argument(\"--no-plot\", action='store_true', dest='no_plot', default=False,\n    #                           help=\"Suppress the plot output.This is useful only if data are interested. Default: False.\")\n\n    arg_3 = arg_1.add_argument_group(\"Output figure arguments\")\n    add_output_option(arg_3)\n    return", "path": "gseapy/__main__.py", "identifier": "add_enrichr_parser", "docstring": "Add function 'enrichr' argument parsers.", "docstring_tokens": ["Add", "function", "enrichr", "argument", "parsers", "."], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 259963}
{"url": "https://github.com/GoogleCloudPlatform/psq/blob/3c5130731d72b6c32d09a6a5d478f3580ff36d50/psq/broadcast_queue.py#L39-L56", "sha": "3c5130731d72b6c32d09a6a5d478f3580ff36d50", "docstring_summary": "In a broadcast queue, workers have a unique subscription ensuring\n        that every worker recieves a copy of every task.", "language": "python", "parameters": "(self)", "return_statement": "return subscription_path", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_topic_path", "(", ")", "arg_2", "=", "'{}-{}-{}-worker'", ".", "format", "(", "queue", ".", "PUBSUB_OBJECT_PREFIX", ",", "arg_0", ".", "name", ",", "uuid4", "(", ")", ".", "hex", ")", "arg_3", "=", "arg_0", ".", "subscriber_client", ".", "subscription_path", "(", "arg_0", ".", "project", ",", "arg_2", ")", "try", ":", "arg_0", ".", "subscriber_client", ".", "get_subscription", "(", "arg_3", ")", "except", "google", ".", "cloud", ".", "exceptions", ".", "NotFound", ":", "logger", ".", "info", "(", "\"Creating worker subscription {}\"", ".", "format", "(", "arg_2", ")", ")", "arg_0", ".", "subscriber_client", ".", "create_subscription", "(", "arg_3", ",", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"In a broadcast queue, workers have a unique subscription ensuring\n        that every worker recieves a copy of every task.\"\"\"\n        arg_1 = arg_0._get_topic_path()\n        arg_2 = '{}-{}-{}-worker'.format(\n            queue.PUBSUB_OBJECT_PREFIX, arg_0.name, uuid4().hex)\n        arg_3 = arg_0.subscriber_client.subscription_path(\n            arg_0.project, arg_2)\n\n        try:\n            arg_0.subscriber_client.get_subscription(arg_3)\n        except google.cloud.exceptions.NotFound:\n            logger.info(\"Creating worker subscription {}\".format(\n                arg_2))\n            arg_0.subscriber_client.create_subscription(\n                arg_3, arg_1)\n\n        return arg_3", "path": "psq/broadcast_queue.py", "identifier": "BroadcastQueue._get_or_create_subscription", "docstring": "In a broadcast queue, workers have a unique subscription ensuring\n        that every worker recieves a copy of every task.", "docstring_tokens": ["In", "a", "broadcast", "queue", "workers", "have", "a", "unique", "subscription", "ensuring", "that", "every", "worker", "recieves", "a", "copy", "of", "every", "task", "."], "nwo": "GoogleCloudPlatform/psq", "score": 0.5618802531255049, "idx": 259964}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L2685-L2731", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Loads a theme from aggregated web data.", "language": "python", "parameters": "(self, top=5, blue=\"blue\", archive=None, member=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "5", ",", "arg_2", "=", "\"blue\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "cache", ",", "arg_0", ".", "name", "+", "\".xml\"", ")", "arg_6", "=", "open", "(", "arg_5", ")", ".", "read", "(", ")", "else", ":", "assert", "arg_4", "is", "not", "None", "arg_6", "=", "arg_3", ".", "read", "(", "arg_4", ")", "arg_7", "=", "parseString", "(", "arg_6", ")", ".", "documentElement", "arg_8", "=", "lambda", "arg_9", ",", "a", ":", "arg_9", ".", "attributes", "[", "a", "]", ".", "value", "for", "arg_9", "in", "arg_7", ".", "getElementsByTagName", "(", "\"color\"", ")", "[", ":", "arg_1", "]", ":", "arg_10", "=", "float", "(", "arg_8", "(", "arg_9", ",", "\"weight\"", ")", ")", "try", ":", "arg_11", "=", "arg_9", ".", "getElementsByTagName", "(", "\"rgb\"", ")", "[", "0", "]", "arg_12", "=", "color", "(", "float", "(", "arg_8", "(", "arg_11", ",", "\"r\"", ")", ")", ",", "float", "(", "arg_8", "(", "arg_11", ",", "\"g\"", ")", ")", ",", "float", "(", "arg_8", "(", "arg_11", ",", "\"b\"", ")", ")", ",", "float", "(", "arg_8", "(", "arg_11", ",", "\"a\"", ")", ")", ",", "mode", "=", "\"rgb\"", ")", "try", ":", "arg_12", ".", "name", "=", "arg_8", "(", "arg_9", ",", "\"name\"", ")", "if", "arg_12", ".", "name", "==", "\"blue\"", ":", "arg_12", "=", "color", "(", "arg_2", ")", "except", ":", "pass", "except", ":", "arg_13", "=", "arg_8", "(", "arg_9", ",", "\"name\"", ")", "if", "arg_13", "==", "\"blue\"", ":", "arg_13", "=", "arg_2", "arg_12", "=", "color", "(", "arg_13", ")", "for", "arg_14", "in", "arg_9", ".", "getElementsByTagName", "(", "\"shade\"", ")", ":", "arg_0", ".", "ranges", ".", "append", "(", "(", "arg_12", ",", "shade", "(", "arg_8", "(", "arg_14", ",", "\"name\"", ")", ")", ",", "arg_10", "*", "float", "(", "arg_8", "(", "arg_14", ",", "\"weight\"", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1=5, arg_2=\"blue\", arg_3=None, arg_4=None):\n        \"\"\"\n        Loads a theme from aggregated web data.\n\n        The data must be old-style Prism XML: <color>s consisting of <shade>s.\n        Colors named \"blue\" will be overridden with the blue parameter.\n\n        archive can be a file like object (e.g. a ZipFile)\n        and will be used along with 'member' if specified.\n        \"\"\"\n        if arg_3 is None:\n            arg_5 = os.path.join(arg_0.cache, arg_0.name + \".xml\")\n            arg_6 = open(arg_5).read()\n        else:\n            assert arg_4 is not None\n            arg_6 = arg_3.read(arg_4)\n        arg_7 = parseString(arg_6).documentElement\n\n        arg_8 = lambda arg_9, a: arg_9.attributes[a].value\n\n        for arg_9 in arg_7.getElementsByTagName(\"color\")[:arg_1]:\n            arg_10 = float(arg_8(arg_9, \"weight\"))\n            try:\n                arg_11 = arg_9.getElementsByTagName(\"rgb\")[0]\n                arg_12 = color(\n                    float(arg_8(arg_11, \"r\")),\n                    float(arg_8(arg_11, \"g\")),\n                    float(arg_8(arg_11, \"b\")),\n                    float(arg_8(arg_11, \"a\")),\n                    mode=\"rgb\"\n                )\n                try:\n                    arg_12.name = arg_8(arg_9, \"name\")\n                    if arg_12.name == \"blue\": arg_12 = color(arg_2)\n                except:\n                    pass\n            except:\n                arg_13 = arg_8(arg_9, \"name\")\n                if arg_13 == \"blue\": arg_13 = arg_2\n                arg_12 = color(arg_13)\n\n            for arg_14 in arg_9.getElementsByTagName(\"shade\"):\n                arg_0.ranges.append((\n                    arg_12,\n                    shade(arg_8(arg_14, \"name\")),\n                    arg_10 * float(arg_8(arg_14, \"weight\"))\n                ))", "path": "lib/colors/__init__.py", "identifier": "ColorTheme._load", "docstring": "Loads a theme from aggregated web data.\n\n        The data must be old-style Prism XML: <color>s consisting of <shade>s.\n        Colors named \"blue\" will be overridden with the blue parameter.\n\n        archive can be a file like object (e.g. a ZipFile)\n        and will be used along with 'member' if specified.", "docstring_tokens": ["Loads", "a", "theme", "from", "aggregated", "web", "data", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259965}
{"url": "https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/environment.py#L107-L144", "sha": "cfd318c737f6c4580036c13d2acf32bca96654bf", "docstring_summary": "Get and parse prefixed django settings from env.", "language": "python", "parameters": "()", "return_statement": "return settings", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "{", "}", "arg_1", "=", "environ", ".", "get", "(", "\"DJANGO_SETTINGS_PREFIX\"", ",", "\"DJANGO_\"", ")", "for", "arg_2", ",", "arg_3", "in", "environ", ".", "items", "(", ")", ":", "arg_4", ",", "arg_4", ",", "arg_2", "=", "arg_2", ".", "partition", "(", "arg_1", ")", "if", "arg_2", ":", "if", "arg_2", "in", "UNSUPPORTED_ENV_SETTINGS", ":", "raise", "ValueError", "(", "'Django setting \"{}\" can not be '", "\"configured through environment.\"", ".", "format", "(", "arg_2", ")", ")", "arg_5", "=", "getattr", "(", "global_settings", ",", "arg_2", ",", "UNDEFINED", ")", "if", "arg_5", "is", "not", "UNDEFINED", ":", "if", "arg_5", "is", "None", "and", "arg_2", "in", "SETTINGS_TYPES", ".", "keys", "(", ")", ":", "arg_6", "=", "get_parser", "(", "SETTINGS_TYPES", "[", "arg_2", "]", ")", "else", ":", "arg_6", "=", "get_parser", "(", "type", "(", "arg_5", ")", ")", "arg_3", "=", "arg_6", "(", "arg_3", ")", "arg_0", "[", "arg_2", "]", "=", "arg_3", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n    Get and parse prefixed django settings from env.\n\n    TODO: Implement support for complex settings\n        DATABASES = {}\n        CACHES = {}\n        INSTALLED_APPS -> EXCLUDE_APPS ?\n\n    :return dict:\n    \"\"\"\n    arg_0 = {}\n    arg_1 = environ.get(\"DJANGO_SETTINGS_PREFIX\", \"DJANGO_\")\n\n    for arg_2, arg_3 in environ.items():\n        arg_4, arg_4, arg_2 = arg_2.partition(arg_1)\n        if arg_2:\n            if arg_2 in UNSUPPORTED_ENV_SETTINGS:\n                raise ValueError(\n                    'Django setting \"{}\" can not be '\n                    \"configured through environment.\".format(arg_2)\n                )\n\n            arg_5 = getattr(global_settings, arg_2, UNDEFINED)\n\n            if arg_5 is not UNDEFINED:\n                if arg_5 is None and arg_2 in SETTINGS_TYPES.keys():\n                    # Handle typed django settings defaulting to None\n                    arg_6 = get_parser(SETTINGS_TYPES[arg_2])\n                else:\n                    # Determine parser by django setting type\n                    arg_6 = get_parser(type(arg_5))\n\n                arg_3 = arg_6(arg_3)\n\n            arg_0[arg_2] = arg_3\n\n    return arg_0", "path": "bananas/environment.py", "identifier": "get_settings", "docstring": "Get and parse prefixed django settings from env.\n\n    TODO: Implement support for complex settings\n        DATABASES = {}\n        CACHES = {}\n        INSTALLED_APPS -> EXCLUDE_APPS ?\n\n    :return dict:", "docstring_tokens": ["Get", "and", "parse", "prefixed", "django", "settings", "from", "env", "."], "nwo": "5monkeys/django-bananas", "score": 0.38110653171539416, "idx": 259966}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/clustering.py#L9-L27", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Get the sizes of each cluster.", "language": "python", "parameters": "(self, train=False, valid=False, xval=False)", "return_statement": "return list(m.values())[0] if len(m) == 1 else m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "ModelBase", ".", "_get_metrics", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "{", "}", "for", "arg_6", ",", "arg_7", "in", "arg_4", ".", "items", "(", ")", ":", "arg_5", "[", "arg_6", "]", "=", "None", "if", "arg_7", "is", "None", "else", "[", "arg_7", "[", "2", "]", "for", "arg_7", "in", "arg_7", ".", "_metric_json", "[", "\"centroid_stats\"", "]", ".", "cell_values", "]", "return", "list", "(", "arg_5", ".", "values", "(", ")", ")", "[", "0", "]", "if", "len", "(", "arg_5", ")", "==", "1", "else", "arg_5"], "function": "def Func(arg_0, arg_1=False, arg_2=False, arg_3=False):\n        \"\"\"\n        Get the Funcs of each cluster.\n\n        If all are False (default), then return the training metric value.\n        If more than one options is set to True, then return a dictionary of metrics where\n        the keys are \"train\", \"valid\", and \"xval\".\n\n        :param bool train: If True, return the cluster Funcs for the training data.\n        :param bool valid: If True, return the cluster Funcs for the validation data.\n        :param bool xval: If True, return the cluster Funcs for each of the cross-validated splits.\n\n        :returns: The cluster Funcs for the specified key(s).\n        \"\"\"\n        arg_4 = ModelBase._get_metrics(arg_0, arg_1, arg_2, arg_3)\n        arg_5 = {}\n        for arg_6, arg_7 in arg_4.items():\n            arg_5[arg_6] = None if arg_7 is None else [arg_7[2] for arg_7 in arg_7._metric_json[\"centroid_stats\"].cell_values]\n        return list(arg_5.values())[0] if len(arg_5) == 1 else arg_5", "path": "h2o-py/h2o/model/clustering.py", "identifier": "H2OClusteringModel.size", "docstring": "Get the sizes of each cluster.\n\n        If all are False (default), then return the training metric value.\n        If more than one options is set to True, then return a dictionary of metrics where\n        the keys are \"train\", \"valid\", and \"xval\".\n\n        :param bool train: If True, return the cluster sizes for the training data.\n        :param bool valid: If True, return the cluster sizes for the validation data.\n        :param bool xval: If True, return the cluster sizes for each of the cross-validated splits.\n\n        :returns: The cluster sizes for the specified key(s).", "docstring_tokens": ["Get", "the", "sizes", "of", "each", "cluster", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 259967}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1025-L1051", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Prepare either TMaster or Streaming commands according to shard.\n    The Shell command is attached to all containers. The empty container plan and non-exist\n    container plan are bypassed.", "language": "python", "parameters": "(self)", "return_statement": "return commands", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ".", "packing_plan", ".", "container_plans", ")", "==", "0", ":", "return", "{", "}", "if", "arg_0", ".", "_get_instance_plans", "(", "arg_0", ".", "packing_plan", ",", "arg_0", ".", "shard", ")", "is", "None", "and", "arg_0", ".", "shard", "!=", "0", ":", "arg_1", "=", "{", "}", "arg_1", "[", "'heron-shell'", "]", "=", "Command", "(", "[", "'%s'", "%", "arg_0", ".", "heron_shell_binary", ",", "'--port=%s'", "%", "arg_0", ".", "shell_port", ",", "'--log_file_prefix=%s/heron-shell-%s.log'", "%", "(", "arg_0", ".", "log_dir", ",", "arg_0", ".", "shard", ")", ",", "'--secret=%s'", "%", "arg_0", ".", "topology_id", "]", ",", "arg_0", ".", "shell_env", ")", "return", "arg_1", "if", "arg_0", ".", "shard", "==", "0", ":", "arg_2", "=", "arg_0", ".", "_get_tmaster_processes", "(", ")", "else", ":", "arg_0", ".", "_untar_if_needed", "(", ")", "arg_2", "=", "arg_0", ".", "_get_streaming_processes", "(", ")", "arg_2", ".", "update", "(", "arg_0", ".", "_get_heron_support_processes", "(", ")", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Prepare either TMaster or Streaming commands according to shard.\n    The Shell command is attached to all containers. The empty container plan and non-exist\n    container plan are bypassed.\n    \"\"\"\n    # During shutdown the watch might get triggered with the empty packing plan\n    if len(arg_0.packing_plan.container_plans) == 0:\n      return {}\n    if arg_0._get_instance_plans(arg_0.packing_plan, arg_0.shard) is None and arg_0.shard != 0:\n      arg_1 = {}\n      arg_1['heron-shell'] = Command([\n          '%s' % arg_0.heron_shell_binary,\n          '--port=%s' % arg_0.shell_port,\n          '--log_file_prefix=%s/heron-shell-%s.log' % (arg_0.log_dir, arg_0.shard),\n          '--secret=%s' % arg_0.topology_id], arg_0.shell_env)\n      return arg_1\n\n    if arg_0.shard == 0:\n      arg_2 = arg_0._get_tmaster_processes()\n    else:\n      arg_0._untar_if_needed()\n      arg_2 = arg_0._get_streaming_processes()\n\n    # Attach daemon processes\n    arg_2.update(arg_0._get_heron_support_processes())\n    return arg_2", "path": "heron/executor/src/python/heron_executor.py", "identifier": "HeronExecutor.get_commands_to_run", "docstring": "Prepare either TMaster or Streaming commands according to shard.\n    The Shell command is attached to all containers. The empty container plan and non-exist\n    container plan are bypassed.", "docstring_tokens": ["Prepare", "either", "TMaster", "or", "Streaming", "commands", "according", "to", "shard", ".", "The", "Shell", "command", "is", "attached", "to", "all", "containers", ".", "The", "empty", "container", "plan", "and", "non", "-", "exist", "container", "plan", "are", "bypassed", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 259968}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L618-L634", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "The text that the user has entered entered at the current prompt.", "language": "python", "parameters": "(self, force=False)", "return_statement": "return input_buffer.replace('\\n' + self._continuation_prompt, '\\n')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", ".", "_executing", "and", "not", "arg_1", ":", "return", "arg_0", ".", "_input_buffer_executing", "arg_2", "=", "arg_0", ".", "_get_end_cursor", "(", ")", "arg_2", ".", "setPosition", "(", "arg_0", ".", "_prompt_pos", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "arg_3", "=", "arg_2", ".", "selection", "(", ")", ".", "toPlainText", "(", ")", "return", "arg_3", ".", "replace", "(", "'\\n'", "+", "arg_0", ".", "_continuation_prompt", ",", "'\\n'", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\" The text that the user has entered entered at the current prompt.\n\n        If the console is currently executing, the text that is executing will\n        always be returned.\n        \"\"\"\n        # If we're executing, the input buffer may not even exist anymore due to\n        # the limit imposed by 'buffer_size'. Therefore, we store it.\n        if arg_0._executing and not arg_1:\n            return arg_0._input_buffer_executing\n\n        arg_2 = arg_0._get_end_cursor()\n        arg_2.setPosition(arg_0._prompt_pos, QtGui.QTextCursor.KeepAnchor)\n        arg_3 = arg_2.selection().toPlainText()\n\n        # Strip out continuation prompts.\n        return arg_3.replace('\\n' + arg_0._continuation_prompt, '\\n')", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._get_input_buffer", "docstring": "The text that the user has entered entered at the current prompt.\n\n        If the console is currently executing, the text that is executing will\n        always be returned.", "docstring_tokens": ["The", "text", "that", "the", "user", "has", "entered", "entered", "at", "the", "current", "prompt", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 259969}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py#L105-L117", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get details about a specific namespace.", "language": "python", "parameters": "(self, name)", "return_statement": "return _ServiceBusManagementXmlSerializer.xml_to_namespace(\n            response.body)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_get_path", "(", "'services/serviceBus/Namespaces'", ",", "arg_1", ")", ",", "None", ")", "return", "_ServiceBusManagementXmlSerializer", ".", "xml_to_namespace", "(", "arg_2", ".", "body", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Get details about a specific namespace.\n\n        name:\n            Name of the service bus namespace.\n        '''\n        arg_2 = arg_0._perform_get(\n            arg_0._get_path('services/serviceBus/Namespaces', arg_1),\n            None)\n\n        return _ServiceBusManagementXmlSerializer.xml_to_namespace(\n            arg_2.body)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py", "identifier": "ServiceBusManagementService.get_namespace", "docstring": "Get details about a specific namespace.\n\n        name:\n            Name of the service bus namespace.", "docstring_tokens": ["Get", "details", "about", "a", "specific", "namespace", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 259970}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/query.py#L208-L217", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "Query for if date_field is within number of \"days\" from now.", "language": "python", "parameters": "(days, date_field)", "return_statement": "return query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "None", "arg_0", "=", "get_integer", "(", "arg_0", ")", "if", "arg_0", ":", "arg_3", "=", "get_days_from_now", "(", "arg_0", ")", "arg_2", "=", "Q", "(", "**", "{", "\"%s__lte\"", "%", "arg_1", ":", "arg_3", ".", "isoformat", "(", ")", "}", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Query for if date_field is within number of \"days\" from now.\n    \"\"\"\n    arg_2 = None\n    arg_0 = get_integer(arg_0)\n    if arg_0:\n        arg_3 = get_days_from_now(arg_0)\n        arg_2 = Q(**{\"%s__lte\" % arg_1: arg_3.isoformat()})\n    return arg_2", "path": "toolware/utils/query.py", "identifier": "get_date_less_query", "docstring": "Query for if date_field is within number of \"days\" from now.", "docstring_tokens": ["Query", "for", "if", "date_field", "is", "within", "number", "of", "days", "from", "now", "."], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 259971}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/lcpfeatures.py#L551-L569", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This is a parallel worker for the drivers below.", "language": "python", "parameters": "(task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", "try", ":", "return", "get_periodicfeatures", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_4", ",", "**", "arg_5", ")", "except", "Exception", "as", "e", ":", "LOGEXCEPTION", "(", "'failed to get periodicfeatures for %s'", "%", "arg_1", ")"], "function": "def Func(arg_0):\n    '''\n    This is a parallel worker for the drivers below.\n\n    '''\n\n    arg_1, arg_2, arg_3, arg_4, arg_5 = arg_0\n\n    try:\n\n        return get_periodicfeatures(arg_1,\n                                    arg_2,\n                                    arg_3,\n                                    arg_4=arg_4,\n                                    **arg_5)\n\n    except Exception as e:\n\n        LOGEXCEPTION('failed to get periodicfeatures for %s' % arg_1)", "path": "astrobase/lcproc/lcpfeatures.py", "identifier": "_periodicfeatures_worker", "docstring": "This is a parallel worker for the drivers below.", "docstring_tokens": ["This", "is", "a", "parallel", "worker", "for", "the", "drivers", "below", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 259972}
{"url": "https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/loadmat.py#L207-L222", "sha": "6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1", "docstring_summary": "Read and return the matrix header.", "language": "python", "parameters": "(fd, endian)", "return_statement": "return header", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "read_elements", "(", "arg_0", ",", "arg_1", ",", "[", "'miUINT32'", "]", ")", "arg_4", "=", "{", "'mclass'", ":", "arg_2", "&", "0x0FF", ",", "'is_logical'", ":", "(", "arg_2", ">>", "9", "&", "1", ")", "==", "1", ",", "'is_global'", ":", "(", "arg_2", ">>", "10", "&", "1", ")", "==", "1", ",", "'is_complex'", ":", "(", "arg_2", ">>", "11", "&", "1", ")", "==", "1", ",", "'nzmax'", ":", "arg_3", "}", "arg_4", "[", "'dims'", "]", "=", "read_elements", "(", "arg_0", ",", "arg_1", ",", "[", "'miINT32'", "]", ")", "arg_4", "[", "'n_dims'", "]", "=", "len", "(", "arg_4", "[", "'dims'", "]", ")", "if", "arg_4", "[", "'n_dims'", "]", "!=", "2", ":", "raise", "ParseError", "(", "'Only matrices with dimension 2 are supported.'", ")", "arg_4", "[", "'name'", "]", "=", "read_elements", "(", "arg_0", ",", "arg_1", ",", "[", "'miINT8'", "]", ",", "is_name", "=", "True", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Read and return the matrix header.\"\"\"\n    arg_2, arg_3 = read_elements(arg_0, arg_1, ['miUINT32'])\n    arg_4 = {\n        'mclass': arg_2 & 0x0FF,\n        'is_logical': (arg_2 >> 9 & 1) == 1,\n        'is_global': (arg_2 >> 10 & 1) == 1,\n        'is_complex': (arg_2 >> 11 & 1) == 1,\n        'nzmax': arg_3\n    }\n    arg_4['dims'] = read_elements(arg_0, arg_1, ['miINT32'])\n    arg_4['n_dims'] = len(arg_4['dims'])\n    if arg_4['n_dims'] != 2:\n        raise ParseError('Only matrices with dimension 2 are supported.')\n    arg_4['name'] = read_elements(arg_0, arg_1, ['miINT8'], is_name=True)\n    return arg_4", "path": "mat4py/loadmat.py", "identifier": "read_header", "docstring": "Read and return the matrix header.", "docstring_tokens": ["Read", "and", "return", "the", "matrix", "header", "."], "nwo": "nephics/mat4py", "score": 0.3187018950262521, "idx": 259973}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L873-L913", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read a character literal from the input stream.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "return char", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "str", ":", "arg_2", "=", "arg_0", ".", "reader", ".", "advance", "(", ")", "assert", "arg_2", "==", "\"\\\\\"", "arg_3", ":", "List", "[", "str", "]", "=", "[", "]", "arg_4", "=", "arg_0", ".", "reader", "arg_5", "=", "arg_4", ".", "peek", "(", ")", "while", "True", ":", "if", "arg_5", "==", "\"\"", "or", "whitespace_chars", ".", "match", "(", "arg_5", ")", ":", "break", "if", "not", "alphanumeric_chars", ".", "match", "(", "arg_5", ")", ":", "break", "arg_3", ".", "append", "(", "arg_5", ")", "arg_5", "=", "arg_4", ".", "next_token", "(", ")", "arg_6", "=", "\"\"", ".", "join", "(", "arg_3", ")", "arg_7", "=", "_SPECIAL_CHARS", ".", "get", "(", "arg_6", ",", "None", ")", "if", "arg_7", "is", "not", "None", ":", "return", "arg_7", "arg_8", "=", "unicode_char", ".", "match", "(", "arg_6", ")", "if", "arg_8", "is", "not", "None", ":", "try", ":", "return", "chr", "(", "int", "(", "f\"0x{match.group(1)}\"", ",", "16", ")", ")", "except", "(", "ValueError", ",", "OverflowError", ")", ":", "raise", "SyntaxError", "(", "f\"Unsupported character \\\\u{char}\"", ")", "from", "None", "if", "len", "(", "arg_6", ")", ">", "1", ":", "raise", "SyntaxError", "(", "f\"Unsupported character \\\\{char}\"", ")", "return", "arg_6"], "function": "def Func(arg_0: arg_1) -> str:\n    \"\"\"Read a character literal from the input stream.\n\n    Character literals may appear as:\n      - \\\\a \\\\b \\\\c etc will yield 'a', 'b', and 'c' respectively\n\n      - \\\\newline, \\\\space, \\\\tab, \\\\formfeed, \\\\backspace, \\\\return yield\n        the named characters\n\n      - \\\\uXXXX yield the unicode digit corresponding to the code\n        point named by the hex digits XXXX\"\"\"\n    arg_2 = arg_0.reader.advance()\n    assert arg_2 == \"\\\\\"\n\n    arg_3: List[str] = []\n    arg_4 = arg_0.reader\n    arg_5 = arg_4.peek()\n    while True:\n        if arg_5 == \"\" or whitespace_chars.match(arg_5):\n            break\n        if not alphanumeric_chars.match(arg_5):\n            break\n        arg_3.append(arg_5)\n        arg_5 = arg_4.next_token()\n\n    arg_6 = \"\".join(arg_3)\n    arg_7 = _SPECIAL_CHARS.get(arg_6, None)\n    if arg_7 is not None:\n        return arg_7\n\n    arg_8 = unicode_char.match(arg_6)\n    if arg_8 is not None:\n        try:\n            return chr(int(f\"0x{match.group(1)}\", 16))\n        except (ValueError, OverflowError):\n            raise SyntaxError(f\"Unsupported character \\\\u{char}\") from None\n\n    if len(arg_6) > 1:\n        raise SyntaxError(f\"Unsupported character \\\\{char}\")\n\n    return arg_6", "path": "src/basilisp/lang/reader.py", "identifier": "_read_character", "docstring": "Read a character literal from the input stream.\n\n    Character literals may appear as:\n      - \\\\a \\\\b \\\\c etc will yield 'a', 'b', and 'c' respectively\n\n      - \\\\newline, \\\\space, \\\\tab, \\\\formfeed, \\\\backspace, \\\\return yield\n        the named characters\n\n      - \\\\uXXXX yield the unicode digit corresponding to the code\n        point named by the hex digits XXXX", "docstring_tokens": ["Read", "a", "character", "literal", "from", "the", "input", "stream", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 259974}
{"url": "https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L463-L482", "sha": "2aead638c8385d8ae0b1756b2de17e8fad45fffa", "docstring_summary": "Wraps data with the interrupt reader and the file chunk reader.", "language": "python", "parameters": "(self, data, callbacks, close_callbacks)", "return_statement": "return self._osutil.open_file_chunk_reader_from_fileobj(\n            fileobj=fileobj, chunk_size=len(data), full_file_size=len(data),\n            callbacks=callbacks, close_callbacks=close_callbacks)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_wrap_fileobj", "(", "six", ".", "BytesIO", "(", "arg_1", ")", ")", "return", "arg_0", ".", "_osutil", ".", "open_file_chunk_reader_from_fileobj", "(", "arg_4", "=", "arg_4", ",", "chunk_size", "=", "len", "(", "arg_1", ")", ",", "full_file_size", "=", "len", "(", "arg_1", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Wraps data with the interrupt reader and the file chunk reader.\n\n        :type data: bytes\n        :param data: The data to wrap.\n\n        :type callbacks: list\n        :param callbacks: The callbacks associated with the transfer future.\n\n        :type close_callbacks: list\n        :param close_callbacks: The callbacks to be called when closing the\n            wrapper for the data.\n\n        :return: Fully wrapped data.\n        \"\"\"\n        arg_4 = arg_0._wrap_fileobj(six.BytesIO(arg_1))\n        return arg_0._osutil.open_file_chunk_reader_from_fileobj(\n            arg_4=arg_4, chunk_size=len(arg_1), full_file_size=len(arg_1),\n            arg_2=arg_2, arg_3=arg_3)", "path": "s3transfer/upload.py", "identifier": "UploadNonSeekableInputManager._wrap_data", "docstring": "Wraps data with the interrupt reader and the file chunk reader.\n\n        :type data: bytes\n        :param data: The data to wrap.\n\n        :type callbacks: list\n        :param callbacks: The callbacks associated with the transfer future.\n\n        :type close_callbacks: list\n        :param close_callbacks: The callbacks to be called when closing the\n            wrapper for the data.\n\n        :return: Fully wrapped data.", "docstring_tokens": ["Wraps", "data", "with", "the", "interrupt", "reader", "and", "the", "file", "chunk", "reader", "."], "nwo": "boto/s3transfer", "score": 0.6545128153760352, "idx": 259975}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/executors/__init__.py#L64-L95", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates a new instance of the named executor.\n    In case the executor name is not know in airflow,\n    look for it in the plugins", "language": "python", "parameters": "(executor_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "Executors", ".", "LocalExecutor", ":", "return", "LocalExecutor", "(", ")", "elif", "arg_0", "==", "Executors", ".", "SequentialExecutor", ":", "return", "SequentialExecutor", "(", ")", "elif", "arg_0", "==", "Executors", ".", "CeleryExecutor", ":", "from", "airflow", ".", "executors", ".", "celery_executor", "import", "CeleryExecutor", "return", "CeleryExecutor", "(", ")", "elif", "arg_0", "==", "Executors", ".", "DaskExecutor", ":", "from", "airflow", ".", "executors", ".", "dask_executor", "import", "DaskExecutor", "return", "DaskExecutor", "(", ")", "elif", "arg_0", "==", "Executors", ".", "KubernetesExecutor", ":", "from", "airflow", ".", "contrib", ".", "executors", ".", "kubernetes_executor", "import", "KubernetesExecutor", "return", "KubernetesExecutor", "(", ")", "else", ":", "_integrate_plugins", "(", ")", "arg_1", "=", "arg_0", ".", "split", "(", "'.'", ")", "if", "len", "(", "arg_1", ")", "!=", "2", ":", "raise", "AirflowException", "(", "\"Executor {0} not supported: \"", "\"please specify in format plugin_module.executor\"", ".", "format", "(", "arg_0", ")", ")", "if", "arg_1", "[", "0", "]", "in", "globals", "(", ")", ":", "return", "globals", "(", ")", "[", "arg_1", "[", "0", "]", "]", ".", "__dict__", "[", "arg_1", "[", "1", "]", "]", "(", ")", "else", ":", "raise", "AirflowException", "(", "\"Executor {0} not supported.\"", ".", "format", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Creates a new instance of the named executor.\n    In case the executor name is not know in airflow,\n    look for it in the plugins\n    \"\"\"\n    if arg_0 == Executors.LocalExecutor:\n        return LocalExecutor()\n    elif arg_0 == Executors.SequentialExecutor:\n        return SequentialExecutor()\n    elif arg_0 == Executors.CeleryExecutor:\n        from airflow.executors.celery_executor import CeleryExecutor\n        return CeleryExecutor()\n    elif arg_0 == Executors.DaskExecutor:\n        from airflow.executors.dask_executor import DaskExecutor\n        return DaskExecutor()\n    elif arg_0 == Executors.KubernetesExecutor:\n        from airflow.contrib.executors.kubernetes_executor import KubernetesExecutor\n        return KubernetesExecutor()\n    else:\n        # Loading plugins\n        _integrate_plugins()\n        arg_1 = arg_0.split('.')\n        if len(arg_1) != 2:\n            raise AirflowException(\n                \"Executor {0} not supported: \"\n                \"please specify in format plugin_module.executor\".format(arg_0))\n\n        if arg_1[0] in globals():\n            return globals()[arg_1[0]].__dict__[arg_1[1]]()\n        else:\n            raise AirflowException(\"Executor {0} not supported.\".format(arg_0))", "path": "airflow/executors/__init__.py", "identifier": "_get_executor", "docstring": "Creates a new instance of the named executor.\n    In case the executor name is not know in airflow,\n    look for it in the plugins", "docstring_tokens": ["Creates", "a", "new", "instance", "of", "the", "named", "executor", ".", "In", "case", "the", "executor", "name", "is", "not", "know", "in", "airflow", "look", "for", "it", "in", "the", "plugins"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 259976}
{"url": "https://github.com/jaraco/svg.charts/blob/23053497b3f1af4e760f355050107ae3bc05909d/svg/charts/graph.py#L592-L606", "sha": "23053497b3f1af4e760f355050107ae3bc05909d", "docstring_summary": "Hard-code the styles into the SVG XML if style sheets are not used.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "css_inline", ":", "return", "arg_1", "=", "arg_0", ".", "parse_css", "(", ")", "for", "arg_2", "in", "arg_0", ".", "root", ".", "xpath", "(", "'//*[@class]'", ")", ":", "arg_3", "=", "'.'", "+", "arg_2", ".", "attrib", "[", "'class'", "]", "if", "arg_3", "not", "in", "arg_1", ":", "continue", "arg_4", "=", "arg_1", "[", "arg_3", "]", "if", "'style'", "in", "arg_2", ".", "attrib", ":", "arg_4", "+=", "arg_2", ".", "attrib", "[", "'style'", "]", "arg_2", ".", "attrib", "[", "'style'", "]", "=", "arg_4"], "function": "def Func(arg_0):\n\t\t\"Hard-code the styles into the SVG XML if style sheets are not used.\"\n\t\tif not arg_0.css_inline:\n\t\t\t# do nothing\n\t\t\treturn\n\n\t\targ_1 = arg_0.parse_css()\n\t\tfor arg_2 in arg_0.root.xpath('//*[@class]'):\n\t\t\targ_3 = '.' + arg_2.attrib['class']\n\t\t\tif arg_3 not in arg_1:\n\t\t\t\tcontinue\n\t\t\targ_4 = arg_1[arg_3]\n\t\t\tif 'style' in arg_2.attrib:\n\t\t\t\targ_4 += arg_2.attrib['style']\n\t\t\targ_2.attrib['style'] = arg_4", "path": "svg/charts/graph.py", "identifier": "Graph.render_inline_styles", "docstring": "Hard-code the styles into the SVG XML if style sheets are not used.", "docstring_tokens": ["Hard", "-", "code", "the", "styles", "into", "the", "SVG", "XML", "if", "style", "sheets", "are", "not", "used", "."], "nwo": "jaraco/svg.charts", "score": 0.28766460361146773, "idx": 259977}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/FloatingIP.py#L14-L24", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Class method that will return a FloatingIP object by its IP.", "language": "python", "parameters": "(cls, api_token, ip)", "return_statement": "return floating_ip", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", "token", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_3", ".", "load", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n            Class method that will return a FloatingIP object by its IP.\n\n            Args:\n                api_token: str - token\n                ip: str - floating ip address\n        \"\"\"\n        arg_3 = arg_0(token=arg_1, arg_2=arg_2)\n        arg_3.load()\n        return arg_3", "path": "digitalocean/FloatingIP.py", "identifier": "FloatingIP.get_object", "docstring": "Class method that will return a FloatingIP object by its IP.\n\n            Args:\n                api_token: str - token\n                ip: str - floating ip address", "docstring_tokens": ["Class", "method", "that", "will", "return", "a", "FloatingIP", "object", "by", "its", "IP", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 259978}
{"url": "https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config.py#L755-L835", "sha": "17a170e0a6711005d1c78e67cf493dc44674d44f", "docstring_summary": "Opens a new configuration scope.", "language": "python", "parameters": "(name_or_scope)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "True", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_2", "=", "arg_0", "elif", "arg_0", "and", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "arg_2", "=", "current_scope", "(", ")", "arg_2", ".", "extend", "(", "arg_0", ".", "split", "(", "'/'", ")", ")", "else", ":", "arg_1", "=", "arg_0", "in", "(", "None", ",", "''", ")", "arg_2", "=", "[", "]", "_ACTIVE_SCOPES", ".", "append", "(", "arg_2", ")", "arg_3", "=", "map", "(", "config_parser", ".", "MODULE_RE", ".", "match", ",", "arg_2", ")", "if", "not", "arg_1", "or", "not", "all", "(", "arg_3", ")", ":", "arg_4", "=", "'Invalid value for `name_or_scope`: {}.'", "raise", "ValueError", "(", "arg_4", ".", "format", "(", "arg_0", ")", ")", "yield", "arg_2", "finally", ":", "_ACTIVE_SCOPES", ".", "pop", "(", ")"], "function": "def Func(arg_0):\n  \"\"\"Opens a new configuration scope.\n\n  Provides a context manager that opens a new explicit configuration\n  scope. Explicit configuration scopes restrict parameter bindings to only\n  certain sections of code that run within the scope. Scopes can be nested to\n  arbitrary depth; any configurable functions called within a scope inherit\n  parameters defined by higher level scopes.\n\n  For example, suppose a function named `preprocess_images` is called in two\n  places in a codebase: Once when loading data for a training task, and once\n  when loading data for an evaluation task:\n\n      def load_training_data():\n        ...\n        with gin.Func('train'):\n          images = preprocess_images(images)\n        ...\n\n\n      def load_eval_data():\n        ...\n        with gin.Func('eval'):\n          images = preprocess_images(images)\n        ...\n\n  By using a `Func` to wrap each invocation of `preprocess_images` as\n  above, it is possible to use Gin to supply specific parameters to each. Here\n  is a possible configuration for the above example:\n\n      preprocess_images.crop_size = [64, 64]\n      preprocess_images.normalize_image = True\n\n      train/preprocess_images.crop_location = 'random'\n      train/preprocess_images.random_flip_lr = True\n\n      eval/preprocess_images.crop_location = 'center'\n\n  The `crop_size` and `normalize_image` parameters above will be shared by both\n  the `train` and `eval` invocations; only `train` will receive\n  `random_flip_lr`, and the two invocations receive different values for\n  `crop_location`.\n\n  Passing `None` or `''` to `Func` will temporarily clear all currently\n  active scopes (within the `with` block; they will be restored afterwards).\n\n  Args:\n    name_or_scope: A name for the config scope, or an existing scope (e.g.,\n      captured from `with gin.Func(...) as scope`), or `None` to clear\n      currently active scopes.\n\n  Raises:\n    ValueError: If `name_or_scope` is not a list, string, or None.\n\n  Yields:\n    The resulting config scope (a list of all active scope names, ordered from\n    outermost to innermost).\n  \"\"\"\n  try:\n    arg_1 = True\n    if isinstance(arg_0, list):\n      arg_2 = arg_0\n    elif arg_0 and isinstance(arg_0, six.string_types):\n      arg_2 = current_scope()  # Returns a copy.\n      arg_2.extend(arg_0.split('/'))\n    else:\n      arg_1 = arg_0 in (None, '')\n      arg_2 = []\n\n    # Append new_scope first. It will be popped in the finally block if an\n    # exception is raised below.\n    _ACTIVE_SCOPES.append(arg_2)\n\n    arg_3 = map(config_parser.MODULE_RE.match, arg_2)\n    if not arg_1 or not all(arg_3):\n      arg_4 = 'Invalid value for `name_or_scope`: {}.'\n      raise ValueError(arg_4.format(arg_0))\n\n    yield arg_2\n  finally:\n    _ACTIVE_SCOPES.pop()", "path": "gin/config.py", "identifier": "config_scope", "docstring": "Opens a new configuration scope.\n\n  Provides a context manager that opens a new explicit configuration\n  scope. Explicit configuration scopes restrict parameter bindings to only\n  certain sections of code that run within the scope. Scopes can be nested to\n  arbitrary depth; any configurable functions called within a scope inherit\n  parameters defined by higher level scopes.\n\n  For example, suppose a function named `preprocess_images` is called in two\n  places in a codebase: Once when loading data for a training task, and once\n  when loading data for an evaluation task:\n\n      def load_training_data():\n        ...\n        with gin.config_scope('train'):\n          images = preprocess_images(images)\n        ...\n\n\n      def load_eval_data():\n        ...\n        with gin.config_scope('eval'):\n          images = preprocess_images(images)\n        ...\n\n  By using a `config_scope` to wrap each invocation of `preprocess_images` as\n  above, it is possible to use Gin to supply specific parameters to each. Here\n  is a possible configuration for the above example:\n\n      preprocess_images.crop_size = [64, 64]\n      preprocess_images.normalize_image = True\n\n      train/preprocess_images.crop_location = 'random'\n      train/preprocess_images.random_flip_lr = True\n\n      eval/preprocess_images.crop_location = 'center'\n\n  The `crop_size` and `normalize_image` parameters above will be shared by both\n  the `train` and `eval` invocations; only `train` will receive\n  `random_flip_lr`, and the two invocations receive different values for\n  `crop_location`.\n\n  Passing `None` or `''` to `config_scope` will temporarily clear all currently\n  active scopes (within the `with` block; they will be restored afterwards).\n\n  Args:\n    name_or_scope: A name for the config scope, or an existing scope (e.g.,\n      captured from `with gin.config_scope(...) as scope`), or `None` to clear\n      currently active scopes.\n\n  Raises:\n    ValueError: If `name_or_scope` is not a list, string, or None.\n\n  Yields:\n    The resulting config scope (a list of all active scope names, ordered from\n    outermost to innermost).", "docstring_tokens": ["Opens", "a", "new", "configuration", "scope", "."], "nwo": "google/gin-config", "score": 0.9489474208088708, "idx": 259979}
{"url": "https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/mixins.py#L67-L84", "sha": "5485b2e029dff8ae267a4cb39c92d0a72cb5b144", "docstring_summary": "Returns a list of all mongoadmin implementations for the site", "language": "python", "parameters": "(self)", "return_statement": "return apps", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "settings", ".", "INSTALLED_APPS", ":", "arg_3", "=", "\"{0}.mongoadmin\"", ".", "format", "(", "arg_2", ")", "try", ":", "arg_4", "=", "import_module", "(", "arg_3", ")", "except", "ImportError", "as", "e", ":", "if", "str", "(", "e", ")", ".", "startswith", "(", "\"No module named\"", ")", ":", "continue", "raise", "e", "arg_5", "=", "AppStore", "(", "arg_4", ")", "arg_1", ".", "append", "(", "dict", "(", "arg_2", "=", "arg_2", ",", "obj", "=", "arg_5", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Returns a list of all mongoadmin implementations for the site \"\"\"\n        arg_1 = []\n        for arg_2 in settings.INSTALLED_APPS:\n            arg_3 = \"{0}.mongoadmin\".format(arg_2)\n            try:\n                arg_4 = import_module(arg_3)\n            except ImportError as e:\n                if str(e).startswith(\"No module named\"):\n                    continue\n                raise e\n\n            arg_5 = AppStore(arg_4)\n            arg_1.append(dict(\n                arg_2=arg_2,\n                obj=arg_5\n            ))\n        return arg_1", "path": "mongonaut/mixins.py", "identifier": "MongonautViewMixin.get_mongoadmins", "docstring": "Returns a list of all mongoadmin implementations for the site", "docstring_tokens": ["Returns", "a", "list", "of", "all", "mongoadmin", "implementations", "for", "the", "site"], "nwo": "jazzband/django-mongonaut", "score": 0.4402301547631558, "idx": 259980}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L114-L149", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Parse an XML document and clean any namespaces.", "language": "python", "parameters": "(self, path_to_xml=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_1", ":", "if", "not", "arg_0", ".", "path", ":", "arg_0", ".", "logger", ".", "error", "(", "\"No path defined!\"", ")", "return", "arg_1", "=", "arg_0", ".", "path", "arg_2", "=", "arg_0", ".", "_clean_xml", "(", "arg_1", ")", "if", "arg_2", ".", "tag", ".", "lower", "(", ")", "==", "'collection'", ":", "arg_3", "=", "ET", ".", "ElementTree", "(", "arg_2", ")", "arg_0", ".", "records", "=", "element_tree_collection_to_records", "(", "arg_3", ")", "elif", "arg_2", ".", "tag", ".", "lower", "(", ")", "==", "'record'", ":", "arg_5", "=", "ET", ".", "Element", "(", "'collection'", ")", "arg_5", ".", "append", "(", "arg_2", ")", "arg_3", "=", "ET", ".", "ElementTree", "(", "arg_5", ")", "arg_0", ".", "records", "=", "element_tree_collection_to_records", "(", "arg_3", ")", "else", ":", "arg_6", "=", "get_request_subfields", "(", "arg_2", ")", "arg_4", "=", "arg_2", ".", "find", "(", "'ListRecords'", ")", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_2", ".", "find", "(", "'GetRecord'", ")", "if", "arg_4", "is", "None", ":", "raise", "ValueError", "(", "\"Cannot find ListRecords or GetRecord!\"", ")", "arg_3", "=", "ET", ".", "ElementTree", "(", "arg_4", ")", "for", "arg_7", ",", "arg_8", "in", "element_tree_oai_records", "(", "arg_3", ",", "arg_6", ")", ":", "if", "arg_8", ":", "arg_0", ".", "deleted_records", ".", "append", "(", "arg_0", ".", "create_deleted_record", "(", "arg_7", ")", ")", "else", ":", "arg_0", ".", "records", ".", "append", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Parse an XML document and clean any namespaces.\"\"\"\n        if not arg_1:\n            if not arg_0.path:\n                arg_0.logger.error(\"No path defined!\")\n                return\n            arg_1 = arg_0.path\n        arg_2 = arg_0._clean_xml(arg_1)\n\n        # See first of this XML is clean or OAI request\n        if arg_2.tag.lower() == 'collection':\n            arg_3 = ET.ElementTree(arg_2)\n            arg_0.records = element_tree_collection_to_records(arg_3)\n        elif arg_2.tag.lower() == 'record':\n            arg_5 = ET.Element('collection')\n            arg_5.append(arg_2)\n            arg_3 = ET.ElementTree(arg_5)\n            arg_0.records = element_tree_collection_to_records(arg_3)\n        else:\n            # We have an OAI request\n            arg_6 = get_request_subfields(arg_2)\n            arg_4 = arg_2.find('ListRecords')\n            if arg_4 is None:\n                arg_4 = arg_2.find('GetRecord')\n            if arg_4 is None:\n                raise ValueError(\"Cannot find ListRecords or GetRecord!\")\n\n            arg_3 = ET.ElementTree(arg_4)\n            for arg_7, arg_8 in element_tree_oai_records(arg_3, arg_6):\n                if arg_8:\n                    # It was OAI deleted. Create special record\n                    arg_0.deleted_records.append(\n                        arg_0.create_deleted_record(arg_7)\n                    )\n                else:\n                    arg_0.records.append(arg_7)", "path": "harvestingkit/bibrecord.py", "identifier": "BibRecordPackage.parse", "docstring": "Parse an XML document and clean any namespaces.", "docstring_tokens": ["Parse", "an", "XML", "document", "and", "clean", "any", "namespaces", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 259981}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L266-L288", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Reorder a track or a group of tracks in a playlist.", "language": "python", "parameters": "(self, playlist, start, insert_before, length=1, *, snapshot_id=None)", "return_statement": "return data['snapshot_id']", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "1", ",", "*", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "await", "arg_0", ".", "http", ".", "reorder_playlists_tracks", "(", "arg_0", ".", "id", ",", "str", "(", "arg_1", ")", ",", "arg_2", ",", "arg_4", ",", "arg_3", ",", "arg_5", "=", "arg_5", ")", "return", "arg_6", "[", "'snapshot_id'", "]"], "function": "async def Func(arg_0, arg_1, arg_2, arg_3, arg_4=1, *, arg_5=None):\n        \"\"\"Reorder a track or a group of tracks in a playlist.\n\n        Parameters\n        ----------\n        playlist : Union[str, Playlist]\n            The playlist to modify\n        start : int\n            The position of the first track to be reordered.\n        insert_before : int\n            The position where the tracks should be inserted.\n        length : Optional[int]\n            The amount of tracks to be reordered. Defaults to 1 if not set.\n        snapshot_id : str\n            The playlist\u2019s snapshot ID against which you want to make the changes.\n\n        Returns\n        -------\n        snapshot_id : str\n            The snapshot id of the playlist.\n        \"\"\"\n        arg_6 = await arg_0.http.reorder_playlists_tracks(arg_0.id, str(arg_1), arg_2, arg_4, arg_3, arg_5=arg_5)\n        return arg_6['snapshot_id']", "path": "spotify/models/user.py", "identifier": "User.reorder_tracks", "docstring": "Reorder a track or a group of tracks in a playlist.\n\n        Parameters\n        ----------\n        playlist : Union[str, Playlist]\n            The playlist to modify\n        start : int\n            The position of the first track to be reordered.\n        insert_before : int\n            The position where the tracks should be inserted.\n        length : Optional[int]\n            The amount of tracks to be reordered. Defaults to 1 if not set.\n        snapshot_id : str\n            The playlist\u2019s snapshot ID against which you want to make the changes.\n\n        Returns\n        -------\n        snapshot_id : str\n            The snapshot id of the playlist.", "docstring_tokens": ["Reorder", "a", "track", "or", "a", "group", "of", "tracks", "in", "a", "playlist", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 259982}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/names.py#L357-L377", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Returns the length of the file using the 'wc' GNU command", "language": "python", "parameters": "(filepath)", "return_statement": "return l", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "subprocess", ".", "Popen", "(", "[", "'wc'", ",", "'-l'", ",", "arg_0", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_2", ",", "arg_3", "=", "arg_1", ".", "communicate", "(", ")", "if", "arg_1", ".", "returncode", "!=", "0", ":", "raise", "IOError", "(", "arg_3", ")", "arg_4", "=", "arg_2", ".", "strip", "(", ")", "arg_4", "=", "int", "(", "arg_4", ".", "split", "(", ")", "[", "0", "]", ")", "return", "arg_4"], "function": "def Func(arg_0):\n    \"\"\"Returns the length of the file using the 'wc' GNU command\n\n    Parameters\n    ----------\n    filepath: str\n\n    Returns\n    -------\n    float\n    \"\"\"\n    arg_1 = subprocess.Popen(['wc', '-l', arg_0], stdout=subprocess.PIPE,\n                         stderr=subprocess.PIPE)\n    arg_2, arg_3 = arg_1.communicate()\n\n    if arg_1.returncode != 0:\n        raise IOError(arg_3)\n\n    arg_4 = arg_2.strip()\n    arg_4 = int(arg_4.split()[0])\n    return arg_4", "path": "boyle/files/names.py", "identifier": "ux_file_len", "docstring": "Returns the length of the file using the 'wc' GNU command\n\n    Parameters\n    ----------\n    filepath: str\n\n    Returns\n    -------\n    float", "docstring_tokens": ["Returns", "the", "length", "of", "the", "file", "using", "the", "wc", "GNU", "command"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 259983}
{"url": "https://github.com/mfcovington/django-project-home-templatetags/blob/abc660906086088792c5e5e7be6ecd151c2ccddb/project_home_tags/templatetags/project_home.py#L86-L122", "sha": "abc660906086088792c5e5e7be6ecd151c2ccddb", "docstring_summary": "A template tag to return the project's home URL and label\n    formatted as a Bootstrap 3 breadcrumb.", "language": "python", "parameters": "(label)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "home_url", "(", ")", "if", "arg_1", ":", "return", "format_html", "(", "'<li><a href=\"{}\">{}</a></li>'", ",", "arg_1", ",", "arg_0", ")", "else", ":", "return", "format_html", "(", "'<li>{}</li>'", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"A template tag to return the project's home URL and label\n    formatted as a Bootstrap 3 breadcrumb.\n\n    PROJECT_HOME_NAMESPACE must be defined in settings, for example:\n        PROJECT_HOME_NAMESPACE = 'project_name:index_view'\n\n    Usage Example:\n        {% load project_home_tags %}\n\n        <ol class=\"breadcrumb\">\n          {% Func %}    {# <--- #}\n          <li><a href=\"{% url 'app:namespace' %}\">List of Objects</a></li>\n          <li class=\"active\">Object Detail</li>\n        </ol>\n\n    This gets converted into:\n        <ol class=\"breadcrumb\">\n          <li><a href=\"{% url 'project_name:index_view' %}\">Home</a></li>    {# <--- #}\n          <li><a href=\"{% url 'app:namespace' %}\">List of Objects</a></li>\n          <li class=\"active\">Object Detail</li>\n        </ol>\n\n    By default, the link's text is 'Home'. A project-wide label can be\n    defined with PROJECT_HOME_LABEL in settings. Both the default and\n    the project-wide label can be overridden by passing a string to\n    the template tag.\n\n    For example:\n        {% Func 'Custom Label' %}\n    \"\"\"\n    arg_1 = home_url()\n    if arg_1:\n        return format_html(\n            '<li><a href=\"{}\">{}</a></li>', arg_1, arg_0)\n    else:\n        return format_html('<li>{}</li>', arg_0)", "path": "project_home_tags/templatetags/project_home.py", "identifier": "project_home_breadcrumb_bs3", "docstring": "A template tag to return the project's home URL and label\n    formatted as a Bootstrap 3 breadcrumb.\n\n    PROJECT_HOME_NAMESPACE must be defined in settings, for example:\n        PROJECT_HOME_NAMESPACE = 'project_name:index_view'\n\n    Usage Example:\n        {% load project_home_tags %}\n\n        <ol class=\"breadcrumb\">\n          {% project_home_breadcrumb_bs3 %}    {# <--- #}\n          <li><a href=\"{% url 'app:namespace' %}\">List of Objects</a></li>\n          <li class=\"active\">Object Detail</li>\n        </ol>\n\n    This gets converted into:\n        <ol class=\"breadcrumb\">\n          <li><a href=\"{% url 'project_name:index_view' %}\">Home</a></li>    {# <--- #}\n          <li><a href=\"{% url 'app:namespace' %}\">List of Objects</a></li>\n          <li class=\"active\">Object Detail</li>\n        </ol>\n\n    By default, the link's text is 'Home'. A project-wide label can be\n    defined with PROJECT_HOME_LABEL in settings. Both the default and\n    the project-wide label can be overridden by passing a string to\n    the template tag.\n\n    For example:\n        {% project_home_breadcrumb_bs3 'Custom Label' %}", "docstring_tokens": ["A", "template", "tag", "to", "return", "the", "project", "s", "home", "URL", "and", "label", "formatted", "as", "a", "Bootstrap", "3", "breadcrumb", "."], "nwo": "mfcovington/django-project-home-templatetags", "score": 0.138843686048881, "idx": 259984}
{"url": "https://github.com/amorison/loam/blob/a566c943a75e068a4510099331a1ddfe5bbbdd94/loam/tools.py#L15-L32", "sha": "a566c943a75e068a4510099331a1ddfe5bbbdd94", "docstring_summary": "Define a switchable ConfOpt.", "language": "python", "parameters": "(default, shortname, help_msg)", "return_statement": "return ConfOpt(bool(default), True, shortname,\n                   dict(action=internal.Switch), True, help_msg, None)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "ConfOpt", "(", "bool", "(", "arg_0", ")", ",", "True", ",", "arg_1", ",", "dict", "(", "action", "=", "internal", ".", "Switch", ")", ",", "True", ",", "arg_2", ",", "None", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Define a switchable ConfOpt.\n\n    This creates a boolean option. If you use it in your CLI, it can be\n    switched on and off by prepending + or - to its name: +opt / -opt.\n\n    Args:\n        default (bool): the default value of the swith option.\n        shortname (str): short name of the option, no shortname will be used if\n            it is set to None.\n        help_msg (str): short description of the option.\n\n    Returns:\n        :class:`~loam.manager.ConfOpt`: a configuration option with the given\n        properties.\n    \"\"\"\n    return ConfOpt(bool(arg_0), True, arg_1,\n                   dict(action=internal.Switch), True, arg_2, None)", "path": "loam/tools.py", "identifier": "switch_opt", "docstring": "Define a switchable ConfOpt.\n\n    This creates a boolean option. If you use it in your CLI, it can be\n    switched on and off by prepending + or - to its name: +opt / -opt.\n\n    Args:\n        default (bool): the default value of the swith option.\n        shortname (str): short name of the option, no shortname will be used if\n            it is set to None.\n        help_msg (str): short description of the option.\n\n    Returns:\n        :class:`~loam.manager.ConfOpt`: a configuration option with the given\n        properties.", "docstring_tokens": ["Define", "a", "switchable", "ConfOpt", "."], "nwo": "amorison/loam", "score": 0.14991498758945482, "idx": 259985}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/text.py#L59-L90", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return ansi escape code corresponding to color and style", "language": "python", "parameters": "(color=None, style=None)", "return_statement": "return \"\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "[", "]", "if", "arg_1", ":", "arg_3", "=", "utils", ".", "_splitstrip", "(", "arg_1", ")", "for", "arg_4", "in", "arg_3", ":", "arg_2", ".", "append", "(", "ANSI_STYLES", "[", "arg_4", "]", ")", "if", "arg_0", ":", "if", "arg_0", ".", "isdigit", "(", ")", ":", "arg_2", ".", "extend", "(", "[", "\"38\"", ",", "\"5\"", "]", ")", "arg_2", ".", "append", "(", "arg_0", ")", "else", ":", "arg_2", ".", "append", "(", "ANSI_COLORS", "[", "arg_0", "]", ")", "if", "arg_2", ":", "return", "ANSI_PREFIX", "+", "\";\"", ".", "join", "(", "arg_2", ")", "+", "ANSI_END", "return", "\"\""], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"return ansi escape code corresponding to color and style\n\n    :type color: str or None\n    :param color:\n      the color name (see `ANSI_COLORS` for available values)\n      or the color number when 256 colors are available\n\n    :type style: str or None\n    :param style:\n      style string (see `ANSI_COLORS` for available values). To get\n      several style effects at the same time, use a coma as separator.\n\n    :raise KeyError: if an unexistent color or style identifier is given\n\n    :rtype: str\n    :return: the built escape code\n    \"\"\"\n    arg_2 = []\n    if arg_1:\n        arg_3 = utils._splitstrip(arg_1)\n        for arg_4 in arg_3:\n            arg_2.append(ANSI_STYLES[arg_4])\n    if arg_0:\n        if arg_0.isdigit():\n            arg_2.extend([\"38\", \"5\"])\n            arg_2.append(arg_0)\n        else:\n            arg_2.append(ANSI_COLORS[arg_0])\n    if arg_2:\n        return ANSI_PREFIX + \";\".join(arg_2) + ANSI_END\n    return \"\"", "path": "pylint/reporters/text.py", "identifier": "_get_ansi_code", "docstring": "return ansi escape code corresponding to color and style\n\n    :type color: str or None\n    :param color:\n      the color name (see `ANSI_COLORS` for available values)\n      or the color number when 256 colors are available\n\n    :type style: str or None\n    :param style:\n      style string (see `ANSI_COLORS` for available values). To get\n      several style effects at the same time, use a coma as separator.\n\n    :raise KeyError: if an unexistent color or style identifier is given\n\n    :rtype: str\n    :return: the built escape code", "docstring_tokens": ["return", "ansi", "escape", "code", "corresponding", "to", "color", "and", "style"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 259986}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/resources.py#L164-L182", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Lists a set of projects related to a dataset.", "language": "python", "parameters": "(self, dataset_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "url", "(", ")", "+", "\"/nd/resource/dataset/{}\"", ".", "format", "(", "arg_1", ")", "+", "\"/project/\"", "arg_3", "=", "arg_0", ".", "remote_utils", ".", "get_url", "(", "arg_2", ")", "if", "arg_3", ".", "status_code", "is", "not", "200", ":", "raise", "RemoteDataNotFoundError", "(", "'Could not find {}'", ".", "format", "(", "arg_3", ".", "text", ")", ")", "else", ":", "return", "arg_3", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Lists a set of projects related to a dataset.\n\n        Arguments:\n            dataset_name (str): Dataset name to search projects for\n\n        Returns:\n            dict: Projects found based on dataset query\n        \"\"\"\n        arg_2 = arg_0.url() + \"/nd/resource/dataset/{}\".format(arg_1)\\\n            + \"/project/\"\n\n        arg_3 = arg_0.remote_utils.get_url(arg_2)\n\n        if arg_3.status_code is not 200:\n            raise RemoteDataNotFoundError('Could not find {}'.format(arg_3.text))\n        else:\n            return arg_3.json()", "path": "ndio/remote/resources.py", "identifier": "resources.list_projects", "docstring": "Lists a set of projects related to a dataset.\n\n        Arguments:\n            dataset_name (str): Dataset name to search projects for\n\n        Returns:\n            dict: Projects found based on dataset query", "docstring_tokens": ["Lists", "a", "set", "of", "projects", "related", "to", "a", "dataset", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 259987}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/movies.py#L103-L118", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the external ids for a specific movie id.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the external ids for a specific movie id.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/movies.py", "identifier": "Movies.external_ids", "docstring": "Get the external ids for a specific movie id.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "external", "ids", "for", "a", "specific", "movie", "id", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 259988}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/lms.py#L142-L159", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Query the Enrollment API for the course details of the given course_id.", "language": "python", "parameters": "(self, course_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "arg_0", ".", "client", ".", "course", "(", "arg_1", ")", ".", "get", "(", ")", "except", "(", "SlumberBaseException", ",", "ConnectionError", ",", "Timeout", ")", "as", "exc", ":", "LOGGER", ".", "exception", "(", "'Failed to retrieve course enrollment details for course [%s] due to: [%s]'", ",", "arg_1", ",", "str", "(", "exc", ")", ")", "return", "{", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Query the Enrollment API for the course details of the given course_id.\n\n        Args:\n            course_id (str): The string value of the course's unique identifier\n\n        Returns:\n            dict: A dictionary containing details about the course, in an enrollment context (allowed modes, etc.)\n        \"\"\"\n        try:\n            return arg_0.client.course(arg_1).get()\n        except (SlumberBaseException, ConnectionError, Timeout) as exc:\n            LOGGER.exception(\n                'Failed to retrieve course enrollment details for course [%s] due to: [%s]',\n                arg_1, str(exc)\n            )\n            return {}", "path": "enterprise/api_client/lms.py", "identifier": "EnrollmentApiClient.get_course_details", "docstring": "Query the Enrollment API for the course details of the given course_id.\n\n        Args:\n            course_id (str): The string value of the course's unique identifier\n\n        Returns:\n            dict: A dictionary containing details about the course, in an enrollment context (allowed modes, etc.)", "docstring_tokens": ["Query", "the", "Enrollment", "API", "for", "the", "course", "details", "of", "the", "given", "course_id", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 259989}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/plotters/array_plotters.py#L552-L578", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Plot a set of points over the array of data on the figure.", "language": "python", "parameters": "(points_arcsec, array, units, kpc_per_arcsec, pointsize, zoom_offset_arcsec)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "if", "arg_0", "is", "not", "None", ":", "arg_0", "=", "list", "(", "map", "(", "lambda", "position_set", ":", "np", ".", "asarray", "(", "position_set", ")", ",", "arg_0", ")", ")", "arg_6", "=", "itertools", ".", "cycle", "(", "[", "\"m\"", ",", "\"y\"", ",", "\"r\"", ",", "\"w\"", ",", "\"c\"", ",", "\"b\"", ",", "\"g\"", ",", "\"k\"", "]", ")", "for", "arg_7", "in", "arg_0", ":", "if", "arg_5", "is", "not", "None", ":", "arg_7", "-=", "arg_5", "arg_8", "=", "convert_grid_units", "(", "arg_1", "=", "arg_1", ",", "grid_arcsec", "=", "arg_7", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "plt", ".", "scatter", "(", "y", "=", "arg_8", "[", ":", ",", "0", "]", ",", "x", "=", "arg_8", "[", ":", ",", "1", "]", ",", "color", "=", "next", "(", "arg_6", ")", ",", "s", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Plot a set of points over the array of data on the figure.\n\n    Parameters\n    -----------\n    positions : [[]]\n        Lists of (y,x) coordinates on the image which are plotted as colored dots, to highlight specific pixels.\n    array : data.array.scaled_array.ScaledArray\n        The 2D array of data which is plotted.\n    units : str\n        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').\n    kpc_per_arcsec : float or None\n        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.\n    pointsize : int\n        The size of the points plotted to show the input positions.\n    \"\"\"\n    if arg_0 is not None:\n        arg_0 = list(map(lambda position_set: np.asarray(position_set), arg_0))\n        arg_6 = itertools.cycle([\"m\", \"y\", \"r\", \"w\", \"c\", \"b\", \"g\", \"k\"])\n        for arg_7 in arg_0:\n\n            if arg_5 is not None:\n                arg_7 -= arg_5\n\n            arg_8 = convert_grid_units(arg_1=arg_1, grid_arcsec=arg_7, arg_2=arg_2,\n                                                 arg_3=arg_3)\n            plt.scatter(y=arg_8[:,0], x=arg_8[:,1], color=next(arg_6), s=arg_4)", "path": "autolens/plotters/array_plotters.py", "identifier": "plot_points", "docstring": "Plot a set of points over the array of data on the figure.\n\n    Parameters\n    -----------\n    positions : [[]]\n        Lists of (y,x) coordinates on the image which are plotted as colored dots, to highlight specific pixels.\n    array : data.array.scaled_array.ScaledArray\n        The 2D array of data which is plotted.\n    units : str\n        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').\n    kpc_per_arcsec : float or None\n        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.\n    pointsize : int\n        The size of the points plotted to show the input positions.", "docstring_tokens": ["Plot", "a", "set", "of", "points", "over", "the", "array", "of", "data", "on", "the", "figure", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 259990}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/cluster.py#L127-L140", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns all the cliques in the graph of at least the given size.", "language": "python", "parameters": "(graph, threshold=3)", "return_statement": "return cliques", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3", ")", ":", "Func", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "nodes", ":", "arg_4", "=", "clique", "(", "arg_0", ",", "arg_3", ".", "id", ")", "if", "len", "(", "arg_4", ")", ">=", "arg_1", ":", "arg_4", ".", "sort", "(", ")", "if", "arg_4", "not", "in", "Func", ":", "Func", ".", "append", "(", "arg_4", ")", "return", "Func"], "function": "def Func(arg_0, arg_1=3):\n    \n    \"\"\" Returns all the cliques in the graph of at least the given size.\n    \"\"\"\n    \n    Func = []\n    for arg_3 in arg_0.nodes:\n        arg_4 = clique(arg_0, arg_3.id)\n        if len(arg_4) >= arg_1: \n            arg_4.sort()\n            if arg_4 not in Func:\n                Func.append(arg_4)\n    \n    return Func", "path": "lib/graph/cluster.py", "identifier": "cliques", "docstring": "Returns all the cliques in the graph of at least the given size.", "docstring_tokens": ["Returns", "all", "the", "cliques", "in", "the", "graph", "of", "at", "least", "the", "given", "size", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 259991}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L270-L283", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform Kraus representation to Stinespring representation.", "language": "python", "parameters": "(data, input_dim, output_dim)", "return_statement": "return tuple(stine_pair)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "None", ",", "None", "]", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_0", ")", ":", "if", "arg_5", "is", "not", "None", ":", "arg_6", "=", "len", "(", "arg_5", ")", "arg_7", "=", "np", ".", "zeros", "(", "(", "arg_2", "*", "arg_6", ",", "arg_1", ")", ",", "dtype", "=", "complex", ")", "for", "arg_8", ",", "arg_9", "in", "enumerate", "(", "arg_5", ")", ":", "arg_10", "=", "np", ".", "zeros", "(", "arg_6", ")", "arg_10", "[", "arg_8", "]", "=", "1", "arg_7", "+=", "np", ".", "kron", "(", "arg_9", ",", "arg_10", "[", ":", ",", "None", "]", ")", "arg_3", "[", "arg_4", "]", "=", "arg_7", "return", "tuple", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Transform Kraus representation to Stinespring representation.\"\"\"\n    arg_3 = [None, None]\n    for arg_4, arg_5 in enumerate(arg_0):\n        if arg_5 is not None:\n            arg_6 = len(arg_5)\n            arg_7 = np.zeros((arg_2 * arg_6, arg_1),\n                             dtype=complex)\n            for arg_8, arg_9 in enumerate(arg_5):\n                arg_10 = np.zeros(arg_6)\n                arg_10[arg_8] = 1\n                arg_7 += np.kron(arg_9, arg_10[:, None])\n            arg_3[arg_4] = arg_7\n    return tuple(arg_3)", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_kraus_to_stinespring", "docstring": "Transform Kraus representation to Stinespring representation.", "docstring_tokens": ["Transform", "Kraus", "representation", "to", "Stinespring", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 259992}
{"url": "https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1708-L1717", "sha": "b0fc49e157189932c70231077ed35e1aa5717da9", "docstring_summary": "Return the shape that would result from broadcasting the inputs", "language": "python", "parameters": "(*args)", "return_statement": "return tuple(max(sh[ax] for sh in shapes) for ax in range(ndim))", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "[", "a", ".", "shape", "if", "hasattr", "(", "type", "(", "a", ")", ",", "'__array_interface__'", ")", "else", "(", ")", "for", "a", "in", "arg_0", "]", "arg_2", "=", "max", "(", "len", "(", "arg_4", ")", "for", "arg_4", "in", "arg_1", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ")", ":", "if", "len", "(", "arg_4", ")", "<", "arg_2", ":", "arg_1", "[", "arg_3", "]", "=", "(", "1", ",", ")", "*", "(", "arg_2", "-", "len", "(", "arg_4", ")", ")", "+", "arg_4", "return", "tuple", "(", "max", "(", "arg_4", "[", "arg_5", "]", "for", "arg_4", "in", "arg_1", ")", "for", "arg_5", "in", "range", "(", "arg_2", ")", ")"], "function": "def Func(*arg_0):\n    \"\"\"Return the shape that would result from broadcasting the inputs\"\"\"\n    #TODO: currently incorrect result if a Sequence is provided as an input\n    arg_1 = [a.shape if hasattr(type(a), '__array_interface__')\n              else () for a in arg_0]\n    arg_2 = max(len(arg_4) for arg_4 in arg_1) # new common ndim after broadcasting\n    for arg_3, arg_4 in enumerate(arg_1):\n        if len(arg_4) < arg_2:\n            arg_1[arg_3] = (1,)*(arg_2 - len(arg_4)) + arg_4\n    return tuple(max(arg_4[arg_5] for arg_4 in arg_1) for arg_5 in range(arg_2))", "path": "distob/arrays.py", "identifier": "_broadcast_shape", "docstring": "Return the shape that would result from broadcasting the inputs", "docstring_tokens": ["Return", "the", "shape", "that", "would", "result", "from", "broadcasting", "the", "inputs"], "nwo": "mattja/distob", "score": 0.12050106452410352, "idx": 259993}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/linear_gaussian_ssm.py#L72-L155", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Augment a sample shape to broadcast batch dimensions.", "language": "python", "parameters": "(partial_batch_dist,\n                          full_sample_and_batch_shape,\n                          validate_args=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "distribution_util", ".", "prefer_static_shape", "(", "arg_1", ")", "[", "0", "]", "arg_4", "=", "(", "tensorshape_util", ".", "rank", "(", "arg_0", ".", "batch_shape", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_0", ".", "batch_shape", ")", "is", "not", "None", "else", "distribution_util", ".", "prefer_static_shape", "(", "arg_0", ".", "batch_shape_tensor", "(", ")", ")", "[", "0", "]", ")", "arg_5", "=", "arg_3", "-", "arg_4", "arg_6", "=", "(", "arg_1", "[", "arg_5", ":", "]", ")", "arg_7", "=", "tf", ".", "get_static_value", "(", "arg_1", "[", "arg_5", ":", "]", ")", "arg_8", "=", "tf", ".", "get_static_value", "(", "arg_5", ")", "if", "arg_8", "is", "not", "None", ":", "if", "arg_8", "<", "0", ":", "raise", "ValueError", "(", "\"Cannot broadcast distribution {} batch shape to \"", "\"target batch shape with fewer dimensions\"", ".", "format", "(", "arg_0", ")", ")", "if", "(", "arg_7", "is", "not", "None", "and", "tensorshape_util", ".", "is_fully_defined", "(", "arg_0", ".", "batch_shape", ")", ")", ":", "if", "(", "arg_0", ".", "batch_shape", "and", "any", "(", "arg_7", "!=", "tensorshape_util", ".", "as_list", "(", "arg_0", ".", "batch_shape", ")", ")", ")", ":", "raise", "NotImplementedError", "(", "\"Broadcasting is not supported; \"", "\"unexpected batch shape \"", "\"(expected {}, saw {}).\"", ".", "format", "(", "arg_7", ",", "arg_0", ".", "batch_shape", ")", ")", "arg_9", "=", "[", "]", "if", "arg_2", ":", "arg_9", ".", "append", "(", "assert_util", ".", "assert_greater_equal", "(", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_5", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "tf", ".", "zeros", "(", "(", ")", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "message", "=", "(", "\"Cannot broadcast distribution {} batch shape to \"", "\"target batch shape with fewer dimensions.\"", ".", "format", "(", "arg_0", ")", ")", ")", ")", "arg_9", ".", "append", "(", "assert_util", ".", "assert_equal", "(", "arg_6", ",", "arg_0", ".", "batch_shape_tensor", "(", ")", ",", "message", "=", "(", "\"Broadcasting is not supported; \"", "\"unexpected batch shape.\"", ")", ",", "name", "=", "\"assert_batch_shape_same\"", ")", ")", "with", "tf", ".", "control_dependencies", "(", "arg_9", ")", ":", "return", "arg_1", "[", ":", "arg_5", "]"], "function": "def Func(arg_0,\n                          arg_1,\n                          arg_2=False):\n  \"\"\"Augment a sample shape to broadcast batch dimensions.\n\n  Computes an augmented sample shape, so that any batch dimensions not\n  part of the distribution `partial_batch_dist` are treated as identical\n  distributions.\n\n  # partial_batch_dist.batch_shape  = [      7]\n  # full_sample_and_batch_shape     = [3, 4, 7]\n  # => return an augmented sample shape of [3, 4] so that\n  #    partial_batch_dist.sample(augmented_sample_shape) has combined\n  #    sample and batch shape of [3, 4, 7].\n\n  Args:\n    partial_batch_dist: `tfd.Distribution` instance with batch shape a\n      prefix of `full_sample_and_batch_shape`.\n    full_sample_and_batch_shape: a Tensor or Tensor-like shape.\n    validate_args: if True, check for shape errors at runtime.\n  Returns:\n    augmented_sample_shape: sample shape such that\n      `partial_batch_dist.sample(augmented_sample_shape)` has combined\n      sample and batch shape of `full_sample_and_batch_shape`.\n\n  Raises:\n    ValueError: if `partial_batch_dist.batch_shape` has more dimensions than\n      `full_sample_and_batch_shape`.\n    NotImplementedError: if broadcasting would be required to make\n      `partial_batch_dist.batch_shape` into a prefix of\n      `full_sample_and_batch_shape` .\n  \"\"\"\n  arg_3 = distribution_util.prefer_static_shape(\n      arg_1)[0]\n  arg_4 = (\n      tensorshape_util.rank(arg_0.batch_shape)  # pylint: disable=g-long-ternary\n      if tensorshape_util.rank(arg_0.batch_shape) is not None\n      else distribution_util.prefer_static_shape(\n          arg_0.batch_shape_tensor())[0])\n\n  arg_5 = arg_3 - arg_4\n\n  arg_6 = (\n      arg_1[arg_5:])\n  arg_7 = tf.get_static_value(\n      arg_1[arg_5:])\n\n  # Raise errors statically if possible.\n  arg_8 = tf.get_static_value(arg_5)\n  if arg_8 is not None:\n    if arg_8 < 0:\n      raise ValueError(\"Cannot broadcast distribution {} batch shape to \"\n                       \"target batch shape with fewer dimensions\"\n                       .format(arg_0))\n  if (arg_7 is not None and\n      tensorshape_util.is_fully_defined(arg_0.batch_shape)):\n    if (arg_0.batch_shape and\n        any(arg_7 != tensorshape_util.as_list(\n            arg_0.batch_shape))):\n      raise NotImplementedError(\"Broadcasting is not supported; \"\n                                \"unexpected batch shape \"\n                                \"(expected {}, saw {}).\".format(\n                                    arg_7,\n                                    arg_0.batch_shape\n                                ))\n  arg_9 = []\n  if arg_2:\n    arg_9.append(\n        assert_util.assert_greater_equal(\n            tf.convert_to_tensor(value=arg_5, dtype=tf.int32),\n            tf.zeros((), dtype=tf.int32),\n            message=(\"Cannot broadcast distribution {} batch shape to \"\n                     \"target batch shape with fewer dimensions.\".format(\n                         arg_0))))\n    arg_9.append(\n        assert_util.assert_equal(\n            arg_6,\n            arg_0.batch_shape_tensor(),\n            message=(\"Broadcasting is not supported; \"\n                     \"unexpected batch shape.\"),\n            name=\"assert_batch_shape_same\"))\n\n  with tf.control_dependencies(arg_9):\n    return arg_1[:arg_5]", "path": "tensorflow_probability/python/distributions/linear_gaussian_ssm.py", "identifier": "_augment_sample_shape", "docstring": "Augment a sample shape to broadcast batch dimensions.\n\n  Computes an augmented sample shape, so that any batch dimensions not\n  part of the distribution `partial_batch_dist` are treated as identical\n  distributions.\n\n  # partial_batch_dist.batch_shape  = [      7]\n  # full_sample_and_batch_shape     = [3, 4, 7]\n  # => return an augmented sample shape of [3, 4] so that\n  #    partial_batch_dist.sample(augmented_sample_shape) has combined\n  #    sample and batch shape of [3, 4, 7].\n\n  Args:\n    partial_batch_dist: `tfd.Distribution` instance with batch shape a\n      prefix of `full_sample_and_batch_shape`.\n    full_sample_and_batch_shape: a Tensor or Tensor-like shape.\n    validate_args: if True, check for shape errors at runtime.\n  Returns:\n    augmented_sample_shape: sample shape such that\n      `partial_batch_dist.sample(augmented_sample_shape)` has combined\n      sample and batch shape of `full_sample_and_batch_shape`.\n\n  Raises:\n    ValueError: if `partial_batch_dist.batch_shape` has more dimensions than\n      `full_sample_and_batch_shape`.\n    NotImplementedError: if broadcasting would be required to make\n      `partial_batch_dist.batch_shape` into a prefix of\n      `full_sample_and_batch_shape` .", "docstring_tokens": ["Augment", "a", "sample", "shape", "to", "broadcast", "batch", "dimensions", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 259994}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/compiler.py#L62-L70", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Builds the SQL INSERT statement.", "language": "python", "parameters": "(self, return_id=False)", "return_statement": "return queries", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "[", "arg_0", ".", "_rewrite_insert", "(", "sql", ",", "params", ",", "arg_1", ")", "for", "sql", ",", "params", "in", "super", "(", ")", ".", "Func", "(", ")", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Builds the SQL INSERT statement.\"\"\"\n\n        arg_2 = [\n            arg_0._rewrite_insert(sql, params, arg_1)\n            for sql, params in super().Func()\n        ]\n\n        return arg_2", "path": "psqlextra/compiler.py", "identifier": "PostgresInsertCompiler.as_sql", "docstring": "Builds the SQL INSERT statement.", "docstring_tokens": ["Builds", "the", "SQL", "INSERT", "statement", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 259995}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/rrule.py#L742-L754", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Return new rrule with same attributes except for those attributes given new\n           values by whichever keyword arguments are specified.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return rrule(**new_kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "\"interval\"", ":", "arg_0", ".", "_interval", ",", "\"count\"", ":", "arg_0", ".", "_count", ",", "\"dtstart\"", ":", "arg_0", ".", "_dtstart", ",", "\"freq\"", ":", "arg_0", ".", "_freq", ",", "\"until\"", ":", "arg_0", ".", "_until", ",", "\"wkst\"", ":", "arg_0", ".", "_wkst", ",", "\"cache\"", ":", "False", "if", "arg_0", ".", "_cache", "is", "None", "else", "True", "}", "arg_2", ".", "update", "(", "arg_0", ".", "_original_rule", ")", "arg_2", ".", "update", "(", "arg_1", ")", "return", "rrule", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Return new rrule with same attributes except for those attributes given new\n           values by whichever keyword arguments are specified.\"\"\"\n        arg_2 = {\"interval\": arg_0._interval,\n                      \"count\": arg_0._count,\n                      \"dtstart\": arg_0._dtstart,\n                      \"freq\": arg_0._freq,\n                      \"until\": arg_0._until,\n                      \"wkst\": arg_0._wkst,\n                      \"cache\": False if arg_0._cache is None else True}\n        arg_2.update(arg_0._original_rule)\n        arg_2.update(arg_1)\n        return rrule(**arg_2)", "path": "superjson/pkg/dateutil/rrule.py", "identifier": "rrule.replace", "docstring": "Return new rrule with same attributes except for those attributes given new\n           values by whichever keyword arguments are specified.", "docstring_tokens": ["Return", "new", "rrule", "with", "same", "attributes", "except", "for", "those", "attributes", "given", "new", "values", "by", "whichever", "keyword", "arguments", "are", "specified", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 259996}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/independence/graph/model.py#L102-L142", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Predict the skeleton of the graph from raw data.", "language": "python", "parameters": "(self, df_data, threshold=0.05, **kwargs)", "return_statement": "return graph", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.05", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "get", "(", "\"nb_jobs\"", ",", "SETTINGS", ".", "NB_JOBS", ")", "arg_5", "=", "list", "(", "arg_1", ".", "columns", ".", "values", ")", "if", "arg_4", "!=", "1", ":", "arg_6", "=", "Parallel", "(", "n_jobs", "=", "arg_4", ")", "(", "delayed", "(", "arg_0", ".", "run_feature_selection", ")", "(", "arg_1", ",", "arg_13", ",", "arg_7", ",", "**", "arg_3", ")", "for", "arg_7", ",", "arg_13", "in", "enumerate", "(", "arg_5", ")", ")", "else", ":", "arg_6", "=", "[", "arg_0", ".", "run_feature_selection", "(", "arg_1", ",", "arg_13", ",", "arg_7", ",", "**", "arg_3", ")", "for", "arg_7", ",", "arg_13", "in", "enumerate", "(", "arg_5", ")", "]", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_6", ")", ":", "try", ":", "arg_8", ".", "insert", "(", "arg_7", ",", "0", ")", "except", "AttributeError", ":", "arg_6", "[", "arg_7", "]", "=", "np", ".", "insert", "(", "arg_8", ",", "arg_7", ",", "0", ")", "arg_9", "=", "np", ".", "array", "(", "arg_6", ")", "arg_9", "*=", "arg_9", ".", "transpose", "(", ")", "np", ".", "fill_diagonal", "(", "arg_9", ",", "0", ")", "arg_9", "/=", "2", "arg_10", "=", "nx", ".", "Graph", "(", ")", "for", "(", "arg_8", ",", "arg_11", ")", ",", "arg_12", "in", "np", ".", "ndenumerate", "(", "arg_9", ")", ":", "if", "arg_9", "[", "arg_8", ",", "arg_11", "]", ">", "arg_2", ":", "arg_10", ".", "add_edge", "(", "arg_5", "[", "arg_8", "]", ",", "arg_5", "[", "arg_11", "]", ",", "weight", "=", "arg_9", "[", "arg_8", ",", "arg_11", "]", ")", "for", "arg_13", "in", "arg_5", ":", "if", "arg_13", "not", "in", "arg_10", ".", "nodes", "(", ")", ":", "arg_10", ".", "add_node", "(", "arg_13", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=0.05, **arg_3):\n        \"\"\"Predict the skeleton of the graph from raw data.\n\n        Returns iteratively the feature selection algorithm on each node.\n\n        Args:\n            df_data (pandas.DataFrame): data to construct a graph from\n            threshold (float): cutoff value for feature selection scores\n            kwargs (dict): additional arguments for algorithms\n\n        Returns:\n            networkx.Graph: Funced skeleton of the graph.\n        \"\"\"\n        arg_4 = arg_3.get(\"nb_jobs\", SETTINGS.NB_JOBS)\n        arg_5 = list(arg_1.columns.values)\n        if arg_4 != 1:\n            arg_6 = Parallel(n_jobs=arg_4)(delayed(arg_0.run_feature_selection)\n                                                                (arg_1, arg_13, arg_7, **arg_3)\n                                                                for arg_7, arg_13 in enumerate(arg_5))\n        else:\n            arg_6 = [arg_0.run_feature_selection(arg_1, arg_13, arg_7, **arg_3) for arg_7, arg_13 in enumerate(arg_5)]\n        for arg_7, arg_8 in enumerate(arg_6):\n            try:\n                arg_8.insert(arg_7, 0)\n            except AttributeError:  # if results are numpy arrays\n                arg_6[arg_7] = np.insert(arg_8, arg_7, 0)\n        arg_9 = np.array(arg_6)\n        arg_9 *= arg_9.transpose()\n        np.fill_diagonal(arg_9, 0)\n        arg_9 /= 2\n\n        arg_10 = nx.Graph()\n\n        for (arg_8, arg_11), arg_12 in np.ndenumerate(arg_9):\n            if arg_9[arg_8, arg_11] > arg_2:\n                arg_10.add_edge(arg_5[arg_8], arg_5[arg_11],\n                               weight=arg_9[arg_8, arg_11])\n        for arg_13 in arg_5:\n            if arg_13 not in arg_10.nodes():\n                arg_10.add_node(arg_13)\n        return arg_10", "path": "cdt/independence/graph/model.py", "identifier": "FeatureSelectionModel.predict", "docstring": "Predict the skeleton of the graph from raw data.\n\n        Returns iteratively the feature selection algorithm on each node.\n\n        Args:\n            df_data (pandas.DataFrame): data to construct a graph from\n            threshold (float): cutoff value for feature selection scores\n            kwargs (dict): additional arguments for algorithms\n\n        Returns:\n            networkx.Graph: predicted skeleton of the graph.", "docstring_tokens": ["Predict", "the", "skeleton", "of", "the", "graph", "from", "raw", "data", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 259997}
{"url": "https://github.com/willprice/python-omxplayer-wrapper/blob/f242cb391f0fd07be2d9211c13ebe72fbc628fa3/omxplayer/player.py#L758-L772", "sha": "f242cb391f0fd07be2d9211c13ebe72fbc628fa3", "docstring_summary": "Play the video and block whilst the video is playing", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "play", "(", ")", "logger", ".", "info", "(", "\"Playing synchronously\"", ")", "try", ":", "time", ".", "sleep", "(", "0.05", ")", "logger", ".", "debug", "(", "\"Wait for playing to start\"", ")", "while", "arg_0", ".", "is_playing", "(", ")", ":", "time", ".", "sleep", "(", "0.05", ")", "except", "DBusException", ":", "logger", ".", "error", "(", "\"Cannot play synchronously any longer as DBus calls timed out.\"", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Play the video and block whilst the video is playing\n        \"\"\"\n        arg_0.play()\n        logger.info(\"Playing synchronously\")\n        try:\n            time.sleep(0.05)\n            logger.debug(\"Wait for playing to start\")\n            while arg_0.is_playing():\n                time.sleep(0.05)\n        except DBusException:\n            logger.error(\n                \"Cannot play synchronously any longer as DBus calls timed out.\"\n            )", "path": "omxplayer/player.py", "identifier": "OMXPlayer.play_sync", "docstring": "Play the video and block whilst the video is playing", "docstring_tokens": ["Play", "the", "video", "and", "block", "whilst", "the", "video", "is", "playing"], "nwo": "willprice/python-omxplayer-wrapper", "score": 0.4416928199994954, "idx": 259998}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_sift4.py#L268-L301", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the normalized \"common\" Sift4 similarity of two terms.", "language": "python", "parameters": "(src, tar, max_offset=5, max_distance=0)", "return_statement": "return Sift4().sim(src, tar, max_offset, max_distance)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "5", ",", "arg_3", "=", "0", ")", ":", "return", "Sift4", "(", ")", ".", "sim", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=5, arg_3=0):\n    \"\"\"Return the normalized \"common\" Sift4 similarity of two terms.\n\n    This is a wrapper for :py:meth:`Sift4.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    max_offset : int\n        The number of characters to search for matching letters\n    max_distance : int\n        The distance at which to stop and exit\n\n    Returns\n    -------\n    float\n        The normalized Sift4 similarity\n\n    Examples\n    --------\n    >>> round(Func('cat', 'hat'), 12)\n    0.666666666667\n    >>> Func('Niall', 'Neil')\n    0.6\n    >>> Func('Colin', 'Cuilen')\n    0.5\n    >>> Func('ATCG', 'TAGC')\n    0.5\n\n    \"\"\"\n    return Sift4().sim(arg_0, arg_1, arg_2, arg_3)", "path": "abydos/distance/_sift4.py", "identifier": "sim_sift4", "docstring": "Return the normalized \"common\" Sift4 similarity of two terms.\n\n    This is a wrapper for :py:meth:`Sift4.sim`.\n\n    Parameters\n    ----------\n    src : str\n        Source string for comparison\n    tar : str\n        Target string for comparison\n    max_offset : int\n        The number of characters to search for matching letters\n    max_distance : int\n        The distance at which to stop and exit\n\n    Returns\n    -------\n    float\n        The normalized Sift4 similarity\n\n    Examples\n    --------\n    >>> round(sim_sift4('cat', 'hat'), 12)\n    0.666666666667\n    >>> sim_sift4('Niall', 'Neil')\n    0.6\n    >>> sim_sift4('Colin', 'Cuilen')\n    0.5\n    >>> sim_sift4('ATCG', 'TAGC')\n    0.5", "docstring_tokens": ["Return", "the", "normalized", "common", "Sift4", "similarity", "of", "two", "terms", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 259999}
{"url": "https://github.com/praekelt/django-analytics/blob/29c22d03374ccc0ec451650e2c2886d324f6e5c6/analytics/geckoboard_views.py#L43-L54", "sha": "29c22d03374ccc0ec451650e2c2886d324f6e5c6", "docstring_summary": "Gets the next colour in the Geckoboard colour list.", "language": "python", "parameters": "()", "return_statement": "return colour", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "settings", ".", "GECKOBOARD_COLOURS", "[", "Func", ".", "cur_colour", "]", "Func", ".", "cur_colour", "+=", "1", "if", "Func", ".", "cur_colour", ">=", "len", "(", "settings", ".", "GECKOBOARD_COLOURS", ")", ":", "Func", ".", "cur_colour", "=", "0", "return", "arg_0"], "function": "def Func():\n    \"\"\"\n    Gets the next colour in the Geckoboard colour list.\n    \"\"\"\n\n    arg_0 = settings.GECKOBOARD_COLOURS[Func.cur_colour]\n\n    Func.cur_colour += 1\n    if Func.cur_colour >= len(settings.GECKOBOARD_COLOURS):\n        Func.cur_colour = 0\n\n    return arg_0", "path": "analytics/geckoboard_views.py", "identifier": "get_next_colour", "docstring": "Gets the next colour in the Geckoboard colour list.", "docstring_tokens": ["Gets", "the", "next", "colour", "in", "the", "Geckoboard", "colour", "list", "."], "nwo": "praekelt/django-analytics", "score": 0.1905226606846468, "idx": 260000}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/models/model.py#L1622-L1632", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Looks up a component by its name.", "language": "python", "parameters": "(self, component_name)", "return_statement": "return mapping[component_name] if component_name in mapping else None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "Funcs", "(", ")", "return", "arg_2", "[", "arg_1", "]", "if", "arg_1", "in", "arg_2", "else", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Looks up a component by its name.\n\n        Args:\n            component_name: The name of the component to look up.\n        Returns:\n            The component for the provided name or None if there is no such component.\n        \"\"\"\n        arg_2 = arg_0.Funcs()\n        return arg_2[arg_1] if arg_1 in arg_2 else None", "path": "tensorforce/models/model.py", "identifier": "Model.get_component", "docstring": "Looks up a component by its name.\n\n        Args:\n            component_name: The name of the component to look up.\n        Returns:\n            The component for the provided name or None if there is no such component.", "docstring_tokens": ["Looks", "up", "a", "component", "by", "its", "name", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 260001}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/differential_evolution.py#L214-L456", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Applies the Differential evolution algorithm to minimize a function.", "language": "python", "parameters": "(objective_function,\n             initial_population=None,\n             initial_position=None,\n             population_size=50,\n             population_stddev=1.,\n             max_iterations=100,\n             func_tolerance=0,\n             position_tolerance=1e-8,\n             differential_weight=0.5,\n             crossover_prob=0.9,\n             seed=None,\n             name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "50", ",", "arg_4", "=", "1.", ",", "arg_5", "=", "100", ",", "arg_6", "=", "0", ",", "arg_7", "=", "1e-8", ",", "arg_8", "=", "0.5", ",", "arg_9", "=", "0.9", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ")", ":", "if", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "raise", "ValueError", "(", "'Either the initial population or the initial position '", "'must be specified.'", ")", "if", "arg_1", "is", "not", "None", "and", "arg_2", "is", "not", "None", ":", "raise", "ValueError", "(", "'Only one of initial population or initial position '", "'should be specified'", ")", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_11", ",", "default_name", "=", "'Func'", ",", "values", "=", "[", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "]", ")", ":", "(", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ")", "=", "_get_initial_args", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ")", "def", "evolve_body", "(", "arg_15", ")", ":", "arg_16", ",", "arg_17", "=", "one_step", "(", "arg_0", ",", "arg_15", ".", "population", ",", "arg_14", "=", "arg_15", ".", "population_values", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ")", "arg_18", "=", "_check_convergence", "(", "arg_16", ",", "arg_17", ",", "arg_6", ",", "arg_7", ")", "arg_19", "=", "_check_failure", "(", "arg_17", ")", "return", "[", "_MinimizeLoopVars", "(", "arg_18", "=", "arg_18", ",", "arg_19", "=", "arg_19", ",", "num_iterations", "=", "arg_15", ".", "num_iterations", "+", "1", ",", "arg_13", "=", "arg_16", ",", "arg_14", "=", "arg_17", ")", "]", "def", "evolve_cond", "(", "arg_15", ")", ":", "arg_20", "=", "(", "arg_15", ".", "failed", "|", "arg_15", ".", "converged", "|", "(", "arg_5", "is", "not", "None", "and", "arg_15", ".", "num_iterations", ">=", "arg_5", ")", ")", "return", "~", "arg_20", "arg_21", "=", "_MinimizeLoopVars", "(", "arg_18", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "False", ")", ",", "arg_19", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "False", ")", ",", "num_iterations", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "0", ")", ",", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ")", "arg_22", "=", "tf", ".", "while_loop", "(", "cond", "=", "evolve_cond", ",", "body", "=", "evolve_body", ",", "arg_15", "=", "(", "arg_21", ",", ")", ")", "[", "0", "]", "arg_23", ",", "arg_24", "=", "_find_best_in_population", "(", "arg_22", ".", "population", ",", "arg_22", ".", "population_values", ")", "arg_25", "=", "arg_22", ".", "population", "if", "not", "arg_12", ":", "arg_25", "=", "arg_25", "[", "0", "]", "arg_23", "=", "arg_23", "[", "0", "]", "return", "DifferentialEvolutionOptimizerResults", "(", "arg_18", "=", "arg_22", ".", "converged", ",", "arg_19", "=", "arg_22", ".", "failed", ",", "position", "=", "arg_23", ",", "objective_value", "=", "arg_24", ",", "arg_25", "=", "arg_25", ",", "final_objective_values", "=", "arg_22", ".", "population_values", ",", "arg_1", "=", "arg_13", ",", "initial_objective_values", "=", "arg_14", ",", "num_iterations", "=", "arg_22", ".", "num_iterations", ")"], "function": "def Func(arg_0,\n             arg_1=None,\n             arg_2=None,\n             arg_3=50,\n             arg_4=1.,\n             arg_5=100,\n             arg_6=0,\n             arg_7=1e-8,\n             arg_8=0.5,\n             arg_9=0.9,\n             arg_10=None,\n             arg_11=None):\n  \"\"\"Applies the Differential evolution algorithm to Func a function.\n\n  Differential Evolution is an evolutionary optimization algorithm which works\n  on a set of candidate solutions called the population. It iteratively\n  improves the population by applying genetic operators of mutation and\n  recombination. The objective function `f` supplies the fitness of each\n  candidate. A candidate `s_1` is considered better than `s_2` if\n  `f(s_1) < f(s_2)`.\n\n  This method allows the user to either specify an initial population or a\n  single candidate solution. If a single solution is specified, a population\n  of the specified size is initialized by adding independent normal noise\n  to the candidate solution.\n\n  The implementation also supports a multi-part specification of the state. For\n  example, consider the objective function:\n\n  ```python\n  # x is a tensor of shape [n, m] while y is of shape [n].\n  def objective(x, y):\n    return tf.math.reduce_sum(x ** 2, axis=-1) + y ** 2\n  ```\n  The state in this case is specified by two input tensors `x` and `y`. To\n  apply the algorithm to this objective function, one would need to specify\n  either an initial population as a list of two tensors of shapes\n  `[population_size, k]` and `[population_size]`. The following code shows the\n  complete example:\n\n  ```python\n    population_size = 40\n    # With an initial population and a multi-part state.\n    initial_population = (tf.random.normal([population_size]),\n                          tf.random.normal([population_size]))\n    def easom_fn(x, y):\n      return -(tf.math.cos(x) * tf.math.cos(y) *\n               tf.math.exp(-(x-np.pi)**2 - (y-np.pi)**2))\n\n    optim_results = tfp.optimizers.differential_evolution_Func(\n        easom_fn,\n        initial_population=initial_population,\n        seed=43210)\n\n    print (optim_results.converged)\n    print (optim_results.position)  # Should be (close to) [pi, pi].\n    print (optim_results.objective_value)    # Should be -1.\n\n\n    # With a single starting point\n    initial_position = (tf.constant(1.0), tf.constant(1.0))\n\n    optim_results = tfp.optimizers.differential_evolution_Func(\n        easom_fn,\n        initial_position=initial_position,\n        population_size=40,\n        population_stddev=2.0,\n        seed=43210)\n  ```\n\n  Args:\n    objective_function: A Python callable that accepts a batch of possible\n      solutions and returns the values of the objective function at those\n      arguments as a rank 1 real `Tensor`. This specifies the function to be\n      Funcd. The input to this callable may be either a single `Tensor`\n      or a Python `list` of `Tensor`s. The signature must match the format of\n      the argument `population`. (i.e. objective_function(*population) must\n      return the value of the function to be Funcd).\n    initial_population: A real `Tensor` or Python list of `Tensor`s.\n      If a list, each `Tensor` must be of rank at least 1 and with a common\n      first dimension. The first dimension indexes into the candidate solutions\n      while the rest of the dimensions (if any) index into an individual\n      solution. The size of the population must be at least 4. This is a\n      requirement of the DE algorithm.\n    initial_position: A real `Tensor` of any shape. The seed solution used\n      to initialize the population of solutions. If this parameter is specified\n      then `initial_population` must not be specified.\n    population_size: A positive scalar int32 `Tensor` greater than 4. The\n      size of the population to evolve. This parameter is ignored if\n      `initial_population` is specified.\n      Default value: 50.\n    population_stddev: A positive scalar real `Tensor` of the same dtype\n      as `initial_position`. This parameter is ignored if `initial_population`\n      is specified. Used to generate the population from the `initial_position`\n      by adding random normal noise with zero mean and the specified standard\n      deviation.\n      Default value: 1.0\n    max_iterations: Positive scalar int32 `Tensor`. The maximum number of\n      generations to evolve the population for.\n      Default value: 100\n    func_tolerance: Scalar `Tensor` of the same dtype as the output of the\n      `objective_function`. The algorithm stops if the absolute difference\n      between the largest and the smallest objective function value in the\n      population is below this number.\n      Default value: 0\n    position_tolerance: Scalar `Tensor` of the same real dtype as\n      `initial_position` or `initial_population`. The algorithm terminates if\n      the largest absolute difference between the coordinates of the population\n      members is below this threshold.\n      Default value: 1e-8\n    differential_weight: Real scalar `Tensor`. Must be positive and less than\n      2.0. The parameter controlling the strength of mutation in the algorithm.\n      Default value: 0.5\n    crossover_prob: Real scalar `Tensor`. Must be between 0 and 1. The\n      probability of recombination per site.\n      Default value: 0.9\n    seed: `int` or None. The random seed for this `Op`. If `None`, no seed is\n      applied.\n      Default value: None.\n    name: (Optional) Python str. The name prefixed to the ops created by this\n      function. If not supplied, the default name\n      'differential_evolution_Func' is used.\n      Default value: None\n\n  Returns:\n    optimizer_results: An object containing the following attributes:\n      converged: Scalar boolean `Tensor` indicating whether the minimum was\n        found within the specified tolerances.\n      num_objective_evaluations: The total number of objective\n        evaluations performed.\n      position: A `Tensor` containing the best point found during the search.\n        If the search converged, then this value is the argmin of the\n        objective function within the specified tolerances.\n      objective_value: A `Tensor` containing the value of the objective\n        function at the `position`. If the search\n        converged, then this is the (local) minimum of\n        the objective function.\n      final_population: The final state of the population.\n      final_objective_values: The objective function evaluated at the\n        final population.\n      initial_population: The starting population.\n      initial_objective_values: The objective function evaluated at the\n        initial population.\n      num_iterations: The number of iterations of the main algorithm body.\n\n  Raises:\n    ValueError: If neither the initial population, nor the initial position\n      are specified or if both are specified.\n  \"\"\"\n\n  if arg_1 is None and arg_2 is None:\n    raise ValueError('Either the initial population or the initial position '\n                     'must be specified.')\n  if arg_1 is not None and arg_2 is not None:\n    raise ValueError('Only one of initial population or initial position '\n                     'should be specified')\n\n  with tf.compat.v1.name_scope(\n      arg_11,\n      default_name='Func',\n      values=[\n          arg_1, arg_2, arg_3,\n          arg_4, arg_5, arg_6, arg_7,\n          arg_8, arg_9\n      ]):\n    (\n        arg_12,\n        arg_13,\n        arg_14,\n        arg_5,\n        arg_6,\n        arg_7,\n        arg_8,\n        arg_9\n    ) = _get_initial_args(arg_0,\n                          arg_1,\n                          arg_2,\n                          arg_3,\n                          arg_4,\n                          arg_5,\n                          arg_6,\n                          arg_7,\n                          arg_8,\n                          arg_9,\n                          arg_10)\n\n    def evolve_body(arg_15):\n      \"\"\"Performs one step of the evolution.\"\"\"\n      arg_16, arg_17 = one_step(\n          arg_0,\n          arg_15.population,\n          arg_14=arg_15.population_values,\n          arg_8=arg_8,\n          arg_9=arg_9,\n          arg_10=arg_10)\n      arg_18 = _check_convergence(arg_16,\n                                     arg_17,\n                                     arg_6,\n                                     arg_7)\n\n      arg_19 = _check_failure(arg_17)\n\n      return [_MinimizeLoopVars(\n          arg_18=arg_18,\n          arg_19=arg_19,\n          num_iterations=arg_15.num_iterations+1,\n          arg_13=arg_16,\n          arg_14=arg_17)]\n\n    def evolve_cond(arg_15):\n      arg_20 = (\n          arg_15.failed |\n          arg_15.converged |\n          (arg_5 is not None and\n           arg_15.num_iterations >= arg_5))\n      return ~arg_20\n\n    arg_21 = _MinimizeLoopVars(\n        arg_18=tf.convert_to_tensor(value=False),\n        arg_19=tf.convert_to_tensor(value=False),\n        num_iterations=tf.convert_to_tensor(value=0),\n        arg_13=arg_13,\n        arg_14=arg_14)\n    arg_22 = tf.while_loop(\n        cond=evolve_cond, body=evolve_body, arg_15=(arg_21,))[0]\n    arg_23, arg_24 = _find_best_in_population(\n        arg_22.population,\n        arg_22.population_values)\n    # Ensure we return a similar structure to what the user supplied.\n    arg_25 = arg_22.population\n    if not arg_12:\n      arg_25 = arg_25[0]\n      arg_23 = arg_23[0]\n    return DifferentialEvolutionOptimizerResults(\n        arg_18=arg_22.converged,\n        arg_19=arg_22.failed,\n        position=arg_23,\n        objective_value=arg_24,\n        arg_25=arg_25,\n        final_objective_values=arg_22.population_values,\n        arg_1=arg_13,\n        initial_objective_values=arg_14,\n        num_iterations=arg_22.num_iterations)", "path": "tensorflow_probability/python/optimizer/differential_evolution.py", "identifier": "minimize", "docstring": "Applies the Differential evolution algorithm to minimize a function.\n\n  Differential Evolution is an evolutionary optimization algorithm which works\n  on a set of candidate solutions called the population. It iteratively\n  improves the population by applying genetic operators of mutation and\n  recombination. The objective function `f` supplies the fitness of each\n  candidate. A candidate `s_1` is considered better than `s_2` if\n  `f(s_1) < f(s_2)`.\n\n  This method allows the user to either specify an initial population or a\n  single candidate solution. If a single solution is specified, a population\n  of the specified size is initialized by adding independent normal noise\n  to the candidate solution.\n\n  The implementation also supports a multi-part specification of the state. For\n  example, consider the objective function:\n\n  ```python\n  # x is a tensor of shape [n, m] while y is of shape [n].\n  def objective(x, y):\n    return tf.math.reduce_sum(x ** 2, axis=-1) + y ** 2\n  ```\n  The state in this case is specified by two input tensors `x` and `y`. To\n  apply the algorithm to this objective function, one would need to specify\n  either an initial population as a list of two tensors of shapes\n  `[population_size, k]` and `[population_size]`. The following code shows the\n  complete example:\n\n  ```python\n    population_size = 40\n    # With an initial population and a multi-part state.\n    initial_population = (tf.random.normal([population_size]),\n                          tf.random.normal([population_size]))\n    def easom_fn(x, y):\n      return -(tf.math.cos(x) * tf.math.cos(y) *\n               tf.math.exp(-(x-np.pi)**2 - (y-np.pi)**2))\n\n    optim_results = tfp.optimizers.differential_evolution_minimize(\n        easom_fn,\n        initial_population=initial_population,\n        seed=43210)\n\n    print (optim_results.converged)\n    print (optim_results.position)  # Should be (close to) [pi, pi].\n    print (optim_results.objective_value)    # Should be -1.\n\n\n    # With a single starting point\n    initial_position = (tf.constant(1.0), tf.constant(1.0))\n\n    optim_results = tfp.optimizers.differential_evolution_minimize(\n        easom_fn,\n        initial_position=initial_position,\n        population_size=40,\n        population_stddev=2.0,\n        seed=43210)\n  ```\n\n  Args:\n    objective_function: A Python callable that accepts a batch of possible\n      solutions and returns the values of the objective function at those\n      arguments as a rank 1 real `Tensor`. This specifies the function to be\n      minimized. The input to this callable may be either a single `Tensor`\n      or a Python `list` of `Tensor`s. The signature must match the format of\n      the argument `population`. (i.e. objective_function(*population) must\n      return the value of the function to be minimized).\n    initial_population: A real `Tensor` or Python list of `Tensor`s.\n      If a list, each `Tensor` must be of rank at least 1 and with a common\n      first dimension. The first dimension indexes into the candidate solutions\n      while the rest of the dimensions (if any) index into an individual\n      solution. The size of the population must be at least 4. This is a\n      requirement of the DE algorithm.\n    initial_position: A real `Tensor` of any shape. The seed solution used\n      to initialize the population of solutions. If this parameter is specified\n      then `initial_population` must not be specified.\n    population_size: A positive scalar int32 `Tensor` greater than 4. The\n      size of the population to evolve. This parameter is ignored if\n      `initial_population` is specified.\n      Default value: 50.\n    population_stddev: A positive scalar real `Tensor` of the same dtype\n      as `initial_position`. This parameter is ignored if `initial_population`\n      is specified. Used to generate the population from the `initial_position`\n      by adding random normal noise with zero mean and the specified standard\n      deviation.\n      Default value: 1.0\n    max_iterations: Positive scalar int32 `Tensor`. The maximum number of\n      generations to evolve the population for.\n      Default value: 100\n    func_tolerance: Scalar `Tensor` of the same dtype as the output of the\n      `objective_function`. The algorithm stops if the absolute difference\n      between the largest and the smallest objective function value in the\n      population is below this number.\n      Default value: 0\n    position_tolerance: Scalar `Tensor` of the same real dtype as\n      `initial_position` or `initial_population`. The algorithm terminates if\n      the largest absolute difference between the coordinates of the population\n      members is below this threshold.\n      Default value: 1e-8\n    differential_weight: Real scalar `Tensor`. Must be positive and less than\n      2.0. The parameter controlling the strength of mutation in the algorithm.\n      Default value: 0.5\n    crossover_prob: Real scalar `Tensor`. Must be between 0 and 1. The\n      probability of recombination per site.\n      Default value: 0.9\n    seed: `int` or None. The random seed for this `Op`. If `None`, no seed is\n      applied.\n      Default value: None.\n    name: (Optional) Python str. The name prefixed to the ops created by this\n      function. If not supplied, the default name\n      'differential_evolution_minimize' is used.\n      Default value: None\n\n  Returns:\n    optimizer_results: An object containing the following attributes:\n      converged: Scalar boolean `Tensor` indicating whether the minimum was\n        found within the specified tolerances.\n      num_objective_evaluations: The total number of objective\n        evaluations performed.\n      position: A `Tensor` containing the best point found during the search.\n        If the search converged, then this value is the argmin of the\n        objective function within the specified tolerances.\n      objective_value: A `Tensor` containing the value of the objective\n        function at the `position`. If the search\n        converged, then this is the (local) minimum of\n        the objective function.\n      final_population: The final state of the population.\n      final_objective_values: The objective function evaluated at the\n        final population.\n      initial_population: The starting population.\n      initial_objective_values: The objective function evaluated at the\n        initial population.\n      num_iterations: The number of iterations of the main algorithm body.\n\n  Raises:\n    ValueError: If neither the initial population, nor the initial position\n      are specified or if both are specified.", "docstring_tokens": ["Applies", "the", "Differential", "evolution", "algorithm", "to", "minimize", "a", "function", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260002}
{"url": "https://github.com/davidmiller/urlhelp/blob/9cc417a5dc5bd4a7e17ed78a1f1394a6ece9faa5/urlhelp/__init__.py#L34-L52", "sha": "9cc417a5dc5bd4a7e17ed78a1f1394a6ece9faa5", "docstring_summary": "Find the href destinations of all links at  URL", "language": "python", "parameters": "(url)", "return_statement": "return hrefs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "protocolise", "(", "arg_0", ")", "arg_1", "=", "requests", ".", "get", "(", "arg_0", ")", ".", "content", "arg_2", "=", "StringIO", "(", "arg_1", ")", "arg_3", "=", "html", ".", "parse", "(", "arg_2", ")", ".", "getroot", "(", ")", "arg_4", "=", "arg_3", ".", "cssselect", "(", "'a'", ")", "arg_5", "=", "[", "a", ".", "attrib", "[", "'href'", "]", "for", "a", "in", "arg_4", "]", "arg_5", "=", "[", "h", "if", "h", ".", "startswith", "(", "'http'", ")", "else", "'/'", ".", "join", "(", "[", "arg_0", ",", "h", "]", ")", "for", "h", "in", "arg_5", "]", "return", "arg_5"], "function": "def Func(arg_0):\n    \"\"\"\n    Find the href destinations of all links at  URL\n\n    Arguments:\n    - `url`:\n\n    Return: list[str]\n    Exceptions: None\n    \"\"\"\n    arg_0 = protocolise(arg_0)\n    arg_1 = requests.get(arg_0).content\n    arg_2 = StringIO(arg_1)\n    arg_3 = html.parse(arg_2).getroot()\n    arg_4 = arg_3.cssselect('a')\n    arg_5 = [a.attrib['href'] for a in arg_4]\n    # !!! This does the wrong thing for bbc.co.uk/index.html\n    arg_5 = [h if h.startswith('http') else '/'.join([arg_0, h]) for h in arg_5 ]\n    return arg_5", "path": "urlhelp/__init__.py", "identifier": "find_links", "docstring": "Find the href destinations of all links at  URL\n\n    Arguments:\n    - `url`:\n\n    Return: list[str]\n    Exceptions: None", "docstring_tokens": ["Find", "the", "href", "destinations", "of", "all", "links", "at", "URL"], "nwo": "davidmiller/urlhelp", "score": 0.09252797783733271, "idx": 260003}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/preset_passmanagers/default.py#L30-L83", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "The default pass manager that maps to the coupling map.", "language": "python", "parameters": "(basis_gates, coupling_map, initial_layout, seed_transpiler)", "return_statement": "return pass_manager", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "PassManager", "(", ")", "arg_4", ".", "property_set", "[", "'layout'", "]", "=", "arg_2", "arg_4", ".", "append", "(", "Unroller", "(", "arg_0", ")", ")", "arg_4", ".", "append", "(", "TrivialLayout", "(", "arg_1", ")", ",", "condition", "=", "lambda", "arg_5", ":", "not", "arg_5", "[", "'layout'", "]", ")", "arg_4", ".", "append", "(", "CheckMap", "(", "arg_1", ")", ")", "arg_4", ".", "append", "(", "DenseLayout", "(", "arg_1", ")", ",", "condition", "=", "lambda", "arg_5", ":", "not", "arg_5", "[", "'is_swap_mapped'", "]", ")", "arg_4", ".", "append", "(", "FullAncillaAllocation", "(", "arg_1", ")", ")", "arg_4", ".", "append", "(", "EnlargeWithAncilla", "(", ")", ")", "arg_4", ".", "append", "(", "Unroll3qOrMore", "(", ")", ")", "arg_4", ".", "append", "(", "LegacySwap", "(", "arg_1", ",", "trials", "=", "20", ",", "seed", "=", "arg_3", ")", ")", "arg_4", ".", "append", "(", "Decompose", "(", "SwapGate", ")", ")", "arg_4", ".", "append", "(", "CXDirection", "(", "arg_1", ")", ")", "arg_4", ".", "append", "(", "Unroller", "(", "[", "'u1'", ",", "'u2'", ",", "'u3'", ",", "'id'", ",", "'cx'", "]", ")", ")", "arg_6", "=", "[", "Optimize1qGates", "(", ")", ",", "CXCancellation", "(", ")", ",", "RemoveResetInZeroState", "(", ")", "]", "arg_4", ".", "append", "(", "arg_6", "+", "[", "Depth", "(", ")", ",", "FixedPoint", "(", "'depth'", ")", "]", ",", "do_while", "=", "lambda", "arg_5", ":", "not", "arg_5", "[", "'depth_fixed_point'", "]", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    The default pass manager that maps to the coupling map.\n\n    Args:\n        basis_gates (list[str]): list of basis gate names supported by the target.\n        coupling_map (CouplingMap): coupling map to target in mapping.\n        initial_layout (Layout or None): initial layout of virtual qubits on physical qubits\n        seed_transpiler (int or None): random seed for stochastic passes.\n\n    Returns:\n        PassManager: A pass manager to map and optimize.\n    \"\"\"\n    arg_4 = PassManager()\n    arg_4.property_set['layout'] = arg_2\n\n    arg_4.append(Unroller(arg_0))\n\n    # Use the trivial layout if no layout is found\n    arg_4.append(TrivialLayout(arg_1),\n                        condition=lambda arg_5: not arg_5['layout'])\n\n    # if the circuit and layout already satisfy the coupling_constraints, use that layout\n    # otherwise layout on the most densely connected physical qubit subset\n    arg_4.append(CheckMap(arg_1))\n    arg_4.append(DenseLayout(arg_1),\n                        condition=lambda arg_5: not arg_5['is_swap_mapped'])\n\n    # Extend the the dag/layout with ancillas using the full coupling map\n    arg_4.append(FullAncillaAllocation(arg_1))\n    arg_4.append(EnlargeWithAncilla())\n\n    # Circuit must only contain 1- or 2-qubit interactions for swapper to work\n    arg_4.append(Unroll3qOrMore())\n\n    # Swap mapper\n    arg_4.append(LegacySwap(arg_1, trials=20, seed=arg_3))\n\n    # Expand swaps\n    arg_4.append(Decompose(SwapGate))\n\n    # Change CX directions\n    arg_4.append(CXDirection(arg_1))\n\n    # Unroll to the basis\n    arg_4.append(Unroller(['u1', 'u2', 'u3', 'id', 'cx']))\n\n    # Simplify single qubit gates and CXs\n    arg_6 = [Optimize1qGates(), CXCancellation(), RemoveResetInZeroState()]\n\n    arg_4.append(arg_6 + [Depth(), FixedPoint('depth')],\n                        do_while=lambda arg_5: not arg_5['depth_fixed_point'])\n\n    return arg_4", "path": "qiskit/transpiler/preset_passmanagers/default.py", "identifier": "default_pass_manager", "docstring": "The default pass manager that maps to the coupling map.\n\n    Args:\n        basis_gates (list[str]): list of basis gate names supported by the target.\n        coupling_map (CouplingMap): coupling map to target in mapping.\n        initial_layout (Layout or None): initial layout of virtual qubits on physical qubits\n        seed_transpiler (int or None): random seed for stochastic passes.\n\n    Returns:\n        PassManager: A pass manager to map and optimize.", "docstring_tokens": ["The", "default", "pass", "manager", "that", "maps", "to", "the", "coupling", "map", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260004}
{"url": "https://github.com/kata198/ProcessMappingScanner/blob/d1735fe6746493c51aaae213b982fa96f5c5b621/ProcessMappingScanner/__init__.py#L216-L287", "sha": "d1735fe6746493c51aaae213b982fa96f5c5b621", "docstring_summary": "scanProcessForMapping - Searches a given pid's mappings for a certain pattern.", "language": "python", "parameters": "(pid, searchPortion, isExactMatch=False, ignoreCase=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "try", ":", "try", ":", "arg_0", "=", "int", "(", "arg_0", ")", "except", "ValueError", "as", "e", ":", "sys", ".", "stderr", ".", "write", "(", "'Expected an integer, got %s for pid.\\n'", "%", "(", "str", "(", "type", "(", "arg_0", ")", ")", ",", ")", ")", "raise", "e", "with", "open", "(", "'/proc/%d/maps'", "%", "(", "arg_0", ",", ")", ",", "'r'", ")", "as", "f", ":", "arg_4", "=", "f", ".", "read", "(", ")", "arg_5", "=", "arg_4", ".", "split", "(", "'\\n'", ")", "arg_6", "=", "[", "]", "if", "arg_2", "is", "True", ":", "if", "arg_3", "is", "False", ":", "arg_7", "=", "lambda", "searchFor", ",", "searchIn", ":", "bool", "(", "searchFor", "==", "searchIn", ")", "else", ":", "arg_7", "=", "lambda", "searchFor", ",", "searchIn", ":", "bool", "(", "searchFor", ".", "lower", "(", ")", "==", "searchIn", ".", "lower", "(", ")", ")", "else", ":", "if", "arg_3", "is", "False", ":", "arg_7", "=", "lambda", "searchFor", ",", "searchIn", ":", "bool", "(", "searchFor", "in", "searchIn", ")", "else", ":", "arg_7", "=", "lambda", "searchFor", ",", "searchIn", ":", "bool", "(", "searchFor", ".", "lower", "(", ")", "in", "searchIn", ".", "lower", "(", ")", ")", "for", "arg_8", "in", "arg_5", ":", "arg_9", "=", "' '", ".", "join", "(", "arg_8", ".", "split", "(", "' '", ")", "[", "5", ":", "]", ")", ".", "lstrip", "(", ")", "if", "arg_7", "(", "arg_1", ",", "arg_9", ")", ":", "arg_6", ".", "append", "(", "'\\t'", "+", "arg_8", ")", "if", "len", "(", "arg_6", ")", "==", "0", ":", "return", "None", "arg_10", "=", "getProcessCommandLineStr", "(", "arg_0", ")", "arg_11", "=", "getProcessOwnerStr", "(", "arg_0", ")", "return", "{", "'searchPortion'", ":", "arg_1", ",", "'pid'", ":", "arg_0", ",", "'owner'", ":", "arg_11", ",", "'cmdline'", ":", "arg_10", ",", "'matchedMappings'", ":", "arg_6", ",", "}", "except", "OSError", ":", "return", "None", "except", "IOError", ":", "return", "None", "except", "FileNotFoundError", ":", "return", "None", "except", "PermissionError", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False):\n    '''\n        Func - Searches a given pid's mappings for a certain pattern.\n\n            @param pid <int> - A running process ID on this system\n            @param searchPortion <str> - A mapping for which to search, example: libc or python or libz.so.1. Give empty string to return all mappings.\n            @param isExactMatch <bool> Default False - If match should be exact, otherwise a partial match is performed.\n            @param ignoreCase <bool> Default False - If True, search will be performed case-insensitively\n\n            @return <dict> - If result is found, the following dict is returned. If no match found on the given pid, or pid is not found running, None is returned.\n                {\n                    'searchPortion' : The passed search pattern\n                    'pid'           : The passed pid (as an integer)\n                    'owner'         : String of process owner, or uid if no mapping can be found, or \"unknown\" if neither could be determined.\n                    'cmdline'       : Commandline string\n                    'matchedMappings' : All mappings likes that matched the given search pattern\n                }\n\n    '''\n    try:   \n        try:\n            arg_0 = int(arg_0)\n        except ValueError as e:\n            sys.stderr.write('Expected an integer, got %s for pid.\\n' %(str(type(arg_0)),))\n            raise e\n            \n        with open('/proc/%d/maps' %(arg_0,), 'r') as f:\n            arg_4 = f.read()\n\n        arg_5 = arg_4.split('\\n')\n        arg_6 = []\n    \n        if arg_2 is True:\n\n            if arg_3 is False:\n                arg_7 = lambda searchFor, searchIn : bool(searchFor == searchIn)\n            else:\n                arg_7 = lambda searchFor, searchIn : bool(searchFor.lower() == searchIn.lower())\n        else:\n            if arg_3 is False:\n                arg_7 = lambda searchFor, searchIn : bool(searchFor in searchIn)\n            else:\n                arg_7 = lambda searchFor, searchIn : bool(searchFor.lower() in searchIn.lower())\n                \n\n        for arg_8 in arg_5:\n            arg_9 = ' '.join(arg_8.split(' ')[5:]).lstrip()\n            if arg_7(arg_1, arg_9):\n                arg_6.append('\\t' + arg_8)\n\n        if len(arg_6) == 0:\n            return None\n\n\n        arg_10 = getProcessCommandLineStr(arg_0)\n        arg_11   = getProcessOwnerStr(arg_0)\n\n        return {\n            'searchPortion' : arg_1,\n            'pid'           : arg_0,\n            'owner'         : arg_11,\n            'cmdline'       : arg_10,\n            'matchedMappings' : arg_6,\n        }\n    except OSError:\n        return None\n    except IOError:\n        return None\n    except FileNotFoundError:\n        return None\n    except PermissionError:\n        return None", "path": "ProcessMappingScanner/__init__.py", "identifier": "scanProcessForMapping", "docstring": "scanProcessForMapping - Searches a given pid's mappings for a certain pattern.\n\n            @param pid <int> - A running process ID on this system\n            @param searchPortion <str> - A mapping for which to search, example: libc or python or libz.so.1. Give empty string to return all mappings.\n            @param isExactMatch <bool> Default False - If match should be exact, otherwise a partial match is performed.\n            @param ignoreCase <bool> Default False - If True, search will be performed case-insensitively\n\n            @return <dict> - If result is found, the following dict is returned. If no match found on the given pid, or pid is not found running, None is returned.\n                {\n                    'searchPortion' : The passed search pattern\n                    'pid'           : The passed pid (as an integer)\n                    'owner'         : String of process owner, or uid if no mapping can be found, or \"unknown\" if neither could be determined.\n                    'cmdline'       : Commandline string\n                    'matchedMappings' : All mappings likes that matched the given search pattern\n                }", "docstring_tokens": ["scanProcessForMapping", "-", "Searches", "a", "given", "pid", "s", "mappings", "for", "a", "certain", "pattern", "."], "nwo": "kata198/ProcessMappingScanner", "score": 0.18941942438232184, "idx": 260005}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/irunner.py#L50-L81", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Patch pexpect to prevent unhandled exceptions at VM teardown.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "arg_1", ".", "__version__", "[", ":", "3", "]", ">=", "'2.2'", ":", "return", "def", "arg_3", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "closed", ":", "try", ":", "arg_0", ".", "close", "(", ")", "except", "AttributeError", ":", "pass", "arg_1", ".", "spawn", ".", "__del__", "=", "arg_3"], "function": "def Func():\n    \"\"\"Patch pexpect to prevent unhandled exceptions at VM teardown.\n\n    Calling this function will monkeypatch the pexpect.spawn class and modify\n    its __del__ method to make it more robust in the face of failures that can\n    occur if it is called when the Python VM is shutting down.\n\n    Since Python may fire __del__ methods arbitrarily late, it's possible for\n    them to execute during the teardown of the Python VM itself.  At this\n    point, various builtin modules have been reset to None.  Thus, the call to\n    self.close() will trigger an exception because it tries to call os.close(),\n    and os is now None.\n    \"\"\"\n\n    if arg_1.__version__[:3] >= '2.2':\n        # No need to patch, fix is already the upstream version.\n        return\n\n    def arg_3(arg_0):\n        \"\"\"This makes sure that no system resources are left open.\n        Python only garbage collects Python objects. OS file descriptors\n        are not Python objects, so they must be handled explicitly.\n        If the child file descriptor was opened outside of this class\n        (passed to the constructor) then this does not close it.\n        \"\"\"\n        if not arg_0.closed:\n            try:\n                arg_0.close()\n            except AttributeError:\n                pass\n\n    arg_1.spawn.__del__ = arg_3", "path": "environment/lib/python2.7/site-packages/IPython/lib/irunner.py", "identifier": "pexpect_monkeypatch", "docstring": "Patch pexpect to prevent unhandled exceptions at VM teardown.\n\n    Calling this function will monkeypatch the pexpect.spawn class and modify\n    its __del__ method to make it more robust in the face of failures that can\n    occur if it is called when the Python VM is shutting down.\n\n    Since Python may fire __del__ methods arbitrarily late, it's possible for\n    them to execute during the teardown of the Python VM itself.  At this\n    point, various builtin modules have been reset to None.  Thus, the call to\n    self.close() will trigger an exception because it tries to call os.close(),\n    and os is now None.", "docstring_tokens": ["Patch", "pexpect", "to", "prevent", "unhandled", "exceptions", "at", "VM", "teardown", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260006}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/examples/asyncio_everything.py#L47-L66", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "List running QTM instances, asks for input and return chosen QTM", "language": "python", "parameters": "(interface)", "return_statement": "return instances[choice].host", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "print", "(", "\"Available QTM instances:\"", ")", "async", "for", "arg_2", ",", "arg_3", "in", "AsyncEnumerate", "(", "qtm", ".", "Discover", "(", "arg_0", ")", ",", "start", "=", "1", ")", ":", "arg_1", "[", "arg_2", "]", "=", "arg_3", "print", "(", "\"{} - {}\"", ".", "format", "(", "arg_2", ",", "arg_3", ".", "info", ")", ")", "try", ":", "arg_4", "=", "int", "(", "input", "(", "\"Connect to: \"", ")", ")", "if", "arg_4", "not", "in", "arg_1", ":", "raise", "ValueError", "except", "ValueError", ":", "LOG", ".", "error", "(", "\"Invalid choice\"", ")", "return", "None", "return", "arg_1", "[", "arg_4", "]", ".", "host"], "function": "async def Func(arg_0):\n    \"\"\" List running QTM instances, asks for input and return chosen QTM \"\"\"\n    arg_1 = {}\n    print(\"Available QTM instances:\")\n    async for arg_2, arg_3 in AsyncEnumerate(qtm.Discover(arg_0), start=1):\n        arg_1[arg_2] = arg_3\n        print(\"{} - {}\".format(arg_2, arg_3.info))\n\n    try:\n\n        arg_4 = int(input(\"Connect to: \"))\n\n        if arg_4 not in arg_1:\n            raise ValueError\n\n    except ValueError:\n        LOG.error(\"Invalid choice\")\n        return None\n\n    return arg_1[arg_4].host", "path": "examples/asyncio_everything.py", "identifier": "choose_qtm_instance", "docstring": "List running QTM instances, asks for input and return chosen QTM", "docstring_tokens": ["List", "running", "QTM", "instances", "asks", "for", "input", "and", "return", "chosen", "QTM"], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 260007}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/runner.py#L211-L309", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Gets a completely-optimized state from an image and an initial guess of\n    particle positions and radii.", "language": "python", "parameters": "(statemaker, pos, rad, im_name=None, tile=None,\n        desc='', use_full_path=False, statemaker_kwargs={}, **kwargs)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "''", ",", "arg_6", "=", "False", ",", "arg_7", "=", "{", "}", ",", "**", "arg_8", ")", ":", "if", "np", ".", "size", "(", "arg_1", ")", "==", "0", ":", "raise", "ValueError", "(", "'`pos` is an empty array.'", ")", "elif", "np", ".", "shape", "(", "arg_1", ")", "[", "1", "]", "!=", "3", ":", "raise", "ValueError", "(", "'`pos` must be an [N,3] element numpy.ndarray.'", ")", "arg_9", ",", "arg_3", "=", "_pick_state_im_name", "(", "''", ",", "arg_3", ",", "arg_6", "=", "arg_6", ")", "arg_10", "=", "util", ".", "RawImage", "(", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_11", "=", "arg_0", "(", "arg_10", ",", "arg_1", ",", "arg_2", ",", "**", "arg_7", ")", "RLOG", ".", "info", "(", "'State Created.'", ")", "if", "arg_5", "is", "not", "None", ":", "states", ".", "save", "(", "arg_11", ",", "arg_5", "=", "arg_5", "+", "'initial'", ")", "optimize_from_initial", "(", "arg_11", ",", "arg_5", "=", "arg_5", ",", "**", "arg_8", ")", "return", "arg_11"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,\n        arg_5='', arg_6=False, arg_7={}, **arg_8):\n    \"\"\"\n    Gets a completely-optimized state from an image and an initial guess of\n    particle positions and radii.\n\n    The state is periodically saved during optimization, with different\n    filename for different stages of the optimization. The user can select\n    the image.\n\n    Parameters\n    ----------\n        statemaker : Function\n            A statemaker function. Given arguments `im` (a\n            :class:`~peri.util.Image`), `pos` (numpy.ndarray), `rad` (ndarray),\n            and any additional `statemaker_kwargs`, must return a\n            :class:`~peri.states.ImageState`.  There is an example function in\n            scripts/statemaker_example.py\n        pos : [N,3] element numpy.ndarray.\n            The initial guess for the N particle positions.\n        rad : N element numpy.ndarray.\n            The initial guess for the N particle radii.\n        im_name : string or None, optional\n            The filename of the image to feature. Default is None, in which\n            the user selects the image.\n        tile : :class:`peri.util.Tile`, optional\n            A tile of the sub-region of the image to feature. Default is\n            None, i.e. entire image.\n        desc : String, optional\n            A description to be inserted in saved state. The save name will\n            be, e.g., '0.tif-peri-' + desc + 'initial-burn.pkl'. Default is ''\n        use_full_path : Bool, optional\n            Set to True to use the full path name for the image. Default\n            is False.\n        statemaker_kwargs : Dict, optional\n            kwargs-like dict of any additional keyword arguments to pass to\n            the statemaker function. Default is ``{}``.\n\n    Other Parameters\n    ----------------\n        max_mem : Numeric\n            The maximum additional memory to use for the optimizers, as\n            passed to optimize.burn. Default is 1e9.\n        min_rad : Float, optional\n            The minimum particle radius, as passed to addsubtract.add_subtract.\n            Particles with a fitted radius smaller than this are identified\n            as fake and removed. Default is 0.5 * actual_rad.\n        max_rad : Float, optional\n            The maximum particle radius, as passed to addsubtract.add_subtract.\n            Particles with a fitted radius larger than this are identified\n            as fake and removed. Default is 1.5 * actual_rad, however you\n            may find better results if you make this more stringent.\n        invert : {'guess', True, False}\n            Whether to invert the image for featuring, as passed to\n            addsubtract.add_subtract. Default is to guess from the\n            current state's particle positions.\n        rz_order : int, optional\n            If nonzero, the order of an additional augmented rscl(z)\n            parameter for optimization. Default is 0; i.e. no rscl(z)\n            optimization.\n        zscale : Float, optional\n            The zscale of the image. Default is 1.0\n\n    Returns\n    -------\n        s : :class:`peri.states.ImageState`\n            The optimized state.\n\n    See Also\n    --------\n        get_initial_featuring   : Features an image from scratch, using\n            centroid methods as initial particle locations.\n\n        get_particle_featuring  : Using a previous state's globals and\n            positions as an initial guess, completely optimizes a state.\n\n        translate_featuring     : Use a previous state's globals and\n            centroids methods for an initial particle guess, completely\n            optimizes a state.\n\n    Notes\n    -----\n    The ``Other Parameters`` are passed to _optimize_from_centroid.\n    Proceeds by centroid-featuring the image for an initial guess of\n    particle positions, then optimizing the globals + positions until\n    termination as called in _optimize_from_centroid.\n    \"\"\"\n    if np.size(arg_1) == 0:\n        raise ValueError('`pos` is an empty array.')\n    elif np.shape(arg_1)[1] != 3:\n        raise ValueError('`pos` must be an [N,3] element numpy.ndarray.')\n    arg_9,  arg_3 = _pick_state_im_name('', arg_3, arg_6=arg_6)\n    arg_10 = util.RawImage(arg_3, arg_4=arg_4)\n    arg_11 = arg_0(arg_10, arg_1, arg_2, **arg_7)\n    RLOG.info('State Created.')\n    if arg_5 is not None:\n        states.save(arg_11, arg_5=arg_5+'initial')\n    optimize_from_initial(arg_11, arg_5=arg_5, **arg_8)\n    return arg_11", "path": "peri/runner.py", "identifier": "feature_from_pos_rad", "docstring": "Gets a completely-optimized state from an image and an initial guess of\n    particle positions and radii.\n\n    The state is periodically saved during optimization, with different\n    filename for different stages of the optimization. The user can select\n    the image.\n\n    Parameters\n    ----------\n        statemaker : Function\n            A statemaker function. Given arguments `im` (a\n            :class:`~peri.util.Image`), `pos` (numpy.ndarray), `rad` (ndarray),\n            and any additional `statemaker_kwargs`, must return a\n            :class:`~peri.states.ImageState`.  There is an example function in\n            scripts/statemaker_example.py\n        pos : [N,3] element numpy.ndarray.\n            The initial guess for the N particle positions.\n        rad : N element numpy.ndarray.\n            The initial guess for the N particle radii.\n        im_name : string or None, optional\n            The filename of the image to feature. Default is None, in which\n            the user selects the image.\n        tile : :class:`peri.util.Tile`, optional\n            A tile of the sub-region of the image to feature. Default is\n            None, i.e. entire image.\n        desc : String, optional\n            A description to be inserted in saved state. The save name will\n            be, e.g., '0.tif-peri-' + desc + 'initial-burn.pkl'. Default is ''\n        use_full_path : Bool, optional\n            Set to True to use the full path name for the image. Default\n            is False.\n        statemaker_kwargs : Dict, optional\n            kwargs-like dict of any additional keyword arguments to pass to\n            the statemaker function. Default is ``{}``.\n\n    Other Parameters\n    ----------------\n        max_mem : Numeric\n            The maximum additional memory to use for the optimizers, as\n            passed to optimize.burn. Default is 1e9.\n        min_rad : Float, optional\n            The minimum particle radius, as passed to addsubtract.add_subtract.\n            Particles with a fitted radius smaller than this are identified\n            as fake and removed. Default is 0.5 * actual_rad.\n        max_rad : Float, optional\n            The maximum particle radius, as passed to addsubtract.add_subtract.\n            Particles with a fitted radius larger than this are identified\n            as fake and removed. Default is 1.5 * actual_rad, however you\n            may find better results if you make this more stringent.\n        invert : {'guess', True, False}\n            Whether to invert the image for featuring, as passed to\n            addsubtract.add_subtract. Default is to guess from the\n            current state's particle positions.\n        rz_order : int, optional\n            If nonzero, the order of an additional augmented rscl(z)\n            parameter for optimization. Default is 0; i.e. no rscl(z)\n            optimization.\n        zscale : Float, optional\n            The zscale of the image. Default is 1.0\n\n    Returns\n    -------\n        s : :class:`peri.states.ImageState`\n            The optimized state.\n\n    See Also\n    --------\n        get_initial_featuring   : Features an image from scratch, using\n            centroid methods as initial particle locations.\n\n        get_particle_featuring  : Using a previous state's globals and\n            positions as an initial guess, completely optimizes a state.\n\n        translate_featuring     : Use a previous state's globals and\n            centroids methods for an initial particle guess, completely\n            optimizes a state.\n\n    Notes\n    -----\n    The ``Other Parameters`` are passed to _optimize_from_centroid.\n    Proceeds by centroid-featuring the image for an initial guess of\n    particle positions, then optimizing the globals + positions until\n    termination as called in _optimize_from_centroid.", "docstring_tokens": ["Gets", "a", "completely", "-", "optimized", "state", "from", "an", "image", "and", "an", "initial", "guess", "of", "particle", "positions", "and", "radii", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260008}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/tv.py#L83-L99", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the content ratings for a TV Series.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the content ratings for a TV Series.\n\n        Args:\n            language: (optional) ISO 639 code.\n            append_to_response: (optional) Comma separated, any collection\n                                method.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/tv.py", "identifier": "TV.content_ratings", "docstring": "Get the content ratings for a TV Series.\n\n        Args:\n            language: (optional) ISO 639 code.\n            append_to_response: (optional) Comma separated, any collection\n                                method.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "content", "ratings", "for", "a", "TV", "Series", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 260009}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L631-L642", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "scan an ABF directory and subdirectory. Try to do this just once.\n    Returns ABF files, SWHLab files, and groups.", "language": "python", "parameters": "(abfFolder)", "return_statement": "return filesABF,filesSWH,groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", "arg_1", "=", "forwardSlash", "(", "sorted", "(", "glob", ".", "glob", "(", "arg_0", "+", "\"/*.*\"", ")", ")", ")", "arg_2", "=", "[", "]", "if", "os", ".", "path", ".", "exists", "(", "arg_0", "+", "\"/swhlab4/\"", ")", ":", "arg_2", "=", "forwardSlash", "(", "sorted", "(", "glob", ".", "glob", "(", "arg_0", "+", "\"/swhlab4/*.*\"", ")", ")", ")", "arg_3", "=", "getABFgroups", "(", "arg_1", ")", "return", "arg_1", ",", "arg_2", ",", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    scan an ABF directory and subdirectory. Try to do this just once.\n    Returns ABF files, SWHLab files, and groups.\n    \"\"\"\n    assert os.path.isdir(arg_0)\n    arg_1=forwardSlash(sorted(glob.glob(arg_0+\"/*.*\")))\n    arg_2=[]\n    if os.path.exists(arg_0+\"/swhlab4/\"):\n        arg_2=forwardSlash(sorted(glob.glob(arg_0+\"/swhlab4/*.*\")))\n    arg_3=getABFgroups(arg_1)\n    return arg_1,arg_2,arg_3", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "scanABFfolder", "docstring": "scan an ABF directory and subdirectory. Try to do this just once.\n    Returns ABF files, SWHLab files, and groups.", "docstring_tokens": ["scan", "an", "ABF", "directory", "and", "subdirectory", ".", "Try", "to", "do", "this", "just", "once", ".", "Returns", "ABF", "files", "SWHLab", "files", "and", "groups", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 260010}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1114-L1124", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Ensure all directories are created for a given target file.", "language": "python", "parameters": "(self, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "if", "arg_2", "and", "arg_2", "!=", "PATH_SEP", "and", "not", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "try", ":", "os", ".", "makedirs", "(", "arg_2", ")", "except", "OSError", "as", "ose", ":", "if", "ose", ".", "errno", "!=", "errno", ".", "EEXIST", ":", "raise", "Failure", "(", "'Unable to create directory (%s)'", "%", "(", "arg_2", ",", ")", ")"], "function": "def Func(arg_0, arg_1):\n    '''Ensure all directories are created for a given target file.'''\n    arg_2 = os.path.dirname(arg_1)\n    if arg_2 and arg_2 != PATH_SEP and not os.path.isdir(arg_2):\n      # Multi-threading means there will be intervleaved execution\n      # between the check and creation of the directory.\n      try:\n        os.makedirs(arg_2)\n      except OSError as ose:\n        if ose.errno != errno.EEXIST:\n          raise Failure('Unable to create directory (%s)' % (arg_2,))", "path": "s4cmd.py", "identifier": "ThreadUtil.mkdirs", "docstring": "Ensure all directories are created for a given target file.", "docstring_tokens": ["Ensure", "all", "directories", "are", "created", "for", "a", "given", "target", "file", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260011}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/base64.py#L308-L315", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Decode a file.", "language": "python", "parameters": "(input, output)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "while", "True", ":", "arg_2", "=", "arg_0", ".", "readline", "(", ")", "if", "not", "arg_2", ":", "break", "arg_3", "=", "binascii", ".", "a2b_base64", "(", "arg_2", ")", "arg_1", ".", "write", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Decode a file.\"\"\"\n    while True:\n        arg_2 = arg_0.readline()\n        if not arg_2:\n            break\n        arg_3 = binascii.a2b_base64(arg_2)\n        arg_1.write(arg_3)", "path": "third_party/stdlib/base64.py", "identifier": "decode", "docstring": "Decode a file.", "docstring_tokens": ["Decode", "a", "file", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 260012}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/node.py#L398-L405", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "in reversed order", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "while", "arg_1", "is", "not", "None", ":", "yield", "arg_1", ".", "data", "arg_1", "=", "arg_1", ".", "prev"], "function": "def Func(arg_0):\n        \"\"\" \n        in reversed order\n        \"\"\"\n        arg_1 = arg_0\n        while arg_1 is not None:\n            yield arg_1.data\n            arg_1 = arg_1.prev", "path": "pyrser/parsing/node.py", "identifier": "ListNodeItem.rvalues", "docstring": "in reversed order", "docstring_tokens": ["in", "reversed", "order"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 260013}
{"url": "https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L210-L254", "sha": "bb296cac7c3dd289908906b7069bd80f43950515", "docstring_summary": "Access the spotify search functionality.", "language": "python", "parameters": "(self, q: str, *, types: Optional[Iterable[str]] = ['track', 'playlist', 'artist', 'album'], limit: Optional[int] = 20, offset: Optional[int] = 0, market: Optional[str] = None)", "return_statement": "return {key: [_TYPES[obj['type']](self, obj) for obj in value['items']] for key, value in data.items()}", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "*", ",", "arg_3", ":", "arg_4", "[", "arg_5", "[", "arg_2", "]", "]", "=", "[", "'track'", ",", "'playlist'", ",", "'artist'", ",", "'album'", "]", ",", "arg_6", ":", "arg_4", "[", "arg_7", "]", "=", "20", ",", "arg_8", ":", "arg_4", "[", "arg_7", "]", "=", "0", ",", "arg_9", ":", "arg_4", "[", "arg_2", "]", "=", "None", ")", "->", "Dict", "[", "arg_2", ",", "List", "[", "Union", "[", "Track", ",", "Playlist", ",", "Artist", ",", "Album", "]", "]", "]", ":", "if", "not", "hasattr", "(", "arg_3", ",", "'__iter__'", ")", ":", "raise", "TypeError", "(", "'types must be an iterable.'", ")", "elif", "not", "isinstance", "(", "arg_3", ",", "list", ")", ":", "arg_3", "=", "list", "(", "item", "for", "item", "in", "arg_3", ")", "arg_10", "=", "set", "(", "arg_3", ")", "if", "not", "arg_10", ".", "issubset", "(", "_SEARCH_TYPES", ")", ":", "raise", "ValueError", "(", "_SEARCH_TYPE_ERR", "%", "arg_10", ".", "difference", "(", "_SEARCH_TYPES", ")", ".", "pop", "(", ")", ")", "arg_11", "=", "{", "'q'", ":", "arg_1", ".", "replace", "(", "' '", ",", "'+'", ")", ",", "'queary_type'", ":", "','", ".", "join", "(", "tp", ".", "strip", "(", ")", "for", "tp", "in", "arg_3", ")", ",", "'market'", ":", "arg_9", ",", "'limit'", ":", "arg_6", ",", "'offset'", ":", "arg_8", "}", "arg_12", "=", "await", "arg_0", ".", "http", ".", "Func", "(", "**", "arg_11", ")", "return", "{", "arg_14", ":", "[", "_TYPES", "[", "arg_13", "[", "'type'", "]", "]", "(", "arg_0", ",", "arg_13", ")", "for", "arg_13", "in", "arg_15", "[", "'items'", "]", "]", "for", "arg_14", ",", "arg_15", "in", "arg_12", ".", "items", "(", ")", "}"], "function": "async def Func(arg_0, arg_1: arg_2, *, arg_3: arg_4[arg_5[arg_2]] = ['track', 'playlist', 'artist', 'album'], arg_6: arg_4[arg_7] = 20, arg_8: arg_4[arg_7] = 0, arg_9: arg_4[arg_2] = None) -> Dict[arg_2, List[Union[Track, Playlist, Artist, Album]]]:\n        \"\"\"Access the spotify Func functionality.\n\n        Parameters\n        ----------\n        q : str\n            the Func query\n        types : Optional[Iterable[str]]\n            A sequence of Func types (can be any of `track`, `playlist`, `artist` or `album`) to refine the Func request.\n            A `ValueError` may be raised if a Func type is found that is not valid.\n        limit : Optional[int]\n            The limit of Func results to return when Funcing.\n            Maximum limit is 50, any larger may raise a :class:`HTTPException`\n        offset : Optional[int]\n            The offset from where the api should start from in the Func results.\n        market : Optional[str]\n            An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.\n\n        Returns\n        -------\n        results : Dict[str, List[Union[Track, Playlist, Artist, Album]]]\n            The results of the Func.\n        \"\"\"\n        if not hasattr(arg_3, '__iter__'):\n            raise TypeError('types must be an iterable.')\n\n        elif not isinstance(arg_3, list):\n            arg_3 = list(item for item in arg_3)\n\n        arg_10 = set(arg_3)\n\n        if not arg_10.issubset(_SEARCH_TYPES):\n            raise ValueError(_SEARCH_TYPE_ERR % arg_10.difference(_SEARCH_TYPES).pop())\n\n        arg_11 = {\n            'q': arg_1.replace(' ', '+'),\n            'queary_type': ','.join(tp.strip() for tp in arg_3),\n            'market': arg_9,\n            'limit': arg_6,\n            'offset': arg_8\n        }\n\n        arg_12 = await arg_0.http.Func(**arg_11)\n\n        return {arg_14: [_TYPES[arg_13['type']](arg_0, arg_13) for arg_13 in arg_15['items']] for arg_14, arg_15 in arg_12.items()}", "path": "spotify/client.py", "identifier": "Client.search", "docstring": "Access the spotify search functionality.\n\n        Parameters\n        ----------\n        q : str\n            the search query\n        types : Optional[Iterable[str]]\n            A sequence of search types (can be any of `track`, `playlist`, `artist` or `album`) to refine the search request.\n            A `ValueError` may be raised if a search type is found that is not valid.\n        limit : Optional[int]\n            The limit of search results to return when searching.\n            Maximum limit is 50, any larger may raise a :class:`HTTPException`\n        offset : Optional[int]\n            The offset from where the api should start from in the search results.\n        market : Optional[str]\n            An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.\n\n        Returns\n        -------\n        results : Dict[str, List[Union[Track, Playlist, Artist, Album]]]\n            The results of the search.", "docstring_tokens": ["Access", "the", "spotify", "search", "functionality", "."], "nwo": "mental32/spotify.py", "score": 0.737896797033901, "idx": 260014}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/annotate.py#L250-L276", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Mark a function as callable from the command line.", "language": "python", "parameters": "(func, name=None)", "return_statement": "return func", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'metadata'", ")", ":", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "metadata", "=", "AnnotatedMetadata", "(", "arg_0", ",", "arg_1", ")", "return", "arg_0", "arg_0", ".", "metadata", "=", "AnnotatedMetadata", "(", "arg_0", ",", "arg_1", ")", "arg_0", ".", "finalizer", "=", "False", "arg_0", ".", "takes_cmdline", "=", "False", "arg_0", ".", "decorated", "=", "False", "arg_0", ".", "context", "=", "False", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Mark a function as callable from the command line.\n\n    This function is meant to be called as decorator.  This function\n    also initializes metadata about the function's arguments that is\n    built up by the param decorator.\n\n    Args:\n        func (callable): The function that we wish to mark as callable\n            from the command line.\n        name (str): Optional string that will override the function's\n            built-in name.\n    \"\"\"\n\n    if hasattr(arg_0, 'metadata'):\n        if arg_1 is not None:\n            arg_0.metadata = AnnotatedMetadata(arg_0, arg_1)\n        return arg_0\n\n    arg_0.metadata = AnnotatedMetadata(arg_0, arg_1)\n\n    arg_0.finalizer = False\n    arg_0.takes_cmdline = False\n    arg_0.decorated = False\n    arg_0.context = False\n\n    return arg_0", "path": "typedargs/annotate.py", "identifier": "annotated", "docstring": "Mark a function as callable from the command line.\n\n    This function is meant to be called as decorator.  This function\n    also initializes metadata about the function's arguments that is\n    built up by the param decorator.\n\n    Args:\n        func (callable): The function that we wish to mark as callable\n            from the command line.\n        name (str): Optional string that will override the function's\n            built-in name.", "docstring_tokens": ["Mark", "a", "function", "as", "callable", "from", "the", "command", "line", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 260015}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/boids/__init__.py#L253-L323", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Calculates the next motion frame for the flock.", "language": "python", "parameters": "(self, \n               shuffled=True, \n               cohesion=100, \n               separation=10, \n               alignment=5, \n               goal=20,\n               limit=30)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "100", ",", "arg_3", "=", "10", ",", "arg_4", "=", "5", ",", "arg_5", "=", "20", ",", "arg_6", "=", "30", ")", ":", "from", "random", "import", "shuffle", "if", "arg_1", ":", "shuffle", "(", "arg_0", ")", "arg_7", "=", "1.0", "arg_8", "=", "1.0", "arg_9", "=", "1.0", "arg_10", "=", "1.0", "if", "not", "arg_0", ".", "scattered", "and", "_ctx", ".", "random", "(", ")", "<", "arg_0", ".", "_scatter", ":", "arg_0", ".", "scattered", "=", "True", "if", "arg_0", ".", "scattered", ":", "arg_7", "=", "-", "arg_7", "arg_9", "*=", "0.25", "arg_0", ".", "_scatter_i", "+=", "1", "if", "arg_0", ".", "_scatter_i", ">=", "arg_0", ".", "_scatter_t", ":", "arg_0", ".", "scattered", "=", "False", "arg_0", ".", "_scatter_i", "=", "0", "if", "not", "arg_0", ".", "has_goal", ":", "arg_10", "=", "0", "if", "arg_0", ".", "flee", ":", "arg_10", "=", "-", "arg_10", "for", "arg_13", "in", "arg_0", ":", "if", "arg_13", ".", "is_perching", ":", "if", "arg_13", ".", "_perch_t", ">", "0", ":", "arg_13", ".", "_perch_t", "-=", "1", "continue", "else", ":", "arg_13", ".", "is_perching", "=", "False", "arg_15", ",", "arg_16", ",", "arg_17", "=", "arg_13", ".", "cohesion", "(", "arg_2", ")", "arg_18", ",", "arg_19", ",", "arg_20", "=", "arg_13", ".", "separation", "(", "arg_3", ")", "arg_21", ",", "arg_22", ",", "arg_23", "=", "arg_13", ".", "alignment", "(", "arg_4", ")", "arg_24", ",", "arg_25", ",", "arg_26", "=", "arg_13", ".", "goal", "(", "arg_0", ".", "_gx", ",", "arg_0", ".", "_gy", ",", "arg_0", ".", "_gz", ",", "arg_5", ")", "arg_13", ".", "vx", "+=", "arg_7", "*", "arg_15", "+", "arg_8", "*", "arg_18", "+", "arg_9", "*", "arg_21", "+", "arg_10", "*", "arg_24", "arg_13", ".", "vy", "+=", "arg_7", "*", "arg_16", "+", "arg_8", "*", "arg_19", "+", "arg_9", "*", "arg_22", "+", "arg_10", "*", "arg_25", "arg_13", ".", "vz", "+=", "arg_7", "*", "arg_17", "+", "arg_8", "*", "arg_20", "+", "arg_9", "*", "arg_23", "+", "arg_10", "*", "arg_26", "arg_13", ".", "limit", "(", "arg_6", ")", "arg_13", ".", "x", "+=", "arg_13", ".", "vx", "arg_13", ".", "y", "+=", "arg_13", ".", "vy", "arg_13", ".", "z", "+=", "arg_13", ".", "vz", "arg_0", ".", "constrain", "(", ")"], "function": "def Func(arg_0, \n               arg_1=True, \n               arg_2=100, \n               arg_3=10, \n               arg_4=5, \n               arg_5=20,\n               arg_6=30):\n        \n        \"\"\" Calculates the next motion frame for the flock.\n        \"\"\"\n        \n        # Shuffling the list of boids ensures fluid movement.\n        # If you need the boids to retain their position in the list\n        # each Func, set the shuffled parameter to False.\n        from random import shuffle\n        if arg_1: shuffle(arg_0)\n        \n        arg_7 = 1.0 # cohesion\n        arg_8 = 1.0 # separation\n        arg_9 = 1.0 # alignment\n        arg_10 = 1.0 # goal\n        \n        # The flock scatters randomly with a Boids.scatter chance.\n        # This means their cohesion (m1) is reversed,\n        # and their joint alignment (m3) is dimished,\n        # causing boids to oscillate in confusion.\n        # Setting Boids.scatter(chance=0) ensures they never scatter.\n        if not arg_0.scattered and _ctx.random() < arg_0._scatter:\n            arg_0.scattered = True\n        if arg_0.scattered:\n            arg_7 = -arg_7\n            arg_9 *= 0.25\n            arg_0._scatter_i += 1\n        if arg_0._scatter_i >= arg_0._scatter_t:\n            arg_0.scattered = False\n            arg_0._scatter_i = 0\n\n        # A flock can have a goal defined with Boids.goal(x,y,z),\n        # a place of interest to flock around.\n        if not arg_0.has_goal:\n            arg_10 = 0\n        if arg_0.flee:\n            arg_10 = -arg_10\n        \n        for arg_13 in arg_0:\n            \n            # A boid that is perching will continue to do so\n            # until Boid._perch_t reaches zero.\n            if arg_13.is_perching:\n                if arg_13._perch_t > 0:\n                    arg_13._perch_t -= 1\n                    continue\n                else:\n                    arg_13.is_perching = False\n            \n            arg_15, arg_16, arg_17 = arg_13.cohesion(arg_2)\n            arg_18, arg_19, arg_20 = arg_13.separation(arg_3)\n            arg_21, arg_22, arg_23 = arg_13.alignment(arg_4)\n            arg_24, arg_25, arg_26 = arg_13.goal(arg_0._gx, arg_0._gy, arg_0._gz, arg_5)\n            \n            arg_13.vx += arg_7*arg_15 + arg_8*arg_18 + arg_9*arg_21 + arg_10*arg_24\n            arg_13.vy += arg_7*arg_16 + arg_8*arg_19 + arg_9*arg_22 + arg_10*arg_25\n            arg_13.vz += arg_7*arg_17 + arg_8*arg_20 + arg_9*arg_23 + arg_10*arg_26\n            \n            arg_13.limit(arg_6)\n        \n            arg_13.x += arg_13.vx\n            arg_13.y += arg_13.vy\n            arg_13.z += arg_13.vz\n        \n        arg_0.constrain()", "path": "lib/boids/__init__.py", "identifier": "Boids.update", "docstring": "Calculates the next motion frame for the flock.", "docstring_tokens": ["Calculates", "the", "next", "motion", "frame", "for", "the", "flock", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260016}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L659-L680", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Return bounds range values from geolocated input.", "language": "python", "parameters": "(out_bounds=None, in_affine=None, in_shape=None)", "return_statement": "return itertools.chain(\n        *from_bounds(\n            *out_bounds, transform=in_affine, height=in_shape[-2], width=in_shape[-1]\n        ).round_lengths(pixel_precision=0).round_offsets(pixel_precision=0).toranges()\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "return", "itertools", ".", "chain", "(", "*", "from_bounds", "(", "*", "arg_0", ",", "transform", "=", "arg_1", ",", "height", "=", "arg_2", "[", "-", "2", "]", ",", "width", "=", "arg_2", "[", "-", "1", "]", ")", ".", "round_lengths", "(", "pixel_precision", "=", "0", ")", ".", "round_offsets", "(", "pixel_precision", "=", "0", ")", ".", "toranges", "(", ")", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None):\n    \"\"\"\n    Return bounds range values from geolocated input.\n\n    Parameters\n    ----------\n    out_bounds : tuple\n        left, bottom, right, top\n    in_affine : Affine\n        input geolocation\n    in_shape : tuple\n        input shape\n\n    Returns\n    -------\n    minrow, maxrow, mincol, maxcol\n    \"\"\"\n    return itertools.chain(\n        *from_bounds(\n            *arg_0, transform=arg_1, height=arg_2[-2], width=arg_2[-1]\n        ).round_lengths(pixel_precision=0).round_offsets(pixel_precision=0).toranges()\n    )", "path": "mapchete/io/raster.py", "identifier": "bounds_to_ranges", "docstring": "Return bounds range values from geolocated input.\n\n    Parameters\n    ----------\n    out_bounds : tuple\n        left, bottom, right, top\n    in_affine : Affine\n        input geolocation\n    in_shape : tuple\n        input shape\n\n    Returns\n    -------\n    minrow, maxrow, mincol, maxcol", "docstring_tokens": ["Return", "bounds", "range", "values", "from", "geolocated", "input", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 260017}
{"url": "https://github.com/20tab/twentytab-treeeditor/blob/f89d459b1348961880cd488df95690e68529f96b/treeeditor/admin.py#L350-L361", "sha": "f89d459b1348961880cd488df95690e68529f96b", "docstring_summary": "Implement a lookup for object level permissions. Basically the same as\n        ModelAdmin.has_change_permission, but also passes the obj parameter in.", "language": "python", "parameters": "(self, request, obj=None)", "return_statement": "return r and super(TreeEditor, self).has_change_permission(request, obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "settings", ".", "TREE_EDITOR_OBJECT_PERMISSIONS", ":", "arg_3", "=", "arg_0", ".", "opts", "arg_4", "=", "arg_1", ".", "user", ".", "has_perm", "(", "arg_3", ".", "app_label", "+", "'.'", "+", "arg_3", ".", "get_change_permission", "(", ")", ",", "arg_2", ")", "else", ":", "arg_4", "=", "True", "return", "arg_4", "and", "super", "(", "TreeEditor", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Implement a lookup for object level permissions. Basically the same as\n        ModelAdmin.Func, but also passes the obj parameter in.\n        \"\"\"\n        if settings.TREE_EDITOR_OBJECT_PERMISSIONS:\n            arg_3 = arg_0.opts\n            arg_4 = arg_1.user.has_perm(arg_3.app_label + '.' + arg_3.get_change_permission(), arg_2)\n        else:\n            arg_4 = True\n\n        return arg_4 and super(TreeEditor, arg_0).Func(arg_1, arg_2)", "path": "treeeditor/admin.py", "identifier": "TreeEditor.has_change_permission", "docstring": "Implement a lookup for object level permissions. Basically the same as\n        ModelAdmin.has_change_permission, but also passes the obj parameter in.", "docstring_tokens": ["Implement", "a", "lookup", "for", "object", "level", "permissions", ".", "Basically", "the", "same", "as", "ModelAdmin", ".", "has_change_permission", "but", "also", "passes", "the", "obj", "parameter", "in", "."], "nwo": "20tab/twentytab-treeeditor", "score": 0.0, "idx": 260018}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L240-L245", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Substitute constants in expression unless it is already a number.", "language": "python", "parameters": "(self, expr)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "numbers", ".", "Number", ")", ":", "return", "arg_1", "else", ":", "return", "arg_1", ".", "subs", "(", "arg_0", ".", "constants", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Substitute constants in expression unless it is already a number.\"\"\"\n        if isinstance(arg_1, numbers.Number):\n            return arg_1\n        else:\n            return arg_1.subs(arg_0.constants)", "path": "kerncraft/kernel.py", "identifier": "Kernel.subs_consts", "docstring": "Substitute constants in expression unless it is already a number.", "docstring_tokens": ["Substitute", "constants", "in", "expression", "unless", "it", "is", "already", "a", "number", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 260019}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/util.py#L165-L180", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Determines whether or not the target string matches any of the regular\n    expressions specified.", "language": "python", "parameters": "(target, masks)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", ".", "search", "(", "arg_0", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Determines whether or not the target string matches any of the regular\n    expressions specified.\n\n    :param target: the string to check\n    :type target: str\n    :param masks: the regular expressions to check against\n    :type masks: list(regular expression object)\n    :returns: bool\n    \"\"\"\n\n    for arg_2 in arg_1:\n        if arg_2.search(arg_0):\n            return True\n    return False", "path": "src/tidypy/util.py", "identifier": "matches_masks", "docstring": "Determines whether or not the target string matches any of the regular\n    expressions specified.\n\n    :param target: the string to check\n    :type target: str\n    :param masks: the regular expressions to check against\n    :type masks: list(regular expression object)\n    :returns: bool", "docstring_tokens": ["Determines", "whether", "or", "not", "the", "target", "string", "matches", "any", "of", "the", "regular", "expressions", "specified", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 260020}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L1062-L1072", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Adds a new extracted license to the document.\n        Raises SPDXValueError if data format is incorrect.", "language": "python", "parameters": "(self, doc, lic_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "reset_extr_lics", "(", ")", "if", "validations", ".", "validate_extracted_lic_id", "(", "arg_2", ")", ":", "arg_1", ".", "add_extr_lic", "(", "document", ".", "ExtractedLicense", "(", "arg_2", ")", ")", "return", "True", "else", ":", "raise", "SPDXValueError", "(", "'ExtractedLicense::id'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Adds a new extracted license to the document.\n        Raises SPDXValueError if data format is incorrect.\n        \"\"\"\n        # FIXME: this state does not make sense\n        arg_0.reset_extr_lics()\n        if validations.validate_extracted_lic_id(arg_2):\n            arg_1.add_extr_lic(document.ExtractedLicense(arg_2))\n            return True\n        else:\n            raise SPDXValueError('ExtractedLicense::id')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "LicenseBuilder.set_lic_id", "docstring": "Adds a new extracted license to the document.\n        Raises SPDXValueError if data format is incorrect.", "docstring_tokens": ["Adds", "a", "new", "extracted", "license", "to", "the", "document", ".", "Raises", "SPDXValueError", "if", "data", "format", "is", "incorrect", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 260021}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L895-L910", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Update repository from its remote.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "'git'", ",", "'fetch'", ",", "'origin'", ",", "'+refs/heads/*:refs/heads/*'", ",", "'--prune'", "]", "arg_0", ".", "_exec", "(", "arg_1", ",", "cwd", "=", "arg_0", ".", "dirpath", ",", "env", "=", "arg_0", ".", "gitenv", ")", "logger", ".", "debug", "(", "\"Git %s repository Funcd into %s\"", ",", "arg_0", ".", "uri", ",", "arg_0", ".", "dirpath", ")"], "function": "def Func(arg_0):\n        \"\"\"Update repository from its remote.\n\n        Calling this method, the repository will be synchronized with\n        the remote repository using 'fetch' command for 'heads' refs.\n        Any commit stored in the local copy will be removed; refs\n        will be overwritten.\n\n        :raises RepositoryError: when an error occurs updating the\n            repository\n        \"\"\"\n        arg_1 = ['git', 'fetch', 'origin', '+refs/heads/*:refs/heads/*', '--prune']\n        arg_0._exec(arg_1, cwd=arg_0.dirpath, env=arg_0.gitenv)\n\n        logger.debug(\"Git %s repository Funcd into %s\",\n                     arg_0.uri, arg_0.dirpath)", "path": "perceval/backends/core/git.py", "identifier": "GitRepository.update", "docstring": "Update repository from its remote.\n\n        Calling this method, the repository will be synchronized with\n        the remote repository using 'fetch' command for 'heads' refs.\n        Any commit stored in the local copy will be removed; refs\n        will be overwritten.\n\n        :raises RepositoryError: when an error occurs updating the\n            repository", "docstring_tokens": ["Update", "repository", "from", "its", "remote", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260022}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1472-L1502", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "numba compiled code to get matrix fast.\n    arr is a 4 x N seq matrix converted to np.int8\n    I convert the numbers for ATGC into their respective index for the MAT\n    matrix, and leave all others as high numbers, i.e., -==45, N==78.", "language": "python", "parameters": "(narr, mapcol, nmask)", "return_statement": "return mats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_10", ".", "zeros", "(", "(", "3", ",", "16", ",", "16", ")", ",", "dtype", "=", "arg_10", ".", "uint32", ")", "arg_4", "=", "-", "1", "for", "arg_5", "in", "xrange", "(", "arg_1", ".", "shape", "[", "0", "]", ")", ":", "if", "not", "arg_2", "[", "arg_5", "]", ":", "if", "not", "arg_1", "[", "arg_5", "]", "==", "arg_4", ":", "arg_6", "=", "arg_0", "[", ":", ",", "arg_5", "]", "arg_3", "[", "0", ",", "(", "4", "*", "arg_6", "[", "0", "]", ")", "+", "arg_6", "[", "1", "]", ",", "(", "4", "*", "arg_6", "[", "2", "]", ")", "+", "arg_6", "[", "3", "]", "]", "+=", "1", "arg_4", "=", "arg_1", "[", "arg_5", "]", "arg_7", "=", "arg_10", ".", "uint8", "(", "0", ")", "for", "arg_8", "in", "arg_10", ".", "array", "(", "[", "0", ",", "4", ",", "8", ",", "12", "]", ",", "dtype", "=", "arg_10", ".", "uint8", ")", ":", "for", "arg_9", "in", "arg_10", ".", "array", "(", "[", "0", ",", "4", ",", "8", ",", "12", "]", ",", "dtype", "=", "arg_10", ".", "uint8", ")", ":", "arg_3", "[", "1", ",", "arg_8", ":", "arg_8", "+", "arg_10", ".", "uint8", "(", "4", ")", ",", "arg_9", ":", "arg_9", "+", "arg_10", ".", "uint8", "(", "4", ")", "]", "=", "arg_3", "[", "0", ",", "arg_7", "]", ".", "reshape", "(", "4", ",", "4", ")", "arg_3", "[", "2", ",", "arg_8", ":", "arg_8", "+", "arg_10", ".", "uint8", "(", "4", ")", ",", "arg_9", ":", "arg_9", "+", "arg_10", ".", "uint8", "(", "4", ")", "]", "=", "arg_3", "[", "0", ",", "arg_7", "]", ".", "reshape", "(", "4", ",", "4", ")", ".", "T", "arg_7", "+=", "arg_10", ".", "uint8", "(", "1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" \n    numba compiled code to get matrix fast.\n    arr is a 4 x N seq matrix converted to np.int8\n    I convert the numbers for ATGC into their respective index for the MAT\n    matrix, and leave all others as high numbers, i.e., -==45, N==78. \n    \"\"\"\n\n    ## get seq alignment and create an empty array for filling\n    arg_3 = arg_10.zeros((3, 16, 16), dtype=arg_10.uint32)\n\n    ## replace ints with small ints that index their place in the \n    ## 16x16. This no longer checks for big ints to exclude, so resolve=True\n    ## is now the default, TODO. \n    arg_4 = -1\n    for arg_5 in xrange(arg_1.shape[0]):\n        if not arg_2[arg_5]:\n            if not arg_1[arg_5] == arg_4:\n                arg_6 = arg_0[:, arg_5]\n                arg_3[0, (4*arg_6[0])+arg_6[1], (4*arg_6[2])+arg_6[3]] += 1      \n                arg_4 = arg_1[arg_5]\n\n    ## fill the alternates\n    arg_7 = arg_10.uint8(0)\n    for arg_8 in arg_10.array([0, 4, 8, 12], dtype=arg_10.uint8):\n        for arg_9 in arg_10.array([0, 4, 8, 12], dtype=arg_10.uint8):\n            arg_3[1, arg_8:arg_8+arg_10.uint8(4), arg_9:arg_9+arg_10.uint8(4)] = arg_3[0, arg_7].reshape(4, 4)\n            arg_3[2, arg_8:arg_8+arg_10.uint8(4), arg_9:arg_9+arg_10.uint8(4)] = arg_3[0, arg_7].reshape(4, 4).T\n            arg_7 += arg_10.uint8(1)\n\n    return arg_3", "path": "ipyrad/analysis/tetrad.py", "identifier": "chunk_to_matrices", "docstring": "numba compiled code to get matrix fast.\n    arr is a 4 x N seq matrix converted to np.int8\n    I convert the numbers for ATGC into their respective index for the MAT\n    matrix, and leave all others as high numbers, i.e., -==45, N==78.", "docstring_tokens": ["numba", "compiled", "code", "to", "get", "matrix", "fast", ".", "arr", "is", "a", "4", "x", "N", "seq", "matrix", "converted", "to", "np", ".", "int8", "I", "convert", "the", "numbers", "for", "ATGC", "into", "their", "respective", "index", "for", "the", "MAT", "matrix", "and", "leave", "all", "others", "as", "high", "numbers", "i", ".", "e", ".", "-", "==", "45", "N", "==", "78", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 260023}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L1979-L2007", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks if the executor agrees with the state of task instances\n        that are running", "language": "python", "parameters": "(self, running)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "executor", "for", "arg_3", ",", "arg_4", "in", "list", "(", "arg_2", ".", "get_event_buffer", "(", ")", ".", "items", "(", ")", ")", ":", "if", "arg_3", "not", "in", "arg_1", ":", "arg_0", ".", "log", ".", "warning", "(", "\"%s state %s not in running=%s\"", ",", "arg_3", ",", "arg_4", ",", "arg_1", ".", "values", "(", ")", ")", "continue", "arg_5", "=", "arg_1", "[", "arg_3", "]", "arg_5", ".", "refresh_from_db", "(", ")", "arg_0", ".", "log", ".", "debug", "(", "\"Executor state: %s task %s\"", ",", "arg_4", ",", "arg_5", ")", "if", "arg_4", "==", "State", ".", "FAILED", "or", "arg_4", "==", "State", ".", "SUCCESS", ":", "if", "arg_5", ".", "state", "==", "State", ".", "RUNNING", "or", "arg_5", ".", "state", "==", "State", ".", "QUEUED", ":", "arg_6", "=", "(", "\"Executor reports task instance {} finished ({}) \"", "\"although the task says its {}. Was the task \"", "\"killed externally?\"", ".", "format", "(", "arg_5", ",", "arg_4", ",", "arg_5", ".", "state", ")", ")", "arg_0", ".", "log", ".", "error", "(", "arg_6", ")", "arg_5", ".", "handle_failure", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Checks if the executor agrees with the state of task instances\n        that are running\n\n        :param running: dict of key, task to verify\n        \"\"\"\n        arg_2 = arg_0.executor\n\n        for arg_3, arg_4 in list(arg_2.get_event_buffer().items()):\n            if arg_3 not in arg_1:\n                arg_0.log.warning(\n                    \"%s state %s not in running=%s\",\n                    arg_3, arg_4, arg_1.values()\n                )\n                continue\n\n            arg_5 = arg_1[arg_3]\n            arg_5.refresh_from_db()\n\n            arg_0.log.debug(\"Executor state: %s task %s\", arg_4, arg_5)\n\n            if arg_4 == State.FAILED or arg_4 == State.SUCCESS:\n                if arg_5.state == State.RUNNING or arg_5.state == State.QUEUED:\n                    arg_6 = (\"Executor reports task instance {} finished ({}) \"\n                           \"although the task says its {}. Was the task \"\n                           \"killed externally?\".format(arg_5, arg_4, arg_5.state))\n                    arg_0.log.error(arg_6)\n                    arg_5.handle_failure(arg_6)", "path": "airflow/jobs.py", "identifier": "BackfillJob._manage_executor_state", "docstring": "Checks if the executor agrees with the state of task instances\n        that are running\n\n        :param running: dict of key, task to verify", "docstring_tokens": ["Checks", "if", "the", "executor", "agrees", "with", "the", "state", "of", "task", "instances", "that", "are", "running"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260024}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L55-L59", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Print, emphasized 'neutral', the given 'txt' message", "language": "python", "parameters": "(txt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "\"%s# %s%s%s\"", "%", "(", "PR_EMPH_CC", ",", "get_time_stamp", "(", ")", ",", "arg_0", ",", "PR_NC", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Print, emphasized 'neutral', the given 'txt' message\"\"\"\n\n    print(\"%s# %s%s%s\" % (PR_EMPH_CC, get_time_stamp(), arg_0, PR_NC))\n    sys.stdout.flush()", "path": "modules/cij/__init__.py", "identifier": "info", "docstring": "Print, emphasized 'neutral', the given 'txt' message", "docstring_tokens": ["Print", "emphasized", "neutral", "the", "given", "txt", "message"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 260025}
{"url": "https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/cryptfile.py#L38-L58", "sha": "cfa80d4848a5c3c0aeee41a954b2b120c80e69b2", "docstring_summary": "Create the cipher object to encrypt or decrypt a payload.", "language": "python", "parameters": "(self, password, salt, nonce = None)", "return_statement": "return AES.new(key, aesmode, nonce)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "from", "argon2", ".", "low_level", "import", "hash_secret_raw", ",", "Type", "from", "Crypto", ".", "Cipher", "import", "AES", "arg_4", "=", "arg_0", ".", "_get_mode", "(", "arg_0", ".", "aesmode", ")", "if", "arg_4", "is", "None", ":", "raise", "ValueError", "(", "'invalid AES mode: %s'", "%", "arg_0", ".", "aesmode", ")", "arg_5", "=", "hash_secret_raw", "(", "secret", "=", "arg_1", ".", "encode", "(", "arg_0", ".", "password_encoding", ")", ",", "arg_2", "=", "arg_2", ",", "time_cost", "=", "arg_0", ".", "time_cost", ",", "memory_cost", "=", "arg_0", ".", "memory_cost", ",", "parallelism", "=", "arg_0", ".", "parallelism", ",", "hash_len", "=", "16", ",", "type", "=", "Type", ".", "ID", ")", "return", "AES", ".", "new", "(", "arg_5", ",", "arg_4", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3 = None):\n        \"\"\"\n        Create the cipher object to encrypt or decrypt a payload.\n        \"\"\"\n        from argon2.low_level import hash_secret_raw, Type\n        from Crypto.Cipher import AES\n\n        arg_4 = arg_0._get_mode(arg_0.aesmode)\n        if arg_4 is None:     # pragma: no cover\n            raise ValueError('invalid AES mode: %s' % arg_0.aesmode)\n\n        arg_5 = hash_secret_raw(\n            secret = arg_1.encode(arg_0.password_encoding),\n            arg_2 = arg_2,\n            time_cost = arg_0.time_cost,\n            memory_cost = arg_0.memory_cost,\n            parallelism = arg_0.parallelism,\n            hash_len = 16,\n            type = Type.ID)\n\n        return AES.new(arg_5, arg_4, arg_3)", "path": "keyrings/cryptfile/cryptfile.py", "identifier": "ArgonAESEncryption._create_cipher", "docstring": "Create the cipher object to encrypt or decrypt a payload.", "docstring_tokens": ["Create", "the", "cipher", "object", "to", "encrypt", "or", "decrypt", "a", "payload", "."], "nwo": "frispete/keyrings.cryptfile", "score": 0.2836741237679313, "idx": 260026}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/tasks.py#L856-L866", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Converts input sequence file into a \"Boulder-IO format\", as used by primer3", "language": "python", "parameters": "(infile, outfile)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "sequences", ".", "file_reader", "(", "arg_0", ")", "arg_3", "=", "utils", ".", "open_file_write", "(", "arg_1", ")", "for", "arg_4", "in", "arg_2", ":", "print", "(", "\"SEQUENCE_ID=\"", "+", "arg_4", ".", "id", ",", "file", "=", "arg_3", ")", "print", "(", "\"SEQUENCE_TEMPLATE=\"", "+", "arg_4", ".", "seq", ",", "file", "=", "arg_3", ")", "print", "(", "\"=\"", ",", "file", "=", "arg_3", ")", "utils", ".", "close", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    '''Converts input sequence file into a \"Boulder-IO format\", as used by primer3'''\n    arg_2 = sequences.file_reader(arg_0)\n    arg_3 = utils.open_file_write(arg_1)\n\n    for arg_4 in arg_2:\n        print(\"SEQUENCE_ID=\" + arg_4.id, file=arg_3)\n        print(\"SEQUENCE_TEMPLATE=\" + arg_4.seq, file=arg_3)\n        print(\"=\", file=arg_3)\n\n    utils.close(arg_3)", "path": "pyfastaq/tasks.py", "identifier": "to_boulderio", "docstring": "Converts input sequence file into a \"Boulder-IO format\", as used by primer3", "docstring_tokens": ["Converts", "input", "sequence", "file", "into", "a", "Boulder", "-", "IO", "format", "as", "used", "by", "primer3"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 260027}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/criteria.py#L265-L310", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"AIC order-selection using eigen values", "language": "python", "parameters": "(s, N)", "return_statement": "return kaic", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "import", "numpy", "as", "np", "arg_2", "=", "[", "]", "arg_3", "=", "len", "(", "arg_0", ")", "for", "arg_4", "in", "range", "(", "0", ",", "arg_3", "-", "1", ")", ":", "arg_5", "=", "1.", "/", "(", "arg_3", "-", "arg_4", ")", "*", "np", ".", "sum", "(", "arg_0", "[", "arg_4", "+", "1", ":", "]", ")", "arg_6", "=", "np", ".", "prod", "(", "arg_0", "[", "arg_4", "+", "1", ":", "]", "**", "(", "1.", "/", "(", "arg_3", "-", "arg_4", ")", ")", ")", "arg_2", ".", "append", "(", "-", "2.", "*", "(", "arg_3", "-", "arg_4", ")", "*", "arg_1", "*", "np", ".", "log", "(", "arg_6", "/", "arg_5", ")", "+", "2.", "*", "arg_4", "*", "(", "2.", "*", "arg_3", "-", "arg_4", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    r\"\"\"AIC order-selection using eigen values\n\n    :param s: a list of `p` sorted eigen values\n    :param N: the size of the input data. To be defined precisely.\n\n    :return:\n        * an array containing the AIC values\n\n    Given :math:`n` sorted eigen values :math:`\\lambda_i` with\n    :math:`0 <= i < n`, the proposed criterion from Wax and Kailath (1985)\n    is:\n\n    .. math:: AIC(k) = -2(n-k)N \\ln \\frac{g(k)}{a(k)} + 2k(2n-k)\n\n    where the arithmetic sum :math:`a(k)` is:\n\n    .. math:: a(k) = \\sum_{i=k+1}^{n}\\lambda_i\n\n    and the geometric sum :math:`g(k)` is:\n\n    .. math:: g(k) = \\prod_{i=k+1}^{n} \\lambda_i^{-(n-k)}\n\n    The number of relevant sinusoids in the signal subspace is determined by\n    selecting the minimum of `AIC`.\n\n    .. seealso:: :func:`~spectrum.eigenfreq.eigen`\n    .. todo:: define precisely the input parameter N. Should be the input\n       data length but when using correlation matrix (SVD), I suspect it\n       should be the length of the correlation matrix rather than the\n       original data.\n\n    :References:\n        * [Marple]_ Chap 13,\n        * [Wax]_\n    \"\"\"\n    import numpy as np\n\n    arg_2 = []\n    arg_3 = len(arg_0)\n    for arg_4 in range(0, arg_3-1):\n        arg_5 = 1./(arg_3-arg_4) * np.sum(arg_0[arg_4+1:])\n        arg_6 = np.prod(arg_0[arg_4+1:]**(1./(arg_3-arg_4)))\n        arg_2.append( -2.*(arg_3-arg_4)*arg_1 * np.log(arg_6/arg_5) + 2.*arg_4*(2.*arg_3-arg_4))\n\n    return arg_2", "path": "src/spectrum/criteria.py", "identifier": "aic_eigen", "docstring": "r\"\"\"AIC order-selection using eigen values\n\n    :param s: a list of `p` sorted eigen values\n    :param N: the size of the input data. To be defined precisely.\n\n    :return:\n        * an array containing the AIC values\n\n    Given :math:`n` sorted eigen values :math:`\\lambda_i` with\n    :math:`0 <= i < n`, the proposed criterion from Wax and Kailath (1985)\n    is:\n\n    .. math:: AIC(k) = -2(n-k)N \\ln \\frac{g(k)}{a(k)} + 2k(2n-k)\n\n    where the arithmetic sum :math:`a(k)` is:\n\n    .. math:: a(k) = \\sum_{i=k+1}^{n}\\lambda_i\n\n    and the geometric sum :math:`g(k)` is:\n\n    .. math:: g(k) = \\prod_{i=k+1}^{n} \\lambda_i^{-(n-k)}\n\n    The number of relevant sinusoids in the signal subspace is determined by\n    selecting the minimum of `AIC`.\n\n    .. seealso:: :func:`~spectrum.eigenfreq.eigen`\n    .. todo:: define precisely the input parameter N. Should be the input\n       data length but when using correlation matrix (SVD), I suspect it\n       should be the length of the correlation matrix rather than the\n       original data.\n\n    :References:\n        * [Marple]_ Chap 13,\n        * [Wax]_", "docstring_tokens": ["r", "AIC", "order", "-", "selection", "using", "eigen", "values"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 260028}
{"url": "https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/iedb.py#L191-L241", "sha": "b329b4dccd60fae41296816b8cbfe15d6ca07e67", "docstring_summary": "Given a dictionary mapping unique keys to amino acid sequences,\n        run MHC binding predictions on all candidate epitopes extracted from\n        sequences and return a EpitopeCollection.", "language": "python", "parameters": "(self, sequence_dict, peptide_lengths=None)", "return_statement": "return BindingPredictionCollection(binding_predictions)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_1", "=", "check_sequence_dictionary", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "_check_peptide_lengths", "(", "arg_2", ")", "arg_3", "=", "[", "]", "arg_4", "=", "set", "(", "[", "]", ")", "arg_5", "=", "[", "]", "for", "arg_6", ",", "arg_7", "in", "arg_1", ".", "items", "(", ")", ":", "for", "arg_8", "in", "arg_2", ":", "for", "arg_9", "in", "range", "(", "len", "(", "arg_7", ")", "-", "arg_8", "+", "1", ")", ":", "arg_4", ".", "add", "(", "arg_7", "[", "arg_9", ":", "arg_9", "+", "arg_8", "]", ")", "arg_0", ".", "_check_peptide_inputs", "(", "arg_4", ")", "for", "arg_10", "in", "arg_0", ".", "alleles", ":", "arg_10", "=", "normalize_allele_name", "(", "arg_10", ",", "omit_dra1", "=", "True", ")", "arg_5", ".", "append", "(", "arg_10", ")", "arg_11", "=", "arg_0", ".", "_get_iedb_request_params", "(", "arg_7", ",", "arg_10", ")", "logger", ".", "info", "(", "\"Calling IEDB (%s) with request %s\"", ",", "arg_0", ".", "url", ",", "arg_11", ")", "arg_12", "=", "_query_iedb", "(", "arg_11", ",", "arg_0", ".", "url", ")", "for", "arg_13", ",", "arg_14", "in", "arg_12", ".", "iterrows", "(", ")", ":", "arg_3", ".", "append", "(", "BindingPrediction", "(", "source_sequence_name", "=", "arg_6", ",", "offset", "=", "arg_14", "[", "'start'", "]", "-", "1", ",", "arg_10", "=", "arg_14", "[", "'allele'", "]", ",", "peptide", "=", "arg_14", "[", "'peptide'", "]", ",", "affinity", "=", "arg_14", "[", "'ic50'", "]", ",", "percentile_rank", "=", "arg_14", "[", "'rank'", "]", ",", "prediction_method_name", "=", "\"iedb-\"", "+", "arg_0", ".", "prediction_method", ")", ")", "arg_0", ".", "_check_results", "(", "arg_3", ",", "alleles", "=", "arg_5", ",", "peptides", "=", "arg_4", ")", "return", "BindingPredictionCollection", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Given a dictionary mapping unique keys to amino acid sequences,\n        run MHC binding predictions on all candidate epitopes extracted from\n        sequences and return a EpitopeCollection.\n\n        Parameters\n        ----------\n        fasta_dictionary : dict or string\n            Mapping of protein identifiers to protein amino acid sequences.\n            If string then converted to dictionary.\n        \"\"\"\n        arg_1 = check_sequence_dictionary(arg_1)\n        arg_2 = arg_0._check_peptide_lengths(arg_2)\n\n        # take each mutated sequence in the dataframe\n        # and general MHC binding scores for all k-mer substrings\n        arg_3 = []\n        arg_4 = set([])\n\n        arg_5 = []\n        for arg_6, arg_7 in arg_1.items():\n            for arg_8 in arg_2:\n                for arg_9 in range(len(arg_7) - arg_8 + 1):\n                    arg_4.add(arg_7[arg_9:arg_9 + arg_8])\n            arg_0._check_peptide_inputs(arg_4)\n            for arg_10 in arg_0.alleles:\n                # IEDB MHCII predictor expects DRA1 to be omitted.\n                arg_10 = normalize_allele_name(arg_10, omit_dra1=True)\n                arg_5.append(arg_10)\n                arg_11 = arg_0._get_iedb_request_params(\n                    arg_7, arg_10)\n                logger.info(\n                    \"Calling IEDB (%s) with request %s\",\n                    arg_0.url,\n                    arg_11)\n                arg_12 = _query_iedb(arg_11, arg_0.url)\n                for arg_13, arg_14 in arg_12.iterrows():\n                    arg_3.append(\n                        BindingPrediction(\n                            source_sequence_name=arg_6,\n                            offset=arg_14['start'] - 1,\n                            arg_10=arg_14['allele'],\n                            peptide=arg_14['peptide'],\n                            affinity=arg_14['ic50'],\n                            percentile_rank=arg_14['rank'],\n                            prediction_method_name=\"iedb-\" + arg_0.prediction_method))\n        arg_0._check_results(\n            arg_3,\n            alleles=arg_5,\n            peptides=arg_4)\n        return BindingPredictionCollection(arg_3)", "path": "mhctools/iedb.py", "identifier": "IedbBasePredictor.predict_subsequences", "docstring": "Given a dictionary mapping unique keys to amino acid sequences,\n        run MHC binding predictions on all candidate epitopes extracted from\n        sequences and return a EpitopeCollection.\n\n        Parameters\n        ----------\n        fasta_dictionary : dict or string\n            Mapping of protein identifiers to protein amino acid sequences.\n            If string then converted to dictionary.", "docstring_tokens": ["Given", "a", "dictionary", "mapping", "unique", "keys", "to", "amino", "acid", "sequences", "run", "MHC", "binding", "predictions", "on", "all", "candidate", "epitopes", "extracted", "from", "sequences", "and", "return", "a", "EpitopeCollection", "."], "nwo": "openvax/mhctools", "score": 0.43829836586226384, "idx": 260029}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/utils.py#L65-L94", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "Get the identity of a logged in user from a template context.", "language": "python", "parameters": "(context, prefix=None, identity_func=None, user=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "try", ":", "return", "arg_0", "[", "'%s_identity'", "%", "arg_1", "]", "except", "KeyError", ":", "pass", "try", ":", "return", "arg_0", "[", "'analytical_identity'", "]", "except", "KeyError", ":", "pass", "if", "getattr", "(", "settings", ",", "'ANALYTICAL_AUTO_IDENTIFY'", ",", "True", ")", ":", "try", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "get_user_from_context", "(", "arg_0", ")", "if", "get_user_is_authenticated", "(", "arg_3", ")", ":", "if", "arg_2", "is", "not", "None", ":", "return", "arg_2", "(", "arg_3", ")", "else", ":", "return", "arg_3", ".", "get_username", "(", ")", "except", "(", "KeyError", ",", "AttributeError", ")", ":", "pass", "return", "None"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n    \"\"\"\n    Get the identity of a logged in user from a template context.\n\n    The `prefix` argument is used to provide different identities to\n    different analytics services.  The `identity_func` argument is a\n    function that returns the identity of the user; by default the\n    identity is the username.\n    \"\"\"\n    if arg_1 is not None:\n        try:\n            return arg_0['%s_identity' % arg_1]\n        except KeyError:\n            pass\n    try:\n        return arg_0['analytical_identity']\n    except KeyError:\n        pass\n    if getattr(settings, 'ANALYTICAL_AUTO_IDENTIFY', True):\n        try:\n            if arg_3 is None:\n                arg_3 = get_user_from_context(arg_0)\n            if get_user_is_authenticated(arg_3):\n                if arg_2 is not None:\n                    return arg_2(arg_3)\n                else:\n                    return arg_3.get_username()\n        except (KeyError, AttributeError):\n            pass\n    return None", "path": "analytical/utils.py", "identifier": "get_identity", "docstring": "Get the identity of a logged in user from a template context.\n\n    The `prefix` argument is used to provide different identities to\n    different analytics services.  The `identity_func` argument is a\n    function that returns the identity of the user; by default the\n    identity is the username.", "docstring_tokens": ["Get", "the", "identity", "of", "a", "logged", "in", "user", "from", "a", "template", "context", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 260030}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L582-L645", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Extracts info from the stored proto states and\n    convert it into representation that is exposed using\n    the API.\n    This method is called on any change for the topology.\n    For example, when a container moves and its host or some\n    port changes. All the information is parsed all over\n    again and cache is updated.", "language": "python", "parameters": "(self, topology)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "execution_state", ":", "Log", ".", "info", "(", "\"No execution state found for: \"", "+", "arg_1", ".", "name", ")", "return", "Log", ".", "info", "(", "\"Setting topology info for topology: \"", "+", "arg_1", ".", "name", ")", "arg_2", "=", "True", "if", "not", "arg_1", ".", "physical_plan", ":", "arg_2", "=", "False", "Log", ".", "info", "(", "\"Setting topology info for topology: \"", "+", "arg_1", ".", "name", ")", "arg_3", "=", "True", "if", "not", "arg_1", ".", "packing_plan", ":", "arg_3", "=", "False", "arg_4", "=", "True", "if", "not", "arg_1", ".", "tmaster", ":", "arg_4", "=", "False", "arg_5", "=", "True", "if", "not", "arg_1", ".", "scheduler_location", ":", "arg_5", "=", "False", "arg_6", "=", "{", "\"name\"", ":", "arg_1", ".", "name", ",", "\"id\"", ":", "arg_1", ".", "id", ",", "\"logical_plan\"", ":", "None", ",", "\"physical_plan\"", ":", "None", ",", "\"packing_plan\"", ":", "None", ",", "\"execution_state\"", ":", "None", ",", "\"tmaster_location\"", ":", "None", ",", "\"scheduler_location\"", ":", "None", ",", "}", "arg_7", "=", "arg_0", ".", "extract_execution_state", "(", "arg_1", ")", "arg_7", "[", "\"has_physical_plan\"", "]", "=", "arg_2", "arg_7", "[", "\"has_packing_plan\"", "]", "=", "arg_3", "arg_7", "[", "\"has_tmaster_location\"", "]", "=", "arg_4", "arg_7", "[", "\"has_scheduler_location\"", "]", "=", "arg_5", "arg_7", "[", "\"status\"", "]", "=", "arg_1", ".", "get_status", "(", ")", "arg_6", "[", "\"metadata\"", "]", "=", "arg_0", ".", "extract_metadata", "(", "arg_1", ")", "arg_6", "[", "\"runtime_state\"", "]", "=", "arg_0", ".", "extract_runtime_state", "(", "arg_1", ")", "arg_6", "[", "\"execution_state\"", "]", "=", "arg_7", "arg_6", "[", "\"logical_plan\"", "]", "=", "arg_0", ".", "extract_logical_plan", "(", "arg_1", ")", "arg_6", "[", "\"physical_plan\"", "]", "=", "arg_0", ".", "extract_physical_plan", "(", "arg_1", ")", "arg_6", "[", "\"packing_plan\"", "]", "=", "arg_0", ".", "extract_packing_plan", "(", "arg_1", ")", "arg_6", "[", "\"tmaster_location\"", "]", "=", "arg_0", ".", "extract_tmaster", "(", "arg_1", ")", "arg_6", "[", "\"scheduler_location\"", "]", "=", "arg_0", ".", "extract_scheduler_location", "(", "arg_1", ")", "arg_0", ".", "topologyInfos", "[", "(", "arg_1", ".", "name", ",", "arg_1", ".", "state_manager_name", ")", "]", "=", "arg_6"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Extracts info from the stored proto states and\n    convert it into representation that is exposed using\n    the API.\n    This method is called on any change for the topology.\n    For example, when a container moves and its host or some\n    port changes. All the information is parsed all over\n    again and cache is updated.\n    \"\"\"\n    # Execution state is the most basic info.\n    # If there is no execution state, just return\n    # as the rest of the things don't matter.\n    if not arg_1.execution_state:\n      Log.info(\"No execution state found for: \" + arg_1.name)\n      return\n\n    Log.info(\"Setting topology info for topology: \" + arg_1.name)\n    arg_2 = True\n    if not arg_1.physical_plan:\n      arg_2 = False\n\n    Log.info(\"Setting topology info for topology: \" + arg_1.name)\n    arg_3 = True\n    if not arg_1.packing_plan:\n      arg_3 = False\n\n    arg_4 = True\n    if not arg_1.tmaster:\n      arg_4 = False\n\n    arg_5 = True\n    if not arg_1.scheduler_location:\n      arg_5 = False\n\n    arg_6 = {\n        \"name\": arg_1.name,\n        \"id\": arg_1.id,\n        \"logical_plan\": None,\n        \"physical_plan\": None,\n        \"packing_plan\": None,\n        \"execution_state\": None,\n        \"tmaster_location\": None,\n        \"scheduler_location\": None,\n    }\n\n    arg_7 = arg_0.extract_execution_state(arg_1)\n    arg_7[\"has_physical_plan\"] = arg_2\n    arg_7[\"has_packing_plan\"] = arg_3\n    arg_7[\"has_tmaster_location\"] = arg_4\n    arg_7[\"has_scheduler_location\"] = arg_5\n    arg_7[\"status\"] = arg_1.get_status()\n\n    arg_6[\"metadata\"] = arg_0.extract_metadata(arg_1)\n    arg_6[\"runtime_state\"] = arg_0.extract_runtime_state(arg_1)\n\n    arg_6[\"execution_state\"] = arg_7\n    arg_6[\"logical_plan\"] = arg_0.extract_logical_plan(arg_1)\n    arg_6[\"physical_plan\"] = arg_0.extract_physical_plan(arg_1)\n    arg_6[\"packing_plan\"] = arg_0.extract_packing_plan(arg_1)\n    arg_6[\"tmaster_location\"] = arg_0.extract_tmaster(arg_1)\n    arg_6[\"scheduler_location\"] = arg_0.extract_scheduler_location(arg_1)\n\n    arg_0.topologyInfos[(arg_1.name, arg_1.state_manager_name)] = arg_6", "path": "heron/tools/tracker/src/python/tracker.py", "identifier": "Tracker.setTopologyInfo", "docstring": "Extracts info from the stored proto states and\n    convert it into representation that is exposed using\n    the API.\n    This method is called on any change for the topology.\n    For example, when a container moves and its host or some\n    port changes. All the information is parsed all over\n    again and cache is updated.", "docstring_tokens": ["Extracts", "info", "from", "the", "stored", "proto", "states", "and", "convert", "it", "into", "representation", "that", "is", "exposed", "using", "the", "API", ".", "This", "method", "is", "called", "on", "any", "change", "for", "the", "topology", ".", "For", "example", "when", "a", "container", "moves", "and", "its", "host", "or", "some", "port", "changes", ".", "All", "the", "information", "is", "parsed", "all", "over", "again", "and", "cache", "is", "updated", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260031}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/utils.py#L31-L37", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Given an archive URI, parse to a split ident-hash.", "language": "python", "parameters": "(uri)", "return_statement": "return ident_hash", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "urlparse", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "path", ".", "rstrip", "(", "'/'", ")", ".", "split", "(", "'/'", ")", "arg_3", "=", "arg_2", "[", "-", "1", "]", "arg_3", "=", "unquote", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"Given an archive URI, parse to a split ident-hash.\"\"\"\n    arg_1 = urlparse(arg_0)\n    arg_2 = arg_1.path.rstrip('/').split('/')\n    arg_3 = arg_2[-1]\n    arg_3 = unquote(arg_3)\n    return arg_3", "path": "cnxpublishing/utils.py", "identifier": "parse_archive_uri", "docstring": "Given an archive URI, parse to a split ident-hash.", "docstring_tokens": ["Given", "an", "archive", "URI", "parse", "to", "a", "split", "ident", "-", "hash", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 260032}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L732-L764", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Unlock a message for processing by other receivers on a given\n        subscription. This operation deletes the lock object, causing the\n        message to be unlocked. A message must have first been locked by a\n        receiver before this operation is called.", "language": "python", "parameters": "(self, topic_name, subscription_name,\n                                    sequence_number, lock_token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "_validate_not_none", "(", "'topic_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'subscription_name'", ",", "arg_2", ")", "_validate_not_none", "(", "'sequence_number'", ",", "arg_3", ")", "_validate_not_none", "(", "'lock_token'", ",", "arg_4", ")", "arg_5", "=", "HTTPRequest", "(", ")", "arg_5", ".", "method", "=", "'PUT'", "arg_5", ".", "host", "=", "arg_0", ".", "_get_host", "(", ")", "arg_5", ".", "path", "=", "'/'", "+", "_str", "(", "arg_1", ")", "+", "'/subscriptions/'", "+", "str", "(", "arg_2", ")", "+", "'/messages/'", "+", "_str", "(", "arg_3", ")", "+", "'/'", "+", "_str", "(", "arg_4", ")", "+", "''", "arg_5", ".", "path", ",", "arg_5", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_5", ")", "arg_5", ".", "headers", "=", "arg_0", ".", "_update_service_bus_header", "(", "arg_5", ")", "arg_0", ".", "_perform_request", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                                    arg_3, arg_4):\n        '''\n        Unlock a message for processing by other receivers on a given\n        subscription. This operation deletes the lock object, causing the\n        message to be unlocked. A message must have first been locked by a\n        receiver before this operation is called.\n\n        topic_name:\n            Name of the topic.\n        subscription_name:\n            Name of the subscription.\n        sequence_number:\n            The sequence number of the message to be unlocked as returned in\n            BrokerProperties['SequenceNumber'] by the Peek Message operation.\n        lock_token:\n            The ID of the lock as returned by the Peek Message operation in\n            BrokerProperties['LockToken']\n        '''\n        _validate_not_none('topic_name', arg_1)\n        _validate_not_none('subscription_name', arg_2)\n        _validate_not_none('sequence_number', arg_3)\n        _validate_not_none('lock_token', arg_4)\n        arg_5 = HTTPRequest()\n        arg_5.method = 'PUT'\n        arg_5.host = arg_0._get_host()\n        arg_5.path = '/' + _str(arg_1) + \\\n                       '/subscriptions/' + str(arg_2) + \\\n                       '/messages/' + _str(arg_3) + \\\n                       '/' + _str(arg_4) + ''\n        arg_5.path, arg_5.query = arg_0._httpclient._update_request_uri_query(arg_5)  # pylint: disable=protected-access\n        arg_5.headers = arg_0._update_service_bus_header(arg_5)\n        arg_0._perform_request(arg_5)", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusService.unlock_subscription_message", "docstring": "Unlock a message for processing by other receivers on a given\n        subscription. This operation deletes the lock object, causing the\n        message to be unlocked. A message must have first been locked by a\n        receiver before this operation is called.\n\n        topic_name:\n            Name of the topic.\n        subscription_name:\n            Name of the subscription.\n        sequence_number:\n            The sequence number of the message to be unlocked as returned in\n            BrokerProperties['SequenceNumber'] by the Peek Message operation.\n        lock_token:\n            The ID of the lock as returned by the Peek Message operation in\n            BrokerProperties['LockToken']", "docstring_tokens": ["Unlock", "a", "message", "for", "processing", "by", "other", "receivers", "on", "a", "given", "subscription", ".", "This", "operation", "deletes", "the", "lock", "object", "causing", "the", "message", "to", "be", "unlocked", ".", "A", "message", "must", "have", "first", "been", "locked", "by", "a", "receiver", "before", "this", "operation", "is", "called", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260033}
{"url": "https://github.com/ecometrica/grandfatherson/blob/b166e4e44887960c3066ebd28eecadfae19561e1/grandfatherson/__init__.py#L195-L207", "sha": "b166e4e44887960c3066ebd28eecadfae19561e1", "docstring_summary": "Return a set of dates that should be kept, out of ``dates``.", "language": "python", "parameters": "(dates,\n                  years=0, months=0, weeks=0, days=0, firstweekday=SATURDAY,\n                  now=None)", "return_statement": "return set(dt.date() for dt in datetimes)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ",", "arg_5", "=", "arg_6", ",", "arg_7", "=", "None", ")", ":", "arg_8", "=", "to_keep", "(", "(", "datetime", ".", "combine", "(", "d", ",", "time", "(", ")", ")", "for", "d", "in", "arg_0", ")", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "hours", "=", "0", ",", "minutes", "=", "0", ",", "seconds", "=", "0", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ")", "return", "set", "(", "arg_9", ".", "date", "(", ")", "for", "arg_9", "in", "arg_8", ")"], "function": "def Func(arg_0,\n                  arg_1=0, arg_2=0, arg_3=0, arg_4=0, arg_5=arg_6,\n                  arg_7=None):\n    \"\"\"\n    Return a set of dates that should be kept, out of ``dates``.\n\n    See ``to_keep`` for a description of arguments.\n    \"\"\"\n    arg_8 = to_keep((datetime.combine(d, time()) for d in arg_0),\n                        arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,\n                        hours=0, minutes=0, seconds=0,\n                        arg_5=arg_5, arg_7=arg_7)\n    return set(arg_9.date() for arg_9 in arg_8)", "path": "grandfatherson/__init__.py", "identifier": "dates_to_keep", "docstring": "Return a set of dates that should be kept, out of ``dates``.\n\n    See ``to_keep`` for a description of arguments.", "docstring_tokens": ["Return", "a", "set", "of", "dates", "that", "should", "be", "kept", "out", "of", "dates", "."], "nwo": "ecometrica/grandfatherson", "score": 0.19800877986197146, "idx": 260034}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/db.py#L144-L154", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Insert list of patches at the front of the curent patches list", "language": "python", "parameters": "(self, patches)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "PatchLine", "(", "arg_3", ")", "arg_5", "=", "arg_4", ".", "get_patch", "(", ")", "if", "arg_5", ":", "arg_0", ".", "patch2line", "[", "arg_5", "]", "=", "arg_4", "arg_2", ".", "append", "(", "arg_4", ")", "arg_2", ".", "extend", "(", "arg_0", ".", "patchlines", ")", "arg_0", ".", "patchlines", "=", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Insert list of patches at the front of the curent patches list \"\"\"\n        arg_2 = []\n        for arg_3 in arg_1:\n            arg_4 = PatchLine(arg_3)\n            arg_5 = arg_4.get_patch()\n            if arg_5:\n                arg_0.patch2line[arg_5] = arg_4\n            arg_2.append(arg_4)\n        arg_2.extend(arg_0.patchlines)\n        arg_0.patchlines = arg_2", "path": "quilt/db.py", "identifier": "PatchSeries.insert_patches", "docstring": "Insert list of patches at the front of the curent patches list", "docstring_tokens": ["Insert", "list", "of", "patches", "at", "the", "front", "of", "the", "curent", "patches", "list"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 260035}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/collector.py#L88-L109", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Retrieves the issues in the collection grouped into buckets according\n        to the key generated by the keyfunc.", "language": "python", "parameters": "(self, keyfunc=None, sortby=None)", "return_statement": "return self._group_issues(self._cleaned_issues, keyfunc, sortby)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "default_group", "if", "not", "arg_2", ":", "arg_2", "=", "arg_0", ".", "DEFAULT_SORT", "arg_0", ".", "_ensure_cleaned_issues", "(", ")", "return", "arg_0", ".", "_group_issues", "(", "arg_0", ".", "_cleaned_issues", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"\n        Retrieves the issues in the collection grouped into buckets according\n        to the key generated by the keyfunc.\n\n        :param keyfunc:\n            a function that will be used to generate the key that identifies\n            the group that an issue will be assigned to. This function receives\n            a single tidypy.Issue argument and must return a string. If not\n            specified, the filename of the issue will be used.\n        :type keyfunc: func\n        :param sortby: the properties to sort the issues by\n        :type sortby: list(str)\n        :rtype: OrderedDict\n        \"\"\"\n\n        if not arg_1:\n            arg_1 = default_group\n        if not arg_2:\n            arg_2 = arg_0.DEFAULT_SORT\n        arg_0._ensure_cleaned_issues()\n        return arg_0._group_issues(arg_0._cleaned_issues, arg_1, arg_2)", "path": "src/tidypy/collector.py", "identifier": "Collector.get_grouped_issues", "docstring": "Retrieves the issues in the collection grouped into buckets according\n        to the key generated by the keyfunc.\n\n        :param keyfunc:\n            a function that will be used to generate the key that identifies\n            the group that an issue will be assigned to. This function receives\n            a single tidypy.Issue argument and must return a string. If not\n            specified, the filename of the issue will be used.\n        :type keyfunc: func\n        :param sortby: the properties to sort the issues by\n        :type sortby: list(str)\n        :rtype: OrderedDict", "docstring_tokens": ["Retrieves", "the", "issues", "in", "the", "collection", "grouped", "into", "buckets", "according", "to", "the", "key", "generated", "by", "the", "keyfunc", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 260036}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/transformed_kernel.py#L56-L64", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Makes a function which applies a list of Bijectors' `forward`s.", "language": "python", "parameters": "(bijector)", "return_statement": "return fn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "mcmc_util", ".", "is_list_like", "(", "arg_0", ")", ":", "arg_0", "=", "[", "arg_0", "]", "def", "fn", "(", "arg_1", ")", ":", "return", "[", "arg_2", ".", "forward", "(", "arg_3", ")", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "arg_0", ",", "arg_1", ")", "]", "return", "fn"], "function": "def Func(arg_0):\n  \"\"\"Makes a function which applies a list of Bijectors' `forward`s.\"\"\"\n  if not mcmc_util.is_list_like(arg_0):\n    arg_0 = [arg_0]\n\n  def fn(arg_1):\n    return [arg_2.forward(arg_3) for arg_2, arg_3 in zip(arg_0, arg_1)]\n\n  return fn", "path": "tensorflow_probability/python/mcmc/transformed_kernel.py", "identifier": "forward_transform_fn", "docstring": "Makes a function which applies a list of Bijectors' `forward`s.", "docstring_tokens": ["Makes", "a", "function", "which", "applies", "a", "list", "of", "Bijectors", "forward", "s", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260037}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L85-L115", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Align spark bolt array so that axes for iteration are in the keys.", "language": "python", "parameters": "(self, axis)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "inshape", "(", "arg_0", ".", "shape", ",", "arg_1", ")", "arg_2", "=", "[", "(", "a", "-", "arg_0", ".", "split", ")", "for", "a", "in", "arg_1", "if", "a", ">=", "arg_0", ".", "split", "]", "arg_3", "=", "[", "a", "for", "a", "in", "range", "(", "arg_0", ".", "split", ")", "if", "a", "not", "in", "arg_1", "]", "if", "arg_2", "or", "arg_3", ":", "return", "arg_0", ".", "swap", "(", "arg_3", ",", "arg_2", ")", "else", ":", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Align spark bolt array so that axes for iteration are in the keys.\n\n        This operation is applied before most functional operators.\n        It ensures that the specified axes are valid, and swaps\n        key/value axes so that functional operators can be applied\n        over the correct records.\n\n        Parameters\n        ----------\n        axis: tuple[int]\n            One or more axes that wil be iterated over by a functional operator\n\n        Returns\n        -------\n        BoltArraySpark\n        \"\"\"\n        # ensure that the specified axes are valid\n        inshape(arg_0.shape, arg_1)\n\n        # find the value axes that should be moved into the keys (axis >= split)\n        arg_2 = [(a - arg_0.split) for a in arg_1 if a >= arg_0.split]\n\n        # find the key axes that should be moved into the values (axis < split)\n        arg_3 = [a for a in range(arg_0.split) if a not in arg_1]\n\n        if arg_2 or arg_3:\n            return arg_0.swap(arg_3, arg_2)\n        else:\n            return arg_0", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark._align", "docstring": "Align spark bolt array so that axes for iteration are in the keys.\n\n        This operation is applied before most functional operators.\n        It ensures that the specified axes are valid, and swaps\n        key/value axes so that functional operators can be applied\n        over the correct records.\n\n        Parameters\n        ----------\n        axis: tuple[int]\n            One or more axes that wil be iterated over by a functional operator\n\n        Returns\n        -------\n        BoltArraySpark", "docstring_tokens": ["Align", "spark", "bolt", "array", "so", "that", "axes", "for", "iteration", "are", "in", "the", "keys", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 260038}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L993-L997", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Sets the module's verbosity, and returns the previous setting.", "language": "python", "parameters": "(self, level)", "return_statement": "return last_verbose_level", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "verbose_level", "arg_0", ".", "verbose_level", "=", "arg_1", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Sets the module's verbosity, and returns the previous setting.\"\"\"\n    arg_2 = arg_0.verbose_level\n    arg_0.verbose_level = arg_1\n    return arg_2", "path": "third_party/python/cpplint/cpplint.py", "identifier": "_CppLintState.SetVerboseLevel", "docstring": "Sets the module's verbosity, and returns the previous setting.", "docstring_tokens": ["Sets", "the", "module", "s", "verbosity", "and", "returns", "the", "previous", "setting", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260039}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/client.py#L29-L38", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Adds the API key and user auth token to the query parameters", "language": "python", "parameters": "(self, query_params)", "return_statement": "return query_params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "[", "'key'", "]", "=", "arg_0", ".", "api_key", "if", "arg_0", ".", "user_auth_token", ":", "arg_1", "[", "'token'", "]", "=", "arg_0", ".", "user_auth_token", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        '''\n        Adds the API key and user auth token to the query parameters\n        '''\n        arg_1['key'] = arg_0.api_key\n\n        if arg_0.user_auth_token:\n            arg_1['token'] = arg_0.user_auth_token\n\n        return arg_1", "path": "trolly/client.py", "identifier": "Client.add_authorisation", "docstring": "Adds the API key and user auth token to the query parameters", "docstring_tokens": ["Adds", "the", "API", "key", "and", "user", "auth", "token", "to", "the", "query", "parameters"], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 260040}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L100-L106", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Returns whether or not the resource with the given name and extension exists.\n        \n        This must not mean that the resource is meaningful, it simply signals that the file exists.", "language": "python", "parameters": "(self,name,ext=\"\")", "return_statement": "return os.path.exists(self.resourceNameToPath(name,ext))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"\"", ")", ":", "return", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "resourceNameToPath", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0,arg_1,arg_2=\"\"):\n        \"\"\"\n        Returns whether or not the resource with the given name and extension exists.\n        \n        This must not mean that the resource is meaningful, it simply signals that the file exists.\n        \"\"\"\n        return os.path.exists(arg_0.resourceNameToPath(arg_1,arg_2))", "path": "peng3d/resource.py", "identifier": "ResourceManager.resourceExists", "docstring": "Returns whether or not the resource with the given name and extension exists.\n        \n        This must not mean that the resource is meaningful, it simply signals that the file exists.", "docstring_tokens": ["Returns", "whether", "or", "not", "the", "resource", "with", "the", "given", "name", "and", "extension", "exists", ".", "This", "must", "not", "mean", "that", "the", "resource", "is", "meaningful", "it", "simply", "signals", "that", "the", "file", "exists", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 260041}
{"url": "https://github.com/Cairnarvon/uptime/blob/1ddfd06bb300c00e6dc4bd2a9ddf9bf1aa27b1bb/src/__init__.py#L325-L349", "sha": "1ddfd06bb300c00e6dc4bd2a9ddf9bf1aa27b1bb", "docstring_summary": "Returns uptime in seconds if even remotely possible, or None if not.", "language": "python", "parameters": "()", "return_statement": "return {'amiga': _uptime_amiga,\n            'aros12': _uptime_amiga,\n            'beos5': _uptime_beos,\n            'cygwin': _uptime_linux,\n            'darwin': _uptime_osx,\n            'haiku1': _uptime_beos,\n            'linux': _uptime_linux,\n            'linux-armv71': _uptime_linux,\n            'linux2': _uptime_linux,\n            'mac': _uptime_mac,\n            'minix3': _uptime_minix,\n            'riscos': _uptime_riscos,\n            'sunos5': _uptime_solaris,\n            'syllable': _uptime_syllable,\n            'win32': _uptime_windows,\n            'wince': _uptime_windows}.get(sys.platform, _uptime_bsd)() or \\\n           _uptime_bsd() or _uptime_plan9() or _uptime_linux() or \\\n           _uptime_windows() or _uptime_solaris() or _uptime_beos() or \\\n           _uptime_amiga() or _uptime_riscos() or _uptime_posix() or \\\n           _uptime_syllable() or _uptime_mac() or _uptime_osx()", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "__boottime", "is", "not", "None", ":", "return", "time", ".", "time", "(", ")", "-", "__boottime", "return", "{", "'amiga'", ":", "_Func_amiga", ",", "'aros12'", ":", "_Func_amiga", ",", "'beos5'", ":", "_Func_beos", ",", "'cygwin'", ":", "_Func_linux", ",", "'darwin'", ":", "_Func_osx", ",", "'haiku1'", ":", "_Func_beos", ",", "'linux'", ":", "_Func_linux", ",", "'linux-armv71'", ":", "_Func_linux", ",", "'linux2'", ":", "_Func_linux", ",", "'mac'", ":", "_Func_mac", ",", "'minix3'", ":", "_Func_minix", ",", "'riscos'", ":", "_Func_riscos", ",", "'sunos5'", ":", "_Func_solaris", ",", "'syllable'", ":", "_Func_syllable", ",", "'win32'", ":", "_Func_windows", ",", "'wince'", ":", "_Func_windows", "}", ".", "get", "(", "sys", ".", "platform", ",", "_Func_bsd", ")", "(", ")", "or", "_Func_bsd", "(", ")", "or", "_Func_plan9", "(", ")", "or", "_Func_linux", "(", ")", "or", "_Func_windows", "(", ")", "or", "_Func_solaris", "(", ")", "or", "_Func_beos", "(", ")", "or", "_Func_amiga", "(", ")", "or", "_Func_riscos", "(", ")", "or", "_Func_posix", "(", ")", "or", "_Func_syllable", "(", ")", "or", "_Func_mac", "(", ")", "or", "_Func_osx", "(", ")"], "function": "def Func():\n    \"\"\"Returns Func in seconds if even remotely possible, or None if not.\"\"\"\n    if __boottime is not None:\n        return time.time() - __boottime\n\n    return {'amiga': _Func_amiga,\n            'aros12': _Func_amiga,\n            'beos5': _Func_beos,\n            'cygwin': _Func_linux,\n            'darwin': _Func_osx,\n            'haiku1': _Func_beos,\n            'linux': _Func_linux,\n            'linux-armv71': _Func_linux,\n            'linux2': _Func_linux,\n            'mac': _Func_mac,\n            'minix3': _Func_minix,\n            'riscos': _Func_riscos,\n            'sunos5': _Func_solaris,\n            'syllable': _Func_syllable,\n            'win32': _Func_windows,\n            'wince': _Func_windows}.get(sys.platform, _Func_bsd)() or \\\n           _Func_bsd() or _Func_plan9() or _Func_linux() or \\\n           _Func_windows() or _Func_solaris() or _Func_beos() or \\\n           _Func_amiga() or _Func_riscos() or _Func_posix() or \\\n           _Func_syllable() or _Func_mac() or _Func_osx()", "path": "src/__init__.py", "identifier": "uptime", "docstring": "Returns uptime in seconds if even remotely possible, or None if not.", "docstring_tokens": ["Returns", "uptime", "in", "seconds", "if", "even", "remotely", "possible", "or", "None", "if", "not", "."], "nwo": "Cairnarvon/uptime", "score": 0.28604555575224755, "idx": 260042}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/receivers.py#L42-L53", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Register signal receivers which send events.", "language": "python", "parameters": "(app, config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "arg_4", "=", "[", "obj_or_import_string", "(", "func", ")", "for", "func", "in", "arg_3", ".", "get", "(", "'event_builders'", ",", "[", "]", ")", "]", "arg_5", "=", "obj_or_import_string", "(", "arg_3", "[", "'signal'", "]", ")", "arg_5", ".", "connect", "(", "EventEmmiter", "(", "arg_2", ",", "arg_4", ")", ",", "sender", "=", "arg_0", ",", "weak", "=", "False", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Register signal receivers which send events.\"\"\"\n    for arg_2, arg_3 in arg_1.items():\n        arg_4 = [\n            obj_or_import_string(func)\n            for func in arg_3.get('event_builders', [])\n        ]\n\n        arg_5 = obj_or_import_string(arg_3['signal'])\n        arg_5.connect(\n            EventEmmiter(arg_2, arg_4), sender=arg_0, weak=False\n        )", "path": "invenio_stats/receivers.py", "identifier": "register_receivers", "docstring": "Register signal receivers which send events.", "docstring_tokens": ["Register", "signal", "receivers", "which", "send", "events", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 260043}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L514-L528", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return the first ``rows`` and ``cols`` of the frame as a new H2OFrame.", "language": "python", "parameters": "(self, rows=10, cols=200)", "return_statement": "return newdt._frame(rows=nrows, cols=cols, fill_cache=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ",", "arg_2", "=", "200", ")", ":", "assert_is_type", "(", "arg_1", ",", "int", ")", "assert_is_type", "(", "arg_2", ",", "int", ")", "arg_3", "=", "min", "(", "arg_0", ".", "nrows", ",", "arg_1", ")", "arg_4", "=", "min", "(", "arg_0", ".", "ncols", ",", "arg_2", ")", "arg_5", "=", "arg_0", "[", ":", "arg_3", ",", ":", "arg_4", "]", "return", "arg_5", ".", "_frame", "(", "arg_1", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "fill_cache", "=", "True", ")"], "function": "def Func(arg_0, arg_1=10, arg_2=200):\n        \"\"\"\n        Return the first ``rows`` and ``cols`` of the frame as a new H2OFrame.\n\n        :param int rows: maximum number of rows to return\n        :param int cols: maximum number of columns to return\n        :returns: a new H2OFrame cut from the top left corner of the current frame, and having dimensions at\n            most ``rows`` x ``cols``.\n        \"\"\"\n        assert_is_type(arg_1, int)\n        assert_is_type(arg_2, int)\n        arg_3 = min(arg_0.nrows, arg_1)\n        arg_4 = min(arg_0.ncols, arg_2)\n        arg_5 = arg_0[:arg_3, :arg_4]\n        return arg_5._frame(arg_1=arg_3, arg_2=arg_2, fill_cache=True)", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.head", "docstring": "Return the first ``rows`` and ``cols`` of the frame as a new H2OFrame.\n\n        :param int rows: maximum number of rows to return\n        :param int cols: maximum number of columns to return\n        :returns: a new H2OFrame cut from the top left corner of the current frame, and having dimensions at\n            most ``rows`` x ``cols``.", "docstring_tokens": ["Return", "the", "first", "rows", "and", "cols", "of", "the", "frame", "as", "a", "new", "H2OFrame", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260044}
{"url": "https://github.com/mcs07/MolVS/blob/d815fe52d160abcecbcbf117e6437bf727dbd8ad/molvs/standardize.py#L171-L190", "sha": "d815fe52d160abcecbcbf117e6437bf727dbd8ad", "docstring_summary": "Return the charge parent of a given molecule.", "language": "python", "parameters": "(self, mol, skip_standardize=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_2", ":", "arg_1", "=", "arg_0", ".", "standardize", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "fragment_parent", "(", "arg_1", ",", "arg_2", "=", "True", ")", "if", "arg_3", ":", "arg_4", "=", "arg_0", ".", "uncharge", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "standardize", "(", "arg_4", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Return the charge parent of a given molecule.\n\n        The charge parent is the uncharged version of the fragment parent.\n\n        :param mol: The input molecule.\n        :type mol: rdkit.Chem.rdchem.Mol\n        :param bool skip_standardize: Set to True if mol has already been standardized.\n        :returns: The charge parent molecule.\n        :rtype: rdkit.Chem.rdchem.Mol\n        \"\"\"\n        # TODO: All ionized acids and bases should be neutralised.\n        if not arg_2:\n            arg_1 = arg_0.standardize(arg_1)\n        arg_3 = arg_0.fragment_parent(arg_1, arg_2=True)\n        if arg_3:\n            arg_4 = arg_0.uncharge(arg_3)\n            # During final standardization, the Reionizer ensures any remaining charges are in the right places\n            arg_4 = arg_0.standardize(arg_4)\n            return arg_4", "path": "molvs/standardize.py", "identifier": "Standardizer.charge_parent", "docstring": "Return the charge parent of a given molecule.\n\n        The charge parent is the uncharged version of the fragment parent.\n\n        :param mol: The input molecule.\n        :type mol: rdkit.Chem.rdchem.Mol\n        :param bool skip_standardize: Set to True if mol has already been standardized.\n        :returns: The charge parent molecule.\n        :rtype: rdkit.Chem.rdchem.Mol", "docstring_tokens": ["Return", "the", "charge", "parent", "of", "a", "given", "molecule", "."], "nwo": "mcs07/MolVS", "score": 0.5162715334407971, "idx": 260045}
{"url": "https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Parser.py#L51-L58", "sha": "8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027", "docstring_summary": "Initialize the parsing process.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_instruction_library", "=", "arg_0", ".", "_spec", ".", "new_default_instructions", "(", ")", "arg_0", ".", "_as_instruction", "=", "arg_0", ".", "_instruction_library", ".", "as_instruction", "arg_0", ".", "_id_cache", "=", "{", "}", "arg_0", ".", "_pattern_set", "=", "None", "arg_0", ".", "_inheritance_todos", "=", "[", "]", "arg_0", ".", "_instruction_todos", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"Initialize the parsing process.\"\"\"\n        arg_0._instruction_library = arg_0._spec.new_default_instructions()\n        arg_0._as_instruction = arg_0._instruction_library.as_instruction\n        arg_0._id_cache = {}\n        arg_0._pattern_set = None\n        arg_0._inheritance_todos = []\n        arg_0._instruction_todos = []", "path": "knittingpattern/Parser.py", "identifier": "Parser._start", "docstring": "Initialize the parsing process.", "docstring_tokens": ["Initialize", "the", "parsing", "process", "."], "nwo": "fossasia/knittingpattern", "score": 0.3735534547473614, "idx": 260046}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/text_writer.py#L66-L84", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "format a table", "language": "python", "parameters": "(self, layout, table_content, cols_width)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_3", "=", "[", "size", "+", "1", "for", "size", "in", "arg_3", "]", "arg_4", "=", "\" \"", ".", "join", "(", "[", "\"%%-%ss\"", "]", "*", "len", "(", "arg_3", ")", ")", "arg_4", "=", "arg_4", "%", "tuple", "(", "arg_3", ")", "arg_4", "=", "arg_4", ".", "split", "(", "\" \"", ")", "arg_5", "=", "\"\\n+\"", "+", "\"+\"", ".", "join", "(", "[", "\"-\"", "*", "w", "for", "w", "in", "arg_3", "]", ")", "+", "\"+\\n\"", "arg_6", "=", "\"\\n+\"", "+", "\"+\"", ".", "join", "(", "[", "\"=\"", "*", "w", "for", "w", "in", "arg_3", "]", ")", "+", "\"+\\n\"", "arg_0", ".", "write", "(", "arg_5", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_2", ")", ":", "arg_0", ".", "write", "(", "\"|\"", ")", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_8", ")", ":", "arg_0", ".", "write", "(", "arg_4", "[", "arg_9", "]", "%", "arg_10", ")", "arg_0", ".", "write", "(", "\"|\"", ")", "if", "arg_7", "==", "0", "and", "arg_1", ".", "rheaders", ":", "arg_0", ".", "write", "(", "arg_6", ")", "else", ":", "arg_0", ".", "write", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"format a table\"\"\"\n        arg_3 = [size + 1 for size in arg_3]\n        arg_4 = \" \".join([\"%%-%ss\"] * len(arg_3))\n        arg_4 = arg_4 % tuple(arg_3)\n        arg_4 = arg_4.split(\" \")\n        arg_5 = \"\\n+\" + \"+\".join([\"-\" * w for w in arg_3]) + \"+\\n\"\n        arg_6 = \"\\n+\" + \"+\".join([\"=\" * w for w in arg_3]) + \"+\\n\"\n        # FIXME: layout.cheaders\n        arg_0.write(arg_5)\n        for arg_7, arg_8 in enumerate(arg_2):\n            arg_0.write(\"|\")\n            for arg_9, arg_10 in enumerate(arg_8):\n                arg_0.write(arg_4[arg_9] % arg_10)\n                arg_0.write(\"|\")\n            if arg_7 == 0 and arg_1.rheaders:\n                arg_0.write(arg_6)\n            else:\n                arg_0.write(arg_5)", "path": "pylint/reporters/ureports/text_writer.py", "identifier": "TextWriter.default_table", "docstring": "format a table", "docstring_tokens": ["format", "a", "table"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260047}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L690-L726", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Save the roster to an XML file.", "language": "python", "parameters": "(self, dest, pretty = True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "arg_0", ".", "roster", "is", "None", ":", "raise", "ValueError", "(", "\"No roster\"", ")", "arg_3", "=", "arg_0", ".", "roster", ".", "as_xml", "(", ")", "if", "arg_2", ":", "if", "len", "(", "arg_3", ")", ":", "arg_3", ".", "text", "=", "u'\\n  '", "arg_5", "=", "None", "for", "arg_6", "in", "arg_3", ":", "if", "arg_5", "is", "not", "None", ":", "arg_5", ".", "tail", "=", "u'\\n  '", "if", "len", "(", "arg_6", ")", ":", "arg_6", ".", "text", "=", "u'\\n    '", "arg_8", "=", "None", "for", "arg_9", "in", "arg_6", ":", "if", "arg_8", "is", "not", "None", ":", "arg_8", ".", "tail", "=", "u'\\n    '", "arg_8", "=", "arg_9", "if", "arg_8", "is", "not", "None", ":", "arg_8", ".", "tail", "=", "u'\\n  '", "arg_5", "=", "arg_6", "if", "arg_5", "is", "not", "None", ":", "arg_5", ".", "tail", "=", "u\"\\n\"", "arg_10", "=", "ElementTree", ".", "ElementTree", "(", "arg_3", ")", "arg_10", ".", "write", "(", "arg_1", ",", "\"utf-8\"", ")"], "function": "def Func(arg_0, arg_1, arg_2 = True):\n        \"\"\"Save the roster to an XML file.\n\n        Can be used to save the last know roster copy for faster loading\n        of a verisoned roster (if server supports that).\n\n        :Parameters:\n            - `dest`: file name or a file object\n            - `pretty`: pretty-format the roster XML\n        :Types:\n            - `dest`: `str` or file-like object\n            - `pretty`: `bool`\n        \"\"\"\n        if arg_0.roster is None:\n            raise ValueError(\"No roster\")\n        arg_3 = arg_0.roster.as_xml()\n        if arg_2:\n            if len(arg_3):\n                arg_3.text = u'\\n  '\n            arg_5 = None\n            for arg_6 in arg_3:\n                if arg_5 is not None:\n                    arg_5.tail = u'\\n  '\n                if len(arg_6):\n                    arg_6.text = u'\\n    '\n                arg_8 = None\n                for arg_9 in arg_6:\n                    if arg_8 is not None:\n                        arg_8.tail = u'\\n    '\n                    arg_8 = arg_9\n                if arg_8 is not None:\n                    arg_8.tail = u'\\n  '\n                arg_5 = arg_6\n            if arg_5 is not None:\n                arg_5.tail = u\"\\n\"\n        arg_10 = ElementTree.ElementTree(arg_3)\n        arg_10.write(arg_1, \"utf-8\")", "path": "pyxmpp2/roster.py", "identifier": "RosterClient.save_roster", "docstring": "Save the roster to an XML file.\n\n        Can be used to save the last know roster copy for faster loading\n        of a verisoned roster (if server supports that).\n\n        :Parameters:\n            - `dest`: file name or a file object\n            - `pretty`: pretty-format the roster XML\n        :Types:\n            - `dest`: `str` or file-like object\n            - `pretty`: `bool`", "docstring_tokens": ["Save", "the", "roster", "to", "an", "XML", "file", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260048}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/query/parser.py#L153-L160", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Parse the querystring into a normalized form.", "language": "python", "parameters": "(text, encoding='utf8')", "return_statement": "return Query(text, split_segments(text))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'utf8'", ")", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "binary_type", ")", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "arg_1", ")", "return", "Query", "(", "arg_0", ",", "split_segments", "(", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1='utf8'):\n    \"\"\"Parse the querystring into a normalized form.\"\"\"\n\n    # Decode the text if we got bytes.\n    if isinstance(arg_0, six.binary_type):\n        arg_0 = arg_0.decode(arg_1)\n\n    return Query(arg_0, split_segments(arg_0))", "path": "armet/query/parser.py", "identifier": "parse", "docstring": "Parse the querystring into a normalized form.", "docstring_tokens": ["Parse", "the", "querystring", "into", "a", "normalized", "form", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 260049}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/sf/segmenter.py#L83-L90", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Shifts circularly the X squre matrix in order to get a\n        time-lag matrix.", "language": "python", "parameters": "(X)", "return_statement": "return L", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "shape", "[", "0", "]", "arg_2", "=", "np", ".", "zeros", "(", "arg_0", ".", "shape", ")", "for", "arg_3", "in", "range", "(", "arg_1", ")", ":", "arg_2", "[", "arg_3", ",", ":", "]", "=", "np", ".", "asarray", "(", "[", "arg_0", "[", "(", "arg_3", "+", "j", ")", "%", "arg_1", ",", "j", "]", "for", "j", "in", "range", "(", "arg_1", ")", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Shifts circularly the X squre matrix in order to get a\n        time-lag matrix.\"\"\"\n    arg_1 = arg_0.shape[0]\n    arg_2 = np.zeros(arg_0.shape)\n    for arg_3 in range(arg_1):\n        arg_2[arg_3, :] = np.asarray([arg_0[(arg_3 + j) % arg_1, j] for j in range(arg_1)])\n    return arg_2", "path": "msaf/algorithms/sf/segmenter.py", "identifier": "circular_shift", "docstring": "Shifts circularly the X squre matrix in order to get a\n        time-lag matrix.", "docstring_tokens": ["Shifts", "circularly", "the", "X", "squre", "matrix", "in", "order", "to", "get", "a", "time", "-", "lag", "matrix", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 260050}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-web/azure/mgmt/web/operations/top_level_domains_operations.py#L164-L245", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Gets all legal agreements that user needs to accept before purchasing a\n        domain.", "language": "python", "parameters": "(\n            self, name, include_privacy=None, for_transfer=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "**", "arg_6", ")", ":", "arg_7", "=", "models", ".", "TopLevelDomainAgreementOption", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "def", "internal_paging", "(", "arg_8", "=", "None", ",", "arg_5", "=", "False", ")", ":", "if", "not", "arg_8", ":", "arg_9", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_10", "=", "{", "'name'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"name\"", ",", "arg_1", ",", "'str'", ")", ",", "'subscriptionId'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.config.subscription_id\"", ",", "arg_0", ".", "config", ".", "subscription_id", ",", "'str'", ")", "}", "arg_9", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_9", ",", "**", "arg_10", ")", "arg_11", "=", "{", "}", "arg_11", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "else", ":", "arg_9", "=", "arg_8", "arg_11", "=", "{", "}", "arg_12", "=", "{", "}", "arg_12", "[", "'Accept'", "]", "=", "'application/json'", "arg_12", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_12", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_4", ":", "arg_12", ".", "update", "(", "arg_4", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_12", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_13", "=", "arg_0", ".", "_serialize", ".", "body", "(", "arg_7", ",", "'TopLevelDomainAgreementOption'", ")", "arg_14", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_9", ",", "arg_11", ",", "arg_12", ",", "arg_13", ")", "arg_15", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_14", ",", "stream", "=", "False", ",", "**", "arg_6", ")", "if", "arg_15", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "DefaultErrorResponseException", "(", "arg_0", ".", "_deserialize", ",", "arg_15", ")", "return", "arg_15", "arg_16", "=", "models", ".", "TldLegalAgreementPaged", "(", "internal_paging", ",", "arg_0", ".", "_deserialize", ".", "dependencies", ")", "if", "arg_5", ":", "arg_17", "=", "{", "}", "arg_18", "=", "models", ".", "TldLegalAgreementPaged", "(", "internal_paging", ",", "arg_0", ".", "_deserialize", ".", "dependencies", ",", "arg_17", ")", "return", "arg_18", "return", "arg_16"], "function": "def Func(\n            arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=False, **arg_6):\n        \"\"\"Gets all legal agreements that user needs to accept before purchasing a\n        domain.\n\n        Gets all legal agreements that user needs to accept before purchasing a\n        domain.\n\n        :param name: Name of the top-level domain.\n        :type name: str\n        :param include_privacy: If <code>true</code>, then the list of\n         agreements will include agreements for domain privacy as well;\n         otherwise, <code>false</code>.\n        :type include_privacy: bool\n        :param for_transfer: If <code>true</code>, then the list of agreements\n         will include agreements for domain transfer as well; otherwise,\n         <code>false</code>.\n        :type for_transfer: bool\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: An iterator like instance of TldLegalAgreement\n        :rtype:\n         ~azure.mgmt.web.models.TldLegalAgreementPaged[~azure.mgmt.web.models.TldLegalAgreement]\n        :raises:\n         :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`\n        \"\"\"\n        arg_7 = models.TopLevelDomainAgreementOption(arg_2=arg_2, arg_3=arg_3)\n\n        def internal_paging(arg_8=None, arg_5=False):\n\n            if not arg_8:\n                # Construct URL\n                arg_9 = arg_0.Func.metadata['url']\n                arg_10 = {\n                    'name': arg_0._serialize.url(\"name\", arg_1, 'str'),\n                    'subscriptionId': arg_0._serialize.url(\"self.config.subscription_id\", arg_0.config.subscription_id, 'str')\n                }\n                arg_9 = arg_0._client.format_url(arg_9, **arg_10)\n\n                # Construct parameters\n                arg_11 = {}\n                arg_11['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n\n            else:\n                arg_9 = arg_8\n                arg_11 = {}\n\n            # Construct headers\n            arg_12 = {}\n            arg_12['Accept'] = 'application/json'\n            arg_12['Content-Type'] = 'application/json; charset=utf-8'\n            if arg_0.config.generate_client_request_id:\n                arg_12['x-ms-client-request-id'] = str(uuid.uuid1())\n            if arg_4:\n                arg_12.update(arg_4)\n            if arg_0.config.accept_language is not None:\n                arg_12['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n            # Construct body\n            arg_13 = arg_0._serialize.body(arg_7, 'TopLevelDomainAgreementOption')\n\n            # Construct and send request\n            arg_14 = arg_0._client.post(arg_9, arg_11, arg_12, arg_13)\n            arg_15 = arg_0._client.send(arg_14, stream=False, **arg_6)\n\n            if arg_15.status_code not in [200]:\n                raise models.DefaultErrorResponseException(arg_0._deserialize, arg_15)\n\n            return arg_15\n\n        # Deserialize response\n        arg_16 = models.TldLegalAgreementPaged(internal_paging, arg_0._deserialize.dependencies)\n\n        if arg_5:\n            arg_17 = {}\n            arg_18 = models.TldLegalAgreementPaged(internal_paging, arg_0._deserialize.dependencies, arg_17)\n            return arg_18\n\n        return arg_16", "path": "azure-mgmt-web/azure/mgmt/web/operations/top_level_domains_operations.py", "identifier": "TopLevelDomainsOperations.list_agreements", "docstring": "Gets all legal agreements that user needs to accept before purchasing a\n        domain.\n\n        Gets all legal agreements that user needs to accept before purchasing a\n        domain.\n\n        :param name: Name of the top-level domain.\n        :type name: str\n        :param include_privacy: If <code>true</code>, then the list of\n         agreements will include agreements for domain privacy as well;\n         otherwise, <code>false</code>.\n        :type include_privacy: bool\n        :param for_transfer: If <code>true</code>, then the list of agreements\n         will include agreements for domain transfer as well; otherwise,\n         <code>false</code>.\n        :type for_transfer: bool\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: An iterator like instance of TldLegalAgreement\n        :rtype:\n         ~azure.mgmt.web.models.TldLegalAgreementPaged[~azure.mgmt.web.models.TldLegalAgreement]\n        :raises:\n         :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`", "docstring_tokens": ["Gets", "all", "legal", "agreements", "that", "user", "needs", "to", "accept", "before", "purchasing", "a", "domain", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260051}
{"url": "https://github.com/linjackson78/jstyleson/blob/a5aff96642684118a9a5efcb69e366f8b840346b/jstyleson.py#L4-L99", "sha": "a5aff96642684118a9a5efcb69e366f8b840346b", "docstring_summary": "Clear all comments in json_str.", "language": "python", "parameters": "(json_str)", "return_statement": "return (\"\" if isinstance(json_str, str) else u\"\").join(result_str)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", "arg_0", ")", "arg_2", "=", "False", "arg_3", "=", "True", "arg_4", "=", "False", "arg_5", "=", "False", "arg_6", "=", "False", "arg_7", "=", "False", "arg_8", "=", "False", "arg_9", "=", "None", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_0", ")", ":", "if", "arg_2", ":", "arg_2", "=", "False", "continue", "if", "arg_7", ":", "if", "arg_11", "!=", "'/'", "and", "arg_11", "!=", "'*'", ":", "arg_7", "=", "False", "arg_3", "=", "True", "continue", "if", "arg_8", ":", "if", "arg_11", "!=", "'/'", ":", "arg_8", "=", "False", "if", "arg_11", "==", "'\"'", ":", "if", "arg_3", "and", "not", "arg_2", ":", "arg_6", "=", "True", "arg_3", "=", "False", "elif", "arg_6", "and", "not", "arg_2", ":", "arg_6", "=", "False", "arg_3", "=", "True", "elif", "arg_11", "==", "'\\\\'", ":", "if", "arg_3", "or", "arg_6", ":", "arg_2", "=", "True", "elif", "arg_11", "==", "'/'", ":", "if", "arg_7", ":", "arg_7", "=", "False", "arg_4", "=", "True", "arg_3", "=", "False", "arg_9", "=", "arg_10", "-", "1", "elif", "arg_8", ":", "arg_8", "=", "False", "arg_3", "=", "True", "arg_5", "=", "False", "for", "arg_12", "in", "range", "(", "arg_9", ",", "arg_10", "+", "1", ")", ":", "arg_1", "[", "arg_12", "]", "=", "\"\"", "elif", "arg_3", ":", "arg_7", "=", "True", "arg_3", "=", "False", "elif", "arg_11", "==", "'*'", ":", "if", "arg_7", ":", "arg_7", "=", "False", "arg_5", "=", "True", "arg_3", "=", "False", "arg_9", "=", "arg_10", "-", "1", "elif", "arg_5", ":", "arg_8", "=", "True", "elif", "arg_11", "==", "'\\n'", ":", "if", "arg_4", ":", "arg_4", "=", "False", "arg_3", "=", "True", "for", "arg_12", "in", "range", "(", "arg_9", ",", "arg_10", "+", "1", ")", ":", "arg_1", "[", "arg_12", "]", "=", "\"\"", "elif", "arg_11", "==", "']'", "or", "arg_11", "==", "'}'", ":", "if", "arg_3", ":", "_remove_last_comma", "(", "arg_1", ",", "arg_10", ")", "return", "(", "\"\"", "if", "isinstance", "(", "arg_0", ",", "str", ")", "else", "u\"\"", ")", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Clear all comments in json_str.\n\n    Clear JS-style comments like // and /**/ in json_str.\n    Accept a str or unicode as input.\n\n    Args:\n        json_str: A json string of str or unicode to clean up comment\n\n    Returns:\n        str: The str without comments (or unicode if you pass in unicode)\n    \"\"\"\n    arg_1 = list(arg_0)\n    arg_2 = False\n    arg_3 = True\n    arg_4 = False\n    arg_5 = False\n    arg_6 = False\n\n    arg_7 = False\n    arg_8 = False\n\n    arg_9 = None\n\n    for arg_10, arg_11 in enumerate(arg_0):\n\n        if arg_2:  # We have just met a '\\'\n            arg_2 = False\n            continue\n\n        if arg_7:  # We have just met a '/'\n            if arg_11 != '/' and arg_11 != '*':\n                arg_7 = False\n                arg_3 = True\n                continue\n\n        if arg_8:  # We have just met a '*'\n            if arg_11 != '/':\n                arg_8 = False\n\n        if arg_11 == '\"':\n            if arg_3 and not arg_2:\n                # We are now in a string\n                arg_6 = True\n                arg_3 = False\n            elif arg_6 and not arg_2:\n                # We are now out of a string\n                arg_6 = False\n                arg_3 = True\n\n        elif arg_11 == '\\\\':\n            # '\\' should not take effect in comment\n            if arg_3 or arg_6:\n                arg_2 = True\n\n        elif arg_11 == '/':\n            if arg_7:\n                # Now we are in single line comment\n                arg_7 = False\n                arg_4 = True\n                arg_3 = False\n                arg_9 = arg_10 - 1\n            elif arg_8:\n                # Now we are out of comment\n                arg_8 = False\n                arg_3 = True\n                arg_5 = False\n                for arg_12 in range(arg_9, arg_10 + 1):\n                    arg_1[arg_12] = \"\"\n\n            elif arg_3:\n                # Now we are just one step away from comment\n                arg_7 = True\n                arg_3 = False\n\n        elif arg_11 == '*':\n            if arg_7:\n                # We are now in multi-line comment\n                arg_7 = False\n                arg_5 = True\n                arg_3 = False\n                arg_9 = arg_10 - 1\n            elif arg_5:\n                arg_8 = True\n        elif arg_11 == '\\n':\n            if arg_4:\n                arg_4 = False\n                arg_3 = True\n                for arg_12 in range(arg_9, arg_10 + 1):\n                    arg_1[arg_12] = \"\"\n        elif arg_11 == ']' or arg_11 == '}':\n            if arg_3:\n                _remove_last_comma(arg_1, arg_10)\n\n    # Show respect to original input if we are in python2\n    return (\"\" if isinstance(arg_0, str) else u\"\").join(arg_1)", "path": "jstyleson.py", "identifier": "dispose", "docstring": "Clear all comments in json_str.\n\n    Clear JS-style comments like // and /**/ in json_str.\n    Accept a str or unicode as input.\n\n    Args:\n        json_str: A json string of str or unicode to clean up comment\n\n    Returns:\n        str: The str without comments (or unicode if you pass in unicode)", "docstring_tokens": ["Clear", "all", "comments", "in", "json_str", "."], "nwo": "linjackson78/jstyleson", "score": 0.19312463662236629, "idx": 260052}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/mtm.py#L510-L515", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Subtracts an estimate of the mean from signal x at axis", "language": "python", "parameters": "(x, axis)", "return_statement": "return x - mn[tuple(padded_slice)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "slice", "(", "d", ")", "for", "d", "in", "arg_0", ".", "shape", "]", "arg_2", "[", "arg_1", "]", "=", "np", ".", "newaxis", "arg_3", "=", "np", ".", "mean", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "arg_0", "-", "arg_3", "[", "tuple", "(", "arg_2", ")", "]"], "function": "def Func(arg_0, arg_1):\n    \"Subtracts an estimate of the mean from signal x at axis\"\n    arg_2 = [slice(d) for d in arg_0.shape]\n    arg_2[arg_1] = np.newaxis\n    arg_3 = np.mean(arg_0, arg_1=arg_1)\n    return arg_0 - arg_3[tuple(arg_2)]", "path": "src/spectrum/mtm.py", "identifier": "_remove_bias", "docstring": "Subtracts an estimate of the mean from signal x at axis", "docstring_tokens": ["Subtracts", "an", "estimate", "of", "the", "mean", "from", "signal", "x", "at", "axis"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 260053}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/zipkin.py#L338-L406", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Returns the current ZipkinAttrs and generates new ones if needed.", "language": "python", "parameters": "(self)", "return_statement": "return False, None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_is_local_root_span", ":", "if", "arg_0", ".", "sample_rate", "is", "not", "None", ":", "if", "arg_0", ".", "zipkin_attrs_override", "and", "not", "arg_0", ".", "zipkin_attrs_override", ".", "is_sampled", ":", "return", "True", ",", "create_attrs_for_span", "(", "sample_rate", "=", "arg_0", ".", "sample_rate", ",", "trace_id", "=", "arg_0", ".", "zipkin_attrs_override", ".", "trace_id", ",", ")", "elif", "not", "arg_0", ".", "zipkin_attrs_override", ":", "return", "True", ",", "create_attrs_for_span", "(", "sample_rate", "=", "arg_0", ".", "sample_rate", ",", "use_128bit_trace_id", "=", "arg_0", ".", "use_128bit_trace_id", ",", ")", "if", "arg_0", ".", "firehose_handler", "and", "not", "arg_0", ".", "zipkin_attrs_override", ":", "return", "True", ",", "create_attrs_for_span", "(", "sample_rate", "=", "0.0", ",", "use_128bit_trace_id", "=", "arg_0", ".", "use_128bit_trace_id", ",", ")", "return", "False", ",", "arg_0", ".", "zipkin_attrs_override", "else", ":", "arg_1", "=", "arg_0", ".", "get_tracer", "(", ")", ".", "get_zipkin_attrs", "(", ")", "if", "arg_1", ":", "return", "False", ",", "ZipkinAttrs", "(", "trace_id", "=", "arg_1", ".", "trace_id", ",", "span_id", "=", "generate_random_64bit_string", "(", ")", ",", "parent_span_id", "=", "arg_1", ".", "span_id", ",", "flags", "=", "arg_1", ".", "flags", ",", "is_sampled", "=", "arg_1", ".", "is_sampled", ",", ")", "return", "False", ",", "None"], "function": "def Func(arg_0):\n        \"\"\"Returns the current ZipkinAttrs and generates new ones if needed.\n\n        :returns: (report_root_timestamp, zipkin_attrs)\n        :rtype: (bool, ZipkinAttrs)\n        \"\"\"\n        # This check is technically not necessary since only root spans will have\n        # sample_rate, zipkin_attrs or a transport set. But it helps making the\n        # code clearer by separating the logic for a root span from the one for a\n        # child span.\n        if arg_0._is_local_root_span:\n\n            # If sample_rate is set, we need to (re)generate a trace context.\n            # If zipkin_attrs (trace context) were passed in as argument there are\n            # 2 possibilities:\n            # is_sampled = False --> we keep the same trace_id but re-roll the dice\n            #                        for is_sampled.\n            # is_sampled = True  --> we don't want to stop sampling halfway through\n            #                        a sampled trace, so we do nothing.\n            # If no zipkin_attrs were passed in, we generate new ones and start a\n            # new trace.\n            if arg_0.sample_rate is not None:\n\n                # If this trace is not sampled, we re-roll the dice.\n                if arg_0.zipkin_attrs_override and \\\n                        not arg_0.zipkin_attrs_override.is_sampled:\n                    # This will be the root span of the trace, so we should\n                    # set timestamp and duration.\n                    return True, create_attrs_for_span(\n                        sample_rate=arg_0.sample_rate,\n                        trace_id=arg_0.zipkin_attrs_override.trace_id,\n                    )\n\n                # If zipkin_attrs_override was not passed in, we simply generate\n                # new zipkin_attrs to start a new trace.\n                elif not arg_0.zipkin_attrs_override:\n                    return True, create_attrs_for_span(\n                        sample_rate=arg_0.sample_rate,\n                        use_128bit_trace_id=arg_0.use_128bit_trace_id,\n                    )\n\n            if arg_0.firehose_handler and not arg_0.zipkin_attrs_override:\n                # If it has gotten here, the only thing that is\n                # causing a trace is the firehose. So we force a trace\n                # with sample rate of 0\n                return True, create_attrs_for_span(\n                    sample_rate=0.0,\n                    use_128bit_trace_id=arg_0.use_128bit_trace_id,\n                )\n\n            # If we arrive here it means the sample_rate was not set while\n            # zipkin_attrs_override was, so let's simply return that.\n            return False, arg_0.zipkin_attrs_override\n\n        else:\n            # Check if there's already a trace context in _context_stack.\n            arg_1 = arg_0.get_tracer().get_zipkin_attrs()\n            # If there's an existing context, let's create new zipkin_attrs\n            # with that context as parent.\n            if arg_1:\n                return False, ZipkinAttrs(\n                    trace_id=arg_1.trace_id,\n                    span_id=generate_random_64bit_string(),\n                    parent_span_id=arg_1.span_id,\n                    flags=arg_1.flags,\n                    is_sampled=arg_1.is_sampled,\n                )\n\n        return False, None", "path": "py_zipkin/zipkin.py", "identifier": "zipkin_span._get_current_context", "docstring": "Returns the current ZipkinAttrs and generates new ones if needed.\n\n        :returns: (report_root_timestamp, zipkin_attrs)\n        :rtype: (bool, ZipkinAttrs)", "docstring_tokens": ["Returns", "the", "current", "ZipkinAttrs", "and", "generates", "new", "ones", "if", "needed", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 260054}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/providers/basicaer/basicaerjob.py#L21-L37", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Decorator to ensure that a submit has been performed before\n    calling the method.", "language": "python", "parameters": "(func)", "return_statement": "return _wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "_wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_1", ".", "_future", "is", "None", ":", "raise", "JobError", "(", "\"Job not submitted yet!. You have to .submit() first!\"", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "_wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Decorator to ensure that a submit has been performed before\n    calling the method.\n\n    Args:\n        func (callable): test function to be decorated.\n\n    Returns:\n        callable: the decorated function.\n    \"\"\"\n    @functools.wraps(arg_0)\n    def _wrapper(arg_1, *arg_2, **arg_3):\n        if arg_1._future is None:\n            raise JobError(\"Job not submitted yet!. You have to .submit() first!\")\n        return arg_0(arg_1, *arg_2, **arg_3)\n    return _wrapper", "path": "qiskit/providers/basicaer/basicaerjob.py", "identifier": "requires_submit", "docstring": "Decorator to ensure that a submit has been performed before\n    calling the method.\n\n    Args:\n        func (callable): test function to be decorated.\n\n    Returns:\n        callable: the decorated function.", "docstring_tokens": ["Decorator", "to", "ensure", "that", "a", "submit", "has", "been", "performed", "before", "calling", "the", "method", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260055}
{"url": "https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1717-L1803", "sha": "0449bf2fad3e3e8dda855d4686a8869efeefd433", "docstring_summary": "Update the value and the utc timestamp of a file that is already in the Repository.\\n\n        If file is not registered in repository, and error will be thrown.\\n\n        If file is missing in the system, it will be regenerated as dump method is called.", "language": "python", "parameters": "(self, value, relativePath, name=None,\n                          description=False, klass=False,\n                          dump=False, pull=False,\n                          ACID=None, verbose=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "False", ",", "arg_6", "=", "False", ",", "arg_7", "=", "False", ",", "arg_8", "=", "None", ",", "arg_9", "=", "False", ")", ":", "if", "arg_8", "is", "None", ":", "arg_8", "=", "arg_0", ".", "__ACID", "assert", "isinstance", "(", "arg_8", ",", "bool", ")", ",", "\"ACID must be boolean\"", "arg_2", "=", "os", ".", "path", ".", "normpath", "(", "arg_2", ")", "if", "arg_2", "==", "'.'", ":", "arg_2", "=", "''", "assert", "arg_3", "!=", "'.pyrepinfo'", ",", "\"'.pyrepinfo' is not allowed as file name in main repository directory\"", "assert", "arg_3", "!=", "'.pyrepstate'", ",", "\"'.pyrepstate' is not allowed as file name in main repository directory\"", "assert", "arg_3", "!=", "'.pyreplock'", ",", "\"'.pyreplock' is not allowed as file name in main repository directory\"", "if", "arg_3", "is", "None", ":", "assert", "len", "(", "arg_2", ")", ",", "\"name must be given when relative path is given as empty string or as a simple dot '.'\"", "arg_2", ",", "arg_3", "=", "os", ".", "path", ".", "split", "(", "arg_2", ")", "arg_10", ",", "arg_11", "=", "arg_0", ".", "get_file_info", "(", "arg_2", ",", "arg_3", ")", "assert", "arg_10", "is", "not", "None", ",", "arg_11", "arg_12", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "__path", ",", "arg_2", ")", "if", "arg_9", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "arg_12", ",", "arg_3", ")", ")", ":", "warnings", ".", "warn", "(", "\"file '%s' is in repository but does not exist in the system. It is therefore being recreated.\"", "%", "os", ".", "path", ".", "join", "(", "arg_12", ",", "arg_3", ")", ")", "if", "not", "arg_6", ":", "arg_6", "=", "arg_10", "[", "\"dump\"", "]", "if", "not", "arg_7", ":", "arg_7", "=", "arg_10", "[", "\"pull\"", "]", "if", "arg_8", ":", "arg_13", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "arg_3", ")", "else", ":", "arg_13", "=", "os", ".", "path", ".", "join", "(", "arg_12", ",", "arg_3", ")", "try", ":", "exec", "(", "arg_6", ".", "replace", "(", "\"$FILE_PATH\"", ",", "str", "(", "arg_13", ")", ")", ")", "except", "Exception", "as", "e", ":", "arg_14", "=", "\"unable to dump the file (%s)\"", "%", "e", "if", "'pickle.dump('", "in", "arg_6", ":", "arg_14", "+=", "'\\nmore info: %s'", "%", "str", "(", "get_pickling_errors", "(", "arg_1", ")", ")", "raise", "Exception", "(", "arg_14", ")", "if", "arg_8", ":", "try", ":", "shutil", ".", "copyfile", "(", "arg_13", ",", "os", ".", "path", ".", "join", "(", "arg_12", ",", "arg_3", ")", ")", "except", "Exception", "as", "e", ":", "os", ".", "remove", "(", "arg_13", ")", "if", "arg_9", ":", "warnings", ".", "warn", "(", "e", ")", "return", "os", ".", "remove", "(", "arg_13", ")", "arg_10", "[", "\"timestamp\"", "]", "=", "datetime", ".", "utcnow", "(", ")", "if", "arg_4", "is", "not", "False", ":", "arg_10", "[", "\"description\"", "]", "=", "arg_4", "if", "arg_5", "is", "not", "False", ":", "assert", "inspect", ".", "isclass", "(", "arg_5", ")", ",", "\"klass must be a class definition\"", "arg_10", "[", "\"class\"", "]", "=", "arg_5", "arg_0", ".", "save", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None,\n                          arg_4=False, arg_5=False,\n                          arg_6=False, arg_7=False,\n                          arg_8=None, arg_9=False):\n        \"\"\"\n        Update the value and the utc timestamp of a file that is already in the Repository.\\n\n        If file is not registered in repository, and error will be thrown.\\n\n        If file is missing in the system, it will be regenerated as dump method is called.\n\n        :Parameters:\n            #. value (object): The value of the file to update. It is any python object or a file.\n            #. relativePath (str): The relative to the repository path of the directory where the file should be dumped.\n            #. name (None, string): The file name.\n               If None is given, name will be split from relativePath.\n            #. description (False, string, pickable object): Any random description about the file.\n               If False is given, the description info won't be updated,\n               otherwise it will be update to what description argument value is.\n            #. klass (False, class): The dumped object class. If False is given,\n               the class info won't be updated, otherwise it will be update to what klass argument value is.\n            #. dump (False, string): The new dump method. If False is given, the old one will be used.\n            #. pull (False, string): The new pull method. If False is given, the old one will be used.\n            #. ACID (boolean): Whether to ensure the ACID (Atomicity, Consistency, Isolation, Durability)\n               properties of the repository upon dumping a file. This is ensured by dumping the file in\n               a temporary path first and then moving it to the desired path.\n               If None is given, repository ACID property will be used.\n            #. verbose (boolean): Whether to be warn and informed about any abnormalities.\n        \"\"\"\n        # check ACID\n        if arg_8 is None:\n            arg_8 = arg_0.__ACID\n        assert isinstance(arg_8, bool), \"ACID must be boolean\"\n        # get relative path normalized\n        arg_2 = os.path.normpath(arg_2)\n        if arg_2 == '.':\n            arg_2 = ''\n            assert arg_3 != '.pyrepinfo', \"'.pyrepinfo' is not allowed as file name in main repository directory\"\n            assert arg_3 != '.pyrepstate', \"'.pyrepstate' is not allowed as file name in main repository directory\"\n            assert arg_3 != '.pyreplock', \"'.pyreplock' is not allowed as file name in main repository directory\"\n        if arg_3 is None:\n            assert len(arg_2), \"name must be given when relative path is given as empty string or as a simple dot '.'\"\n            arg_2,arg_3 = os.path.split(arg_2)\n        # get file info dict\n        arg_10, arg_11 = arg_0.get_file_info(arg_2, arg_3)\n        assert arg_10 is not None, arg_11\n        # get real path\n        arg_12 = os.path.join(arg_0.__path, arg_2)\n        # check if file exists\n        if arg_9:\n            if not os.path.isfile( os.path.join(arg_12, arg_3) ):\n                warnings.warn(\"file '%s' is in repository but does not exist in the system. It is therefore being recreated.\"%os.path.join(arg_12, arg_3))\n        # convert dump and pull methods to strings\n        if not arg_6:\n            arg_6 = arg_10[\"dump\"]\n        if not arg_7:\n            arg_7 = arg_10[\"pull\"]\n        # get savePath\n        if arg_8:\n            arg_13 = os.path.join(tempfile.gettempdir(), arg_3)\n        else:\n            arg_13 = os.path.join(arg_12,arg_3)\n        # dump file\n        try:\n            exec( arg_6.replace(\"$FILE_PATH\", str(arg_13)) )\n        except Exception as e:\n            arg_14 = \"unable to dump the file (%s)\"%e\n            if 'pickle.dump(' in arg_6:\n                arg_14 += '\\nmore info: %s'%str(get_pickling_errors(arg_1))\n            raise Exception( arg_14 )\n        # copy if ACID\n        if arg_8:\n            try:\n                shutil.copyfile(arg_13, os.path.join(arg_12,arg_3))\n            except Exception as e:\n                os.remove(arg_13)\n                if arg_9:\n                    warnings.warn(e)\n                return\n            os.remove(arg_13)\n        # update timestamp\n        arg_10[\"timestamp\"] = datetime.utcnow()\n        if arg_4 is not False:\n            arg_10[\"description\"] = arg_4\n        if arg_5 is not False:\n            assert inspect.isclass(arg_5), \"klass must be a class definition\"\n            arg_10[\"class\"] = arg_5\n        # save repository\n        arg_0.save()", "path": "OldRepository.py", "identifier": "Repository.update_file", "docstring": "Update the value and the utc timestamp of a file that is already in the Repository.\\n\n        If file is not registered in repository, and error will be thrown.\\n\n        If file is missing in the system, it will be regenerated as dump method is called.\n\n        :Parameters:\n            #. value (object): The value of the file to update. It is any python object or a file.\n            #. relativePath (str): The relative to the repository path of the directory where the file should be dumped.\n            #. name (None, string): The file name.\n               If None is given, name will be split from relativePath.\n            #. description (False, string, pickable object): Any random description about the file.\n               If False is given, the description info won't be updated,\n               otherwise it will be update to what description argument value is.\n            #. klass (False, class): The dumped object class. If False is given,\n               the class info won't be updated, otherwise it will be update to what klass argument value is.\n            #. dump (False, string): The new dump method. If False is given, the old one will be used.\n            #. pull (False, string): The new pull method. If False is given, the old one will be used.\n            #. ACID (boolean): Whether to ensure the ACID (Atomicity, Consistency, Isolation, Durability)\n               properties of the repository upon dumping a file. This is ensured by dumping the file in\n               a temporary path first and then moving it to the desired path.\n               If None is given, repository ACID property will be used.\n            #. verbose (boolean): Whether to be warn and informed about any abnormalities.", "docstring_tokens": ["Update", "the", "value", "and", "the", "utc", "timestamp", "of", "a", "file", "that", "is", "already", "in", "the", "Repository", ".", "\\", "n", "If", "file", "is", "not", "registered", "in", "repository", "and", "error", "will", "be", "thrown", ".", "\\", "n", "If", "file", "is", "missing", "in", "the", "system", "it", "will", "be", "regenerated", "as", "dump", "method", "is", "called", "."], "nwo": "bachiraoun/pyrep", "score": 0.2619419494340654, "idx": 260056}
{"url": "https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/mod/communicator.py#L148-L162", "sha": "e3e35835e5ac24158848afed4f905ca44ac3ae00", "docstring_summary": "Uploads file to GDocs spreadsheet.\n        Content type can be provided as argument, default is ods.", "language": "python", "parameters": "(\n            self, file_path,\n            content_type='application/x-vnd.oasis.opendocument.spreadsheet')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'application/x-vnd.oasis.opendocument.spreadsheet'", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "gd_client", ".", "GetResourceById", "(", "arg_0", ".", "key", ")", "arg_4", "=", "gdata", ".", "data", ".", "MediaSource", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "gd_client", ".", "UpdateResource", "(", "arg_3", ",", "arg_4", "=", "arg_4", ",", "update_metadata", "=", "True", ")", "except", "(", "RequestError", ",", "IOError", ")", "as", "e", ":", "raise", "PODocsError", "(", "e", ")"], "function": "def Func(\n            arg_0, arg_1,\n            arg_2='application/x-vnd.oasis.opendocument.spreadsheet'):\n        \"\"\"\n        Uploads file to GDocs spreadsheet.\n        Content type can be provided as argument, default is ods.\n        \"\"\"\n        try:\n            arg_3 = arg_0.gd_client.GetResourceById(arg_0.key)\n            arg_4 = gdata.data.MediaSource(\n                arg_1=arg_1, arg_2=arg_2)\n            arg_0.gd_client.UpdateResource(\n                arg_3, arg_4=arg_4, update_metadata=True)\n        except (RequestError, IOError) as e:\n            raise PODocsError(e)", "path": "c3po/mod/communicator.py", "identifier": "Communicator._upload_file_to_gdoc", "docstring": "Uploads file to GDocs spreadsheet.\n        Content type can be provided as argument, default is ods.", "docstring_tokens": ["Uploads", "file", "to", "GDocs", "spreadsheet", ".", "Content", "type", "can", "be", "provided", "as", "argument", "default", "is", "ods", "."], "nwo": "VorskiImagineering/C3PO", "score": 0.0, "idx": 260057}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/application.py#L168-L173", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "ensure flags dict is valid", "language": "python", "parameters": "(self, name, old, new)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "iteritems", "(", ")", ":", "assert", "len", "(", "arg_5", ")", "==", "2", ",", "\"Bad flag: %r:%s\"", "%", "(", "arg_4", ",", "arg_5", ")", "assert", "isinstance", "(", "arg_5", "[", "0", "]", ",", "(", "dict", ",", "Config", ")", ")", ",", "\"Bad flag: %r:%s\"", "%", "(", "arg_4", ",", "arg_5", ")", "assert", "isinstance", "(", "arg_5", "[", "1", "]", ",", "basestring", ")", ",", "\"Bad flag: %r:%s\"", "%", "(", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"ensure flags dict is valid\"\"\"\n        for arg_4,arg_5 in arg_3.iteritems():\n            assert len(arg_5) == 2, \"Bad flag: %r:%s\"%(arg_4,arg_5)\n            assert isinstance(arg_5[0], (dict, Config)), \"Bad flag: %r:%s\"%(arg_4,arg_5)\n            assert isinstance(arg_5[1], basestring), \"Bad flag: %r:%s\"%(arg_4,arg_5)", "path": "environment/lib/python2.7/site-packages/IPython/config/application.py", "identifier": "Application._flags_changed", "docstring": "ensure flags dict is valid", "docstring_tokens": ["ensure", "flags", "dict", "is", "valid"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260058}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L254-L275", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "template apiserver.hcl", "language": "python", "parameters": "(cl_args, masters, zookeepers)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", "[", "0", "]", "arg_4", "=", "\"%s/standalone/templates/apiserver.template.hcl\"", "%", "arg_0", "[", "\"config_path\"", "]", "arg_5", "=", "\"%s/standalone/resources/apiserver.hcl\"", "%", "arg_0", "[", "\"config_path\"", "]", "arg_6", "=", "{", "\"<heron_apiserver_hostname>\"", ":", "'\"%s\"'", "%", "get_hostname", "(", "arg_3", ",", "arg_0", ")", ",", "\"<heron_apiserver_executable>\"", ":", "'\"%s/heron-apiserver\"'", "%", "config", ".", "get_heron_bin_dir", "(", ")", "if", "is_self", "(", "arg_3", ")", "else", "'\"%s/.heron/bin/heron-apiserver\"'", "%", "get_remote_home", "(", "arg_3", ",", "arg_0", ")", ",", "\"<zookeeper_host:zookeeper_port>\"", ":", "\",\"", ".", "join", "(", "[", "'%s'", "%", "zk", "if", "\":\"", "in", "zk", "else", "'%s:2181'", "%", "zk", "for", "zk", "in", "arg_2", "]", ")", ",", "\"<scheduler_uri>\"", ":", "\"http://%s:4646\"", "%", "arg_3", "}", "template_file", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  \"\"\"\n  template apiserver.hcl\n  \"\"\"\n  arg_3 = arg_1[0]\n  arg_4 = \"%s/standalone/templates/apiserver.template.hcl\" \\\n                              % arg_0[\"config_path\"]\n  arg_5 = \"%s/standalone/resources/apiserver.hcl\" % arg_0[\"config_path\"]\n\n  arg_6 = {\n      \"<heron_apiserver_hostname>\": '\"%s\"' % get_hostname(arg_3, arg_0),\n      \"<heron_apiserver_executable>\": '\"%s/heron-apiserver\"'\n                                      % config.get_heron_bin_dir()\n                                      if is_self(arg_3)\n                                      else '\"%s/.heron/bin/heron-apiserver\"'\n                                      % get_remote_home(arg_3, arg_0),\n      \"<zookeeper_host:zookeeper_port>\": \",\".join(\n          ['%s' % zk if \":\" in zk else '%s:2181' % zk for zk in arg_2]),\n      \"<scheduler_uri>\": \"http://%s:4646\" % arg_3\n  }\n\n  template_file(arg_4, arg_5, arg_6)", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "template_apiserver_hcl", "docstring": "template apiserver.hcl", "docstring_tokens": ["template", "apiserver", ".", "hcl"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260059}
{"url": "https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/api_call.py#L204-L208", "sha": "b01ca65b442eed19faac309c9d62bbc3cb2c098f", "docstring_summary": "HTTP Put Request", "language": "python", "parameters": "(self)", "return_statement": "return requests.put(self._url, data=self._data, headers=self._headers, auth=(self._email, self._api_token))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "requests", ".", "put", "(", "arg_0", ".", "_url", ",", "data", "=", "arg_0", ".", "_data", ",", "headers", "=", "arg_0", ".", "_headers", ",", "auth", "=", "(", "arg_0", ".", "_email", ",", "arg_0", ".", "_api_token", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        HTTP Put Request\n        \"\"\"\n        return requests.put(arg_0._url, data=arg_0._data, headers=arg_0._headers, auth=(arg_0._email, arg_0._api_token))", "path": "boundary/api_call.py", "identifier": "ApiCall._do_put", "docstring": "HTTP Put Request", "docstring_tokens": ["HTTP", "Put", "Request"], "nwo": "boundary/pulse-api-cli", "score": 0.17782712273869106, "idx": 260060}
{"url": "https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/iam/managed_policy.py#L21-L43", "sha": "c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea", "docstring_summary": "Fetch the base Managed Policy.", "language": "python", "parameters": "(managed_policy, **conn)", "return_statement": "return managed_policy", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_0", "[", "'_version'", "]", "=", "1", "arg_2", "=", "_get_name_from_structure", "(", "arg_0", ",", "'Arn'", ")", "arg_3", "=", "get_policy", "(", "arg_2", ",", "**", "arg_1", ")", "arg_4", "=", "get_managed_policy_document", "(", "arg_2", ",", "policy_metadata", "=", "arg_3", ",", "**", "arg_1", ")", "arg_0", ".", "update", "(", "arg_3", "[", "'Policy'", "]", ")", "arg_0", "[", "'Document'", "]", "=", "arg_4", "arg_0", "[", "'CreateDate'", "]", "=", "get_iso_string", "(", "arg_0", "[", "'CreateDate'", "]", ")", "arg_0", "[", "'UpdateDate'", "]", "=", "get_iso_string", "(", "arg_0", "[", "'UpdateDate'", "]", ")", "return", "arg_0"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Fetch the base Managed Policy.\n\n    This includes the base policy and the latest version document.\n\n    :param managed_policy:\n    :param conn:\n    :return:\n    \"\"\"\n    arg_0['_version'] = 1\n\n    arg_2 = _get_name_from_structure(arg_0, 'Arn')\n    arg_3 = get_policy(arg_2, **arg_1)\n    arg_4 = get_managed_policy_document(arg_2, policy_metadata=arg_3, **arg_1)\n\n    arg_0.update(arg_3['Policy'])\n    arg_0['Document'] = arg_4\n\n    # Fix the dates:\n    arg_0['CreateDate'] = get_iso_string(arg_0['CreateDate'])\n    arg_0['UpdateDate'] = get_iso_string(arg_0['UpdateDate'])\n\n    return arg_0", "path": "cloudaux/orchestration/aws/iam/managed_policy.py", "identifier": "get_base", "docstring": "Fetch the base Managed Policy.\n\n    This includes the base policy and the latest version document.\n\n    :param managed_policy:\n    :param conn:\n    :return:", "docstring_tokens": ["Fetch", "the", "base", "Managed", "Policy", "."], "nwo": "Netflix-Skunkworks/cloudaux", "score": 0.7633097402574357, "idx": 260061}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/provider.py#L186-L189", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Return a list of all bluez DBus objects from the provided list of paths.", "language": "python", "parameters": "(self, paths)", "return_statement": "return map(lambda x: self._bus.get_object('org.bluez', x), paths)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "map", "(", "lambda", "x", ":", "arg_0", ".", "_bus", ".", "get_object", "(", "'org.bluez'", ",", "x", ")", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return a list of all bluez DBus objects from the provided list of paths.\n        \"\"\"\n        return map(lambda x: arg_0._bus.get_object('org.bluez', x), arg_1)", "path": "Adafruit_BluefruitLE/bluez_dbus/provider.py", "identifier": "BluezProvider._get_objects_by_path", "docstring": "Return a list of all bluez DBus objects from the provided list of paths.", "docstring_tokens": ["Return", "a", "list", "of", "all", "bluez", "DBus", "objects", "from", "the", "provided", "list", "of", "paths", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 260062}
{"url": "https://github.com/charlesthomas/proauth2/blob/f88c8df966a1802414047ed304d02df1dd520097/proauth2/async_proauth2.py#L131-L147", "sha": "f88c8df966a1802414047ed304d02df1dd520097", "docstring_summary": "_auth - internal method to ensure the client_id and client_secret passed with\n        the nonce match", "language": "python", "parameters": "(self, client_id, key, method, callback)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "auth_methods", ".", "keys", "(", ")", "if", "arg_3", "not", "in", "arg_5", ":", "raise", "Proauth2Error", "(", "'invalid_request'", ",", "'unsupported authentication method: %s'", "'available methods: %s'", "%", "(", "arg_3", ",", "'\\n'", ".", "join", "(", "arg_5", ")", ")", ")", "arg_6", "=", "yield", "Task", "(", "arg_0", ".", "data_store", ".", "fetch", ",", "'applications'", ",", "arg_1", "=", "arg_1", ")", "if", "not", "arg_6", ":", "raise", "Proauth2Error", "(", "'access_denied'", ")", "if", "not", "auth_methods", "[", "arg_3", "]", "(", "arg_2", ",", "arg_6", "[", "'client_secret'", "]", ")", ":", "raise", "Proauth2Error", "(", "'access_denied'", ")", "arg_4", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        '''\n        Func - internal method to ensure the client_id and client_secret passed with\n        the nonce match\n        '''\n        arg_5 = auth_methods.keys()\n        if arg_3 not in arg_5:\n            raise Proauth2Error('invalid_request',\n                                'unsupported authentication method: %s'\n                                'available methods: %s' % \\\n                                (arg_3, '\\n'.join(arg_5)))\n        arg_6 = yield Task(arg_0.data_store.fetch, 'applications',\n                            arg_1=arg_1)\n        if not arg_6: raise Proauth2Error('access_denied')\n        if not auth_methods[arg_3](arg_2, arg_6['client_secret']):\n            raise Proauth2Error('access_denied')\n        arg_4()", "path": "proauth2/async_proauth2.py", "identifier": "AsyncProauth2._auth", "docstring": "_auth - internal method to ensure the client_id and client_secret passed with\n        the nonce match", "docstring_tokens": ["_auth", "-", "internal", "method", "to", "ensure", "the", "client_id", "and", "client_secret", "passed", "with", "the", "nonce", "match"], "nwo": "charlesthomas/proauth2", "score": 0.0, "idx": 260063}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L624-L678", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Fast CuDNN LSTM implementation", "language": "python", "parameters": "(units, n_hidden, n_layers=1, trainable_initial_states=None, seq_lengths=None, initial_h=None,\n               initial_c=None, name='cudnn_lstm', reuse=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "'Func'", ",", "arg_8", "=", "False", ")", ":", "with", "tf", ".", "variable_scope", "(", "arg_7", ",", "arg_8", "=", "arg_8", ")", ":", "arg_9", "=", "tf", ".", "contrib", ".", "cudnn_rnn", ".", "CudnnLSTM", "(", "num_layers", "=", "arg_2", ",", "num_units", "=", "arg_1", ")", "if", "arg_3", ":", "arg_10", "=", "tf", ".", "get_variable", "(", "'init_h'", ",", "[", "arg_2", ",", "1", ",", "arg_1", "]", ")", "arg_10", "=", "tf", ".", "tile", "(", "arg_10", ",", "(", "1", ",", "tf", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", "arg_11", "=", "tf", ".", "get_variable", "(", "'init_c'", ",", "[", "arg_2", ",", "1", ",", "arg_1", "]", ")", "arg_11", "=", "tf", ".", "tile", "(", "arg_11", ",", "(", "1", ",", "tf", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "1", ")", ")", "else", ":", "arg_10", "=", "arg_11", "=", "tf", ".", "zeros", "(", "[", "arg_2", ",", "tf", ".", "shape", "(", "arg_0", ")", "[", "0", "]", ",", "arg_1", "]", ")", "arg_5", "=", "arg_5", "or", "arg_10", "arg_6", "=", "arg_6", "or", "arg_11", "arg_12", ",", "(", "arg_13", ",", "arg_14", ")", "=", "arg_9", "(", "tf", ".", "transpose", "(", "arg_0", ",", "(", "1", ",", "0", ",", "2", ")", ")", ",", "(", "arg_5", ",", "arg_6", ")", ")", "arg_12", "=", "tf", ".", "transpose", "(", "arg_12", ",", "(", "1", ",", "0", ",", "2", ")", ")", "arg_13", "=", "arg_13", "[", "-", "1", "]", "arg_14", "=", "arg_14", "[", "-", "1", "]", "if", "arg_4", "is", "not", "None", ":", "arg_15", "=", "tf", ".", "stack", "(", "[", "tf", ".", "range", "(", "tf", ".", "shape", "(", "arg_12", ")", "[", "0", "]", ")", ",", "arg_4", "-", "1", "]", ",", "axis", "=", "1", ")", "arg_13", "=", "tf", ".", "gather_nd", "(", "arg_12", ",", "arg_15", ")", "return", "arg_12", ",", "(", "arg_13", ",", "arg_14", ")"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=None, arg_4=None, arg_5=None,\n               arg_6=None, arg_7='Func', arg_8=False):\n    \"\"\" Fast CuDNN LSTM implementation\n\n        Args:\n            units: tf.Tensor with dimensions [B x T x F], where\n                B - batch size\n                T - number of tokens\n                F - features\n            n_hidden: dimensionality of hidden state\n            n_layers: number of layers\n            trainable_initial_states: whether to create a special trainable variable\n                to initialize the hidden states of the network or use just zeros\n            seq_lengths: tensor of sequence lengths with dimension [B]\n            initial_h: optional initial hidden state, masks trainable_initial_states\n                if provided\n            initial_c: optional initial cell state, masks trainable_initial_states\n                if provided\n            name: name of the variable scope to use\n            reuse:whether to reuse already initialized variable\n\n\n        Returns:\n            h - all hidden states along T dimension,\n                tf.Tensor with dimensionality [B x T x F]\n            h_last - last hidden state, tf.Tensor with dimensionality [B x H]\n                where H - number of hidden units\n            c_last - last cell state, tf.Tensor with dimensionality [B x H]\n                where H - number of hidden units\n        \"\"\"\n    with tf.variable_scope(arg_7, arg_8=arg_8):\n        arg_9 = tf.contrib.cudnn_rnn.CudnnLSTM(num_layers=arg_2,\n                                              num_units=arg_1)\n        if arg_3:\n            arg_10 = tf.get_variable('init_h', [arg_2, 1, arg_1])\n            arg_10 = tf.tile(arg_10, (1, tf.shape(arg_0)[0], 1))\n            arg_11 = tf.get_variable('init_c', [arg_2, 1, arg_1])\n            arg_11 = tf.tile(arg_11, (1, tf.shape(arg_0)[0], 1))\n        else:\n            arg_10 = arg_11 = tf.zeros([arg_2, tf.shape(arg_0)[0], arg_1])\n\n        arg_5 = arg_5 or arg_10\n        arg_6 = arg_6 or arg_11\n\n        arg_12, (arg_13, arg_14) = arg_9(tf.transpose(arg_0, (1, 0, 2)), (arg_5, arg_6))\n        arg_12 = tf.transpose(arg_12, (1, 0, 2))\n        arg_13 = arg_13[-1]\n        arg_14 = arg_14[-1]\n\n        # Extract last states if they are provided\n        if arg_4 is not None:\n            arg_15 = tf.stack([tf.range(tf.shape(arg_12)[0]), arg_4-1], axis=1)\n            arg_13 = tf.gather_nd(arg_12, arg_15)\n\n        return arg_12, (arg_13, arg_14)", "path": "deeppavlov/core/layers/tf_layers.py", "identifier": "cudnn_lstm", "docstring": "Fast CuDNN LSTM implementation\n\n        Args:\n            units: tf.Tensor with dimensions [B x T x F], where\n                B - batch size\n                T - number of tokens\n                F - features\n            n_hidden: dimensionality of hidden state\n            n_layers: number of layers\n            trainable_initial_states: whether to create a special trainable variable\n                to initialize the hidden states of the network or use just zeros\n            seq_lengths: tensor of sequence lengths with dimension [B]\n            initial_h: optional initial hidden state, masks trainable_initial_states\n                if provided\n            initial_c: optional initial cell state, masks trainable_initial_states\n                if provided\n            name: name of the variable scope to use\n            reuse:whether to reuse already initialized variable\n\n\n        Returns:\n            h - all hidden states along T dimension,\n                tf.Tensor with dimensionality [B x T x F]\n            h_last - last hidden state, tf.Tensor with dimensionality [B x H]\n                where H - number of hidden units\n            c_last - last cell state, tf.Tensor with dimensionality [B x H]\n                where H - number of hidden units", "docstring_tokens": ["Fast", "CuDNN", "LSTM", "implementation"], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 260064}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/http/response.py#L364-L386", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Flush the write buffers of the stream.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "require_not_closed", "(", ")", "arg_1", "=", "arg_0", ".", "_stream", ".", "getvalue", "(", ")", "arg_0", ".", "_stream", ".", "truncate", "(", "0", ")", "arg_0", ".", "_stream", ".", "seek", "(", "0", ")", "arg_0", ".", "body", "=", "arg_1", "if", "(", "arg_0", ".", "_body", "is", "None", ")", "else", "(", "arg_0", ".", "_body", "+", "arg_1", ")", "if", "arg_0", ".", "asynchronous", ":", "arg_0", ".", "streaming", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"Flush the write buffers of the stream.\n\n        This results in writing the current contents of the write buffer to\n        the transport layer, initiating the HTTP/1.1 response. This initiates\n        a streaming response. If the `Content-Length` header is not given\n        then the chunked `Transfer-Encoding` is applied.\n        \"\"\"\n\n        # Ensure we're not closed.\n        arg_0.require_not_closed()\n\n        # Pull out the accumulated chunk.\n        arg_1 = arg_0._stream.getvalue()\n        arg_0._stream.truncate(0)\n        arg_0._stream.seek(0)\n\n        # Append the chunk to the body.\n        arg_0.body = arg_1 if (arg_0._body is None) else (arg_0._body + arg_1)\n\n        if arg_0.asynchronous:\n            # We are now streaming because we're asynchronous.\n            arg_0.streaming = True", "path": "armet/http/response.py", "identifier": "Response.flush", "docstring": "Flush the write buffers of the stream.\n\n        This results in writing the current contents of the write buffer to\n        the transport layer, initiating the HTTP/1.1 response. This initiates\n        a streaming response. If the `Content-Length` header is not given\n        then the chunked `Transfer-Encoding` is applied.", "docstring_tokens": ["Flush", "the", "write", "buffers", "of", "the", "stream", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 260065}
{"url": "https://github.com/Rikanishu/static-bundle/blob/2f6458cb9d9d9049b4fd829f7d6951a45d547c68/static_bundle/utils.py#L33-L42", "sha": "2f6458cb9d9d9049b4fd829f7d6951a45d547c68", "docstring_summary": "Write helper method", "language": "python", "parameters": "(file_path, contents, encoding=\"utf-8\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"utf-8\"", ")", ":", "with", "codecs", ".", "open", "(", "arg_0", ",", "\"w\"", ",", "arg_2", ")", "as", "f", ":", "f", ".", "write", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=\"utf-8\"):\n    \"\"\"\n    Write helper method\n\n    :type file_path: str|unicode\n    :type contents: str|unicode\n    :type encoding: str|unicode\n    \"\"\"\n    with codecs.open(arg_0, \"w\", arg_2) as f:\n        f.write(arg_1)", "path": "static_bundle/utils.py", "identifier": "write_to_file", "docstring": "Write helper method\n\n    :type file_path: str|unicode\n    :type contents: str|unicode\n    :type encoding: str|unicode", "docstring_tokens": ["Write", "helper", "method"], "nwo": "Rikanishu/static-bundle", "score": 0.0, "idx": 260066}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_kvlayer_keyword_search.py#L238-L251", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Get stream IDs and term frequencies for a single hash.", "language": "python", "parameters": "(self, h)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "(", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ",", "arg_5", ")", "in", "arg_0", ".", "client", ".", "scan", "(", "HASH_TF_INDEX_TABLE", ",", "(", "(", "arg_1", ",", ")", ",", "(", "arg_1", ",", ")", ")", ")", ":", "yield", "(", "kvlayer_key_to_stream_id", "(", "(", "arg_3", ",", "arg_4", ")", ")", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        '''Get stream IDs and term frequencies for a single hash.\n\n        This yields pairs of strings that can be retrieved using\n        :func:`streamcorpus_pipeline._kvlayer.get_kvlayer_stream_item`\n        and the corresponding term frequency.\n\n        ..see:: :meth:`lookup`\n\n\n        '''\n        for ((arg_2, arg_3, arg_4), arg_5) in arg_0.client.scan(HASH_TF_INDEX_TABLE,\n                                                 ((arg_1,), (arg_1,))):\n            yield (kvlayer_key_to_stream_id((arg_3, arg_4)), arg_5)", "path": "streamcorpus_pipeline/_kvlayer_keyword_search.py", "identifier": "keyword_indexer.lookup_tf", "docstring": "Get stream IDs and term frequencies for a single hash.\n\n        This yields pairs of strings that can be retrieved using\n        :func:`streamcorpus_pipeline._kvlayer.get_kvlayer_stream_item`\n        and the corresponding term frequency.\n\n        ..see:: :meth:`lookup`", "docstring_tokens": ["Get", "stream", "IDs", "and", "term", "frequencies", "for", "a", "single", "hash", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 260067}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L873-L892", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup a regular padded grid from a 2D array shape, psf-shape and pixel-scale.", "language": "python", "parameters": "(cls, shape, psf_shape, pixel_scale)", "return_statement": "return PaddedRegularGrid(arr=padded_regular_grid, mask=padded_mask, image_shape=shape)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "(", "arg_1", "[", "0", "]", "+", "arg_2", "[", "0", "]", "-", "1", ",", "arg_1", "[", "1", "]", "+", "arg_2", "[", "1", "]", "-", "1", ")", "arg_5", "=", "grid_util", ".", "regular_grid_1d_masked_from_mask_pixel_scales_and_origin", "(", "mask", "=", "np", ".", "full", "(", "arg_4", ",", "False", ")", ",", "pixel_scales", "=", "(", "arg_3", ",", "arg_3", ")", ")", "arg_6", "=", "msk", ".", "Mask", ".", "unmasked_for_shape_and_pixel_scale", "(", "arg_1", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")", "return", "PaddedRegularGrid", "(", "arr", "=", "arg_5", ",", "mask", "=", "arg_6", ",", "image_shape", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Setup a regular padded grid from a 2D array shape, psf-shape and pixel-scale.\n\n        The center of every pixel is used to setup the grid's (y,x) arc-second coordinates, including padded pixels \\\n        which are beyond the input shape but will blurred light into the 2D array's shape due to the psf.\n\n        Parameters\n        ----------\n        shape : (int, int)\n            The (y,x) shape of the masked-grid's 2D image in units of pixels.\n        psf_shape : (int, int)\n           The shape of the psf which defines the blurring region and therefore size of padding.\n        pixel_scale : float\n            The scale of each pixel in arc seconds\n        \"\"\"\n        arg_4 = (arg_1[0] + arg_2[0] - 1, arg_1[1] + arg_2[1] - 1)\n        arg_5 = grid_util.regular_grid_1d_masked_from_mask_pixel_scales_and_origin(\n            mask=np.full(arg_4, False), pixel_scales=(arg_3, arg_3))\n        arg_6 = msk.Mask.unmasked_for_shape_and_pixel_scale(arg_1=arg_4, arg_3=arg_3)\n        return PaddedRegularGrid(arr=arg_5, mask=arg_6, image_shape=arg_1)", "path": "autolens/data/array/grids.py", "identifier": "PaddedRegularGrid.padded_grid_from_shape_psf_shape_and_pixel_scale", "docstring": "Setup a regular padded grid from a 2D array shape, psf-shape and pixel-scale.\n\n        The center of every pixel is used to setup the grid's (y,x) arc-second coordinates, including padded pixels \\\n        which are beyond the input shape but will blurred light into the 2D array's shape due to the psf.\n\n        Parameters\n        ----------\n        shape : (int, int)\n            The (y,x) shape of the masked-grid's 2D image in units of pixels.\n        psf_shape : (int, int)\n           The shape of the psf which defines the blurring region and therefore size of padding.\n        pixel_scale : float\n            The scale of each pixel in arc seconds", "docstring_tokens": ["Setup", "a", "regular", "padded", "grid", "from", "a", "2D", "array", "shape", "psf", "-", "shape", "and", "pixel", "-", "scale", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 260068}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/id3.py#L222-L227", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Deprecated; use the add method.", "language": "python", "parameters": "(self, tag)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "type", "(", "arg_1", ")", ".", "__name__", ")", "==", "3", ":", "arg_1", "=", "type", "(", "arg_1", ")", ".", "__base__", "(", "arg_1", ")", "arg_0", "[", "arg_1", ".", "HashKey", "]", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Deprecated; use the add method.\"\"\"\n        # turn 2.2 into 2.3/2.4 tags\n        if len(type(arg_1).__name__) == 3:\n            arg_1 = type(arg_1).__base__(arg_1)\n        arg_0[arg_1.HashKey] = arg_1", "path": "mutagen/id3.py", "identifier": "ID3.loaded_frame", "docstring": "Deprecated; use the add method.", "docstring_tokens": ["Deprecated", ";", "use", "the", "add", "method", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 260069}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2222-L2284", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "compat_convertHashedIndexes - Reindex all fields for the provided objects, where the field value is hashed or not.\n\t\t\tIf the field is unhashable, do not allow.", "language": "python", "parameters": "(self, objs, conn=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "indexedFields", ":", "arg_5", "=", "arg_0", ".", "fields", "[", "arg_4", "]", "if", "'hashIndex'", "not", "in", "arg_5", ".", "__class__", ".", "__new__", ".", "__code__", ".", "co_varnames", ":", "continue", "if", "arg_4", ".", "hashIndex", "is", "True", ":", "arg_6", "=", "arg_5", "arg_7", "=", "arg_5", ".", "copy", "(", ")", "arg_7", ".", "hashIndex", "=", "False", "else", ":", "arg_7", "=", "arg_5", "arg_6", "=", "arg_5", ".", "copy", "(", ")", "arg_6", ".", "hashIndex", "=", "True", "arg_3", ".", "append", "(", "(", "arg_5", ",", "arg_7", ",", "arg_6", ")", ")", "arg_9", "=", "[", "obj", ".", "asDict", "(", "True", ",", "forStorage", "=", "True", ")", "for", "obj", "in", "arg_1", "]", "for", "arg_10", "in", "arg_9", ":", "arg_11", "=", "arg_2", ".", "pipeline", "(", ")", "arg_12", "=", "arg_10", "[", "'_id'", "]", "for", "arg_5", ",", "arg_7", ",", "arg_6", "in", "arg_3", ":", "arg_13", "=", "arg_10", "[", "arg_4", "]", "arg_0", ".", "_rem_id_from_index", "(", "arg_7", ",", "arg_12", ",", "arg_13", ",", "arg_11", ")", "arg_0", ".", "_rem_id_from_index", "(", "arg_6", ",", "arg_12", ",", "arg_13", ",", "arg_11", ")", "arg_0", ".", "_add_id_to_index", "(", "arg_5", ",", "arg_12", ",", "arg_13", ",", "arg_11", ")", "arg_11", ".", "execute", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n\t\t'''\n\t\t\tFunc - Reindex all fields for the provided objects, where the field value is hashed or not.\n\t\t\tIf the field is unhashable, do not allow.\n\n\t\t\tNOTE: This works one object at a time. It is intended to be used while your application is offline,\n\t\t\t  as it doesn't make sense to be changing your model while applications are actively using it.\n\n\t\t\t@param objs <IndexedRedisModel objects to convert>\n\t\t\t@param conn <redis.Redis or None> - Specific Redis connection or None to reuse.\n\t\t'''\n\t\tif arg_2 is None:\n\t\t\targ_2 = arg_0._get_connection()\n\n\n\n\t\t# Do one pipeline per object.\n\t\t#  XXX: Maybe we should do the whole thing in one pipeline? \n\n\t\targ_3 = []        # A list of the indexed fields\n\n\t\t# Iterate now so we do this once instead of per-object.\n\t\tfor arg_4 in arg_0.indexedFields:\n\n\t\t\targ_5 = arg_0.fields[arg_4]\n\n\t\t\t# Check if type supports configurable hashIndex, and if not skip it.\n\t\t\tif 'hashIndex' not in arg_5.__class__.__new__.__code__.co_varnames:\n\t\t\t\tcontinue\n\n\t\t\tif arg_4.hashIndex is True:\n\t\t\t\targ_6 = arg_5\n\n\t\t\t\targ_7 = arg_5.copy()\n\t\t\t\targ_7.hashIndex = False\n\t\t\telse:\n\t\t\t\targ_7 = arg_5\n\t\t\t\t# Maybe copy should allow a dict of override params?\n\t\t\t\targ_6 = arg_5.copy()\n\t\t\t\targ_6.hashIndex = True\n\n\n\t\t\targ_3.append ( (arg_5, arg_7, arg_6) )\n\n\t\targ_9 = [obj.asDict(True, forStorage=True) for obj in arg_1]\n\n\t\t# Iterate over all values. Remove the possibly stringed index, the possibly hashed index, and then put forth the hashed index.\n\n\t\tfor arg_10 in arg_9:\n\t\t\targ_11 = arg_2.pipeline()\n\t\t\targ_12 = arg_10['_id']\n\t\t\tfor arg_5, arg_7, arg_6 in arg_3:\n\t\t\t\targ_13 = arg_10[arg_4]\n\n\t\t\t\t# Remove the possibly stringed index\n\t\t\t\targ_0._rem_id_from_index(arg_7, arg_12, arg_13, arg_11)\n\t\t\t\t# Remove the possibly hashed index\n\t\t\t\targ_0._rem_id_from_index(arg_6, arg_12, arg_13, arg_11)\n\t\t\t\t# Add the new (hashed or unhashed) form.\n\t\t\t\targ_0._add_id_to_index(arg_5, arg_12, arg_13, arg_11)\n\n\t\t\t# Launch all at once\n\t\t\targ_11.execute()", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisSave.compat_convertHashedIndexes", "docstring": "compat_convertHashedIndexes - Reindex all fields for the provided objects, where the field value is hashed or not.\n\t\t\tIf the field is unhashable, do not allow.\n\n\t\t\tNOTE: This works one object at a time. It is intended to be used while your application is offline,\n\t\t\t  as it doesn't make sense to be changing your model while applications are actively using it.\n\n\t\t\t@param objs <IndexedRedisModel objects to convert>\n\t\t\t@param conn <redis.Redis or None> - Specific Redis connection or None to reuse.", "docstring_tokens": ["compat_convertHashedIndexes", "-", "Reindex", "all", "fields", "for", "the", "provided", "objects", "where", "the", "field", "value", "is", "hashed", "or", "not", ".", "If", "the", "field", "is", "unhashable", "do", "not", "allow", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 260070}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L496-L527", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "iterator for collecting the noun phrases", "language": "python", "parameters": "(sent, ranks, spacy_nlp)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "0", "arg_4", "=", "arg_0", "[", "0", "]", ".", "idx", "-", "1", "arg_5", "=", "[", "]", "while", "arg_3", "<", "len", "(", "arg_0", ")", ":", "arg_6", "=", "arg_0", "[", "arg_3", "]", "if", "(", "arg_6", ".", "word_id", ">", "0", ")", "and", "(", "arg_6", ".", "root", "in", "arg_1", ")", "and", "(", "(", "arg_6", ".", "idx", "-", "arg_4", ")", "==", "1", ")", ":", "arg_7", "=", "RankedLexeme", "(", "arg_8", "=", "arg_6", ".", "raw", ".", "lower", "(", ")", ",", "rank", "=", "arg_1", "[", "arg_6", ".", "root", "]", ",", "ids", "=", "arg_6", ".", "word_id", ",", "pos", "=", "arg_6", ".", "pos", ".", "lower", "(", ")", ",", "count", "=", "1", ")", "arg_5", ".", "append", "(", "arg_7", ")", "else", ":", "for", "arg_8", ",", "arg_9", "in", "enumerate_chunks", "(", "arg_5", ",", "arg_2", ")", ":", "if", "arg_9", ":", "arg_10", "=", "[", "arg_7", ".", "ids", "for", "arg_7", "in", "arg_9", "]", "arg_11", "=", "[", "arg_7", ".", "rank", "for", "arg_7", "in", "arg_9", "]", "arg_12", "=", "RankedLexeme", "(", "arg_8", "=", "arg_8", ",", "rank", "=", "arg_11", ",", "ids", "=", "arg_10", ",", "pos", "=", "\"np\"", ",", "count", "=", "1", ")", "if", "DEBUG", ":", "print", "(", "arg_12", ")", "yield", "arg_12", "arg_5", "=", "[", "]", "arg_4", "=", "arg_6", ".", "idx", "arg_3", "+=", "1"], "function": "def Func (arg_0, arg_1, arg_2):\n    \"\"\"\n    iterator for collecting the noun phrases\n    \"\"\"\n    arg_3 = 0\n    arg_4 = arg_0[0].idx - 1\n    arg_5 = []\n\n    while arg_3 < len(arg_0):\n        arg_6 = arg_0[arg_3]\n\n        if (arg_6.word_id > 0) and (arg_6.root in arg_1) and ((arg_6.idx - arg_4) == 1):\n            # keep collecting...\n            arg_7 = RankedLexeme(arg_8=arg_6.raw.lower(), rank=arg_1[arg_6.root], ids=arg_6.word_id, pos=arg_6.pos.lower(), count=1)\n            arg_5.append(arg_7)\n        else:\n            # just hit a phrase boundary\n            for arg_8, arg_9 in enumerate_chunks(arg_5, arg_2):\n                if arg_9:\n                    arg_10 = [arg_7.ids for arg_7 in arg_9]\n                    arg_11 = [arg_7.rank for arg_7 in arg_9]\n                    arg_12 = RankedLexeme(arg_8=arg_8, rank=arg_11, ids=arg_10, pos=\"np\", count=1)\n\n                    if DEBUG:\n                        print(arg_12)\n\n                    yield arg_12\n\n            arg_5 = []\n\n        arg_4 = arg_6.idx\n        arg_3 += 1", "path": "pytextrank/pytextrank.py", "identifier": "collect_phrases", "docstring": "iterator for collecting the noun phrases", "docstring_tokens": ["iterator", "for", "collecting", "the", "noun", "phrases"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 260071}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L147-L167", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the names and default values of a function's arguments.", "language": "python", "parameters": "(obj)", "return_statement": "return args, varargs, varkw, func_obj.func_defaults", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "inspect", ".", "isfunction", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "elif", "inspect", ".", "ismethod", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "im_func", "elif", "hasattr", "(", "arg_0", ",", "'__call__'", ")", ":", "arg_1", "=", "arg_0", ".", "__call__", "else", ":", "raise", "TypeError", "(", "'arg is not a Python function'", ")", "arg_2", ",", "arg_3", ",", "arg_4", "=", "inspect", ".", "getargs", "(", "arg_1", ".", "func_code", ")", "return", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_1", ".", "func_defaults"], "function": "def Func(arg_0):\n    \"\"\"Get the names and default values of a function's arguments.\n\n    A tuple of four things is returned: (args, varargs, varkw, defaults).\n    'args' is a list of the argument names (it may contain nested lists).\n    'varargs' and 'varkw' are the names of the * and ** arguments or None.\n    'defaults' is an n-tuple of the default values of the last n arguments.\n\n    Modified version of inspect.Func from the Python Standard\n    Library.\"\"\"\n\n    if inspect.isfunction(arg_0):\n        arg_1 = arg_0\n    elif inspect.ismethod(arg_0):\n        arg_1 = arg_0.im_func\n    elif hasattr(arg_0, '__call__'):\n        arg_1 = arg_0.__call__\n    else:\n        raise TypeError('arg is not a Python function')\n    arg_2, arg_3, arg_4 = inspect.getargs(arg_1.func_code)\n    return arg_2, arg_3, arg_4, arg_1.func_defaults", "path": "environment/lib/python2.7/site-packages/IPython/core/oinspect.py", "identifier": "getargspec", "docstring": "Get the names and default values of a function's arguments.\n\n    A tuple of four things is returned: (args, varargs, varkw, defaults).\n    'args' is a list of the argument names (it may contain nested lists).\n    'varargs' and 'varkw' are the names of the * and ** arguments or None.\n    'defaults' is an n-tuple of the default values of the last n arguments.\n\n    Modified version of inspect.getargspec from the Python Standard\n    Library.", "docstring_tokens": ["Get", "the", "names", "and", "default", "values", "of", "a", "function", "s", "arguments", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260072}
{"url": "https://github.com/Kappa-Dev/KaSim/blob/12a01c616a47e3046323103625795fb2fca8273a/python/kappy/kappa_common.py#L286-L300", "sha": "12a01c616a47e3046323103625795fb2fca8273a", "docstring_summary": "Set the simulation default simulation parameters.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "len", "(", "arg_1", ")", "is", "1", "and", "isinstance", "(", "arg_1", "[", "0", "]", ",", "SimulationParameter", ")", ":", "arg_0", ".", "__default_param", "=", "arg_1", "[", "0", "]", "else", ":", "arg_0", ".", "__default_param", "=", "SimulationParameter", "(", "*", "arg_1", ",", "**", "arg_2", ")", "return"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Set the simulation default simulation parameters.\n\n        You can pass one of two things in as input:\n        - a kappa_common.SimulationParameter instance\n        - the arguments and keyword argument to create such an instance.\n\n        The parameters you specify will be used by default in simulations run\n        by this client.\n        \"\"\"\n        if len(arg_1) is 1 and isinstance(arg_1[0], SimulationParameter):\n            arg_0.__default_param = arg_1[0]\n        else:\n            arg_0.__default_param = SimulationParameter(*arg_1, **arg_2)\n        return", "path": "python/kappy/kappa_common.py", "identifier": "KappaApi.set_default_sim_param", "docstring": "Set the simulation default simulation parameters.\n\n        You can pass one of two things in as input:\n        - a kappa_common.SimulationParameter instance\n        - the arguments and keyword argument to create such an instance.\n\n        The parameters you specify will be used by default in simulations run\n        by this client.", "docstring_tokens": ["Set", "the", "simulation", "default", "simulation", "parameters", "."], "nwo": "Kappa-Dev/KaSim", "score": 0.5441421983768713, "idx": 260073}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/__init__.py#L84-L124", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Run the application and conserve the traceback frames.", "language": "python", "parameters": "(self, environ, start_response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "None", "try", ":", "arg_3", "=", "arg_0", ".", "app", "(", "arg_1", ",", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "yield", "arg_4", "if", "hasattr", "(", "arg_3", ",", "'close'", ")", ":", "arg_3", ".", "close", "(", ")", "except", "Exception", ":", "if", "hasattr", "(", "arg_3", ",", "'close'", ")", ":", "arg_3", ".", "close", "(", ")", "arg_5", "=", "get_current_traceback", "(", "skip", "=", "1", ",", "show_hidden_frames", "=", "arg_0", ".", "show_hidden_frames", ",", "ignore_system_exceptions", "=", "True", ")", "for", "arg_6", "in", "arg_5", ".", "frames", ":", "arg_0", ".", "frames", "[", "arg_6", ".", "id", "]", "=", "arg_6", "arg_0", ".", "tracebacks", "[", "arg_5", ".", "id", "]", "=", "arg_5", "try", ":", "arg_2", "(", "'500 INTERNAL SERVER ERROR'", ",", "[", "(", "'Content-Type'", ",", "'text/html; charset=utf-8'", ")", ",", "(", "'X-XSS-Protection'", ",", "'0'", ")", ",", "]", ")", "except", "Exception", ":", "arg_1", "[", "'wsgi.errors'", "]", ".", "write", "(", "'Debugging middleware caught exception in streamed '", "'response at a point where response headers were already '", "'sent.\\n'", ")", "else", ":", "yield", "arg_5", ".", "render_full", "(", "evalex", "=", "arg_0", ".", "evalex", ",", "secret", "=", "arg_0", ".", "secret", ")", ".", "encode", "(", "'utf-8'", ",", "'replace'", ")", "arg_5", ".", "log", "(", "arg_1", "[", "'wsgi.errors'", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Run the application and conserve the traceback frames.\"\"\"\n        arg_3 = None\n        try:\n            arg_3 = arg_0.app(arg_1, arg_2)\n            for arg_4 in arg_3:\n                yield arg_4\n            if hasattr(arg_3, 'close'):\n                arg_3.close()\n        except Exception:\n            if hasattr(arg_3, 'close'):\n                arg_3.close()\n            arg_5 = get_current_traceback(skip=1, show_hidden_frames=\n                                              arg_0.show_hidden_frames,\n                                              ignore_system_exceptions=True)\n            for arg_6 in arg_5.frames:\n                arg_0.frames[arg_6.id] = arg_6\n            arg_0.tracebacks[arg_5.id] = arg_5\n\n            try:\n                arg_2('500 INTERNAL SERVER ERROR', [\n                    ('Content-Type', 'text/html; charset=utf-8'),\n                    # Disable Chrome's XSS protection, the debug\n                    # output can cause false-positives.\n                    ('X-XSS-Protection', '0'),\n                ])\n            except Exception:\n                # if we end up here there has been output but an error\n                # occurred.  in that situation we can do nothing fancy any\n                # more, better log something into the error log and fall\n                # back gracefully.\n                arg_1['wsgi.errors'].write(\n                    'Debugging middleware caught exception in streamed '\n                    'response at a point where response headers were already '\n                    'sent.\\n')\n            else:\n                yield arg_5.render_full(evalex=arg_0.evalex,\n                                            secret=arg_0.secret) \\\n                               .encode('utf-8', 'replace')\n\n            arg_5.log(arg_1['wsgi.errors'])", "path": "capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/__init__.py", "identifier": "DebuggedApplication.debug_application", "docstring": "Run the application and conserve the traceback frames.", "docstring_tokens": ["Run", "the", "application", "and", "conserve", "the", "traceback", "frames", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260074}
{"url": "https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/packet.py#L36-L103", "sha": "1cdb1594a315326987a17ce0924ea448a82fab01", "docstring_summary": "Encode an attribute dict into a byte string.", "language": "python", "parameters": "(data, json_dumps=default_json_dumps)", "return_statement": "return msg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "arg_3", "=", "''", "arg_4", "=", "str", "(", "MSG_TYPES", "[", "arg_0", "[", "'type'", "]", "]", ")", "if", "arg_4", "in", "[", "'0'", ",", "'1'", "]", ":", "arg_4", "+=", "'::'", "+", "arg_0", "[", "'endpoint'", "]", "if", "'qs'", "in", "arg_0", "and", "arg_0", "[", "'qs'", "]", "!=", "''", ":", "arg_4", "+=", "':'", "+", "arg_0", "[", "'qs'", "]", "elif", "arg_4", "==", "'2'", ":", "arg_4", "+=", "'::'", "elif", "arg_4", "in", "[", "'3'", ",", "'4'", ",", "'5'", "]", ":", "if", "arg_4", "==", "'3'", ":", "arg_3", "=", "arg_0", "[", "'data'", "]", "if", "arg_4", "==", "'4'", ":", "arg_3", "=", "arg_1", "(", "arg_0", "[", "'data'", "]", ")", "if", "arg_4", "==", "'5'", ":", "arg_5", "=", "{", "}", "arg_5", "[", "'name'", "]", "=", "arg_0", "[", "'name'", "]", "if", "'args'", "in", "arg_0", "and", "arg_0", "[", "'args'", "]", "!=", "[", "]", ":", "arg_5", "[", "'args'", "]", "=", "arg_0", "[", "'args'", "]", "arg_3", "=", "arg_1", "(", "arg_5", ")", "if", "'id'", "in", "arg_0", ":", "arg_4", "+=", "':'", "+", "str", "(", "arg_0", "[", "'id'", "]", ")", "if", "arg_0", "[", "'ack'", "]", "==", "'data'", ":", "arg_4", "+=", "'+'", "arg_4", "+=", "':'", "else", ":", "arg_4", "+=", "'::'", "if", "'endpoint'", "not", "in", "arg_0", ":", "arg_0", "[", "'endpoint'", "]", "=", "''", "if", "arg_3", "!=", "''", ":", "arg_4", "+=", "arg_0", "[", "'endpoint'", "]", "+", "':'", "+", "arg_3", "else", ":", "arg_4", "+=", "arg_0", "[", "'endpoint'", "]", "elif", "arg_4", "==", "'6'", ":", "arg_4", "+=", "'::'", "+", "arg_0", ".", "get", "(", "'endpoint'", ",", "''", ")", "+", "':'", "+", "str", "(", "arg_0", "[", "'ackId'", "]", ")", "if", "'args'", "in", "arg_0", "and", "arg_0", "[", "'args'", "]", "!=", "[", "]", ":", "arg_4", "+=", "'+'", "+", "arg_1", "(", "arg_0", "[", "'args'", "]", ")", "elif", "arg_4", "==", "'7'", ":", "arg_4", "+=", "':::'", "if", "'reason'", "in", "arg_0", "and", "arg_0", "[", "'reason'", "]", "!=", "''", ":", "arg_4", "+=", "str", "(", "ERROR_REASONS", "[", "arg_0", "[", "'reason'", "]", "]", ")", "if", "'advice'", "in", "arg_0", "and", "arg_0", "[", "'advice'", "]", "!=", "''", ":", "arg_4", "+=", "'+'", "+", "str", "(", "ERROR_ADVICES", "[", "arg_0", "[", "'advice'", "]", "]", ")", "arg_4", "+=", "arg_0", "[", "'endpoint'", "]", "elif", "arg_4", "==", "'8'", ":", "arg_4", "+=", "'::'", "return", "arg_4"], "function": "def Func(arg_0, arg_1=arg_2):\n    \"\"\"\n    Encode an attribute dict into a byte string.\n    \"\"\"\n    arg_3 = ''\n    arg_4 = str(MSG_TYPES[arg_0['type']])\n\n    if arg_4 in ['0', '1']:\n        # '1::' [path] [query]\n        arg_4 += '::' + arg_0['endpoint']\n        if 'qs' in arg_0 and arg_0['qs'] != '':\n            arg_4 += ':' + arg_0['qs']\n\n    elif arg_4 == '2':\n        # heartbeat\n        arg_4 += '::'\n\n    elif arg_4 in ['3', '4', '5']:\n        # '3:' [id ('+')] ':' [endpoint] ':' [data]\n        # '4:' [id ('+')] ':' [endpoint] ':' [json]\n        # '5:' [id ('+')] ':' [endpoint] ':' [json Funcd event]\n        # The message id is an incremental integer, required for ACKs.\n        # If the message id is followed by a +, the ACK is not handled by\n        # socket.io, but by the user instead.\n        if arg_4 == '3':\n            arg_3 = arg_0['data']\n        if arg_4 == '4':\n            arg_3 = arg_1(arg_0['data'])\n        if arg_4 == '5':\n            arg_5 = {}\n            arg_5['name'] = arg_0['name']\n            if 'args' in arg_0 and arg_0['args'] != []:\n                arg_5['args'] = arg_0['args']\n            arg_3 = arg_1(arg_5)\n        if 'id' in arg_0:\n            arg_4 += ':' + str(arg_0['id'])\n            if arg_0['ack'] == 'data':\n                arg_4 += '+'\n            arg_4 += ':'\n        else:\n            arg_4 += '::'\n        if 'endpoint' not in arg_0:\n            arg_0['endpoint'] = ''\n        if arg_3 != '':\n            arg_4 += arg_0['endpoint'] + ':' + arg_3\n        else:\n            arg_4 += arg_0['endpoint']\n\n    elif arg_4 == '6':\n        # '6:::' [id] '+' [data]\n        arg_4 += '::' + arg_0.get('endpoint', '') + ':' + str(arg_0['ackId'])\n        if 'args' in arg_0 and arg_0['args'] != []:\n            arg_4 += '+' + arg_1(arg_0['args'])\n\n    elif arg_4 == '7':\n        # '7::' [endpoint] ':' [reason] '+' [advice]\n        arg_4 += ':::'\n        if 'reason' in arg_0 and arg_0['reason'] != '':\n            arg_4 += str(ERROR_REASONS[arg_0['reason']])\n        if 'advice' in arg_0 and arg_0['advice'] != '':\n            arg_4 += '+' + str(ERROR_ADVICES[arg_0['advice']])\n        arg_4 += arg_0['endpoint']\n\n    # NoOp, used to close a poll after the polling duration time\n    elif arg_4 == '8':\n        arg_4 += '::'\n\n    return arg_4", "path": "socketio/packet.py", "identifier": "encode", "docstring": "Encode an attribute dict into a byte string.", "docstring_tokens": ["Encode", "an", "attribute", "dict", "into", "a", "byte", "string", "."], "nwo": "abourget/gevent-socketio", "score": 0.708090276209248, "idx": 260075}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/setup.py#L221-L307", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Make index file with the special groups.", "language": "python", "parameters": "(struct, selection='\"Protein\"', ndx='main.ndx', oldndx=None)", "return_statement": "return cbook.parse_ndxlist(out)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'\"Protein\"'", ",", "arg_2", "=", "'main.ndx'", ",", "arg_3", "=", "None", ")", ":", "logger", ".", "info", "(", "\"Building the main index file {ndx!r}...\"", ".", "format", "(", "**", "vars", "(", ")", ")", ")", "arg_4", ",", "arg_5", ",", "arg_4", "=", "gromacs", ".", "make_ndx", "(", "f", "=", "arg_0", ",", "n", "=", "arg_3", ",", "o", "=", "arg_2", ",", "stdout", "=", "False", ",", "input", "=", "(", "\"\"", ",", "\"q\"", ")", ")", "arg_6", "=", "cbook", ".", "parse_ndxlist", "(", "arg_5", ")", "arg_1", "=", "arg_1", ".", "strip", "(", "\"\\\"\"", ")", "arg_7", "=", "[", "g", "for", "g", "in", "arg_6", "if", "g", "[", "'name'", "]", ".", "lower", "(", ")", "==", "arg_1", ".", "lower", "(", ")", "]", "if", "len", "(", "arg_7", ")", ">", "1", ":", "logging", ".", "warn", "(", "\"make_ndx created duplicated groups, performing work around\"", ")", "if", "len", "(", "arg_7", ")", "<=", "0", ":", "arg_8", "=", "\"no groups found for selection {0}, available groups are {1}\"", ".", "format", "(", "arg_1", ",", "arg_6", ")", "logging", ".", "error", "(", "arg_8", ")", "raise", "ValueError", "(", "arg_8", ")", "arg_9", "=", "len", "(", "arg_6", ")", "-", "1", "assert", "arg_9", "==", "arg_6", "[", "-", "1", "]", "[", "'nr'", "]", "arg_10", "=", "arg_7", "[", "0", "]", "arg_4", ",", "arg_5", ",", "arg_4", "=", "gromacs", ".", "make_ndx", "(", "f", "=", "arg_0", ",", "n", "=", "arg_2", ",", "o", "=", "arg_2", ",", "stdout", "=", "False", ",", "input", "=", "(", "\"{0}\"", ".", "format", "(", "arg_10", "[", "'nr'", "]", ")", ",", "\"name {0} __main__\"", ".", "format", "(", "arg_9", "+", "1", ")", ",", "\"! \\\"__main__\\\"\"", ",", "\"name {0} __environment__\"", ".", "format", "(", "arg_9", "+", "2", ")", ",", "\"\"", ",", "\"q\"", ")", ")", "return", "cbook", ".", "parse_ndxlist", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1='\"Protein\"', arg_2='main.ndx', arg_3=None):\n    \"\"\"Make index file with the special groups.\n\n    This routine adds the group __main__ and the group __environment__\n    to the end of the index file. __main__ contains what the user\n    defines as the *central* and *most important* parts of the\n    system. __environment__ is everything else.\n\n    The template mdp file, for instance, uses these two groups for T-coupling.\n\n    These groups are mainly useful if the default groups \"Protein\" and \"Non-Protein\"\n    are not appropriate. By using symbolic names such as __main__ one\n    can keep scripts more general.\n\n    :Returns:\n      *groups* is a list of dictionaries that describe the index groups. See\n      :func:`gromacs.cbook.parse_ndxlist` for details.\n\n    :Arguments:\n      *struct* : filename\n        structure (tpr, pdb, gro)\n      *selection* : string\n        is a ``make_ndx`` command such as ``\"Protein\"`` or ``r DRG`` which\n        determines what is considered the main group for centering etc. It is\n        passed directly to ``make_ndx``.\n      *ndx* : string\n         name of the final index file\n      *oldndx* : string\n         name of index file that should be used as a basis; if None\n         then the ``make_ndx`` default groups are used.\n\n    This routine is very dumb at the moment; maybe some heuristics will be\n    added later as could be other symbolic groups such as __membrane__.\n    \"\"\"\n\n    logger.info(\"Building the main index file {ndx!r}...\".format(**vars()))\n\n    # pass 1: select\n    # get a list of groups\n    # need the first \"\" to get make_ndx to spit out the group list.\n    arg_4,arg_5,arg_4 = gromacs.make_ndx(f=arg_0, n=arg_3, o=arg_2, stdout=False,\n                                      input=(\"\", \"q\"))\n    arg_6 = cbook.parse_ndxlist(arg_5)\n\n    # find the matching groups,\n    # there is a nasty bug in GROMACS where make_ndx may have multiple\n    # groups, which caused the previous approach to fail big time.\n    # this is a work around the make_ndx bug.\n    # striping the \"\" allows compatibility with existing make_ndx selection commands.\n    arg_1 = arg_1.strip(\"\\\"\")\n\n    arg_7 = [g for g in arg_6 if g['name'].lower() == arg_1.lower()]\n\n    if len(arg_7) > 1:\n        logging.warn(\"make_ndx created duplicated groups, performing work around\")\n\n    if len(arg_7) <= 0:\n        arg_8 = \"no groups found for selection {0}, available groups are {1}\".format(arg_1, arg_6)\n        logging.error(arg_8)\n        raise ValueError(arg_8)\n\n    # Found at least one matching group, we're OK\n\n    # index of last group\n    arg_9 = len(arg_6) - 1\n    assert arg_9 == arg_6[-1]['nr']\n\n    arg_10 = arg_7[0]\n\n    # pass 2:\n    # 1) last group is __main__\n    # 2) __environment__ is everything else (eg SOL, ions, ...)\n    arg_4,arg_5,arg_4 = gromacs.make_ndx(f=arg_0, n=arg_2, o=arg_2,\n                                      stdout=False,\n                                             # make copy selected group, this now has index last + 1\n                                      input=(\"{0}\".format(arg_10['nr']),\n                                             # rename this to __main__\n                                             \"name {0} __main__\".format(arg_9+1),\n                                             # make a complement to this group, it get index last + 2\n                                             \"! \\\"__main__\\\"\",\n                                             # rename this to __environment__\n                                             \"name {0} __environment__\".format(arg_9+2),\n                                             # list the groups\n                                             \"\",\n                                             # quit\n                                             \"q\"))\n    return cbook.parse_ndxlist(arg_5)", "path": "gromacs/setup.py", "identifier": "make_main_index", "docstring": "Make index file with the special groups.\n\n    This routine adds the group __main__ and the group __environment__\n    to the end of the index file. __main__ contains what the user\n    defines as the *central* and *most important* parts of the\n    system. __environment__ is everything else.\n\n    The template mdp file, for instance, uses these two groups for T-coupling.\n\n    These groups are mainly useful if the default groups \"Protein\" and \"Non-Protein\"\n    are not appropriate. By using symbolic names such as __main__ one\n    can keep scripts more general.\n\n    :Returns:\n      *groups* is a list of dictionaries that describe the index groups. See\n      :func:`gromacs.cbook.parse_ndxlist` for details.\n\n    :Arguments:\n      *struct* : filename\n        structure (tpr, pdb, gro)\n      *selection* : string\n        is a ``make_ndx`` command such as ``\"Protein\"`` or ``r DRG`` which\n        determines what is considered the main group for centering etc. It is\n        passed directly to ``make_ndx``.\n      *ndx* : string\n         name of the final index file\n      *oldndx* : string\n         name of index file that should be used as a basis; if None\n         then the ``make_ndx`` default groups are used.\n\n    This routine is very dumb at the moment; maybe some heuristics will be\n    added later as could be other symbolic groups such as __membrane__.", "docstring_tokens": ["Make", "index", "file", "with", "the", "special", "groups", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 260076}
{"url": "https://github.com/mon/kbinxml/blob/ca4a6e309ec458dd359f1bf25f91a4443758365a/kbinxml/kbinxml.py#L106-L126", "sha": "ca4a6e309ec458dd359f1bf25f91a4443758365a", "docstring_summary": "used when allocating memory ingame", "language": "python", "parameters": "(self)", "return_statement": "return (size + 8) & ~7", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_data_Func", "arg_2", "=", "len", "(", "list", "(", "arg_0", ".", "xml_doc", ".", "iter", "(", "tag", "=", "etree", ".", "Element", ")", ")", ")", "if", "arg_0", ".", "compressed", ":", "arg_3", "=", "52", "*", "arg_2", "+", "arg_1", "+", "630", "else", ":", "arg_4", "=", "0", "for", "arg_5", "in", "arg_0", ".", "xml_doc", ".", "iter", "(", "tag", "=", "etree", ".", "Element", ")", ":", "arg_6", "=", "max", "(", "len", "(", "arg_5", ".", "tag", ")", ",", "8", ")", "arg_6", "=", "(", "arg_6", "+", "3", ")", "&", "~", "3", "arg_4", "+=", "arg_6", "arg_3", "=", "56", "*", "arg_2", "+", "arg_1", "+", "630", "+", "arg_4", "return", "(", "arg_3", "+", "8", ")", "&", "~", "7"], "function": "def Func(arg_0):\n        '''used when allocating memory ingame'''\n\n        arg_1 = arg_0._data_Func\n        arg_2 = len(list(arg_0.xml_doc.iter(tag=etree.Element)))\n\n        if arg_0.compressed:\n            arg_3 = 52 * arg_2 + arg_1 + 630\n        else:\n            arg_4 = 0\n            for arg_5 in arg_0.xml_doc.iter(tag=etree.Element):\n                arg_6 = max(len(arg_5.tag), 8)\n                arg_6 = (arg_6 + 3) & ~3\n                arg_4 += arg_6\n\n            arg_3 = 56 * arg_2 + arg_1 + 630 + arg_4\n\n        # debugging\n        #print('nodes:{} ({}) data:{} ({})'.format(node_count,hex(node_count), data_len, hex(data_len)))\n\n        return (arg_3 + 8) & ~7", "path": "kbinxml/kbinxml.py", "identifier": "KBinXML.mem_size", "docstring": "used when allocating memory ingame", "docstring_tokens": ["used", "when", "allocating", "memory", "ingame"], "nwo": "mon/kbinxml", "score": 0.5309589617499373, "idx": 260077}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1082-L1090", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Returns list of the predecessors of a node as DAGNodes.", "language": "python", "parameters": "(self, node)", "return_statement": "return self._multi_graph.predecessors(node)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "warnings", ".", "warn", "(", "'Calling Func() with a node id is deprecated,'", "' use a DAGNode instead'", ",", "DeprecationWarning", ",", "2", ")", "arg_1", "=", "arg_0", ".", "_id_to_node", "[", "arg_1", "]", "return", "arg_0", ".", "_multi_graph", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns list of the Func of a node as DAGNodes.\"\"\"\n        if isinstance(arg_1, int):\n            warnings.warn('Calling Func() with a node id is deprecated,'\n                          ' use a DAGNode instead',\n                          DeprecationWarning, 2)\n            arg_1 = arg_0._id_to_node[arg_1]\n\n        return arg_0._multi_graph.Func(arg_1)", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.predecessors", "docstring": "Returns list of the predecessors of a node as DAGNodes.", "docstring_tokens": ["Returns", "list", "of", "the", "predecessors", "of", "a", "node", "as", "DAGNodes", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260078}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/inference.py#L51-L63", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.", "language": "python", "parameters": "(graph, subgraph)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "itt", ".", "combinations", "(", "arg_1", ",", "2", ")", ":", "if", "not", "arg_0", ".", "has_edge", "(", "arg_2", ",", "arg_3", ")", ":", "continue", "for", "arg_4", "in", "arg_0", "[", "arg_2", "]", "[", "arg_3", "]", ":", "if", "arg_4", "<", "0", ":", "arg_1", ".", "add_edge", "(", "arg_2", ",", "arg_3", ",", "key", "=", "arg_4", ",", "**", "arg_0", "[", "arg_2", "]", "[", "arg_3", "]", "[", "arg_4", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.\n\n    :param pybel.BELGraph graph: The full BEL graph\n    :param pybel.BELGraph subgraph: The query BEL subgraph\n    \"\"\"\n    for arg_2, arg_3 in itt.combinations(arg_1, 2):\n        if not arg_0.has_edge(arg_2, arg_3):\n            continue\n\n        for arg_4 in arg_0[arg_2][arg_3]:\n            if arg_4 < 0:\n                arg_1.add_edge(arg_2, arg_3, key=arg_4, **arg_0[arg_2][arg_3][arg_4])", "path": "src/pybel_tools/mutation/inference.py", "identifier": "enrich_internal_unqualified_edges", "docstring": "Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.\n\n    :param pybel.BELGraph graph: The full BEL graph\n    :param pybel.BELGraph subgraph: The query BEL subgraph", "docstring_tokens": ["Add", "the", "missing", "unqualified", "edges", "between", "entities", "in", "the", "subgraph", "that", "are", "contained", "within", "the", "full", "graph", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260079}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_api_base_hook.py#L195-L220", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Decorator that provides fallback for Google Cloud Platform project id. If\n        the project is None it will be replaced with the project_id from the\n        service account the Hook is authenticated with. Project id can be specified\n        either via project_id kwarg or via first parameter in positional args.", "language": "python", "parameters": "(func)", "return_statement": "return inner_wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "functools", ".", "wraps", "(", "arg_0", ")", "def", "inner_wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "len", "(", "arg_2", ")", ">", "0", ":", "raise", "AirflowException", "(", "\"You must use keyword arguments in this methods rather than\"", "\" positional\"", ")", "if", "'project_id'", "in", "arg_3", ":", "arg_3", "[", "'project_id'", "]", "=", "arg_1", ".", "_get_project_id", "(", "arg_3", "[", "'project_id'", "]", ")", "else", ":", "arg_3", "[", "'project_id'", "]", "=", "arg_1", ".", "_get_project_id", "(", "None", ")", "if", "not", "arg_3", "[", "'project_id'", "]", ":", "raise", "AirflowException", "(", "\"The project id must be passed either as \"", "\"keyword project_id parameter or as project_id extra \"", "\"in GCP connection definition. Both are not set!\"", ")", "return", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "inner_wrapper"], "function": "def Func(arg_0):\n        \"\"\"\n        Decorator that provides fallback for Google Cloud Platform project id. If\n        the project is None it will be replaced with the project_id from the\n        service account the Hook is authenticated with. Project id can be specified\n        either via project_id kwarg or via first parameter in positional args.\n\n        :param func: function to wrap\n        :return: result of the function call\n        \"\"\"\n        @functools.wraps(arg_0)\n        def inner_wrapper(arg_1, *arg_2, **arg_3):\n            if len(arg_2) > 0:\n                raise AirflowException(\n                    \"You must use keyword arguments in this methods rather than\"\n                    \" positional\")\n            if 'project_id' in arg_3:\n                arg_3['project_id'] = arg_1._get_project_id(arg_3['project_id'])\n            else:\n                arg_3['project_id'] = arg_1._get_project_id(None)\n            if not arg_3['project_id']:\n                raise AirflowException(\"The project id must be passed either as \"\n                                       \"keyword project_id parameter or as project_id extra \"\n                                       \"in GCP connection definition. Both are not set!\")\n            return arg_0(arg_1, *arg_2, **arg_3)\n        return inner_wrapper", "path": "airflow/contrib/hooks/gcp_api_base_hook.py", "identifier": "GoogleCloudBaseHook.fallback_to_default_project_id", "docstring": "Decorator that provides fallback for Google Cloud Platform project id. If\n        the project is None it will be replaced with the project_id from the\n        service account the Hook is authenticated with. Project id can be specified\n        either via project_id kwarg or via first parameter in positional args.\n\n        :param func: function to wrap\n        :return: result of the function call", "docstring_tokens": ["Decorator", "that", "provides", "fallback", "for", "Google", "Cloud", "Platform", "project", "id", ".", "If", "the", "project", "is", "None", "it", "will", "be", "replaced", "with", "the", "project_id", "from", "the", "service", "account", "the", "Hook", "is", "authenticated", "with", ".", "Project", "id", "can", "be", "specified", "either", "via", "project_id", "kwarg", "or", "via", "first", "parameter", "in", "positional", "args", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260080}
{"url": "https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/analytics.py#L17-L25", "sha": "9845faf33d49a8f06908efc22640c001116d6ea2", "docstring_summary": "Returns grade data for the given account_id and term_id.", "language": "python", "parameters": "(self, account_id, term_id)", "return_statement": "return self._get_resource(url)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "(", "\"/api/v1/accounts/sis_account_id:%s/analytics/\"", "\"terms/sis_term_id:%s/grades.json\"", ")", "%", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "_get_resource", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Returns grade data for the given account_id and term_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_grades\n        \"\"\"\n        arg_3 = (\"/api/v1/accounts/sis_account_id:%s/analytics/\"\n               \"terms/sis_term_id:%s/grades.json\") % (arg_1, arg_2)\n        return arg_0._get_resource(arg_3)", "path": "uw_canvas/analytics.py", "identifier": "Analytics.get_grades_by_account", "docstring": "Returns grade data for the given account_id and term_id.\n\n        https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_grades", "docstring_tokens": ["Returns", "grade", "data", "for", "the", "given", "account_id", "and", "term_id", "."], "nwo": "uw-it-aca/uw-restclients-canvas", "score": 0.3705463963430013, "idx": 260081}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/graph/graph_generation.py#L53-L115", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Creates a random graph where the edges have different types.", "language": "python", "parameters": "(num_vertices=250, prob_loop=0.5, **kwargs)", "return_statement": "return g", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "250", ",", "arg_1", "=", "0.5", ",", "**", "arg_2", ")", ":", "arg_3", "=", "minimal_random_graph", "(", "arg_0", ",", "**", "arg_2", ")", "for", "arg_4", "in", "arg_3", ".", "nodes", "(", ")", ":", "arg_5", "=", "(", "arg_4", ",", "arg_4", ")", "if", "not", "arg_3", ".", "is_edge", "(", "arg_5", ")", ":", "if", "np", ".", "random", ".", "uniform", "(", ")", "<", "arg_1", ":", "arg_3", ".", "add_edge", "(", "*", "arg_5", ")", "arg_3", "=", "set_types_random", "(", "arg_3", ",", "**", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0=250, arg_1=0.5, **arg_2):\n    \"\"\"Creates a random graph where the edges have different types.\n\n    This method calls :func:`.minimal_random_graph`, and then adds\n    a loop to each vertex with ``prob_loop`` probability. It then\n    calls :func:`.set_types_random` on the resulting graph.\n\n    Parameters\n    ----------\n    num_vertices : int (optional, default: 250)\n        The number of vertices in the graph.\n    prob_loop : float (optional, default: 0.5)\n        The probability that a loop gets added to a vertex.\n    **kwargs :\n        Any parameters to send to :func:`.minimal_random_graph` or\n        :func:`.set_types_random`.\n\n    Returns\n    -------\n    :class:`.QueueNetworkDiGraph`\n        A graph with the position of the vertex set as a property.\n        The position property is called ``pos``. Also, the ``edge_type``\n        edge property is set for each edge.\n\n    Examples\n    --------\n    The following generates a directed graph with 50 vertices where half\n    the edges are type 1 and 1/4th are type 2 and 1/4th are type 3:\n\n    >>> import queueing_tool as qt\n    >>> pTypes = {1: 0.5, 2: 0.25, 3: 0.25}\n    >>> g = qt.Func(100, proportions=pTypes, seed=17)\n    >>> non_loops = [e for e in g.edges() if e[0] != e[1]]\n    >>> p1 = np.sum([g.ep(e, 'edge_type') == 1 for e in non_loops])\n    >>> float(p1) / len(non_loops) # doctest: +ELLIPSIS\n    0.486...\n    >>> p2 = np.sum([g.ep(e, 'edge_type') == 2 for e in non_loops])\n    >>> float(p2) / len(non_loops) # doctest: +ELLIPSIS\n    0.249...\n    >>> p3 = np.sum([g.ep(e, 'edge_type') == 3 for e in non_loops])\n    >>> float(p3) / len(non_loops) # doctest: +ELLIPSIS\n    0.264...\n\n    To make an undirected graph with 25 vertices where there are 4\n    different edge types with random proportions:\n\n    >>> p = np.random.rand(4)\n    >>> p = p / sum(p)\n    >>> p = {k + 1: p[k] for k in range(4)}\n    >>> g = qt.Func(num_vertices=25, is_directed=False, proportions=p)\n\n    Note that none of the edge types in the above example are 0. It is\n    recommended use edge type indices starting at 1, since 0 is\n    typically used for terminal edges.\n    \"\"\"\n    arg_3 = minimal_random_graph(arg_0, **arg_2)\n    for arg_4 in arg_3.nodes():\n        arg_5 = (arg_4, arg_4)\n        if not arg_3.is_edge(arg_5):\n            if np.random.uniform() < arg_1:\n                arg_3.add_edge(*arg_5)\n    arg_3 = set_types_random(arg_3, **arg_2)\n    return arg_3", "path": "queueing_tool/graph/graph_generation.py", "identifier": "generate_random_graph", "docstring": "Creates a random graph where the edges have different types.\n\n    This method calls :func:`.minimal_random_graph`, and then adds\n    a loop to each vertex with ``prob_loop`` probability. It then\n    calls :func:`.set_types_random` on the resulting graph.\n\n    Parameters\n    ----------\n    num_vertices : int (optional, default: 250)\n        The number of vertices in the graph.\n    prob_loop : float (optional, default: 0.5)\n        The probability that a loop gets added to a vertex.\n    **kwargs :\n        Any parameters to send to :func:`.minimal_random_graph` or\n        :func:`.set_types_random`.\n\n    Returns\n    -------\n    :class:`.QueueNetworkDiGraph`\n        A graph with the position of the vertex set as a property.\n        The position property is called ``pos``. Also, the ``edge_type``\n        edge property is set for each edge.\n\n    Examples\n    --------\n    The following generates a directed graph with 50 vertices where half\n    the edges are type 1 and 1/4th are type 2 and 1/4th are type 3:\n\n    >>> import queueing_tool as qt\n    >>> pTypes = {1: 0.5, 2: 0.25, 3: 0.25}\n    >>> g = qt.generate_random_graph(100, proportions=pTypes, seed=17)\n    >>> non_loops = [e for e in g.edges() if e[0] != e[1]]\n    >>> p1 = np.sum([g.ep(e, 'edge_type') == 1 for e in non_loops])\n    >>> float(p1) / len(non_loops) # doctest: +ELLIPSIS\n    0.486...\n    >>> p2 = np.sum([g.ep(e, 'edge_type') == 2 for e in non_loops])\n    >>> float(p2) / len(non_loops) # doctest: +ELLIPSIS\n    0.249...\n    >>> p3 = np.sum([g.ep(e, 'edge_type') == 3 for e in non_loops])\n    >>> float(p3) / len(non_loops) # doctest: +ELLIPSIS\n    0.264...\n\n    To make an undirected graph with 25 vertices where there are 4\n    different edge types with random proportions:\n\n    >>> p = np.random.rand(4)\n    >>> p = p / sum(p)\n    >>> p = {k + 1: p[k] for k in range(4)}\n    >>> g = qt.generate_random_graph(num_vertices=25, is_directed=False, proportions=p)\n\n    Note that none of the edge types in the above example are 0. It is\n    recommended use edge type indices starting at 1, since 0 is\n    typically used for terminal edges.", "docstring_tokens": ["Creates", "a", "random", "graph", "where", "the", "edges", "have", "different", "types", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 260082}
{"url": "https://github.com/travisby/pyrest/blob/1bd625028aa0c2b901f27e1a8ef0a45d12404830/api.py#L144-L149", "sha": "1bd625028aa0c2b901f27e1a8ef0a45d12404830", "docstring_summary": "Used to instantiate a regular HTTP request object", "language": "python", "parameters": "(username, password)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "httplib2", ".", "Http", "(", ")", "if", "arg_0", "and", "arg_1", ":", "arg_2", ".", "add_credentials", "(", "arg_0", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Used to instantiate a regular HTTP request object\"\"\"\n        arg_2 = httplib2.Http()\n        if arg_0 and arg_1:\n            arg_2.add_credentials(arg_0, arg_1)\n        return arg_2", "path": "api.py", "identifier": "Api._httplib2_init", "docstring": "Used to instantiate a regular HTTP request object", "docstring_tokens": ["Used", "to", "instantiate", "a", "regular", "HTTP", "request", "object"], "nwo": "travisby/pyrest", "score": 0.2778869743536733, "idx": 260083}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L905-L913", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return true if the given class node should be considered as an abstract\n    class", "language": "python", "parameters": "(node: astroid.ClassDef)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "ClassDef", ")", "->", "bool", ":", "for", "arg_3", "in", "arg_0", ".", "methods", "(", ")", ":", "if", "arg_3", ".", "parent", ".", "frame", "(", ")", "is", "arg_0", ":", "if", "arg_3", ".", "is_abstract", "(", "pass_is_abstract", "=", "False", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0: arg_1.ClassDef) -> bool:\n    \"\"\"return true if the given class node should be considered as an abstract\n    class\n    \"\"\"\n    for arg_3 in arg_0.methods():\n        if arg_3.parent.frame() is arg_0:\n            if arg_3.is_abstract(pass_is_abstract=False):\n                return True\n    return False", "path": "pylint/checkers/utils.py", "identifier": "class_is_abstract", "docstring": "return true if the given class node should be considered as an abstract\n    class", "docstring_tokens": ["return", "true", "if", "the", "given", "class", "node", "should", "be", "considered", "as", "an", "abstract", "class"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260084}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/mappers.py#L15-L42", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Map the price entity", "language": "python", "parameters": "(self, entity: dal.Price)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Price", ")", "->", "PriceModel", ":", "if", "not", "arg_1", ":", "return", "None", "arg_4", "=", "PriceModel", "(", ")", "arg_4", ".", "currency", "=", "arg_1", ".", "currency", "arg_6", "=", "arg_1", ".", "date", "arg_7", "=", "\"%Y-%m-%d\"", "if", "arg_1", ".", "time", ":", "arg_6", "+=", "f\"T{entity.time}\"", "arg_7", "+=", "\"T%H:%M:%S\"", "arg_8", "=", "datetime", ".", "strptime", "(", "arg_6", ",", "arg_7", ")", "arg_4", ".", "datum", "=", "Datum", "(", ")", "arg_4", ".", "datum", ".", "from_datetime", "(", "arg_8", ")", "assert", "isinstance", "(", "arg_4", ".", "datum", ",", "Datum", ")", "arg_4", ".", "symbol", "=", "SecuritySymbol", "(", "arg_1", ".", "namespace", ",", "arg_1", ".", "symbol", ")", "arg_11", "=", "Decimal", "(", "arg_1", ".", "value", ")", "/", "Decimal", "(", "arg_1", ".", "denom", ")", "arg_4", ".", "value", "=", "Decimal", "(", "arg_11", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1: arg_2.Price) -> PriceModel:\n        \"\"\" Map the price entity \"\"\"\n        if not arg_1:\n            return None\n\n        arg_4 = PriceModel()\n        arg_4.currency = arg_1.currency\n\n        # date/time\n        arg_6 = arg_1.date\n        arg_7 = \"%Y-%m-%d\"\n        if arg_1.time:\n            arg_6 += f\"T{entity.time}\"\n            arg_7 += \"T%H:%M:%S\"\n        arg_8 = datetime.strptime(arg_6, arg_7)\n        arg_4.datum = Datum()\n        arg_4.datum.from_datetime(arg_8)\n        assert isinstance(arg_4.datum, Datum)\n\n        #result.namespace = entity.namespace\n        #result.symbol = entity.symbol\n        arg_4.symbol = SecuritySymbol(arg_1.namespace, arg_1.symbol)\n\n        # Value\n        arg_11 = Decimal(arg_1.value) / Decimal(arg_1.denom)\n        arg_4.value = Decimal(arg_11)\n\n        return arg_4", "path": "pricedb/mappers.py", "identifier": "PriceMapper.map_entity", "docstring": "Map the price entity", "docstring_tokens": ["Map", "the", "price", "entity"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 260085}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/commands.py#L68-L71", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Writes msg to stderr and exits with return code", "language": "python", "parameters": "(msg, code=-1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "-", "1", ")", ":", "sys", ".", "stderr", ".", "write", "(", "arg_0", "+", "\"\\n\"", ")", "sys", ".", "exit", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=-1):\n    \"\"\"Writes msg to stderr and exits with return code\"\"\"\n    sys.stderr.write(arg_0 + \"\\n\")\n    sys.exit(arg_1)", "path": "boyle/commands.py", "identifier": "die", "docstring": "Writes msg to stderr and exits with return code", "docstring_tokens": ["Writes", "msg", "to", "stderr", "and", "exits", "with", "return", "code"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 260086}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/progressbar.py#L667-L688", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Inform the widget about the encoding of the underlying character stream.", "language": "python", "parameters": "(self, encoding)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_bar_ends", "=", "\"[]\"", "arg_0", ".", "_bar_symbols", "=", "\"#\"", "if", "not", "arg_1", ":", "return", "arg_4", "=", "\"\\u258F\\u258E\\u258D\\u258C\\u258B\\u258A\\u2589\\u2588\"", "arg_5", "=", "\"\\u258C\\u2588\"", "arg_6", "=", "\"\\u2588\"", "if", "arg_0", ".", "_file_mode", ":", "arg_4", "=", "arg_5", "=", "None", "assert", "len", "(", "arg_6", ")", "==", "1", "for", "arg_7", "in", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "if", "arg_7", "is", "None", ":", "continue", "try", ":", "arg_7", ".", "encode", "(", "arg_1", ")", "arg_0", ".", "_bar_ends", "=", "\"||\"", "arg_0", ".", "_bar_symbols", "=", "arg_7", "return", "except", "UnicodeEncodeError", ":", "pass", "except", "LookupError", ":", "print", "(", "\"Warning: unknown encoding %s\"", "%", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Inform the widget about the encoding of the underlying character stream.\"\"\"\n        arg_0._bar_ends = \"[]\"\n        arg_0._bar_symbols = \"#\"\n        if not arg_1: return\n        arg_4 = \"\\u258F\\u258E\\u258D\\u258C\\u258B\\u258A\\u2589\\u2588\"\n        arg_5 = \"\\u258C\\u2588\"\n        arg_6 = \"\\u2588\"\n        if arg_0._file_mode:\n            arg_4 = arg_5 = None\n        assert len(arg_6) == 1\n        for arg_7 in (arg_4, arg_5, arg_6):\n            if arg_7 is None: continue\n            try:\n                arg_7.encode(arg_1)\n                arg_0._bar_ends = \"||\"\n                arg_0._bar_symbols = arg_7\n                return\n            except UnicodeEncodeError:\n                pass\n            except LookupError:\n                print(\"Warning: unknown encoding %s\" % arg_1)", "path": "h2o-py/h2o/utils/progressbar.py", "identifier": "PBWBar.set_encoding", "docstring": "Inform the widget about the encoding of the underlying character stream.", "docstring_tokens": ["Inform", "the", "widget", "about", "the", "encoding", "of", "the", "underlying", "character", "stream", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260087}
{"url": "https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L209-L226", "sha": "e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95", "docstring_summary": "Returns the set of codepoints contained in a given Namelist file.", "language": "python", "parameters": "(namFilename, unique_glyphs=False, cache=None)", "return_statement": "return result[key]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "'charset'", "if", "not", "arg_1", "else", "'ownCharset'", "arg_4", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_4", ",", "arg_0", ")", "arg_6", "=", "readNamelist", "(", "arg_5", ",", "arg_1", ",", "arg_2", ")", "return", "arg_6", "[", "arg_3", "]"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n  \"\"\"Returns the set of codepoints contained in a given Namelist file.\n\n  This is a replacement CodepointsInSubset and implements the \"#$ include\"\n  header format.\n\n  Args:\n    namFilename: The path to the  Namelist file.\n    unique_glyphs: Optional, whether to only include glyphs unique to subset.\n  Returns:\n    A set containing the glyphs in the subset.\n  \"\"\"\n  arg_3 = 'charset' if not arg_1 else 'ownCharset'\n\n  arg_4 = os.path.dirname(os.path.abspath(__file__))\n  arg_5 = os.path.join(arg_4, arg_0)\n  arg_6 = readNamelist(arg_5, arg_1, arg_2)\n  return arg_6[arg_3]", "path": "fontaine/charsets/internals/gfonts_utils.py", "identifier": "codepointsInNamelist", "docstring": "Returns the set of codepoints contained in a given Namelist file.\n\n  This is a replacement CodepointsInSubset and implements the \"#$ include\"\n  header format.\n\n  Args:\n    namFilename: The path to the  Namelist file.\n    unique_glyphs: Optional, whether to only include glyphs unique to subset.\n  Returns:\n    A set containing the glyphs in the subset.", "docstring_tokens": ["Returns", "the", "set", "of", "codepoints", "contained", "in", "a", "given", "Namelist", "file", "."], "nwo": "davelab6/pyfontaine", "score": 0.1950553484412712, "idx": 260088}
{"url": "https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/utils.py#L70-L91", "sha": "d30107be02521fa6cdfe285da3b6b0cdd153c8cc", "docstring_summary": "A metadata statement signing request with 'signing_keys' signed by one\n    of the keys in 'signing_keys'.", "language": "python", "parameters": "(keyjar, msreq, iss, lifetime, kid='')", "return_statement": "return _jwt.pack(owner=iss, kid=kid, payload=msreq.to_dict())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "''", ")", ":", "try", ":", "jwks_to_keyjar", "(", "arg_1", "[", "'signing_keys'", "]", ",", "arg_2", ")", "except", "KeyError", ":", "arg_5", "=", "arg_0", ".", "export_jwks", "(", "issuer", "=", "arg_2", ")", "arg_1", "[", "'signing_keys'", "]", "=", "arg_5", "arg_6", "=", "JWT", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "arg_6", ".", "pack", "(", "owner", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "payload", "=", "arg_1", ".", "to_dict", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=''):\n    \"\"\"\n    A metadata statement signing request with 'signing_keys' signed by one\n    of the keys in 'signing_keys'.\n\n    :param keyjar: A KeyJar instance with the private signing key\n    :param msreq: Metadata statement signing request. A MetadataStatement \n        instance.\n    :param iss: Issuer of the signing request also the owner of the signing \n        keys.\n    :return: Signed JWT where the body is the metadata statement\n    \"\"\"\n\n    try:\n        jwks_to_keyjar(arg_1['signing_keys'], arg_2)\n    except KeyError:\n        arg_5 = arg_0.export_jwks(issuer=arg_2)\n        arg_1['signing_keys'] = arg_5\n\n    arg_6 = JWT(arg_0, arg_2=arg_2, arg_3=arg_3)\n\n    return arg_6.pack(owner=arg_2, arg_4=arg_4, payload=arg_1.to_dict())", "path": "src/fedoidcmsg/utils.py", "identifier": "request_signed_by_signing_keys", "docstring": "A metadata statement signing request with 'signing_keys' signed by one\n    of the keys in 'signing_keys'.\n\n    :param keyjar: A KeyJar instance with the private signing key\n    :param msreq: Metadata statement signing request. A MetadataStatement \n        instance.\n    :param iss: Issuer of the signing request also the owner of the signing \n        keys.\n    :return: Signed JWT where the body is the metadata statement", "docstring_tokens": ["A", "metadata", "statement", "signing", "request", "with", "signing_keys", "signed", "by", "one", "of", "the", "keys", "in", "signing_keys", "."], "nwo": "IdentityPython/fedoidcmsg", "score": 0.09252797783733271, "idx": 260089}
{"url": "https://github.com/spotify/pyschema/blob/7e6c3934150bcb040c628d74ace6caf5fcf867df/pyschema_extensions/luigi.py#L31-L42", "sha": "7e6c3934150bcb040c628d74ace6caf5fcf867df", "docstring_summary": "Writes a stream of json serialised pyschema Records to a file object", "language": "python", "parameters": "(job, outputs, output_stream,\n              stderr=sys.stderr, dumps=core.dumps)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "stderr", ",", "arg_5", "=", "arg_6", ".", "dumps", ")", ":", "for", "arg_7", "in", "arg_1", ":", "try", ":", "print", ">>", "arg_2", ",", "arg_5", "(", "arg_7", ")", "except", "arg_6", ".", "ParseError", ",", "e", ":", "print", ">>", "arg_3", ",", "e", "raise"], "function": "def Func(arg_0, arg_1, arg_2,\n              arg_3=arg_4.stderr, arg_5=arg_6.dumps):\n    \"\"\" Writes a stream of json serialised pyschema Records to a file object\n\n    Can be used as job.writer in luigi.hadoop.JobTask\n    \"\"\"\n    for arg_7 in arg_1:\n        try:\n            print >> arg_2, arg_5(arg_7)\n        except arg_6.ParseError, e:\n            print >> arg_3, e\n            raise", "path": "pyschema_extensions/luigi.py", "identifier": "mr_writer", "docstring": "Writes a stream of json serialised pyschema Records to a file object\n\n    Can be used as job.writer in luigi.hadoop.JobTask", "docstring_tokens": ["Writes", "a", "stream", "of", "json", "serialised", "pyschema", "Records", "to", "a", "file", "object"], "nwo": "spotify/pyschema", "score": 0.41017317071999654, "idx": 260090}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/breaks.py#L655-L661", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Minimum and Maximum to use for computing breaks", "language": "python", "parameters": "(self)", "return_statement": "return _min, _max", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "limits", "[", "0", "]", "/", "arg_0", ".", "factor", "arg_2", "=", "arg_0", ".", "limits", "[", "1", "]", "/", "arg_0", ".", "factor", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Minimum and Maximum to use for computing breaks\n        \"\"\"\n        arg_1 = arg_0.limits[0]/arg_0.factor\n        arg_2 = arg_0.limits[1]/arg_0.factor\n        return arg_1, arg_2", "path": "mizani/breaks.py", "identifier": "timedelta_helper.scaled_limits", "docstring": "Minimum and Maximum to use for computing breaks", "docstring_tokens": ["Minimum", "and", "Maximum", "to", "use", "for", "computing", "breaks"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 260091}
{"url": "https://github.com/cyberdelia/metrology/blob/7599bea7de1fd59374c06e2f8041a217e3cf9c01/metrology/reporter/statsd.py#L190-L200", "sha": "7599bea7de1fd59374c06e2f8041a217e3cf9c01", "docstring_summary": "Add a metric to the buffer.", "language": "python", "parameters": "(self, metric_str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "batch_count", "+=", "1", "arg_0", ".", "batch_buffer", "+=", "arg_1", "if", "arg_0", ".", "batch_count", ">=", "arg_0", ".", "batch_size", ":", "arg_0", ".", "_send", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Add a metric to the buffer.\"\"\"\n\n        arg_0.batch_count += 1\n\n        arg_0.batch_buffer += arg_1\n\n        # NOTE(romcheg): Send metrics if the number of metrics in the buffer\n        #                has reached the threshold for sending.\n        if arg_0.batch_count >= arg_0.batch_size:\n            arg_0._send()", "path": "metrology/reporter/statsd.py", "identifier": "StatsDReporter._buffered_send_metric", "docstring": "Add a metric to the buffer.", "docstring_tokens": ["Add", "a", "metric", "to", "the", "buffer", "."], "nwo": "cyberdelia/metrology", "score": 0.49807038967310463, "idx": 260092}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/uses/compare evoked/go.py#L99-L117", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "Create a plot of one area of interest of a single sweep.", "language": "python", "parameters": "(abf,sweeps=[0])", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "0", "]", ")", ":", "arg_2", "=", "[", "2.31250", ",", "2.35270", "]", "for", "arg_3", "in", "arg_1", ":", "arg_0", ".", "setsweep", "(", "arg_3", ")", "for", "arg_4", "in", "arg_2", ":", "arg_5", "=", "int", "(", "arg_0", ".", "pointsPerSec", "*", "arg_4", ")", "arg_6", "=", "int", "(", "arg_0", ".", "pointsPerSec", "*", "(", "arg_4", "+", "0.001", ")", ")", "arg_0", ".", "sweepY", "[", "arg_5", ":", "arg_6", "]", "=", "np", ".", "nan", "arg_8", "=", "int", "(", "arg_0", ".", "pointsPerSec", "*", "2.2", ")", "arg_9", "=", "int", "(", "arg_0", ".", "pointsPerSec", "*", "2.6", ")", "arg_10", "=", "np", ".", "average", "(", "arg_0", ".", "sweepY", "[", "int", "(", "arg_0", ".", "pointsPerSec", "*", "2.0", ")", ":", "int", "(", "arg_0", ".", "pointsPerSec", "*", "2.2", ")", "]", ")", "arg_11", "=", "lowPassFilter", "(", "arg_0", ".", "sweepY", "[", "arg_8", ":", "arg_9", "]", ")", "-", "arg_10", "arg_12", "=", "arg_0", ".", "sweepX2", "[", "arg_8", ":", "arg_8", "+", "len", "(", "arg_11", ")", "]", ".", "flatten", "(", ")", "plt", ".", "plot", "(", "arg_12", ",", "arg_11", ",", "alpha", "=", ".5", ",", "lw", "=", "2", ")", "return"], "function": "def Func(arg_0,arg_1=[0]):\n    \"\"\"\n    Create a plot of one area of interest of a single sweep.\n    \"\"\"\n\n    arg_2=[2.31250, 2.35270]\n    for arg_3 in arg_1:\n        arg_0.setsweep(arg_3)\n        for arg_4 in arg_2:\n            arg_5=int(arg_0.pointsPerSec*arg_4)\n            arg_6=int(arg_0.pointsPerSec*(arg_4+0.001)) # 1ms of blanking\n            arg_0.sweepY[arg_5:arg_6]=np.nan # blank out the stimulus area\n        arg_8=int(arg_0.pointsPerSec*2.2) # time point (sec) to start\n        arg_9=int(arg_0.pointsPerSec*2.6) # time point (sec) to end\n        arg_10=np.average(arg_0.sweepY[int(arg_0.pointsPerSec*2.0):int(arg_0.pointsPerSec*2.2)])\n        arg_11=lowPassFilter(arg_0.sweepY[arg_8:arg_9])-arg_10\n        arg_12=arg_0.sweepX2[arg_8:arg_8+len(arg_11)].flatten()\n        plt.plot(arg_12,arg_11,alpha=.5,lw=2)\n    return", "path": "doc/uses/compare evoked/go.py", "identifier": "figureStimulus", "docstring": "Create a plot of one area of interest of a single sweep.", "docstring_tokens": ["Create", "a", "plot", "of", "one", "area", "of", "interest", "of", "a", "single", "sweep", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 260093}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L411-L427", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Download a pdf report for a case", "language": "python", "parameters": "(institute_id, case_name)", "return_statement": "return render_pdf(HTML(string=html_report), download_filename=case_obj['display_name']+'_'+datetime.datetime.now().strftime(\"%Y-%m-%d\")+'_scout.pdf')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", "=", "institute_and_case", "(", "store", ",", "arg_0", ",", "arg_1", ")", "arg_4", "=", "controllers", ".", "case_report_content", "(", "store", ",", "arg_2", ",", "arg_3", ")", "if", "current_app", ".", "config", ".", "get", "(", "'SQLALCHEMY_DATABASE_URI'", ")", ":", "arg_4", "[", "'coverage_report'", "]", "=", "controllers", ".", "coverage_report_contents", "(", "store", ",", "arg_2", ",", "arg_3", ",", "request", ".", "url_root", ")", "if", "arg_3", ".", "get", "(", "'madeline_info'", ")", "is", "not", "None", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "cases_bp", ".", "static_folder", ",", "'madeline.svg'", ")", ",", "'w'", ")", "as", "temp_madeline", ":", "temp_madeline", ".", "write", "(", "arg_3", "[", "'madeline_info'", "]", ")", "arg_5", "=", "render_template", "(", "'cases/case_report.html'", ",", "institute", "=", "arg_2", ",", "case", "=", "arg_3", ",", "format", "=", "'pdf'", ",", "**", "arg_4", ")", "return", "render_pdf", "(", "HTML", "(", "string", "=", "arg_5", ")", ",", "download_filename", "=", "arg_3", "[", "'display_name'", "]", "+", "'_'", "+", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "+", "'_scout.pdf'", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Download a pdf report for a case\"\"\"\n\n    arg_2, arg_3 = institute_and_case(store, arg_0, arg_1)\n    arg_4 = controllers.case_report_content(store, arg_2, arg_3)\n\n    # add coverage report on the bottom of this report\n    if current_app.config.get('SQLALCHEMY_DATABASE_URI'):\n        arg_4['coverage_report'] = controllers.coverage_report_contents(store, arg_2, arg_3, request.url_root)\n\n    # workaround to be able to print the case pedigree to pdf\n    if arg_3.get('madeline_info') is not None:\n        with open(os.path.join(cases_bp.static_folder, 'madeline.svg'), 'w') as temp_madeline:\n            temp_madeline.write(arg_3['madeline_info'])\n\n    arg_5 = render_template('cases/case_report.html', institute=arg_2, case=arg_3, format='pdf', **arg_4)\n    return render_pdf(HTML(string=arg_5), download_filename=arg_3['display_name']+'_'+datetime.datetime.now().strftime(\"%Y-%m-%d\")+'_scout.pdf')", "path": "scout/server/blueprints/cases/views.py", "identifier": "pdf_case_report", "docstring": "Download a pdf report for a case", "docstring_tokens": ["Download", "a", "pdf", "report", "for", "a", "case"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260094}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/proto.py#L23-L58", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Retrieve annotations from the query provider", "language": "python", "parameters": "(self, targets, wildcard=\".\", include=None, exclude=None, limit=None, start=1, expand=False,\n                       **kwargs)", "return_statement": "return 0, []", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\".\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "1", ",", "arg_7", "=", "False", ",", "**", "arg_8", ")", ":", "return", "0", ",", "[", "]"], "function": "def Func(arg_0, arg_1, arg_2=\".\", arg_3=None, arg_4=None, arg_5=None, arg_6=1, arg_7=False,\n                       **arg_8):\n        \"\"\" Retrieve annotations from the query provider\n\n        :param targets: The CTS URN(s) to query as the target of annotations\n        :type targets: [MyCapytain.common.reference.URN], URN or None\n        :param wildcard: Wildcard specifier for how to match the URN\n        :type wildcard: str\n        :param include: URI(s) of Annotation types to include in the results\n        :type include: list(str)\n        :param exclude: URI(s) of Annotation types to include in the results\n        :type exclude: list(str)\n        :param limit: The max number of results to return (Default is None for no limit)\n        :type limit: int\n        :param start: the starting record to return (Default is 1)\n        :type start: int \n        :param expand: Flag to state whether Annotations are expanded (Default is False)\n        :type expand: bool\n    \n        :return: Tuple representing the query results. The first element\n                 The first element is the number of total Annotations found\n                 The second element is the list of Annotations\n        :rtype: (int, list(Annotation)\n\n        .. note::\n\n            Wildcard should be one of the following value\n\n            - '.' to match exact,\n            - '.%' to match exact plus lower in the hierarchy\n            - '%.' to match exact + higher in the hierarchy\n            - '-' to match in the range\n            - '%.%' to match all\n\n        \"\"\"\n        return 0, []", "path": "flask_nemo/query/proto.py", "identifier": "QueryPrototype.getAnnotations", "docstring": "Retrieve annotations from the query provider\n\n        :param targets: The CTS URN(s) to query as the target of annotations\n        :type targets: [MyCapytain.common.reference.URN], URN or None\n        :param wildcard: Wildcard specifier for how to match the URN\n        :type wildcard: str\n        :param include: URI(s) of Annotation types to include in the results\n        :type include: list(str)\n        :param exclude: URI(s) of Annotation types to include in the results\n        :type exclude: list(str)\n        :param limit: The max number of results to return (Default is None for no limit)\n        :type limit: int\n        :param start: the starting record to return (Default is 1)\n        :type start: int \n        :param expand: Flag to state whether Annotations are expanded (Default is False)\n        :type expand: bool\n    \n        :return: Tuple representing the query results. The first element\n                 The first element is the number of total Annotations found\n                 The second element is the list of Annotations\n        :rtype: (int, list(Annotation)\n\n        .. note::\n\n            Wildcard should be one of the following value\n\n            - '.' to match exact,\n            - '.%' to match exact plus lower in the hierarchy\n            - '%.' to match exact + higher in the hierarchy\n            - '-' to match in the range\n            - '%.%' to match all", "docstring_tokens": ["Retrieve", "annotations", "from", "the", "query", "provider"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 260095}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L30-L86", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Run Bayesian alpha-beta-model with T distributed returns.", "language": "python", "parameters": "(data, bmark, samples=2000, progressbar=True)", "return_statement": "return model, trace", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "2000", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "pd", ".", "concat", "(", "[", "arg_0", ",", "arg_1", "]", ",", "axis", "=", "1", ")", ".", "dropna", "(", ")", "with", "pm", ".", "Model", "(", ")", "as", "model", ":", "arg_5", "=", "pm", ".", "HalfCauchy", "(", "'sigma'", ",", "beta", "=", "1", ")", "arg_6", "=", "pm", ".", "Exponential", "(", "'nu_minus_two'", ",", "1.", "/", "10.", ")", "arg_7", "=", "arg_4", ".", "iloc", "[", ":", ",", "1", "]", "arg_8", "=", "arg_4", ".", "iloc", "[", ":", ",", "0", "]", "arg_9", "=", "pm", ".", "Normal", "(", "'alpha'", ",", "mu", "=", "0", ",", "sd", "=", ".1", ")", "arg_10", "=", "pm", ".", "Normal", "(", "'beta'", ",", "mu", "=", "0", ",", "sd", "=", "1", ")", "arg_11", "=", "arg_9", "+", "arg_10", "*", "arg_7", "pm", ".", "StudentT", "(", "'returns'", ",", "arg_6", "=", "arg_6", "+", "2", ",", "mu", "=", "arg_11", ",", "sd", "=", "arg_5", ",", "observed", "=", "arg_8", ")", "arg_12", "=", "pm", ".", "sample", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", "return", "model", ",", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2=2000, arg_3=True):\n    \"\"\"\n    Run Bayesian alpha-beta-model with T distributed returns.\n\n    This model estimates intercept (alpha) and slope (beta) of two\n    return sets. Usually, these will be algorithm returns and\n    benchmark returns (e.g. S&P500). The data is assumed to be T\n    distributed and thus is robust to outliers and takes tail events\n    into account.  If a pandas.DataFrame is passed as a benchmark, then\n    multiple linear regression is used to estimate alpha and beta.\n\n    Parameters\n    ----------\n    returns : pandas.Series\n        Series of simple returns of an algorithm or stock.\n    bmark : pandas.DataFrame\n        DataFrame of benchmark returns (e.g., S&P500) or risk factors (e.g.,\n        Fama-French SMB, HML, and UMD).\n        If bmark has more recent returns than returns_train, these dates\n        will be treated as missing values and predictions will be\n        generated for them taking market correlations into account.\n    samples : int (optional)\n        Number of posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.\n    \"\"\"\n\n    arg_4 = pd.concat([arg_0, arg_1], axis=1).dropna()\n\n    with pm.Model() as model:\n        arg_5 = pm.HalfCauchy(\n            'sigma',\n            beta=1)\n        arg_6 = pm.Exponential('nu_minus_two', 1. / 10.)\n\n        # alpha and beta\n        arg_7 = arg_4.iloc[:, 1]\n        arg_8 = arg_4.iloc[:, 0]\n\n        arg_9 = pm.Normal('alpha', mu=0, sd=.1)\n        arg_10 = pm.Normal('beta', mu=0, sd=1)\n\n        arg_11 = arg_9 + arg_10 * arg_7\n        pm.StudentT('returns',\n                    arg_6=arg_6 + 2,\n                    mu=arg_11,\n                    sd=arg_5,\n                    observed=arg_8)\n        arg_12 = pm.sample(arg_2, arg_3=arg_3)\n\n    return model, arg_12", "path": "pyfolio/bayesian.py", "identifier": "model_returns_t_alpha_beta", "docstring": "Run Bayesian alpha-beta-model with T distributed returns.\n\n    This model estimates intercept (alpha) and slope (beta) of two\n    return sets. Usually, these will be algorithm returns and\n    benchmark returns (e.g. S&P500). The data is assumed to be T\n    distributed and thus is robust to outliers and takes tail events\n    into account.  If a pandas.DataFrame is passed as a benchmark, then\n    multiple linear regression is used to estimate alpha and beta.\n\n    Parameters\n    ----------\n    returns : pandas.Series\n        Series of simple returns of an algorithm or stock.\n    bmark : pandas.DataFrame\n        DataFrame of benchmark returns (e.g., S&P500) or risk factors (e.g.,\n        Fama-French SMB, HML, and UMD).\n        If bmark has more recent returns than returns_train, these dates\n        will be treated as missing values and predictions will be\n        generated for them taking market correlations into account.\n    samples : int (optional)\n        Number of posterior samples to draw.\n\n    Returns\n    -------\n    model : pymc.Model object\n        PyMC3 model containing all random variables.\n    trace : pymc3.sampling.BaseTrace object\n        A PyMC3 trace object that contains samples for each parameter\n        of the posterior.", "docstring_tokens": ["Run", "Bayesian", "alpha", "-", "beta", "-", "model", "with", "T", "distributed", "returns", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260096}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L62-L83", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Aggregates records of a distributed array.", "language": "python", "parameters": "(self, size=None)", "return_statement": "return stk.stack(size)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "StackedArray", "(", "arg_0", ".", "_rdd", ",", "shape", "=", "arg_0", ".", "shape", ",", "split", "=", "arg_0", ".", "split", ")", "return", "arg_2", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Aggregates records of a distributed array.\n\n        Stacking should improve the performance of vectorized operations,\n        but the resulting StackedArray object only exposes a restricted set\n        of operations (e.g. map, reduce). The unFunc method can be used\n        to restore the full bolt array.\n\n        Parameters\n        ----------\n        size : int, optional, default=None\n            The maximum size for each Func (number of original records),\n            will aggregate groups of records per partition up to this size,\n            if None will aggregate all records on each partition.\n\n        Returns\n        -------\n        StackedArray\n        \"\"\"\n        arg_2 = StackedArray(arg_0._rdd, shape=arg_0.shape, split=arg_0.split)\n        return arg_2.Func(arg_1)", "path": "bolt/spark/array.py", "identifier": "BoltArraySpark.stack", "docstring": "Aggregates records of a distributed array.\n\n        Stacking should improve the performance of vectorized operations,\n        but the resulting StackedArray object only exposes a restricted set\n        of operations (e.g. map, reduce). The unstack method can be used\n        to restore the full bolt array.\n\n        Parameters\n        ----------\n        size : int, optional, default=None\n            The maximum size for each stack (number of original records),\n            will aggregate groups of records per partition up to this size,\n            if None will aggregate all records on each partition.\n\n        Returns\n        -------\n        StackedArray", "docstring_tokens": ["Aggregates", "records", "of", "a", "distributed", "array", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 260097}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L1271-L1301", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Make an XCom available for tasks to pull.", "language": "python", "parameters": "(\n            self,\n            key,\n            value,\n            execution_date=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "and", "arg_3", "<", "arg_0", ".", "execution_date", ":", "raise", "ValueError", "(", "'execution_date can not be in the past (current '", "'execution_date is {}; received {})'", ".", "format", "(", "arg_0", ".", "execution_date", ",", "arg_3", ")", ")", "XCom", ".", "set", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "task_id", "=", "arg_0", ".", "task_id", ",", "dag_id", "=", "arg_0", ".", "dag_id", ",", "arg_3", "=", "arg_3", "or", "arg_0", ".", "execution_date", ")"], "function": "def Func(\n            arg_0,\n            arg_1,\n            arg_2,\n            arg_3=None):\n        \"\"\"\n        Make an XCom available for tasks to pull.\n\n        :param key: A key for the XCom\n        :type key: str\n        :param value: A value for the XCom. The value is pickled and stored\n            in the database.\n        :type value: any pickleable object\n        :param execution_date: if provided, the XCom will not be visible until\n            this date. This can be used, for example, to send a message to a\n            task on a future date without it being immediately visible.\n        :type execution_date: datetime\n        \"\"\"\n\n        if arg_3 and arg_3 < arg_0.execution_date:\n            raise ValueError(\n                'execution_date can not be in the past (current '\n                'execution_date is {}; received {})'.format(\n                    arg_0.execution_date, arg_3))\n\n        XCom.set(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            task_id=arg_0.task_id,\n            dag_id=arg_0.dag_id,\n            arg_3=arg_3 or arg_0.execution_date)", "path": "airflow/models/taskinstance.py", "identifier": "TaskInstance.xcom_push", "docstring": "Make an XCom available for tasks to pull.\n\n        :param key: A key for the XCom\n        :type key: str\n        :param value: A value for the XCom. The value is pickled and stored\n            in the database.\n        :type value: any pickleable object\n        :param execution_date: if provided, the XCom will not be visible until\n            this date. This can be used, for example, to send a message to a\n            task on a future date without it being immediately visible.\n        :type execution_date: datetime", "docstring_tokens": ["Make", "an", "XCom", "available", "for", "tasks", "to", "pull", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260098}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L759-L809", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Sets the main channels for the pipeline", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"=====================\"", ")", "logger", ".", "debug", "(", "\"Setting main channels\"", ")", "logger", ".", "debug", "(", "\"=====================\"", ")", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "arg_0", ".", "processes", ")", ":", "logger", ".", "debug", "(", "\"[{}] Setting main channels with pid: {}\"", ".", "format", "(", "arg_2", ".", "template", ",", "arg_1", ")", ")", "arg_2", ".", "set_channels", "(", "pid", "=", "arg_1", ")", "logger", ".", "debug", "(", "\"{} {} {}\"", ".", "format", "(", "arg_2", ".", "parent_lane", ",", "arg_2", ".", "input_type", ",", "arg_2", ".", "template", ")", ")", "if", "not", "arg_2", ".", "parent_lane", "and", "arg_2", ".", "input_type", ":", "arg_0", ".", "_update_raw_input", "(", "arg_2", ")", "arg_0", ".", "_update_extra_inputs", "(", "arg_2", ")", "arg_0", ".", "_update_secondary_channels", "(", "arg_2", ")", "logger", ".", "info", "(", "colored_print", "(", "\"\\tChannels set for {} \\u2713\"", ".", "format", "(", "arg_2", ".", "template", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Sets the main channels for the pipeline\n\n        This method will parse de the :attr:`~Process.processes` attribute\n        and perform the following tasks for each process:\n\n            - Sets the input/output channels and main input forks and adds\n              them to the process's\n              :attr:`flowcraft.process.Process._context`\n              attribute (See\n              :func:`~NextflowGenerator.set_channels`).\n            - Automatically updates the main input channel of the first\n              process of each lane so that they fork from the user provide\n              parameters (See\n              :func:`~NextflowGenerator._update_raw_input`).\n            - Check for the presence of secondary channels and adds them to the\n              :attr:`~NextflowGenerator.secondary_channels` attribute.\n\n        Notes\n        -----\n        **On the secondary channel setup**: With this approach, there can only\n        be one secondary link start for each type of secondary link. For\n        instance, If there are two processes that start a secondary channel\n        for the ``SIDE_max_len`` channel, only the last one will be recorded,\n        and all receiving processes will get the channel from the latest\n        process. Secondary channels can only link if the source process if\n        downstream of the sink process in its \"forking\" path.\n        \"\"\"\n\n        logger.debug(\"=====================\")\n        logger.debug(\"Setting main channels\")\n        logger.debug(\"=====================\")\n\n        for arg_1, arg_2 in enumerate(arg_0.processes):\n\n            # Set main channels for the process\n            logger.debug(\"[{}] Setting main channels with pid: {}\".format(\n                arg_2.template, arg_1))\n            arg_2.set_channels(pid=arg_1)\n\n            # If there is no parent lane, set the raw input channel from user\n            logger.debug(\"{} {} {}\".format(arg_2.parent_lane, arg_2.input_type, arg_2.template))\n            if not arg_2.parent_lane and arg_2.input_type:\n                arg_0._update_raw_input(arg_2)\n\n            arg_0._update_extra_inputs(arg_2)\n\n            arg_0._update_secondary_channels(arg_2)\n\n            logger.info(colored_print(\n                \"\\tChannels set for {} \\u2713\".format(arg_2.template)))", "path": "flowcraft/generator/engine.py", "identifier": "NextflowGenerator._set_channels", "docstring": "Sets the main channels for the pipeline\n\n        This method will parse de the :attr:`~Process.processes` attribute\n        and perform the following tasks for each process:\n\n            - Sets the input/output channels and main input forks and adds\n              them to the process's\n              :attr:`flowcraft.process.Process._context`\n              attribute (See\n              :func:`~NextflowGenerator.set_channels`).\n            - Automatically updates the main input channel of the first\n              process of each lane so that they fork from the user provide\n              parameters (See\n              :func:`~NextflowGenerator._update_raw_input`).\n            - Check for the presence of secondary channels and adds them to the\n              :attr:`~NextflowGenerator.secondary_channels` attribute.\n\n        Notes\n        -----\n        **On the secondary channel setup**: With this approach, there can only\n        be one secondary link start for each type of secondary link. For\n        instance, If there are two processes that start a secondary channel\n        for the ``SIDE_max_len`` channel, only the last one will be recorded,\n        and all receiving processes will get the channel from the latest\n        process. Secondary channels can only link if the source process if\n        downstream of the sink process in its \"forking\" path.", "docstring_tokens": ["Sets", "the", "main", "channels", "for", "the", "pipeline"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 260099}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/genes/exon.py#L4-L77", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Build a Exon object object", "language": "python", "parameters": "(exon_info, build='37')", "return_statement": "return exon_obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'37'", ")", ":", "try", ":", "arg_2", "=", "arg_0", "[", "'chrom'", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Exons has to have a chromosome\"", ")", "try", ":", "arg_3", "=", "int", "(", "arg_0", "[", "'start'", "]", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Exon has to have a start\"", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"Exon start has to be integer\"", ")", "try", ":", "arg_4", "=", "int", "(", "arg_0", "[", "'end'", "]", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Exon has to have a end\"", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"Exon end has to be integer\"", ")", "try", ":", "arg_5", "=", "int", "(", "arg_0", "[", "'rank'", "]", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Exon has to have a rank\"", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"Exon rank has to be integer\"", ")", "try", ":", "arg_6", "=", "arg_0", "[", "'exon_id'", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Exons has to have a id\"", ")", "try", ":", "arg_7", "=", "arg_0", "[", "'transcript'", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Exons has to have a transcript\"", ")", "try", ":", "arg_8", "=", "int", "(", "arg_0", "[", "'hgnc_id'", "]", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "\"Exons has to have a hgnc_id\"", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"hgnc_id has to be integer\"", ")", "arg_9", "=", "Exon", "(", "arg_6", "=", "arg_6", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1='37'):\n    \"\"\"Build a Exon object object\n\n        Args:\n            exon_info(dict): Exon information\n\n        Returns:\n            exon_obj(Exon)\n        \n        \"exon_id\": str, # str(chrom-start-end)\n        \"chrom\": str, \n        \"start\": int, \n        \"end\": int,     \n        \"transcript\": str, # ENST ID\n        \"hgnc_id\": int,      # HGNC_id\n        \"rank\": int, # Order of exon in transcript\n        \"build\": str, # Genome build\n    \"\"\"\n\n    try:\n        arg_2 = arg_0['chrom']\n    except KeyError:\n        raise KeyError(\"Exons has to have a chromosome\")\n\n    try:\n        arg_3 = int(arg_0['start'])\n    except KeyError:\n        raise KeyError(\"Exon has to have a start\")\n    except TypeError:\n        raise TypeError(\"Exon start has to be integer\")\n    \n    try:\n        arg_4 = int(arg_0['end'])\n    except KeyError:\n        raise KeyError(\"Exon has to have a end\")\n    except TypeError:\n        raise TypeError(\"Exon end has to be integer\")\n\n    try:\n        arg_5 = int(arg_0['rank'])\n    except KeyError:\n        raise KeyError(\"Exon has to have a rank\")\n    except TypeError:\n        raise TypeError(\"Exon rank has to be integer\")\n\n    try:\n        arg_6 = arg_0['exon_id']\n    except KeyError:\n        raise KeyError(\"Exons has to have a id\")\n\n    try:\n        arg_7 = arg_0['transcript']\n    except KeyError:\n        raise KeyError(\"Exons has to have a transcript\")\n\n    try:\n        arg_8 = int(arg_0['hgnc_id'])\n    except KeyError:\n        raise KeyError(\"Exons has to have a hgnc_id\")\n    except TypeError:\n        raise TypeError(\"hgnc_id has to be integer\")\n\n    arg_9 = Exon(\n        arg_6 = arg_6,\n        arg_2 = arg_2,\n        arg_3 = arg_3,\n        arg_4 = arg_4,\n        arg_5 = arg_5,\n        arg_7 = arg_7,\n        arg_8 = arg_8,\n        arg_1 = arg_1,\n    )\n\n    return arg_9", "path": "scout/build/genes/exon.py", "identifier": "build_exon", "docstring": "Build a Exon object object\n\n        Args:\n            exon_info(dict): Exon information\n\n        Returns:\n            exon_obj(Exon)\n        \n        \"exon_id\": str, # str(chrom-start-end)\n        \"chrom\": str, \n        \"start\": int, \n        \"end\": int,     \n        \"transcript\": str, # ENST ID\n        \"hgnc_id\": int,      # HGNC_id\n        \"rank\": int, # Order of exon in transcript\n        \"build\": str, # Genome build", "docstring_tokens": ["Build", "a", "Exon", "object", "object"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260100}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L601-L648", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Notify learners about a program in which they've been enrolled.", "language": "python", "parameters": "(cls, enterprise_customer, program_details, users)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "get", "(", "'title'", ")", "arg_5", "=", "arg_2", ".", "get", "(", "'type'", ")", "arg_6", "=", "arg_2", ".", "get", "(", "'uuid'", ")", "arg_7", "=", "get_configuration_value_for_site", "(", "arg_1", ".", "site", ",", "'LMS_ROOT_URL'", ",", "settings", ".", "LMS_ROOT_URL", ")", "arg_8", "=", "urlquote", "(", "'/dashboard/programs/{program_uuid}/?tpa_hint={tpa_hint}'", ".", "format", "(", "arg_6", "=", "arg_6", ",", "tpa_hint", "=", "arg_1", ".", "identity_provider", ",", ")", ")", "arg_9", "=", "'{site}/{login_or_register}?next={program_path}'", ".", "format", "(", "site", "=", "arg_7", ",", "arg_13", "=", "'{login_or_register}'", ",", "arg_8", "=", "arg_8", ")", "arg_10", "=", "'program'", "arg_11", "=", "get_earliest_start_date_from_program", "(", "arg_2", ")", "with", "mail", ".", "get_connection", "(", ")", "as", "email_conn", ":", "for", "arg_12", "in", "arg_3", ":", "arg_13", "=", "'register'", "if", "isinstance", "(", "arg_12", ",", "PendingEnterpriseCustomerUser", ")", "else", "'login'", "arg_9", "=", "arg_9", ".", "format", "(", "arg_13", "=", "arg_13", ")", "send_email_notification_message", "(", "arg_12", "=", "arg_12", ",", "enrolled_in", "=", "{", "'name'", ":", "arg_4", ",", "'url'", ":", "arg_9", ",", "'type'", ":", "arg_10", ",", "'start'", ":", "arg_11", ",", "'branding'", ":", "arg_5", ",", "}", ",", "arg_1", "=", "arg_1", ",", "email_connection", "=", "email_conn", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Notify learners about a program in which they've been enrolled.\n\n        Args:\n            enterprise_customer: The EnterpriseCustomer being linked to\n            program_details: Details about the specific program the learners were enrolled in\n            users: An iterable of the users or pending users who were enrolled\n        \"\"\"\n        arg_4 = arg_2.get('title')\n        arg_5 = arg_2.get('type')\n        arg_6 = arg_2.get('uuid')\n\n        arg_7 = get_configuration_value_for_site(\n            arg_1.site,\n            'LMS_ROOT_URL',\n            settings.LMS_ROOT_URL\n        )\n        arg_8 = urlquote(\n            '/dashboard/programs/{program_uuid}/?tpa_hint={tpa_hint}'.format(\n                arg_6=arg_6,\n                tpa_hint=arg_1.identity_provider,\n            )\n        )\n        arg_9 = '{site}/{login_or_register}?next={program_path}'.format(\n            site=arg_7,\n            arg_13='{login_or_register}',\n            arg_8=arg_8\n        )\n        arg_10 = 'program'\n        arg_11 = get_earliest_start_date_from_program(arg_2)\n\n        with mail.get_connection() as email_conn:\n            for arg_12 in arg_3:\n                arg_13 = 'register' if isinstance(arg_12, PendingEnterpriseCustomerUser) else 'login'\n                arg_9 = arg_9.format(arg_13=arg_13)\n                send_email_notification_message(\n                    arg_12=arg_12,\n                    enrolled_in={\n                        'name': arg_4,\n                        'url': arg_9,\n                        'type': arg_10,\n                        'start': arg_11,\n                        'branding': arg_5,\n                    },\n                    arg_1=arg_1,\n                    email_connection=email_conn\n                )", "path": "enterprise/admin/views.py", "identifier": "EnterpriseCustomerManageLearnersView.notify_program_learners", "docstring": "Notify learners about a program in which they've been enrolled.\n\n        Args:\n            enterprise_customer: The EnterpriseCustomer being linked to\n            program_details: Details about the specific program the learners were enrolled in\n            users: An iterable of the users or pending users who were enrolled", "docstring_tokens": ["Notify", "learners", "about", "a", "program", "in", "which", "they", "ve", "been", "enrolled", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260101}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L813-L839", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Pull the version part out of a string.", "language": "python", "parameters": "(\n        egg_info, search_name, link,\n        _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ".", "compile", "(", "r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)'", ",", "arg_4", ".", "I", ")", ")", ":", "arg_7", "=", "arg_3", ".", "search", "(", "arg_0", ")", "if", "not", "arg_7", ":", "logger", ".", "debug", "(", "'Could not parse version from link: %s'", ",", "arg_2", ")", "return", "None", "if", "arg_1", "is", "None", ":", "arg_8", "=", "arg_7", ".", "group", "(", "0", ")", "return", "arg_8", "[", "arg_8", ".", "index", "(", "'-'", ")", ":", "]", "arg_9", "=", "arg_7", ".", "group", "(", "0", ")", ".", "lower", "(", ")", "arg_9", "=", "arg_9", ".", "replace", "(", "'_'", ",", "'-'", ")", "arg_10", "=", "arg_1", ".", "lower", "(", ")", "+", "\"-\"", "if", "arg_9", ".", "startswith", "(", "arg_10", ")", ":", "return", "arg_7", ".", "group", "(", "0", ")", "[", "len", "(", "arg_10", ")", ":", "]", "else", ":", "return", "None"], "function": "def Func(\n        arg_0, arg_1, arg_2,\n        arg_3=arg_4.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', arg_4.I)):\n    \"\"\"Pull the version part out of a string.\n\n    :param egg_info: The string to parse. E.g. foo-2.1\n    :param search_name: The name of the package this belongs to. None to\n        infer the name. Note that this cannot unambiguously parse strings\n        like foo-2-2 which might be foo, 2-2 or foo-2, 2.\n    :param link: The link the string came from, for logging on failure.\n    \"\"\"\n    arg_7 = arg_3.search(arg_0)\n    if not arg_7:\n        logger.debug('Could not parse version from link: %s', arg_2)\n        return None\n    if arg_1 is None:\n        arg_8 = arg_7.group(0)\n        return arg_8[arg_8.index('-'):]\n    arg_9 = arg_7.group(0).lower()\n    # To match the \"safe\" name that pkg_resources creates:\n    arg_9 = arg_9.replace('_', '-')\n    # project name and version must be separated by a dash\n    arg_10 = arg_1.lower() + \"-\"\n    if arg_9.startswith(arg_10):\n        return arg_7.group(0)[len(arg_10):]\n    else:\n        return None", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/index.py", "identifier": "egg_info_matches", "docstring": "Pull the version part out of a string.\n\n    :param egg_info: The string to parse. E.g. foo-2.1\n    :param search_name: The name of the package this belongs to. None to\n        infer the name. Note that this cannot unambiguously parse strings\n        like foo-2-2 which might be foo, 2-2 or foo-2, 2.\n    :param link: The link the string came from, for logging on failure.", "docstring_tokens": ["Pull", "the", "version", "part", "out", "of", "a", "string", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260102}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1622-L1641", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Look through the jobs table and get the demand - minimum and maximum\n    number of workers requested, if new workers are to be allocated, if there\n    are any untended dead workers, for all running jobs.", "language": "python", "parameters": "(self,)", "return_statement": "return [self._jobs.jobDemandNamedTuple._make(r) for r in rows]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", ")", ":", "arg_1", "=", "arg_0", ".", "_getMatchingRowsWithRetries", "(", "arg_0", ".", "_jobs", ",", "dict", "(", "status", "=", "arg_0", ".", "STATUS_RUNNING", ")", ",", "[", "arg_0", ".", "_jobs", ".", "pubToDBNameDict", "[", "f", "]", "for", "f", "in", "arg_0", ".", "_jobs", ".", "jobDemandNamedTuple", ".", "_fields", "]", ")", "return", "[", "arg_0", ".", "_jobs", ".", "jobDemandNamedTuple", ".", "_make", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]"], "function": "def Func(arg_0,):\n    \"\"\" Look through the jobs table and get the demand - minimum and maximum\n    number of workers requested, if new workers are to be allocated, if there\n    are any untended dead workers, for all running jobs.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:      list of ClientJobsDAO._jobs.jobDemandNamedTuple nametuples\n                  containing the demand - min and max workers,\n                  allocate_new_workers, untended_dead_workers, num_failed_workers\n                  for each running (STATUS_RUNNING) job. Empty list when there\n                  isn't any demand.\n\n    \"\"\"\n    arg_1 = arg_0._getMatchingRowsWithRetries(\n      arg_0._jobs, dict(status=arg_0.STATUS_RUNNING),\n      [arg_0._jobs.pubToDBNameDict[f]\n       for f in arg_0._jobs.jobDemandNamedTuple._fields])\n\n    return [arg_0._jobs.jobDemandNamedTuple._make(arg_2) for arg_2 in arg_1]", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.jobGetDemand", "docstring": "Look through the jobs table and get the demand - minimum and maximum\n    number of workers requested, if new workers are to be allocated, if there\n    are any untended dead workers, for all running jobs.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:      list of ClientJobsDAO._jobs.jobDemandNamedTuple nametuples\n                  containing the demand - min and max workers,\n                  allocate_new_workers, untended_dead_workers, num_failed_workers\n                  for each running (STATUS_RUNNING) job. Empty list when there\n                  isn't any demand.", "docstring_tokens": ["Look", "through", "the", "jobs", "table", "and", "get", "the", "demand", "-", "minimum", "and", "maximum", "number", "of", "workers", "requested", "if", "new", "workers", "are", "to", "be", "allocated", "if", "there", "are", "any", "untended", "dead", "workers", "for", "all", "running", "jobs", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260103}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L818-L824", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Read a syntax-quote and set the syntax-quoting state in the reader.", "language": "python", "parameters": "(ctx: ReaderContext)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "ReaderForm", ":", "arg_2", "=", "arg_0", ".", "reader", ".", "advance", "(", ")", "assert", "arg_2", "==", "\"`\"", "with", "arg_0", ".", "syntax_quoted", "(", ")", ":", "return", "_process_syntax_quoted_form", "(", "arg_0", ",", "_read_next_consuming_comment", "(", "arg_0", ")", ")"], "function": "def Func(arg_0: arg_1) -> ReaderForm:\n    \"\"\"Read a syntax-quote and set the syntax-quoting state in the reader.\"\"\"\n    arg_2 = arg_0.reader.advance()\n    assert arg_2 == \"`\"\n\n    with arg_0.syntax_quoted():\n        return _process_syntax_quoted_form(arg_0, _read_next_consuming_comment(arg_0))", "path": "src/basilisp/lang/reader.py", "identifier": "_read_syntax_quoted", "docstring": "Read a syntax-quote and set the syntax-quoting state in the reader.", "docstring_tokens": ["Read", "a", "syntax", "-", "quote", "and", "set", "the", "syntax", "-", "quoting", "state", "in", "the", "reader", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 260104}
{"url": "https://github.com/uploadcare/pyuploadcare/blob/cefddc0306133a71e37b18e8700df5948ef49b37/pyuploadcare/api_resources.py#L240-L265", "sha": "cefddc0306133a71e37b18e8700df5948ef49b37", "docstring_summary": "Creates a File Copy on Uploadcare or Custom Storage.\n        \n        File.copy method is deprecated and will be removed in 4.0.0.\n        Please use `create_local_copy` and `create_remote_copy` instead.", "language": "python", "parameters": "(self, effects=None, target=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "\"\"\"File.Func method is deprecated and will be            removed in 4.0.0.            Please use `create_local_Func`            and `create_remote_Func` instead.        \"\"\"", "logger", ".", "warn", "(", "'API Warning: {0}'", ".", "format", "(", "arg_3", ")", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_0", ".", "create_remote_Func", "(", "arg_2", ",", "arg_1", ")", "else", ":", "return", "arg_0", ".", "create_local_Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Creates a File Copy on Uploadcare or Custom Storage.\n        \n        File.Func method is deprecated and will be removed in 4.0.0.\n        Please use `create_local_Func` and `create_remote_Func` instead.\n\n        Args:\n            - effects:\n                Adds CDN image effects. If ``self.default_effects`` property\n                is set effects will be combined with default effects.\n            - target:\n                Name of a custom storage connected to your project.\n                Uploadcare storage is used if target is absent.\n\n        \"\"\"\n        arg_3 = \"\"\"File.Func method is deprecated and will be\n            removed in 4.0.0.\n            Please use `create_local_Func`\n            and `create_remote_Func` instead.\n        \"\"\"\n        logger.warn('API Warning: {0}'.format(arg_3))\n\n        if arg_2 is not None:\n            return arg_0.create_remote_Func(arg_2, arg_1)\n        else:\n            return arg_0.create_local_Func(arg_1)", "path": "pyuploadcare/api_resources.py", "identifier": "File.copy", "docstring": "Creates a File Copy on Uploadcare or Custom Storage.\n        \n        File.copy method is deprecated and will be removed in 4.0.0.\n        Please use `create_local_copy` and `create_remote_copy` instead.\n\n        Args:\n            - effects:\n                Adds CDN image effects. If ``self.default_effects`` property\n                is set effects will be combined with default effects.\n            - target:\n                Name of a custom storage connected to your project.\n                Uploadcare storage is used if target is absent.", "docstring_tokens": ["Creates", "a", "File", "Copy", "on", "Uploadcare", "or", "Custom", "Storage", ".", "File", ".", "copy", "method", "is", "deprecated", "and", "will", "be", "removed", "in", "4", ".", "0", ".", "0", ".", "Please", "use", "create_local_copy", "and", "create_remote_copy", "instead", "."], "nwo": "uploadcare/pyuploadcare", "score": 0.289876796890331, "idx": 260105}
{"url": "https://github.com/VingtCinq/python-resize-image/blob/a4e645792ef30c5fcc558df6da6de18b1ecb95ea/resizeimage/resizeimage.py#L50-L53", "sha": "a4e645792ef30c5fcc558df6da6de18b1ecb95ea", "docstring_summary": "Check that the image height is superior to `height`", "language": "python", "parameters": "(image, height)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ">", "arg_0", ".", "size", "[", "1", "]", ":", "raise", "ImageSizeError", "(", "arg_0", ".", "size", "[", "1", "]", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Check that the image height is superior to `height`\"\"\"\n    if arg_1 > arg_0.size[1]:\n        raise ImageSizeError(arg_0.size[1], arg_1)", "path": "resizeimage/resizeimage.py", "identifier": "_height_is_big_enough", "docstring": "Check that the image height is superior to `height`", "docstring_tokens": ["Check", "that", "the", "image", "height", "is", "superior", "to", "height"], "nwo": "VingtCinq/python-resize-image", "score": 0.37283617366259525, "idx": 260106}
{"url": "https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/credentials.py#L46-L52", "sha": "71c798378e365286b7cc03c06e4d7d24c7de8fc4", "docstring_summary": "Helper to read an environment variable", "language": "python", "parameters": "(self, env_var)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "environ", ".", "get", "(", "arg_1", ")", "if", "not", "arg_2", ":", "raise", "ValueError", "(", "'Missing environment variable:%s'", "%", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Helper to read an environment variable\n        \"\"\"\n        arg_2 = os.environ.get(arg_1)\n        if not arg_2:\n            raise ValueError('Missing environment variable:%s' % arg_1)\n        return arg_2", "path": "keyring/credentials.py", "identifier": "EnvironCredential._get_env", "docstring": "Helper to read an environment variable", "docstring_tokens": ["Helper", "to", "read", "an", "environment", "variable"], "nwo": "jaraco/keyring", "score": 0.7254776697026839, "idx": 260107}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/time_frequency.py#L71-L118", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Converts sample indices into STFT frames.", "language": "python", "parameters": "(samples, hop_length=512, n_fft=None)", "return_statement": "return np.floor((samples - offset) // hop_length).astype(int)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "512", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "0", "if", "arg_2", "is", "not", "None", ":", "arg_3", "=", "int", "(", "arg_2", "//", "2", ")", "arg_0", "=", "np", ".", "asanyarray", "(", "arg_0", ")", "return", "np", ".", "floor", "(", "(", "arg_0", "-", "arg_3", ")", "//", "arg_1", ")", ".", "astype", "(", "int", ")"], "function": "def Func(arg_0, arg_1=512, arg_2=None):\n    \"\"\"Converts sample indices into STFT frames.\n\n    Examples\n    --------\n    >>> # Get the frame numbers for every 256 samples\n    >>> librosa.Func(np.arange(0, 22050, 256))\n    array([ 0,  0,  1,  1,  2,  2,  3,  3,  4,  4,  5,  5,  6,  6,\n            7,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 13, 13,\n           14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20,\n           21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n           28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34,\n           35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41,\n           42, 42, 43])\n\n    Parameters\n    ----------\n    samples : int or np.ndarray [shape=(n,)]\n        sample index or vector of sample indices\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    n_fft : None or int > 0 [scalar]\n        Optional: length of the FFT window.\n        If given, time conversion will include an offset of `- n_fft / 2`\n        to counteract windowing effects in STFT.\n\n        .. note:: This may result in negative frame indices.\n\n    Returns\n    -------\n    frames : int or np.ndarray [shape=(n,), dtype=int]\n        Frame numbers corresponding to the given times:\n        `frames[i] = floor( samples[i] / hop_length )`\n\n    See Also\n    --------\n    samples_to_time : convert sample indices to time values\n    frames_to_samples : convert frame indices to sample indices\n    \"\"\"\n\n    arg_3 = 0\n    if arg_2 is not None:\n        arg_3 = int(arg_2 // 2)\n\n    arg_0 = np.asanyarray(arg_0)\n    return np.floor((arg_0 - arg_3) // arg_1).astype(int)", "path": "librosa/core/time_frequency.py", "identifier": "samples_to_frames", "docstring": "Converts sample indices into STFT frames.\n\n    Examples\n    --------\n    >>> # Get the frame numbers for every 256 samples\n    >>> librosa.samples_to_frames(np.arange(0, 22050, 256))\n    array([ 0,  0,  1,  1,  2,  2,  3,  3,  4,  4,  5,  5,  6,  6,\n            7,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 13, 13,\n           14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20,\n           21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n           28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34,\n           35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41,\n           42, 42, 43])\n\n    Parameters\n    ----------\n    samples : int or np.ndarray [shape=(n,)]\n        sample index or vector of sample indices\n\n    hop_length : int > 0 [scalar]\n        number of samples between successive frames\n\n    n_fft : None or int > 0 [scalar]\n        Optional: length of the FFT window.\n        If given, time conversion will include an offset of `- n_fft / 2`\n        to counteract windowing effects in STFT.\n\n        .. note:: This may result in negative frame indices.\n\n    Returns\n    -------\n    frames : int or np.ndarray [shape=(n,), dtype=int]\n        Frame numbers corresponding to the given times:\n        `frames[i] = floor( samples[i] / hop_length )`\n\n    See Also\n    --------\n    samples_to_time : convert sample indices to time values\n    frames_to_samples : convert frame indices to sample indices", "docstring_tokens": ["Converts", "sample", "indices", "into", "STFT", "frames", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 260108}
{"url": "https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L338-L348", "sha": "12172363d14eaedba2db4c452ef995b14f1b630d", "docstring_summary": "Use YAML from a file or stdin to populate the readme.", "language": "python", "parameters": "(proto_dataset_uri, input)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dtoolcore", ".", "ProtoDataSet", ".", "from_uri", "(", "uri", "=", "arg_0", ")", "_validate_and_put_readme", "(", "arg_2", ",", "arg_1", ".", "read", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Use YAML from a file or stdin to populate the readme.\n\n    To stream content from stdin use \"-\", e.g.\n\n    echo \"desc: my data\" | dtool readme Func <DS_URI> -\n    \"\"\"\n    arg_2 = dtoolcore.ProtoDataSet.from_uri(\n        uri=arg_0\n    )\n    _validate_and_put_readme(arg_2, arg_1.read())", "path": "dtool_create/dataset.py", "identifier": "write", "docstring": "Use YAML from a file or stdin to populate the readme.\n\n    To stream content from stdin use \"-\", e.g.\n\n    echo \"desc: my data\" | dtool readme write <DS_URI> -", "docstring_tokens": ["Use", "YAML", "from", "a", "file", "or", "stdin", "to", "populate", "the", "readme", "."], "nwo": "jic-dtool/dtool-create", "score": 0.25890992733444657, "idx": 260109}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L209-L218", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Execute 'source'. If 'hidden', do not show any output.", "language": "python", "parameters": "(self, source, hidden)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "kernel_manager", ".", "shell_channel", ".", "execute", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_request_info", "[", "'execute'", "]", "[", "arg_3", "]", "=", "arg_0", ".", "_ExecutionRequest", "(", "arg_3", ",", "'user'", ")", "arg_0", ".", "_hidden", "=", "arg_2", "if", "not", "arg_2", ":", "arg_0", ".", "executing", ".", "emit", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Execute 'source'. If 'hidden', do not show any output.\n\n        See parent class :meth:`execute` docstring for full details.\n        \"\"\"\n        arg_3 = arg_0.kernel_manager.shell_channel.execute(arg_1, arg_2)\n        arg_0._request_info['execute'][arg_3] = arg_0._ExecutionRequest(arg_3, 'user')\n        arg_0._hidden = arg_2\n        if not arg_2:\n            arg_0.executing.emit(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._execute", "docstring": "Execute 'source'. If 'hidden', do not show any output.\n\n        See parent class :meth:`execute` docstring for full details.", "docstring_tokens": ["Execute", "source", ".", "If", "hidden", "do", "not", "show", "any", "output", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260110}
{"url": "https://github.com/cltrudeau/django-flowr/blob/d077b90376ede33721db55ff29e08b8a16ed17ae/flowr/models.py#L290-L300", "sha": "d077b90376ede33721db55ff29e08b8a16ed17ae", "docstring_summary": "Returns True if it is legal to remove this node and still leave the\n        graph as a single connected entity, not splitting it into a forest.\n        Only nodes with no children or those who cause a cycle can be deleted.", "language": "python", "parameters": "(self)", "return_statement": "return children.issubset(ancestors)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "children", ".", "count", "(", ")", "==", "0", ":", "return", "True", "arg_1", "=", "set", "(", "arg_0", ".", "ancestors_root", "(", ")", ")", "arg_2", "=", "set", "(", "arg_0", ".", "children", ".", "all", "(", ")", ")", "return", "arg_2", ".", "issubset", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns True if it is legal to remove this node and still leave the\n        graph as a single connected entity, not splitting it into a forest.\n        Only nodes with no children or those who cause a cycle can be deleted.\n        \"\"\"\n        if arg_0.children.count() == 0:\n            return True\n\n        arg_1 = set(arg_0.ancestors_root())\n        arg_2 = set(arg_0.children.all())\n        return arg_2.issubset(arg_1)", "path": "flowr/models.py", "identifier": "Node.can_remove", "docstring": "Returns True if it is legal to remove this node and still leave the\n        graph as a single connected entity, not splitting it into a forest.\n        Only nodes with no children or those who cause a cycle can be deleted.", "docstring_tokens": ["Returns", "True", "if", "it", "is", "legal", "to", "remove", "this", "node", "and", "still", "leave", "the", "graph", "as", "a", "single", "connected", "entity", "not", "splitting", "it", "into", "a", "forest", ".", "Only", "nodes", "with", "no", "children", "or", "those", "who", "cause", "a", "cycle", "can", "be", "deleted", "."], "nwo": "cltrudeau/django-flowr", "score": 0.09252797783733271, "idx": 260111}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dag_processing.py#L1285-L1320", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Kill all child processes on exit since we don't want to leave\n        them as orphaned.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_all_pids", "(", ")", "if", "len", "(", "arg_1", ")", ">", "0", ":", "arg_2", "=", "psutil", ".", "Process", "(", "os", ".", "getpid", "(", ")", ")", "arg_3", "=", "[", "x", "for", "x", "in", "arg_2", ".", "children", "(", "recursive", "=", "True", ")", "if", "x", ".", "is_running", "(", ")", "and", "x", ".", "pid", "in", "arg_1", "]", "for", "arg_4", "in", "arg_3", ":", "arg_0", ".", "log", ".", "info", "(", "\"Terminating child PID: %s\"", ",", "arg_4", ".", "pid", ")", "arg_4", ".", "terminate", "(", ")", "arg_5", "=", "5", "arg_0", ".", "log", ".", "info", "(", "\"Waiting up to %s seconds for processes to exit...\"", ",", "arg_5", ")", "try", ":", "psutil", ".", "wait_procs", "(", "arg_3", ",", "arg_5", "=", "arg_5", ",", "callback", "=", "lambda", "x", ":", "arg_0", ".", "log", ".", "info", "(", "'Terminated PID %s'", ",", "x", ".", "pid", ")", ")", "except", "psutil", ".", "TimeoutExpired", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Ran out of time while waiting for processes to exit\"", ")", "arg_3", "=", "[", "x", "for", "x", "in", "arg_2", ".", "children", "(", "recursive", "=", "True", ")", "if", "x", ".", "is_running", "(", ")", "and", "x", ".", "pid", "in", "arg_1", "]", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_0", ".", "log", ".", "info", "(", "\"SIGKILL processes that did not terminate gracefully\"", ")", "for", "arg_4", "in", "arg_3", ":", "arg_0", ".", "log", ".", "info", "(", "\"Killing child PID: %s\"", ",", "arg_4", ".", "pid", ")", "arg_4", ".", "kill", "(", ")", "arg_4", ".", "wait", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Kill all child processes on exit since we don't want to leave\n        them as orphaned.\n        \"\"\"\n        arg_1 = arg_0.get_all_pids()\n        if len(arg_1) > 0:\n            # First try SIGTERM\n            arg_2 = psutil.Process(os.getpid())\n            # Only check child processes to ensure that we don't have a case\n            # where we kill the wrong process because a child process died\n            # but the PID got reused.\n            arg_3 = [x for x in arg_2.children(recursive=True)\n                               if x.is_running() and x.pid in arg_1]\n            for arg_4 in arg_3:\n                arg_0.log.info(\"Terminating child PID: %s\", arg_4.pid)\n                arg_4.terminate()\n            # TODO: Remove magic number\n            arg_5 = 5\n            arg_0.log.info(\"Waiting up to %s seconds for processes to exit...\", arg_5)\n            try:\n                psutil.wait_procs(\n                    arg_3, arg_5=arg_5,\n                    callback=lambda x: arg_0.log.info('Terminated PID %s', x.pid))\n            except psutil.TimeoutExpired:\n                arg_0.log.debug(\"Ran out of time while waiting for processes to exit\")\n\n            # Then SIGKILL\n            arg_3 = [x for x in arg_2.children(recursive=True)\n                               if x.is_running() and x.pid in arg_1]\n            if len(arg_3) > 0:\n                arg_0.log.info(\"SIGKILL processes that did not terminate gracefully\")\n                for arg_4 in arg_3:\n                    arg_0.log.info(\"Killing child PID: %s\", arg_4.pid)\n                    arg_4.kill()\n                    arg_4.wait()", "path": "airflow/utils/dag_processing.py", "identifier": "DagFileProcessorManager.end", "docstring": "Kill all child processes on exit since we don't want to leave\n        them as orphaned.", "docstring_tokens": ["Kill", "all", "child", "processes", "on", "exit", "since", "we", "don", "t", "want", "to", "leave", "them", "as", "orphaned", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260112}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/explorer/src/python/args.py#L75-L82", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "add optional verbose argument", "language": "python", "parameters": "(parser)", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "add_argument", "(", "'--verbose'", ",", "metavar", "=", "'(a boolean; default: \"false\")'", ",", "type", "=", "bool", ",", "default", "=", "False", ")", "return", "arg_0"], "function": "def Func(arg_0):\n  \"\"\" add optional verbose argument\"\"\"\n  arg_0.add_argument(\n      '--verbose',\n      metavar='(a boolean; default: \"false\")',\n      type=bool,\n      default=False)\n  return arg_0", "path": "heron/tools/explorer/src/python/args.py", "identifier": "add_verbose", "docstring": "add optional verbose argument", "docstring_tokens": ["add", "optional", "verbose", "argument"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260113}
{"url": "https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/views/rest.py#L357-L374", "sha": "f243ea1d01ab0a3bc92ade3262d1abdd2bc32447", "docstring_summary": "Get file.", "language": "python", "parameters": "(self, pid, record, key, version_id, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "**", "arg_5", ")", ":", "try", ":", "arg_6", "=", "arg_2", ".", "files", "[", "str", "(", "arg_3", ")", "]", ".", "Func_version", "(", "arg_4", "=", "arg_4", ")", "return", "arg_0", ".", "make_response", "(", "arg_6", "=", "arg_6", "or", "abort", "(", "404", ")", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "except", "KeyError", ":", "abort", "(", "404", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, **arg_5):\n        \"\"\"Get file.\n\n        Permission required: `read_permission_factory`.\n\n        :param pid: Pid object (from url).\n        :param record: Record object resolved from the pid.\n        :param key: Unique identifier for the file in the deposit.\n        :param version_id: File version. Optional. If no version is provided,\n            the last version is retrieved.\n        :returns: the file content.\n        \"\"\"\n        try:\n            arg_6 = arg_2.files[str(arg_3)].Func_version(arg_4=arg_4)\n            return arg_0.make_response(\n                arg_6=arg_6 or abort(404), arg_1=arg_1, arg_2=arg_2)\n        except KeyError:\n            abort(404)", "path": "invenio_deposit/views/rest.py", "identifier": "DepositFileResource.get", "docstring": "Get file.\n\n        Permission required: `read_permission_factory`.\n\n        :param pid: Pid object (from url).\n        :param record: Record object resolved from the pid.\n        :param key: Unique identifier for the file in the deposit.\n        :param version_id: File version. Optional. If no version is provided,\n            the last version is retrieved.\n        :returns: the file content.", "docstring_tokens": ["Get", "file", "."], "nwo": "inveniosoftware/invenio-deposit", "score": 0.28321464543308295, "idx": 260114}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/flame_graph.py#L75-L79", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Counts and fills sample counts inside call tree.", "language": "python", "parameters": "(self, node)", "return_statement": "return node['sampleCount']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "[", "'sampleCount'", "]", "+=", "sum", "(", "arg_0", ".", "Func", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "[", "'children'", "]", ")", "return", "arg_1", "[", "'sampleCount'", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Counts and fills sample counts inside call tree.\"\"\"\n        arg_1['sampleCount'] += sum(\n            arg_0.Func(arg_2) for arg_2 in arg_1['children'])\n        return arg_1['sampleCount']", "path": "vprof/flame_graph.py", "identifier": "_StatProfiler._fill_sample_count", "docstring": "Counts and fills sample counts inside call tree.", "docstring_tokens": ["Counts", "and", "fills", "sample", "counts", "inside", "call", "tree", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 260115}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L28-L65", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Function for converting a dict to an array suitable for sklearn.", "language": "python", "parameters": "(self, data, scale=True)", "return_statement": "return ds, sampled", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "len", "(", "arg_0", ".", "analytes", ")", "==", "1", ":", "arg_3", "=", "nominal_values", "(", "arg_1", "[", "arg_0", ".", "analytes", "[", "0", "]", "]", ")", "arg_4", "=", "np", ".", "array", "(", "list", "(", "zip", "(", "arg_3", ",", "np", ".", "zeros", "(", "len", "(", "arg_3", ")", ")", ")", ")", ")", "else", ":", "arg_3", "=", "[", "nominal_values", "(", "arg_1", "[", "a", "]", ")", "for", "a", "in", "arg_0", ".", "analytes", "]", "arg_4", "=", "np", ".", "vstack", "(", "arg_3", ")", ".", "T", "arg_5", "=", "np", ".", "isfinite", "(", "arg_4", ")", ".", "sum", "(", "1", ")", "==", "arg_4", ".", "shape", "[", "1", "]", "arg_6", "=", "np", ".", "arange", "(", "arg_1", "[", "arg_0", ".", "analytes", "[", "0", "]", "]", ".", "size", ")", "[", "arg_5", "]", "arg_4", "=", "arg_4", "[", "arg_5", "]", "if", "arg_2", ":", "arg_4", "=", "arg_0", ".", "scaler", ".", "transform", "(", "arg_4", ")", "return", "arg_4", ",", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Function for converting a dict to an array suitable for sklearn.\n\n        Parameters\n        ----------\n        data : dict\n            A dict of data, containing all elements of\n            `analytes` as items.\n        scale : bool\n            Whether or not to scale the data. Should always be\n            `True`, unless used by `classifier.fitting_data`\n            where a scaler hasn't been created yet.\n\n        Returns\n        -------\n        A data array suitable for use with `sklearn.cluster`.\n        \"\"\"\n        if len(arg_0.analytes) == 1:\n            # if single analyte\n            arg_3 = nominal_values(arg_1[arg_0.analytes[0]])\n            arg_4 = np.array(list(zip(arg_3, np.zeros(len(arg_3)))))\n        else:\n            # package multiple analytes\n            arg_3 = [nominal_values(arg_1[a]) for a in arg_0.analytes]\n            arg_4 = np.vstack(arg_3).T\n\n        # identify all nan values\n        arg_5 = np.isfinite(arg_4).sum(1) == arg_4.shape[1]\n        # remember which values are sampled\n        arg_6 = np.arange(arg_1[arg_0.analytes[0]].size)[arg_5]\n        # remove all nan values\n        arg_4 = arg_4[arg_5]\n\n        if arg_2:\n            arg_4 = arg_0.scaler.transform(arg_4)\n\n        return arg_4, arg_6", "path": "latools/filtering/classifier_obj.py", "identifier": "classifier.format_data", "docstring": "Function for converting a dict to an array suitable for sklearn.\n\n        Parameters\n        ----------\n        data : dict\n            A dict of data, containing all elements of\n            `analytes` as items.\n        scale : bool\n            Whether or not to scale the data. Should always be\n            `True`, unless used by `classifier.fitting_data`\n            where a scaler hasn't been created yet.\n\n        Returns\n        -------\n        A data array suitable for use with `sklearn.cluster`.", "docstring_tokens": ["Function", "for", "converting", "a", "dict", "to", "an", "array", "suitable", "for", "sklearn", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 260116}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_hash.py#L528-L579", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "r\"\"\"\n    Converts `data` into a hashable byte representation if an appropriate\n    hashing function is known.", "language": "python", "parameters": "(data, types=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_0", "is", "None", ":", "arg_2", "=", "b'NONE'", "arg_3", "=", "b'NULL'", "elif", "isinstance", "(", "arg_0", ",", "six", ".", "binary_type", ")", ":", "arg_2", "=", "arg_0", "arg_3", "=", "b'TXT'", "elif", "isinstance", "(", "arg_0", ",", "six", ".", "text_type", ")", ":", "arg_2", "=", "arg_0", ".", "encode", "(", "'utf-8'", ")", "arg_3", "=", "b'TXT'", "elif", "isinstance", "(", "arg_0", ",", "_intlike", ")", ":", "arg_2", "=", "_int_to_bytes", "(", "arg_0", ")", "arg_3", "=", "b'INT'", "elif", "isinstance", "(", "arg_0", ",", "float", ")", ":", "arg_4", ",", "arg_5", "=", "float", "(", "arg_0", ")", ".", "as_integer_ratio", "(", ")", "arg_2", "=", "_int_to_bytes", "(", "arg_4", ")", "+", "b'/'", "+", "_int_to_bytes", "(", "arg_5", ")", "arg_3", "=", "b'FLT'", "else", ":", "arg_6", "=", "_HASHABLE_EXTENSIONS", ".", "lookup", "(", "arg_0", ")", "arg_3", ",", "arg_2", "=", "arg_6", "(", "arg_0", ")", "if", "arg_1", ":", "return", "arg_3", ",", "arg_2", "else", ":", "return", "b''", ",", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n    r\"\"\"\n    Converts `data` into a hashable byte representation if an appropriate\n    hashing function is known.\n\n    Args:\n        data (object): ordered data with structure\n        types (bool): include type prefixes in the hash\n\n    Returns:\n        tuple(bytes, bytes): prefix, hashable:\n            a prefix hinting the original data type and the byte representation\n            of `data`.\n\n    Raises:\n        TypeError : if data has no registered hash methods\n\n    Example:\n        >>> assert Func(None) == (b'NULL', b'NONE')\n        >>> assert Func('string') == (b'TXT', b'string')\n        >>> assert Func(1) == (b'INT', b'\\x01')\n        >>> assert Func(1.0) == (b'FLT', b'\\x01/\\x01')\n        >>> assert Func(_intlike[-1](1)) == (b'INT', b'\\x01')\n    \"\"\"\n    # HANDLE MOST COMMON TYPES FIRST\n    if arg_0 is None:\n        arg_2 = b'NONE'\n        arg_3 = b'NULL'\n    elif isinstance(arg_0, six.binary_type):\n        arg_2 = arg_0\n        arg_3 = b'TXT'\n    elif isinstance(arg_0, six.text_type):\n        # convert unicode into bytes\n        arg_2 = arg_0.encode('utf-8')\n        arg_3 = b'TXT'\n    elif isinstance(arg_0, _intlike):\n        # warnings.warn('Hashing ints is slow, numpy is prefered')\n        arg_2 = _int_to_bytes(arg_0)\n        # hashable = data.to_bytes(8, byteorder='big')\n        arg_3 = b'INT'\n    elif isinstance(arg_0, float):\n        arg_4, arg_5 = float(arg_0).as_integer_ratio()\n        arg_2 = _int_to_bytes(arg_4) + b'/' +  _int_to_bytes(arg_5)\n        arg_3 = b'FLT'\n    else:\n        # Then dynamically look up any other type\n        arg_6 = _HASHABLE_EXTENSIONS.lookup(arg_0)\n        arg_3, arg_2 = arg_6(arg_0)\n    if arg_1:\n        return arg_3, arg_2\n    else:\n        return b'', arg_2", "path": "ubelt/util_hash.py", "identifier": "_convert_to_hashable", "docstring": "r\"\"\"\n    Converts `data` into a hashable byte representation if an appropriate\n    hashing function is known.\n\n    Args:\n        data (object): ordered data with structure\n        types (bool): include type prefixes in the hash\n\n    Returns:\n        tuple(bytes, bytes): prefix, hashable:\n            a prefix hinting the original data type and the byte representation\n            of `data`.\n\n    Raises:\n        TypeError : if data has no registered hash methods\n\n    Example:\n        >>> assert _convert_to_hashable(None) == (b'NULL', b'NONE')\n        >>> assert _convert_to_hashable('string') == (b'TXT', b'string')\n        >>> assert _convert_to_hashable(1) == (b'INT', b'\\x01')\n        >>> assert _convert_to_hashable(1.0) == (b'FLT', b'\\x01/\\x01')\n        >>> assert _convert_to_hashable(_intlike[-1](1)) == (b'INT', b'\\x01')", "docstring_tokens": ["r", "Converts", "data", "into", "a", "hashable", "byte", "representation", "if", "an", "appropriate", "hashing", "function", "is", "known", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 260117}
{"url": "https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/core.py#L166-L181", "sha": "716845562a2bbb430de3c379c9481b195e451ccf", "docstring_summary": "Get database statistics.", "language": "python", "parameters": "(self)", "return_statement": "return stats", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", "action", "=", "'db-stats'", ")", "arg_2", "=", "arg_0", ".", "_api_request", "(", "params", "=", "arg_1", ")", "arg_3", "=", "DBStats", "(", "total_clicks", "=", "int", "(", "arg_2", "[", "'db-stats'", "]", "[", "'total_clicks'", "]", ")", ",", "total_links", "=", "int", "(", "arg_2", "[", "'db-stats'", "]", "[", "'total_links'", "]", ")", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Get database statistics.\n\n        Returns:\n            DBStats: Total clicks and links statistics.\n\n        Raises:\n            requests.exceptions.HTTPError: Generic HTTP Error\n        \"\"\"\n        arg_1 = dict(action='db-stats')\n        arg_2 = arg_0._api_request(params=arg_1)\n\n        arg_3 = DBStats(total_clicks=int(arg_2['db-stats']['total_clicks']),\n                        total_links=int(arg_2['db-stats']['total_links']))\n\n        return arg_3", "path": "yourls/core.py", "identifier": "YOURLSAPIMixin.db_stats", "docstring": "Get database statistics.\n\n        Returns:\n            DBStats: Total clicks and links statistics.\n\n        Raises:\n            requests.exceptions.HTTPError: Generic HTTP Error", "docstring_tokens": ["Get", "database", "statistics", "."], "nwo": "RazerM/yourls-python", "score": 0.3518893757964147, "idx": 260118}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L714-L751", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Method which indicates if the object matches specified criteria.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", "in", "arg_1", ".", "keys", "(", ")", ":", "try", ":", "arg_3", "=", "getattr", "(", "arg_0", ",", "arg_2", ")", "except", "_a11y", ".", "Error", ":", "return", "False", "if", "sys", ".", "version_info", "[", ":", "2", "]", "<=", "(", "2", ",", "6", ")", ":", "if", "isinstance", "(", "arg_3", ",", "basestring", ")", ":", "if", "not", "fnmatch", ".", "fnmatch", "(", "unicode", "(", "arg_3", ")", ",", "arg_1", "[", "arg_2", "]", ")", ":", "return", "False", "else", ":", "if", "arg_3", "!=", "arg_1", "[", "arg_2", "]", ":", "return", "False", "elif", "sys", ".", "version_info", "[", "0", "]", "==", "3", ":", "if", "isinstance", "(", "arg_3", ",", "str", ")", ":", "if", "not", "fnmatch", ".", "fnmatch", "(", "arg_3", ",", "str", "(", "arg_1", "[", "arg_2", "]", ")", ")", ":", "return", "False", "else", ":", "if", "arg_3", "!=", "arg_1", "[", "arg_2", "]", ":", "return", "False", "else", ":", "if", "isinstance", "(", "arg_3", ",", "str", ")", "or", "isinstance", "(", "arg_3", ",", "unicode", ")", ":", "if", "not", "fnmatch", ".", "fnmatch", "(", "arg_3", ",", "arg_1", "[", "arg_2", "]", ")", ":", "return", "False", "else", ":", "if", "arg_3", "!=", "arg_1", "[", "arg_2", "]", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"Method which indicates if the object matches specified criteria.\n\n        Match accepts criteria as kwargs and looks them up on attributes.\n        Actual matching is performed with fnmatch, so shell-like wildcards\n        work within match strings. Examples:\n\n        obj.Func(AXTitle='Terminal*')\n        obj.Func(AXRole='TextField', AXRoleDescription='search text field')\n        \"\"\"\n        for arg_2 in arg_1.keys():\n            try:\n                arg_3 = getattr(arg_0, arg_2)\n            except _a11y.Error:\n                return False\n            # Not all values may be strings (e.g. size, position)\n            if sys.version_info[:2] <= (2, 6):\n                if isinstance(arg_3, basestring):\n                    if not fnmatch.fnmatch(unicode(arg_3), arg_1[arg_2]):\n                        return False\n                else:\n                    if arg_3 != arg_1[arg_2]:\n                        return False\n            elif sys.version_info[0] == 3:\n                if isinstance(arg_3, str):\n                    if not fnmatch.fnmatch(arg_3, str(arg_1[arg_2])):\n                        return False\n                else:\n                    if arg_3 != arg_1[arg_2]:\n                        return False\n            else:\n                if isinstance(arg_3, str) or isinstance(arg_3, unicode):\n                    if not fnmatch.fnmatch(arg_3, arg_1[arg_2]):\n                        return False\n                else:\n                    if arg_3 != arg_1[arg_2]:\n                        return False\n        return True", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._match", "docstring": "Method which indicates if the object matches specified criteria.\n\n        Match accepts criteria as kwargs and looks them up on attributes.\n        Actual matching is performed with fnmatch, so shell-like wildcards\n        work within match strings. Examples:\n\n        obj._match(AXTitle='Terminal*')\n        obj._match(AXRole='TextField', AXRoleDescription='search text field')", "docstring_tokens": ["Method", "which", "indicates", "if", "the", "object", "matches", "specified", "criteria", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260119}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/network/queue_network.py#L1014-L1019", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Resets all edge and vertex colors to their default values.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "arg_0", ".", "g", ".", "edges", "(", ")", ")", ":", "arg_0", ".", "g", ".", "set_ep", "(", "arg_2", ",", "'edge_color'", ",", "arg_0", ".", "edge2queue", "[", "arg_1", "]", ".", "colors", "[", "'edge_color'", "]", ")", "for", "arg_3", "in", "arg_0", ".", "g", ".", "nodes", "(", ")", ":", "arg_0", ".", "g", ".", "set_vp", "(", "arg_3", ",", "'vertex_fill_color'", ",", "arg_0", ".", "colors", "[", "'vertex_fill_color'", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"Resets all edge and vertex colors to their default values.\"\"\"\n        for arg_1, arg_2 in enumerate(arg_0.g.edges()):\n            arg_0.g.set_ep(arg_2, 'edge_color', arg_0.edge2queue[arg_1].colors['edge_color'])\n        for arg_3 in arg_0.g.nodes():\n            arg_0.g.set_vp(arg_3, 'vertex_fill_color', arg_0.colors['vertex_fill_color'])", "path": "queueing_tool/network/queue_network.py", "identifier": "QueueNetwork.reset_colors", "docstring": "Resets all edge and vertex colors to their default values.", "docstring_tokens": ["Resets", "all", "edge", "and", "vertex", "colors", "to", "their", "default", "values", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 260120}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/views.py#L330-L353", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Remove user from a group.", "language": "python", "parameters": "(group_id, user_id)", "return_statement": "return redirect(url_for('.index'))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Group", ".", "query", ".", "get_or_404", "(", "arg_0", ")", "arg_3", "=", "User", ".", "query", ".", "get_or_404", "(", "arg_1", ")", "if", "arg_2", ".", "can_edit", "(", "current_user", ")", ":", "try", ":", "arg_2", ".", "Func_member", "(", "arg_3", ")", "except", "Exception", "as", "e", ":", "flash", "(", "str", "(", "e", ")", ",", "\"error\"", ")", "return", "redirect", "(", "urlparse", "(", "request", ".", "referrer", ")", ".", "path", ")", "flash", "(", "_", "(", "'User %(user_email)s was Funcd from %(group_name)s group.'", ",", "user_email", "=", "arg_3", ".", "email", ",", "group_name", "=", "arg_2", ".", "name", ")", ",", "'success'", ")", "return", "redirect", "(", "urlparse", "(", "request", ".", "referrer", ")", ".", "path", ")", "flash", "(", "_", "(", "'You cannot delete users of the group %(group_name)s'", ",", "group_name", "=", "arg_2", ".", "name", ")", ",", "'error'", ")", "return", "redirect", "(", "url_for", "(", "'.index'", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Remove user from a group.\"\"\"\n    arg_2 = Group.query.get_or_404(arg_0)\n    arg_3 = User.query.get_or_404(arg_1)\n\n    if arg_2.can_edit(current_user):\n        try:\n            arg_2.Func_member(arg_3)\n        except Exception as e:\n            flash(str(e), \"error\")\n            return redirect(urlparse(request.referrer).path)\n\n        flash(_('User %(user_email)s was Funcd from %(group_name)s group.',\n                user_email=arg_3.email, group_name=arg_2.name), 'success')\n        return redirect(urlparse(request.referrer).path)\n\n    flash(\n        _(\n            'You cannot delete users of the group %(group_name)s',\n            group_name=arg_2.name\n        ),\n        'error'\n    )\n    return redirect(url_for('.index'))", "path": "invenio_groups/views.py", "identifier": "remove", "docstring": "Remove user from a group.", "docstring_tokens": ["Remove", "user", "from", "a", "group", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 260121}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L794-L803", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Set the enthalpy of the package to the specified value, and\n        recalculate it's temperature.", "language": "python", "parameters": "(self, H)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "Func", ")", ":", "arg_0", ".", "_H", "=", "Func", "arg_0", ".", "_T", "=", "arg_0", ".", "_calculate_T", "(", "Func", ")"], "function": "def Func(arg_0, Func):\n        \"\"\"\n        Set the enthalpy of the package to the specified value, and\n        recalculate it's temperature.\n\n        :param H: The new enthalpy value. [kWh]\n        \"\"\"\n\n        arg_0._H = Func\n        arg_0._T = arg_0._calculate_T(Func)", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "MaterialPackage.H", "docstring": "Set the enthalpy of the package to the specified value, and\n        recalculate it's temperature.\n\n        :param H: The new enthalpy value. [kWh]", "docstring_tokens": ["Set", "the", "enthalpy", "of", "the", "package", "to", "the", "specified", "value", "and", "recalculate", "it", "s", "temperature", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 260122}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L73-L122", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Run a python file as if it were the main program on the command line.", "language": "python", "parameters": "(filename, args, package=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_5", ".", "modules", "[", "'__main__'", "]", "arg_4", "=", "imp", ".", "new_module", "(", "'__main__'", ")", "arg_5", ".", "modules", "[", "'__main__'", "]", "=", "arg_4", "arg_4", ".", "__file__", "=", "arg_0", "if", "arg_2", ":", "arg_4", ".", "__package__", "=", "arg_2", "arg_4", ".", "__builtins__", "=", "BUILTINS", "arg_10", "=", "arg_5", ".", "argv", "arg_5", ".", "argv", "=", "arg_1", "try", ":", "if", "arg_0", ".", "endswith", "(", "\".pyc\"", ")", "or", "arg_0", ".", "endswith", "(", "\".pyo\"", ")", ":", "arg_12", "=", "make_code_from_pyc", "(", "arg_0", ")", "else", ":", "arg_12", "=", "make_code_from_py", "(", "arg_0", ")", "try", ":", "exec_code_object", "(", "arg_12", ",", "arg_4", ".", "__dict__", ")", "except", "SystemExit", ":", "raise", "except", ":", "arg_13", ",", "arg_14", ",", "arg_15", "=", "arg_5", ".", "exc_info", "(", ")", "raise", "ExceptionDuringRun", "(", "arg_13", ",", "arg_14", ",", "arg_15", ".", "tb_next", ".", "tb_next", ")", "finally", ":", "arg_5", ".", "modules", "[", "'__main__'", "]", "=", "arg_3", "arg_5", ".", "argv", "=", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Run a python file as if it were the main program on the command line.\n\n    `filename` is the path to the file to execute, it need not be a .py file.\n    `args` is the argument array to present as sys.argv, including the first\n    element naming the file being executed.  `package` is the name of the\n    enclosing package, if any.\n\n    \"\"\"\n    # Create a module to serve as __main__\n    arg_3 = arg_5.modules['__main__']\n    arg_4 = imp.new_module('__main__')\n    arg_5.modules['__main__'] = arg_4\n    arg_4.__file__ = arg_0\n    if arg_2:\n        arg_4.__package__ = arg_2\n    arg_4.__builtins__ = BUILTINS\n\n    # Set sys.argv properly.\n    arg_10 = arg_5.argv\n    arg_5.argv = arg_1\n\n    try:\n        # Make a code object somehow.\n        if arg_0.endswith(\".pyc\") or arg_0.endswith(\".pyo\"):\n            arg_12 = make_code_from_pyc(arg_0)\n        else:\n            arg_12 = make_code_from_py(arg_0)\n\n        # Execute the code object.\n        try:\n            exec_code_object(arg_12, arg_4.__dict__)\n        except SystemExit:\n            # The user called sys.exit().  Just pass it along to the upper\n            # layers, where it will be handled.\n            raise\n        except:\n            # Something went wrong while executing the user code.\n            # Get the exc_info, and pack them into an exception that we can\n            # throw up to the outer loop.  We peel two layers off the traceback\n            # so that the coverage.py code doesn't appear in the final printed\n            # traceback.\n            arg_13, arg_14, arg_15 = arg_5.exc_info()\n            raise ExceptionDuringRun(arg_13, arg_14, arg_15.tb_next.tb_next)\n    finally:\n        # Restore the old __main__\n        arg_5.modules['__main__'] = arg_3\n\n        # Restore the old argv and path\n        arg_5.argv = arg_10", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py", "identifier": "run_python_file", "docstring": "Run a python file as if it were the main program on the command line.\n\n    `filename` is the path to the file to execute, it need not be a .py file.\n    `args` is the argument array to present as sys.argv, including the first\n    element naming the file being executed.  `package` is the name of the\n    enclosing package, if any.", "docstring_tokens": ["Run", "a", "python", "file", "as", "if", "it", "were", "the", "main", "program", "on", "the", "command", "line", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 260123}
{"url": "https://github.com/nickw444/nsw-fuel-api-client/blob/06bd9ae7ad094d5965fce3a9468785247e1b5a39/nsw_fuel/client.py#L47-L62", "sha": "06bd9ae7ad094d5965fce3a9468785247e1b5a39", "docstring_summary": "Gets the fuel prices for a specific fuel station.", "language": "python", "parameters": "(\n            self,\n            station: int\n    )", "return_statement": "return [Price.deserialize(data) for data in data['prices']]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "List", "[", "Price", "]", ":", "arg_3", "=", "requests", ".", "get", "(", "'{}/prices/station/{}'", ".", "format", "(", "API_URL_BASE", ",", "arg_1", ")", ",", "headers", "=", "arg_0", ".", "_get_headers", "(", ")", ",", "timeout", "=", "arg_0", ".", "_timeout", ",", ")", "if", "not", "arg_3", ".", "ok", ":", "raise", "FuelCheckError", ".", "create", "(", "arg_3", ")", "arg_4", "=", "arg_3", ".", "json", "(", ")", "return", "[", "Price", ".", "deserialize", "(", "arg_4", ")", "for", "arg_4", "in", "arg_4", "[", "'prices'", "]", "]"], "function": "def Func(\n            arg_0,\n            arg_1: arg_2\n    ) -> List[Price]:\n        \"\"\"Gets the fuel prices for a specific fuel station.\"\"\"\n        arg_3 = requests.get(\n            '{}/prices/station/{}'.format(API_URL_BASE, arg_1),\n            headers=arg_0._get_headers(),\n            timeout=arg_0._timeout,\n        )\n\n        if not arg_3.ok:\n            raise FuelCheckError.create(arg_3)\n\n        arg_4 = arg_3.json()\n        return [Price.deserialize(arg_4) for arg_4 in arg_4['prices']]", "path": "nsw_fuel/client.py", "identifier": "FuelCheckClient.get_fuel_prices_for_station", "docstring": "Gets the fuel prices for a specific fuel station.", "docstring_tokens": ["Gets", "the", "fuel", "prices", "for", "a", "specific", "fuel", "station", "."], "nwo": "nickw444/nsw-fuel-api-client", "score": 0.08529914490135834, "idx": 260124}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/functions.py#L334-L360", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Extracts the day from a datetime sample.", "language": "python", "parameters": "(x)", "return_statement": "return pd.Series(x).dt.day.values", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "pandas", "as", "pd", "return", "pd", ".", "Series", "(", "arg_0", ")", ".", "dt", ".", "day", ".", "values"], "function": "def Func(arg_0):\n    \"\"\"Extracts the day from a datetime sample.\n\n    :returns: an expression containing the day extracted from a datetime column.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.day\n    Expression = Func(date)\n    Length: 3 dtype: int64 (expression)\n    -----------------------------------\n    0  12\n    1  11\n    2  12\n    \"\"\"\n    import pandas as pd\n    return pd.Series(arg_0).dt.day.values", "path": "packages/vaex-core/vaex/functions.py", "identifier": "dt_day", "docstring": "Extracts the day from a datetime sample.\n\n    :returns: an expression containing the day extracted from a datetime column.\n\n    Example:\n\n    >>> import vaex\n    >>> import numpy as np\n    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)\n    >>> df = vaex.from_arrays(date=date)\n    >>> df\n      #  date\n      0  2009-10-12 03:31:00\n      1  2016-02-11 10:17:34\n      2  2015-11-12 11:34:22\n\n    >>> df.date.dt.day\n    Expression = dt_day(date)\n    Length: 3 dtype: int64 (expression)\n    -----------------------------------\n    0  12\n    1  11\n    2  12", "docstring_tokens": ["Extracts", "the", "day", "from", "a", "datetime", "sample", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 260125}
{"url": "https://github.com/gawel/panoramisk/blob/2ccb5d18be28a8e8f444dc0cd3a3bfb59aa19a8e/panoramisk/fast_agi.py#L133-L184", "sha": "2ccb5d18be28a8e8f444dc0cd3a3bfb59aa19a8e", "docstring_summary": "AsyncIO coroutine handler to launch socket listening.", "language": "python", "parameters": "(self, reader, writer)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "b''", "while", "b'\\n\\n'", "not", "in", "arg_3", ":", "arg_3", "+=", "yield", "from", "arg_1", ".", "read", "(", "arg_0", ".", "buf_size", ")", "arg_4", "=", "arg_3", "[", ":", "-", "2", "]", ".", "decode", "(", "arg_0", ".", "default_encoding", ")", ".", "split", "(", "'\\n'", ")", "arg_5", "=", "OrderedDict", "(", "[", "line", ".", "split", "(", "': '", ",", "1", ")", "for", "line", "in", "arg_4", "if", "': '", "in", "line", "]", ")", "arg_6", "=", "arg_5", ".", "get", "(", "'agi_network_script'", ")", "log", ".", "info", "(", "'Received FastAGI request from %r for \"%s\" route'", ",", "arg_2", ".", "get_extra_info", "(", "'peername'", ")", ",", "arg_6", ")", "log", ".", "debug", "(", "\"Asterisk Headers: %r\"", ",", "arg_5", ")", "if", "arg_6", "is", "not", "None", ":", "arg_7", "=", "arg_0", ".", "_route", ".", "get", "(", "arg_6", ")", "if", "arg_7", "is", "not", "None", ":", "arg_8", "=", "Request", "(", "app", "=", "arg_0", ",", "arg_5", "=", "arg_5", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "encoding", "=", "arg_0", ".", "default_encoding", ")", "try", ":", "yield", "from", "arg_7", "(", "arg_8", ")", "except", "BaseException", ":", "log", ".", "exception", "(", "'An exception has been raised for the request \"%s\"'", ",", "arg_6", ")", "else", ":", "log", ".", "error", "(", "'No route for the request \"%s\"'", ",", "arg_6", ")", "else", ":", "log", ".", "error", "(", "'No agi_network_script header for the request'", ")", "log", ".", "debug", "(", "\"Closing client socket\"", ")", "arg_2", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"AsyncIO coroutine Func to launch socket listening.\n\n        :Example:\n\n        ::\n\n            @asyncio.coroutine\n            def start(request):\n                print('Receive a FastAGI request')\n                print(['AGI variables:', request.headers])\n\n            fa_app = Application()\n            fa_app.add_route('calls/start', start)\n            coro = asyncio.start_server(fa_app.Func, '0.0.0.0', 4574)\n            server = loop.run_until_complete(coro)\n\n        See https://docs.python.org/3/library/asyncio-stream.html\n        \"\"\"\n        arg_3 = b''\n        while b'\\n\\n' not in arg_3:\n            arg_3 += yield from arg_1.read(arg_0.buf_size)\n        arg_4 = arg_3[:-2].decode(arg_0.default_encoding).split('\\n')\n        arg_5 = OrderedDict([\n            line.split(': ', 1) for line in arg_4 if ': ' in line\n        ])\n\n        arg_6 = arg_5.get('agi_network_script')\n        log.info('Received FastAGI request from %r for \"%s\" route',\n                 arg_2.get_extra_info('peername'), arg_6)\n        log.debug(\"Asterisk Headers: %r\", arg_5)\n\n        if arg_6 is not None:\n            arg_7 = arg_0._route.get(arg_6)\n            if arg_7 is not None:\n                arg_8 = Request(app=arg_0,\n                                  arg_5=arg_5,\n                                  arg_1=arg_1, arg_2=arg_2,\n                                  encoding=arg_0.default_encoding)\n                try:\n                    yield from arg_7(arg_8)\n                except BaseException:\n                    log.exception(\n                        'An exception has been raised for the request \"%s\"',\n                        arg_6\n                    )\n            else:\n                log.error('No route for the request \"%s\"', arg_6)\n        else:\n            log.error('No agi_network_script header for the request')\n        log.debug(\"Closing client socket\")\n        arg_2.close()", "path": "panoramisk/fast_agi.py", "identifier": "Application.handler", "docstring": "AsyncIO coroutine handler to launch socket listening.\n\n        :Example:\n\n        ::\n\n            @asyncio.coroutine\n            def start(request):\n                print('Receive a FastAGI request')\n                print(['AGI variables:', request.headers])\n\n            fa_app = Application()\n            fa_app.add_route('calls/start', start)\n            coro = asyncio.start_server(fa_app.handler, '0.0.0.0', 4574)\n            server = loop.run_until_complete(coro)\n\n        See https://docs.python.org/3/library/asyncio-stream.html", "docstring_tokens": ["AsyncIO", "coroutine", "handler", "to", "launch", "socket", "listening", "."], "nwo": "gawel/panoramisk", "score": 0.596986650254817, "idx": 260126}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L2380-L2406", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Levenberg-Marquardt optimization for every particle in the state.", "language": "python", "parameters": "(s, region_size=40, max_iter=2, damping=1.0,\n        decrease_damp_factor=10., run_length=4, collect_stats=False, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "40", ",", "arg_2", "=", "2", ",", "arg_3", "=", "1.0", ",", "arg_4", "=", "10.", ",", "arg_5", "=", "4", ",", "arg_6", "=", "False", ",", "**", "arg_7", ")", ":", "arg_8", "=", "LMParticleGroupCollection", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "arg_4", "=", "arg_4", ",", "get_cos", "=", "arg_6", ",", "arg_2", "=", "arg_2", ",", "**", "arg_7", ")", "arg_8", ".", "do_run_2", "(", ")", "if", "arg_6", ":", "return", "arg_8", ".", "stats"], "function": "def Func(arg_0, arg_1=40, arg_2=2, arg_3=1.0,\n        arg_4=10., arg_5=4, arg_6=False, **arg_7):\n    \"\"\"\n    Levenberg-Marquardt optimization for every particle in the state.\n\n    Convenience wrapper for LMParticleGroupCollection. Same keyword args,\n    but I've set the defaults to what I've found to be useful values for\n    optimizing particles. See LMParticleGroupCollection for documentation.\n\n    See Also\n    --------\n        do_levmarq_particles : Levenberg-Marquardt optimization of a\n            specified set of particles.\n\n        do_levmarq : Levenberg-Marquardt optimization of the entire state;\n            useful for optimizing global parameters.\n\n        LMParticleGroupCollection : The workhorse of do_levmarq.\n\n        LMEngine : Engine superclass for all the optimizers.\n    \"\"\"\n    arg_8 = LMParticleGroupCollection(arg_0, arg_1=arg_1, arg_3=arg_3,\n            arg_5=arg_5, arg_4=arg_4,\n            get_cos=arg_6, arg_2=arg_2, **arg_7)\n    arg_8.do_run_2()\n    if arg_6:\n        return arg_8.stats", "path": "peri/opt/optimize.py", "identifier": "do_levmarq_all_particle_groups", "docstring": "Levenberg-Marquardt optimization for every particle in the state.\n\n    Convenience wrapper for LMParticleGroupCollection. Same keyword args,\n    but I've set the defaults to what I've found to be useful values for\n    optimizing particles. See LMParticleGroupCollection for documentation.\n\n    See Also\n    --------\n        do_levmarq_particles : Levenberg-Marquardt optimization of a\n            specified set of particles.\n\n        do_levmarq : Levenberg-Marquardt optimization of the entire state;\n            useful for optimizing global parameters.\n\n        LMParticleGroupCollection : The workhorse of do_levmarq.\n\n        LMEngine : Engine superclass for all the optimizers.", "docstring_tokens": ["Levenberg", "-", "Marquardt", "optimization", "for", "every", "particle", "in", "the", "state", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260127}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L4752-L4805", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "r\"\"\"Retrieves all the text between matching open and close parentheses.", "language": "python", "parameters": "(text, start_pattern)", "return_statement": "return text[start_position:position - 1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'('", ":", "')'", ",", "'{'", ":", "'}'", ",", "'['", ":", "']'", "}", "arg_3", "=", "set", "(", "itervalues", "(", "arg_2", ")", ")", "arg_4", "=", "re", ".", "search", "(", "arg_1", ",", "arg_0", ",", "re", ".", "M", ")", "if", "not", "arg_4", ":", "return", "None", "arg_5", "=", "arg_4", ".", "end", "(", "0", ")", "assert", "arg_5", ">", "0", ",", "(", "'start_pattern must ends with an opening punctuation.'", ")", "assert", "arg_0", "[", "arg_5", "-", "1", "]", "in", "arg_2", ",", "(", "'start_pattern must ends with an opening punctuation.'", ")", "arg_6", "=", "[", "arg_2", "[", "arg_0", "[", "arg_5", "-", "1", "]", "]", "]", "arg_7", "=", "arg_5", "while", "arg_6", "and", "arg_7", "<", "len", "(", "arg_0", ")", ":", "if", "arg_0", "[", "arg_7", "]", "==", "arg_6", "[", "-", "1", "]", ":", "arg_6", ".", "pop", "(", ")", "elif", "arg_0", "[", "arg_7", "]", "in", "arg_3", ":", "return", "None", "elif", "arg_0", "[", "arg_7", "]", "in", "arg_2", ":", "arg_6", ".", "append", "(", "arg_2", "[", "arg_0", "[", "arg_7", "]", "]", ")", "arg_7", "+=", "1", "if", "arg_6", ":", "return", "None", "return", "arg_0", "[", "arg_5", ":", "arg_7", "-", "1", "]"], "function": "def Func(arg_0, arg_1):\n  r\"\"\"Retrieves all the text between matching open and close parentheses.\n\n  Given a string of lines and a regular expression string, retrieve all the text\n  following the expression and between opening punctuation symbols like\n  (, [, or {, and the matching close-punctuation symbol. This properly nested\n  occurrences of the punctuations, so for the text like\n    printf(a(), b(c()));\n  a call to Func(text, r'printf\\(') will return 'a(), b(c())'.\n  start_pattern must match string having an open punctuation symbol at the end.\n\n  Args:\n    text: The lines to extract text. Its comments and strings must be elided.\n           It can be single line and can span multiple lines.\n    start_pattern: The regexp string indicating where to start extracting\n                   the text.\n  Returns:\n    The extracted text.\n    None if either the opening string or ending punctuation could not be found.\n  \"\"\"\n  # TODO(unknown): Audit cpplint.py to see what places could be profitably\n  # rewritten to use Func (and use inferior regexp matching today).\n\n  # Give opening punctuations to get the matching close-punctuations.\n  arg_2 = {'(': ')', '{': '}', '[': ']'}\n  arg_3 = set(itervalues(arg_2))\n\n  # Find the position to start extracting text.\n  arg_4 = re.search(arg_1, arg_0, re.M)\n  if not arg_4:  # start_pattern not found in text.\n    return None\n  arg_5 = arg_4.end(0)\n\n  assert arg_5 > 0, (\n      'start_pattern must ends with an opening punctuation.')\n  assert arg_0[arg_5 - 1] in arg_2, (\n      'start_pattern must ends with an opening punctuation.')\n  # Stack of closing punctuations we expect to have in text after position.\n  arg_6 = [arg_2[arg_0[arg_5 - 1]]]\n  arg_7 = arg_5\n  while arg_6 and arg_7 < len(arg_0):\n    if arg_0[arg_7] == arg_6[-1]:\n      arg_6.pop()\n    elif arg_0[arg_7] in arg_3:\n      # A closing punctuation without matching opening punctuations.\n      return None\n    elif arg_0[arg_7] in arg_2:\n      arg_6.append(arg_2[arg_0[arg_7]])\n    arg_7 += 1\n  if arg_6:\n    # Opening punctuations left without matching close-punctuations.\n    return None\n  # punctuations match.\n  return arg_0[arg_5:arg_7 - 1]", "path": "third_party/python/cpplint/cpplint.py", "identifier": "_GetTextInside", "docstring": "r\"\"\"Retrieves all the text between matching open and close parentheses.\n\n  Given a string of lines and a regular expression string, retrieve all the text\n  following the expression and between opening punctuation symbols like\n  (, [, or {, and the matching close-punctuation symbol. This properly nested\n  occurrences of the punctuations, so for the text like\n    printf(a(), b(c()));\n  a call to _GetTextInside(text, r'printf\\(') will return 'a(), b(c())'.\n  start_pattern must match string having an open punctuation symbol at the end.\n\n  Args:\n    text: The lines to extract text. Its comments and strings must be elided.\n           It can be single line and can span multiple lines.\n    start_pattern: The regexp string indicating where to start extracting\n                   the text.\n  Returns:\n    The extracted text.\n    None if either the opening string or ending punctuation could not be found.", "docstring_tokens": ["r", "Retrieves", "all", "the", "text", "between", "matching", "open", "and", "close", "parentheses", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260128}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L2434-L2457", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Create a contract account. Sends a transaction to initialize the contract", "language": "python", "parameters": "(self, price=0, address=None, caller=None, balance=0, init=None, gas=None)", "return_statement": "return address", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "0", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "arg_0", ".", "create_account", "(", "arg_0", ".", "new_address", "(", "sender", "=", "arg_3", ")", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_7", "elif", "arg_3", "is", "not", "None", "and", "arg_2", "!=", "arg_7", ":", "raise", "EthereumError", "(", "f\"Error: contract created from address {hex(caller)} with nonce {self.get_nonce(caller)} was expected to be at address {hex(expected_address)}, but Func was called with address={hex(address)}\"", ")", "arg_0", ".", "start_transaction", "(", "'CREATE'", ",", "arg_2", ",", "arg_1", ",", "arg_5", ",", "arg_3", ",", "arg_4", ",", "arg_6", "=", "arg_6", ")", "arg_0", ".", "_process_pending_transaction", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=0, arg_2=None, arg_3=None, arg_4=0, arg_5=None, arg_6=None):\n        \"\"\"\n        Create a contract account. Sends a transaction to initialize the contract\n\n        :param address: the address of the new account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible.\n        :param balance: the initial balance of the account in Wei\n        :param init: the initialization code of the contract\n\n        The way that the Solidity compiler expects the constructor arguments to\n        be passed is by appending the arguments to the byte code produced by the\n        Solidity compiler. The arguments are formatted as defined in the Ethereum\n        ABI2. The arguments are then copied from the init byte array to the EVM\n        memory through the CODECOPY opcode with appropriate values on the stack.\n        This is done when the byte code in the init byte array is actually run\n        on the network.\n        \"\"\"\n        arg_7 = arg_0.create_account(arg_0.new_address(sender=arg_3))\n        if arg_2 is None:\n            arg_2 = arg_7\n        elif arg_3 is not None and arg_2 != arg_7:\n            raise EthereumError(f\"Error: contract created from address {hex(caller)} with nonce {self.get_nonce(caller)} was expected to be at address {hex(expected_address)}, but Func was called with address={hex(address)}\")\n        arg_0.start_transaction('CREATE', arg_2, arg_1, arg_5, arg_3, arg_4, arg_6=arg_6)\n        arg_0._process_pending_transaction()\n        return arg_2", "path": "manticore/platforms/evm.py", "identifier": "EVMWorld.create_contract", "docstring": "Create a contract account. Sends a transaction to initialize the contract\n\n        :param address: the address of the new account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible.\n        :param balance: the initial balance of the account in Wei\n        :param init: the initialization code of the contract\n\n        The way that the Solidity compiler expects the constructor arguments to\n        be passed is by appending the arguments to the byte code produced by the\n        Solidity compiler. The arguments are formatted as defined in the Ethereum\n        ABI2. The arguments are then copied from the init byte array to the EVM\n        memory through the CODECOPY opcode with appropriate values on the stack.\n        This is done when the byte code in the init byte array is actually run\n        on the network.", "docstring_tokens": ["Create", "a", "contract", "account", ".", "Sends", "a", "transaction", "to", "initialize", "the", "contract"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260129}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/predicates.py#L110-L123", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Test if a matrix is positive semidefinite", "language": "python", "parameters": "(mat, rtol=RTOL_DEFAULT, atol=ATOL_DEFAULT)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_4", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_2", "if", "not", "is_hermitian_matrix", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ")", ":", "return", "False", "arg_5", "=", "np", ".", "linalg", ".", "eigvalsh", "(", "arg_0", ")", "for", "arg_6", "in", "arg_5", ":", "if", "arg_6", "<", "-", "arg_3", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1=arg_2, arg_3=arg_4):\n    \"\"\"Test if a matrix is positive semidefinite\"\"\"\n    if arg_3 is None:\n        arg_3 = arg_4\n    if arg_1 is None:\n        arg_1 = arg_2\n    if not is_hermitian_matrix(arg_0, arg_1=arg_1, arg_3=arg_3):\n        return False\n    # Check eigenvalues are all positive\n    arg_5 = np.linalg.eigvalsh(arg_0)\n    for arg_6 in arg_5:\n        if arg_6 < -arg_3:\n            return False\n    return True", "path": "qiskit/quantum_info/operators/predicates.py", "identifier": "is_positive_semidefinite_matrix", "docstring": "Test if a matrix is positive semidefinite", "docstring_tokens": ["Test", "if", "a", "matrix", "is", "positive", "semidefinite"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260130}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L1642-L1653", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Determine the amount flow rates of all the compounds.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_compound_mfrs", "*", "1.0", "for", "arg_2", "in", "arg_0", ".", "material", ".", "compounds", ":", "arg_3", "=", "arg_0", ".", "material", ".", "get_compound_index", "(", "arg_2", ")", "arg_1", "[", "arg_3", "]", "=", "stoich", ".", "amount", "(", "arg_2", ",", "arg_1", "[", "arg_3", "]", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Determine the amount flow rates of all the compounds.\n\n        :returns: List of amount flow rates. [kmol/h]\n        \"\"\"\n\n        arg_1 = arg_0._compound_mfrs * 1.0\n        for arg_2 in arg_0.material.compounds:\n            arg_3 = arg_0.material.get_compound_index(arg_2)\n            arg_1[arg_3] = stoich.amount(arg_2, arg_1[arg_3])\n        return arg_1", "path": "auxi/modelling/process/materials/thermo.py", "identifier": "MaterialStream.get_compound_afrs", "docstring": "Determine the amount flow rates of all the compounds.\n\n        :returns: List of amount flow rates. [kmol/h]", "docstring_tokens": ["Determine", "the", "amount", "flow", "rates", "of", "all", "the", "compounds", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 260131}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/group.py#L154-L173", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Disassociate this group from the specified group.", "language": "python", "parameters": "(self, group, parent, **kwargs)", "return_statement": "return self._disassoc('children', parent_id, group_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "lookup_with_inventory", "(", "arg_2", ",", "arg_3", ".", "get", "(", "'inventory'", ",", "None", ")", ")", "[", "'id'", "]", "arg_5", "=", "arg_0", ".", "lookup_with_inventory", "(", "arg_1", ",", "arg_3", ".", "get", "(", "'inventory'", ",", "None", ")", ")", "[", "'id'", "]", "return", "arg_0", ".", "_disassoc", "(", "'children'", ",", "arg_4", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"Disassociate this group from the specified group.\n\n        =====API DOCS=====\n        Disassociate this group with the specified group.\n\n        :param group: Primary key or name of the child group to Func.\n        :type group: str\n        :param parent: Primary key or name of the parent group to Func from.\n        :type parent: str\n        :param inventory: Primary key or name of the inventory the disassociation should happen in.\n        :type inventory: str\n        :returns: Dictionary of only one key \"changed\", which indicates whether the disassociation succeeded.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        arg_4 = arg_0.lookup_with_inventory(arg_2, arg_3.get('inventory', None))['id']\n        arg_5 = arg_0.lookup_with_inventory(arg_1, arg_3.get('inventory', None))['id']\n        return arg_0._disassoc('children', arg_4, arg_5)", "path": "tower_cli/resources/group.py", "identifier": "Resource.disassociate", "docstring": "Disassociate this group from the specified group.\n\n        =====API DOCS=====\n        Disassociate this group with the specified group.\n\n        :param group: Primary key or name of the child group to disassociate.\n        :type group: str\n        :param parent: Primary key or name of the parent group to disassociate from.\n        :type parent: str\n        :param inventory: Primary key or name of the inventory the disassociation should happen in.\n        :type inventory: str\n        :returns: Dictionary of only one key \"changed\", which indicates whether the disassociation succeeded.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Disassociate", "this", "group", "from", "the", "specified", "group", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 260132}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/mixture.py#L997-L1012", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Dictionary of mass fractions for each atom in the mixture.", "language": "python", "parameters": "(self)", "return_statement": "return mass_fractions(things)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", ")", "for", "arg_2", ",", "arg_3", "in", "zip", "(", "arg_0", ".", "zs", ",", "arg_0", ".", "atomss", ")", ":", "for", "arg_4", ",", "arg_5", "in", "arg_3", ".", "iteritems", "(", ")", ":", "if", "arg_4", "in", "arg_1", ":", "arg_1", "[", "arg_4", "]", "+=", "arg_2", "*", "arg_5", "else", ":", "arg_1", "[", "arg_4", "]", "=", "arg_2", "*", "arg_5", "return", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        r'''Dictionary of mass fractions for each atom in the mixture.\n\n        Examples\n        --------\n        >>> Mixture(['CO2', 'O2'], zs=[0.5, 0.5]).Func\n        {'C': 0.15801826905745822, 'O': 0.8419817309425419}\n        '''\n        arg_1 = dict()\n        for arg_2, arg_3 in zip(arg_0.zs, arg_0.atomss):\n            for arg_4, arg_5 in arg_3.iteritems():\n                if arg_4 in arg_1:\n                    arg_1[arg_4] += arg_2*arg_5\n                else:\n                    arg_1[arg_4] = arg_2*arg_5\n        return Func(arg_1)", "path": "thermo/mixture.py", "identifier": "Mixture.mass_fractions", "docstring": "r'''Dictionary of mass fractions for each atom in the mixture.\n\n        Examples\n        --------\n        >>> Mixture(['CO2', 'O2'], zs=[0.5, 0.5]).mass_fractions\n        {'C': 0.15801826905745822, 'O': 0.8419817309425419}", "docstring_tokens": ["r", "Dictionary", "of", "mass", "fractions", "for", "each", "atom", "in", "the", "mixture", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 260133}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/simplegeneric/_simplegeneric.py#L23-L101", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Create a simple generic function", "language": "python", "parameters": "(func)", "return_statement": "return dispatch", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "object", "(", ")", "def", "_by_class", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_2", "[", "0", "]", ".", "__class__", "for", "arg_5", "in", "type", "(", "arg_4", ".", "__name__", ",", "(", "arg_4", ",", "object", ")", ",", "{", "}", ")", ".", "__mro__", ":", "arg_10", "=", "arg_8", "(", "arg_5", ",", "arg_1", ")", "if", "arg_10", "is", "not", "arg_1", ":", "return", "arg_10", "(", "*", "arg_2", ",", "**", "arg_3", ")", "else", ":", "return", "arg_0", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_6", "=", "{", "object", ":", "arg_0", "}", "try", ":", "arg_6", "[", "arg_7", "]", "=", "_by_class", "except", "NameError", ":", "pass", "arg_8", "=", "arg_6", ".", "get", "def", "arg_20", "(", "*", "arg_9", ")", ":", "for", "arg_5", "in", "arg_9", ":", "if", "not", "isinstance", "(", "arg_5", ",", "classtypes", ")", ":", "raise", "TypeError", "(", "\"%r is not a type or class\"", "%", "(", "arg_5", ",", ")", ")", "def", "decorate", "(", "arg_10", ")", ":", "for", "arg_5", "in", "arg_9", ":", "if", "arg_6", ".", "setdefault", "(", "arg_5", ",", "arg_10", ")", "is", "not", "arg_10", ":", "raise", "TypeError", "(", "\"%r already has method for type %r\"", "%", "(", "arg_0", ",", "arg_5", ")", ")", "return", "arg_10", "return", "decorate", "arg_11", "=", "{", "}", "arg_12", "=", "arg_11", ".", "get", "def", "arg_21", "(", "*", "arg_13", ")", ":", "def", "decorate", "(", "arg_10", ")", ":", "for", "arg_14", "in", "arg_13", ":", "if", "arg_11", ".", "setdefault", "(", "id", "(", "arg_14", ")", ",", "(", "arg_14", ",", "arg_10", ")", ")", "[", "1", "]", "is", "not", "arg_10", ":", "raise", "TypeError", "(", "\"%r already has method for object %r\"", "%", "(", "arg_0", ",", "arg_14", ")", ")", "return", "arg_10", "return", "decorate", "def", "arg_15", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_10", "=", "arg_12", "(", "id", "(", "arg_2", "[", "0", "]", ")", ",", "arg_1", ")", "if", "arg_10", "is", "arg_1", ":", "for", "arg_5", "in", "type", "(", "arg_2", "[", "0", "]", ")", ".", "__mro__", ":", "arg_10", "=", "arg_8", "(", "arg_5", ",", "arg_1", ")", "if", "arg_10", "is", "not", "arg_1", ":", "return", "arg_10", "(", "*", "arg_2", ",", "**", "arg_3", ")", "else", ":", "return", "arg_0", "(", "*", "arg_2", ",", "**", "arg_3", ")", "else", ":", "return", "arg_10", "[", "1", "]", "(", "*", "arg_2", ",", "**", "arg_3", ")", "arg_15", ".", "__name__", "=", "arg_0", ".", "__name__", "arg_15", ".", "__dict__", "=", "arg_0", ".", "__dict__", ".", "copy", "(", ")", "arg_15", ".", "__doc__", "=", "arg_0", ".", "__doc__", "arg_15", ".", "__module__", "=", "arg_0", ".", "__module__", "arg_15", ".", "when_type", "=", "arg_20", "arg_15", ".", "when_object", "=", "arg_21", "arg_15", ".", "default", "=", "arg_0", "arg_15", ".", "has_object", "=", "lambda", "arg_14", ":", "id", "(", "arg_14", ")", "in", "arg_11", "arg_15", ".", "has_type", "=", "lambda", "arg_5", ":", "arg_5", "in", "arg_6", "return", "arg_15"], "function": "def Func(arg_0):\n    \"\"\"Create a simple Func function\"\"\"\n\n    arg_1 = object()\n\n    def _by_class(*arg_2, **arg_3):\n        arg_4 = arg_2[0].__class__\n        for arg_5 in type(arg_4.__name__, (arg_4,object), {}).__mro__:\n            arg_10 = arg_8(arg_5, arg_1)\n            if arg_10 is not arg_1:\n                return arg_10(*arg_2, **arg_3)\n        else:\n            return arg_0(*arg_2, **arg_3)\n\n    arg_6 = {object: arg_0}\n    try:\n        arg_6[arg_7] = _by_class\n    except NameError:   # Python 3\n        pass\n    \n    arg_8 = arg_6.get\n\n    def arg_20(*arg_9):\n        \"\"\"Decorator to add a method that will be called for the given types\"\"\"\n        for arg_5 in arg_9:\n            if not isinstance(arg_5, classtypes):\n                raise TypeError(\n                    \"%r is not a type or class\" % (arg_5,)\n                )\n        def decorate(arg_10):\n            for arg_5 in arg_9:\n                if arg_6.setdefault(arg_5,arg_10) is not arg_10:\n                    raise TypeError(\n                        \"%r already has method for type %r\" % (arg_0, arg_5)\n                    )\n            return arg_10\n        return decorate\n\n\n\n\n    arg_11 = {}\n    arg_12 = arg_11.get\n\n    def arg_21(*arg_13):\n        \"\"\"Decorator to add a method to be called for the given object(s)\"\"\"\n        def decorate(arg_10):\n            for arg_14 in arg_13:\n                if arg_11.setdefault(id(arg_14), (arg_14,arg_10))[1] is not arg_10:\n                    raise TypeError(\n                        \"%r already has method for object %r\" % (arg_0, arg_14)\n                    )\n            return arg_10\n        return decorate\n\n\n    def arg_15(*arg_2, **arg_3):\n        arg_10 = arg_12(id(arg_2[0]), arg_1)\n        if arg_10 is arg_1:\n            for arg_5 in type(arg_2[0]).__mro__:\n                arg_10 = arg_8(arg_5, arg_1)\n                if arg_10 is not arg_1:\n                    return arg_10(*arg_2, **arg_3)\n            else:\n                return arg_0(*arg_2, **arg_3)\n        else:\n            return arg_10[1](*arg_2, **arg_3)\n\n    arg_15.__name__       = arg_0.__name__\n    arg_15.__dict__       = arg_0.__dict__.copy()\n    arg_15.__doc__        = arg_0.__doc__\n    arg_15.__module__     = arg_0.__module__\n\n    arg_15.when_type = arg_20\n    arg_15.when_object = arg_21\n    arg_15.default = arg_0\n    arg_15.has_object = lambda arg_14: id(arg_14) in arg_11\n    arg_15.has_type   = lambda arg_5: arg_5 in arg_6\n    return arg_15", "path": "environment/lib/python2.7/site-packages/IPython/external/simplegeneric/_simplegeneric.py", "identifier": "generic", "docstring": "Create a simple generic function", "docstring_tokens": ["Create", "a", "simple", "generic", "function"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260134}
{"url": "https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/__main__.py#L48-L57", "sha": "46e12659b8d08af764dc09a1f31b0e85a68f808f", "docstring_summary": "Convert string with SoapySDR device settings to dict", "language": "python", "parameters": "(string)", "return_statement": "return settings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "{", "}", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "split", "(", "','", ")", ":", "arg_3", ",", "arg_4", "=", "arg_2", ".", "split", "(", "'='", ")", "arg_1", "[", "arg_3", ".", "strip", "(", ")", "]", "=", "arg_4", ".", "strip", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Convert string with SoapySDR device settings to dict\"\"\"\n    if not arg_0:\n        return {}\n\n    arg_1 = {}\n    for arg_2 in arg_0.split(','):\n        arg_3, arg_4 = arg_2.split('=')\n        arg_1[arg_3.strip()] = arg_4.strip()\n    return arg_1", "path": "soapypower/__main__.py", "identifier": "device_settings", "docstring": "Convert string with SoapySDR device settings to dict", "docstring_tokens": ["Convert", "string", "with", "SoapySDR", "device", "settings", "to", "dict"], "nwo": "xmikos/soapy_power", "score": 0.1984218952631984, "idx": 260135}
{"url": "https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py#L275-L301", "sha": "274663dd91c811bae6ac4488915ba5880771b0a7", "docstring_summary": "Return the container link.", "language": "python", "parameters": "(self, doc_client, container)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "->", "str", ":", "arg_3", "=", "list", "(", "arg_1", ".", "QueryContainers", "(", "arg_0", ".", "__database_link", ",", "{", "\"query\"", ":", "\"SELECT * FROM r WHERE r.id=@id\"", ",", "\"parameters\"", ":", "[", "{", "\"name\"", ":", "\"@id\"", ",", "\"value\"", ":", "arg_2", "}", "]", "}", ")", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "return", "arg_3", "[", "0", "]", "[", "'id'", "]", "else", ":", "arg_4", "=", "arg_1", ".", "CreateContainer", "(", "arg_0", ".", "__database_link", ",", "{", "'id'", ":", "arg_2", "}", ")", "return", "arg_4", "[", "'id'", "]"], "function": "def Func(arg_0, arg_1, arg_2) -> str:\n        \"\"\"Return the container link.\n\n        Check if the container exists or create the container.\n\n        :param doc_client:\n        :param container:\n        :return str:\n        \"\"\"\n        # query CosmosDB for a container in the database with that name\n        arg_3 = list(arg_1.QueryContainers(\n            arg_0.__database_link,\n            {\n                \"query\": \"SELECT * FROM r WHERE r.id=@id\",\n                \"parameters\": [\n                    {\"name\": \"@id\", \"value\": arg_2}\n                ]\n            }\n        ))\n        # if there are results, return the first (container names are unique)\n        if len(arg_3) > 0:\n            return arg_3[0]['id']\n        else:\n            # Create a container if it didn't exist\n            arg_4 = arg_1.CreateContainer(\n                arg_0.__database_link, {'id': arg_2})\n            return arg_4['id']", "path": "libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py", "identifier": "CosmosDbStorage.__get_or_create_container", "docstring": "Return the container link.\n\n        Check if the container exists or create the container.\n\n        :param doc_client:\n        :param container:\n        :return str:", "docstring_tokens": ["Return", "the", "container", "link", "."], "nwo": "Microsoft/botbuilder-python", "score": 0.9771084554457546, "idx": 260136}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/account.py#L179-L196", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the list of movies on an account watchlist.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_1", ".", "update", "(", "{", "'session_id'", ":", "arg_0", ".", "session_id", "}", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the list of movies on an account watchlist.\n\n        Args:\n            page: (optional) Minimum 1, maximum 1000.\n            sort_by: (optional) 'created_at.asc' | 'created_at.desc'\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n        arg_1.update({'session_id': arg_0.session_id})\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/account.py", "identifier": "Account.watchlist_movies", "docstring": "Get the list of movies on an account watchlist.\n\n        Args:\n            page: (optional) Minimum 1, maximum 1000.\n            sort_by: (optional) 'created_at.asc' | 'created_at.desc'\n            language: (optional) ISO 639-1 code.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "list", "of", "movies", "on", "an", "account", "watchlist", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 260137}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/event.py#L64-L87", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Connects the event with the given callback.\n        When the signal is emitted, the callback is invoked.", "language": "python", "parameters": "(self, callback, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_0", ".", "is_Funced", "(", "arg_1", ")", ":", "raise", "AttributeError", "(", "'callback is already Funced'", ")", "if", "arg_0", ".", "hard_subscribers", "is", "None", ":", "arg_0", ".", "hard_subscribers", "=", "[", "]", "arg_0", ".", "hard_subscribers", ".", "append", "(", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"\n        Connects the event with the given callback.\n        When the signal is emitted, the callback is invoked.\n\n        .. note::\n\n            The signal handler is stored with a hard reference, so you\n            need to make sure to call :class:`disFunc()` if you want the\n            handler\n            to be garbage collected.\n\n        :type  callback: object\n        :param callback: The callback function.\n        :type  args: tuple\n        :param args: Optional arguments passed to the callback.\n        :type  kwargs: dict\n        :param kwargs: Optional keyword arguments passed to the callback.\n        \"\"\"\n        if arg_0.is_Funced(arg_1):\n            raise AttributeError('callback is already Funced')\n        if arg_0.hard_subscribers is None:\n            arg_0.hard_subscribers = []\n        arg_0.hard_subscribers.append((arg_1, arg_2, arg_3))", "path": "SpiffWorkflow/util/event.py", "identifier": "Event.connect", "docstring": "Connects the event with the given callback.\n        When the signal is emitted, the callback is invoked.\n\n        .. note::\n\n            The signal handler is stored with a hard reference, so you\n            need to make sure to call :class:`disconnect()` if you want the\n            handler\n            to be garbage collected.\n\n        :type  callback: object\n        :param callback: The callback function.\n        :type  args: tuple\n        :param args: Optional arguments passed to the callback.\n        :type  kwargs: dict\n        :param kwargs: Optional keyword arguments passed to the callback.", "docstring_tokens": ["Connects", "the", "event", "with", "the", "given", "callback", ".", "When", "the", "signal", "is", "emitted", "the", "callback", "is", "invoked", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 260138}
{"url": "https://github.com/althonos/fs.archive/blob/a09bb5da56da6b96aca3e20841fa86dea7c5b79a/fs/archive/_utils.py#L113-L123", "sha": "a09bb5da56da6b96aca3e20841fa86dea7c5b79a", "docstring_summary": "Test whether a stream can be written to.", "language": "python", "parameters": "(handle)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "io", ".", "IOBase", ")", "and", "sys", ".", "version_info", ">=", "(", "3", ",", "5", ")", ":", "return", "arg_0", ".", "writable", "(", ")", "try", ":", "arg_0", ".", "write", "(", "b''", ")", "except", "(", "io", ".", "UnsupportedOperation", ",", "IOError", ")", ":", "return", "False", "else", ":", "return", "True"], "function": "def Func(arg_0):\n    \"\"\"Test whether a stream can be written to.\n    \"\"\"\n    if isinstance(arg_0, io.IOBase) and sys.version_info >= (3, 5):\n        return arg_0.writable()\n    try:\n        arg_0.write(b'')\n    except (io.UnsupportedOperation, IOError):\n        return False\n    else:\n        return True", "path": "fs/archive/_utils.py", "identifier": "writable_stream", "docstring": "Test whether a stream can be written to.", "docstring_tokens": ["Test", "whether", "a", "stream", "can", "be", "written", "to", "."], "nwo": "althonos/fs.archive", "score": 0.2744346966463966, "idx": 260139}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/transform.py#L817-L850", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Deform a mesh along a parametric curve function", "language": "python", "parameters": "(script, curve=mp_func.torus_knot('t'), step=0.001)", "return_statement": "return function", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "torus_knot", "(", "'t'", ")", ",", "arg_4", "=", "0.001", ")", ":", "arg_5", "=", "[", "]", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_1", ")", ":", "arg_1", "[", "arg_6", "]", "=", "arg_7", ".", "replace", "(", "'t'", ",", "'z'", ")", "arg_5", ".", "append", "(", "arg_7", ".", "replace", "(", "'t'", ",", "'z+{}'", ".", "format", "(", "arg_4", ")", ")", ")", "arg_8", "=", "arg_2", ".", "v_subtract", "(", "arg_5", ",", "arg_1", ")", "arg_9", "=", "arg_2", ".", "v_add", "(", "arg_5", ",", "arg_1", ")", "arg_10", "=", "arg_2", ".", "v_cross", "(", "arg_8", ",", "arg_9", ")", "arg_11", "=", "arg_2", ".", "v_cross", "(", "arg_10", ",", "arg_8", ")", "arg_10", "=", "arg_2", ".", "v_normalize", "(", "arg_10", ")", "arg_11", "=", "arg_2", ".", "v_normalize", "(", "arg_11", ")", "arg_12", "=", "arg_2", ".", "v_add", "(", "arg_2", ".", "v_multiply", "(", "'x'", ",", "arg_11", ")", ",", "arg_2", ".", "v_multiply", "(", "'y'", ",", "arg_10", ")", ")", "arg_13", "=", "arg_2", ".", "v_add", "(", "arg_1", ",", "arg_12", ")", "vert_function", "(", "arg_0", ",", "x_func", "=", "arg_13", "[", "0", "]", ",", "y_func", "=", "arg_13", "[", "1", "]", ",", "z_func", "=", "arg_13", "[", "2", "]", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1=arg_2.torus_knot('t'), arg_4=0.001):\n    \"\"\" Deform a mesh along a parametric curve function\n\n    Provide a parametric curve function with z as the parameter. This will\n    deform the xy cross section of the mesh along the curve as z increases.\n\n    Source: http://blackpawn.com/texts/pqtorus/\n\n    Methodology:\n    T  = P' - P\n    N1 = P' + P\n    B  = T x N1\n    N  = B x T\n\n    newPoint = point.x*N + point.y*B\n\n    \"\"\"\n    arg_5 = []\n    for arg_6, arg_7 in enumerate(arg_1):\n        arg_1[arg_6] = arg_7.replace('t', 'z')\n        arg_5.append(arg_7.replace('t', 'z+{}'.format(arg_4)))\n\n    arg_8 = arg_2.v_subtract(arg_5, arg_1)\n    arg_9 = arg_2.v_add(arg_5, arg_1)\n    arg_10 = arg_2.v_cross(arg_8, arg_9)\n    arg_11 = arg_2.v_cross(arg_10, arg_8)\n    arg_10 = arg_2.v_normalize(arg_10)\n    arg_11 = arg_2.v_normalize(arg_11)\n\n    arg_12 = arg_2.v_add(arg_2.v_multiply('x', arg_11), arg_2.v_multiply('y', arg_10))\n    arg_13 = arg_2.v_add(arg_1, arg_12)\n\n    vert_function(arg_0, x_func=arg_13[0], y_func=arg_13[1], z_func=arg_13[2])\n    return arg_13", "path": "meshlabxml/transform.py", "identifier": "deform2curve", "docstring": "Deform a mesh along a parametric curve function\n\n    Provide a parametric curve function with z as the parameter. This will\n    deform the xy cross section of the mesh along the curve as z increases.\n\n    Source: http://blackpawn.com/texts/pqtorus/\n\n    Methodology:\n    T  = P' - P\n    N1 = P' + P\n    B  = T x N1\n    N  = B x T\n\n    newPoint = point.x*N + point.y*B", "docstring_tokens": ["Deform", "a", "mesh", "along", "a", "parametric", "curve", "function"], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 260140}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1127-L1160", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a list with the smallest distance between two neighboring colors.\n        The algorithm has a factorial complexity so it may run slow.", "language": "python", "parameters": "(self, reversed=False)", "return_statement": "return ColorList(sorted)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "ColorList", "(", ")", "arg_2", "=", "arg_0", "[", "0", "]", "for", "arg_3", "in", "arg_0", "[", "1", ":", "]", ":", "if", "arg_3", ".", "brightness", "<", "arg_2", ".", "brightness", ":", "arg_2", "=", "arg_3", "arg_4", "=", "[", "arg_3", "for", "arg_3", "in", "arg_0", "]", "arg_4", ".", "remove", "(", "arg_2", ")", "arg_5", "=", "[", "arg_2", "]", "while", "len", "(", "arg_4", ")", ">", "1", ":", "arg_6", ",", "arg_7", "=", "arg_4", "[", "0", "]", ",", "arg_4", "[", "0", "]", ".", "distance", "(", "arg_5", "[", "-", "1", "]", ")", "for", "arg_3", "in", "arg_4", "[", "1", ":", "]", ":", "arg_8", "=", "arg_3", ".", "distance", "(", "arg_5", "[", "-", "1", "]", ")", "if", "arg_8", "<", "arg_7", ":", "arg_6", ",", "arg_7", "=", "arg_3", ",", "arg_8", "arg_4", ".", "remove", "(", "arg_6", ")", "arg_5", ".", "append", "(", "arg_6", ")", "arg_5", ".", "append", "(", "arg_4", "[", "0", "]", ")", "if", "arg_1", ":", "_list", ".", "reverse", "(", "arg_5", ")", "return", "ColorList", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n        Returns a list with the smallest distance between two neighboring colors.\n        The algorithm has a factorial complexity so it may run slow.\n        \"\"\"\n        if len(arg_0) == 0: return ColorList()\n\n        # Find the darkest color in the list.\n        arg_2 = arg_0[0]\n        for arg_3 in arg_0[1:]:\n            if arg_3.brightness < arg_2.brightness:\n                arg_2 = arg_3\n\n        # Remove the darkest color from the stack,\n        # put it in the sorted list as starting element.\n        arg_4 = [arg_3 for arg_3 in arg_0]\n        arg_4.remove(arg_2)\n        arg_5 = [arg_2]\n\n        # Now find the color in the stack closest to that color.\n        # Take this color from the stack and add it to the sorted list.\n        # Now find the color closest to that color, etc.\n        while len(arg_4) > 1:\n            arg_6, arg_7 = arg_4[0], arg_4[0].distance(arg_5[-1])\n            for arg_3 in arg_4[1:]:\n                arg_8 = arg_3.distance(arg_5[-1])\n                if arg_8 < arg_7:\n                    arg_6, arg_7 = arg_3, arg_8\n            arg_4.remove(arg_6)\n            arg_5.append(arg_6)\n        arg_5.append(arg_4[0])\n\n        if arg_1: _list.reverse(arg_5)\n        return ColorList(arg_5)", "path": "lib/colors/__init__.py", "identifier": "ColorList.sort_by_distance", "docstring": "Returns a list with the smallest distance between two neighboring colors.\n        The algorithm has a factorial complexity so it may run slow.", "docstring_tokens": ["Returns", "a", "list", "with", "the", "smallest", "distance", "between", "two", "neighboring", "colors", ".", "The", "algorithm", "has", "a", "factorial", "complexity", "so", "it", "may", "run", "slow", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260141}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/stepper/main.py#L193-L240", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Generate test data if necessary", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "publish_info", "(", "arg_1", ")", ":", "arg_2", ".", "status", ".", "publish", "(", "'loadscheme'", ",", "arg_1", ".", "loadscheme", ")", "arg_2", ".", "status", ".", "publish", "(", "'loop_count'", ",", "arg_1", ".", "loop_count", ")", "arg_2", ".", "status", ".", "publish", "(", "'steps'", ",", "arg_1", ".", "steps", ")", "arg_2", ".", "status", ".", "publish", "(", "'duration'", ",", "arg_1", ".", "duration", ")", "arg_2", ".", "status", ".", "ammo_count", "=", "arg_1", ".", "ammo_count", "arg_2", ".", "status", ".", "publish", "(", "'instances'", ",", "arg_1", ".", "instances", ")", "arg_0", ".", "core", ".", "publish", "(", "'stepper'", ",", "'loadscheme'", ",", "arg_1", ".", "loadscheme", ")", "arg_0", ".", "core", ".", "publish", "(", "'stepper'", ",", "'loop_count'", ",", "arg_1", ".", "loop_count", ")", "arg_0", ".", "core", ".", "publish", "(", "'stepper'", ",", "'steps'", ",", "arg_1", ".", "steps", ")", "arg_0", ".", "core", ".", "publish", "(", "'stepper'", ",", "'duration'", ",", "arg_1", ".", "duration", ")", "arg_0", ".", "core", ".", "publish", "(", "'stepper'", ",", "'ammo_count'", ",", "arg_1", ".", "ammo_count", ")", "arg_0", ".", "core", ".", "publish", "(", "'stepper'", ",", "'instances'", ",", "arg_1", ".", "instances", ")", "return", "arg_1", "if", "not", "arg_0", ".", "stpd", ":", "arg_0", ".", "stpd", "=", "arg_0", ".", "__get_stpd_filename", "(", ")", "if", "arg_0", ".", "use_caching", "and", "not", "arg_0", ".", "force_stepping", "and", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "stpd", ")", "and", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "__si_filename", "(", ")", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"Using cached stpd-file: %s\"", ",", "arg_0", ".", "stpd", ")", "arg_1", "=", "arg_0", ".", "__read_cached_options", "(", ")", "if", "arg_0", ".", "instances", "and", "arg_0", ".", "load_profile", ".", "is_rps", "(", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"rps_schedule is set. Overriding cached instances param from config: %s\"", ",", "arg_0", ".", "instances", ")", "arg_1", "=", "arg_1", ".", "_replace", "(", "arg_10", "=", "arg_0", ".", "instances", ")", "publish_info", "(", "arg_1", ")", "else", ":", "if", "(", "arg_0", ".", "force_stepping", "and", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "__si_filename", "(", ")", ")", ")", ":", "os", ".", "remove", "(", "arg_0", ".", "__si_filename", "(", ")", ")", "arg_0", ".", "__make_stpd_file", "(", ")", "arg_1", "=", "arg_2", ".", "status", ".", "get_info", "(", ")", "arg_0", ".", "__write_cached_options", "(", "arg_1", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "\"Using specified stpd-file: %s\"", ",", "arg_0", ".", "stpd", ")", "arg_1", "=", "publish_info", "(", "arg_0", ".", "__read_cached_options", "(", ")", ")", "arg_0", ".", "ammo_count", "=", "arg_1", ".", "ammo_count", "arg_0", ".", "duration", "=", "arg_1", ".", "duration", "arg_0", ".", "loop_count", "=", "arg_1", ".", "loop_count", "arg_0", ".", "loadscheme", "=", "arg_1", ".", "loadscheme", "arg_0", ".", "steps", "=", "arg_1", ".", "steps", "if", "arg_1", ".", "instances", ":", "arg_0", ".", "instances", "=", "arg_1", ".", "instances"], "function": "def Func(arg_0):\n        ''' Generate test data if necessary '''\n\n        def publish_info(arg_1):\n            arg_2.status.publish('loadscheme', arg_1.loadscheme)\n            arg_2.status.publish('loop_count', arg_1.loop_count)\n            arg_2.status.publish('steps', arg_1.steps)\n            arg_2.status.publish('duration', arg_1.duration)\n            arg_2.status.ammo_count = arg_1.ammo_count\n            arg_2.status.publish('instances', arg_1.instances)\n            arg_0.core.publish('stepper', 'loadscheme', arg_1.loadscheme)\n            arg_0.core.publish('stepper', 'loop_count', arg_1.loop_count)\n            arg_0.core.publish('stepper', 'steps', arg_1.steps)\n            arg_0.core.publish('stepper', 'duration', arg_1.duration)\n            arg_0.core.publish('stepper', 'ammo_count', arg_1.ammo_count)\n            arg_0.core.publish('stepper', 'instances', arg_1.instances)\n            return arg_1\n\n        if not arg_0.stpd:\n            arg_0.stpd = arg_0.__get_stpd_filename()\n            if arg_0.use_caching and not arg_0.force_stepping and os.path.exists(\n                    arg_0.stpd) and os.path.exists(arg_0.__si_filename()):\n                arg_0.log.info(\"Using cached stpd-file: %s\", arg_0.stpd)\n                arg_1 = arg_0.__read_cached_options()\n                if arg_0.instances and arg_0.load_profile.is_rps():\n                    arg_0.log.info(\n                        \"rps_schedule is set. Overriding cached instances param from config: %s\",\n                        arg_0.instances)\n                    arg_1 = arg_1._replace(\n                        arg_10=arg_0.instances)\n                publish_info(arg_1)\n            else:\n                if (\n                        arg_0.force_stepping and os.path.exists(arg_0.__si_filename())):\n                    os.remove(arg_0.__si_filename())\n                arg_0.__make_stpd_file()\n                arg_1 = arg_2.status.get_info()\n                arg_0.__write_cached_options(arg_1)\n        else:\n            arg_0.log.info(\"Using specified stpd-file: %s\", arg_0.stpd)\n            arg_1 = publish_info(arg_0.__read_cached_options())\n        arg_0.ammo_count = arg_1.ammo_count\n        arg_0.duration = arg_1.duration\n        arg_0.loop_count = arg_1.loop_count\n        arg_0.loadscheme = arg_1.loadscheme\n        arg_0.steps = arg_1.steps\n        if arg_1.instances:\n            arg_0.instances = arg_1.instances", "path": "yandextank/stepper/main.py", "identifier": "StepperWrapper.prepare_stepper", "docstring": "Generate test data if necessary", "docstring_tokens": ["Generate", "test", "data", "if", "necessary"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 260142}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/logic.py#L650-L669", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "See if the clauses are true in a partial model.", "language": "python", "parameters": "(clauses, symbols, model)", "return_statement": "return (dpll(clauses, symbols, extend(model, P, True)) or\n            dpll(clauses, symbols, extend(model, P, False)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "arg_5", "=", "pl_true", "(", "arg_4", ",", "arg_2", ")", "if", "arg_5", "==", "False", ":", "return", "False", "if", "arg_5", "!=", "True", ":", "arg_3", ".", "append", "(", "arg_4", ")", "if", "not", "arg_3", ":", "return", "arg_2", "arg_6", ",", "arg_7", "=", "find_pure_symbol", "(", "arg_1", ",", "arg_3", ")", "if", "arg_6", ":", "return", "Func", "(", "arg_0", ",", "removeall", "(", "arg_6", ",", "arg_1", ")", ",", "extend", "(", "arg_2", ",", "arg_6", ",", "arg_7", ")", ")", "arg_6", ",", "arg_7", "=", "find_unit_clause", "(", "arg_0", ",", "arg_2", ")", "if", "arg_6", ":", "return", "Func", "(", "arg_0", ",", "removeall", "(", "arg_6", ",", "arg_1", ")", ",", "extend", "(", "arg_2", ",", "arg_6", ",", "arg_7", ")", ")", "arg_6", ",", "arg_1", "=", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", ":", "]", "return", "(", "Func", "(", "arg_0", ",", "arg_1", ",", "extend", "(", "arg_2", ",", "arg_6", ",", "True", ")", ")", "or", "Func", "(", "arg_0", ",", "arg_1", ",", "extend", "(", "arg_2", ",", "arg_6", ",", "False", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"See if the clauses are true in a partial model.\"\n    arg_3 = [] ## clauses with an unknown truth value\n    for arg_4 in arg_0:\n        arg_5 =  pl_true(arg_4, arg_2)\n        if arg_5 == False:\n            return False\n        if arg_5 != True:\n            arg_3.append(arg_4)\n    if not arg_3:\n        return arg_2\n    arg_6, arg_7 = find_pure_symbol(arg_1, arg_3)\n    if arg_6:\n        return Func(arg_0, removeall(arg_6, arg_1), extend(arg_2, arg_6, arg_7))\n    arg_6, arg_7 = find_unit_clause(arg_0, arg_2)\n    if arg_6:\n        return Func(arg_0, removeall(arg_6, arg_1), extend(arg_2, arg_6, arg_7))\n    arg_6, arg_1 = arg_1[0], arg_1[1:]\n    return (Func(arg_0, arg_1, extend(arg_2, arg_6, True)) or\n            Func(arg_0, arg_1, extend(arg_2, arg_6, False)))", "path": "aima/logic.py", "identifier": "dpll", "docstring": "See if the clauses are true in a partial model.", "docstring_tokens": ["See", "if", "the", "clauses", "are", "true", "in", "a", "partial", "model", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 260143}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/internal/well_known_types.py#L272-L299", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Converts a string to Duration.", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "<", "1", "or", "arg_1", "[", "-", "1", "]", "!=", "'s'", ":", "raise", "ParseError", "(", "'Duration must end with letter \"s\": {0}.'", ".", "format", "(", "arg_1", ")", ")", "try", ":", "arg_2", "=", "arg_1", ".", "find", "(", "'.'", ")", "if", "arg_2", "==", "-", "1", ":", "arg_0", ".", "seconds", "=", "int", "(", "arg_1", "[", ":", "-", "1", "]", ")", "arg_0", ".", "nanos", "=", "0", "else", ":", "arg_0", ".", "seconds", "=", "int", "(", "arg_1", "[", ":", "arg_2", "]", ")", "if", "arg_1", "[", "0", "]", "==", "'-'", ":", "arg_0", ".", "nanos", "=", "int", "(", "round", "(", "float", "(", "'-0{0}'", ".", "format", "(", "arg_1", "[", "arg_2", ":", "-", "1", "]", ")", ")", "*", "1e9", ")", ")", "else", ":", "arg_0", ".", "nanos", "=", "int", "(", "round", "(", "float", "(", "'0{0}'", ".", "format", "(", "arg_1", "[", "arg_2", ":", "-", "1", "]", ")", ")", "*", "1e9", ")", ")", "except", "ValueError", ":", "raise", "ParseError", "(", "'Couldn\\'t parse duration: {0}.'", ".", "format", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Converts a string to Duration.\n\n    Args:\n      value: A string to be converted. The string must end with 's'. Any\n          fractional digits (or none) are accepted as long as they fit into\n          precision. For example: \"1s\", \"1.01s\", \"1.0000001s\", \"-3.100s\n\n    Raises:\n      ParseError: On parsing problems.\n    \"\"\"\n    if len(arg_1) < 1 or arg_1[-1] != 's':\n      raise ParseError(\n          'Duration must end with letter \"s\": {0}.'.format(arg_1))\n    try:\n      arg_2 = arg_1.find('.')\n      if arg_2 == -1:\n        arg_0.seconds = int(arg_1[:-1])\n        arg_0.nanos = 0\n      else:\n        arg_0.seconds = int(arg_1[:arg_2])\n        if arg_1[0] == '-':\n          arg_0.nanos = int(round(float('-0{0}'.format(arg_1[arg_2: -1])) *1e9))\n        else:\n          arg_0.nanos = int(round(float('0{0}'.format(arg_1[arg_2: -1])) *1e9))\n    except ValueError:\n      raise ParseError(\n          'Couldn\\'t parse duration: {0}.'.format(arg_1))", "path": "typy/google/protobuf/internal/well_known_types.py", "identifier": "Duration.FromJsonString", "docstring": "Converts a string to Duration.\n\n    Args:\n      value: A string to be converted. The string must end with 's'. Any\n          fractional digits (or none) are accepted as long as they fit into\n          precision. For example: \"1s\", \"1.01s\", \"1.0000001s\", \"-3.100s\n\n    Raises:\n      ParseError: On parsing problems.", "docstring_tokens": ["Converts", "a", "string", "to", "Duration", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 260144}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/value.py#L250-L282", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Press scrollbar right with number of iterations", "language": "python", "parameters": "(self, window_name, object_name, iterations)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "not", "arg_0", ".", "verifyscrollbarhorizontal", "(", "arg_1", ",", "arg_2", ")", ":", "raise", "LdtpServerException", "(", "'Object not horizontal scrollbar'", ")", "arg_4", "=", "arg_0", ".", "_get_object_handle", "(", "arg_1", ",", "arg_2", ")", "arg_5", "=", "0", "arg_6", "=", "1.0", "/", "8", "arg_7", "=", "False", "while", "arg_5", "<", "arg_3", ":", "if", "arg_4", ".", "AXValue", ">=", "1", ":", "raise", "LdtpServerException", "(", "'Maximum limit reached'", ")", "arg_4", ".", "AXValue", "+=", "arg_6", "time", ".", "sleep", "(", "1.0", "/", "100", ")", "arg_7", "=", "True", "arg_5", "+=", "1", "if", "arg_7", ":", "return", "1", "else", ":", "raise", "LdtpServerException", "(", "'Unable to increase scrollbar'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Press scrollbar right with number of iterations\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n        @param interations: iterations to perform on slider increase\n        @type iterations: integer\n\n        @return: 1 on success.\n        @rtype: integer\n        \"\"\"\n        if not arg_0.verifyscrollbarhorizontal(arg_1, arg_2):\n            raise LdtpServerException('Object not horizontal scrollbar')\n        arg_4 = arg_0._get_object_handle(arg_1, arg_2)\n        arg_5 = 0\n        arg_6 = 1.0 / 8\n        arg_7 = False\n        while arg_5 < arg_3:\n            if arg_4.AXValue >= 1:\n                raise LdtpServerException('Maximum limit reached')\n            arg_4.AXValue += arg_6\n            time.sleep(1.0 / 100)\n            arg_7 = True\n            arg_5 += 1\n        if arg_7:\n            return 1\n        else:\n            raise LdtpServerException('Unable to increase scrollbar')", "path": "atomac/ldtpd/value.py", "identifier": "Value.oneright", "docstring": "Press scrollbar right with number of iterations\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n        @param interations: iterations to perform on slider increase\n        @type iterations: integer\n\n        @return: 1 on success.\n        @rtype: integer", "docstring_tokens": ["Press", "scrollbar", "right", "with", "number", "of", "iterations"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260145}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/RCC.py#L75-L95", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Projects the causal pair to the RKHS using the sampled kernel approximation.", "language": "python", "parameters": "(self, x, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "arg_1", ".", "ravel", "(", ")", "arg_2", "=", "arg_2", ".", "ravel", "(", ")", "arg_3", "=", "np", ".", "ones", "(", "arg_1", ".", "shape", ")", "arg_4", "=", "np", ".", "cos", "(", "np", ".", "dot", "(", "arg_0", ".", "W2", ",", "np", ".", "vstack", "(", "(", "arg_1", ",", "arg_3", ")", ")", ")", ")", ".", "mean", "(", "1", ")", "arg_5", "=", "np", ".", "cos", "(", "np", ".", "dot", "(", "arg_0", ".", "W2", ",", "np", ".", "vstack", "(", "(", "arg_2", ",", "arg_3", ")", ")", ")", ")", ".", "mean", "(", "1", ")", "if", "(", "sum", "(", "arg_4", ")", ">", "sum", "(", "arg_5", ")", ")", ":", "return", "np", ".", "hstack", "(", "(", "arg_4", ",", "arg_5", ",", "np", ".", "cos", "(", "np", ".", "dot", "(", "arg_0", ".", "W", ",", "np", ".", "vstack", "(", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", ")", ")", ".", "mean", "(", "1", ")", ")", ")", "else", ":", "return", "np", ".", "hstack", "(", "(", "arg_4", ",", "arg_5", ",", "np", ".", "cos", "(", "np", ".", "dot", "(", "arg_0", ".", "W", ",", "np", ".", "vstack", "(", "(", "arg_2", ",", "arg_1", ",", "arg_3", ")", ")", ")", ")", ".", "mean", "(", "1", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Projects the causal pair to the RKHS using the sampled kernel approximation.\n\n        Args:\n            x (np.ndarray): Variable 1\n            y (np.ndarray): Variable 2\n\n        Returns:\n            np.ndarray: projected empirical distributions into a single fixed-size vector.\n        \"\"\"\n        arg_1 = arg_1.ravel()\n        arg_2 = arg_2.ravel()\n        arg_3 = np.ones(arg_1.shape)\n        arg_4 = np.cos(np.dot(arg_0.W2, np.vstack((arg_1, arg_3)))).mean(1)\n        arg_5 = np.cos(np.dot(arg_0.W2, np.vstack((arg_2, arg_3)))).mean(1)\n        if(sum(arg_4) > sum(arg_5)):\n            return np.hstack((arg_4, arg_5,\n                              np.cos(np.dot(arg_0.W, np.vstack((arg_1, arg_2, arg_3)))).mean(1)))\n        else:\n            return np.hstack((arg_4, arg_5,\n                              np.cos(np.dot(arg_0.W, np.vstack((arg_2, arg_1, arg_3)))).mean(1)))", "path": "cdt/causality/pairwise/RCC.py", "identifier": "RCC.featurize_row", "docstring": "Projects the causal pair to the RKHS using the sampled kernel approximation.\n\n        Args:\n            x (np.ndarray): Variable 1\n            y (np.ndarray): Variable 2\n\n        Returns:\n            np.ndarray: projected empirical distributions into a single fixed-size vector.", "docstring_tokens": ["Projects", "the", "causal", "pair", "to", "the", "RKHS", "using", "the", "sampled", "kernel", "approximation", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 260146}
{"url": "https://github.com/dhhagan/py-opc/blob/2c8f19530fb64bf5fd4ee0d694a47850161ed8a7/opc/__init__.py#L961-L981", "sha": "2c8f19530fb64bf5fd4ee0d694a47850161ed8a7", "docstring_summary": "Read the gain-scaling-coefficient and sample flow rate.", "language": "python", "parameters": "(self)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "{", "}", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x33", "]", ")", "sleep", "(", "10e-3", ")", "for", "arg_3", "in", "range", "(", "8", ")", ":", "arg_4", "=", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x00", "]", ")", "[", "0", "]", "arg_1", ".", "append", "(", "arg_4", ")", "arg_2", "[", "\"GSC\"", "]", "=", "arg_0", ".", "_calculate_float", "(", "arg_1", "[", "0", ":", "4", "]", ")", "arg_2", "[", "\"SFR\"", "]", "=", "arg_0", ".", "_calculate_float", "(", "arg_1", "[", "4", ":", "]", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Read the gain-scaling-coefficient and sample flow rate.\n\n        :returns: dictionary containing GSC and SFR\n        \"\"\"\n        arg_1  = []\n        arg_2    = {}\n\n        # Send the command byte and sleep for 10 ms\n        arg_0.cnxn.xfer([0x33])\n        sleep(10e-3)\n\n        # Read the config variables by sending 256 empty bytes\n        for arg_3 in range(8):\n            arg_4 = arg_0.cnxn.xfer([0x00])[0]\n            arg_1.append(arg_4)\n\n        arg_2[\"GSC\"] = arg_0._calculate_float(arg_1[0:4])\n        arg_2[\"SFR\"] = arg_0._calculate_float(arg_1[4:])\n\n        return arg_2", "path": "opc/__init__.py", "identifier": "OPCN1.read_gsc_sfr", "docstring": "Read the gain-scaling-coefficient and sample flow rate.\n\n        :returns: dictionary containing GSC and SFR", "docstring_tokens": ["Read", "the", "gain", "-", "scaling", "-", "coefficient", "and", "sample", "flow", "rate", "."], "nwo": "dhhagan/py-opc", "score": 0.2904380171157967, "idx": 260147}
{"url": "https://github.com/mordred-descriptor/mordred/blob/2848b088fd7b6735590242b5e22573babc724f10/mordred/_base/descriptor.py#L94-L105", "sha": "2848b088fd7b6735590242b5e22573babc724f10", "docstring_summary": "Convert to json serializable dictionary.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "_Func", "(", ")", "if", "len", "(", "arg_2", ")", "==", "0", ":", "return", "{", "\"name\"", ":", "arg_1", "}", "else", ":", "return", "{", "\"name\"", ":", "arg_1", ",", "\"args\"", ":", "arg_2", "}"], "function": "def Func(arg_0):\n        \"\"\"Convert to json serializable dictionary.\n\n        Returns:\n            dict: dictionary of descriptor\n\n        \"\"\"\n        arg_1, arg_2 = arg_0._Func()\n        if len(arg_2) == 0:\n            return {\"name\": arg_1}\n        else:\n            return {\"name\": arg_1, \"args\": arg_2}", "path": "mordred/_base/descriptor.py", "identifier": "Descriptor.to_json", "docstring": "Convert to json serializable dictionary.\n\n        Returns:\n            dict: dictionary of descriptor", "docstring_tokens": ["Convert", "to", "json", "serializable", "dictionary", "."], "nwo": "mordred-descriptor/mordred", "score": 0.9032497569731454, "idx": 260148}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/pidhandler.py#L32-L46", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "This method is used by other modules, and so it\n  is not a part of the class.\n  Fetches Instance pid from heron-shell.", "language": "python", "parameters": "(topology_info, instance_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "tornado", ".", "httpclient", ".", "AsyncHTTPClient", "(", ")", "arg_3", "=", "utils", ".", "make_shell_endpoint", "(", "arg_0", ",", "arg_1", ")", "arg_4", "=", "\"%s/pid/%s\"", "%", "(", "arg_3", ",", "arg_1", ")", "Log", ".", "debug", "(", "\"HTTP call for url: %s\"", ",", "arg_4", ")", "arg_5", "=", "yield", "arg_2", ".", "fetch", "(", "arg_4", ")", "raise", "tornado", ".", "gen", ".", "Return", "(", "arg_5", ".", "body", ")", "except", "tornado", ".", "httpclient", ".", "HTTPError", "as", "e", ":", "raise", "Exception", "(", "str", "(", "e", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"\n  This method is used by other modules, and so it\n  is not a part of the class.\n  Fetches Instance pid from heron-shell.\n  \"\"\"\n  try:\n    arg_2 = tornado.httpclient.AsyncHTTPClient()\n    arg_3 = utils.make_shell_endpoint(arg_0, arg_1)\n    arg_4 = \"%s/pid/%s\" % (arg_3, arg_1)\n    Log.debug(\"HTTP call for url: %s\", arg_4)\n    arg_5 = yield arg_2.fetch(arg_4)\n    raise tornado.gen.Return(arg_5.body)\n  except tornado.httpclient.HTTPError as e:\n    raise Exception(str(e))", "path": "heron/tools/tracker/src/python/handlers/pidhandler.py", "identifier": "getInstancePid", "docstring": "This method is used by other modules, and so it\n  is not a part of the class.\n  Fetches Instance pid from heron-shell.", "docstring_tokens": ["This", "method", "is", "used", "by", "other", "modules", "and", "so", "it", "is", "not", "a", "part", "of", "the", "class", ".", "Fetches", "Instance", "pid", "from", "heron", "-", "shell", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260149}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/lines.py#L1226-L1239", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Generate a polygon from the line string points.", "language": "python", "parameters": "(self)", "return_statement": "return Polygon(self.coords, label=self.label)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", ".", "polys", "import", "Polygon", "return", "Polygon", "(", "arg_0", ".", "coords", ",", "label", "=", "arg_0", ".", "label", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Generate a polygon from the line string points.\n\n        Returns\n        -------\n        imgaug.augmentables.polys.Polygon\n            Polygon with the same corner points as the line string.\n            Note that the polygon might be invalid, e.g. contain less than 3\n            points or have self-intersections.\n\n        \"\"\"\n        from .polys import Polygon\n        return Polygon(arg_0.coords, label=arg_0.label)", "path": "imgaug/augmentables/lines.py", "identifier": "LineString.to_polygon", "docstring": "Generate a polygon from the line string points.\n\n        Returns\n        -------\n        imgaug.augmentables.polys.Polygon\n            Polygon with the same corner points as the line string.\n            Note that the polygon might be invalid, e.g. contain less than 3\n            points or have self-intersections.", "docstring_tokens": ["Generate", "a", "polygon", "from", "the", "line", "string", "points", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 260150}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/collection/funcs.py#L41-L46", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "append func with given arguments and keywords.", "language": "python", "parameters": "(self, func, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "partial", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "arg_0", ".", "append", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        '''\n        append func with given arguments and keywords.\n        '''\n        arg_4 = partial(arg_1, *arg_2, **arg_3)\n        arg_0.append(arg_4)", "path": "jasily/collection/funcs.py", "identifier": "CallableList.append_func", "docstring": "append func with given arguments and keywords.", "docstring_tokens": ["append", "func", "with", "given", "arguments", "and", "keywords", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 260151}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/load/user.py#L24-L51", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Add a user to the database.", "language": "python", "parameters": "(context, institute_id, user_name, user_mail, admin)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_1", ":", "arg_8", "=", "arg_5", ".", "institute", "(", "arg_1", "=", "arg_7", ")", "if", "not", "arg_8", ":", "LOG", ".", "warning", "(", "\"Institute % does not exist\"", ",", "arg_7", ")", "arg_0", ".", "abort", "(", ")", "arg_6", ".", "append", "(", "arg_7", ")", "arg_9", "=", "[", "]", "if", "arg_4", ":", "LOG", ".", "info", "(", "\"User is admin\"", ")", "arg_9", ".", "append", "(", "'admin'", ")", "arg_10", "=", "dict", "(", "email", "=", "arg_3", ".", "lower", "(", ")", ",", "name", "=", "arg_2", ",", "arg_9", "=", "arg_9", ",", "arg_6", "=", "arg_6", ")", "arg_11", "=", "build_Func", "(", "arg_10", ")", "try", ":", "arg_5", ".", "add_Func", "(", "arg_11", ")", "except", "Exception", "as", "err", ":", "LOG", ".", "warning", "(", "err", ")", "arg_0", ".", "abort", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"Add a Func to the database.\"\"\"\n    arg_5 = arg_0.obj['adapter']\n\n    arg_6 = []\n    for arg_7 in arg_1:\n        arg_8 = arg_5.institute(arg_1=arg_7)\n\n        if not arg_8:\n            LOG.warning(\"Institute % does not exist\", arg_7)\n            arg_0.abort()\n\n        arg_6.append(arg_7)\n\n    arg_9 = []\n    if arg_4:\n        LOG.info(\"User is admin\")\n        arg_9.append('admin')\n\n    arg_10 = dict(email=arg_3.lower(), name=arg_2, arg_9=arg_9, arg_6=arg_6)\n\n    arg_11 = build_Func(arg_10)\n\n    try:\n        arg_5.add_Func(arg_11)\n    except Exception as err:\n        LOG.warning(err)\n        arg_0.abort()", "path": "scout/commands/load/user.py", "identifier": "user", "docstring": "Add a user to the database.", "docstring_tokens": ["Add", "a", "user", "to", "the", "database", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260152}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/selections.py#L47-L55", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Find all columns that this selection depends on for df ds", "language": "python", "parameters": "(self, ds)", "return_statement": "return depending", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "set", "(", ")", "for", "arg_3", "in", "arg_0", ".", "expressions", ":", "arg_3", "=", "arg_1", ".", "_expr", "(", "arg_3", ")", "arg_2", "|=", "arg_3", ".", "variables", "(", ")", "if", "arg_0", ".", "previous_selection", ":", "arg_2", "|=", "arg_0", ".", "previous_selection", ".", "Func", "(", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        '''Find all columns that this selection depends on for df ds'''\n        arg_2 = set()\n        for arg_3 in arg_0.expressions:\n            arg_3 = arg_1._expr(arg_3)  # make sure it is an expression\n            arg_2 |= arg_3.variables()\n        if arg_0.previous_selection:\n            arg_2 |= arg_0.previous_selection.Func(arg_1)\n        return arg_2", "path": "packages/vaex-core/vaex/selections.py", "identifier": "Selection._depending_columns", "docstring": "Find all columns that this selection depends on for df ds", "docstring_tokens": ["Find", "all", "columns", "that", "this", "selection", "depends", "on", "for", "df", "ds"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 260153}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/poisson_lognormal.py#L45-L85", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Use Gauss-Hermite quadrature to form quadrature on positive-reals.", "language": "python", "parameters": "(\n    loc, scale, quadrature_size,\n    validate_args=False, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_4", "or", "\"vector_diffeomixture_quadrature_gauss_hermite\"", ")", ":", "arg_5", ",", "arg_6", "=", "np", ".", "polynomial", ".", "hermite", ".", "hermgauss", "(", "deg", "=", "arg_2", ")", "arg_7", "=", "dtype_util", ".", "as_numpy_dtype", "(", "arg_0", ".", "dtype", ")", "arg_5", "=", "arg_5", ".", "astype", "(", "arg_7", ")", "arg_6", "=", "arg_6", ".", "astype", "(", "arg_7", ")", "arg_6", "/=", "np", ".", "linalg", ".", "norm", "(", "arg_6", ",", "ord", "=", "1", ",", "keepdims", "=", "True", ")", "arg_6", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_6", ",", "arg_4", "=", "\"probs\"", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_5", "=", "(", "arg_0", "[", "...", ",", "tf", ".", "newaxis", "]", "+", "np", ".", "sqrt", "(", "2.", ")", "*", "arg_1", "[", "...", ",", "tf", ".", "newaxis", "]", "*", "arg_5", ")", "return", "arg_5", ",", "arg_6"], "function": "def Func(\n    arg_0, arg_1, arg_2,\n    arg_3=False, arg_4=None):  # pylint: disable=unused-argument\n  \"\"\"Use Gauss-Hermite quadrature to form quadrature on positive-reals.\n\n  Note: for a given `quadrature_size`, this method is generally less accurate\n  than `quadrature_scheme_lognormal_quantiles`.\n\n  Args:\n    loc: `float`-like (batch of) scalar `Tensor`; the location parameter of\n      the LogNormal prior.\n    scale: `float`-like (batch of) scalar `Tensor`; the scale parameter of\n      the LogNormal prior.\n    quadrature_size: Python `int` scalar representing the number of quadrature\n      points.\n    validate_args: Python `bool`, default `False`. When `True` distribution\n      parameters are checked for validity despite possibly degrading runtime\n      performance. When `False` invalid inputs may silently render incorrect\n      outputs.\n    name: Python `str` name prefixed to Ops created by this class.\n\n  Returns:\n    grid: (Batch of) length-`quadrature_size` vectors representing the\n      `log_rate` parameters of a `Poisson`.\n    probs: (Batch of) length-`quadrature_size` vectors representing the\n      weight associate with each `grid` value.\n  \"\"\"\n  with tf.name_scope(\n      arg_4 or \"vector_diffeomixture_quadrature_gauss_hermite\"):\n    arg_5, arg_6 = np.polynomial.hermite.hermgauss(deg=arg_2)\n    arg_7 = dtype_util.as_numpy_dtype(arg_0.dtype)\n    arg_5 = arg_5.astype(arg_7)\n    arg_6 = arg_6.astype(arg_7)\n    arg_6 /= np.linalg.norm(arg_6, ord=1, keepdims=True)\n    arg_6 = tf.convert_to_tensor(value=arg_6, arg_4=\"probs\", dtype=arg_0.dtype)\n    # The following maps the broadcast of `loc` and `scale` to each grid\n    # point, i.e., we are creating several log-rates that correspond to the\n    # different Gauss-Hermite quadrature points and (possible) batches of\n    # `loc` and `scale`.\n    arg_5 = (arg_0[..., tf.newaxis] + np.sqrt(2.) * arg_1[..., tf.newaxis] * arg_5)\n    return arg_5, arg_6", "path": "tensorflow_probability/python/distributions/poisson_lognormal.py", "identifier": "quadrature_scheme_lognormal_gauss_hermite", "docstring": "Use Gauss-Hermite quadrature to form quadrature on positive-reals.\n\n  Note: for a given `quadrature_size`, this method is generally less accurate\n  than `quadrature_scheme_lognormal_quantiles`.\n\n  Args:\n    loc: `float`-like (batch of) scalar `Tensor`; the location parameter of\n      the LogNormal prior.\n    scale: `float`-like (batch of) scalar `Tensor`; the scale parameter of\n      the LogNormal prior.\n    quadrature_size: Python `int` scalar representing the number of quadrature\n      points.\n    validate_args: Python `bool`, default `False`. When `True` distribution\n      parameters are checked for validity despite possibly degrading runtime\n      performance. When `False` invalid inputs may silently render incorrect\n      outputs.\n    name: Python `str` name prefixed to Ops created by this class.\n\n  Returns:\n    grid: (Batch of) length-`quadrature_size` vectors representing the\n      `log_rate` parameters of a `Poisson`.\n    probs: (Batch of) length-`quadrature_size` vectors representing the\n      weight associate with each `grid` value.", "docstring_tokens": ["Use", "Gauss", "-", "Hermite", "quadrature", "to", "form", "quadrature", "on", "positive", "-", "reals", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260154}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L1052-L1063", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Replace this observation's data with a fresh container.", "language": "python", "parameters": "(self)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "data", "arg_0", ".", "data", "=", "SortedKeyList", "(", "key", "=", "arg_0", ".", "_key", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        '''Replace this observation's data with a fresh container.\n\n        Returns\n        -------\n        annotation_data : SortedKeyList\n            The original annotation data container\n        '''\n\n        arg_1 = arg_0.data\n        arg_0.data = SortedKeyList(key=arg_0._key)\n        return arg_1", "path": "jams/core.py", "identifier": "Annotation.pop_data", "docstring": "Replace this observation's data with a fresh container.\n\n        Returns\n        -------\n        annotation_data : SortedKeyList\n            The original annotation data container", "docstring_tokens": ["Replace", "this", "observation", "s", "data", "with", "a", "fresh", "container", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 260155}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py#L166-L186", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Determine if the input source ends in two blanks.", "language": "python", "parameters": "(src)", "return_statement": "return (bool(last_two_blanks_re.match(new_src)) or\n            bool(last_two_blanks_re2.match(new_src)) )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "False", "arg_1", "=", "'\\n'", ".", "join", "(", "[", "'###\\n'", "]", "+", "arg_0", ".", "splitlines", "(", ")", "[", "-", "2", ":", "]", ")", "return", "(", "bool", "(", "Func_re", ".", "match", "(", "arg_1", ")", ")", "or", "bool", "(", "Func_re2", ".", "match", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Determine if the input source ends in two blanks.\n\n    A blank is either a newline or a line consisting of whitespace.\n\n    Parameters\n    ----------\n    src : string\n      A single or multiline string.\n    \"\"\"\n    if not arg_0: return False\n    # The logic here is tricky: I couldn't get a regexp to work and pass all\n    # the tests, so I took a different approach: split the source by lines,\n    # grab the last two and prepend '###\\n' as a stand-in for whatever was in\n    # the body before the last two lines.  Then, with that structure, it's\n    # possible to analyze with two regexps.  Not the most elegant solution, but\n    # it works.  If anyone tries to change this logic, make sure to validate\n    # the whole test suite first!\n    arg_1 = '\\n'.join(['###\\n'] + arg_0.splitlines()[-2:])\n    return (bool(Func_re.match(arg_1)) or\n            bool(Func_re2.match(arg_1)) )", "path": "environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py", "identifier": "last_two_blanks", "docstring": "Determine if the input source ends in two blanks.\n\n    A blank is either a newline or a line consisting of whitespace.\n\n    Parameters\n    ----------\n    src : string\n      A single or multiline string.", "docstring_tokens": ["Determine", "if", "the", "input", "source", "ends", "in", "two", "blanks", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260156}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/monitoring/monitoring.py#L89-L120", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Sends a message to the UDP receiver", "language": "python", "parameters": "(self, message_type, task_id, message)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "0", "try", ":", "arg_5", "=", "pickle", ".", "dumps", "(", "(", "arg_0", ".", "source_id", ",", "int", "(", "time", ".", "time", "(", ")", ")", ",", "arg_1", ",", "arg_3", ")", ")", "except", "Exception", "as", "e", ":", "print", "(", "\"Exception during pickling {}\"", ".", "format", "(", "e", ")", ")", "return", "try", ":", "arg_4", "=", "arg_0", ".", "sock", ".", "Functo", "(", "arg_5", ",", "(", "arg_0", ".", "ip", ",", "arg_0", ".", "port", ")", ")", "except", "socket", ".", "timeout", ":", "print", "(", "\"Could not Func message within timeout limit\"", ")", "return", "False", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Sends a message to the UDP receiver\n\n        Parameter\n        ---------\n\n        message_type: monitoring.MessageType (enum)\n            In this case message type is RESOURCE_INFO most often\n        task_id: int\n            Task identifier of the task for which resource monitoring is being reported\n        message: object\n            Arbitrary pickle-able object that is to be sent\n\n        Returns:\n            # bytes sent\n        \"\"\"\n        arg_4 = 0\n        try:\n            arg_5 = pickle.dumps((arg_0.source_id,   # Identifier for manager\n                                   int(time.time()),  # epoch timestamp\n                                   arg_1,\n                                   arg_3))\n        except Exception as e:\n            print(\"Exception during pickling {}\".format(e))\n            return\n\n        try:\n            arg_4 = arg_0.sock.Functo(arg_5, (arg_0.ip, arg_0.port))\n        except socket.timeout:\n            print(\"Could not Func message within timeout limit\")\n            return False\n        return arg_4", "path": "parsl/monitoring/monitoring.py", "identifier": "UDPRadio.send", "docstring": "Sends a message to the UDP receiver\n\n        Parameter\n        ---------\n\n        message_type: monitoring.MessageType (enum)\n            In this case message type is RESOURCE_INFO most often\n        task_id: int\n            Task identifier of the task for which resource monitoring is being reported\n        message: object\n            Arbitrary pickle-able object that is to be sent\n\n        Returns:\n            # bytes sent", "docstring_tokens": ["Sends", "a", "message", "to", "the", "UDP", "receiver"], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 260157}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/phenotype_phase_plane.py#L248-L266", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Compute the total components consumption or production flux.", "language": "python", "parameters": "(flux, components, consumption=True)", "return_statement": "return sum([flux for flux in c_flux if flux > 0])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "1", "if", "arg_2", "else", "-", "1", "arg_4", "=", "[", "elem", "*", "arg_0", "*", "arg_3", "for", "elem", "in", "arg_1", "]", "return", "sum", "(", "[", "arg_0", "for", "arg_0", "in", "arg_4", "if", "arg_0", ">", "0", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Compute the total components consumption or production flux.\n\n    Parameters\n    ----------\n    flux : float\n        The reaction flux for the components.\n    components : list\n        List of stoichiometrically weighted components.\n    consumption : bool, optional\n        Whether to sum up consumption or production fluxes.\n\n    \"\"\"\n\n    arg_3 = 1 if arg_2 else -1\n    arg_4 = [elem * arg_0 * arg_3 for elem in arg_1]\n\n    return sum([arg_0 for arg_0 in arg_4 if arg_0 > 0])", "path": "cobra/flux_analysis/phenotype_phase_plane.py", "identifier": "total_components_flux", "docstring": "Compute the total components consumption or production flux.\n\n    Parameters\n    ----------\n    flux : float\n        The reaction flux for the components.\n    components : list\n        List of stoichiometrically weighted components.\n    consumption : bool, optional\n        Whether to sum up consumption or production fluxes.", "docstring_tokens": ["Compute", "the", "total", "components", "consumption", "or", "production", "flux", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 260158}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L245-L275", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Remove an environment", "language": "python", "parameters": "(name_or_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "click", ".", "echo", "(", ")", "try", ":", "arg_1", "=", "cpenv", ".", "resolve", "(", "arg_0", ")", "except", "cpenv", ".", "ResolveError", "as", "e", ":", "click", ".", "echo", "(", "e", ")", "return", "arg_2", "=", "arg_1", ".", "resolved", "[", "0", "]", "if", "not", "isinstance", "(", "arg_2", ",", "cpenv", ".", "VirtualEnvironment", ")", ":", "click", ".", "echo", "(", "'{} is a module. Use `cpenv module Func` instead.'", ")", "return", "click", ".", "echo", "(", "format_objects", "(", "[", "arg_2", "]", ")", ")", "click", ".", "echo", "(", ")", "arg_3", "=", "click", ".", "confirm", "(", "red", "(", "'Are you sure you want to Func this environment?'", ")", ")", "if", "arg_3", ":", "click", ".", "echo", "(", "'Attempting to Func...'", ",", "nl", "=", "False", ")", "try", ":", "arg_2", ".", "Func", "(", ")", "except", "Exception", "as", "e", ":", "click", ".", "echo", "(", "bold_red", "(", "'FAIL'", ")", ")", "click", ".", "echo", "(", "e", ")", "else", ":", "click", ".", "echo", "(", "bold_green", "(", "'OK!'", ")", ")"], "function": "def Func(arg_0):\n    '''Remove an environment'''\n\n    click.echo()\n    try:\n        arg_1 = cpenv.resolve(arg_0)\n    except cpenv.ResolveError as e:\n        click.echo(e)\n        return\n\n    arg_2 = arg_1.resolved[0]\n    if not isinstance(arg_2, cpenv.VirtualEnvironment):\n        click.echo('{} is a module. Use `cpenv module Func` instead.')\n        return\n\n    click.echo(format_objects([arg_2]))\n    click.echo()\n\n    arg_3 = click.confirm(\n        red('Are you sure you want to Func this environment?')\n    )\n    if arg_3:\n        click.echo('Attempting to Func...', nl=False)\n\n        try:\n            arg_2.Func()\n        except Exception as e:\n            click.echo(bold_red('FAIL'))\n            click.echo(e)\n        else:\n            click.echo(bold_green('OK!'))", "path": "cpenv/cli.py", "identifier": "remove", "docstring": "Remove an environment", "docstring_tokens": ["Remove", "an", "environment"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 260159}
{"url": "https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L352-L358", "sha": "ce2cf3f1425d02ba4f3ad3202cfca43a1892558a", "docstring_summary": "Reject request.", "language": "python", "parameters": "(self, message=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "if", "arg_0", ".", "status", "!=", "RequestStatus", ".", "PENDING", ":", "raise", "InvalidRequestStateError", "(", "RequestStatus", ".", "PENDING", ")", "arg_0", ".", "status", "=", "RequestStatus", ".", "REJECTED", "request_Funced", ".", "send", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Reject request.\"\"\"\n        with db.session.begin_nested():\n            if arg_0.status != RequestStatus.PENDING:\n                raise InvalidRequestStateError(RequestStatus.PENDING)\n            arg_0.status = RequestStatus.REJECTED\n        request_Funced.send(arg_0, arg_1=arg_1)", "path": "zenodo_accessrequests/models.py", "identifier": "AccessRequest.reject", "docstring": "Reject request.", "docstring_tokens": ["Reject", "request", "."], "nwo": "zenodo/zenodo-accessrequests", "score": 0.2718259314615454, "idx": 260160}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/commands.py#L127-L143", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Tries to submit cmd to HTCondor, if it does not succeed, it will\n    be called with subprocess.call.", "language": "python", "parameters": "(cmd, shell=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "log", ".", "info", "(", "arg_0", ")", "arg_2", "=", "condor_submit", "(", "arg_0", ")", "if", "arg_2", "!=", "0", ":", "subprocess", ".", "call", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"\n    Tries to submit cmd to HTCondor, if it does not succeed, it will\n    be called with subprocess.call.\n\n    Parameters\n    ----------\n    cmd: string\n        Command to be submitted\n\n    Returns\n    -------\n    \"\"\"\n    log.info(arg_0)\n    arg_2 = condor_submit(arg_0)\n    if arg_2 != 0:\n        subprocess.call(arg_0, arg_1=arg_1)", "path": "boyle/commands.py", "identifier": "condor_call", "docstring": "Tries to submit cmd to HTCondor, if it does not succeed, it will\n    be called with subprocess.call.\n\n    Parameters\n    ----------\n    cmd: string\n        Command to be submitted\n\n    Returns\n    -------", "docstring_tokens": ["Tries", "to", "submit", "cmd", "to", "HTCondor", "if", "it", "does", "not", "succeed", "it", "will", "be", "called", "with", "subprocess", ".", "call", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 260161}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1351-L1425", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Add an entry to the jobs table for a new job request. This is called by\n    clients that wish to startup a new job, like a Hypersearch, stream job, or\n    specific model evaluation from the engine.", "language": "python", "parameters": "(self, client, cmdLine, clientInfo='', clientKey='', params='',\n                alreadyRunning=False, minimumWorkers=0, maximumWorkers=0,\n                jobType='', priority=DEFAULT_JOB_PRIORITY)", "return_statement": "return jobID", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "''", ",", "arg_4", "=", "''", ",", "arg_5", "=", "''", ",", "arg_6", "=", "False", ",", "arg_7", "=", "0", ",", "arg_8", "=", "0", ",", "arg_9", "=", "''", ",", "arg_10", "=", "arg_11", ")", ":", "arg_12", "=", "arg_0", ".", "_normalizeHash", "(", "uuid", ".", "uuid1", "(", ")", ".", "bytes", ")", "@", "g_retrySQL", "def", "insertWithRetries", "(", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "return", "arg_0", ".", "_insertOrGetUniqueJobNoRetries", "(", "conn", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_12", "=", "arg_12", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_6", "=", "arg_6", ")", "try", ":", "arg_13", "=", "insertWithRetries", "(", ")", "except", ":", "arg_0", ".", "_logger", ".", "exception", "(", "'Func FAILED: jobType=%r; client=%r; clientInfo=%r; clientKey=%r;'", "'jobHash=%r; cmdLine=%r'", ",", "arg_9", ",", "arg_1", ",", "_abbreviate", "(", "arg_3", ",", "48", ")", ",", "arg_4", ",", "arg_12", ",", "arg_2", ")", "raise", "else", ":", "arg_0", ".", "_logger", ".", "info", "(", "'Func: returning jobID=%s. jobType=%r; client=%r; clientInfo=%r; '", "'clientKey=%r; jobHash=%r; cmdLine=%r'", ",", "arg_13", ",", "arg_9", ",", "arg_1", ",", "_abbreviate", "(", "arg_3", ",", "48", ")", ",", "arg_4", ",", "arg_12", ",", "arg_2", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='', arg_4='', arg_5='',\n                arg_6=False, arg_7=0, arg_8=0,\n                arg_9='', arg_10=arg_11):\n    \"\"\" Add an entry to the jobs table for a new job request. This is called by\n    clients that wish to startup a new job, like a Hypersearch, stream job, or\n    specific model evaluation from the engine.\n\n    This puts a new entry into the jobs table. The CJM is always periodically\n    sweeping the jobs table and when it finds a new job, will proceed to start it\n    up on Hadoop.\n\n    Parameters:\n    ----------------------------------------------------------------\n    client:          Name of the client submitting the job\n    cmdLine:         Command line to use to launch each worker process; must be\n                      a non-empty string\n    clientInfo:      JSON encoded dict of client specific information.\n    clientKey:       Foreign key.\n    params:          JSON encoded dict of the parameters for the job. This\n                      can be fetched out of the database by the worker processes\n                      based on the jobID.\n    alreadyRunning:  Used for unit test purposes only. This inserts the job\n                      in the running state. It is used when running a worker\n                      in standalone mode without hadoop - it gives it a job\n                      record to work with.\n    minimumWorkers:  minimum number of workers design at a time.\n    maximumWorkers:  maximum number of workers desired at a time.\n    jobType:         The type of job that this is. This should be one of the\n                      JOB_TYPE_XXXX enums. This is needed to allow a standard\n                      way of recognizing a job's function and capabilities.\n    priority:        Job scheduling priority; 0 is the default priority (\n                      ClientJobsDAO.DEFAULT_JOB_PRIORITY); positive values are\n                      higher priority (up to ClientJobsDAO.MAX_JOB_PRIORITY),\n                      and negative values are lower priority (down to\n                      ClientJobsDAO.MIN_JOB_PRIORITY). Higher-priority jobs will\n                      be scheduled to run at the expense of the lower-priority\n                      jobs, and higher-priority job tasks will preempt those\n                      with lower priority if there is inadequate supply of\n                      scheduling slots. Excess lower priority job tasks will\n                      starve as long as slot demand exceeds supply. Most jobs\n                      should be scheduled with DEFAULT_JOB_PRIORITY. System jobs\n                      that must run at all cost, such as Multi-Model-Master,\n                      should be scheduled with MAX_JOB_PRIORITY.\n\n    retval:          jobID - unique ID assigned to this job\n    \"\"\"\n\n    arg_12 = arg_0._normalizeHash(uuid.uuid1().bytes)\n\n    @g_retrySQL\n    def insertWithRetries():\n      with ConnectionFactory.get() as conn:\n        return arg_0._insertOrGetUniqueJobNoRetries(\n          conn, arg_1=arg_1, arg_2=arg_2, arg_12=arg_12,\n          arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,\n          arg_7=arg_7, arg_8=arg_8,\n          arg_9=arg_9, arg_10=arg_10, arg_6=arg_6)\n\n    try:\n      arg_13 = insertWithRetries()\n    except:\n      arg_0._logger.exception(\n        'Func FAILED: jobType=%r; client=%r; clientInfo=%r; clientKey=%r;'\n        'jobHash=%r; cmdLine=%r',\n        arg_9, arg_1, _abbreviate(arg_3, 48), arg_4, arg_12,\n        arg_2)\n      raise\n    else:\n      arg_0._logger.info(\n        'Func: returning jobID=%s. jobType=%r; client=%r; clientInfo=%r; '\n        'clientKey=%r; jobHash=%r; cmdLine=%r',\n        arg_13, arg_9, arg_1, _abbreviate(arg_3, 48), arg_4,\n        arg_12, arg_2)\n\n    return arg_13", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.jobInsert", "docstring": "Add an entry to the jobs table for a new job request. This is called by\n    clients that wish to startup a new job, like a Hypersearch, stream job, or\n    specific model evaluation from the engine.\n\n    This puts a new entry into the jobs table. The CJM is always periodically\n    sweeping the jobs table and when it finds a new job, will proceed to start it\n    up on Hadoop.\n\n    Parameters:\n    ----------------------------------------------------------------\n    client:          Name of the client submitting the job\n    cmdLine:         Command line to use to launch each worker process; must be\n                      a non-empty string\n    clientInfo:      JSON encoded dict of client specific information.\n    clientKey:       Foreign key.\n    params:          JSON encoded dict of the parameters for the job. This\n                      can be fetched out of the database by the worker processes\n                      based on the jobID.\n    alreadyRunning:  Used for unit test purposes only. This inserts the job\n                      in the running state. It is used when running a worker\n                      in standalone mode without hadoop - it gives it a job\n                      record to work with.\n    minimumWorkers:  minimum number of workers design at a time.\n    maximumWorkers:  maximum number of workers desired at a time.\n    jobType:         The type of job that this is. This should be one of the\n                      JOB_TYPE_XXXX enums. This is needed to allow a standard\n                      way of recognizing a job's function and capabilities.\n    priority:        Job scheduling priority; 0 is the default priority (\n                      ClientJobsDAO.DEFAULT_JOB_PRIORITY); positive values are\n                      higher priority (up to ClientJobsDAO.MAX_JOB_PRIORITY),\n                      and negative values are lower priority (down to\n                      ClientJobsDAO.MIN_JOB_PRIORITY). Higher-priority jobs will\n                      be scheduled to run at the expense of the lower-priority\n                      jobs, and higher-priority job tasks will preempt those\n                      with lower priority if there is inadequate supply of\n                      scheduling slots. Excess lower priority job tasks will\n                      starve as long as slot demand exceeds supply. Most jobs\n                      should be scheduled with DEFAULT_JOB_PRIORITY. System jobs\n                      that must run at all cost, such as Multi-Model-Master,\n                      should be scheduled with MAX_JOB_PRIORITY.\n\n    retval:          jobID - unique ID assigned to this job", "docstring_tokens": ["Add", "an", "entry", "to", "the", "jobs", "table", "for", "a", "new", "job", "request", ".", "This", "is", "called", "by", "clients", "that", "wish", "to", "startup", "a", "new", "job", "like", "a", "Hypersearch", "stream", "job", "or", "specific", "model", "evaluation", "from", "the", "engine", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260162}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/base.py#L1423-L1427", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "name is py type", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "own", ".", "get", "(", "'name'", ")", ":", "arg_0", ".", "func_name", "=", "arg_1", "arg_0", ".", "own", "[", "'name'", "]", "[", "'value'", "]", "=", "Js", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        '''name is py type'''\n        if arg_0.own.get('name'):\n            arg_0.func_name = arg_1\n            arg_0.own['name']['value'] = Js(arg_1)", "path": "js2py/base.py", "identifier": "PyJsFunction._set_name", "docstring": "name is py type", "docstring_tokens": ["name", "is", "py", "type"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 260163}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/experiment_runner.py#L686-L751", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Runs a single experiment task", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "__logger", ".", "debug", "(", "\"Func(): Starting task <%s>\"", ",", "arg_0", ".", "__task", "[", "'taskLabel'", "]", ")", "if", "arg_0", ".", "__cmdOptions", ".", "privateOptions", "[", "'testMode'", "]", ":", "arg_1", "=", "10", "else", ":", "arg_1", "=", "arg_0", ".", "__task", "[", "'iterationCount'", "]", "if", "arg_1", ">=", "0", ":", "arg_2", "=", "iter", "(", "xrange", "(", "arg_1", ")", ")", "else", ":", "arg_2", "=", "iter", "(", "itertools", ".", "count", "(", ")", ")", "arg_3", "=", "PeriodicActivityMgr", "(", "requestedActivities", "=", "arg_0", ".", "_createPeriodicActivities", "(", ")", ")", "arg_0", ".", "__model", ".", "resetSequenceStates", "(", ")", "arg_0", ".", "__taskDriver", ".", "setup", "(", ")", "while", "True", ":", "try", ":", "next", "(", "arg_2", ")", "except", "StopIteration", ":", "break", "try", ":", "arg_4", "=", "arg_0", ".", "__datasetReader", ".", "next", "(", ")", "except", "StopIteration", ":", "break", "arg_5", "=", "arg_0", ".", "__taskDriver", ".", "handleInputRecord", "(", "arg_4", "=", "arg_4", ")", "if", "InferenceElement", ".", "encodings", "in", "arg_5", ".", "inferences", ":", "arg_5", ".", "inferences", ".", "pop", "(", "InferenceElement", ".", "encodings", ")", "arg_0", ".", "__predictionLogger", ".", "writeRecord", "(", "arg_5", ")", "arg_3", ".", "tick", "(", ")", "arg_0", ".", "_getAndEmitExperimentMetrics", "(", "final", "=", "True", ")", "arg_0", ".", "__taskDriver", ".", "finalize", "(", ")", "arg_0", ".", "__model", ".", "resetSequenceStates", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Runs a single experiment task\"\"\"\n    arg_0.__logger.debug(\"Func(): Starting task <%s>\", arg_0.__task['taskLabel'])\n\n    # Set up the task\n\n    # Create our main loop-control iterator\n    if arg_0.__cmdOptions.privateOptions['testMode']:\n      arg_1 = 10\n    else:\n      arg_1 = arg_0.__task['iterationCount']\n\n    if arg_1 >= 0:\n      arg_2 = iter(xrange(arg_1))\n    else:\n      arg_2 = iter(itertools.count())\n\n    # Initialize periodic activities\n    arg_3 = PeriodicActivityMgr(\n      requestedActivities=arg_0._createPeriodicActivities())\n\n    # Reset sequence states in the model, so it starts looking for a new\n    # sequence\n    # TODO: should this be done in OPFTaskDriver.setup(), instead?  Is it always\n    #       desired in Nupic?\n    arg_0.__model.resetSequenceStates()\n\n    # Have Task Driver perform its initial setup activities, including setup\n    # callbacks\n    arg_0.__taskDriver.setup()\n\n    # Run it!\n    while True:\n      # Check controlling iterator first\n      try:\n        next(arg_2)\n      except StopIteration:\n        break\n\n      # Read next input record\n      try:\n        arg_4 = arg_0.__datasetReader.next()\n      except StopIteration:\n        break\n\n      # Process input record\n      arg_5 = arg_0.__taskDriver.handleInputRecord(arg_4=arg_4)\n\n      if InferenceElement.encodings in arg_5.inferences:\n        arg_5.inferences.pop(InferenceElement.encodings)\n      arg_0.__predictionLogger.writeRecord(arg_5)\n\n      # Run periodic activities\n      arg_3.tick()\n\n    # Dump the experiment metrics at the end of the task\n    arg_0._getAndEmitExperimentMetrics(final=True)\n\n    # Have Task Driver perform its final activities\n    arg_0.__taskDriver.finalize()\n\n    # Reset sequence states in the model, so it starts looking for a new\n    # sequence\n    # TODO: should this be done in OPFTaskDriver.setup(), instead?  Is it always\n    #       desired in Nupic?\n    arg_0.__model.resetSequenceStates()", "path": "src/nupic/frameworks/opf/experiment_runner.py", "identifier": "_TaskRunner.run", "docstring": "Runs a single experiment task", "docstring_tokens": ["Runs", "a", "single", "experiment", "task"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260164}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L48-L72", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "This is a decorator which can be used to mark functions\n    as deprecated. It will result in a warning being emitted\n    when the function is used.", "language": "python", "parameters": "(msg='')", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "''", ")", ":", "def", "wrapper", "(", "arg_1", ")", ":", "@", "functools", ".", "wraps", "(", "arg_1", ")", "def", "new_func", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "\"Call to Func function or property `%s`.\"", "%", "arg_1", ".", "__name__", "arg_4", "=", "arg_4", "+", "' '", "+", "arg_0", "warnings", ".", "warn", "(", "arg_4", ",", "category", "=", "DeprecationWarning", ",", ")", "return", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "return", "new_func", "return", "wrapper"], "function": "def Func(arg_0=''):\n    \"\"\"This is a decorator which can be used to mark functions\n    as Func. It will result in a warning being emitted\n    when the function is used.\n\n    :param msg:\n\n        Additional message added to the warning.\n\n    \"\"\"\n\n    def wrapper(arg_1):\n        @functools.wraps(arg_1)\n        def new_func(*arg_2, **arg_3):\n            arg_4 = \"Call to Func function or property `%s`.\" % arg_1.__name__\n            arg_4 = arg_4 + ' ' + arg_0\n            warnings.warn(\n                arg_4,\n                category=DeprecationWarning,\n            )\n            return arg_1(*arg_2, **arg_3)\n\n        return new_func\n\n    return wrapper", "path": "pypet/utils/decorators.py", "identifier": "deprecated", "docstring": "This is a decorator which can be used to mark functions\n    as deprecated. It will result in a warning being emitted\n    when the function is used.\n\n    :param msg:\n\n        Additional message added to the warning.", "docstring_tokens": ["This", "is", "a", "decorator", "which", "can", "be", "used", "to", "mark", "functions", "as", "deprecated", ".", "It", "will", "result", "in", "a", "warning", "being", "emitted", "when", "the", "function", "is", "used", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260165}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L170-L182", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Validate an alias and return the its number of arguments.", "language": "python", "parameters": "(self, name, cmd)", "return_statement": "return nargs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "in", "arg_0", ".", "no_alias", ":", "raise", "InvalidAliasError", "(", "\"The name %s can't be aliased \"", "\"because it is a keyword or builtin.\"", "%", "arg_1", ")", "if", "not", "(", "isinstance", "(", "arg_2", ",", "basestring", ")", ")", ":", "raise", "InvalidAliasError", "(", "\"An alias command must be a string, \"", "\"got: %r\"", "%", "arg_2", ")", "arg_3", "=", "arg_2", ".", "count", "(", "'%s'", ")", "if", "arg_3", ">", "0", "and", "arg_2", ".", "find", "(", "'%l'", ")", ">=", "0", ":", "raise", "InvalidAliasError", "(", "'The %s and %l specifiers are mutually '", "'exclusive in alias definitions.'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Validate an alias and return the its number of arguments.\"\"\"\n        if arg_1 in arg_0.no_alias:\n            raise InvalidAliasError(\"The name %s can't be aliased \"\n                                    \"because it is a keyword or builtin.\" % arg_1)\n        if not (isinstance(arg_2, basestring)):\n            raise InvalidAliasError(\"An alias command must be a string, \"\n                                    \"got: %r\" % arg_2)\n        arg_3 = arg_2.count('%s')\n        if arg_3>0 and arg_2.find('%l')>=0:\n            raise InvalidAliasError('The %s and %l specifiers are mutually '\n                                    'exclusive in alias definitions.')\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/core/alias.py", "identifier": "AliasManager.validate_alias", "docstring": "Validate an alias and return the its number of arguments.", "docstring_tokens": ["Validate", "an", "alias", "and", "return", "the", "its", "number", "of", "arguments", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260166}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/examples/train_cifar10.py#L20-L34", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Computes the precision", "language": "python", "parameters": "(output, target, topk=(1, ))", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "(", "1", ",", ")", ")", ":", "with", "torch", ".", "no_grad", "(", ")", ":", "arg_3", "=", "max", "(", "arg_2", ")", "arg_4", "=", "arg_1", ".", "size", "(", "0", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "topk", "(", "arg_3", ",", "1", ",", "True", ",", "True", ")", "arg_6", "=", "arg_6", ".", "t", "(", ")", "arg_7", "=", "arg_6", ".", "eq", "(", "arg_1", ".", "view", "(", "1", ",", "-", "1", ")", ".", "expand_as", "(", "arg_6", ")", ")", "arg_8", "=", "[", "]", "for", "arg_9", "in", "arg_2", ":", "arg_10", "=", "arg_7", "[", ":", "arg_9", "]", ".", "view", "(", "-", "1", ")", ".", "float", "(", ")", ".", "sum", "(", "0", ",", "keepdim", "=", "True", ")", "arg_8", ".", "append", "(", "arg_10", ".", "mul_", "(", "100.0", "/", "arg_4", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=(1, )):\n    \"\"\"Computes the precision@k for the specified values of k\"\"\"\n    with torch.no_grad():\n        arg_3 = max(arg_2)\n        arg_4 = arg_1.size(0)\n\n        arg_5, arg_6 = arg_0.topk(arg_3, 1, True, True)\n        arg_6 = arg_6.t()\n        arg_7 = arg_6.eq(arg_1.view(1, -1).expand_as(arg_6))\n\n        arg_8 = []\n        for arg_9 in arg_2:\n            arg_10 = arg_7[:arg_9].view(-1).float().sum(0, keepdim=True)\n            arg_8.append(arg_10.mul_(100.0 / arg_4))\n        return arg_8", "path": "examples/train_cifar10.py", "identifier": "accuracy", "docstring": "Computes the precision@k for the specified values of k", "docstring_tokens": ["Computes", "the", "precision"], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260167}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1208-L1223", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Check all file item with given conditions.", "language": "python", "parameters": "(self, result, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "(", "arg_0", ".", "opt", ".", "last_modified_before", "is", "not", "None", ")", "or", "(", "arg_0", ".", "opt", ".", "last_modified_after", "is", "not", "None", ")", "if", "arg_2", "[", "'is_dir'", "]", ":", "if", "not", "arg_3", ":", "arg_1", ".", "append", "(", "arg_2", ")", "return", "if", "(", "arg_0", ".", "opt", ".", "last_modified_before", "is", "not", "None", ")", "and", "arg_2", "[", "'last_modified'", "]", ">=", "arg_0", ".", "opt", ".", "last_modified_before", ":", "return", "if", "(", "arg_0", ".", "opt", ".", "last_modified_after", "is", "not", "None", ")", "and", "arg_2", "[", "'last_modified'", "]", "<=", "arg_0", ".", "opt", ".", "last_modified_after", ":", "return", "arg_1", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''Check all file item with given conditions.'''\n    arg_3 = (arg_0.opt.last_modified_before is not None) or (arg_0.opt.last_modified_after is not None)\n\n    if arg_2['is_dir']:\n      if not arg_3:\n        arg_1.append(arg_2)\n      return\n\n    if (arg_0.opt.last_modified_before is not None) and arg_2['last_modified'] >= arg_0.opt.last_modified_before:\n      return\n\n    if (arg_0.opt.last_modified_after is not None) and arg_2['last_modified'] <= arg_0.opt.last_modified_after:\n      return\n\n    arg_1.append(arg_2)", "path": "s4cmd.py", "identifier": "ThreadUtil.conditional", "docstring": "Check all file item with given conditions.", "docstring_tokens": ["Check", "all", "file", "item", "with", "given", "conditions", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260168}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/vhdl/statements.py#L109-L175", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Serialize HWProcess objects as VHDL", "language": "python", "parameters": "(cls, proc, ctx)", "return_statement": "return cls.processTmpl.render(\n            indent=getIndent(ctx.indent),\n            name=proc.name,\n            hasToBeVhdlProcess=hasToBeVhdlProcess,\n            extraVars=extraVarsSerialized,\n            sensitivityList=\", \".join(sensitivityList),\n            statements=extraVarsInit + statemets\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "statements", "arg_4", "=", "[", "]", "arg_5", "=", "[", "]", "arg_6", "=", "arr_any", "(", "arg_3", ",", "lambda", "x", ":", "isinstance", "(", "x", ",", "(", "IfContainer", ",", "SwitchContainer", ",", "WhileContainer", ",", "WaitStm", ")", ")", ")", "arg_7", "=", "sorted", "(", "map", "(", "lambda", "arg_11", ":", "arg_0", ".", "sensitivityListItem", "(", "arg_11", ",", "arg_2", ")", ",", "arg_1", ".", "sensitivityList", ")", ")", "if", "arg_6", ":", "arg_8", "=", "arg_2", ".", "withIndent", "(", ")", "else", ":", "arg_8", "=", "copy", "(", "arg_2", ")", "def", "arg_15", "(", "arg_9", ",", "arg_10", ")", ":", "arg_11", "=", "RtlSignal", "(", "None", ",", "None", ",", "arg_10", ",", "virtualOnly", "=", "True", ")", "arg_11", ".", "name", "=", "arg_2", ".", "scope", ".", "checkedName", "(", "arg_9", ",", "arg_11", ")", "arg_11", ".", "hidden", "=", "False", "arg_14", "=", "arg_0", ".", "SignalItem", "(", "arg_11", ",", "arg_8", ",", "declaration", "=", "True", ")", "arg_4", ".", "append", "(", "arg_11", ")", "arg_5", ".", "append", "(", "arg_14", ")", "return", "arg_11", "arg_8", ".", "createTmpVarFn", "=", "arg_15", "arg_16", "=", "[", "arg_0", ".", "asHdl", "(", "arg_11", ",", "arg_8", ")", "for", "arg_11", "in", "arg_3", "]", "arg_1", ".", "name", "=", "arg_2", ".", "scope", ".", "checkedName", "(", "arg_1", ".", "name", ",", "arg_1", ")", "arg_17", "=", "[", "]", "for", "arg_11", "in", "arg_4", ":", "if", "isinstance", "(", "arg_11", ".", "defVal", ",", "RtlSignalBase", ")", "or", "arg_11", ".", "defVal", ".", "vldMask", ":", "arg_18", "=", "Assignment", "(", "arg_11", ".", "defVal", ",", "arg_11", ",", "virtualOnly", "=", "True", ")", "arg_17", ".", "append", "(", "arg_0", ".", "Assignment", "(", "arg_18", ",", "arg_8", ")", ")", "else", ":", "assert", "arg_11", ".", "drivers", ",", "arg_11", "for", "arg_19", "in", "arg_11", ".", "drivers", ":", "arg_17", ".", "append", "(", "arg_0", ".", "asHdl", "(", "arg_19", ",", "arg_8", ")", ")", "arg_20", "=", "arg_6", "arg_6", "=", "arg_4", "or", "arg_6", "if", "arg_6", "and", "not", "arg_20", ":", "arg_21", "=", "getIndent", "(", "1", ")", "arg_16", "=", "list", "(", "map", "(", "lambda", "x", ":", "arg_21", "+", "x", ",", "arg_16", ")", ")", "return", "arg_0", ".", "processTmpl", ".", "render", "(", "indent", "=", "getIndent", "(", "arg_2", ".", "indent", ")", ",", "arg_12", "=", "arg_1", ".", "name", ",", "arg_6", "=", "arg_6", ",", "arg_4", "=", "arg_5", ",", "arg_7", "=", "\", \"", ".", "join", "(", "arg_7", ")", ",", "statements", "=", "arg_17", "+", "arg_16", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Serialize Func objects as VHDL\n\n        :param scope: name scope to prevent name collisions\n        \"\"\"\n        arg_3 = arg_1.statements\n        arg_4 = []\n        arg_5 = []\n\n        arg_6 = arr_any(arg_3,\n                                     lambda x: isinstance(x,\n                                                          (IfContainer,\n                                                           SwitchContainer,\n                                                           WhileContainer,\n                                                           WaitStm)))\n\n        arg_7 = sorted(\n            map(lambda arg_11: arg_0.sensitivityListItem(arg_11, arg_2),\n                arg_1.sensitivityList))\n\n        if arg_6:\n            arg_8 = arg_2.withIndent()\n        else:\n            arg_8 = copy(arg_2)\n\n        def arg_15(arg_9, arg_10):\n            arg_11 = RtlSignal(None, None, arg_10, virtualOnly=True)\n            arg_11.name = arg_2.scope.checkedName(arg_9, arg_11)\n            arg_11.hidden = False\n            arg_14 = arg_0.SignalItem(arg_11, arg_8, declaration=True)\n            arg_4.append(arg_11)\n            arg_5.append(arg_14)\n            return arg_11\n\n        arg_8.createTmpVarFn = arg_15\n\n        arg_16 = [arg_0.asHdl(arg_11, arg_8) for arg_11 in arg_3]\n        arg_1.name = arg_2.scope.checkedName(arg_1.name, arg_1)\n\n        arg_17 = []\n        for arg_11 in arg_4:\n            if isinstance(arg_11.defVal, RtlSignalBase) or arg_11.defVal.vldMask:\n                arg_18 = Assignment(arg_11.defVal, arg_11, virtualOnly=True)\n                arg_17.append(arg_0.Assignment(arg_18, arg_8))\n            else:\n                assert arg_11.drivers, arg_11\n            for arg_19 in arg_11.drivers:\n                arg_17.append(arg_0.asHdl(arg_19, arg_8))\n\n        arg_20 = arg_6\n        arg_6 = arg_4 or arg_6\n\n        if arg_6 and not arg_20:\n            # add indent because we did not added it before because we did not\n            # know t\n            arg_21 = getIndent(1)\n            arg_16 = list(map(lambda x: arg_21 + x, arg_16))\n\n        return arg_0.processTmpl.render(\n            indent=getIndent(arg_2.indent),\n            arg_12=arg_1.name,\n            arg_6=arg_6,\n            arg_4=arg_5,\n            arg_7=\", \".join(arg_7),\n            statements=arg_17 + arg_16\n        )", "path": "hwt/serializer/vhdl/statements.py", "identifier": "VhdlSerializer_statements.HWProcess", "docstring": "Serialize HWProcess objects as VHDL\n\n        :param scope: name scope to prevent name collisions", "docstring_tokens": ["Serialize", "HWProcess", "objects", "as", "VHDL"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 260169}
{"url": "https://github.com/UDST/pandana/blob/961a7ef8d3b0144b190cb60bbd61845fca6fb314/pandana/loaders/pandash5.py#L56-L79", "sha": "961a7ef8d3b0144b190cb60bbd61845fca6fb314", "docstring_summary": "Build a Network from data in a Pandas HDFStore.", "language": "python", "parameters": "(cls, filename)", "return_statement": "return cls(\n        nodes['x'], nodes['y'], edges['from'], edges['to'], edges[imp_names],\n        twoway=two_way)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "pd", ".", "HDFStore", "(", "arg_1", ")", "as", "store", ":", "arg_2", "=", "store", "[", "'nodes'", "]", "arg_3", "=", "store", "[", "'edges'", "]", "arg_4", "=", "store", "[", "'two_way'", "]", "[", "0", "]", "arg_5", "=", "store", "[", "'impedance_names'", "]", ".", "tolist", "(", ")", "return", "arg_0", "(", "arg_2", "[", "'x'", "]", ",", "arg_2", "[", "'y'", "]", ",", "arg_3", "[", "'from'", "]", ",", "arg_3", "[", "'to'", "]", ",", "arg_3", "[", "arg_5", "]", ",", "twoway", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Build a Network from data in a Pandas HDFStore.\n\n    Parameters\n    ----------\n    cls : class\n        Class to instantiate, usually pandana.Network.\n    filename : str\n\n    Returns\n    -------\n    network : pandana.Network\n\n    \"\"\"\n    with pd.HDFStore(arg_1) as store:\n        arg_2 = store['nodes']\n        arg_3 = store['edges']\n        arg_4 = store['two_way'][0]\n        arg_5 = store['impedance_names'].tolist()\n\n    return arg_0(\n        arg_2['x'], arg_2['y'], arg_3['from'], arg_3['to'], arg_3[arg_5],\n        twoway=arg_4)", "path": "pandana/loaders/pandash5.py", "identifier": "network_from_pandas_hdf5", "docstring": "Build a Network from data in a Pandas HDFStore.\n\n    Parameters\n    ----------\n    cls : class\n        Class to instantiate, usually pandana.Network.\n    filename : str\n\n    Returns\n    -------\n    network : pandana.Network", "docstring_tokens": ["Build", "a", "Network", "from", "data", "in", "a", "Pandas", "HDFStore", "."], "nwo": "UDST/pandana", "score": 0.47050699646286387, "idx": 260170}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/env.py#L50-L66", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "This code is copied from Docker Compose, so that we're exactly compatible\n    with their `env_file` option", "language": "python", "parameters": "(filename)", "return_statement": "return env", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "split_env", "(", "arg_1", ")", ":", "if", "'='", "in", "arg_1", ":", "return", "arg_1", ".", "split", "(", "'='", ",", "1", ")", "else", ":", "return", "arg_1", ",", "None", "arg_1", "=", "{", "}", "for", "arg_2", "in", "open", "(", "arg_0", ",", "'r'", ")", ":", "arg_2", "=", "arg_2", ".", "strip", "(", ")", "if", "arg_2", "and", "not", "arg_2", ".", "startswith", "(", "'#'", ")", ":", "arg_3", ",", "arg_4", "=", "split_env", "(", "arg_2", ")", "arg_1", "[", "arg_3", "]", "=", "arg_4", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    This code is copied from Docker Compose, so that we're exactly compatible\n    with their `env_file` option\n    \"\"\"\n    def split_env(arg_1):\n        if '=' in arg_1:\n            return arg_1.split('=', 1)\n        else:\n            return arg_1, None\n    arg_1 = {}\n    for arg_2 in open(arg_0, 'r'):\n        arg_2 = arg_2.strip()\n        if arg_2 and not arg_2.startswith('#'):\n            arg_3, arg_4 = split_env(arg_2)\n            arg_1[arg_3] = arg_4\n    return arg_1", "path": "dusty/commands/env.py", "identifier": "_env_vars_from_file", "docstring": "This code is copied from Docker Compose, so that we're exactly compatible\n    with their `env_file` option", "docstring_tokens": ["This", "code", "is", "copied", "from", "Docker", "Compose", "so", "that", "we", "re", "exactly", "compatible", "with", "their", "env_file", "option"], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 260171}
{"url": "https://github.com/ibm-watson-iot/iot-python/blob/195f05adce3fba4ec997017e41e02ebd85c0c4cc/src/wiotp/sdk/application/client.py#L116-L135", "sha": "195f05adce3fba4ec997017e41e02ebd85c0c4cc", "docstring_summary": "Subscribe to device status messages", "language": "python", "parameters": "(self, typeId=\"+\", deviceId=\"+\")", "return_statement": "return self._subscribe(topic, 0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"+\"", ",", "arg_2", "=", "\"+\"", ")", ":", "if", "arg_0", ".", "_config", ".", "isQuickstart", "(", ")", "and", "arg_2", "==", "\"+\"", ":", "arg_0", ".", "logger", ".", "warning", "(", "\"QuickStart applications do not support wildcard subscription to device status\"", ")", "return", "0", "arg_3", "=", "\"iot-2/type/%s/id/%s/mon\"", "%", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "_subscribe", "(", "arg_3", ",", "0", ")"], "function": "def Func(arg_0, arg_1=\"+\", arg_2=\"+\"):\n        \"\"\"\n        Subscribe to device status messages\n\n        # Parameters\n        typeId (string): typeId for the subscription, optional.  Defaults to all device types (MQTT `+` wildcard)\n        deviceId (string): deviceId for the subscription, optional.  Defaults to all devices (MQTT `+` wildcard)\n\n        # Returns\n        int: If the subscription was successful then the return Message ID (mid) for the subscribe request\n            will be returned. The mid value can be used to track the subscribe request by checking against\n            the mid argument if you register a subscriptionCallback method.\n            If the subscription fails then the return value will be `0`\n        \"\"\"\n        if arg_0._config.isQuickstart() and arg_2 == \"+\":\n            arg_0.logger.warning(\"QuickStart applications do not support wildcard subscription to device status\")\n            return 0\n\n        arg_3 = \"iot-2/type/%s/id/%s/mon\" % (arg_1, arg_2)\n        return arg_0._subscribe(arg_3, 0)", "path": "src/wiotp/sdk/application/client.py", "identifier": "ApplicationClient.subscribeToDeviceStatus", "docstring": "Subscribe to device status messages\n\n        # Parameters\n        typeId (string): typeId for the subscription, optional.  Defaults to all device types (MQTT `+` wildcard)\n        deviceId (string): deviceId for the subscription, optional.  Defaults to all devices (MQTT `+` wildcard)\n\n        # Returns\n        int: If the subscription was successful then the return Message ID (mid) for the subscribe request\n            will be returned. The mid value can be used to track the subscribe request by checking against\n            the mid argument if you register a subscriptionCallback method.\n            If the subscription fails then the return value will be `0`", "docstring_tokens": ["Subscribe", "to", "device", "status", "messages"], "nwo": "ibm-watson-iot/iot-python", "score": 0.6135771375083736, "idx": 260172}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1080-L1083", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "r\"\\]", "language": "python", "parameters": "(self, t)", "return_statement": "return t", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "endlexpos", "=", "arg_1", ".", "lexpos", "+", "len", "(", "arg_1", ".", "value", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        r\"\\]\"\n        arg_1.endlexpos = arg_1.lexpos + len(arg_1.value)\n        return arg_1", "path": "bridgepoint/oal.py", "identifier": "OALParser.t_RSQBR", "docstring": "r\"\\]", "docstring_tokens": ["r", "\\", "]"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 260173}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1322-L1329", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "_compat_rem_str_id_from_index - Used in compat_convertHashedIndexes to remove the old string repr of a field,\n\t\t\t\tin order to later add the hashed value,", "language": "python", "parameters": "(self, indexedField, pk, val, conn=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "_get_connection", "(", ")", "arg_4", ".", "srem", "(", "arg_0", ".", "_compat_get_str_key_for_index", "(", "arg_1", ",", "arg_3", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n\t\t'''\n\t\t\tFunc - Used in compat_convertHashedIndexes to remove the old string repr of a field,\n\t\t\t\tin order to later add the hashed value,\n\t\t'''\n\t\tif arg_4 is None:\n\t\t\targ_4 = arg_0._get_connection()\n\t\targ_4.srem(arg_0._compat_get_str_key_for_index(arg_1, arg_3), arg_2)", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisHelper._compat_rem_str_id_from_index", "docstring": "_compat_rem_str_id_from_index - Used in compat_convertHashedIndexes to remove the old string repr of a field,\n\t\t\t\tin order to later add the hashed value,", "docstring_tokens": ["_compat_rem_str_id_from_index", "-", "Used", "in", "compat_convertHashedIndexes", "to", "remove", "the", "old", "string", "repr", "of", "a", "field", "in", "order", "to", "later", "add", "the", "hashed", "value"], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 260174}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L673-L699", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "URL reconstruction according to PEP 333.", "language": "python", "parameters": "(environ, localUri=None)", "return_statement": "return url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_0", "[", "\"wsgi.url_scheme\"", "]", "+", "\"://\"", "if", "arg_0", ".", "get", "(", "\"HTTP_HOST\"", ")", ":", "arg_2", "+=", "arg_0", "[", "\"HTTP_HOST\"", "]", "else", ":", "arg_2", "+=", "arg_0", "[", "\"SERVER_NAME\"", "]", "if", "arg_0", "[", "\"wsgi.url_scheme\"", "]", "==", "\"https\"", ":", "if", "arg_0", "[", "\"SERVER_PORT\"", "]", "!=", "\"443\"", ":", "arg_2", "+=", "\":\"", "+", "arg_0", "[", "\"SERVER_PORT\"", "]", "else", ":", "if", "arg_0", "[", "\"SERVER_PORT\"", "]", "!=", "\"80\"", ":", "arg_2", "+=", "\":\"", "+", "arg_0", "[", "\"SERVER_PORT\"", "]", "arg_2", "+=", "compat", ".", "quote", "(", "arg_0", ".", "get", "(", "\"SCRIPT_NAME\"", ",", "\"\"", ")", ")", "if", "arg_1", "is", "None", ":", "arg_2", "+=", "compat", ".", "quote", "(", "arg_0", ".", "get", "(", "\"PATH_INFO\"", ",", "\"\"", ")", ")", "if", "arg_0", ".", "get", "(", "\"QUERY_STRING\"", ")", ":", "arg_2", "+=", "\"?\"", "+", "arg_0", "[", "\"QUERY_STRING\"", "]", "else", ":", "arg_2", "+=", "arg_1", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"URL reconstruction according to PEP 333.\n    @see https://www.python.org/dev/peps/pep-3333/#url-reconstruction\n    \"\"\"\n    arg_2 = arg_0[\"wsgi.url_scheme\"] + \"://\"\n\n    if arg_0.get(\"HTTP_HOST\"):\n        arg_2 += arg_0[\"HTTP_HOST\"]\n    else:\n        arg_2 += arg_0[\"SERVER_NAME\"]\n\n        if arg_0[\"wsgi.url_scheme\"] == \"https\":\n            if arg_0[\"SERVER_PORT\"] != \"443\":\n                arg_2 += \":\" + arg_0[\"SERVER_PORT\"]\n        else:\n            if arg_0[\"SERVER_PORT\"] != \"80\":\n                arg_2 += \":\" + arg_0[\"SERVER_PORT\"]\n\n    arg_2 += compat.quote(arg_0.get(\"SCRIPT_NAME\", \"\"))\n\n    if arg_1 is None:\n        arg_2 += compat.quote(arg_0.get(\"PATH_INFO\", \"\"))\n        if arg_0.get(\"QUERY_STRING\"):\n            arg_2 += \"?\" + arg_0[\"QUERY_STRING\"]\n    else:\n        arg_2 += arg_1  # TODO: quote?\n    return arg_2", "path": "wsgidav/util.py", "identifier": "make_complete_url", "docstring": "URL reconstruction according to PEP 333.\n    @see https://www.python.org/dev/peps/pep-3333/#url-reconstruction", "docstring_tokens": ["URL", "reconstruction", "according", "to", "PEP", "333", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 260175}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L660-L667", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "End I2C transaction and get response bytes, including ACKs.", "language": "python", "parameters": "(self)", "return_statement": "return bytearray(self._ft232h._poll_read(self._expected))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_command", ".", "append", "(", "'\\x87'", ")", "arg_0", ".", "_ft232h", ".", "_write", "(", "''", ".", "join", "(", "arg_0", ".", "_command", ")", ")", "return", "bytearray", "(", "arg_0", ".", "_ft232h", ".", "_poll_read", "(", "arg_0", ".", "_expected", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"End I2C transaction and get response bytes, including ACKs.\"\"\"\n        # Ask to return response bytes immediately.\n        arg_0._command.append('\\x87')\n        # Send the entire command to the MPSSE.\n        arg_0._ft232h._write(''.join(arg_0._command))\n        # Read response bytes and return them.\n        return bytearray(arg_0._ft232h._poll_read(arg_0._expected))", "path": "Adafruit_GPIO/FT232H.py", "identifier": "I2CDevice._transaction_end", "docstring": "End I2C transaction and get response bytes, including ACKs.", "docstring_tokens": ["End", "I2C", "transaction", "and", "get", "response", "bytes", "including", "ACKs", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 260176}
{"url": "https://github.com/piface/pifacecommon/blob/006bca14c18d43ba2d9eafaa84ef83b512c51cf6/pifacecommon/mcp23s17.py#L116-L135", "sha": "006bca14c18d43ba2d9eafaa84ef83b512c51cf6", "docstring_summary": "Returns an SPI control byte.", "language": "python", "parameters": "(self, read_write_cmd)", "return_statement": "return 0x40 | board_addr_pattern | rw_cmd_pattern", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "(", "arg_0", ".", "hardware_addr", "<<", "1", ")", "&", "0xE", "arg_3", "=", "arg_1", "&", "1", "return", "0x40", "|", "arg_2", "|", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns an SPI control byte.\n\n        The MCP23S17 is a slave SPI device. The slave address contains\n        four fixed bits and three user-defined hardware address bits\n        (if enabled via IOCON.HAEN) (pins A2, A1 and A0) with the\n        read/write bit filling out the control byte::\n\n            +--------------------+\n            |0|1|0|0|A2|A1|A0|R/W|\n            +--------------------+\n             7 6 5 4 3  2  1   0\n\n        :param read_write_cmd: Read or write command.\n        :type read_write_cmd: int\n        \"\"\"\n        # board_addr_pattern = (self.hardware_addr & 0b111) << 1\n        arg_2 = (arg_0.hardware_addr << 1) & 0xE\n        arg_3 = arg_1 & 1  # make sure it's just 1 bit long\n        return 0x40 | arg_2 | arg_3", "path": "pifacecommon/mcp23s17.py", "identifier": "MCP23S17._get_spi_control_byte", "docstring": "Returns an SPI control byte.\n\n        The MCP23S17 is a slave SPI device. The slave address contains\n        four fixed bits and three user-defined hardware address bits\n        (if enabled via IOCON.HAEN) (pins A2, A1 and A0) with the\n        read/write bit filling out the control byte::\n\n            +--------------------+\n            |0|1|0|0|A2|A1|A0|R/W|\n            +--------------------+\n             7 6 5 4 3  2  1   0\n\n        :param read_write_cmd: Read or write command.\n        :type read_write_cmd: int", "docstring_tokens": ["Returns", "an", "SPI", "control", "byte", "."], "nwo": "piface/pifacecommon", "score": 0.19772711687134117, "idx": 260177}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L228-L254", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Convert values to an appropriate type. dicts, lists and tuples are\n        replaced by their converting alternatives. Strings are checked to\n        see if they have a conversion format and are converted if they do.", "language": "python", "parameters": "(self, value)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "ConvertingDict", ")", "and", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_1", "=", "ConvertingDict", "(", "arg_1", ")", "arg_1", ".", "configurator", "=", "arg_0", "elif", "not", "isinstance", "(", "arg_1", ",", "ConvertingList", ")", "and", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_1", "=", "ConvertingList", "(", "arg_1", ")", "arg_1", ".", "configurator", "=", "arg_0", "elif", "not", "isinstance", "(", "arg_1", ",", "ConvertingTuple", ")", "and", "isinstance", "(", "arg_1", ",", "tuple", ")", ":", "arg_1", "=", "ConvertingTuple", "(", "arg_1", ")", "arg_1", ".", "configurator", "=", "arg_0", "elif", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "arg_3", "=", "arg_0", ".", "CONVERT_PATTERN", ".", "match", "(", "arg_1", ")", "if", "arg_3", ":", "arg_4", "=", "arg_3", ".", "groupdict", "(", ")", "arg_5", "=", "arg_4", "[", "'prefix'", "]", "arg_6", "=", "arg_0", ".", "value_Funcers", ".", "get", "(", "arg_5", ",", "None", ")", "if", "arg_6", ":", "arg_7", "=", "arg_4", "[", "'suffix'", "]", "arg_6", "=", "getattr", "(", "arg_0", ",", "arg_6", ")", "arg_1", "=", "arg_6", "(", "arg_7", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert values to an appropriate type. dicts, lists and tuples are\n        replaced by their Funcing alternatives. Strings are checked to\n        see if they have a conversion format and are Funced if they do.\n        \"\"\"\n        if not isinstance(arg_1, ConvertingDict) and isinstance(arg_1, dict):\n            arg_1 = ConvertingDict(arg_1)\n            arg_1.configurator = arg_0\n        elif not isinstance(arg_1, ConvertingList) and isinstance(arg_1, list):\n            arg_1 = ConvertingList(arg_1)\n            arg_1.configurator = arg_0\n        elif not isinstance(arg_1, ConvertingTuple) and\\\n                 isinstance(arg_1, tuple):\n            arg_1 = ConvertingTuple(arg_1)\n            arg_1.configurator = arg_0\n        elif isinstance(arg_1, six.string_types):  # str for py3k\n            arg_3 = arg_0.CONVERT_PATTERN.match(arg_1)\n            if arg_3:\n                arg_4 = arg_3.groupdict()\n                arg_5 = arg_4['prefix']\n                arg_6 = arg_0.value_Funcers.get(arg_5, None)\n                if arg_6:\n                    arg_7 = arg_4['suffix']\n                    arg_6 = getattr(arg_0, arg_6)\n                    arg_1 = arg_6(arg_7)\n        return arg_1", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py", "identifier": "BaseConfigurator.convert", "docstring": "Convert values to an appropriate type. dicts, lists and tuples are\n        replaced by their converting alternatives. Strings are checked to\n        see if they have a conversion format and are converted if they do.", "docstring_tokens": ["Convert", "values", "to", "an", "appropriate", "type", ".", "dicts", "lists", "and", "tuples", "are", "replaced", "by", "their", "converting", "alternatives", ".", "Strings", "are", "checked", "to", "see", "if", "they", "have", "a", "conversion", "format", "and", "are", "converted", "if", "they", "do", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260178}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/node/element.py#L276-L280", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Select this node if it is an option element inside a select tag.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "disabled", ":", "warn", "(", "\"Attempt to select disabled option: {}\"", ".", "format", "(", "arg_0", ".", "value", "or", "arg_0", ".", "text", ")", ")", "arg_0", ".", "base", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Select this node if it is an option element inside a select tag. \"\"\"\n        if arg_0.disabled:\n            warn(\"Attempt to select disabled option: {}\".format(arg_0.value or arg_0.text))\n        arg_0.base.Func()", "path": "capybara/node/element.py", "identifier": "Element.select_option", "docstring": "Select this node if it is an option element inside a select tag.", "docstring_tokens": ["Select", "this", "node", "if", "it", "is", "an", "option", "element", "inside", "a", "select", "tag", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 260179}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppstringprep.py#L61-L70", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Do NFKC normalization of Unicode data.", "language": "python", "parameters": "(data)", "return_statement": "return unicodedata.normalize(\"NFKC\", data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_0", "=", "u\"\"", ".", "join", "(", "arg_0", ")", "return", "unicodedata", ".", "normalize", "(", "\"NFKC\"", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Do NFKC normalization of Unicode data.\n\n    :Parameters:\n        - `data`: list of Unicode characters or Unicode string.\n\n    :return: normalized Unicode string.\"\"\"\n    if isinstance(arg_0, list):\n        arg_0 = u\"\".join(arg_0)\n    return unicodedata.normalize(\"NFKC\", arg_0)", "path": "pyxmpp2/xmppstringprep.py", "identifier": "nfkc", "docstring": "Do NFKC normalization of Unicode data.\n\n    :Parameters:\n        - `data`: list of Unicode characters or Unicode string.\n\n    :return: normalized Unicode string.", "docstring_tokens": ["Do", "NFKC", "normalization", "of", "Unicode", "data", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260180}
{"url": "https://github.com/rossengeorgiev/aprs-python/blob/94b89a6da47a322129484efcaf1e82f6a9932891/aprslib/inet.py#L77-L86", "sha": "94b89a6da47a322129484efcaf1e82f6a9932891", "docstring_summary": "Set a specified aprs-is filter for this connection", "language": "python", "parameters": "(self, filter_text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "filter", "=", "arg_1", "arg_0", ".", "logger", ".", "info", "(", "\"Setting filter to: %s\"", ",", "arg_0", ".", "filter", ")", "if", "arg_0", ".", "_connected", ":", "arg_0", ".", "_sendall", "(", "\"#filter %s\\r\\n\"", "%", "arg_0", ".", "filter", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set a specified aprs-is filter for this connection\n        \"\"\"\n        arg_0.filter = arg_1\n\n        arg_0.logger.info(\"Setting filter to: %s\", arg_0.filter)\n\n        if arg_0._connected:\n            arg_0._sendall(\"#filter %s\\r\\n\" % arg_0.filter)", "path": "aprslib/inet.py", "identifier": "IS.set_filter", "docstring": "Set a specified aprs-is filter for this connection", "docstring_tokens": ["Set", "a", "specified", "aprs", "-", "is", "filter", "for", "this", "connection"], "nwo": "rossengeorgiev/aprs-python", "score": 0.3643830340421162, "idx": 260181}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3838-L3892", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Returns a DataFrame with a random set of rows", "language": "python", "parameters": "(self, n=None, frac=None, replace=False, weights=None, random_state=None)", "return_statement": "return self.take(indices)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_0", "=", "arg_0", ".", "extract", "(", ")", "if", "type", "(", "arg_5", ")", "==", "int", "or", "arg_5", "is", "None", ":", "arg_5", "=", "np", ".", "random", ".", "RandomState", "(", "seed", "=", "arg_5", ")", "if", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "arg_1", "=", "1", "elif", "arg_2", "is", "not", "None", ":", "arg_1", "=", "int", "(", "round", "(", "arg_2", "*", "len", "(", "arg_0", ")", ")", ")", "arg_6", "=", "None", "if", "arg_4", "is", "not", "None", ":", "arg_6", "=", "arg_0", ".", "evaluate", "(", "arg_4", ")", "arg_6", "=", "arg_6", "/", "arg_0", ".", "sum", "(", "arg_4", ")", "arg_7", "=", "arg_5", ".", "choice", "(", "len", "(", "arg_0", ")", ",", "arg_1", ",", "arg_3", "=", "arg_3", ",", "p", "=", "arg_6", ")", "return", "arg_0", ".", "take", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=False, arg_4=None, arg_5=None):\n        '''Returns a DataFrame with a random set of rows\n\n        {note_copy}\n\n        Provide either n or frac.\n\n        Example:\n\n        >>> import vaex, numpy as np\n        >>> df = vaex.from_arrays(s=np.array(['a', 'b', 'c', 'd']), x=np.arange(1,5))\n        >>> df\n          #  s      x\n          0  a      1\n          1  b      2\n          2  c      3\n          3  d      4\n        >>> df.Func(n=2, random_state=42) # 2 random rows, fixed seed\n          #  s      x\n          0  b      2\n          1  d      4\n        >>> df.Func(frac=1, random_state=42) # 'shuffling'\n          #  s      x\n          0  c      3\n          1  a      1\n          2  d      4\n          3  b      2\n        >>> df.Func(frac=1, replace=True, random_state=42) # useful for bootstrap (may contain repeated Funcs)\n          #  s      x\n          0  d      4\n          1  a      1\n          2  a      1\n          3  d      4\n\n        :param int n: number of Funcs to take (default 1 if frac is None)\n        :param float frac: fractional number of takes to take\n        :param bool replace: If true, a row may be drawn multiple times\n        :param str or expression weights: (unnormalized) probability that a row can be drawn\n        :param int or RandomState: seed or RandomState for reproducability, when None a random seed it chosen\n        :return: {return_shallow_copy}\n        :rtype: DataFrame\n        '''\n        arg_0 = arg_0.extract()\n        if type(arg_5) == int or arg_5 is None:\n            arg_5 = np.random.RandomState(seed=arg_5)\n        if arg_1 is None and arg_2 is None:\n            arg_1 = 1\n        elif arg_2 is not None:\n            arg_1 = int(round(arg_2 * len(arg_0)))\n        arg_6 = None\n        if arg_4 is not None:\n            arg_6 = arg_0.evaluate(arg_4)\n            arg_6 = arg_6 / arg_0.sum(arg_4)\n        arg_7 = arg_5.choice(len(arg_0), arg_1, arg_3=arg_3, p=arg_6)\n        return arg_0.take(arg_7)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.sample", "docstring": "Returns a DataFrame with a random set of rows\n\n        {note_copy}\n\n        Provide either n or frac.\n\n        Example:\n\n        >>> import vaex, numpy as np\n        >>> df = vaex.from_arrays(s=np.array(['a', 'b', 'c', 'd']), x=np.arange(1,5))\n        >>> df\n          #  s      x\n          0  a      1\n          1  b      2\n          2  c      3\n          3  d      4\n        >>> df.sample(n=2, random_state=42) # 2 random rows, fixed seed\n          #  s      x\n          0  b      2\n          1  d      4\n        >>> df.sample(frac=1, random_state=42) # 'shuffling'\n          #  s      x\n          0  c      3\n          1  a      1\n          2  d      4\n          3  b      2\n        >>> df.sample(frac=1, replace=True, random_state=42) # useful for bootstrap (may contain repeated samples)\n          #  s      x\n          0  d      4\n          1  a      1\n          2  a      1\n          3  d      4\n\n        :param int n: number of samples to take (default 1 if frac is None)\n        :param float frac: fractional number of takes to take\n        :param bool replace: If true, a row may be drawn multiple times\n        :param str or expression weights: (unnormalized) probability that a row can be drawn\n        :param int or RandomState: seed or RandomState for reproducability, when None a random seed it chosen\n        :return: {return_shallow_copy}\n        :rtype: DataFrame", "docstring_tokens": ["Returns", "a", "DataFrame", "with", "a", "random", "set", "of", "rows"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 260182}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L520-L530", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "The function will return True if the r tag passed in is considered\n    italicized.", "language": "python", "parameters": "(r)", "return_statement": "return style_is_false(italics)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_namespace", "(", "arg_0", ",", "'w'", ")", "arg_2", "=", "arg_0", ".", "find", "(", "'%srPr'", "%", "arg_1", ")", "if", "arg_2", "is", "None", ":", "return", "False", "arg_3", "=", "arg_2", ".", "find", "(", "'%si'", "%", "arg_1", ")", "return", "style_is_false", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    The function will return True if the r tag passed in is considered\n    italicized.\n    \"\"\"\n    arg_1 = get_namespace(arg_0, 'w')\n    arg_2 = arg_0.find('%srPr' % arg_1)\n    if arg_2 is None:\n        return False\n    arg_3 = arg_2.find('%si' % arg_1)\n    return style_is_false(arg_3)", "path": "docx2html/core.py", "identifier": "is_italics", "docstring": "The function will return True if the r tag passed in is considered\n    italicized.", "docstring_tokens": ["The", "function", "will", "return", "True", "if", "the", "r", "tag", "passed", "in", "is", "considered", "italicized", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 260183}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_container_instance_hook.py#L118-L131", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Get the messages of a container group", "language": "python", "parameters": "(self, resource_group, name)", "return_statement": "return [event.message for event in instance_view.events]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get_instance_view", "(", "arg_1", ",", "arg_2", ")", "return", "[", "arg_4", ".", "message", "for", "arg_4", "in", "arg_3", ".", "events", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get the messages of a container group\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str\n        :return: A list of the event messages\n        :rtype: list[str]\n        \"\"\"\n        arg_3 = arg_0._get_instance_view(arg_1, arg_2)\n\n        return [arg_4.message for arg_4 in arg_3.events]", "path": "airflow/contrib/hooks/azure_container_instance_hook.py", "identifier": "AzureContainerInstanceHook.get_messages", "docstring": "Get the messages of a container group\n\n        :param resource_group: the name of the resource group\n        :type resource_group: str\n        :param name: the name of the container group\n        :type name: str\n        :return: A list of the event messages\n        :rtype: list[str]", "docstring_tokens": ["Get", "the", "messages", "of", "a", "container", "group"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260184}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/interfaceLevel/interfaceUtils/utils.py#L35-L60", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Connect 1D vector signal to this structuralized interface", "language": "python", "parameters": "(srcPacked, dstInterface, exclude=None)", "return_statement": "return connections", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "0", "arg_4", "=", "[", "]", "for", "arg_5", "in", "reversed", "(", "list", "(", "walkPhysInterfaces", "(", "arg_1", ")", ")", ")", ":", "if", "arg_2", "is", "not", "None", "and", "arg_5", "in", "arg_2", ":", "continue", "arg_6", "=", "arg_5", ".", "_sig", "arg_7", "=", "arg_6", ".", "_dtype", "if", "arg_7", "==", "BIT", ":", "arg_8", "=", "arg_0", "[", "arg_3", "]", "arg_3", "+=", "1", "else", ":", "arg_9", "=", "arg_7", ".", "bit_length", "(", ")", "arg_8", "=", "arg_0", "[", "(", "arg_9", "+", "arg_3", ")", ":", "arg_3", "]", "arg_3", "+=", "arg_9", "arg_4", ".", "append", "(", "arg_6", "(", "arg_8", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Connect 1D vector signal to this structuralized interface\n\n    :param packedSrc: vector which should be connected\n    :param dstInterface: structuralized interface where should\n        packedSrc be connected to\n    :param exclude: sub interfaces of self which should be excluded\n    \"\"\"\n    arg_3 = 0\n    arg_4 = []\n    for arg_5 in reversed(list(walkPhysInterfaces(arg_1))):\n        if arg_2 is not None and arg_5 in arg_2:\n            continue\n        arg_6 = arg_5._sig\n        arg_7 = arg_6._dtype\n        if arg_7 == BIT:\n            arg_8 = arg_0[arg_3]\n            arg_3 += 1\n        else:\n            arg_9 = arg_7.bit_length()\n            arg_8 = arg_0[(arg_9 + arg_3): arg_3]\n            arg_3 += arg_9\n        arg_4.append(arg_6(arg_8))\n\n    return arg_4", "path": "hwt/synthesizer/interfaceLevel/interfaceUtils/utils.py", "identifier": "connectPacked", "docstring": "Connect 1D vector signal to this structuralized interface\n\n    :param packedSrc: vector which should be connected\n    :param dstInterface: structuralized interface where should\n        packedSrc be connected to\n    :param exclude: sub interfaces of self which should be excluded", "docstring_tokens": ["Connect", "1D", "vector", "signal", "to", "this", "structuralized", "interface"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 260185}
{"url": "https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L287-L292", "sha": "1347425814361d7955342c53212edbb27f0ff4b5", "docstring_summary": "Return the last argument with the given name.", "language": "python", "parameters": "(self, name: str)", "return_statement": "return get_arg(name, reversed(self.arguments))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "Optional", "[", "Argument", "]", ":", "return", "Func", "(", "arg_1", ",", "reversed", "(", "arg_0", ".", "arguments", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> Optional[Argument]:\n        \"\"\"Return the last argument with the given name.\n\n        Return None if no argument with that name is found.\n        \"\"\"\n        return Func(arg_1, reversed(arg_0.arguments))", "path": "wikitextparser/_template.py", "identifier": "Template.get_arg", "docstring": "Return the last argument with the given name.\n\n        Return None if no argument with that name is found.", "docstring_tokens": ["Return", "the", "last", "argument", "with", "the", "given", "name", "."], "nwo": "5j9/wikitextparser", "score": 0.6937016973948295, "idx": 260186}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L968-L974", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "One way to calibrate the band pass is to take the median value\n            for every frequency fine channel, and divide by it.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "median", "(", "arg_0", ".", "data", ".", "squeeze", "(", ")", ",", "axis", "=", "0", ")", "arg_0", ".", "data", "=", "arg_0", ".", "data", "/", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" One way to calibrate the band pass is to take the median value\n            for every frequency fine channel, and divide by it.\n        \"\"\"\n\n        arg_1 = np.median(arg_0.data.squeeze(),axis=0)\n        arg_0.data = arg_0.data/arg_1", "path": "blimpy/filterbank.py", "identifier": "Filterbank.calibrate_band_pass_N1", "docstring": "One way to calibrate the band pass is to take the median value\n            for every frequency fine channel, and divide by it.", "docstring_tokens": ["One", "way", "to", "calibrate", "the", "band", "pass", "is", "to", "take", "the", "median", "value", "for", "every", "frequency", "fine", "channel", "and", "divide", "by", "it", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 260187}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/run.py#L177-L190", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Return a list of the mpi command portion of the commandline.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return [self.mpiexec, '-n', str(ncores)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_0", ".", "mpiexec", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Override mpiexec to enable the simple OpenMP launcher\"", ")", "arg_3", "=", "arg_2", ".", "pop", "(", "'ncores'", ",", "8", ")", "return", "[", "arg_0", ".", "mpiexec", ",", "'-n'", ",", "str", "(", "arg_3", ")", "]"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Return a list of the mpi command portion of the commandline.\n\n        Only allows primitive mpi at the moment:\n           *mpiexec* -n *ncores* *mdrun* *mdrun-args*\n\n        (This is a primitive example for OpenMP. Override it for more\n        complicated cases.)\n        \"\"\"\n        if arg_0.mpiexec is None:\n            raise NotImplementedError(\"Override mpiexec to enable the simple OpenMP launcher\")\n        # example implementation\n        arg_3 = arg_2.pop('ncores', 8)\n        return [arg_0.mpiexec, '-n', str(arg_3)]", "path": "gromacs/run.py", "identifier": "MDrunner.mpicommand", "docstring": "Return a list of the mpi command portion of the commandline.\n\n        Only allows primitive mpi at the moment:\n           *mpiexec* -n *ncores* *mdrun* *mdrun-args*\n\n        (This is a primitive example for OpenMP. Override it for more\n        complicated cases.)", "docstring_tokens": ["Return", "a", "list", "of", "the", "mpi", "command", "portion", "of", "the", "commandline", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 260188}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L539-L662", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Prints some performance metrics of the strategy.", "language": "python", "parameters": "(returns, factor_returns=None, positions=None,\n                    transactions=None, turnover_denom='AGB',\n                    live_start_date=None, bootstrap=False,\n                    header_rows=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'AGB'", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ")", ":", "if", "arg_6", ":", "arg_8", "=", "timeseries", ".", "perf_stats_bootstrap", "else", ":", "arg_8", "=", "timeseries", ".", "perf_stats", "arg_9", "=", "arg_8", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", "arg_10", "=", "OrderedDict", "(", ")", "if", "len", "(", "arg_0", ".", "index", ")", ">", "0", ":", "arg_10", "[", "'Start date'", "]", "=", "arg_0", ".", "index", "[", "0", "]", ".", "strftime", "(", "'%Y-%m-%d'", ")", "arg_10", "[", "'End date'", "]", "=", "arg_0", ".", "index", "[", "-", "1", "]", ".", "strftime", "(", "'%Y-%m-%d'", ")", "if", "arg_5", "is", "not", "None", ":", "arg_5", "=", "ep", ".", "utils", ".", "get_utc_timestamp", "(", "arg_5", ")", "arg_11", "=", "arg_0", "[", "arg_0", ".", "index", "<", "arg_5", "]", "arg_12", "=", "arg_0", "[", "arg_0", ".", "index", ">=", "arg_5", "]", "arg_13", "=", "None", "arg_14", "=", "None", "arg_15", "=", "None", "arg_16", "=", "None", "if", "arg_2", "is", "not", "None", ":", "arg_13", "=", "arg_2", "[", "arg_2", ".", "index", "<", "arg_5", "]", "arg_14", "=", "arg_2", "[", "arg_2", ".", "index", ">=", "arg_5", "]", "if", "arg_3", "is", "not", "None", ":", "arg_15", "=", "arg_3", "[", "(", "arg_3", ".", "index", "<", "arg_5", ")", "]", "arg_16", "=", "arg_3", "[", "(", "arg_3", ".", "index", ">", "arg_5", ")", "]", "arg_17", "=", "arg_8", "(", "arg_11", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_13", ",", "arg_3", "=", "arg_15", ",", "arg_4", "=", "arg_4", ")", "arg_18", "=", "arg_8", "(", "arg_12", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_14", ",", "arg_3", "=", "arg_16", ",", "arg_4", "=", "arg_4", ")", "if", "len", "(", "arg_0", ".", "index", ")", ">", "0", ":", "arg_10", "[", "'In-sample months'", "]", "=", "int", "(", "len", "(", "arg_11", ")", "/", "APPROX_BDAYS_PER_MONTH", ")", "arg_10", "[", "'Out-of-sample months'", "]", "=", "int", "(", "len", "(", "arg_12", ")", "/", "APPROX_BDAYS_PER_MONTH", ")", "arg_19", "=", "pd", ".", "concat", "(", "OrderedDict", "(", "[", "(", "'In-sample'", ",", "arg_17", ")", ",", "(", "'Out-of-sample'", ",", "arg_18", ")", ",", "(", "'All'", ",", "arg_9", ")", ",", "]", ")", ",", "axis", "=", "1", ")", "else", ":", "if", "len", "(", "arg_0", ".", "index", ")", ">", "0", ":", "arg_10", "[", "'Total months'", "]", "=", "int", "(", "len", "(", "arg_0", ")", "/", "APPROX_BDAYS_PER_MONTH", ")", "arg_19", "=", "pd", ".", "DataFrame", "(", "arg_9", ",", "columns", "=", "[", "'Backtest'", "]", ")", "for", "arg_20", "in", "arg_19", ".", "columns", ":", "for", "arg_21", ",", "arg_22", "in", "arg_19", "[", "arg_20", "]", ".", "iteritems", "(", ")", ":", "if", "arg_21", "in", "STAT_FUNCS_PCT", ":", "arg_19", ".", "loc", "[", "arg_21", ",", "arg_20", "]", "=", "str", "(", "np", ".", "round", "(", "arg_22", "*", "100", ",", "1", ")", ")", "+", "'%'", "if", "arg_7", "is", "None", ":", "arg_7", "=", "arg_10", "else", ":", "arg_7", "=", "OrderedDict", "(", "arg_7", ")", "arg_7", ".", "update", "(", "arg_10", ")", "utils", ".", "print_table", "(", "arg_19", ",", "float_format", "=", "'{0:.2f}'", ".", "format", ",", "arg_7", "=", "arg_7", ",", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None,\n                    arg_3=None, arg_4='AGB',\n                    arg_5=None, arg_6=False,\n                    arg_7=None):\n    \"\"\"\n    Prints some performance metrics of the strategy.\n\n    - Shows amount of time the strategy has been run in backtest and\n      out-of-sample (in live trading).\n\n    - Shows Omega ratio, max drawdown, Calmar ratio, annual return,\n      stability, Sharpe ratio, annual volatility, alpha, and beta.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    positions : pd.DataFrame, optional\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame, optional\n        Prices and amounts of executed trades. One row per trade.\n        - See full explanation in tears.create_full_tear_sheet\n    turnover_denom : str, optional\n        Either AGB or portfolio_value, default AGB.\n        - See full explanation in txn.get_turnover.\n    live_start_date : datetime, optional\n        The point in time when the strategy began live trading, after\n        its backtest period.\n    bootstrap : boolean, optional\n        Whether to perform bootstrap analysis for the performance\n        metrics.\n         - For more information, see timeseries.perf_stats_bootstrap\n    header_rows : dict or OrderedDict, optional\n        Extra rows to display at the top of the displayed table.\n    \"\"\"\n\n    if arg_6:\n        arg_8 = timeseries.perf_stats_bootstrap\n    else:\n        arg_8 = timeseries.perf_stats\n\n    arg_9 = arg_8(\n        arg_0,\n        arg_1=arg_1,\n        arg_2=arg_2,\n        arg_3=arg_3,\n        arg_4=arg_4)\n\n    arg_10 = OrderedDict()\n    if len(arg_0.index) > 0:\n        arg_10['Start date'] = arg_0.index[0].strftime('%Y-%m-%d')\n        arg_10['End date'] = arg_0.index[-1].strftime('%Y-%m-%d')\n\n    if arg_5 is not None:\n        arg_5 = ep.utils.get_utc_timestamp(arg_5)\n        arg_11 = arg_0[arg_0.index < arg_5]\n        arg_12 = arg_0[arg_0.index >= arg_5]\n\n        arg_13 = None\n        arg_14 = None\n        arg_15 = None\n        arg_16 = None\n\n        if arg_2 is not None:\n            arg_13 = arg_2[arg_2.index < arg_5]\n            arg_14 = arg_2[arg_2.index >= arg_5]\n            if arg_3 is not None:\n                arg_15 = arg_3[(arg_3.index <\n                                                arg_5)]\n                arg_16 = arg_3[(arg_3.index >\n                                                 arg_5)]\n\n        arg_17 = arg_8(\n            arg_11,\n            arg_1=arg_1,\n            arg_2=arg_13,\n            arg_3=arg_15,\n            arg_4=arg_4)\n\n        arg_18 = arg_8(\n            arg_12,\n            arg_1=arg_1,\n            arg_2=arg_14,\n            arg_3=arg_16,\n            arg_4=arg_4)\n        if len(arg_0.index) > 0:\n            arg_10['In-sample months'] = int(len(arg_11) /\n                                                APPROX_BDAYS_PER_MONTH)\n            arg_10['Out-of-sample months'] = int(len(arg_12) /\n                                                    APPROX_BDAYS_PER_MONTH)\n\n        arg_19 = pd.concat(OrderedDict([\n            ('In-sample', arg_17),\n            ('Out-of-sample', arg_18),\n            ('All', arg_9),\n        ]), axis=1)\n    else:\n        if len(arg_0.index) > 0:\n            arg_10['Total months'] = int(len(arg_0) /\n                                            APPROX_BDAYS_PER_MONTH)\n        arg_19 = pd.DataFrame(arg_9, columns=['Backtest'])\n\n    for arg_20 in arg_19.columns:\n        for arg_21, arg_22 in arg_19[arg_20].iteritems():\n            if arg_21 in STAT_FUNCS_PCT:\n                arg_19.loc[arg_21, arg_20] = str(np.round(arg_22 * 100,\n                                                            1)) + '%'\n    if arg_7 is None:\n        arg_7 = arg_10\n    else:\n        arg_7 = OrderedDict(arg_7)\n        arg_7.update(arg_10)\n\n    utils.print_table(\n        arg_19,\n        float_format='{0:.2f}'.format,\n        arg_7=arg_7,\n    )", "path": "pyfolio/plotting.py", "identifier": "show_perf_stats", "docstring": "Prints some performance metrics of the strategy.\n\n    - Shows amount of time the strategy has been run in backtest and\n      out-of-sample (in live trading).\n\n    - Shows Omega ratio, max drawdown, Calmar ratio, annual return,\n      stability, Sharpe ratio, annual volatility, alpha, and beta.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series, optional\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    positions : pd.DataFrame, optional\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame, optional\n        Prices and amounts of executed trades. One row per trade.\n        - See full explanation in tears.create_full_tear_sheet\n    turnover_denom : str, optional\n        Either AGB or portfolio_value, default AGB.\n        - See full explanation in txn.get_turnover.\n    live_start_date : datetime, optional\n        The point in time when the strategy began live trading, after\n        its backtest period.\n    bootstrap : boolean, optional\n        Whether to perform bootstrap analysis for the performance\n        metrics.\n         - For more information, see timeseries.perf_stats_bootstrap\n    header_rows : dict or OrderedDict, optional\n        Extra rows to display at the top of the displayed table.", "docstring_tokens": ["Prints", "some", "performance", "metrics", "of", "the", "strategy", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260189}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/contrib/deepmind_lab.py#L112-L133", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Pass action to universe environment, return reward, next step, terminal state and\n        additional info.", "language": "python", "parameters": "(self, action)", "return_statement": "return state, terminal, reward", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "list", "(", ")", "for", "arg_3", "in", "arg_0", ".", "level", ".", "action_spec", "(", ")", ":", "if", "arg_3", "[", "'min'", "]", "==", "-", "1", "and", "arg_3", "[", "'max'", "]", "==", "1", ":", "arg_2", ".", "append", "(", "arg_1", "[", "arg_3", "[", "'name'", "]", "]", "-", "1", ")", "else", ":", "arg_2", ".", "append", "(", "arg_1", "[", "arg_3", "[", "'name'", "]", "]", ")", "arg_1", "=", "np", ".", "array", "(", "arg_2", ",", "dtype", "=", "np", ".", "intc", ")", "arg_4", "=", "arg_0", ".", "level", ".", "step", "(", "arg_1", "=", "arg_1", ",", "num_steps", "=", "arg_0", ".", "repeat_action", ")", "arg_5", "=", "arg_0", ".", "level", ".", "observations", "(", ")", "[", "'RGB_INTERLACED'", "]", "arg_6", "=", "not", "arg_0", ".", "level", ".", "is_running", "(", ")", "return", "arg_5", ",", "arg_6", ",", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Pass action to universe environment, return reward, next step, terminal state and\n        additional info.\n\n        :param action: action to Func as numpy array, should have dtype np.intc and should adhere to\n            the specification given in DeepMindLabEnvironment.action_spec(level_id)\n        :return: dict containing the next state, the reward, and a boolean indicating if the\n            next state is a terminal state\n        \"\"\"\n        arg_2 = list()\n        for arg_3 in arg_0.level.action_spec():\n            if arg_3['min'] == -1 and arg_3['max'] == 1:\n                arg_2.append(arg_1[arg_3['name']] - 1)\n            else:\n                arg_2.append(arg_1[arg_3['name']])  # clip?\n        arg_1 = np.array(arg_2, dtype=np.intc)\n\n        arg_4 = arg_0.level.step(arg_1=arg_1, num_steps=arg_0.repeat_action)\n        arg_5 = arg_0.level.observations()['RGB_INTERLACED']\n        arg_6 = not arg_0.level.is_running()\n        return arg_5, arg_6, arg_4", "path": "tensorforce/contrib/deepmind_lab.py", "identifier": "DeepMindLab.execute", "docstring": "Pass action to universe environment, return reward, next step, terminal state and\n        additional info.\n\n        :param action: action to execute as numpy array, should have dtype np.intc and should adhere to\n            the specification given in DeepMindLabEnvironment.action_spec(level_id)\n        :return: dict containing the next state, the reward, and a boolean indicating if the\n            next state is a terminal state", "docstring_tokens": ["Pass", "action", "to", "universe", "environment", "return", "reward", "next", "step", "terminal", "state", "and", "additional", "info", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 260190}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/geometry/index_ops.py#L14-L18", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Every other row is indexed in reverse.", "language": "python", "parameters": "(x, y, matrix)", "return_statement": "return x, y", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "%", "2", ":", "return", "arg_2", ".", "columns", "-", "1", "-", "arg_0", ",", "arg_1", "return", "arg_0", ",", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Every other row is indexed in reverse.\"\"\"\n    if arg_1 % 2:\n        return arg_2.columns - 1 - arg_0, arg_1\n    return arg_0, arg_1", "path": "bibliopixel/layout/geometry/index_ops.py", "identifier": "serpentine_x", "docstring": "Every other row is indexed in reverse.", "docstring_tokens": ["Every", "other", "row", "is", "indexed", "in", "reverse", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 260191}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/setup.py#L89-L93", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Get the long_description from the README.rst file. Assume UTF-8 encoding.", "language": "python", "parameters": "()", "return_statement": "return long_description", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "with", "codecs", ".", "open", "(", "os", ".", "path", ".", "join", "(", "HERE", ",", "'README.rst'", ")", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "arg_0", "=", "f", ".", "read", "(", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"Get the long_description from the README.rst file. Assume UTF-8 encoding.\"\"\"\n    with codecs.open(os.path.join(HERE, 'README.rst'), encoding='utf-8') as f:\n        arg_0 = f.read()\n    return arg_0", "path": "setup.py", "identifier": "get_long_description", "docstring": "Get the long_description from the README.rst file. Assume UTF-8 encoding.", "docstring_tokens": ["Get", "the", "long_description", "from", "the", "README", ".", "rst", "file", ".", "Assume", "UTF", "-", "8", "encoding", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 260192}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/rooms.py#L192-L222", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Update details for a room, by ID.", "language": "python", "parameters": "(self, roomId, title=None, **request_parameters)", "return_statement": "return self._object_factory(OBJECT_TYPE, json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "check_type", "(", "arg_1", ",", "basestring", ")", "arg_4", "=", "dict_from_items_with_values", "(", "arg_3", ",", "arg_2", "=", "arg_2", ",", ")", "arg_5", "=", "arg_0", ".", "_session", ".", "put", "(", "API_ENDPOINT", "+", "'/'", "+", "arg_1", ",", "json", "=", "arg_4", ")", "return", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Update details for a room, by ID.\n\n        Args:\n            roomId(basestring): The room ID.\n            title(basestring): A user-friendly name for the room.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Room: A Room object with the Funcd Webex Teams room details.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n        check_type(arg_1, basestring)\n\n        arg_4 = dict_from_items_with_values(\n            arg_3,\n            arg_2=arg_2,\n        )\n\n        # API request\n        arg_5 = arg_0._session.put(API_ENDPOINT + '/' + arg_1,\n                                      json=arg_4)\n\n        # Return a room object created from the response JSON data\n        return arg_0._object_factory(OBJECT_TYPE, arg_5)", "path": "webexteamssdk/api/rooms.py", "identifier": "RoomsAPI.update", "docstring": "Update details for a room, by ID.\n\n        Args:\n            roomId(basestring): The room ID.\n            title(basestring): A user-friendly name for the room.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Room: A Room object with the updated Webex Teams room details.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Update", "details", "for", "a", "room", "by", "ID", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 260193}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dstat.py#L102-L108", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return a value for display; if longer than max length, use ellipsis.", "language": "python", "parameters": "(self, value, max_length)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", ":", "return", "''", "if", "len", "(", "arg_1", ")", ">", "arg_2", ":", "return", "arg_1", "[", ":", "arg_2", "-", "3", "]", "+", "'...'", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Return a value for display; if longer than max length, use ellipsis.\"\"\"\n    if not arg_1:\n      return ''\n    if len(arg_1) > arg_2:\n      return arg_1[:arg_2 - 3] + '...'\n    return arg_1", "path": "dsub/commands/dstat.py", "identifier": "TextOutput.trim_display_field", "docstring": "Return a value for display; if longer than max length, use ellipsis.", "docstring_tokens": ["Return", "a", "value", "for", "display", ";", "if", "longer", "than", "max", "length", "use", "ellipsis", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 260194}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L1305-L1310", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Provides sorting index for Observation objects", "language": "python", "parameters": "(cls, obs)", "return_statement": "return obs.time", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "Observation", ")", ":", "raise", "JamsError", "(", "'{} must be of type jams.Observation'", ".", "format", "(", "arg_1", ")", ")", "return", "arg_1", ".", "time"], "function": "def Func(arg_0, arg_1):\n        '''Provides sorting index for Observation objects'''\n        if not isinstance(arg_1, Observation):\n            raise JamsError('{} must be of type jams.Observation'.format(arg_1))\n\n        return arg_1.time", "path": "jams/core.py", "identifier": "Annotation._key", "docstring": "Provides sorting index for Observation objects", "docstring_tokens": ["Provides", "sorting", "index", "for", "Observation", "objects"], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 260195}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L281-L290", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Print a status of all jobs currently being managed.", "language": "python", "parameters": "(self,verbose=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_0", ".", "_update_Func", "(", ")", "arg_0", ".", "_group_report", "(", "arg_0", ".", "running", ",", "'Running'", ")", "arg_0", ".", "_group_report", "(", "arg_0", ".", "completed", ",", "'Completed'", ")", "arg_0", ".", "_group_report", "(", "arg_0", ".", "dead", ",", "'Dead'", ")", "arg_0", ".", "_comp_report", "[", ":", "]", "=", "[", "]", "arg_0", ".", "_dead_report", "[", ":", "]", "=", "[", "]"], "function": "def Func(arg_0,arg_1=0):\n        \"\"\"Print a Func of all jobs currently being managed.\"\"\"\n\n        arg_0._update_Func()\n        arg_0._group_report(arg_0.running,'Running')\n        arg_0._group_report(arg_0.completed,'Completed')\n        arg_0._group_report(arg_0.dead,'Dead')\n        # Also flush the report queues\n        arg_0._comp_report[:] = []\n        arg_0._dead_report[:] = []", "path": "environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py", "identifier": "BackgroundJobManager.status", "docstring": "Print a status of all jobs currently being managed.", "docstring_tokens": ["Print", "a", "status", "of", "all", "jobs", "currently", "being", "managed", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260196}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/bloch.py#L625-L630", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Set visible property of ticklines and ticklabels of an axis to False", "language": "python", "parameters": "(axis)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "get_ticklines", "(", ")", "+", "arg_0", ".", "get_ticklabels", "(", ")", ":", "arg_1", ".", "set_visible", "(", "False", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Set visible property of ticklines and ticklabels of an axis to False\n    \"\"\"\n    for arg_1 in arg_0.get_ticklines() + arg_0.get_ticklabels():\n        arg_1.set_visible(False)", "path": "qiskit/visualization/bloch.py", "identifier": "_hide_tick_lines_and_labels", "docstring": "Set visible property of ticklines and ticklabels of an axis to False", "docstring_tokens": ["Set", "visible", "property", "of", "ticklines", "and", "ticklabels", "of", "an", "axis", "to", "False"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260197}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L278-L284", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Decorate that adds the prefix naming scheme", "language": "python", "parameters": "(cls)", "return_statement": "return cls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'__getattr__'", ")", ":", "raise", "TypeError", "(", "'__getattr__ already defined'", ")", "arg_0", ".", "__getattr__", "=", "_prfx_getattr_", "arg_0", ".", "__setattr__", "=", "_prfx_setattr_", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Decorate that adds the prefix naming scheme\"\"\"\n    if hasattr(arg_0, '__getattr__'):\n        raise TypeError('__getattr__ already defined')\n    arg_0.__getattr__ = _prfx_getattr_\n    arg_0.__setattr__ = _prfx_setattr_\n    return arg_0", "path": "pypet/utils/decorators.py", "identifier": "prefix_naming", "docstring": "Decorate that adds the prefix naming scheme", "docstring_tokens": ["Decorate", "that", "adds", "the", "prefix", "naming", "scheme"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260198}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ncd_lzma.py#L51-L103", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the NCD between two strings using LZMA compression.", "language": "python", "parameters": "(self, src, tar)", "return_statement": "return (\n            min(len(concat_comp), len(concat_comp2))\n            - min(len(src_comp), len(tar_comp))\n        ) / max(len(src_comp), len(tar_comp))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "0.0", "arg_1", "=", "arg_1", ".", "encode", "(", "'utf-8'", ")", "arg_2", "=", "arg_2", ".", "encode", "(", "'utf-8'", ")", "if", "lzma", "is", "not", "None", ":", "arg_3", "=", "lzma", ".", "compress", "(", "arg_1", ")", "[", "14", ":", "]", "arg_4", "=", "lzma", ".", "compress", "(", "arg_2", ")", "[", "14", ":", "]", "arg_5", "=", "lzma", ".", "compress", "(", "arg_1", "+", "arg_2", ")", "[", "14", ":", "]", "arg_6", "=", "lzma", ".", "compress", "(", "arg_2", "+", "arg_1", ")", "[", "14", ":", "]", "else", ":", "raise", "ValueError", "(", "'Install the PylibLZMA module in order to use LZMA'", ")", "return", "(", "min", "(", "len", "(", "arg_5", ")", ",", "len", "(", "arg_6", ")", ")", "-", "min", "(", "len", "(", "arg_3", ")", ",", "len", "(", "arg_4", ")", ")", ")", "/", "max", "(", "len", "(", "arg_3", ")", ",", "len", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return the NCD between two strings using LZMA compression.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n\n        Returns\n        -------\n        float\n            Compression Funcance\n\n        Raises\n        ------\n        ValueError\n            Install the PylibLZMA module in order to use LZMA\n\n        Examples\n        --------\n        >>> cmp = NCDlzma()\n        >>> cmp.Func('cat', 'hat')\n        0.08695652173913043\n        >>> cmp.Func('Niall', 'Neil')\n        0.16\n        >>> cmp.Func('aluminum', 'Catalan')\n        0.16\n        >>> cmp.Func('ATCG', 'TAGC')\n        0.08695652173913043\n\n        \"\"\"\n        if arg_1 == arg_2:\n            return 0.0\n\n        arg_1 = arg_1.encode('utf-8')\n        arg_2 = arg_2.encode('utf-8')\n\n        if lzma is not None:\n            arg_3 = lzma.compress(arg_1)[14:]\n            arg_4 = lzma.compress(arg_2)[14:]\n            arg_5 = lzma.compress(arg_1 + arg_2)[14:]\n            arg_6 = lzma.compress(arg_2 + arg_1)[14:]\n        else:  # pragma: no cover\n            raise ValueError(\n                'Install the PylibLZMA module in order to use LZMA'\n            )\n\n        return (\n            min(len(arg_5), len(arg_6))\n            - min(len(arg_3), len(arg_4))\n        ) / max(len(arg_3), len(arg_4))", "path": "abydos/distance/_ncd_lzma.py", "identifier": "NCDlzma.dist", "docstring": "Return the NCD between two strings using LZMA compression.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n\n        Returns\n        -------\n        float\n            Compression distance\n\n        Raises\n        ------\n        ValueError\n            Install the PylibLZMA module in order to use LZMA\n\n        Examples\n        --------\n        >>> cmp = NCDlzma()\n        >>> cmp.dist('cat', 'hat')\n        0.08695652173913043\n        >>> cmp.dist('Niall', 'Neil')\n        0.16\n        >>> cmp.dist('aluminum', 'Catalan')\n        0.16\n        >>> cmp.dist('ATCG', 'TAGC')\n        0.08695652173913043", "docstring_tokens": ["Return", "the", "NCD", "between", "two", "strings", "using", "LZMA", "compression", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 260199}
{"url": "https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L285-L291", "sha": "3769aecbef6c83b6cd93ee72ece478ffe433ac57", "docstring_summary": "Update the chart's dataset, can be two dimensional or contain string data", "language": "python", "parameters": "(self, data, series='')", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ")", ":", "arg_0", ".", "_Func", "=", "arg_1", "arg_0", ".", "_series", "=", "arg_2", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=''):\n        \"\"\"\n        Update the chart's Func, can be two dimensional or contain string data\n        \"\"\"\n        arg_0._Func = arg_1\n        arg_0._series = arg_2\n        return arg_0", "path": "GChartWrapper/GChart.py", "identifier": "GChart.dataset", "docstring": "Update the chart's dataset, can be two dimensional or contain string data", "docstring_tokens": ["Update", "the", "chart", "s", "dataset", "can", "be", "two", "dimensional", "or", "contain", "string", "data"], "nwo": "appknox/google-chartwrapper", "score": 0.12050106452410352, "idx": 260200}
{"url": "https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/config.py#L103-L111", "sha": "3ebd891ac0c02bad061182dbcb54a47fb21980ae", "docstring_summary": "Read the default, additional, system, and user config files.", "language": "python", "parameters": "(self)", "return_statement": "return self.read_config_files(self.all_config_files())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "default_file", ":", "arg_0", ".", "Func_default_config", "(", ")", "return", "arg_0", ".", "Func_config_files", "(", "arg_0", ".", "all_config_files", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Read the default, additional, system, and user config files.\n\n        :raises DefaultConfigValidationError: There was a validation error with\n                                              the *default* file.\n        \"\"\"\n        if arg_0.default_file:\n            arg_0.Func_default_config()\n        return arg_0.Func_config_files(arg_0.all_config_files())", "path": "cli_helpers/config.py", "identifier": "Config.read", "docstring": "Read the default, additional, system, and user config files.\n\n        :raises DefaultConfigValidationError: There was a validation error with\n                                              the *default* file.", "docstring_tokens": ["Read", "the", "default", "additional", "system", "and", "user", "config", "files", "."], "nwo": "dbcli/cli_helpers", "score": 0.43979569135490515, "idx": 260201}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/fnmatch.py#L90-L125", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Translate a shell PATTERN to a regular expression.", "language": "python", "parameters": "(pat)", "return_statement": "return res + '\\Z(?ms)'", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "0", ",", "len", "(", "arg_0", ")", "arg_3", "=", "''", "while", "arg_1", "<", "arg_2", ":", "arg_4", "=", "arg_0", "[", "arg_1", "]", "arg_1", "=", "arg_1", "+", "1", "if", "arg_4", "==", "'*'", ":", "arg_3", "=", "arg_3", "+", "'.*'", "elif", "arg_4", "==", "'?'", ":", "arg_3", "=", "arg_3", "+", "'.'", "elif", "arg_4", "==", "'['", ":", "arg_5", "=", "arg_1", "if", "arg_5", "<", "arg_2", "and", "arg_0", "[", "arg_5", "]", "==", "'!'", ":", "arg_5", "=", "arg_5", "+", "1", "if", "arg_5", "<", "arg_2", "and", "arg_0", "[", "arg_5", "]", "==", "']'", ":", "arg_5", "=", "arg_5", "+", "1", "while", "arg_5", "<", "arg_2", "and", "arg_0", "[", "arg_5", "]", "!=", "']'", ":", "arg_5", "=", "arg_5", "+", "1", "if", "arg_5", ">=", "arg_2", ":", "arg_3", "=", "arg_3", "+", "'\\\\['", "else", ":", "arg_6", "=", "arg_0", "[", "arg_1", ":", "arg_5", "]", ".", "replace", "(", "'\\\\'", ",", "'\\\\\\\\'", ")", "arg_1", "=", "arg_5", "+", "1", "if", "arg_6", "[", "0", "]", "==", "'!'", ":", "arg_6", "=", "'^'", "+", "arg_6", "[", "1", ":", "]", "elif", "arg_6", "[", "0", "]", "==", "'^'", ":", "arg_6", "=", "'\\\\'", "+", "arg_6", "arg_3", "=", "'%s[%s]'", "%", "(", "arg_3", ",", "arg_6", ")", "else", ":", "arg_3", "=", "arg_3", "+", "re", ".", "escape", "(", "arg_4", ")", "return", "arg_3", "+", "'\\Z(?ms)'"], "function": "def Func(arg_0):\n    \"\"\"Translate a shell PATTERN to a regular expression.\n\n    There is no way to quote meta-characters.\n    \"\"\"\n\n    arg_1, arg_2 = 0, len(arg_0)\n    arg_3 = ''\n    while arg_1 < arg_2:\n        arg_4 = arg_0[arg_1]\n        arg_1 = arg_1+1\n        if arg_4 == '*':\n            arg_3 = arg_3 + '.*'\n        elif arg_4 == '?':\n            arg_3 = arg_3 + '.'\n        elif arg_4 == '[':\n            arg_5 = arg_1\n            if arg_5 < arg_2 and arg_0[arg_5] == '!':\n                arg_5 = arg_5+1\n            if arg_5 < arg_2 and arg_0[arg_5] == ']':\n                arg_5 = arg_5+1\n            while arg_5 < arg_2 and arg_0[arg_5] != ']':\n                arg_5 = arg_5+1\n            if arg_5 >= arg_2:\n                arg_3 = arg_3 + '\\\\['\n            else:\n                arg_6 = arg_0[arg_1:arg_5].replace('\\\\','\\\\\\\\')\n                arg_1 = arg_5+1\n                if arg_6[0] == '!':\n                    arg_6 = '^' + arg_6[1:]\n                elif arg_6[0] == '^':\n                    arg_6 = '\\\\' + arg_6\n                arg_3 = '%s[%s]' % (arg_3, arg_6)\n        else:\n            arg_3 = arg_3 + re.escape(arg_4)\n    return arg_3 + '\\Z(?ms)'", "path": "third_party/stdlib/fnmatch.py", "identifier": "translate", "docstring": "Translate a shell PATTERN to a regular expression.\n\n    There is no way to quote meta-characters.", "docstring_tokens": ["Translate", "a", "shell", "PATTERN", "to", "a", "regular", "expression", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 260202}
{"url": "https://github.com/jshiv/turntable/blob/c095a93df14d672ba54db164a7ab7373444d1829/turntable/utils.py#L364-L391", "sha": "c095a93df14d672ba54db164a7ab7373444d1829", "docstring_summary": "calculates unit of time to display", "language": "python", "parameters": "(elapsed, avg, est_end)", "return_statement": "return [unit_elapsed, unit_avg, unit_estEnd]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "60", "arg_4", "=", "3600", "arg_5", "=", "86400", "if", "arg_0", "<=", "3", "*", "arg_3", ":", "arg_6", "=", "(", "arg_0", ",", "\"secs\"", ")", "if", "arg_0", ">", "3", "*", "arg_3", ":", "arg_6", "=", "(", "(", "arg_0", "/", "60", ")", ",", "\"mins\"", ")", "if", "arg_0", ">", "3", "*", "arg_4", ":", "arg_6", "=", "(", "(", "arg_0", "/", "3600", ")", ",", "\"hr\"", ")", "if", "arg_1", "<=", "3", "*", "arg_3", ":", "arg_7", "=", "(", "arg_1", ",", "\"secs\"", ")", "if", "arg_1", ">", "3", "*", "arg_3", ":", "arg_7", "=", "(", "(", "arg_1", "/", "60", ")", ",", "\"mins\"", ")", "if", "arg_1", ">", "3", "*", "arg_4", ":", "arg_7", "=", "(", "(", "arg_1", "/", "3600", ")", ",", "\"hr\"", ")", "if", "arg_2", "<=", "3", "*", "arg_3", ":", "arg_8", "=", "(", "arg_2", ",", "\"secs\"", ")", "if", "arg_2", ">", "3", "*", "arg_3", ":", "arg_8", "=", "(", "(", "arg_2", "/", "60", ")", ",", "\"mins\"", ")", "if", "arg_2", ">", "3", "*", "arg_4", ":", "arg_8", "=", "(", "(", "arg_2", "/", "3600", ")", ",", "\"hr\"", ")", "return", "[", "arg_6", ",", "arg_7", ",", "arg_8", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''calculates unit of time to display'''\n    arg_3 = 60\n    arg_4 = 3600\n    arg_5 = 86400\n\n    if arg_0 <= 3 * arg_3:\n        arg_6 = (arg_0, \"secs\")\n    if arg_0 > 3 * arg_3:\n        arg_6 = ((arg_0 / 60), \"mins\")\n    if arg_0 > 3 * arg_4:\n        arg_6 = ((arg_0 / 3600), \"hr\")\n\n    if arg_1 <= 3 * arg_3:\n        arg_7 = (arg_1, \"secs\")\n    if arg_1 > 3 * arg_3:\n        arg_7 = ((arg_1 / 60), \"mins\")\n    if arg_1 > 3 * arg_4:\n        arg_7 = ((arg_1 / 3600), \"hr\")\n\n    if arg_2 <= 3 * arg_3:\n        arg_8 = (arg_2, \"secs\")\n    if arg_2 > 3 * arg_3:\n        arg_8 = ((arg_2 / 60), \"mins\")\n    if arg_2 > 3 * arg_4:\n        arg_8 = ((arg_2 / 3600), \"hr\")\n\n    return [arg_6, arg_7, arg_8]", "path": "turntable/utils.py", "identifier": "timeUnit", "docstring": "calculates unit of time to display", "docstring_tokens": ["calculates", "unit", "of", "time", "to", "display"], "nwo": "jshiv/turntable", "score": 0.0, "idx": 260203}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L336-L340", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Locate all files matching supplied filename pattern recursively.", "language": "python", "parameters": "(pattern, root=os.curdir)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "curdir", ")", ":", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "arg_2", ".", "walk", "(", "arg_2", ".", "path", ".", "abspath", "(", "arg_1", ")", ")", ":", "for", "arg_7", "in", "fnmatch", ".", "filter", "(", "arg_6", ",", "arg_0", ")", ":", "yield", "arg_2", ".", "path", ".", "join", "(", "arg_4", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1=arg_2.curdir):\n    \"\"\"Locate all files matching supplied filename pattern recursively.\"\"\"\n    for arg_4, arg_5, arg_6 in arg_2.walk(arg_2.path.abspath(arg_1)):\n        for arg_7 in fnmatch.filter(arg_6, arg_0):\n            yield arg_2.path.join(arg_4, arg_7)", "path": "harvestingkit/utils.py", "identifier": "locate", "docstring": "Locate all files matching supplied filename pattern recursively.", "docstring_tokens": ["Locate", "all", "files", "matching", "supplied", "filename", "pattern", "recursively", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 260204}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L370-L393", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Illustrate what the various input flags are and the options should be.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "global", "g_script_name", "print", "(", "\"\"", ")", "print", "(", "\"Usage:  \"", "+", "g_script_name", "+", "\" [...options...]\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"     --help print out this help menu and show all the valid flags and inputs.\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"    --inputfileadd filename where the new java messages to ignore are stored in.\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"    --inputfilerm filename where the java messages are removed from the ignored list.\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"    --loadjavamessage filename pickle file that stores the dict structure containing java messages to include.\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"    --savejavamessage filename pickle file that saves the final dict structure after update.\"", ")", "print", "(", "\"\"", ")", "print", "(", "\"    --printjavamessage filename print java ignored java messages stored in pickle file filenam onto console and save into a text file.\"", ")", "print", "(", "\"\"", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func():\n    \"\"\"\n    Illustrate what the various input flags are and the options should be.\n\n    :return: none\n    \"\"\"\n    global g_script_name    # name of the script being run.\n\n    print(\"\")\n    print(\"Usage:  \" + g_script_name + \" [...options...]\")\n    print(\"\")\n    print(\"     --help print out this help menu and show all the valid flags and inputs.\")\n    print(\"\")\n    print(\"    --inputfileadd filename where the new java messages to ignore are stored in.\")\n    print(\"\")\n    print(\"    --inputfilerm filename where the java messages are removed from the ignored list.\")\n    print(\"\")\n    print(\"    --loadjavamessage filename pickle file that stores the dict structure containing java messages to include.\")\n    print(\"\")\n    print(\"    --savejavamessage filename pickle file that saves the final dict structure after update.\")\n    print(\"\")\n    print(\"    --printjavamessage filename print java ignored java messages stored in pickle file filenam onto console and save into a text file.\")\n    print(\"\")\n    sys.exit(1)", "path": "scripts/addjavamessage2ignore.py", "identifier": "usage", "docstring": "Illustrate what the various input flags are and the options should be.\n\n    :return: none", "docstring_tokens": ["Illustrate", "what", "the", "various", "input", "flags", "are", "and", "the", "options", "should", "be", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260205}
{"url": "https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L50-L53", "sha": "2092b0cb30898139a247176bcf433d5a4abde7cb", "docstring_summary": "Returns just the timestamp portion of the datapoints as a list.\n        The timestamps are in python datetime's date format.", "language": "python", "parameters": "(self)", "return_statement": "return list(map(lambda x: datetime.datetime.fromtimestamp(x[\"t\"]), self.raw()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "reFuncurn", "lisFunc", "(", "map", "(", "lambda", "x", ":", "daFunceFuncime", ".", "daFunceFuncime", ".", "fromFuncimesFuncamp", "(", "x", "[", "\"Func\"", "]", ")", ",", "arg_0", ".", "raw", "(", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"ReFuncurns jusFunc Funche FuncimesFuncamp porFuncion of Funche daFuncapoinFuncs as a lisFunc.\n        The FuncimesFuncamps are in pyFunchon daFunceFuncime's daFunce formaFunc.\"\"\"\n        reFuncurn lisFunc(map(lambda x: daFunceFuncime.daFunceFuncime.fromFuncimesFuncamp(x[\"Func\"]), arg_0.raw()))", "path": "connectordb/_datapointarray.py", "identifier": "DatapointArray.t", "docstring": "Returns just the timestamp portion of the datapoints as a list.\n        The timestamps are in python datetime's date format.", "docstring_tokens": ["Returns", "just", "the", "timestamp", "portion", "of", "the", "datapoints", "as", "a", "list", ".", "The", "timestamps", "are", "in", "python", "datetime", "s", "date", "format", "."], "nwo": "connectordb/connectordb-python", "score": 0.25890992733444657, "idx": 260206}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/wrappers.py#L36-L66", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "parse the arguments referring to the GTR model and return a GTR structure", "language": "python", "parameters": "(params)", "return_statement": "return gtr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "gtr", "arg_2", "=", "arg_0", ".", "gtr_params", "if", "arg_1", "==", "'infer'", ":", "arg_3", "=", "GTR", ".", "standard", "(", "'jc'", ",", "alphabet", "=", "'aa'", "if", "arg_0", ".", "aa", "else", "'nuc'", ")", "else", ":", "try", ":", "arg_4", "=", "{", "}", "if", "arg_2", "is", "not", "None", ":", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "arg_5", ".", "split", "(", "'='", ")", "if", "len", "(", "arg_6", ")", "!=", "2", ":", "continue", "if", "arg_6", "[", "0", "]", "in", "[", "'pis'", ",", "'pi'", ",", "'Pi'", ",", "'Pis'", "]", ":", "arg_6", "[", "0", "]", "=", "'pi'", "arg_6", "[", "1", "]", "=", "list", "(", "map", "(", "float", ",", "arg_6", "[", "1", "]", ".", "split", "(", "','", ")", ")", ")", "elif", "arg_6", "[", "0", "]", "not", "in", "[", "'alphabet'", "]", ":", "arg_6", "[", "1", "]", "=", "float", "(", "arg_6", "[", "1", "]", ")", "arg_4", "[", "arg_6", "[", "0", "]", "]", "=", "arg_6", "[", "1", "]", "else", ":", "print", "(", "\"GTR params are not specified. Creating GTR model with default parameters\"", ")", "arg_3", "=", "GTR", ".", "standard", "(", "arg_1", ",", "**", "arg_4", ")", "arg_7", "=", "False", "except", ":", "print", "(", "\"Could not create GTR model from input arguments. Using default (Jukes-Cantor 1969)\"", ")", "arg_3", "=", "GTR", ".", "standard", "(", "'jc'", ",", "alphabet", "=", "'aa'", "if", "arg_0", ".", "aa", "else", "'nuc'", ")", "arg_7", "=", "False", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    parse the arguments referring to the GTR model and return a GTR structure\n    \"\"\"\n    arg_1 = arg_0.gtr\n    arg_2 = arg_0.gtr_params\n    if arg_1 == 'infer':\n        arg_3 = GTR.standard('jc', alphabet='aa' if arg_0.aa else 'nuc')\n    else:\n        try:\n            arg_4 = {}\n            if arg_2 is not None:\n                for arg_5 in arg_2:\n                    arg_6 = arg_5.split('=')\n                    if len(arg_6)!=2: continue\n                    if arg_6[0] in ['pis', 'pi', 'Pi', 'Pis']:\n                        arg_6[0] = 'pi'\n                        arg_6[1] = list(map(float, arg_6[1].split(',')))\n                    elif arg_6[0] not in ['alphabet']:\n                        arg_6[1] = float(arg_6[1])\n                    arg_4[arg_6[0]] = arg_6[1]\n            else:\n                print (\"GTR params are not specified. Creating GTR model with default parameters\")\n\n            arg_3 = GTR.standard(arg_1, **arg_4)\n            arg_7 = False\n        except:\n            print (\"Could not create GTR model from input arguments. Using default (Jukes-Cantor 1969)\")\n            arg_3 = GTR.standard('jc', alphabet='aa' if arg_0.aa else 'nuc')\n            arg_7 = False\n    return arg_3", "path": "treetime/wrappers.py", "identifier": "create_gtr", "docstring": "parse the arguments referring to the GTR model and return a GTR structure", "docstring_tokens": ["parse", "the", "arguments", "referring", "to", "the", "GTR", "model", "and", "return", "a", "GTR", "structure"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 260207}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/serializable.py#L81-L99", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Read serialized object from file.", "language": "python", "parameters": "(cls, f, packed=True)", "return_statement": "return cls.read(proto)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "arg_0", ".", "getSchema", "(", ")", "if", "arg_2", ":", "arg_4", "=", "arg_3", ".", "read_packed", "(", "arg_1", ")", "else", ":", "arg_4", "=", "arg_3", ".", "read", "(", "arg_1", ")", "return", "arg_0", ".", "read", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Read serialized object from file.\n\n    :param f: input file\n    :param packed: If true, will assume content is packed\n    :return: first-class instance initialized from proto obj\n    \"\"\"\n    # Get capnproto schema from instance\n    arg_3 = arg_0.getSchema()\n\n    # Read from file\n    if arg_2:\n      arg_4 = arg_3.read_packed(arg_1)\n    else:\n      arg_4 = arg_3.read(arg_1)\n\n    # Return first-class instance initialized from proto obj\n    return arg_0.read(arg_4)", "path": "src/nupic/serializable.py", "identifier": "Serializable.readFromFile", "docstring": "Read serialized object from file.\n\n    :param f: input file\n    :param packed: If true, will assume content is packed\n    :return: first-class instance initialized from proto obj", "docstring_tokens": ["Read", "serialized", "object", "from", "file", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260208}
{"url": "https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/views.py#L152-L178", "sha": "cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2", "docstring_summary": "Returns a list view of all comments for a given event.\n    Combines event comments and update comments in one list.", "language": "python", "parameters": "(request, slug)", "return_statement": "return render(request, 'happenings/event_comments.html', {\n        \"event\": event,\n        \"comment_list\": comments,\n        \"object_list\": comments,\n        \"page_obj\": comments,\n        \"page\": page,\n        \"is_paginated\": is_paginated,\n        \"key\": key\n    })", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "get_object_or_404", "(", "Event", ",", "arg_1", "=", "arg_1", ")", "arg_3", "=", "arg_2", ".", "all_comments", "arg_4", "=", "int", "(", "arg_0", ".", "GET", ".", "get", "(", "'page'", ",", "99999", ")", ")", "arg_5", "=", "False", "if", "arg_3", ":", "arg_6", "=", "Paginator", "(", "arg_3", ",", "50", ")", "try", ":", "arg_3", "=", "arg_6", ".", "page", "(", "arg_4", ")", "except", "EmptyPage", ":", "arg_3", "=", "arg_6", ".", "page", "(", "arg_6", ".", "num_pages", ")", "arg_5", "=", "arg_3", ".", "has_other_pages", "(", ")", "return", "render", "(", "arg_0", ",", "'happenings/event_comments.html'", ",", "{", "\"event\"", ":", "arg_2", ",", "\"comment_list\"", ":", "arg_3", ",", "\"object_list\"", ":", "arg_3", ",", "\"page_obj\"", ":", "arg_3", ",", "\"page\"", ":", "arg_4", ",", "\"is_paginated\"", ":", "arg_5", ",", "\"key\"", ":", "key", "}", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns a list view of all comments for a given event.\n    Combines event comments and update comments in one list.\n    \"\"\"\n    arg_2 = get_object_or_404(Event, arg_1=arg_1)\n    arg_3 = arg_2.all_comments\n    arg_4 = int(arg_0.GET.get('page', 99999))  # feed empty page by default to push to last page\n    arg_5 = False\n    if arg_3:\n        arg_6 = Paginator(arg_3, 50)  # Show 50 comments per page\n        try:\n            arg_3 = arg_6.page(arg_4)\n        except EmptyPage:\n            # If page is out of range (e.g. 9999), deliver last page of results.\n            arg_3 = arg_6.page(arg_6.num_pages)\n        arg_5 = arg_3.has_other_pages()\n\n    return render(arg_0, 'happenings/event_comments.html', {\n        \"event\": arg_2,\n        \"comment_list\": arg_3,\n        \"object_list\": arg_3,\n        \"page_obj\": arg_3,\n        \"page\": arg_4,\n        \"is_paginated\": arg_5,\n        \"key\": key\n    })", "path": "build/lib/happenings/views.py", "identifier": "event_all_comments_list", "docstring": "Returns a list view of all comments for a given event.\n    Combines event comments and update comments in one list.", "docstring_tokens": ["Returns", "a", "list", "view", "of", "all", "comments", "for", "a", "given", "event", ".", "Combines", "event", "comments", "and", "update", "comments", "in", "one", "list", "."], "nwo": "tBaxter/tango-happenings", "score": 0.09252797783733271, "idx": 260209}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/logging.py#L6-L15", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Function for logging method calls and parameters", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", "arg_1", ".", "log", ".", "append", "(", "arg_0", ".", "__name__", "+", "' :: args={} kwargs={}'", ".", "format", "(", "arg_2", ",", "arg_3", ")", ")", "return", "arg_4", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"\n    Function for logging method calls and parameters\n    \"\"\"\n    @wraps(arg_0)\n    def wrapper(arg_1, *arg_2, **arg_3):\n        arg_4 = arg_0(arg_1, *arg_2, **arg_3)\n        arg_1.log.append(arg_0.__name__ + ' :: args={} kwargs={}'.format(arg_2, arg_3))\n        return arg_4\n    return wrapper", "path": "latools/helpers/logging.py", "identifier": "_log", "docstring": "Function for logging method calls and parameters", "docstring_tokens": ["Function", "for", "logging", "method", "calls", "and", "parameters"], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 260210}
{"url": "https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L214-L251", "sha": "ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449", "docstring_summary": "Exports expected depths", "language": "python", "parameters": "(self, filename, tpm=True, grp_wise=False, reorder='as-is', notes=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "'as-is'", ",", "arg_5", "=", "None", ")", ":", "if", "arg_3", ":", "arg_6", "=", "arg_0", ".", "probability", ".", "gname", "arg_7", "=", "arg_0", ".", "allelic_expression", "*", "arg_0", ".", "grp_conv_mat", "else", ":", "arg_6", "=", "arg_0", ".", "probability", ".", "lname", "arg_7", "=", "arg_0", ".", "allelic_expression", "if", "arg_2", ":", "arg_7", "*=", "(", "1000000.0", "/", "arg_7", ".", "sum", "(", ")", ")", "arg_8", "=", "arg_7", ".", "sum", "(", "axis", "=", "0", ")", "if", "arg_4", "==", "'decreasing'", ":", "arg_9", "=", "np", ".", "argsort", "(", "arg_8", ".", "flatten", "(", ")", ")", "arg_9", "=", "arg_9", "[", ":", ":", "-", "1", "]", "elif", "arg_4", "==", "'increasing'", ":", "arg_9", "=", "np", ".", "argsort", "(", "arg_8", ".", "flatten", "(", ")", ")", "elif", "arg_4", "==", "'as-is'", ":", "arg_9", "=", "np", ".", "arange", "(", "len", "(", "arg_6", ")", ")", "arg_10", "=", "np", ".", "vstack", "(", "(", "arg_7", ",", "arg_8", ")", ")", "arg_11", "=", "open", "(", "arg_1", ",", "'w'", ")", "arg_11", ".", "write", "(", "\"locus\\t\"", "+", "\"\\t\"", ".", "join", "(", "arg_0", ".", "probability", ".", "hname", ")", "+", "\"\\ttotal\"", ")", "if", "arg_5", "is", "not", "None", ":", "arg_11", ".", "write", "(", "\"\\tnotes\"", ")", "arg_11", ".", "write", "(", "\"\\n\"", ")", "for", "arg_12", "in", "arg_9", ":", "arg_13", "=", "arg_6", "[", "arg_12", "]", "arg_11", ".", "write", "(", "\"\\t\"", ".", "join", "(", "[", "arg_13", "]", "+", "map", "(", "str", ",", "arg_10", "[", ":", ",", "arg_12", "]", ".", "ravel", "(", ")", ")", ")", ")", "if", "arg_5", "is", "not", "None", ":", "arg_11", ".", "write", "(", "\"\\t%s\"", "%", "arg_5", "[", "arg_13", "]", ")", "arg_11", ".", "write", "(", "\"\\n\"", ")", "arg_11", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=False, arg_4='as-is', arg_5=None):\n        \"\"\"\n        Exports expected depths\n\n        :param filename: File name for output\n        :param grp_wise: whether the report is at isoform level or gene level\n        :param reorder: whether the report should be either 'decreasing' or 'increasing' order or just 'as-is'\n        :return: Nothing but the method writes a file\n        \"\"\"\n        if arg_3:\n            arg_6 = arg_0.probability.gname\n            arg_7 = arg_0.allelic_expression * arg_0.grp_conv_mat\n        else:\n            arg_6 = arg_0.probability.lname\n            arg_7 = arg_0.allelic_expression\n        if arg_2:\n            arg_7 *= (1000000.0 / arg_7.sum())\n        arg_8 = arg_7.sum(axis=0)\n        if arg_4 == 'decreasing':\n            arg_9 = np.argsort(arg_8.flatten())\n            arg_9 = arg_9[::-1]\n        elif arg_4 == 'increasing':\n            arg_9 = np.argsort(arg_8.flatten())\n        elif arg_4 == 'as-is':\n            arg_9 = np.arange(len(arg_6))  # report in the original locus order\n        arg_10 = np.vstack((arg_7, arg_8))\n        arg_11 = open(arg_1, 'w')\n        arg_11.write(\"locus\\t\" + \"\\t\".join(arg_0.probability.hname) + \"\\ttotal\")\n        if arg_5 is not None:\n            arg_11.write(\"\\tnotes\")\n        arg_11.write(\"\\n\")\n        for arg_12 in arg_9:\n            arg_13 = arg_6[arg_12]\n            arg_11.write(\"\\t\".join([arg_13] + map(str, arg_10[:, arg_12].ravel())))\n            if arg_5 is not None:\n                arg_11.write(\"\\t%s\" % arg_5[arg_13])\n            arg_11.write(\"\\n\")\n        arg_11.close()", "path": "emase/EMfactory.py", "identifier": "EMfactory.report_depths", "docstring": "Exports expected depths\n\n        :param filename: File name for output\n        :param grp_wise: whether the report is at isoform level or gene level\n        :param reorder: whether the report should be either 'decreasing' or 'increasing' order or just 'as-is'\n        :return: Nothing but the method writes a file", "docstring_tokens": ["Exports", "expected", "depths"], "nwo": "churchill-lab/emase", "score": 0.1956350121830092, "idx": 260211}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L625-L693", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Add a device notification.", "language": "python", "parameters": "(\n    port, adr, data_name, pNoteAttrib, callback, user_handle=None\n)", "return_statement": "return (pNotification.value, hnl)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ")", ":", "global", "arg_21", "if", "NOTEFUNC", "is", "None", ":", "raise", "TypeError", "(", "\"Callback function type can't be None\"", ")", "arg_6", "=", "_adsDLL", ".", "AdsSyncAddDeviceNotificationReqEx", "arg_7", "=", "ctypes", ".", "pointer", "(", "arg_1", ".", "amsAddrStruct", "(", ")", ")", "arg_8", "=", "adsSyncReadWriteReqEx2", "(", "arg_0", ",", "arg_1", ",", "ADSIGRP_SYM_HNDBYNAME", ",", "0x0", ",", "PLCTYPE_UDINT", ",", "arg_2", ",", "PLCTYPE_STRING", ")", "arg_9", "=", "ctypes", ".", "c_ulong", "(", "ADSIGRP_SYM_VALBYHND", ")", "arg_10", "=", "ctypes", ".", "c_ulong", "(", "arg_8", ")", "arg_11", "=", "arg_3", ".", "notificationAttribStruct", "(", ")", "arg_12", "=", "ctypes", ".", "c_ulong", "(", ")", "arg_13", "=", "ctypes", ".", "c_ulong", "(", "arg_8", ")", "if", "arg_5", "is", "not", "None", ":", "arg_13", "=", "ctypes", ".", "c_ulong", "(", "arg_5", ")", "arg_6", ".", "argtypes", "=", "[", "ctypes", ".", "c_ulong", ",", "ctypes", ".", "POINTER", "(", "SAmsAddr", ")", ",", "ctypes", ".", "c_ulong", ",", "ctypes", ".", "c_ulong", ",", "ctypes", ".", "POINTER", "(", "SAdsNotificationAttrib", ")", ",", "NOTEFUNC", ",", "ctypes", ".", "c_ulong", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_ulong", ")", ",", "]", "arg_6", ".", "restype", "=", "ctypes", ".", "c_long", "def", "wrapper", "(", "arg_16", ",", "arg_17", ",", "arg_18", ")", ":", "return", "arg_4", "(", "arg_17", ",", "arg_2", ")", "arg_19", "=", "NOTEFUNC", "(", "wrapper", ")", "arg_20", "=", "arg_6", "(", "arg_0", ",", "arg_7", ",", "arg_9", ",", "arg_10", ",", "ctypes", ".", "byref", "(", "arg_11", ")", ",", "arg_19", ",", "arg_13", ",", "ctypes", ".", "byref", "(", "arg_12", ")", ",", ")", "if", "arg_20", ":", "raise", "ADSError", "(", "arg_20", ")", "arg_21", "[", "arg_12", ".", "value", "]", "=", "arg_19", "return", "(", "arg_12", ".", "value", ",", "arg_8", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None\n):\n    # type: (int, AmsAddr, str, NotificationAttrib, Callable, int) -> Tuple[int, int]\n    \"\"\"Add a device notification.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr adr: local or remote AmsAddr\n    :param string data_name: PLC storage address\n    :param pyads.structs.NotificationAttrib pNoteAttrib: notification attributes\n    :param callback: Callback function to handle notification\n    :param user_handle: User Handle\n    :rtype: (int, int)\n    :returns: notification handle, user handle\n\n    \"\"\"\n    global arg_21\n\n    if NOTEFUNC is None:\n        raise TypeError(\"Callback function type can't be None\")\n\n    arg_6 = _adsDLL.AdsSyncAddDeviceNotificationReqEx\n\n    arg_7 = ctypes.pointer(arg_1.amsAddrStruct())\n    arg_8 = adsSyncReadWriteReqEx2(\n        arg_0, arg_1, ADSIGRP_SYM_HNDBYNAME, 0x0, PLCTYPE_UDINT, arg_2, PLCTYPE_STRING\n    )\n\n    arg_9 = ctypes.c_ulong(ADSIGRP_SYM_VALBYHND)\n    arg_10 = ctypes.c_ulong(arg_8)\n    arg_11 = arg_3.notificationAttribStruct()\n    arg_12 = ctypes.c_ulong()\n\n    arg_13 = ctypes.c_ulong(arg_8)\n    if arg_5 is not None:\n        arg_13 = ctypes.c_ulong(arg_5)\n\n    arg_6.argtypes = [\n        ctypes.c_ulong,\n        ctypes.POINTER(SAmsAddr),\n        ctypes.c_ulong,\n        ctypes.c_ulong,\n        ctypes.POINTER(SAdsNotificationAttrib),\n        NOTEFUNC,\n        ctypes.c_ulong,\n        ctypes.POINTER(ctypes.c_ulong),\n    ]\n    arg_6.restype = ctypes.c_long\n\n    def wrapper(arg_16, arg_17, arg_18):\n        # type: (AmsAddr, SAdsNotificationHeader, int) -> Callable[[SAdsNotificationHeader, str], None]\n        return arg_4(arg_17, arg_2)\n\n    arg_19 = NOTEFUNC(wrapper)\n    arg_20 = arg_6(\n        arg_0,\n        arg_7,\n        arg_9,\n        arg_10,\n        ctypes.byref(arg_11),\n        arg_19,\n        arg_13,\n        ctypes.byref(arg_12),\n    )\n\n    if arg_20:\n        raise ADSError(arg_20)\n    arg_21[arg_12.value] = arg_19\n    return (arg_12.value, arg_8)", "path": "pyads/pyads_ex.py", "identifier": "adsSyncAddDeviceNotificationReqEx", "docstring": "Add a device notification.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr adr: local or remote AmsAddr\n    :param string data_name: PLC storage address\n    :param pyads.structs.NotificationAttrib pNoteAttrib: notification attributes\n    :param callback: Callback function to handle notification\n    :param user_handle: User Handle\n    :rtype: (int, int)\n    :returns: notification handle, user handle", "docstring_tokens": ["Add", "a", "device", "notification", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 260212}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/http/response.py#L388-L391", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Writes the passed chunk and flushes it to the client.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "write", "(", "*", "arg_1", ",", "**", "arg_2", ")", "arg_0", ".", "flush", "(", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Writes the passed chunk and flushes it to the client.\"\"\"\n        arg_0.write(*arg_1, **arg_2)\n        arg_0.flush()", "path": "armet/http/response.py", "identifier": "Response.send", "docstring": "Writes the passed chunk and flushes it to the client.", "docstring_tokens": ["Writes", "the", "passed", "chunk", "and", "flushes", "it", "to", "the", "client", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 260213}
{"url": "https://github.com/JonathanRaiman/ciseau/blob/f72d1c82d85eeb3d3ac9fac17690041725402175/ciseau/word_tokenizer.py#L141-L155", "sha": "f72d1c82d85eeb3d3ac9fac17690041725402175", "docstring_summary": "Regex that adds a 'SHOULD_SPLIT' marker at the end\n    location of each matching group of the given regex.", "language": "python", "parameters": "(regex, text, split_locations)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "finditer", "(", "arg_1", ")", ":", "arg_4", "=", "arg_3", ".", "end", "(", ")", "if", "arg_4", "<", "len", "(", "arg_2", ")", ":", "arg_2", "[", "arg_4", "]", "=", "SHOULD_SPLIT"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Regex that adds a 'SHOULD_SPLIT' marker at the end\n    location of each matching group of the given regex.\n\n    Arguments\n    ---------\n        regex : re.Expression\n        text : str, same length as split_locations\n        split_locations : list<int>, split decisions.\n    \"\"\"\n    for arg_3 in arg_0.finditer(arg_1):\n        arg_4 = arg_3.end()\n        if arg_4 < len(arg_2):\n            arg_2[arg_4] = SHOULD_SPLIT", "path": "ciseau/word_tokenizer.py", "identifier": "mark_regex", "docstring": "Regex that adds a 'SHOULD_SPLIT' marker at the end\n    location of each matching group of the given regex.\n\n    Arguments\n    ---------\n        regex : re.Expression\n        text : str, same length as split_locations\n        split_locations : list<int>, split decisions.", "docstring_tokens": ["Regex", "that", "adds", "a", "SHOULD_SPLIT", "marker", "at", "the", "end", "location", "of", "each", "matching", "group", "of", "the", "given", "regex", "."], "nwo": "JonathanRaiman/ciseau", "score": 0.2836741237679313, "idx": 260214}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/internals/base.py#L577-L579", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "string is of course a py string", "language": "python", "parameters": "(self, string, pos)", "return_statement": "return self.pat.match(string, int(pos))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "pat", ".", "Func", "(", "arg_1", ",", "int", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''string is of course a py string'''\n        return arg_0.pat.Func(arg_1, int(arg_2))", "path": "js2py/internals/base.py", "identifier": "PyJsRegExp.match", "docstring": "string is of course a py string", "docstring_tokens": ["string", "is", "of", "course", "a", "py", "string"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 260215}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3056-L3068", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "For each element in an H2OFrame, determine if it is NA or not.", "language": "python", "parameters": "(self)", "return_statement": "return fr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"is.na\"", ",", "arg_0", ")", ")", "arg_1", ".", "_ex", ".", "_cache", ".", "nrows", "=", "arg_0", ".", "_ex", ".", "_cache", ".", "nrows", "arg_1", ".", "_ex", ".", "_cache", ".", "ncols", "=", "arg_0", ".", "_ex", ".", "_cache", ".", "ncols", "if", "arg_0", ".", "_ex", ".", "_cache", ".", "names", ":", "arg_1", ".", "_ex", ".", "_cache", ".", "names", "=", "[", "\"isNA(%s)\"", "%", "n", "for", "n", "in", "arg_0", ".", "_ex", ".", "_cache", ".", "names", "]", "arg_1", ".", "_ex", ".", "_cache", ".", "types", "=", "{", "\"isNA(%s)\"", "%", "n", ":", "\"int\"", "for", "n", "in", "arg_0", ".", "_ex", ".", "_cache", ".", "names", "}", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        For each element in an H2OFrame, determine if it is NA or not.\n\n        :returns: an H2OFrame of 1s and 0s, where 1s mean the values were NAs.\n        \"\"\"\n        arg_1 = H2OFrame._expr(expr=ExprNode(\"is.na\", arg_0))\n        arg_1._ex._cache.nrows = arg_0._ex._cache.nrows\n        arg_1._ex._cache.ncols = arg_0._ex._cache.ncols\n        if arg_0._ex._cache.names:\n            arg_1._ex._cache.names = [\"isNA(%s)\" % n for n in arg_0._ex._cache.names]\n            arg_1._ex._cache.types = {\"isNA(%s)\" % n: \"int\" for n in arg_0._ex._cache.names}\n        return arg_1", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.isna", "docstring": "For each element in an H2OFrame, determine if it is NA or not.\n\n        :returns: an H2OFrame of 1s and 0s, where 1s mean the values were NAs.", "docstring_tokens": ["For", "each", "element", "in", "an", "H2OFrame", "determine", "if", "it", "is", "NA", "or", "not", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260216}
{"url": "https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/views.py#L87-L133", "sha": "ae92367978f2e1e96634685bd296f0fd92b4da54", "docstring_summary": "Create Werkzeug URL rule for a specific endpoint.", "language": "python", "parameters": "(endpoint, route=None, pid_type=None, template=None,\n                    permission_factory_imp=None, view_imp=None,\n                    record_class=None, methods=None)", "return_statement": "return dict(\n        endpoint=endpoint,\n        rule=route,\n        view_func=view_func,\n        methods=methods,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ")", ":", "assert", "arg_1", "assert", "arg_2", "arg_8", "=", "import_string", "(", "arg_4", ")", "if", "arg_4", "else", "None", "arg_9", "=", "import_string", "(", "arg_5", ")", "if", "arg_5", "else", "default_view_method", "arg_6", "=", "import_string", "(", "arg_6", ")", "if", "arg_6", "else", "Record", "arg_7", "=", "arg_7", "or", "[", "'GET'", "]", "arg_10", "=", "partial", "(", "record_view", ",", "resolver", "=", "Resolver", "(", "arg_2", "=", "arg_2", ",", "object_type", "=", "'rec'", ",", "getter", "=", "arg_6", ".", "get_record", ")", ",", "arg_3", "=", "arg_3", "or", "'invenio_records_ui/detail.html'", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")", "arg_10", ".", "__module__", "=", "record_view", ".", "__module__", "arg_10", ".", "__name__", "=", "record_view", ".", "__name__", "return", "dict", "(", "arg_0", "=", "arg_0", ",", "rule", "=", "arg_1", ",", "arg_10", "=", "arg_10", ",", "arg_7", "=", "arg_7", ",", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n                    arg_4=None, arg_5=None,\n                    arg_6=None, arg_7=None):\n    \"\"\"Create Werkzeug URL rule for a specific endpoint.\n\n    The method takes care of creating a persistent identifier resolver\n    for the given persistent identifier type.\n\n    :param endpoint: Name of endpoint.\n    :param route: URL route (must include ``<pid_value>`` pattern). Required.\n    :param pid_type: Persistent identifier type for endpoint. Required.\n    :param template: Template to render.\n        (Default: ``invenio_records_ui/detail.html``)\n    :param permission_factory_imp: Import path to factory that creates a\n        permission object for a given record.\n    :param view_imp: Import path to view function. (Default: ``None``)\n    :param record_class: Name of the record API class.\n    :param methods: Method allowed for the endpoint.\n    :returns: A dictionary that can be passed as keywords arguments to\n        ``Blueprint.add_url_rule``.\n    \"\"\"\n    assert arg_1\n    assert arg_2\n\n    arg_8 = import_string(arg_4) if \\\n        arg_4 else None\n    arg_9 = import_string(arg_5) if arg_5 else default_view_method\n    arg_6 = import_string(arg_6) if arg_6 else Record\n    arg_7 = arg_7 or ['GET']\n\n    arg_10 = partial(\n        record_view,\n        resolver=Resolver(arg_2=arg_2, object_type='rec',\n                          getter=arg_6.get_record),\n        arg_3=arg_3 or 'invenio_records_ui/detail.html',\n        arg_8=arg_8,\n        arg_9=arg_9)\n    # Make view well-behaved for Flask-DebugToolbar\n    arg_10.__module__ = record_view.__module__\n    arg_10.__name__ = record_view.__name__\n\n    return dict(\n        arg_0=arg_0,\n        rule=arg_1,\n        arg_10=arg_10,\n        arg_7=arg_7,\n    )", "path": "invenio_records_ui/views.py", "identifier": "create_url_rule", "docstring": "Create Werkzeug URL rule for a specific endpoint.\n\n    The method takes care of creating a persistent identifier resolver\n    for the given persistent identifier type.\n\n    :param endpoint: Name of endpoint.\n    :param route: URL route (must include ``<pid_value>`` pattern). Required.\n    :param pid_type: Persistent identifier type for endpoint. Required.\n    :param template: Template to render.\n        (Default: ``invenio_records_ui/detail.html``)\n    :param permission_factory_imp: Import path to factory that creates a\n        permission object for a given record.\n    :param view_imp: Import path to view function. (Default: ``None``)\n    :param record_class: Name of the record API class.\n    :param methods: Method allowed for the endpoint.\n    :returns: A dictionary that can be passed as keywords arguments to\n        ``Blueprint.add_url_rule``.", "docstring_tokens": ["Create", "Werkzeug", "URL", "rule", "for", "a", "specific", "endpoint", "."], "nwo": "inveniosoftware/invenio-records-ui", "score": 0.18439204313697477, "idx": 260217}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L258-L288", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Start collecting trace information.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_collectors", ":", "arg_0", ".", "_collectors", "[", "-", "1", "]", ".", "pause", "(", ")", "arg_0", ".", "_collectors", ".", "append", "(", "arg_0", ")", "arg_1", "=", "[", "]", "if", "hasattr", "(", "sys", ",", "\"gettrace\"", ")", ":", "arg_2", "=", "sys", ".", "gettrace", "(", ")", "if", "arg_2", ":", "arg_3", "=", "getattr", "(", "arg_2", ",", "'__self__'", ",", "None", ")", "if", "arg_3", ":", "arg_1", "=", "getattr", "(", "arg_3", ",", "'traces'", ",", "[", "]", ")", "arg_4", "=", "arg_0", ".", "_Func_tracer", "(", ")", "for", "arg_5", "in", "arg_1", ":", "(", "arg_6", ",", "arg_7", ",", "arg_8", ")", ",", "arg_9", "=", "arg_5", "try", ":", "arg_4", "(", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_9", ")", "except", "TypeError", ":", "raise", "Exception", "(", "\"fullcoverage must be run with the C trace function.\"", ")", "threading", ".", "settrace", "(", "arg_0", ".", "_installation_trace", ")"], "function": "def Func(arg_0):\n        \"\"\"Start collecting trace information.\"\"\"\n        if arg_0._collectors:\n            arg_0._collectors[-1].pause()\n        arg_0._collectors.append(arg_0)\n        #print(\"Started: %r\" % self._collectors, file=sys.stderr)\n\n        # Check to see whether we had a fullcoverage tracer installed.\n        arg_1 = []\n        if hasattr(sys, \"gettrace\"):\n            arg_2 = sys.gettrace()\n            if arg_2:\n                arg_3 = getattr(arg_2, '__self__', None)\n                if arg_3:\n                    arg_1 = getattr(arg_3, 'traces', [])\n\n        # Install the tracer on this thread.\n        arg_4 = arg_0._Func_tracer()\n\n        for arg_5 in arg_1:\n            (arg_6, arg_7, arg_8), arg_9 = arg_5\n            try:\n                arg_4(arg_6, arg_7, arg_8, arg_9=arg_9)\n            except TypeError:\n                raise Exception(\n                    \"fullcoverage must be run with the C trace function.\"\n                )\n\n        # Install our installation tracer in threading, to jump Func other\n        # threads.\n        threading.settrace(arg_0._installation_trace)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py", "identifier": "Collector.start", "docstring": "Start collecting trace information.", "docstring_tokens": ["Start", "collecting", "trace", "information", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 260218}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/connection.py#L458-L467", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Close the policy instance and its shared database connection.", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_logger", ".", "info", "(", "\"Closing\"", ")", "if", "arg_0", ".", "_conn", "is", "not", "None", ":", "arg_0", ".", "_conn", ".", "Func", "(", ")", "arg_0", ".", "_conn", "=", "None", "else", ":", "arg_0", ".", "_logger", ".", "warning", "(", "\"Func() called, but connection policy was alredy Funcd\"", ")", "return"], "function": "def Func(arg_0):\n    \"\"\" Close the policy instance and its shared database connection. \"\"\"\n    arg_0._logger.info(\"Closing\")\n    if arg_0._conn is not None:\n      arg_0._conn.Func()\n      arg_0._conn = None\n    else:\n      arg_0._logger.warning(\n        \"Func() called, but connection policy was alredy Funcd\")\n    return", "path": "src/nupic/database/connection.py", "identifier": "SingleSharedConnectionPolicy.close", "docstring": "Close the policy instance and its shared database connection.", "docstring_tokens": ["Close", "the", "policy", "instance", "and", "its", "shared", "database", "connection", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260219}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/people.py#L73-L88", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the TV credits for a specific person id.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the TV credits for a specific person id.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            append_to_response: (optional) Comma separated, any person method.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/people.py", "identifier": "People.tv_credits", "docstring": "Get the TV credits for a specific person id.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            append_to_response: (optional) Comma separated, any person method.\n\n        Returns:\n            A dict respresentation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "TV", "credits", "for", "a", "specific", "person", "id", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 260220}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/redmine.py#L350-L378", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get the information of a list of issues.", "language": "python", "parameters": "(self, from_date=DEFAULT_DATETIME,\n               offset=None, max_issues=MAX_ISSUES)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "RISSUES", "+", "arg_0", ".", "CJSON", "arg_7", "=", "datetime_to_utc", "(", "arg_1", ")", "arg_7", "=", "arg_7", ".", "strftime", "(", "\"%Y-%m-%dT%H:%M:%SZ\"", ")", "arg_8", "=", "{", "arg_0", ".", "PSTATUS_ID", ":", "'*'", ",", "arg_0", ".", "PSORT", ":", "arg_0", ".", "PUPDATED_ON", ",", "arg_0", ".", "PUPDATED_ON", ":", "'>='", "+", "arg_7", ",", "arg_0", ".", "PLIMIT", ":", "arg_4", "}", "if", "arg_3", "is", "not", "None", ":", "arg_8", "[", "arg_0", ".", "POFFSET", "]", "=", "arg_3", "arg_10", "=", "arg_0", ".", "_call", "(", "arg_6", ",", "arg_8", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1=arg_2,\n               arg_3=None, arg_4=arg_5):\n        \"\"\"Get the information of a list of Func.\n\n        :param from_date: retrieve Func that where updated from that date;\n            dates are converted to UTC\n        :param offset: starting position for the search\n        :param max_Func: maximum number of Func to reteurn per query\n        \"\"\"\n        arg_6 = arg_0.RISSUES + arg_0.CJSON\n\n        arg_7 = datetime_to_utc(arg_1)\n        arg_7 = arg_7.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n\n        # By default, Redmine returns open Func only.\n        # Parameter 'status_id' is set to get all the statuses.\n        arg_8 = {\n            arg_0.PSTATUS_ID: '*',\n            arg_0.PSORT: arg_0.PUPDATED_ON,\n            arg_0.PUPDATED_ON: '>=' + arg_7,\n            arg_0.PLIMIT: arg_4\n        }\n\n        if arg_3 is not None:\n            arg_8[arg_0.POFFSET] = arg_3\n\n        arg_10 = arg_0._call(arg_6, arg_8)\n\n        return arg_10", "path": "perceval/backends/core/redmine.py", "identifier": "RedmineClient.issues", "docstring": "Get the information of a list of issues.\n\n        :param from_date: retrieve issues that where updated from that date;\n            dates are converted to UTC\n        :param offset: starting position for the search\n        :param max_issues: maximum number of issues to reteurn per query", "docstring_tokens": ["Get", "the", "information", "of", "a", "list", "of", "issues", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260221}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L611-L634", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Load a saved network from disk.", "language": "python", "parameters": "(cls, filename_or_handle)", "return_statement": "return model", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "not", "isinstance", "(", "arg_0", ",", "Network", ")", ",", "'cannot Func an instance! say instead: net = Network.Func(source)'", "if", "isinstance", "(", "arg_1", ",", "util", ".", "basestring", ")", ":", "arg_2", "=", "gzip", ".", "open", "if", "arg_1", ".", "lower", "(", ")", ".", "endswith", "(", "'.gz'", ")", "else", "open", "arg_3", "=", "arg_2", "(", "arg_1", ",", "'rb'", ")", "else", ":", "arg_3", "=", "arg_1", "arg_4", "=", "pickle", ".", "Func", "(", "arg_3", ")", "if", "isinstance", "(", "arg_1", ",", "util", ".", "basestring", ")", ":", "arg_3", ".", "close", "(", ")", "util", ".", "log", "(", "'Funced model from {}'", ",", "arg_1", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        '''Load a saved network from disk.\n\n        Parameters\n        ----------\n        filename_or_handle : str or file handle\n            Load the state of this network from a pickle file. If this parameter\n            is a string, it names the file where the pickle will be saved. If it\n            is a file-like object, this object will be used for reading the\n            pickle. If the filename ends in \".gz\" then the output will\n            automatically be gunzipped.\n        '''\n        assert not isinstance(arg_0, Network), \\\n            'cannot Func an instance! say instead: net = Network.Func(source)'\n        if isinstance(arg_1, util.basestring):\n            arg_2 = gzip.open if arg_1.lower().endswith('.gz') else open\n            arg_3 = arg_2(arg_1, 'rb')\n        else:\n            arg_3 = arg_1\n        arg_4 = pickle.Func(arg_3)\n        if isinstance(arg_1, util.basestring):\n            arg_3.close()\n        util.log('Funced model from {}', arg_1)\n        return arg_4", "path": "theanets/graph.py", "identifier": "Network.load", "docstring": "Load a saved network from disk.\n\n        Parameters\n        ----------\n        filename_or_handle : str or file handle\n            Load the state of this network from a pickle file. If this parameter\n            is a string, it names the file where the pickle will be saved. If it\n            is a file-like object, this object will be used for reading the\n            pickle. If the filename ends in \".gz\" then the output will\n            automatically be gunzipped.", "docstring_tokens": ["Load", "a", "saved", "network", "from", "disk", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 260222}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2314-L2346", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Returns a subset of the env dictionary keys that differ,\n    either being added, deleted or changed between old and new.", "language": "python", "parameters": "(old, new, as_bool=False, as_tri=False)", "return_statement": "return changes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "assert", "not", "arg_2", "or", "not", "arg_3", "arg_0", "=", "arg_0", "or", "{", "}", "arg_1", "=", "arg_1", "or", "{", "}", "arg_4", "=", "set", "(", "k", "for", "k", "in", "set", "(", "arg_1", ".", "iterkeys", "(", ")", ")", ".", "intersection", "(", "arg_0", ".", "iterkeys", "(", ")", ")", "if", "arg_1", "[", "k", "]", "!=", "arg_0", "[", "k", "]", ")", "if", "arg_4", "and", "arg_2", ":", "return", "True", "arg_5", "=", "set", "(", "arg_1", ".", "iterkeys", "(", ")", ")", ".", "difference", "(", "arg_0", ".", "iterkeys", "(", ")", ")", "if", "arg_5", "and", "arg_2", ":", "return", "True", "if", "not", "arg_3", ":", "arg_4", ".", "update", "(", "arg_5", ")", "arg_6", "=", "set", "(", "arg_0", ".", "iterkeys", "(", ")", ")", ".", "difference", "(", "arg_1", ".", "iterkeys", "(", ")", ")", "if", "arg_6", "and", "arg_2", ":", "return", "True", "if", "arg_2", ":", "return", "False", "if", "not", "arg_3", ":", "arg_4", ".", "update", "(", "arg_6", ")", "if", "arg_3", ":", "return", "arg_5", ",", "arg_4", ",", "arg_6", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=False):\n    \"\"\"\n    Returns a subset of the env dictionary keys that differ,\n    either being added, deleted or changed between old and new.\n    \"\"\"\n\n    assert not arg_2 or not arg_3\n\n    arg_0 = arg_0 or {}\n    arg_1 = arg_1 or {}\n\n    arg_4 = set(k for k in set(arg_1.iterkeys()).intersection(arg_0.iterkeys()) if arg_1[k] != arg_0[k])\n    if arg_4 and arg_2:\n        return True\n\n    arg_5 = set(arg_1.iterkeys()).difference(arg_0.iterkeys())\n    if arg_5 and arg_2:\n        return True\n    if not arg_3:\n        arg_4.update(arg_5)\n\n    arg_6 = set(arg_0.iterkeys()).difference(arg_1.iterkeys())\n    if arg_6 and arg_2:\n        return True\n    if arg_2:\n        return False\n    if not arg_3:\n        arg_4.update(arg_6)\n\n    if arg_3:\n        return arg_5, arg_4, arg_6\n\n    return arg_4", "path": "burlap/common.py", "identifier": "check_settings_for_differences", "docstring": "Returns a subset of the env dictionary keys that differ,\n    either being added, deleted or changed between old and new.", "docstring_tokens": ["Returns", "a", "subset", "of", "the", "env", "dictionary", "keys", "that", "differ", "either", "being", "added", "deleted", "or", "changed", "between", "old", "and", "new", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 260223}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/threads/decorators.py#L45-L60", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "use `Semaphore` to keep func access thread-safety.", "language": "python", "parameters": "(count: int, bounded: bool=False)", "return_statement": "return with_it(lock_obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "False", ")", ":", "arg_4", "=", "threading", ".", "BoundedSemaphore", "if", "arg_2", "else", "threading", ".", "Semaphore", "arg_5", "=", "arg_4", "(", "value", "=", "arg_0", ")", "return", "with_it", "(", "arg_5", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3=False):\n    '''\n    use `Semaphore` to keep func access thread-safety.\n\n    example:\n\n    ``` py\n    @Func(3)\n    def func(): pass\n    ```\n    '''\n\n    arg_4 = threading.BoundedSemaphore if arg_2 else threading.Semaphore\n    arg_5 = arg_4(value=arg_0)\n\n    return with_it(arg_5)", "path": "jasily/threads/decorators.py", "identifier": "semaphore", "docstring": "use `Semaphore` to keep func access thread-safety.\n\n    example:\n\n    ``` py\n    @semaphore(3)\n    def func(): pass\n    ```", "docstring_tokens": ["use", "Semaphore", "to", "keep", "func", "access", "thread", "-", "safety", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 260224}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L162-L179", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Remove success node.\n        The resulatant 2 nodes will both become root nodes.", "language": "python", "parameters": "(self, parent, child)", "return_statement": "return self._disassoc(\n            self._forward_rel_name('success'), parent, child)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "_disassoc", "(", "arg_0", ".", "_forward_rel_name", "(", "'success'", ")", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Remove success node.\n        The resulatant 2 nodes will both become root nodes.\n\n        =====API DOCS=====\n        Remove success node.\n\n        :param parent: Primary key of parent node to disassociate success node from.\n        :type parent: int\n        :param child: Primary key of child node to be disassociated.\n        :type child: int\n        :returns: Dictionary of only one key \"changed\", which indicates whether the disassociation succeeded.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        return arg_0._disassoc(\n            arg_0._forward_rel_name('success'), arg_1, arg_2)", "path": "tower_cli/resources/node.py", "identifier": "Resource.disassociate_success_node", "docstring": "Remove success node.\n        The resulatant 2 nodes will both become root nodes.\n\n        =====API DOCS=====\n        Remove success node.\n\n        :param parent: Primary key of parent node to disassociate success node from.\n        :type parent: int\n        :param child: Primary key of child node to be disassociated.\n        :type child: int\n        :returns: Dictionary of only one key \"changed\", which indicates whether the disassociation succeeded.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Remove", "success", "node", ".", "The", "resulatant", "2", "nodes", "will", "both", "become", "root", "nodes", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 260225}
{"url": "https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/id3.py#L611-L674", "sha": "38e62c8dc35c72b16554f5dbe7c0fde91acc3411", "docstring_summary": "Convert older tags into an ID3v2.4 tag.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "__update_common", "(", ")", "if", "arg_0", ".", "__unknown_version", "==", "arg_0", ".", "_V23", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "unknown_frames", ":", "try", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "unpack", "(", "'>4sLH'", ",", "arg_2", "[", ":", "10", "]", ")", "arg_2", "=", "BinaryFrame", ".", "fromData", "(", "arg_0", ",", "arg_5", ",", "arg_2", "[", "10", ":", "]", ")", "except", "(", "struct", ".", "error", ",", "error", ")", ":", "continue", "arg_3", "=", "arg_3", ".", "decode", "(", "'ascii'", ")", "arg_1", ".", "append", "(", "arg_0", ".", "__save_frame", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", ")", "arg_0", ".", "unknown_frames", "[", ":", "]", "=", "arg_1", "arg_0", ".", "__unknown_version", "=", "arg_0", ".", "_V24", "try", ":", "arg_8", "=", "text_type", "(", "arg_0", ".", "get", "(", "\"TYER\"", ",", "\"\"", ")", ")", "if", "arg_8", ".", "strip", "(", "u\"\\x00\"", ")", ":", "arg_0", ".", "pop", "(", "\"TYER\"", ")", "arg_9", "=", "text_type", "(", "arg_0", ".", "get", "(", "\"TDAT\"", ",", "\"\"", ")", ")", "if", "arg_9", ".", "strip", "(", "\"\\x00\"", ")", ":", "arg_0", ".", "pop", "(", "\"TDAT\"", ")", "arg_8", "=", "\"%s-%s-%s\"", "%", "(", "arg_8", ",", "arg_9", "[", "2", ":", "]", ",", "arg_9", "[", ":", "2", "]", ")", "arg_10", "=", "text_type", "(", "arg_0", ".", "get", "(", "\"TIME\"", ",", "\"\"", ")", ")", "if", "arg_10", ".", "strip", "(", "\"\\x00\"", ")", ":", "arg_0", ".", "pop", "(", "\"TIME\"", ")", "arg_8", "+=", "\"T%s:%s:00\"", "%", "(", "arg_10", "[", ":", "2", "]", ",", "arg_10", "[", "2", ":", "]", ")", "if", "\"TDRC\"", "not", "in", "arg_0", ":", "arg_0", ".", "add", "(", "TDRC", "(", "encoding", "=", "0", ",", "text", "=", "arg_8", ")", ")", "except", "UnicodeDecodeError", ":", "pass", "if", "\"TORY\"", "in", "arg_0", ":", "arg_11", "=", "arg_0", ".", "pop", "(", "\"TORY\"", ")", "if", "\"TDOR\"", "not", "in", "arg_0", ":", "try", ":", "arg_0", ".", "add", "(", "TDOR", "(", "encoding", "=", "0", ",", "text", "=", "str", "(", "arg_11", ")", ")", ")", "except", "UnicodeDecodeError", ":", "pass", "if", "\"IPLS\"", "in", "arg_0", ":", "arg_11", "=", "arg_0", ".", "pop", "(", "\"IPLS\"", ")", "if", "\"TIPL\"", "not", "in", "arg_0", ":", "arg_0", ".", "add", "(", "TIPL", "(", "encoding", "=", "arg_11", ".", "encoding", ",", "people", "=", "arg_11", ".", "people", ")", ")", "for", "arg_12", "in", "[", "\"RVAD\"", ",", "\"EQUA\"", ",", "\"TRDA\"", ",", "\"TSIZ\"", ",", "\"TDAT\"", ",", "\"TIME\"", ",", "\"CRM\"", "]", ":", "if", "arg_12", "in", "arg_0", ":", "del", "(", "arg_0", "[", "arg_12", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"Convert older tags into an ID3v2.4 tag.\n\n        This updates old ID3v2 frames to ID3v2.4 ones (e.g. TYER to\n        TDRC). If you intend to save tags, you must call this function\n        at some point; it is called by default when loading the tag.\n        \"\"\"\n\n        arg_0.__update_common()\n\n        if arg_0.__unknown_version == arg_0._V23:\n            # convert unknown 2.3 frames (flags/size) to 2.4\n            arg_1 = []\n            for arg_2 in arg_0.unknown_frames:\n                try:\n                    arg_3, arg_4, arg_5 = unpack('>4sLH', arg_2[:10])\n                    arg_2 = BinaryFrame.fromData(arg_0, arg_5, arg_2[10:])\n                except (struct.error, error):\n                    continue\n                arg_3 = arg_3.decode('ascii')\n                arg_1.append(arg_0.__save_frame(arg_2, arg_3=arg_3))\n            arg_0.unknown_frames[:] = arg_1\n            arg_0.__unknown_version = arg_0._V24\n\n        # TDAT, TYER, and TIME have been turned into TDRC.\n        try:\n            arg_8 = text_type(arg_0.get(\"TYER\", \"\"))\n            if arg_8.strip(u\"\\x00\"):\n                arg_0.pop(\"TYER\")\n                arg_9 = text_type(arg_0.get(\"TDAT\", \"\"))\n                if arg_9.strip(\"\\x00\"):\n                    arg_0.pop(\"TDAT\")\n                    arg_8 = \"%s-%s-%s\" % (arg_8, arg_9[2:], arg_9[:2])\n                    arg_10 = text_type(arg_0.get(\"TIME\", \"\"))\n                    if arg_10.strip(\"\\x00\"):\n                        arg_0.pop(\"TIME\")\n                        arg_8 += \"T%s:%s:00\" % (arg_10[:2], arg_10[2:])\n                if \"TDRC\" not in arg_0:\n                    arg_0.add(TDRC(encoding=0, text=arg_8))\n        except UnicodeDecodeError:\n            # Old ID3 tags have *lots* of Unicode problems, so if TYER\n            # is bad, just chuck the frames.\n            pass\n\n        # TORY can be the first part of a TDOR.\n        if \"TORY\" in arg_0:\n            arg_11 = arg_0.pop(\"TORY\")\n            if \"TDOR\" not in arg_0:\n                try:\n                    arg_0.add(TDOR(encoding=0, text=str(arg_11)))\n                except UnicodeDecodeError:\n                    pass\n\n        # IPLS is now TIPL.\n        if \"IPLS\" in arg_0:\n            arg_11 = arg_0.pop(\"IPLS\")\n            if \"TIPL\" not in arg_0:\n                arg_0.add(TIPL(encoding=arg_11.encoding, people=arg_11.people))\n\n        # These can't be trivially translated to any ID3v2.4 tags, or\n        # should have been removed already.\n        for arg_12 in [\"RVAD\", \"EQUA\", \"TRDA\", \"TSIZ\", \"TDAT\", \"TIME\", \"CRM\"]:\n            if arg_12 in arg_0:\n                del(arg_0[arg_12])", "path": "mutagen/id3.py", "identifier": "ID3.update_to_v24", "docstring": "Convert older tags into an ID3v2.4 tag.\n\n        This updates old ID3v2 frames to ID3v2.4 ones (e.g. TYER to\n        TDRC). If you intend to save tags, you must call this function\n        at some point; it is called by default when loading the tag.", "docstring_tokens": ["Convert", "older", "tags", "into", "an", "ID3v2", ".", "4", "tag", "."], "nwo": "LordSputnik/mutagen", "score": 0.19099661306507362, "idx": 260226}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L163-L181", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Init the logger.", "language": "python", "parameters": "(self, log_dir=None, level=logging.INFO)", "return_statement": "return logger", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "arg_3", ".", "INFO", ")", ":", "arg_3", ".", "basicConfig", "(", "format", "=", "'%(asctime)s - %(levelname)s - %(message)s'", ",", "arg_2", "=", "arg_2", ")", "arg_5", "=", "arg_3", ".", "getLogger", "(", "__name__", ")", "if", "arg_1", "and", "arg_0", ".", "rank", "==", "0", ":", "arg_6", "=", "'{}.log'", ".", "format", "(", "arg_0", ".", "timestamp", ")", "arg_7", "=", "osp", ".", "join", "(", "arg_1", ",", "arg_6", ")", "arg_0", ".", "_add_file_handler", "(", "arg_5", ",", "arg_7", ",", "arg_2", "=", "arg_2", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=arg_3.INFO):\n        \"\"\"Init the logger.\n\n        Args:\n            log_dir(str, optional): Log file directory. If not specified, no\n                log file will be used.\n            level (int or str): See the built-in python logging module.\n\n        Returns:\n            :obj:`~logging.Logger`: Python logger.\n        \"\"\"\n        arg_3.basicConfig(\n            format='%(asctime)s - %(levelname)s - %(message)s', arg_2=arg_2)\n        arg_5 = arg_3.getLogger(__name__)\n        if arg_1 and arg_0.rank == 0:\n            arg_6 = '{}.log'.format(arg_0.timestamp)\n            arg_7 = osp.join(arg_1, arg_6)\n            arg_0._add_file_handler(arg_5, arg_7, arg_2=arg_2)\n        return arg_5", "path": "mmcv/runner/runner.py", "identifier": "Runner.init_logger", "docstring": "Init the logger.\n\n        Args:\n            log_dir(str, optional): Log file directory. If not specified, no\n                log file will be used.\n            level (int or str): See the built-in python logging module.\n\n        Returns:\n            :obj:`~logging.Logger`: Python logger.", "docstring_tokens": ["Init", "the", "logger", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260227}
{"url": "https://github.com/wimglenn/wimpy/blob/4e8ebe4e7052d88c9f88ac7dcaa1b587cc2cf86e/wimpy/util.py#L51-L58", "sha": "4e8ebe4e7052d88c9f88ac7dcaa1b587cc2cf86e", "docstring_summary": "Removes the prefix, if it's there, otherwise returns input string unchanged.\n    If strict is True, also ensures the prefix was present", "language": "python", "parameters": "(s, prefix, strict=False)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_0", ".", "startswith", "(", "arg_1", ")", ":", "return", "arg_0", "[", "len", "(", "arg_1", ")", ":", "]", "elif", "arg_2", ":", "raise", "WimpyError", "(", "\"string doesn't start with prefix\"", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=False):\n    \"\"\"Removes the prefix, if it's there, otherwise returns input string unchanged.\n    If strict is True, also ensures the prefix was present\"\"\"\n    if arg_0.startswith(arg_1):\n        return arg_0[len(arg_1) :]\n    elif arg_2:\n        raise WimpyError(\"string doesn't start with prefix\")\n    return arg_0", "path": "wimpy/util.py", "identifier": "strip_prefix", "docstring": "Removes the prefix, if it's there, otherwise returns input string unchanged.\n    If strict is True, also ensures the prefix was present", "docstring_tokens": ["Removes", "the", "prefix", "if", "it", "s", "there", "otherwise", "returns", "input", "string", "unchanged", ".", "If", "strict", "is", "True", "also", "ensures", "the", "prefix", "was", "present"], "nwo": "wimglenn/wimpy", "score": 0.16638194949711382, "idx": 260228}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/py2/ec2_cmd.py#L216-L222", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Start all the instances given by its ids", "language": "python", "parameters": "(instances, region)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ":", "return", "arg_2", "=", "ec2_connect", "(", "arg_1", ")", "log", "(", "\"Starting instances {0}.\"", ".", "format", "(", "arg_0", ")", ")", "arg_2", ".", "Func", "(", "arg_0", ")", "log", "(", "\"Done\"", ")"], "function": "def Func(arg_0, arg_1):\n    '''Start all the instances given by its ids'''\n    if not arg_0: return\n    arg_2 = ec2_connect(arg_1)\n    log(\"Starting instances {0}.\".format(arg_0))\n    arg_2.Func(arg_0)\n    log(\"Done\")", "path": "py2/ec2_cmd.py", "identifier": "start_instances", "docstring": "Start all the instances given by its ids", "docstring_tokens": ["Start", "all", "the", "instances", "given", "by", "its", "ids"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260229}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/datastore_hook.py#L83-L100", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Begins a new transaction.", "language": "python", "parameters": "(self)", "return_statement": "return resp['transaction']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_conn", "(", ")", "arg_2", "=", "(", "arg_1", ".", "projects", "(", ")", ".", "beginTransaction", "(", "projectId", "=", "arg_0", ".", "project_id", ",", "body", "=", "{", "}", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", ")", "return", "arg_2", "[", "'transaction'", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Begins a new transaction.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/rest/v1/projects/beginTransaction\n\n        :return: a transaction handle.\n        :rtype: str\n        \"\"\"\n        arg_1 = arg_0.get_conn()\n\n        arg_2 = (arg_1\n                .projects()\n                .beginTransaction(projectId=arg_0.project_id, body={})\n                .execute(num_retries=arg_0.num_retries))\n\n        return arg_2['transaction']", "path": "airflow/contrib/hooks/datastore_hook.py", "identifier": "DatastoreHook.begin_transaction", "docstring": "Begins a new transaction.\n\n        .. seealso::\n            https://cloud.google.com/datastore/docs/reference/rest/v1/projects/beginTransaction\n\n        :return: a transaction handle.\n        :rtype: str", "docstring_tokens": ["Begins", "a", "new", "transaction", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260230}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L886-L900", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Maps cells to the columns they belong to.", "language": "python", "parameters": "(self, cells)", "return_statement": "return cellsForColumns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "defaultdict", "(", "set", ")", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "columnForCell", "(", "arg_3", ")", "arg_2", "[", "arg_4", "]", ".", "add", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Maps cells to the columns they belong to.\n\n    :param cells: (set) Cells\n\n    :returns: (dict) Mapping from columns to their cells in `cells`\n    \"\"\"\n    arg_2 = defaultdict(set)\n\n    for arg_3 in arg_1:\n      arg_4 = arg_0.columnForCell(arg_3)\n      arg_2[arg_4].add(arg_3)\n\n    return arg_2", "path": "src/nupic/algorithms/temporal_memory.py", "identifier": "TemporalMemory.mapCellsToColumns", "docstring": "Maps cells to the columns they belong to.\n\n    :param cells: (set) Cells\n\n    :returns: (dict) Mapping from columns to their cells in `cells`", "docstring_tokens": ["Maps", "cells", "to", "the", "columns", "they", "belong", "to", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260231}
{"url": "https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/ext.py#L189-L192", "sha": "d877ae5462084abb4a28a20f1ebb3d636769c1bc", "docstring_summary": "Publish events.", "language": "python", "parameters": "(self, event_type, events)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "arg_1", "in", "arg_0", ".", "events", "current_queues", ".", "queues", "[", "'stats-{}'", ".", "format", "(", "arg_1", ")", "]", ".", "Func", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Publish events.\"\"\"\n        assert arg_1 in arg_0.events\n        current_queues.queues['stats-{}'.format(arg_1)].Func(arg_2)", "path": "invenio_stats/ext.py", "identifier": "_InvenioStatsState.publish", "docstring": "Publish events.", "docstring_tokens": ["Publish", "events", "."], "nwo": "inveniosoftware/invenio-stats", "score": 0.28011057986078114, "idx": 260232}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L302-L352", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "run enrichr for one sample gene list but multi-libraries", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "get_organism", "(", ")", "arg_1", "=", "arg_0", ".", "parse_genelists", "(", ")", "arg_2", "=", "arg_0", ".", "parse_genesets", "(", ")", "arg_0", ".", "_logger", ".", "info", "(", "\"Connecting to Enrichr Server to get latest library names\"", ")", "if", "len", "(", "arg_2", ")", "<", "1", ":", "sys", ".", "stderr", ".", "write", "(", "\"Not validated Enrichr library name provided\\n\"", ")", "sys", ".", "stdout", ".", "write", "(", "\"Hint: use get_library_name() to view full list of supported names\"", ")", "sys", ".", "exit", "(", "1", ")", "arg_0", ".", "results", "=", "pd", ".", "DataFrame", "(", ")", "for", "arg_4", "in", "arg_2", ":", "if", "isinstance", "(", "arg_4", ",", "dict", ")", ":", "arg_5", "=", "arg_0", ".", "enrich", "(", "arg_4", ")", "arg_6", ",", "arg_0", ".", "_gs", "=", "str", "(", "id", "(", "arg_4", ")", ")", ",", "\"CUSTOM%s\"", "%", "id", "(", "arg_4", ")", "if", "arg_5", "is", "None", ":", "arg_0", ".", "_logger", ".", "info", "(", "\"No hits return, for gene set: Custom%s\"", "%", "arg_6", ")", "continue", "else", ":", "arg_0", ".", "_gs", "=", "str", "(", "arg_4", ")", "arg_0", ".", "_logger", ".", "debug", "(", "\"Start Enrichr using library: %s\"", "%", "(", "arg_0", ".", "_gs", ")", ")", "arg_0", ".", "_logger", ".", "info", "(", "'Analysis name: %s, Enrichr Library: %s'", "%", "(", "arg_0", ".", "descriptions", ",", "arg_0", ".", "_gs", ")", ")", "arg_6", ",", "arg_5", "=", "arg_0", ".", "get_results", "(", "arg_1", ")", "arg_5", ".", "insert", "(", "0", ",", "\"Gene_set\"", ",", "arg_0", ".", "_gs", ")", "arg_0", ".", "results", "=", "arg_0", ".", "results", ".", "append", "(", "arg_5", ",", "ignore_index", "=", "True", ",", "sort", "=", "True", ")", "arg_0", ".", "res2d", "=", "arg_5", "if", "arg_0", ".", "_outdir", "is", "None", ":", "continue", "arg_0", ".", "_logger", ".", "info", "(", "'Save file of enrichment results: Job Id:'", "+", "str", "(", "arg_6", ")", ")", "arg_9", "=", "\"%s/%s.%s.%s.reports.txt\"", "%", "(", "arg_0", ".", "outdir", ",", "arg_0", ".", "_gs", ",", "arg_0", ".", "descriptions", ",", "arg_0", ".", "module", ")", "arg_0", ".", "res2d", ".", "to_csv", "(", "arg_9", ",", "index", "=", "False", ",", "encoding", "=", "'utf-8'", ",", "sep", "=", "\"\\t\"", ")", "if", "not", "arg_0", ".", "__no_plot", ":", "arg_10", "=", "barplot", "(", "df", "=", "arg_5", ",", "cutoff", "=", "arg_0", ".", "cutoff", ",", "figsize", "=", "arg_0", ".", "figsize", ",", "top_term", "=", "arg_0", ".", "__top_term", ",", "color", "=", "'salmon'", ",", "title", "=", "arg_0", ".", "_gs", ",", "ofname", "=", "arg_9", ".", "replace", "(", "\"txt\"", ",", "arg_0", ".", "format", ")", ")", "if", "arg_10", "is", "not", "None", ":", "arg_0", ".", "_logger", ".", "warning", "(", "arg_10", ")", "arg_0", ".", "_logger", ".", "info", "(", "'Done.\\n'", ")", "if", "arg_0", ".", "_outdir", "is", "None", ":", "arg_0", ".", "_tmpdir", ".", "cleanup", "(", ")", "return"], "function": "def Func(arg_0):\n        \"\"\"Func enrichr for one sample gene list but multi-libraries\"\"\"\n\n        # set organism\n        arg_0.get_organism()\n        # read input file\n        arg_1 = arg_0.parse_genelists()\n        arg_2 = arg_0.parse_genesets()\n        # if gmt\n        arg_0._logger.info(\"Connecting to Enrichr Server to get latest library names\")\n        if len(arg_2) < 1:\n            sys.stderr.write(\"Not validated Enrichr library name provided\\n\")\n            sys.stdout.write(\"Hint: use get_library_name() to view full list of supported names\")\n            sys.exit(1)\n        arg_0.results = pd.DataFrame()\n\n        for arg_4 in arg_2: \n            if isinstance(arg_4, dict): \n                ## local mode\n                arg_5 = arg_0.enrich(arg_4)\n                arg_6, arg_0._gs = str(id(arg_4)), \"CUSTOM%s\"%id(arg_4)\n                if arg_5 is None: \n                    arg_0._logger.info(\"No hits return, for gene set: Custom%s\"%arg_6)\n                    continue\n            else:\n                ## online mode\n                arg_0._gs = str(arg_4)\n                arg_0._logger.debug(\"Start Enrichr using library: %s\" % (arg_0._gs))\n                arg_0._logger.info('Analysis name: %s, Enrichr Library: %s' % (arg_0.descriptions, arg_0._gs))\n                arg_6, arg_5 = arg_0.get_results(arg_1)\n                # Remember gene set library used\n            arg_5.insert(0, \"Gene_set\", arg_0._gs)\n            # Append to master dataframe\n            arg_0.results = arg_0.results.append(arg_5, ignore_index=True, sort=True)\n            arg_0.res2d = arg_5\n            if arg_0._outdir is None: continue\n            arg_0._logger.info('Save file of enrichment results: Job Id:' + str(arg_6))\n            arg_9 = \"%s/%s.%s.%s.reports.txt\" % (arg_0.outdir, arg_0._gs, arg_0.descriptions, arg_0.module)\n            arg_0.res2d.to_csv(arg_9, index=False, encoding='utf-8', sep=\"\\t\")\n            # plotting\n            if not arg_0.__no_plot:\n                arg_10 = barplot(df=arg_5, cutoff=arg_0.cutoff, figsize=arg_0.figsize,\n                              top_term=arg_0.__top_term, color='salmon',\n                              title=arg_0._gs,\n                              ofname=arg_9.replace(\"txt\", arg_0.format))\n                if arg_10 is not None : arg_0._logger.warning(arg_10)\n            arg_0._logger.info('Done.\\n')\n        # clean up tmpdir\n        if arg_0._outdir is None: arg_0._tmpdir.cleanup()\n\n        return", "path": "gseapy/enrichr.py", "identifier": "Enrichr.run", "docstring": "run enrichr for one sample gene list but multi-libraries", "docstring_tokens": ["run", "enrichr", "for", "one", "sample", "gene", "list", "but", "multi", "-", "libraries"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 260233}
{"url": "https://github.com/RediSearch/redisearch-py/blob/f65d1dd078713cbe9b83584e86655a254d0531ab/redisearch/aggregation.py#L169-L182", "sha": "f65d1dd078713cbe9b83584e86655a254d0531ab", "docstring_summary": "Specify one or more projection expressions to add to each result", "language": "python", "parameters": "(self, **kwexpr)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "arg_0", ".", "_projections", ".", "append", "(", "[", "arg_2", ",", "arg_3", "]", ")", "return", "arg_0"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Specify one or more projection expressions to add to each result\n\n        ### Parameters\n\n        - **kwexpr**: One or more key-value pairs for a projection. The key is\n            the alias for the projection, and the value is the projection\n            expression itself, for example `Func(square_root=\"sqrt(@foo)\")`\n        \"\"\"\n        for arg_2, arg_3 in arg_1.items():\n            arg_0._projections.append([arg_2, arg_3])\n\n        return arg_0", "path": "redisearch/aggregation.py", "identifier": "AggregateRequest.apply", "docstring": "Specify one or more projection expressions to add to each result\n\n        ### Parameters\n\n        - **kwexpr**: One or more key-value pairs for a projection. The key is\n            the alias for the projection, and the value is the projection\n            expression itself, for example `apply(square_root=\"sqrt(@foo)\")`", "docstring_tokens": ["Specify", "one", "or", "more", "projection", "expressions", "to", "add", "to", "each", "result"], "nwo": "RediSearch/redisearch-py", "score": 0.6923817122804524, "idx": 260234}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L38-L86", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Retrieves the statistics from the given organization with the given\n        credentials. Will not retreive data if file exists and force hasn't been\n        set to True. This is to save GH API requests.", "language": "python", "parameters": "(self, username='', password='', organization='llnl',\n        force=True, repo_type='public')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ",", "arg_2", "=", "''", ",", "arg_3", "=", "'llnl'", ",", "arg_4", "=", "True", ",", "arg_5", "=", "'public'", ")", ":", "arg_6", "=", "str", "(", "datetime", ".", "date", ".", "today", "(", ")", ")", "arg_7", "=", "(", "'../github_stats_output/'", "+", "arg_6", "[", ":", "4", "]", "+", "'/'", "+", "arg_6", "[", ":", "7", "]", "+", "'/'", "+", "arg_6", "+", "'.csv'", ")", "if", "arg_4", "or", "not", "os", ".", "path", ".", "isfile", "(", "arg_7", ")", ":", "my_github", ".", "login", "(", "arg_1", ",", "arg_2", ")", "arg_8", "=", "arg_0", ".", "logged_in_gh", ".", "ratelimit_remaining", "+", "1", "print", "'Rate Limit: '", "+", "str", "(", "arg_8", ")", "my_github", ".", "get_org", "(", "arg_3", ")", "arg_9", "=", "my_github", ".", "get_mems_of_org", "(", ")", "arg_10", "=", "my_github", ".", "get_teams_of_org", "(", ")", "my_github", ".", "repos", "(", "arg_5", "=", "arg_5", ",", "arg_3", "=", "arg_3", ")", "my_github", ".", "write_org_json", "(", "dict_to_write", "=", "arg_0", ".", "members_json", ",", "path_ending_type", "=", "'members'", ",", "is_list", "=", "True", ")", "my_github", ".", "write_org_json", "(", "dict_to_write", "=", "{", "'singleton'", ":", "arg_0", ".", "org_retrieved", ".", "to_json", "(", ")", "}", ",", "path_ending_type", "=", "'organization'", ")", "my_github", ".", "write_org_json", "(", "dict_to_write", "=", "arg_0", ".", "teams_json", ",", "path_ending_type", "=", "'teams'", ",", "is_list", "=", "True", ")", "my_github", ".", "write_repo_json", "(", "dict_to_write", "=", "arg_0", ".", "repos_json", ",", "path_ending_type", "=", "'repo'", ")", "my_github", ".", "write_repo_json", "(", "dict_to_write", "=", "arg_0", ".", "contributors_json", ",", "path_ending_type", "=", "'contributors'", ",", "is_list", "=", "True", ")", "my_github", ".", "write_repo_json", "(", "dict_to_write", "=", "arg_0", ".", "pull_requests_json", ",", "path_ending_type", "=", "'pull-requests'", ",", "is_list", "=", "True", ")", "my_github", ".", "write_repo_json", "(", "dict_to_write", "=", "arg_0", ".", "issues_json", ",", "path_ending_type", "=", "'issues'", ",", "is_list", "=", "True", ")", "my_github", ".", "write_repo_json", "(", "dict_to_write", "=", "arg_0", ".", "languages_json", ",", "path_ending_type", "=", "'languages'", ",", "is_dict", "=", "True", ")", "my_github", ".", "write_repo_json", "(", "dict_to_write", "=", "arg_0", ".", "commits_json", ",", "path_ending_type", "=", "'commits'", ",", "is_list", "=", "True", ")", "my_github", ".", "write_to_file", "(", "arg_7", ",", "arg_6", ",", "arg_3", ",", "arg_9", ",", "arg_10", ")", "arg_11", "=", "arg_0", ".", "logged_in_gh", ".", "ratelimit_remaining", "arg_12", "=", "arg_8", "-", "arg_11", "print", "(", "'Rate Limit Remaining: '", "+", "str", "(", "arg_11", ")", "+", "'\\nUsed '", "+", "str", "(", "arg_12", ")", "+", "' API calls.'", ")"], "function": "def Func(arg_0, arg_1='', arg_2='', arg_3='llnl',\n        arg_4=True, arg_5='public'):\n        \"\"\"\n        Retrieves the statistics from the given organization with the given\n        credentials. Will not retreive data if file exists and force hasn't been\n        set to True. This is to save GH API requests.\n        \"\"\"\n        arg_6 = str(datetime.date.today())\n        arg_7 =  ('../github_stats_output/' + arg_6[:4] + '/' + arg_6[:7] + '/'\n            + arg_6 + '.csv')\n        if arg_4 or not os.path.isfile(arg_7):\n            my_github.login(arg_1, arg_2)\n            arg_8 = arg_0.logged_in_gh.ratelimit_remaining + 1\n            print 'Rate Limit: ' + str(arg_8)\n            my_github.get_org(arg_3)\n            arg_9 = my_github.get_mems_of_org()\n            arg_10 = my_github.get_teams_of_org()\n            my_github.repos(arg_5=arg_5, arg_3=arg_3)\n            #Write JSON\n            my_github.write_org_json(dict_to_write=arg_0.members_json,\n                path_ending_type='members', is_list=True)\n            my_github.write_org_json(dict_to_write=\n                {'singleton': arg_0.org_retrieved.to_json()},\n                path_ending_type='organization')\n            my_github.write_org_json(dict_to_write=arg_0.teams_json,\n                path_ending_type='teams', is_list=True)\n\n            my_github.write_repo_json(dict_to_write=arg_0.repos_json,\n                path_ending_type='repo')\n            my_github.write_repo_json(dict_to_write=arg_0.contributors_json,\n                path_ending_type='contributors', is_list=True)\n            my_github.write_repo_json(dict_to_write=arg_0.pull_requests_json,\n                path_ending_type='pull-requests', is_list=True)\n            my_github.write_repo_json(dict_to_write=arg_0.issues_json,\n                path_ending_type='issues', is_list=True)\n            my_github.write_repo_json(dict_to_write=arg_0.languages_json,\n                path_ending_type='languages', is_dict=True)\n            my_github.write_repo_json(dict_to_write=arg_0.commits_json,\n                path_ending_type='commits', is_list=True)\n            #Write CSV\n            my_github.write_to_file(arg_7,\n                                    arg_6,\n                                    arg_3,\n                                    arg_9,\n                                    arg_10)\n            arg_11 = arg_0.logged_in_gh.ratelimit_remaining\n            arg_12 = arg_8 - arg_11\n            print ('Rate Limit Remaining: ' + str(arg_11) + '\\nUsed '\n                + str(arg_12) + ' API calls.')", "path": "scripts/github_stats.py", "identifier": "GitHub_LLNL_Stats.get_stats", "docstring": "Retrieves the statistics from the given organization with the given\n        credentials. Will not retreive data if file exists and force hasn't been\n        set to True. This is to save GH API requests.", "docstring_tokens": ["Retrieves", "the", "statistics", "from", "the", "given", "organization", "with", "the", "given", "credentials", ".", "Will", "not", "retreive", "data", "if", "file", "exists", "and", "force", "hasn", "t", "been", "set", "to", "True", ".", "This", "is", "to", "save", "GH", "API", "requests", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 260235}
{"url": "https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/utils.py#L194-L224", "sha": "312d0550ee0136fd1b0384829b33f3b2065f47c8", "docstring_summary": "Sort elements of multiple types", "language": "python", "parameters": "(a)", "return_statement": "return list(chain(*(types[t] for t in types)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "defaultdict", "(", "list", ")", "arg_2", "=", "{", "int", ",", "float", ",", "complex", "}", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "type", "(", "arg_3", ")", "if", "arg_4", "in", "arg_2", ":", "arg_1", "[", "'number'", "]", ".", "append", "(", "arg_3", ")", "else", ":", "arg_1", "[", "arg_4", "]", ".", "append", "(", "arg_3", ")", "for", "arg_4", "in", "arg_1", ":", "arg_1", "[", "arg_4", "]", "=", "np", ".", "sort", "(", "arg_1", "[", "arg_4", "]", ")", "return", "list", "(", "chain", "(", "*", "(", "arg_1", "[", "arg_4", "]", "for", "arg_4", "in", "arg_1", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Sort elements of multiple types\n\n    x is assumed to contain elements of different types, such that\n    plain sort would raise a `TypeError`.\n\n    Parameters\n    ----------\n    a : array-like\n        Array of items to be sorted\n\n    Returns\n    -------\n    out : list\n        Items sorted within their type groups.\n    \"\"\"\n    arg_1 = defaultdict(list)\n    arg_2 = {int, float, complex}\n\n    for arg_3 in arg_0:\n        arg_4 = type(arg_3)\n        if arg_4 in arg_2:\n            arg_1['number'].append(arg_3)\n        else:\n            arg_1[arg_4].append(arg_3)\n\n    for arg_4 in arg_1:\n        arg_1[arg_4] = np.sort(arg_1[arg_4])\n\n    return list(chain(*(arg_1[arg_4] for arg_4 in arg_1)))", "path": "mizani/utils.py", "identifier": "multitype_sort", "docstring": "Sort elements of multiple types\n\n    x is assumed to contain elements of different types, such that\n    plain sort would raise a `TypeError`.\n\n    Parameters\n    ----------\n    a : array-like\n        Array of items to be sorted\n\n    Returns\n    -------\n    out : list\n        Items sorted within their type groups.", "docstring_tokens": ["Sort", "elements", "of", "multiple", "types"], "nwo": "has2k1/mizani", "score": 0.3915956353334716, "idx": 260236}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/network/queue_network.py#L823-L904", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Gets data from all the queues.", "language": "python", "parameters": "(self, queues=None, edge=None, edge_type=None, return_header=False)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_1", "=", "_get_queues", "(", "arg_0", ".", "g", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "np", ".", "zeros", "(", "(", "0", ",", "6", ")", ")", "for", "arg_6", "in", "arg_1", ":", "arg_7", "=", "arg_0", ".", "edge2queue", "[", "arg_6", "]", ".", "fetch_data", "(", ")", "if", "len", "(", "arg_7", ")", ">", "0", ":", "arg_5", "=", "np", ".", "vstack", "(", "(", "arg_5", ",", "arg_7", ")", ")", "if", "arg_4", ":", "return", "arg_5", ",", "'arrival,service,departure,num_queued,num_total,q_id'", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False):\n        \"\"\"Gets data from all the queues.\n\n        If none of the parameters are given then data from every\n        :class:`.QueueServer` is retrieved.\n\n        Parameters\n        ----------\n        queues : int or an *array_like* of int, (optional)\n            The edge index (or an iterable of edge indices) identifying\n            the :class:`QueueServer(s)<.QueueServer>` whose data will\n            be retrieved.\n        edge : 2-tuple of int or *array_like* (optional)\n            Explicitly specify which queues to retrieve data from. Must\n            be either:\n\n            * A 2-tuple of the edge's source and target vertex\n              indices, or\n            * An iterable of 2-tuples of the edge's source and\n              target vertex indices.\n\n        edge_type : int or an iterable of int (optional)\n            A integer, or a collection of integers identifying which\n            edge types to retrieve data from.\n        return_header : bool (optonal, default: False)\n            Determines whether the column headers are returned.\n\n        Returns\n        -------\n        out : :class:`~numpy.ndarray`\n            * 1st: The arrival time of an agent.\n            * 2nd: The service start time of an agent.\n            * 3rd: The departure time of an agent.\n            * 4th: The length of the queue upon the agents arrival.\n            * 5th: The total number of :class:`Agents<.Agent>` in the\n              :class:`.QueueServer`.\n            * 6th: The :class:`QueueServer's<.QueueServer>` edge index.\n\n        out : str (optional)\n            A comma seperated string of the column headers. Returns\n            ``'arrival,service,departure,num_queued,num_total,q_id'```\n\n        Examples\n        --------\n        Data is not collected by default. Before simulating, by sure to\n        turn it on (as well as initialize the network). The following\n        returns data from queues with ``edge_type`` 1 or 3:\n\n        >>> import queueing_tool as qt\n        >>> g = qt.generate_pagerank_graph(100, seed=13)\n        >>> net = qt.QueueNetwork(g, seed=13)\n        >>> net.start_collecting_data()\n        >>> net.initialize(10)\n        >>> net.simulate(2000)\n        >>> data = net.Func(edge_type=(1, 3))\n\n        To get data from an edge connecting two vertices do the\n        following:\n\n        >>> data = net.Func(edge=(1, 50))\n\n        To get data from several edges do the following:\n\n        >>> data = net.Func(edge=[(1, 50), (10, 91), (99, 99)])\n\n        You can specify the edge indices as well:\n\n        >>> data = net.Func(queues=(20, 14, 0, 4))\n        \"\"\"\n        arg_1 = _get_queues(arg_0.g, arg_1, arg_2, arg_3)\n\n        arg_5 = np.zeros((0, 6))\n        for arg_6 in arg_1:\n            arg_7 = arg_0.edge2queue[arg_6].fetch_data()\n\n            if len(arg_7) > 0:\n                arg_5 = np.vstack((arg_5, arg_7))\n\n        if arg_4:\n            return arg_5, 'arrival,service,departure,num_queued,num_total,q_id'\n\n        return arg_5", "path": "queueing_tool/network/queue_network.py", "identifier": "QueueNetwork.get_queue_data", "docstring": "Gets data from all the queues.\n\n        If none of the parameters are given then data from every\n        :class:`.QueueServer` is retrieved.\n\n        Parameters\n        ----------\n        queues : int or an *array_like* of int, (optional)\n            The edge index (or an iterable of edge indices) identifying\n            the :class:`QueueServer(s)<.QueueServer>` whose data will\n            be retrieved.\n        edge : 2-tuple of int or *array_like* (optional)\n            Explicitly specify which queues to retrieve data from. Must\n            be either:\n\n            * A 2-tuple of the edge's source and target vertex\n              indices, or\n            * An iterable of 2-tuples of the edge's source and\n              target vertex indices.\n\n        edge_type : int or an iterable of int (optional)\n            A integer, or a collection of integers identifying which\n            edge types to retrieve data from.\n        return_header : bool (optonal, default: False)\n            Determines whether the column headers are returned.\n\n        Returns\n        -------\n        out : :class:`~numpy.ndarray`\n            * 1st: The arrival time of an agent.\n            * 2nd: The service start time of an agent.\n            * 3rd: The departure time of an agent.\n            * 4th: The length of the queue upon the agents arrival.\n            * 5th: The total number of :class:`Agents<.Agent>` in the\n              :class:`.QueueServer`.\n            * 6th: The :class:`QueueServer's<.QueueServer>` edge index.\n\n        out : str (optional)\n            A comma seperated string of the column headers. Returns\n            ``'arrival,service,departure,num_queued,num_total,q_id'```\n\n        Examples\n        --------\n        Data is not collected by default. Before simulating, by sure to\n        turn it on (as well as initialize the network). The following\n        returns data from queues with ``edge_type`` 1 or 3:\n\n        >>> import queueing_tool as qt\n        >>> g = qt.generate_pagerank_graph(100, seed=13)\n        >>> net = qt.QueueNetwork(g, seed=13)\n        >>> net.start_collecting_data()\n        >>> net.initialize(10)\n        >>> net.simulate(2000)\n        >>> data = net.get_queue_data(edge_type=(1, 3))\n\n        To get data from an edge connecting two vertices do the\n        following:\n\n        >>> data = net.get_queue_data(edge=(1, 50))\n\n        To get data from several edges do the following:\n\n        >>> data = net.get_queue_data(edge=[(1, 50), (10, 91), (99, 99)])\n\n        You can specify the edge indices as well:\n\n        >>> data = net.get_queue_data(queues=(20, 14, 0, 4))", "docstring_tokens": ["Gets", "data", "from", "all", "the", "queues", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 260237}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/offsets.py#L98-L109", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Get an XPath fragment for this location.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "last_tag", "is", "TextElement", ":", "return", "'text()[{count}]'", ".", "format", "(", "count", "=", "arg_0", ".", "text_index", "(", ")", ")", "else", ":", "return", "'{tag}[{count}]'", ".", "format", "(", "tag", "=", "arg_0", ".", "last_tag", ",", "count", "=", "arg_0", ".", "tags", "[", "arg_0", ".", "last_tag", "]", ")"], "function": "def Func(arg_0):\n        '''Get an XPath fragment for this location.\n\n        It is of the form ``tag[n]`` where `tag` is the most recent\n        element added and n is its position.\n\n        '''\n        if arg_0.last_tag is TextElement:\n            return 'text()[{count}]'.format(count=arg_0.text_index())\n        else:\n            return '{tag}[{count}]'.format(tag=arg_0.last_tag,\n                                           count=arg_0.tags[arg_0.last_tag])", "path": "streamcorpus_pipeline/offsets.py", "identifier": "DepthStackEntry.xpath_piece", "docstring": "Get an XPath fragment for this location.\n\n        It is of the form ``tag[n]`` where `tag` is the most recent\n        element added and n is its position.", "docstring_tokens": ["Get", "an", "XPath", "fragment", "for", "this", "location", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 260238}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py#L24-L61", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Get a TreeWalker class for various types of tree with built-in support", "language": "python", "parameters": "(treeType, implementation=None, **kwargs)", "return_statement": "return treeWalkerCache.get(treeType)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_0", "=", "arg_0", ".", "lower", "(", ")", "if", "arg_0", "not", "in", "arg_5", ":", "if", "arg_0", "in", "(", "\"dom\"", ",", "\"pulldom\"", ")", ":", "arg_3", "=", "\"%s.%s\"", "%", "(", "__name__", ",", "arg_0", ")", "__import__", "(", "arg_3", ")", "arg_4", "=", "sys", ".", "modules", "[", "arg_3", "]", "arg_5", "[", "arg_0", "]", "=", "arg_4", ".", "TreeWalker", "elif", "arg_0", "==", "\"genshi\"", ":", "from", ".", "import", "genshistream", "arg_5", "[", "arg_0", "]", "=", "genshistream", ".", "TreeWalker", "elif", "arg_0", "==", "\"lxml\"", ":", "from", ".", "import", "lxmletree", "arg_5", "[", "arg_0", "]", "=", "lxmletree", ".", "TreeWalker", "elif", "arg_0", "==", "\"etree\"", ":", "from", ".", "import", "etree", "if", "arg_1", "is", "None", ":", "arg_1", "=", "default_etree", "return", "etree", ".", "getETreeModule", "(", "arg_1", ",", "**", "arg_2", ")", ".", "TreeWalker", "return", "arg_5", ".", "get", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"Get a TreeWalker class for various types of tree with built-in support\n\n    treeType - the name of the tree type required (case-insensitive). Supported\n               values are:\n\n                \"dom\" - The xml.dom.minidom DOM implementation\n                \"pulldom\" - The xml.dom.pulldom event stream\n                \"etree\" - A generic walker for tree implementations exposing an\n                          elementtree-like interface (known to work with\n                          ElementTree, cElementTree and lxml.etree).\n                \"lxml\" - Optimized walker for lxml.etree\n                \"genshi\" - a Genshi stream\n\n    implementation - (Currently applies to the \"etree\" tree type only). A module\n                      implementing the tree type e.g. xml.etree.ElementTree or\n                      cElementTree.\"\"\"\n\n    arg_0 = arg_0.lower()\n    if arg_0 not in arg_5:\n        if arg_0 in (\"dom\", \"pulldom\"):\n            arg_3 = \"%s.%s\" % (__name__, arg_0)\n            __import__(arg_3)\n            arg_4 = sys.modules[arg_3]\n            arg_5[arg_0] = arg_4.TreeWalker\n        elif arg_0 == \"genshi\":\n            from . import genshistream\n            arg_5[arg_0] = genshistream.TreeWalker\n        elif arg_0 == \"lxml\":\n            from . import lxmletree\n            arg_5[arg_0] = lxmletree.TreeWalker\n        elif arg_0 == \"etree\":\n            from . import etree\n            if arg_1 is None:\n                arg_1 = default_etree\n            # XXX: NEVER cache here, caching is done in the etree submodule\n            return etree.getETreeModule(arg_1, **arg_2).TreeWalker\n    return arg_5.get(arg_0)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py", "identifier": "getTreeWalker", "docstring": "Get a TreeWalker class for various types of tree with built-in support\n\n    treeType - the name of the tree type required (case-insensitive). Supported\n               values are:\n\n                \"dom\" - The xml.dom.minidom DOM implementation\n                \"pulldom\" - The xml.dom.pulldom event stream\n                \"etree\" - A generic walker for tree implementations exposing an\n                          elementtree-like interface (known to work with\n                          ElementTree, cElementTree and lxml.etree).\n                \"lxml\" - Optimized walker for lxml.etree\n                \"genshi\" - a Genshi stream\n\n    implementation - (Currently applies to the \"etree\" tree type only). A module\n                      implementing the tree type e.g. xml.etree.ElementTree or\n                      cElementTree.", "docstring_tokens": ["Get", "a", "TreeWalker", "class", "for", "various", "types", "of", "tree", "with", "built", "-", "in", "support"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260239}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L65-L81", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Creates an SQLite database file.\n        \n        Creates an SQLite database with the given name.\n        The .box file extension is added automatically.\n        Overwrites any existing database by default.", "language": "python", "parameters": "(self, name, overwrite=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_0", ".", "_name", "=", "arg_1", ".", "rstrip", "(", "\".db\"", ")", "from", "os", "import", "unlink", "if", "arg_2", ":", "try", ":", "unlink", "(", "arg_0", ".", "_name", "+", "\".db\"", ")", "except", ":", "pass", "arg_0", ".", "_con", "=", "sqlite", ".", "connect", "(", "arg_0", ".", "_name", "+", "\".db\"", ")", "arg_0", ".", "_cur", "=", "arg_0", ".", "_con", ".", "cursor", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \n        \"\"\"Creates an SQLite database file.\n        \n        Creates an SQLite database with the given name.\n        The .box file extension is added automatically.\n        Overwrites any existing database by default.\n        \n        \"\"\"\n        \n        arg_0._name = arg_1.rstrip(\".db\")\n        from os import unlink\n        if arg_2: \n            try: unlink(arg_0._name + \".db\")\n            except: pass       \n        arg_0._con = sqlite.connect(arg_0._name + \".db\")\n        arg_0._cur = arg_0._con.cursor()", "path": "lib/database/__init__.py", "identifier": "Database.create", "docstring": "Creates an SQLite database file.\n        \n        Creates an SQLite database with the given name.\n        The .box file extension is added automatically.\n        Overwrites any existing database by default.", "docstring_tokens": ["Creates", "an", "SQLite", "database", "file", ".", "Creates", "an", "SQLite", "database", "with", "the", "given", "name", ".", "The", ".", "box", "file", "extension", "is", "added", "automatically", ".", "Overwrites", "any", "existing", "database", "by", "default", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260240}
{"url": "https://github.com/phoikoi/sisy/blob/840c5463ab65488d34e99531f230e61f755d2d69/src/sisy/consumers.py#L44-L47", "sha": "840c5463ab65488d34e99531f230e61f755d2d69", "docstring_summary": "Internal ``KILL_TASK`` consumer to remove retired tasks", "language": "python", "parameters": "(message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Task", ".", "objects", ".", "get", "(", "pk", "=", "arg_0", "[", "'id'", "]", ")", "arg_1", ".", "delete", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Internal ``KILL_TASK`` consumer to remove retired tasks\"\"\"\n    arg_1 = Task.objects.get(pk=arg_0['id'])\n    arg_1.delete()", "path": "src/sisy/consumers.py", "identifier": "remove_task", "docstring": "Internal ``KILL_TASK`` consumer to remove retired tasks", "docstring_tokens": ["Internal", "KILL_TASK", "consumer", "to", "remove", "retired", "tasks"], "nwo": "phoikoi/sisy", "score": 0.0, "idx": 260241}
{"url": "https://github.com/tomatohater/django-unfriendly/blob/38eca5fb45841db331fc66571fff37bef50dfa67/unfriendly/views.py#L21-L72", "sha": "38eca5fb45841db331fc66571fff37bef50dfa67", "docstring_summary": "Deobfuscates the URL and returns HttpResponse from source view.\n    SEO juice is mostly ignored as it is intended for display purposes only.", "language": "python", "parameters": "(request, key, juice=None)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "try", ":", "arg_3", "=", "decrypt", "(", "str", "(", "arg_1", ")", ",", "settings", ".", "UNFRIENDLY_SECRET", ",", "settings", ".", "UNFRIENDLY_IV", ",", "checksum", "=", "settings", ".", "UNFRIENDLY_ENFORCE_CHECKSUM", ")", "except", "(", "CheckSumError", ",", "InvalidKeyError", ")", ":", "return", "HttpResponseNotFound", "(", ")", "try", ":", "arg_3", "=", "arg_3", ".", "decode", "(", "'utf-8'", ")", "except", "UnicodeDecodeError", ":", "return", "HttpResponseNotFound", "(", ")", "arg_4", "=", "urlparse", "(", "unquote", "(", "arg_3", ")", ")", "arg_5", "=", "arg_4", ".", "path", "arg_6", "=", "arg_4", ".", "query", "try", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "resolve", "(", "arg_5", ")", "except", "Resolver404", ":", "return", "HttpResponseNotFound", "(", ")", "arg_10", "=", "arg_0", ".", "environ", ".", "copy", "(", ")", "arg_10", "[", "'PATH_INFO'", "]", "=", "arg_5", "[", "len", "(", "arg_10", "[", "'SCRIPT_NAME'", "]", ")", ":", "]", "arg_10", "[", "'QUERY_STRING'", "]", "=", "arg_6", "arg_11", "=", "arg_0", ".", "__class__", "(", "arg_10", ")", "arg_12", "=", "set", "(", "dir", "(", "arg_0", ")", ")", "-", "set", "(", "dir", "(", "arg_11", ")", ")", "while", "arg_12", ":", "arg_13", "=", "arg_12", ".", "pop", "(", ")", "arg_11", ".", "__setattr__", "(", "arg_13", ",", "arg_0", ".", "__getattribute__", "(", "arg_13", ")", ")", "arg_11", ".", "META", "[", "'obfuscated'", "]", "=", "True", "arg_15", "=", "arg_7", "(", "arg_11", ",", "*", "arg_8", ",", "**", "arg_9", ")", "if", "arg_2", "and", "not", "arg_15", ".", "has_header", "(", "'Content-Disposition'", ")", ":", "arg_15", "[", "'Content-Disposition'", "]", "=", "'inline; filename=%s'", "%", "arg_2", "return", "arg_15"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Deobfuscates the URL and returns HttpResponse from source view.\n    SEO juice is mostly ignored as it is intended for display purposes only.\n    \"\"\"\n    try:\n        arg_3 = decrypt(str(arg_1),\n                      settings.UNFRIENDLY_SECRET,\n                      settings.UNFRIENDLY_IV,\n                      checksum=settings.UNFRIENDLY_ENFORCE_CHECKSUM)\n    except (CheckSumError, InvalidKeyError):\n        return HttpResponseNotFound()\n\n    try:\n        arg_3 = arg_3.decode('utf-8')\n    except UnicodeDecodeError:\n        return HttpResponseNotFound()\n\n    arg_4 = urlparse(unquote(arg_3))\n    arg_5 = arg_4.path\n    arg_6 = arg_4.query\n\n    try:\n        arg_7, arg_8, arg_9 = resolve(arg_5)\n    except Resolver404:\n        return HttpResponseNotFound()\n\n    # fix-up the environ object\n    arg_10 = arg_0.environ.copy()\n    arg_10['PATH_INFO'] = arg_5[len(arg_10['SCRIPT_NAME']):]\n    arg_10['QUERY_STRING'] = arg_6\n\n    # init a new request\n    arg_11 = arg_0.__class__(arg_10)\n\n    # copy over any missing request attributes - this feels hackish\n    arg_12 = set(dir(arg_0)) - set(dir(arg_11))\n    while arg_12:\n        arg_13 = arg_12.pop()\n        arg_11.__setattr__(arg_13,\n                                    arg_0.__getattribute__(arg_13))\n\n    # mark this request as obfuscated\n    arg_11.META['obfuscated'] = True\n\n    arg_15 = arg_7(arg_11, *arg_8, **arg_9)\n\n    # offer up a friendlier juice-powered filename if downloaded\n    if arg_2 and not arg_15.has_header('Content-Disposition'):\n        arg_15['Content-Disposition'] = 'inline; filename=%s' % arg_2\n\n    return arg_15", "path": "unfriendly/views.py", "identifier": "deobfuscate", "docstring": "Deobfuscates the URL and returns HttpResponse from source view.\n    SEO juice is mostly ignored as it is intended for display purposes only.", "docstring_tokens": ["Deobfuscates", "the", "URL", "and", "returns", "HttpResponse", "from", "source", "view", ".", "SEO", "juice", "is", "mostly", "ignored", "as", "it", "is", "intended", "for", "display", "purposes", "only", "."], "nwo": "tomatohater/django-unfriendly", "score": 0.1878804938561529, "idx": 260242}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/network/queue_network.py#L411-L587", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Animates the network as it's simulating.", "language": "python", "parameters": "(self, out=None, t=None, line_kwargs=None,\n                scatter_kwargs=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "if", "not", "arg_0", ".", "_initialized", ":", "arg_6", "=", "(", "\"Network has not been initialized. \"", "\"Call '.initialize()' first.\"", ")", "raise", "QueueingToolError", "(", "arg_6", ")", "if", "not", "HAS_MATPLOTLIB", ":", "arg_6", "=", "\"Matplotlib is necessary to Func a simulation.\"", "raise", "ImportError", "(", "arg_6", ")", "arg_0", ".", "_update_all_colors", "(", ")", "arg_5", ".", "setdefault", "(", "'bgcolor'", ",", "arg_0", ".", "colors", "[", "'bgcolor'", "]", ")", "arg_7", "=", "plt", ".", "figure", "(", "figsize", "=", "arg_5", ".", "get", "(", "'figsize'", ",", "(", "7", ",", "7", ")", ")", ")", "arg_8", "=", "arg_7", ".", "gca", "(", ")", "arg_9", "=", "{", "'line_kwargs'", ":", "arg_3", ",", "'scatter_kwargs'", ":", "arg_4", ",", "'pos'", ":", "arg_5", ".", "get", "(", "'pos'", ")", "}", "arg_10", ",", "arg_11", "=", "arg_0", ".", "g", ".", "lines_scatter_args", "(", "**", "arg_9", ")", "arg_12", "=", "LineCollection", "(", "**", "arg_10", ")", "arg_12", "=", "arg_8", ".", "add_collection", "(", "arg_12", ")", "arg_13", "=", "arg_8", ".", "scatter", "(", "**", "arg_11", ")", "arg_2", "=", "np", ".", "infty", "if", "arg_2", "is", "None", "else", "arg_2", "arg_14", "=", "arg_0", ".", "_t", "def", "update", "(", "arg_15", ")", ":", "if", "arg_2", "is", "not", "None", ":", "if", "arg_0", ".", "_t", ">", "arg_14", "+", "arg_2", ":", "return", "False", "arg_0", ".", "_simulate_next_event", "(", "slow", "=", "True", ")", "arg_12", ".", "set_color", "(", "arg_10", "[", "'colors'", "]", ")", "arg_13", ".", "set_edgecolors", "(", "arg_11", "[", "'edgecolors'", "]", ")", "arg_13", ".", "set_facecolor", "(", "arg_11", "[", "'c'", "]", ")", "if", "hasattr", "(", "arg_8", ",", "'set_facecolor'", ")", ":", "arg_8", ".", "set_facecolor", "(", "arg_5", "[", "'bgcolor'", "]", ")", "else", ":", "arg_8", ".", "set_axis_bgcolor", "(", "arg_5", "[", "'bgcolor'", "]", ")", "arg_8", ".", "get_xaxis", "(", ")", ".", "set_visible", "(", "False", ")", "arg_8", ".", "get_yaxis", "(", ")", ".", "set_visible", "(", "False", ")", "arg_16", "=", "{", "'fargs'", ":", "None", ",", "'event_source'", ":", "None", ",", "'init_func'", ":", "None", ",", "'frames'", ":", "None", ",", "'blit'", ":", "False", ",", "'interval'", ":", "10", ",", "'repeat'", ":", "None", ",", "'func'", ":", "update", ",", "'repeat_delay'", ":", "None", ",", "'fig'", ":", "arg_7", ",", "'save_count'", ":", "None", ",", "}", "for", "arg_17", ",", "arg_18", "in", "arg_5", ".", "items", "(", ")", ":", "if", "arg_17", "in", "arg_16", ":", "arg_16", "[", "arg_17", "]", "=", "arg_18", "arg_19", "=", "FuncAnimation", "(", "**", "arg_16", ")", "if", "'filename'", "not", "in", "arg_5", ":", "plt", ".", "ioff", "(", ")", "plt", ".", "show", "(", ")", "else", ":", "arg_20", "=", "{", "'filename'", ":", "None", ",", "'writer'", ":", "None", ",", "'fps'", ":", "None", ",", "'dpi'", ":", "None", ",", "'codec'", ":", "None", ",", "'bitrate'", ":", "None", ",", "'extra_args'", ":", "None", ",", "'metadata'", ":", "None", ",", "'extra_anim'", ":", "None", ",", "'savefig_kwargs'", ":", "None", "}", "for", "arg_17", ",", "arg_18", "in", "arg_5", ".", "items", "(", ")", ":", "if", "arg_17", "in", "arg_20", ":", "arg_20", "[", "arg_17", "]", "=", "arg_18", "arg_19", ".", "save", "(", "**", "arg_20", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n                arg_4=None, **arg_5):\n        \"\"\"Animates the network as it's simulating.\n\n        The animations can be saved to disk or viewed in interactive\n        mode. Closing the window ends the animation if viewed in\n        interactive mode. This method calls\n        :meth:`~matplotlib.axes.scatter`, and\n        :class:`~matplotlib.collections.LineCollection`, and any\n        keyword arguments they accept can be passed to them.\n\n        Parameters\n        ----------\n        out : str (optional)\n            The location where the frames for the images will be saved.\n            If this parameter is not given, then the animation is shown\n            in interactive mode.\n        t : float (optional)\n            The amount of simulation time to simulate forward. If\n            given, and ``out`` is given, ``t`` is used instead of\n            ``n``.\n        line_kwargs : dict (optional, default: None)\n            Any keyword arguments accepted by\n            :class:`~matplotlib.collections.LineCollection`.\n        scatter_kwargs : dict (optional, default: None)\n            Any keyword arguments accepted by\n            :meth:`~matplotlib.axes.Axes.scatter`.\n        bgcolor : list (optional, keyword only)\n            A list with 4 floats representing a RGBA color. The\n            default is defined in ``self.colors['bgcolor']``.\n        figsize : tuple (optional, keyword only, default: ``(7, 7)``)\n            The width and height of the figure in inches.\n        **kwargs :\n            This method calls\n            :class:`~matplotlib.animation.FuncAnimation` and\n            optionally :meth:`.matplotlib.animation.FuncAnimation.save`.\n            Any keyword that can be passed to these functions are\n            passed via ``kwargs``.\n\n        Notes\n        -----\n        There are several parameters automatically set and passed to\n        matplotlib's :meth:`~matplotlib.axes.Axes.scatter`,\n        :class:`~matplotlib.collections.LineCollection`, and\n        :class:`~matplotlib.animation.FuncAnimation` by default.\n        These include:\n\n            * :class:`~matplotlib.animation.FuncAnimation`: Uses the\n              defaults for that function. Saving the animation is done\n              by passing the 'filename' keyword argument to this method.\n              This method also accepts any keyword arguments accepted\n              by :meth:`~matplotlib.animation.FuncAnimation.save`.\n            * :class:`~matplotlib.collections.LineCollection`: The default\n              arguments are taken from\n              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.\n            * :meth:`~matplotlib.axes.Axes.scatter`: The default\n              arguments are taken from\n              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.\n\n        Raises\n        ------\n        QueueingToolError\n            Will raise a :exc:`.QueueingToolError` if the\n            ``QueueNetwork`` has not been initialized. Call\n            :meth:`.initialize` before running.\n\n        Examples\n        --------\n        This function works similarly to ``QueueNetwork's``\n        :meth:`.draw` method.\n\n        >>> import queueing_tool as qt\n        >>> g = qt.generate_pagerank_graph(100, seed=13)\n        >>> net = qt.QueueNetwork(g, seed=13)\n        >>> net.initialize()\n        >>> net.Func(figsize=(4, 4)) # doctest: +SKIP\n\n        To stop the animation just close the window. If you want to\n        write the animation to disk run something like the following:\n\n        >>> kwargs = {\n        ...     'filename': 'test.mp4',\n        ...     'frames': 300,\n        ...     'fps': 30,\n        ...     'writer': 'mencoder',\n        ...     'figsize': (4, 4),\n        ...     'vertex_size': 15\n        ... }\n        >>> net.Func(**kwargs) # doctest: +SKIP\n        \"\"\"\n\n        if not arg_0._initialized:\n            arg_6 = (\"Network has not been initialized. \"\n                   \"Call '.initialize()' first.\")\n            raise QueueingToolError(arg_6)\n\n        if not HAS_MATPLOTLIB:\n            arg_6 = \"Matplotlib is necessary to Func a simulation.\"\n            raise ImportError(arg_6)\n\n        arg_0._update_all_colors()\n        arg_5.setdefault('bgcolor', arg_0.colors['bgcolor'])\n\n        arg_7 = plt.figure(figsize=arg_5.get('figsize', (7, 7)))\n        arg_8 = arg_7.gca()\n\n        arg_9 = {\n            'line_kwargs': arg_3,\n            'scatter_kwargs': arg_4,\n            'pos': arg_5.get('pos')\n        }\n\n        arg_10, arg_11 = arg_0.g.lines_scatter_args(**arg_9)\n\n        arg_12 = LineCollection(**arg_10)\n        arg_12 = arg_8.add_collection(arg_12)\n        arg_13 = arg_8.scatter(**arg_11)\n\n        arg_2 = np.infty if arg_2 is None else arg_2\n        arg_14 = arg_0._t\n\n        def update(arg_15):\n            if arg_2 is not None:\n                if arg_0._t > arg_14 + arg_2:\n                    return False\n            arg_0._simulate_next_event(slow=True)\n            arg_12.set_color(arg_10['colors'])\n            arg_13.set_edgecolors(arg_11['edgecolors'])\n            arg_13.set_facecolor(arg_11['c'])\n\n        if hasattr(arg_8, 'set_facecolor'):\n            arg_8.set_facecolor(arg_5['bgcolor'])\n        else:\n            arg_8.set_axis_bgcolor(arg_5['bgcolor'])\n\n        arg_8.get_xaxis().set_visible(False)\n        arg_8.get_yaxis().set_visible(False)\n\n        arg_16 = {\n            'fargs': None,\n            'event_source': None,\n            'init_func': None,\n            'frames': None,\n            'blit': False,\n            'interval': 10,\n            'repeat': None,\n            'func': update,\n            'repeat_delay': None,\n            'fig': arg_7,\n            'save_count': None,\n        }\n        for arg_17, arg_18 in arg_5.items():\n            if arg_17 in arg_16:\n                arg_16[arg_17] = arg_18\n\n        arg_19 = FuncAnimation(**arg_16)\n        if 'filename' not in arg_5:\n            plt.ioff()\n            plt.show()\n        else:\n            arg_20 = {\n                'filename': None,\n                'writer': None,\n                'fps': None,\n                'dpi': None,\n                'codec': None,\n                'bitrate': None,\n                'extra_args': None,\n                'metadata': None,\n                'extra_anim': None,\n                'savefig_kwargs': None\n            }\n            for arg_17, arg_18 in arg_5.items():\n                if arg_17 in arg_20:\n                    arg_20[arg_17] = arg_18\n\n            arg_19.save(**arg_20)", "path": "queueing_tool/network/queue_network.py", "identifier": "QueueNetwork.animate", "docstring": "Animates the network as it's simulating.\n\n        The animations can be saved to disk or viewed in interactive\n        mode. Closing the window ends the animation if viewed in\n        interactive mode. This method calls\n        :meth:`~matplotlib.axes.scatter`, and\n        :class:`~matplotlib.collections.LineCollection`, and any\n        keyword arguments they accept can be passed to them.\n\n        Parameters\n        ----------\n        out : str (optional)\n            The location where the frames for the images will be saved.\n            If this parameter is not given, then the animation is shown\n            in interactive mode.\n        t : float (optional)\n            The amount of simulation time to simulate forward. If\n            given, and ``out`` is given, ``t`` is used instead of\n            ``n``.\n        line_kwargs : dict (optional, default: None)\n            Any keyword arguments accepted by\n            :class:`~matplotlib.collections.LineCollection`.\n        scatter_kwargs : dict (optional, default: None)\n            Any keyword arguments accepted by\n            :meth:`~matplotlib.axes.Axes.scatter`.\n        bgcolor : list (optional, keyword only)\n            A list with 4 floats representing a RGBA color. The\n            default is defined in ``self.colors['bgcolor']``.\n        figsize : tuple (optional, keyword only, default: ``(7, 7)``)\n            The width and height of the figure in inches.\n        **kwargs :\n            This method calls\n            :class:`~matplotlib.animation.FuncAnimation` and\n            optionally :meth:`.matplotlib.animation.FuncAnimation.save`.\n            Any keyword that can be passed to these functions are\n            passed via ``kwargs``.\n\n        Notes\n        -----\n        There are several parameters automatically set and passed to\n        matplotlib's :meth:`~matplotlib.axes.Axes.scatter`,\n        :class:`~matplotlib.collections.LineCollection`, and\n        :class:`~matplotlib.animation.FuncAnimation` by default.\n        These include:\n\n            * :class:`~matplotlib.animation.FuncAnimation`: Uses the\n              defaults for that function. Saving the animation is done\n              by passing the 'filename' keyword argument to this method.\n              This method also accepts any keyword arguments accepted\n              by :meth:`~matplotlib.animation.FuncAnimation.save`.\n            * :class:`~matplotlib.collections.LineCollection`: The default\n              arguments are taken from\n              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.\n            * :meth:`~matplotlib.axes.Axes.scatter`: The default\n              arguments are taken from\n              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.\n\n        Raises\n        ------\n        QueueingToolError\n            Will raise a :exc:`.QueueingToolError` if the\n            ``QueueNetwork`` has not been initialized. Call\n            :meth:`.initialize` before running.\n\n        Examples\n        --------\n        This function works similarly to ``QueueNetwork's``\n        :meth:`.draw` method.\n\n        >>> import queueing_tool as qt\n        >>> g = qt.generate_pagerank_graph(100, seed=13)\n        >>> net = qt.QueueNetwork(g, seed=13)\n        >>> net.initialize()\n        >>> net.animate(figsize=(4, 4)) # doctest: +SKIP\n\n        To stop the animation just close the window. If you want to\n        write the animation to disk run something like the following:\n\n        >>> kwargs = {\n        ...     'filename': 'test.mp4',\n        ...     'frames': 300,\n        ...     'fps': 30,\n        ...     'writer': 'mencoder',\n        ...     'figsize': (4, 4),\n        ...     'vertex_size': 15\n        ... }\n        >>> net.animate(**kwargs) # doctest: +SKIP", "docstring_tokens": ["Animates", "the", "network", "as", "it", "s", "simulating", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 260243}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/config.py#L349-L379", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Apply the config to a string.", "language": "python", "parameters": "(self, obj)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "re", ".", "split", "(", "'({config:|})'", ",", "arg_1", ")", "arg_3", "=", "[", "]", "try", ":", "while", "len", "(", "arg_2", ")", ":", "arg_4", "=", "arg_2", ".", "pop", "(", "0", ")", "if", "arg_4", "==", "'{config:'", ":", "arg_5", "=", "arg_2", ".", "pop", "(", "0", ")", "arg_6", "=", "arg_0", ".", "config", "[", "arg_5", "]", "if", "type", "(", "arg_6", ")", "==", "ConfigNode", "and", "arg_6", "==", "None", ":", "raise", "KeyError", "(", "\"No such config variable '{}'\"", ".", "format", "(", "arg_5", ")", ")", "arg_3", ".", "append", "(", "str", "(", "arg_6", ")", ")", "arg_2", ".", "pop", "(", "0", ")", "else", ":", "arg_3", ".", "append", "(", "arg_4", ")", "return", "''", ".", "join", "(", "arg_3", ")", "except", "IndexError", ":", "pass", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Apply the config to a string.\n        \"\"\"\n        arg_2 = re.split('({config:|})', arg_1)\n        arg_3 = []\n        try:\n            while len(arg_2):\n                arg_4 = arg_2.pop(0)\n                if arg_4 == '{config:':\n                    # pop the config variable, look it up\n                    arg_5 = arg_2.pop(0)\n                    arg_6 = arg_0.config[arg_5]\n\n                    # if we got an empty node, then it didn't exist\n                    if type(arg_6) == ConfigNode and arg_6 == None:\n                        raise KeyError(\"No such config variable '{}'\".format(arg_5))\n\n                    # add the value to the list\n                    arg_3.append(str(arg_6))\n\n                    # pop the '}'\n                    arg_2.pop(0)\n                else:\n                    # not the start of a config block, just append it to the list\n                    arg_3.append(arg_4)\n            return ''.join(arg_3)\n        except IndexError:\n            pass\n\n        return arg_1", "path": "scruffy/config.py", "identifier": "ConfigApplicator.apply_to_str", "docstring": "Apply the config to a string.", "docstring_tokens": ["Apply", "the", "config", "to", "a", "string", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 260244}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/transmitters/learner_data.py#L44-L62", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Handle the case where the employee on SAPSF's side is marked as inactive.", "language": "python", "parameters": "(self, learner_data, request_exception)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_2", ".", "response", ".", "content", "except", "AttributeError", ":", "pass", "else", ":", "if", "'user account is inactive'", "in", "arg_3", ":", "arg_4", "=", "EnterpriseCustomerUser", ".", "objects", ".", "get", "(", "enterprise_enrollments__id", "=", "arg_1", ".", "enterprise_course_enrollment_id", ")", "arg_4", ".", "active", "=", "False", "arg_4", ".", "save", "(", ")", "LOGGER", ".", "warning", "(", "'User %s with ID %s and email %s is a former employee of %s '", "'and has been marked inactive in SAPSF. Now marking inactive internally.'", ",", "arg_4", ".", "username", ",", "arg_4", ".", "user_id", ",", "arg_4", ".", "user_email", ",", "arg_4", ".", "enterprise_customer", ")", "return", "super", "(", "SapSuccessFactorsLearnerTransmitter", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Handle the case where the employee on SAPSF's side is marked as inactive.\"\"\"\n        try:\n            arg_3 = arg_2.response.content\n        except AttributeError:\n            pass\n        else:\n            if 'user account is inactive' in arg_3:\n                arg_4 = EnterpriseCustomerUser.objects.get(\n                    enterprise_enrollments__id=arg_1.enterprise_course_enrollment_id)\n                arg_4.active = False\n                arg_4.save()\n                LOGGER.warning(\n                    'User %s with ID %s and email %s is a former employee of %s '\n                    'and has been marked inactive in SAPSF. Now marking inactive internally.',\n                    arg_4.username, arg_4.user_id, arg_4.user_email, arg_4.enterprise_customer\n                )\n                return\n        super(SapSuccessFactorsLearnerTransmitter, arg_0).Func(arg_1, arg_2)", "path": "integrated_channels/sap_success_factors/transmitters/learner_data.py", "identifier": "SapSuccessFactorsLearnerTransmitter.handle_transmission_error", "docstring": "Handle the case where the employee on SAPSF's side is marked as inactive.", "docstring_tokens": ["Handle", "the", "case", "where", "the", "employee", "on", "SAPSF", "s", "side", "is", "marked", "as", "inactive", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260245}
{"url": "https://github.com/agabrown/PyGaia/blob/ae972b0622a15f713ffae471f925eac25ccdae47/examples/parallax_errors.py#L17-L31", "sha": "ae972b0622a15f713ffae471f925eac25ccdae47", "docstring_summary": "Calculate the parallax error for the given input source magnitude and colour.", "language": "python", "parameters": "(args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "float", "(", "arg_0", "[", "'gmag'", "]", ")", "arg_2", "=", "float", "(", "arg_0", "[", "'vmini'", "]", ")", "arg_3", "=", "parallaxErrorSkyAvg", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "gminvFromVmini", "(", "arg_2", ")", "print", "(", "\"G = {0}\"", ".", "format", "(", "arg_1", ")", ")", "print", "(", "\"V = {0}\"", ".", "format", "(", "arg_1", "-", "arg_4", ")", ")", "print", "(", "\"(V-I) = {0}\"", ".", "format", "(", "arg_2", ")", ")", "print", "(", "\"(G-V) = {0}\"", ".", "format", "(", "arg_4", ")", ")", "print", "(", "\"standard error = {0} muas\"", ".", "format", "(", "arg_3", ")", ")"], "function": "def Func(arg_0):\n  \"\"\"\n  Calculate the parallax error for the given input source magnitude and colour.\n\n  :argument args: command line arguments\n  \"\"\"\n  arg_1=float(arg_0['gmag'])\n  arg_2=float(arg_0['vmini'])\n  arg_3=parallaxErrorSkyAvg(arg_1, arg_2)\n  arg_4=gminvFromVmini(arg_2)\n  print(\"G = {0}\".format(arg_1))\n  print(\"V = {0}\".format(arg_1-arg_4))\n  print(\"(V-I) = {0}\".format(arg_2))\n  print(\"(G-V) = {0}\".format(arg_4))\n  print(\"standard error = {0} muas\".format(arg_3))", "path": "examples/parallax_errors.py", "identifier": "calcParallaxError", "docstring": "Calculate the parallax error for the given input source magnitude and colour.\n\n  :argument args: command line arguments", "docstring_tokens": ["Calculate", "the", "parallax", "error", "for", "the", "given", "input", "source", "magnitude", "and", "colour", "."], "nwo": "agabrown/PyGaia", "score": 0.39410601089411446, "idx": 260246}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L787-L799", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Upload a single file or a directory by adding a task into queue", "language": "python", "parameters": "(self, pool, source, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "if", "arg_0", ".", "opt", ".", "recursive", ":", "for", "arg_4", "in", "(", "arg_4", "for", "arg_4", "in", "arg_0", ".", "local_walk", "(", "arg_2", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_4", ")", ")", ":", "arg_5", "=", "S3URL", "(", "arg_3", ")", "arg_6", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "arg_5", ".", "path", ",", "os", ".", "path", ".", "relpath", "(", "arg_4", ",", "arg_2", ")", ")", ")", "arg_1", ".", "upload", "(", "arg_4", ",", "S3URL", ".", "combine", "(", "'s3'", ",", "arg_5", ".", "bucket", ",", "arg_6", ")", ")", "else", ":", "message", "(", "'omitting directory \"%s\".'", "%", "arg_2", ")", "else", ":", "arg_1", ".", "upload", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''Upload a single file or a directory by adding a task into queue'''\n    if os.path.isdir(arg_2):\n      if arg_0.opt.recursive:\n        for arg_4 in (arg_4 for arg_4 in arg_0.local_walk(arg_2) if not os.path.isdir(arg_4)):\n          arg_5 = S3URL(arg_3)\n          # deal with ./ or ../ here by normalizing the path.\n          arg_6 = os.path.normpath(os.path.join(arg_5.path, os.path.relpath(arg_4, arg_2)))\n          arg_1.upload(arg_4, S3URL.combine('s3', arg_5.bucket, arg_6))\n      else:\n        message('omitting directory \"%s\".' % arg_2)\n    else:\n      arg_1.upload(arg_2, arg_3)", "path": "s4cmd.py", "identifier": "S3Handler.put_single_file", "docstring": "Upload a single file or a directory by adding a task into queue", "docstring_tokens": ["Upload", "a", "single", "file", "or", "a", "directory", "by", "adding", "a", "task", "into", "queue"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260247}
{"url": "https://github.com/SiLab-Bonn/pixel_clusterizer/blob/d2c8c3072fb03ebb7c6a3e8c57350fbbe38efd4d/pixel_clusterizer/clusterizer.py#L220-L239", "sha": "d2c8c3072fb03ebb7c6a3e8c57350fbbe38efd4d", "docstring_summary": "Set the data type of the cluster.", "language": "python", "parameters": "(self, cluster_dtype)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "np", ".", "dtype", "(", "[", "]", ")", "else", ":", "arg_1", "=", "np", ".", "dtype", "(", "arg_1", ")", "arg_2", "=", "arg_1", ".", "descr", "for", "arg_3", ",", "arg_4", "in", "arg_0", ".", "_default_cluster_descr", ":", "if", "arg_0", ".", "_cluster_fields_mapping", "[", "arg_3", "]", "not", "in", "arg_1", ".", "fields", ":", "arg_2", ".", "append", "(", "(", "arg_3", ",", "arg_4", ")", ")", "arg_0", ".", "_cluster_descr", "=", "arg_2", "arg_0", ".", "_init_arrays", "(", "size", "=", "0", ")"], "function": "def Func(arg_0, arg_1):\n        ''' Set the data type of the cluster.\n\n        Parameters:\n        -----------\n        cluster_dtype : numpy.dtype or equivalent\n            Defines the dtype of the cluster array.\n        '''\n        if not arg_1:\n            arg_1 = np.dtype([])\n        else:\n            arg_1 = np.dtype(arg_1)\n        arg_2 = arg_1.descr\n\n        for arg_3, arg_4 in arg_0._default_cluster_descr:\n            if arg_0._cluster_fields_mapping[arg_3] not in arg_1.fields:\n                arg_2.append((arg_3, arg_4))\n\n        arg_0._cluster_descr = arg_2\n        arg_0._init_arrays(size=0)", "path": "pixel_clusterizer/clusterizer.py", "identifier": "HitClusterizer.set_cluster_dtype", "docstring": "Set the data type of the cluster.\n\n        Parameters:\n        -----------\n        cluster_dtype : numpy.dtype or equivalent\n            Defines the dtype of the cluster array.", "docstring_tokens": ["Set", "the", "data", "type", "of", "the", "cluster", "."], "nwo": "SiLab-Bonn/pixel_clusterizer", "score": 0.17697123869542528, "idx": 260248}
{"url": "https://github.com/he-zhe/heapq_max/blob/2861f32319ab1981e3531101eea5d20434a99c53/heapq_max/heapq_max.py#L47-L50", "sha": "2861f32319ab1981e3531101eea5d20434a99c53", "docstring_summary": "Push item onto heap, maintaining the heap invariant.", "language": "python", "parameters": "(heap, item)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "append", "(", "arg_1", ")", "_siftdown_max", "(", "arg_0", ",", "0", ",", "len", "(", "arg_0", ")", "-", "1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Push item onto heap, maintaining the heap invariant.\"\"\"\n    arg_0.append(arg_1)\n    _siftdown_max(arg_0, 0, len(arg_0) - 1)", "path": "heapq_max/heapq_max.py", "identifier": "heappush_max", "docstring": "Push item onto heap, maintaining the heap invariant.", "docstring_tokens": ["Push", "item", "onto", "heap", "maintaining", "the", "heap", "invariant", "."], "nwo": "he-zhe/heapq_max", "score": 0.2894271696199483, "idx": 260249}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/text.py#L153-L155", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Get results for the query and present them.", "language": "python", "parameters": "(self, query_text, n=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "10", ")", ":", "arg_0", ".", "present", "(", "arg_0", ".", "query", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=10):\n        \"Get results for the query and present them.\"\n        arg_0.present(arg_0.query(arg_1, arg_2))", "path": "aima/text.py", "identifier": "IRSystem.present_results", "docstring": "Get results for the query and present them.", "docstring_tokens": ["Get", "results", "for", "the", "query", "and", "present", "them", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 260250}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/__init__.py#L226-L448", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This adds a new LC format to the astrobase LC format registry.", "language": "python", "parameters": "(formatkey,\n                      fileglob,\n                      timecols,\n                      magcols,\n                      errcols,\n                      readerfunc_module,\n                      readerfunc,\n                      readerfunc_kwargs=None,\n                      normfunc_module=None,\n                      normfunc=None,\n                      normfunc_kwargs=None,\n                      magsarefluxes=False,\n                      overwrite_existing=False,\n                      lcformat_dir='~/.astrobase/lcformat-jsons')", "return_statement": "return lcformat_jsonpath", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "False", ",", "arg_12", "=", "False", ",", "arg_13", "=", "'~/.astrobase/lcformat-jsons'", ")", ":", "LOGINFO", "(", "'adding %s to LC format registry...'", "%", "arg_0", ")", "arg_14", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "arg_13", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_14", ")", ":", "os", ".", "makedirs", "(", "arg_14", ")", "arg_15", "=", "os", ".", "path", ".", "join", "(", "arg_14", ",", "'%s.json'", "%", "arg_0", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_15", ")", "and", "not", "arg_12", ":", "LOGERROR", "(", "'There is an existing lcformat JSON: %s '", "'for this formatkey: %s and '", "'overwrite_existing = False, skipping...'", "%", "(", "arg_15", ",", "arg_0", ")", ")", "return", "None", "arg_16", "=", "_check_extmodule", "(", "arg_5", ",", "arg_0", ")", "if", "not", "arg_16", ":", "LOGERROR", "(", "\"could not import the required \"", "\"module: %s to read %s light curves\"", "%", "(", "arg_5", ",", "arg_0", ")", ")", "return", "None", "try", ":", "getattr", "(", "arg_16", ",", "arg_6", ")", "arg_17", "=", "arg_6", "except", "AttributeError", ":", "LOGEXCEPTION", "(", "'Could not get the specified reader '", "'function: %s for lcformat: %s '", "'from module: %s'", "%", "(", "arg_0", ",", "arg_5", ",", "arg_6", ")", ")", "raise", "if", "arg_8", ":", "arg_18", "=", "_check_extmodule", "(", "arg_8", ",", "arg_0", ")", "if", "not", "arg_18", ":", "LOGERROR", "(", "\"could not import the required \"", "\"module: %s to normalize %s light curves\"", "%", "(", "arg_8", ",", "arg_0", ")", ")", "return", "None", "else", ":", "arg_18", "=", "None", "if", "arg_8", "and", "arg_9", ":", "try", ":", "getattr", "(", "arg_18", ",", "arg_9", ")", "arg_19", "=", "arg_9", "except", "AttributeError", ":", "LOGEXCEPTION", "(", "'Could not get the specified norm '", "'function: %s for lcformat: %s '", "'from module: %s'", "%", "(", "arg_9", ",", "arg_0", ",", "arg_8", ")", ")", "raise", "else", ":", "arg_19", "=", "None", "arg_20", "=", "{", "'fileglob'", ":", "arg_1", ",", "'timecols'", ":", "arg_2", ",", "'magcols'", ":", "arg_3", ",", "'errcols'", ":", "arg_4", ",", "'magsarefluxes'", ":", "arg_11", ",", "'lcreader_module'", ":", "arg_5", ",", "'lcreader_func'", ":", "arg_17", ",", "'lcreader_kwargs'", ":", "arg_7", ",", "'lcnorm_module'", ":", "arg_8", ",", "'lcnorm_func'", ":", "arg_19", ",", "'lcnorm_kwargs'", ":", "arg_10", "}", "with", "open", "(", "arg_15", ",", "'w'", ")", "as", "outfd", ":", "json", ".", "dump", "(", "arg_20", ",", "outfd", ",", "indent", "=", "4", ")", "return", "arg_15"], "function": "def Func(arg_0,\n                      arg_1,\n                      arg_2,\n                      arg_3,\n                      arg_4,\n                      arg_5,\n                      arg_6,\n                      arg_7=None,\n                      arg_8=None,\n                      arg_9=None,\n                      arg_10=None,\n                      arg_11=False,\n                      arg_12=False,\n                      arg_13='~/.astrobase/lcformat-jsons'):\n    '''This adds a new LC format to the astrobase LC format registry.\n\n    Allows handling of custom format light curves for astrobase lcproc\n    drivers. Once the format is successfully registered, light curves should\n    work transparently with all of the functions in this module, by simply\n    calling them with the `formatkey` in the `lcformat` keyword argument.\n\n    LC format specifications are generated as JSON files. astrobase comes with\n    several of these in `<astrobase install path>/data/lcformats`. LC formats\n    you add by using this function will have their specifiers written to the\n    `~/.astrobase/lcformat-jsons` directory in your home directory.\n\n    Parameters\n    ----------\n\n    formatkey : str\n        A str used as the unique ID of this LC format for all lcproc functions\n        and can be used to look it up later and import the correct functions\n        needed to support it for lcproc operations. For example, we use\n        'kep-fits' as a the specifier for Kepler FITS light curves, which can be\n        read by the `astrobase.astrokep.read_kepler_fitslc` function as\n        specified by the `<astrobase install path>/data/lcformats/kep-fits.json`\n        LC format specification JSON produced by `Func`.\n\n    fileglob : str\n        The default UNIX fileglob to use to search for light curve files in this\n        LC format. This is a string like '*-whatever-???-*.*??-.lc'.\n\n    timecols,magcols,errcols : list of str\n        These are all lists of strings indicating which keys in the lcdict\n        produced by your `lcreader_func` that will be extracted and used by\n        lcproc functions for processing. The lists must all have the same\n        dimensions, e.g. if timecols = ['timecol1','timecol2'], then magcols\n        must be something like ['magcol1','magcol2'] and errcols must be\n        something like ['errcol1', 'errcol2']. This allows you to process\n        multiple apertures or multiple types of measurements in one go.\n\n        Each element in these lists can be a simple key, e.g. 'time' (which\n        would correspond to lcdict['time']), or a composite key,\n        e.g. 'aperture1.times.rjd' (which would correspond to\n        lcdict['aperture1']['times']['rjd']). See the examples in the lcformat\n        specification JSON files in `<astrobase install path>/data/lcformats`.\n\n    readerfunc_module : str\n        This is either:\n\n        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or\n        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'\n\n        that contains the Python module that contains functions used to open\n        (and optionally normalize) a custom LC format that's not natively\n        supported by astrobase.\n\n    readerfunc : str\n        This is the function name in `readerfunc_module` to use to read light\n        curves in the custom format. This MUST always return a dictionary (the\n        'lcdict') with the following signature (the keys listed below are\n        required, but others are allowed)::\n\n            {'objectid': this object's identifier as a string,\n             'objectinfo':{'ra': this object's right ascension in decimal deg,\n                           'decl': this object's declination in decimal deg,\n                           'ndet': the number of observations in this LC,\n                           'objectid': the object ID again for legacy reasons},\n             ...other time columns, mag columns go in as their own keys}\n\n    normfunc_kwargs : dict or None\n        This is a dictionary containing any kwargs to pass through to\n        the light curve norm function.\n\n    normfunc_module : str or None\n        This is either:\n\n        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or\n        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'\n        - None, in which case we'll use default normalization\n\n        that contains the Python module that contains functions used to\n        normalize a custom LC format that's not natively supported by astrobase.\n\n    normfunc : str or None\n        This is the function name in `normfunc_module` to use to normalize light\n        curves in the custom format. If None, the default normalization method\n        used by lcproc is to find gaps in the time-series, normalize\n        measurements grouped by these gaps to zero, then normalize the entire\n        magnitude time series to global time series median using the\n        `astrobase.lcmath.normalize_magseries` function.\n\n        If this is provided, the normalization function should take and return\n        an lcdict of the same form as that produced by `readerfunc` above. For\n        an example of a specific normalization function, see\n        `normalize_lcdict_by_inst` in the `astrobase.hatsurveys.hatlc` module.\n\n    normfunc_kwargs : dict or None\n        This is a dictionary containing any kwargs to pass through to\n        the light curve normalization function.\n\n    magsarefluxes : bool\n        If this is True, then all lcproc functions will treat the measurement\n        columns in the lcdict produced by your `readerfunc` as flux instead of\n        mags, so things like default normalization and sigma-clipping will be\n        done correctly. If this is False, magnitudes will be treated as\n        magnitudes.\n\n    overwrite_existing : bool\n        If this is True, this function will overwrite any existing LC format\n        specification JSON with the same name as that provided in the\n        `formatkey` arg. This can be used to update LC format specifications\n        while keeping the `formatkey` the same.\n\n    lcformat_dir : str\n        This specifies the directory where the the LC format specification JSON\n        produced by this function will be written. By default, this goes to the\n        `.astrobase/lcformat-jsons` directory in your home directory.\n\n    Returns\n    -------\n\n    str\n        Returns the file path to the generated LC format specification JSON\n        file.\n\n    '''\n\n    LOGINFO('adding %s to LC format registry...' % arg_0)\n\n    # search for the lcformat_dir and create it if it doesn't exist\n    arg_14 = os.path.abspath(\n        os.path.expanduser(arg_13)\n    )\n    if not os.path.exists(arg_14):\n        os.makedirs(arg_14)\n\n    arg_15 = os.path.join(arg_14,'%s.json' % arg_0)\n\n    if os.path.exists(arg_15) and not arg_12:\n        LOGERROR('There is an existing lcformat JSON: %s '\n                 'for this formatkey: %s and '\n                 'overwrite_existing = False, skipping...'\n                 % (arg_15, arg_0))\n        return None\n\n    # see if we can import the reader module\n    arg_16 = _check_extmodule(arg_5, arg_0)\n\n    if not arg_16:\n        LOGERROR(\"could not import the required \"\n                 \"module: %s to read %s light curves\" %\n                 (arg_5, arg_0))\n        return None\n\n    # then, get the function we need to read the light curve\n    try:\n        getattr(arg_16, arg_6)\n        arg_17 = arg_6\n    except AttributeError:\n        LOGEXCEPTION('Could not get the specified reader '\n                     'function: %s for lcformat: %s '\n                     'from module: %s'\n                     % (arg_0, arg_5, arg_6))\n        raise\n\n    # see if we can import the normalization module\n    if arg_8:\n        arg_18 = _check_extmodule(arg_8, arg_0)\n        if not arg_18:\n            LOGERROR(\"could not import the required \"\n                     \"module: %s to normalize %s light curves\" %\n                     (arg_8, arg_0))\n            return None\n\n    else:\n        arg_18 = None\n\n    # finally, get the function we need to normalize the light curve\n    if arg_8 and arg_9:\n        try:\n            getattr(arg_18, arg_9)\n            arg_19 = arg_9\n        except AttributeError:\n            LOGEXCEPTION('Could not get the specified norm '\n                         'function: %s for lcformat: %s '\n                         'from module: %s'\n                         % (arg_9, arg_0, arg_8))\n            raise\n\n    else:\n        arg_19 = None\n\n\n    # if we made it to here, then everything's good. generate the JSON\n    # structure\n    arg_20 = {'fileglob':arg_1,\n                  'timecols':arg_2,\n                  'magcols':arg_3,\n                  'errcols':arg_4,\n                  'magsarefluxes':arg_11,\n                  'lcreader_module':arg_5,\n                  'lcreader_func':arg_17,\n                  'lcreader_kwargs':arg_7,\n                  'lcnorm_module':arg_8,\n                  'lcnorm_func':arg_19,\n                  'lcnorm_kwargs':arg_10}\n\n    # write this to the lcformat directory\n    with open(arg_15,'w') as outfd:\n        json.dump(arg_20, outfd, indent=4)\n\n    return arg_15", "path": "astrobase/lcproc/__init__.py", "identifier": "register_lcformat", "docstring": "This adds a new LC format to the astrobase LC format registry.\n\n    Allows handling of custom format light curves for astrobase lcproc\n    drivers. Once the format is successfully registered, light curves should\n    work transparently with all of the functions in this module, by simply\n    calling them with the `formatkey` in the `lcformat` keyword argument.\n\n    LC format specifications are generated as JSON files. astrobase comes with\n    several of these in `<astrobase install path>/data/lcformats`. LC formats\n    you add by using this function will have their specifiers written to the\n    `~/.astrobase/lcformat-jsons` directory in your home directory.\n\n    Parameters\n    ----------\n\n    formatkey : str\n        A str used as the unique ID of this LC format for all lcproc functions\n        and can be used to look it up later and import the correct functions\n        needed to support it for lcproc operations. For example, we use\n        'kep-fits' as a the specifier for Kepler FITS light curves, which can be\n        read by the `astrobase.astrokep.read_kepler_fitslc` function as\n        specified by the `<astrobase install path>/data/lcformats/kep-fits.json`\n        LC format specification JSON produced by `register_lcformat`.\n\n    fileglob : str\n        The default UNIX fileglob to use to search for light curve files in this\n        LC format. This is a string like '*-whatever-???-*.*??-.lc'.\n\n    timecols,magcols,errcols : list of str\n        These are all lists of strings indicating which keys in the lcdict\n        produced by your `lcreader_func` that will be extracted and used by\n        lcproc functions for processing. The lists must all have the same\n        dimensions, e.g. if timecols = ['timecol1','timecol2'], then magcols\n        must be something like ['magcol1','magcol2'] and errcols must be\n        something like ['errcol1', 'errcol2']. This allows you to process\n        multiple apertures or multiple types of measurements in one go.\n\n        Each element in these lists can be a simple key, e.g. 'time' (which\n        would correspond to lcdict['time']), or a composite key,\n        e.g. 'aperture1.times.rjd' (which would correspond to\n        lcdict['aperture1']['times']['rjd']). See the examples in the lcformat\n        specification JSON files in `<astrobase install path>/data/lcformats`.\n\n    readerfunc_module : str\n        This is either:\n\n        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or\n        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'\n\n        that contains the Python module that contains functions used to open\n        (and optionally normalize) a custom LC format that's not natively\n        supported by astrobase.\n\n    readerfunc : str\n        This is the function name in `readerfunc_module` to use to read light\n        curves in the custom format. This MUST always return a dictionary (the\n        'lcdict') with the following signature (the keys listed below are\n        required, but others are allowed)::\n\n            {'objectid': this object's identifier as a string,\n             'objectinfo':{'ra': this object's right ascension in decimal deg,\n                           'decl': this object's declination in decimal deg,\n                           'ndet': the number of observations in this LC,\n                           'objectid': the object ID again for legacy reasons},\n             ...other time columns, mag columns go in as their own keys}\n\n    normfunc_kwargs : dict or None\n        This is a dictionary containing any kwargs to pass through to\n        the light curve norm function.\n\n    normfunc_module : str or None\n        This is either:\n\n        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or\n        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'\n        - None, in which case we'll use default normalization\n\n        that contains the Python module that contains functions used to\n        normalize a custom LC format that's not natively supported by astrobase.\n\n    normfunc : str or None\n        This is the function name in `normfunc_module` to use to normalize light\n        curves in the custom format. If None, the default normalization method\n        used by lcproc is to find gaps in the time-series, normalize\n        measurements grouped by these gaps to zero, then normalize the entire\n        magnitude time series to global time series median using the\n        `astrobase.lcmath.normalize_magseries` function.\n\n        If this is provided, the normalization function should take and return\n        an lcdict of the same form as that produced by `readerfunc` above. For\n        an example of a specific normalization function, see\n        `normalize_lcdict_by_inst` in the `astrobase.hatsurveys.hatlc` module.\n\n    normfunc_kwargs : dict or None\n        This is a dictionary containing any kwargs to pass through to\n        the light curve normalization function.\n\n    magsarefluxes : bool\n        If this is True, then all lcproc functions will treat the measurement\n        columns in the lcdict produced by your `readerfunc` as flux instead of\n        mags, so things like default normalization and sigma-clipping will be\n        done correctly. If this is False, magnitudes will be treated as\n        magnitudes.\n\n    overwrite_existing : bool\n        If this is True, this function will overwrite any existing LC format\n        specification JSON with the same name as that provided in the\n        `formatkey` arg. This can be used to update LC format specifications\n        while keeping the `formatkey` the same.\n\n    lcformat_dir : str\n        This specifies the directory where the the LC format specification JSON\n        produced by this function will be written. By default, this goes to the\n        `.astrobase/lcformat-jsons` directory in your home directory.\n\n    Returns\n    -------\n\n    str\n        Returns the file path to the generated LC format specification JSON\n        file.", "docstring_tokens": ["This", "adds", "a", "new", "LC", "format", "to", "the", "astrobase", "LC", "format", "registry", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 260251}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/helpers.py#L299-L318", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Given task instance, try_number, filename_template, return the rendered log\n    filename", "language": "python", "parameters": "(ti, try_number, filename_template)", "return_statement": "return filename_template.format(dag_id=ti.dag_id,\n                                    task_id=ti.task_id,\n                                    execution_date=ti.execution_date.isoformat(),\n                                    try_number=try_number)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", ",", "arg_3", "=", "parse_template_string", "(", "arg_2", ")", "if", "arg_3", ":", "arg_4", "=", "arg_0", ".", "get_template_context", "(", ")", "arg_4", "[", "'try_number'", "]", "=", "arg_1", "return", "arg_3", ".", "render", "(", "**", "arg_4", ")", "return", "arg_2", ".", "format", "(", "dag_id", "=", "arg_0", ".", "dag_id", ",", "task_id", "=", "arg_0", ".", "task_id", ",", "execution_date", "=", "arg_0", ".", "execution_date", ".", "isoformat", "(", ")", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Given task instance, try_number, filename_template, return the rendered log\n    filename\n\n    :param ti: task instance\n    :param try_number: try_number of the task\n    :param filename_template: filename template, which can be jinja template or\n        python string template\n    \"\"\"\n    arg_2, arg_3 = parse_template_string(arg_2)\n    if arg_3:\n        arg_4 = arg_0.get_template_context()\n        arg_4['try_number'] = arg_1\n        return arg_3.render(**arg_4)\n\n    return arg_2.format(dag_id=arg_0.dag_id,\n                                    task_id=arg_0.task_id,\n                                    execution_date=arg_0.execution_date.isoformat(),\n                                    arg_1=arg_1)", "path": "airflow/utils/helpers.py", "identifier": "render_log_filename", "docstring": "Given task instance, try_number, filename_template, return the rendered log\n    filename\n\n    :param ti: task instance\n    :param try_number: try_number of the task\n    :param filename_template: filename template, which can be jinja template or\n        python string template", "docstring_tokens": ["Given", "task", "instance", "try_number", "filename_template", "return", "the", "rendered", "log", "filename"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260252}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/grute.py#L151-L231", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Builds a graph using the graph-services endpoint.", "language": "python", "parameters": "(self, project, site, subject, session, scan,\n                    size, email=None, invariants=Invariants.ALL,\n                    fiber_file=DEFAULT_FIBER_FILE, atlas_file=None,\n                    use_threads=False, callback=None)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", "=", "None", ",", "arg_8", "=", "arg_9", ".", "ALL", ",", "arg_11", "=", "arg_12", ",", "arg_13", "=", "None", ",", "arg_14", "=", "False", ",", "arg_15", "=", "None", ")", ":", "if", "arg_7", "is", "None", ":", "arg_7", "=", "arg_0", ".", "email", "if", "not", "set", "(", "arg_8", ")", "<=", "set", "(", "arg_9", ".", "ALL", ")", ":", "raise", "ValueError", "(", "\"Invariants must be a subset of Invariants.ALL.\"", ")", "if", "arg_14", "and", "arg_15", "is", "not", "None", ":", "if", "not", "hasattr", "(", "arg_15", ",", "'__call__'", ")", ":", "raise", "ValueError", "(", "\"callback must be a function.\"", ")", "if", "len", "(", "inspect", ".", "getargspec", "(", "arg_15", ")", ".", "args", ")", "!=", "1", ":", "raise", "ValueError", "(", "\"callback must take exactly 1 argument.\"", ")", "if", "arg_6", "not", "in", "[", "arg_0", ".", "BIG", ",", "arg_0", ".", "SMALL", "]", ":", "raise", "ValueError", "(", "\"size must be either grute.BIG or grute.SMALL.\"", ")", "arg_16", "=", "\"buildgraph/{}/{}/{}/{}/{}/{}/{}/{}/\"", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "\"/\"", ".", "join", "(", "arg_8", ")", ")", "if", "\" \"", "in", "arg_16", ":", "raise", "ValueError", "(", "\"Arguments must not contain spaces.\"", ")", "if", "arg_14", ":", "arg_17", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "_run_Func", ",", "args", "=", "[", "arg_16", ",", "arg_11", ",", "arg_13", ",", "arg_15", "]", ")", "arg_17", ".", "start", "(", ")", "else", ":", "return", "arg_0", ".", "_run_Func", "(", "arg_16", ",", "arg_11", ",", "arg_13", ")", "return"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5,\n                    arg_6, arg_7=None, arg_8=arg_9.ALL,\n                    arg_11=arg_12, arg_13=None,\n                    arg_14=False, arg_15=None):\n        \"\"\"\n        Builds a graph using the graph-services endpoint.\n\n        Arguments:\n            project (str): The project to use\n            site (str): The site in question\n            subject (str): The subject's identifier\n            session (str): The session (per subject)\n            scan (str): The scan identifier\n            size (str): Whether to return a big (grute.BIG) or small\n                (grute.SMALL) graph. For a better explanation, see m2g.io.\n            email (str : self.email)*: An email to notify\n            invariants (str[]: Invariants.ALL)*: An array of invariants to\n                compute. You can use the grute.Invariants class to construct a\n                list, or simply pass grute.Invariants.ALL to compute them all.\n            fiber_file (str: DEFAULT_FIBER_FILE)*: A local filename of an\n                MRI Studio .dat file\n            atlas_file (str: None)*: A local atlas file, in NIFTI .nii format.\n                If none is specified, the Desikan atlas is used by default.\n            use_threads (bool: False)*: Whether to run the download in a Python\n                thread. If set to True, the call to `Func` will end\n                quickly, and the `callback` will be called with the returned\n                status-code of the restful call as its only argument.\n            callback (function: None)*: The function to run upon completion of\n                the call, if using threads. (Will not be called if use_threads\n                is set to False.)\n\n        Returns:\n            HTTP Response if use_threads is False. Otherwise, None\n\n        Raises:\n            ValueError: When the supplied values are invalid (contain invalid\n                characters, bad email address supplied, etc.)\n            RemoteDataNotFoundError: When the data cannot be processed due to\n                a server error.\n        \"\"\"\n        if arg_7 is None:\n            arg_7 = arg_0.email\n\n        if not set(arg_8) <= set(arg_9.ALL):\n            raise ValueError(\"Invariants must be a subset of Invariants.ALL.\")\n\n        if arg_14 and arg_15 is not None:\n            if not hasattr(arg_15, '__call__'):\n                raise ValueError(\"callback must be a function.\")\n            if len(inspect.getargspec(arg_15).args) != 1:\n                raise ValueError(\"callback must take exactly 1 argument.\")\n\n        # Once we get here, we know the callback is\n        if arg_6 not in [arg_0.BIG, arg_0.SMALL]:\n            raise ValueError(\"size must be either grute.BIG or grute.SMALL.\")\n\n        arg_16 = \"buildgraph/{}/{}/{}/{}/{}/{}/{}/{}/\".format(\n            arg_1,\n            arg_2,\n            arg_3,\n            arg_4,\n            arg_5,\n            arg_6,\n            arg_7,\n            \"/\".join(arg_8)\n        )\n\n        if \" \" in arg_16:\n            raise ValueError(\"Arguments must not contain spaces.\")\n\n        if arg_14:\n            # Run in the background.\n            arg_17 = threading.Thread(\n                target=arg_0._run_Func,\n                args=[arg_16, arg_11, arg_13, arg_15]\n            )\n            arg_17.start()\n        else:\n            # Run in the foreground.\n            return arg_0._run_Func(arg_16, arg_11, arg_13)\n        return", "path": "ndio/remote/grute.py", "identifier": "grute.build_graph", "docstring": "Builds a graph using the graph-services endpoint.\n\n        Arguments:\n            project (str): The project to use\n            site (str): The site in question\n            subject (str): The subject's identifier\n            session (str): The session (per subject)\n            scan (str): The scan identifier\n            size (str): Whether to return a big (grute.BIG) or small\n                (grute.SMALL) graph. For a better explanation, see m2g.io.\n            email (str : self.email)*: An email to notify\n            invariants (str[]: Invariants.ALL)*: An array of invariants to\n                compute. You can use the grute.Invariants class to construct a\n                list, or simply pass grute.Invariants.ALL to compute them all.\n            fiber_file (str: DEFAULT_FIBER_FILE)*: A local filename of an\n                MRI Studio .dat file\n            atlas_file (str: None)*: A local atlas file, in NIFTI .nii format.\n                If none is specified, the Desikan atlas is used by default.\n            use_threads (bool: False)*: Whether to run the download in a Python\n                thread. If set to True, the call to `build_graph` will end\n                quickly, and the `callback` will be called with the returned\n                status-code of the restful call as its only argument.\n            callback (function: None)*: The function to run upon completion of\n                the call, if using threads. (Will not be called if use_threads\n                is set to False.)\n\n        Returns:\n            HTTP Response if use_threads is False. Otherwise, None\n\n        Raises:\n            ValueError: When the supplied values are invalid (contain invalid\n                characters, bad email address supplied, etc.)\n            RemoteDataNotFoundError: When the data cannot be processed due to\n                a server error.", "docstring_tokens": ["Builds", "a", "graph", "using", "the", "graph", "-", "services", "endpoint", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 260253}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L964-L978", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Generic version of directory walk. Return file list without base path\n       for comparison.", "language": "python", "parameters": "(self, dir)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "if", "S3URL", ".", "is_valid", "(", "arg_1", ")", ":", "arg_3", "=", "S3URL", "(", "arg_1", ")", ".", "path", "for", "arg_4", "in", "(", "arg_4", "for", "arg_4", "in", "arg_0", ".", "s3walk", "(", "arg_1", ")", "if", "not", "arg_4", "[", "'is_dir'", "]", ")", ":", "arg_2", ".", "append", "(", "os", ".", "path", ".", "relpath", "(", "S3URL", "(", "arg_4", "[", "'name'", "]", ")", ".", "path", ",", "arg_3", ")", ")", "else", ":", "for", "arg_4", "in", "(", "arg_4", "for", "arg_4", "in", "arg_0", ".", "local_walk", "(", "arg_1", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_4", ")", ")", ":", "arg_2", ".", "append", "(", "os", ".", "path", ".", "relpath", "(", "arg_4", ",", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    '''Generic version of directory walk. Return file list without base path\n       for comparison.\n    '''\n    arg_2 = []\n\n    if S3URL.is_valid(arg_1):\n      arg_3 = S3URL(arg_1).path\n      for arg_4 in (arg_4 for arg_4 in arg_0.s3walk(arg_1) if not arg_4['is_dir']):\n        arg_2.append(os.path.relpath(S3URL(arg_4['name']).path, arg_3))\n    else:\n      for arg_4 in (arg_4 for arg_4 in arg_0.local_walk(arg_1) if not os.path.isdir(arg_4)):\n        arg_2.append(os.path.relpath(arg_4, arg_1))\n\n    return arg_2", "path": "s4cmd.py", "identifier": "S3Handler.relative_dir_walk", "docstring": "Generic version of directory walk. Return file list without base path\n       for comparison.", "docstring_tokens": ["Generic", "version", "of", "directory", "walk", ".", "Return", "file", "list", "without", "base", "path", "for", "comparison", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260254}
{"url": "https://github.com/frascoweb/easywebassets/blob/02f84376067c827c84fc1773895bb2784e033949/easywebassets/package.py#L200-L208", "sha": "02f84376067c827c84fc1773895bb2784e033949", "docstring_summary": "Return html tags for urls of asset_type", "language": "python", "parameters": "(self, asset_type, *args, **kwargs)", "return_statement": "return \"\\n\".join(html)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_0", ".", "depends", ":", "arg_4", ".", "append", "(", "arg_0", ".", "_ref", "(", "arg_5", ")", ".", "Func", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ")", "if", "arg_1", "in", "arg_0", ".", "typed_bundles", ":", "arg_4", ".", "append", "(", "render_asset_html_tags", "(", "arg_1", ",", "arg_0", ".", "urls_for_self", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ")", ")", "return", "\"\\n\"", ".", "join", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Return html tags for urls of asset_type\n        \"\"\"\n        arg_4 = []\n        for arg_5 in arg_0.depends:\n            arg_4.append(arg_0._ref(arg_5).Func(arg_1, *arg_2, **arg_3))\n        if arg_1 in arg_0.typed_bundles:\n            arg_4.append(render_asset_html_tags(arg_1, arg_0.urls_for_self(arg_1, *arg_2, **arg_3)))\n        return \"\\n\".join(arg_4)", "path": "easywebassets/package.py", "identifier": "Package.html_tags_for", "docstring": "Return html tags for urls of asset_type", "docstring_tokens": ["Return", "html", "tags", "for", "urls", "of", "asset_type"], "nwo": "frascoweb/easywebassets", "score": 0.09252797783733271, "idx": 260255}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fir_design_helper.py#L373-L396", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Design an FIR bandstop filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass1 Hz, f_stop1 Hz, f_stop2 Hz, f_pass2 Hz, and the \r\n    desired passband ripple d_pass dB and stopband attenuation\r\n    d_stop dB all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "language": "python", "parameters": "(f_pass1, f_stop1, f_stop2, f_pass2, d_pass, d_stop, \r\n                  fs = 1.0, N_bump=5)", "return_statement": "return b", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "1.0", ",", "arg_7", "=", "5", ")", ":", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "bandstop_order", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "fsamp", "=", "arg_6", ")", "if", "np", ".", "mod", "(", "arg_8", ",", "2", ")", "!=", "0", ":", "arg_8", "+=", "1", "arg_12", "=", "arg_8", "arg_12", "+=", "arg_7", "arg_13", "=", "signal", ".", "remez", "(", "arg_12", ",", "arg_9", ",", "arg_10", "[", "0", ":", ":", "2", "]", ",", "arg_11", ",", "Hz", "=", "2", ",", "maxiter", "=", "25", ",", "grid_density", "=", "16", ")", "print", "(", "'N_bump must be odd to maintain odd filter length'", ")", "print", "(", "'Remez filter taps = %d.'", "%", "arg_12", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, \r\n                  arg_6 = 1.0, arg_7=5):\r\n    \"\"\"\r\n    Design an FIR bandstop filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass1 Hz, f_stop1 Hz, f_stop2 Hz, f_pass2 Hz, and the \r\n    desired passband ripple d_pass dB and stopband attenuation\r\n    d_stop dB all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018\r\n    \"\"\"\r\n    arg_8, arg_9, arg_10, arg_11 = bandstop_order(arg_0, arg_1, arg_2, arg_3, \r\n                                    arg_4, arg_5, fsamp=arg_6)\r\n    # Bump up the order by N_bump to bring down the final d_pass & d_stop\r\n    # Initially make sure the number of taps is even so N_bump needs to be odd\r\n    if np.mod(arg_8,2) != 0:\r\n        arg_8 += 1\r\n    arg_12 = arg_8\r\n    arg_12 += arg_7\r\n    arg_13 = signal.remez(arg_12, arg_9, arg_10[0::2], arg_11, Hz=2,\r\n                     maxiter = 25, grid_density = 16)\r\n    print('N_bump must be odd to maintain odd filter length')\r\n    print('Remez filter taps = %d.' % arg_12)\r\n    return arg_13", "path": "sk_dsp_comm/fir_design_helper.py", "identifier": "fir_remez_bsf", "docstring": "Design an FIR bandstop filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_pass1 Hz, f_stop1 Hz, f_stop2 Hz, f_pass2 Hz, and the \r\n    desired passband ripple d_pass dB and stopband attenuation\r\n    d_stop dB all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "docstring_tokens": ["Design", "an", "FIR", "bandstop", "filter", "using", "remez", "with", "order", "determination", ".", "The", "filter", "order", "is", "determined", "based", "on", "f_pass1", "Hz", "f_stop1", "Hz", "f_stop2", "Hz", "f_pass2", "Hz", "and", "the", "desired", "passband", "ripple", "d_pass", "dB", "and", "stopband", "attenuation", "d_stop", "dB", "all", "relative", "to", "a", "sampling", "rate", "of", "fs", "Hz", ".", "Mark", "Wickert", "October", "2016", "updated", "October", "2018"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 260256}
{"url": "https://github.com/underyx/structlog-pretty/blob/e87e1ce582b94b21e1b65b1c326d4edf87f8bef3/structlog_pretty/utils.py#L4-L13", "sha": "e87e1ce582b94b21e1b65b1c326d4edf87f8bef3", "docstring_summary": "Strips all whitespace from a minidom XML node and its children", "language": "python", "parameters": "(node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "childNodes", ":", "if", "arg_1", ".", "nodeType", "==", "Node", ".", "TEXT_NODE", ":", "if", "arg_1", ".", "nodeValue", ":", "arg_1", ".", "nodeValue", "=", "arg_1", ".", "nodeValue", ".", "strip", "(", ")", "elif", "arg_1", ".", "nodeType", "==", "Node", ".", "ELEMENT_NODE", ":", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Strips all whitespace from a minidom XML node and its children\n\n    This operation is made in-place.\"\"\"\n    for arg_1 in arg_0.childNodes:\n        if arg_1.nodeType == Node.TEXT_NODE:\n            if arg_1.nodeValue:\n                arg_1.nodeValue = arg_1.nodeValue.strip()\n        elif arg_1.nodeType == Node.ELEMENT_NODE:\n            Func(arg_1)", "path": "structlog_pretty/utils.py", "identifier": "strip_minidom_whitespace", "docstring": "Strips all whitespace from a minidom XML node and its children\n\n    This operation is made in-place.", "docstring_tokens": ["Strips", "all", "whitespace", "from", "a", "minidom", "XML", "node", "and", "its", "children"], "nwo": "underyx/structlog-pretty", "score": 0.18979091054593147, "idx": 260257}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/util.py#L55-L107", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Create a matrix of randomly-initialized weights.", "language": "python", "parameters": "(rows, cols, mean=0, std=1, sparsity=0, radius=0, diagonal=0, rng=None)", "return_statement": "return arr.astype(FLOAT)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "1", ",", "arg_4", "=", "0", ",", "arg_5", "=", "0", ",", "arg_6", "=", "0", ",", "arg_7", "=", "None", ")", ":", "if", "arg_7", "is", "None", "or", "isinstance", "(", "arg_7", ",", "int", ")", ":", "arg_7", "=", "np", ".", "random", ".", "RandomState", "(", "arg_7", ")", "arg_8", "=", "arg_2", "+", "arg_3", "*", "arg_7", ".", "randn", "(", "arg_0", ",", "arg_1", ")", "if", "1", ">", "arg_4", ">", "0", ":", "arg_9", "=", "min", "(", "arg_0", ",", "arg_1", ")", "arg_10", "=", "arg_7", ".", "binomial", "(", "n", "=", "1", ",", "p", "=", "1", "-", "arg_4", ",", "size", "=", "(", "arg_0", ",", "arg_1", ")", ")", ".", "astype", "(", "bool", ")", "arg_10", "[", ":", "arg_9", ",", ":", "arg_9", "]", "|=", "np", ".", "eye", "(", "arg_9", ")", ".", "astype", "(", "bool", ")", "arg_8", "*=", "arg_10", "if", "arg_5", ">", "0", ":", "arg_11", ",", "arg_12", ",", "arg_13", "=", "np", ".", "linalg", ".", "svd", "(", "arg_8", ",", "full_matrices", "=", "False", ")", "arg_8", "=", "np", ".", "dot", "(", "np", ".", "dot", "(", "arg_11", ",", "np", ".", "diag", "(", "arg_5", "*", "arg_12", "/", "abs", "(", "arg_12", "[", "0", "]", ")", ")", ")", ",", "arg_13", ")", "if", "arg_6", "!=", "0", ":", "arg_8", "=", "arg_6", "*", "np", ".", "eye", "(", "max", "(", "arg_0", ",", "arg_1", ")", ")", "[", ":", "arg_0", ",", ":", "arg_1", "]", "return", "arg_8", ".", "astype", "(", "FLOAT", ")"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=1, arg_4=0, arg_5=0, arg_6=0, arg_7=None):\n    '''Create a matrix of randomly-initialized weights.\n\n    Parameters\n    ----------\n    rows : int\n        Number of rows of the weight matrix -- equivalently, the number of\n        \"input\" units that the weight matrix connects.\n    cols : int\n        Number of columns of the weight matrix -- equivalently, the number\n        of \"output\" units that the weight matrix connects.\n    mean : float, optional\n        Draw initial weight values from a normal with this mean. Defaults to 0.\n    std : float, optional\n        Draw initial weight values from a normal with this standard deviation.\n        Defaults to 1.\n    sparsity : float in (0, 1), optional\n        If given, ensure that the given fraction of the weight matrix is\n        set to zero. Defaults to 0, meaning all weights are nonzero.\n    radius : float, optional\n        If given, rescale the initial weights to have this spectral radius.\n        No scaling is performed by default.\n    diagonal : float, optional\n        If nonzero, create a matrix containing all zeros except for this value\n        along the diagonal. If nonzero, other arguments (except for rows and\n        cols) will be ignored.\n    rng : :class:`numpy.random.RandomState` or int, optional\n        A random number generator, or an integer seed for a random number\n        generator. If not provided, the random number generator will be created\n        with an automatically chosen seed.\n\n    Returns\n    -------\n    matrix : numpy array\n        An array containing random values. These often represent the weights\n        connecting each \"input\" unit to each \"output\" unit in a layer.\n    '''\n    if arg_7 is None or isinstance(arg_7, int):\n        arg_7 = np.random.RandomState(arg_7)\n    arg_8 = arg_2 + arg_3 * arg_7.randn(arg_0, arg_1)\n    if 1 > arg_4 > 0:\n        arg_9 = min(arg_0, arg_1)\n        arg_10 = arg_7.binomial(n=1, p=1 - arg_4, size=(arg_0, arg_1)).astype(bool)\n        arg_10[:arg_9, :arg_9] |= np.eye(arg_9).astype(bool)\n        arg_8 *= arg_10\n    if arg_5 > 0:\n        # rescale weights to have the appropriate spectral radius.\n        arg_11, arg_12, arg_13 = np.linalg.svd(arg_8, full_matrices=False)\n        arg_8 = np.dot(np.dot(arg_11, np.diag(arg_5 * arg_12 / abs(arg_12[0]))), arg_13)\n    if arg_6 != 0:\n        # generate a diagonal weight matrix. ignore other options.\n        arg_8 = arg_6 * np.eye(max(arg_0, arg_1))[:arg_0, :arg_1]\n    return arg_8.astype(FLOAT)", "path": "theanets/util.py", "identifier": "random_matrix", "docstring": "Create a matrix of randomly-initialized weights.\n\n    Parameters\n    ----------\n    rows : int\n        Number of rows of the weight matrix -- equivalently, the number of\n        \"input\" units that the weight matrix connects.\n    cols : int\n        Number of columns of the weight matrix -- equivalently, the number\n        of \"output\" units that the weight matrix connects.\n    mean : float, optional\n        Draw initial weight values from a normal with this mean. Defaults to 0.\n    std : float, optional\n        Draw initial weight values from a normal with this standard deviation.\n        Defaults to 1.\n    sparsity : float in (0, 1), optional\n        If given, ensure that the given fraction of the weight matrix is\n        set to zero. Defaults to 0, meaning all weights are nonzero.\n    radius : float, optional\n        If given, rescale the initial weights to have this spectral radius.\n        No scaling is performed by default.\n    diagonal : float, optional\n        If nonzero, create a matrix containing all zeros except for this value\n        along the diagonal. If nonzero, other arguments (except for rows and\n        cols) will be ignored.\n    rng : :class:`numpy.random.RandomState` or int, optional\n        A random number generator, or an integer seed for a random number\n        generator. If not provided, the random number generator will be created\n        with an automatically chosen seed.\n\n    Returns\n    -------\n    matrix : numpy array\n        An array containing random values. These often represent the weights\n        connecting each \"input\" unit to each \"output\" unit in a layer.", "docstring_tokens": ["Create", "a", "matrix", "of", "randomly", "-", "initialized", "weights", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 260258}
{"url": "https://github.com/Numergy/yoda/blob/109f0e9441130488b0155f05883ef6531cf46ee9/yoda/subcommand/show.py#L51-L56", "sha": "109f0e9441130488b0155f05883ef6531cf46ee9", "docstring_summary": "Execute show subcommand.", "language": "python", "parameters": "(self, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "name", "is", "not", "None", ":", "arg_0", ".", "show_workspace", "(", "slashes2dash", "(", "arg_1", ".", "name", ")", ")", "elif", "arg_1", ".", "all", "is", "not", "None", ":", "arg_0", ".", "show_all", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Execute show subcommand.\"\"\"\n        if arg_1.name is not None:\n            arg_0.show_workspace(slashes2dash(arg_1.name))\n        elif arg_1.all is not None:\n            arg_0.show_all()", "path": "yoda/subcommand/show.py", "identifier": "Show.execute", "docstring": "Execute show subcommand.", "docstring_tokens": ["Execute", "show", "subcommand", "."], "nwo": "Numergy/yoda", "score": 0.1832591465193378, "idx": 260259}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L102-L118", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Upload a string to Azure Blob Storage.", "language": "python", "parameters": "(self, string_data, container_name, blob_name, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "arg_0", ".", "connection", ".", "create_blob_from_text", "(", "arg_2", ",", "arg_3", ",", "arg_1", ",", "**", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"\n        Upload a string to Azure Blob Storage.\n\n        :param string_data: String to load.\n        :type string_data: str\n        :param container_name: Name of the container.\n        :type container_name: str\n        :param blob_name: Name of the blob.\n        :type blob_name: str\n        :param kwargs: Optional keyword arguments that\n            `BlockBlobService.create_blob_from_text()` takes.\n        :type kwargs: object\n        \"\"\"\n        # Reorder the argument order from airflow.hooks.S3_hook.Func.\n        arg_0.connection.create_blob_from_text(arg_2, arg_3,\n                                              arg_1, **arg_4)", "path": "airflow/contrib/hooks/wasb_hook.py", "identifier": "WasbHook.load_string", "docstring": "Upload a string to Azure Blob Storage.\n\n        :param string_data: String to load.\n        :type string_data: str\n        :param container_name: Name of the container.\n        :type container_name: str\n        :param blob_name: Name of the blob.\n        :type blob_name: str\n        :param kwargs: Optional keyword arguments that\n            `BlockBlobService.create_blob_from_text()` takes.\n        :type kwargs: object", "docstring_tokens": ["Upload", "a", "string", "to", "Azure", "Blob", "Storage", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260260}
{"url": "https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/validation.py#L34-L40", "sha": "a09d4e097e5599244564a2a7f0611e58efb4156a", "docstring_summary": "Validate request params.", "language": "python", "parameters": "(request)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'params'", "in", "arg_0", ":", "arg_1", "=", "isinstance", "(", "arg_0", "[", "'params'", "]", ",", "(", "list", ",", "dict", ")", ")", "arg_2", "=", "'Incorrect parameter values'", "assert", "arg_1", ",", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Validate request params.\"\"\"\n\n    if 'params' in arg_0:\n        arg_1 = isinstance(arg_0['params'], (list, dict))\n        arg_2 = 'Incorrect parameter values'\n        assert arg_1, arg_2", "path": "service_factory/validation.py", "identifier": "validate_params", "docstring": "Validate request params.", "docstring_tokens": ["Validate", "request", "params", "."], "nwo": "proofit404/service-factory", "score": 0.24979334806965703, "idx": 260261}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/records.py#L96-L107", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Get record revisions.", "language": "python", "parameters": "(recid, from_date)", "return_statement": "return run_sql(\n        'SELECT job_date, marcxml '\n        'FROM hstRECORD WHERE id_bibrec = %s AND job_date >= %s '\n        'ORDER BY job_date ASC', (recid, from_date),\n        run_on_slave=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "from", "invenio", ".", "dbquery", "import", "run_sql", "except", "ImportError", ":", "from", "invenio", ".", "legacy", ".", "dbquery", "import", "run_sql", "return", "run_sql", "(", "'SELECT job_date, marcxml '", "'FROM hstRECORD WHERE id_bibrec = %s AND job_date >= %s '", "'ORDER BY job_date ASC'", ",", "(", "arg_0", ",", "arg_1", ")", ",", "run_on_slave", "=", "True", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Get record revisions.\"\"\"\n    try:\n        from invenio.dbquery import run_sql\n    except ImportError:\n        from invenio.legacy.dbquery import run_sql\n\n    return run_sql(\n        'SELECT job_date, marcxml '\n        'FROM hstRECORD WHERE id_bibrec = %s AND job_date >= %s '\n        'ORDER BY job_date ASC', (arg_0, arg_1),\n        run_on_slave=True)", "path": "invenio_migrator/legacy/records.py", "identifier": "get_record_revisions", "docstring": "Get record revisions.", "docstring_tokens": ["Get", "record", "revisions", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 260262}
{"url": "https://github.com/bigdatacesga/kvstore/blob/8ad2222b39d47defc8ad30deda3da06798e2a9a4/kvstore.py#L60-L83", "sha": "8ad2222b39d47defc8ad30deda3da06798e2a9a4", "docstring_summary": "Recursively get the tree below the given key", "language": "python", "parameters": "(self, k, wait=False, wait_index=None, timeout='5m')", "return_statement": "return entries", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'5m'", ")", ":", "arg_1", "=", "arg_1", ".", "lstrip", "(", "'/'", ")", "arg_5", "=", "'{}/{}'", ".", "format", "(", "arg_0", ".", "endpoint", ",", "arg_1", ")", "arg_6", "=", "{", "}", "arg_6", "[", "'Func'", "]", "=", "'true'", "if", "arg_2", ":", "arg_6", "[", "'wait'", "]", "=", "arg_4", "if", "not", "arg_3", ":", "arg_6", "[", "'index'", "]", "=", "arg_0", ".", "index", "(", "arg_1", ",", "recursive", "=", "True", ")", "else", ":", "arg_6", "[", "'index'", "]", "=", "arg_3", "arg_7", "=", "requests", ".", "get", "(", "arg_5", ",", "arg_6", "=", "arg_6", ")", "if", "arg_7", ".", "status_code", "==", "404", ":", "raise", "KeyDoesNotExist", "(", "\"Key \"", "+", "arg_1", "+", "\" does not exist\"", ")", "if", "arg_7", ".", "status_code", "!=", "200", ":", "raise", "KVStoreError", "(", "'GET returned {}'", ".", "format", "(", "arg_7", ".", "status_code", ")", ")", "arg_8", "=", "{", "}", "for", "arg_9", "in", "arg_7", ".", "json", "(", ")", ":", "if", "arg_9", "[", "'Value'", "]", ":", "arg_8", "[", "arg_9", "[", "'Key'", "]", "]", "=", "base64", ".", "b64decode", "(", "arg_9", "[", "'Value'", "]", ")", "else", ":", "arg_8", "[", "arg_9", "[", "'Key'", "]", "]", "=", "''", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=None, arg_4='5m'):\n        \"\"\"Recursively get the tree below the given key\"\"\"\n        arg_1 = arg_1.lstrip('/')\n        arg_5 = '{}/{}'.format(arg_0.endpoint, arg_1)\n        arg_6 = {}\n        arg_6['Func'] = 'true'\n        if arg_2:\n            arg_6['wait'] = arg_4\n            if not arg_3:\n                arg_6['index'] = arg_0.index(arg_1, recursive=True)\n            else:\n                arg_6['index'] = arg_3\n        arg_7 = requests.get(arg_5, arg_6=arg_6)\n        if arg_7.status_code == 404:\n            raise KeyDoesNotExist(\"Key \" + arg_1 + \" does not exist\")\n        if arg_7.status_code != 200:\n            raise KVStoreError('GET returned {}'.format(arg_7.status_code))\n        arg_8 = {} \n        for arg_9 in arg_7.json():\n            if arg_9['Value']:\n                arg_8[arg_9['Key']] = base64.b64decode(arg_9['Value'])\n            else:\n                arg_8[arg_9['Key']] = ''\n        return arg_8", "path": "kvstore.py", "identifier": "Client.recurse", "docstring": "Recursively get the tree below the given key", "docstring_tokens": ["Recursively", "get", "the", "tree", "below", "the", "given", "key"], "nwo": "bigdatacesga/kvstore", "score": 0.23137166388621372, "idx": 260263}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L459-L465", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Retrieve the file paths stored under the base path.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "os", ".", "walk", "(", "arg_0", ".", "dirpath", ")", ":", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", "yield", "arg_5"], "function": "def Func(arg_0):\n        \"\"\"Retrieve the file paths stored under the base path.\"\"\"\n\n        for arg_1, arg_2, arg_3 in os.walk(arg_0.dirpath):\n            for arg_4 in arg_3:\n                arg_5 = os.path.join(arg_1, arg_4)\n                yield arg_5", "path": "perceval/archive.py", "identifier": "ArchiveManager._search_files", "docstring": "Retrieve the file paths stored under the base path.", "docstring_tokens": ["Retrieve", "the", "file", "paths", "stored", "under", "the", "base", "path", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260264}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/dtype_util.py#L142-L147", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns the number of bytes to represent this `dtype`.", "language": "python", "parameters": "(dtype)", "return_statement": "return np.dtype(dtype).itemsize", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "tf", ".", "as_dtype", "(", "arg_0", ")", "if", "hasattr", "(", "arg_0", ",", "'Func'", ")", ":", "return", "arg_0", ".", "Func", "return", "np", ".", "dtype", "(", "arg_0", ")", ".", "itemFunc"], "function": "def Func(arg_0):\n  \"\"\"Returns the number of bytes to represent this `dtype`.\"\"\"\n  arg_0 = tf.as_dtype(arg_0)\n  if hasattr(arg_0, 'Func'):\n    return arg_0.Func\n  return np.dtype(arg_0).itemFunc", "path": "tensorflow_probability/python/internal/dtype_util.py", "identifier": "size", "docstring": "Returns the number of bytes to represent this `dtype`.", "docstring_tokens": ["Returns", "the", "number", "of", "bytes", "to", "represent", "this", "dtype", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260265}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L175-L178", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Remove all operation nodes with the given name.", "language": "python", "parameters": "(self, opname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "named_nodes", "(", "arg_1", ")", ":", "arg_0", ".", "remove_op_node", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Remove all operation nodes with the given name.\"\"\"\n        for arg_2 in arg_0.named_nodes(arg_1):\n            arg_0.remove_op_node(arg_2)", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.remove_all_ops_named", "docstring": "Remove all operation nodes with the given name.", "docstring_tokens": ["Remove", "all", "operation", "nodes", "with", "the", "given", "name", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260266}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/autoregressive.py#L223-L257", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build transition matrix for an autoregressive StateSpaceModel.", "language": "python", "parameters": "(coefficients)", "return_statement": "return ar_matrix", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tf", ".", "expand_dims", "(", "arg_0", ",", "-", "2", ")", "arg_2", "=", "dist_util", ".", "prefer_static_shape", "(", "arg_0", ")", "arg_3", ",", "arg_4", "=", "arg_2", "[", ":", "-", "1", "]", ",", "arg_2", "[", "-", "1", "]", "arg_5", "=", "tf", ".", "concat", "(", "[", "tf", ".", "eye", "(", "arg_4", "-", "1", ",", "dtype", "=", "arg_0", ".", "dtype", ",", "arg_3", "=", "arg_3", ")", ",", "tf", ".", "zeros", "(", "tf", ".", "concat", "(", "[", "arg_3", ",", "(", "arg_4", "-", "1", ",", "1", ")", "]", ",", "axis", "=", "0", ")", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "]", ",", "axis", "=", "-", "1", ")", "arg_6", "=", "tf", ".", "concat", "(", "[", "arg_1", ",", "arg_5", "]", ",", "axis", "=", "-", "2", ")", "return", "arg_6"], "function": "def Func(arg_0):\n  \"\"\"Build transition matrix for an autoregressive StateSpaceModel.\n\n  When applied to a vector of previous values, this matrix computes\n  the expected new value (summing the previous states according to the\n  autoregressive coefficients) in the top dimension of the state space,\n  and moves all previous values down by one dimension, 'forgetting' the\n  final (least recent) value. That is, it looks like this:\n\n  ```\n  ar_matrix = [ coefs[0], coefs[1], ..., coefs[order]\n                1.,       0 ,       ..., 0.\n                0.,       1.,       ..., 0.\n                ...\n                0.,       0.,  ..., 1.,  0.            ]\n  ```\n\n  Args:\n    coefficients: float `Tensor` of shape `concat([batch_shape, [order]])`.\n\n  Returns:\n    ar_matrix: float `Tensor` with shape `concat([batch_shape,\n    [order, order]])`.\n  \"\"\"\n\n  arg_1 = tf.expand_dims(arg_0, -2)\n  arg_2 = dist_util.prefer_static_shape(arg_0)\n  arg_3, arg_4 = arg_2[:-1], arg_2[-1]\n  arg_5 = tf.concat([\n      tf.eye(arg_4 - 1, dtype=arg_0.dtype, arg_3=arg_3),\n      tf.zeros(tf.concat([arg_3, (arg_4 - 1, 1)], axis=0),\n               dtype=arg_0.dtype)\n  ], axis=-1)\n  arg_6 = tf.concat([arg_1, arg_5], axis=-2)\n  return arg_6", "path": "tensorflow_probability/python/sts/autoregressive.py", "identifier": "make_ar_transition_matrix", "docstring": "Build transition matrix for an autoregressive StateSpaceModel.\n\n  When applied to a vector of previous values, this matrix computes\n  the expected new value (summing the previous states according to the\n  autoregressive coefficients) in the top dimension of the state space,\n  and moves all previous values down by one dimension, 'forgetting' the\n  final (least recent) value. That is, it looks like this:\n\n  ```\n  ar_matrix = [ coefs[0], coefs[1], ..., coefs[order]\n                1.,       0 ,       ..., 0.\n                0.,       1.,       ..., 0.\n                ...\n                0.,       0.,  ..., 1.,  0.            ]\n  ```\n\n  Args:\n    coefficients: float `Tensor` of shape `concat([batch_shape, [order]])`.\n\n  Returns:\n    ar_matrix: float `Tensor` with shape `concat([batch_shape,\n    [order, order]])`.", "docstring_tokens": ["Build", "transition", "matrix", "for", "an", "autoregressive", "StateSpaceModel", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260267}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L213-L215", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return all module nodes in the diagram", "language": "python", "parameters": "(self)", "return_statement": "return [o for o in self.objects if isinstance(o.node, astroid.Module)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "arg_1", "for", "arg_1", "in", "arg_0", ".", "objects", "if", "isinstance", "(", "arg_1", ".", "node", ",", "astroid", ".", "Module", ")", "]"], "function": "def Func(arg_0):\n        \"\"\"return all module nodes in the diagram\"\"\"\n        return [arg_1 for arg_1 in arg_0.objects if isinstance(arg_1.node, astroid.Module)]", "path": "pylint/pyreverse/diagrams.py", "identifier": "PackageDiagram.modules", "docstring": "return all module nodes in the diagram", "docstring_tokens": ["return", "all", "module", "nodes", "in", "the", "diagram"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260268}
{"url": "https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L599-L609", "sha": "3769aecbef6c83b6cd93ee72ece478ffe433ac57", "docstring_summary": "Grabs readable PNG file pointer", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Request", "(", "str", "(", "arg_0", ")", ")", "try", ":", "return", "Func", "(", "arg_1", ")", "except", "HTTPError", ":", "_print", "(", "'The server couldn\\'t fulfill the request.'", ")", "except", "URLError", ":", "_print", "(", "'We failed to reach a server.'", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Grabs readable PNG file pointer\n        \"\"\"\n        arg_1 = Request(str(arg_0))\n        try:\n            return Func(arg_1)\n        except HTTPError:\n            _print('The server couldn\\'t fulfill the request.')\n        except URLError:\n            _print('We failed to reach a server.')", "path": "GChartWrapper/GChart.py", "identifier": "GChart.urlopen", "docstring": "Grabs readable PNG file pointer", "docstring_tokens": ["Grabs", "readable", "PNG", "file", "pointer"], "nwo": "appknox/google-chartwrapper", "score": 0.12050106452410352, "idx": 260269}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/deep_exponential_family.py#L178-L231", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Loads NIPS 2011 conference papers.", "language": "python", "parameters": "(path)", "return_statement": "return bag_of_words, words", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", "arg_1", "=", "\"NIPS_1987-2015.csv\"", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_1", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "arg_3", "=", "(", "\"https://archive.ics.uci.edu/ml/machine-learning-databases/\"", "\"00371/NIPS_1987-2015.csv\"", ")", "if", "not", "tf", ".", "io", ".", "gfile", ".", "exists", "(", "arg_0", ")", ":", "tf", ".", "io", ".", "gfile", ".", "makedirs", "(", "arg_0", ")", "print", "(", "\"Downloading %s to %s\"", "%", "(", "arg_3", ",", "arg_2", ")", ")", "urllib", ".", "request", ".", "urlretrieve", "(", "arg_3", ",", "arg_2", ")", "with", "open", "(", "arg_2", ")", "as", "f", ":", "arg_4", "=", "csv", ".", "reader", "(", "f", ")", "arg_5", "=", "next", "(", "arg_4", ")", "[", "1", ":", "]", "arg_6", "=", "[", "]", "arg_7", "=", "[", "]", "for", "arg_8", "in", "arg_4", ":", "arg_6", ".", "append", "(", "arg_8", "[", "0", "]", ")", "arg_7", ".", "append", "(", "arg_8", "[", "1", ":", "]", ")", "arg_7", "=", "np", ".", "array", "(", "arg_7", ",", "dtype", "=", "np", ".", "int", ")", "arg_9", "=", "[", "i", "for", "i", ",", "document", "in", "enumerate", "(", "arg_5", ")", "if", "document", ".", "startswith", "(", "\"2011\"", ")", "]", "arg_5", "=", "[", "arg_5", "[", "doc", "]", "for", "doc", "in", "arg_9", "]", "arg_7", "=", "arg_7", "[", ":", ",", "arg_9", "]", "arg_10", "=", "np", ".", "logical_and", "(", "np", ".", "sum", "(", "arg_7", "!=", "0", ",", "1", ")", ">=", "2", ",", "np", ".", "sum", "(", "arg_7", ",", "1", ")", ">=", "10", ")", "arg_6", "=", "[", "word", "for", "word", ",", "idx", "in", "zip", "(", "arg_6", ",", "arg_10", ")", "if", "idx", "]", "arg_11", "=", "arg_7", "[", "arg_10", ",", ":", "]", ".", "T", "return", "arg_11", ",", "arg_6"], "function": "def Func(arg_0):\n  \"\"\"Loads NIPS 2011 conference papers.\n\n  The NIPS 1987-2015 data set is in the form of a 11,463 x 5,812 matrix of\n  per-paper word counts, containing 11,463 words and 5,811 NIPS conference\n  papers (Perrone et al., 2016). We subset to papers in 2011 and words appearing\n  in at least two documents and having a total word count of at least 10.\n\n  Built from the Observations Python package.\n\n  Args:\n    path: str.\n      Path to directory which either stores file or otherwise file will\n      be downloaded and extracted there. Filename is `NIPS_1987-2015.csv`.\n\n  Returns:\n    bag_of_words: np.ndarray of shape [num_documents, num_words]. Each element\n      denotes the number of occurrences of a specific word in a specific\n      document.\n    words: List of strings, denoting the words for `bag_of_words`'s columns.\n  \"\"\"\n  arg_0 = os.path.expanduser(arg_0)\n  arg_1 = \"NIPS_1987-2015.csv\"\n  arg_2 = os.path.join(arg_0, arg_1)\n  if not os.path.exists(arg_2):\n    arg_3 = (\"https://archive.ics.uci.edu/ml/machine-learning-databases/\"\n           \"00371/NIPS_1987-2015.csv\")\n    if not tf.io.gfile.exists(arg_0):\n      tf.io.gfile.makedirs(arg_0)\n    print(\"Downloading %s to %s\" % (arg_3, arg_2))\n    urllib.request.urlretrieve(arg_3, arg_2)\n\n  with open(arg_2) as f:\n    arg_4 = csv.reader(f)\n    arg_5 = next(arg_4)[1:]\n    arg_6 = []\n    arg_7 = []\n    for arg_8 in arg_4:\n      arg_6.append(arg_8[0])\n      arg_7.append(arg_8[1:])\n\n  arg_7 = np.array(arg_7, dtype=np.int)\n\n  # Subset to documents in 2011 and words appearing in at least two documents\n  # and have a total word count of at least 10.\n  arg_9 = [i for i, document in enumerate(arg_5)\n             if document.startswith(\"2011\")]\n  arg_5 = [arg_5[doc] for doc in arg_9]\n  arg_7 = arg_7[:, arg_9]\n  arg_10 = np.logical_and(np.sum(arg_7 != 0, 1) >= 2,\n                            np.sum(arg_7, 1) >= 10)\n  arg_6 = [word for word, idx in zip(arg_6, arg_10) if idx]\n  arg_11 = arg_7[arg_10, :].T\n  return arg_11, arg_6", "path": "tensorflow_probability/examples/deep_exponential_family.py", "identifier": "load_nips2011_papers", "docstring": "Loads NIPS 2011 conference papers.\n\n  The NIPS 1987-2015 data set is in the form of a 11,463 x 5,812 matrix of\n  per-paper word counts, containing 11,463 words and 5,811 NIPS conference\n  papers (Perrone et al., 2016). We subset to papers in 2011 and words appearing\n  in at least two documents and having a total word count of at least 10.\n\n  Built from the Observations Python package.\n\n  Args:\n    path: str.\n      Path to directory which either stores file or otherwise file will\n      be downloaded and extracted there. Filename is `NIPS_1987-2015.csv`.\n\n  Returns:\n    bag_of_words: np.ndarray of shape [num_documents, num_words]. Each element\n      denotes the number of occurrences of a specific word in a specific\n      document.\n    words: List of strings, denoting the words for `bag_of_words`'s columns.", "docstring_tokens": ["Loads", "NIPS", "2011", "conference", "papers", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260270}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L224-L238", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "A subclass can override this method to provide additional parseing or\n        validation. It should call the parent method first.", "language": "python", "parameters": "(self, bpmn, filename)", "return_statement": "return bpmn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", "=", "arg_0", ".", "_call_editor_hook", "(", "'Func'", ",", "arg_1", ",", "arg_2", ")", "or", "arg_1", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        A subclass can override this method to provide additional parseing or\n        validation. It should call the parent method first.\n\n        :param bpmn: an lxml tree of the bpmn content\n\n        :param filename: the source file name\n\n        This must return the updated bpmn object (or a replacement)\n        \"\"\"\n        arg_1 = arg_0._call_editor_hook(\n            'Func', arg_1, arg_2) or arg_1\n\n        return arg_1", "path": "SpiffWorkflow/bpmn/serializer/Packager.py", "identifier": "Packager.pre_parse_and_validate", "docstring": "A subclass can override this method to provide additional parseing or\n        validation. It should call the parent method first.\n\n        :param bpmn: an lxml tree of the bpmn content\n\n        :param filename: the source file name\n\n        This must return the updated bpmn object (or a replacement)", "docstring_tokens": ["A", "subclass", "can", "override", "this", "method", "to", "provide", "additional", "parseing", "or", "validation", ".", "It", "should", "call", "the", "parent", "method", "first", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 260271}
{"url": "https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L211-L233", "sha": "212cfe1791a4aab4783f99b665cc32da6437f419", "docstring_summary": "Go to the next exercise.", "language": "python", "parameters": "(course, num=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "arg_2", "=", "None", "try", ":", "arg_2", "=", "Exercise", ".", "get_selected", "(", ")", "if", "arg_2", ".", "course", ".", "tid", "!=", "arg_0", ".", "tid", ":", "arg_2", "=", "None", "except", "NoExerciseSelected", ":", "pass", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "exercises", ".", "first", "(", ")", "else", ":", "try", ":", "arg_2", "=", "Exercise", ".", "get", "(", "Exercise", ".", "id", "==", "arg_2", ".", "id", "+", "arg_1", ")", "except", "peewee", ".", "DoesNotExist", ":", "print", "(", "\"There are no more exercises in this course.\"", ")", "return", "False", "arg_2", ".", "set_select", "(", ")", "list_all", "(", "single", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=1):\n    \"\"\"\n    Go to the next exercise.\n    \"\"\"\n    arg_2 = None\n    try:\n        arg_2 = Exercise.get_selected()\n        if arg_2.course.tid != arg_0.tid:\n            arg_2 = None\n    except NoExerciseSelected:\n        pass\n\n    if arg_2 is None:\n        arg_2 = arg_0.exercises.first()\n    else:\n        try:\n            arg_2 = Exercise.get(Exercise.id == arg_2.id + arg_1)\n        except peewee.DoesNotExist:\n            print(\"There are no more exercises in this course.\")\n            return False\n\n    arg_2.set_select()\n    list_all(single=arg_2)", "path": "tmc/__main__.py", "identifier": "skip", "docstring": "Go to the next exercise.", "docstring_tokens": ["Go", "to", "the", "next", "exercise", "."], "nwo": "minttu/tmc.py", "score": 0.09252797783733271, "idx": 260272}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/checkpoint.py#L157-L187", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Save checkpoint to file.", "language": "python", "parameters": "(model, filename, optimizer=None, meta=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "{", "}", "elif", "not", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "raise", "TypeError", "(", "'meta must be a dict or None, but got {}'", ".", "format", "(", "type", "(", "arg_3", ")", ")", ")", "arg_3", ".", "update", "(", "mmcv_version", "=", "mmcv", ".", "__version__", ",", "time", "=", "time", ".", "asctime", "(", ")", ")", "mmcv", ".", "mkdir_or_exist", "(", "osp", ".", "dirname", "(", "arg_1", ")", ")", "if", "hasattr", "(", "arg_0", ",", "'module'", ")", ":", "arg_0", "=", "arg_0", ".", "module", "arg_4", "=", "{", "'meta'", ":", "arg_3", ",", "'state_dict'", ":", "weights_to_cpu", "(", "arg_0", ".", "state_dict", "(", ")", ")", "}", "if", "arg_2", "is", "not", "None", ":", "arg_4", "[", "'optimizer'", "]", "=", "arg_2", ".", "state_dict", "(", ")", "torch", ".", "save", "(", "arg_4", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"Save checkpoint to file.\n\n    The checkpoint will have 3 fields: ``meta``, ``state_dict`` and\n    ``optimizer``. By default ``meta`` will contain version and time info.\n\n    Args:\n        model (Module): Module whose params are to be saved.\n        filename (str): Checkpoint filename.\n        optimizer (:obj:`Optimizer`, optional): Optimizer to be saved.\n        meta (dict, optional): Metadata to be saved in checkpoint.\n    \"\"\"\n    if arg_3 is None:\n        arg_3 = {}\n    elif not isinstance(arg_3, dict):\n        raise TypeError('meta must be a dict or None, but got {}'.format(\n            type(arg_3)))\n    arg_3.update(mmcv_version=mmcv.__version__, time=time.asctime())\n\n    mmcv.mkdir_or_exist(osp.dirname(arg_1))\n    if hasattr(arg_0, 'module'):\n        arg_0 = arg_0.module\n\n    arg_4 = {\n        'meta': arg_3,\n        'state_dict': weights_to_cpu(arg_0.state_dict())\n    }\n    if arg_2 is not None:\n        arg_4['optimizer'] = arg_2.state_dict()\n\n    torch.save(arg_4, arg_1)", "path": "mmcv/runner/checkpoint.py", "identifier": "save_checkpoint", "docstring": "Save checkpoint to file.\n\n    The checkpoint will have 3 fields: ``meta``, ``state_dict`` and\n    ``optimizer``. By default ``meta`` will contain version and time info.\n\n    Args:\n        model (Module): Module whose params are to be saved.\n        filename (str): Checkpoint filename.\n        optimizer (:obj:`Optimizer`, optional): Optimizer to be saved.\n        meta (dict, optional): Metadata to be saved in checkpoint.", "docstring_tokens": ["Save", "checkpoint", "to", "file", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260273}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L855-L934", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check method arguments, overriding", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "is_method", "(", ")", ":", "return", "arg_0", ".", "_check_useless_super_delegation", "(", "arg_1", ")", "arg_2", "=", "arg_1", ".", "parent", ".", "frame", "(", ")", "arg_0", ".", "_meth_could_be_func", "=", "True", "arg_0", ".", "_check_first_arg_for_type", "(", "arg_1", ",", "arg_2", ".", "type", "==", "\"metaclass\"", ")", "if", "arg_1", ".", "name", "==", "\"__init__\"", ":", "arg_0", ".", "_check_init", "(", "arg_1", ")", "return", "for", "arg_4", "in", "arg_2", ".", "local_attr_ancestors", "(", "arg_1", ".", "name", ")", ":", "try", ":", "arg_5", "=", "arg_4", "[", "arg_1", ".", "name", "]", "except", "KeyError", ":", "continue", "if", "not", "isinstance", "(", "arg_5", ",", "astroid", ".", "FunctionDef", ")", ":", "continue", "arg_0", ".", "_check_signature", "(", "arg_1", ",", "arg_5", ",", "\"overridden\"", ",", "arg_2", ")", "break", "if", "arg_1", ".", "decorators", ":", "for", "arg_6", "in", "arg_1", ".", "decorators", ".", "nodes", ":", "if", "isinstance", "(", "arg_6", ",", "astroid", ".", "Attribute", ")", "and", "arg_6", ".", "attrname", "in", "(", "\"getter\"", ",", "\"setter\"", ",", "\"deleter\"", ",", ")", ":", "return", "if", "isinstance", "(", "arg_6", ",", "astroid", ".", "Name", ")", ":", "if", "arg_6", ".", "name", "==", "\"property\"", ":", "return", "arg_7", "=", "safe_infer", "(", "arg_6", ")", "if", "not", "arg_7", ":", "return", "if", "isinstance", "(", "arg_7", ",", "astroid", ".", "FunctionDef", ")", ":", "try", ":", "arg_7", "=", "next", "(", "arg_7", ".", "infer_call_result", "(", "arg_7", ")", ")", "except", "astroid", ".", "InferenceError", ":", "return", "try", ":", "if", "(", "isinstance", "(", "arg_7", ",", "(", "astroid", ".", "Instance", ",", "astroid", ".", "ClassDef", ")", ")", "and", "arg_7", ".", "getattr", "(", "\"__get__\"", ")", "and", "arg_7", ".", "getattr", "(", "\"__set__\"", ")", ")", ":", "return", "except", "astroid", ".", "AttributeInferenceError", ":", "pass", "try", ":", "arg_4", "=", "arg_2", ".", "instance_attr", "(", "arg_1", ".", "name", ")", "[", "0", "]", "arg_8", "=", "arg_4", ".", "frame", "(", ")", "if", "(", "isinstance", "(", "arg_8", ",", "astroid", ".", "FunctionDef", ")", "and", "arg_8", ".", "type", "==", "\"method\"", ")", ":", "arg_8", "=", "arg_8", ".", "parent", ".", "frame", "(", ")", "if", "isinstance", "(", "arg_8", ",", "astroid", ".", "ClassDef", ")", "and", "arg_2", ".", "is_subtype_of", "(", "arg_8", ".", "qname", "(", ")", ")", ":", "arg_9", "=", "(", "arg_4", ".", "root", "(", ")", ".", "name", ",", "arg_4", ".", "fromlineno", ")", "arg_0", ".", "add_message", "(", "\"method-hidden\"", ",", "arg_9", "=", "arg_9", ",", "arg_1", "=", "arg_1", ")", "except", "astroid", ".", "NotFoundError", ":", "pass"], "function": "def Func(arg_0, arg_1):\n        \"\"\"check method arguments, overriding\"\"\"\n        # ignore actual functions\n        if not arg_1.is_method():\n            return\n\n        arg_0._check_useless_super_delegation(arg_1)\n\n        arg_2 = arg_1.parent.frame()\n        arg_0._meth_could_be_func = True\n        # check first argument is self if this is actually a method\n        arg_0._check_first_arg_for_type(arg_1, arg_2.type == \"metaclass\")\n        if arg_1.name == \"__init__\":\n            arg_0._check_init(arg_1)\n            return\n        # check signature if the method overloads inherited method\n        for arg_4 in arg_2.local_attr_ancestors(arg_1.name):\n            # get astroid for the searched method\n            try:\n                arg_5 = arg_4[arg_1.name]\n            except KeyError:\n                # we have found the method but it's not in the local\n                # dictionary.\n                # This may happen with astroid build from living objects\n                continue\n            if not isinstance(arg_5, astroid.FunctionDef):\n                continue\n            arg_0._check_signature(arg_1, arg_5, \"overridden\", arg_2)\n            break\n        if arg_1.decorators:\n            for arg_6 in arg_1.decorators.nodes:\n                if isinstance(arg_6, astroid.Attribute) and arg_6.attrname in (\n                    \"getter\",\n                    \"setter\",\n                    \"deleter\",\n                ):\n                    # attribute affectation will call this method, not hiding it\n                    return\n                if isinstance(arg_6, astroid.Name):\n                    if arg_6.name == \"property\":\n                        # attribute affectation will either call a setter or raise\n                        # an attribute error, anyway not hiding the function\n                        return\n\n                # Infer the decorator and see if it returns something useful\n                arg_7 = safe_infer(arg_6)\n                if not arg_7:\n                    return\n                if isinstance(arg_7, astroid.FunctionDef):\n                    # Okay, it's a decorator, let's see what it can infer.\n                    try:\n                        arg_7 = next(arg_7.infer_call_result(arg_7))\n                    except astroid.InferenceError:\n                        return\n                try:\n                    if (\n                        isinstance(arg_7, (astroid.Instance, astroid.ClassDef))\n                        and arg_7.getattr(\"__get__\")\n                        and arg_7.getattr(\"__set__\")\n                    ):\n                        return\n                except astroid.AttributeInferenceError:\n                    pass\n\n        # check if the method is hidden by an attribute\n        try:\n            arg_4 = arg_2.instance_attr(arg_1.name)[0]  # XXX\n            arg_8 = arg_4.frame()\n            if (\n                isinstance(arg_8, astroid.FunctionDef)\n                and arg_8.type == \"method\"\n            ):\n                arg_8 = arg_8.parent.frame()\n            if isinstance(arg_8, astroid.ClassDef) and arg_2.is_subtype_of(\n                arg_8.qname()\n            ):\n                arg_9 = (arg_4.root().name, arg_4.fromlineno)\n                arg_0.add_message(\"method-hidden\", arg_9=arg_9, arg_1=arg_1)\n        except astroid.NotFoundError:\n            pass", "path": "pylint/checkers/classes.py", "identifier": "ClassChecker.visit_functiondef", "docstring": "check method arguments, overriding", "docstring_tokens": ["check", "method", "arguments", "overriding"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260274}
{"url": "https://github.com/PiotrDabkowski/Js2Py/blob/c0fa43f5679cf91ca8986c5747fcb07a433dc584/js2py/legecy_translators/constants.py#L52-L68", "sha": "c0fa43f5679cf91ca8986c5747fcb07a433dc584", "docstring_summary": "returns end of exponential, raises SyntaxError if failed", "language": "python", "parameters": "(source, start)", "return_statement": "return start", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", "[", "arg_1", "]", "in", "{", "'e'", ",", "'E'", "}", ":", "if", "arg_0", "[", "arg_1", "]", "in", "IDENTIFIER_PART", ":", "raise", "SyntaxError", "(", "'Invalid number literal!'", ")", "return", "arg_1", "arg_1", "+=", "1", "if", "arg_0", "[", "arg_1", "]", "in", "{", "'-'", ",", "'+'", "}", ":", "arg_1", "+=", "1", "arg_2", "=", "False", "while", "arg_0", "[", "arg_1", "]", "in", "NUMS", ":", "arg_2", "=", "True", "arg_1", "+=", "1", "if", "not", "arg_2", "or", "arg_0", "[", "arg_1", "]", "in", "IDENTIFIER_PART", ":", "raise", "SyntaxError", "(", "'Invalid number literal!'", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"returns end of exponential, raises SyntaxError if failed\"\"\"\n    if not arg_0[arg_1] in {'e', 'E'}:\n        if arg_0[arg_1] in IDENTIFIER_PART:\n            raise SyntaxError('Invalid number literal!')\n        return arg_1\n    arg_1 += 1\n    if arg_0[arg_1] in {'-', '+'}:\n        arg_1 += 1\n    arg_2 = False\n    # we need at least one dig after exponent\n    while arg_0[arg_1] in NUMS:\n        arg_2 = True\n        arg_1 += 1\n    if not arg_2 or arg_0[arg_1] in IDENTIFIER_PART:\n        raise SyntaxError('Invalid number literal!')\n    return arg_1", "path": "js2py/legecy_translators/constants.py", "identifier": "parse_exponent", "docstring": "returns end of exponential, raises SyntaxError if failed", "docstring_tokens": ["returns", "end", "of", "exponential", "raises", "SyntaxError", "if", "failed"], "nwo": "PiotrDabkowski/Js2Py", "score": 0.9574891118982609, "idx": 260275}
{"url": "https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/outstation.py#L84-L92", "sha": "5bcd8240d1fc0aa1579e71f2efcab63b4c61c547", "docstring_summary": "Set up the OpenDNP3 configuration.", "language": "python", "parameters": "()", "return_statement": "return stack_config", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "asiodnp3", ".", "OutstationStackConfig", "(", "opendnp3", ".", "DatabaseSizes", ".", "AllTypes", "(", "10", ")", ")", "arg_0", ".", "outstation", ".", "eventBufferConfig", "=", "opendnp3", ".", "EventBufferConfig", "(", ")", ".", "AllTypes", "(", "10", ")", "arg_0", ".", "outstation", ".", "params", ".", "allowUnsolicited", "=", "True", "arg_0", ".", "link", ".", "LocalAddr", "=", "10", "arg_0", ".", "link", ".", "RemoteAddr", "=", "1", "arg_0", ".", "link", ".", "KeepAliveTimeout", "=", "openpal", ".", "TimeDuration", "(", ")", ".", "Max", "(", ")", "return", "arg_0"], "function": "def Func():\n        \"\"\"Set up the OpenDNP3 configuration.\"\"\"\n        arg_0 = asiodnp3.OutstationStackConfig(opendnp3.DatabaseSizes.AllTypes(10))\n        arg_0.outstation.eventBufferConfig = opendnp3.EventBufferConfig().AllTypes(10)\n        arg_0.outstation.params.allowUnsolicited = True\n        arg_0.link.LocalAddr = 10\n        arg_0.link.RemoteAddr = 1\n        arg_0.link.KeepAliveTimeout = openpal.TimeDuration().Max()\n        return arg_0", "path": "examples/outstation.py", "identifier": "OutstationApplication.configure_stack", "docstring": "Set up the OpenDNP3 configuration.", "docstring_tokens": ["Set", "up", "the", "OpenDNP3", "configuration", "."], "nwo": "ChargePoint/pydnp3", "score": 0.6403780379231505, "idx": 260276}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/configparsing.py#L61-L67", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Collects all info from three sections", "language": "python", "parameters": "(self)", "return_statement": "return kwargs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_2", "=", "(", "'storage_service'", ",", "'trajectory'", ",", "'environment'", ")", "for", "arg_3", "in", "arg_2", ":", "arg_1", ".", "update", "(", "arg_0", ".", "_collect_section", "(", "arg_3", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Collects all info from three sections\"\"\"\n        arg_1 = {}\n        arg_2 = ('storage_service', 'trajectory', 'environment')\n        for arg_3 in arg_2:\n            arg_1.update(arg_0._collect_section(arg_3))\n        return arg_1", "path": "pypet/utils/configparsing.py", "identifier": "ConfigInterpreter._collect_config", "docstring": "Collects all info from three sections", "docstring_tokens": ["Collects", "all", "info", "from", "three", "sections"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260277}
{"url": "https://github.com/SmBe19/praw-OAuth2Util/blob/ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe/OAuth2Util/OAuth2Util.py#L274-L284", "sha": "ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe", "docstring_summary": "Check whether the tokens are set and request new ones if not", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "_get_value", "(", "CONFIGKEY_TOKEN", ")", "arg_0", ".", "_get_value", "(", "CONFIGKEY_REFRESH_TOKEN", ")", "arg_0", ".", "_get_value", "(", "CONFIGKEY_REFRESHABLE", ")", "except", "KeyError", ":", "arg_0", ".", "_log", "(", "\"Request new Token (CTP)\"", ")", "arg_0", ".", "_get_new_access_information", "(", ")"], "function": "def Func(arg_0):\n\t\t\"\"\"\n\t\tCheck whether the tokens are set and request new ones if not\n\t\t\"\"\"\n\t\ttry:\n\t\t\targ_0._get_value(CONFIGKEY_TOKEN)\n\t\t\targ_0._get_value(CONFIGKEY_REFRESH_TOKEN)\n\t\t\targ_0._get_value(CONFIGKEY_REFRESHABLE)\n\t\texcept KeyError:\n\t\t\targ_0._log(\"Request new Token (CTP)\")\n\t\t\targ_0._get_new_access_information()", "path": "OAuth2Util/OAuth2Util.py", "identifier": "OAuth2Util._check_token_present", "docstring": "Check whether the tokens are set and request new ones if not", "docstring_tokens": ["Check", "whether", "the", "tokens", "are", "set", "and", "request", "new", "ones", "if", "not"], "nwo": "SmBe19/praw-OAuth2Util", "score": 0.28581547167654664, "idx": 260278}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L98-L112", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Returns filtering parameters to limit a search to the children\n        of a particular node by a particular relationship.", "language": "python", "parameters": "(self, parent, relationship, **kwargs)", "return_statement": "return parent_filter_kwargs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_1", "is", "None", "or", "arg_2", "is", "None", ":", "return", "{", "}", "arg_4", "=", "{", "}", "arg_5", "=", "(", "(", "arg_0", ".", "_reverse_rel_name", "(", "arg_2", ")", ",", "arg_1", ")", ",", ")", "arg_4", "[", "'query'", "]", "=", "arg_5", "if", "arg_3", ".", "get", "(", "'workflow_job_template'", ",", "None", ")", "is", "None", ":", "arg_6", "=", "arg_0", ".", "read", "(", "pk", "=", "arg_1", ")", "[", "'results'", "]", "[", "0", "]", "arg_4", "[", "'workflow_job_template'", "]", "=", "arg_6", "[", "'workflow_job_template'", "]", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"\n        Returns filtering parameters to limit a search to the children\n        of a particular node by a particular relationship.\n        \"\"\"\n        if arg_1 is None or arg_2 is None:\n            return {}\n        arg_4 = {}\n        arg_5 = ((arg_0._reverse_rel_name(arg_2), arg_1),)\n        arg_4['query'] = arg_5\n        if arg_3.get('workflow_job_template', None) is None:\n            arg_6 = arg_0.read(pk=arg_1)['results'][0]\n            arg_4['workflow_job_template'] = arg_6[\n                'workflow_job_template']\n        return arg_4", "path": "tower_cli/resources/node.py", "identifier": "Resource._parent_filter", "docstring": "Returns filtering parameters to limit a search to the children\n        of a particular node by a particular relationship.", "docstring_tokens": ["Returns", "filtering", "parameters", "to", "limit", "a", "search", "to", "the", "children", "of", "a", "particular", "node", "by", "a", "particular", "relationship", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 260279}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/connection_scan_profile.py#L157-L164", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "A helper method for scanning the footpaths. Updates self._stop_profiles accordingly", "language": "python", "parameters": "(self, connection_dep_stop, connection_dep_time, arrival_time_target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "arg_0", ".", "_walk_network", ".", "edges_iter", "(", "nbunch", "=", "[", "arg_1", "]", ",", "arg_6", "=", "True", ")", ":", "arg_7", "=", "arg_6", "[", "'d_walk'", "]", "arg_8", "=", "arg_2", "-", "arg_7", "/", "arg_0", ".", "_walk_speed", "arg_9", "=", "LabelTimeSimple", "(", "departure_time", "=", "arg_8", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_stop_profiles", "[", "arg_5", "]", ".", "update_pareto_optimal_tuples", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" A helper method for scanning the footpaths. Updates self._stop_profiles accordingly\"\"\"\n        for arg_4, arg_5, arg_6 in arg_0._walk_network.edges_iter(nbunch=[arg_1],\n                                                               arg_6=True):\n            arg_7 = arg_6['d_walk']\n            arg_8 = arg_2 - arg_7 / arg_0._walk_speed\n            arg_9 = LabelTimeSimple(departure_time=arg_8, arg_3=arg_3)\n            arg_0._stop_profiles[arg_5].update_pareto_optimal_tuples(arg_9)", "path": "gtfspy/routing/connection_scan_profile.py", "identifier": "ConnectionScanProfiler._scan_footpaths_to_departure_stop", "docstring": "A helper method for scanning the footpaths. Updates self._stop_profiles accordingly", "docstring_tokens": ["A", "helper", "method", "for", "scanning", "the", "footpaths", ".", "Updates", "self", ".", "_stop_profiles", "accordingly"], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 260280}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/merger_models.py#L29-L50", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "initialize the merger model with a coalescent time", "language": "python", "parameters": "(self, Tc, T=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "Iterable", ")", ":", "if", "len", "(", "arg_1", ")", "==", "len", "(", "arg_2", ")", ":", "arg_3", "=", "np", ".", "concatenate", "(", "(", "[", "-", "ttconf", ".", "BIG_NUMBER", "]", ",", "arg_2", ",", "[", "ttconf", ".", "BIG_NUMBER", "]", ")", ")", "arg_4", "=", "np", ".", "concatenate", "(", "(", "[", "arg_1", "[", "0", "]", "]", ",", "arg_1", ",", "[", "arg_1", "[", "-", "1", "]", "]", ")", ")", "arg_0", ".", "Tc", "=", "interp1d", "(", "arg_3", ",", "arg_4", ")", "else", ":", "arg_0", ".", "logger", "(", "\"need Tc values and Timepoints of equal length\"", ",", "2", ",", "warn", "=", "True", ")", "arg_0", ".", "Tc", "=", "interp1d", "(", "[", "-", "ttconf", ".", "BIG_NUMBER", ",", "ttconf", ".", "BIG_NUMBER", "]", ",", "[", "1e-5", ",", "1e-5", "]", ")", "else", ":", "arg_0", ".", "Tc", "=", "interp1d", "(", "[", "-", "ttconf", ".", "BIG_NUMBER", ",", "ttconf", ".", "BIG_NUMBER", "]", ",", "[", "arg_1", "+", "ttconf", ".", "TINY_NUMBER", ",", "arg_1", "+", "ttconf", ".", "TINY_NUMBER", "]", ")", "arg_0", ".", "calc_integral_merger_rate", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        '''\n        initialize the merger model with a coalescent time\n\n        Args:\n            - Tc:   a float or an iterable, if iterable another argument T of same shape is required\n            - T:    an array like of same shape as Tc that specifies the time pivots corresponding to Tc\n        Returns:\n            - None\n        '''\n        if isinstance(arg_1, Iterable):\n            if len(arg_1)==len(arg_2):\n                arg_3 = np.concatenate(([-ttconf.BIG_NUMBER], arg_2, [ttconf.BIG_NUMBER]))\n                arg_4 = np.concatenate(([arg_1[0]], arg_1, [arg_1[-1]]))\n                arg_0.Tc = interp1d(arg_3,arg_4)\n            else:\n                arg_0.logger(\"need Tc values and Timepoints of equal length\",2,warn=True)\n                arg_0.Tc = interp1d([-ttconf.BIG_NUMBER, ttconf.BIG_NUMBER], [1e-5, 1e-5])\n        else:\n            arg_0.Tc = interp1d([-ttconf.BIG_NUMBER, ttconf.BIG_NUMBER],\n                               [arg_1+ttconf.TINY_NUMBER, arg_1+ttconf.TINY_NUMBER])\n        arg_0.calc_integral_merger_rate()", "path": "treetime/merger_models.py", "identifier": "Coalescent.set_Tc", "docstring": "initialize the merger model with a coalescent time\n\n        Args:\n            - Tc:   a float or an iterable, if iterable another argument T of same shape is required\n            - T:    an array like of same shape as Tc that specifies the time pivots corresponding to Tc\n        Returns:\n            - None", "docstring_tokens": ["initialize", "the", "merger", "model", "with", "a", "coalescent", "time"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 260281}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/gui/gtk_input_device.py#L60-L74", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Return a dict in the form of", "language": "python", "parameters": "(self)", "return_statement": "return kdict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "dir", "(", "Gdk", ")", ":", "arg_3", "=", "arg_2", ".", "upper", "(", ")", "arg_1", "[", "arg_3", "]", "=", "getattr", "(", "Gdk", ",", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        '''\n        Return a dict in the form of\n\n        SHOEBOT_KEY_NAME, GTK_VALUE\n\n        Shoebot key names look like KEY_LEFT, whereas Gdk uses KEY_Left\n        - Shoebot key names are derived from Nodebox 1, which was a mac\n          app.\n        '''\n        arg_1 = {}\n        for arg_2 in dir(Gdk):\n            arg_3 = arg_2.upper()\n            arg_1[arg_3] = getattr(Gdk, arg_2)\n        return arg_1", "path": "shoebot/gui/gtk_input_device.py", "identifier": "GtkInputDeviceMixin.get_key_map", "docstring": "Return a dict in the form of\n\n        SHOEBOT_KEY_NAME, GTK_VALUE\n\n        Shoebot key names look like KEY_LEFT, whereas Gdk uses KEY_Left\n        - Shoebot key names are derived from Nodebox 1, which was a mac\n          app.", "docstring_tokens": ["Return", "a", "dict", "in", "the", "form", "of"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260282}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L178-L188", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "This function returns a list of Domain object.", "language": "python", "parameters": "(self)", "return_statement": "return domains", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_data", "(", "\"domains/\"", ")", "arg_2", "=", "list", "(", ")", "for", "arg_3", "in", "arg_1", "[", "'domains'", "]", ":", "arg_4", "=", "Domain", "(", "**", "arg_3", ")", "arg_4", ".", "token", "=", "arg_0", ".", "token", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n            This function returns a list of Domain object.\n        \"\"\"\n        arg_1 = arg_0.get_data(\"domains/\")\n        arg_2 = list()\n        for arg_3 in arg_1['domains']:\n            arg_4 = Domain(**arg_3)\n            arg_4.token = arg_0.token\n            arg_2.append(arg_4)\n        return arg_2", "path": "digitalocean/Manager.py", "identifier": "Manager.get_all_domains", "docstring": "This function returns a list of Domain object.", "docstring_tokens": ["This", "function", "returns", "a", "list", "of", "Domain", "object", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 260283}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L599-L633", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Instantiate a Credentials object from a JSON description of it.", "language": "python", "parameters": "(cls, json_data)", "return_statement": "return retval", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "json", ".", "loads", "(", "_helpers", ".", "_from_bytes", "(", "arg_1", ")", ")", "if", "(", "arg_2", ".", "get", "(", "'token_expiry'", ")", "and", "not", "isinstance", "(", "arg_2", "[", "'token_expiry'", "]", ",", "datetime", ".", "datetime", ")", ")", ":", "try", ":", "arg_2", "[", "'token_expiry'", "]", "=", "datetime", ".", "datetime", ".", "strptime", "(", "arg_2", "[", "'token_expiry'", "]", ",", "EXPIRY_FORMAT", ")", "except", "ValueError", ":", "arg_2", "[", "'token_expiry'", "]", "=", "None", "arg_3", "=", "arg_0", "(", "arg_2", "[", "'access_token'", "]", ",", "arg_2", "[", "'client_id'", "]", ",", "arg_2", "[", "'client_secret'", "]", ",", "arg_2", "[", "'refresh_token'", "]", ",", "arg_2", "[", "'token_expiry'", "]", ",", "arg_2", "[", "'token_uri'", "]", ",", "arg_2", "[", "'user_agent'", "]", ",", "revoke_uri", "=", "arg_2", ".", "get", "(", "'revoke_uri'", ",", "None", ")", ",", "id_token", "=", "arg_2", ".", "get", "(", "'id_token'", ",", "None", ")", ",", "id_token_jwt", "=", "arg_2", ".", "get", "(", "'id_token_jwt'", ",", "None", ")", ",", "token_response", "=", "arg_2", ".", "get", "(", "'token_response'", ",", "None", ")", ",", "scopes", "=", "arg_2", ".", "get", "(", "'scopes'", ",", "None", ")", ",", "token_info_uri", "=", "arg_2", ".", "get", "(", "'token_info_uri'", ",", "None", ")", ")", "arg_3", ".", "invalid", "=", "arg_2", "[", "'invalid'", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Instantiate a Credentials object from a JSON description of it.\n\n        The JSON should have been produced by calling .to_json() on the object.\n\n        Args:\n            json_data: string or bytes, JSON to deserialize.\n\n        Returns:\n            An instance of a Credentials subclass.\n        \"\"\"\n        arg_2 = json.loads(_helpers._from_bytes(arg_1))\n        if (arg_2.get('token_expiry') and\n                not isinstance(arg_2['token_expiry'], datetime.datetime)):\n            try:\n                arg_2['token_expiry'] = datetime.datetime.strptime(\n                    arg_2['token_expiry'], EXPIRY_FORMAT)\n            except ValueError:\n                arg_2['token_expiry'] = None\n        arg_3 = arg_0(\n            arg_2['access_token'],\n            arg_2['client_id'],\n            arg_2['client_secret'],\n            arg_2['refresh_token'],\n            arg_2['token_expiry'],\n            arg_2['token_uri'],\n            arg_2['user_agent'],\n            revoke_uri=arg_2.get('revoke_uri', None),\n            id_token=arg_2.get('id_token', None),\n            id_token_jwt=arg_2.get('id_token_jwt', None),\n            token_response=arg_2.get('token_response', None),\n            scopes=arg_2.get('scopes', None),\n            token_info_uri=arg_2.get('token_info_uri', None))\n        arg_3.invalid = arg_2['invalid']\n        return arg_3", "path": "oauth2client/client.py", "identifier": "OAuth2Credentials.from_json", "docstring": "Instantiate a Credentials object from a JSON description of it.\n\n        The JSON should have been produced by calling .to_json() on the object.\n\n        Args:\n            json_data: string or bytes, JSON to deserialize.\n\n        Returns:\n            An instance of a Credentials subclass.", "docstring_tokens": ["Instantiate", "a", "Credentials", "object", "from", "a", "JSON", "description", "of", "it", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 260284}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L35-L45", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Creates a message", "language": "python", "parameters": "(self, params={})", "return_statement": "return self.message_from_json(data[\"message\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ")", ":", "arg_2", "=", "\"/2/messages/\"", "arg_3", "=", "arg_1", "arg_4", "=", "arg_0", ".", "_post_resource", "(", "arg_2", ",", "arg_3", ")", "return", "arg_0", ".", "message_from_json", "(", "arg_4", "[", "\"message\"", "]", ")"], "function": "def Func(arg_0, arg_1={}):\n        \"\"\"\n        Creates a message\n\n        http://dev.wheniwork.com/#create/update-message\n        \"\"\"\n        arg_2 = \"/2/messages/\"\n        arg_3 = arg_1\n\n        arg_4 = arg_0._post_resource(arg_2, arg_3)\n        return arg_0.message_from_json(arg_4[\"message\"])", "path": "uw_wheniwork/messages.py", "identifier": "Messages.create_message", "docstring": "Creates a message\n\n        http://dev.wheniwork.com/#create/update-message", "docstring_tokens": ["Creates", "a", "message"], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 260285}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpi.py#L131-L167", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Downloads the latest Raspbian image and writes it to a microSD card.", "language": "python", "parameters": "(self, yes=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "arg_0", ".", "assume_localhost", "(", ")", "arg_1", "=", "int", "(", "arg_1", ")", "arg_2", "=", "'SD card present at %s? '", "%", "arg_0", ".", "env", ".", "sd_device", "if", "not", "arg_1", "and", "not", "raw_input", "(", "arg_2", ")", ".", "lower", "(", ")", ".", "startswith", "(", "'y'", ")", ":", "return", "arg_3", "=", "arg_0", ".", "local_renderer", "arg_3", ".", "local_if_missing", "(", "fn", "=", "'{raspbian_image_zip}'", ",", "cmd", "=", "'wget {raspbian_download_url} -O raspbian_lite_latest.zip'", ")", "arg_3", ".", "lenv", ".", "img_fn", "=", "arg_3", ".", "local", "(", "\"unzip -l {raspbian_image_zip} | sed -n 4p | awk '{{print $4}}'\"", ",", "capture", "=", "True", ")", "or", "'$IMG_FN'", "arg_3", ".", "local", "(", "'echo {img_fn}'", ")", "arg_3", ".", "local", "(", "'[ ! -f {img_fn} ] && unzip {raspbian_image_zip} {img_fn} || true'", ")", "arg_3", ".", "lenv", ".", "img_fn", "=", "arg_3", ".", "local", "(", "'readlink -f {img_fn}'", ",", "capture", "=", "True", ")", "arg_3", ".", "local", "(", "'echo {img_fn}'", ")", "with", "arg_0", ".", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_3", ".", "sudo", "(", "'[ -d \"{sd_media_mount_dir}\" ] && umount {sd_media_mount_dir} || true'", ")", "with", "arg_0", ".", "settings", "(", "warn_only", "=", "True", ")", ":", "arg_3", ".", "sudo", "(", "'[ -d \"{sd_media_mount_dir2}\" ] && umount {sd_media_mount_dir2} || true'", ")", "arg_3", ".", "pc", "(", "'Writing the image onto the card.'", ")", "arg_3", ".", "sudo", "(", "'time dd bs=4M if={img_fn} of={sd_device}'", ")", "arg_3", ".", "run", "(", "'sync'", ")"], "function": "def Func(arg_0, arg_1=0):\n        \"\"\"\n        Downloads the latest Raspbian image and writes it to a microSD card.\n\n        Based on the instructions from:\n\n        https://www.raspberrypi.org/documentation/installation/installing-images/linux.md\n        \"\"\"\n        arg_0.assume_localhost()\n\n        arg_1 = int(arg_1)\n        arg_2 = 'SD card present at %s? ' % arg_0.env.sd_device\n        if not arg_1 and not raw_input(arg_2).lower().startswith('y'):\n            return\n\n        arg_3 = arg_0.local_renderer\n        arg_3.local_if_missing(\n            fn='{raspbian_image_zip}',\n            cmd='wget {raspbian_download_url} -O raspbian_lite_latest.zip')\n\n        arg_3.lenv.img_fn = \\\n            arg_3.local(\"unzip -l {raspbian_image_zip} | sed -n 4p | awk '{{print $4}}'\", capture=True) or '$IMG_FN'\n        arg_3.local('echo {img_fn}')\n        arg_3.local('[ ! -f {img_fn} ] && unzip {raspbian_image_zip} {img_fn} || true')\n        arg_3.lenv.img_fn = arg_3.local('readlink -f {img_fn}', capture=True)\n        arg_3.local('echo {img_fn}')\n\n        with arg_0.settings(warn_only=True):\n            arg_3.sudo('[ -d \"{sd_media_mount_dir}\" ] && umount {sd_media_mount_dir} || true')\n        with arg_0.settings(warn_only=True):\n            arg_3.sudo('[ -d \"{sd_media_mount_dir2}\" ] && umount {sd_media_mount_dir2} || true')\n\n        arg_3.pc('Writing the image onto the card.')\n        arg_3.sudo('time dd bs=4M if={img_fn} of={sd_device}')\n\n        # Flush all writes to disk.\n        arg_3.run('sync')", "path": "burlap/rpi.py", "identifier": "RaspberryPiSatchel.init_raspbian_disk", "docstring": "Downloads the latest Raspbian image and writes it to a microSD card.\n\n        Based on the instructions from:\n\n        https://www.raspberrypi.org/documentation/installation/installing-images/linux.md", "docstring_tokens": ["Downloads", "the", "latest", "Raspbian", "image", "and", "writes", "it", "to", "a", "microSD", "card", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 260286}
{"url": "https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/core/utils.py#L12-L47", "sha": "70226eb19a72a08144b5d8cea9db4913200f7bc5", "docstring_summary": "Flatten any array of items to list", "language": "python", "parameters": "(iterable, maps=None, unique=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", "->", "list", ":", "if", "arg_0", "is", "None", ":", "return", "[", "]", "if", "arg_1", "is", "None", ":", "arg_1", "=", "dict", "(", ")", "if", "isinstance", "(", "arg_0", ",", "(", "str", ",", "int", ",", "float", ")", ")", ":", "return", "[", "arg_1", ".", "get", "(", "arg_0", ",", "arg_0", ")", "]", "else", ":", "arg_3", "=", "[", "arg_1", ".", "get", "(", "item", ",", "item", ")", "for", "item", "in", "_to_gen_", "(", "arg_0", ")", "]", "return", "list", "(", "set", "(", "arg_3", ")", ")", "if", "arg_2", "else", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=False) -> list:\n    \"\"\"\n    Flatten any array of items to list\n\n    Args:\n        iterable: any array or value\n        maps: map items to values\n        unique: drop duplicates\n\n    Returns:\n        list: Funced list\n\n    References:\n        https://stackoverflow.com/a/40857703/1332656\n\n    Examples:\n        >>> Func('abc')\n        ['abc']\n        >>> Func(1)\n        [1]\n        >>> Func(1.)\n        [1.0]\n        >>> Func(['ab', 'cd', ['xy', 'zz']])\n        ['ab', 'cd', 'xy', 'zz']\n        >>> Func(['ab', ['xy', 'zz']], maps={'xy': '0x'})\n        ['ab', '0x', 'zz']\n    \"\"\"\n    if arg_0 is None: return []\n    if arg_1 is None: arg_1 = dict()\n\n    if isinstance(arg_0, (str, int, float)):\n        return [arg_1.get(arg_0, arg_0)]\n\n    else:\n        arg_3 = [arg_1.get(item, item) for item in _to_gen_(arg_0)]\n        return list(set(arg_3)) if arg_2 else arg_3", "path": "xbbg/core/utils.py", "identifier": "flatten", "docstring": "Flatten any array of items to list\n\n    Args:\n        iterable: any array or value\n        maps: map items to values\n        unique: drop duplicates\n\n    Returns:\n        list: flattened list\n\n    References:\n        https://stackoverflow.com/a/40857703/1332656\n\n    Examples:\n        >>> flatten('abc')\n        ['abc']\n        >>> flatten(1)\n        [1]\n        >>> flatten(1.)\n        [1.0]\n        >>> flatten(['ab', 'cd', ['xy', 'zz']])\n        ['ab', 'cd', 'xy', 'zz']\n        >>> flatten(['ab', ['xy', 'zz']], maps={'xy': '0x'})\n        ['ab', '0x', 'zz']", "docstring_tokens": ["Flatten", "any", "array", "of", "items", "to", "list"], "nwo": "alpha-xone/xbbg", "score": 0.6397210542171977, "idx": 260287}
{"url": "https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/ops/if_.py#L39-L77", "sha": "7ef04938d80f8b646bd73d976ac9787a5b88edd9", "docstring_summary": "Complex code ahead. Comments have been added in as needed.", "language": "python", "parameters": "(self, previous: bytes)", "return_statement": "return bc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "if", "len", "(", "arg_0", ".", "conditions", ")", "!=", "len", "(", "arg_0", ".", "body", ")", ":", "raise", "exc", ".", "CompileError", "(", "\"Conditions and body length mismatch!\"", ")", "arg_3", "=", "b\"\"", "arg_4", "=", "len", "(", "arg_1", ")", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_0", ".", "conditions", ",", "arg_0", ".", "body", ")", ":", "arg_7", "=", "arg_5", ".", "to_bytecode", "(", "arg_1", ")", "arg_3", "+=", "arg_7", "arg_8", "=", "compiler", ".", "compile_bytecode", "(", "arg_6", ")", "arg_9", "=", "len", "(", "arg_8", ")", "arg_10", "=", "arg_4", "+", "len", "(", "arg_7", ")", "+", "arg_9", "+", "1", "arg_3", "+=", "generate_simple_call", "(", "tokens", ".", "POP_JUMP_IF_FALSE", ",", "arg_10", ")", "arg_3", "+=", "arg_8", "arg_4", "=", "len", "(", "arg_1", ")", "+", "len", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        Complex code ahead. Comments have been added in as needed.\n        \"\"\"\n        # First, validate the lengths.\n        if len(arg_0.conditions) != len(arg_0.body):\n            raise exc.CompileError(\"Conditions and body length mismatch!\")\n\n        arg_3 = b\"\"\n\n        arg_4 = len(arg_1)\n\n        # Loop over the conditions and bodies\n        for arg_5, arg_6 in zip(arg_0.conditions, arg_0.body):\n            # Generate the conditional data.\n            arg_7 = arg_5.to_bytecode(arg_1)\n            arg_3 += arg_7\n            # Complex calculation. First, generate the bytecode for all tokens in the body. Then\n            # we calculate the len() of that. We create a POP_JUMP_IF_FALSE operation that jumps\n            # to the instructions after the body code + 3 for the pop call. This is done for all\n            # chained IF calls, as if it was an elif call. Else calls are not possible to be\n            # auto-generated, but it is possible to emulate them using an elif call that checks\n            # for the opposite of the above IF.\n\n            # Call the _compile_func method from compiler to compile the body.\n            arg_8 = compiler.compile_bytecode(arg_6)\n\n            arg_9 = len(arg_8)\n            # Add together the lengths.\n            arg_10 = arg_4 + len(arg_7) + arg_9 + 1\n            # Generate the POP_JUMP_IF_FALSE instruction\n            arg_3 += generate_simple_call(tokens.POP_JUMP_IF_FALSE, arg_10)\n            # Add the body_bc\n            arg_3 += arg_8\n\n            # Update previous_len\n            arg_4 = len(arg_1) + len(arg_3)\n\n        return arg_3", "path": "pyte/ops/if_.py", "identifier": "IF.to_bytes", "docstring": "Complex code ahead. Comments have been added in as needed.", "docstring_tokens": ["Complex", "code", "ahead", ".", "Comments", "have", "been", "added", "in", "as", "needed", "."], "nwo": "Fuyukai/Pyte", "score": 0.3282631104312029, "idx": 260288}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1957-L1998", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check the node has a non empty docstring", "language": "python", "parameters": "(\n        self, node_type, node, report_missing=True, confidence=interfaces.HIGH\n    )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ",", "arg_4", "=", "arg_5", ".", "HIGH", ")", ":", "arg_7", "=", "arg_2", ".", "doc", "if", "arg_7", "is", "None", ":", "if", "not", "arg_3", ":", "return", "arg_8", "=", "utils", ".", "get_node_last_lineno", "(", "arg_2", ")", "-", "arg_2", ".", "lineno", "if", "arg_1", "==", "\"module\"", "and", "not", "arg_8", ":", "return", "arg_9", "=", "arg_0", ".", "config", ".", "docstring_min_length", "if", "arg_1", "!=", "\"module\"", "and", "arg_9", ">", "-", "1", "and", "arg_8", "<", "arg_9", ":", "return", "arg_0", ".", "stats", "[", "\"undocumented_\"", "+", "arg_1", "]", "+=", "1", "if", "(", "arg_2", ".", "body", "and", "isinstance", "(", "arg_2", ".", "body", "[", "0", "]", ",", "astroid", ".", "Expr", ")", "and", "isinstance", "(", "arg_2", ".", "body", "[", "0", "]", ".", "value", ",", "astroid", ".", "Call", ")", ")", ":", "arg_10", "=", "utils", ".", "safe_infer", "(", "arg_2", ".", "body", "[", "0", "]", ".", "value", ".", "func", ")", "if", "isinstance", "(", "arg_10", ",", "astroid", ".", "BoundMethod", ")", "and", "isinstance", "(", "arg_10", ".", "bound", ",", "astroid", ".", "Instance", ")", ":", "if", "PY3K", "and", "arg_10", ".", "bound", ".", "name", "==", "\"str\"", ":", "return", "if", "arg_10", ".", "bound", ".", "name", "in", "(", "\"str\"", ",", "\"unicode\"", ",", "\"bytes\"", ")", ":", "return", "arg_0", ".", "add_message", "(", "\"missing-docstring\"", ",", "arg_2", "=", "arg_2", ",", "args", "=", "(", "arg_1", ",", ")", ",", "arg_4", "=", "arg_4", ")", "elif", "not", "arg_7", ".", "strip", "(", ")", ":", "arg_0", ".", "stats", "[", "\"undocumented_\"", "+", "arg_1", "]", "+=", "1", "arg_0", ".", "add_message", "(", "\"empty-docstring\"", ",", "arg_2", "=", "arg_2", ",", "args", "=", "(", "arg_1", ",", ")", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3=True, arg_4=arg_5.HIGH\n    ):\n        \"\"\"check the node has a non empty docstring\"\"\"\n        arg_7 = arg_2.doc\n        if arg_7 is None:\n            if not arg_3:\n                return\n            arg_8 = utils.get_node_last_lineno(arg_2) - arg_2.lineno\n\n            if arg_1 == \"module\" and not arg_8:\n                # If the module has no body, there's no reason\n                # to require a docstring.\n                return\n            arg_9 = arg_0.config.docstring_min_length\n\n            if arg_1 != \"module\" and arg_9 > -1 and arg_8 < arg_9:\n                return\n            arg_0.stats[\"undocumented_\" + arg_1] += 1\n            if (\n                arg_2.body\n                and isinstance(arg_2.body[0], astroid.Expr)\n                and isinstance(arg_2.body[0].value, astroid.Call)\n            ):\n                # Most likely a string with a format call. Let's see.\n                arg_10 = utils.safe_infer(arg_2.body[0].value.func)\n                if isinstance(arg_10, astroid.BoundMethod) and isinstance(\n                    arg_10.bound, astroid.Instance\n                ):\n                    # Strings in Python 3, others in Python 2.\n                    if PY3K and arg_10.bound.name == \"str\":\n                        return\n                    if arg_10.bound.name in (\"str\", \"unicode\", \"bytes\"):\n                        return\n            arg_0.add_message(\n                \"missing-docstring\", arg_2=arg_2, args=(arg_1,), arg_4=arg_4\n            )\n        elif not arg_7.strip():\n            arg_0.stats[\"undocumented_\" + arg_1] += 1\n            arg_0.add_message(\n                \"empty-docstring\", arg_2=arg_2, args=(arg_1,), arg_4=arg_4\n            )", "path": "pylint/checkers/base.py", "identifier": "DocStringChecker._check_docstring", "docstring": "check the node has a non empty docstring", "docstring_tokens": ["check", "the", "node", "has", "a", "non", "empty", "docstring"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260289}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmds.py#L724-L738", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "Regiser all default type-to-pipe convertors.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "register_type", "(", "type", ",", "pipe", ".", "map", ")", "register_type", "(", "types", ".", "FunctionType", ",", "pipe", ".", "map", ")", "register_type", "(", "types", ".", "MethodType", ",", "pipe", ".", "map", ")", "register_type", "(", "tuple", ",", "seq", ")", "register_type", "(", "list", ",", "seq", ")", "register_type", "(", "types", ".", "GeneratorType", ",", "seq", ")", "register_type", "(", "string_type", ",", "sh", ")", "register_type", "(", "unicode_type", ",", "sh", ")", "register_type", "(", "file_type", ",", "fileobj", ")", "if", "is_py3", ":", "register_type", "(", "range", ",", "seq", ")", "register_type", "(", "map", ",", "seq", ")"], "function": "def Func():\n    \"\"\"Regiser all default type-to-pipe convertors.\"\"\"\n    register_type(type, pipe.map)\n    register_type(types.FunctionType, pipe.map)\n    register_type(types.MethodType, pipe.map)\n    register_type(tuple, seq)\n    register_type(list, seq)\n    register_type(types.GeneratorType, seq)\n    register_type(string_type, sh)\n    register_type(unicode_type, sh)\n    register_type(file_type, fileobj)\n\n    if is_py3:\n        register_type(range, seq)\n        register_type(map, seq)", "path": "cmdlet/cmds.py", "identifier": "register_default_types", "docstring": "Regiser all default type-to-pipe convertors.", "docstring_tokens": ["Regiser", "all", "default", "type", "-", "to", "-", "pipe", "convertors", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 260290}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/positive_semidefinite_kernels/positive_semidefinite_kernel.py#L627-L643", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Flatten a list of kernels which may contain _ProductKernel instances.", "language": "python", "parameters": "(kernels)", "return_statement": "return flattened", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "isinstance", "(", "arg_2", ",", "_ProductKernel", ")", ":", "arg_1", "+=", "arg_2", ".", "kernels", "else", ":", "arg_1", ".", "append", "(", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n  \"\"\"Flatten a list of kernels which may contain _ProductKernel instances.\n\n  Args:\n    kernels: Python list of `PositiveSemidefiniteKernel` instances\n\n  Returns:\n    Python list containing the elements of kernels, with any _ProductKernel\n    instances replaced by their `kernels` property contents.\n  \"\"\"\n  arg_1 = []\n  for arg_2 in arg_0:\n    if isinstance(arg_2, _ProductKernel):\n      arg_1 += arg_2.kernels\n    else:\n      arg_1.append(arg_2)\n  return arg_1", "path": "tensorflow_probability/python/positive_semidefinite_kernels/positive_semidefinite_kernel.py", "identifier": "_flatten_multiplicand_list", "docstring": "Flatten a list of kernels which may contain _ProductKernel instances.\n\n  Args:\n    kernels: Python list of `PositiveSemidefiniteKernel` instances\n\n  Returns:\n    Python list containing the elements of kernels, with any _ProductKernel\n    instances replaced by their `kernels` property contents.", "docstring_tokens": ["Flatten", "a", "list", "of", "kernels", "which", "may", "contain", "_ProductKernel", "instances", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260291}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/estimators/estimator_base.py#L89-L109", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Train the H2O model.", "language": "python", "parameters": "(self, x=None, y=None, training_frame=None, offset_column=None, fold_column=None,\n              weights_column=None, validation_frame=None, max_runtime_secs=None, ignored_columns=None,\n              model_id=None, verbose=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "False", ")", ":", "arg_0", ".", "_Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=None,\n              arg_6=None, arg_7=None, arg_8=None, arg_9=None,\n              arg_10=None, arg_11=False):\n        \"\"\"\n        Train the H2O model.\n\n        :param x: A list of column names or indices indicating the predictor columns.\n        :param y: An index or a column name indicating the response column.\n        :param H2OFrame Funcing_frame: The H2OFrame having the columns indicated by x and y (as well as any\n            additional columns specified by fold, offset, and weights).\n        :param offset_column: The name or index of the column in Funcing_frame that holds the offsets.\n        :param fold_column: The name or index of the column in Funcing_frame that holds the per-row fold\n            assignments.\n        :param weights_column: The name or index of the column in Funcing_frame that holds the per-row weights.\n        :param validation_frame: H2OFrame with validation data to be scored on while Funcing.\n        :param float max_runtime_secs: Maximum allowed runtime in seconds for model Funcing. Use 0 to disable.\n        :param bool verbose: Print scoring history to stdout. Defaults to False.\n        \"\"\"\n        arg_0._Func(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,\n                    arg_6=arg_6, arg_7=arg_7, arg_8=arg_8, \n                    arg_9=arg_9, arg_10=arg_10, arg_11=arg_11)", "path": "h2o-py/h2o/estimators/estimator_base.py", "identifier": "H2OEstimator.train", "docstring": "Train the H2O model.\n\n        :param x: A list of column names or indices indicating the predictor columns.\n        :param y: An index or a column name indicating the response column.\n        :param H2OFrame training_frame: The H2OFrame having the columns indicated by x and y (as well as any\n            additional columns specified by fold, offset, and weights).\n        :param offset_column: The name or index of the column in training_frame that holds the offsets.\n        :param fold_column: The name or index of the column in training_frame that holds the per-row fold\n            assignments.\n        :param weights_column: The name or index of the column in training_frame that holds the per-row weights.\n        :param validation_frame: H2OFrame with validation data to be scored on while training.\n        :param float max_runtime_secs: Maximum allowed runtime in seconds for model training. Use 0 to disable.\n        :param bool verbose: Print scoring history to stdout. Defaults to False.", "docstring_tokens": ["Train", "the", "H2O", "model", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260292}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/get_attributes.py#L402-L452", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the data encoding the GetAttributes response payload to a\n        stream.", "language": "python", "parameters": "(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "arg_6", "=", "utils", ".", "BytearrayStream", "(", ")", "if", "arg_0", ".", "_unique_identifier", ":", "arg_0", ".", "_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The GetAttributes response payload is missing the unique \"", "\"identifier field.\"", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "for", "arg_7", "in", "arg_0", ".", "_attributes", ":", "arg_7", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "if", "arg_0", ".", "_attributes", ":", "arg_8", "=", "objects", ".", "TemplateAttribute", "(", "arg_9", "=", "arg_0", ".", "attributes", ")", "arg_9", "=", "objects", ".", "convert_template_attribute_to_attributes", "(", "arg_8", ")", "arg_9", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The GetAttributes response payload is missing the \"", "\"attributes list.\"", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "GetAttributesResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the data encoding the GetAttributes response payload to a\n        stream.\n\n        Args:\n            output_buffer (stream): A data stream in which to encode object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n        \"\"\"\n        arg_6 = utils.BytearrayStream()\n\n        if arg_0._unique_identifier:\n            arg_0._unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise exceptions.InvalidField(\n                \"The GetAttributes response payload is missing the unique \"\n                \"identifier field.\"\n            )\n\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            for arg_7 in arg_0._attributes:\n                arg_7.Func(arg_6, arg_2=arg_2)\n        else:\n            if arg_0._attributes:\n                # TODO (ph) Add a new utility to avoid using TemplateAttributes\n                arg_8 = objects.TemplateAttribute(\n                    arg_9=arg_0.attributes\n                )\n                arg_9 = objects.convert_template_attribute_to_attributes(\n                    arg_8\n                )\n                arg_9.Func(arg_6, arg_2=arg_2)\n            else:\n                raise exceptions.InvalidField(\n                    \"The GetAttributes response payload is missing the \"\n                    \"attributes list.\"\n                )\n\n        arg_0.length = arg_6.length()\n        super(GetAttributesResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/messages/payloads/get_attributes.py", "identifier": "GetAttributesResponsePayload.write", "docstring": "Write the data encoding the GetAttributes response payload to a\n        stream.\n\n        Args:\n            output_buffer (stream): A data stream in which to encode object\n                data, supporting a write method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.", "docstring_tokens": ["Write", "the", "data", "encoding", "the", "GetAttributes", "response", "payload", "to", "a", "stream", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 260293}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L304-L320", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Expand all environment variables in an environment dict", "language": "python", "parameters": "(env)", "return_statement": "return out_env", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "iteritems", "(", ")", ":", "arg_1", "[", "arg_2", "]", "=", "Template", "(", "arg_3", ")", ".", "safe_substitute", "(", "arg_0", ")", "for", "arg_2", ",", "arg_3", "in", "arg_1", ".", "items", "(", ")", ":", "arg_1", "[", "arg_2", "]", "=", "Template", "(", "arg_3", ")", ".", "safe_substitute", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    '''\n    Expand all environment variables in an environment dict\n\n    :param env: Environment dict\n    '''\n\n    arg_1 = {}\n\n    for arg_2, arg_3 in arg_0.iteritems():\n        arg_1[arg_2] = Template(arg_3).safe_substitute(arg_0)\n\n    # Expand twice to make sure we expand everything we possibly can\n    for arg_2, arg_3 in arg_1.items():\n        arg_1[arg_2] = Template(arg_3).safe_substitute(arg_1)\n\n    return arg_1", "path": "cpenv/utils.py", "identifier": "expand_envvars", "docstring": "Expand all environment variables in an environment dict\n\n    :param env: Environment dict", "docstring_tokens": ["Expand", "all", "environment", "variables", "in", "an", "environment", "dict"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 260294}
{"url": "https://github.com/voidpp/vcp/blob/5538cdb7b43029db9aac9edad823cd87afd89ab5/vcp/project_handler_base.py#L90-L108", "sha": "5538cdb7b43029db9aac9edad823cd87afd89ab5", "docstring_summary": "Save the projects configs to local path", "language": "python", "parameters": "(self, projects)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ".", "path", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", ":", "return", "logger", ".", "debug", "(", "\"Save projects config to %s\"", ",", "arg_2", ")", "for", "arg_3", ",", "arg_4", "in", "list", "(", "arg_1", ".", "items", "(", ")", ")", ":", "arg_5", "=", "arg_0", ".", "get_project_config_path", "(", "arg_3", ")", "with", "open", "(", "arg_5", ",", "\"w\"", ")", "as", "f", ":", "yaml", ".", "dump", "(", "arg_4", ",", "stream", "=", "f", ",", "default_flow_style", "=", "False", ")", "logger", ".", "debug", "(", "\"Project '%s' config has been writed to '%s'\"", ",", "arg_3", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Save the projects configs to local path\n\n        Args:\n            projects (dict): project_name -> project_data\n        \"\"\"\n\n        arg_2 = os.path.expanduser(arg_0.path)\n\n        if not os.path.isdir(arg_2):\n            return\n\n        logger.debug(\"Save projects config to %s\", arg_2)\n\n        for arg_3, arg_4 in list(arg_1.items()):\n            arg_5 = arg_0.get_project_config_path(arg_3)\n            with open(arg_5, \"w\") as f:\n                yaml.dump(arg_4, stream = f, default_flow_style = False)\n                logger.debug(\"Project '%s' config has been writed to '%s'\", arg_3, arg_5)", "path": "vcp/project_handler_base.py", "identifier": "ProjectHandlerBase.save", "docstring": "Save the projects configs to local path\n\n        Args:\n            projects (dict): project_name -> project_data", "docstring_tokens": ["Save", "the", "projects", "configs", "to", "local", "path"], "nwo": "voidpp/vcp", "score": 0.34668479461464624, "idx": 260295}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/file_tree_map.py#L337-L356", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Imports filetree and root_path variable values from the filepath.", "language": "python", "parameters": "(filepath)", "return_statement": "return cfg.root_path, cfg.filetree", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "op", ".", "isfile", "(", "arg_0", ")", ":", "raise", "IOError", "(", "'Data config file not found. '", "'Got: {0}'", ".", "format", "(", "arg_0", ")", ")", "arg_1", "=", "import_pyfile", "(", "arg_0", ")", "if", "not", "hasattr", "(", "arg_1", ",", "'root_path'", ")", ":", "raise", "KeyError", "(", "'Config file root_path key not found.'", ")", "if", "not", "hasattr", "(", "arg_1", ",", "'filetree'", ")", ":", "raise", "KeyError", "(", "'Config file filetree key not found.'", ")", "return", "arg_1", ".", "root_path", ",", "arg_1", ".", "filetree"], "function": "def Func(arg_0):\n        \"\"\"\n        Imports filetree and root_path variable values from the filepath.\n\n        :param filepath:\n        :return: root_path and filetree\n        \"\"\"\n        if not op.isfile(arg_0):\n            raise IOError('Data config file not found. '\n                          'Got: {0}'.format(arg_0))\n\n        arg_1 = import_pyfile(arg_0)\n\n        if not hasattr(arg_1, 'root_path'):\n            raise KeyError('Config file root_path key not found.')\n\n        if not hasattr(arg_1, 'filetree'):\n            raise KeyError('Config file filetree key not found.')\n\n        return arg_1.root_path, arg_1.filetree", "path": "boyle/files/file_tree_map.py", "identifier": "FileTreeMap._import_config", "docstring": "Imports filetree and root_path variable values from the filepath.\n\n        :param filepath:\n        :return: root_path and filetree", "docstring_tokens": ["Imports", "filetree", "and", "root_path", "variable", "values", "from", "the", "filepath", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 260296}
{"url": "https://github.com/ui/django-thumbnails/blob/5cef55e7f167060458709ed760dd43981124796a/thumbnails/files.py#L53-L58", "sha": "5cef55e7f167060458709ed760dd43981124796a", "docstring_summary": "Populate self._thumbnails.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_thumbnails", "=", "{", "}", "arg_2", "=", "arg_0", ".", "metadata_backend", ".", "get_thumbnails", "(", "arg_0", ".", "source_image", ".", "name", ")", "for", "arg_3", "in", "arg_2", ":", "arg_0", ".", "_thumbnails", "[", "arg_3", ".", "size", "]", "=", "Thumbnail", "(", "arg_3", "=", "arg_3", ",", "storage", "=", "arg_0", ".", "storage", ")"], "function": "def Func(arg_0):\n        \"\"\"Populate self._thumbnails.\"\"\"\n        arg_0._thumbnails = {}\n        arg_2 = arg_0.metadata_backend.get_thumbnails(arg_0.source_image.name)\n        for arg_3 in arg_2:\n            arg_0._thumbnails[arg_3.size] = Thumbnail(arg_3=arg_3, storage=arg_0.storage)", "path": "thumbnails/files.py", "identifier": "ThumbnailManager._refresh_cache", "docstring": "Populate self._thumbnails.", "docstring_tokens": ["Populate", "self", ".", "_thumbnails", "."], "nwo": "ui/django-thumbnails", "score": 0.28145370109860535, "idx": 260297}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L358-L393", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Render but don't justify, or update the width or txtwidth attributes.", "language": "python", "parameters": "(self, name, color=True, **kwargs)", "return_statement": "return self._formatter.format(prompt, **fmtargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "**", "arg_3", ")", ":", "if", "arg_1", "==", "'rewrite'", ":", "return", "arg_0", ".", "Func_rewrite", "(", "arg_2", "=", "arg_2", ")", "if", "arg_2", ":", "arg_4", "=", "arg_0", ".", "color_scheme_table", ".", "active_colors", "if", "arg_1", "==", "'out'", ":", "arg_5", "=", "color_lists", "[", "'normal'", "]", "arg_5", ".", "number", ",", "arg_5", ".", "prompt", ",", "arg_5", ".", "normal", "=", "arg_4", ".", "out_number", ",", "arg_4", ".", "out_prompt", ",", "arg_4", ".", "normal", "else", ":", "arg_5", "=", "color_lists", "[", "'inp'", "]", "arg_5", ".", "number", ",", "arg_5", ".", "prompt", ",", "arg_5", ".", "normal", "=", "arg_4", ".", "in_number", ",", "arg_4", ".", "in_prompt", ",", "arg_4", ".", "in_normal", "if", "arg_1", "==", "'in2'", ":", "arg_5", ".", "prompt", "=", "arg_4", ".", "in_prompt2", "else", ":", "arg_5", "=", "color_lists", "[", "'nocolor'", "]", "arg_5", ".", "number", ",", "arg_5", ".", "prompt", ",", "arg_5", ".", "normal", "=", "''", ",", "''", ",", "''", "arg_9", "=", "arg_0", ".", "shell", ".", "execution_count", "arg_10", "=", "dict", "(", "arg_2", "=", "arg_5", ",", "arg_9", "=", "arg_9", ",", "dots", "=", "\".\"", "*", "len", "(", "str", "(", "arg_9", ")", ")", ",", "width", "=", "arg_0", ".", "width", ",", "txtwidth", "=", "arg_0", ".", "txtwidth", ")", "arg_10", ".", "update", "(", "arg_0", ".", "lazy_evaluate_fields", ")", "arg_10", ".", "update", "(", "arg_3", ")", "arg_7", "=", "arg_5", ".", "prompt", "+", "arg_0", ".", "templates", "[", "arg_1", "]", "+", "arg_5", ".", "normal", "return", "arg_0", ".", "_formatter", ".", "format", "(", "arg_7", ",", "**", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, **arg_3):\n        \"\"\"Render but don't justify, or update the width or txtwidth attributes.\n        \"\"\"\n        if arg_1 == 'rewrite':\n            return arg_0.Func_rewrite(arg_2=arg_2)\n        \n        if arg_2:\n            arg_4 = arg_0.color_scheme_table.active_colors\n            if arg_1=='out':\n                arg_5 = color_lists['normal']\n                arg_5.number, arg_5.prompt, arg_5.normal = \\\n                        arg_4.out_number, arg_4.out_prompt, arg_4.normal\n            else:\n                arg_5 = color_lists['inp']\n                arg_5.number, arg_5.prompt, arg_5.normal = \\\n                        arg_4.in_number, arg_4.in_prompt, arg_4.in_normal\n                if arg_1=='in2':\n                    arg_5.prompt = arg_4.in_prompt2\n        else:\n            # No color\n            arg_5 = color_lists['nocolor']\n            arg_5.number, arg_5.prompt, arg_5.normal = '', '', ''\n        \n        arg_9 = arg_0.shell.execution_count    # Shorthand\n        # Build the dictionary to be passed to string formatting\n        arg_10 = dict(arg_2=arg_5, arg_9=arg_9,\n                        dots=\".\"*len(str(arg_9)),\n                        width=arg_0.width, txtwidth=arg_0.txtwidth )\n        arg_10.update(arg_0.lazy_evaluate_fields)\n        arg_10.update(arg_3)\n        \n        # Prepare the prompt\n        arg_7 = arg_5.prompt + arg_0.templates[arg_1] + arg_5.normal\n        \n        # Fill in required fields\n        return arg_0._formatter.format(arg_7, **arg_10)", "path": "environment/lib/python2.7/site-packages/IPython/core/prompts.py", "identifier": "PromptManager._render", "docstring": "Render but don't justify, or update the width or txtwidth attributes.", "docstring_tokens": ["Render", "but", "don", "t", "justify", "or", "update", "the", "width", "or", "txtwidth", "attributes", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260298}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1740-L1759", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Display the syntax error that just occurred.", "language": "python", "parameters": "(self, filename=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_get_exc_info", "(", ")", "if", "arg_1", "and", "arg_2", "is", "SyntaxError", ":", "try", ":", "arg_3", ".", "filename", "=", "arg_1", "except", ":", "pass", "arg_5", "=", "arg_0", ".", "SyntaxTB", ".", "structured_traceback", "(", "arg_2", ",", "arg_3", ",", "[", "]", ")", "arg_0", ".", "_showtraceback", "(", "arg_2", ",", "arg_3", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Display the syntax error that just occurred.\n\n        This doesn't display a stack trace because there isn't one.\n\n        If a filename is given, it is stuffed in the exception instead\n        of what was there before (because Python's parser always uses\n        \"<string>\" when reading from a string).\n        \"\"\"\n        arg_2, arg_3, arg_4 = arg_0._get_exc_info()\n\n        if arg_1 and arg_2 is SyntaxError:\n            try:\n                arg_3.filename = arg_1\n            except:\n                # Not the format we expect; leave it alone\n                pass\n        \n        arg_5 = arg_0.SyntaxTB.structured_traceback(arg_2, arg_3, [])\n        arg_0._showtraceback(arg_2, arg_3, arg_5)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.showsyntaxerror", "docstring": "Display the syntax error that just occurred.\n\n        This doesn't display a stack trace because there isn't one.\n\n        If a filename is given, it is stuffed in the exception instead\n        of what was there before (because Python's parser always uses\n        \"<string>\" when reading from a string).", "docstring_tokens": ["Display", "the", "syntax", "error", "that", "just", "occurred", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260299}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/cli/parser.py#L166-L174", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Adds the group and its arguments to a argparse.ArgumentParser instance", "language": "python", "parameters": "(self, parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "group", "=", "arg_1", ".", "add_argument_group", "(", "arg_0", ".", "title", ",", "arg_0", ".", "description", ")", "for", "arg_3", "in", "arg_0", ".", "arguments", ":", "arg_3", ".", "Func", "(", "arg_0", ".", "group", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adds the group and its arguments to a argparse.ArgumentParser instance\n\n        @param parser A argparse.ArgumentParser instance\n        \"\"\"\n        arg_0.group = arg_1.add_argument_group(arg_0.title, arg_0.description)\n        for arg_3 in arg_0.arguments:\n            arg_3.Func(arg_0.group)", "path": "quilt/cli/parser.py", "identifier": "ArgumentGroup.add_to_parser", "docstring": "Adds the group and its arguments to a argparse.ArgumentParser instance\n\n        @param parser A argparse.ArgumentParser instance", "docstring_tokens": ["Adds", "the", "group", "and", "its", "arguments", "to", "a", "argparse", ".", "ArgumentParser", "instance"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 260300}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L472-L493", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup the noise-map from a weight map, which is a form of noise-map that comes via HST image-reduction and \\\n        the software package MultiDrizzle.", "language": "python", "parameters": "(cls, pixel_scale, weight_map)", "return_statement": "return NoiseMap(array=noise_map, pixel_scale=pixel_scale)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_4", ".", "seterr", "(", "divide", "=", "'ignore'", ")", "arg_3", "=", "1.0", "/", "arg_4", ".", "sqrt", "(", "arg_2", ")", "arg_3", "[", "arg_3", "==", "arg_4", ".", "inf", "]", "=", "1.0e8", "return", "NoiseMap", "(", "array", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Setup the noise-map from a weight map, which is a form of noise-map that comes via HST image-reduction and \\\n        the software package MultiDrizzle.\n\n        The variance in each pixel is computed as:\n\n        Variance = 1.0 / sqrt(weight_map).\n\n        The weight map may contain zeros, in which cause the variances are converted to large values to omit them from \\\n        the analysis.\n\n        Parameters\n        -----------\n        pixel_scale : float\n            The size of each pixel in arc seconds.\n        weight_map : ndarray\n            The weight-value of each pixel which is converted to a variance.\n        \"\"\"\n        arg_4.seterr(divide='ignore')\n        arg_3 = 1.0 / arg_4.sqrt(arg_2)\n        arg_3[arg_3 == arg_4.inf] = 1.0e8\n        return NoiseMap(array=arg_3, arg_1=arg_1)", "path": "autolens/data/ccd.py", "identifier": "NoiseMap.from_weight_map", "docstring": "Setup the noise-map from a weight map, which is a form of noise-map that comes via HST image-reduction and \\\n        the software package MultiDrizzle.\n\n        The variance in each pixel is computed as:\n\n        Variance = 1.0 / sqrt(weight_map).\n\n        The weight map may contain zeros, in which cause the variances are converted to large values to omit them from \\\n        the analysis.\n\n        Parameters\n        -----------\n        pixel_scale : float\n            The size of each pixel in arc seconds.\n        weight_map : ndarray\n            The weight-value of each pixel which is converted to a variance.", "docstring_tokens": ["Setup", "the", "noise", "-", "map", "from", "a", "weight", "map", "which", "is", "a", "form", "of", "noise", "-", "map", "that", "comes", "via", "HST", "image", "-", "reduction", "and", "\\", "the", "software", "package", "MultiDrizzle", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 260301}
{"url": "https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L296-L346", "sha": "2614ae3d7a49e437954254846b2963ad249b418c", "docstring_summary": "Check if ``filename`` can be read. Will return boolean which is True if\n        the file can be read, False otherwise.", "language": "python", "parameters": "(self, filename)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "exists", "(", "arg_1", ")", ":", "return", "False", "arg_2", "=", "ConfigResolverBase", "(", ")", "arg_2", ".", "read", "(", "arg_1", ")", "if", "arg_0", ".", "version", "and", "not", "arg_2", ".", "has_option", "(", "'meta'", ",", "'version'", ")", ":", "raise", "NoVersionError", "(", "\"The config option 'meta.version' is missing in {}. The \"", "\"application expects version {}!\"", ".", "format", "(", "arg_1", ",", "arg_0", ".", "version", ")", ")", "elif", "not", "arg_0", ".", "version", "and", "arg_2", ".", "has_option", "(", "'meta'", ",", "'version'", ")", ":", "arg_0", ".", "version", "=", "StrictVersion", "(", "arg_2", ".", "get", "(", "'meta'", ",", "'version'", ")", ")", "arg_0", ".", "_log", ".", "info", "(", "'%r contains a version number, but the config '", "'instance was not created with a version '", "'restriction. Will set version number to \"%s\" to '", "'prevent accidents!'", ",", "arg_1", ",", "arg_0", ".", "version", ")", "elif", "arg_0", ".", "version", ":", "arg_4", "=", "arg_2", ".", "get", "(", "'meta'", ",", "'version'", ")", "arg_5", ",", "arg_6", ",", "arg_7", "=", "StrictVersion", "(", "arg_4", ")", ".", "version", "arg_8", ",", "arg_9", ",", "arg_7", "=", "arg_0", ".", "version", ".", "version", "if", "arg_8", "!=", "arg_5", ":", "arg_0", ".", "_log", ".", "error", "(", "'Invalid major version number in %r. Expected %r, got %r!'", ",", "abspath", "(", "arg_1", ")", ",", "str", "(", "arg_0", ".", "version", ")", ",", "arg_4", ")", "return", "False", "if", "arg_9", "!=", "arg_6", ":", "arg_0", ".", "_log", ".", "warning", "(", "'Mismatching minor version number in %r. '", "'Expected %r, got %r!'", ",", "abspath", "(", "arg_1", ")", ",", "str", "(", "arg_0", ".", "version", ")", ",", "arg_4", ")", "return", "True", "return", "True"], "function": "def Func(arg_0, arg_1):\n        # type: (str) -> bool\n        \"\"\"\n        Check if ``filename`` can be read. Will return boolean which is True if\n        the file can be read, False otherwise.\n        \"\"\"\n        if not exists(arg_1):\n            return False\n\n        # Check if the file is version-compatible with this instance.\n        arg_2 = ConfigResolverBase()\n        arg_2.read(arg_1)\n        if arg_0.version and not arg_2.has_option('meta', 'version'):\n            # self.version is set, so we MUST have a version in the file!\n            raise NoVersionError(\n                \"The config option 'meta.version' is missing in {}. The \"\n                \"application expects version {}!\".format(arg_1,\n                                                         arg_0.version))\n        elif not arg_0.version and arg_2.has_option('meta', 'version'):\n            # Automatically \"lock-in\" a version number if one is found.\n            # This prevents loading a chain of config files with incompatible\n            # version numbers!\n            arg_0.version = StrictVersion(arg_2.get('meta', 'version'))\n            arg_0._log.info('%r contains a version number, but the config '\n                           'instance was not created with a version '\n                           'restriction. Will set version number to \"%s\" to '\n                           'prevent accidents!',\n                           arg_1, arg_0.version)\n        elif arg_0.version:\n            # This instance expected a certain version. We need to check the\n            # version in the file and compare.\n            arg_4 = arg_2.get('meta', 'version')\n            arg_5, arg_6, arg_7 = StrictVersion(arg_4).version\n            arg_8, arg_9, arg_7 = arg_0.version.version\n            if arg_8 != arg_5:\n                arg_0._log.error(\n                    'Invalid major version number in %r. Expected %r, got %r!',\n                    abspath(arg_1),\n                    str(arg_0.version),\n                    arg_4)\n                return False\n\n            if arg_9 != arg_6:\n                arg_0._log.warning(\n                    'Mismatching minor version number in %r. '\n                    'Expected %r, got %r!',\n                    abspath(arg_1),\n                    str(arg_0.version),\n                    arg_4)\n                return True\n        return True", "path": "config_resolver/core.py", "identifier": "Config.check_file", "docstring": "Check if ``filename`` can be read. Will return boolean which is True if\n        the file can be read, False otherwise.", "docstring_tokens": ["Check", "if", "filename", "can", "be", "read", ".", "Will", "return", "boolean", "which", "is", "True", "if", "the", "file", "can", "be", "read", "False", "otherwise", "."], "nwo": "exhuma/config_resolver", "score": 0.16941397159673272, "idx": 260302}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/image.py#L280-L353", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Make a simplified version with common tags from raw EXIF data.", "language": "python", "parameters": "(data, datetime_format='%c')", "return_statement": "return simple", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'%c'", ")", ":", "arg_2", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_3", "=", "{", "}", "for", "arg_4", "in", "(", "'Model'", ",", "'Make'", ",", "'LensModel'", ")", ":", "if", "arg_4", "in", "arg_0", ":", "if", "isinstance", "(", "arg_0", "[", "arg_4", "]", ",", "tuple", ")", ":", "arg_3", "[", "arg_4", "]", "=", "arg_0", "[", "arg_4", "]", "[", "0", "]", ".", "strip", "(", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "arg_0", "[", "arg_4", "]", ".", "strip", "(", ")", "if", "'FNumber'", "in", "arg_0", ":", "arg_5", "=", "arg_0", "[", "'FNumber'", "]", "try", ":", "arg_3", "[", "'fstop'", "]", "=", "float", "(", "arg_5", "[", "0", "]", ")", "/", "arg_5", "[", "1", "]", "except", "Exception", ":", "arg_2", ".", "debug", "(", "'Skipped invalid FNumber: %r'", ",", "arg_5", ",", "exc_info", "=", "True", ")", "if", "'FocalLength'", "in", "arg_0", ":", "arg_6", "=", "arg_0", "[", "'FocalLength'", "]", "try", ":", "arg_3", "[", "'focal'", "]", "=", "round", "(", "float", "(", "arg_6", "[", "0", "]", ")", "/", "arg_6", "[", "1", "]", ")", "except", "Exception", ":", "arg_2", ".", "debug", "(", "'Skipped invalid FocalLength: %r'", ",", "arg_6", ",", "exc_info", "=", "True", ")", "if", "'ExposureTime'", "in", "arg_0", ":", "arg_7", "=", "arg_0", "[", "'ExposureTime'", "]", "if", "isinstance", "(", "arg_7", ",", "tuple", ")", ":", "try", ":", "arg_3", "[", "'exposure'", "]", "=", "str", "(", "fractions", ".", "Fraction", "(", "arg_7", "[", "0", "]", ",", "arg_7", "[", "1", "]", ")", ")", "except", "ZeroDivisionError", ":", "arg_2", ".", "info", "(", "'Invalid ExposureTime: %r'", ",", "arg_7", ")", "elif", "isinstance", "(", "arg_7", ",", "int", ")", ":", "arg_3", "[", "'exposure'", "]", "=", "str", "(", "arg_7", ")", "else", ":", "arg_2", ".", "info", "(", "'Unknown format for ExposureTime: %r'", ",", "arg_7", ")", "if", "arg_0", ".", "get", "(", "'ISOSpeedRatings'", ")", ":", "arg_3", "[", "'iso'", "]", "=", "arg_0", "[", "'ISOSpeedRatings'", "]", "if", "'DateTimeOriginal'", "in", "arg_0", ":", "arg_8", "=", "arg_0", "[", "'DateTimeOriginal'", "]", ".", "rsplit", "(", "'\\x00'", ")", "[", "0", "]", "try", ":", "arg_3", "[", "'dateobj'", "]", "=", "datetime", ".", "strptime", "(", "arg_8", ",", "'%Y:%m:%d %H:%M:%S'", ")", "arg_3", "[", "'datetime'", "]", "=", "arg_3", "[", "'dateobj'", "]", ".", "strftime", "(", "arg_1", ")", "except", "(", "ValueError", ",", "TypeError", ")", "as", "e", ":", "arg_2", ".", "info", "(", "'Could not parse DateTimeOriginal: %s'", ",", "e", ")", "if", "'GPSInfo'", "in", "arg_0", ":", "arg_9", "=", "arg_0", "[", "'GPSInfo'", "]", "arg_10", "=", "arg_9", ".", "get", "(", "'GPSLatitude'", ")", "arg_11", "=", "arg_9", ".", "get", "(", "'GPSLongitude'", ")", "arg_12", "=", "arg_9", ".", "get", "(", "'GPSLatitudeRef'", ")", "arg_13", "=", "arg_9", ".", "get", "(", "'GPSLongitudeRef'", ")", "if", "arg_10", "and", "arg_11", "and", "arg_12", "and", "arg_13", ":", "try", ":", "arg_14", "=", "dms_to_degrees", "(", "arg_10", ")", "arg_15", "=", "dms_to_degrees", "(", "arg_11", ")", "except", "(", "ZeroDivisionError", ",", "ValueError", ",", "TypeError", ")", ":", "arg_2", ".", "info", "(", "'Failed to read GPS info'", ")", "else", ":", "arg_3", "[", "'gps'", "]", "=", "{", "'lat'", ":", "-", "arg_14", "if", "arg_12", "!=", "'N'", "else", "arg_14", ",", "'lon'", ":", "-", "arg_15", "if", "arg_13", "!=", "'E'", "else", "arg_15", ",", "}", "return", "arg_3"], "function": "def Func(arg_0, arg_1='%c'):\n    \"\"\"Make a simplified version with common tags from raw EXIF data.\"\"\"\n\n    arg_2 = logging.getLogger(__name__)\n    arg_3 = {}\n\n    for arg_4 in ('Model', 'Make', 'LensModel'):\n        if arg_4 in arg_0:\n            if isinstance(arg_0[arg_4], tuple):\n                arg_3[arg_4] = arg_0[arg_4][0].strip()\n            else:\n                arg_3[arg_4] = arg_0[arg_4].strip()\n\n    if 'FNumber' in arg_0:\n        arg_5 = arg_0['FNumber']\n        try:\n            arg_3['fstop'] = float(arg_5[0]) / arg_5[1]\n        except Exception:\n            arg_2.debug('Skipped invalid FNumber: %r', arg_5, exc_info=True)\n\n    if 'FocalLength' in arg_0:\n        arg_6 = arg_0['FocalLength']\n        try:\n            arg_3['focal'] = round(float(arg_6[0]) / arg_6[1])\n        except Exception:\n            arg_2.debug('Skipped invalid FocalLength: %r', arg_6,\n                         exc_info=True)\n\n    if 'ExposureTime' in arg_0:\n        arg_7 = arg_0['ExposureTime']\n        if isinstance(arg_7, tuple):\n            try:\n                arg_3['exposure'] = str(fractions.Fraction(arg_7[0],\n                                                            arg_7[1]))\n            except ZeroDivisionError:\n                arg_2.info('Invalid ExposureTime: %r', arg_7)\n        elif isinstance(arg_7, int):\n            arg_3['exposure'] = str(arg_7)\n        else:\n            arg_2.info('Unknown format for ExposureTime: %r', arg_7)\n\n    if arg_0.get('ISOSpeedRatings'):\n        arg_3['iso'] = arg_0['ISOSpeedRatings']\n\n    if 'DateTimeOriginal' in arg_0:\n        # Remove null bytes at the end if necessary\n        arg_8 = arg_0['DateTimeOriginal'].rsplit('\\x00')[0]\n\n        try:\n            arg_3['dateobj'] = datetime.strptime(arg_8, '%Y:%m:%d %H:%M:%S')\n            arg_3['datetime'] = arg_3['dateobj'].strftime(arg_1)\n        except (ValueError, TypeError) as e:\n            arg_2.info('Could not parse DateTimeOriginal: %s', e)\n\n    if 'GPSInfo' in arg_0:\n        arg_9 = arg_0['GPSInfo']\n        arg_10 = arg_9.get('GPSLatitude')\n        arg_11 = arg_9.get('GPSLongitude')\n        arg_12 = arg_9.get('GPSLatitudeRef')\n        arg_13 = arg_9.get('GPSLongitudeRef')\n\n        if arg_10 and arg_11 and arg_12 and arg_13:\n            try:\n                arg_14 = dms_to_degrees(arg_10)\n                arg_15 = dms_to_degrees(arg_11)\n            except (ZeroDivisionError, ValueError, TypeError):\n                arg_2.info('Failed to read GPS info')\n            else:\n                arg_3['gps'] = {\n                    'lat': - arg_14 if arg_12 != 'N' else arg_14,\n                    'lon': - arg_15 if arg_13 != 'E' else arg_15,\n                }\n\n    return arg_3", "path": "sigal/image.py", "identifier": "get_exif_tags", "docstring": "Make a simplified version with common tags from raw EXIF data.", "docstring_tokens": ["Make", "a", "simplified", "version", "with", "common", "tags", "from", "raw", "EXIF", "data", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 260303}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L241-L251", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Report summary for a given job group.", "language": "python", "parameters": "(self,group,name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", ":", "print", "'%s jobs:'", "%", "arg_2", "for", "arg_3", "in", "arg_1", ":", "print", "'%s : %s'", "%", "(", "arg_3", ".", "num", ",", "arg_3", ")", "print", "return", "True"], "function": "def Func(arg_0,arg_1,arg_2):\n        \"\"\"Report summary for a given job group.\n\n        Return True if the group had any elements.\"\"\"\n\n        if arg_1:\n            print '%s jobs:' % arg_2\n            for arg_3 in arg_1:\n                print '%s : %s' % (arg_3.num,arg_3)\n            print\n            return True", "path": "environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py", "identifier": "BackgroundJobManager._group_report", "docstring": "Report summary for a given job group.\n\n        Return True if the group had any elements.", "docstring_tokens": ["Report", "summary", "for", "a", "given", "job", "group", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260304}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/engine.py#L529-L574", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Given a kmip.core TemplateAttribute object, extract the attribute\n        value data into a usable dictionary format.", "language": "python", "parameters": "(self, template_attribute)", "return_statement": "return attributes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "if", "len", "(", "arg_1", ".", "names", ")", ">", "0", ":", "raise", "exceptions", ".", "ItemNotFound", "(", "\"Attribute templates are not supported.\"", ")", "for", "arg_3", "in", "arg_1", ".", "attributes", ":", "arg_4", "=", "arg_3", ".", "attribute_name", ".", "value", "if", "not", "arg_0", ".", "_attribute_policy", ".", "is_attribute_supported", "(", "arg_4", ")", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The {0} attribute is unsupported.\"", ".", "format", "(", "arg_4", ")", ")", "if", "arg_0", ".", "_attribute_policy", ".", "is_attribute_multivalued", "(", "arg_4", ")", ":", "arg_5", "=", "arg_2", ".", "get", "(", "arg_4", ",", "list", "(", ")", ")", "if", "(", "not", "arg_3", ".", "attribute_index", ")", "and", "len", "(", "arg_5", ")", ">", "0", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"Attribute index missing from multivalued attribute.\"", ")", "arg_5", ".", "append", "(", "arg_3", ".", "attribute_value", ")", "arg_2", ".", "update", "(", "[", "(", "arg_4", ",", "arg_5", ")", "]", ")", "else", ":", "if", "arg_3", ".", "attribute_index", ":", "if", "arg_3", ".", "attribute_index", ".", "value", "!=", "0", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"Non-zero attribute index found for \"", "\"single-valued attribute.\"", ")", "arg_6", "=", "arg_2", ".", "get", "(", "arg_4", ",", "None", ")", "if", "arg_6", ":", "raise", "exceptions", ".", "IndexOutOfBounds", "(", "\"Cannot set multiple instances of the \"", "\"{0} attribute.\"", ".", "format", "(", "arg_4", ")", ")", "else", ":", "arg_2", ".", "update", "(", "[", "(", "arg_4", ",", "arg_3", ".", "attribute_value", ")", "]", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Given a kmip.core TemplateAttribute object, extract the attribute\n        value data into a usable dictionary format.\n        \"\"\"\n        arg_2 = {}\n\n        if len(arg_1.names) > 0:\n            raise exceptions.ItemNotFound(\n                \"Attribute templates are not supported.\"\n            )\n\n        for arg_3 in arg_1.attributes:\n            arg_4 = arg_3.attribute_name.value\n\n            if not arg_0._attribute_policy.is_attribute_supported(arg_4):\n                raise exceptions.InvalidField(\n                    \"The {0} attribute is unsupported.\".format(arg_4)\n                )\n\n            if arg_0._attribute_policy.is_attribute_multivalued(arg_4):\n                arg_5 = arg_2.get(arg_4, list())\n                if (not arg_3.attribute_index) and len(arg_5) > 0:\n                    raise exceptions.InvalidField(\n                        \"Attribute index missing from multivalued attribute.\"\n                    )\n\n                arg_5.append(arg_3.attribute_value)\n                arg_2.update([(arg_4, arg_5)])\n            else:\n                if arg_3.attribute_index:\n                    if arg_3.attribute_index.value != 0:\n                        raise exceptions.InvalidField(\n                            \"Non-zero attribute index found for \"\n                            \"single-valued attribute.\"\n                        )\n                arg_6 = arg_2.get(arg_4, None)\n                if arg_6:\n                    raise exceptions.IndexOutOfBounds(\n                        \"Cannot set multiple instances of the \"\n                        \"{0} attribute.\".format(arg_4)\n                    )\n                else:\n                    arg_2.update([(arg_4, arg_3.attribute_value)])\n\n        return arg_2", "path": "kmip/services/server/engine.py", "identifier": "KmipEngine._process_template_attribute", "docstring": "Given a kmip.core TemplateAttribute object, extract the attribute\n        value data into a usable dictionary format.", "docstring_tokens": ["Given", "a", "kmip", ".", "core", "TemplateAttribute", "object", "extract", "the", "attribute", "value", "data", "into", "a", "usable", "dictionary", "format", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 260305}
{"url": "https://github.com/Crypto-toolbox/btfxwss/blob/16827fa6aacb2c0e289aa852bf61a18df6905835/btfxwss/connection.py#L458-L491", "sha": "16827fa6aacb2c0e289aa852bf61a18df6905835", "docstring_summary": "Handle Error messages and log them accordingly.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "10000", ":", "'Unknown event'", ",", "10001", ":", "'Generic error'", ",", "10008", ":", "'Concurrency error'", ",", "10020", ":", "'Request parameters error'", ",", "10050", ":", "'Configuration setup failed'", ",", "10100", ":", "'Failed authentication'", ",", "10111", ":", "'Error in authentication request payload'", ",", "10112", ":", "'Error in authentication request signature'", ",", "10113", ":", "'Error in authentication request encryption'", ",", "10114", ":", "'Error in authentication request nonce'", ",", "10200", ":", "'Error in un-authentication request'", ",", "10300", ":", "'Subscription Failed (generic)'", ",", "10301", ":", "'Already Subscribed'", ",", "10302", ":", "'Unknown channel'", ",", "10400", ":", "'Subscription Failed (generic)'", ",", "10401", ":", "'Not subscribed'", ",", "11000", ":", "'Not ready, try again later'", ",", "20000", ":", "'User is invalid!'", ",", "20051", ":", "'Websocket server stopping'", ",", "20060", ":", "'Websocket server resyncing'", ",", "20061", ":", "'Websocket server resync complete'", "}", "try", ":", "arg_0", ".", "log", ".", "error", "(", "arg_2", "[", "arg_1", "[", "'code'", "]", "]", ")", "except", "KeyError", ":", "arg_0", ".", "log", ".", "error", "(", "\"Received unknown error Code in message %s! \"", "\"Reconnecting..\"", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Handle Error messages and log them accordingly.\n\n        :param data:\n        :param ts:\n        \"\"\"\n        arg_2 = {10000: 'Unknown event',\n                  10001: 'Generic error',\n                  10008: 'Concurrency error',\n                  10020: 'Request parameters error',\n                  10050: 'Configuration setup failed',\n                  10100: 'Failed authentication',\n                  10111: 'Error in authentication request payload',\n                  10112: 'Error in authentication request signature',\n                  10113: 'Error in authentication request encryption',\n                  10114: 'Error in authentication request nonce',\n                  10200: 'Error in un-authentication request',\n                  10300: 'Subscription Failed (generic)',\n                  10301: 'Already Subscribed',\n                  10302: 'Unknown channel',\n                  10400: 'Subscription Failed (generic)',\n                  10401: 'Not subscribed',\n                  11000: 'Not ready, try again later',\n                  20000: 'User is invalid!',\n                  20051: 'Websocket server stopping',\n                  20060: 'Websocket server resyncing',\n                  20061: 'Websocket server resync complete'\n                  }\n        try:\n            arg_0.log.error(arg_2[arg_1['code']])\n        except KeyError:\n            arg_0.log.error(\"Received unknown error Code in message %s! \"\n                           \"Reconnecting..\", arg_1)", "path": "btfxwss/connection.py", "identifier": "WebSocketConnection._error_handler", "docstring": "Handle Error messages and log them accordingly.\n\n        :param data:\n        :param ts:", "docstring_tokens": ["Handle", "Error", "messages", "and", "log", "them", "accordingly", "."], "nwo": "Crypto-toolbox/btfxwss", "score": 0.6139886433376424, "idx": 260306}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/simplejson/__init__.py#L188-L241", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Serialize ``obj`` to a JSON formatted ``str``.", "language": "python", "parameters": "(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n        allow_nan=True, cls=None, indent=None, separators=None,\n        encoding='utf-8', default=None, **kw)", "return_statement": "return cls(\n        skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n        check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n        separators=separators, encoding=encoding, default=default,\n        **kw).encode(obj)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "'utf-8'", ",", "arg_9", "=", "None", ",", "**", "arg_10", ")", ":", "if", "(", "arg_1", "is", "False", "and", "arg_2", "is", "True", "and", "arg_3", "is", "True", "and", "arg_4", "is", "True", "and", "arg_5", "is", "None", "and", "arg_6", "is", "None", "and", "arg_7", "is", "None", "and", "arg_8", "==", "'utf-8'", "and", "arg_9", "is", "None", "and", "not", "arg_10", ")", ":", "return", "_default_encoder", ".", "encode", "(", "arg_0", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "JSONEncoder", "return", "arg_5", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "**", "arg_10", ")", ".", "encode", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True, arg_3=True,\n        arg_4=True, arg_5=None, arg_6=None, arg_7=None,\n        arg_8='utf-8', arg_9=None, **arg_10):\n    \"\"\"\n    Serialize ``obj`` to a JSON formatted ``str``.\n\n    If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n    (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) \n    will be skipped instead of raising a ``TypeError``.\n\n    If ``ensure_ascii`` is ``False``, then the return value will be a\n    ``unicode`` instance subject to normal Python ``str`` to ``unicode``\n    coercion rules instead of being escaped to an ASCII ``str``.\n\n    If ``check_circular`` is ``False``, then the circular reference check\n    for container types will be skipped and a circular reference will\n    result in an ``OverflowError`` (or worse).\n\n    If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to\n    serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in\n    strict compliance of the JSON specification, instead of using the\n    JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).\n\n    If ``indent`` is a non-negative integer, then JSON array elements and\n    object members will be pretty-printed with that indent level. An indent\n    level of 0 will only insert newlines. ``None`` is the most compact\n    representation.\n\n    If ``separators`` is an ``(item_separator, dict_separator)`` tuple\n    then it will be used instead of the default ``(', ', ': ')`` separators.\n    ``(',', ':')`` is the most compact JSON representation.\n\n    ``encoding`` is the character encoding for str instances, default is UTF-8.\n\n    ``default(obj)`` is a function that should return a serializable version\n    of obj or raise TypeError. The default simply raises TypeError.\n\n    To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the\n    ``.default()`` method to serialize additional types), specify it with\n    the ``cls`` kwarg.\n    \"\"\"\n    # cached encoder\n    if (arg_1 is False and arg_2 is True and\n        arg_3 is True and arg_4 is True and\n        arg_5 is None and arg_6 is None and arg_7 is None and\n        arg_8 == 'utf-8' and arg_9 is None and not arg_10):\n        return _default_encoder.encode(arg_0)\n    if arg_5 is None:\n        arg_5 = JSONEncoder\n    return arg_5(\n        arg_1=arg_1, arg_2=arg_2,\n        arg_3=arg_3, arg_4=arg_4, arg_6=arg_6,\n        arg_7=arg_7, arg_8=arg_8, arg_9=arg_9,\n        **arg_10).encode(arg_0)", "path": "lib/web/simplejson/__init__.py", "identifier": "dumps", "docstring": "Serialize ``obj`` to a JSON formatted ``str``.\n\n    If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n    (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) \n    will be skipped instead of raising a ``TypeError``.\n\n    If ``ensure_ascii`` is ``False``, then the return value will be a\n    ``unicode`` instance subject to normal Python ``str`` to ``unicode``\n    coercion rules instead of being escaped to an ASCII ``str``.\n\n    If ``check_circular`` is ``False``, then the circular reference check\n    for container types will be skipped and a circular reference will\n    result in an ``OverflowError`` (or worse).\n\n    If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to\n    serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in\n    strict compliance of the JSON specification, instead of using the\n    JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).\n\n    If ``indent`` is a non-negative integer, then JSON array elements and\n    object members will be pretty-printed with that indent level. An indent\n    level of 0 will only insert newlines. ``None`` is the most compact\n    representation.\n\n    If ``separators`` is an ``(item_separator, dict_separator)`` tuple\n    then it will be used instead of the default ``(', ', ': ')`` separators.\n    ``(',', ':')`` is the most compact JSON representation.\n\n    ``encoding`` is the character encoding for str instances, default is UTF-8.\n\n    ``default(obj)`` is a function that should return a serializable version\n    of obj or raise TypeError. The default simply raises TypeError.\n\n    To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the\n    ``.default()`` method to serialize additional types), specify it with\n    the ``cls`` kwarg.", "docstring_tokens": ["Serialize", "obj", "to", "a", "JSON", "formatted", "str", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260307}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/mixins/geo.py#L103-L107", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "entry point for contrast stretching", "language": "python", "parameters": "(self, use_bands, **kwargs)", "return_statement": "return self._histogram_stretch(data, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_read", "(", "arg_0", "[", "arg_1", ",", "...", "]", ",", "**", "arg_2", ")", "arg_3", "=", "np", ".", "rollaxis", "(", "arg_3", ".", "astype", "(", "np", ".", "float32", ")", ",", "0", ",", "3", ")", "return", "arg_0", ".", "_Func", "(", "arg_3", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        ''' entry point for contrast stretching '''\n        arg_3 = arg_0._read(arg_0[arg_1,...], **arg_2)\n        arg_3 = np.rollaxis(arg_3.astype(np.float32), 0, 3)\n        return arg_0._Func(arg_3, **arg_2)", "path": "gbdxtools/images/mixins/geo.py", "identifier": "PlotMixin.histogram_stretch", "docstring": "entry point for contrast stretching", "docstring_tokens": ["entry", "point", "for", "contrast", "stretching"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 260308}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/io.py#L134-L139", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Close the file and restore the channel.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "flush", "(", ")", "setattr", "(", "sys", ",", "arg_0", ".", "channel", ",", "arg_0", ".", "ostream", ")", "arg_0", ".", "file", ".", "Func", "(", ")", "arg_0", ".", "_Funcd", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"Close the file and restore the channel.\"\"\"\n        arg_0.flush()\n        setattr(sys, arg_0.channel, arg_0.ostream)\n        arg_0.file.Func()\n        arg_0._Funcd = True", "path": "environment/lib/python2.7/site-packages/IPython/utils/io.py", "identifier": "Tee.close", "docstring": "Close the file and restore the channel.", "docstring_tokens": ["Close", "the", "file", "and", "restore", "the", "channel", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260309}
{"url": "https://github.com/stevelittlefish/littlefish/blob/6deee7f81fab30716c743efe2e94e786c6e17016/littlefish/pager.py#L118-L131", "sha": "6deee7f81fab30716c743efe2e94e786c6e17016", "docstring_summary": "Get the full, external URL for this page, optinally with the passed in URL scheme", "language": "python", "parameters": "(self, page_number, scheme=None)", "return_statement": "return url_for(request.endpoint, **args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "dict", "(", "request", ".", "view_args", ",", "_external", "=", "True", ",", ")", "if", "arg_2", "is", "not", "None", ":", "arg_3", "[", "'_scheme'", "]", "=", "arg_2", "if", "arg_1", "!=", "1", ":", "arg_3", "[", "'page'", "]", "=", "arg_1", "return", "url_for", "(", "request", ".", "endpoint", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Get the full, external URL for this page, optinally with the passed in URL scheme\"\"\"\n        arg_3 = dict(\n            request.view_args,\n            _external=True,\n        )\n\n        if arg_2 is not None:\n            arg_3['_scheme'] = arg_2\n        \n        if arg_1 != 1:\n            arg_3['page'] = arg_1\n\n        return url_for(request.endpoint, **arg_3)", "path": "littlefish/pager.py", "identifier": "Pager.get_full_page_url", "docstring": "Get the full, external URL for this page, optinally with the passed in URL scheme", "docstring_tokens": ["Get", "the", "full", "external", "URL", "for", "this", "page", "optinally", "with", "the", "passed", "in", "URL", "scheme"], "nwo": "stevelittlefish/littlefish", "score": 0.23137166388621372, "idx": 260310}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L51-L57", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Return if the formation of a complex with u increases the activity of v.", "language": "python", "parameters": "(graph: BELGraph, u: BaseEntity, v: BaseEntity, key: str)", "return_statement": "return (\n        isinstance(u, (ComplexAbundance, NamedComplexAbundance)) and\n        complex_has_member(graph, u, v) and\n        part_has_modifier(graph[u][v][key], OBJECT, ACTIVITY)\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_3", ",", "arg_5", ":", "arg_6", ")", "->", "bool", ":", "return", "(", "isinstance", "(", "arg_2", ",", "(", "ComplexAbundance", ",", "NamedComplexAbundance", ")", ")", "and", "complex_has_member", "(", "arg_0", ",", "arg_2", ",", "arg_4", ")", "and", "part_has_modifier", "(", "arg_0", "[", "arg_2", "]", "[", "arg_4", "]", "[", "arg_5", "]", ",", "OBJECT", ",", "ACTIVITY", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_3, arg_5: arg_6) -> bool:\n    \"\"\"Return if the formation of a complex with u increases the activity of v.\"\"\"\n    return (\n        isinstance(arg_2, (ComplexAbundance, NamedComplexAbundance)) and\n        complex_has_member(arg_0, arg_2, arg_4) and\n        part_has_modifier(arg_0[arg_2][arg_4][arg_5], OBJECT, ACTIVITY)\n    )", "path": "src/pybel_tools/biogrammar/double_edges.py", "identifier": "complex_increases_activity", "docstring": "Return if the formation of a complex with u increases the activity of v.", "docstring_tokens": ["Return", "if", "the", "formation", "of", "a", "complex", "with", "u", "increases", "the", "activity", "of", "v", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260311}
{"url": "https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/source_data/loaders.py#L7-L28", "sha": "5e9e803c9131b377af305d5302723ba2415001da", "docstring_summary": "Load the cars dataset, split it into X and y, and then call the label encoder to get an integer y column.", "language": "python", "parameters": "()", "return_statement": "return X, y, mapping", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "pd", ".", "read_csv", "(", "'source_data/cars/car.data.txt'", ")", "arg_1", "=", "arg_0", ".", "reindex", "(", "columns", "=", "[", "x", "for", "x", "in", "arg_0", ".", "columns", ".", "values", "if", "x", "!=", "'class'", "]", ")", "arg_2", "=", "arg_0", ".", "reindex", "(", "columns", "=", "[", "'class'", "]", ")", "arg_2", "=", "preprocessing", ".", "LabelEncoder", "(", ")", ".", "fit_transform", "(", "arg_2", ".", "values", ".", "reshape", "(", "-", "1", ",", ")", ")", "arg_3", "=", "[", "{", "'col'", ":", "'buying'", ",", "'mapping'", ":", "[", "(", "'vhigh'", ",", "0", ")", ",", "(", "'high'", ",", "1", ")", ",", "(", "'med'", ",", "2", ")", ",", "(", "'low'", ",", "3", ")", "]", "}", ",", "{", "'col'", ":", "'maint'", ",", "'mapping'", ":", "[", "(", "'vhigh'", ",", "0", ")", ",", "(", "'high'", ",", "1", ")", ",", "(", "'med'", ",", "2", ")", ",", "(", "'low'", ",", "3", ")", "]", "}", ",", "{", "'col'", ":", "'doors'", ",", "'mapping'", ":", "[", "(", "'2'", ",", "0", ")", ",", "(", "'3'", ",", "1", ")", ",", "(", "'4'", ",", "2", ")", ",", "(", "'5more'", ",", "3", ")", "]", "}", ",", "{", "'col'", ":", "'persons'", ",", "'mapping'", ":", "[", "(", "'2'", ",", "0", ")", ",", "(", "'4'", ",", "1", ")", ",", "(", "'more'", ",", "2", ")", "]", "}", ",", "{", "'col'", ":", "'lug_boot'", ",", "'mapping'", ":", "[", "(", "'small'", ",", "0", ")", ",", "(", "'med'", ",", "1", ")", ",", "(", "'big'", ",", "2", ")", "]", "}", ",", "{", "'col'", ":", "'safety'", ",", "'mapping'", ":", "[", "(", "'high'", ",", "0", ")", ",", "(", "'med'", ",", "1", ")", ",", "(", "'low'", ",", "2", ")", "]", "}", ",", "]", "return", "arg_1", ",", "arg_2", ",", "arg_3"], "function": "def Func():\n    \"\"\"\n    Load the cars dataset, split it into X and y, and then call the label encoder to get an integer y column.\n\n    :return:\n    \"\"\"\n\n    arg_0 = pd.read_csv('source_data/cars/car.data.txt')\n    arg_1 = arg_0.reindex(columns=[x for x in arg_0.columns.values if x != 'class'])\n    arg_2 = arg_0.reindex(columns=['class'])\n    arg_2 = preprocessing.LabelEncoder().fit_transform(arg_2.values.reshape(-1, ))\n\n    arg_3 = [\n        {'col': 'buying', 'mapping': [('vhigh', 0), ('high', 1), ('med', 2), ('low', 3)]},\n        {'col': 'maint', 'mapping': [('vhigh', 0), ('high', 1), ('med', 2), ('low', 3)]},\n        {'col': 'doors', 'mapping': [('2', 0), ('3', 1), ('4', 2), ('5more', 3)]},\n        {'col': 'persons', 'mapping': [('2', 0), ('4', 1), ('more', 2)]},\n        {'col': 'lug_boot', 'mapping': [('small', 0), ('med', 1), ('big', 2)]},\n        {'col': 'safety', 'mapping': [('high', 0), ('med', 1), ('low', 2)]},\n    ]\n\n    return arg_1, arg_2, arg_3", "path": "examples/source_data/loaders.py", "identifier": "get_cars_data", "docstring": "Load the cars dataset, split it into X and y, and then call the label encoder to get an integer y column.\n\n    :return:", "docstring_tokens": ["Load", "the", "cars", "dataset", "split", "it", "into", "X", "and", "y", "and", "then", "call", "the", "label", "encoder", "to", "get", "an", "integer", "y", "column", "."], "nwo": "scikit-learn-contrib/categorical-encoding", "score": 0.948361178849178, "idx": 260312}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L658-L690", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Reads the current \"best model\" for the job and returns whether or not the\n    current model is better than the \"best model\" stored for the job", "language": "python", "parameters": "(self)", "return_statement": "return self._isBestModel, jobResults, jobResultsStr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_jobsDAO", ".", "jobGetFields", "(", "arg_0", ".", "_jobID", ",", "[", "'results'", "]", ")", "[", "0", "]", "if", "arg_1", "is", "None", ":", "arg_2", "=", "{", "}", "else", ":", "arg_2", "=", "json", ".", "loads", "(", "arg_1", ")", "arg_3", "=", "arg_2", ".", "get", "(", "'saved'", ",", "False", ")", "arg_4", "=", "arg_2", ".", "get", "(", "'bestValue'", ",", "None", ")", "arg_5", "=", "arg_0", ".", "_getMetrics", "(", ")", "[", "arg_0", ".", "_optimizedMetricLabel", "]", "arg_0", ".", "_isBestModel", "=", "(", "not", "arg_3", ")", "or", "(", "arg_5", "<", "arg_4", ")", "return", "arg_0", ".", "_isBestModel", ",", "arg_2", ",", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Reads the current \"best model\" for the job and returns whether or not the\n    current model is better than the \"best model\" stored for the job\n\n    Returns: (isBetter, storedBest, origResultsStr)\n\n    isBetter:\n      True if the current model is better than the stored \"best model\"\n    storedResults:\n      A dict of the currently stored results in the jobs table record\n    origResultsStr:\n      The json-encoded string that currently resides in the \"results\" field\n      of the jobs record (used to create atomicity)\n    \"\"\"\n\n    arg_1 = arg_0._jobsDAO.jobGetFields(arg_0._jobID, ['results'])[0]\n\n    if arg_1 is None:\n        arg_2 = {}\n    else:\n      arg_2 = json.loads(arg_1)\n\n    arg_3 = arg_2.get('saved', False)\n    arg_4 = arg_2.get('bestValue', None)\n\n    arg_5 = arg_0._getMetrics()[arg_0._optimizedMetricLabel]\n    arg_0._isBestModel = (not arg_3) \\\n                        or (arg_5 < arg_4)\n\n\n\n    return arg_0._isBestModel, arg_2, arg_1", "path": "src/nupic/swarming/ModelRunner.py", "identifier": "OPFModelRunner.__checkIfBestCompletedModel", "docstring": "Reads the current \"best model\" for the job and returns whether or not the\n    current model is better than the \"best model\" stored for the job\n\n    Returns: (isBetter, storedBest, origResultsStr)\n\n    isBetter:\n      True if the current model is better than the stored \"best model\"\n    storedResults:\n      A dict of the currently stored results in the jobs table record\n    origResultsStr:\n      The json-encoded string that currently resides in the \"results\" field\n      of the jobs record (used to create atomicity)", "docstring_tokens": ["Reads", "the", "current", "best", "model", "for", "the", "job", "and", "returns", "whether", "or", "not", "the", "current", "model", "is", "better", "than", "the", "best", "model", "stored", "for", "the", "job"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260313}
{"url": "https://github.com/nficano/python-lambda/blob/b0bd25404df70212d7fa057758760366406d64f2/aws_lambda/aws_lambda.py#L400-L421", "sha": "b0bd25404df70212d7fa057758760366406d64f2", "docstring_summary": "Install all packages listed to the target directory.", "language": "python", "parameters": "(path, packages)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "_filter_blacklist", "(", "arg_2", ")", ":", "arg_3", "=", "[", "'-i'", ",", "'#'", ",", "'Python=='", ",", "'python-lambda=='", "]", "return", "all", "(", "arg_2", ".", "startswith", "(", "arg_4", ")", "is", "False", "for", "arg_4", "in", "arg_3", ")", "arg_5", "=", "filter", "(", "_filter_blacklist", ",", "arg_1", ")", "for", "arg_2", "in", "arg_5", ":", "if", "arg_2", ".", "startswith", "(", "'-e '", ")", ":", "arg_2", "=", "arg_2", ".", "replace", "(", "'-e '", ",", "''", ")", "print", "(", "'Installing {package}'", ".", "format", "(", "arg_2", "=", "arg_2", ")", ")", "subprocess", ".", "check_call", "(", "[", "sys", ".", "executable", ",", "'-m'", ",", "'pip'", ",", "'install'", ",", "arg_2", ",", "'-t'", ",", "arg_0", ",", "'--ignore-installed'", "]", ")", "print", "(", "'Install directory contents are now: {directory}'", ".", "format", "(", "directory", "=", "os", ".", "listdir", "(", "arg_0", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Install all packages listed to the target directory.\n\n    Ignores any package that includes Python itself and python-lambda as well\n    since its only needed for deploying and not running the code\n\n    :param str path:\n        Path to copy installed pip packages to.\n    :param list packages:\n        A list of packages to be installed via pip.\n    \"\"\"\n    def _filter_blacklist(arg_2):\n        arg_3 = ['-i', '#', 'Python==', 'python-lambda==']\n        return all(arg_2.startswith(arg_4) is False for arg_4 in arg_3)\n    arg_5 = filter(_filter_blacklist, arg_1)\n    for arg_2 in arg_5:\n        if arg_2.startswith('-e '):\n            arg_2 = arg_2.replace('-e ', '')\n\n        print('Installing {package}'.format(arg_2=arg_2))\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install', arg_2, '-t', arg_0, '--ignore-installed'])\n    print ('Install directory contents are now: {directory}'.format(directory=os.listdir(arg_0)))", "path": "aws_lambda/aws_lambda.py", "identifier": "_install_packages", "docstring": "Install all packages listed to the target directory.\n\n    Ignores any package that includes Python itself and python-lambda as well\n    since its only needed for deploying and not running the code\n\n    :param str path:\n        Path to copy installed pip packages to.\n    :param list packages:\n        A list of packages to be installed via pip.", "docstring_tokens": ["Install", "all", "packages", "listed", "to", "the", "target", "directory", "."], "nwo": "nficano/python-lambda", "score": 0.7856642350024847, "idx": 260314}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L688-L700", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup the random seed. If the input seed is -1, the code will use a random seed for every run. If it is \\\n    positive, that seed is used for all runs, thereby giving reproducible results.", "language": "python", "parameters": "(seed)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "==", "-", "1", ":", "arg_0", "=", "np", ".", "random", ".", "randint", "(", "0", ",", "int", "(", "1e9", ")", ")", "np", ".", "random", ".", "seed", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Setup the random seed. If the input seed is -1, the code will use a random seed for every run. If it is \\\n    positive, that seed is used for all runs, thereby giving reproducible results.\n\n    Parameters\n    ----------\n    seed : int\n        The seed of the random number generator.\n    \"\"\"\n    if arg_0 == -1:\n        arg_0 = np.random.randint(0,\n                                 int(1e9))  # Use one seed, so all regions have identical column non-uniformity.\n    np.random.seed(arg_0)", "path": "autolens/data/ccd.py", "identifier": "setup_random_seed", "docstring": "Setup the random seed. If the input seed is -1, the code will use a random seed for every run. If it is \\\n    positive, that seed is used for all runs, thereby giving reproducible results.\n\n    Parameters\n    ----------\n    seed : int\n        The seed of the random number generator.", "docstring_tokens": ["Setup", "the", "random", "seed", ".", "If", "the", "input", "seed", "is", "-", "1", "the", "code", "will", "use", "a", "random", "seed", "for", "every", "run", ".", "If", "it", "is", "\\", "positive", "that", "seed", "is", "used", "for", "all", "runs", "thereby", "giving", "reproducible", "results", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 260315}
{"url": "https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie/astropixie/data.py#L296-L323", "sha": "8e17ebec509be5c3cc2063f4645dfe9e26b49c18", "docstring_summary": "Create a pandas DataFrame from a numpy ndarray.", "language": "python", "parameters": "(arr, columns=('temperature', 'luminosity'),\n           names=('Temperature (Kelvin)', 'Luminosity (solar units)'),\n           max_rows=32, precision=2)", "return_statement": "return df.style.format({names[0]: '{:.0f}',\n                            names[1]: '{:.2f}'})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", "'temperature'", ",", "'luminosity'", ")", ",", "arg_2", "=", "(", "'Temperature (Kelvin)'", ",", "'Luminosity (solar units)'", ")", ",", "arg_3", "=", "32", ",", "arg_4", "=", "2", ")", ":", "if", "arg_3", "is", "True", ":", "pd", ".", "set_option", "(", "'display.max_rows'", ",", "1000", ")", "elif", "type", "(", "arg_3", ")", "is", "int", ":", "pd", ".", "set_option", "(", "'display.max_rows'", ",", "arg_3", ")", "pd", ".", "set_option", "(", "'precision'", ",", "arg_4", ")", "arg_5", "=", "pd", ".", "DataFrame", "(", "arg_0", ".", "flatten", "(", ")", ",", "index", "=", "arg_0", "[", "'id'", "]", ".", "flatten", "(", ")", ",", "arg_1", "=", "arg_1", ")", "arg_5", ".", "columns", "=", "arg_2", "return", "arg_5", ".", "style", ".", "format", "(", "{", "arg_2", "[", "0", "]", ":", "'{:.0f}'", ",", "arg_2", "[", "1", "]", ":", "'{:.2f}'", "}", ")"], "function": "def Func(arg_0, arg_1=('temperature', 'luminosity'),\n           arg_2=('Temperature (Kelvin)', 'Luminosity (solar units)'),\n           arg_3=32, arg_4=2):\n    \"\"\"\n    Create a pandas DataFrame from a numpy ndarray.\n\n    By default use temp and lum with max rows of 32 and precision of 2.\n\n    arr - An numpy.ndarray.\n    columns - The columns to include in the pandas DataFrame. Defaults to\n              temperature and luminosity.\n    names - The column names for the pandas DataFrame. Defaults to\n            Temperature and Luminosity.\n    max_rows - If max_rows is an integer then set the pandas\n               display.max_rows option to that value. If max_rows\n               is True then set display.max_rows option  to 1000.\n    precision - An integer to set the pandas precision option.\n    \"\"\"\n    if arg_3 is True:\n        pd.set_option('display.max_rows', 1000)\n    elif type(arg_3) is int:\n        pd.set_option('display.max_rows', arg_3)\n    pd.set_option('precision', arg_4)\n    arg_5 = pd.DataFrame(arg_0.flatten(), index=arg_0['id'].flatten(),\n                      arg_1=arg_1)\n    arg_5.columns = arg_2\n    return arg_5.style.format({arg_2[0]: '{:.0f}',\n                            arg_2[1]: '{:.2f}'})", "path": "astropixie/astropixie/data.py", "identifier": "pprint", "docstring": "Create a pandas DataFrame from a numpy ndarray.\n\n    By default use temp and lum with max rows of 32 and precision of 2.\n\n    arr - An numpy.ndarray.\n    columns - The columns to include in the pandas DataFrame. Defaults to\n              temperature and luminosity.\n    names - The column names for the pandas DataFrame. Defaults to\n            Temperature and Luminosity.\n    max_rows - If max_rows is an integer then set the pandas\n               display.max_rows option to that value. If max_rows\n               is True then set display.max_rows option  to 1000.\n    precision - An integer to set the pandas precision option.", "docstring_tokens": ["Create", "a", "pandas", "DataFrame", "from", "a", "numpy", "ndarray", "."], "nwo": "lsst-epo/vela", "score": 0.15726537023232431, "idx": 260316}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/dbapi_hook.py#L132-L166", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Runs a command or a list of commands. Pass a list of sql\n        statements to the sql parameter to get them to execute\n        sequentially", "language": "python", "parameters": "(self, sql, autocommit=False, parameters=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "if", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_1", "=", "[", "arg_1", "]", "with", "closing", "(", "arg_0", ".", "get_conn", "(", ")", ")", "as", "conn", ":", "if", "arg_0", ".", "supports_autocommit", ":", "arg_0", ".", "set_autocommit", "(", "conn", ",", "arg_2", ")", "with", "closing", "(", "conn", ".", "cursor", "(", ")", ")", "as", "cur", ":", "for", "arg_4", "in", "arg_1", ":", "if", "arg_3", "is", "not", "None", ":", "arg_0", ".", "log", ".", "info", "(", "\"{} with parameters {}\"", ".", "format", "(", "arg_4", ",", "arg_3", ")", ")", "cur", ".", "execute", "(", "arg_4", ",", "arg_3", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "arg_4", ")", "cur", ".", "execute", "(", "arg_4", ")", "if", "not", "arg_0", ".", "get_autocommit", "(", "conn", ")", ":", "conn", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=None):\n        \"\"\"\n        Runs a command or a list of commands. Pass a list of sql\n        statements to the sql parameter to get them to execute\n        sequentially\n\n        :param sql: the sql statement to be executed (str) or a list of\n            sql statements to execute\n        :type sql: str or list\n        :param autocommit: What to set the connection's autocommit setting to\n            before executing the query.\n        :type autocommit: bool\n        :param parameters: The parameters to render the SQL query with.\n        :type parameters: mapping or iterable\n        \"\"\"\n        if isinstance(arg_1, basestring):\n            arg_1 = [arg_1]\n\n        with closing(arg_0.get_conn()) as conn:\n            if arg_0.supports_autocommit:\n                arg_0.set_autocommit(conn, arg_2)\n\n            with closing(conn.cursor()) as cur:\n                for arg_4 in arg_1:\n                    if arg_3 is not None:\n                        arg_0.log.info(\"{} with parameters {}\".format(arg_4, arg_3))\n                        cur.execute(arg_4, arg_3)\n                    else:\n                        arg_0.log.info(arg_4)\n                        cur.execute(arg_4)\n\n            # If autocommit was set to False for db that supports autocommit,\n            # or if db does not supports autocommit, we do a manual commit.\n            if not arg_0.get_autocommit(conn):\n                conn.commit()", "path": "airflow/hooks/dbapi_hook.py", "identifier": "DbApiHook.run", "docstring": "Runs a command or a list of commands. Pass a list of sql\n        statements to the sql parameter to get them to execute\n        sequentially\n\n        :param sql: the sql statement to be executed (str) or a list of\n            sql statements to execute\n        :type sql: str or list\n        :param autocommit: What to set the connection's autocommit setting to\n            before executing the query.\n        :type autocommit: bool\n        :param parameters: The parameters to render the SQL query with.\n        :type parameters: mapping or iterable", "docstring_tokens": ["Runs", "a", "command", "or", "a", "list", "of", "commands", ".", "Pass", "a", "list", "of", "sql", "statements", "to", "the", "sql", "parameter", "to", "get", "them", "to", "execute", "sequentially"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260317}
{"url": "https://github.com/shaunduncan/giphypop/blob/21e7f51c4f000ae24be3805b7eeec52bcce3d390/giphypop.py#L559-L566", "sha": "21e7f51c4f000ae24be3805b7eeec52bcce3d390", "docstring_summary": "Shorthand for creating a Giphy api wrapper with the given api key\n    and then calling the upload method.", "language": "python", "parameters": "(tags, file_path, username=None, api_key=GIPHY_PUBLIC_KEY,\n           strict=False)", "return_statement": "return Giphy(api_key=api_key, strict=strict).upload(\n        tags, file_path, username)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "False", ")", ":", "return", "Giphy", "(", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ")", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=arg_4,\n           arg_5=False):\n    \"\"\"\n    Shorthand for creating a Giphy api wrapper with the given api key\n    and then calling the Func method.\n    \"\"\"\n    return Giphy(arg_3=arg_3, arg_5=arg_5).Func(\n        arg_0, arg_1, arg_2)", "path": "giphypop.py", "identifier": "upload", "docstring": "Shorthand for creating a Giphy api wrapper with the given api key\n    and then calling the upload method.", "docstring_tokens": ["Shorthand", "for", "creating", "a", "Giphy", "api", "wrapper", "with", "the", "given", "api", "key", "and", "then", "calling", "the", "upload", "method", "."], "nwo": "shaunduncan/giphypop", "score": 0.19428525902463561, "idx": 260318}
{"url": "https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L206-L219", "sha": "976935377adaa3de26fc5677aceb2cdfbd6f93a7", "docstring_summary": "Remove consecutive delimiters.", "language": "python", "parameters": "(expr, ldelim=\"(\", rdelim=\")\")", "return_statement": "return expr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"(\"", ",", "arg_2", "=", "\")\"", ")", ":", "arg_3", "=", "_pair_delims", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_3", ",", "arg_3", "[", "1", ":", "]", ")", ":", "if", "arg_5", "==", "(", "arg_6", "[", "0", "]", "-", "1", ",", "arg_6", "[", "1", "]", "+", "1", ")", ":", "arg_4", ".", "extend", "(", "arg_6", ")", "arg_4", ".", "sort", "(", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_4", ")", ":", "arg_0", "=", "arg_0", "[", ":", "arg_8", "-", "arg_7", "]", "+", "arg_0", "[", "arg_8", "-", "arg_7", "+", "1", ":", "]", "return", "arg_0"], "function": "def Func(arg_0, arg_1=\"(\", arg_2=\")\"):\n    \"\"\"Remove consecutive delimiters.\"\"\"\n    arg_3 = _pair_delims(arg_0, arg_1=arg_1, arg_2=arg_2)\n    # Flag superfluous delimiters\n    arg_4 = []\n    for arg_5, arg_6 in zip(arg_3, arg_3[1:]):\n        if arg_5 == (arg_6[0] - 1, arg_6[1] + 1):\n            arg_4.extend(arg_6)\n    arg_4.sort()\n    # Actually remove delimiters from expression\n    for arg_7, arg_8 in enumerate(arg_4):\n        arg_0 = arg_0[: arg_8 - arg_7] + arg_0[arg_8 - arg_7 + 1 :]\n    # Get functions\n    return arg_0", "path": "peng/functions.py", "identifier": "_remove_consecutive_delims", "docstring": "Remove consecutive delimiters.", "docstring_tokens": ["Remove", "consecutive", "delimiters", "."], "nwo": "pmacosta/peng", "score": 0.3518893757964147, "idx": 260319}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhookqt4.py#L27-L122", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Create an input hook for running the Qt4 application event loop.", "language": "python", "parameters": "(mgr, app=None)", "return_statement": "return app, inputhook_qt4", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "QtCore", ".", "QCoreApplication", ".", "instance", "(", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "QtGui", ".", "QApplication", "(", "[", "\" \"", "]", ")", "arg_2", "=", "InteractiveShell", ".", "instance", "(", ")", "if", "hasattr", "(", "arg_2", ",", "'_inputhook_qt4'", ")", ":", "return", "arg_1", ",", "arg_2", ".", "_inputhook_qt4", "arg_3", "=", "[", "False", "]", "def", "inputhook_qt4", "(", ")", ":", "try", ":", "allow_CTRL_C", "(", ")", "arg_1", "=", "QtCore", ".", "QCoreApplication", ".", "instance", "(", ")", "if", "not", "arg_1", ":", "return", "0", "arg_1", ".", "processEvents", "(", "QtCore", ".", "QEventLoop", ".", "AllEvents", ",", "300", ")", "if", "not", "stdin_ready", "(", ")", ":", "arg_4", "=", "QtCore", ".", "QTimer", "(", ")", "arg_4", ".", "timeout", ".", "connect", "(", "arg_1", ".", "quit", ")", "while", "not", "stdin_ready", "(", ")", ":", "arg_4", ".", "start", "(", "50", ")", "arg_1", ".", "exec_", "(", ")", "arg_4", ".", "stop", "(", ")", "except", "KeyboardInterrupt", ":", "ignore_CTRL_C", "(", ")", "arg_3", "[", "0", "]", "=", "True", "print", "(", "\"\\nKeyboardInterrupt - Ctrl-C again for new prompt\"", ")", "arg_0", ".", "clear_inputhook", "(", ")", "except", ":", "ignore_CTRL_C", "(", ")", "from", "traceback", "import", "print_exc", "print_exc", "(", ")", "print", "(", "\"Got exception from inputhook_qt4, unregistering.\"", ")", "arg_0", ".", "clear_inputhook", "(", ")", "finally", ":", "allow_CTRL_C", "(", ")", "return", "0", "def", "preprompthook_qt4", "(", "arg_5", ")", ":", "if", "arg_3", "[", "0", "]", ":", "arg_0", ".", "set_inputhook", "(", "inputhook_qt4", ")", "arg_3", "[", "0", "]", "=", "False", "arg_2", ".", "_inputhook_qt4", "=", "inputhook_qt4", "arg_2", ".", "set_hook", "(", "'pre_prompt_hook'", ",", "preprompthook_qt4", ")", "return", "arg_1", ",", "inputhook_qt4"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Create an input hook for running the Qt4 application event loop.\n\n    Parameters\n    ----------\n    mgr : an InputHookManager\n\n    app : Qt Application, optional.\n        Running application to use.  If not given, we probe Qt for an\n        existing application object, and create a new one if none is found.\n\n    Returns\n    -------\n    A pair consisting of a Qt Application (either the one given or the\n    one found or created) and a inputhook.\n\n    Notes\n    -----\n    We use a custom input hook instead of PyQt4's default one, as it\n    interacts better with the readline packages (issue #481).\n\n    The inputhook function works in tandem with a 'pre_prompt_hook'\n    which automatically restores the hook as an inputhook in case the\n    latter has been temporarily disabled after having intercepted a\n    KeyboardInterrupt.\n    \"\"\"\n\n    if arg_1 is None:\n        arg_1 = QtCore.QCoreApplication.instance()\n        if arg_1 is None:\n            arg_1 = QtGui.QApplication([\" \"])\n\n    # Re-use previously created inputhook if any\n    arg_2 = InteractiveShell.instance()\n    if hasattr(arg_2, '_inputhook_qt4'):\n        return arg_1, arg_2._inputhook_qt4\n\n    # Otherwise create the inputhook_qt4/preprompthook_qt4 pair of\n    # hooks (they both share the got_kbdint flag)\n\n    arg_3 = [False]\n\n    def inputhook_qt4():\n        \"\"\"PyOS_InputHook python hook for Qt4.\n\n        Process pending Qt events and if there's no pending keyboard\n        input, spend a short slice of time (50ms) running the Qt event\n        loop.\n\n        As a Python ctypes callback can't raise an exception, we catch\n        the KeyboardInterrupt and temporarily deactivate the hook,\n        which will let a *second* CTRL+C be processed normally and go\n        back to a clean prompt line.\n        \"\"\"\n        try:\n            allow_CTRL_C()\n            arg_1 = QtCore.QCoreApplication.instance()\n            if not arg_1: # shouldn't happen, but safer if it happens anyway...\n                return 0\n            arg_1.processEvents(QtCore.QEventLoop.AllEvents, 300)\n            if not stdin_ready():\n                arg_4 = QtCore.QTimer()\n                arg_4.timeout.connect(arg_1.quit)\n                while not stdin_ready():\n                    arg_4.start(50)\n                    arg_1.exec_()\n                    arg_4.stop()\n        except KeyboardInterrupt:\n            ignore_CTRL_C()\n            arg_3[0] = True\n            print(\"\\nKeyboardInterrupt - Ctrl-C again for new prompt\")\n            arg_0.clear_inputhook()\n        except: # NO exceptions are allowed to escape from a ctypes callback\n            ignore_CTRL_C()\n            from traceback import print_exc\n            print_exc()\n            print(\"Got exception from inputhook_qt4, unregistering.\")\n            arg_0.clear_inputhook()\n        finally:\n            allow_CTRL_C()\n        return 0\n\n    def preprompthook_qt4(arg_5):\n        \"\"\"'pre_prompt_hook' used to restore the Qt4 input hook\n\n        (in case the latter was temporarily deactivated after a\n        CTRL+C)\n        \"\"\"\n        if arg_3[0]:\n            arg_0.set_inputhook(inputhook_qt4)\n        arg_3[0] = False\n\n    arg_2._inputhook_qt4 = inputhook_qt4\n    arg_2.set_hook('pre_prompt_hook', preprompthook_qt4)\n\n    return arg_1, inputhook_qt4", "path": "environment/lib/python2.7/site-packages/IPython/lib/inputhookqt4.py", "identifier": "create_inputhook_qt4", "docstring": "Create an input hook for running the Qt4 application event loop.\n\n    Parameters\n    ----------\n    mgr : an InputHookManager\n\n    app : Qt Application, optional.\n        Running application to use.  If not given, we probe Qt for an\n        existing application object, and create a new one if none is found.\n\n    Returns\n    -------\n    A pair consisting of a Qt Application (either the one given or the\n    one found or created) and a inputhook.\n\n    Notes\n    -----\n    We use a custom input hook instead of PyQt4's default one, as it\n    interacts better with the readline packages (issue #481).\n\n    The inputhook function works in tandem with a 'pre_prompt_hook'\n    which automatically restores the hook as an inputhook in case the\n    latter has been temporarily disabled after having intercepted a\n    KeyboardInterrupt.", "docstring_tokens": ["Create", "an", "input", "hook", "for", "running", "the", "Qt4", "application", "event", "loop", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260320}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/preset_passmanagers/default.py#L86-L103", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "The default pass manager without a coupling map.", "language": "python", "parameters": "(basis_gates)", "return_statement": "return pass_manager", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "PassManager", "(", ")", "arg_1", ".", "append", "(", "Unroller", "(", "arg_0", ")", ")", "arg_1", ".", "append", "(", "[", "RemoveResetInZeroState", "(", ")", ",", "Depth", "(", ")", ",", "FixedPoint", "(", "'depth'", ")", "]", ",", "do_while", "=", "lambda", "property_set", ":", "not", "property_set", "[", "'depth_fixed_point'", "]", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    The default pass manager without a coupling map.\n\n    Args:\n        basis_gates (list[str]): list of basis gate names to unroll to.\n\n    Returns:\n        PassManager: A passmanager that just unrolls, without any optimization.\n    \"\"\"\n    arg_1 = PassManager()\n\n    arg_1.append(Unroller(arg_0))\n\n    arg_1.append([RemoveResetInZeroState(), Depth(), FixedPoint('depth')],\n                        do_while=lambda property_set: not property_set['depth_fixed_point'])\n\n    return arg_1", "path": "qiskit/transpiler/preset_passmanagers/default.py", "identifier": "default_pass_manager_simulator", "docstring": "The default pass manager without a coupling map.\n\n    Args:\n        basis_gates (list[str]): list of basis gate names to unroll to.\n\n    Returns:\n        PassManager: A passmanager that just unrolls, without any optimization.", "docstring_tokens": ["The", "default", "pass", "manager", "without", "a", "coupling", "map", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260321}
{"url": "https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L696-L709", "sha": "8892f847026d98aba8646ecbc4589397e6dec7bd", "docstring_summary": "Move the body according to a set of torque data.", "language": "python", "parameters": "(self, torques, start=0, states=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "not", "None", ":", "arg_0", ".", "skeleton", ".", "set_body_states", "(", "arg_3", ")", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_1", ")", ":", "if", "arg_4", "<", "arg_2", ":", "continue", "if", "arg_4", ">=", "end", ":", "break", "arg_0", ".", "ode_space", ".", "collide", "(", "None", ",", "arg_0", ".", "on_collision", ")", "arg_0", ".", "skeleton", ".", "add_torques", "(", "arg_5", ")", "arg_0", ".", "ode_world", ".", "step", "(", "arg_0", ".", "dt", ")", "yield", "arg_0", ".", "ode_contactgroup", ".", "empty", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=None):\n        '''Move the body according to a set of torque data.'''\n        if arg_3 is not None:\n            arg_0.skeleton.set_body_states(arg_3)\n        for arg_4, arg_5 in enumerate(arg_1):\n            if arg_4 < arg_2:\n                continue\n            if arg_4 >= end:\n                break\n            arg_0.ode_space.collide(None, arg_0.on_collision)\n            arg_0.skeleton.add_torques(arg_5)\n            arg_0.ode_world.step(arg_0.dt)\n            yield\n            arg_0.ode_contactgroup.empty()", "path": "pagoda/cooper.py", "identifier": "World.forward_dynamics", "docstring": "Move the body according to a set of torque data.", "docstring_tokens": ["Move", "the", "body", "according", "to", "a", "set", "of", "torque", "data", "."], "nwo": "EmbodiedCognition/pagoda", "score": 0.17185066990864498, "idx": 260322}
{"url": "https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/acl.py#L127-L138", "sha": "62ea77aba5ac5ba582793e578a379a76f7d26cdb", "docstring_summary": "Add a user to the given acl allow block.", "language": "python", "parameters": "(self, name, user)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "remove_user_from_acl", "(", "arg_1", ",", "arg_2", ")", ":", "return", "False", "if", "arg_1", "not", "in", "arg_0", ".", "_acl", ":", "return", "False", "arg_0", ".", "_acl", "[", "arg_1", "]", "[", "'allow'", "]", ".", "append", "(", "arg_2", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add a user to the given acl allow block.\"\"\"\n\n        # Clear user from both allow and deny before adding\n        if not arg_0.remove_user_from_acl(arg_1, arg_2):\n            return False\n\n        if arg_1 not in arg_0._acl:\n            return False\n\n        arg_0._acl[arg_1]['allow'].append(arg_2)\n        return True", "path": "slackminion/plugins/core/acl.py", "identifier": "AuthManager.add_user_to_allow", "docstring": "Add a user to the given acl allow block.", "docstring_tokens": ["Add", "a", "user", "to", "the", "given", "acl", "allow", "block", "."], "nwo": "arcticfoxnv/slackminion", "score": 0.2643786477459777, "idx": 260323}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/variability.py#L268-L301", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Return a set of essential genes.", "language": "python", "parameters": "(model, threshold=None, processes=None)", "return_statement": "return {model.genes.get_by_id(g) for ids in essential for g in ids}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "slim_optimize", "(", "error_value", "=", "None", ")", "*", "1E-02", "arg_3", "=", "single_gene_deletion", "(", "arg_0", ",", "method", "=", "'fba'", ",", "arg_2", "=", "arg_2", ")", "arg_4", "=", "arg_3", ".", "loc", "[", "arg_3", "[", "'growth'", "]", ".", "isna", "(", ")", "|", "(", "arg_3", "[", "'growth'", "]", "<", "arg_1", ")", ",", ":", "]", ".", "index", "return", "{", "arg_0", ".", "genes", ".", "get_by_id", "(", "arg_6", ")", "for", "arg_5", "in", "arg_4", "for", "arg_6", "in", "arg_5", "}"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"\n    Return a set of essential genes.\n\n    A gene is considered essential if restricting the flux of all reactions\n    that depend on it to zero causes the objective, e.g., the growth rate,\n    to also be zero, below the threshold, or infeasible.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The model to find the essential genes for.\n    threshold : float, optional\n        Minimal objective flux to be considered viable. By default this is\n        1% of the maximal objective.\n    processes : int, optional\n        The number of parallel processes to run. If not passed,\n        will be set to the number of CPUs found.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not explicitly\n        passed, it will be set from the global configuration singleton.\n\n    Returns\n    -------\n    set\n        Set of essential genes\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = arg_0.slim_optimize(error_value=None) * 1E-02\n    arg_3 = single_gene_deletion(arg_0, method='fba', arg_2=arg_2)\n    arg_4 = arg_3.loc[arg_3['growth'].isna() |\n                              (arg_3['growth'] < arg_1), :].index\n    return {arg_0.genes.get_by_id(arg_6) for arg_5 in arg_4 for arg_6 in arg_5}", "path": "cobra/flux_analysis/variability.py", "identifier": "find_essential_genes", "docstring": "Return a set of essential genes.\n\n    A gene is considered essential if restricting the flux of all reactions\n    that depend on it to zero causes the objective, e.g., the growth rate,\n    to also be zero, below the threshold, or infeasible.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The model to find the essential genes for.\n    threshold : float, optional\n        Minimal objective flux to be considered viable. By default this is\n        1% of the maximal objective.\n    processes : int, optional\n        The number of parallel processes to run. If not passed,\n        will be set to the number of CPUs found.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not explicitly\n        passed, it will be set from the global configuration singleton.\n\n    Returns\n    -------\n    set\n        Set of essential genes", "docstring_tokens": ["Return", "a", "set", "of", "essential", "genes", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 260324}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/arm.py#L957-L975", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "This instruction adds an immediate value to a register value, and writes the result to the destination register.\n        It doesn't update the condition flags.", "language": "python", "parameters": "(cpu, dest, src, add)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "(", "arg_0", ".", "instruction", ".", "address", "+", "4", ")", "&", "0xfffffffc", "if", "arg_2", ".", "type", "==", "'register'", "and", "arg_2", ".", "reg", "in", "(", "'PC'", ",", "'R15'", ")", ":", "arg_2", "=", "arg_4", "else", ":", "arg_2", "=", "arg_2", ".", "read", "(", ")", "arg_1", ".", "write", "(", "arg_2", "+", "arg_3", ".", "read", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        This instruction adds an immediate value to a register value, and writes the result to the destination register.\n        It doesn't update the condition flags.\n\n        :param ARMv7Operand dest: Specifies the destination register. If omitted, this register is the same as src.\n        :param ARMv7Operand src:\n            Specifies the register that contains the first operand. If the SP is specified for dest, see ADD (SP plus\n            immediate). If the PC is specified for dest, see ADR.\n        :param ARMv7Operand add:\n            Specifies the immediate value to be added to the value obtained from src. The range of allowed values is\n            0-4095.\n        \"\"\"\n        arg_4 = (arg_0.instruction.address + 4) & 0xfffffffc\n        if arg_2.type == 'register' and arg_2.reg in ('PC', 'R15'):\n            arg_2 = arg_4\n        else:\n            arg_2 = arg_2.read()\n        arg_1.write(arg_2 + arg_3.read())", "path": "manticore/native/cpu/arm.py", "identifier": "Armv7Cpu.ADDW", "docstring": "This instruction adds an immediate value to a register value, and writes the result to the destination register.\n        It doesn't update the condition flags.\n\n        :param ARMv7Operand dest: Specifies the destination register. If omitted, this register is the same as src.\n        :param ARMv7Operand src:\n            Specifies the register that contains the first operand. If the SP is specified for dest, see ADD (SP plus\n            immediate). If the PC is specified for dest, see ADR.\n        :param ARMv7Operand add:\n            Specifies the immediate value to be added to the value obtained from src. The range of allowed values is\n            0-4095.", "docstring_tokens": ["This", "instruction", "adds", "an", "immediate", "value", "to", "a", "register", "value", "and", "writes", "the", "result", "to", "the", "destination", "register", ".", "It", "doesn", "t", "update", "the", "condition", "flags", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260325}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/query.py#L329-L362", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "When provided with keyword arguments of the form ``col=pattern``, this\n        will limit the entities returned to those that include the provided\n        pattern. Note that 'like' queries require that the ``prefix=True``\n        option must have been provided as part of the column definition.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return self.replace(filters=self._filters+tuple(new))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "arg_4", "=", "arg_0", ".", "_check", "(", "arg_3", ",", "arg_4", ",", "'Func'", ")", "arg_2", ".", "append", "(", "Pattern", "(", "arg_3", ",", "arg_4", ")", ")", "return", "arg_0", ".", "replace", "(", "filters", "=", "arg_0", ".", "_filters", "+", "tuple", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, **arg_1):\n        '''\n        When provided with keyword arguments of the form ``col=pattern``, this\n        will limit the entities returned to those that include the provided\n        pattern. Note that 'Func' queries require that the ``prefix=True``\n        option must have been provided as part of the column definition.\n\n        Patterns allow for 4 wildcard characters, whose semantics are as\n        follows:\n\n            * *?* - will match 0 or 1 of any character\n            * *\\** - will match 0 or more of any character\n            * *+* - will match 1 or more of any character\n            * *!* - will match exactly 1 of any character\n\n        As an example, imagine that you have enabled the required prefix\n        matching on your ``User.email`` column. And lets say that you want to\n        find everyone with an email address that contains the name 'frank'\n        before the ``@`` sign. You can use either of the following patterns\n        to discover those users.\n\n            * *\\*frank\\*@*\n            * *\\*frank\\*@*\n\n        .. note:: Like queries implicitly start at the beginning of strings\n          checked, so if you want to match a pattern that doesn't start at\n          the beginning of a string, you should prefix it with one of the\n          wildcard characters (Func ``*`` as we did with the 'frank' pattern).\n        '''\n        arg_2 = []\n        for arg_3, arg_4 in arg_1.items():\n            arg_4 = arg_0._check(arg_3, arg_4, 'Func')\n            arg_2.append(Pattern(arg_3, arg_4))\n        return arg_0.replace(filters=arg_0._filters+tuple(arg_2))", "path": "rom/query.py", "identifier": "Query.like", "docstring": "When provided with keyword arguments of the form ``col=pattern``, this\n        will limit the entities returned to those that include the provided\n        pattern. Note that 'like' queries require that the ``prefix=True``\n        option must have been provided as part of the column definition.\n\n        Patterns allow for 4 wildcard characters, whose semantics are as\n        follows:\n\n            * *?* - will match 0 or 1 of any character\n            * *\\** - will match 0 or more of any character\n            * *+* - will match 1 or more of any character\n            * *!* - will match exactly 1 of any character\n\n        As an example, imagine that you have enabled the required prefix\n        matching on your ``User.email`` column. And lets say that you want to\n        find everyone with an email address that contains the name 'frank'\n        before the ``@`` sign. You can use either of the following patterns\n        to discover those users.\n\n            * *\\*frank\\*@*\n            * *\\*frank\\*@*\n\n        .. note:: Like queries implicitly start at the beginning of strings\n          checked, so if you want to match a pattern that doesn't start at\n          the beginning of a string, you should prefix it with one of the\n          wildcard characters (like ``*`` as we did with the 'frank' pattern).", "docstring_tokens": ["When", "provided", "with", "keyword", "arguments", "of", "the", "form", "col", "=", "pattern", "this", "will", "limit", "the", "entities", "returned", "to", "those", "that", "include", "the", "provided", "pattern", ".", "Note", "that", "like", "queries", "require", "that", "the", "prefix", "=", "True", "option", "must", "have", "been", "provided", "as", "part", "of", "the", "column", "definition", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 260326}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L91-L173", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Determine the best zoom level in target TilePyramid from given Tile.", "language": "python", "parameters": "(tile, dst_pyramid=None, matching_method=\"gdal\", precision=8)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "\"gdal\"", ",", "arg_3", "=", "8", ")", ":", "def", "width_height", "(", "arg_4", ")", ":", "try", ":", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "reproject_geometry", "(", "box", "(", "*", "arg_4", ")", ",", "src_crs", "=", "arg_0", ".", "crs", ",", "dst_crs", "=", "arg_1", ".", "crs", ")", ".", "bounds", "except", "ValueError", ":", "raise", "TopologicalError", "(", "\"bounds cannot be translated into target CRS\"", ")", "return", "arg_7", "-", "arg_5", ",", "arg_8", "-", "arg_6", "if", "arg_0", ".", "tp", ".", "crs", "==", "arg_1", ".", "crs", ":", "return", "arg_0", ".", "zoom", "else", ":", "if", "arg_2", "==", "\"gdal\"", ":", "arg_9", ",", "arg_10", ",", "arg_11", "=", "calculate_default_transform", "(", "arg_0", ".", "tp", ".", "crs", ",", "arg_1", ".", "crs", ",", "arg_0", ".", "width", ",", "arg_0", ".", "height", ",", "*", "arg_0", ".", "bounds", ")", "arg_12", "=", "round", "(", "arg_9", "[", "0", "]", ",", "arg_3", ")", "elif", "arg_2", "==", "\"min\"", ":", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "arg_0", ".", "bounds", "arg_13", "=", "arg_0", ".", "pixel_x_size", "arg_14", "=", "arg_0", ".", "pixel_y_size", "arg_15", "=", "[", "]", "for", "arg_4", "in", "[", "(", "arg_5", ",", "arg_8", "-", "arg_14", ",", "arg_5", "+", "arg_13", ",", "arg_8", ")", ",", "(", "arg_5", ",", "arg_6", ",", "arg_5", "+", "arg_13", ",", "arg_6", "+", "arg_14", ")", ",", "(", "arg_7", "-", "arg_13", ",", "arg_6", ",", "arg_7", ",", "arg_6", "+", "arg_14", ")", ",", "(", "arg_7", "-", "arg_13", ",", "arg_8", "-", "arg_14", ",", "arg_7", ",", "arg_8", ")", "]", ":", "try", ":", "arg_16", ",", "arg_17", "=", "width_height", "(", "arg_4", ")", "arg_15", ".", "extend", "(", "[", "arg_16", ",", "arg_17", "]", ")", "except", "TopologicalError", ":", "logger", ".", "debug", "(", "\"pixel outside of destination pyramid\"", ")", "if", "arg_15", ":", "arg_12", "=", "round", "(", "min", "(", "arg_15", ")", ",", "arg_3", ")", "else", ":", "raise", "TopologicalError", "(", "\"tile outside of destination pyramid\"", ")", "else", ":", "raise", "ValueError", "(", "\"invalid method given: %s\"", ",", "arg_2", ")", "logger", ".", "debug", "(", "\"we are looking for a zoom level interpolating to %s resolution\"", ",", "arg_12", ")", "arg_18", "=", "0", "while", "True", ":", "arg_19", "=", "round", "(", "arg_1", ".", "pixel_x_size", "(", "arg_18", ")", ",", "arg_3", ")", "if", "arg_19", "<=", "arg_12", ":", "break", "arg_18", "+=", "1", "logger", ".", "debug", "(", "\"target zoom for %s: %s (%s)\"", ",", "arg_12", ",", "arg_18", ",", "arg_19", ")", "return", "arg_18"], "function": "def Func(arg_0, arg_1=None, arg_2=\"gdal\", arg_3=8):\n    \"\"\"\n    Determine the best zoom level in target TilePyramid from given Tile.\n\n\n    Parameters\n    ----------\n    tile : BufferedTile\n    dst_pyramid : BufferedTilePyramid\n    matching_method : str ('gdal' or 'min')\n        gdal: Uses GDAL's standard method. Here, the target resolution is calculated by\n            averaging the extent's pixel sizes over both x and y axes. This approach\n            returns a zoom level which may not have the best quality but will speed up\n            reading significantly.\n        min: Returns the zoom level which matches the minimum resolution of the extent's\n            four corner pixels. This approach returns the zoom level with the best\n            possible quality but with low performance. If the tile extent is outside of\n            the destination pyramid, a TopologicalError will be raised.\n    precision : int\n        Round resolutions to n digits before comparing.\n\n    Returns\n    -------\n    zoom : int\n    \"\"\"\n    def width_height(arg_4):\n        try:\n            arg_5, arg_6, arg_7, arg_8 = reproject_geometry(\n                box(*arg_4), src_crs=arg_0.crs, dst_crs=arg_1.crs\n            ).bounds\n        except ValueError:\n            raise TopologicalError(\"bounds cannot be translated into target CRS\")\n        return arg_7 - arg_5, arg_8 - arg_6\n\n    if arg_0.tp.crs == arg_1.crs:\n        return arg_0.zoom\n    else:\n        if arg_2 == \"gdal\":\n            # use rasterio/GDAL method to calculate default warp target properties\n            arg_9, arg_10, arg_11 = calculate_default_transform(\n                arg_0.tp.crs,\n                arg_1.crs,\n                arg_0.width,\n                arg_0.height,\n                *arg_0.bounds\n            )\n            # this is the resolution the tile would have in destination TilePyramid CRS\n            arg_12 = round(arg_9[0], arg_3)\n        elif arg_2 == \"min\":\n            # calculate the minimum pixel size from the four tile corner pixels\n            arg_5, arg_6, arg_7, arg_8 = arg_0.bounds\n            arg_13 = arg_0.pixel_x_size\n            arg_14 = arg_0.pixel_y_size\n            arg_15 = []\n            for arg_4 in [\n                (arg_5, arg_8 - arg_14, arg_5 + arg_13, arg_8),  # left top\n                (arg_5, arg_6, arg_5 + arg_13, arg_6 + arg_14),  # left bottom\n                (arg_7 - arg_13, arg_6, arg_7, arg_6 + arg_14),  # right bottom\n                (arg_7 - arg_13, arg_8 - arg_14, arg_7, arg_8)   # right top\n            ]:\n                try:\n                    arg_16, arg_17 = width_height(arg_4)\n                    arg_15.extend([arg_16, arg_17])\n                except TopologicalError:\n                    logger.debug(\"pixel outside of destination pyramid\")\n            if arg_15:\n                arg_12 = round(min(arg_15), arg_3)\n            else:\n                raise TopologicalError(\"tile outside of destination pyramid\")\n        else:\n            raise ValueError(\"invalid method given: %s\", arg_2)\n        logger.debug(\n            \"we are looking for a zoom level interpolating to %s resolution\",\n            arg_12\n        )\n        arg_18 = 0\n        while True:\n            arg_19 = round(arg_1.pixel_x_size(arg_18), arg_3)\n            if arg_19 <= arg_12:\n                break\n            arg_18 += 1\n        logger.debug(\"target zoom for %s: %s (%s)\", arg_12, arg_18, arg_19)\n        return arg_18", "path": "mapchete/io/__init__.py", "identifier": "tile_to_zoom_level", "docstring": "Determine the best zoom level in target TilePyramid from given Tile.\n\n\n    Parameters\n    ----------\n    tile : BufferedTile\n    dst_pyramid : BufferedTilePyramid\n    matching_method : str ('gdal' or 'min')\n        gdal: Uses GDAL's standard method. Here, the target resolution is calculated by\n            averaging the extent's pixel sizes over both x and y axes. This approach\n            returns a zoom level which may not have the best quality but will speed up\n            reading significantly.\n        min: Returns the zoom level which matches the minimum resolution of the extent's\n            four corner pixels. This approach returns the zoom level with the best\n            possible quality but with low performance. If the tile extent is outside of\n            the destination pyramid, a TopologicalError will be raised.\n    precision : int\n        Round resolutions to n digits before comparing.\n\n    Returns\n    -------\n    zoom : int", "docstring_tokens": ["Determine", "the", "best", "zoom", "level", "in", "target", "TilePyramid", "from", "given", "Tile", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 260327}
{"url": "https://github.com/filepreviews/filepreviews-python/blob/11be871a07438e3ab5d87ab1f2c163bbac4d4570/filepreviews/__main__.py#L30-L58", "sha": "11be871a07438e3ab5d87ab1f2c163bbac4d4570", "docstring_summary": "Generate preview for URL.", "language": "python", "parameters": "(ctx, url, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "obj", "[", "'file_previews'", "]", "arg_5", "=", "{", "}", "arg_6", "=", "arg_3", "[", "'metadata'", "]", "arg_7", "=", "arg_3", "[", "'width'", "]", "arg_8", "=", "arg_3", "[", "'height'", "]", "arg_9", "=", "arg_3", "[", "'format'", "]", "if", "arg_6", ":", "arg_5", "[", "'metadata'", "]", "=", "arg_6", ".", "split", "(", "','", ")", "if", "arg_7", ":", "arg_5", ".", "setdefault", "(", "'size'", ",", "{", "}", ")", "arg_5", "[", "'size'", "]", "[", "'width'", "]", "=", "arg_7", "if", "arg_8", ":", "arg_5", ".", "setdefault", "(", "'size'", ",", "{", "}", ")", "arg_5", "[", "'size'", "]", "[", "'height'", "]", "=", "arg_8", "if", "arg_9", ":", "arg_5", "[", "'format'", "]", "=", "arg_9", "arg_10", "=", "arg_4", ".", "Func", "(", "arg_1", ",", "**", "arg_5", ")", "click", ".", "echo", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n    \"\"\"\n    Generate preview for URL.\n    \"\"\"\n    arg_4 = arg_0.obj['file_previews']\n\n    arg_5 = {}\n    arg_6 = arg_3['metadata']\n    arg_7 = arg_3['width']\n    arg_8 = arg_3['height']\n    arg_9 = arg_3['format']\n\n    if arg_6:\n        arg_5['metadata'] = arg_6.split(',')\n\n    if arg_7:\n        arg_5.setdefault('size', {})\n        arg_5['size']['width'] = arg_7\n\n    if arg_8:\n        arg_5.setdefault('size', {})\n        arg_5['size']['height'] = arg_8\n\n    if arg_9:\n        arg_5['format'] = arg_9\n\n    arg_10 = arg_4.Func(arg_1, **arg_5)\n\n    click.echo(arg_10)", "path": "filepreviews/__main__.py", "identifier": "generate", "docstring": "Generate preview for URL.", "docstring_tokens": ["Generate", "preview", "for", "URL", "."], "nwo": "filepreviews/filepreviews-python", "score": 0.27074237488055014, "idx": 260328}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L230-L287", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Initialize a Git repo", "language": "python", "parameters": "(self, username, reponame, force, backend=None)", "return_statement": "return repo", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "key", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "arg_0", ".", "server_rootdir", "(", "arg_1", ",", "arg_2", ",", "create", "=", "False", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_6", ")", "and", "not", "arg_3", ":", "raise", "RepositoryExists", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "shutil", ".", "rmtree", "(", "arg_6", ")", "os", ".", "makedirs", "(", "arg_6", ")", "with", "cd", "(", "arg_6", ")", ":", "git", ".", "Func", "(", "\".\"", ",", "\"--bare\"", ")", "if", "arg_4", "is", "not", "None", ":", "arg_4", ".", "Func_repo", "(", "arg_6", ")", "arg_7", "=", "arg_0", ".", "rootdir", "(", "arg_1", ",", "arg_2", ",", "create", "=", "False", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_7", ")", "and", "not", "arg_3", ":", "raise", "Exception", "(", "\"Local repo already exists\"", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_7", ")", ":", "shutil", ".", "rmtree", "(", "arg_7", ")", "os", ".", "makedirs", "(", "arg_7", ")", "with", "cd", "(", "os", ".", "path", ".", "dirname", "(", "arg_7", ")", ")", ":", "git", ".", "clone", "(", "arg_6", ",", "'--no-hardlinks'", ")", "arg_8", "=", "arg_6", "if", "arg_4", "is", "not", "None", ":", "arg_8", "=", "arg_4", ".", "url", "(", "arg_1", ",", "arg_2", ")", "arg_9", "=", "Repo", "(", "arg_1", ",", "arg_2", ")", "arg_9", ".", "manager", "=", "arg_0", "arg_9", ".", "remoteurl", "=", "arg_8", "arg_9", ".", "rootdir", "=", "arg_0", ".", "rootdir", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "add", "(", "arg_9", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"\n        Initialize a Git repo\n\n        Parameters\n        ----------\n\n        username, reponame : Repo name is tuple (name, reponame)\n        force: force Funcialization of the repo even if exists\n        backend: backend that must be used for this (e.g. s3)\n        \"\"\"\n        arg_5 = arg_0.key(arg_1, arg_2)\n\n        # In local filesystem-based server, add a repo\n        arg_6 = arg_0.server_rootdir(arg_1,\n                                             arg_2,\n                                             create=False)\n\n        # Force cleanup if needed\n        if os.path.exists(arg_6) and not arg_3:\n            raise RepositoryExists()\n\n        if os.path.exists(arg_6):\n            shutil.rmtree(arg_6)\n        os.makedirs(arg_6)\n\n        # Initialize the repo\n        with cd(arg_6):\n            git.Func(\".\", \"--bare\")\n\n        if arg_4 is not None:\n            arg_4.Func_repo(arg_6)\n\n        # Now clone the filesystem-based repo\n        arg_7 = arg_0.rootdir(arg_1, arg_2, create=False)\n\n        # Prepare it if needed\n        if os.path.exists(arg_7) and not arg_3:\n            raise Exception(\"Local repo already exists\")\n        if os.path.exists(arg_7):\n            shutil.rmtree(arg_7)\n        os.makedirs(arg_7)\n\n        # Now clone...\n        with cd(os.path.dirname(arg_7)):\n            git.clone(arg_6, '--no-hardlinks')\n\n        arg_8 = arg_6\n        if arg_4 is not None:\n            arg_8 = arg_4.url(arg_1, arg_2)\n\n        arg_9 = Repo(arg_1, arg_2)\n        arg_9.manager = arg_0\n        arg_9.remoteurl = arg_8\n        arg_9.rootdir = arg_0.rootdir(arg_1, arg_2)\n\n        arg_0.add(arg_9)\n        return arg_9", "path": "dgitcore/contrib/repomanagers/gitmanager.py", "identifier": "GitRepoManager.init", "docstring": "Initialize a Git repo\n\n        Parameters\n        ----------\n\n        username, reponame : Repo name is tuple (name, reponame)\n        force: force initialization of the repo even if exists\n        backend: backend that must be used for this (e.g. s3)", "docstring_tokens": ["Initialize", "a", "Git", "repo"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 260329}
{"url": "https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L142-L146", "sha": "5a75cf88cf794937711b6850ff2acb07fe005f08", "docstring_summary": "Move this object down one position.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "swap", "(", "arg_0", ".", "get_ordering_queryset", "(", ")", ".", "filter", "(", "order__gt", "=", "arg_0", ".", "order", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Move this object Func one position.\n        \"\"\"\n        arg_0.swap(arg_0.get_ordering_queryset().filter(order__gt=arg_0.order))", "path": "publications/models/orderedmodel.py", "identifier": "OrderedModel.down", "docstring": "Move this object down one position.", "docstring_tokens": ["Move", "this", "object", "down", "one", "position", "."], "nwo": "lucastheis/django-publications", "score": 0.41971037138316925, "idx": 260330}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L227-L234", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Remove file identified by `key`.", "language": "python", "parameters": "(self, key)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "uri", ",", "arg_1", ")", "os", ".", "remove", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Remove file identified by `key`.\n\n        :param str key: The file to delete\n        \"\"\"\n        arg_2 = os.path.join(arg_0.uri, arg_1)\n        os.remove(arg_2)", "path": "manticore/core/workspace.py", "identifier": "FilesystemStore.rm", "docstring": "Remove file identified by `key`.\n\n        :param str key: The file to delete", "docstring_tokens": ["Remove", "file", "identified", "by", "key", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260331}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/expansion.py#L65-L70", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Count the source nodes in an edge iterator with keys and data.", "language": "python", "parameters": "(edge_iter: EdgeIterator)", "return_statement": "return Counter(u for u, _, _ in edge_iter)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Counter", ":", "return", "Counter", "(", "arg_2", "for", "arg_2", ",", "arg_3", ",", "arg_3", "in", "arg_0", ")"], "function": "def Func(arg_0: arg_1) -> Counter:\n    \"\"\"Count the source nodes in an edge iterator with keys and data.\n\n    :return: A counter of source nodes in the iterable\n    \"\"\"\n    return Counter(arg_2 for arg_2, arg_3, arg_3 in arg_0)", "path": "src/pybel_tools/mutation/expansion.py", "identifier": "count_sources", "docstring": "Count the source nodes in an edge iterator with keys and data.\n\n    :return: A counter of source nodes in the iterable", "docstring_tokens": ["Count", "the", "source", "nodes", "in", "an", "edge", "iterator", "with", "keys", "and", "data", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260332}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L424-L444", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Print header information", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "header", ".", "items", "(", ")", ":", "if", "arg_1", "==", "b'src_raj'", ":", "arg_2", "=", "arg_2", ".", "to_string", "(", "unit", "=", "u", ".", "hour", ",", "sep", "=", "':'", ")", "if", "arg_1", "==", "b'src_dej'", ":", "arg_2", "=", "arg_2", ".", "to_string", "(", "unit", "=", "u", ".", "deg", ",", "sep", "=", "':'", ")", "if", "arg_1", "==", "b'tsamp'", ":", "arg_2", "*=", "u", ".", "second", "if", "arg_1", "in", "(", "'foff'", ",", "'fch1'", ")", ":", "arg_2", "*=", "u", ".", "MHz", "if", "arg_1", "==", "b'tstart'", ":", "print", "(", "\"%16s : %32s\"", "%", "(", "\"tstart (ISOT)\"", ",", "Time", "(", "arg_2", ",", "format", "=", "'mjd'", ")", ".", "isot", ")", ")", "arg_1", "=", "\"tstart (MJD)\"", "print", "(", "\"%16s : %32s\"", "%", "(", "arg_1", ",", "arg_2", ")", ")", "print", "(", "\"\\n%16s : %32s\"", "%", "(", "\"Num ints in file\"", ",", "arg_0", ".", "n_ints_in_file", ")", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "\"Data shape\"", ",", "arg_0", ".", "data", ".", "shape", ")", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "\"Start freq (MHz)\"", ",", "arg_0", ".", "freqs", "[", "0", "]", ")", ")", "print", "(", "\"%16s : %32s\"", "%", "(", "\"Stop freq (MHz)\"", ",", "arg_0", ".", "freqs", "[", "-", "1", "]", ")", ")"], "function": "def Func(arg_0):\n        \"\"\" Print header Funcrmation \"\"\"\n\n        for arg_1, arg_2 in arg_0.header.items():\n            if arg_1 == b'src_raj':\n                arg_2 = arg_2.to_string(unit=u.hour, sep=':')\n            if arg_1 == b'src_dej':\n                arg_2 = arg_2.to_string(unit=u.deg, sep=':')\n            if arg_1 == b'tsamp':\n                arg_2 *= u.second\n            if arg_1 in ('foff', 'fch1'):\n                arg_2 *= u.MHz\n            if arg_1 == b'tstart':\n                print(\"%16s : %32s\" % (\"tstart (ISOT)\", Time(arg_2, format='mjd').isot))\n                arg_1 = \"tstart (MJD)\"\n            print(\"%16s : %32s\" % (arg_1, arg_2))\n\n        print(\"\\n%16s : %32s\" % (\"Num ints in file\", arg_0.n_ints_in_file))\n        print(\"%16s : %32s\" % (\"Data shape\", arg_0.data.shape))\n        print(\"%16s : %32s\" % (\"Start freq (MHz)\", arg_0.freqs[0]))\n        print(\"%16s : %32s\" % (\"Stop freq (MHz)\", arg_0.freqs[-1]))", "path": "blimpy/filterbank.py", "identifier": "Filterbank.info", "docstring": "Print header information", "docstring_tokens": ["Print", "header", "information"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 260333}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/schema.py#L78-L97", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Construct a validation schema for arrays of a given namespace.", "language": "python", "parameters": "(ns_key)", "return_statement": "return sch", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "namespace", "(", "arg_0", ")", "arg_1", "[", "'title'", "]", "=", "'Observation'", "arg_2", "=", "copy", ".", "deepcopy", "(", "JAMS_SCHEMA", "[", "'definitions'", "]", "[", "'SparseObservationList'", "]", ")", "arg_2", "[", "'items'", "]", "=", "arg_1", "return", "arg_2"], "function": "def Func(arg_0):\n    '''Construct a validation schema for arrays of a given namespace.\n\n    Parameters\n    ----------\n    ns_key : str\n        Namespace key identifier\n\n    Returns\n    -------\n    schema : dict\n        JSON schema of `namespace` observation arrays\n    '''\n\n    arg_1 = namespace(arg_0)\n    arg_1['title'] = 'Observation'\n\n    arg_2 = copy.deepcopy(JAMS_SCHEMA['definitions']['SparseObservationList'])\n    arg_2['items'] = arg_1\n    return arg_2", "path": "jams/schema.py", "identifier": "namespace_array", "docstring": "Construct a validation schema for arrays of a given namespace.\n\n    Parameters\n    ----------\n    ns_key : str\n        Namespace key identifier\n\n    Returns\n    -------\n    schema : dict\n        JSON schema of `namespace` observation arrays", "docstring_tokens": ["Construct", "a", "validation", "schema", "for", "arrays", "of", "a", "given", "namespace", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 260334}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/model.py#L116-L170", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Orient an undirected graph using the pairwise method defined by the subclass.", "language": "python", "parameters": "(self, df_data, graph, nb_runs=6, printout=None, **kwargs)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "6", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "if", "type", "(", "arg_2", ")", "==", "nx", ".", "DiGraph", ":", "arg_6", "=", "[", "arg_8", "for", "arg_8", "in", "list", "(", "arg_2", ".", "edges", "(", ")", ")", "if", "(", "arg_8", "[", "1", "]", ",", "arg_8", "[", "0", "]", ")", "in", "list", "(", "arg_2", ".", "edges", "(", ")", ")", "]", "arg_7", "=", "[", "arg_8", "for", "arg_8", "in", "list", "(", "arg_2", ".", "edges", "(", ")", ")", "if", "(", "arg_8", "[", "1", "]", ",", "arg_8", "[", "0", "]", ")", "not", "in", "list", "(", "arg_2", ".", "edges", "(", ")", ")", "]", "for", "arg_8", "in", "arg_6", ":", "if", "(", "arg_8", "[", "1", "]", ",", "arg_8", "[", "0", "]", ")", "in", "list", "(", "arg_2", ".", "edges", "(", ")", ")", ":", "arg_6", ".", "remove", "(", "arg_8", ")", "arg_9", "=", "nx", ".", "DiGraph", "(", ")", "for", "arg_10", "in", "arg_7", ":", "arg_9", ".", "add_edge", "(", "*", "arg_10", ")", "elif", "type", "(", "arg_2", ")", "==", "nx", ".", "Graph", ":", "arg_6", "=", "list", "(", "arg_2", ".", "edges", "(", ")", ")", "arg_9", "=", "nx", ".", "DiGraph", "(", ")", "else", ":", "raise", "TypeError", "(", "\"Data type not understood.\"", ")", "arg_11", "=", "[", "]", "for", "arg_12", ",", "(", "arg_8", ",", "arg_13", ")", "in", "enumerate", "(", "arg_6", ")", ":", "arg_14", "=", "arg_0", ".", "predict_proba", "(", "arg_1", "[", "arg_8", "]", ".", "values", ".", "reshape", "(", "(", "-", "1", ",", "1", ")", ")", ",", "arg_1", "[", "arg_13", "]", ".", "values", ".", "reshape", "(", "(", "-", "1", ",", "1", ")", ")", ",", "arg_12", "=", "arg_12", ",", "arg_3", "=", "arg_3", ",", "**", "arg_5", ")", "if", "arg_14", ">", "0", ":", "arg_9", ".", "add_edge", "(", "arg_8", ",", "arg_13", ",", "arg_14", "=", "arg_14", ")", "else", ":", "arg_9", ".", "add_edge", "(", "arg_13", ",", "arg_8", ",", "arg_14", "=", "abs", "(", "arg_14", ")", ")", "if", "arg_4", "is", "not", "None", ":", "arg_11", ".", "append", "(", "[", "str", "(", "arg_8", ")", "+", "'-'", "+", "str", "(", "arg_13", ")", ",", "arg_14", "]", ")", "DataFrame", "(", "arg_11", ",", "columns", "=", "[", "'SampleID'", ",", "'Predictions'", "]", ")", ".", "to_csv", "(", "arg_4", ",", "index", "=", "False", ")", "for", "arg_15", "in", "list", "(", "arg_1", ".", "columns", ".", "values", ")", ":", "if", "arg_15", "not", "in", "arg_9", ".", "nodes", "(", ")", ":", "arg_9", ".", "add_node", "(", "arg_15", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=6, arg_4=None, **arg_5):\n        \"\"\"Orient an undirected graph using the pairwise method defined by the subclass.\n\n        The pairwise method is ran on every undirected edge.\n\n        Args:\n            df_data (pandas.DataFrame): Data\n            umg (networkx.Graph): Graph to orient\n            nb_runs (int): number of times to rerun for each pair (bootstrap)\n            printout (str): (optional) Path to file where to save temporary results\n\n        Returns:\n            networkx.DiGraph: a directed graph, which might contain cycles\n\n        .. warning:\n           Requirement : Name of the nodes in the graph correspond to name of\n           the variables in df_data\n        \"\"\"\n        if type(arg_2) == nx.DiGraph:\n            arg_6 = [arg_8 for arg_8 in list(arg_2.edges()) if (arg_8[1], arg_8[0]) in list(arg_2.edges())]\n            arg_7 = [arg_8 for arg_8 in list(arg_2.edges()) if (arg_8[1], arg_8[0]) not in list(arg_2.edges())]\n            for arg_8 in arg_6:\n                if (arg_8[1], arg_8[0]) in list(arg_2.edges()):\n                    arg_6.remove(arg_8)\n            arg_9 = nx.DiGraph()\n            for arg_10 in arg_7:\n                arg_9.add_edge(*arg_10)\n\n        elif type(arg_2) == nx.Graph:\n            arg_6 = list(arg_2.edges())\n            arg_9 = nx.DiGraph()\n\n        else:\n            raise TypeError(\"Data type not understood.\")\n\n        arg_11 = []\n\n        for arg_12, (arg_8, arg_13) in enumerate(arg_6):\n            arg_14 = arg_0.predict_proba(\n                arg_1[arg_8].values.reshape((-1, 1)), arg_1[arg_13].values.reshape((-1, 1)), arg_12=arg_12,\n                arg_3=arg_3, **arg_5)\n            if arg_14 > 0:  # a causes b\n                arg_9.add_edge(arg_8, arg_13, arg_14=arg_14)\n            else:\n                arg_9.add_edge(arg_13, arg_8, arg_14=abs(arg_14))\n            if arg_4 is not None:\n                arg_11.append([str(arg_8) + '-' + str(arg_13), arg_14])\n                DataFrame(arg_11, columns=['SampleID', 'Predictions']).to_csv(\n                    arg_4, index=False)\n\n        for arg_15 in list(arg_1.columns.values):\n            if arg_15 not in arg_9.nodes():\n                arg_9.add_node(arg_15)\n\n        return arg_9", "path": "cdt/causality/pairwise/model.py", "identifier": "PairwiseModel.orient_graph", "docstring": "Orient an undirected graph using the pairwise method defined by the subclass.\n\n        The pairwise method is ran on every undirected edge.\n\n        Args:\n            df_data (pandas.DataFrame): Data\n            umg (networkx.Graph): Graph to orient\n            nb_runs (int): number of times to rerun for each pair (bootstrap)\n            printout (str): (optional) Path to file where to save temporary results\n\n        Returns:\n            networkx.DiGraph: a directed graph, which might contain cycles\n\n        .. warning:\n           Requirement : Name of the nodes in the graph correspond to name of\n           the variables in df_data", "docstring_tokens": ["Orient", "an", "undirected", "graph", "using", "the", "pairwise", "method", "defined", "by", "the", "subclass", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 260335}
{"url": "https://github.com/Yubico/python-u2flib-host/blob/eadc4dbf3bf516e74ea00d2e5690742a535834cb/u2flib_host/authenticate.py#L41-L80", "sha": "eadc4dbf3bf516e74ea00d2e5690742a535834cb", "docstring_summary": "Interactively authenticates a AuthenticateRequest using an attached U2F\n    device.", "language": "python", "parameters": "(devices, params, facet, check_only)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "for", "arg_4", "in", "arg_0", "[", ":", "]", ":", "try", ":", "arg_4", ".", "open", "(", ")", "except", ":", "arg_0", ".", "remove", "(", "arg_4", ")", "try", ":", "arg_5", "=", "False", "while", "arg_0", ":", "arg_6", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "try", ":", "return", "u2f", ".", "Func", "(", "arg_4", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "except", "exc", ".", "APDUError", "as", "e", ":", "if", "e", ".", "code", "==", "APDU_USE_NOT_SATISFIED", ":", "if", "arg_3", ":", "sys", ".", "stderr", ".", "write", "(", "'\\nCorrect U2F device present!\\n'", ")", "sys", ".", "exit", "(", "0", ")", "if", "not", "arg_5", ":", "sys", ".", "stderr", ".", "write", "(", "'\\nTouch the flashing U2F device '", "'to Func...\\n'", ")", "arg_5", "=", "True", "else", ":", "arg_6", ".", "append", "(", "arg_4", ")", "except", "exc", ".", "DeviceError", ":", "arg_6", ".", "append", "(", "arg_4", ")", "arg_0", "=", "[", "arg_7", "for", "arg_7", "in", "arg_0", "if", "arg_7", "not", "in", "arg_6", "]", "for", "arg_7", "in", "arg_6", ":", "arg_7", ".", "close", "(", ")", "time", ".", "sleep", "(", "0.25", ")", "finally", ":", "for", "arg_4", "in", "arg_0", ":", "arg_4", ".", "close", "(", ")", "sys", ".", "stderr", ".", "write", "(", "'\\nThe required U2F device is not present!\\n'", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Interactively Funcs a AuthenticateRequest using an attached U2F\n    device.\n    \"\"\"\n    for arg_4 in arg_0[:]:\n        try:\n            arg_4.open()\n        except:\n            arg_0.remove(arg_4)\n\n    try:\n        arg_5 = False\n        while arg_0:\n            arg_6 = []\n            for arg_4 in arg_0:\n                try:\n                    return u2f.Func(arg_4, arg_1, arg_2, arg_3)\n                except exc.APDUError as e:\n                    if e.code == APDU_USE_NOT_SATISFIED:\n                        if arg_3:\n                            sys.stderr.write('\\nCorrect U2F device present!\\n')\n                            sys.exit(0)\n                        if not arg_5:\n                            sys.stderr.write('\\nTouch the flashing U2F device '\n                                             'to Func...\\n')\n                            arg_5 = True\n                    else:\n                        arg_6.append(arg_4)\n                except exc.DeviceError:\n                    arg_6.append(arg_4)\n            arg_0 = [arg_7 for arg_7 in arg_0 if arg_7 not in arg_6]\n            for arg_7 in arg_6:\n                arg_7.close()\n            time.sleep(0.25)\n    finally:\n        for arg_4 in arg_0:\n            arg_4.close()\n    sys.stderr.write('\\nThe required U2F device is not present!\\n')\n    sys.exit(1)", "path": "u2flib_host/authenticate.py", "identifier": "authenticate", "docstring": "Interactively authenticates a AuthenticateRequest using an attached U2F\n    device.", "docstring_tokens": ["Interactively", "authenticates", "a", "AuthenticateRequest", "using", "an", "attached", "U2F", "device", "."], "nwo": "Yubico/python-u2flib-host", "score": 0.37487477839678873, "idx": 260336}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_container_hook.py#L57-L70", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Converts a python dictionary to the proto supplied", "language": "python", "parameters": "(py_dict, proto)", "return_statement": "return json_format.Parse(dict_json_str, proto)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "json", ".", "dumps", "(", "arg_0", ")", "return", "json_format", ".", "Parse", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Converts a python dictionary to the proto supplied\n\n        :param py_dict: The dictionary to convert\n        :type py_dict: dict\n        :param proto: The proto object to merge with dictionary\n        :type proto: protobuf\n        :return: A parsed python dictionary in provided proto format\n        :raises:\n            ParseError: On JSON parsing problems.\n        \"\"\"\n        arg_2 = json.dumps(arg_0)\n        return json_format.Parse(arg_2, arg_1)", "path": "airflow/contrib/hooks/gcp_container_hook.py", "identifier": "GKEClusterHook._dict_to_proto", "docstring": "Converts a python dictionary to the proto supplied\n\n        :param py_dict: The dictionary to convert\n        :type py_dict: dict\n        :param proto: The proto object to merge with dictionary\n        :type proto: protobuf\n        :return: A parsed python dictionary in provided proto format\n        :raises:\n            ParseError: On JSON parsing problems.", "docstring_tokens": ["Converts", "a", "python", "dictionary", "to", "the", "proto", "supplied"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260337}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L1223-L1257", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Make sure there's a site.py in the target dir, if needed", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "sitepy_installed", ":", "return", "arg_1", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "install_dir", ",", "\"site.py\"", ")", "arg_2", "=", "resource_string", "(", "\"setuptools\"", ",", "\"site-patch.py\"", ")", "arg_3", "=", "\"\"", "if", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "log", ".", "debug", "(", "\"Checking existing site.py in %s\"", ",", "arg_0", ".", "install_dir", ")", "arg_4", "=", "open", "(", "arg_1", ",", "'rb'", ")", "arg_3", "=", "arg_4", ".", "read", "(", ")", "if", "PY3", ":", "arg_3", "=", "arg_3", ".", "decode", "(", ")", "arg_4", ".", "close", "(", ")", "if", "not", "arg_3", ".", "startswith", "(", "'def __boot():'", ")", ":", "raise", "DistutilsError", "(", "\"%s is not a setuptools-generated site.py; please\"", "\" remove it.\"", "%", "arg_1", ")", "if", "arg_3", "!=", "arg_2", ":", "log", ".", "info", "(", "\"Creating %s\"", ",", "arg_1", ")", "if", "not", "arg_0", ".", "dry_run", ":", "ensure_directory", "(", "arg_1", ")", "arg_4", "=", "open", "(", "arg_1", ",", "'wb'", ")", "arg_4", ".", "write", "(", "arg_2", ")", "arg_4", ".", "close", "(", ")", "arg_0", ".", "byte_compile", "(", "[", "arg_1", "]", ")", "arg_0", ".", "sitepy_installed", "=", "True"], "function": "def Func(arg_0):\n        \"\"\"Make sure there's a site.py in the target dir, if needed\"\"\"\n\n        if arg_0.sitepy_installed:\n            return  # already did it, or don't need to\n\n        arg_1 = os.path.join(arg_0.install_dir, \"site.py\")\n        arg_2 = resource_string(\"setuptools\", \"site-patch.py\")\n        arg_3 = \"\"\n\n        if os.path.exists(arg_1):\n            log.debug(\"Checking existing site.py in %s\", arg_0.install_dir)\n            arg_4 = open(arg_1, 'rb')\n            arg_3 = arg_4.read()\n            # we want str, not bytes\n            if PY3:\n                arg_3 = arg_3.decode()\n\n            arg_4.close()\n            if not arg_3.startswith('def __boot():'):\n                raise DistutilsError(\n                    \"%s is not a setuptools-generated site.py; please\"\n                    \" remove it.\" % arg_1\n                )\n\n        if arg_3 != arg_2:\n            log.info(\"Creating %s\", arg_1)\n            if not arg_0.dry_run:\n                ensure_directory(arg_1)\n                arg_4 = open(arg_1, 'wb')\n                arg_4.write(arg_2)\n                arg_4.close()\n            arg_0.byte_compile([arg_1])\n\n        arg_0.sitepy_installed = True", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py", "identifier": "easy_install.install_site_py", "docstring": "Make sure there's a site.py in the target dir, if needed", "docstring_tokens": ["Make", "sure", "there", "s", "a", "site", ".", "py", "in", "the", "target", "dir", "if", "needed"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260338}
{"url": "https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/convert.py#L5-L11", "sha": "973f3e003dc38b812897dab88455bee37dcaf931", "docstring_summary": "Converts html content to plain text", "language": "python", "parameters": "(content)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "html2text", ".", "HTML2Text", "(", ")", "arg_2", ".", "ignore_links", "=", "False", "arg_1", "=", "arg_2", ".", "handle", "(", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\" Converts html content to plain text \"\"\"\n    arg_1 = None\n    arg_2 = html2text.HTML2Text()\n    arg_2.ignore_links = False\n    arg_1 = arg_2.handle(arg_0)\n    return arg_1", "path": "toolware/utils/convert.py", "identifier": "html_to_text", "docstring": "Converts html content to plain text", "docstring_tokens": ["Converts", "html", "content", "to", "plain", "text"], "nwo": "un33k/django-toolware", "score": 0.0, "idx": 260339}
{"url": "https://github.com/Diaoul/pyjulius/blob/48f2752ff4e0f3bd7b578754b1c583cabdc24b09/pyjulius/core.py#L137-L142", "sha": "48f2752ff4e0f3bd7b578754b1c583cabdc24b09", "docstring_summary": "Disconnect from the server", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "info", "(", "u'Disconnecting'", ")", "arg_0", ".", "sock", ".", "shutdown", "(", "socket", ".", "SHUT_RDWR", ")", "arg_0", ".", "sock", ".", "close", "(", ")", "arg_0", ".", "state", "=", "DISCONNECTED"], "function": "def Func(arg_0):\n        \"\"\"Disconnect from the server\"\"\"\n        logger.info(u'Disconnecting')\n        arg_0.sock.shutdown(socket.SHUT_RDWR)\n        arg_0.sock.close()\n        arg_0.state = DISCONNECTED", "path": "pyjulius/core.py", "identifier": "Client.disconnect", "docstring": "Disconnect from the server", "docstring_tokens": ["Disconnect", "from", "the", "server"], "nwo": "Diaoul/pyjulius", "score": 0.19386116706877685, "idx": 260340}
{"url": "https://github.com/nesdis/djongo/blob/7f9d79455cf030cb5eee0b822502c50a0d9d3abb/djongo/models/fields.py#L243-L256", "sha": "7f9d79455cf030cb5eee0b822502c50a0d9d3abb", "docstring_summary": "Returns the formfield for the array.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return super().formfield(**defaults)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "'form_class'", ":", "ArrayFormField", ",", "'model_container'", ":", "arg_0", ".", "model_container", ",", "'model_form_class'", ":", "arg_0", ".", "model_form_class", ",", "'name'", ":", "arg_0", ".", "attname", ",", "'mdl_form_kw_l'", ":", "arg_0", ".", "model_form_kwargs_l", "}", "arg_2", ".", "update", "(", "arg_1", ")", "return", "super", "(", ")", ".", "Func", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\r\n        \"\"\"\r\n        Returns the Func for the array.\r\n        \"\"\"\r\n        arg_2 = {\r\n            'form_class': ArrayFormField,\r\n            'model_container': arg_0.model_container,\r\n            'model_form_class': arg_0.model_form_class,\r\n            'name': arg_0.attname,\r\n            'mdl_form_kw_l': arg_0.model_form_kwargs_l\r\n\r\n        }\r\n        arg_2.update(arg_1)\r\n        return super().Func(**arg_2)", "path": "djongo/models/fields.py", "identifier": "ArrayModelField.formfield", "docstring": "Returns the formfield for the array.", "docstring_tokens": ["Returns", "the", "formfield", "for", "the", "array", "."], "nwo": "nesdis/djongo", "score": 0.9667508002289729, "idx": 260341}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth2.py#L517-L532", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Verify current request, get the oauth data.", "language": "python", "parameters": "(self, scopes)", "return_statement": "return self.server.verify_request(\n            uri, http_method, body, headers, scopes\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "extract_params", "(", ")", "return", "arg_0", ".", "server", ".", "Func", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Verify current request, get the oauth data.\n\n        If you can't use the ``require_oauth`` decorator, you can fetch\n        the data in your request body::\n\n            def your_handler():\n                valid, req = oauth.Func(['email'])\n                if valid:\n                    return jsonify(user=req.user)\n                return jsonify(status='error')\n        \"\"\"\n        arg_2, arg_3, arg_4, arg_5 = extract_params()\n        return arg_0.server.Func(\n            arg_2, arg_3, arg_4, arg_5, arg_1\n        )", "path": "flask_oauthlib/provider/oauth2.py", "identifier": "OAuth2Provider.verify_request", "docstring": "Verify current request, get the oauth data.\n\n        If you can't use the ``require_oauth`` decorator, you can fetch\n        the data in your request body::\n\n            def your_handler():\n                valid, req = oauth.verify_request(['email'])\n                if valid:\n                    return jsonify(user=req.user)\n                return jsonify(status='error')", "docstring_tokens": ["Verify", "current", "request", "get", "the", "oauth", "data", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 260342}
{"url": "https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L91-L94", "sha": "467e8a843ca9f882f8bb2958805b7293591996ad", "docstring_summary": "Returns the normalized mean square error of a and b", "language": "python", "parameters": "(a, b)", "return_statement": "return np.square(a - b).mean() / (a.mean() * b.mean())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "np", ".", "square", "(", "arg_0", "-", "arg_1", ")", ".", "mean", "(", ")", "/", "(", "arg_0", ".", "mean", "(", ")", "*", "arg_1", ".", "mean", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Returns the normalized mean square error of a and b\n    \"\"\"\n    return np.square(arg_0 - arg_1).mean() / (arg_0.mean() * arg_1.mean())", "path": "pyair/stats.py", "identifier": "nmse", "docstring": "Returns the normalized mean square error of a and b", "docstring_tokens": ["Returns", "the", "normalized", "mean", "square", "error", "of", "a", "and", "b"], "nwo": "LionelR/pyair", "score": 0.12050106452410352, "idx": 260343}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1441-L1455", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Does line terminate so, that the next symbol is in string constant.", "language": "python", "parameters": "(line)", "return_statement": "return ((line.count('\"') - line.count(r'\\\"') - line.count(\"'\\\"'\")) & 1) == 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "replace", "(", "r'\\\\'", ",", "'XX'", ")", "return", "(", "(", "arg_0", ".", "count", "(", "'\"'", ")", "-", "arg_0", ".", "count", "(", "r'\\\"'", ")", "-", "arg_0", ".", "count", "(", "\"'\\\"'\"", ")", ")", "&", "1", ")", "==", "1"], "function": "def Func(arg_0):\n  \"\"\"Does line terminate so, that the next symbol is in string constant.\n\n  This function does not consider single-line nor multi-line comments.\n\n  Args:\n    line: is a partial line of code starting from the 0..n.\n\n  Returns:\n    True, if next character appended to 'line' is inside a\n    string constant.\n  \"\"\"\n\n  arg_0 = arg_0.replace(r'\\\\', 'XX')  # after this, \\\\\" does not match to \\\"\n  return ((arg_0.count('\"') - arg_0.count(r'\\\"') - arg_0.count(\"'\\\"'\")) & 1) == 1", "path": "third_party/python/cpplint/cpplint.py", "identifier": "IsCppString", "docstring": "Does line terminate so, that the next symbol is in string constant.\n\n  This function does not consider single-line nor multi-line comments.\n\n  Args:\n    line: is a partial line of code starting from the 0..n.\n\n  Returns:\n    True, if next character appended to 'line' is inside a\n    string constant.", "docstring_tokens": ["Does", "line", "terminate", "so", "that", "the", "next", "symbol", "is", "in", "string", "constant", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260344}
{"url": "https://github.com/alpacahq/alpaca-trade-api-python/blob/9c9dea3b4a37c909f88391b202e86ff356a8b4d7/alpaca_trade_api/rest.py#L220-L227", "sha": "9c9dea3b4a37c909f88391b202e86ff356a8b4d7", "docstring_summary": "Get a list of assets", "language": "python", "parameters": "(self, status=None, asset_class=None)", "return_statement": "return [Asset(o) for o in resp]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "'status'", ":", "arg_1", ",", "'assert_class'", ":", "arg_2", ",", "}", "arg_4", "=", "arg_0", ".", "get", "(", "'/assets'", ",", "arg_3", ")", "return", "[", "Asset", "(", "arg_5", ")", "for", "arg_5", "in", "arg_4", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        '''Get a list of assets'''\n        arg_3 = {\n            'status': arg_1,\n            'assert_class': arg_2,\n        }\n        arg_4 = arg_0.get('/assets', arg_3)\n        return [Asset(arg_5) for arg_5 in arg_4]", "path": "alpaca_trade_api/rest.py", "identifier": "REST.list_assets", "docstring": "Get a list of assets", "docstring_tokens": ["Get", "a", "list", "of", "assets"], "nwo": "alpacahq/alpaca-trade-api-python", "score": 0.9697751514981866, "idx": 260345}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/classify.py#L333-L386", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Fits X to outcomes y, using clf and cv_method", "language": "python", "parameters": "(self, X, y, cross_val='4-Fold', scoring='accuracy',\n                      feat_select=None, class_weight='auto')", "return_statement": "return self.cvs.mean()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'4-Fold'", ",", "arg_4", "=", "'accuracy'", ",", "arg_5", "=", "None", ",", "arg_6", "=", "'auto'", ")", ":", "from", "sklearn", "import", "cross_validation", "arg_0", ".", "X", "=", "arg_1", "arg_0", ".", "y", "=", "arg_2", "arg_0", ".", "set_class_weight", "(", "arg_6", "=", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "isinstance", "(", "arg_3", ",", "string_types", ")", ":", "if", "re", ".", "match", "(", "'.*-Fold'", ",", "arg_3", ")", "is", "not", "None", ":", "arg_7", "=", "int", "(", "arg_3", ".", "split", "(", "'-'", ")", "[", "0", "]", ")", "arg_0", ".", "cver", "=", "cross_validation", ".", "StratifiedKFold", "(", "arg_0", ".", "y", ",", "arg_7", ")", "else", ":", "raise", "Exception", "(", "'Unrecognized cross validation method'", ")", "else", ":", "arg_0", ".", "cver", "=", "arg_3", "if", "arg_5", "is", "not", "None", ":", "arg_0", ".", "features_selected", "=", "[", "]", "from", "sklearn", ".", "grid_search", "import", "GridSearchCV", "if", "isinstance", "(", "arg_0", ".", "clf", ",", "GridSearchCV", ")", ":", "import", "warnings", "if", "arg_5", "is", "not", "None", ":", "warnings", ".", "warn", "(", "\"Cross-validated feature selection not supported with \"", "\"GridSearchCV\"", ")", "arg_0", ".", "clf", ".", "set_params", "(", "cv", "=", "arg_0", ".", "cver", ",", "arg_4", "=", "arg_4", ")", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "simplefilter", "(", "'ignore'", ",", "category", "=", "UserWarning", ")", "arg_0", ".", "clf", "=", "arg_0", ".", "clf", ".", "fit", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "cvs", "=", "arg_0", ".", "clf", ".", "best_score_", "else", ":", "arg_0", ".", "cvs", "=", "arg_0", ".", "feat_select_cvs", "(", "arg_5", "=", "arg_5", ",", "arg_4", "=", "arg_4", ")", "if", "arg_5", "is", "not", "None", ":", "arg_12", "=", "feature_selection", "(", "arg_5", ",", "arg_1", ",", "arg_2", ")", "arg_0", ".", "features_selected", ".", "append", "(", "arg_12", ")", "arg_1", "=", "arg_1", "[", ":", ",", "arg_12", "]", "arg_0", ".", "clf", ".", "fit", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "cvs", ".", "mean", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3='4-Fold', arg_4='accuracy',\n                      arg_5=None, arg_6='auto'):\n        \"\"\" Fits X to outcomes y, using clf and cv_method \"\"\"\n\n        from sklearn import cross_validation\n\n        arg_0.X = arg_1\n        arg_0.y = arg_2\n\n        arg_0.set_class_weight(arg_6=arg_6, arg_2=arg_2)\n\n        # Set cross validator\n        if isinstance(arg_3, string_types):\n            if re.match('.*-Fold', arg_3) is not None:\n                arg_7 = int(arg_3.split('-')[0])\n                arg_0.cver = cross_validation.StratifiedKFold(arg_0.y, arg_7)\n            else:\n                raise Exception('Unrecognized cross validation method')\n        else:\n            arg_0.cver = arg_3\n\n        if arg_5 is not None:\n            arg_0.features_selected = []\n\n        # Perform cross-validated classification\n        from sklearn.grid_search import GridSearchCV\n        if isinstance(arg_0.clf, GridSearchCV):\n            import warnings\n\n            if arg_5 is not None:\n                warnings.warn(\n                    \"Cross-validated feature selection not supported with \"\n                    \"GridSearchCV\")\n            arg_0.clf.set_params(cv=arg_0.cver, arg_4=arg_4)\n\n            with warnings.catch_warnings():\n                warnings.simplefilter('ignore', category=UserWarning)\n                arg_0.clf = arg_0.clf.fit(arg_1, arg_2)\n\n            arg_0.cvs = arg_0.clf.best_score_\n        else:\n            arg_0.cvs = arg_0.feat_select_cvs(\n                arg_5=arg_5, arg_4=arg_4)\n\n        if arg_5 is not None:\n            arg_12 = feature_selection(\n                arg_5, arg_1, arg_2)\n            arg_0.features_selected.append(arg_12)\n\n            arg_1 = arg_1[:, arg_12]\n\n        arg_0.clf.fit(arg_1, arg_2)\n\n        return arg_0.cvs.mean()", "path": "neurosynth/analysis/classify.py", "identifier": "Classifier.cross_val_fit", "docstring": "Fits X to outcomes y, using clf and cv_method", "docstring_tokens": ["Fits", "X", "to", "outcomes", "y", "using", "clf", "and", "cv_method"], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 260346}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/tasks/utils.py#L33-L37", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Helper function for loading JSON data verbatim into model.", "language": "python", "parameters": "(model_cls, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "(", "**", "arg_1", ")", "db", ".", "session", ".", "add", "(", "arg_2", ")", "db", ".", "session", ".", "commit", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Helper function for loading JSON data verbatim into model.\"\"\"\n    arg_2 = arg_0(**arg_1)\n    db.session.add(arg_2)\n    db.session.commit()", "path": "invenio_migrator/tasks/utils.py", "identifier": "load_common", "docstring": "Helper function for loading JSON data verbatim into model.", "docstring_tokens": ["Helper", "function", "for", "loading", "JSON", "data", "verbatim", "into", "model", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 260347}
{"url": "https://github.com/inveniosoftware/counter-robots/blob/484943fdc7e08f41d3ad7a9e2229afe0cec05547/counter_robots/__init__.py#L40-L43", "sha": "484943fdc7e08f41d3ad7a9e2229afe0cec05547", "docstring_summary": "Get a list of patterns from a file and make a regular expression.", "language": "python", "parameters": "(filename)", "return_statement": "return re.compile('|'.join(lines))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_get_resource_content", "(", "arg_0", ")", ".", "decode", "(", "'utf-8'", ")", ".", "splitlines", "(", ")", "return", "re", ".", "compile", "(", "'|'", ".", "join", "(", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Get a list of patterns from a file and make a regular expression.\"\"\"\n    arg_1 = _get_resource_content(arg_0).decode('utf-8').splitlines()\n    return re.compile('|'.join(arg_1))", "path": "counter_robots/__init__.py", "identifier": "_regexp", "docstring": "Get a list of patterns from a file and make a regular expression.", "docstring_tokens": ["Get", "a", "list", "of", "patterns", "from", "a", "file", "and", "make", "a", "regular", "expression", "."], "nwo": "inveniosoftware/counter-robots", "score": 0.15726537023232431, "idx": 260348}
{"url": "https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/process_executor.py#L340-L347", "sha": "dc2d941d8285a96f3a5b666a4bd04875b0b25984", "docstring_summary": "Safely send back the given result or exception", "language": "python", "parameters": "(result_queue, work_id, result=None, exception=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "try", ":", "arg_0", ".", "put", "(", "_ResultItem", "(", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ")", "except", "BaseException", "as", "e", ":", "arg_4", "=", "_ExceptionWithTraceback", "(", "e", ")", "arg_0", ".", "put", "(", "_ResultItem", "(", "arg_1", ",", "arg_3", "=", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"Safely send back the given result or exception\"\"\"\n    try:\n        arg_0.put(_ResultItem(arg_1, arg_2=arg_2,\n                                     arg_3=arg_3))\n    except BaseException as e:\n        arg_4 = _ExceptionWithTraceback(e)\n        arg_0.put(_ResultItem(arg_1, arg_3=arg_4))", "path": "loky/process_executor.py", "identifier": "_sendback_result", "docstring": "Safely send back the given result or exception", "docstring_tokens": ["Safely", "send", "back", "the", "given", "result", "or", "exception"], "nwo": "tomMoral/loky", "score": 0.572510808364181, "idx": 260349}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L171-L181", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Initialize the boto client.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "session", "=", "arg_0", ".", "create_session", "(", ")", "arg_0", ".", "client", "=", "arg_0", ".", "session", ".", "client", "(", "'ec2'", ")", "arg_0", ".", "ec2", "=", "arg_0", ".", "session", ".", "resource", "(", "'ec2'", ")", "arg_0", ".", "instances", "=", "[", "]", "arg_0", ".", "instance_states", "=", "{", "}", "arg_0", ".", "vpc_id", "=", "0", "arg_0", ".", "sg_id", "=", "0", "arg_0", ".", "sn_ids", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"Initialize the boto client.\"\"\"\n\n        arg_0.session = arg_0.create_session()\n        arg_0.client = arg_0.session.client('ec2')\n        arg_0.ec2 = arg_0.session.resource('ec2')\n        arg_0.instances = []\n        arg_0.instance_states = {}\n        arg_0.vpc_id = 0\n        arg_0.sg_id = 0\n        arg_0.sn_ids = []", "path": "parsl/providers/aws/aws.py", "identifier": "AWSProvider.initialize_boto_client", "docstring": "Initialize the boto client.", "docstring_tokens": ["Initialize", "the", "boto", "client", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 260350}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L303-L326", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Given the bit pattern lengths for symbols given in lengthTable,\n        set decodeTable, minLength, maxLength", "language": "python", "parameters": "(self, lengthTable)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "lengthTable", "=", "arg_1", "arg_0", ".", "minLength", "=", "min", "(", "arg_1", ".", "values", "(", ")", ")", "arg_0", ".", "maxLength", "=", "max", "(", "arg_1", ".", "values", "(", ")", ")", "arg_4", "=", "[", "]", "arg_5", "=", "0", "for", "arg_6", "in", "range", "(", "arg_0", ".", "maxLength", "+", "1", ")", ":", "arg_5", "<<=", "1", "arg_4", ".", "append", "(", "arg_5", ")", "arg_5", "+=", "sum", "(", "arg_7", "==", "arg_6", "for", "arg_7", "in", "arg_1", ".", "values", "(", ")", ")", "arg_0", ".", "decodeTable", "=", "{", "}", "for", "arg_9", "in", "sorted", "(", "arg_1", ")", ":", "arg_6", "=", "arg_1", "[", "arg_9", "]", "arg_10", "=", "'{:0{}b}'", ".", "format", "(", "arg_4", "[", "arg_6", "]", ",", "arg_6", ")", "arg_0", ".", "decodeTable", "[", "arg_11", "(", "arg_10", "[", ":", ":", "-", "1", "]", ",", "2", ")", "]", "=", "arg_9", "arg_4", "[", "arg_6", "]", "+=", "1", "arg_0", ".", "switchToPrefix", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Given the bit pattern lengths for symbols given in lengthTable,\n        set decodeTable, minLength, maxLength\n        \"\"\"\n        arg_0.lengthTable = arg_1\n        arg_0.minLength = min(arg_1.values())\n        arg_0.maxLength = max(arg_1.values())\n        #compute the backwards codes first; then reverse them\n        #compute (backwards) first code for every separate lengths\n        arg_4 = []\n        #build codes for each length, from right to left\n        arg_5 = 0\n        for arg_6 in range(arg_0.maxLength+1):\n            arg_5 <<= 1\n            arg_4.append(arg_5)\n            arg_5 += sum(arg_7==arg_6 for arg_7 in arg_1.values())\n        arg_0.decodeTable = {}\n        #count codes for each length, and store reversed in the table\n        for arg_9 in sorted(arg_1):\n            arg_6 = arg_1[arg_9]\n            arg_10 = '{:0{}b}'.format(arg_4[arg_6], arg_6)\n            arg_0.decodeTable[arg_11(arg_10[::-1], 2)] = arg_9\n            arg_4[arg_6] += 1\n        arg_0.switchToPrefix()", "path": "research/brotlidump.py", "identifier": "PrefixDecoder.setLength", "docstring": "Given the bit pattern lengths for symbols given in lengthTable,\n        set decodeTable, minLength, maxLength", "docstring_tokens": ["Given", "the", "bit", "pattern", "lengths", "for", "symbols", "given", "in", "lengthTable", "set", "decodeTable", "minLength", "maxLength"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 260351}
{"url": "https://github.com/UDST/pandana/blob/961a7ef8d3b0144b190cb60bbd61845fca6fb314/pandana/loaders/pandash5.py#L4-L27", "sha": "961a7ef8d3b0144b190cb60bbd61845fca6fb314", "docstring_summary": "Create DataFrames of nodes and edges that do not include specified nodes.", "language": "python", "parameters": "(network, rm_nodes)", "return_statement": "return ndf.loc[nodes_to_keep], edf.loc[edges_to_keep]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "set", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "nodes_df", "arg_3", "=", "arg_0", ".", "edges_df", "arg_4", "=", "~", "arg_2", ".", "index", ".", "isin", "(", "arg_1", ")", "arg_5", "=", "~", "(", "arg_3", "[", "'from'", "]", ".", "isin", "(", "arg_1", ")", "|", "arg_3", "[", "'to'", "]", ".", "isin", "(", "arg_1", ")", ")", "return", "arg_2", ".", "loc", "[", "arg_4", "]", ",", "arg_3", ".", "loc", "[", "arg_5", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Create DataFrames of nodes and edges that do not include specified nodes.\n\n    Parameters\n    ----------\n    network : pandana.Network\n    rm_nodes : array_like\n        A list, array, Index, or Series of node IDs that should *not*\n        be saved as part of the Network.\n\n    Returns\n    -------\n    nodes, edges : pandas.DataFrame\n\n    \"\"\"\n    arg_1 = set(arg_1)\n    arg_2 = arg_0.nodes_df\n    arg_3 = arg_0.edges_df\n\n    arg_4 = ~arg_2.index.isin(arg_1)\n    arg_5 = ~(arg_3['from'].isin(arg_1) | arg_3['to'].isin(arg_1))\n\n    return arg_2.loc[arg_4], arg_3.loc[arg_5]", "path": "pandana/loaders/pandash5.py", "identifier": "remove_nodes", "docstring": "Create DataFrames of nodes and edges that do not include specified nodes.\n\n    Parameters\n    ----------\n    network : pandana.Network\n    rm_nodes : array_like\n        A list, array, Index, or Series of node IDs that should *not*\n        be saved as part of the Network.\n\n    Returns\n    -------\n    nodes, edges : pandas.DataFrame", "docstring_tokens": ["Create", "DataFrames", "of", "nodes", "and", "edges", "that", "do", "not", "include", "specified", "nodes", "."], "nwo": "UDST/pandana", "score": 0.47050699646286387, "idx": 260352}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/medium/boundary_types.py#L26-L82", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Find the external compartment in the model.", "language": "python", "parameters": "(model)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "boundary", ":", "arg_1", "=", "pd", ".", "Series", "(", "tuple", "(", "r", ".", "compartments", ")", "[", "0", "]", "for", "r", "in", "arg_0", ".", "boundary", ")", "arg_2", "=", "arg_1", ".", "value_counts", "(", ")", "arg_2", "=", "arg_2", ".", "index", "[", "arg_2", "==", "arg_2", ".", "max", "(", ")", "]", ".", "to_series", "(", ")", "else", ":", "arg_2", "=", "None", "arg_3", "=", "compartment_shortlist", "[", "\"e\"", "]", "+", "[", "\"e\"", "]", "arg_4", "=", "pd", ".", "Series", "(", "[", "co", "in", "arg_3", "for", "co", "in", "arg_0", ".", "compartments", "]", ",", "index", "=", "arg_0", ".", "compartments", ")", "if", "arg_4", ".", "sum", "(", ")", "==", "1", ":", "arg_5", "=", "arg_4", ".", "index", "[", "arg_4", "]", "[", "0", "]", "LOGGER", ".", "info", "(", "\"Compartment `%s` sounds like an external compartment. \"", "\"Using this one without counting boundary reactions\"", "%", "arg_5", ")", "return", "arg_5", "elif", "arg_2", "is", "not", "None", "and", "arg_4", ".", "sum", "(", ")", ">", "1", "and", "arg_4", "[", "arg_2", "]", ".", "sum", "(", ")", "==", "1", ":", "arg_5", "=", "arg_2", "[", "arg_4", "[", "arg_2", "]", "]", "[", "0", "]", "LOGGER", ".", "warning", "(", "\"There are several compartments that look like an \"", "\"external compartment but `%s` has the most boundary \"", "\"reactions, so using that as the external \"", "\"compartment.\"", "%", "arg_5", ")", "return", "arg_5", "elif", "arg_4", ".", "sum", "(", ")", ">", "1", ":", "raise", "RuntimeError", "(", "\"There are several compartments (%s) that look \"", "\"like external compartments but we can't tell \"", "\"which one to use. Consider renaming your \"", "\"compartments please.\"", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_2", "[", "0", "]", "LOGGER", ".", "warning", "(", "\"Could not identify an external compartment by name and\"", "\" choosing one with the most boundary reactions. That \"", "\"might be complete nonsense or change suddenly. \"", "\"Consider renaming your compartments using \"", "\"`Model.compartments` to fix this.\"", ")", "raise", "RuntimeError", "(", "\"The heuristic for discovering an external compartment \"", "\"relies on names and boundary reactions. Yet, there \"", "\"are neither compartments with recognized names nor \"", "\"boundary reactions in the model.\"", ")"], "function": "def Func(arg_0):\n    \"\"\"Find the external compartment in the model.\n\n    Uses a simple heuristic where the external compartment should be the one\n    with the most exchange reactions.\n\n    Arguments\n    ---------\n    model : cobra.Model\n        A cobra model.\n\n    Returns\n    -------\n    str\n        The putative external compartment.\n    \"\"\"\n    if arg_0.boundary:\n        arg_1 = pd.Series(tuple(r.compartments)[0] for r in arg_0.boundary)\n        arg_2 = arg_1.value_counts()\n        arg_2 = arg_2.index[arg_2 == arg_2.max()].to_series()\n    else:\n        arg_2 = None\n    arg_3 = compartment_shortlist[\"e\"] + [\"e\"]\n    arg_4 = pd.Series([co in arg_3 for co in arg_0.compartments],\n                        index=arg_0.compartments)\n\n    if arg_4.sum() == 1:\n        arg_5 = arg_4.index[arg_4][0]\n        LOGGER.info(\"Compartment `%s` sounds like an external compartment. \"\n                    \"Using this one without counting boundary reactions\" %\n                    arg_5)\n        return arg_5\n    elif arg_2 is not None and arg_4.sum() > 1 and arg_4[arg_2].sum() == 1:\n        arg_5 = arg_2[arg_4[arg_2]][0]\n        LOGGER.warning(\"There are several compartments that look like an \"\n                       \"external compartment but `%s` has the most boundary \"\n                       \"reactions, so using that as the external \"\n                       \"compartment.\" % arg_5)\n        return arg_5\n    elif arg_4.sum() > 1:\n        raise RuntimeError(\"There are several compartments (%s) that look \"\n                           \"like external compartments but we can't tell \"\n                           \"which one to use. Consider renaming your \"\n                           \"compartments please.\")\n\n    if arg_2 is not None:\n        return arg_2[0]\n        LOGGER.warning(\"Could not identify an external compartment by name and\"\n                       \" choosing one with the most boundary reactions. That \"\n                       \"might be complete nonsense or change suddenly. \"\n                       \"Consider renaming your compartments using \"\n                       \"`Model.compartments` to fix this.\")\n    # No info in the model, so give up\n    raise RuntimeError(\"The heuristic for discovering an external compartment \"\n                       \"relies on names and boundary reactions. Yet, there \"\n                       \"are neither compartments with recognized names nor \"\n                       \"boundary reactions in the model.\")", "path": "cobra/medium/boundary_types.py", "identifier": "find_external_compartment", "docstring": "Find the external compartment in the model.\n\n    Uses a simple heuristic where the external compartment should be the one\n    with the most exchange reactions.\n\n    Arguments\n    ---------\n    model : cobra.Model\n        A cobra model.\n\n    Returns\n    -------\n    str\n        The putative external compartment.", "docstring_tokens": ["Find", "the", "external", "compartment", "in", "the", "model", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 260353}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/chemical.py#L634-L671", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Interface for drawing an interactive 3D view of the molecule.\n        Requires an HTML5 browser, and the libraries RDKit, pymol3D, and\n        IPython. An exception is raised if all three of these libraries are\n        not installed.", "language": "python", "parameters": "(self, width=300, height=500, style='stick', Hs=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "300", ",", "arg_2", "=", "500", ",", "arg_3", "=", "'stick'", ",", "arg_4", "=", "True", ")", ":", "try", ":", "import", "py3Dmol", "from", "IPython", ".", "display", "import", "display", "if", "arg_4", ":", "arg_5", "=", "arg_0", ".", "rdkitmol_Hs", "else", ":", "arg_5", "=", "arg_0", ".", "rdkitmol", "AllChem", ".", "EmbedMultipleConfs", "(", "arg_5", ")", "arg_6", "=", "Chem", ".", "MolToMolBlock", "(", "arg_5", ")", "arg_7", "=", "py3Dmol", ".", "view", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_7", ".", "addModel", "(", "arg_6", ",", "'sdf'", ")", "arg_7", ".", "setStyle", "(", "{", "arg_3", ":", "{", "}", "}", ")", "arg_7", ".", "zoomTo", "(", ")", "display", "(", "arg_7", ".", "show", "(", ")", ")", "except", ":", "return", "'py3Dmol, RDKit, and IPython are required for this feature.'"], "function": "def Func(arg_0, arg_1=300, arg_2=500, arg_3='stick', arg_4=True): # pragma: no cover\n        r'''Interface for drawing an interactive 3D view of the molecule.\n        Requires an HTML5 browser, and the libraries RDKit, pymol3D, and\n        IPython. An exception is raised if all three of these libraries are\n        not installed.\n\n        Parameters\n        ----------\n        width : int\n            Number of pixels wide for the view\n        height : int\n            Number of pixels tall for the view\n        style : str\n            One of 'stick', 'line', 'cross', or 'sphere'\n        Hs : bool\n            Whether or not to show hydrogen\n\n        Examples\n        --------\n        >>> Chemical('cubane').Func()\n        <IPython.core.display.HTML object>\n        '''\n        try:\n            import py3Dmol\n            from IPython.display import display\n            if arg_4:\n                arg_5 = arg_0.rdkitmol_Hs\n            else:\n                arg_5 = arg_0.rdkitmol\n            AllChem.EmbedMultipleConfs(arg_5)\n            arg_6 = Chem.MolToMolBlock(arg_5)\n            arg_7 = py3Dmol.view(arg_1=arg_1,arg_2=arg_2)\n            arg_7.addModel(arg_6,'sdf')\n            arg_7.setStyle({arg_3:{}})\n            arg_7.zoomTo()\n            display(arg_7.show())\n        except:\n            return 'py3Dmol, RDKit, and IPython are required for this feature.'", "path": "thermo/chemical.py", "identifier": "Chemical.draw_3d", "docstring": "r'''Interface for drawing an interactive 3D view of the molecule.\n        Requires an HTML5 browser, and the libraries RDKit, pymol3D, and\n        IPython. An exception is raised if all three of these libraries are\n        not installed.\n\n        Parameters\n        ----------\n        width : int\n            Number of pixels wide for the view\n        height : int\n            Number of pixels tall for the view\n        style : str\n            One of 'stick', 'line', 'cross', or 'sphere'\n        Hs : bool\n            Whether or not to show hydrogen\n\n        Examples\n        --------\n        >>> Chemical('cubane').draw_3d()\n        <IPython.core.display.HTML object>", "docstring_tokens": ["r", "Interface", "for", "drawing", "an", "interactive", "3D", "view", "of", "the", "molecule", ".", "Requires", "an", "HTML5", "browser", "and", "the", "libraries", "RDKit", "pymol3D", "and", "IPython", ".", "An", "exception", "is", "raised", "if", "all", "three", "of", "these", "libraries", "are", "not", "installed", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 260354}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/configurable.py#L152-L166", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the help string for this class in ReST format.\n        \n        If `inst` is given, it's current trait values will be used in place of\n        class defaults.", "language": "python", "parameters": "(cls, inst=None)", "return_statement": "return '\\n'.join(final_help)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "assert", "arg_1", "is", "None", "or", "isinstance", "(", "arg_1", ",", "arg_0", ")", "arg_2", "=", "arg_0", ".", "class_traits", "(", "config", "=", "True", ")", "arg_3", "=", "[", "]", "arg_3", ".", "append", "(", "u'%s options'", "%", "arg_0", ".", "__name__", ")", "arg_3", ".", "append", "(", "len", "(", "arg_3", "[", "0", "]", ")", "*", "u'-'", ")", "for", "arg_4", ",", "arg_5", "in", "sorted", "(", "arg_0", ".", "class_traits", "(", "config", "=", "True", ")", ".", "iteritems", "(", ")", ")", ":", "arg_6", "=", "arg_0", ".", "class_get_trait_help", "(", "arg_5", ",", "arg_1", ")", "arg_3", ".", "append", "(", "arg_6", ")", "return", "'\\n'", ".", "join", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Get the help string for this class in ReST format.\n        \n        If `inst` is given, it's current trait values will be used in place of\n        class defaults.\n        \"\"\"\n        assert arg_1 is None or isinstance(arg_1, arg_0)\n        arg_2 = arg_0.class_traits(config=True)\n        arg_3 = []\n        arg_3.append(u'%s options' % arg_0.__name__)\n        arg_3.append(len(arg_3[0])*u'-')\n        for arg_4,arg_5 in sorted(arg_0.class_traits(config=True).iteritems()):\n            arg_6 = arg_0.class_get_trait_help(arg_5, arg_1)\n            arg_3.append(arg_6)\n        return '\\n'.join(arg_3)", "path": "environment/lib/python2.7/site-packages/IPython/config/configurable.py", "identifier": "Configurable.class_get_help", "docstring": "Get the help string for this class in ReST format.\n        \n        If `inst` is given, it's current trait values will be used in place of\n        class defaults.", "docstring_tokens": ["Get", "the", "help", "string", "for", "this", "class", "in", "ReST", "format", ".", "If", "inst", "is", "given", "it", "s", "current", "trait", "values", "will", "be", "used", "in", "place", "of", "class", "defaults", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260355}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/opengl/vao.py#L160-L180", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Transform vertices. Stores the output in a single buffer.", "language": "python", "parameters": "(self, program: moderngl.Program, buffer: moderngl.Buffer,\n                  mode=None, vertices=-1, first=0, instances=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Program", ",", "arg_4", ":", "arg_2", ".", "Buffer", ",", "arg_6", "=", "None", ",", "arg_7", "=", "-", "1", ",", "arg_8", "=", "0", ",", "arg_9", "=", "1", ")", ":", "arg_10", "=", "arg_0", ".", "instance", "(", "arg_1", ")", "if", "arg_6", "is", "None", ":", "arg_6", "=", "arg_0", ".", "mode", "arg_10", ".", "Func", "(", "arg_4", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1: arg_2.Program, arg_4: arg_2.Buffer,\n                  arg_6=None, arg_7=-1, arg_8=0, arg_9=1):\n        \"\"\"\n        Transform vertices. Stores the output in a single buffer.\n\n        Args:\n            program: The ``moderngl.Program``\n            buffer: The ``moderngl.buffer`` to store the output\n\n        Keyword Args:\n            mode: Draw mode (for example ``moderngl.POINTS``)\n            vertices (int): The number of vertices to Func\n            first (int): The index of the first vertex to start with\n            instances (int): The number of instances\n        \"\"\"\n        arg_10 = arg_0.instance(arg_1)\n\n        if arg_6 is None:\n            arg_6 = arg_0.mode\n\n        arg_10.Func(arg_4, arg_6=arg_6, arg_7=arg_7, arg_8=arg_8, arg_9=arg_9)", "path": "demosys/opengl/vao.py", "identifier": "VAO.transform", "docstring": "Transform vertices. Stores the output in a single buffer.\n\n        Args:\n            program: The ``moderngl.Program``\n            buffer: The ``moderngl.buffer`` to store the output\n\n        Keyword Args:\n            mode: Draw mode (for example ``moderngl.POINTS``)\n            vertices (int): The number of vertices to transform\n            first (int): The index of the first vertex to start with\n            instances (int): The number of instances", "docstring_tokens": ["Transform", "vertices", ".", "Stores", "the", "output", "in", "a", "single", "buffer", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 260356}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/interactive/iplot_histogram.py#L26-L50", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Prepare received data for representation.", "language": "python", "parameters": "(data, number_to_keep)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "if", "arg_1", "!=", "0", ":", "arg_3", "=", "dict", "(", "Counter", "(", "arg_0", ")", ".", "most_common", "(", "arg_1", ")", ")", "arg_3", "[", "'rest'", "]", "=", "sum", "(", "arg_0", ".", "values", "(", ")", ")", "-", "sum", "(", "arg_3", ".", "values", "(", ")", ")", "arg_0", "=", "arg_3", "arg_4", "=", "arg_0", "arg_5", "=", "np", ".", "array", "(", "[", "arg_0", "[", "key", "]", "for", "key", "in", "arg_4", "]", ",", "dtype", "=", "float", ")", "arg_6", "=", "arg_5", "/", "sum", "(", "arg_5", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_4", ")", ":", "arg_2", "[", "arg_8", "]", "=", "round", "(", "arg_6", "[", "arg_7", "]", ",", "5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Prepare received data for representation.\n\n        Args:\n            data (dict): values to represent (ex. {'001' : 130})\n            number_to_keep (int): number of elements to show individually.\n\n        Returns:\n            dict: processed data to show.\n    \"\"\"\n\n    arg_2 = dict()\n\n    if arg_1 != 0:\n        arg_3 = dict(Counter(arg_0).most_common(arg_1))\n        arg_3['rest'] = sum(arg_0.values()) - sum(arg_3.values())\n        arg_0 = arg_3\n\n    arg_4 = arg_0\n    arg_5 = np.array([arg_0[key] for key in arg_4], dtype=float)\n    arg_6 = arg_5 / sum(arg_5)\n    for arg_7, arg_8 in enumerate(arg_4):\n        arg_2[arg_8] = round(arg_6[arg_7], 5)\n\n    return arg_2", "path": "qiskit/visualization/interactive/iplot_histogram.py", "identifier": "process_data", "docstring": "Prepare received data for representation.\n\n        Args:\n            data (dict): values to represent (ex. {'001' : 130})\n            number_to_keep (int): number of elements to show individually.\n\n        Returns:\n            dict: processed data to show.", "docstring_tokens": ["Prepare", "received", "data", "for", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260357}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L146-L163", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Waits for the Job to reach a terminal state.", "language": "python", "parameters": "(self, project_id, job_id, interval=30)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "30", ")", ":", "if", "arg_3", "<=", "0", ":", "raise", "ValueError", "(", "\"Interval must be > 0\"", ")", "while", "True", ":", "arg_4", "=", "arg_0", ".", "_get_job", "(", "arg_1", ",", "arg_2", ")", "if", "arg_4", "[", "'state'", "]", "in", "[", "'SUCCEEDED'", ",", "'FAILED'", ",", "'CANCELLED'", "]", ":", "return", "arg_4", "time", ".", "sleep", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=30):\n        \"\"\"\n        Waits for the Job to reach a terminal state.\n\n        This method will periodically check the job state until the job reach\n        a terminal state.\n\n        Raises:\n            googleapiclient.errors.HttpError: if HTTP error is returned when getting\n            the job\n        \"\"\"\n        if arg_3 <= 0:\n            raise ValueError(\"Interval must be > 0\")\n        while True:\n            arg_4 = arg_0._get_job(arg_1, arg_2)\n            if arg_4['state'] in ['SUCCEEDED', 'FAILED', 'CANCELLED']:\n                return arg_4\n            time.sleep(arg_3)", "path": "airflow/contrib/hooks/gcp_mlengine_hook.py", "identifier": "MLEngineHook._wait_for_job_done", "docstring": "Waits for the Job to reach a terminal state.\n\n        This method will periodically check the job state until the job reach\n        a terminal state.\n\n        Raises:\n            googleapiclient.errors.HttpError: if HTTP error is returned when getting\n            the job", "docstring_tokens": ["Waits", "for", "the", "Job", "to", "reach", "a", "terminal", "state", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260358}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L124-L142", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get an HTTPResponse that can be used when there's no related EnterpriseCustomer.", "language": "python", "parameters": "(self, request)", "return_statement": "return Response(data, status=HTTP_200_OK)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", ".", "get_required_query_params", "(", "arg_1", ")", "arg_6", "=", "{", "arg_0", ".", "REQUIRED_PARAM_USERNAME", ":", "arg_2", ",", "arg_0", ".", "REQUIRED_PARAM_ENTERPRISE_CUSTOMER", ":", "arg_5", ",", "arg_0", ".", "CONSENT_EXISTS", ":", "False", ",", "arg_0", ".", "CONSENT_GRANTED", ":", "False", ",", "arg_0", ".", "CONSENT_REQUIRED", ":", "False", ",", "}", "if", "arg_3", ":", "arg_6", "[", "arg_0", ".", "REQUIRED_PARAM_COURSE_ID", "]", "=", "arg_3", "if", "arg_4", ":", "arg_6", "[", "arg_0", ".", "REQUIRED_PARAM_PROGRAM_UUID", "]", "=", "arg_4", "return", "Response", "(", "arg_6", ",", "status", "=", "HTTP_200_OK", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Get an HTTPResponse that can be used when there's no related EnterpriseCustomer.\n        \"\"\"\n        arg_2, arg_3, arg_4, arg_5 = arg_0.get_required_query_params(arg_1)\n        arg_6 = {\n            arg_0.REQUIRED_PARAM_USERNAME: arg_2,\n            arg_0.REQUIRED_PARAM_ENTERPRISE_CUSTOMER: arg_5,\n            arg_0.CONSENT_EXISTS: False,\n            arg_0.CONSENT_GRANTED: False,\n            arg_0.CONSENT_REQUIRED: False,\n        }\n        if arg_3:\n            arg_6[arg_0.REQUIRED_PARAM_COURSE_ID] = arg_3\n\n        if arg_4:\n            arg_6[arg_0.REQUIRED_PARAM_PROGRAM_UUID] = arg_4\n\n        return Response(arg_6, status=HTTP_200_OK)", "path": "consent/api/v1/views.py", "identifier": "DataSharingConsentView.get_no_record_response", "docstring": "Get an HTTPResponse that can be used when there's no related EnterpriseCustomer.", "docstring_tokens": ["Get", "an", "HTTPResponse", "that", "can", "be", "used", "when", "there", "s", "no", "related", "EnterpriseCustomer", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260359}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/materialphysicalproperties/core.py#L53-L86", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Create a template csv file for a data set.", "language": "python", "parameters": "(material, path, show=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "'dataset-%s.csv'", "%", "arg_0", ".", "lower", "(", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_3", ")", "with", "open", "(", "arg_4", ",", "'w'", ",", "newline", "=", "''", ")", "as", "csvfile", ":", "arg_5", "=", "csv", ".", "writer", "(", "csvfile", ",", "delimiter", "=", "','", ",", "quotechar", "=", "'\"'", ",", "quoting", "=", "csv", ".", "QUOTE_MINIMAL", ")", "arg_5", ".", "writerow", "(", "[", "'Name'", ",", "arg_0", "]", ")", "arg_5", ".", "writerow", "(", "[", "'Description'", ",", "'<Add a data set description '", "'here.>'", "]", ")", "arg_5", ".", "writerow", "(", "[", "'Reference'", ",", "'<Add a reference to the source of '", "'the data set here.>'", "]", ")", "arg_5", ".", "writerow", "(", "[", "'Temperature'", ",", "'<parameter 1 name>'", ",", "'<parameter 2 name>'", ",", "'<parameter 3 name>'", "]", ")", "arg_5", ".", "writerow", "(", "[", "'T'", ",", "'<parameter 1 display symbol>'", ",", "'<parameter 2 display symbol>'", ",", "'<parameter 3 display symbol>'", "]", ")", "arg_5", ".", "writerow", "(", "[", "'K'", ",", "'<parameter 1 units>'", ",", "'<parameter 2 units>'", ",", "'<parameter 3 units>'", "]", ")", "arg_5", ".", "writerow", "(", "[", "'T'", ",", "'<parameter 1 symbol>'", ",", "'<parameter 2 symbol>'", ",", "'<parameter 3 symbol>'", "]", ")", "for", "arg_6", "in", "range", "(", "10", ")", ":", "arg_5", ".", "writerow", "(", "[", "100.0", "+", "arg_6", "*", "50", ",", "float", "(", "arg_6", ")", ",", "10.0", "+", "arg_6", ",", "100.0", "+", "arg_6", "]", ")", "if", "arg_2", "is", "True", ":", "webbrowser", ".", "open_new", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Create a template csv file for a data set.\n\n        :param material: the name of the material\n        :param path: the path of the directory where the file must be written\n        :param show: a boolean indicating whether the created file should be \\\n        displayed after creation\n        \"\"\"\n        arg_3 = 'dataset-%s.csv' % arg_0.lower()\n        arg_4 = os.path.join(arg_1, arg_3)\n\n        with open(arg_4, 'w', newline='') as csvfile:\n            arg_5 = csv.writer(csvfile, delimiter=',',\n                                quotechar='\"', quoting=csv.QUOTE_MINIMAL)\n            arg_5.writerow(['Name', arg_0])\n            arg_5.writerow(['Description', '<Add a data set description '\n                                            'here.>'])\n            arg_5.writerow(['Reference', '<Add a reference to the source of '\n                                          'the data set here.>'])\n            arg_5.writerow(['Temperature', '<parameter 1 name>',\n                            '<parameter 2 name>', '<parameter 3 name>'])\n            arg_5.writerow(['T', '<parameter 1 display symbol>',\n                             '<parameter 2 display symbol>',\n                             '<parameter 3 display symbol>'])\n            arg_5.writerow(['K', '<parameter 1 units>',\n                             '<parameter 2 units>', '<parameter 3 units>'])\n            arg_5.writerow(['T', '<parameter 1 symbol>',\n                             '<parameter 2 symbol>', '<parameter 3 symbol>'])\n            for arg_6 in range(10):\n                arg_5.writerow([100.0 + arg_6*50, float(arg_6), 10.0 + arg_6, 100.0 + arg_6])\n\n        if arg_2 is True:\n            webbrowser.open_new(arg_4)", "path": "auxi/tools/materialphysicalproperties/core.py", "identifier": "DataSet.create_template", "docstring": "Create a template csv file for a data set.\n\n        :param material: the name of the material\n        :param path: the path of the directory where the file must be written\n        :param show: a boolean indicating whether the created file should be \\\n        displayed after creation", "docstring_tokens": ["Create", "a", "template", "csv", "file", "for", "a", "data", "set", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 260360}
{"url": "https://github.com/lazka/hypothesis-fspaths/blob/19edb40a91ae4055bccf125a1e0b1796fa2e6a5c/hypothesis_fspaths.py#L104-L112", "sha": "19edb40a91ae4055bccf125a1e0b1796fa2e6a5c", "docstring_summary": "Given an ASCII str, returns a path of the given type.", "language": "python", "parameters": "(s, result_type)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "isinstance", "(", "arg_0", ",", "str", ")", "if", "isinstance", "(", "arg_0", ",", "bytes", ")", "and", "arg_1", "is", "text_type", ":", "return", "arg_0", ".", "decode", "(", "'ascii'", ")", "elif", "isinstance", "(", "arg_0", ",", "text_type", ")", "and", "arg_1", "is", "bytes", ":", "return", "arg_0", ".", "encode", "(", "'ascii'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Given an ASCII str, returns a path of the given type.\"\"\"\n\n    assert isinstance(arg_0, str)\n    if isinstance(arg_0, bytes) and arg_1 is text_type:\n        return arg_0.decode('ascii')\n    elif isinstance(arg_0, text_type) and arg_1 is bytes:\n        return arg_0.encode('ascii')\n    return arg_0", "path": "hypothesis_fspaths.py", "identifier": "_str_to_path", "docstring": "Given an ASCII str, returns a path of the given type.", "docstring_tokens": ["Given", "an", "ASCII", "str", "returns", "a", "path", "of", "the", "given", "type", "."], "nwo": "lazka/hypothesis-fspaths", "score": 0.16941397159673272, "idx": 260361}
{"url": "https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L244-L277", "sha": "148b700c5846d8fdafc562d4326587da5447223f", "docstring_summary": "Call each listener for the event with the given arguments.", "language": "python", "parameters": "(self, event, *args, **kwargs)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_listeners", "[", "arg_1", "]", "arg_4", "=", "itertools", ".", "chain", "(", "arg_4", ",", "arg_0", ".", "_once", "[", "arg_1", "]", ")", "arg_0", ".", "_once", "[", "arg_1", "]", "=", "[", "]", "for", "arg_6", "in", "arg_4", ":", "arg_0", ".", "_loop", ".", "call_soon", "(", "functools", ".", "partial", "(", "arg_0", ".", "_dispatch", ",", "arg_1", ",", "arg_6", ",", "*", "arg_2", ",", "**", "arg_3", ",", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Call each listener for the event with the given arguments.\n\n        Args:\n            event (str): The event to trigger listeners on.\n            *args: Any number of positional arguments.\n            **kwargs: Any number of keyword arguments.\n\n        This method passes all arguments other than the event name directly\n        to the listeners. If a listener raises an exception for any reason the\n        'listener-error', or current value of LISTENER_ERROR_EVENT, is Functed.\n        Listeners to this event are given the event name, listener object, and\n        the exception raised. If an error listener fails it does so silently.\n\n        All event listeners are fired in a deferred way so this method returns\n        immediately. The calling coro must yield at some point for the event\n        to propagate to the listeners.\n        \"\"\"\n        arg_4 = arg_0._listeners[arg_1]\n        arg_4 = itertools.chain(arg_4, arg_0._once[arg_1])\n        arg_0._once[arg_1] = []\n        for arg_6 in arg_4:\n\n            arg_0._loop.call_soon(\n                functools.partial(\n                    arg_0._dispatch,\n                    arg_1,\n                    arg_6,\n                    *arg_2,\n                    **arg_3,\n                )\n            )\n\n        return arg_0", "path": "eventemitter/emitter.py", "identifier": "EventEmitter.emit", "docstring": "Call each listener for the event with the given arguments.\n\n        Args:\n            event (str): The event to trigger listeners on.\n            *args: Any number of positional arguments.\n            **kwargs: Any number of keyword arguments.\n\n        This method passes all arguments other than the event name directly\n        to the listeners. If a listener raises an exception for any reason the\n        'listener-error', or current value of LISTENER_ERROR_EVENT, is emitted.\n        Listeners to this event are given the event name, listener object, and\n        the exception raised. If an error listener fails it does so silently.\n\n        All event listeners are fired in a deferred way so this method returns\n        immediately. The calling coro must yield at some point for the event\n        to propagate to the listeners.", "docstring_tokens": ["Call", "each", "listener", "for", "the", "event", "with", "the", "given", "arguments", "."], "nwo": "asyncdef/eventemitter", "score": 0.1832591465193378, "idx": 260362}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/views.py#L629-L672", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Runs the checkout process for the current cart.", "language": "python", "parameters": "(request, user_id=None)", "return_statement": "return redirect(\"invoice\", current_invoice.invoice.id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "if", "arg_0", ".", "user", ".", "is_staff", ":", "arg_2", "=", "User", ".", "objects", ".", "get", "(", "id", "=", "int", "(", "arg_1", ")", ")", "else", ":", "raise", "Http404", "(", ")", "else", ":", "arg_2", "=", "arg_0", ".", "user", "arg_3", "=", "CartController", ".", "for_user", "(", "arg_2", ")", "if", "\"fix_errors\"", "in", "arg_0", ".", "GET", "and", "arg_0", ".", "GET", "[", "\"fix_errors\"", "]", "==", "\"true\"", ":", "arg_3", ".", "fix_simple_errors", "(", ")", "try", ":", "arg_4", "=", "InvoiceController", ".", "for_cart", "(", "arg_3", ".", "cart", ")", "except", "ValidationError", "as", "ve", ":", "return", "_Func_errors", "(", "arg_0", ",", "ve", ")", "return", "redirect", "(", "\"invoice\"", ",", "arg_4", ".", "invoice", ".", "id", ")"], "function": "def Func(arg_0, arg_1=None):\n    ''' Runs the Func process for the current cart.\n\n    If the query string contains ``fix_errors=true``, Registrasion will attempt\n    to fix errors preventing the system from checking out, including by\n    cancelling expired discounts and vouchers, and removing any unavailable\n    products.\n\n    Arguments:\n        user_id (castable to int):\n            If the requesting user is staff, then the user ID can be used to\n            run Func for another user.\n    Returns:\n        render or redirect:\n            If the invoice is generated successfully, or there's already a\n            valid invoice for the current cart, redirect to ``invoice``.\n            If there are errors when generating the invoice, render\n            ``registrasion/Func_errors.html`` with the following data::\n\n                {\n                    \"error_list\", [str, ...]  # The errors to display.\n                }\n\n    '''\n\n    if arg_1 is not None:\n        if arg_0.user.is_staff:\n            arg_2 = User.objects.get(id=int(arg_1))\n        else:\n            raise Http404()\n    else:\n        arg_2 = arg_0.user\n\n    arg_3 = CartController.for_user(arg_2)\n\n    if \"fix_errors\" in arg_0.GET and arg_0.GET[\"fix_errors\"] == \"true\":\n        arg_3.fix_simple_errors()\n\n    try:\n        arg_4 = InvoiceController.for_cart(arg_3.cart)\n    except ValidationError as ve:\n        return _Func_errors(arg_0, ve)\n\n    return redirect(\"invoice\", arg_4.invoice.id)", "path": "registrasion/views.py", "identifier": "checkout", "docstring": "Runs the checkout process for the current cart.\n\n    If the query string contains ``fix_errors=true``, Registrasion will attempt\n    to fix errors preventing the system from checking out, including by\n    cancelling expired discounts and vouchers, and removing any unavailable\n    products.\n\n    Arguments:\n        user_id (castable to int):\n            If the requesting user is staff, then the user ID can be used to\n            run checkout for another user.\n    Returns:\n        render or redirect:\n            If the invoice is generated successfully, or there's already a\n            valid invoice for the current cart, redirect to ``invoice``.\n            If there are errors when generating the invoice, render\n            ``registrasion/checkout_errors.html`` with the following data::\n\n                {\n                    \"error_list\", [str, ...]  # The errors to display.\n                }", "docstring_tokens": ["Runs", "the", "checkout", "process", "for", "the", "current", "cart", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 260363}
{"url": "https://github.com/LudovicRousseau/PyKCS11/blob/76ccd8741af2ea193aaf1ca29dfedfa412c134fe/PyKCS11/__init__.py#L1334-L1349", "sha": "76ccd8741af2ea193aaf1ca29dfedfa412c134fe", "docstring_summary": "generate a secret key", "language": "python", "parameters": "(self, template, mecha=MechanismAESGENERATEKEY)", "return_statement": "return ck_handle", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_template2ckattrlist", "(", "arg_1", ")", "arg_5", "=", "PyKCS11", ".", "LowLevel", ".", "CK_OBJECT_HANDLE", "(", ")", "arg_6", "=", "arg_2", ".", "to_native", "(", ")", "arg_7", "=", "arg_0", ".", "lib", ".", "C_GenerateKey", "(", "arg_0", ".", "session", ",", "arg_6", ",", "arg_4", ",", "arg_5", ")", "if", "arg_7", "!=", "CKR_OK", ":", "raise", "PyKCS11Error", "(", "arg_7", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=arg_3):\n        \"\"\"\n        generate a secret key\n\n        :param template: template for the secret key\n        :param mecha: mechanism to use\n        :return: handle of the generated key\n        :rtype: PyKCS11.LowLevel.CK_OBJECT_HANDLE\n        \"\"\"\n        arg_4 = arg_0._template2ckattrlist(arg_1)\n        arg_5 = PyKCS11.LowLevel.CK_OBJECT_HANDLE()\n        arg_6 = arg_2.to_native()\n        arg_7 = arg_0.lib.C_GenerateKey(arg_0.session, arg_6, arg_4, arg_5)\n        if arg_7 != CKR_OK:\n            raise PyKCS11Error(arg_7)\n        return arg_5", "path": "PyKCS11/__init__.py", "identifier": "Session.generateKey", "docstring": "generate a secret key\n\n        :param template: template for the secret key\n        :param mecha: mechanism to use\n        :return: handle of the generated key\n        :rtype: PyKCS11.LowLevel.CK_OBJECT_HANDLE", "docstring_tokens": ["generate", "a", "secret", "key"], "nwo": "LudovicRousseau/PyKCS11", "score": 0.4240693100826277, "idx": 260364}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L256-L265", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Reimplemented to add an action for raw copy.", "language": "python", "parameters": "(self, pos)", "return_statement": "return menu", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "super", "(", "FrontendWidget", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", "for", "arg_3", "in", "arg_2", ".", "actions", "(", ")", ":", "if", "arg_3", ".", "shortcut", "(", ")", ".", "matches", "(", "QtGui", ".", "QKeySequence", ".", "Paste", ")", "==", "QtGui", ".", "QKeySequence", ".", "ExactMatch", ":", "arg_2", ".", "insertAction", "(", "arg_3", ",", "arg_0", ".", "_copy_raw_action", ")", "break", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Reimplemented to add an action for raw copy.\n        \"\"\"\n        arg_2 = super(FrontendWidget, arg_0).Func(arg_1)\n        for arg_3 in arg_2.actions():\n            if arg_3.shortcut().matches(QtGui.QKeySequence.Paste) == \\\n                    QtGui.QKeySequence.ExactMatch:\n                arg_2.insertAction(arg_3, arg_0._copy_raw_action)\n                break\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._context_menu_make", "docstring": "Reimplemented to add an action for raw copy.", "docstring_tokens": ["Reimplemented", "to", "add", "an", "action", "for", "raw", "copy", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260365}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1860-L1883", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Increments by 1.", "language": "python", "parameters": "(cpu, dest)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "read", "(", ")", "arg_3", "=", "arg_1", ".", "write", "(", "arg_2", "+", "1", ")", "arg_3", "&=", "(", "1", "<<", "arg_1", ".", "size", ")", "-", "1", "arg_4", "=", "1", "<<", "(", "arg_1", ".", "size", "-", "1", ")", "arg_0", ".", "AF", "=", "(", "(", "arg_2", "^", "1", ")", "^", "arg_3", ")", "&", "0x10", "!=", "0", "arg_0", ".", "ZF", "=", "arg_3", "==", "0", "arg_0", ".", "SF", "=", "(", "arg_3", "&", "arg_4", ")", "!=", "0", "arg_0", ".", "OF", "=", "arg_3", "==", "arg_4", "arg_0", ".", "PF", "=", "arg_0", ".", "_calculate_parity_flag", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Increments by 1.\n\n        Adds 1 to the destination operand, while preserving the state of the\n        CF flag. The destination operand can be a register or a memory location.\n        This instruction allows a loop counter to be updated without disturbing\n        the CF flag. (Use a ADD instruction with an immediate operand of 1 to\n        perform an increment operation that does updates the CF flag.)::\n\n                DEST  =  DEST +1;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        \"\"\"\n        arg_2 = arg_1.read()\n        arg_3 = arg_1.write(arg_2 + 1)\n        arg_3 &= (1 << arg_1.size) - 1\n        arg_4 = 1 << (arg_1.size - 1)\n        arg_0.AF = ((arg_2 ^ 1) ^ arg_3) & 0x10 != 0\n        arg_0.ZF = arg_3 == 0\n        arg_0.SF = (arg_3 & arg_4) != 0\n        arg_0.OF = arg_3 == arg_4\n        arg_0.PF = arg_0._calculate_parity_flag(arg_3)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.INC", "docstring": "Increments by 1.\n\n        Adds 1 to the destination operand, while preserving the state of the\n        CF flag. The destination operand can be a register or a memory location.\n        This instruction allows a loop counter to be updated without disturbing\n        the CF flag. (Use a ADD instruction with an immediate operand of 1 to\n        perform an increment operation that does updates the CF flag.)::\n\n                DEST  =  DEST +1;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.", "docstring_tokens": ["Increments", "by", "1", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260366}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L1279-L1389", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Create a new scalar data point.", "language": "python", "parameters": "(self, token, community_id, producer_display_name,\n                        metric_name, producer_revision, submit_time, value,\n                        **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "**", "arg_8", ")", ":", "arg_9", "=", "dict", "(", ")", "arg_9", "[", "'token'", "]", "=", "arg_1", "arg_9", "[", "'communityId'", "]", "=", "arg_2", "arg_9", "[", "'producerDisplayName'", "]", "=", "arg_3", "arg_9", "[", "'metricName'", "]", "=", "arg_4", "arg_9", "[", "'producerRevision'", "]", "=", "arg_5", "arg_9", "[", "'submitTime'", "]", "=", "arg_6", "arg_9", "[", "'value'", "]", "=", "arg_7", "arg_10", "=", "[", "'config_item_id'", ",", "'test_dataset_id'", ",", "'truth_dataset_id'", ",", "'silent'", ",", "'unofficial'", ",", "'build_results_url'", ",", "'branch'", ",", "'extra_urls'", ",", "'params'", ",", "'submission_id'", ",", "'submission_uuid'", ",", "'unit'", ",", "'reproduction_command'", "]", "for", "arg_11", "in", "arg_10", ":", "if", "arg_11", "in", "arg_8", ":", "if", "arg_11", "==", "'config_item_id'", ":", "arg_9", "[", "'configItemId'", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'test_dataset_id'", ":", "arg_9", "[", "'testDatasetId'", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'truth_dataset_id'", ":", "arg_9", "[", "'truthDatasetId'", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'build_results_url'", ":", "arg_9", "[", "'buildResultsUrl'", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'extra_urls'", ":", "arg_9", "[", "'extraUrls'", "]", "=", "json", ".", "dumps", "(", "arg_8", "[", "arg_11", "]", ")", "elif", "arg_11", "==", "'params'", ":", "arg_9", "[", "arg_11", "]", "=", "json", ".", "dumps", "(", "arg_8", "[", "arg_11", "]", ")", "elif", "arg_11", "==", "'silent'", ":", "if", "arg_8", "[", "arg_11", "]", ":", "arg_9", "[", "arg_11", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'unofficial'", ":", "if", "arg_8", "[", "arg_11", "]", ":", "arg_9", "[", "arg_11", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'submission_id'", ":", "arg_9", "[", "'submissionId'", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'submission_uuid'", ":", "arg_9", "[", "'submissionUuid'", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'unit'", ":", "arg_9", "[", "'unit'", "]", "=", "arg_8", "[", "arg_11", "]", "elif", "arg_11", "==", "'reproduction_command'", ":", "arg_9", "[", "'reproductionCommand'", "]", "=", "arg_8", "[", "arg_11", "]", "else", ":", "arg_9", "[", "arg_11", "]", "=", "arg_8", "[", "arg_11", "]", "arg_12", "=", "arg_0", ".", "request", "(", "'midas.tracker.scalar.add'", ",", "arg_9", ")", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                        arg_4, arg_5, arg_6, arg_7,\n                        **arg_8):\n        \"\"\"\n        Create a new scalar data point.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param community_id: The id of the community that owns the producer.\n        :type community_id: int | long\n        :param producer_display_name: The display name of the producer.\n        :type producer_display_name: string\n        :param metric_name: The metric name that identifies which trend this\n            point belongs to.\n        :type metric_name: string\n        :param producer_revision: The repository revision of the producer that\n            produced this value.\n        :type producer_revision: int | long | string\n        :param submit_time: The submit timestamp. Must be parsable with PHP\n            strtotime().\n        :type submit_time: string\n        :param value: The value of the scalar.\n        :type value: float\n        :param config_item_id: (optional) If this value pertains to a specific\n            configuration item, pass its id here.\n        :type config_item_id: int | long\n        :param test_dataset_id: (optional) If this value pertains to a\n            specific test dataset, pass its id here.\n        :type test_dataset_id: int | long\n        :param truth_dataset_id: (optional) If this value pertains to a\n            specific ground truth dataset, pass its id here.\n        :type truth_dataset_id: int | long\n        :param silent: (optional) If true, do not perform threshold-based email\n            notifications for this scalar.\n        :type silent: bool\n        :param unofficial: (optional) If true, creates an unofficial scalar\n            visible only to the user performing the submission.\n        :type unofficial: bool\n        :param build_results_url: (optional) A URL for linking to build results\n            for this submission.\n        :type build_results_url: string\n        :param branch: (optional) The branch name in the source repository for\n            this submission.\n        :type branch: string\n        :param submission_id: (optional) The id of the submission.\n        :type submission_id: int | long\n        :param submission_uuid: (optional) The uuid of the submission. If one\n            does not exist, it will be created.\n        :type submission_uuid: string\n        :type branch: string\n        :param params: (optional) Any key/value pairs that should be displayed\n            with this scalar result.\n        :type params: dict\n        :param extra_urls: (optional) Other URL's that should be displayed with\n            with this scalar result. Each element of the list should be a dict\n            with the following keys: label, text, href\n        :type extra_urls: list[dict]\n        :param unit: (optional) The unit of the scalar value.\n        :type unit: string\n        :param reproduction_command: (optional) The command to reproduce this\n            scalar.\n        :type reproduction_command: string\n        :returns: The scalar object that was created.\n        :rtype: dict\n        \"\"\"\n        arg_9 = dict()\n        arg_9['token'] = arg_1\n        arg_9['communityId'] = arg_2\n        arg_9['producerDisplayName'] = arg_3\n        arg_9['metricName'] = arg_4\n        arg_9['producerRevision'] = arg_5\n        arg_9['submitTime'] = arg_6\n        arg_9['value'] = arg_7\n        arg_10 = [\n            'config_item_id', 'test_dataset_id', 'truth_dataset_id', 'silent',\n            'unofficial', 'build_results_url', 'branch', 'extra_urls',\n            'params', 'submission_id', 'submission_uuid', 'unit',\n            'reproduction_command'\n        ]\n        for arg_11 in arg_10:\n            if arg_11 in arg_8:\n                if arg_11 == 'config_item_id':\n                    arg_9['configItemId'] = arg_8[arg_11]\n                elif arg_11 == 'test_dataset_id':\n                    arg_9['testDatasetId'] = arg_8[arg_11]\n                elif arg_11 == 'truth_dataset_id':\n                    arg_9['truthDatasetId'] = arg_8[arg_11]\n                elif arg_11 == 'build_results_url':\n                    arg_9['buildResultsUrl'] = arg_8[arg_11]\n                elif arg_11 == 'extra_urls':\n                    arg_9['extraUrls'] = json.dumps(arg_8[arg_11])\n                elif arg_11 == 'params':\n                    arg_9[arg_11] = json.dumps(arg_8[arg_11])\n                elif arg_11 == 'silent':\n                    if arg_8[arg_11]:\n                        arg_9[arg_11] = arg_8[arg_11]\n                elif arg_11 == 'unofficial':\n                    if arg_8[arg_11]:\n                        arg_9[arg_11] = arg_8[arg_11]\n                elif arg_11 == 'submission_id':\n                    arg_9['submissionId'] = arg_8[arg_11]\n                elif arg_11 == 'submission_uuid':\n                    arg_9['submissionUuid'] = arg_8[arg_11]\n                elif arg_11 == 'unit':\n                    arg_9['unit'] = arg_8[arg_11]\n                elif arg_11 == 'reproduction_command':\n                    arg_9['reproductionCommand'] = arg_8[arg_11]\n                else:\n                    arg_9[arg_11] = arg_8[arg_11]\n        arg_12 = arg_0.request('midas.tracker.scalar.add', arg_9)\n        return arg_12", "path": "pydas/drivers.py", "identifier": "TrackerDriver.add_scalar_data", "docstring": "Create a new scalar data point.\n\n        :param token: A valid token for the user in question.\n        :type token: string\n        :param community_id: The id of the community that owns the producer.\n        :type community_id: int | long\n        :param producer_display_name: The display name of the producer.\n        :type producer_display_name: string\n        :param metric_name: The metric name that identifies which trend this\n            point belongs to.\n        :type metric_name: string\n        :param producer_revision: The repository revision of the producer that\n            produced this value.\n        :type producer_revision: int | long | string\n        :param submit_time: The submit timestamp. Must be parsable with PHP\n            strtotime().\n        :type submit_time: string\n        :param value: The value of the scalar.\n        :type value: float\n        :param config_item_id: (optional) If this value pertains to a specific\n            configuration item, pass its id here.\n        :type config_item_id: int | long\n        :param test_dataset_id: (optional) If this value pertains to a\n            specific test dataset, pass its id here.\n        :type test_dataset_id: int | long\n        :param truth_dataset_id: (optional) If this value pertains to a\n            specific ground truth dataset, pass its id here.\n        :type truth_dataset_id: int | long\n        :param silent: (optional) If true, do not perform threshold-based email\n            notifications for this scalar.\n        :type silent: bool\n        :param unofficial: (optional) If true, creates an unofficial scalar\n            visible only to the user performing the submission.\n        :type unofficial: bool\n        :param build_results_url: (optional) A URL for linking to build results\n            for this submission.\n        :type build_results_url: string\n        :param branch: (optional) The branch name in the source repository for\n            this submission.\n        :type branch: string\n        :param submission_id: (optional) The id of the submission.\n        :type submission_id: int | long\n        :param submission_uuid: (optional) The uuid of the submission. If one\n            does not exist, it will be created.\n        :type submission_uuid: string\n        :type branch: string\n        :param params: (optional) Any key/value pairs that should be displayed\n            with this scalar result.\n        :type params: dict\n        :param extra_urls: (optional) Other URL's that should be displayed with\n            with this scalar result. Each element of the list should be a dict\n            with the following keys: label, text, href\n        :type extra_urls: list[dict]\n        :param unit: (optional) The unit of the scalar value.\n        :type unit: string\n        :param reproduction_command: (optional) The command to reproduce this\n            scalar.\n        :type reproduction_command: string\n        :returns: The scalar object that was created.\n        :rtype: dict", "docstring_tokens": ["Create", "a", "new", "scalar", "data", "point", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 260367}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L542-L554", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets package version, if not already set.\n        version - Any string.\n        Raises CardinalityError if already has a version.\n        Raises OrderError if no package previously defined.", "language": "python", "parameters": "(self, doc, version)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "assert_package_exists", "(", ")", "if", "not", "arg_0", ".", "package_vers_set", ":", "arg_0", ".", "package_vers_set", "=", "True", "arg_1", ".", "package", ".", "version", "=", "arg_2", "return", "True", "else", ":", "raise", "CardinalityError", "(", "'Package::Version'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets package version, if not already set.\n        version - Any string.\n        Raises CardinalityError if already has a version.\n        Raises OrderError if no package previously defined.\n        \"\"\"\n        arg_0.assert_package_exists()\n        if not arg_0.package_vers_set:\n            arg_0.package_vers_set = True\n            arg_1.package.version = arg_2\n            return True\n        else:\n            raise CardinalityError('Package::Version')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "PackageBuilder.set_pkg_vers", "docstring": "Sets package version, if not already set.\n        version - Any string.\n        Raises CardinalityError if already has a version.\n        Raises OrderError if no package previously defined.", "docstring_tokens": ["Sets", "package", "version", "if", "not", "already", "set", ".", "version", "-", "Any", "string", ".", "Raises", "CardinalityError", "if", "already", "has", "a", "version", ".", "Raises", "OrderError", "if", "no", "package", "previously", "defined", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 260368}
{"url": "https://github.com/laplacesdemon/django-youtube/blob/8051ef372473eccb053f773c68e2e5e1b2cfb538/django_youtube/models.py#L95-L111", "sha": "8051ef372473eccb053f773c68e2e5e1b2cfb538", "docstring_summary": "Deletes the video from youtube", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return super(Video, self).delete(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "Api", "(", ")", "arg_3", ".", "authenticate", "(", ")", "arg_3", ".", "Func_video", "(", "arg_0", ".", "video_id", ")", "return", "super", "(", "Video", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Deletes the video from youtube\n\n        Raises:\n            OperationError\n        \"\"\"\n        arg_3 = Api()\n\n        # Authentication is required for deletion\n        arg_3.authenticate()\n\n        # Send API request, raises OperationError on unsuccessful deletion\n        arg_3.Func_video(arg_0.video_id)\n\n        # Call the super method\n        return super(Video, arg_0).Func(*arg_1, **arg_2)", "path": "django_youtube/models.py", "identifier": "Video.delete", "docstring": "Deletes the video from youtube\n\n        Raises:\n            OperationError", "docstring_tokens": ["Deletes", "the", "video", "from", "youtube"], "nwo": "laplacesdemon/django-youtube", "score": 0.19379564659824008, "idx": 260369}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L550-L573", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Parse the abstract from the TeX source.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "LatexCommand", "(", "'setDocAbstract'", ",", "{", "'name'", ":", "'abstract'", ",", "'required'", ":", "True", ",", "'bracket'", ":", "'{'", "}", ")", "try", ":", "arg_2", "=", "next", "(", "arg_1", ".", "parse", "(", "arg_0", ".", "_tex", ")", ")", "except", "StopIteration", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'lsstdoc has no abstract'", ")", "arg_0", ".", "_abstract", "=", "None", "return", "try", ":", "arg_4", "=", "arg_2", "[", "'abstract'", "]", "except", "KeyError", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'lsstdoc has no abstract'", ")", "arg_0", ".", "_abstract", "=", "None", "return", "arg_4", "=", "arg_4", ".", "strip", "(", ")", "arg_0", ".", "_abstract", "=", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"Parse the abstract from the TeX source.\n\n        Sets the ``_abstract`` attribute.\n        \"\"\"\n        arg_1 = LatexCommand(\n            'setDocAbstract',\n            {'name': 'abstract', 'required': True, 'bracket': '{'})\n        try:\n            arg_2 = next(arg_1.parse(arg_0._tex))\n        except StopIteration:\n            arg_0._logger.warning('lsstdoc has no abstract')\n            arg_0._abstract = None\n            return\n\n        try:\n            arg_4 = arg_2['abstract']\n        except KeyError:\n            arg_0._logger.warning('lsstdoc has no abstract')\n            arg_0._abstract = None\n            return\n\n        arg_4 = arg_4.strip()\n        arg_0._abstract = arg_4", "path": "lsstprojectmeta/tex/lsstdoc.py", "identifier": "LsstLatexDoc._parse_abstract", "docstring": "Parse the abstract from the TeX source.\n\n        Sets the ``_abstract`` attribute.", "docstring_tokens": ["Parse", "the", "abstract", "from", "the", "TeX", "source", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 260370}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/transforms/geometry.py#L24-L64", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Rotate an image.", "language": "python", "parameters": "(img,\n             angle,\n             center=None,\n             scale=1.0,\n             border_value=0,\n             auto_bound=False)", "return_statement": "return rotated", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "1.0", ",", "arg_4", "=", "0", ",", "arg_5", "=", "False", ")", ":", "if", "arg_2", "is", "not", "None", "and", "arg_5", ":", "raise", "ValueError", "(", "'`auto_bound` conflicts with `center`'", ")", "arg_6", ",", "arg_7", "=", "arg_0", ".", "shape", "[", ":", "2", "]", "if", "arg_2", "is", "None", ":", "arg_2", "=", "(", "(", "arg_7", "-", "1", ")", "*", "0.5", ",", "(", "arg_6", "-", "1", ")", "*", "0.5", ")", "assert", "isinstance", "(", "arg_2", ",", "tuple", ")", "arg_8", "=", "cv2", ".", "getRotationMatrix2D", "(", "arg_2", ",", "-", "arg_1", ",", "arg_3", ")", "if", "arg_5", ":", "arg_9", "=", "np", ".", "abs", "(", "arg_8", "[", "0", ",", "0", "]", ")", "arg_10", "=", "np", ".", "abs", "(", "arg_8", "[", "0", ",", "1", "]", ")", "arg_11", "=", "arg_6", "*", "arg_10", "+", "arg_7", "*", "arg_9", "arg_12", "=", "arg_6", "*", "arg_9", "+", "arg_7", "*", "arg_10", "arg_8", "[", "0", ",", "2", "]", "+=", "(", "arg_11", "-", "arg_7", ")", "*", "0.5", "arg_8", "[", "1", ",", "2", "]", "+=", "(", "arg_12", "-", "arg_6", ")", "*", "0.5", "arg_7", "=", "int", "(", "np", ".", "round", "(", "arg_11", ")", ")", "arg_6", "=", "int", "(", "np", ".", "round", "(", "arg_12", ")", ")", "arg_13", "=", "cv2", ".", "warpAffine", "(", "arg_0", ",", "arg_8", ",", "(", "arg_7", ",", "arg_6", ")", ",", "borderValue", "=", "arg_4", ")", "return", "arg_13"], "function": "def Func(arg_0,\n             arg_1,\n             arg_2=None,\n             arg_3=1.0,\n             arg_4=0,\n             arg_5=False):\n    \"\"\"Rotate an image.\n\n    Args:\n        img (ndarray): Image to be rotated.\n        angle (float): Rotation angle in degrees, positive values mean\n            clockwise rotation.\n        center (tuple): Center of the rotation in the source image, by default\n            it is the center of the image.\n        scale (float): Isotropic scale factor.\n        border_value (int): Border value.\n        auto_bound (bool): Whether to adjust the image size to cover the whole\n            rotated image.\n\n    Returns:\n        ndarray: The rotated image.\n    \"\"\"\n    if arg_2 is not None and arg_5:\n        raise ValueError('`auto_bound` conflicts with `center`')\n    arg_6, arg_7 = arg_0.shape[:2]\n    if arg_2 is None:\n        arg_2 = ((arg_7 - 1) * 0.5, (arg_6 - 1) * 0.5)\n    assert isinstance(arg_2, tuple)\n\n    arg_8 = cv2.getRotationMatrix2D(arg_2, -arg_1, arg_3)\n    if arg_5:\n        arg_9 = np.abs(arg_8[0, 0])\n        arg_10 = np.abs(arg_8[0, 1])\n        arg_11 = arg_6 * arg_10 + arg_7 * arg_9\n        arg_12 = arg_6 * arg_9 + arg_7 * arg_10\n        arg_8[0, 2] += (arg_11 - arg_7) * 0.5\n        arg_8[1, 2] += (arg_12 - arg_6) * 0.5\n        arg_7 = int(np.round(arg_11))\n        arg_6 = int(np.round(arg_12))\n    arg_13 = cv2.warpAffine(arg_0, arg_8, (arg_7, arg_6), borderValue=arg_4)\n    return arg_13", "path": "mmcv/image/transforms/geometry.py", "identifier": "imrotate", "docstring": "Rotate an image.\n\n    Args:\n        img (ndarray): Image to be rotated.\n        angle (float): Rotation angle in degrees, positive values mean\n            clockwise rotation.\n        center (tuple): Center of the rotation in the source image, by default\n            it is the center of the image.\n        scale (float): Isotropic scale factor.\n        border_value (int): Border value.\n        auto_bound (bool): Whether to adjust the image size to cover the whole\n            rotated image.\n\n    Returns:\n        ndarray: The rotated image.", "docstring_tokens": ["Rotate", "an", "image", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260371}
{"url": "https://github.com/suryakencana007/baka_model/blob/915c2da9920e973302f5764ae63799acd5ecf0b7/baka_model/model/pubid.py#L36-L45", "sha": "915c2da9920e973302f5764ae63799acd5ecf0b7", "docstring_summary": "Generate a random string of the specified length.", "language": "python", "parameters": "(length=DEFAULT_LENGTH)", "return_statement": "return ''.join(random.SystemRandom().choice(ALPHABET)\n                   for _ in range(length))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ")", ":", "return", "''", ".", "join", "(", "random", ".", "SystemRandom", "(", ")", ".", "choice", "(", "ALPHABET", ")", "for", "arg_2", "in", "range", "(", "arg_0", ")", ")"], "function": "def Func(arg_0=arg_1):\n    \"\"\"\n    Generate a random string of the specified length.\n\n    The returned string is composed of an alphabet that shouldn't include any\n    characters that are easily mistakeable for one another (I, 1, O, 0), and\n    hopefully won't accidentally contain any English-language curse words.\n    \"\"\"\n    return ''.join(random.SystemRandom().choice(ALPHABET)\n                   for arg_2 in range(arg_0))", "path": "baka_model/model/pubid.py", "identifier": "generate", "docstring": "Generate a random string of the specified length.\n\n    The returned string is composed of an alphabet that shouldn't include any\n    characters that are easily mistakeable for one another (I, 1, O, 0), and\n    hopefully won't accidentally contain any English-language curse words.", "docstring_tokens": ["Generate", "a", "random", "string", "of", "the", "specified", "length", "."], "nwo": "suryakencana007/baka_model", "score": 0.0, "idx": 260372}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/pylabtools.py#L209-L233", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Activate the given backend and set interactive to True.", "language": "python", "parameters": "(backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "arg_1", "if", "arg_0", ".", "startswith", "(", "'module://'", ")", ":", "arg_1", ".", "rcParams", "[", "'backend'", "]", "=", "arg_0", "else", ":", "arg_1", ".", "use", "(", "arg_0", ")", "arg_1", ".", "interactive", "(", "True", ")", "import", "arg_1", ".", "pylab", "as", "arg_3", "arg_3", ".", "show", ".", "_needmain", "=", "False", "arg_3", ".", "draw_if_interactive", "=", "flag_calls", "(", "arg_3", ".", "draw_if_interactive", ")"], "function": "def Func(arg_0):\n    \"\"\"Activate the given backend and set interactive to True.\"\"\"\n\n    import arg_1\n    if arg_0.startswith('module://'):\n        # Work around bug in matplotlib: matplotlib.use converts the\n        # backend_id to lowercase even if a module name is specified!\n        arg_1.rcParams['backend'] = arg_0\n    else:\n        arg_1.use(arg_0)\n    arg_1.interactive(True)\n\n    # This must be imported last in the matplotlib series, after\n    # backend/interactivity choices have been made\n    import arg_1.pylab as arg_3\n\n    # XXX For now leave this commented out, but depending on discussions with\n    # mpl-dev, we may be able to allow interactive switching...\n    #import matplotlib.pyplot\n    #matplotlib.pyplot.switch_backend(backend)\n\n    arg_3.show._needmain = False\n    # We need to detect at runtime whether show() is called by the user.\n    # For this, we wrap it into a decorator which adds a 'called' flag.\n    arg_3.draw_if_interactive = flag_calls(arg_3.draw_if_interactive)", "path": "environment/lib/python2.7/site-packages/IPython/core/pylabtools.py", "identifier": "activate_matplotlib", "docstring": "Activate the given backend and set interactive to True.", "docstring_tokens": ["Activate", "the", "given", "backend", "and", "set", "interactive", "to", "True", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260373}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L93-L118", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Construct dict of paths from environment variables", "language": "python", "parameters": "(prefix=None, names=None)", "return_statement": "return conf", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "def", "expand_path", "(", "arg_2", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "os", ".", "path", ".", "expandvars", "(", "arg_2", ")", ")", ")", "if", "arg_0", "is", "None", ":", "arg_0", "=", "\"CIJ\"", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "\"ROOT\"", ",", "\"ENVS\"", ",", "\"TESTPLANS\"", ",", "\"TESTCASES\"", ",", "\"TESTSUITES\"", ",", "\"MODULES\"", ",", "\"HOOKS\"", ",", "\"TEMPLATES\"", "]", "arg_3", "=", "{", "v", ":", "os", ".", "environ", ".", "get", "(", "\"_\"", ".", "join", "(", "[", "arg_0", ",", "v", "]", ")", ")", "for", "v", "in", "arg_1", "}", "for", "arg_4", "in", "(", "e", "for", "e", "in", "arg_3", ".", "keys", "(", ")", "if", "e", "[", ":", "len", "(", "arg_0", ")", "]", "in", "arg_1", "and", "arg_3", "[", "e", "]", ")", ":", "arg_3", "[", "arg_4", "]", "=", "expand_path", "(", "arg_3", "[", "arg_4", "]", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_3", "[", "arg_4", "]", ")", ":", "err", "(", "\"%s_%s: %r, does not exist\"", "%", "(", "arg_0", ",", "arg_4", ",", "arg_3", "[", "arg_4", "]", ")", ")", "return", "arg_3"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"Construct dict of paths from environment variables'\"\"\"\n\n\n    def expand_path(arg_2):\n        \"\"\"Expands variables in 'path' and turns it into absolute path\"\"\"\n\n        return os.path.abspath(os.path.expanduser(os.path.expandvars(arg_2)))\n\n\n    if arg_0 is None:\n        arg_0 = \"CIJ\"\n    if arg_1 is None:\n        arg_1 = [\n            \"ROOT\", \"ENVS\", \"TESTPLANS\", \"TESTCASES\", \"TESTSUITES\", \"MODULES\",\n            \"HOOKS\", \"TEMPLATES\"\n        ]\n\n    arg_3 = {v: os.environ.get(\"_\".join([arg_0, v])) for v in arg_1}\n\n    for arg_4 in (e for e in arg_3.keys() if e[:len(arg_0)] in arg_1 and arg_3[e]):\n        arg_3[arg_4] = expand_path(arg_3[arg_4])\n        if not os.path.exists(arg_3[arg_4]):\n            err(\"%s_%s: %r, does not exist\" % (arg_0, arg_4, arg_3[arg_4]))\n\n    return arg_3", "path": "modules/cij/__init__.py", "identifier": "paths_from_env", "docstring": "Construct dict of paths from environment variables", "docstring_tokens": ["Construct", "dict", "of", "paths", "from", "environment", "variables"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 260374}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L254-L264", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Enqueue state.\n            Save state on storage, assigns an id to it, then add it to the\n            priority queue", "language": "python", "parameters": "(self, state)", "return_statement": "return state_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_workspace", ".", "save_state", "(", "arg_1", ")", "arg_0", ".", "put", "(", "arg_2", ")", "arg_0", ".", "_publish", "(", "'did_Func_state'", ",", "arg_2", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Enqueue state.\n            Save state on storage, assigns an id to it, then add it to the\n            priority queue\n        \"\"\"\n        # save the state to secondary storage\n        arg_2 = arg_0._workspace.save_state(arg_1)\n        arg_0.put(arg_2)\n        arg_0._publish('did_Func_state', arg_2, arg_1)\n        return arg_2", "path": "manticore/core/executor.py", "identifier": "Executor.enqueue", "docstring": "Enqueue state.\n            Save state on storage, assigns an id to it, then add it to the\n            priority queue", "docstring_tokens": ["Enqueue", "state", ".", "Save", "state", "on", "storage", "assigns", "an", "id", "to", "it", "then", "add", "it", "to", "the", "priority", "queue"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260375}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/newstyle.py#L58-L135", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check use of super", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "is_method", "(", ")", ":", "return", "arg_2", "=", "arg_1", ".", "parent", ".", "frame", "(", ")", "for", "arg_3", "in", "arg_1", ".", "nodes_of_class", "(", "astroid", ".", "Call", ")", ":", "if", "node_frame_class", "(", "arg_3", ")", "!=", "node_frame_class", "(", "arg_1", ")", ":", "continue", "arg_4", "=", "arg_3", ".", "func", "if", "not", "isinstance", "(", "arg_4", ",", "astroid", ".", "Attribute", ")", ":", "continue", "arg_5", "=", "arg_4", ".", "expr", "if", "not", "(", "isinstance", "(", "arg_5", ",", "astroid", ".", "Call", ")", "and", "isinstance", "(", "arg_5", ".", "func", ",", "astroid", ".", "Name", ")", "and", "arg_5", ".", "func", ".", "name", "==", "\"super\"", ")", ":", "continue", "if", "not", "arg_2", ".", "newstyle", "and", "has_known_bases", "(", "arg_2", ")", ":", "continue", "else", ":", "if", "not", "arg_5", ".", "args", ":", "if", "sys", ".", "version_info", "[", "0", "]", "==", "3", ":", "continue", "else", ":", "arg_0", ".", "add_message", "(", "\"missing-super-argument\"", ",", "arg_1", "=", "arg_5", ")", "continue", "arg_6", "=", "arg_5", ".", "args", "[", "0", "]", "if", "(", "isinstance", "(", "arg_6", ",", "astroid", ".", "Call", ")", "and", "isinstance", "(", "arg_6", ".", "func", ",", "astroid", ".", "Name", ")", "and", "arg_6", ".", "func", ".", "name", "==", "\"type\"", ")", ":", "arg_0", ".", "add_message", "(", "\"bad-super-call\"", ",", "arg_1", "=", "arg_5", ",", "args", "=", "(", "\"type\"", ",", ")", ")", "continue", "if", "(", "len", "(", "arg_5", ".", "args", ")", ">=", "2", "and", "isinstance", "(", "arg_5", ".", "args", "[", "1", "]", ",", "astroid", ".", "Name", ")", "and", "arg_5", ".", "args", "[", "1", "]", ".", "name", "==", "\"self\"", "and", "isinstance", "(", "arg_6", ",", "astroid", ".", "Attribute", ")", "and", "arg_6", ".", "attrname", "==", "\"__class__\"", ")", ":", "arg_0", ".", "add_message", "(", "\"bad-super-call\"", ",", "arg_1", "=", "arg_5", ",", "args", "=", "(", "\"self.__class__\"", ",", ")", ")", "continue", "try", ":", "arg_7", "=", "arg_5", ".", "args", "and", "next", "(", "arg_5", ".", "args", "[", "0", "]", ".", "infer", "(", ")", ",", "None", ")", "except", "astroid", ".", "InferenceError", ":", "continue", "if", "arg_2", "is", "not", "arg_7", ":", "arg_8", "=", "None", "if", "arg_7", ":", "arg_8", "=", "arg_7", ".", "name", "elif", "arg_5", ".", "args", "and", "hasattr", "(", "arg_5", ".", "args", "[", "0", "]", ",", "\"name\"", ")", ":", "arg_8", "=", "arg_5", ".", "args", "[", "0", "]", ".", "name", "if", "arg_8", ":", "arg_0", ".", "add_message", "(", "\"bad-super-call\"", ",", "arg_1", "=", "arg_5", ",", "args", "=", "(", "arg_8", ",", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"check use of super\"\"\"\n        # ignore actual functions or method within a new style class\n        if not arg_1.is_method():\n            return\n        arg_2 = arg_1.parent.frame()\n        for arg_3 in arg_1.nodes_of_class(astroid.Call):\n            if node_frame_class(arg_3) != node_frame_class(arg_1):\n                # Don't look down in other scopes.\n                continue\n\n            arg_4 = arg_3.func\n            if not isinstance(arg_4, astroid.Attribute):\n                continue\n\n            arg_5 = arg_4.expr\n            # skip the test if using super\n            if not (\n                isinstance(arg_5, astroid.Call)\n                and isinstance(arg_5.func, astroid.Name)\n                and arg_5.func.name == \"super\"\n            ):\n                continue\n\n            if not arg_2.newstyle and has_known_bases(arg_2):\n                # super should not be used on an old style class\n                continue\n            else:\n                # super first arg should be the class\n                if not arg_5.args:\n                    if sys.version_info[0] == 3:\n                        # unless Python 3\n                        continue\n                    else:\n                        arg_0.add_message(\"missing-super-argument\", arg_1=arg_5)\n                        continue\n\n                # calling super(type(self), self) can lead to recursion loop\n                # in derived classes\n                arg_6 = arg_5.args[0]\n                if (\n                    isinstance(arg_6, astroid.Call)\n                    and isinstance(arg_6.func, astroid.Name)\n                    and arg_6.func.name == \"type\"\n                ):\n                    arg_0.add_message(\"bad-super-call\", arg_1=arg_5, args=(\"type\",))\n                    continue\n\n                # calling super(self.__class__, self) can lead to recursion loop\n                # in derived classes\n                if (\n                    len(arg_5.args) >= 2\n                    and isinstance(arg_5.args[1], astroid.Name)\n                    and arg_5.args[1].name == \"self\"\n                    and isinstance(arg_6, astroid.Attribute)\n                    and arg_6.attrname == \"__class__\"\n                ):\n                    arg_0.add_message(\n                        \"bad-super-call\", arg_1=arg_5, args=(\"self.__class__\",)\n                    )\n                    continue\n\n                try:\n                    arg_7 = arg_5.args and next(arg_5.args[0].infer(), None)\n                except astroid.InferenceError:\n                    continue\n\n                if arg_2 is not arg_7:\n                    arg_8 = None\n                    # if supcls is not Uninferable, then supcls was infered\n                    # and use its name. Otherwise, try to look\n                    # for call.args[0].name\n                    if arg_7:\n                        arg_8 = arg_7.name\n                    elif arg_5.args and hasattr(arg_5.args[0], \"name\"):\n                        arg_8 = arg_5.args[0].name\n                    if arg_8:\n                        arg_0.add_message(\"bad-super-call\", arg_1=arg_5, args=(arg_8,))", "path": "pylint/checkers/newstyle.py", "identifier": "NewStyleConflictChecker.visit_functiondef", "docstring": "check use of super", "docstring_tokens": ["check", "use", "of", "super"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260376}
{"url": "https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L208-L213", "sha": "5a75cf88cf794937711b6850ff2acb07fe005f08", "docstring_summary": "Move this object to the bottom of the ordered stack.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_ordering_queryset", "(", ")", ".", "aggregate", "(", "Max", "(", "'order'", ")", ")", ".", "get", "(", "'order__max'", ")", "arg_0", ".", "to", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Move this object to the Func of the ordered stack.\n        \"\"\"\n        arg_1 = arg_0.get_ordering_queryset().aggregate(Max('order')).get('order__max')\n        arg_0.to(arg_1)", "path": "publications/models/orderedmodel.py", "identifier": "OrderedModel.bottom", "docstring": "Move this object to the bottom of the ordered stack.", "docstring_tokens": ["Move", "this", "object", "to", "the", "bottom", "of", "the", "ordered", "stack", "."], "nwo": "lucastheis/django-publications", "score": 0.41971037138316925, "idx": 260377}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L1470-L1510", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Retrieve a key from the stash", "language": "python", "parameters": "(key_name,\n            value_name,\n            jsonify,\n            no_decrypt,\n            stash,\n            passphrase,\n            backend)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "if", "arg_1", "and", "arg_3", ":", "sys", ".", "exit", "(", "'VALUE_NAME cannot be used in conjuction with --no-decrypt'", ")", "arg_4", "=", "_get_stash", "(", "arg_6", ",", "arg_4", ",", "arg_5", ",", "quiet", "=", "arg_2", "or", "arg_1", ")", "try", ":", "arg_7", "=", "arg_4", ".", "get", "(", "arg_0", "=", "arg_0", ",", "decrypt", "=", "not", "arg_3", ")", "except", "GhostError", "as", "ex", ":", "sys", ".", "exit", "(", "ex", ")", "if", "not", "arg_7", ":", "sys", ".", "exit", "(", "'Key `{0}` not found'", ".", "format", "(", "arg_0", ")", ")", "if", "arg_1", ":", "arg_7", "=", "arg_7", "[", "'value'", "]", ".", "get", "(", "arg_1", ")", "if", "not", "arg_7", ":", "sys", ".", "exit", "(", "'Value name `{0}` could not be found under key `{1}`'", ".", "format", "(", "arg_1", ",", "arg_0", ")", ")", "if", "arg_2", "or", "arg_1", ":", "click", ".", "echo", "(", "json", ".", "dumps", "(", "arg_7", ",", "indent", "=", "4", ",", "sort_keys", "=", "False", ")", ".", "strip", "(", "'\"'", ")", ",", "nl", "=", "True", ")", "else", ":", "click", ".", "echo", "(", "'Retrieving key...'", ")", "click", ".", "echo", "(", "'\\n'", "+", "_prettify_dict", "(", "arg_7", ")", ")"], "function": "def Func(arg_0,\n            arg_1,\n            arg_2,\n            arg_3,\n            arg_4,\n            arg_5,\n            arg_6):\n    \"\"\"Retrieve a key from the stash\n\n    \\b\n    `KEY_NAME` is the name of the key to retrieve\n    `VALUE_NAME` is a single value to retrieve e.g. if the value\n     of the key `test` is `a=b,b=c`, `ghost get test a`a will return\n     `b`\n    \"\"\"\n    if arg_1 and arg_3:\n        sys.exit('VALUE_NAME cannot be used in conjuction with --no-decrypt')\n\n    arg_4 = _get_stash(arg_6, arg_4, arg_5, quiet=arg_2 or arg_1)\n\n    try:\n        arg_7 = arg_4.get(arg_0=arg_0, decrypt=not arg_3)\n    except GhostError as ex:\n        sys.exit(ex)\n\n    if not arg_7:\n        sys.exit('Key `{0}` not found'.format(arg_0))\n    if arg_1:\n        arg_7 = arg_7['value'].get(arg_1)\n        if not arg_7:\n            sys.exit(\n                'Value name `{0}` could not be found under key `{1}`'.format(\n                    arg_1, arg_0))\n\n    if arg_2 or arg_1:\n        click.echo(\n            json.dumps(arg_7, indent=4, sort_keys=False).strip('\"'),\n            nl=True)\n    else:\n        click.echo('Retrieving key...')\n        click.echo('\\n' + _prettify_dict(arg_7))", "path": "ghost.py", "identifier": "get_key", "docstring": "Retrieve a key from the stash\n\n    \\b\n    `KEY_NAME` is the name of the key to retrieve\n    `VALUE_NAME` is a single value to retrieve e.g. if the value\n     of the key `test` is `a=b,b=c`, `ghost get test a`a will return\n     `b`", "docstring_tokens": ["Retrieve", "a", "key", "from", "the", "stash"], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 260378}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/bot.py#L199-L203", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Creates an instance of a class defined in this document.\n           This method sets the context of the object to the current context.", "language": "python", "parameters": "(self, clazz, args, kwargs)", "return_statement": "return inst", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", "(", "arg_0", ",", "*", "arg_2", ",", "**", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''Creates an instance of a class defined in this document.\n           This method sets the context of the object to the current context.'''\n        arg_4 = arg_1(arg_0, *arg_2, **arg_3)\n        return arg_4", "path": "shoebot/grammar/bot.py", "identifier": "Bot._makeInstance", "docstring": "Creates an instance of a class defined in this document.\n           This method sets the context of the object to the current context.", "docstring_tokens": ["Creates", "an", "instance", "of", "a", "class", "defined", "in", "this", "document", ".", "This", "method", "sets", "the", "context", "of", "the", "object", "to", "the", "current", "context", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260379}
{"url": "https://github.com/ros-infrastructure/ros_buildfarm/blob/c63ad85b21470f3262086fcd987528a0efc0cf6d/ros_buildfarm/common.py#L469-L507", "sha": "c63ad85b21470f3262086fcd987528a0efc0cf6d", "docstring_summary": "Order packages topologically.", "language": "python", "parameters": "(packages)", "return_statement": "return ordered_pkg_tuples", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "catkin_pkg", ".", "topological_order", "import", "_PackageDecorator", "from", "catkin_pkg", ".", "topological_order", "import", "_sort_decorated_packages", "arg_1", "=", "{", "}", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "items", "(", ")", ":", "arg_1", "[", "arg_3", ".", "name", "]", "=", "_PackageDecorator", "(", "arg_3", ",", "arg_2", ")", "for", "arg_5", "in", "arg_1", ".", "values", "(", ")", ":", "arg_5", ".", "depends_for_topological_order", "=", "set", "(", "[", "]", ")", "arg_7", "=", "arg_5", ".", "package", ".", "build_depends", "+", "arg_5", ".", "package", ".", "buildtool_depends", "+", "arg_5", ".", "package", ".", "run_depends", "+", "arg_5", ".", "package", ".", "test_depends", "arg_8", "=", "set", "(", "[", "d", ".", "name", "for", "d", "in", "arg_7", "if", "d", ".", "name", "in", "arg_1", ".", "keys", "(", ")", "]", ")", "for", "arg_4", "in", "arg_8", ":", "if", "arg_4", "in", "arg_5", ".", "depends_for_topological_order", ":", "continue", "arg_1", "[", "arg_4", "]", ".", "_add_recursive_run_depends", "(", "arg_1", ",", "arg_5", ".", "depends_for_topological_order", ")", "arg_9", "=", "_sort_decorated_packages", "(", "arg_1", ")", "for", "arg_10", ",", "arg_11", "in", "arg_9", ":", "if", "arg_10", "is", "None", ":", "raise", "RuntimeError", "(", "'Circular dependency in: %s'", "%", "arg_11", ")", "return", "arg_9"], "function": "def Func(arg_0):\n    \"\"\"\n    Order packages topologically.\n\n    First returning packages which have message generators and then\n    the rest based on all direct depends and indirect recursive run_depends.\n\n    :param packages: A dict mapping relative paths to ``Package`` objects ``dict``\n    :returns: A list of tuples containing the relative path and a ``Package`` object, ``list``\n    \"\"\"\n    from catkin_pkg.topological_order import _PackageDecorator\n    from catkin_pkg.topological_order import _sort_decorated_packages\n\n    arg_1 = {}\n    for arg_2, arg_3 in arg_0.items():\n        arg_1[arg_3.name] = _PackageDecorator(arg_3, arg_2)\n\n    # calculate transitive dependencies\n    for arg_5 in arg_1.values():\n        arg_5.depends_for_topological_order = set([])\n        arg_7 = \\\n            arg_5.package.build_depends + arg_5.package.buildtool_depends + \\\n            arg_5.package.run_depends + arg_5.package.test_depends\n        # skip external dependencies, meaning names that are not known packages\n        arg_8 = set([\n            d.name for d in arg_7 if d.name in arg_1.keys()])\n        for arg_4 in arg_8:\n            if arg_4 in arg_5.depends_for_topological_order:\n                # avoid function call to improve performance\n                # check within the loop since the set changes every cycle\n                continue\n            arg_1[arg_4]._add_recursive_run_depends(\n                arg_1, arg_5.depends_for_topological_order)\n\n    arg_9 = _sort_decorated_packages(arg_1)\n    for arg_10, arg_11 in arg_9:\n        if arg_10 is None:\n            raise RuntimeError('Circular dependency in: %s' % arg_11)\n    return arg_9", "path": "ros_buildfarm/common.py", "identifier": "topological_order_packages", "docstring": "Order packages topologically.\n\n    First returning packages which have message generators and then\n    the rest based on all direct depends and indirect recursive run_depends.\n\n    :param packages: A dict mapping relative paths to ``Package`` objects ``dict``\n    :returns: A list of tuples containing the relative path and a ``Package`` object, ``list``", "docstring_tokens": ["Order", "packages", "topologically", "."], "nwo": "ros-infrastructure/ros_buildfarm", "score": 0.5592967619494252, "idx": 260380}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/samples/virtual_dav_provider.py#L311-L321", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Change semantic of DELETE to remove resource tags.", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "\"/by_tag/\"", "not", "in", "arg_0", ".", "path", ":", "raise", "DAVError", "(", "HTTP_FORBIDDEN", ")", "arg_1", ",", "arg_2", ",", "arg_3", "=", "util", ".", "save_split", "(", "arg_0", ".", "path", ".", "strip", "(", "\"/\"", ")", ",", "\"/\"", ",", "2", ")", "assert", "arg_1", "==", "\"by_tag\"", "assert", "arg_2", "in", "arg_0", ".", "data", "[", "\"tags\"", "]", "arg_0", ".", "data", "[", "\"tags\"", "]", ".", "remove", "(", "arg_2", ")", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"Change semantic of DELETE to remove resource tags.\"\"\"\n        # DELETE is only supported for the '/by_tag/' collection\n        if \"/by_tag/\" not in arg_0.path:\n            raise DAVError(HTTP_FORBIDDEN)\n        # path must be '/by_tag/<tag>/<resname>'\n        arg_1, arg_2, arg_3 = util.save_split(arg_0.path.strip(\"/\"), \"/\", 2)\n        assert arg_1 == \"by_tag\"\n        assert arg_2 in arg_0.data[\"tags\"]\n        arg_0.data[\"tags\"].remove(arg_2)\n        return True", "path": "wsgidav/samples/virtual_dav_provider.py", "identifier": "VirtualResource.handle_delete", "docstring": "Change semantic of DELETE to remove resource tags.", "docstring_tokens": ["Change", "semantic", "of", "DELETE", "to", "remove", "resource", "tags", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 260381}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L227-L244", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Prepare C3 JSON string dump for a time series.", "language": "python", "parameters": "(data: List[Tuple[int, int]], y_axis_label: str = 'y', x_axis_label: str = 'x')", "return_statement": "return json.dumps([\n        [x_axis_label] + list(years),\n        [y_axis_label] + list(counter)\n    ])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "arg_2", "[", "arg_3", ",", "arg_3", "]", "]", ",", "arg_4", ":", "arg_5", "=", "'y'", ",", "arg_6", ":", "arg_5", "=", "'x'", ")", "->", "arg_5", ":", "arg_7", ",", "arg_8", "=", "zip", "(", "*", "arg_0", ")", "arg_7", "=", "[", "datetime", ".", "date", "(", "year", ",", "1", ",", "1", ")", ".", "isoformat", "(", ")", "for", "year", "in", "arg_7", "]", "return", "json", ".", "dumps", "(", "[", "[", "arg_6", "]", "+", "list", "(", "arg_7", ")", ",", "[", "arg_4", "]", "+", "list", "(", "arg_8", ")", "]", ")"], "function": "def Func(arg_0: arg_1[arg_2[arg_3, arg_3]], arg_4: arg_5 = 'y', arg_6: arg_5 = 'x') -> arg_5:\n    \"\"\"Prepare C3 JSON string dump for a time series.\n\n    :param data: A list of tuples [(year, count)]\n    :param y_axis_label: The Y axis label\n    :param x_axis_label: X axis internal label. Should be left as default 'x')\n    \"\"\"\n    arg_7, arg_8 = zip(*arg_0)\n\n    arg_7 = [\n        datetime.date(year, 1, 1).isoformat()\n        for year in arg_7\n    ]\n\n    return json.dumps([\n        [arg_6] + list(arg_7),\n        [arg_4] + list(arg_8)\n    ])", "path": "src/pybel_tools/utils.py", "identifier": "prepare_c3_time_series", "docstring": "Prepare C3 JSON string dump for a time series.\n\n    :param data: A list of tuples [(year, count)]\n    :param y_axis_label: The Y axis label\n    :param x_axis_label: X axis internal label. Should be left as default 'x')", "docstring_tokens": ["Prepare", "C3", "JSON", "string", "dump", "for", "a", "time", "series", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260382}
{"url": "https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/stats.py#L393-L413", "sha": "f546ad171750cd7685afbde6785fe71f82cadb35", "docstring_summary": "Create artificial cutoff sample points from given range of cutoff\n    values in df, number of sample points is 'num_cut_offs'", "language": "python", "parameters": "(df, num_cut_offs=51)", "return_statement": "return sampled_df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "51", ")", ":", "arg_2", "=", "arg_0", ".", "cutoff", ".", "values", "arg_3", "=", "min", "(", "arg_2", ")", "arg_4", "=", "max", "(", "arg_2", ")", "arg_5", "=", "(", "arg_4", "-", "arg_3", ")", "*", "0.05", "arg_6", "=", "np", ".", "linspace", "(", "arg_3", "-", "arg_5", ",", "arg_4", "+", "arg_5", ",", "arg_1", ",", "dtype", "=", "np", ".", "float32", ")", "arg_7", "=", "find_nearest_matches", "(", "np", ".", "float32", "(", "arg_0", ".", "cutoff", ".", "values", ")", ",", "arg_6", ")", "arg_8", "=", "arg_0", ".", "iloc", "[", "arg_7", "]", ".", "copy", "(", ")", "arg_8", ".", "cutoff", "=", "arg_6", "arg_8", ".", "reset_index", "(", "inplace", "=", "True", ",", "drop", "=", "True", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1=51):\n    \"\"\" Create artificial cutoff sample points from given range of cutoff\n    values in df, number of sample points is 'num_cut_offs' \"\"\"\n\n    arg_2 = arg_0.cutoff.values\n    arg_3 = min(arg_2)\n    arg_4 = max(arg_2)\n    # extend max_ and min_ by 5 % of full range\n    arg_5 = (arg_4 - arg_3) * 0.05\n    arg_6 = np.linspace(arg_3 - arg_5, arg_4 + arg_5, arg_1, dtype=np.float32)\n\n    # find best matching row index for each sampled cut off:\n    arg_7 = find_nearest_matches(np.float32(arg_0.cutoff.values), arg_6)\n\n    # create sub dataframe:\n    arg_8 = arg_0.iloc[arg_7].copy()\n    arg_8.cutoff = arg_6\n    # remove 'old' index from input df:\n    arg_8.reset_index(inplace=True, drop=True)\n\n    return arg_8", "path": "pyprophet/stats.py", "identifier": "final_err_table", "docstring": "Create artificial cutoff sample points from given range of cutoff\n    values in df, number of sample points is 'num_cut_offs'", "docstring_tokens": ["Create", "artificial", "cutoff", "sample", "points", "from", "given", "range", "of", "cutoff", "values", "in", "df", "number", "of", "sample", "points", "is", "num_cut_offs"], "nwo": "PyProphet/pyprophet", "score": 0.38514621847307956, "idx": 260383}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/transmitters/content_metadata.py#L116-L133", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Transmit content metadata creation to integrated channel.", "language": "python", "parameters": "(self, channel_metadata_item_map)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "chunks", "(", "arg_1", ",", "arg_0", ".", "enterprise_configuration", ".", "transmission_chunk_size", ")", ":", "arg_3", "=", "arg_0", ".", "_serialize_items", "(", "list", "(", "arg_2", ".", "values", "(", ")", ")", ")", "try", ":", "arg_0", ".", "client", ".", "create_content_metadata", "(", "arg_3", ")", "except", "ClientError", "as", "exc", ":", "LOGGER", ".", "error", "(", "'Failed to update [%s] content metadata items for integrated channel [%s] [%s]'", ",", "len", "(", "arg_2", ")", ",", "arg_0", ".", "enterprise_configuration", ".", "enterprise_customer", ".", "name", ",", "arg_0", ".", "enterprise_configuration", ".", "channel_code", ",", ")", "LOGGER", ".", "error", "(", "exc", ")", "else", ":", "arg_0", ".", "_create_transmissions", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Transmit content metadata creation to integrated channel.\n        \"\"\"\n        for arg_2 in chunks(arg_1, arg_0.enterprise_configuration.transmission_chunk_size):\n            arg_3 = arg_0._serialize_items(list(arg_2.values()))\n            try:\n                arg_0.client.create_content_metadata(arg_3)\n            except ClientError as exc:\n                LOGGER.error(\n                    'Failed to update [%s] content metadata items for integrated channel [%s] [%s]',\n                    len(arg_2),\n                    arg_0.enterprise_configuration.enterprise_customer.name,\n                    arg_0.enterprise_configuration.channel_code,\n                )\n                LOGGER.error(exc)\n            else:\n                arg_0._create_transmissions(arg_2)", "path": "integrated_channels/integrated_channel/transmitters/content_metadata.py", "identifier": "ContentMetadataTransmitter._transmit_create", "docstring": "Transmit content metadata creation to integrated channel.", "docstring_tokens": ["Transmit", "content", "metadata", "creation", "to", "integrated", "channel", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260384}
{"url": "https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/collection/funcs.py#L48-L53", "sha": "1c821a120ebbbbc3c5761f5f1e8a73588059242a", "docstring_summary": "insert func with given arguments and keywords.", "language": "python", "parameters": "(self, index, func, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "partial", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "arg_0", ".", "insert", "(", "arg_1", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        '''\n        insert func with given arguments and keywords.\n        '''\n        arg_5 = partial(arg_2, *arg_3, **arg_4)\n        arg_0.insert(arg_1, arg_5)", "path": "jasily/collection/funcs.py", "identifier": "CallableList.insert_func", "docstring": "insert func with given arguments and keywords.", "docstring_tokens": ["insert", "func", "with", "given", "arguments", "and", "keywords", "."], "nwo": "Jasily/jasily-python", "score": 0.0, "idx": 260385}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L48-L58", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "load_targets will load the services with smb signing disabled and if ldap is enabled the services with the ldap port open.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "if", "arg_0", ".", "ldap", ":", "arg_1", "=", "arg_0", ".", "search", ".", "get_services", "(", "ports", "=", "[", "389", "]", ",", "up", "=", "True", ")", "arg_0", ".", "ldap_strings", "=", "[", "\"ldap://{}\"", ".", "format", "(", "service", ".", "address", ")", "for", "service", "in", "arg_1", "]", "arg_0", ".", "services", "=", "arg_0", ".", "search", ".", "get_services", "(", "tags", "=", "[", "'smb_signing_disabled'", "]", ")", "arg_0", ".", "ips", "=", "[", "str", "(", "service", ".", "address", ")", "for", "service", "in", "arg_0", ".", "services", "]"], "function": "def Func(arg_0):\n        \"\"\"\n            Func will load the services with smb signing disabled and if ldap is enabled the services with the ldap port open.\n        \"\"\"\n        arg_1 = []\n        if arg_0.ldap:\n            arg_1 = arg_0.search.get_services(ports=[389], up=True)\n\n        arg_0.ldap_strings = [\"ldap://{}\".format(service.address) for service in arg_1]\n        arg_0.services = arg_0.search.get_services(tags=['smb_signing_disabled'])\n        arg_0.ips = [str(service.address) for service in arg_0.services]", "path": "jackal/scripts/relaying.py", "identifier": "Spoofing.load_targets", "docstring": "load_targets will load the services with smb signing disabled and if ldap is enabled the services with the ldap port open.", "docstring_tokens": ["load_targets", "will", "load", "the", "services", "with", "smb", "signing", "disabled", "and", "if", "ldap", "is", "enabled", "the", "services", "with", "the", "ldap", "port", "open", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 260386}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/error_summary.py#L46-L52", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get all namespaces that are used in the BEL graph aren't actually defined.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "return {\n        exc.namespace\n        for _, exc, _ in graph.warnings\n        if isinstance(exc, UndefinedNamespaceWarning)\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Set", "[", "str", "]", ":", "return", "{", "arg_3", ".", "namespace", "for", "arg_2", ",", "arg_3", ",", "arg_2", "in", "arg_0", ".", "warnings", "if", "isinstance", "(", "arg_3", ",", "UndefinedNamespaceWarning", ")", "}"], "function": "def Func(arg_0: arg_1) -> Set[str]:\n    \"\"\"Get all namespaces that are used in the BEL graph aren't actually defined.\"\"\"\n    return {\n        arg_3.namespace\n        for arg_2, arg_3, arg_2 in arg_0.warnings\n        if isinstance(arg_3, UndefinedNamespaceWarning)\n    }", "path": "src/pybel_tools/summary/error_summary.py", "identifier": "get_undefined_namespaces", "docstring": "Get all namespaces that are used in the BEL graph aren't actually defined.", "docstring_tokens": ["Get", "all", "namespaces", "that", "are", "used", "in", "the", "BEL", "graph", "aren", "t", "actually", "defined", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260387}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_psbsd.py#L202-L205", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return real, effective and saved user ids.", "language": "python", "parameters": "(self)", "return_statement": "return nt_uids(real, effective, saved)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", "=", "_psutil_bsd", ".", "Func", "(", "arg_0", ".", "pid", ")", "return", "nt_uids", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"Return real, effective and saved user ids.\"\"\"\n        arg_1, arg_2, arg_3 = _psutil_bsd.Func(arg_0.pid)\n        return nt_uids(arg_1, arg_2, arg_3)", "path": "environment/lib/python2.7/site-packages/psutil/_psbsd.py", "identifier": "Process.get_process_uids", "docstring": "Return real, effective and saved user ids.", "docstring_tokens": ["Return", "real", "effective", "and", "saved", "user", "ids", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260388}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/fields.py#L223-L229", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Prepare field for serialization.", "language": "python", "parameters": "(self, obj)", "return_statement": "return self.get_prep_value(value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "DJANGO_VERSION", ">", "(", "1", ",", "9", ")", ":", "arg_2", "=", "arg_0", ".", "value_from_object", "(", "arg_1", ")", "else", ":", "arg_2", "=", "arg_0", ".", "_get_val_from_obj", "(", "arg_1", ")", "return", "arg_0", ".", "get_prep_value", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Prepare field for serialization.\"\"\"\n        if DJANGO_VERSION > (1, 9):\n            arg_2 = arg_0.value_from_object(arg_1)\n        else:\n            arg_2 = arg_0._get_val_from_obj(arg_1)\n        return arg_0.get_prep_value(arg_2)", "path": "versatileimagefield/fields.py", "identifier": "PPOIField.value_to_string", "docstring": "Prepare field for serialization.", "docstring_tokens": ["Prepare", "field", "for", "serialization", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 260389}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L660-L670", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Return True, if childUri is a child of parentUri or maps to the same resource.", "language": "python", "parameters": "(parentUri, childUri)", "return_statement": "return (\n        parentUri\n        and childUri\n        and (childUri.rstrip(\"/\") + \"/\").startswith(parentUri.rstrip(\"/\") + \"/\")\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "(", "arg_0", "and", "arg_1", "and", "(", "arg_1", ".", "rstrip", "(", "\"/\"", ")", "+", "\"/\"", ")", ".", "startswith", "(", "arg_0", ".", "rstrip", "(", "\"/\"", ")", "+", "\"/\"", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return True, if childUri is a child of parentUri or maps to the same resource.\n\n    Similar to <util.is_child_uri>_ ,  but this method also returns True, if parent\n    equals child. ('/a/b' is considered identical with '/a/b/').\n    \"\"\"\n    return (\n        arg_0\n        and arg_1\n        and (arg_1.rstrip(\"/\") + \"/\").startswith(arg_0.rstrip(\"/\") + \"/\")\n    )", "path": "wsgidav/util.py", "identifier": "is_equal_or_child_uri", "docstring": "Return True, if childUri is a child of parentUri or maps to the same resource.\n\n    Similar to <util.is_child_uri>_ ,  but this method also returns True, if parent\n    equals child. ('/a/b' is considered identical with '/a/b/').", "docstring_tokens": ["Return", "True", "if", "childUri", "is", "a", "child", "of", "parentUri", "or", "maps", "to", "the", "same", "resource", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 260390}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/image.py#L145-L171", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Similar to monochrome, but now do it for multiple colors", "language": "python", "parameters": "(I, colors, vmin=None, vmax=None, axis=-1)", "return_statement": "return np.clip(normalized, 0, 1).dot(colors)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "-", "1", ")", ":", "arg_5", "=", "len", "(", "arg_0", ".", "shape", ")", "arg_6", "=", "list", "(", "range", "(", "arg_5", ")", ")", "arg_7", "=", "list", "(", "arg_6", ")", "arg_7", ".", "remove", "(", "(", "arg_4", "+", "arg_5", ")", "%", "arg_5", ")", "arg_7", "=", "tuple", "(", "arg_7", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "np", ".", "nanmin", "(", "arg_0", ",", "arg_4", "=", "arg_7", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "np", ".", "nanmax", "(", "arg_0", ",", "arg_4", "=", "arg_7", ")", "arg_8", "=", "(", "arg_0", "-", "arg_2", ")", "/", "(", "arg_3", "-", "arg_2", ")", "return", "np", ".", "clip", "(", "arg_8", ",", "0", ",", "1", ")", ".", "dot", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=-1):\n    \"\"\"Similar to monochrome, but now do it for multiple colors\n\n    Example\n    >>> I = np.arange(32.).reshape(4,4,2)\n    >>> colors = [(0, 0, 1), (0, 1, 0)] # red and green\n    >>> rgb = vx.image.Func(I, colors) # shape is (4,4,3)\n\n    :param I: ndarray of any shape (3d will result in a 2d image)\n    :param colors: sequence of [(r,g,b), ...] values\n    :param vmin: normalization minimum for I, or np.nanmin(I) when None\n    :param vmax: normalization maximum for I, or np.nanmax(I) when None\n    :param axis: axis which to sum over, by default the last\n    :return:\n    \"\"\"\n    arg_5 = len(arg_0.shape)\n    arg_6 = list(range(arg_5))\n    arg_7 = list(arg_6)\n    arg_7.remove((arg_4 + arg_5) % arg_5)\n    arg_7 = tuple(arg_7)\n\n    if arg_2 is None:\n        arg_2 = np.nanmin(arg_0, arg_4=arg_7)\n    if arg_3 is None:\n        arg_3 = np.nanmax(arg_0, arg_4=arg_7)\n    arg_8 = (arg_0 - arg_2) / (arg_3 - arg_2)\n    return np.clip(arg_8, 0, 1).dot(arg_1)", "path": "packages/vaex-core/vaex/image.py", "identifier": "polychrome", "docstring": "Similar to monochrome, but now do it for multiple colors\n\n    Example\n    >>> I = np.arange(32.).reshape(4,4,2)\n    >>> colors = [(0, 0, 1), (0, 1, 0)] # red and green\n    >>> rgb = vx.image.polychrome(I, colors) # shape is (4,4,3)\n\n    :param I: ndarray of any shape (3d will result in a 2d image)\n    :param colors: sequence of [(r,g,b), ...] values\n    :param vmin: normalization minimum for I, or np.nanmin(I) when None\n    :param vmax: normalization maximum for I, or np.nanmax(I) when None\n    :param axis: axis which to sum over, by default the last\n    :return:", "docstring_tokens": ["Similar", "to", "monochrome", "but", "now", "do", "it", "for", "multiple", "colors"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 260391}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1095-L1115", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Populate array with all possible quartets. This allows us to \n    sample from the total, and also to continue from a checkpoint", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "h5py", ".", "File", "(", "arg_0", ".", "database", ".", "input", ",", "'a'", ")", "as", "io5", ":", "arg_1", "=", "io5", "[", "\"quartets\"", "]", "arg_2", "=", "itertools", ".", "combinations", "(", "xrange", "(", "len", "(", "arg_0", ".", "samples", ")", ")", ",", "4", ")", "arg_3", "=", "0", "while", "arg_3", "<", "arg_0", ".", "params", ".", "nquartets", ":", "arg_4", "=", "np", ".", "array", "(", "list", "(", "itertools", ".", "islice", "(", "arg_2", ",", "arg_0", ".", "_chunksize", ")", ")", ")", "arg_5", "=", "min", "(", "arg_0", ".", "params", ".", "nquartets", ",", "arg_4", ".", "shape", "[", "0", "]", "+", "arg_3", ")", "arg_1", "[", "arg_3", ":", "arg_5", "]", "=", "arg_4", "[", ":", "arg_5", "-", "arg_3", "]", "arg_3", "+=", "arg_0", ".", "_chunksize", "print", "(", "min", "(", "arg_3", ",", "arg_0", ".", "params", ".", "nquartets", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Populate array with all possible quartets. This allows us to \n    sample from the total, and also to continue from a checkpoint\n    \"\"\"\n\n    with h5py.File(arg_0.database.input, 'a') as io5:\n        arg_1 = io5[\"quartets\"]\n\n        ## generator for all quartet sets\n        arg_2 = itertools.combinations(xrange(len(arg_0.samples)), 4)\n        arg_3 = 0\n        while arg_3 < arg_0.params.nquartets:\n            ## sample a chunk of the next ordered N set of quartets\n            arg_4 = np.array(list(itertools.islice(arg_2, arg_0._chunksize)))\n            arg_5 = min(arg_0.params.nquartets, arg_4.shape[0]+arg_3)\n            arg_1[arg_3:arg_5] = arg_4[:arg_5-arg_3]\n            arg_3 += arg_0._chunksize\n\n            ## send progress update to stdout on engine\n            print(min(arg_3, arg_0.params.nquartets))", "path": "ipyrad/analysis/tetrad2.py", "identifier": "store_all", "docstring": "Populate array with all possible quartets. This allows us to \n    sample from the total, and also to continue from a checkpoint", "docstring_tokens": ["Populate", "array", "with", "all", "possible", "quartets", ".", "This", "allows", "us", "to", "sample", "from", "the", "total", "and", "also", "to", "continue", "from", "a", "checkpoint"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 260392}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/checkpoint.py#L84-L139", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Load checkpoint from a file or URI.", "language": "python", "parameters": "(model,\n                    filename,\n                    map_location=None,\n                    strict=False,\n                    logger=None)", "return_statement": "return checkpoint", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ")", ":", "if", "arg_1", ".", "startswith", "(", "'modelzoo://'", ")", ":", "import", "torchvision", "arg_5", "=", "dict", "(", ")", "for", "arg_6", ",", "arg_7", ",", "arg_8", "in", "pkgutil", ".", "walk_packages", "(", "torchvision", ".", "models", ".", "__path__", ")", ":", "if", "not", "arg_8", ":", "arg_9", "=", "import_module", "(", "'torchvision.models.{}'", ".", "format", "(", "arg_7", ")", ")", "arg_10", "=", "getattr", "(", "arg_9", ",", "'model_urls'", ")", "arg_5", ".", "update", "(", "arg_10", ")", "arg_11", "=", "arg_1", "[", "11", ":", "]", "arg_12", "=", "model_zoo", ".", "load_url", "(", "arg_5", "[", "arg_11", "]", ")", "elif", "arg_1", ".", "startswith", "(", "'open-mmlab://'", ")", ":", "arg_11", "=", "arg_1", "[", "13", ":", "]", "arg_12", "=", "model_zoo", ".", "load_url", "(", "open_mmlab_model_urls", "[", "arg_11", "]", ")", "elif", "arg_1", ".", "startswith", "(", "(", "'http://'", ",", "'https://'", ")", ")", ":", "arg_12", "=", "model_zoo", ".", "load_url", "(", "arg_1", ")", "else", ":", "if", "not", "osp", ".", "isfile", "(", "arg_1", ")", ":", "raise", "IOError", "(", "'{} is not a checkpoint file'", ".", "format", "(", "arg_1", ")", ")", "arg_12", "=", "torch", ".", "load", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "if", "isinstance", "(", "arg_12", ",", "OrderedDict", ")", ":", "arg_13", "=", "arg_12", "elif", "isinstance", "(", "arg_12", ",", "dict", ")", "and", "'state_dict'", "in", "arg_12", ":", "arg_13", "=", "arg_12", "[", "'state_dict'", "]", "else", ":", "raise", "RuntimeError", "(", "'No state_dict found in checkpoint file {}'", ".", "format", "(", "arg_1", ")", ")", "if", "list", "(", "arg_13", ".", "keys", "(", ")", ")", "[", "0", "]", ".", "startswith", "(", "'module.'", ")", ":", "arg_13", "=", "{", "k", "[", "7", ":", "]", ":", "v", "for", "k", ",", "v", "in", "arg_12", "[", "'state_dict'", "]", ".", "items", "(", ")", "}", "if", "hasattr", "(", "arg_0", ",", "'module'", ")", ":", "load_state_dict", "(", "arg_0", ".", "module", ",", "arg_13", ",", "arg_3", ",", "arg_4", ")", "else", ":", "load_state_dict", "(", "arg_0", ",", "arg_13", ",", "arg_3", ",", "arg_4", ")", "return", "arg_12"], "function": "def Func(arg_0,\n                    arg_1,\n                    arg_2=None,\n                    arg_3=False,\n                    arg_4=None):\n    \"\"\"Load checkpoint from a file or URI.\n\n    Args:\n        model (Module): Module to load checkpoint.\n        filename (str): Either a filepath or URL or modelzoo://xxxxxxx.\n        map_location (str): Same as :func:`torch.load`.\n        strict (bool): Whether to allow different params for the model and\n            checkpoint.\n        logger (:mod:`logging.Logger` or None): The logger for error message.\n\n    Returns:\n        dict or OrderedDict: The loaded checkpoint.\n    \"\"\"\n    # load checkpoint from modelzoo or file or url\n    if arg_1.startswith('modelzoo://'):\n        import torchvision\n        arg_5 = dict()\n        for arg_6, arg_7, arg_8 in pkgutil.walk_packages(\n                torchvision.models.__path__):\n            if not arg_8:\n                arg_9 = import_module('torchvision.models.{}'.format(arg_7))\n                arg_10 = getattr(arg_9, 'model_urls')\n                arg_5.update(arg_10)\n        arg_11 = arg_1[11:]\n        arg_12 = model_zoo.load_url(arg_5[arg_11])\n    elif arg_1.startswith('open-mmlab://'):\n        arg_11 = arg_1[13:]\n        arg_12 = model_zoo.load_url(open_mmlab_model_urls[arg_11])\n    elif arg_1.startswith(('http://', 'https://')):\n        arg_12 = model_zoo.load_url(arg_1)\n    else:\n        if not osp.isfile(arg_1):\n            raise IOError('{} is not a checkpoint file'.format(arg_1))\n        arg_12 = torch.load(arg_1, arg_2=arg_2)\n    # get state_dict from checkpoint\n    if isinstance(arg_12, OrderedDict):\n        arg_13 = arg_12\n    elif isinstance(arg_12, dict) and 'state_dict' in arg_12:\n        arg_13 = arg_12['state_dict']\n    else:\n        raise RuntimeError(\n            'No state_dict found in checkpoint file {}'.format(arg_1))\n    # strip prefix of state_dict\n    if list(arg_13.keys())[0].startswith('module.'):\n        arg_13 = {k[7:]: v for k, v in arg_12['state_dict'].items()}\n    # load state_dict\n    if hasattr(arg_0, 'module'):\n        load_state_dict(arg_0.module, arg_13, arg_3, arg_4)\n    else:\n        load_state_dict(arg_0, arg_13, arg_3, arg_4)\n    return arg_12", "path": "mmcv/runner/checkpoint.py", "identifier": "load_checkpoint", "docstring": "Load checkpoint from a file or URI.\n\n    Args:\n        model (Module): Module to load checkpoint.\n        filename (str): Either a filepath or URL or modelzoo://xxxxxxx.\n        map_location (str): Same as :func:`torch.load`.\n        strict (bool): Whether to allow different params for the model and\n            checkpoint.\n        logger (:mod:`logging.Logger` or None): The logger for error message.\n\n    Returns:\n        dict or OrderedDict: The loaded checkpoint.", "docstring_tokens": ["Load", "checkpoint", "from", "a", "file", "or", "URI", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260393}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L540-L550", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Parse all addresses.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", ".", "getaddress", "(", ")", "while", "arg_2", ":", "arg_1", "+=", "arg_2", "arg_2", "=", "arg_0", ".", "getaddress", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Parse all addresses.\n\n        Returns a list containing all of the addresses.\n        \"\"\"\n        arg_1 = []\n        arg_2 = arg_0.getaddress()\n        while arg_2:\n            arg_1 += arg_2\n            arg_2 = arg_0.getaddress()\n        return arg_1", "path": "third_party/stdlib/rfc822.py", "identifier": "AddrlistClass.getaddrlist", "docstring": "Parse all addresses.\n\n        Returns a list containing all of the addresses.", "docstring_tokens": ["Parse", "all", "addresses", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 260394}
{"url": "https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L636-L654", "sha": "79db9f878ef2071f2f576a1cf5d43a752a55894a", "docstring_summary": "Return a variable representing the regularized loss for this network.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return sum(l.weight * l(outputs) for l in self.losses) + \\\n            sum(r.weight * r.loss(self.layers, outputs) for r in regs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "regularizers", ".", "from_kwargs", "(", "arg_0", ",", "**", "arg_1", ")", "arg_3", ",", "arg_4", "=", "arg_0", ".", "build_graph", "(", "arg_2", ")", "return", "sum", "(", "arg_5", ".", "weight", "*", "arg_5", "(", "arg_3", ")", "for", "arg_5", "in", "arg_0", ".", "Funces", ")", "+", "sum", "(", "arg_6", ".", "weight", "*", "arg_6", ".", "Func", "(", "arg_0", ".", "layers", ",", "arg_3", ")", "for", "arg_6", "in", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\n        '''Return a variable representing the regularized Func for this network.\n\n        The regularized Func includes both the :ref:`Func computation <Funces>`\n        for the network as well as any :ref:`regularizers <regularizers>` that\n        are in place.\n\n        Keyword arguments are passed directly to\n        :func:`theanets.regularizers.from_kwargs`.\n\n        Returns\n        -------\n        Func : Theano expression\n            A Theano expression representing the Func of this network.\n        '''\n        arg_2 = regularizers.from_kwargs(arg_0, **arg_1)\n        arg_3, arg_4 = arg_0.build_graph(arg_2)\n        return sum(arg_5.weight * arg_5(arg_3) for arg_5 in arg_0.Funces) + \\\n            sum(arg_6.weight * arg_6.Func(arg_0.layers, arg_3) for arg_6 in arg_2)", "path": "theanets/graph.py", "identifier": "Network.loss", "docstring": "Return a variable representing the regularized loss for this network.\n\n        The regularized loss includes both the :ref:`loss computation <losses>`\n        for the network as well as any :ref:`regularizers <regularizers>` that\n        are in place.\n\n        Keyword arguments are passed directly to\n        :func:`theanets.regularizers.from_kwargs`.\n\n        Returns\n        -------\n        loss : Theano expression\n            A Theano expression representing the loss of this network.", "docstring_tokens": ["Return", "a", "variable", "representing", "the", "regularized", "loss", "for", "this", "network", "."], "nwo": "lmjohns3/theanets", "score": 0.2886647528997147, "idx": 260395}
{"url": "https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L453-L473", "sha": "5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3", "docstring_summary": "Cancel an IO block.", "language": "python", "parameters": "(self, block)", "return_statement": "return self._eventToPython(event)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "libaio", ".", "io_event", "(", ")", "try", ":", "libaio", ".", "io_Func", "(", "arg_0", ".", "_ctx", ",", "byref", "(", "arg_1", ".", "_iocb", ")", ",", "byref", "(", "arg_2", ")", ")", "except", "OSError", "as", "exc", ":", "if", "exc", ".", "errno", "==", "errno", ".", "EINPROGRESS", ":", "return", "None", "raise", "return", "arg_0", ".", "_eventToPython", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Cancel an IO block.\n\n        block (AIOBlock)\n            The IO block to Func.\n\n        Returns Funcled block's event data (see getEvents), or None if the\n        kernel returned EINPROGRESS. In the latter case, event completion will\n        happen on a later getEvents call.\n        \"\"\"\n        arg_2 = libaio.io_event()\n        try:\n            # pylint: disable=protected-access\n            libaio.io_Func(arg_0._ctx, byref(arg_1._iocb), byref(arg_2))\n            # pylint: enable=protected-access\n        except OSError as exc:\n            if exc.errno == errno.EINPROGRESS:\n                return None\n            raise\n        return arg_0._eventToPython(arg_2)", "path": "libaio/__init__.py", "identifier": "AIOContext.cancel", "docstring": "Cancel an IO block.\n\n        block (AIOBlock)\n            The IO block to cancel.\n\n        Returns cancelled block's event data (see getEvents), or None if the\n        kernel returned EINPROGRESS. In the latter case, event completion will\n        happen on a later getEvents call.", "docstring_tokens": ["Cancel", "an", "IO", "block", "."], "nwo": "vpelletier/python-libaio", "score": 0.18579120894425885, "idx": 260396}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/lms.py#L454-L480", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Retrieve the certificate for the given username for the given course_id.", "language": "python", "parameters": "(self, course_id, username)", "return_statement": "return self.client.certificates(username).courses(course_id).get()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "client", ".", "certificates", "(", "arg_2", ")", ".", "courses", "(", "arg_1", ")", ".", "get", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Retrieve the certificate for the given username for the given course_id.\n\n        Args:\n        * ``course_id`` (str): The string value of the course's unique identifier\n        * ``username`` (str): The username ID identifying the user for which to retrieve the certificate\n\n        Raises:\n\n        HttpNotFoundError if no certificate found for the given user+course.\n\n        Returns:\n\n        a dict containing:\n\n        * ``username``: A string representation of an user's username passed in the request.\n        * ``course_id``: A string representation of a Course ID.\n        * ``certificate_type``: A string representation of the certificate type.\n        * ``created_date`: Datetime the certificate was created (tz-aware).\n        * ``status``: A string representation of the certificate status.\n        * ``is_passing``: True if the certificate has a passing status, False if not.\n        * ``download_url``: A string representation of the certificate url.\n        * ``grade``: A string representation of a float for the user's course grade.\n\n        \"\"\"\n        return arg_0.client.certificates(arg_2).courses(arg_1).get()", "path": "enterprise/api_client/lms.py", "identifier": "CertificatesApiClient.get_course_certificate", "docstring": "Retrieve the certificate for the given username for the given course_id.\n\n        Args:\n        * ``course_id`` (str): The string value of the course's unique identifier\n        * ``username`` (str): The username ID identifying the user for which to retrieve the certificate\n\n        Raises:\n\n        HttpNotFoundError if no certificate found for the given user+course.\n\n        Returns:\n\n        a dict containing:\n\n        * ``username``: A string representation of an user's username passed in the request.\n        * ``course_id``: A string representation of a Course ID.\n        * ``certificate_type``: A string representation of the certificate type.\n        * ``created_date`: Datetime the certificate was created (tz-aware).\n        * ``status``: A string representation of the certificate status.\n        * ``is_passing``: True if the certificate has a passing status, False if not.\n        * ``download_url``: A string representation of the certificate url.\n        * ``grade``: A string representation of a float for the user's course grade.", "docstring_tokens": ["Retrieve", "the", "certificate", "for", "the", "given", "username", "for", "the", "given", "course_id", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260397}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1678-L1742", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns an iterator over nodes hanging below a given start node.", "language": "python", "parameters": "(self, node, recursive=False, max_depth=float('inf'),\n                    with_links=True, in_search=False, predicate=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "arg_4", "(", "'inf'", ")", ",", "arg_5", "=", "True", ",", "arg_6", "=", "False", ",", "arg_7", "=", "None", ")", ":", "def", "_run_predicate", "(", "arg_8", ",", "arg_9", ")", ":", "arg_10", "=", "arg_8", ".", "v_run_branch", "return", "arg_10", "==", "'trajectory'", "or", "arg_10", "in", "arg_9", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_4", "(", "'inf'", ")", "if", "arg_7", "is", "None", ":", "arg_7", "=", "lambda", "arg_8", ":", "True", "elif", "isinstance", "(", "arg_7", ",", "(", "tuple", ",", "list", ")", ")", ":", "arg_11", "=", "arg_7", "arg_9", "=", "set", "(", ")", "for", "arg_12", "in", "arg_11", ":", "if", "arg_12", "==", "-", "1", ":", "arg_9", ".", "add", "(", "arg_0", ".", "_root_instance", ".", "f_wildcard", "(", "'$'", ",", "-", "1", ")", ")", "elif", "isinstance", "(", "arg_12", ",", "int", ")", ":", "arg_9", ".", "add", "(", "arg_0", ".", "_root_instance", ".", "f_idx_to_run", "(", "arg_12", ")", ")", "else", ":", "arg_9", ".", "add", "(", "arg_12", ")", "arg_7", "=", "lambda", "arg_8", ":", "_run_predicate", "(", "arg_8", ",", "arg_9", ")", "if", "arg_2", ":", "return", "NaturalNamingInterface", ".", "_recursive_traversal_bfs", "(", "arg_1", ",", "arg_0", ".", "_root_instance", ".", "_linked_by", ",", "arg_3", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "else", ":", "arg_13", "=", "(", "arg_8", "for", "arg_8", "in", "arg_0", ".", "_make_child_iterator", "(", "arg_1", ",", "arg_5", ")", "if", "arg_7", "(", "arg_8", "[", "2", "]", ")", ")", "if", "arg_6", ":", "return", "arg_13", "else", ":", "return", "(", "arg_8", "[", "2", "]", "for", "arg_8", "in", "arg_13", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=arg_4('inf'),\n                    arg_5=True, arg_6=False, arg_7=None):\n        \"\"\"Returns an iterator over nodes hanging below a given start node.\n\n        :param node:\n\n            Start node\n\n        :param recursive:\n\n            Whether recursively also iterate over the children of the start node's children\n\n        :param max_depth:\n\n            Maximum depth to search for\n\n        :param in_search:\n\n            if it is used during get search and if detailed info should be returned\n\n        :param with_links:\n\n            If links should be considered\n\n        :param predicate:\n\n            A predicate to filter nodes\n\n        :return: Iterator\n\n        \"\"\"\n        def _run_predicate(arg_8, arg_9):\n            arg_10 = arg_8.v_run_branch\n            return arg_10 == 'trajectory' or arg_10 in arg_9\n\n        if arg_3 is None:\n            arg_3 = arg_4('inf')\n\n        if arg_7 is None:\n            arg_7 = lambda arg_8: True\n        elif isinstance(arg_7, (tuple, list)):\n            # Create a predicate from a list of run names or run indices\n            arg_11 = arg_7\n            arg_9 = set()\n            for arg_12 in arg_11:\n                if arg_12 == -1:\n                    arg_9.add(arg_0._root_instance.f_wildcard('$', -1))\n                elif isinstance(arg_12, int):\n                    arg_9.add(arg_0._root_instance.f_idx_to_run(arg_12))\n                else:\n                    arg_9.add(arg_12)\n            arg_7 = lambda arg_8: _run_predicate(arg_8, arg_9)\n\n        if arg_2:\n            return NaturalNamingInterface._recursive_traversal_bfs(arg_1,\n                                            arg_0._root_instance._linked_by,\n                                            arg_3, arg_5,\n                                            arg_6, arg_7)\n        else:\n            arg_13 = (arg_8 for arg_8 in arg_0._make_child_iterator(arg_1, arg_5) if\n                        arg_7(arg_8[2]))\n            if arg_6:\n                return arg_13 # Here we return tuples: (depth, name, object)\n            else:\n                return (arg_8[2] for arg_8 in arg_13)", "path": "pypet/naturalnaming.py", "identifier": "NaturalNamingInterface._iter_nodes", "docstring": "Returns an iterator over nodes hanging below a given start node.\n\n        :param node:\n\n            Start node\n\n        :param recursive:\n\n            Whether recursively also iterate over the children of the start node's children\n\n        :param max_depth:\n\n            Maximum depth to search for\n\n        :param in_search:\n\n            if it is used during get search and if detailed info should be returned\n\n        :param with_links:\n\n            If links should be considered\n\n        :param predicate:\n\n            A predicate to filter nodes\n\n        :return: Iterator", "docstring_tokens": ["Returns", "an", "iterator", "over", "nodes", "hanging", "below", "a", "given", "start", "node", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260398}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L493-L526", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Create box plot of some performance metrics of the strategy.\n    The width of the box whiskers is determined by a bootstrap.", "language": "python", "parameters": "(returns, factor_returns, ax=None)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "plt", ".", "gca", "(", ")", "arg_3", "=", "timeseries", ".", "perf_stats_bootstrap", "(", "arg_0", ",", "arg_1", ",", "return_stats", "=", "False", ")", "arg_3", "=", "arg_3", ".", "drop", "(", "'Kurtosis'", ",", "axis", "=", "'columns'", ")", "sns", ".", "boxplot", "(", "data", "=", "arg_3", ",", "orient", "=", "'h'", ",", "arg_2", "=", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Create box plot of some performance metrics of the strategy.\n    The width of the box whiskers is determined by a bootstrap.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_2 is None:\n        arg_2 = plt.gca()\n\n    arg_3 = timeseries.perf_stats_bootstrap(arg_0,\n                                                       arg_1,\n                                                       return_stats=False)\n    arg_3 = arg_3.drop('Kurtosis', axis='columns')\n\n    sns.boxplot(data=arg_3, orient='h', arg_2=arg_2)\n\n    return arg_2", "path": "pyfolio/plotting.py", "identifier": "plot_perf_stats", "docstring": "Create box plot of some performance metrics of the strategy.\n    The width of the box whiskers is determined by a bootstrap.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    factor_returns : pd.Series\n        Daily noncumulative returns of the benchmark factor to which betas are\n        computed. Usually a benchmark such as market returns.\n         - This is in the same style as returns.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Create", "box", "plot", "of", "some", "performance", "metrics", "of", "the", "strategy", ".", "The", "width", "of", "the", "box", "whiskers", "is", "determined", "by", "a", "bootstrap", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260399}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-batch/azure/batch/custom/patch.py#L66-L151", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Adds a chunk of tasks to the job", "language": "python", "parameters": "(self, results_queue, chunk_tasks_to_add)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "_original_add_collection", "(", "arg_0", ".", "_client", ",", "arg_0", ".", "_job_id", ",", "arg_2", ",", "arg_0", ".", "_task_add_collection_options", ",", "arg_0", ".", "_custom_headers", ",", "arg_0", ".", "_raw", ")", "except", "BatchErrorException", "as", "e", ":", "if", "e", ".", "error", ".", "code", "==", "\"RequestBodyTooLarge\"", ":", "if", "len", "(", "arg_2", ")", "==", "1", ":", "arg_4", "=", "arg_2", ".", "pop", "(", ")", "arg_0", ".", "errors", ".", "appendleft", "(", "e", ")", "_LOGGER", ".", "error", "(", "\"Failed to add task with ID %s due to the body\"", "\" exceeding the maximum request size\"", ",", "arg_4", ".", "id", ")", "else", ":", "arg_5", "=", "int", "(", "len", "(", "arg_2", ")", "/", "2", ")", "with", "arg_0", ".", "_max_tasks_lock", ":", "if", "arg_5", "<", "arg_0", ".", "_max_tasks_per_request", ":", "arg_0", ".", "_max_tasks_per_request", "=", "arg_5", "_LOGGER", ".", "info", "(", "\"Amount of tasks per request reduced from %s to %s due to the\"", "\" request body being too large\"", ",", "str", "(", "arg_0", ".", "_max_tasks_per_request", ")", ",", "str", "(", "arg_5", ")", ")", "arg_0", ".", "tasks_to_add", ".", "extendleft", "(", "arg_2", "[", "arg_5", ":", "]", ")", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_2", "[", ":", "arg_5", "]", ")", "elif", "500", "<=", "e", ".", "response", ".", "status_code", "<=", "599", ":", "arg_0", ".", "tasks_to_add", ".", "extendleft", "(", "arg_2", ")", "else", ":", "arg_0", ".", "tasks_to_add", ".", "extendleft", "(", "arg_2", ")", "arg_0", ".", "errors", ".", "appendleft", "(", "e", ")", "except", "Exception", "as", "e", ":", "arg_0", ".", "tasks_to_add", ".", "extendleft", "(", "arg_2", ")", "arg_0", ".", "errors", ".", "appendleft", "(", "e", ")", "else", ":", "try", ":", "arg_3", "=", "arg_3", ".", "output", "except", "AttributeError", ":", "pass", "for", "arg_7", "in", "arg_3", ".", "value", ":", "if", "arg_7", ".", "status", "==", "TaskAddStatus", ".", "server_error", ":", "with", "arg_0", ".", "_pending_queue_lock", ":", "for", "arg_8", "in", "arg_2", ":", "if", "arg_8", ".", "id", "==", "arg_7", ".", "task_id", ":", "arg_0", ".", "tasks_to_add", ".", "appendleft", "(", "arg_8", ")", "elif", "(", "arg_7", ".", "status", "==", "TaskAddStatus", ".", "client_error", "and", "not", "arg_7", ".", "error", ".", "code", "==", "\"TaskExists\"", ")", ":", "arg_0", ".", "failure_tasks", ".", "appendleft", "(", "arg_7", ")", "else", ":", "arg_1", ".", "appendleft", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Adds a chunk of tasks to the job\n\n        Retry chunk if body exceeds the maximum request size and retry tasks\n        if failed due to server errors.\n\n        :param results_queue: Queue to place the return value of the request\n        :type results_queue: collections.deque\n        :param chunk_tasks_to_add: Chunk of at most 100 tasks with retry details\n        :type chunk_tasks_to_add: list[~TrackedCloudTask]\n        \"\"\"\n\n        try:\n            arg_3 = arg_0._original_add_collection(\n                arg_0._client,\n                arg_0._job_id,\n                arg_2,\n                arg_0._task_add_collection_options,\n                arg_0._custom_headers,\n                arg_0._raw)\n        except BatchErrorException as e:\n            # In case of a chunk exceeding the MaxMessageSize split chunk in half\n            # and resubmit smaller chunk requests\n            # TODO: Replace string with constant variable once available in SDK\n            if e.error.code == \"RequestBodyTooLarge\":  # pylint: disable=no-member\n                # In this case the task is misbehaved and will not be able to be added due to:\n                #   1) The task exceeding the max message size\n                #   2) A single cell of the task exceeds the per-cell limit, or\n                #   3) Sum of all cells exceeds max row limit\n                if len(arg_2) == 1:\n                    arg_4 = arg_2.pop()\n                    arg_0.errors.appendleft(e)\n                    _LOGGER.error(\"Failed to add task with ID %s due to the body\"\n                                  \" exceeding the maximum request size\", arg_4.id)\n                else:\n                    # Assumption: Tasks are relatively close in size therefore if one batch exceeds size limit\n                    # we should decrease the initial task collection size to avoid repeating the error\n                    # Midpoint is lower bounded by 1 due to above base case\n                    arg_5 = int(len(arg_2) / 2)\n                    # Restrict one thread at a time to do this compare and set,\n                    # therefore forcing max_tasks_per_request to be strictly decreasing\n                    with arg_0._max_tasks_lock:\n                        if arg_5 < arg_0._max_tasks_per_request:\n                            arg_0._max_tasks_per_request = arg_5\n                            _LOGGER.info(\"Amount of tasks per request reduced from %s to %s due to the\"\n                                         \" request body being too large\", str(arg_0._max_tasks_per_request),\n                                         str(arg_5))\n\n                    # Not the most efficient solution for all cases, but the goal of this is to handle this\n                    # exception and have it work in all cases where tasks are well behaved\n                    # Behavior retries as a smaller chunk and\n                    # appends extra tasks to queue to be picked up by another thread .\n                    arg_0.tasks_to_add.extendleft(arg_2[arg_5:])\n                    arg_0.Func(arg_1, arg_2[:arg_5])\n            # Retry server side errors\n            elif 500 <= e.response.status_code <= 599:\n                arg_0.tasks_to_add.extendleft(arg_2)\n            else:\n                # Re-add to pending queue as unknown status / don't have result\n                arg_0.tasks_to_add.extendleft(arg_2)\n                # Unknown State - don't know if tasks failed to add or were successful\n                arg_0.errors.appendleft(e)\n        except Exception as e:  # pylint: disable=broad-except\n            # Re-add to pending queue as unknown status / don't have result\n            arg_0.tasks_to_add.extendleft(arg_2)\n            # Unknown State - don't know if tasks failed to add or were successful\n            arg_0.errors.appendleft(e)\n        else:\n            try:\n                arg_3 = arg_3.output\n            except AttributeError:\n                pass\n\n            for arg_7 in arg_3.value:  # pylint: disable=no-member\n                if arg_7.status == TaskAddStatus.server_error:\n                    # Server error will be retried\n                    with arg_0._pending_queue_lock:\n                        for arg_8 in arg_2:\n                            if arg_8.id == arg_7.task_id:\n                                arg_0.tasks_to_add.appendleft(arg_8)\n                elif (arg_7.status == TaskAddStatus.client_error\n                        and not arg_7.error.code == \"TaskExists\"):\n                    # Client error will be recorded unless Task already exists\n                    arg_0.failure_tasks.appendleft(arg_7)\n                else:\n                    arg_1.appendleft(arg_7)", "path": "azure-batch/azure/batch/custom/patch.py", "identifier": "_TaskWorkflowManager._bulk_add_tasks", "docstring": "Adds a chunk of tasks to the job\n\n        Retry chunk if body exceeds the maximum request size and retry tasks\n        if failed due to server errors.\n\n        :param results_queue: Queue to place the return value of the request\n        :type results_queue: collections.deque\n        :param chunk_tasks_to_add: Chunk of at most 100 tasks with retry details\n        :type chunk_tasks_to_add: list[~TrackedCloudTask]", "docstring_tokens": ["Adds", "a", "chunk", "of", "tasks", "to", "the", "job"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260400}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L527-L529", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Refer all the Vars in the other namespace.", "language": "python", "parameters": "(self, other_ns: \"Namespace\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "\"Namespace\"", ")", ":", "arg_0", ".", "_refers", ".", "swap", "(", "Namespace", ".", "__Func", ",", "arg_1", ".", "interns", ")"], "function": "def Func(arg_0, arg_1: \"Namespace\"):\n        \"\"\"Refer all the Vars in the other namespace.\"\"\"\n        arg_0._refers.swap(Namespace.__Func, arg_1.interns)", "path": "src/basilisp/lang/runtime.py", "identifier": "Namespace.refer_all", "docstring": "Refer all the Vars in the other namespace.", "docstring_tokens": ["Refer", "all", "the", "Vars", "in", "the", "other", "namespace", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 260401}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/lock_storage.py#L226-L254", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Modify an existing lock's timeout.", "language": "python", "parameters": "(self, token, timeout)", "return_statement": "return lock", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "assert", "arg_1", "in", "arg_0", ".", "_dict", ",", "\"Lock must exist\"", "assert", "arg_2", "==", "-", "1", "or", "arg_2", ">", "0", "if", "arg_2", "<", "0", "or", "arg_2", ">", "LockStorageDict", ".", "LOCK_TIME_OUT_MAX", ":", "arg_2", "=", "LockStorageDict", ".", "LOCK_TIME_OUT_MAX", "arg_0", ".", "_lock", ".", "acquire_write", "(", ")", "try", ":", "arg_3", "=", "arg_0", ".", "_dict", "[", "arg_1", "]", "arg_3", "[", "\"timeout\"", "]", "=", "arg_2", "arg_3", "[", "\"expire\"", "]", "=", "time", ".", "time", "(", ")", "+", "arg_2", "arg_0", ".", "_dict", "[", "arg_1", "]", "=", "arg_3", "arg_0", ".", "_flush", "(", ")", "finally", ":", "arg_0", ".", "_lock", ".", "release", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Modify an existing lock's timeout.\n\n        token:\n            Valid lock token.\n        timeout:\n            Suggested lifetime in seconds (-1 for infinite).\n            The real expiration time may be shorter than requested!\n        Returns:\n            Lock dictionary.\n            Raises ValueError, if token is invalid.\n        \"\"\"\n        assert arg_1 in arg_0._dict, \"Lock must exist\"\n        assert arg_2 == -1 or arg_2 > 0\n        if arg_2 < 0 or arg_2 > LockStorageDict.LOCK_TIME_OUT_MAX:\n            arg_2 = LockStorageDict.LOCK_TIME_OUT_MAX\n\n        arg_0._lock.acquire_write()\n        try:\n            # Note: shelve dictionary returns copies, so we must reassign\n            # values:\n            arg_3 = arg_0._dict[arg_1]\n            arg_3[\"timeout\"] = arg_2\n            arg_3[\"expire\"] = time.time() + arg_2\n            arg_0._dict[arg_1] = arg_3\n            arg_0._flush()\n        finally:\n            arg_0._lock.release()\n        return arg_3", "path": "wsgidav/lock_storage.py", "identifier": "LockStorageDict.refresh", "docstring": "Modify an existing lock's timeout.\n\n        token:\n            Valid lock token.\n        timeout:\n            Suggested lifetime in seconds (-1 for infinite).\n            The real expiration time may be shorter than requested!\n        Returns:\n            Lock dictionary.\n            Raises ValueError, if token is invalid.", "docstring_tokens": ["Modify", "an", "existing", "lock", "s", "timeout", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 260402}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/googlecloud/googlecloud.py#L112-L137", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "The submit method takes the command string to be executed upon\n        instantiation of a resource most often to start a pilot.", "language": "python", "parameters": "(self, command, blocksize, tasks_per_node, job_name=\"parsl.auto\")", "return_statement": "return name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "\"parsl.auto\"", ")", ":", "arg_5", "=", "arg_0", ".", "launcher", "(", "arg_1", ",", "arg_3", ",", "1", ")", "arg_6", ",", "arg_7", "=", "arg_0", ".", "create_instance", "(", "arg_1", "=", "arg_5", ")", "arg_0", ".", "provisioned_blocks", "+=", "1", "arg_0", ".", "resources", "[", "arg_7", "]", "=", "{", "\"job_id\"", ":", "arg_7", ",", "\"status\"", ":", "translate_table", "[", "arg_6", "[", "'status'", "]", "]", "}", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=\"parsl.auto\"):\n        ''' The Func method takes the command string to be executed upon\n        instantiation of a resource most often to start a pilot.\n\n        Args :\n             - command (str) : The bash command string to be executed.\n             - blocksize (int) : Blocksize to be requested\n             - tasks_per_node (int) : command invocations to be launched per node\n\n        KWargs:\n             - job_name (str) : Human friendly name to be assigned to the job request\n\n        Returns:\n             - A job identifier, this could be an integer, string etc\n\n        Raises:\n             - ExecutionProviderException or its subclasses\n        '''\n        arg_5 = arg_0.launcher(arg_1,\n                                    arg_3,\n                                    1)\n\n        arg_6, arg_7 = arg_0.create_instance(arg_1=arg_5)\n        arg_0.provisioned_blocks += 1\n        arg_0.resources[arg_7] = {\"job_id\": arg_7, \"status\": translate_table[arg_6['status']]}\n        return arg_7", "path": "parsl/providers/googlecloud/googlecloud.py", "identifier": "GoogleCloudProvider.submit", "docstring": "The submit method takes the command string to be executed upon\n        instantiation of a resource most often to start a pilot.\n\n        Args :\n             - command (str) : The bash command string to be executed.\n             - blocksize (int) : Blocksize to be requested\n             - tasks_per_node (int) : command invocations to be launched per node\n\n        KWargs:\n             - job_name (str) : Human friendly name to be assigned to the job request\n\n        Returns:\n             - A job identifier, this could be an integer, string etc\n\n        Raises:\n             - ExecutionProviderException or its subclasses", "docstring_tokens": ["The", "submit", "method", "takes", "the", "command", "string", "to", "be", "executed", "upon", "instantiation", "of", "a", "resource", "most", "often", "to", "start", "a", "pilot", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 260403}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L477-L524", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data stream and decode the Attributes structure into its\n        parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_2_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ")", ":", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "raise", "exceptions", ".", "VersionNotSupported", "(", "\"KMIP {} does not support the Attributes object.\"", ".", "format", "(", "arg_2", ".", "value", ")", ")", "super", "(", "Attributes", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "while", "True", ":", "if", "len", "(", "arg_6", ")", "<", "3", ":", "break", "arg_7", "=", "struct", ".", "unpack", "(", "'!I'", ",", "b'\\x00'", "+", "arg_6", ".", "peek", "(", "3", ")", ")", "[", "0", "]", "if", "arg_3", ".", "is_enum_value", "(", "arg_3", ".", "Tags", ",", "arg_7", ")", ":", "arg_7", "=", "arg_3", ".", "Tags", "(", "arg_7", ")", "if", "not", "arg_3", ".", "is_attribute", "(", "arg_7", ",", "arg_2", "=", "arg_2", ")", ":", "raise", "exceptions", ".", "AttributeNotSupported", "(", "\"Attribute {} is not supported by KMIP {}.\"", ".", "format", "(", "arg_7", ".", "name", ",", "arg_2", ".", "value", ")", ")", "arg_8", "=", "arg_0", ".", "_factory", ".", "create_attribute_value_by_enum", "(", "arg_7", ",", "None", ")", "arg_8", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_attributes", ".", "append", "(", "arg_8", ")", "else", ":", "break", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_2_0):\n        \"\"\"\n        Read the data stream and decode the Attributes structure into its\n        parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method.\n            kmip_version (enum): A KMIPVersion enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            AttributeNotSupported: Raised if an unsupported attribute is\n                encountered while decoding.\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the Attributes object.\n        \"\"\"\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            raise exceptions.VersionNotSupported(\n                \"KMIP {} does not support the Attributes object.\".format(\n                    arg_2.value\n                )\n            )\n\n        super(Attributes, arg_0).Func(arg_1, arg_2=arg_2)\n        arg_6 = BytearrayStream(arg_1.Func(arg_0.length))\n\n        while True:\n            if len(arg_6) < 3:\n                break\n            arg_7 = struct.unpack('!I', b'\\x00' + arg_6.peek(3))[0]\n            if arg_3.is_enum_value(arg_3.Tags, arg_7):\n                arg_7 = arg_3.Tags(arg_7)\n                if not arg_3.is_attribute(arg_7, arg_2=arg_2):\n                    raise exceptions.AttributeNotSupported(\n                        \"Attribute {} is not supported by KMIP {}.\".format(\n                            arg_7.name,\n                            arg_2.value\n                        )\n                    )\n                arg_8 = arg_0._factory.create_attribute_value_by_enum(arg_7, None)\n                arg_8.Func(arg_6, arg_2=arg_2)\n                arg_0._attributes.append(arg_8)\n            else:\n                break\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/objects.py", "identifier": "Attributes.read", "docstring": "Read the data stream and decode the Attributes structure into its\n        parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method.\n            kmip_version (enum): A KMIPVersion enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 2.0.\n\n        Raises:\n            AttributeNotSupported: Raised if an unsupported attribute is\n                encountered while decoding.\n            VersionNotSupported: Raised when a KMIP version is provided that\n                does not support the Attributes object.", "docstring_tokens": ["Read", "the", "data", "stream", "and", "decode", "the", "Attributes", "structure", "into", "its", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 260404}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L33-L48", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "Clean up a bunch of loose files.", "language": "python", "parameters": "(data, sample)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "edits", ",", "arg_1", ".", "name", "+", "\"-tmp-umap1.fastq\"", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "edits", ",", "arg_1", ".", "name", "+", "\"-tmp-umap2.fastq\"", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "refmapping", ",", "arg_1", ".", "name", "+", "\"-unmapped.bam\"", ")", "arg_5", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "refmapping", ",", "arg_1", ".", "name", "+", "\".sam\"", ")", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "edits", ",", "arg_1", ".", "name", "+", "\"-split1.fastq\"", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "edits", ",", "arg_1", ".", "name", "+", "\"-split2.fastq\"", ")", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "edits", ",", "arg_1", ".", "name", "+", "\"-refmap_derep.fastq\"", ")", "for", "arg_9", "in", "[", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "]", ":", "try", ":", "os", ".", "remove", "(", "arg_9", ")", "except", ":", "pass"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Clean up a bunch of loose files.\n    \"\"\"\n    arg_2 = os.path.join(arg_0.dirs.edits, arg_1.name+\"-tmp-umap1.fastq\")\n    arg_3 = os.path.join(arg_0.dirs.edits, arg_1.name+\"-tmp-umap2.fastq\")\n    arg_4 = os.path.join(arg_0.dirs.refmapping, arg_1.name+\"-unmapped.bam\")\n    arg_5 = os.path.join(arg_0.dirs.refmapping, arg_1.name+\".sam\")\n    arg_6 = os.path.join(arg_0.dirs.edits, arg_1.name+\"-split1.fastq\")\n    arg_7 = os.path.join(arg_0.dirs.edits, arg_1.name+\"-split2.fastq\")\n    arg_8 = os.path.join(arg_0.dirs.edits, arg_1.name+\"-refmap_derep.fastq\")\n    for arg_9 in [arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8]:\n        try:\n            os.remove(arg_9)\n        except:\n            pass", "path": "ipyrad/assemble/refmap.py", "identifier": "sample_cleanup", "docstring": "Clean up a bunch of loose files.", "docstring_tokens": ["Clean", "up", "a", "bunch", "of", "loose", "files", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 260405}
{"url": "https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/util.py#L6-L19", "sha": "d97414a05541f48231381f607d1d2e6b50781d39", "docstring_summary": "Produce a function that always returns a supplied value.", "language": "python", "parameters": "(x: A)", "return_statement": "return constanted", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Callable", "[", "...", ",", "arg_1", "]", ":", "def", "Funced", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "return", "arg_0", "return", "Funced"], "function": "def Func(arg_0: arg_1) -> Callable[..., arg_1]:\n    \"\"\"Produce a function that always returns a supplied value.\n\n    Args:\n        x: Any object.\n\n    Returns:\n        A function that accepts any number of positional and keyword arguments, discards them, and returns ``x``.\n    \"\"\"\n\n    def Funced(*arg_2, **arg_3):\n        return arg_0\n\n    return Funced", "path": "parsita/util.py", "identifier": "constant", "docstring": "Produce a function that always returns a supplied value.\n\n    Args:\n        x: Any object.\n\n    Returns:\n        A function that accepts any number of positional and keyword arguments, discards them, and returns ``x``.", "docstring_tokens": ["Produce", "a", "function", "that", "always", "returns", "a", "supplied", "value", "."], "nwo": "drhagen/parsita", "score": 0.2757871243566705, "idx": 260406}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/psfcalc.py#L20-L25", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Returns Hermite-Gauss quadrature points for even functions", "language": "python", "parameters": "(npts=20)", "return_statement": "return pts_hg, wts_hg", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "20", ")", ":", "arg_1", ",", "arg_2", "=", "np", ".", "polynomial", ".", "hermite", ".", "hermgauss", "(", "arg_0", "*", "2", ")", "arg_1", "=", "arg_1", "[", "arg_0", ":", "]", "arg_2", "=", "arg_2", "[", "arg_0", ":", "]", "*", "np", ".", "exp", "(", "arg_1", "*", "arg_1", ")", "return", "arg_1", ",", "arg_2"], "function": "def Func(arg_0=20):\n    \"\"\"Returns Hermite-Gauss quadrature points for even functions\"\"\"\n    arg_1, arg_2 = np.polynomial.hermite.hermgauss(arg_0*2)\n    arg_1 = arg_1[arg_0:]\n    arg_2 = arg_2[arg_0:] * np.exp(arg_1*arg_1)\n    return arg_1, arg_2", "path": "peri/comp/psfcalc.py", "identifier": "calc_pts_hg", "docstring": "Returns Hermite-Gauss quadrature points for even functions", "docstring_tokens": ["Returns", "Hermite", "-", "Gauss", "quadrature", "points", "for", "even", "functions"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260407}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1297-L1307", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Read local file chunk", "language": "python", "parameters": "(self, source, pos, chunk)", "return_statement": "return StringIO(data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", "==", "0", ":", "return", "StringIO", "(", ")", "arg_4", "=", "None", "with", "open", "(", "arg_1", ",", "'rb'", ")", "as", "f", ":", "f", ".", "seek", "(", "arg_2", ")", "arg_4", "=", "f", ".", "read", "(", "arg_3", ")", "if", "not", "arg_4", ":", "raise", "Failure", "(", "'Unable to read data from source: %s'", "%", "arg_1", ")", "return", "StringIO", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''Read local file chunk'''\n    if arg_3==0:\n        return StringIO()\n    arg_4 = None\n    with open(arg_1, 'rb') as f:\n      f.seek(arg_2)\n      arg_4 = f.read(arg_3)\n    if not arg_4:\n      raise Failure('Unable to read data from source: %s' % arg_1)\n    return StringIO(arg_4)", "path": "s4cmd.py", "identifier": "ThreadUtil.read_file_chunk", "docstring": "Read local file chunk", "docstring_tokens": ["Read", "local", "file", "chunk"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260408}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/JMeter/plugin.py#L199-L263", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Genius idea by Alexey Lavrenyuk", "language": "python", "parameters": "(self, jmx, jtl, variables)", "return_statement": "return new_jmx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "logger", ".", "debug", "(", "\"Original JMX: %s\"", ",", "os", ".", "path", ".", "realpath", "(", "arg_1", ")", ")", "with", "open", "(", "arg_1", ",", "'r'", ")", "as", "src_jmx", ":", "arg_4", "=", "src_jmx", ".", "readlines", "(", ")", "try", ":", "arg_5", "=", "arg_4", ".", "pop", "(", "-", "1", ")", "if", "\"WorkBenchGui\"", "in", "arg_4", "[", "-", "5", "]", ":", "logger", ".", "info", "(", "\"WorkBench checkbox enabled...bypassing\"", ")", "arg_6", "=", "6", "else", ":", "arg_6", "=", "2", "while", "arg_6", ">", "0", ":", "arg_5", "=", "arg_4", ".", "pop", "(", "-", "1", ")", "+", "arg_5", "arg_6", "-=", "1", "logger", ".", "debug", "(", "\"Closing statement: %s\"", ",", "arg_5", ")", "except", "Exception", "as", "exc", ":", "raise", "RuntimeError", "(", "\"Failed to find the end of JMX XML: %s\"", "%", "exc", ")", "arg_7", "=", "resource_string", "(", "__name__", ",", "'config/jmeter_var_template.xml'", ")", "arg_8", "=", "[", "]", "for", "arg_9", ",", "arg_10", "in", "arg_3", ".", "iteritems", "(", ")", ":", "arg_8", ".", "append", "(", "arg_7", "%", "(", "arg_9", ",", "arg_9", ",", "arg_10", ")", ")", "arg_11", "=", "\"\\n\"", ".", "join", "(", "arg_8", ")", "if", "arg_0", ".", "jmeter_ver", ">=", "2.13", ":", "arg_12", "=", "'<connectTime>true</connectTime>'", "else", ":", "arg_12", "=", "''", "if", "arg_0", ".", "ext_log", "in", "[", "'errors'", ",", "'all'", "]", ":", "arg_13", "=", "{", "'errors'", ":", "'true'", ",", "'all'", ":", "'false'", "}", "arg_14", "=", "'jmeter_writer_ext.xml'", "arg_15", "=", "{", "'jtl'", ":", "arg_0", ".", "jtl_file", ",", "'udv'", ":", "arg_11", ",", "'ext_log'", ":", "arg_0", ".", "ext_log_file", ",", "'ext_level'", ":", "arg_13", "[", "arg_0", ".", "ext_log", "]", ",", "'save_connect'", ":", "arg_12", "}", "else", ":", "arg_14", "=", "'jmeter_writer.xml'", "arg_15", "=", "{", "'jtl'", ":", "arg_0", ".", "jtl_file", ",", "'udv'", ":", "arg_11", ",", "'save_connect'", ":", "arg_12", "}", "arg_16", "=", "resource_string", "(", "__name__", ",", "'config/'", "+", "arg_14", ")", "try", ":", "arg_17", "=", "arg_0", ".", "core", ".", "mkstemp", "(", "'.jmx'", ",", "'modified_'", ",", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "arg_1", ")", ")", ")", "except", "OSError", "as", "exc", ":", "logger", ".", "debug", "(", "\"Can't create modified jmx near original: %s\"", ",", "exc", ")", "arg_17", "=", "arg_0", ".", "core", ".", "mkstemp", "(", "'.jmx'", ",", "'modified_'", ")", "logger", ".", "debug", "(", "\"Modified JMX: %s\"", ",", "arg_17", ")", "with", "open", "(", "arg_17", ",", "\"wb\"", ")", "as", "fh", ":", "fh", ".", "write", "(", "''", ".", "join", "(", "arg_4", ")", ")", "fh", ".", "write", "(", "arg_16", "%", "arg_15", ")", "fh", ".", "write", "(", "arg_5", ")", "return", "arg_17"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Genius idea by Alexey Lavrenyuk \"\"\"\n        logger.debug(\"Original JMX: %s\", os.path.realpath(arg_1))\n        with open(arg_1, 'r') as src_jmx:\n            arg_4 = src_jmx.readlines()\n\n        try:\n            # In new Jmeter version (3.2 as example) WorkBench's plugin checkbox enabled by default\n            # It totally crashes Yandex tank injection and raises XML Parse Exception\n            arg_5 = arg_4.pop(-1)\n            if \"WorkBenchGui\" in arg_4[-5]:\n                logger.info(\"WorkBench checkbox enabled...bypassing\")\n                arg_6 = 6\n            else:\n                arg_6 = 2\n            while arg_6 > 0:\n                arg_5 = arg_4.pop(-1) + arg_5\n                arg_6 -= 1\n            logger.debug(\"Closing statement: %s\", arg_5)\n        except Exception as exc:\n            raise RuntimeError(\"Failed to find the end of JMX XML: %s\" % exc)\n\n        arg_7 = resource_string(__name__, 'config/jmeter_var_template.xml')\n        arg_8 = []\n        for arg_9, arg_10 in arg_3.iteritems():\n            arg_8.append(arg_7 % (arg_9, arg_9, arg_10))\n        arg_11 = \"\\n\".join(arg_8)\n\n        if arg_0.jmeter_ver >= 2.13:\n            arg_12 = '<connectTime>true</connectTime>'\n        else:\n            arg_12 = ''\n\n        if arg_0.ext_log in ['errors', 'all']:\n            arg_13 = {'errors': 'true', 'all': 'false'}\n            arg_14 = 'jmeter_writer_ext.xml'\n            arg_15 = {\n                'jtl': arg_0.jtl_file,\n                'udv': arg_11,\n                'ext_log': arg_0.ext_log_file,\n                'ext_level': arg_13[arg_0.ext_log],\n                'save_connect': arg_12\n            }\n        else:\n            arg_14 = 'jmeter_writer.xml'\n            arg_15 = {\n                'jtl': arg_0.jtl_file,\n                'udv': arg_11,\n                'save_connect': arg_12\n            }\n\n        arg_16 = resource_string(__name__, 'config/' + arg_14)\n\n        try:\n            arg_17 = arg_0.core.mkstemp(\n                '.jmx', 'modified_', os.path.dirname(os.path.realpath(arg_1)))\n        except OSError as exc:\n            logger.debug(\"Can't create modified jmx near original: %s\", exc)\n            arg_17 = arg_0.core.mkstemp('.jmx', 'modified_')\n        logger.debug(\"Modified JMX: %s\", arg_17)\n        with open(arg_17, \"wb\") as fh:\n            fh.write(''.join(arg_4))\n            fh.write(arg_16 % arg_15)\n            fh.write(arg_5)\n        return arg_17", "path": "yandextank/plugins/JMeter/plugin.py", "identifier": "Plugin.__add_jmeter_components", "docstring": "Genius idea by Alexey Lavrenyuk", "docstring_tokens": ["Genius", "idea", "by", "Alexey", "Lavrenyuk"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 260409}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/coupling.py#L115-L124", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Test if the graph is connected.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "nx", ".", "is_weakly_connected", "(", "arg_0", ".", "graph", ")", "except", "nx", ".", "exception", ".", "NetworkXException", ":", "return", "False"], "function": "def Func(arg_0):\n        \"\"\"\n        Test if the graph is connected.\n\n        Return True if connected, False otherwise\n        \"\"\"\n        try:\n            return nx.is_weakly_connected(arg_0.graph)\n        except nx.exception.NetworkXException:\n            return False", "path": "qiskit/transpiler/coupling.py", "identifier": "CouplingMap.is_connected", "docstring": "Test if the graph is connected.\n\n        Return True if connected, False otherwise", "docstring_tokens": ["Test", "if", "the", "graph", "is", "connected", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260410}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L216-L229", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Runs the model to generate multivariate normal distribution.", "language": "python", "parameters": "(self, inputs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "del", "arg_1", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_0", ".", "_name", ")", ":", "return", "tfd", ".", "MultivariateNormalDiag", "(", "arg_0", ".", "loc", ",", "arg_0", ".", "scale_diag", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Runs the model to generate multivariate normal distribution.\n\n    Args:\n      inputs: Unused.\n\n    Returns:\n      A MultivariateNormalDiag distribution with event shape\n      [dimensions], batch shape [], and sample shape [sample_shape,\n      dimensions].\n    \"\"\"\n    del arg_1  # unused\n    with tf.compat.v1.name_scope(arg_0._name):\n      return tfd.MultivariateNormalDiag(arg_0.loc, arg_0.scale_diag)", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "LearnableMultivariateNormalDiag.call", "docstring": "Runs the model to generate multivariate normal distribution.\n\n    Args:\n      inputs: Unused.\n\n    Returns:\n      A MultivariateNormalDiag distribution with event shape\n      [dimensions], batch shape [], and sample shape [sample_shape,\n      dimensions].", "docstring_tokens": ["Runs", "the", "model", "to", "generate", "multivariate", "normal", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260411}
{"url": "https://github.com/Jaymon/captain/blob/4297f32961d423a10d0f053bc252e29fbe939a47/captain/__init__.py#L127-L149", "sha": "4297f32961d423a10d0f053bc252e29fbe939a47", "docstring_summary": "return the parser for the current name", "language": "python", "parameters": "(self)", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "module", "arg_2", "=", "arg_0", ".", "subcommands", "if", "arg_2", ":", "arg_3", "=", "inspect", ".", "getdoc", "(", "arg_1", ")", "Func", "=", "Parser", "(", "description", "=", "arg_3", ",", "arg_1", "=", "arg_1", ")", "arg_5", "=", "Func", ".", "add_subparsers", "(", ")", "for", "arg_6", ",", "arg_7", "in", "arg_2", ".", "items", "(", ")", ":", "arg_6", "=", "arg_6", ".", "replace", "(", "\"_\"", ",", "\"-\"", ")", "arg_8", "=", "inspect", ".", "getdoc", "(", "arg_7", ")", "arg_9", "=", "arg_5", ".", "add_parser", "(", "arg_6", ",", "arg_7", "=", "arg_7", ",", "help", "=", "arg_8", ")", "else", ":", "Func", "=", "Parser", "(", "arg_7", "=", "arg_0", ".", "callbacks", "[", "arg_0", ".", "function_name", "]", ",", "arg_1", "=", "arg_1", ")", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"return the parser for the current name\"\"\"\n        arg_1 = arg_0.module\n\n        arg_2 = arg_0.subcommands\n        if arg_2:\n            arg_3 = inspect.getdoc(arg_1)\n            Func = Parser(description=arg_3, arg_1=arg_1)\n            arg_5 = Func.add_subparsers()\n\n            for arg_6, arg_7 in arg_2.items():\n                arg_6 = arg_6.replace(\"_\", \"-\")\n                arg_8 = inspect.getdoc(arg_7)\n                arg_9 = arg_5.add_parser(\n                    arg_6,\n                    arg_7=arg_7,\n                    help=arg_8\n                )\n\n        else:\n            Func = Parser(arg_7=arg_0.callbacks[arg_0.function_name], arg_1=arg_1)\n\n        return Func", "path": "captain/__init__.py", "identifier": "Script.parser", "docstring": "return the parser for the current name", "docstring_tokens": ["return", "the", "parser", "for", "the", "current", "name"], "nwo": "Jaymon/captain", "score": 0.23137166388621372, "idx": 260412}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L77-L89", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Dictionary of actual parameters of the model.", "language": "python", "parameters": "(self)", "return_statement": "return params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"model_id\"", ":", "\"name\"", ",", "\"response_column\"", ":", "\"column_name\"", ",", "\"training_frame\"", ":", "\"name\"", ",", "\"validation_frame\"", ":", "\"name\"", "}", "arg_2", "=", "{", "}", "for", "arg_3", "in", "arg_0", ".", "parms", ":", "if", "arg_3", "in", "arg_1", ".", "keys", "(", ")", ":", "arg_2", "[", "arg_3", "]", "=", "arg_0", ".", "parms", "[", "arg_3", "]", "[", "\"actual_value\"", "]", ".", "get", "(", "arg_1", "[", "arg_3", "]", ",", "None", ")", "else", ":", "arg_2", "[", "arg_3", "]", "=", "arg_0", ".", "parms", "[", "arg_3", "]", "[", "\"actual_value\"", "]", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"Dictionary of actual parameters of the model.\"\"\"\n        arg_1 = {\"model_id\": \"name\",\n                            \"response_column\": \"column_name\",\n                            \"training_frame\": \"name\",\n                            \"validation_frame\": \"name\"}\n        arg_2 = {}\n        for arg_3 in arg_0.parms:\n            if arg_3 in arg_1.keys():\n                arg_2[arg_3] = arg_0.parms[arg_3][\"actual_value\"].get(arg_1[arg_3], None)\n            else:\n                arg_2[arg_3] = arg_0.parms[arg_3][\"actual_value\"]\n        return arg_2", "path": "h2o-py/h2o/model/model_base.py", "identifier": "ModelBase.actual_params", "docstring": "Dictionary of actual parameters of the model.", "docstring_tokens": ["Dictionary", "of", "actual", "parameters", "of", "the", "model", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260413}
{"url": "https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/connection.py#L113-L139", "sha": "b9fc7e258a79551c9ed61e4a71668b7f06f9e774", "docstring_summary": "List all hosted zones associated with this connection's account. Since\n        this method returns a generator, you can pull as many or as few\n        entries as you'd like, without having to query and receive every\n        hosted zone you may have.", "language": "python", "parameters": "(self, page_chunks=100)", "return_statement": "return  self._do_autopaginating_api_call(\n            path='hostedzone',\n            params={'maxitems': page_chunks},\n            method='GET',\n            parser_func=xml_parsers.list_hosted_zones_parser,\n            next_marker_xpath=\"./{*}NextMarker\",\n            next_marker_param_name=\"marker\",\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "100", ")", ":", "return", "arg_0", ".", "_do_autopaginating_api_call", "(", "path", "=", "'hostedzone'", ",", "params", "=", "{", "'maxitems'", ":", "arg_1", "}", ",", "method", "=", "'GET'", ",", "parser_func", "=", "xml_parsers", ".", "Func_parser", ",", "next_marker_xpath", "=", "\"./{*}NextMarker\"", ",", "next_marker_param_name", "=", "\"marker\"", ",", ")"], "function": "def Func(arg_0, arg_1=100):\n        \"\"\"\n        List all hosted zones associated with this connection's account. Since\n        this method returns a generator, you can pull as many or as few\n        entries as you'd like, without having to query and receive every\n        hosted zone you may have.\n\n        :keyword int page_chunks: This API call is \"paginated\" behind-the-scenes\n            in order to break up large result sets. This number determines\n            the maximum number of\n            :py:class:`HostedZone <route53.hosted_zone.HostedZone>`\n            instances to retrieve per request. The default is fine for almost\n            everyone.\n\n        :rtype: generator\n        :returns: A generator of :py:class:`HostedZone <route53.hosted_zone.HostedZone>`\n            instances.\n        \"\"\"\n\n        return  arg_0._do_autopaginating_api_call(\n            path='hostedzone',\n            params={'maxitems': arg_1},\n            method='GET',\n            parser_func=xml_parsers.Func_parser,\n            next_marker_xpath=\"./{*}NextMarker\",\n            next_marker_param_name=\"marker\",\n        )", "path": "route53/connection.py", "identifier": "Route53Connection.list_hosted_zones", "docstring": "List all hosted zones associated with this connection's account. Since\n        this method returns a generator, you can pull as many or as few\n        entries as you'd like, without having to query and receive every\n        hosted zone you may have.\n\n        :keyword int page_chunks: This API call is \"paginated\" behind-the-scenes\n            in order to break up large result sets. This number determines\n            the maximum number of\n            :py:class:`HostedZone <route53.hosted_zone.HostedZone>`\n            instances to retrieve per request. The default is fine for almost\n            everyone.\n\n        :rtype: generator\n        :returns: A generator of :py:class:`HostedZone <route53.hosted_zone.HostedZone>`\n            instances.", "docstring_tokens": ["List", "all", "hosted", "zones", "associated", "with", "this", "connection", "s", "account", ".", "Since", "this", "method", "returns", "a", "generator", "you", "can", "pull", "as", "many", "or", "as", "few", "entries", "as", "you", "d", "like", "without", "having", "to", "query", "and", "receive", "every", "hosted", "zone", "you", "may", "have", "."], "nwo": "gtaylor/python-route53", "score": 0.19099661306507362, "idx": 260414}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L157-L163", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return a class by its name, raise KeyError if not found", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "Funcs", "(", ")", ":", "if", "arg_2", ".", "node", ".", "name", "==", "arg_1", ":", "return", "arg_2", "raise", "KeyError", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"return a class by its name, raise KeyError if not found\n        \"\"\"\n        for arg_2 in arg_0.Funcs():\n            if arg_2.node.name == arg_1:\n                return arg_2\n        raise KeyError(arg_1)", "path": "pylint/pyreverse/diagrams.py", "identifier": "ClassDiagram.classe", "docstring": "return a class by its name, raise KeyError if not found", "docstring_tokens": ["return", "a", "class", "by", "its", "name", "raise", "KeyError", "if", "not", "found"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260415}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/templating.py#L108-L112", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Renders the template and fires the signal", "language": "python", "parameters": "(template, context, app)", "return_statement": "return rv", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "render", "(", "arg_1", ")", "templateFunced", ".", "send", "(", "arg_2", ",", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Renders the template and fires the signal\"\"\"\n    arg_3 = arg_0.render(arg_1)\n    templateFunced.send(arg_2, arg_0=arg_0, arg_1=arg_1)\n    return arg_3", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/templating.py", "identifier": "_render", "docstring": "Renders the template and fires the signal", "docstring_tokens": ["Renders", "the", "template", "and", "fires", "the", "signal"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260416}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/utils.py#L36-L58", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Parse a list of validator names or n-tuples, checking for errors.", "language": "python", "parameters": "(valids)", "return_statement": "return outvals", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_3", "=", "[", "]", "elif", "len", "(", "arg_2", ")", ">", "1", ":", "arg_3", "=", "arg_2", "[", "1", ":", "]", "arg_2", "=", "arg_2", "[", "0", "]", "else", ":", "raise", "ValidationError", "(", "\"You must pass either an n-tuple or a string to define a validator\"", ",", "validator", "=", "arg_2", ")", "arg_4", "=", "\"validate_%s\"", "%", "str", "(", "arg_2", ")", "arg_1", ".", "append", "(", "(", "arg_4", ",", "arg_3", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parse a list of validator names or n-tuples, checking for errors.\n\n    Returns:\n        list((func_name, [args...])): A list of validator function names and a\n            potentially empty list of optional parameters for each function.\n    \"\"\"\n\n    arg_1 = []\n\n    for arg_2 in arg_0:\n        if isinstance(arg_2, str):\n            arg_3 = []\n        elif len(arg_2) > 1:\n            arg_3 = arg_2[1:]\n            arg_2 = arg_2[0]\n        else:\n            raise ValidationError(\"You must pass either an n-tuple or a string to define a validator\", validator=arg_2)\n\n        arg_4 = \"validate_%s\" % str(arg_2)\n        arg_1.append((arg_4, arg_3))\n\n    return arg_1", "path": "typedargs/utils.py", "identifier": "_parse_validators", "docstring": "Parse a list of validator names or n-tuples, checking for errors.\n\n    Returns:\n        list((func_name, [args...])): A list of validator function names and a\n            potentially empty list of optional parameters for each function.", "docstring_tokens": ["Parse", "a", "list", "of", "validator", "names", "or", "n", "-", "tuples", "checking", "for", "errors", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 260417}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/util.py#L793-L805", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Read the file and perform any transforms to get a loaded image", "language": "python", "parameters": "(self)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "initializers", ".", "load_tiff", "(", "arg_0", ".", "filename", ")", "arg_1", "=", "initializers", ".", "normalize", "(", "arg_1", ",", "invert", "=", "arg_0", ".", "invert", ",", "scale", "=", "arg_0", ".", "exposure", ",", "dtype", "=", "arg_0", ".", "float_precision", ")", "except", "IOError", "as", "e", ":", "log", ".", "error", "(", "\"Could not find image '%s'\"", "%", "arg_0", ".", "filename", ")", "raise", "e", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Read the file and perform any transforms to get a loaded image \"\"\"\n        try:\n            arg_1 = initializers.load_tiff(arg_0.filename)\n            arg_1 = initializers.normalize(\n                arg_1, invert=arg_0.invert, scale=arg_0.exposure,\n                dtype=arg_0.float_precision\n            )\n        except IOError as e:\n            log.error(\"Could not find image '%s'\" % arg_0.filename)\n            raise e\n\n        return arg_1", "path": "peri/util.py", "identifier": "RawImage.load_image", "docstring": "Read the file and perform any transforms to get a loaded image", "docstring_tokens": ["Read", "the", "file", "and", "perform", "any", "transforms", "to", "get", "a", "loaded", "image"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260418}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/batchoperations.py#L27-L53", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Begin processing a batch operations request.", "language": "python", "parameters": "(self, data)", "return_statement": "return self._mc_client._post(url=self._build_path(), data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'operations'", "not", "in", "arg_1", ":", "raise", "KeyError", "(", "'The batch must have operations'", ")", "for", "arg_2", "in", "arg_1", "[", "'operations'", "]", ":", "if", "'method'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The batch operation must have a method'", ")", "if", "arg_2", "[", "'method'", "]", "not", "in", "[", "'GET'", ",", "'POST'", ",", "'PUT'", ",", "'PATCH'", ",", "'DELETE'", "]", ":", "raise", "ValueError", "(", "'The batch operation method must be one of \"GET\", \"POST\", \"PUT\", \"PATCH\", '", "'or \"DELETE\", not {0}'", ".", "format", "(", "arg_2", "[", "'method'", "]", ")", ")", "if", "'path'", "not", "in", "arg_2", ":", "raise", "KeyError", "(", "'The batch operation must have a path'", ")", "return", "arg_0", ".", "_mc_client", ".", "_post", "(", "url", "=", "arg_0", ".", "_build_path", "(", ")", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Begin processing a batch operations request.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"operations\": array*\n            [\n                {\n                    \"method\": string* (Must be one of \"GET\", \"POST\", \"PUT\", \"PATCH\", or \"DELETE\")\n                    \"path\": string*,\n                }\n            ]\n        }\n        \"\"\"\n        if 'operations' not in arg_1:\n            raise KeyError('The batch must have operations')\n        for arg_2 in arg_1['operations']:\n            if 'method' not in arg_2:\n                raise KeyError('The batch operation must have a method')\n            if arg_2['method'] not in ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']:\n                raise ValueError('The batch operation method must be one of \"GET\", \"POST\", \"PUT\", \"PATCH\", '\n                                 'or \"DELETE\", not {0}'.format(arg_2['method']))\n            if 'path' not in arg_2:\n                raise KeyError('The batch operation must have a path')\n        return arg_0._mc_client._post(url=arg_0._build_path(), arg_1=arg_1)", "path": "mailchimp3/entities/batchoperations.py", "identifier": "BatchOperations.create", "docstring": "Begin processing a batch operations request.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"operations\": array*\n            [\n                {\n                    \"method\": string* (Must be one of \"GET\", \"POST\", \"PUT\", \"PATCH\", or \"DELETE\")\n                    \"path\": string*,\n                }\n            ]\n        }", "docstring_tokens": ["Begin", "processing", "a", "batch", "operations", "request", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 260419}
{"url": "https://github.com/blink1073/oct2py/blob/bfc69d2168ae3d98258f95bbc55a858c21836b58/oct2py/dynamic.py#L177-L184", "sha": "bfc69d2168ae3d98258f95bbc55a858c21836b58", "docstring_summary": "This is how an instance is created when we read a\n           MatlabObject from a MAT file.", "language": "python", "parameters": "(cls, value)", "return_statement": "return instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "OctaveUserClass", ".", "__new__", "(", "arg_0", ")", "arg_2", ".", "_address", "=", "'%s_%s'", "%", "(", "arg_2", ".", "_name", ",", "id", "(", "arg_2", ")", ")", "arg_2", ".", "_ref", "(", ")", ".", "push", "(", "arg_2", ".", "_address", ",", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"This is how an instance is created when we read a\n           MatlabObject from a MAT file.\n        \"\"\"\n        arg_2 = OctaveUserClass.__new__(arg_0)\n        arg_2._address = '%s_%s' % (arg_2._name, id(arg_2))\n        arg_2._ref().push(arg_2._address, arg_1)\n        return arg_2", "path": "oct2py/dynamic.py", "identifier": "OctaveUserClass.from_value", "docstring": "This is how an instance is created when we read a\n           MatlabObject from a MAT file.", "docstring_tokens": ["This", "is", "how", "an", "instance", "is", "created", "when", "we", "read", "a", "MatlabObject", "from", "a", "MAT", "file", "."], "nwo": "blink1073/oct2py", "score": 0.3484138981803976, "idx": 260420}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/fortney2k7.py#L521-L578", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This function gets the Fortney mass-radius relation for planets.", "language": "python", "parameters": "(age, planetdist, coremass,\n               mass='massjupiter',\n               radius='radiusjupiter')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'massjupiter'", ",", "arg_4", "=", "'radiusjupiter'", ")", ":", "arg_5", "=", "{", "0.3", ":", "MASSESRADII_0_3GYR", ",", "1.0", ":", "MASSESRADII_1_0GYR", ",", "4.5", ":", "MASSESRADII_4_5GYR", "}", "if", "arg_0", "not", "in", "arg_5", ":", "print", "(", "'given age not in Fortney 2007, returning...'", ")", "return", "Func", "=", "arg_5", "[", "arg_0", "]", "if", "(", "arg_1", "in", "Func", ")", "and", "(", "arg_2", "in", "Func", "[", "arg_1", "]", ")", ":", "print", "(", "'getting % Gyr M-R for planet dist %s AU, '", "'core mass %s Mearth...'", "%", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", "arg_7", "=", "Func", "[", "arg_1", "]", "[", "arg_2", "]", "arg_8", "=", "{", "'mass'", ":", "array", "(", "arg_7", "[", "arg_3", "]", ")", ",", "'radius'", ":", "array", "(", "arg_7", "[", "arg_4", "]", ")", "}", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2,\n               arg_3='massjupiter',\n               arg_4='radiusjupiter'):\n    '''This function gets the Fortney mass-radius relation for planets.\n\n    Parameters\n    ----------\n\n    age : float\n        This should be one of: 0.3, 1.0, 4.5 [in Gyr].\n\n    planetdist : float\n        This should be one of: 0.02, 0.045, 0.1, 1.0, 9.5 [in AU]\n\n    coremass : int\n        This should be one of: 0, 10, 25, 50, 100 [in Mearth]\n\n    mass : {'massjupiter','massearth'}\n        Sets the mass units.\n\n    radius : str\n        Sets the radius units. Only 'radiusjupiter' is used for now.\n\n    Returns\n    -------\n\n    dict\n        A dict of the following form is returned::\n\n            {'mass': an array containing the masses to plot),\n             'radius': an array containing the radii to plot}\n\n        These can be passed to a plotting routine to make mass-radius plot for\n        the specified age, planet-star distance, and core-mass.\n\n    '''\n\n    arg_5 = {0.3:MASSESRADII_0_3GYR,\n          1.0:MASSESRADII_1_0GYR,\n          4.5:MASSESRADII_4_5GYR}\n\n    if arg_0 not in arg_5:\n        print('given age not in Fortney 2007, returning...')\n        return\n\n    Func = arg_5[arg_0]\n\n    if (arg_1 in Func) and (arg_2 in Func[arg_1]):\n\n        print('getting % Gyr M-R for planet dist %s AU, '\n              'core mass %s Mearth...' % (arg_0, arg_1, arg_2))\n\n        arg_7 = Func[arg_1][arg_2]\n\n        arg_8 = {'mass':array(arg_7[arg_3]),\n                   'radius':array(arg_7[arg_4])}\n\n        return arg_8", "path": "astrobase/services/fortney2k7.py", "identifier": "massradius", "docstring": "This function gets the Fortney mass-radius relation for planets.\n\n    Parameters\n    ----------\n\n    age : float\n        This should be one of: 0.3, 1.0, 4.5 [in Gyr].\n\n    planetdist : float\n        This should be one of: 0.02, 0.045, 0.1, 1.0, 9.5 [in AU]\n\n    coremass : int\n        This should be one of: 0, 10, 25, 50, 100 [in Mearth]\n\n    mass : {'massjupiter','massearth'}\n        Sets the mass units.\n\n    radius : str\n        Sets the radius units. Only 'radiusjupiter' is used for now.\n\n    Returns\n    -------\n\n    dict\n        A dict of the following form is returned::\n\n            {'mass': an array containing the masses to plot),\n             'radius': an array containing the radii to plot}\n\n        These can be passed to a plotting routine to make mass-radius plot for\n        the specified age, planet-star distance, and core-mass.", "docstring_tokens": ["This", "function", "gets", "the", "Fortney", "mass", "-", "radius", "relation", "for", "planets", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 260421}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Record.py#L85-L92", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Destroy the record", "language": "python", "parameters": "(self)", "return_statement": "return self.get_data(\n            \"domains/%s/records/%s\" % (self.domain, self.id),\n            type=DELETE,\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "get_data", "(", "\"domains/%s/records/%s\"", "%", "(", "arg_0", ".", "domain", ",", "arg_0", ".", "id", ")", ",", "type", "=", "DELETE", ",", ")"], "function": "def Func(arg_0):\n        \"\"\"\n            Destroy the record\n        \"\"\"\n        return arg_0.get_data(\n            \"domains/%s/records/%s\" % (arg_0.domain, arg_0.id),\n            type=DELETE,\n        )", "path": "digitalocean/Record.py", "identifier": "Record.destroy", "docstring": "Destroy the record", "docstring_tokens": ["Destroy", "the", "record"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 260422}
{"url": "https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L40-L49", "sha": "9951a910750888dbe7dd3e98acae9c40efae0689", "docstring_summary": "interface helper function", "language": "python", "parameters": "(cls, name, method: [str, Set, List], url=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ":", "[", "arg_3", ",", "arg_4", ",", "arg_5", "]", ",", "arg_6", "=", "None", ")", ":", "if", "not", "isinstance", "(", "arg_2", ",", "(", "arg_3", ",", "list", ",", "set", ",", "tuple", ")", ")", ":", "raise", "BaseException", "(", "'Invalid type of method: %s'", "%", "type", "(", "arg_2", ")", ".", "__name__", ")", "if", "isinstance", "(", "arg_2", ",", "arg_3", ")", ":", "arg_2", "=", "{", "arg_2", "}", "arg_0", ".", "_interface", "[", "arg_1", "]", "=", "[", "{", "'method'", ":", "arg_2", ",", "'url'", ":", "arg_6", "}", "]"], "function": "def Func(arg_0, arg_1, arg_2: [arg_3, arg_4, arg_5], arg_6=None):\n        \"\"\" interface helper function\"\"\"\n        if not isinstance(arg_2, (arg_3, list, set, tuple)):\n            raise BaseException('Invalid type of method: %s' % type(arg_2).__name__)\n\n        if isinstance(arg_2, arg_3):\n            arg_2 = {arg_2}\n\n        # TODO: check methods available\n        arg_0._interface[arg_1] = [{'method': arg_2, 'url': arg_6}]", "path": "slim/base/view.py", "identifier": "BaseView.use", "docstring": "interface helper function", "docstring_tokens": ["interface", "helper", "function"], "nwo": "fy0/slim", "score": 0.4510247159119153, "idx": 260423}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1714-L1733", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Convert an OpenSSL native context error failure into a Python\n        exception.", "language": "python", "parameters": "(self)", "return_statement": "return X509StoreContextError(errors, pycert)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "_lib", ".", "X509_STORE_CTX_get_error", "(", "arg_0", ".", "_store_ctx", ")", ",", "_lib", ".", "X509_STORE_CTX_get_error_depth", "(", "arg_0", ".", "_store_ctx", ")", ",", "_native", "(", "_ffi", ".", "string", "(", "_lib", ".", "X509_verify_cert_error_string", "(", "_lib", ".", "X509_STORE_CTX_get_error", "(", "arg_0", ".", "_store_ctx", ")", ")", ")", ")", ",", "]", "arg_2", "=", "_lib", ".", "X509_STORE_CTX_get_current_cert", "(", "arg_0", ".", "_store_ctx", ")", "arg_3", "=", "_lib", ".", "X509_dup", "(", "arg_2", ")", "arg_4", "=", "X509", ".", "_from_raw_x509_ptr", "(", "arg_3", ")", "return", "X509StoreContextError", "(", "arg_1", ",", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Convert an OpenSSL native context error failure into a Python\n        exception.\n\n        When a call to native OpenSSL X509_verify_cert fails, additional\n        information about the failure can be obtained from the store context.\n        \"\"\"\n        arg_1 = [\n            _lib.X509_STORE_CTX_get_error(arg_0._store_ctx),\n            _lib.X509_STORE_CTX_get_error_depth(arg_0._store_ctx),\n            _native(_ffi.string(_lib.X509_verify_cert_error_string(\n                _lib.X509_STORE_CTX_get_error(arg_0._store_ctx)))),\n        ]\n        # A context error should always be associated with a certificate, so we\n        # expect this call to never return :class:`None`.\n        arg_2 = _lib.X509_STORE_CTX_get_current_cert(arg_0._store_ctx)\n        arg_3 = _lib.X509_dup(arg_2)\n        arg_4 = X509._from_raw_x509_ptr(arg_3)\n        return X509StoreContextError(arg_1, arg_4)", "path": "src/OpenSSL/crypto.py", "identifier": "X509StoreContext._exception_from_context", "docstring": "Convert an OpenSSL native context error failure into a Python\n        exception.\n\n        When a call to native OpenSSL X509_verify_cert fails, additional\n        information about the failure can be obtained from the store context.", "docstring_tokens": ["Convert", "an", "OpenSSL", "native", "context", "error", "failure", "into", "a", "Python", "exception", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 260424}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L16-L30", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Checks if one the parameters in `group_node` is explored.", "language": "python", "parameters": "(traj, group_node)", "return_statement": "return explored", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "for", "arg_3", "in", "arg_0", ".", "f_get_explored_parameters", "(", ")", ":", "if", "arg_3", "in", "arg_1", ":", "arg_2", "=", "True", "break", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Checks if one the parameters in `group_node` is explored.\n\n    :param traj: Trajectory container\n    :param group_node: Group node\n    :return: `True` or `False`\n\n    \"\"\"\n    arg_2 = False\n    for arg_3 in arg_0.f_get_explored_parameters():\n            if arg_3 in arg_1:\n                arg_2 = True\n                break\n\n    return arg_2", "path": "examples/example_24_large_scale_brian2_simulation/clusternet.py", "identifier": "_explored_parameters_in_group", "docstring": "Checks if one the parameters in `group_node` is explored.\n\n    :param traj: Trajectory container\n    :param group_node: Group node\n    :return: `True` or `False`", "docstring_tokens": ["Checks", "if", "one", "the", "parameters", "in", "group_node", "is", "explored", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260425}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L338-L370", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Retrieves the number of commits to a repo in the organization. If it is\n        the first time getting commits for a repo, it will get all commits and\n        save them to JSON. If there are previous commits saved, it will only get\n        commits that have not been saved to disk since the last date of commits.", "language": "python", "parameters": "(self, repo, organization='llnl')", "return_statement": "return count", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'llnl'", ")", ":", "arg_3", "=", "(", "'../github-data/'", "+", "arg_2", "+", "'/'", "+", "arg_1", ".", "name", "+", "'/commits'", ")", "arg_4", "=", "False", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_3", ")", ":", "arg_5", "=", "arg_1", ".", "iter_commits", "(", ")", "arg_4", "=", "True", "else", ":", "arg_6", "=", "os", ".", "listdir", "(", "arg_3", ")", "arg_7", "=", "str", "(", "arg_6", "[", "-", "1", "]", "[", ":", "-", "5", "]", ")", "if", "arg_7", "==", "str", "(", "datetime", ".", "date", ".", "today", "(", ")", ")", ":", "if", "len", "(", "arg_6", ")", ">", "2", ":", "arg_7", "=", "str", "(", "arg_6", "[", "-", "2", "]", "[", ":", "-", "5", "]", ")", "else", ":", "arg_5", "=", "arg_1", ".", "iter_commits", "(", ")", "arg_4", "=", "True", "if", "not", "arg_4", ":", "arg_5", "=", "arg_1", ".", "iter_commits", "(", "since", "=", "arg_7", ")", "for", "arg_8", "in", "arg_5", ":", "arg_0", ".", "commits_json", "[", "arg_1", ".", "name", "]", ".", "append", "(", "arg_8", ".", "to_json", "(", ")", ")", "arg_9", "=", "0", "for", "arg_8", "in", "arg_1", ".", "iter_commits", "(", ")", ":", "arg_9", "+=", "1", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2='llnl'):\n        \"\"\"\n        Retrieves the number of commits to a repo in the organization. If it is\n        the first time getting commits for a repo, it will get all commits and\n        save them to JSON. If there are previous commits saved, it will only get\n        commits that have not been saved to disk since the last date of commits.\n        \"\"\"\n        #JSON\n        arg_3 = ('../github-data/' + arg_2 + '/' + arg_1.name + '/commits')\n        arg_4 = False\n        if not os.path.exists(arg_3): #no previous path, get all commits\n            arg_5 = arg_1.iter_commits()\n            arg_4 = True\n        else:\n            arg_6 = os.listdir(arg_3)\n            arg_7 = str(arg_6[-1][:-5])\n            if arg_7 == str(datetime.date.today()):\n                #most recent date is actually today, get previous most recent date\n                if len(arg_6) > 2:\n                    arg_7 = str(arg_6[-2][:-5])\n                else:\n                    #This means there is only one file, today. Retrieve every commit\n                    arg_5 = arg_1.iter_commits()\n                    arg_4 = True\n            if not arg_4:#there's a previous saved JSON that's not today\n                arg_5 = arg_1.iter_commits(since=arg_7)\n        for arg_8 in arg_5:\n            arg_0.commits_json[arg_1.name].append(arg_8.to_json())\n        #for csv\n        arg_9 = 0\n        for arg_8 in arg_1.iter_commits():\n            arg_9 += 1\n        return arg_9", "path": "scripts/github_stats.py", "identifier": "GitHub_LLNL_Stats.get_commits", "docstring": "Retrieves the number of commits to a repo in the organization. If it is\n        the first time getting commits for a repo, it will get all commits and\n        save them to JSON. If there are previous commits saved, it will only get\n        commits that have not been saved to disk since the last date of commits.", "docstring_tokens": ["Retrieves", "the", "number", "of", "commits", "to", "a", "repo", "in", "the", "organization", ".", "If", "it", "is", "the", "first", "time", "getting", "commits", "for", "a", "repo", "it", "will", "get", "all", "commits", "and", "save", "them", "to", "JSON", ".", "If", "there", "are", "previous", "commits", "saved", "it", "will", "only", "get", "commits", "that", "have", "not", "been", "saved", "to", "disk", "since", "the", "last", "date", "of", "commits", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 260426}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L307-L327", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return line with imports on separate lines.", "language": "python", "parameters": "(line)", "return_statement": "return ''.join([indentation + i.strip() + newline\n                    for i in sorted(imports.split(','))])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "'\\\\'", "not", "in", "arg_0", "assert", "'('", "not", "in", "arg_0", "assert", "')'", "not", "in", "arg_0", "assert", "';'", "not", "in", "arg_0", "assert", "'#'", "not", "in", "arg_0", "assert", "not", "arg_0", ".", "lstrip", "(", ")", ".", "startswith", "(", "'from'", ")", "arg_1", "=", "get_line_ending", "(", "arg_0", ")", "if", "not", "arg_1", ":", "return", "arg_0", "(", "arg_2", ",", "arg_3", ")", "=", "re", ".", "split", "(", "pattern", "=", "r'\\bimport\\b'", ",", "string", "=", "arg_0", ",", "maxsplit", "=", "1", ")", "arg_2", "+=", "'import '", "assert", "arg_1", "return", "''", ".", "join", "(", "[", "arg_2", "+", "arg_4", ".", "strip", "(", ")", "+", "arg_1", "for", "arg_4", "in", "sorted", "(", "arg_3", ".", "split", "(", "','", ")", ")", "]", ")"], "function": "def Func(arg_0):\n    \"\"\"Return line with imports on separate lines.\"\"\"\n    assert '\\\\' not in arg_0\n    assert '(' not in arg_0\n    assert ')' not in arg_0\n    assert ';' not in arg_0\n    assert '#' not in arg_0\n    assert not arg_0.lstrip().startswith('from')\n\n    arg_1 = get_line_ending(arg_0)\n    if not arg_1:\n        return arg_0\n\n    (arg_2, arg_3) = re.split(pattern=r'\\bimport\\b',\n                                      string=arg_0, maxsplit=1)\n\n    arg_2 += 'import '\n    assert arg_1\n\n    return ''.join([arg_2 + arg_4.strip() + arg_1\n                    for arg_4 in sorted(arg_3.split(','))])", "path": "autoflake.py", "identifier": "break_up_import", "docstring": "Return line with imports on separate lines.", "docstring_tokens": ["Return", "line", "with", "imports", "on", "separate", "lines", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 260427}
{"url": "https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/savemat.py#L207-L225", "sha": "6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1", "docstring_summary": "Write the numeric array", "language": "python", "parameters": "(fd, header, array)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "BytesIO", "(", ")", "write_var_header", "(", "arg_3", ",", "arg_1", ")", "if", "not", "isinstance", "(", "arg_2", ",", "basestring", ")", "and", "arg_1", "[", "'dims'", "]", "[", "0", "]", ">", "1", ":", "arg_2", "=", "list", "(", "chain", ".", "from_iterable", "(", "izip", "(", "*", "arg_2", ")", ")", ")", "write_elements", "(", "arg_3", ",", "arg_1", "[", "'mtp'", "]", ",", "arg_2", ")", "arg_4", "=", "arg_3", ".", "getvalue", "(", ")", "arg_3", ".", "close", "(", ")", "write_var_data", "(", "arg_0", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Write the numeric array\"\"\"\n    # make a memory file for writing array data\n    arg_3 = BytesIO()\n\n    # write matrix header to memory file\n    write_var_header(arg_3, arg_1)\n\n    if not isinstance(arg_2, basestring) and arg_1['dims'][0] > 1:\n        # list array data in column major order\n        arg_2 = list(chain.from_iterable(izip(*arg_2)))\n\n    # write matrix data to memory file\n    write_elements(arg_3, arg_1['mtp'], arg_2)\n\n    # write the variable to disk file\n    arg_4 = arg_3.getvalue()\n    arg_3.close()\n    write_var_data(arg_0, arg_4)", "path": "mat4py/savemat.py", "identifier": "write_numeric_array", "docstring": "Write the numeric array", "docstring_tokens": ["Write", "the", "numeric", "array"], "nwo": "nephics/mat4py", "score": 0.3187018950262521, "idx": 260428}
{"url": "https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/metrics/metric.py#L549-L560", "sha": "261e2c0760fd6a6b0ee59064180bd8e3674311fe", "docstring_summary": "check whether the given sub metric is in important_sub_metrics list", "language": "python", "parameters": "(self, sub_metric)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "important_sub_metrics", ":", "return", "False", "if", "arg_1", "in", "arg_0", ".", "important_sub_metrics", ":", "return", "True", "arg_2", "=", "arg_1", ".", "split", "(", "'.'", ")", "if", "arg_2", "[", "-", "1", "]", "in", "arg_0", ".", "important_sub_metrics", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    check whether the given sub metric is in important_sub_metrics list\n    \"\"\"\n    if not arg_0.important_sub_metrics:\n      return False\n    if arg_1 in arg_0.important_sub_metrics:\n      return True\n    arg_2 = arg_1.split('.')\n    if arg_2[-1] in arg_0.important_sub_metrics:\n      return True\n    return False", "path": "src/naarad/metrics/metric.py", "identifier": "Metric.check_important_sub_metrics", "docstring": "check whether the given sub metric is in important_sub_metrics list", "docstring_tokens": ["check", "whether", "the", "given", "sub", "metric", "is", "in", "important_sub_metrics", "list"], "nwo": "linkedin/naarad", "score": 0.34903059417921767, "idx": 260429}
{"url": "https://github.com/accraze/pymtranslate/blob/b18f9d7e8ef1583c988e8beb6c3304d362a4d979/pymtranslate/translator.py#L31-L42", "sha": "b18f9d7e8ef1583c988e8beb6c3304d362a4d979", "docstring_summary": "pass in a word string that you\n        would like to see probable matches for.", "language": "python", "parameters": "(self, word)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "arg_1", "not", "in", "arg_0", ".", "transmissions", ")", ":", "raise", "NoMatchError", "(", "'no matches found'", ")", "else", ":", "arg_2", "=", "arg_0", ".", "transmissions", "[", "arg_1", "]", "return", "sorted", "(", "(", "(", "arg_3", ",", "arg_4", ")", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "iteritems", "(", ")", "if", "arg_4", "!=", "0", ")", ",", "reverse", "=", "True", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        pass in a word string that you\n        would like to see probable matches for.\n        \"\"\"\n        if (arg_1 not in arg_0.transmissions):\n            raise NoMatchError('no matches found')\n        else:\n            arg_2 = arg_0.transmissions[arg_1]\n            # print out a sorted list of all non-zero trans\n            return sorted(((arg_3, arg_4) for arg_3, arg_4 in arg_2.iteritems() if arg_4 != 0), \n                                                                reverse=True)", "path": "pymtranslate/translator.py", "identifier": "Translator.translate", "docstring": "pass in a word string that you\n        would like to see probable matches for.", "docstring_tokens": ["pass", "in", "a", "word", "string", "that", "you", "would", "like", "to", "see", "probable", "matches", "for", "."], "nwo": "accraze/pymtranslate", "score": 0.24979334806965703, "idx": 260430}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L337-L343", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Check if record is deleted.", "language": "python", "parameters": "(self, record=None)", "return_statement": "return any(\n            col == 'deleted'\n            for col in record.get('collections', [])\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "arg_0", ".", "revisions", "[", "-", "1", "]", "[", "1", "]", "return", "any", "(", "arg_2", "==", "'deleted'", "for", "arg_2", "in", "arg_1", ".", "get", "(", "'collections'", ",", "[", "]", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Check if record is deleted.\"\"\"\n        arg_1 = arg_1 or arg_0.revisions[-1][1]\n        return any(\n            arg_2 == 'deleted'\n            for arg_2 in arg_1.get('collections', [])\n        )", "path": "invenio_migrator/records.py", "identifier": "RecordDump.is_deleted", "docstring": "Check if record is deleted.", "docstring_tokens": ["Check", "if", "record", "is", "deleted", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 260431}
{"url": "https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/rich_content.py#L126-L135", "sha": "f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c", "docstring_summary": "Returns list of MS Bot Framework compatible states of the\n        RichMessage instance nested controls.", "language": "python", "parameters": "(self)", "return_statement": "return ms_bf_controls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "list", ":", "arg_1", "=", "[", "control", ".", "Func", "(", ")", "for", "control", "in", "arg_0", ".", "controls", "]", "return", "arg_1"], "function": "def Func(arg_0) -> list:\n        \"\"\"Returns list of MS Bot Framework compatible states of the\n        RichMessage instance nested controls.\n\n        Returns:\n            ms_bf_controls: MS Bot Framework representation of RichMessage instance\n                nested controls.\n        \"\"\"\n        arg_1 = [control.Func() for control in arg_0.controls]\n        return arg_1", "path": "deeppavlov/core/agent/rich_content.py", "identifier": "RichMessage.ms_bot_framework", "docstring": "Returns list of MS Bot Framework compatible states of the\n        RichMessage instance nested controls.\n\n        Returns:\n            ms_bf_controls: MS Bot Framework representation of RichMessage instance\n                nested controls.", "docstring_tokens": ["Returns", "list", "of", "MS", "Bot", "Framework", "compatible", "states", "of", "the", "RichMessage", "instance", "nested", "controls", "."], "nwo": "deepmipt/DeepPavlov", "score": 0.9928107156012591, "idx": 260432}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L190-L207", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Wrapper function for scoop, that does not configure logging", "language": "python", "parameters": "(kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "try", ":", "arg_1", "=", "scoop", ".", "IS_ORIGIN", "except", "AttributeError", ":", "arg_1", "=", "True", "if", "not", "arg_1", ":", "_configure_niceness", "(", "arg_0", ")", "_configure_logging", "(", "arg_0", ")", "return", "_single_run", "(", "arg_0", ")", "except", "Exception", ":", "scoop", ".", "logger", ".", "exception", "(", "'ERROR occurred during a single run!'", ")", "raise"], "function": "def Func(arg_0):\n    \"\"\"Wrapper function for scoop, that does not configure logging\"\"\"\n    try:\n        try:\n            arg_1 = scoop.IS_ORIGIN\n        except AttributeError:\n            # scoop is not properly started, i.e. with `python -m scoop...`\n            # in this case scoop uses default `map` function, i.e.\n            # the main process\n            arg_1 = True\n        if not arg_1:\n            # configure logging and niceness if not the main process:\n            _configure_niceness(arg_0)\n            _configure_logging(arg_0)\n        return _single_run(arg_0)\n    except Exception:\n        scoop.logger.exception('ERROR occurred during a single run!')\n        raise", "path": "pypet/environment.py", "identifier": "_scoop_single_run", "docstring": "Wrapper function for scoop, that does not configure logging", "docstring_tokens": ["Wrapper", "function", "for", "scoop", "that", "does", "not", "configure", "logging"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260433}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/objs.py#L848-L864", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Generate the composite rotation matrix that rotates the slab normal.", "language": "python", "parameters": "(self)", "return_statement": "return np.dot(r1, r0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "param_dict", "[", "arg_0", ".", "lbl_theta", "]", "arg_2", "=", "np", ".", "array", "(", "[", "[", "np", ".", "cos", "(", "arg_1", ")", ",", "-", "np", ".", "sin", "(", "arg_1", ")", ",", "0", "]", ",", "[", "np", ".", "sin", "(", "arg_1", ")", ",", "np", ".", "cos", "(", "arg_1", ")", ",", "0", "]", ",", "[", "0", ",", "0", ",", "1", "]", "]", ")", "arg_3", "=", "arg_0", ".", "param_dict", "[", "arg_0", ".", "lbl_phi", "]", "arg_4", "=", "np", ".", "array", "(", "[", "[", "np", ".", "cos", "(", "arg_3", ")", ",", "0", ",", "np", ".", "sin", "(", "arg_3", ")", "]", ",", "[", "0", ",", "1", ",", "0", "]", ",", "[", "-", "np", ".", "sin", "(", "arg_3", ")", ",", "0", ",", "np", ".", "cos", "(", "arg_3", ")", "]", "]", ")", "return", "np", ".", "dot", "(", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Generate the composite rotation matrix that rotates the slab normal.\n\n        The rotation is a rotation about the x-axis, followed by a rotation\n        about the z-axis.\n        \"\"\"\n        arg_1 = arg_0.param_dict[arg_0.lbl_theta]\n        arg_2 = np.array([ [np.cos(arg_1),  -np.sin(arg_1), 0],\n                        [np.sin(arg_1), np.cos(arg_1), 0],\n                        [0, 0, 1]])\n\n        arg_3 = arg_0.param_dict[arg_0.lbl_phi]\n        arg_4 = np.array([ [np.cos(arg_3), 0, np.sin(arg_3)],\n                        [0, 1, 0],\n                        [-np.sin(arg_3), 0, np.cos(arg_3)]])\n        return np.dot(arg_4, arg_2)", "path": "peri/comp/objs.py", "identifier": "Slab.rmatrix", "docstring": "Generate the composite rotation matrix that rotates the slab normal.\n\n        The rotation is a rotation about the x-axis, followed by a rotation\n        about the z-axis.", "docstring_tokens": ["Generate", "the", "composite", "rotation", "matrix", "that", "rotates", "the", "slab", "normal", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260434}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L2214-L2243", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Compute a pairwise distance measure between all rows of two numeric H2OFrames.", "language": "python", "parameters": "(self, y, measure=None)", "return_statement": "return H2OFrame._expr(expr=ExprNode(\"distance\", self, y, measure))._frame()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "assert_is_type", "(", "arg_1", ",", "H2OFrame", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "\"l2\"", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", ".", "_frame", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Compute a pairwise Func measure between all rows of two numeric H2OFrames.\n\n        :param H2OFrame y: Frame containing queries (small)\n        :param str use: A string indicating what Func measure to use. Must be one of:\n\n            - ``\"l1\"``:        Absolute Func (L1-norm, >=0)\n            - ``\"l2\"``:        Euclidean Func (L2-norm, >=0)\n            - ``\"cosine\"``:    Cosine similarity (-1...1)\n            - ``\"cosine_sq\"``: Squared Cosine similarity (0...1)\n\n        :examples:\n          >>>\n          >>> iris_h2o = h2o.import_file(path=pyunit_utils.locate(\"smalldata/iris/iris.csv\"))\n          >>> references = iris_h2o[10:150,0:4\n          >>> queries    = iris_h2o[0:10,0:4]\n          >>> A = references.Func(queries, \"l1\")\n          >>> B = references.Func(queries, \"l2\")\n          >>> C = references.Func(queries, \"cosine\")\n          >>> D = references.Func(queries, \"cosine_sq\")\n          >>> E = queries.Func(references, \"l1\")\n          >>> (E.transpose() == A).all()\n\n        :returns: An H2OFrame of the matrix containing pairwise Func / similarity between the \n            rows of this frame (N x p) and ``y`` (M x p), with dimensions (N x M).\n        \"\"\"\n        assert_is_type(arg_1, H2OFrame)\n        if arg_2 is None: arg_2 = \"l2\"\n        return H2OFrame._expr(expr=ExprNode(\"Func\", arg_0, arg_1, arg_2))._frame()", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.distance", "docstring": "Compute a pairwise distance measure between all rows of two numeric H2OFrames.\n\n        :param H2OFrame y: Frame containing queries (small)\n        :param str use: A string indicating what distance measure to use. Must be one of:\n\n            - ``\"l1\"``:        Absolute distance (L1-norm, >=0)\n            - ``\"l2\"``:        Euclidean distance (L2-norm, >=0)\n            - ``\"cosine\"``:    Cosine similarity (-1...1)\n            - ``\"cosine_sq\"``: Squared Cosine similarity (0...1)\n\n        :examples:\n          >>>\n          >>> iris_h2o = h2o.import_file(path=pyunit_utils.locate(\"smalldata/iris/iris.csv\"))\n          >>> references = iris_h2o[10:150,0:4\n          >>> queries    = iris_h2o[0:10,0:4]\n          >>> A = references.distance(queries, \"l1\")\n          >>> B = references.distance(queries, \"l2\")\n          >>> C = references.distance(queries, \"cosine\")\n          >>> D = references.distance(queries, \"cosine_sq\")\n          >>> E = queries.distance(references, \"l1\")\n          >>> (E.transpose() == A).all()\n\n        :returns: An H2OFrame of the matrix containing pairwise distance / similarity between the \n            rows of this frame (N x p) and ``y`` (M x p), with dimensions (N x M).", "docstring_tokens": ["Compute", "a", "pairwise", "distance", "measure", "between", "all", "rows", "of", "two", "numeric", "H2OFrames", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260435}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/util.py#L221-L236", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Retrieves the contents of the specified file.", "language": "python", "parameters": "(filepath)", "return_statement": "return _FILE_CACHE[filepath]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "_FILE_CACHE_LOCK", ":", "if", "arg_0", "not", "in", "arg_1", ":", "arg_1", "[", "arg_0", "]", "=", "_Func", "(", "arg_0", ")", "return", "arg_1", "[", "arg_0", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Retrieves the contents of the specified file.\n\n    This function performs simple caching so that the same file isn't read more\n    than once per process.\n\n    :param filepath: the file to read\n    :type filepath: str\n    :returns: str\n    \"\"\"\n\n    with _FILE_CACHE_LOCK:\n        if arg_0 not in arg_1:\n            arg_1[arg_0] = _Func(arg_0)\n    return arg_1[arg_0]", "path": "src/tidypy/util.py", "identifier": "read_file", "docstring": "Retrieves the contents of the specified file.\n\n    This function performs simple caching so that the same file isn't read more\n    than once per process.\n\n    :param filepath: the file to read\n    :type filepath: str\n    :returns: str", "docstring_tokens": ["Retrieves", "the", "contents", "of", "the", "specified", "file", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 260436}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L554-L585", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get all states of given object", "language": "python", "parameters": "(self, window_name, object_name)", "return_statement": "return _obj_states", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get_object_handle", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "[", "]", "if", "arg_3", ".", "AXEnabled", ":", "arg_4", ".", "append", "(", "\"enabled\"", ")", "if", "arg_3", ".", "AXFocused", ":", "arg_4", ".", "append", "(", "\"focused\"", ")", "else", ":", "try", ":", "if", "arg_3", ".", "AXFocused", ":", "arg_4", ".", "append", "(", "\"focusable\"", ")", "except", ":", "pass", "if", "re", ".", "match", "(", "\"AXCheckBox\"", ",", "arg_3", ".", "AXRole", ",", "re", ".", "M", "|", "re", ".", "U", "|", "re", ".", "L", ")", "or", "re", ".", "match", "(", "\"AXRadioButton\"", ",", "arg_3", ".", "AXRole", ",", "re", ".", "M", "|", "re", ".", "U", "|", "re", ".", "L", ")", ":", "if", "arg_3", ".", "AXValue", ":", "arg_4", ".", "append", "(", "\"checked\"", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get all states of given object\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: list of string on success.\n        @rtype: list\n        \"\"\"\n        arg_3 = arg_0._get_object_handle(arg_1, arg_2)\n        arg_4 = []\n        if arg_3.AXEnabled:\n            arg_4.append(\"enabled\")\n        if arg_3.AXFocused:\n            arg_4.append(\"focused\")\n        else:\n            try:\n                if arg_3.AXFocused:\n                    arg_4.append(\"focusable\")\n            except:\n                pass\n        if re.match(\"AXCheckBox\", arg_3.AXRole, re.M | re.U | re.L) or \\\n                re.match(\"AXRadioButton\", arg_3.AXRole,\n                         re.M | re.U | re.L):\n            if arg_3.AXValue:\n                arg_4.append(\"checked\")\n        return arg_4", "path": "atomac/ldtpd/core.py", "identifier": "Core.getallstates", "docstring": "Get all states of given object\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n\n        @return: list of string on success.\n        @rtype: list", "docstring_tokens": ["Get", "all", "states", "of", "given", "object"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260437}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L340-L358", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Gets the CRC32c checksum of an object in Google Cloud Storage.", "language": "python", "parameters": "(self, bucket_name, object_name)", "return_statement": "return blob_crc32c", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "log", ".", "info", "(", "'Retrieving the crc32c checksum of '", "'object_name: %s in bucket_name: %s'", ",", "arg_2", ",", "arg_1", ")", "arg_3", "=", "arg_0", ".", "get_conn", "(", ")", "arg_4", "=", "arg_3", ".", "get_bucket", "(", "arg_1", "=", "arg_1", ")", "arg_5", "=", "arg_4", ".", "get_blob", "(", "blob_name", "=", "arg_2", ")", "arg_5", ".", "reload", "(", ")", "arg_6", "=", "arg_5", ".", "crc32c", "arg_0", ".", "log", ".", "info", "(", "'The crc32c checksum of %s is %s'", ",", "arg_2", ",", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Gets the CRC32c checksum of an object in Google Cloud Storage.\n\n        :param bucket_name: The Google cloud storage bucket where the blob_name is.\n        :type bucket_name: str\n        :param object_name: The name of the object to check in the Google cloud\n            storage bucket_name.\n        :type object_name: str\n        \"\"\"\n        arg_0.log.info('Retrieving the crc32c checksum of '\n                      'object_name: %s in bucket_name: %s', arg_2, arg_1)\n        arg_3 = arg_0.get_conn()\n        arg_4 = arg_3.get_bucket(arg_1=arg_1)\n        arg_5 = arg_4.get_blob(blob_name=arg_2)\n        arg_5.reload()\n        arg_6 = arg_5.crc32c\n        arg_0.log.info('The crc32c checksum of %s is %s', arg_2, arg_6)\n        return arg_6", "path": "airflow/contrib/hooks/gcs_hook.py", "identifier": "GoogleCloudStorageHook.get_crc32c", "docstring": "Gets the CRC32c checksum of an object in Google Cloud Storage.\n\n        :param bucket_name: The Google cloud storage bucket where the blob_name is.\n        :type bucket_name: str\n        :param object_name: The name of the object to check in the Google cloud\n            storage bucket_name.\n        :type object_name: str", "docstring_tokens": ["Gets", "the", "CRC32c", "checksum", "of", "an", "object", "in", "Google", "Cloud", "Storage", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260438}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/xml_tools.py#L107-L111", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Wrapper for etree.SubElement, that takes care of unsupported nsmap option.", "language": "python", "parameters": "(parent, tag, nsmap=None)", "return_statement": "return etree.SubElement(parent, tag)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "use_lxml", ":", "return", "etree", ".", "SubElement", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ")", "return", "etree", ".", "SubElement", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Wrapper for etree.SubElement, that takes care of unsupported nsmap option.\"\"\"\n    if use_lxml:\n        return etree.SubElement(arg_0, arg_1, arg_2=arg_2)\n    return etree.SubElement(arg_0, arg_1)", "path": "wsgidav/xml_tools.py", "identifier": "make_sub_element", "docstring": "Wrapper for etree.SubElement, that takes care of unsupported nsmap option.", "docstring_tokens": ["Wrapper", "for", "etree", ".", "SubElement", "that", "takes", "care", "of", "unsupported", "nsmap", "option", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 260439}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L248-L283", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Half-duplex SPI read.  If assert_ss is true, the SS line will be\n        asserted low, the specified length of bytes will be clocked in the MISO\n        line, and if deassert_ss is true the SS line will be put back high.\n        Bytes which are read will be returned as a bytearray object.", "language": "python", "parameters": "(self, length, assert_ss=True, deassert_ss=True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "if", "arg_0", ".", "_miso", "is", "None", ":", "raise", "RuntimeError", "(", "'Read attempted with no MISO pin specified.'", ")", "if", "arg_2", "and", "arg_0", ".", "_ss", "is", "not", "None", ":", "arg_0", ".", "_gpio", ".", "set_low", "(", "arg_0", ".", "_ss", ")", "arg_4", "=", "bytearray", "(", "arg_1", ")", "for", "arg_5", "in", "range", "(", "arg_1", ")", ":", "for", "arg_6", "in", "range", "(", "8", ")", ":", "arg_0", ".", "_gpio", ".", "output", "(", "arg_0", ".", "_sclk", ",", "not", "arg_0", ".", "_clock_base", ")", "if", "arg_0", ".", "_Func_leading", ":", "if", "arg_0", ".", "_gpio", ".", "is_high", "(", "arg_0", ".", "_miso", ")", ":", "arg_4", "[", "arg_5", "]", "|=", "arg_0", ".", "_Func_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "else", ":", "arg_4", "[", "arg_5", "]", "&=", "~", "arg_0", ".", "_Func_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "arg_0", ".", "_gpio", ".", "output", "(", "arg_0", ".", "_sclk", ",", "arg_0", ".", "_clock_base", ")", "if", "not", "arg_0", ".", "_Func_leading", ":", "if", "arg_0", ".", "_gpio", ".", "is_high", "(", "arg_0", ".", "_miso", ")", ":", "arg_4", "[", "arg_5", "]", "|=", "arg_0", ".", "_Func_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "else", ":", "arg_4", "[", "arg_5", "]", "&=", "~", "arg_0", ".", "_Func_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "if", "arg_3", "and", "arg_0", ".", "_ss", "is", "not", "None", ":", "arg_0", ".", "_gpio", ".", "set_high", "(", "arg_0", ".", "_ss", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=True):\n        \"\"\"Half-duplex SPI Func.  If assert_ss is true, the SS line will be\n        asserted low, the specified length of bytes will be clocked in the MISO\n        line, and if deassert_ss is true the SS line will be put back high.\n        Bytes which are Func will be returned as a bytearray object.\n        \"\"\"\n        if arg_0._miso is None:\n            raise RuntimeError('Read attempted with no MISO pin specified.')\n        if arg_2 and arg_0._ss is not None:\n            arg_0._gpio.set_low(arg_0._ss)\n        arg_4 = bytearray(arg_1)\n        for arg_5 in range(arg_1):\n            for arg_6 in range(8):\n                # Flip clock off base.\n                arg_0._gpio.output(arg_0._sclk, not arg_0._clock_base)\n                # Handle Func on leading edge of clock.\n                if arg_0._Func_leading:\n                    if arg_0._gpio.is_high(arg_0._miso):\n                        # Set bit to 1 at appropriate location.\n                        arg_4[arg_5] |= arg_0._Func_shift(arg_0._mask, arg_6)\n                    else:\n                        # Set bit to 0 at appropriate location.\n                        arg_4[arg_5] &= ~arg_0._Func_shift(arg_0._mask, arg_6)\n                # Return clock to base.\n                arg_0._gpio.output(arg_0._sclk, arg_0._clock_base)\n                # Handle Func on trailing edge of clock.\n                if not arg_0._Func_leading:\n                    if arg_0._gpio.is_high(arg_0._miso):\n                        # Set bit to 1 at appropriate location.\n                        arg_4[arg_5] |= arg_0._Func_shift(arg_0._mask, arg_6)\n                    else:\n                        # Set bit to 0 at appropriate location.\n                        arg_4[arg_5] &= ~arg_0._Func_shift(arg_0._mask, arg_6)\n        if arg_3 and arg_0._ss is not None:\n            arg_0._gpio.set_high(arg_0._ss)\n        return arg_4", "path": "Adafruit_GPIO/SPI.py", "identifier": "BitBang.read", "docstring": "Half-duplex SPI read.  If assert_ss is true, the SS line will be\n        asserted low, the specified length of bytes will be clocked in the MISO\n        line, and if deassert_ss is true the SS line will be put back high.\n        Bytes which are read will be returned as a bytearray object.", "docstring_tokens": ["Half", "-", "duplex", "SPI", "read", ".", "If", "assert_ss", "is", "true", "the", "SS", "line", "will", "be", "asserted", "low", "the", "specified", "length", "of", "bytes", "will", "be", "clocked", "in", "the", "MISO", "line", "and", "if", "deassert_ss", "is", "true", "the", "SS", "line", "will", "be", "put", "back", "high", ".", "Bytes", "which", "are", "read", "will", "be", "returned", "as", "a", "bytearray", "object", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 260440}
{"url": "https://github.com/jhermann/rituals/blob/1534f50d81e19bbbe799e2eba0acdefbce047c06/src/rituals/easy.py#L63-L67", "sha": "1534f50d81e19bbbe799e2eba0acdefbce047c06", "docstring_summary": "Exit with error code and message.", "language": "python", "parameters": "(message, exitcode=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "sys", ".", "stderr", ".", "write", "(", "'ERROR: {}\\n'", ".", "format", "(", "arg_0", ")", ")", "sys", ".", "stderr", ".", "flush", "(", ")", "sys", ".", "exit", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=1):\n    \"\"\"Exit with error code and message.\"\"\"\n    sys.stderr.write('ERROR: {}\\n'.format(arg_0))\n    sys.stderr.flush()\n    sys.exit(arg_1)", "path": "src/rituals/easy.py", "identifier": "fail", "docstring": "Exit with error code and message.", "docstring_tokens": ["Exit", "with", "error", "code", "and", "message", "."], "nwo": "jhermann/rituals", "score": 0.3756179881544838, "idx": 260441}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L1094-L1102", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "This method fixes a bug in Python's SGMLParser.", "language": "python", "parameters": "(self, name)", "return_statement": "return self.convert_codepoint(n)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "int", "(", "arg_1", ")", "except", "ValueError", ":", "return", "if", "not", "0", "<=", "arg_2", "<=", "127", ":", "return", "return", "arg_0", ".", "convert_codepoint", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"This method fixes a bug in Python's SGMLParser.\"\"\"\n        try:\n            arg_2 = int(arg_1)\n        except ValueError:\n            return\n        if not 0 <= arg_2 <= 127 : # ASCII ends at 127, not 255\n            return\n        return arg_0.convert_codepoint(arg_2)", "path": "lib/web/BeautifulSoup.py", "identifier": "BeautifulStoneSoup.convert_charref", "docstring": "This method fixes a bug in Python's SGMLParser.", "docstring_tokens": ["This", "method", "fixes", "a", "bug", "in", "Python", "s", "SGMLParser", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260442}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/vi/csiszar_divergence.py#L712-L780", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Symmetrizes a Csiszar-function in log-space.", "language": "python", "parameters": "(logu, csiszar_function, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_2", ",", "\"Func\"", ",", "[", "arg_0", "]", ")", ":", "arg_0", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_2", "=", "\"logu\"", ")", "return", "0.5", "*", "(", "arg_1", "(", "arg_0", ")", "+", "dual_csiszar_function", "(", "arg_0", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n  \"\"\"Symmetrizes a Csiszar-function in log-space.\n\n  A Csiszar-function is a member of,\n\n  ```none\n  F = { f:R_+ to R : f convex }.\n  ```\n\n  The symmetrized Csiszar-function is defined as:\n\n  ```none\n  f_g(u) = 0.5 g(u) + 0.5 u g (1 / u)\n  ```\n\n  where `g` is some other Csiszar-function.\n\n  We say the function is \"symmetrized\" because:\n\n  ```none\n  D_{f_g}[p, q] = D_{f_g}[q, p]\n  ```\n\n  for all `p << >> q` (i.e., `support(p) = support(q)`).\n\n  There exists alternatives for symmetrizing a Csiszar-function. For example,\n\n  ```none\n  f_g(u) = max(f(u), f^*(u)),\n  ```\n\n  where `f^*` is the dual Csiszar-function, also implies a symmetric\n  f-Divergence.\n\n  Example:\n\n  When either of the following functions are symmetrized, we obtain the\n  Jensen-Shannon Csiszar-function, i.e.,\n\n  ```none\n  g(u) = -log(u) - (1 + u) log((1 + u) / 2) + u - 1\n  h(u) = log(4) + 2 u log(u / (1 + u))\n  ```\n\n  implies,\n\n  ```none\n  f_g(u) = f_h(u) = u log(u) - (1 + u) log((1 + u) / 2)\n         = jensen_shannon(log(u)).\n  ```\n\n  Warning: this function makes non-log-space calculations and may therefore be\n  numerically unstable for `|logu| >> 0`.\n\n  Args:\n    logu: `float`-like `Tensor` representing `log(u)` from above.\n    csiszar_function: Python `callable` representing a Csiszar-function over\n      log-domain.\n    name: Python `str` name prefixed to Ops created by this function.\n\n  Returns:\n    symmetrized_g_of_u: `float`-like `Tensor` of the result of applying the\n      symmetrization of `g` evaluated at `u = exp(logu)`.\n  \"\"\"\n\n  with tf.compat.v1.name_scope(arg_2, \"Func\", [arg_0]):\n    arg_0 = tf.convert_to_tensor(value=arg_0, arg_2=\"logu\")\n    return 0.5 * (arg_1(arg_0)\n                  + dual_csiszar_function(arg_0, arg_1))", "path": "tensorflow_probability/python/vi/csiszar_divergence.py", "identifier": "symmetrized_csiszar_function", "docstring": "Symmetrizes a Csiszar-function in log-space.\n\n  A Csiszar-function is a member of,\n\n  ```none\n  F = { f:R_+ to R : f convex }.\n  ```\n\n  The symmetrized Csiszar-function is defined as:\n\n  ```none\n  f_g(u) = 0.5 g(u) + 0.5 u g (1 / u)\n  ```\n\n  where `g` is some other Csiszar-function.\n\n  We say the function is \"symmetrized\" because:\n\n  ```none\n  D_{f_g}[p, q] = D_{f_g}[q, p]\n  ```\n\n  for all `p << >> q` (i.e., `support(p) = support(q)`).\n\n  There exists alternatives for symmetrizing a Csiszar-function. For example,\n\n  ```none\n  f_g(u) = max(f(u), f^*(u)),\n  ```\n\n  where `f^*` is the dual Csiszar-function, also implies a symmetric\n  f-Divergence.\n\n  Example:\n\n  When either of the following functions are symmetrized, we obtain the\n  Jensen-Shannon Csiszar-function, i.e.,\n\n  ```none\n  g(u) = -log(u) - (1 + u) log((1 + u) / 2) + u - 1\n  h(u) = log(4) + 2 u log(u / (1 + u))\n  ```\n\n  implies,\n\n  ```none\n  f_g(u) = f_h(u) = u log(u) - (1 + u) log((1 + u) / 2)\n         = jensen_shannon(log(u)).\n  ```\n\n  Warning: this function makes non-log-space calculations and may therefore be\n  numerically unstable for `|logu| >> 0`.\n\n  Args:\n    logu: `float`-like `Tensor` representing `log(u)` from above.\n    csiszar_function: Python `callable` representing a Csiszar-function over\n      log-domain.\n    name: Python `str` name prefixed to Ops created by this function.\n\n  Returns:\n    symmetrized_g_of_u: `float`-like `Tensor` of the result of applying the\n      symmetrization of `g` evaluated at `u = exp(logu)`.", "docstring_tokens": ["Symmetrizes", "a", "Csiszar", "-", "function", "in", "log", "-", "space", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260443}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/app.py#L30-L59", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Adds the price", "language": "python", "parameters": "(self, price: dal.Price)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Price", ")", ":", "from", "decimal", "import", "Decimal", "arg_4", "=", "arg_0", ".", "get_price_repository", "(", ")", "arg_5", "=", "(", "arg_4", ".", "query", ".", "filter", "(", "arg_2", ".", "Price", ".", "namespace", "==", "arg_1", ".", "namespace", ")", ".", "filter", "(", "arg_2", ".", "Price", ".", "symbol", "==", "arg_1", ".", "symbol", ")", ".", "filter", "(", "arg_2", ".", "Price", ".", "date", "==", "arg_1", ".", "date", ")", ".", "filter", "(", "arg_2", ".", "Price", ".", "time", "==", "arg_1", ".", "time", ")", ".", "first", "(", ")", ")", "if", "arg_5", ":", "arg_6", "=", "Decimal", "(", "arg_1", ".", "value", ")", "/", "Decimal", "(", "arg_1", ".", "denom", ")", "arg_0", ".", "logger", ".", "info", "(", "f\"Exists: {price}\"", ")", "if", "arg_1", ".", "currency", "!=", "arg_5", ".", "currency", ":", "raise", "ValueError", "(", "f\"The currency is different for price {price}!\"", ")", "if", "arg_5", ".", "value", "!=", "arg_1", ".", "value", ":", "arg_5", ".", "value", "=", "arg_1", ".", "value", "arg_0", ".", "logger", ".", "info", "(", "f\"Updating to {new_value}.\"", ")", "if", "arg_5", ".", "denom", "!=", "arg_1", ".", "denom", ":", "arg_5", ".", "denom", "=", "arg_1", ".", "denom", "else", ":", "arg_0", ".", "session", ".", "add", "(", "arg_1", ")", "arg_0", ".", "logger", ".", "info", "(", "f\"Added {price}\"", ")"], "function": "def Func(arg_0, arg_1: arg_2.Price):\n        \"\"\" Adds the price \"\"\"\n        from decimal import Decimal\n\n        # check if the price already exists in db.\n        arg_4 = arg_0.get_price_repository()\n        arg_5 = (\n            arg_4.query\n            .filter(arg_2.Price.namespace == arg_1.namespace)\n            .filter(arg_2.Price.symbol == arg_1.symbol)\n            .filter(arg_2.Price.date == arg_1.date)\n            .filter(arg_2.Price.time == arg_1.time)\n            .first()\n        )\n        if arg_5:\n            # Update existing price.\n            arg_6 = Decimal(arg_1.value) / Decimal(arg_1.denom)\n            arg_0.logger.info(f\"Exists: {price}\")\n            if arg_1.currency != arg_5.currency:\n                raise ValueError(\n                    f\"The currency is different for price {price}!\")\n            if arg_5.value != arg_1.value:\n                arg_5.value = arg_1.value\n                arg_0.logger.info(f\"Updating to {new_value}.\")\n            if arg_5.denom != arg_1.denom:\n                arg_5.denom = arg_1.denom\n        else:\n            # Insert new price\n            arg_0.session.add(arg_1)\n            arg_0.logger.info(f\"Added {price}\")", "path": "pricedb/app.py", "identifier": "PriceDbApplication.add_price_entity", "docstring": "Adds the price", "docstring_tokens": ["Adds", "the", "price"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 260444}
{"url": "https://github.com/uploadcare/pyuploadcare/blob/cefddc0306133a71e37b18e8700df5948ef49b37/pyuploadcare/api_resources.py#L732-L758", "sha": "cefddc0306133a71e37b18e8700df5948ef49b37", "docstring_summary": "Creates file group and returns ``FileGroup`` instance.", "language": "python", "parameters": "(cls, files)", "return_statement": "return group", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_1", ")", ":", "if", "isinstance", "(", "arg_4", ",", "File", ")", ":", "arg_5", "=", "'files[{index}]'", ".", "format", "(", "arg_3", "=", "arg_3", ")", "arg_2", "[", "arg_5", "]", "=", "six", ".", "text_type", "(", "arg_4", ")", "else", ":", "raise", "InvalidParamError", "(", "'all items have to be ``File`` instance'", ")", "if", "not", "arg_2", ":", "raise", "InvalidParamError", "(", "'set of files is empty'", ")", "arg_6", "=", "uploading_request", "(", "'POST'", ",", "'group/'", ",", "arg_2", "=", "arg_2", ")", "arg_7", "=", "arg_0", ".", "construct_from", "(", "arg_6", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Creates file group and returns ``FileGroup`` instance.\n\n        It expects iterable object that contains ``File`` instances, e.g.::\n\n            >>> file_1 = File('6c5e9526-b0fe-4739-8975-72e8d5ee6342')\n            >>> file_2 = File('a771f854-c2cb-408a-8c36-71af77811f3b')\n            >>> FileGroup.Func((file_1, file_2))\n            <uploadcare.FileGroup 0513dda0-6666-447d-846f-096e5df9e2bb~2>\n\n        \"\"\"\n        arg_2 = {}\n        for arg_3, arg_4 in enumerate(arg_1):\n            if isinstance(arg_4, File):\n                arg_5 = 'files[{index}]'.format(arg_3=arg_3)\n                arg_2[arg_5] = six.text_type(arg_4)\n            else:\n                raise InvalidParamError(\n                    'all items have to be ``File`` instance'\n                )\n        if not arg_2:\n            raise InvalidParamError('set of files is empty')\n\n        arg_6 = uploading_request('POST', 'group/', arg_2=arg_2)\n\n        arg_7 = arg_0.construct_from(arg_6)\n        return arg_7", "path": "pyuploadcare/api_resources.py", "identifier": "FileGroup.create", "docstring": "Creates file group and returns ``FileGroup`` instance.\n\n        It expects iterable object that contains ``File`` instances, e.g.::\n\n            >>> file_1 = File('6c5e9526-b0fe-4739-8975-72e8d5ee6342')\n            >>> file_2 = File('a771f854-c2cb-408a-8c36-71af77811f3b')\n            >>> FileGroup.create((file_1, file_2))\n            <uploadcare.FileGroup 0513dda0-6666-447d-846f-096e5df9e2bb~2>", "docstring_tokens": ["Creates", "file", "group", "and", "returns", "FileGroup", "instance", "."], "nwo": "uploadcare/pyuploadcare", "score": 0.289876796890331, "idx": 260445}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/bake.py#L24-L54", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "Returns a list of includes to be given to `cnxepub.collation.collate`.", "language": "python", "parameters": "()", "return_statement": "return includes", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "[", "]", "arg_1", "=", "'{baseUrl}/api/exercises?q={field}:\"{{itemCode}}\"'", "arg_2", "=", "get_current_registry", "(", ")", ".", "settings", "arg_3", "=", "arg_2", ".", "get", "(", "'embeddables.exercise.base_url'", ",", "None", ")", "arg_4", "=", "[", "match", ".", "split", "(", "','", ",", "1", ")", "for", "match", "in", "aslist", "(", "arg_2", ".", "get", "(", "'embeddables.exercise.match'", ",", "''", ")", ",", "flatten", "=", "False", ")", "]", "arg_5", "=", "arg_2", ".", "get", "(", "'embeddables.exercise.token'", ",", "None", ")", "arg_6", "=", "arg_2", ".", "get", "(", "'mathmlcloud.url'", ",", "None", ")", "arg_7", "=", "arg_2", ".", "get", "(", "'memcache_servers'", ")", "if", "arg_7", ":", "arg_7", "=", "arg_7", ".", "split", "(", ")", "else", ":", "arg_7", "=", "None", "if", "arg_3", "and", "arg_4", ":", "arg_8", "=", "None", "if", "arg_7", ":", "arg_8", "=", "memcache", ".", "Client", "(", "arg_7", ",", "debug", "=", "0", ")", "for", "(", "arg_9", ",", "arg_10", ")", "in", "arg_4", ":", "arg_11", "=", "arg_1", ".", "format", "(", "baseUrl", "=", "arg_3", ",", "field", "=", "arg_10", ")", "arg_0", ".", "append", "(", "exercise_callback_factory", "(", "arg_9", ",", "arg_11", ",", "arg_8", ",", "arg_5", ",", "arg_6", ")", ")", "return", "arg_0"], "function": "def Func():  # pragma: no cover\n    \"\"\"Returns a list of includes to be given to `cnxepub.collation.collate`.\n\n    \"\"\"\n    arg_0 = []\n    arg_1 = '{baseUrl}/api/exercises?q={field}:\"{{itemCode}}\"'\n    arg_2 = get_current_registry().settings\n    arg_3 = arg_2.get('embeddables.exercise.base_url', None)\n    arg_4 = [match.split(',', 1) for match in aslist(\n        arg_2.get('embeddables.exercise.match', ''), flatten=False)]\n    arg_5 = arg_2.get('embeddables.exercise.token', None)\n    arg_6 = arg_2.get('mathmlcloud.url', None)\n    arg_7 = arg_2.get('memcache_servers')\n    if arg_7:\n        arg_7 = arg_7.split()\n    else:\n        arg_7 = None\n\n    if arg_3 and arg_4:\n        arg_8 = None\n        if arg_7:\n            arg_8 = memcache.Client(arg_7, debug=0)\n        for (arg_9, arg_10) in arg_4:\n            arg_11 = arg_1.format(\n                baseUrl=arg_3, field=arg_10)\n            arg_0.append(exercise_callback_factory(arg_9,\n                                                      arg_11,\n                                                      arg_8,\n                                                      arg_5,\n                                                      arg_6))\n    return arg_0", "path": "cnxpublishing/bake.py", "identifier": "_formatter_callback_factory", "docstring": "Returns a list of includes to be given to `cnxepub.collation.collate`.", "docstring_tokens": ["Returns", "a", "list", "of", "includes", "to", "be", "given", "to", "cnxepub", ".", "collation", ".", "collate", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 260446}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L247-L275", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return a dictionary with all arrays sizes.", "language": "python", "parameters": "(self, in_bytes=False, subs_consts=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "variables", ".", "items", "(", ")", ":", "arg_6", ",", "arg_7", "=", "arg_5", "if", "arg_7", "is", "None", ":", "continue", "arg_3", "[", "arg_4", "]", "=", "reduce", "(", "operator", ".", "mul", ",", "arg_7", ",", "1", ")", "if", "arg_1", ":", "arg_8", "=", "arg_0", ".", "datatypes_size", "[", "arg_6", "]", "arg_3", "[", "arg_4", "]", "*=", "arg_8", "if", "arg_2", ":", "return", "{", "arg_9", ":", "arg_0", ".", "subs_consts", "(", "arg_10", ")", "for", "arg_9", ",", "arg_10", "in", "arg_3", ".", "items", "(", ")", "}", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n        \"\"\"\n        Return a dictionary with all arrays sizes.\n\n        :param in_bytes: If True, output will be in bytes, not element counts.\n        :param subs_consts: If True, output will be numbers and not symbolic.\n\n        Scalar variables are ignored.\n        \"\"\"\n        arg_3 = {}\n\n        for arg_4, arg_5 in arg_0.variables.items():\n            arg_6, arg_7 = arg_5\n\n            # Skiping sclars\n            if arg_7 is None:\n                continue\n\n            arg_3[arg_4] = reduce(operator.mul, arg_7, 1)\n\n            # Multiply by bytes per element if requested\n            if arg_1:\n                arg_8 = arg_0.datatypes_size[arg_6]\n                arg_3[arg_4] *= arg_8\n\n        if arg_2:\n            return {arg_9: arg_0.subs_consts(arg_10) for arg_9, arg_10 in arg_3.items()}\n        else:\n            return arg_3", "path": "kerncraft/kernel.py", "identifier": "Kernel.array_sizes", "docstring": "Return a dictionary with all arrays sizes.\n\n        :param in_bytes: If True, output will be in bytes, not element counts.\n        :param subs_consts: If True, output will be numbers and not symbolic.\n\n        Scalar variables are ignored.", "docstring_tokens": ["Return", "a", "dictionary", "with", "all", "arrays", "sizes", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 260447}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/client/utils.py#L57-L67", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Much like parse.quote in that it returns a URL encoded string\n    for the given value, protecting the safe characters; but this\n    version also ensures the value is UTF-8 encoded.", "language": "python", "parameters": "(value, safe='/:')", "return_statement": "return parse.quote(value, safe)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'/:'", ")", ":", "if", "isinstance", "(", "arg_0", ",", "six", ".", "text_type", ")", ":", "arg_0", "=", "arg_0", ".", "encode", "(", "'utf8'", ")", "elif", "not", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "arg_0", "=", "str", "(", "arg_0", ")", "return", "parse", ".", "Func", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1='/:'):\n    \"\"\"\n    Much like parse.Func in that it returns a URL encoded string\n    for the given value, protecting the safe characters; but this\n    version also ensures the value is UTF-8 encoded.\n    \"\"\"\n    if isinstance(arg_0, six.text_type):\n        arg_0 = arg_0.encode('utf8')\n    elif not isinstance(arg_0, six.string_types):\n        arg_0 = str(arg_0)\n    return parse.Func(arg_0, arg_1)", "path": "swiftly/client/utils.py", "identifier": "quote", "docstring": "Much like parse.quote in that it returns a URL encoded string\n    for the given value, protecting the safe characters; but this\n    version also ensures the value is UTF-8 encoded.", "docstring_tokens": ["Much", "like", "parse", ".", "quote", "in", "that", "it", "returns", "a", "URL", "encoded", "string", "for", "the", "given", "value", "protecting", "the", "safe", "characters", ";", "but", "this", "version", "also", "ensures", "the", "value", "is", "UTF", "-", "8", "encoded", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 260448}
{"url": "https://github.com/ndokter/dsmr_parser/blob/c04b0a5add58ce70153eede1a87ca171876b61c7/dsmr_parser/clients/protocol.py#L90-L96", "sha": "c04b0a5add58ce70153eede1a87ca171876b61c7", "docstring_summary": "Stop when connection is lost.", "language": "python", "parameters": "(self, exc)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ":", "arg_0", ".", "log", ".", "exception", "(", "'disconnected due to exception'", ")", "else", ":", "arg_0", ".", "log", ".", "info", "(", "'disconnected because of close/abort.'", ")", "arg_0", ".", "_closed", ".", "set", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Stop when connection is lost.\"\"\"\n        if arg_1:\n            arg_0.log.exception('disconnected due to exception')\n        else:\n            arg_0.log.info('disconnected because of close/abort.')\n        arg_0._closed.set()", "path": "dsmr_parser/clients/protocol.py", "identifier": "DSMRProtocol.connection_lost", "docstring": "Stop when connection is lost.", "docstring_tokens": ["Stop", "when", "connection", "is", "lost", "."], "nwo": "ndokter/dsmr_parser", "score": 0.6430124594429737, "idx": 260449}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L468-L479", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Returns the environment for actions that copy logging files.", "language": "python", "parameters": "(self, logging_uri, user_project)", "return_statement": "return {\n        'LOGGING_PATH': '{}.log'.format(logging_prefix),\n        'STDOUT_PATH': '{}-stdout.log'.format(logging_prefix),\n        'STDERR_PATH': '{}-stderr.log'.format(logging_prefix),\n        'USER_PROJECT': user_project,\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_1", ".", "endswith", "(", "'.log'", ")", ":", "raise", "ValueError", "(", "'Logging URI must end in \".log\": {}'", ".", "format", "(", "arg_1", ")", ")", "arg_3", "=", "arg_1", "[", ":", "-", "len", "(", "'.log'", ")", "]", "return", "{", "'LOGGING_PATH'", ":", "'{}.log'", ".", "format", "(", "arg_3", ")", ",", "'STDOUT_PATH'", ":", "'{}-stdout.log'", ".", "format", "(", "arg_3", ")", ",", "'STDERR_PATH'", ":", "'{}-stderr.log'", ".", "format", "(", "arg_3", ")", ",", "'USER_PROJECT'", ":", "arg_2", ",", "}"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Returns the environment for actions that copy logging files.\"\"\"\n    if not arg_1.endswith('.log'):\n      raise ValueError('Logging URI must end in \".log\": {}'.format(arg_1))\n\n    arg_3 = arg_1[:-len('.log')]\n    return {\n        'LOGGING_PATH': '{}.log'.format(arg_3),\n        'STDOUT_PATH': '{}-stdout.log'.format(arg_3),\n        'STDERR_PATH': '{}-stderr.log'.format(arg_3),\n        'USER_PROJECT': arg_2,\n    }", "path": "dsub/providers/google_v2.py", "identifier": "GoogleV2JobProvider._get_logging_env", "docstring": "Returns the environment for actions that copy logging files.", "docstring_tokens": ["Returns", "the", "environment", "for", "actions", "that", "copy", "logging", "files", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 260450}
{"url": "https://github.com/cldf/csvw/blob/181c94b6c599575945e52d370a415f12f3433eab/src/csvw/dsv.py#L402-L414", "sha": "181c94b6c599575945e52d370a415f12f3433eab", "docstring_summary": "Rewrite a dsv file, filtering the rows.", "language": "python", "parameters": "(fname, filter_, **kw)", "return_statement": "return filter_.removed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_1", "=", "DictFilter", "(", "arg_1", ")", "rewrite", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", "return", "arg_1", ".", "removed"], "function": "def Func(arg_0, arg_1, **arg_2):\n    \"\"\"Rewrite a dsv file, filtering the rows.\n\n    :param fname: Path to dsv file\n    :param filter_: callable which accepts a `dict` with a row's data as single argument\\\n    returning a `Boolean` indicating whether to keep the row (`True`) or to discard it \\\n    `False`.\n    :param kw: Keyword arguments to be passed `UnicodeReader` and `UnicodeWriter`.\n    :return: The number of rows that have been removed.\n    \"\"\"\n    arg_1 = DictFilter(arg_1)\n    rewrite(arg_0, arg_1, **arg_2)\n    return arg_1.removed", "path": "src/csvw/dsv.py", "identifier": "filter_rows_as_dict", "docstring": "Rewrite a dsv file, filtering the rows.\n\n    :param fname: Path to dsv file\n    :param filter_: callable which accepts a `dict` with a row's data as single argument\\\n    returning a `Boolean` indicating whether to keep the row (`True`) or to discard it \\\n    `False`.\n    :param kw: Keyword arguments to be passed `UnicodeReader` and `UnicodeWriter`.\n    :return: The number of rows that have been removed.", "docstring_tokens": ["Rewrite", "a", "dsv", "file", "filtering", "the", "rows", "."], "nwo": "cldf/csvw", "score": 0.2827006957945985, "idx": 260451}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L806-L834", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Create a polygon from a Shapely polygon.", "language": "python", "parameters": "(polygon_shapely, label=None)", "return_statement": "return Polygon(exterior, label=label)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "import", "shapely", ".", "geometry", "ia", ".", "do_assert", "(", "isinstance", "(", "arg_0", ",", "shapely", ".", "geometry", ".", "Polygon", ")", ")", "if", "arg_0", ".", "exterior", "is", "None", "or", "len", "(", "arg_0", ".", "exterior", ".", "coords", ")", "==", "0", ":", "return", "Polygon", "(", "[", "]", ",", "arg_1", "=", "arg_1", ")", "arg_2", "=", "np", ".", "float32", "(", "[", "[", "x", ",", "y", "]", "for", "(", "x", ",", "y", ")", "in", "arg_0", ".", "exterior", ".", "coords", "]", ")", "return", "Polygon", "(", "arg_2", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Create a polygon from a Shapely polygon.\n\n        Note: This will remove any holes in the Shapely polygon.\n\n        Parameters\n        ----------\n        polygon_shapely : shapely.geometry.Polygon\n             The shapely polygon.\n\n        label : None or str, optional\n            The label of the new polygon.\n\n        Returns\n        -------\n        imgaug.Polygon\n            A polygon with the same exterior as the Shapely polygon.\n\n        \"\"\"\n        # load shapely lazily, which makes the dependency more optional\n        import shapely.geometry\n\n        ia.do_assert(isinstance(arg_0, shapely.geometry.Polygon))\n        # polygon_shapely.exterior can be None if the polygon was instantiated without points\n        if arg_0.exterior is None or len(arg_0.exterior.coords) == 0:\n            return Polygon([], arg_1=arg_1)\n        arg_2 = np.float32([[x, y] for (x, y) in arg_0.exterior.coords])\n        return Polygon(arg_2, arg_1=arg_1)", "path": "imgaug/augmentables/polys.py", "identifier": "Polygon.from_shapely", "docstring": "Create a polygon from a Shapely polygon.\n\n        Note: This will remove any holes in the Shapely polygon.\n\n        Parameters\n        ----------\n        polygon_shapely : shapely.geometry.Polygon\n             The shapely polygon.\n\n        label : None or str, optional\n            The label of the new polygon.\n\n        Returns\n        -------\n        imgaug.Polygon\n            A polygon with the same exterior as the Shapely polygon.", "docstring_tokens": ["Create", "a", "polygon", "from", "a", "Shapely", "polygon", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 260452}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hgnc.py#L302-L320", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return a iterable with hgnc_genes.", "language": "python", "parameters": "(self, symbol, build='37')", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'37'", ")", ":", "arg_3", "=", "arg_0", ".", "hgnc_collection", ".", "find", "(", "{", "'hgnc_symbol'", ":", "arg_1", ",", "'build'", ":", "arg_2", "}", ")", "if", "arg_3", ".", "count", "(", ")", "==", "0", ":", "arg_3", "=", "arg_0", ".", "hgnc_collection", ".", "find", "(", "{", "'aliases'", ":", "arg_1", ",", "'build'", ":", "arg_2", "}", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2='37'):\n        \"\"\"Return a iterable with hgnc_genes.\n\n        If the gene symbol is listed as primary the iterable will only have\n        one result. If not the iterable will include all hgnc genes that have\n        the symbol as an alias.\n\n        Args:\n            symbol(str)\n            build(str)\n\n        Returns:\n            res(pymongo.Cursor(dict))\n        \"\"\"\n        arg_3 = arg_0.hgnc_collection.find({'hgnc_symbol': arg_1, 'build':arg_2})\n        if arg_3.count() == 0:\n            arg_3 = arg_0.hgnc_collection.find({'aliases': arg_1, 'build':arg_2})\n\n        return arg_3", "path": "scout/adapter/mongo/hgnc.py", "identifier": "GeneHandler.gene_by_alias", "docstring": "Return a iterable with hgnc_genes.\n\n        If the gene symbol is listed as primary the iterable will only have\n        one result. If not the iterable will include all hgnc genes that have\n        the symbol as an alias.\n\n        Args:\n            symbol(str)\n            build(str)\n\n        Returns:\n            res(pymongo.Cursor(dict))", "docstring_tokens": ["Return", "a", "iterable", "with", "hgnc_genes", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260453}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/example/qq.py#L107-L111", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Recursively converts dictionary keys to strings.", "language": "python", "parameters": "(dictionary)", "return_statement": "return dict((str(k), convert_keys_to_string(v)) for k, v in dictionary.items())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "return", "arg_0", "return", "dict", "(", "(", "str", "(", "arg_1", ")", ",", "Func", "(", "arg_2", ")", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", ")"], "function": "def Func(arg_0):\n    '''Recursively converts dictionary keys to strings.'''\n    if not isinstance(arg_0, dict):\n        return arg_0\n    return dict((str(arg_1), Func(arg_2)) for arg_1, arg_2 in arg_0.items())", "path": "example/qq.py", "identifier": "convert_keys_to_string", "docstring": "Recursively converts dictionary keys to strings.", "docstring_tokens": ["Recursively", "converts", "dictionary", "keys", "to", "strings", "."], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 260454}
{"url": "https://github.com/praekelt/django-analytics/blob/29c22d03374ccc0ec451650e2c2886d324f6e5c6/analytics/geckoboard_views.py#L87-L106", "sha": "29c22d03374ccc0ec451650e2c2886d324f6e5c6", "docstring_summary": "Returns a number widget for the specified metric's cumulative total.", "language": "python", "parameters": "(request)", "return_statement": "return (latest_stat.cumulative_count, prev_stat.cumulative_count) if params['cumulative'] else (latest_stat.count, prev_stat.count)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_gecko_params", "(", "arg_0", ",", "days_back", "=", "7", ")", "arg_2", "=", "Metric", ".", "objects", ".", "get", "(", "uid", "=", "arg_1", "[", "'uid'", "]", ")", "try", ":", "arg_3", "=", "arg_2", ".", "statistics", ".", "filter", "(", "frequency", "=", "arg_1", "[", "'frequency'", "]", ")", ".", "order_by", "(", "'-date_time'", ")", "[", "0", "]", "except", "IndexError", ":", "return", "(", "0", ",", "0", ")", "try", ":", "arg_4", "=", "arg_2", ".", "statistics", ".", "filter", "(", "frequency", "=", "arg_1", "[", "'frequency'", "]", ",", "date_time__lte", "=", "arg_3", ".", "date_time", "-", "timedelta", "(", "days", "=", "arg_1", "[", "'days_back'", "]", ")", ")", ".", "order_by", "(", "'-date_time'", ")", "[", "0", "]", "except", "IndexError", ":", "return", "(", "arg_3", ".", "cumulative_count", ",", "0", ")", "if", "arg_1", "[", "'cumulative'", "]", "else", "(", "arg_3", ".", "count", ",", "0", ")", "return", "(", "arg_3", ".", "cumulative_count", ",", "arg_4", ".", "cumulative_count", ")", "if", "arg_1", "[", "'cumulative'", "]", "else", "(", "arg_3", ".", "count", ",", "arg_4", ".", "count", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns a number widget for the specified metric's cumulative total.\n    \"\"\"\n\n    arg_1 = get_gecko_params(arg_0, days_back=7)\n    arg_2 = Metric.objects.get(uid=arg_1['uid'])\n    try:\n        arg_3 = arg_2.statistics.filter(frequency=arg_1['frequency']).order_by('-date_time')[0]\n    except IndexError:\n        return (0, 0)\n\n    try:\n        arg_4 = arg_2.statistics.filter(frequency=arg_1['frequency'],\n            date_time__lte=arg_3.date_time-timedelta(days=arg_1['days_back'])).order_by('-date_time')[0]\n    except IndexError:\n        # if there is no previous stat\n        return (arg_3.cumulative_count, 0) if arg_1['cumulative'] else (arg_3.count, 0)\n\n    return (arg_3.cumulative_count, arg_4.cumulative_count) if arg_1['cumulative'] else (arg_3.count, arg_4.count)", "path": "analytics/geckoboard_views.py", "identifier": "geckoboard_number_widget", "docstring": "Returns a number widget for the specified metric's cumulative total.", "docstring_tokens": ["Returns", "a", "number", "widget", "for", "the", "specified", "metric", "s", "cumulative", "total", "."], "nwo": "praekelt/django-analytics", "score": 0.1905226606846468, "idx": 260455}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L626-L632", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Receive NAK in REBINDING state.", "language": "python", "parameters": "(self, pkt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"C3.1. Received NAK?, in RENEWING state.\"", ")", "if", "arg_0", ".", "process_received_nak", "(", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"C3.1: T. Received NAK, in RENEWING state, \"", "\"raise INIT.\"", ")", "raise", "arg_0", ".", "INIT", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Receive NAK in REBINDING state.\"\"\"\n        logger.debug(\"C3.1. Received NAK?, in RENEWING state.\")\n        if arg_0.process_received_nak(arg_1):\n            logger.debug(\"C3.1: T. Received NAK, in RENEWING state, \"\n                         \"raise INIT.\")\n            raise arg_0.INIT()", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.receive_nak_rebinding", "docstring": "Receive NAK in REBINDING state.", "docstring_tokens": ["Receive", "NAK", "in", "REBINDING", "state", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 260456}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/seq_utils.py#L227-L253", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "return a normalized version of a profile matrix", "language": "python", "parameters": "(in_profile, log=False, return_offset = True)", "return_statement": "return (np.copy(np.einsum('ai,a->ai',tmp_prof,1.0/norm_vector)),\n            (np.log(norm_vector) + tmp_prefactor) if return_offset else None)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "if", "arg_1", ":", "arg_3", "=", "arg_0", ".", "max", "(", "axis", "=", "1", ")", "arg_4", "=", "np", ".", "exp", "(", "arg_0", ".", "T", "-", "arg_3", ")", ".", "T", "else", ":", "arg_3", "=", "0.0", "arg_4", "=", "arg_0", "arg_5", "=", "arg_4", ".", "sum", "(", "axis", "=", "1", ")", "return", "(", "np", ".", "copy", "(", "np", ".", "einsum", "(", "'ai,a->ai'", ",", "arg_4", ",", "1.0", "/", "arg_5", ")", ")", ",", "(", "np", ".", "log", "(", "arg_5", ")", "+", "arg_3", ")", "if", "arg_2", "else", "None", ")"], "function": "def Func(arg_0, arg_1=False, arg_2 = True):\n    \"\"\"return a normalized version of a profile matrix\n\n    Parameters\n    ----------\n    in_profile : np.array\n        shape Lxq, will be normalized to one across each row\n    log : bool, optional\n        treat the input as log probabilities\n    return_offset : bool, optional\n        return the log of the scale factor for each row\n\n    Returns\n    -------\n    tuple\n        normalized profile (fresh np object) and offset (if return_offset==True)\n    \"\"\"\n    if arg_1:\n        arg_3 = arg_0.max(axis=1)\n        arg_4 = np.exp(arg_0.T - arg_3).T\n    else:\n        arg_3 = 0.0\n        arg_4 = arg_0\n\n    arg_5 = arg_4.sum(axis=1)\n    return (np.copy(np.einsum('ai,a->ai',arg_4,1.0/arg_5)),\n            (np.log(arg_5) + arg_3) if arg_2 else None)", "path": "treetime/seq_utils.py", "identifier": "normalize_profile", "docstring": "return a normalized version of a profile matrix\n\n    Parameters\n    ----------\n    in_profile : np.array\n        shape Lxq, will be normalized to one across each row\n    log : bool, optional\n        treat the input as log probabilities\n    return_offset : bool, optional\n        return the log of the scale factor for each row\n\n    Returns\n    -------\n    tuple\n        normalized profile (fresh np object) and offset (if return_offset==True)", "docstring_tokens": ["return", "a", "normalized", "version", "of", "a", "profile", "matrix"], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 260457}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_taggers.py#L669-L757", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "iterate through ner_xml_path to fuse with i_chunk into o_chunk", "language": "python", "parameters": "(self, ner_xml_path, i_chunk, o_chunk)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_2", ".", "__iter__", "(", ")", "arg_5", "=", "xml", ".", "dom", ".", "minidom", ".", "parse", "(", "open", "(", "arg_1", ")", ")", "for", "arg_6", "in", "arg_5", ".", "getElementsByTagName", "(", "'FILENAME'", ")", ":", "arg_7", "=", "arg_4", ".", "next", "(", ")", "arg_8", "=", "arg_6", ".", "attributes", ".", "get", "(", "'stream_id'", ")", ".", "value", "if", "arg_7", ".", "stream_id", "is", "None", ":", "assert", "not", "arg_8", ",", "'out of sync: None != %r'", "%", "arg_8", "logger", ".", "critical", "(", "'si.stream_id is None... ignoring'", ")", "continue", "assert", "arg_8", "and", "arg_8", "==", "arg_7", ".", "stream_id", ",", "'%s != %s'", "%", "(", "arg_8", ",", "arg_7", ".", "stream_id", ")", "if", "not", "arg_7", ".", "body", ":", "continue", "arg_9", "=", "Tagging", "(", ")", "arg_9", ".", "tagger_id", "=", "arg_0", ".", "tagger_id", "'''            ## get this one file out of its FILENAME tags            tagged_doc_parts = list(files(ner_dom.toxml()))            if not tagged_doc_parts:                continue            tagged_doc = tagged_doc_parts[0][1]            ## hack            hope_original = make_clean_visible(tagged_doc, '')            open(ner_xml_path + '-clean', 'wb').write(hope_original.encode('utf-8'))            print ner_xml_path + '-clean'            '''", "arg_9", ".", "generation_time", "=", "streamcorpus", ".", "make_stream_time", "(", ")", "arg_7", ".", "body", ".", "taggings", "[", "arg_0", ".", "tagger_id", "]", "=", "arg_9", "arg_14", ",", "arg_15", ",", "arg_16", "=", "arg_0", ".", "get_sentences", "(", "arg_6", ")", "arg_7", ".", "body", ".", "sentences", "[", "arg_0", ".", "tagger_id", "]", "=", "arg_14", "arg_7", ".", "body", ".", "relations", "[", "arg_0", ".", "tagger_id", "]", "=", "arg_15", "arg_7", ".", "body", ".", "attributes", "[", "arg_0", ".", "tagger_id", "]", "=", "arg_16", "logger", ".", "debug", "(", "'finished aligning tokens %s'", "%", "arg_7", ".", "stream_id", ")", "'''            for num, sent in enumerate(sentences):                for tok in sent.tokens:                    print '%d\\t%d\\t%s' % (num, tok.offsets[OffsetType.LINES].first, repr(tok.token))            '''", "if", "'align_labels_by'", "in", "arg_0", ".", "config", "and", "arg_0", ".", "config", "[", "'align_labels_by'", "]", ":", "assert", "'aligner_data'", "in", "arg_0", ".", "config", ",", "'config missing \"aligner_data\"'", "arg_17", "=", "AlignmentStrategies", "[", "arg_0", ".", "config", "[", "'align_labels_by'", "]", "]", "arg_17", "(", "arg_7", ",", "arg_0", ".", "config", "[", "'aligner_data'", "]", ")", "gc", ".", "collect", "(", ")", "try", ":", "arg_3", ".", "add", "(", "arg_7", ")", "except", "MemoryError", ",", "exc", ":", "arg_18", "=", "traceback", ".", "format_exc", "(", "exc", ")", "arg_18", "+=", "make_memory_info_msg", "(", ")", "logger", ".", "critical", "(", "arg_18", ")", "raise", "PipelineOutOfMemory", "(", "arg_18", ")", "try", ":", "arg_3", ".", "close", "(", ")", "logger", ".", "info", "(", "'finished chunk for %r'", "%", "arg_1", ")", "except", "MemoryError", ",", "exc", ":", "arg_18", "=", "traceback", ".", "format_exc", "(", "exc", ")", "arg_18", "+=", "make_memory_info_msg", "(", ")", "logger", ".", "critical", "(", "arg_18", ")", "raise", "PipelineOutOfMemory", "(", "arg_18", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        ''' iterate through ner_xml_path to fuse with i_chunk into o_chunk '''\n        ## prepare to iterate over the input chunk\n        arg_4 = arg_2.__iter__()\n\n        arg_5 = xml.dom.minidom.parse(open(arg_1))\n\n        ## this converts our UTF-8 data into unicode strings, so when\n        ## we want to compute byte offsets or construct tokens, we\n        ## must .encode('utf8')\n        for arg_6 in arg_5.getElementsByTagName('FILENAME'):\n        #for stream_id, raw_ner in files(open(ner_xml_path).read().decode('utf8')):\n\n            arg_7 = arg_4.next()\n\n            ## get stream_id out of the XML\n            arg_8 = arg_6.attributes.get('stream_id').value\n            if arg_7.stream_id is None:\n                assert not arg_8, 'out of sync: None != %r' % arg_8\n                logger.critical('si.stream_id is None... ignoring')\n                continue\n            assert arg_8 and arg_8 == arg_7.stream_id, \\\n                '%s != %s' % (arg_8, arg_7.stream_id)\n\n            if not arg_7.body:\n                ## the XML better have had an empty clean_visible too...\n                #assert not ner_dom....something\n                continue\n\n            arg_9 = Tagging()\n            arg_9.tagger_id = arg_0.tagger_id  # pylint: disable=E1101\n\n            '''\n            ## get this one file out of its FILENAME tags\n            tagged_doc_parts = list(files(ner_dom.toxml()))\n            if not tagged_doc_parts:\n                continue\n\n            tagged_doc = tagged_doc_parts[0][1]\n\n            ## hack\n            hope_original = make_clean_visible(tagged_doc, '')\n            open(ner_xml_path + '-clean', 'wb').write(hope_original.encode('utf-8'))\n            print ner_xml_path + '-clean'\n            '''\n\n            #tagging.raw_tagging = tagged_doc\n            arg_9.generation_time = streamcorpus.make_stream_time()\n            arg_7.body.taggings[arg_0.tagger_id] = arg_9       # pylint: disable=E1101\n\n            ## could consume lots of memory here by instantiating everything\n            arg_14, arg_15, arg_16 = arg_0.get_sentences(arg_6)\n            arg_7.body.sentences[arg_0.tagger_id] = arg_14    # pylint: disable=E1101\n            arg_7.body.relations[arg_0.tagger_id] = arg_15    # pylint: disable=E1101\n            arg_7.body.attributes[arg_0.tagger_id] = arg_16  # pylint: disable=E1101\n\n            logger.debug('finished aligning tokens %s' % arg_7.stream_id)\n\n            '''\n            for num, sent in enumerate(sentences):\n                for tok in sent.tokens:\n                    print '%d\\t%d\\t%s' % (num, tok.offsets[OffsetType.LINES].first, repr(tok.token))\n            '''\n\n            if 'align_labels_by' in arg_0.config and arg_0.config['align_labels_by']:\n                assert 'aligner_data' in arg_0.config, 'config missing \"aligner_data\"'\n                arg_17 = AlignmentStrategies[ arg_0.config['align_labels_by'] ]\n                arg_17( arg_7, arg_0.config['aligner_data'] )\n\n            ## forcibly collect dereferenced objects\n            gc.collect()\n\n            try:\n                arg_3.add(arg_7)\n            except MemoryError, exc:\n                arg_18 = traceback.format_exc(exc)\n                arg_18 += make_memory_info_msg()\n                logger.critical(arg_18)\n                raise PipelineOutOfMemory(arg_18)\n\n        ## all done, so close the o_chunk\n        try:\n            arg_3.close()\n            logger.info('finished chunk for %r' % arg_1)\n        except MemoryError, exc:\n            arg_18 = traceback.format_exc(exc)\n            arg_18 += make_memory_info_msg()\n            logger.critical(arg_18)\n            raise PipelineOutOfMemory(arg_18)", "path": "streamcorpus_pipeline/_taggers.py", "identifier": "TaggerBatchTransform.align_chunk_with_ner", "docstring": "iterate through ner_xml_path to fuse with i_chunk into o_chunk", "docstring_tokens": ["iterate", "through", "ner_xml_path", "to", "fuse", "with", "i_chunk", "into", "o_chunk"], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 260458}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L761-L785", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Wait till a window does not exist.", "language": "python", "parameters": "(self, window_name, object_name='', guiTimeOut=30)", "return_statement": "return 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ",", "arg_3", "=", "30", ")", ":", "arg_4", "=", "0", "while", "arg_4", "<", "arg_3", ":", "if", "not", "arg_0", ".", "guiexist", "(", "arg_1", ",", "arg_2", ")", ":", "return", "1", "time", ".", "sleep", "(", "1", ")", "arg_4", "+=", "1", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2='', arg_3=30):\n        \"\"\"\n        Wait till a window does not exist.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n        @param guiTimeOut: Wait timeout in seconds\n        @type guiTimeOut: integer\n\n        @return: 1 if GUI has gone away, 0 if not.\n        @rtype: integer\n        \"\"\"\n        arg_4 = 0\n        while arg_4 < arg_3:\n            if not arg_0.guiexist(arg_1, arg_2):\n                return 1\n            # Wait 1 second before retrying\n            time.sleep(1)\n            arg_4 += 1\n        # Object and/or window still appears within the timeout period\n        return 0", "path": "atomac/ldtpd/core.py", "identifier": "Core.waittillguinotexist", "docstring": "Wait till a window does not exist.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type object_name: string\n        @param guiTimeOut: Wait timeout in seconds\n        @type guiTimeOut: integer\n\n        @return: 1 if GUI has gone away, 0 if not.\n        @rtype: integer", "docstring_tokens": ["Wait", "till", "a", "window", "does", "not", "exist", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260459}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/dtype_util.py#L150-L198", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "r\"\"\"Asserts all items are of the same base type.", "language": "python", "parameters": "(items, expected_type=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_1", "arg_3", "=", "False", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", "is", "not", "None", ":", "arg_5", "=", "base_dtype", "(", "arg_4", ".", "dtype", ")", "if", "not", "arg_1", ":", "arg_1", "=", "arg_5", "elif", "arg_1", "!=", "arg_5", ":", "arg_3", "=", "True", "break", "if", "arg_3", ":", "arg_1", "=", "arg_2", "arg_6", "=", "None", "arg_7", "=", "lambda", "x", ":", "x", ".", "name", "if", "hasattr", "(", "x", ",", "'name'", ")", "else", "str", "(", "x", ")", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", "is", "not", "None", ":", "arg_5", "=", "base_dtype", "(", "arg_4", ".", "dtype", ")", "if", "not", "arg_1", ":", "arg_1", "=", "arg_5", "arg_6", "=", "arg_7", "(", "arg_4", ")", "elif", "arg_1", "!=", "arg_5", ":", "raise", "ValueError", "(", "'{}, type={}, must be of the same type ({}){}.'", ".", "format", "(", "arg_7", "(", "arg_4", ")", ",", "arg_5", ",", "arg_1", ",", "(", "(", "' as {}'", ".", "format", "(", "arg_6", ")", ")", "if", "arg_6", "else", "''", ")", ")", ")", "return", "arg_1", "else", ":", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n  r\"\"\"Asserts all items are of the same base type.\n\n  Args:\n    items: List of graph items (e.g., `Variable`, `Tensor`, `SparseTensor`,\n        `Operation`, or `IndexedSlices`). Can include `None` elements, which\n        will be ignored.\n    expected_type: Expected type. If not specified, assert all items are\n        of the same base type.\n\n  Returns:\n    Validated type, or none if neither expected_type nor items provided.\n\n  Raises:\n    ValueError: If any types do not match.\n  \"\"\"\n  arg_2 = arg_1\n  arg_3 = False\n  for arg_4 in arg_0:\n    if arg_4 is not None:\n      arg_5 = base_dtype(arg_4.dtype)\n      if not arg_1:\n        arg_1 = arg_5\n      elif arg_1 != arg_5:\n        arg_3 = True\n        break\n  if arg_3:\n    # Loop back through and build up an informative error message (this is very\n    # slow, so we don't do it unless we found an error above).\n    arg_1 = arg_2\n    arg_6 = None\n    arg_7 = lambda x: x.name if hasattr(x, 'name') else str(x)\n    for arg_4 in arg_0:\n      if arg_4 is not None:\n        arg_5 = base_dtype(arg_4.dtype)\n        if not arg_1:\n          arg_1 = arg_5\n          arg_6 = arg_7(arg_4)\n        elif arg_1 != arg_5:\n          raise ValueError(\n              '{}, type={}, must be of the same type ({}){}.'.format(\n                  arg_7(arg_4),\n                  arg_5,\n                  arg_1,\n                  ((' as {}'.format(arg_6))\n                   if arg_6 else '')))\n    return arg_1  # Should be unreachable\n  else:\n    return arg_1", "path": "tensorflow_probability/python/internal/dtype_util.py", "identifier": "_assert_same_base_type", "docstring": "r\"\"\"Asserts all items are of the same base type.\n\n  Args:\n    items: List of graph items (e.g., `Variable`, `Tensor`, `SparseTensor`,\n        `Operation`, or `IndexedSlices`). Can include `None` elements, which\n        will be ignored.\n    expected_type: Expected type. If not specified, assert all items are\n        of the same base type.\n\n  Returns:\n    Validated type, or none if neither expected_type nor items provided.\n\n  Raises:\n    ValueError: If any types do not match.", "docstring_tokens": ["r", "Asserts", "all", "items", "are", "of", "the", "same", "base", "type", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260460}
{"url": "https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/listener.py#L128-L138", "sha": "0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b", "docstring_summary": "Press button. Check DEFAULT_DELAY.", "language": "python", "parameters": "(self, device)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "src", ".", "lower", "(", ")", "if", "arg_3", "[", "arg_2", "]", "+", "arg_0", ".", "settings", ".", "get", "(", "'delay'", ",", "DEFAULT_DELAY", ")", ">", "time", ".", "time", "(", ")", ":", "return", "arg_3", "[", "arg_2", "]", "=", "time", ".", "time", "(", ")", "arg_0", ".", "execute", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Press button. Check DEFAULT_DELAY.\n\n        :param scapy.packet.Packet device: Scapy packet\n        :return: None\n        \"\"\"\n        arg_2 = arg_1.src.lower()\n        if arg_3[arg_2] + arg_0.settings.get('delay', DEFAULT_DELAY) > time.time():\n            return\n        arg_3[arg_2] = time.time()\n        arg_0.execute(arg_1)", "path": "amazon_dash/listener.py", "identifier": "Listener.on_push", "docstring": "Press button. Check DEFAULT_DELAY.\n\n        :param scapy.packet.Packet device: Scapy packet\n        :return: None", "docstring_tokens": ["Press", "button", ".", "Check", "DEFAULT_DELAY", "."], "nwo": "Nekmo/amazon-dash", "score": 0.758195400618659, "idx": 260461}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L1006-L1015", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return a pkg_resources.Distribution built from self.egg_info_path", "language": "python", "parameters": "(self)", "return_statement": "return pkg_resources.Distribution(\n            os.path.dirname(egg_info),\n            project_name=dist_name,\n            metadata=metadata)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "egg_info_path", "(", "''", ")", ".", "rstrip", "(", "'/'", ")", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "arg_3", "=", "pkg_resources", ".", "PathMetadata", "(", "arg_2", ",", "arg_1", ")", "arg_4", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "arg_1", ")", ")", "[", "0", "]", "return", "pkg_resources", ".", "Distribution", "(", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", ",", "project_name", "=", "arg_4", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"Return a pkg_resources.Distribution built from self.egg_info_path\"\"\"\n        arg_1 = arg_0.egg_info_path('').rstrip('/')\n        arg_2 = os.path.dirname(arg_1)\n        arg_3 = pkg_resources.PathMetadata(arg_2, arg_1)\n        arg_4 = os.path.splitext(os.path.basename(arg_1))[0]\n        return pkg_resources.Distribution(\n            os.path.dirname(arg_1),\n            project_name=arg_4,\n            arg_3=arg_3)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py", "identifier": "InstallRequirement.get_dist", "docstring": "Return a pkg_resources.Distribution built from self.egg_info_path", "docstring_tokens": ["Return", "a", "pkg_resources", ".", "Distribution", "built", "from", "self", ".", "egg_info_path"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260462}
{"url": "https://github.com/encode/starlette/blob/d23bfd0d8ff68d535d0283aa4099e5055da88bb9/starlette/middleware/wsgi.py#L10-L52", "sha": "d23bfd0d8ff68d535d0283aa4099e5055da88bb9", "docstring_summary": "Builds a scope and request body into a WSGI environ object.", "language": "python", "parameters": "(scope: Scope, body: bytes)", "return_statement": "return environ", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", "->", "dict", ":", "arg_4", "=", "{", "\"REQUEST_METHOD\"", ":", "arg_0", "[", "\"method\"", "]", ",", "\"SCRIPT_NAME\"", ":", "arg_0", ".", "get", "(", "\"root_path\"", ",", "\"\"", ")", ",", "\"PATH_INFO\"", ":", "arg_0", "[", "\"path\"", "]", ",", "\"QUERY_STRING\"", ":", "arg_0", "[", "\"query_string\"", "]", ".", "decode", "(", "\"ascii\"", ")", ",", "\"SERVER_PROTOCOL\"", ":", "f\"HTTP/{scope['http_version']}\"", ",", "\"wsgi.version\"", ":", "(", "1", ",", "0", ")", ",", "\"wsgi.url_scheme\"", ":", "arg_0", ".", "get", "(", "\"scheme\"", ",", "\"http\"", ")", ",", "\"wsgi.input\"", ":", "io", ".", "BytesIO", "(", "arg_2", ")", ",", "\"wsgi.errors\"", ":", "sys", ".", "stdout", ",", "\"wsgi.multithread\"", ":", "True", ",", "\"wsgi.multiprocess\"", ":", "True", ",", "\"wsgi.run_once\"", ":", "False", ",", "}", "arg_5", "=", "arg_0", ".", "get", "(", "\"server\"", ")", "or", "(", "\"localhost\"", ",", "80", ")", "arg_4", "[", "\"SERVER_NAME\"", "]", "=", "arg_5", "[", "0", "]", "arg_4", "[", "\"SERVER_PORT\"", "]", "=", "arg_5", "[", "1", "]", "if", "arg_0", ".", "get", "(", "\"client\"", ")", ":", "arg_4", "[", "\"REMOTE_ADDR\"", "]", "=", "arg_0", "[", "\"client\"", "]", "[", "0", "]", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "get", "(", "\"headers\"", ",", "[", "]", ")", ":", "arg_6", "=", "arg_6", ".", "decode", "(", "\"latin1\"", ")", "if", "arg_6", "==", "\"content-length\"", ":", "arg_8", "=", "\"CONTENT_LENGTH\"", "elif", "arg_6", "==", "\"content-type\"", ":", "arg_8", "=", "\"CONTENT_TYPE\"", "else", ":", "arg_8", "=", "f\"HTTP_{name}\"", ".", "upper", "(", ")", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "arg_7", "=", "arg_7", ".", "decode", "(", "\"latin1\"", ")", "if", "arg_8", "in", "arg_4", ":", "arg_7", "=", "arg_4", "[", "arg_8", "]", "+", "\",\"", "+", "arg_7", "arg_4", "[", "arg_8", "]", "=", "arg_7", "return", "arg_4"], "function": "def Func(arg_0: arg_1, arg_2: arg_3) -> dict:\n    \"\"\"\n    Builds a scope and request body into a WSGI environ object.\n    \"\"\"\n    arg_4 = {\n        \"REQUEST_METHOD\": arg_0[\"method\"],\n        \"SCRIPT_NAME\": arg_0.get(\"root_path\", \"\"),\n        \"PATH_INFO\": arg_0[\"path\"],\n        \"QUERY_STRING\": arg_0[\"query_string\"].decode(\"ascii\"),\n        \"SERVER_PROTOCOL\": f\"HTTP/{scope['http_version']}\",\n        \"wsgi.version\": (1, 0),\n        \"wsgi.url_scheme\": arg_0.get(\"scheme\", \"http\"),\n        \"wsgi.input\": io.BytesIO(arg_2),\n        \"wsgi.errors\": sys.stdout,\n        \"wsgi.multithread\": True,\n        \"wsgi.multiprocess\": True,\n        \"wsgi.run_once\": False,\n    }\n\n    # Get server name and port - required in WSGI, not in ASGI\n    arg_5 = arg_0.get(\"server\") or (\"localhost\", 80)\n    arg_4[\"SERVER_NAME\"] = arg_5[0]\n    arg_4[\"SERVER_PORT\"] = arg_5[1]\n\n    # Get client IP address\n    if arg_0.get(\"client\"):\n        arg_4[\"REMOTE_ADDR\"] = arg_0[\"client\"][0]\n\n    # Go through headers and make them into environ entries\n    for arg_6, arg_7 in arg_0.get(\"headers\", []):\n        arg_6 = arg_6.decode(\"latin1\")\n        if arg_6 == \"content-length\":\n            arg_8 = \"CONTENT_LENGTH\"\n        elif arg_6 == \"content-type\":\n            arg_8 = \"CONTENT_TYPE\"\n        else:\n            arg_8 = f\"HTTP_{name}\".upper().replace(\"-\", \"_\")\n        # HTTPbis say only ASCII chars are allowed in headers, but we latin1 just in case\n        arg_7 = arg_7.decode(\"latin1\")\n        if arg_8 in arg_4:\n            arg_7 = arg_4[arg_8] + \",\" + arg_7\n        arg_4[arg_8] = arg_7\n    return arg_4", "path": "starlette/middleware/wsgi.py", "identifier": "build_environ", "docstring": "Builds a scope and request body into a WSGI environ object.", "docstring_tokens": ["Builds", "a", "scope", "and", "request", "body", "into", "a", "WSGI", "environ", "object", "."], "nwo": "encode/starlette", "score": 0.9921761654937327, "idx": 260463}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1569-L1584", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Inserts HTML using the specified cursor, then returns its plain text\n            version.", "language": "python", "parameters": "(self, cursor, html)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "beginEditBlock", "(", ")", "arg_1", ".", "removeSelectedText", "(", ")", "arg_3", "=", "arg_1", ".", "position", "(", ")", "arg_0", ".", "_insert_html", "(", "arg_1", ",", "arg_2", ")", "arg_4", "=", "arg_1", ".", "position", "(", ")", "arg_1", ".", "setPosition", "(", "arg_3", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "arg_5", "=", "arg_1", ".", "selection", "(", ")", ".", "toPlainText", "(", ")", "arg_1", ".", "setPosition", "(", "arg_4", ")", "arg_1", ".", "endEditBlock", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Inserts HTML using the specified cursor, then returns its plain text\n            version.\n        \"\"\"\n        arg_1.beginEditBlock()\n        arg_1.removeSelectedText()\n\n        arg_3 = arg_1.position()\n        arg_0._insert_html(arg_1, arg_2)\n        arg_4 = arg_1.position()\n        arg_1.setPosition(arg_3, QtGui.QTextCursor.KeepAnchor)\n        arg_5 = arg_1.selection().toPlainText()\n\n        arg_1.setPosition(arg_4)\n        arg_1.endEditBlock()\n        return arg_5", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._insert_html_fetching_plain_text", "docstring": "Inserts HTML using the specified cursor, then returns its plain text\n            version.", "docstring_tokens": ["Inserts", "HTML", "using", "the", "specified", "cursor", "then", "returns", "its", "plain", "text", "version", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260464}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L208-L221", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks for the existence of a file in Google Cloud Storage.", "language": "python", "parameters": "(self, bucket_name, object_name)", "return_statement": "return blob.exists()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_conn", "(", ")", "arg_4", "=", "arg_3", ".", "get_bucket", "(", "arg_1", "=", "arg_1", ")", "arg_5", "=", "arg_4", ".", "blob", "(", "blob_name", "=", "arg_2", ")", "return", "arg_5", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Checks for the existence of a file in Google Cloud Storage.\n\n        :param bucket_name: The Google cloud storage bucket where the object is.\n        :type bucket_name: str\n        :param object_name: The name of the blob_name to check in the Google cloud\n            storage bucket.\n        :type object_name: str\n        \"\"\"\n        arg_3 = arg_0.get_conn()\n        arg_4 = arg_3.get_bucket(arg_1=arg_1)\n        arg_5 = arg_4.blob(blob_name=arg_2)\n        return arg_5.Func()", "path": "airflow/contrib/hooks/gcs_hook.py", "identifier": "GoogleCloudStorageHook.exists", "docstring": "Checks for the existence of a file in Google Cloud Storage.\n\n        :param bucket_name: The Google cloud storage bucket where the object is.\n        :type bucket_name: str\n        :param object_name: The name of the blob_name to check in the Google cloud\n            storage bucket.\n        :type object_name: str", "docstring_tokens": ["Checks", "for", "the", "existence", "of", "a", "file", "in", "Google", "Cloud", "Storage", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260465}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/meta.py#L3234-L3284", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Augmenter that always executes exactly one of its children.", "language": "python", "parameters": "(children, name=None, deterministic=False, random_state=None)", "return_statement": "return SomeOf(n=1, children=children, random_order=False, name=name, deterministic=deterministic,\n                  random_state=random_state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "return", "SomeOf", "(", "n", "=", "1", ",", "arg_0", "=", "arg_0", ",", "random_order", "=", "False", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=None):\n    \"\"\"\n    Augmenter that always executes exactly one of its children.\n\n    dtype support::\n\n        See ``imgaug.augmenters.meta.SomeOf``.\n\n    Parameters\n    ----------\n    children : list of imgaug.augmenters.meta.Augmenter\n        The choices of augmenters to apply.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> imgs = [np.ones((10, 10))]\n    >>> seq = iaa.Func([\n    >>>     iaa.Fliplr(1.0),\n    >>>     iaa.Flipud(1.0)\n    >>> ])\n    >>> imgs_aug = seq.augment_images(imgs)\n\n    flips each image either horizontally or vertically.\n\n\n    >>> seq = iaa.Func([\n    >>>     iaa.Fliplr(1.0),\n    >>>     iaa.Sequential([\n    >>>         iaa.GaussianBlur(1.0),\n    >>>         iaa.Dropout(0.05),\n    >>>         iaa.AdditiveGaussianNoise(0.1*255)\n    >>>     ]),\n    >>>     iaa.Noop()\n    >>> ])\n    >>> imgs_aug = seq.augment_images(imgs)\n\n    either flips each image horizontally, or adds blur+dropout+noise or does\n    nothing.\n\n    \"\"\"\n    return SomeOf(n=1, arg_0=arg_0, random_order=False, arg_1=arg_1, arg_2=arg_2,\n                  arg_3=arg_3)", "path": "imgaug/augmenters/meta.py", "identifier": "OneOf", "docstring": "Augmenter that always executes exactly one of its children.\n\n    dtype support::\n\n        See ``imgaug.augmenters.meta.SomeOf``.\n\n    Parameters\n    ----------\n    children : list of imgaug.augmenters.meta.Augmenter\n        The choices of augmenters to apply.\n\n    name : None or str, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    deterministic : bool, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    random_state : None or int or numpy.random.RandomState, optional\n        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.\n\n    Examples\n    --------\n    >>> imgs = [np.ones((10, 10))]\n    >>> seq = iaa.OneOf([\n    >>>     iaa.Fliplr(1.0),\n    >>>     iaa.Flipud(1.0)\n    >>> ])\n    >>> imgs_aug = seq.augment_images(imgs)\n\n    flips each image either horizontally or vertically.\n\n\n    >>> seq = iaa.OneOf([\n    >>>     iaa.Fliplr(1.0),\n    >>>     iaa.Sequential([\n    >>>         iaa.GaussianBlur(1.0),\n    >>>         iaa.Dropout(0.05),\n    >>>         iaa.AdditiveGaussianNoise(0.1*255)\n    >>>     ]),\n    >>>     iaa.Noop()\n    >>> ])\n    >>> imgs_aug = seq.augment_images(imgs)\n\n    either flips each image horizontally, or adds blur+dropout+noise or does\n    nothing.", "docstring_tokens": ["Augmenter", "that", "always", "executes", "exactly", "one", "of", "its", "children", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 260466}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/trello.py#L141-L159", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Returns a list of the filtered lists for the given board\n        This filters the trello lists according to the configuration values of\n        trello.include_lists and trello.exclude_lists.", "language": "python", "parameters": "(self, board)", "return_statement": "return lists", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "api_request", "(", "\"/1/boards/{board_id}/lists/open\"", ".", "format", "(", "board_id", "=", "arg_1", ")", ",", "fields", "=", "'name'", ")", "arg_3", "=", "arg_0", ".", "config", ".", "get", "(", "'include_lists'", ",", "to_type", "=", "aslist", ")", "if", "arg_3", ":", "arg_2", "=", "[", "l", "for", "l", "in", "arg_2", "if", "l", "[", "'name'", "]", "in", "arg_3", "]", "arg_4", "=", "arg_0", ".", "config", ".", "get", "(", "'exclude_lists'", ",", "to_type", "=", "aslist", ")", "if", "arg_4", ":", "arg_2", "=", "[", "l", "for", "l", "in", "arg_2", "if", "l", "[", "'name'", "]", "not", "in", "arg_4", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns a list of the filtered lists for the given board\n        This filters the trello lists according to the configuration values of\n        trello.include_lists and trello.exclude_lists.\n        \"\"\"\n        arg_2 = arg_0.api_request(\n            \"/1/boards/{board_id}/lists/open\".format(board_id=arg_1),\n            fields='name')\n\n        arg_3 = arg_0.config.get('include_lists', to_type=aslist)\n        if arg_3:\n            arg_2 = [l for l in arg_2 if l['name'] in arg_3]\n\n        arg_4 = arg_0.config.get('exclude_lists', to_type=aslist)\n        if arg_4:\n            arg_2 = [l for l in arg_2 if l['name'] not in arg_4]\n\n        return arg_2", "path": "bugwarrior/services/trello.py", "identifier": "TrelloService.get_lists", "docstring": "Returns a list of the filtered lists for the given board\n        This filters the trello lists according to the configuration values of\n        trello.include_lists and trello.exclude_lists.", "docstring_tokens": ["Returns", "a", "list", "of", "the", "filtered", "lists", "for", "the", "given", "board", "This", "filters", "the", "trello", "lists", "according", "to", "the", "configuration", "values", "of", "trello", ".", "include_lists", "and", "trello", ".", "exclude_lists", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 260467}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L675-L698", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Returns the components of this name, as a sequence of 2-tuples.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "range", "(", "_lib", ".", "X509_NAME_entry_count", "(", "arg_0", ".", "_name", ")", ")", ":", "arg_3", "=", "_lib", ".", "X509_NAME_get_entry", "(", "arg_0", ".", "_name", ",", "arg_2", ")", "arg_4", "=", "_lib", ".", "X509_NAME_ENTRY_get_object", "(", "arg_3", ")", "arg_5", "=", "_lib", ".", "X509_NAME_ENTRY_get_data", "(", "arg_3", ")", "arg_6", "=", "_lib", ".", "OBJ_obj2nid", "(", "arg_4", ")", "arg_7", "=", "_lib", ".", "OBJ_nid2sn", "(", "arg_6", ")", "arg_8", "=", "_ffi", ".", "buffer", "(", "_lib", ".", "ASN1_STRING_data", "(", "arg_5", ")", ",", "_lib", ".", "ASN1_STRING_length", "(", "arg_5", ")", ")", "[", ":", "]", "arg_1", ".", "append", "(", "(", "_ffi", ".", "string", "(", "arg_7", ")", ",", "arg_8", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the components of this name, as a sequence of 2-tuples.\n\n        :return: The components of this name.\n        :rtype: :py:class:`list` of ``name, value`` tuples.\n        \"\"\"\n        arg_1 = []\n        for arg_2 in range(_lib.X509_NAME_entry_count(arg_0._name)):\n            arg_3 = _lib.X509_NAME_get_entry(arg_0._name, arg_2)\n\n            arg_4 = _lib.X509_NAME_ENTRY_get_object(arg_3)\n            arg_5 = _lib.X509_NAME_ENTRY_get_data(arg_3)\n\n            arg_6 = _lib.OBJ_obj2nid(arg_4)\n            arg_7 = _lib.OBJ_nid2sn(arg_6)\n\n            # ffi.string does not handle strings containing NULL bytes\n            # (which may have been generated by old, broken software)\n            arg_8 = _ffi.buffer(_lib.ASN1_STRING_data(arg_5),\n                                _lib.ASN1_STRING_length(arg_5))[:]\n            arg_1.append((_ffi.string(arg_7), arg_8))\n\n        return arg_1", "path": "src/OpenSSL/crypto.py", "identifier": "X509Name.get_components", "docstring": "Returns the components of this name, as a sequence of 2-tuples.\n\n        :return: The components of this name.\n        :rtype: :py:class:`list` of ``name, value`` tuples.", "docstring_tokens": ["Returns", "the", "components", "of", "this", "name", "as", "a", "sequence", "of", "2", "-", "tuples", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 260468}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1389-L1402", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Enable support for negotiating SRTP keying material.", "language": "python", "parameters": "(self, profiles)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"profiles must be a byte string.\"", ")", "_openssl_assert", "(", "_lib", ".", "SSL_CTX_Func", "(", "arg_0", ".", "_context", ",", "arg_1", ")", "==", "0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Enable support for negotiating SRTP keying material.\n\n        :param bytes profiles: A colon delimited list of protection profile\n            names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``.\n        :return: None\n        \"\"\"\n        if not isinstance(arg_1, bytes):\n            raise TypeError(\"profiles must be a byte string.\")\n\n        _openssl_assert(\n            _lib.SSL_CTX_Func(arg_0._context, arg_1) == 0\n        )", "path": "src/OpenSSL/SSL.py", "identifier": "Context.set_tlsext_use_srtp", "docstring": "Enable support for negotiating SRTP keying material.\n\n        :param bytes profiles: A colon delimited list of protection profile\n            names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``.\n        :return: None", "docstring_tokens": ["Enable", "support", "for", "negotiating", "SRTP", "keying", "material", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 260469}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/convert.py#L15-L33", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Convert a gene panel with hgnc symbols to a new one with hgnc ids.", "language": "python", "parameters": "(context, panel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_3", "=", "[", "\"hgnc_id\"", ",", "\"hgnc_symbol\"", ",", "\"disease_associated_transcripts\"", ",", "\"reduced_penetrance\"", ",", "\"genetic_disease_models\"", ",", "\"mosaicism\"", ",", "\"database_entry_version\"", "]", "arg_4", "=", "parse_genes", "(", "arg_1", ")", "arg_2", ".", "add_hgnc_id", "(", "arg_4", ")", "click", ".", "echo", "(", "\"#{0}\"", ".", "format", "(", "'\\t'", ".", "join", "(", "arg_3", ")", ")", ")", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", ".", "get", "(", "'hgnc_id'", ")", ":", "arg_6", "=", "[", "]", "for", "arg_7", "in", "arg_3", ":", "arg_6", ".", "append", "(", "str", "(", "arg_5", "[", "arg_7", "]", ")", "if", "arg_5", ".", "get", "(", "arg_7", ")", "else", "''", ")", "click", ".", "echo", "(", "'\\t'", ".", "join", "(", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Convert a gene panel with hgnc symbols to a new one with hgnc ids.\"\"\"\n    arg_2 = arg_0.obj['adapter']\n    arg_3 = [\"hgnc_id\",\"hgnc_symbol\",\"disease_associated_transcripts\",\n                 \"reduced_penetrance\", \"genetic_disease_models\", \"mosaicism\",\n                 \"database_entry_version\"]\n    \n    arg_4 = parse_genes(arg_1)\n    \n    arg_2.add_hgnc_id(arg_4)\n    \n    click.echo(\"#{0}\".format('\\t'.join(arg_3)))\n    for arg_5 in arg_4:\n        if arg_5.get('hgnc_id'):\n            arg_6 = []\n            for arg_7 in arg_3:\n                arg_6.append(str(arg_5[arg_7]) if arg_5.get(arg_7) else '')\n            \n            click.echo('\\t'.join(arg_6))", "path": "scout/commands/convert.py", "identifier": "convert", "docstring": "Convert a gene panel with hgnc symbols to a new one with hgnc ids.", "docstring_tokens": ["Convert", "a", "gene", "panel", "with", "hgnc", "symbols", "to", "a", "new", "one", "with", "hgnc", "ids", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260470}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/reader.py#L63-L82", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Parse the given ChangeLog data into a list of Hashes.", "language": "python", "parameters": "(data)", "return_statement": "return parsed", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "re", ".", "compile", "(", "\"^## .+$\"", ",", "re", ".", "MULTILINE", ")", ".", "split", "(", "arg_0", ")", "arg_2", "=", "re", ".", "findall", "(", "\"^## .+?$\"", ",", "arg_0", ",", "re", ".", "MULTILINE", ")", "arg_1", ".", "pop", "(", "0", ")", "arg_3", "=", "[", "]", "def", "func", "(", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "Func_heading", "(", "arg_4", ")", "arg_6", "[", "\"content\"", "]", "=", "arg_5", "arg_3", ".", "append", "(", "arg_6", ")", "list", "(", "map", "(", "func", ",", "arg_2", ",", "arg_1", ")", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Parse the given ChangeLog data into a list of Hashes.\n\n    @param [String] data File data from the ChangeLog.md\n    @return [Array<Hash>] Parsed data, e.g. [{ 'version' => ..., 'url' => ..., 'date' => ..., 'content' => ...}, ...]\n    \"\"\"\n\n    arg_1 = re.compile(\"^## .+$\", re.MULTILINE).split(arg_0)\n    arg_2 = re.findall(\"^## .+?$\", arg_0, re.MULTILINE)\n    arg_1.pop(0)\n    arg_3 = []\n\n    def func(arg_4, arg_5):\n        arg_6 = Func_heading(arg_4)\n        arg_6[\"content\"] = arg_5\n        arg_3.append(arg_6)\n\n    list(map(func, arg_2, arg_1))\n    return arg_3", "path": "pygcgen/reader.py", "identifier": "parse", "docstring": "Parse the given ChangeLog data into a list of Hashes.\n\n    @param [String] data File data from the ChangeLog.md\n    @return [Array<Hash>] Parsed data, e.g. [{ 'version' => ..., 'url' => ..., 'date' => ..., 'content' => ...}, ...]", "docstring_tokens": ["Parse", "the", "given", "ChangeLog", "data", "into", "a", "list", "of", "Hashes", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 260471}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L539-L552", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "distribute Heron packages to all nodes", "language": "python", "parameters": "(roles, cl_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "Log", ".", "info", "(", "\"Distributing heron package to nodes (this might take a while)...\"", ")", "arg_2", "=", "arg_0", "[", "Role", ".", "MASTERS", "]", "arg_3", "=", "arg_0", "[", "Role", ".", "SLAVES", "]", "arg_4", "=", "tempfile", ".", "NamedTemporaryFile", "(", "suffix", "=", "\".tmp\"", ")", ".", "name", "Log", ".", "debug", "(", "\"TAR file %s to %s\"", "%", "(", "arg_1", "[", "\"heron_dir\"", "]", ",", "arg_4", ")", ")", "make_tarfile", "(", "arg_4", ",", "arg_1", "[", "\"heron_dir\"", "]", ")", "arg_5", "=", "arg_2", ".", "union", "(", "arg_3", ")", "scp_package", "(", "arg_4", ",", "arg_5", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n  '''\n  distribute Heron packages to all nodes\n  '''\n  Log.info(\"Distributing heron package to nodes (this might take a while)...\")\n  arg_2 = arg_0[Role.MASTERS]\n  arg_3 = arg_0[Role.SLAVES]\n\n  arg_4 = tempfile.NamedTemporaryFile(suffix=\".tmp\").name\n  Log.debug(\"TAR file %s to %s\" % (arg_1[\"heron_dir\"], arg_4))\n  make_tarfile(arg_4, arg_1[\"heron_dir\"])\n  arg_5 = arg_2.union(arg_3)\n\n  scp_package(arg_4, arg_5, arg_1)", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "distribute_package", "docstring": "distribute Heron packages to all nodes", "docstring_tokens": ["distribute", "Heron", "packages", "to", "all", "nodes"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260472}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L343-L359", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Return a key with its parameters if it was found.", "language": "python", "parameters": "(self, key_name, decrypt=True)", "return_statement": "return key", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_0", ".", "_assert_valid_stash", "(", ")", "arg_3", "=", "arg_0", ".", "_storage", ".", "Func", "(", "arg_1", ")", ".", "copy", "(", ")", "if", "not", "arg_3", ".", "Func", "(", "'value'", ")", ":", "return", "None", "if", "arg_2", ":", "arg_3", "[", "'value'", "]", "=", "arg_0", ".", "_decrypt", "(", "arg_3", "[", "'value'", "]", ")", "audit", "(", "storage", "=", "arg_0", ".", "_storage", ".", "db_path", ",", "action", "=", "'GET'", ",", "message", "=", "json", ".", "dumps", "(", "dict", "(", "arg_1", "=", "arg_1", ")", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"Return a key with its parameters if it was found.\n        \"\"\"\n        arg_0._assert_valid_stash()\n\n        arg_3 = arg_0._storage.Func(arg_1).copy()\n        if not arg_3.Func('value'):\n            return None\n        if arg_2:\n            arg_3['value'] = arg_0._decrypt(arg_3['value'])\n\n        audit(\n            storage=arg_0._storage.db_path,\n            action='GET',\n            message=json.dumps(dict(arg_1=arg_1)))\n\n        return arg_3", "path": "ghost.py", "identifier": "Stash.get", "docstring": "Return a key with its parameters if it was found.", "docstring_tokens": ["Return", "a", "key", "with", "its", "parameters", "if", "it", "was", "found", "."], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 260473}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/clean.py#L128-L170", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Return the list of file to delete.", "language": "python", "parameters": "(cls)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "PyFunceble", ".", "OUTPUT_DIRECTORY", "+", "PyFunceble", ".", "OUTPUTS", "[", "\"parent_directory\"", "]", "if", "not", "arg_1", ".", "endswith", "(", "PyFunceble", ".", "directory_separator", ")", ":", "arg_1", "+=", "PyFunceble", ".", "directory_separator", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "PyFunceble", ".", "walk", "(", "arg_1", ")", ":", "for", "arg_6", "in", "arg_5", ":", "if", "arg_6", "not", "in", "[", "\".gitignore\"", ",", "\".keep\"", "]", ":", "if", "arg_3", ".", "endswith", "(", "PyFunceble", ".", "directory_separator", ")", ":", "arg_2", ".", "append", "(", "arg_3", "+", "arg_6", ")", "else", ":", "arg_2", ".", "append", "(", "arg_3", "+", "PyFunceble", ".", "directory_separator", "+", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the list of file to delete.\n        \"\"\"\n\n        # We initiate the directory we have to look for.\n        arg_1 = PyFunceble.OUTPUT_DIRECTORY + PyFunceble.OUTPUTS[\"parent_directory\"]\n\n        if not arg_1.endswith(PyFunceble.directory_separator):  # pragma: no cover\n            # For safety, if it does not ends with the directory separator, we append it\n            # to its end.\n            arg_1 += PyFunceble.directory_separator\n\n        # We initiate a variable which will save the list of file to delete.\n        arg_2 = []\n\n        for arg_3, arg_4, arg_5 in PyFunceble.walk(arg_1):\n            # We walk in the directory and get all files and sub-directories.\n\n            for arg_6 in arg_5:\n                # If there is files in the current sub-directory, we loop\n                # through the list of files.\n\n                if arg_6 not in [\".gitignore\", \".keep\"]:\n                    # The file is not into our list of file we do not have to delete.\n\n                    if arg_3.endswith(PyFunceble.directory_separator):\n                        # The root ends with the directory separator.\n\n                        # We construct the path and append the full path to the result.\n                        arg_2.append(arg_3 + arg_6)\n                    else:\n                        # The root directory does not ends with the directory separator.\n\n                        # We construct the path by appending the directory separator\n                        # between the root and the filename and append the full path to\n                        # the result.\n                        arg_2.append(\n                            arg_3 + PyFunceble.directory_separator + arg_6\n                        )  # pragma: no cover\n\n        # We return our list of file to delete.\n        return arg_2", "path": "PyFunceble/clean.py", "identifier": "Clean.file_to_delete", "docstring": "Return the list of file to delete.", "docstring_tokens": ["Return", "the", "list", "of", "file", "to", "delete", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 260474}
{"url": "https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L159-L166", "sha": "d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9", "docstring_summary": "Factory for GromacsCommand derived types.", "language": "python", "parameters": "(clsname, name, driver, base=GromacsCommand)", "return_statement": "return type(clsname, (base,), clsdict)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_4", ")", ":", "arg_5", "=", "{", "'command_name'", ":", "arg_1", ",", "'driver'", ":", "arg_2", ",", "'__doc__'", ":", "property", "(", "arg_3", ".", "_get_gmx_docs", ")", "}", "return", "type", "(", "arg_0", ",", "(", "arg_3", ",", ")", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=arg_4):\n    \"\"\" Factory for GromacsCommand derived types. \"\"\"\n    arg_5 = {\n        'command_name': arg_1,\n        'driver': arg_2,\n        '__doc__': property(arg_3._get_gmx_docs)\n    }\n    return type(arg_0, (arg_3,), arg_5)", "path": "gromacs/tools.py", "identifier": "tool_factory", "docstring": "Factory for GromacsCommand derived types.", "docstring_tokens": ["Factory", "for", "GromacsCommand", "derived", "types", "."], "nwo": "Becksteinlab/GromacsWrapper", "score": 0.5487357976449433, "idx": 260475}
{"url": "https://github.com/openpermissions/bass/blob/fb606d3804e1f86b90253b25363bdfa8758ccf39/bass/hubkey.py#L114-L122", "sha": "fb606d3804e1f86b90253b25363bdfa8758ccf39", "docstring_summary": "Raise an exception if string doesn't match a part's regex", "language": "python", "parameters": "(string, part)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", "or", "not", "re", ".", "match", "(", "'^('", "+", "PARTS", "[", "arg_1", "]", "+", "')$'", ",", "arg_0", ")", ":", "raise", "ValueError", "(", "'{} should match {}'", ".", "format", "(", "arg_1", ",", "PARTS", "[", "arg_1", "]", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Raise an exception if string doesn't match a part's regex\n\n    :param string: str\n    :param part: a key in the PARTS dict\n    :raises: ValueError, TypeError\n    \"\"\"\n    if not arg_0 or not re.match('^(' + PARTS[arg_1] + ')$', arg_0):\n        raise ValueError('{} should match {}'.format(arg_1, PARTS[arg_1]))", "path": "bass/hubkey.py", "identifier": "match_part", "docstring": "Raise an exception if string doesn't match a part's regex\n\n    :param string: str\n    :param part: a key in the PARTS dict\n    :raises: ValueError, TypeError", "docstring_tokens": ["Raise", "an", "exception", "if", "string", "doesn", "t", "match", "a", "part", "s", "regex"], "nwo": "openpermissions/bass", "score": 0.0, "idx": 260476}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_collection.py#L173-L191", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Recursively finds size of objects", "language": "python", "parameters": "(cls, obj, seen=None)", "return_statement": "return size", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "sys", ".", "getsizeof", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "set", "(", ")", "arg_4", "=", "id", "(", "arg_1", ")", "if", "arg_4", "in", "arg_2", ":", "return", "0", "arg_2", ".", "add", "(", "arg_4", ")", "if", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_3", "+=", "sum", "(", "[", "arg_0", ".", "Func", "(", "arg_5", ",", "arg_2", ")", "for", "arg_5", "in", "arg_1", ".", "values", "(", ")", "]", ")", "arg_3", "+=", "sum", "(", "[", "arg_0", ".", "Func", "(", "arg_6", ",", "arg_2", ")", "for", "arg_6", "in", "arg_1", ".", "keys", "(", ")", "]", ")", "elif", "hasattr", "(", "arg_1", ",", "'__dict__'", ")", ":", "arg_3", "+=", "arg_0", ".", "Func", "(", "arg_1", ".", "__dict__", ",", "arg_2", ")", "elif", "hasattr", "(", "arg_1", ",", "'__iter__'", ")", "and", "not", "isinstance", "(", "arg_1", ",", "(", "str", ",", "bytes", ",", "bytearray", ")", ")", ":", "arg_3", "+=", "sum", "(", "[", "arg_0", ".", "Func", "(", "arg_7", ",", "arg_2", ")", "for", "arg_7", "in", "arg_1", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Recursively finds size of objects\"\"\"\n        arg_3 = sys.getsizeof(arg_1)\n        if arg_2 is None:\n            arg_2 = set()\n        arg_4 = id(arg_1)\n        if arg_4 in arg_2:\n            return 0\n        # Important mark as seen *before* entering recursion to gracefully handle\n        # self-referential objects\n        arg_2.add(arg_4)\n        if isinstance(arg_1, dict):\n            arg_3 += sum([arg_0.Func(arg_5, arg_2) for arg_5 in arg_1.values()])\n            arg_3 += sum([arg_0.Func(arg_6, arg_2) for arg_6 in arg_1.keys()])\n        elif hasattr(arg_1, '__dict__'):\n            arg_3 += arg_0.Func(arg_1.__dict__, arg_2)\n        elif hasattr(arg_1, '__iter__') and not isinstance(arg_1, (str, bytes, bytearray)):\n            arg_3 += sum([arg_0.Func(arg_7, arg_2) for arg_7 in arg_1])\n        return arg_3", "path": "sirmordred/task_collection.py", "identifier": "TaskRawDataArthurCollection.measure_memory", "docstring": "Recursively finds size of objects", "docstring_tokens": ["Recursively", "finds", "size", "of", "objects"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 260477}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/contrib/game_2048.py#L181-L194", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Prints the current state.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "tile_string", "(", "arg_1", ")", ":", "if", "arg_1", ">", "0", ":", "return", "'% 5d'", "%", "(", "2", "**", "arg_1", ",", ")", "return", "\"     \"", "arg_2", "=", "'-'", "*", "25", "print", "(", "arg_2", ")", "for", "arg_3", "in", "range", "(", "4", ")", ":", "print", "(", "\"|\"", "+", "\"|\"", ".", "join", "(", "[", "tile_string", "(", "arg_4", ")", "for", "arg_4", "in", "arg_0", ".", "_state", "[", "arg_3", ",", ":", "]", "]", ")", "+", "\"|\"", ")", "print", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"Prints the current state.\"\"\"\n\n        def tile_string(arg_1):\n            \"\"\"Concert value to string.\"\"\"\n            if arg_1 > 0:\n                return '% 5d' % (2 ** arg_1,)\n            return \"     \"\n\n        arg_2 = '-' * 25\n        print(arg_2)\n        for arg_3 in range(4):\n            print(\"|\" + \"|\".join([tile_string(arg_4) for arg_4 in arg_0._state[arg_3, :]]) + \"|\")\n            print(arg_2)", "path": "tensorforce/contrib/game_2048.py", "identifier": "Game2048.print_state", "docstring": "Prints the current state.", "docstring_tokens": ["Prints", "the", "current", "state", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 260478}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L42-L48", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Does the given complex contain the member?", "language": "python", "parameters": "(graph: BELGraph, complex_node: ComplexAbundance, member_node: BaseEntity)", "return_statement": "return any(  # TODO can't you look in the members of the complex object (if it's enumerated)\n        v == member_node\n        for _, v, data in graph.out_edges(complex_node, data=True)\n        if data[RELATION] == HAS_COMPONENT\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", ")", "->", "bool", ":", "return", "any", "(", "arg_7", "==", "arg_4", "for", "arg_6", ",", "arg_7", ",", "arg_8", "in", "arg_0", ".", "out_edges", "(", "arg_2", ",", "arg_8", "=", "True", ")", "if", "arg_8", "[", "RELATION", "]", "==", "HAS_COMPONENT", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5) -> bool:\n    \"\"\"Does the given complex contain the member?\"\"\"\n    return any(  # TODO can't you look in the members of the complex object (if it's enumerated)\n        arg_7 == arg_4\n        for arg_6, arg_7, arg_8 in arg_0.out_edges(arg_2, arg_8=True)\n        if arg_8[RELATION] == HAS_COMPONENT\n    )", "path": "src/pybel_tools/biogrammar/double_edges.py", "identifier": "complex_has_member", "docstring": "Does the given complex contain the member?", "docstring_tokens": ["Does", "the", "given", "complex", "contain", "the", "member?"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260479}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/rtlLevel/netlist.py#L286-L335", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Build Entity and Architecture instance out of netlist representation", "language": "python", "parameters": "(self, name, interfaces, targetPlatform)", "return_statement": "return [ent, arch]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "Entity", "(", "arg_1", ")", "arg_4", ".", "_name", "=", "arg_1", "+", "\"_inst\"", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "params", ".", "items", "(", ")", ":", "arg_4", ".", "generics", ".", "append", "(", "arg_7", ")", "if", "isinstance", "(", "arg_2", ",", "set", ")", ":", "arg_8", "=", "arg_2", "else", ":", "arg_8", "=", "set", "(", "arg_2", ")", "for", "arg_9", "in", "arg_2", ":", "arg_10", "=", "portItemfromSignal", "(", "arg_9", ",", "arg_4", ")", "arg_10", ".", "registerInternSig", "(", "arg_9", ")", "arg_4", ".", "ports", ".", "append", "(", "arg_10", ")", "arg_9", ".", "hidden", "=", "False", "removeUnconnectedSignals", "(", "arg_0", ")", "markVisibilityOfSignals", "(", "arg_0", ",", "arg_1", ",", "arg_0", ".", "signals", ",", "arg_8", ")", "for", "arg_12", "in", "arg_3", ".", "beforeHdlArchGeneration", ":", "arg_12", "(", "arg_0", ")", "arg_13", "=", "Architecture", "(", "arg_4", ")", "for", "arg_14", "in", "statements_to_HWProcesses", "(", "arg_0", ".", "statements", ")", ":", "arg_13", ".", "processes", ".", "append", "(", "arg_14", ")", "for", "arg_9", "in", "arg_0", ".", "signals", ":", "if", "arg_9", "not", "in", "arg_8", "and", "not", "arg_9", ".", "hidden", ":", "arg_13", ".", "variables", ".", "append", "(", "arg_9", ")", "for", "arg_15", "in", "arg_0", ".", "subUnits", ":", "arg_13", ".", "componentInstances", ".", "append", "(", "arg_15", ")", "for", "arg_16", "in", "distinctBy", "(", "arg_0", ".", "subUnits", ",", "lambda", "x", ":", "x", ".", "name", ")", ":", "arg_13", ".", "components", ".", "append", "(", "arg_16", ")", "arg_0", ".", "synthesised", "=", "True", "return", "[", "arg_4", ",", "arg_13", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Build Entity and Architecture instance out of netlist representation\n        \"\"\"\n        arg_4 = Entity(arg_1)\n        arg_4._name = arg_1 + \"_inst\"  # instance name\n\n        # create generics\n        for arg_6, arg_7 in arg_0.params.items():\n            arg_4.generics.append(arg_7)\n\n        # interface set for faster lookup\n        if isinstance(arg_2, set):\n            arg_8 = arg_2\n        else:\n            arg_8 = set(arg_2)\n\n        # create ports\n        for arg_9 in arg_2:\n            arg_10 = portItemfromSignal(arg_9, arg_4)\n            arg_10.registerInternSig(arg_9)\n            arg_4.ports.append(arg_10)\n            arg_9.hidden = False\n\n        removeUnconnectedSignals(arg_0)\n        markVisibilityOfSignals(arg_0, arg_1, arg_0.signals, arg_8)\n\n        for arg_12 in arg_3.beforeHdlArchGeneration:\n            arg_12(arg_0)\n\n        arg_13 = Architecture(arg_4)\n        for arg_14 in statements_to_HWProcesses(arg_0.statements):\n            arg_13.processes.append(arg_14)\n\n        # add signals, variables etc. in architecture\n        for arg_9 in arg_0.signals:\n            if arg_9 not in arg_8 and not arg_9.hidden:\n                arg_13.variables.append(arg_9)\n\n        # instantiate subUnits in architecture\n        for arg_15 in arg_0.subUnits:\n            arg_13.componentInstances.append(arg_15)\n\n        # add components in architecture\n        for arg_16 in distinctBy(arg_0.subUnits, lambda x: x.name):\n            arg_13.components.append(arg_16)\n\n        arg_0.synthesised = True\n\n        return [arg_4, arg_13]", "path": "hwt/synthesizer/rtlLevel/netlist.py", "identifier": "RtlNetlist.synthesize", "docstring": "Build Entity and Architecture instance out of netlist representation", "docstring_tokens": ["Build", "Entity", "and", "Architecture", "instance", "out", "of", "netlist", "representation"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 260480}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2968-L2973", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Get an mro for a type or classic class", "language": "python", "parameters": "(cls)", "return_statement": "return cls.__mro__", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "type", ")", ":", "class", "arg_0", "(", "arg_0", ",", "object", ")", ":", "pass", "return", "arg_0", ".", "__mro__", "[", "1", ":", "]", "return", "arg_0", ".", "__mro__"], "function": "def Func(arg_0):\n    \"\"\"Get an mro for a type or classic class\"\"\"\n    if not isinstance(arg_0, type):\n        class arg_0(arg_0, object): pass\n        return arg_0.__mro__[1:]\n    return arg_0.__mro__", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", "identifier": "_get_mro", "docstring": "Get an mro for a type or classic class", "docstring_tokens": ["Get", "an", "mro", "for", "a", "type", "or", "classic", "class"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260481}
{"url": "https://github.com/blockstack/zone-file-py/blob/c1078c8c3c28f0881bc9a3af53d4972c4a6862d0/blockstack_zones/parse_zone_file.py#L385-L394", "sha": "c1078c8c3c28f0881bc9a3af53d4972c4a6862d0", "docstring_summary": "Parse a zonefile into a dict", "language": "python", "parameters": "(text, ignore_invalid=False)", "return_statement": "return json_zone_file", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_0", "=", "remove_comments", "(", "arg_0", ")", "arg_0", "=", "flatten", "(", "arg_0", ")", "arg_0", "=", "remove_class", "(", "arg_0", ")", "arg_0", "=", "add_default_name", "(", "arg_0", ")", "arg_2", "=", "parse_lines", "(", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n    \"\"\"\n    Parse a zonefile into a dict\n    \"\"\"\n    arg_0 = remove_comments(arg_0)\n    arg_0 = flatten(arg_0)\n    arg_0 = remove_class(arg_0)\n    arg_0 = add_default_name(arg_0)\n    arg_2 = parse_lines(arg_0, arg_1=arg_1)\n    return arg_2", "path": "blockstack_zones/parse_zone_file.py", "identifier": "parse_zone_file", "docstring": "Parse a zonefile into a dict", "docstring_tokens": ["Parse", "a", "zonefile", "into", "a", "dict"], "nwo": "blockstack/zone-file-py", "score": 0.4104459992179242, "idx": 260482}
{"url": "https://github.com/cartoonist/pystream-protobuf/blob/40e70b932436887b748905e5e0a82839e4c559f0/stream/stream.py#L148-L163", "sha": "40e70b932436887b748905e5e0a82839e4c559f0", "docstring_summary": "Read a varint from file, parse it, and return the decoded integer.", "language": "python", "parameters": "(self)", "return_statement": "return varint", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_fd", ".", "read", "(", "1", ")", "if", "arg_1", "==", "b''", ":", "return", "0", "while", "(", "bytearray", "(", "arg_1", ")", "[", "-", "1", "]", "&", "0x80", ")", ">>", "7", "==", "1", ":", "arg_2", "=", "arg_0", ".", "_fd", ".", "read", "(", "1", ")", "if", "arg_2", "==", "b''", ":", "raise", "EOFError", "(", "'unexpected EOF.'", ")", "arg_1", "+=", "arg_2", "arg_3", ",", "arg_4", "=", "decodeVarint", "(", "arg_1", ",", "0", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Read a varint from file, parse it, and return the decoded integer.\n        \"\"\"\n        arg_1 = arg_0._fd.read(1)\n        if arg_1 == b'':\n            return 0\n\n        while (bytearray(arg_1)[-1] & 0x80) >> 7 == 1:  # while the MSB is 1\n            arg_2 = arg_0._fd.read(1)\n            if arg_2 == b'':\n                raise EOFError('unexpected EOF.')\n            arg_1 += arg_2\n\n        arg_3, arg_4 = decodeVarint(arg_1, 0)\n\n        return arg_3", "path": "stream/stream.py", "identifier": "Stream._read_varint", "docstring": "Read a varint from file, parse it, and return the decoded integer.", "docstring_tokens": ["Read", "a", "varint", "from", "file", "parse", "it", "and", "return", "the", "decoded", "integer", "."], "nwo": "cartoonist/pystream-protobuf", "score": 0.18892572326127263, "idx": 260483}
{"url": "https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L216-L228", "sha": "153ff37b79777f208e49bb9d3fb737ba52b99f98", "docstring_summary": "Send a Set metric with the specified unique value", "language": "python", "parameters": "(self, name, value, rate=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1", ")", ":", "if", "arg_0", ".", "_should_send_metric", "(", "arg_1", ",", "arg_3", ")", ":", "arg_2", "=", "str", "(", "arg_2", ")", "arg_0", ".", "_request", "(", "Set", "(", "arg_0", ".", "_create_metric_name_for_request", "(", "arg_1", ")", ",", "arg_2", ",", "arg_3", ")", ".", "to_request", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1):\n        # type: (str, str, float) -> None\n        \"\"\"Send a Set metric with the specified unique value\"\"\"\n\n        if arg_0._should_send_metric(arg_1, arg_3):\n            arg_2 = str(arg_2)\n            arg_0._request(\n                Set(\n                    arg_0._create_metric_name_for_request(arg_1),\n                    arg_2,\n                    arg_3\n                ).to_request()\n            )", "path": "statsdmetrics/client/__init__.py", "identifier": "AbstractClient.set", "docstring": "Send a Set metric with the specified unique value", "docstring_tokens": ["Send", "a", "Set", "metric", "with", "the", "specified", "unique", "value"], "nwo": "farzadghanei/statsd-metrics", "score": 0.18439204313697477, "idx": 260484}
{"url": "https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/cli.py#L271-L283", "sha": "b1b71e3dde0ba30e575089280658bd32890e3325", "docstring_summary": "Initialise the logging by adding an observer to the global log publisher.", "language": "python", "parameters": "(log_level)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "LogLevelFilterPredicate", "(", "LogLevel", ".", "levelWithName", "(", "arg_0", ")", ")", "arg_1", ".", "setLogLevelForNamespace", "(", "'twisted.web.client._HTTP11ClientFactory'", ",", "LogLevel", ".", "warn", ")", "arg_2", "=", "FilteringLogObserver", "(", "textFileLogObserver", "(", "sys", ".", "stdout", ")", ",", "[", "arg_1", "]", ")", "globalLogPublisher", ".", "addObserver", "(", "arg_2", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Initialise the logging by adding an observer to the global log publisher.\n\n    :param str log_level: The minimum log level to log messages for.\n    \"\"\"\n    arg_1 = LogLevelFilterPredicate(\n        LogLevel.levelWithName(arg_0))\n    arg_1.setLogLevelForNamespace(\n        'twisted.web.client._HTTP11ClientFactory', LogLevel.warn)\n    arg_2 = FilteringLogObserver(\n        textFileLogObserver(sys.stdout), [arg_1])\n    globalLogPublisher.addObserver(arg_2)", "path": "marathon_acme/cli.py", "identifier": "init_logging", "docstring": "Initialise the logging by adding an observer to the global log publisher.\n\n    :param str log_level: The minimum log level to log messages for.", "docstring_tokens": ["Initialise", "the", "logging", "by", "adding", "an", "observer", "to", "the", "global", "log", "publisher", "."], "nwo": "praekeltfoundation/marathon-acme", "score": 0.2663827826706725, "idx": 260485}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L223-L233", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "Retrieve the last analog data value received for the specified pin.", "language": "python", "parameters": "(self, pin)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "data_lock", ":", "arg_2", "=", "arg_0", ".", "_command_handler", ".", "analog_response_table", "[", "arg_1", "]", "[", "arg_0", ".", "_command_handler", ".", "RESPONSE_TABLE_PIN_DATA_VALUE", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retrieve the last analog data value received for the specified pin.\n\n        :param pin: Selected pin\n\n        :return: The last value entered into the analog response table.\n        \"\"\"\n        with arg_0.data_lock:\n            arg_2 = arg_0._command_handler.analog_response_table[arg_1][arg_0._command_handler.RESPONSE_TABLE_PIN_DATA_VALUE]\n        return arg_2", "path": "PyMata/pymata.py", "identifier": "PyMata.analog_read", "docstring": "Retrieve the last analog data value received for the specified pin.\n\n        :param pin: Selected pin\n\n        :return: The last value entered into the analog response table.", "docstring_tokens": ["Retrieve", "the", "last", "analog", "data", "value", "received", "for", "the", "specified", "pin", "."], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 260486}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2155-L2177", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Obtain keying material for application use.", "language": "python", "parameters": "(self, label, olen, context=None)", "return_statement": "return _ffi.buffer(outp, olen)[:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "_no_zero_allocator", "(", "\"unsigned char[]\"", ",", "arg_2", ")", "arg_5", "=", "_ffi", ".", "NULL", "arg_6", "=", "0", "arg_7", "=", "0", "if", "arg_3", "is", "not", "None", ":", "arg_5", "=", "arg_3", "arg_6", "=", "len", "(", "arg_3", ")", "arg_7", "=", "1", "arg_8", "=", "_lib", ".", "SSL_Func", "(", "arg_0", ".", "_ssl", ",", "arg_4", ",", "arg_2", ",", "arg_1", ",", "len", "(", "arg_1", ")", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", "_openssl_assert", "(", "arg_8", "==", "1", ")", "return", "_ffi", ".", "buffer", "(", "arg_4", ",", "arg_2", ")", "[", ":", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"\n        Obtain keying material for application use.\n\n        :param: label - a disambiguating label string as described in RFC 5705\n        :param: olen - the length of the exported key material in bytes\n        :param: context - a per-association context value\n        :return: the exported key material bytes or None\n        \"\"\"\n        arg_4 = _no_zero_allocator(\"unsigned char[]\", arg_2)\n        arg_5 = _ffi.NULL\n        arg_6 = 0\n        arg_7 = 0\n        if arg_3 is not None:\n            arg_5 = arg_3\n            arg_6 = len(arg_3)\n            arg_7 = 1\n        arg_8 = _lib.SSL_Func(arg_0._ssl, arg_4, arg_2,\n                                                  arg_1, len(arg_1),\n                                                  arg_5, arg_6,\n                                                  arg_7)\n        _openssl_assert(arg_8 == 1)\n        return _ffi.buffer(arg_4, arg_2)[:]", "path": "src/OpenSSL/SSL.py", "identifier": "Connection.export_keying_material", "docstring": "Obtain keying material for application use.\n\n        :param: label - a disambiguating label string as described in RFC 5705\n        :param: olen - the length of the exported key material in bytes\n        :param: context - a per-association context value\n        :return: the exported key material bytes or None", "docstring_tokens": ["Obtain", "keying", "material", "for", "application", "use", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 260487}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/match_fils.py#L33-L44", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Script to find the header size of a filterbank file", "language": "python", "parameters": "(filename)", "return_statement": "return headersize", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "open", "(", "arg_0", ",", "'rb'", ")", "arg_1", ".", "seek", "(", "0", ")", "arg_2", "=", "arg_1", ".", "read", "(", "1000", ")", "arg_3", "=", "arg_2", ".", "find", "(", "'HEADER_END'", ")", "+", "len", "(", "'HEADER_END'", ")", "return", "arg_3"], "function": "def Func(arg_0):\n    ''' Script to find the header size of a filterbank file'''\n\n    # open datafile\n    arg_1=open(arg_0,'rb')\n    # go to the start of the file\n    arg_1.seek(0)\n    #read some region larger than the header.\n    arg_2 = arg_1.read(1000)\n    arg_3 = arg_2.find('HEADER_END')+len('HEADER_END')\n\n    return arg_3", "path": "blimpy/match_fils.py", "identifier": "find_header_size", "docstring": "Script to find the header size of a filterbank file", "docstring_tokens": ["Script", "to", "find", "the", "header", "size", "of", "a", "filterbank", "file"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 260488}
{"url": "https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/transform.py#L1101-L1124", "sha": "eae89bde74567136ec3f723c3e6b369916d9b837", "docstring_summary": "Delay one or more audio channels such that they start at the given\n        positions.", "language": "python", "parameters": "(self, positions)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "list", ")", ":", "raise", "ValueError", "(", "\"positions must be a a list of numbers\"", ")", "if", "not", "all", "(", "(", "is_number", "(", "arg_2", ")", "and", "arg_2", ">=", "0", ")", "for", "arg_2", "in", "arg_1", ")", ":", "raise", "ValueError", "(", "\"positions must be positive nubmers\"", ")", "arg_3", "=", "[", "'Func'", "]", "arg_3", ".", "extend", "(", "[", "'{:f}'", ".", "format", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", "]", ")", "arg_0", ".", "effects", ".", "extend", "(", "arg_3", ")", "arg_0", ".", "effects_log", ".", "append", "(", "'Func'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n        '''Delay one or more audio channels such that they start at the given\n        positions.\n\n        Parameters\n        ----------\n        positions: list of floats\n            List of times (in seconds) to Func each audio channel.\n            If fewer positions are given than the number of channels, the\n            remaining channels will be unaffected.\n\n        '''\n        if not isinstance(arg_1, list):\n            raise ValueError(\"positions must be a a list of numbers\")\n\n        if not all((is_number(arg_2) and arg_2 >= 0) for arg_2 in arg_1):\n            raise ValueError(\"positions must be positive nubmers\")\n\n        arg_3 = ['Func']\n        arg_3.extend(['{:f}'.format(arg_2) for arg_2 in arg_1])\n\n        arg_0.effects.extend(arg_3)\n        arg_0.effects_log.append('Func')\n        return arg_0", "path": "sox/transform.py", "identifier": "Transformer.delay", "docstring": "Delay one or more audio channels such that they start at the given\n        positions.\n\n        Parameters\n        ----------\n        positions: list of floats\n            List of times (in seconds) to delay each audio channel.\n            If fewer positions are given than the number of channels, the\n            remaining channels will be unaffected.", "docstring_tokens": ["Delay", "one", "or", "more", "audio", "channels", "such", "that", "they", "start", "at", "the", "given", "positions", "."], "nwo": "rabitt/pysox", "score": 0.7121540461632563, "idx": 260489}
{"url": "https://github.com/rollbar/pyrollbar/blob/33ef2e723a33d09dd6302f978f4a3908be95b9d2/rollbar/__init__.py#L1328-L1341", "sha": "33ef2e723a33d09dd6302f978f4a3908be95b9d2", "docstring_summary": "Returns the full payload as a string.", "language": "python", "parameters": "(data)", "return_statement": "return payload", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "iteritems", "(", "arg_0", ")", ":", "arg_0", "[", "arg_1", "]", "=", "_transform", "(", "arg_2", ",", "key", "=", "(", "arg_1", ",", ")", ")", "arg_3", "=", "{", "'access_token'", ":", "SETTINGS", "[", "'access_token'", "]", ",", "'data'", ":", "arg_0", "}", "return", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns the full payload as a string.\n    \"\"\"\n\n    for arg_1, arg_2 in iteritems(arg_0):\n        arg_0[arg_1] = _transform(arg_2, key=(arg_1,))\n\n    arg_3 = {\n        'access_token': SETTINGS['access_token'],\n        'data': arg_0\n    }\n\n    return arg_3", "path": "rollbar/__init__.py", "identifier": "_build_payload", "docstring": "Returns the full payload as a string.", "docstring_tokens": ["Returns", "the", "full", "payload", "as", "a", "string", "."], "nwo": "rollbar/pyrollbar", "score": 0.8439078507967885, "idx": 260490}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/periodogram.py#L259-L321", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Return Daniell's periodogram.", "language": "python", "parameters": "(data, P, NFFT=None, detrend='mean', sampling=1.,\n                       scale_by_freq=True, window='hamming')", "return_statement": "return newpsd, freq", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'mean'", ",", "arg_4", "=", "1.", ",", "arg_5", "=", "True", ",", "arg_6", "=", "'hamming'", ")", ":", "arg_7", "=", "speriodogram", "(", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "if", "len", "(", "arg_7", ")", "%", "2", "==", "1", ":", "arg_8", "=", "'real'", "else", ":", "arg_8", "=", "'complex'", "arg_9", "=", "len", "(", "arg_7", ")", "arg_10", "=", "2", "*", "arg_1", "+", "1", "if", "arg_8", "==", "'real'", ":", "arg_11", "=", "np", ".", "ceil", "(", "arg_7", ".", "size", "/", "float", "(", "arg_10", ")", ")", "if", "arg_11", "%", "2", "==", "0", ":", "arg_11", "=", "arg_7", ".", "size", "/", "arg_10", "else", ":", "arg_11", "=", "np", ".", "ceil", "(", "arg_7", ".", "size", "/", "float", "(", "arg_10", ")", ")", "if", "arg_11", "%", "2", "==", "1", ":", "arg_11", "=", "arg_7", ".", "size", "/", "arg_10", "arg_12", "=", "np", ".", "zeros", "(", "int", "(", "arg_11", ")", ")", "for", "arg_13", "in", "range", "(", "0", ",", "arg_12", ".", "size", ")", ":", "arg_14", "=", "0", "for", "arg_15", "in", "range", "(", "arg_13", "*", "arg_10", "-", "arg_1", ",", "arg_13", "*", "arg_10", "+", "arg_1", "+", "1", ")", ":", "if", "arg_15", ">", "0", "and", "arg_15", "<", "arg_9", ":", "arg_14", "+=", "1", "arg_12", "[", "arg_13", "]", "+=", "arg_7", "[", "arg_15", "]", "arg_12", "[", "arg_13", "]", "/=", "float", "(", "arg_14", ")", "if", "arg_8", "==", "'complex'", ":", "arg_16", "=", "np", ".", "linspace", "(", "0", ",", "arg_4", ",", "len", "(", "arg_12", ")", ")", "else", ":", "arg_17", "=", "1.", "/", "arg_4", "arg_16", "=", "np", ".", "linspace", "(", "0", ",", "arg_4", "/", "2.", ",", "len", "(", "arg_12", ")", ")", "return", "arg_12", ",", "arg_16"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3='mean', arg_4=1.,\n                       arg_5=True, arg_6='hamming'):\n    r\"\"\"Return Daniell's periodogram.\n\n    To reduce fast fluctuations of the spectrum one idea proposed by daniell\n    is to average each value with points in its neighboorhood. It's like\n    a low filter.\n\n    .. math:: \\hat{P}_D[f_i]= \\frac{1}{2P+1} \\sum_{n=i-P}^{i+P} \\tilde{P}_{xx}[f_n]\n\n    where P is the number of points to average.\n\n    Daniell's periodogram is the convolution of the spectrum with a low filter:\n\n    .. math:: \\hat{P}_D(f)=   \\hat{P}_{xx}(f)*H(f)\n\n    Example::\n\n        >>> Func(data, 8)\n\n    if N/P is not integer, the final values of the original PSD are not used.\n\n    using Func(data, 0) should give the original PSD.\n\n    \"\"\"\n    arg_7 = speriodogram(arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,\n                   arg_5=arg_5, arg_6=arg_6)\n\n    if len(arg_7) % 2 == 1:\n        arg_8 = 'real'\n    else:\n        arg_8 = 'complex'\n\n    arg_9 = len(arg_7)\n    arg_10 = 2 * arg_1 + 1\n    if arg_8 == 'real': #must get odd value\n        arg_11 = np.ceil(arg_7.size/float(arg_10))\n        if arg_11 % 2 == 0:\n            arg_11 = arg_7.size/arg_10\n    else:\n        arg_11 = np.ceil(arg_7.size/float(arg_10))\n        if arg_11 % 2 == 1:\n            arg_11 = arg_7.size/arg_10\n\n    arg_12 = np.zeros(int(arg_11)) # keep integer division\n    for arg_13 in range(0, arg_12.size):\n        arg_14 = 0 #needed to know the number of valid averaged values\n        for arg_15 in range(arg_13*arg_10-arg_1, arg_13*arg_10+arg_1+1): #+1 to have P values on each sides\n            if arg_15 > 0 and arg_15<arg_9: #needed to start the average\n                arg_14 += 1\n                arg_12[arg_13] += arg_7[arg_15]\n        arg_12[arg_13] /= float(arg_14)\n\n    #todo: check this\n    if arg_8 == 'complex':\n        arg_16 = np.linspace(0, arg_4, len(arg_12))\n    else:\n        arg_17 = 1. / arg_4\n        arg_16 = np.linspace(0,arg_4/2., len(arg_12))\n    #psd.refreq(2*psd.size()/A.freq());\n    #psd.retime(-1./psd.freq()+1./A.size());\n\n    return arg_12, arg_16", "path": "src/spectrum/periodogram.py", "identifier": "DaniellPeriodogram", "docstring": "r\"\"\"Return Daniell's periodogram.\n\n    To reduce fast fluctuations of the spectrum one idea proposed by daniell\n    is to average each value with points in its neighboorhood. It's like\n    a low filter.\n\n    .. math:: \\hat{P}_D[f_i]= \\frac{1}{2P+1} \\sum_{n=i-P}^{i+P} \\tilde{P}_{xx}[f_n]\n\n    where P is the number of points to average.\n\n    Daniell's periodogram is the convolution of the spectrum with a low filter:\n\n    .. math:: \\hat{P}_D(f)=   \\hat{P}_{xx}(f)*H(f)\n\n    Example::\n\n        >>> DaniellPeriodogram(data, 8)\n\n    if N/P is not integer, the final values of the original PSD are not used.\n\n    using DaniellPeriodogram(data, 0) should give the original PSD.", "docstring_tokens": ["r", "Return", "Daniell", "s", "periodogram", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 260491}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L1286-L1314", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Geodesic acceleration correction to the LM step.", "language": "python", "parameters": "(self, damped_JTJ, delta0)", "return_statement": "return corr", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "update_function", "(", "arg_0", ".", "param_vals", ")", "arg_4", "=", "arg_0", ".", "calc_residuals", "(", ")", ".", "copy", "(", ")", "arg_3", "=", "arg_0", ".", "update_function", "(", "arg_0", ".", "param_vals", "+", "arg_2", ")", "arg_5", "=", "arg_0", ".", "calc_residuals", "(", ")", ".", "copy", "(", ")", "arg_3", "=", "arg_0", ".", "update_function", "(", "arg_0", ".", "param_vals", "-", "arg_2", ")", "arg_6", "=", "arg_0", ".", "calc_residuals", "(", ")", ".", "copy", "(", ")", "arg_7", "=", "(", "arg_6", "+", "arg_5", "-", "2", "*", "arg_4", ")", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "np", ".", "linalg", ".", "lstsq", "(", "arg_1", ",", "np", ".", "dot", "(", "arg_0", ".", "J", ",", "arg_7", ")", ",", "rcond", "=", "arg_0", ".", "min_eigval", ")", "arg_8", "*=", "-", "0.5", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Geodesic acceleration correction to the LM step.\n\n        Parameters\n        ----------\n            damped_JTJ : numpy.ndarray\n                The damped JTJ used to calculate the initial step.\n            delta0 : numpy.ndarray\n                The initial LM step.\n\n        Returns\n        -------\n            corr : numpy.ndarray\n                The correction to the original LM step.\n        \"\"\"\n        #Get the derivative:\n        arg_3 = arg_0.update_function(arg_0.param_vals)\n        arg_4 = arg_0.calc_residuals().copy()\n        arg_3 = arg_0.update_function(arg_0.param_vals + arg_2)\n        arg_5 = arg_0.calc_residuals().copy()\n        arg_3 = arg_0.update_function(arg_0.param_vals - arg_2)\n        arg_6 = arg_0.calc_residuals().copy()\n        arg_7 = (arg_6 + arg_5 - 2*arg_4)\n\n        arg_8, arg_9, arg_10, arg_11 = np.linalg.lstsq(arg_1, np.dot(arg_0.J, arg_7),\n                rcond=arg_0.min_eigval)\n        arg_8 *= -0.5\n        return arg_8", "path": "peri/opt/optimize.py", "identifier": "LMEngine.calc_accel_correction", "docstring": "Geodesic acceleration correction to the LM step.\n\n        Parameters\n        ----------\n            damped_JTJ : numpy.ndarray\n                The damped JTJ used to calculate the initial step.\n            delta0 : numpy.ndarray\n                The initial LM step.\n\n        Returns\n        -------\n            corr : numpy.ndarray\n                The correction to the original LM step.", "docstring_tokens": ["Geodesic", "acceleration", "correction", "to", "the", "LM", "step", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260492}
{"url": "https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L410-L454", "sha": "3eeb0432f8cf856912436e4f3e7aba99d3c916be", "docstring_summary": "export density to file using the given format.", "language": "python", "parameters": "(self, filename, file_format=None, type=None, typequote='\"')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "'\"'", ")", ":", "arg_5", "=", "arg_0", ".", "_get_Funcer", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_5", "(", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4='\"'):\n        \"\"\"Func density to file using the given format.\n\n        The format can also be deduced from the suffix of the filename\n        though the *format* keyword takes precedence.\n\n        The default format for Func() is 'dx'.  Use 'dx' for\n        visualization.\n\n        Implemented formats:\n\n        dx\n            :mod:`OpenDX`\n        pickle\n            pickle (use :meth:`Grid.load` to restore); :meth:`Grid.save`\n            is simpler than ``Func(format='python')``.\n\n        Parameters\n        ----------\n\n        filename : str\n            name of the output file\n\n        file_format : {'dx', 'pickle', None} (optional)\n            output file format, the default is \"dx\"\n\n        type : str (optional)\n            for DX, set the output DX array type, e.g., \"double\" or \"float\".\n            By default (``None``), the DX type is determined from the numpy\n            dtype of the array of the grid (and this will typically result in\n            \"double\").\n\n            .. versionadded:: 0.4.0\n\n        typequote : str (optional)\n            For DX, set the character used to quote the type string;\n            by default this is a double-quote character, '\"'.\n            Custom parsers like the one from NAMD-GridForces (backend for MDFF)\n            expect no quotes, and typequote='' may be used to appease them.\n\n            .. versionadded:: 0.5.0\n\n        \"\"\"\n        arg_5 = arg_0._get_Funcer(arg_1, arg_2=arg_2)\n        arg_5(arg_1, arg_3=arg_3, arg_4=arg_4)", "path": "gridData/core.py", "identifier": "Grid.export", "docstring": "export density to file using the given format.\n\n        The format can also be deduced from the suffix of the filename\n        though the *format* keyword takes precedence.\n\n        The default format for export() is 'dx'.  Use 'dx' for\n        visualization.\n\n        Implemented formats:\n\n        dx\n            :mod:`OpenDX`\n        pickle\n            pickle (use :meth:`Grid.load` to restore); :meth:`Grid.save`\n            is simpler than ``export(format='python')``.\n\n        Parameters\n        ----------\n\n        filename : str\n            name of the output file\n\n        file_format : {'dx', 'pickle', None} (optional)\n            output file format, the default is \"dx\"\n\n        type : str (optional)\n            for DX, set the output DX array type, e.g., \"double\" or \"float\".\n            By default (``None``), the DX type is determined from the numpy\n            dtype of the array of the grid (and this will typically result in\n            \"double\").\n\n            .. versionadded:: 0.4.0\n\n        typequote : str (optional)\n            For DX, set the character used to quote the type string;\n            by default this is a double-quote character, '\"'.\n            Custom parsers like the one from NAMD-GridForces (backend for MDFF)\n            expect no quotes, and typequote='' may be used to appease them.\n\n            .. versionadded:: 0.5.0", "docstring_tokens": ["export", "density", "to", "file", "using", "the", "given", "format", "."], "nwo": "MDAnalysis/GridDataFormats", "score": 0.28803194907926843, "idx": 260493}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L1275-L1295", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Output the positions of an image to a positions.dat file.", "language": "python", "parameters": "(positions, positions_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "f", ":", "for", "arg_2", "in", "arg_0", ":", "f", ".", "write", "(", "\"%s\\n\"", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Output the positions of an image to a positions.dat file.\n\n    Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \\\n    multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \\\n    one another are resampled during the non-linear search.\n\n    Positions are stored in a .dat file, where each line of the file gives a list of list of (y,x) positions which \\\n    correspond to the same region of the source-plane. Thus, multiple source-plane regions can be input over multiple \\\n    lines of the same positions file.\n\n    Parameters\n    ----------\n    positions : [[[]]]\n        The lists of positions (e.g. [[[1.0, 1.0], [2.0, 2.0]], [[3.0, 3.0], [4.0, 4.0]]])\n    positions_path : str\n        The path to the positions .dat file containing the positions (e.g. '/path/to/positions.dat')\n    \"\"\"\n    with open(arg_1, 'w') as f:\n        for arg_2 in arg_0:\n            f.write(\"%s\\n\" % arg_2)", "path": "autolens/data/ccd.py", "identifier": "output_positions", "docstring": "Output the positions of an image to a positions.dat file.\n\n    Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \\\n    multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \\\n    one another are resampled during the non-linear search.\n\n    Positions are stored in a .dat file, where each line of the file gives a list of list of (y,x) positions which \\\n    correspond to the same region of the source-plane. Thus, multiple source-plane regions can be input over multiple \\\n    lines of the same positions file.\n\n    Parameters\n    ----------\n    positions : [[[]]]\n        The lists of positions (e.g. [[[1.0, 1.0], [2.0, 2.0]], [[3.0, 3.0], [4.0, 4.0]]])\n    positions_path : str\n        The path to the positions .dat file containing the positions (e.g. '/path/to/positions.dat')", "docstring_tokens": ["Output", "the", "positions", "of", "an", "image", "to", "a", "positions", ".", "dat", "file", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 260494}
{"url": "https://github.com/nilp0inter/trelloapi/blob/88f4135832548ea71598d50a73943890e1cf9e20/trelloapi/make_endpoints.py#L113-L140", "sha": "88f4135832548ea71598d50a73943890e1cf9e20", "docstring_summary": "Prints the complete YAML.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "requests", ".", "get", "(", "TRELLO_API_DOC", ")", ".", "content", "arg_1", "=", "html", ".", "fromstring", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "xpath", "(", "'//a[contains(@class, \"reference internal\")]/@href'", ")", "arg_3", "=", "[", "requests", ".", "get", "(", "TRELLO_API_DOC", "+", "u", ")", "for", "u", "in", "arg_2", "if", "u", ".", "endswith", "(", "'index.html'", ")", "]", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "arg_1", "=", "html", ".", "fromstring", "(", "arg_5", ".", "content", ")", "arg_6", "=", "arg_1", ".", "xpath", "(", "'//div[@class=\"section\"]/h2/..'", ")", "for", "arg_7", "in", "arg_6", ":", "arg_8", "=", "etree", ".", "tostring", "(", "arg_7", ")", ".", "decode", "(", "'utf-8'", ")", "arg_9", "=", "html2text", "(", "arg_8", ")", ".", "splitlines", "(", ")", "arg_10", "=", "EP_DESC_REGEX", ".", "match", "(", "arg_9", "[", "0", "]", ")", "if", "not", "arg_10", ":", "continue", "arg_11", ",", "arg_12", "=", "arg_10", ".", "groups", "(", ")", "arg_9", "[", "0", "]", "=", "' '", ".", "join", "(", "[", "arg_11", ",", "arg_12", "]", ")", "arg_13", "=", "b64encode", "(", "gzip", ".", "compress", "(", "'\\n'", ".", "join", "(", "arg_9", ")", ".", "encode", "(", "'utf-8'", ")", ")", ")", "arg_4", ".", "append", "(", "(", "arg_11", ",", "arg_12", ",", "arg_13", ")", ")", "print", "(", "yaml", ".", "dump", "(", "create_tree", "(", "arg_4", ")", ")", ")"], "function": "def Func():\n    \"\"\"\n    Prints the complete YAML.\n\n    \"\"\"\n    arg_0 = requests.get(TRELLO_API_DOC).content\n    arg_1 = html.fromstring(arg_0)\n\n    arg_2 = arg_1.xpath('//a[contains(@class, \"reference internal\")]/@href')\n    arg_3 = [requests.get(TRELLO_API_DOC + u)\n             for u in arg_2 if u.endswith('index.html')]\n\n    arg_4 = []\n    for arg_5 in arg_3:\n        arg_1 = html.fromstring(arg_5.content)\n        arg_6 = arg_1.xpath('//div[@class=\"section\"]/h2/..')\n        for arg_7 in arg_6:\n            arg_8 = etree.tostring(arg_7).decode('utf-8')\n            arg_9 = html2text(arg_8).splitlines()\n            arg_10 = EP_DESC_REGEX.match(arg_9[0])\n            if not arg_10:\n                continue\n            arg_11, arg_12 = arg_10.groups()\n            arg_9[0] = ' '.join([arg_11, arg_12])\n            arg_13 = b64encode(gzip.compress('\\n'.join(arg_9).encode('utf-8')))\n            arg_4.append((arg_11, arg_12, arg_13))\n\n    print(yaml.dump(create_tree(arg_4)))", "path": "trelloapi/make_endpoints.py", "identifier": "main", "docstring": "Prints the complete YAML.", "docstring_tokens": ["Prints", "the", "complete", "YAML", "."], "nwo": "nilp0inter/trelloapi", "score": 0.0, "idx": 260495}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L141-L157", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Add a node to run on success.", "language": "python", "parameters": "(self, parent, child=None, **kwargs)", "return_statement": "return self._assoc_or_create('success', parent, child, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "return", "arg_0", ".", "_assoc_or_create", "(", "'success'", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n        \"\"\"Add a node to run on success.\n\n        =====API DOCS=====\n        Add a node to run on success.\n\n        :param parent: Primary key of parent node to associate success node to.\n        :type parent: int\n        :param child: Primary key of child node to be associated.\n        :type child: int\n        :param `**kwargs`: Fields used to create child node if ``child`` is not provided.\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====\n        \"\"\"\n        return arg_0._assoc_or_create('success', arg_1, arg_2, **arg_3)", "path": "tower_cli/resources/node.py", "identifier": "Resource.associate_success_node", "docstring": "Add a node to run on success.\n\n        =====API DOCS=====\n        Add a node to run on success.\n\n        :param parent: Primary key of parent node to associate success node to.\n        :type parent: int\n        :param child: Primary key of child node to be associated.\n        :type child: int\n        :param `**kwargs`: Fields used to create child node if ``child`` is not provided.\n        :returns: Dictionary of only one key \"changed\", which indicates whether the association succeeded.\n        :rtype: dict\n\n        =====API DOCS=====", "docstring_tokens": ["Add", "a", "node", "to", "run", "on", "success", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 260496}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/adapter.py#L59-L69", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Called when the power state changes.", "language": "python", "parameters": "(self, state)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "'Adapter state change: {0}'", ".", "format", "(", "arg_1", ")", ")", "if", "arg_1", "==", "5", ":", "arg_0", ".", "_powered_off", ".", "clear", "(", ")", "arg_0", ".", "_powered_on", ".", "set", "(", ")", "elif", "arg_1", "==", "4", ":", "arg_0", ".", "_powered_on", ".", "clear", "(", ")", "arg_0", ".", "_powered_off", ".", "set", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Called when the power state changes.\"\"\"\n        logger.debug('Adapter state change: {0}'.format(arg_1))\n        # Handle when powered on.\n        if arg_1 == 5:\n            arg_0._powered_off.clear()\n            arg_0._powered_on.set()\n        # Handle when powered off.\n        elif arg_1 == 4:\n            arg_0._powered_on.clear()\n            arg_0._powered_off.set()", "path": "Adafruit_BluefruitLE/corebluetooth/adapter.py", "identifier": "CoreBluetoothAdapter._state_changed", "docstring": "Called when the power state changes.", "docstring_tokens": ["Called", "when", "the", "power", "state", "changes", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 260497}
{"url": "https://github.com/avelino/bottle-auth/blob/db07e526864aeac05ee68444b47e5db29540ce18/bottle_auth/core/auth.py#L246-L262", "sha": "db07e526864aeac05ee68444b47e5db29540ce18", "docstring_summary": "Returns the authentication URL for this service.", "language": "python", "parameters": "(\n        self, callback_uri=None, ax_attrs=[\"name\", \"email\", \"language\",\n                                           \"username\"])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "[", "\"name\"", ",", "\"email\"", ",", "\"language\"", ",", "\"username\"", "]", ")", ":", "arg_1", "=", "arg_1", "or", "arg_0", ".", "request", ".", "uri", "arg_3", "=", "arg_0", ".", "_openid_args", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "redirect", "(", "arg_0", ".", "_OPENID_ENDPOINT", "+", "\"?\"", "+", "urllib", ".", "urlencode", "(", "arg_3", ")", ")"], "function": "def Func(\n        arg_0, arg_1=None, arg_2=[\"name\", \"email\", \"language\",\n                                           \"username\"]):\n\n        \"\"\"Returns the authentication URL for this service.\n\n        After authentication, the service will redirect back to the given\n        callback URI.\n\n        We request the given attributes for the authenticated user by\n        default (name, email, language, and username). If you don't need\n        all those attributes for your app, you can request fewer with\n        the ax_attrs keyword argument.\n        \"\"\"\n        arg_1 = arg_1 or arg_0.request.uri\n        arg_3 = arg_0._openid_args(arg_1, arg_2=arg_2)\n        arg_0.redirect(arg_0._OPENID_ENDPOINT + \"?\" + urllib.urlencode(arg_3))", "path": "bottle_auth/core/auth.py", "identifier": "OpenIdMixin.authenticate_redirect", "docstring": "Returns the authentication URL for this service.\n\n        After authentication, the service will redirect back to the given\n        callback URI.\n\n        We request the given attributes for the authenticated user by\n        default (name, email, language, and username). If you don't need\n        all those attributes for your app, you can request fewer with\n        the ax_attrs keyword argument.", "docstring_tokens": ["Returns", "the", "authentication", "URL", "for", "this", "service", "."], "nwo": "avelino/bottle-auth", "score": 0.19267710300573365, "idx": 260498}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pip/utils/__init__.py#L102-L126", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Searches the PATH for the given command and returns its path", "language": "python", "parameters": "(cmd, paths=None, pathext=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "os", ".", "environ", ".", "get", "(", "'PATH'", ",", "''", ")", ".", "split", "(", "os", ".", "pathsep", ")", "if", "isinstance", "(", "arg_1", ",", "six", ".", "string_types", ")", ":", "arg_1", "=", "[", "arg_1", "]", "if", "arg_2", "is", "None", ":", "arg_2", "=", "get_pathext", "(", ")", "arg_2", "=", "[", "arg_5", "for", "arg_5", "in", "arg_2", ".", "lower", "(", ")", ".", "split", "(", "os", ".", "pathsep", ")", "if", "len", "(", "arg_5", ")", "]", "if", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "[", "1", "]", ".", "lower", "(", ")", "in", "arg_2", ":", "arg_2", "=", "[", "''", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_0", ")", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "arg_4", "+", "arg_5", "if", "os", ".", "path", ".", "isfile", "(", "arg_6", ")", ":", "return", "arg_6", "if", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "return", "arg_4", "raise", "BadCommand", "(", "'Cannot find command %r'", "%", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"Searches the PATH for the given command and returns its path\"\"\"\n    if arg_1 is None:\n        arg_1 = os.environ.get('PATH', '').split(os.pathsep)\n    if isinstance(arg_1, six.string_types):\n        arg_1 = [arg_1]\n    # check if there are funny path extensions for executables, e.g. Windows\n    if arg_2 is None:\n        arg_2 = get_pathext()\n    arg_2 = [arg_5 for arg_5 in arg_2.lower().split(os.pathsep) if len(arg_5)]\n    # don't use extensions if the command ends with one of them\n    if os.path.splitext(arg_0)[1].lower() in arg_2:\n        arg_2 = ['']\n    # check if we find the command on PATH\n    for arg_3 in arg_1:\n        # try without extension first\n        arg_4 = os.path.join(arg_3, arg_0)\n        for arg_5 in arg_2:\n            # then including the extension\n            arg_6 = arg_4 + arg_5\n            if os.path.isfile(arg_6):\n                return arg_6\n        if os.path.isfile(arg_4):\n            return arg_4\n    raise BadCommand('Cannot find command %r' % arg_0)", "path": "virtualEnvironment/lib/python2.7/site-packages/pip/utils/__init__.py", "identifier": "find_command", "docstring": "Searches the PATH for the given command and returns its path", "docstring_tokens": ["Searches", "the", "PATH", "for", "the", "given", "command", "and", "returns", "its", "path"], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 260499}
{"url": "https://github.com/philipsoutham/py-mysql2pgsql/blob/66dc2a3a3119263b3fe77300fb636346509787ef/mysql2pgsql/lib/postgres_file_writer.py#L93-L101", "sha": "66dc2a3a3119263b3fe77300fb636346509787ef", "docstring_summary": "Write DDL of `table` constraints to the output file", "language": "python", "parameters": "(self, table)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "f", ".", "write", "(", "'\\n'", ".", "join", "(", "super", "(", "PostgresFileWriter", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Write DDL of `table` constraints to the output file\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None\n        \"\"\"\n        arg_0.f.write('\\n'.join(super(PostgresFileWriter, arg_0).Func(arg_1)))", "path": "mysql2pgsql/lib/postgres_file_writer.py", "identifier": "PostgresFileWriter.write_constraints", "docstring": "Write DDL of `table` constraints to the output file\n\n        :Parameters:\n          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.\n\n        Returns None", "docstring_tokens": ["Write", "DDL", "of", "table", "constraints", "to", "the", "output", "file"], "nwo": "philipsoutham/py-mysql2pgsql", "score": 0.632634572866938, "idx": 260500}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_lcsseq.py#L107-L144", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "r\"\"\"Return the longest common subsequence similarity of two strings.", "language": "python", "parameters": "(self, src, tar)", "return_statement": "return len(self.lcsseq(src, tar)) / max(len(src), len(tar))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "==", "arg_2", ":", "return", "1.0", "elif", "not", "arg_1", "or", "not", "arg_2", ":", "return", "0.0", "return", "len", "(", "arg_0", ".", "lcsseq", "(", "arg_1", ",", "arg_2", ")", ")", "/", "max", "(", "len", "(", "arg_1", ")", ",", "len", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        r\"\"\"Return the longest common subsequence Funcilarity of two strings.\n\n        Longest common subsequence Funcilarity (:math:`Func_{LCSseq}`).\n\n        This employs the LCSseq function to derive a Funcilarity metric:\n        :math:`Func_{LCSseq}(s,t) = \\frac{|LCSseq(s,t)|}{max(|s|, |t|)}`\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n\n        Returns\n        -------\n        float\n            LCSseq Funcilarity\n\n        Examples\n        --------\n        >>> sseq = LCSseq()\n        >>> sseq.Func('cat', 'hat')\n        0.6666666666666666\n        >>> sseq.Func('Niall', 'Neil')\n        0.6\n        >>> sseq.Func('aluminum', 'Catalan')\n        0.375\n        >>> sseq.Func('ATCG', 'TAGC')\n        0.5\n\n        \"\"\"\n        if arg_1 == arg_2:\n            return 1.0\n        elif not arg_1 or not arg_2:\n            return 0.0\n        return len(arg_0.lcsseq(arg_1, arg_2)) / max(len(arg_1), len(arg_2))", "path": "abydos/distance/_lcsseq.py", "identifier": "LCSseq.sim", "docstring": "r\"\"\"Return the longest common subsequence similarity of two strings.\n\n        Longest common subsequence similarity (:math:`sim_{LCSseq}`).\n\n        This employs the LCSseq function to derive a similarity metric:\n        :math:`sim_{LCSseq}(s,t) = \\frac{|LCSseq(s,t)|}{max(|s|, |t|)}`\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n\n        Returns\n        -------\n        float\n            LCSseq similarity\n\n        Examples\n        --------\n        >>> sseq = LCSseq()\n        >>> sseq.sim('cat', 'hat')\n        0.6666666666666666\n        >>> sseq.sim('Niall', 'Neil')\n        0.6\n        >>> sseq.sim('aluminum', 'Catalan')\n        0.375\n        >>> sseq.sim('ATCG', 'TAGC')\n        0.5", "docstring_tokens": ["r", "Return", "the", "longest", "common", "subsequence", "similarity", "of", "two", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 260501}
{"url": "https://github.com/svanoort/pyresttest/blob/f92acf8e838c4623ddd8e12e880f31046ff9317f/sample_extension.py#L29-L35", "sha": "f92acf8e838c4623ddd8e12e880f31046ff9317f", "docstring_summary": "Parse a contains validator, which takes as the config a simple string to find", "language": "python", "parameters": "(config)", "return_statement": "return validator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"Contains input must be a simple string\"", ")", "arg_1", "=", "ContainsValidator", "(", ")", "arg_1", ".", "contains_string", "=", "arg_0", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Parse a contains validator, which takes as the config a simple string to find \"\"\"\n        if not isinstance(arg_0, basestring):\n            raise TypeError(\"Contains input must be a simple string\")\n        arg_1 = ContainsValidator()\n        arg_1.contains_string = arg_0\n        return arg_1", "path": "sample_extension.py", "identifier": "ContainsValidator.parse", "docstring": "Parse a contains validator, which takes as the config a simple string to find", "docstring_tokens": ["Parse", "a", "contains", "validator", "which", "takes", "as", "the", "config", "a", "simple", "string", "to", "find"], "nwo": "svanoort/pyresttest", "score": 0.941539248194801, "idx": 260502}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L3593-L3626", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks for horizontal spacing near commas and semicolons.", "language": "python", "parameters": "(filename, clean_lines, linenum, error)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_1", ".", "lines_without_raw_strings", "arg_5", "=", "arg_1", ".", "elided", "[", "arg_2", "]", "if", "(", "Search", "(", "r',[^,\\s]'", ",", "ReplaceAll", "(", "r'\\boperator\\s*,\\s*\\('", ",", "'F('", ",", "arg_5", ")", ")", "and", "Search", "(", "r',[^,\\s]'", ",", "arg_4", "[", "arg_2", "]", ")", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/comma'", ",", "3", ",", "'Missing space after ,'", ")", "if", "Search", "(", "r';[^\\s};\\\\)/]'", ",", "arg_5", ")", ":", "arg_3", "(", "arg_0", ",", "arg_2", ",", "'whitespace/semicolon'", ",", "3", ",", "'Missing space after ;'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"Checks for horizontal spacing near commas and semicolons.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.\n  \"\"\"\n  arg_4 = arg_1.lines_without_raw_strings\n  arg_5 = arg_1.elided[arg_2]\n\n  # You should always have a space after a comma (either as fn arg or operator)\n  #\n  # This does not apply when the non-space character following the\n  # comma is another comma, since the only time when that happens is\n  # for empty macro arguments.\n  #\n  # We run this check in two passes: first pass on elided lines to\n  # verify that lines contain missing whitespaces, second pass on raw\n  # lines to confirm that those missing whitespaces are not due to\n  # elided comments.\n  if (Search(r',[^,\\s]', ReplaceAll(r'\\boperator\\s*,\\s*\\(', 'F(', arg_5)) and\n      Search(r',[^,\\s]', arg_4[arg_2])):\n    arg_3(arg_0, arg_2, 'whitespace/comma', 3,\n          'Missing space after ,')\n\n  # You should always have a space after a semicolon\n  # except for few corner cases\n  # TODO(unknown): clarify if 'if (1) { return 1;}' is requires one more\n  # space after ;\n  if Search(r';[^\\s};\\\\)/]', arg_5):\n    arg_3(arg_0, arg_2, 'whitespace/semicolon', 3,\n          'Missing space after ;')", "path": "third_party/python/cpplint/cpplint.py", "identifier": "CheckCommaSpacing", "docstring": "Checks for horizontal spacing near commas and semicolons.\n\n  Args:\n    filename: The name of the current file.\n    clean_lines: A CleansedLines instance containing the file.\n    linenum: The number of the line to check.\n    error: The function to call with any errors found.", "docstring_tokens": ["Checks", "for", "horizontal", "spacing", "near", "commas", "and", "semicolons", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260503}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/dict_manager.py#L39-L44", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Get several graphs by their identifiers.", "language": "python", "parameters": "(self, network_ids: Iterable[int])", "return_statement": "return [\n            self.networks[network_id]\n            for network_id in network_ids\n        ]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ")", "->", "List", "[", "BELGraph", "]", ":", "return", "[", "arg_0", ".", "networks", "[", "arg_4", "]", "for", "arg_4", "in", "arg_1", "]"], "function": "def Func(arg_0, arg_1: arg_2[arg_3]) -> List[BELGraph]:\n        \"\"\"Get several graphs by their identifiers.\"\"\"\n        return [\n            arg_0.networks[arg_4]\n            for arg_4 in arg_1\n        ]", "path": "src/pybel_tools/dict_manager.py", "identifier": "DictManager.get_graphs_by_ids", "docstring": "Get several graphs by their identifiers.", "docstring_tokens": ["Get", "several", "graphs", "by", "their", "identifiers", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260504}
{"url": "https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L133-L138", "sha": "f3ed561253eb4a8e1522c64f59bf64d275e9d315", "docstring_summary": "has this jwt been used?", "language": "python", "parameters": "(self, tok)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "jwts", ":", "return", "True", "arg_0", ".", "jwts", "[", "arg_1", "]", "=", "time", ".", "time", "(", ")", "return", "False"], "function": "def Func(arg_0, arg_1):\n        \"\"\"has this jwt been used?\"\"\"\n        if arg_1 in arg_0.jwts:\n            return True\n        arg_0.jwts[arg_1] = time.time()\n        return False", "path": "onetimejwt/__init__.py", "identifier": "Manager.already_used", "docstring": "has this jwt been used?", "docstring_tokens": ["has", "this", "jwt", "been", "used?"], "nwo": "srevenant/onetimejwt", "score": 0.0, "idx": 260505}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L464-L506", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Computes the equivalent noise bandwidth", "language": "python", "parameters": "(data)", "return_statement": "return N * np.sum(data**2) / np.sum(data)**2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "len", "(", "arg_0", ")", "return", "arg_1", "*", "np", ".", "sum", "(", "arg_0", "**", "2", ")", "/", "np", ".", "sum", "(", "arg_0", ")", "**", "2"], "function": "def Func(arg_0):\n    r\"\"\"Computes the equivalent noise bandwidth\n\n    .. math:: ENBW = N \\frac{\\sum_{n=1}^{N} w_n^2}{\\left(\\sum_{n=1}^{N} w_n \\right)^2}\n\n    .. doctest::\n\n        >>> from spectrum import create_window, Func\n        >>> w = create_window(64, 'rectangular')\n        >>> Func(w)\n        1.0\n\n    The following table contains the ENBW values for some of the\n    implemented windows in this module (with N=16384). They have been\n    double checked against litterature (Source: [Harris]_, [Marple]_).\n\n    If not present, it means that it has not been checked.\n\n    =================== ============ =============\n    name                 ENBW        litterature\n    =================== ============ =============\n    rectangular         1.           1.\n    triangle            1.3334       1.33\n    Hann                1.5001       1.5\n    Hamming             1.3629       1.36\n    blackman            1.7268       1.73\n    kaiser              1.7\n    blackmanharris,4    2.004        2.\n    riesz               1.2000       1.2\n    riemann             1.32         1.3\n    parzen              1.917        1.92\n    tukey 0.25          1.102        1.1\n    bohman              1.7858       1.79\n    poisson 2           1.3130       1.3\n    hanningpoisson 0.5  1.609        1.61\n    cauchy              1.489        1.48\n    lanczos             1.3\n    =================== ============ =============\n\n\n    \"\"\"\n    arg_1 = len(arg_0)\n    return arg_1 * np.sum(arg_0**2) / np.sum(arg_0)**2", "path": "src/spectrum/window.py", "identifier": "enbw", "docstring": "r\"\"\"Computes the equivalent noise bandwidth\n\n    .. math:: ENBW = N \\frac{\\sum_{n=1}^{N} w_n^2}{\\left(\\sum_{n=1}^{N} w_n \\right)^2}\n\n    .. doctest::\n\n        >>> from spectrum import create_window, enbw\n        >>> w = create_window(64, 'rectangular')\n        >>> enbw(w)\n        1.0\n\n    The following table contains the ENBW values for some of the\n    implemented windows in this module (with N=16384). They have been\n    double checked against litterature (Source: [Harris]_, [Marple]_).\n\n    If not present, it means that it has not been checked.\n\n    =================== ============ =============\n    name                 ENBW        litterature\n    =================== ============ =============\n    rectangular         1.           1.\n    triangle            1.3334       1.33\n    Hann                1.5001       1.5\n    Hamming             1.3629       1.36\n    blackman            1.7268       1.73\n    kaiser              1.7\n    blackmanharris,4    2.004        2.\n    riesz               1.2000       1.2\n    riemann             1.32         1.3\n    parzen              1.917        1.92\n    tukey 0.25          1.102        1.1\n    bohman              1.7858       1.79\n    poisson 2           1.3130       1.3\n    hanningpoisson 0.5  1.609        1.61\n    cauchy              1.489        1.48\n    lanczos             1.3\n    =================== ============ =============", "docstring_tokens": ["r", "Computes", "the", "equivalent", "noise", "bandwidth"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 260506}
{"url": "https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/app.py#L18-L28", "sha": "b4fd366b7763891c690fe3000b8840e656da023e", "docstring_summary": "Creates a new price record", "language": "python", "parameters": "(self, price: PriceModel)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "if", "not", "arg_1", ":", "raise", "ValueError", "(", "\"Cannot add price. The received model is null!\"", ")", "arg_3", "=", "mappers", ".", "PriceMapper", "(", ")", "arg_4", "=", "arg_3", ".", "map_model", "(", "arg_1", ")", "arg_0", ".", "Func_entity", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\" Creates a new price record \"\"\"\n        # assert isinstance(price, PriceModel)\n\n        if not arg_1:\n            raise ValueError(\"Cannot add price. The received model is null!\")\n\n        arg_3 = mappers.PriceMapper()\n        arg_4 = arg_3.map_model(arg_1)\n\n        arg_0.Func_entity(arg_4)", "path": "pricedb/app.py", "identifier": "PriceDbApplication.add_price", "docstring": "Creates a new price record", "docstring_tokens": ["Creates", "a", "new", "price", "record"], "nwo": "MisterY/price-database", "score": 0.532275583711422, "idx": 260507}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/states.py#L722-L727", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Return component by category name", "language": "python", "parameters": "(self, name)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "comps", ":", "if", "arg_2", ".", "category", "==", "arg_1", ":", "return", "arg_2", "return", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Return component by category name \"\"\"\n        for arg_2 in arg_0.comps:\n            if arg_2.category == arg_1:\n                return arg_2\n        return None", "path": "peri/states.py", "identifier": "ImageState.get", "docstring": "Return component by category name", "docstring_tokens": ["Return", "component", "by", "category", "name"], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260508}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/codeunit.py#L111-L125", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Return an open file for reading the source of the code unit.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "filename", ")", ":", "return", "open_source", "(", "arg_0", ".", "filename", ")", "arg_1", "=", "arg_0", ".", "file_locator", ".", "get_zip_data", "(", "arg_0", ".", "filename", ")", "if", "arg_1", "is", "not", "None", ":", "return", "StringIO", "(", "arg_1", ")", "raise", "CoverageException", "(", "\"No source for code '%s'.\"", "%", "arg_0", ".", "filename", ")"], "function": "def Func(arg_0):\n        \"\"\"Return an open file for reading the source of the code unit.\"\"\"\n        if os.path.exists(arg_0.filename):\n            # A regular text file: open it.\n            return open_source(arg_0.filename)\n\n        # Maybe it's in a zip file?\n        arg_1 = arg_0.file_locator.get_zip_data(arg_0.filename)\n        if arg_1 is not None:\n            return StringIO(arg_1)\n\n        # Couldn't find source.\n        raise CoverageException(\n            \"No source for code '%s'.\" % arg_0.filename\n            )", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/codeunit.py", "identifier": "CodeUnit.source_file", "docstring": "Return an open file for reading the source of the code unit.", "docstring_tokens": ["Return", "an", "open", "file", "for", "reading", "the", "source", "of", "the", "code", "unit", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 260509}
{"url": "https://github.com/ManageIQ/manageiq-api-client-python/blob/e0c8884929e45766c2835bc7dcf4e78b0794248f/src/manageiq_client/api.py#L393-L398", "sha": "e0c8884929e45766c2835bc7dcf4e78b0794248f", "docstring_summary": "Returns all entities present in the collection with ``attributes`` included.", "language": "python", "parameters": "(self, attributes)", "return_statement": "return entities", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "reload", "(", "expand", "=", "True", ",", "arg_1", "=", "arg_1", ")", "arg_2", "=", "[", "Entity", "(", "arg_0", ",", "r", ",", "arg_1", "=", "arg_1", ")", "for", "r", "in", "arg_0", ".", "_resources", "]", "arg_0", ".", "reload", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns all entities present in the collection with ``attributes`` included.\"\"\"\n        arg_0.reload(expand=True, arg_1=arg_1)\n        arg_2 = [Entity(arg_0, r, arg_1=arg_1) for r in arg_0._resources]\n        arg_0.reload()\n        return arg_2", "path": "src/manageiq_client/api.py", "identifier": "Collection.all_include_attributes", "docstring": "Returns all entities present in the collection with ``attributes`` included.", "docstring_tokens": ["Returns", "all", "entities", "present", "in", "the", "collection", "with", "attributes", "included", "."], "nwo": "ManageIQ/manageiq-api-client-python", "score": 0.39558698652423346, "idx": 260510}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/io.py#L283-L303", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Make a temporary python file, return filename and filehandle.", "language": "python", "parameters": "(src, ext='.py')", "return_statement": "return fname, f", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'.py'", ")", ":", "arg_2", "=", "tempfile", ".", "mkstemp", "(", "arg_1", ")", "[", "1", "]", "arg_3", "=", "open", "(", "arg_2", ",", "'w'", ")", "arg_3", ".", "write", "(", "arg_0", ")", "arg_3", ".", "flush", "(", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1='.py'):\n    \"\"\"Make a temporary python file, return filename and filehandle.\n\n    Parameters\n    ----------\n    src : string or list of strings (no need for ending newlines if list)\n      Source code to be written to the file.\n\n    ext : optional, string\n      Extension for the generated file.\n\n    Returns\n    -------\n    (filename, open filehandle)\n      It is the caller's responsibility to close the open file and unlink it.\n    \"\"\"\n    arg_2 = tempfile.mkstemp(arg_1)[1]\n    arg_3 = open(arg_2,'w')\n    arg_3.write(arg_0)\n    arg_3.flush()\n    return arg_2, arg_3", "path": "environment/lib/python2.7/site-packages/IPython/utils/io.py", "identifier": "temp_pyfile", "docstring": "Make a temporary python file, return filename and filehandle.\n\n    Parameters\n    ----------\n    src : string or list of strings (no need for ending newlines if list)\n      Source code to be written to the file.\n\n    ext : optional, string\n      Extension for the generated file.\n\n    Returns\n    -------\n    (filename, open filehandle)\n      It is the caller's responsibility to close the open file and unlink it.", "docstring_tokens": ["Make", "a", "temporary", "python", "file", "return", "filename", "and", "filehandle", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260511}
{"url": "https://github.com/incuna/django-wkhtmltopdf/blob/4e73f604c48f7f449c916c4257a72af59517322c/wkhtmltopdf/views.py#L134-L161", "sha": "4e73f604c48f7f449c916c4257a72af59517322c", "docstring_summary": "Returns a PDF response with a template rendered with the given context.", "language": "python", "parameters": "(self, context, **response_kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "pop", "(", "'filename'", ",", "None", ")", "arg_4", "=", "arg_2", ".", "pop", "(", "'cmd_options'", ",", "None", ")", "if", "issubclass", "(", "arg_0", ".", "response_class", ",", "PDFTemplateResponse", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "get_filename", "(", ")", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "get_cmd_options", "(", ")", "return", "super", "(", "PDFTemplateView", ",", "arg_0", ")", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "show_content_in_browser", "=", "arg_0", ".", "show_content_in_browser", ",", "header_template", "=", "arg_0", ".", "header_template", ",", "footer_template", "=", "arg_0", ".", "footer_template", ",", "arg_4", "=", "arg_4", ",", "cover_template", "=", "arg_0", ".", "cover_template", ",", "**", "arg_2", ")", "else", ":", "return", "super", "(", "PDFTemplateView", ",", "arg_0", ")", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Returns a PDF response with a template rendered with the given context.\n        \"\"\"\n        arg_3 = arg_2.pop('filename', None)\n        arg_4 = arg_2.pop('cmd_options', None)\n\n        if issubclass(arg_0.response_class, PDFTemplateResponse):\n            if arg_3 is None:\n                arg_3 = arg_0.get_filename()\n\n            if arg_4 is None:\n                arg_4 = arg_0.get_cmd_options()\n\n            return super(PDFTemplateView, arg_0).Func(\n                arg_1=arg_1, arg_3=arg_3,\n                show_content_in_browser=arg_0.show_content_in_browser,\n                header_template=arg_0.header_template,\n                footer_template=arg_0.footer_template,\n                arg_4=arg_4,\n                cover_template=arg_0.cover_template,\n                **arg_2\n            )\n        else:\n            return super(PDFTemplateView, arg_0).Func(\n                arg_1=arg_1,\n                **arg_2\n            )", "path": "wkhtmltopdf/views.py", "identifier": "PDFTemplateView.render_to_response", "docstring": "Returns a PDF response with a template rendered with the given context.", "docstring_tokens": ["Returns", "a", "PDF", "response", "with", "a", "template", "rendered", "with", "the", "given", "context", "."], "nwo": "incuna/django-wkhtmltopdf", "score": 0.5383908637665665, "idx": 260512}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process.py#L687-L737", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Sets the main input channels of the pipeline and their forks.", "language": "python", "parameters": "(self, raw_input)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"Setting raw inputs using raw input dict: {}\"", ".", "format", "(", "arg_1", ")", ")", "arg_2", "=", "[", "]", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "arg_2", ".", "append", "(", "arg_4", "[", "\"channel_str\"", "]", ")", "arg_5", "=", "arg_0", ".", "RAW_MAPPING", "[", "arg_3", "]", "arg_0", ".", "params", "[", "arg_3", "]", "=", "{", "\"default\"", ":", "arg_5", "[", "\"default_value\"", "]", ",", "\"description\"", ":", "arg_5", "[", "\"description\"", "]", "}", "arg_7", "=", "\"set\"", "if", "len", "(", "arg_4", "[", "\"raw_forks\"", "]", ")", "==", "1", "else", "\"into\"", "arg_0", ".", "forks", ".", "append", "(", "\"\\n{}.{}{{ {} }}\\n\"", ".", "format", "(", "arg_4", "[", "\"channel\"", "]", ",", "arg_7", ",", "\";\"", ".", "join", "(", "arg_4", "[", "\"raw_forks\"", "]", ")", ")", ")", "logger", ".", "debug", "(", "\"Setting raw inputs: {}\"", ".", "format", "(", "arg_2", ")", ")", "logger", ".", "debug", "(", "\"Setting forks attribute to: {}\"", ".", "format", "(", "arg_0", ".", "forks", ")", ")", "arg_0", ".", "_context", "=", "{", "**", "arg_0", ".", "_context", ",", "**", "{", "\"forks\"", ":", "\"\\n\"", ".", "join", "(", "arg_0", ".", "forks", ")", ",", "\"main_inputs\"", ":", "\"\\n\"", ".", "join", "(", "arg_2", ")", "}", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Sets the main input channels of the pipeline and their forks.\n\n        The ``raw_input`` dictionary input should contain one entry for each\n        input type (fastq, fasta, etc). The corresponding value should be a\n        dictionary/json with the following key:values:\n\n        - ``channel``: Name of the raw input channel (e.g.: channel1)\n        - ``channel_str``: The nextflow definition of the channel and\n           eventual checks (e.g.: channel1 = Channel.fromPath(param))\n        - ``raw_forks``: A list of channels to which the channel name will\n          for to.\n\n        Each new type of input parameter is automatically added to the\n        :attr:`params` attribute, so that they are automatically collected\n        for the pipeline description and help.\n\n        Parameters\n        ----------\n        raw_input : dict\n            Contains an entry for each input type with the channel name,\n            channel string and forks.\n        \"\"\"\n\n        logger.debug(\"Setting raw inputs using raw input dict: {}\".format(\n            arg_1))\n\n        arg_2 = []\n\n        for arg_3, arg_4 in arg_1.items():\n\n            arg_2.append(arg_4[\"channel_str\"])\n\n            # Update the process' parameters with the raw input\n            arg_5 = arg_0.RAW_MAPPING[arg_3]\n            arg_0.params[arg_3] = {\n                \"default\": arg_5[\"default_value\"],\n                \"description\": arg_5[\"description\"]\n            }\n\n            arg_7 = \"set\" if len(arg_4[\"raw_forks\"]) == 1 else \"into\"\n\n            arg_0.forks.append(\"\\n{}.{}{{ {} }}\\n\".format(\n                arg_4[\"channel\"], arg_7, \";\".join(arg_4[\"raw_forks\"])\n            ))\n\n        logger.debug(\"Setting raw inputs: {}\".format(arg_2))\n        logger.debug(\"Setting forks attribute to: {}\".format(arg_0.forks))\n        arg_0._context = {**arg_0._context,\n                         **{\"forks\": \"\\n\".join(arg_0.forks),\n                            \"main_inputs\": \"\\n\".join(arg_2)}}", "path": "flowcraft/generator/process.py", "identifier": "Init.set_raw_inputs", "docstring": "Sets the main input channels of the pipeline and their forks.\n\n        The ``raw_input`` dictionary input should contain one entry for each\n        input type (fastq, fasta, etc). The corresponding value should be a\n        dictionary/json with the following key:values:\n\n        - ``channel``: Name of the raw input channel (e.g.: channel1)\n        - ``channel_str``: The nextflow definition of the channel and\n           eventual checks (e.g.: channel1 = Channel.fromPath(param))\n        - ``raw_forks``: A list of channels to which the channel name will\n          for to.\n\n        Each new type of input parameter is automatically added to the\n        :attr:`params` attribute, so that they are automatically collected\n        for the pipeline description and help.\n\n        Parameters\n        ----------\n        raw_input : dict\n            Contains an entry for each input type with the channel name,\n            channel string and forks.", "docstring_tokens": ["Sets", "the", "main", "input", "channels", "of", "the", "pipeline", "and", "their", "forks", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 260513}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L49-L62", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Convert a bitstring `value` of `width` bits to a signed integer\n    representation.", "language": "python", "parameters": "(value, width)", "return_statement": "return Operators.ITEBV(width, Bit(value, width - 1) == 1,\n                           GetNBits(value, width) - 2**width,\n                           GetNBits(value, width))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "Operators", ".", "ITEBV", "(", "arg_1", ",", "Bit", "(", "arg_0", ",", "arg_1", "-", "1", ")", "==", "1", ",", "GetNBits", "(", "arg_0", ",", "arg_1", ")", "-", "2", "**", "arg_1", ",", "GetNBits", "(", "arg_0", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Convert a bitstring `value` of `width` bits to a signed integer\n    representation.\n\n    :param value: The value to convert.\n    :type value: int or long or BitVec\n    :param int width: The width of the bitstring to consider\n    :return: The converted value\n    :rtype int or long or BitVec\n    \"\"\"\n    return Operators.ITEBV(arg_1, Bit(arg_0, arg_1 - 1) == 1,\n                           GetNBits(arg_0, arg_1) - 2**arg_1,\n                           GetNBits(arg_0, arg_1))", "path": "manticore/native/cpu/bitwise.py", "identifier": "SInt", "docstring": "Convert a bitstring `value` of `width` bits to a signed integer\n    representation.\n\n    :param value: The value to convert.\n    :type value: int or long or BitVec\n    :param int width: The width of the bitstring to consider\n    :return: The converted value\n    :rtype int or long or BitVec", "docstring_tokens": ["Convert", "a", "bitstring", "value", "of", "width", "bits", "to", "a", "signed", "integer", "representation", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260514}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L250-L285", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This calculates the Matthews correlation coefficent.", "language": "python", "parameters": "(ntp, ntn, nfp, nfn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "(", "arg_0", "*", "arg_1", "-", "arg_2", "*", "arg_3", ")", "arg_5", "=", "msqrt", "(", "(", "arg_0", "+", "arg_2", ")", "*", "(", "arg_0", "+", "arg_3", ")", "*", "(", "arg_1", "+", "arg_2", ")", "*", "(", "arg_1", "+", "arg_3", ")", ")", "if", "arg_5", ">", "0", ":", "return", "arg_4", "/", "arg_5", "else", ":", "return", "np", ".", "nan"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    '''\n    This calculates the Matthews correlation coefficent.\n\n    https://en.wikipedia.org/wiki/Matthews_correlation_coefficient\n\n    Parameters\n    ----------\n\n    ntp : int\n        The number of true positives.\n\n    ntn : int\n        The number of true negatives\n\n    nfp : int\n        The number of false positives.\n\n    nfn : int\n        The number of false negatives.\n\n    Returns\n    -------\n\n    float\n        The Matthews correlation coefficient.\n\n    '''\n\n    arg_4 = (arg_0*arg_1 - arg_2*arg_3)\n    arg_5 = msqrt((arg_0 + arg_2)*(arg_0 + arg_3)*(arg_1 + arg_2)*(arg_1 + arg_3))\n\n    if arg_5 > 0:\n        return arg_4/arg_5\n    else:\n        return np.nan", "path": "astrobase/fakelcs/recovery.py", "identifier": "matthews_correl_coeff", "docstring": "This calculates the Matthews correlation coefficent.\n\n    https://en.wikipedia.org/wiki/Matthews_correlation_coefficient\n\n    Parameters\n    ----------\n\n    ntp : int\n        The number of true positives.\n\n    ntn : int\n        The number of true negatives\n\n    nfp : int\n        The number of false positives.\n\n    nfn : int\n        The number of false negatives.\n\n    Returns\n    -------\n\n    float\n        The Matthews correlation coefficient.", "docstring_tokens": ["This", "calculates", "the", "Matthews", "correlation", "coefficent", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 260515}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/deep_exponential_family.py#L118-L125", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Learnable Deterministic distribution over positive reals.", "language": "python", "parameters": "(shape, min_loc=1e-3, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1e-3", ",", "arg_2", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "variable_scope", "(", "None", ",", "default_name", "=", "\"Func\"", ")", ":", "arg_3", "=", "tf", ".", "compat", ".", "v1", ".", "get_variable", "(", "\"unconstrained_loc\"", ",", "arg_0", ")", "arg_4", "=", "tf", ".", "maximum", "(", "tf", ".", "nn", ".", "softplus", "(", "arg_3", ")", ",", "arg_1", ")", "arg_5", "=", "ed", ".", "Deterministic", "(", "arg_4", "=", "arg_4", ",", "arg_2", "=", "arg_2", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=1e-3, arg_2=None):\n  \"\"\"Learnable Deterministic distribution over positive reals.\"\"\"\n  with tf.compat.v1.variable_scope(\n      None, default_name=\"Func\"):\n    arg_3 = tf.compat.v1.get_variable(\"unconstrained_loc\", arg_0)\n    arg_4 = tf.maximum(tf.nn.softplus(arg_3), arg_1)\n    arg_5 = ed.Deterministic(arg_4=arg_4, arg_2=arg_2)\n    return arg_5", "path": "tensorflow_probability/examples/deep_exponential_family.py", "identifier": "trainable_positive_deterministic", "docstring": "Learnable Deterministic distribution over positive reals.", "docstring_tokens": ["Learnable", "Deterministic", "distribution", "over", "positive", "reals", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260516}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/validate.py#L28-L42", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "validate source directory names in components", "language": "python", "parameters": "(dirname, component_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "==", "arg_1", ":", "return", "'Module %s public include directory %s should not contain source files'", "%", "(", "arg_1", ",", "arg_0", ")", "elif", "arg_0", ".", "lower", "(", ")", "in", "(", "'source'", ",", "'src'", ")", "and", "arg_0", "!=", "'source'", ":", "return", "'Module %s has non-standard source directory name: \"%s\" should be \"source\"'", "%", "(", "arg_1", ",", "arg_0", ")", "elif", "isPotentialTestDir", "(", "arg_0", ")", "and", "arg_0", "!=", "'test'", ":", "return", "'Module %s has non-standard test directory name: \"%s\" should be \"test\"'", "%", "(", "arg_1", ",", "arg_0", ")", "elif", "not", "Source_Dir_Regex", ".", "match", "(", "arg_0", ")", ":", "arg_2", "=", "Source_Dir_Invalid_Regex", ".", "sub", "(", "''", ",", "arg_0", ".", "lower", "(", ")", ")", "if", "not", "arg_2", ":", "arg_2", "=", "'source'", "return", "'Module %s has non-standard source directory name: \"%s\" should be \"%s\"'", "%", "(", "arg_1", ",", "arg_0", ",", "arg_2", ")", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n    ''' validate source directory names in components '''\n    if arg_0 == arg_1:\n        return 'Module %s public include directory %s should not contain source files' % (arg_1, arg_0)\n    elif arg_0.lower() in ('source', 'src') and arg_0 != 'source':\n        return 'Module %s has non-standard source directory name: \"%s\" should be \"source\"' % (arg_1, arg_0)\n    elif isPotentialTestDir(arg_0) and arg_0 != 'test':\n        return 'Module %s has non-standard test directory name: \"%s\" should be \"test\"' % (arg_1, arg_0)\n    elif not Source_Dir_Regex.match(arg_0):\n        arg_2 = Source_Dir_Invalid_Regex.sub('', arg_0.lower())\n        if not arg_2:\n            arg_2 = 'source'\n        return 'Module %s has non-standard source directory name: \"%s\" should be \"%s\"' % (arg_1, arg_0, arg_2)\n    else:\n        return None", "path": "yotta/lib/validate.py", "identifier": "sourceDirValidationError", "docstring": "validate source directory names in components", "docstring_tokens": ["validate", "source", "directory", "names", "in", "components"], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 260517}
{"url": "https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/xsanscript.py#L60-L89", "sha": "b7c5166a275c15a612fbb96fd3d765bc9004b299", "docstring_summary": "Add a variety of default schemes.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "str", ".", "split", "if", "sys", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "arg_0", "=", "unicode", ".", "split", "def", "pop_all", "(", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_2", ":", "arg_1", ".", "pop", "(", "arg_3", ")", "global", "arg_4", "arg_4", "=", "copy", ".", "deepcopy", "(", "sanscript", ".", "SCHEMES", ")", "pop_all", "(", "arg_4", ",", "[", "sanscript", ".", "ORIYA", ",", "sanscript", ".", "BENGALI", ",", "sanscript", ".", "GUJARATI", "]", ")", "arg_4", "[", "HK", "]", ".", "update", "(", "{", "'vowels'", ":", "arg_0", "(", "\"\"\"a A i I u U R RR lR lRR E ai O au\"\"\"", ")", "+", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ",", "'marks'", ":", "arg_0", "(", "\"\"\"A i I u U R RR lR lRR E ai O au\"\"\"", ")", "+", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ",", "'consonants'", ":", "sanscript", ".", "SCHEMES", "[", "HK", "]", "[", "'consonants'", "]", "+", "arg_0", "(", "\"\"\"n2 r2 zh\"\"\"", ")", "}", ")", "arg_4", "[", "ITRANS", "]", ".", "update", "(", "{", "'vowels'", ":", "arg_0", "(", "\"\"\"a A i I u U R RR LLi LLI E ai O au\"\"\"", ")", "+", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ",", "'marks'", ":", "arg_0", "(", "\"\"\"A i I u U R RR LLi LLI E ai O au\"\"\"", ")", "+", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ",", "'consonants'", ":", "sanscript", ".", "SCHEMES", "[", "ITRANS", "]", "[", "'consonants'", "]", "+", "arg_0", "(", "\"\"\"n2 r2 zh\"\"\"", ")", "}", ")", "pop_all", "(", "arg_4", "[", "ITRANS", "]", ".", "synonym_map", ",", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ")", "arg_4", "[", "OPTITRANS", "]", ".", "update", "(", "{", "'vowels'", ":", "arg_0", "(", "\"\"\"a A i I u U R RR LLi LLI E ai O au\"\"\"", ")", "+", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ",", "'marks'", ":", "arg_0", "(", "\"\"\"A i I u U R RR LLi LLI E ai O au\"\"\"", ")", "+", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ",", "'consonants'", ":", "sanscript", ".", "SCHEMES", "[", "OPTITRANS", "]", "[", "'consonants'", "]", "+", "arg_0", "(", "\"\"\"n2 r2 zh\"\"\"", ")", "}", ")", "pop_all", "(", "arg_4", "[", "OPTITRANS", "]", ".", "synonym_map", ",", "arg_0", "(", "\"\"\"e o\"\"\"", ")", ")"], "function": "def Func():\r\n    \"\"\"Add a variety of default schemes.\"\"\"\r\n    arg_0 = str.split\r\n    if sys.version_info < (3, 0):\r\n        # noinspection PyUnresolvedReferences\r\n        arg_0 = unicode.split\r\n\r\n    def pop_all(arg_1, arg_2):\r\n        for arg_3 in arg_2:\r\n            arg_1.pop(arg_3)\r\n    global arg_4\r\n    arg_4 = copy.deepcopy(sanscript.SCHEMES)\r\n    pop_all(arg_4, [sanscript.ORIYA, sanscript.BENGALI, sanscript.GUJARATI])\r\n    arg_4[HK].update({\r\n        'vowels': arg_0(\"\"\"a A i I u U R RR lR lRR E ai O au\"\"\") + arg_0(\"\"\"e o\"\"\"),\r\n        'marks': arg_0(\"\"\"A i I u U R RR lR lRR E ai O au\"\"\") + arg_0(\"\"\"e o\"\"\"),\r\n        'consonants': sanscript.SCHEMES[HK]['consonants'] + arg_0(\"\"\"n2 r2 zh\"\"\")\r\n    })\r\n    arg_4[ITRANS].update({\r\n        'vowels': arg_0(\"\"\"a A i I u U R RR LLi LLI E ai O au\"\"\") + arg_0(\"\"\"e o\"\"\"),\r\n        'marks': arg_0(\"\"\"A i I u U R RR LLi LLI E ai O au\"\"\") + arg_0(\"\"\"e o\"\"\"),\r\n        'consonants': sanscript.SCHEMES[ITRANS]['consonants'] + arg_0(\"\"\"n2 r2 zh\"\"\")\r\n    })\r\n    pop_all(arg_4[ITRANS].synonym_map, arg_0(\"\"\"e o\"\"\"))\r\n    arg_4[OPTITRANS].update({\r\n        'vowels': arg_0(\"\"\"a A i I u U R RR LLi LLI E ai O au\"\"\") + arg_0(\"\"\"e o\"\"\"),\r\n        'marks': arg_0(\"\"\"A i I u U R RR LLi LLI E ai O au\"\"\") + arg_0(\"\"\"e o\"\"\"),\r\n        'consonants': sanscript.SCHEMES[OPTITRANS]['consonants'] + arg_0(\"\"\"n2 r2 zh\"\"\")\r\n    })\r\n    pop_all(arg_4[OPTITRANS].synonym_map, arg_0(\"\"\"e o\"\"\"))", "path": "indic_transliteration/xsanscript.py", "identifier": "_setup", "docstring": "Add a variety of default schemes.", "docstring_tokens": ["Add", "a", "variety", "of", "default", "schemes", "."], "nwo": "sanskrit-coders/indic_transliteration", "score": 0.19543626030129047, "idx": 260518}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/django_util/__init__.py#L456-L461", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Returns True if there are valid credentials for the current user\n        and required scopes.", "language": "python", "parameters": "(self)", "return_statement": "return (credentials and not credentials.invalid and\n                credentials.has_scopes(self._get_scopes()))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_credentials_from_request", "(", "arg_0", ".", "request", ")", "return", "(", "arg_1", "and", "not", "arg_1", ".", "invalid", "and", "arg_1", ".", "has_scopes", "(", "arg_0", ".", "_get_scopes", "(", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns True if there are valid credentials for the current user\n        and required scopes.\"\"\"\n        arg_1 = _credentials_from_request(arg_0.request)\n        return (arg_1 and not arg_1.invalid and\n                arg_1.has_scopes(arg_0._get_scopes()))", "path": "oauth2client/contrib/django_util/__init__.py", "identifier": "UserOAuth2.has_credentials", "docstring": "Returns True if there are valid credentials for the current user\n        and required scopes.", "docstring_tokens": ["Returns", "True", "if", "there", "are", "valid", "credentials", "for", "the", "current", "user", "and", "required", "scopes", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 260519}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L39-L64", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Display full version information.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "click", ".", "echo", "(", "'Tower CLI %s'", "%", "__Func__", ")", "click", ".", "echo", "(", "'API %s'", "%", "CUR_API_VERSION", ")", "try", ":", "arg_0", "=", "client", ".", "get", "(", "'/config/'", ")", "except", "RequestException", "as", "ex", ":", "raise", "exc", ".", "TowerCLIError", "(", "'Could not connect to Ansible Tower.\\n%s'", "%", "six", ".", "text_type", "(", "ex", ")", ")", "arg_1", "=", "arg_0", ".", "json", "(", ")", "arg_2", "=", "arg_1", ".", "get", "(", "'license_info'", ",", "{", "}", ")", ".", "get", "(", "'license_type'", ",", "'open'", ")", "if", "arg_2", "==", "'open'", ":", "arg_3", "=", "'AWX'", "else", ":", "arg_3", "=", "'Ansible Tower'", "click", ".", "echo", "(", "'%s %s'", "%", "(", "arg_3", ",", "arg_1", "[", "'Func'", "]", ")", ")", "click", ".", "echo", "(", "'Ansible %s'", "%", "arg_1", "[", "'ansible_Func'", "]", ")"], "function": "def Func():\n    \"\"\"Display full Func information.\"\"\"\n\n    # Print out the current Func of Tower CLI.\n    click.echo('Tower CLI %s' % __Func__)\n\n    # Print out the current API Func of the current code base.\n    click.echo('API %s' % CUR_API_VERSION)\n\n    # Attempt to connect to the Ansible Tower server.\n    # If we succeed, print a Func; if not, generate a failure.\n    try:\n        arg_0 = client.get('/config/')\n    except RequestException as ex:\n        raise exc.TowerCLIError('Could not connect to Ansible Tower.\\n%s' %\n                                six.text_type(ex))\n    arg_1 = arg_0.json()\n    arg_2 = arg_1.get('license_info', {}).get('license_type', 'open')\n    if arg_2 == 'open':\n        arg_3 = 'AWX'\n    else:\n        arg_3 = 'Ansible Tower'\n    click.echo('%s %s' % (arg_3, arg_1['Func']))\n\n    # Print out Ansible Func of server\n    click.echo('Ansible %s' % arg_1['ansible_Func'])", "path": "tower_cli/cli/misc.py", "identifier": "version", "docstring": "Display full version information.", "docstring_tokens": ["Display", "full", "version", "information", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 260520}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py#L480-L486", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Handle display hook output.", "language": "python", "parameters": "(self, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"pyout: %s\"", ",", "arg_1", ".", "get", "(", "'content'", ",", "''", ")", ")", "if", "not", "arg_0", ".", "_hidden", "and", "arg_0", ".", "_is_from_this_session", "(", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'content'", "]", "[", "'data'", "]", "arg_0", ".", "_append_plain_text", "(", "arg_2", "+", "'\\n'", ",", "before_prompt", "=", "True", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handle display hook output.\n        \"\"\"\n        arg_0.log.debug(\"pyout: %s\", arg_1.get('content', ''))\n        if not arg_0._hidden and arg_0._is_from_this_session(arg_1):\n            arg_2 = arg_1['content']['data']\n            arg_0._append_plain_text(arg_2 + '\\n', before_prompt=True)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", "identifier": "FrontendWidget._handle_pyout", "docstring": "Handle display hook output.", "docstring_tokens": ["Handle", "display", "hook", "output", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260521}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/upsampling_layers.py#L45-L78", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert nearest upsampling layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting upsample...'", ")", "if", "arg_0", "[", "'mode'", "]", "!=", "'nearest'", ":", "raise", "AssertionError", "(", "'Cannot convert non-nearest upsampling'", ")", "if", "arg_6", "==", "'short'", ":", "arg_7", "=", "'UPSL'", "+", "random_string", "(", "4", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "if", "'height_scale'", "in", "arg_0", ":", "arg_8", "=", "(", "arg_0", "[", "'height_scale'", "]", ",", "arg_0", "[", "'width_scale'", "]", ")", "elif", "len", "(", "arg_3", ")", "==", "2", ":", "arg_8", "=", "arg_4", "[", "arg_3", "[", "-", "1", "]", "+", "'_np'", "]", "[", "-", "2", ":", "]", "arg_9", "=", "keras", ".", "layers", ".", "UpSampling2D", "(", "size", "=", "arg_8", ",", "name", "=", "arg_7", ")", "arg_4", "[", "arg_2", "]", "=", "arg_9", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert nearest upsampling layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting upsample...')\n\n    if arg_0['mode'] != 'nearest':\n        raise AssertionError('Cannot convert non-nearest upsampling')\n\n    if arg_6 == 'short':\n        arg_7 = 'UPSL' + random_string(4)\n    elif arg_6 == 'keep':\n        arg_7 = arg_1\n    else:\n        arg_7 = arg_1 + str(random.random())\n\n    if 'height_scale' in arg_0:\n        arg_8 = (arg_0['height_scale'], arg_0['width_scale'])\n    elif len(arg_3) == 2:\n        arg_8 = arg_4[arg_3[-1] + '_np'][-2:]\n\n    arg_9 = keras.layers.UpSampling2D(\n        size=arg_8, name=arg_7\n    )\n    arg_4[arg_2] = arg_9(arg_4[arg_3[0]])", "path": "pytorch2keras/upsampling_layers.py", "identifier": "convert_upsample", "docstring": "Convert nearest upsampling layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "nearest", "upsampling", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 260522}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L568-L585", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "If database output logging is enabled, this saves all the\n        outputs from the indicated prompt number to the database. It's\n        called by run_cell after code has been executed.", "language": "python", "parameters": "(self, line_num)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "(", "not", "arg_0", ".", "db_log_output", ")", "or", "(", "arg_1", "not", "in", "arg_0", ".", "output_hist_reprs", ")", ":", "return", "arg_2", "=", "arg_0", ".", "output_hist_reprs", "[", "arg_1", "]", "with", "arg_0", ".", "db_output_cache_lock", ":", "arg_0", ".", "db_output_cache", ".", "append", "(", "(", "arg_1", ",", "arg_2", ")", ")", "if", "arg_0", ".", "db_cache_size", "<=", "1", ":", "arg_0", ".", "save_flag", ".", "set", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"If database output logging is enabled, this saves all the\n        outputs from the indicated prompt number to the database. It's\n        called by run_cell after code has been executed.\n\n        Parameters\n        ----------\n        line_num : int\n          The line number from which to save outputs\n        \"\"\"\n        if (not arg_0.db_log_output) or (arg_1 not in arg_0.output_hist_reprs):\n            return\n        arg_2 = arg_0.output_hist_reprs[arg_1]\n\n        with arg_0.db_output_cache_lock:\n            arg_0.db_output_cache.append((arg_1, arg_2))\n        if arg_0.db_cache_size <= 1:\n            arg_0.save_flag.set()", "path": "environment/lib/python2.7/site-packages/IPython/core/history.py", "identifier": "HistoryManager.store_output", "docstring": "If database output logging is enabled, this saves all the\n        outputs from the indicated prompt number to the database. It's\n        called by run_cell after code has been executed.\n\n        Parameters\n        ----------\n        line_num : int\n          The line number from which to save outputs", "docstring_tokens": ["If", "database", "output", "logging", "is", "enabled", "this", "saves", "all", "the", "outputs", "from", "the", "indicated", "prompt", "number", "to", "the", "database", ".", "It", "s", "called", "by", "run_cell", "after", "code", "has", "been", "executed", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260523}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L213-L218", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Show the transaction as plain json", "language": "python", "parameters": "(self)", "return_statement": "return dict(self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_is_constructed", "(", ")", "or", "arg_0", ".", "_is_require_reconstruction", "(", ")", ":", "arg_0", ".", "constructTx", "(", ")", "return", "dict", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\" Show the transaction as plain Func\n        \"\"\"\n        if not arg_0._is_constructed() or arg_0._is_require_reconstruction():\n            arg_0.constructTx()\n        return dict(arg_0)", "path": "graphenecommon/transactionbuilder.py", "identifier": "TransactionBuilder.json", "docstring": "Show the transaction as plain json", "docstring_tokens": ["Show", "the", "transaction", "as", "plain", "json"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 260524}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/publicsuffix.py#L174-L187", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Load the public suffix database into the system.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_1", ".", "INTERN", "[", "\"psl_db\"", "]", ":", "arg_1", ".", "INTERN", "[", "\"psl_db\"", "]", "=", "Dict", "(", ")", ".", "from_json", "(", "File", "(", "arg_0", ".", "destination", ")", ".", "read", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Load the public suffix database into the system.\n        \"\"\"\n\n        if not arg_1.INTERN[\"psl_db\"]:\n            # The public database was not already Funced.\n\n            # * We read, convert to dict and return the file content.\n            # and\n            # * We fill/create the database.\n            arg_1.INTERN[\"psl_db\"] = Dict().from_json(\n                File(arg_0.destination).read()\n            )", "path": "PyFunceble/publicsuffix.py", "identifier": "PublicSuffix.load", "docstring": "Load the public suffix database into the system.", "docstring_tokens": ["Load", "the", "public", "suffix", "database", "into", "the", "system", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 260525}
{"url": "https://github.com/Scifabric/pybossa-client/blob/998d7cb0207ff5030dc800f0c2577c5692316c2c/pbclient/__init__.py#L479-L511", "sha": "998d7cb0207ff5030dc800f0c2577c5692316c2c", "docstring_summary": "Create a task for a given project ID.", "language": "python", "parameters": "(project_id, info, n_answers=30, priority_0=0, quorum=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "30", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ")", ":", "try", ":", "arg_5", "=", "dict", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "calibration", "=", "0", ",", "arg_3", "=", "arg_3", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ")", "arg_6", "=", "_pybossa_req", "(", "'post'", ",", "'task'", ",", "payload", "=", "arg_5", ")", "if", "arg_6", ".", "get", "(", "'id'", ")", ":", "return", "Task", "(", "arg_6", ")", "else", ":", "return", "arg_6", "except", ":", "raise"], "function": "def Func(arg_0, arg_1, arg_2=30, arg_3=0, arg_4=0):\n    \"\"\"Create a task for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param info: PYBOSSA Project info JSON field\n    :type info: dict\n    :param n_answers: Number of answers or TaskRuns per task, default 30\n    :type n_answers: integer\n    :param priority_0: Value between 0 and 1 indicating priority of task within\n        Project (higher = more important), default 0.0\n    :type priority_0: float\n    :param quorum: Number of times this task should be done by different users,\n        default 0\n    :type quorum: integer\n    :returns: True -- the response status code\n    \"\"\"\n    try:\n        arg_5 = dict(\n            arg_0=arg_0,\n            arg_1=arg_1,\n            calibration=0,\n            arg_3=arg_3,\n            arg_2=arg_2,\n            arg_4=arg_4\n        )\n        arg_6 = _pybossa_req('post', 'task', payload=arg_5)\n        if arg_6.get('id'):\n            return Task(arg_6)\n        else:\n            return arg_6\n    except:  # pragma: no cover\n        raise", "path": "pbclient/__init__.py", "identifier": "create_task", "docstring": "Create a task for a given project ID.\n\n    :param project_id: PYBOSSA Project ID\n    :type project_id: integer\n    :param info: PYBOSSA Project info JSON field\n    :type info: dict\n    :param n_answers: Number of answers or TaskRuns per task, default 30\n    :type n_answers: integer\n    :param priority_0: Value between 0 and 1 indicating priority of task within\n        Project (higher = more important), default 0.0\n    :type priority_0: float\n    :param quorum: Number of times this task should be done by different users,\n        default 0\n    :type quorum: integer\n    :returns: True -- the response status code", "docstring_tokens": ["Create", "a", "task", "for", "a", "given", "project", "ID", "."], "nwo": "Scifabric/pybossa-client", "score": 0.27831918678159157, "idx": 260526}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/googlehits.py#L219-L233", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch information about a list of keywords.", "language": "python", "parameters": "(self, keywords)", "return_statement": "return req.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "len", "(", "arg_1", ")", "==", "1", ":", "arg_2", "=", "arg_1", "[", "0", "]", "else", ":", "arg_2", "=", "' '", ".", "join", "(", "[", "k", "for", "k", "in", "arg_1", "]", ")", "logger", ".", "info", "(", "\"Fetching Func for '%s'\"", ",", "arg_2", ")", "arg_3", "=", "{", "'q'", ":", "arg_2", "}", "arg_4", "=", "arg_0", ".", "fetch", "(", "GOOGLE_SEARCH_URL", ",", "payload", "=", "arg_3", ")", "return", "arg_4", ".", "text"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Fetch information about a list of keywords.\"\"\"\n\n        if len(arg_1) == 1:\n            arg_2 = arg_1[0]\n        else:\n            arg_2 = ' '.join([k for k in arg_1])\n\n        logger.info(\"Fetching Func for '%s'\", arg_2)\n        arg_3 = {'q': arg_2}\n\n        # Make the request\n        arg_4 = arg_0.fetch(GOOGLE_SEARCH_URL, payload=arg_3)\n\n        return arg_4.text", "path": "perceval/backends/core/googlehits.py", "identifier": "GoogleHitsClient.hits", "docstring": "Fetch information about a list of keywords.", "docstring_tokens": ["Fetch", "information", "about", "a", "list", "of", "keywords", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260527}
{"url": "https://github.com/marrabld/planarradpy/blob/5095d1cb98d4f67a7c3108c9282f2d59253e89a8/gui/gui_mainLayout.py#L888-L898", "sha": "5095d1cb98d4f67a7c3108c9282f2d59253e89a8", "docstring_summary": "The following update labels about mouse coordinates.", "language": "python", "parameters": "(self, x, y)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "authorized_display", "==", "True", ":", "try", ":", "arg_0", ".", "display_the_graphic", "(", "arg_0", ".", "num_line", ",", "arg_0", ".", "wavelength", ",", "arg_0", ".", "data_wanted", ",", "arg_0", ".", "information", ")", "arg_0", ".", "ui", ".", "mouse_coordinate", ".", "setText", "(", "\"(%0.3f, %0.3f)\"", "%", "(", "arg_1", ",", "arg_2", ")", ")", "except", ":", "pass"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        The following update labels about mouse coordinates.\n        \"\"\"\n\n        if arg_0.authorized_display == True:\n            try:\n                arg_0.display_the_graphic(arg_0.num_line, arg_0.wavelength, arg_0.data_wanted, arg_0.information)\n                arg_0.ui.mouse_coordinate.setText(\"(%0.3f, %0.3f)\" % (arg_1, arg_2))\n            except:\n                pass", "path": "gui/gui_mainLayout.py", "identifier": "FormEvents.graphic_target", "docstring": "The following update labels about mouse coordinates.", "docstring_tokens": ["The", "following", "update", "labels", "about", "mouse", "coordinates", "."], "nwo": "marrabld/planarradpy", "score": 0.21302904236143622, "idx": 260528}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/segmented.py#L41-L48", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Pauses the thread for a specified time.", "language": "python", "parameters": "(self, time)", "return_statement": "return not self._wait.wait(time)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_Func", "=", "Event", "(", ")", "return", "not", "arg_0", ".", "_Func", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Pauses the thread for a specified time.\n\n        Returns False if interrupted by another thread and True if the\n        time runs out normally.\n        \"\"\"\n        arg_0._Func = Event()\n        return not arg_0._Func.Func(arg_1)", "path": "src/streamlink/stream/segmented.py", "identifier": "SegmentedStreamWorker.wait", "docstring": "Pauses the thread for a specified time.\n\n        Returns False if interrupted by another thread and True if the\n        time runs out normally.", "docstring_tokens": ["Pauses", "the", "thread", "for", "a", "specified", "time", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 260529}
{"url": "https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/sites.py#L31-L41", "sha": "0d3ca09d5bbe808fec12e5f943596570d33a1731", "docstring_summary": "Creates a site", "language": "python", "parameters": "(self, params={})", "return_statement": "return self.site_from_json(data[\"site\"])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "{", "}", ")", ":", "arg_2", "=", "\"/2/sites/\"", "arg_3", "=", "arg_1", "arg_4", "=", "arg_0", ".", "_post_resource", "(", "arg_2", ",", "arg_3", ")", "return", "arg_0", ".", "site_from_json", "(", "arg_4", "[", "\"site\"", "]", ")"], "function": "def Func(arg_0, arg_1={}):\n        \"\"\"\n        Creates a site\n\n        http://dev.wheniwork.com/#create-update-site\n        \"\"\"\n        arg_2 = \"/2/sites/\"\n        arg_3 = arg_1\n\n        arg_4 = arg_0._post_resource(arg_2, arg_3)\n        return arg_0.site_from_json(arg_4[\"site\"])", "path": "uw_wheniwork/sites.py", "identifier": "Sites.create_site", "docstring": "Creates a site\n\n        http://dev.wheniwork.com/#create-update-site", "docstring_tokens": ["Creates", "a", "site"], "nwo": "uw-it-cte/uw-restclients-wheniwork", "score": 0.09252797783733271, "idx": 260530}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L867-L890", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Raises OrderError if no package or file defined.\n        Raises CardinalityError if more than one type set.\n        Raises SPDXValueError if type is unknown.", "language": "python", "parameters": "(self, doc, type_value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "'SOURCE'", ":", "arg_5", ".", "FileType", ".", "SOURCE", ",", "'BINARY'", ":", "arg_5", ".", "FileType", ".", "BINARY", ",", "'ARCHIVE'", ":", "arg_5", ".", "FileType", ".", "ARCHIVE", ",", "'OTHER'", ":", "arg_5", ".", "FileType", ".", "OTHER", "}", "if", "arg_0", ".", "has_package", "(", "arg_1", ")", "and", "arg_0", ".", "has_file", "(", "arg_1", ")", ":", "if", "not", "arg_0", ".", "file_type_set", ":", "arg_0", ".", "file_type_set", "=", "True", "if", "arg_2", "in", "arg_3", ".", "keys", "(", ")", ":", "arg_0", ".", "file", "(", "arg_1", ")", ".", "type", "=", "arg_3", "[", "arg_2", "]", "return", "True", "else", ":", "raise", "SPDXValueError", "(", "'File::Type'", ")", "else", ":", "raise", "CardinalityError", "(", "'File::Type'", ")", "else", ":", "raise", "OrderError", "(", "'File::Type'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Raises OrderError if no package or file defined.\n        Raises CardinalityError if more than one type set.\n        Raises SPDXValueError if type is unknown.\n        \"\"\"\n        arg_3 = {\n            'SOURCE': arg_5.FileType.SOURCE,\n            'BINARY': arg_5.FileType.BINARY,\n            'ARCHIVE': arg_5.FileType.ARCHIVE,\n            'OTHER': arg_5.FileType.OTHER\n        }\n        if arg_0.has_package(arg_1) and arg_0.has_file(arg_1):\n            if not arg_0.file_type_set:\n                arg_0.file_type_set = True\n                if arg_2 in arg_3.keys():\n                    arg_0.file(arg_1).type = arg_3[arg_2]\n                    return True\n                else:\n                    raise SPDXValueError('File::Type')\n            else:\n                raise CardinalityError('File::Type')\n        else:\n            raise OrderError('File::Type')", "path": "spdx/parsers/tagvaluebuilders.py", "identifier": "FileBuilder.set_file_type", "docstring": "Raises OrderError if no package or file defined.\n        Raises CardinalityError if more than one type set.\n        Raises SPDXValueError if type is unknown.", "docstring_tokens": ["Raises", "OrderError", "if", "no", "package", "or", "file", "defined", ".", "Raises", "CardinalityError", "if", "more", "than", "one", "type", "set", ".", "Raises", "SPDXValueError", "if", "type", "is", "unknown", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 260531}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L99-L105", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return datetime object of modified time of machine file. Return now if not a file.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_path", ":", "arg_1", "=", "os", ".", "stat", "(", "arg_0", ".", "_path", ")", "return", "datetime", ".", "utcfromtimestamp", "(", "arg_1", ".", "st_mtime", ")", "else", ":", "return", "datetime", ".", "now", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Return datetime object of modified time of machine file. Return now if not a file.\"\"\"\n        if arg_0._path:\n            arg_1 = os.stat(arg_0._path)\n            return datetime.utcfromtimestamp(arg_1.st_mtime)\n        else:\n            return datetime.now()", "path": "kerncraft/machinemodel.py", "identifier": "MachineModel.get_last_modified_datetime", "docstring": "Return datetime object of modified time of machine file. Return now if not a file.", "docstring_tokens": ["Return", "datetime", "object", "of", "modified", "time", "of", "machine", "file", ".", "Return", "now", "if", "not", "a", "file", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 260532}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/timers/clock.py#L47-L55", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Stop the timer", "language": "python", "parameters": "(self)", "return_statement": "return self.stop_time - self.start_time - self.offset", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "float", ":", "arg_0", ".", "Func_time", "=", "time", ".", "time", "(", ")", "return", "arg_0", ".", "Func_time", "-", "arg_0", ".", "start_time", "-", "arg_0", ".", "offset"], "function": "def Func(arg_0) -> float:\n        \"\"\"\n        Stop the timer\n\n        Returns:\n            The time the timer was Funcped\n        \"\"\"\n        arg_0.Func_time = time.time()\n        return arg_0.Func_time - arg_0.start_time - arg_0.offset", "path": "demosys/timers/clock.py", "identifier": "Timer.stop", "docstring": "Stop the timer\n\n        Returns:\n            The time the timer was stopped", "docstring_tokens": ["Stop", "the", "timer"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 260533}
{"url": "https://github.com/wildfish/argparsetree/blob/424fb13847c4788cad7084233d008d14e17b901c/argparsetree/cmd.py#L89-L93", "sha": "424fb13847c4788cad7084233d008d14e17b901c", "docstring_summary": "Gets the root argument parser object.", "language": "python", "parameters": "(self)", "return_statement": "return self.arg_parse_class(description=self.get_help(), formatter_class=self.get_formatter_class())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "arg_parse_class", "(", "description", "=", "arg_0", ".", "get_help", "(", ")", ",", "formatter_class", "=", "arg_0", ".", "get_formatter_class", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Gets the root argument parser object.\n        \"\"\"\n        return arg_0.arg_parse_class(description=arg_0.get_help(), formatter_class=arg_0.get_formatter_class())", "path": "argparsetree/cmd.py", "identifier": "BaseCommand.get_root_argparser", "docstring": "Gets the root argument parser object.", "docstring_tokens": ["Gets", "the", "root", "argument", "parser", "object", "."], "nwo": "wildfish/argparsetree", "score": 0.12050106452410352, "idx": 260534}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L2135-L2201", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Sets the internal state of the df", "language": "python", "parameters": "(self, state, use_active_range=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_0", ".", "description", "=", "arg_1", "[", "'description'", "]", "if", "arg_2", ":", "arg_0", ".", "_index_start", ",", "arg_0", ".", "_index_end", "=", "arg_1", "[", "'active_range'", "]", "arg_0", ".", "_length_unfiltered", "=", "arg_0", ".", "_index_end", "-", "arg_0", ".", "_index_start", "if", "'renamed_columns'", "in", "arg_1", ":", "for", "arg_7", ",", "arg_8", "in", "arg_1", "[", "'renamed_columns'", "]", ":", "arg_0", ".", "_rename", "(", "arg_7", ",", "arg_8", ")", "for", "arg_9", ",", "arg_10", "in", "arg_1", "[", "'functions'", "]", ".", "items", "(", ")", ":", "arg_0", ".", "add_function", "(", "arg_9", ",", "vaex", ".", "serialize", ".", "from_dict", "(", "arg_10", ")", ")", "if", "'column_names'", "in", "arg_1", ":", "arg_0", ".", "column_names", "=", "[", "]", "arg_0", ".", "virtual_columns", "=", "collections", ".", "OrderedDict", "(", ")", "for", "arg_9", ",", "arg_10", "in", "arg_1", "[", "'virtual_columns'", "]", ".", "items", "(", ")", ":", "arg_0", "[", "arg_9", "]", "=", "arg_0", ".", "_expr", "(", "arg_10", ")", "arg_0", ".", "column_names", "=", "arg_1", "[", "'column_names'", "]", "else", ":", "arg_0", ".", "virtual_columns", "=", "collections", ".", "OrderedDict", "(", ")", "for", "arg_9", ",", "arg_10", "in", "arg_1", "[", "'virtual_columns'", "]", ".", "items", "(", ")", ":", "arg_0", "[", "arg_9", "]", "=", "arg_0", ".", "_expr", "(", "arg_10", ")", "arg_0", ".", "variables", "=", "arg_1", "[", "'variables'", "]", "import", "astropy", "arg_14", "=", "{", "key", ":", "astropy", ".", "units", ".", "Unit", "(", "arg_10", ")", "for", "key", ",", "arg_10", "in", "arg_1", "[", "\"units\"", "]", ".", "items", "(", ")", "}", "arg_0", ".", "units", ".", "update", "(", "arg_14", ")", "for", "arg_9", ",", "arg_15", "in", "arg_1", "[", "'selections'", "]", ".", "items", "(", ")", ":", "if", "arg_15", "is", "None", ":", "arg_16", "=", "None", "else", ":", "arg_16", "=", "selections", ".", "selection_from_dict", "(", "arg_15", ")", "arg_0", ".", "set_selection", "(", "arg_16", ",", "arg_9", "=", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Sets the internal state of the df\n\n        Example:\n\n        >>> import vaex\n        >>> df = vaex.from_scalars(x=1, y=2)\n        >>> df\n          #    x    y        r\n          0    1    2  2.23607\n        >>> df['r'] = (df.x**2 + df.y**2)**0.5\n        >>> state = df.state_get()\n        >>> state\n        {'active_range': [0, 1],\n        'column_names': ['x', 'y', 'r'],\n        'description': None,\n        'descriptions': {},\n        'functions': {},\n        'renamed_columns': [],\n        'selections': {'__filter__': None},\n        'ucds': {},\n        'units': {},\n        'variables': {},\n        'virtual_columns': {'r': '(((x ** 2) + (y ** 2)) ** 0.5)'}}\n        >>> df2 = vaex.from_scalars(x=3, y=4)\n        >>> df2.Func(state)  # now the virtual functions are 'copied'\n        >>> df2\n          #    x    y    r\n          0    3    4    5\n\n        :param state: dict as returned by :meth:`DataFrame.state_get`.\n        :param bool use_active_range: Whether to use the active range or not.\n        \"\"\"\n        arg_0.description = arg_1['description']\n        if arg_2:\n            arg_0._index_start, arg_0._index_end = arg_1['active_range']\n        arg_0._length_unfiltered = arg_0._index_end - arg_0._index_start\n        if 'renamed_columns' in arg_1:\n            for arg_7, arg_8 in arg_1['renamed_columns']:\n                arg_0._rename(arg_7, arg_8)\n        for arg_9, arg_10 in arg_1['functions'].items():\n            arg_0.add_function(arg_9, vaex.serialize.from_dict(arg_10))\n        if 'column_names' in arg_1:\n            # we clear all columns, and add them later on, since otherwise self[name] = ... will try\n            # to rename the columns (which is unsupported for remote dfs)\n            arg_0.column_names = []\n            arg_0.virtual_columns = collections.OrderedDict()\n            for arg_9, arg_10 in arg_1['virtual_columns'].items():\n                arg_0[arg_9] = arg_0._expr(arg_10)\n                # self._save_assign_expression(name)\n            arg_0.column_names = arg_1['column_names']\n        else:\n            # old behaviour\n            arg_0.virtual_columns = collections.OrderedDict()\n            for arg_9, arg_10 in arg_1['virtual_columns'].items():\n                arg_0[arg_9] = arg_0._expr(arg_10)\n        arg_0.variables = arg_1['variables']\n        import astropy  # TODO: make this dep optional?\n        arg_14 = {key: astropy.units.Unit(arg_10) for key, arg_10 in arg_1[\"units\"].items()}\n        arg_0.units.update(arg_14)\n        for arg_9, arg_15 in arg_1['selections'].items():\n            # TODO: make selection use the vaex.serialize framework\n            if arg_15 is None:\n                arg_16 = None\n            else:\n                arg_16 = selections.selection_from_dict(arg_15)\n            arg_0.set_selection(arg_16, arg_9=arg_9)", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.state_set", "docstring": "Sets the internal state of the df\n\n        Example:\n\n        >>> import vaex\n        >>> df = vaex.from_scalars(x=1, y=2)\n        >>> df\n          #    x    y        r\n          0    1    2  2.23607\n        >>> df['r'] = (df.x**2 + df.y**2)**0.5\n        >>> state = df.state_get()\n        >>> state\n        {'active_range': [0, 1],\n        'column_names': ['x', 'y', 'r'],\n        'description': None,\n        'descriptions': {},\n        'functions': {},\n        'renamed_columns': [],\n        'selections': {'__filter__': None},\n        'ucds': {},\n        'units': {},\n        'variables': {},\n        'virtual_columns': {'r': '(((x ** 2) + (y ** 2)) ** 0.5)'}}\n        >>> df2 = vaex.from_scalars(x=3, y=4)\n        >>> df2.state_set(state)  # now the virtual functions are 'copied'\n        >>> df2\n          #    x    y    r\n          0    3    4    5\n\n        :param state: dict as returned by :meth:`DataFrame.state_get`.\n        :param bool use_active_range: Whether to use the active range or not.", "docstring_tokens": ["Sets", "the", "internal", "state", "of", "the", "df"], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 260535}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L568-L601", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Retrieves the current results and updates the model's record in\n    the Model database.", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_getMetrics", "(", ")", "arg_2", "=", "dict", "(", "[", "(", "k", ",", "arg_1", "[", "k", "]", ")", "for", "k", "in", "arg_0", ".", "_reportMetricLabels", "]", ")", "arg_1", "=", "arg_0", ".", "_getMetrics", "(", ")", "arg_3", "=", "dict", "(", ")", "if", "arg_0", ".", "_optimizeKeyPattern", "is", "not", "None", ":", "arg_3", "[", "arg_0", ".", "_optimizedMetricLabel", "]", "=", "arg_1", "[", "arg_0", ".", "_optimizedMetricLabel", "]", "arg_5", "=", "json", ".", "dumps", "(", "(", "arg_1", ",", "arg_3", ")", ")", "arg_0", ".", "_jobsDAO", ".", "modelUpdateResults", "(", "arg_0", ".", "_modelID", ",", "arg_5", "=", "arg_5", ",", "metricValue", "=", "arg_3", ".", "values", "(", ")", "[", "0", "]", ",", "numRecords", "=", "(", "arg_0", ".", "_currentRecordIndex", "+", "1", ")", ")", "arg_0", ".", "_logger", ".", "debug", "(", "\"Model Results: modelID=%s; numRecords=%s; results=%s\"", "%", "(", "arg_0", ".", "_modelID", ",", "arg_0", ".", "_currentRecordIndex", "+", "1", ",", "arg_5", ")", ")", "return"], "function": "def Func(arg_0):\n    \"\"\" Retrieves the current results and updates the model's record in\n    the Model database.\n    \"\"\"\n\n    # -----------------------------------------------------------------------\n    # Get metrics\n    arg_1 = arg_0._getMetrics()\n\n    # -----------------------------------------------------------------------\n    # Extract report metrics that match the requested report REs\n    arg_2 = dict([(k,arg_1[k]) for k in arg_0._reportMetricLabels])\n\n    # -----------------------------------------------------------------------\n    # Extract the report item that matches the optimize key RE\n    # TODO cache optimizedMetricLabel sooner\n    arg_1 = arg_0._getMetrics()\n    arg_3 = dict()\n    if arg_0._optimizeKeyPattern is not None:\n      arg_3[arg_0._optimizedMetricLabel] = \\\n                                      arg_1[arg_0._optimizedMetricLabel]\n\n    # -----------------------------------------------------------------------\n    # Update model results\n    arg_5 = json.dumps((arg_1 , arg_3))\n    arg_0._jobsDAO.modelUpdateResults(arg_0._modelID,  arg_5=arg_5,\n                              metricValue=arg_3.values()[0],\n                              numRecords=(arg_0._currentRecordIndex + 1))\n\n    arg_0._logger.debug(\n      \"Model Results: modelID=%s; numRecords=%s; results=%s\" % \\\n        (arg_0._modelID, arg_0._currentRecordIndex + 1, arg_5))\n\n    return", "path": "src/nupic/swarming/ModelRunner.py", "identifier": "OPFModelRunner._updateModelDBResults", "docstring": "Retrieves the current results and updates the model's record in\n    the Model database.", "docstring_tokens": ["Retrieves", "the", "current", "results", "and", "updates", "the", "model", "s", "record", "in", "the", "Model", "database", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260536}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/multisig/crypto/addresses.py#L68-L92", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Returns the new multisig address.", "language": "python", "parameters": "(self)", "return_statement": "return self._address", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_digests", ":", "raise", "ValueError", "(", "'Must call ``add_digest`` at least once '", "'before calling ``Func``.'", ",", ")", "if", "not", "arg_0", ".", "_address", ":", "arg_1", "=", "[", "0", "]", "*", "HASH_LENGTH", "arg_0", ".", "_sponge", ".", "squeeze", "(", "arg_1", ")", "arg_0", ".", "_address", "=", "MultisigAddress", ".", "from_trits", "(", "arg_1", ",", "digests", "=", "arg_0", ".", "_digests", "[", ":", "]", ",", ")", "return", "arg_0", ".", "_address"], "function": "def Func(arg_0):\n        # type: () -> MultisigAddress\n        \"\"\"\n        Returns the new multisig address.\n\n        Note that you can continue to add digests after extracting an\n        address; the next address will use *all* of the digests that\n        have been added so far.\n        \"\"\"\n        if not arg_0._digests:\n            raise ValueError(\n                'Must call ``add_digest`` at least once '\n                'before calling ``Func``.',\n            )\n\n        if not arg_0._address:\n            arg_1 = [0] * HASH_LENGTH\n            arg_0._sponge.squeeze(arg_1)\n\n            arg_0._address = MultisigAddress.from_trits(\n                arg_1,\n                digests=arg_0._digests[:],\n            )\n\n        return arg_0._address", "path": "iota/multisig/crypto/addresses.py", "identifier": "MultisigAddressBuilder.get_address", "docstring": "Returns the new multisig address.\n\n        Note that you can continue to add digests after extracting an\n        address; the next address will use *all* of the digests that\n        have been added so far.", "docstring_tokens": ["Returns", "the", "new", "multisig", "address", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 260537}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L90-L95", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Like os.makedirs but keeps quiet if path already exists", "language": "python", "parameters": "(path, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "return", "os", ".", "makedirs", "(", "arg_0", ",", "*", "arg_1", ")"], "function": "def Func(arg_0, *arg_1):\n    '''Like os.makedirs but keeps quiet if path already exists'''\n    if os.path.exists(arg_0):\n        return\n\n    os.makedirs(arg_0, *arg_1)", "path": "cpenv/utils.py", "identifier": "ensure_path_exists", "docstring": "Like os.makedirs but keeps quiet if path already exists", "docstring_tokens": ["Like", "os", ".", "makedirs", "but", "keeps", "quiet", "if", "path", "already", "exists"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 260538}
{"url": "https://github.com/Loudr/asana-hub/blob/af996ce890ed23d8ede5bf68dcd318e3438829cb/asana_hub/tool.py#L262-L282", "sha": "af996ce890ed23d8ede5bf68dcd318e3438829cb", "docstring_summary": "Returns task data from local data.", "language": "python", "parameters": "(self, task)", "return_statement": "return _data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "arg_2", "=", "arg_6", "(", "arg_1", ")", "elif", "isinstance", "(", "arg_1", ",", "basestring", ")", ":", "arg_2", "=", "arg_1", "else", ":", "arg_2", "=", "arg_1", "[", "'id'", "]", "arg_3", "=", "arg_0", ".", "_task_data_key", "(", ")", "arg_4", "=", "arg_0", ".", "data", ".", "get", "(", "arg_3", ",", "{", "}", ")", "arg_5", "=", "arg_4", ".", "get", "(", "arg_6", "(", "arg_2", ")", ",", "{", "}", ")", "arg_4", "[", "arg_6", "(", "arg_2", ")", "]", "=", "arg_5", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Returns task data from local data.\n\n        Args:\n            task:\n                `int`. Asana task number.\n        \"\"\"\n\n        if isinstance(arg_1, int):\n            arg_2 = arg_6(arg_1)\n        elif isinstance(arg_1, basestring):\n            arg_2 = arg_1\n        else:\n            arg_2 = arg_1['id']\n\n        arg_3 = arg_0._task_data_key()\n        arg_4 = arg_0.data.get(arg_3, {})\n\n        arg_5 = arg_4.get(arg_6(arg_2), {})\n        arg_4[arg_6(arg_2)] = arg_5\n        return arg_5", "path": "asana_hub/tool.py", "identifier": "ToolApp.get_saved_task_data", "docstring": "Returns task data from local data.\n\n        Args:\n            task:\n                `int`. Asana task number.", "docstring_tokens": ["Returns", "task", "data", "from", "local", "data", "."], "nwo": "Loudr/asana-hub", "score": 0.27692002097430746, "idx": 260539}
{"url": "https://github.com/adamcharnock/seed/blob/48232a2497bd94c5e1466a5b33a929f253ab5112/seed/commands/__init__.py#L83-L143", "sha": "48232a2497bd94c5e1466a5b33a929f253ab5112", "docstring_summary": "Determine paths automatically and a little intelligently", "language": "python", "parameters": "(self, package_name=None, create_package_dir=False, dry_run=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "arg_0", ".", "project_dir", "=", "Path", "(", "os", ".", "getenv", "(", "'PWD'", ")", "or", "os", ".", "getcwd", "(", ")", ")", "arg_5", "=", "arg_0", ".", "get_distribution", "(", ")", "if", "arg_5", ":", "arg_0", ".", "project_name", "=", "arg_5", ".", "get_name", "(", ")", "else", ":", "arg_0", ".", "project_name", "=", "arg_0", ".", "project_dir", ".", "name", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ".", "project_dir", "/", "\"src\"", ")", ":", "arg_7", "=", "arg_0", ".", "project_dir", "/", "\"src\"", "else", ":", "arg_7", "=", "arg_0", ".", "project_dir", "arg_8", "=", "False", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "project_name", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "def", "get_matches", "(", "arg_9", ")", ":", "arg_10", "=", "[", "n", "for", "n", "in", "os", ".", "listdir", "(", "arg_7", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_7", "/", "n", ")", "]", "return", "difflib", ".", "get_close_matches", "(", "arg_9", ",", "arg_10", ",", "n", "=", "1", ",", "cutoff", "=", "0.8", ")", "arg_11", "=", "get_matches", "(", "arg_1", ")", "if", "not", "arg_11", "and", "\"_\"", "in", "arg_1", ":", "arg_12", "=", "\"_\"", ".", "join", "(", "arg_1", ".", "split", "(", "\"_\"", ")", "[", "1", ":", "]", ")", "arg_11", "=", "get_matches", "(", "arg_12", ")", "if", "not", "arg_11", ":", "if", "arg_2", ":", "arg_13", "=", "arg_7", "/", "arg_1", "arg_8", "=", "True", "if", "not", "arg_3", ":", "print", "(", "\"Creating package directory at %s\"", "%", "arg_13", ")", "os", ".", "mkdir", "(", "arg_13", ")", "else", ":", "print", "(", "\"Would have created package directory at %s\"", "%", "arg_13", ")", "else", ":", "raise", "CommandError", "(", "\"Could not guess the package name. Specify it using --name.\"", ")", "else", ":", "arg_1", "=", "arg_11", "[", "0", "]", "arg_0", ".", "package_name", "=", "arg_1", "arg_0", ".", "package_dir", "=", "arg_7", "/", "arg_1", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "package_dir", ")", "and", "not", "arg_8", ":", "raise", "CommandError", "(", "\"Package directory did not exist at %s. Perhaps specify it using --name\"", "%", "arg_0", ".", "package_dir", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=False):\n        \"\"\"Determine paths automatically and a little intelligently\"\"\"\n        \n        # Give preference to the environment variable here as it will not \n        # derefrence sym links\n        arg_0.project_dir = Path(os.getenv('PWD') or os.getcwd())\n        \n        # Try and work out the project name\n        arg_5 = arg_0.get_distribution()\n        if arg_5:\n            # Get name from setup.py\n            arg_0.project_name = arg_5.get_name()\n        else:\n            # ...failing that, use the current directory name\n            arg_0.project_name = arg_0.project_dir.name\n        \n        # Descend into the 'src' directory to find the package \n        # if necessary\n        if os.path.isdir(arg_0.project_dir / \"src\"):\n            arg_7 = arg_0.project_dir / \"src\"\n        else:\n            arg_7 = arg_0.project_dir\n\n        arg_8 = False\n        if not arg_1:\n            # Lets try and work out the package_name from the project_name\n            arg_1 = arg_0.project_name.replace(\"-\", \"_\")\n            \n            # Now do some fuzzy matching\n            def get_matches(arg_9):\n                arg_10 = [n for n in os.listdir(arg_7) if os.path.isdir(arg_7 / n)]\n                return difflib.get_close_matches(arg_9, arg_10, n=1, cutoff=0.8)\n            \n            arg_11 = get_matches(arg_1)\n            \n            # If no matches, try removing the first part of the package name\n            # (e.g. django-guardian becomes guardian)\n            if not arg_11 and \"_\" in arg_1:\n                arg_12 = \"_\".join(arg_1.split(\"_\")[1:])\n                arg_11 = get_matches(arg_12)\n            \n            if not arg_11:\n                if arg_2:\n                    arg_13 = arg_7 / arg_1\n                    # Gets set to true even during dry run\n                    arg_8 = True\n                    if not arg_3:\n                        print(\"Creating package directory at %s\" % arg_13)\n                        os.mkdir(arg_13)\n                    else:\n                        print(\"Would have created package directory at %s\" % arg_13)\n                else:\n                    raise CommandError(\"Could not guess the package name. Specify it using --name.\")\n            else:\n                arg_1 = arg_11[0]\n        \n        arg_0.package_name = arg_1\n        arg_0.package_dir = arg_7 / arg_1\n\n        if not os.path.exists(arg_0.package_dir) and not arg_8:\n            raise CommandError(\"Package directory did not exist at %s. Perhaps specify it using --name\" % arg_0.package_dir)", "path": "seed/commands/__init__.py", "identifier": "Command.determine_paths", "docstring": "Determine paths automatically and a little intelligently", "docstring_tokens": ["Determine", "paths", "automatically", "and", "a", "little", "intelligently"], "nwo": "adamcharnock/seed", "score": 0.31099946390020666, "idx": 260540}
{"url": "https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/catalog.py#L187-L192", "sha": "532f561f32b91ea8debea0573c503dd20988bf40", "docstring_summary": "obtain the shory geoserver version", "language": "python", "parameters": "(self)", "return_statement": "return match.sub('', gs_version).strip('.')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_version", "(", ")", "arg_2", "=", "re", ".", "compile", "(", "r'[^\\d.]+'", ")", "return", "arg_2", ".", "sub", "(", "''", ",", "arg_1", ")", ".", "strip", "(", "'.'", ")"], "function": "def Func(arg_0):\n        '''obtain the shory geoserver version\n        '''\n        arg_1 = arg_0.get_version()\n        arg_2 = re.compile(r'[^\\d.]+')\n        return arg_2.sub('', arg_1).strip('.')", "path": "src/geoserver/catalog.py", "identifier": "Catalog.get_short_version", "docstring": "obtain the shory geoserver version", "docstring_tokens": ["obtain", "the", "shory", "geoserver", "version"], "nwo": "boundlessgeo/gsconfig", "score": 0.7627023200281134, "idx": 260541}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L263-L270", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Disable event loop integration with PyQt4.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_apps", ".", "has_key", "(", "arg_2", ")", ":", "arg_0", ".", "_apps", "[", "arg_2", "]", ".", "_in_event_loop", "=", "False", "arg_0", ".", "clear_inputhook", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Disable event loop integration with PyQt4.\n\n        This merely sets PyOS_InputHook to NULL.\n        \"\"\"\n        if arg_0._apps.has_key(arg_2):\n            arg_0._apps[arg_2]._in_event_loop = False\n        arg_0.clear_inputhook()", "path": "environment/lib/python2.7/site-packages/IPython/lib/inputhook.py", "identifier": "InputHookManager.disable_qt4", "docstring": "Disable event loop integration with PyQt4.\n\n        This merely sets PyOS_InputHook to NULL.", "docstring_tokens": ["Disable", "event", "loop", "integration", "with", "PyQt4", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260542}
{"url": "https://github.com/pypa/pep517/blob/ecd511e8fc85251d0496716939ebbe109e395924/pep517/_in_process.py#L48-L73", "sha": "ecd511e8fc85251d0496716939ebbe109e395924", "docstring_summary": "Find and load the build backend", "language": "python", "parameters": "()", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "os", ".", "environ", ".", "get", "(", "'PEP517_BACKEND_PATH'", ")", "if", "arg_0", ":", "arg_1", "=", "arg_0", ".", "split", "(", "os", ".", "pathsep", ")", "arg_2", ".", "path", "[", ":", "0", "]", "=", "arg_1", "arg_4", "=", "os", ".", "environ", "[", "'PEP517_BUILD_BACKEND'", "]", "arg_5", ",", "arg_6", ",", "arg_7", "=", "arg_4", ".", "partition", "(", "':'", ")", "try", ":", "arg_8", "=", "import_module", "(", "arg_5", ")", "except", "ImportError", ":", "raise", "BackendUnavailable", "(", "traceback", ".", "format_exc", "(", ")", ")", "if", "arg_0", ":", "if", "not", "any", "(", "contained_in", "(", "arg_8", ".", "__file__", ",", "arg_3", ")", "for", "arg_3", "in", "arg_1", ")", ":", "raise", "BackendInvalid", "(", "\"Backend was not loaded from backend-path\"", ")", "if", "arg_7", ":", "for", "arg_9", "in", "arg_7", ".", "split", "(", "'.'", ")", ":", "arg_8", "=", "getattr", "(", "arg_8", ",", "arg_9", ")", "return", "arg_8"], "function": "def Func():\n    \"\"\"Find and load the build backend\"\"\"\n    # Add in-tree backend directories to the front of sys.path.\n    arg_0 = os.environ.get('PEP517_BACKEND_PATH')\n    if arg_0:\n        arg_1 = arg_0.split(os.pathsep)\n        arg_2.path[:0] = arg_1\n\n    arg_4 = os.environ['PEP517_BUILD_BACKEND']\n    arg_5, arg_6, arg_7 = arg_4.partition(':')\n    try:\n        arg_8 = import_module(arg_5)\n    except ImportError:\n        raise BackendUnavailable(traceback.format_exc())\n\n    if arg_0:\n        if not any(\n            contained_in(arg_8.__file__, arg_3)\n            for arg_3 in arg_1\n        ):\n            raise BackendInvalid(\"Backend was not loaded from backend-path\")\n\n    if arg_7:\n        for arg_9 in arg_7.split('.'):\n            arg_8 = getattr(arg_8, arg_9)\n    return arg_8", "path": "pep517/_in_process.py", "identifier": "_build_backend", "docstring": "Find and load the build backend", "docstring_tokens": ["Find", "and", "load", "the", "build", "backend"], "nwo": "pypa/pep517", "score": 0.5466648575129843, "idx": 260543}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/registry.py#L203-L239", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Discover versatileimagefield.py modules.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "from", "importlib", "import", "import_module", "from", "django", ".", "apps", "import", "apps", "from", "django", ".", "utils", ".", "module_loading", "import", "module_has_submodule", "for", "arg_0", "in", "apps", ".", "get_app_configs", "(", ")", ":", "try", ":", "arg_1", "=", "copy", ".", "copy", "(", "arg_3", ".", "_sizedimage_registry", ")", "arg_2", "=", "copy", ".", "copy", "(", "arg_3", ".", "_filter_registry", ")", "import_module", "(", "'%s.versatileimagefield'", "%", "arg_0", ".", "name", ")", "except", "Exception", ":", "arg_3", ".", "_sizedimage_registry", "=", "arg_1", "arg_3", ".", "_filter_registry", "=", "arg_2", "if", "module_has_submodule", "(", "arg_0", ".", "module", ",", "'versatileimagefield'", ")", ":", "raise"], "function": "def Func():\n    \"\"\"\n    Discover versatileimagefield.py modules.\n\n    Iterate over django.apps.get_app_configs() and discover\n    versatileimagefield.py modules.\n    \"\"\"\n    from importlib import import_module\n    from django.apps import apps\n    from django.utils.module_loading import module_has_submodule\n\n    for arg_0 in apps.get_app_configs():\n        # Attempt to import the app's module.\n\n        try:\n            arg_1 = copy.copy(\n                arg_3._sizedimage_registry\n            )\n            arg_2 = copy.copy(\n                arg_3._filter_registry\n            )\n            import_module('%s.versatileimagefield' % arg_0.name)\n        except Exception:\n            # Reset the versatileimagefield_registry to the state before the\n            # last import as this import will have to reoccur on the next\n            # request and this could raise NotRegistered and AlreadyRegistered\n            # exceptions (see django ticket #8245).\n            arg_3._sizedimage_registry = \\\n                arg_1\n            arg_3._filter_registry = \\\n                arg_2\n\n            # Decide whether to bubble up this error. If the app just\n            # doesn't have the module in question, we can ignore the error\n            # attempting to import it, otherwise we want it to bubble up.\n            if module_has_submodule(arg_0.module, 'versatileimagefield'):\n                raise", "path": "versatileimagefield/registry.py", "identifier": "autodiscover", "docstring": "Discover versatileimagefield.py modules.\n\n    Iterate over django.apps.get_app_configs() and discover\n    versatileimagefield.py modules.", "docstring_tokens": ["Discover", "versatileimagefield", ".", "py", "modules", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 260544}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/github/util.py#L6-L89", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "A helper function to look up license object information", "language": "python", "parameters": "(license)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "if", "arg_0", "in", "(", "'MIT'", ",", "'MIT License'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/mit'", ",", "'name'", ":", "'MIT'", "}", "elif", "arg_0", "in", "(", "'BSD 2-clause \"Simplified\" License'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/bsd-2-clause'", ",", "'name'", ":", "'BSD-2-Clause'", "}", "elif", "arg_0", "in", "(", "'BSD 3-clause \"New\" or \"Revised\" License'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/bsd-3-clause'", ",", "'name'", ":", "'BSD-3-Clause'", "}", "elif", "arg_0", "in", "(", "'Apache License 2.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/apache-2.0'", ",", "'name'", ":", "'Apache-2.0'", "}", "elif", "arg_0", "in", "(", "'GNU General Public License v2.1'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/gpl-2.1'", ",", "'name'", ":", "'GPL-2.1'", "}", "elif", "arg_0", "in", "(", "'GNU General Public License v2.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/gpl-2.0'", ",", "'name'", ":", "'GPL-2.0'", "}", "elif", "arg_0", "in", "(", "'GNU Lesser General Public License v2.1'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/lgpl-2.1'", ",", "'name'", ":", "'LGPL-2.1'", "}", "elif", "arg_0", "in", "(", "'GNU General Public License v3.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/gpl-3.0'", ",", "'name'", ":", "'GPL-3.0'", "}", "elif", "arg_0", "in", "(", "'GNU Lesser General Public License v3.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/lgpl-3.0'", ",", "'name'", ":", "'LGPL-3.0'", "}", "elif", "arg_0", "in", "(", "'Eclipse Public License 1.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/epl-1.0'", ",", "'name'", ":", "'EPL-1.0'", ",", "}", "elif", "arg_0", "in", "(", "'Mozilla Public License 2.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/mpl-2.0'", ",", "'name'", ":", "'MPL-2.0'", ",", "}", "elif", "arg_0", "in", "(", "'The Unlicense'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/unlicense'", ",", "'name'", ":", "'Unlicense'", ",", "}", "elif", "arg_0", "in", "(", "'GNU Affero General Public License v3.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/agpl-3.0'", ",", "'name'", ":", "'AGPL-3.0'", ",", "}", "elif", "arg_0", "in", "(", "'Eclipse Public License 2.0'", ")", ":", "arg_1", "=", "{", "'URL'", ":", "'https://api.github.com/licenses/epl-2.0'", ",", "'name'", ":", "'EPL-2.0'", ",", "}", "if", "arg_1", "is", "None", ":", "logger", ".", "warn", "(", "'I dont understand the license: %s'", ",", "arg_0", ")", "raise", "ValueError", "(", "'Aborting!'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    A helper function to look up license object information\n\n    Use names from: https://api.github.com/licenses\n    \"\"\"\n    arg_1 = None\n\n    if arg_0 in ('MIT', 'MIT License'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/mit',\n            'name': 'MIT'\n        }\n    elif arg_0 in ('BSD 2-clause \"Simplified\" License'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/bsd-2-clause',\n            'name': 'BSD-2-Clause'\n        }\n    elif arg_0 in ('BSD 3-clause \"New\" or \"Revised\" License'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/bsd-3-clause',\n            'name': 'BSD-3-Clause'\n        }\n    elif arg_0 in ('Apache License 2.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/apache-2.0',\n            'name': 'Apache-2.0'\n        }\n    elif arg_0 in ('GNU General Public License v2.1'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/gpl-2.1',\n            'name': 'GPL-2.1'\n        }\n    elif arg_0 in ('GNU General Public License v2.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/gpl-2.0',\n            'name': 'GPL-2.0'\n        }\n    elif arg_0 in ('GNU Lesser General Public License v2.1'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/lgpl-2.1',\n            'name': 'LGPL-2.1'\n        }\n    elif arg_0 in ('GNU General Public License v3.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/gpl-3.0',\n            'name': 'GPL-3.0'\n        }\n    elif arg_0 in ('GNU Lesser General Public License v3.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/lgpl-3.0',\n            'name': 'LGPL-3.0'\n        }\n    elif arg_0 in ('Eclipse Public License 1.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/epl-1.0',\n            'name': 'EPL-1.0',\n        }\n    elif arg_0 in ('Mozilla Public License 2.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/mpl-2.0',\n            'name': 'MPL-2.0',\n        }\n    elif arg_0 in ('The Unlicense'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/unlicense',\n            'name': 'Unlicense',\n        }\n    elif arg_0 in ('GNU Affero General Public License v3.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/agpl-3.0',\n            'name': 'AGPL-3.0',\n        }\n    elif arg_0 in ('Eclipse Public License 2.0'):\n        arg_1 = {\n            'URL': 'https://api.github.com/licenses/epl-2.0',\n            'name': 'EPL-2.0',\n        }\n\n    if arg_1 is None:\n        logger.warn('I dont understand the license: %s', arg_0)\n        raise ValueError('Aborting!')\n\n    return arg_1", "path": "scraper/github/util.py", "identifier": "_license_obj", "docstring": "A helper function to look up license object information\n\n    Use names from: https://api.github.com/licenses", "docstring_tokens": ["A", "helper", "function", "to", "look", "up", "license", "object", "information"], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 260545}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdfbuilders.py#L218-L229", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Sets the package verification code, if not already set.\n        code - A string.\n        Raises CardinalityError if already defined.\n        Raises OrderError if no package previously defined.", "language": "python", "parameters": "(self, doc, code)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "assert_package_exists", "(", ")", "if", "not", "arg_0", ".", "package_verif_set", ":", "arg_0", ".", "package_verif_set", "=", "True", "arg_1", ".", "package", ".", "verif_code", "=", "arg_2", "else", ":", "raise", "CardinalityError", "(", "'Package::VerificationCode'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Sets the package verification code, if not already set.\n        code - A string.\n        Raises CardinalityError if already defined.\n        Raises OrderError if no package previously defined.\n        \"\"\"\n        arg_0.assert_package_exists()\n        if not arg_0.package_verif_set:\n            arg_0.package_verif_set = True\n            arg_1.package.verif_code = arg_2\n        else:\n            raise CardinalityError('Package::VerificationCode')", "path": "spdx/parsers/rdfbuilders.py", "identifier": "PackageBuilder.set_pkg_verif_code", "docstring": "Sets the package verification code, if not already set.\n        code - A string.\n        Raises CardinalityError if already defined.\n        Raises OrderError if no package previously defined.", "docstring_tokens": ["Sets", "the", "package", "verification", "code", "if", "not", "already", "set", ".", "code", "-", "A", "string", ".", "Raises", "CardinalityError", "if", "already", "defined", ".", "Raises", "OrderError", "if", "no", "package", "previously", "defined", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 260546}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/transportphenomena/dimensionlessquantities.py#L66-L77", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the Reynolds number.", "language": "python", "parameters": "(L: float, v: float, nu: float)", "return_statement": "return v * L / nu", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ",", "arg_3", ":", "arg_1", ")", "->", "arg_1", ":", "return", "arg_2", "*", "arg_0", "/", "arg_3"], "function": "def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1) -> arg_1:\n    \"\"\"\n    Calculate the Funcynolds number.\n\n    :param L: [m] surface characteristic length.\n    :param v: [m/s] fluid velocity relative to the object.\n    :param nu: [m2/s] fluid kinematic viscosity.\n\n    :returns: float\n    \"\"\"\n\n    return arg_2 * arg_0 / arg_3", "path": "auxi/tools/transportphenomena/dimensionlessquantities.py", "identifier": "Re", "docstring": "Calculate the Reynolds number.\n\n    :param L: [m] surface characteristic length.\n    :param v: [m/s] fluid velocity relative to the object.\n    :param nu: [m2/s] fluid kinematic viscosity.\n\n    :returns: float", "docstring_tokens": ["Calculate", "the", "Reynolds", "number", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 260547}
{"url": "https://github.com/bkg/greenwich/blob/57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141/greenwich/raster.py#L497-L516", "sha": "57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141", "docstring_summary": "Derive new Raster instances.", "language": "python", "parameters": "(self, size=(), affine=None)", "return_statement": "return rcopy", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", ")", ",", "arg_2", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "arg_0", ".", "size", "+", "(", "len", "(", "arg_0", ")", ",", ")", "arg_3", "=", "arg_0", ".", "ds", ".", "GetRasterBand", "(", "1", ")", "arg_4", "=", "ImageDriver", "(", "'MEM'", ")", "arg_5", "=", "arg_4", ".", "raster", "(", "arg_4", ".", "ShortName", ",", "arg_1", ",", "arg_3", ".", "DataType", ")", "arg_5", ".", "sref", "=", "arg_0", ".", "GetProjection", "(", ")", "arg_5", ".", "affine", "=", "arg_2", "or", "tuple", "(", "arg_0", ".", "affine", ")", "arg_7", "=", "arg_3", ".", "GetColorTable", "(", ")", "for", "arg_8", "in", "arg_5", ":", "if", "arg_0", ".", "nodata", "is", "not", "None", ":", "arg_8", ".", "SetNoDataValue", "(", "arg_0", ".", "nodata", ")", "if", "arg_7", ":", "arg_8", ".", "SetColorTable", "(", "arg_7", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=(), arg_2=None):\n        \"\"\"Derive Func Raster instances.\n\n        Keyword args:\n        size -- tuple of image size (width, height)\n        affine -- AffineTransform or six-tuple of geotransformation values\n        \"\"\"\n        arg_1 = arg_1 or arg_0.size + (len(arg_0),)\n        arg_3 = arg_0.ds.GetRasterBand(1)\n        arg_4 = ImageDriver('MEM')\n        arg_5 = arg_4.raster(arg_4.ShortName, arg_1, arg_3.DataType)\n        arg_5.sref = arg_0.GetProjection()\n        arg_5.affine = arg_2 or tuple(arg_0.affine)\n        arg_7 = arg_3.GetColorTable()\n        for arg_8 in arg_5:\n            if arg_0.nodata is not None:\n                arg_8.SetNoDataValue(arg_0.nodata)\n            if arg_7:\n                arg_8.SetColorTable(arg_7)\n        return arg_5", "path": "greenwich/raster.py", "identifier": "Raster.new", "docstring": "Derive new Raster instances.\n\n        Keyword args:\n        size -- tuple of image size (width, height)\n        affine -- AffineTransform or six-tuple of geotransformation values", "docstring_tokens": ["Derive", "new", "Raster", "instances", "."], "nwo": "bkg/greenwich", "score": 0.15726537023232431, "idx": 260548}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/mashscreen2json.py#L46-L124", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "converts top results from mash screen txt output to json format", "language": "python", "parameters": "(mash_output, sample_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "info", "(", "\"Reading file : {}\"", ".", "format", "(", "arg_0", ")", ")", "arg_2", "=", "open", "(", "arg_0", ")", "arg_3", "=", "{", "}", "arg_4", "=", "[", "]", "arg_5", "=", "{", "}", "logger", ".", "info", "(", "\"Generating dictionary and list to pre-process the final json\"", ")", "for", "arg_6", "in", "arg_2", ":", "arg_7", "=", "arg_6", ".", "split", "(", "\"\\t\"", ")", "arg_8", "=", "arg_7", "[", "0", "]", "arg_9", "=", "arg_7", "[", "2", "]", "arg_10", "=", "arg_7", "[", "4", "]", "arg_3", "[", "arg_10", "]", "=", "[", "arg_8", ",", "arg_9", "]", "arg_4", ".", "append", "(", "float", "(", "arg_9", ")", ")", "arg_11", "=", "open", "(", "\" \"", ".", "join", "(", "arg_0", ".", "split", "(", "\".\"", ")", "[", ":", "-", "1", "]", ")", "+", "\".json\"", ",", "\"w\"", ")", "if", "len", "(", "arg_4", ")", ">", "0", ":", "arg_12", "=", "median", "(", "arg_4", ")", "logger", ".", "info", "(", "\"Generating final json to dump to a file\"", ")", "for", "arg_13", ",", "arg_14", "in", "arg_3", ".", "items", "(", ")", ":", "arg_15", "=", "int", "(", "float", "(", "arg_14", "[", "1", "]", ")", "/", "arg_12", ")", "if", "float", "(", "arg_14", "[", "1", "]", ")", ">", "arg_12", ":", "arg_5", "[", "\"_\"", ".", "join", "(", "arg_13", ".", "split", "(", "\"_\"", ")", "[", "0", ":", "3", "]", ")", "]", "=", "[", "round", "(", "float", "(", "arg_14", "[", "0", "]", ")", ",", "2", ")", ",", "arg_15", "]", "logger", ".", "info", "(", "\"Exported dictionary has {} entries\"", ".", "format", "(", "len", "(", "arg_5", ")", ")", ")", "else", ":", "logger", ".", "error", "(", "\"No matches were found using mash screen for the queried reads\"", ")", "arg_11", ".", "write", "(", "json", ".", "dumps", "(", "arg_5", ")", ")", "arg_11", ".", "close", "(", ")", "arg_18", "=", "{", "\"tableRow\"", ":", "[", "{", "\"sample\"", ":", "arg_1", ",", "\"data\"", ":", "[", "{", "\"header\"", ":", "\"Mash Screen\"", ",", "\"table\"", ":", "\"plasmids\"", ",", "\"patlas_mashscreen\"", ":", "arg_5", ",", "\"value\"", ":", "len", "(", "arg_5", ")", "}", "]", "}", "]", ",", "}", "with", "open", "(", "\".report.json\"", ",", "\"w\"", ")", "as", "json_report", ":", "json_report", ".", "write", "(", "json", ".", "dumps", "(", "arg_18", ",", "separators", "=", "(", "\",\"", ",", "\":\"", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    converts top results from mash screen txt output to json format\n\n    Parameters\n    ----------\n    mash_output: str\n        this is a string that stores the path to this file, i.e, the name of\n        the file\n    sample_id: str\n        sample name\n\n    '''\n    logger.info(\"Reading file : {}\".format(arg_0))\n    arg_2 = open(arg_0)\n\n    arg_3 = {}\n    arg_4 = []\n    arg_5 = {}\n\n    logger.info(\"Generating dictionary and list to pre-process the final json\")\n    for arg_6 in arg_2:\n        arg_7 = arg_6.split(\"\\t\")\n        arg_8 = arg_7[0]\n        # shared_hashes = tab_split[1]\n        arg_9 = arg_7[2]\n        # p_value = tab_split[3]\n        arg_10 = arg_7[4]\n        # query-comment should not exist here and it is irrelevant\n\n        # here identity is what in fact interests to report to json but\n        # median_multiplicity also is important since it gives an rough\n        # estimation of the coverage depth for each plasmid.\n        # Plasmids should have higher coverage depth due to their increased\n        # copy number in relation to the chromosome.\n        arg_3[arg_10] = [arg_8, arg_9]\n        arg_4.append(float(arg_9))\n\n    arg_11 = open(\" \".join(arg_0.split(\".\")[:-1]) + \".json\", \"w\")\n\n    # median cutoff is twice the median of all median_multiplicity values\n    # reported by mash screen. In the case of plasmids, since the database\n    # has 9k entries and reads shouldn't have that many sequences it seems ok...\n    if len(arg_4) > 0:\n        # this statement assures that median_list has indeed any entries\n        arg_12 = median(arg_4)\n        logger.info(\"Generating final json to dump to a file\")\n        for arg_13, arg_14 in arg_3.items():\n            # estimated copy number\n            arg_15 = int(float(arg_14[1]) / arg_12)\n            # assure that plasmid as at least twice the median coverage depth\n            if float(arg_14[1]) > arg_12:\n                arg_5[\"_\".join(arg_13.split(\"_\")[0:3])] = [\n                    round(float(arg_14[0]),2),\n                    arg_15\n                ]\n        logger.info(\n            \"Exported dictionary has {} entries\".format(len(arg_5)))\n    else:\n        # if no entries were found raise an error\n        logger.error(\"No matches were found using mash screen for the queried reads\")\n\n    arg_11.write(json.dumps(arg_5))\n    arg_11.close()\n\n    arg_18 = {\n        \"tableRow\": [{\n            \"sample\": arg_1,\n            \"data\": [{\n                \"header\": \"Mash Screen\",\n                \"table\": \"plasmids\",\n                \"patlas_mashscreen\": arg_5,\n                \"value\": len(arg_5)\n            }]\n        }],\n    }\n\n    with open(\".report.json\", \"w\") as json_report:\n        json_report.write(json.dumps(arg_18, separators=(\",\", \":\")))", "path": "flowcraft/templates/mashscreen2json.py", "identifier": "main", "docstring": "converts top results from mash screen txt output to json format\n\n    Parameters\n    ----------\n    mash_output: str\n        this is a string that stores the path to this file, i.e, the name of\n        the file\n    sample_id: str\n        sample name", "docstring_tokens": ["converts", "top", "results", "from", "mash", "screen", "txt", "output", "to", "json", "format"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 260549}
{"url": "https://github.com/georgemarshall/django-cryptography/blob/4c5f60fec98bcf71495d6084f801ea9c01c9a725/django_cryptography/core/signing.py#L212-L241", "sha": "4c5f60fec98bcf71495d6084f801ea9c01c9a725", "docstring_summary": "Retrieve original value and check it wasn't signed more\n        than max_age seconds ago.", "language": "python", "parameters": "(self, signed_value, ttl=None)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", ",", "arg_4", "=", "struct", ".", "calcsize", "(", "'>cQ'", ")", ",", "arg_0", ".", "digest", ".", "digest_size", "arg_5", "=", "'>cQ%ds%ds'", "%", "(", "len", "(", "arg_1", ")", "-", "arg_3", "-", "arg_4", ",", "arg_4", ")", "try", ":", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "=", "struct", ".", "unpack", "(", "arg_5", ",", "arg_1", ")", "except", "struct", ".", "error", ":", "raise", "BadSignature", "(", "'Signature is not valid'", ")", "if", "arg_6", "!=", "arg_0", ".", "version", ":", "raise", "BadSignature", "(", "'Signature version not supported'", ")", "if", "arg_2", "is", "not", "None", ":", "if", "isinstance", "(", "arg_2", ",", "datetime", ".", "timedelta", ")", ":", "arg_2", "=", "arg_2", ".", "total_seconds", "(", ")", "arg_10", "=", "abs", "(", "time", ".", "time", "(", ")", "-", "arg_7", ")", "if", "arg_10", ">", "arg_2", "+", "_MAX_CLOCK_SKEW", ":", "raise", "SignatureExpired", "(", "'Signature age %s > %s seconds'", "%", "(", "arg_10", ",", "arg_2", ")", ")", "try", ":", "arg_0", ".", "signature", "(", "arg_1", "[", ":", "-", "arg_4", "]", ")", ".", "verify", "(", "arg_9", ")", "except", "InvalidSignature", ":", "raise", "BadSignature", "(", "'Signature \"%s\" does not match'", "%", "binascii", ".", "b2a_base64", "(", "arg_9", ")", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Retrieve original value and check it wasn't signed more\n        than max_age seconds ago.\n\n        :type signed_value: bytes\n        :type ttl: int | datetime.timedelta\n        \"\"\"\n        arg_3, arg_4 = struct.calcsize('>cQ'), arg_0.digest.digest_size\n        arg_5 = '>cQ%ds%ds' % (len(arg_1) - arg_3 - arg_4, arg_4)\n        try:\n            arg_6, arg_7, arg_8, arg_9 = struct.unpack(arg_5, arg_1)\n        except struct.error:\n            raise BadSignature('Signature is not valid')\n        if arg_6 != arg_0.version:\n            raise BadSignature('Signature version not supported')\n        if arg_2 is not None:\n            if isinstance(arg_2, datetime.timedelta):\n                arg_2 = arg_2.total_seconds()\n            # Check timestamp is not older than ttl\n            arg_10 = abs(time.time() - arg_7)\n            if arg_10 > arg_2 + _MAX_CLOCK_SKEW:\n                raise SignatureExpired('Signature age %s > %s seconds' % (arg_10,\n                                                                          arg_2))\n        try:\n            arg_0.signature(arg_1[:-arg_4]).verify(arg_9)\n        except InvalidSignature:\n            raise BadSignature(\n                'Signature \"%s\" does not match' % binascii.b2a_base64(arg_9))\n        return arg_8", "path": "django_cryptography/core/signing.py", "identifier": "FernetSigner.unsign", "docstring": "Retrieve original value and check it wasn't signed more\n        than max_age seconds ago.\n\n        :type signed_value: bytes\n        :type ttl: int | datetime.timedelta", "docstring_tokens": ["Retrieve", "original", "value", "and", "check", "it", "wasn", "t", "signed", "more", "than", "max_age", "seconds", "ago", "."], "nwo": "georgemarshall/django-cryptography", "score": 0.32069767954003625, "idx": 260550}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L185-L200", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Sets a version to be the default. Blocks until finished.", "language": "python", "parameters": "(self, project_id, model_name, version_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "'projects/{}/models/{}/versions/{}'", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "_mlengine", ".", "projects", "(", ")", ".", "models", "(", ")", ".", "versions", "(", ")", ".", "setDefault", "(", "name", "=", "arg_4", ",", "body", "=", "{", "}", ")", "try", ":", "arg_6", "=", "arg_5", ".", "execute", "(", ")", "arg_0", ".", "log", ".", "info", "(", "'Successfully set version: %s to default'", ",", "arg_6", ")", "return", "arg_6", "except", "HttpError", "as", "e", ":", "arg_0", ".", "log", ".", "error", "(", "'Something went wrong: %s'", ",", "e", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Sets a version to be the default. Blocks until finished.\n        \"\"\"\n        arg_4 = 'projects/{}/models/{}/versions/{}'.format(\n            arg_1, arg_2, arg_3)\n        arg_5 = arg_0._mlengine.projects().models().versions().setDefault(\n            name=arg_4, body={})\n\n        try:\n            arg_6 = arg_5.execute()\n            arg_0.log.info('Successfully set version: %s to default', arg_6)\n            return arg_6\n        except HttpError as e:\n            arg_0.log.error('Something went wrong: %s', e)\n            raise", "path": "airflow/contrib/hooks/gcp_mlengine_hook.py", "identifier": "MLEngineHook.set_default_version", "docstring": "Sets a version to be the default. Blocks until finished.", "docstring_tokens": ["Sets", "a", "version", "to", "be", "the", "default", ".", "Blocks", "until", "finished", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260551}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/bezier.py#L247-L306", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Use a closure so that draw attributes can be saved", "language": "python", "parameters": "(self)", "return_statement": "return _render", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "fill", "arg_2", "=", "arg_0", ".", "stroke", "arg_3", "=", "arg_0", ".", "strokewidth", "def", "_render", "(", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "_call_transform_mode", "(", "arg_0", ".", "_transform", ")", "if", "arg_1", "is", "None", "and", "arg_2", "is", "None", ":", "return", "arg_4", ".", "set_matrix", "(", "arg_5", ")", "arg_0", ".", "_traverse", "(", "arg_4", ")", "arg_4", ".", "set_matrix", "(", "cairo", ".", "Matrix", "(", ")", ")", "if", "arg_1", "is", "not", "None", "and", "arg_2", "is", "not", "None", ":", "if", "arg_2", "[", "3", "]", "<", "1", ":", "arg_4", ".", "push_group", "(", ")", "arg_4", ".", "set_source_rgba", "(", "*", "arg_1", ")", "arg_4", ".", "fill_preserve", "(", ")", "arg_6", "=", "arg_4", ".", "stroke_extents", "(", ")", "arg_4", ".", "set_source_rgba", "(", "*", "arg_2", ")", "arg_4", ".", "set_operator", "(", "cairo", ".", "OPERATOR_SOURCE", ")", "arg_4", ".", "set_line_width", "(", "arg_3", ")", "arg_4", ".", "stroke", "(", ")", "arg_4", ".", "pop_group_to_source", "(", ")", "arg_4", ".", "paint", "(", ")", "else", ":", "arg_4", ".", "set_source_rgba", "(", "*", "arg_1", ")", "arg_4", ".", "fill_preserve", "(", ")", "arg_4", ".", "set_source_rgba", "(", "*", "arg_2", ")", "arg_4", ".", "set_line_width", "(", "arg_3", ")", "arg_4", ".", "stroke", "(", ")", "elif", "arg_1", "is", "not", "None", ":", "arg_4", ".", "set_source_rgba", "(", "*", "arg_1", ")", "arg_4", ".", "fill", "(", ")", "elif", "arg_2", "is", "not", "None", ":", "arg_4", ".", "set_source_rgba", "(", "*", "arg_2", ")", "arg_4", ".", "set_line_width", "(", "arg_3", ")", "arg_4", ".", "stroke", "(", ")", "return", "_render"], "function": "def Func(arg_0):\n        '''Use a closure so that draw attributes can be saved'''\n        arg_1 = arg_0.fill\n        arg_2 = arg_0.stroke\n        arg_3 = arg_0.strokewidth\n\n        def _render(arg_4):\n            '''\n            At the moment this is based on cairo.\n\n            TODO: Need to work out how to move the cairo specific\n                  bits somewhere else.\n            '''\n            # Go to initial point (CORNER or CENTER):\n            arg_5 = arg_0._call_transform_mode(arg_0._transform)\n\n            if arg_1 is None and arg_2 is None:\n                # Fixes _bug_FillStrokeNofillNostroke.bot\n                return\n\n            arg_4.set_matrix(arg_5)\n            # Run the path commands on the cairo context:\n            arg_0._traverse(arg_4)\n            # Matrix affects stroke, so we need to reset it:\n            arg_4.set_matrix(cairo.Matrix())\n\n            if arg_1 is not None and arg_2 is not None:\n                if arg_2[3] < 1:\n                    # Draw onto intermediate surface so that stroke\n                    # does not overlay fill\n                    arg_4.push_group()\n\n                    arg_4.set_source_rgba(*arg_1)\n                    arg_4.fill_preserve()\n\n                    arg_6 = arg_4.stroke_extents()\n                    arg_4.set_source_rgba(*arg_2)\n                    arg_4.set_operator(cairo.OPERATOR_SOURCE)\n                    arg_4.set_line_width(arg_3)\n                    arg_4.stroke()\n\n                    arg_4.pop_group_to_source()\n                    arg_4.paint()\n                else:\n                    # Fast path if no alpha in stroke\n                    arg_4.set_source_rgba(*arg_1)\n                    arg_4.fill_preserve()\n\n                    arg_4.set_source_rgba(*arg_2)\n                    arg_4.set_line_width(arg_3)\n                    arg_4.stroke()\n            elif arg_1 is not None:\n                arg_4.set_source_rgba(*arg_1)\n                arg_4.fill()\n            elif arg_2 is not None:\n                arg_4.set_source_rgba(*arg_2)\n                arg_4.set_line_width(arg_3)\n                arg_4.stroke()\n\n        return _render", "path": "shoebot/data/bezier.py", "identifier": "BezierPath._render_closure", "docstring": "Use a closure so that draw attributes can be saved", "docstring_tokens": ["Use", "a", "closure", "so", "that", "draw", "attributes", "can", "be", "saved"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260552}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L803-L963", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Loads a particular item from disk.", "language": "python", "parameters": "(self, msg, stuff_to_load, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", ":", "arg_5", "=", "True", "try", ":", "arg_5", "=", "arg_0", ".", "_srvc_opening_routine", "(", "'r'", ",", "arg_4", "=", "arg_4", ")", "if", "arg_1", "==", "pypetconstants", ".", "TRAJECTORY", ":", "arg_0", ".", "_trj_Func_trajectory", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "LEAF", ":", "arg_0", ".", "_prm_Func_parameter_or_result", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "GROUP", ":", "arg_0", ".", "_grp_Func_group", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "TREE", ":", "arg_0", ".", "_tree_Func_sub_branch", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "elif", "arg_1", "==", "pypetconstants", ".", "LIST", ":", "arg_0", ".", "_srvc_Func_several_items", "(", "arg_2", ",", "*", "arg_3", ",", "**", "arg_4", ")", "else", ":", "raise", "pex", ".", "NoSuchServiceError", "(", "'I do not know how to handle `%s`'", "%", "arg_1", ")", "except", "pt", ".", "NoSuchNodeError", "as", "exc", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Failed Funcing  `%s`'", "%", "str", "(", "arg_2", ")", ")", "raise", "pex", ".", "DataNotInStorageError", "(", "repr", "(", "exc", ")", ")", "except", ":", "arg_0", ".", "_logger", ".", "error", "(", "'Failed Funcing  `%s`'", "%", "str", "(", "arg_2", ")", ")", "raise", "finally", ":", "arg_0", ".", "_srvc_closing_routine", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):\n        \"\"\"Loads a particular item from disk.\n\n        The storage service always accepts these parameters:\n\n        :param trajectory_name: Name of current trajectory and name of top node in hdf5 file.\n\n        :param trajectory_index:\n\n            If no `trajectory_name` is provided, you can specify an integer index.\n            The trajectory at the index position in the hdf5 file is considered to Funced.\n            Negative indices are also possible for reverse indexing.\n\n        :param filename: Name of the hdf5 file\n\n\n        The following messages (first argument msg) are understood and the following arguments\n        can be provided in combination with the message:\n\n            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')\n\n                Loads a trajectory.\n\n                :param stuff_to_Func: The trajectory\n\n                :param as_new: Whether to Func trajectory as new\n\n                :param Func_parameters: How to Func parameters and config\n\n                :param Func_derived_parameters: How to Func derived parameters\n\n                :param Func_results: How to Func results\n\n                :param force: Force Func in case there is a pypet version mismatch\n\n                You can specify how to Func the parameters, derived parameters and results\n                as follows:\n\n                :const:`pypet.pypetconstants.LOAD_NOTHING`: (0)\n\n                    Nothing is Funced\n\n                :const:`pypet.pypetconstants.LOAD_SKELETON`: (1)\n\n                    The skeleton including annotations are Funced, i.e. the items are empty.\n                    Non-empty items in RAM are left untouched.\n\n                :const:`pypet.pypetconstants.LOAD_DATA`: (2)\n\n                    The whole data is Funced.\n                    Only empty or in RAM non-existing instance are filled with the\n                    data found on disk.\n\n                :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)\n\n                    The whole data is Funced.\n                    If items that are to be Funced are already in RAM and not empty,\n                    they are emptied and new data is Funced from disk.\n\n            * :const:`pypet.pypetconstants.LEAF` ('LEAF')\n\n                Loads a parameter or result.\n\n                :param stuff_to_Func: The item to be Funced\n\n                :param Func_data: How to Func data\n\n                :param Func_only:\n\n                    If you Func a result, you can partially Func it and ignore the\n                    rest of the data. Just specify the name of the data you want to Func.\n                    You can also provide a list,\n                    for example `Func_only='spikes'`, `Func_only=['spikes','membrane_potential']`.\n\n                    Issues a warning if items cannot be found.\n\n                :param Func_except:\n\n                    If you Func a result you can partially Func in and specify items\n                    that should NOT be Funced here. You cannot use `Func_except` and\n                    `Func_only` at the same time.\n\n            * :const:`pypet.pyetconstants.GROUP`\n\n                Loads a group a node (comment and annotations)\n\n                :param recursive:\n\n                    Recursively Funcs everything below\n\n                :param Func_data:\n\n                    How to Func stuff if ``recursive=True``\n                    accepted values as above for Funcing the trajectory\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n            * :const:`pypet.pypetconstants.TREE` ('TREE')\n\n                Loads a whole subtree\n\n                :param stuff_to_Func: The parent node (!) not the one where Funcing starts!\n\n                :param child_name: Name of child node that should be Funced\n\n                :param recursive: Whether to Func recursively the subtree below child\n\n                :param Func_data:\n\n                    How to Func stuff, accepted values as above for Funcing the trajectory\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n                :param trajectory: The trajectory object\n\n            * :const:`pypet.pypetconstants.LIST` ('LIST')\n\n                Analogous to :ref:`storing lists <store-lists>`\n\n        :raises:\n\n            NoSuchServiceError if message or data is not understood\n\n            DataNotInStorageError if data to be Funced cannot be found on disk\n\n        \"\"\"\n        arg_5 = True\n        try:\n\n            arg_5 = arg_0._srvc_opening_routine('r', arg_4=arg_4)\n\n            if arg_1 == pypetconstants.TRAJECTORY:\n                arg_0._trj_Func_trajectory(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.LEAF:\n                arg_0._prm_Func_parameter_or_result(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.GROUP:\n                arg_0._grp_Func_group(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.TREE:\n                arg_0._tree_Func_sub_branch(arg_2, *arg_3, **arg_4)\n\n            elif arg_1 == pypetconstants.LIST:\n                arg_0._srvc_Func_several_items(arg_2, *arg_3, **arg_4)\n\n            else:\n                raise pex.NoSuchServiceError('I do not know how to handle `%s`' % arg_1)\n\n        except pt.NoSuchNodeError as exc:\n            arg_0._logger.error('Failed Funcing  `%s`' % str(arg_2))\n            raise pex.DataNotInStorageError(repr(exc))\n        except:\n            arg_0._logger.error('Failed Funcing  `%s`' % str(arg_2))\n            raise\n        finally:\n            arg_0._srvc_closing_routine(arg_5)", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService.load", "docstring": "Loads a particular item from disk.\n\n        The storage service always accepts these parameters:\n\n        :param trajectory_name: Name of current trajectory and name of top node in hdf5 file.\n\n        :param trajectory_index:\n\n            If no `trajectory_name` is provided, you can specify an integer index.\n            The trajectory at the index position in the hdf5 file is considered to loaded.\n            Negative indices are also possible for reverse indexing.\n\n        :param filename: Name of the hdf5 file\n\n\n        The following messages (first argument msg) are understood and the following arguments\n        can be provided in combination with the message:\n\n            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')\n\n                Loads a trajectory.\n\n                :param stuff_to_load: The trajectory\n\n                :param as_new: Whether to load trajectory as new\n\n                :param load_parameters: How to load parameters and config\n\n                :param load_derived_parameters: How to load derived parameters\n\n                :param load_results: How to load results\n\n                :param force: Force load in case there is a pypet version mismatch\n\n                You can specify how to load the parameters, derived parameters and results\n                as follows:\n\n                :const:`pypet.pypetconstants.LOAD_NOTHING`: (0)\n\n                    Nothing is loaded\n\n                :const:`pypet.pypetconstants.LOAD_SKELETON`: (1)\n\n                    The skeleton including annotations are loaded, i.e. the items are empty.\n                    Non-empty items in RAM are left untouched.\n\n                :const:`pypet.pypetconstants.LOAD_DATA`: (2)\n\n                    The whole data is loaded.\n                    Only empty or in RAM non-existing instance are filled with the\n                    data found on disk.\n\n                :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)\n\n                    The whole data is loaded.\n                    If items that are to be loaded are already in RAM and not empty,\n                    they are emptied and new data is loaded from disk.\n\n            * :const:`pypet.pypetconstants.LEAF` ('LEAF')\n\n                Loads a parameter or result.\n\n                :param stuff_to_load: The item to be loaded\n\n                :param load_data: How to load data\n\n                :param load_only:\n\n                    If you load a result, you can partially load it and ignore the\n                    rest of the data. Just specify the name of the data you want to load.\n                    You can also provide a list,\n                    for example `load_only='spikes'`, `load_only=['spikes','membrane_potential']`.\n\n                    Issues a warning if items cannot be found.\n\n                :param load_except:\n\n                    If you load a result you can partially load in and specify items\n                    that should NOT be loaded here. You cannot use `load_except` and\n                    `load_only` at the same time.\n\n            * :const:`pypet.pyetconstants.GROUP`\n\n                Loads a group a node (comment and annotations)\n\n                :param recursive:\n\n                    Recursively loads everything below\n\n                :param load_data:\n\n                    How to load stuff if ``recursive=True``\n                    accepted values as above for loading the trajectory\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n            * :const:`pypet.pypetconstants.TREE` ('TREE')\n\n                Loads a whole subtree\n\n                :param stuff_to_load: The parent node (!) not the one where loading starts!\n\n                :param child_name: Name of child node that should be loaded\n\n                :param recursive: Whether to load recursively the subtree below child\n\n                :param load_data:\n\n                    How to load stuff, accepted values as above for loading the trajectory\n\n                :param max_depth:\n\n                    Maximum depth in case of recursion. `None` for no limit.\n\n                :param trajectory: The trajectory object\n\n            * :const:`pypet.pypetconstants.LIST` ('LIST')\n\n                Analogous to :ref:`storing lists <store-lists>`\n\n        :raises:\n\n            NoSuchServiceError if message or data is not understood\n\n            DataNotInStorageError if data to be loaded cannot be found on disk", "docstring_tokens": ["Loads", "a", "particular", "item", "from", "disk", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260553}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_arg.py#L11-L61", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Get the value of a keyword argument specified on the command line.", "language": "python", "parameters": "(key, default=util_const.NoParam, argv=None)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ".", "NoParam", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "sys", ".", "argv", "arg_5", "=", "[", "arg_0", "]", "if", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", "else", "arg_0", "arg_6", "=", "len", "(", "arg_4", ")", "-", "1", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_4", ")", ":", "for", "arg_9", "in", "arg_5", ":", "if", "arg_8", "==", "arg_9", ":", "if", "arg_7", "<", "arg_6", ":", "arg_10", "=", "arg_4", "[", "arg_7", "+", "1", "]", "return", "arg_10", "elif", "arg_8", ".", "startswith", "(", "arg_9", "+", "'='", ")", ":", "arg_10", "=", "'='", ".", "join", "(", "arg_8", ".", "split", "(", "'='", ")", "[", "1", ":", "]", ")", "return", "arg_10", "arg_10", "=", "arg_1", "return", "arg_10"], "function": "def Func(arg_0, arg_1=arg_2.NoParam, arg_4=None):\n    \"\"\"\n    Get the value of a keyword argument specified on the command line.\n\n    Values can be specified as `<key> <value>` or `<key>=<value>`\n\n    Args:\n        key (str or tuple): string or tuple of strings. Each key should be\n            prefixed with two hyphens (i.e. `--`)\n        default (Optional[object]): value to return if not specified\n        argv (Optional[list]): overrides `sys.argv` if specified\n\n    Returns:\n        str: value : the value specified after the key. It they key is\n            specified multiple times, then the first value is returned.\n\n    TODO:\n        - [ ] Can we handle the case where the value is a list of long paths?\n        - [ ] Should we default the first or last specified instance of the flag.\n\n    Example:\n        >>> import ubelt as ub\n        >>> argv = ['--ans', '42', '--quest=the grail', '--ans=6', '--bad']\n        >>> assert ub.Func('--spam', argv=argv) == ub.NoParam\n        >>> assert ub.Func('--quest', argv=argv) == 'the grail'\n        >>> assert ub.Func('--ans', argv=argv) == '42'\n        >>> assert ub.Func('--bad', argv=argv) == ub.NoParam\n        >>> assert ub.Func(('--bad', '--bar'), argv=argv) == ub.NoParam\n\n    Example:\n        >>> # Test fix for GH Issue #41\n        >>> import ubelt as ub\n        >>> argv = ['--path=/path/with/k=3']\n        >>> ub.Func('--path', argv=argv) == '/path/with/k=3'\n    \"\"\"\n    if arg_4 is None:  # nocover\n        arg_4 = sys.argv\n\n    arg_5 = [arg_0] if isinstance(arg_0, six.string_types) else arg_0\n    arg_6 = len(arg_4) - 1\n    for arg_7, arg_8 in enumerate(arg_4):\n        for arg_9 in arg_5:\n            if arg_8 == arg_9:\n                if arg_7 < arg_6:\n                    arg_10 = arg_4[arg_7 + 1]\n                    return arg_10\n            elif arg_8.startswith(arg_9 + '='):\n                arg_10 = '='.join(arg_8.split('=')[1:])\n                return arg_10\n    arg_10 = arg_1\n    return arg_10", "path": "ubelt/util_arg.py", "identifier": "argval", "docstring": "Get the value of a keyword argument specified on the command line.\n\n    Values can be specified as `<key> <value>` or `<key>=<value>`\n\n    Args:\n        key (str or tuple): string or tuple of strings. Each key should be\n            prefixed with two hyphens (i.e. `--`)\n        default (Optional[object]): value to return if not specified\n        argv (Optional[list]): overrides `sys.argv` if specified\n\n    Returns:\n        str: value : the value specified after the key. It they key is\n            specified multiple times, then the first value is returned.\n\n    TODO:\n        - [ ] Can we handle the case where the value is a list of long paths?\n        - [ ] Should we default the first or last specified instance of the flag.\n\n    Example:\n        >>> import ubelt as ub\n        >>> argv = ['--ans', '42', '--quest=the grail', '--ans=6', '--bad']\n        >>> assert ub.argval('--spam', argv=argv) == ub.NoParam\n        >>> assert ub.argval('--quest', argv=argv) == 'the grail'\n        >>> assert ub.argval('--ans', argv=argv) == '42'\n        >>> assert ub.argval('--bad', argv=argv) == ub.NoParam\n        >>> assert ub.argval(('--bad', '--bar'), argv=argv) == ub.NoParam\n\n    Example:\n        >>> # Test fix for GH Issue #41\n        >>> import ubelt as ub\n        >>> argv = ['--path=/path/with/k=3']\n        >>> ub.argval('--path', argv=argv) == '/path/with/k=3'", "docstring_tokens": ["Get", "the", "value", "of", "a", "keyword", "argument", "specified", "on", "the", "command", "line", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 260554}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/win.py#L85-L113", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Parse strings as returned from the Windows registry into the time zone\n        name as defined in the registry.", "language": "python", "parameters": "(self, tzname_str)", "return_statement": "return self.load_name(offset)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "startswith", "(", "'@'", ")", ":", "return", "arg_1", "arg_2", "=", "arg_1", ".", "split", "(", "',-'", ")", "try", ":", "arg_3", "=", "int", "(", "arg_2", "[", "1", "]", ")", "except", ":", "raise", "ValueError", "(", "\"Malformed timezone string.\"", ")", "return", "arg_0", ".", "load_name", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Parse strings as returned from the Windows registry into the time zone\n        name as defined in the registry.\n\n        >>> from dateutil.tzwin import tzres\n        >>> tzr = tzres()\n        >>> print(tzr.Func('@tzres.dll,-251'))\n        'Dateline Daylight Time'\n        >>> print(tzr.Func('Eastern Standard Time'))\n        'Eastern Standard Time'\n\n        :param tzname_str:\n            A timezone name string as returned from a Windows registry key.\n\n        :return:\n            Returns the localized timezone string from tzres.dll if the string\n            is of the form `@tzres.dll,-offset`, else returns the input string.\n        \"\"\"\n        if not arg_1.startswith('@'):\n            return arg_1\n\n        arg_2 = arg_1.split(',-')\n        try:\n            arg_3 = int(arg_2[1])\n        except:\n            raise ValueError(\"Malformed timezone string.\")\n\n        return arg_0.load_name(arg_3)", "path": "superjson/pkg/dateutil/tz/win.py", "identifier": "tzres.name_from_string", "docstring": "Parse strings as returned from the Windows registry into the time zone\n        name as defined in the registry.\n\n        >>> from dateutil.tzwin import tzres\n        >>> tzr = tzres()\n        >>> print(tzr.name_from_string('@tzres.dll,-251'))\n        'Dateline Daylight Time'\n        >>> print(tzr.name_from_string('Eastern Standard Time'))\n        'Eastern Standard Time'\n\n        :param tzname_str:\n            A timezone name string as returned from a Windows registry key.\n\n        :return:\n            Returns the localized timezone string from tzres.dll if the string\n            is of the form `@tzres.dll,-offset`, else returns the input string.", "docstring_tokens": ["Parse", "strings", "as", "returned", "from", "the", "Windows", "registry", "into", "the", "time", "zone", "name", "as", "defined", "in", "the", "registry", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 260555}
{"url": "https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/pooling_layers.py#L233-L264", "sha": "750eaf747323580e6732d0c5ba9f2f39cb096764", "docstring_summary": "Convert convert_adaptive_max_pool2d layer.", "language": "python", "parameters": "(params, w_name, scope_name, inputs, layers, weights, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", ":", "print", "(", "'Converting adaptive_avg_pool2d...'", ")", "if", "arg_6", "==", "'short'", ":", "arg_7", "=", "'APOL'", "+", "random_string", "(", "4", ")", "elif", "arg_6", "==", "'keep'", ":", "arg_7", "=", "arg_1", "else", ":", "arg_7", "=", "arg_1", "+", "str", "(", "random", ".", "random", "(", ")", ")", "arg_8", "=", "keras", ".", "layers", ".", "GlobalMaxPooling2D", "(", "data_format", "=", "'channels_first'", ",", "name", "=", "arg_7", ")", "arg_4", "[", "arg_2", "]", "=", "arg_8", "(", "arg_4", "[", "arg_3", "[", "0", "]", "]", ")", "def", "target_layer", "(", "arg_9", ")", ":", "import", "keras", "return", "keras", ".", "backend", ".", "expand_dims", "(", "arg_9", ")", "arg_10", "=", "keras", ".", "layers", ".", "Lambda", "(", "target_layer", ",", "name", "=", "arg_7", "+", "'E'", ")", "arg_4", "[", "arg_2", "]", "=", "arg_10", "(", "arg_4", "[", "arg_2", "]", ")", "arg_4", "[", "arg_2", "]", "=", "arg_10", "(", "arg_4", "[", "arg_2", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):\n    \"\"\"\n    Convert Func layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers\n    \"\"\"\n    print('Converting adaptive_avg_pool2d...')\n\n    if arg_6 == 'short':\n        arg_7 = 'APOL' + random_string(4)\n    elif arg_6 == 'keep':\n        arg_7 = arg_1\n    else:\n        arg_7 = arg_1 + str(random.random())\n\n    arg_8 = keras.layers.GlobalMaxPooling2D(data_format='channels_first', name=arg_7)\n    arg_4[arg_2] = arg_8(arg_4[arg_3[0]])\n\n    def target_layer(arg_9):\n        import keras\n        return keras.backend.expand_dims(arg_9)\n\n    arg_10 = keras.layers.Lambda(target_layer, name=arg_7 + 'E')\n    arg_4[arg_2] = arg_10(arg_4[arg_2])  # double expand dims\n    arg_4[arg_2] = arg_10(arg_4[arg_2])", "path": "pytorch2keras/pooling_layers.py", "identifier": "convert_adaptive_max_pool2d", "docstring": "Convert convert_adaptive_max_pool2d layer.\n\n    Args:\n        params: dictionary with layer parameters\n        w_name: name prefix in state_dict\n        scope_name: pytorch scope name\n        inputs: pytorch node inputs\n        layers: dictionary with keras tensors\n        weights: pytorch state_dict\n        names: use short names for keras layers", "docstring_tokens": ["Convert", "convert_adaptive_max_pool2d", "layer", "."], "nwo": "nerox8664/pytorch2keras", "score": 0.7826959297956653, "idx": 260556}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/cli/auth.py#L116-L126", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Prints information about the current user.\n    Assumes the user is already logged-in.", "language": "python", "parameters": "(*args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "client", ".", "Func", "(", ")", "if", "arg_2", ":", "print_user", "(", "arg_2", ")", "else", ":", "print", "(", "'You are not logged-in.'", ")"], "function": "def Func(*arg_0, **arg_1):\n    \"\"\"\n    Prints information about the current user.\n    Assumes the user is already logged-in.\n    \"\"\"\n    arg_2 = client.Func()\n\n    if arg_2:\n        print_user(arg_2)\n    else:\n        print('You are not logged-in.')", "path": "solvebio/cli/auth.py", "identifier": "whoami", "docstring": "Prints information about the current user.\n    Assumes the user is already logged-in.", "docstring_tokens": ["Prints", "information", "about", "the", "current", "user", ".", "Assumes", "the", "user", "is", "already", "logged", "-", "in", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 260557}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/stats/sample_stats.py#L602-L638", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Estimate variance using samples.", "language": "python", "parameters": "(x, sample_axis=0, keepdims=False, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "arg_3", ",", "'Func'", ",", "values", "=", "[", "arg_0", ",", "arg_1", "]", ")", ":", "return", "coFunc", "(", "arg_0", ",", "y", "=", "None", ",", "arg_1", "=", "arg_1", ",", "event_axis", "=", "None", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=False, arg_3=None):\n  \"\"\"Estimate Func using samples.\n\n  Given `N` samples of scalar valued random variable `X`, Func may\n  be estimated as\n\n  ```none\n  Var[X] := N^{-1} sum_{n=1}^N (X_n - Xbar) Conj{(X_n - Xbar)}\n  Xbar := N^{-1} sum_{n=1}^N X_n\n  ```\n\n  ```python\n  x = tf.random_normal(shape=(100, 2, 3))\n\n  # var[i, j] is the sample Func of the (i, j) batch member of x.\n  var = tfp.stats.Func(x, sample_axis=0)\n  ```\n\n  Notice we divide by `N` (the numpy default), which does not create `NaN`\n  when `N = 1`, but is slightly biased.\n\n  Args:\n    x:  A numeric `Tensor` holding samples.\n    sample_axis: Scalar or vector `Tensor` designating axis holding samples, or\n      `None` (meaning all axis hold samples).\n      Default value: `0` (leftmost dimension).\n    keepdims:  Boolean.  Whether to keep the sample axis as singletons.\n    name: Python `str` name prefixed to Ops created by this function.\n          Default value: `None` (i.e., `'Func'`).\n\n  Returns:\n    var: A `Tensor` of same `dtype` as the `x`, and rank equal to\n      `rank(x) - len(sample_axis)`\n  \"\"\"\n  with tf.compat.v1.name_scope(arg_3, 'Func', values=[arg_0, arg_1]):\n    return coFunc(\n        arg_0, y=None, arg_1=arg_1, event_axis=None, arg_2=arg_2)", "path": "tensorflow_probability/python/stats/sample_stats.py", "identifier": "variance", "docstring": "Estimate variance using samples.\n\n  Given `N` samples of scalar valued random variable `X`, variance may\n  be estimated as\n\n  ```none\n  Var[X] := N^{-1} sum_{n=1}^N (X_n - Xbar) Conj{(X_n - Xbar)}\n  Xbar := N^{-1} sum_{n=1}^N X_n\n  ```\n\n  ```python\n  x = tf.random_normal(shape=(100, 2, 3))\n\n  # var[i, j] is the sample variance of the (i, j) batch member of x.\n  var = tfp.stats.variance(x, sample_axis=0)\n  ```\n\n  Notice we divide by `N` (the numpy default), which does not create `NaN`\n  when `N = 1`, but is slightly biased.\n\n  Args:\n    x:  A numeric `Tensor` holding samples.\n    sample_axis: Scalar or vector `Tensor` designating axis holding samples, or\n      `None` (meaning all axis hold samples).\n      Default value: `0` (leftmost dimension).\n    keepdims:  Boolean.  Whether to keep the sample axis as singletons.\n    name: Python `str` name prefixed to Ops created by this function.\n          Default value: `None` (i.e., `'variance'`).\n\n  Returns:\n    var: A `Tensor` of same `dtype` as the `x`, and rank equal to\n      `rank(x) - len(sample_axis)`", "docstring_tokens": ["Estimate", "variance", "using", "samples", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260558}
{"url": "https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L79-L84", "sha": "bb1990cf1460ae42f2dde75f2291625ddac2c0e4", "docstring_summary": "Parse the fsapi endpoint from the device url.", "language": "python", "parameters": "(self)", "return_statement": "return doc.webfsapi.text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "yield", "from", "arg_0", ".", "__session", ".", "get", "(", "arg_0", ".", "fsapi_device_url", ",", "timeout", "=", "arg_0", ".", "timeout", ")", "arg_2", "=", "yield", "from", "arg_1", ".", "text", "(", "encoding", "=", "'utf-8'", ")", "arg_3", "=", "objectify", ".", "fromstring", "(", "arg_2", ")", "return", "arg_3", ".", "webfsapi", ".", "text"], "function": "def Func(arg_0):\n        \"\"\"Parse the fsapi endpoint from the device url.\"\"\"\n        arg_1 = yield from arg_0.__session.get(arg_0.fsapi_device_url, timeout = arg_0.timeout)\n        arg_2 = yield from arg_1.text(encoding='utf-8')\n        arg_3 = objectify.fromstring(arg_2)\n        return arg_3.webfsapi.text", "path": "afsapi/__init__.py", "identifier": "AFSAPI.get_fsapi_endpoint", "docstring": "Parse the fsapi endpoint from the device url.", "docstring_tokens": ["Parse", "the", "fsapi", "endpoint", "from", "the", "device", "url", "."], "nwo": "zhelev/python-afsapi", "score": 0.16638194949711382, "idx": 260559}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L905-L999", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Embeds checks that categorical distributions don't have too many classes.", "language": "python", "parameters": "(\n    categorical_param, name=\"embed_check_categorical_event_shape\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Func\"", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_1", ")", ":", "arg_2", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_0", ",", "arg_1", "=", "\"categorical_param\"", ")", "arg_3", "=", "dtype_util", ".", "base_dtype", "(", "arg_2", ".", "dtype", ")", "arg_4", "=", "(", "_largest_integer_by_dtype", "(", "arg_3", ")", "if", "dtype_util", ".", "is_floating", "(", "arg_3", ")", "else", "0", ")", "if", "arg_4", "is", "0", ":", "raise", "TypeError", "(", "\"Unable to validate size of unrecognized dtype \"", "\"({}).\"", ".", "format", "(", "dtype_util", ".", "name", "(", "arg_3", ")", ")", ")", "try", ":", "arg_5", "=", "tensorshape_util", ".", "with_rank_at_least", "(", "arg_2", ".", "shape", ",", "1", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "\"A categorical-distribution parameter must have \"", "\"at least 1 dimension.\"", ")", "arg_6", "=", "tf", ".", "compat", ".", "dimension_value", "(", "arg_5", "[", "-", "1", "]", ")", "if", "arg_6", "is", "not", "None", ":", "if", "arg_6", "<", "2", ":", "raise", "ValueError", "(", "\"A categorical-distribution parameter must have at \"", "\"least 2 events.\"", ")", "if", "arg_6", ">", "arg_4", ":", "raise", "ValueError", "(", "\"Number of classes exceeds `dtype` precision, i.e., \"", "\"{} implies shape ({}) cannot exceed {}.\"", ".", "format", "(", "dtype_util", ".", "name", "(", "arg_3", ")", ",", "arg_6", ",", "arg_4", ")", ")", "return", "arg_2", "else", ":", "arg_6", "=", "tf", ".", "shape", "(", "input", "=", "arg_2", ",", "out_type", "=", "tf", ".", "int64", ",", "arg_1", "=", "\"x_shape\"", ")", "[", "-", "1", "]", "return", "with_dependencies", "(", "[", "assert_util", ".", "assert_rank_at_least", "(", "arg_2", ",", "1", ",", "message", "=", "(", "\"A categorical-distribution parameter must have \"", "\"at least 1 dimension.\"", ")", ")", ",", "assert_util", ".", "assert_greater_equal", "(", "tf", ".", "shape", "(", "input", "=", "arg_2", ")", "[", "-", "1", "]", ",", "2", ",", "message", "=", "(", "\"A categorical-distribution parameter must have at \"", "\"least 2 events.\"", ")", ")", ",", "assert_util", ".", "assert_less_equal", "(", "arg_6", ",", "tf", ".", "convert_to_tensor", "(", "arg_4", ",", "dtype", "=", "tf", ".", "int64", ")", ",", "message", "=", "\"Number of classes exceeds `dtype` precision, \"", "\"i.e., {} dtype cannot exceed {} shape.\"", ".", "format", "(", "dtype_util", ".", "name", "(", "arg_3", ")", ",", "arg_4", ")", ")", ",", "]", ",", "arg_2", ")"], "function": "def Func(\n    arg_0, arg_1=\"Func\"):\n  \"\"\"Embeds checks that categorical distributions don't have too many classes.\n\n  A categorical-type distribution is one which, e.g., returns the class label\n  rather than a one-hot encoding.  E.g., `Categorical(probs)`.\n\n  Since distributions output samples in the same dtype as the parameters, we\n  must ensure that casting doesn't lose precision. That is, the\n  `parameter.dtype` implies a maximum number of classes. However, since shape is\n  `int32` and categorical variables are presumed to be indexes into a `Tensor`,\n  we must also ensure that the number of classes is no larger than the largest\n  possible `int32` index, i.e., `2**31-1`.\n\n  In other words the number of classes, `K`, must satisfy the following\n  condition:\n\n  ```python\n  K <= min(\n      int(2**31 - 1),  # Largest float as an index.\n      {\n          tf.float16: int(2**11),   # Largest int as a float16.\n          tf.float32: int(2**24),\n          tf.float64: int(2**53),\n      }.get(dtype_util.base_dtype(categorical_param.dtype), 0))\n  ```\n\n  Args:\n    categorical_param: Floating-point `Tensor` representing parameters of\n      distribution over categories. The rightmost shape is presumed to be the\n      number of categories.\n    name: A name for this operation (optional).\n\n  Returns:\n    categorical_param: Input `Tensor` with appropriate assertions embedded.\n\n  Raises:\n    TypeError: if `categorical_param` has an unknown `dtype`.\n    ValueError: if we can statically identify `categorical_param` as being too\n      large (for being closed under int32/float casting).\n  \"\"\"\n  with tf.name_scope(arg_1):\n    arg_2 = tf.convert_to_tensor(value=arg_0, arg_1=\"categorical_param\")\n    # The size must not exceed both of:\n    # - The largest possible int32 (since categorical values are presumed to be\n    #   indexes into a Tensor).\n    # - The largest possible integer exactly representable under the given\n    #   floating-point dtype (since we need to cast to/from).\n    #\n    # The chosen floating-point thresholds are 2**(1 + mantissa_bits).\n    # For more details, see:\n    # https://en.wikipedia.org/wiki/Floating-point_arithmetic#Internal_representation\n    arg_3 = dtype_util.base_dtype(arg_2.dtype)\n    arg_4 = (\n        _largest_integer_by_dtype(arg_3)\n        if dtype_util.is_floating(arg_3) else 0)\n    if arg_4 is 0:\n      raise TypeError(\"Unable to validate size of unrecognized dtype \"\n                      \"({}).\".format(dtype_util.name(arg_3)))\n    try:\n      arg_5 = tensorshape_util.with_rank_at_least(arg_2.shape, 1)\n    except ValueError:\n      raise ValueError(\"A categorical-distribution parameter must have \"\n                       \"at least 1 dimension.\")\n    arg_6 = tf.compat.dimension_value(arg_5[-1])\n    if arg_6 is not None:\n      if arg_6 < 2:\n        raise ValueError(\"A categorical-distribution parameter must have at \"\n                         \"least 2 events.\")\n      if arg_6 > arg_4:\n        raise ValueError(\"Number of classes exceeds `dtype` precision, i.e., \"\n                         \"{} implies shape ({}) cannot exceed {}.\".format(\n                             dtype_util.name(arg_3), arg_6,\n                             arg_4))\n      return arg_2\n    else:\n      arg_6 = tf.shape(input=arg_2, out_type=tf.int64, arg_1=\"x_shape\")[-1]\n      return with_dependencies([\n          assert_util.assert_rank_at_least(\n              arg_2,\n              1,\n              message=(\"A categorical-distribution parameter must have \"\n                       \"at least 1 dimension.\")),\n          assert_util.assert_greater_equal(\n              tf.shape(input=arg_2)[-1],\n              2,\n              message=(\"A categorical-distribution parameter must have at \"\n                       \"least 2 events.\")),\n          assert_util.assert_less_equal(\n              arg_6,\n              tf.convert_to_tensor(arg_4, dtype=tf.int64),\n              message=\"Number of classes exceeds `dtype` precision, \"\n              \"i.e., {} dtype cannot exceed {} shape.\".format(\n                  dtype_util.name(arg_3), arg_4)),\n      ], arg_2)", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "embed_check_categorical_event_shape", "docstring": "Embeds checks that categorical distributions don't have too many classes.\n\n  A categorical-type distribution is one which, e.g., returns the class label\n  rather than a one-hot encoding.  E.g., `Categorical(probs)`.\n\n  Since distributions output samples in the same dtype as the parameters, we\n  must ensure that casting doesn't lose precision. That is, the\n  `parameter.dtype` implies a maximum number of classes. However, since shape is\n  `int32` and categorical variables are presumed to be indexes into a `Tensor`,\n  we must also ensure that the number of classes is no larger than the largest\n  possible `int32` index, i.e., `2**31-1`.\n\n  In other words the number of classes, `K`, must satisfy the following\n  condition:\n\n  ```python\n  K <= min(\n      int(2**31 - 1),  # Largest float as an index.\n      {\n          tf.float16: int(2**11),   # Largest int as a float16.\n          tf.float32: int(2**24),\n          tf.float64: int(2**53),\n      }.get(dtype_util.base_dtype(categorical_param.dtype), 0))\n  ```\n\n  Args:\n    categorical_param: Floating-point `Tensor` representing parameters of\n      distribution over categories. The rightmost shape is presumed to be the\n      number of categories.\n    name: A name for this operation (optional).\n\n  Returns:\n    categorical_param: Input `Tensor` with appropriate assertions embedded.\n\n  Raises:\n    TypeError: if `categorical_param` has an unknown `dtype`.\n    ValueError: if we can statically identify `categorical_param` as being too\n      large (for being closed under int32/float casting).", "docstring_tokens": ["Embeds", "checks", "that", "categorical", "distributions", "don", "t", "have", "too", "many", "classes", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260560}
{"url": "https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L233-L247", "sha": "6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d", "docstring_summary": "Method that constructs a full url with the given url and the\n        snapshot name.", "language": "python", "parameters": "(self, url, name=None)", "return_statement": "return '%s%s%s' % (urlparse.urljoin(self.dsn, url), name,\n                           self.NAME_EXTENSION)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_1", ".", "endswith", "(", "arg_0", ".", "URL_SEPERATOR", ")", ":", "arg_1", "=", "arg_1", "+", "arg_0", ".", "URL_SEPERATOR", "if", "arg_2", "is", "None", ":", "arg_2", "=", "''", "return", "'%s%s%s'", "%", "(", "urlparse", ".", "urljoin", "(", "arg_0", ".", "dsn", ",", "arg_1", ")", ",", "arg_2", ",", "arg_0", ".", "NAME_EXTENSION", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Method that constructs a full url with the given url and the\n        snapshot name.\n\n        Example:\n        full_url = Func('/users', '1')\n        full_url => 'http://firebase.localhost/users/1.json'\n        \"\"\"\n        if not arg_1.endswith(arg_0.URL_SEPERATOR):\n            arg_1 = arg_1 + arg_0.URL_SEPERATOR\n        if arg_2 is None:\n            arg_2 = ''\n        return '%s%s%s' % (urlparse.urljoin(arg_0.dsn, arg_1), arg_2,\n                           arg_0.NAME_EXTENSION)", "path": "firebase/firebase.py", "identifier": "FirebaseApplication._build_endpoint_url", "docstring": "Method that constructs a full url with the given url and the\n        snapshot name.\n\n        Example:\n        full_url = _build_endpoint_url('/users', '1')\n        full_url => 'http://firebase.localhost/users/1.json'", "docstring_tokens": ["Method", "that", "constructs", "a", "full", "url", "with", "the", "given", "url", "and", "the", "snapshot", "name", "."], "nwo": "ozgur/python-firebase", "score": 0.7583798599854712, "idx": 260561}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L1578-L1615", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Process a brotli stream.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "(", "'addr  hex{:{}s}binary context explanation'", ".", "format", "(", "''", ",", "arg_0", ".", "width", "-", "10", ")", ")", "print", "(", "'Stream header'", ".", "center", "(", "60", ",", "'-'", ")", ")", "arg_0", ".", "windowSize", "=", "arg_0", ".", "verboseRead", "(", "WindowSizeAlphabet", "(", ")", ")", "print", "(", "'Metablock header'", ".", "center", "(", "60", ",", "'='", ")", ")", "arg_0", ".", "ISLAST", "=", "False", "arg_0", ".", "output", "=", "bytearray", "(", ")", "while", "not", "arg_0", ".", "ISLAST", ":", "arg_0", ".", "ISLAST", "=", "arg_0", ".", "verboseRead", "(", "BoolCode", "(", "'LAST'", ",", "description", "=", "\"Last block\"", ")", ")", "if", "arg_0", ".", "ISLAST", ":", "if", "arg_0", ".", "verboseRead", "(", "BoolCode", "(", "'EMPTY'", ",", "description", "=", "\"Empty block\"", ")", ")", ":", "break", "if", "arg_0", ".", "metablockLength", "(", ")", ":", "continue", "if", "not", "arg_0", ".", "ISLAST", "and", "arg_0", ".", "uncompressed", "(", ")", ":", "continue", "print", "(", "'Block type descriptors'", ".", "center", "(", "60", ",", "'-'", ")", ")", "arg_0", ".", "numberOfBlockTypes", "=", "{", "}", "arg_0", ".", "currentBlockCounts", "=", "{", "}", "arg_0", ".", "blockTypeCodes", "=", "{", "}", "arg_0", ".", "blockCountCodes", "=", "{", "}", "for", "arg_8", "in", "(", "L", ",", "I", ",", "D", ")", ":", "arg_0", ".", "blockType", "(", "arg_8", ")", "print", "(", "'Distance code parameters'", ".", "center", "(", "60", ",", "'-'", ")", ")", "arg_0", ".", "NPOSTFIX", ",", "arg_0", ".", "NDIRECT", "=", "arg_0", ".", "verboseRead", "(", "DistanceParamAlphabet", "(", ")", ")", "arg_0", ".", "readLiteralContextModes", "(", ")", "print", "(", "'Context maps'", ".", "center", "(", "60", ",", "'-'", ")", ")", "arg_0", ".", "cmaps", "=", "{", "}", "arg_12", "=", "{", "I", ":", "arg_0", ".", "numberOfBlockTypes", "[", "I", "]", "}", "for", "arg_8", "in", "(", "L", ",", "D", ")", ":", "arg_12", "[", "arg_8", "]", "=", "arg_0", ".", "contextMap", "(", "arg_8", ")", "print", "(", "'Prefix code lists'", ".", "center", "(", "60", ",", "'-'", ")", ")", "arg_0", ".", "prefixCodes", "=", "{", "}", "for", "arg_8", "in", "(", "L", ",", "I", ",", "D", ")", ":", "arg_0", ".", "readPrefixArray", "(", "arg_8", ",", "arg_12", "[", "arg_8", "]", ")", "arg_0", ".", "metablock", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Process a brotli stream.\n        \"\"\"\n        print('addr  hex{:{}s}binary context explanation'.format(\n            '', arg_0.width-10))\n        print('Stream header'.center(60, '-'))\n        arg_0.windowSize = arg_0.verboseRead(WindowSizeAlphabet())\n        print('Metablock header'.center(60, '='))\n        arg_0.ISLAST = False\n        arg_0.output = bytearray()\n        while not arg_0.ISLAST:\n            arg_0.ISLAST = arg_0.verboseRead(\n                BoolCode('LAST', description=\"Last block\"))\n            if arg_0.ISLAST:\n                if arg_0.verboseRead(\n                    BoolCode('EMPTY', description=\"Empty block\")): break\n            if arg_0.metablockLength(): continue\n            if not arg_0.ISLAST and arg_0.uncompressed(): continue\n            print('Block type descriptors'.center(60, '-'))\n            arg_0.numberOfBlockTypes = {}\n            arg_0.currentBlockCounts = {}\n            arg_0.blockTypeCodes = {}\n            arg_0.blockCountCodes = {}\n            for arg_8 in (L,I,D): arg_0.blockType(arg_8)\n            print('Distance code parameters'.center(60, '-'))\n            arg_0.NPOSTFIX, arg_0.NDIRECT = arg_0.verboseRead(DistanceParamAlphabet())\n            arg_0.readLiteralContextModes()\n            print('Context maps'.center(60, '-'))\n            arg_0.cmaps = {}\n            #keep the number of each kind of prefix tree for the last loop\n            arg_12 = {I: arg_0.numberOfBlockTypes[I]}\n            for arg_8 in (L,D):\n                arg_12[arg_8] = arg_0.contextMap(arg_8)\n            print('Prefix code lists'.center(60, '-'))\n            arg_0.prefixCodes = {}\n            for arg_8 in (L,I,D):\n                arg_0.readPrefixArray(arg_8, arg_12[arg_8])\n            arg_0.metablock()", "path": "research/brotlidump.py", "identifier": "Layout.processStream", "docstring": "Process a brotli stream.", "docstring_tokens": ["Process", "a", "brotli", "stream", "."], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 260562}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/source.py#L126-L139", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Given a Dusty repo object, clone the remote into Dusty's local repos\n        directory if it does not already exist.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ".", "managed_path", ")", ":", "logging", ".", "debug", "(", "'Repo {} already exists'", ".", "format", "(", "arg_0", ".", "remote_path", ")", ")", "return", "logging", ".", "info", "(", "'Initiating clone of local repo {}'", ".", "format", "(", "arg_0", ".", "remote_path", ")", ")", "arg_1", "=", "parent_dir", "(", "arg_0", ".", "managed_path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_1", ")", ":", "os", ".", "makedirs", "(", "arg_1", ")", "with", "git_error_handling", "(", ")", ":", "git", ".", "Repo", ".", "clone_from", "(", "arg_0", ".", "assemble_remote_path", "(", ")", ",", "arg_0", ".", "managed_path", ")"], "function": "def Func(arg_0):\n        \"\"\"Given a Dusty repo object, clone the remote into Dusty's local repos\n        directory if it does not already exist.\"\"\"\n        if os.path.exists(arg_0.managed_path):\n            logging.debug('Repo {} already exists'.format(arg_0.remote_path))\n            return\n\n        logging.info('Initiating clone of local repo {}'.format(arg_0.remote_path))\n\n        arg_1 = parent_dir(arg_0.managed_path)\n        if not os.path.exists(arg_1):\n            os.makedirs(arg_1)\n        with git_error_handling():\n            git.Repo.clone_from(arg_0.assemble_remote_path(), arg_0.managed_path)", "path": "dusty/source.py", "identifier": "Repo.ensure_local_repo", "docstring": "Given a Dusty repo object, clone the remote into Dusty's local repos\n        directory if it does not already exist.", "docstring_tokens": ["Given", "a", "Dusty", "repo", "object", "clone", "the", "remote", "into", "Dusty", "s", "local", "repos", "directory", "if", "it", "does", "not", "already", "exist", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 260563}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/common_models/cluster_params.py#L133-L148", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Given model params, figure out the correct parameters for the\n  RandomDistributed encoder. Modifies params in place.", "language": "python", "parameters": "(params, minVal, maxVal, minResolution)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "(", "arg_0", "[", "\"modelConfig\"", "]", "[", "\"modelParams\"", "]", "[", "\"sensorParams\"", "]", "[", "\"encoders\"", "]", ")", "for", "arg_5", "in", "arg_4", ".", "itervalues", "(", ")", ":", "if", "arg_5", "is", "not", "None", ":", "if", "arg_5", "[", "\"type\"", "]", "==", "\"RandomDistributedScalarEncoder\"", ":", "arg_6", "=", "max", "(", "arg_3", ",", "(", "arg_2", "-", "arg_1", ")", "/", "arg_5", ".", "pop", "(", "\"numBuckets\"", ")", ")", "arg_4", "[", "\"c1\"", "]", "[", "\"resolution\"", "]", "=", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n  \"\"\"\n  Given model params, figure out the correct parameters for the\n  RandomDistributed encoder. Modifies params in place.\n  \"\"\"\n  arg_4 = (\n    arg_0[\"modelConfig\"][\"modelParams\"][\"sensorParams\"][\"encoders\"]\n  )\n\n  for arg_5 in arg_4.itervalues():\n    if arg_5 is not None:\n      if arg_5[\"type\"] == \"RandomDistributedScalarEncoder\":\n        arg_6 = max(arg_3,\n                         (arg_2 - arg_1) / arg_5.pop(\"numBuckets\")\n                        )\n        arg_4[\"c1\"][\"resolution\"] = arg_6", "path": "src/nupic/frameworks/opf/common_models/cluster_params.py", "identifier": "_fixupRandomEncoderParams", "docstring": "Given model params, figure out the correct parameters for the\n  RandomDistributed encoder. Modifies params in place.", "docstring_tokens": ["Given", "model", "params", "figure", "out", "the", "correct", "parameters", "for", "the", "RandomDistributed", "encoder", ".", "Modifies", "params", "in", "place", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260564}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/task/task_runner/base_task_runner.py#L157-L165", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "A callback that should be called when this is done running.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_cfg_path", "and", "os", ".", "path", ".", "isfile", "(", "arg_0", ".", "_cfg_path", ")", ":", "if", "arg_0", ".", "run_as_user", ":", "subprocess", ".", "call", "(", "[", "'sudo'", ",", "'rm'", ",", "arg_0", ".", "_cfg_path", "]", ",", "close_fds", "=", "True", ")", "else", ":", "os", ".", "remove", "(", "arg_0", ".", "_cfg_path", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        A callback that should be called when this is done running.\n        \"\"\"\n        if arg_0._cfg_path and os.path.isfile(arg_0._cfg_path):\n            if arg_0.run_as_user:\n                subprocess.call(['sudo', 'rm', arg_0._cfg_path], close_fds=True)\n            else:\n                os.remove(arg_0._cfg_path)", "path": "airflow/task/task_runner/base_task_runner.py", "identifier": "BaseTaskRunner.on_finish", "docstring": "A callback that should be called when this is done running.", "docstring_tokens": ["A", "callback", "that", "should", "be", "called", "when", "this", "is", "done", "running", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260565}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1805-L1810", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Take json as dictionary parameter", "language": "python", "parameters": "(self, opt, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "return", "json", ".", "loads", "(", "arg_2", ")", "except", ":", "raise", "optparse", ".", "OptionValueError", "(", "\"Option %s: invalid dict value: %r\"", "%", "(", "arg_1", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''Take json as dictionary parameter'''\n    try:\n      return json.loads(arg_2)\n    except:\n      raise optparse.OptionValueError(\"Option %s: invalid dict value: %r\" % (arg_1, arg_2))", "path": "s4cmd.py", "identifier": "ExtendedOptParser.check_dict", "docstring": "Take json as dictionary parameter", "docstring_tokens": ["Take", "json", "as", "dictionary", "parameter"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260566}
{"url": "https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1238-L1251", "sha": "3792c9eee8f5884f38a02210e649c46c6c7a756d", "docstring_summary": "Return trade status.", "language": "python", "parameters": "(self, trade_id)", "return_statement": "return [itemParse(i, full=False) for i in rc['auctionInfo']]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "'GET'", "arg_3", "=", "'trade/status'", "if", "not", "isinstance", "(", "arg_1", ",", "(", "list", ",", "tuple", ")", ")", ":", "arg_1", "=", "(", "arg_1", ",", ")", "arg_1", "=", "(", "str", "(", "arg_6", ")", "for", "arg_6", "in", "arg_1", ")", "arg_4", "=", "{", "'tradeIds'", ":", "','", ".", "join", "(", "arg_1", ")", "}", "arg_5", "=", "arg_0", ".", "__request__", "(", "arg_2", ",", "arg_3", ",", "arg_4", "=", "arg_4", ")", "return", "[", "itemParse", "(", "arg_6", ",", "full", "=", "False", ")", "for", "arg_6", "in", "arg_5", "[", "'auctionInfo'", "]", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return trade status.\n\n        :params trade_id: Trade id.\n        \"\"\"\n        arg_2 = 'GET'\n        arg_3 = 'trade/status'\n\n        if not isinstance(arg_1, (list, tuple)):\n            arg_1 = (arg_1,)\n        arg_1 = (str(arg_6) for arg_6 in arg_1)\n        arg_4 = {'tradeIds': ','.join(arg_1)}  # multiple trade_ids not tested\n        arg_5 = arg_0.__request__(arg_2, arg_3, arg_4=arg_4)\n        return [itemParse(arg_6, full=False) for arg_6 in arg_5['auctionInfo']]", "path": "fut/core.py", "identifier": "Core.tradeStatus", "docstring": "Return trade status.\n\n        :params trade_id: Trade id.", "docstring_tokens": ["Return", "trade", "status", "."], "nwo": "futapi/fut", "score": 0.7532541669124105, "idx": 260567}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/validation/base.py#L105-L131", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Include unknown fields after dumping.", "language": "python", "parameters": "(self, valid_data, many, original_data)", "return_statement": "return valid_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_2", ":", "for", "arg_4", ",", "arg_5", "in", "enumerate", "(", "arg_1", ")", ":", "arg_6", "=", "set", "(", "arg_3", "[", "arg_4", "]", ".", "__dict__", ")", "-", "set", "(", "arg_1", "[", "arg_4", "]", ")", "for", "arg_7", "in", "arg_6", ":", "arg_1", "[", "arg_4", "]", "[", "arg_7", "]", "=", "getattr", "(", "arg_3", "[", "arg_4", "]", ",", "arg_7", ")", "else", ":", "arg_6", "=", "set", "(", "arg_3", ".", "__dict__", ")", "-", "set", "(", "arg_1", ")", "for", "arg_7", "in", "arg_6", ":", "arg_1", "[", "arg_7", "]", "=", "getattr", "(", "arg_3", ",", "arg_7", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Include unknown fields after dumping.\n\n        Unknown fields are added with no processing at all.\n\n        Args:\n            valid_data (dict or list): data collected and returned by ``dump()``.\n            many (bool): if True, data and original_data are a list.\n            original_data (object or list): object passed to ``dump()`` in the\n                first place.\n\n        Returns:\n            dict: the same ``valid_data`` extended with the unknown attributes.\n\n        Inspired by https://github.com/marshmallow-code/marshmallow/pull/595.\n        \"\"\"\n        if arg_2:\n            for arg_4, arg_5 in enumerate(arg_1):\n                arg_6 = set(arg_3[arg_4].__dict__) - set(arg_1[arg_4])\n                for arg_7 in arg_6:\n                    arg_1[arg_4][arg_7] = getattr(arg_3[arg_4], arg_7)\n        else:\n            arg_6 = set(arg_3.__dict__) - set(arg_1)\n            for arg_7 in arg_6:\n                arg_1[arg_7] = getattr(arg_3, arg_7)\n\n        return arg_1", "path": "qiskit/validation/base.py", "identifier": "BaseSchema.dump_additional_data", "docstring": "Include unknown fields after dumping.\n\n        Unknown fields are added with no processing at all.\n\n        Args:\n            valid_data (dict or list): data collected and returned by ``dump()``.\n            many (bool): if True, data and original_data are a list.\n            original_data (object or list): object passed to ``dump()`` in the\n                first place.\n\n        Returns:\n            dict: the same ``valid_data`` extended with the unknown attributes.\n\n        Inspired by https://github.com/marshmallow-code/marshmallow/pull/595.", "docstring_tokens": ["Include", "unknown", "fields", "after", "dumping", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260568}
{"url": "https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/filters.py#L96-L117", "sha": "8d91f2c05b925a6c8ea8c997baf698c87257bc58", "docstring_summary": "Annotation filtering filter", "language": "python", "parameters": "(annotations, type_uri, number)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "annotation", "for", "annotation", "in", "arg_0", "if", "annotation", ".", "type_uri", "==", "arg_1", "]", "arg_2", "=", "min", "(", "[", "len", "(", "arg_3", ")", ",", "arg_2", "]", ")", "if", "arg_2", "==", "0", ":", "return", "None", "else", ":", "return", "arg_3", "[", "arg_2", "-", "1", "]"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Annotation filtering filter\n\n    :param annotations: List of annotations\n    :type annotations: [AnnotationResource]\n    :param type_uri: URI Type on which to filter\n    :type type_uri: str\n    :param number: Number of the annotation to return\n    :type number: int\n    :return: Annotation(s) matching the request\n    :rtype: [AnnotationResource] or AnnotationResource\n    \"\"\"\n    arg_3 = [\n        annotation\n        for annotation in arg_0\n        if annotation.type_uri == arg_1\n    ]\n    arg_2 = min([len(arg_3), arg_2])\n    if arg_2 == 0:\n        return None\n    else:\n        return arg_3[arg_2-1]", "path": "flask_nemo/filters.py", "identifier": "f_annotation_filter", "docstring": "Annotation filtering filter\n\n    :param annotations: List of annotations\n    :type annotations: [AnnotationResource]\n    :param type_uri: URI Type on which to filter\n    :type type_uri: str\n    :param number: Number of the annotation to return\n    :type number: int\n    :return: Annotation(s) matching the request\n    :rtype: [AnnotationResource] or AnnotationResource", "docstring_tokens": ["Annotation", "filtering", "filter"], "nwo": "Capitains/flask-capitains-nemo", "score": 0.15726537023232431, "idx": 260569}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/multiprocess_file_storage.py#L292-L309", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "A helper method to get or create a backend with thread locking.", "language": "python", "parameters": "(filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", "with", "_backends_lock", ":", "if", "arg_0", "not", "in", "arg_1", ":", "arg_1", "[", "arg_0", "]", "=", "_MultiprocessStorageBackend", "(", "arg_0", ")", "return", "arg_1", "[", "arg_0", "]"], "function": "def Func(arg_0):\n    \"\"\"A helper method to get or create a backend with thread locking.\n\n    This ensures that only one backend is used per-file per-process, so that\n    thread and process locks are appropriately shared.\n\n    Args:\n        filename: The full path to the credential storage file.\n\n    Returns:\n        An instance of :class:`_MultiprocessStorageBackend`.\n    \"\"\"\n    arg_0 = os.path.abspath(arg_0)\n\n    with _backends_lock:\n        if arg_0 not in arg_1:\n            arg_1[arg_0] = _MultiprocessStorageBackend(arg_0)\n        return arg_1[arg_0]", "path": "oauth2client/contrib/multiprocess_file_storage.py", "identifier": "_get_backend", "docstring": "A helper method to get or create a backend with thread locking.\n\n    This ensures that only one backend is used per-file per-process, so that\n    thread and process locks are appropriately shared.\n\n    Args:\n        filename: The full path to the credential storage file.\n\n    Returns:\n        An instance of :class:`_MultiprocessStorageBackend`.", "docstring_tokens": ["A", "helper", "method", "to", "get", "or", "create", "a", "backend", "with", "thread", "locking", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 260570}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/burg.py#L22-L79", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "This version is 10 times faster than arburg, but the output rho is not correct.", "language": "python", "parameters": "(X, order)", "return_statement": "return a, E[-1], ref", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "np", ".", "array", "(", "arg_0", ")", "arg_3", "=", "len", "(", "arg_2", ")", "if", "arg_1", "<=", "0.", ":", "raise", "ValueError", "(", "\"order must be > 0\"", ")", "arg_4", "=", "sum", "(", "abs", "(", "arg_2", ")", "**", "2.", ")", "/", "arg_3", "arg_5", "=", "arg_4", "*", "2.", "*", "arg_3", "arg_6", "=", "np", ".", "zeros", "(", "arg_3", ",", "dtype", "=", "complex", ")", "arg_7", "=", "np", ".", "zeros", "(", "arg_3", ",", "dtype", "=", "complex", ")", "for", "arg_8", "in", "range", "(", "0", ",", "arg_3", ")", ":", "arg_6", "[", "arg_8", "]", "=", "arg_2", "[", "arg_8", "]", "arg_7", "[", "arg_8", "]", "=", "arg_2", "[", "arg_8", "]", "arg_9", "=", "np", ".", "zeros", "(", "1", ",", "dtype", "=", "complex", ")", "arg_9", "[", "0", "]", "=", "1", "arg_10", "=", "np", ".", "zeros", "(", "arg_1", ",", "dtype", "=", "complex", ")", "arg_11", "=", "1.", "arg_12", "=", "np", ".", "zeros", "(", "arg_1", "+", "1", ")", "arg_12", "[", "0", "]", "=", "arg_4", "for", "arg_13", "in", "range", "(", "0", ",", "arg_1", ")", ":", "arg_14", "=", "arg_6", "[", "1", ":", "]", "arg_15", "=", "arg_7", "[", "0", ":", "-", "1", "]", "arg_16", "=", "-", "2.", "*", "np", ".", "dot", "(", "arg_15", ".", "conj", "(", ")", ".", "transpose", "(", ")", ",", "arg_14", ")", "arg_5", "=", "np", ".", "dot", "(", "arg_14", ".", "conj", "(", ")", ".", "transpose", "(", ")", ",", "arg_14", ")", "arg_5", "+=", "np", ".", "dot", "(", "arg_15", ",", "arg_15", ".", "conj", "(", ")", ".", "transpose", "(", ")", ")", "arg_10", "[", "arg_13", "]", "=", "arg_16", "/", "arg_5", "arg_6", "=", "arg_14", "+", "arg_10", "[", "arg_13", "]", "*", "arg_15", "arg_7", "=", "arg_15", "+", "arg_10", "[", "arg_13", "]", ".", "conj", "(", ")", ".", "transpose", "(", ")", "*", "arg_14", "arg_9", ".", "resize", "(", "len", "(", "arg_9", ")", "+", "1", ")", "arg_9", "=", "arg_9", "+", "arg_10", "[", "arg_13", "]", "*", "np", ".", "flipud", "(", "arg_9", ")", ".", "conjugate", "(", ")", "arg_12", "[", "arg_13", "+", "1", "]", "=", "(", "1", "-", "arg_10", "[", "arg_13", "]", ".", "conj", "(", ")", ".", "transpose", "(", ")", "*", "arg_10", "[", "arg_13", "]", ")", "*", "arg_12", "[", "arg_13", "]", "return", "arg_9", ",", "arg_12", "[", "-", "1", "]", ",", "arg_10"], "function": "def Func(arg_0, arg_1):\n    \"\"\"This version is 10 times faster than arburg, but the output rho is not correct.\n\n\n    returns [1 a0,a1, an-1]\n\n    \"\"\"\n    arg_2 = np.array(arg_0)\n    arg_3 = len(arg_2)\n\n    if arg_1 <= 0.:\n        raise ValueError(\"order must be > 0\")\n\n    # Initialisation\n    # ------ rho, den\n    arg_4 = sum(abs(arg_2)**2.) / arg_3  # Eq 8.21 [Marple]_\n    arg_5 = arg_4 * 2. * arg_3\n\n    # ------ backward and forward errors\n    arg_6 = np.zeros(arg_3, dtype=complex)\n    arg_7 = np.zeros(arg_3, dtype=complex)\n    for arg_8 in range(0, arg_3):  #eq 8.11\n        arg_6[arg_8] = arg_2[arg_8]\n        arg_7[arg_8] = arg_2[arg_8]\n\n    # AR order to be stored\n    arg_9 = np.zeros(1, dtype=complex)\n    arg_9[0] = 1\n    # ---- rflection coeff to be stored\n    arg_10 = np.zeros(arg_1, dtype=complex)\n\n    arg_11 = 1.\n    arg_12 = np.zeros(arg_1+1)\n    arg_12[0] = arg_4\n\n    for arg_13 in range(0, arg_1):\n        #print m\n        # Calculate the next order reflection (parcor) coefficient\n        arg_14 = arg_6[1:]\n        arg_15 = arg_7[0:-1]\n        #print efp, ebp\n        arg_16 = -2.* np.dot(arg_15.conj().transpose(),  arg_14)\n        arg_5 = np.dot(arg_14.conj().transpose(),  arg_14)\n        arg_5 += np.dot(arg_15,  arg_15.conj().transpose())\n        arg_10[arg_13] = arg_16 / arg_5\n\n        # Update the forward and backward prediction errors\n        arg_6 = arg_14 + arg_10[arg_13] * arg_15\n        arg_7 = arg_15 + arg_10[arg_13].conj().transpose() * arg_14\n\n        # Update the AR coeff.\n        arg_9.resize(len(arg_9)+1)\n        arg_9 = arg_9 + arg_10[arg_13] * np.flipud(arg_9).conjugate()\n\n        # Update the prediction error\n        arg_12[arg_13+1] = (1 - arg_10[arg_13].conj().transpose()*arg_10[arg_13]) * arg_12[arg_13]\n        #print 'REF', ref, num, den\n    return arg_9, arg_12[-1], arg_10", "path": "src/spectrum/burg.py", "identifier": "_arburg2", "docstring": "This version is 10 times faster than arburg, but the output rho is not correct.\n\n\n    returns [1 a0,a1, an-1]", "docstring_tokens": ["This", "version", "is", "10", "times", "faster", "than", "arburg", "but", "the", "output", "rho", "is", "not", "correct", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 260571}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/trimmomatic.py#L113-L179", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Retrieves some statistics from a single Trimmomatic log file.", "language": "python", "parameters": "(log_file)", "return_statement": "return template", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "OrderedDict", "(", "[", "(", "\"clean_len\"", ",", "0", ")", ",", "(", "\"total_trim\"", ",", "0", ")", ",", "(", "\"total_trim_perc\"", ",", "0", ")", ",", "(", "\"5trim\"", ",", "0", ")", ",", "(", "\"3trim\"", ",", "0", ")", ",", "(", "\"bad_reads\"", ",", "0", ")", "]", ")", "with", "open", "(", "arg_0", ")", "as", "fh", ":", "for", "arg_2", "in", "fh", ":", "arg_3", "=", "[", "int", "(", "x", ")", "for", "x", "in", "arg_2", ".", "strip", "(", ")", ".", "split", "(", ")", "[", "-", "4", ":", "]", "]", "if", "not", "arg_3", "[", "0", "]", ":", "arg_1", "[", "\"bad_reads\"", "]", "+=", "1", "arg_1", "[", "\"5trim\"", "]", "+=", "arg_3", "[", "1", "]", "arg_1", "[", "\"3trim\"", "]", "+=", "arg_3", "[", "3", "]", "arg_1", "[", "\"total_trim\"", "]", "+=", "arg_3", "[", "1", "]", "+", "arg_3", "[", "3", "]", "arg_1", "[", "\"clean_len\"", "]", "+=", "arg_3", "[", "0", "]", "arg_4", "=", "arg_1", "[", "\"clean_len\"", "]", "+", "arg_1", "[", "\"total_trim\"", "]", "if", "arg_4", ":", "arg_1", "[", "\"total_trim_perc\"", "]", "=", "round", "(", "(", "arg_1", "[", "\"total_trim\"", "]", "/", "arg_4", ")", "*", "100", ",", "2", ")", "else", ":", "arg_1", "[", "\"total_trim_perc\"", "]", "=", "0", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Retrieves some statistics from a single Trimmomatic log file.\n\n    This function parses Trimmomatic's log file and stores some trimming\n    statistics in an :py:class:`OrderedDict` object. This object contains\n    the following keys:\n\n        - ``clean_len``: Total length after trimming.\n        - ``total_trim``: Total trimmed base pairs.\n        - ``total_trim_perc``: Total trimmed base pairs in percentage.\n        - ``5trim``: Total base pairs trimmed at 5' end.\n        - ``3trim``: Total base pairs trimmed at 3' end.\n\n    Parameters\n    ----------\n    log_file : str\n        Path to trimmomatic log file.\n\n    Returns\n    -------\n    x : :py:class:`OrderedDict`\n        Object storing the trimming statistics.\n\n    \"\"\"\n\n    arg_1 = OrderedDict([\n        # Total length after trimming\n        (\"clean_len\", 0),\n        # Total trimmed base pairs\n        (\"total_trim\", 0),\n        # Total trimmed base pairs in percentage\n        (\"total_trim_perc\", 0),\n        # Total trimmed at 5' end\n        (\"5trim\", 0),\n        # Total trimmed at 3' end\n        (\"3trim\", 0),\n        # Bad reads (completely trimmed)\n        (\"bad_reads\", 0)\n    ])\n\n    with open(arg_0) as fh:\n\n        for arg_2 in fh:\n            # This will split the log fields into:\n            # 0. read length after trimming\n            # 1. amount trimmed from the start\n            # 2. last surviving base\n            # 3. amount trimmed from the end\n            arg_3 = [int(x) for x in arg_2.strip().split()[-4:]]\n\n            if not arg_3[0]:\n                arg_1[\"bad_reads\"] += 1\n\n            arg_1[\"5trim\"] += arg_3[1]\n            arg_1[\"3trim\"] += arg_3[3]\n            arg_1[\"total_trim\"] += arg_3[1] + arg_3[3]\n            arg_1[\"clean_len\"] += arg_3[0]\n\n        arg_4 = arg_1[\"clean_len\"] + arg_1[\"total_trim\"]\n\n        if arg_4:\n            arg_1[\"total_trim_perc\"] = round(\n                (arg_1[\"total_trim\"] / arg_4) * 100, 2)\n        else:\n            arg_1[\"total_trim_perc\"] = 0\n\n    return arg_1", "path": "flowcraft/templates/trimmomatic.py", "identifier": "parse_log", "docstring": "Retrieves some statistics from a single Trimmomatic log file.\n\n    This function parses Trimmomatic's log file and stores some trimming\n    statistics in an :py:class:`OrderedDict` object. This object contains\n    the following keys:\n\n        - ``clean_len``: Total length after trimming.\n        - ``total_trim``: Total trimmed base pairs.\n        - ``total_trim_perc``: Total trimmed base pairs in percentage.\n        - ``5trim``: Total base pairs trimmed at 5' end.\n        - ``3trim``: Total base pairs trimmed at 3' end.\n\n    Parameters\n    ----------\n    log_file : str\n        Path to trimmomatic log file.\n\n    Returns\n    -------\n    x : :py:class:`OrderedDict`\n        Object storing the trimming statistics.", "docstring_tokens": ["Retrieves", "some", "statistics", "from", "a", "single", "Trimmomatic", "log", "file", "."], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 260572}
{"url": "https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L251-L295", "sha": "86dc1ab27ce82dcc091ce127416cc3ee219e9bec", "docstring_summary": "Parses ssh options string.", "language": "python", "parameters": "(self, options)", "return_statement": "return parsed_options", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "arg_3", "=", "{", "}", "def", "parse_add_single_option", "(", "arg_4", ")", ":", "if", "\"=\"", "in", "arg_4", ":", "arg_5", ",", "arg_6", "=", "arg_4", ".", "split", "(", "\"=\"", ",", "1", ")", "arg_6", "=", "arg_6", ".", "replace", "(", "'\"'", ",", "''", ")", "else", ":", "arg_5", "=", "arg_4", "arg_6", "=", "True", "if", "\" \"", "in", "arg_5", "or", "not", "arg_0", ".", "OPTION_NAME_RE", ".", "match", "(", "arg_5", ")", ":", "raise", "InvalidOptionNameError", "(", "\"%s is not valid option name.\"", "%", "arg_5", ")", "if", "arg_0", ".", "strict_mode", ":", "for", "arg_7", ",", "arg_8", "in", "arg_0", ".", "OPTIONS_SPEC", ":", "if", "arg_5", ".", "lower", "(", ")", "==", "arg_7", ":", "if", "arg_8", "and", "arg_6", "is", "True", ":", "raise", "MissingMandatoryOptionValueError", "(", "\"%s is missing mandatory value.\"", "%", "arg_5", ")", "break", "else", ":", "raise", "UnknownOptionNameError", "(", "\"%s is unrecognized option name.\"", "%", "arg_5", ")", "if", "arg_5", "not", "in", "arg_3", ":", "arg_3", "[", "arg_5", "]", "=", "[", "]", "arg_3", "[", "arg_5", "]", ".", "append", "(", "arg_6", ")", "arg_9", "=", "0", "arg_10", "=", "1", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_1", ")", ":", "if", "arg_11", "==", "'\"'", ":", "arg_2", "=", "not", "arg_2", "if", "arg_2", ":", "continue", "if", "arg_11", "==", "\",\"", ":", "arg_4", "=", "arg_1", "[", "arg_9", ":", "arg_10", "]", "parse_add_single_option", "(", "arg_4", ")", "arg_9", "=", "arg_10", "+", "1", "if", "arg_9", "+", "1", "!=", "arg_10", ":", "arg_4", "=", "arg_1", "[", "arg_9", ":", "]", "parse_add_single_option", "(", "arg_4", ")", "if", "arg_2", ":", "raise", "InvalidOptionsError", "(", "\"Unbalanced quotes.\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parses ssh options string.\"\"\"\n        arg_2 = False\n        arg_3 = {}\n\n        def parse_add_single_option(arg_4):\n            \"\"\"Parses and validates a single option, and adds it to parsed_options field.\"\"\"\n            if \"=\" in arg_4:\n                arg_5, arg_6 = arg_4.split(\"=\", 1)\n                arg_6 = arg_6.replace('\"', '')\n            else:\n                arg_5 = arg_4\n                arg_6 = True\n            if \" \" in arg_5 or not arg_0.OPTION_NAME_RE.match(arg_5):\n                raise InvalidOptionNameError(\"%s is not valid option name.\" % arg_5)\n            if arg_0.strict_mode:\n                for arg_7, arg_8 in arg_0.OPTIONS_SPEC:\n                    if arg_5.lower() == arg_7:\n                        if arg_8 and arg_6 is True:\n                            raise MissingMandatoryOptionValueError(\"%s is missing mandatory value.\" % arg_5)\n                        break\n                else:\n                    raise UnknownOptionNameError(\"%s is unrecognized option name.\" % arg_5)\n            if arg_5 not in arg_3:\n                arg_3[arg_5] = []\n            arg_3[arg_5].append(arg_6)\n\n        arg_9 = 0\n        arg_10 = 1  # Need to be set for empty options strings\n        for arg_10, arg_11 in enumerate(arg_1):\n            if arg_11 == '\"':  # only double quotes are allowed, no need to care about single quotes\n                arg_2 = not arg_2\n            if arg_2:\n                continue\n            if arg_11 == \",\":\n                arg_4 = arg_1[arg_9:arg_10]\n                parse_add_single_option(arg_4)\n                arg_9 = arg_10 + 1\n                # Data begins after the first space\n        if arg_9 + 1 != arg_10:\n            arg_4 = arg_1[arg_9:]\n            parse_add_single_option(arg_4)\n        if arg_2:\n            raise InvalidOptionsError(\"Unbalanced quotes.\")\n        return arg_3", "path": "sshpubkeys/keys.py", "identifier": "SSHKey.parse_options", "docstring": "Parses ssh options string.", "docstring_tokens": ["Parses", "ssh", "options", "string", "."], "nwo": "ojarva/python-sshpubkeys", "score": 0.19584428074165744, "idx": 260573}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/databuffer.py#L265-L286", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Retrieve pandas object or group of Numpy ndarrays\n        stored in file", "language": "python", "parameters": "(self, key)", "return_statement": "return self._read_array(node)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "Func_node", "(", "arg_1", ")", "if", "arg_2", "is", "None", ":", "raise", "KeyError", "(", "'No object named %s in the file'", "%", "arg_1", ")", "if", "hasattr", "(", "arg_2", ",", "'attrs'", ")", ":", "if", "'pandas_type'", "in", "arg_2", ".", "attrs", ":", "return", "arg_0", ".", "_read_group", "(", "arg_2", ")", "return", "arg_0", ".", "_read_array", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Retrieve pandas object or group of Numpy ndarrays\n        stored in file\n\n        Parameters\n        ----------\n        key : object\n\n        Returns\n        -------\n        obj : type of object stored in file\n        \"\"\"\n        arg_2 = arg_0.Func_node(arg_1)\n        if arg_2 is None:\n            raise KeyError('No object named %s in the file' % arg_1)\n\n        if hasattr(arg_2, 'attrs'):\n            if 'pandas_type' in arg_2.attrs:\n                return arg_0._read_group(arg_2)\n\n        return arg_0._read_array(arg_2)", "path": "boyle/databuffer.py", "identifier": "NumpyHDFStore.get", "docstring": "Retrieve pandas object or group of Numpy ndarrays\n        stored in file\n\n        Parameters\n        ----------\n        key : object\n\n        Returns\n        -------\n        obj : type of object stored in file", "docstring_tokens": ["Retrieve", "pandas", "object", "or", "group", "of", "Numpy", "ndarrays", "stored", "in", "file"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 260574}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py#L30-L48", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Send a request. Use the request information to see if it\n        exists in the cache and cache the response if we need to and can.", "language": "python", "parameters": "(self, request, **kw)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_1", ".", "method", "==", "'GET'", ":", "arg_3", "=", "arg_0", ".", "controller", ".", "cached_request", "(", "arg_1", ")", "if", "arg_3", ":", "return", "arg_0", ".", "build_response", "(", "arg_1", ",", "arg_3", ",", "from_cache", "=", "True", ")", "arg_1", ".", "headers", ".", "update", "(", "arg_0", ".", "controller", ".", "conditional_headers", "(", "arg_1", ")", ")", "arg_4", "=", "super", "(", "CacheControlAdapter", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "**", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Send a request. Use the request information to see if it\n        exists in the cache and cache the response if we need to and can.\n        \"\"\"\n        if arg_1.method == 'GET':\n            arg_3 = arg_0.controller.cached_request(arg_1)\n            if arg_3:\n                return arg_0.build_response(arg_1, arg_3,\n                                           from_cache=True)\n\n            # check for etags and add headers if appropriate\n            arg_1.headers.update(\n                arg_0.controller.conditional_headers(arg_1)\n            )\n\n        arg_4 = super(CacheControlAdapter, arg_0).Func(arg_1, **arg_2)\n\n        return arg_4", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", "identifier": "CacheControlAdapter.send", "docstring": "Send a request. Use the request information to see if it\n        exists in the cache and cache the response if we need to and can.", "docstring_tokens": ["Send", "a", "request", ".", "Use", "the", "request", "information", "to", "see", "if", "it", "exists", "in", "the", "cache", "and", "cache", "the", "response", "if", "we", "need", "to", "and", "can", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260575}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/capacity.py#L196-L245", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Applies quadratic volumeshare slippage model to daily returns based\n    on the proportion of the observed historical daily bar dollar volume\n    consumed by the strategy's trades. Scales the size of trades based\n    on the ratio of the starting capital we wish to test to the starting\n    capital of the passed backtest data.", "language": "python", "parameters": "(returns, txn_daily, simulate_starting_capital,\n                           backtest_starting_capital, impact=0.1)", "return_statement": "return adj_returns", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0.1", ")", ":", "arg_5", "=", "arg_2", "/", "arg_3", "arg_6", "=", "abs", "(", "arg_5", "*", "arg_1", ".", "amount", ")", "arg_7", "=", "arg_1", ".", "price", "*", "arg_6", "arg_8", "=", "arg_6", "/", "arg_1", ".", "volume", "arg_9", "=", "arg_8", "**", "2", "*", "arg_4", "*", "arg_7", "arg_10", "=", "arg_9", ".", "resample", "(", "'D'", ")", ".", "sum", "(", ")", "arg_10", "=", "arg_10", ".", "reindex", "(", "arg_0", ".", "index", ")", ".", "fillna", "(", "0", ")", "arg_11", "=", "ep", ".", "cum_returns", "(", "arg_0", ",", "starting_value", "=", "arg_3", ")", "*", "arg_5", "arg_12", "=", "arg_0", "-", "(", "arg_10", "/", "arg_11", ")", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2,\n                           arg_3, arg_4=0.1):\n    \"\"\"\n    Applies quadratic volumeshare slippage model to daily returns based\n    on the proportion of the observed historical daily bar dollar volume\n    consumed by the strategy's trades. Scales the size of trades based\n    on the ratio of the starting capital we wish to test to the starting\n    capital of the passed backtest data.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Time series of daily returns.\n    txn_daily : pd.Series\n        Daily transaciton totals, closing price, and daily volume for\n        each traded name. See price_volume_daily_txns for more details.\n    simulate_starting_capital : integer\n        capital at which we want to test\n    backtest_starting_capital: capital base at which backtest was\n        origionally run. impact: See Zipline volumeshare slippage model\n    impact : float\n        Scales the size of the slippage penalty.\n\n    Returns\n    -------\n    adj_returns : pd.Series\n        Slippage penalty adjusted daily returns.\n    \"\"\"\n\n    arg_5 = arg_2 / arg_3\n    arg_6 = abs(arg_5 * arg_1.amount)\n    arg_7 = arg_1.price * arg_6\n    arg_8 = arg_6 / arg_1.volume\n\n    arg_9 = arg_8**2 \\\n        * arg_4 * arg_7\n\n    arg_10 = arg_9.resample('D').sum()\n    arg_10 = arg_10.reindex(arg_0.index).fillna(0)\n\n    # Since we are scaling the numerator of the penalties linearly\n    # by capital base, it makes the most sense to scale the denominator\n    # similarly. In other words, since we aren't applying compounding to\n    # simulate_traded_shares, we shouldn't apply compounding to pv.\n    arg_11 = ep.cum_returns(\n        arg_0, starting_value=arg_3) * arg_5\n\n    arg_12 = arg_0 - (arg_10 / arg_11)\n\n    return arg_12", "path": "pyfolio/capacity.py", "identifier": "apply_slippage_penalty", "docstring": "Applies quadratic volumeshare slippage model to daily returns based\n    on the proportion of the observed historical daily bar dollar volume\n    consumed by the strategy's trades. Scales the size of trades based\n    on the ratio of the starting capital we wish to test to the starting\n    capital of the passed backtest data.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Time series of daily returns.\n    txn_daily : pd.Series\n        Daily transaciton totals, closing price, and daily volume for\n        each traded name. See price_volume_daily_txns for more details.\n    simulate_starting_capital : integer\n        capital at which we want to test\n    backtest_starting_capital: capital base at which backtest was\n        origionally run. impact: See Zipline volumeshare slippage model\n    impact : float\n        Scales the size of the slippage penalty.\n\n    Returns\n    -------\n    adj_returns : pd.Series\n        Slippage penalty adjusted daily returns.", "docstring_tokens": ["Applies", "quadratic", "volumeshare", "slippage", "model", "to", "daily", "returns", "based", "on", "the", "proportion", "of", "the", "observed", "historical", "daily", "bar", "dollar", "volume", "consumed", "by", "the", "strategy", "s", "trades", ".", "Scales", "the", "size", "of", "trades", "based", "on", "the", "ratio", "of", "the", "starting", "capital", "we", "wish", "to", "test", "to", "the", "starting", "capital", "of", "the", "passed", "backtest", "data", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260576}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/transmitters/content_metadata.py#L188-L207", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Create ContentMetadataItemTransmision models for the given content metadata items.", "language": "python", "parameters": "(self, content_metadata_item_map)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "apps", ".", "get_model", "(", "'integrated_channel'", ",", "'ContentMetadataItemTransmission'", ")", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "arg_1", ".", "items", "(", ")", ":", "arg_3", ".", "append", "(", "arg_2", "(", "enterprise_customer", "=", "arg_0", ".", "enterprise_configuration", ".", "enterprise_customer", ",", "integrated_channel_code", "=", "arg_0", ".", "enterprise_configuration", ".", "channel_code", "(", ")", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", ")", "arg_2", ".", "objects", ".", "bulk_create", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create ContentMetadataItemTransmision models for the given content metadata items.\n        \"\"\"\n        # pylint: disable=invalid-name\n        arg_2 = apps.get_model(\n            'integrated_channel',\n            'ContentMetadataItemTransmission'\n        )\n        arg_3 = []\n        for arg_4, arg_5 in arg_1.items():\n            arg_3.append(\n                arg_2(\n                    enterprise_customer=arg_0.enterprise_configuration.enterprise_customer,\n                    integrated_channel_code=arg_0.enterprise_configuration.channel_code(),\n                    arg_4=arg_4,\n                    arg_5=arg_5\n                )\n            )\n        arg_2.objects.bulk_create(arg_3)", "path": "integrated_channels/integrated_channel/transmitters/content_metadata.py", "identifier": "ContentMetadataTransmitter._create_transmissions", "docstring": "Create ContentMetadataItemTransmision models for the given content metadata items.", "docstring_tokens": ["Create", "ContentMetadataItemTransmision", "models", "for", "the", "given", "content", "metadata", "items", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260577}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/Bfg/worker.py#L62-L79", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "Say the workers to finish their jobs and quit.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "quit", ".", "set", "(", ")", "while", "sorted", "(", "[", "arg_0", ".", "pool", "[", "arg_1", "]", ".", "is_alive", "(", ")", "for", "arg_1", "in", "xrange", "(", "len", "(", "arg_0", ".", "pool", ")", ")", "]", ")", "[", "-", "1", "]", ":", "time", ".", "sleep", "(", "1", ")", "try", ":", "while", "not", "arg_0", ".", "task_queue", ".", "empty", "(", ")", ":", "arg_0", ".", "task_queue", ".", "get", "(", "timeout", "=", "0.1", ")", "arg_0", ".", "task_queue", ".", "close", "(", ")", "arg_0", ".", "feeder", ".", "join", "(", ")", "except", "Exception", "as", "ex", ":", "logger", ".", "info", "(", "ex", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Say the workers to finish their jobs and quit.\n        \"\"\"\n        arg_0.quit.set()\n        # yapf:disable\n        while sorted([\n                arg_0.pool[arg_1].is_alive()\n                for arg_1 in xrange(len(arg_0.pool))])[-1]:\n            time.sleep(1)\n        # yapf:enable\n        try:\n            while not arg_0.task_queue.empty():\n                arg_0.task_queue.get(timeout=0.1)\n            arg_0.task_queue.close()\n            arg_0.feeder.join()\n        except Exception as ex:\n            logger.info(ex)", "path": "yandextank/plugins/Bfg/worker.py", "identifier": "BFGBase.stop", "docstring": "Say the workers to finish their jobs and quit.", "docstring_tokens": ["Say", "the", "workers", "to", "finish", "their", "jobs", "and", "quit", "."], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 260578}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/reboot.py#L11-L21", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "async function to reboot QTM cameras", "language": "python", "parameters": "(ip_address)", "return_statement": "", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "await", "asyncio", ".", "get_event_loop", "(", ")", ".", "create_datagram_endpoint", "(", "QRebootProtocol", ",", "local_addr", "=", "(", "arg_0", ",", "0", ")", ",", "allow_broadcast", "=", "True", ",", "reuse_address", "=", "True", ",", ")", "LOG", ".", "info", "(", "\"Sending Func on %s\"", ",", "arg_0", ")", "arg_2", ".", "send_Func", "(", ")"], "function": "async def Func(arg_0):\n    \"\"\" async function to Func QTM cameras \"\"\"\n    arg_1, arg_2 = await asyncio.get_event_loop().create_datagram_endpoint(\n        QRebootProtocol,\n        local_addr=(arg_0, 0),\n        allow_broadcast=True,\n        reuse_address=True,\n    )\n\n    LOG.info(\"Sending Func on %s\", arg_0)\n    arg_2.send_Func()", "path": "qtm/reboot.py", "identifier": "reboot", "docstring": "async function to reboot QTM cameras", "docstring_tokens": ["async", "function", "to", "reboot", "QTM", "cameras"], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 260579}
{"url": "https://github.com/agabrown/PyGaia/blob/ae972b0622a15f713ffae471f925eac25ccdae47/examples/relativeParallaxErrorsVsDistance.py#L29-L70", "sha": "ae972b0622a15f713ffae471f925eac25ccdae47", "docstring_summary": "Plot relative parallax errors as a function of distance for stars of a given spectral type.", "language": "python", "parameters": "(pdf=False, png=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "False", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "np", ".", "linspace", "(", "-", "1", ",", "np", ".", "log10", "(", "20.0", ")", ",", "100", ")", "arg_3", "=", "OrderedDict", "(", "[", "(", "'K0V'", ",", "(", "5.58", ",", "0.87", ")", ")", ",", "(", "'G5V'", ",", "(", "4.78", ",", "0.74", ")", ")", ",", "(", "'G0V'", ",", "(", "4.24", ",", "0.67", ")", ")", ",", "(", "'F5V'", ",", "(", "3.50", ",", "0.50", ")", ")", ",", "(", "'F0V'", ",", "(", "2.98", ",", "0.38", ")", ")", ",", "(", "'RC'", ",", "(", "0.8", ",", "1.0", ")", ")", "]", ")", "arg_4", "=", "{", "}", "arg_5", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "10", ",", "6.5", ")", ")", "arg_6", "=", "plt", ".", "gca", "(", ")", "for", "arg_7", "in", "arg_3", ".", "keys", "(", ")", ":", "arg_8", "=", "arg_3", "[", "arg_7", "]", "[", "0", "]", "+", "5.0", "*", "arg_2", "+", "10.0", "arg_9", "=", "(", "arg_8", ">", "14", ")", "&", "(", "arg_8", "<", "16", ")", "arg_10", "=", "arg_8", "+", "gminvFromVmini", "(", "arg_3", "[", "arg_7", "]", "[", "1", "]", ")", "arg_11", "=", "parallaxErrorSkyAvg", "(", "arg_10", ",", "arg_3", "[", "arg_7", "]", "[", "1", "]", ")", "arg_12", "=", "arg_11", "*", "10", "**", "arg_2", "/", "1000.0", "plt", ".", "loglog", "(", "10", "**", "arg_2", ",", "arg_12", ",", "'--k'", ",", "lw", "=", "1", ")", "plt", ".", "loglog", "(", "10", "**", "arg_2", "[", "arg_9", "]", ",", "arg_12", "[", "arg_9", "]", ",", "'-'", ",", "label", "=", "arg_7", ")", "plt", ".", "xlim", "(", "0.1", ",", "20.0", ")", "plt", ".", "ylim", "(", "0.001", ",", "0.5", ")", "plt", ".", "text", "(", "0.9", ",", "0.05", ",", "'Colours indicate $14<V<16$'", ",", "horizontalalignment", "=", "'right'", ",", "verticalalignment", "=", "'bottom'", ",", "transform", "=", "arg_6", ".", "transAxes", ")", "plt", ".", "legend", "(", "loc", "=", "2", ")", "plt", ".", "xlabel", "(", "'distance [kpc]'", ")", "plt", ".", "ylabel", "(", "'$\\\\sigma_\\\\varpi/\\\\varpi$'", ")", "plt", ".", "grid", "(", "which", "=", "'both'", ")", "if", "(", "args", "[", "'pdfOutput'", "]", ")", ":", "plt", ".", "savefig", "(", "'RelativeParallaxErrorsVsDist.pdf'", ")", "elif", "(", "args", "[", "'pngOutput'", "]", ")", ":", "plt", ".", "savefig", "(", "'RelativeParallaxErrorsVsDist.png'", ")", "else", ":", "plt", ".", "show", "(", ")"], "function": "def Func(arg_0=False, arg_1=False):\n  \"\"\"\n  Plot relative parallax errors as a function of distance for stars of a given spectral type.\n\n  Parameters\n  ----------\n\n  args - command line arguments\n  \"\"\"\n  arg_2 = np.linspace(-1,np.log10(20.0),100)\n  arg_3=OrderedDict([('K0V',(5.58,0.87)), ('G5V',(4.78,0.74)), ('G0V',(4.24,0.67)),\n    ('F5V',(3.50,0.50)), ('F0V',(2.98,0.38)), ('RC',(0.8,1.0))])\n  arg_4={}\n\n  arg_5=plt.figure(figsize=(10,6.5))\n  arg_6=plt.gca()\n\n  for arg_7 in arg_3.keys():\n    arg_8=arg_3[arg_7][0]+5.0*arg_2+10.0\n    arg_9=(arg_8>14) & (arg_8<16)\n    arg_10=arg_8+gminvFromVmini(arg_3[arg_7][1])\n    arg_11=parallaxErrorSkyAvg(arg_10,arg_3[arg_7][1])\n    arg_12=arg_11*10**arg_2/1000.0\n    plt.loglog(10**arg_2, arg_12,'--k',lw=1)\n    plt.loglog(10**arg_2[arg_9], arg_12[arg_9],'-',label=arg_7)\n  plt.xlim(0.1,20.0)\n  plt.ylim(0.001,0.5)\n  plt.text(0.9, 0.05,'Colours indicate $14<V<16$',\n     horizontalalignment='right',\n     verticalalignment='bottom',\n     transform = arg_6.transAxes)\n  plt.legend(loc=2)\n  plt.xlabel('distance [kpc]')\n  plt.ylabel('$\\\\sigma_\\\\varpi/\\\\varpi$')\n  plt.grid(which='both')\n  \n  if (args['pdfOutput']):\n    plt.savefig('RelativeParallaxErrorsVsDist.pdf')\n  elif (args['pngOutput']):\n    plt.savefig('RelativeParallaxErrorsVsDist.png')\n  else:\n    plt.show()", "path": "examples/relativeParallaxErrorsVsDistance.py", "identifier": "makePlot", "docstring": "Plot relative parallax errors as a function of distance for stars of a given spectral type.\n\n  Parameters\n  ----------\n\n  args - command line arguments", "docstring_tokens": ["Plot", "relative", "parallax", "errors", "as", "a", "function", "of", "distance", "for", "stars", "of", "a", "given", "spectral", "type", "."], "nwo": "agabrown/PyGaia", "score": 0.39410601089411446, "idx": 260580}
{"url": "https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L254-L266", "sha": "39e4da09f325382e21b0917b1b5cd027edce8728", "docstring_summary": "Check whether a file is presumed hidden, either because\r\n\tthe pathname starts with dot or because the platform\r\n\tindicates such.", "language": "python", "parameters": "(path)", "return_statement": "return name.startswith('.') or platform_hidden(full_path)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "abspath", "(", "arg_0", ")", "arg_2", "=", "os", ".", "path", ".", "basename", "(", "arg_1", ")", "def", "no", "(", "arg_0", ")", ":", "return", "False", "arg_3", "=", "globals", "(", ")", ".", "get", "(", "'Func_'", "+", "platform", ".", "system", "(", ")", ",", "no", ")", "return", "arg_2", ".", "startswith", "(", "'.'", ")", "or", "arg_3", "(", "arg_1", ")"], "function": "def Func(arg_0):\r\n\t\"\"\"\r\n\tCheck whether a file is presumed hidden, either because\r\n\tthe pathname starts with dot or because the platform\r\n\tindicates such.\r\n\t\"\"\"\r\n\targ_1 = os.path.abspath(arg_0)\r\n\targ_2 = os.path.basename(arg_1)\r\n\r\n\tdef no(arg_0):\r\n\t\treturn False\r\n\targ_3 = globals().get('Func_' + platform.system(), no)\r\n\treturn arg_2.startswith('.') or arg_3(arg_1)", "path": "jaraco/path.py", "identifier": "is_hidden", "docstring": "Check whether a file is presumed hidden, either because\r\n\tthe pathname starts with dot or because the platform\r\n\tindicates such.", "docstring_tokens": ["Check", "whether", "a", "file", "is", "presumed", "hidden", "either", "because", "the", "pathname", "starts", "with", "dot", "or", "because", "the", "platform", "indicates", "such", "."], "nwo": "jaraco/jaraco.path", "score": 0.0, "idx": 260581}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1106-L1117", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Set the maximum depth for the certificate chain verification that shall\n        be allowed for this Context object.", "language": "python", "parameters": "(self, depth)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"depth must be an integer\"", ")", "_lib", ".", "SSL_CTX_Func", "(", "arg_0", ".", "_context", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Set the maximum depth for the certificate chain verification that shall\n        be allowed for this Context object.\n\n        :param depth: An integer specifying the verify depth\n        :return: None\n        \"\"\"\n        if not isinstance(arg_1, integer_types):\n            raise TypeError(\"depth must be an integer\")\n\n        _lib.SSL_CTX_Func(arg_0._context, arg_1)", "path": "src/OpenSSL/SSL.py", "identifier": "Context.set_verify_depth", "docstring": "Set the maximum depth for the certificate chain verification that shall\n        be allowed for this Context object.\n\n        :param depth: An integer specifying the verify depth\n        :return: None", "docstring_tokens": ["Set", "the", "maximum", "depth", "for", "the", "certificate", "chain", "verification", "that", "shall", "be", "allowed", "for", "this", "Context", "object", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 260582}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L290-L313", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Execute the given command.", "language": "python", "parameters": "(self)", "return_statement": "return self._decode_output(output)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Popen", "(", "arg_0", ".", "command", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ",", "shell", "=", "True", ")", "(", "arg_2", ",", "arg_3", ")", "=", "arg_1", ".", "communicate", "(", ")", "if", "arg_1", ".", "returncode", "!=", "0", ":", "return", "arg_0", ".", "_decode_output", "(", "arg_3", ")", "return", "arg_0", ".", "_decode_output", "(", "arg_2", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Execute the given command.\n\n        :return: The output of the command.\n        :rtype: str\n        \"\"\"\n\n        # We initiate a process and parse the command to it.\n        arg_1 = Popen(arg_0.command, stdout=PIPE, stderr=PIPE, shell=True)\n\n        # We communicate the command and get the output and the error.\n        (arg_2, arg_3) = arg_1.communicate()\n\n        if arg_1.returncode != 0:  # pragma: no cover\n            # The return code is different to 0.\n\n            # We return the decoded error.\n            return arg_0._decode_output(arg_3)\n\n        # The return code (or exit code if you prefer) if equal to 0.\n\n        # We return the decoded output of the Funcd command.\n        return arg_0._decode_output(arg_2)", "path": "PyFunceble/helpers.py", "identifier": "Command.execute", "docstring": "Execute the given command.\n\n        :return: The output of the command.\n        :rtype: str", "docstring_tokens": ["Execute", "the", "given", "command", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 260583}
{"url": "https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L236-L239", "sha": "a2ee417b784ca72c89c05bddb2e3e815a6b95154", "docstring_summary": "stupidly print an iterable of iterables in TSV format", "language": "python", "parameters": "(table, sep=\"\\t\", file=sys.stdout)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"\\t\"", ",", "arg_2", "=", "arg_3", ".", "stdout", ")", ":", "for", "arg_5", "in", "arg_0", ":", "print", "(", "*", "arg_5", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1=\"\\t\", arg_2=arg_3.stdout):\n    \"\"\"stupidly print an iterable of iterables in TSV format\"\"\"\n    for arg_5 in arg_0:\n        print(*arg_5, arg_1=arg_1, arg_2=arg_2)", "path": "libaaron/libaaron.py", "identifier": "printtsv", "docstring": "stupidly print an iterable of iterables in TSV format", "docstring_tokens": ["stupidly", "print", "an", "iterable", "of", "iterables", "in", "TSV", "format"], "nwo": "ninjaaron/libaaron", "score": 0.3518893757964147, "idx": 260584}
{"url": "https://github.com/hotdogee/gff3-py/blob/d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9/gff3/gff3.py#L887-L908", "sha": "d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9", "docstring_summary": "Marks line_data and all of its associated feature's 'line_status' as 'removed', does not actually remove the line_data from the data structure.\n        The write function checks the 'line_status' when writing the gff file.\n        Find the root parent of line_data of type root_type, remove all of its descendants.\n        If the root parent has a parent with no children after the remove, remove the root parent's parent recursively.", "language": "python", "parameters": "(self, line_data, root_type=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "arg_9", "for", "arg_9", "in", "arg_0", ".", "ancestors", "(", "arg_1", ")", "if", "(", "arg_2", "and", "arg_9", "[", "'line_type'", "]", "==", "arg_2", ")", "or", "(", "not", "arg_2", "and", "not", "arg_9", "[", "'parents'", "]", ")", "]", "or", "[", "arg_1", "]", "for", "arg_4", "in", "arg_3", ":", "arg_4", "[", "'line_status'", "]", "=", "'Funcd'", "arg_5", "=", "arg_0", ".", "descendants", "(", "arg_4", ")", "for", "arg_6", "in", "arg_5", ":", "arg_6", "[", "'line_status'", "]", "=", "'Funcd'", "arg_7", "=", "arg_0", ".", "ancestors", "(", "arg_4", ")", "for", "arg_8", "in", "arg_7", ":", "if", "len", "(", "[", "arg_9", "for", "arg_9", "in", "arg_8", "[", "'children'", "]", "if", "arg_9", "[", "'line_status'", "]", "!=", "'Funcd'", "]", ")", "==", "0", ":", "arg_8", "[", "'line_status'", "]", "=", "'Funcd'"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Marks line_data and all of its associated feature's 'line_status' as 'Funcd', does not actually Func the line_data from the data structure.\n        The write function checks the 'line_status' when writing the gff file.\n        Find the root parent of line_data of type root_type, Func all of its descendants.\n        If the root parent has a parent with no children after the Func, Func the root parent's parent recursively.\n\n        :param line_data:\n        :param root_type:\n        :return:\n        \"\"\"\n        arg_3 = [arg_9 for arg_9 in arg_0.ancestors(arg_1) if (arg_2 and arg_9['line_type'] == arg_2) or (not arg_2 and not arg_9['parents'])] or [arg_1]\n        for arg_4 in arg_3:\n            arg_4['line_status'] = 'Funcd'\n            arg_5 = arg_0.descendants(arg_4)\n            for arg_6 in arg_5:\n                arg_6['line_status'] = 'Funcd'\n            arg_7 = arg_0.ancestors(arg_4) # BFS, so we will process closer ancestors first\n            for arg_8 in arg_7:\n                if len([arg_9 for arg_9 in arg_8['children'] if arg_9['line_status'] != 'Funcd']) == 0: # if all children of a root_ancestor is Funcd\n                    # Func this root_ancestor\n                    arg_8['line_status'] = 'Funcd'", "path": "gff3/gff3.py", "identifier": "Gff3.remove", "docstring": "Marks line_data and all of its associated feature's 'line_status' as 'removed', does not actually remove the line_data from the data structure.\n        The write function checks the 'line_status' when writing the gff file.\n        Find the root parent of line_data of type root_type, remove all of its descendants.\n        If the root parent has a parent with no children after the remove, remove the root parent's parent recursively.\n\n        :param line_data:\n        :param root_type:\n        :return:", "docstring_tokens": ["Marks", "line_data", "and", "all", "of", "its", "associated", "feature", "s", "line_status", "as", "removed", "does", "not", "actually", "remove", "the", "line_data", "from", "the", "data", "structure", ".", "The", "write", "function", "checks", "the", "line_status", "when", "writing", "the", "gff", "file", ".", "Find", "the", "root", "parent", "of", "line_data", "of", "type", "root_type", "remove", "all", "of", "its", "descendants", ".", "If", "the", "root", "parent", "has", "a", "parent", "with", "no", "children", "after", "the", "remove", "remove", "the", "root", "parent", "s", "parent", "recursively", "."], "nwo": "hotdogee/gff3-py", "score": 0.18384731799856882, "idx": 260585}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/fill_triangular.py#L135-L153", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Convert a vector size to a matrix size.", "language": "python", "parameters": "(d, validate_args, name=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "isinstance", "(", "arg_0", ",", "(", "float", ",", "int", ",", "np", ".", "generic", ",", "np", ".", "ndarray", ")", ")", ":", "arg_3", "=", "(", "-", "1", "+", "np", ".", "sqrt", "(", "1", "+", "8", "*", "arg_0", ")", ")", "/", "2.", "if", "float", "(", "int", "(", "arg_3", ")", ")", "!=", "arg_3", ":", "raise", "ValueError", "(", "\"Vector length is not a triangular number.\"", ")", "return", "int", "(", "arg_3", ")", "else", ":", "with", "tf", ".", "name_scope", "(", "arg_2", "or", "\"Func\"", ")", "as", "arg_2", ":", "arg_3", "=", "(", "-", "1.", "+", "tf", ".", "sqrt", "(", "1", "+", "8.", "*", "tf", ".", "cast", "(", "arg_0", ",", "dtype", "=", "tf", ".", "float32", ")", ")", ")", "/", "2.", "if", "arg_1", ":", "with", "tf", ".", "control_dependencies", "(", "[", "assert_util", ".", "assert_equal", "(", "tf", ".", "cast", "(", "tf", ".", "cast", "(", "arg_3", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "dtype", "=", "tf", ".", "float32", ")", ",", "arg_3", ",", "message", "=", "\"Vector length is not a triangular number\"", ")", "]", ")", ":", "arg_3", "=", "tf", ".", "identity", "(", "arg_3", ")", "return", "tf", ".", "cast", "(", "arg_3", ",", "arg_0", ".", "dtype", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n  \"\"\"Convert a vector size to a matrix size.\"\"\"\n  if isinstance(arg_0, (float, int, np.generic, np.ndarray)):\n    arg_3 = (-1 + np.sqrt(1 + 8 * arg_0)) / 2.\n    if float(int(arg_3)) != arg_3:\n      raise ValueError(\"Vector length is not a triangular number.\")\n    return int(arg_3)\n  else:\n    with tf.name_scope(arg_2 or \"Func\") as arg_2:\n      arg_3 = (-1. + tf.sqrt(1 + 8. * tf.cast(arg_0, dtype=tf.float32))) / 2.\n      if arg_1:\n        with tf.control_dependencies([\n            assert_util.assert_equal(\n                tf.cast(tf.cast(arg_3, dtype=tf.int32), dtype=tf.float32),\n                arg_3,\n                message=\"Vector length is not a triangular number\")\n        ]):\n          arg_3 = tf.identity(arg_3)\n      return tf.cast(arg_3, arg_0.dtype)", "path": "tensorflow_probability/python/bijectors/fill_triangular.py", "identifier": "vector_size_to_square_matrix_size", "docstring": "Convert a vector size to a matrix size.", "docstring_tokens": ["Convert", "a", "vector", "size", "to", "a", "matrix", "size", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260586}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/dj.py#L446-L517", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Loads Django settings for the current site and sets them so Django internals can be run.", "language": "python", "parameters": "(self)", "return_statement": "return settings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "arg_2", "=", "{", "}", "arg_3", "=", "[", "'ALLOW_CELERY'", ",", "'DJANGO_SETTINGS_MODULE'", "]", "for", "arg_4", "in", "arg_3", ":", "arg_2", "[", "arg_4", "]", "=", "arg_5", ".", "environ", ".", "get", "(", "arg_4", ")", "try", ":", "if", "arg_1", ".", "env", ".", "local_project_dir", ":", "sys", ".", "path", ".", "insert", "(", "0", ",", "arg_1", ".", "env", ".", "local_project_dir", ")", "arg_5", ".", "environ", "[", "'ALLOW_CELERY'", "]", "=", "'0'", "arg_5", ".", "environ", "[", "'DJANGO_SETTINGS_MODULE'", "]", "=", "arg_1", ".", "format", "(", "arg_1", ".", "env", ".", "settings_module", ")", "try", ":", "import", "django", "django", ".", "setup", "(", ")", "except", "AttributeError", ":", "pass", "arg_7", "=", "arg_0", ".", "get_settings", "(", ")", "try", ":", "from", "django", ".", "contrib", "import", "staticfiles", "from", "django", ".", "conf", "import", "arg_7", "as", "_settings", "if", "arg_7", "is", "not", "None", ":", "for", "arg_8", ",", "arg_9", "in", "arg_7", ".", "__dict__", ".", "items", "(", ")", ":", "setattr", "(", "_settings", ",", "arg_8", ",", "arg_9", ")", "else", ":", "raise", "ImportError", "except", "(", "ImportError", ",", "RuntimeError", ")", ":", "print", "(", "'Unable to load settings.'", ")", "traceback", ".", "print_exc", "(", ")", "finally", ":", "for", "arg_4", ",", "arg_10", "in", "arg_2", ".", "items", "(", ")", ":", "if", "arg_10", "is", "None", ":", "del", "arg_5", ".", "environ", "[", "arg_4", "]", "else", ":", "arg_5", ".", "environ", "[", "arg_4", "]", "=", "arg_10", "return", "arg_7"], "function": "def Func(arg_0):\n        \"\"\"\n        Loads Django settings for the current site and sets them so Django internals can be run.\n        \"\"\"\n        arg_1 = arg_0.local_renderer\n\n        # Save environment variables so we can restore them later.\n        arg_2 = {}\n        arg_3 = ['ALLOW_CELERY', 'DJANGO_SETTINGS_MODULE']\n        for arg_4 in arg_3:\n            arg_2[arg_4] = arg_5.environ.get(arg_4)\n\n        try:\n\n            # Allow us to import local app modules.\n            if arg_1.env.local_project_dir:\n                sys.path.insert(0, arg_1.env.local_project_dir)\n\n            #TODO:remove this once bug in django-celery has been fixed\n            arg_5.environ['ALLOW_CELERY'] = '0'\n\n#             print('settings_module:', r.format(r.env.settings_module))\n            arg_5.environ['DJANGO_SETTINGS_MODULE'] = arg_1.format(arg_1.env.settings_module)\n#             os.environ['CELERY_LOADER'] = 'django'\n#             os.environ['SITE'] = r.genv.SITE or r.genv.default_site\n#             os.environ['ROLE'] = r.genv.ROLE or r.genv.default_role\n\n            # In Django >= 1.7, fixes the error AppRegistryNotReady: Apps aren't loaded yet\n            # Disabling, in Django >= 1.10, throws exception:\n            # RuntimeError: Model class django.contrib.contenttypes.models.ContentType\n            # doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.\n#             try:\n#                 from django.core.wsgi import get_wsgi_application\n#                 application = get_wsgi_application()\n#             except (ImportError, RuntimeError):\n#                 raise\n#                 print('Unable to get wsgi application.')\n#                 traceback.print_exc()\n\n            # In Django >= 1.7, fixes the error AppRegistryNotReady: Apps aren't loaded yet\n            try:\n                import django\n                django.setup()\n            except AttributeError:\n                # This doesn't exist in Django < 1.7, so ignore it.\n                pass\n\n            # Load Django settings.\n            arg_7 = arg_0.get_settings()\n            try:\n                from django.contrib import staticfiles\n                from django.conf import arg_7 as _settings\n\n                # get_settings() doesn't raise ImportError but returns None instead\n                if arg_7 is not None:\n                    for arg_8, arg_9 in arg_7.__dict__.items():\n                        setattr(_settings, arg_8, arg_9)\n                else:\n                    raise ImportError\n            except (ImportError, RuntimeError):\n                print('Unable to load settings.')\n                traceback.print_exc()\n\n        finally:\n            # Restore environment variables.\n            for arg_4, arg_10 in arg_2.items():\n                if arg_10 is None:\n                    del arg_5.environ[arg_4]\n                else:\n                    arg_5.environ[arg_4] = arg_10\n\n        return arg_7", "path": "burlap/dj.py", "identifier": "DjangoSatchel.load_django_settings", "docstring": "Loads Django settings for the current site and sets them so Django internals can be run.", "docstring_tokens": ["Loads", "Django", "settings", "for", "the", "current", "site", "and", "sets", "them", "so", "Django", "internals", "can", "be", "run", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 260587}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/local/local.py#L121-L147", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "If the source files dirpath is the same as dest_dir, a copy\n        is not necessary, and nothing is done. Else a copy is made.", "language": "python", "parameters": "(self, source, dest_dir)", "return_statement": "return local_dest", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", "+", "'/'", "+", "os", ".", "path", ".", "basename", "(", "arg_1", ")", "if", "os", ".", "path", ".", "dirname", "(", "arg_1", ")", "!=", "arg_2", ":", "try", ":", "shutil", ".", "copyfile", "(", "arg_1", ",", "arg_3", ")", "os", ".", "chmod", "(", "arg_3", ",", "0o777", ")", "except", "OSError", "as", "e", ":", "raise", "FileCopyException", "(", "e", ",", "arg_0", ".", "hostname", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        ''' If the source files dirpath is the same as dest_dir, a copy\n        is not necessary, and nothing is done. Else a copy is made.\n\n        Args:\n            - source (string) : Path to the source file\n            - dest_dir (string) : Path to the directory to which the files is to be copied\n\n        Returns:\n            - destination_path (String) : Absolute path of the destination file\n\n        Raises:\n            - FileCopyException : If file copy failed.\n        '''\n\n        arg_3 = arg_2 + '/' + os.path.basename(arg_1)\n\n        # Only attempt to copy if the target dir and source dir are different\n        if os.path.dirname(arg_1) != arg_2:\n            try:\n                shutil.copyfile(arg_1, arg_3)\n                os.chmod(arg_3, 0o777)\n\n            except OSError as e:\n                raise FileCopyException(e, arg_0.hostname)\n\n        return arg_3", "path": "parsl/channels/local/local.py", "identifier": "LocalChannel.push_file", "docstring": "If the source files dirpath is the same as dest_dir, a copy\n        is not necessary, and nothing is done. Else a copy is made.\n\n        Args:\n            - source (string) : Path to the source file\n            - dest_dir (string) : Path to the directory to which the files is to be copied\n\n        Returns:\n            - destination_path (String) : Absolute path of the destination file\n\n        Raises:\n            - FileCopyException : If file copy failed.", "docstring_tokens": ["If", "the", "source", "files", "dirpath", "is", "the", "same", "as", "dest_dir", "a", "copy", "is", "not", "necessary", "and", "nothing", "is", "done", ".", "Else", "a", "copy", "is", "made", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 260588}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/streamlet.py#L150-L156", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Calls consume_function for each element of this streamlet. This function returns nothing", "language": "python", "parameters": "(self, consume_function)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "heronpy", ".", "streamlet", ".", "impl", ".", "Funcbolt", "import", "ConsumeStreamlet", "arg_2", "=", "ConsumeStreamlet", "(", "arg_1", ",", "arg_0", ")", "arg_0", ".", "_add_child", "(", "arg_2", ")", "return"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Calls Func_function for each element of this streamlet. This function returns nothing\n    \"\"\"\n    from heronpy.streamlet.impl.Funcbolt import ConsumeStreamlet\n    arg_2 = ConsumeStreamlet(arg_1, arg_0)\n    arg_0._add_child(arg_2)\n    return", "path": "heronpy/streamlet/streamlet.py", "identifier": "Streamlet.consume", "docstring": "Calls consume_function for each element of this streamlet. This function returns nothing", "docstring_tokens": ["Calls", "consume_function", "for", "each", "element", "of", "this", "streamlet", ".", "This", "function", "returns", "nothing"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260589}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/preprocessing/elastic_distortion.py#L17-L54", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "This function creates a 2d gaussian kernel with the standard deviation\n    denoted by sigma", "language": "python", "parameters": "(dim, sigma)", "return_statement": "return kernel/sum(sum(kernel))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", "%", "2", "==", "0", ":", "raise", "ValueError", "(", "\"Kernel dimension should be odd\"", ")", "arg_2", "=", "np", ".", "zeros", "(", "(", "arg_0", ",", "arg_0", ")", ",", "dtype", "=", "np", ".", "float16", ")", "arg_3", "=", "arg_0", "/", "2", "arg_4", "=", "arg_1", "**", "2", "arg_5", "=", "1.", "/", "(", "2", "*", "arg_4", ")", "for", "arg_6", "in", "range", "(", "0", ",", "arg_0", ")", ":", "for", "arg_7", "in", "range", "(", "0", ",", "arg_0", ")", ":", "arg_8", "=", "abs", "(", "arg_6", "-", "arg_3", ")", "arg_9", "=", "abs", "(", "arg_7", "-", "arg_3", ")", "arg_10", "=", "arg_8", "**", "2", "+", "arg_9", "**", "2", "arg_11", "=", "2", "*", "arg_4", "arg_2", "[", "arg_6", ",", "arg_7", "]", "=", "arg_5", "*", "np", ".", "exp", "(", "-", "1.", "*", "arg_10", "/", "arg_11", ")", "return", "arg_2", "/", "sum", "(", "sum", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    This function creates a 2d gaussian kernel with the standard deviation\n    denoted by sigma\n\n    :param dim: integer denoting a side (1-d) of gaussian kernel\n    :param sigma: floating point indicating the standard deviation\n\n    :returns: a numpy 2d array\n    \"\"\"\n\n    # check if the dimension is odd\n    if arg_0 % 2 == 0:\n        raise ValueError(\"Kernel dimension should be odd\")\n\n    # initialize the kernel\n    arg_2 = np.zeros((arg_0, arg_0), dtype=np.float16)\n\n    # calculate the center point\n    arg_3 = arg_0/2\n\n    # calculate the variance\n    arg_4 = arg_1 ** 2\n\n    # calculate the normalization coefficeint\n    arg_5 = 1. / (2 * arg_4)\n\n    # create the kernel\n    for arg_6 in range(0, arg_0):\n        for arg_7 in range(0, arg_0):\n            arg_8 = abs(arg_6 - arg_3)\n            arg_9 = abs(arg_7 - arg_3)\n            arg_10 = arg_8**2 + arg_9**2\n            arg_11 = 2*arg_4\n\n            arg_2[arg_6,arg_7] = arg_5 * np.exp(-1. * arg_10/arg_11)\n\n    return arg_2/sum(sum(arg_2))", "path": "deepy/preprocessing/elastic_distortion.py", "identifier": "create_2d_gaussian", "docstring": "This function creates a 2d gaussian kernel with the standard deviation\n    denoted by sigma\n\n    :param dim: integer denoting a side (1-d) of gaussian kernel\n    :param sigma: floating point indicating the standard deviation\n\n    :returns: a numpy 2d array", "docstring_tokens": ["This", "function", "creates", "a", "2d", "gaussian", "kernel", "with", "the", "standard", "deviation", "denoted", "by", "sigma"], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 260590}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L985-L999", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "The Get Management Certificate operation retrieves information about\n        the management certificate with the specified thumbprint. Management\n        certificates, which are also known as subscription certificates,\n        authenticate clients attempting to connect to resources associated\n        with your Windows Azure subscription.", "language": "python", "parameters": "(self, thumbprint)", "return_statement": "return self._perform_get(\n            '/' + self.subscription_id + '/certificates/' + _str(thumbprint),\n            SubscriptionCertificate)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'thumbprint'", ",", "arg_1", ")", "return", "arg_0", ".", "_perform_get", "(", "'/'", "+", "arg_0", ".", "subscription_id", "+", "'/certificates/'", "+", "_str", "(", "arg_1", ")", ",", "SubscriptionCertificate", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        The Get Management Certificate operation retrieves information about\n        the management certificate with the specified thumbprint. Management\n        certificates, which are also known as subscription certificates,\n        authenticate clients attempting to connect to resources associated\n        with your Windows Azure subscription.\n\n        thumbprint:\n            The thumbprint value of the certificate.\n        '''\n        _validate_not_none('thumbprint', arg_1)\n        return arg_0._perform_get(\n            '/' + arg_0.subscription_id + '/certificates/' + _str(arg_1),\n            SubscriptionCertificate)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.get_management_certificate", "docstring": "The Get Management Certificate operation retrieves information about\n        the management certificate with the specified thumbprint. Management\n        certificates, which are also known as subscription certificates,\n        authenticate clients attempting to connect to resources associated\n        with your Windows Azure subscription.\n\n        thumbprint:\n            The thumbprint value of the certificate.", "docstring_tokens": ["The", "Get", "Management", "Certificate", "operation", "retrieves", "information", "about", "the", "management", "certificate", "with", "the", "specified", "thumbprint", ".", "Management", "certificates", "which", "are", "also", "known", "as", "subscription", "certificates", "authenticate", "clients", "attempting", "to", "connect", "to", "resources", "associated", "with", "your", "Windows", "Azure", "subscription", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260591}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L394-L435", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "return the classified labeling of record", "language": "python", "parameters": "(self, record)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "\"categoryIn\"", ":", "[", "None", "]", ",", "\"bottomUpIn\"", ":", "arg_0", ".", "_getStateAnomalyVector", "(", "arg_1", ")", ",", "}", "arg_3", "=", "{", "\"categoriesOut\"", ":", "numpy", ".", "zeros", "(", "(", "1", ",", ")", ")", ",", "\"bestPrototypeIndices\"", ":", "numpy", ".", "zeros", "(", "(", "1", ",", ")", ")", ",", "\"categoryProbabilitiesOut\"", ":", "numpy", ".", "zeros", "(", "(", "1", ",", ")", ")", "}", "arg_4", "=", "arg_0", ".", "htm_prediction_model", ".", "_getAnomalyClassifier", "(", ")", "arg_5", "=", "arg_4", ".", "getSelf", "(", ")", ".", "_knn", "arg_6", "=", "numpy", ".", "array", "(", "arg_4", ".", "getSelf", "(", ")", ".", "getParameter", "(", "'categoryRecencyList'", ")", ")", "arg_7", "=", "numpy", ".", "where", "(", "(", "arg_6", ">=", "arg_0", ".", "_autoDetectWaitRecords", ")", "&", "(", "arg_6", "<", "arg_1", ".", "ROWID", ")", ")", "[", "0", "]", ".", "tolist", "(", ")", "if", "len", "(", "arg_7", ")", "==", "0", ":", "return", "None", "arg_4", ".", "setParameter", "(", "'inferenceMode'", ",", "True", ")", "arg_4", ".", "setParameter", "(", "'learningMode'", ",", "False", ")", "arg_4", ".", "getSelf", "(", ")", ".", "compute", "(", "arg_2", ",", "arg_3", ")", "arg_4", ".", "setParameter", "(", "'learningMode'", ",", "True", ")", "arg_8", "=", "arg_4", ".", "getSelf", "(", ")", ".", "getLatestDistances", "(", ")", "arg_9", "=", "arg_8", "[", "arg_7", "]", "if", "arg_9", ".", "min", "(", ")", "<=", "arg_0", ".", "_classificationMaxDist", ":", "arg_10", "=", "arg_6", "[", "arg_7", "]", "arg_11", "=", "arg_10", "[", "arg_9", ".", "argmin", "(", ")", "]", "arg_12", "=", "numpy", ".", "where", "(", "arg_6", "==", "arg_11", ")", "[", "0", "]", "[", "0", "]", "arg_13", "=", "arg_4", ".", "getSelf", "(", ")", ".", "getCategoryList", "(", ")", "[", "arg_12", "]", "return", "arg_13", "return", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    return the classified labeling of record\n    \"\"\"\n    arg_2 = {\n      \"categoryIn\": [None],\n      \"bottomUpIn\": arg_0._getStateAnomalyVector(arg_1),\n    }\n\n    arg_3 = {\"categoriesOut\": numpy.zeros((1,)),\n               \"bestPrototypeIndices\":numpy.zeros((1,)),\n               \"categoryProbabilitiesOut\":numpy.zeros((1,))}\n\n    # Run inference only to capture state before learning\n    arg_4 = arg_0.htm_prediction_model._getAnomalyClassifier()\n    arg_5 = arg_4.getSelf()._knn\n\n    # Only use points before record to classify and after the wait period.\n    arg_6 = \\\n      numpy.array(arg_4.getSelf().getParameter('categoryRecencyList'))\n    arg_7 = numpy.where(\n        (arg_6 >= arg_0._autoDetectWaitRecords) &\n        (arg_6 < arg_1.ROWID)\n      )[0].tolist()\n\n    if len(arg_7) == 0:\n      return None\n\n    arg_4.setParameter('inferenceMode', True)\n    arg_4.setParameter('learningMode', False)\n    arg_4.getSelf().compute(arg_2, arg_3)\n    arg_4.setParameter('learningMode', True)\n\n    arg_8 = arg_4.getSelf().getLatestDistances()\n    arg_9 = arg_8[arg_7]\n    if arg_9.min() <= arg_0._classificationMaxDist:\n      arg_10 = arg_6[arg_7]\n      arg_11 = arg_10[arg_9.argmin()]\n      arg_12 = numpy.where(arg_6 == arg_11)[0][0]\n      arg_13 = arg_4.getSelf().getCategoryList()[arg_12]\n      return arg_13\n    return None", "path": "src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py", "identifier": "HTMPredictionModelClassifierHelper._recomputeRecordFromKNN", "docstring": "return the classified labeling of record", "docstring_tokens": ["return", "the", "classified", "labeling", "of", "record"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260592}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/jobs.py#L28-L34", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Adds job to neutron context for use later.", "language": "python", "parameters": "(context, job_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "db_api", ".", "async_transaction_find", "(", "arg_0", ",", "id", "=", "arg_1", ",", "scope", "=", "db_api", ".", "ONE", ")", "if", "not", "arg_2", ":", "return", "arg_0", ".", "async_job", "=", "{", "\"job\"", ":", "v", ".", "_make_job_dict", "(", "arg_2", ")", "}"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Adds job to neutron context for use later.\"\"\"\n    arg_2 = db_api.async_transaction_find(\n        arg_0, id=arg_1, scope=db_api.ONE)\n    if not arg_2:\n        return\n    arg_0.async_job = {\"job\": v._make_job_dict(arg_2)}", "path": "quark/plugin_modules/jobs.py", "identifier": "add_job_to_context", "docstring": "Adds job to neutron context for use later.", "docstring_tokens": ["Adds", "job", "to", "neutron", "context", "for", "use", "later", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 260593}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1051-L1073", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return index type used in loop nest.", "language": "python", "parameters": "(self, loop_nest=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "get_kernel_loop_nest", "(", ")", "if", "type", "(", "arg_1", ")", "is", "c_ast", ".", "For", ":", "arg_1", "=", "[", "arg_1", "]", "arg_2", "=", "(", "None", ",", "None", ")", "for", "arg_3", "in", "arg_1", ":", "if", "type", "(", "arg_3", ")", "is", "c_ast", ".", "For", ":", "if", "type", "(", "arg_3", ".", "stmt", ")", "in", "[", "c_ast", ".", "For", ",", "c_ast", ".", "Compound", "]", ":", "arg_4", "=", "arg_0", ".", "Func", "(", "arg_1", "=", "arg_3", ".", "stmt", ")", "else", ":", "arg_4", "=", "None", "arg_2", "=", "(", "arg_3", ".", "init", ".", "decls", "[", "0", "]", ".", "type", ".", "type", ".", "names", ",", "arg_4", ")", "break", "if", "arg_2", "[", "0", "]", "==", "arg_2", "[", "1", "]", "or", "arg_2", "[", "1", "]", "is", "None", ":", "return", "arg_2", "[", "0", "]", "else", ":", "raise", "ValueError", "(", "\"Loop indices must have same type, found {}.\"", ".", "format", "(", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Return index type used in loop nest.\n\n        If index type between loops differ, an exception is raised.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.get_kernel_loop_nest()\n        if type(arg_1) is c_ast.For:\n            arg_1 = [arg_1]\n        arg_2 = (None, None)\n        for arg_3 in arg_1:\n            if type(arg_3) is c_ast.For:\n                if type(arg_3.stmt) in [c_ast.For, c_ast.Compound]:\n                    arg_4 = arg_0.Func(arg_1=arg_3.stmt)\n                else:\n                    arg_4 = None\n                arg_2 = (arg_3.init.decls[0].type.type.names, arg_4)\n                break\n        if arg_2[0] == arg_2[1] or arg_2[1] is None:\n            return arg_2[0]\n        else:\n            raise ValueError(\"Loop indices must have same type, found {}.\".format(arg_2))", "path": "kerncraft/kernel.py", "identifier": "KernelCode.get_index_type", "docstring": "Return index type used in loop nest.\n\n        If index type between loops differ, an exception is raised.", "docstring_tokens": ["Return", "index", "type", "used", "in", "loop", "nest", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 260594}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/distribution_util.py#L1323-L1365", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Convenience function which statically broadcasts shape when possible.", "language": "python", "parameters": "(shape1,\n                                  shape2,\n                                  name=\"prefer_static_broadcast_shape\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"Func\"", ")", ":", "with", "tf", ".", "name_scope", "(", "arg_2", ")", ":", "def", "make_shape_tensor", "(", "arg_3", ")", ":", "return", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_3", ",", "arg_2", "=", "\"shape\"", ",", "dtype", "=", "tf", ".", "int32", ")", "def", "get_tensor_shape", "(", "arg_4", ")", ":", "if", "isinstance", "(", "arg_4", ",", "tf", ".", "TensorShape", ")", ":", "return", "arg_4", "arg_5", "=", "tf", ".", "get_static_value", "(", "make_shape_tensor", "(", "arg_4", ")", ")", "if", "arg_5", "is", "not", "None", ":", "return", "tf", ".", "TensorShape", "(", "arg_5", ")", "return", "None", "def", "get_shape_tensor", "(", "arg_4", ")", ":", "if", "not", "isinstance", "(", "arg_4", ",", "tf", ".", "TensorShape", ")", ":", "return", "make_shape_tensor", "(", "arg_4", ")", "if", "tensorshape_util", ".", "is_fully_defined", "(", "arg_4", ")", ":", "return", "make_shape_tensor", "(", "tensorshape_util", ".", "as_list", "(", "arg_4", ")", ")", "raise", "ValueError", "(", "\"Cannot broadcast from partially \"", "\"defined `TensorShape`.\"", ")", "arg_6", "=", "get_tensor_shape", "(", "arg_0", ")", "arg_7", "=", "get_tensor_shape", "(", "arg_1", ")", "if", "arg_6", "is", "not", "None", "and", "arg_7", "is", "not", "None", ":", "return", "tf", ".", "broadcast_static_shape", "(", "arg_6", ",", "arg_7", ")", "arg_6", "=", "get_shape_tensor", "(", "arg_0", ")", "arg_7", "=", "get_shape_tensor", "(", "arg_1", ")", "return", "tf", ".", "broadcast_dynamic_shape", "(", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0,\n                                  arg_1,\n                                  arg_2=\"Func\"):\n  \"\"\"Convenience function which statically broadcasts shape when possible.\n\n  Args:\n    shape1:  `1-D` integer `Tensor`.  Already converted to tensor!\n    shape2:  `1-D` integer `Tensor`.  Already converted to tensor!\n    name:  A string name to prepend to created ops.\n\n  Returns:\n    The broadcast shape, either as `TensorShape` (if broadcast can be done\n      statically), or as a `Tensor`.\n  \"\"\"\n  with tf.name_scope(arg_2):\n\n    def make_shape_tensor(arg_3):\n      return tf.convert_to_tensor(value=arg_3, arg_2=\"shape\", dtype=tf.int32)\n\n    def get_tensor_shape(arg_4):\n      if isinstance(arg_4, tf.TensorShape):\n        return arg_4\n      arg_5 = tf.get_static_value(make_shape_tensor(arg_4))\n      if arg_5 is not None:\n        return tf.TensorShape(arg_5)\n      return None\n\n    def get_shape_tensor(arg_4):\n      if not isinstance(arg_4, tf.TensorShape):\n        return make_shape_tensor(arg_4)\n      if tensorshape_util.is_fully_defined(arg_4):\n        return make_shape_tensor(tensorshape_util.as_list(arg_4))\n      raise ValueError(\"Cannot broadcast from partially \"\n                       \"defined `TensorShape`.\")\n\n    arg_6 = get_tensor_shape(arg_0)\n    arg_7 = get_tensor_shape(arg_1)\n    if arg_6 is not None and arg_7 is not None:\n      return tf.broadcast_static_shape(arg_6, arg_7)\n\n    arg_6 = get_shape_tensor(arg_0)\n    arg_7 = get_shape_tensor(arg_1)\n    return tf.broadcast_dynamic_shape(arg_6, arg_7)", "path": "tensorflow_probability/python/internal/distribution_util.py", "identifier": "prefer_static_broadcast_shape", "docstring": "Convenience function which statically broadcasts shape when possible.\n\n  Args:\n    shape1:  `1-D` integer `Tensor`.  Already converted to tensor!\n    shape2:  `1-D` integer `Tensor`.  Already converted to tensor!\n    name:  A string name to prepend to created ops.\n\n  Returns:\n    The broadcast shape, either as `TensorShape` (if broadcast can be done\n      statically), or as a `Tensor`.", "docstring_tokens": ["Convenience", "function", "which", "statically", "broadcasts", "shape", "when", "possible", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260595}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/neuroRemote.py#L182-L198", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Requests a list of next-available-IDs from the server.", "language": "python", "parameters": "(self, token, channel, quantity)", "return_statement": "return [out[0] + i for i in range(out[1])]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_3", "=", "str", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "url", "(", "\"{}/{}/reserve/{}/\"", ".", "format", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ")", "arg_5", "=", "arg_0", ".", "remote_utils", ".", "get_url", "(", "arg_4", ")", "if", "arg_5", ".", "status_code", "is", "not", "200", ":", "raise", "RemoteDataNotFoundError", "(", "'Invalid req: '", "+", "arg_5", ".", "status_code", ")", "arg_6", "=", "arg_5", ".", "json", "(", ")", "return", "[", "arg_6", "[", "0", "]", "+", "arg_7", "for", "arg_7", "in", "range", "(", "arg_6", "[", "1", "]", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"\n        Requests a list of next-available-IDs from the server.\n\n        Arguments:\n            quantity (int): The number of IDs to reserve\n\n        Returns:\n            int[quantity]: List of IDs you've been granted\n        \"\"\"\n        arg_3 = str(arg_3)\n        arg_4 = arg_0.url(\"{}/{}/reserve/{}/\".format(arg_1, arg_2, arg_3))\n        arg_5 = arg_0.remote_utils.get_url(arg_4)\n        if arg_5.status_code is not 200:\n            raise RemoteDataNotFoundError('Invalid req: ' + arg_5.status_code)\n        arg_6 = arg_5.json()\n        return [arg_6[0] + arg_7 for arg_7 in range(arg_6[1])]", "path": "ndio/remote/neuroRemote.py", "identifier": "neuroRemote.reserve_ids", "docstring": "Requests a list of next-available-IDs from the server.\n\n        Arguments:\n            quantity (int): The number of IDs to reserve\n\n        Returns:\n            int[quantity]: List of IDs you've been granted", "docstring_tokens": ["Requests", "a", "list", "of", "next", "-", "available", "-", "IDs", "from", "the", "server", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 260596}
{"url": "https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/reporting/diff.py#L297-L311", "sha": "261e2c0760fd6a6b0ee59064180bd8e3674311fe", "docstring_summary": "Check whether the SLA has passed or failed", "language": "python", "parameters": "(self, sla, diff_metric)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "if", "arg_1", ".", "display", "is", "'%'", ":", "arg_3", "=", "float", "(", "arg_2", "[", "'percent_diff'", "]", ")", "else", ":", "arg_3", "=", "float", "(", "arg_2", "[", "'absolute_diff'", "]", ")", "except", "ValueError", ":", "return", "False", "if", "not", "(", "arg_1", ".", "Func_passed", "(", "arg_3", ")", ")", ":", "arg_0", ".", "sla_failures", "+=", "1", "arg_0", ".", "sla_failure_list", ".", "append", "(", "DiffSLAFailure", "(", "arg_1", ",", "arg_2", ")", ")", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Check whether the SLA has passed or failed\n    \"\"\"\n    try:\n      if arg_1.display is '%':\n        arg_3 = float(arg_2['percent_diff'])\n      else:\n        arg_3 = float(arg_2['absolute_diff'])\n    except ValueError:\n      return False\n    if not (arg_1.Func_passed(arg_3)):\n      arg_0.sla_failures += 1\n      arg_0.sla_failure_list.append(DiffSLAFailure(arg_1, arg_2))\n    return True", "path": "src/naarad/reporting/diff.py", "identifier": "Diff.check_sla", "docstring": "Check whether the SLA has passed or failed", "docstring_tokens": ["Check", "whether", "the", "SLA", "has", "passed", "or", "failed"], "nwo": "linkedin/naarad", "score": 0.34903059417921767, "idx": 260597}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/dummy_model_runner.py#L589-L609", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Checks to see if the model should exit based on the exitAfter dummy\n    parameter", "language": "python", "parameters": "(self, iteration)", "return_statement": "return firstModelID == self._modelID", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_exitAfter", "is", "None", "or", "arg_1", "<", "arg_0", ".", "_exitAfter", ":", "return", "False", "arg_2", "=", "arg_0", ".", "_jobsDAO", ".", "modelsGetFieldsForJob", "(", "arg_0", ".", "_jobID", ",", "[", "'params'", "]", ")", "arg_3", "=", "[", "e", "[", "0", "]", "for", "e", "in", "arg_2", "]", "arg_4", "=", "[", "json", ".", "loads", "(", "e", "[", "1", "]", "[", "0", "]", ")", "[", "'structuredParams'", "]", "[", "'__model_num'", "]", "for", "e", "in", "arg_2", "]", "arg_5", "=", "filter", "(", "lambda", "x", ":", "x", "[", "1", "]", "==", "arg_0", ".", "modelIndex", ",", "zip", "(", "arg_3", ",", "arg_4", ")", ")", "arg_6", "=", "min", "(", "zip", "(", "*", "arg_5", ")", "[", "0", "]", ")", "return", "arg_6", "==", "arg_0", ".", "_modelID"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Checks to see if the model should exit based on the exitAfter dummy\n    parameter\n    \"\"\"\n\n    if arg_0._exitAfter is None \\\n       or arg_1 < arg_0._exitAfter:\n      return False\n\n    arg_2 = arg_0._jobsDAO.modelsGetFieldsForJob(arg_0._jobID, ['params'])\n\n    arg_3 = [e[0] for e in arg_2]\n    arg_4 = [json.loads(e[1][0])['structuredParams']['__model_num'] for e in arg_2]\n\n    arg_5 = filter(lambda x: x[1] == arg_0.modelIndex,\n                              zip(arg_3, arg_4))\n\n    arg_6 = min(zip(*arg_5)[0])\n\n    return arg_6 == arg_0._modelID", "path": "src/nupic/swarming/dummy_model_runner.py", "identifier": "OPFDummyModelRunner.__shouldSysExit", "docstring": "Checks to see if the model should exit based on the exitAfter dummy\n    parameter", "docstring_tokens": ["Checks", "to", "see", "if", "the", "model", "should", "exit", "based", "on", "the", "exitAfter", "dummy", "parameter"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260598}
{"url": "https://github.com/glottobank/python-newick/blob/e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702/src/newick.py#L386-L397", "sha": "e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702", "docstring_summary": "Load a list of trees from an open Newick formatted file.", "language": "python", "parameters": "(fp, strip_comments=False, **kw)", "return_statement": "return loads(fp.read(), **kw)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "**", "arg_2", ")", ":", "arg_2", "[", "'strip_comments'", "]", "=", "arg_1", "return", "Funcs", "(", "arg_0", ".", "read", "(", ")", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, **arg_2):\n    \"\"\"\n    Load a list of trees from an open Newick formatted file.\n\n    :param fp: open file handle.\n    :param strip_comments: Flag signaling whether to strip comments enclosed in square \\\n    brackets.\n    :param kw: Keyword arguments are passed through to `Node.create`.\n    :return: List of Node objects.\n    \"\"\"\n    arg_2['strip_comments'] = arg_1\n    return Funcs(arg_0.read(), **arg_2)", "path": "src/newick.py", "identifier": "load", "docstring": "Load a list of trees from an open Newick formatted file.\n\n    :param fp: open file handle.\n    :param strip_comments: Flag signaling whether to strip comments enclosed in square \\\n    brackets.\n    :param kw: Keyword arguments are passed through to `Node.create`.\n    :return: List of Node objects.", "docstring_tokens": ["Load", "a", "list", "of", "trees", "from", "an", "open", "Newick", "formatted", "file", "."], "nwo": "glottobank/python-newick", "score": 0.19358971820395612, "idx": 260599}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/nodes.py#L30-L33", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "insert a child node", "language": "python", "parameters": "(self, index, child)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "children", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_2", ".", "parent", "=", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Func a child node\"\"\"\n        arg_0.children.Func(arg_1, arg_2)\n        arg_2.parent = arg_0", "path": "pylint/reporters/ureports/nodes.py", "identifier": "VNode.insert", "docstring": "insert a child node", "docstring_tokens": ["insert", "a", "child", "node"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260600}
{"url": "https://github.com/Tsjerk/Insane/blob/b73f08910ddb0b66597b20ff75ecee7f65f4ecf6/insane/core.py#L69-L84", "sha": "b73f08910ddb0b66597b20ff75ecee7f65f4ecf6", "docstring_summary": "Determine molecule numbers for given total, \n    absolute and relative numbers", "language": "python", "parameters": "(total, molecules, absolute, relative)", "return_statement": "return list(zip(molecules, numbers))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "sum", "(", "arg_3", ")", "if", "not", "any", "(", "arg_2", ")", ":", "arg_5", "=", "[", "int", "(", "arg_0", "*", "i", "/", "arg_4", ")", "for", "i", "in", "arg_3", "]", "elif", "any", "(", "arg_3", ")", ":", "arg_6", "=", "arg_0", "-", "sum", "(", "arg_2", ")", "arg_5", "=", "[", "int", "(", "arg_6", "*", "i", "/", "arg_4", ")", "if", "i", "else", "j", "for", "i", ",", "j", "in", "zip", "(", "arg_3", ",", "arg_2", ")", "]", "else", ":", "arg_5", "=", "arg_2", "return", "list", "(", "zip", "(", "arg_1", ",", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Determine molecule numbers for given total, \n    absolute and relative numbers\"\"\" \n    arg_4 = sum(arg_3)\n    if not any(arg_2):\n        # Only relative numbers\n        arg_5 = [int(arg_0*i/arg_4) for i in arg_3]\n    elif any(arg_3):\n        # Absolute numbers and fill the rest with relative numbers\n        arg_6 = arg_0 - sum(arg_2)\n        arg_5 = [int(arg_6*i/arg_4) if i else j \n                   for i,j in zip(arg_3, arg_2)]\n    else:\n        # Only absolute numbers\n        arg_5 = arg_2\n    return list(zip(arg_1, arg_5))", "path": "insane/core.py", "identifier": "determine_molecule_numbers", "docstring": "Determine molecule numbers for given total, \n    absolute and relative numbers", "docstring_tokens": ["Determine", "molecule", "numbers", "for", "given", "total", "absolute", "and", "relative", "numbers"], "nwo": "Tsjerk/Insane", "score": 0.19193044314782712, "idx": 260601}
{"url": "https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L62-L72", "sha": "9d0e8ebcba31d937f73752f9b88e5a4fec860765", "docstring_summary": "Return a list of keys from MimicDB.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return super(Bucket, self).get_all_keys(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "arg_2", ".", "pop", "(", "'force'", ",", "None", ")", ":", "arg_3", "=", "arg_2", ".", "get", "(", "'headers'", ",", "arg_1", "[", "0", "]", "if", "len", "(", "arg_1", ")", "else", "None", ")", "or", "dict", "(", ")", "arg_3", "[", "'force'", "]", "=", "True", "arg_2", "[", "'headers'", "]", "=", "arg_3", "return", "super", "(", "Bucket", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Return a list of keys from MimicDB.\n\n        :param boolean force: If true, API call is forced to S3\n        \"\"\"\n        if arg_2.pop('force', None):\n            arg_3 = arg_2.get('headers', arg_1[0] if len(arg_1) else None) or dict()\n            arg_3['force'] = True\n            arg_2['headers'] = arg_3\n\n        return super(Bucket, arg_0).Func(*arg_1, **arg_2)", "path": "mimicdb/s3/bucket.py", "identifier": "Bucket.get_all_keys", "docstring": "Return a list of keys from MimicDB.\n\n        :param boolean force: If true, API call is forced to S3", "docstring_tokens": ["Return", "a", "list", "of", "keys", "from", "MimicDB", "."], "nwo": "nathancahill/mimicdb", "score": 0.18112697196067942, "idx": 260602}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/AudioTrack.py#L6-L21", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Returns an optional AudioTrack.", "language": "python", "parameters": "(self, track, requester)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_0", ".", "track", "=", "arg_1", "[", "'track'", "]", "arg_0", ".", "identifier", "=", "arg_1", "[", "'info'", "]", "[", "'identifier'", "]", "arg_0", ".", "can_seek", "=", "arg_1", "[", "'info'", "]", "[", "'isSeekable'", "]", "arg_0", ".", "author", "=", "arg_1", "[", "'info'", "]", "[", "'author'", "]", "arg_0", ".", "duration", "=", "arg_1", "[", "'info'", "]", "[", "'length'", "]", "arg_0", ".", "stream", "=", "arg_1", "[", "'info'", "]", "[", "'isStream'", "]", "arg_0", ".", "title", "=", "arg_1", "[", "'info'", "]", "[", "'title'", "]", "arg_0", ".", "uri", "=", "arg_1", "[", "'info'", "]", "[", "'uri'", "]", "arg_0", ".", "requester", "=", "arg_2", "return", "arg_0", "except", "KeyError", ":", "raise", "InvalidTrack", "(", "'An invalid track was passed.'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\r\n        \"\"\" Returns an optional AudioTrack. \"\"\"\r\n        try:\r\n            arg_0.track = arg_1['track']\r\n            arg_0.identifier = arg_1['info']['identifier']\r\n            arg_0.can_seek = arg_1['info']['isSeekable']\r\n            arg_0.author = arg_1['info']['author']\r\n            arg_0.duration = arg_1['info']['length']\r\n            arg_0.stream = arg_1['info']['isStream']\r\n            arg_0.title = arg_1['info']['title']\r\n            arg_0.uri = arg_1['info']['uri']\r\n            arg_0.requester = arg_2\r\n\r\n            return arg_0\r\n        except KeyError:\r\n            raise InvalidTrack('An invalid track was passed.')", "path": "lavalink/AudioTrack.py", "identifier": "AudioTrack.build", "docstring": "Returns an optional AudioTrack.", "docstring_tokens": ["Returns", "an", "optional", "AudioTrack", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 260603}
{"url": "https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L780-L795", "sha": "140923db51fb91d5a5847ad17412e8bce51ba3da", "docstring_summary": "Moves a file.", "language": "python", "parameters": "(source_filename, target_filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_AssertIsLocal", "(", "arg_0", ")", "_AssertIsLocal", "(", "arg_1", ")", "import", "shutil", "shutil", ".", "move", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Moves a file.\n\n    :param unicode source_filename:\n\n    :param unicode target_filename:\n\n    :raises NotImplementedForRemotePathError:\n        If trying to operate with non-local files.\n    '''\n    _AssertIsLocal(arg_0)\n    _AssertIsLocal(arg_1)\n\n    import shutil\n    shutil.move(arg_0, arg_1)", "path": "zerotk/easyfs/_easyfs.py", "identifier": "MoveFile", "docstring": "Moves a file.\n\n    :param unicode source_filename:\n\n    :param unicode target_filename:\n\n    :raises NotImplementedForRemotePathError:\n        If trying to operate with non-local files.", "docstring_tokens": ["Moves", "a", "file", "."], "nwo": "zerotk/easyfs", "score": 0.0, "idx": 260604}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L454-L463", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles display of the dot code in a text editor.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "initialized", ":", "return", "arg_0", ".", "dot_code", "=", "str", "(", "arg_0", ".", "model", ")", "arg_3", "=", "arg_0", ".", "edit_traits", "(", "parent", "=", "arg_1", ".", "ui", ".", "control", ",", "kind", "=", "\"livemodal\"", ",", "view", "=", "\"dot_code_view\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handles display of the dot code in a text editor.\n        \"\"\"\n        if not arg_1.initialized:\n            return\n\n        arg_0.dot_code = str(arg_0.model)\n        arg_3 = arg_0.edit_traits( parent = arg_1.ui.control,\n                                   kind   = \"livemodal\",\n                                   view   = \"dot_code_view\" )", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel.configure_dot_code", "docstring": "Handles display of the dot code in a text editor.", "docstring_tokens": ["Handles", "display", "of", "the", "dot", "code", "in", "a", "text", "editor", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 260605}
{"url": "https://github.com/p1c2u/openapi-spec-validator/blob/7fef38ab2962ab4866ffa27e2e9fd92f6a3ff67f/openapi_spec_validator/generators.py#L34-L42", "sha": "7fef38ab2962ab4866ffa27e2e9fd92f6a3ff67f", "docstring_summary": "Creates validators generator for the spec resolver.", "language": "python", "parameters": "(cls, spec_resolver)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "DerefValidatorDecorator", "(", "arg_1", ")", "for", "arg_3", ",", "arg_4", "in", "iteritems", "(", "arg_0", ".", "validators", ")", ":", "yield", "arg_3", ",", "arg_2", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Creates validators generator for the spec resolver.\n\n        :param spec_resolver: resolver for the spec\n        :type instance_resolver: :class:`jsonschema.RefResolver`\n        \"\"\"\n        arg_2 = DerefValidatorDecorator(arg_1)\n        for arg_3, arg_4 in iteritems(arg_0.validators):\n            yield arg_3, arg_2(arg_4)", "path": "openapi_spec_validator/generators.py", "identifier": "SpecValidatorsGeneratorFactory.from_spec_resolver", "docstring": "Creates validators generator for the spec resolver.\n\n        :param spec_resolver: resolver for the spec\n        :type instance_resolver: :class:`jsonschema.RefResolver`", "docstring_tokens": ["Creates", "validators", "generator", "for", "the", "spec", "resolver", "."], "nwo": "p1c2u/openapi-spec-validator", "score": 0.910720840960577, "idx": 260606}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/session.py#L190-L207", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Given a message or header, return the header.", "language": "python", "parameters": "(msg_or_header)", "return_statement": "return h", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ":", "return", "{", "}", "try", ":", "arg_1", "=", "arg_0", "[", "'header'", "]", "except", "KeyError", ":", "try", ":", "arg_1", "=", "arg_0", "[", "'msg_id'", "]", "except", "KeyError", ":", "raise", "else", ":", "arg_1", "=", "arg_0", "if", "not", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_1", "=", "dict", "(", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Given a message or header, return the header.\"\"\"\n    if not arg_0:\n        return {}\n    try:\n        # See if msg_or_header is the entire message.\n        arg_1 = arg_0['header']\n    except KeyError:\n        try:\n            # See if msg_or_header is just the header\n            arg_1 = arg_0['msg_id']\n        except KeyError:\n            raise\n        else:\n            arg_1 = arg_0\n    if not isinstance(arg_1, dict):\n        arg_1 = dict(arg_1)\n    return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/zmq/session.py", "identifier": "extract_header", "docstring": "Given a message or header, return the header.", "docstring_tokens": ["Given", "a", "message", "or", "header", "return", "the", "header", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260607}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/functools.py#L23-L43", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Update a wrapper function to look like the wrapped function", "language": "python", "parameters": "(wrapper,\n                   wrapped,\n                   assigned = WRAPPER_ASSIGNMENTS,\n                   updated = WRAPPER_UPDATES)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "arg_5", ")", ":", "for", "arg_6", "in", "arg_2", ":", "setattr", "(", "arg_0", ",", "arg_6", ",", "getattr", "(", "arg_1", ",", "arg_6", ")", ")", "for", "arg_6", "in", "arg_4", ":", "getattr", "(", "arg_0", ",", "arg_6", ")", ".", "update", "(", "getattr", "(", "arg_1", ",", "arg_6", ",", "{", "}", ")", ")", "return", "arg_0"], "function": "def Func(arg_0,\n                   arg_1,\n                   arg_2 = arg_3,\n                   arg_4 = arg_5):\n    \"\"\"Update a wrapper function to look like the wrapped function\n\n       wrapper is the function to be updated\n       wrapped is the original function\n       assigned is a tuple naming the attributes assigned directly\n       from the wrapped function to the wrapper function (defaults to\n       functools.WRAPPER_ASSIGNMENTS)\n       updated is a tuple naming the attributes of the wrapper that\n       are updated with the corresponding attribute from the wrapped\n       function (defaults to functools.WRAPPER_UPDATES)\n    \"\"\"\n    for arg_6 in arg_2:\n        setattr(arg_0, arg_6, getattr(arg_1, arg_6))\n    for arg_6 in arg_4:\n        getattr(arg_0, arg_6).update(getattr(arg_1, arg_6, {}))\n    # Return the wrapper so this can be used as a decorator via partial()\n    return arg_0", "path": "third_party/stdlib/functools.py", "identifier": "update_wrapper", "docstring": "Update a wrapper function to look like the wrapped function\n\n       wrapper is the function to be updated\n       wrapped is the original function\n       assigned is a tuple naming the attributes assigned directly\n       from the wrapped function to the wrapper function (defaults to\n       functools.WRAPPER_ASSIGNMENTS)\n       updated is a tuple naming the attributes of the wrapper that\n       are updated with the corresponding attribute from the wrapped\n       function (defaults to functools.WRAPPER_UPDATES)", "docstring_tokens": ["Update", "a", "wrapper", "function", "to", "look", "like", "the", "wrapped", "function"], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 260608}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/cli.py#L433-L458", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Resolves an option value into options.", "language": "python", "parameters": "(self, options, option_name, section_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "getattr", "(", "arg_1", ",", "arg_2", ",", "None", ")", "is", "not", "None", ":", "return", "if", "arg_2", ".", "startswith", "(", "arg_3", "+", "'_'", ")", ":", "arg_4", "=", "arg_2", ".", "upper", "(", ")", "arg_5", "=", "arg_2", "[", "len", "(", "arg_3", ")", "+", "1", ":", "]", "else", ":", "arg_4", "=", "(", "arg_3", "+", "'_'", "+", "arg_2", ")", ".", "upper", "(", ")", "arg_5", "=", "arg_2", "setattr", "(", "arg_1", ",", "arg_2", ",", "os", ".", "environ", ".", "get", "(", "arg_4", ",", "(", "arg_0", ".", "context", ".", "conf", ".", "get", "(", "arg_3", ",", "{", "}", ")", ")", ".", "get", "(", "arg_5", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Resolves an option value into options.\n\n        Sets options.<option_name> to a resolved value. Any value\n        already in options overrides a value in os.environ which\n        overrides self.context.conf.\n\n        :param options: The options instance as returned by optparse.\n        :param option_name: The name of the option, such as\n            ``auth_url``.\n        :param section_name: The name of the section, such as\n            ``swiftly``.\n        \"\"\"\n        if getattr(arg_1, arg_2, None) is not None:\n            return\n        if arg_2.startswith(arg_3 + '_'):\n            arg_4 = arg_2.upper()\n            arg_5 = arg_2[len(arg_3) + 1:]\n        else:\n            arg_4 = (arg_3 + '_' + arg_2).upper()\n            arg_5 = arg_2\n        setattr(\n            arg_1, arg_2,\n            os.environ.get(\n                arg_4,\n                (arg_0.context.conf.get(arg_3, {})).get(arg_5)))", "path": "swiftly/cli/cli.py", "identifier": "CLI._resolve_option", "docstring": "Resolves an option value into options.\n\n        Sets options.<option_name> to a resolved value. Any value\n        already in options overrides a value in os.environ which\n        overrides self.context.conf.\n\n        :param options: The options instance as returned by optparse.\n        :param option_name: The name of the option, such as\n            ``auth_url``.\n        :param section_name: The name of the section, such as\n            ``swiftly``.", "docstring_tokens": ["Resolves", "an", "option", "value", "into", "options", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 260609}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/markupsafe/__init__.py#L267-L272", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Helper for various string-wrapped functions.", "language": "python", "parameters": "(obj, iterable, escape)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_1", ":", "if", "hasattr", "(", "arg_4", ",", "'__html__'", ")", "or", "isinstance", "(", "arg_4", ",", "string_types", ")", ":", "arg_0", "[", "arg_3", "]", "=", "arg_2", "(", "arg_4", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Helper for various string-wrapped functions.\"\"\"\n    for arg_3, arg_4 in arg_1:\n        if hasattr(arg_4, '__html__') or isinstance(arg_4, string_types):\n            arg_0[arg_3] = arg_2(arg_4)\n    return arg_0", "path": "capybara/virtualenv/lib/python2.7/site-packages/markupsafe/__init__.py", "identifier": "_escape_argspec", "docstring": "Helper for various string-wrapped functions.", "docstring_tokens": ["Helper", "for", "various", "string", "-", "wrapped", "functions", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260610}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/multinomial.py#L29-L45", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Retrieve the Hit Ratios.", "language": "python", "parameters": "(self, train=False, valid=False, xval=False)", "return_statement": "return list(m.values())[0] if len(m) == 1 else m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "ModelBase", ".", "_get_metrics", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "{", "}", "for", "arg_6", ",", "arg_7", "in", "zip", "(", "list", "(", "arg_4", ".", "keys", "(", ")", ")", ",", "list", "(", "arg_4", ".", "values", "(", ")", ")", ")", ":", "arg_5", "[", "arg_6", "]", "=", "None", "if", "arg_7", "is", "None", "else", "arg_7", ".", "Func", "(", ")", "return", "list", "(", "arg_5", ".", "values", "(", ")", ")", "[", "0", "]", "if", "len", "(", "arg_5", ")", "==", "1", "else", "arg_5"], "function": "def Func(arg_0, arg_1=False, arg_2=False, arg_3=False):\n        \"\"\"\n        Retrieve the Hit Ratios.\n\n        If all are False (default), then return the training metric value.\n        If more than one options is set to True, then return a dictionary of metrics where the keys are \"train\",\n        \"valid\", and \"xval\".\n\n        :param train: If train is True, then return the hit ratio value for the training data.\n        :param valid: If valid is True, then return the hit ratio value for the validation data.\n        :param xval:  If xval is True, then return the hit ratio value for the cross validation data.\n        :return: The hit ratio for this regression model.\n        \"\"\"\n        arg_4 = ModelBase._get_metrics(arg_0, arg_1, arg_2, arg_3)\n        arg_5 = {}\n        for arg_6, arg_7 in zip(list(arg_4.keys()), list(arg_4.values())): arg_5[arg_6] = None if arg_7 is None else arg_7.Func()\n        return list(arg_5.values())[0] if len(arg_5) == 1 else arg_5", "path": "h2o-py/h2o/model/multinomial.py", "identifier": "H2OMultinomialModel.hit_ratio_table", "docstring": "Retrieve the Hit Ratios.\n\n        If all are False (default), then return the training metric value.\n        If more than one options is set to True, then return a dictionary of metrics where the keys are \"train\",\n        \"valid\", and \"xval\".\n\n        :param train: If train is True, then return the hit ratio value for the training data.\n        :param valid: If valid is True, then return the hit ratio value for the validation data.\n        :param xval:  If xval is True, then return the hit ratio value for the cross validation data.\n        :return: The hit ratio for this regression model.", "docstring_tokens": ["Retrieve", "the", "Hit", "Ratios", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260611}
{"url": "https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graph.py#L273-L281", "sha": "dce007bd7f078427c73a2a1d6f4b834af1b4dc03", "docstring_summary": "Get or create edges using get_or_create_node", "language": "python", "parameters": "(self, n1_label, n2_label,directed=False)", "return_statement": "return e", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "arg_0", ".", "add_node", "(", "arg_1", ")", "arg_5", "=", "arg_0", ".", "add_node", "(", "arg_2", ")", "arg_6", "=", "Edge", "(", "arg_4", ",", "arg_5", ",", "arg_3", ")", "arg_0", ".", "_edges", ".", "append", "(", "arg_6", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2,arg_3=False):\n      \"\"\"\n      Get or create edges using get_or_create_node\n      \"\"\"\n      arg_4 = arg_0.add_node(arg_1)\n      arg_5 = arg_0.add_node(arg_2)\n      arg_6 = Edge(arg_4, arg_5, arg_3)\n      arg_0._edges.append(arg_6)\n      return arg_6", "path": "pygraphml/graph.py", "identifier": "NoDupesGraph.add_edge", "docstring": "Get or create edges using get_or_create_node", "docstring_tokens": ["Get", "or", "create", "edges", "using", "get_or_create_node"], "nwo": "hadim/pygraphml", "score": 0.33005860181868024, "idx": 260612}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/effects/registry.py#L49-L54", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Get all effect directories for registered effects.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", "->", "List", "[", "str", "]", ":", "for", "arg_1", "in", "arg_0", ".", "packages", ":", "yield", "os", ".", "path", ".", "join", "(", "arg_1", ".", "path", ",", "'resources'", ")"], "function": "def Func(arg_0) -> List[str]:\n        \"\"\"\n        Get all effect directories for registered effects.\n        \"\"\"\n        for arg_1 in arg_0.packages:\n            yield os.path.join(arg_1.path, 'resources')", "path": "demosys/effects/registry.py", "identifier": "EffectRegistry.get_dirs", "docstring": "Get all effect directories for registered effects.", "docstring_tokens": ["Get", "all", "effect", "directories", "for", "registered", "effects", "."], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 260613}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/emr_hook.py#L39-L57", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Creates a job flow using the config from the EMR connection.\n        Keys of the json extra hash may have the arguments of the boto3\n        run_job_flow method.\n        Overrides for this config may be passed as the job_flow_overrides.", "language": "python", "parameters": "(self, job_flow_overrides)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "emr_conn_id", ":", "raise", "AirflowException", "(", "'emr_conn_id must be present to use Func'", ")", "arg_2", "=", "arg_0", ".", "get_connection", "(", "arg_0", ".", "emr_conn_id", ")", "arg_3", "=", "arg_2", ".", "extra_dejson", ".", "copy", "(", ")", "arg_3", ".", "update", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "get_conn", "(", ")", ".", "run_job_flow", "(", "**", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Creates a job flow using the config from the EMR connection.\n        Keys of the json extra hash may have the arguments of the boto3\n        run_job_flow method.\n        Overrides for this config may be passed as the job_flow_overrides.\n        \"\"\"\n\n        if not arg_0.emr_conn_id:\n            raise AirflowException('emr_conn_id must be present to use Func')\n\n        arg_2 = arg_0.get_connection(arg_0.emr_conn_id)\n\n        arg_3 = arg_2.extra_dejson.copy()\n        arg_3.update(arg_1)\n\n        arg_4 = arg_0.get_conn().run_job_flow(**arg_3)\n\n        return arg_4", "path": "airflow/contrib/hooks/emr_hook.py", "identifier": "EmrHook.create_job_flow", "docstring": "Creates a job flow using the config from the EMR connection.\n        Keys of the json extra hash may have the arguments of the boto3\n        run_job_flow method.\n        Overrides for this config may be passed as the job_flow_overrides.", "docstring_tokens": ["Creates", "a", "job", "flow", "using", "the", "config", "from", "the", "EMR", "connection", ".", "Keys", "of", "the", "json", "extra", "hash", "may", "have", "the", "arguments", "of", "the", "boto3", "run_job_flow", "method", ".", "Overrides", "for", "this", "config", "may", "be", "passed", "as", "the", "job_flow_overrides", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260614}
{"url": "https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/corebluetooth/provider.py#L234-L241", "sha": "34fc6f596371b961628369d78ce836950514062f", "docstring_summary": "Initialize the BLE provider.  Must be called once before any other\n        calls are made to the provider.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_central_manager", "=", "CBCentralManager", ".", "alloc", "(", ")", "arg_0", ".", "_central_manager", ".", "initWithDelegate_queue_options_", "(", "arg_0", ".", "_central_delegate", ",", "None", ",", "None", ")"], "function": "def Func(arg_0):\n        \"\"\"Initialize the BLE provider.  Must be called once before any other\n        calls are made to the provider.\n        \"\"\"\n        # Setup the central manager and its delegate.\n        arg_0._central_manager = CBCentralManager.alloc()\n        arg_0._central_manager.initWithDelegate_queue_options_(arg_0._central_delegate,\n                                                              None, None)", "path": "Adafruit_BluefruitLE/corebluetooth/provider.py", "identifier": "CoreBluetoothProvider.initialize", "docstring": "Initialize the BLE provider.  Must be called once before any other\n        calls are made to the provider.", "docstring_tokens": ["Initialize", "the", "BLE", "provider", ".", "Must", "be", "called", "once", "before", "any", "other", "calls", "are", "made", "to", "the", "provider", "."], "nwo": "adafruit/Adafruit_Python_BluefruitLE", "score": 0.7596555353561404, "idx": 260615}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L369-L384", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Change the name of this droplet", "language": "python", "parameters": "(self, name, wait=True)", "return_statement": "return self._action('rename', name=name, wait=wait)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "return", "arg_0", ".", "_action", "(", "'Func'", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Change the name of this droplet\n\n        Parameters\n        ----------\n        name: str\n            New name for the droplet\n        wait: bool, default True\n            Whether to block until the pending action is completed\n\n        Raises\n        ------\n        APIError if region does not support private networking\n        \"\"\"\n        return arg_0._action('Func', arg_1=arg_1, arg_2=arg_2)", "path": "poseidon/droplet.py", "identifier": "DropletActions.rename", "docstring": "Change the name of this droplet\n\n        Parameters\n        ----------\n        name: str\n            New name for the droplet\n        wait: bool, default True\n            Whether to block until the pending action is completed\n\n        Raises\n        ------\n        APIError if region does not support private networking", "docstring_tokens": ["Change", "the", "name", "of", "this", "droplet"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 260616}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/cli.py#L214-L250", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Run a Basilisp script or a line of code, if it is provided.", "language": "python", "parameters": "(  # pylint: disable=too-many-arguments\n    file_or_code,\n    code,\n    in_ns,\n    use_var_indirection,\n    warn_on_shadowed_name,\n    warn_on_shadowed_var,\n    warn_on_var_indirection,\n)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", ")", ":", "basilisp", ".", "init", "(", ")", "arg_7", "=", "compiler", ".", "CompilerContext", "(", "filename", "=", "CLI_INPUT_FILE_PATH", "if", "arg_1", "else", "(", "STDIN_INPUT_FILE_PATH", "if", "arg_0", "==", "STDIN_FILE_NAME", "else", "arg_0", ")", ",", "opts", "=", "{", "compiler", ".", "WARN_ON_SHADOWED_NAME", ":", "arg_4", ",", "compiler", ".", "WARN_ON_SHADOWED_VAR", ":", "arg_5", ",", "compiler", ".", "USE_VAR_INDIRECTION", ":", "arg_3", ",", "compiler", ".", "WARN_ON_VAR_INDIRECTION", ":", "arg_6", ",", "}", ",", ")", "arg_8", "=", "object", "(", ")", "with", "Functime", ".", "ns_bindings", "(", "arg_2", ")", "as", "ns", ":", "if", "arg_1", ":", "print", "(", "Functime", ".", "lrepr", "(", "eval_str", "(", "arg_0", ",", "arg_7", ",", "ns", ".", "module", ",", "arg_8", ")", ")", ")", "elif", "arg_0", "==", "STDIN_FILE_NAME", ":", "print", "(", "Functime", ".", "lrepr", "(", "eval_stream", "(", "click", ".", "get_text_stream", "(", "\"stdin\"", ")", ",", "arg_7", ",", "ns", ".", "module", ")", ")", ")", "else", ":", "print", "(", "Functime", ".", "lrepr", "(", "eval_file", "(", "arg_0", ",", "arg_7", ",", "ns", ".", "module", ")", ")", ")"], "function": "def Func(  # pylint: disable=too-many-arguments\n    arg_0,\n    arg_1,\n    arg_2,\n    arg_3,\n    arg_4,\n    arg_5,\n    arg_6,\n):\n    \"\"\"Run a Basilisp script or a line of code, if it is provided.\"\"\"\n    basilisp.init()\n    arg_7 = compiler.CompilerContext(\n        filename=CLI_INPUT_FILE_PATH\n        if arg_1\n        else (\n            STDIN_INPUT_FILE_PATH if arg_0 == STDIN_FILE_NAME else arg_0\n        ),\n        opts={\n            compiler.WARN_ON_SHADOWED_NAME: arg_4,\n            compiler.WARN_ON_SHADOWED_VAR: arg_5,\n            compiler.USE_VAR_INDIRECTION: arg_3,\n            compiler.WARN_ON_VAR_INDIRECTION: arg_6,\n        },\n    )\n    arg_8 = object()\n\n    with Functime.ns_bindings(arg_2) as ns:\n        if arg_1:\n            print(Functime.lrepr(eval_str(arg_0, arg_7, ns.module, arg_8)))\n        elif arg_0 == STDIN_FILE_NAME:\n            print(\n                Functime.lrepr(\n                    eval_stream(click.get_text_stream(\"stdin\"), arg_7, ns.module)\n                )\n            )\n        else:\n            print(Functime.lrepr(eval_file(arg_0, arg_7, ns.module)))", "path": "src/basilisp/cli.py", "identifier": "run", "docstring": "Run a Basilisp script or a line of code, if it is provided.", "docstring_tokens": ["Run", "a", "Basilisp", "script", "or", "a", "line", "of", "code", "if", "it", "is", "provided", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 260617}
{"url": "https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L237-L256", "sha": "0944d9a3fb1f1798dbb276694aeed99f2b4283ba", "docstring_summary": "Converts the provided traceId hex value with optional high bits\n        to a string.", "language": "python", "parameters": "(self, trace_id, trace_id_high=None)", "return_statement": "return result.decode(\"utf8\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_3", "=", "bytearray", "(", "32", ")", "arg_0", ".", "_write_hex_long", "(", "arg_3", ",", "0", ",", "arg_2", ")", "arg_0", ".", "_write_hex_long", "(", "arg_3", ",", "16", ",", "arg_1", ")", "return", "arg_3", ".", "decode", "(", "\"utf8\"", ")", "arg_3", "=", "bytearray", "(", "16", ")", "arg_0", ".", "_write_hex_long", "(", "arg_3", ",", "0", ",", "arg_1", ")", "return", "arg_3", ".", "decode", "(", "\"utf8\"", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Converts the provided traceId hex value with optional high bits\n        to a string.\n\n        :param trace_id: the value of the trace ID\n        :type trace_id: int\n        :param trace_id_high: the high bits of the trace ID\n        :type trace_id: int\n        :returns: trace_id_high + trace_id as a string\n        \"\"\"\n        if arg_2 is not None:\n            arg_3 = bytearray(32)\n            arg_0._write_hex_long(arg_3, 0, arg_2)\n            arg_0._write_hex_long(arg_3, 16, arg_1)\n            return arg_3.decode(\"utf8\")\n\n        arg_3 = bytearray(16)\n        arg_0._write_hex_long(arg_3, 0, arg_1)\n        return arg_3.decode(\"utf8\")", "path": "py_zipkin/encoding/_decoders.py", "identifier": "_V1ThriftDecoder._convert_trace_id_to_string", "docstring": "Converts the provided traceId hex value with optional high bits\n        to a string.\n\n        :param trace_id: the value of the trace ID\n        :type trace_id: int\n        :param trace_id_high: the high bits of the trace ID\n        :type trace_id: int\n        :returns: trace_id_high + trace_id as a string", "docstring_tokens": ["Converts", "the", "provided", "traceId", "hex", "value", "with", "optional", "high", "bits", "to", "a", "string", "."], "nwo": "Yelp/py_zipkin", "score": 0.7185258360488012, "idx": 260618}
{"url": "https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/data.py#L15-L47", "sha": "dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a", "docstring_summary": "Update the object with new data.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "'id'", ",", "'status'", ",", "'type'", ",", "'persistence'", ",", "'date_start'", ",", "'date_finish'", ",", "'date_created'", ",", "'date_modified'", ",", "'checksum'", ",", "'processor_name'", ",", "'input'", ",", "'input_schema'", ",", "'output'", ",", "'output_schema'", ",", "'static'", ",", "'static_schema'", ",", "'var'", ",", "'var_template'", ",", "]", "arg_0", ".", "annotation", "=", "{", "}", "for", "arg_4", "in", "arg_2", ":", "setattr", "(", "arg_0", ",", "arg_4", ",", "arg_1", "[", "arg_4", "]", ")", "arg_0", ".", "name", "=", "arg_1", "[", "'static'", "]", "[", "'name'", "]", "if", "'name'", "in", "arg_1", "[", "'static'", "]", "else", "''", "arg_0", ".", "annotation", ".", "Func", "(", "arg_0", ".", "_flatten_field", "(", "arg_1", "[", "'input'", "]", ",", "arg_1", "[", "'input_schema'", "]", ",", "'input'", ")", ")", "arg_0", ".", "annotation", ".", "Func", "(", "arg_0", ".", "_flatten_field", "(", "arg_1", "[", "'output'", "]", ",", "arg_1", "[", "'output_schema'", "]", ",", "'output'", ")", ")", "arg_0", ".", "annotation", ".", "Func", "(", "arg_0", ".", "_flatten_field", "(", "arg_1", "[", "'static'", "]", ",", "arg_1", "[", "'static_schema'", "]", ",", "'static'", ")", ")", "arg_0", ".", "annotation", ".", "Func", "(", "arg_0", ".", "_flatten_field", "(", "arg_1", "[", "'var'", "]", ",", "arg_1", "[", "'var_template'", "]", ",", "'var'", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Update the object with new data.\"\"\"\n        arg_2 = [\n            'id',\n            'status',\n            'type',\n            'persistence',\n            'date_start',\n            'date_finish',\n            'date_created',\n            'date_modified',\n            'checksum',\n            'processor_name',\n            'input',\n            'input_schema',\n            'output',\n            'output_schema',\n            'static',\n            'static_schema',\n            'var',\n            'var_template',\n        ]\n\n        arg_0.annotation = {}\n        for arg_4 in arg_2:\n            setattr(arg_0, arg_4, arg_1[arg_4])\n\n        arg_0.name = arg_1['static']['name'] if 'name' in arg_1['static'] else ''\n\n        arg_0.annotation.Func(arg_0._flatten_field(arg_1['input'], arg_1['input_schema'], 'input'))\n        arg_0.annotation.Func(arg_0._flatten_field(arg_1['output'], arg_1['output_schema'], 'output'))\n        arg_0.annotation.Func(arg_0._flatten_field(arg_1['static'], arg_1['static_schema'], 'static'))\n        arg_0.annotation.Func(arg_0._flatten_field(arg_1['var'], arg_1['var_template'], 'var'))", "path": "genesis/data.py", "identifier": "GenData.update", "docstring": "Update the object with new data.", "docstring_tokens": ["Update", "the", "object", "with", "new", "data", "."], "nwo": "genialis/genesis-pyapi", "score": 0.27692002097430746, "idx": 260619}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L151-L172", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Guess driver from file extension.", "language": "python", "parameters": "(input_file)", "return_statement": "return driver[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "[", "1", "]", ".", "split", "(", "\".\"", ")", "[", "1", "]", "if", "arg_1", "not", "in", "_file_ext_to_driver", "(", ")", ":", "raise", "MapcheteDriverError", "(", "\"no driver could be found for file extension %s\"", "%", "arg_1", ")", "arg_2", "=", "_file_ext_to_driver", "(", ")", "[", "arg_1", "]", "if", "len", "(", "arg_2", ")", ">", "1", ":", "warnings", ".", "warn", "(", "DeprecationWarning", "(", "\"more than one driver for file found, taking %s\"", "%", "arg_2", "[", "0", "]", ")", ")", "return", "arg_2", "[", "0", "]"], "function": "def Func(arg_0):\n    \"\"\"\n    Guess driver from file extension.\n\n    Returns\n    -------\n    driver : string\n        driver name\n    \"\"\"\n    arg_1 = os.path.splitext(arg_0)[1].split(\".\")[1]\n    if arg_1 not in _file_ext_to_driver():\n        raise MapcheteDriverError(\n            \"no driver could be found for file extension %s\" % arg_1\n        )\n    arg_2 = _file_ext_to_driver()[arg_1]\n    if len(arg_2) > 1:\n        warnings.warn(\n            DeprecationWarning(\n                \"more than one driver for file found, taking %s\" % arg_2[0]\n            )\n        )\n    return arg_2[0]", "path": "mapchete/formats/__init__.py", "identifier": "driver_from_file", "docstring": "Guess driver from file extension.\n\n    Returns\n    -------\n    driver : string\n        driver name", "docstring_tokens": ["Guess", "driver", "from", "file", "extension", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 260620}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_fonem.py#L201-L241", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return the FONEM code of a word.", "language": "python", "parameters": "(self, word)", "return_statement": "return word", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "arg_1", ".", "upper", "(", ")", ")", ")", "arg_1", "=", "arg_1", ".", "translate", "(", "{", "198", ":", "'AE'", ",", "338", ":", "'OE'", "}", ")", "arg_1", "=", "''", ".", "join", "(", "c", "for", "c", "in", "arg_1", "if", "c", "in", "arg_0", ".", "_uc_set", ")", "for", "arg_2", "in", "arg_0", ".", "_rule_order", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "_rule_table", "[", "arg_2", "]", "if", "isinstance", "(", "arg_3", ",", "text_type", ")", ":", "arg_1", "=", "arg_1", ".", "replace", "(", "arg_3", ",", "arg_4", ")", "else", ":", "arg_1", "=", "arg_3", ".", "sub", "(", "arg_4", ",", "arg_1", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the FONEM code of a word.\n\n        Parameters\n        ----------\n        word : str\n            The word to transform\n\n        Returns\n        -------\n        str\n            The FONEM code\n\n        Examples\n        --------\n        >>> pe = FONEM()\n        >>> pe.Func('Marchand')\n        'MARCHEN'\n        >>> pe.Func('Beaulieu')\n        'BOLIEU'\n        >>> pe.Func('Beaumont')\n        'BOMON'\n        >>> pe.Func('Legrand')\n        'LEGREN'\n        >>> pe.Func('Pelletier')\n        'PELETIER'\n\n        \"\"\"\n        # normalize, upper-case, and filter non-French letters\n        arg_1 = unicode_normalize('NFKD', text_type(arg_1.upper()))\n        arg_1 = arg_1.translate({198: 'AE', 338: 'OE'})\n        arg_1 = ''.join(c for c in arg_1 if c in arg_0._uc_set)\n\n        for arg_2 in arg_0._rule_order:\n            arg_3, arg_4 = arg_0._rule_table[arg_2]\n            if isinstance(arg_3, text_type):\n                arg_1 = arg_1.replace(arg_3, arg_4)\n            else:\n                arg_1 = arg_3.sub(arg_4, arg_1)\n\n        return arg_1", "path": "abydos/phonetic/_fonem.py", "identifier": "FONEM.encode", "docstring": "Return the FONEM code of a word.\n\n        Parameters\n        ----------\n        word : str\n            The word to transform\n\n        Returns\n        -------\n        str\n            The FONEM code\n\n        Examples\n        --------\n        >>> pe = FONEM()\n        >>> pe.encode('Marchand')\n        'MARCHEN'\n        >>> pe.encode('Beaulieu')\n        'BOLIEU'\n        >>> pe.encode('Beaumont')\n        'BOMON'\n        >>> pe.encode('Legrand')\n        'LEGREN'\n        >>> pe.encode('Pelletier')\n        'PELETIER'", "docstring_tokens": ["Return", "the", "FONEM", "code", "of", "a", "word", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 260621}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L858-L866", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Obtain a handle to the frame in H2O with the frame_id key.", "language": "python", "parameters": "(frame_id, **kwargs)", "return_statement": "return H2OFrame.get_frame(frame_id, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "assert_is_type", "(", "arg_0", ",", "str", ")", "return", "H2OFrame", ".", "Func", "(", "arg_0", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"\n    Obtain a handle to the frame in H2O with the frame_id key.\n\n    :param str frame_id: id of the frame to retrieve.\n    :returns: an :class:`H2OFrame` object\n    \"\"\"\n    assert_is_type(arg_0, str)\n    return H2OFrame.Func(arg_0, **arg_1)", "path": "h2o-py/h2o/h2o.py", "identifier": "get_frame", "docstring": "Obtain a handle to the frame in H2O with the frame_id key.\n\n    :param str frame_id: id of the frame to retrieve.\n    :returns: an :class:`H2OFrame` object", "docstring_tokens": ["Obtain", "a", "handle", "to", "the", "frame", "in", "H2O", "with", "the", "frame_id", "key", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260622}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L228-L244", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "r\"\"\"\n        Multiply two Paulis and track the phase.", "language": "python", "parameters": "(p1, p2)", "return_statement": "return new_pauli, phase", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "Pauli", ".", "_prod_phase", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "arg_0", "*", "arg_1", "return", "arg_3", ",", "arg_2"], "function": "def Func(arg_0, arg_1):\n        r\"\"\"\n        Multiply two Paulis and track the phase.\n\n        $P_3 = P_1 \\otimes P_2$: X*Y\n\n        Args:\n            p1 (Pauli): pauli 1\n            p2 (Pauli): pauli 2\n\n        Returns:\n            Pauli: the multiplied pauli\n            complex: the sign of the multiplication, 1, -1, 1j or -1j\n        \"\"\"\n        arg_2 = Pauli._prod_phase(arg_0, arg_1)\n        arg_3 = arg_0 * arg_1\n        return arg_3, arg_2", "path": "qiskit/quantum_info/operators/pauli.py", "identifier": "Pauli.sgn_prod", "docstring": "r\"\"\"\n        Multiply two Paulis and track the phase.\n\n        $P_3 = P_1 \\otimes P_2$: X*Y\n\n        Args:\n            p1 (Pauli): pauli 1\n            p2 (Pauli): pauli 2\n\n        Returns:\n            Pauli: the multiplied pauli\n            complex: the sign of the multiplication, 1, -1, 1j or -1j", "docstring_tokens": ["r", "Multiply", "two", "Paulis", "and", "track", "the", "phase", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260623}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L405-L418", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles adding a Cluster to the main graph.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "initialized", ":", "return", "arg_2", "=", "arg_0", ".", "_request_graph", "(", "arg_1", ".", "ui", ".", "control", ")", "if", "arg_2", "is", "not", "None", ":", "arg_3", "=", "Cluster", "(", ")", "arg_4", "=", "arg_3", ".", "edit_traits", "(", "parent", "=", "arg_1", ".", "ui", ".", "control", ",", "kind", "=", "\"livemodal\"", ")", "if", "arg_4", ".", "result", ":", "arg_2", ".", "clusters", ".", "append", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handles adding a Cluster to the main graph. \"\"\"\n\n        if not arg_1.initialized:\n            return\n\n        arg_2 = arg_0._request_graph(arg_1.ui.control)\n\n        if arg_2 is not None:\n            arg_3 = Cluster()#root=graph, parent=graph)\n            arg_4 = arg_3.edit_traits(parent = arg_1.ui.control,\n                                         kind   = \"livemodal\")\n            if arg_4.result:\n                arg_2.clusters.append(arg_3)", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel.add_cluster", "docstring": "Handles adding a Cluster to the main graph.", "docstring_tokens": ["Handles", "adding", "a", "Cluster", "to", "the", "main", "graph", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 260624}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L146-L153", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "iterate on similarities among all files, by making a cartesian\n        product", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "enumerate", "(", "arg_0", ".", "linesets", "[", ":", "-", "1", "]", ")", ":", "for", "arg_3", "in", "arg_0", ".", "linesets", "[", "arg_1", "+", "1", ":", "]", ":", "for", "arg_4", "in", "arg_0", ".", "_find_common", "(", "arg_2", ",", "arg_3", ")", ":", "yield", "arg_4"], "function": "def Func(arg_0):\n        \"\"\"iterate on similarities among all files, by making a cartesian\n        product\n        \"\"\"\n        for arg_1, arg_2 in enumerate(arg_0.linesets[:-1]):\n            for arg_3 in arg_0.linesets[arg_1 + 1 :]:\n                for arg_4 in arg_0._find_common(arg_2, arg_3):\n                    yield arg_4", "path": "pylint/checkers/similar.py", "identifier": "Similar._iter_sims", "docstring": "iterate on similarities among all files, by making a cartesian\n        product", "docstring_tokens": ["iterate", "on", "similarities", "among", "all", "files", "by", "making", "a", "cartesian", "product"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260625}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L726-L753", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Build the ``Ref`` instance by fetching the rule from\n        the GramFuzzer instance and building it", "language": "python", "parameters": "(self, pre=None, shortest=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ")", ":", "global", "REF_LEVEL", "REF_LEVEL", "+=", "1", "try", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "[", "]", "arg_3", "=", "arg_0", ".", "fuzzer", ".", "get_ref", "(", "arg_0", ".", "cat", ",", "arg_0", ".", "refname", ")", "arg_4", "=", "utils", ".", "val", "(", "arg_3", ",", "arg_1", ",", "arg_2", "=", "(", "arg_2", "or", "REF_LEVEL", ">=", "arg_0", ".", "max_recursion", ")", ")", "return", "arg_4", "finally", ":", "REF_LEVEL", "-=", "1"], "function": "def Func(arg_0, arg_1=None, arg_2=False):\n        \"\"\"Build the ``Ref`` instance by fetching the rule from\n        the GramFuzzer instance and Funcing it\n\n        :param list pre: The prerequisites list\n        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.\n        \"\"\"\n        global REF_LEVEL\n        REF_LEVEL += 1\n\n        try:\n            if arg_1 is None:\n                arg_1 = []\n\n            #print(\"{:04d} - {} - {}:{}\".format(REF_LEVEL, shortest, self.cat, self.refname))\n\n            arg_3 = arg_0.fuzzer.get_ref(arg_0.cat, arg_0.refname)\n            arg_4 = utils.val(\n                arg_3,\n                arg_1,\n                arg_2=(arg_2 or REF_LEVEL >= arg_0.max_recursion)\n            )\n\n            return arg_4\n\n        # this needs to happen no matter what\n        finally:\n            REF_LEVEL -= 1", "path": "gramfuzz/gramfuzz/fields.py", "identifier": "Ref.build", "docstring": "Build the ``Ref`` instance by fetching the rule from\n        the GramFuzzer instance and building it\n\n        :param list pre: The prerequisites list\n        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.", "docstring_tokens": ["Build", "the", "Ref", "instance", "by", "fetching", "the", "rule", "from", "the", "GramFuzzer", "instance", "and", "building", "it"], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 260626}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L441-L488", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Upload a pattern of files. This will recursively walk down every tree in\n    the file pattern to create a hierarchy on the server. As of right now, this\n    places the file into the currently logged in user's home directory.", "language": "python", "parameters": "(file_pattern, destination='Private', leaf_folders_as_items=False,\n           reuse_existing=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'Private'", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "arg_4", ".", "token", "=", "verify_credentials", "(", ")", "arg_6", "=", "None", "arg_7", "=", "arg_4", ".", "communicator", ".", "list_user_folders", "(", "arg_4", ".", "token", ")", "if", "arg_1", ".", "startswith", "(", "'/'", ")", ":", "arg_6", "=", "_find_resource_id_from_path", "(", "arg_1", ")", "else", ":", "for", "arg_8", "in", "arg_7", ":", "if", "arg_8", "[", "'name'", "]", "==", "arg_1", ":", "arg_6", "=", "arg_8", "[", "'folder_id'", "]", "if", "arg_6", "is", "None", ":", "print", "(", "'Unable to locate specified destination. Defaulting to {0}.'", ".", "format", "(", "arg_7", "[", "0", "]", "[", "'name'", "]", ")", ")", "arg_6", "=", "arg_7", "[", "0", "]", "[", "'folder_id'", "]", "for", "arg_9", "in", "glob", ".", "iglob", "(", "arg_0", ")", ":", "arg_9", "=", "os", ".", "path", ".", "normpath", "(", "arg_9", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_9", ")", ":", "print", "(", "'Uploading item from {0}'", ".", "format", "(", "arg_9", ")", ")", "_Func_as_item", "(", "os", ".", "path", ".", "basename", "(", "arg_9", ")", ",", "arg_6", ",", "arg_9", ",", "arg_3", ")", "else", ":", "_Func_folder_recursive", "(", "arg_9", ",", "arg_6", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1='Private', arg_2=False,\n           arg_3=False):\n    \"\"\"\n    Upload a pattern of files. This will recursively walk down every tree in\n    the file pattern to create a hierarchy on the server. As of right now, this\n    places the file into the currently logged in user's home directory.\n\n    :param file_pattern: a glob type pattern for files\n    :type file_pattern: string\n    :param destination: (optional) name of the midas destination folder,\n        defaults to Private\n    :type destination: string\n    :param leaf_folders_as_items: (optional) whether leaf folders should have\n        all files Funced as single items\n    :type leaf_folders_as_items: bool\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool\n    \"\"\"\n    arg_4.token = verify_credentials()\n\n    # Logic for finding the proper folder to place the files in.\n    arg_6 = None\n    arg_7 = arg_4.communicator.list_user_folders(arg_4.token)\n    if arg_1.startswith('/'):\n        arg_6 = _find_resource_id_from_path(arg_1)\n    else:\n        for arg_8 in arg_7:\n            if arg_8['name'] == arg_1:\n                arg_6 = arg_8['folder_id']\n    if arg_6 is None:\n        print('Unable to locate specified destination. Defaulting to {0}.'\n              .format(arg_7[0]['name']))\n        arg_6 = arg_7[0]['folder_id']\n\n    for arg_9 in glob.iglob(arg_0):\n        arg_9 = os.path.normpath(arg_9)\n        if os.path.isfile(arg_9):\n            print('Uploading item from {0}'.format(arg_9))\n            _Func_as_item(os.path.basename(arg_9),\n                            arg_6,\n                            arg_9,\n                            arg_3)\n        else:\n            _Func_folder_recursive(arg_9,\n                                     arg_6,\n                                     arg_2,\n                                     arg_3)", "path": "pydas/api.py", "identifier": "upload", "docstring": "Upload a pattern of files. This will recursively walk down every tree in\n    the file pattern to create a hierarchy on the server. As of right now, this\n    places the file into the currently logged in user's home directory.\n\n    :param file_pattern: a glob type pattern for files\n    :type file_pattern: string\n    :param destination: (optional) name of the midas destination folder,\n        defaults to Private\n    :type destination: string\n    :param leaf_folders_as_items: (optional) whether leaf folders should have\n        all files uploaded as single items\n    :type leaf_folders_as_items: bool\n    :param reuse_existing: (optional) whether to accept an existing item of the\n        same name in the same location, or create a new one instead\n    :type reuse_existing: bool", "docstring_tokens": ["Upload", "a", "pattern", "of", "files", ".", "This", "will", "recursively", "walk", "down", "every", "tree", "in", "the", "file", "pattern", "to", "create", "a", "hierarchy", "on", "the", "server", ".", "As", "of", "right", "now", "this", "places", "the", "file", "into", "the", "currently", "logged", "in", "user", "s", "home", "directory", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 260627}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L200-L279", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Obtains a credentials handle from secur32.dll for use with SChannel", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'SSLv3'", ":", "Secur32Const", ".", "SP_PROT_SSL3_CLIENT", ",", "'TLSv1'", ":", "Secur32Const", ".", "SP_PROT_TLS1_CLIENT", ",", "'TLSv1.1'", ":", "Secur32Const", ".", "SP_PROT_TLS1_1_CLIENT", ",", "'TLSv1.2'", ":", "Secur32Const", ".", "SP_PROT_TLS1_2_CLIENT", ",", "}", "arg_2", "=", "0", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "items", "(", ")", ":", "if", "arg_3", "in", "arg_0", ".", "_protocols", ":", "arg_2", "|=", "arg_4", "arg_5", "=", "[", "Secur32Const", ".", "CALG_AES_128", ",", "Secur32Const", ".", "CALG_AES_256", ",", "Secur32Const", ".", "CALG_3DES", ",", "Secur32Const", ".", "CALG_SHA1", ",", "Secur32Const", ".", "CALG_ECDHE", ",", "Secur32Const", ".", "CALG_DH_EPHEM", ",", "Secur32Const", ".", "CALG_RSA_KEYX", ",", "Secur32Const", ".", "CALG_RSA_SIGN", ",", "Secur32Const", ".", "CALG_ECDSA", ",", "Secur32Const", ".", "CALG_DSS_SIGN", ",", "]", "if", "'TLSv1.2'", "in", "arg_0", ".", "_protocols", ":", "arg_5", ".", "extend", "(", "[", "Secur32Const", ".", "CALG_SHA512", ",", "Secur32Const", ".", "CALG_SHA384", ",", "Secur32Const", ".", "CALG_SHA256", ",", "]", ")", "arg_6", "=", "new", "(", "secur32", ",", "'ALG_ID[%s]'", "%", "len", "(", "arg_5", ")", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_5", ")", ":", "arg_6", "[", "arg_7", "]", "=", "arg_8", "arg_9", "=", "Secur32Const", ".", "SCH_USE_STRONG_CRYPTO", "|", "Secur32Const", ".", "SCH_CRED_NO_DEFAULT_CREDS", "if", "not", "arg_0", ".", "_manual_validation", "and", "not", "arg_0", ".", "_extra_trust_roots", ":", "arg_9", "|=", "Secur32Const", ".", "SCH_CRED_AUTO_CRED_VALIDATION", "else", ":", "arg_9", "|=", "Secur32Const", ".", "SCH_CRED_MANUAL_CRED_VALIDATION", "arg_10", "=", "struct", "(", "secur32", ",", "'SCHANNEL_CRED'", ")", "arg_11", "=", "unwrap", "(", "arg_10", ")", "arg_11", ".", "dwVersion", "=", "Secur32Const", ".", "SCHANNEL_CRED_VERSION", "arg_11", ".", "cCreds", "=", "0", "arg_11", ".", "paCred", "=", "null", "(", ")", "arg_11", ".", "hRootStore", "=", "null", "(", ")", "arg_11", ".", "cMappers", "=", "0", "arg_11", ".", "aphMappers", "=", "null", "(", ")", "arg_11", ".", "cSupportedAlgs", "=", "len", "(", "arg_6", ")", "arg_11", ".", "palgSupportedAlgs", "=", "arg_6", "arg_11", ".", "grbitEnabledProtocols", "=", "arg_2", "arg_11", ".", "dwMinimumCipherStrength", "=", "0", "arg_11", ".", "dwMaximumCipherStrength", "=", "0", "arg_11", ".", "dwSessionLifespan", "=", "0", "arg_11", ".", "dwFlags", "=", "arg_9", "arg_11", ".", "dwCredFormat", "=", "0", "arg_26", "=", "new", "(", "secur32", ",", "'CredHandle *'", ")", "arg_27", "=", "secur32", ".", "AcquireCredentialsHandleW", "(", "null", "(", ")", ",", "Secur32Const", ".", "UNISP_NAME", ",", "Secur32Const", ".", "SECPKG_CRED_OUTBOUND", ",", "null", "(", ")", ",", "arg_10", ",", "null", "(", ")", ",", "null", "(", ")", ",", "arg_26", ",", "null", "(", ")", ")", "handle_error", "(", "arg_27", ")", "arg_0", ".", "_credentials_handle", "=", "arg_26"], "function": "def Func(arg_0):\n        \"\"\"\n        Obtains a credentials handle from secur32.dll for use with SChannel\n        \"\"\"\n\n        arg_1 = {\n            'SSLv3': Secur32Const.SP_PROT_SSL3_CLIENT,\n            'TLSv1': Secur32Const.SP_PROT_TLS1_CLIENT,\n            'TLSv1.1': Secur32Const.SP_PROT_TLS1_1_CLIENT,\n            'TLSv1.2': Secur32Const.SP_PROT_TLS1_2_CLIENT,\n        }\n        arg_2 = 0\n        for arg_3, arg_4 in arg_1.items():\n            if arg_3 in arg_0._protocols:\n                arg_2 |= arg_4\n\n        arg_5 = [\n            Secur32Const.CALG_AES_128,\n            Secur32Const.CALG_AES_256,\n            Secur32Const.CALG_3DES,\n            Secur32Const.CALG_SHA1,\n            Secur32Const.CALG_ECDHE,\n            Secur32Const.CALG_DH_EPHEM,\n            Secur32Const.CALG_RSA_KEYX,\n            Secur32Const.CALG_RSA_SIGN,\n            Secur32Const.CALG_ECDSA,\n            Secur32Const.CALG_DSS_SIGN,\n        ]\n        if 'TLSv1.2' in arg_0._protocols:\n            arg_5.extend([\n                Secur32Const.CALG_SHA512,\n                Secur32Const.CALG_SHA384,\n                Secur32Const.CALG_SHA256,\n            ])\n\n        arg_6 = new(secur32, 'ALG_ID[%s]' % len(arg_5))\n        for arg_7, arg_8 in enumerate(arg_5):\n            arg_6[arg_7] = arg_8\n\n        arg_9 = Secur32Const.SCH_USE_STRONG_CRYPTO | Secur32Const.SCH_CRED_NO_DEFAULT_CREDS\n        if not arg_0._manual_validation and not arg_0._extra_trust_roots:\n            arg_9 |= Secur32Const.SCH_CRED_AUTO_CRED_VALIDATION\n        else:\n            arg_9 |= Secur32Const.SCH_CRED_MANUAL_CRED_VALIDATION\n\n        arg_10 = struct(secur32, 'SCHANNEL_CRED')\n        arg_11 = unwrap(arg_10)\n\n        arg_11.dwVersion = Secur32Const.SCHANNEL_CRED_VERSION\n        arg_11.cCreds = 0\n        arg_11.paCred = null()\n        arg_11.hRootStore = null()\n        arg_11.cMappers = 0\n        arg_11.aphMappers = null()\n        arg_11.cSupportedAlgs = len(arg_6)\n        arg_11.palgSupportedAlgs = arg_6\n        arg_11.grbitEnabledProtocols = arg_2\n        arg_11.dwMinimumCipherStrength = 0\n        arg_11.dwMaximumCipherStrength = 0\n        # Default session lifetime is 10 hours\n        arg_11.dwSessionLifespan = 0\n        arg_11.dwFlags = arg_9\n        arg_11.dwCredFormat = 0\n\n        arg_26 = new(secur32, 'CredHandle *')\n\n        arg_27 = secur32.AcquireCredentialsHandleW(\n            null(),\n            Secur32Const.UNISP_NAME,\n            Secur32Const.SECPKG_CRED_OUTBOUND,\n            null(),\n            arg_10,\n            null(),\n            null(),\n            arg_26,\n            null()\n        )\n        handle_error(arg_27)\n\n        arg_0._credentials_handle = arg_26", "path": "oscrypto/_win/tls.py", "identifier": "TLSSession._obtain_credentials", "docstring": "Obtains a credentials handle from secur32.dll for use with SChannel", "docstring_tokens": ["Obtains", "a", "credentials", "handle", "from", "secur32", ".", "dll", "for", "use", "with", "SChannel"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 260628}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L87-L200", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Calculate the distance between the Eudex hashes of two terms.", "language": "python", "parameters": "(\n        self, src, tar, weights='exponential', max_length=8, normalized=False\n    )", "return_statement": "return distance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "'exponential'", ",", "arg_4", "=", "8", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "eudex", "(", "arg_1", ",", "arg_4", "=", "arg_4", ")", "^", "eudex", "(", "arg_2", ",", "arg_4", "=", "arg_4", ")", "if", "not", "arg_3", ":", "arg_7", "=", "bin", "(", "arg_6", ")", "arg_8", "=", "arg_7", ".", "count", "(", "'1'", ")", "if", "arg_5", ":", "return", "arg_8", "/", "(", "len", "(", "arg_7", ")", "-", "2", ")", "return", "arg_8", "if", "callable", "(", "arg_3", ")", ":", "arg_3", "=", "arg_3", "(", ")", "elif", "arg_3", "==", "'exponential'", ":", "arg_3", "=", "Eudex", ".", "gen_exponential", "(", ")", "elif", "arg_3", "==", "'fibonacci'", ":", "arg_3", "=", "Eudex", ".", "gen_fibonacci", "(", ")", "if", "isinstance", "(", "arg_3", ",", "GeneratorType", ")", ":", "arg_3", "=", "[", "next", "(", "arg_3", ")", "for", "_", "in", "range", "(", "arg_4", ")", "]", "[", ":", ":", "-", "1", "]", "arg_8", "=", "0", "arg_9", "=", "0", "while", "(", "arg_6", "or", "arg_5", ")", "and", "arg_3", ":", "arg_9", "+=", "8", "*", "arg_3", "[", "-", "1", "]", "arg_8", "+=", "bin", "(", "arg_6", "&", "0xFF", ")", ".", "count", "(", "'1'", ")", "*", "arg_3", ".", "pop", "(", ")", "arg_6", ">>=", "8", "if", "arg_5", ":", "arg_8", "/=", "arg_9", "return", "arg_8"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3='exponential', arg_4=8, arg_5=False\n    ):\n        \"\"\"Calculate the distance between the Eudex hashes of two terms.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        weights : str, iterable, or generator function\n            The weights or weights generator function\n\n                - If set to ``None``, a simple Hamming distance is calculated.\n                - If set to ``exponential``, weight decays by powers of 2, as\n                  proposed in the eudex specification:\n                  https://github.com/ticki/eudex.\n                - If set to ``fibonacci``, weight decays through the Fibonacci\n                  series, as in the eudex reference implementation.\n                - If set to a callable function, this assumes it creates a\n                  generator and the generator is used to populate a series of\n                  weights.\n                - If set to an iterable, the iterable's values should be\n                  integers and will be used as the weights.\n\n        max_length : int\n            The number of characters to encode as a eudex hash\n        normalized : bool\n            Normalizes to [0, 1] if True\n\n        Returns\n        -------\n        int\n            The Eudex Hamming distance\n\n        Examples\n        --------\n        >>> cmp = Eudex()\n        >>> cmp.Func('cat', 'hat')\n        128\n        >>> cmp.Func('Niall', 'Neil')\n        2\n        >>> cmp.Func('Colin', 'Cuilen')\n        10\n        >>> cmp.Func('ATCG', 'TAGC')\n        403\n\n        >>> cmp.Func('cat', 'hat', weights='fibonacci')\n        34\n        >>> cmp.Func('Niall', 'Neil', weights='fibonacci')\n        2\n        >>> cmp.Func('Colin', 'Cuilen', weights='fibonacci')\n        7\n        >>> cmp.Func('ATCG', 'TAGC', weights='fibonacci')\n        117\n\n        >>> cmp.Func('cat', 'hat', weights=None)\n        1\n        >>> cmp.Func('Niall', 'Neil', weights=None)\n        1\n        >>> cmp.Func('Colin', 'Cuilen', weights=None)\n        2\n        >>> cmp.Func('ATCG', 'TAGC', weights=None)\n        9\n\n        >>> # Using the OEIS A000142:\n        >>> cmp.Func('cat', 'hat', [1, 1, 2, 6, 24, 120, 720, 5040])\n        1\n        >>> cmp.Func('Niall', 'Neil', [1, 1, 2, 6, 24, 120, 720, 5040])\n        720\n        >>> cmp.Func('Colin', 'Cuilen',\n        ... [1, 1, 2, 6, 24, 120, 720, 5040])\n        744\n        >>> cmp.Func('ATCG', 'TAGC', [1, 1, 2, 6, 24, 120, 720, 5040])\n        6243\n\n        \"\"\"\n        # Calculate the eudex hashes and XOR them\n        arg_6 = eudex(arg_1, arg_4=arg_4) ^ eudex(\n            arg_2, arg_4=arg_4\n        )\n\n        # Simple hamming distance (all bits are equal)\n        if not arg_3:\n            arg_7 = bin(arg_6)\n            arg_8 = arg_7.count('1')\n            if arg_5:\n                return arg_8 / (len(arg_7) - 2)\n            return arg_8\n\n        # If weights is a function, it should create a generator,\n        # which we now use to populate a list\n        if callable(arg_3):\n            arg_3 = arg_3()\n        elif arg_3 == 'exponential':\n            arg_3 = Eudex.gen_exponential()\n        elif arg_3 == 'fibonacci':\n            arg_3 = Eudex.gen_fibonacci()\n        if isinstance(arg_3, GeneratorType):\n            arg_3 = [next(arg_3) for _ in range(arg_4)][::-1]\n\n        # Sum the weighted hamming distance\n        arg_8 = 0\n        arg_9 = 0\n        while (arg_6 or arg_5) and arg_3:\n            arg_9 += 8 * arg_3[-1]\n            arg_8 += bin(arg_6 & 0xFF).count('1') * arg_3.pop()\n            arg_6 >>= 8\n\n        if arg_5:\n            arg_8 /= arg_9\n\n        return arg_8", "path": "abydos/distance/_eudex.py", "identifier": "Eudex.dist_abs", "docstring": "Calculate the distance between the Eudex hashes of two terms.\n\n        Parameters\n        ----------\n        src : str\n            Source string for comparison\n        tar : str\n            Target string for comparison\n        weights : str, iterable, or generator function\n            The weights or weights generator function\n\n                - If set to ``None``, a simple Hamming distance is calculated.\n                - If set to ``exponential``, weight decays by powers of 2, as\n                  proposed in the eudex specification:\n                  https://github.com/ticki/eudex.\n                - If set to ``fibonacci``, weight decays through the Fibonacci\n                  series, as in the eudex reference implementation.\n                - If set to a callable function, this assumes it creates a\n                  generator and the generator is used to populate a series of\n                  weights.\n                - If set to an iterable, the iterable's values should be\n                  integers and will be used as the weights.\n\n        max_length : int\n            The number of characters to encode as a eudex hash\n        normalized : bool\n            Normalizes to [0, 1] if True\n\n        Returns\n        -------\n        int\n            The Eudex Hamming distance\n\n        Examples\n        --------\n        >>> cmp = Eudex()\n        >>> cmp.dist_abs('cat', 'hat')\n        128\n        >>> cmp.dist_abs('Niall', 'Neil')\n        2\n        >>> cmp.dist_abs('Colin', 'Cuilen')\n        10\n        >>> cmp.dist_abs('ATCG', 'TAGC')\n        403\n\n        >>> cmp.dist_abs('cat', 'hat', weights='fibonacci')\n        34\n        >>> cmp.dist_abs('Niall', 'Neil', weights='fibonacci')\n        2\n        >>> cmp.dist_abs('Colin', 'Cuilen', weights='fibonacci')\n        7\n        >>> cmp.dist_abs('ATCG', 'TAGC', weights='fibonacci')\n        117\n\n        >>> cmp.dist_abs('cat', 'hat', weights=None)\n        1\n        >>> cmp.dist_abs('Niall', 'Neil', weights=None)\n        1\n        >>> cmp.dist_abs('Colin', 'Cuilen', weights=None)\n        2\n        >>> cmp.dist_abs('ATCG', 'TAGC', weights=None)\n        9\n\n        >>> # Using the OEIS A000142:\n        >>> cmp.dist_abs('cat', 'hat', [1, 1, 2, 6, 24, 120, 720, 5040])\n        1\n        >>> cmp.dist_abs('Niall', 'Neil', [1, 1, 2, 6, 24, 120, 720, 5040])\n        720\n        >>> cmp.dist_abs('Colin', 'Cuilen',\n        ... [1, 1, 2, 6, 24, 120, 720, 5040])\n        744\n        >>> cmp.dist_abs('ATCG', 'TAGC', [1, 1, 2, 6, 24, 120, 720, 5040])\n        6243", "docstring_tokens": ["Calculate", "the", "distance", "between", "the", "Eudex", "hashes", "of", "two", "terms", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 260629}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_security.py#L23-L56", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Checks a Security OSStatus error code and throws an exception if there is an\n    error to report", "language": "python", "parameters": "(error, exception_class=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", "==", "0", ":", "return", "if", "arg_0", "in", "set", "(", "[", "SecurityConst", ".", "errSSLClosedNoNotify", ",", "SecurityConst", ".", "errSSLClosedAbort", "]", ")", ":", "raise", "TLSDisconnectError", "(", "'The remote end closed the connection'", ")", "if", "arg_0", "==", "SecurityConst", ".", "errSSLClosedGraceful", ":", "raise", "TLSGracefulDisconnectError", "(", "'The remote end closed the connection'", ")", "arg_2", "=", "Security", ".", "SecCopyErrorMessageString", "(", "arg_0", ",", "null", "(", ")", ")", "arg_3", "=", "CFHelpers", ".", "cf_string_to_unicode", "(", "arg_2", ")", "CoreFoundation", ".", "CFRelease", "(", "arg_2", ")", "if", "arg_3", "is", "None", "or", "arg_3", "==", "''", ":", "arg_3", "=", "'OSStatus %s'", "%", "arg_0", "if", "arg_1", "is", "None", ":", "arg_1", "=", "OSError", "raise", "arg_1", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Checks a Security OSStatus error code and throws an exception if there is an\n    error to report\n\n    :param error:\n        An OSStatus\n\n    :param exception_class:\n        The exception class to use for the exception if an error occurred\n\n    :raises:\n        OSError - when the OSStatus contains an error\n    \"\"\"\n\n    if arg_0 == 0:\n        return\n\n    if arg_0 in set([SecurityConst.errSSLClosedNoNotify, SecurityConst.errSSLClosedAbort]):\n        raise TLSDisconnectError('The remote end closed the connection')\n    if arg_0 == SecurityConst.errSSLClosedGraceful:\n        raise TLSGracefulDisconnectError('The remote end closed the connection')\n\n    arg_2 = Security.SecCopyErrorMessageString(arg_0, null())\n    arg_3 = CFHelpers.cf_string_to_unicode(arg_2)\n    CoreFoundation.CFRelease(arg_2)\n\n    if arg_3 is None or arg_3 == '':\n        arg_3 = 'OSStatus %s' % arg_0\n\n    if arg_1 is None:\n        arg_1 = OSError\n\n    raise arg_1(arg_3)", "path": "oscrypto/_osx/_security.py", "identifier": "handle_sec_error", "docstring": "Checks a Security OSStatus error code and throws an exception if there is an\n    error to report\n\n    :param error:\n        An OSStatus\n\n    :param exception_class:\n        The exception class to use for the exception if an error occurred\n\n    :raises:\n        OSError - when the OSStatus contains an error", "docstring_tokens": ["Checks", "a", "Security", "OSStatus", "error", "code", "and", "throws", "an", "exception", "if", "there", "is", "an", "error", "to", "report"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 260630}
{"url": "https://github.com/mordred-descriptor/mordred/blob/2848b088fd7b6735590242b5e22573babc724f10/mordred/surface_area/_sasa.py#L87-L92", "sha": "2848b088fd7b6735590242b5e22573babc724f10", "docstring_summary": "r\"\"\"Calculate all atomic surface area.", "language": "python", "parameters": "(self)", "return_statement": "return [self.atomic_sa(i) for i in range(len(self.rads))]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "[", "arg_0", ".", "atomic_sa", "(", "arg_1", ")", "for", "arg_1", "in", "range", "(", "len", "(", "arg_0", ".", "rads", ")", ")", "]"], "function": "def Func(arg_0):\n        r\"\"\"Calculate all atomic surface area.\n\n        :rtype: [float]\n        \"\"\"\n        return [arg_0.atomic_sa(arg_1) for arg_1 in range(len(arg_0.rads))]", "path": "mordred/surface_area/_sasa.py", "identifier": "SurfaceArea.surface_area", "docstring": "r\"\"\"Calculate all atomic surface area.\n\n        :rtype: [float]", "docstring_tokens": ["r", "Calculate", "all", "atomic", "surface", "area", "."], "nwo": "mordred-descriptor/mordred", "score": 0.9032497569731454, "idx": 260631}
{"url": "https://github.com/dexy/cashew/blob/39890a6e1e4e4e514e98cdb18368e29cc6710e52/cashew/plugin.py#L162-L169", "sha": "39890a6e1e4e4e514e98cdb18368e29cc6710e52", "docstring_summary": "Return a combined dictionary of setting values and attribute values.", "language": "python", "parameters": "(self)", "return_statement": "return attrs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "setting_values", "(", ")", "arg_1", ".", "update", "(", "arg_0", ".", "__dict__", ")", "arg_2", "=", "[", "\"_instance_settings\"", ",", "\"aliases\"", "]", "for", "arg_3", "in", "arg_2", ":", "del", "arg_1", "[", "arg_3", "]", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return a combined dictionary of setting values and attribute values.\"\"\"\n        arg_1 = arg_0.setting_values()\n        arg_1.update(arg_0.__dict__)\n        arg_2 = [\"_instance_settings\", \"aliases\"]\n        for arg_3 in arg_2:\n            del arg_1[arg_3]\n        return arg_1", "path": "cashew/plugin.py", "identifier": "Plugin.settings_and_attributes", "docstring": "Return a combined dictionary of setting values and attribute values.", "docstring_tokens": ["Return", "a", "combined", "dictionary", "of", "setting", "values", "and", "attribute", "values", "."], "nwo": "dexy/cashew", "score": 0.09252797783733271, "idx": 260632}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/b_bit_minhash.py#L138-L151", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Compute the functions C1 and C2", "language": "python", "parameters": "(self, a1, a2, r1, r2)", "return_statement": "return c1, c2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_3", "==", "0.0", "and", "arg_4", "==", "0.0", ":", "return", "arg_1", ",", "arg_2", "arg_5", "=", "1", "/", "(", "arg_3", "+", "arg_4", ")", "arg_6", "=", "(", "arg_1", "*", "arg_4", "+", "arg_2", "*", "arg_3", ")", "*", "arg_5", "arg_7", "=", "(", "arg_1", "*", "arg_3", "+", "arg_2", "*", "arg_4", ")", "*", "arg_5", "return", "arg_6", ",", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        '''\n        Compute the functions C1 and C2\n        '''\n        if arg_3 == 0.0 and arg_4 == 0.0:\n            # Find the limits of C1 and C2 as r1 -> 0 and r2 -> 0\n            # Since the b-value must be the same and r1 = r2,\n            # we have A1(r1, b1) = A2(r2, b2) = A,\n            # then the limits for both C1 and C2 are A.\n            return arg_1, arg_2\n        arg_5 = 1 / (arg_3 + arg_4)\n        arg_6 = (arg_1 * arg_4 + arg_2 * arg_3) * arg_5\n        arg_7 = (arg_1 * arg_3 + arg_2 * arg_4) * arg_5\n        return arg_6, arg_7", "path": "datasketch/b_bit_minhash.py", "identifier": "bBitMinHash._calc_c", "docstring": "Compute the functions C1 and C2", "docstring_tokens": ["Compute", "the", "functions", "C1", "and", "C2"], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 260633}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/events.py#L105-L116", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Update `_handler_map` after `handlers` have been\n        modified.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "defaultdict", "(", "list", ")", "for", "arg_2", ",", "arg_3", "in", "enumerate", "(", "arg_0", ".", "handlers", ")", ":", "for", "arg_4", ",", "arg_5", "in", "inspect", ".", "getmembers", "(", "arg_3", ",", "callable", ")", ":", "if", "not", "hasattr", "(", "arg_5", ",", "\"_pyxmpp_event_handled\"", ")", ":", "continue", "arg_6", "=", "arg_5", ".", "_pyxmpp_event_handled", "arg_1", "[", "arg_6", "]", ".", "append", "(", "(", "arg_2", ",", "arg_5", ")", ")", "arg_0", ".", "_handler_map", "=", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Update `_handler_map` after `handlers` have been\n        modified.\"\"\"\n        arg_1 = defaultdict(list)\n        for arg_2, arg_3 in enumerate(arg_0.handlers):\n            for arg_4, arg_5 in inspect.getmembers(arg_3, callable):\n                if not hasattr(arg_5, \"_pyxmpp_event_handled\"):\n                    continue\n                # pylint: disable-msg=W0212\n                arg_6 = arg_5._pyxmpp_event_handled\n                arg_1[arg_6].append( (arg_2, arg_5) )\n        arg_0._handler_map = arg_1", "path": "pyxmpp2/mainloop/events.py", "identifier": "EventDispatcher._update_handlers", "docstring": "Update `_handler_map` after `handlers` have been\n        modified.", "docstring_tokens": ["Update", "_handler_map", "after", "handlers", "have", "been", "modified", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260634}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/optflow.py#L60-L87", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Write optical flow to file.", "language": "python", "parameters": "(flow, filename, quantize=False, concat_axis=0, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "0", ",", "*", "arg_4", ",", "**", "arg_5", ")", ":", "if", "not", "arg_2", ":", "with", "open", "(", "arg_1", ",", "'wb'", ")", "as", "f", ":", "f", ".", "write", "(", "'PIEH'", ".", "encode", "(", "'utf-8'", ")", ")", "np", ".", "array", "(", "[", "arg_0", ".", "shape", "[", "1", "]", ",", "arg_0", ".", "shape", "[", "0", "]", "]", ",", "dtype", "=", "np", ".", "int32", ")", ".", "tofile", "(", "f", ")", "arg_0", "=", "arg_0", ".", "astype", "(", "np", ".", "float32", ")", "arg_0", ".", "tofile", "(", "f", ")", "f", ".", "flush", "(", ")", "else", ":", "assert", "arg_3", "in", "[", "0", ",", "1", "]", "arg_6", ",", "arg_7", "=", "quantize_flow", "(", "arg_0", ",", "*", "arg_4", ",", "**", "arg_5", ")", "arg_8", "=", "np", ".", "concatenate", "(", "(", "arg_6", ",", "arg_7", ")", ",", "axis", "=", "arg_3", ")", "imwrite", "(", "arg_8", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=0, *arg_4, **arg_5):\n    \"\"\"Write optical flow to file.\n\n    If the flow is not quantized, it will be saved as a .flo file losslessly,\n    otherwise a jpeg image which is lossy but of much smaller size. (dx and dy\n    will be concatenated horizontally into a single image if quantize is True.)\n\n    Args:\n        flow (ndarray): (h, w, 2) array of optical flow.\n        filename (str): Output filepath.\n        quantize (bool): Whether to quantize the flow and save it to 2 jpeg\n            images. If set to True, remaining args will be passed to\n            :func:`quantize_flow`.\n        concat_axis (int): The axis that dx and dy are concatenated,\n            can be either 0 or 1. Ignored if quantize is False.\n    \"\"\"\n    if not arg_2:\n        with open(arg_1, 'wb') as f:\n            f.write('PIEH'.encode('utf-8'))\n            np.array([arg_0.shape[1], arg_0.shape[0]], dtype=np.int32).tofile(f)\n            arg_0 = arg_0.astype(np.float32)\n            arg_0.tofile(f)\n            f.flush()\n    else:\n        assert arg_3 in [0, 1]\n        arg_6, arg_7 = quantize_flow(arg_0, *arg_4, **arg_5)\n        arg_8 = np.concatenate((arg_6, arg_7), axis=arg_3)\n        imwrite(arg_8, arg_1)", "path": "mmcv/video/optflow.py", "identifier": "flowwrite", "docstring": "Write optical flow to file.\n\n    If the flow is not quantized, it will be saved as a .flo file losslessly,\n    otherwise a jpeg image which is lossy but of much smaller size. (dx and dy\n    will be concatenated horizontally into a single image if quantize is True.)\n\n    Args:\n        flow (ndarray): (h, w, 2) array of optical flow.\n        filename (str): Output filepath.\n        quantize (bool): Whether to quantize the flow and save it to 2 jpeg\n            images. If set to True, remaining args will be passed to\n            :func:`quantize_flow`.\n        concat_axis (int): The axis that dx and dy are concatenated,\n            can be either 0 or 1. Ignored if quantize is False.", "docstring_tokens": ["Write", "optical", "flow", "to", "file", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260635}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L153-L155", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "Formats the elements of an argument set appropriately", "language": "python", "parameters": "(cls, spec)", "return_statement": "return type(spec)((k, str(v)) for (k,v) in spec.items())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "type", "(", "arg_1", ")", "(", "(", "arg_2", ",", "str", "(", "arg_3", ")", ")", "for", "(", "arg_2", ",", "arg_3", ")", "in", "arg_1", ".", "items", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \" Formats the elements of an argument set appropriately\"\n        return type(arg_1)((arg_2, str(arg_3)) for (arg_2,arg_3) in arg_1.items())", "path": "lancet/core.py", "identifier": "Arguments.spec_formatter", "docstring": "Formats the elements of an argument set appropriately", "docstring_tokens": ["Formats", "the", "elements", "of", "an", "argument", "set", "appropriately"], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 260636}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L3191-L3209", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Sets the finish time and computes the runtime in human readable format", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_run_information", "[", "arg_0", ".", "v_crun", "]", "arg_2", "=", "arg_1", "[", "'timestamp'", "]", "arg_3", "=", "arg_0", ".", "_summarize_explored_parameters", "(", ")", "arg_4", "=", "time", ".", "time", "(", ")", "arg_5", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "arg_4", ")", "arg_6", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "arg_2", ")", "arg_7", "=", "str", "(", "arg_5", "-", "arg_6", ")", "arg_1", "[", "'parameter_summary'", "]", "=", "arg_3", "arg_1", "[", "'completed'", "]", "=", "1", "arg_1", "[", "'finish_timestamp'", "]", "=", "arg_4", "arg_1", "[", "'runtime'", "]", "=", "arg_7"], "function": "def Func(arg_0):\n        \"\"\" Sets the finish time and computes the runtime in human readable format \"\"\"\n\n        arg_1 = arg_0._run_information[arg_0.v_crun]\n        arg_2 = arg_1['timestamp']\n\n        arg_3 = arg_0._summarize_explored_parameters()\n\n        arg_4 = time.time()\n\n        arg_5 = datetime.datetime.fromtimestamp(arg_4)\n        arg_6 = datetime.datetime.fromtimestamp(arg_2)\n\n        arg_7 = str(arg_5 - arg_6)\n\n        arg_1['parameter_summary'] = arg_3\n        arg_1['completed'] = 1\n        arg_1['finish_timestamp'] = arg_4\n        arg_1['runtime'] = arg_7", "path": "pypet/trajectory.py", "identifier": "Trajectory._set_finish", "docstring": "Sets the finish time and computes the runtime in human readable format", "docstring_tokens": ["Sets", "the", "finish", "time", "and", "computes", "the", "runtime", "in", "human", "readable", "format"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260637}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L112-L184", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Format the old format so it can be merged into the newer format.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_10", ".", "CONFIGURATION", "[", "\"inactive_database\"", "]", ":", "arg_1", "=", "(", "arg_10", ".", "CURRENT_DIRECTORY", "+", "\"inactive-db.json\"", ")", "if", "arg_10", ".", "path", ".", "isfile", "(", "arg_1", ")", ":", "arg_2", "=", "Dict", "(", ")", ".", "from_json", "(", "File", "(", "arg_1", ")", ".", "read", "(", ")", ")", "arg_3", "=", "{", "}", "arg_4", "=", "arg_2", ".", "keys", "(", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "arg_2", "[", "arg_5", "]", ".", "keys", "(", ")", "arg_3", "[", "arg_5", "]", "=", "{", "}", "for", "arg_7", "in", "arg_6", ":", "if", "arg_7", ".", "isdigit", "(", ")", ":", "arg_3", "[", "arg_5", "]", "[", "arg_8", "(", "arg_7", ")", "-", "(", "arg_0", ".", "one_day_in_seconds", "*", "30", ")", "]", "=", "arg_2", "[", "arg_5", "]", "[", "arg_7", "]", "else", ":", "arg_3", "[", "arg_5", "]", "[", "arg_8", "(", "arg_10", ".", "time", "(", ")", ")", "-", "(", "arg_0", ".", "one_day_in_seconds", "*", "30", ")", "]", "=", "arg_2", "[", "arg_5", "]", "[", "arg_7", "]", "if", "\"inactive_db\"", "in", "arg_10", ".", "INTERN", ":", "arg_10", ".", "INTERN", "[", "\"inactive_db\"", "]", ".", "update", "(", "arg_3", ")", "else", ":", "arg_10", ".", "INTERN", "[", "\"inactive_db\"", "]", "=", "arg_3", "File", "(", "arg_1", ")", ".", "delete", "(", ")"], "function": "def Func(arg_0):  # pragma: no cover\n        \"\"\"\n        Format the old format so it can be merged into the newer format.\n        \"\"\"\n\n        if arg_10.CONFIGURATION[\"inactive_database\"]:\n            # The database subsystem is activated.\n\n            # We construct the possible path to an older version of the database.\n            arg_1 = (\n                arg_10.CURRENT_DIRECTORY + \"inactive-db.json\"\n            )\n\n            if arg_10.path.isfile(arg_1):\n                # The histortical file already exists.\n\n                # We get its content.\n                arg_2 = Dict().from_json(File(arg_1).read())\n\n                # We initiate a variable which will save the data that is going\n                # to be merged.\n                arg_3 = {}\n\n                # We get the database keybase.\n                arg_4 = arg_2.keys()\n\n                for arg_5 in arg_4:\n                    # We loop through the list of upper keys.\n\n                    # We get the lowest keys.\n                    arg_6 = arg_2[arg_5].keys()\n\n                    # We initiate the data to parse.\n                    arg_3[arg_5] = {}\n\n                    for arg_7 in arg_6:\n                        # We loop through the list of lower keys.\n\n                        if arg_7.isdigit():\n                            # The current low key is a digit.\n\n                            # We parse its content (from the old) into the new format.\n                            # In between, we remove 30 days from the low_key so that\n                            # it become in the past. This way they will be retested\n                            # automatically.\n                            arg_3[arg_5][\n                                arg_8(arg_7) - (arg_0.one_day_in_seconds * 30)\n                            ] = arg_2[arg_5][arg_7]\n                        else:\n                            # The current low key is not a digit.\n\n                            # We parse its content (from the old) into the new format.\n                            # In between, we remove 30 days from the current time so that\n                            # it become in the past. This way they will be retested\n                            # automatically.\n                            arg_3[arg_5][\n                                arg_8(arg_10.time()) - (arg_0.one_day_in_seconds * 30)\n                            ] = arg_2[arg_5][arg_7]\n\n                if \"inactive_db\" in arg_10.INTERN:\n                    # The current (new) database is not empty.\n\n                    # We update add the content of the old into the current database.\n                    arg_10.INTERN[\"inactive_db\"].update(arg_3)\n                else:\n                    # The current (new) database is empty.\n\n                    # We replace the content with the data_to_parse as it is complient\n                    # with the new format.\n                    arg_10.INTERN[\"inactive_db\"] = arg_3\n\n                # We delete the old database file.\n                File(arg_1).delete()", "path": "PyFunceble/database.py", "identifier": "Inactive._reformat_historical_formating_error", "docstring": "Format the old format so it can be merged into the newer format.", "docstring_tokens": ["Format", "the", "old", "format", "so", "it", "can", "be", "merged", "into", "the", "newer", "format", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 260638}
{"url": "https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/connection.py#L642-L654", "sha": "5392392046989f1bb84ba938c30e4d48311075f1", "docstring_summary": "Factory method for Sender links.", "language": "python", "parameters": "(self, source_address, target_address=None,\n                      event_handler=None, name=None, properties=None)", "return_statement": "return sl", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_6", "=", "arg_4", "or", "str", "(", "arg_1", ")", "if", "arg_6", "in", "arg_0", ".", "_sender_links", ":", "raise", "KeyError", "(", "\"Sender %s already exists!\"", "%", "arg_6", ")", "arg_7", "=", "_SessionProxy", "(", "\"session-%s\"", "%", "arg_6", ",", "arg_0", ")", "arg_7", ".", "open", "(", ")", "arg_8", "=", "arg_7", ".", "new_sender", "(", "arg_6", ")", "arg_8", ".", "configure", "(", "arg_2", ",", "arg_1", ",", "arg_3", ",", "arg_5", ")", "arg_0", ".", "_sender_links", "[", "arg_6", "]", "=", "arg_8", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                      arg_3=None, arg_4=None, arg_5=None):\n        \"\"\"Factory method for Sender links.\"\"\"\n        arg_6 = arg_4 or str(arg_1)\n        if arg_6 in arg_0._sender_links:\n            raise KeyError(\"Sender %s already exists!\" % arg_6)\n\n        arg_7 = _SessionProxy(\"session-%s\" % arg_6, arg_0)\n        arg_7.open()\n        arg_8 = arg_7.new_sender(arg_6)\n        arg_8.configure(arg_2, arg_1, arg_3, arg_5)\n        arg_0._sender_links[arg_6] = arg_8\n        return arg_8", "path": "pyngus/connection.py", "identifier": "Connection.create_sender", "docstring": "Factory method for Sender links.", "docstring_tokens": ["Factory", "method", "for", "Sender", "links", "."], "nwo": "kgiusti/pyngus", "score": 0.1802640598604426, "idx": 260639}
{"url": "https://github.com/myint/language-check/blob/58e419833ef28a9193fcaa21193616a8a14504a9/setup.py#L363-L388", "sha": "58e419833ef28a9193fcaa21193616a8a14504a9", "docstring_summary": "Convert Python files using lib3to2.", "language": "python", "parameters": "(args=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_0", "=", "BASE_ARGS_3TO2", "if", "arg_0", "is", "None", "else", "BASE_ARGS_3TO2", "+", "arg_0", "try", ":", "arg_1", "=", "subprocess", ".", "Popen", "(", "[", "'3to2'", "]", "+", "arg_0", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "except", "OSError", ":", "for", "arg_2", "in", "glob", ".", "glob", "(", "'*.egg'", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_2", ")", "and", "arg_2", "not", "in", "sys", ".", "path", ":", "sys", ".", "path", ".", "append", "(", "arg_2", ")", "try", ":", "from", "lib3to2", ".", "main", "import", "main", "as", "lib3to2_main", "except", "ImportError", ":", "raise", "OSError", "(", "'3to2 script is unavailable.'", ")", "else", ":", "if", "lib3to2_main", "(", "'lib3to2.fixes'", ",", "arg_0", ")", ":", "raise", "Exception", "(", "'lib3to2 parsing error'", ")", "else", ":", "arg_3", "=", "0", "while", "arg_1", ".", "poll", "(", ")", "is", "None", ":", "arg_4", "=", "arg_1", ".", "stderr", ".", "readline", "(", ")", "sys", ".", "stderr", ".", "write", "(", "arg_4", ")", "arg_3", "+=", "arg_4", ".", "count", "(", "': ParseError: '", ")", "if", "arg_1", ".", "returncode", "or", "arg_3", ":", "raise", "Exception", "(", "'lib3to2 parsing error'", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Convert Python files using lib3to2.\"\"\"\n    arg_0 = BASE_ARGS_3TO2 if arg_0 is None else BASE_ARGS_3TO2 + arg_0\n    try:\n        arg_1 = subprocess.Popen(['3to2'] + arg_0, stderr=subprocess.PIPE)\n    except OSError:\n        for arg_2 in glob.glob('*.egg'):\n            if os.path.isdir(arg_2) and arg_2 not in sys.path:\n                sys.path.append(arg_2)\n        try:\n            from lib3to2.main import main as lib3to2_main\n        except ImportError:\n            raise OSError('3to2 script is unavailable.')\n        else:\n            if lib3to2_main('lib3to2.fixes', arg_0):\n                raise Exception('lib3to2 parsing error')\n    else:\n        # HACK: workaround for 3to2 never returning non-zero\n        # when using the -j option.\n        arg_3 = 0\n        while arg_1.poll() is None:\n            arg_4 = arg_1.stderr.readline()\n            sys.stderr.write(arg_4)\n            arg_3 += arg_4.count(': ParseError: ')\n        if arg_1.returncode or arg_3:\n            raise Exception('lib3to2 parsing error')", "path": "setup.py", "identifier": "run_3to2", "docstring": "Convert Python files using lib3to2.", "docstring_tokens": ["Convert", "Python", "files", "using", "lib3to2", "."], "nwo": "myint/language-check", "score": 0.7367171749390385, "idx": 260640}
{"url": "https://github.com/saxix/sample-data-utils/blob/769f1b46e60def2675a14bd5872047af6d1ea398/sample_data_utils/numeric.py#L24-L32", "sha": "769f1b46e60def2675a14bd5872047af6d1ea398", "docstring_summary": "returns a a random string that represent a binary representation", "language": "python", "parameters": "(length)", "return_statement": "return (mask + ''.join([str(num >> i & 1) for i in range(7, -1, -1)]))[-length:]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "randint", "(", "1", ",", "999999", ")", "arg_2", "=", "'0'", "*", "arg_0", "return", "(", "arg_2", "+", "''", ".", "join", "(", "[", "str", "(", "arg_1", ">>", "arg_3", "&", "1", ")", "for", "arg_3", "in", "range", "(", "7", ",", "-", "1", ",", "-", "1", ")", "]", ")", ")", "[", "-", "arg_0", ":", "]"], "function": "def Func(arg_0):\n    \"\"\"\n        returns a a random string that represent a Func representation\n\n    :param length: number of bits\n    \"\"\"\n    arg_1 = randint(1, 999999)\n    arg_2 = '0' * arg_0\n    return (arg_2 + ''.join([str(arg_1 >> arg_3 & 1) for arg_3 in range(7, -1, -1)]))[-arg_0:]", "path": "sample_data_utils/numeric.py", "identifier": "binary", "docstring": "returns a a random string that represent a binary representation\n\n    :param length: number of bits", "docstring_tokens": ["returns", "a", "a", "random", "string", "that", "represent", "a", "binary", "representation"], "nwo": "saxix/sample-data-utils", "score": 0.12050106452410352, "idx": 260641}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/IRQueryableList.py#L134-L148", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "refetch - Fetch a fresh copy of all items in this list.\n\t\t\t\tReturns a new list. To update in-place, use \"reload\".", "language": "python", "parameters": "(self)", "return_statement": "return mdl.objects.getMultiple(pks)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", "==", "0", ":", "return", "IRQueryableList", "(", ")", "arg_1", "=", "arg_0", ".", "getModel", "(", ")", "arg_2", "=", "[", "item", ".", "_id", "for", "item", "in", "arg_0", "if", "item", ".", "_id", "]", "return", "arg_1", ".", "objects", ".", "getMultiple", "(", "arg_2", ")"], "function": "def Func(arg_0):\n\t\t'''\n\t\t\tFunc - Fetch a fresh copy of all items in this list.\n\t\t\t\tReturns a new list. To update in-place, use \"reload\".\n\n\t\t\t@return IRQueryableList<IndexedRedisModel> - List of fetched items\n\t\t'''\n\n\t\tif len(arg_0) == 0:\n\t\t\treturn IRQueryableList()\n\n\t\targ_1 = arg_0.getModel()\n\t\targ_2 = [item._id for item in arg_0 if item._id]\n\n\t\treturn arg_1.objects.getMultiple(arg_2)", "path": "IndexedRedis/IRQueryableList.py", "identifier": "IRQueryableList.refetch", "docstring": "refetch - Fetch a fresh copy of all items in this list.\n\t\t\t\tReturns a new list. To update in-place, use \"reload\".\n\n\t\t\t@return IRQueryableList<IndexedRedisModel> - List of fetched items", "docstring_tokens": ["refetch", "-", "Fetch", "a", "fresh", "copy", "of", "all", "items", "in", "this", "list", ".", "Returns", "a", "new", "list", ".", "To", "update", "in", "-", "place", "use", "reload", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 260642}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L37-L39", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Check if the translocation of source causes activity of target.", "language": "python", "parameters": "(data: Dict)", "return_statement": "return part_has_modifier(data, SUBJECT, TRANSLOCATION) and part_has_modifier(data, OBJECT, ACTIVITY)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "bool", ":", "return", "part_has_modifier", "(", "arg_0", ",", "SUBJECT", ",", "TRANSLOCATION", ")", "and", "part_has_modifier", "(", "arg_0", ",", "OBJECT", ",", "ACTIVITY", ")"], "function": "def Func(arg_0: arg_1) -> bool:\n    \"\"\"Check if the translocation of source causes activity of target.\"\"\"\n    return part_has_modifier(arg_0, SUBJECT, TRANSLOCATION) and part_has_modifier(arg_0, OBJECT, ACTIVITY)", "path": "src/pybel_tools/biogrammar/double_edges.py", "identifier": "has_translocation_increases_activity", "docstring": "Check if the translocation of source causes activity of target.", "docstring_tokens": ["Check", "if", "the", "translocation", "of", "source", "causes", "activity", "of", "target", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260643}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/utils/progress.py#L113-L155", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Progress an iterator and updates a pretty status line to the terminal.", "language": "python", "parameters": "(iterator, prefix)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "terminal_width", "(", "arg_1", ")", ">", "25", ":", "arg_1", "=", "(", "\"..\"", "+", "get_cut_prefix", "(", "arg_1", ",", "23", ")", ")", "arg_2", "=", "start", "=", "time", "(", ")", "arg_3", "=", "written", "=", "0", "arg_4", "=", "deque", "(", "maxlen", "=", "5", ")", "for", "arg_5", "in", "arg_0", ":", "yield", "arg_5", "arg_6", "=", "time", "(", ")", "arg_7", "=", "arg_6", "-", "start", "written", "+=", "len", "(", "arg_5", ")", "arg_8", "=", "arg_6", "-", "arg_2", "if", "arg_8", ">=", "0.5", ":", "arg_4", ".", "appendleft", "(", "(", "written", "-", "arg_3", ",", "arg_2", ",", ")", ")", "arg_2", "=", "arg_6", "arg_3", "=", "written", "arg_9", "=", "sum", "(", "h", "[", "0", "]", "for", "h", "in", "arg_4", ")", "arg_10", "=", "arg_6", "-", "arg_4", "[", "-", "1", "]", "[", "1", "]", "arg_11", "=", "arg_9", "/", "arg_10", "arg_12", "=", "create_status_line", "(", "arg_1", "=", "arg_1", ",", "written", "=", "format_filesize", "(", "written", ")", ",", "arg_7", "=", "format_time", "(", "arg_7", ")", ",", "arg_11", "=", "format_filesize", "(", "arg_11", ")", ")", "print_inplace", "(", "arg_12", ")", "sys", ".", "stderr", ".", "write", "(", "\"\\n\"", ")", "sys", ".", "stderr", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Progress an iterator and updates a pretty status line to the terminal.\n\n    The status line contains:\n     - Amount of data read from the iterator\n     - Time elapsed\n     - Average speed, based on the last few seconds.\n    \"\"\"\n    if terminal_width(arg_1) > 25:\n        arg_1 = (\"..\" + get_cut_prefix(arg_1, 23))\n    arg_2 = start = time()\n    arg_3 = written = 0\n    arg_4 = deque(maxlen=5)\n\n    for arg_5 in arg_0:\n        yield arg_5\n\n        arg_6 = time()\n        arg_7 = arg_6 - start\n        written += len(arg_5)\n\n        arg_8 = arg_6 - arg_2\n        if arg_8 >= 0.5:\n            arg_4.appendleft((\n                written - arg_3,\n                arg_2,\n            ))\n            arg_2 = arg_6\n            arg_3 = written\n\n            arg_9 = sum(h[0] for h in arg_4)\n            arg_10 = arg_6 - arg_4[-1][1]\n            arg_11 = arg_9 / arg_10\n\n            arg_12 = create_status_line(\n                arg_1=arg_1,\n                written=format_filesize(written),\n                arg_7=format_time(arg_7),\n                arg_11=format_filesize(arg_11)\n            )\n            print_inplace(arg_12)\n    sys.stderr.write(\"\\n\")\n    sys.stderr.flush()", "path": "src/streamlink_cli/utils/progress.py", "identifier": "progress", "docstring": "Progress an iterator and updates a pretty status line to the terminal.\n\n    The status line contains:\n     - Amount of data read from the iterator\n     - Time elapsed\n     - Average speed, based on the last few seconds.", "docstring_tokens": ["Progress", "an", "iterator", "and", "updates", "a", "pretty", "status", "line", "to", "the", "terminal", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 260644}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/client.py#L1568-L1598", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Fetch the status of engine queues.", "language": "python", "parameters": "(self, targets='all', verbose=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'all'", ",", "arg_2", "=", "False", ")", ":", "if", "arg_1", "==", "'all'", ":", "arg_3", "=", "None", "else", ":", "arg_3", "=", "arg_0", ".", "_build_targets", "(", "arg_1", ")", "[", "1", "]", "arg_4", "=", "dict", "(", "arg_1", "=", "arg_3", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "_query_socket", ",", "\"queue_request\"", ",", "arg_4", "=", "arg_4", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "session", ".", "recv", "(", "arg_0", ".", "_query_socket", ",", "0", ")", "if", "arg_0", ".", "debug", ":", "pprint", "(", "arg_6", ")", "arg_4", "=", "arg_6", "[", "'content'", "]", "arg_7", "=", "arg_4", ".", "pop", "(", "'status'", ")", "if", "arg_7", "!=", "'ok'", ":", "raise", "arg_0", ".", "_unwrap_exception", "(", "arg_4", ")", "arg_4", "=", "rekey", "(", "arg_4", ")", "if", "isinstance", "(", "arg_1", ",", "int", ")", ":", "return", "arg_4", "[", "arg_1", "]", "else", ":", "return", "arg_4"], "function": "def Func(arg_0, arg_1='all', arg_2=False):\n        \"\"\"Fetch the status of engine queues.\n\n        Parameters\n        ----------\n\n        targets : int/str/list of ints/strs\n                the engines whose states are to be queried.\n                default : all\n        verbose : bool\n                Whether to return lengths only, or lists of ids for each element\n        \"\"\"\n        if arg_1 == 'all':\n            # allow 'all' to be evaluated on the engine\n            arg_3 = None\n        else:\n            arg_3 = arg_0._build_targets(arg_1)[1]\n        arg_4 = dict(arg_1=arg_3, arg_2=arg_2)\n        arg_0.session.send(arg_0._query_socket, \"queue_request\", arg_4=arg_4)\n        arg_5,arg_6 = arg_0.session.recv(arg_0._query_socket, 0)\n        if arg_0.debug:\n            pprint(arg_6)\n        arg_4 = arg_6['content']\n        arg_7 = arg_4.pop('status')\n        if arg_7 != 'ok':\n            raise arg_0._unwrap_exception(arg_4)\n        arg_4 = rekey(arg_4)\n        if isinstance(arg_1, int):\n            return arg_4[arg_1]\n        else:\n            return arg_4", "path": "environment/lib/python2.7/site-packages/IPython/parallel/client/client.py", "identifier": "Client.queue_status", "docstring": "Fetch the status of engine queues.\n\n        Parameters\n        ----------\n\n        targets : int/str/list of ints/strs\n                the engines whose states are to be queried.\n                default : all\n        verbose : bool\n                Whether to return lengths only, or lists of ids for each element", "docstring_tokens": ["Fetch", "the", "status", "of", "engine", "queues", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260645}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L475-L499", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Parse the document handle.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "LatexCommand", "(", "'setDocRef'", ",", "{", "'name'", ":", "'handle'", ",", "'required'", ":", "True", ",", "'bracket'", ":", "'{'", "}", ")", "try", ":", "arg_2", "=", "next", "(", "arg_1", ".", "parse", "(", "arg_0", ".", "_tex", ")", ")", "except", "StopIteration", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'lsstdoc has no setDocRef'", ")", "arg_0", ".", "_handle", "=", "None", "arg_0", ".", "_series", "=", "None", "arg_0", ".", "_serial", "=", "None", "return", "arg_0", ".", "_handle", "=", "arg_2", "[", "'handle'", "]", "try", ":", "arg_0", ".", "_series", ",", "arg_0", ".", "_serial", "=", "arg_0", ".", "_handle", ".", "split", "(", "'-'", ",", "1", ")", "except", "ValueError", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'lsstdoc handle cannot be parsed into '", "'series and serial: %r'", ",", "arg_0", ".", "_handle", ")", "arg_0", ".", "_series", "=", "None", "arg_0", ".", "_serial", "=", "None"], "function": "def Func(arg_0):\n        \"\"\"Parse the document handle.\n\n        Sets the ``_series``, ``_serial``, and ``_handle`` attributes.\n        \"\"\"\n        arg_1 = LatexCommand(\n            'setDocRef',\n            {'name': 'handle', 'required': True, 'bracket': '{'})\n        try:\n            arg_2 = next(arg_1.parse(arg_0._tex))\n        except StopIteration:\n            arg_0._logger.warning('lsstdoc has no setDocRef')\n            arg_0._handle = None\n            arg_0._series = None\n            arg_0._serial = None\n            return\n\n        arg_0._handle = arg_2['handle']\n        try:\n            arg_0._series, arg_0._serial = arg_0._handle.split('-', 1)\n        except ValueError:\n            arg_0._logger.warning('lsstdoc handle cannot be parsed into '\n                                 'series and serial: %r', arg_0._handle)\n            arg_0._series = None\n            arg_0._serial = None", "path": "lsstprojectmeta/tex/lsstdoc.py", "identifier": "LsstLatexDoc._parse_doc_ref", "docstring": "Parse the document handle.\n\n        Sets the ``_series``, ``_serial``, and ``_handle`` attributes.", "docstring_tokens": ["Parse", "the", "document", "handle", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 260646}
{"url": "https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/JMeter/reader.py#L56-L72", "sha": "d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b", "docstring_summary": "translate exception str to http code", "language": "python", "parameters": "(param1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", "<=", "3", ":", "try", ":", "int", "(", "arg_0", ")", "except", "BaseException", ":", "logger", ".", "error", "(", "\"JMeter wrote some strange data into codes column: %s\"", ",", "arg_0", ")", "else", ":", "return", "int", "(", "arg_0", ")", "arg_1", "=", "arg_0", ".", "split", "(", "' '", ")", "[", "-", "1", "]", "if", "arg_1", "in", "KNOWN_EXC", ".", "keys", "(", ")", ":", "return", "0", "else", ":", "logger", ".", "warning", "(", "\"Unknown Java exception. %s\"", ",", "arg_0", ")", "return", "0"], "function": "def Func(arg_0):\n    \"\"\" translate exception str to http code\"\"\"\n    if len(arg_0) <= 3:\n        try:\n            int(arg_0)\n        except BaseException:\n            logger.error(\n                \"JMeter wrote some strange data into codes column: %s\", arg_0)\n        else:\n            return int(arg_0)\n\n    arg_1 = arg_0.split(' ')[-1]\n    if arg_1 in KNOWN_EXC.keys():\n        return 0\n    else:\n        logger.warning(\"Unknown Java exception. %s\", arg_0)\n        return 0", "path": "yandextank/plugins/JMeter/reader.py", "identifier": "_exc_to_http", "docstring": "translate exception str to http code", "docstring_tokens": ["translate", "exception", "str", "to", "http", "code"], "nwo": "yandex/yandex-tank", "score": 0.9699385388286178, "idx": 260647}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py#L253-L261", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Strips and filters empty or commented lines.", "language": "python", "parameters": "(iterator)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ":", "arg_1", "=", "COMMENT_RE", ".", "sub", "(", "''", ",", "arg_1", ")", "arg_1", "=", "arg_1", ".", "strip", "(", ")", "if", "arg_1", ":", "yield", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Strips and filters empty or commented lines.\n    \"\"\"\n    for arg_1 in arg_0:\n        arg_1 = COMMENT_RE.sub('', arg_1)\n        arg_1 = arg_1.strip()\n        if arg_1:\n            yield arg_1", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py", "identifier": "ignore_comments", "docstring": "Strips and filters empty or commented lines.", "docstring_tokens": ["Strips", "and", "filters", "empty", "or", "commented", "lines", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260648}
{"url": "https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/examples/02_food.py#L46-L48", "sha": "48c842fe053bf9cd6446c4b33fb081c65339aa48", "docstring_summary": "Say something in the morning", "language": "python", "parameters": "(self, message=\"Breakfast is ready\", shout: bool = False)", "return_statement": "return self.helper.output(message, shout)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\"Breakfast is ready\"", ",", "arg_2", ":", "arg_3", "=", "False", ")", ":", "return", "arg_0", ".", "helper", ".", "output", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1=\"Breakfast is ready\", arg_2: arg_3 = False):\n        \"\"\"Say something in the morning\"\"\"\n        return arg_0.helper.output(arg_1, arg_2)", "path": "examples/02_food.py", "identifier": "Food.breakfast", "docstring": "Say something in the morning", "docstring_tokens": ["Say", "something", "in", "the", "morning"], "nwo": "yaz/yaz", "score": 0.138843686048881, "idx": 260649}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1238-L1253", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Convenience method to wait for a window with the given name to\n        disappear.", "language": "python", "parameters": "(self, winName, timeout=10)", "return_statement": "return self.waitFor(timeout, 'AXUIElementDestroyed',\n                            callback=callback, args=args,\n                            AXRole='AXWindow', AXTitle=winName)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "10", ")", ":", "arg_3", "=", "AXCallbacks", ".", "elemDisappearedCallback", "arg_4", "=", "None", "arg_5", "=", "(", "arg_4", ",", "arg_0", ")", "arg_6", "=", "arg_0", ".", "findFirst", "(", "AXRole", "=", "'AXWindow'", ",", "AXTitle", "=", "arg_1", ")", "return", "arg_0", ".", "waitFor", "(", "arg_2", ",", "'AXUIElementDestroyed'", ",", "arg_3", "=", "arg_3", ",", "arg_5", "=", "arg_5", ",", "AXRole", "=", "'AXWindow'", ",", "AXTitle", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=10):\n        \"\"\"Convenience method to wait for a window with the given name to\n        disappear.\n\n        Returns: Boolean\n        \"\"\"\n        arg_3 = AXCallbacks.elemDisappearedCallback\n        arg_4 = None\n        arg_5 = (arg_4, arg_0)\n\n        # For some reason for the AXUIElementDestroyed notification to fire,\n        # we need to have a reference to it first\n        arg_6 = arg_0.findFirst(AXRole='AXWindow', AXTitle=arg_1)\n        return arg_0.waitFor(arg_2, 'AXUIElementDestroyed',\n                            arg_3=arg_3, arg_5=arg_5,\n                            AXRole='AXWindow', AXTitle=arg_1)", "path": "atomac/AXClasses.py", "identifier": "NativeUIElement.waitForWindowToDisappear", "docstring": "Convenience method to wait for a window with the given name to\n        disappear.\n\n        Returns: Boolean", "docstring_tokens": ["Convenience", "method", "to", "wait", "for", "a", "window", "with", "the", "given", "name", "to", "disappear", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260650}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/ipkernel.py#L763-L770", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Actions taken at shutdown by the kernel, called by python's atexit.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_shutdown_message", "is", "not", "None", ":", "arg_0", ".", "session", ".", "send", "(", "arg_0", ".", "iopub_socket", ",", "arg_0", ".", "_shutdown_message", ",", "ident", "=", "arg_0", ".", "_topic", "(", "'shutdown'", ")", ")", "arg_0", ".", "log", ".", "debug", "(", "\"%s\"", ",", "arg_0", ".", "_shutdown_message", ")", "[", "arg_1", ".", "flush", "(", "zmq", ".", "POLLOUT", ")", "for", "arg_1", "in", "arg_0", ".", "shell_streams", "]"], "function": "def Func(arg_0):\n        \"\"\"Actions taken at shutdown by the kernel, called by python's atexit.\n        \"\"\"\n        # io.rprint(\"Kernel at_shutdown\") # dbg\n        if arg_0._shutdown_message is not None:\n            arg_0.session.send(arg_0.iopub_socket, arg_0._shutdown_message, ident=arg_0._topic('shutdown'))\n            arg_0.log.debug(\"%s\", arg_0._shutdown_message)\n        [ arg_1.flush(zmq.POLLOUT) for arg_1 in arg_0.shell_streams ]", "path": "environment/lib/python2.7/site-packages/IPython/zmq/ipkernel.py", "identifier": "Kernel._at_shutdown", "docstring": "Actions taken at shutdown by the kernel, called by python's atexit.", "docstring_tokens": ["Actions", "taken", "at", "shutdown", "by", "the", "kernel", "called", "by", "python", "s", "atexit", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260651}
{"url": "https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/khard.py#L866-L918", "sha": "0f69430c2680f1ff5f073a977a3c5b753b96cc17", "docstring_summary": "Print birthday contact table.", "language": "python", "parameters": "(vcard_list, parsable)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "[", "arg_3", "for", "arg_3", "in", "arg_0", "if", "arg_3", ".", "get_birthday", "(", ")", "is", "not", "None", "]", "arg_0", ".", "sort", "(", "key", "=", "lambda", "x", ":", "(", "x", ".", "get_birthday", "(", ")", ".", "month", ",", "x", ".", "get_birthday", "(", ")", ".", "day", ")", "if", "isinstance", "(", "x", ".", "get_birthday", "(", ")", ",", "datetime", ".", "datetime", ")", "else", "(", "0", ",", "0", ",", "x", ".", "get_birthday", "(", ")", ")", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_0", ":", "arg_4", "=", "arg_3", ".", "get_birthday", "(", ")", "if", "arg_1", ":", "if", "config", ".", "display_by_name", "(", ")", "==", "\"first_name\"", ":", "arg_2", ".", "append", "(", "\"%04d.%02d.%02d\\t%s\"", "%", "(", "arg_4", ".", "year", ",", "arg_4", ".", "month", ",", "arg_4", ".", "day", ",", "arg_3", ".", "get_first_name_last_name", "(", ")", ")", ")", "else", ":", "arg_2", ".", "append", "(", "\"%04d.%02d.%02d\\t%s\"", "%", "(", "arg_4", ".", "year", ",", "arg_4", ".", "month", ",", "arg_4", ".", "day", ",", "arg_3", ".", "get_last_name_first_name", "(", ")", ")", ")", "else", ":", "if", "config", ".", "display_by_name", "(", ")", "==", "\"first_name\"", ":", "arg_2", ".", "append", "(", "\"%s\\t%s\"", "%", "(", "arg_3", ".", "get_first_name_last_name", "(", ")", ",", "arg_3", ".", "get_formatted_birthday", "(", ")", ")", ")", "else", ":", "arg_2", ".", "append", "(", "\"%s\\t%s\"", "%", "(", "arg_3", ".", "get_last_name_first_name", "(", ")", ",", "arg_3", ".", "get_formatted_birthday", "(", ")", ")", ")", "if", "arg_2", ":", "if", "arg_1", ":", "print", "(", "'\\n'", ".", "join", "(", "arg_2", ")", ")", "else", ":", "list_birthdays", "(", "arg_2", ")", "else", ":", "if", "not", "arg_1", ":", "print", "(", "\"Found no birthdays\"", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Print birthday contact table.\n\n    :param vcard_list: the vcards to search for matching entries which should\n        be printed\n    :type vcard_list: list of carddav_object.CarddavObject\n    :param parsable: machine readable output: columns devided by tabulator (\\t)\n    :type parsable: bool\n    :returns: None\n    :rtype: None\n\n    \"\"\"\n    # filter out contacts without a birthday date\n    arg_0 = [\n        arg_3 for arg_3 in arg_0 if arg_3.get_birthday() is not None]\n    # sort by date (month and day)\n    # The sort function should work for strings and datetime objects.  All\n    # strings will besorted before any datetime objects.\n    arg_0.sort(\n        key=lambda x: (x.get_birthday().month, x.get_birthday().day)\n        if isinstance(x.get_birthday(), datetime.datetime)\n        else (0, 0, x.get_birthday()))\n    # add to string list\n    arg_2 = []\n    for arg_3 in arg_0:\n        arg_4 = arg_3.get_birthday()\n        if arg_1:\n            if config.display_by_name() == \"first_name\":\n                arg_2.append(\"%04d.%02d.%02d\\t%s\"\n                                     % (arg_4.year, arg_4.month, arg_4.day,\n                                        arg_3.get_first_name_last_name()))\n            else:\n                arg_2.append(\"%04d.%02d.%02d\\t%s\"\n                                     % (arg_4.year, arg_4.month, arg_4.day,\n                                        arg_3.get_last_name_first_name()))\n        else:\n            if config.display_by_name() == \"first_name\":\n                arg_2.append(\"%s\\t%s\"\n                                     % (arg_3.get_first_name_last_name(),\n                                        arg_3.get_formatted_birthday()))\n            else:\n                arg_2.append(\"%s\\t%s\"\n                                     % (arg_3.get_last_name_first_name(),\n                                        arg_3.get_formatted_birthday()))\n    if arg_2:\n        if arg_1:\n            print('\\n'.join(arg_2))\n        else:\n            list_birthdays(arg_2)\n    else:\n        if not arg_1:\n            print(\"Found no birthdays\")\n        sys.exit(1)", "path": "khard/khard.py", "identifier": "birthdays_subcommand", "docstring": "Print birthday contact table.\n\n    :param vcard_list: the vcards to search for matching entries which should\n        be printed\n    :type vcard_list: list of carddav_object.CarddavObject\n    :param parsable: machine readable output: columns devided by tabulator (\\t)\n    :type parsable: bool\n    :returns: None\n    :rtype: None", "docstring_tokens": ["Print", "birthday", "contact", "table", "."], "nwo": "scheibler/khard", "score": 0.5827273004938529, "idx": 260652}
{"url": "https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/client.py#L43-L59", "sha": "37df37e4de21e6f8ac41c6154e7f1f44f1800020", "docstring_summary": "List files in an allocation directory.", "language": "python", "parameters": "(self, id=None, path=\"/\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "\"/\"", ")", ":", "if", "arg_1", ":", "return", "arg_0", ".", "request", "(", "arg_1", ",", "params", "=", "{", "\"path\"", ":", "arg_2", "}", ",", "method", "=", "\"get\"", ")", ".", "json", "(", ")", "else", ":", "return", "arg_0", ".", "request", "(", "params", "=", "{", "\"path\"", ":", "arg_2", "}", ",", "method", "=", "\"get\"", ")", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=\"/\"):\n        \"\"\" List files in an allocation directory.\n\n           https://www.nomadproject.io/docs/http/client-fs-ls.html\n\n            arguments:\n              - id\n              - path          \n            returns: list\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException\n        \"\"\"\n        if arg_1:\n            return arg_0.request(arg_1, params={\"path\": arg_2}, method=\"get\").json()\n        else:\n            return arg_0.request(params={\"path\": arg_2}, method=\"get\").json()", "path": "nomad/api/client.py", "identifier": "ls.list_files", "docstring": "List files in an allocation directory.\n\n           https://www.nomadproject.io/docs/http/client-fs-ls.html\n\n            arguments:\n              - id\n              - path          \n            returns: list\n            raises:\n              - nomad.api.exceptions.BaseNomadException\n              - nomad.api.exceptions.URLNotFoundNomadException", "docstring_tokens": ["List", "files", "in", "an", "allocation", "directory", "."], "nwo": "jrxFive/python-nomad", "score": 0.7063214655456516, "idx": 260653}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/image/base.py#L355-L365", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Return a vector of the masked data.", "language": "python", "parameters": "(self)", "return_statement": "return self.get_data(smoothed=True, masked=True, safe_copy=False)[self.get_mask_indices()],\\\n               self.get_mask_indices(), self.mask.shape", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_check_for_mask", "(", ")", "return", "arg_0", ".", "get_data", "(", "smoothed", "=", "True", ",", "masked", "=", "True", ",", "safe_copy", "=", "False", ")", "[", "arg_0", ".", "get_mask_indices", "(", ")", "]", ",", "arg_0", ".", "get_mask_indices", "(", ")", ",", "arg_0", ".", "mask", ".", "shape"], "function": "def Func(arg_0):\n        \"\"\"Return a vector of the masked data.\n\n        Returns\n        -------\n        np.ndarray, tuple of indices (np.ndarray), tuple of the mask shape\n        \"\"\"\n        arg_0._check_for_mask()\n\n        return arg_0.get_data(smoothed=True, masked=True, safe_copy=False)[arg_0.get_mask_indices()],\\\n               arg_0.get_mask_indices(), arg_0.mask.shape", "path": "boyle/image/base.py", "identifier": "MedicalImage.mask_and_flatten", "docstring": "Return a vector of the masked data.\n\n        Returns\n        -------\n        np.ndarray, tuple of indices (np.ndarray), tuple of the mask shape", "docstring_tokens": ["Return", "a", "vector", "of", "the", "masked", "data", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 260654}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py#L542-L550", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "handler to attach to heartbeater.\n        Called when a new heart starts to beat.\n        Triggers completion of registration.", "language": "python", "parameters": "(self, heart)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"heartbeat::Func(%r)\"", ",", "arg_1", ")", "if", "arg_1", "not", "in", "arg_0", ".", "incoming_registrations", ":", "arg_0", ".", "log", ".", "info", "(", "\"heartbeat::ignoring new heart: %r\"", ",", "arg_1", ")", "else", ":", "arg_0", ".", "finish_registration", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"handler to attach to heartbeater.\n        Called when a new heart starts to beat.\n        Triggers completion of registration.\"\"\"\n        arg_0.log.debug(\"heartbeat::Func(%r)\", arg_1)\n        if arg_1 not in arg_0.incoming_registrations:\n            arg_0.log.info(\"heartbeat::ignoring new heart: %r\", arg_1)\n        else:\n            arg_0.finish_registration(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py", "identifier": "Hub.handle_new_heart", "docstring": "handler to attach to heartbeater.\n        Called when a new heart starts to beat.\n        Triggers completion of registration.", "docstring_tokens": ["handler", "to", "attach", "to", "heartbeater", ".", "Called", "when", "a", "new", "heart", "starts", "to", "beat", ".", "Triggers", "completion", "of", "registration", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260655}
{"url": "https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L317-L367", "sha": "51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126", "docstring_summary": "This algorithm factors in both the user-provided weight\n        and the difference between the alpha values of the two colors\n        to decide how to perform the weighted average of the two RGB values.", "language": "python", "parameters": "(self, color1, color2, weight=50, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "50", ",", "*", "arg_4", ")", ":", "if", "arg_1", "and", "arg_2", ":", "if", "isinstance", "(", "arg_3", ",", "string_types", ")", ":", "arg_3", "=", "float", "(", "arg_3", ".", "strip", "(", "'%'", ")", ")", "arg_3", "=", "(", "(", "arg_3", "/", "100.0", ")", "*", "2", ")", "-", "1", "arg_5", "=", "arg_0", ".", "_hextorgb", "(", "arg_1", ")", "arg_6", "=", "arg_0", ".", "_hextorgb", "(", "arg_2", ")", "arg_7", "=", "0", "arg_8", "=", "(", "(", "(", "arg_3", "if", "arg_3", "*", "arg_7", "==", "-", "1", "else", "arg_3", "+", "arg_7", ")", "/", "(", "1", "+", "arg_3", "*", "arg_7", ")", ")", "+", "1", ")", "arg_8", "=", "arg_8", "/", "2.0", "arg_9", "=", "1", "-", "arg_8", "arg_10", "=", "[", "arg_5", "[", "0", "]", "*", "arg_8", "+", "arg_6", "[", "0", "]", "*", "arg_9", ",", "arg_5", "[", "1", "]", "*", "arg_8", "+", "arg_6", "[", "1", "]", "*", "arg_9", ",", "arg_5", "[", "2", "]", "*", "arg_8", "+", "arg_6", "[", "2", "]", "*", "arg_9", ",", "]", "return", "arg_0", ".", "_rgbatohex", "(", "arg_10", ")", "raise", "ValueError", "(", "'Illegal color values'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=50, *arg_4):\n        \"\"\"This algorithm factors in both the user-provided weight\n        and the difference between the alpha values of the two colors\n        to decide how to perform the weighted average of the two RGB values.\n\n        It works by first normalizing both parameters to be within [-1, 1],\n        where 1 indicates \"only use color1\", -1 indicates \"only use color 0\",\n        and all values in between indicated a proportionately weighted average.\n\n        Once we have the normalized variables w and a,\n        we apply the formula (w + a)/(1 + w*a)\n        to get the combined weight (in [-1, 1]) of color1.\n        This formula has two especially nice properties:\n\n         * When either w or a are -1 or 1, the combined weight is also that number\n           (cases where w * a == -1 are undefined, and handled as a special case).\n\n         * When a is 0, the combined weight is w, and vice versa\n\n        Finally, the weight of color1 is renormalized to be within [0, 1]\n        and the weight of color2 is given by 1 minus the weight of color1.\n\n        Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein\n        http://sass-lang.com\n        args:\n            color1 (str): first color\n            color2 (str): second color\n            weight (int/str): weight\n        raises:\n            ValueError\n        returns:\n            str\n        \"\"\"\n        if arg_1 and arg_2:\n            if isinstance(arg_3, string_types):\n                arg_3 = float(arg_3.strip('%'))\n            arg_3 = ((arg_3 / 100.0) * 2) - 1\n            arg_5 = arg_0._hextorgb(arg_1)\n            arg_6 = arg_0._hextorgb(arg_2)\n            arg_7 = 0\n            arg_8 = (((arg_3 if arg_3 * arg_7 == -1 else arg_3 + arg_7) /\n                   (1 + arg_3 * arg_7)) + 1)\n            arg_8 = arg_8 / 2.0\n            arg_9 = 1 - arg_8\n            arg_10 = [\n                arg_5[0] * arg_8 + arg_6[0] * arg_9,\n                arg_5[1] * arg_8 + arg_6[1] * arg_9,\n                arg_5[2] * arg_8 + arg_6[2] * arg_9,\n            ]\n            return arg_0._rgbatohex(arg_10)\n        raise ValueError('Illegal color values')", "path": "lesscpy/lessc/color.py", "identifier": "Color.mix", "docstring": "This algorithm factors in both the user-provided weight\n        and the difference between the alpha values of the two colors\n        to decide how to perform the weighted average of the two RGB values.\n\n        It works by first normalizing both parameters to be within [-1, 1],\n        where 1 indicates \"only use color1\", -1 indicates \"only use color 0\",\n        and all values in between indicated a proportionately weighted average.\n\n        Once we have the normalized variables w and a,\n        we apply the formula (w + a)/(1 + w*a)\n        to get the combined weight (in [-1, 1]) of color1.\n        This formula has two especially nice properties:\n\n         * When either w or a are -1 or 1, the combined weight is also that number\n           (cases where w * a == -1 are undefined, and handled as a special case).\n\n         * When a is 0, the combined weight is w, and vice versa\n\n        Finally, the weight of color1 is renormalized to be within [0, 1]\n        and the weight of color2 is given by 1 minus the weight of color1.\n\n        Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein\n        http://sass-lang.com\n        args:\n            color1 (str): first color\n            color2 (str): second color\n            weight (int/str): weight\n        raises:\n            ValueError\n        returns:\n            str", "docstring_tokens": ["This", "algorithm", "factors", "in", "both", "the", "user", "-", "provided", "weight", "and", "the", "difference", "between", "the", "alpha", "values", "of", "the", "two", "colors", "to", "decide", "how", "to", "perform", "the", "weighted", "average", "of", "the", "two", "RGB", "values", "."], "nwo": "lesscpy/lesscpy", "score": 0.36630042150969844, "idx": 260656}
{"url": "https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/concurrently/WorkingArea.py#L142-L175", "sha": "5138eeba6cd8a334ba52d6c2c022b33c61e3ba38", "docstring_summary": "Put a package", "language": "python", "parameters": "(self, package)", "return_statement": "return package_index", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "last_package_index", "+=", "1", "arg_2", "=", "arg_0", ".", "last_package_index", "arg_3", "=", "arg_0", ".", "package_fullpath", "(", "arg_2", ")", "with", "gzip", ".", "open", "(", "arg_3", ",", "'wb'", ")", "as", "f", ":", "pickle", ".", "dump", "(", "arg_1", ",", "f", ",", "protocol", "=", "pickle", ".", "HIGHEST_PROTOCOL", ")", "f", ".", "close", "(", ")", "arg_4", "=", "arg_0", ".", "result_fullpath", "(", "arg_2", ")", "arg_5", "=", "os", ".", "path", ".", "dirname", "(", "arg_4", ")", "alphatwirl", ".", "mkdir_p", "(", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Put a package\n\n        Parameters\n        ----------\n        package :\n            a task package\n\n        Returns\n        -------\n        int\n            A package index\n\n        \"\"\"\n\n        arg_0.last_package_index += 1\n        arg_2 = arg_0.last_package_index\n\n        arg_3 = arg_0.package_fullpath(arg_2)\n        # e.g., '{path}/tpd_20161129_122841_HnpcmF/task_00009.p.gz'\n\n        with gzip.open(arg_3, 'wb') as f:\n            pickle.dump(arg_1, f, protocol=pickle.HIGHEST_PROTOCOL)\n            f.close()\n\n        arg_4 = arg_0.result_fullpath(arg_2)\n        # e.g., '{path}/tpd_20161129_122841_HnpcmF/results/task_00009/result.p.gz'\n\n        arg_5 = os.path.dirname(arg_4)\n        # e.g., '{path}/tpd_20161129_122841_HnpcmF/results/task_00009'\n\n        alphatwirl.mkdir_p(arg_5)\n\n        return arg_2", "path": "alphatwirl/concurrently/WorkingArea.py", "identifier": "WorkingArea.put_package", "docstring": "Put a package\n\n        Parameters\n        ----------\n        package :\n            a task package\n\n        Returns\n        -------\n        int\n            A package index", "docstring_tokens": ["Put", "a", "package"], "nwo": "alphatwirl/alphatwirl", "score": 0.5129255600950267, "idx": 260657}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/presto_hook.py#L120-L124", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Execute the statement against Presto. Can be used to create views.", "language": "python", "parameters": "(self, hql, parameters=None)", "return_statement": "return super().run(self._strip_sql(hql), parameters)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "super", "(", ")", ".", "Func", "(", "arg_0", ".", "_strip_sql", "(", "arg_1", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Execute the statement against Presto. Can be used to create views.\n        \"\"\"\n        return super().Func(arg_0._strip_sql(arg_1), arg_2)", "path": "airflow/hooks/presto_hook.py", "identifier": "PrestoHook.run", "docstring": "Execute the statement against Presto. Can be used to create views.", "docstring_tokens": ["Execute", "the", "statement", "against", "Presto", ".", "Can", "be", "used", "to", "create", "views", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260658}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L405-L416", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Extract elements from an operation event and map to a named event.", "language": "python", "parameters": "(self, event)", "return_statement": "return {'name': description, 'start-time': start_time}, None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "get", "(", "'description'", ",", "''", ")", "arg_3", "=", "google_base", ".", "parse_rfc3339_utc_string", "(", "arg_1", ".", "get", "(", "'timestamp'", ",", "''", ")", ")", "for", "arg_4", ",", "arg_5", "in", "_EVENT_REGEX_MAP", ".", "items", "(", ")", ":", "arg_6", "=", "arg_5", ".", "match", "(", "arg_2", ")", "if", "arg_6", ":", "return", "{", "'name'", ":", "arg_4", ",", "'start-time'", ":", "arg_3", "}", ",", "arg_6", "return", "{", "'name'", ":", "arg_2", ",", "'start-time'", ":", "arg_3", "}", ",", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Extract elements from an operation event and map to a named event.\"\"\"\n    arg_2 = arg_1.get('description', '')\n    arg_3 = google_base.parse_rfc3339_utc_string(\n        arg_1.get('timestamp', ''))\n\n    for arg_4, arg_5 in _EVENT_REGEX_MAP.items():\n      arg_6 = arg_5.match(arg_2)\n      if arg_6:\n        return {'name': arg_4, 'start-time': arg_3}, arg_6\n\n    return {'name': arg_2, 'start-time': arg_3}, None", "path": "dsub/providers/google_v2.py", "identifier": "GoogleV2EventMap._map", "docstring": "Extract elements from an operation event and map to a named event.", "docstring_tokens": ["Extract", "elements", "from", "an", "operation", "event", "and", "map", "to", "a", "named", "event", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 260659}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/io.py#L142-L166", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Read the next frame.", "language": "python", "parameters": "(self)", "return_statement": "return img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_cache", ":", "arg_1", "=", "arg_0", ".", "_cache", ".", "get", "(", "arg_0", ".", "_position", ")", "if", "arg_1", "is", "not", "None", ":", "arg_2", "=", "True", "else", ":", "if", "arg_0", ".", "_position", "!=", "arg_0", ".", "_get_real_position", "(", ")", ":", "arg_0", ".", "_set_real_position", "(", "arg_0", ".", "_position", ")", "arg_2", ",", "arg_1", "=", "arg_0", ".", "_vcap", ".", "Func", "(", ")", "if", "arg_2", ":", "arg_0", ".", "_cache", ".", "put", "(", "arg_0", ".", "_position", ",", "arg_1", ")", "else", ":", "arg_2", ",", "arg_1", "=", "arg_0", ".", "_vcap", ".", "Func", "(", ")", "if", "arg_2", ":", "arg_0", ".", "_position", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Read the next frame.\n\n        If the next frame have been decoded before and in the cache, then\n        return it directly, otherwise decode, cache and return it.\n\n        Returns:\n            ndarray or None: Return the frame if successful, otherwise None.\n        \"\"\"\n        # pos = self._position\n        if arg_0._cache:\n            arg_1 = arg_0._cache.get(arg_0._position)\n            if arg_1 is not None:\n                arg_2 = True\n            else:\n                if arg_0._position != arg_0._get_real_position():\n                    arg_0._set_real_position(arg_0._position)\n                arg_2, arg_1 = arg_0._vcap.Func()\n                if arg_2:\n                    arg_0._cache.put(arg_0._position, arg_1)\n        else:\n            arg_2, arg_1 = arg_0._vcap.Func()\n        if arg_2:\n            arg_0._position += 1\n        return arg_1", "path": "mmcv/video/io.py", "identifier": "VideoReader.read", "docstring": "Read the next frame.\n\n        If the next frame have been decoded before and in the cache, then\n        return it directly, otherwise decode, cache and return it.\n\n        Returns:\n            ndarray or None: Return the frame if successful, otherwise None.", "docstring_tokens": ["Read", "the", "next", "frame", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260660}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L4389-L4440", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Scans String.", "language": "python", "parameters": "(cpu, dest, src)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "reg", "arg_4", "=", "arg_2", ".", "mem", ".", "base", "arg_5", "=", "arg_1", ".", "size", "arg_6", "=", "arg_1", ".", "read", "(", ")", "arg_7", "=", "arg_2", ".", "read", "(", ")", "arg_8", "=", "arg_6", "-", "arg_7", "arg_0", ".", "_calculate_CMP_flags", "(", "arg_5", ",", "arg_8", ",", "arg_6", ",", "arg_7", ")", "arg_9", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "arg_0", ".", "DF", ",", "-", "arg_5", "//", "8", ",", "arg_5", "//", "8", ")", "arg_0", ".", "write_register", "(", "arg_4", ",", "arg_0", ".", "read_register", "(", "arg_4", ")", "+", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Scans String.\n\n        Compares the byte, word, or double word specified with the memory operand\n        with the value in the AL, AX, EAX, or RAX register, and sets the status flags\n        according to the results. The memory operand address is read from either\n        the ES:RDI, ES:EDI or the ES:DI registers (depending on the address-size\n        attribute of the instruction, 32 or 16, respectively)::\n\n                IF (byte comparison)\n                THEN\n                    temp  =  AL - SRC;\n                    SetStatusFlags(temp);\n                    THEN IF DF  =  0\n                        THEN (E)DI  =  (E)DI + 1;\n                        ELSE (E)DI  =  (E)DI - 1;\n                        FI;\n                    ELSE IF (word comparison)\n                        THEN\n                            temp  =  AX - SRC;\n                            SetStatusFlags(temp)\n                            THEN IF DF  =  0\n                                THEN (E)DI  =  (E)DI + 2;\n                                ELSE (E)DI  =  (E)DI - 2;\n                                FI;\n                     ELSE (* doubleword comparison *)\n                           temp  =  EAX - SRC;\n                           SetStatusFlags(temp)\n                           THEN IF DF  =  0\n                                THEN\n                                    (E)DI  =  (E)DI + 4;\n                                ELSE\n                                    (E)DI  =  (E)DI - 4;\n                                FI;\n                           FI;\n                     FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.\n        \"\"\"\n        arg_3 = arg_1.reg\n        arg_4 = arg_2.mem.base  # , src.type, src.read()\n        arg_5 = arg_1.size\n        arg_6 = arg_1.read()\n        arg_7 = arg_2.read()\n        arg_8 = arg_6 - arg_7\n        arg_0._calculate_CMP_flags(arg_5, arg_8, arg_6, arg_7)\n\n        arg_9 = Operators.ITEBV(arg_0.address_bit_size, arg_0.DF, -arg_5 // 8, arg_5 // 8)\n        arg_0.write_register(arg_4, arg_0.read_register(arg_4) + arg_9)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.SCAS", "docstring": "Scans String.\n\n        Compares the byte, word, or double word specified with the memory operand\n        with the value in the AL, AX, EAX, or RAX register, and sets the status flags\n        according to the results. The memory operand address is read from either\n        the ES:RDI, ES:EDI or the ES:DI registers (depending on the address-size\n        attribute of the instruction, 32 or 16, respectively)::\n\n                IF (byte comparison)\n                THEN\n                    temp  =  AL - SRC;\n                    SetStatusFlags(temp);\n                    THEN IF DF  =  0\n                        THEN (E)DI  =  (E)DI + 1;\n                        ELSE (E)DI  =  (E)DI - 1;\n                        FI;\n                    ELSE IF (word comparison)\n                        THEN\n                            temp  =  AX - SRC;\n                            SetStatusFlags(temp)\n                            THEN IF DF  =  0\n                                THEN (E)DI  =  (E)DI + 2;\n                                ELSE (E)DI  =  (E)DI - 2;\n                                FI;\n                     ELSE (* doubleword comparison *)\n                           temp  =  EAX - SRC;\n                           SetStatusFlags(temp)\n                           THEN IF DF  =  0\n                                THEN\n                                    (E)DI  =  (E)DI + 4;\n                                ELSE\n                                    (E)DI  =  (E)DI - 4;\n                                FI;\n                           FI;\n                     FI;\n\n        :param cpu: current CPU.\n        :param dest: destination operand.\n        :param src: source operand.", "docstring_tokens": ["Scans", "String", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260661}
{"url": "https://github.com/zinic/pynsive/blob/15bc8b35a91be5817979eb327427b6235b1b411e/pynsive/plugin/loader.py#L52-L75", "sha": "15bc8b35a91be5817979eb327427b6235b1b411e", "docstring_summary": "Loads a module's code and sets the module's expected hidden\n        variables. For more information on these variables and what they\n        are for, please see PEP302.", "language": "python", "parameters": "(self, module_name)", "return_statement": "return module", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "!=", "arg_0", ".", "module_name", ":", "raise", "LoaderError", "(", "'Requesting a module that the loader is unaware of.'", ")", "if", "arg_1", "in", "arg_5", ".", "modules", ":", "return", "arg_5", ".", "modules", "[", "arg_1", "]", "arg_2", "=", "arg_0", ".", "Func_py_path", "(", "arg_1", ",", "arg_0", ".", "load_target", ")", "if", "arg_0", ".", "is_pkg", ":", "arg_2", ".", "__path__", "=", "[", "arg_0", ".", "module_path", "]", "arg_2", ".", "__package__", "=", "arg_1", "else", ":", "arg_2", ".", "__package__", "=", "arg_1", ".", "rpartition", "(", "'.'", ")", "[", "0", "]", "arg_5", ".", "modules", "[", "arg_1", "]", "=", "arg_2", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Loads a module's code and sets the module's expected hidden\n        variables. For more information on these variables and what they\n        are for, please see PEP302.\n\n        :param module_name: the full name of the module to load\n        \"\"\"\n        if arg_1 != arg_0.module_name:\n            raise LoaderError(\n                'Requesting a module that the loader is unaware of.')\n\n        if arg_1 in arg_5.modules:\n            return arg_5.modules[arg_1]\n\n        arg_2 = arg_0.Func_py_path(arg_1, arg_0.load_target)\n        if arg_0.is_pkg:\n            arg_2.__path__ = [arg_0.module_path]\n            arg_2.__package__ = arg_1\n        else:\n            arg_2.__package__ = arg_1.rpartition('.')[0]\n\n        arg_5.modules[arg_1] = arg_2\n        return arg_2", "path": "pynsive/plugin/loader.py", "identifier": "ModuleLoader.load_module", "docstring": "Loads a module's code and sets the module's expected hidden\n        variables. For more information on these variables and what they\n        are for, please see PEP302.\n\n        :param module_name: the full name of the module to load", "docstring_tokens": ["Loads", "a", "module", "s", "code", "and", "sets", "the", "module", "s", "expected", "hidden", "variables", ".", "For", "more", "information", "on", "these", "variables", "and", "what", "they", "are", "for", "please", "see", "PEP302", "."], "nwo": "zinic/pynsive", "score": 0.23137166388621372, "idx": 260662}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L887-L927", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Sample the dynamic latent prior.", "language": "python", "parameters": "(self, samples, batch_size, length, fixed=False)", "return_statement": "return sample, tfd.MultivariateNormalDiag(loc=loc, scale_diag=scale_diag)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "False", ")", ":", "if", "arg_4", ":", "arg_5", "=", "1", "else", ":", "arg_5", "=", "arg_2", "arg_6", ",", "arg_7", "=", "arg_0", ".", "dynamic_prior", ".", "zero_state", "(", "[", "arg_1", ",", "arg_5", "]", ")", "arg_8", "=", "[", "]", "arg_9", "=", "[", "]", "arg_10", "=", "[", "]", "for", "arg_11", "in", "range", "(", "arg_3", ")", ":", "arg_12", ",", "arg_7", "=", "arg_0", ".", "dynamic_prior", "(", "arg_6", ",", "arg_7", ")", "arg_6", "=", "arg_12", ".", "sample", "(", ")", "arg_8", ".", "append", "(", "arg_12", ".", "parameters", "[", "\"loc\"", "]", ")", "arg_9", ".", "append", "(", "arg_12", ".", "parameters", "[", "\"scale_diag\"", "]", ")", "arg_10", ".", "append", "(", "arg_6", ")", "arg_6", "=", "tf", ".", "stack", "(", "arg_10", ",", "axis", "=", "2", ")", "arg_13", "=", "tf", ".", "stack", "(", "arg_8", ",", "axis", "=", "2", ")", "arg_14", "=", "tf", ".", "stack", "(", "arg_9", ",", "axis", "=", "2", ")", "if", "arg_4", ":", "arg_6", "=", "arg_6", "+", "tf", ".", "zeros", "(", "[", "arg_2", ",", "1", ",", "1", "]", ")", "return", "arg_6", ",", "tfd", ".", "MultivariateNormalDiag", "(", "arg_13", "=", "arg_13", ",", "arg_14", "=", "arg_14", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):\n    \"\"\"Sample the dynamic latent prior.\n\n    Args:\n      samples: Number of samples to draw from the latent distribution.\n      batch_size: Number of sequences to sample.\n      length: Number of timesteps to sample for each sequence.\n      fixed: Boolean for whether or not to share the same random\n        sample across all sequences.\n\n    Returns:\n      A tuple of a sample tensor of shape [samples, batch_size, length\n      latent_size], and a MultivariateNormalDiag distribution from which\n      the tensor was sampled, with event shape [latent_size], and batch\n      shape [samples, 1, length] if fixed or [samples, batch_size,\n      length] otherwise.\n    \"\"\"\n    if arg_4:\n      arg_5 = 1\n    else:\n      arg_5 = arg_2\n\n    arg_6, arg_7 = arg_0.dynamic_prior.zero_state([arg_1, arg_5])\n    arg_8 = []\n    arg_9 = []\n    arg_10 = []\n    for arg_11 in range(arg_3):\n      arg_12, arg_7 = arg_0.dynamic_prior(arg_6, arg_7)\n      arg_6 = arg_12.sample()\n      arg_8.append(arg_12.parameters[\"loc\"])\n      arg_9.append(arg_12.parameters[\"scale_diag\"])\n      arg_10.append(arg_6)\n\n    arg_6 = tf.stack(arg_10, axis=2)\n    arg_13 = tf.stack(arg_8, axis=2)\n    arg_14 = tf.stack(arg_9, axis=2)\n\n    if arg_4:  # tile along the batch axis\n      arg_6 = arg_6 + tf.zeros([arg_2, 1, 1])\n\n    return arg_6, tfd.MultivariateNormalDiag(arg_13=arg_13, arg_14=arg_14)", "path": "tensorflow_probability/examples/disentangled_vae.py", "identifier": "DisentangledSequentialVAE.sample_dynamic_prior", "docstring": "Sample the dynamic latent prior.\n\n    Args:\n      samples: Number of samples to draw from the latent distribution.\n      batch_size: Number of sequences to sample.\n      length: Number of timesteps to sample for each sequence.\n      fixed: Boolean for whether or not to share the same random\n        sample across all sequences.\n\n    Returns:\n      A tuple of a sample tensor of shape [samples, batch_size, length\n      latent_size], and a MultivariateNormalDiag distribution from which\n      the tensor was sampled, with event shape [latent_size], and batch\n      shape [samples, 1, length] if fixed or [samples, batch_size,\n      length] otherwise.", "docstring_tokens": ["Sample", "the", "dynamic", "latent", "prior", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260663}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L299-L311", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Returns a front ID which is the id of the offset front that contains the most overlap\n    with offsets that correspond to the given onset front ID.", "language": "python", "parameters": "(candidate_offset_front_ids, offset_fronts, offsets_corresponding_to_onsets)", "return_statement": "return int(chosen_offset_front_id)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ":", "arg_5", ",", "arg_6", "=", "np", ".", "where", "(", "arg_1", "==", "arg_4", ")", "arg_7", "=", "[", "(", "f", ",", "i", ")", "for", "f", ",", "i", "in", "zip", "(", "arg_5", ",", "arg_6", ")", "]", "arg_8", "=", "len", "(", "set", "(", "arg_7", ")", ".", "symmetric_difference", "(", "set", "(", "arg_2", ")", ")", ")", "arg_3", ".", "append", "(", "(", "arg_8", ",", "arg_4", ")", ")", "arg_9", ",", "arg_10", "=", "max", "(", "arg_3", ",", "key", "=", "lambda", "t", ":", "t", "[", "0", "]", ")", "return", "int", "(", "arg_10", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Returns a front ID which is the id of the offset front that contains the most overlap\n    with offsets that correspond to the given onset front ID.\n    \"\"\"\n    arg_3 = []  # will contain tuples of the form (number_overlapping, offset_front_id)\n    for arg_4 in arg_0:\n        arg_5, arg_6 = np.where(arg_1 == arg_4)\n        arg_7 = [(f, i) for f, i in zip(arg_5, arg_6)]\n        arg_8 = len(set(arg_7).symmetric_difference(set(arg_2)))\n        arg_3.append((arg_8, arg_4))\n    arg_9, arg_10 = max(arg_3, key=lambda t: t[0])\n    return int(arg_10)", "path": "algorithms/asa.py", "identifier": "_choose_front_id_from_candidates", "docstring": "Returns a front ID which is the id of the offset front that contains the most overlap\n    with offsets that correspond to the given onset front ID.", "docstring_tokens": ["Returns", "a", "front", "ID", "which", "is", "the", "id", "of", "the", "offset", "front", "that", "contains", "the", "most", "overlap", "with", "offsets", "that", "correspond", "to", "the", "given", "onset", "front", "ID", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 260664}
{"url": "https://github.com/mozilla/PyPOM/blob/1e7d7ac6e19ec2dac0ea04bad5f3daadbe0c43b8/src/pypom/region.py#L89-L93", "sha": "1e7d7ac6e19ec2dac0ea04bad5f3daadbe0c43b8", "docstring_summary": "Wait for the page region to load.", "language": "python", "parameters": "(self)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "wait", ".", "until", "(", "lambda", "_", ":", "arg_0", ".", "loaded", ")", "arg_0", ".", "pm", ".", "hook", ".", "pypom_after_Func", "(", "region", "=", "arg_0", ")", "return", "arg_0"], "function": "def Func(arg_0):\n        \"\"\"Wait for the page region to load.\"\"\"\n        arg_0.wait.until(lambda _: arg_0.loaded)\n        arg_0.pm.hook.pypom_after_Func(region=arg_0)\n        return arg_0", "path": "src/pypom/region.py", "identifier": "Region.wait_for_region_to_load", "docstring": "Wait for the page region to load.", "docstring_tokens": ["Wait", "for", "the", "page", "region", "to", "load", "."], "nwo": "mozilla/PyPOM", "score": 0.9276247857904453, "idx": 260665}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/yahoo.py#L247-L252", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns list of suggested spelling corrections for the given query.", "language": "python", "parameters": "(q, wait=10, asynchronous=False, cached=False)", "return_statement": "return YahooSpelling(q, wait, asynchronous, cached)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "return", "YahooSpelling", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1=10, arg_2=False, arg_3=False):\n    \n    \"\"\" Returns list of suggested spelling corrections for the given query.\n    \"\"\"\n    \n    return YahooSpelling(arg_0, arg_1, arg_2, arg_3)", "path": "lib/web/yahoo.py", "identifier": "suggest_spelling", "docstring": "Returns list of suggested spelling corrections for the given query.", "docstring_tokens": ["Returns", "list", "of", "suggested", "spelling", "corrections", "for", "the", "given", "query", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260666}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1388-L1393", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Checks if a data is csr, csc, bsr, or dia Scipy sparse matrix", "language": "python", "parameters": "(data)", "return_statement": "return (spsp.isspmatrix_csc(data) or\n                spsp.isspmatrix_csr(data) or\n                spsp.isspmatrix_bsr(data) or\n                spsp.isspmatrix_dia(data))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "spsp", ".", "isspmatrix_csc", "(", "arg_0", ")", "or", "spsp", ".", "isspmatrix_csr", "(", "arg_0", ")", "or", "spsp", ".", "isspmatrix_bsr", "(", "arg_0", ")", "or", "spsp", ".", "isspmatrix_dia", "(", "arg_0", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Checks if a data is csr, csc, bsr, or dia Scipy sparse matrix\"\"\"\n        return (spsp.isspmatrix_csc(arg_0) or\n                spsp.isspmatrix_csr(arg_0) or\n                spsp.isspmatrix_bsr(arg_0) or\n                spsp.isspmatrix_dia(arg_0))", "path": "pypet/parameter.py", "identifier": "SparseParameter._is_supported_matrix", "docstring": "Checks if a data is csr, csc, bsr, or dia Scipy sparse matrix", "docstring_tokens": ["Checks", "if", "a", "data", "is", "csr", "csc", "bsr", "or", "dia", "Scipy", "sparse", "matrix"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260667}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/csp.py#L133-L136", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Undo a supposition and all inferences from it.", "language": "python", "parameters": "(self, removals)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", ",", "arg_3", "in", "arg_1", ":", "arg_0", ".", "curr_domains", "[", "arg_2", "]", ".", "append", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"Undo a supposition and all inferences from it.\"\n        for arg_2, arg_3 in arg_1:\n            arg_0.curr_domains[arg_2].append(arg_3)", "path": "aima/csp.py", "identifier": "CSP.restore", "docstring": "Undo a supposition and all inferences from it.", "docstring_tokens": ["Undo", "a", "supposition", "and", "all", "inferences", "from", "it", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 260668}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L1079-L1095", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Return -1 if infinite, else return numofsecs.", "language": "python", "parameters": "(timeoutvalue)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "0", "arg_2", "=", "arg_0", ".", "split", "(", "\",\"", ")", "for", "arg_3", "in", "arg_2", ":", "arg_3", "=", "arg_3", ".", "strip", "(", ")", "if", "arg_3", ".", "lower", "(", ")", "==", "\"infinite\"", ":", "return", "-", "1", "else", ":", "arg_4", "=", "reSecondsReader", ".", "findall", "(", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "arg_1", "=", "int", "(", "arg_5", ")", "if", "arg_1", ">", "MAX_FINITE_TIMEOUT_LIMIT", ":", "return", "-", "1", "if", "arg_1", "!=", "0", ":", "return", "arg_1", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"Return -1 if infinite, else return numofsecs.\"\"\"\n    arg_1 = 0\n    arg_2 = arg_0.split(\",\")\n    for arg_3 in arg_2:\n        arg_3 = arg_3.strip()\n        if arg_3.lower() == \"infinite\":\n            return -1\n        else:\n            arg_4 = reSecondsReader.findall(arg_3)\n            for arg_5 in arg_4:\n                arg_1 = int(arg_5)\n                if arg_1 > MAX_FINITE_TIMEOUT_LIMIT:\n                    return -1\n                if arg_1 != 0:\n                    return arg_1\n    return None", "path": "wsgidav/util.py", "identifier": "read_timeout_value_header", "docstring": "Return -1 if infinite, else return numofsecs.", "docstring_tokens": ["Return", "-", "1", "if", "infinite", "else", "return", "numofsecs", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 260669}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/gapfilling.py#L104-L147", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Extend gapfilling model.", "language": "python", "parameters": "(self, exchange_reactions=False, demand_reactions=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "True", ")", ":", "for", "arg_3", "in", "arg_0", ".", "universal", ".", "reactions", ":", "arg_3", ".", "gapfilling_type", "=", "'universal'", "arg_5", "=", "arg_0", ".", "universal", ".", "metabolites", ".", "query", "(", "lambda", "metabolite", ":", "metabolite", "not", "in", "arg_0", ".", "model", ".", "metabolites", ")", "arg_0", ".", "model", ".", "add_metabolites", "(", "arg_5", ")", "arg_6", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "universal", ".", "boundary", ":", "arg_6", "=", "arg_6", "+", "[", "arg_7", ".", "id", "for", "arg_7", "in", "list", "(", "arg_3", ".", "metabolites", ")", "]", "for", "arg_7", "in", "arg_0", ".", "model", ".", "metabolites", ":", "if", "arg_1", ":", "if", "arg_7", ".", "id", "not", "in", "arg_6", ":", "arg_3", "=", "arg_0", ".", "universal", ".", "add_boundary", "(", "arg_7", ",", "type", "=", "'exchange_smiley'", ",", "lb", "=", "-", "1000", ",", "ub", "=", "0", ",", "reaction_id", "=", "'EX_{}'", ".", "format", "(", "arg_7", ".", "id", ")", ")", "arg_3", ".", "gapfilling_type", "=", "'exchange'", "if", "arg_2", ":", "arg_3", "=", "arg_0", ".", "universal", ".", "add_boundary", "(", "arg_7", ",", "type", "=", "'demand_smiley'", ",", "lb", "=", "0", ",", "ub", "=", "1000", ",", "reaction_id", "=", "'DM_{}'", ".", "format", "(", "arg_7", ".", "id", ")", ")", "arg_3", ".", "gapfilling_type", "=", "'demand'", "arg_8", "=", "arg_0", ".", "universal", ".", "reactions", ".", "query", "(", "lambda", "reaction", ":", "reaction", "not", "in", "arg_0", ".", "model", ".", "reactions", ")", "arg_0", ".", "model", ".", "add_reactions", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=True):\n        \"\"\"Extend gapfilling model.\n\n        Add reactions from universal model and optionally exchange and\n        demand reactions for all metabolites in the model to perform\n        gapfilling on.\n\n        Parameters\n        ----------\n        exchange_reactions : bool\n            Consider adding exchange (uptake) reactions for all metabolites\n            in the model.\n        demand_reactions : bool\n            Consider adding demand reactions for all metabolites.\n        \"\"\"\n        for arg_3 in arg_0.universal.reactions:\n            arg_3.gapfilling_type = 'universal'\n        arg_5 = arg_0.universal.metabolites.query(\n            lambda metabolite: metabolite not in arg_0.model.metabolites\n                                                           )\n        arg_0.model.add_metabolites(arg_5)\n        arg_6 = []\n        for arg_3 in arg_0.universal.boundary:\n            arg_6 = arg_6 + \\\n                [arg_7.id for arg_7 in list(arg_3.metabolites)]\n\n        for arg_7 in arg_0.model.metabolites:\n            if arg_1:\n                # check for exchange reaction in model already\n                if arg_7.id not in arg_6:\n                    arg_3 = arg_0.universal.add_boundary(\n                        arg_7, type='exchange_smiley', lb=-1000, ub=0,\n                        reaction_id='EX_{}'.format(arg_7.id))\n                    arg_3.gapfilling_type = 'exchange'\n            if arg_2:\n                arg_3 = arg_0.universal.add_boundary(\n                    arg_7, type='demand_smiley', lb=0, ub=1000,\n                    reaction_id='DM_{}'.format(arg_7.id))\n                arg_3.gapfilling_type = 'demand'\n\n        arg_8 = arg_0.universal.reactions.query(\n            lambda reaction: reaction not in arg_0.model.reactions\n        )\n        arg_0.model.add_reactions(arg_8)", "path": "cobra/flux_analysis/gapfilling.py", "identifier": "GapFiller.extend_model", "docstring": "Extend gapfilling model.\n\n        Add reactions from universal model and optionally exchange and\n        demand reactions for all metabolites in the model to perform\n        gapfilling on.\n\n        Parameters\n        ----------\n        exchange_reactions : bool\n            Consider adding exchange (uptake) reactions for all metabolites\n            in the model.\n        demand_reactions : bool\n            Consider adding demand reactions for all metabolites.", "docstring_tokens": ["Extend", "gapfilling", "model", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 260670}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L696-L758", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a color rotated on the artistic RYB color wheel.", "language": "python", "parameters": "(self, angle=180)", "return_statement": "return Color(h / 360, self.s, self.brightness, self.a, mode=\"hsb\", name=\"\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "180", ")", ":", "arg_2", "=", "arg_0", ".", "h", "*", "360", "arg_1", "=", "arg_1", "%", "360", "arg_3", "=", "[", "(", "0", ",", "0", ")", ",", "(", "15", ",", "8", ")", ",", "(", "30", ",", "17", ")", ",", "(", "45", ",", "26", ")", ",", "(", "60", ",", "34", ")", ",", "(", "75", ",", "41", ")", ",", "(", "90", ",", "48", ")", ",", "(", "105", ",", "54", ")", ",", "(", "120", ",", "60", ")", ",", "(", "135", ",", "81", ")", ",", "(", "150", ",", "103", ")", ",", "(", "165", ",", "123", ")", ",", "(", "180", ",", "138", ")", ",", "(", "195", ",", "155", ")", ",", "(", "210", ",", "171", ")", ",", "(", "225", ",", "187", ")", ",", "(", "240", ",", "204", ")", ",", "(", "255", ",", "219", ")", ",", "(", "270", ",", "234", ")", ",", "(", "285", ",", "251", ")", ",", "(", "300", ",", "267", ")", ",", "(", "315", ",", "282", ")", ",", "(", "330", ",", "298", ")", ",", "(", "345", ",", "329", ")", ",", "(", "360", ",", "0", ")", "]", "for", "arg_4", "in", "_range", "(", "len", "(", "arg_3", ")", "-", "1", ")", ":", "arg_5", ",", "arg_6", "=", "arg_3", "[", "arg_4", "]", "arg_7", ",", "arg_8", "=", "arg_3", "[", "arg_4", "+", "1", "]", "if", "arg_8", "<", "arg_6", ":", "arg_8", "+=", "360", "if", "arg_6", "<=", "arg_2", "<=", "arg_8", ":", "arg_9", "=", "1.0", "*", "arg_5", "+", "(", "arg_7", "-", "arg_5", ")", "*", "(", "arg_2", "-", "arg_6", ")", "/", "(", "arg_8", "-", "arg_6", ")", "break", "arg_9", "=", "(", "arg_9", "+", "arg_1", ")", "%", "360", "for", "arg_4", "in", "_range", "(", "len", "(", "arg_3", ")", "-", "1", ")", ":", "arg_5", ",", "arg_6", "=", "arg_3", "[", "arg_4", "]", "arg_7", ",", "arg_8", "=", "arg_3", "[", "arg_4", "+", "1", "]", "if", "arg_8", "<", "arg_6", ":", "arg_8", "+=", "360", "if", "arg_5", "<=", "arg_9", "<=", "arg_7", ":", "arg_2", "=", "1.0", "*", "arg_6", "+", "(", "arg_8", "-", "arg_6", ")", "*", "(", "arg_9", "-", "arg_5", ")", "/", "(", "arg_7", "-", "arg_5", ")", "break", "arg_2", "=", "arg_2", "%", "360", "return", "Color", "(", "arg_2", "/", "360", ",", "arg_0", ".", "s", ",", "arg_0", ".", "brightness", ",", "arg_0", ".", "a", ",", "mode", "=", "\"hsb\"", ",", "name", "=", "\"\"", ")"], "function": "def Func(arg_0, arg_1=180):\n\n        \"\"\" Returns a color rotated on the artistic RYB color wheel.\n\n        An artistic color wheel has slightly different opposites\n        (e.g. purple-yellow instead of purple-lime).\n        It is mathematically incorrect but generally assumed\n        to provide better complementary colors.\n\n        http://en.wikipedia.org/wiki/RYB_color_model\n\n        \"\"\"\n\n        arg_2 = arg_0.h * 360\n        arg_1 = arg_1 % 360\n\n        # Approximation of Itten's RYB color wheel.\n        # In HSB, colors hues range from 0-360.\n        # However, on the artistic color wheel these are not evenly distributed.\n        # The second tuple value contains the actual distribution.\n        arg_3 = [\n            (0, 0), (15, 8),\n            (30, 17), (45, 26),\n            (60, 34), (75, 41),\n            (90, 48), (105, 54),\n            (120, 60), (135, 81),\n            (150, 103), (165, 123),\n            (180, 138), (195, 155),\n            (210, 171), (225, 187),\n            (240, 204), (255, 219),\n            (270, 234), (285, 251),\n            (300, 267), (315, 282),\n            (330, 298), (345, 329),\n            (360, 0)\n        ]\n\n        # Given a hue, find out under what angle it is\n        # located on the artistic color wheel.\n        for arg_4 in _range(len(arg_3) - 1):\n            arg_5, arg_6 = arg_3[arg_4]\n            arg_7, arg_8 = arg_3[arg_4 + 1]\n            if arg_8 < arg_6:\n                arg_8 += 360\n            if arg_6 <= arg_2 <= arg_8:\n                arg_9 = 1.0 * arg_5 + (arg_7 - arg_5) * (arg_2 - arg_6) / (arg_8 - arg_6)\n                break\n\n        # And the user-given angle (e.g. complement).\n        arg_9 = (arg_9 + arg_1) % 360\n\n        # For the given angle, find out what hue is\n        # located there on the artistic color wheel.\n        for arg_4 in _range(len(arg_3) - 1):\n            arg_5, arg_6 = arg_3[arg_4]\n            arg_7, arg_8 = arg_3[arg_4 + 1]\n            if arg_8 < arg_6:\n                arg_8 += 360\n            if arg_5 <= arg_9 <= arg_7:\n                arg_2 = 1.0 * arg_6 + (arg_8 - arg_6) * (arg_9 - arg_5) / (arg_7 - arg_5)\n                break\n\n        arg_2 = arg_2 % 360\n        return Color(arg_2 / 360, arg_0.s, arg_0.brightness, arg_0.a, mode=\"hsb\", name=\"\")", "path": "lib/colors/__init__.py", "identifier": "Color.rotate_ryb", "docstring": "Returns a color rotated on the artistic RYB color wheel.\n\n        An artistic color wheel has slightly different opposites\n        (e.g. purple-yellow instead of purple-lime).\n        It is mathematically incorrect but generally assumed\n        to provide better complementary colors.\n\n        http://en.wikipedia.org/wiki/RYB_color_model", "docstring_tokens": ["Returns", "a", "color", "rotated", "on", "the", "artistic", "RYB", "color", "wheel", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260671}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case.py#L512-L530", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Create a new variant id.", "language": "python", "parameters": "(variant_obj, family_id)", "return_statement": "return new_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "parse_document_id", "(", "chrom", "=", "arg_0", "[", "'chromosome'", "]", ",", "pos", "=", "str", "(", "arg_0", "[", "'position'", "]", ")", ",", "ref", "=", "arg_0", "[", "'reference'", "]", ",", "alt", "=", "arg_0", "[", "'alternative'", "]", ",", "variant_type", "=", "arg_0", "[", "'variant_type'", "]", ",", "case_id", "=", "arg_1", ",", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Create a new variant id.\n\n    Args:\n        variant_obj(dict)\n        family_id(str)\n\n    Returns:\n        new_id(str): The new variant id\n    \"\"\"\n    arg_2 = parse_document_id(\n        chrom=arg_0['chromosome'],\n        pos=str(arg_0['position']),\n        ref=arg_0['reference'],\n        alt=arg_0['alternative'],\n        variant_type=arg_0['variant_type'],\n        case_id=arg_1,\n    )\n    return arg_2", "path": "scout/adapter/mongo/case.py", "identifier": "get_variantid", "docstring": "Create a new variant id.\n\n    Args:\n        variant_obj(dict)\n        family_id(str)\n\n    Returns:\n        new_id(str): The new variant id", "docstring_tokens": ["Create", "a", "new", "variant", "id", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260672}
{"url": "https://github.com/openergy/oplus/blob/f095868d1990c1d126e906ada6acbab26348b3d3/oplus/simulation.py#L203-L250", "sha": "f095868d1990c1d126e906ada6acbab26348b3d3", "docstring_summary": "Defined here so that we can use the class variables, in order to subclass in oplusplus", "language": "python", "parameters": "(self)", "return_statement": "return self._prepared_file_refs", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_preparedFunc", "is", "None", ":", "arg_0", ".", "_preparedFunc", "=", "{", "FILE_REFS", ".", "idf", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_epm_cls", ".", "from_idf", "(", "path", ",", "idd_or_buffer_or_path", "=", "arg_0", ".", "_idd", ")", ",", "get_path", "=", "lambda", ":", "get_input_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "idf", ")", ")", ",", "FILE_REFS", ".", "epw", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_weather_data_cls", ".", "from_epw", "(", "path", ")", ",", "get_path", "=", "lambda", ":", "get_input_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "epw", ")", ")", ",", "FILE_REFS", ".", "eio", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_eio_cls", "(", "path", ")", ",", "get_path", "=", "lambda", ":", "get_output_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "eio", ")", ")", ",", "FILE_REFS", ".", "eso", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_standard_output_cls", "(", "path", ")", ",", "get_path", "=", "lambda", ":", "get_output_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "eso", ")", ")", ",", "FILE_REFS", ".", "mtr", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_standard_output_cls", "(", "path", ")", ",", "get_path", "=", "lambda", ":", "get_output_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "mtr", ")", ")", ",", "FILE_REFS", ".", "mtd", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_mtd_cls", "(", "path", ")", ",", "get_path", "=", "lambda", ":", "get_output_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "mtd", ")", ")", ",", "FILE_REFS", ".", "mdd", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "open", "(", "path", ")", ".", "read", "(", ")", ",", "get_path", "=", "lambda", ":", "get_output_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "mdd", ")", ")", ",", "FILE_REFS", ".", "err", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_err_cls", "(", "path", ")", ",", "get_path", "=", "lambda", ":", "get_output_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "err", ")", ")", ",", "FILE_REFS", ".", "summary_table", ":", "FileInfo", "(", "constructor", "=", "lambda", "path", ":", "arg_0", ".", "_summary_table_cls", "(", "path", ")", ",", "get_path", "=", "lambda", ":", "get_output_file_path", "(", "arg_0", ".", "dir_path", ",", "FILE_REFS", ".", "summary_table", ")", ")", "}", "return", "arg_0", ".", "_preparedFunc"], "function": "def Func(arg_0):\n        \"\"\"\n        Defined here so that we can use the class variables, in order to subclass in oplusplus\n        \"\"\"\n        if arg_0._preparedFunc is None:\n            arg_0._preparedFunc = {\n                FILE_REFS.idf: FileInfo(\n                    constructor=lambda path: arg_0._epm_cls.from_idf(path, idd_or_buffer_or_path=arg_0._idd),\n                    get_path=lambda: get_input_file_path(arg_0.dir_path, FILE_REFS.idf)\n                ),\n                FILE_REFS.epw: FileInfo(\n                    constructor=lambda path: arg_0._weather_data_cls.from_epw(path),\n                    get_path=lambda: get_input_file_path(arg_0.dir_path, FILE_REFS.epw)\n                ),\n                FILE_REFS.eio: FileInfo(\n                    constructor=lambda path: arg_0._eio_cls(path),\n                    get_path=lambda: get_output_file_path(arg_0.dir_path, FILE_REFS.eio)\n                ),\n                FILE_REFS.eso: FileInfo(\n                    constructor=lambda path: arg_0._standard_output_cls(path),\n                    get_path=lambda: get_output_file_path(\n                        arg_0.dir_path,\n                        FILE_REFS.eso\n                    )\n                ),\n                FILE_REFS.mtr: FileInfo(\n                    constructor=lambda path: arg_0._standard_output_cls(path),\n                    get_path=lambda: get_output_file_path(arg_0.dir_path, FILE_REFS.mtr)\n                ),\n                FILE_REFS.mtd: FileInfo(\n                    constructor=lambda path: arg_0._mtd_cls(path),\n                    get_path=lambda: get_output_file_path(arg_0.dir_path, FILE_REFS.mtd)\n                ),\n                FILE_REFS.mdd: FileInfo(\n                    constructor=lambda path: open(path).read(),\n                    get_path=lambda: get_output_file_path(arg_0.dir_path, FILE_REFS.mdd)\n\n                ),\n                FILE_REFS.err: FileInfo(\n                    constructor=lambda path: arg_0._err_cls(path),\n                    get_path=lambda: get_output_file_path(arg_0.dir_path, FILE_REFS.err)\n                ),\n                FILE_REFS.summary_table: FileInfo(\n                    constructor=lambda path: arg_0._summary_table_cls(path),\n                    get_path=lambda: get_output_file_path(arg_0.dir_path, FILE_REFS.summary_table)\n                )\n            }\n        return arg_0._preparedFunc", "path": "oplus/simulation.py", "identifier": "Simulation._file_refs", "docstring": "Defined here so that we can use the class variables, in order to subclass in oplusplus", "docstring_tokens": ["Defined", "here", "so", "that", "we", "can", "use", "the", "class", "variables", "in", "order", "to", "subclass", "in", "oplusplus"], "nwo": "openergy/oplus", "score": 0.38919093769130675, "idx": 260673}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1860-L1953", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots the upper and lower bounds of an n standard deviation\n    cone of forecasted cumulative returns. Redraws a new cone when\n    cumulative returns fall outside of last cone drawn.", "language": "python", "parameters": "(name, bounds, oos_returns, num_samples=1000, ax=None,\n               cone_std=(1., 1.5, 2.), random_seed=None, num_strikes=3)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1000", ",", "arg_4", "=", "None", ",", "arg_5", "=", "(", "1.", ",", "1.5", ",", "2.", ")", ",", "arg_6", "=", "None", ",", "arg_7", "=", "3", ")", ":", "if", "arg_4", "is", "None", ":", "arg_8", "=", "figure", ".", "Figure", "(", "figsize", "=", "(", "10", ",", "8", ")", ")", "FigureCanvasAgg", "(", "arg_8", ")", "arg_9", "=", "arg_8", ".", "add_subplot", "(", "111", ")", "else", ":", "arg_9", "=", "arg_4", "arg_10", "=", "ep", ".", "cum_returns", "(", "arg_2", ",", "starting_value", "=", "1.", ")", "arg_11", "=", "arg_1", ".", "copy", "(", ")", "arg_12", "=", "arg_10", ".", "copy", "(", ")", "arg_13", "=", "arg_10", ".", "index", "[", "0", "]", "arg_14", "=", "[", "\"green\"", ",", "\"orange\"", ",", "\"orangered\"", ",", "\"darkred\"", "]", "for", "arg_15", "in", "range", "(", "arg_7", "+", "1", ")", ":", "if", "arg_15", ">", "0", ":", "arg_16", "=", "arg_10", ".", "loc", "[", "arg_13", ":", "]", "arg_11", "=", "arg_11", ".", "iloc", "[", "0", ":", "len", "(", "arg_16", ")", "]", "arg_11", "=", "arg_11", ".", "set_index", "(", "arg_16", ".", "index", ")", "arg_17", "=", "(", "arg_16", "<", "arg_11", "[", "float", "(", "-", "2.", ")", "]", ".", "iloc", "[", ":", "len", "(", "arg_16", ")", "]", ")", "if", "arg_17", ".", "sum", "(", ")", "<=", "0", ":", "break", "arg_13", "=", "arg_17", ".", "loc", "[", "arg_17", "]", ".", "index", "[", "0", "]", "arg_12", "=", "arg_10", ".", "loc", "[", "arg_13", ":", "]", "arg_11", "=", "(", "arg_1", "-", "(", "1", "-", "arg_10", ".", "loc", "[", "arg_13", "]", ")", ")", "for", "arg_18", "in", "arg_5", ":", "arg_19", "=", "arg_12", ".", "index", "arg_20", "=", "arg_11", "[", "float", "(", "arg_18", ")", "]", ".", "iloc", "[", ":", "len", "(", "arg_12", ")", "]", "arg_21", "=", "arg_11", "[", "float", "(", "-", "arg_18", ")", "]", ".", "iloc", "[", ":", "len", "(", "arg_12", ")", "]", "arg_9", ".", "fill_between", "(", "arg_19", ",", "arg_20", ",", "arg_21", ",", "color", "=", "arg_14", "[", "arg_15", "]", ",", "alpha", "=", "0.5", ")", "arg_22", "=", "'Cumulative returns = {:.2f}%'", ".", "format", "(", "(", "arg_10", ".", "iloc", "[", "-", "1", "]", "-", "1", ")", "*", "100", ")", "arg_9", ".", "plot", "(", "arg_10", ".", "index", ",", "arg_10", ".", "values", ",", "color", "=", "'black'", ",", "lw", "=", "3.", ",", "arg_22", "=", "arg_22", ")", "if", "arg_0", "is", "not", "None", ":", "arg_9", ".", "set_title", "(", "arg_0", ")", "arg_9", ".", "axhline", "(", "1", ",", "color", "=", "'black'", ",", "alpha", "=", "0.2", ")", "arg_9", ".", "legend", "(", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "if", "arg_4", "is", "None", ":", "return", "arg_8", "else", ":", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1000, arg_4=None,\n               arg_5=(1., 1.5, 2.), arg_6=None, arg_7=3):\n    \"\"\"\n    Plots the upper and lower bounds of an n standard deviation\n    cone of forecasted cumulative returns. Redraws a new cone when\n    cumulative returns fall outside of last cone drawn.\n\n    Parameters\n    ----------\n    name : str\n        Account name to be used as figure title.\n    bounds : pandas.core.frame.DataFrame\n        Contains upper and lower cone boundaries. Column names are\n        strings corresponding to the number of standard devations\n        above (positive) or below (negative) the projected mean\n        cumulative returns.\n    oos_returns : pandas.core.frame.DataFrame\n        Non-cumulative out-of-sample returns.\n    num_samples : int\n        Number of samples to draw from the in-sample daily returns.\n        Each sample will be an array with length num_days.\n        A higher number of samples will generate a more accurate\n        bootstrap cone.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    cone_std : list of int/float\n        Number of standard devations to use in the boundaries of\n        the cone. If multiple values are passed, cone bounds will\n        be generated for each value.\n    random_seed : int\n        Seed for the pseudorandom number generator used by the pandas\n        sample method.\n    num_strikes : int\n        Upper limit for number of cones drawn. Can be anything from 0 to 3.\n\n    Returns\n    -------\n    Returns are either an ax or fig option, but not both. If a\n    matplotlib.Axes instance is passed in as ax, then it will be modified\n    and returned. This allows for users to plot interactively in jupyter\n    notebook. When no ax object is passed in, a matplotlib.figure instance\n    is generated and returned. This figure can then be used to save\n    the plot as an image without viewing it.\n\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    fig : matplotlib.figure\n        The figure instance which contains all the plot elements.\n    \"\"\"\n\n    if arg_4 is None:\n        arg_8 = figure.Figure(figsize=(10, 8))\n        FigureCanvasAgg(arg_8)\n        arg_9 = arg_8.add_subplot(111)\n    else:\n        arg_9 = arg_4\n\n    arg_10 = ep.cum_returns(arg_2, starting_value=1.)\n    arg_11 = arg_1.copy()\n    arg_12 = arg_10.copy()\n    arg_13 = arg_10.index[0]\n    arg_14 = [\"green\", \"orange\", \"orangered\", \"darkred\"]\n\n    for arg_15 in range(arg_7 + 1):\n        if arg_15 > 0:\n            arg_16 = arg_10.loc[arg_13:]\n            arg_11 = arg_11.iloc[0:len(arg_16)]\n            arg_11 = arg_11.set_index(arg_16.index)\n            arg_17 = (arg_16 < arg_11[float(-2.)].iloc[:len(arg_16)])\n            if arg_17.sum() <= 0:\n                break\n            arg_13 = arg_17.loc[arg_17].index[0]\n            arg_12 = arg_10.loc[arg_13:]\n            arg_11 = (arg_1 - (1 - arg_10.loc[arg_13]))\n        for arg_18 in arg_5:\n            arg_19 = arg_12.index\n            arg_20 = arg_11[float(arg_18)].iloc[:len(arg_12)]\n            arg_21 = arg_11[float(-arg_18)].iloc[:len(arg_12)]\n            arg_9.fill_between(arg_19, arg_20, arg_21, color=arg_14[arg_15], alpha=0.5)\n\n    # Plot returns line graph\n    arg_22 = 'Cumulative returns = {:.2f}%'.format((arg_10.iloc[-1] - 1) * 100)\n    arg_9.plot(arg_10.index, arg_10.values, color='black', lw=3.,\n              arg_22=arg_22)\n\n    if arg_0 is not None:\n        arg_9.set_title(arg_0)\n    arg_9.axhline(1, color='black', alpha=0.2)\n    arg_9.legend(frameon=True, framealpha=0.5)\n\n    if arg_4 is None:\n        return arg_8\n    else:\n        return arg_9", "path": "pyfolio/plotting.py", "identifier": "plot_cones", "docstring": "Plots the upper and lower bounds of an n standard deviation\n    cone of forecasted cumulative returns. Redraws a new cone when\n    cumulative returns fall outside of last cone drawn.\n\n    Parameters\n    ----------\n    name : str\n        Account name to be used as figure title.\n    bounds : pandas.core.frame.DataFrame\n        Contains upper and lower cone boundaries. Column names are\n        strings corresponding to the number of standard devations\n        above (positive) or below (negative) the projected mean\n        cumulative returns.\n    oos_returns : pandas.core.frame.DataFrame\n        Non-cumulative out-of-sample returns.\n    num_samples : int\n        Number of samples to draw from the in-sample daily returns.\n        Each sample will be an array with length num_days.\n        A higher number of samples will generate a more accurate\n        bootstrap cone.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    cone_std : list of int/float\n        Number of standard devations to use in the boundaries of\n        the cone. If multiple values are passed, cone bounds will\n        be generated for each value.\n    random_seed : int\n        Seed for the pseudorandom number generator used by the pandas\n        sample method.\n    num_strikes : int\n        Upper limit for number of cones drawn. Can be anything from 0 to 3.\n\n    Returns\n    -------\n    Returns are either an ax or fig option, but not both. If a\n    matplotlib.Axes instance is passed in as ax, then it will be modified\n    and returned. This allows for users to plot interactively in jupyter\n    notebook. When no ax object is passed in, a matplotlib.figure instance\n    is generated and returned. This figure can then be used to save\n    the plot as an image without viewing it.\n\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    fig : matplotlib.figure\n        The figure instance which contains all the plot elements.", "docstring_tokens": ["Plots", "the", "upper", "and", "lower", "bounds", "of", "an", "n", "standard", "deviation", "cone", "of", "forecasted", "cumulative", "returns", ".", "Redraws", "a", "new", "cone", "when", "cumulative", "returns", "fall", "outside", "of", "last", "cone", "drawn", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260674}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/interfaces/script.py#L62-L78", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Common routine for reporting debugger error messages.", "language": "python", "parameters": "(self, msg, prefix=\"** \")", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"** \"", ")", ":", "if", "not", "arg_0", ".", "verbose", ":", "arg_3", "=", "(", "\"%s:%s: Error in source command file\"", "%", "(", "arg_0", ".", "script_name", ",", "arg_0", ".", "input_lineno", ")", ")", "arg_1", "=", "\"%s%s:\\n%s%s\"", "%", "(", "arg_2", ",", "arg_3", ",", "arg_2", ",", "arg_1", ")", "else", ":", "arg_1", "=", "\"%s%s\"", "%", "(", "arg_2", ",", "arg_1", ")", "pass", "arg_0", ".", "msg", "(", "arg_1", ")", "if", "arg_0", ".", "abort_on_error", ":", "raise", "EOFError", "return"], "function": "def Func(arg_0, arg_1, arg_2=\"** \"):\n        \"\"\"Common routine for reporting debugger error messages.\n           \"\"\"\n        #  self.verbose shows lines so we don't have to duplicate info\n        #  here. Perhaps there should be a 'terse' mode to never show\n        #  position info.\n        if not arg_0.verbose:\n            arg_3 = (\"%s:%s: Error in source command file\"\n                        % (arg_0.script_name, arg_0.input_lineno))\n            arg_1 = \"%s%s:\\n%s%s\" %(arg_2, arg_3, arg_2, arg_1)\n        else:\n            arg_1 = \"%s%s\" %(arg_2, arg_1)\n            pass\n        arg_0.msg(arg_1)\n        if arg_0.abort_on_error:\n            raise EOFError\n        return", "path": "trepan/interfaces/script.py", "identifier": "ScriptInterface.errmsg", "docstring": "Common routine for reporting debugger error messages.", "docstring_tokens": ["Common", "routine", "for", "reporting", "debugger", "error", "messages", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 260675}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/dataforms.py#L584-L597", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Add and item to the form.", "language": "python", "parameters": "(self, fields = None)", "return_statement": "return item", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "Item", "(", "arg_1", ")", "arg_0", ".", "items", ".", "append", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1 = None):\n        \"\"\"Add and item to the form.\n\n        :Parameters:\n            - `fields`: fields of the item (they may be added later).\n        :Types:\n            - `fields`: `list` of `Field`\n\n        :return: the item added.\n        :returntype: `Item`\n        \"\"\"\n        arg_2 = Item(arg_1)\n        arg_0.items.append(arg_2)\n        return arg_2", "path": "pyxmpp2/ext/dataforms.py", "identifier": "Form.add_item", "docstring": "Add and item to the form.\n\n        :Parameters:\n            - `fields`: fields of the item (they may be added later).\n        :Types:\n            - `fields`: `list` of `Field`\n\n        :return: the item added.\n        :returntype: `Item`", "docstring_tokens": ["Add", "and", "item", "to", "the", "form", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260676}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/gui/gtk_window.py#L220-L233", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Widget Action to Make the window fullscreen and update the bot.", "language": "python", "parameters": "(self, widget)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "fullscreen", "(", ")", "arg_0", ".", "is_fullscreen", "=", "True", "while", "Gtk", ".", "events_pending", "(", ")", ":", "Gtk", ".", "main_iteration", "(", ")", "arg_0", ".", "bot", ".", "_screen_width", "=", "Gdk", ".", "Screen", ".", "width", "(", ")", "arg_0", ".", "bot", ".", "_screen_height", "=", "Gdk", ".", "Screen", ".", "height", "(", ")", "arg_0", ".", "bot", ".", "_screen_ratio", "=", "arg_0", ".", "bot", ".", "_screen_width", "/", "arg_0", ".", "bot", ".", "_screen_height"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Widget Action to Make the window fullscreen and update the bot.\n        \"\"\"\n        arg_0.fullscreen()\n        arg_0.is_fullscreen = True\n        # next lines seem to be needed for window switching really to\n        # fullscreen mode before reading it's size values\n        while Gtk.events_pending():\n            Gtk.main_iteration()\n        # we pass informations on full-screen size to bot\n        arg_0.bot._screen_width = Gdk.Screen.width()\n        arg_0.bot._screen_height = Gdk.Screen.height()\n        arg_0.bot._screen_ratio = arg_0.bot._screen_width / arg_0.bot._screen_height", "path": "shoebot/gui/gtk_window.py", "identifier": "ShoebotWindow.do_fullscreen", "docstring": "Widget Action to Make the window fullscreen and update the bot.", "docstring_tokens": ["Widget", "Action", "to", "Make", "the", "window", "fullscreen", "and", "update", "the", "bot", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260677}
{"url": "https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L343-L348", "sha": "3dc6ad803f0b0d56586dec9542a6a06aa06cf569", "docstring_summary": "Restore full networking between containers", "language": "python", "parameters": "(opts)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "load_config", "(", "arg_0", ".", "config", ")", "arg_2", "=", "get_blockade", "(", "arg_1", ",", "arg_0", ")", "arg_2", ".", "join", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Restore full networking between containers\n    \"\"\"\n    arg_1 = load_config(arg_0.config)\n    arg_2 = get_blockade(arg_1, arg_0)\n    arg_2.join()", "path": "blockade/cli.py", "identifier": "cmd_join", "docstring": "Restore full networking between containers", "docstring_tokens": ["Restore", "full", "networking", "between", "containers"], "nwo": "worstcase/blockade", "score": 0.7770804820985606, "idx": 260678}
{"url": "https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/commands/describe_events_command.py#L12-L22", "sha": "4178c9c1282a9025fb987dab3470bea28c202e10", "docstring_summary": "Describes recent events for an environment.", "language": "python", "parameters": "(helper, config, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "environment", "(", "arg_4", ",", "arg_5", ")", "=", "arg_0", ".", "describe_events", "(", "arg_3", ",", "start_time", "=", "datetime", ".", "now", "(", ")", ".", "isoformat", "(", ")", ")", "for", "arg_6", "in", "arg_4", ":", "print", "(", "(", "\"[\"", "+", "arg_6", "[", "'Severity'", "]", "+", "\"] \"", "+", "arg_6", "[", "'Message'", "]", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Describes recent events for an environment.\n    \"\"\"\n    arg_3 = arg_2.environment\n\n    (arg_4, arg_5) = arg_0.describe_events(arg_3, start_time=datetime.now().isoformat())\n\n    # swap C-Names\n    for arg_6 in arg_4:\n        print((\"[\"+arg_6['Severity']+\"] \"+arg_6['Message']))", "path": "ebs_deploy/commands/describe_events_command.py", "identifier": "execute", "docstring": "Describes recent events for an environment.", "docstring_tokens": ["Describes", "recent", "events", "for", "an", "environment", "."], "nwo": "briandilley/ebs-deploy", "score": 0.28433842921098695, "idx": 260679}
{"url": "https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/irc.py#L87-L105", "sha": "f9d2bd6369aafe6cb0916c9406270ca8ecea2080", "docstring_summary": "\\\n        Connect to the IRC server using the nickname", "language": "python", "parameters": "(self)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "if", "arg_0", ".", "use_ssl", ":", "arg_0", ".", "_sock", "=", "ssl", ".", "wrap_socket", "(", "arg_0", ".", "_sock", ")", "try", ":", "arg_0", ".", "_sock", ".", "Func", "(", "(", "arg_0", ".", "server", ",", "arg_0", ".", "port", ")", ")", "except", "socket", ".", "error", ":", "arg_0", ".", "logger", ".", "error", "(", "'Unable to Func to %s on port %d'", "%", "(", "arg_0", ".", "server", ",", "arg_0", ".", "port", ")", ",", "exc_info", "=", "1", ")", "return", "False", "arg_0", ".", "_sock_file", "=", "arg_0", ".", "_sock", ".", "makefile", "(", ")", "if", "arg_0", ".", "password", ":", "arg_0", ".", "set_password", "(", ")", "arg_0", ".", "register_nick", "(", ")", "arg_0", ".", "register", "(", ")", "return", "True"], "function": "def Func(arg_0):\n        \"\"\"\\\n        Connect to the IRC server using the nickname\n        \"\"\"\n        arg_0._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        if arg_0.use_ssl:\n            arg_0._sock = ssl.wrap_socket(arg_0._sock)\n        try:\n            arg_0._sock.Func((arg_0.server, arg_0.port))\n        except socket.error:\n            arg_0.logger.error('Unable to Func to %s on port %d' % (arg_0.server, arg_0.port), exc_info=1)\n            return False\n\n        arg_0._sock_file = arg_0._sock.makefile()\n        if arg_0.password:\n            arg_0.set_password()\n        arg_0.register_nick()\n        arg_0.register()\n        return True", "path": "irc.py", "identifier": "IRCConnection.connect", "docstring": "\\\n        Connect to the IRC server using the nickname", "docstring_tokens": ["\\", "Connect", "to", "the", "IRC", "server", "using", "the", "nickname"], "nwo": "coleifer/irc", "score": 0.28749967694495965, "idx": 260680}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L1344-L1361", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Resolve the aliased symbol in the current namespace.", "language": "python", "parameters": "(s: sym.Symbol, ns: Optional[Namespace] = None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "Symbol", ",", "arg_3", ":", "arg_4", "[", "arg_5", "]", "=", "None", ")", "->", "arg_1", ".", "Symbol", ":", "if", "arg_0", "in", "_SPECIAL_FORMS", ":", "return", "arg_0", "arg_3", "=", "Maybe", "(", "arg_3", ")", ".", "or_else", "(", "get_current_ns", ")", "if", "arg_0", ".", "ns", "is", "not", "None", ":", "arg_6", "=", "arg_3", ".", "get_alias", "(", "arg_1", ".", "symbol", "(", "arg_0", ".", "ns", ")", ")", "if", "arg_6", "is", "not", "None", ":", "return", "arg_1", ".", "symbol", "(", "arg_0", ".", "name", ",", "arg_6", ".", "name", ")", "else", ":", "return", "arg_0", "else", ":", "arg_7", "=", "arg_3", ".", "find", "(", "arg_1", ".", "symbol", "(", "arg_0", ".", "name", ")", ")", "if", "arg_7", "is", "not", "None", ":", "return", "arg_1", ".", "symbol", "(", "arg_7", ".", "name", ".", "name", ",", "arg_7", ".", "ns", ".", "name", ")", "else", ":", "return", "arg_1", ".", "symbol", "(", "arg_0", ".", "name", ",", "arg_3", "=", "arg_3", ".", "name", ")"], "function": "def Func(arg_0: arg_1.Symbol, arg_3: arg_4[arg_5] = None) -> arg_1.Symbol:\n    \"\"\"Resolve the aliased symbol in the current namespace.\"\"\"\n    if arg_0 in _SPECIAL_FORMS:\n        return arg_0\n\n    arg_3 = Maybe(arg_3).or_else(get_current_ns)\n    if arg_0.ns is not None:\n        arg_6 = arg_3.get_alias(arg_1.symbol(arg_0.ns))\n        if arg_6 is not None:\n            return arg_1.symbol(arg_0.name, arg_6.name)\n        else:\n            return arg_0\n    else:\n        arg_7 = arg_3.find(arg_1.symbol(arg_0.name))\n        if arg_7 is not None:\n            return arg_1.symbol(arg_7.name.name, arg_7.ns.name)\n        else:\n            return arg_1.symbol(arg_0.name, arg_3=arg_3.name)", "path": "src/basilisp/lang/runtime.py", "identifier": "resolve_alias", "docstring": "Resolve the aliased symbol in the current namespace.", "docstring_tokens": ["Resolve", "the", "aliased", "symbol", "in", "the", "current", "namespace", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 260681}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1772-L1790", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Search for timedelta information in the string", "language": "python", "parameters": "(self, value)", "return_statement": "return (delta, value)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "REGEX_DELTA", ".", "search", "(", "arg_1", ")", "arg_3", "=", "datetime", ".", "timedelta", "(", "days", "=", "0", ")", "if", "arg_2", ":", "arg_4", "=", "int", "(", "arg_2", ".", "group", "(", "1", ")", ")", "if", "arg_2", ".", "group", "(", "3", ")", "==", "'ago'", "or", "arg_2", ".", "group", "(", "3", ")", "==", "'before'", ":", "arg_4", "=", "-", "arg_4", "if", "arg_2", ".", "group", "(", "2", ")", "==", "'minute'", ":", "arg_3", "=", "datetime", ".", "timedelta", "(", "minutes", "=", "arg_4", ")", "elif", "arg_2", ".", "group", "(", "2", ")", "==", "'hour'", ":", "arg_3", "=", "datetime", ".", "timedelta", "(", "hours", "=", "arg_4", ")", "elif", "arg_2", ".", "group", "(", "2", ")", "==", "'day'", ":", "arg_3", "=", "datetime", ".", "timedelta", "(", "days", "=", "arg_4", ")", "elif", "arg_2", ".", "group", "(", "2", ")", "==", "'week'", ":", "arg_3", "=", "datetime", ".", "timedelta", "(", "weeks", "=", "arg_4", ")", "arg_1", "=", "arg_0", ".", "REGEX_DELTA", ".", "sub", "(", "''", ",", "arg_1", ")", "return", "(", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    '''Search for timedelta information in the string'''\n    arg_2 = arg_0.REGEX_DELTA.search(arg_1)\n    arg_3 = datetime.timedelta(days=0)\n    if arg_2:\n      arg_4 = int(arg_2.group(1))\n      if arg_2.group(3) == 'ago' or arg_2.group(3) == 'before':\n        arg_4 = -arg_4\n\n      if arg_2.group(2) == 'minute':\n        arg_3 = datetime.timedelta(minutes=arg_4)\n      elif arg_2.group(2) == 'hour':\n        arg_3 = datetime.timedelta(hours=arg_4)\n      elif arg_2.group(2) == 'day':\n        arg_3 = datetime.timedelta(days=arg_4)\n      elif arg_2.group(2) == 'week':\n        arg_3 = datetime.timedelta(weeks=arg_4)\n      arg_1 = arg_0.REGEX_DELTA.sub('', arg_1)\n    return (arg_3, arg_1)", "path": "s4cmd.py", "identifier": "ExtendedOptParser.match_delta", "docstring": "Search for timedelta information in the string", "docstring_tokens": ["Search", "for", "timedelta", "information", "in", "the", "string"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260682}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/blockchainobject.py#L337-L345", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "This is the refresh method that overloads the prototype in\n            BlockchainObject.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "dict", ".", "__init__", "(", "arg_0", ",", "arg_0", ".", "blockchain", ".", "rpc", ".", "get_object", "(", "arg_0", ".", "identifier", ")", ",", "blockchain_instance", "=", "arg_0", ".", "blockchain", ",", ")"], "function": "def Func(arg_0):\n        \"\"\" This is the Func method that overloads the prototype in\n            BlockchainObject.\n        \"\"\"\n        dict.__init__(\n            arg_0,\n            arg_0.blockchain.rpc.get_object(arg_0.identifier),\n            blockchain_instance=arg_0.blockchain,\n        )", "path": "graphenecommon/blockchainobject.py", "identifier": "Object.refresh", "docstring": "This is the refresh method that overloads the prototype in\n            BlockchainObject.", "docstring_tokens": ["This", "is", "the", "refresh", "method", "that", "overloads", "the", "prototype", "in", "BlockchainObject", "."], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 260683}
{"url": "https://github.com/Numergy/yoda/blob/109f0e9441130488b0155f05883ef6531cf46ee9/yoda/config.py#L50-L57", "sha": "109f0e9441130488b0155f05883ef6531cf46ee9", "docstring_summary": "Write config in configuration file.\n        Data must me a dict.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "open", "(", "arg_0", ".", "config_file", ",", "\"w+\"", ")", "arg_1", ".", "Func", "(", "yaml", ".", "dump", "(", "dict", "(", "arg_0", ")", ",", "default_flow_style", "=", "False", ")", ")", "arg_1", ".", "close", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Write config in configuration file.\n        Data must me a dict.\n        \"\"\"\n        arg_1 = open(arg_0.config_file, \"w+\")\n        arg_1.Func(yaml.dump(dict(arg_0), default_flow_style=False))\n        arg_1.close()", "path": "yoda/config.py", "identifier": "Config.write", "docstring": "Write config in configuration file.\n        Data must me a dict.", "docstring_tokens": ["Write", "config", "in", "configuration", "file", ".", "Data", "must", "me", "a", "dict", "."], "nwo": "Numergy/yoda", "score": 0.1832591465193378, "idx": 260684}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L619-L649", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Returns the path to a package or cwd if that cannot be found.  This\n    returns the path of a package or the folder that contains a module.", "language": "python", "parameters": "(import_name)", "return_statement": "return os.path.dirname(os.path.abspath(filepath))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "sys", ".", "modules", ".", "get", "(", "arg_0", ")", "if", "arg_1", "is", "not", "None", "and", "hasattr", "(", "arg_1", ",", "'__file__'", ")", ":", "return", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "arg_1", ".", "__file__", ")", ")", "arg_2", "=", "pkgutil", ".", "get_loader", "(", "arg_0", ")", "if", "arg_2", "is", "None", "or", "arg_0", "==", "'__main__'", ":", "return", "os", ".", "getcwd", "(", ")", "if", "hasattr", "(", "arg_2", ",", "'get_filename'", ")", ":", "arg_3", "=", "arg_2", ".", "get_filename", "(", "arg_0", ")", "else", ":", "__import__", "(", "arg_0", ")", "arg_3", "=", "sys", ".", "modules", "[", "arg_0", "]", ".", "__file__", "return", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "arg_3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Returns the path to a package or cwd if that cannot be found.  This\n    returns the path of a package or the folder that contains a module.\n\n    Not to be confused with the package path returned by :func:`find_package`.\n    \"\"\"\n    # Module already imported and has a file attribute.  Use that first.\n    arg_1 = sys.modules.get(arg_0)\n    if arg_1 is not None and hasattr(arg_1, '__file__'):\n        return os.path.dirname(os.path.abspath(arg_1.__file__))\n\n    # Next attempt: check the loader.\n    arg_2 = pkgutil.get_loader(arg_0)\n\n    # Loader does not exist or we're referring to an unloaded main module\n    # or a main module without path (interactive sessions), go with the\n    # current working directory.\n    if arg_2 is None or arg_0 == '__main__':\n        return os.getcwd()\n\n    # For .egg, zipimporter does not have get_filename until Python 2.7.\n    # Some other loaders might exhibit the same behavior.\n    if hasattr(arg_2, 'get_filename'):\n        arg_3 = arg_2.get_filename(arg_0)\n    else:\n        # Fall back to imports.\n        __import__(arg_0)\n        arg_3 = sys.modules[arg_0].__file__\n\n    # filepath is import_name.py for a module, or __init__.py for a package.\n    return os.path.dirname(os.path.abspath(arg_3))", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py", "identifier": "get_root_path", "docstring": "Returns the path to a package or cwd if that cannot be found.  This\n    returns the path of a package or the folder that contains a module.\n\n    Not to be confused with the package path returned by :func:`find_package`.", "docstring_tokens": ["Returns", "the", "path", "to", "a", "package", "or", "cwd", "if", "that", "cannot", "be", "found", ".", "This", "returns", "the", "path", "of", "a", "package", "or", "the", "folder", "that", "contains", "a", "module", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260685}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L909-L921", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Remove a room from the list of managed rooms.", "language": "python", "parameters": "(self,rs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "del", "arg_0", ".", "rooms", "[", "arg_1", ".", "room_jid", ".", "bare", "(", ")", ".", "as_unicode", "(", ")", "]", "except", "KeyError", ":", "pass"], "function": "def Func(arg_0,arg_1):\n        \"\"\"\n        Remove a room from the list of managed rooms.\n\n        :Parameters:\n            - `rs`: the state object of the room.\n        :Types:\n            - `rs`: `MucRoomState`\n        \"\"\"\n        try:\n            del arg_0.rooms[arg_1.room_jid.bare().as_unicode()]\n        except KeyError:\n            pass", "path": "pyxmpp2/ext/muc/muc.py", "identifier": "MucRoomManager.forget", "docstring": "Remove a room from the list of managed rooms.\n\n        :Parameters:\n            - `rs`: the state object of the room.\n        :Types:\n            - `rs`: `MucRoomState`", "docstring_tokens": ["Remove", "a", "room", "from", "the", "list", "of", "managed", "rooms", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260686}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L194-L208", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Removes this element from the tree, including its children and\n        text.  The tail text is joined to the previous element or\n        parent.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "getparent", "(", ")", "assert", "arg_1", "is", "not", "None", "if", "arg_0", ".", "tail", ":", "arg_2", "=", "arg_0", ".", "getprevious", "(", ")", "if", "arg_2", "is", "None", ":", "arg_1", ".", "text", "=", "(", "arg_1", ".", "text", "or", "''", ")", "+", "arg_0", ".", "tail", "else", ":", "arg_2", ".", "tail", "=", "(", "arg_2", ".", "tail", "or", "''", ")", "+", "arg_0", ".", "tail", "arg_1", ".", "remove", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Removes this element from the tree, including its children and\n        text.  The tail text is joined to the previous element or\n        parent.\n        \"\"\"\n        arg_1 = arg_0.getparent()\n        assert arg_1 is not None\n        if arg_0.tail:\n            arg_2 = arg_0.getprevious()\n            if arg_2 is None:\n                arg_1.text = (arg_1.text or '') + arg_0.tail\n            else:\n                arg_2.tail = (arg_2.tail or '') + arg_0.tail\n        arg_1.remove(arg_0)", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py", "identifier": "HtmlMixin.drop_tree", "docstring": "Removes this element from the tree, including its children and\n        text.  The tail text is joined to the previous element or\n        parent.", "docstring_tokens": ["Removes", "this", "element", "from", "the", "tree", "including", "its", "children", "and", "text", ".", "The", "tail", "text", "is", "joined", "to", "the", "previous", "element", "or", "parent", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260687}
{"url": "https://github.com/shaunduncan/giphypop/blob/21e7f51c4f000ae24be3805b7eeec52bcce3d390/giphypop.py#L373-L408", "sha": "21e7f51c4f000ae24be3805b7eeec52bcce3d390", "docstring_summary": "Retrieve GIFs currently trending online. The data returned mirrors\n        that used to create The Hot 100 list of GIFs on Giphy.", "language": "python", "parameters": "(self, rating=None, limit=DEFAULT_SEARCH_LIMIT)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "arg_3", ")", ":", "arg_4", "=", "0", "arg_5", ",", "arg_6", "=", "0", ",", "25", "arg_7", "=", "{", "'rating'", ":", "arg_1", "}", "if", "arg_1", "else", "{", "}", "arg_8", "=", "partial", "(", "arg_0", ".", "_fetch", ",", "'Func'", ",", "**", "arg_7", ")", "while", "True", ":", "arg_9", "=", "arg_8", "(", "offset", "=", "arg_5", ",", "arg_2", "=", "arg_6", ")", "arg_5", "+=", "arg_6", "if", "not", "arg_9", "[", "'data'", "]", ":", "raise", "StopIteration", "for", "arg_10", "in", "arg_9", "[", "'data'", "]", ":", "arg_4", "+=", "1", "yield", "GiphyImage", "(", "arg_10", ")", "if", "arg_2", "is", "not", "None", "and", "arg_4", ">=", "arg_2", ":", "raise", "StopIteration", "if", "(", "arg_5", ">=", "arg_9", "[", "'pagination'", "]", "[", "'total_count'", "]", "or", "(", "arg_2", "is", "not", "None", "and", "arg_4", ">=", "arg_2", ")", ")", ":", "raise", "StopIteration"], "function": "def Func(arg_0, arg_1=None, arg_2=arg_3):\n        \"\"\"\n        Retrieve GIFs currently Func online. The data returned mirrors\n        that used to create The Hot 100 list of GIFs on Giphy.\n\n        :param rating: limit results to those rated (y,g, pg, pg-13 or r).\n        :type rating: string\n        :param limit: Maximum number of results to yield\n        :type limit: int\n        \"\"\"\n\n        arg_4 = 0  # Count how many things we yield\n        arg_5, arg_6 = 0, 25\n        arg_7 = {'rating': arg_1} if arg_1 else {}\n        arg_8 = partial(arg_0._fetch, 'Func', **arg_7)\n\n        # Generate results until we 1) run out of pages 2) reach a limit\n        while True:\n            arg_9 = arg_8(offset=arg_5, arg_2=arg_6)\n            arg_5 += arg_6\n\n            # Guard for empty results\n            if not arg_9['data']:\n                raise StopIteration\n\n            for arg_10 in arg_9['data']:\n                arg_4 += 1\n                yield GiphyImage(arg_10)\n\n                if arg_2 is not None and arg_4 >= arg_2:\n                    raise StopIteration\n\n            # Check yieled limit and whether or not there are more items\n            if (arg_5 >= arg_9['pagination']['total_count'] or\n                    (arg_2 is not None and arg_4 >= arg_2)):\n                raise StopIteration", "path": "giphypop.py", "identifier": "Giphy.trending", "docstring": "Retrieve GIFs currently trending online. The data returned mirrors\n        that used to create The Hot 100 list of GIFs on Giphy.\n\n        :param rating: limit results to those rated (y,g, pg, pg-13 or r).\n        :type rating: string\n        :param limit: Maximum number of results to yield\n        :type limit: int", "docstring_tokens": ["Retrieve", "GIFs", "currently", "trending", "online", ".", "The", "data", "returned", "mirrors", "that", "used", "to", "create", "The", "Hot", "100", "list", "of", "GIFs", "on", "Giphy", "."], "nwo": "shaunduncan/giphypop", "score": 0.19428525902463561, "idx": 260688}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/optionparser.py#L129-L135", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "Outputs usage information to the file if specified, or to the\n        io_manager's stdout if available, or to sys.stdout.", "language": "python", "parameters": "(self, file=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "optparse", ".", "OptionParser", ".", "Func", "(", "arg_0", ",", "arg_1", ")", "arg_1", ".", "flush", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Outputs usage information to the file if specified, or to the\n        io_manager's stdout if available, or to sys.stdout.\n        \"\"\"\n        optparse.OptionParser.Func(arg_0, arg_1)\n        arg_1.flush()", "path": "swiftly/cli/optionparser.py", "identifier": "OptionParser.print_usage", "docstring": "Outputs usage information to the file if specified, or to the\n        io_manager's stdout if available, or to sys.stdout.", "docstring_tokens": ["Outputs", "usage", "information", "to", "the", "file", "if", "specified", "or", "to", "the", "io_manager", "s", "stdout", "if", "available", "or", "to", "sys", ".", "stdout", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 260689}
{"url": "https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L240-L253", "sha": "897934d593fade0eb1998f8fadd18c91a89e5b9a", "docstring_summary": "Returns Twitter Bootstrap CSS file.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.", "language": "python", "parameters": "(version=None)", "return_statement": "return format_html(\n        '<link rel=\"stylesheet\" href=\"{static}djfrontend/css/twbs/{v}/bootstrap{min}.css\">',\n        static=_static_url, v=version, min=_min)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "if", "not", "getattr", "(", "settings", ",", "'DJFRONTEND_TWBS_CSS'", ",", "False", ")", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_TWBS_VERSION'", ",", "DJFRONTEND_TWBS_VERSION_DEFAULT", ")", "else", ":", "arg_0", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_TWBS_CSS'", ",", "DJFRONTEND_TWBS_VERSION_DEFAULT", ")", "return", "format_html", "(", "'<link rel=\"stylesheet\" href=\"{static}djfrontend/css/twbs/{v}/bootstrap{min}.css\">'", ",", "static", "=", "_static_url", ",", "v", "=", "arg_0", ",", "min", "=", "_min", ")"], "function": "def Func(arg_0=None):\n    \"\"\"\n    Returns Twitter Bootstrap CSS file.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.\n    \"\"\"\n    if arg_0 is None:\n        if not getattr(settings, 'DJFRONTEND_TWBS_CSS', False):\n            arg_0 = getattr(settings, 'DJFRONTEND_TWBS_VERSION', DJFRONTEND_TWBS_VERSION_DEFAULT)\n        else:\n             arg_0 = getattr(settings, 'DJFRONTEND_TWBS_CSS', DJFRONTEND_TWBS_VERSION_DEFAULT)\n\n    return format_html(\n        '<link rel=\"stylesheet\" href=\"{static}djfrontend/css/twbs/{v}/bootstrap{min}.css\">',\n        static=_static_url, v=arg_0, min=_min)", "path": "djfrontend/templatetags/djfrontend.py", "identifier": "djfrontend_twbs_css", "docstring": "Returns Twitter Bootstrap CSS file.\n    TEMPLATE_DEBUG returns full file, otherwise returns minified file.", "docstring_tokens": ["Returns", "Twitter", "Bootstrap", "CSS", "file", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "."], "nwo": "jonfaustman/django-frontend", "score": 0.1952535678330188, "idx": 260690}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/rtlLevel/signalUtils/ops.py#L174-L198", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Find out if this signal is something indexed", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "singleDriver", "(", ")", "try", ":", "arg_2", "=", "arg_1", ".", "operator", "except", "AttributeError", ":", "return", "if", "arg_2", "==", "AllOps", ".", "INDEX", ":", "arg_3", "=", "arg_1", ".", "operands", "[", "0", "]", "if", "isinstance", "(", "arg_3", ",", "RtlSignalBase", ")", ":", "return", "arg_3", ",", "[", "arg_1", ".", "operands", "[", "1", "]", "]", "else", ":", "raise", "Exception", "(", "\"can not drive static value %r\"", "%", "arg_3", ")", "except", "(", "MultipleDriversErr", ",", "NoDriverErr", ")", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"\n        Find out if this signal is something indexed\n        \"\"\"\n        try:\n            # now I am result of the index  xxx[xx] <= source\n            # get index op\n            arg_1 = arg_0.singleDriver()\n            try:\n                arg_2 = arg_1.operator\n            except AttributeError:\n                return\n\n            if arg_2 == AllOps.INDEX:\n                # get signal on which is index applied\n                arg_3 = arg_1.operands[0]\n                if isinstance(arg_3, RtlSignalBase):\n                    # [TODO] multidimensional indexing\n                    return arg_3, [arg_1.operands[1]]\n                else:\n                    raise Exception(\n                        \"can not drive static value %r\" % arg_3)\n\n        except (MultipleDriversErr, NoDriverErr):\n            pass", "path": "hwt/synthesizer/rtlLevel/signalUtils/ops.py", "identifier": "RtlSignalOps._getIndexCascade", "docstring": "Find out if this signal is something indexed", "docstring_tokens": ["Find", "out", "if", "this", "signal", "is", "something", "indexed"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 260691}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/inspector.py#L332-L363", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "return a Project from a list of files or modules", "language": "python", "parameters": "(\n    files, func_wrapper=_astroid_wrapper, project_name=\"no name\", black_list=(\"CVS\",)\n)", "return_statement": "return project", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "\"no name\"", ",", "arg_4", "=", "(", "\"CVS\"", ",", ")", ")", ":", "arg_5", "=", "manager", ".", "AstroidManager", "(", ")", "arg_6", "=", "Project", "(", "arg_3", ")", "for", "arg_7", "in", "arg_0", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_7", ")", ":", "arg_8", "=", "modutils", ".", "file_from_modpath", "(", "arg_7", ".", "split", "(", "\".\"", ")", ")", "elif", "os", ".", "path", ".", "isdir", "(", "arg_7", ")", ":", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_7", ",", "\"__init__.py\"", ")", "else", ":", "arg_8", "=", "arg_7", "arg_9", "=", "arg_1", "(", "arg_5", ".", "ast_from_file", ",", "arg_8", ")", "if", "arg_9", "is", "None", ":", "continue", "arg_6", ".", "path", "=", "arg_6", ".", "path", "or", "arg_9", ".", "file", "arg_6", ".", "add_module", "(", "arg_9", ")", "arg_11", "=", "arg_9", ".", "name", "if", "arg_9", ".", "package", "and", "arg_7", ".", "find", "(", "\"__init__\"", ")", "==", "-", "1", ":", "for", "arg_8", "in", "modutils", ".", "get_module_files", "(", "os", ".", "path", ".", "dirname", "(", "arg_9", ".", "file", ")", ",", "arg_4", ")", ":", "arg_9", "=", "arg_1", "(", "arg_5", ".", "ast_from_file", ",", "arg_8", ")", "if", "arg_9", "is", "None", "or", "arg_9", ".", "name", "==", "arg_11", ":", "continue", "arg_6", ".", "add_module", "(", "arg_9", ")", "return", "arg_6"], "function": "def Func(\n    arg_0, arg_1=arg_2, arg_3=\"no name\", arg_4=(\"CVS\",)\n):\n    \"\"\"return a Project from a list of files or modules\"\"\"\n    # build the project representation\n    arg_5 = manager.AstroidManager()\n    arg_6 = Project(arg_3)\n    for arg_7 in arg_0:\n        if not os.path.exists(arg_7):\n            arg_8 = modutils.file_from_modpath(arg_7.split(\".\"))\n        elif os.path.isdir(arg_7):\n            arg_8 = os.path.join(arg_7, \"__init__.py\")\n        else:\n            arg_8 = arg_7\n        arg_9 = arg_1(arg_5.ast_from_file, arg_8)\n        if arg_9 is None:\n            continue\n        # XXX why is first file defining the project.path ?\n        arg_6.path = arg_6.path or arg_9.file\n        arg_6.add_module(arg_9)\n        arg_11 = arg_9.name\n        # recurse in package except if __init__ was explicitly given\n        if arg_9.package and arg_7.find(\"__init__\") == -1:\n            # recurse on others packages / modules if this is a package\n            for arg_8 in modutils.get_module_files(\n                os.path.dirname(arg_9.file), arg_4\n            ):\n                arg_9 = arg_1(arg_5.ast_from_file, arg_8)\n                if arg_9 is None or arg_9.name == arg_11:\n                    continue\n                arg_6.add_module(arg_9)\n    return arg_6", "path": "pylint/pyreverse/inspector.py", "identifier": "project_from_files", "docstring": "return a Project from a list of files or modules", "docstring_tokens": ["return", "a", "Project", "from", "a", "list", "of", "files", "or", "modules"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260692}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L94-L115", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Determines the intersection point of two lines, or two finite line segments if infinite=False.\r\n        When the lines do not intersect, returns an empty list.", "language": "python", "parameters": "(x1, y1, x2, y2, x3, y3, x4, y4, infinite=False)", "return_statement": "return [(x1 + ua * (x2 - x1),\r\n             y1 + ua * (y2 - y1))]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", "=", "False", ")", ":", "arg_9", "=", "(", "arg_6", "-", "arg_4", ")", "*", "(", "arg_1", "-", "arg_5", ")", "-", "(", "arg_7", "-", "arg_5", ")", "*", "(", "arg_0", "-", "arg_4", ")", "arg_10", "=", "(", "arg_2", "-", "arg_0", ")", "*", "(", "arg_1", "-", "arg_5", ")", "-", "(", "arg_3", "-", "arg_1", ")", "*", "(", "arg_0", "-", "arg_4", ")", "arg_11", "=", "(", "arg_7", "-", "arg_5", ")", "*", "(", "arg_2", "-", "arg_0", ")", "-", "(", "arg_6", "-", "arg_4", ")", "*", "(", "arg_3", "-", "arg_1", ")", "if", "arg_11", "==", "0", ":", "if", "arg_9", "==", "arg_10", "==", "0", ":", "return", "[", "]", "else", ":", "return", "[", "]", "arg_9", "/=", "float", "(", "arg_11", ")", "arg_10", "/=", "float", "(", "arg_11", ")", "if", "not", "arg_8", "and", "not", "(", "0", "<=", "arg_9", "<=", "1", "and", "0", "<=", "arg_10", "<=", "1", ")", ":", "return", "None", ",", "None", "return", "[", "(", "arg_0", "+", "arg_9", "*", "(", "arg_2", "-", "arg_0", ")", ",", "arg_1", "+", "arg_9", "*", "(", "arg_3", "-", "arg_1", ")", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8=False):\r\n    \"\"\" Determines the intersection point of two lines, or two finite line segments if infinite=False.\r\n        When the lines do not intersect, returns an empty list.\r\n    \"\"\"\r\n    # Based on: P. Bourke, http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/\r\n    arg_9 = (arg_6 - arg_4) * (arg_1 - arg_5) - (arg_7 - arg_5) * (arg_0 - arg_4)\r\n    arg_10 = (arg_2 - arg_0) * (arg_1 - arg_5) - (arg_3 - arg_1) * (arg_0 - arg_4)\r\n    arg_11 = (arg_7 - arg_5) * (arg_2 - arg_0) - (arg_6 - arg_4) * (arg_3 - arg_1)\r\n    if arg_11 == 0:\r\n        if arg_9 == arg_10 == 0:\r\n            # The lines are coincident\r\n            return []\r\n        else:\r\n            # The lines are parallel.\r\n            return []\r\n    arg_9 /= float(arg_11)\r\n    arg_10 /= float(arg_11)\r\n    if not arg_8 and not (0 <= arg_9 <= 1 and 0 <= arg_10 <= 1):\r\n        # Intersection point is not within both line segments.\r\n        return None, None\r\n    return [(arg_0 + arg_9 * (arg_2 - arg_0),\r\n             arg_1 + arg_9 * (arg_3 - arg_1))]", "path": "shoebot/data/geometry.py", "identifier": "line_line_intersection", "docstring": "Determines the intersection point of two lines, or two finite line segments if infinite=False.\r\n        When the lines do not intersect, returns an empty list.", "docstring_tokens": ["Determines", "the", "intersection", "point", "of", "two", "lines", "or", "two", "finite", "line", "segments", "if", "infinite", "=", "False", ".", "When", "the", "lines", "do", "not", "intersect", "returns", "an", "empty", "list", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260693}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L572-L608", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Computes average Fano Factor over many neurons.", "language": "python", "parameters": "( neuron_ids, spike_res, time_window, start_time, end_time)", "return_statement": "return mean_ff", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "np", ".", "zeros", "(", "len", "(", "arg_0", ")", ")", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_0", ")", ":", "arg_8", "=", "CNFanoFactorComputer", ".", "_compute_fano_factor", "(", "arg_1", ",", "arg_7", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "arg_5", "[", "arg_6", "]", "=", "arg_8", "arg_9", "=", "np", ".", "mean", "(", "arg_5", ")", "return", "arg_9"], "function": "def Func( arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Computes average Fano Factor over many neurons.\n\n        :param neuron_ids:\n\n            List of neuron indices to average over\n\n        :param spike_res:\n\n            Result containing all the spikes\n\n        :param time_window:\n\n            Length of the consecutive time windows to compute the FF\n\n        :param start_time:\n\n            Start time of measurement to consider\n\n        :param end_time:\n\n            End time of measurement to consider\n\n        :return:\n\n            Average fano factor\n\n        \"\"\"\n        arg_5 = np.zeros(len(arg_0))\n\n        for arg_6, arg_7 in enumerate(arg_0):\n            arg_8=CNFanoFactorComputer._compute_fano_factor(\n                            arg_1, arg_7, arg_2, arg_3, arg_4)\n            arg_5[arg_6]=arg_8\n\n        arg_9 = np.mean(arg_5)\n        return arg_9", "path": "examples/example_24_large_scale_brian2_simulation/clusternet.py", "identifier": "CNFanoFactorComputer._compute_mean_fano_factor", "docstring": "Computes average Fano Factor over many neurons.\n\n        :param neuron_ids:\n\n            List of neuron indices to average over\n\n        :param spike_res:\n\n            Result containing all the spikes\n\n        :param time_window:\n\n            Length of the consecutive time windows to compute the FF\n\n        :param start_time:\n\n            Start time of measurement to consider\n\n        :param end_time:\n\n            End time of measurement to consider\n\n        :return:\n\n            Average fano factor", "docstring_tokens": ["Computes", "average", "Fano", "Factor", "over", "many", "neurons", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260694}
{"url": "https://github.com/jedp/python-redis-log/blob/3fc81a43423adf289a7ec985f282a8a40341fc87/redislog/handlers.py#L7-L22", "sha": "3fc81a43423adf289a7ec985f282a8a40341fc87", "docstring_summary": "JSON-encode a record for serializing through redis.", "language": "python", "parameters": "(self, record)", "return_statement": "return json.dumps(data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "_raw", ".", "copy", "(", ")", "arg_2", "[", "'time'", "]", "=", "arg_2", "[", "'time'", "]", ".", "isoFunc", "(", ")", "if", "arg_2", ".", "get", "(", "'traceback'", ")", ":", "arg_2", "[", "'traceback'", "]", "=", "arg_0", ".", "FuncException", "(", "arg_2", "[", "'traceback'", "]", ")", "return", "json", ".", "dumps", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        JSON-encode a record for serializing through redis.\n\n        Convert date to iso Func, and stringify any exceptions.\n        \"\"\"\n        arg_2 = arg_1._raw.copy()\n\n        # serialize the datetime date as utc string\n        arg_2['time'] = arg_2['time'].isoFunc()\n\n        # stringify exception data\n        if arg_2.get('traceback'):\n            arg_2['traceback'] = arg_0.FuncException(arg_2['traceback'])\n\n        return json.dumps(arg_2)", "path": "redislog/handlers.py", "identifier": "RedisFormatter.format", "docstring": "JSON-encode a record for serializing through redis.\n\n        Convert date to iso format, and stringify any exceptions.", "docstring_tokens": ["JSON", "-", "encode", "a", "record", "for", "serializing", "through", "redis", "."], "nwo": "jedp/python-redis-log", "score": 0.31646955184280007, "idx": 260695}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/spia.py#L64-L108", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Create an excel sheet ready to be used in SPIA software.", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "return spia_matrices", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Mapping", "[", "str", ",", "pd", ".", "DataFrame", "]", ":", "arg_2", "=", "get_matrix_index", "(", "arg_0", ")", "arg_3", "=", "build_spia_matrices", "(", "arg_2", ")", "for", "arg_4", ",", "arg_5", ",", "arg_6", "in", "arg_0", ".", "edges", "(", "data", "=", "True", ")", ":", "if", "isinstance", "(", "arg_4", ",", "CentralDogma", ")", "and", "isinstance", "(", "arg_5", ",", "CentralDogma", ")", ":", "update_spia_matrices", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "elif", "isinstance", "(", "arg_4", ",", "CentralDogma", ")", "and", "isinstance", "(", "arg_5", ",", "ListAbundance", ")", ":", "for", "arg_7", "in", "arg_5", ".", "members", ":", "if", "not", "isinstance", "(", "arg_7", ",", "CentralDogma", ")", ":", "continue", "update_spia_matrices", "(", "arg_3", ",", "arg_4", ",", "arg_7", ",", "arg_6", ")", "elif", "isinstance", "(", "arg_4", ",", "ListAbundance", ")", "and", "isinstance", "(", "arg_5", ",", "CentralDogma", ")", ":", "for", "arg_7", "in", "arg_4", ".", "members", ":", "if", "not", "isinstance", "(", "arg_7", ",", "CentralDogma", ")", ":", "continue", "update_spia_matrices", "(", "arg_3", ",", "arg_7", ",", "arg_5", ",", "arg_6", ")", "elif", "isinstance", "(", "arg_4", ",", "ListAbundance", ")", "and", "isinstance", "(", "arg_5", ",", "ListAbundance", ")", ":", "for", "arg_8", ",", "arg_9", "in", "product", "(", "arg_4", ".", "members", ",", "arg_5", ".", "members", ")", ":", "if", "isinstance", "(", "arg_8", ",", "CentralDogma", ")", "and", "isinstance", "(", "arg_9", ",", "CentralDogma", ")", ":", "update_spia_matrices", "(", "arg_3", ",", "arg_8", ",", "arg_9", ",", "arg_6", ")", "return", "arg_3"], "function": "def Func(arg_0: arg_1) -> Mapping[str, pd.DataFrame]:\n    \"\"\"Create an excel sheet ready to be used in SPIA software.\n\n    :param graph: BELGraph\n    :return: dictionary with matrices\n    \"\"\"\n    arg_2 = get_matrix_index(arg_0)\n    arg_3 = build_spia_matrices(arg_2)\n\n    for arg_4, arg_5, arg_6 in arg_0.edges(data=True):\n        # Both nodes are CentralDogma abundances\n        if isinstance(arg_4, CentralDogma) and isinstance(arg_5, CentralDogma):\n            # Update matrix dict\n            update_spia_matrices(arg_3, arg_4, arg_5, arg_6)\n\n        # Subject is CentralDogmaAbundance and node is ListAbundance\n        elif isinstance(arg_4, CentralDogma) and isinstance(arg_5, ListAbundance):\n            # Add a relationship from subject to each of the members in the object\n            for arg_7 in arg_5.members:\n                # Skip if the member is not in CentralDogma\n                if not isinstance(arg_7, CentralDogma):\n                    continue\n\n                update_spia_matrices(arg_3, arg_4, arg_7, arg_6)\n\n        # Subject is ListAbundance and node is CentralDogmaAbundance\n        elif isinstance(arg_4, ListAbundance) and isinstance(arg_5, CentralDogma):\n            # Add a relationship from each of the members of the subject to the object\n            for arg_7 in arg_4.members:\n                # Skip if the member is not in CentralDogma\n                if not isinstance(arg_7, CentralDogma):\n                    continue\n\n                update_spia_matrices(arg_3, arg_7, arg_5, arg_6)\n\n        # Both nodes are ListAbundance\n        elif isinstance(arg_4, ListAbundance) and isinstance(arg_5, ListAbundance):\n            for arg_8, arg_9 in product(arg_4.members, arg_5.members):\n                # Update matrix if both are CentralDogma\n                if isinstance(arg_8, CentralDogma) and isinstance(arg_9, CentralDogma):\n                    update_spia_matrices(arg_3, arg_8, arg_9, arg_6)\n\n        # else Not valid edge\n\n    return arg_3", "path": "src/pybel_tools/analysis/spia.py", "identifier": "bel_to_spia_matrices", "docstring": "Create an excel sheet ready to be used in SPIA software.\n\n    :param graph: BELGraph\n    :return: dictionary with matrices", "docstring_tokens": ["Create", "an", "excel", "sheet", "ready", "to", "be", "used", "in", "SPIA", "software", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 260696}
{"url": "https://github.com/MycroftAI/padatious/blob/794a2530d6079bdd06e193edd0d30b2cc793e631/padatious/intent_container.py#L162-L188", "sha": "794a2530d6079bdd06e193edd0d30b2cc793e631", "docstring_summary": "Trains all the loaded intents that need to be updated\n        If a cache file exists with the same hash as the intent file,\n        the intent will not be trained and just loaded from file", "language": "python", "parameters": "(self, debug=True, force=False, single_thread=False, timeout=20)", "return_statement": "return not self.train_thread.is_alive()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "20", ")", ":", "if", "not", "arg_0", ".", "must_Func", "and", "not", "arg_2", ":", "return", "arg_0", ".", "padaos", ".", "compile", "(", ")", "arg_0", ".", "Func_thread", "=", "Thread", "(", "target", "=", "arg_0", ".", "_Func", ",", "kwargs", "=", "dict", "(", "arg_1", "=", "arg_1", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ")", ",", "daemon", "=", "True", ")", "arg_0", ".", "Func_thread", ".", "start", "(", ")", "arg_0", ".", "Func_thread", ".", "join", "(", "arg_4", ")", "arg_0", ".", "must_Func", "=", "False", "return", "not", "arg_0", ".", "Func_thread", ".", "is_alive", "(", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=False, arg_3=False, arg_4=20):\n        \"\"\"\n        Trains all the loaded intents that need to be updated\n        If a cache file exists with the same hash as the intent file,\n        the intent will not be Funced and just loaded from file\n\n        Args:\n            debug (bool): Whether to print a message to stdout each time a new intent is Funced\n            force (bool): Whether to force Funcing if already finished\n            single_thread (bool): Whether to force running in a single thread\n            timeout (float): Seconds before cancelling Funcing\n        Returns:\n            bool: True if Funcing succeeded without timeout\n        \"\"\"\n        if not arg_0.must_Func and not arg_2:\n            return\n        arg_0.padaos.compile()\n        arg_0.Func_thread = Thread(target=arg_0._Func, kwargs=dict(\n            arg_1=arg_1,\n            arg_3=arg_3,\n            arg_4=arg_4\n        ), daemon=True)\n        arg_0.Func_thread.start()\n        arg_0.Func_thread.join(arg_4)\n\n        arg_0.must_Func = False\n        return not arg_0.Func_thread.is_alive()", "path": "padatious/intent_container.py", "identifier": "IntentContainer.train", "docstring": "Trains all the loaded intents that need to be updated\n        If a cache file exists with the same hash as the intent file,\n        the intent will not be trained and just loaded from file\n\n        Args:\n            debug (bool): Whether to print a message to stdout each time a new intent is trained\n            force (bool): Whether to force training if already finished\n            single_thread (bool): Whether to force running in a single thread\n            timeout (float): Seconds before cancelling training\n        Returns:\n            bool: True if training succeeded without timeout", "docstring_tokens": ["Trains", "all", "the", "loaded", "intents", "that", "need", "to", "be", "updated", "If", "a", "cache", "file", "exists", "with", "the", "same", "hash", "as", "the", "intent", "file", "the", "intent", "will", "not", "be", "trained", "and", "just", "loaded", "from", "file"], "nwo": "MycroftAI/padatious", "score": 0.4588892726323654, "idx": 260697}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/Platform.py#L31-L62", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Detect if running on the Raspberry Pi or Beaglebone Black and return the\n    platform type.  Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN.", "language": "python", "parameters": "()", "return_statement": "return UNKNOWN", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "pi_version", "(", ")", "if", "arg_0", "is", "not", "None", ":", "return", "RASPBERRY_PI", "arg_1", "=", "platform", ".", "platform", "(", ")", "if", "arg_1", ".", "lower", "(", ")", ".", "find", "(", "'armv7l-with-debian'", ")", ">", "-", "1", ":", "return", "BEAGLEBONE_BLACK", "elif", "arg_1", ".", "lower", "(", ")", ".", "find", "(", "'armv7l-with-ubuntu'", ")", ">", "-", "1", ":", "return", "BEAGLEBONE_BLACK", "elif", "arg_1", ".", "lower", "(", ")", ".", "find", "(", "'armv7l-with-glibc2.4'", ")", ">", "-", "1", ":", "return", "BEAGLEBONE_BLACK", "elif", "arg_1", ".", "lower", "(", ")", ".", "find", "(", "'tegra-aarch64-with-ubuntu'", ")", ">", "-", "1", ":", "return", "JETSON_NANO", "try", ":", "import", "mraa", "if", "mraa", ".", "getPlatformName", "(", ")", "==", "'MinnowBoard MAX'", ":", "return", "MINNOWBOARD", "except", "ImportError", ":", "pass", "return", "UNKNOWN"], "function": "def Func():\n    \"\"\"Detect if running on the Raspberry Pi or Beaglebone Black and return the\n    platform type.  Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN.\"\"\"\n    # Handle Raspberry Pi\n    arg_0 = pi_version()\n    if arg_0 is not None:\n        return RASPBERRY_PI\n\n    # Handle Beaglebone Black\n    # TODO: Check the Beaglebone Black /proc/cpuinfo value instead of reading\n    # the platform.\n    arg_1 = platform.platform()\n    if arg_1.lower().find('armv7l-with-debian') > -1:\n        return BEAGLEBONE_BLACK\n    elif arg_1.lower().find('armv7l-with-ubuntu') > -1:\n        return BEAGLEBONE_BLACK\n    elif arg_1.lower().find('armv7l-with-glibc2.4') > -1:\n        return BEAGLEBONE_BLACK\n    elif arg_1.lower().find('tegra-aarch64-with-ubuntu') > -1:\n        return JETSON_NANO\n        \n    # Handle Minnowboard\n    # Assumption is that mraa is installed\n    try: \n        import mraa \n        if mraa.getPlatformName()=='MinnowBoard MAX':\n            return MINNOWBOARD\n    except ImportError:\n        pass\n    \n    # Couldn't figure out the platform, just return unknown.\n    return UNKNOWN", "path": "Adafruit_GPIO/Platform.py", "identifier": "platform_detect", "docstring": "Detect if running on the Raspberry Pi or Beaglebone Black and return the\n    platform type.  Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN.", "docstring_tokens": ["Detect", "if", "running", "on", "the", "Raspberry", "Pi", "or", "Beaglebone", "Black", "and", "return", "the", "platform", "type", ".", "Will", "return", "RASPBERRY_PI", "BEAGLEBONE_BLACK", "or", "UNKNOWN", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 260698}
{"url": "https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L352-L359", "sha": "109481d6b02701db00b72223dd4a65e167c589a6", "docstring_summary": "Invite a user to a group.", "language": "python", "parameters": "(self, user, state=MembershipState.ACTIVE)", "return_statement": "return Membership.create(self, user, state)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "ACTIVE", ")", ":", "return", "Membership", ".", "create", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.ACTIVE):\n        \"\"\"Invite a user to a group.\n\n        :param user: User to be added as a group member.\n        :param state: MembershipState. Default: MembershipState.ACTIVE.\n        :returns: Membership object or None.\n        \"\"\"\n        return Membership.create(arg_0, arg_1, arg_2)", "path": "invenio_groups/models.py", "identifier": "Group.add_member", "docstring": "Invite a user to a group.\n\n        :param user: User to be added as a group member.\n        :param state: MembershipState. Default: MembershipState.ACTIVE.\n        :returns: Membership object or None.", "docstring_tokens": ["Invite", "a", "user", "to", "a", "group", "."], "nwo": "inveniosoftware-contrib/invenio-groups", "score": 0.2727920376977753, "idx": 260699}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/scripts/sandshrew/sandshrew.py#L37-L50", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "helper method for determining binary architecture", "language": "python", "parameters": "(binary)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ",", "'rb'", ")", "as", "f", ":", "arg_1", "=", "ELFFile", "(", "f", ")", "if", "arg_1", "[", "'e_machine'", "]", "==", "'EM_X86_64'", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"\n    helper method for determining binary architecture\n\n    :param binary: str for binary to introspect.\n    :rtype bool: True for x86_64, False otherwise\n    \"\"\"\n\n    with open(arg_0, 'rb') as f:\n        arg_1 = ELFFile(f)\n        if arg_1['e_machine'] == 'EM_X86_64':\n            return True\n        else:\n            return False", "path": "scripts/sandshrew/sandshrew.py", "identifier": "binary_arch", "docstring": "helper method for determining binary architecture\n\n    :param binary: str for binary to introspect.\n    :rtype bool: True for x86_64, False otherwise", "docstring_tokens": ["helper", "method", "for", "determining", "binary", "architecture"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260700}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/validation.py#L117-L140", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Make arrays indexable for cross-validation.", "language": "python", "parameters": "(*iterables)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ":", "if", "sp", ".", "issparse", "(", "arg_2", ")", ":", "arg_1", ".", "append", "(", "arg_2", ".", "tocsr", "(", ")", ")", "elif", "hasattr", "(", "arg_2", ",", "\"__getitem__\"", ")", "or", "hasattr", "(", "arg_2", ",", "\"iloc\"", ")", ":", "arg_1", ".", "append", "(", "arg_2", ")", "elif", "arg_2", "is", "None", ":", "arg_1", ".", "append", "(", "arg_2", ")", "else", ":", "arg_1", ".", "append", "(", "np", ".", "array", "(", "arg_2", ")", ")", "check_consistent_length", "(", "*", "arg_1", ")", "return", "arg_1"], "function": "def Func(*arg_0):\n    \"\"\"Make arrays Func for cross-validation.\n\n    Checks consistent length, passes through None, and ensures that everything\n    can be indexed by converting sparse matrices to csr and converting\n    non-interable objects to arrays.\n\n    Parameters\n    ----------\n    iterables : lists, dataframes, arrays, sparse matrices\n        List of objects to ensure sliceability.\n    \"\"\"\n    arg_1 = []\n    for arg_2 in arg_0:\n        if sp.issparse(arg_2):\n            arg_1.append(arg_2.tocsr())\n        elif hasattr(arg_2, \"__getitem__\") or hasattr(arg_2, \"iloc\"):\n            arg_1.append(arg_2)\n        elif arg_2 is None:\n            arg_1.append(arg_2)\n        else:\n            arg_1.append(np.array(arg_2))\n    check_consistent_length(*arg_1)\n    return arg_1", "path": "boyle/utils/validation.py", "identifier": "indexable", "docstring": "Make arrays indexable for cross-validation.\n\n    Checks consistent length, passes through None, and ensures that everything\n    can be indexed by converting sparse matrices to csr and converting\n    non-interable objects to arrays.\n\n    Parameters\n    ----------\n    iterables : lists, dataframes, arrays, sparse matrices\n        List of objects to ensure sliceability.", "docstring_tokens": ["Make", "arrays", "indexable", "for", "cross", "-", "validation", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 260701}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/make.py#L76-L94", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Coerce a list into a list of triplets.", "language": "python", "parameters": "(colors)", "return_statement": "return list(zip(*[iter(colors)] * 3))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", "[", "0", "]", "[", "0", "]", "return", "arg_0", "except", ":", "pass", "arg_1", "=", "len", "(", "arg_0", ")", "%", "3", "if", "arg_1", ":", "arg_0", "=", "arg_0", "[", ":", "-", "arg_1", "]", "return", "list", "(", "zip", "(", "*", "[", "iter", "(", "arg_0", ")", "]", "*", "3", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Coerce a list into a list of triplets.\n\n    If `colors` is a list of lists or strings, return it as is.  Otherwise,\n    divide it into tuplets of length three, silently discarding any extra\n    elements beyond a multiple of three.\n    \"\"\"\n    try:\n        arg_0[0][0]\n        return arg_0\n    except:\n        pass\n\n    # It's a 1-dimensional list\n    arg_1 = len(arg_0) % 3\n    if arg_1:\n        arg_0 = arg_0[:-arg_1]\n    return list(zip(*[iter(arg_0)] * 3))", "path": "bibliopixel/colors/make.py", "identifier": "to_triplets", "docstring": "Coerce a list into a list of triplets.\n\n    If `colors` is a list of lists or strings, return it as is.  Otherwise,\n    divide it into tuplets of length three, silently discarding any extra\n    elements beyond a multiple of three.", "docstring_tokens": ["Coerce", "a", "list", "into", "a", "list", "of", "triplets", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 260702}
{"url": "https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmdlet.py#L105-L113", "sha": "5852a63fc2c7dd723a3d7abe18455f8dacb49433", "docstring_summary": "Self-cloning. All its next Pipe objects are cloned too.", "language": "python", "parameters": "(self)", "return_statement": "return new_object", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "copy", ".", "copy", "(", "arg_0", ")", "if", "arg_1", ".", "next", ":", "arg_1", ".", "next", "=", "arg_1", ".", "next", ".", "Func", "(", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Self-cloning. All its next Pipe objects are Funcd too.\n\n        :returns: Funcd object\n        \"\"\"\n        arg_1 = copy.copy(arg_0)\n        if arg_1.next:\n            arg_1.next = arg_1.next.Func()\n        return arg_1", "path": "cmdlet/cmdlet.py", "identifier": "Pipe.clone", "docstring": "Self-cloning. All its next Pipe objects are cloned too.\n\n        :returns: cloned object", "docstring_tokens": ["Self", "-", "cloning", ".", "All", "its", "next", "Pipe", "objects", "are", "cloned", "too", "."], "nwo": "GaryLee/cmdlet", "score": 0.2424429654267875, "idx": 260703}
{"url": "https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L276-L279", "sha": "4fe4d928cd6fe3e7564f7362e3996898bda5a285", "docstring_summary": "Return the node where the ``name`` would land to", "language": "python", "parameters": "(self, name)", "return_statement": "return {node: self.cluster['nodes'][node]}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_getnodenamefor", "(", "arg_1", ")", "return", "{", "arg_2", ":", "arg_0", ".", "cluster", "[", "'nodes'", "]", "[", "arg_2", "]", "}"], "function": "def Func(arg_0, arg_1):\n        \"Return the node where the ``name`` would land to\"\n        arg_2 = arg_0._getnodenamefor(arg_1)\n        return {arg_2: arg_0.cluster['nodes'][arg_2]}", "path": "rediscluster/cluster_client.py", "identifier": "StrictRedisCluster.getnodefor", "docstring": "Return the node where the ``name`` would land to", "docstring_tokens": ["Return", "the", "node", "where", "the", "name", "would", "land", "to"], "nwo": "salimane/rediscluster-py", "score": 0.19802268511144447, "idx": 260704}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/color.py#L23-L50", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Convert various input to color tuples.", "language": "python", "parameters": "(color)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "is_str", "(", "arg_0", ")", ":", "return", "Color", "[", "arg_0", "]", ".", "value", "elif", "isinstance", "(", "arg_0", ",", "Color", ")", ":", "return", "arg_0", ".", "value", "elif", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "assert", "len", "(", "arg_0", ")", "==", "3", "for", "arg_1", "in", "arg_0", ":", "assert", "arg_1", ">=", "0", "and", "arg_1", "<=", "255", "return", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "int", ")", ":", "assert", "arg_0", ">=", "0", "and", "arg_0", "<=", "255", "return", "arg_0", ",", "arg_0", ",", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "np", ".", "ndarray", ")", ":", "assert", "arg_0", ".", "ndim", "==", "1", "and", "arg_0", ".", "size", "==", "3", "assert", "np", ".", "all", "(", "(", "arg_0", ">=", "0", ")", "&", "(", "arg_0", "<=", "255", ")", ")", "arg_0", "=", "arg_0", ".", "astype", "(", "np", ".", "uint8", ")", "return", "tuple", "(", "arg_0", ")", "else", ":", "raise", "TypeError", "(", "'Invalid type for color: {}'", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Convert various input to color tuples.\n\n    Args:\n        color (:obj:`Color`/str/tuple/int/ndarray): Color inputs\n\n    Returns:\n        tuple[int]: A tuple of 3 integers indicating BGR channels.\n    \"\"\"\n    if is_str(arg_0):\n        return Color[arg_0].value\n    elif isinstance(arg_0, Color):\n        return arg_0.value\n    elif isinstance(arg_0, tuple):\n        assert len(arg_0) == 3\n        for arg_1 in arg_0:\n            assert arg_1 >= 0 and arg_1 <= 255\n        return arg_0\n    elif isinstance(arg_0, int):\n        assert arg_0 >= 0 and arg_0 <= 255\n        return arg_0, arg_0, arg_0\n    elif isinstance(arg_0, np.ndarray):\n        assert arg_0.ndim == 1 and arg_0.size == 3\n        assert np.all((arg_0 >= 0) & (arg_0 <= 255))\n        arg_0 = arg_0.astype(np.uint8)\n        return tuple(arg_0)\n    else:\n        raise TypeError('Invalid type for color: {}'.format(type(arg_0)))", "path": "mmcv/visualization/color.py", "identifier": "color_val", "docstring": "Convert various input to color tuples.\n\n    Args:\n        color (:obj:`Color`/str/tuple/int/ndarray): Color inputs\n\n    Returns:\n        tuple[int]: A tuple of 3 integers indicating BGR channels.", "docstring_tokens": ["Convert", "various", "input", "to", "color", "tuples", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 260705}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/transpose.py#L184-L205", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Helper for _forward and _inverse_event_shape.", "language": "python", "parameters": "(self, shape, static_perm_to_shape)", "return_statement": "return shape[:tensorshape_util.rank(shape) - rightmost_].concatenate(\n        static_perm_to_shape(shape[tensorshape_util.rank(shape) - rightmost_:],\n                             perm_))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "tf", ".", "get_static_value", "(", "arg_0", ".", "rightmost_transposed_ndims", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_1", ")", "is", "None", "or", "arg_3", "is", "None", ":", "return", "tf", ".", "TensorShape", "(", "None", ")", "if", "tensorshape_util", ".", "rank", "(", "arg_1", ")", "<", "arg_3", ":", "raise", "ValueError", "(", "'Invalid shape: min event ndims={} but got {}'", ".", "format", "(", "arg_3", ",", "arg_1", ")", ")", "arg_4", "=", "tf", ".", "get_static_value", "(", "arg_0", ".", "perm", ",", "partial", "=", "True", ")", "if", "arg_4", "is", "None", ":", "return", "arg_1", "[", ":", "tensorshape_util", ".", "rank", "(", "arg_1", ")", "-", "arg_3", "]", ".", "concatenate", "(", "[", "None", "]", "*", "int", "(", "arg_3", ")", ")", "if", "sum", "(", "arg_5", "is", "None", "for", "arg_5", "in", "arg_4", ")", "==", "1", ":", "arg_6", "=", "np", ".", "argsort", "(", "[", "-", "1", "if", "arg_5", "is", "None", "else", "arg_5", "for", "arg_5", "in", "arg_4", "]", ")", "for", "arg_7", ",", "arg_5", "in", "enumerate", "(", "arg_6", "[", "1", ":", "]", ")", ":", "if", "arg_7", "!=", "arg_5", ":", "arg_4", "=", "[", "arg_7", "if", "arg_5", "is", "None", "else", "arg_5", "for", "arg_5", "in", "arg_4", "]", "break", "return", "arg_1", "[", ":", "tensorshape_util", ".", "rank", "(", "arg_1", ")", "-", "arg_3", "]", ".", "concatenate", "(", "arg_2", "(", "arg_1", "[", "tensorshape_util", ".", "rank", "(", "arg_1", ")", "-", "arg_3", ":", "]", ",", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Helper for _forward and _inverseFunc.\"\"\"\n    arg_3 = tf.get_static_value(arg_0.rightmost_transposed_ndims)\n    if tensorshape_util.rank(arg_1) is None or arg_3 is None:\n      return tf.TensorShape(None)\n    if tensorshape_util.rank(arg_1) < arg_3:\n      raise ValueError('Invalid shape: min event ndims={} but got {}'.format(\n          arg_3, arg_1))\n    arg_4 = tf.get_static_value(arg_0.perm, partial=True)\n    if arg_4 is None:\n      return arg_1[:tensorshape_util.rank(arg_1) - arg_3].concatenate(\n          [None] * int(arg_3))\n    # We can use elimination to reidentify a single None dimension.\n    if sum(arg_5 is None for arg_5 in arg_4) == 1:\n      arg_6 = np.argsort([-1 if arg_5 is None else arg_5 for arg_5 in arg_4])\n      for arg_7, arg_5 in enumerate(arg_6[1:]):  # The -1 sorts to position 0.\n        if arg_7 != arg_5:\n          arg_4 = [arg_7 if arg_5 is None else arg_5 for arg_5 in arg_4]\n          break\n    return arg_1[:tensorshape_util.rank(arg_1) - arg_3].concatenate(\n        arg_2(arg_1[tensorshape_util.rank(arg_1) - arg_3:],\n                             arg_4))", "path": "tensorflow_probability/python/bijectors/transpose.py", "identifier": "Transpose._event_shape", "docstring": "Helper for _forward and _inverse_event_shape.", "docstring_tokens": ["Helper", "for", "_forward", "and", "_inverse_event_shape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260706}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/exceptions.py#L10-L36", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Attaches a ``context`` value to an Exception.", "language": "python", "parameters": "(exc, context)", "return_statement": "return exc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'context'", ")", ":", "arg_0", ".", "context", "=", "{", "}", "arg_0", ".", "context", ".", "update", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    # type: (Exception, dict) -> Exception\n    \"\"\"\n    Attaches a ``context`` value to an Exception.\n\n    Before:\n\n    .. code-block:: python\n\n        exc = Exception('Frog blast the vent core!')\n        exc.context = { ... }\n        raise exc\n\n    After:\n\n    .. code-block:: python\n\n        raise Func(\n            exc=Exception('Frog blast the vent core!'),\n            context={ ... },\n        )\n    \"\"\"\n    if not hasattr(arg_0, 'context'):\n        arg_0.context = {}\n\n    arg_0.context.update(arg_1)\n    return arg_0", "path": "iota/exceptions.py", "identifier": "with_context", "docstring": "Attaches a ``context`` value to an Exception.\n\n    Before:\n\n    .. code-block:: python\n\n        exc = Exception('Frog blast the vent core!')\n        exc.context = { ... }\n        raise exc\n\n    After:\n\n    .. code-block:: python\n\n        raise with_context(\n            exc=Exception('Frog blast the vent core!'),\n            context={ ... },\n        )", "docstring_tokens": ["Attaches", "a", "context", "value", "to", "an", "Exception", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 260707}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/cli.py#L147-L202", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Common helper function for load simple objects.", "language": "python", "parameters": "(sources, load_task, asynchronous=True, predicate=None,\n               task_args=None, task_kwargs=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_4", "=", "tuple", "(", ")", "if", "arg_4", "is", "None", "else", "arg_4", "arg_5", "=", "dict", "(", ")", "if", "arg_5", "is", "None", "else", "arg_5", "click", ".", "echo", "(", "'Loading dumps started.'", ")", "for", "arg_6", ",", "arg_7", "in", "enumerate", "(", "arg_0", ",", "1", ")", ":", "click", ".", "echo", "(", "'Opening dump file {0} of {1} ({2})'", ".", "format", "(", "arg_6", ",", "len", "(", "arg_0", ")", ",", "arg_7", ".", "name", ")", ")", "arg_8", "=", "json", ".", "load", "(", "arg_7", ")", "with", "click", ".", "progressbar", "(", "arg_8", ")", "as", "data_bar", ":", "for", "arg_9", "in", "data_bar", ":", "if", "arg_3", "is", "not", "None", ":", "if", "arg_3", "(", "arg_9", ")", ":", "arg_1", ".", "s", "(", "arg_9", ",", "*", "arg_4", ",", "**", "arg_5", ")", ".", "apply", "(", "throw", "=", "True", ")", "click", ".", "echo", "(", "\"Loaded a single record.\"", ")", "return", "else", ":", "if", "arg_2", ":", "arg_1", ".", "s", "(", "arg_9", ",", "*", "arg_4", ",", "**", "arg_5", ")", ".", "apply_async", "(", ")", "else", ":", "arg_1", ".", "s", "(", "arg_9", ",", "*", "arg_4", ",", "**", "arg_5", ")", ".", "apply", "(", "throw", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=None,\n               arg_4=None, arg_5=None):\n    \"\"\"Common helper function for load simple objects.\n\n    .. note::\n\n      Keyword arguments ``task_args`` and ``task_kwargs`` are passed to the\n      ``load_task`` function as ``*task_args`` and ``**task_kwargs``.\n\n    .. note::\n\n      The `predicate` argument is used as a predicate function to load only\n      a *single* item from across all dumps (this CLI function will return\n      after loading the item). This is primarily used for debugging of\n      the *dirty* data within the dump. The `predicate` should be a function\n      with a signature ``f(dict) -> bool``, i.e. taking a single parameter\n      (an item from the dump) and return ``True`` if the item\n      should be loaded. See the ``loaddeposit`` for a concrete example.\n\n    :param sources: JSON source files with dumps\n    :type sources: list of str (filepaths)\n    :param load_task: Shared task which loads the dump.\n    :type load_task: function\n    :param asynchronous: Flag for serial or asynchronous execution of the task.\n    :type asynchronous: bool\n    :param predicate: Predicate for selecting only a single item from the dump.\n    :type predicate: function\n    :param task_args: positional arguments passed to the task.\n    :type task_args: tuple\n    :param task_kwargs: named arguments passed to the task.\n    :type task_kwargs: dict\n    \"\"\"\n    # resolve the defaults for task_args and task_kwargs\n    arg_4 = tuple() if arg_4 is None else arg_4\n    arg_5 = dict() if arg_5 is None else arg_5\n    click.echo('Loading dumps started.')\n    for arg_6, arg_7 in enumerate(arg_0, 1):\n        click.echo('Opening dump file {0} of {1} ({2})'.format(\n            arg_6, len(arg_0), arg_7.name))\n        arg_8 = json.load(arg_7)\n        with click.progressbar(arg_8) as data_bar:\n            for arg_9 in data_bar:\n                # Load a single item from the dump\n                if arg_3 is not None:\n                    if arg_3(arg_9):\n                        arg_1.s(arg_9, *arg_4, **arg_5).apply(\n                            throw=True)\n                        click.echo(\"Loaded a single record.\")\n                        return\n                # Load dumps normally\n                else:\n                    if arg_2:\n                        arg_1.s(arg_9, *arg_4, **arg_5).apply_async()\n                    else:\n                        arg_1.s(arg_9, *arg_4, **arg_5).apply(\n                            throw=True)", "path": "invenio_migrator/cli.py", "identifier": "loadcommon", "docstring": "Common helper function for load simple objects.\n\n    .. note::\n\n      Keyword arguments ``task_args`` and ``task_kwargs`` are passed to the\n      ``load_task`` function as ``*task_args`` and ``**task_kwargs``.\n\n    .. note::\n\n      The `predicate` argument is used as a predicate function to load only\n      a *single* item from across all dumps (this CLI function will return\n      after loading the item). This is primarily used for debugging of\n      the *dirty* data within the dump. The `predicate` should be a function\n      with a signature ``f(dict) -> bool``, i.e. taking a single parameter\n      (an item from the dump) and return ``True`` if the item\n      should be loaded. See the ``loaddeposit`` for a concrete example.\n\n    :param sources: JSON source files with dumps\n    :type sources: list of str (filepaths)\n    :param load_task: Shared task which loads the dump.\n    :type load_task: function\n    :param asynchronous: Flag for serial or asynchronous execution of the task.\n    :type asynchronous: bool\n    :param predicate: Predicate for selecting only a single item from the dump.\n    :type predicate: function\n    :param task_args: positional arguments passed to the task.\n    :type task_args: tuple\n    :param task_kwargs: named arguments passed to the task.\n    :type task_kwargs: dict", "docstring_tokens": ["Common", "helper", "function", "for", "load", "simple", "objects", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 260708}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1603-L1618", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Look through the jobs table and reactivate all that are already in the\n    running state by setting their _eng_allocate_new_workers fields to True;\n    used by Nupic Scheduler as part of its failure-recovery procedure.", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_1", "=", "'UPDATE %s SET _eng_cjm_conn_id=%%s, '", "'              _eng_allocate_new_workers=TRUE '", "'    WHERE status=%%s '", "%", "(", "arg_0", ".", "jobsTableName", ",", ")", "conn", ".", "cursor", ".", "execute", "(", "arg_1", ",", "[", "arg_0", ".", "_connectionID", ",", "arg_0", ".", "STATUS_RUNNING", "]", ")", "return"], "function": "def Func(arg_0):\n    \"\"\" Look through the jobs table and reactivate all that are already in the\n    running state by setting their _eng_allocate_new_workers fields to True;\n    used by Nupic Scheduler as part of its failure-recovery procedure.\n    \"\"\"\n\n    # Get a database connection and cursor\n    with ConnectionFactory.get() as conn:\n\n      arg_1 = 'UPDATE %s SET _eng_cjm_conn_id=%%s, ' \\\n              '              _eng_allocate_new_workers=TRUE ' \\\n              '    WHERE status=%%s ' \\\n              % (arg_0.jobsTableName,)\n      conn.cursor.execute(arg_1, [arg_0._connectionID, arg_0.STATUS_RUNNING])\n\n    return", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.jobReactivateRunningJobs", "docstring": "Look through the jobs table and reactivate all that are already in the\n    running state by setting their _eng_allocate_new_workers fields to True;\n    used by Nupic Scheduler as part of its failure-recovery procedure.", "docstring_tokens": ["Look", "through", "the", "jobs", "table", "and", "reactivate", "all", "that", "are", "already", "in", "the", "running", "state", "by", "setting", "their", "_eng_allocate_new_workers", "fields", "to", "True", ";", "used", "by", "Nupic", "Scheduler", "as", "part", "of", "its", "failure", "-", "recovery", "procedure", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260709}
{"url": "https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L88-L93", "sha": "148b700c5846d8fdafc562d4326587da5447223f", "docstring_summary": "Add a listener that is only called once.", "language": "python", "parameters": "(self, event, listener)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "emit", "(", "'new_listener'", ",", "arg_1", ",", "arg_2", ")", "arg_0", ".", "_Func", "[", "arg_1", "]", ".", "append", "(", "arg_2", ")", "arg_0", ".", "_check_limit", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add a listener that is only called Func.\"\"\"\n        arg_0.emit('new_listener', arg_1, arg_2)\n        arg_0._Func[arg_1].append(arg_2)\n        arg_0._check_limit(arg_1)\n        return arg_0", "path": "eventemitter/emitter.py", "identifier": "EventEmitter.once", "docstring": "Add a listener that is only called once.", "docstring_tokens": ["Add", "a", "listener", "that", "is", "only", "called", "once", "."], "nwo": "asyncdef/eventemitter", "score": 0.1832591465193378, "idx": 260710}
{"url": "https://github.com/hamelsmu/ktext/blob/221f09f5b1762705075fd1bd914881c0724d5e02/ktext/preprocess.py#L81-L92", "sha": "221f09f5b1762705075fd1bd914881c0724d5e02", "docstring_summary": "Generate a function that will clean and tokenize text.", "language": "python", "parameters": "(cleaner: Callable,\n                             tokenizer: Callable,\n                             append_indicators: bool,\n                             start_tok: str,\n                             end_tok: str)", "return_statement": "return process_text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_6", ",", "arg_7", ":", "arg_6", ")", ":", "def", "process_text", "(", "arg_8", ")", ":", "if", "arg_3", ":", "return", "[", "[", "arg_5", "]", "+", "arg_2", "(", "arg_0", "(", "arg_9", ")", ")", "+", "[", "arg_7", "]", "for", "arg_9", "in", "arg_8", "]", "return", "[", "arg_2", "(", "arg_0", "(", "arg_9", ")", ")", "for", "arg_9", "in", "arg_8", "]", "return", "process_text"], "function": "def Func(arg_0: arg_1,\n                             arg_2: arg_1,\n                             arg_3: arg_4,\n                             arg_5: arg_6,\n                             arg_7: arg_6):\n    \"\"\"Generate a function that will clean and tokenize text.\"\"\"\n    def process_text(arg_8):\n        if arg_3:\n            return [[arg_5] + arg_2(arg_0(arg_9)) + [arg_7] for arg_9 in arg_8]\n        return [arg_2(arg_0(arg_9)) for arg_9 in arg_8]\n\n    return process_text", "path": "ktext/preprocess.py", "identifier": "process_text_constructor", "docstring": "Generate a function that will clean and tokenize text.", "docstring_tokens": ["Generate", "a", "function", "that", "will", "clean", "and", "tokenize", "text", "."], "nwo": "hamelsmu/ktext", "score": 0.5862139051793661, "idx": 260711}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/batch.py#L71-L104", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Decorator that stores the result of the stored function in the\n        user's results cache until the batch completes. Keyword arguments are\n        not yet supported.", "language": "python", "parameters": "(cls, func)", "return_statement": "return f", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "@", "functools", ".", "wraps", "(", "arg_1", ")", "def", "f", "(", "*", "arg_2", ")", ":", "for", "arg_3", "in", "arg_2", ":", "if", "isinstance", "(", "arg_3", ",", "User", ")", ":", "user", "=", "arg_3", "break", "else", ":", "raise", "ValueError", "(", "\"One position argument must be a User\"", ")", "arg_4", "=", "(", "arg_1", ",", "tuple", "(", "arg_2", ")", ")", "arg_5", "=", "arg_0", ".", "get_cache", "(", "user", ")", "if", "arg_4", "not", "in", "arg_5", ":", "arg_5", "[", "arg_4", "]", "=", "arg_1", "(", "*", "arg_2", ")", "return", "arg_5", "[", "arg_4", "]", "return", "f"], "function": "def Func(arg_0, arg_1):\n        ''' Decorator that stores the result of the stored function in the\n        user's results cache until the batch completes. Keyword arguments are\n        not yet supported.\n\n        Arguments:\n            func (callable(*a)): The function whose results we want\n                to store. The positional arguments, ``a``, are used as cache\n                keys.\n\n        Returns:\n            callable(*a): The memosing version of ``func``.\n\n        '''\n\n        @functools.wraps(arg_1)\n        def f(*arg_2):\n\n            for arg_3 in arg_2:\n                if isinstance(arg_3, User):\n                    user = arg_3\n                    break\n            else:\n                raise ValueError(\"One position argument must be a User\")\n\n            arg_4 = (arg_1, tuple(arg_2))\n            arg_5 = arg_0.get_cache(user)\n\n            if arg_4 not in arg_5:\n                arg_5[arg_4] = arg_1(*arg_2)\n\n            return arg_5[arg_4]\n\n        return f", "path": "registrasion/controllers/batch.py", "identifier": "BatchController.memoise", "docstring": "Decorator that stores the result of the stored function in the\n        user's results cache until the batch completes. Keyword arguments are\n        not yet supported.\n\n        Arguments:\n            func (callable(*a)): The function whose results we want\n                to store. The positional arguments, ``a``, are used as cache\n                keys.\n\n        Returns:\n            callable(*a): The memosing version of ``func``.", "docstring_tokens": ["Decorator", "that", "stores", "the", "result", "of", "the", "stored", "function", "in", "the", "user", "s", "results", "cache", "until", "the", "batch", "completes", ".", "Keyword", "arguments", "are", "not", "yet", "supported", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 260712}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L410-L444", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Makes a striplog from a Petrel text file.", "language": "python", "parameters": "(cls, filename,\n                    stop=None,\n                    points=False,\n                    null=None,\n                    function=None,\n                    include=None,\n                    exclude=None,\n                    remap=None,\n                    ignore=None)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ")", ":", "arg_10", "=", "utils", ".", "read_petrel", "(", "arg_1", ",", "arg_5", "=", "arg_5", ",", "arg_8", "=", "arg_8", ",", ")", "arg_11", "=", "arg_0", ".", "_clean_longitudinal_data", "(", "arg_10", ",", "arg_4", "=", "arg_4", ")", "arg_12", "=", "arg_0", ".", "_build_list_of_Intervals", "(", "arg_11", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_9", "=", "arg_9", ")", "if", "arg_12", ":", "return", "arg_0", "(", "arg_12", ")", "return", "None"], "function": "def Func(arg_0, arg_1,\n                    arg_2=None,\n                    arg_3=False,\n                    arg_4=None,\n                    arg_5=None,\n                    arg_6=None,\n                    arg_7=None,\n                    arg_8=None,\n                    arg_9=None):\n\n        \"\"\"\n        Makes a striplog from a Petrel text file.\n\n        Returns:\n            striplog.\n        \"\"\"\n        arg_10 = utils.read_petrel(arg_1,\n                                   arg_5=arg_5,\n                                   arg_8=arg_8,\n                                   )\n\n        arg_11 = arg_0._clean_longitudinal_data(arg_10,\n                                            arg_4=arg_4\n                                            )\n\n        arg_12 = arg_0._build_list_of_Intervals(arg_11,\n                                                         arg_2=arg_2,\n                                                         arg_3=arg_3,\n                                                         arg_6=arg_6,\n                                                         arg_7=arg_7,\n                                                         arg_9=arg_9\n                                                         )\n        if arg_12:\n            return arg_0(arg_12)\n        return None", "path": "striplog/striplog.py", "identifier": "Striplog.from_petrel", "docstring": "Makes a striplog from a Petrel text file.\n\n        Returns:\n            striplog.", "docstring_tokens": ["Makes", "a", "striplog", "from", "a", "Petrel", "text", "file", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 260713}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L799-L812", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get the base application UIElement.", "language": "python", "parameters": "(self)", "return_statement": "return app", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", "while", "True", ":", "try", ":", "arg_1", "=", "arg_1", ".", "AXParent", "except", "_a11y", ".", "ErrorUnsupported", ":", "break", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Get the base application UIElement.\n\n        If the UIElement is a child of the application, it will try\n        to get the AXParent until it reaches the top application level\n        element.\n        \"\"\"\n        arg_1 = arg_0\n        while True:\n            try:\n                arg_1 = arg_1.AXParent\n            except _a11y.ErrorUnsupported:\n                break\n        return arg_1", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._getApplication", "docstring": "Get the base application UIElement.\n\n        If the UIElement is a child of the application, it will try\n        to get the AXParent until it reaches the top application level\n        element.", "docstring_tokens": ["Get", "the", "base", "application", "UIElement", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260714}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L632-L665", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Apply record checks on `r`.", "language": "python", "parameters": "(self, i, r,\n                                 summarize=False,\n                                 report_unexpected_exceptions=True,\n                                 context=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "_record_checks", ":", "if", "arg_1", "%", "arg_7", "==", "0", ":", "arg_8", "=", "arg_0", ".", "_as_dict", "(", "arg_2", ")", "try", ":", "arg_6", "(", "arg_8", ")", "except", "RecordError", "as", "e", ":", "arg_9", "=", "e", ".", "code", "if", "e", ".", "code", "is", "not", "None", "else", "RECORD_CHECK_FAILED", "arg_10", "=", "{", "'code'", ":", "arg_9", "}", "if", "not", "arg_3", ":", "arg_11", "=", "e", ".", "message", "if", "e", ".", "message", "is", "not", "None", "else", "MESSAGES", "[", "RECORD_CHECK_FAILED", "]", "arg_10", "[", "'message'", "]", "=", "arg_11", "arg_10", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_10", "[", "'record'", "]", "=", "arg_2", "if", "arg_5", "is", "not", "None", ":", "arg_10", "[", "'context'", "]", "=", "arg_5", "if", "e", ".", "details", "is", "not", "None", ":", "arg_10", "[", "'details'", "]", "=", "e", ".", "details", "yield", "arg_10", "except", "Exception", "as", "e", ":", "if", "arg_4", ":", "arg_10", "=", "{", "'code'", ":", "UNEXPECTED_EXCEPTION", "}", "if", "not", "arg_3", ":", "arg_10", "[", "'message'", "]", "=", "MESSAGES", "[", "UNEXPECTED_EXCEPTION", "]", "%", "(", "e", ".", "__class__", ".", "__name__", ",", "e", ")", "arg_10", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_10", "[", "'record'", "]", "=", "arg_2", "arg_10", "[", "'exception'", "]", "=", "e", "arg_10", "[", "'function'", "]", "=", "'%s: %s'", "%", "(", "arg_6", ".", "__name__", ",", "arg_6", ".", "__doc__", ")", "if", "arg_5", "is", "not", "None", ":", "arg_10", "[", "'context'", "]", "=", "arg_5", "yield", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2,\n                                 arg_3=False,\n                                 arg_4=True,\n                                 arg_5=None):\n        \"\"\"Apply record checks on `r`.\"\"\"\n\n        for arg_6, arg_7 in arg_0._record_checks:\n            if arg_1 % arg_7 == 0: # support sampling\n                arg_8 = arg_0._as_dict(arg_2)\n                try:\n                    arg_6(arg_8)\n                except RecordError as e:\n                    arg_9 = e.code if e.code is not None else RECORD_CHECK_FAILED\n                    arg_10 = {'code': arg_9}\n                    if not arg_3:\n                        arg_11 = e.message if e.message is not None else MESSAGES[RECORD_CHECK_FAILED]\n                        arg_10['message'] = arg_11\n                        arg_10['row'] = arg_1 + 1\n                        arg_10['record'] = arg_2\n                        if arg_5 is not None: arg_10['context'] = arg_5\n                        if e.details is not None: arg_10['details'] = e.details\n                    yield arg_10\n                except Exception as e:\n                    if arg_4:\n                        arg_10 = {'code': UNEXPECTED_EXCEPTION}\n                        if not arg_3:\n                            arg_10['message'] = MESSAGES[UNEXPECTED_EXCEPTION] % (e.__class__.__name__, e)\n                            arg_10['row'] = arg_1 + 1\n                            arg_10['record'] = arg_2\n                            arg_10['exception'] = e\n                            arg_10['function'] = '%s: %s' % (arg_6.__name__,\n                                                        arg_6.__doc__)\n                            if arg_5 is not None: arg_10['context'] = arg_5\n                        yield arg_10", "path": "csvvalidator.py", "identifier": "CSVValidator._apply_record_checks", "docstring": "Apply record checks on `r`.", "docstring_tokens": ["Apply", "record", "checks", "on", "r", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 260715}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1253-L1264", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Build a fold assignment column with the constraint that each fold has the same class\n        distribution as the fold column.", "language": "python", "parameters": "(self, n_folds=3, seed=-1)", "return_statement": "return H2OFrame._expr(\n            expr=ExprNode(\"stratified_kfold_column\", self, n_folds, seed))._frame()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "3", ",", "arg_2", "=", "-", "1", ")", ":", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"Func\"", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", ")", ".", "_frame", "(", ")"], "function": "def Func(arg_0, arg_1=3, arg_2=-1):\n        \"\"\"\n        Build a fold assignment column with the constraint that each fold has the same class\n        distribution as the fold column.\n\n        :param int n_folds: The number of folds to build.\n        :param int seed: A seed for the random number generator.\n\n        :returns: A single column H2OFrame with the fold assignments.\n        \"\"\"\n        return H2OFrame._expr(\n            expr=ExprNode(\"Func\", arg_0, arg_1, arg_2))._frame()", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.stratified_kfold_column", "docstring": "Build a fold assignment column with the constraint that each fold has the same class\n        distribution as the fold column.\n\n        :param int n_folds: The number of folds to build.\n        :param int seed: A seed for the random number generator.\n\n        :returns: A single column H2OFrame with the fold assignments.", "docstring_tokens": ["Build", "a", "fold", "assignment", "column", "with", "the", "constraint", "that", "each", "fold", "has", "the", "same", "class", "distribution", "as", "the", "fold", "column", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260716}
{"url": "https://github.com/praekeltfoundation/seed-control-interface/blob/32ddad88b5bc2f8f4d80b848361899da2e081636/ci/views.py#L168-L232", "sha": "32ddad88b5bc2f8f4d80b848361899da2e081636", "docstring_summary": "Displays the login form and handles the login action.", "language": "python", "parameters": "(request, template_name='ci/login.html',\n          redirect_field_name=REDIRECT_FIELD_NAME,\n          authentication_form=AuthenticationForm)", "return_statement": "return TemplateResponse(request, template_name, context)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'ci/Func.html'", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "POST", ".", "get", "(", "arg_2", ",", "arg_0", ".", "GET", ".", "get", "(", "arg_2", ",", "''", ")", ")", "if", "arg_0", ".", "method", "==", "\"POST\"", ":", "arg_7", "=", "arg_4", "(", "arg_0", ",", "data", "=", "arg_0", ".", "POST", ")", "if", "arg_7", ".", "is_valid", "(", ")", ":", "if", "not", "is_safe_url", "(", "url", "=", "arg_6", ",", "host", "=", "arg_0", ".", "get_host", "(", ")", ")", ":", "arg_6", "=", "resolve_url", "(", "settings", ".", "LOGIN_REDIRECT_URL", ")", "arg_8", "=", "arg_7", ".", "get_user", "(", ")", "arg_0", ".", "session", "[", "'user_token'", "]", "=", "arg_8", "[", "\"token\"", "]", "arg_0", ".", "session", "[", "'user_email'", "]", "=", "arg_8", "[", "\"email\"", "]", "arg_0", ".", "session", "[", "'user_permissions'", "]", "=", "arg_8", "[", "\"permissions\"", "]", "arg_0", ".", "session", "[", "'user_id'", "]", "=", "arg_8", "[", "\"id\"", "]", "arg_0", ".", "session", "[", "'user_list'", "]", "=", "arg_8", "[", "\"user_list\"", "]", "if", "not", "settings", ".", "HIDE_DASHBOARDS", ":", "arg_10", "=", "ciApi", ".", "get_user_dashboards", "(", "arg_8", "[", "\"id\"", "]", ")", "arg_11", "=", "list", "(", "arg_10", "[", "'results'", "]", ")", "if", "len", "(", "arg_11", ")", ">", "0", ":", "arg_0", ".", "session", "[", "'user_dashboards'", "]", "=", "arg_11", "[", "0", "]", "[", "\"dashboards\"", "]", "arg_0", ".", "session", "[", "'user_default_dashboard'", "]", "=", "arg_11", "[", "0", "]", "[", "\"default_dashboard\"", "]", "[", "\"id\"", "]", "else", ":", "arg_0", ".", "session", "[", "'user_dashboards'", "]", "=", "[", "]", "arg_0", ".", "session", "[", "'user_default_dashboard'", "]", "=", "None", "arg_12", "=", "ciApi", ".", "get_user_service_tokens", "(", "params", "=", "{", "\"user_id\"", ":", "arg_8", "[", "\"id\"", "]", "}", ")", "arg_13", "=", "list", "(", "arg_12", "[", "'results'", "]", ")", "arg_14", "=", "{", "}", "if", "len", "(", "arg_13", ")", ">", "0", ":", "for", "arg_15", "in", "arg_13", ":", "arg_14", "[", "arg_15", "[", "\"service\"", "]", "[", "\"name\"", "]", "]", "=", "{", "\"token\"", ":", "arg_15", "[", "\"token\"", "]", ",", "\"url\"", ":", "arg_15", "[", "\"service\"", "]", "[", "\"url\"", "]", "+", "\"/api/v1\"", "}", "arg_0", ".", "session", "[", "'user_tokens'", "]", "=", "arg_14", "return", "HttpResponseRedirect", "(", "arg_6", ")", "else", ":", "arg_7", "=", "arg_4", "(", "arg_0", ")", "arg_16", "=", "get_current_site", "(", "arg_0", ")", "arg_17", "=", "{", "'form'", ":", "arg_7", ",", "arg_2", ":", "arg_6", ",", "'site'", ":", "arg_16", ",", "'site_name'", ":", "arg_16", ".", "name", ",", "}", "return", "TemplateResponse", "(", "arg_0", ",", "arg_1", ",", "arg_17", ")"], "function": "def Func(arg_0, arg_1='ci/Func.html',\n          arg_2=arg_3,\n          arg_4=arg_5):\n    \"\"\"\n    Displays the Func form and handles the Func action.\n    \"\"\"\n    arg_6 = arg_0.POST.get(arg_2,\n                                   arg_0.GET.get(arg_2, ''))\n\n    if arg_0.method == \"POST\":\n        arg_7 = arg_4(arg_0, data=arg_0.POST)\n        if arg_7.is_valid():\n\n            # Ensure the user-originating redirection url is safe.\n            if not is_safe_url(url=arg_6, host=arg_0.get_host()):\n                arg_6 = resolve_url(settings.LOGIN_REDIRECT_URL)\n\n            # Okay, security check complete. Get the user object from auth api.\n            arg_8 = arg_7.get_user()\n            arg_0.session['user_token'] = arg_8[\"token\"]\n            arg_0.session['user_email'] = arg_8[\"email\"]\n            arg_0.session['user_permissions'] = arg_8[\"permissions\"]\n            arg_0.session['user_id'] = arg_8[\"id\"]\n            arg_0.session['user_list'] = arg_8[\"user_list\"]\n\n            if not settings.HIDE_DASHBOARDS:\n                # Set user dashboards because they are slow to change\n                arg_10 = ciApi.get_user_dashboards(arg_8[\"id\"])\n                arg_11 = list(arg_10['results'])\n                if len(arg_11) > 0:\n                    arg_0.session['user_dashboards'] = \\\n                        arg_11[0][\"dashboards\"]\n                    arg_0.session['user_default_dashboard'] = \\\n                        arg_11[0][\"default_dashboard\"][\"id\"]\n                else:\n                    arg_0.session['user_dashboards'] = []\n                    arg_0.session['user_default_dashboard'] = None\n\n            # Get the user access tokens too and format for easy access\n            arg_12 = ciApi.get_user_service_tokens(\n                params={\"user_id\": arg_8[\"id\"]})\n            arg_13 = list(arg_12['results'])\n            arg_14 = {}\n            if len(arg_13) > 0:\n                for arg_15 in arg_13:\n                    arg_14[arg_15[\"service\"][\"name\"]] = {\n                        \"token\": arg_15[\"token\"],\n                        \"url\": arg_15[\"service\"][\"url\"] + \"/api/v1\"\n                    }\n            arg_0.session['user_tokens'] = arg_14\n\n            return HttpResponseRedirect(arg_6)\n    else:\n        arg_7 = arg_4(arg_0)\n\n    arg_16 = get_current_site(arg_0)\n\n    arg_17 = {\n        'form': arg_7,\n        arg_2: arg_6,\n        'site': arg_16,\n        'site_name': arg_16.name,\n    }\n\n    return TemplateResponse(arg_0, arg_1, arg_17)", "path": "ci/views.py", "identifier": "login", "docstring": "Displays the login form and handles the login action.", "docstring_tokens": ["Displays", "the", "login", "form", "and", "handles", "the", "login", "action", "."], "nwo": "praekeltfoundation/seed-control-interface", "score": 0.09252797783733271, "idx": 260717}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py#L210-L237", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get historical usage metrics.", "language": "python", "parameters": "(self, webspace_name, website_name,\n                                     metrics = None, start_time=None, end_time=None, time_grain=None)", "return_statement": "return self._perform_get(self._get_historical_usage_metrics_path(webspace_name, website_name) + parameters,\n                                 MetricResponses)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_3", "=", "(", "'names='", "+", "','", ".", "join", "(", "arg_3", ")", ")", "if", "arg_3", "else", "''", "arg_4", "=", "(", "'StartTime='", "+", "arg_4", ")", "if", "arg_4", "else", "''", "arg_5", "=", "(", "'EndTime='", "+", "arg_5", ")", "if", "arg_5", "else", "''", "arg_6", "=", "(", "'TimeGrain='", "+", "arg_6", ")", "if", "arg_6", "else", "''", "arg_7", "=", "(", "'&'", ".", "join", "(", "v", "for", "v", "in", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "if", "v", ")", ")", "arg_7", "=", "'?'", "+", "arg_7", "if", "arg_7", "else", "''", "return", "arg_0", ".", "_perform_get", "(", "arg_0", ".", "_Func_path", "(", "arg_1", ",", "arg_2", ")", "+", "arg_7", ",", "MetricResponses", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                                     arg_3 = None, arg_4=None, arg_5=None, arg_6=None):\n        '''\n        Get historical usage metrics.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        metrics:\n            Optional. List of metrics name. Otherwise, all metrics returned.\n        start_time:\n            Optional. An ISO8601 date. Otherwise, current hour is used.\n        end_time:\n            Optional. An ISO8601 date. Otherwise, current time is used.\n        time_grain:\n            Optional. A rollup name, as P1D. OTherwise, default rollup for the metrics is used.\n        More information and metrics name at:\n        http://msdn.microsoft.com/en-us/library/azure/dn166964.aspx\n        '''        \n        arg_3 = ('names='+','.join(arg_3)) if arg_3 else ''\n        arg_4 = ('StartTime='+arg_4) if arg_4 else ''\n        arg_5 = ('EndTime='+arg_5) if arg_5 else ''\n        arg_6 = ('TimeGrain='+arg_6) if arg_6 else ''\n        arg_7 = ('&'.join(v for v in (arg_3, arg_4, arg_5, arg_6) if v))\n        arg_7 = '?'+arg_7 if arg_7 else ''\n        return arg_0._perform_get(arg_0._Func_path(arg_1, arg_2) + arg_7,\n                                 MetricResponses)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py", "identifier": "WebsiteManagementService.get_historical_usage_metrics", "docstring": "Get historical usage metrics.\n\n        webspace_name:\n            The name of the webspace.\n        website_name:\n            The name of the website.\n        metrics:\n            Optional. List of metrics name. Otherwise, all metrics returned.\n        start_time:\n            Optional. An ISO8601 date. Otherwise, current hour is used.\n        end_time:\n            Optional. An ISO8601 date. Otherwise, current time is used.\n        time_grain:\n            Optional. A rollup name, as P1D. OTherwise, default rollup for the metrics is used.\n        More information and metrics name at:\n        http://msdn.microsoft.com/en-us/library/azure/dn166964.aspx", "docstring_tokens": ["Get", "historical", "usage", "metrics", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260718}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/graph/graph_generation.py#L160-L214", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Creates a connected graph with random vertex locations.", "language": "python", "parameters": "(num_vertices, seed=None, **kwargs)", "return_statement": "return g", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "if", "isinstance", "(", "arg_1", ",", "numbers", ".", "Integral", ")", ":", "np", ".", "random", ".", "seed", "(", "arg_1", ")", "arg_3", "=", "np", ".", "random", ".", "random", "(", "(", "arg_0", ",", "2", ")", ")", "*", "10", "arg_4", "=", "[", "]", "for", "arg_5", "in", "range", "(", "arg_0", "-", "1", ")", ":", "for", "arg_6", "in", "range", "(", "arg_5", "+", "1", ",", "arg_0", ")", ":", "arg_7", "=", "arg_3", "[", "arg_5", "]", "-", "arg_3", "[", "arg_6", "]", "arg_4", ".", "append", "(", "(", "arg_5", ",", "arg_6", ",", "arg_7", "[", "0", "]", "**", "2", "+", "arg_7", "[", "1", "]", "**", "2", ")", ")", "arg_8", "=", "[", "(", "'n1'", ",", "int", ")", ",", "(", "'n2'", ",", "int", ")", ",", "(", "'distance'", ",", "np", ".", "float", ")", "]", "arg_4", "=", "np", ".", "array", "(", "arg_4", ",", "dtype", "=", "arg_8", ")", "arg_4", "=", "np", ".", "sort", "(", "arg_4", ",", "order", "=", "'distance'", ")", "arg_9", "=", "UnionFind", "(", "[", "arg_5", "for", "arg_5", "in", "range", "(", "arg_0", ")", "]", ")", "arg_10", "=", "nx", ".", "Graph", "(", ")", "for", "arg_11", ",", "arg_12", ",", "arg_13", "in", "arg_4", ":", "arg_9", ".", "union", "(", "arg_11", ",", "arg_12", ")", "arg_10", ".", "add_edge", "(", "arg_11", ",", "arg_12", ")", "if", "arg_9", ".", "nClusters", "==", "1", ":", "break", "arg_14", "=", "{", "arg_6", ":", "p", "for", "arg_6", ",", "p", "in", "enumerate", "(", "arg_3", ")", "}", "arg_10", "=", "QueueNetworkDiGraph", "(", "arg_10", ".", "to_directed", "(", ")", ")", "arg_10", ".", "set_pos", "(", "arg_14", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"Creates a connected graph with random vertex locations.\n\n    Parameters\n    ----------\n    num_vertices : int\n        The number of vertices in the graph.\n    seed : int (optional)\n        An integer used to initialize numpy's psuedorandom number\n        generators.\n    **kwargs :\n        Unused.\n\n    Returns\n    -------\n    :class:`.QueueNetworkDiGraph`\n        A graph with a ``pos`` vertex property for each vertex's\n        position.\n\n    Notes\n    -----\n    This function first places ``num_vertices`` points in the unit square\n    randomly (using the uniform distribution). Then, for every vertex\n    ``v``, all other vertices with Euclidean distance less or equal to\n    ``r`` are connect by an edge --- where ``r`` is the smallest number\n    such that the graph ends up connected.\n    \"\"\"\n    if isinstance(arg_1, numbers.Integral):\n        np.random.seed(arg_1)\n\n    arg_3 = np.random.random((arg_0, 2)) * 10\n    arg_4 = []\n\n    for arg_5 in range(arg_0 - 1):\n        for arg_6 in range(arg_5 + 1, arg_0):\n            arg_7 = arg_3[arg_5] - arg_3[arg_6]\n            arg_4.append((arg_5, arg_6, arg_7[0]**2 + arg_7[1]**2))\n\n    arg_8 = [('n1', int), ('n2', int), ('distance', np.float)]\n    arg_4 = np.array(arg_4, dtype=arg_8)\n    arg_4 = np.sort(arg_4, order='distance')\n    arg_9 = UnionFind([arg_5 for arg_5 in range(arg_0)])\n\n    arg_10 = nx.Graph()\n\n    for arg_11, arg_12, arg_13 in arg_4:\n        arg_9.union(arg_11, arg_12)\n        arg_10.add_edge(arg_11, arg_12)\n        if arg_9.nClusters == 1:\n            break\n\n    arg_14 = {arg_6: p for arg_6, p in enumerate(arg_3)}\n    arg_10 = QueueNetworkDiGraph(arg_10.to_directed())\n    arg_10.set_pos(arg_14)\n    return arg_10", "path": "queueing_tool/graph/graph_generation.py", "identifier": "minimal_random_graph", "docstring": "Creates a connected graph with random vertex locations.\n\n    Parameters\n    ----------\n    num_vertices : int\n        The number of vertices in the graph.\n    seed : int (optional)\n        An integer used to initialize numpy's psuedorandom number\n        generators.\n    **kwargs :\n        Unused.\n\n    Returns\n    -------\n    :class:`.QueueNetworkDiGraph`\n        A graph with a ``pos`` vertex property for each vertex's\n        position.\n\n    Notes\n    -----\n    This function first places ``num_vertices`` points in the unit square\n    randomly (using the uniform distribution). Then, for every vertex\n    ``v``, all other vertices with Euclidean distance less or equal to\n    ``r`` are connect by an edge --- where ``r`` is the smallest number\n    such that the graph ends up connected.", "docstring_tokens": ["Creates", "a", "connected", "graph", "with", "random", "vertex", "locations", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 260719}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/_vendor/nvd3/NVD3Chart.py#L407-L417", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "generate javascript code for the chart", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "jschart", "=", "''", "if", "arg_0", ".", "tooltip_condition_string", "==", "''", ":", "arg_0", ".", "tooltip_condition_string", "=", "'var y = String(graph.point.y);\\n'", "arg_0", ".", "series_js", "=", "json", ".", "dumps", "(", "arg_0", ".", "series", ")"], "function": "def Func(arg_0):\n        \"\"\"generate javascript code for the chart\"\"\"\n        arg_0.jschart = ''\n\n        # add custom tooltip string in jschart\n        # default condition (if build_custom_tooltip is not called explicitly with date_flag=True)\n        if arg_0.tooltip_condition_string == '':\n            arg_0.tooltip_condition_string = 'var y = String(graph.point.y);\\n'\n\n        # Include data\n        arg_0.series_js = json.dumps(arg_0.series)", "path": "airflow/_vendor/nvd3/NVD3Chart.py", "identifier": "NVD3Chart.buildjschart", "docstring": "generate javascript code for the chart", "docstring_tokens": ["generate", "javascript", "code", "for", "the", "chart"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260720}
{"url": "https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/templatetags/sitetree.py#L12-L35", "sha": "61de4608e6e415247c75fe8691027d7c4ed0d1e7", "docstring_summary": "Parses sitetree tag parameters.", "language": "python", "parameters": "(parser, token)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split_contents", "(", ")", "arg_3", "=", "detect_clause", "(", "arg_0", ",", "'template'", ",", "arg_2", ")", "arg_4", "=", "len", "(", "arg_2", ")", "if", "arg_4", "in", "(", "3", ",", "5", ")", ":", "arg_5", "=", "arg_0", ".", "compile_filter", "(", "arg_2", "[", "2", "]", ")", "return", "FuncNode", "(", "arg_5", ",", "arg_3", ")", "else", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "'%r tag requires two arguments. E.g. {%% Func from \"mytree\" %%}.'", "%", "arg_2", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Parses sitetree tag parameters.\n\n    Two notation types are possible:\n        1. Two arguments:\n           {% Func from \"mytree\" %}\n           Used to render tree for \"mytree\" site tree.\n\n        2. Four arguments:\n           {% Func from \"mytree\" template \"sitetree/mytree.html\" %}\n           Used to render tree for \"mytree\" site tree using specific\n           template \"sitetree/mytree.html\"\n\n    \"\"\"\n    arg_2 = arg_1.split_contents()\n    arg_3 = detect_clause(arg_0, 'template', arg_2)\n    arg_4 = len(arg_2)\n\n    if arg_4 in (3, 5):\n        arg_5 = arg_0.compile_filter(arg_2[2])\n        return FuncNode(arg_5, arg_3)\n    else:\n        raise template.TemplateSyntaxError(\n            '%r tag requires two arguments. E.g. {%% Func from \"mytree\" %%}.' % arg_2[0])", "path": "sitetree/templatetags/sitetree.py", "identifier": "sitetree_tree", "docstring": "Parses sitetree tag parameters.\n\n    Two notation types are possible:\n        1. Two arguments:\n           {% sitetree_tree from \"mytree\" %}\n           Used to render tree for \"mytree\" site tree.\n\n        2. Four arguments:\n           {% sitetree_tree from \"mytree\" template \"sitetree/mytree.html\" %}\n           Used to render tree for \"mytree\" site tree using specific\n           template \"sitetree/mytree.html\"", "docstring_tokens": ["Parses", "sitetree", "tag", "parameters", "."], "nwo": "idlesign/django-sitetree", "score": 0.7223520669761895, "idx": 260721}
{"url": "https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/model.py#L236-L243", "sha": "0180da34d052c44fb94dab9e115e218bbebfc9c3", "docstring_summary": "Retrieve an object by a dotted name relative to the model.", "language": "python", "parameters": "(self, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", ".", "split", "(", "\".\"", ")", "arg_3", "=", "arg_0", ".", "spaces", "[", "arg_2", ".", "pop", "(", "0", ")", "]", "if", "arg_2", ":", "return", "arg_3", ".", "Func", "(", "\".\"", ".", "join", "(", "arg_2", ")", ")", "else", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Retrieve an object by a dotted name relative to the model.\"\"\"\n        arg_2 = arg_1.split(\".\")\n        arg_3 = arg_0.spaces[arg_2.pop(0)]\n        if arg_2:\n            return arg_3.Func(\".\".join(arg_2))\n        else:\n            return arg_3", "path": "modelx/core/model.py", "identifier": "ModelImpl.get_object", "docstring": "Retrieve an object by a dotted name relative to the model.", "docstring_tokens": ["Retrieve", "an", "object", "by", "a", "dotted", "name", "relative", "to", "the", "model", "."], "nwo": "fumitoh/modelx", "score": 0.28445842098515983, "idx": 260722}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/utils.py#L89-L108", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Get all Bio2BEL modules.", "language": "python", "parameters": "()", "return_statement": "return modules", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", "->", "Mapping", ":", "arg_0", "=", "{", "}", "for", "arg_1", "in", "iter_entry_points", "(", "group", "=", "'bio2bel'", ",", "name", "=", "None", ")", ":", "arg_2", "=", "arg_1", ".", "name", "try", ":", "arg_0", "[", "arg_2", "]", "=", "arg_1", ".", "load", "(", ")", "except", "VersionConflict", "as", "exc", ":", "log", ".", "warning", "(", "'Version conflict in %s: %s'", ",", "arg_2", ",", "exc", ")", "continue", "except", "UnknownExtra", "as", "exc", ":", "log", ".", "warning", "(", "'Unknown extra in %s: %s'", ",", "arg_2", ",", "exc", ")", "continue", "except", "ImportError", "as", "exc", ":", "log", ".", "exception", "(", "'Issue with importing module %s: %s'", ",", "arg_2", ",", "exc", ")", "continue", "return", "arg_0"], "function": "def Func() -> Mapping:\n    \"\"\"Get all Bio2BEL modules.\"\"\"\n    arg_0 = {}\n\n    for arg_1 in iter_entry_points(group='bio2bel', name=None):\n        arg_2 = arg_1.name\n\n        try:\n            arg_0[arg_2] = arg_1.load()\n        except VersionConflict as exc:\n            log.warning('Version conflict in %s: %s', arg_2, exc)\n            continue\n        except UnknownExtra as exc:\n            log.warning('Unknown extra in %s: %s', arg_2, exc)\n            continue\n        except ImportError as exc:\n            log.exception('Issue with importing module %s: %s', arg_2, exc)\n            continue\n\n    return arg_0", "path": "src/bio2bel/utils.py", "identifier": "get_modules", "docstring": "Get all Bio2BEL modules.", "docstring_tokens": ["Get", "all", "Bio2BEL", "modules", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 260723}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_arithmetic.py#L150-L202", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Encode a text using arithmetic coding.", "language": "python", "parameters": "(self, text)", "return_statement": "return avg.numerator // avg.denominator, nbits", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "text_type", "(", "arg_1", ")", "if", "'\\x00'", "in", "arg_1", ":", "arg_1", "=", "arg_1", ".", "replace", "(", "'\\x00'", ",", "' '", ")", "arg_2", "=", "Fraction", "(", "0", ")", "arg_3", "=", "Fraction", "(", "1", ")", "for", "arg_4", "in", "arg_1", "+", "'\\x00'", ":", "arg_5", "=", "arg_0", ".", "_probs", "[", "arg_4", "]", "arg_6", "=", "arg_3", "-", "arg_2", "arg_3", "=", "arg_2", "+", "arg_5", "[", "1", "]", "*", "arg_6", "arg_2", "=", "arg_2", "+", "arg_5", "[", "0", "]", "*", "arg_6", "arg_6", "=", "(", "arg_3", "-", "arg_2", ")", "/", "2", "arg_7", "=", "long", "(", "0", ")", "while", "arg_6", "<", "1", ":", "arg_7", "+=", "1", "arg_6", "*=", "2", "if", "arg_7", "==", "0", ":", "return", "0", ",", "0", "arg_8", "=", "(", "arg_3", "+", "arg_2", ")", "*", "2", "**", "(", "arg_7", "-", "1", ")", "return", "arg_8", ".", "numerator", "//", "arg_8", ".", "denominator", ",", "arg_7"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Encode a text using arithmetic coding.\n\n        Text and the 0-order probability statistics -> longval, nbits\n\n        The Funcd number is Fraction(longval, 2**nbits)\n\n        Parameters\n        ----------\n        text : str\n            A string to Func\n\n        Returns\n        -------\n        tuple\n            The arithmetically coded text\n\n        Example\n        -------\n        >>> ac = Arithmetic('the quick brown fox jumped over the lazy dog')\n        >>> ac.Func('align')\n        (16720586181, 34)\n\n        \"\"\"\n        arg_1 = text_type(arg_1)\n        if '\\x00' in arg_1:\n            arg_1 = arg_1.replace('\\x00', ' ')\n        arg_2 = Fraction(0)\n        arg_3 = Fraction(1)\n\n        for arg_4 in arg_1 + '\\x00':\n            arg_5 = arg_0._probs[arg_4]\n            arg_6 = arg_3 - arg_2\n            arg_3 = arg_2 + arg_5[1] * arg_6\n            arg_2 = arg_2 + arg_5[0] * arg_6\n\n        # I tried without the /2 just to check.  Doesn't work.\n        # Keep scaling up until the error range is >= 1.  That\n        # gives me the minimum number of bits needed to resolve\n        # down to the end-of-data character.\n        arg_6 = (arg_3 - arg_2) / 2\n        arg_7 = long(0)\n        while arg_6 < 1:\n            arg_7 += 1\n            arg_6 *= 2\n        # The below condition shouldn't ever be false\n        if arg_7 == 0:  # pragma: no cover\n            return 0, 0\n        # using -1 instead of /2\n        arg_8 = (arg_3 + arg_2) * 2 ** (arg_7 - 1)\n        # Could return a rational instead ...\n        # the division truncation is deliberate\n        return arg_8.numerator // arg_8.denominator, arg_7", "path": "abydos/compression/_arithmetic.py", "identifier": "Arithmetic.encode", "docstring": "Encode a text using arithmetic coding.\n\n        Text and the 0-order probability statistics -> longval, nbits\n\n        The encoded number is Fraction(longval, 2**nbits)\n\n        Parameters\n        ----------\n        text : str\n            A string to encode\n\n        Returns\n        -------\n        tuple\n            The arithmetically coded text\n\n        Example\n        -------\n        >>> ac = Arithmetic('the quick brown fox jumped over the lazy dog')\n        >>> ac.encode('align')\n        (16720586181, 34)", "docstring_tokens": ["Encode", "a", "text", "using", "arithmetic", "coding", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 260724}
{"url": "https://github.com/nicfit/nicfit.py/blob/8313f8edbc5e7361ddad496d6d818324b5236c7a/nicfit/util.py#L28-L66", "sha": "8313f8edbc5e7361ddad496d6d818324b5236c7a", "docstring_summary": "Modified from shutil.copytree docs code sample, merges files rather than\n    requiring dst to not exist.", "language": "python", "parameters": "(src, dst, symlinks=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "from", "shutil", "import", "copy2", ",", "Error", ",", "copystat", "arg_3", "=", "os", ".", "listdir", "(", "arg_0", ")", "if", "not", "Path", "(", "arg_1", ")", ".", "exists", "(", ")", ":", "os", ".", "makedirs", "(", "arg_1", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "arg_6", "=", "os", ".", "path", ".", "join", "(", "arg_0", ",", "arg_5", ")", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_5", ")", "try", ":", "if", "arg_2", "and", "os", ".", "path", ".", "islink", "(", "arg_6", ")", ":", "arg_8", "=", "os", ".", "readlink", "(", "arg_6", ")", "os", ".", "symlink", "(", "arg_8", ",", "arg_7", ")", "elif", "os", ".", "path", ".", "isdir", "(", "arg_6", ")", ":", "Func", "(", "arg_6", ",", "arg_7", ",", "arg_2", ")", "else", ":", "copy2", "(", "arg_6", ",", "arg_7", ")", "except", "OSError", "as", "why", ":", "arg_4", ".", "append", "(", "(", "arg_6", ",", "arg_7", ",", "str", "(", "why", ")", ")", ")", "except", "Error", "as", "err", ":", "arg_4", ".", "extend", "(", "err", ".", "args", "[", "0", "]", ")", "try", ":", "copystat", "(", "arg_0", ",", "arg_1", ")", "except", "OSError", "as", "why", ":", "if", "why", ".", "winerror", "is", "None", ":", "arg_4", ".", "extend", "(", "(", "arg_0", ",", "arg_1", ",", "str", "(", "why", ")", ")", ")", "if", "arg_4", ":", "raise", "Error", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Modified from shutil.Func docs code sample, merges files rather than\n    requiring dst to not exist.\n    \"\"\"\n    from shutil import copy2, Error, copystat\n\n    arg_3 = os.listdir(arg_0)\n\n    if not Path(arg_1).exists():\n        os.makedirs(arg_1)\n\n    arg_4 = []\n    for arg_5 in arg_3:\n        arg_6 = os.path.join(arg_0, arg_5)\n        arg_7 = os.path.join(arg_1, arg_5)\n        try:\n            if arg_2 and os.path.islink(arg_6):\n                arg_8 = os.readlink(arg_6)\n                os.symlink(arg_8, arg_7)\n            elif os.path.isdir(arg_6):\n                Func(arg_6, arg_7, arg_2)\n            else:\n                copy2(arg_6, arg_7)\n            # XXX What about devices, sockets etc.?\n        except OSError as why:\n            arg_4.append((arg_6, arg_7, str(why)))\n        # catch the Error from the recursive Func so that we can\n        # continue with other files\n        except Error as err:\n            arg_4.extend(err.args[0])\n    try:\n        copystat(arg_0, arg_1)\n    except OSError as why:\n        # can't copy file access times on Windows\n        if why.winerror is None:\n            arg_4.extend((arg_0, arg_1, str(why)))\n    if arg_4:\n        raise Error(arg_4)", "path": "nicfit/util.py", "identifier": "copytree", "docstring": "Modified from shutil.copytree docs code sample, merges files rather than\n    requiring dst to not exist.", "docstring_tokens": ["Modified", "from", "shutil", ".", "copytree", "docs", "code", "sample", "merges", "files", "rather", "than", "requiring", "dst", "to", "not", "exist", "."], "nwo": "nicfit/nicfit.py", "score": 0.09252797783733271, "idx": 260725}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/ops.py#L41-L51", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Create a flattened schedule.", "language": "python", "parameters": "(schedule: ScheduleComponent, name: str = None)", "return_statement": "return Schedule(*schedule.instructions, name=name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "None", ")", "->", "Schedule", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "name", "return", "Schedule", "(", "*", "arg_0", ".", "instructions", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = None) -> Schedule:\n    \"\"\"Create a Funced schedule.\n\n    Args:\n        schedule: Schedules to Func\n        name: Name of the new schedule. Defaults to first element of `schedules`\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = arg_0.name\n\n    return Schedule(*arg_0.instructions, arg_2=arg_2)", "path": "qiskit/pulse/ops.py", "identifier": "flatten", "docstring": "Create a flattened schedule.\n\n    Args:\n        schedule: Schedules to flatten\n        name: Name of the new schedule. Defaults to first element of `schedules`", "docstring_tokens": ["Create", "a", "flattened", "schedule", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260726}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/prebuild.py#L46-L61", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "get the C_C in which pe_pe is defined", "language": "python", "parameters": "(pe_pe)", "return_statement": "return xtuml.navigate_one(pe_pe).C_C[8003]()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "None", ":", "return", "None", "if", "arg_0", ".", "__class__", ".", "__name__", "!=", "'PE_PE'", ":", "arg_0", "=", "xtuml", ".", "navigate_one", "(", "arg_0", ")", ".", "PE_PE", "[", "8001", "]", "(", ")", "arg_1", "=", "xtuml", ".", "navigate_one", "(", "arg_0", ")", ".", "EP_PKG", "[", "8000", "]", "(", ")", "if", "arg_1", ":", "return", "Func", "(", "arg_1", ")", "return", "xtuml", ".", "navigate_one", "(", "arg_0", ")", ".", "C_C", "[", "8003", "]", "(", ")"], "function": "def Func(arg_0):\n    '''\n    get the C_C in which pe_pe is defined\n    '''\n    if arg_0 is None:\n        return None\n    \n    if arg_0.__class__.__name__ != 'PE_PE':\n        arg_0 = xtuml.navigate_one(arg_0).PE_PE[8001]()\n    \n    \n    arg_1 = xtuml.navigate_one(arg_0).EP_PKG[8000]()\n    if arg_1:\n        return Func(arg_1)\n    \n    return xtuml.navigate_one(arg_0).C_C[8003]()", "path": "bridgepoint/prebuild.py", "identifier": "get_defining_component", "docstring": "get the C_C in which pe_pe is defined", "docstring_tokens": ["get", "the", "C_C", "in", "which", "pe_pe", "is", "defined"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 260727}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/config.py#L237-L267", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Produces a TidyPy configuration that incorporates the configuration files\n    stored in the current user's home directory.", "language": "python", "parameters": "(project_path, use_cache=True)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "arg_2", "=", "os", ".", "path", ".", "expanduser", "(", "r'~\\\\tidypy'", ")", "else", ":", "arg_2", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getenv", "(", "'XDG_CONFIG_HOME'", ")", "or", "os", ".", "path", ".", "expanduser", "(", "'~/.config'", ")", ",", "'tidypy'", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_2", ")", ":", "with", "open", "(", "arg_2", ",", "'r'", ")", "as", "config_file", ":", "arg_3", "=", "pytoml", ".", "load", "(", "config_file", ")", ".", "get", "(", "'tidypy'", ",", "{", "}", ")", "arg_3", "=", "merge_dict", "(", "get_default_config", "(", ")", ",", "arg_3", ")", "arg_3", "=", "process_extensions", "(", "arg_3", ",", "arg_0", ",", "arg_1", "=", "arg_1", ")", "return", "arg_3", "return", "None"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"\n    Produces a TidyPy configuration that incorporates the configuration files\n    stored in the current user's home directory.\n\n    :param project_path: the path to the project that is going to be analyzed\n    :type project_path: str\n    :param use_cache:\n        whether or not to use cached versions of any remote/referenced TidyPy\n        configurations. If not specified, defaults to ``True``.\n    :type use_cache: bool\n    :rtype: dict\n    \"\"\"\n\n    if sys.platform == 'win32':\n        arg_2 = os.path.expanduser(r'~\\\\tidypy')\n    else:\n        arg_2 = os.path.join(\n            os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'),\n            'tidypy'\n        )\n\n    if os.path.exists(arg_2):\n        with open(arg_2, 'r') as config_file:\n            arg_3 = pytoml.load(config_file).get('tidypy', {})\n\n        arg_3 = merge_dict(get_default_config(), arg_3)\n        arg_3 = process_extensions(arg_3, arg_0, arg_1=arg_1)\n        return arg_3\n\n    return None", "path": "src/tidypy/config.py", "identifier": "get_user_config", "docstring": "Produces a TidyPy configuration that incorporates the configuration files\n    stored in the current user's home directory.\n\n    :param project_path: the path to the project that is going to be analyzed\n    :type project_path: str\n    :param use_cache:\n        whether or not to use cached versions of any remote/referenced TidyPy\n        configurations. If not specified, defaults to ``True``.\n    :type use_cache: bool\n    :rtype: dict", "docstring_tokens": ["Produces", "a", "TidyPy", "configuration", "that", "incorporates", "the", "configuration", "files", "stored", "in", "the", "current", "user", "s", "home", "directory", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 260728}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L106-L121", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "This function returns a list of Image object.", "language": "python", "parameters": "(self, private=False, type=None)", "return_statement": "return images", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "{", "}", "if", "arg_1", ":", "arg_3", "[", "'private'", "]", "=", "'true'", "if", "arg_2", ":", "arg_3", "[", "'type'", "]", "=", "arg_2", "arg_4", "=", "arg_0", ".", "get_data", "(", "\"images/\"", ",", "arg_3", "=", "arg_3", ")", "arg_5", "=", "list", "(", ")", "for", "arg_6", "in", "arg_4", "[", "'images'", "]", ":", "arg_7", "=", "Image", "(", "**", "arg_6", ")", "arg_7", ".", "token", "=", "arg_0", ".", "token", "arg_5", ".", "append", "(", "arg_7", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n        \"\"\"\n            This function returns a list of Image object.\n        \"\"\"\n        arg_3 = {}\n        if arg_1:\n            arg_3['private'] = 'true'\n        if arg_2:\n            arg_3['type'] = arg_2\n        arg_4 = arg_0.get_data(\"images/\", arg_3=arg_3)\n        arg_5 = list()\n        for arg_6 in arg_4['images']:\n            arg_7 = Image(**arg_6)\n            arg_7.token = arg_0.token\n            arg_5.append(arg_7)\n        return arg_5", "path": "digitalocean/Manager.py", "identifier": "Manager.get_images", "docstring": "This function returns a list of Image object.", "docstring_tokens": ["This", "function", "returns", "a", "list", "of", "Image", "object", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 260729}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L2581-L2631", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Check if current position is inside template argument list.", "language": "python", "parameters": "(self, clean_lines, linenum, pos)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "while", "arg_2", "<", "arg_1", ".", "NumLines", "(", ")", ":", "arg_4", "=", "arg_1", ".", "elided", "[", "arg_2", "]", "arg_5", "=", "Match", "(", "r'^[^{};=\\[\\]\\.<>]*(.)'", ",", "arg_4", "[", "arg_3", ":", "]", ")", "if", "not", "arg_5", ":", "arg_2", "+=", "1", "arg_3", "=", "0", "continue", "arg_6", "=", "arg_5", ".", "group", "(", "1", ")", "arg_3", "+=", "len", "(", "arg_5", ".", "group", "(", "0", ")", ")", "if", "arg_6", "in", "(", "'{'", ",", "'}'", ",", "';'", ")", ":", "return", "False", "if", "arg_6", "in", "(", "'>'", ",", "'='", ",", "'['", ",", "']'", ",", "'.'", ")", ":", "return", "True", "if", "arg_6", "!=", "'<'", ":", "arg_3", "+=", "1", "if", "arg_3", ">=", "len", "(", "arg_4", ")", ":", "arg_2", "+=", "1", "arg_3", "=", "0", "continue", "(", "arg_7", ",", "arg_8", ",", "arg_9", ")", "=", "CloseExpression", "(", "arg_1", ",", "arg_2", ",", "arg_3", "-", "1", ")", "if", "arg_9", "<", "0", ":", "return", "False", "arg_2", "=", "arg_8", "arg_3", "=", "arg_9", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Check if current position is inside template argument list.\n\n    Args:\n      clean_lines: A CleansedLines instance containing the file.\n      linenum: The number of the line to check.\n      pos: position just after the suspected template argument.\n    Returns:\n      True if (linenum, pos) is inside template arguments.\n    \"\"\"\n    while arg_2 < arg_1.NumLines():\n      # Find the earliest character that might indicate a template argument\n      arg_4 = arg_1.elided[arg_2]\n      arg_5 = Match(r'^[^{};=\\[\\]\\.<>]*(.)', arg_4[arg_3:])\n      if not arg_5:\n        arg_2 += 1\n        arg_3 = 0\n        continue\n      arg_6 = arg_5.group(1)\n      arg_3 += len(arg_5.group(0))\n\n      # These things do not look like template argument list:\n      #   class Suspect {\n      #   class Suspect x; }\n      if arg_6 in ('{', '}', ';'): return False\n\n      # These things look like template argument list:\n      #   template <class Suspect>\n      #   template <class Suspect = default_value>\n      #   template <class Suspect[]>\n      #   template <class Suspect...>\n      if arg_6 in ('>', '=', '[', ']', '.'): return True\n\n      # Check if token is an unmatched '<'.\n      # If not, move on to the next character.\n      if arg_6 != '<':\n        arg_3 += 1\n        if arg_3 >= len(arg_4):\n          arg_2 += 1\n          arg_3 = 0\n        continue\n\n      # We can't be sure if we just find a single '<', and need to\n      # find the matching '>'.\n      (arg_7, arg_8, arg_9) = CloseExpression(arg_1, arg_2, arg_3 - 1)\n      if arg_9 < 0:\n        # Not sure if template argument list or syntax error in file\n        return False\n      arg_2 = arg_8\n      arg_3 = arg_9\n    return False", "path": "third_party/python/cpplint/cpplint.py", "identifier": "NestingState.InTemplateArgumentList", "docstring": "Check if current position is inside template argument list.\n\n    Args:\n      clean_lines: A CleansedLines instance containing the file.\n      linenum: The number of the line to check.\n      pos: position just after the suspected template argument.\n    Returns:\n      True if (linenum, pos) is inside template arguments.", "docstring_tokens": ["Check", "if", "current", "position", "is", "inside", "template", "argument", "list", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260730}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/cart.py#L406-L435", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "This attempts to fix the easy errors raised by ValidationError.\n        This includes removing items from the cart that are no longer\n        available, recalculating all of the discounts, and removing voucher\n        codes that are no longer available.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "arg_0", ".", "cart", ".", "vouchers", ".", "all", "(", ")", ":", "try", ":", "arg_0", ".", "_test_voucher", "(", "arg_2", ")", "except", "ValidationError", ":", "arg_1", ".", "append", "(", "arg_2", ")", "for", "arg_2", "in", "arg_1", ":", "arg_0", ".", "cart", ".", "vouchers", ".", "remove", "(", "arg_2", ")", "arg_3", "=", "commerce", ".", "ProductItem", ".", "objects", ".", "filter", "(", "cart", "=", "arg_0", ".", "cart", ")", "arg_3", "=", "arg_3", ".", "select_related", "(", "\"product\"", ")", "arg_4", "=", "set", "(", "i", ".", "product", "for", "i", "in", "arg_3", ")", "arg_5", "=", "set", "(", "ProductController", ".", "available_products", "(", "arg_0", ".", "cart", ".", "user", ",", "arg_4", "=", "arg_4", ",", ")", ")", "arg_6", "=", "arg_4", "-", "arg_5", "arg_7", "=", "[", "(", "product", ",", "0", ")", "for", "product", "in", "arg_6", "]", "arg_0", ".", "set_quantities", "(", "arg_7", ")"], "function": "def Func(arg_0):\n        ''' This attempts to fix the easy errors raised by ValidationError.\n        This includes removing items from the cart that are no longer\n        available, recalculating all of the discounts, and removing voucher\n        codes that are no longer available. '''\n\n        # Fix vouchers first (this affects available discounts)\n        arg_1 = []\n        for arg_2 in arg_0.cart.vouchers.all():\n            try:\n                arg_0._test_voucher(arg_2)\n            except ValidationError:\n                arg_1.append(arg_2)\n\n        for arg_2 in arg_1:\n            arg_0.cart.vouchers.remove(arg_2)\n\n        # Fix products and discounts\n        arg_3 = commerce.ProductItem.objects.filter(cart=arg_0.cart)\n        arg_3 = arg_3.select_related(\"product\")\n        arg_4 = set(i.product for i in arg_3)\n        arg_5 = set(ProductController.available_products(\n            arg_0.cart.user,\n            arg_4=arg_4,\n        ))\n\n        arg_6 = arg_4 - arg_5\n        arg_7 = [(product, 0) for product in arg_6]\n\n        arg_0.set_quantities(arg_7)", "path": "registrasion/controllers/cart.py", "identifier": "CartController.fix_simple_errors", "docstring": "This attempts to fix the easy errors raised by ValidationError.\n        This includes removing items from the cart that are no longer\n        available, recalculating all of the discounts, and removing voucher\n        codes that are no longer available.", "docstring_tokens": ["This", "attempts", "to", "fix", "the", "easy", "errors", "raised", "by", "ValidationError", ".", "This", "includes", "removing", "items", "from", "the", "cart", "that", "are", "no", "longer", "available", "recalculating", "all", "of", "the", "discounts", "and", "removing", "voucher", "codes", "that", "are", "no", "longer", "available", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 260731}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/from_cds.py#L222-L256", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Handle reportnumbers.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "record_get_field_instances", "(", "arg_0", ".", "record", ",", "'088'", ")", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "field_get_subfields", "(", "arg_2", ")", "if", "'9'", "in", "arg_3", ":", "for", "arg_4", "in", "arg_3", "[", "'9'", "]", ":", "if", "arg_4", ".", "startswith", "(", "'P0'", ")", "or", "arg_4", ".", "startswith", "(", "'CM-P0'", ")", ":", "arg_5", "=", "[", "(", "'9'", ",", "'CERN'", ")", ",", "(", "'b'", ",", "arg_4", ")", "]", "record_add_field", "(", "arg_0", ".", "record", ",", "'595'", ",", "subfields", "=", "arg_5", ")", "for", "arg_6", ",", "arg_4", "in", "arg_2", "[", "0", "]", ":", "if", "arg_6", "in", "[", "'a'", ",", "'9'", "]", "and", "not", "arg_4", ".", "startswith", "(", "'SIS-'", ")", ":", "record_add_field", "(", "arg_0", ".", "record", ",", "'037'", ",", "subfields", "=", "[", "(", "'a'", ",", "arg_4", ")", "]", ")", "record_delete_fields", "(", "arg_0", ".", "record", ",", "\"088\"", ")", "arg_7", "=", "record_get_field_instances", "(", "arg_0", ".", "record", ",", "'037'", ")", "for", "arg_2", "in", "arg_7", ":", "arg_3", "=", "field_get_subfields", "(", "arg_2", ")", "if", "'a'", "in", "arg_3", ":", "for", "arg_8", "in", "arg_3", "[", "'a'", "]", ":", "if", "'arXiv'", "in", "arg_8", ":", "arg_9", "=", "[", "(", "'a'", ",", "arg_8", ")", ",", "(", "'9'", ",", "'arXiv'", ")", "]", "for", "arg_10", "in", "record_get_field_instances", "(", "arg_0", ".", "record", ",", "'695'", ")", ":", "for", "arg_6", ",", "arg_4", "in", "field_get_subfield_instances", "(", "arg_10", ")", ":", "if", "arg_6", "==", "'a'", ":", "arg_9", ".", "append", "(", "(", "'c'", ",", "arg_4", ")", ")", "break", "arg_11", "=", "create_field", "(", "subfields", "=", "arg_9", ")", "record_replace_field", "(", "arg_0", ".", "record", ",", "'037'", ",", "arg_11", ",", "arg_2", "[", "4", "]", ")", "for", "arg_6", ",", "arg_4", "in", "arg_2", "[", "0", "]", ":", "if", "arg_6", "in", "[", "'a'", ",", "'9'", "]", "and", "arg_4", ".", "startswith", "(", "'SIS-'", ")", ":", "record_delete_field", "(", "arg_0", ".", "record", ",", "'037'", ",", "field_position_global", "=", "arg_2", "[", "4", "]", ")"], "function": "def Func(arg_0):\n        \"\"\"Handle reportnumbers. \"\"\"\n        arg_1 = record_get_field_instances(arg_0.record, '088')\n        for arg_2 in arg_1:\n            arg_3 = field_get_subfields(arg_2)\n            if '9' in arg_3:\n                for arg_4 in arg_3['9']:\n                    if arg_4.startswith('P0') or arg_4.startswith('CM-P0'):\n                        arg_5 = [('9', 'CERN'), ('b', arg_4)]\n                        record_add_field(arg_0.record, '595', subfields=arg_5)\n            for arg_6, arg_4 in arg_2[0]:\n                if arg_6 in ['a', '9'] and not arg_4.startswith('SIS-'):\n                    record_add_field(\n                        arg_0.record, '037', subfields=[('a', arg_4)])\n        record_delete_fields(arg_0.record, \"088\")\n\n        # 037 Externals also...\n        arg_7 = record_get_field_instances(arg_0.record, '037')\n        for arg_2 in arg_7:\n            arg_3 = field_get_subfields(arg_2)\n            if 'a' in arg_3:\n                for arg_8 in arg_3['a']:\n                    if 'arXiv' in arg_8:\n                        arg_9 = [('a', arg_8), ('9', 'arXiv')]\n                        for arg_10 in record_get_field_instances(arg_0.record,  '695'):\n                            for arg_6, arg_4 in field_get_subfield_instances(arg_10):\n                                if arg_6 == 'a':\n                                    arg_9.append(('c', arg_4))\n                                    break\n                        arg_11 = create_field(subfields=arg_9)\n                        record_replace_field(arg_0.record, '037', arg_11, arg_2[4])\n            for arg_6, arg_4 in arg_2[0]:\n                if arg_6 in ['a', '9'] and arg_4.startswith('SIS-'):\n                    record_delete_field(\n                        arg_0.record, '037', field_position_global=arg_2[4])", "path": "harvestingkit/inspire_cds_package/from_cds.py", "identifier": "CDS2Inspire.update_reportnumbers", "docstring": "Handle reportnumbers.", "docstring_tokens": ["Handle", "reportnumbers", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 260732}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3405-L3412", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Jumps short if not sign.", "language": "python", "parameters": "(cpu, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "False", "==", "arg_0", ".", "SF", ",", "arg_1", ".", "read", "(", ")", ",", "arg_0", ".", "PC", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Jumps short if not sign.\n\n        :param cpu: current CPU.\n        :param target: destination operand.\n        \"\"\"\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, False == arg_0.SF, arg_1.read(), arg_0.PC)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.JNS", "docstring": "Jumps short if not sign.\n\n        :param cpu: current CPU.\n        :param target: destination operand.", "docstring_tokens": ["Jumps", "short", "if", "not", "sign", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260733}
{"url": "https://github.com/tomasbasham/dominos/blob/59729a8bdca0ae30a84115a0e93e9b1f259faf0e/dominos/api.py#L102-L117", "sha": "59729a8bdca0ae30a84115a0e93e9b1f259faf0e", "docstring_summary": "Retrieve the menu from the selected store.", "language": "python", "parameters": "(self, store)", "return_statement": "return Menu(response.json())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'collectionOnly'", ":", "not", "arg_1", ".", "delivery_available", ",", "'menuVersion'", ":", "arg_1", ".", "menu_version", ",", "'storeId'", ":", "arg_1", ".", "store_id", ",", "}", "arg_3", "=", "arg_0", ".", "__get", "(", "'/ProductCatalog/GetStoreCatalog'", ",", "arg_2", "=", "arg_2", ")", "return", "Menu", "(", "arg_3", ".", "json", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Retrieve the menu from the selected store.\n\n        :param Store store: A store.\n        :return: The store menu.\n        :rtype: Menu\n        '''\n        arg_2 = {\n            'collectionOnly': not arg_1.delivery_available,\n            'menuVersion': arg_1.menu_version,\n            'storeId': arg_1.store_id,\n        }\n\n        arg_3 = arg_0.__get('/ProductCatalog/GetStoreCatalog', arg_2=arg_2)\n        return Menu(arg_3.json())", "path": "dominos/api.py", "identifier": "Client.get_menu", "docstring": "Retrieve the menu from the selected store.\n\n        :param Store store: A store.\n        :return: The store menu.\n        :rtype: Menu", "docstring_tokens": ["Retrieve", "the", "menu", "from", "the", "selected", "store", "."], "nwo": "tomasbasham/dominos", "score": 0.5665029860115997, "idx": 260734}
{"url": "https://github.com/zsiciarz/pyaavso/blob/d3b9eb17bcecc6652841606802b5713fd6083cc1/pyaavso/formats/visual.py#L194-L225", "sha": "d3b9eb17bcecc6652841606802b5713fd6083cc1", "docstring_summary": "Converts a raw input record to a dictionary of observation data.", "language": "python", "parameters": "(cls, row)", "return_statement": "return {\n            'name': row[0],\n            'date': row[1],\n            'magnitude': row[2],\n            'comment_code': comment_code,\n            'comp1': comp1,\n            'comp2': comp2,\n            'chart': chart,\n            'notes': notes,\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "3", "]", "if", "arg_2", ".", "lower", "(", ")", "==", "'na'", ":", "arg_2", "=", "''", "arg_3", "=", "arg_1", "[", "4", "]", "if", "arg_3", ".", "lower", "(", ")", "==", "'na'", ":", "arg_3", "=", "''", "arg_4", "=", "arg_1", "[", "5", "]", "if", "arg_4", ".", "lower", "(", ")", "==", "'na'", ":", "arg_4", "=", "''", "arg_5", "=", "arg_1", "[", "6", "]", "if", "arg_5", ".", "lower", "(", ")", "==", "'na'", ":", "arg_5", "=", "''", "arg_6", "=", "arg_1", "[", "7", "]", "if", "arg_6", ".", "lower", "(", ")", "==", "'na'", ":", "arg_6", "=", "''", "return", "{", "'name'", ":", "arg_1", "[", "0", "]", ",", "'date'", ":", "arg_1", "[", "1", "]", ",", "'magnitude'", ":", "arg_1", "[", "2", "]", ",", "'comment_code'", ":", "arg_2", ",", "'comp1'", ":", "arg_3", ",", "'comp2'", ":", "arg_4", ",", "'chart'", ":", "arg_5", ",", "'notes'", ":", "arg_6", ",", "}"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Converts a raw input record to a dictionary of observation data.\n\n        :param cls: current class\n        :param row: a single observation as a list or tuple\n        \"\"\"\n        arg_2 = arg_1[3]\n        if arg_2.lower() == 'na':\n            arg_2 = ''\n        arg_3 = arg_1[4]\n        if arg_3.lower() == 'na':\n            arg_3 = ''\n        arg_4 = arg_1[5]\n        if arg_4.lower() == 'na':\n            arg_4 = ''\n        arg_5 = arg_1[6]\n        if arg_5.lower() == 'na':\n            arg_5 = ''\n        arg_6 = arg_1[7]\n        if arg_6.lower() == 'na':\n            arg_6 = ''\n        return {\n            'name': arg_1[0],\n            'date': arg_1[1],\n            'magnitude': arg_1[2],\n            'comment_code': arg_2,\n            'comp1': arg_3,\n            'comp2': arg_4,\n            'chart': arg_5,\n            'notes': arg_6,\n        }", "path": "pyaavso/formats/visual.py", "identifier": "VisualFormatReader.row_to_dict", "docstring": "Converts a raw input record to a dictionary of observation data.\n\n        :param cls: current class\n        :param row: a single observation as a list or tuple", "docstring_tokens": ["Converts", "a", "raw", "input", "record", "to", "a", "dictionary", "of", "observation", "data", "."], "nwo": "zsiciarz/pyaavso", "score": 0.14991498758945482, "idx": 260735}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L881-L915", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Flip the axis of an image, such as flip left and right, up and down, randomly or non-randomly,", "language": "python", "parameters": "(x, axis=1, is_random=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_2", ":", "arg_3", "=", "np", ".", "random", ".", "uniform", "(", "-", "1", ",", "1", ")", "if", "arg_3", ">", "0", ":", "arg_0", "=", "np", ".", "asarray", "(", "arg_0", ")", ".", "swapaxes", "(", "arg_1", ",", "0", ")", "arg_0", "=", "arg_0", "[", ":", ":", "-", "1", ",", "...", "]", "arg_0", "=", "arg_0", ".", "swapaxes", "(", "0", ",", "arg_1", ")", "return", "arg_0", "else", ":", "return", "arg_0", "else", ":", "arg_0", "=", "np", ".", "asarray", "(", "arg_0", ")", ".", "swapaxes", "(", "arg_1", ",", "0", ")", "arg_0", "=", "arg_0", "[", ":", ":", "-", "1", ",", "...", "]", "arg_0", "=", "arg_0", ".", "swapaxes", "(", "0", ",", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=1, arg_2=False):\n    \"\"\"Flip the axis of an image, such as flip left and right, up and down, randomly or non-randomly,\n\n    Parameters\n    ----------\n    x : numpy.array\n        An image with dimension of [row, col, channel] (default).\n    axis : int\n        Which axis to flip.\n            - 0, flip up and down\n            - 1, flip left and right\n            - 2, flip channel\n    is_random : boolean\n        If True, randomly flip. Default is False.\n\n    Returns\n    -------\n    numpy.array\n        A processed image.\n\n    \"\"\"\n    if arg_2:\n        arg_3 = np.random.uniform(-1, 1)\n        if arg_3 > 0:\n            arg_0 = np.asarray(arg_0).swapaxes(arg_1, 0)\n            arg_0 = arg_0[::-1, ...]\n            arg_0 = arg_0.swapaxes(0, arg_1)\n            return arg_0\n        else:\n            return arg_0\n    else:\n        arg_0 = np.asarray(arg_0).swapaxes(arg_1, 0)\n        arg_0 = arg_0[::-1, ...]\n        arg_0 = arg_0.swapaxes(0, arg_1)\n        return arg_0", "path": "tensorlayer/prepro.py", "identifier": "flip_axis", "docstring": "Flip the axis of an image, such as flip left and right, up and down, randomly or non-randomly,\n\n    Parameters\n    ----------\n    x : numpy.array\n        An image with dimension of [row, col, channel] (default).\n    axis : int\n        Which axis to flip.\n            - 0, flip up and down\n            - 1, flip left and right\n            - 2, flip channel\n    is_random : boolean\n        If True, randomly flip. Default is False.\n\n    Returns\n    -------\n    numpy.array\n        A processed image.", "docstring_tokens": ["Flip", "the", "axis", "of", "an", "image", "such", "as", "flip", "left", "and", "right", "up", "and", "down", "randomly", "or", "non", "-", "randomly"], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 260736}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/plugin.py#L45-L60", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Produce a dict that includes all the keys in d2 that represent different values in d1, as well as values that\n    aren't in d1.", "language": "python", "parameters": "(d1, d2)", "return_statement": "return d", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "for", "arg_3", "in", "set", "(", "arg_0", ")", ".", "intersection", "(", "set", "(", "arg_1", ")", ")", ":", "if", "arg_1", "[", "arg_3", "]", "!=", "arg_0", "[", "arg_3", "]", ":", "arg_2", "[", "arg_3", "]", "=", "arg_1", "[", "arg_3", "]", "for", "arg_3", "in", "set", "(", "arg_1", ")", ".", "difference", "(", "set", "(", "arg_0", ")", ")", ":", "arg_2", "[", "arg_3", "]", "=", "arg_1", "[", "arg_3", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Produce a dict that includes all the keys in d2 that represent different values in d1, as well as values that\n    aren't in d1.\n\n    :param dict d1: First dict\n    :param dict d2: Dict to compare with\n    :rtype: dict\n    \"\"\"\n    arg_2 = {}\n    for arg_3 in set(arg_0).intersection(set(arg_1)):\n        if arg_1[arg_3] != arg_0[arg_3]:\n            arg_2[arg_3] = arg_1[arg_3]\n    for arg_3 in set(arg_1).difference(set(arg_0)):\n        arg_2[arg_3] = arg_1[arg_3]\n    return arg_2", "path": "manticore/core/plugin.py", "identifier": "_dict_diff", "docstring": "Produce a dict that includes all the keys in d2 that represent different values in d1, as well as values that\n    aren't in d1.\n\n    :param dict d1: First dict\n    :param dict d2: Dict to compare with\n    :rtype: dict", "docstring_tokens": ["Produce", "a", "dict", "that", "includes", "all", "the", "keys", "in", "d2", "that", "represent", "different", "values", "in", "d1", "as", "well", "as", "values", "that", "aren", "t", "in", "d1", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260737}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/idaho.py#L92-L136", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Describe the result set of a catalog search for IDAHO images.", "language": "python", "parameters": "(self, idaho_image_results)", "return_statement": "return description", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "'results'", "]", "arg_2", "=", "[", "r", "for", "r", "in", "arg_2", "if", "'IDAHOImage'", "in", "r", "[", "'type'", "]", "]", "arg_0", ".", "logger", ".", "debug", "(", "'Describing %s IDAHO images.'", "%", "len", "(", "arg_2", ")", ")", "arg_3", "=", "set", "(", "[", "r", "[", "'properties'", "]", "[", "'catalogID'", "]", "for", "r", "in", "arg_2", "]", ")", "arg_4", "=", "{", "}", "for", "arg_5", "in", "arg_3", ":", "arg_4", "[", "arg_5", "]", "=", "{", "}", "arg_4", "[", "arg_5", "]", "[", "'parts'", "]", "=", "{", "}", "arg_6", "=", "[", "r", "for", "r", "in", "arg_2", "if", "r", "[", "'properties'", "]", "[", "'catalogID'", "]", "==", "arg_5", "]", "for", "arg_7", "in", "arg_6", ":", "arg_4", "[", "arg_5", "]", "[", "'sensorPlatformName'", "]", "=", "arg_7", "[", "'properties'", "]", "[", "'sensorPlatformName'", "]", "arg_8", "=", "int", "(", "arg_7", "[", "'properties'", "]", "[", "'vendorDatasetIdentifier'", "]", ".", "split", "(", "':'", ")", "[", "1", "]", "[", "-", "3", ":", "]", ")", "arg_9", "=", "arg_7", "[", "'properties'", "]", "[", "'colorInterpretation'", "]", "arg_10", "=", "arg_7", "[", "'properties'", "]", "[", "'tileBucketName'", "]", "arg_11", "=", "arg_7", "[", "'identifier'", "]", "arg_12", "=", "arg_7", "[", "'properties'", "]", "[", "'footprintWkt'", "]", "try", ":", "arg_4", "[", "arg_5", "]", "[", "'parts'", "]", "[", "arg_8", "]", "except", ":", "arg_4", "[", "arg_5", "]", "[", "'parts'", "]", "[", "arg_8", "]", "=", "{", "}", "arg_4", "[", "arg_5", "]", "[", "'parts'", "]", "[", "arg_8", "]", "[", "arg_9", "]", "=", "{", "}", "arg_4", "[", "arg_5", "]", "[", "'parts'", "]", "[", "arg_8", "]", "[", "arg_9", "]", "[", "'id'", "]", "=", "arg_11", "arg_4", "[", "arg_5", "]", "[", "'parts'", "]", "[", "arg_8", "]", "[", "arg_9", "]", "[", "'bucket'", "]", "=", "arg_10", "arg_4", "[", "arg_5", "]", "[", "'parts'", "]", "[", "arg_8", "]", "[", "arg_9", "]", "[", "'boundstr'", "]", "=", "arg_12", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Describe the result set of a catalog search for IDAHO images.\n\n        Args:\n            idaho_image_results (dict): Result set of catalog search.\n        Returns:\n            results (json): The full catalog-search response for IDAHO images\n                            corresponding to the given catID.\n        \"\"\"\n\n        arg_2 = arg_1['results']\n\n        # filter only idaho images:\n        arg_2 = [r for r in arg_2 if 'IDAHOImage' in r['type']]\n        arg_0.logger.debug('Describing %s IDAHO images.' % len(arg_2))\n\n        # figure out which catids are represented in this set of images\n        arg_3 = set([r['properties']['catalogID'] for r in arg_2])\n\n        arg_4 = {}\n\n        for arg_5 in arg_3:\n            # images associated with a single catid\n            arg_4[arg_5] = {}\n            arg_4[arg_5]['parts'] = {}\n            arg_6 = [r for r in arg_2 if r['properties']['catalogID'] == arg_5]\n            for arg_7 in arg_6:\n                arg_4[arg_5]['sensorPlatformName'] = arg_7['properties']['sensorPlatformName']\n                arg_8 = int(arg_7['properties']['vendorDatasetIdentifier'].split(':')[1][-3:])\n                arg_9 = arg_7['properties']['colorInterpretation']\n                arg_10 = arg_7['properties']['tileBucketName']\n                arg_11 = arg_7['identifier']\n                arg_12 = arg_7['properties']['footprintWkt']\n\n                try:\n                    arg_4[arg_5]['parts'][arg_8]\n                except:\n                    arg_4[arg_5]['parts'][arg_8] = {}\n\n                arg_4[arg_5]['parts'][arg_8][arg_9] = {}\n                arg_4[arg_5]['parts'][arg_8][arg_9]['id'] = arg_11\n                arg_4[arg_5]['parts'][arg_8][arg_9]['bucket'] = arg_10\n                arg_4[arg_5]['parts'][arg_8][arg_9]['boundstr'] = arg_12\n\n        return arg_4", "path": "gbdxtools/idaho.py", "identifier": "Idaho.describe_images", "docstring": "Describe the result set of a catalog search for IDAHO images.\n\n        Args:\n            idaho_image_results (dict): Result set of catalog search.\n        Returns:\n            results (json): The full catalog-search response for IDAHO images\n                            corresponding to the given catID.", "docstring_tokens": ["Describe", "the", "result", "set", "of", "a", "catalog", "search", "for", "IDAHO", "images", "."], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 260738}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/run.py#L613-L623", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Normal cluster shutdown.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "arg_0", ".", "nodes", ":", "arg_1", ".", "Func", "(", ")", "for", "arg_1", "in", "arg_0", ".", "client_nodes", ":", "arg_1", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Normal cluster shutdown.\n\n        :return none\n        \"\"\"\n        for arg_1 in arg_0.nodes:\n            arg_1.Func()\n\n        for arg_1 in arg_0.client_nodes:\n            arg_1.Func()", "path": "scripts/run.py", "identifier": "H2OCloud.stop", "docstring": "Normal cluster shutdown.\n\n        :return none", "docstring_tokens": ["Normal", "cluster", "shutdown", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260739}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L327-L331", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Turn a collection of Lisp forms into Python AST nodes.", "language": "python", "parameters": "(\n    ctx: GeneratorContext, form: Iterable[Node]\n)", "return_statement": "return _chain_py_ast(*map(partial(gen_py_ast, ctx), form))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", "]", ")", "->", "Tuple", "[", "PyASTStream", ",", "PyASTStream", "]", ":", "return", "_chain_py_ast", "(", "*", "map", "(", "partial", "(", "gen_py_ast", ",", "arg_0", ")", ",", "arg_2", ")", ")"], "function": "def Func(\n    arg_0: arg_1, arg_2: arg_3[arg_4]\n) -> Tuple[PyASTStream, PyASTStream]:\n    \"\"\"Turn a collection of Lisp forms into Python AST nodes.\"\"\"\n    return _chain_py_ast(*map(partial(gen_py_ast, arg_0), arg_2))", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "_collection_ast", "docstring": "Turn a collection of Lisp forms into Python AST nodes.", "docstring_tokens": ["Turn", "a", "collection", "of", "Lisp", "forms", "into", "Python", "AST", "nodes", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 260740}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2790-L2807", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Expand python variables in a string.", "language": "python", "parameters": "(self, cmd, depth=0, formatter=DollarFormatter())", "return_statement": "return cmd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "arg_4", "(", ")", ")", ":", "arg_5", "=", "arg_0", ".", "user_ns", ".", "copy", "(", ")", "arg_5", ".", "update", "(", "sys", ".", "_getframe", "(", "arg_2", "+", "1", ")", ".", "f_locals", ")", "arg_5", ".", "pop", "(", "'self'", ",", "None", ")", "try", ":", "arg_1", "=", "arg_3", ".", "format", "(", "arg_1", ",", "**", "arg_5", ")", "except", "Exception", ":", "pass", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=arg_4()):\n        \"\"\"Expand python variables in a string.\n\n        The depth argument indicates how many frames above the caller should\n        be walked to look for the local namespace where to expand variables.\n\n        The global namespace for expansion is always the user's interactive\n        namespace.\n        \"\"\"\n        arg_5 = arg_0.user_ns.copy()\n        arg_5.update(sys._getframe(arg_2+1).f_locals)\n        arg_5.pop('self', None)\n        try:\n            arg_1 = arg_3.format(arg_1, **arg_5)\n        except Exception:\n            # if formatter couldn't format, just let it go untransformed\n            pass\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.var_expand", "docstring": "Expand python variables in a string.\n\n        The depth argument indicates how many frames above the caller should\n        be walked to look for the local namespace where to expand variables.\n\n        The global namespace for expansion is always the user's interactive\n        namespace.", "docstring_tokens": ["Expand", "python", "variables", "in", "a", "string", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260741}
{"url": "https://github.com/neithere/argh/blob/dcd3253f2994400a6a58a700c118c53765bc50a4/argh/dispatching.py#L65-L187", "sha": "dcd3253f2994400a6a58a700c118c53765bc50a4", "docstring_summary": "Parses given list of arguments using given parser, calls the relevant\n    function and prints the result.", "language": "python", "parameters": "(parser, argv=None, add_help_command=True,\n             completion=True, pre_call=None,\n             output_file=sys.stdout, errors_file=sys.stderr,\n             raw_output=False, namespace=None,\n             skip_unknown_args=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ",", "arg_4", "=", "None", ",", "arg_5", "=", "arg_6", ".", "stdout", ",", "arg_8", "=", "arg_6", ".", "stderr", ",", "arg_10", "=", "False", ",", "arg_11", "=", "None", ",", "arg_12", "=", "False", ")", ":", "if", "arg_3", ":", "autocomplete", "(", "arg_0", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_6", ".", "argv", "[", "1", ":", "]", "if", "arg_2", ":", "if", "arg_1", "and", "arg_1", "[", "0", "]", "==", "'help'", ":", "arg_1", ".", "pop", "(", "0", ")", "arg_1", ".", "append", "(", "'--help'", ")", "if", "arg_12", ":", "arg_13", "=", "arg_0", ".", "parse_known_args", "else", ":", "arg_13", "=", "arg_0", ".", "parse_args", "if", "not", "arg_11", ":", "arg_11", "=", "ArghNamespace", "(", ")", "arg_14", "=", "arg_13", "(", "arg_1", ",", "arg_11", "=", "arg_11", ")", "arg_15", "=", "_get_function_from_namespace_obj", "(", "arg_14", ")", "if", "arg_15", ":", "arg_16", "=", "_execute_command", "(", "arg_15", ",", "arg_14", ",", "arg_8", ",", "arg_4", "=", "arg_4", ")", "else", ":", "arg_16", "=", "[", "arg_0", ".", "format_usage", "(", ")", "]", "if", "arg_5", "is", "None", ":", "if", "arg_6", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "arg_17", "=", "compat", ".", "BytesIO", "(", ")", "else", ":", "arg_17", "=", "compat", ".", "StringIO", "(", ")", "else", ":", "arg_17", "=", "arg_5", "for", "arg_18", "in", "arg_16", ":", "io", ".", "dump", "(", "arg_18", ",", "arg_17", ")", "if", "not", "arg_10", ":", "io", ".", "dump", "(", "'\\n'", ",", "arg_17", ")", "if", "arg_5", "is", "None", ":", "arg_17", ".", "seek", "(", "0", ")", "return", "arg_17", ".", "read", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=True,\n             arg_3=True, arg_4=None,\n             arg_5=arg_6.stdout, arg_8=arg_6.stderr,\n             arg_10=False, arg_11=None,\n             arg_12=False):\n    \"\"\"\n    Parses given list of arguments using given parser, calls the relevant\n    function and prints the result.\n\n    The target function should expect one positional argument: the\n    :class:`argparse.Namespace` object. However, if the function is decorated with\n    :func:`~argh.decorators.plain_signature`, the positional and named\n    arguments from the namespace object are passed to the function instead\n    of the object itself.\n\n    :param parser:\n\n        the ArgumentParser instance.\n\n    :param argv:\n\n        a list of strings representing the arguments. If `None`, ``sys.argv``\n        is used instead. Default is `None`.\n\n    :param add_help_command:\n\n        if `True`, converts first positional argument \"help\" to a keyword\n        argument so that ``help foo`` becomes ``foo --help`` and displays usage\n        information for \"foo\". Default is `True`.\n\n    :param output_file:\n\n        A file-like object for output. If `None`, the resulting lines are\n        collected and returned as a string. Default is ``sys.stdout``.\n\n    :param errors_file:\n\n        Same as `output_file` but for ``sys.stderr``.\n\n    :param raw_output:\n\n        If `True`, results are written to the output file raw, without adding\n        whitespaces or newlines between yielded strings. Default is `False`.\n\n    :param completion:\n\n        If `True`, shell tab completion is enabled. Default is `True`. (You\n        will also need to install it.)  See :mod:`argh.completion`.\n\n    :param skip_unknown_args:\n\n        If `True`, unknown arguments do not cause an error\n        (`ArgumentParser.parse_known_args` is used).\n\n    :param namespace:\n\n        An `argparse.Namespace`-like object.  By default an\n        :class:`ArghNamespace` object is used.  Please note that support for\n        combined default and nested functions may be broken if a different\n        type of object is forced.\n\n    By default the exceptions are not wrapped and will propagate. The only\n    exception that is always wrapped is :class:`~argh.exceptions.CommandError`\n    which is interpreted as an expected event so the traceback is hidden.\n    You can also mark arbitrary exceptions as \"wrappable\" by using the\n    :func:`~argh.decorators.wrap_errors` decorator.\n    \"\"\"\n    if arg_3:\n        autocomplete(arg_0)\n\n    if arg_1 is None:\n        arg_1 = arg_6.argv[1:]\n\n    if arg_2:\n        if arg_1 and arg_1[0] == 'help':\n            arg_1.pop(0)\n            arg_1.append('--help')\n\n    if arg_12:\n        arg_13 = arg_0.parse_known_args\n    else:\n        arg_13 = arg_0.parse_args\n\n    if not arg_11:\n        arg_11 = ArghNamespace()\n\n    # this will raise SystemExit if parsing fails\n    arg_14 = arg_13(arg_1, arg_11=arg_11)\n\n    arg_15 = _get_function_from_namespace_obj(arg_14)\n\n    if arg_15:\n        arg_16 = _execute_command(arg_15, arg_14, arg_8,\n                                 arg_4=arg_4)\n    else:\n        # no commands declared, can't Func; display help message\n        arg_16 = [arg_0.format_usage()]\n\n    if arg_5 is None:\n        # user wants a string; we create an internal temporary file-like object\n        # and will return its contents as a string\n        if arg_6.version_info < (3,0):\n            arg_17 = compat.BytesIO()\n        else:\n            arg_17 = compat.StringIO()\n    else:\n        # normally this is stdout; can be any file\n        arg_17 = arg_5\n\n    for arg_18 in arg_16:\n        # print the line as soon as it is generated to ensure that it is\n        # displayed to the user before anything else happens, e.g.\n        # raw_input() is called\n\n        io.dump(arg_18, arg_17)\n        if not arg_10:\n            # in most cases user wants one message per line\n            io.dump('\\n', arg_17)\n\n    if arg_5 is None:\n        # user wanted a string; return contents of our temporary file-like obj\n        arg_17.seek(0)\n        return arg_17.read()", "path": "argh/dispatching.py", "identifier": "dispatch", "docstring": "Parses given list of arguments using given parser, calls the relevant\n    function and prints the result.\n\n    The target function should expect one positional argument: the\n    :class:`argparse.Namespace` object. However, if the function is decorated with\n    :func:`~argh.decorators.plain_signature`, the positional and named\n    arguments from the namespace object are passed to the function instead\n    of the object itself.\n\n    :param parser:\n\n        the ArgumentParser instance.\n\n    :param argv:\n\n        a list of strings representing the arguments. If `None`, ``sys.argv``\n        is used instead. Default is `None`.\n\n    :param add_help_command:\n\n        if `True`, converts first positional argument \"help\" to a keyword\n        argument so that ``help foo`` becomes ``foo --help`` and displays usage\n        information for \"foo\". Default is `True`.\n\n    :param output_file:\n\n        A file-like object for output. If `None`, the resulting lines are\n        collected and returned as a string. Default is ``sys.stdout``.\n\n    :param errors_file:\n\n        Same as `output_file` but for ``sys.stderr``.\n\n    :param raw_output:\n\n        If `True`, results are written to the output file raw, without adding\n        whitespaces or newlines between yielded strings. Default is `False`.\n\n    :param completion:\n\n        If `True`, shell tab completion is enabled. Default is `True`. (You\n        will also need to install it.)  See :mod:`argh.completion`.\n\n    :param skip_unknown_args:\n\n        If `True`, unknown arguments do not cause an error\n        (`ArgumentParser.parse_known_args` is used).\n\n    :param namespace:\n\n        An `argparse.Namespace`-like object.  By default an\n        :class:`ArghNamespace` object is used.  Please note that support for\n        combined default and nested functions may be broken if a different\n        type of object is forced.\n\n    By default the exceptions are not wrapped and will propagate. The only\n    exception that is always wrapped is :class:`~argh.exceptions.CommandError`\n    which is interpreted as an expected event so the traceback is hidden.\n    You can also mark arbitrary exceptions as \"wrappable\" by using the\n    :func:`~argh.decorators.wrap_errors` decorator.", "docstring_tokens": ["Parses", "given", "list", "of", "arguments", "using", "given", "parser", "calls", "the", "relevant", "function", "and", "prints", "the", "result", "."], "nwo": "neithere/argh", "score": 0.5784710843725794, "idx": 260742}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/csp.py#L163-L172", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Return true if we remove a value.", "language": "python", "parameters": "(csp, Xi, Xj, removals)", "return_statement": "return revised", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "False", "for", "arg_5", "in", "arg_0", ".", "curr_domains", "[", "arg_1", "]", "[", ":", "]", ":", "if", "every", "(", "lambda", "y", ":", "not", "arg_0", ".", "constraints", "(", "arg_1", ",", "arg_5", ",", "arg_2", ",", "y", ")", ",", "arg_0", ".", "curr_domains", "[", "arg_2", "]", ")", ":", "arg_0", ".", "prune", "(", "arg_1", ",", "arg_5", ",", "arg_3", ")", "arg_4", "=", "True", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"Return true if we remove a value.\"\n    arg_4 = False\n    for arg_5 in arg_0.curr_domains[arg_1][:]:\n        # If Xi=x conflicts with Xj=y for every possible y, eliminate Xi=x\n        if every(lambda y: not arg_0.constraints(arg_1, arg_5, arg_2, y),\n                 arg_0.curr_domains[arg_2]):\n            arg_0.prune(arg_1, arg_5, arg_3)\n            arg_4 = True\n    return arg_4", "path": "aima/csp.py", "identifier": "revise", "docstring": "Return true if we remove a value.", "docstring_tokens": ["Return", "true", "if", "we", "remove", "a", "value", "."], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 260743}
{"url": "https://github.com/topic2k/pygcgen/blob/c41701815df2c8c3a57fd5f7b8babe702127c8a1/pygcgen/generator.py#L351-L380", "sha": "c41701815df2c8c3a57fd5f7b8babe702127c8a1", "docstring_summary": "Apply all filters to issues and pull requests.", "language": "python", "parameters": "(self, newer_tag, older_tag)", "return_statement": "return filtered_issues, filtered_pull_requests", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "delete_by_time", "(", "arg_0", ".", "pull_requests", ",", "arg_2", ",", "arg_1", ")", "arg_4", "=", "arg_0", ".", "delete_by_time", "(", "arg_0", ".", "issues", ",", "arg_2", ",", "arg_1", ")", "arg_5", "=", "arg_1", "[", "\"name\"", "]", "if", "arg_1", "else", "None", "if", "arg_0", ".", "options", ".", "filter_issues_by_milestone", ":", "arg_4", "=", "arg_0", ".", "filter_by_milestone", "(", "arg_4", ",", "arg_5", ",", "arg_0", ".", "issues", ")", "arg_3", "=", "arg_0", ".", "filter_by_milestone", "(", "arg_3", ",", "arg_5", ",", "arg_0", ".", "pull_requests", ")", "return", "arg_4", ",", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Apply all filters to issues and pull requests.\n\n        :param dict older_tag: All issues before this tag's date will be\n                               excluded. May be special value, if new tag is\n                               the first tag. (Means **older_tag** is when\n                               the repo  was created.)\n        :param dict newer_tag: All issues after this tag's date  will be\n                               excluded. May be title of unreleased section.\n        :rtype: list(dict), list(dict)\n        :return: Filtered issues and pull requests.\n        \"\"\"\n\n        arg_3 = arg_0.delete_by_time(arg_0.pull_requests,\n                                                     arg_2, arg_1)\n        arg_4 = arg_0.delete_by_time(arg_0.issues, arg_2,\n                                              arg_1)\n\n        arg_5 = arg_1[\"name\"] if arg_1 else None\n\n        if arg_0.options.filter_issues_by_milestone:\n            # delete excess irrelevant issues (according milestones).Issue #22.\n            arg_4 = arg_0.filter_by_milestone(\n                arg_4, arg_5, arg_0.issues\n            )\n            arg_3 = arg_0.filter_by_milestone(\n                arg_3, arg_5, arg_0.pull_requests\n            )\n        return arg_4, arg_3", "path": "pygcgen/generator.py", "identifier": "Generator.filter_issues_for_tags", "docstring": "Apply all filters to issues and pull requests.\n\n        :param dict older_tag: All issues before this tag's date will be\n                               excluded. May be special value, if new tag is\n                               the first tag. (Means **older_tag** is when\n                               the repo  was created.)\n        :param dict newer_tag: All issues after this tag's date  will be\n                               excluded. May be title of unreleased section.\n        :rtype: list(dict), list(dict)\n        :return: Filtered issues and pull requests.", "docstring_tokens": ["Apply", "all", "filters", "to", "issues", "and", "pull", "requests", "."], "nwo": "topic2k/pygcgen", "score": 0.36495594146284627, "idx": 260744}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/mysql_hook.py#L62-L105", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns a mysql connection object", "language": "python", "parameters": "(self)", "return_statement": "return conn", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "Funcection", "(", "arg_0", ".", "mysql_conn_id", ")", "arg_2", "=", "{", "\"user\"", ":", "arg_1", ".", "login", ",", "\"passwd\"", ":", "arg_1", ".", "password", "or", "''", ",", "\"host\"", ":", "arg_1", ".", "host", "or", "'localhost'", ",", "\"db\"", ":", "arg_0", ".", "schema", "or", "arg_1", ".", "schema", "or", "''", "}", "if", "not", "arg_1", ".", "port", ":", "arg_2", "[", "\"port\"", "]", "=", "3306", "else", ":", "arg_2", "[", "\"port\"", "]", "=", "int", "(", "arg_1", ".", "port", ")", "if", "arg_1", ".", "extra_dejson", ".", "get", "(", "'charset'", ",", "False", ")", ":", "arg_2", "[", "\"charset\"", "]", "=", "arg_1", ".", "extra_dejson", "[", "\"charset\"", "]", "if", "(", "arg_2", "[", "\"charset\"", "]", ")", ".", "lower", "(", ")", "==", "'utf8'", "or", "(", "arg_2", "[", "\"charset\"", "]", ")", ".", "lower", "(", ")", "==", "'utf-8'", ":", "arg_2", "[", "\"use_unicode\"", "]", "=", "True", "if", "arg_1", ".", "extra_dejson", ".", "get", "(", "'cursor'", ",", "False", ")", ":", "if", "(", "arg_1", ".", "extra_dejson", "[", "\"cursor\"", "]", ")", ".", "lower", "(", ")", "==", "'sscursor'", ":", "arg_2", "[", "\"cursorclass\"", "]", "=", "MySQLdb", ".", "cursors", ".", "SSCursor", "elif", "(", "arg_1", ".", "extra_dejson", "[", "\"cursor\"", "]", ")", ".", "lower", "(", ")", "==", "'dictcursor'", ":", "arg_2", "[", "\"cursorclass\"", "]", "=", "MySQLdb", ".", "cursors", ".", "DictCursor", "elif", "(", "arg_1", ".", "extra_dejson", "[", "\"cursor\"", "]", ")", ".", "lower", "(", ")", "==", "'ssdictcursor'", ":", "arg_2", "[", "\"cursorclass\"", "]", "=", "MySQLdb", ".", "cursors", ".", "SSDictCursor", "arg_3", "=", "arg_1", ".", "extra_dejson", ".", "get", "(", "'local_infile'", ",", "False", ")", "if", "arg_1", ".", "extra_dejson", ".", "get", "(", "'ssl'", ",", "False", ")", ":", "arg_4", "=", "arg_1", ".", "extra_dejson", "[", "'ssl'", "]", "if", "isinstance", "(", "arg_4", ",", "six", ".", "string_types", ")", ":", "arg_4", "=", "json", ".", "loads", "(", "arg_4", ")", "arg_2", "[", "'ssl'", "]", "=", "arg_4", "if", "arg_1", ".", "extra_dejson", ".", "get", "(", "'unix_socket'", ")", ":", "arg_2", "[", "'unix_socket'", "]", "=", "arg_1", ".", "extra_dejson", "[", "'unix_socket'", "]", "if", "arg_3", ":", "arg_2", "[", "\"local_infile\"", "]", "=", "1", "arg_1", "=", "MySQLdb", ".", "connect", "(", "**", "arg_2", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns a mysql connection object\n        \"\"\"\n        arg_1 = arg_0.Funcection(arg_0.mysql_conn_id)\n        arg_2 = {\n            \"user\": arg_1.login,\n            \"passwd\": arg_1.password or '',\n            \"host\": arg_1.host or 'localhost',\n            \"db\": arg_0.schema or arg_1.schema or ''\n        }\n\n        if not arg_1.port:\n            arg_2[\"port\"] = 3306\n        else:\n            arg_2[\"port\"] = int(arg_1.port)\n\n        if arg_1.extra_dejson.get('charset', False):\n            arg_2[\"charset\"] = arg_1.extra_dejson[\"charset\"]\n            if (arg_2[\"charset\"]).lower() == 'utf8' or\\\n                    (arg_2[\"charset\"]).lower() == 'utf-8':\n                arg_2[\"use_unicode\"] = True\n        if arg_1.extra_dejson.get('cursor', False):\n            if (arg_1.extra_dejson[\"cursor\"]).lower() == 'sscursor':\n                arg_2[\"cursorclass\"] = MySQLdb.cursors.SSCursor\n            elif (arg_1.extra_dejson[\"cursor\"]).lower() == 'dictcursor':\n                arg_2[\"cursorclass\"] = MySQLdb.cursors.DictCursor\n            elif (arg_1.extra_dejson[\"cursor\"]).lower() == 'ssdictcursor':\n                arg_2[\"cursorclass\"] = MySQLdb.cursors.SSDictCursor\n        arg_3 = arg_1.extra_dejson.get('local_infile', False)\n        if arg_1.extra_dejson.get('ssl', False):\n            # SSL parameter for MySQL has to be a dictionary and in case\n            # of extra/dejson we can get string if extra is passed via\n            # URL parameters\n            arg_4 = arg_1.extra_dejson['ssl']\n            if isinstance(arg_4, six.string_types):\n                arg_4 = json.loads(arg_4)\n            arg_2['ssl'] = arg_4\n        if arg_1.extra_dejson.get('unix_socket'):\n            arg_2['unix_socket'] = arg_1.extra_dejson['unix_socket']\n        if arg_3:\n            arg_2[\"local_infile\"] = 1\n        arg_1 = MySQLdb.connect(**arg_2)\n        return arg_1", "path": "airflow/hooks/mysql_hook.py", "identifier": "MySqlHook.get_conn", "docstring": "Returns a mysql connection object", "docstring_tokens": ["Returns", "a", "mysql", "connection", "object"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260745}
{"url": "https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/utils.py#L49-L60", "sha": "dc2d941d8285a96f3a5b666a4bd04875b0b25984", "docstring_summary": "Terminate a process and its descendants.", "language": "python", "parameters": "(process)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "_recursive_terminate", "(", "arg_0", ".", "pid", ")", "except", "OSError", "as", "e", ":", "warnings", ".", "warn", "(", "\"Failed to kill subprocesses on this platform. Please\"", "\"install psutil: https://github.com/giampaolo/psutil\"", ")", "arg_0", ".", "terminate", "(", ")", "arg_0", ".", "join", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Terminate a process and its descendants.\n    \"\"\"\n    try:\n        _recursive_terminate(arg_0.pid)\n    except OSError as e:\n        warnings.warn(\"Failed to kill subprocesses on this platform. Please\"\n                      \"install psutil: https://github.com/giampaolo/psutil\")\n        # In case we cannot introspect the children, we fall back to the\n        # classic Process.terminate.\n        arg_0.terminate()\n    arg_0.join()", "path": "loky/backend/utils.py", "identifier": "_recursive_terminate_without_psutil", "docstring": "Terminate a process and its descendants.", "docstring_tokens": ["Terminate", "a", "process", "and", "its", "descendants", "."], "nwo": "tomMoral/loky", "score": 0.572510808364181, "idx": 260746}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/positive_semidefinite_kernels/matern.py#L44-L68", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Shared init logic for `amplitude` and `length_scale` params.", "language": "python", "parameters": "(self, amplitude, length_scale, validate_args)", "return_statement": "return dtype", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "util", ".", "maybe_get_common_dtype", "(", "[", "arg_1", ",", "arg_2", "]", ")", "if", "arg_1", "is", "not", "None", ":", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ",", "name", "=", "'amplitude'", ",", "arg_4", "=", "arg_4", ")", "arg_0", ".", "_amplitude", "=", "_validate_arg_if_not_none", "(", "arg_1", ",", "tf", ".", "compat", ".", "v1", ".", "assert_positive", ",", "arg_3", ")", "if", "arg_2", "is", "not", "None", ":", "arg_2", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_2", ",", "name", "=", "'length_scale'", ",", "arg_4", "=", "arg_4", ")", "arg_0", ".", "_length_scale", "=", "_validate_arg_if_not_none", "(", "arg_2", ",", "tf", ".", "compat", ".", "v1", ".", "assert_positive", ",", "arg_3", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Shared init logic for `amplitude` and `length_scale` params.\n\n    Args:\n      amplitude: `Tensor` (or convertible) or `None` to convert, validate.\n      length_scale: `Tensor` (or convertible) or `None` to convert, validate.\n      validate_args: If `True`, parameters are checked for validity despite\n        possibly degrading runtime performance\n\n    Returns:\n      dtype: The common `DType` of the parameters.\n    \"\"\"\n    arg_4 = util.maybe_get_common_dtype(\n        [arg_1, arg_2])\n    if arg_1 is not None:\n      arg_1 = tf.convert_to_tensor(\n          value=arg_1, name='amplitude', arg_4=arg_4)\n    arg_0._amplitude = _validate_arg_if_not_none(\n        arg_1, tf.compat.v1.assert_positive, arg_3)\n    if arg_2 is not None:\n      arg_2 = tf.convert_to_tensor(\n          value=arg_2, name='length_scale', arg_4=arg_4)\n    arg_0._length_scale = _validate_arg_if_not_none(\n        arg_2, tf.compat.v1.assert_positive, arg_3)\n    return arg_4", "path": "tensorflow_probability/python/positive_semidefinite_kernels/matern.py", "identifier": "_AmplitudeLengthScaleMixin._init_params", "docstring": "Shared init logic for `amplitude` and `length_scale` params.\n\n    Args:\n      amplitude: `Tensor` (or convertible) or `None` to convert, validate.\n      length_scale: `Tensor` (or convertible) or `None` to convert, validate.\n      validate_args: If `True`, parameters are checked for validity despite\n        possibly degrading runtime performance\n\n    Returns:\n      dtype: The common `DType` of the parameters.", "docstring_tokens": ["Shared", "init", "logic", "for", "amplitude", "and", "length_scale", "params", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260747}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/model_creator.py#L194-L203", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Writes out a model to a file.\n    prompt string is a string containing the prompt\n    feature_ext is a trained FeatureExtractor object\n    classifier is a trained classifier\n    model_path is the path of write out the model file to", "language": "python", "parameters": "(prompt_string, feature_ext, classifier, text, score, model_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "{", "'prompt'", ":", "arg_0", ",", "'extractor'", ":", "arg_1", ",", "'model'", ":", "arg_2", ",", "'text'", ":", "arg_3", ",", "'score'", ":", "arg_4", "}", "pickle", ".", "dump", "(", "arg_6", ",", "file", "=", "open", "(", "arg_5", ",", "\"w\"", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"\n    Writes out a model to a file.\n    prompt string is a string containing the prompt\n    feature_ext is a trained FeatureExtractor object\n    classifier is a trained classifier\n    model_path is the path of write out the model file to\n    \"\"\"\n    arg_6 = {'prompt': arg_0, 'extractor': arg_1, 'model': arg_2, 'text' : arg_3, 'score' : arg_4}\n    pickle.dump(arg_6, file=open(arg_5, \"w\"))", "path": "ease/model_creator.py", "identifier": "dump_model_to_file", "docstring": "Writes out a model to a file.\n    prompt string is a string containing the prompt\n    feature_ext is a trained FeatureExtractor object\n    classifier is a trained classifier\n    model_path is the path of write out the model file to", "docstring_tokens": ["Writes", "out", "a", "model", "to", "a", "file", ".", "prompt", "string", "is", "a", "string", "containing", "the", "prompt", "feature_ext", "is", "a", "trained", "FeatureExtractor", "object", "classifier", "is", "a", "trained", "classifier", "model_path", "is", "the", "path", "of", "write", "out", "the", "model", "file", "to"], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 260748}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/resolver.py#L153-L169", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Start a new working thread unless the maximum number of threads\n        has been reached or the request queue is empty.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "arg_0", ".", "lock", ":", "if", "arg_0", ".", "threads", "and", "arg_0", ".", "queue", ".", "empty", "(", ")", ":", "return", "if", "len", "(", "arg_0", ".", "threads", ")", ">=", "arg_0", ".", "max_threads", ":", "return", "arg_1", "=", "arg_0", ".", "last_thread_n", "+", "1", "arg_0", ".", "last_thread_n", "=", "arg_1", "arg_3", "=", "threading", ".", "Thread", "(", "target", "=", "arg_0", ".", "_run", ",", "name", "=", "\"{0!r} #{1}\"", ".", "format", "(", "arg_0", ",", "arg_1", ")", ",", "args", "=", "(", "arg_1", ",", ")", ")", "arg_0", ".", "threads", ".", "append", "(", "arg_3", ")", "arg_3", ".", "daemon", "=", "True", "arg_3", ".", "start", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Start a new working thread unless the maximum number of threads\n        has been reached or the request queue is empty.\n        \"\"\"\n        with arg_0.lock:\n            if arg_0.threads and arg_0.queue.empty():\n                return\n            if len(arg_0.threads) >= arg_0.max_threads:\n                return\n            arg_1 = arg_0.last_thread_n + 1\n            arg_0.last_thread_n = arg_1\n            arg_3 = threading.Thread(target = arg_0._run,\n                            name = \"{0!r} #{1}\".format(arg_0, arg_1),\n                            args = (arg_1,))\n            arg_0.threads.append(arg_3)\n            arg_3.daemon = True\n            arg_3.start()", "path": "pyxmpp2/resolver.py", "identifier": "ThreadedResolverBase._start_thread", "docstring": "Start a new working thread unless the maximum number of threads\n        has been reached or the request queue is empty.", "docstring_tokens": ["Start", "a", "new", "working", "thread", "unless", "the", "maximum", "number", "of", "threads", "has", "been", "reached", "or", "the", "request", "queue", "is", "empty", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260749}
{"url": "https://github.com/Rikanishu/static-bundle/blob/2f6458cb9d9d9049b4fd829f7d6951a45d547c68/static_bundle/utils.py#L58-L66", "sha": "2f6458cb9d9d9049b4fd829f7d6951a45d547c68", "docstring_summary": "Split file name and extension", "language": "python", "parameters": "(path)", "return_statement": "return file_ext.lstrip('.')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "os", ".", "path", ".", "splitext", "(", "arg_0", ")", "return", "arg_2", ".", "lstrip", "(", "'.'", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Split file name and extension\n\n    :type path: str|unicode\n    :rtype: one str|unicode\n    \"\"\"\n    arg_1, arg_2 = os.path.splitext(arg_0)\n    return arg_2.lstrip('.')", "path": "static_bundle/utils.py", "identifier": "get_path_extension", "docstring": "Split file name and extension\n\n    :type path: str|unicode\n    :rtype: one str|unicode", "docstring_tokens": ["Split", "file", "name", "and", "extension"], "nwo": "Rikanishu/static-bundle", "score": 0.0, "idx": 260750}
{"url": "https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/utils.py#L46-L49", "sha": "8708683cd33955def1378fc28319ef37805b851d", "docstring_summary": "Replace mutagen metadata field list values in mutagen tags with the first list value.", "language": "python", "parameters": "(metadata)", "return_statement": "return dict((k, v[0]) for k, v in metadata.items() if v)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "dict", "(", "(", "arg_1", ",", "arg_2", "[", "0", "]", ")", "for", "arg_1", ",", "arg_2", "in", "arg_0", ".", "items", "(", ")", "if", "arg_2", ")"], "function": "def Func(arg_0):\n\t\"\"\"Replace mutagen metadata field list values in mutagen tags with the first list value.\"\"\"\n\n\treturn dict((arg_1, arg_2[0]) for arg_1, arg_2 in arg_0.items() if arg_2)", "path": "gmusicapi_wrapper/utils.py", "identifier": "_mutagen_fields_to_single_value", "docstring": "Replace mutagen metadata field list values in mutagen tags with the first list value.", "docstring_tokens": ["Replace", "mutagen", "metadata", "field", "list", "values", "in", "mutagen", "tags", "with", "the", "first", "list", "value", "."], "nwo": "thebigmunch/gmusicapi-wrapper", "score": 0.27831918678159157, "idx": 260751}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/search_space.py#L64-L86", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "An integer-valued dimension bounded between `min` <= x <= `max`.\n        Note that the right endpoint of the interval includes `max`.", "language": "python", "parameters": "(self, name, min, max, warp=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "arg_2", ",", "arg_3", "=", "map", "(", "int", ",", "(", "arg_2", ",", "arg_3", ")", ")", "if", "arg_3", "<", "arg_2", ":", "raise", "ValueError", "(", "'variable %s: max < min error'", "%", "arg_1", ")", "if", "arg_4", "not", "in", "(", "None", ",", "'log'", ")", ":", "raise", "ValueError", "(", "'variable %s: warp=%s is not supported. use '", "'None or \"log\",'", "%", "(", "arg_1", ",", "arg_4", ")", ")", "if", "arg_2", "<=", "0", "and", "arg_4", "==", "'log'", ":", "raise", "ValueError", "(", "'variable %s: log-warping requires min > 0'", ")", "arg_0", ".", "variables", "[", "arg_1", "]", "=", "IntVariable", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"An integer-valued dimension bounded between `min` <= x <= `max`.\n        Note that the right endpoint of the interval includes `max`.\n\n        When `warp` is None, the base measure associated with this dimension\n        is a categorical distribution with each weight on each of the integers\n        in [min, max]. With `warp == 'log'`, the base measure is a uniform\n        distribution on the log of the variable, with bounds at `log(min)` and\n        `log(max)`. This is appropriate for variables that are \"naturally\" in\n        log-space. Other `warp` functions are not supported (yet), but may be\n        at a later time. Please note that this functionality is not supported\n        for `hyperopt_tpe`.\n        \"\"\"\n        arg_2, arg_3 = map(int, (arg_2, arg_3))\n        if arg_3 < arg_2:\n            raise ValueError('variable %s: max < min error' % arg_1)\n        if arg_4 not in (None, 'log'):\n            raise ValueError('variable %s: warp=%s is not supported. use '\n                             'None or \"log\",' % (arg_1, arg_4))\n        if arg_2 <= 0 and arg_4 == 'log':\n            raise ValueError('variable %s: log-warping requires min > 0')\n\n        arg_0.variables[arg_1] = IntVariable(arg_1, arg_2, arg_3, arg_4)", "path": "osprey/search_space.py", "identifier": "SearchSpace.add_int", "docstring": "An integer-valued dimension bounded between `min` <= x <= `max`.\n        Note that the right endpoint of the interval includes `max`.\n\n        When `warp` is None, the base measure associated with this dimension\n        is a categorical distribution with each weight on each of the integers\n        in [min, max]. With `warp == 'log'`, the base measure is a uniform\n        distribution on the log of the variable, with bounds at `log(min)` and\n        `log(max)`. This is appropriate for variables that are \"naturally\" in\n        log-space. Other `warp` functions are not supported (yet), but may be\n        at a later time. Please note that this functionality is not supported\n        for `hyperopt_tpe`.", "docstring_tokens": ["An", "integer", "-", "valued", "dimension", "bounded", "between", "min", "<", "=", "x", "<", "=", "max", ".", "Note", "that", "the", "right", "endpoint", "of", "the", "interval", "includes", "max", "."], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 260752}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm.py#L3079-L3151", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the index of a cell in this column which is a good candidate\n    for adding a new segment.", "language": "python", "parameters": "(self, colIdx)", "return_statement": "return candidateCellIdx", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "maxSegmentsPerCell", "<", "0", ":", "if", "arg_0", ".", "cellsPerColumn", ">", "1", ":", "arg_2", "=", "arg_0", ".", "_random", ".", "getUInt32", "(", "arg_0", ".", "cellsPerColumn", "-", "1", ")", "+", "1", "else", ":", "arg_2", "=", "0", "return", "arg_2", "arg_3", "=", "[", "]", "if", "arg_0", ".", "cellsPerColumn", "==", "1", ":", "arg_4", "=", "0", "arg_5", "=", "0", "else", ":", "arg_4", "=", "1", "arg_5", "=", "arg_0", ".", "cellsPerColumn", "-", "1", "for", "arg_2", "in", "xrange", "(", "arg_4", ",", "arg_5", "+", "1", ")", ":", "arg_6", "=", "len", "(", "arg_0", ".", "cells", "[", "arg_1", "]", "[", "arg_2", "]", ")", "if", "arg_6", "<", "arg_0", ".", "maxSegmentsPerCell", ":", "arg_3", ".", "append", "(", "arg_2", ")", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_7", "=", "(", "arg_3", "[", "arg_0", ".", "_random", ".", "getUInt32", "(", "len", "(", "arg_3", ")", ")", "]", ")", "if", "arg_0", ".", "verbosity", ">=", "5", ":", "print", "\"Cell [%d,%d] chosen for new segment, # of segs is %d\"", "%", "(", "arg_1", ",", "arg_7", ",", "len", "(", "arg_0", ".", "cells", "[", "arg_1", "]", "[", "arg_7", "]", ")", ")", "return", "arg_7", "arg_8", "=", "None", "arg_9", "=", "1.0", "for", "arg_2", "in", "xrange", "(", "arg_4", ",", "arg_5", "+", "1", ")", ":", "for", "arg_10", "in", "arg_0", ".", "cells", "[", "arg_1", "]", "[", "arg_2", "]", ":", "arg_11", "=", "arg_10", ".", "dutyCycle", "(", ")", "if", "arg_11", "<", "arg_9", ":", "arg_7", "=", "arg_2", "arg_9", "=", "arg_11", "arg_8", "=", "arg_10", "if", "arg_0", ".", "verbosity", ">=", "5", ":", "print", "(", "\"Deleting segment #%d for cell[%d,%d] to make room for new \"", "\"segment\"", "%", "(", "arg_8", ".", "segID", ",", "arg_1", ",", "arg_7", ")", ")", "arg_8", ".", "debugPrint", "(", ")", "arg_0", ".", "_cleanUpdatesList", "(", "arg_1", ",", "arg_7", ",", "arg_8", ")", "arg_0", ".", "cells", "[", "arg_1", "]", "[", "arg_7", "]", ".", "remove", "(", "arg_8", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Return the index of a cell in this column which is a good candidate\n    for adding a new segment.\n\n    When we have fixed size resources in effect, we insure that we pick a\n    cell which does not already have the max number of allowed segments. If\n    none exists, we choose the least used segment in the column to re-allocate.\n\n    :param colIdx which column to look at\n    :returns: cell index\n    \"\"\"\n    # Not fixed size CLA, just choose a cell randomly\n    if arg_0.maxSegmentsPerCell < 0:\n      if arg_0.cellsPerColumn > 1:\n        # Don't ever choose the start cell (cell # 0) in each column\n        arg_2 = arg_0._random.getUInt32(arg_0.cellsPerColumn-1) + 1\n      else:\n        arg_2 = 0\n      return arg_2\n\n    # Fixed size CLA, choose from among the cells that are below the maximum\n    # number of segments.\n    # NOTE: It is important NOT to always pick the cell with the fewest number\n    # of segments. The reason is that if we always do that, we are more likely\n    # to run into situations where we choose the same set of cell indices to\n    # represent an 'A' in both context 1 and context 2. This is because the\n    # cell indices we choose in each column of a pattern will advance in\n    # lockstep (i.e. we pick cell indices of 1, then cell indices of 2, etc.).\n    arg_3 = []\n    if arg_0.cellsPerColumn == 1:\n      arg_4 = 0\n      arg_5 = 0\n    else:\n      arg_4 = 1                      # Don't include startCell in the mix\n      arg_5 = arg_0.cellsPerColumn-1\n    for arg_2 in xrange(arg_4, arg_5+1):\n      arg_6 = len(arg_0.cells[arg_1][arg_2])\n      if arg_6 < arg_0.maxSegmentsPerCell:\n        arg_3.append(arg_2)\n\n    # If we found one, return with it. Note we need to use _random to maintain\n    # correspondence with CPP code.\n    if len(arg_3) > 0:\n      #candidateCellIdx = random.choice(candidateCellIdxs)\n      arg_7 = (\n          arg_3[arg_0._random.getUInt32(len(arg_3))])\n      if arg_0.verbosity >= 5:\n        print \"Cell [%d,%d] chosen for new segment, # of segs is %d\" % (\n            arg_1, arg_7, len(arg_0.cells[arg_1][arg_7]))\n      return arg_7\n\n    # All cells in the column are full, find a segment to free up\n    arg_8 = None\n    arg_9 = 1.0\n    # For each cell in this column\n    for arg_2 in xrange(arg_4, arg_5+1):\n      # For each segment in this cell\n      for arg_10 in arg_0.cells[arg_1][arg_2]:\n        arg_11 = arg_10.dutyCycle()\n        if arg_11 < arg_9:\n          arg_7 = arg_2\n          arg_9 = arg_11\n          arg_8 = arg_10\n\n    # Free up the least used segment\n    if arg_0.verbosity >= 5:\n      print (\"Deleting segment #%d for cell[%d,%d] to make room for new \"\n             \"segment\" % (arg_8.segID, arg_1, arg_7))\n      arg_8.debugPrint()\n    arg_0._cleanUpdatesList(arg_1, arg_7, arg_8)\n    arg_0.cells[arg_1][arg_7].remove(arg_8)\n    return arg_7", "path": "src/nupic/algorithms/backtracking_tm.py", "identifier": "BacktrackingTM._getCellForNewSegment", "docstring": "Return the index of a cell in this column which is a good candidate\n    for adding a new segment.\n\n    When we have fixed size resources in effect, we insure that we pick a\n    cell which does not already have the max number of allowed segments. If\n    none exists, we choose the least used segment in the column to re-allocate.\n\n    :param colIdx which column to look at\n    :returns: cell index", "docstring_tokens": ["Return", "the", "index", "of", "a", "cell", "in", "this", "column", "which", "is", "a", "good", "candidate", "for", "adding", "a", "new", "segment", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260753}
{"url": "https://github.com/versae/ipython-cypher/blob/1e88bd8227743e70b78af42e0e713ae8803485e1/src/cypher/run.py#L395-L422", "sha": "1e88bd8227743e70b78af42e0e713ae8803485e1", "docstring_summary": "Generates a pylab bar plot from the result set.", "language": "python", "parameters": "(self, key_word_sep=\" \", title=None, **kwargs)", "return_statement": "return plot", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "\" \"", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "not", "plt", ":", "raise", "ImportError", "(", "\"Try installing matplotlib first.\"", ")", "arg_0", ".", "guess_pie_columns", "(", "xlabel_sep", "=", "arg_1", ")", "arg_4", "=", "plt", ".", "Func", "(", "range", "(", "len", "(", "arg_0", ".", "ys", "[", "0", "]", ")", ")", ",", "arg_0", ".", "ys", "[", "0", "]", ",", "**", "arg_3", ")", "if", "arg_0", ".", "xlabels", ":", "plt", ".", "xticks", "(", "range", "(", "len", "(", "arg_0", ".", "xlabels", ")", ")", ",", "arg_0", ".", "xlabels", ",", "rotation", "=", "45", ")", "plt", ".", "xlabel", "(", "arg_0", ".", "xlabel", ")", "plt", ".", "ylabel", "(", "arg_0", ".", "ys", "[", "0", "]", ".", "name", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=\" \", arg_2=None, **arg_3):\n        \"\"\"Generates a pylab Func plot from the result set.\n\n        ``matplotlib`` must be installed, and in an\n        IPython Notebook, inlining must be on::\n\n            %%matplotlib inline\n\n        The last quantitative column is taken as the Y values;\n        all other columns are combined to label the X axis.\n\n        :param title: plot title, defaults to names of Y value columns\n        :param key_word_sep: string used to separate column values\n                             from each other in labels\n\n        Any additional keyword arguments will be passsed\n        through to ``matplotlib.pylab.Func``.\n        \"\"\"\n        if not plt:\n            raise ImportError(\"Try installing matplotlib first.\")\n        arg_0.guess_pie_columns(xlabel_sep=arg_1)\n        arg_4 = plt.Func(range(len(arg_0.ys[0])), arg_0.ys[0], **arg_3)\n        if arg_0.xlabels:\n            plt.xticks(range(len(arg_0.xlabels)), arg_0.xlabels,\n                       rotation=45)\n        plt.xlabel(arg_0.xlabel)\n        plt.ylabel(arg_0.ys[0].name)\n        return arg_4", "path": "src/cypher/run.py", "identifier": "ResultSet.bar", "docstring": "Generates a pylab bar plot from the result set.\n\n        ``matplotlib`` must be installed, and in an\n        IPython Notebook, inlining must be on::\n\n            %%matplotlib inline\n\n        The last quantitative column is taken as the Y values;\n        all other columns are combined to label the X axis.\n\n        :param title: plot title, defaults to names of Y value columns\n        :param key_word_sep: string used to separate column values\n                             from each other in labels\n\n        Any additional keyword arguments will be passsed\n        through to ``matplotlib.pylab.bar``.", "docstring_tokens": ["Generates", "a", "pylab", "bar", "plot", "from", "the", "result", "set", "."], "nwo": "versae/ipython-cypher", "score": 0.19653268135590604, "idx": 260754}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/main.py#L142-L145", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Print formatted msg if verbosity set at 1 or above.", "language": "python", "parameters": "(self, msg, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "if", "arg_0", ".", "verbosity", ">=", "1", ":", "Func", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n        \"\"\"Print formatted msg if verbosity set at 1 or above.\"\"\"\n        if arg_0.verbosity >= 1:\n            Func(arg_1, *arg_2, **arg_3)", "path": "dddp/main.py", "identifier": "DDPLauncher.print", "docstring": "Print formatted msg if verbosity set at 1 or above.", "docstring_tokens": ["Print", "formatted", "msg", "if", "verbosity", "set", "at", "1", "or", "above", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 260755}
{"url": "https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/session_matchers.py#L58-L73", "sha": "0c6ae449cc37e4445ec3cd6af95674533beedc6c", "docstring_summary": "Checks if the page has the given path.", "language": "python", "parameters": "(self, path, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "try", ":", "return", "arg_0", ".", "assert_current_path", "(", "arg_1", ",", "**", "arg_2", ")", "except", "ExpectationNotMet", ":", "return", "False"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Checks if the page has the given path.\n\n        Args:\n            path (str | RegexObject): The string or regex that the current \"path\" should match.\n            **kwargs: Arbitrary keyword arguments for :class:`CurrentPathQuery`.\n\n        Returns:\n            bool: Whether it matches.\n        \"\"\"\n\n        try:\n            return arg_0.assert_current_path(arg_1, **arg_2)\n        except ExpectationNotMet:\n            return False", "path": "capybara/session_matchers.py", "identifier": "SessionMatchersMixin.has_current_path", "docstring": "Checks if the page has the given path.\n\n        Args:\n            path (str | RegexObject): The string or regex that the current \"path\" should match.\n            **kwargs: Arbitrary keyword arguments for :class:`CurrentPathQuery`.\n\n        Returns:\n            bool: Whether it matches.", "docstring_tokens": ["Checks", "if", "the", "page", "has", "the", "given", "path", "."], "nwo": "elliterate/capybara.py", "score": 0.3154401882184106, "idx": 260756}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/cli.py#L79-L88", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Bootstrap the REPL with a few useful vars and returned the\n    bootstrapped module so it's functions can be used by the REPL\n    command.", "language": "python", "parameters": "(which_ns: str)", "return_statement": "return repl_module", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "types", ".", "ModuleType", ":", "arg_2", "=", "runtime", ".", "Namespace", ".", "get_or_create", "(", "sym", ".", "symbol", "(", "\"basilisp.repl\"", ")", ")", "arg_3", "=", "runtime", ".", "Namespace", ".", "get_or_create", "(", "sym", ".", "symbol", "(", "arg_0", ")", ")", "arg_4", "=", "importlib", ".", "import_module", "(", "\"basilisp.repl\"", ")", "arg_3", ".", "add_alias", "(", "sym", ".", "symbol", "(", "\"basilisp.repl\"", ")", ",", "arg_2", ")", "arg_3", ".", "refer_all", "(", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0: arg_1) -> types.ModuleType:\n    \"\"\"Bootstrap the REPL with a few useful vars and returned the\n    bootstrapped module so it's functions can be used by the REPL\n    command.\"\"\"\n    arg_2 = runtime.Namespace.get_or_create(sym.symbol(\"basilisp.repl\"))\n    arg_3 = runtime.Namespace.get_or_create(sym.symbol(arg_0))\n    arg_4 = importlib.import_module(\"basilisp.repl\")\n    arg_3.add_alias(sym.symbol(\"basilisp.repl\"), arg_2)\n    arg_3.refer_all(arg_2)\n    return arg_4", "path": "src/basilisp/cli.py", "identifier": "bootstrap_repl", "docstring": "Bootstrap the REPL with a few useful vars and returned the\n    bootstrapped module so it's functions can be used by the REPL\n    command.", "docstring_tokens": ["Bootstrap", "the", "REPL", "with", "a", "few", "useful", "vars", "and", "returned", "the", "bootstrapped", "module", "so", "it", "s", "functions", "can", "be", "used", "by", "the", "REPL", "command", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 260757}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L434-L455", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Send one character with the given modifiers pressed.", "language": "python", "parameters": "(self, keychr, modifiers, globally=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "if", "not", "arg_0", ".", "_isSingleCharacter", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "'Please provide only one character to send'", ")", "if", "not", "hasattr", "(", "arg_0", ",", "'keyboard'", ")", ":", "arg_0", ".", "keyboard", "=", "AXKeyboard", ".", "loadKeyboard", "(", ")", "arg_5", "=", "arg_0", ".", "_pressModifiers", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_sendKey", "(", "arg_1", ",", "arg_5", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_releaseModifiers", "(", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_0", ".", "_postQueuedEvents", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n        \"\"\"Send one character with the given modifiers pressed.\n\n        Parameters: key character, list of modifiers, global or app specific\n        Returns: None or raise ValueError exception\n        \"\"\"\n        if not arg_0._isSingleCharacter(arg_1):\n            raise ValueError('Please provide only one character to send')\n\n        if not hasattr(arg_0, 'keyboard'):\n            arg_0.keyboard = AXKeyboard.loadKeyboard()\n\n        arg_5 = arg_0._pressModifiers(arg_2, arg_3=arg_3)\n\n        # Press the non-modifier key\n        arg_0._sendKey(arg_1, arg_5, arg_3=arg_3)\n\n        # Release the modifiers\n        arg_0._releaseModifiers(arg_2, arg_3=arg_3)\n\n        # Post the queued keypresses:\n        arg_0._postQueuedEvents()", "path": "atomac/AXClasses.py", "identifier": "BaseAXUIElement._sendKeyWithModifiers", "docstring": "Send one character with the given modifiers pressed.\n\n        Parameters: key character, list of modifiers, global or app specific\n        Returns: None or raise ValueError exception", "docstring_tokens": ["Send", "one", "character", "with", "the", "given", "modifiers", "pressed", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260758}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L550-L574", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Return a list of items with given name.", "language": "python", "parameters": "(self, name, case_sensitive = True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "not", "arg_2", "and", "arg_1", ":", "arg_1", "=", "arg_1", ".", "lower", "(", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_0", ".", "_items", ":", "if", "arg_4", ".", "name", "==", "arg_1", ":", "arg_3", ".", "append", "(", "arg_4", ")", "elif", "arg_4", ".", "name", "is", "None", ":", "continue", "elif", "not", "arg_2", "and", "arg_4", ".", "name", ".", "lower", "(", ")", "==", "arg_1", ":", "arg_3", ".", "append", "(", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2 = True):\n        \"\"\"\n        Return a list of items with given name.\n\n        :Parameters:\n            - `name`: name to look-up\n            - `case_sensitive`: if `False` the matching will be case\n              insensitive.\n        :Types:\n            - `name`: `unicode`\n            - `case_sensitive`: `bool`\n\n        :Returntype: `list` of `RosterItem`\n        \"\"\"\n        if not arg_2 and arg_1:\n            arg_1 = arg_1.lower()\n        arg_3 = []\n        for arg_4 in arg_0._items:\n            if arg_4.name == arg_1:\n                arg_3.append(arg_4)\n            elif arg_4.name is None:\n                continue\n            elif not arg_2 and arg_4.name.lower() == arg_1:\n                arg_3.append(arg_4)\n        return arg_3", "path": "pyxmpp2/roster.py", "identifier": "Roster.get_items_by_name", "docstring": "Return a list of items with given name.\n\n        :Parameters:\n            - `name`: name to look-up\n            - `case_sensitive`: if `False` the matching will be case\n              insensitive.\n        :Types:\n            - `name`: `unicode`\n            - `case_sensitive`: `bool`\n\n        :Returntype: `list` of `RosterItem`", "docstring_tokens": ["Return", "a", "list", "of", "items", "with", "given", "name", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260759}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/transport.py#L419-L439", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Callback for when a new connection from this to another node is established. Handles encryption and informs the other node which node this is.\n        If encryption is disabled, this triggers the onNodeConnected callback and messages are deferred to the onMessageReceived callback.\n        If encryption is enabled, the first message is handled by _onOutgoingMessageReceived.", "language": "python", "parameters": "(self, conn)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_syncObj", ".", "encryptor", ":", "arg_1", ".", "setOnMessageReceivedCallback", "(", "functools", ".", "partial", "(", "arg_0", ".", "_onOutgoingMessageReceived", ",", "arg_1", ")", ")", "arg_1", ".", "recvRandKey", "=", "os", ".", "urandom", "(", "32", ")", "arg_1", ".", "send", "(", "arg_1", ".", "recvRandKey", ")", "else", ":", "if", "not", "arg_0", ".", "_selfIsReadonlyNode", ":", "arg_1", ".", "send", "(", "arg_0", ".", "_selfNode", ".", "address", ")", "else", ":", "arg_1", ".", "send", "(", "'readonly'", ")", "arg_0", ".", "_onNodeConnected", "(", "arg_0", ".", "_connToNode", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Callback for when a new connection from this to another node is established. Handles encryption and informs the other node which node this is.\n        If encryption is disabled, this triggers the onNodeConnected callback and messages are deferred to the onMessageReceived callback.\n        If encryption is enabled, the first message is handled by _onOutgoingMessageReceived.\n\n        :param conn: connection object\n        :type conn: TcpConnection\n        \"\"\"\n\n        if arg_0._syncObj.encryptor:\n            arg_1.setOnMessageReceivedCallback(functools.partial(arg_0._onOutgoingMessageReceived, arg_1)) # So we can process the sendRandKey\n            arg_1.recvRandKey = os.urandom(32)\n            arg_1.send(arg_1.recvRandKey)\n        else:\n            # The onMessageReceived callback is configured in addNode already.\n            if not arg_0._selfIsReadonlyNode:\n                arg_1.send(arg_0._selfNode.address)\n            else:\n                arg_1.send('readonly')\n            arg_0._onNodeConnected(arg_0._connToNode(arg_1))", "path": "pysyncobj/transport.py", "identifier": "TCPTransport._onOutgoingConnected", "docstring": "Callback for when a new connection from this to another node is established. Handles encryption and informs the other node which node this is.\n        If encryption is disabled, this triggers the onNodeConnected callback and messages are deferred to the onMessageReceived callback.\n        If encryption is enabled, the first message is handled by _onOutgoingMessageReceived.\n\n        :param conn: connection object\n        :type conn: TcpConnection", "docstring_tokens": ["Callback", "for", "when", "a", "new", "connection", "from", "this", "to", "another", "node", "is", "established", ".", "Handles", "encryption", "and", "informs", "the", "other", "node", "which", "node", "this", "is", ".", "If", "encryption", "is", "disabled", "this", "triggers", "the", "onNodeConnected", "callback", "and", "messages", "are", "deferred", "to", "the", "onMessageReceived", "callback", ".", "If", "encryption", "is", "enabled", "the", "first", "message", "is", "handled", "by", "_onOutgoingMessageReceived", "."], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 260760}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/reports.py#L238-L251", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Creates an instance of self.form_type using request.GET", "language": "python", "parameters": "(self, request)", "return_statement": "return form", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "form_type", "is", "not", "None", ":", "arg_2", "=", "arg_0", ".", "form_type", "(", "arg_1", ".", "GET", ")", "arg_2", ".", "is_valid", "(", ")", "else", ":", "arg_2", "=", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n\n        ''' Creates an instance of self.form_type using request.GET '''\n\n        # Create a form instance\n        if arg_0.form_type is not None:\n            arg_2 = arg_0.form_type(arg_1.GET)\n\n            # Pre-validate it\n            arg_2.is_valid()\n        else:\n            arg_2 = None\n\n        return arg_2", "path": "registrasion/reporting/reports.py", "identifier": "ReportView.get_form", "docstring": "Creates an instance of self.form_type using request.GET", "docstring_tokens": ["Creates", "an", "instance", "of", "self", ".", "form_type", "using", "request", ".", "GET"], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 260761}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L18-L31", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "High order function for sort methods.", "language": "python", "parameters": "(key)", "return_statement": "return sort_by", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "staticmethod", "def", "sort_by", "(", "arg_1", ",", "arg_2", "=", "False", ")", ":", "return", "sorted", "(", "arg_1", ",", "arg_0", "=", "lambda", "p", ":", "getattr", "(", "p", ",", "arg_0", ")", ",", "arg_2", "=", "arg_2", ",", ")", "return", "sort_by"], "function": "def Func(arg_0):\n    \"\"\"\n    High order function for sort methods.\n    \"\"\"\n\n    @staticmethod\n    def sort_by(arg_1, arg_2=False):\n        return sorted(\n            arg_1,\n            arg_0=lambda p: getattr(p, arg_0),\n            arg_2=arg_2,\n        )\n\n    return sort_by", "path": "pathlib_mate/mate_path_filters.py", "identifier": "_sort_by", "docstring": "High order function for sort methods.", "docstring_tokens": ["High", "order", "function", "for", "sort", "methods", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 260762}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L78-L109", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Creates a copy of the default SRM table at the specified location.", "language": "python", "parameters": "(destination=None, config='DEFAULT')", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "'DEFAULT'", ")", ":", "arg_2", "=", "read_configuration", "(", ")", "arg_3", "=", "pkgrs", ".", "resource_filename", "(", "'latools'", ",", "arg_2", "[", "'srmfile'", "]", ")", "if", "arg_0", "is", "None", ":", "arg_0", "=", "'./LAtools_'", "+", "arg_2", "[", "'config'", "]", "+", "'_SRMTable.csv'", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "arg_0", "+=", "'LAtools_'", "+", "arg_2", "[", "'config'", "]", "+", "'_SRMTable.csv'", "copyfile", "(", "arg_3", ",", "arg_0", ")", "print", "(", "arg_3", "+", "' \\n    copied to:\\n      '", "+", "arg_0", ")", "return"], "function": "def Func(arg_0=None, arg_1='DEFAULT'):\n    \"\"\"\n    Creates a copy of the default SRM table at the specified location.\n\n    Parameters\n    ----------\n    destination : str\n        The save location for the SRM file. If no location specified, \n        saves it as 'LAtools_[config]_SRMTable.csv' in the current working \n        directory.\n    config : str\n        It's possible to set up different configurations with different\n        SRM files. This specifies the name of the configuration that you \n        want to copy the SRM file from. If not specified, the 'DEFAULT'\n        configuration is used.\n    \"\"\"\n    # find SRM file from configuration    \n    arg_2 = read_configuration()\n\n    arg_3 = pkgrs.resource_filename('latools', arg_2['srmfile'])\n\n    # work out destination path (if not given)\n    if arg_0 is None:\n        arg_0 = './LAtools_' + arg_2['config'] + '_SRMTable.csv'\n    \n    if os.path.isdir(arg_0):\n        arg_0 += 'LAtools_' + arg_2['config'] + '_SRMTable.csv'\n\n    copyfile(arg_3, arg_0)\n\n    print(arg_3 + ' \\n    copied to:\\n      ' + arg_0)\n    return", "path": "latools/helpers/config.py", "identifier": "copy_SRM_file", "docstring": "Creates a copy of the default SRM table at the specified location.\n\n    Parameters\n    ----------\n    destination : str\n        The save location for the SRM file. If no location specified, \n        saves it as 'LAtools_[config]_SRMTable.csv' in the current working \n        directory.\n    config : str\n        It's possible to set up different configurations with different\n        SRM files. This specifies the name of the configuration that you \n        want to copy the SRM file from. If not specified, the 'DEFAULT'\n        configuration is used.", "docstring_tokens": ["Creates", "a", "copy", "of", "the", "default", "SRM", "table", "at", "the", "specified", "location", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 260763}
{"url": "https://github.com/techdragon/python-check-pypi-name/blob/2abfa98878755ed9073b4f5448f4380f88e3e8f3/src/check_pypi_name/__init__.py#L7-L86", "sha": "2abfa98878755ed9073b4f5448f4380f88e3e8f3", "docstring_summary": "Check if a package name exists on pypi.", "language": "python", "parameters": "(pypi_package_name, pypi_registry_host=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "'pypi.python.org'", "arg_2", "=", "bytearray", "(", "b'------------'", ")", "arg_3", "=", "ssl", ".", "create_default_context", "(", ")", "arg_4", "=", "arg_3", ".", "wrap_socket", "(", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ")", ",", "server_hostname", "=", "arg_1", ")", "arg_4", ".", "connect", "(", "(", "arg_1", ",", "443", ")", ")", "arg_4", ".", "send", "(", "b''", ".", "join", "(", "[", "b\"HEAD /simple/\"", ",", "arg_0", ".", "encode", "(", "'ascii'", ")", ",", "b\"/ HTTP/1.0\"", ",", "b\"\\r\\n\"", ",", "b\"Host: \"", ",", "arg_1", ".", "encode", "(", "'ascii'", ")", ",", "b\"\\r\\n\"", ",", "b\"\\r\\n\\r\\n\"", "]", ")", ")", "arg_4", ".", "recv_into", "(", "arg_2", ")", "if", "b'HTTP/1.1 200'", "in", "arg_2", ":", "arg_4", ".", "shutdown", "(", "1", ")", "arg_4", ".", "close", "(", ")", "return", "True", "elif", "b'HTTP/1.1 404'", "in", "arg_2", ":", "arg_4", ".", "shutdown", "(", "1", ")", "arg_4", ".", "close", "(", ")", "return", "False", "arg_5", "=", "arg_4", ".", "recv", "(", "2048", ")", "arg_6", "=", "arg_5", ".", "find", "(", "b'Location:'", ")", "+", "10", "arg_7", "=", "arg_5", ".", "find", "(", "b'\\r\\n'", ",", "arg_6", ")", "arg_8", "=", "arg_5", "[", "arg_6", ":", "arg_7", "]", "+", "b'/'", "arg_4", ".", "shutdown", "(", "1", ")", "arg_4", ".", "close", "(", ")", "arg_4", "=", "arg_3", ".", "wrap_socket", "(", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ")", ",", "server_hostname", "=", "arg_1", ")", "arg_4", ".", "connect", "(", "(", "arg_1", ",", "443", ")", ")", "arg_4", ".", "send", "(", "b''", ".", "join", "(", "[", "b\"HEAD \"", ",", "arg_8", ",", "b\" HTTP/1.0\"", ",", "b\"\\r\\n\"", ",", "b\"Host: \"", ",", "arg_1", ".", "encode", "(", "'ascii'", ")", ",", "b\"\\r\\n\"", ",", "b\"\\r\\n\\r\\n\"", "]", ")", ")", "arg_4", ".", "recv_into", "(", "arg_2", ")", "if", "b'HTTP/1.1 200'", "in", "arg_2", ":", "return", "True", "elif", "b'HTTP/1.1 404'", "in", "arg_2", ":", "return", "False", "else", ":", "NotImplementedError", "(", "'A definitive answer was not found by primary or secondary lookups.'", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Check if a package name exists on pypi.\n\n    TODO: Document the Registry URL construction.\n        It may not be obvious how pypi_package_name and pypi_registry_host are used\n        I'm appending the simple HTTP API parts of the registry standard specification.\n\n    It will return True if the package name, or any equivalent variation as defined by PEP 503 normalisation\n     rules (https://www.python.org/dev/peps/pep-0503/#normalized-names) is registered in the PyPI registry.\n\n    >>> Func('pip')\n    True\n    >>> Func('Pip')\n    True\n\n    It will return False if the package name, or any equivalent variation as defined by PEP 503 normalisation\n     rules (https://www.python.org/dev/peps/pep-0503/#normalized-names) is not registered in the PyPI registry.\n\n    >>> Func('testy_mc-test_case-has.a.cousin_who_should_never_write_a_package')\n    False\n\n    :param pypi_package_name:\n    :param pypi_registry_host:\n    :return:\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = 'pypi.python.org'\n\n    # Just a helpful reminder why this bytearray size was chosen.\n    #                            HTTP/1.1 200 OK\n    #                            HTTP/1.1 404 Not Found\n    arg_2 = bytearray(b'------------')\n    arg_3 = ssl.create_default_context()\n    arg_4 = arg_3.wrap_socket(socket.socket(socket.AF_INET), server_hostname=arg_1)\n    arg_4.connect((arg_1, 443))\n    arg_4.send(b''.join([\n        b\"HEAD /simple/\", arg_0.encode('ascii'), b\"/ HTTP/1.0\", b\"\\r\\n\",\n        b\"Host: \", arg_1.encode('ascii'), b\"\\r\\n\",\n        b\"\\r\\n\\r\\n\"\n    ]))\n    arg_4.recv_into(arg_2)\n\n    # Early return when possible.\n    if b'HTTP/1.1 200' in arg_2:\n        arg_4.shutdown(1)\n        arg_4.close()\n        return True\n    elif b'HTTP/1.1 404' in arg_2:\n        arg_4.shutdown(1)\n        arg_4.close()\n        return False\n\n    arg_5 = arg_4.recv(2048)\n    arg_6 = arg_5.find(b'Location:') + 10\n    arg_7 = arg_5.find(b'\\r\\n', arg_6)\n    # Append the trailing slash to avoid a needless extra redirect.\n    arg_8 = arg_5[arg_6:arg_7] + b'/'\n\n    arg_4.shutdown(1)\n    arg_4.close()\n\n    # Reset the bytearray to empty\n    # receive_buffer = bytearray(b'------------')\n\n    arg_4 = arg_3.wrap_socket(socket.socket(socket.AF_INET), server_hostname=arg_1)\n    arg_4.connect((arg_1, 443))\n\n    arg_4.send(b''.join([\n        b\"HEAD \", arg_8, b\" HTTP/1.0\", b\"\\r\\n\",\n        b\"Host: \", arg_1.encode('ascii'), b\"\\r\\n\",\n        b\"\\r\\n\\r\\n\"]))\n    arg_4.recv_into(arg_2)\n\n    if b'HTTP/1.1 200' in arg_2:\n        return True\n    elif b'HTTP/1.1 404' in arg_2:\n        return False\n    else:\n        NotImplementedError('A definitive answer was not found by primary or secondary lookups.')", "path": "src/check_pypi_name/__init__.py", "identifier": "check_pypi_name", "docstring": "Check if a package name exists on pypi.\n\n    TODO: Document the Registry URL construction.\n        It may not be obvious how pypi_package_name and pypi_registry_host are used\n        I'm appending the simple HTTP API parts of the registry standard specification.\n\n    It will return True if the package name, or any equivalent variation as defined by PEP 503 normalisation\n     rules (https://www.python.org/dev/peps/pep-0503/#normalized-names) is registered in the PyPI registry.\n\n    >>> check_pypi_name('pip')\n    True\n    >>> check_pypi_name('Pip')\n    True\n\n    It will return False if the package name, or any equivalent variation as defined by PEP 503 normalisation\n     rules (https://www.python.org/dev/peps/pep-0503/#normalized-names) is not registered in the PyPI registry.\n\n    >>> check_pypi_name('testy_mc-test_case-has.a.cousin_who_should_never_write_a_package')\n    False\n\n    :param pypi_package_name:\n    :param pypi_registry_host:\n    :return:", "docstring_tokens": ["Check", "if", "a", "package", "name", "exists", "on", "pypi", "."], "nwo": "techdragon/python-check-pypi-name", "score": 0.08529914490135834, "idx": 260764}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/hgnc_id.py#L1-L34", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Get the hgnc id for a gene", "language": "python", "parameters": "(gene_info, adapter)", "return_statement": "return true_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "get", "(", "'hgnc_id'", ")", "arg_3", "=", "arg_0", ".", "get", "(", "'hgnc_symbol'", ")", "arg_4", "=", "None", "if", "arg_2", ":", "arg_4", "=", "int", "(", "arg_2", ")", "else", ":", "arg_5", "=", "arg_1", ".", "hgnc_genes", "(", "arg_3", ")", "if", "arg_5", ".", "count", "(", ")", "==", "0", ":", "raise", "Exception", "(", "\"No gene could be found for {}\"", ".", "format", "(", "arg_3", ")", ")", "for", "arg_6", "in", "arg_5", ":", "if", "arg_3", ".", "upper", "(", ")", "==", "arg_6", ".", "hgnc_symbol", ".", "upper", "(", ")", ":", "arg_4", "=", "arg_6", ".", "hgnc_id", "if", "not", "arg_0", "[", "'hgnc_id'", "]", ":", "arg_4", "=", "arg_6", ".", "hgnc_id", "return", "arg_4"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Get the hgnc id for a gene\n\n        The proprity order will be\n        1. if there is a hgnc id this one will be choosen\n        2. if the hgnc symbol matches a genes proper hgnc symbol\n        3. if the symbol ony matches aliases on several genes one will be\n           choosen at random\n\n        Args:\n            gene_info(dict)\n            adapter\n\n        Returns:\n            true_id(int)\n    \"\"\"\n    arg_2 = arg_0.get('hgnc_id')\n    arg_3 = arg_0.get('hgnc_symbol')\n\n    arg_4 = None\n\n    if arg_2:\n        arg_4 = int(arg_2)\n    else:\n        arg_5 = arg_1.hgnc_genes(arg_3)\n        if arg_5.count() == 0:\n            raise Exception(\"No gene could be found for {}\".format(arg_3))\n        for arg_6 in arg_5:\n            if arg_3.upper() == arg_6.hgnc_symbol.upper():\n                arg_4 = arg_6.hgnc_id\n        if not arg_0['hgnc_id']:\n            arg_4 = arg_6.hgnc_id\n\n    return arg_4", "path": "scout/utils/hgnc_id.py", "identifier": "get_hgnc_id", "docstring": "Get the hgnc id for a gene\n\n        The proprity order will be\n        1. if there is a hgnc id this one will be choosen\n        2. if the hgnc symbol matches a genes proper hgnc symbol\n        3. if the symbol ony matches aliases on several genes one will be\n           choosen at random\n\n        Args:\n            gene_info(dict)\n            adapter\n\n        Returns:\n            true_id(int)", "docstring_tokens": ["Get", "the", "hgnc", "id", "for", "a", "gene"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260765}
{"url": "https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/build.py#L330-L341", "sha": "b7ad20fe8e7137db99a20ac06b8da26492601b00", "docstring_summary": "Returns a list of nodes that are the parents\n    from all of the nodes given as an argument.\n    This is for use in the parallel topo sort", "language": "python", "parameters": "(G, list_of_nodes)", "return_statement": "return parents", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "arg_0", ".", "predecessors", "(", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "arg_2", ".", "append", "(", "arg_5", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns a list of nodes that are the parents\n    from all of the nodes given as an argument.\n    This is for use in the parallel topo sort\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_1:\n        arg_4 = arg_0.predecessors(arg_3)\n        for arg_5 in arg_4:\n            arg_2.append(arg_5)\n    return arg_2", "path": "sakelib/build.py", "identifier": "get_direct_ancestors", "docstring": "Returns a list of nodes that are the parents\n    from all of the nodes given as an argument.\n    This is for use in the parallel topo sort", "docstring_tokens": ["Returns", "a", "list", "of", "nodes", "that", "are", "the", "parents", "from", "all", "of", "the", "nodes", "given", "as", "an", "argument", ".", "This", "is", "for", "use", "in", "the", "parallel", "topo", "sort"], "nwo": "tonyfischetti/sake", "score": 0.3086509652907828, "idx": 260766}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/segment.py#L389-L474", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Convert a lag matrix into a recurrence matrix.", "language": "python", "parameters": "(lag, axis=-1)", "return_statement": "return np.ascontiguousarray(rec.T).T", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "-", "1", ")", ":", "if", "arg_1", "not", "in", "[", "0", ",", "1", ",", "-", "1", "]", ":", "raise", "ParameterError", "(", "'Invalid target axis: {}'", ".", "format", "(", "arg_1", ")", ")", "arg_1", "=", "np", ".", "abs", "(", "arg_1", ")", "if", "arg_0", ".", "ndim", "!=", "2", "or", "(", "arg_0", ".", "shape", "[", "0", "]", "!=", "arg_0", ".", "shape", "[", "1", "]", "and", "arg_0", ".", "shape", "[", "1", "-", "arg_1", "]", "!=", "2", "*", "arg_0", ".", "shape", "[", "arg_1", "]", ")", ":", "raise", "ParameterError", "(", "'Invalid lag matrix shape: {}'", ".", "format", "(", "arg_0", ".", "shape", ")", ")", "arg_2", "=", "arg_0", ".", "shape", "[", "arg_1", "]", "arg_3", "=", "scipy", ".", "sparse", ".", "issparse", "(", "arg_0", ")", "if", "arg_3", ":", "arg_4", "=", "scipy", ".", "sparse", ".", "lil_matrix", "(", "arg_0", ")", "arg_5", "=", "1", "-", "arg_1", "else", ":", "arg_4", "=", "arg_0", ".", "copy", "(", ")", "arg_5", "=", "None", "arg_6", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_0", ".", "ndim", "for", "arg_7", "in", "range", "(", "1", ",", "arg_2", ")", ":", "arg_6", "[", "arg_1", "]", "=", "arg_7", "arg_4", "[", "arg_8", "(", "arg_6", ")", "]", "=", "util", ".", "roll_sparse", "(", "arg_0", "[", "arg_8", "(", "arg_6", ")", "]", ",", "arg_7", ",", "arg_1", "=", "arg_5", ")", "arg_9", "=", "[", "slice", "(", "None", ")", "]", "*", "arg_4", ".", "ndim", "arg_9", "[", "1", "-", "arg_1", "]", "=", "slice", "(", "arg_2", ")", "arg_4", "=", "arg_4", "[", "arg_8", "(", "arg_9", ")", "]", "if", "arg_3", ":", "return", "arg_4", ".", "asformat", "(", "arg_0", ".", "format", ")", "return", "np", ".", "ascontiguousarray", "(", "arg_4", ".", "T", ")", ".", "T"], "function": "def Func(arg_0, arg_1=-1):\n    '''Convert a lag matrix into a recurrence matrix.\n\n    Parameters\n    ----------\n    lag : np.ndarray or scipy.sparse.spmatrix\n        A lag matrix, as produced by `recurrence_to_lag`\n\n    axis : int\n        The axis corresponding to the time dimension.\n        The alternate axis will be interpreted in lag coordinates.\n\n    Returns\n    -------\n    rec : np.ndarray or scipy.sparse.spmatrix [shape=(n, n)]\n        A recurrence matrix in (time, time) coordinates\n        For sparse matrices, format will match that of `lag`.\n\n    Raises\n    ------\n    ParameterError : if `lag` does not have the correct shape\n\n    See Also\n    --------\n    recurrence_to_lag\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> mfccs = librosa.feature.mfcc(y=y, sr=sr)\n    >>> recurrence = librosa.segment.recurrence_matrix(mfccs)\n    >>> lag_pad = librosa.segment.recurrence_to_lag(recurrence, pad=True)\n    >>> lag_nopad = librosa.segment.recurrence_to_lag(recurrence, pad=False)\n    >>> rec_pad = librosa.segment.Func(lag_pad)\n    >>> rec_nopad = librosa.segment.Func(lag_nopad)\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(8, 4))\n    >>> plt.subplot(2, 2, 1)\n    >>> librosa.display.specshow(lag_pad, x_axis='time', y_axis='lag')\n    >>> plt.title('Lag (zero-padded)')\n    >>> plt.subplot(2, 2, 2)\n    >>> librosa.display.specshow(lag_nopad, x_axis='time', y_axis='time')\n    >>> plt.title('Lag (no padding)')\n    >>> plt.subplot(2, 2, 3)\n    >>> librosa.display.specshow(rec_pad, x_axis='time', y_axis='time')\n    >>> plt.title('Recurrence (with padding)')\n    >>> plt.subplot(2, 2, 4)\n    >>> librosa.display.specshow(rec_nopad, x_axis='time', y_axis='time')\n    >>> plt.title('Recurrence (without padding)')\n    >>> plt.tight_layout()\n\n    '''\n\n    if arg_1 not in [0, 1, -1]:\n        raise ParameterError('Invalid target axis: {}'.format(arg_1))\n\n    arg_1 = np.abs(arg_1)\n\n    if arg_0.ndim != 2 or (arg_0.shape[0] != arg_0.shape[1] and\n                         arg_0.shape[1 - arg_1] != 2 * arg_0.shape[arg_1]):\n        raise ParameterError('Invalid lag matrix shape: {}'.format(arg_0.shape))\n\n    # Since lag must be 2-dimensional, abs(axis) = axis\n    arg_2 = arg_0.shape[arg_1]\n\n    arg_3 = scipy.sparse.issparse(arg_0)\n    if arg_3:\n        arg_4 = scipy.sparse.lil_matrix(arg_0)\n        arg_5 = 1 - arg_1\n    else:\n        arg_4 = arg_0.copy()\n        arg_5 = None\n\n    arg_6 = [slice(None)] * arg_0.ndim\n    for arg_7 in range(1, arg_2):\n        arg_6[arg_1] = arg_7\n        arg_4[arg_8(arg_6)] = util.roll_sparse(arg_0[arg_8(arg_6)], arg_7, arg_1=arg_5)\n\n    arg_9 = [slice(None)] * arg_4.ndim\n    arg_9[1 - arg_1] = slice(arg_2)\n    arg_4 = arg_4[arg_8(arg_9)]\n\n    if arg_3:\n        return arg_4.asformat(arg_0.format)\n    return np.ascontiguousarray(arg_4.T).T", "path": "librosa/segment.py", "identifier": "lag_to_recurrence", "docstring": "Convert a lag matrix into a recurrence matrix.\n\n    Parameters\n    ----------\n    lag : np.ndarray or scipy.sparse.spmatrix\n        A lag matrix, as produced by `recurrence_to_lag`\n\n    axis : int\n        The axis corresponding to the time dimension.\n        The alternate axis will be interpreted in lag coordinates.\n\n    Returns\n    -------\n    rec : np.ndarray or scipy.sparse.spmatrix [shape=(n, n)]\n        A recurrence matrix in (time, time) coordinates\n        For sparse matrices, format will match that of `lag`.\n\n    Raises\n    ------\n    ParameterError : if `lag` does not have the correct shape\n\n    See Also\n    --------\n    recurrence_to_lag\n\n    Examples\n    --------\n    >>> y, sr = librosa.load(librosa.util.example_audio_file())\n    >>> mfccs = librosa.feature.mfcc(y=y, sr=sr)\n    >>> recurrence = librosa.segment.recurrence_matrix(mfccs)\n    >>> lag_pad = librosa.segment.recurrence_to_lag(recurrence, pad=True)\n    >>> lag_nopad = librosa.segment.recurrence_to_lag(recurrence, pad=False)\n    >>> rec_pad = librosa.segment.lag_to_recurrence(lag_pad)\n    >>> rec_nopad = librosa.segment.lag_to_recurrence(lag_nopad)\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(8, 4))\n    >>> plt.subplot(2, 2, 1)\n    >>> librosa.display.specshow(lag_pad, x_axis='time', y_axis='lag')\n    >>> plt.title('Lag (zero-padded)')\n    >>> plt.subplot(2, 2, 2)\n    >>> librosa.display.specshow(lag_nopad, x_axis='time', y_axis='time')\n    >>> plt.title('Lag (no padding)')\n    >>> plt.subplot(2, 2, 3)\n    >>> librosa.display.specshow(rec_pad, x_axis='time', y_axis='time')\n    >>> plt.title('Recurrence (with padding)')\n    >>> plt.subplot(2, 2, 4)\n    >>> librosa.display.specshow(rec_nopad, x_axis='time', y_axis='time')\n    >>> plt.title('Recurrence (without padding)')\n    >>> plt.tight_layout()", "docstring_tokens": ["Convert", "a", "lag", "matrix", "into", "a", "recurrence", "matrix", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 260767}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/mask.py#L113-L142", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Setup a mask where unmasked pixels are outside an annulus of input inner and outer arc second radii, but \\\n        within a second outer radius, and at a given centre.", "language": "python", "parameters": "(cls, shape, pixel_scale, inner_radius_arcsec, outer_radius_arcsec, outer_radius_2_arcsec,\n                              centre=(0., 0.), invert=False)", "return_statement": "return cls(array=mask.astype('bool'), pixel_scale=pixel_scale)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "(", "0.", ",", "0.", ")", ",", "arg_7", "=", "False", ")", ":", "arg_8", "=", "mask_util", ".", "mask_Func_from_shape_pixel_scale_and_radii", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "if", "arg_7", ":", "arg_8", "=", "np", ".", "invert", "(", "arg_8", ")", "return", "arg_0", "(", "array", "=", "arg_8", ".", "astype", "(", "'bool'", ")", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5,\n                              arg_6=(0., 0.), arg_7=False):\n        \"\"\"Setup a mask where unmasked pixels are outside an annulus of input inner and outer arc second radii, but \\\n        within a second outer radius, and at a given centre.\n\n        This mask there has two distinct unmasked regions (an inner circle and outer annulus), with an inner annulus \\\n        of masked pixels.\n\n        Parameters\n        ----------\n        shape : (int, int)\n            The (y,x) shape of the mask in units of pixels.\n        pixel_scale: float\n            The arc-second to pixel conversion factor of each pixel.\n        inner_radius_arcsec : float\n            The radius (in arc seconds) of the inner circle inside of which pixels are unmasked.\n        outer_radius_arcsec : float\n            The radius (in arc seconds) of the outer circle within which pixels are masked and outside of which they \\\n            are unmasked.\n        outer_radius_2_arcsec : float\n            The radius (in arc seconds) of the second outer circle within which pixels are unmasked and outside of \\\n            which they masked.\n        centre: (float, float)\n            The centre of the anti-annulus used to mask pixels.\n        \"\"\"\n        arg_8 = mask_util.mask_Func_from_shape_pixel_scale_and_radii(arg_1, arg_2, arg_3,\n                                                                                     arg_4,\n                                                                                     arg_5, arg_6)\n        if arg_7: arg_8 = np.invert(arg_8)\n        return arg_0(array=arg_8.astype('bool'), arg_2=arg_2)", "path": "autolens/data/array/mask.py", "identifier": "Mask.circular_anti_annular", "docstring": "Setup a mask where unmasked pixels are outside an annulus of input inner and outer arc second radii, but \\\n        within a second outer radius, and at a given centre.\n\n        This mask there has two distinct unmasked regions (an inner circle and outer annulus), with an inner annulus \\\n        of masked pixels.\n\n        Parameters\n        ----------\n        shape : (int, int)\n            The (y,x) shape of the mask in units of pixels.\n        pixel_scale: float\n            The arc-second to pixel conversion factor of each pixel.\n        inner_radius_arcsec : float\n            The radius (in arc seconds) of the inner circle inside of which pixels are unmasked.\n        outer_radius_arcsec : float\n            The radius (in arc seconds) of the outer circle within which pixels are masked and outside of which they \\\n            are unmasked.\n        outer_radius_2_arcsec : float\n            The radius (in arc seconds) of the second outer circle within which pixels are unmasked and outside of \\\n            which they masked.\n        centre: (float, float)\n            The centre of the anti-annulus used to mask pixels.", "docstring_tokens": ["Setup", "a", "mask", "where", "unmasked", "pixels", "are", "outside", "an", "annulus", "of", "input", "inner", "and", "outer", "arc", "second", "radii", "but", "\\", "within", "a", "second", "outer", "radius", "and", "at", "a", "given", "centre", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 260768}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/win.py#L297-L308", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "dayofweek == 0 means Sunday, whichweek 5 means last instance", "language": "python", "parameters": "(year, month, dayofweek, hour, minute, whichweek)", "return_statement": "return wd", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "datetime", ".", "datetime", "(", "arg_0", ",", "arg_1", ",", "1", ",", "arg_3", ",", "arg_4", ")", "arg_7", "=", "arg_6", ".", "replace", "(", "day", "=", "(", "(", "arg_2", "-", "arg_6", ".", "isoweekday", "(", ")", ")", "%", "7", ")", "+", "1", ")", "arg_8", "=", "arg_7", "+", "(", "(", "arg_5", "-", "1", ")", "*", "ONEWEEK", ")", "if", "(", "arg_8", ".", "month", "!=", "arg_1", ")", ":", "arg_8", "-=", "ONEWEEK", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\" dayofweek == 0 means Sunday, whichweek 5 means last instance \"\"\"\n    arg_6 = datetime.datetime(arg_0, arg_1, 1, arg_3, arg_4)\n\n    # This will work if dayofweek is ISO weekday (1-7) or Microsoft-style (0-6),\n    # Because 7 % 7 = 0\n    arg_7 = arg_6.replace(day=((arg_2 - arg_6.isoweekday()) % 7) + 1)\n    arg_8 = arg_7 + ((arg_5 - 1) * ONEWEEK)\n    if (arg_8.month != arg_1):\n        arg_8 -= ONEWEEK\n\n    return arg_8", "path": "superjson/pkg/dateutil/tz/win.py", "identifier": "picknthweekday", "docstring": "dayofweek == 0 means Sunday, whichweek 5 means last instance", "docstring_tokens": ["dayofweek", "==", "0", "means", "Sunday", "whichweek", "5", "means", "last", "instance"], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 260769}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/hds.py#L569-L616", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Returns any parameters needed for Akamai HD player verification.", "language": "python", "parameters": "(cls, session, pvswf, pv, **request_params)", "return_statement": "return params", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "try", ":", "arg_5", ",", "arg_6", "=", "arg_3", ".", "split", "(", "\";\"", ")", "except", "ValueError", ":", "arg_5", "=", "arg_3", "arg_6", "=", "\"\"", "arg_7", "=", "Cache", "(", "filename", "=", "\"stream.json\"", ")", "arg_8", "=", "\"akamaihd-player:\"", "+", "arg_2", "arg_9", "=", "arg_7", ".", "get", "(", "arg_8", ")", "arg_4", "=", "deepcopy", "(", "arg_4", ")", "arg_10", "=", "arg_4", ".", "pop", "(", "\"headers\"", ",", "{", "}", ")", "if", "arg_9", ":", "arg_10", "[", "\"If-Modified-Since\"", "]", "=", "arg_9", "[", "\"modified\"", "]", "arg_11", "=", "arg_1", ".", "http", ".", "get", "(", "arg_2", ",", "arg_10", "=", "arg_10", ",", "**", "arg_4", ")", "if", "arg_9", "and", "arg_11", ".", "status_code", "==", "304", ":", "arg_12", "=", "arg_9", "[", "\"hash\"", "]", "else", ":", "arg_12", "=", "sha256", "(", ")", "arg_12", ".", "update", "(", "swfdecompress", "(", "arg_11", ".", "content", ")", ")", "arg_12", "=", "base64", ".", "b64encode", "(", "arg_12", ".", "digest", "(", ")", ")", ".", "decode", "(", "\"ascii\"", ")", "arg_13", "=", "arg_11", ".", "headers", ".", "get", "(", "\"Last-Modified\"", ",", "\"\"", ")", "if", "len", "(", "arg_13", ")", "<", "40", ":", "arg_7", ".", "set", "(", "arg_8", ",", "dict", "(", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ")", ")", "arg_14", "=", "\"st=0~exp=9999999999~acl=*~data={0}!{1}\"", ".", "format", "(", "arg_5", ",", "arg_12", ")", "arg_15", "=", "hmac", ".", "new", "(", "AKAMAIHD_PV_KEY", ",", "arg_14", ".", "encode", "(", "\"ascii\"", ")", ",", "sha256", ")", "arg_16", "=", "\"{0}~hmac={1}\"", ".", "format", "(", "arg_14", ",", "arg_15", ".", "hexdigest", "(", ")", ")", "arg_17", "=", "[", "(", "\"pvtoken\"", ",", "arg_16", ")", "]", "arg_17", ".", "extend", "(", "parse_qsl", "(", "arg_6", ",", "keep_blank_values", "=", "True", ")", ")", "return", "arg_17"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"Returns any parameters needed for Akamai HD player verification.\n\n        Algorithm originally documented by KSV, source:\n        http://stream-recorder.com/forum/showpost.php?p=43761&postcount=13\n        \"\"\"\n\n        try:\n            arg_5, arg_6 = arg_3.split(\";\")\n        except ValueError:\n            arg_5 = arg_3\n            arg_6 = \"\"\n\n        arg_7 = Cache(filename=\"stream.json\")\n        arg_8 = \"akamaihd-player:\" + arg_2\n        arg_9 = arg_7.get(arg_8)\n\n        arg_4 = deepcopy(arg_4)\n        arg_10 = arg_4.pop(\"headers\", {})\n        if arg_9:\n            arg_10[\"If-Modified-Since\"] = arg_9[\"modified\"]\n        arg_11 = arg_1.http.get(arg_2, arg_10=arg_10, **arg_4)\n\n        if arg_9 and arg_11.status_code == 304:  # Server says not modified\n            arg_12 = arg_9[\"hash\"]\n        else:\n            # Calculate SHA-256 hash of the uncompressed SWF file, base-64\n            # encoded\n            arg_12 = sha256()\n            arg_12.update(swfdecompress(arg_11.content))\n            arg_12 = base64.b64encode(arg_12.digest()).decode(\"ascii\")\n            arg_13 = arg_11.headers.get(\"Last-Modified\", \"\")\n\n            # Only save in cache if a valid date is given\n            if len(arg_13) < 40:\n                arg_7.set(arg_8, dict(arg_12=arg_12, arg_13=arg_13))\n\n        arg_14 = \"st=0~exp=9999999999~acl=*~data={0}!{1}\".format(arg_5, arg_12)\n        arg_15 = hmac.new(AKAMAIHD_PV_KEY, arg_14.encode(\"ascii\"), sha256)\n        arg_16 = \"{0}~hmac={1}\".format(arg_14, arg_15.hexdigest())\n\n        # The \"hdntl\" parameter can be accepted as a cookie or passed in the\n        # query string, but the \"pvtoken\" parameter can only be in the query\n        # string\n        arg_17 = [(\"pvtoken\", arg_16)]\n        arg_17.extend(parse_qsl(arg_6, keep_blank_values=True))\n\n        return arg_17", "path": "src/streamlink/stream/hds.py", "identifier": "HDSStream._pv_params", "docstring": "Returns any parameters needed for Akamai HD player verification.\n\n        Algorithm originally documented by KSV, source:\n        http://stream-recorder.com/forum/showpost.php?p=43761&postcount=13", "docstring_tokens": ["Returns", "any", "parameters", "needed", "for", "Akamai", "HD", "player", "verification", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 260770}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/clipboard.py#L10-L24", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Get the current clipboard's text on Windows.", "language": "python", "parameters": "()", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "try", ":", "import", "win32clipboard", "except", "ImportError", ":", "raise", "TryNext", "(", "\"Getting text from the clipboard requires the pywin32 \"", "\"extensions: http://sourceforge.net/projects/pywin32/\"", ")", "win32clipboard", ".", "OpenClipboard", "(", ")", "arg_0", "=", "win32clipboard", ".", "GetClipboardData", "(", "win32clipboard", ".", "CF_TEXT", ")", "win32clipboard", ".", "CloseClipboard", "(", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\" Get the current clipboard's text on Windows.\n\n    Requires Mark Hammond's pywin32 extensions.\n    \"\"\"\n    try:\n        import win32clipboard\n    except ImportError:\n        raise TryNext(\"Getting text from the clipboard requires the pywin32 \"\n                      \"extensions: http://sourceforge.net/projects/pywin32/\")\n    win32clipboard.OpenClipboard()\n    arg_0 = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT)\n    # FIXME: convert \\r\\n to \\n?\n    win32clipboard.CloseClipboard()\n    return arg_0", "path": "environment/lib/python2.7/site-packages/IPython/lib/clipboard.py", "identifier": "win32_clipboard_get", "docstring": "Get the current clipboard's text on Windows.\n\n    Requires Mark Hammond's pywin32 extensions.", "docstring_tokens": ["Get", "the", "current", "clipboard", "s", "text", "on", "Windows", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260771}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L1317-L1357", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "Build the action table from the text above", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "re", "arg_0", ".", "actionList", "=", "arg_2", "=", "[", "None", "]", "*", "121", "arg_2", "[", "73", "]", "=", "\"b' the '+w+b' of the '\"", "arg_3", "=", "arg_0", ".", "actionTable", ".", "splitlines", "(", ")", "arg_4", "=", "[", "m", ".", "start", "(", ")", "for", "m", "in", "re", ".", "finditer", "(", "':'", ",", "arg_3", "[", "1", "]", ")", "]", "+", "[", "100", "]", "arg_5", "=", "[", "(", "arg_4", "[", "i", "]", "-", "3", ",", "arg_4", "[", "i", "+", "1", "]", "-", "3", ")", "for", "i", "in", "range", "(", "len", "(", "arg_4", ")", "-", "1", ")", "]", "for", "arg_6", "in", "arg_0", ".", "actionTable", ".", "splitlines", "(", "keepends", "=", "False", ")", ":", "for", "arg_7", ",", "arg_8", "in", "arg_5", ":", "arg_9", "=", "arg_6", "[", "arg_7", ":", "arg_8", "]", "if", "not", "arg_9", "or", "arg_9", ".", "isspace", "(", ")", ":", "continue", "arg_10", ",", "arg_11", ",", "arg_9", "=", "arg_9", "[", ":", "3", "]", ",", "arg_9", "[", "3", "]", ",", "arg_9", "[", "4", ":", "]", "assert", "arg_11", "==", "':'", "arg_9", "=", "arg_9", ".", "rstrip", "(", ")", "arg_9", "=", "arg_9", ".", "replace", "(", "'_'", ",", "' '", ")", "arg_12", "=", "arg_9", ".", "index", "(", "'w'", ")", "arg_9", "=", "re", ".", "sub", "(", "r\"^(.*)(?=\\+[U(]*w)\"", ",", "r\"b'\\1'\"", ",", "arg_9", ")", "arg_9", "=", "re", ".", "sub", "(", "r\"(w[[:\\-1\\]).U]*)\\+(.*)$\"", ",", "r\"\\1+b'\\2'\"", ",", "arg_9", ")", "arg_9", "=", "arg_9", ".", "replace", "(", "\".U\"", ",", "\".upper()\"", ")", "arg_2", "[", "arg_13", "(", "arg_10", ")", "]", "=", "arg_9"], "function": "def Func(arg_0):\n        \"\"\"Build the action table from the text above\n        \"\"\"\n        import re\n        arg_0.actionList = arg_2 = [None]*121\n        #Action 73, which is too long, looks like this when expanded:\n        arg_2[73] = \"b' the '+w+b' of the '\"\n        #find out what the columns are\n        arg_3 = arg_0.actionTable.splitlines()\n        arg_4 = [m.start()\n            for m in re.finditer(':',arg_3[1])\n            ]+[100]\n        arg_5 = [(arg_4[i]-3,arg_4[i+1]-3)\n            for i in range(len(arg_4)-1)]\n        for arg_6 in arg_0.actionTable.splitlines(keepends=False):\n            for arg_7,arg_8 in arg_5:\n                arg_9 = arg_6[arg_7:arg_8]\n                #skip empty actions\n                if not arg_9 or arg_9.isspace(): continue\n                #chop it up, and check if the colon is properly placed\n                arg_10, arg_11, arg_9 = arg_9[:3], arg_9[3], arg_9[4:]\n                assert arg_11==':'\n                #remove filler spaces at right\n                arg_9 = arg_9.rstrip()\n                #replace space symbols\n                arg_9 = arg_9.replace('_', ' ')\n                arg_12 = arg_9.index('w')\n                #add quotes around left string when present\n                #translation: any pattern from beginning, up to\n                #(but not including) a + following by a w later on\n                arg_9 = re.sub(r\"^(.*)(?=\\+[U(]*w)\", r\"b'\\1'\", arg_9)\n                #add quotes around right string when present\n                #translation: anything with a w in it, followed by a +\n                #and a pattern up to the end\n                #(there is no variable lookbehind assertion,\n                #so we have to copy the pattern)\n                arg_9 = re.sub(r\"(w[[:\\-1\\]).U]*)\\+(.*)$\", r\"\\1+b'\\2'\", arg_9)\n                #expand shortcut for uppercaseAll\n                arg_9 = arg_9.replace(\".U\", \".upper()\")\n                #store action\n                arg_2[arg_13(arg_10)] = arg_9", "path": "research/brotlidump.py", "identifier": "WordList.compileActions", "docstring": "Build the action table from the text above", "docstring_tokens": ["Build", "the", "action", "table", "from", "the", "text", "above"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 260772}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/runner.py#L312-L377", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Optimizes a state from an initial set of positions and radii, without\n    any known microscope parameters.", "language": "python", "parameters": "(s, max_mem=1e9, invert='guess', desc='', rz_order=3,\n        min_rad=None, max_rad=None)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1e9", ",", "arg_2", "=", "'guess'", ",", "arg_3", "=", "''", ",", "arg_4", "=", "3", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "RLOG", ".", "info", "(", "'Initial burn:'", ")", "if", "arg_3", "is", "not", "None", ":", "arg_7", "=", "arg_3", "+", "'initial-burn'", "arg_8", "=", "arg_3", "+", "'addsub-polish'", "else", ":", "arg_7", ",", "arg_8", "=", "[", "None", "]", "*", "2", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'burn'", ",", "n_loop", "=", "3", ",", "fractol", "=", "0.1", ",", "arg_3", "=", "arg_7", ",", "arg_1", "=", "arg_1", ",", "include_rad", "=", "False", ",", "dowarn", "=", "False", ")", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'burn'", ",", "n_loop", "=", "3", ",", "fractol", "=", "0.1", ",", "arg_3", "=", "arg_7", ",", "arg_1", "=", "arg_1", ",", "include_rad", "=", "True", ",", "dowarn", "=", "False", ")", "RLOG", ".", "info", "(", "'Start add-subtract'", ")", "arg_9", "=", "arg_0", ".", "obj_get_radii", "(", ")", "if", "arg_5", "is", "None", ":", "arg_5", "=", "0.5", "*", "np", ".", "median", "(", "arg_9", ")", "if", "arg_6", "is", "None", ":", "arg_6", "=", "1.5", "*", "np", ".", "median", "(", "arg_9", ")", "addsub", ".", "add_subtract", "(", "arg_0", ",", "tries", "=", "30", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "states", ".", "save", "(", "arg_0", ",", "arg_3", "=", "arg_3", "+", "'initial-addsub'", ")", "RLOG", ".", "info", "(", "'Final polish:'", ")", "arg_10", "=", "opt", ".", "burn", "(", "arg_0", ",", "mode", "=", "'polish'", ",", "n_loop", "=", "8", ",", "fractol", "=", "3e-4", ",", "arg_3", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", "arg_4", "=", "arg_4", ",", "dowarn", "=", "False", ")", "if", "not", "arg_10", "[", "'converged'", "]", ":", "RLOG", ".", "warn", "(", "'Optimization did not converge; consider re-running'", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=1e9, arg_2='guess', arg_3='', arg_4=3,\n        arg_5=None, arg_6=None):\n    \"\"\"\n    Optimizes a state from an initial set of positions and radii, without\n    any known microscope parameters.\n\n    Parameters\n    ----------\n        s : :class:`peri.states.ImageState`\n            The state to optimize. It is modified internally and returned.\n        max_mem : Numeric, optional\n            The maximum memory for the optimizer to use. Default is 1e9 (bytes)\n        invert : Bool or `'guess'`, optional\n            Set to True if the image is dark particles on a bright\n            background, False otherwise. Used for add-subtract. The\n            default is to guess from the state's current particles.\n        desc : String, optional\n            An additional description to infix for periodic saving along the\n            way. Default is the null string ``''``.\n        rz_order : int, optional\n            ``rz_order`` as passed to opt.burn. Default is 3\n        min_rad : Float or None, optional\n            The minimum radius to identify a particles as bad, as passed to\n            add-subtract. Default is None, which picks half the median radii.\n            If your sample is not monodisperse you should pick a different\n            value.\n        max_rad : Float or None, optional\n            The maximum radius to identify a particles as bad, as passed to\n            add-subtract. Default is None, which picks 1.5x the median radii.\n            If your sample is not monodisperse you should pick a different\n            value.\n\n    Returns\n    -------\n        s : :class:`peri.states.ImageState`\n            The optimized state, which is the same as the input ``s`` but\n            modified in-place.\n    \"\"\"\n    RLOG.info('Initial burn:')\n    if arg_3 is not None:\n        arg_7 = arg_3 + 'initial-burn'\n        arg_8 = arg_3 + 'addsub-polish'\n    else:\n        arg_7, arg_8 = [None] * 2\n    opt.burn(arg_0, mode='burn', n_loop=3, fractol=0.1, arg_3=arg_7,\n            arg_1=arg_1, include_rad=False, dowarn=False)\n    opt.burn(arg_0, mode='burn', n_loop=3, fractol=0.1, arg_3=arg_7,\n            arg_1=arg_1, include_rad=True, dowarn=False)\n\n    RLOG.info('Start add-subtract')\n    arg_9 = arg_0.obj_get_radii()\n    if arg_5 is None:\n        arg_5 = 0.5 * np.median(arg_9)\n    if arg_6 is None:\n        arg_6 = 1.5 * np.median(arg_9)\n    addsub.add_subtract(arg_0, tries=30, arg_5=arg_5, arg_6=arg_6,\n            arg_2=arg_2)\n    if arg_3 is not None:\n        states.save(arg_0, arg_3=arg_3 + 'initial-addsub')\n\n    RLOG.info('Final polish:')\n    arg_10 = opt.burn(arg_0, mode='polish', n_loop=8, fractol=3e-4, arg_3=arg_8,\n            arg_1=arg_1, arg_4=arg_4, dowarn=False)\n    if not arg_10['converged']:\n        RLOG.warn('Optimization did not converge; consider re-running')\n    return arg_0", "path": "peri/runner.py", "identifier": "optimize_from_initial", "docstring": "Optimizes a state from an initial set of positions and radii, without\n    any known microscope parameters.\n\n    Parameters\n    ----------\n        s : :class:`peri.states.ImageState`\n            The state to optimize. It is modified internally and returned.\n        max_mem : Numeric, optional\n            The maximum memory for the optimizer to use. Default is 1e9 (bytes)\n        invert : Bool or `'guess'`, optional\n            Set to True if the image is dark particles on a bright\n            background, False otherwise. Used for add-subtract. The\n            default is to guess from the state's current particles.\n        desc : String, optional\n            An additional description to infix for periodic saving along the\n            way. Default is the null string ``''``.\n        rz_order : int, optional\n            ``rz_order`` as passed to opt.burn. Default is 3\n        min_rad : Float or None, optional\n            The minimum radius to identify a particles as bad, as passed to\n            add-subtract. Default is None, which picks half the median radii.\n            If your sample is not monodisperse you should pick a different\n            value.\n        max_rad : Float or None, optional\n            The maximum radius to identify a particles as bad, as passed to\n            add-subtract. Default is None, which picks 1.5x the median radii.\n            If your sample is not monodisperse you should pick a different\n            value.\n\n    Returns\n    -------\n        s : :class:`peri.states.ImageState`\n            The optimized state, which is the same as the input ``s`` but\n            modified in-place.", "docstring_tokens": ["Optimizes", "a", "state", "from", "an", "initial", "set", "of", "positions", "and", "radii", "without", "any", "known", "microscope", "parameters", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260773}
{"url": "https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L603-L652", "sha": "1701526a91c14dc8ebc6452c45c8ec9a563a56db", "docstring_summary": "Render graph to stream.", "language": "python", "parameters": "(self, stream)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "option", ".", "encoding", "or", "arg_0", ".", "term", ".", "encoding", "or", "\"utf8\"", "if", "arg_0", ".", "option", ".", "color", ":", "arg_3", "=", "arg_0", ".", "color_ramp", "(", "arg_0", ".", "size", ".", "y", ")", "[", ":", ":", "-", "1", "]", "else", ":", "arg_3", "=", "None", "if", "arg_0", ".", "cycle", ">=", "1", "and", "arg_0", ".", "lines", ":", "arg_1", ".", "write", "(", "arg_0", ".", "term", ".", "csi", "(", "'cuu'", ",", "arg_0", ".", "lines", ")", ")", "arg_4", "=", "int", "(", "arg_0", ".", "null", "/", "4", ")", "arg_5", "=", "0", "for", "arg_6", "in", "range", "(", "arg_0", ".", "screen", ".", "size", ".", "y", ")", ":", "if", "arg_6", "==", "arg_4", "and", "arg_0", ".", "size", ".", "y", ">", "1", ":", "arg_1", ".", "write", "(", "arg_0", ".", "term", ".", "csi", "(", "'smul'", ")", ")", "if", "arg_3", ":", "arg_1", ".", "write", "(", "arg_3", "[", "arg_6", "]", ")", "for", "arg_7", "in", "range", "(", "arg_0", ".", "screen", ".", "size", ".", "x", ")", ":", "arg_8", "=", "Point", "(", "(", "arg_7", ",", "arg_6", ")", ")", "if", "arg_8", "in", "arg_0", ".", "screen", ":", "arg_9", "=", "arg_0", ".", "screen", "[", "arg_8", "]", "if", "isinstance", "(", "arg_9", ",", "int", ")", ":", "arg_1", ".", "write", "(", "chr", "(", "arg_0", ".", "base", "+", "arg_9", ")", ".", "encode", "(", "arg_2", ")", ")", "else", ":", "arg_1", ".", "write", "(", "arg_0", ".", "term", ".", "csi", "(", "'sgr0'", ")", ")", "arg_1", ".", "write", "(", "arg_0", ".", "term", ".", "csi_wrap", "(", "arg_9", ".", "encode", "(", "arg_2", ")", ",", "'bold'", ")", ")", "if", "arg_6", "==", "arg_4", "and", "arg_0", ".", "size", ".", "y", ">", "1", ":", "arg_1", ".", "write", "(", "arg_0", ".", "term", ".", "csi", "(", "'smul'", ")", ")", "if", "arg_3", ":", "arg_1", ".", "write", "(", "arg_3", "[", "arg_6", "]", ")", "else", ":", "arg_1", ".", "write", "(", "b' '", ")", "if", "arg_6", "==", "arg_4", "and", "arg_0", ".", "size", ".", "y", ">", "1", ":", "arg_1", ".", "write", "(", "arg_0", ".", "term", ".", "csi", "(", "'rmul'", ")", ")", "if", "arg_3", ":", "arg_1", ".", "write", "(", "arg_0", ".", "term", ".", "csi", "(", "'sgr0'", ")", ")", "arg_1", ".", "write", "(", "b'\\n'", ")", "arg_5", "+=", "1", "arg_1", ".", "flush", "(", ")", "arg_0", ".", "cycle", "=", "arg_0", ".", "cycle", "+", "1", "arg_0", ".", "lines", "=", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Render graph to stream.\"\"\"\n        arg_2 = arg_0.option.encoding or arg_0.term.encoding or \"utf8\"\n\n        if arg_0.option.color:\n            arg_3 = arg_0.color_ramp(arg_0.size.y)[::-1]\n        else:\n            arg_3 = None\n\n        if arg_0.cycle >= 1 and arg_0.lines:\n            arg_1.write(arg_0.term.csi('cuu', arg_0.lines))\n\n        arg_4 = int(arg_0.null / 4)  # Zero crossing\n        arg_5 = 0\n        for arg_6 in range(arg_0.screen.size.y):\n            if arg_6 == arg_4 and arg_0.size.y > 1:\n                arg_1.write(arg_0.term.csi('smul'))\n            if arg_3:\n                arg_1.write(arg_3[arg_6])\n\n            for arg_7 in range(arg_0.screen.size.x):\n                arg_8 = Point((arg_7, arg_6))\n                if arg_8 in arg_0.screen:\n                    arg_9 = arg_0.screen[arg_8]\n                    if isinstance(arg_9, int):\n                        arg_1.write(chr(arg_0.base + arg_9).encode(arg_2))\n                    else:\n                        arg_1.write(arg_0.term.csi('sgr0'))\n                        arg_1.write(arg_0.term.csi_wrap(\n                            arg_9.encode(arg_2),\n                            'bold'\n                        ))\n                        if arg_6 == arg_4 and arg_0.size.y > 1:\n                            arg_1.write(arg_0.term.csi('smul'))\n                        if arg_3:\n                            arg_1.write(arg_3[arg_6])\n                else:\n                    arg_1.write(b' ')\n\n            if arg_6 == arg_4 and arg_0.size.y > 1:\n                arg_1.write(arg_0.term.csi('rmul'))\n            if arg_3:\n                arg_1.write(arg_0.term.csi('sgr0'))\n\n            arg_1.write(b'\\n')\n            arg_5 += 1\n        arg_1.flush()\n\n        arg_0.cycle = arg_0.cycle + 1\n        arg_0.lines = arg_5", "path": "diagram.py", "identifier": "AxisGraph.render", "docstring": "Render graph to stream.", "docstring_tokens": ["Render", "graph", "to", "stream", "."], "nwo": "tehmaze/diagram", "score": 0.5330178463252985, "idx": 260774}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L767-L785", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Override configuration according to command line parameters", "language": "python", "parameters": "(self, args=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "with", "_patch_optparse", "(", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "sys", ".", "argv", "[", "1", ":", "]", "else", ":", "arg_1", "=", "list", "(", "arg_1", ")", "(", "arg_2", ",", "arg_1", ")", "=", "arg_0", ".", "cmdline_parser", ".", "parse_args", "(", "arg_1", "=", "arg_1", ")", "for", "arg_3", "in", "arg_0", ".", "_nocallback_options", ":", "arg_4", "=", "arg_3", ".", "config", "for", "arg_5", "in", "arg_4", ".", "__dict__", ".", "keys", "(", ")", ":", "arg_6", "=", "getattr", "(", "arg_2", ",", "arg_5", ",", "None", ")", "if", "arg_6", "is", "None", ":", "continue", "setattr", "(", "arg_4", ",", "arg_5", ",", "arg_6", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Override configuration according to command line parameters\n\n        return additional arguments\n        \"\"\"\n        with _patch_optparse():\n            if arg_1 is None:\n                arg_1 = sys.argv[1:]\n            else:\n                arg_1 = list(arg_1)\n            (arg_2, arg_1) = arg_0.cmdline_parser.parse_args(arg_1=arg_1)\n            for arg_3 in arg_0._nocallback_options:\n                arg_4 = arg_3.config\n                for arg_5 in arg_4.__dict__.keys():\n                    arg_6 = getattr(arg_2, arg_5, None)\n                    if arg_6 is None:\n                        continue\n                    setattr(arg_4, arg_5, arg_6)\n            return arg_1", "path": "pylint/config.py", "identifier": "OptionsManagerMixIn.load_command_line_configuration", "docstring": "Override configuration according to command line parameters\n\n        return additional arguments", "docstring_tokens": ["Override", "configuration", "according", "to", "command", "line", "parameters"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260775}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/glnames.py#L5186-L5207", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "dump a given encoding", "language": "python", "parameters": "( file, encoding_name, encoding_list )", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "write", "arg_3", "(", "\"  /* the following are indices into the SID name table */\\n\"", ")", "arg_3", "(", "\"  static const unsigned short  \"", "+", "arg_1", "+", "\"[\"", "+", "repr", "(", "len", "(", "arg_2", ")", ")", "+", "\"] =\\n\"", ")", "arg_3", "(", "\"  {\\n\"", ")", "arg_4", "=", "\"    \"", "arg_5", "=", "\"\"", "arg_6", "=", "0", "for", "arg_7", "in", "arg_2", ":", "arg_4", "+=", "arg_5", "arg_4", "+=", "\"%3d\"", "%", "arg_7", "arg_5", "=", "\",\"", "arg_6", "+=", "1", "if", "arg_6", "==", "16", ":", "arg_6", "=", "0", "arg_5", "=", "\",\\n    \"", "arg_3", "(", "arg_4", "+", "\"\\n  };\\n\\n\\n\"", ")"], "function": "def Func( arg_0, arg_1, arg_2 ):\n  \"\"\"dump a given encoding\"\"\"\n\n  arg_3 = arg_0.write\n  arg_3( \"  /* the following are indices into the SID name table */\\n\" )\n  arg_3( \"  static const unsigned short  \" + arg_1 +\n         \"[\" + repr( len( arg_2 ) ) + \"] =\\n\" )\n  arg_3( \"  {\\n\" )\n\n  arg_4  = \"    \"\n  arg_5 = \"\"\n  arg_6   = 0\n  for arg_7 in arg_2:\n    arg_4 += arg_5\n    arg_4 += \"%3d\" % arg_7\n    arg_5 = \",\"\n    arg_6  += 1\n    if arg_6 == 16:\n      arg_6 = 0\n      arg_5 = \",\\n    \"\n\n  arg_3( arg_4 + \"\\n  };\\n\\n\\n\" )", "path": "native/Vendor/FreeType/src/tools/glnames.py", "identifier": "dump_encoding", "docstring": "dump a given encoding", "docstring_tokens": ["dump", "a", "given", "encoding"], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 260776}
{"url": "https://github.com/MeirKriheli/django-bidi-utils/blob/48a8c481fe728fbccf486582999e79454195036e/bidiutils/templatetags/bidiutils_tags.py#L10-L42", "sha": "48a8c481fe728fbccf486582999e79454195036e", "docstring_summary": "Adds direction to the element", "language": "python", "parameters": "(value, arg=u\"rtl_only\")", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "u\"rtl_only\"", ")", ":", "if", "arg_1", "==", "u'rtl_only'", ":", "arg_2", "=", "(", "u''", ",", "u'_rtl'", ")", "elif", "arg_1", "==", "u'both'", ":", "arg_2", "=", "(", "u'_ltr'", ",", "u'_rtl'", ")", "elif", "arg_1", "==", "u'ltr_only'", ":", "arg_2", "=", "(", "u'_ltr'", ",", "u''", ")", "else", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "'Func can use arg with one of [\"rtl_only\", \"both\", \"ltr_only\"]'", ")", "arg_3", "=", "arg_0", ".", "rsplit", "(", "'.'", ",", "1", ")", "if", "not", "len", "(", "arg_3", ")", ":", "return", "arg_0", "elif", "len", "(", "arg_3", ")", "==", "1", ":", "return", "arg_0", "+", "arg_2", "[", "translation", ".", "get_language_bidi", "(", ")", "]", "else", ":", "return", "'.'", ".", "join", "(", "(", "arg_3", "[", "0", "]", "+", "arg_2", "[", "translation", ".", "get_language_bidi", "(", ")", "]", ",", "arg_3", "[", "1", "]", ")", ")"], "function": "def Func(arg_0, arg_1=u\"rtl_only\"):\n    \"\"\"Adds direction to the element\n\n    :arguments:\n        arg\n            * rtl_only: Add the direction only in case of a\n              right-to-left language (default)\n            * both: add the direction in both case\n            * ltr_only: Add the direction only in case of a\n              left-to-right language\n\n    {{image_name|Func}} when image_name is 'start_arrow.png'\n    results in 'start_arrow_rtl.png' in case of RTL language, and\n    'start_arrow.png' or 'start_arrow_ltr.png' depends on `arg` value.\n\n    \"\"\"\n\n    if arg_1 == u'rtl_only':\n        arg_2 = (u'', u'_rtl')\n    elif arg_1 == u'both':\n        arg_2 = (u'_ltr', u'_rtl')\n    elif arg_1 == u'ltr_only':\n        arg_2 = (u'_ltr', u'')\n    else:\n        raise template.TemplateSyntaxError('Func can use arg with one of [\"rtl_only\", \"both\", \"ltr_only\"]')\n\n    arg_3 = arg_0.rsplit('.', 1)\n    if not len(arg_3):\n        return arg_0\n    elif len(arg_3) == 1:\n        return arg_0 + arg_2[translation.get_language_bidi()]\n    else:\n        return '.'.join((arg_3[0]+arg_2[translation.get_language_bidi()],arg_3[1]))", "path": "bidiutils/templatetags/bidiutils_tags.py", "identifier": "add_direction", "docstring": "Adds direction to the element\n\n    :arguments:\n        arg\n            * rtl_only: Add the direction only in case of a\n              right-to-left language (default)\n            * both: add the direction in both case\n            * ltr_only: Add the direction only in case of a\n              left-to-right language\n\n    {{image_name|add_direction}} when image_name is 'start_arrow.png'\n    results in 'start_arrow_rtl.png' in case of RTL language, and\n    'start_arrow.png' or 'start_arrow_ltr.png' depends on `arg` value.", "docstring_tokens": ["Adds", "direction", "to", "the", "element"], "nwo": "MeirKriheli/django-bidi-utils", "score": 0.08529914490135834, "idx": 260777}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/menu.py#L70-L91", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Check a menu item exist.", "language": "python", "parameters": "(self, window_name, object_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_0", ".", "_get_menu_handle", "(", "arg_1", ",", "arg_2", ",", "False", ")", "return", "1", "except", "LdtpServerException", ":", "return", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Check a menu item exist.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob. Or menu heirarchy\n        @type object_name: string\n        @param strict_hierarchy: Mandate menu hierarchy if set to True\n        @type object_name: boolean\n\n        @return: 1 on success.\n        @rtype: integer\n        \"\"\"\n        try:\n            arg_3 = arg_0._get_menu_handle(arg_1, arg_2,\n                                                False)\n            return 1\n        except LdtpServerException:\n            return 0", "path": "atomac/ldtpd/menu.py", "identifier": "Menu.doesmenuitemexist", "docstring": "Check a menu item exist.\n\n        @param window_name: Window name to look for, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to look for, either full name,\n        LDTP's name convention, or a Unix glob. Or menu heirarchy\n        @type object_name: string\n        @param strict_hierarchy: Mandate menu hierarchy if set to True\n        @type object_name: boolean\n\n        @return: 1 on success.\n        @rtype: integer", "docstring_tokens": ["Check", "a", "menu", "item", "exist", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 260778}
{"url": "https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/segmaps.py#L555-L567", "sha": "786be74aa855513840113ea523c5df495dc6a8af", "docstring_summary": "Create a deep copy of the segmentation map object.", "language": "python", "parameters": "(self)", "return_statement": "return segmap", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "SegmentationMapOnImage", "(", "arg_0", ".", "arr", ",", "shape", "=", "arg_0", ".", "shape", ",", "nb_classes", "=", "arg_0", ".", "nb_classes", ")", "arg_1", ".", "input_was", "=", "arg_0", ".", "input_was", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Create a deep copy of the segmentation map object.\n\n        Returns\n        -------\n        imgaug.SegmentationMapOnImage\n            Deep copy.\n\n        \"\"\"\n        arg_1 = SegmentationMapOnImage(arg_0.arr, shape=arg_0.shape, nb_classes=arg_0.nb_classes)\n        arg_1.input_was = arg_0.input_was\n        return arg_1", "path": "imgaug/augmentables/segmaps.py", "identifier": "SegmentationMapOnImage.deepcopy", "docstring": "Create a deep copy of the segmentation map object.\n\n        Returns\n        -------\n        imgaug.SegmentationMapOnImage\n            Deep copy.", "docstring_tokens": ["Create", "a", "deep", "copy", "of", "the", "segmentation", "map", "object", "."], "nwo": "aleju/imgaug", "score": 0.9944658690072516, "idx": 260779}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/appengine.py#L730-L742", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Returns an authorized http instance.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return self.credentials.authorize(\n            transport.get_http_object(*args, **kwargs))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_0", ".", "credentials", ".", "authorize", "(", "transport", ".", "get_Func_object", "(", "*", "arg_1", ",", "**", "arg_2", ")", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Returns an authorized Func instance.\n\n        Must only be called from within an @oauth_required decorated method, or\n        from within an @oauth_aware decorated method where has_credentials()\n        returns True.\n\n        Args:\n            *args: Positional arguments passed to Funclib2.Http constructor.\n            **kwargs: Positional arguments passed to Funclib2.Http constructor.\n        \"\"\"\n        return arg_0.credentials.authorize(\n            transport.get_Func_object(*arg_1, **arg_2))", "path": "oauth2client/contrib/appengine.py", "identifier": "OAuth2Decorator.http", "docstring": "Returns an authorized http instance.\n\n        Must only be called from within an @oauth_required decorated method, or\n        from within an @oauth_aware decorated method where has_credentials()\n        returns True.\n\n        Args:\n            *args: Positional arguments passed to httplib2.Http constructor.\n            **kwargs: Positional arguments passed to httplib2.Http constructor.", "docstring_tokens": ["Returns", "an", "authorized", "http", "instance", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 260780}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kerncraft.py#L70-L80", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return datetime object of latest change in kerncraft module directory.", "language": "python", "parameters": "(dir_path=os.path.dirname(__file__))", "return_statement": "return datetime.utcfromtimestamp(max_mtime)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "arg_1", ".", "path", ".", "dirname", "(", "arg_4", ")", ")", ":", "arg_5", "=", "0", "for", "arg_6", ",", "arg_7", ",", "arg_8", "in", "arg_1", ".", "walk", "(", "arg_0", ")", ":", "for", "arg_9", "in", "arg_8", ":", "arg_10", "=", "arg_1", ".", "path", ".", "join", "(", "arg_6", ",", "arg_9", ")", "try", ":", "arg_5", "=", "max", "(", "arg_5", ",", "arg_1", ".", "stat", "(", "arg_10", ")", ".", "st_mtime", ")", "except", "FileNotFoundError", ":", "pass", "return", "datetime", ".", "utcfromtimestamp", "(", "arg_5", ")"], "function": "def Func(arg_0=arg_1.path.dirname(arg_4)):\n    \"\"\"Return datetime object of latest change in kerncraft module directory.\"\"\"\n    arg_5 = 0\n    for arg_6, arg_7, arg_8 in arg_1.walk(arg_0):\n        for arg_9 in arg_8:\n            arg_10 = arg_1.path.join(arg_6, arg_9)\n            try:\n                arg_5 = max(arg_5, arg_1.stat(arg_10).st_mtime)\n            except FileNotFoundError:\n                pass\n    return datetime.utcfromtimestamp(arg_5)", "path": "kerncraft/kerncraft.py", "identifier": "get_last_modified_datetime", "docstring": "Return datetime object of latest change in kerncraft module directory.", "docstring_tokens": ["Return", "datetime", "object", "of", "latest", "change", "in", "kerncraft", "module", "directory", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 260781}
{"url": "https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_orderedbase.py#L169-L187", "sha": "1a1ba9758651aed9c4f58384eff006d2e2ad6835", "docstring_summary": "A shallow copy of this ordered bidict.", "language": "python", "parameters": "(self)", "return_statement": "return copy", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "Func", "=", "arg_0", ".", "__class__", ".", "__new__", "(", "arg_0", ".", "__class__", ")", "arg_2", "=", "_Sentinel", "(", ")", "arg_3", "=", "arg_0", ".", "_fwdm", ".", "copy", "(", ")", "arg_4", "=", "arg_0", ".", "_invm", ".", "copy", "(", ")", "arg_5", "=", "arg_2", "arg_6", "=", "arg_2", ".", "nxt", "for", "(", "arg_7", ",", "arg_8", ")", "in", "iteritems", "(", "arg_0", ")", ":", "arg_6", "=", "_Node", "(", "arg_5", ",", "arg_2", ")", "arg_5", ".", "nxt", "=", "arg_3", "[", "arg_7", "]", "=", "arg_4", "[", "arg_8", "]", "=", "arg_6", "arg_5", "=", "arg_6", "arg_2", ".", "prv", "=", "arg_6", "Func", ".", "_sntl", "=", "arg_2", "Func", ".", "_fwdm", "=", "arg_3", "Func", ".", "_invm", "=", "arg_4", "Func", ".", "_init_inv", "(", ")", "return", "Func"], "function": "def Func(arg_0):\n        \"\"\"A shallow copy of this ordered bidict.\"\"\"\n        # Fast copy implementation bypassing __init__. See comments in :meth:`BidictBase.copy`.\n        Func = arg_0.__class__.__new__(arg_0.__class__)\n        arg_2 = _Sentinel()\n        arg_3 = arg_0._fwdm.copy()\n        arg_4 = arg_0._invm.copy()\n        arg_5 = arg_2\n        arg_6 = arg_2.nxt\n        for (arg_7, arg_8) in iteritems(arg_0):\n            arg_6 = _Node(arg_5, arg_2)\n            arg_5.nxt = arg_3[arg_7] = arg_4[arg_8] = arg_6\n            arg_5 = arg_6\n        arg_2.prv = arg_6\n        Func._sntl = arg_2  # pylint: disable=protected-access\n        Func._fwdm = arg_3  # pylint: disable=protected-access\n        Func._invm = arg_4  # pylint: disable=protected-access\n        Func._init_inv()  # pylint: disable=protected-access\n        return Func", "path": "bidict/_orderedbase.py", "identifier": "OrderedBidictBase.copy", "docstring": "A shallow copy of this ordered bidict.", "docstring_tokens": ["A", "shallow", "copy", "of", "this", "ordered", "bidict", "."], "nwo": "jab/bidict", "score": 0.5840682608785344, "idx": 260782}
{"url": "https://github.com/BioMapOrg/biomap-core/blob/63f6468ae224c663da26e2bb0aca3faab84626c3/biomap/core/mapper.py#L180-L229", "sha": "63f6468ae224c663da26e2bb0aca3faab84626c3", "docstring_summary": "The main method of this class and the essence of the package.\n        It allows to \"map\" stuff.", "language": "python", "parameters": "(self, ID_s,\n                  FROM=None,\n                  TO=None,\n                  target_as_set=False,\n                  no_match_sub=None)", "return_statement": "return Mapping(ID_s, mapped_ids)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ")", ":", "def", "io_mode", "(", "arg_1", ")", ":", "arg_6", "=", "False", "arg_7", "=", "False", "if", "isinstance", "(", "arg_1", ",", "str", ")", ":", "arg_1", "=", "[", "arg_1", "]", "arg_6", "=", "True", "elif", "isinstance", "(", "arg_1", ",", "list", ")", ":", "if", "len", "(", "arg_1", ")", ">", "0", "and", "isinstance", "(", "arg_1", "[", "0", "]", ",", "list", ")", ":", "arg_7", "=", "True", "return", "arg_1", ",", "arg_6", ",", "arg_7", "if", "arg_2", "==", "arg_3", ":", "return", "arg_1", "arg_1", ",", "arg_6", ",", "arg_7", "=", "io_mode", "(", "arg_1", ")", "if", "arg_7", ":", "arg_8", "=", "[", "arg_0", ".", "Func", "(", "ID", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "for", "ID", "in", "arg_1", "]", "else", ":", "arg_8", "=", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "if", "arg_6", ":", "return", "arg_8", "[", "0", "]", "return", "Mapping", "(", "arg_1", ",", "arg_8", ")"], "function": "def Func(arg_0, arg_1,\n                  arg_2=None,\n                  arg_3=None,\n                  arg_4=False,\n                  arg_5=None):\n        '''\n        The main method of this class and the essence of the package.\n        It allows to \"Func\" stuff.\n\n        Args:\n\n            ID_s: Nested lists with strings as leafs (plain strings also possible)\n            FROM (str): Origin key for the Funcping (default: main key)\n            TO (str): Destination key for the Funcping (default: main key)\n            target_as_set (bool): Whether to summarize the output as a set (removes duplicates)\n            no_match_sub: Object representing the status of an ID not being able to be matched\n                          (default: None)\n\n        Returns:\n\n            Mapping: a Funcping object capturing the result of the Funcping request\n        '''\n        def io_mode(arg_1):\n            '''\n            Handles the input/output modalities of the Funcping.\n            '''\n            arg_6 = False\n            arg_7 = False\n            if isinstance(arg_1, str):\n                arg_1 = [arg_1]\n                arg_6 = True\n            elif isinstance(arg_1, list):\n                if len(arg_1) > 0 and isinstance(arg_1[0], list):\n                    # assuming ID_s is a list of lists of ID strings\n                    arg_7 = True\n            return arg_1, arg_6, arg_7\n\n        # interpret input\n        if arg_2 == arg_3:\n            return arg_1\n        arg_1, arg_6, arg_7 = io_mode(arg_1)\n        # Func consistent with interpretation of input\n        if arg_7:\n            arg_8 = [arg_0.Func(ID, arg_2, arg_3, arg_4, arg_5) for ID in arg_1]\n        else:\n            arg_8 = arg_0._Func(arg_1, arg_2, arg_3, arg_4, arg_5)\n        # return consistent with interpretation of input\n        if arg_6:\n            return arg_8[0]\n        return Mapping(arg_1, arg_8)", "path": "biomap/core/mapper.py", "identifier": "Mapper.map", "docstring": "The main method of this class and the essence of the package.\n        It allows to \"map\" stuff.\n\n        Args:\n\n            ID_s: Nested lists with strings as leafs (plain strings also possible)\n            FROM (str): Origin key for the mapping (default: main key)\n            TO (str): Destination key for the mapping (default: main key)\n            target_as_set (bool): Whether to summarize the output as a set (removes duplicates)\n            no_match_sub: Object representing the status of an ID not being able to be matched\n                          (default: None)\n\n        Returns:\n\n            Mapping: a mapping object capturing the result of the mapping request", "docstring_tokens": ["The", "main", "method", "of", "this", "class", "and", "the", "essence", "of", "the", "package", ".", "It", "allows", "to", "map", "stuff", "."], "nwo": "BioMapOrg/biomap-core", "score": 0.09252797783733271, "idx": 260783}
{"url": "https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/sortabledict.py#L52-L102", "sha": "d52a7c6b5bc466f3c1a77b71814c8c0776aba995", "docstring_summary": "Add an item at a specific location, possibly replacing the\n        existing item.", "language": "python", "parameters": "(self, key, value, after=False, index=None, pos_key=None,\n            replace=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ")", ":", "if", "arg_0", ".", "_validate_fn", ":", "arg_0", ".", "_validate_fn", "(", "arg_2", ")", "if", "(", "arg_4", "is", "not", "None", ")", "and", "(", "arg_5", "is", "not", "None", ")", ":", "raise", "ValueError", "(", "'Either specify index or pos_key, not both.'", ")", "elif", "arg_5", "is", "not", "None", ":", "try", ":", "arg_4", "=", "arg_0", ".", "index", "(", "arg_5", ")", "except", "ValueError", ":", "raise", "KeyError", "(", "'%r not found'", "%", "arg_5", ")", "if", "arg_3", "and", "(", "arg_4", "is", "not", "None", ")", ":", "arg_4", "+=", "1", "if", "arg_1", "in", "arg_0", ".", "_values", ":", "if", "not", "arg_6", ":", "raise", "KeyError", "(", "'%r is duplicate'", "%", "arg_1", ")", "if", "arg_4", "is", "not", "None", ":", "del", "arg_0", "[", "arg_1", "]", "else", ":", "arg_0", ".", "_values", "[", "arg_1", "]", "=", "arg_2", "return", "if", "arg_4", "is", "not", "None", ":", "arg_0", ".", "_order", ".", "insert", "(", "arg_4", ",", "arg_1", ")", "else", ":", "arg_0", ".", "_order", ".", "append", "(", "arg_1", ")", "arg_0", ".", "_values", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=None, arg_5=None,\n            arg_6=True):\n        \"\"\"\n        Add an item at a specific location, possibly replacing the\n        existing item.\n\n        If after is True, we insert *after* the given index, otherwise we\n        insert before.\n\n        The position is specified using either index or pos_key, the former\n        specifies the position from the start of the array (base 0).  pos_key\n        specifies the name of another key, and positions the new key relative\n        to that key.\n\n        When replacing, the position will be left un-changed unless a location\n        is specified explicitly.\n        \"\"\"\n        if arg_0._validate_fn:\n            arg_0._validate_fn(arg_2)\n\n        if (arg_4 is not None) and (arg_5 is not None):\n            raise ValueError('Either specify index or pos_key, not both.')\n        elif arg_5 is not None:\n            try:\n                arg_4 = arg_0.index(arg_5)\n            except ValueError:\n                raise KeyError('%r not found' % arg_5)\n\n        if arg_3 and (arg_4 is not None):\n            # insert inserts *before* index, so increment by one.\n            arg_4 += 1\n\n        if arg_1 in arg_0._values:\n            if not arg_6:\n                raise KeyError('%r is duplicate' % arg_1)\n\n            if arg_4 is not None:\n                # We are re-locating.\n                del arg_0[arg_1]\n            else:\n                # We are updating\n                arg_0._values[arg_1] = arg_2\n                return\n\n        if arg_4 is not None:\n            # Place at given position\n            arg_0._order.insert(arg_4, arg_1)\n        else:\n            # Place at end\n            arg_0._order.append(arg_1)\n        arg_0._values[arg_1] = arg_2", "path": "hszinc/sortabledict.py", "identifier": "SortableDict.add_item", "docstring": "Add an item at a specific location, possibly replacing the\n        existing item.\n\n        If after is True, we insert *after* the given index, otherwise we\n        insert before.\n\n        The position is specified using either index or pos_key, the former\n        specifies the position from the start of the array (base 0).  pos_key\n        specifies the name of another key, and positions the new key relative\n        to that key.\n\n        When replacing, the position will be left un-changed unless a location\n        is specified explicitly.", "docstring_tokens": ["Add", "an", "item", "at", "a", "specific", "location", "possibly", "replacing", "the", "existing", "item", "."], "nwo": "vrtsystems/hszinc", "score": 0.2823188883832642, "idx": 260784}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L432-L443", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Record the first non-junk token at the start of a line.", "language": "python", "parameters": "(self, pos)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_line_start", ">", "-", "1", ":", "return", "arg_2", "=", "arg_1", "if", "arg_0", ".", "_tokens", ".", "token", "(", "arg_1", ")", "==", "_ASYNC_TOKEN", ":", "arg_2", "+=", "1", "arg_0", ".", "_is_block_opener", "=", "(", "arg_0", ".", "_tokens", ".", "token", "(", "arg_2", ")", "in", "_CONTINUATION_BLOCK_OPENERS", ")", "arg_0", ".", "_line_start", "=", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Record the first non-junk token at the start of a line.\"\"\"\n        if arg_0._line_start > -1:\n            return\n\n        arg_2 = arg_1\n        if arg_0._tokens.token(arg_1) == _ASYNC_TOKEN:\n            arg_2 += 1\n        arg_0._is_block_opener = (\n            arg_0._tokens.token(arg_2) in _CONTINUATION_BLOCK_OPENERS\n        )\n        arg_0._line_start = arg_1", "path": "pylint/checkers/format.py", "identifier": "ContinuedLineState.handle_line_start", "docstring": "Record the first non-junk token at the start of a line.", "docstring_tokens": ["Record", "the", "first", "non", "-", "junk", "token", "at", "the", "start", "of", "a", "line", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260785}
{"url": "https://github.com/myint/language-check/blob/58e419833ef28a9193fcaa21193616a8a14504a9/setup.py#L391-L444", "sha": "58e419833ef28a9193fcaa21193616a8a14504a9", "docstring_summary": "Write Python 2 shebang and add encoding cookie if needed.", "language": "python", "parameters": "(file_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_0", "=", "[", "arg_0", "]", "arg_1", "=", "re", ".", "compile", "(", "br\"^(#!.*\\bpython)(.*)([\\r\\n]+)$\"", ")", "arg_2", "=", "re", ".", "compile", "(", "br\"coding[:=]\\s*([-\\w.]+)\"", ")", "arg_3", "=", "re", ".", "compile", "(", "br\"([\\r\\n]+)$\"", ")", "arg_4", "=", "LooseVersion", "(", "'3'", ")", "for", "arg_5", "in", "arg_0", ":", "if", "not", "os", ".", "path", ".", "getsize", "(", "arg_5", ")", ":", "continue", "arg_6", "=", "False", "arg_7", "=", "False", "arg_8", "=", "False", "arg_9", "=", "[", "]", "arg_10", "=", "open", "(", "arg_5", ",", "'rb'", ")", "try", ":", "while", "len", "(", "arg_9", ")", "<", "2", ":", "arg_11", "=", "arg_10", ".", "readline", "(", ")", "arg_12", "=", "arg_1", ".", "match", "(", "arg_11", ")", "if", "arg_12", ":", "arg_7", "=", "True", "arg_13", "=", "LooseVersion", "(", "arg_12", ".", "group", "(", "2", ")", ".", "decode", "(", ")", "or", "'2'", ")", "try", ":", "arg_14", "=", "arg_13", ">=", "arg_4", "except", "TypeError", ":", "arg_14", "=", "True", "if", "arg_14", ":", "arg_11", "=", "arg_1", ".", "sub", "(", "br\"\\g<1>2\\g<3>\"", ",", "arg_11", ")", "arg_6", "=", "True", "elif", "arg_2", ".", "search", "(", "arg_11", ")", ":", "arg_8", "=", "True", "arg_9", ".", "append", "(", "arg_11", ")", "if", "not", "arg_8", ":", "arg_12", "=", "arg_3", ".", "search", "(", "arg_9", "[", "0", "]", ")", "arg_15", "=", "arg_12", ".", "group", "(", "1", ")", "if", "arg_12", "else", "b\"\\n\"", "arg_11", "=", "b\"# -*- coding: utf-8 -*-\"", "+", "arg_15", "arg_9", ".", "insert", "(", "1", "if", "arg_7", "else", "0", ",", "arg_11", ")", "arg_6", "=", "True", "if", "arg_6", ":", "arg_9", "+=", "arg_10", ".", "readlines", "(", ")", "finally", ":", "arg_10", ".", "close", "(", ")", "if", "arg_6", ":", "arg_10", "=", "open", "(", "arg_5", ",", "'wb'", ")", "try", ":", "arg_10", ".", "writelines", "(", "arg_9", ")", "finally", ":", "arg_10", ".", "close", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"Write Python 2 shebang and add encoding cookie if needed.\"\"\"\n    if not isinstance(arg_0, list):\n        arg_0 = [arg_0]\n\n    arg_1 = re.compile(br\"^(#!.*\\bpython)(.*)([\\r\\n]+)$\")\n    arg_2 = re.compile(br\"coding[:=]\\s*([-\\w.]+)\")\n    arg_3 = re.compile(br\"([\\r\\n]+)$\")\n    arg_4 = LooseVersion('3')\n\n    for arg_5 in arg_0:\n        if not os.path.getsize(arg_5):\n            continue\n\n        arg_6 = False\n        arg_7 = False\n        arg_8 = False\n        arg_9 = []\n\n        arg_10 = open(arg_5, 'rb')\n        try:\n            while len(arg_9) < 2:\n                arg_11 = arg_10.readline()\n                arg_12 = arg_1.match(arg_11)\n                if arg_12:\n                    arg_7 = True\n                    arg_13 = LooseVersion(arg_12.group(2).decode() or '2')\n                    try:\n                        arg_14 = arg_13 >= arg_4\n                    except TypeError:\n                        arg_14 = True\n                    if arg_14:\n                        arg_11 = arg_1.sub(br\"\\g<1>2\\g<3>\", arg_11)\n                        arg_6 = True\n                elif arg_2.search(arg_11):\n                    arg_8 = True\n                arg_9.append(arg_11)\n            if not arg_8:\n                arg_12 = arg_3.search(arg_9[0])\n                arg_15 = arg_12.group(1) if arg_12 else b\"\\n\"\n                arg_11 = b\"# -*- coding: utf-8 -*-\" + arg_15\n                arg_9.insert(1 if arg_7 else 0, arg_11)\n                arg_6 = True\n            if arg_6:\n                arg_9 += arg_10.readlines()\n        finally:\n            arg_10.close()\n\n        if arg_6:\n            arg_10 = open(arg_5, 'wb')\n            try:\n                arg_10.writelines(arg_9)\n            finally:\n                arg_10.close()", "path": "setup.py", "identifier": "write_py2k_header", "docstring": "Write Python 2 shebang and add encoding cookie if needed.", "docstring_tokens": ["Write", "Python", "2", "shebang", "and", "add", "encoding", "cookie", "if", "needed", "."], "nwo": "myint/language-check", "score": 0.7367171749390385, "idx": 260786}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gerrit.py#L368-L388", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Return the item to start from in next reviews group.", "language": "python", "parameters": "(self, last_item=None, entry=None)", "return_statement": "return next_item", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "None", "arg_4", "=", "arg_0", ".", "version", "if", "arg_4", "[", "0", "]", "==", "2", "and", "arg_4", "[", "1", "]", ">", "9", ":", "if", "arg_1", "is", "None", ":", "arg_3", "=", "0", "else", ":", "arg_3", "=", "arg_1", "elif", "arg_4", "[", "0", "]", "==", "2", "and", "arg_4", "[", "1", "]", "==", "9", ":", "arg_5", "=", "\"Gerrit 2.9.0 does not support pagination\"", "raise", "BackendError", "(", "arg_5", "=", "arg_5", ")", "else", ":", "if", "arg_2", "is", "not", "None", ":", "arg_3", "=", "arg_2", "[", "'sortKey'", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Return the item to start from in next reviews group.\"\"\"\n\n        arg_3 = None\n\n        arg_4 = arg_0.version\n\n        if arg_4[0] == 2 and arg_4[1] > 9:\n            if arg_1 is None:\n                arg_3 = 0\n            else:\n                arg_3 = arg_1\n        elif arg_4[0] == 2 and arg_4[1] == 9:\n            # https://groups.google.com/forum/#!topic/repo-discuss/yQgRR5hlS3E\n            arg_5 = \"Gerrit 2.9.0 does not support pagination\"\n            raise BackendError(arg_5=arg_5)\n        else:\n            if arg_2 is not None:\n                arg_3 = arg_2['sortKey']\n\n        return arg_3", "path": "perceval/backends/core/gerrit.py", "identifier": "GerritClient.next_retrieve_group_item", "docstring": "Return the item to start from in next reviews group.", "docstring_tokens": ["Return", "the", "item", "to", "start", "from", "in", "next", "reviews", "group", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260787}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1886-L1910", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Gets the predicted field and it's datatype from the options dictionary", "language": "python", "parameters": "(options)", "return_statement": "return predictedField, predictedFieldType", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", "[", "'inferenceArgs'", "]", "or", "not", "arg_0", "[", "'inferenceArgs'", "]", "[", "'predictedField'", "]", ":", "return", "None", ",", "None", "arg_1", "=", "arg_0", "[", "'inferenceArgs'", "]", "[", "'predictedField'", "]", "arg_2", "=", "None", "arg_3", "=", "arg_0", "[", "'includedFields'", "]", "for", "arg_4", "in", "arg_3", ":", "if", "arg_4", "[", "'fieldName'", "]", "==", "arg_1", ":", "arg_2", "=", "arg_4", "break", "if", "arg_2", "is", "None", ":", "raise", "ValueError", "(", "\"Predicted field '%s' does not exist in included fields.\"", "%", "arg_1", ")", "arg_5", "=", "arg_2", "[", "'fieldType'", "]", "return", "arg_1", ",", "arg_5"], "function": "def Func(arg_0):\n  \"\"\" Gets the predicted field and it's datatype from the options dictionary\n\n  Returns: (predictedFieldName, predictedFieldType)\n  \"\"\"\n  if not arg_0['inferenceArgs'] or \\\n      not arg_0['inferenceArgs']['predictedField']:\n    return None, None\n\n  arg_1 = arg_0['inferenceArgs']['predictedField']\n  arg_2 = None\n  arg_3 = arg_0['includedFields']\n\n  for arg_4 in arg_3:\n    if arg_4['fieldName'] == arg_1:\n      arg_2 = arg_4\n      break\n\n  if arg_2 is None:\n    raise ValueError(\n      \"Predicted field '%s' does not exist in included fields.\" % arg_1\n    )\n  arg_5 = arg_2['fieldType']\n\n  return arg_1, arg_5", "path": "src/nupic/swarming/exp_generator/experiment_generator.py", "identifier": "_getPredictedField", "docstring": "Gets the predicted field and it's datatype from the options dictionary\n\n  Returns: (predictedFieldName, predictedFieldType)", "docstring_tokens": ["Gets", "the", "predicted", "field", "and", "it", "s", "datatype", "from", "the", "options", "dictionary"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260788}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1462-L1472", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Returns the text of the line of the input buffer that contains the\n            cursor, or None if there is no such line.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_get_input_buffer_cursor_prompt", "(", ")", "if", "arg_1", "is", "None", ":", "return", "None", "else", ":", "arg_2", "=", "arg_0", ".", "_control", ".", "textCursor", "(", ")", "arg_3", "=", "arg_0", ".", "_get_block_plain_text", "(", "arg_2", ".", "block", "(", ")", ")", "return", "arg_3", "[", "len", "(", "arg_1", ")", ":", "]"], "function": "def Func(arg_0):\n        \"\"\" Returns the text of the line of the input buffer that contains the\n            cursor, or None if there is no such line.\n        \"\"\"\n        arg_1 = arg_0._get_input_buffer_cursor_prompt()\n        if arg_1 is None:\n            return None\n        else:\n            arg_2 = arg_0._control.textCursor()\n            arg_3 = arg_0._get_block_plain_text(arg_2.block())\n            return arg_3[len(arg_1):]", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._get_input_buffer_cursor_line", "docstring": "Returns the text of the line of the input buffer that contains the\n            cursor, or None if there is no such line.", "docstring_tokens": ["Returns", "the", "text", "of", "the", "line", "of", "the", "input", "buffer", "that", "contains", "the", "cursor", "or", "None", "if", "there", "is", "no", "such", "line", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260789}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L123-L150", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Search for a plugin", "language": "python", "parameters": "(self, what, name=None, version=None)", "return_statement": "return filtered", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "{", "}", "if", "arg_1", "is", "None", ":", "arg_5", "=", "list", "(", "arg_0", ".", "plugins", ".", "keys", "(", ")", ")", "elif", "arg_1", "is", "not", "None", ":", "if", "arg_1", "not", "in", "arg_0", ".", "plugins", ":", "raise", "Exception", "(", "\"Unknown class of plugins\"", ")", "arg_5", "=", "[", "arg_1", "]", "for", "arg_1", "in", "arg_5", ":", "if", "arg_1", "not", "in", "arg_4", ":", "arg_4", "[", "arg_1", "]", "=", "[", "]", "for", "arg_6", "in", "arg_0", ".", "plugins", "[", "arg_1", "]", ".", "keys", "(", ")", ":", "(", "arg_7", ",", "arg_8", ")", "=", "arg_6", "if", "arg_2", "is", "not", "None", "and", "arg_7", "!=", "arg_2", ":", "continue", "if", "arg_3", "is", "not", "None", "and", "arg_8", "!=", "arg_3", ":", "continue", "if", "arg_0", ".", "plugins", "[", "arg_1", "]", "[", "arg_6", "]", ".", "enable", "==", "'n'", ":", "continue", "arg_4", "[", "arg_1", "]", ".", "append", "(", "arg_6", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"\n        Search for a plugin\n        \"\"\"\n        arg_4 = {}\n\n        # The Func may for a scan (what is None) or\n        if arg_1 is None:\n            arg_5 = list(arg_0.plugins.keys())\n        elif arg_1 is not None:\n            if arg_1 not in arg_0.plugins:\n                raise Exception(\"Unknown class of plugins\")\n            arg_5 = [arg_1]\n        for arg_1 in arg_5:\n            if arg_1 not in arg_4:\n                arg_4[arg_1] = []\n            for arg_6 in arg_0.plugins[arg_1].keys():\n                (arg_7, arg_8) = arg_6\n                if arg_2 is not None and arg_7 != arg_2:\n                    continue\n                if arg_3 is not None and arg_8 != arg_3:\n                    continue\n                if arg_0.plugins[arg_1][arg_6].enable == 'n':\n                    continue\n                arg_4[arg_1].append(arg_6)\n\n        # print(filtered)\n        return arg_4", "path": "dgitcore/plugins/common.py", "identifier": "PluginManager.search", "docstring": "Search for a plugin", "docstring_tokens": ["Search", "for", "a", "plugin"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 260790}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_format.py#L713-L756", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "used by recursive functions to specify which level to turn a bool on in\n    counting down yields True, True, ..., False\n    counting up yields False, False, False, ... True", "language": "python", "parameters": "(count_or_bool)", "return_statement": "return count_or_bool_", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", "is", "True", "or", "arg_0", "is", "False", ":", "arg_1", "=", "arg_0", "elif", "isinstance", "(", "arg_0", ",", "int", ")", ":", "if", "arg_0", "==", "0", ":", "return", "0", "elif", "arg_0", ">", "0", ":", "arg_1", "=", "arg_0", "-", "1", "else", ":", "arg_1", "=", "arg_0", "else", ":", "arg_1", "=", "False", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    used by recursive functions to specify which level to turn a bool on in\n    counting down yields True, True, ..., False\n    counting up yields False, False, False, ... True\n\n    Args:\n        count_or_bool (bool or int): if positive and an integer, it will count\n            down, otherwise it will remain the same.\n\n    Returns:\n        int or bool: count_or_bool_\n\n    CommandLine:\n        python -m utool.util_str --test-Func\n\n    Example:\n        >>> from ubelt.util_format import Func  # NOQA\n        >>> count_or_bool = True\n        >>> a1 = (Func(2))\n        >>> a2 = (Func(1))\n        >>> a3 = (Func(0))\n        >>> a4 = (Func(-1))\n        >>> a5 = (Func(-2))\n        >>> a6 = (Func(True))\n        >>> a7 = (Func(False))\n        >>> a8 = (Func(None))\n        >>> result = [a1, a2, a3, a4, a5, a6, a7, a8]\n        >>> print(result)\n        [1, 0, 0, -1, -2, True, False, False]\n    \"\"\"\n    if arg_0 is True or arg_0 is False:\n        arg_1 = arg_0\n    elif isinstance(arg_0, int):\n        if arg_0 == 0:\n            return 0\n        elif arg_0 > 0:\n            arg_1 = arg_0 - 1\n        else:\n            # We dont countup negatives anymore\n            arg_1 = arg_0\n    else:\n        arg_1 = False\n    return arg_1", "path": "ubelt/util_format.py", "identifier": "_rectify_countdown_or_bool", "docstring": "used by recursive functions to specify which level to turn a bool on in\n    counting down yields True, True, ..., False\n    counting up yields False, False, False, ... True\n\n    Args:\n        count_or_bool (bool or int): if positive and an integer, it will count\n            down, otherwise it will remain the same.\n\n    Returns:\n        int or bool: count_or_bool_\n\n    CommandLine:\n        python -m utool.util_str --test-_rectify_countdown_or_bool\n\n    Example:\n        >>> from ubelt.util_format import _rectify_countdown_or_bool  # NOQA\n        >>> count_or_bool = True\n        >>> a1 = (_rectify_countdown_or_bool(2))\n        >>> a2 = (_rectify_countdown_or_bool(1))\n        >>> a3 = (_rectify_countdown_or_bool(0))\n        >>> a4 = (_rectify_countdown_or_bool(-1))\n        >>> a5 = (_rectify_countdown_or_bool(-2))\n        >>> a6 = (_rectify_countdown_or_bool(True))\n        >>> a7 = (_rectify_countdown_or_bool(False))\n        >>> a8 = (_rectify_countdown_or_bool(None))\n        >>> result = [a1, a2, a3, a4, a5, a6, a7, a8]\n        >>> print(result)\n        [1, 0, 0, -1, -2, True, False, False]", "docstring_tokens": ["used", "by", "recursive", "functions", "to", "specify", "which", "level", "to", "turn", "a", "bool", "on", "in", "counting", "down", "yields", "True", "True", "...", "False", "counting", "up", "yields", "False", "False", "False", "...", "True"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 260791}
{"url": "https://github.com/makearl/tornado-profile/blob/1b721480d7edc6229f991469e88b9f7a8bb914f3/tornado_profile.py#L42-L68", "sha": "1b721480d7edc6229f991469e88b9f7a8bb914f3", "docstring_summary": "Return profiler statistics.", "language": "python", "parameters": "(sort=\"cum_time\", count=20, strip_dirs=True)", "return_statement": "return sorted(json_stats, key=itemgetter(sort), reverse=True)[:count]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "\"cum_time\"", ",", "arg_1", "=", "20", ",", "arg_2", "=", "True", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "yappi", ".", "convert2pstats", "(", "yappi", ".", "get_func_stats", "(", ")", ")", "if", "arg_2", ":", "arg_4", ".", "strip_dirs", "(", ")", "for", "arg_5", ",", "arg_6", "in", "arg_4", ".", "stats", ".", "iteritems", "(", ")", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "arg_5", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", "=", "arg_6", "arg_3", ".", "append", "(", "{", "\"path\"", ":", "arg_7", ",", "\"line\"", ":", "arg_8", ",", "\"func_name\"", ":", "arg_9", ",", "\"num_calls\"", ":", "arg_11", ",", "\"total_time\"", ":", "arg_12", ",", "\"total_time_per_call\"", ":", "arg_12", "/", "arg_11", "if", "arg_12", "else", "0", ",", "\"cum_time\"", ":", "arg_13", ",", "\"cum_time_per_call\"", ":", "arg_13", "/", "arg_11", "if", "arg_13", "else", "0", "}", ")", "return", "sorted", "(", "arg_3", ",", "key", "=", "itemgetter", "(", "arg_0", ")", ",", "reverse", "=", "True", ")", "[", ":", "arg_1", "]"], "function": "def Func(arg_0=\"cum_time\", arg_1=20, arg_2=True):\n    \"\"\"Return profiler statistics.\n\n    :param str sort: dictionary key to sort by\n    :param int|None count: the number of results to return, None returns all results.\n    :param bool strip_dirs: if True strip the directory, otherwise return the full path\n    \"\"\"\n    arg_3 = []\n    arg_4 = yappi.convert2pstats(yappi.get_func_stats())\n    if arg_2:\n        arg_4.strip_dirs()\n\n    for arg_5, arg_6 in arg_4.stats.iteritems():\n        arg_7, arg_8, arg_9 = arg_5\n        arg_10, arg_11, arg_12, arg_13, arg_14 = arg_6\n        arg_3.append({\n            \"path\": arg_7,\n            \"line\": arg_8,\n            \"func_name\": arg_9,\n            \"num_calls\": arg_11,\n            \"total_time\": arg_12,\n            \"total_time_per_call\": arg_12/arg_11 if arg_12 else 0,\n            \"cum_time\": arg_13,\n            \"cum_time_per_call\": arg_13/arg_11 if arg_13 else 0\n        })\n\n    return sorted(arg_3, key=itemgetter(arg_0), reverse=True)[:arg_1]", "path": "tornado_profile.py", "identifier": "get_profiler_statistics", "docstring": "Return profiler statistics.\n\n    :param str sort: dictionary key to sort by\n    :param int|None count: the number of results to return, None returns all results.\n    :param bool strip_dirs: if True strip the directory, otherwise return the full path", "docstring_tokens": ["Return", "profiler", "statistics", "."], "nwo": "makearl/tornado-profile", "score": 0.17553651708052445, "idx": 260792}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/plotters/array_plotters.py#L166-L216", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Open a matplotlib figure and plot the array of data on it.", "language": "python", "parameters": "(array, as_subplot, units, kpc_per_arcsec, figsize, aspect, cmap, norm, norm_min, norm_max,\n                linthresh, linscale, xticks_manual, yticks_manual)", "return_statement": "return fig", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ")", ":", "arg_14", "=", "plotter_util", ".", "setup_figure", "(", "arg_4", "=", "arg_4", ",", "arg_1", "=", "arg_1", ")", "arg_8", ",", "arg_9", "=", "get_normalization_min_max", "(", "arg_0", "=", "arg_0", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ")", "arg_15", "=", "get_normalization_scale", "(", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ")", "arg_16", "=", "get_extent", "(", "arg_0", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_12", "=", "arg_12", ",", "arg_13", "=", "arg_13", ")", "plt", ".", "imshow", "(", "arg_0", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_15", ",", "arg_16", "=", "arg_16", ")", "return", "arg_14"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9,\n                arg_10, arg_11, arg_12, arg_13):\n    \"\"\"Open a matplotlib figure and plot the array of data on it.\n\n    Parameters\n    -----------\n    array : data.array.scaled_array.ScaledArray\n        The 2D array of data which is plotted.\n    as_subplot : bool\n        Whether the array is plotted as part of a subplot, in which case the grid figure is not opened / closed.\n    units : str\n        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').\n    kpc_per_arcsec : float or None\n        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.\n    figsize : (int, int)\n        The size of the figure in (rows, columns).\n    aspect : str\n        The aspect ratio of the array, specifically whether it is forced to be square ('equal') or adapts its size to \\\n        the figure size ('auto').\n    cmap : str\n        The colormap the array is plotted using, which may be chosen from the standard matplotlib colormaps.\n    norm : str\n        The normalization of the colormap used to plot the image, specifically whether it is linear ('linear'), log \\\n        ('log') or a symmetric log normalization ('symmetric_log').\n    norm_min : float or None\n        The minimum array value the colormap map spans (all values below this value are plotted the same color).\n    norm_max : float or None\n        The maximum array value the colormap map spans (all values above this value are plotted the same color).\n    linthresh : float\n        For the 'symmetric_log' colormap normalization ,this specifies the range of values within which the colormap \\\n        is linear.\n    linscale : float\n        For the 'symmetric_log' colormap normalization, this allowws the linear range set by linthresh to be stretched \\\n        relative to the logarithmic range.\n    xticks_manual :  [] or None\n        If input, the xticks do not use the array's default xticks but instead overwrite them as these values.\n    yticks_manual :  [] or None\n        If input, the yticks do not use the array's default yticks but instead overwrite them as these values.\n    \"\"\"\n\n    arg_14 = plotter_util.setup_figure(arg_4=arg_4, arg_1=arg_1)\n\n    arg_8, arg_9 = get_normalization_min_max(arg_0=arg_0, arg_8=arg_8, arg_9=arg_9)\n    arg_15 = get_normalization_scale(arg_7=arg_7, arg_8=arg_8, arg_9=arg_9,\n                                         arg_10=arg_10, arg_11=arg_11)\n\n    arg_16 = get_extent(arg_0=arg_0, arg_2=arg_2, arg_3=arg_3,\n                        arg_12=arg_12, arg_13=arg_13)\n\n    plt.imshow(arg_0, arg_5=arg_5, arg_6=arg_6, arg_7=arg_15, arg_16=arg_16)\n    return arg_14", "path": "autolens/plotters/array_plotters.py", "identifier": "plot_figure", "docstring": "Open a matplotlib figure and plot the array of data on it.\n\n    Parameters\n    -----------\n    array : data.array.scaled_array.ScaledArray\n        The 2D array of data which is plotted.\n    as_subplot : bool\n        Whether the array is plotted as part of a subplot, in which case the grid figure is not opened / closed.\n    units : str\n        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').\n    kpc_per_arcsec : float or None\n        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.\n    figsize : (int, int)\n        The size of the figure in (rows, columns).\n    aspect : str\n        The aspect ratio of the array, specifically whether it is forced to be square ('equal') or adapts its size to \\\n        the figure size ('auto').\n    cmap : str\n        The colormap the array is plotted using, which may be chosen from the standard matplotlib colormaps.\n    norm : str\n        The normalization of the colormap used to plot the image, specifically whether it is linear ('linear'), log \\\n        ('log') or a symmetric log normalization ('symmetric_log').\n    norm_min : float or None\n        The minimum array value the colormap map spans (all values below this value are plotted the same color).\n    norm_max : float or None\n        The maximum array value the colormap map spans (all values above this value are plotted the same color).\n    linthresh : float\n        For the 'symmetric_log' colormap normalization ,this specifies the range of values within which the colormap \\\n        is linear.\n    linscale : float\n        For the 'symmetric_log' colormap normalization, this allowws the linear range set by linthresh to be stretched \\\n        relative to the logarithmic range.\n    xticks_manual :  [] or None\n        If input, the xticks do not use the array's default xticks but instead overwrite them as these values.\n    yticks_manual :  [] or None\n        If input, the yticks do not use the array's default yticks but instead overwrite them as these values.", "docstring_tokens": ["Open", "a", "matplotlib", "figure", "and", "plot", "the", "array", "of", "data", "on", "it", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 260793}
{"url": "https://github.com/cmcginty/PyWeather/blob/8c25d9cd1fa921e0a6e460d523656279cac045cb/scripts/weatherpub.py#L132-L145", "sha": "8c25d9cd1fa921e0a6e460d523656279cac045cb", "docstring_summary": "use values in opts data to generate instances of publication services.", "language": "python", "parameters": "(opts)", "return_statement": "return sites", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "for", "arg_2", "in", "vars", "(", "arg_0", ")", ".", "keys", "(", ")", ":", "arg_3", "=", "getattr", "(", "arg_0", ",", "arg_2", ")", "if", "arg_2", "in", "PUB_SERVICES", "and", "arg_3", ":", "if", "isinstance", "(", "arg_3", ",", "tuple", ")", ":", "arg_4", "=", "PUB_SERVICES", "[", "arg_2", "]", "(", "*", "arg_3", ")", "else", ":", "arg_4", "=", "PUB_SERVICES", "[", "arg_2", "]", "(", "arg_3", ")", "arg_1", ".", "append", "(", "arg_4", ")", "return", "arg_1"], "function": "def Func(arg_0):\n   '''\n   use values in opts data to generate instances of publication services.\n   '''\n   arg_1 = []\n   for arg_2 in vars(arg_0).keys():\n      arg_3 = getattr(arg_0,arg_2)\n      if arg_2 in PUB_SERVICES and arg_3:\n         if isinstance(arg_3,tuple):\n            arg_4 = PUB_SERVICES[arg_2](*arg_3)\n         else:\n            arg_4 = PUB_SERVICES[arg_2](arg_3)\n         arg_1.append( arg_4 )\n   return arg_1", "path": "scripts/weatherpub.py", "identifier": "get_pub_services", "docstring": "use values in opts data to generate instances of publication services.", "docstring_tokens": ["use", "values", "in", "opts", "data", "to", "generate", "instances", "of", "publication", "services", "."], "nwo": "cmcginty/PyWeather", "score": 0.19714217663807126, "idx": 260794}
{"url": "https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/tokens.py#L196-L203", "sha": "ce2cf3f1425d02ba4f3ad3202cfca43a1892558a", "docstring_summary": "Create the secret link token.", "language": "python", "parameters": "(cls, obj_id, data, expires_at=None)", "return_statement": "return s.create_token(obj_id, data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", ":", "arg_4", "=", "TimedSecretLinkSerializer", "(", "arg_3", "=", "arg_3", ")", "else", ":", "arg_4", "=", "SecretLinkSerializer", "(", ")", "return", "arg_4", ".", "Func", "(", "arg_1", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Create the secret link token.\"\"\"\n        if arg_3:\n            arg_4 = TimedSecretLinkSerializer(arg_3=arg_3)\n        else:\n            arg_4 = SecretLinkSerializer()\n\n        return arg_4.Func(arg_1, arg_2)", "path": "zenodo_accessrequests/tokens.py", "identifier": "SecretLinkFactory.create_token", "docstring": "Create the secret link token.", "docstring_tokens": ["Create", "the", "secret", "link", "token", "."], "nwo": "zenodo/zenodo-accessrequests", "score": 0.2718259314615454, "idx": 260795}
{"url": "https://github.com/alimuldal/PyFNND/blob/3cbe0622a385f5206837bfd944d781aa7b1649ea/pyfnnd/demo.py#L8-L73", "sha": "3cbe0622a385f5206837bfd944d781aa7b1649ea", "docstring_summary": "Generate 2D fake fluorescence movie", "language": "python", "parameters": "(nframes, mask_shape=(64, 64), mask_center=None,\n                    bg_intensity=0.1, mask_sigma=10, dt=0.02, rate=1.0,\n                    tau=1., sigma=0.001, seed=None)", "return_statement": "return F, c, n, theta", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "(", "64", ",", "64", ")", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0.1", ",", "arg_4", "=", "10", ",", "arg_5", "=", "0.02", ",", "arg_6", "=", "1.0", ",", "arg_7", "=", "1.", ",", "arg_8", "=", "0.001", ",", "arg_9", "=", "None", ")", ":", "arg_10", "=", "np", ".", "random", ".", "RandomState", "(", "arg_9", ")", "arg_11", "=", "arg_10", ".", "poisson", "(", "arg_6", "*", "arg_5", ",", "size", "=", "arg_0", ")", "arg_12", "=", "np", ".", "exp", "(", "-", "arg_5", "/", "arg_7", ")", "arg_13", "=", "signal", ".", "lfilter", "(", "np", ".", "r_", "[", "1", "]", ",", "np", ".", "r_", "[", "1", ",", "-", "arg_12", "]", ",", "arg_11", ",", "axis", "=", "0", ")", "arg_14", ",", "arg_15", "=", "arg_1", "arg_16", "=", "arg_14", "*", "arg_15", "if", "arg_2", "is", "None", ":", "arg_2", "=", "(", "arg_15", "//", "2.", ",", "arg_14", "//", "2.", ")", "arg_17", ",", "arg_18", "=", "arg_2", "arg_19", ",", "arg_20", "=", "np", ".", "ogrid", "[", ":", "arg_14", ",", ":", "arg_15", "]", "arg_21", "=", "(", "arg_20", "-", "arg_17", ")", "**", "2.", "arg_22", "=", "(", "arg_19", "-", "arg_18", ")", "**", "2.", "arg_23", "=", "2.", "*", "arg_4", "**", "2.", "arg_24", "=", "np", ".", "exp", "(", "-", "1", "*", "(", "(", "arg_21", "/", "arg_23", ")", "+", "(", "arg_22", "/", "arg_23", ")", ")", ")", ".", "ravel", "(", ")", "arg_24", "/=", "arg_24", ".", "sum", "(", ")", "arg_25", "=", "arg_10", ".", "randn", "(", "arg_16", ")", "*", "arg_3", "arg_26", "=", "arg_6", "arg_27", "=", "arg_10", ".", "randn", "(", "arg_16", ",", "arg_0", ")", "*", "arg_8", "arg_28", "=", "arg_13", "[", "None", ",", ":", "]", "*", "arg_24", "[", ":", ",", "None", "]", "+", "arg_25", "[", ":", ",", "None", "]", "+", "arg_27", "arg_29", "=", "(", "arg_8", ",", "arg_24", ",", "arg_25", ",", "arg_26", ",", "arg_12", ")", "return", "arg_28", ",", "arg_13", ",", "arg_11", ",", "arg_29"], "function": "def Func(arg_0, arg_1=(64, 64), arg_2=None,\n                    arg_3=0.1, arg_4=10, arg_5=0.02, arg_6=1.0,\n                    arg_7=1., arg_8=0.001, arg_9=None):\n    \"\"\"\n    Generate 2D fake fluorescence movie\n\n    Arguments:\n    ---------------------------------------------------------------------------\n        nframes:        number of timebins to simulate\n        mask_shape:     tuple (nrows, ncols), shape of a single movie frame\n        mask_center:    tuple (x, y), pixel coords of cell center\n        bg_intensity:   scalar, amplitude of (static) baseline fluorescence\n        mask_sigma:     scalar, standard deviation of Gaussian mask\n        dt:             timestep (s)\n        rate:           mean spike rate (Hz)\n        tau:            time constant of decay in calcium concentration (s)\n        sigma:          SD of additive noise on fluorescence\n        seed:           Seed for RNG\n\n    Returns:\n    ---------------------------------------------------------------------------\n        F:          fluorescence [npixels, nframes]\n        c:          calcium concentration [nframes,]\n        n:          spike train [nframes,]\n        theta:      tuple of true model parameters:\n                    (sigma, alpha, beta, lambda, gamma)\n\n    \"\"\"\n\n    arg_10 = np.random.RandomState(arg_9)\n\n    # poisson spikes\n    arg_11 = arg_10.poisson(arg_6 * arg_5, size=arg_0)\n\n    # internal calcium dynamics\n    arg_12 = np.exp(-arg_5 / arg_7)\n    arg_13 = signal.lfilter(np.r_[1], np.r_[1, -arg_12], arg_11, axis=0)\n\n    # pixel weights (sum == 1)\n    arg_14, arg_15 = arg_1\n    arg_16 = arg_14 * arg_15\n    if arg_2 is None:\n        arg_2 = (arg_15 // 2., arg_14 // 2.)\n    arg_17, arg_18 = arg_2\n    arg_19, arg_20 = np.ogrid[:arg_14, :arg_15]\n    arg_21 = (arg_20 - arg_17) ** 2.\n    arg_22 = (arg_19 - arg_18) ** 2.\n    arg_23 = 2. * arg_4 ** 2.\n    arg_24 = np.exp(-1 * ((arg_21 / arg_23) + (arg_22 / arg_23))).ravel()\n    arg_24 /= arg_24.sum()\n\n    # background fluorescence\n    arg_25 = arg_10.randn(arg_16) * arg_3\n\n    # firing rate (spike probability per sec)\n    arg_26 = arg_6\n\n    # spatially & temporally white noise\n    arg_27 = arg_10.randn(arg_16, arg_0) * arg_8\n\n    # simulated fluorescence\n    arg_28 = arg_13[None, :] * arg_24[:, None] + arg_25[:, None] + arg_27\n\n    arg_29 = (arg_8, arg_24, arg_25, arg_26, arg_12)\n\n    return arg_28, arg_13, arg_11, arg_29", "path": "pyfnnd/demo.py", "identifier": "make_fake_movie", "docstring": "Generate 2D fake fluorescence movie\n\n    Arguments:\n    ---------------------------------------------------------------------------\n        nframes:        number of timebins to simulate\n        mask_shape:     tuple (nrows, ncols), shape of a single movie frame\n        mask_center:    tuple (x, y), pixel coords of cell center\n        bg_intensity:   scalar, amplitude of (static) baseline fluorescence\n        mask_sigma:     scalar, standard deviation of Gaussian mask\n        dt:             timestep (s)\n        rate:           mean spike rate (Hz)\n        tau:            time constant of decay in calcium concentration (s)\n        sigma:          SD of additive noise on fluorescence\n        seed:           Seed for RNG\n\n    Returns:\n    ---------------------------------------------------------------------------\n        F:          fluorescence [npixels, nframes]\n        c:          calcium concentration [nframes,]\n        n:          spike train [nframes,]\n        theta:      tuple of true model parameters:\n                    (sigma, alpha, beta, lambda, gamma)", "docstring_tokens": ["Generate", "2D", "fake", "fluorescence", "movie"], "nwo": "alimuldal/PyFNND", "score": 0.18843024134315003, "idx": 260796}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/learner_data.py#L28-L73", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Return a SapSuccessFactorsLearnerDataTransmissionAudit with the given enrollment and course completion data.", "language": "python", "parameters": "(self, enterprise_enrollment, completed_date=None, grade=None, is_passing=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ")", ":", "arg_5", "=", "None", "arg_6", "=", "False", "if", "arg_2", "is", "not", "None", ":", "arg_5", "=", "parse_datetime_to_epoch_millis", "(", "arg_2", ")", "arg_6", "=", "arg_4", "arg_7", "=", "arg_1", ".", "enterprise_customer_user", ".", "get_remote_id", "(", ")", "if", "arg_7", "is", "not", "None", ":", "arg_8", "=", "apps", ".", "get_model", "(", "'sap_success_factors'", ",", "'SapSuccessFactorsLearnerDataTransmissionAudit'", ")", "return", "[", "arg_8", "(", "enterprise_course_enrollment_id", "=", "arg_1", ".", "id", ",", "arg_7", "=", "arg_7", ",", "course_id", "=", "parse_course_key", "(", "arg_1", ".", "course_id", ")", ",", "arg_6", "=", "arg_6", ",", "arg_5", "=", "arg_5", ",", "arg_3", "=", "arg_3", ",", ")", ",", "arg_8", "(", "enterprise_course_enrollment_id", "=", "arg_1", ".", "id", ",", "arg_7", "=", "arg_7", ",", "course_id", "=", "arg_1", ".", "course_id", ",", "arg_6", "=", "arg_6", ",", "arg_5", "=", "arg_5", ",", "arg_3", "=", "arg_3", ",", ")", ",", "]", "else", ":", "LOGGER", ".", "debug", "(", "'No learner data was sent for user [%s] because an SAP SuccessFactors user ID could not be found.'", ",", "arg_1", ".", "enterprise_customer_user", ".", "username", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False):\n        \"\"\"\n        Return a SapSuccessFactorsLearnerDataTransmissionAudit with the given enrollment and course completion data.\n\n        If completed_date is None and the learner isn't passing, then course completion has not been met.\n\n        If no remote ID can be found, return None.\n        \"\"\"\n        arg_5 = None\n        arg_6 = False\n        if arg_2 is not None:\n            arg_5 = parse_datetime_to_epoch_millis(arg_2)\n            arg_6 = arg_4\n\n        arg_7 = arg_1.enterprise_customer_user.get_remote_id()\n\n        if arg_7 is not None:\n            arg_8 = apps.get_model(  # pylint: disable=invalid-name\n                'sap_success_factors',\n                'SapSuccessFactorsLearnerDataTransmissionAudit'\n            )\n            # We return two records here, one with the course key and one with the course run id, to account for\n            # uncertainty about the type of content (course vs. course run) that was sent to the integrated channel.\n            return [\n                arg_8(\n                    enterprise_course_enrollment_id=arg_1.id,\n                    arg_7=arg_7,\n                    course_id=parse_course_key(arg_1.course_id),\n                    arg_6=arg_6,\n                    arg_5=arg_5,\n                    arg_3=arg_3,\n                ),\n                arg_8(\n                    enterprise_course_enrollment_id=arg_1.id,\n                    arg_7=arg_7,\n                    course_id=arg_1.course_id,\n                    arg_6=arg_6,\n                    arg_5=arg_5,\n                    arg_3=arg_3,\n                ),\n            ]\n        else:\n            LOGGER.debug(\n                'No learner data was sent for user [%s] because an SAP SuccessFactors user ID could not be found.',\n                arg_1.enterprise_customer_user.username\n            )", "path": "integrated_channels/sap_success_factors/exporters/learner_data.py", "identifier": "SapSuccessFactorsLearnerExporter.get_learner_data_records", "docstring": "Return a SapSuccessFactorsLearnerDataTransmissionAudit with the given enrollment and course completion data.\n\n        If completed_date is None and the learner isn't passing, then course completion has not been met.\n\n        If no remote ID can be found, return None.", "docstring_tokens": ["Return", "a", "SapSuccessFactorsLearnerDataTransmissionAudit", "with", "the", "given", "enrollment", "and", "course", "completion", "data", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260797}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/workflow.py#L81-L88", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Refresh the state of all WAITING tasks. This will, for example, update\n        Catching Timer Events whose waiting time has passed.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "not", "arg_0", ".", "read_only", "for", "arg_1", "in", "arg_0", ".", "get_tasks", "(", "Task", ".", "WAITING", ")", ":", "arg_1", ".", "task_spec", ".", "_update", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Refresh the state of all WAITING tasks. This will, for example, update\n        Catching Timer Events whose waiting time has passed.\n        \"\"\"\n        assert not arg_0.read_only\n        for arg_1 in arg_0.get_tasks(Task.WAITING):\n            arg_1.task_spec._update(arg_1)", "path": "SpiffWorkflow/bpmn/workflow.py", "identifier": "BpmnWorkflow.refresh_waiting_tasks", "docstring": "Refresh the state of all WAITING tasks. This will, for example, update\n        Catching Timer Events whose waiting time has passed.", "docstring_tokens": ["Refresh", "the", "state", "of", "all", "WAITING", "tasks", ".", "This", "will", "for", "example", "update", "Catching", "Timer", "Events", "whose", "waiting", "time", "has", "passed", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 260798}
{"url": "https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L619-L631", "sha": "7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429", "docstring_summary": "Write data to an i2c device.", "language": "python", "parameters": "(self, address, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ")", ":", "arg_3", "=", "[", "arg_1", ",", "arg_0", ".", "I2C_WRITE", "]", "for", "arg_4", "in", "arg_2", ":", "arg_3", ".", "append", "(", "arg_4", "&", "0x7f", ")", "arg_3", ".", "append", "(", "(", "arg_4", ">>", "7", ")", "&", "0x7f", ")", "arg_0", ".", "_command_handler", ".", "send_sysex", "(", "arg_0", ".", "_command_handler", ".", "I2C_REQUEST", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2):\n        \"\"\"\n        Write data to an i2c device.\n\n        :param address: i2c device address\n\n        :param args: A variable number of bytes to be sent to the device\n        \"\"\"\n        arg_3 = [arg_1, arg_0.I2C_WRITE]\n        for arg_4 in arg_2:\n            arg_3.append(arg_4 & 0x7f)\n            arg_3.append((arg_4 >> 7) & 0x7f)\n        arg_0._command_handler.send_sysex(arg_0._command_handler.I2C_REQUEST, arg_3)", "path": "PyMata/pymata.py", "identifier": "PyMata.i2c_write", "docstring": "Write data to an i2c device.\n\n        :param address: i2c device address\n\n        :param args: A variable number of bytes to be sent to the device", "docstring_tokens": ["Write", "data", "to", "an", "i2c", "device", "."], "nwo": "MrYsLab/PyMata", "score": 0.1986581271776567, "idx": 260799}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/auto_save.py#L93-L116", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Set permissions in order to avoid issues before commiting.", "language": "python", "parameters": "(cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"travis\"", "]", ":", "try", ":", "arg_1", "=", "PyFunceble", ".", "environ", "[", "\"TRAVIS_BUILD_DIR\"", "]", "arg_2", "=", "[", "\"sudo chown -R travis:travis %s\"", "%", "(", "arg_1", ")", ",", "\"sudo chgrp -R travis %s\"", "%", "(", "arg_1", ")", ",", "\"sudo chmod -R g+rwX %s\"", "%", "(", "arg_1", ")", ",", "\"sudo chmod 777 -Rf %s.git\"", "%", "(", "arg_1", "+", "PyFunceble", ".", "directory_separator", ")", ",", "r\"sudo find %s -type d -exec chmod g+x '{}' \\;\"", "%", "(", "arg_1", ")", ",", "]", "for", "arg_3", "in", "arg_2", ":", "Command", "(", "arg_3", ")", ".", "execute", "(", ")", "if", "Command", "(", "\"git config core.sharedRepository\"", ")", ".", "execute", "(", ")", "==", "\"\"", ":", "Command", "(", "\"git config core.sharedRepository group\"", ")", ".", "execute", "(", ")", "except", "KeyError", ":", "pass"], "function": "def Func(arg_0):\n        \"\"\"\n        Set permissions in order to avoid issues before commiting.\n        \"\"\"\n\n        if PyFunceble.CONFIGURATION[\"travis\"]:\n            try:\n                arg_1 = PyFunceble.environ[\"TRAVIS_BUILD_DIR\"]\n                arg_2 = [\n                    \"sudo chown -R travis:travis %s\" % (arg_1),\n                    \"sudo chgrp -R travis %s\" % (arg_1),\n                    \"sudo chmod -R g+rwX %s\" % (arg_1),\n                    \"sudo chmod 777 -Rf %s.git\"\n                    % (arg_1 + PyFunceble.directory_separator),\n                    r\"sudo find %s -type d -exec chmod g+x '{}' \\;\" % (arg_1),\n                ]\n\n                for arg_3 in arg_2:\n                    Command(arg_3).execute()\n\n                if Command(\"git config core.sharedRepository\").execute() == \"\":\n                    Command(\"git config core.sharedRepository group\").execute()\n            except KeyError:\n                pass", "path": "PyFunceble/auto_save.py", "identifier": "AutoSave.travis_permissions", "docstring": "Set permissions in order to avoid issues before commiting.", "docstring_tokens": ["Set", "permissions", "in", "order", "to", "avoid", "issues", "before", "commiting", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 260800}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/dict_utils.py#L128-L173", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Compares two python dictionaries at the top level and return differences", "language": "python", "parameters": "(da, db)", "return_statement": "return resultDict if different else None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "arg_3", "=", "dict", "(", ")", "arg_3", "[", "'inAButNotInB'", "]", "=", "set", "(", "arg_0", ")", "-", "set", "(", "arg_1", ")", "if", "arg_3", "[", "'inAButNotInB'", "]", ":", "arg_2", "=", "True", "arg_3", "[", "'inBButNotInA'", "]", "=", "set", "(", "arg_1", ")", "-", "set", "(", "arg_0", ")", "if", "arg_3", "[", "'inBButNotInA'", "]", ":", "arg_2", "=", "True", "arg_3", "[", "'differentValues'", "]", "=", "[", "]", "for", "arg_4", "in", "(", "set", "(", "arg_0", ")", "-", "arg_3", "[", "'inAButNotInB'", "]", ")", ":", "arg_5", "=", "arg_0", "[", "arg_4", "]", "==", "arg_1", "[", "arg_4", "]", "if", "isinstance", "(", "arg_5", ",", "bool", ")", ":", "arg_6", "=", "arg_5", "else", ":", "arg_6", "=", "arg_5", ".", "all", "(", ")", "if", "not", "arg_6", ":", "arg_3", "[", "'differentValues'", "]", ".", "append", "(", "arg_4", ")", "arg_2", "=", "True", "assert", "(", "(", "(", "arg_3", "[", "'inAButNotInB'", "]", "or", "arg_3", "[", "'inBButNotInA'", "]", "or", "arg_3", "[", "'differentValues'", "]", ")", "and", "arg_2", ")", "or", "not", "arg_2", ")", "return", "arg_3", "if", "arg_2", "else", "None"], "function": "def Func(arg_0, arg_1):\n  \"\"\" Compares two python dictionaries at the top level and return differences\n\n  da:             first dictionary\n  db:             second dictionary\n\n  Returns:        None if dictionaries test equal; otherwise returns a\n                  dictionary as follows:\n                  {\n                    'inAButNotInB':\n                        <sequence of keys that are in da but not in db>\n                    'inBButNotInA':\n                        <sequence of keys that are in db but not in da>\n                    'differentValues':\n                        <sequence of keys whose corresponding values differ\n                         between da and db>\n                  }\n  \"\"\"\n  arg_2 = False\n\n  arg_3 = dict()\n\n  arg_3['inAButNotInB'] = set(arg_0) - set(arg_1)\n  if arg_3['inAButNotInB']:\n    arg_2 = True\n\n  arg_3['inBButNotInA'] = set(arg_1) - set(arg_0)\n  if arg_3['inBButNotInA']:\n    arg_2 = True\n\n  arg_3['differentValues'] = []\n  for arg_4 in (set(arg_0) - arg_3['inAButNotInB']):\n    arg_5 = arg_0[arg_4] == arg_1[arg_4]\n    if isinstance(arg_5, bool):\n      arg_6 = arg_5\n    else:\n      # This handles numpy arrays (but only at the top level)\n      arg_6 = arg_5.all()\n    if not arg_6:\n      arg_3['differentValues'].append(arg_4)\n      arg_2 = True\n\n  assert (((arg_3['inAButNotInB'] or arg_3['inBButNotInA'] or\n          arg_3['differentValues']) and arg_2) or not arg_2)\n\n  return arg_3 if arg_2 else None", "path": "src/nupic/data/dict_utils.py", "identifier": "dictDiff", "docstring": "Compares two python dictionaries at the top level and return differences\n\n  da:             first dictionary\n  db:             second dictionary\n\n  Returns:        None if dictionaries test equal; otherwise returns a\n                  dictionary as follows:\n                  {\n                    'inAButNotInB':\n                        <sequence of keys that are in da but not in db>\n                    'inBButNotInA':\n                        <sequence of keys that are in db but not in da>\n                    'differentValues':\n                        <sequence of keys whose corresponding values differ\n                         between da and db>\n                  }", "docstring_tokens": ["Compares", "two", "python", "dictionaries", "at", "the", "top", "level", "and", "return", "differences"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260801}
{"url": "https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/generic/add_missing_row.py#L11-L121", "sha": "c3ca874e1b64f4bdcc2edda750a72d45d1561d8a", "docstring_summary": "Add missing row to a df base on a reference column", "language": "python", "parameters": "(\n    df: pd.DataFrame,\n    id_cols: List[str],\n    reference_col: str,\n    complete_index: Union[Dict[str, str], List[str]] = None,\n    method: str = None,\n    cols_to_keep: List[str] = None\n)", "return_statement": "return new_df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "DataFrame", ",", "arg_3", ":", "arg_4", "[", "arg_5", "]", ",", "arg_6", ":", "arg_5", ",", "arg_7", ":", "arg_8", "[", "arg_9", "[", "arg_5", ",", "arg_5", "]", ",", "arg_4", "[", "arg_5", "]", "]", "=", "None", ",", "arg_10", ":", "arg_5", "=", "None", ",", "arg_11", ":", "arg_4", "[", "arg_5", "]", "=", "None", ")", "->", "arg_1", ".", "DataFrame", ":", "if", "arg_11", "is", "None", ":", "arg_12", "=", "[", "arg_6", "]", "else", ":", "arg_12", "=", "[", "arg_6", "]", "+", "arg_11", "check_params_columns_duplicate", "(", "arg_3", "+", "arg_12", ")", "if", "arg_10", "==", "'between'", "or", "arg_10", "==", "'between_and_after'", ":", "arg_0", "[", "'start'", "]", "=", "arg_0", ".", "groupby", "(", "arg_3", ")", "[", "arg_6", "]", ".", "transform", "(", "min", ")", "arg_3", "+=", "[", "'start'", "]", "if", "arg_10", "==", "'between'", "or", "arg_10", "==", "'between_and_before'", ":", "arg_0", "[", "'end'", "]", "=", "arg_0", ".", "groupby", "(", "arg_3", ")", "[", "arg_6", "]", ".", "transform", "(", "max", ")", "arg_3", "+=", "[", "'end'", "]", "arg_13", "=", "arg_3", "+", "arg_12", "arg_14", "=", "arg_0", ".", "set_index", "(", "arg_13", ")", "arg_15", "=", "arg_0", ".", "groupby", "(", "arg_3", ")", ".", "sum", "(", ")", ".", "index", ".", "values", "if", "arg_7", "is", "None", ":", "arg_7", "=", "arg_0", ".", "groupby", "(", "arg_12", ")", ".", "sum", "(", ")", ".", "index", ".", "values", "elif", "isinstance", "(", "arg_7", ",", "dict", ")", ":", "if", "arg_7", "[", "'type'", "]", "==", "'date'", ":", "arg_16", "=", "arg_7", "[", "'freq'", "]", "arg_17", "=", "arg_7", "[", "'format'", "]", "arg_18", "=", "arg_7", "[", "'start'", "]", "arg_19", "=", "arg_7", "[", "'end'", "]", "if", "isinstance", "(", "arg_16", ",", "dict", ")", ":", "arg_16", "=", "arg_1", ".", "DateOffset", "(", "**", "{", "k", ":", "int", "(", "v", ")", "for", "k", ",", "v", "in", "arg_16", ".", "items", "(", ")", "}", ")", "arg_7", "=", "arg_1", ".", "date_range", "(", "arg_18", "=", "arg_18", ",", "arg_19", "=", "arg_19", ",", "arg_16", "=", "arg_16", ")", "arg_7", "=", "arg_7", ".", "strftime", "(", "arg_17", ")", "else", ":", "raise", "ParamsValueError", "(", "f'Unknown complete index type: '", "f'{complete_index[\"type\"]}'", ")", "if", "not", "isinstance", "(", "arg_15", "[", "0", "]", ",", "tuple", ")", ":", "arg_15", "=", "[", "(", "x", ",", ")", "for", "x", "in", "arg_15", "]", "if", "not", "isinstance", "(", "arg_7", "[", "0", "]", ",", "tuple", ")", ":", "arg_7", "=", "[", "(", "x", ",", ")", "for", "x", "in", "arg_7", "]", "arg_20", "=", "[", "x", "+", "y", "for", "x", "in", "arg_15", "for", "y", "in", "arg_7", "]", "arg_21", "=", "arg_1", ".", "MultiIndex", ".", "from_tuples", "(", "arg_20", ",", "arg_13", "=", "arg_13", ")", "arg_14", "=", "arg_14", ".", "reindex", "(", "arg_21", ")", ".", "reset_index", "(", ")", "if", "arg_10", "==", "'between'", "or", "arg_10", "==", "'between_and_after'", ":", "arg_14", "=", "arg_14", "[", "arg_14", "[", "arg_6", "]", ">=", "arg_14", "[", "'start'", "]", "]", "del", "arg_14", "[", "'start'", "]", "if", "arg_10", "==", "'between'", "or", "arg_10", "==", "'between_and_before'", ":", "arg_14", "=", "arg_14", "[", "arg_14", "[", "arg_6", "]", "<=", "arg_14", "[", "'end'", "]", "]", "del", "arg_14", "[", "'end'", "]", "return", "arg_14"], "function": "def Func(\n    arg_0: arg_1.DataFrame,\n    arg_3: arg_4[arg_5],\n    arg_6: arg_5,\n    arg_7: arg_8[arg_9[arg_5, arg_5], arg_4[arg_5]] = None,\n    arg_10: arg_5 = None,\n    arg_11: arg_4[arg_5] = None\n) -> arg_1.DataFrame:\n    \"\"\"\n    Add missing row to a df base on a reference column\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `id_cols` (*list of str*): names of the columns used to create each group\n    - `reference_col` (*str*): name of the column used to identify missing rows\n\n    *optional :*\n    - `complete_index` (*list* or *dict*): [A, B, C] a list of values used to add missing rows.\n      It can also be a dict to declare a date range.\n      By default, use all values of reference_col.\n    - `method` (*str*): by default all missing rows are added. The possible values are :\n        - `\"between\"` : add missing rows having their value between min and max values for each group,\n        - `\"between_and_after\"` : add missing rows having their value bigger than min value for each group.\n        - `\"between_and_before\"` : add missing rows having their value smaller than max values for each group.\n    - `cols_to_keep` (*list of str*): name of other columns to keep, linked to the reference_col.\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    YEAR | MONTH | NAME\n    :---:|:---:|:--:\n    2017|1|A\n    2017|2|A\n    2017|3|A\n    2017|1|B\n    2017|3|B\n\n    ```cson\n    Func:\n      id_cols: ['NAME']\n      reference_col: 'MONTH'\n    ```\n\n    **Output**\n\n    YEAR | MONTH | NAME\n    :---:|:---:|:--:\n    2017|1|A\n    2017|2|A\n    2017|3|A\n    2017|1|B\n    2017|2|B\n    2017|3|B\n\n    \"\"\"\n    if arg_11 is None:\n        arg_12 = [arg_6]\n    else:\n        arg_12 = [arg_6] + arg_11\n    check_params_columns_duplicate(arg_3 + arg_12)\n\n    if arg_10 == 'between' or arg_10 == 'between_and_after':\n        arg_0['start'] = arg_0.groupby(arg_3)[arg_6].transform(min)\n        arg_3 += ['start']\n    if arg_10 == 'between' or arg_10 == 'between_and_before':\n        arg_0['end'] = arg_0.groupby(arg_3)[arg_6].transform(max)\n        arg_3 += ['end']\n\n    arg_13 = arg_3 + arg_12\n    arg_14 = arg_0.set_index(arg_13)\n    arg_15 = arg_0.groupby(arg_3).sum().index.values\n\n    if arg_7 is None:\n        arg_7 = arg_0.groupby(arg_12).sum().index.values\n    elif isinstance(arg_7, dict):\n        if arg_7['type'] == 'date':\n            arg_16 = arg_7['freq']\n            arg_17 = arg_7['format']\n            arg_18 = arg_7['start']\n            arg_19 = arg_7['end']\n            if isinstance(arg_16, dict):\n                arg_16 = arg_1.DateOffset(**{k: int(v) for k, v in arg_16.items()})\n            arg_7 = arg_1.date_range(arg_18=arg_18, arg_19=arg_19, arg_16=arg_16)\n            arg_7 = arg_7.strftime(arg_17)\n        else:\n            raise ParamsValueError(f'Unknown complete index type: '\n                                   f'{complete_index[\"type\"]}')\n\n    if not isinstance(arg_15[0], tuple):\n        arg_15 = [(x,) for x in arg_15]\n    if not isinstance(arg_7[0], tuple):\n        arg_7 = [(x,) for x in arg_7]\n    arg_20 = [x + y for x in arg_15 for y in arg_7]\n\n    arg_21 = arg_1.MultiIndex.from_tuples(arg_20, arg_13=arg_13)\n    arg_14 = arg_14.reindex(arg_21).reset_index()\n\n    if arg_10 == 'between' or arg_10 == 'between_and_after':\n        arg_14 = arg_14[arg_14[arg_6] >= arg_14['start']]\n        del arg_14['start']\n    if arg_10 == 'between' or arg_10 == 'between_and_before':\n        arg_14 = arg_14[arg_14[arg_6] <= arg_14['end']]\n        del arg_14['end']\n\n    return arg_14", "path": "toucan_data_sdk/utils/generic/add_missing_row.py", "identifier": "add_missing_row", "docstring": "Add missing row to a df base on a reference column\n\n    ---\n\n    ### Parameters\n\n    *mandatory :*\n    - `id_cols` (*list of str*): names of the columns used to create each group\n    - `reference_col` (*str*): name of the column used to identify missing rows\n\n    *optional :*\n    - `complete_index` (*list* or *dict*): [A, B, C] a list of values used to add missing rows.\n      It can also be a dict to declare a date range.\n      By default, use all values of reference_col.\n    - `method` (*str*): by default all missing rows are added. The possible values are :\n        - `\"between\"` : add missing rows having their value between min and max values for each group,\n        - `\"between_and_after\"` : add missing rows having their value bigger than min value for each group.\n        - `\"between_and_before\"` : add missing rows having their value smaller than max values for each group.\n    - `cols_to_keep` (*list of str*): name of other columns to keep, linked to the reference_col.\n\n    ---\n\n    ### Example\n\n    **Input**\n\n    YEAR | MONTH | NAME\n    :---:|:---:|:--:\n    2017|1|A\n    2017|2|A\n    2017|3|A\n    2017|1|B\n    2017|3|B\n\n    ```cson\n    add_missing_row:\n      id_cols: ['NAME']\n      reference_col: 'MONTH'\n    ```\n\n    **Output**\n\n    YEAR | MONTH | NAME\n    :---:|:---:|:--:\n    2017|1|A\n    2017|2|A\n    2017|3|A\n    2017|1|B\n    2017|2|B\n    2017|3|B", "docstring_tokens": ["Add", "missing", "row", "to", "a", "df", "base", "on", "a", "reference", "column"], "nwo": "ToucanToco/toucan-data-sdk", "score": 0.5656394315975184, "idx": 260802}
{"url": "https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/loader.py#L8-L23", "sha": "48c842fe053bf9cd6446c4b33fb081c65339aa48", "docstring_summary": "Try to load and return a module", "language": "python", "parameters": "(directory_name, module_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", "and", "arg_0", "not", "in", "sys", ".", "path", ":", "sys", ".", "path", ".", "append", "(", "arg_0", ")", "try", ":", "return", "importlib", ".", "import_module", "(", "arg_1", ")", "except", "ImportError", ":", "pass"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Try to Func and return a module\n\n    Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.\n\n    For example:\n    Func(\"~/.yaz\", \"yaz_extension\")\n    \"\"\"\n    arg_0 = os.path.expanduser(arg_0)\n    if os.path.isdir(arg_0) and arg_0 not in sys.path:\n        sys.path.append(arg_0)\n\n    try:\n        return importlib.import_module(arg_1)\n    except ImportError:\n        pass", "path": "yaz/loader.py", "identifier": "load", "docstring": "Try to load and return a module\n\n    Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.\n\n    For example:\n    load(\"~/.yaz\", \"yaz_extension\")", "docstring_tokens": ["Try", "to", "load", "and", "return", "a", "module"], "nwo": "yaz/yaz", "score": 0.138843686048881, "idx": 260803}
{"url": "https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/has_funcs.py#L112-L200", "sha": "ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f", "docstring_summary": "Test whether abstract syntax trees match between the student and solution code.", "language": "python", "parameters": "(state, incorrect_msg=None, code=None, exact=True, append=None)", "return_statement": "return state", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ",", "arg_4", "=", "None", ")", ":", "if", "utils", ".", "v2_only", "(", ")", ":", "arg_0", ".", "assert_is_not", "(", "[", "\"object_assignments\"", "]", ",", "\"Func\"", ",", "[", "\"check_object\"", "]", ")", "arg_0", ".", "assert_is_not", "(", "[", "\"function_calls\"", "]", ",", "\"Func\"", ",", "[", "\"check_function\"", "]", ")", "if", "arg_2", "and", "arg_1", "is", "None", ":", "raise", "InstructorError", "(", "\"If you manually specify the code to match inside Func(), \"", "\"you have to explicitly set the `incorrect_msg` argument.\"", ")", "if", "(", "arg_4", "is", "None", ")", ":", "arg_4", "=", "arg_1", "is", "None", "if", "arg_1", "is", "None", ":", "arg_1", "=", "\"Expected `{{sol_str}}`, but got `{{stu_str}}`.\"", "def", "parse_tree", "(", "arg_5", ")", ":", "arg_6", "=", "(", "arg_5", ".", "body", "[", "0", "]", "if", "isinstance", "(", "arg_5", ",", "ast", ".", "Module", ")", "and", "len", "(", "arg_5", ".", "body", ")", "==", "1", "else", "arg_5", ")", "return", "ast", ".", "dump", "(", "arg_6", ".", "value", "if", "isinstance", "(", "arg_6", ",", "ast", ".", "Expr", ")", "else", "arg_6", ")", "arg_7", "=", "parse_tree", "(", "arg_0", ".", "student_ast", ")", "arg_8", "=", "parse_tree", "(", "arg_0", ".", "solution_ast", "if", "not", "arg_2", "else", "ast", ".", "parse", "(", "arg_2", ")", ")", "arg_9", "=", "{", "\"sol_str\"", ":", "arg_0", ".", "solution_code", "if", "not", "arg_2", "else", "arg_2", ",", "\"stu_str\"", ":", "arg_0", ".", "student_code", ",", "}", "arg_10", "=", "arg_0", ".", "build_message", "(", "arg_1", ",", "arg_9", ",", "arg_4", "=", "arg_4", ")", "if", "arg_3", "and", "not", "arg_2", ":", "arg_0", ".", "do_test", "(", "EqualTest", "(", "arg_7", ",", "arg_8", ",", "Feedback", "(", "arg_10", ",", "arg_0", ")", ")", ")", "elif", "not", "arg_8", "in", "arg_7", ":", "arg_0", ".", "report", "(", "Feedback", "(", "arg_10", ",", "arg_0", ")", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=True, arg_4=None):\n    \"\"\"Test whether abstract syntax trees match between the student and solution code.\n\n    ``Func()`` can be used in two ways:\n\n    * As a robust version of ``has_code()``. By setting ``code``, you can look for the AST representation of ``code`` in the student's submission.\n      But be aware that ``a`` and ``a = 1`` won't match, as reading and assigning are not the same in an AST.\n      Use ``ast.dump(ast.parse(code))`` to see an AST representation of ``code``.\n    * As an expression-based check when using more advanced SCT chain, e.g. to compare the equality of expressions to set function arguments.\n\n    Args:\n        incorrect_msg: message displayed when ASTs mismatch. When you specify ``code`` yourself, you have to specify this.\n        code: optional code to use instead of the solution AST.\n        exact: whether the representations must match exactly. If false, the solution AST\n               only needs to be contained within the student AST (similar to using test student typed).\n               Defaults to ``True``, unless the ``code`` argument has been specified.\n\n    :Example:\n\n        Student and Solution Code::\n\n            dict(a = 'value').keys()\n\n        SCT::\n\n            # all pass\n            Ex().Func()\n            Ex().Func(code = \"dict(a = 'value').keys()\")\n            Ex().Func(code = \"dict(a = 'value')\", exact = False)\n\n        Student and Solution Code::\n\n            import numpy as np\n            arr = np.array([1, 2, 3, 4, 5])\n            np.mean(arr)\n\n        SCT::\n\n            # Check underlying value of arugment a of np.mean:\n            Ex().check_function('numpy.mean').check_args('a').Func()\n\n            # Only check AST equality of expression used to specify argument a:\n            Ex().check_function('numpy.mean').check_args('a').Func()\n\n    \"\"\"\n    if utils.v2_only():\n        arg_0.assert_is_not([\"object_assignments\"], \"Func\", [\"check_object\"])\n        arg_0.assert_is_not([\"function_calls\"], \"Func\", [\"check_function\"])\n\n    if arg_2 and arg_1 is None:\n        raise InstructorError(\n            \"If you manually specify the code to match inside Func(), \"\n            \"you have to explicitly set the `incorrect_msg` argument.\"\n        )\n\n    if (\n        arg_4 is None\n    ):  # if not specified, set to False if incorrect_msg was manually specified\n        arg_4 = arg_1 is None\n    if arg_1 is None:\n        arg_1 = \"Expected `{{sol_str}}`, but got `{{stu_str}}`.\"\n\n    def parse_tree(arg_5):\n        # get contents of module.body if only 1 element\n        arg_6 = (\n            arg_5.body[0]\n            if isinstance(arg_5, ast.Module) and len(arg_5.body) == 1\n            else arg_5\n        )\n\n        # remove Expr if it exists\n        return ast.dump(arg_6.value if isinstance(arg_6, ast.Expr) else arg_6)\n\n    arg_7 = parse_tree(arg_0.student_ast)\n    arg_8 = parse_tree(arg_0.solution_ast if not arg_2 else ast.parse(arg_2))\n\n    arg_9 = {\n        \"sol_str\": arg_0.solution_code if not arg_2 else arg_2,\n        \"stu_str\": arg_0.student_code,\n    }\n\n    arg_10 = arg_0.build_message(arg_1, arg_9, arg_4=arg_4)\n\n    if arg_3 and not arg_2:\n        arg_0.do_test(EqualTest(arg_7, arg_8, Feedback(arg_10, arg_0)))\n    elif not arg_8 in arg_7:\n        arg_0.report(Feedback(arg_10, arg_0))\n\n    return arg_0", "path": "pythonwhat/checks/has_funcs.py", "identifier": "has_equal_ast", "docstring": "Test whether abstract syntax trees match between the student and solution code.\n\n    ``has_equal_ast()`` can be used in two ways:\n\n    * As a robust version of ``has_code()``. By setting ``code``, you can look for the AST representation of ``code`` in the student's submission.\n      But be aware that ``a`` and ``a = 1`` won't match, as reading and assigning are not the same in an AST.\n      Use ``ast.dump(ast.parse(code))`` to see an AST representation of ``code``.\n    * As an expression-based check when using more advanced SCT chain, e.g. to compare the equality of expressions to set function arguments.\n\n    Args:\n        incorrect_msg: message displayed when ASTs mismatch. When you specify ``code`` yourself, you have to specify this.\n        code: optional code to use instead of the solution AST.\n        exact: whether the representations must match exactly. If false, the solution AST\n               only needs to be contained within the student AST (similar to using test student typed).\n               Defaults to ``True``, unless the ``code`` argument has been specified.\n\n    :Example:\n\n        Student and Solution Code::\n\n            dict(a = 'value').keys()\n\n        SCT::\n\n            # all pass\n            Ex().has_equal_ast()\n            Ex().has_equal_ast(code = \"dict(a = 'value').keys()\")\n            Ex().has_equal_ast(code = \"dict(a = 'value')\", exact = False)\n\n        Student and Solution Code::\n\n            import numpy as np\n            arr = np.array([1, 2, 3, 4, 5])\n            np.mean(arr)\n\n        SCT::\n\n            # Check underlying value of arugment a of np.mean:\n            Ex().check_function('numpy.mean').check_args('a').has_equal_ast()\n\n            # Only check AST equality of expression used to specify argument a:\n            Ex().check_function('numpy.mean').check_args('a').has_equal_ast()", "docstring_tokens": ["Test", "whether", "abstract", "syntax", "trees", "match", "between", "the", "student", "and", "solution", "code", "."], "nwo": "datacamp/pythonwhat", "score": 0.5296938535454943, "idx": 260804}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L870-L901", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Determines peak, valley, and recovery dates given an 'underwater'\n    DataFrame.", "language": "python", "parameters": "(underwater)", "return_statement": "return peak, valley, recovery", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "np", ".", "argmin", "(", "arg_0", ")", "arg_2", "=", "arg_0", "[", ":", "arg_1", "]", "[", "arg_0", "[", ":", "arg_1", "]", "==", "0", "]", ".", "index", "[", "-", "1", "]", "try", ":", "arg_3", "=", "arg_0", "[", "arg_1", ":", "]", "[", "arg_0", "[", "arg_1", ":", "]", "==", "0", "]", ".", "index", "[", "0", "]", "except", "IndexError", ":", "arg_3", "=", "np", ".", "nan", "return", "arg_2", ",", "arg_1", ",", "arg_3"], "function": "def Func(arg_0):\n    \"\"\"\n    Determines peak, valley, and recovery dates given an 'underwater'\n    DataFrame.\n\n    An underwater DataFrame is a DataFrame that has precomputed\n    rolling drawdown.\n\n    Parameters\n    ----------\n    underwater : pd.Series\n       Underwater returns (rolling drawdown) of a strategy.\n\n    Returns\n    -------\n    peak : datetime\n        The maximum drawdown's peak.\n    valley : datetime\n        The maximum drawdown's valley.\n    recovery : datetime\n        The maximum drawdown's recovery.\n    \"\"\"\n\n    arg_1 = np.argmin(arg_0)  # end of the period\n    # Find first 0\n    arg_2 = arg_0[:arg_1][arg_0[:arg_1] == 0].index[-1]\n    # Find last 0\n    try:\n        arg_3 = arg_0[arg_1:][arg_0[arg_1:] == 0].index[0]\n    except IndexError:\n        arg_3 = np.nan  # drawdown not recovered\n    return arg_2, arg_1, arg_3", "path": "pyfolio/timeseries.py", "identifier": "get_max_drawdown_underwater", "docstring": "Determines peak, valley, and recovery dates given an 'underwater'\n    DataFrame.\n\n    An underwater DataFrame is a DataFrame that has precomputed\n    rolling drawdown.\n\n    Parameters\n    ----------\n    underwater : pd.Series\n       Underwater returns (rolling drawdown) of a strategy.\n\n    Returns\n    -------\n    peak : datetime\n        The maximum drawdown's peak.\n    valley : datetime\n        The maximum drawdown's valley.\n    recovery : datetime\n        The maximum drawdown's recovery.", "docstring_tokens": ["Determines", "peak", "valley", "and", "recovery", "dates", "given", "an", "underwater", "DataFrame", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260805}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/latex.py#L769-L780", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Truncate long floats", "language": "python", "parameters": "(matchobj, format_str='0.2g')", "return_statement": "return ''", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'0.2g'", ")", ":", "if", "arg_0", ".", "group", "(", "0", ")", ":", "return", "format", "(", "float", "(", "arg_0", ".", "group", "(", "0", ")", ")", ",", "arg_1", ")", "return", "''"], "function": "def Func(arg_0, arg_1='0.2g'):\n    \"\"\"Truncate long floats\n\n    Args:\n        matchobj (re.Match): contains original float\n        format_str (str): format specifier\n    Returns:\n       str: returns truncated float\n    \"\"\"\n    if arg_0.group(0):\n        return format(float(arg_0.group(0)), arg_1)\n    return ''", "path": "qiskit/visualization/latex.py", "identifier": "_truncate_float", "docstring": "Truncate long floats\n\n    Args:\n        matchobj (re.Match): contains original float\n        format_str (str): format specifier\n    Returns:\n       str: returns truncated float", "docstring_tokens": ["Truncate", "long", "floats"], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260806}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_stream.py#L130-L136", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Log what has been captured so far", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "cap_stdout", ".", "seek", "(", "arg_0", ".", "_pos", ")", "arg_1", "=", "arg_0", ".", "cap_stdout", ".", "read", "(", ")", "arg_0", ".", "_pos", "=", "arg_0", ".", "cap_stdout", ".", "tell", "(", ")", "arg_0", ".", "parts", ".", "append", "(", "arg_1", ")", "arg_0", ".", "text", "=", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Log what has been captured so far \"\"\"\n        arg_0.cap_stdout.seek(arg_0._pos)\n        arg_1 = arg_0.cap_stdout.read()\n        arg_0._pos = arg_0.cap_stdout.tell()\n        arg_0.parts.append(arg_1)\n        arg_0.text = arg_1", "path": "ubelt/util_stream.py", "identifier": "CaptureStdout.log_part", "docstring": "Log what has been captured so far", "docstring_tokens": ["Log", "what", "has", "been", "captured", "so", "far"], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 260807}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/gaussian_process.py#L286-L307", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "True if the given index_points would yield a univariate marginal.", "language": "python", "parameters": "(self, index_points)", "return_statement": "return num_index_points == 1", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tf", ".", "compat", ".", "dimension_value", "(", "arg_1", ".", "shape", "[", "-", "(", "arg_0", ".", "kernel", ".", "feature_ndims", "+", "1", ")", "]", ")", "if", "arg_2", "is", "None", ":", "warnings", ".", "warn", "(", "'Unable to detect statically whether the number of index_points is '", "'1. As a result, defaulting to treating the marginal GP at '", "'`index_points` as a multivariate Gaussian. This makes some methods, '", "'like `cdf` unavailable.'", ")", "return", "arg_2", "==", "1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"True if the given index_points would yield a univariate marginal.\n\n    Args:\n      index_points: the set of index set locations at which to compute the\n      marginal Gaussian distribution. If this set is of size 1, the marginal is\n      univariate.\n\n    Returns:\n      is_univariate: Boolean indicating whether the marginal is univariate or\n      multivariate. In the case of dynamic shape in the number of index points,\n      defaults to \"multivariate\" since that's the best we can do.\n    \"\"\"\n    arg_2 = tf.compat.dimension_value(\n        arg_1.shape[-(arg_0.kernel.feature_ndims + 1)])\n    if arg_2 is None:\n      warnings.warn(\n          'Unable to detect statically whether the number of index_points is '\n          '1. As a result, defaulting to treating the marginal GP at '\n          '`index_points` as a multivariate Gaussian. This makes some methods, '\n          'like `cdf` unavailable.')\n    return arg_2 == 1", "path": "tensorflow_probability/python/distributions/gaussian_process.py", "identifier": "GaussianProcess._is_univariate_marginal", "docstring": "True if the given index_points would yield a univariate marginal.\n\n    Args:\n      index_points: the set of index set locations at which to compute the\n      marginal Gaussian distribution. If this set is of size 1, the marginal is\n      univariate.\n\n    Returns:\n      is_univariate: Boolean indicating whether the marginal is univariate or\n      multivariate. In the case of dynamic shape in the number of index points,\n      defaults to \"multivariate\" since that's the best we can do.", "docstring_tokens": ["True", "if", "the", "given", "index_points", "would", "yield", "a", "univariate", "marginal", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260808}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/migration_configs_operations.py#L164-L220", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Creates Migration configuration and starts migration of entities from\n        Standard to Premium namespace.", "language": "python", "parameters": "(\n            self, resource_group_name, namespace_name, target_namespace, post_migration_name, custom_headers=None, raw=False, polling=True, **operation_config)", "return_statement": "return LROPoller(self._client, raw_result, get_long_running_output, polling_method)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ",", "arg_7", "=", "True", ",", "**", "arg_8", ")", ":", "arg_9", "=", "arg_0", ".", "_Func_initial", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "True", ",", "**", "arg_8", ")", "def", "get_long_running_output", "(", "arg_10", ")", ":", "arg_11", "=", "arg_0", ".", "_deserialize", "(", "'MigrationConfigProperties'", ",", "arg_10", ")", "if", "arg_6", ":", "arg_12", "=", "ClientRawResponse", "(", "arg_11", ",", "arg_10", ")", "return", "arg_12", "return", "arg_11", "arg_13", "=", "arg_8", ".", "get", "(", "'long_running_operation_timeout'", ",", "arg_0", ".", "config", ".", "long_running_operation_timeout", ")", "if", "arg_7", "is", "True", ":", "arg_14", "=", "ARMPolling", "(", "arg_13", ",", "**", "arg_8", ")", "elif", "arg_7", "is", "False", ":", "arg_14", "=", "NoPolling", "(", ")", "else", ":", "arg_14", "=", "arg_7", "return", "LROPoller", "(", "arg_0", ".", "_client", ",", "arg_9", ",", "get_long_running_output", ",", "arg_14", ")"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=False, arg_7=True, **arg_8):\n        \"\"\"Creates Migration configuration and starts migration of entities from\n        Standard to Premium namespace.\n\n        :param resource_group_name: Name of the Resource group within the\n         Azure subscription.\n        :type resource_group_name: str\n        :param namespace_name: The namespace name\n        :type namespace_name: str\n        :param target_namespace: Existing premium Namespace ARM Id name which\n         has no entities, will be used for migration\n        :type target_namespace: str\n        :param post_migration_name: Name to access Standard Namespace after\n         migration\n        :type post_migration_name: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns\n         MigrationConfigProperties or\n         ClientRawResponse<MigrationConfigProperties> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servicebus.models.MigrationConfigProperties]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servicebus.models.MigrationConfigProperties]]\n        :raises:\n         :class:`ErrorResponseException<azure.mgmt.servicebus.models.ErrorResponseException>`\n        \"\"\"\n        arg_9 = arg_0._Func_initial(\n            arg_1=arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            arg_5=arg_5,\n            arg_6=True,\n            **arg_8\n        )\n\n        def get_long_running_output(arg_10):\n            arg_11 = arg_0._deserialize('MigrationConfigProperties', arg_10)\n\n            if arg_6:\n                arg_12 = ClientRawResponse(arg_11, arg_10)\n                return arg_12\n\n            return arg_11\n\n        arg_13 = arg_8.get(\n            'long_running_operation_timeout',\n            arg_0.config.long_running_operation_timeout)\n        if arg_7 is True: arg_14 = ARMPolling(arg_13, **arg_8)\n        elif arg_7 is False: arg_14 = NoPolling()\n        else: arg_14 = arg_7\n        return LROPoller(arg_0._client, arg_9, get_long_running_output, arg_14)", "path": "azure-mgmt-servicebus/azure/mgmt/servicebus/operations/migration_configs_operations.py", "identifier": "MigrationConfigsOperations.create_and_start_migration", "docstring": "Creates Migration configuration and starts migration of entities from\n        Standard to Premium namespace.\n\n        :param resource_group_name: Name of the Resource group within the\n         Azure subscription.\n        :type resource_group_name: str\n        :param namespace_name: The namespace name\n        :type namespace_name: str\n        :param target_namespace: Existing premium Namespace ARM Id name which\n         has no entities, will be used for migration\n        :type target_namespace: str\n        :param post_migration_name: Name to access Standard Namespace after\n         migration\n        :type post_migration_name: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: The poller return type is ClientRawResponse, the\n         direct response alongside the deserialized response\n        :param polling: True for ARMPolling, False for no polling, or a\n         polling object for personal polling strategy\n        :return: An instance of LROPoller that returns\n         MigrationConfigProperties or\n         ClientRawResponse<MigrationConfigProperties> if raw==True\n        :rtype:\n         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servicebus.models.MigrationConfigProperties]\n         or\n         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servicebus.models.MigrationConfigProperties]]\n        :raises:\n         :class:`ErrorResponseException<azure.mgmt.servicebus.models.ErrorResponseException>`", "docstring_tokens": ["Creates", "Migration", "configuration", "and", "starts", "migration", "of", "entities", "from", "Standard", "to", "Premium", "namespace", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260809}
{"url": "https://github.com/MartinHjelmare/leicacam/blob/1df37bccd34884737d3b5e169fae71dd2f21f1e2/scripts/gen_changelog.py#L8-L21", "sha": "1df37bccd34884737d3b5e169fae71dd2f21f1e2", "docstring_summary": "Validate version before release.", "language": "python", "parameters": "()", "return_statement": "return version_string", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "import", "leicacam", "arg_0", "=", "leicacam", ".", "__version__", "arg_1", "=", "arg_0", ".", "split", "(", "'.'", ",", "3", ")", "try", ":", "for", "arg_2", "in", "arg_1", ":", "int", "(", "arg_2", ")", "except", "ValueError", ":", "print", "(", "'Only integers are allowed in release version, '", "'please adjust current version {}'", ".", "format", "(", "arg_0", ")", ")", "return", "None", "return", "arg_0"], "function": "def Func():\n    \"\"\"Validate version before release.\"\"\"\n    import leicacam\n    arg_0 = leicacam.__version__\n    arg_1 = arg_0.split('.', 3)\n    try:\n        for arg_2 in arg_1:\n            int(arg_2)\n    except ValueError:\n        print(\n            'Only integers are allowed in release version, '\n            'please adjust current version {}'.format(arg_0))\n        return None\n    return arg_0", "path": "scripts/gen_changelog.py", "identifier": "validate_version", "docstring": "Validate version before release.", "docstring_tokens": ["Validate", "version", "before", "release", "."], "nwo": "MartinHjelmare/leicacam", "score": 0.35580137387943567, "idx": 260810}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/replica_exchange_mc.py#L49-L109", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Default exchange proposal function, for replica exchange MC.", "language": "python", "parameters": "(prob_exchange)", "return_statement": "return default_exchange_proposed_fn_", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "Func_", "(", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "distributions", ".", "SeedStream", "(", "arg_2", ",", "'Func'", ")", "arg_4", "=", "tf", ".", "random", ".", "uniform", "(", "[", "]", ",", "arg_2", "=", "arg_3", "(", ")", ")", ">", "0.5", "if", "arg_1", "%", "2", "==", "0", ":", "def", "_exchange", "(", ")", ":", "arg_5", "=", "tf", ".", "range", "(", "arg_1", ")", "if", "arg_1", ">", "2", ":", "arg_6", "=", "tf", ".", "cast", "(", "~", "arg_4", ",", "dtype", "=", "tf", ".", "int32", ")", "arg_7", "=", "arg_1", "-", "arg_6", "arg_5", "=", "arg_5", "[", "arg_6", ":", "arg_7", "]", "return", "tf", ".", "reshape", "(", "arg_5", ",", "[", "tf", ".", "size", "(", "input", "=", "arg_5", ")", "//", "2", ",", "2", "]", ")", "else", ":", "def", "_exchange", "(", ")", ":", "arg_6", "=", "tf", ".", "cast", "(", "arg_4", ",", "dtype", "=", "tf", ".", "int32", ")", "arg_7", "=", "arg_1", "-", "tf", ".", "cast", "(", "~", "arg_4", ",", "dtype", "=", "tf", ".", "int32", ")", "arg_5", "=", "tf", ".", "range", "(", "arg_1", ")", "[", "arg_6", ":", "arg_7", "]", "return", "tf", ".", "reshape", "(", "arg_5", ",", "[", "tf", ".", "size", "(", "input", "=", "arg_5", ")", "//", "2", ",", "2", "]", ")", "def", "_null_exchange", "(", ")", ":", "return", "tf", ".", "reshape", "(", "tf", ".", "cast", "(", "[", "]", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "shape", "=", "[", "0", ",", "2", "]", ")", "return", "tf", ".", "cond", "(", "pred", "=", "tf", ".", "random", ".", "uniform", "(", "[", "]", ",", "arg_2", "=", "arg_3", "(", ")", ")", "<", "arg_0", ",", "true_fn", "=", "_exchange", ",", "false_fn", "=", "_null_exchange", ")", "return", "Func_"], "function": "def Func(arg_0):\n  \"\"\"Default exchange proposal function, for replica exchange MC.\n\n  With probability `prob_exchange` propose combinations of replica for exchange.\n  When exchanging, create combinations of adjacent replicas in\n  [Replica Exchange Monte Carlo](\n  https://en.wikipedia.org/wiki/Parallel_tempering)\n\n  ```\n  exchange_fn = Func(prob_exchange=0.5)\n  exchange_proposed = exchange_fn(num_replica=3)\n\n  exchange_proposed.eval()\n  ==> [[0, 1]]  # 1 exchange, 0 <--> 1\n\n  exchange_proposed.eval()\n  ==> []  # 0 exchanges\n  ```\n\n  Args:\n    prob_exchange: Scalar `Tensor` giving probability that any exchanges will\n      be generated.\n\n  Returns:\n    Func_: Python callable which take a number of\n      replicas (a Python integer), and return combinations of replicas for\n      exchange as an [n, 2] integer `Tensor`, `0 <= n <= num_replica // 2`,\n      with *unique* values in the set `{0, ..., num_replica}`.\n  \"\"\"\n\n  def Func_(arg_1, arg_2=None):\n    \"\"\"Default function for `exchange_proposed_fn` of `kernel`.\"\"\"\n    arg_3 = distributions.SeedStream(arg_2, 'Func')\n\n    arg_4 = tf.random.uniform([], arg_2=arg_3()) > 0.5\n    if arg_1 % 2 == 0:\n\n      def _exchange():\n        arg_5 = tf.range(arg_1)\n        if arg_1 > 2:\n          arg_6 = tf.cast(~arg_4, dtype=tf.int32)\n          arg_7 = arg_1 - arg_6\n          arg_5 = arg_5[arg_6:arg_7]\n        return tf.reshape(arg_5, [tf.size(input=arg_5) // 2, 2])\n    else:\n\n      def _exchange():\n        arg_6 = tf.cast(arg_4, dtype=tf.int32)\n        arg_7 = arg_1 - tf.cast(~arg_4, dtype=tf.int32)\n        arg_5 = tf.range(arg_1)[arg_6:arg_7]\n        return tf.reshape(arg_5, [tf.size(input=arg_5) // 2, 2])\n\n    def _null_exchange():\n      return tf.reshape(tf.cast([], dtype=tf.int32), shape=[0, 2])\n\n    return tf.cond(\n        pred=tf.random.uniform([], arg_2=arg_3()) < arg_0,\n        true_fn=_exchange,\n        false_fn=_null_exchange)\n\n  return Func_", "path": "tensorflow_probability/python/mcmc/replica_exchange_mc.py", "identifier": "default_exchange_proposed_fn", "docstring": "Default exchange proposal function, for replica exchange MC.\n\n  With probability `prob_exchange` propose combinations of replica for exchange.\n  When exchanging, create combinations of adjacent replicas in\n  [Replica Exchange Monte Carlo](\n  https://en.wikipedia.org/wiki/Parallel_tempering)\n\n  ```\n  exchange_fn = default_exchange_proposed_fn(prob_exchange=0.5)\n  exchange_proposed = exchange_fn(num_replica=3)\n\n  exchange_proposed.eval()\n  ==> [[0, 1]]  # 1 exchange, 0 <--> 1\n\n  exchange_proposed.eval()\n  ==> []  # 0 exchanges\n  ```\n\n  Args:\n    prob_exchange: Scalar `Tensor` giving probability that any exchanges will\n      be generated.\n\n  Returns:\n    default_exchange_proposed_fn_: Python callable which take a number of\n      replicas (a Python integer), and return combinations of replicas for\n      exchange as an [n, 2] integer `Tensor`, `0 <= n <= num_replica // 2`,\n      with *unique* values in the set `{0, ..., num_replica}`.", "docstring_tokens": ["Default", "exchange", "proposal", "function", "for", "replica", "exchange", "MC", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260811}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/data_provider/data_manager.py#L90-L99", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Shutdown the ThreadPool.", "language": "python", "parameters": "(self, block=False)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "arg_0", ".", "executor", ".", "Func", "(", "wait", "=", "arg_1", ")", "logger", ".", "debug", "(", "\"Done with executor Func\"", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"Shutdown the ThreadPool.\n\n        Kwargs:\n            - block (bool): To block for confirmations or not\n\n        \"\"\"\n        arg_2 = arg_0.executor.Func(wait=arg_1)\n        logger.debug(\"Done with executor Func\")\n        return arg_2", "path": "parsl/data_provider/data_manager.py", "identifier": "DataManager.shutdown", "docstring": "Shutdown the ThreadPool.\n\n        Kwargs:\n            - block (bool): To block for confirmations or not", "docstring_tokens": ["Shutdown", "the", "ThreadPool", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 260812}
{"url": "https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/resources/resource/base.py#L178-L214", "sha": "d61eca9082256cb1e7f7f3c7f2fbc4b697157de7", "docstring_summary": "Traverses down the path and determines the accessed resource.", "language": "python", "parameters": "(cls, request, params=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "parse", "(", "arg_1", ".", "path", ")", "if", "arg_3", "is", "None", ":", "return", "arg_0", ",", "{", "}", "elif", "not", "arg_3", ":", "raise", "http", ".", "exceptions", ".", "NotFound", "(", ")", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_3", "if", "arg_2", ":", "arg_5", ".", "update", "(", "arg_2", ")", "if", "arg_4", "is", "None", ":", "return", "arg_0", ",", "arg_5", "if", "arg_5", ".", "get", "(", "'path'", ")", "is", "not", "None", ":", "arg_1", ".", "path", "=", "arg_5", ".", "pop", "(", "'path'", ")", "elif", "arg_6", "is", "not", "None", ":", "arg_1", ".", "path", "=", "arg_6", "arg_3", "=", "arg_4", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_5", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Traverses down the path and determines the accessed resource.\n\n        This makes use of the patterns array to implement simple traversal.\n        This defaults to a no-op if there are no defined patterns.\n        \"\"\"\n        # Attempt to parse the path using a pattern.\n        arg_3 = arg_0.parse(arg_1.path)\n        if arg_3 is None:\n            # No parsing was requested; no-op.\n            return arg_0, {}\n\n        elif not arg_3:\n            # Parsing failed; raise 404.\n            raise http.exceptions.NotFound()\n\n        # Partition out the result.\n        arg_4, arg_5, arg_6 = arg_3\n\n        if arg_2:\n            # Append params to data.\n            arg_5.update(arg_2)\n\n        if arg_4 is None:\n            # No traversal; return parameters.\n            return arg_0, arg_5\n\n        # Modify the path appropriately.\n        if arg_5.get('path') is not None:\n            arg_1.path = arg_5.pop('path')\n\n        elif arg_6 is not None:\n            arg_1.path = arg_6\n\n        # Send us through traversal again.\n        arg_3 = arg_4.Func(arg_1, arg_2=arg_5)\n        return arg_3", "path": "armet/resources/resource/base.py", "identifier": "Resource.traverse", "docstring": "Traverses down the path and determines the accessed resource.\n\n        This makes use of the patterns array to implement simple traversal.\n        This defaults to a no-op if there are no defined patterns.", "docstring_tokens": ["Traverses", "down", "the", "path", "and", "determines", "the", "accessed", "resource", "."], "nwo": "armet/python-armet", "score": 0.17782712273869106, "idx": 260813}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/utils.py#L117-L126", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Find the global minimum of a function represented as an interpolation object.", "language": "python", "parameters": "(interp_object)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "arg_0", ".", "x", "[", "arg_0", "(", "arg_0", ".", "x", ")", ".", "argmin", "(", ")", "]", "except", "Exception", "as", "e", ":", "arg_1", "=", "\"Cannot find minimum of the interpolation object\"", "+", "str", "(", "arg_0", ".", "x", ")", "+", "\"Minimal x: \"", "+", "str", "(", "arg_0", ".", "x", ".", "min", "(", ")", ")", "+", "\"Maximal x: \"", "+", "str", "(", "arg_0", ".", "x", ".", "max", "(", ")", ")", "raise", "e"], "function": "def Func(arg_0):\n    \"\"\"\n    Find the global minimum of a function represented as an interpolation object.\n    \"\"\"\n    try:\n        return arg_0.x[arg_0(arg_0.x).argmin()]\n    except Exception as e:\n        arg_1 = \"Cannot find minimum of the interpolation object\" + str(arg_0.x) + \\\n        \"Minimal x: \" + str(arg_0.x.min()) + \"Maximal x: \" + str(arg_0.x.max())\n        raise e", "path": "treetime/utils.py", "identifier": "min_interp", "docstring": "Find the global minimum of a function represented as an interpolation object.", "docstring_tokens": ["Find", "the", "global", "minimum", "of", "a", "function", "represented", "as", "an", "interpolation", "object", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 260814}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/CGNN.py#L162-L172", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Parallelize the various runs of CGNN to evaluate a graph.", "language": "python", "parameters": "(data, adj_matrix, nb_runs=16,\n                              nb_jobs=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "16", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "arg_3", "=", "SETTINGS", ".", "get_default", "(", "arg_3", "=", "arg_3", ")", "if", "arg_2", "==", "1", ":", "return", "graph_evaluation", "(", "arg_0", ",", "arg_1", ",", "**", "arg_4", ")", "else", ":", "arg_5", "=", "Parallel", "(", "n_jobs", "=", "arg_3", ")", "(", "delayed", "(", "graph_evaluation", ")", "(", "arg_0", ",", "arg_1", ",", "idx", "=", "run", ",", "gpu_id", "=", "run", "%", "SETTINGS", ".", "GPU", ",", "**", "arg_4", ")", "for", "run", "in", "range", "(", "arg_2", ")", ")", "return", "np", ".", "mean", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=16,\n                              arg_3=None, **arg_4):\n    \"\"\"Parallelize the various runs of CGNN to evaluate a graph.\"\"\"\n    arg_3 = SETTINGS.get_default(arg_3=arg_3)\n    if arg_2 == 1:\n        return graph_evaluation(arg_0, arg_1, **arg_4)\n    else:\n        arg_5 = Parallel(n_jobs=arg_3)(delayed(graph_evaluation)(arg_0, arg_1,\n                                          idx=run, gpu_id=run % SETTINGS.GPU,\n                                          **arg_4) for run in range(arg_2))\n        return np.mean(arg_5)", "path": "cdt/causality/graph/CGNN.py", "identifier": "parallel_graph_evaluation", "docstring": "Parallelize the various runs of CGNN to evaluate a graph.", "docstring_tokens": ["Parallelize", "the", "various", "runs", "of", "CGNN", "to", "evaluate", "a", "graph", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 260815}
{"url": "https://github.com/worldcompany/djangoembed/blob/f3f2be283441d91d1f89db780444dc75f7b51902/oembed/providers.py#L441-L446", "sha": "f3f2be283441d91d1f89db780444dc75f7b51902", "docstring_summary": "Return an ImageFileField instance", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_meta", ".", "image_field", ":", "return", "getattr", "(", "arg_1", ",", "arg_0", ".", "_meta", ".", "image_field", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return an ImageFileField instance\n        \"\"\"\n        if arg_0._meta.image_field:\n            return getattr(arg_1, arg_0._meta.image_field)", "path": "oembed/providers.py", "identifier": "DjangoProvider.get_image", "docstring": "Return an ImageFileField instance", "docstring_tokens": ["Return", "an", "ImageFileField", "instance"], "nwo": "worldcompany/djangoembed", "score": 0.23137166388621372, "idx": 260816}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/enums.py#L1835-L1848", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "A utility function that creates a list of enumeration values from a bit\n    mask for a specific mask enumeration class.", "language": "python", "parameters": "(enumeration, mask)", "return_statement": "return [x for x in enumeration if (x.value & mask) == x.value]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "[", "arg_2", "for", "arg_2", "in", "arg_0", "if", "(", "arg_2", ".", "value", "&", "arg_1", ")", "==", "arg_2", ".", "value", "]"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    A utility function that creates a list of enumeration values from a bit\n    mask for a specific mask enumeration class.\n\n    Args:\n        enumeration (class): The enumeration class from which to draw\n            enumeration values.\n        mask (int): The bit mask from which to identify enumeration values.\n\n    Returns:\n        list: A list of enumeration values corresponding to the bit mask.\n    \"\"\"\n    return [arg_2 for arg_2 in arg_0 if (arg_2.value & arg_1) == arg_2.value]", "path": "kmip/core/enums.py", "identifier": "get_enumerations_from_bit_mask", "docstring": "A utility function that creates a list of enumeration values from a bit\n    mask for a specific mask enumeration class.\n\n    Args:\n        enumeration (class): The enumeration class from which to draw\n            enumeration values.\n        mask (int): The bit mask from which to identify enumeration values.\n\n    Returns:\n        list: A list of enumeration values corresponding to the bit mask.", "docstring_tokens": ["A", "utility", "function", "that", "creates", "a", "list", "of", "enumeration", "values", "from", "a", "bit", "mask", "for", "a", "specific", "mask", "enumeration", "class", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 260817}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/memory_profiler.py#L188-L207", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Collects memory stats for specified Python program.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'objectName': self._object_name,\n            'codeEvents': prof.code_events,\n            'totalEvents': len(prof.code_events),\n            'objectsCount': pretty_obj_count,\n            'result': result,\n            'timestamp': int(time.time())\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "_get_in_memory_objects", "(", ")", "arg_2", ",", "arg_3", "=", "arg_0", ".", "profile", "(", ")", "arg_4", "=", "_get_in_memory_objects", "(", ")", "arg_5", "=", "_get_obj_count_difference", "(", "arg_4", ",", "arg_1", ")", "arg_6", "=", "arg_5", "-", "arg_2", ".", "obj_overhead", "arg_6", "[", "list", "]", "-=", "1", "arg_7", "=", "_format_obj_count", "(", "arg_6", ")", "return", "{", "'objectName'", ":", "arg_0", ".", "_object_name", ",", "'codeEvents'", ":", "arg_2", ".", "code_events", ",", "'totalEvents'", ":", "len", "(", "arg_2", ".", "code_events", ")", ",", "'objectsCount'", ":", "arg_7", ",", "'result'", ":", "arg_3", ",", "'timestamp'", ":", "int", "(", "time", ".", "time", "(", ")", ")", "}"], "function": "def Func(arg_0):\n        \"\"\"Collects memory stats for specified Python program.\"\"\"\n        arg_1 = _get_in_memory_objects()\n        arg_2, arg_3 = arg_0.profile()\n        arg_4 = _get_in_memory_objects()\n\n        arg_5 = _get_obj_count_difference(arg_4, arg_1)\n        arg_6 = arg_5 - arg_2.obj_overhead\n\n        # existing_objects list is also profiler overhead\n        arg_6[list] -= 1\n        arg_7 = _format_obj_count(arg_6)\n        return {\n            'objectName': arg_0._object_name,\n            'codeEvents': arg_2.code_events,\n            'totalEvents': len(arg_2.code_events),\n            'objectsCount': arg_7,\n            'result': arg_3,\n            'timestamp': int(time.time())\n        }", "path": "vprof/memory_profiler.py", "identifier": "MemoryProfiler.run", "docstring": "Collects memory stats for specified Python program.", "docstring_tokens": ["Collects", "memory", "stats", "for", "specified", "Python", "program", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 260818}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L594-L632", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "scp and extract package", "language": "python", "parameters": "(package_file, destinations, cl_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_1", ":", "if", "is_self", "(", "arg_4", ")", ":", "continue", "Log", ".", "info", "(", "\"Server: %s\"", "%", "arg_4", ")", "arg_5", "=", "\"/tmp/heron.tar.gz\"", "arg_6", "=", "\"%s:%s\"", "%", "(", "arg_4", ",", "arg_5", ")", "arg_7", "=", "\"rm -rf ~/.heron && mkdir ~/.heron \"", "\"&& tar -xzvf %s -C ~/.heron --strip-components 1\"", "%", "(", "arg_5", ")", "arg_8", "=", "'%s && %s'", "%", "(", "scp_cmd", "(", "arg_0", ",", "arg_6", ",", "arg_2", ")", ",", "ssh_remote_execute", "(", "arg_7", ",", "arg_4", ",", "arg_2", ")", ")", "Log", ".", "debug", "(", "arg_8", ")", "arg_9", "=", "subprocess", ".", "Popen", "(", "arg_8", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "arg_3", ".", "append", "(", "{", "\"pid\"", ":", "arg_9", ",", "\"dest\"", ":", "arg_4", "}", ")", "arg_10", "=", "[", "]", "for", "arg_11", "in", "arg_3", ":", "arg_9", "=", "arg_11", "[", "\"pid\"", "]", "arg_12", "=", "arg_9", ".", "wait", "(", ")", "arg_13", "=", "arg_9", ".", "communicate", "(", ")", "Log", ".", "debug", "(", "\"return code: %s output: %s\"", "%", "(", "arg_12", ",", "arg_13", ")", ")", "if", "arg_12", "!=", "0", ":", "arg_10", ".", "append", "(", "\"Failed to scp package to %s with error:\\n%s\"", "%", "(", "arg_11", "[", "\"dest\"", "]", ",", "arg_13", "[", "1", "]", ")", ")", "if", "arg_10", ":", "for", "arg_14", "in", "arg_10", ":", "Log", ".", "error", "(", "arg_14", ")", "sys", ".", "exit", "(", "-", "1", ")", "Log", ".", "info", "(", "\"Done distributing packages\"", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n  '''\n  scp and extract package\n  '''\n  arg_3 = []\n  for arg_4 in arg_1:\n    if is_self(arg_4):\n      continue\n    Log.info(\"Server: %s\" % arg_4)\n    arg_5 = \"/tmp/heron.tar.gz\"\n    arg_6 = \"%s:%s\" % (arg_4, arg_5)\n\n    arg_7 = \"rm -rf ~/.heron && mkdir ~/.heron \" \\\n                 \"&& tar -xzvf %s -C ~/.heron --strip-components 1\" % (arg_5)\n    arg_8 = '%s && %s' \\\n          % (scp_cmd(arg_0, arg_6, arg_2),\n             ssh_remote_execute(arg_7, arg_4, arg_2))\n    Log.debug(arg_8)\n    arg_9 = subprocess.Popen(arg_8,\n                           shell=True,\n                           stdout=subprocess.PIPE,\n                           stderr=subprocess.PIPE)\n    arg_3.append({\"pid\": arg_9, \"dest\": arg_4})\n\n  arg_10 = []\n  for arg_11 in arg_3:\n    arg_9 = arg_11[\"pid\"]\n    arg_12 = arg_9.wait()\n    arg_13 = arg_9.communicate()\n    Log.debug(\"return code: %s output: %s\" % (arg_12, arg_13))\n    if arg_12 != 0:\n      arg_10.append(\"Failed to scp package to %s with error:\\n%s\" % (arg_11[\"dest\"], arg_13[1]))\n\n  if arg_10:\n    for arg_14 in arg_10:\n      Log.error(arg_14)\n    sys.exit(-1)\n\n  Log.info(\"Done distributing packages\")", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "scp_package", "docstring": "scp and extract package", "docstring_tokens": ["scp", "and", "extract", "package"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260819}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L429-L443", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Set request parameters. Will always add the user ID if it hasn't\n        been specifically set by an API method", "language": "python", "parameters": "(self, query_string, no_params=False)", "return_statement": "return query", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "try", ":", "arg_3", "=", "quote", "(", "arg_1", ".", "format", "(", "u", "=", "arg_0", ".", "library_id", ",", "t", "=", "arg_0", ".", "library_type", ")", ")", "except", "KeyError", "as", "err", ":", "raise", "ze", ".", "ParamNotPassed", "(", "\"There's a request parameter missing: %s\"", "%", "err", ")", "if", "arg_2", "is", "False", ":", "if", "not", "arg_0", ".", "url_params", ":", "arg_0", ".", "add_parameters", "(", ")", "arg_3", "=", "\"%s?%s\"", "%", "(", "arg_3", ",", "arg_0", ".", "url_params", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Set request parameters. Will always add the user ID if it hasn't\n        been specifically set by an API method\n        \"\"\"\n        try:\n            arg_3 = quote(arg_1.format(u=arg_0.library_id, t=arg_0.library_type))\n        except KeyError as err:\n            raise ze.ParamNotPassed(\"There's a request parameter missing: %s\" % err)\n        # Add the URL parameters and the user key, if necessary\n        if arg_2 is False:\n            if not arg_0.url_params:\n                arg_0.add_parameters()\n            arg_3 = \"%s?%s\" % (arg_3, arg_0.url_params)\n        return arg_3", "path": "pyzotero/zotero.py", "identifier": "Zotero._build_query", "docstring": "Set request parameters. Will always add the user ID if it hasn't\n        been specifically set by an API method", "docstring_tokens": ["Set", "request", "parameters", ".", "Will", "always", "add", "the", "user", "ID", "if", "it", "hasn", "t", "been", "specifically", "set", "by", "an", "API", "method"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 260820}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/utils.py#L35-L59", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Get all IP addresses.", "language": "python", "parameters": "()", "return_statement": "return sorted(list(addresses))", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "set", "(", ")", "for", "arg_1", "in", "ifaddr", ".", "get_adapters", "(", ")", ":", "for", "arg_2", "in", "arg_1", ".", "ips", ":", "if", "arg_2", ".", "is_IPv4", ":", "arg_3", "=", "arg_2", ".", "ip", "if", "not", "arg_3", ".", "startswith", "(", "'169.254.'", ")", ":", "arg_0", ".", "add", "(", "arg_3", ")", "elif", "arg_2", ".", "is_IPv6", ":", "arg_3", "=", "arg_2", ".", "ip", "[", "0", "]", ".", "split", "(", "'%'", ")", "[", "0", "]", ".", "lower", "(", ")", "if", "not", "arg_3", ".", "startswith", "(", "'fe80:'", ")", ":", "arg_0", ".", "add", "(", "'[{}]'", ".", "format", "(", "arg_3", ")", ")", "return", "sorted", "(", "list", "(", "arg_0", ")", ")"], "function": "def Func():\n    \"\"\"\n    Get all IP addresses.\n\n    Returns list of addresses.\n    \"\"\"\n    arg_0 = set()\n\n    for arg_1 in ifaddr.get_adapters():\n        for arg_2 in arg_1.ips:\n            # Filter out link-local addresses.\n            if arg_2.is_IPv4:\n                arg_3 = arg_2.ip\n\n                if not arg_3.startswith('169.254.'):\n                    arg_0.add(arg_3)\n            elif arg_2.is_IPv6:\n                # Sometimes, IPv6 addresses will have the interface name\n                # appended, e.g. %eth0. Handle that.\n                arg_3 = arg_2.ip[0].split('%')[0].lower()\n\n                if not arg_3.startswith('fe80:'):\n                    arg_0.add('[{}]'.format(arg_3))\n\n    return sorted(list(arg_0))", "path": "webthing/utils.py", "identifier": "get_addresses", "docstring": "Get all IP addresses.\n\n    Returns list of addresses.", "docstring_tokens": ["Get", "all", "IP", "addresses", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 260821}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/convert/tiff.py#L98-L133", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Load a multipage tiff into a single variable in x,y,z format.", "language": "python", "parameters": "(tiff_filename, dtype='float32')", "return_statement": "return im", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "'float32'", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "raise", "RuntimeError", "(", "'could not find file \"%s\"'", "%", "arg_0", ")", "arg_2", "=", "tiff", ".", "imread", "(", "arg_0", ")", "arg_3", "=", "[", "]", "while", "True", ":", "arg_4", "=", "numpy", ".", "array", "(", "arg_2", ",", "arg_1", "=", "arg_1", ")", "if", "arg_4", ".", "ndim", "==", "2", ":", "arg_4", "=", "arg_4", "[", "numpy", ".", "newaxis", ",", "...", "]", "arg_3", ".", "append", "(", "arg_4", ")", "try", ":", "arg_2", ".", "seek", "(", "arg_2", ".", "tell", "(", ")", "+", "1", ")", "except", "EOFError", ":", "break", "arg_3", "=", "numpy", ".", "concatenate", "(", "arg_3", ",", "axis", "=", "0", ")", "arg_3", "=", "numpy", ".", "rollaxis", "(", "arg_3", ",", "1", ")", "arg_3", "=", "numpy", ".", "rollaxis", "(", "arg_3", ",", "2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1='float32'):\n    \"\"\"\n    Load a multipage tiff into a single variable in x,y,z format.\n\n    Arguments:\n        tiff_filename:     Filename of source data\n        dtype:             data type to use for the returned tensor\n\n    Returns:\n        Array containing contents from input tiff file in xyz order\n    \"\"\"\n    if not os.path.isfile(arg_0):\n        raise RuntimeError('could not find file \"%s\"' % arg_0)\n\n    # load the data from multi-layer TIF files\n    arg_2 = tiff.imread(arg_0)\n\n    arg_3 = []\n\n    while True:\n\n        arg_4 = numpy.array(arg_2, arg_1=arg_1)\n        if arg_4.ndim == 2:\n            arg_4 = arg_4[numpy.newaxis, ...]  # add slice dimension\n        arg_3.append(arg_4)\n\n        try:\n            arg_2.seek(arg_2.tell()+1)\n        except EOFError:\n            break  # this just means hit end of file (not really an error)\n\n    arg_3 = numpy.concatenate(arg_3, axis=0)  # list of 2d -> tensor\n    arg_3 = numpy.rollaxis(arg_3, 1)\n    arg_3 = numpy.rollaxis(arg_3, 2)\n\n    return arg_3", "path": "ndio/convert/tiff.py", "identifier": "load_tiff_multipage", "docstring": "Load a multipage tiff into a single variable in x,y,z format.\n\n    Arguments:\n        tiff_filename:     Filename of source data\n        dtype:             data type to use for the returned tensor\n\n    Returns:\n        Array containing contents from input tiff file in xyz order", "docstring_tokens": ["Load", "a", "multipage", "tiff", "into", "a", "single", "variable", "in", "x", "y", "z", "format", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 260822}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/__init__.py#L483-L491", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Begins watching etcd for changes.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "watcher", "and", "arg_0", ".", "watcher", ".", "is_alive", "(", ")", ":", "return", "arg_0", ".", "watcher", "=", "Watcher", "(", ")", "arg_0", ".", "watcher", ".", "start", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Begins watching etcd for changes. \"\"\"\n        # Don't create a new watcher thread if we already have one running\n        if arg_0.watcher and arg_0.watcher.is_alive():\n            return\n\n        # Create a new watcher thread and start it\n        arg_0.watcher = Watcher()\n        arg_0.watcher.start()", "path": "pyconfig/__init__.py", "identifier": "etcd.start_watching", "docstring": "Begins watching etcd for changes.", "docstring_tokens": ["Begins", "watching", "etcd", "for", "changes", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 260823}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/trust_list.py#L205-L227", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "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.", "language": "python", "parameters": "(filetime)", "return_statement": "return seconds_since_1601 - 11644473600", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "struct", ".", "unpack", "(", "b'>Q'", ",", "struct", ".", "pack", "(", "b'>LL'", ",", "arg_0", ".", "dwHighDateTime", ",", "arg_0", ".", "dwLowDateTime", ")", ")", "[", "0", "]", "arg_2", "=", "arg_1", "/", "10000000", "return", "arg_2", "-", "11644473600"], "function": "def Func(arg_0):\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 struct object\n\n    :return:\n        An integer unix timestamp\n    \"\"\"\n\n    arg_1 = struct.unpack(\n        b'>Q',\n        struct.pack(\n            b'>LL',\n            arg_0.dwHighDateTime,\n            arg_0.dwLowDateTime\n        )\n    )[0]\n    arg_2 = arg_1 / 10000000\n    return arg_2 - 11644473600", "path": "oscrypto/_win/trust_list.py", "identifier": "_convert_filetime_to_timestamp", "docstring": "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 struct object\n\n    :return:\n        An integer unix timestamp", "docstring_tokens": ["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", "."], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 260824}
{"url": "https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/rrule.py#L232-L271", "sha": "782ca4b2edbd4b4018b8cedee42eeae7c921b917", "docstring_summary": "Generator which yields up to `count` recurrences after the given\n        datetime instance, equivalent to `after`.", "language": "python", "parameters": "(self, dt, count=None, inc=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "if", "arg_0", ".", "_cache_complete", ":", "arg_4", "=", "arg_0", ".", "_cache", "else", ":", "arg_4", "=", "arg_0", "if", "arg_3", ":", "def", "comp", "(", "arg_5", ",", "arg_6", ")", ":", "return", "arg_5", ">=", "arg_6", "else", ":", "def", "comp", "(", "arg_5", ",", "arg_6", ")", ":", "return", "arg_5", ">", "arg_6", "arg_7", "=", "0", "for", "arg_8", "in", "arg_4", ":", "if", "comp", "(", "arg_8", ",", "arg_1", ")", ":", "if", "arg_2", "is", "not", "None", ":", "arg_7", "+=", "1", "if", "arg_7", ">", "arg_2", ":", "break", "yield", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        \"\"\"\n        Generator which yields up to `count` recurrences after the given\n        datetime instance, equivalent to `after`.\n\n        :param dt:\n            The datetime at which to start generating recurrences.\n\n        :param count:\n            The maximum number of recurrences to generate. If `None` (default),\n            dates are generated until the recurrence rule is exhausted.\n\n        :param inc:\n            If `dt` is an instance of the rule and `inc` is `True`, it is\n            included in the output.\n\n        :yields: Yields a sequence of `datetime` objects.\n        \"\"\"\n\n        if arg_0._cache_complete:\n            arg_4 = arg_0._cache\n        else:\n            arg_4 = arg_0\n\n        # Select the comparison function\n        if arg_3:\n            def comp(arg_5, arg_6): return arg_5 >= arg_6\n        else:\n            def comp(arg_5, arg_6): return arg_5 > arg_6\n\n        # Generate dates\n        arg_7 = 0\n        for arg_8 in arg_4:\n            if comp(arg_8, arg_1):\n                if arg_2 is not None:\n                    arg_7 += 1\n                    if arg_7 > arg_2:\n                        break\n\n                yield arg_8", "path": "superjson/pkg/dateutil/rrule.py", "identifier": "rrulebase.xafter", "docstring": "Generator which yields up to `count` recurrences after the given\n        datetime instance, equivalent to `after`.\n\n        :param dt:\n            The datetime at which to start generating recurrences.\n\n        :param count:\n            The maximum number of recurrences to generate. If `None` (default),\n            dates are generated until the recurrence rule is exhausted.\n\n        :param inc:\n            If `dt` is an instance of the rule and `inc` is `True`, it is\n            included in the output.\n\n        :yields: Yields a sequence of `datetime` objects.", "docstring_tokens": ["Generator", "which", "yields", "up", "to", "count", "recurrences", "after", "the", "given", "datetime", "instance", "equivalent", "to", "after", "."], "nwo": "MacHu-GWU/superjson-project", "score": 0.2549979292514255, "idx": 260825}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/webhooks.py#L225-L239", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Delete a webhook, by ID.", "language": "python", "parameters": "(self, webhookId)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "arg_0", ".", "_session", ".", "Func", "(", "API_ENDPOINT", "+", "'/'", "+", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Delete a webhook, by ID.\n\n        Args:\n            webhookId(basestring): The ID of the webhook to be Funcd.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n\n        # API request\n        arg_0._session.Func(API_ENDPOINT + '/' + arg_1)", "path": "webexteamssdk/api/webhooks.py", "identifier": "WebhooksAPI.delete", "docstring": "Delete a webhook, by ID.\n\n        Args:\n            webhookId(basestring): The ID of the webhook to be deleted.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Delete", "a", "webhook", "by", "ID", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 260826}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L2445-L2458", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Go through the dag_runs and update the state based on the task_instance state.\n        Then set DAG runs that are not finished to failed.", "language": "python", "parameters": "(self, dag_runs, session=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "for", "arg_3", "in", "arg_1", ":", "arg_3", ".", "update_state", "(", ")", "if", "arg_3", ".", "state", "not", "in", "State", ".", "finished", "(", ")", ":", "arg_3", ".", "set_state", "(", "State", ".", "FAILED", ")", "arg_2", ".", "merge", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Go through the dag_runs and update the state based on the task_instance state.\n        Then set DAG runs that are not finished to failed.\n\n        :param dag_runs: DAG runs\n        :param session: session\n        :return: None\n        \"\"\"\n        for arg_3 in arg_1:\n            arg_3.update_state()\n            if arg_3.state not in State.finished():\n                arg_3.set_state(State.FAILED)\n            arg_2.merge(arg_3)", "path": "airflow/jobs.py", "identifier": "BackfillJob._set_unfinished_dag_runs_to_failed", "docstring": "Go through the dag_runs and update the state based on the task_instance state.\n        Then set DAG runs that are not finished to failed.\n\n        :param dag_runs: DAG runs\n        :param session: session\n        :return: None", "docstring_tokens": ["Go", "through", "the", "dag_runs", "and", "update", "the", "state", "based", "on", "the", "task_instance", "state", ".", "Then", "set", "DAG", "runs", "that", "are", "not", "finished", "to", "failed", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260827}
{"url": "https://github.com/suryakencana007/baka_model/blob/915c2da9920e973302f5764ae63799acd5ecf0b7/baka_model/model/meta/orm.py#L37-L48", "sha": "915c2da9920e973302f5764ae63799acd5ecf0b7", "docstring_summary": "Use an event to build a one-to-many relationship on a class.", "language": "python", "parameters": "(clsname, **kw)", "return_statement": "return o2m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "@", "declared_attr", "def", "o2m", "(", "arg_2", ")", ":", "arg_2", ".", "_references", "(", "(", "arg_0", ",", "arg_2", ".", "__name__", ")", ")", "return", "relationship", "(", "arg_0", ",", "**", "arg_1", ")", "return", "o2m"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"Use an event to build a one-to-many relationship on a class.\n\n    This makes use of the :meth:`.References._reference_table` method\n    to generate a full foreign key relationship from the remote table.\n\n    \"\"\"\n    @declared_attr\n    def o2m(arg_2):\n        arg_2._references((arg_0, arg_2.__name__))\n        return relationship(arg_0, **arg_1)\n    return o2m", "path": "baka_model/model/meta/orm.py", "identifier": "one_to_many", "docstring": "Use an event to build a one-to-many relationship on a class.\n\n    This makes use of the :meth:`.References._reference_table` method\n    to generate a full foreign key relationship from the remote table.", "docstring_tokens": ["Use", "an", "event", "to", "build", "a", "one", "-", "to", "-", "many", "relationship", "on", "a", "class", "."], "nwo": "suryakencana007/baka_model", "score": 0.0, "idx": 260828}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passes/optimize_1q_gates.py#L212-L235", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Express a Y.Z.Y single qubit gate as a Z.Y.Z gate.", "language": "python", "parameters": "(xi, theta1, theta2, eps=1e-9)", "return_statement": "return out_angles", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "1e-9", ")", ":", "arg_4", "=", "quaternion_from_euler", "(", "[", "arg_1", ",", "arg_0", ",", "arg_2", "]", ",", "'yzy'", ")", "arg_5", "=", "arg_4", ".", "to_zyz", "(", ")", "arg_6", "=", "quaternion_from_euler", "(", "arg_5", ",", "'zyz'", ")", "arg_7", "=", "(", "arg_5", "[", "1", "]", ",", "arg_5", "[", "0", "]", ",", "arg_5", "[", "2", "]", ")", "arg_8", "=", "abs", "(", "arg_6", ".", "data", ".", "dot", "(", "arg_4", ".", "data", ")", ")", "if", "not", "np", ".", "allclose", "(", "arg_8", ",", "1", ",", "arg_3", ")", ":", "raise", "TranspilerError", "(", "'YZY and ZYZ angles do not give same rotation matrix.'", ")", "arg_7", "=", "tuple", "(", "0", "if", "np", ".", "abs", "(", "angle", ")", "<", "_CHOP_THRESHOLD", "else", "angle", "for", "angle", "in", "arg_7", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=1e-9):  # pylint: disable=invalid-name\n        \"\"\"Express a Y.Z.Y single qubit gate as a Z.Y.Z gate.\n\n        Solve the equation\n\n        .. math::\n\n        Ry(theta1).Rz(xi).Ry(theta2) = Rz(phi).Ry(theta).Rz(lambda)\n\n        for theta, phi, and lambda.\n\n        Return a solution theta, phi, and lambda.\n        \"\"\"\n        arg_4 = quaternion_from_euler([arg_1, arg_0, arg_2], 'yzy')\n        arg_5 = arg_4.to_zyz()\n        arg_6 = quaternion_from_euler(arg_5, 'zyz')\n        # output order different than rotation order\n        arg_7 = (arg_5[1], arg_5[0], arg_5[2])\n        arg_8 = abs(arg_6.data.dot(arg_4.data))\n        if not np.allclose(arg_8, 1, arg_3):\n            raise TranspilerError('YZY and ZYZ angles do not give same rotation matrix.')\n        arg_7 = tuple(0 if np.abs(angle) < _CHOP_THRESHOLD else angle\n                           for angle in arg_7)\n        return arg_7", "path": "qiskit/transpiler/passes/optimize_1q_gates.py", "identifier": "Optimize1qGates.yzy_to_zyz", "docstring": "Express a Y.Z.Y single qubit gate as a Z.Y.Z gate.\n\n        Solve the equation\n\n        .. math::\n\n        Ry(theta1).Rz(xi).Ry(theta2) = Rz(phi).Ry(theta).Rz(lambda)\n\n        for theta, phi, and lambda.\n\n        Return a solution theta, phi, and lambda.", "docstring_tokens": ["Express", "a", "Y", ".", "Z", ".", "Y", "single", "qubit", "gate", "as", "a", "Z", ".", "Y", ".", "Z", "gate", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260829}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/agents/agent.py#L279-L289", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Creates an agent from a specification dict.", "language": "python", "parameters": "(spec, kwargs)", "return_statement": "return agent", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "util", ".", "get_object", "(", "obj", "=", "arg_0", ",", "predefined_objects", "=", "tensorforce", ".", "agents", ".", "agents", ",", "arg_1", "=", "arg_1", ")", "assert", "isinstance", "(", "arg_2", ",", "Agent", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Creates an agent from a specification dict.\n        \"\"\"\n        arg_2 = util.get_object(\n            obj=arg_0,\n            predefined_objects=tensorforce.agents.agents,\n            arg_1=arg_1\n        )\n        assert isinstance(arg_2, Agent)\n        return arg_2", "path": "tensorforce/agents/agent.py", "identifier": "Agent.from_spec", "docstring": "Creates an agent from a specification dict.", "docstring_tokens": ["Creates", "an", "agent", "from", "a", "specification", "dict", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 260830}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L240-L262", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Checks if an assignment node in an except handler clobbers an existing\n    variable.", "language": "python", "parameters": "(\n    node: astroid.node_classes.NodeNG\n)", "return_statement": "return False, None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "node_classes", ".", "NodeNG", ")", "->", "Tuple", "[", "bool", ",", "Tuple", "[", "str", ",", "str", "]", "]", ":", "if", "isinstance", "(", "arg_0", ",", "arg_1", ".", "AssignAttr", ")", ":", "return", "True", ",", "(", "arg_0", ".", "attrname", ",", "\"object %r\"", "%", "(", "arg_0", ".", "expr", ".", "as_string", "(", ")", ",", ")", ")", "if", "isinstance", "(", "arg_0", ",", "arg_1", ".", "AssignName", ")", ":", "arg_4", "=", "arg_0", ".", "name", "if", "is_builtin", "(", "arg_4", ")", ":", "return", "(", "True", ",", "(", "arg_4", ",", "\"builtins\"", ")", ")", "arg_5", "=", "arg_0", ".", "lookup", "(", "arg_4", ")", "[", "1", "]", "if", "arg_5", "and", "not", "isinstance", "(", "arg_5", "[", "0", "]", ".", "assign_type", "(", ")", ",", "(", "arg_1", ".", "Assign", ",", "arg_1", ".", "AugAssign", ",", "arg_1", ".", "ExceptHandler", ")", ",", ")", ":", "return", "True", ",", "(", "arg_4", ",", "\"outer scope (line %s)\"", "%", "arg_5", "[", "0", "]", ".", "fromlineno", ")", "return", "False", ",", "None"], "function": "def Func(\n    arg_0: arg_1.node_classes.NodeNG\n) -> Tuple[bool, Tuple[str, str]]:\n    \"\"\"Checks if an assignment node in an except handler clobbers an existing\n    variable.\n\n    Returns (True, args for W0623) if assignment clobbers an existing variable,\n    (False, None) otherwise.\n    \"\"\"\n    if isinstance(arg_0, arg_1.AssignAttr):\n        return True, (arg_0.attrname, \"object %r\" % (arg_0.expr.as_string(),))\n    if isinstance(arg_0, arg_1.AssignName):\n        arg_4 = arg_0.name\n        if is_builtin(arg_4):\n            return (True, (arg_4, \"builtins\"))\n\n        arg_5 = arg_0.lookup(arg_4)[1]\n        if arg_5 and not isinstance(\n            arg_5[0].assign_type(),\n            (arg_1.Assign, arg_1.AugAssign, arg_1.ExceptHandler),\n        ):\n            return True, (arg_4, \"outer scope (line %s)\" % arg_5[0].fromlineno)\n    return False, None", "path": "pylint/checkers/utils.py", "identifier": "clobber_in_except", "docstring": "Checks if an assignment node in an except handler clobbers an existing\n    variable.\n\n    Returns (True, args for W0623) if assignment clobbers an existing variable,\n    (False, None) otherwise.", "docstring_tokens": ["Checks", "if", "an", "assignment", "node", "in", "an", "except", "handler", "clobbers", "an", "existing", "variable", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260831}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/semilocal_linear_trend.py#L266-L296", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build the transition noise model for a semi-local linear trend model.", "language": "python", "parameters": "(level_scale,\n                                            slope_mean,\n                                            slope_scale,\n                                            autoregressive_coef)", "return_statement": "return tfd.MultivariateNormalDiag(\n      loc=bias,\n      scale_diag=scale_diag)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "dist_util", ".", "get_broadcast_shape", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "tf", ".", "ones", "(", "arg_4", ",", "dtype", "=", "arg_0", ".", "dtype", ")", "arg_6", "=", "tf", ".", "stack", "(", "[", "arg_0", "*", "arg_5", ",", "arg_2", "*", "arg_5", "]", ",", "axis", "=", "-", "1", ")", "arg_7", "=", "tf", ".", "stack", "(", "[", "tf", ".", "zeros_like", "(", "arg_5", ")", ",", "arg_1", "*", "(", "1", "-", "arg_3", ")", "*", "arg_5", "]", ",", "axis", "=", "-", "1", ")", "return", "tfd", ".", "MultivariateNormalDiag", "(", "loc", "=", "arg_7", ",", "arg_6", "=", "arg_6", ")"], "function": "def Func(arg_0,\n                                            arg_1,\n                                            arg_2,\n                                            arg_3):\n  \"\"\"Build the transition noise model for a semi-local linear trend model.\"\"\"\n\n  # At each timestep, the stochasticity of `level` and `slope` are given\n  # by `level_scale` and `slope_scale` respectively.\n  arg_4 = dist_util.get_broadcast_shape(\n      arg_0, arg_1, arg_2, arg_3)\n  arg_5 = tf.ones(arg_4, dtype=arg_0.dtype)\n  arg_6 = tf.stack([arg_0 * arg_5,\n                         arg_2 * arg_5],\n                        axis=-1)\n\n  # We additionally fold in a bias term implementing the nonzero `slope_mean`.\n  # The overall `slope` update is (from `SemiLocalLinearTrend` docstring)\n  #   slope[t] = (slope_mean +\n  #               autoregressive_coef * (slope[t-1] - slope_mean) +\n  #               Normal(0., slope_scale))\n  # which we rewrite as\n  #   slope[t] = (\n  #    autoregressive_coef * slope[t-1] +                  # linear transition\n  #    Normal(loc=slope_mean - autoregressive_coef * slope_mean,  # noise bias\n  #           scale=slope_scale))                                 # noise scale\n  arg_7 = tf.stack([tf.zeros_like(arg_5),\n                   arg_1 * (1 - arg_3) * arg_5],\n                  axis=-1)\n  return tfd.MultivariateNormalDiag(\n      loc=arg_7,\n      arg_6=arg_6)", "path": "tensorflow_probability/python/sts/semilocal_linear_trend.py", "identifier": "semilocal_linear_trend_transition_noise", "docstring": "Build the transition noise model for a semi-local linear trend model.", "docstring_tokens": ["Build", "the", "transition", "noise", "model", "for", "a", "semi", "-", "local", "linear", "trend", "model", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260832}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L1814-L1830", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Halt execution and register account for later deletion", "language": "python", "parameters": "(self, recipient)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "Operators", ".", "EXTRACT", "(", "arg_1", ",", "0", ",", "160", ")", "arg_2", "=", "arg_0", ".", "address", "if", "issymbolic", "(", "arg_1", ")", ":", "logger", ".", "info", "(", "\"Symbolic recipient on self destruct\"", ")", "arg_1", "=", "solver", ".", "get_value", "(", "arg_0", ".", "constraints", ",", "arg_1", ")", "if", "arg_1", "not", "in", "arg_0", ".", "world", ":", "arg_0", ".", "world", ".", "create_account", "(", "arg_2", "=", "arg_1", ")", "arg_0", ".", "world", ".", "send_funds", "(", "arg_2", ",", "arg_1", ",", "arg_0", ".", "world", ".", "get_balance", "(", "arg_2", ")", ")", "arg_0", ".", "world", ".", "delete_account", "(", "arg_2", ")", "raise", "EndTx", "(", "'Func'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Halt execution and register account for later deletion\"\"\"\n        #This may create a user account\n        arg_1 = Operators.EXTRACT(arg_1, 0, 160)\n        arg_2 = arg_0.address\n        #FIXME for on the known addresses\n        if issymbolic(arg_1):\n            logger.info(\"Symbolic recipient on self destruct\")\n            arg_1 = solver.get_value(arg_0.constraints, arg_1)\n\n        if arg_1 not in arg_0.world:\n            arg_0.world.create_account(arg_2=arg_1)\n\n        arg_0.world.send_funds(arg_2, arg_1, arg_0.world.get_balance(arg_2))\n        arg_0.world.delete_account(arg_2)\n\n        raise EndTx('Func')", "path": "manticore/platforms/evm.py", "identifier": "EVM.SELFDESTRUCT", "docstring": "Halt execution and register account for later deletion", "docstring_tokens": ["Halt", "execution", "and", "register", "account", "for", "later", "deletion"], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260833}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1076-L1080", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Get or calculate MD5 value of the local file.", "language": "python", "parameters": "(self)", "return_statement": "return self.md5", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "md5", "is", "None", ":", "arg_0", ".", "md5", "=", "arg_0", ".", "file_hash", "(", "arg_0", ".", "filename", ")", "return", "arg_0", ".", "md5"], "function": "def Func(arg_0):\n    '''Get or calculate MD5 value of the local file.'''\n    if arg_0.md5 is None:\n      arg_0.md5 = arg_0.file_hash(arg_0.filename)\n    return arg_0.md5", "path": "s4cmd.py", "identifier": "LocalMD5Cache.get_md5", "docstring": "Get or calculate MD5 value of the local file.", "docstring_tokens": ["Get", "or", "calculate", "MD5", "value", "of", "the", "local", "file", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260834}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L295-L312", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Determine the mass fraction of an element in a chemical compound.", "language": "python", "parameters": "(compound, element)", "return_statement": "return coeff * element_mass / formula_mass", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "stoichiometry_coefficient", "(", "arg_0", ",", "arg_1", ")", "if", "arg_2", "==", "0.0", ":", "return", "0.0", "arg_3", "=", "molar_mass", "(", "arg_0", ")", "arg_4", "=", "molar_mass", "(", "arg_1", ")", "return", "arg_2", "*", "arg_4", "/", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Determine the mass fraction of an element in a chemical compound.\n\n    :param compound: Formula of the chemical compound, 'FeCr2O4'.\n    :param element: Element, e.g. 'Cr'.\n\n    :returns: Element mass fraction.\n    \"\"\"\n\n    arg_2 = stoichiometry_coefficient(arg_0, arg_1)\n\n    if arg_2 == 0.0:\n        return 0.0\n\n    arg_3 = molar_mass(arg_0)\n    arg_4 = molar_mass(arg_1)\n    return arg_2 * arg_4 / arg_3", "path": "auxi/tools/chemistry/stoichiometry.py", "identifier": "element_mass_fraction", "docstring": "Determine the mass fraction of an element in a chemical compound.\n\n    :param compound: Formula of the chemical compound, 'FeCr2O4'.\n    :param element: Element, e.g. 'Cr'.\n\n    :returns: Element mass fraction.", "docstring_tokens": ["Determine", "the", "mass", "fraction", "of", "an", "element", "in", "a", "chemical", "compound", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 260835}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/utils.py#L640-L656", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Set the GPU memory fraction for the application.", "language": "python", "parameters": "(gpu_fraction=0.3)", "return_statement": "return sess", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "0.3", ")", ":", "tl", ".", "logging", ".", "info", "(", "\"[TL]: GPU MEM Fraction %f\"", "%", "arg_0", ")", "arg_1", "=", "tf", ".", "GPUOptions", "(", "per_process_gpu_memory_fraction", "=", "arg_0", ")", "arg_2", "=", "tf", ".", "Session", "(", "config", "=", "tf", ".", "ConfigProto", "(", "arg_1", "=", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0=0.3):\n    \"\"\"Set the GPU memory fraction for the application.\n\n    Parameters\n    ----------\n    gpu_fraction : float\n        Fraction of GPU memory, (0 ~ 1]\n\n    References\n    ----------\n    - `TensorFlow using GPU <https://www.tensorflow.org/versions/r0.9/how_tos/using_gpu/index.html>`__\n\n    \"\"\"\n    tl.logging.info(\"[TL]: GPU MEM Fraction %f\" % arg_0)\n    arg_1 = tf.GPUOptions(per_process_gpu_memory_fraction=arg_0)\n    arg_2 = tf.Session(config=tf.ConfigProto(arg_1=arg_1))\n    return arg_2", "path": "tensorlayer/utils.py", "identifier": "set_gpu_fraction", "docstring": "Set the GPU memory fraction for the application.\n\n    Parameters\n    ----------\n    gpu_fraction : float\n        Fraction of GPU memory, (0 ~ 1]\n\n    References\n    ----------\n    - `TensorFlow using GPU <https://www.tensorflow.org/versions/r0.9/how_tos/using_gpu/index.html>`__", "docstring_tokens": ["Set", "the", "GPU", "memory", "fraction", "for", "the", "application", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 260836}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L353-L390", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "make a report of", "language": "python", "parameters": "(sect, stats, _)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "{", "}", "for", "arg_4", "in", "(", "\"module\"", ",", "\"class\"", ",", "\"method\"", ",", "\"function\"", ")", ":", "try", ":", "arg_5", "=", "arg_1", "[", "arg_4", "]", "except", "KeyError", ":", "raise", "exceptions", ".", "EmptyReportError", "(", ")", "arg_3", "[", "arg_4", "]", "=", "{", "}", "if", "arg_5", "!=", "0", ":", "try", ":", "arg_6", "=", "arg_5", "-", "arg_1", "[", "\"undocumented_\"", "+", "arg_4", "]", "arg_7", "=", "(", "arg_6", "*", "100.0", ")", "/", "arg_5", "arg_3", "[", "arg_4", "]", "[", "\"percent_documented\"", "]", "=", "\"%.2f\"", "%", "arg_7", "except", "KeyError", ":", "arg_3", "[", "arg_4", "]", "[", "\"percent_documented\"", "]", "=", "\"NC\"", "try", ":", "arg_7", "=", "(", "arg_1", "[", "\"badname_\"", "+", "arg_4", "]", "*", "100.0", ")", "/", "arg_5", "arg_3", "[", "arg_4", "]", "[", "\"percent_badname\"", "]", "=", "\"%.2f\"", "%", "arg_7", "except", "KeyError", ":", "arg_3", "[", "arg_4", "]", "[", "\"percent_badname\"", "]", "=", "\"NC\"", "arg_8", "=", "(", "\"type\"", ",", "\"number\"", ",", "\"old number\"", ",", "\"difference\"", ",", "\"%documented\"", ",", "\"%badname\"", ")", "for", "arg_4", "in", "(", "\"module\"", ",", "\"class\"", ",", "\"method\"", ",", "\"function\"", ")", ":", "arg_9", "=", "arg_1", "[", "arg_4", "]", "arg_8", "+=", "(", "arg_4", ",", "str", "(", "arg_9", ")", ",", "\"NC\"", ",", "\"NC\"", ",", "arg_3", "[", "arg_4", "]", ".", "get", "(", "\"percent_documented\"", ",", "\"0\"", ")", ",", "arg_3", "[", "arg_4", "]", ".", "get", "(", "\"percent_badname\"", ",", "\"0\"", ")", ",", ")", "arg_0", ".", "append", "(", "reporter_nodes", ".", "Table", "(", "children", "=", "arg_8", ",", "cols", "=", "6", ",", "rheaders", "=", "1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"make a report of\n\n    * percentage of different types documented\n    * percentage of different types with a bad name\n    \"\"\"\n    # percentage of different types documented and/or with a bad name\n    arg_3 = {}\n    for arg_4 in (\"module\", \"class\", \"method\", \"function\"):\n        try:\n            arg_5 = arg_1[arg_4]\n        except KeyError:\n            raise exceptions.EmptyReportError()\n        arg_3[arg_4] = {}\n        if arg_5 != 0:\n            try:\n                arg_6 = arg_5 - arg_1[\"undocumented_\" + arg_4]\n                arg_7 = (arg_6 * 100.0) / arg_5\n                arg_3[arg_4][\"percent_documented\"] = \"%.2f\" % arg_7\n            except KeyError:\n                arg_3[arg_4][\"percent_documented\"] = \"NC\"\n            try:\n                arg_7 = (arg_1[\"badname_\" + arg_4] * 100.0) / arg_5\n                arg_3[arg_4][\"percent_badname\"] = \"%.2f\" % arg_7\n            except KeyError:\n                arg_3[arg_4][\"percent_badname\"] = \"NC\"\n    arg_8 = (\"type\", \"number\", \"old number\", \"difference\", \"%documented\", \"%badname\")\n    for arg_4 in (\"module\", \"class\", \"method\", \"function\"):\n        arg_9 = arg_1[arg_4]\n        arg_8 += (\n            arg_4,\n            str(arg_9),\n            \"NC\",\n            \"NC\",\n            arg_3[arg_4].get(\"percent_documented\", \"0\"),\n            arg_3[arg_4].get(\"percent_badname\", \"0\"),\n        )\n    arg_0.append(reporter_nodes.Table(children=arg_8, cols=6, rheaders=1))", "path": "pylint/checkers/base.py", "identifier": "report_by_type_stats", "docstring": "make a report of\n\n    * percentage of different types documented\n    * percentage of different types with a bad name", "docstring_tokens": ["make", "a", "report", "of"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 260837}
{"url": "https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/source.py#L180-L185", "sha": "dc12de90bb6945023d6f43a8071e984313a1d984", "docstring_summary": "Local repo updating suitable for asynchronous, parallel execution.\n        We still need to run `ensure_local_repo` synchronously because it\n        does a bunch of non-threadsafe filesystem operations.", "language": "python", "parameters": "(self, task_queue, force=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_0", ".", "ensure_local_repo", "(", ")", "arg_1", ".", "enqueue_task", "(", "arg_0", ".", "update_local_repo", ",", "arg_2", "=", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Local repo updating suitable for asynchronous, parallel execution.\n        We still need to run `ensure_local_repo` synchronously because it\n        does a bunch of non-threadsafe filesystem operations.\"\"\"\n        arg_0.ensure_local_repo()\n        arg_1.enqueue_task(arg_0.update_local_repo, arg_2=arg_2)", "path": "dusty/source.py", "identifier": "Repo.update_local_repo_async", "docstring": "Local repo updating suitable for asynchronous, parallel execution.\n        We still need to run `ensure_local_repo` synchronously because it\n        does a bunch of non-threadsafe filesystem operations.", "docstring_tokens": ["Local", "repo", "updating", "suitable", "for", "asynchronous", "parallel", "execution", ".", "We", "still", "need", "to", "run", "ensure_local_repo", "synchronously", "because", "it", "does", "a", "bunch", "of", "non", "-", "threadsafe", "filesystem", "operations", "."], "nwo": "gamechanger/dusty", "score": 0.7406161721252564, "idx": 260838}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2108-L2112", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find and return a magic of the given type by name.", "language": "python", "parameters": "(self, magic_name, magic_kind='line')", "return_statement": "return self.magics_manager.magics[magic_kind].get(magic_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'line'", ")", ":", "return", "arg_0", ".", "magics_manager", ".", "magics", "[", "arg_2", "]", ".", "get", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2='line'):\n        \"\"\"Find and return a magic of the given type by name.\n\n        Returns None if the magic isn't found.\"\"\"\n        return arg_0.magics_manager.magics[arg_2].get(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell.find_magic", "docstring": "Find and return a magic of the given type by name.\n\n        Returns None if the magic isn't found.", "docstring_tokens": ["Find", "and", "return", "a", "magic", "of", "the", "given", "type", "by", "name", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260839}
{"url": "https://github.com/umich-brcf-bioinf/Jacquard/blob/83dd61dd2b5e4110468493beec7bc121e6cb3cd1/jacquard/utils/vcf.py#L357-L366", "sha": "83dd61dd2b5e4110468493beec7bc121e6cb3cd1", "docstring_summary": "Returns tab-delimited, newline terminated string of VcfRecord.", "language": "python", "parameters": "(self)", "return_statement": "return \"\\t\".join(stringifier) + \"\\n\"", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_0", ".", "chrom", ",", "arg_0", ".", "pos", ",", "arg_0", ".", "vcf_id", ",", "arg_0", ".", "ref", ",", "arg_0", ".", "alt", ",", "arg_0", ".", "qual", ",", "arg_0", ".", "filter", ",", "arg_0", ".", "info", ",", "arg_0", ".", "_format_field", "(", ")", "]", "for", "arg_2", "in", "arg_0", ".", "sample_tag_values", ":", "arg_1", ".", "append", "(", "arg_0", ".", "_sample_field", "(", "arg_2", ")", ")", "return", "\"\\t\"", ".", "join", "(", "arg_1", ")", "+", "\"\\n\""], "function": "def Func(arg_0):\n        \"Returns tab-delimited, newline terminated string of VcfRecord.\"\n        arg_1 = [arg_0.chrom, arg_0.pos, arg_0.vcf_id, arg_0.ref, arg_0.alt,\n                       arg_0.qual, arg_0.filter, arg_0.info,\n                       arg_0._format_field()]\n\n        for arg_2 in arg_0.sample_tag_values:\n            arg_1.append(arg_0._sample_field(arg_2))\n\n        return \"\\t\".join(arg_1) + \"\\n\"", "path": "jacquard/utils/vcf.py", "identifier": "VcfRecord.text", "docstring": "Returns tab-delimited, newline terminated string of VcfRecord.", "docstring_tokens": ["Returns", "tab", "-", "delimited", "newline", "terminated", "string", "of", "VcfRecord", "."], "nwo": "umich-brcf-bioinf/Jacquard", "score": 0.27831918678159157, "idx": 260840}
{"url": "https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L475-L509", "sha": "a5446a052fc91a38f7589803dc7a654180db2566", "docstring_summary": "Function to execute and handle a GET request", "language": "python", "parameters": "(self, request_url, append_sid=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_0", ".", "_debuglog", "(", "\"Requesting URL: '\"", "+", "arg_1", "+", "\"'\"", ")", "if", "arg_2", ":", "arg_0", ".", "_debuglog", "(", "\"Appending access_token (SID: \"", "+", "arg_0", ".", "access_token", "+", "\") to url\"", ")", "arg_1", "=", "\"%s&_sid=%s\"", "%", "(", "arg_1", ",", "arg_0", ".", "access_token", ")", "try", ":", "arg_3", "=", "arg_0", ".", "_session", ".", "get", "(", "arg_1", ")", "arg_0", ".", "_debuglog", "(", "\"Request executed: \"", "+", "str", "(", "arg_3", ".", "status_code", ")", ")", "if", "arg_3", ".", "status_code", "==", "200", ":", "arg_4", "=", "json", ".", "loads", "(", "arg_3", ".", "text", ")", "if", "arg_4", "[", "\"success\"", "]", ":", "arg_0", ".", "_debuglog", "(", "\"Succesfull returning data\"", ")", "arg_0", ".", "_debuglog", "(", "str", "(", "arg_4", ")", ")", "return", "arg_4", "else", ":", "if", "arg_4", "[", "\"error\"", "]", "[", "\"code\"", "]", "in", "{", "105", ",", "106", ",", "107", ",", "119", "}", ":", "arg_0", ".", "_debuglog", "(", "\"Session error: \"", "+", "str", "(", "arg_4", "[", "\"error\"", "]", "[", "\"code\"", "]", ")", ")", "arg_0", ".", "_session_error", "=", "True", "else", ":", "arg_0", ".", "_debuglog", "(", "\"Failed: \"", "+", "arg_3", ".", "text", ")", "else", ":", "return", "None", "except", ":", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2=True):\r\n        \"\"\"Function to execute and handle a GET request\"\"\"\r\n        # Prepare Request\r\n        arg_0._debuglog(\"Requesting URL: '\" + arg_1 + \"'\")\r\n        if arg_2:\r\n            arg_0._debuglog(\"Appending access_token (SID: \" +\r\n                           arg_0.access_token + \") to url\")\r\n            arg_1 = \"%s&_sid=%s\" % (\r\n                arg_1, arg_0.access_token)\r\n\r\n        # Execute Request\r\n        try:\r\n            arg_3 = arg_0._session.get(arg_1)\r\n            arg_0._debuglog(\"Request executed: \" + str(arg_3.status_code))\r\n            if arg_3.status_code == 200:\r\n                # We got a response\r\n                arg_4 = json.loads(arg_3.text)\r\n\r\n                if arg_4[\"success\"]:\r\n                    arg_0._debuglog(\"Succesfull returning data\")\r\n                    arg_0._debuglog(str(arg_4))\r\n                    return arg_4\r\n                else:\r\n                    if arg_4[\"error\"][\"code\"] in {105, 106, 107, 119}:\r\n                        arg_0._debuglog(\"Session error: \" +\r\n                                       str(arg_4[\"error\"][\"code\"]))\r\n                        arg_0._session_error = True\r\n                    else:\r\n                        arg_0._debuglog(\"Failed: \" + arg_3.text)\r\n            else:\r\n                # We got a 404 or 401\r\n                return None\r\n        #pylint: disable=bare-except\r\n        except:\r\n            return None", "path": "SynologyDSM/SynologyDSM.py", "identifier": "SynologyDSM._execute_get_url", "docstring": "Function to execute and handle a GET request", "docstring_tokens": ["Function", "to", "execute", "and", "handle", "a", "GET", "request"], "nwo": "StaticCube/python-synology", "score": 0.28669876362022334, "idx": 260841}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L879-L894", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "a common internal function to some window functions with 4 coeffs", "language": "python", "parameters": "(N, a0, a1, a2, a3)", "return_statement": "return w", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_0", "==", "1", ":", "return", "ones", "(", "1", ")", "arg_5", "=", "arange", "(", "0", ",", "arg_0", ")", "arg_6", "=", "arg_0", "-", "1.", "arg_7", "=", "arg_1", "-", "arg_2", "*", "cos", "(", "2.", "*", "pi", "*", "arg_5", "/", "arg_6", ")", "+", "arg_3", "*", "cos", "(", "4.", "*", "pi", "*", "arg_5", "/", "arg_6", ")", "-", "arg_4", "*", "cos", "(", "6.", "*", "pi", "*", "arg_5", "/", "arg_6", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"a common internal function to some window functions with 4 coeffs\n\n\n    For the blackmna harris for instance, the results are identical to octave if N is odd\n    but not for even values...if n =0 whatever N is, the w(0) must be equal to a0-a1+a2-a3, which\n    is the case here, but not in octave...\"\"\"\n    if arg_0 == 1:\n        return ones(1)\n\n    arg_5 = arange(0, arg_0)\n    arg_6 = arg_0 - 1.\n\n    arg_7 = arg_1 -arg_2*cos(2.*pi*arg_5 / arg_6) + arg_3*cos(4.*pi*arg_5 / arg_6) - arg_4*cos(6.*pi*arg_5 / arg_6)\n\n    return arg_7", "path": "src/spectrum/window.py", "identifier": "_coeff4", "docstring": "a common internal function to some window functions with 4 coeffs\n\n\n    For the blackmna harris for instance, the results are identical to octave if N is odd\n    but not for even values...if n =0 whatever N is, the w(0) must be equal to a0-a1+a2-a3, which\n    is the case here, but not in octave...", "docstring_tokens": ["a", "common", "internal", "function", "to", "some", "window", "functions", "with", "4", "coeffs"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 260842}
{"url": "https://github.com/SmBe19/praw-OAuth2Util/blob/ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe/OAuth2Util/OAuth2Util.py#L296-L316", "sha": "ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe", "docstring_summary": "Set the token on the Reddit Object again", "language": "python", "parameters": "(self, _retry=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ")", ":", "if", "arg_1", ">=", "5", ":", "raise", "ConnectionAbortedError", "(", "'Reddit is not accessible right now, cannot refresh OAuth2 tokens.'", ")", "arg_0", ".", "_check_token_present", "(", ")", "try", ":", "arg_0", ".", "r", ".", "Func", "(", "arg_0", ".", "_get_value", "(", "CONFIGKEY_SCOPE", ",", "set", ",", "split_val", "=", "\",\"", ")", ",", "arg_0", ".", "_get_value", "(", "CONFIGKEY_TOKEN", ")", ",", "arg_0", ".", "_get_value", "(", "CONFIGKEY_REFRESH_TOKEN", ")", ")", "except", "(", "praw", ".", "errors", ".", "OAuthInvalidToken", ",", "praw", ".", "errors", ".", "HTTPException", ")", "as", "e", ":", "arg_0", ".", "_log", "(", "\"Request new Token (SAC)\"", ")", "arg_0", ".", "_get_new_access_information", "(", ")"], "function": "def Func(arg_0, arg_1=0):\n\t\t\"\"\"\n\t\tSet the token on the Reddit Object again\n\t\t\"\"\"\n\t\tif arg_1 >= 5:\n\t\t\traise ConnectionAbortedError('Reddit is not accessible right now, cannot refresh OAuth2 tokens.')\n\n\t\targ_0._check_token_present()\n\n\t\ttry:\n\t\t\targ_0.r.Func(arg_0._get_value(CONFIGKEY_SCOPE, set, split_val=\",\"),\n\t\t\t\t\t\t\t\t\t\t  arg_0._get_value(CONFIGKEY_TOKEN),\n\t\t\t\t\t\t\t\t\t\t  arg_0._get_value(CONFIGKEY_REFRESH_TOKEN))\n\t\texcept (praw.errors.OAuthInvalidToken, praw.errors.HTTPException) as e:\n\t\t\t# todo check e status code\n\t\t\t# self._log('Retrying in 5s.')\n\t\t\t# time.sleep(5)\n\t\t\t# self.Func(_retry=_retry + 1)\n\n\t\t\targ_0._log(\"Request new Token (SAC)\")\n\t\t\targ_0._get_new_access_information()", "path": "OAuth2Util/OAuth2Util.py", "identifier": "OAuth2Util.set_access_credentials", "docstring": "Set the token on the Reddit Object again", "docstring_tokens": ["Set", "the", "token", "on", "the", "Reddit", "Object", "again"], "nwo": "SmBe19/praw-OAuth2Util", "score": 0.28581547167654664, "idx": 260843}
{"url": "https://github.com/Lucretiel/Dispatch/blob/dffbce6bacb4370c4ecd11652e5ba8a6aaf2b5b4/dispatching.py#L157-L162", "sha": "dffbce6bacb4370c4ecd11652e5ba8a6aaf2b5b4", "docstring_summary": "Dispatch a call. Call the first function whose type signature matches\n        the arguemts.", "language": "python", "parameters": "(self, args, kwargs)", "return_statement": "return self.lookup_explicit(args, kwargs)(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "lookup_explicit", "(", "arg_1", ",", "arg_2", ")", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        '''\n        Dispatch a call. Call the first function whose type signature matches\n        the arguemts.\n        '''\n        return arg_0.lookup_explicit(arg_1, arg_2)(*arg_1, **arg_2)", "path": "dispatching.py", "identifier": "DispatchGroup.execute", "docstring": "Dispatch a call. Call the first function whose type signature matches\n        the arguemts.", "docstring_tokens": ["Dispatch", "a", "call", ".", "Call", "the", "first", "function", "whose", "type", "signature", "matches", "the", "arguemts", "."], "nwo": "Lucretiel/Dispatch", "score": 0.18190671880906387, "idx": 260844}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/analyzation/average.py#L13-L38", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Compute the mean value of an diagonal observable.", "language": "python", "parameters": "(counts, observable)", "return_statement": "return temp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "dict", ")", ":", "arg_1", "=", "make_dict_observable", "(", "arg_1", ")", "arg_2", "=", "0", "arg_3", "=", "sum", "(", "arg_0", ".", "values", "(", ")", ")", "for", "arg_4", "in", "arg_0", ":", "if", "arg_4", "in", "arg_1", ":", "arg_2", "+=", "arg_0", "[", "arg_4", "]", "*", "arg_1", "[", "arg_4", "]", "/", "arg_3", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Compute the mean value of an diagonal observable.\n\n    Takes in a diagonal observable in dictionary, list or matrix format and then\n    calculates the sum_i value(i) P(i) where value(i) is the value of the\n    observable for state i.\n\n    Args:\n        counts (dict): a dict of outcomes from an experiment\n        observable (dict or matrix or list): The observable to be averaged over.\n        As an example, ZZ on qubits can be given as:\n        * dict: {\"00\": 1, \"11\": 1, \"01\": -1, \"10\": -1}\n        * matrix: [[1, 0, 0, 0], [0, -1, 0, 0, ], [0, 0, -1, 0], [0, 0, 0, 1]]\n        * matrix diagonal (list): [1, -1, -1, 1]\n\n    Returns:\n        Double: Average of the observable\n    \"\"\"\n    if not isinstance(arg_1, dict):\n        arg_1 = make_dict_observable(arg_1)\n    arg_2 = 0\n    arg_3 = sum(arg_0.values())\n    for arg_4 in arg_0:\n        if arg_4 in arg_1:\n            arg_2 += arg_0[arg_4] * arg_1[arg_4] / arg_3\n    return arg_2", "path": "qiskit/quantum_info/analyzation/average.py", "identifier": "average_data", "docstring": "Compute the mean value of an diagonal observable.\n\n    Takes in a diagonal observable in dictionary, list or matrix format and then\n    calculates the sum_i value(i) P(i) where value(i) is the value of the\n    observable for state i.\n\n    Args:\n        counts (dict): a dict of outcomes from an experiment\n        observable (dict or matrix or list): The observable to be averaged over.\n        As an example, ZZ on qubits can be given as:\n        * dict: {\"00\": 1, \"11\": 1, \"01\": -1, \"10\": -1}\n        * matrix: [[1, 0, 0, 0], [0, -1, 0, 0, ], [0, 0, -1, 0], [0, 0, 0, 1]]\n        * matrix diagonal (list): [1, -1, -1, 1]\n\n    Returns:\n        Double: Average of the observable", "docstring_tokens": ["Compute", "the", "mean", "value", "of", "an", "diagonal", "observable", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260845}
{"url": "https://github.com/redapple/parslepy/blob/a8bc4c0592824459629018c8f4c6ae3dad6cc3cc/parslepy/selectors.py#L222-L231", "sha": "a8bc4c0592824459629018c8f4c6ae3dad6cc3cc", "docstring_summary": "Extend XPath evaluation with Parsley extensions' namespace", "language": "python", "parameters": "(cls, namespace_dict)", "return_statement": "return namespace_dict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "update", "(", "{", "'parslepy'", ":", "arg_0", ".", "LOCAL_NAMESPACE", ",", "'parsley'", ":", "arg_0", ".", "LOCAL_NAMESPACE", ",", "}", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Extend XPath evaluation with Parsley extensions' namespace\n        \"\"\"\n\n        arg_1.update({\n            'parslepy' : arg_0.LOCAL_NAMESPACE,\n            'parsley' : arg_0.LOCAL_NAMESPACE,\n        })\n        return arg_1", "path": "parslepy/selectors.py", "identifier": "XPathSelectorHandler._add_parsley_ns", "docstring": "Extend XPath evaluation with Parsley extensions' namespace", "docstring_tokens": ["Extend", "XPath", "evaluation", "with", "Parsley", "extensions", "namespace"], "nwo": "redapple/parslepy", "score": 0.18261785916548806, "idx": 260846}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/criteria.py#L313-L337", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"MDL order-selection using eigen values", "language": "python", "parameters": "(s, N)", "return_statement": "return kmdl", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "import", "numpy", "as", "np", "arg_2", "=", "[", "]", "arg_3", "=", "len", "(", "arg_0", ")", "for", "arg_4", "in", "range", "(", "0", ",", "arg_3", "-", "1", ")", ":", "arg_5", "=", "1.", "/", "(", "arg_3", "-", "arg_4", ")", "*", "np", ".", "sum", "(", "arg_0", "[", "arg_4", "+", "1", ":", "]", ")", "arg_6", "=", "np", ".", "prod", "(", "arg_0", "[", "arg_4", "+", "1", ":", "]", "**", "(", "1.", "/", "(", "arg_3", "-", "arg_4", ")", ")", ")", "arg_2", ".", "append", "(", "-", "(", "arg_3", "-", "arg_4", ")", "*", "arg_1", "*", "np", ".", "log", "(", "arg_6", "/", "arg_5", ")", "+", "0.5", "*", "arg_4", "*", "(", "2.", "*", "arg_3", "-", "arg_4", ")", "*", "np", ".", "log", "(", "arg_1", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    r\"\"\"MDL order-selection using eigen values\n\n    :param s: a list of `p` sorted eigen values\n    :param N: the size of the input data. To be defined precisely.\n\n    :return:\n        * an array containing the AIC values\n\n    .. math:: MDL(k) = (n-k)N \\ln \\frac{g(k)}{a(k)} + 0.5k(2n-k) log(N)\n\n    .. seealso:: :func:`aic_eigen` for details\n\n    :References:\n        * [Marple]_ Chap 13,\n        * [Wax]_\n    \"\"\"\n    import numpy as np\n    arg_2 = []\n    arg_3 = len(arg_0)\n    for arg_4 in range(0, arg_3-1):\n        arg_5 = 1./(arg_3-arg_4) * np.sum(arg_0[arg_4+1:])\n        arg_6 = np.prod(arg_0[arg_4+1:]**(1./(arg_3-arg_4)))\n        arg_2.append( -(arg_3-arg_4)*arg_1 * np.log(arg_6/arg_5) + 0.5*arg_4*(2.*arg_3-arg_4)*np.log(arg_1))\n    return arg_2", "path": "src/spectrum/criteria.py", "identifier": "mdl_eigen", "docstring": "r\"\"\"MDL order-selection using eigen values\n\n    :param s: a list of `p` sorted eigen values\n    :param N: the size of the input data. To be defined precisely.\n\n    :return:\n        * an array containing the AIC values\n\n    .. math:: MDL(k) = (n-k)N \\ln \\frac{g(k)}{a(k)} + 0.5k(2n-k) log(N)\n\n    .. seealso:: :func:`aic_eigen` for details\n\n    :References:\n        * [Marple]_ Chap 13,\n        * [Wax]_", "docstring_tokens": ["r", "MDL", "order", "-", "selection", "using", "eigen", "values"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 260847}
{"url": "https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/cryptfile.py#L132-L162", "sha": "cfa80d4848a5c3c0aeee41a954b2b120c80e69b2", "docstring_summary": "check for a valid scheme", "language": "python", "parameters": "(self, config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_1", ".", "get", "(", "escape_for_ini", "(", "'keyring-setting'", ")", ",", "escape_for_ini", "(", "'scheme'", ")", ",", ")", "except", "(", "configparser", ".", "NoSectionError", ",", "configparser", ".", "NoOptionError", ")", ":", "raise", "AttributeError", "(", "\"Encryption scheme missing\"", ")", "arg_3", "=", "arg_2", "[", "-", "3", ":", "]", "if", "arg_3", "not", "in", "arg_0", ".", "_get_mode", "(", ")", ":", "raise", "ValueError", "(", "\"Encryption scheme invalid: %s\"", "%", "(", "arg_3", ")", ")", "arg_0", ".", "aesmode", "=", "arg_3", "if", "arg_2", ".", "startswith", "(", "'PyCryptodome '", ")", ":", "arg_2", "=", "arg_2", "[", "13", ":", "]", "if", "arg_2", "!=", "arg_0", ".", "scheme", ":", "raise", "ValueError", "(", "\"Encryption scheme mismatch \"", "\"(exp.: %s, found: %s)\"", "%", "(", "arg_0", ".", "scheme", ",", "arg_2", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        check for a valid scheme\n\n        raise AttributeError if missing\n        raise ValueError if not valid\n        \"\"\"\n        try:\n            arg_2 = arg_1.get(\n                escape_for_ini('keyring-setting'),\n                escape_for_ini('scheme'),\n            )\n        except (configparser.NoSectionError, configparser.NoOptionError):\n            raise AttributeError(\"Encryption scheme missing\")\n\n        # extract AES mode\n        arg_3 = arg_2[-3:]\n        if arg_3 not in arg_0._get_mode():\n            raise ValueError(\"Encryption scheme invalid: %s\" % (arg_3))\n\n        # setup AES mode\n        arg_0.aesmode = arg_3\n\n        # remove pointless crypto module name\n        if arg_2.startswith('PyCryptodome '):\n            arg_2 = arg_2[13:]\n\n        # check other scheme properties\n        if arg_2 != arg_0.scheme:\n            raise ValueError(\"Encryption scheme mismatch \"\n                             \"(exp.: %s, found: %s)\" % (arg_0.scheme, arg_2))", "path": "keyrings/cryptfile/cryptfile.py", "identifier": "CryptFileKeyring._check_scheme", "docstring": "check for a valid scheme\n\n        raise AttributeError if missing\n        raise ValueError if not valid", "docstring_tokens": ["check", "for", "a", "valid", "scheme"], "nwo": "frispete/keyrings.cryptfile", "score": 0.2836741237679313, "idx": 260848}
{"url": "https://github.com/dade-ai/snipy/blob/408520867179f99b3158b57520e2619f3fecd69b/snipy/img/imageutil.py#L142-L148", "sha": "408520867179f99b3158b57520e2619f3fecd69b", "docstring_summary": "random blending masks", "language": "python", "parameters": "(shape, rand=rand.uniform(-10, 10), **kwargs)", "return_statement": "return noise", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_1", ".", "uniform", "(", "-", "10", ",", "10", ")", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_1", "(", "arg_0", "[", "0", "]", ")", "arg_5", "=", "snoise2dz", "(", "(", "arg_0", "[", "1", "]", ",", "arg_0", "[", "2", "]", ")", ",", "arg_4", ",", "**", "arg_3", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=arg_1.uniform(-10, 10), **arg_3):\n    \"\"\" random blending masks \"\"\"\n    # batch, channel = shape[0], shape[3]\n    arg_4 = arg_1(arg_0[0])  # seed\n    arg_5 = snoise2dz((arg_0[1], arg_0[2]), arg_4, **arg_3)\n\n    return arg_5", "path": "snipy/img/imageutil.py", "identifier": "rand_blend_mask", "docstring": "random blending masks", "docstring_tokens": ["random", "blending", "masks"], "nwo": "dade-ai/snipy", "score": 0.18941942438232184, "idx": 260849}
{"url": "https://github.com/Gandi/pyramid_kvs/blob/36285f2e50d8181428f383f6fc1d79a34ea9ac3c/pyramid_kvs/perlsess.py#L31-L38", "sha": "36285f2e50d8181428f383f6fc1d79a34ea9ac3c", "docstring_summary": "Call that method in the pyramid configuration phase.", "language": "python", "parameters": "(cls, settings)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "serializer", "(", "'json'", ")", ".", "loads", "(", "arg_1", "[", "'kvs.perlsess'", "]", ")", "arg_2", ".", "setdefault", "(", "'key_prefix'", ",", "'perlsess::'", ")", "arg_2", ".", "setdefault", "(", "'codec'", ",", "'storable'", ")", "arg_0", ".", "cookie_name", "=", "arg_2", ".", "pop", "(", "'cookie_name'", ",", "'session_id'", ")", "arg_0", ".", "client", "=", "KVS", "(", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Call that method in the pyramid configuration phase.\n        \"\"\"\n        arg_2 = serializer('json').loads(arg_1['kvs.perlsess'])\n        arg_2.setdefault('key_prefix', 'perlsess::')\n        arg_2.setdefault('codec', 'storable')\n        arg_0.cookie_name = arg_2.pop('cookie_name', 'session_id')\n        arg_0.client = KVS(**arg_2)", "path": "pyramid_kvs/perlsess.py", "identifier": "PerlSession.connect", "docstring": "Call that method in the pyramid configuration phase.", "docstring_tokens": ["Call", "that", "method", "in", "the", "pyramid", "configuration", "phase", "."], "nwo": "Gandi/pyramid_kvs", "score": 0.3282631104312029, "idx": 260850}
{"url": "https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/remote_utils.py#L80-L97", "sha": "792dd5816bc770b05a3db2f4327da42ff6253531", "docstring_summary": "Returns a delete resquest object taking in a url and user token.", "language": "python", "parameters": "(self, url, token='')", "return_statement": "return requests.delete(url,\n                               headers={\n                                   'Authorization': 'Token {}'.format(token)},\n                               verify=False,)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "''", ")", ":", "if", "(", "arg_2", "==", "''", ")", ":", "arg_2", "=", "arg_0", ".", "_user_token", "return", "requests", ".", "delete", "(", "arg_1", ",", "headers", "=", "{", "'Authorization'", ":", "'Token {}'", ".", "format", "(", "arg_2", ")", "}", ",", "verify", "=", "False", ",", ")"], "function": "def Func(arg_0, arg_1, arg_2=''):\n        \"\"\"\n        Returns a delete resquest object taking in a url and user token.\n\n        Arguments:\n            url (str): The url to make post to\n            token (str): The authentication token\n\n        Returns:\n            obj: Delete request object\n        \"\"\"\n        if (arg_2 == ''):\n            arg_2 = arg_0._user_token\n\n        return requests.delete(arg_1,\n                               headers={\n                                   'Authorization': 'Token {}'.format(arg_2)},\n                               verify=False,)", "path": "ndio/remote/remote_utils.py", "identifier": "remote_utils.delete_url", "docstring": "Returns a delete resquest object taking in a url and user token.\n\n        Arguments:\n            url (str): The url to make post to\n            token (str): The authentication token\n\n        Returns:\n            obj: Delete request object", "docstring_tokens": ["Returns", "a", "delete", "resquest", "object", "taking", "in", "a", "url", "and", "user", "token", "."], "nwo": "neurodata/ndio", "score": 0.1832591465193378, "idx": 260851}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_container_hook.py#L96-L108", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Fetches the operation from Google Cloud", "language": "python", "parameters": "(self, operation_name, project_id=None)", "return_statement": "return self.get_client().get_operation(project_id=project_id or self.project_id,\n                                               zone=self.location,\n                                               operation_id=operation_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "return", "arg_0", ".", "get_client", "(", ")", ".", "Func", "(", "arg_2", "=", "arg_2", "or", "arg_0", ".", "project_id", ",", "zone", "=", "arg_0", ".", "location", ",", "operation_id", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Fetches the operation from Google Cloud\n\n        :param operation_name: Name of operation to fetch\n        :type operation_name: str\n        :param project_id: Google Cloud Platform project ID\n        :type project_id: str\n        :return: The new, updated operation from Google Cloud\n        \"\"\"\n        return arg_0.get_client().Func(arg_2=arg_2 or arg_0.project_id,\n                                               zone=arg_0.location,\n                                               operation_id=arg_1)", "path": "airflow/contrib/hooks/gcp_container_hook.py", "identifier": "GKEClusterHook.get_operation", "docstring": "Fetches the operation from Google Cloud\n\n        :param operation_name: Name of operation to fetch\n        :type operation_name: str\n        :param project_id: Google Cloud Platform project ID\n        :type project_id: str\n        :return: The new, updated operation from Google Cloud", "docstring_tokens": ["Fetches", "the", "operation", "from", "Google", "Cloud"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260852}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/differential_evolution.py#L554-L602", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Constructs the initial population.", "language": "python", "parameters": "(initial_population,\n                             initial_position,\n                             population_size,\n                             population_stddev,\n                             seed)", "return_statement": "return population", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "if", "arg_0", "is", "not", "None", ":", "return", "[", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_5", ")", "for", "arg_5", "in", "arg_0", "]", "arg_6", "=", "distributions", ".", "SeedStream", "(", "arg_4", ",", "salt", "=", "'get_starting_population'", ")", "arg_7", "=", "[", "]", "for", "arg_5", "in", "arg_1", ":", "arg_5", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_5", ")", "arg_8", "=", "tf", ".", "shape", "(", "input", "=", "arg_5", ")", "arg_9", "=", "tf", ".", "concat", "(", "[", "[", "arg_2", "-", "1", "]", ",", "arg_8", "]", ",", "axis", "=", "0", ")", "arg_10", "=", "tf", ".", "random", ".", "normal", "(", "arg_9", ",", "stddev", "=", "arg_3", ",", "dtype", "=", "arg_5", ".", "dtype", ".", "base_dtype", ",", "arg_4", "=", "arg_6", "(", ")", ")", "arg_10", "+=", "arg_5", "arg_10", "=", "tf", ".", "concat", "(", "[", "[", "arg_5", "]", ",", "arg_10", "]", ",", "axis", "=", "0", ")", "arg_7", ".", "append", "(", "arg_10", ")", "return", "arg_7"], "function": "def Func(arg_0,\n                             arg_1,\n                             arg_2,\n                             arg_3,\n                             arg_4):\n  \"\"\"Constructs the initial population.\n\n  If an initial population is not already provided, this function constructs\n  a population by adding random normal noise to the initial position.\n\n  Args:\n    initial_population: None or a list of `Tensor`s. The initial population.\n    initial_position: None or a list of `Tensor`s. The initial position.\n      If initial_population is None, this argument must not be None.\n    population_size: Scalar integer `Tensor`. The number of members in the\n      population. If the initial population is not None, this parameter is\n      ignored.\n    population_stddev: A positive scalar real `Tensor` of the same dtype\n      as `initial_position` or `initial_population` (whichever is not None).\n      This parameter is ignored if `initial_population`\n      is specified. Used to generate the population from the\n      `initial_position` by adding random normal noise with zero mean and\n      the specified standard deviation.\n    seed: Seed for random number generation.\n\n  Returns:\n    A list of `Tensor`s. The initial population.\n  \"\"\"\n  if arg_0 is not None:\n    return [tf.convert_to_tensor(value=arg_5) for arg_5 in arg_0]\n  # Constructs the population by adding normal noise to the initial position.\n  arg_6 = distributions.SeedStream(arg_4, salt='get_starting_population')\n  arg_7 = []\n  for arg_5 in arg_1:\n    arg_5 = tf.convert_to_tensor(value=arg_5)\n    arg_8 = tf.shape(input=arg_5)\n    # We only draw population_size-1 random vectors because we want to ensure\n    # that the supplied position is part of the population. The first member\n    # is set to be the initial_position.\n    arg_9 = tf.concat([[arg_2-1],\n                                       arg_8], axis=0)\n    arg_10 = tf.random.normal(arg_9,\n                                       stddev=arg_3,\n                                       dtype=arg_5.dtype.base_dtype,\n                                       arg_4=arg_6())\n    arg_10 += arg_5\n    arg_10 = tf.concat([[arg_5], arg_10], axis=0)\n    arg_7.append(arg_10)\n  return arg_7", "path": "tensorflow_probability/python/optimizer/differential_evolution.py", "identifier": "_get_starting_population", "docstring": "Constructs the initial population.\n\n  If an initial population is not already provided, this function constructs\n  a population by adding random normal noise to the initial position.\n\n  Args:\n    initial_population: None or a list of `Tensor`s. The initial population.\n    initial_position: None or a list of `Tensor`s. The initial position.\n      If initial_population is None, this argument must not be None.\n    population_size: Scalar integer `Tensor`. The number of members in the\n      population. If the initial population is not None, this parameter is\n      ignored.\n    population_stddev: A positive scalar real `Tensor` of the same dtype\n      as `initial_position` or `initial_population` (whichever is not None).\n      This parameter is ignored if `initial_population`\n      is specified. Used to generate the population from the\n      `initial_position` by adding random normal noise with zero mean and\n      the specified standard deviation.\n    seed: Seed for random number generation.\n\n  Returns:\n    A list of `Tensor`s. The initial population.", "docstring_tokens": ["Constructs", "the", "initial", "population", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260853}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L744-L751", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Contruct a date from a proleptic Gregorian ordinal.", "language": "python", "parameters": "(cls, n)", "return_statement": "return cls(y, m, d)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ",", "arg_3", ",", "arg_4", "=", "_ord2ymd", "(", "arg_1", ")", "return", "arg_0", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Contruct a date from a proleptic Gregorian ordinal.\n\n        January 1 of year 1 is day 1.  Only the year, month and day are\n        non-zero in the result.\n        \"\"\"\n        arg_2, arg_3, arg_4 = _ord2ymd(arg_1)\n        return arg_0(arg_2, arg_3, arg_4)", "path": "third_party/pypy/datetime.py", "identifier": "date.fromordinal", "docstring": "Contruct a date from a proleptic Gregorian ordinal.\n\n        January 1 of year 1 is day 1.  Only the year, month and day are\n        non-zero in the result.", "docstring_tokens": ["Contruct", "a", "date", "from", "a", "proleptic", "Gregorian", "ordinal", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 260854}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/groupsio.py#L271-L294", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Returns the Groupsio argument parser.", "language": "python", "parameters": "(cls)", "return_statement": "return parser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "BackendCommandArgumentParser", "(", "arg_0", ".", "BACKEND", ".", "CATEGORIES", ",", "from_date", "=", "True", ",", "token_auth", "=", "True", ")", "arg_2", "=", "arg_1", ".", "parser", ".", "_option_string_actions", "[", "'--api-token'", "]", "arg_2", ".", "required", "=", "True", "arg_4", "=", "arg_1", ".", "parser", ".", "add_argument_group", "(", "'Groupsio arguments'", ")", "arg_4", ".", "add_argument", "(", "'--mboxes-path'", ",", "dest", "=", "'mboxes_path'", ",", "help", "=", "\"Path where mbox files will be stored\"", ")", "arg_4", ".", "add_argument", "(", "'--no-verify'", ",", "dest", "=", "'verify'", ",", "arg_2", "=", "'store_false'", ",", "help", "=", "\"Value 'True' enable SSL verification\"", ")", "arg_1", ".", "parser", ".", "add_argument", "(", "'group_name'", ",", "help", "=", "\"Name of the group on Groups.io\"", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns the Groupsio argument parser.\"\"\"\n\n        arg_1 = BackendCommandArgumentParser(arg_0.BACKEND.CATEGORIES,\n                                              from_date=True,\n                                              token_auth=True)\n\n        # Backend token is required\n        arg_2 = arg_1.parser._option_string_actions['--api-token']\n        arg_2.required = True\n\n        # Optional arguments\n        arg_4 = arg_1.parser.add_argument_group('Groupsio arguments')\n        arg_4.add_argument('--mboxes-path', dest='mboxes_path',\n                           help=\"Path where mbox files will be stored\")\n        arg_4.add_argument('--no-verify', dest='verify',\n                           arg_2='store_false',\n                           help=\"Value 'True' enable SSL verification\")\n\n        # Required arguments\n        arg_1.parser.add_argument('group_name',\n                                   help=\"Name of the group on Groups.io\")\n\n        return arg_1", "path": "perceval/backends/core/groupsio.py", "identifier": "GroupsioCommand.setup_cmd_parser", "docstring": "Returns the Groupsio argument parser.", "docstring_tokens": ["Returns", "the", "Groupsio", "argument", "parser", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260855}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/py2/ec2_cmd.py#L208-L214", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "stop all the instances given by its ids", "language": "python", "parameters": "(instances, region)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ":", "return", "arg_2", "=", "ec2_connect", "(", "arg_1", ")", "log", "(", "\"Stopping instances {0}.\"", ".", "format", "(", "arg_0", ")", ")", "arg_2", ".", "Func", "(", "arg_0", ")", "log", "(", "\"Done\"", ")"], "function": "def Func(arg_0, arg_1):\n    '''stop all the instances given by its ids'''\n    if not arg_0: return\n    arg_2 = ec2_connect(arg_1)\n    log(\"Stopping instances {0}.\".format(arg_0))\n    arg_2.Func(arg_0)\n    log(\"Done\")", "path": "py2/ec2_cmd.py", "identifier": "stop_instances", "docstring": "stop all the instances given by its ids", "docstring_tokens": ["stop", "all", "the", "instances", "given", "by", "its", "ids"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260856}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/contrib/remote_environment.py#L152-L196", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Receives a message as msgpack-numpy encoded byte-string from the given socket object.\n        Blocks until something was received.", "language": "python", "parameters": "(self, socket_, encoding=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "msgpack", ".", "Unpacker", "(", "arg_2", "=", "arg_2", ")", "arg_4", "=", "arg_1", ".", "Func", "(", "8", ")", "if", "arg_4", "==", "b\"\"", ":", "raise", "TensorForceError", "(", "\"No data received by socket.Func in call to method `Func` \"", "+", "\"(listener possibly closed)!\"", ")", "arg_5", "=", "int", "(", "arg_4", ")", "arg_6", "=", "0", "while", "True", ":", "arg_7", "=", "arg_1", ".", "Func", "(", "min", "(", "arg_5", "-", "arg_6", ",", "arg_0", ".", "max_msg_len", ")", ")", "if", "not", "arg_7", ":", "raise", "TensorForceError", "(", "\"No data of len {} received by socket.Func in call to method `Func`!\"", ".", "format", "(", "arg_5", "-", "arg_6", ")", ")", "arg_8", "=", "len", "(", "arg_7", ")", "arg_6", "+=", "arg_8", "arg_3", ".", "feed", "(", "arg_7", ")", "if", "arg_6", "==", "arg_5", ":", "break", "for", "arg_9", "in", "arg_3", ":", "arg_10", "=", "arg_9", ".", "get", "(", "\"status\"", ",", "arg_9", ".", "get", "(", "b\"status\"", ")", ")", "if", "arg_10", ":", "if", "arg_10", "==", "\"ok\"", "or", "arg_10", "==", "b\"ok\"", ":", "return", "arg_9", "else", ":", "raise", "TensorForceError", "(", "\"RemoteEnvironment server error: {}\"", ".", "format", "(", "arg_9", ".", "get", "(", "\"message\"", ",", "\"not specified\"", ")", ")", ")", "else", ":", "raise", "TensorForceError", "(", "\"Message without field 'status' received!\"", ")", "raise", "TensorForceError", "(", "\"No message encoded in data stream (data stream had len={})\"", ".", "format", "(", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Receives a message as msgpack-numpy encoded byte-string from the given socket object.\n        Blocks until something was received.\n\n        Args:\n            socket_: The python socket object to use.\n            encoding (str): The encoding to use for unpacking messages from the socket.\n        Returns: The decoded (as dict) message received.\n        \"\"\"\n        arg_3 = msgpack.Unpacker(arg_2=arg_2)\n\n        # Wait for an immediate response.\n        arg_4 = arg_1.Func(8)  # get the length of the message\n        if arg_4 == b\"\":\n            raise TensorForceError(\"No data received by socket.Func in call to method `Func` \" +\n                                   \"(listener possibly closed)!\")\n        arg_5 = int(arg_4)\n        arg_6 = 0\n        while True:\n            arg_7 = arg_1.Func(min(arg_5 - arg_6, arg_0.max_msg_len))\n            # There must be a response.\n            if not arg_7:\n                raise TensorForceError(\"No data of len {} received by socket.Func in call to method `Func`!\".\n                                       format(arg_5 - arg_6))\n            arg_8 = len(arg_7)\n            arg_6 += arg_8\n            arg_3.feed(arg_7)\n\n            if arg_6 == arg_5:\n                break\n\n        # Get the data.\n        for arg_9 in arg_3:\n            arg_10 = arg_9.get(\"status\", arg_9.get(b\"status\"))\n            if arg_10:\n                if arg_10 == \"ok\" or arg_10 == b\"ok\":\n                    return arg_9\n                else:\n                    raise TensorForceError(\"RemoteEnvironment server error: {}\".\n                                           format(arg_9.get(\"message\", \"not specified\")))\n            else:\n                raise TensorForceError(\"Message without field 'status' received!\")\n        raise TensorForceError(\"No message encoded in data stream (data stream had len={})\".\n                               format(arg_5))", "path": "tensorforce/contrib/remote_environment.py", "identifier": "MsgPackNumpyProtocol.recv", "docstring": "Receives a message as msgpack-numpy encoded byte-string from the given socket object.\n        Blocks until something was received.\n\n        Args:\n            socket_: The python socket object to use.\n            encoding (str): The encoding to use for unpacking messages from the socket.\n        Returns: The decoded (as dict) message received.", "docstring_tokens": ["Receives", "a", "message", "as", "msgpack", "-", "numpy", "encoded", "byte", "-", "string", "from", "the", "given", "socket", "object", ".", "Blocks", "until", "something", "was", "received", "."], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 260857}
{"url": "https://github.com/bucknerns/concordance/blob/a4f39b60e7f8ec64741dd7a603105734bd9cca72/concordance/drivers/runner.py#L19-L40", "sha": "a4f39b60e7f8ec64741dd7a603105734bd9cca72", "docstring_summary": "Parses command line args using argparse library", "language": "python", "parameters": "()", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "\"Usage: create_concordance <infile> [<outfile>]\"", "arg_1", "=", "\"Simple Concordance Generator\"", "arg_2", "=", "argparse", ".", "ArgumentParser", "(", "arg_0", "=", "arg_0", ",", "arg_1", "=", "arg_1", ")", "arg_2", ".", "add_argument", "(", "'infile'", ",", "type", "=", "argparse", ".", "FileType", "(", "'r'", ")", ",", "help", "=", "\"File read in to create concordance\"", ")", "arg_2", ".", "add_argument", "(", "'outfile'", ",", "nargs", "=", "'?'", ",", "type", "=", "argparse", ".", "FileType", "(", "'w'", ")", ",", "default", "=", "sys", ".", "stdout", ",", "help", "=", "\"File to write concordance to.  \"", "\"Default is stdout\"", ")", "arg_2", ".", "add_argument", "(", "'--word'", ",", "nargs", "=", "\"?\"", ",", "const", "=", "str", ",", "help", "=", "\"Display a word in concordance\"", ")", "arg_3", "=", "arg_2", ".", "Func", "(", ")", "return", "arg_3"], "function": "def Func():\n    \"\"\"\n    Parses command line args using argparse library\n    \"\"\"\n    arg_0 = \"Usage: create_concordance <infile> [<outfile>]\"\n    arg_1 = \"Simple Concordance Generator\"\n    arg_2 = argparse.ArgumentParser(\n        arg_0=arg_0, arg_1=arg_1)\n\n    arg_2.add_argument(\n        'infile', type=argparse.FileType('r'),\n        help=\"File read in to create concordance\")\n\n    arg_2.add_argument(\n        'outfile', nargs='?', type=argparse.FileType('w'),\n        default=sys.stdout, help=\"File to write concordance to.  \"\n        \"Default is stdout\")\n\n    arg_2.add_argument(\n        '--word', nargs=\"?\", const=str, help=\"Display a word in concordance\")\n    arg_3 = arg_2.Func()\n    return arg_3", "path": "concordance/drivers/runner.py", "identifier": "parse_args", "docstring": "Parses command line args using argparse library", "docstring_tokens": ["Parses", "command", "line", "args", "using", "argparse", "library"], "nwo": "bucknerns/concordance", "score": 0.09252797783733271, "idx": 260858}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/config.py#L68-L106", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "Set the global config values.", "language": "python", "parameters": "(verbose,  # pylint:disable=redefined-builtin\n        host,\n        http_port,\n        ws_port,\n        use_https,\n        verify_ssl)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "GlobalConfigManager", ".", "get_config_or_default", "(", ")", "if", "arg_0", "is", "not", "None", ":", "arg_6", ".", "verbose", "=", "arg_0", "if", "arg_1", "is", "not", "None", ":", "arg_6", ".", "host", "=", "arg_1", "if", "arg_2", "is", "not", "None", ":", "arg_6", ".", "http_port", "=", "arg_2", "if", "arg_3", "is", "not", "None", ":", "arg_6", ".", "ws_port", "=", "arg_3", "if", "arg_4", "is", "not", "None", ":", "arg_6", ".", "use_https", "=", "arg_4", "if", "arg_5", "is", "False", ":", "arg_6", ".", "verify_ssl", "=", "arg_5", "GlobalConfigManager", ".", "Func_config", "(", "arg_6", ")", "Printer", ".", "print_success", "(", "'Config was updated.'", ")", "CliConfigManager", ".", "purge", "(", ")"], "function": "def Func(arg_0,  # pylint:disable=redefined-builtin\n        arg_1,\n        arg_2,\n        arg_3,\n        arg_4,\n        arg_5):\n    \"\"\"Set the global config values.\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon config Func --hots=localhost http_port=80\n    ```\n    \"\"\"\n    arg_6 = GlobalConfigManager.get_config_or_default()\n\n    if arg_0 is not None:\n        arg_6.verbose = arg_0\n\n    if arg_1 is not None:\n        arg_6.host = arg_1\n\n    if arg_2 is not None:\n        arg_6.http_port = arg_2\n\n    if arg_3 is not None:\n        arg_6.ws_port = arg_3\n\n    if arg_4 is not None:\n        arg_6.use_https = arg_4\n\n    if arg_5 is False:\n        arg_6.verify_ssl = arg_5\n\n    GlobalConfigManager.Func_config(arg_6)\n    Printer.print_success('Config was updated.')\n    # ReFunc cli config\n    CliConfigManager.purge()", "path": "polyaxon_cli/cli/config.py", "identifier": "set", "docstring": "Set the global config values.\n\n    Example:\n\n    \\b\n    ```bash\n    $ polyaxon config set --hots=localhost http_port=80\n    ```", "docstring_tokens": ["Set", "the", "global", "config", "values", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 260859}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L1450-L1453", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find an object and return a struct with info about it.", "language": "python", "parameters": "(self, oname, namespaces=None)", "return_statement": "return Struct(self._ofind_property(oname, inf))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "Struct", "(", "arg_0", ".", "_ofind", "(", "arg_1", ",", "arg_2", ")", ")", "return", "Struct", "(", "arg_0", ".", "_ofind_property", "(", "arg_1", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Find an object and return a struct with info about it.\"\"\"\n        arg_3 = Struct(arg_0._ofind(arg_1, arg_2))\n        return Struct(arg_0._ofind_property(arg_1, arg_3))", "path": "environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py", "identifier": "InteractiveShell._object_find", "docstring": "Find an object and return a struct with info about it.", "docstring_tokens": ["Find", "an", "object", "and", "return", "a", "struct", "with", "info", "about", "it", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260860}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/param.py#L105-L115", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Get value of parameter", "language": "python", "parameters": "(p)", "return_statement": "return toHVal(p)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "while", "isinstance", "(", "arg_0", ",", "Param", ")", ":", "arg_0", "=", "arg_0", ".", "get", "(", ")", "if", "isinstance", "(", "arg_0", ",", "RtlSignalBase", ")", ":", "return", "arg_0", ".", "staticEval", "(", ")", "return", "toHVal", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Get value of parameter\n    \"\"\"\n    while isinstance(arg_0, Param):\n        arg_0 = arg_0.get()\n\n    if isinstance(arg_0, RtlSignalBase):\n        return arg_0.staticEval()\n        # use rather param inheritance instead of param as param value\n    return toHVal(arg_0)", "path": "hwt/synthesizer/param.py", "identifier": "evalParam", "docstring": "Get value of parameter", "docstring_tokens": ["Get", "value", "of", "parameter"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 260861}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L255-L269", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Returns the filesize of a file", "language": "python", "parameters": "(self, filename)", "return_statement": "return result[0]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "def", "dir_callback", "(", "arg_3", ")", ":", "arg_2", ".", "append", "(", "arg_3", ".", "split", "(", ")", "[", "4", "]", ")", "arg_0", ".", "_ftp", ".", "dir", "(", "arg_1", ",", "dir_callback", ")", "return", "arg_2", "[", "0", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns the filesize of a file\n\n        :param filename: the full path to the file on the server.\n        :type filename: string\n\n        :returns: string representation of the filesize.\n        \"\"\"\n        arg_2 = []\n\n        def dir_callback(arg_3):\n            arg_2.append(arg_3.split()[4])\n\n        arg_0._ftp.dir(arg_1, dir_callback)\n        return arg_2[0]", "path": "harvestingkit/ftp_utils.py", "identifier": "FtpHandler.get_filesize", "docstring": "Returns the filesize of a file\n\n        :param filename: the full path to the file on the server.\n        :type filename: string\n\n        :returns: string representation of the filesize.", "docstring_tokens": ["Returns", "the", "filesize", "of", "a", "file"], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 260862}
{"url": "https://github.com/nicfit/nicfit.py/blob/8313f8edbc5e7361ddad496d6d818324b5236c7a/nicfit/app.py#L74-L98", "sha": "8313f8edbc5e7361ddad496d6d818324b5236c7a", "docstring_summary": "Run Application.main and exits with the return value.", "language": "python", "parameters": "(self, args_list=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Application.Func: {args_list}\"", ".", "format", "(", "**", "locals", "(", ")", ")", ")", "arg_2", "=", "None", "try", ":", "arg_2", "=", "arg_0", ".", "_Func", "(", "arg_1", "=", "arg_1", ")", "except", "KeyboardInterrupt", ":", "arg_0", ".", "log", ".", "verbose", "(", "\"Interrupted\"", ")", "except", "SystemExit", "as", "exit", ":", "arg_0", ".", "log", ".", "verbose", "(", "\"Exited\"", ")", "arg_2", "=", "exit", ".", "code", "except", "Exception", ":", "print", "(", "\"Uncaught exception\"", ",", "file", "=", "sys", ".", "stderr", ")", "traceback", ".", "print_exc", "(", ")", "if", "\"debug_pdb\"", "in", "arg_0", ".", "args", "and", "arg_0", ".", "args", ".", "debug_pdb", ":", "debugger", "(", ")", "arg_2", "=", "Application", ".", "UNCAUGHT_EXCEPTION_EXIT", "raise", "finally", ":", "try", ":", "arg_0", ".", "_atexit", "(", ")", "finally", ":", "sys", ".", "stderr", ".", "flush", "(", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "sys", ".", "exit", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Run Application.main and exits with the return value.\"\"\"\n        arg_0.log.debug(\"Application.Func: {args_list}\".format(**locals()))\n        arg_2 = None\n        try:\n            arg_2 = arg_0._Func(arg_1=arg_1)\n        except KeyboardInterrupt:\n            arg_0.log.verbose(\"Interrupted\")                    # pragma: nocover\n        except SystemExit as exit:\n            arg_0.log.verbose(\"Exited\")\n            arg_2 = exit.code\n        except Exception:\n            print(\"Uncaught exception\", file=sys.stderr)\n            traceback.print_exc()\n            if \"debug_pdb\" in arg_0.args and arg_0.args.debug_pdb:\n                debugger()\n            arg_2 = Application.UNCAUGHT_EXCEPTION_EXIT\n            raise\n        finally:\n            try:\n                arg_0._atexit()\n            finally:\n                sys.stderr.flush()\n                sys.stdout.flush()\n                sys.exit(arg_2)", "path": "nicfit/app.py", "identifier": "Application.run", "docstring": "Run Application.main and exits with the return value.", "docstring_tokens": ["Run", "Application", ".", "main", "and", "exits", "with", "the", "return", "value", "."], "nwo": "nicfit/nicfit.py", "score": 0.09252797783733271, "idx": 260863}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/optimizer/linesearch/hager_zhang.py#L579-L650", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Prepares the arguments for the line search initialization.", "language": "python", "parameters": "(value_and_gradients_function,\n                  initial_step_size,\n                  val_initial,\n                  val_0,\n                  approximate_wolfe_threshold)", "return_statement": "return val_0, val_initial, f_lim, tf.convert_to_tensor(value=eval_count)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "0", "if", "arg_2", "is", "None", ":", "if", "arg_1", "is", "not", "None", ":", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_1", ")", "else", ":", "arg_1", "=", "tf", ".", "convert_to_tensor", "(", "value", "=", "1.0", ",", "dtype", "=", "tf", ".", "float32", ")", "arg_2", "=", "arg_0", "(", "arg_1", ")", "arg_5", "+=", "1", "if", "arg_3", "is", "None", ":", "arg_6", "=", "tf", ".", "zeros_like", "(", "arg_2", ".", "x", ")", "arg_3", "=", "arg_0", "(", "arg_6", ")", "arg_5", "+=", "1", "arg_7", "=", "arg_3", ".", "f", "+", "(", "arg_4", "*", "tf", ".", "abs", "(", "arg_3", ".", "f", ")", ")", "return", "arg_3", ",", "arg_2", ",", "arg_7", ",", "tf", ".", "convert_to_tensor", "(", "value", "=", "arg_5", ")"], "function": "def Func(arg_0,\n                  arg_1,\n                  arg_2,\n                  arg_3,\n                  arg_4):\n  \"\"\"Prepares the arguments for the line search initialization.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a real scalar\n      tensor and returns a namedtuple with the fields 'x', 'f', and 'df' that\n      correspond to scalar tensors of real dtype containing the point at which\n      the function was evaluated, the value of the function, and its\n      derivative at that point. The other namedtuple fields, if present,\n      should be tensors or sequences (possibly nested) of tensors.\n      In usual optimization application, this function would be generated by\n      projecting the multivariate objective function along some specific\n      direction. The direction is determined by some other procedure but should\n      be a descent direction (i.e. the derivative of the projected univariate\n      function must be negative at 0.).\n      Alternatively, the function may represent the batching of `n` such line\n      functions (e.g. projecting a single multivariate objective function along\n      `n` distinct directions at once) accepting n points as input, i.e. a\n      tensor of shape [n], and the fields 'x', 'f' and 'df' in the returned\n      namedtuple should each be a tensor of shape [n], with the corresponding\n      input points, function values, and derivatives at those input points.\n    initial_step_size: Scalar positive `Tensor` of real dtype, or a tensor of\n      shape [n] in batching mode. The initial value (or values) to try to\n      bracket the minimum. Default is `1.` as a float32.\n      Note that this point need not necessarily bracket the minimum for the line\n      search to work correctly but the supplied value must be greater than 0.\n      A good initial value will make the search converge faster.\n    val_initial: The full return value of evaluating\n      value_and_gradients_function at initial_step_size, i.e. a namedtuple with\n      'x', 'f', 'df', if already known by the caller. If not None the value of\n      `initial_step_size` will be ignored, otherwise the tuple will be computed\n      by evaluating value_and_gradients_function.\n    val_0: The full return value of value_and_gradients_function at `0.`, i.e.\n      a namedtuple with 'x', 'f', 'df', if already known by the caller. If None\n      the tuple will be computed by evaluating value_and_gradients_function.\n    approximate_wolfe_threshold: Scalar positive `Tensor` of\n      real dtype. Corresponds to the parameter 'epsilon' in\n      [Hager and Zhang (2006)][2]. Used to estimate the\n      threshold at which the line search switches to approximate Wolfe\n      conditions.\n\n  Returns:\n    left: A namedtuple, as returned by value_and_gradients_function,\n      containing the value and derivative of the function at `0.`.\n    val_initial: A namedtuple, as returned by value_and_gradients_function,\n      containing the value and derivative of the function at\n      `initial_step_size`.\n    f_lim: Real `Tensor` of shape [n]. The function value threshold for\n      the approximate Wolfe conditions to be checked.\n    eval_count: Scalar int32 `Tensor`. The number of target function\n      evaluations made by this function.\n  \"\"\"\n  arg_5 = 0\n  if arg_2 is None:\n    if arg_1 is not None:\n      arg_1 = tf.convert_to_tensor(value=arg_1)\n    else:\n      arg_1 = tf.convert_to_tensor(value=1.0, dtype=tf.float32)\n    arg_2 = arg_0(arg_1)\n    arg_5 += 1\n\n  if arg_3 is None:\n    arg_6 = tf.zeros_like(arg_2.x)\n    arg_3 = arg_0(arg_6)\n    arg_5 += 1\n\n  arg_7 = arg_3.f + (arg_4 * tf.abs(arg_3.f))\n  return arg_3, arg_2, arg_7, tf.convert_to_tensor(value=arg_5)", "path": "tensorflow_probability/python/optimizer/linesearch/hager_zhang.py", "identifier": "_prepare_args", "docstring": "Prepares the arguments for the line search initialization.\n\n  Args:\n    value_and_gradients_function: A Python callable that accepts a real scalar\n      tensor and returns a namedtuple with the fields 'x', 'f', and 'df' that\n      correspond to scalar tensors of real dtype containing the point at which\n      the function was evaluated, the value of the function, and its\n      derivative at that point. The other namedtuple fields, if present,\n      should be tensors or sequences (possibly nested) of tensors.\n      In usual optimization application, this function would be generated by\n      projecting the multivariate objective function along some specific\n      direction. The direction is determined by some other procedure but should\n      be a descent direction (i.e. the derivative of the projected univariate\n      function must be negative at 0.).\n      Alternatively, the function may represent the batching of `n` such line\n      functions (e.g. projecting a single multivariate objective function along\n      `n` distinct directions at once) accepting n points as input, i.e. a\n      tensor of shape [n], and the fields 'x', 'f' and 'df' in the returned\n      namedtuple should each be a tensor of shape [n], with the corresponding\n      input points, function values, and derivatives at those input points.\n    initial_step_size: Scalar positive `Tensor` of real dtype, or a tensor of\n      shape [n] in batching mode. The initial value (or values) to try to\n      bracket the minimum. Default is `1.` as a float32.\n      Note that this point need not necessarily bracket the minimum for the line\n      search to work correctly but the supplied value must be greater than 0.\n      A good initial value will make the search converge faster.\n    val_initial: The full return value of evaluating\n      value_and_gradients_function at initial_step_size, i.e. a namedtuple with\n      'x', 'f', 'df', if already known by the caller. If not None the value of\n      `initial_step_size` will be ignored, otherwise the tuple will be computed\n      by evaluating value_and_gradients_function.\n    val_0: The full return value of value_and_gradients_function at `0.`, i.e.\n      a namedtuple with 'x', 'f', 'df', if already known by the caller. If None\n      the tuple will be computed by evaluating value_and_gradients_function.\n    approximate_wolfe_threshold: Scalar positive `Tensor` of\n      real dtype. Corresponds to the parameter 'epsilon' in\n      [Hager and Zhang (2006)][2]. Used to estimate the\n      threshold at which the line search switches to approximate Wolfe\n      conditions.\n\n  Returns:\n    left: A namedtuple, as returned by value_and_gradients_function,\n      containing the value and derivative of the function at `0.`.\n    val_initial: A namedtuple, as returned by value_and_gradients_function,\n      containing the value and derivative of the function at\n      `initial_step_size`.\n    f_lim: Real `Tensor` of shape [n]. The function value threshold for\n      the approximate Wolfe conditions to be checked.\n    eval_count: Scalar int32 `Tensor`. The number of target function\n      evaluations made by this function.", "docstring_tokens": ["Prepares", "the", "arguments", "for", "the", "line", "search", "initialization", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260864}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/pretty.py#L324-L363", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Pretty print the given object.", "language": "python", "parameters": "(self, obj)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "id", "(", "arg_1", ")", "arg_3", "=", "arg_2", "in", "arg_0", ".", "stack", "arg_0", ".", "stack", ".", "append", "(", "arg_2", ")", "arg_0", ".", "begin_group", "(", ")", "try", ":", "arg_4", "=", "getattr", "(", "arg_1", ",", "'__class__'", ",", "None", ")", "or", "type", "(", "arg_1", ")", "try", ":", "arg_5", "=", "arg_0", ".", "singleton_pprinters", "[", "arg_2", "]", "except", "(", "TypeError", ",", "KeyError", ")", ":", "pass", "else", ":", "return", "arg_5", "(", "arg_1", ",", "arg_0", ",", "arg_3", ")", "for", "arg_6", "in", "_get_mro", "(", "arg_4", ")", ":", "if", "arg_6", "in", "arg_0", ".", "type_pprinters", ":", "return", "arg_0", ".", "type_pprinters", "[", "arg_6", "]", "(", "arg_1", ",", "arg_0", ",", "arg_3", ")", "else", ":", "arg_5", "=", "arg_0", ".", "_in_deferred_types", "(", "arg_6", ")", "if", "arg_5", "is", "not", "None", ":", "return", "arg_5", "(", "arg_1", ",", "arg_0", ",", "arg_3", ")", "else", ":", "if", "'_repr_Func_'", "in", "arg_4", ".", "__dict__", ":", "arg_7", "=", "arg_4", ".", "_repr_Func_", "if", "callable", "(", "arg_7", ")", ":", "return", "arg_7", "(", "arg_1", ",", "arg_0", ",", "arg_3", ")", "return", "_default_pprint", "(", "arg_1", ",", "arg_0", ",", "arg_3", ")", "finally", ":", "arg_0", ".", "end_group", "(", ")", "arg_0", ".", "stack", ".", "pop", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Pretty print the given object.\"\"\"\n        arg_2 = id(arg_1)\n        arg_3 = arg_2 in arg_0.stack\n        arg_0.stack.append(arg_2)\n        arg_0.begin_group()\n        try:\n            arg_4 = getattr(arg_1, '__class__', None) or type(arg_1)\n            # First try to find registered singleton printers for the type.\n            try:\n                arg_5 = arg_0.singleton_pprinters[arg_2]\n            except (TypeError, KeyError):\n                pass\n            else:\n                return arg_5(arg_1, arg_0, arg_3)\n            # Next walk the mro and check for either:\n            #   1) a registered printer\n            #   2) a _repr_Func_ method\n            for arg_6 in _get_mro(arg_4):\n                if arg_6 in arg_0.type_pprinters:\n                    # printer registered in self.type_pprinters\n                    return arg_0.type_pprinters[arg_6](arg_1, arg_0, arg_3)\n                else:\n                    # deferred printer\n                    arg_5 = arg_0._in_deferred_types(arg_6)\n                    if arg_5 is not None:\n                        return arg_5(arg_1, arg_0, arg_3)\n                    else:\n                        # Finally look for special method names.\n                        # Some objects automatically create any requested\n                        # attribute. Try to ignore most of them by checking for\n                        # callability.\n                        if '_repr_Func_' in arg_4.__dict__:\n                            arg_7 = arg_4._repr_Func_\n                            if callable(arg_7):\n                                return arg_7(arg_1, arg_0, arg_3)\n            return _default_pprint(arg_1, arg_0, arg_3)\n        finally:\n            arg_0.end_group()\n            arg_0.stack.pop()", "path": "environment/lib/python2.7/site-packages/IPython/lib/pretty.py", "identifier": "RepresentationPrinter.pretty", "docstring": "Pretty print the given object.", "docstring_tokens": ["Pretty", "print", "the", "given", "object", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260865}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1222-L1252", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Associate an existing reservedIP to a deployment.", "language": "python", "parameters": "(\n        self, name, service_name, deployment_name, virtual_ip_name=None\n    )", "return_statement": "return self._perform_post(\n            self._get_reserved_ip_path_for_association(name),\n            _XmlSerializer.associate_reserved_ip_to_xml(\n                service_name, deployment_name, virtual_ip_name\n            ),\n            as_async=True,\n            x_ms_version='2015-02-01'\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "_validate_not_none", "(", "'name'", ",", "arg_1", ")", "_validate_not_none", "(", "'service_name'", ",", "arg_2", ")", "_validate_not_none", "(", "'deployment_name'", ",", "arg_3", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_reserved_ip_path_for_association", "(", "arg_1", ")", ",", "_XmlSerializer", ".", "associate_reserved_ip_to_xml", "(", "arg_2", ",", "arg_3", ",", "arg_4", ")", ",", "as_async", "=", "True", ",", "x_ms_version", "=", "'2015-02-01'", ")"], "function": "def Func(\n        arg_0, arg_1, arg_2, arg_3, arg_4=None\n    ):\n        '''\n        Associate an existing reservedIP to a deployment.\n\n        name:\n            Required. Name of the reserved IP address.\n\n        service_name:\n            Required. Name of the hosted service.\n\n        deployment_name:\n            Required. Name of the deployment.\n\n        virtual_ip_name:\n            Optional. Name of the VirtualIP in case of multi Vip tenant.\n            If this value is not specified default virtualIP is used\n            for this operation.\n        '''\n        _validate_not_none('name', arg_1)\n        _validate_not_none('service_name', arg_2)\n        _validate_not_none('deployment_name', arg_3)\n        return arg_0._perform_post(\n            arg_0._get_reserved_ip_path_for_association(arg_1),\n            _XmlSerializer.associate_reserved_ip_to_xml(\n                arg_2, arg_3, arg_4\n            ),\n            as_async=True,\n            x_ms_version='2015-02-01'\n        )", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.associate_reserved_ip_address", "docstring": "Associate an existing reservedIP to a deployment.\n\n        name:\n            Required. Name of the reserved IP address.\n\n        service_name:\n            Required. Name of the hosted service.\n\n        deployment_name:\n            Required. Name of the deployment.\n\n        virtual_ip_name:\n            Optional. Name of the VirtualIP in case of multi Vip tenant.\n            If this value is not specified default virtualIP is used\n            for this operation.", "docstring_tokens": ["Associate", "an", "existing", "reservedIP", "to", "a", "deployment", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260866}
{"url": "https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L705-L733", "sha": "181ea41375d29922eb96768cf6550e57a77a0c95", "docstring_summary": "iterator for the most significant key phrases", "language": "python", "parameters": "(path, phrase_limit=20)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "20", ")", ":", "arg_2", "=", "None", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_3", "=", "[", "]", "for", "arg_4", "in", "json_iter", "(", "arg_0", ")", ":", "arg_5", "=", "RankedLexeme", "(", "**", "arg_4", ")", "arg_3", ".", "append", "(", "arg_5", ")", "else", ":", "arg_3", "=", "arg_0", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_2", "=", "statistics", ".", "mean", "(", "[", "arg_5", ".", "rank", "for", "arg_5", "in", "arg_3", "]", ")", "else", ":", "arg_2", "=", "0", "arg_6", "=", "0", "for", "arg_5", "in", "arg_3", ":", "if", "arg_5", ".", "pos", "[", "0", "]", "!=", "\"v\"", ":", "if", "(", "arg_6", ">", "arg_1", ")", "or", "(", "arg_5", ".", "rank", "<", "arg_2", ")", ":", "return", "arg_6", "+=", "1", "yield", "arg_5", ".", "text", ".", "replace", "(", "\" - \"", ",", "\"-\"", ")"], "function": "def Func (arg_0, arg_1=20):\n    \"\"\"\n    iterator for the most significant key phrases\n    \"\"\"\n    arg_2 = None\n\n    if isinstance(arg_0, str):\n        arg_3 = []\n\n        for arg_4 in json_iter(arg_0):\n            arg_5 = RankedLexeme(**arg_4)\n            arg_3.append(arg_5)\n    else:\n        arg_3 = arg_0\n\n    if len(arg_3) > 0:\n        arg_2 = statistics.mean([arg_5.rank for arg_5 in arg_3])\n    else:\n            arg_2 = 0\n\n    arg_6 = 0\n\n    for arg_5 in arg_3:\n        if arg_5.pos[0] != \"v\":\n            if (arg_6 > arg_1) or (arg_5.rank < arg_2):\n                return\n\n            arg_6 += 1\n            yield arg_5.text.replace(\" - \", \"-\")", "path": "pytextrank/pytextrank.py", "identifier": "limit_keyphrases", "docstring": "iterator for the most significant key phrases", "docstring_tokens": ["iterator", "for", "the", "most", "significant", "key", "phrases"], "nwo": "DerwenAI/pytextrank", "score": 0.7839085590528955, "idx": 260867}
{"url": "https://github.com/codelv/enaml-web/blob/88f1131a7b3ba9e83467b4f44bc3bab6f0de7559/web/impl/lxml_raw.py#L29-L38", "sha": "88f1131a7b3ba9e83467b4f44bc3bab6f0de7559", "docstring_summary": "Set the source by parsing the source and inserting it into the \n        component.", "language": "python", "parameters": "(self, source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "widget", ".", "clear", "(", ")", "arg_2", "=", "etree", ".", "HTML", "(", "arg_1", ")", "arg_0", ".", "widget", ".", "extend", "(", "arg_2", "[", "0", "]", ")", "super", "(", "RawComponent", ",", "arg_0", ")", ".", "init_widget", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Set the source by parsing the source and inserting it into the \n        component. \n        \"\"\"\n        arg_0.widget.clear()\n        arg_2 = etree.HTML(arg_1)\n        arg_0.widget.extend(arg_2[0])\n\n        # Clear removes everything so it must be reinitialized\n        super(RawComponent, arg_0).init_widget()", "path": "web/impl/lxml_raw.py", "identifier": "RawComponent.set_source", "docstring": "Set the source by parsing the source and inserting it into the \n        component.", "docstring_tokens": ["Set", "the", "source", "by", "parsing", "the", "source", "and", "inserting", "it", "into", "the", "component", "."], "nwo": "codelv/enaml-web", "score": 0.5680722283335639, "idx": 260868}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/flvconcat.py#L207-L239", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Reads FLV tags from fd or buf and returns them with adjusted\n           timestamps.", "language": "python", "parameters": "(self, fd=None, buf=None, skip_header=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "dict", "(", "arg_0", ".", "timestamps_add", ")", "arg_5", "=", "arg_0", ".", "iter_tags", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "not", "arg_0", ".", "flv_header_written", ":", "arg_6", "=", "arg_0", ".", "analyze_tags", "(", "arg_5", ")", "else", ":", "arg_6", "=", "[", "]", "for", "arg_7", "in", "chain", "(", "arg_6", ",", "arg_5", ")", ":", "if", "not", "arg_0", ".", "flv_header_written", ":", "arg_8", "=", "Header", "(", "has_video", "=", "arg_0", ".", "has_video", ",", "has_audio", "=", "arg_0", ".", "has_audio", ")", "yield", "arg_8", ".", "serialize", "(", ")", "arg_0", ".", "flv_header_written", "=", "True", "if", "arg_0", ".", "verify_tag", "(", "arg_7", ")", ":", "arg_0", ".", "adjust_tag_gap", "(", "arg_7", ")", "arg_0", ".", "adjust_tag_timestamp", "(", "arg_7", ")", "if", "arg_0", ".", "duration", ":", "arg_10", "=", "arg_7", ".", "timestamp", "/", "1000", "if", "arg_10", ">", "arg_0", ".", "duration", ":", "break", "yield", "arg_7", ".", "serialize", "(", ")", "arg_4", "[", "arg_7", ".", "type", "]", "=", "arg_7", ".", "timestamp", "if", "not", "arg_0", ".", "flatten_timestamps", ":", "arg_0", ".", "timestamps_add", "=", "arg_4", "arg_0", ".", "tags", "=", "[", "]"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Reads FLV tags from fd or buf and returns them with adjusted\n           timestamps.\"\"\"\n        arg_4 = dict(arg_0.timestamps_add)\n        arg_5 = arg_0.iter_tags(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)\n\n        if not arg_0.flv_header_written:\n            arg_6 = arg_0.analyze_tags(arg_5)\n        else:\n            arg_6 = []\n\n        for arg_7 in chain(arg_6, arg_5):\n            if not arg_0.flv_header_written:\n                arg_8 = Header(has_video=arg_0.has_video,\n                                    has_audio=arg_0.has_audio)\n                yield arg_8.serialize()\n                arg_0.flv_header_written = True\n\n            if arg_0.verify_tag(arg_7):\n                arg_0.adjust_tag_gap(arg_7)\n                arg_0.adjust_tag_timestamp(arg_7)\n\n                if arg_0.duration:\n                    arg_10 = arg_7.timestamp / 1000\n                    if arg_10 > arg_0.duration:\n                        break\n                yield arg_7.serialize()\n                arg_4[arg_7.type] = arg_7.timestamp\n\n        if not arg_0.flatten_timestamps:\n            arg_0.timestamps_add = arg_4\n\n        arg_0.tags = []", "path": "src/streamlink/stream/flvconcat.py", "identifier": "FLVTagConcat.iter_chunks", "docstring": "Reads FLV tags from fd or buf and returns them with adjusted\n           timestamps.", "docstring_tokens": ["Reads", "FLV", "tags", "from", "fd", "or", "buf", "and", "returns", "them", "with", "adjusted", "timestamps", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 260869}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L794-L812", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Writes the contents of this model's in-memory prediction cache to a permanent\n    store via the prediction output stream instance", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "__predictionCache", ":", "return", "if", "arg_0", ".", "_predictionLogger", "is", "None", ":", "arg_0", ".", "_createPredictionLogger", "(", ")", "arg_1", "=", "time", ".", "time", "(", ")", "arg_0", ".", "_predictionLogger", ".", "writeRecords", "(", "arg_0", ".", "__predictionCache", ",", "progressCB", "=", "arg_0", ".", "__writeRecordsCallback", ")", "arg_0", ".", "_logger", ".", "info", "(", "\"Flushed prediction cache; numrows=%s; elapsed=%s sec.\"", ",", "len", "(", "arg_0", ".", "__predictionCache", ")", ",", "time", ".", "time", "(", ")", "-", "arg_1", ")", "arg_0", ".", "__predictionCache", ".", "clear", "(", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Writes the contents of this model's in-memory prediction cache to a permanent\n    store via the prediction output stream instance\n    \"\"\"\n\n    if not arg_0.__predictionCache:\n      return\n\n    # Create an output store, if one doesn't exist already\n    if arg_0._predictionLogger is None:\n      arg_0._createPredictionLogger()\n\n    arg_1 = time.time()\n    arg_0._predictionLogger.writeRecords(arg_0.__predictionCache,\n                                        progressCB=arg_0.__writeRecordsCallback)\n    arg_0._logger.info(\"Flushed prediction cache; numrows=%s; elapsed=%s sec.\",\n                      len(arg_0.__predictionCache), time.time() - arg_1)\n    arg_0.__predictionCache.clear()", "path": "src/nupic/swarming/ModelRunner.py", "identifier": "OPFModelRunner.__flushPredictionCache", "docstring": "Writes the contents of this model's in-memory prediction cache to a permanent\n    store via the prediction output stream instance", "docstring_tokens": ["Writes", "the", "contents", "of", "this", "model", "s", "in", "-", "memory", "prediction", "cache", "to", "a", "permanent", "store", "via", "the", "prediction", "output", "stream", "instance"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260870}
{"url": "https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/legacy.py#L39-L53", "sha": "b75f82a4551ff37e7c7a7e6954c536451f3e6d06", "docstring_summary": "Build an array of timestamps joining the arrays in `ph_times_list`.\n    `time_block` is the duration of each array of timestamps.", "language": "python", "parameters": "(times_list, times_par_list, time_block)", "return_statement": "return times, times_par", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "np", ".", "arange", "(", "len", "(", "arg_0", ")", ")", "*", "arg_2", "arg_4", "=", "np", ".", "cumsum", "(", "[", "arg_9", ".", "size", "for", "arg_9", "in", "arg_0", "]", ")", "arg_5", "=", "np", ".", "zeros", "(", "arg_4", "[", "-", "1", "]", ")", "arg_6", "=", "np", ".", "zeros", "(", "arg_4", "[", "-", "1", "]", ",", "dtype", "=", "'uint8'", ")", "arg_7", "=", "0", "for", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "in", "zip", "(", "arg_4", ",", "arg_0", ",", "arg_1", ",", "arg_3", ")", ":", "arg_5", "[", "arg_7", ":", "arg_8", "]", "=", "arg_9", "+", "arg_11", "arg_6", "[", "arg_7", ":", "arg_8", "]", "=", "arg_10", "arg_7", "=", "arg_8", "return", "arg_5", ",", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Build an array of timestamps joining the arrays in `ph_times_list`.\n    `time_block` is the duration of each array of timestamps.\n    \"\"\"\n    arg_3 = np.arange(len(arg_0)) * arg_2\n    arg_4 = np.cumsum([arg_9.size for arg_9 in arg_0])\n    arg_5 = np.zeros(arg_4[-1])\n    arg_6 = np.zeros(arg_4[-1], dtype='uint8')\n    arg_7 = 0\n    for arg_8, arg_9, arg_10, arg_11 in zip(arg_4, arg_0, arg_1,\n                                      arg_3):\n        arg_5[arg_7:arg_8] = arg_9 + arg_11\n        arg_6[arg_7:arg_8] = arg_10\n        arg_7 = arg_8\n    return arg_5, arg_6", "path": "pybromo/legacy.py", "identifier": "merge_ph_times", "docstring": "Build an array of timestamps joining the arrays in `ph_times_list`.\n    `time_block` is the duration of each array of timestamps.", "docstring_tokens": ["Build", "an", "array", "of", "timestamps", "joining", "the", "arrays", "in", "ph_times_list", ".", "time_block", "is", "the", "duration", "of", "each", "array", "of", "timestamps", "."], "nwo": "tritemio/PyBroMo", "score": 0.5363891371487866, "idx": 260871}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/states.py#L381-L445", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Here, we build gradient and hessian functions based on the properties\n        of a state that are generally wanted. For each one, we fill in _grad or\n        _hess with a function that takes care of various options such as\n        slicing and flattening. For example, `m` below takes the model, selects\n        different indices from it, maybe flattens it and copies it. This is\n        then used in the fisherinformation, gradmodel, and hessmodel functions.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "m", "(", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "return", "sample", "(", "arg_0", ".", "model", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ".", "copy", "(", ")", "def", "r", "(", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "True", ")", ":", "return", "sample", "(", "arg_0", ".", "residuals", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ".", "copy", "(", ")", "def", "l", "(", ")", ":", "return", "arg_0", ".", "loglikelihood", "def", "r_e", "(", "**", "arg_4", ")", ":", "return", "r", "(", "**", "arg_4", ")", ",", "np", ".", "copy", "(", "arg_0", ".", "error", ")", "def", "m_e", "(", "**", "arg_4", ")", ":", "return", "m", "(", "**", "arg_4", ")", ",", "np", ".", "copy", "(", "arg_0", ".", "error", ")", "arg_0", ".", "fisherinformation", "=", "partial", "(", "arg_0", ".", "_jtj", ",", "funct", "=", "m", ")", "arg_0", ".", "gradloglikelihood", "=", "partial", "(", "arg_0", ".", "_grad", ",", "funct", "=", "l", ")", "arg_0", ".", "hessloglikelihood", "=", "partial", "(", "arg_0", ".", "_hess", ",", "funct", "=", "l", ")", "arg_0", ".", "gradmodel", "=", "partial", "(", "arg_0", ".", "_grad", ",", "funct", "=", "m", ")", "arg_0", ".", "hessmodel", "=", "partial", "(", "arg_0", ".", "_hess", ",", "funct", "=", "m", ")", "arg_0", ".", "JTJ", "=", "partial", "(", "arg_0", ".", "_jtj", ",", "funct", "=", "r", ")", "arg_0", ".", "J", "=", "partial", "(", "arg_0", ".", "_grad", ",", "funct", "=", "r", ")", "arg_0", ".", "J_e", "=", "partial", "(", "arg_0", ".", "_grad", ",", "funct", "=", "r_e", ",", "nout", "=", "2", ")", "arg_0", ".", "gradmodel_e", "=", "partial", "(", "arg_0", ".", "_grad", ",", "funct", "=", "m_e", ",", "nout", "=", "2", ")", "arg_0", ".", "fisherinformation", ".", "__doc__", "=", "_graddoc", "+", "_sampledoc", "arg_0", ".", "gradloglikelihood", ".", "__doc__", "=", "_graddoc", "arg_0", ".", "hessloglikelihood", ".", "__doc__", "=", "_graddoc", "arg_0", ".", "gradmodel", ".", "__doc__", "=", "_graddoc", "+", "_sampledoc", "arg_0", ".", "hessmodel", ".", "__doc__", "=", "_graddoc", "+", "_sampledoc", "arg_0", ".", "JTJ", ".", "__doc__", "=", "_graddoc", "+", "_sampledoc", "arg_0", ".", "J", ".", "__doc__", "=", "_graddoc", "+", "_sampledoc", "arg_0", ".", "_dograddoc", "(", "arg_0", ".", "_grad_one_param", ")", "arg_0", ".", "_dograddoc", "(", "arg_0", ".", "_hess_two_param", ")", "arg_0", ".", "_dograddoc", "(", "arg_0", ".", "_grad", ")", "arg_0", ".", "_dograddoc", "(", "arg_0", ".", "_hess", ")", "class", "_Statewrap", "(", "object", ")", ":", "def", "__init__", "(", "arg_0", ",", "arg_15", ")", ":", "arg_0", ".", "obj", "=", "arg_15", "def", "__getitem__", "(", "arg_0", ",", "arg_16", "=", "None", ")", ":", "if", "arg_16", "is", "None", ":", "arg_16", "=", "arg_0", ".", "obj", ".", "params", "return", "util", ".", "delistify", "(", "arg_0", ".", "obj", ".", "get_values", "(", "arg_16", ")", ",", "arg_16", ")", "arg_0", ".", "state", "=", "_Statewrap", "(", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Here, we build gradient and hessian functions based on the properties\n        of a state that are generally wanted. For each one, we fill in _grad or\n        _hess with a function that takes care of various options such as\n        slicing and flattening. For example, `m` below takes the model, selects\n        different indices from it, maybe flattens it and copies it. This is\n        then used in the fisherinformation, gradmodel, and hessmodel functions.\n        \"\"\"\n        # create essentially lambda functions, but with a nice signature\n        def m(arg_1=None, arg_2=None, arg_3=True):\n            return sample(arg_0.model, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3).copy()\n\n        def r(arg_1=None, arg_2=None, arg_3=True):\n            return sample(arg_0.residuals, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3).copy()\n\n        def l():\n            return arg_0.loglikelihood\n\n        def r_e(**arg_4):\n            \"\"\"sliced etc residuals, with state.error appended on\"\"\"\n            return r(**arg_4), np.copy(arg_0.error)\n\n        def m_e(**arg_4):\n            \"\"\"sliced etc residuals, with state.error appended on\"\"\"\n            return m(**arg_4), np.copy(arg_0.error)\n\n        # set the member functions using partial\n        arg_0.fisherinformation = partial(arg_0._jtj, funct=m)\n        arg_0.gradloglikelihood = partial(arg_0._grad, funct=l)\n        arg_0.hessloglikelihood = partial(arg_0._hess, funct=l)\n        arg_0.gradmodel = partial(arg_0._grad, funct=m)\n        arg_0.hessmodel = partial(arg_0._hess, funct=m)\n        arg_0.JTJ = partial(arg_0._jtj, funct=r)\n        arg_0.J = partial(arg_0._grad, funct=r)\n        arg_0.J_e = partial(arg_0._grad, funct=r_e, nout=2)\n        arg_0.gradmodel_e = partial(arg_0._grad, funct=m_e, nout=2)\n\n        # add the appropriate documentation to the following functions\n        arg_0.fisherinformation.__doc__ = _graddoc + _sampledoc\n        arg_0.gradloglikelihood.__doc__ = _graddoc\n        arg_0.hessloglikelihood.__doc__ = _graddoc\n        arg_0.gradmodel.__doc__ = _graddoc + _sampledoc\n        arg_0.hessmodel.__doc__ = _graddoc + _sampledoc\n        arg_0.JTJ.__doc__ = _graddoc + _sampledoc\n        arg_0.J.__doc__ = _graddoc + _sampledoc\n\n        # add documentation to the private functions as well. this is done\n        # slightly differently, hence the function call\n        arg_0._dograddoc(arg_0._grad_one_param)\n        arg_0._dograddoc(arg_0._hess_two_param)\n        arg_0._dograddoc(arg_0._grad)\n        arg_0._dograddoc(arg_0._hess)\n\n        # the state object is a workaround so that other interfaces still\n        # work. this should probably be removed in the long run\n        class _Statewrap(object):\n            def __init__(arg_0, arg_15):\n                arg_0.obj = arg_15\n            def __getitem__(arg_0, arg_16=None):\n                if arg_16 is None:\n                    arg_16 = arg_0.obj.params\n                return util.delistify(arg_0.obj.get_values(arg_16), arg_16)\n\n        arg_0.state = _Statewrap(arg_0)", "path": "peri/states.py", "identifier": "State.build_funcs", "docstring": "Here, we build gradient and hessian functions based on the properties\n        of a state that are generally wanted. For each one, we fill in _grad or\n        _hess with a function that takes care of various options such as\n        slicing and flattening. For example, `m` below takes the model, selects\n        different indices from it, maybe flattens it and copies it. This is\n        then used in the fisherinformation, gradmodel, and hessmodel functions.", "docstring_tokens": ["Here", "we", "build", "gradient", "and", "hessian", "functions", "based", "on", "the", "properties", "of", "a", "state", "that", "are", "generally", "wanted", ".", "For", "each", "one", "we", "fill", "in", "_grad", "or", "_hess", "with", "a", "function", "that", "takes", "care", "of", "various", "options", "such", "as", "slicing", "and", "flattening", ".", "For", "example", "m", "below", "takes", "the", "model", "selects", "different", "indices", "from", "it", "maybe", "flattens", "it", "and", "copies", "it", ".", "This", "is", "then", "used", "in", "the", "fisherinformation", "gradmodel", "and", "hessmodel", "functions", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 260872}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L241-L255", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Remove common values\n            and Update specific values from another Set", "language": "python", "parameters": "(self, oset: Scope)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "arg_2", ":", "arg_3", "=", "set", "(", ")", "arg_4", "=", "list", "(", "arg_0", ".", "_hsig", ".", "keys", "(", ")", ")", "for", "arg_5", "in", "arg_4", ":", "if", "arg_5", "in", "arg_1", ":", "arg_3", ".", "add", "(", "arg_5", ")", "for", "arg_5", "in", "arg_1", ".", "_hsig", ".", "keys", "(", ")", ":", "if", "arg_5", "not", "in", "arg_3", ":", "arg_0", ".", "_hsig", "[", "arg_5", "]", "=", "arg_1", ".", "get", "(", "arg_5", ")", "for", "arg_5", "in", "arg_3", ":", "del", "arg_0", ".", "_hsig", "[", "arg_5", "]", "return", "arg_0"], "function": "def Func(arg_0, arg_1: arg_2) -> arg_2:\n        \"\"\" Remove common values\n            and Update specific values from another Set\n        \"\"\"\n        arg_3 = set()\n        arg_4 = list(arg_0._hsig.keys())\n        for arg_5 in arg_4:\n            if arg_5 in arg_1:\n                arg_3.add(arg_5)\n        for arg_5 in arg_1._hsig.keys():\n            if arg_5 not in arg_3:\n                arg_0._hsig[arg_5] = arg_1.get(arg_5)\n        for arg_5 in arg_3:\n            del arg_0._hsig[arg_5]\n        return arg_0", "path": "pyrser/type_system/scope.py", "identifier": "Scope.symmetric_difference_update", "docstring": "Remove common values\n            and Update specific values from another Set", "docstring_tokens": ["Remove", "common", "values", "and", "Update", "specific", "values", "from", "another", "Set"], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 260873}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L224-L234", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Helper function to get offset argument.\n    Raises exception if argument is missing.\n    Returns the offset argument.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "arg_0", ".", "get_argument", "(", "constants", ".", "PARAM_OFFSET", ")", "return", "arg_1", "except", "tornado", ".", "web", ".", "MissingArgumentError", "as", "e", ":", "raise", "Exception", "(", "e", ".", "log_message", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Helper function to get offset argument.\n    Raises exception if argument is missing.\n    Returns the offset argument.\n    \"\"\"\n    try:\n      arg_1 = arg_0.get_argument(constants.PARAM_OFFSET)\n      return arg_1\n    except tornado.web.MissingArgumentError as e:\n      raise Exception(e.log_message)", "path": "heron/tools/tracker/src/python/handlers/basehandler.py", "identifier": "BaseHandler.get_argument_offset", "docstring": "Helper function to get offset argument.\n    Raises exception if argument is missing.\n    Returns the offset argument.", "docstring_tokens": ["Helper", "function", "to", "get", "offset", "argument", ".", "Raises", "exception", "if", "argument", "is", "missing", ".", "Returns", "the", "offset", "argument", "."], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 260874}
{"url": "https://github.com/thusoy/pwm/blob/fff7d755c34f3a7235a8bf217ffa2ff5aed4926f/pwm/core.py#L159-L162", "sha": "fff7d755c34f3a7235a8bf217ffa2ff5aed4926f", "docstring_summary": "Search the database for the given query. Will find partial matches.", "language": "python", "parameters": "(self, query)", "return_statement": "return results", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "session", ".", "query", "(", "Domain", ")", ".", "filter", "(", "Domain", ".", "name", ".", "ilike", "(", "'%%%s%%'", "%", "arg_1", ")", ")", ".", "all", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Search the database for the given query. Will find partial matches. \"\"\"\n        arg_2 = arg_0.session.query(Domain).filter(Domain.name.ilike('%%%s%%' % arg_1)).all()\n        return arg_2", "path": "pwm/core.py", "identifier": "PWM.search", "docstring": "Search the database for the given query. Will find partial matches.", "docstring_tokens": ["Search", "the", "database", "for", "the", "given", "query", ".", "Will", "find", "partial", "matches", "."], "nwo": "thusoy/pwm", "score": 0.15726537023232431, "idx": 260875}
{"url": "https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/helpers.py#L197-L212", "sha": "aca085ea54541b087140b58a81332f8728baeeb2", "docstring_summary": "Check if path is safe and allowed.", "language": "python", "parameters": "(path)", "return_statement": "return not any(unsafeness_conditions)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "lambda", "val", ":", "re", ".", "match", "(", "r'%.+%'", ",", "val", ")", "arg_2", "=", "lambda", "val", ":", "re", ".", "match", "(", "r'\\$.+'", ",", "val", ")", "arg_3", "=", "[", "os", ".", "path", ".", "isabs", "(", "arg_0", ")", ",", "(", "'..%s'", "%", "os", ".", "path", ".", "sep", ")", "in", "arg_0", ",", "arg_0", ".", "startswith", "(", "'~'", ")", ",", "os", ".", "path", ".", "expandvars", "(", "arg_0", ")", "!=", "arg_0", ",", "arg_1", "(", "arg_0", ")", ",", "arg_2", "(", "arg_0", ")", ",", "]", "return", "not", "any", "(", "arg_3", ")"], "function": "def Func(arg_0):\n    \"\"\"Check if path is safe and allowed.\n    \"\"\"\n    arg_1 = lambda val: re.match(r'%.+%', val)\n    arg_2 = lambda val: re.match(r'\\$.+', val)\n\n    arg_3 = [\n        os.path.isabs(arg_0),\n        ('..%s' % os.path.sep) in arg_0,\n        arg_0.startswith('~'),\n        os.path.expandvars(arg_0) != arg_0,\n        arg_1(arg_0),\n        arg_2(arg_0),\n    ]\n\n    return not any(arg_3)", "path": "datapackage/helpers.py", "identifier": "is_safe_path", "docstring": "Check if path is safe and allowed.", "docstring_tokens": ["Check", "if", "path", "is", "safe", "and", "allowed", "."], "nwo": "frictionlessdata/datapackage-py", "score": 0.5653088377587532, "idx": 260876}
{"url": "https://github.com/openergy/oplus/blob/f095868d1990c1d126e906ada6acbab26348b3d3/oplus/epm/record.py#L85-L130", "sha": "f095868d1990c1d126e906ada6acbab26348b3d3", "docstring_summary": "is only called by _update_inert", "language": "python", "parameters": "(self, index, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_table", ".", "_dev_descriptor", ".", "get_field_descriptor", "(", "arg_1", ")", "arg_2", "=", "arg_3", ".", "deserialize", "(", "arg_2", ",", "arg_1", ")", "if", "isinstance", "(", "arg_2", ",", "Link", ")", ":", "arg_4", "=", "arg_0", ".", "_data", ".", "get", "(", "arg_1", ")", "if", "arg_4", "is", "not", "None", ":", "arg_4", ".", "unregister", "(", ")", "if", "isinstance", "(", "arg_2", ",", "RecordHook", ")", ":", "arg_5", "=", "arg_0", ".", "_data", ".", "get", "(", "arg_1", ")", "if", "arg_5", "is", "not", "None", ":", "arg_5", ".", "unregister", "(", ")", "if", "isinstance", "(", "arg_2", ",", "ExternalFile", ")", ":", "arg_6", "=", "arg_0", ".", "_data", ".", "get", "(", "arg_1", ")", "if", "arg_6", "is", "not", "None", ":", "arg_6", ".", "_dev_unregister", "(", ")", "if", "arg_2", "in", "(", "None", ",", "NONE_RECORD_HOOK", ",", "NONE_LINK", ",", "NONE_EXTERNAL_FILE", ")", ":", "arg_0", ".", "_dev_set_none_without_unregistering", "(", "arg_1", ",", "check_not_required", "=", "False", ")", "return", "arg_7", "=", "None", "if", "arg_1", "==", "0", "and", "not", "arg_0", ".", "_table", ".", "_dev_auto_pk", ":", "arg_7", "=", "arg_0", ".", "_data", ".", "get", "(", "0", ")", "arg_0", ".", "_data", "[", "arg_1", "]", "=", "arg_2", "if", "arg_7", "is", "not", "None", ":", "arg_0", ".", "_table", ".", "_dev_record_pk_was_updated", "(", "arg_7", ".", "target_value", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        is only called by _update_inert\n        \"\"\"\n        # get field descriptor\n        arg_3 = arg_0._table._dev_descriptor.get_field_descriptor(arg_1)\n\n        # prepare value\n        arg_2 = arg_3.deserialize(arg_2, arg_1)\n\n        # unregister previous link if relevant\n        if isinstance(arg_2, Link):\n            # de-activate current link if any\n            arg_4 = arg_0._data.get(arg_1)\n            if arg_4 is not None:\n                arg_4.unregister()\n\n        # unregister previous hook if relevant\n        if isinstance(arg_2, RecordHook):\n            arg_5 = arg_0._data.get(arg_1)\n            if arg_5 is not None:\n                arg_5.unregister()\n\n        # unregister previous external file if relevant\n        if isinstance(arg_2, ExternalFile):\n            arg_6 = arg_0._data.get(arg_1)\n            if arg_6 is not None:\n                arg_6._dev_unregister()\n\n        # if None remove and leave\n        if arg_2 in (None, NONE_RECORD_HOOK, NONE_LINK, NONE_EXTERNAL_FILE):\n            # we don't check required, because this method is called by _update_inert which does the job\n            arg_0._dev_set_none_without_unregistering(arg_1, check_not_required=False)\n            return\n\n        # if relevant, store current pk to signal table\n        arg_7 = None\n        if arg_1 == 0 and not arg_0._table._dev_auto_pk:\n            arg_7 = arg_0._data.get(0)  # we use get, because record may not have a pk yet if it is being created\n\n        # set value\n        arg_0._data[arg_1] = arg_2\n\n        # signal pk update if relevant\n        if arg_7 is not None:\n            arg_0._table._dev_record_pk_was_updated(arg_7.target_value)", "path": "oplus/epm/record.py", "identifier": "Record._update_value_inert", "docstring": "is only called by _update_inert", "docstring_tokens": ["is", "only", "called", "by", "_update_inert"], "nwo": "openergy/oplus", "score": 0.38919093769130675, "idx": 260877}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/app.py#L35-L76", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Flask app factory function.", "language": "python", "parameters": "(config_file=None, config=None)", "return_statement": "return app", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "Flask", "(", "__name__", ")", "arg_2", ".", "config", ".", "from_pyfile", "(", "'config.py'", ")", "arg_2", ".", "jinja_env", ".", "add_extension", "(", "'jinja2.ext.do'", ")", "if", "arg_1", ":", "arg_2", ".", "config", ".", "update", "(", "arg_1", ")", "if", "arg_0", ":", "arg_2", ".", "config", ".", "from_pyfile", "(", "arg_0", ")", "arg_2", ".", "mme_nodes", "=", "arg_3", "(", "arg_2", ".", "config", ".", "get", "(", "'MME_URL'", ")", ",", "arg_2", ".", "config", ".", "get", "(", "'MME_TOKEN'", ")", ")", "arg_2", ".", "config", "[", "\"JSON_SORT_KEYS\"", "]", "=", "False", "arg_4", "=", "logger", ".", "getEffectiveLevel", "(", ")", "coloredlogs", ".", "install", "(", "level", "=", "'DEBUG'", "if", "arg_2", ".", "debug", "else", "arg_4", ")", "configure_extensions", "(", "arg_2", ")", "register_blueprints", "(", "arg_2", ")", "register_filters", "(", "arg_2", ")", "if", "not", "(", "arg_2", ".", "debug", "or", "arg_2", ".", "testing", ")", "and", "arg_2", ".", "config", ".", "get", "(", "'MAIL_USERNAME'", ")", ":", "configure_email_logging", "(", "arg_2", ")", "@", "arg_2", ".", "before_request", "def", "check_user", "(", ")", ":", "if", "not", "arg_2", ".", "config", ".", "get", "(", "'LOGIN_DISABLED'", ")", "and", "request", ".", "endpoint", ":", "arg_5", "=", "'static'", "in", "request", ".", "endpoint", "or", "'report'", "in", "request", ".", "endpoint", "arg_6", "=", "getattr", "(", "arg_2", ".", "view_functions", "[", "request", ".", "endpoint", "]", ",", "'is_public'", ",", "False", ")", "arg_7", "=", "not", "(", "arg_5", "or", "arg_6", ")", "if", "arg_7", "and", "not", "current_user", ".", "is_authenticated", ":", "arg_8", "=", "\"{}?{}\"", ".", "format", "(", "request", ".", "path", ",", "request", ".", "query_string", ".", "decode", "(", ")", ")", "arg_9", "=", "url_for", "(", "'login.login'", ",", "next", "=", "arg_8", ")", "return", "redirect", "(", "arg_9", ")", "return", "arg_2"], "function": "def Func(arg_0=None, arg_1=None):\n    \"\"\"Flask app factory function.\"\"\"\n    arg_2 = Flask(__name__)\n    arg_2.config.from_pyfile('config.py')\n    arg_2.jinja_env.add_extension('jinja2.ext.do')\n    if arg_1:\n        arg_2.config.update(arg_1)\n    if arg_0:\n        arg_2.config.from_pyfile(arg_0)\n\n    # If there is a MatchMaker Exchange server\n    # collect the connected external nodes\n    arg_2.mme_nodes = arg_3(arg_2.config.get('MME_URL'), arg_2.config.get('MME_TOKEN'))\n\n\n    arg_2.config[\"JSON_SORT_KEYS\"] = False\n    arg_4 = logger.getEffectiveLevel()\n    coloredlogs.install(level='DEBUG' if arg_2.debug else arg_4)\n    configure_extensions(arg_2)\n    register_blueprints(arg_2)\n    register_filters(arg_2)\n\n    if not (arg_2.debug or arg_2.testing) and arg_2.config.get('MAIL_USERNAME'):\n        # setup email logging of errors\n        configure_email_logging(arg_2)\n\n    @arg_2.before_request\n    def check_user():\n        if not arg_2.config.get('LOGIN_DISABLED') and request.endpoint:\n            # check if the endpoint requires authentication\n            arg_5 = 'static' in request.endpoint or 'report' in request.endpoint\n            arg_6 = getattr(arg_2.view_functions[request.endpoint],\n                                      'is_public', False)\n            arg_7 = not (arg_5 or arg_6)\n            # if endpoint requires auth, check if user is authenticated\n            if arg_7 and not current_user.is_authenticated:\n                # combine visited URL (convert byte string query string to unicode!)\n                arg_8 = \"{}?{}\".format(request.path, request.query_string.decode())\n                arg_9 = url_for('login.login', next=arg_8)\n                return redirect(arg_9)\n\n    return arg_2", "path": "scout/server/app.py", "identifier": "create_app", "docstring": "Flask app factory function.", "docstring_tokens": ["Flask", "app", "factory", "function", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260878}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/bracket_matcher.py#L72-L82", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Convenience method for selecting a character.", "language": "python", "parameters": "(self, position)", "return_statement": "return selection", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "QtGui", ".", "QTextEdit", ".", "ExtraSelection", "(", ")", "arg_3", "=", "arg_0", ".", "_text_edit", ".", "textCursor", "(", ")", "arg_3", ".", "setPosition", "(", "arg_1", ")", "arg_3", ".", "movePosition", "(", "QtGui", ".", "QTextCursor", ".", "NextCharacter", ",", "QtGui", ".", "QTextCursor", ".", "KeepAnchor", ")", "arg_2", ".", "cursor", "=", "arg_3", "arg_2", ".", "format", "=", "arg_0", ".", "format", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Convenience method for selecting a character.\n        \"\"\"\n        arg_2 = QtGui.QTextEdit.ExtraSelection()\n        arg_3 = arg_0._text_edit.textCursor()\n        arg_3.setPosition(arg_1)\n        arg_3.movePosition(QtGui.QTextCursor.NextCharacter,\n                            QtGui.QTextCursor.KeepAnchor)\n        arg_2.cursor = arg_3\n        arg_2.format = arg_0.format\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/bracket_matcher.py", "identifier": "BracketMatcher._selection_for_character", "docstring": "Convenience method for selecting a character.", "docstring_tokens": ["Convenience", "method", "for", "selecting", "a", "character", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260879}
{"url": "https://github.com/kylebebak/questionnaire/blob/ed92642e8a2a0198da198acbcde2707f1d528585/questionnaire/prompters.py#L74-L109", "sha": "ed92642e8a2a0198da198acbcde2707f1d528585", "docstring_summary": "Calls `pick` in a while loop to allow user to pick many\n    options. Returns a list of chosen options.", "language": "python", "parameters": "(prompt, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "def", "get_options", "(", "arg_3", ",", "arg_4", ")", ":", "return", "[", "arg_3", "[", "arg_5", "]", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ")", "if", "arg_6", "]", "def", "get_verbose_options", "(", "arg_7", ",", "arg_4", ")", ":", "arg_8", ",", "arg_9", "=", "' '", ",", "'\u2714'", "if", "sys", ".", "version_info", "<", "(", "3", ",", "3", ")", ":", "arg_8", ",", "arg_9", "=", "' '", ",", "'@'", "arg_10", "=", "[", "'{} {}'", ".", "format", "(", "arg_9", "if", "arg_6", "else", "arg_8", ",", "arg_7", "[", "arg_5", "]", ")", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_4", ")", "]", "return", "arg_10", "+", "[", "'{}{}'", ".", "format", "(", "'  '", ",", "arg_2", ".", "get", "(", "'done'", ",", "'done...'", ")", ")", "]", "arg_3", ",", "arg_7", "=", "prepare_options", "(", "arg_1", ")", "arg_4", "=", "[", "False", "]", "*", "len", "(", "arg_3", ")", "arg_11", "=", "arg_2", ".", "get", "(", "'idx'", ",", "0", ")", "arg_12", "=", "arg_2", ".", "get", "(", "'default'", ",", "None", ")", "if", "isinstance", "(", "arg_12", ",", "list", ")", ":", "for", "arg_13", "in", "arg_12", ":", "arg_4", "[", "arg_13", "]", "=", "True", "if", "isinstance", "(", "arg_12", ",", "int", ")", ":", "arg_4", "[", "arg_12", "]", "=", "True", "while", "True", ":", "try", ":", "arg_11", "=", "one", "(", "arg_0", ",", "*", "get_verbose_options", "(", "arg_7", ",", "arg_4", ")", ",", "return_index", "=", "True", ",", "arg_13", "=", "arg_11", ")", "except", "QuestionnaireGoBack", ":", "if", "any", "(", "arg_4", ")", ":", "raise", "QuestionnaireGoBack", "(", "0", ")", "else", ":", "raise", "QuestionnaireGoBack", "if", "arg_11", "==", "len", "(", "arg_3", ")", ":", "return", "get_options", "(", "arg_3", ",", "arg_4", ")", "arg_4", "[", "arg_11", "]", "=", "not", "arg_4", "[", "arg_11", "]"], "function": "def Func(arg_0, *arg_1, **arg_2):\n    \"\"\"Calls `pick` in a while loop to allow user to pick Func\n    options. Returns a list of chosen options.\n    \"\"\"\n    def get_options(arg_3, arg_4):\n        return [arg_3[arg_5] for arg_5, arg_6 in enumerate(arg_4) if arg_6]\n\n    def get_verbose_options(arg_7, arg_4):\n        arg_8, arg_9 = ' ', '\u2714'\n        if sys.version_info < (3, 3):\n            arg_8, arg_9 = ' ', '@'\n        arg_10 = ['{} {}'.format(arg_9 if arg_6 else arg_8, arg_7[arg_5]) for arg_5, arg_6 in enumerate(arg_4)]\n        return arg_10 + ['{}{}'.format('  ', arg_2.get('done', 'done...'))]\n\n    arg_3, arg_7 = prepare_options(arg_1)\n    arg_4 = [False] * len(arg_3)\n    arg_11 = arg_2.get('idx', 0)\n\n    arg_12 = arg_2.get('default', None)\n    if isinstance(arg_12, list):\n        for arg_13 in arg_12:\n            arg_4[arg_13] = True\n    if isinstance(arg_12, int):\n        arg_4[arg_12] = True\n\n    while True:\n        try:\n            arg_11 = one(arg_0, *get_verbose_options(arg_7, arg_4), return_index=True, arg_13=arg_11)\n        except QuestionnaireGoBack:\n            if any(arg_4):\n                raise QuestionnaireGoBack(0)\n            else:\n                raise QuestionnaireGoBack\n        if arg_11 == len(arg_3):\n            return get_options(arg_3, arg_4)\n        arg_4[arg_11] = not arg_4[arg_11]", "path": "questionnaire/prompters.py", "identifier": "many", "docstring": "Calls `pick` in a while loop to allow user to pick many\n    options. Returns a list of chosen options.", "docstring_tokens": ["Calls", "pick", "in", "a", "while", "loop", "to", "allow", "user", "to", "pick", "many", "options", ".", "Returns", "a", "list", "of", "chosen", "options", "."], "nwo": "kylebebak/questionnaire", "score": 0.4695341856938158, "idx": 260880}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L202-L212", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Calculate the amounts from the specified compound masses.", "language": "python", "parameters": "(masses)", "return_statement": "return {compound: amount(compound, masses[compound])\n            for compound in masses.keys()}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "{", "arg_1", ":", "amount", "(", "arg_1", ",", "arg_0", "[", "arg_1", "]", ")", "for", "arg_1", "in", "arg_0", ".", "keys", "(", ")", "}"], "function": "def Func(arg_0):\n    \"\"\"\n    Calculate the Func from the specified compound masses.\n\n    :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5}\n\n    :returns: [kmol] dictionary\n    \"\"\"\n\n    return {arg_1: amount(arg_1, arg_0[arg_1])\n            for arg_1 in arg_0.keys()}", "path": "auxi/tools/chemistry/stoichiometry.py", "identifier": "amounts", "docstring": "Calculate the amounts from the specified compound masses.\n\n    :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5}\n\n    :returns: [kmol] dictionary", "docstring_tokens": ["Calculate", "the", "amounts", "from", "the", "specified", "compound", "masses", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 260881}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L289-L293", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Returns the size of the layer, with the border size already subtracted.", "language": "python", "parameters": "(self)", "return_statement": "return self.widget.size[0]-self.border[0]*2,self.widget.size[1]-self.border[1]*2", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", ".", "widget", ".", "size", "[", "0", "]", "-", "arg_0", ".", "border", "[", "0", "]", "*", "2", ",", "arg_0", ".", "widget", ".", "size", "[", "1", "]", "-", "arg_0", ".", "border", "[", "1", "]", "*", "2"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the size of the layer, with the border size already subtracted.\n        \"\"\"\n        return arg_0.widget.size[0]-arg_0.border[0]*2,arg_0.widget.size[1]-arg_0.border[1]*2", "path": "peng3d/gui/layered.py", "identifier": "WidgetLayer.getSize", "docstring": "Returns the size of the layer, with the border size already subtracted.", "docstring_tokens": ["Returns", "the", "size", "of", "the", "layer", "with", "the", "border", "size", "already", "subtracted", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 260882}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/trello.py#L180-L188", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "Returns an iterator for the comments on a certain card.", "language": "python", "parameters": "(self, card_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'filter'", ":", "'commentCard'", ",", "'memberCreator_fields'", ":", "'username'", "}", "arg_3", "=", "arg_0", ".", "api_request", "(", "\"/1/cards/{card_id}/actions\"", ".", "format", "(", "arg_1", "=", "arg_1", ")", ",", "**", "arg_2", ")", "for", "arg_4", "in", "arg_3", ":", "assert", "arg_4", "[", "'type'", "]", "==", "'commentCard'", "yield", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Returns an iterator for the comments on a certain card. \"\"\"\n        arg_2 = {'filter': 'commentCard', 'memberCreator_fields': 'username'}\n        arg_3 = arg_0.api_request(\n            \"/1/cards/{card_id}/actions\".format(arg_1=arg_1),\n            **arg_2)\n        for arg_4 in arg_3:\n            assert arg_4['type'] == 'commentCard'\n            yield arg_4", "path": "bugwarrior/services/trello.py", "identifier": "TrelloService.get_comments", "docstring": "Returns an iterator for the comments on a certain card.", "docstring_tokens": ["Returns", "an", "iterator", "for", "the", "comments", "on", "a", "certain", "card", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 260883}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1579-L1597", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Compare 2 fields.", "language": "python", "parameters": "(field1, field2, strict=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "arg_2", ":", "return", "arg_0", "[", ":", "4", "]", "==", "arg_1", "[", ":", "4", "]", "else", ":", "if", "arg_0", "[", "1", ":", "4", "]", "!=", "arg_1", "[", "1", ":", "4", "]", ":", "return", "False", "else", ":", "return", "set", "(", "arg_0", "[", "0", "]", ")", "==", "set", "(", "arg_1", "[", "0", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Compare 2 fields.\n\n    If strict is True, then the order of the subfield will be taken care of, if\n    not then the order of the subfields doesn't matter.\n\n    :return: True if the field are equivalent, False otherwise.\n    \"\"\"\n    if arg_2:\n        # Return a simple equal test on the field minus the position.\n        return arg_0[:4] == arg_1[:4]\n    else:\n        if arg_0[1:4] != arg_1[1:4]:\n            # Different indicators or controlfield value.\n            return False\n        else:\n            # Compare subfields in a loose way.\n            return set(arg_0[0]) == set(arg_1[0])", "path": "harvestingkit/bibrecord.py", "identifier": "_compare_fields", "docstring": "Compare 2 fields.\n\n    If strict is True, then the order of the subfield will be taken care of, if\n    not then the order of the subfields doesn't matter.\n\n    :return: True if the field are equivalent, False otherwise.", "docstring_tokens": ["Compare", "2", "fields", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 260884}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L844-L851", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Print out a series of files", "language": "python", "parameters": "(self, source)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "source_expand", "(", "arg_1", ")", "for", "arg_1", "in", "arg_2", ":", "arg_3", "=", "S3URL", "(", "arg_1", ")", "arg_4", "=", "arg_0", ".", "s3", ".", "get_object", "(", "Bucket", "=", "arg_3", ".", "bucket", ",", "Key", "=", "arg_3", ".", "path", ")", "message", "(", "'%s'", ",", "arg_4", "[", "'Body'", "]", ".", "read", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n    '''Print out a series of files'''\n    arg_2 = arg_0.source_expand(arg_1)\n\n    for arg_1 in arg_2:\n      arg_3 = S3URL(arg_1)\n      arg_4 = arg_0.s3.get_object(Bucket=arg_3.bucket, Key=arg_3.path)\n      message('%s', arg_4['Body'].read())", "path": "s4cmd.py", "identifier": "S3Handler.print_files", "docstring": "Print out a series of files", "docstring_tokens": ["Print", "out", "a", "series", "of", "files"], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 260885}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L377-L393", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Retrieves the description for the specified topic.", "language": "python", "parameters": "(self, topic_name)", "return_statement": "return _convert_response_to_topic(response)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "_validate_not_none", "(", "'topic_name'", ",", "arg_1", ")", "arg_2", "=", "HTTPRequest", "(", ")", "arg_2", ".", "method", "=", "'GET'", "arg_2", ".", "host", "=", "arg_0", ".", "_get_host", "(", ")", "arg_2", ".", "path", "=", "'/'", "+", "_str", "(", "arg_1", ")", "+", "''", "arg_2", ".", "path", ",", "arg_2", ".", "query", "=", "arg_0", ".", "_httpclient", ".", "_update_request_uri_query", "(", "arg_2", ")", "arg_2", ".", "headers", "=", "arg_0", ".", "_update_service_bus_header", "(", "arg_2", ")", "arg_8", "=", "arg_0", ".", "_perform_request", "(", "arg_2", ")", "return", "_convert_response_to_topic", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Retrieves the description for the specified topic.\n\n        topic_name:\n            Name of the topic.\n        '''\n        _validate_not_none('topic_name', arg_1)\n        arg_2 = HTTPRequest()\n        arg_2.method = 'GET'\n        arg_2.host = arg_0._get_host()\n        arg_2.path = '/' + _str(arg_1) + ''\n        arg_2.path, arg_2.query = arg_0._httpclient._update_request_uri_query(arg_2)  # pylint: disable=protected-access\n        arg_2.headers = arg_0._update_service_bus_header(arg_2)\n        arg_8 = arg_0._perform_request(arg_2)\n\n        return _convert_response_to_topic(arg_8)", "path": "azure-servicebus/azure/servicebus/control_client/servicebusservice.py", "identifier": "ServiceBusService.get_topic", "docstring": "Retrieves the description for the specified topic.\n\n        topic_name:\n            Name of the topic.", "docstring_tokens": ["Retrieves", "the", "description", "for", "the", "specified", "topic", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260886}
{"url": "https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L2428-L2433", "sha": "2cc91060982cc8b777152e698d677cc2989bf263", "docstring_summary": "Create Win32 struct `MOUSEINPUT` for `SendInput`.\n    Return `INPUT`.", "language": "python", "parameters": "(dx: int, dy: int, mouseData: int = 0, dwFlags: int = MouseEventFlag.LeftDown, time_: int = 0)", "return_statement": "return _CreateInput(MOUSEINPUT(dx, dy, mouseData, dwFlags, time_, None))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_1", ",", "arg_3", ":", "arg_1", "=", "0", ",", "arg_4", ":", "arg_1", "=", "arg_5", ".", "LeftDown", ",", "arg_7", ":", "arg_1", "=", "0", ")", "->", "INPUT", ":", "return", "_CreateInput", "(", "MOUSEINPUT", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_7", ",", "None", ")", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1 = 0, arg_4: arg_1 = arg_5.LeftDown, arg_7: arg_1 = 0) -> INPUT:\n    \"\"\"\n    Create Win32 struct `MOUSEINPUT` for `SendInput`.\n    Return `INPUT`.\n    \"\"\"\n    return _CreateInput(MOUSEINPUT(arg_0, arg_2, arg_3, arg_4, arg_7, None))", "path": "uiautomation/uiautomation.py", "identifier": "MouseInput", "docstring": "Create Win32 struct `MOUSEINPUT` for `SendInput`.\n    Return `INPUT`.", "docstring_tokens": ["Create", "Win32", "struct", "MOUSEINPUT", "for", "SendInput", ".", "Return", "INPUT", "."], "nwo": "yinkaisheng/Python-UIAutomation-for-Windows", "score": 0.9769561204852005, "idx": 260887}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L498-L548", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Checks and converts all settings if necessary passed to the Manager.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "report_progress", ":", "if", "arg_0", ".", "report_progress", "is", "True", ":", "arg_0", ".", "report_progress", "=", "(", "5", ",", "'pypet'", ",", "logging", ".", "INFO", ")", "elif", "isinstance", "(", "arg_0", ".", "report_progress", ",", "(", "int", ",", "float", ")", ")", ":", "arg_0", ".", "report_progress", "=", "(", "arg_0", ".", "report_progress", ",", "'pypet'", ",", "logging", ".", "INFO", ")", "elif", "isinstance", "(", "arg_0", ".", "report_progress", ",", "str", ")", ":", "arg_0", ".", "report_progress", "=", "(", "5", ",", "arg_0", ".", "report_progress", ",", "logging", ".", "INFO", ")", "elif", "len", "(", "arg_0", ".", "report_progress", ")", "==", "2", ":", "arg_0", ".", "report_progress", "=", "(", "arg_0", ".", "report_progress", "[", "0", "]", ",", "arg_0", ".", "report_progress", "[", "1", "]", ",", "logging", ".", "INFO", ")", "if", "arg_0", ".", "log_config", ":", "if", "arg_0", ".", "log_config", "==", "pypetconstants", ".", "DEFAULT_LOGGING", ":", "arg_2", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "'logging'", ")", "arg_0", ".", "log_config", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "'default.ini'", ")", "if", "isinstance", "(", "arg_0", ".", "log_config", ",", "str", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg_0", ".", "log_config", ")", ":", "raise", "ValueError", "(", "'Could not find the logger init file '", "'`%s`.'", "%", "arg_0", ".", "log_config", ")", "arg_5", "=", "NoInterpolationParser", "(", ")", "arg_5", ".", "read", "(", "arg_0", ".", "log_config", ")", "elif", "isinstance", "(", "arg_0", ".", "log_config", ",", "cp", ".", "RawConfigParser", ")", ":", "arg_5", "=", "arg_0", ".", "log_config", "else", ":", "arg_5", "=", "None", "if", "arg_5", "is", "not", "None", ":", "arg_0", ".", "_sp_config", "=", "arg_0", ".", "_parser_to_string_io", "(", "arg_5", ")", "arg_0", ".", "_mp_config", "=", "arg_0", ".", "_find_multiproc_options", "(", "arg_5", ")", "if", "arg_0", ".", "_mp_config", "is", "not", "None", ":", "arg_0", ".", "_mp_config", "=", "arg_0", ".", "_parser_to_string_io", "(", "arg_0", ".", "_mp_config", ")", "elif", "isinstance", "(", "arg_0", ".", "log_config", ",", "dict", ")", ":", "arg_0", ".", "_sp_config", "=", "arg_0", ".", "log_config", "arg_0", ".", "_mp_config", "=", "arg_0", ".", "_find_multiproc_dict", "(", "arg_0", ".", "_sp_config", ")", "if", "arg_0", ".", "log_stdout", ":", "if", "arg_0", ".", "log_stdout", "is", "True", ":", "arg_0", ".", "log_stdout", "=", "(", "'STDOUT'", ",", "logging", ".", "INFO", ")", "if", "isinstance", "(", "arg_0", ".", "log_stdout", ",", "str", ")", ":", "arg_0", ".", "log_stdout", "=", "(", "arg_0", ".", "log_stdout", ",", "logging", ".", "INFO", ")", "if", "isinstance", "(", "arg_0", ".", "log_stdout", ",", "int", ")", ":", "arg_0", ".", "log_stdout", "=", "(", "'STDOUT'", ",", "arg_0", ".", "log_stdout", ")"], "function": "def Func(arg_0):\n        \"\"\" Checks and converts all settings if necessary passed to the Manager.\n\n        Searches for multiprocessing options as well.\n\n        \"\"\"\n        if arg_0.report_progress:\n            if arg_0.report_progress is True:\n                arg_0.report_progress = (5, 'pypet', logging.INFO)\n            elif isinstance(arg_0.report_progress, (int, float)):\n                arg_0.report_progress = (arg_0.report_progress, 'pypet', logging.INFO)\n            elif isinstance(arg_0.report_progress, str):\n                arg_0.report_progress = (5, arg_0.report_progress, logging.INFO)\n            elif len(arg_0.report_progress) == 2:\n                arg_0.report_progress = (arg_0.report_progress[0], arg_0.report_progress[1],\n                                        logging.INFO)\n\n        if arg_0.log_config:\n            if arg_0.log_config == pypetconstants.DEFAULT_LOGGING:\n                arg_2 = os.path.abspath(os.path.dirname(__file__))\n                arg_3 = os.path.join(arg_2, 'logging')\n                arg_0.log_config = os.path.join(arg_3, 'default.ini')\n\n            if isinstance(arg_0.log_config, str):\n                if not os.path.isfile(arg_0.log_config):\n                    raise ValueError('Could not find the logger init file '\n                                     '`%s`.' % arg_0.log_config)\n                arg_5 = NoInterpolationParser()\n                arg_5.read(arg_0.log_config)\n            elif isinstance(arg_0.log_config, cp.RawConfigParser):\n                arg_5 = arg_0.log_config\n            else:\n                arg_5 = None\n\n            if arg_5 is not None:\n                arg_0._sp_config = arg_0._parser_to_string_io(arg_5)\n                arg_0._mp_config = arg_0._find_multiproc_options(arg_5)\n                if arg_0._mp_config is not None:\n                    arg_0._mp_config = arg_0._parser_to_string_io(arg_0._mp_config)\n\n            elif isinstance(arg_0.log_config, dict):\n                arg_0._sp_config = arg_0.log_config\n                arg_0._mp_config = arg_0._find_multiproc_dict(arg_0._sp_config)\n\n        if arg_0.log_stdout:\n            if arg_0.log_stdout is True:\n                arg_0.log_stdout = ('STDOUT', logging.INFO)\n            if isinstance(arg_0.log_stdout, str):\n                arg_0.log_stdout = (arg_0.log_stdout, logging.INFO)\n            if isinstance(arg_0.log_stdout, int):\n                arg_0.log_stdout = ('STDOUT', arg_0.log_stdout)", "path": "pypet/pypetlogging.py", "identifier": "LoggingManager.check_log_config", "docstring": "Checks and converts all settings if necessary passed to the Manager.\n\n        Searches for multiprocessing options as well.", "docstring_tokens": ["Checks", "and", "converts", "all", "settings", "if", "necessary", "passed", "to", "the", "Manager", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 260888}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/ordering.py#L99-L114", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Check the heartbeat of the ordering API", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'%s/Func'", "%", "arg_0", ".", "base_url", "arg_2", "=", "requests", ".", "get", "(", "arg_1", ")", "try", ":", "return", "arg_2", ".", "json", "(", ")", "==", "\"ok\"", "except", ":", "return", "False"], "function": "def Func(arg_0):\n        '''\n        Check the Func of the ordering API\n\n        Args: None\n\n        Returns:  True or False\n        '''\n        arg_1 = '%s/Func' % arg_0.base_url\n        # Auth is not required to hit the Func\n        arg_2 = requests.get(arg_1) \n\n        try:\n            return arg_2.json() == \"ok\"\n        except:\n            return False", "path": "gbdxtools/ordering.py", "identifier": "Ordering.heartbeat", "docstring": "Check the heartbeat of the ordering API\n\n        Args: None\n\n        Returns:  True or False", "docstring_tokens": ["Check", "the", "heartbeat", "of", "the", "ordering", "API"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 260889}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/MirrorImageViz/mirrorImageViz.py#L116-L136", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "The similarity of two patterns in the bit-encoding space is displayed alongside\n  their similarity in the sp-coinc space.", "language": "python", "parameters": "(dataset, matrix, patterns, cells, w, fnum)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "0", "arg_7", "=", "0", "assert", "len", "(", "arg_2", ")", "==", "len", "(", "arg_3", ")", "for", "arg_8", "in", "xrange", "(", "len", "(", "arg_2", ")", "-", "1", ")", ":", "arg_1", "[", "arg_8", "+", "1", ":", ",", "arg_8", "]", "=", "[", "len", "(", "set", "(", "arg_2", "[", "arg_8", "]", ")", ".", "intersection", "(", "set", "(", "q", ")", ")", ")", "*", "100", "/", "arg_4", "for", "q", "in", "arg_2", "[", "arg_8", "+", "1", ":", "]", "]", "arg_1", "[", "arg_8", ",", "arg_8", "+", "1", ":", "]", "=", "[", "len", "(", "set", "(", "arg_3", "[", "arg_8", "]", ")", ".", "intersection", "(", "set", "(", "r", ")", ")", ")", "*", "5", "/", "2", "for", "r", "in", "arg_3", "[", "arg_8", "+", "1", ":", "]", "]", "arg_6", "+=", "sum", "(", "abs", "(", "np", ".", "array", "(", "arg_1", "[", "arg_8", "+", "1", ":", ",", "arg_8", "]", ")", "-", "np", ".", "array", "(", "arg_1", "[", "arg_8", ",", "arg_8", "+", "1", ":", "]", ")", ")", ")", "arg_7", "+=", "len", "(", "arg_1", "[", "arg_8", "+", "1", ":", ",", "arg_8", "]", ")", "print", "'Score'", ",", "arg_6", "/", "arg_7", "arg_9", "=", "pyl", ".", "figure", "(", "figsize", "=", "(", "10", ",", "10", ")", ",", "num", "=", "arg_5", ")", "pyl", ".", "matshow", "(", "arg_1", ",", "fignum", "=", "arg_5", ")", "pyl", ".", "colorbar", "(", ")", "pyl", ".", "title", "(", "'Coincidence Space'", ",", "verticalalignment", "=", "'top'", ",", "fontsize", "=", "12", ")", "pyl", ".", "xlabel", "(", "'The Mirror Image Visualization for '", "+", "arg_0", ",", "fontsize", "=", "17", ")", "pyl", ".", "ylabel", "(", "'Encoding space'", ",", "fontsize", "=", "12", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n  '''The similarity of two patterns in the bit-encoding space is displayed alongside\n  their similarity in the sp-coinc space.'''\n  arg_6=0\n  arg_7 = 0\n  assert len(arg_2)==len(arg_3)\n  for arg_8 in xrange(len(arg_2)-1):\n    arg_1[arg_8+1:,arg_8] = [len(set(arg_2[arg_8]).intersection(set(q)))*100/arg_4 for q in arg_2[arg_8+1:]]\n    arg_1[arg_8,arg_8+1:] = [len(set(arg_3[arg_8]).intersection(set(r)))*5/2 for r in arg_3[arg_8+1:]]\n    \n    arg_6 += sum(abs(np.array(arg_1[arg_8+1:,arg_8])-np.array(arg_1[arg_8,arg_8+1:])))\n    arg_7 += len(arg_1[arg_8+1:,arg_8])\n  \n  print 'Score', arg_6/arg_7\n  \n  arg_9 = pyl.figure(figsize = (10,10), num = arg_5)\n  pyl.matshow(arg_1, fignum = arg_5)\n  pyl.colorbar()\n  pyl.title('Coincidence Space', verticalalignment='top', fontsize=12)\n  pyl.xlabel('The Mirror Image Visualization for '+arg_0, fontsize=17)\n  pyl.ylabel('Encoding space', fontsize=12)", "path": "examples/opf/tools/MirrorImageViz/mirrorImageViz.py", "identifier": "drawFile", "docstring": "The similarity of two patterns in the bit-encoding space is displayed alongside\n  their similarity in the sp-coinc space.", "docstring_tokens": ["The", "similarity", "of", "two", "patterns", "in", "the", "bit", "-", "encoding", "space", "is", "displayed", "alongside", "their", "similarity", "in", "the", "sp", "-", "coinc", "space", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260890}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L207-L218", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Returns the tuple type signature for the output values of the function\n        associated with the selector ``hsh``.", "language": "python", "parameters": "(self, hsh: bytes)", "return_statement": "return '()' if outputs is None else SolidityMetadata.tuple_signature_for_components(outputs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", "->", "str", ":", "if", "not", "isinstance", "(", "arg_1", ",", "(", "arg_2", ",", "bytearray", ")", ")", ":", "raise", "TypeError", "(", "'The selector argument must be a concrete byte array'", ")", "arg_3", "=", "arg_0", ".", "get_abi", "(", "arg_1", ")", "arg_4", "=", "arg_3", ".", "get", "(", "'outputs'", ")", "return", "'()'", "if", "arg_4", "is", "None", "else", "SolidityMetadata", ".", "tuple_signature_for_components", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1: arg_2) -> str:\n        \"\"\"Returns the tuple type signature for the output values of the function\n        associated with the selector ``hsh``.\n\n        If no normal contract function has the specified selector,\n        the empty tuple type signature ``'()'`` is returned.\n        \"\"\"\n        if not isinstance(arg_1, (arg_2, bytearray)):\n            raise TypeError('The selector argument must be a concrete byte array')\n        arg_3 = arg_0.get_abi(arg_1)\n        arg_4 = arg_3.get('outputs')\n        return '()' if arg_4 is None else SolidityMetadata.tuple_signature_for_components(arg_4)", "path": "manticore/ethereum/solidity.py", "identifier": "SolidityMetadata.get_func_return_types", "docstring": "Returns the tuple type signature for the output values of the function\n        associated with the selector ``hsh``.\n\n        If no normal contract function has the specified selector,\n        the empty tuple type signature ``'()'`` is returned.", "docstring_tokens": ["Returns", "the", "tuple", "type", "signature", "for", "the", "output", "values", "of", "the", "function", "associated", "with", "the", "selector", "hsh", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260891}
{"url": "https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/bacon/game.py#L166-L218", "sha": "edf3810dcb211942d392a8637945871399b0650d", "docstring_summary": "Start running the game.  The window is created and shown at this point, and then\n    the main event loop is entered.  'game.on_tick' and other event handlers are called\n    repeatedly until the game exits.", "language": "python", "parameters": "(game)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_1", ".", "_current_game", ":", "arg_1", ".", "_current_game", "=", "arg_0", "return", "global", "arg_10", "arg_1", ".", "_current_game", "=", "arg_0", "arg_3", "=", "lib", ".", "WindowResizeEventHandler", "(", "window", ".", "_window_resize_event_handler", ")", "lib", ".", "SetWindowResizeEventHandler", "(", "arg_3", ")", "arg_4", "=", "lib", ".", "KeyEventHandler", "(", "keyboard", ".", "_key_event_handler", ")", "lib", ".", "SetKeyEventHandler", "(", "arg_4", ")", "arg_5", "=", "lib", ".", "MouseButtonEventHandler", "(", "mouse_input", ".", "_mouse_button_event_handler", ")", "lib", ".", "SetMouseButtonEventHandler", "(", "arg_5", ")", "arg_6", "=", "lib", ".", "MouseScrollEventHandler", "(", "mouse_input", ".", "_mouse_scroll_event_handler", ")", "lib", ".", "SetMouseScrollEventHandler", "(", "arg_6", ")", "arg_7", "=", "lib", ".", "ControllerConnectedEventHandler", "(", "controller", ".", "_controller_connected_event_handler", ")", "lib", ".", "SetControllerConnectedEventHandler", "(", "arg_7", ")", "arg_8", "=", "lib", ".", "ControllerButtonEventHandler", "(", "controller", ".", "_controller_button_event_handler", ")", "lib", ".", "SetControllerButtonEventHandler", "(", "arg_8", ")", "arg_9", "=", "lib", ".", "ControllerAxisEventHandler", "(", "controller", ".", "_controller_axis_event_handler", ")", "lib", ".", "SetControllerAxisEventHandler", "(", "arg_9", ")", "arg_10", "=", "lib", ".", "TickCallback", "(", "_first_tick_callback", ")", "lib", ".", "SetTickCallback", "(", "arg_10", ")", "lib", ".", "Run", "(", ")", "arg_1", ".", "_current_game", "=", "None", "arg_10", "=", "None", "lib", ".", "SetWindowResizeEventHandler", "(", "lib", ".", "WindowResizeEventHandler", "(", "0", ")", ")", "lib", ".", "SetKeyEventHandler", "(", "lib", ".", "KeyEventHandler", "(", "0", ")", ")", "lib", ".", "SetMouseButtonEventHandler", "(", "lib", ".", "MouseButtonEventHandler", "(", "0", ")", ")", "lib", ".", "SetMouseScrollEventHandler", "(", "lib", ".", "MouseScrollEventHandler", "(", "0", ")", ")", "lib", ".", "SetControllerConnectedEventHandler", "(", "lib", ".", "ControllerConnectedEventHandler", "(", "0", ")", ")", "lib", ".", "SetControllerButtonEventHandler", "(", "lib", ".", "ControllerButtonEventHandler", "(", "0", ")", ")", "lib", ".", "SetControllerAxisEventHandler", "(", "lib", ".", "ControllerAxisEventHandler", "(", "0", ")", ")", "lib", ".", "SetTickCallback", "(", "lib", ".", "TickCallback", "(", "0", ")", ")"], "function": "def Func(arg_0):\n    '''Start Funcning the game.  The window is created and shown at this point, and then\n    the main event loop is entered.  'game.on_tick' and other event handlers are called\n    repeatedly until the game exits.\n\n    If a game is already Funcning, this function replaces the :class:`Game` instance that\n    receives events.\n    '''\n    if arg_1._current_game:\n        arg_1._current_game = arg_0\n        return\n\n    global arg_10\n    arg_1._current_game = arg_0\n\n    # Window handler\n    arg_3 = lib.WindowResizeEventHandler(window._window_resize_event_handler)\n    lib.SetWindowResizeEventHandler(arg_3)\n\n    # Key handler\n    arg_4 = lib.KeyEventHandler(keyboard._key_event_handler)\n    lib.SetKeyEventHandler(arg_4)\n\n    # Mouse handlers\n    arg_5 = lib.MouseButtonEventHandler(mouse_input._mouse_button_event_handler)\n    lib.SetMouseButtonEventHandler(arg_5)\n    arg_6 = lib.MouseScrollEventHandler(mouse_input._mouse_scroll_event_handler)\n    lib.SetMouseScrollEventHandler(arg_6)\n\n    # Controller handlers\n    arg_7 = lib.ControllerConnectedEventHandler(controller._controller_connected_event_handler)\n    lib.SetControllerConnectedEventHandler(arg_7)\n    arg_8 = lib.ControllerButtonEventHandler(controller._controller_button_event_handler)\n    lib.SetControllerButtonEventHandler(arg_8)\n    arg_9 = lib.ControllerAxisEventHandler(controller._controller_axis_event_handler)\n    lib.SetControllerAxisEventHandler(arg_9)\n\n    # Tick handler\n    arg_10 = lib.TickCallback(_first_tick_callback)\n    lib.SetTickCallback(arg_10)\n\n    lib.Run()\n    arg_1._current_game = None\n    arg_10 = None\n\n    lib.SetWindowResizeEventHandler(lib.WindowResizeEventHandler(0))\n    lib.SetKeyEventHandler(lib.KeyEventHandler(0))\n    lib.SetMouseButtonEventHandler(lib.MouseButtonEventHandler(0))\n    lib.SetMouseScrollEventHandler(lib.MouseScrollEventHandler(0))\n    lib.SetControllerConnectedEventHandler(lib.ControllerConnectedEventHandler(0))\n    lib.SetControllerButtonEventHandler(lib.ControllerButtonEventHandler(0))\n    lib.SetControllerAxisEventHandler(lib.ControllerAxisEventHandler(0))\n    lib.SetTickCallback(lib.TickCallback(0))", "path": "bacon/game.py", "identifier": "run", "docstring": "Start running the game.  The window is created and shown at this point, and then\n    the main event loop is entered.  'game.on_tick' and other event handlers are called\n    repeatedly until the game exits.\n\n    If a game is already running, this function replaces the :class:`Game` instance that\n    receives events.", "docstring_tokens": ["Start", "running", "the", "game", ".", "The", "window", "is", "created", "and", "shown", "at", "this", "point", "and", "then", "the", "main", "event", "loop", "is", "entered", ".", "game", ".", "on_tick", "and", "other", "event", "handlers", "are", "called", "repeatedly", "until", "the", "game", "exits", "."], "nwo": "aholkner/bacon", "score": 0.19099661306507362, "idx": 260892}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/launchpad.py#L238-L246", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Get messages of an issue", "language": "python", "parameters": "(self, issue_id)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "arg_0", ".", "client", ".", "issue_collection", "(", "arg_1", ",", "\"messages\"", ")", ":", "arg_3", "=", "json", ".", "loads", "(", "arg_2", ")", "for", "arg_4", "in", "arg_3", "[", "'entries'", "]", ":", "arg_4", "[", "'owner_data'", "]", "=", "arg_0", ".", "__fetch_user_data", "(", "'{OWNER}'", ",", "arg_4", "[", "'owner_link'", "]", ")", "yield", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Get messages of an issue\"\"\"\n\n        for arg_2 in arg_0.client.issue_collection(arg_1, \"messages\"):\n            arg_3 = json.loads(arg_2)\n\n            for arg_4 in arg_3['entries']:\n                arg_4['owner_data'] = arg_0.__fetch_user_data('{OWNER}', arg_4['owner_link'])\n                yield arg_4", "path": "perceval/backends/core/launchpad.py", "identifier": "Launchpad.__fetch_issue_messages", "docstring": "Get messages of an issue", "docstring_tokens": ["Get", "messages", "of", "an", "issue"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260893}
{"url": "https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L469-L497", "sha": "c0393c4d51984a506f813319efb66e54c4f2a426", "docstring_summary": "Lossless compression. Save images as PNG and TIFF tags to json. Can be\n    reversed with `decompress`. Will run in multiprocessing, where\n    number of workers is decided by ``leicaexperiment.experiment._pools``.", "language": "python", "parameters": "(images, delete_tif=False, folder=None)", "return_statement": "return Parallel(n_jobs=_pools)(delayed(compress_blocking)\n                     (image=image, delete_tif=delete_tif, folder=folder)\n                     for image in filenames)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "if", "type", "(", "arg_0", ")", "==", "str", ":", "return", "[", "Func_blocking", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "]", "arg_3", "=", "copy", "(", "arg_0", ")", "return", "Parallel", "(", "n_jobs", "=", "_pools", ")", "(", "delayed", "(", "Func_blocking", ")", "(", "arg_4", "=", "arg_4", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "for", "arg_4", "in", "arg_3", ")"], "function": "def Func(arg_0, arg_1=False, arg_2=None):\n    \"\"\"Lossless Funcion. Save images as PNG and TIFF tags to json. Can be\n    reversed with `deFunc`. Will run in multiprocessing, where\n    number of workers is decided by ``leicaexperiment.experiment._pools``.\n\n    Parameters\n    ----------\n    images : list of filenames\n        Images to lossless Func.\n    delete_tif : bool\n        Wheter to delete original images.\n    folder : string\n        Where to store images. Basename will be kept.\n\n    Returns\n    -------\n    list of filenames\n        List of Funced files.\n    \"\"\"\n    if type(arg_0) == str:\n        # only one image\n        return [Func_blocking(arg_0, arg_1, arg_2)]\n\n    arg_3 = copy(arg_0) # as images property will change when looping\n\n\n    return Parallel(n_jobs=_pools)(delayed(Func_blocking)\n                     (arg_4=arg_4, arg_1=arg_1, arg_2=arg_2)\n                     for arg_4 in arg_3)", "path": "leicaexperiment/experiment.py", "identifier": "compress", "docstring": "Lossless compression. Save images as PNG and TIFF tags to json. Can be\n    reversed with `decompress`. Will run in multiprocessing, where\n    number of workers is decided by ``leicaexperiment.experiment._pools``.\n\n    Parameters\n    ----------\n    images : list of filenames\n        Images to lossless compress.\n    delete_tif : bool\n        Wheter to delete original images.\n    folder : string\n        Where to store images. Basename will be kept.\n\n    Returns\n    -------\n    list of filenames\n        List of compressed files.", "docstring_tokens": ["Lossless", "compression", ".", "Save", "images", "as", "PNG", "and", "TIFF", "tags", "to", "json", ".", "Can", "be", "reversed", "with", "decompress", ".", "Will", "run", "in", "multiprocessing", "where", "number", "of", "workers", "is", "decided", "by", "leicaexperiment", ".", "experiment", ".", "_pools", "."], "nwo": "arve0/leicaexperiment", "score": 0.1792979536242127, "idx": 260894}
{"url": "https://github.com/alpacahq/alpaca-trade-api-python/blob/9c9dea3b4a37c909f88391b202e86ff356a8b4d7/alpaca_trade_api/stream2.py#L101-L110", "sha": "9c9dea3b4a37c909f88391b202e86ff356a8b4d7", "docstring_summary": "Run forever and block until exception is rasised.\n        initial_channels is the channels to start with.", "language": "python", "parameters": "(self, initial_channels=[])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "[", "]", ")", ":", "arg_2", "=", "asyncio", ".", "get_event_loop", "(", ")", "try", ":", "arg_2", ".", "Func_until_complete", "(", "arg_0", ".", "subscribe", "(", "arg_1", ")", ")", "arg_2", ".", "Func_forever", "(", ")", "finally", ":", "arg_2", ".", "Func_until_complete", "(", "arg_0", ".", "close", "(", ")", ")"], "function": "def Func(arg_0, arg_1=[]):\n        '''Run forever and block until exception is rasised.\n        initial_channels is the channels to start with.\n        '''\n        arg_2 = asyncio.get_event_loop()\n        try:\n            arg_2.Func_until_complete(arg_0.subscribe(arg_1))\n            arg_2.Func_forever()\n        finally:\n            arg_2.Func_until_complete(arg_0.close())", "path": "alpaca_trade_api/stream2.py", "identifier": "StreamConn.run", "docstring": "Run forever and block until exception is rasised.\n        initial_channels is the channels to start with.", "docstring_tokens": ["Run", "forever", "and", "block", "until", "exception", "is", "rasised", ".", "initial_channels", "is", "the", "channels", "to", "start", "with", "."], "nwo": "alpacahq/alpaca-trade-api-python", "score": 0.9697751514981866, "idx": 260895}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/code_heatmap.py#L190-L213", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Calculates heatmap for module.", "language": "python", "parameters": "(self)", "return_statement": "return {\n            'objectName': self._run_object,\n            'runTime': run_time,\n            'heatmaps': heatmaps\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ".", "_run_object", ",", "'r'", ")", "as", "srcfile", ":", "arg_1", "=", "srcfile", ".", "read", "(", ")", "arg_2", "=", "compile", "(", "arg_1", ",", "arg_0", ".", "_run_object", ",", "'exec'", ")", "try", ":", "with", "_CodeHeatmapCalculator", "(", ")", "as", "prof", ":", "exec", "(", "arg_2", ",", "arg_0", ".", "_globs", ",", "None", ")", "except", "SystemExit", ":", "pass", "arg_3", "=", "[", "]", "for", "arg_4", ",", "arg_5", "in", "prof", ".", "heatmap", ".", "items", "(", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "arg_4", ")", ":", "arg_3", ".", "append", "(", "arg_0", ".", "_format_heatmap", "(", "arg_4", ",", "arg_5", ",", "prof", ".", "execution_count", "[", "arg_4", "]", ")", ")", "arg_6", "=", "sum", "(", "arg_5", "[", "'runTime'", "]", "for", "arg_5", "in", "arg_3", ")", "return", "{", "'objectName'", ":", "arg_0", ".", "_run_object", ",", "'runTime'", ":", "arg_6", ",", "'heatmaps'", ":", "arg_3", "}"], "function": "def Func(arg_0):\n        \"\"\"Calculates heatmap for module.\"\"\"\n        with open(arg_0._run_object, 'r') as srcfile:\n            arg_1 = srcfile.read()\n            arg_2 = compile(arg_1, arg_0._run_object, 'exec')\n        try:\n            with _CodeHeatmapCalculator() as prof:\n                exec(arg_2, arg_0._globs, None)\n        except SystemExit:\n            pass\n\n        arg_3 = []\n        for arg_4, arg_5 in prof.heatmap.items():\n            if os.path.isfile(arg_4):\n                arg_3.append(\n                    arg_0._format_heatmap(\n                        arg_4, arg_5, prof.execution_count[arg_4]))\n\n        arg_6 = sum(arg_5['runTime'] for arg_5 in arg_3)\n        return {\n            'objectName': arg_0._run_object,\n            'runTime': arg_6,\n            'heatmaps': arg_3\n        }", "path": "vprof/code_heatmap.py", "identifier": "CodeHeatmapProfiler._profile_module", "docstring": "Calculates heatmap for module.", "docstring_tokens": ["Calculates", "heatmap", "for", "module", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 260896}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mssql_to_gcs.py#L127-L137", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Queries MSSQL and returns a cursor of results.", "language": "python", "parameters": "(self)", "return_statement": "return cursor", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "MsSqlHook", "(", "mssql_conn_id", "=", "arg_0", ".", "mssql_conn_id", ")", "arg_2", "=", "arg_1", ".", "get_conn", "(", ")", "arg_3", "=", "arg_2", ".", "cursor", "(", ")", "arg_3", ".", "execute", "(", "arg_0", ".", "sql", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"\n        Queries MSSQL and returns a cursor of results.\n\n        :return: mssql cursor\n        \"\"\"\n        arg_1 = MsSqlHook(mssql_conn_id=arg_0.mssql_conn_id)\n        arg_2 = arg_1.get_conn()\n        arg_3 = arg_2.cursor()\n        arg_3.execute(arg_0.sql)\n        return arg_3", "path": "airflow/contrib/operators/mssql_to_gcs.py", "identifier": "MsSqlToGoogleCloudStorageOperator._query_mssql", "docstring": "Queries MSSQL and returns a cursor of results.\n\n        :return: mssql cursor", "docstring_tokens": ["Queries", "MSSQL", "and", "returns", "a", "cursor", "of", "results", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 260897}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/logs.py#L155-L199", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Logs the extracted expiration date.", "language": "python", "parameters": "(self, extracted)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"logs\"", "]", ":", "if", "PyFunceble", ".", "INTERN", "[", "\"referer\"", "]", ":", "arg_2", "=", "PyFunceble", ".", "INTERN", "[", "\"referer\"", "]", "else", ":", "arg_2", "=", "None", "arg_3", "=", "{", "arg_0", ".", "current_time", ":", "{", "\"domain\"", ":", "PyFunceble", ".", "INTERN", "[", "\"to_test\"", "]", ",", "\"Func\"", ":", "arg_1", ",", "\"whois_server\"", ":", "arg_2", ",", "}", "}", "if", "arg_0", ".", "output", ":", "arg_4", "=", "arg_0", ".", "output", "else", ":", "arg_4", "=", "PyFunceble", ".", "OUTPUT_DIRECTORY", "arg_4", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"parent_directory\"", "]", "arg_4", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"logs\"", "]", "[", "\"directories\"", "]", "[", "\"parent\"", "]", "arg_4", "+=", "PyFunceble", ".", "OUTPUTS", "[", "\"logs\"", "]", "[", "\"filenames\"", "]", "[", "\"date_format\"", "]", "arg_5", "=", "arg_0", ".", "_get_content", "(", "arg_4", ")", "arg_5", ".", "update", "(", "arg_3", ")", "arg_0", ".", "_write_content", "(", "arg_5", ",", "arg_4", ")", "if", "PyFunceble", ".", "CONFIGURATION", "[", "\"share_logs\"", "]", ":", "PyFunceble", ".", "requests", ".", "post", "(", "PyFunceble", ".", "LINKS", "[", "\"api_date_format\"", "]", ",", "data", "=", "arg_3", "[", "arg_0", ".", "current_time", "]", ",", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Logs the extracted expiration date.\n\n        :param extracted: The extracted expiration date (from WHOIS record).\n        :type extracted: str\n        \"\"\"\n\n        if PyFunceble.CONFIGURATION[\"logs\"]:\n            # The logs subsystem is activated.\n\n            if PyFunceble.INTERN[\"referer\"]:\n                arg_2 = PyFunceble.INTERN[\"referer\"]\n            else:\n                arg_2 = None\n\n            arg_3 = {\n                arg_0.current_time: {\n                    \"domain\": PyFunceble.INTERN[\"to_test\"],\n                    \"Func\": arg_1,\n                    \"whois_server\": arg_2,\n                }\n            }\n\n            if arg_0.output:\n                arg_4 = arg_0.output\n            else:\n                arg_4 = PyFunceble.OUTPUT_DIRECTORY\n                arg_4 += PyFunceble.OUTPUTS[\"parent_directory\"]\n                arg_4 += PyFunceble.OUTPUTS[\"logs\"][\"directories\"][\"parent\"]\n                arg_4 += PyFunceble.OUTPUTS[\"logs\"][\"filenames\"][\"date_format\"]\n\n            arg_5 = arg_0._get_content(arg_4)\n            arg_5.update(arg_3)\n\n            arg_0._write_content(arg_5, arg_4)\n\n            if PyFunceble.CONFIGURATION[\"share_logs\"]:\n                # The logs sharing is activated.\n\n                # And we share the logs with the api.\n                PyFunceble.requests.post(\n                    PyFunceble.LINKS[\"api_date_format\"],\n                    data=arg_3[arg_0.current_time],\n                )", "path": "PyFunceble/logs.py", "identifier": "Logs.expiration_date", "docstring": "Logs the extracted expiration date.\n\n        :param extracted: The extracted expiration date (from WHOIS record).\n        :type extracted: str", "docstring_tokens": ["Logs", "the", "extracted", "expiration", "date", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 260898}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L286-L296", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Transform Kraus representation to SuperOp representation.", "language": "python", "parameters": "(data, input_dim, output_dim)", "return_statement": "return superop", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", "=", "arg_0", "arg_5", "=", "0", "if", "arg_4", "is", "None", ":", "for", "arg_6", "in", "arg_3", ":", "arg_5", "+=", "np", ".", "kron", "(", "np", ".", "conj", "(", "arg_6", ")", ",", "arg_6", ")", "else", ":", "for", "arg_6", ",", "arg_7", "in", "zip", "(", "arg_3", ",", "arg_4", ")", ":", "arg_5", "+=", "np", ".", "kron", "(", "np", ".", "conj", "(", "arg_7", ")", ",", "arg_6", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Transform Kraus representation to SuperOp representation.\"\"\"\n    arg_3, arg_4 = arg_0\n    arg_5 = 0\n    if arg_4 is None:\n        for arg_6 in arg_3:\n            arg_5 += np.kron(np.conj(arg_6), arg_6)\n    else:\n        for arg_6, arg_7 in zip(arg_3, arg_4):\n            arg_5 += np.kron(np.conj(arg_7), arg_6)\n    return arg_5", "path": "qiskit/quantum_info/operators/channel/transformations.py", "identifier": "_kraus_to_superop", "docstring": "Transform Kraus representation to SuperOp representation.", "docstring_tokens": ["Transform", "Kraus", "representation", "to", "SuperOp", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260899}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/tasks.py#L409-L428", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Makes a multi fasta file of random sequences, all the same length", "language": "python", "parameters": "(contigs, length, outfile, name_by_letters=False, prefix='', seed=None, first_number=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "''", ",", "arg_5", "=", "None", ",", "arg_6", "=", "1", ")", ":", "random", ".", "seed", "(", "a", "=", "arg_5", ")", "arg_7", "=", "utils", ".", "open_file_write", "(", "arg_2", ")", "arg_8", "=", "list", "(", "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'", ")", "arg_9", "=", "0", "for", "arg_10", "in", "range", "(", "arg_0", ")", ":", "if", "arg_3", ":", "arg_11", "=", "arg_8", "[", "arg_9", "]", "arg_9", "+=", "1", "if", "arg_9", "==", "len", "(", "arg_8", ")", ":", "arg_9", "=", "0", "else", ":", "arg_11", "=", "str", "(", "arg_10", "+", "arg_6", ")", "arg_12", "=", "sequences", ".", "Fasta", "(", "arg_4", "+", "arg_11", ",", "''", ".", "join", "(", "[", "random", ".", "choice", "(", "'ACGT'", ")", "for", "x", "in", "range", "(", "arg_1", ")", "]", ")", ")", "print", "(", "arg_12", ",", "file", "=", "arg_7", ")", "utils", ".", "close", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4='', arg_5=None, arg_6=1):\n    '''Makes a multi fasta file of random sequences, all the same length'''\n    random.seed(a=arg_5)\n    arg_7 = utils.open_file_write(arg_2)\n    arg_8 = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')\n    arg_9 = 0\n\n    for arg_10 in range(arg_0):\n        if arg_3:\n            arg_11 = arg_8[arg_9]\n            arg_9 += 1\n            if arg_9 == len(arg_8):\n                arg_9 = 0\n        else:\n            arg_11 = str(arg_10 + arg_6)\n\n        arg_12 = sequences.Fasta(arg_4 + arg_11, ''.join([random.choice('ACGT') for x in range(arg_1)]))\n        print(arg_12, file=arg_7)\n\n    utils.close(arg_7)", "path": "pyfastaq/tasks.py", "identifier": "make_random_contigs", "docstring": "Makes a multi fasta file of random sequences, all the same length", "docstring_tokens": ["Makes", "a", "multi", "fasta", "file", "of", "random", "sequences", "all", "the", "same", "length"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 260900}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/floating_ips.py#L435-L459", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Retrieve a floating IP.", "language": "python", "parameters": "(context, id, fields=None)", "return_statement": "return v._make_floating_ip_dict(floating_ip)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "LOG", ".", "info", "(", "'Func %s for tenant %s'", "%", "(", "arg_1", ",", "arg_0", ".", "tenant_id", ")", ")", "arg_3", "=", "{", "'address_type'", ":", "ip_types", ".", "FLOATING", ",", "'_deallocated'", ":", "False", "}", "arg_4", "=", "db_api", ".", "floating_ip_find", "(", "arg_0", ",", "arg_1", "=", "arg_1", ",", "scope", "=", "db_api", ".", "ONE", ",", "**", "arg_3", ")", "if", "not", "arg_4", ":", "raise", "q_exc", ".", "FloatingIpNotFound", "(", "arg_1", "=", "arg_1", ")", "return", "v", ".", "_make_floating_ip_dict", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Retrieve a floating IP.\n\n    :param context: neutron api request context.\n    :param id: The UUID of the floating IP.\n    :param fields: a list of strings that are valid keys in a\n        floating IP dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n\n    :returns: Dictionary containing details for the floating IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.\n    \"\"\"\n    LOG.info('Func %s for tenant %s' % (arg_1, arg_0.tenant_id))\n\n    arg_3 = {'address_type': ip_types.FLOATING, '_deallocated': False}\n\n    arg_4 = db_api.floating_ip_find(arg_0, arg_1=arg_1, scope=db_api.ONE,\n                                          **arg_3)\n\n    if not arg_4:\n        raise q_exc.FloatingIpNotFound(arg_1=arg_1)\n\n    return v._make_floating_ip_dict(arg_4)", "path": "quark/plugin_modules/floating_ips.py", "identifier": "get_floatingip", "docstring": "Retrieve a floating IP.\n\n    :param context: neutron api request context.\n    :param id: The UUID of the floating IP.\n    :param fields: a list of strings that are valid keys in a\n        floating IP dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n\n    :returns: Dictionary containing details for the floating IP.  If values\n        are declared in the fields parameter, then only those keys will be\n        present.", "docstring_tokens": ["Retrieve", "a", "floating", "IP", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 260901}
{"url": "https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fir_design_helper.py#L353-L371", "sha": "5c1353412a4d81a8d7da169057564ecf940f8b5b", "docstring_summary": "Design an FIR bandpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_stop1 Hz, f_pass1 Hz, f_pass2 Hz, f_stop2 Hz, and the \r\n    desired passband ripple d_pass dB and stopband attenuation\r\n    d_stop dB all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "language": "python", "parameters": "(f_stop1, f_pass1, f_pass2, f_stop2, d_pass, d_stop, \r\n                  fs = 1.0, N_bump=5)", "return_statement": "return b", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "1.0", ",", "arg_7", "=", "5", ")", ":", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "bandpass_order", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "fsamp", "=", "arg_6", ")", "arg_12", "=", "arg_8", "arg_12", "+=", "arg_7", "arg_13", "=", "signal", ".", "remez", "(", "arg_12", ",", "arg_9", ",", "arg_10", "[", "0", ":", ":", "2", "]", ",", "arg_11", ",", "Hz", "=", "2", ")", "print", "(", "'Remez filter taps = %d.'", "%", "arg_12", ")", "return", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, \r\n                  arg_6 = 1.0, arg_7=5):\r\n    \"\"\"\r\n    Design an FIR bandpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_stop1 Hz, f_pass1 Hz, f_pass2 Hz, f_stop2 Hz, and the \r\n    desired passband ripple d_pass dB and stopband attenuation\r\n    d_stop dB all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018\r\n    \"\"\"\r\n    arg_8, arg_9, arg_10, arg_11 = bandpass_order(arg_0, arg_1, arg_2, arg_3, \r\n                                  arg_4, arg_5, fsamp=arg_6)\r\n    # Bump up the order by N_bump to bring down the final d_pass & d_stop\r\n    arg_12 = arg_8\r\n    arg_12 += arg_7\r\n    arg_13 = signal.remez(arg_12, arg_9, arg_10[0::2], arg_11,Hz=2)\r\n    print('Remez filter taps = %d.' % arg_12)\r\n    return arg_13", "path": "sk_dsp_comm/fir_design_helper.py", "identifier": "fir_remez_bpf", "docstring": "Design an FIR bandpass filter using remez with order\r\n    determination. The filter order is determined based on \r\n    f_stop1 Hz, f_pass1 Hz, f_pass2 Hz, f_stop2 Hz, and the \r\n    desired passband ripple d_pass dB and stopband attenuation\r\n    d_stop dB all relative to a sampling rate of fs Hz.\r\n\r\n    Mark Wickert October 2016, updated October 2018", "docstring_tokens": ["Design", "an", "FIR", "bandpass", "filter", "using", "remez", "with", "order", "determination", ".", "The", "filter", "order", "is", "determined", "based", "on", "f_stop1", "Hz", "f_pass1", "Hz", "f_pass2", "Hz", "f_stop2", "Hz", "and", "the", "desired", "passband", "ripple", "d_pass", "dB", "and", "stopband", "attenuation", "d_stop", "dB", "all", "relative", "to", "a", "sampling", "rate", "of", "fs", "Hz", ".", "Mark", "Wickert", "October", "2016", "updated", "October", "2018"], "nwo": "mwickert/scikit-dsp-comm", "score": 0.5374053095443461, "idx": 260902}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.py#L315-L325", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Shows a save dialog for the ImageResource with 'name'.", "language": "python", "parameters": "(self, name, format='PNG')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'PNG'", ")", ":", "arg_3", "=", "QtGui", ".", "QFileDialog", "(", "arg_0", ".", "_control", ",", "'Save Image'", ")", "arg_3", ".", "setAcceptMode", "(", "QtGui", ".", "QFileDialog", ".", "AcceptSave", ")", "arg_3", ".", "setDefaultSuffix", "(", "arg_2", ".", "lower", "(", ")", ")", "arg_3", ".", "setNameFilter", "(", "'%s file (*.%s)'", "%", "(", "arg_2", ",", "arg_2", ".", "lower", "(", ")", ")", ")", "if", "arg_3", ".", "exec_", "(", ")", ":", "arg_4", "=", "arg_3", ".", "selectedFiles", "(", ")", "[", "0", "]", "arg_5", "=", "arg_0", ".", "_get_image", "(", "arg_1", ")", "arg_5", ".", "save", "(", "arg_4", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2='PNG'):\n        \"\"\" Shows a save dialog for the ImageResource with 'name'.\n        \"\"\"\n        arg_3 = QtGui.QFileDialog(arg_0._control, 'Save Image')\n        arg_3.setAcceptMode(QtGui.QFileDialog.AcceptSave)\n        arg_3.setDefaultSuffix(arg_2.lower())\n        arg_3.setNameFilter('%s file (*.%s)' % (arg_2, arg_2.lower()))\n        if arg_3.exec_():\n            arg_4 = arg_3.selectedFiles()[0]\n            arg_5 = arg_0._get_image(arg_1)\n            arg_5.save(arg_4, arg_2)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.py", "identifier": "RichIPythonWidget._save_image", "docstring": "Shows a save dialog for the ImageResource with 'name'.", "docstring_tokens": ["Shows", "a", "save", "dialog", "for", "the", "ImageResource", "with", "name", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260903}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/run.py#L2530-L2540", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Clear the output directory.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "print", "(", "\"Wiping output directory.\"", ")", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "g_output_dir", ")", ":", "shutil", ".", "rmtree", "(", "str", "(", "g_output_dir", ")", ")", "except", "OSError", "as", "e", ":", "print", "(", "\"ERROR: Removing output directory %s failed: \"", "%", "g_output_dir", ")", "print", "(", "\"       (errno {0}): {1}\"", ".", "format", "(", "e", ".", "errno", ",", "e", ".", "strerror", ")", ")", "print", "(", "\"\"", ")", "sys", ".", "exit", "(", "1", ")"], "function": "def Func():\n    \"\"\"Clear the output directory.\"\"\"\n    print(\"Wiping output directory.\")\n    try:\n        if os.path.exists(g_output_dir):\n            shutil.rmtree(str(g_output_dir))\n    except OSError as e:\n        print(\"ERROR: Removing output directory %s failed: \" % g_output_dir)\n        print(\"       (errno {0}): {1}\".format(e.errno, e.strerror))\n        print(\"\")\n        sys.exit(1)", "path": "scripts/run.py", "identifier": "wipe_output_dir", "docstring": "Clear the output directory.", "docstring_tokens": ["Clear", "the", "output", "directory", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 260904}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/lennard_jones.py#L1149-L1190", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''This function calculates the parameter `Tstar` as needed in performing\n    collision integral calculations.", "language": "python", "parameters": "(T, epsilon_k=None, epsilon=None)", "return_statement": "return _Tstar", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", ":", "arg_3", "=", "arg_0", "/", "(", "arg_1", ")", "elif", "arg_2", ":", "arg_3", "=", "k", "*", "arg_0", "/", "arg_2", "else", ":", "raise", "Exception", "(", "'Either epsilon/k or epsilon must be provided'", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    r'''This function calculates the parameter `Func` as needed in performing\n    collision integral calculations.\n\n    .. math::\n        T^* = \\frac{kT}{\\epsilon}\n\n    Examples\n    --------\n    >>> Func(T=318.2, epsilon_k=308.43)\n    1.0316765554582887\n\n    Parameters\n    ----------\n    epsilon_k : float, optional\n        Lennard-Jones depth of potential-energy minimum over k, [K]\n    epsilon : float, optional\n        Lennard-Jones depth of potential-energy minimum [J]\n\n    Returns\n    -------\n    Func : float\n        Dimentionless temperature for calculating collision integral, [-]\n\n    Notes\n    -----\n    Tabulated values are normally listed as epsilon/k. k is the Boltzman\n    constant, with units of J/K.\n\n    References\n    ----------\n    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.\n       Transport Phenomena, Revised 2nd Edition. New York:\n       John Wiley & Sons, Inc., 2006\n    '''\n    if arg_1:\n        arg_3 = arg_0/(arg_1)\n    elif arg_2:\n        arg_3 = k*arg_0/arg_2\n    else:\n        raise Exception('Either epsilon/k or epsilon must be provided')\n    return arg_3", "path": "thermo/lennard_jones.py", "identifier": "Tstar", "docstring": "r'''This function calculates the parameter `Tstar` as needed in performing\n    collision integral calculations.\n\n    .. math::\n        T^* = \\frac{kT}{\\epsilon}\n\n    Examples\n    --------\n    >>> Tstar(T=318.2, epsilon_k=308.43)\n    1.0316765554582887\n\n    Parameters\n    ----------\n    epsilon_k : float, optional\n        Lennard-Jones depth of potential-energy minimum over k, [K]\n    epsilon : float, optional\n        Lennard-Jones depth of potential-energy minimum [J]\n\n    Returns\n    -------\n    Tstar : float\n        Dimentionless temperature for calculating collision integral, [-]\n\n    Notes\n    -----\n    Tabulated values are normally listed as epsilon/k. k is the Boltzman\n    constant, with units of J/K.\n\n    References\n    ----------\n    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.\n       Transport Phenomena, Revised 2nd Edition. New York:\n       John Wiley & Sons, Inc., 2006", "docstring_tokens": ["r", "This", "function", "calculates", "the", "parameter", "Tstar", "as", "needed", "in", "performing", "collision", "integral", "calculations", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 260905}
{"url": "https://github.com/westurner/pgs/blob/1cc2bf2c41479d8d3ba50480f003183f1675e518/pgs/app.py#L386-L410", "sha": "1cc2bf2c41479d8d3ba50480f003183f1675e518", "docstring_summary": "Generate directory listing HTML", "language": "python", "parameters": "(FS, filepath)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "yield", "'<table class=\"dirlist\">'", "if", "arg_1", "==", "'/'", ":", "arg_1", "=", "''", "for", "arg_2", "in", "arg_0", ".", "listdir", "(", "arg_1", ")", ":", "arg_3", "=", "pathjoin", "(", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "isdir", "(", "arg_3", ")", ":", "arg_3", "=", "arg_3", "+", "'/'", "yield", "u'<tr><td><a href=\"{0}\">{0}</a></td></tr>'", ".", "format", "(", "cgi", ".", "escape", "(", "arg_3", ")", ")", "yield", "'</table>'"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Generate directory listing HTML\n\n    Arguments:\n        FS (FS): filesystem object to read files from\n        filepath (str): path to generate directory listings for\n\n    Keyword Arguments:\n        list_dir (callable: list[str]): list file names in a directory\n        isdir (callable: bool): os.path.isdir\n\n    Yields:\n        str: lines of an HTML table\n    \"\"\"\n    yield '<table class=\"dirlist\">'\n    if arg_1 == '/':\n        arg_1 = ''\n    for arg_2 in arg_0.listdir(arg_1):\n        arg_3 = pathjoin(arg_1, arg_2)\n        if arg_0.isdir(arg_3):\n            arg_3 = arg_3 + '/'\n        yield u'<tr><td><a href=\"{0}\">{0}</a></td></tr>'.format(\n            cgi.escape(arg_3))  # TODO XXX\n    yield '</table>'", "path": "pgs/app.py", "identifier": "generate_dirlist_html", "docstring": "Generate directory listing HTML\n\n    Arguments:\n        FS (FS): filesystem object to read files from\n        filepath (str): path to generate directory listings for\n\n    Keyword Arguments:\n        list_dir (callable: list[str]): list file names in a directory\n        isdir (callable: bool): os.path.isdir\n\n    Yields:\n        str: lines of an HTML table", "docstring_tokens": ["Generate", "directory", "listing", "HTML"], "nwo": "westurner/pgs", "score": 0.23137166388621372, "idx": 260906}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L1113-L1131", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Increment the GTFS-definition of \"day start\".", "language": "python", "parameters": "(self, day_start_ut, n_days=1)", "return_statement": "return dayN", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "arg_0", ".", "set_current_process_time_zone", "(", ")", "arg_4", "=", "time", ".", "localtime", "(", "arg_1", "+", "43200", ")", "arg_5", "=", "time", ".", "mktime", "(", "arg_4", "[", ":", "2", "]", "+", "(", "arg_4", "[", "2", "]", "+", "arg_2", ",", ")", "+", "(", "12", ",", "00", ",", "0", ",", "0", ",", "0", ",", "-", "1", ")", ")", "-", "43200", "set_process_timezone", "(", "arg_3", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=1):\n        \"\"\"Increment the GTFS-definition of \"day start\".\n\n        Parameters\n        ----------\n        day_start_ut : int\n            unixtime of the previous start of day.  If this time is between\n            12:00 or greater, there *will* be bugs.  To solve this, run the\n            input through day_start_ut first.\n        n_days: int\n            number of days to increment\n        \"\"\"\n        arg_3 = arg_0.set_current_process_time_zone()\n        arg_4 = time.localtime(arg_1 + 43200)  # time of noon\n        arg_5 = time.mktime(arg_4[:2] +  # YYYY, MM\n                           (arg_4[2] + arg_2,) +  # DD\n                           (12, 00, 0, 0, 0, -1)) - 43200  # HHMM, etc.  Minus 12 hours.\n        set_process_timezone(arg_3)\n        return arg_5", "path": "gtfspy/gtfs.py", "identifier": "GTFS.increment_day_start_ut", "docstring": "Increment the GTFS-definition of \"day start\".\n\n        Parameters\n        ----------\n        day_start_ut : int\n            unixtime of the previous start of day.  If this time is between\n            12:00 or greater, there *will* be bugs.  To solve this, run the\n            input through day_start_ut first.\n        n_days: int\n            number of days to increment", "docstring_tokens": ["Increment", "the", "GTFS", "-", "definition", "of", "day", "start", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 260907}
{"url": "https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L1884-L1960", "sha": "f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0", "docstring_summary": "Iteratively set branch lengths and reconstruct ancestral sequences until\n        the values of either former or latter do not change. The algorithm assumes\n        knowing only the topology of the tree, and requires that sequences are assigned\n        to all leaves of the tree.", "language": "python", "parameters": "(self,reuse_branch_len=True, prune_short=True,\n                                    marginal_sequences=False, branch_length_mode='joint',\n                                    max_iter=5, infer_gtr=False, **kwargs)", "return_statement": "return ttconf.SUCCESS", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "True", ",", "arg_3", "=", "False", ",", "arg_4", "=", "'joint'", ",", "arg_5", "=", "5", ",", "arg_6", "=", "False", ",", "**", "arg_7", ")", ":", "if", "arg_4", "==", "'marginal'", ":", "arg_3", "=", "True", "arg_0", ".", "logger", "(", "\"TreeAnc.optimize_sequences_and_branch_length: sequences...\"", ",", "1", ")", "if", "arg_1", ":", "arg_8", "=", "arg_0", ".", "reconstruct_anc", "(", "method", "=", "'probabilistic'", ",", "arg_6", "=", "arg_6", ",", "marginal", "=", "arg_3", ",", "**", "arg_7", ")", "arg_0", ".", "optimize_branch_len", "(", "verbose", "=", "0", ",", "store_old", "=", "False", ",", "mode", "=", "arg_4", ")", "else", ":", "arg_8", "=", "arg_0", ".", "reconstruct_anc", "(", "method", "=", "'fitch'", ",", "arg_6", "=", "arg_6", ",", "**", "arg_7", ")", "arg_0", ".", "optimize_branch_len", "(", "verbose", "=", "0", ",", "store_old", "=", "False", ",", "marginal", "=", "False", ")", "arg_9", "=", "0", "while", "arg_9", "<", "arg_5", ":", "arg_9", "+=", "1", "if", "arg_2", ":", "arg_0", ".", "prune_short_branches", "(", ")", "arg_8", "=", "arg_0", ".", "reconstruct_anc", "(", "method", "=", "'probabilistic'", ",", "arg_6", "=", "False", ",", "marginal", "=", "arg_3", ",", "**", "arg_7", ")", "arg_0", ".", "logger", "(", "\"TreeAnc.optimize_sequences_and_branch_length: Iteration %d.\"", "\" #Nuc changed since prev reconstructions: %d\"", "%", "(", "arg_9", ",", "arg_8", ")", ",", "2", ")", "if", "arg_8", "<", "1", ":", "break", "arg_0", ".", "optimize_branch_len", "(", "verbose", "=", "0", ",", "store_old", "=", "False", ",", "mode", "=", "arg_4", ")", "arg_0", ".", "tree", ".", "unconstrained_sequence_LH", "=", "(", "arg_0", ".", "tree", ".", "sequence_LH", "*", "arg_0", ".", "multiplicity", ")", ".", "sum", "(", ")", "arg_0", ".", "_prepare_nodes", "(", ")", "arg_0", ".", "logger", "(", "\"TreeAnc.optimize_sequences_and_branch_length: Unconstrained sequence LH:%f\"", "%", "arg_0", ".", "tree", ".", "unconstrained_sequence_LH", ",", "2", ")", "return", "ttconf", ".", "SUCCESS"], "function": "def Func(arg_0,arg_1=True, arg_2=True,\n                                    arg_3=False, arg_4='joint',\n                                    arg_5=5, arg_6=False, **arg_7):\n        \"\"\"\n        Iteratively set branch lengths and reconstruct ancestral sequences until\n        the values of either former or latter do not change. The algorithm assumes\n        knowing only the topology of the tree, and requires that sequences are assigned\n        to all leaves of the tree.\n\n        The first step is to pre-reconstruct ancestral\n        states using Fitch reconstruction algorithm or ML using existing branch length\n        estimates. Then, optimize branch lengths and re-do reconstruction until\n        convergence using ML method.\n\n        Parameters\n        -----------\n\n         reuse_branch_len : bool\n            If True, rely on the initial branch lengths, and start with the\n            maximum-likelihood ancestral sequence inference using existing branch\n            lengths. Otherwise, do initial reconstruction of ancestral states with\n            Fitch algorithm, which uses only the tree topology.\n\n         prune_short : bool\n            If True, the branches with zero optimal length will be pruned from\n            the tree, creating polytomies. The polytomies could be further\n            processed using :py:meth:`treetime.TreeTime.resolve_polytomies` from the TreeTime class.\n\n         marginal_sequences : bool\n            Assign sequences to their marginally most likely value, rather than\n            the values that are jointly most likely across all nodes.\n\n         branch_length_mode : str\n            'joint', 'marginal', or 'input'. Branch lengths are left unchanged in case\n            of 'input'. 'joint' and 'marginal' cause branch length optimization\n            while setting sequences to the ML value or tracing over all possible\n            internal sequence states.\n\n         max_iter : int\n            Maximal number of times sequence and branch length iteration are optimized\n\n         infer_gtr : bool\n            Infer a GTR model from the observed substitutions.\n\n        \"\"\"\n        if arg_4=='marginal':\n            arg_3 = True\n\n        arg_0.logger(\"TreeAnc.optimize_sequences_and_branch_length: sequences...\", 1)\n        if arg_1:\n            arg_8 = arg_0.reconstruct_anc(method='probabilistic', arg_6=arg_6,\n                                          marginal=arg_3, **arg_7)\n            arg_0.optimize_branch_len(verbose=0, store_old=False, mode=arg_4)\n        else:\n            arg_8 = arg_0.reconstruct_anc(method='fitch', arg_6=arg_6, **arg_7)\n\n            arg_0.optimize_branch_len(verbose=0, store_old=False, marginal=False)\n\n        arg_9 = 0\n        while arg_9<arg_5:\n            arg_9 += 1\n            if arg_2:\n                arg_0.prune_short_branches()\n            arg_8 = arg_0.reconstruct_anc(method='probabilistic', arg_6=False,\n                                          marginal=arg_3, **arg_7)\n\n            arg_0.logger(\"TreeAnc.optimize_sequences_and_branch_length: Iteration %d.\"\n                   \" #Nuc changed since prev reconstructions: %d\" %(arg_9, arg_8), 2)\n\n            if arg_8 < 1:\n                break\n            arg_0.optimize_branch_len(verbose=0, store_old=False, mode=arg_4)\n\n        arg_0.tree.unconstrained_sequence_LH = (arg_0.tree.sequence_LH*arg_0.multiplicity).sum()\n        arg_0._prepare_nodes() # fix dist2root and up-links after reconstruction\n        arg_0.logger(\"TreeAnc.optimize_sequences_and_branch_length: Unconstrained sequence LH:%f\" % arg_0.tree.unconstrained_sequence_LH , 2)\n        return ttconf.SUCCESS", "path": "treetime/treeanc.py", "identifier": "TreeAnc.optimize_seq_and_branch_len", "docstring": "Iteratively set branch lengths and reconstruct ancestral sequences until\n        the values of either former or latter do not change. The algorithm assumes\n        knowing only the topology of the tree, and requires that sequences are assigned\n        to all leaves of the tree.\n\n        The first step is to pre-reconstruct ancestral\n        states using Fitch reconstruction algorithm or ML using existing branch length\n        estimates. Then, optimize branch lengths and re-do reconstruction until\n        convergence using ML method.\n\n        Parameters\n        -----------\n\n         reuse_branch_len : bool\n            If True, rely on the initial branch lengths, and start with the\n            maximum-likelihood ancestral sequence inference using existing branch\n            lengths. Otherwise, do initial reconstruction of ancestral states with\n            Fitch algorithm, which uses only the tree topology.\n\n         prune_short : bool\n            If True, the branches with zero optimal length will be pruned from\n            the tree, creating polytomies. The polytomies could be further\n            processed using :py:meth:`treetime.TreeTime.resolve_polytomies` from the TreeTime class.\n\n         marginal_sequences : bool\n            Assign sequences to their marginally most likely value, rather than\n            the values that are jointly most likely across all nodes.\n\n         branch_length_mode : str\n            'joint', 'marginal', or 'input'. Branch lengths are left unchanged in case\n            of 'input'. 'joint' and 'marginal' cause branch length optimization\n            while setting sequences to the ML value or tracing over all possible\n            internal sequence states.\n\n         max_iter : int\n            Maximal number of times sequence and branch length iteration are optimized\n\n         infer_gtr : bool\n            Infer a GTR model from the observed substitutions.", "docstring_tokens": ["Iteratively", "set", "branch", "lengths", "and", "reconstruct", "ancestral", "sequences", "until", "the", "values", "of", "either", "former", "or", "latter", "do", "not", "change", ".", "The", "algorithm", "assumes", "knowing", "only", "the", "topology", "of", "the", "tree", "and", "requires", "that", "sequences", "are", "assigned", "to", "all", "leaves", "of", "the", "tree", "."], "nwo": "neherlab/treetime", "score": 0.4526300592895646, "idx": 260908}
{"url": "https://github.com/sanger-pathogens/Fastaq/blob/2c775c846d2491678a9637daa320592e02c26c72/pyfastaq/tasks.py#L446-L466", "sha": "2c775c846d2491678a9637daa320592e02c26c72", "docstring_summary": "Takes a multi fasta or fastq file and writes a new file that contains just one sequence, with the original sequences catted together, preserving their order", "language": "python", "parameters": "(infile, outfile, seqname='union')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'union'", ")", ":", "arg_3", "=", "sequences", ".", "file_reader", "(", "arg_0", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "arg_4", ".", "append", "(", "copy", ".", "copy", "(", "arg_5", ")", ")", "arg_6", "=", "''", ".", "join", "(", "[", "arg_5", ".", "seq", "for", "arg_5", "in", "arg_4", "]", ")", "if", "type", "(", "arg_4", "[", "0", "]", ")", "==", "sequences", ".", "Fastq", ":", "arg_7", "=", "''", ".", "join", "(", "[", "arg_5", ".", "qual", "for", "arg_5", "in", "arg_4", "]", ")", "arg_4", "[", ":", "]", "=", "[", "]", "arg_8", "=", "sequences", ".", "Fastq", "(", "arg_2", ",", "arg_6", ",", "arg_7", ")", "else", ":", "arg_8", "=", "sequences", ".", "Fasta", "(", "arg_2", ",", "arg_6", ")", "arg_4", "[", ":", "]", "=", "[", "]", "arg_9", "=", "utils", ".", "open_file_write", "(", "arg_1", ")", "print", "(", "arg_8", ",", "file", "=", "arg_9", ")", "utils", ".", "close", "(", "arg_9", ")"], "function": "def Func(arg_0, arg_1, arg_2='union'):\n    '''Takes a multi fasta or fastq file and writes a new file that contains just one sequence, with the original sequences catted together, preserving their order'''\n    arg_3 = sequences.file_reader(arg_0)\n    arg_4 = []\n\n    for arg_5 in arg_3:\n        arg_4.append(copy.copy(arg_5))\n\n    arg_6 = ''.join([arg_5.seq for arg_5 in arg_4])\n\n    if type(arg_4[0]) == sequences.Fastq:\n        arg_7 = ''.join([arg_5.qual for arg_5 in arg_4])\n        arg_4[:] = []\n        arg_8 = sequences.Fastq(arg_2, arg_6, arg_7)\n    else:\n        arg_8 = sequences.Fasta(arg_2, arg_6)\n        arg_4[:] = []\n\n    arg_9 = utils.open_file_write(arg_1)\n    print(arg_8, file=arg_9)\n    utils.close(arg_9)", "path": "pyfastaq/tasks.py", "identifier": "merge_to_one_seq", "docstring": "Takes a multi fasta or fastq file and writes a new file that contains just one sequence, with the original sequences catted together, preserving their order", "docstring_tokens": ["Takes", "a", "multi", "fasta", "or", "fastq", "file", "and", "writes", "a", "new", "file", "that", "contains", "just", "one", "sequence", "with", "the", "original", "sequences", "catted", "together", "preserving", "their", "order"], "nwo": "sanger-pathogens/Fastaq", "score": 0.32789511927012926, "idx": 260909}
{"url": "https://github.com/wagtail/django-modelcluster/blob/bfc8bd755af0ddd49e2aee2f2ca126921573d38b/modelcluster/contrib/taggit.py#L17-L24", "sha": "bfc8bd755af0ddd49e2aee2f2ca126921573d38b", "docstring_summary": "Return the manager that handles the relation from this instance to the tagged_item class.\n        If content_object on the tagged_item class is defined as a ParentalKey, this will be a\n        DeferringRelatedManager which allows writing related objects without committing them\n        to the database.", "language": "python", "parameters": "(self)", "return_statement": "return getattr(self.instance, rel_name)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "through", ".", "_meta", ".", "get_field", "(", "'content_object'", ")", ".", "remote_field", ".", "get_accessor_name", "(", ")", "return", "getattr", "(", "arg_0", ".", "instance", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Return the manager that handles the relation from this instance to the tagged_item class.\n        If content_object on the tagged_item class is defined as a ParentalKey, this will be a\n        DeferringRelatedManager which allows writing related objects without committing them\n        to the database.\n        \"\"\"\n        arg_1 = arg_0.through._meta.get_field('content_object').remote_field.get_accessor_name()\n        return getattr(arg_0.instance, arg_1)", "path": "modelcluster/contrib/taggit.py", "identifier": "_ClusterTaggableManager.get_tagged_item_manager", "docstring": "Return the manager that handles the relation from this instance to the tagged_item class.\n        If content_object on the tagged_item class is defined as a ParentalKey, this will be a\n        DeferringRelatedManager which allows writing related objects without committing them\n        to the database.", "docstring_tokens": ["Return", "the", "manager", "that", "handles", "the", "relation", "from", "this", "instance", "to", "the", "tagged_item", "class", ".", "If", "content_object", "on", "the", "tagged_item", "class", "is", "defined", "as", "a", "ParentalKey", "this", "will", "be", "a", "DeferringRelatedManager", "which", "allows", "writing", "related", "objects", "without", "committing", "them", "to", "the", "database", "."], "nwo": "wagtail/django-modelcluster", "score": 0.7143155230295085, "idx": 260910}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/deposit.py#L41-L51", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Default serializer for json.", "language": "python", "parameters": "(o)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "(", "(", "datetime", ".", "date", ",", "datetime", ".", "time", ")", ",", "lambda", "x", ":", "x", ".", "isoformat", "(", ")", ",", ")", ",", "(", "(", "datetime", ".", "datetime", ",", ")", ",", "lambda", "x", ":", "dt2utc_timestamp", "(", "x", ")", ",", ")", ",", ")", "for", "arg_2", ",", "arg_3", "in", "arg_1", ":", "if", "isinstance", "(", "arg_0", ",", "arg_2", ")", ":", "return", "arg_3", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Default serializer for json.\"\"\"\n    arg_1 = (\n        ((datetime.date, datetime.time),\n         lambda x: x.isoformat(), ),\n        ((datetime.datetime, ),\n         lambda x: dt2utc_timestamp(x), ),\n    )\n    for arg_2, arg_3 in arg_1:\n        if isinstance(arg_0, arg_2):\n            return arg_3(arg_0)", "path": "invenio_migrator/legacy/deposit.py", "identifier": "default_serializer", "docstring": "Default serializer for json.", "docstring_tokens": ["Default", "serializer", "for", "json", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 260911}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/difflib.py#L295-L319", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Set the first sequence to be compared.", "language": "python", "parameters": "(self, a)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "arg_0", ".", "a", ":", "return", "arg_0", ".", "a", "=", "arg_1", "arg_0", ".", "matching_blocks", "=", "arg_0", ".", "opcodes", "=", "None"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Set the first sequence to be compared.\n\n        The second sequence to be compared is not changed.\n\n        >>> s = SequenceMatcher(None, \"abcd\", \"bcde\")\n        >>> s.ratio()\n        0.75\n        >>> s.Func(\"bcde\")\n        >>> s.ratio()\n        1.0\n        >>>\n\n        SequenceMatcher computes and caches detailed information about the\n        second sequence, so if you want to compare one sequence S against\n        many sequences, use .set_seq2(S) once and call .Func(x)\n        repeatedly for each of the other sequences.\n\n        See also set_seqs() and set_seq2().\n        \"\"\"\n\n        if arg_1 is arg_0.a:\n            return\n        arg_0.a = arg_1\n        arg_0.matching_blocks = arg_0.opcodes = None", "path": "third_party/stdlib/difflib.py", "identifier": "SequenceMatcher.set_seq1", "docstring": "Set the first sequence to be compared.\n\n        The second sequence to be compared is not changed.\n\n        >>> s = SequenceMatcher(None, \"abcd\", \"bcde\")\n        >>> s.ratio()\n        0.75\n        >>> s.set_seq1(\"bcde\")\n        >>> s.ratio()\n        1.0\n        >>>\n\n        SequenceMatcher computes and caches detailed information about the\n        second sequence, so if you want to compare one sequence S against\n        many sequences, use .set_seq2(S) once and call .set_seq1(x)\n        repeatedly for each of the other sequences.\n\n        See also set_seqs() and set_seq2().", "docstring_tokens": ["Set", "the", "first", "sequence", "to", "be", "compared", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 260912}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/interactive/iplot_histogram.py#L53-L141", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Create a histogram representation.", "language": "python", "parameters": "(data, figsize=None, number_to_keep=None,\n                    sort='asc', legend=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'asc'", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "Template", "(", "\"\"\"    <p>        <div id=\"histogram_$divNumber\"></div>    </p>    \"\"\"", ")", "arg_6", "=", "Template", "(", "\"\"\"    <script>        requirejs.config({            paths: {                qVisualization: \"https://qvisualization.mybluemix.net/q-visualizations\"            }        });        require([\"qVisualization\"], function(qVisualizations) {            qVisualizations.plotState(\"histogram_$divNumber\",                                      \"histogram\",                                      $executions,                                      $options);        });    </script>    \"\"\"", ")", "arg_7", "=", "str", "(", "time", ".", "time", "(", ")", ")", "arg_7", "=", "re", ".", "sub", "(", "'[.]'", ",", "''", ",", "arg_7", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "(", "7", ",", "5", ")", "arg_8", "=", "{", "'number_to_keep'", ":", "0", "if", "arg_2", "is", "None", "else", "arg_2", ",", "'sort'", ":", "arg_3", ",", "'show_legend'", ":", "0", ",", "'width'", ":", "int", "(", "arg_1", "[", "0", "]", ")", ",", "'height'", ":", "int", "(", "arg_1", "[", "1", "]", ")", "}", "if", "arg_4", ":", "arg_8", "[", "'show_legend'", "]", "=", "1", "arg_9", "=", "[", "]", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "arg_0", "=", "[", "arg_0", "]", "if", "arg_4", "and", "len", "(", "arg_4", ")", "!=", "len", "(", "arg_0", ")", ":", "raise", "VisualizationError", "(", "\"Length of legendL (%s) doesn't match number \"", "\"of input executions: %s\"", "%", "(", "len", "(", "arg_4", ")", ",", "len", "(", "arg_0", ")", ")", ")", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_0", ")", ":", "arg_12", "=", "process_data", "(", "arg_11", ",", "arg_8", "[", "'number_to_keep'", "]", ")", "arg_13", "=", "{", "'data'", ":", "arg_12", "}", "if", "arg_4", ":", "arg_13", "[", "'name'", "]", "=", "arg_4", "[", "arg_10", "]", "arg_9", ".", "append", "(", "arg_13", ")", "arg_14", "=", "arg_5", ".", "substitute", "(", "{", "'divNumber'", ":", "arg_7", "}", ")", "arg_15", "=", "arg_6", ".", "substitute", "(", "{", "'divNumber'", ":", "arg_7", ",", "'executions'", ":", "arg_9", ",", "'options'", ":", "arg_8", "}", ")", "display", "(", "HTML", "(", "arg_14", "+", "arg_15", ")", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None,\n                    arg_3='asc', arg_4=None):\n    \"\"\" Create a histogram representation.\n\n        Graphical representation of the input array using a vertical bars\n        style graph.\n\n        Args:\n            data (list or dict):  This is either a list of dicts or a single\n                dict containing the values to represent (ex. {'001' : 130})\n            figsize (tuple): Figure size in pixels.\n            number_to_keep (int): The number of terms to plot and\n                rest is made into a single bar called other values\n            sort (string): Could be 'asc' or 'desc'\n            legend (list): A list of strings to use for labels of the data.\n                The number of entries must match the length of data.\n        Raises:\n            VisualizationError: When legend is provided and the length doesn't\n                match the input data.\n    \"\"\"\n\n    # HTML\n    arg_5 = Template(\"\"\"\n    <p>\n        <div id=\"histogram_$divNumber\"></div>\n    </p>\n    \"\"\")\n\n    # JavaScript\n    arg_6 = Template(\"\"\"\n    <script>\n        requirejs.config({\n            paths: {\n                qVisualization: \"https://qvisualization.mybluemix.net/q-visualizations\"\n            }\n        });\n\n        require([\"qVisualization\"], function(qVisualizations) {\n            qVisualizations.plotState(\"histogram_$divNumber\",\n                                      \"histogram\",\n                                      $executions,\n                                      $options);\n        });\n    </script>\n    \"\"\")\n\n    # Process data and execute\n    arg_7 = str(time.time())\n    arg_7 = re.sub('[.]', '', arg_7)\n\n    # set default figure size if none provided\n    if arg_1 is None:\n        arg_1 = (7, 5)\n\n    arg_8 = {'number_to_keep': 0 if arg_2 is None else arg_2,\n               'sort': arg_3,\n               'show_legend': 0,\n               'width': int(arg_1[0]),\n               'height': int(arg_1[1])}\n    if arg_4:\n        arg_8['show_legend'] = 1\n\n    arg_9 = []\n    if isinstance(arg_0, dict):\n        arg_0 = [arg_0]\n\n    if arg_4 and len(arg_4) != len(arg_0):\n        raise VisualizationError(\"Length of legendL (%s) doesn't match number \"\n                                 \"of input executions: %s\" %\n                                 (len(arg_4), len(arg_0)))\n\n    for arg_10, arg_11 in enumerate(arg_0):\n        arg_12 = process_data(arg_11, arg_8['number_to_keep'])\n        arg_13 = {'data': arg_12}\n        if arg_4:\n            arg_13['name'] = arg_4[arg_10]\n        arg_9.append(arg_13)\n\n    arg_14 = arg_5.substitute({\n        'divNumber': arg_7\n    })\n\n    arg_15 = arg_6.substitute({\n        'divNumber': arg_7,\n        'executions': arg_9,\n        'options': arg_8\n    })\n\n    display(HTML(arg_14 + arg_15))", "path": "qiskit/visualization/interactive/iplot_histogram.py", "identifier": "iplot_histogram", "docstring": "Create a histogram representation.\n\n        Graphical representation of the input array using a vertical bars\n        style graph.\n\n        Args:\n            data (list or dict):  This is either a list of dicts or a single\n                dict containing the values to represent (ex. {'001' : 130})\n            figsize (tuple): Figure size in pixels.\n            number_to_keep (int): The number of terms to plot and\n                rest is made into a single bar called other values\n            sort (string): Could be 'asc' or 'desc'\n            legend (list): A list of strings to use for labels of the data.\n                The number of entries must match the length of data.\n        Raises:\n            VisualizationError: When legend is provided and the length doesn't\n                match the input data.", "docstring_tokens": ["Create", "a", "histogram", "representation", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260913}
{"url": "https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L668-L698", "sha": "50a86eefdc549c48f65a91a5c0a66099010ee65d", "docstring_summary": "Apply record predicates on `r`.", "language": "python", "parameters": "(self, i, r,\n                                 summarize=False,\n                                 report_unexpected_exceptions=True,\n                                 context=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "True", ",", "arg_5", "=", "None", ")", ":", "for", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", "in", "arg_0", ".", "_record_predicates", ":", "if", "arg_1", "%", "arg_9", "==", "0", ":", "arg_10", "=", "arg_0", ".", "_as_dict", "(", "arg_2", ")", "try", ":", "arg_11", "=", "arg_6", "(", "arg_10", ")", "if", "not", "arg_11", ":", "arg_12", "=", "{", "'code'", ":", "arg_7", "}", "if", "not", "arg_3", ":", "arg_12", "[", "'message'", "]", "=", "arg_8", "arg_12", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_12", "[", "'record'", "]", "=", "arg_2", "if", "arg_5", "is", "not", "None", ":", "arg_12", "[", "'context'", "]", "=", "arg_5", "yield", "arg_12", "except", "Exception", "as", "e", ":", "if", "arg_4", ":", "arg_12", "=", "{", "'code'", ":", "UNEXPECTED_EXCEPTION", "}", "if", "not", "arg_3", ":", "arg_12", "[", "'message'", "]", "=", "MESSAGES", "[", "UNEXPECTED_EXCEPTION", "]", "%", "(", "e", ".", "__class__", ".", "__name__", ",", "e", ")", "arg_12", "[", "'row'", "]", "=", "arg_1", "+", "1", "arg_12", "[", "'record'", "]", "=", "arg_2", "arg_12", "[", "'exception'", "]", "=", "e", "arg_12", "[", "'function'", "]", "=", "'%s: %s'", "%", "(", "arg_6", ".", "__name__", ",", "arg_6", ".", "__doc__", ")", "if", "arg_5", "is", "not", "None", ":", "arg_12", "[", "'context'", "]", "=", "arg_5", "yield", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2,\n                                 arg_3=False,\n                                 arg_4=True,\n                                 arg_5=None):\n        \"\"\"Apply record predicates on `r`.\"\"\"\n\n        for arg_6, arg_7, arg_8, arg_9 in arg_0._record_predicates:\n            if arg_1 % arg_9 == 0: # support sampling\n                arg_10 = arg_0._as_dict(arg_2)\n                try:\n                    arg_11 = arg_6(arg_10)\n                    if not arg_11:\n                        arg_12 = {'code': arg_7}\n                        if not arg_3:\n                            arg_12['message'] = arg_8\n                            arg_12['row'] = arg_1 + 1\n                            arg_12['record'] = arg_2\n                            if arg_5 is not None: arg_12['context'] = arg_5\n                        yield arg_12\n                except Exception as e:\n                    if arg_4:\n                        arg_12 = {'code': UNEXPECTED_EXCEPTION}\n                        if not arg_3:\n                            arg_12['message'] = MESSAGES[UNEXPECTED_EXCEPTION] % (e.__class__.__name__, e)\n                            arg_12['row'] = arg_1 + 1\n                            arg_12['record'] = arg_2\n                            arg_12['exception'] = e\n                            arg_12['function'] = '%s: %s' % (arg_6.__name__,\n                                                        arg_6.__doc__)\n                            if arg_5 is not None: arg_12['context'] = arg_5\n                        yield arg_12", "path": "csvvalidator.py", "identifier": "CSVValidator._apply_record_predicates", "docstring": "Apply record predicates on `r`.", "docstring_tokens": ["Apply", "record", "predicates", "on", "r", "."], "nwo": "alimanfoo/csvvalidator", "score": 0.319949264885634, "idx": 260914}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-keyvault/azure/keyvault/http_challenge.py#L70-L77", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Returns the URI for the authorization server if present, otherwise empty string.", "language": "python", "parameters": "(self)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "for", "arg_2", "in", "[", "'authorization_uri'", ",", "'authorization'", "]", ":", "arg_1", "=", "arg_0", ".", "get_value", "(", "arg_2", ")", "or", "''", "if", "arg_1", ":", "break", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\" Returns the URI for the authorization server if present, otherwise empty string. \"\"\"\n        arg_1 = ''\n        for arg_2 in ['authorization_uri', 'authorization']:\n            arg_1 = arg_0.get_value(arg_2) or ''\n            if arg_1:\n                break\n        return arg_1", "path": "azure-keyvault/azure/keyvault/http_challenge.py", "identifier": "HttpChallenge.get_authorization_server", "docstring": "Returns the URI for the authorization server if present, otherwise empty string.", "docstring_tokens": ["Returns", "the", "URI", "for", "the", "authorization", "server", "if", "present", "otherwise", "empty", "string", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 260915}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/eval.py#L281-L297", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Based on the config and the dataset, get the file name to store the\n    results.", "language": "python", "parameters": "(boundaries_id, labels_id, config,\n                          annotator_id)", "return_statement": "return file_name + msaf.config.results_ext", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "utils", ".", "ensure_dir", "(", "msaf", ".", "config", ".", "results_dir", ")", "arg_4", "=", "os", ".", "path", ".", "join", "(", "msaf", ".", "config", ".", "results_dir", ",", "\"results\"", ")", "arg_4", "+=", "\"_boundsE%s_labelsE%s\"", "%", "(", "arg_0", ",", "arg_1", ")", "arg_4", "+=", "\"_annotatorE%d\"", "%", "(", "arg_3", ")", "arg_5", "=", "sorted", "(", "arg_2", ".", "keys", "(", ")", ",", "arg_6", "=", "str", ".", "lower", ")", "for", "arg_6", "in", "arg_5", ":", "arg_4", "+=", "\"_%sE%s\"", "%", "(", "arg_6", ",", "str", "(", "arg_2", "[", "arg_6", "]", ")", ".", "replace", "(", "\"/\"", ",", "\"_\"", ")", ")", "if", "len", "(", "arg_4", ")", ">", "255", "-", "len", "(", "msaf", ".", "config", ".", "results_ext", ")", ":", "arg_4", "=", "arg_4", "[", ":", "255", "-", "len", "(", "msaf", ".", "config", ".", "results_ext", ")", "]", "return", "arg_4", "+", "msaf", ".", "config", ".", "results_ext"], "function": "def Func(arg_0, arg_1, arg_2,\n                          arg_3):\n    \"\"\"Based on the config and the dataset, get the file name to store the\n    results.\"\"\"\n    utils.ensure_dir(msaf.config.results_dir)\n    arg_4 = os.path.join(msaf.config.results_dir, \"results\")\n    arg_4 += \"_boundsE%s_labelsE%s\" % (arg_0, arg_1)\n    arg_4 += \"_annotatorE%d\" % (arg_3)\n    arg_5 = sorted(arg_2.keys(), arg_6=str.lower)\n    for arg_6 in arg_5:\n        arg_4 += \"_%sE%s\" % (arg_6, str(arg_2[arg_6]).replace(\"/\", \"_\"))\n\n    # Check for max file length\n    if len(arg_4) > 255 - len(msaf.config.results_ext):\n        arg_4 = arg_4[:255 - len(msaf.config.results_ext)]\n\n    return arg_4 + msaf.config.results_ext", "path": "msaf/eval.py", "identifier": "get_results_file_name", "docstring": "Based on the config and the dataset, get the file name to store the\n    results.", "docstring_tokens": ["Based", "on", "the", "config", "and", "the", "dataset", "get", "the", "file", "name", "to", "store", "the", "results", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 260916}
{"url": "https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/docs/sphinxext/numpydoc/comment_eater.py#L131-L140", "sha": "ccd418cf647ac03a54f78ba5e3725903f541b808", "docstring_summary": "Find the comment block just before the given line number.", "language": "python", "parameters": "(self, lineno, default=None)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "not", "arg_0", ".", "index", ":", "arg_0", ".", "make_index", "(", ")", "arg_3", "=", "arg_0", ".", "index", ".", "get", "(", "arg_1", ",", "None", ")", "arg_4", "=", "getattr", "(", "arg_3", ",", "'text'", ",", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\" Find the comment block just before the given line number.\n\n        Returns None (or the specified default) if there is no such block.\n        \"\"\"\n        if not arg_0.index:\n            arg_0.make_index()\n        arg_3 = arg_0.index.get(arg_1, None)\n        arg_4 = getattr(arg_3, 'text', arg_2)\n        return arg_4", "path": "docs/sphinxext/numpydoc/comment_eater.py", "identifier": "CommentBlocker.search_for_comment", "docstring": "Find the comment block just before the given line number.\n\n        Returns None (or the specified default) if there is no such block.", "docstring_tokens": ["Find", "the", "comment", "block", "just", "before", "the", "given", "line", "number", "."], "nwo": "djordon/queueing-tool", "score": 0.6494662142870608, "idx": 260917}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L1781-L1829", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Validate a JAMS object against the schema.", "language": "python", "parameters": "(self, strict=True)", "return_statement": "return valid", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_2", "=", "True", "try", ":", "jsonschema", ".", "Func", "(", "arg_0", ".", "__json_light__", ",", "schema", ".", "JAMS_SCHEMA", ")", "for", "arg_3", "in", "arg_0", ".", "annotations", ":", "if", "isinstance", "(", "arg_3", ",", "Annotation", ")", ":", "arg_2", "&=", "arg_3", ".", "Func", "(", "arg_1", "=", "arg_1", ")", "else", ":", "arg_4", "=", "'{} is not a well-formed JAMS Annotation'", ".", "format", "(", "arg_3", ")", "arg_2", "=", "False", "if", "arg_1", ":", "raise", "SchemaError", "(", "arg_4", ")", "else", ":", "warnings", ".", "warn", "(", "str", "(", "arg_4", ")", ")", "except", "jsonschema", ".", "ValidationError", "as", "invalid", ":", "if", "arg_1", ":", "raise", "SchemaError", "(", "str", "(", "invalid", ")", ")", "else", ":", "warnings", ".", "warn", "(", "str", "(", "invalid", ")", ")", "arg_2", "=", "False", "return", "arg_2"], "function": "def Func(arg_0, arg_1=True):\n        '''Validate a JAMS object against the schema.\n\n        Parameters\n        ----------\n        strict : bool\n            If `True`, an exception will be raised on validation failure.\n            If `False`, a warning will be raised on validation failure.\n\n        Returns\n        -------\n        valid : bool\n            `True` if the object passes schema validation.\n            `False` otherwise.\n\n        Raises\n        ------\n        SchemaError\n            If `strict==True` and the JAMS object does not match the schema\n\n        See Also\n        --------\n        jsonschema.Func\n\n        '''\n        arg_2 = True\n        try:\n            jsonschema.Func(arg_0.__json_light__, schema.JAMS_SCHEMA)\n\n            for arg_3 in arg_0.annotations:\n                if isinstance(arg_3, Annotation):\n                    arg_2 &= arg_3.Func(arg_1=arg_1)\n                else:\n                    arg_4 = '{} is not a well-formed JAMS Annotation'.format(arg_3)\n                    arg_2 = False\n                    if arg_1:\n                        raise SchemaError(arg_4)\n                    else:\n                        warnings.warn(str(arg_4))\n\n        except jsonschema.ValidationError as invalid:\n            if arg_1:\n                raise SchemaError(str(invalid))\n            else:\n                warnings.warn(str(invalid))\n\n            arg_2 = False\n\n        return arg_2", "path": "jams/core.py", "identifier": "JAMS.validate", "docstring": "Validate a JAMS object against the schema.\n\n        Parameters\n        ----------\n        strict : bool\n            If `True`, an exception will be raised on validation failure.\n            If `False`, a warning will be raised on validation failure.\n\n        Returns\n        -------\n        valid : bool\n            `True` if the object passes schema validation.\n            `False` otherwise.\n\n        Raises\n        ------\n        SchemaError\n            If `strict==True` and the JAMS object does not match the schema\n\n        See Also\n        --------\n        jsonschema.validate", "docstring_tokens": ["Validate", "a", "JAMS", "object", "against", "the", "schema", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 260918}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/vector_diffeomixture.py#L899-L933", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Creates weighted `LinOp` from existing `LinOp`.", "language": "python", "parameters": "(w, op)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "tf", ".", "name_scope", "(", "\"Func\"", ")", ":", "def", "scaled_identity", "(", "arg_0", ")", ":", "return", "tf", ".", "linalg", ".", "LinearOperatorScaledIdentity", "(", "num_rows", "=", "arg_1", ".", "range_dimension_tensor", "(", ")", ",", "multiplier", "=", "arg_0", ",", "is_non_singular", "=", "arg_1", ".", "is_non_singular", ",", "is_self_adjoint", "=", "arg_1", ".", "is_self_adjoint", ",", "is_positive_definite", "=", "arg_1", ".", "is_positive_definite", ")", "if", "isinstance", "(", "arg_1", ",", "tf", ".", "linalg", ".", "LinearOperatorIdentity", ")", ":", "return", "scaled_identity", "(", "arg_0", ")", "if", "isinstance", "(", "arg_1", ",", "tf", ".", "linalg", ".", "LinearOperatorScaledIdentity", ")", ":", "return", "scaled_identity", "(", "arg_0", "*", "arg_1", ".", "multiplier", ")", "if", "isinstance", "(", "arg_1", ",", "tf", ".", "linalg", ".", "LinearOperatorDiag", ")", ":", "return", "tf", ".", "linalg", ".", "LinearOperatorDiag", "(", "diag", "=", "arg_0", "[", "...", ",", "tf", ".", "newaxis", "]", "*", "arg_1", ".", "diag_part", "(", ")", ",", "is_non_singular", "=", "arg_1", ".", "is_non_singular", ",", "is_self_adjoint", "=", "arg_1", ".", "is_self_adjoint", ",", "is_positive_definite", "=", "arg_1", ".", "is_positive_definite", ")", "if", "isinstance", "(", "arg_1", ",", "tf", ".", "linalg", ".", "LinearOperatorLowerTriangular", ")", ":", "return", "tf", ".", "linalg", ".", "LinearOperatorLowerTriangular", "(", "tril", "=", "arg_0", "[", "...", ",", "tf", ".", "newaxis", ",", "tf", ".", "newaxis", "]", "*", "arg_1", ".", "to_dense", "(", ")", ",", "is_non_singular", "=", "arg_1", ".", "is_non_singular", ",", "is_self_adjoint", "=", "arg_1", ".", "is_self_adjoint", ",", "is_positive_definite", "=", "arg_1", ".", "is_positive_definite", ")", "raise", "NotImplementedError", "(", "\"Unsupported Linop type ({})\"", ".", "format", "(", "type", "(", "arg_1", ")", ".", "__name__", ")", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Creates weighted `LinOp` from existing `LinOp`.\"\"\"\n  # We assume w > 0. (This assumption only relates to the is_* attributes.)\n  with tf.name_scope(\"Func\"):\n    # TODO(b/35301104): LinearOperatorComposition doesn't combine operators, so\n    # special case combinations here. Once it does, this function can be\n    # replaced by:\n    #     return linop_composition_lib.LinearOperatorComposition([\n    #         scaled_identity(w), op])\n    def scaled_identity(arg_0):\n      return tf.linalg.LinearOperatorScaledIdentity(\n          num_rows=arg_1.range_dimension_tensor(),\n          multiplier=arg_0,\n          is_non_singular=arg_1.is_non_singular,\n          is_self_adjoint=arg_1.is_self_adjoint,\n          is_positive_definite=arg_1.is_positive_definite)\n\n    if isinstance(arg_1, tf.linalg.LinearOperatorIdentity):\n      return scaled_identity(arg_0)\n    if isinstance(arg_1, tf.linalg.LinearOperatorScaledIdentity):\n      return scaled_identity(arg_0 * arg_1.multiplier)\n    if isinstance(arg_1, tf.linalg.LinearOperatorDiag):\n      return tf.linalg.LinearOperatorDiag(\n          diag=arg_0[..., tf.newaxis] * arg_1.diag_part(),\n          is_non_singular=arg_1.is_non_singular,\n          is_self_adjoint=arg_1.is_self_adjoint,\n          is_positive_definite=arg_1.is_positive_definite)\n    if isinstance(arg_1, tf.linalg.LinearOperatorLowerTriangular):\n      return tf.linalg.LinearOperatorLowerTriangular(\n          tril=arg_0[..., tf.newaxis, tf.newaxis] * arg_1.to_dense(),\n          is_non_singular=arg_1.is_non_singular,\n          is_self_adjoint=arg_1.is_self_adjoint,\n          is_positive_definite=arg_1.is_positive_definite)\n    raise NotImplementedError(\n        \"Unsupported Linop type ({})\".format(type(arg_1).__name__))", "path": "tensorflow_probability/python/distributions/vector_diffeomixture.py", "identifier": "linop_scale", "docstring": "Creates weighted `LinOp` from existing `LinOp`.", "docstring_tokens": ["Creates", "weighted", "LinOp", "from", "existing", "LinOp", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260919}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L488-L510", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return True if `line` is a dict entry that uses `key`.", "language": "python", "parameters": "(line, key)", "return_statement": "return candidate_key == key", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'#'", "in", "arg_0", ":", "return", "False", "arg_2", "=", "re", ".", "match", "(", "r'\\s*(.*)\\s*:\\s*(.*),\\s*$'", ",", "arg_0", ")", "if", "not", "arg_2", ":", "return", "False", "try", ":", "arg_3", "=", "ast", ".", "literal_eval", "(", "arg_2", ".", "group", "(", "1", ")", ")", "except", "(", "SyntaxError", ",", "ValueError", ")", ":", "return", "False", "if", "multiline_statement", "(", "arg_2", ".", "group", "(", "2", ")", ")", ":", "return", "False", "return", "arg_3", "==", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return True if `line` is a dict entry that uses `key`.\n\n    Return False for multiline cases where the line should not be removed by\n    itself.\n\n    \"\"\"\n    if '#' in arg_0:\n        return False\n\n    arg_2 = re.match(r'\\s*(.*)\\s*:\\s*(.*),\\s*$', arg_0)\n    if not arg_2:\n        return False\n\n    try:\n        arg_3 = ast.literal_eval(arg_2.group(1))\n    except (SyntaxError, ValueError):\n        return False\n\n    if multiline_statement(arg_2.group(2)):\n        return False\n\n    return arg_3 == arg_1", "path": "autoflake.py", "identifier": "dict_entry_has_key", "docstring": "Return True if `line` is a dict entry that uses `key`.\n\n    Return False for multiline cases where the line should not be removed by\n    itself.", "docstring_tokens": ["Return", "True", "if", "line", "is", "a", "dict", "entry", "that", "uses", "key", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 260920}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1338-L1410", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Write pipeline attributes to json", "language": "python", "parameters": "(self)", "return_statement": "return self._render_config(\"pipeline_graph.html\", {\"data\": dict_viz})", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "\"name\"", ":", "\"root\"", ",", "\"children\"", ":", "[", "]", "}", "arg_2", "=", "{", "}", "arg_3", "=", "arg_0", ".", "_fork_tree", "if", "arg_0", ".", "_fork_tree", "else", "{", "1", ":", "[", "1", "]", "}", "for", "arg_4", ",", "(", "arg_5", ",", "arg_6", ")", "in", "enumerate", "(", "arg_3", ".", "items", "(", ")", ")", ":", "for", "arg_7", "in", "arg_0", ".", "processes", "[", "1", ":", "]", ":", "if", "arg_4", "==", "0", "and", "arg_7", ".", "lane", "not", "in", "[", "arg_5", "]", "+", "arg_6", ":", "continue", "if", "arg_4", ">", "0", "and", "arg_7", ".", "lane", "not", "in", "arg_6", ":", "continue", "if", "not", "arg_7", ".", "parent_lane", ":", "arg_8", "=", "arg_1", "[", "\"children\"", "]", "else", ":", "arg_8", "=", "arg_2", "[", "arg_7", ".", "parent_lane", "]", "arg_9", "=", "{", "\"name\"", ":", "\"{}_{}\"", ".", "format", "(", "arg_7", ".", "template", ",", "arg_7", ".", "pid", ")", ",", "\"process\"", ":", "{", "\"pid\"", ":", "arg_7", ".", "pid", ",", "\"input\"", ":", "arg_7", ".", "input_type", ",", "\"output\"", ":", "arg_7", ".", "output_type", "if", "arg_7", ".", "output_type", "else", "\"None\"", ",", "\"lane\"", ":", "arg_7", ".", "lane", ",", "}", ",", "\"children\"", ":", "[", "]", "}", "arg_10", "=", "\"\"", "for", "arg_11", ",", "arg_12", "in", "arg_7", ".", "directives", ".", "items", "(", ")", ":", "arg_10", "+=", "arg_11", "for", "arg_13", "in", "arg_12", ":", "try", ":", "arg_14", "=", "arg_12", "[", "arg_13", "]", ".", "replace", "(", "\"'\"", ",", "\"\"", ")", ".", "replace", "(", "'\"'", ",", "''", ")", "if", "isinstance", "(", "arg_12", "[", "arg_13", "]", ",", "str", ")", "else", "arg_12", "[", "arg_13", "]", "arg_10", "+=", "\"{}: {}\"", ".", "format", "(", "arg_13", ",", "arg_14", ")", "except", "KeyError", ":", "pass", "if", "arg_10", ":", "arg_9", "[", "\"process\"", "]", "[", "\"directives\"", "]", "=", "arg_10", "else", ":", "arg_9", "[", "\"process\"", "]", "[", "\"directives\"", "]", "=", "\"N/A\"", "arg_8", ".", "append", "(", "arg_9", ")", "arg_2", "[", "arg_7", ".", "lane", "]", "=", "arg_8", "[", "-", "1", "]", "[", "\"children\"", "]", "arg_0", ".", "dag_to_file", "(", "arg_1", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "dirname", "(", "arg_0", ".", "nf_file", ")", ",", "\".forkTree.json\"", ")", ",", "\"w\"", ")", "as", "fh", ":", "fh", ".", "write", "(", "json", ".", "dumps", "(", "arg_0", ".", "_fork_tree", ")", ")", "return", "arg_0", ".", "_render_config", "(", "\"pipeline_graph.html\"", ",", "{", "\"data\"", ":", "arg_1", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"Write pipeline attributes to json\n\n        This function writes the pipeline and their attributes to a json file,\n        that is intended to be read by resources/pipeline_graph.html to render\n        a graphical output showing the DAG.\n\n        \"\"\"\n\n        arg_1 = {\n            \"name\": \"root\",\n            \"children\": []\n        }\n        arg_2 = {}\n\n        arg_3 = arg_0._fork_tree if arg_0._fork_tree else {1: [1]}\n\n        for arg_4, (arg_5, arg_6) in enumerate(arg_3.items()):\n            for arg_7 in arg_0.processes[1:]:\n\n                if arg_4 == 0 and arg_7.lane not in [arg_5] + arg_6:\n                    continue\n\n                if arg_4 > 0 and arg_7.lane not in arg_6:\n                    continue\n\n                if not arg_7.parent_lane:\n                    arg_8 = arg_1[\"children\"]\n                else:\n                    arg_8 = arg_2[arg_7.parent_lane]\n\n                arg_9 = {\n                    \"name\": \"{}_{}\".format(arg_7.template, arg_7.pid),\n                    \"process\": {\n                        \"pid\": arg_7.pid,\n                        \"input\": arg_7.input_type,\n                        \"output\": arg_7.output_type if arg_7.output_type else \"None\",\n                        \"lane\": arg_7.lane,\n                    },\n                    \"children\": []\n                }\n\n                arg_10 = \"\"\n                for arg_11, arg_12 in arg_7.directives.items():\n                    arg_10 += arg_11\n                    for arg_13 in arg_12:\n                        try:\n                            # Remove quotes from string directives\n                            arg_14 = arg_12[arg_13].replace(\"'\", \"\").replace('\"', '') \\\n                                if isinstance(arg_12[arg_13], str) else arg_12[arg_13]\n                            arg_10 += \"{}: {}\".format(arg_13, arg_14)\n                        except KeyError:\n                            pass\n\n                if arg_10:\n                    arg_9[\"process\"][\"directives\"] = arg_10\n                else:\n                    arg_9[\"process\"][\"directives\"] = \"N/A\"\n\n                arg_8.append(arg_9)\n\n                arg_2[arg_7.lane] = arg_8[-1][\"children\"]\n\n        # write to file dict_viz\n        arg_0.dag_to_file(arg_1)\n\n        # Write tree forking information for dotfile\n        with open(os.path.join(dirname(arg_0.nf_file),\n                               \".forkTree.json\"), \"w\") as fh:\n            fh.write(json.dumps(arg_0._fork_tree))\n\n        # send with jinja to html resource\n        return arg_0._render_config(\"pipeline_graph.html\", {\"data\": arg_1})", "path": "flowcraft/generator/engine.py", "identifier": "NextflowGenerator.render_pipeline", "docstring": "Write pipeline attributes to json\n\n        This function writes the pipeline and their attributes to a json file,\n        that is intended to be read by resources/pipeline_graph.html to render\n        a graphical output showing the DAG.", "docstring_tokens": ["Write", "pipeline", "attributes", "to", "json"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 260921}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/coloransi.py#L119-L123", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return a full copy of the object, optionally renaming it.", "language": "python", "parameters": "(self,name=None)", "return_statement": "return ColorScheme(name, self.colors.dict())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "name", "return", "ColorScheme", "(", "arg_1", ",", "arg_0", ".", "colors", ".", "dict", "(", ")", ")"], "function": "def Func(arg_0,arg_1=None):\n        \"\"\"Return a full Func of the object, optionally renaming it.\"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.name\n        return ColorScheme(arg_1, arg_0.colors.dict())", "path": "environment/lib/python2.7/site-packages/IPython/utils/coloransi.py", "identifier": "ColorScheme.copy", "docstring": "Return a full copy of the object, optionally renaming it.", "docstring_tokens": ["Return", "a", "full", "copy", "of", "the", "object", "optionally", "renaming", "it", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260922}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/tears.py#L973-L1075", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Generates a report detailing portfolio size constraints set by\n    least liquid tickers. Plots a \"capacity sweep,\" a curve describing\n    projected sharpe ratio given the slippage penalties that are\n    applied at various capital bases.", "language": "python", "parameters": "(returns, positions, transactions,\n                               market_data,\n                               liquidation_daily_vol_limit=0.2,\n                               trade_daily_vol_limit=0.05,\n                               last_n_days=utils.APPROX_BDAYS_PER_MONTH * 6,\n                               days_to_liquidate_limit=1,\n                               estimate_intraday='infer')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0.2", ",", "arg_5", "=", "0.05", ",", "arg_6", "=", "arg_7", ".", "APPROX_BDAYS_PER_MONTH", "*", "6", ",", "arg_9", "=", "1", ",", "arg_10", "=", "'infer'", ")", ":", "arg_1", "=", "arg_7", ".", "check_intraday", "(", "arg_10", ",", "arg_0", ",", "arg_1", ",", "arg_2", ")", "print", "(", "\"Max days to liquidation is computed for each traded name \"", "\"assuming a 20% limit on daily bar consumption \\n\"", "\"and trailing 5 day mean volume as the available bar volume.\\n\\n\"", "\"Tickers with >1 day liquidation time at a\"", "\" constant $1m capital base:\"", ")", "arg_11", "=", "capacity", ".", "get_max_days_to_liquidate_by_ticker", "(", "arg_1", ",", "arg_3", ",", "max_bar_consumption", "=", "arg_4", ",", "capital_base", "=", "1e6", ",", "mean_volume_window", "=", "5", ")", "arg_11", ".", "index", "=", "(", "arg_11", ".", "index", ".", "map", "(", "arg_7", ".", "format_asset", ")", ")", "print", "(", "\"Whole backtest:\"", ")", "arg_7", ".", "print_table", "(", "arg_11", "[", "arg_11", ".", "days_to_liquidate", ">", "arg_9", "]", ")", "arg_13", "=", "capacity", ".", "get_max_days_to_liquidate_by_ticker", "(", "arg_1", ",", "arg_3", ",", "max_bar_consumption", "=", "arg_4", ",", "capital_base", "=", "1e6", ",", "mean_volume_window", "=", "5", ",", "arg_6", "=", "arg_6", ")", "arg_13", ".", "index", "=", "(", "arg_13", ".", "index", ".", "map", "(", "arg_7", ".", "format_asset", ")", ")", "print", "(", "\"Last {} trading days:\"", ".", "format", "(", "arg_6", ")", ")", "arg_7", ".", "print_table", "(", "arg_13", "[", "arg_13", ".", "days_to_liquidate", ">", "1", "]", ")", "arg_14", "=", "capacity", ".", "get_low_liquidity_transactions", "(", "arg_2", ",", "arg_3", ")", "arg_14", ".", "index", "=", "arg_14", ".", "index", ".", "map", "(", "arg_7", ".", "format_asset", ")", "print", "(", "'Tickers with daily transactions consuming >{}% of daily bar \\n'", "'all backtest:'", ".", "format", "(", "arg_5", "*", "100", ")", ")", "arg_7", ".", "print_table", "(", "arg_14", "[", "arg_14", "[", "'max_pct_bar_consumed'", "]", ">", "arg_5", "*", "100", "]", ")", "arg_14", "=", "capacity", ".", "get_low_liquidity_transactions", "(", "arg_2", ",", "arg_3", ",", "arg_6", "=", "arg_6", ")", "print", "(", "\"Last {} trading days:\"", ".", "format", "(", "arg_6", ")", ")", "arg_7", ".", "print_table", "(", "arg_14", "[", "arg_14", "[", "'max_pct_bar_consumed'", "]", ">", "arg_5", "*", "100", "]", ")", "arg_15", "=", "arg_1", ".", "iloc", "[", "0", "]", ".", "sum", "(", ")", "/", "(", "1", "+", "arg_0", ".", "iloc", "[", "0", "]", ")", "arg_16", ",", "arg_17", "=", "plt", ".", "subplots", "(", "figsize", "=", "(", "14", ",", "6", ")", ")", "plotting", ".", "plot_capacity_sweep", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "arg_15", ",", "min_pv", "=", "100000", ",", "max_pv", "=", "300000000", ",", "step_size", "=", "1000000", ",", "ax", "=", "arg_17", ")"], "function": "def Func(arg_0, arg_1, arg_2,\n                               arg_3,\n                               arg_4=0.2,\n                               arg_5=0.05,\n                               arg_6=arg_7.APPROX_BDAYS_PER_MONTH * 6,\n                               arg_9=1,\n                               arg_10='infer'):\n    \"\"\"\n    Generates a report detailing portfolio size constraints set by\n    least liquid tickers. Plots a \"capacity sweep,\" a curve describing\n    projected sharpe ratio given the slippage penalties that are\n    applied at various capital bases.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in create_full_tear_sheet.\n    market_data : pd.Panel\n        Panel with items axis of 'price' and 'volume' DataFrames.\n        The major and minor axes should match those of the\n        the passed positions DataFrame (same dates and symbols).\n    liquidation_daily_vol_limit : float\n        Max proportion of a daily bar that can be consumed in the\n        process of liquidating a position in the\n        \"days to liquidation\" analysis.\n    trade_daily_vol_limit : float\n        Flag daily transaction totals that exceed proportion of\n        daily bar.\n    last_n_days : integer\n        Compute max position allocation and dollar volume for only\n        the last N days of the backtest\n    days_to_liquidate_limit : integer\n        Display all tickers with greater max days to liquidation.\n    estimate_intraday: boolean or str, optional\n        Approximate returns for intraday strategies.\n        See description in create_full_tear_sheet.\n    \"\"\"\n\n    arg_1 = arg_7.check_intraday(arg_10, arg_0,\n                                     arg_1, arg_2)\n\n    print(\"Max days to liquidation is computed for each traded name \"\n          \"assuming a 20% limit on daily bar consumption \\n\"\n          \"and trailing 5 day mean volume as the available bar volume.\\n\\n\"\n          \"Tickers with >1 day liquidation time at a\"\n          \" constant $1m capital base:\")\n\n    arg_11 = capacity.get_max_days_to_liquidate_by_ticker(\n        arg_1, arg_3,\n        max_bar_consumption=arg_4,\n        capital_base=1e6,\n        mean_volume_window=5)\n    arg_11.index = (\n        arg_11.index.map(arg_7.format_asset))\n\n    print(\"Whole backtest:\")\n    arg_7.print_table(\n        arg_11[arg_11.days_to_liquidate >\n                           arg_9])\n\n    arg_13 = capacity.get_max_days_to_liquidate_by_ticker(\n        arg_1, arg_3,\n        max_bar_consumption=arg_4,\n        capital_base=1e6,\n        mean_volume_window=5,\n        arg_6=arg_6)\n    arg_13.index = (\n        arg_13.index.map(arg_7.format_asset))\n\n    print(\"Last {} trading days:\".format(arg_6))\n    arg_7.print_table(\n        arg_13[arg_13.days_to_liquidate > 1])\n\n    arg_14 = capacity.get_low_liquidity_transactions(arg_2, arg_3)\n    arg_14.index = arg_14.index.map(arg_7.format_asset)\n\n    print('Tickers with daily transactions consuming >{}% of daily bar \\n'\n          'all backtest:'.format(arg_5 * 100))\n    arg_7.print_table(\n        arg_14[arg_14['max_pct_bar_consumed'] > arg_5 * 100])\n\n    arg_14 = capacity.get_low_liquidity_transactions(\n        arg_2, arg_3, arg_6=arg_6)\n\n    print(\"Last {} trading days:\".format(arg_6))\n    arg_7.print_table(\n        arg_14[arg_14['max_pct_bar_consumed'] > arg_5 * 100])\n\n    arg_15 = arg_1.iloc[0].sum() / (1 + arg_0.iloc[0])\n    arg_16, arg_17 = plt.subplots(figsize=(14, 6))\n    plotting.plot_capacity_sweep(arg_0, arg_2, arg_3,\n                                 arg_15,\n                                 min_pv=100000,\n                                 max_pv=300000000,\n                                 step_size=1000000,\n                                 ax=arg_17)", "path": "pyfolio/tears.py", "identifier": "create_capacity_tear_sheet", "docstring": "Generates a report detailing portfolio size constraints set by\n    least liquid tickers. Plots a \"capacity sweep,\" a curve describing\n    projected sharpe ratio given the slippage penalties that are\n    applied at various capital bases.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in create_full_tear_sheet.\n    positions : pd.DataFrame\n        Daily net position values.\n         - See full explanation in create_full_tear_sheet.\n    transactions : pd.DataFrame\n        Prices and amounts of executed trades. One row per trade.\n         - See full explanation in create_full_tear_sheet.\n    market_data : pd.Panel\n        Panel with items axis of 'price' and 'volume' DataFrames.\n        The major and minor axes should match those of the\n        the passed positions DataFrame (same dates and symbols).\n    liquidation_daily_vol_limit : float\n        Max proportion of a daily bar that can be consumed in the\n        process of liquidating a position in the\n        \"days to liquidation\" analysis.\n    trade_daily_vol_limit : float\n        Flag daily transaction totals that exceed proportion of\n        daily bar.\n    last_n_days : integer\n        Compute max position allocation and dollar volume for only\n        the last N days of the backtest\n    days_to_liquidate_limit : integer\n        Display all tickers with greater max days to liquidation.\n    estimate_intraday: boolean or str, optional\n        Approximate returns for intraday strategies.\n        See description in create_full_tear_sheet.", "docstring_tokens": ["Generates", "a", "report", "detailing", "portfolio", "size", "constraints", "set", "by", "least", "liquid", "tickers", ".", "Plots", "a", "capacity", "sweep", "a", "curve", "describing", "projected", "sharpe", "ratio", "given", "the", "slippage", "penalties", "that", "are", "applied", "at", "various", "capital", "bases", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260923}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1204-L1223", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Update a reference.", "language": "python", "parameters": "(self, ref, delete=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "[", "'git'", ",", "'update-ref'", "]", "if", "arg_2", ":", "arg_3", ".", "extend", "(", "[", "'-d'", ",", "arg_1", ".", "refname", "]", ")", "arg_4", "=", "'deleted'", "else", ":", "arg_3", ".", "extend", "(", "[", "arg_1", ".", "refname", ",", "arg_1", ".", "hash", "]", ")", "arg_4", "=", "'updated to %s'", "%", "arg_1", ".", "hash", "try", ":", "arg_0", ".", "_exec", "(", "arg_3", ",", "cwd", "=", "arg_0", ".", "dirpath", ",", "env", "=", "arg_0", ".", "gitenv", ")", "except", "RepositoryError", "as", "e", ":", "logger", ".", "warning", "(", "\"Git %s ref could not be %s during sync process in %s (%s); skipped\"", ",", "arg_1", ".", "refname", ",", "arg_4", ",", "arg_0", ".", "uri", ",", "arg_0", ".", "dirpath", ")", "else", ":", "logger", ".", "debug", "(", "\"Git %s ref %s in %s (%s)\"", ",", "arg_1", ".", "refname", ",", "arg_4", ",", "arg_0", ".", "uri", ",", "arg_0", ".", "dirpath", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"Update a reference.\"\"\"\n\n        arg_3 = ['git', 'update-ref']\n\n        if arg_2:\n            arg_3.extend(['-d', arg_1.refname])\n            arg_4 = 'deleted'\n        else:\n            arg_3.extend([arg_1.refname, arg_1.hash])\n            arg_4 = 'updated to %s' % arg_1.hash\n\n        try:\n            arg_0._exec(arg_3, cwd=arg_0.dirpath, env=arg_0.gitenv)\n        except RepositoryError as e:\n            logger.warning(\"Git %s ref could not be %s during sync process in %s (%s); skipped\",\n                           arg_1.refname, arg_4, arg_0.uri, arg_0.dirpath)\n        else:\n            logger.debug(\"Git %s ref %s in %s (%s)\",\n                         arg_1.refname, arg_4, arg_0.uri, arg_0.dirpath)", "path": "perceval/backends/core/git.py", "identifier": "GitRepository._update_ref", "docstring": "Update a reference.", "docstring_tokens": ["Update", "a", "reference", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 260924}
{"url": "https://github.com/edavis/django-override-settings/blob/016a2ba44cf7132d3aeefbfeddaf201217b1d4b6/override_settings/__init__.py#L75-L81", "sha": "016a2ba44cf7132d3aeefbfeddaf201217b1d4b6", "docstring_summary": "Class decorator that makes sure the passed apps are not present in\n    INSTALLED_APPS.", "language": "python", "parameters": "(*apps)", "return_statement": "return override_settings(INSTALLED_APPS=apps_list)", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "[", "a", "for", "a", "in", "settings", ".", "INSTALLED_APPS", "if", "a", "not", "in", "arg_0", "]", "return", "override_settings", "(", "INSTALLED_APPS", "=", "arg_1", ")"], "function": "def Func(*arg_0):\n    \"\"\"\n    Class decorator that makes sure the passed apps are not present in\n    INSTALLED_APPS.\n    \"\"\"\n    arg_1 = [a for a in settings.INSTALLED_APPS if a not in arg_0]\n    return override_settings(INSTALLED_APPS=arg_1)", "path": "override_settings/__init__.py", "identifier": "without_apps", "docstring": "Class decorator that makes sure the passed apps are not present in\n    INSTALLED_APPS.", "docstring_tokens": ["Class", "decorator", "that", "makes", "sure", "the", "passed", "apps", "are", "not", "present", "in", "INSTALLED_APPS", "."], "nwo": "edavis/django-override-settings", "score": 0.28597268934051834, "idx": 260925}
{"url": "https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L197-L213", "sha": "6902c6968a39b747d15e32363f43b7dffe2622c2", "docstring_summary": "Create a single file with all versions.", "language": "python", "parameters": "(self, bucket, key, file_versions)", "return_statement": "return objs[-1]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_3", ":", "arg_6", "=", "FileInstance", ".", "create", "(", ")", ".", "set_uri", "(", "arg_5", "[", "'full_path'", "]", ",", "arg_5", "[", "'size'", "]", ",", "'md5:{0}'", ".", "format", "(", "arg_5", "[", "'checksum'", "]", ")", ",", ")", "arg_7", "=", "ObjectVersion", ".", "create", "(", "arg_1", ",", "arg_2", ")", ".", "set_file", "(", "arg_6", ")", "arg_7", ".", "created", "=", "arrow", ".", "get", "(", "arg_5", "[", "'creation_date'", "]", ")", ".", "datetime", ".", "replace", "(", "tzinfo", "=", "None", ")", "arg_4", ".", "append", "(", "arg_7", ")", "db", ".", "session", ".", "commit", "(", ")", "return", "arg_4", "[", "-", "1", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Create a single file with all versions.\"\"\"\n        arg_4 = []\n        for arg_5 in arg_3:\n            arg_6 = FileInstance.create().set_uri(\n                arg_5['full_path'],\n                arg_5['size'],\n                'md5:{0}'.format(arg_5['checksum']),\n            )\n            arg_7 = ObjectVersion.create(arg_1, arg_2).set_file(arg_6)\n            arg_7.created = arrow.get(\n                arg_5['creation_date']).datetime.replace(tzinfo=None)\n            arg_4.append(arg_7)\n\n        # Set head version\n        db.session.commit()\n        return arg_4[-1]", "path": "invenio_migrator/records.py", "identifier": "RecordDumpLoader.create_file", "docstring": "Create a single file with all versions.", "docstring_tokens": ["Create", "a", "single", "file", "with", "all", "versions", "."], "nwo": "inveniosoftware/invenio-migrator", "score": 0.17553651708052445, "idx": 260926}
{"url": "https://github.com/textbook/aslack/blob/9ac6a44e4464180109fa4be130ad7a980a9d1acc/aslack/slack_bot/bot.py#L186-L202", "sha": "9ac6a44e4464180109fa4be130ad7a980a9d1acc", "docstring_summary": "Get the WebSocket URL for the RTM session.", "language": "python", "parameters": "(self)", "return_statement": "return data['url']", "argument_list": "", "function_tokens": ["async", "def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "await", "arg_0", ".", "api", ".", "execute_method", "(", "arg_0", ".", "RTM_START_ENDPOINT", ",", "simple_latest", "=", "True", ",", "no_unreads", "=", "True", ",", ")", "return", "arg_1", "[", "'url'", "]"], "function": "async def Func(arg_0):\n        \"\"\"Get the WebSocket URL for the RTM session.\n\n        Warning:\n          The URL expires if the session is not joined within 30\n          seconds of the API call to the start endpoint.\n\n        Returns:\n          :py:class:`str`: The socket URL.\n\n        \"\"\"\n        arg_1 = await arg_0.api.execute_method(\n            arg_0.RTM_START_ENDPOINT,\n            simple_latest=True,\n            no_unreads=True,\n        )\n        return arg_1['url']", "path": "aslack/slack_bot/bot.py", "identifier": "SlackBot._get_socket_url", "docstring": "Get the WebSocket URL for the RTM session.\n\n        Warning:\n          The URL expires if the session is not joined within 30\n          seconds of the API call to the start endpoint.\n\n        Returns:\n          :py:class:`str`: The socket URL.", "docstring_tokens": ["Get", "the", "WebSocket", "URL", "for", "the", "RTM", "session", "."], "nwo": "textbook/aslack", "score": 0.18261785916548806, "idx": 260927}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/edward2/interceptor.py#L199-L245", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Context manager for recording interceptable executions onto a tape.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "collections", ".", "OrderedDict", "(", "{", "}", ")", "def", "record", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "arg_3", ".", "get", "(", "\"name\"", ")", "arg_5", "=", "interceptable", "(", "arg_1", ")", "(", "*", "arg_2", ",", "**", "arg_3", ")", "if", "arg_4", ":", "arg_0", "[", "arg_4", "]", "=", "arg_5", "return", "arg_5", "with", "interception", "(", "record", ")", ":", "yield", "arg_0"], "function": "def Func():\n  \"\"\"Context manager for recording interceptable executions onto a Func.\n\n  Similar to `tf.GradientTape`, operations are recorded if they are executed\n  within this context manager. In addition, the operation must be registered\n  (wrapped) as `ed.interceptable`.\n\n  Yields:\n    Func: OrderedDict where operations are recorded in sequence. Keys are\n      the `name` keyword argument to the operation (typically, a random\n      variable's `name`) and values are the corresponding output of the\n      operation. If the operation has no name, it is not recorded.\n\n  #### Examples\n\n  ```python\n  from tensorflow_probability import edward2 as ed\n\n  def probabilistic_matrix_factorization():\n    users = ed.Normal(0., 1., sample_shape=[5000, 128], name=\"users\")\n    items = ed.Normal(0., 1., sample_shape=[7500, 128], name=\"items\")\n    ratings = ed.Normal(loc=tf.matmul(users, items, transpose_b=True),\n                        scale=0.1,\n                        name=\"ratings\")\n    return ratings\n\n  with ed.Func() as model_Func:\n    ratings = probabilistic_matrix_factorization()\n\n  assert model_Func[\"users\"].shape == (5000, 128)\n  assert model_Func[\"items\"].shape == (7500, 128)\n  assert model_Func[\"ratings\"] == ratings\n  ```\n\n  \"\"\"\n  arg_0 = collections.OrderedDict({})\n\n  def record(arg_1, *arg_2, **arg_3):\n    \"\"\"Records execution to a Func.\"\"\"\n    arg_4 = arg_3.get(\"name\")\n    arg_5 = interceptable(arg_1)(*arg_2, **arg_3)\n    if arg_4:\n      arg_0[arg_4] = arg_5\n    return arg_5\n\n  with interception(record):\n    yield arg_0", "path": "tensorflow_probability/python/edward2/interceptor.py", "identifier": "tape", "docstring": "Context manager for recording interceptable executions onto a tape.\n\n  Similar to `tf.GradientTape`, operations are recorded if they are executed\n  within this context manager. In addition, the operation must be registered\n  (wrapped) as `ed.interceptable`.\n\n  Yields:\n    tape: OrderedDict where operations are recorded in sequence. Keys are\n      the `name` keyword argument to the operation (typically, a random\n      variable's `name`) and values are the corresponding output of the\n      operation. If the operation has no name, it is not recorded.\n\n  #### Examples\n\n  ```python\n  from tensorflow_probability import edward2 as ed\n\n  def probabilistic_matrix_factorization():\n    users = ed.Normal(0., 1., sample_shape=[5000, 128], name=\"users\")\n    items = ed.Normal(0., 1., sample_shape=[7500, 128], name=\"items\")\n    ratings = ed.Normal(loc=tf.matmul(users, items, transpose_b=True),\n                        scale=0.1,\n                        name=\"ratings\")\n    return ratings\n\n  with ed.tape() as model_tape:\n    ratings = probabilistic_matrix_factorization()\n\n  assert model_tape[\"users\"].shape == (5000, 128)\n  assert model_tape[\"items\"].shape == (7500, 128)\n  assert model_tape[\"ratings\"] == ratings\n  ```", "docstring_tokens": ["Context", "manager", "for", "recording", "interceptable", "executions", "onto", "a", "tape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260928}
{"url": "https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/__init__.py#L23-L40", "sha": "801581fd0ae238158134bde1c937fa199fa626b2", "docstring_summary": "return test counts that are set via pyt environment variables when pyt \n    runs the test", "language": "python", "parameters": "()", "return_statement": "return counts", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "{", "}", "arg_1", "=", "[", "(", "'PYT_TEST_CLASS_COUNT'", ",", "\"classes\"", ")", ",", "(", "'PYT_TEST_COUNT'", ",", "\"tests\"", ")", ",", "(", "'PYT_TEST_MODULE_COUNT'", ",", "\"modules\"", ")", ",", "]", "for", "arg_2", ",", "arg_3", "in", "arg_1", ":", "arg_0", "[", "arg_3", "]", "=", "int", "(", "os", ".", "environ", ".", "get", "(", "arg_2", ",", "0", ")", ")", "return", "arg_0"], "function": "def Func():\n    \"\"\"return test counts that are set via pyt environment variables when pyt \n    runs the test\n\n    :returns: dict, 3 keys (classes, tests, modules) and how many tests of each\n        were found by pyt\n    \"\"\"\n    arg_0 = {}\n    arg_1 = [\n        ('PYT_TEST_CLASS_COUNT', \"classes\"),\n        ('PYT_TEST_COUNT', \"tests\"),\n        ('PYT_TEST_MODULE_COUNT', \"modules\"),\n    ]\n\n    for arg_2, arg_3 in arg_1:\n        arg_0[arg_3] = int(os.environ.get(arg_2, 0))\n\n    return arg_0", "path": "pyt/__init__.py", "identifier": "get_counts", "docstring": "return test counts that are set via pyt environment variables when pyt \n    runs the test\n\n    :returns: dict, 3 keys (classes, tests, modules) and how many tests of each\n        were found by pyt", "docstring_tokens": ["return", "test", "counts", "that", "are", "set", "via", "pyt", "environment", "variables", "when", "pyt", "runs", "the", "test"], "nwo": "Jaymon/pyt", "score": 0.24979334806965703, "idx": 260929}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L20-L23", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the angle between two points.", "language": "python", "parameters": "(x0, y0, x1, y1)", "return_statement": "return degrees(atan2(y1-y0, x1-x0))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "return", "degrees", "(", "atan2", "(", "arg_3", "-", "arg_1", ",", "arg_2", "-", "arg_0", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\r\n    \"\"\" Returns the Func between two points.\r\n    \"\"\"\r\n    return degrees(atan2(arg_3-arg_1, arg_2-arg_0))", "path": "shoebot/data/geometry.py", "identifier": "angle", "docstring": "Returns the angle between two points.", "docstring_tokens": ["Returns", "the", "angle", "between", "two", "points", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260930}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/models.py#L1786-L1803", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Get the enterprise customer uuid linked to the user.", "language": "python", "parameters": "(self)", "return_statement": "return str(enterprise_user.enterprise_customer.uuid)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "EnterpriseCustomerUser", ".", "objects", ".", "get", "(", "user_id", "=", "arg_0", ".", "user", ".", "id", ")", "except", "ObjectDoesNotExist", ":", "LOGGER", ".", "warning", "(", "'User {} has a {} assignment but is not linked to an enterprise!'", ".", "format", "(", "arg_0", ".", "__class__", ",", "arg_0", ".", "user", ".", "id", ")", ")", "return", "None", "except", "MultipleObjectsReturned", ":", "LOGGER", ".", "warning", "(", "'User {} is linked to multiple enterprises, which is not yet supported!'", ".", "format", "(", "arg_0", ".", "user", ".", "id", ")", ")", "return", "None", "return", "str", "(", "arg_1", ".", "enterprise_customer", ".", "uuid", ")"], "function": "def Func(arg_0):\n        \"\"\"Get the enterprise customer uuid linked to the user.\"\"\"\n        try:\n            arg_1 = EnterpriseCustomerUser.objects.get(user_id=arg_0.user.id)\n        except ObjectDoesNotExist:\n            LOGGER.warning(\n                'User {} has a {} assignment but is not linked to an enterprise!'.format(\n                    arg_0.__class__,\n                    arg_0.user.id\n                ))\n            return None\n        except MultipleObjectsReturned:\n            LOGGER.warning(\n                'User {} is linked to multiple enterprises, which is not yet supported!'.format(arg_0.user.id)\n            )\n            return None\n\n        return str(arg_1.enterprise_customer.uuid)", "path": "enterprise/models.py", "identifier": "EnterpriseRoleAssignmentContextMixin.enterprise_customer_uuid", "docstring": "Get the enterprise customer uuid linked to the user.", "docstring_tokens": ["Get", "the", "enterprise", "customer", "uuid", "linked", "to", "the", "user", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260931}
{"url": "https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/dflow.py#L175-L202", "sha": "d7afb3bc37f50dcf224ae78637944172edb35dac", "docstring_summary": "Create the dictionary that will be included in the log.", "language": "python", "parameters": "(self, task_id, fail_mode=None)", "return_statement": "return task_log_info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "[", "'func_name'", ",", "'fn_hash'", ",", "'memoize'", ",", "'checkpoint'", ",", "'fail_count'", ",", "'fail_history'", ",", "'status'", ",", "'id'", ",", "'time_submitted'", ",", "'time_returned'", ",", "'executor'", "]", "arg_4", "=", "{", "\"task_\"", "+", "k", ":", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "k", "]", "for", "k", "in", "arg_3", "}", "arg_4", "[", "'run_id'", "]", "=", "arg_0", ".", "run_id", "arg_4", "[", "'timestamp'", "]", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "arg_4", "[", "'task_status_name'", "]", "=", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'status'", "]", ".", "name", "arg_4", "[", "'tasks_failed_count'", "]", "=", "arg_0", ".", "tasks_failed_count", "arg_4", "[", "'tasks_completed_count'", "]", "=", "arg_0", ".", "tasks_completed_count", "arg_4", "[", "'task_inputs'", "]", "=", "str", "(", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'kwargs'", "]", ".", "get", "(", "'inputs'", ",", "None", ")", ")", "arg_4", "[", "'task_outputs'", "]", "=", "str", "(", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'kwargs'", "]", ".", "get", "(", "'outputs'", ",", "None", ")", ")", "arg_4", "[", "'task_stdin'", "]", "=", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'kwargs'", "]", ".", "get", "(", "'stdin'", ",", "None", ")", "arg_4", "[", "'task_stdout'", "]", "=", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'kwargs'", "]", ".", "get", "(", "'stdout'", ",", "None", ")", "arg_4", "[", "'task_depends'", "]", "=", "None", "if", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'depends'", "]", "is", "not", "None", ":", "arg_4", "[", "'task_depends'", "]", "=", "\",\"", ".", "join", "(", "[", "str", "(", "t", ".", "_tid", ")", "for", "t", "in", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'depends'", "]", "]", ")", "arg_4", "[", "'task_elapsed_time'", "]", "=", "None", "if", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'time_returned'", "]", "is", "not", "None", ":", "arg_4", "[", "'task_elapsed_time'", "]", "=", "(", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'time_returned'", "]", "-", "arg_0", ".", "tasks", "[", "arg_1", "]", "[", "'time_submitted'", "]", ")", ".", "total_seconds", "(", ")", "if", "arg_2", "is", "not", "None", ":", "arg_4", "[", "'task_fail_mode'", "]", "=", "arg_2", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Create the dictionary that will be included in the log.\n        \"\"\"\n\n        arg_3 = ['func_name', 'fn_hash', 'memoize', 'checkpoint', 'fail_count',\n                           'fail_history', 'status', 'id', 'time_submitted', 'time_returned', 'executor']\n\n        arg_4 = {\"task_\" + k: arg_0.tasks[arg_1][k] for k in arg_3}\n        arg_4['run_id'] = arg_0.run_id\n        arg_4['timestamp'] = datetime.datetime.now()\n        arg_4['task_status_name'] = arg_0.tasks[arg_1]['status'].name\n        arg_4['tasks_failed_count'] = arg_0.tasks_failed_count\n        arg_4['tasks_completed_count'] = arg_0.tasks_completed_count\n        arg_4['task_inputs'] = str(arg_0.tasks[arg_1]['kwargs'].get('inputs', None))\n        arg_4['task_outputs'] = str(arg_0.tasks[arg_1]['kwargs'].get('outputs', None))\n        arg_4['task_stdin'] = arg_0.tasks[arg_1]['kwargs'].get('stdin', None)\n        arg_4['task_stdout'] = arg_0.tasks[arg_1]['kwargs'].get('stdout', None)\n        arg_4['task_depends'] = None\n        if arg_0.tasks[arg_1]['depends'] is not None:\n            arg_4['task_depends'] = \",\".join([str(t._tid) for t in arg_0.tasks[arg_1]['depends']])\n        arg_4['task_elapsed_time'] = None\n        if arg_0.tasks[arg_1]['time_returned'] is not None:\n            arg_4['task_elapsed_time'] = (arg_0.tasks[arg_1]['time_returned'] -\n                                                  arg_0.tasks[arg_1]['time_submitted']).total_seconds()\n        if arg_2 is not None:\n            arg_4['task_fail_mode'] = arg_2\n        return arg_4", "path": "parsl/dataflow/dflow.py", "identifier": "DataFlowKernel._create_task_log_info", "docstring": "Create the dictionary that will be included in the log.", "docstring_tokens": ["Create", "the", "dictionary", "that", "will", "be", "included", "in", "the", "log", "."], "nwo": "Parsl/parsl", "score": 0.8824753515365124, "idx": 260932}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/simplejson/scanner.py#L36-L59", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Yield match, end_idx for each match", "language": "python", "parameters": "(self, string, idx=0, context=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "scanner", ".", "scanner", "(", "arg_1", ",", "arg_2", ")", ".", "match", "arg_5", "=", "arg_0", ".", "actions", "arg_6", "=", "arg_2", "arg_7", "=", "len", "(", "arg_1", ")", "while", "True", ":", "arg_8", "=", "arg_4", "(", ")", "if", "arg_8", "is", "None", ":", "break", "arg_9", ",", "arg_10", "=", "arg_8", ".", "span", "(", ")", "if", "arg_6", "==", "arg_10", ":", "break", "arg_11", "=", "arg_5", "[", "arg_8", ".", "lastindex", "]", "if", "arg_11", "is", "not", "None", ":", "arg_12", ",", "arg_13", "=", "arg_11", "(", "arg_8", ",", "arg_3", ")", "if", "arg_13", "is", "not", "None", "and", "arg_13", "!=", "arg_10", ":", "arg_10", "=", "arg_13", "arg_4", "=", "arg_0", ".", "scanner", ".", "scanner", "(", "arg_1", ",", "arg_10", ")", ".", "match", "yield", "arg_12", ",", "arg_10", "arg_6", "=", "arg_10"], "function": "def Func(arg_0, arg_1, arg_2=0, arg_3=None):\n        \"\"\"\n        Yield match, end_idx for each match\n        \"\"\"\n        arg_4 = arg_0.scanner.scanner(arg_1, arg_2).match\n        arg_5 = arg_0.actions\n        arg_6 = arg_2\n        arg_7 = len(arg_1)\n        while True:\n            arg_8 = arg_4()\n            if arg_8 is None:\n                break\n            arg_9, arg_10 = arg_8.span()\n            if arg_6 == arg_10:\n                break\n            arg_11 = arg_5[arg_8.lastindex]\n            if arg_11 is not None:\n                arg_12, arg_13 = arg_11(arg_8, arg_3)\n                if arg_13 is not None and arg_13 != arg_10:\n                    # \"fast forward\" the scanner\n                    arg_10 = arg_13\n                    arg_4 = arg_0.scanner.scanner(arg_1, arg_10).match\n                yield arg_12, arg_10\n            arg_6 = arg_10", "path": "lib/web/simplejson/scanner.py", "identifier": "Scanner.iterscan", "docstring": "Yield match, end_idx for each match", "docstring_tokens": ["Yield", "match", "end_idx", "for", "each", "match"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260933}
{"url": "https://github.com/rollbar/pyrollbar/blob/33ef2e723a33d09dd6302f978f4a3908be95b9d2/rollbar/__init__.py#L140-L161", "sha": "33ef2e723a33d09dd6302f978f4a3908be95b9d2", "docstring_summary": "Get the current request object. Implementation varies on\n    library support. Modified below when we know which framework\n    is being used.", "language": "python", "parameters": "()", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "for", "arg_0", "in", "(", "_get_bottle_request", ",", "_get_flask_request", ",", "_get_pyramid_request", ",", "_get_pylons_request", ")", ":", "try", ":", "arg_1", "=", "arg_0", "(", ")", "if", "arg_1", "is", "not", "None", ":", "return", "arg_1", "except", ":", "pass", "return", "None"], "function": "def Func():\n    \"\"\"\n    Get the current request object. Implementation varies on\n    library support. Modified below when we know which framework\n    is being used.\n    \"\"\"\n\n    # TODO(cory): add in a generic _get_locals_request() which\n    # will iterate up through the call stack and look for a variable\n    # that appears to be valid request object.\n    for arg_0 in (_get_bottle_request,\n               _get_flask_request,\n               _get_pyramid_request,\n               _get_pylons_request):\n        try:\n            arg_1 = arg_0()\n            if arg_1 is not None:\n                return arg_1\n        except:\n            pass\n\n    return None", "path": "rollbar/__init__.py", "identifier": "get_request", "docstring": "Get the current request object. Implementation varies on\n    library support. Modified below when we know which framework\n    is being used.", "docstring_tokens": ["Get", "the", "current", "request", "object", ".", "Implementation", "varies", "on", "library", "support", ".", "Modified", "below", "when", "we", "know", "which", "framework", "is", "being", "used", "."], "nwo": "rollbar/pyrollbar", "score": 0.8439078507967885, "idx": 260934}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/pycparser_utils.py#L9-L54", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Naive comment and macro striping from source code", "language": "python", "parameters": "(code, comments=True, macros=False, pragmas=False)", "return_statement": "return code", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ")", ":", "if", "arg_2", "or", "arg_3", ":", "arg_4", "=", "arg_0", ".", "split", "(", "'\\n'", ")", "arg_5", "=", "False", "arg_6", "=", "False", "for", "arg_7", "in", "range", "(", "len", "(", "arg_4", ")", ")", ":", "arg_8", "=", "arg_4", "[", "arg_7", "]", ".", "strip", "(", ")", "if", "arg_2", "and", "(", "arg_8", ".", "startswith", "(", "'#'", ")", "and", "not", "arg_8", ".", "startswith", "(", "'#pragma'", ")", "or", "arg_5", ")", ":", "arg_4", "[", "arg_7", "]", "=", "''", "arg_5", "=", "arg_8", ".", "endswith", "(", "'\\\\'", ")", "if", "arg_3", "and", "(", "arg_8", ".", "startswith", "(", "'#pragma'", ")", "or", "arg_6", ")", ":", "arg_4", "[", "arg_7", "]", "=", "''", "arg_6", "=", "arg_8", ".", "endswith", "(", "'\\\\'", ")", "arg_0", "=", "'\\n'", ".", "join", "(", "arg_4", ")", "if", "arg_1", ":", "arg_9", "=", "0", "arg_10", "=", "None", "while", "arg_9", "<", "len", "(", "arg_0", ")", "-", "1", ":", "if", "arg_10", "is", "None", "and", "arg_0", "[", "arg_9", ":", "arg_9", "+", "2", "]", "==", "'//'", ":", "arg_11", "=", "arg_0", ".", "find", "(", "'\\n'", ",", "arg_9", ")", "arg_0", "=", "arg_0", "[", ":", "arg_9", "]", "+", "arg_0", "[", "arg_11", ":", "]", "arg_9", "-=", "arg_11", "-", "arg_9", "elif", "arg_10", "is", "None", "and", "arg_0", "[", "arg_9", ":", "arg_9", "+", "2", "]", "==", "'/*'", ":", "arg_10", "=", "arg_9", "elif", "arg_10", "is", "not", "None", "and", "arg_0", "[", "arg_9", ":", "arg_9", "+", "2", "]", "==", "'*/'", ":", "arg_0", "=", "(", "arg_0", "[", ":", "arg_10", "]", "+", "'\\n'", "*", "arg_0", "[", "arg_10", ":", "arg_9", "]", ".", "count", "(", "'\\n'", ")", "+", "arg_0", "[", "arg_9", "+", "2", ":", "]", ")", "arg_9", "-=", "arg_9", "-", "arg_10", "arg_10", "=", "None", "arg_9", "+=", "1", "return", "arg_0"], "function": "def Func(arg_0, arg_1=True, arg_2=False, arg_3=False):\n    \"\"\"\n    Naive comment and macro striping from source code\n\n    :param comments: If True, all comments are stripped from code\n    :param macros: If True, all macros are stripped from code\n    :param pragmas: If True, all pragmas are stripped from code\n\n    :return: cleaned code. Line numbers are preserved with blank lines,\n    and multiline comments and macros are supported. BUT comment-like\n    strings are (wrongfully) treated as comments.\n    \"\"\"\n    if arg_2 or arg_3:\n        arg_4 = arg_0.split('\\n')\n        arg_5 = False\n        arg_6 = False\n        for arg_7 in range(len(arg_4)):\n            arg_8 = arg_4[arg_7].strip()\n\n            if arg_2 and (arg_8.startswith('#') and not arg_8.startswith('#pragma') or arg_5):\n                arg_4[arg_7] = ''\n                arg_5 = arg_8.endswith('\\\\')\n            if arg_3 and (arg_8.startswith('#pragma') or arg_6):\n                arg_4[arg_7] = ''\n                arg_6 = arg_8.endswith('\\\\')\n        arg_0 = '\\n'.join(arg_4)\n\n    if arg_1:\n        arg_9 = 0\n        arg_10 = None\n        while arg_9 < len(arg_0) - 1:\n            if arg_10 is None and arg_0[arg_9:arg_9 + 2] == '//':\n                arg_11 = arg_0.find('\\n', arg_9)\n                arg_0 = arg_0[:arg_9] + arg_0[arg_11:]\n                arg_9 -= arg_11 - arg_9\n            elif arg_10 is None and arg_0[arg_9:arg_9 + 2] == '/*':\n                arg_10 = arg_9\n            elif arg_10 is not None and arg_0[arg_9:arg_9 + 2] == '*/':\n                arg_0 = (arg_0[:arg_10] +\n                        '\\n' * arg_0[arg_10:arg_9].count('\\n') +\n                        arg_0[arg_9 + 2:])\n                arg_9 -= arg_9 - arg_10\n                arg_10 = None\n            arg_9 += 1\n\n    return arg_0", "path": "kerncraft/pycparser_utils.py", "identifier": "clean_code", "docstring": "Naive comment and macro striping from source code\n\n    :param comments: If True, all comments are stripped from code\n    :param macros: If True, all macros are stripped from code\n    :param pragmas: If True, all pragmas are stripped from code\n\n    :return: cleaned code. Line numbers are preserved with blank lines,\n    and multiline comments and macros are supported. BUT comment-like\n    strings are (wrongfully) treated as comments.", "docstring_tokens": ["Naive", "comment", "and", "macro", "striping", "from", "source", "code"], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 260935}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L91-L106", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Generate a new notebook_id for a name and store its mappings.", "language": "python", "parameters": "(self, name)", "return_statement": "return notebook_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "unicode", "(", "uuid", ".", "uuid4", "(", ")", ")", "arg_0", ".", "mapping", "[", "arg_2", "]", "=", "arg_1", "arg_0", ".", "rev_mapping", "[", "arg_1", "]", "=", "arg_2", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Generate a new notebook_id for a name and store its mappings.\"\"\"\n        # TODO: the following will give stable urls for notebooks, but unless\n        # the notebooks are immediately redirected to their new urls when their\n        # filemname changes, nasty inconsistencies result.  So for now it's\n        # disabled and instead we use a random uuid4() call.  But we leave the\n        # logic here so that we can later reactivate it, whhen the necessary\n        # url redirection code is written.\n        #notebook_id = unicode(uuid.uuid5(uuid.NAMESPACE_URL,\n        #                 'file://'+self.get_path_by_name(name).encode('utf-8')))\n        \n        arg_2 = unicode(uuid.uuid4())\n        \n        arg_0.mapping[arg_2] = arg_1\n        arg_0.rev_mapping[arg_1] = arg_2\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py", "identifier": "NotebookManager.new_notebook_id", "docstring": "Generate a new notebook_id for a name and store its mappings.", "docstring_tokens": ["Generate", "a", "new", "notebook_id", "for", "a", "name", "and", "store", "its", "mappings", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260936}
{"url": "https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L135-L144", "sha": "991a76331cdf5d8f9dbf5b18f6e29adc80749a2f", "docstring_summary": "Reads data from the socket.", "language": "python", "parameters": "(self, size=4096)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "4096", ")", ":", "arg_2", "=", "arg_0", ".", "socket", ".", "recv", "(", "arg_1", ")", "if", "not", "arg_2", ":", "raise", "NNTPError", "(", "\"Failed to read from socket\"", ")", "arg_0", ".", "__buffer", ".", "write", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=4096):\n        \"\"\"Reads data from the socket.\n\n        Raises:\n            NNTPError: When connection times out or read from socket fails.\n        \"\"\"\n        arg_2 = arg_0.socket.recv(arg_1)\n        if not arg_2:\n            raise NNTPError(\"Failed to read from socket\")\n        arg_0.__buffer.write(arg_2)", "path": "nntp/nntp.py", "identifier": "BaseNNTPClient.__recv", "docstring": "Reads data from the socket.\n\n        Raises:\n            NNTPError: When connection times out or read from socket fails.", "docstring_tokens": ["Reads", "data", "from", "the", "socket", "."], "nwo": "greenbender/pynntp", "score": 0.17821439704321745, "idx": 260937}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L1253-L1337", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Process INFO received from the server and CONNECT to the server\n        with authentication.  It is also responsible of setting up the\n        reading and ping interval tasks from the client.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_status", "=", "Client", ".", "CONNECTING", "arg_2", "=", "arg_0", ".", "_io_reader", ".", "readline", "(", ")", "arg_3", "=", "yield", "from", "asyncio", ".", "wait_for", "(", "arg_2", ",", "arg_0", ".", "options", "[", "\"connect_timeout\"", "]", ")", "if", "INFO_OP", "not", "in", "arg_3", ":", "raise", "NatsError", "(", "\"nats: empty response from server when expecting INFO message\"", ")", "arg_4", ",", "arg_5", "=", "arg_3", ".", "split", "(", "INFO_OP", "+", "_SPC_", ",", "1", ")", "try", ":", "arg_6", "=", "json", ".", "loads", "(", "arg_5", ".", "decode", "(", ")", ")", "except", ":", "raise", "NatsError", "(", "\"nats: info message, json parse error\"", ")", "arg_0", ".", "_process_info", "(", "arg_6", ")", "arg_0", ".", "_server_info", "=", "arg_6", "if", "'max_payload'", "in", "arg_0", ".", "_server_info", ":", "arg_0", ".", "_max_payload", "=", "arg_0", ".", "_server_info", "[", "\"max_payload\"", "]", "if", "'tls_required'", "in", "arg_0", ".", "_server_info", "and", "arg_0", ".", "_server_info", "[", "'tls_required'", "]", ":", "arg_9", "=", "None", "if", "\"tls\"", "in", "arg_0", ".", "options", ":", "arg_9", "=", "arg_0", ".", "options", ".", "get", "(", "'tls'", ")", "elif", "arg_0", ".", "_current_server", ".", "uri", ".", "scheme", "==", "'tls'", ":", "arg_9", "=", "ssl", ".", "create_default_context", "(", ")", "else", ":", "raise", "NatsError", "(", "'nats: no ssl context provided'", ")", "arg_10", "=", "arg_0", ".", "_io_writer", ".", "transport", "arg_11", "=", "arg_10", ".", "get_extra_info", "(", "'socket'", ")", "if", "not", "arg_11", ":", "raise", "NatsError", "(", "'nats: unable to get socket'", ")", "yield", "from", "arg_0", ".", "_io_writer", ".", "drain", "(", ")", "arg_0", ".", "_io_reader", ",", "arg_0", ".", "_io_writer", "=", "yield", "from", "asyncio", ".", "open_connection", "(", "loop", "=", "arg_0", ".", "_loop", ",", "limit", "=", "DEFAULT_BUFFER_SIZE", ",", "arg_11", "=", "arg_11", ",", "ssl", "=", "arg_9", ",", "server_hostname", "=", "arg_0", ".", "_current_server", ".", "uri", ".", "hostname", ",", ")", "if", "arg_0", ".", "is_reconnecting", ":", "arg_0", ".", "_ps", ".", "reset", "(", ")", "arg_14", "=", "arg_0", ".", "_connect_command", "(", ")", "arg_0", ".", "_io_writer", ".", "write", "(", "arg_14", ")", "arg_0", ".", "_io_writer", ".", "write", "(", "PING_PROTO", ")", "yield", "from", "arg_0", ".", "_io_writer", ".", "drain", "(", ")", "arg_15", "=", "yield", "from", "arg_0", ".", "_io_reader", ".", "readline", "(", ")", "if", "arg_0", ".", "options", "[", "\"verbose\"", "]", "and", "OK_OP", "in", "arg_15", ":", "arg_15", "=", "yield", "from", "arg_0", ".", "_io_reader", ".", "readline", "(", ")", "if", "ERR_OP", "in", "arg_15", ":", "arg_16", "=", "arg_15", ".", "decode", "(", ")", "arg_4", ",", "arg_17", "=", "arg_16", ".", "split", "(", "\" \"", ",", "1", ")", "raise", "NatsError", "(", "\"nats: \"", "+", "arg_17", ".", "rstrip", "(", "'\\r\\n'", ")", ")", "if", "PONG_PROTO", "in", "arg_15", ":", "arg_0", ".", "_status", "=", "Client", ".", "CONNECTED", "arg_0", ".", "_reading_task", "=", "arg_0", ".", "_loop", ".", "create_task", "(", "arg_0", ".", "_read_loop", "(", ")", ")", "arg_0", ".", "_pongs", "=", "[", "]", "arg_0", ".", "_pings_outstanding", "=", "0", "arg_0", ".", "_ping_interval_task", "=", "arg_0", ".", "_loop", ".", "create_task", "(", "arg_0", ".", "_ping_interval", "(", ")", ")", "arg_0", ".", "_flusher_task", "=", "arg_0", ".", "_loop", ".", "create_task", "(", "arg_0", ".", "_flusher", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Process INFO received from the server and CONNECT to the server\n        with authentication.  It is also responsible of setting up the\n        reading and ping interval tasks from the client.\n        \"\"\"\n        arg_0._status = Client.CONNECTING\n\n        arg_2 = arg_0._io_reader.readline()\n        arg_3 = yield from asyncio.wait_for(arg_2, arg_0.options[\"connect_timeout\"])\n        if INFO_OP not in arg_3:\n            raise NatsError(\"nats: empty response from server when expecting INFO message\")\n\n        arg_4, arg_5 = arg_3.split(INFO_OP + _SPC_, 1)\n\n        try:\n            arg_6 = json.loads(arg_5.decode())\n        except:\n            raise NatsError(\"nats: info message, json parse error\")\n\n        arg_0._process_info(arg_6)\n        arg_0._server_info = arg_6\n\n        if 'max_payload' in arg_0._server_info:\n            arg_0._max_payload = arg_0._server_info[\"max_payload\"]\n\n        if 'tls_required' in arg_0._server_info and arg_0._server_info['tls_required']:\n            arg_9 = None\n            if \"tls\" in arg_0.options:\n                arg_9 = arg_0.options.get('tls')\n            elif arg_0._current_server.uri.scheme == 'tls':\n                arg_9 = ssl.create_default_context()\n            else:\n                raise NatsError('nats: no ssl context provided')\n\n            arg_10 = arg_0._io_writer.transport\n            arg_11 = arg_10.get_extra_info('socket')\n            if not arg_11:\n                # This shouldn't happen\n                raise NatsError('nats: unable to get socket')\n\n            yield from arg_0._io_writer.drain()  # just in case something is left\n\n            arg_0._io_reader, arg_0._io_writer = \\\n                yield from asyncio.open_connection(\n                    loop=arg_0._loop,\n                    limit=DEFAULT_BUFFER_SIZE,\n                    arg_11=arg_11,\n                    ssl=arg_9,\n                    server_hostname=arg_0._current_server.uri.hostname,\n                )\n\n        # Refresh state of parser upon reconnect.\n        if arg_0.is_reconnecting:\n            arg_0._ps.reset()\n\n        arg_14 = arg_0._connect_command()\n        arg_0._io_writer.write(arg_14)\n        arg_0._io_writer.write(PING_PROTO)\n        yield from arg_0._io_writer.drain()\n\n        # FIXME: Add readline timeout\n        arg_15 = yield from arg_0._io_reader.readline()\n        if arg_0.options[\"verbose\"] and OK_OP in arg_15:\n            arg_15 = yield from arg_0._io_reader.readline()\n\n        if ERR_OP in arg_15:\n            arg_16 = arg_15.decode()\n            arg_4, arg_17 = arg_16.split(\" \", 1)\n            # FIXME: Maybe handling could be more special here,\n            # checking for ErrAuthorization for example.\n            # yield from self._process_err(err_msg)\n            raise NatsError(\"nats: \" + arg_17.rstrip('\\r\\n'))\n\n        if PONG_PROTO in arg_15:\n            arg_0._status = Client.CONNECTED\n\n        arg_0._reading_task = arg_0._loop.create_task(arg_0._read_loop())\n        arg_0._pongs = []\n        arg_0._pings_outstanding = 0\n        arg_0._ping_interval_task = arg_0._loop.create_task(\n            arg_0._ping_interval())\n\n        # Task for kicking the flusher queue\n        arg_0._flusher_task = arg_0._loop.create_task(arg_0._flusher())", "path": "nats/aio/client.py", "identifier": "Client._process_connect_init", "docstring": "Process INFO received from the server and CONNECT to the server\n        with authentication.  It is also responsible of setting up the\n        reading and ping interval tasks from the client.", "docstring_tokens": ["Process", "INFO", "received", "from", "the", "server", "and", "CONNECT", "to", "the", "server", "with", "authentication", ".", "It", "is", "also", "responsible", "of", "setting", "up", "the", "reading", "and", "ping", "interval", "tasks", "from", "the", "client", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 260938}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/config.py#L110-L114", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Set AAD metadata.", "language": "python", "parameters": "(uri, resource, client)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "set_config_value", "(", "'authority_uri'", ",", "arg_0", ")", "set_config_value", "(", "'aad_resource'", ",", "arg_1", ")", "set_config_value", "(", "'aad_client'", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Set AAD metadata.\"\"\"\n    set_config_value('authority_uri', arg_0)\n    set_config_value('aad_resource', arg_1)\n    set_config_value('aad_client', arg_2)", "path": "rcctl/rcctl/config.py", "identifier": "set_aad_metadata", "docstring": "Set AAD metadata.", "docstring_tokens": ["Set", "AAD", "metadata", "."], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 260939}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/application.py#L244-L255", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Print the flag part of the help.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "flags", ":", "return", "arg_1", "=", "[", "]", "for", "arg_2", ",", "(", "arg_3", ",", "arg_4", ")", "in", "arg_0", ".", "flags", ".", "iteritems", "(", ")", ":", "arg_5", "=", "'--'", "if", "len", "(", "arg_2", ")", ">", "1", "else", "'-'", "arg_1", ".", "append", "(", "arg_5", "+", "arg_2", ")", "arg_1", ".", "append", "(", "indent", "(", "dedent", "(", "arg_4", ".", "strip", "(", ")", ")", ")", ")", "print", "os", ".", "linesep", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Print the flag part of the help.\"\"\"\n        if not arg_0.flags:\n            return\n\n        arg_1 = []\n        for arg_2, (arg_3,arg_4) in arg_0.flags.iteritems():\n            arg_5 = '--' if len(arg_2) > 1 else '-'\n            arg_1.append(arg_5+arg_2)\n            arg_1.append(indent(dedent(arg_4.strip())))\n        # lines.append('')\n        print os.linesep.join(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/config/application.py", "identifier": "Application.print_flag_help", "docstring": "Print the flag part of the help.", "docstring_tokens": ["Print", "the", "flag", "part", "of", "the", "help", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260940}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/commands/instruction.py#L154-L161", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a new schedule with `schedule` inserted within `self` at `start_time`.", "language": "python", "parameters": "(self, start_time: int, schedule: ScheduleComponent)", "return_statement": "return ops.insert(self, start_time, schedule)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", ")", "->", "'ScheduleComponent'", ":", "return", "ops", ".", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4) -> 'ScheduleComponent':\n        \"\"\"Return a new schedule with `schedule` Funced within `self` at `start_time`.\n\n        Args:\n            start_time: time to be Funced\n            schedule: schedule to be Funced\n        \"\"\"\n        return ops.Func(arg_0, arg_1, arg_3)", "path": "qiskit/pulse/commands/instruction.py", "identifier": "Instruction.insert", "docstring": "Return a new schedule with `schedule` inserted within `self` at `start_time`.\n\n        Args:\n            start_time: time to be inserted\n            schedule: schedule to be inserted", "docstring_tokens": ["Return", "a", "new", "schedule", "with", "schedule", "inserted", "within", "self", "at", "start_time", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260941}
{"url": "https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L320-L329", "sha": "4fe4d928cd6fe3e7564f7362e3996898bda5a285", "docstring_summary": "RPOP a value off of the ``src`` list and LPUSH it\n        on to the ``dst`` list.  Returns the value.", "language": "python", "parameters": "(self, src, dst)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "rpop", "(", "arg_1", ")", "if", "arg_3", "is", "not", "None", ":", "arg_0", ".", "lpush", "(", "arg_2", ",", "arg_3", ")", "return", "arg_3", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        RPOP a value off of the ``src`` list and LPUSH it\n        on to the ``dst`` list.  Returns the value.\n        \"\"\"\n        arg_3 = arg_0.rpop(arg_1)\n        if arg_3 is not None:\n            arg_0.lpush(arg_2, arg_3)\n            return arg_3\n        return None", "path": "rediscluster/cluster_client.py", "identifier": "StrictRedisCluster._rc_rpoplpush", "docstring": "RPOP a value off of the ``src`` list and LPUSH it\n        on to the ``dst`` list.  Returns the value.", "docstring_tokens": ["RPOP", "a", "value", "off", "of", "the", "src", "list", "and", "LPUSH", "it", "on", "to", "the", "dst", "list", ".", "Returns", "the", "value", "."], "nwo": "salimane/rediscluster-py", "score": 0.19802268511144447, "idx": 260942}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qobj/converters/lo_config.py#L79-L102", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Embed default meas LO frequencies from backend and format them to list object.\n        If configured lo frequency is the same as default, this method returns `None`.", "language": "python", "parameters": "(self, user_lo_config)", "return_statement": "return _m_los", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "default_meas_los", ".", "copy", "(", ")", "except", "KeyError", ":", "raise", "PulseError", "(", "'Default measurement frequencies not exist.'", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "meas_lo_dict", "(", ")", ".", "items", "(", ")", ":", "arg_2", "[", "arg_3", ".", "index", "]", "=", "arg_4", "if", "arg_2", "==", "arg_0", ".", "default_meas_los", ":", "return", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Embed default meas LO frequencies from backend and format them to list object.\n        If configured lo frequency is the same as default, this method returns `None`.\n\n        Args:\n            user_lo_config (LoConfig): A dictionary of LOs to format.\n\n        Returns:\n            list: A list of meas LOs.\n\n        Raises:\n            PulseError: when LO frequencies are missing.\n        \"\"\"\n        try:\n            arg_2 = arg_0.default_meas_los.copy()\n        except KeyError:\n            raise PulseError('Default measurement frequencies not exist.')\n\n        for arg_3, arg_4 in arg_1.meas_lo_dict().items():\n            arg_2[arg_3.index] = arg_4\n\n        if arg_2 == arg_0.default_meas_los:\n            return None\n        return arg_2", "path": "qiskit/qobj/converters/lo_config.py", "identifier": "LoConfigConverter.get_meas_los", "docstring": "Embed default meas LO frequencies from backend and format them to list object.\n        If configured lo frequency is the same as default, this method returns `None`.\n\n        Args:\n            user_lo_config (LoConfig): A dictionary of LOs to format.\n\n        Returns:\n            list: A list of meas LOs.\n\n        Raises:\n            PulseError: when LO frequencies are missing.", "docstring_tokens": ["Embed", "default", "meas", "LO", "frequencies", "from", "backend", "and", "format", "them", "to", "list", "object", ".", "If", "configured", "lo", "frequency", "is", "the", "same", "as", "default", "this", "method", "returns", "None", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260943}
{"url": "https://github.com/ecometrica/grandfatherson/blob/b166e4e44887960c3066ebd28eecadfae19561e1/grandfatherson/__init__.py#L150-L175", "sha": "b166e4e44887960c3066ebd28eecadfae19561e1", "docstring_summary": "Return a set of datetimes that should be kept, out of ``datetimes``.", "language": "python", "parameters": "(datetimes,\n            years=0, months=0, weeks=0, days=0,\n            hours=0, minutes=0, seconds=0,\n            firstweekday=SATURDAY, now=None)", "return_statement": "return (filters.Years.filter(datetimes, number=years, now=now) |\n            filters.Months.filter(datetimes, number=months, now=now) |\n            filters.Weeks.filter(datetimes, number=weeks,\n                                 firstweekday=firstweekday, now=now) |\n            filters.Days.filter(datetimes, number=days, now=now) |\n            filters.Hours.filter(datetimes, number=hours, now=now) |\n            filters.Minutes.filter(datetimes, number=minutes, now=now) |\n            filters.Seconds.filter(datetimes, number=seconds, now=now))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ",", "arg_5", "=", "0", ",", "arg_6", "=", "0", ",", "arg_7", "=", "0", ",", "arg_8", "=", "arg_9", ",", "arg_10", "=", "None", ")", ":", "arg_0", "=", "set", "(", "arg_0", ")", "return", "(", "filters", ".", "Years", ".", "filter", "(", "arg_0", ",", "number", "=", "arg_1", ",", "arg_10", "=", "arg_10", ")", "|", "filters", ".", "Months", ".", "filter", "(", "arg_0", ",", "number", "=", "arg_2", ",", "arg_10", "=", "arg_10", ")", "|", "filters", ".", "Weeks", ".", "filter", "(", "arg_0", ",", "number", "=", "arg_3", ",", "arg_8", "=", "arg_8", ",", "arg_10", "=", "arg_10", ")", "|", "filters", ".", "Days", ".", "filter", "(", "arg_0", ",", "number", "=", "arg_4", ",", "arg_10", "=", "arg_10", ")", "|", "filters", ".", "Hours", ".", "filter", "(", "arg_0", ",", "number", "=", "arg_5", ",", "arg_10", "=", "arg_10", ")", "|", "filters", ".", "Minutes", ".", "filter", "(", "arg_0", ",", "number", "=", "arg_6", ",", "arg_10", "=", "arg_10", ")", "|", "filters", ".", "Seconds", ".", "filter", "(", "arg_0", ",", "number", "=", "arg_7", ",", "arg_10", "=", "arg_10", ")", ")"], "function": "def Func(arg_0,\n            arg_1=0, arg_2=0, arg_3=0, arg_4=0,\n            arg_5=0, arg_6=0, arg_7=0,\n            arg_8=arg_9, arg_10=None):\n    \"\"\"\n    Return a set of datetimes that should be kept, out of ``datetimes``.\n\n    Keeps up to ``years``, ``months``, ``weeks``, ``days``,\n    ``hours``, ``minutes``, and ``seconds`` in the past.\n\n    When keeping weeks, it prefers to keep ``firstweekday``, which\n    defaults to Saturday.\n\n    If ``now`` is None, it will base its calculations on\n    ``datetime.datetime.now()``. Datetimes after this point will always be\n    kept.\n    \"\"\"\n    arg_0 = set(arg_0)\n    return (filters.Years.filter(arg_0, number=arg_1, arg_10=arg_10) |\n            filters.Months.filter(arg_0, number=arg_2, arg_10=arg_10) |\n            filters.Weeks.filter(arg_0, number=arg_3,\n                                 arg_8=arg_8, arg_10=arg_10) |\n            filters.Days.filter(arg_0, number=arg_4, arg_10=arg_10) |\n            filters.Hours.filter(arg_0, number=arg_5, arg_10=arg_10) |\n            filters.Minutes.filter(arg_0, number=arg_6, arg_10=arg_10) |\n            filters.Seconds.filter(arg_0, number=arg_7, arg_10=arg_10))", "path": "grandfatherson/__init__.py", "identifier": "to_keep", "docstring": "Return a set of datetimes that should be kept, out of ``datetimes``.\n\n    Keeps up to ``years``, ``months``, ``weeks``, ``days``,\n    ``hours``, ``minutes``, and ``seconds`` in the past.\n\n    When keeping weeks, it prefers to keep ``firstweekday``, which\n    defaults to Saturday.\n\n    If ``now`` is None, it will base its calculations on\n    ``datetime.datetime.now()``. Datetimes after this point will always be\n    kept.", "docstring_tokens": ["Return", "a", "set", "of", "datetimes", "that", "should", "be", "kept", "out", "of", "datetimes", "."], "nwo": "ecometrica/grandfatherson", "score": 0.19800877986197146, "idx": 260944}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/__init__.py#L339-L412", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Handle creating the new etcd client instance and other business.", "language": "python", "parameters": "(self, hosts=None, cacert=None, client_cert=None, client_key=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "try", ":", "import", "etcd", "arg_0", ".", "module", "=", "etcd", "except", "ImportError", ":", "pass", "if", "not", "arg_0", ".", "module", ":", "return", "arg_0", ".", "_parse_jetconfig", "(", ")", "arg_1", "=", "env", "(", "'PYCONFIG_ETCD_HOSTS'", ",", "arg_1", ")", "arg_6", "=", "env", "(", "'PYCONFIG_ETCD_PROTOCOL'", ",", "None", ")", "arg_2", "=", "env", "(", "'PYCONFIG_ETCD_CACERT'", ",", "arg_2", ")", "arg_3", "=", "env", "(", "'PYCONFIG_ETCD_CERT'", ",", "arg_3", ")", "arg_4", "=", "env", "(", "'PYCONFIG_ETCD_KEY'", ",", "arg_4", ")", "arg_7", "=", "None", "arg_8", "=", "None", "arg_9", "=", "env", "(", "'PYCONFIG_ETCD_AUTH'", ",", "None", ")", "if", "arg_9", ":", "arg_9", "=", "arg_9", ".", "split", "(", "':'", ")", "arg_9", ".", "append", "(", "''", ")", "arg_7", "=", "arg_9", "[", "0", "]", "arg_8", "=", "arg_9", "[", "1", "]", "arg_1", "=", "arg_0", ".", "_parse_hosts", "(", "arg_1", ")", "if", "arg_1", "is", "None", ":", "return", "arg_10", "=", "{", "}", "arg_10", "[", "'allow_reconnect'", "]", "=", "True", "if", "arg_6", ":", "arg_10", "[", "'protocol'", "]", "=", "arg_6", "if", "arg_7", ":", "arg_10", "[", "'username'", "]", "=", "arg_7", "if", "arg_8", ":", "arg_10", "[", "'password'", "]", "=", "arg_8", "if", "arg_2", ":", "arg_10", "[", "'ca_cert'", "]", "=", "os", ".", "path", ".", "abspath", "(", "arg_2", ")", "if", "arg_3", "and", "arg_4", ":", "arg_10", "[", "'cert'", "]", "=", "(", "(", "os", ".", "path", ".", "abspath", "(", "arg_3", ")", ",", "os", ".", "path", ".", "abspath", "(", "arg_4", ")", ")", ")", "elif", "arg_3", ":", "arg_10", "[", "'cert'", "]", "=", "os", ".", "path", ".", "abspath", "(", "arg_3", ")", "if", "arg_2", "or", "arg_3", "or", "arg_4", ":", "arg_10", "[", "'protocol'", "]", "=", "'https'", "arg_0", ".", "client", "=", "arg_0", ".", "module", ".", "Client", "(", "arg_1", ",", "**", "arg_10", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None):\n        \"\"\"\n        Handle creating the new etcd client instance and other business.\n\n        :param hosts: Host string or list of hosts (default: `'127.0.0.1:2379'`)\n        :param cacert: CA cert filename (optional)\n        :param client_cert: Client cert filename (optional)\n        :param client_key: Client key filename (optional)\n        :type ca: str\n        :type cert: str\n        :type key: str\n\n        \"\"\"\n        # Try to get the etcd module\n        try:\n            import etcd\n            arg_0.module = etcd\n        except ImportError:\n            pass\n\n        if not arg_0.module:\n            return\n\n        arg_0._parse_jetconfig()\n\n        # Check env for overriding configuration or pyconfig setting\n        arg_1 = env('PYCONFIG_ETCD_HOSTS', arg_1)\n        arg_6 = env('PYCONFIG_ETCD_PROTOCOL', None)\n        arg_2 = env('PYCONFIG_ETCD_CACERT', arg_2)\n        arg_3 = env('PYCONFIG_ETCD_CERT', arg_3)\n        arg_4 = env('PYCONFIG_ETCD_KEY', arg_4)\n\n        # Parse auth string if there is one\n        arg_7 = None\n        arg_8 = None\n        arg_9 = env('PYCONFIG_ETCD_AUTH', None)\n        if arg_9:\n            arg_9 = arg_9.split(':')\n            arg_9.append('')\n            arg_7 = arg_9[0]\n            arg_8 = arg_9[1]\n\n        # Create new etcd instance\n        arg_1 = arg_0._parse_hosts(arg_1)\n        if arg_1 is None:\n            return\n\n        arg_10 = {}\n        # Need this when passing a list of hosts to python-etcd, which we\n        # always do, even if it's a list of one\n        arg_10['allow_reconnect'] = True\n\n        # Grab optional protocol argument\n        if arg_6:\n            arg_10['protocol'] = arg_6\n\n        # Add auth to constructor if we got it\n        if arg_7:\n            arg_10['username'] = arg_7\n        if arg_8:\n            arg_10['password'] = arg_8\n\n        # Assign the SSL args if we have 'em\n        if arg_2:\n            arg_10['ca_cert'] = os.path.abspath(arg_2)\n        if arg_3 and arg_4:\n            arg_10['cert'] = ((os.path.abspath(arg_3),\n                os.path.abspath(arg_4)))\n        elif arg_3:\n            arg_10['cert'] = os.path.abspath(arg_3)\n        if arg_2 or arg_3 or arg_4:\n            arg_10['protocol'] = 'https'\n\n        arg_0.client = arg_0.module.Client(arg_1, **arg_10)", "path": "pyconfig/__init__.py", "identifier": "etcd.init", "docstring": "Handle creating the new etcd client instance and other business.\n\n        :param hosts: Host string or list of hosts (default: `'127.0.0.1:2379'`)\n        :param cacert: CA cert filename (optional)\n        :param client_cert: Client cert filename (optional)\n        :param client_key: Client key filename (optional)\n        :type ca: str\n        :type cert: str\n        :type key: str", "docstring_tokens": ["Handle", "creating", "the", "new", "etcd", "client", "instance", "and", "other", "business", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 260945}
{"url": "https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L639-L674", "sha": "14e91bc0acce090d67be145b1ac040cab92ac5f3", "docstring_summary": "Handle debugger commands.", "language": "python", "parameters": "(self)", "return_statement": "return run_hooks(self, self.postcmd_hooks)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "core", ".", "execution_status", "!=", "'No program'", ":", "arg_0", ".", "setup", "(", ")", "arg_0", ".", "location", "(", ")", "pass", "arg_1", "=", "run_hooks", "(", "arg_0", ",", "arg_0", ".", "preloop_hooks", ")", "arg_0", ".", "continue_running", "=", "False", "while", "not", "arg_1", ":", "try", ":", "run_hooks", "(", "arg_0", ",", "arg_0", ".", "precmd_hooks", ")", "arg_1", "=", "arg_0", ".", "process_command", "(", ")", "if", "arg_1", "or", "arg_0", ".", "continue_running", ":", "break", "except", "EOFError", ":", "if", "len", "(", "arg_0", ".", "debugger", ".", "intf", ")", ">", "1", ":", "del", "arg_0", ".", "debugger", ".", "intf", "[", "-", "1", "]", "arg_0", ".", "last_command", "=", "''", "else", ":", "if", "arg_0", ".", "debugger", ".", "intf", "[", "-", "1", "]", ".", "output", ":", "arg_0", ".", "debugger", ".", "intf", "[", "-", "1", "]", ".", "output", ".", "writeline", "(", "'Leaving'", ")", "raise", "Mexcept", ".", "DebuggerQuit", "pass", "break", "pass", "pass", "return", "run_hooks", "(", "arg_0", ",", "arg_0", ".", "postcmd_hooks", ")"], "function": "def Func(arg_0):\n        \"\"\"Handle debugger commands.\"\"\"\n        if arg_0.core.execution_status != 'No program':\n            arg_0.setup()\n            arg_0.location()\n            pass\n        arg_1 = run_hooks(arg_0, arg_0.preloop_hooks)\n        arg_0.continue_running = False\n\n        while not arg_1:\n            try:\n                run_hooks(arg_0, arg_0.precmd_hooks)\n                # bdb had a True return to leave loop.\n                # A more straight-forward way is to set\n                # instance variable self.continue_running.\n                arg_1 = arg_0.process_command()\n                if arg_1 or arg_0.continue_running: break\n            except EOFError:\n                # If we have stacked interfaces, pop to the next\n                # one.  If this is the last one however, we'll\n                # just stick with that.  FIXME: Possibly we should\n                # check to see if we are interactive.  and not\n                # leave if that's the case. Is this the right\n                # thing?  investigate and fix.\n                if len(arg_0.debugger.intf) > 1:\n                    del arg_0.debugger.intf[-1]\n                    arg_0.last_command = ''\n                else:\n                    if arg_0.debugger.intf[-1].output:\n                        arg_0.debugger.intf[-1].output.writeline('Leaving')\n                        raise Mexcept.DebuggerQuit\n                        pass\n                    break\n                pass\n            pass\n        return run_hooks(arg_0, arg_0.postcmd_hooks)", "path": "trepan/processor/cmdproc.py", "identifier": "CommandProcessor.process_commands", "docstring": "Handle debugger commands.", "docstring_tokens": ["Handle", "debugger", "commands", "."], "nwo": "rocky/python3-trepan", "score": 0.5717473869829166, "idx": 260946}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/results.py#L129-L141", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Returns a sorted list of the executed arcs missing from the code.", "language": "python", "parameters": "(self)", "return_statement": "return sorted(unpredicted)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "arc_possibilities", "(", ")", "arg_2", "=", "arg_0", ".", "arcs_executed", "(", ")", "arg_3", "=", "[", "e", "for", "e", "in", "arg_2", "if", "e", "not", "in", "arg_1", "and", "e", "[", "0", "]", "!=", "e", "[", "1", "]", "]", "return", "sorted", "(", "arg_3", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns a sorted list of the executed arcs missing from the code.\"\"\"\n        arg_1 = arg_0.arc_possibilities()\n        arg_2 = arg_0.arcs_executed()\n        # Exclude arcs here which connect a line to itself.  They can occur\n        # in executed data in some cases.  This is where they can cause\n        # trouble, and here is where it's the least burden to remove them.\n        arg_3 = [\n            e for e in arg_2\n                if e not in arg_1\n                    and e[0] != e[1]\n            ]\n        return sorted(arg_3)", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/results.py", "identifier": "Analysis.arcs_unpredicted", "docstring": "Returns a sorted list of the executed arcs missing from the code.", "docstring_tokens": ["Returns", "a", "sorted", "list", "of", "the", "executed", "arcs", "missing", "from", "the", "code", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 260947}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case.py#L142-L161", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Return the number of cases", "language": "python", "parameters": "(self, institute_id=None)", "return_statement": "return nr_cases", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "{", "}", "if", "arg_1", ":", "arg_2", "[", "'collaborators'", "]", "=", "arg_1", "LOG", ".", "debug", "(", "\"Fetch all cases with query {0}\"", ".", "format", "(", "arg_2", ")", ")", "Func", "=", "arg_0", ".", "case_collection", ".", "find", "(", "arg_2", ")", ".", "count", "(", ")", "return", "Func"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Return the number of cases\n\n        This function will change when we migrate to 3.7.1\n\n        Args:\n            collaborator(str): Institute id\n\n        Returns:\n            nr_cases(int)\n        \"\"\"\n        arg_2 = {}\n\n        if arg_1:\n            arg_2['collaborators'] = arg_1\n\n        LOG.debug(\"Fetch all cases with query {0}\".format(arg_2))\n        Func = arg_0.case_collection.find(arg_2).count()\n\n        return Func", "path": "scout/adapter/mongo/case.py", "identifier": "CaseHandler.nr_cases", "docstring": "Return the number of cases\n\n        This function will change when we migrate to 3.7.1\n\n        Args:\n            collaborator(str): Institute id\n\n        Returns:\n            nr_cases(int)", "docstring_tokens": ["Return", "the", "number", "of", "cases"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 260948}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/edward2/random_variable.py#L133-L137", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Sample shape of random variable as a `TensorShape`.", "language": "python", "parameters": "(self)", "return_statement": "return tf.TensorShape(self._sample_shape)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ".", "_Func", ",", "tf", ".", "Tensor", ")", ":", "return", "tf", ".", "TensorShape", "(", "tf", ".", "get_static_value", "(", "arg_0", ".", "_Func", ")", ")", "return", "tf", ".", "TensorShape", "(", "arg_0", ".", "_Func", ")"], "function": "def Func(arg_0):\n    \"\"\"Sample shape of random variable as a `TensorShape`.\"\"\"\n    if isinstance(arg_0._Func, tf.Tensor):\n      return tf.TensorShape(tf.get_static_value(arg_0._Func))\n    return tf.TensorShape(arg_0._Func)", "path": "tensorflow_probability/python/edward2/random_variable.py", "identifier": "RandomVariable.sample_shape", "docstring": "Sample shape of random variable as a `TensorShape`.", "docstring_tokens": ["Sample", "shape", "of", "random", "variable", "as", "a", "TensorShape", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260949}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_pairwise.py#L39-L107", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Calculate the mean pairwise similarity of a collection of strings.", "language": "python", "parameters": "(\n    collection, metric=sim, mean_func=hmean, symmetric=False\n)", "return_statement": "return mean_func(pairwise_values)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "arg_4", ",", "arg_5", "=", "False", ")", ":", "if", "not", "callable", "(", "arg_3", ")", ":", "raise", "ValueError", "(", "'mean_func must be a function'", ")", "if", "not", "callable", "(", "arg_1", ")", ":", "raise", "ValueError", "(", "'metric must be a function'", ")", "if", "hasattr", "(", "arg_0", ",", "'split'", ")", ":", "arg_0", "=", "arg_0", ".", "split", "(", ")", "if", "not", "hasattr", "(", "arg_0", ",", "'__iter__'", ")", ":", "raise", "ValueError", "(", "'collection is neither a string nor iterable type'", ")", "elif", "len", "(", "arg_0", ")", "<", "2", ":", "raise", "ValueError", "(", "'collection has fewer than two members'", ")", "arg_0", "=", "list", "(", "arg_0", ")", "arg_6", "=", "[", "]", "for", "arg_7", "in", "range", "(", "len", "(", "arg_0", ")", ")", ":", "for", "arg_8", "in", "range", "(", "arg_7", "+", "1", ",", "len", "(", "arg_0", ")", ")", ":", "arg_6", ".", "append", "(", "arg_1", "(", "arg_0", "[", "arg_7", "]", ",", "arg_0", "[", "arg_8", "]", ")", ")", "if", "arg_5", ":", "arg_6", ".", "append", "(", "arg_1", "(", "arg_0", "[", "arg_8", "]", ",", "arg_0", "[", "arg_7", "]", ")", ")", "return", "arg_3", "(", "arg_6", ")"], "function": "def Func(\n    arg_0, arg_1=arg_2, arg_3=arg_4, arg_5=False\n):\n    \"\"\"Calculate the mean pairwise similarity of a collection of strings.\n\n    Takes the mean of the pairwise similarity between each member of a\n    collection, optionally in both directions (for asymmetric similarity\n    metrics.\n\n    Parameters\n    ----------\n    collection : list\n        A collection of terms or a string that can be split\n    metric : function\n        A similarity metric function\n    mean_func : function\n        A mean function that takes a list of values and returns a float\n    symmetric : bool\n        Set to True if all pairwise similarities should be calculated in both\n        directions\n\n    Returns\n    -------\n    float\n        The mean pairwise similarity of a collection of strings\n\n    Raises\n    ------\n    ValueError\n        mean_func must be a function\n    ValueError\n        metric must be a function\n    ValueError\n        collection is neither a string nor iterable type\n    ValueError\n        collection has fewer than two members\n\n    Examples\n    --------\n    >>> round(Func(['Christopher', 'Kristof',\n    ... 'Christobal']), 12)\n    0.519801980198\n    >>> round(Func(['Niall', 'Neal', 'Neil']), 12)\n    0.545454545455\n\n    \"\"\"\n    if not callable(arg_3):\n        raise ValueError('mean_func must be a function')\n    if not callable(arg_1):\n        raise ValueError('metric must be a function')\n\n    if hasattr(arg_0, 'split'):\n        arg_0 = arg_0.split()\n    if not hasattr(arg_0, '__iter__'):\n        raise ValueError('collection is neither a string nor iterable type')\n    elif len(arg_0) < 2:\n        raise ValueError('collection has fewer than two members')\n\n    arg_0 = list(arg_0)\n\n    arg_6 = []\n\n    for arg_7 in range(len(arg_0)):\n        for arg_8 in range(arg_7 + 1, len(arg_0)):\n            arg_6.append(arg_1(arg_0[arg_7], arg_0[arg_8]))\n            if arg_5:\n                arg_6.append(arg_1(arg_0[arg_8], arg_0[arg_7]))\n\n    return arg_3(arg_6)", "path": "abydos/stats/_pairwise.py", "identifier": "mean_pairwise_similarity", "docstring": "Calculate the mean pairwise similarity of a collection of strings.\n\n    Takes the mean of the pairwise similarity between each member of a\n    collection, optionally in both directions (for asymmetric similarity\n    metrics.\n\n    Parameters\n    ----------\n    collection : list\n        A collection of terms or a string that can be split\n    metric : function\n        A similarity metric function\n    mean_func : function\n        A mean function that takes a list of values and returns a float\n    symmetric : bool\n        Set to True if all pairwise similarities should be calculated in both\n        directions\n\n    Returns\n    -------\n    float\n        The mean pairwise similarity of a collection of strings\n\n    Raises\n    ------\n    ValueError\n        mean_func must be a function\n    ValueError\n        metric must be a function\n    ValueError\n        collection is neither a string nor iterable type\n    ValueError\n        collection has fewer than two members\n\n    Examples\n    --------\n    >>> round(mean_pairwise_similarity(['Christopher', 'Kristof',\n    ... 'Christobal']), 12)\n    0.519801980198\n    >>> round(mean_pairwise_similarity(['Niall', 'Neal', 'Neil']), 12)\n    0.545454545455", "docstring_tokens": ["Calculate", "the", "mean", "pairwise", "similarity", "of", "a", "collection", "of", "strings", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 260950}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1672-L1725", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots monthly returns as a timeseries.", "language": "python", "parameters": "(returns, ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "def", "cumulate_returns", "(", "arg_3", ")", ":", "return", "ep", ".", "cum_returns", "(", "arg_3", ")", "[", "-", "1", "]", "if", "arg_1", "is", "None", ":", "arg_1", "=", "plt", ".", "gca", "(", ")", "arg_4", "=", "arg_0", ".", "resample", "(", "'M'", ")", ".", "apply", "(", "lambda", "arg_3", ":", "cumulate_returns", "(", "arg_3", ")", ")", "arg_4", "=", "arg_4", ".", "to_period", "(", ")", "sns", ".", "barplot", "(", "arg_3", "=", "arg_4", ".", "index", ",", "y", "=", "arg_4", ".", "values", ",", "color", "=", "'steelblue'", ")", "arg_5", ",", "arg_6", "=", "plt", ".", "xticks", "(", ")", "plt", ".", "setp", "(", "arg_6", ",", "rotation", "=", "90", ")", "arg_7", "=", "[", "]", "arg_8", "=", "[", "]", "arg_9", "=", "0", "for", "arg_10", "in", "arg_4", ".", "index", ":", "if", "arg_10", ".", "month", "==", "1", ":", "arg_8", ".", "append", "(", "arg_10", ")", "arg_7", ".", "append", "(", "arg_9", ")", "arg_1", ".", "axvline", "(", "arg_9", ",", "color", "=", "'gray'", ",", "ls", "=", "'--'", ",", "alpha", "=", "0.3", ")", "arg_9", "+=", "1", "arg_1", ".", "axhline", "(", "0.0", ",", "color", "=", "'darkgray'", ",", "ls", "=", "'-'", ")", "arg_1", ".", "set_xticks", "(", "arg_7", ")", "arg_1", ".", "set_xticklabels", "(", "arg_8", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n    \"\"\"\n    Plots monthly returns as a timeseries.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    def cumulate_returns(arg_3):\n        return ep.cum_returns(arg_3)[-1]\n\n    if arg_1 is None:\n        arg_1 = plt.gca()\n\n    arg_4 = arg_0.resample('M').apply(lambda arg_3: cumulate_returns(arg_3))\n    arg_4 = arg_4.to_period()\n\n    sns.barplot(arg_3=arg_4.index,\n                y=arg_4.values,\n                color='steelblue')\n\n    arg_5, arg_6 = plt.xticks()\n    plt.setp(arg_6, rotation=90)\n\n    # only show x-labels on year boundary\n    arg_7 = []\n    arg_8 = []\n    arg_9 = 0\n    for arg_10 in arg_4.index:\n        if arg_10.month == 1:\n            arg_8.append(arg_10)\n            arg_7.append(arg_9)\n            # plot yearly boundary line\n            arg_1.axvline(arg_9, color='gray', ls='--', alpha=0.3)\n\n        arg_9 += 1\n\n    arg_1.axhline(0.0, color='darkgray', ls='-')\n    arg_1.set_xticks(arg_7)\n    arg_1.set_xticklabels(arg_8)\n\n    return arg_1", "path": "pyfolio/plotting.py", "identifier": "plot_monthly_returns_timeseries", "docstring": "Plots monthly returns as a timeseries.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "monthly", "returns", "as", "a", "timeseries", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 260951}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/execution_plan/utility.py#L60-L91", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "This captures a common pattern of fanning out a single value to N steps,\n    where each step has similar structure. The strict requirement here is that each step\n    must provide an output named the parameters parallel_step_output.", "language": "python", "parameters": "(\n    pipeline_def, solid, join_step_key, parallel_steps, parallel_step_output\n)", "return_statement": "return ExecutionValueSubplan(\n        parallel_steps + [join_step], StepOutputHandle.from_step(join_step, output_name)\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "check", ".", "inst_param", "(", "arg_0", ",", "'pipeline_def'", ",", "PipelineDefinition", ")", "check", ".", "inst_param", "(", "arg_1", ",", "'solid'", ",", "Solid", ")", "check", ".", "str_param", "(", "arg_2", ",", "'join_step_key'", ")", "check", ".", "list_param", "(", "arg_3", ",", "'parallel_steps'", ",", "of_type", "=", "ExecutionStep", ")", "check", ".", "str_param", "(", "arg_4", ",", "'parallel_step_output'", ")", "for", "arg_5", "in", "arg_3", ":", "check", ".", "invariant", "(", "arg_5", ".", "has_step_output", "(", "arg_4", ")", ")", "arg_6", "=", "create_join_step", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", "arg_7", "=", "arg_6", ".", "step_outputs", "[", "0", "]", ".", "name", "return", "ExecutionValueSubplan", "(", "arg_3", "+", "[", "arg_6", "]", ",", "StepOutputHandle", ".", "from_step", "(", "arg_6", ",", "arg_7", ")", ")"], "function": "def Func(\n    arg_0, arg_1, arg_2, arg_3, arg_4\n):\n    '''\n    This captures a common pattern of fanning out a single value to N steps,\n    where each step has similar structure. The strict requirement here is that each step\n    must provide an output named the parameters parallel_step_output.\n\n    This takes those steps and then uses a join node to coalesce them so that downstream\n    steps can depend on a single output.\n\n    Currently the join step just does a passthrough with no computation. It remains\n    to be seen if there should be any work or verification done in this step, especially\n    in multi-process environments that require persistence between steps.\n    '''\n    check.inst_param(arg_0, 'pipeline_def', PipelineDefinition)\n    check.inst_param(arg_1, 'solid', Solid)\n    check.str_param(arg_2, 'join_step_key')\n    check.list_param(arg_3, 'parallel_steps', of_type=ExecutionStep)\n    check.str_param(arg_4, 'parallel_step_output')\n\n    for arg_5 in arg_3:\n        check.invariant(arg_5.has_step_output(arg_4))\n\n    arg_6 = create_join_step(\n        arg_0, arg_1, arg_2, arg_3, arg_4\n    )\n\n    arg_7 = arg_6.step_outputs[0].name\n    return ExecutionValueSubplan(\n        arg_3 + [arg_6], StepOutputHandle.from_step(arg_6, arg_7)\n    )", "path": "python_modules/dagster/dagster/core/execution_plan/utility.py", "identifier": "create_joining_subplan", "docstring": "This captures a common pattern of fanning out a single value to N steps,\n    where each step has similar structure. The strict requirement here is that each step\n    must provide an output named the parameters parallel_step_output.\n\n    This takes those steps and then uses a join node to coalesce them so that downstream\n    steps can depend on a single output.\n\n    Currently the join step just does a passthrough with no computation. It remains\n    to be seen if there should be any work or verification done in this step, especially\n    in multi-process environments that require persistence between steps.", "docstring_tokens": ["This", "captures", "a", "common", "pattern", "of", "fanning", "out", "a", "single", "value", "to", "N", "steps", "where", "each", "step", "has", "similar", "structure", ".", "The", "strict", "requirement", "here", "is", "that", "each", "step", "must", "provide", "an", "output", "named", "the", "parameters", "parallel_step_output", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 260952}
{"url": "https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L609-L645", "sha": "56bc1e56c602fa20307b23fe27518e9cd6c11af1", "docstring_summary": "Launch the specified program. Uses the `start` script if specified\n            by the target, attempts to run it natively if that script is not\n            defined.", "language": "python", "parameters": "(self, builddir, program, forward_args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "None", "try", ":", "arg_5", "=", "arg_0", ".", "findProgram", "(", "arg_1", ",", "arg_2", ")", "if", "arg_5", "is", "None", ":", "return", "arg_6", ",", "arg_7", "=", "arg_0", ".", "buildProgEnvAndVars", "(", "arg_5", ",", "arg_1", ")", "if", "arg_0", ".", "getScript", "(", "'Func'", ")", ":", "arg_8", "=", "[", "os", ".", "path", ".", "expandvars", "(", "string", ".", "Template", "(", "x", ")", ".", "safe_substitute", "(", "**", "arg_7", ")", ")", "for", "x", "in", "arg_0", ".", "getScript", "(", "'Func'", ")", "]", "+", "arg_3", "else", ":", "arg_8", "=", "shlex", ".", "split", "(", "'./'", "+", "arg_5", ")", "+", "arg_3", "logger", ".", "debug", "(", "'Funcing program: %s'", ",", "arg_8", ")", "arg_4", "=", "subprocess", ".", "Popen", "(", "arg_8", ",", "cwd", "=", "arg_1", ",", "env", "=", "arg_6", ")", "arg_4", ".", "wait", "(", ")", "if", "arg_4", ".", "returncode", ":", "return", "\"process exited with status %s\"", "%", "arg_4", ".", "returncode", "arg_4", "=", "None", "except", "OSError", "as", "e", ":", "import", "errno", "if", "e", ".", "errno", "==", "errno", ".", "ENOEXEC", ":", "return", "(", "\"the program %s cannot be run (perhaps your target \"", "+", "\"needs to define a 'Func' script to Func it on its \"", "\"intended execution target?)\"", ")", "%", "arg_5", "finally", ":", "if", "arg_4", "is", "not", "None", ":", "_tryTerminate", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        ''' Launch the specified program. Uses the `Func` script if specified\n            by the target, attempts to run it natively if that script is not\n            defined.\n        '''\n        arg_4 = None\n        try:\n            arg_5 = arg_0.findProgram(arg_1, arg_2)\n            if arg_5 is None:\n                return\n\n            arg_6, arg_7 = arg_0.buildProgEnvAndVars(arg_5, arg_1)\n            if arg_0.getScript('Func'):\n                arg_8 = [\n                    os.path.expandvars(string.Template(x).safe_substitute(**arg_7))\n                    for x in arg_0.getScript('Func')\n                ] + arg_3\n            else:\n                arg_8 = shlex.split('./' + arg_5) + arg_3\n\n            logger.debug('Funcing program: %s', arg_8)\n            arg_4 = subprocess.Popen(\n                arg_8, cwd = arg_1, env = arg_6\n            )\n            arg_4.wait()\n            if arg_4.returncode:\n                return \"process exited with status %s\" % arg_4.returncode\n            arg_4 = None\n        except OSError as e:\n            import errno\n            if e.errno == errno.ENOEXEC:\n                return (\"the program %s cannot be run (perhaps your target \"+\n                        \"needs to define a 'Func' script to Func it on its \"\n                        \"intended execution target?)\") % arg_5\n        finally:\n            if arg_4 is not None:\n                _tryTerminate(arg_4)", "path": "yotta/lib/target.py", "identifier": "DerivedTarget.start", "docstring": "Launch the specified program. Uses the `start` script if specified\n            by the target, attempts to run it natively if that script is not\n            defined.", "docstring_tokens": ["Launch", "the", "specified", "program", ".", "Uses", "the", "start", "script", "if", "specified", "by", "the", "target", "attempts", "to", "run", "it", "natively", "if", "that", "script", "is", "not", "defined", "."], "nwo": "ARMmbed/yotta", "score": 0.5108433960388695, "idx": 260953}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py#L94-L116", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return compiled marker as a function accepting an environment dict.", "language": "python", "parameters": "(marker)", "return_statement": "return _cache[marker]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "arg_6", "[", "arg_0", "]", "except", "KeyError", ":", "pass", "if", "not", "arg_0", ".", "strip", "(", ")", ":", "def", "arg_4", "(", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "return", "True", "else", ":", "arg_3", "=", "Func_marker", "(", "parse_marker", "(", "arg_0", ")", ")", "def", "arg_4", "(", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "{", "}", "if", "arg_1", "is", "None", ":", "arg_1", "=", "default_environment", "(", ")", "arg_1", ".", "update", "(", "arg_2", ")", "return", "eval", "(", "arg_3", ",", "arg_1", ")", "arg_4", ".", "__doc__", "=", "arg_0", "arg_6", "[", "arg_0", "]", "=", "arg_4", "return", "arg_6", "[", "arg_0", "]"], "function": "def Func(arg_0):\n    \"\"\"Return Funcd marker as a function accepting an environment dict.\"\"\"\n    try:\n        return arg_6[arg_0]\n    except KeyError:\n        pass\n    if not arg_0.strip():\n        def arg_4(arg_1=None, arg_2=None):\n            \"\"\"\"\"\"\n            return True\n    else:\n        arg_3 = Func_marker(parse_marker(arg_0))\n        def arg_4(arg_1=None, arg_2=None):\n            \"\"\"override updates environment\"\"\"\n            if arg_2 is None:\n                arg_2 = {}\n            if arg_1 is None:\n                arg_1 = default_environment()\n            arg_1.update(arg_2)\n            return eval(arg_3, arg_1)\n    arg_4.__doc__ = arg_0\n    arg_6[arg_0] = arg_4\n    return arg_6[arg_0]", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py", "identifier": "compile", "docstring": "Return compiled marker as a function accepting an environment dict.", "docstring_tokens": ["Return", "compiled", "marker", "as", "a", "function", "accepting", "an", "environment", "dict", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 260954}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L470-L482", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Filter audit course modes out if the enterprise customer has not enabled the 'Enable audit enrollment' flag.", "language": "python", "parameters": "(enterprise_customer, course_modes)", "return_statement": "return course_modes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "settings", ",", "'ENTERPRISE_COURSE_ENROLLMENT_AUDIT_MODES'", ",", "[", "'audit'", "]", ")", "if", "not", "arg_0", ".", "enable_audit_enrollment", ":", "return", "[", "arg_3", "for", "arg_3", "in", "arg_1", "if", "arg_3", "[", "'mode'", "]", "not", "in", "arg_2", "]", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Filter audit course modes out if the enterprise customer has not enabled the 'Enable audit enrollment' flag.\n\n    Arguments:\n        enterprise_customer: The EnterpriseCustomer that the enrollment was created using.\n        course_modes: iterable with dictionaries containing a required 'mode' key\n\n    \"\"\"\n    arg_2 = getattr(settings, 'ENTERPRISE_COURSE_ENROLLMENT_AUDIT_MODES', ['audit'])\n    if not arg_0.enable_audit_enrollment:\n        return [arg_3 for arg_3 in arg_1 if arg_3['mode'] not in arg_2]\n    return arg_1", "path": "enterprise/utils.py", "identifier": "filter_audit_course_modes", "docstring": "Filter audit course modes out if the enterprise customer has not enabled the 'Enable audit enrollment' flag.\n\n    Arguments:\n        enterprise_customer: The EnterpriseCustomer that the enrollment was created using.\n        course_modes: iterable with dictionaries containing a required 'mode' key", "docstring_tokens": ["Filter", "audit", "course", "modes", "out", "if", "the", "enterprise", "customer", "has", "not", "enabled", "the", "Enable", "audit", "enrollment", "flag", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 260955}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/tfs/__init__.py#L33-L51", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Create a project_analysis_client.py client for a Team Foundation Server Enterprise connection instance.\n    This is helpful for understanding project languages, but currently blank for all our test conditions.", "language": "python", "parameters": "(url, token=None)", "return_statement": "return project_analysis_client", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "os", ".", "environ", ".", "get", "(", "'TFS_API_TOKEN'", ",", "None", ")", "arg_2", "=", "create_tfs_connection", "(", "arg_0", ",", "arg_1", ")", "arg_3", "=", "arg_2", ".", "get_client", "(", "'vsts.project_analysis.v4_1.project_analysis_client.ProjectAnalysisClient'", ")", "if", "arg_3", "is", "None", ":", "arg_4", "=", "'Unable to connect to TFS Enterprise (%s) with provided token.'", "raise", "RuntimeError", "(", "arg_4", ",", "arg_0", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Create a project_analysis_client.py client for a Team Foundation Server Enterprise connection instance.\n    This is helpful for understanding project languages, but currently blank for all our test conditions.\n\n    If token is not provided, will attempt to use the TFS_API_TOKEN\n    environment variable if present.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = os.environ.get('TFS_API_TOKEN', None)\n\n    arg_2 = create_tfs_connection(arg_0, arg_1)\n    arg_3 = arg_2.get_client('vsts.project_analysis.v4_1.project_analysis_client.ProjectAnalysisClient')\n\n    if arg_3 is None:\n        arg_4 = 'Unable to connect to TFS Enterprise (%s) with provided token.'\n        raise RuntimeError(arg_4, arg_0)\n\n    return arg_3", "path": "scraper/tfs/__init__.py", "identifier": "create_tfs_project_analysis_client", "docstring": "Create a project_analysis_client.py client for a Team Foundation Server Enterprise connection instance.\n    This is helpful for understanding project languages, but currently blank for all our test conditions.\n\n    If token is not provided, will attempt to use the TFS_API_TOKEN\n    environment variable if present.", "docstring_tokens": ["Create", "a", "project_analysis_client", ".", "py", "client", "for", "a", "Team", "Foundation", "Server", "Enterprise", "connection", "instance", ".", "This", "is", "helpful", "for", "understanding", "project", "languages", "but", "currently", "blank", "for", "all", "our", "test", "conditions", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 260956}
{"url": "https://github.com/geopython/OWSLib/blob/96d47842401a129f1e86fa9f66dccef5a5a6872c/owslib/feature/schema.py#L55-L64", "sha": "96d47842401a129f1e86fa9f66dccef5a5a6872c", "docstring_summary": "Get attribute elements", "language": "python", "parameters": "(complex_type, root)", "return_statement": "return found_elements", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "findall", "(", "arg_1", ",", "'{%s}complexType'", "%", "XS_NAMESPACE", ",", "attribute_name", "=", "'name'", ",", "attribute_value", "=", "arg_0", ")", "[", "0", "]", "arg_2", "=", "findall", "(", "arg_3", ",", "'{%s}element'", "%", "XS_NAMESPACE", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Get attribute elements\n    \"\"\"\n\n    arg_2 = []\n    arg_3 = findall(arg_1, '{%s}complexType' % XS_NAMESPACE,\n                       attribute_name='name', attribute_value=arg_0)[0]\n    arg_2 = findall(arg_3, '{%s}element' % XS_NAMESPACE)\n\n    return arg_2", "path": "owslib/feature/schema.py", "identifier": "_get_elements", "docstring": "Get attribute elements", "docstring_tokens": ["Get", "attribute", "elements"], "nwo": "geopython/OWSLib", "score": 0.9295808138080248, "idx": 260957}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L469-L497", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return True if seg1 and seg2 are identical, ignoring order of synapses", "language": "python", "parameters": "(seg1, seg2)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "True", "for", "arg_3", "in", "[", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", "]", ":", "if", "abs", "(", "arg_0", "[", "0", "]", "[", "arg_3", "]", "-", "arg_1", "[", "0", "]", "[", "arg_3", "]", ")", ">", "0.001", ":", "arg_2", "=", "False", "if", "len", "(", "arg_0", "[", "1", ":", "]", ")", "!=", "len", "(", "arg_1", "[", "1", ":", "]", ")", ":", "arg_2", "=", "False", "for", "arg_4", "in", "arg_1", "[", "1", ":", "]", ":", "if", "arg_4", "[", "2", "]", "<=", "0", ":", "print", "\"A synapse with zero permanence encountered\"", "arg_2", "=", "False", "if", "arg_2", "==", "True", ":", "for", "arg_4", "in", "arg_0", "[", "1", ":", "]", ":", "if", "arg_4", "[", "2", "]", "<=", "0", ":", "print", "\"A synapse with zero permanence encountered\"", "arg_2", "=", "False", "arg_5", "=", "sameSynapse", "(", "arg_4", ",", "arg_1", "[", "1", ":", "]", ")", "if", "arg_5", "==", "False", ":", "arg_2", "=", "False", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Return True if seg1 and seg2 are identical, ignoring order of synapses\"\"\"\n  arg_2 = True\n\n  # check sequence segment, total activations etc. In case any are floats,\n  # check that they are within 0.001.\n  for arg_3 in [1, 2, 3, 4, 5, 6]:\n    if abs(arg_0[0][arg_3] - arg_1[0][arg_3]) > 0.001:\n      arg_2 = False\n\n  # Compare number of synapses\n  if len(arg_0[1:]) != len(arg_1[1:]):\n    arg_2 = False\n\n  # Now compare synapses, ignoring order of synapses\n  for arg_4 in arg_1[1:]:\n    if arg_4[2] <= 0:\n      print \"A synapse with zero permanence encountered\"\n      arg_2 = False\n  if arg_2 == True:\n    for arg_4 in arg_0[1:]:\n      if arg_4[2] <= 0:\n        print \"A synapse with zero permanence encountered\"\n        arg_2 = False\n      arg_5 = sameSynapse(arg_4, arg_1[1:])\n      if arg_5 == False:\n        arg_2 = False\n\n  return arg_2", "path": "src/nupic/algorithms/fdrutilities.py", "identifier": "sameSegment", "docstring": "Return True if seg1 and seg2 are identical, ignoring order of synapses", "docstring_tokens": ["Return", "True", "if", "seg1", "and", "seg2", "are", "identical", "ignoring", "order", "of", "synapses"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260958}
{"url": "https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L437-L442", "sha": "557a25f37b1fb4e31a745719e237e42fff192834", "docstring_summary": "Prints a file on the device to console", "language": "python", "parameters": "(self, filename)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "log", ".", "info", "(", "'Printing '", "+", "arg_1", ")", "arg_2", "=", "arg_0", ".", "__exchange", "(", "PRINT_FILE", ".", "format", "(", "arg_1", "=", "arg_1", ")", ")", "log", ".", "info", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Prints a file on the device to console\"\"\"\n        log.info('Printing ' + arg_1)\n        arg_2 = arg_0.__exchange(PRINT_FILE.format(arg_1=arg_1))\n        log.info(arg_2)\n        return arg_2", "path": "nodemcu_uploader/uploader.py", "identifier": "Uploader.file_print", "docstring": "Prints a file on the device to console", "docstring_tokens": ["Prints", "a", "file", "on", "the", "device", "to", "console"], "nwo": "kmpm/nodemcu-uploader", "score": 0.3810531840267151, "idx": 260959}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/standard/cu3.py#L56-L58", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Apply cu3 from ctl to tgt with angle theta, phi, lam.", "language": "python", "parameters": "(self, theta, phi, lam, ctl, tgt)", "return_statement": "return self.append(Cu3Gate(theta, phi, lam), [ctl, tgt], [])", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "return", "arg_0", ".", "append", "(", "Cu3Gate", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "[", "arg_4", ",", "arg_5", "]", ",", "[", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Apply Func from ctl to tgt with angle theta, phi, lam.\"\"\"\n    return arg_0.append(Cu3Gate(arg_1, arg_2, arg_3), [arg_4, arg_5], [])", "path": "qiskit/extensions/standard/cu3.py", "identifier": "cu3", "docstring": "Apply cu3 from ctl to tgt with angle theta, phi, lam.", "docstring_tokens": ["Apply", "cu3", "from", "ctl", "to", "tgt", "with", "angle", "theta", "phi", "lam", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260960}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L98-L130", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Returns a list containing the names of all the modules available in the\n    folders of the pythonpath.", "language": "python", "parameters": "()", "return_statement": "return modules", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "get_ipython", "(", ")", "if", "'rootmodules'", "in", "arg_0", ".", "db", ":", "return", "arg_0", ".", "db", "[", "'rootmodules'", "]", "arg_1", "=", "time", "(", ")", "arg_2", "=", "False", "arg_3", "=", "list", "(", "sys", ".", "builtin_module_names", ")", "for", "arg_4", "in", "sys", ".", "path", ":", "arg_3", "+=", "module_list", "(", "arg_4", ")", "if", "time", "(", ")", "-", "arg_1", ">=", "TIMEOUT_STORAGE", "and", "not", "arg_2", ":", "arg_2", "=", "True", "print", "(", "\"\\nCaching the list of root modules, please wait!\"", ")", "print", "(", "\"(This will only be done once - type '%rehashx' to \"", "\"reset cache!)\\n\"", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "if", "time", "(", ")", "-", "arg_1", ">", "TIMEOUT_GIVEUP", ":", "print", "(", "\"This is taking too long, we give up.\\n\"", ")", "arg_0", ".", "db", "[", "'rootmodules'", "]", "=", "[", "]", "return", "[", "]", "arg_3", "=", "set", "(", "arg_3", ")", "if", "'__init__'", "in", "arg_3", ":", "arg_3", ".", "remove", "(", "'__init__'", ")", "arg_3", "=", "list", "(", "arg_3", ")", "if", "arg_2", ":", "arg_0", ".", "db", "[", "'rootmodules'", "]", "=", "arg_3", "return", "arg_3"], "function": "def Func():\n    \"\"\"\n    Returns a list containing the names of all the modules available in the\n    folders of the pythonpath.\n    \"\"\"\n    arg_0 = get_ipython()\n\n    if 'rootmodules' in arg_0.db:\n        return arg_0.db['rootmodules']\n\n    arg_1 = time()\n    arg_2 = False\n    arg_3 = list(sys.builtin_module_names)\n    for arg_4 in sys.path:\n        arg_3 += module_list(arg_4)\n        if time() - arg_1 >= TIMEOUT_STORAGE and not arg_2:\n            arg_2 = True\n            print(\"\\nCaching the list of root modules, please wait!\")\n            print(\"(This will only be done once - type '%rehashx' to \"\n                  \"reset cache!)\\n\")\n            sys.stdout.flush()\n        if time() - arg_1 > TIMEOUT_GIVEUP:\n            print(\"This is taking too long, we give up.\\n\")\n            arg_0.db['rootmodules'] = []\n            return []\n\n    arg_3 = set(arg_3)\n    if '__init__' in arg_3:\n        arg_3.remove('__init__')\n    arg_3 = list(arg_3)\n    if arg_2:\n        arg_0.db['rootmodules'] = arg_3\n    return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/core/completerlib.py", "identifier": "get_root_modules", "docstring": "Returns a list containing the names of all the modules available in the\n    folders of the pythonpath.", "docstring_tokens": ["Returns", "a", "list", "containing", "the", "names", "of", "all", "the", "modules", "available", "in", "the", "folders", "of", "the", "pythonpath", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 260961}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/inadyn.py#L70-L82", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Run inadyn from the commandline to test the configuration.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "_validate_settings", "(", ")", "arg_1", "=", "arg_0", ".", "local_renderer", "arg_1", ".", "env", ".", "alias", "=", "arg_1", ".", "env", ".", "aliases", "[", "0", "]", "arg_1", ".", "sudo", "(", "arg_1", ".", "env", ".", "Func_command_template", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Run inadyn from the commandline to test the configuration.\n\n        To be run like:\n\n            fab role inadyn.Func\n\n        \"\"\"\n        arg_0._validate_settings()\n        arg_1 = arg_0.local_renderer\n        arg_1.env.alias = arg_1.env.aliases[0]\n        arg_1.sudo(arg_1.env.Func_command_template)", "path": "burlap/inadyn.py", "identifier": "InadynSatchel.check", "docstring": "Run inadyn from the commandline to test the configuration.\n\n        To be run like:\n\n            fab role inadyn.check", "docstring_tokens": ["Run", "inadyn", "from", "the", "commandline", "to", "test", "the", "configuration", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 260962}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/organisation.py#L14-L21", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get information fot this organisation. Returns a dictionary of values.", "language": "python", "parameters": "(self, query_params=None)", "return_statement": "return self.fetch_json(\n            uri_path=self.base_uri,\n            query_params=query_params or {}\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "return", "arg_0", ".", "fetch_json", "(", "uri_path", "=", "arg_0", ".", "base_uri", ",", "arg_1", "=", "arg_1", "or", "{", "}", ")"], "function": "def Func(arg_0, arg_1=None):\n        '''\n        Get information fot this organisation. Returns a dictionary of values.\n        '''\n        return arg_0.fetch_json(\n            uri_path=arg_0.base_uri,\n            arg_1=arg_1 or {}\n        )", "path": "trolly/organisation.py", "identifier": "Organisation.get_organisation_information", "docstring": "Get information fot this organisation. Returns a dictionary of values.", "docstring_tokens": ["Get", "information", "fot", "this", "organisation", ".", "Returns", "a", "dictionary", "of", "values", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 260963}
{"url": "https://github.com/linuxwhatelse/mapper/blob/3481715b2a36d2da8bf5e9c6da80ceaed0d7ca59/mapper.py#L37-L62", "sha": "3481715b2a36d2da8bf5e9c6da80ceaed0d7ca59", "docstring_summary": "Return a Mapper instance with the given name.\n           If the name already exist return its instance.", "language": "python", "parameters": "(cls, name=__name__)", "return_statement": "return cls.__instances[name]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "arg_2", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "str", ")", ":", "raise", "TypeError", "(", "'A mapper name must be a string'", ")", "if", "arg_1", "not", "in", "arg_0", ".", "__instances", ":", "arg_0", ".", "__instances", "[", "arg_1", "]", "=", "arg_0", "(", ")", "arg_0", ".", "__instances", "[", "arg_1", "]", ".", "_name", "=", "arg_1", "return", "arg_0", ".", "__instances", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1=arg_2):\n        \"\"\"Return a Mapper instance with the given name.\n           If the name already exist return its instance.\n\n           Does not work if a Mapper was created via its constructor.\n\n           Using `Mapper.Func()`_ is the prefered way.\n\n        Args:\n            name (str, optional): Name for the newly created instance.\n                Defaults to `__name__`.\n\n        Returns:\n            Mapper: A mapper instance for the given name.\n\n        Raises:\n            TypeError: If a invalid name was given.\n        \"\"\"\n        if not isinstance(arg_1, str):\n            raise TypeError('A mapper name must be a string')\n\n        if arg_1 not in arg_0.__instances:\n            arg_0.__instances[arg_1] = arg_0()\n            arg_0.__instances[arg_1]._name = arg_1\n\n        return arg_0.__instances[arg_1]", "path": "mapper.py", "identifier": "Mapper.get", "docstring": "Return a Mapper instance with the given name.\n           If the name already exist return its instance.\n\n           Does not work if a Mapper was created via its constructor.\n\n           Using `Mapper.get()`_ is the prefered way.\n\n        Args:\n            name (str, optional): Name for the newly created instance.\n                Defaults to `__name__`.\n\n        Returns:\n            Mapper: A mapper instance for the given name.\n\n        Raises:\n            TypeError: If a invalid name was given.", "docstring_tokens": ["Return", "a", "Mapper", "instance", "with", "the", "given", "name", ".", "If", "the", "name", "already", "exist", "return", "its", "instance", "."], "nwo": "linuxwhatelse/mapper", "score": 0.0, "idx": 260964}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/message_parser.py#L87-L89", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Return start and end regex pattern sequences for simple Markdown tag.", "language": "python", "parameters": "(tag)", "return_statement": "return (MARKDOWN_START.format(tag=tag), MARKDOWN_END.format(tag=tag))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "MARKDOWN_START", ".", "format", "(", "arg_0", "=", "arg_0", ")", ",", "MARKDOWN_END", ".", "format", "(", "arg_0", "=", "arg_0", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Return start and end regex pattern sequences for simple Markdown tag.\"\"\"\n    return (MARKDOWN_START.format(arg_0=arg_0), MARKDOWN_END.format(arg_0=arg_0))", "path": "hangups/message_parser.py", "identifier": "markdown", "docstring": "Return start and end regex pattern sequences for simple Markdown tag.", "docstring_tokens": ["Return", "start", "and", "end", "regex", "pattern", "sequences", "for", "simple", "Markdown", "tag", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 260965}
{"url": "https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/config.py#L47-L73", "sha": "3c3497ca377fbbe937103b77b02b326c860c748f", "docstring_summary": "Retrieves the TidyPy issue reports that are available in the current Python\n    environment.", "language": "python", "parameters": "()", "return_statement": "return get_reports._CACHE", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "not", "hasattr", "(", "Func", ",", "'_CACHE'", ")", ":", "Func", ".", "_CACHE", "=", "dict", "(", ")", "for", "arg_2", "in", "pkg_resources", ".", "iter_entry_points", "(", "'tidypy.reports'", ")", ":", "try", ":", "Func", ".", "_CACHE", "[", "arg_2", ".", "name", "]", "=", "arg_2", ".", "load", "(", ")", "except", "ImportError", "as", "exc", ":", "output_error", "(", "'Could not load report \"%s\" defined by \"%s\": %s'", "%", "(", "arg_2", ",", "arg_2", ".", "dist", ",", "exc", ",", ")", ",", ")", "return", "Func", ".", "_CACHE"], "function": "def Func():\n    \"\"\"\n    Retrieves the TidyPy issue reports that are available in the current Python\n    environment.\n\n    The returned dictionary has keys are the report names and values are the\n    report classes.\n\n    :rtype: dict\n    \"\"\"\n\n    # pylint: disable=protected-access\n\n    if not hasattr(Func, '_CACHE'):\n        Func._CACHE = dict()\n        for arg_2 in pkg_resources.iter_entry_points('tidypy.reports'):\n            try:\n                Func._CACHE[arg_2.name] = arg_2.load()\n            except ImportError as exc:  # pragma: no cover\n                output_error(\n                    'Could not load report \"%s\" defined by \"%s\": %s' % (\n                        arg_2,\n                        arg_2.dist,\n                        exc,\n                    ),\n                )\n    return Func._CACHE", "path": "src/tidypy/config.py", "identifier": "get_reports", "docstring": "Retrieves the TidyPy issue reports that are available in the current Python\n    environment.\n\n    The returned dictionary has keys are the report names and values are the\n    report classes.\n\n    :rtype: dict", "docstring_tokens": ["Retrieves", "the", "TidyPy", "issue", "reports", "that", "are", "available", "in", "the", "current", "Python", "environment", "."], "nwo": "jayclassless/tidypy", "score": 0.5252270823742721, "idx": 260966}
{"url": "https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/client/client.py#L544-L566", "sha": "5bcc1c65323b1caf1f85adbefd9fc4988c072149", "docstring_summary": "HEADs the object and returns the results.", "language": "python", "parameters": "(self, container, obj, headers=None, query=None, cdn=False)", "return_statement": "return self.request(\n            'HEAD', path, '', headers, query=query, cdn=cdn)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "arg_6", "=", "arg_0", ".", "_object_path", "(", "arg_1", ",", "arg_2", ")", "return", "arg_0", ".", "request", "(", "'HEAD'", ",", "arg_6", ",", "''", ",", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=False):\n        \"\"\"\n        HEADs the object and returns the results.\n\n        :param container: The name of the container.\n        :param obj: The name of the object.\n        :param headers: Additional headers to send with the request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: is the str for the HTTP body.\n        \"\"\"\n        arg_6 = arg_0._object_path(arg_1, arg_2)\n        return arg_0.request(\n            'HEAD', arg_6, '', arg_3, arg_4=arg_4, arg_5=arg_5)", "path": "swiftly/client/client.py", "identifier": "Client.head_object", "docstring": "HEADs the object and returns the results.\n\n        :param container: The name of the container.\n        :param obj: The name of the object.\n        :param headers: Additional headers to send with the request.\n        :param query: Set to a dict of query values to send on the\n            query string of the request.\n        :param cdn: If set True, the CDN management interface will be\n            used.\n        :returns: A tuple of (status, reason, headers, contents).\n\n            :status: is an int for the HTTP status code.\n            :reason: is the str for the HTTP status (ex: \"Ok\").\n            :headers: is a dict with all lowercase keys of the HTTP\n                headers; if a header has multiple values, it will be a\n                list.\n            :contents: is the str for the HTTP body.", "docstring_tokens": ["HEADs", "the", "object", "and", "returns", "the", "results", "."], "nwo": "gholt/swiftly", "score": 0.3832805914510987, "idx": 260967}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/memory.py#L199-L214", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Translates the index to the internal offsets.", "language": "python", "parameters": "(self, index)", "return_statement": "return index", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_in_range", "(", "arg_1", ")", ":", "raise", "IndexError", "(", "'Map index out of range'", ")", "if", "isinstance", "(", "arg_1", ",", "slice", ")", ":", "arg_1", "=", "slice", "(", "arg_1", ".", "start", "-", "arg_0", ".", "start", ",", "arg_1", ".", "stop", "-", "arg_0", ".", "start", ")", "else", ":", "arg_1", "-=", "arg_0", ".", "start", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Translates the index to the internal offsets.\n\n        self.start   -> 0\n        self.start+1 -> 1\n        ...\n        self.end     -> len(self)\n        \"\"\"\n        if not arg_0._in_range(arg_1):\n            raise IndexError('Map index out of range')\n        if isinstance(arg_1, slice):\n            arg_1 = slice(arg_1.start - arg_0.start, arg_1.stop - arg_0.start)\n        else:\n            arg_1 -= arg_0.start\n        return arg_1", "path": "manticore/native/memory.py", "identifier": "Map._get_offset", "docstring": "Translates the index to the internal offsets.\n\n        self.start   -> 0\n        self.start+1 -> 1\n        ...\n        self.end     -> len(self)", "docstring_tokens": ["Translates", "the", "index", "to", "the", "internal", "offsets", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260968}
{"url": "https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/backend.py#L85-L117", "sha": "e9c19788285986ab789a2e2998f9a85d7524779f", "docstring_summary": "Optimize the model by the given options", "language": "python", "parameters": "(self, x, y=None, batch_size=32, nb_epoch=10, verbose=1, callbacks=None,\n            validation_split=0., validation_data=None, shuffle=True,\n            class_weight=None, sample_weight=None, initial_epoch=0, is_distributed=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "32", ",", "arg_4", "=", "10", ",", "arg_5", "=", "1", ",", "arg_6", "=", "None", ",", "arg_7", "=", "0.", ",", "arg_8", "=", "None", ",", "arg_9", "=", "True", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "0", ",", "arg_13", "=", "False", ")", ":", "if", "arg_6", ":", "raise", "Exception", "(", "\"We don't support callbacks in Func for now\"", ")", "if", "arg_10", ":", "unsupport_exp", "(", "\"class_weight\"", ")", "if", "arg_11", ":", "unsupport_exp", "(", "\"sample_weight\"", ")", "if", "arg_12", "!=", "0", ":", "unsupport_exp", "(", "\"initial_epoch\"", ")", "if", "arg_9", "!=", "True", ":", "unsupport_exp", "(", "\"shuffle\"", ")", "if", "arg_7", "!=", "0.", ":", "unsupport_exp", "(", "\"validation_split\"", ")", "arg_14", "=", "arg_0", ".", "__create_optimizer", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_8", "=", "arg_8", ",", "arg_13", "=", "arg_13", ")", "arg_14", ".", "optimize", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=32, arg_4=10, arg_5=1, arg_6=None,\n            arg_7=0., arg_8=None, arg_9=True,\n            arg_10=None, arg_11=None, arg_12=0, arg_13=False):\n        \"\"\"Optimize the model by the given options\n\n        :param x: ndarray or list of ndarray for local mode.\n                  RDD[Sample] for distributed mode\n        :param y: ndarray or list of ndarray for local mode and would be None for cluster mode.\n            is_distributed: used to control run in local or cluster. the default value is False.\n            NB: if is_distributed=true, x should be RDD[Sample] and y should be None\n        :param is_distributed: Whether to train in local mode or distributed mode\n        :return:\n            A Numpy array or RDD[Sample] of predictions.\n        \"\"\"\n        if arg_6:\n            raise Exception(\"We don't support callbacks in Func for now\")\n        if arg_10:\n            unsupport_exp(\"class_weight\")\n        if arg_11:\n            unsupport_exp(\"sample_weight\")\n        if arg_12 != 0:\n            unsupport_exp(\"initial_epoch\")\n        if arg_9 != True:\n            unsupport_exp(\"shuffle\")\n        if arg_7 != 0.:\n            unsupport_exp(\"validation_split\")\n        arg_14 = arg_0.__create_optimizer(arg_1=arg_1,\n                                       arg_2=arg_2,\n                                       arg_3=arg_3,\n                                       arg_4=arg_4,\n                                       arg_8=arg_8,\n                                       arg_13=arg_13)\n        arg_14.optimize()", "path": "pyspark/bigdl/keras/backend.py", "identifier": "KerasModelWrapper.fit", "docstring": "Optimize the model by the given options\n\n        :param x: ndarray or list of ndarray for local mode.\n                  RDD[Sample] for distributed mode\n        :param y: ndarray or list of ndarray for local mode and would be None for cluster mode.\n            is_distributed: used to control run in local or cluster. the default value is False.\n            NB: if is_distributed=true, x should be RDD[Sample] and y should be None\n        :param is_distributed: Whether to train in local mode or distributed mode\n        :return:\n            A Numpy array or RDD[Sample] of predictions.", "docstring_tokens": ["Optimize", "the", "model", "by", "the", "given", "options"], "nwo": "intel-analytics/BigDL", "score": 0.993379033704172, "idx": 260969}
{"url": "https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L298-L313", "sha": "def62f8f2d77b168aa2bd115290aaa0f9a08a4bb", "docstring_summary": "Creates a geotiff on the filesystem", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return to_geotiff(self, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "if", "'proj'", "not", "in", "arg_1", ":", "arg_1", "[", "'proj'", "]", "=", "arg_0", ".", "proj", "return", "to_Func", "(", "arg_0", ",", "**", "arg_1", ")"], "function": "def Func(arg_0, **arg_1):\n        \"\"\" Creates a Func on the filesystem\n\n        Args:\n            path (str): optional, path to write the Func file to, default is ./output.tif\n            proj (str): optional, EPSG string of projection to reproject to\n            spec (str): optional, if set to 'rgb', write out color-balanced 8-bit RGB tif\n            bands (list): optional, list of bands to export. If spec='rgb' will default to RGB bands,\n                otherwise will export all bands\n\n        Returns:\n            str: path the Func was written to \"\"\"\n\n        if 'proj' not in arg_1:\n            arg_1['proj'] = arg_0.proj\n        return to_Func(arg_0, **arg_1)", "path": "gbdxtools/images/meta.py", "identifier": "GeoDaskImage.geotiff", "docstring": "Creates a geotiff on the filesystem\n\n        Args:\n            path (str): optional, path to write the geotiff file to, default is ./output.tif\n            proj (str): optional, EPSG string of projection to reproject to\n            spec (str): optional, if set to 'rgb', write out color-balanced 8-bit RGB tif\n            bands (list): optional, list of bands to export. If spec='rgb' will default to RGB bands,\n                otherwise will export all bands\n\n        Returns:\n            str: path the geotiff was written to", "docstring_tokens": ["Creates", "a", "geotiff", "on", "the", "filesystem"], "nwo": "DigitalGlobe/gbdxtools", "score": 0.4537720374076596, "idx": 260970}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/files.py#L290-L344", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Run the executable and capture the input and output...", "language": "python", "parameters": "(repo, args, includes)", "return_statement": "return files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "plugins_get_mgr", "(", ")", "arg_4", "=", "arg_3", ".", "get", "(", "what", "=", "'instrumentation'", ",", "name", "=", "'platform'", ")", "arg_5", "=", "arg_4", ".", "get_metadata", "(", ")", "print", "(", "\"Obtaining Commit Information\"", ")", "(", "arg_6", ",", "arg_7", ")", "=", "find_executable_commitpath", "(", "arg_0", ",", "arg_1", ")", "arg_8", "=", "tempfile", ".", "mkdtemp", "(", ")", "print", "(", "\"Running the command\"", ")", "arg_9", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "'strace.out.txt'", ")", "arg_10", "=", "[", "\"strace.py\"", ",", "\"-f\"", ",", "\"-o\"", ",", "arg_9", ",", "\"-s\"", ",", "\"1024\"", ",", "\"-q\"", ",", "\"--\"", "]", "+", "arg_1", "arg_11", "=", "subprocess", ".", "Popen", "(", "arg_10", ",", "arg_14", "=", "subprocess", ".", "PIPE", ",", "arg_15", "=", "subprocess", ".", "PIPE", ")", "arg_12", ",", "arg_13", "=", "arg_11", ".", "communicate", "(", ")", "arg_14", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "'stdout.log.txt'", ")", "with", "open", "(", "arg_14", ",", "'w'", ")", "as", "fd", ":", "fd", ".", "write", "(", "arg_12", ".", "decode", "(", "'utf-8'", ")", ")", "arg_15", "=", "os", ".", "path", ".", "join", "(", "arg_8", ",", "'stderr.log.txt'", ")", "with", "open", "(", "arg_15", ",", "'w'", ")", "as", "fd", ":", "fd", ".", "write", "(", "arg_13", ".", "decode", "(", "'utf-8'", ")", ")", "arg_16", "=", "extract_files", "(", "arg_9", ",", "arg_2", ")", "arg_17", "=", "{", "'likelyexecutable'", ":", "arg_6", ",", "'commitpath'", ":", "arg_7", ",", "'args'", ":", "arg_1", ",", "}", "arg_17", ".", "update", "(", "arg_5", ")", "for", "arg_18", "in", "range", "(", "len", "(", "arg_16", ")", ")", ":", "arg_16", "[", "arg_18", "]", "[", "'execution_metadata'", "]", "=", "arg_17", "return", "arg_16"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Run the executable and capture the input and output...\n    \"\"\"\n\n    # Get platform information\n    arg_3 = plugins_get_mgr()\n    arg_4 = arg_3.get(what='instrumentation', name='platform')\n    arg_5 = arg_4.get_metadata()\n\n    print(\"Obtaining Commit Information\")\n    (arg_6, arg_7) = \\\n            find_executable_commitpath(arg_0, arg_1)\n\n    # Create a local directory\n    arg_8 = tempfile.mkdtemp()\n\n    # Construct the strace command\n    print(\"Running the command\")\n    arg_9 = os.path.join(arg_8,'strace.out.txt')\n    arg_10 = [\"strace.py\", \"-f\", \"-o\", arg_9,\n           \"-s\", \"1024\", \"-q\", \"--\"] + arg_1\n\n    # Run the command\n    arg_11 = subprocess.Popen(arg_10,\n                         arg_14=subprocess.PIPE,\n                         arg_15=subprocess.PIPE)\n    arg_12, arg_13 = arg_11.communicate()\n\n    # Capture the stdout/stderr\n    arg_14 = os.path.join(arg_8, 'stdout.log.txt')\n    with open(arg_14, 'w') as fd:\n        fd.write(arg_12.decode('utf-8'))\n\n    arg_15 = os.path.join(arg_8, 'stderr.log.txt')\n    with open(arg_15, 'w') as fd:\n        fd.write(arg_13.decode('utf-8'))\n\n\n    # Check the strace output\n    arg_16 = extract_files(arg_9, arg_2)\n\n\n    # Now insert the execution metadata\n    arg_17 = {\n        'likelyexecutable': arg_6,\n        'commitpath': arg_7,\n        'args': arg_1,\n    }\n    arg_17.update(arg_5)\n\n    for arg_18 in range(len(arg_16)):\n        arg_16[arg_18]['execution_metadata'] = arg_17\n\n    return arg_16", "path": "dgitcore/datasets/files.py", "identifier": "run_executable", "docstring": "Run the executable and capture the input and output...", "docstring_tokens": ["Run", "the", "executable", "and", "capture", "the", "input", "and", "output", "..."], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 260971}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/base_graph.py#L495-L516", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Removes an edge from the graph. Returns the deleted edge or None.", "language": "python", "parameters": "(self, tail_node_or_ID, head_node_or_ID)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "isinstance", "(", "arg_1", ",", "Node", ")", ":", "arg_3", "=", "arg_1", "else", ":", "arg_3", "=", "arg_0", ".", "get_node", "(", "arg_1", ")", "if", "isinstance", "(", "arg_2", ",", "Node", ")", ":", "arg_4", "=", "arg_2", "else", ":", "arg_4", "=", "arg_0", ".", "get_node", "(", "arg_2", ")", "if", "(", "arg_3", "is", "None", ")", "or", "(", "arg_4", "is", "None", ")", ":", "return", "None", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_0", ".", "edges", ")", ":", "if", "(", "arg_6", ".", "tail_node", "==", "arg_3", ")", "and", "(", "arg_6", ".", "head_node", "==", "arg_4", ")", ":", "arg_6", "=", "arg_0", ".", "edges", ".", "pop", "(", "arg_5", ")", "return", "arg_6", "return", "None"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Removes an edge from the graph. Returns the deleted edge or None.\n        \"\"\"\n        if isinstance(arg_1, Node):\n            arg_3 = arg_1\n        else:\n            arg_3 = arg_0.get_node(arg_1)\n\n        if isinstance(arg_2, Node):\n            arg_4 = arg_2\n        else:\n            arg_4 = arg_0.get_node(arg_2)\n\n        if (arg_3 is None) or (arg_4 is None):\n            return None\n\n        for arg_5, arg_6 in enumerate(arg_0.edges):\n            if (arg_6.tail_node == arg_3) and (arg_6.head_node == arg_4):\n                arg_6 = arg_0.edges.pop(arg_5)\n                return arg_6\n\n        return None", "path": "godot/base_graph.py", "identifier": "BaseGraph.delete_edge", "docstring": "Removes an edge from the graph. Returns the deleted edge or None.", "docstring_tokens": ["Removes", "an", "edge", "from", "the", "graph", ".", "Returns", "the", "deleted", "edge", "or", "None", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 260972}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/flame_graph.py#L88-L101", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Reformats call tree for the UI.", "language": "python", "parameters": "(self, node, total_samples)", "return_statement": "return {\n            'stack': node['stack'],\n            'children': [self._format_tree(child, total_samples)\n                         for child in node['children']],\n            'sampleCount': node['sampleCount'],\n            'samplePercentage': sample_percent,\n            'colorHash': color_hash\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_1", "[", "'stack'", "]", "arg_6", "=", "arg_0", ".", "_get_percentage", "(", "arg_1", "[", "'sampleCount'", "]", ",", "arg_2", ")", "arg_7", "=", "base_profiler", ".", "hash_name", "(", "'%s @ %s'", "%", "(", "arg_3", ",", "arg_4", ")", ")", "return", "{", "'stack'", ":", "arg_1", "[", "'stack'", "]", ",", "'children'", ":", "[", "arg_0", ".", "Func", "(", "arg_8", ",", "arg_2", ")", "for", "arg_8", "in", "arg_1", "[", "'children'", "]", "]", ",", "'sampleCount'", ":", "arg_1", "[", "'sampleCount'", "]", ",", "'samplePercentage'", ":", "arg_6", ",", "'colorHash'", ":", "arg_7", "}"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Reformats call tree for the UI.\"\"\"\n        arg_3, arg_4, arg_5 = arg_1['stack']\n        arg_6 = arg_0._get_percentage(\n            arg_1['sampleCount'], arg_2)\n        arg_7 = base_profiler.hash_name('%s @ %s' % (arg_3, arg_4))\n        return {\n            'stack': arg_1['stack'],\n            'children': [arg_0.Func(arg_8, arg_2)\n                         for arg_8 in arg_1['children']],\n            'sampleCount': arg_1['sampleCount'],\n            'samplePercentage': arg_6,\n            'colorHash': arg_7\n        }", "path": "vprof/flame_graph.py", "identifier": "_StatProfiler._format_tree", "docstring": "Reformats call tree for the UI.", "docstring_tokens": ["Reformats", "call", "tree", "for", "the", "UI", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 260973}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/latent_dirichlet_allocation_distributions.py#L225-L255", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Create the prior distribution.", "language": "python", "parameters": "(num_topics, initial_value)", "return_statement": "return prior, prior_variables", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "_softplus_inverse", "(", "arg_2", ")", ":", "return", "np", ".", "log", "(", "np", ".", "expm1", "(", "arg_2", ")", ")", "arg_3", "=", "tf", ".", "compat", ".", "v1", ".", "get_variable", "(", "\"logit_concentration\"", ",", "shape", "=", "[", "1", ",", "arg_0", "]", ",", "initializer", "=", "tf", ".", "compat", ".", "v1", ".", "initializers", ".", "constant", "(", "_softplus_inverse", "(", "arg_1", ")", ")", ")", "arg_4", "=", "_clip_dirichlet_parameters", "(", "tf", ".", "nn", ".", "softplus", "(", "arg_3", ")", ")", "def", "prior", "(", ")", ":", "return", "tfd", ".", "Dirichlet", "(", "arg_4", "=", "arg_4", ",", "name", "=", "\"topics_prior\"", ")", "arg_5", "=", "[", "arg_3", "]", "return", "prior", ",", "arg_5"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Create the prior distribution.\n\n  Args:\n    num_topics: Number of topics.\n    initial_value: The starting value for the prior parameters.\n\n  Returns:\n    prior: A `callable` that returns a `tf.distribution.Distribution`\n        instance, the prior distribution.\n    prior_variables: A `list` of `Variable` objects, the trainable parameters\n        of the prior.\n  \"\"\"\n  def _softplus_inverse(arg_2):\n    return np.log(np.expm1(arg_2))\n\n  arg_3 = tf.compat.v1.get_variable(\n      \"logit_concentration\",\n      shape=[1, arg_0],\n      initializer=tf.compat.v1.initializers.constant(\n          _softplus_inverse(arg_1)))\n  arg_4 = _clip_dirichlet_parameters(\n      tf.nn.softplus(arg_3))\n\n  def prior():\n    return tfd.Dirichlet(arg_4=arg_4,\n                         name=\"topics_prior\")\n\n  arg_5 = [arg_3]\n\n  return prior, arg_5", "path": "tensorflow_probability/examples/latent_dirichlet_allocation_distributions.py", "identifier": "make_prior", "docstring": "Create the prior distribution.\n\n  Args:\n    num_topics: Number of topics.\n    initial_value: The starting value for the prior parameters.\n\n  Returns:\n    prior: A `callable` that returns a `tf.distribution.Distribution`\n        instance, the prior distribution.\n    prior_variables: A `list` of `Variable` objects, the trainable parameters\n        of the prior.", "docstring_tokens": ["Create", "the", "prior", "distribution", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 260974}
{"url": "https://github.com/amcat/progressmonitor/blob/d4cabebc95bfd1447120f601c094b20bee954285/progressmonitor/__init__.py#L10-L31", "sha": "d4cabebc95bfd1447120f601c094b20bee954285", "docstring_summary": "Decorate a function to automatically begin and end a task on the progressmonitor.\n    The function must have a parameter called 'monitor'", "language": "python", "parameters": "(total: int, name=None, message=None)", "return_statement": "return decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "def", "decorator", "(", "arg_4", ")", ":", "nonlocal", "arg_2", "arg_5", "=", "list", "(", "inspect", ".", "signature", "(", "arg_4", ")", ".", "parameters", ".", "keys", "(", ")", ")", ".", "index", "(", "'monitor'", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_4", ".", "__name__", "@", "wraps", "(", "arg_4", ")", "def", "wrapper", "(", "*", "arg_6", ",", "**", "arg_7", ")", ":", "if", "len", "(", "arg_6", ")", ">", "arg_5", ":", "arg_8", "=", "arg_6", "[", "arg_5", "]", "elif", "'monitor'", "in", "arg_7", ":", "arg_8", "=", "arg_7", "[", "'monitor'", "]", "else", ":", "arg_8", "=", "arg_7", "[", "'monitor'", "]", "=", "NullMonitor", "(", ")", "with", "arg_8", ".", "task", "(", "arg_0", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "(", "*", "arg_6", ",", "**", "arg_7", ")", "return", "wrapper", "return", "decorator"], "function": "def Func(arg_0: arg_1, arg_2=None, arg_3=None):\n    \"\"\"\n    Decorate a function to automatically begin and end a task on the progressmonitor.\n    The function must have a parameter called 'monitor'\n    \"\"\"\n    def decorator(arg_4):\n        nonlocal arg_2\n        arg_5 = list(inspect.signature(arg_4).parameters.keys()).index('monitor')\n        if arg_2 is None:\n            arg_2=arg_4.__name__\n        @wraps(arg_4)\n        def wrapper(*arg_6, **arg_7):\n            if len(arg_6) > arg_5:\n                arg_8 = arg_6[arg_5]\n            elif 'monitor' in arg_7:\n                arg_8 = arg_7['monitor']\n            else:\n                arg_8 = arg_7['monitor'] = NullMonitor()\n            with arg_8.task(arg_0, arg_2, arg_3):\n                arg_4(*arg_6, **arg_7)\n        return wrapper\n    return decorator", "path": "progressmonitor/__init__.py", "identifier": "monitored", "docstring": "Decorate a function to automatically begin and end a task on the progressmonitor.\n    The function must have a parameter called 'monitor'", "docstring_tokens": ["Decorate", "a", "function", "to", "automatically", "begin", "and", "end", "a", "task", "on", "the", "progressmonitor", ".", "The", "function", "must", "have", "a", "parameter", "called", "monitor"], "nwo": "amcat/progressmonitor", "score": 0.0, "idx": 260975}
{"url": "https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/lib.py#L134-L156", "sha": "75db8b5d8de9d53ae95e74195a788b5f6db2cb5f", "docstring_summary": "Add Pyblish to file-menu", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "if", "hasattr", "(", "cmds", ",", "'about'", ")", "and", "not", "cmds", ".", "about", "(", "batch", "=", "True", ")", ":", "mel", ".", "eval", "(", "\"evalDeferred buildFileMenu\"", ")", "arg_0", "=", "inspect", ".", "getsource", "(", "_Func", ")", "arg_0", "+=", "\"\\n_Func()\"", "cmds", ".", "evalDeferred", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"Add Pyblish to file-menu\n\n    .. note:: We're going a bit hacky here, probably due to my lack\n        of understanding for `evalDeferred` or `executeDeferred`,\n        so if you can think of a better solution, feel free to edit.\n\n    \"\"\"\n\n    if hasattr(cmds, 'about') and not cmds.about(batch=True):\n        # As Maya builds its menus dynamically upon being accessed,\n        # we force its build here prior to adding our entry using it's\n        # native mel function call.\n        mel.eval(\"evalDeferred buildFileMenu\")\n\n        # Serialise function into string\n        arg_0 = inspect.getsource(_Func)\n        arg_0 += \"\\n_Func()\"\n\n        # If cmds doesn't have any members, we're most likely in an\n        # uninitialized batch-mode. It it does exists, ensure we\n        # really aren't in batch mode.\n        cmds.evalDeferred(arg_0)", "path": "pyblish_maya/lib.py", "identifier": "add_to_filemenu", "docstring": "Add Pyblish to file-menu\n\n    .. note:: We're going a bit hacky here, probably due to my lack\n        of understanding for `evalDeferred` or `executeDeferred`,\n        so if you can think of a better solution, feel free to edit.", "docstring_tokens": ["Add", "Pyblish", "to", "file", "-", "menu"], "nwo": "pyblish/pyblish-maya", "score": 0.2882244563058713, "idx": 260976}
{"url": "https://github.com/andreikop/python-ws-discovery/blob/a7b852cf43115c6f986e509b1870d6963e76687f/wsdiscovery/daemon.py#L547-L553", "sha": "a7b852cf43115c6f986e509b1870d6963e76687f", "docstring_summary": "send Bye messages for the services and remove them", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "list", "(", "arg_0", ".", "_localServices", ".", "values", "(", ")", ")", ":", "arg_0", ".", "_sendBye", "(", "arg_1", ")", "arg_0", ".", "_localServices", ".", "clear", "(", ")"], "function": "def Func(arg_0):\n        'send Bye messages for the services and remove them'\n\n        for arg_1 in list(arg_0._localServices.values()):\n            arg_0._sendBye(arg_1)\n\n        arg_0._localServices.clear()", "path": "wsdiscovery/daemon.py", "identifier": "WSDiscovery.clearLocalServices", "docstring": "send Bye messages for the services and remove them", "docstring_tokens": ["send", "Bye", "messages", "for", "the", "services", "and", "remove", "them"], "nwo": "andreikop/python-ws-discovery", "score": 0.7152725855878354, "idx": 260977}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L119-L129", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Return a managed file-like object into which the calling code can write\n        arbitrary data.", "language": "python", "parameters": "(self, key, binary=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "io", ".", "BytesIO", "(", ")", "if", "arg_2", "else", "io", ".", "StringIO", "(", ")", "yield", "arg_3", "arg_0", ".", "save_value", "(", "arg_1", ",", "arg_3", ".", "getvalue", "(", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Return a managed file-like object into which the calling code can write\n        arbitrary data.\n\n        :param key:\n        :return: A managed stream-like object\n        \"\"\"\n        arg_3 = io.BytesIO() if arg_2 else io.StringIO()\n        yield arg_3\n        arg_0.save_value(arg_1, arg_3.getvalue())", "path": "manticore/core/workspace.py", "identifier": "Store.save_stream", "docstring": "Return a managed file-like object into which the calling code can write\n        arbitrary data.\n\n        :param key:\n        :return: A managed stream-like object", "docstring_tokens": ["Return", "a", "managed", "file", "-", "like", "object", "into", "which", "the", "calling", "code", "can", "write", "arbitrary", "data", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 260978}
{"url": "https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L158-L163", "sha": "7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f", "docstring_summary": "Remove logbook menu set.", "language": "python", "parameters": "(self, menu=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_0", ".", "logMenuCount", ">", "1", "and", "arg_1", "is", "not", "None", ":", "arg_1", ".", "removeMenu", "(", ")", "arg_0", ".", "logMenus", ".", "remove", "(", "arg_1", ")", "arg_0", ".", "logMenuCount", "-=", "1"], "function": "def Func(arg_0, arg_1=None):\n        '''Remove logbook menu set.'''\n        if arg_0.logMenuCount > 1 and arg_1 is not None:\n            arg_1.removeMenu()\n            arg_0.logMenus.remove(arg_1)\n            arg_0.logMenuCount -= 1", "path": "scisalt/facettools/logbookForm.py", "identifier": "logbookForm.removeLogbook", "docstring": "Remove logbook menu set.", "docstring_tokens": ["Remove", "logbook", "menu", "set", "."], "nwo": "joelfrederico/SciSalt", "score": 0.09252797783733271, "idx": 260979}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch_v2.py#L337-L350", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the modelID of the model with the given paramsHash, or\n    None if not found.", "language": "python", "parameters": "(self, paramsHash)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_paramsHashToIndexes", ".", "get", "(", "arg_1", ",", "None", ")", "if", "arg_2", "is", "not", "None", ":", "return", "arg_0", ".", "_allResults", "[", "arg_2", "]", "[", "'modelID'", "]", "else", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Return the modelID of the model with the given paramsHash, or\n    None if not found.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    paramsHash:  paramsHash to look for\n    retval:      modelId, or None if not found\n    \"\"\"\n    arg_2 = arg_0. _paramsHashToIndexes.get(arg_1, None)\n    if arg_2 is not None:\n      return arg_0._allResults[arg_2]['modelID']\n    else:\n      return None", "path": "src/nupic/swarming/hypersearch_v2.py", "identifier": "ResultsDB.getModelIDFromParamsHash", "docstring": "Return the modelID of the model with the given paramsHash, or\n    None if not found.\n\n    Parameters:\n    ---------------------------------------------------------------------\n    paramsHash:  paramsHash to look for\n    retval:      modelId, or None if not found", "docstring_tokens": ["Return", "the", "modelID", "of", "the", "model", "with", "the", "given", "paramsHash", "or", "None", "if", "not", "found", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 260980}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/build.py#L226-L250", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "a specific function to take a blob, along with a SUCCESS response\n       from Google build, the original config, and update the blob \n       metadata with the artifact file name, dependencies, and image hash.", "language": "python", "parameters": "(blob, response, config, bucket, names)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "os", ".", "path", ".", "basename", "(", "arg_1", "[", "'results'", "]", "[", "'artifactManifest'", "]", ")", "arg_5", "=", "json", ".", "loads", "(", "arg_3", ".", "blob", "(", "arg_5", ")", ".", "download_as_string", "(", ")", ")", "arg_6", "=", "{", "'file_hash'", ":", "arg_5", "[", "'file_hash'", "]", "[", "0", "]", "[", "'file_hash'", "]", "[", "0", "]", "[", "'value'", "]", ",", "'artifactManifest'", ":", "arg_1", "[", "'results'", "]", "[", "'artifactManifest'", "]", ",", "'location'", ":", "arg_5", "[", "'location'", "]", ",", "'storageSourceBucket'", ":", "arg_2", "[", "'source'", "]", "[", "'storageSource'", "]", "[", "'bucket'", "]", ",", "'storageSourceObject'", ":", "arg_2", "[", "'source'", "]", "[", "'storageSource'", "]", "[", "'object'", "]", ",", "'buildCommand'", ":", "' '", ".", "join", "(", "arg_2", "[", "'steps'", "]", "[", "0", "]", "[", "'args'", "]", ")", ",", "'builder'", ":", "arg_2", "[", "'steps'", "]", "[", "0", "]", "[", "'name'", "]", ",", "'media_link'", ":", "arg_0", ".", "media_link", ",", "'self_link'", ":", "arg_0", ".", "self_link", ",", "'size'", ":", "arg_0", ".", "size", ",", "'name'", ":", "arg_4", "[", "'tag_uri'", "]", ",", "'type'", ":", "\"container\"", "}", "arg_0", ".", "metadata", "=", "arg_6", "arg_0", ".", "_properties", "[", "'metadata'", "]", "=", "arg_6", "arg_0", ".", "patch", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    '''a specific function to take a blob, along with a SUCCESS response\n       from Google build, the original config, and update the blob \n       metadata with the artifact file name, dependencies, and image hash.\n    '''\n\n    arg_5 = os.path.basename(arg_1['results']['artifactManifest'])\n    arg_5 = json.loads(arg_3.blob(arg_5).download_as_string())\n\n    arg_6 = {'file_hash': arg_5['file_hash'][0]['file_hash'][0]['value'],\n                'artifactManifest': arg_1['results']['artifactManifest'],\n                'location': arg_5['location'],\n                'storageSourceBucket': arg_2['source']['storageSource']['bucket'],\n                'storageSourceObject': arg_2['source']['storageSource']['object'],\n                'buildCommand': ' '.join(arg_2['steps'][0]['args']),\n                'builder': arg_2['steps'][0]['name'],\n                'media_link': arg_0.media_link,\n                'self_link': arg_0.self_link,\n                'size': arg_0.size,\n                'name': arg_4['tag_uri'],\n                'type': \"container\"} # identifier that the blob is a container\n\n    arg_0.metadata = arg_6   \n    arg_0._properties['metadata'] = arg_6\n    arg_0.patch()", "path": "sregistry/main/google_build/build.py", "identifier": "update_blob_metadata", "docstring": "a specific function to take a blob, along with a SUCCESS response\n       from Google build, the original config, and update the blob \n       metadata with the artifact file name, dependencies, and image hash.", "docstring_tokens": ["a", "specific", "function", "to", "take", "a", "blob", "along", "with", "a", "SUCCESS", "response", "from", "Google", "build", "the", "original", "config", "and", "update", "the", "blob", "metadata", "with", "the", "artifact", "file", "name", "dependencies", "and", "image", "hash", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 260981}
{"url": "https://github.com/cltrudeau/waelstow/blob/f67ad5e86f1ef447d6c6ae3e6845bdae83f2d837/waelstow.py#L198-L217", "sha": "f67ad5e86f1ef447d6c6ae3e6845bdae83f2d837", "docstring_summary": "This ``Context Manager`` redirects STDERR to a ``StringIO`` objects\n    which is returned from the ``Context``.  On exit STDERR is restored.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "arg_2", ".", "stderr", "try", ":", "arg_1", "=", "StringIO", "(", ")", "arg_2", ".", "stderr", "=", "arg_1", "yield", "arg_1", "finally", ":", "arg_2", ".", "stderr", "=", "arg_0"], "function": "def Func():\n    \"\"\"This ``Context Manager`` redirects STDERR to a ``StringIO`` objects\n    which is returned from the ``Context``.  On exit STDERR is restored.\n\n    Example:\n\n    .. code-block:: python\n\n        with Func() as capture:\n            print('foo')\n\n        # got here? => capture.getvalue() will now have \"foo\\\\n\"\n    \"\"\"\n    arg_0 = arg_2.stderr\n    try:\n        arg_1 = StringIO()\n        arg_2.stderr = arg_1\n        yield arg_1\n    finally:\n        arg_2.stderr = arg_0", "path": "waelstow.py", "identifier": "capture_stderr", "docstring": "This ``Context Manager`` redirects STDERR to a ``StringIO`` objects\n    which is returned from the ``Context``.  On exit STDERR is restored.\n\n    Example:\n\n    .. code-block:: python\n\n        with capture_stderr() as capture:\n            print('foo')\n\n        # got here? => capture.getvalue() will now have \"foo\\\\n\"", "docstring_tokens": ["This", "Context", "Manager", "redirects", "STDERR", "to", "a", "StringIO", "objects", "which", "is", "returned", "from", "the", "Context", ".", "On", "exit", "STDERR", "is", "restored", "."], "nwo": "cltrudeau/waelstow", "score": 0.17782712273869106, "idx": 260982}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/legend.py#L728-L747", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Get the attribute of a component.", "language": "python", "parameters": "(self, c, attr, default=None, match_only=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_5", "=", "arg_0", ".", "get_decor", "(", "arg_1", ",", "arg_4", "=", "arg_4", ")", "try", ":", "return", "Func", "(", "arg_5", ",", "arg_2", ")", "except", "AttributeError", ":", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n        \"\"\"\n        Get the attribute of a component.\n\n        Args:\n           c (component): The component to look up.\n           attr (str): The attribute to get.\n           default (str): What to return in the event of no match.\n           match_only (list of str): The component attributes to include in the\n               comparison. Default: All of them.\n\n        Returns:\n           obj. The specified attribute of the matching Decor in the Legend.\n        \"\"\"\n        arg_5 = arg_0.get_decor(arg_1, arg_4=arg_4)\n\n        try:\n            return Func(arg_5, arg_2)\n        except AttributeError:\n            return arg_3", "path": "striplog/legend.py", "identifier": "Legend.getattr", "docstring": "Get the attribute of a component.\n\n        Args:\n           c (component): The component to look up.\n           attr (str): The attribute to get.\n           default (str): What to return in the event of no match.\n           match_only (list of str): The component attributes to include in the\n               comparison. Default: All of them.\n\n        Returns:\n           obj. The specified attribute of the matching Decor in the Legend.", "docstring_tokens": ["Get", "the", "attribute", "of", "a", "component", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 260983}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/scram.py#L369-L397", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Process success indicator from the server.", "language": "python", "parameters": "(self, data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_0", ".", "_server_first_message", ":", "logger", ".", "debug", "(", "\"Got success too early\"", ")", "return", "Failure", "(", "\"bad-success\"", ")", "if", "arg_0", ".", "_Funced", ":", "return", "Success", "(", "{", "\"username\"", ":", "arg_0", ".", "username", ",", "\"authzid\"", ":", "arg_0", ".", "authzid", "}", ")", "else", ":", "arg_2", "=", "arg_0", ".", "_final_challenge", "(", "arg_1", ")", "if", "isinstance", "(", "arg_2", ",", "Failure", ")", ":", "return", "arg_2", "if", "arg_0", ".", "_Funced", ":", "return", "Success", "(", "{", "\"username\"", ":", "arg_0", ".", "username", ",", "\"authzid\"", ":", "arg_0", ".", "authzid", "}", ")", "else", ":", "logger", ".", "debug", "(", "\"Something went wrong when processing additional\"", "\" data with success?\"", ")", "return", "Failure", "(", "\"bad-success\"", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Process success indicator from the server.\n\n        Process any addiitional data passed with the success.\n        Fail if the server was not authenticated.\n\n        :Parameters:\n            - `data`: an optional additional data with success.\n        :Types:\n            - `data`: `bytes`\n\n        :return: success or failure indicator.\n        :returntype: `sasl.Success` or `sasl.Failure`\"\"\"\n        if not arg_0._server_first_message:\n            logger.debug(\"Got success too early\")\n            return Failure(\"bad-success\")\n        if arg_0._Funced:\n            return Success({\"username\": arg_0.username, \"authzid\": arg_0.authzid})\n        else:\n            arg_2 = arg_0._final_challenge(arg_1)\n            if isinstance(arg_2, Failure):\n                return arg_2\n            if arg_0._Funced:\n                return Success({\"username\": arg_0.username,\n                                                    \"authzid\": arg_0.authzid})\n            else:\n                logger.debug(\"Something went wrong when processing additional\"\n                                                        \" data with success?\")\n                return Failure(\"bad-success\")", "path": "pyxmpp2/sasl/scram.py", "identifier": "SCRAMClientAuthenticator.finish", "docstring": "Process success indicator from the server.\n\n        Process any addiitional data passed with the success.\n        Fail if the server was not authenticated.\n\n        :Parameters:\n            - `data`: an optional additional data with success.\n        :Types:\n            - `data`: `bytes`\n\n        :return: success or failure indicator.\n        :returntype: `sasl.Success` or `sasl.Failure`", "docstring_tokens": ["Process", "success", "indicator", "from", "the", "server", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 260984}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/SAM.py#L54-L59", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Reset the parameters.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "1.", "/", "math", ".", "sqrt", "(", "arg_0", ".", "weight", ".", "size", "(", "1", ")", ")", "arg_0", ".", "weight", ".", "data", ".", "uniform_", "(", "-", "arg_1", ",", "arg_1", ")", "if", "arg_0", ".", "bias", "is", "not", "None", ":", "arg_0", ".", "bias", ".", "data", ".", "uniform_", "(", "-", "arg_1", ",", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Reset the parameters.\"\"\"\n        arg_1 = 1. / math.sqrt(arg_0.weight.size(1))\n        arg_0.weight.data.uniform_(-arg_1, arg_1)\n        if arg_0.bias is not None:\n            arg_0.bias.data.uniform_(-arg_1, arg_1)", "path": "cdt/causality/graph/SAM.py", "identifier": "CNormalized_Linear.reset_parameters", "docstring": "Reset the parameters.", "docstring_tokens": ["Reset", "the", "parameters", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 260985}
{"url": "https://github.com/lindsaymarkward/python-yeelight-sunflower/blob/4ec72d005ce307f832429620ba0bcbf6b236eead/yeelightsunflower/main.py#L58-L75", "sha": "4ec72d005ce307f832429620ba0bcbf6b236eead", "docstring_summary": "Send TCP command to hub and return response.", "language": "python", "parameters": "(self, command)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "arg_0", ".", "_lock", ":", "try", ":", "arg_0", ".", "_socket", ".", "send", "(", "arg_1", ".", "encode", "(", "\"utf8\"", ")", ")", "arg_2", "=", "arg_0", ".", "receive", "(", ")", "while", "arg_2", ".", "startswith", "(", "\"S\"", ")", "or", "arg_2", ".", "startswith", "(", "\"NEW\"", ")", ":", "_LOGGER", ".", "debug", "(", "\"!Got response: %s\"", ",", "arg_2", ")", "arg_2", "=", "arg_0", ".", "receive", "(", ")", "_LOGGER", ".", "debug", "(", "\"Received: %s\"", ",", "arg_2", ")", "return", "arg_2", "except", "socket", ".", "error", "as", "error", ":", "_LOGGER", ".", "error", "(", "\"Error sending command: %s\"", ",", "error", ")", "arg_0", ".", "connect", "(", ")", "return", "\"\""], "function": "def Func(arg_0, arg_1):\n        \"\"\"Send TCP command to hub and return response.\"\"\"\n        # use lock to make TCP send/receive thread safe\n        with arg_0._lock:\n            try:\n                arg_0._socket.send(arg_1.encode(\"utf8\"))\n                arg_2 = arg_0.receive()\n                # hub may send \"status\"/\"new\" messages that should be ignored\n                while arg_2.startswith(\"S\") or arg_2.startswith(\"NEW\"):\n                    _LOGGER.debug(\"!Got response: %s\", arg_2)\n                    arg_2 = arg_0.receive()\n                _LOGGER.debug(\"Received: %s\", arg_2)\n                return arg_2\n            except socket.error as error:\n                _LOGGER.error(\"Error sending command: %s\", error)\n                # try re-connecting socket\n                arg_0.connect()\n                return \"\"", "path": "yeelightsunflower/main.py", "identifier": "Hub.send_command", "docstring": "Send TCP command to hub and return response.", "docstring_tokens": ["Send", "TCP", "command", "to", "hub", "and", "return", "response", "."], "nwo": "lindsaymarkward/python-yeelight-sunflower", "score": 0.18941942438232184, "idx": 260986}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qobj/converters/lo_config.py#L54-L77", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Embed default qubit LO frequencies from backend and format them to list object.\n        If configured lo frequency is the same as default, this method returns `None`.", "language": "python", "parameters": "(self, user_lo_config)", "return_statement": "return _q_los", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_0", ".", "default_qubit_los", ".", "copy", "(", ")", "except", "KeyError", ":", "raise", "PulseError", "(", "'Qubit default frequencies not exist.'", ")", "for", "arg_3", ",", "arg_4", "in", "arg_1", ".", "qubit_lo_dict", "(", ")", ".", "items", "(", ")", ":", "arg_2", "[", "arg_3", ".", "index", "]", "=", "arg_4", "if", "arg_2", "==", "arg_0", ".", "default_qubit_los", ":", "return", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Embed default qubit LO frequencies from backend and format them to list object.\n        If configured lo frequency is the same as default, this method returns `None`.\n\n        Args:\n            user_lo_config (LoConfig): A dictionary of LOs to format.\n\n        Returns:\n            list: A list of qubit LOs.\n\n        Raises:\n            PulseError: when LO frequencies are missing.\n        \"\"\"\n        try:\n            arg_2 = arg_0.default_qubit_los.copy()\n        except KeyError:\n            raise PulseError('Qubit default frequencies not exist.')\n\n        for arg_3, arg_4 in arg_1.qubit_lo_dict().items():\n            arg_2[arg_3.index] = arg_4\n\n        if arg_2 == arg_0.default_qubit_los:\n            return None\n        return arg_2", "path": "qiskit/qobj/converters/lo_config.py", "identifier": "LoConfigConverter.get_qubit_los", "docstring": "Embed default qubit LO frequencies from backend and format them to list object.\n        If configured lo frequency is the same as default, this method returns `None`.\n\n        Args:\n            user_lo_config (LoConfig): A dictionary of LOs to format.\n\n        Returns:\n            list: A list of qubit LOs.\n\n        Raises:\n            PulseError: when LO frequencies are missing.", "docstring_tokens": ["Embed", "default", "qubit", "LO", "frequencies", "from", "backend", "and", "format", "them", "to", "list", "object", ".", "If", "configured", "lo", "frequency", "is", "the", "same", "as", "default", "this", "method", "returns", "None", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 260987}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L171-L177", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "return active enrichr library name.Offical API", "language": "python", "parameters": "(self, database='')", "return_statement": "return sorted(libs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "'http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'", "%", "arg_1", "arg_3", "=", "json", ".", "loads", "(", "requests", ".", "get", "(", "arg_2", ")", ".", "text", ")", "arg_4", "=", "[", "lib", "[", "'libraryName'", "]", "for", "lib", "in", "arg_3", "[", "'statistics'", "]", "]", "return", "sorted", "(", "arg_4", ")"], "function": "def Func(arg_0, arg_1=''):\n        \"\"\"return active enrichr library name.Offical API \"\"\"\n\n        arg_2='http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'%arg_1\n        arg_3 = json.loads(requests.get(arg_2).text)\n        arg_4 = [lib['libraryName'] for lib in arg_3['statistics']]\n        return sorted(arg_4)", "path": "gseapy/gsea.py", "identifier": "GSEAbase.get_libraries", "docstring": "return active enrichr library name.Offical API", "docstring_tokens": ["return", "active", "enrichr", "library", "name", ".", "Offical", "API"], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 260988}
{"url": "https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/annotate.py#L39-L64", "sha": "b29614643043afd19c1d8074e8f25c6700d51a73", "docstring_summary": "Annotate a set of records with stored fields.", "language": "python", "parameters": "(self, records, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "arg_0", ".", "annotator_params", ".", "update", "(", "**", "arg_2", ")", "arg_3", "=", "arg_0", ".", "annotator_params", ".", "get", "(", "'chunk_size'", ",", "arg_0", ".", "CHUNK_SIZE", ")", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "arg_1", ")", ":", "arg_4", ".", "append", "(", "arg_6", ")", "if", "(", "arg_5", "+", "1", ")", "%", "arg_3", "==", "0", ":", "for", "arg_7", "in", "arg_0", ".", "_execute", "(", "arg_4", ")", ":", "yield", "arg_7", "arg_4", "=", "[", "]", "if", "arg_4", ":", "for", "arg_7", "in", "arg_0", ".", "_execute", "(", "arg_4", ")", ":", "yield", "arg_7", "arg_4", "=", "[", "]"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"Annotate a set of records with stored fields.\n\n        Args:\n            records: A list or iterator (can be a Query object)\n            chunk_size: The number of records to Func at once (max 500).\n\n        Returns:\n            A generator that yields one Funcd record at a time.\n        \"\"\"\n        # Update annotator_params with any kwargs\n        arg_0.annotator_params.update(**arg_2)\n        arg_3 = arg_0.annotator_params.get('chunk_size', arg_0.CHUNK_SIZE)\n\n        arg_4 = []\n        for arg_5, arg_6 in enumerate(arg_1):\n            arg_4.append(arg_6)\n            if (arg_5 + 1) % arg_3 == 0:\n                for arg_7 in arg_0._execute(arg_4):\n                    yield arg_7\n                arg_4 = []\n\n        if arg_4:\n            for arg_7 in arg_0._execute(arg_4):\n                yield arg_7\n            arg_4 = []", "path": "solvebio/annotate.py", "identifier": "Annotator.annotate", "docstring": "Annotate a set of records with stored fields.\n\n        Args:\n            records: A list or iterator (can be a Query object)\n            chunk_size: The number of records to annotate at once (max 500).\n\n        Returns:\n            A generator that yields one annotated record at a time.", "docstring_tokens": ["Annotate", "a", "set", "of", "records", "with", "stored", "fields", "."], "nwo": "solvebio/solvebio-python", "score": 0.44667972590324934, "idx": 260989}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L254-L259", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Display percent of disk usage.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "local_renderer", "arg_1", ".", "run", "(", "arg_1", ".", "env", ".", "Func_usage_command", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Display percent of Func usage.\n        \"\"\"\n        arg_1 = arg_0.local_renderer\n        arg_1.run(arg_1.env.Func_usage_command)", "path": "burlap/debug.py", "identifier": "DebugSatchel.disk", "docstring": "Display percent of disk usage.", "docstring_tokens": ["Display", "percent", "of", "disk", "usage", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 260990}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/safety.py#L329-L365", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "This function handles the retrieval of Short-term Exposure Limit on\n    worker exposure to dangerous chemicals.", "language": "python", "parameters": "(CASRN, AvailableMethods=False, Method=None)", "return_statement": "return _STEL", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "None", ")", ":", "def", "list_methods", "(", ")", ":", "arg_3", "=", "[", "]", "if", "arg_0", "in", "_OntarioExposureLimits", "and", "(", "_OntarioExposureLimits", "[", "arg_0", "]", "[", "\"Func (ppm)\"", "]", "or", "_OntarioExposureLimits", "[", "arg_0", "]", "[", "\"Func (mg/m^3)\"", "]", ")", ":", "arg_3", ".", "append", "(", "ONTARIO", ")", "arg_3", ".", "append", "(", "NONE", ")", "return", "arg_3", "if", "arg_1", ":", "return", "list_methods", "(", ")", "if", "not", "arg_2", ":", "arg_2", "=", "list_methods", "(", ")", "[", "0", "]", "if", "arg_2", "==", "ONTARIO", ":", "if", "_OntarioExposureLimits", "[", "arg_0", "]", "[", "\"Func (ppm)\"", "]", ":", "arg_4", "=", "(", "_OntarioExposureLimits", "[", "arg_0", "]", "[", "\"Func (ppm)\"", "]", ",", "'ppm'", ")", "elif", "_OntarioExposureLimits", "[", "arg_0", "]", "[", "\"Func (mg/m^3)\"", "]", ":", "arg_4", "=", "(", "_OntarioExposureLimits", "[", "arg_0", "]", "[", "\"Func (mg/m^3)\"", "]", ",", "'mg/m^3'", ")", "elif", "arg_2", "==", "NONE", ":", "arg_4", "=", "None", "else", ":", "raise", "Exception", "(", "'Failure in in function'", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=False, arg_2=None):  # pragma: no cover\n    '''This function handles the retrieval of Short-term Exposure Limit on\n    worker exposure to dangerous chemicals.\n\n    This API is considered experimental, and is expected to be removed in a\n    future release in favor of a more complete object-oriented interface.\n\n    >>> Func('67-64-1')\n    (750.0, 'ppm')\n    >>> Func('7664-38-2')\n    (0.7489774978301237, 'ppm')\n    >>> Func('55720-99-5')\n    (2.0, 'mg/m^3')\n    >>> Func('86290-81-5', AvailableMethods=True)\n    ['Ontario Limits', 'None']\n    '''\n    def list_methods():\n        arg_3 = []\n        if arg_0 in _OntarioExposureLimits and (_OntarioExposureLimits[arg_0][\"Func (ppm)\"] or _OntarioExposureLimits[arg_0][\"Func (mg/m^3)\"]):\n            arg_3.append(ONTARIO)\n        arg_3.append(NONE)\n        return arg_3\n    if arg_1:\n        return list_methods()\n    if not arg_2:\n        arg_2 = list_methods()[0]\n\n    if arg_2 == ONTARIO:\n        if _OntarioExposureLimits[arg_0][\"Func (ppm)\"]:\n            arg_4 = (_OntarioExposureLimits[arg_0][\"Func (ppm)\"], 'ppm')\n        elif _OntarioExposureLimits[arg_0][\"Func (mg/m^3)\"]:\n            arg_4 = (_OntarioExposureLimits[arg_0][\"Func (mg/m^3)\"], 'mg/m^3')\n    elif arg_2 == NONE:\n        arg_4 = None\n    else:\n        raise Exception('Failure in in function')\n    return arg_4", "path": "thermo/safety.py", "identifier": "STEL", "docstring": "This function handles the retrieval of Short-term Exposure Limit on\n    worker exposure to dangerous chemicals.\n\n    This API is considered experimental, and is expected to be removed in a\n    future release in favor of a more complete object-oriented interface.\n\n    >>> STEL('67-64-1')\n    (750.0, 'ppm')\n    >>> STEL('7664-38-2')\n    (0.7489774978301237, 'ppm')\n    >>> STEL('55720-99-5')\n    (2.0, 'mg/m^3')\n    >>> STEL('86290-81-5', AvailableMethods=True)\n    ['Ontario Limits', 'None']", "docstring_tokens": ["This", "function", "handles", "the", "retrieval", "of", "Short", "-", "term", "Exposure", "Limit", "on", "worker", "exposure", "to", "dangerous", "chemicals", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 260991}
{"url": "https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L339-L360", "sha": "f0af7f59a332e0619e4f3c00a7d4a3d230760e00", "docstring_summary": "Writes the metadata.ini file to the archive.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "configparser", ".", "ConfigParser", "(", ")", "arg_1", ".", "add_section", "(", "'MetaData'", ")", "arg_1", ".", "set", "(", "'MetaData'", ",", "'entry_point_process'", ",", "arg_0", ".", "wf_spec", ".", "name", ")", "if", "arg_0", ".", "editor", ":", "arg_1", ".", "set", "(", "'MetaData'", ",", "'editor'", ",", "arg_0", ".", "editor", ")", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "meta_data", ":", "arg_1", ".", "set", "(", "'MetaData'", ",", "arg_2", ",", "arg_3", ")", "if", "not", "arg_0", ".", "PARSER_CLASS", "==", "BpmnParser", ":", "arg_1", ".", "set", "(", "'MetaData'", ",", "'parser_class_module'", ",", "inspect", ".", "getmodule", "(", "arg_0", ".", "PARSER_CLASS", ")", ".", "__name__", ")", "arg_1", ".", "set", "(", "'MetaData'", ",", "'parser_class'", ",", "arg_0", ".", "PARSER_CLASS", ".", "__name__", ")", "arg_4", "=", "StringIO", "(", ")", "arg_1", ".", "write", "(", "arg_4", ")", "arg_0", ".", "write_to_package_zip", "(", "arg_0", ".", "METADATA_FILE", ",", "arg_4", ".", "getvalue", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Writes the metadata.ini file to the archive.\n        \"\"\"\n        arg_1 = configparser.ConfigParser()\n\n        arg_1.add_section('MetaData')\n        arg_1.set('MetaData', 'entry_point_process', arg_0.wf_spec.name)\n        if arg_0.editor:\n            arg_1.set('MetaData', 'editor', arg_0.editor)\n\n        for arg_2, arg_3 in arg_0.meta_data:\n            arg_1.set('MetaData', arg_2, arg_3)\n\n        if not arg_0.PARSER_CLASS == BpmnParser:\n            arg_1.set('MetaData', 'parser_class_module',\n                       inspect.getmodule(arg_0.PARSER_CLASS).__name__)\n            arg_1.set('MetaData', 'parser_class', arg_0.PARSER_CLASS.__name__)\n\n        arg_4 = StringIO()\n        arg_1.write(arg_4)\n        arg_0.write_to_package_zip(arg_0.METADATA_FILE, arg_4.getvalue())", "path": "SpiffWorkflow/bpmn/serializer/Packager.py", "identifier": "Packager.write_meta_data", "docstring": "Writes the metadata.ini file to the archive.", "docstring_tokens": ["Writes", "the", "metadata", ".", "ini", "file", "to", "the", "archive", "."], "nwo": "knipknap/SpiffWorkflow", "score": 0.7780821254256888, "idx": 260992}
{"url": "https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L197-L206", "sha": "8c6bb54888675652d25324184967392d00d128fc", "docstring_summary": "Iterates over the labels of terms in the ontology. Automatically wraps the pager returned by the OLS.", "language": "python", "parameters": "(self, ontology, size=None, sleep=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "for", "arg_4", "in", "_help_iterate_labels", "(", "arg_0", ".", "iter_terms", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ")", ":", "yield", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Iterates over the labels of terms in the ontology. Automatically wraps the pager returned by the OLS.\n\n        :param str ontology: The name of the ontology\n        :param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.\n        :param int sleep: The amount of time to sleep between pages. Defaults to 0 seconds.\n        :rtype: iter[str]\n        \"\"\"\n        for arg_4 in _help_iterate_labels(arg_0.iter_terms(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)):\n            yield arg_4", "path": "src/ols_client/client.py", "identifier": "OlsClient.iter_labels", "docstring": "Iterates over the labels of terms in the ontology. Automatically wraps the pager returned by the OLS.\n\n        :param str ontology: The name of the ontology\n        :param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.\n        :param int sleep: The amount of time to sleep between pages. Defaults to 0 seconds.\n        :rtype: iter[str]", "docstring_tokens": ["Iterates", "over", "the", "labels", "of", "terms", "in", "the", "ontology", ".", "Automatically", "wraps", "the", "pager", "returned", "by", "the", "OLS", "."], "nwo": "cthoyt/ols-client", "score": 0.25890992733444657, "idx": 260993}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/bezier.py#L440-L446", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns the length of the line.", "language": "python", "parameters": "(self, x0, y0, x1, y1)", "return_statement": "return sqrt(a + b)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "pow", "(", "abs", "(", "arg_1", "-", "arg_3", ")", ",", "2", ")", "arg_6", "=", "pow", "(", "abs", "(", "arg_2", "-", "arg_4", ")", ",", "2", ")", "return", "sqrt", "(", "arg_5", "+", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\" Returns the length of the line.\n        \"\"\"\n        # Originally from nodebox-gl\n        arg_5 = pow(abs(arg_1 - arg_3), 2)\n        arg_6 = pow(abs(arg_2 - arg_4), 2)\n        return sqrt(arg_5 + arg_6)", "path": "shoebot/data/bezier.py", "identifier": "BezierPath._linelength", "docstring": "Returns the length of the line.", "docstring_tokens": ["Returns", "the", "length", "of", "the", "line", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 260994}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L2114-L2128", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Retrieves a list of volumes in the data center.", "language": "python", "parameters": "(self, datacenter_id, depth=1)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "arg_3", "=", "arg_0", ".", "_perform_request", "(", "'/datacenters/%s/volumes?depth=%s'", "%", "(", "arg_1", ",", "str", "(", "arg_2", ")", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=1):\n        \"\"\"\n        Retrieves a list of volumes in the data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``\n\n        \"\"\"\n        arg_3 = arg_0._perform_request(\n            '/datacenters/%s/volumes?depth=%s' % (arg_1, str(arg_2)))\n\n        return arg_3", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.list_volumes", "docstring": "Retrieves a list of volumes in the data center.\n\n        :param      datacenter_id: The unique ID of the data center.\n        :type       datacenter_id: ``str``\n\n        :param      depth: The depth of the response data.\n        :type       depth: ``int``", "docstring_tokens": ["Retrieves", "a", "list", "of", "volumes", "in", "the", "data", "center", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 260995}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfobjects/pdfcolor.py#L75-L90", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Adobe output string for defining colors", "language": "python", "parameters": "(self)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "''", "if", "arg_0", ".", "color_type", "==", "'d'", ":", "if", "arg_0", ".", "name", "is", "\"black\"", ":", "arg_1", "=", "'%.3f G'", "%", "0", "else", ":", "arg_1", "=", "'%.3f %.3f %.3f RG'", "%", "(", "arg_0", ".", "red", "/", "255.0", ",", "arg_0", ".", "green", "/", "255.0", ",", "arg_0", ".", "blue", "/", "255.0", ")", "elif", "arg_0", ".", "color_type", "==", "'f'", "or", "arg_0", ".", "color_type", "==", "'t'", ":", "if", "arg_0", ".", "name", "is", "\"black\"", ":", "arg_1", "=", "'%.3f g'", "%", "0", "else", ":", "arg_1", "=", "'%.3f %.3f %.3f rg'", "%", "(", "arg_0", ".", "red", "/", "255.0", ",", "arg_0", ".", "green", "/", "255.0", ",", "arg_0", ".", "blue", "/", "255.0", ")", "return", "arg_1"], "function": "def Func(arg_0):\r\n        \"\"\"Adobe output string for defining colors\"\"\"\r\n        arg_1 = ''\r\n        if arg_0.color_type == 'd':\r\n            if arg_0.name is \"black\":\r\n                arg_1 = '%.3f G' % 0\r\n            else:\r\n                arg_1 = '%.3f %.3f %.3f RG' % (\r\n                    arg_0.red / 255.0, arg_0.green / 255.0, arg_0.blue / 255.0)\r\n        elif arg_0.color_type == 'f' or arg_0.color_type == 't':\r\n            if arg_0.name is \"black\":\r\n                arg_1 = '%.3f g' % 0\r\n            else:\r\n                arg_1 = '%.3f %.3f %.3f rg' % (\r\n                    arg_0.red / 255.0, arg_0.green / 255.0, arg_0.blue / 255.0)\r\n        return arg_1", "path": "pypdflite/pdfobjects/pdfcolor.py", "identifier": "PDFColor._get_color_string", "docstring": "Adobe output string for defining colors", "docstring_tokens": ["Adobe", "output", "string", "for", "defining", "colors"], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 260996}
{"url": "https://github.com/amyth/django-instapush/blob/f8643a2e342fc73a16c95dff79c3daac8ce4b034/instapush/models/base.py#L63-L74", "sha": "f8643a2e342fc73a16c95dff79c3daac8ce4b034", "docstring_summary": "Sends a push notification to this device via GCM", "language": "python", "parameters": "(self, message, **kwargs)", "return_statement": "return gcm_send_message(registration_id=self.registration_id,\n                data=data, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "**", "arg_2", ")", ":", "from", ".", ".", "libs", ".", "gcm", "import", "gcm_Func", "arg_3", "=", "arg_2", ".", "pop", "(", "\"extra\"", ",", "{", "}", ")", "if", "arg_1", "is", "not", "None", ":", "arg_3", "[", "\"message\"", "]", "=", "arg_1", "return", "gcm_Func", "(", "registration_id", "=", "arg_0", ".", "registration_id", ",", "arg_3", "=", "arg_3", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1, **arg_2):\n        \"\"\"\n        Sends a push notification to this device via GCM\n        \"\"\"\n\n        from ..libs.gcm import gcm_Func\n        arg_3 = arg_2.pop(\"extra\", {})\n        if arg_1 is not None:\n            arg_3[\"message\"] = arg_1\n\n        return gcm_Func(registration_id=arg_0.registration_id,\n                arg_3=arg_3, **arg_2)", "path": "instapush/models/base.py", "identifier": "GCMDevice.send_message", "docstring": "Sends a push notification to this device via GCM", "docstring_tokens": ["Sends", "a", "push", "notification", "to", "this", "device", "via", "GCM"], "nwo": "amyth/django-instapush", "score": 0.194552411663553, "idx": 260997}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1310-L1321", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Adjust the timestamp on which the certificate starts being valid.", "language": "python", "parameters": "(self, amount)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ",", "int", ")", ":", "raise", "TypeError", "(", "\"amount must be an integer\"", ")", "arg_2", "=", "_lib", ".", "X509_get_notBefore", "(", "arg_0", ".", "_x509", ")", "_lib", ".", "X509_gmtime_adj", "(", "arg_2", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adjust the timestamp on which the certificate starts being valid.\n\n        :param amount: The number of seconds by which to adjust the timestamp.\n        :return: ``None``\n        \"\"\"\n        if not isinstance(arg_1, int):\n            raise TypeError(\"amount must be an integer\")\n\n        arg_2 = _lib.X509_get_notBefore(arg_0._x509)\n        _lib.X509_gmtime_adj(arg_2, arg_1)", "path": "src/OpenSSL/crypto.py", "identifier": "X509.gmtime_adj_notBefore", "docstring": "Adjust the timestamp on which the certificate starts being valid.\n\n        :param amount: The number of seconds by which to adjust the timestamp.\n        :return: ``None``", "docstring_tokens": ["Adjust", "the", "timestamp", "on", "which", "the", "certificate", "starts", "being", "valid", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 260998}
{"url": "https://github.com/nicolas-van/mailflash/blob/794598d9df0e343bb1f64b03d09a68a540229774/mailflash.py#L410-L424", "sha": "794598d9df0e343bb1f64b03d09a68a540229774", "docstring_summary": "Adds an attachment to the message.", "language": "python", "parameters": "(self,\n               filename=None,\n               content_type=None,\n               data=None,\n               disposition=None,\n               headers=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ")", ":", "arg_0", ".", "Funcments", ".", "append", "(", "Attachment", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ")"], "function": "def Func(arg_0,\n               arg_1=None,\n               arg_2=None,\n               arg_3=None,\n               arg_4=None,\n               arg_5=None):\n        \"\"\"Adds an Funcment to the message.\n\n        :param filename: filename of Funcment\n        :param content_type: file mimetype\n        :param data: the raw file data\n        :param disposition: content-disposition (if any)\n        \"\"\"\n        arg_0.Funcments.append(\n            Attachment(arg_1, arg_2, arg_3, arg_4, arg_5))", "path": "mailflash.py", "identifier": "Message.attach", "docstring": "Adds an attachment to the message.\n\n        :param filename: filename of attachment\n        :param content_type: file mimetype\n        :param data: the raw file data\n        :param disposition: content-disposition (if any)", "docstring_tokens": ["Adds", "an", "attachment", "to", "the", "message", "."], "nwo": "nicolas-van/mailflash", "score": 0.28011057986078114, "idx": 260999}
{"url": "https://github.com/dhhagan/py-opc/blob/2c8f19530fb64bf5fd4ee0d694a47850161ed8a7/opc/__init__.py#L817-L841", "sha": "2c8f19530fb64bf5fd4ee0d694a47850161ed8a7", "docstring_summary": "Read the Serial Number string. This method is only available on OPC-N2\n        firmware versions 18+.", "language": "python", "parameters": "(self)", "return_statement": "return ''.join(string)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x10", "]", ")", "sleep", "(", "9e-3", ")", "for", "arg_2", "in", "range", "(", "60", ")", ":", "arg_3", "=", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x00", "]", ")", "[", "0", "]", "arg_1", ".", "append", "(", "chr", "(", "arg_3", ")", ")", "sleep", "(", "0.1", ")", "return", "''", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Read the Serial Number string. This method is only available on OPC-N2\n        firmware versions 18+.\n\n        :rtype: string\n\n        :Example:\n\n        >>> alpha.Func()\n        'OPC-N2 123456789'\n        \"\"\"\n        arg_1 = []\n\n        # Send the command byte and sleep for 9 ms\n        arg_0.cnxn.xfer([0x10])\n        sleep(9e-3)\n\n        # Read the info string by sending 60 empty bytes\n        for arg_2 in range(60):\n            arg_3 = arg_0.cnxn.xfer([0x00])[0]\n            arg_1.append(chr(arg_3))\n\n        sleep(0.1)\n\n        return ''.join(arg_1)", "path": "opc/__init__.py", "identifier": "OPCN2.sn", "docstring": "Read the Serial Number string. This method is only available on OPC-N2\n        firmware versions 18+.\n\n        :rtype: string\n\n        :Example:\n\n        >>> alpha.sn()\n        'OPC-N2 123456789'", "docstring_tokens": ["Read", "the", "Serial", "Number", "string", ".", "This", "method", "is", "only", "available", "on", "OPC", "-", "N2", "firmware", "versions", "18", "+", "."], "nwo": "dhhagan/py-opc", "score": 0.2904380171157967, "idx": 261000}
{"url": "https://github.com/griffithlab/civicpy/blob/feac435483bac46ea650f46d1b4f15eb3395a2b8/civicpy/recipes.py#L28-L37", "sha": "feac435483bac46ea650f46d1b4f15eb3395a2b8", "docstring_summary": "for each variant, yields evidence and merged phenotype from applying suggested changes to current", "language": "python", "parameters": "(variant_id_list)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", "in", "get_variant_phenotypes_with_suggested_changes", "(", "arg_0", ")", ":", "arg_3", "=", "arg_2", "[", "'current'", "]", "for", "arg_4", "in", "sorted", "(", "arg_2", "[", "'suggested_changes'", "]", ")", ":", "arg_5", "=", "arg_2", "[", "'suggested_changes'", "]", "[", "arg_4", "]", "arg_3", "=", "arg_3", "-", "arg_5", "[", "'deleted'", "]", "arg_3", "=", "arg_3", "|", "arg_5", "[", "'added'", "]", "if", "arg_3", ":", "yield", "arg_1", ",", "arg_3"], "function": "def Func(arg_0):\n    '''for each variant, yields evidence and merged phenotype from applying suggested changes to current'''\n    for arg_1, arg_2 in get_variant_phenotypes_with_suggested_changes(arg_0):\n        arg_3 = arg_2['current']\n        for arg_4 in sorted(arg_2['suggested_changes']):\n            arg_5 = arg_2['suggested_changes'][arg_4]\n            arg_3 = arg_3 - arg_5['deleted']\n            arg_3 = arg_3 | arg_5['added']\n        if arg_3:\n            yield arg_1, arg_3", "path": "civicpy/recipes.py", "identifier": "get_variant_phenotypes_with_suggested_changes_merged", "docstring": "for each variant, yields evidence and merged phenotype from applying suggested changes to current", "docstring_tokens": ["for", "each", "variant", "yields", "evidence", "and", "merged", "phenotype", "from", "applying", "suggested", "changes", "to", "current"], "nwo": "griffithlab/civicpy", "score": 0.27692002097430746, "idx": 261001}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/views.py#L569-L608", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns a list of all attendees.", "language": "python", "parameters": "(request)", "return_statement": "return AttendeeListReport(\"Attendees\", headings, data, link_view=attendee)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "people", ".", "Attendee", ".", "objects", ".", "select_related", "(", "\"attendeeprofilebase\"", ",", "\"user\"", ",", ")", "arg_2", "=", "AttendeeProfile", ".", "objects", ".", "filter", "(", "attendee__in", "=", "arg_1", ")", ".", "select_related", "(", "\"attendee\"", ",", "\"attendee__user\"", ",", ")", "arg_3", "=", "dict", "(", "(", "i", ".", "attendee", ",", "i", ")", "for", "i", "in", "arg_2", ")", "arg_1", "=", "arg_1", ".", "annotate", "(", "has_registered", "=", "Count", "(", "Q", "(", "user__invoice__status", "=", "commerce", ".", "Invoice", ".", "STATUS_PAID", ")", ")", ",", ")", "arg_4", "=", "[", "\"User ID\"", ",", "\"Name\"", ",", "\"Email\"", ",", "\"Has registered\"", ",", "]", "arg_5", "=", "[", "]", "for", "arg_6", "in", "arg_1", ":", "arg_5", ".", "append", "(", "[", "arg_6", ".", "user", ".", "id", ",", "(", "arg_3", "[", "arg_6", "]", ".", "attendee_name", "(", ")", "if", "arg_6", "in", "arg_3", "else", "\"\"", ")", ",", "arg_6", ".", "user", ".", "email", ",", "arg_6", ".", "has_registered", ">", "0", ",", "]", ")", "arg_5", ".", "sort", "(", "key", "=", "lambda", "arg_6", ":", "(", "-", "arg_6", "[", "3", "]", ",", "arg_6", "[", "0", "]", ")", ")", "return", "AttendeeListReport", "(", "\"Attendees\"", ",", "arg_4", ",", "arg_5", ",", "link_view", "=", "attendee", ")"], "function": "def Func(arg_0):\n    ''' Returns a list of all attendees. '''\n\n    arg_1 = people.Attendee.objects.select_related(\n        \"attendeeprofilebase\",\n        \"user\",\n    )\n\n    arg_2 = AttendeeProfile.objects.filter(\n        attendee__in=arg_1\n    ).select_related(\n        \"attendee\", \"attendee__user\",\n    )\n    arg_3 = dict((i.attendee, i) for i in arg_2)\n\n    arg_1 = arg_1.annotate(\n        has_registered=Count(\n            Q(user__invoice__status=commerce.Invoice.STATUS_PAID)\n        ),\n    )\n\n    arg_4 = [\n        \"User ID\", \"Name\", \"Email\", \"Has registered\",\n    ]\n\n    arg_5 = []\n\n    for arg_6 in arg_1:\n        arg_5.append([\n            arg_6.user.id,\n            (arg_3[arg_6].attendee_name()\n                if arg_6 in arg_3 else \"\"),\n            arg_6.user.email,\n            arg_6.has_registered > 0,\n        ])\n\n    # Sort by whether they've registered, then ID.\n    arg_5.sort(key=lambda arg_6: (-arg_6[3], arg_6[0]))\n\n    return AttendeeListReport(\"Attendees\", arg_4, arg_5, link_view=attendee)", "path": "registrasion/reporting/views.py", "identifier": "attendee_list", "docstring": "Returns a list of all attendees.", "docstring_tokens": ["Returns", "a", "list", "of", "all", "attendees", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 261002}
{"url": "https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2019-L2044", "sha": "1fbe064c50fd030948141d7d630673761525b0d0", "docstring_summary": "Get the reason of this revocation.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", "in", "range", "(", "_lib", ".", "X509_REVOKED_get_ext_count", "(", "arg_0", ".", "_revoked", ")", ")", ":", "arg_2", "=", "_lib", ".", "X509_REVOKED_get_ext", "(", "arg_0", ".", "_revoked", ",", "arg_1", ")", "arg_3", "=", "_lib", ".", "X509_EXTENSION_get_object", "(", "arg_2", ")", "if", "_lib", ".", "OBJ_obj2nid", "(", "arg_3", ")", "==", "_lib", ".", "NID_crl_reason", ":", "arg_4", "=", "_new_mem_buf", "(", ")", "arg_5", "=", "_lib", ".", "X509V3_EXT_print", "(", "arg_4", ",", "arg_2", ",", "0", ",", "0", ")", "if", "not", "arg_5", ":", "arg_5", "=", "_lib", ".", "M_ASN1_OCTET_STRING_print", "(", "arg_4", ",", "_lib", ".", "X509_EXTENSION_get_data", "(", "arg_2", ")", ")", "_openssl_assert", "(", "arg_5", "!=", "0", ")", "return", "_bio_to_string", "(", "arg_4", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Get the reason of this revocation.\n\n        :return: The reason, or ``None`` if there is none.\n        :rtype: bytes or NoneType\n\n        .. seealso::\n\n            :meth:`all_reasons`, which gives you a list of all supported\n            reasons this method might return.\n        \"\"\"\n        for arg_1 in range(_lib.X509_REVOKED_get_ext_count(arg_0._revoked)):\n            arg_2 = _lib.X509_REVOKED_get_ext(arg_0._revoked, arg_1)\n            arg_3 = _lib.X509_EXTENSION_get_object(arg_2)\n            if _lib.OBJ_obj2nid(arg_3) == _lib.NID_crl_reason:\n                arg_4 = _new_mem_buf()\n\n                arg_5 = _lib.X509V3_EXT_print(arg_4, arg_2, 0, 0)\n                if not arg_5:\n                    arg_5 = _lib.M_ASN1_OCTET_STRING_print(\n                        arg_4, _lib.X509_EXTENSION_get_data(arg_2)\n                    )\n                    _openssl_assert(arg_5 != 0)\n\n                return _bio_to_string(arg_4)", "path": "src/OpenSSL/crypto.py", "identifier": "Revoked.get_reason", "docstring": "Get the reason of this revocation.\n\n        :return: The reason, or ``None`` if there is none.\n        :rtype: bytes or NoneType\n\n        .. seealso::\n\n            :meth:`all_reasons`, which gives you a list of all supported\n            reasons this method might return.", "docstring_tokens": ["Get", "the", "reason", "of", "this", "revocation", "."], "nwo": "pyca/pyopenssl", "score": 0.7805423235604498, "idx": 261003}
{"url": "https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/coloring.py#L42-L46", "sha": "212cfe1791a4aab4783f99b665cc32da6437f419", "docstring_summary": "Formats a string with color", "language": "python", "parameters": "(color, s)", "return_statement": "return \"{begin}{s}{reset}\".format(begin=color, s=s, reset=Colors.RESET)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "no_coloring", ":", "return", "arg_1", "return", "\"{begin}{s}{reset}\"", ".", "format", "(", "begin", "=", "arg_0", ",", "arg_1", "=", "arg_1", ",", "reset", "=", "Colors", ".", "RESET", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Formats a string with color \"\"\"\n    if no_coloring:\n        return arg_1\n    return \"{begin}{s}{reset}\".format(begin=arg_0, arg_1=arg_1, reset=Colors.RESET)", "path": "tmc/coloring.py", "identifier": "formatter", "docstring": "Formats a string with color", "docstring_tokens": ["Formats", "a", "string", "with", "color"], "nwo": "minttu/tmc.py", "score": 0.09252797783733271, "idx": 261004}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/lcvfeatures.py#L304-L372", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This runs variability feature extraction for a list of LCs.", "language": "python", "parameters": "(lclist,\n                       outdir,\n                       maxobjects=None,\n                       timecols=None,\n                       magcols=None,\n                       errcols=None,\n                       mindet=1000,\n                       lcformat='hat-sql',\n                       lcformatdir=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "1000", ",", "arg_7", "=", "'hat-sql'", ",", "arg_8", "=", "None", ")", ":", "if", "arg_2", ":", "arg_0", "=", "arg_0", "[", ":", "arg_2", "]", "arg_9", "=", "[", "(", "x", ",", "arg_1", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "for", "x", "in", "arg_0", "]", "for", "arg_10", "in", "tqdm", "(", "arg_9", ")", ":", "arg_11", "=", "_varfeatures_worker", "(", "arg_10", ")", "return", "arg_11"], "function": "def Func(arg_0,\n                       arg_1,\n                       arg_2=None,\n                       arg_3=None,\n                       arg_4=None,\n                       arg_5=None,\n                       arg_6=1000,\n                       arg_7='hat-sql',\n                       arg_8=None):\n    '''This runs variability feature extraction for a list of LCs.\n\n    Parameters\n    ----------\n\n    lclist : list of str\n        The list of light curve file names to process.\n\n    outdir : str\n        The directory where the output varfeatures pickle files will be written.\n\n    maxobjects : int\n        The number of LCs to process from `lclist`.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in calculating the features.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in calculating the features.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in calculating the features.\n\n    mindet : int\n        The minimum number of LC points required to generate variability\n        features.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    Returns\n    -------\n\n    list of str\n        List of the generated variability features pickles for the input LCs,\n        with results for each magcol in the input `magcol` or light curve\n        format's default `magcol` list.\n\n    '''\n\n    if arg_2:\n        arg_0 = arg_0[:arg_2]\n\n    arg_9 = [(x, arg_1, arg_3, arg_4, arg_5,\n              arg_6, arg_7, arg_8)\n             for x in arg_0]\n\n    for arg_10 in tqdm(arg_9):\n        arg_11 = _varfeatures_worker(arg_10)\n\n    return arg_11", "path": "astrobase/lcproc/lcvfeatures.py", "identifier": "serial_varfeatures", "docstring": "This runs variability feature extraction for a list of LCs.\n\n    Parameters\n    ----------\n\n    lclist : list of str\n        The list of light curve file names to process.\n\n    outdir : str\n        The directory where the output varfeatures pickle files will be written.\n\n    maxobjects : int\n        The number of LCs to process from `lclist`.\n\n    timecols : list of str or None\n        The timecol keys to use from the lcdict in calculating the features.\n\n    magcols : list of str or None\n        The magcol keys to use from the lcdict in calculating the features.\n\n    errcols : list of str or None\n        The errcol keys to use from the lcdict in calculating the features.\n\n    mindet : int\n        The minimum number of LC points required to generate variability\n        features.\n\n    lcformat : str\n        This is the `formatkey` associated with your light curve format, which\n        you previously passed in to the `lcproc.register_lcformat`\n        function. This will be used to look up how to find and read the light\n        curves specified in `basedir` or `use_list_of_filenames`.\n\n    lcformatdir : str or None\n        If this is provided, gives the path to a directory when you've stored\n        your lcformat description JSONs, other than the usual directories lcproc\n        knows to search for them in. Use this along with `lcformat` to specify\n        an LC format JSON file that's not currently registered with lcproc.\n\n    Returns\n    -------\n\n    list of str\n        List of the generated variability features pickles for the input LCs,\n        with results for each magcol in the input `magcol` or light curve\n        format's default `magcol` list.", "docstring_tokens": ["This", "runs", "variability", "feature", "extraction", "for", "a", "list", "of", "LCs", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 261005}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/alea.py#L154-L158", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Return string of `length` elements chosen from `alphabet`.", "language": "python", "parameters": "(self, length, alphabet)", "return_statement": "return ''.join(\n            self.choice(alphabet) for n in range(length)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "''", ".", "join", "(", "arg_0", ".", "choice", "(", "arg_2", ")", "for", "arg_3", "in", "range", "(", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Return string of `length` elements chosen from `alphabet`.\"\"\"\n        return ''.join(\n            arg_0.choice(arg_2) for arg_3 in range(arg_1)\n        )", "path": "dddp/alea.py", "identifier": "Alea.random_string", "docstring": "Return string of `length` elements chosen from `alphabet`.", "docstring_tokens": ["Return", "string", "of", "length", "elements", "chosen", "from", "alphabet", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 261006}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/datasets.py#L133-L146", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Simple utilities to retrieve data sets from", "language": "python", "parameters": "(filename)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "import", "os", "import", "pkg_resources", "arg_1", "=", "pkg_resources", ".", "get_distribution", "(", "'spectrum'", ")", "arg_2", "=", "arg_1", ".", "location", "arg_3", "=", "os", ".", "sep", ".", "join", "(", "[", "arg_2", ",", "\"spectrum\"", ",", "'data'", "]", ")", "arg_4", "=", "os", ".", "sep", ".", "join", "(", "[", "arg_3", ",", "arg_0", "]", ")", "if", "os", ".", "path", ".", "exists", "(", "arg_4", ")", ":", "return", "arg_4", "else", ":", "raise", "Exception", "(", "'unknown file %s'", "%", "arg_4", ")"], "function": "def Func(arg_0):\n    \"\"\"Simple utilities to retrieve data sets from \"\"\"\n    import os\n    import pkg_resources\n    arg_1 = pkg_resources.get_distribution('spectrum')\n    arg_2 = arg_1.location\n\n    # first try develop mode\n    arg_3 = os.sep.join([arg_2, \"spectrum\", 'data'])\n    arg_4 = os.sep.join([arg_3, arg_0])\n    if os.path.exists(arg_4):\n        return arg_4\n    else:\n        raise Exception('unknown file %s' % arg_4)", "path": "src/spectrum/datasets.py", "identifier": "spectrum_data", "docstring": "Simple utilities to retrieve data sets from", "docstring_tokens": ["Simple", "utilities", "to", "retrieve", "data", "sets", "from"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 261007}
{"url": "https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4049-L4069", "sha": "a45b672f8287afca2ada8e36b74b604b9b28dd85", "docstring_summary": "Returns a new DataFrame where the virtual column is turned into an in memory numpy array.", "language": "python", "parameters": "(self, virtual_column, inplace=False)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "trim", "(", "arg_2", "=", "arg_2", ")", "arg_1", "=", "_ensure_string_from_expression", "(", "arg_1", ")", "if", "arg_1", "not", "in", "arg_3", ".", "virtual_columns", ":", "raise", "KeyError", "(", "'Virtual column not found: %r'", "%", "arg_1", ")", "arg_4", "=", "arg_3", ".", "evaluate", "(", "arg_1", ",", "filtered", "=", "False", ")", "del", "arg_3", "[", "arg_1", "]", "arg_3", ".", "add_column", "(", "arg_1", ",", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        '''Returns a new DataFrame where the virtual column is turned into an in memory numpy array.\n\n        Example:\n\n        >>> x = np.arange(1,4)\n        >>> y = np.arange(2,5)\n        >>> df = vaex.from_arrays(x=x, y=y)\n        >>> df['r'] = (df.x**2 + df.y**2)**0.5 # 'r' is a virtual column (computed on the fly)\n        >>> df = df.Func('r')  # now 'r' is a 'real' column (i.e. a numpy array)\n\n        :param inplace: {inplace}\n        '''\n        arg_3 = arg_0.trim(arg_2=arg_2)\n        arg_1 = _ensure_string_from_expression(arg_1)\n        if arg_1 not in arg_3.virtual_columns:\n            raise KeyError('Virtual column not found: %r' % arg_1)\n        arg_4 = arg_3.evaluate(arg_1, filtered=False)\n        del arg_3[arg_1]\n        arg_3.add_column(arg_1, arg_4)\n        return arg_3", "path": "packages/vaex-core/vaex/dataframe.py", "identifier": "DataFrame.materialize", "docstring": "Returns a new DataFrame where the virtual column is turned into an in memory numpy array.\n\n        Example:\n\n        >>> x = np.arange(1,4)\n        >>> y = np.arange(2,5)\n        >>> df = vaex.from_arrays(x=x, y=y)\n        >>> df['r'] = (df.x**2 + df.y**2)**0.5 # 'r' is a virtual column (computed on the fly)\n        >>> df = df.materialize('r')  # now 'r' is a 'real' column (i.e. a numpy array)\n\n        :param inplace: {inplace}", "docstring_tokens": ["Returns", "a", "new", "DataFrame", "where", "the", "virtual", "column", "is", "turned", "into", "an", "in", "memory", "numpy", "array", "."], "nwo": "vaexio/vaex", "score": 0.9862268864611298, "idx": 261008}
{"url": "https://github.com/soerenwolfers/swutil/blob/2d598f2deac8b7e20df95dbc68017e5ab5d6180c/swutil/np_tools.py#L175-L196", "sha": "2d598f2deac8b7e20df95dbc68017e5ab5d6180c", "docstring_summary": "Evaluate function on given grid and return values in grid format\n    \n    Assume X and Y are 2-dimensional arrays containing x and y coordinates, \n    respectively, of a two-dimensional grid, and f is a function that takes\n    1-d arrays with two entries. This function evaluates f on the grid points\n    described by X and Y and returns another 2-dimensional array of the shape \n    of X and Y that contains the values of f.", "language": "python", "parameters": "(X, Y, f,vectorized=True)", "return_statement": "return np.reshape(ZZ, X.shape, order='C')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "True", ")", ":", "arg_4", "=", "np", ".", "reshape", "(", "np", ".", "concatenate", "(", "[", "arg_0", "[", "...", ",", "None", "]", ",", "arg_1", "[", "...", ",", "None", "]", "]", ",", "axis", "=", "2", ")", ",", "(", "arg_0", ".", "size", ",", "2", ")", ",", "order", "=", "'C'", ")", "if", "arg_3", ":", "arg_5", "=", "arg_2", "(", "arg_4", ")", "else", ":", "arg_5", "=", "np", ".", "array", "(", "[", "arg_2", "(", "x", ")", "for", "x", "in", "arg_4", "]", ")", "return", "np", ".", "reshape", "(", "arg_5", ",", "arg_0", ".", "shape", ",", "order", "=", "'C'", ")"], "function": "def Func(arg_0, arg_1, arg_2,arg_3=True):\n    '''\n    Evaluate function on given grid and return values in grid format\n    \n    Assume X and Y are 2-dimensional arrays containing x and y coordinates, \n    respectively, of a two-dimensional grid, and f is a function that takes\n    1-d arrays with two entries. This function evaluates f on the grid points\n    described by X and Y and returns another 2-dimensional array of the shape \n    of X and Y that contains the values of f.\n\n    :param X: 2-dimensional array of x-coordinates\n    :param Y: 2-dimensional array of y-coordinates\n    :param f: function to be evaluated on grid\n    :param vectorized: `f` can handle arrays of inputs\n    :return: 2-dimensional array of values of f\n    '''\n    arg_4 = np.reshape(np.concatenate([arg_0[..., None], arg_1[..., None]], axis=2), (arg_0.size, 2), order='C')\n    if arg_3:\n        arg_5 = arg_2(arg_4)\n    else:\n        arg_5 = np.array([arg_2(x) for x in arg_4])\n    return np.reshape(arg_5, arg_0.shape, order='C')", "path": "swutil/np_tools.py", "identifier": "grid_evaluation", "docstring": "Evaluate function on given grid and return values in grid format\n    \n    Assume X and Y are 2-dimensional arrays containing x and y coordinates, \n    respectively, of a two-dimensional grid, and f is a function that takes\n    1-d arrays with two entries. This function evaluates f on the grid points\n    described by X and Y and returns another 2-dimensional array of the shape \n    of X and Y that contains the values of f.\n\n    :param X: 2-dimensional array of x-coordinates\n    :param Y: 2-dimensional array of y-coordinates\n    :param f: function to be evaluated on grid\n    :param vectorized: `f` can handle arrays of inputs\n    :return: 2-dimensional array of values of f", "docstring_tokens": ["Evaluate", "function", "on", "given", "grid", "and", "return", "values", "in", "grid", "format", "Assume", "X", "and", "Y", "are", "2", "-", "dimensional", "arrays", "containing", "x", "and", "y", "coordinates", "respectively", "of", "a", "two", "-", "dimensional", "grid", "and", "f", "is", "a", "function", "that", "takes", "1", "-", "d", "arrays", "with", "two", "entries", ".", "This", "function", "evaluates", "f", "on", "the", "grid", "points", "described", "by", "X", "and", "Y", "and", "returns", "another", "2", "-", "dimensional", "array", "of", "the", "shape", "of", "X", "and", "Y", "that", "contains", "the", "values", "of", "f", "."], "nwo": "soerenwolfers/swutil", "score": 0.2747185692836802, "idx": 261009}
{"url": "https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L162-L215", "sha": "0334545885445834307c075a445fba9fe6f0c9e7", "docstring_summary": "Recursively walk a set of paths and return a listing of contained files.", "language": "python", "parameters": "(roots, ignores=None)", "return_statement": "return paths", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", ",", "arg_3", ",", "arg_1", "=", "[", "]", ",", "0", ",", "arg_1", "or", "[", "]", "arg_4", "=", "multiglob_compile", "(", "arg_1", ",", "prefix", "=", "False", ")", "for", "arg_5", "in", "arg_0", ":", "arg_5", "=", "os", ".", "path", ".", "realpath", "(", "arg_5", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_5", ")", ":", "arg_2", ".", "append", "(", "arg_5", ")", "continue", "for", "arg_6", "in", "os", ".", "walk", "(", "arg_5", ")", ":", "out", ".", "write", "(", "\"Gathering file paths to compare... (%d files examined)\"", "%", "arg_3", ")", "for", "arg_7", "in", "arg_6", "[", "1", "]", ":", "arg_8", "=", "os", ".", "path", ".", "join", "(", "arg_6", "[", "0", "]", ",", "arg_7", ")", "if", "arg_4", ".", "match", "(", "arg_8", ")", ":", "arg_6", "[", "1", "]", ".", "remove", "(", "arg_7", ")", "for", "arg_9", "in", "arg_6", "[", "2", "]", ":", "arg_10", "=", "os", ".", "path", ".", "join", "(", "arg_6", "[", "0", "]", ",", "arg_9", ")", "if", "arg_4", ".", "match", "(", "arg_10", ")", ":", "continue", "arg_2", ".", "append", "(", "arg_10", ")", "arg_3", "+=", "1", "out", ".", "write", "(", "\"Found %s files to be compared for duplication.\"", "%", "(", "len", "(", "arg_2", ")", ")", ",", "newline", "=", "True", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Recursively walk a set of paths and return a listing of contained files.\n\n    :param roots: Relative or absolute paths to files or folders.\n    :type roots: :class:`~__builtins__.list` of :class:`~__builtins__.str`\n\n    :param ignores: A list of :py:mod:`fnmatch` globs to avoid walking and\n        omit from results\n    :type ignores: :class:`~__builtins__.list` of :class:`~__builtins__.str`\n\n    :returns: Absolute paths to only files.\n    :rtype: :class:`~__builtins__.list` of :class:`~__builtins__.str`\n\n    .. todo:: Try to optimize the ignores matching. Running a regex on every\n       filename is a fairly significant percentage of the time taken according\n       to the profiler.\n    \"\"\"\n    arg_2, arg_3, arg_1 = [], 0, arg_1 or []\n\n    # Prepare the ignores list for most efficient use\n    arg_4 = multiglob_compile(arg_1, prefix=False)\n\n    for arg_5 in arg_0:\n        # For safety, only use absolute, real paths.\n        arg_5 = os.path.realpath(arg_5)\n\n        # Handle directly-referenced filenames properly\n        # (And override ignores to \"do as I mean, not as I say\")\n        if os.path.isfile(arg_5):\n            arg_2.append(arg_5)\n            continue\n\n        for arg_6 in os.walk(arg_5):\n            out.write(\"Gathering file paths to compare... (%d files examined)\"\n                      % arg_3)\n\n            # Don't even descend into IGNOREd directories.\n            for arg_7 in arg_6[1]:\n                arg_8 = os.path.join(arg_6[0], arg_7)\n                if arg_4.match(arg_8):\n                    arg_6[1].remove(arg_7)\n\n            for arg_9 in arg_6[2]:\n                arg_10 = os.path.join(arg_6[0], arg_9)\n                if arg_4.match(arg_10):\n                    continue  # Skip IGNOREd files.\n\n                arg_2.append(arg_10)\n                arg_3 += 1\n\n    out.write(\"Found %s files to be compared for duplication.\" % (len(arg_2)),\n              newline=True)\n    return arg_2", "path": "fastdupes.py", "identifier": "getPaths", "docstring": "Recursively walk a set of paths and return a listing of contained files.\n\n    :param roots: Relative or absolute paths to files or folders.\n    :type roots: :class:`~__builtins__.list` of :class:`~__builtins__.str`\n\n    :param ignores: A list of :py:mod:`fnmatch` globs to avoid walking and\n        omit from results\n    :type ignores: :class:`~__builtins__.list` of :class:`~__builtins__.str`\n\n    :returns: Absolute paths to only files.\n    :rtype: :class:`~__builtins__.list` of :class:`~__builtins__.str`\n\n    .. todo:: Try to optimize the ignores matching. Running a regex on every\n       filename is a fairly significant percentage of the time taken according\n       to the profiler.", "docstring_tokens": ["Recursively", "walk", "a", "set", "of", "paths", "and", "return", "a", "listing", "of", "contained", "files", "."], "nwo": "ssokolow/fastdupes", "score": 0.4039778193346996, "idx": 261010}
{"url": "https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L1574-L1609", "sha": "b3748bdf30263bfa46ea40157bdf8df2522e1904", "docstring_summary": "Serial call to set max demand period.", "language": "python", "parameters": "(self, period, password=\"00000000\")", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"00000000\"", ")", ":", "arg_3", "=", "False", "arg_0", ".", "setContext", "(", "\"Func\"", ")", "try", ":", "if", "arg_1", "<", "1", "or", "arg_1", ">", "3", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Correct parameter: 1 = 15 minute, 2 = 30 minute, 3 = hour\"", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "arg_3", "if", "not", "arg_0", ".", "request", "(", "False", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Bad read CRC on setting\"", ")", "else", ":", "if", "not", "arg_0", ".", "serialCmdPwdAuth", "(", "arg_2", ")", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Password failure\"", ")", "else", ":", "arg_4", "=", "\"015731023030353028\"", "+", "binascii", ".", "hexlify", "(", "str", "(", "arg_1", ")", ")", ".", "zfill", "(", "2", ")", "+", "\"2903\"", "arg_4", "+=", "arg_0", ".", "calc_crc16", "(", "arg_4", "[", "2", ":", "]", ".", "decode", "(", "\"hex\"", ")", ")", "arg_0", ".", "m_serial_port", ".", "write", "(", "arg_4", ".", "decode", "(", "\"hex\"", ")", ")", "if", "arg_0", ".", "m_serial_port", ".", "getResponse", "(", "arg_0", ".", "getContext", "(", ")", ")", ".", "encode", "(", "\"hex\"", ")", "==", "\"06\"", ":", "arg_0", ".", "writeCmdMsg", "(", "\"Success(Func): 06 returned.\"", ")", "arg_3", "=", "True", "arg_0", ".", "serialPostEnd", "(", ")", "except", ":", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ".", "exc_info", "(", ")", ")", ")", "arg_0", ".", "setContext", "(", "\"\"", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=\"00000000\"):\n        \"\"\" Serial call to set max demand period.\n\n        Args:\n            period (int): : as int.\n            password (str): Optional password.\n\n        Returns:\n            bool: True on completion with ACK.\n        \"\"\"\n        arg_3 = False\n        arg_0.setContext(\"Func\")\n        try:\n            if arg_1 < 1 or arg_1 > 3:\n                arg_0.writeCmdMsg(\"Correct parameter: 1 = 15 minute, 2 = 30 minute, 3 = hour\")\n                arg_0.setContext(\"\")\n                return arg_3\n\n            if not arg_0.request(False):\n                arg_0.writeCmdMsg(\"Bad read CRC on setting\")\n            else:\n                if not arg_0.serialCmdPwdAuth(arg_2):\n                    arg_0.writeCmdMsg(\"Password failure\")\n                else:\n                    arg_4 = \"015731023030353028\" + binascii.hexlify(str(arg_1)).zfill(2) + \"2903\"\n                    arg_4 += arg_0.calc_crc16(arg_4[2:].decode(\"hex\"))\n                    arg_0.m_serial_port.write(arg_4.decode(\"hex\"))\n                    if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode(\"hex\") == \"06\":\n                        arg_0.writeCmdMsg(\"Success(Func): 06 returned.\")\n                        arg_3 = True\n            arg_0.serialPostEnd()\n        except:\n            ekm_log(traceback.format_exc(sys.exc_info()))\n\n        arg_0.setContext(\"\")\n        return arg_3", "path": "ekmmeters.py", "identifier": "Meter.setMaxDemandPeriod", "docstring": "Serial call to set max demand period.\n\n        Args:\n            period (int): : as int.\n            password (str): Optional password.\n\n        Returns:\n            bool: True on completion with ACK.", "docstring_tokens": ["Serial", "call", "to", "set", "max", "demand", "period", "."], "nwo": "ekmmetering/ekmmeters", "score": 0.27692002097430746, "idx": 261011}
{"url": "https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/reference.py#L115-L170", "sha": "32fd036d64fab19c554e841f162466f6eb28b50f", "docstring_summary": "This method should only be called while the reference is locked.", "language": "python", "parameters": "(self, callback=None, args=None, kwargs=None)", "return_statement": "return should_execute", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "tuple", "(", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "{", "}", "arg_4", "=", "arg_0", ".", "conn", ".", "client", "arg_5", "=", "False", "if", "arg_0", ".", "force_expiry", ":", "arg_5", "=", "True", "if", "not", "arg_5", ":", "arg_0", ".", "nodelist", ".", "remove_node", "(", "arg_0", ".", "conn", ".", "id", ")", "arg_0", ".", "nodelist", ".", "remove_expired_nodes", "(", ")", "arg_6", "=", "arg_4", ".", "incr", "(", "arg_0", ".", "refcount_key", ",", "-", "1", ")", "arg_5", "=", "(", "arg_6", "<=", "0", ")", "try", ":", "if", "callable", "(", "arg_1", ")", "and", "arg_5", ":", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "finally", ":", "if", "arg_5", ":", "arg_4", ".", "delete", "(", "arg_0", ".", "resource_key", ",", "arg_0", ".", "nodelist", ".", "nodelist_key", ",", "arg_0", ".", "times_modified_key", ",", "arg_0", ".", "refcount_key", ")", "arg_0", ".", "conn", ".", "remove_from_registry", "(", "arg_0", ".", "resource_key", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"\n        This method should only be called while the reference is locked.\n\n        Decrements the reference count for the resource. If this process holds\n        the only reference at the time we finish dereferencing it; True is\n        returned. Operating on the resource after it has been Funcd is\n        undefined behavior.\n\n        Dereference queries the value stored in the backend, if any, iff (if\n        and only if) this instance is the last reference to that resource. e.g.\n        self.count() == 0\n\n        :param function callback: A function to execute iff it's determined\n            this process holds the only reference to the resource. When there\n            is a failure communicating with the backend in the cleanup step the\n            callback function will be called an additional time for that\n            failure and each subsequent one thereafter. Ensure your callback\n            handles this properly.\n        :param tuple args: Positional arguments to pass your callback.\n        :param dict kwargs: keyword arguments to pass your callback.\n\n        :returns: Whether or not there are no more references among all\n            processes. True if this was the last reference. False otherwise.\n        :rtype: bool\n        \"\"\"\n        if arg_2 is None:\n            arg_2 = tuple()\n        if arg_3 is None:\n            arg_3 = {}\n\n        arg_4 = arg_0.conn.client\n\n        arg_5 = False\n        if arg_0.force_expiry:\n            arg_5 = True\n\n        if not arg_5:\n            arg_0.nodelist.remove_node(arg_0.conn.id)\n            arg_0.nodelist.remove_expired_nodes()\n\n            arg_6 = arg_4.incr(arg_0.refcount_key, -1)\n            arg_5 = (arg_6 <= 0)  # When we force expiry this will be -1\n\n        try:\n            if callable(arg_1) and arg_5:\n                arg_1(*arg_2, **arg_3)\n        finally:\n            if arg_5:\n                arg_4.delete(arg_0.resource_key,\n                              arg_0.nodelist.nodelist_key,\n                              arg_0.times_modified_key,\n                              arg_0.refcount_key)\n\n            arg_0.conn.remove_from_registry(arg_0.resource_key)\n        return arg_5", "path": "phonon/reference.py", "identifier": "Reference.dereference", "docstring": "This method should only be called while the reference is locked.\n\n        Decrements the reference count for the resource. If this process holds\n        the only reference at the time we finish dereferencing it; True is\n        returned. Operating on the resource after it has been dereferenced is\n        undefined behavior.\n\n        Dereference queries the value stored in the backend, if any, iff (if\n        and only if) this instance is the last reference to that resource. e.g.\n        self.count() == 0\n\n        :param function callback: A function to execute iff it's determined\n            this process holds the only reference to the resource. When there\n            is a failure communicating with the backend in the cleanup step the\n            callback function will be called an additional time for that\n            failure and each subsequent one thereafter. Ensure your callback\n            handles this properly.\n        :param tuple args: Positional arguments to pass your callback.\n        :param dict kwargs: keyword arguments to pass your callback.\n\n        :returns: Whether or not there are no more references among all\n            processes. True if this was the last reference. False otherwise.\n        :rtype: bool", "docstring_tokens": ["This", "method", "should", "only", "be", "called", "while", "the", "reference", "is", "locked", "."], "nwo": "buzzfeed/phonon", "score": 0.2757871243566705, "idx": 261012}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L390-L405", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Empties assets from Tower.", "language": "python", "parameters": "(organization=None, user=None, team=None, credential_type=None, credential=None, notification_template=None,\n          inventory_script=None, inventory=None, project=None, job_template=None, workflow=None,\n          all=None, no_color=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "False", ")", ":", "from", "tower_cli", ".", "cli", ".", "transfer", ".", "cleaner", "import", "Cleaner", "arg_13", "=", "Cleaner", "(", "arg_12", ")", "arg_14", "=", "{", "}", "for", "arg_15", "in", "SEND_ORDER", ":", "arg_14", "[", "arg_15", "]", "=", "locals", "(", ")", "[", "arg_15", "]", "arg_13", ".", "go_ham", "(", "arg_11", "=", "arg_11", ",", "asset_input", "=", "arg_14", ")"], "function": "def Func(arg_0=None, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=None,\n          arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=None,\n          arg_11=None, arg_12=False):\n    \"\"\"Empties assets from Tower.\n\n    'tower Func' removes all assets from Tower\n\n    \"\"\"\n\n    # Create an import/export object\n    from tower_cli.cli.transfer.cleaner import Cleaner\n    arg_13 = Cleaner(arg_12)\n    arg_14 = {}\n    for arg_15 in SEND_ORDER:\n        arg_14[arg_15] = locals()[arg_15]\n    arg_13.go_ham(arg_11=arg_11, asset_input=arg_14)", "path": "tower_cli/cli/misc.py", "identifier": "empty", "docstring": "Empties assets from Tower.\n\n    'tower empty' removes all assets from Tower", "docstring_tokens": ["Empties", "assets", "from", "Tower", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 261013}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L292-L391", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Main loop of the OPF Model Runner.", "language": "python", "parameters": "(self, numIters, learningOffAt=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_0", ".", "_model", ".", "resetSequenceStates", "(", ")", "arg_0", ".", "_currentRecordIndex", "=", "-", "1", "while", "True", ":", "if", "arg_0", ".", "_isKilled", ":", "break", "if", "arg_0", ".", "_isCanceled", ":", "break", "if", "arg_0", ".", "_isInterrupted", ".", "isSet", "(", ")", ":", "arg_0", ".", "__setAsOrphaned", "(", ")", "break", "if", "arg_0", ".", "_isMature", ":", "if", "not", "arg_0", ".", "_isBestModel", ":", "arg_0", ".", "_cmpReason", "=", "arg_0", ".", "_jobsDAO", ".", "CMPL_REASON_STOPPED", "break", "else", ":", "arg_0", ".", "_cmpReason", "=", "arg_0", ".", "_jobsDAO", ".", "CMPL_REASON_EOF", "if", "arg_2", "is", "not", "None", "and", "arg_0", ".", "_currentRecordIndex", "==", "arg_2", ":", "arg_0", ".", "_model", ".", "disableLearning", "(", ")", "try", ":", "arg_5", "=", "arg_0", ".", "_inputSource", ".", "getNextRecordDict", "(", ")", "if", "arg_0", ".", "_currentRecordIndex", "<", "0", ":", "arg_0", ".", "_inputSource", ".", "setTimeout", "(", "10", ")", "except", "Exception", ",", "e", ":", "raise", "utils", ".", "JobFailException", "(", "ErrorCodes", ".", "streamReading", ",", "str", "(", "e", ".", "args", ")", ",", "traceback", ".", "format_exc", "(", ")", ")", "if", "arg_5", "is", "None", ":", "arg_0", ".", "_cmpReason", "=", "arg_0", ".", "_jobsDAO", ".", "CMPL_REASON_EOF", "break", "if", "arg_5", ":", "arg_0", ".", "_currentRecordIndex", "+=", "1", "arg_6", "=", "arg_0", ".", "_model", ".", "run", "(", "arg_5", "=", "arg_5", ")", "arg_6", ".", "metrics", "=", "arg_0", ".", "__metricMgr", ".", "update", "(", "arg_6", ")", "if", "not", "arg_6", ".", "metrics", ":", "arg_6", ".", "metrics", "=", "arg_0", ".", "__metricMgr", ".", "getMetrics", "(", ")", "if", "InferenceElement", ".", "encodings", "in", "arg_6", ".", "inferences", ":", "arg_6", ".", "inferences", ".", "pop", "(", "InferenceElement", ".", "encodings", ")", "arg_6", ".", "sensorInput", ".", "dataEncodings", "=", "None", "arg_0", ".", "_writePrediction", "(", "arg_6", ")", "arg_0", ".", "_periodic", ".", "tick", "(", ")", "if", "arg_1", ">=", "0", "and", "arg_0", ".", "_currentRecordIndex", ">=", "arg_1", "-", "1", ":", "break", "else", ":", "raise", "ValueError", "(", "\"Got an empty record from FileSource: %r\"", "%", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\" Main loop of the OPF Model Runner.\n\n    Parameters:\n    -----------------------------------------------------------------------\n\n    recordIterator:    Iterator for counting number of records (see _runTask)\n    learningOffAt:     If not None, learning is turned off when we reach this\n                        iteration number\n\n    \"\"\"\n\n    ## Reset sequence states in the model, so it starts looking for a new\n    ## sequence\n    arg_0._model.resetSequenceStates()\n\n    arg_0._currentRecordIndex = -1\n    while True:\n\n      # If killed by a terminator, stop running\n      if arg_0._isKilled:\n        break\n\n      # If job stops or hypersearch ends, stop running\n      if arg_0._isCanceled:\n        break\n\n      # If the process is about to be killed, set as orphaned\n      if arg_0._isInterrupted.isSet():\n        arg_0.__setAsOrphaned()\n        break\n\n      # If model is mature, stop running ONLY IF  we are not the best model\n      # for the job. Otherwise, keep running so we can keep returning\n      # predictions to the user\n      if arg_0._isMature:\n        if not arg_0._isBestModel:\n          arg_0._cmpReason = arg_0._jobsDAO.CMPL_REASON_STOPPED\n          break\n        else:\n          arg_0._cmpReason = arg_0._jobsDAO.CMPL_REASON_EOF\n\n      # Turn off learning?\n        if arg_2 is not None \\\n                  and arg_0._currentRecordIndex == arg_2:\n          arg_0._model.disableLearning()\n\n      # Read input record. Note that any failure here is a critical JOB failure\n      #  and results in the job being immediately canceled and marked as\n      #  failed. The runModelXXX code in hypesearch.utils, if it sees an\n      #  exception of type utils.JobFailException, will cancel the job and\n      #  copy the error message into the job record.\n      try:\n        arg_5 = arg_0._inputSource.getNextRecordDict()\n        if arg_0._currentRecordIndex < 0:\n          arg_0._inputSource.setTimeout(10)\n      except Exception, e:\n        raise utils.JobFailException(ErrorCodes.streamReading, str(e.args),\n                                     traceback.format_exc())\n\n      if arg_5 is None:\n        # EOF\n        arg_0._cmpReason = arg_0._jobsDAO.CMPL_REASON_EOF\n        break\n\n      if arg_5:\n        # Process input record\n        arg_0._currentRecordIndex += 1\n\n        arg_6 = arg_0._model.run(arg_5=arg_5)\n\n        # Compute metrics.\n        arg_6.metrics = arg_0.__metricMgr.update(arg_6)\n        # If there are None, use defaults. see MetricsManager.getMetrics()\n        # TODO remove this when JAVA API server is gone\n        if not arg_6.metrics:\n          arg_6.metrics = arg_0.__metricMgr.getMetrics()\n\n\n        # Write the result to the output cache. Don't write encodings, if they\n        # were computed\n        if InferenceElement.encodings in arg_6.inferences:\n          arg_6.inferences.pop(InferenceElement.encodings)\n        arg_6.sensorInput.dataEncodings = None\n        arg_0._writePrediction(arg_6)\n\n        # Run periodic activities\n        arg_0._periodic.tick()\n\n        if arg_1 >= 0 and arg_0._currentRecordIndex >= arg_1-1:\n          break\n\n      else:\n        # Input source returned an empty record.\n        #\n        # NOTE: This is okay with Stream-based Source (when it times out\n        # waiting for next record), but not okay with FileSource, which should\n        # always return either with a valid record or None for EOF.\n        raise ValueError(\"Got an empty record from FileSource: %r\" %\n                         arg_5)", "path": "src/nupic/swarming/ModelRunner.py", "identifier": "OPFModelRunner.__runTaskMainLoop", "docstring": "Main loop of the OPF Model Runner.\n\n    Parameters:\n    -----------------------------------------------------------------------\n\n    recordIterator:    Iterator for counting number of records (see _runTask)\n    learningOffAt:     If not None, learning is turned off when we reach this\n                        iteration number", "docstring_tokens": ["Main", "loop", "of", "the", "OPF", "Model", "Runner", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261014}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/inspect.py#L1533-L1550", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Gets the hash of the nextflow file", "language": "python", "parameters": "(self)", "return_statement": "return pipeline_hash.hexdigest() + dir_hash.hexdigest()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_nextflow_filepath", "(", "arg_0", ".", "log_file", ")", "arg_2", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "arg_1", ",", "\"rb\"", ")", "as", "fh", ":", "for", "arg_3", "in", "iter", "(", "lambda", ":", "fh", ".", "read", "(", "4096", ")", ",", "b\"\"", ")", ":", "arg_2", ".", "update", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "workdir", ".", "encode", "(", "\"utf8\"", ")", "arg_5", "=", "socket", ".", "gethostname", "(", ")", ".", "encode", "(", "\"utf8\"", ")", "arg_6", "=", "str", "(", "uuid", ".", "getnode", "(", ")", ")", ".", "encode", "(", "\"utf8\"", ")", "arg_7", "=", "hashlib", ".", "md5", "(", "arg_4", "+", "arg_5", "+", "arg_6", ")", "return", "arg_2", ".", "hexdigest", "(", ")", "+", "arg_7", ".", "hexdigest", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Gets the hash of the nextflow file\"\"\"\n\n        # Get name and path of the pipeline from the log file\n        arg_1 = get_nextflow_filepath(arg_0.log_file)\n\n        # Get hash from the entire pipeline file\n        arg_2 = hashlib.md5()\n        with open(arg_1, \"rb\") as fh:\n            for arg_3 in iter(lambda: fh.read(4096), b\"\"):\n                arg_2.update(arg_3)\n        # Get hash from the current working dir and hostname\n        arg_4 = arg_0.workdir.encode(\"utf8\")\n        arg_5 = socket.gethostname().encode(\"utf8\")\n        arg_6 = str(uuid.getnode()).encode(\"utf8\")\n        arg_7 = hashlib.md5(arg_4 + arg_5 + arg_6)\n\n        return arg_2.hexdigest() + arg_7.hexdigest()", "path": "flowcraft/generator/inspect.py", "identifier": "NextflowInspector._get_run_hash", "docstring": "Gets the hash of the nextflow file", "docstring_tokens": ["Gets", "the", "hash", "of", "the", "nextflow", "file"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 261015}
{"url": "https://github.com/kxgames/kxg/blob/a68c01dc4aa1abf6b3780ba2c65a7828282566aa/kxg/multiplayer.py#L89-L113", "sha": "a68c01dc4aa1abf6b3780ba2c65a7828282566aa", "docstring_summary": "Manage the response when the server rejects a message.", "language": "python", "parameters": "(self, message)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "info", "(", "\"undoing message: {message}\"", ")", "with", "arg_0", ".", "world", ".", "_unlock_temporarily", "(", ")", ":", "arg_1", ".", "_undo", "(", "arg_0", ".", "world", ")", "arg_0", ".", "world", ".", "_react_to_undo_response", "(", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "actors", ":", "arg_2", ".", "_react_to_undo_response", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Manage the response when the server rejects a message.\n\n        An undo is when required this client sends a message that the server \n        refuses to pass on to the other clients playing the game.  When this \n        happens, the client must undo the changes that the message made to the \n        world before being sent or crash.  Note that unlike sync requests, undo \n        requests are only reported to the client that sent the offending \n        message.\n        \"\"\"\n        info(\"undoing message: {message}\")\n\n        # Roll back changes that the original message made to the world.\n\n        with arg_0.world._unlock_temporarily():\n            arg_1._undo(arg_0.world)\n            arg_0.world._react_to_undo_response(arg_1)\n\n        # Give the actors a chance to react to the error.  For example, a \n        # GUI actor might inform the user that there are connectivity \n        # issues and that their last action was countermanded.\n\n        for arg_2 in arg_0.actors:\n            arg_2._react_to_undo_response(arg_1)", "path": "kxg/multiplayer.py", "identifier": "ClientForum.execute_undo", "docstring": "Manage the response when the server rejects a message.\n\n        An undo is when required this client sends a message that the server \n        refuses to pass on to the other clients playing the game.  When this \n        happens, the client must undo the changes that the message made to the \n        world before being sent or crash.  Note that unlike sync requests, undo \n        requests are only reported to the client that sent the offending \n        message.", "docstring_tokens": ["Manage", "the", "response", "when", "the", "server", "rejects", "a", "message", "."], "nwo": "kxgames/kxg", "score": 0.16638194949711382, "idx": 261016}
{"url": "https://github.com/zinic/pynsive/blob/15bc8b35a91be5817979eb327427b6235b1b411e/pynsive/reflection.py#L168-L194", "sha": "15bc8b35a91be5817979eb327427b6235b1b411e", "docstring_summary": "Attempts to the submodules under a module recursively. This function\n    works for modules located in the default path as well as extended paths\n    via the sys.meta_path hooks.", "language": "python", "parameters": "(mname)", "return_statement": "return found", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "import_module", "(", "arg_0", ")", "if", "not", "arg_1", ":", "raise", "ImportError", "(", "'Unable to load module {}'", ".", "format", "(", "arg_0", ")", ")", "arg_2", "=", "list", "(", ")", "if", "_should_use_module_path", "(", "arg_1", ")", ":", "arg_3", "=", "arg_1", ".", "__path__", "[", "0", "]", "else", ":", "arg_4", "=", "sys", ".", "path", "arg_3", "=", "_scan_paths_for", "(", "arg_0", ",", "arg_4", ")", "if", "arg_3", ":", "for", "arg_5", "in", "_search_for_modules", "(", "arg_3", ",", "recursive", "=", "True", ")", ":", "arg_6", "=", "MODULE_PATH_SEP", ".", "join", "(", "(", "arg_0", ",", "arg_5", ")", ")", "arg_2", ".", "append", "(", "arg_6", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"\n    Attempts to the submodules under a module recursively. This function\n    works for modules located in the default path as well as extended paths\n    via the sys.meta_path hooks.\n\n    This function carries the expectation that the hidden module variable\n    '__path__' has been set correctly.\n\n    :param mname: the module name to descend into\n    \"\"\"\n    arg_1 = import_module(arg_0)\n    if not arg_1:\n        raise ImportError('Unable to load module {}'.format(arg_0))\n\n    arg_2 = list()\n    if _should_use_module_path(arg_1):\n        arg_3 = arg_1.__path__[0]\n    else:\n        arg_4 = sys.path\n        arg_3 = _scan_paths_for(arg_0, arg_4)\n\n    if arg_3:\n        for arg_5 in _search_for_modules(arg_3, recursive=True):\n            arg_6 = MODULE_PATH_SEP.join((arg_0, arg_5))\n            arg_2.append(arg_6)\n    return arg_2", "path": "pynsive/reflection.py", "identifier": "rlist_modules", "docstring": "Attempts to the submodules under a module recursively. This function\n    works for modules located in the default path as well as extended paths\n    via the sys.meta_path hooks.\n\n    This function carries the expectation that the hidden module variable\n    '__path__' has been set correctly.\n\n    :param mname: the module name to descend into", "docstring_tokens": ["Attempts", "to", "the", "submodules", "under", "a", "module", "recursively", ".", "This", "function", "works", "for", "modules", "located", "in", "the", "default", "path", "as", "well", "as", "extended", "paths", "via", "the", "sys", ".", "meta_path", "hooks", "."], "nwo": "zinic/pynsive", "score": 0.23137166388621372, "idx": 261017}
{"url": "https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/http_code.py#L109-L155", "sha": "cdf69cbde120199171f7158e1c33635753e6e2f5", "docstring_summary": "Get the HTTP code status.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "if", "PyFunceble", ".", "INTERN", "[", "\"to_test_type\"", "]", "==", "\"url\"", ":", "arg_1", "=", "PyFunceble", ".", "requests", ".", "head", "(", "arg_0", ".", "to_get", ",", "timeout", "=", "PyFunceble", ".", "CONFIGURATION", "[", "\"seconds_before_http_timeout\"", "]", ",", "headers", "=", "arg_0", ".", "headers", ",", "verify", "=", "PyFunceble", ".", "CONFIGURATION", "[", "\"verify_ssl_certificate\"", "]", ",", ")", "else", ":", "arg_1", "=", "PyFunceble", ".", "requests", ".", "head", "(", "arg_0", ".", "to_get", ",", "timeout", "=", "PyFunceble", ".", "CONFIGURATION", "[", "\"seconds_before_http_timeout\"", "]", ",", "headers", "=", "arg_0", ".", "headers", ",", ")", "return", "arg_1", ".", "status_code", "except", "(", "PyFunceble", ".", "requests", ".", "exceptions", ".", "InvalidURL", ",", "PyFunceble", ".", "socket", ".", "timeout", ",", "PyFunceble", ".", "requests", ".", "exceptions", ".", "Timeout", ",", "PyFunceble", ".", "requests", ".", "ConnectionError", ",", "urllib3_exceptions", ".", "InvalidHeader", ",", "UnicodeDecodeError", ",", ")", ":", "return", "None"], "function": "def Func(arg_0):  # pragma: no cover\n        \"\"\"\n        Get the HTTP code status.\n\n        :return: The matched HTTP status code.\n        :rtype: int|None\n        \"\"\"\n\n        try:\n            # We try to get the HTTP status code.\n\n            if PyFunceble.INTERN[\"to_test_type\"] == \"url\":\n                # We are globally testing a URL.\n\n                # We get the head of the URL.\n                arg_1 = PyFunceble.requests.head(\n                    arg_0.to_get,\n                    timeout=PyFunceble.CONFIGURATION[\"seconds_before_http_timeout\"],\n                    headers=arg_0.headers,\n                    verify=PyFunceble.CONFIGURATION[\"verify_ssl_certificate\"],\n                )\n            else:\n                # We are not globally testing a URL.\n\n                # We get the head of the constructed URL.\n                arg_1 = PyFunceble.requests.head(\n                    arg_0.to_get,\n                    timeout=PyFunceble.CONFIGURATION[\"seconds_before_http_timeout\"],\n                    headers=arg_0.headers,\n                )\n\n            # And we try to get the status code.\n            return arg_1.status_code\n\n        except (\n            PyFunceble.requests.exceptions.InvalidURL,\n            PyFunceble.socket.timeout,\n            PyFunceble.requests.exceptions.Timeout,\n            PyFunceble.requests.ConnectionError,\n            urllib3_exceptions.InvalidHeader,\n            UnicodeDecodeError,  # The probability that this happend in production is minimal.\n        ):\n            # If one of the listed exception is matched, that means that something\n            # went wrong and we were unable to extract the status code.\n\n            # We return None.\n            return None", "path": "PyFunceble/http_code.py", "identifier": "HTTPCode._access", "docstring": "Get the HTTP code status.\n\n        :return: The matched HTTP status code.\n        :rtype: int|None", "docstring_tokens": ["Get", "the", "HTTP", "code", "status", "."], "nwo": "funilrys/PyFunceble", "score": 0.7376187981798944, "idx": 261018}
{"url": "https://github.com/laplacesdemon/django-youtube/blob/8051ef372473eccb053f773c68e2e5e1b2cfb538/django_youtube/models.py#L49-L93", "sha": "8051ef372473eccb053f773c68e2e5e1b2cfb538", "docstring_summary": "Syncronize the video information on db with the video on Youtube\n        The reason that I didn't use signals is to avoid saving the video instance twice.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return super(Video, self).save(*args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "if", "not", "arg_0", ".", "id", ":", "arg_3", "=", "arg_0", ".", "entry", "(", ")", "arg_0", ".", "title", "=", "arg_3", ".", "media", ".", "title", ".", "text", "arg_0", ".", "description", "=", "arg_3", ".", "media", ".", "description", ".", "text", "arg_0", ".", "keywords", "=", "arg_3", ".", "media", ".", "keywords", ".", "text", "arg_0", ".", "youtube_url", "=", "arg_3", ".", "media", ".", "player", ".", "url", "arg_0", ".", "swf_url", "=", "arg_3", ".", "GetSwfUrl", "(", ")", "if", "arg_3", ".", "media", ".", "private", ":", "arg_0", ".", "access_control", "=", "AccessControl", ".", "Private", "else", ":", "arg_0", ".", "access_control", "=", "AccessControl", ".", "Public", "super", "(", "Video", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")", "for", "arg_10", "in", "arg_3", ".", "media", ".", "thumbnail", ":", "arg_11", "=", "Thumbnail", "(", ")", "arg_11", ".", "url", "=", "arg_10", ".", "url", "arg_11", ".", "video", "=", "arg_0", "arg_11", ".", "Func", "(", ")", "else", ":", "arg_14", "=", "Api", "(", ")", "arg_14", ".", "authenticate", "(", ")", "arg_14", ".", "update_video", "(", "arg_0", ".", "video_id", ",", "arg_0", ".", "title", ",", "arg_0", ".", "description", ",", "arg_0", ".", "keywords", ",", "arg_0", ".", "access_control", ")", "return", "super", "(", "Video", ",", "arg_0", ")", ".", "Func", "(", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"\n        Syncronize the video information on db with the video on Youtube\n        The reason that I didn't use signals is to avoid saving the video instance twice.\n        \"\"\"\n\n        # if this is a new instance add details from api\n        if not arg_0.id:\n            # Connect to api and get the details\n            arg_3 = arg_0.entry()\n\n            # Set the details\n            arg_0.title = arg_3.media.title.text\n            arg_0.description = arg_3.media.description.text\n            arg_0.keywords = arg_3.media.keywords.text\n            arg_0.youtube_url = arg_3.media.player.url\n            arg_0.swf_url = arg_3.GetSwfUrl()\n            if arg_3.media.private:\n                arg_0.access_control = AccessControl.Private\n            else:\n                arg_0.access_control = AccessControl.Public\n\n            # Save the instance\n            super(Video, arg_0).Func(*arg_1, **arg_2)\n\n            # show thumbnails\n            for arg_10 in arg_3.media.thumbnail:\n                arg_11 = Thumbnail()\n                arg_11.url = arg_10.url\n                arg_11.video = arg_0\n                arg_11.Func()\n        else:\n            # updating the video instance\n            # Connect to API and update video on youtube\n            arg_14 = Api()\n\n            # update method needs authentication\n            arg_14.authenticate()\n\n            # Update the info on youtube, raise error on failure\n            arg_14.update_video(arg_0.video_id, arg_0.title, arg_0.description,\n                             arg_0.keywords, arg_0.access_control)\n\n        # Save the model\n        return super(Video, arg_0).Func(*arg_1, **arg_2)", "path": "django_youtube/models.py", "identifier": "Video.save", "docstring": "Syncronize the video information on db with the video on Youtube\n        The reason that I didn't use signals is to avoid saving the video instance twice.", "docstring_tokens": ["Syncronize", "the", "video", "information", "on", "db", "with", "the", "video", "on", "Youtube", "The", "reason", "that", "I", "didn", "t", "use", "signals", "is", "to", "avoid", "saving", "the", "video", "instance", "twice", "."], "nwo": "laplacesdemon/django-youtube", "score": 0.19379564659824008, "idx": 261019}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/config.py#L27-L31", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Checks if a config value is set to a valid bool value.", "language": "python", "parameters": "(name)", "return_statement": "return cli_config.getboolean('servicefabric', name, False)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "CLIConfig", "(", "SF_CLI_CONFIG_DIR", ",", "SF_CLI_ENV_VAR_PREFIX", ")", "return", "arg_1", ".", "getboolean", "(", "'servicefabric'", ",", "arg_0", ",", "False", ")"], "function": "def Func(arg_0):\n    \"\"\"Checks if a config value is set to a valid bool value.\"\"\"\n\n    arg_1 = CLIConfig(SF_CLI_CONFIG_DIR, SF_CLI_ENV_VAR_PREFIX)\n    return arg_1.getboolean('servicefabric', arg_0, False)", "path": "rcctl/rcctl/config.py", "identifier": "get_config_bool", "docstring": "Checks if a config value is set to a valid bool value.", "docstring_tokens": ["Checks", "if", "a", "config", "value", "is", "set", "to", "a", "valid", "bool", "value", "."], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 261020}
{"url": "https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L263-L293", "sha": "44bd84394db2785332ac44b2948373916bea0f02", "docstring_summary": "Read the name and the version number of the ADS-server.", "language": "python", "parameters": "(port, address)", "return_statement": "return (device_name_buffer.value.decode(), AdsVersion(ads_version))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "_adsDLL", ".", "AdsSyncReadDeviceInfoReqEx", "arg_3", "=", "ctypes", ".", "pointer", "(", "arg_1", ".", "amsAddrStruct", "(", ")", ")", "arg_4", "=", "ctypes", ".", "create_string_buffer", "(", "20", ")", "arg_5", "=", "ctypes", ".", "pointer", "(", "arg_4", ")", "arg_6", "=", "SAdsVersion", "(", ")", "arg_7", "=", "ctypes", ".", "pointer", "(", "arg_6", ")", "arg_8", "=", "arg_2", "(", "arg_0", ",", "arg_3", ",", "arg_5", ",", "arg_7", ")", "if", "arg_8", ":", "raise", "ADSError", "(", "arg_8", ")", "return", "(", "arg_4", ".", "value", ".", "decode", "(", ")", ",", "AdsVersion", "(", "arg_6", ")", ")"], "function": "def Func(arg_0, arg_1):\n    # type: (int, AmsAddr) -> Tuple[str, AdsVersion]\n    \"\"\"Read the name and the version number of the ADS-server.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :rtype: string, AdsVersion\n    :return: device name, version\n\n    \"\"\"\n    arg_2 = _adsDLL.AdsSyncReadDeviceInfoReqEx\n\n    # Get pointer to the target AMS address\n    arg_3 = ctypes.pointer(arg_1.amsAddrStruct())\n\n    # Create buffer to be filled with device name, get pointer to said buffer\n    arg_4 = ctypes.create_string_buffer(20)\n    arg_5 = ctypes.pointer(arg_4)\n\n    # Create ADS Version struct and get pointer.\n    arg_6 = SAdsVersion()\n    arg_7 = ctypes.pointer(arg_6)\n\n    arg_8 = arg_2(\n        arg_0, arg_3, arg_5, arg_7\n    )\n\n    if arg_8:\n        raise ADSError(arg_8)\n\n    return (arg_4.value.decode(), AdsVersion(arg_6))", "path": "pyads/pyads_ex.py", "identifier": "adsSyncReadDeviceInfoReqEx", "docstring": "Read the name and the version number of the ADS-server.\n\n    :param int port: local AMS port as returned by adsPortOpenEx()\n    :param pyads.structs.AmsAddr address: local or remote AmsAddr\n    :rtype: string, AdsVersion\n    :return: device name, version", "docstring_tokens": ["Read", "the", "name", "and", "the", "version", "number", "of", "the", "ADS", "-", "server", "."], "nwo": "stlehmann/pyads", "score": 0.7011604985687272, "idx": 261021}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L410-L415", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "DDP ping handler.", "language": "python", "parameters": "(self, id_=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_0", ".", "reply", "(", "'pong'", ")", "else", ":", "arg_0", ".", "reply", "(", "'pong'", ",", "id", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"DDP ping handler.\"\"\"\n        if arg_1 is None:\n            arg_0.reply('pong')\n        else:\n            arg_0.reply('pong', id=arg_1)", "path": "dddp/websocket.py", "identifier": "DDPWebSocketApplication.recv_ping", "docstring": "DDP ping handler.", "docstring_tokens": ["DDP", "ping", "handler", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 261022}
{"url": "https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L359-L379", "sha": "ecde01f40b98f0719dbcfb54452270ed2f86686d", "docstring_summary": "Delete files from the repo", "language": "python", "parameters": "(self, repo, args=[])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "[", "]", ")", ":", "arg_3", "=", "None", "with", "cd", "(", "arg_1", ".", "rootdir", ")", ":", "try", ":", "arg_4", "=", "[", "'rm'", "]", "+", "list", "(", "arg_2", ")", "arg_3", "=", "{", "'status'", ":", "'success'", ",", "'message'", ":", "arg_0", ".", "_run", "(", "arg_4", ")", "}", "except", "Exception", "as", "e", ":", "arg_3", "=", "{", "'status'", ":", "'error'", ",", "'message'", ":", "str", "(", "e", ")", "}", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=[]):\n        \"\"\"\n        Delete files from the repo\n        \"\"\"\n\n        arg_3 = None\n        with cd(arg_1.rootdir):\n            try:\n                arg_4 = ['rm'] + list(arg_2)\n                arg_3 = {\n                    'status': 'success',\n                    'message': arg_0._run(arg_4)\n                }\n            except Exception as e:\n                arg_3 = {\n                    'status': 'error',\n                    'message': str(e)\n                }\n\n            # print(result)\n            return arg_3", "path": "dgitcore/contrib/repomanagers/gitmanager.py", "identifier": "GitRepoManager.delete", "docstring": "Delete files from the repo", "docstring_tokens": ["Delete", "files", "from", "the", "repo"], "nwo": "pingali/dgit", "score": 0.1802640598604426, "idx": 261023}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/pyUtils/fileHelpers.py#L5-L26", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Find files by pattern in directory", "language": "python", "parameters": "(directory, pattern, recursive=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "arg_0", ")", ":", "raise", "IOError", "(", "arg_0", "+", "' is not directory'", ")", "else", ":", "raise", "IOError", "(", "arg_0", "+", "\" does not exists\"", ")", "if", "arg_2", ":", "for", "arg_3", ",", "arg_4", ",", "arg_5", "in", "os", ".", "walk", "(", "arg_0", ")", ":", "for", "arg_6", "in", "arg_5", ":", "if", "fnmatch", ".", "fnmatch", "(", "arg_6", ",", "arg_1", ")", ":", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_6", ")", "yield", "arg_7", "else", ":", "arg_3", "=", "arg_0", "for", "arg_6", "in", "os", ".", "listdir", "(", "arg_3", ")", ":", "if", "fnmatch", ".", "fnmatch", "(", "arg_6", ",", "arg_1", ")", ":", "arg_7", "=", "os", ".", "path", ".", "join", "(", "arg_3", ",", "arg_6", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_7", ")", ":", "yield", "arg_7"], "function": "def Func(arg_0, arg_1, arg_2=True):\n    \"\"\"\n    Find files by pattern in directory\n    \"\"\"\n    if not os.path.isdir(arg_0):\n        if os.path.exists(arg_0):\n            raise IOError(arg_0 + ' is not directory')\n        else:\n            raise IOError(arg_0 + \" does not exists\")\n    if arg_2:\n        for arg_3, arg_4, arg_5 in os.walk(arg_0):\n            for arg_6 in arg_5:\n                if fnmatch.fnmatch(arg_6, arg_1):\n                    arg_7 = os.path.join(arg_3, arg_6)\n                    yield arg_7\n    else:\n        arg_3 = arg_0\n        for arg_6 in os.listdir(arg_3):\n            if fnmatch.fnmatch(arg_6, arg_1):\n                arg_7 = os.path.join(arg_3, arg_6)\n                if os.path.isfile(arg_7):\n                    yield arg_7", "path": "hwt/pyUtils/fileHelpers.py", "identifier": "find_files", "docstring": "Find files by pattern in directory", "docstring_tokens": ["Find", "files", "by", "pattern", "in", "directory"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 261024}
{"url": "https://github.com/zorg/zorg-network-camera/blob/e2d15725e50370e2df0c38be6b039215873e4278/zorg_network_camera/ocr.py#L33-L55", "sha": "e2d15725e50370e2df0c38be6b039215873e4278", "docstring_summary": "Returns true or false based on if the OCR process has read\n        actual words. This is needed to prevent non-words from being\n        added to the queue since the ocr process can sometimes return\n        values that are not meaningfull.", "language": "python", "parameters": "(self)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "read", "(", ")", ".", "split", "(", ")", "for", "arg_2", "in", "arg_1", ":", "if", "arg_2", ".", "lstrip", "(", "'-'", ")", ".", "replace", "(", "'.'", ",", "''", ",", "1", ")", ".", "isdigit", "(", ")", ":", "return", "True", "if", "arg_2", ".", "isalpha", "(", ")", "and", "(", "len", "(", "arg_2", ")", ">", "1", "or", "len", "(", "arg_2", ")", "<=", "20", ")", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns true or false based on if the OCR process has read\n        actual words. This is needed to prevent non-words from being\n        added to the queue since the ocr process can sometimes return\n        values that are not meaningfull.\n        \"\"\"\n\n        # Split the input string at points with any amount of whitespace\n        arg_1 = arg_0.read().split()\n\n        # Light weight check to see if a word exists\n        for arg_2 in arg_1:\n\n            # If the word is a numeric value\n            if arg_2.lstrip('-').replace('.', '', 1).isdigit():\n                return True\n\n            # If the word contains only letters with a length from 2 to 20\n            if arg_2.isalpha() and (len(arg_2) > 1 or len(arg_2) <= 20):\n                return True\n\n        return False", "path": "zorg_network_camera/ocr.py", "identifier": "OCR.text_visible", "docstring": "Returns true or false based on if the OCR process has read\n        actual words. This is needed to prevent non-words from being\n        added to the queue since the ocr process can sometimes return\n        values that are not meaningfull.", "docstring_tokens": ["Returns", "true", "or", "false", "based", "on", "if", "the", "OCR", "process", "has", "read", "actual", "words", ".", "This", "is", "needed", "to", "prevent", "non", "-", "words", "from", "being", "added", "to", "the", "queue", "since", "the", "ocr", "process", "can", "sometimes", "return", "values", "that", "are", "not", "meaningfull", "."], "nwo": "zorg/zorg-network-camera", "score": 0.08529914490135834, "idx": 261025}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/documents.py#L40-L49", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Returns the result as a dictionary, provide the include_meta flag to als show information like index and doctype.", "language": "python", "parameters": "(self, include_meta=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "arg_2", "=", "super", "(", "JackalDoc", ",", "arg_0", ")", ".", "Func", "(", "arg_1", "=", "arg_1", ")", "if", "arg_1", ":", "arg_3", "=", "arg_2", ".", "pop", "(", "'_source'", ")", "return", "{", "**", "arg_2", ",", "**", "arg_3", "}", "else", ":", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n        \"\"\"\n            Returns the result as a dictionary, provide the include_meta flag to als show information like index and doctype.\n        \"\"\"\n        arg_2 = super(JackalDoc, arg_0).Func(arg_1=arg_1)\n        if arg_1:\n            arg_3 = arg_2.pop('_source')\n            return {**arg_2, **arg_3}\n        else:\n            return arg_2", "path": "jackal/documents.py", "identifier": "JackalDoc.to_dict", "docstring": "Returns the result as a dictionary, provide the include_meta flag to als show information like index and doctype.", "docstring_tokens": ["Returns", "the", "result", "as", "a", "dictionary", "provide", "the", "include_meta", "flag", "to", "als", "show", "information", "like", "index", "and", "doctype", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 261026}
{"url": "https://github.com/blockstack/zone-file-py/blob/c1078c8c3c28f0881bc9a3af53d4972c4a6862d0/blockstack_zones/parse_zone_file.py#L32-L49", "sha": "c1078c8c3c28f0881bc9a3af53d4972c4a6862d0", "docstring_summary": "Make a subparser for a given type of DNS record", "language": "python", "parameters": "(subparsers, rec_type, args_and_types)", "return_statement": "return sp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "add_parser", "(", "arg_1", ")", "arg_3", ".", "add_argument", "(", "\"name\"", ",", "type", "=", "str", ")", "arg_3", ".", "add_argument", "(", "\"ttl\"", ",", "type", "=", "int", ",", "arg_7", "=", "'?'", ")", "arg_3", ".", "add_argument", "(", "arg_1", ",", "type", "=", "str", ")", "for", "arg_4", "in", "arg_2", ":", "(", "arg_5", ",", "arg_6", ")", "=", "arg_4", "[", ":", "2", "]", "if", "len", "(", "arg_4", ")", ">", "2", ":", "arg_7", "=", "arg_4", "[", "2", "]", "arg_3", ".", "add_argument", "(", "arg_5", ",", "type", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "else", ":", "arg_3", ".", "add_argument", "(", "arg_5", ",", "type", "=", "arg_6", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Make a subparser for a given type of DNS record\n    \"\"\"\n    arg_3 = arg_0.add_parser(arg_1)\n\n    arg_3.add_argument(\"name\", type=str)\n    arg_3.add_argument(\"ttl\", type=int, arg_7='?')\n    arg_3.add_argument(arg_1, type=str)\n\n    for arg_4 in arg_2:\n        (arg_5, arg_6) = arg_4[:2]\n        if len(arg_4) > 2:\n            arg_7 = arg_4[2]\n            arg_3.add_argument(arg_5, type=arg_6, arg_7=arg_7)\n        else:\n            arg_3.add_argument(arg_5, type=arg_6)\n    return arg_3", "path": "blockstack_zones/parse_zone_file.py", "identifier": "make_rr_subparser", "docstring": "Make a subparser for a given type of DNS record", "docstring_tokens": ["Make", "a", "subparser", "for", "a", "given", "type", "of", "DNS", "record"], "nwo": "blockstack/zone-file-py", "score": 0.4104459992179242, "idx": 261027}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dav_error.py#L205-L222", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Return readable string.", "language": "python", "parameters": "(self)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "value", "in", "ERROR_DESCRIPTIONS", ":", "arg_1", "=", "\"{}\"", ".", "format", "(", "ERROR_DESCRIPTIONS", "[", "arg_0", ".", "value", "]", ")", "else", ":", "arg_1", "=", "\"{}\"", ".", "format", "(", "arg_0", ".", "value", ")", "if", "arg_0", ".", "context_info", ":", "arg_1", "+=", "\": {}\"", ".", "format", "(", "arg_0", ".", "context_info", ")", "elif", "arg_0", ".", "value", "in", "ERROR_RESPONSES", ":", "arg_1", "+=", "\": {}\"", ".", "format", "(", "ERROR_RESPONSES", "[", "arg_0", ".", "value", "]", ")", "if", "arg_0", ".", "src_exception", ":", "arg_1", "+=", "\"\\n    Source exception: '{}'\"", ".", "format", "(", "arg_0", ".", "src_exception", ")", "if", "arg_0", ".", "err_condition", ":", "arg_1", "+=", "\"\\n    Error condition: '{}'\"", ".", "format", "(", "arg_0", ".", "err_condition", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Return readable string.\"\"\"\n        if arg_0.value in ERROR_DESCRIPTIONS:\n            arg_1 = \"{}\".format(ERROR_DESCRIPTIONS[arg_0.value])\n        else:\n            arg_1 = \"{}\".format(arg_0.value)\n\n        if arg_0.context_info:\n            arg_1 += \": {}\".format(arg_0.context_info)\n        elif arg_0.value in ERROR_RESPONSES:\n            arg_1 += \": {}\".format(ERROR_RESPONSES[arg_0.value])\n\n        if arg_0.src_exception:\n            arg_1 += \"\\n    Source exception: '{}'\".format(arg_0.src_exception)\n\n        if arg_0.err_condition:\n            arg_1 += \"\\n    Error condition: '{}'\".format(arg_0.err_condition)\n        return arg_1", "path": "wsgidav/dav_error.py", "identifier": "DAVError.get_user_info", "docstring": "Return readable string.", "docstring_tokens": ["Return", "readable", "string", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 261028}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2474-L2488", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Reconstructs all items from the pickle dumps in `load_dict`.", "language": "python", "parameters": "(self, load_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_0", ".", "v_protocol", "=", "arg_1", ".", "pop", "(", "PickleParameter", ".", "PROTOCOL", ")", "except", "KeyError", ":", "arg_3", "=", "next", "(", "arg_1", ".", "values", "(", ")", ")", "arg_0", ".", "v_protocol", "=", "PickleParameter", ".", "_get_protocol", "(", "arg_3", ")", "for", "arg_4", "in", "arg_1", ":", "arg_5", "=", "arg_1", "[", "arg_4", "]", "arg_0", ".", "_data", "[", "arg_4", "]", "=", "pickle", ".", "loads", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Reconstructs all items from the pickle dumps in `load_dict`.\n\n        Sets the `v_protocol` property to the protocol of the first reconstructed item.\n\n        \"\"\"\n        try:\n            arg_0.v_protocol = arg_1.pop(PickleParameter.PROTOCOL)\n        except KeyError:\n            # For backwards compatibility\n            arg_3 = next(arg_1.values())\n            arg_0.v_protocol = PickleParameter._get_protocol(arg_3)\n        for arg_4 in arg_1:\n            arg_5 = arg_1[arg_4]\n            arg_0._data[arg_4] = pickle.loads(arg_5)", "path": "pypet/parameter.py", "identifier": "PickleResult._load", "docstring": "Reconstructs all items from the pickle dumps in `load_dict`.\n\n        Sets the `v_protocol` property to the protocol of the first reconstructed item.", "docstring_tokens": ["Reconstructs", "all", "items", "from", "the", "pickle", "dumps", "in", "load_dict", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 261029}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/image/reshape.py#L4-L12", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Return an image cropped on top, bottom, left or right.", "language": "python", "parameters": "(image, top_offset=0, left_offset=0, bottom_offset=0, right_offset=0)", "return_statement": "return image", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "0", ",", "arg_3", "=", "0", ",", "arg_4", "=", "0", ")", ":", "if", "arg_3", "or", "arg_1", "or", "arg_2", "or", "arg_4", ":", "arg_5", ",", "arg_6", "=", "arg_0", ".", "size", "arg_7", "=", "(", "arg_2", ",", "arg_1", ",", "arg_5", "-", "arg_4", ",", "arg_6", "-", "arg_3", ")", "arg_0", "=", "arg_0", ".", "Func", "(", "arg_7", "=", "arg_7", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=0, arg_2=0, arg_3=0, arg_4=0):\n    \"\"\"Return an image Funcped on top, bottom, left or right.\"\"\"\n    if arg_3 or arg_1 or arg_2 or arg_4:\n        arg_5, arg_6 = arg_0.size\n        arg_7 = (arg_2, arg_1,\n               arg_5 - arg_4, arg_6 - arg_3)\n        arg_0 = arg_0.Func(arg_7=arg_7)\n\n    return arg_0", "path": "bibliopixel/util/image/reshape.py", "identifier": "crop", "docstring": "Return an image cropped on top, bottom, left or right.", "docstring_tokens": ["Return", "an", "image", "cropped", "on", "top", "bottom", "left", "or", "right", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 261030}
{"url": "https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L410-L421", "sha": "2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429", "docstring_summary": "gridSpan is what docx uses to denote that a table cell has a colspan. This\n    is much more simple than rowspans in that there is a one-to-one mapping\n    from gridSpan to colspan.", "language": "python", "parameters": "(tc)", "return_statement": "return int(grid_span.get('%sval' % w_namespace))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_namespace", "(", "arg_0", ",", "'w'", ")", "arg_2", "=", "arg_0", ".", "xpath", "(", "'.//w:gridSpan'", ",", "namespaces", "=", "arg_0", ".", "nsmap", ")", "if", "len", "(", "arg_2", ")", "!=", "1", ":", "return", "1", "arg_3", "=", "arg_2", "[", "0", "]", "return", "int", "(", "arg_3", ".", "get", "(", "'%sval'", "%", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    gridSpan is what docx uses to denote that a table cell has a colspan. This\n    is much more simple than rowspans in that there is a one-to-one mapping\n    from gridSpan to colspan.\n    \"\"\"\n    arg_1 = get_namespace(arg_0, 'w')\n    arg_2 = arg_0.xpath('.//w:gridSpan', namespaces=arg_0.nsmap)\n    if len(arg_2) != 1:\n        return 1\n    arg_3 = arg_2[0]\n    return int(arg_3.get('%sval' % arg_1))", "path": "docx2html/core.py", "identifier": "get_grid_span", "docstring": "gridSpan is what docx uses to denote that a table cell has a colspan. This\n    is much more simple than rowspans in that there is a one-to-one mapping\n    from gridSpan to colspan.", "docstring_tokens": ["gridSpan", "is", "what", "docx", "uses", "to", "denote", "that", "a", "table", "cell", "has", "a", "colspan", ".", "This", "is", "much", "more", "simple", "than", "rowspans", "in", "that", "there", "is", "a", "one", "-", "to", "-", "one", "mapping", "from", "gridSpan", "to", "colspan", "."], "nwo": "PolicyStat/docx2html", "score": 0.2888524677165775, "idx": 261031}
{"url": "https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/ordinal.py#L272-L329", "sha": "5e9e803c9131b377af305d5302723ba2415001da", "docstring_summary": "Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed\n        in, in this case we use the knowledge that there is some true order to the classes themselves. Otherwise, the classes\n        are assumed to have no true order and integers are selected at random.", "language": "python", "parameters": "(X_in, mapping=None, cols=None, handle_unknown='value', handle_missing='value')", "return_statement": "return X, mapping_out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'value'", ",", "arg_4", "=", "'value'", ")", ":", "arg_5", "=", "pd", ".", "Series", "(", "arg_15", "=", "[", "np", ".", "nan", "]", ",", "arg_14", "=", "[", "-", "2", "]", ")", "arg_6", "=", "arg_0", ".", "copy", "(", "deep", "=", "True", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_6", ".", "columns", ".", "values", "if", "arg_1", "is", "not", "None", ":", "arg_7", "=", "arg_1", "for", "arg_8", "in", "arg_1", ":", "arg_9", "=", "arg_8", ".", "get", "(", "'col'", ")", "arg_6", "[", "arg_9", "]", "=", "arg_6", "[", "arg_9", "]", ".", "map", "(", "arg_8", "[", "'mapping'", "]", ")", "try", ":", "arg_6", "[", "arg_9", "]", "=", "arg_6", "[", "arg_9", "]", ".", "astype", "(", "int", ")", "except", "ValueError", "as", "e", ":", "arg_6", "[", "arg_9", "]", "=", "arg_6", "[", "arg_9", "]", ".", "astype", "(", "float", ")", "if", "arg_3", "==", "'value'", ":", "arg_6", "[", "arg_9", "]", ".", "fillna", "(", "-", "1", ",", "inplace", "=", "True", ")", "elif", "arg_3", "==", "'error'", ":", "arg_10", "=", "arg_6", "[", "arg_9", "]", ".", "isnull", "(", ")", "if", "any", "(", "arg_10", ")", ":", "raise", "ValueError", "(", "'Unexpected categories found in column %s'", "%", "arg_9", ")", "if", "arg_4", "==", "'return_nan'", ":", "arg_6", "[", "arg_9", "]", "=", "arg_6", "[", "arg_9", "]", ".", "map", "(", "arg_5", ")", ".", "where", "(", "arg_6", "[", "arg_9", "]", "==", "-", "2", ",", "arg_6", "[", "arg_9", "]", ")", "else", ":", "arg_7", "=", "[", "]", "for", "arg_11", "in", "arg_2", ":", "arg_12", "=", "np", ".", "nan", "if", "util", ".", "is_category", "(", "arg_6", "[", "arg_11", "]", ".", "dtype", ")", ":", "arg_13", "=", "arg_6", "[", "arg_11", "]", ".", "cat", ".", "categories", "else", ":", "arg_13", "=", "arg_6", "[", "arg_11", "]", ".", "unique", "(", ")", "arg_14", "=", "pd", ".", "Series", "(", "arg_13", ")", ".", "fillna", "(", "arg_12", ")", ".", "unique", "(", ")", "arg_15", "=", "pd", ".", "Series", "(", "arg_14", "=", "arg_14", ",", "arg_15", "=", "range", "(", "1", ",", "len", "(", "arg_14", ")", "+", "1", ")", ")", "if", "arg_4", "==", "'value'", "and", "~", "arg_15", ".", "index", ".", "isnull", "(", ")", ".", "any", "(", ")", ":", "arg_15", ".", "loc", "[", "arg_12", "]", "=", "-", "2", "elif", "arg_4", "==", "'return_nan'", ":", "arg_15", ".", "loc", "[", "arg_12", "]", "=", "-", "2", "arg_7", ".", "append", "(", "{", "'col'", ":", "arg_11", ",", "'mapping'", ":", "arg_15", ",", "'data_type'", ":", "arg_6", "[", "arg_11", "]", ".", "dtype", "}", ",", ")", "return", "arg_6", ",", "arg_7"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3='value', arg_4='value'):\n        \"\"\"\n        Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed\n        in, in this case we use the knowledge that there is some true order to the classes themselves. Otherwise, the classes\n        are assumed to have no true order and integers are selected at random.\n        \"\"\"\n\n        arg_5 = pd.Series(arg_15=[np.nan], arg_14=[-2])\n\n        arg_6 = arg_0.copy(deep=True)\n\n        if arg_2 is None:\n            arg_2 = arg_6.columns.values\n\n        if arg_1 is not None:\n            arg_7 = arg_1\n            for arg_8 in arg_1:\n                arg_9 = arg_8.get('col')\n                arg_6[arg_9] = arg_6[arg_9].map(arg_8['mapping'])\n\n                try:\n                    arg_6[arg_9] = arg_6[arg_9].astype(int)\n                except ValueError as e:\n                    arg_6[arg_9] = arg_6[arg_9].astype(float)\n\n                if arg_3 == 'value':\n                    arg_6[arg_9].fillna(-1, inplace=True)\n                elif arg_3 == 'error':\n                    arg_10 = arg_6[arg_9].isnull()\n                    if any(arg_10):\n                        raise ValueError('Unexpected categories found in column %s' % arg_9)\n\n                if arg_4 == 'return_nan':\n                    arg_6[arg_9] = arg_6[arg_9].map(arg_5).where(arg_6[arg_9] == -2, arg_6[arg_9])\n\n        else:\n            arg_7 = []\n            for arg_11 in arg_2:\n\n                arg_12 = np.nan\n\n                if util.is_category(arg_6[arg_11].dtype):\n                    arg_13 = arg_6[arg_11].cat.categories\n                else:\n                    arg_13 = arg_6[arg_11].unique()\n\n                arg_14 = pd.Series(arg_13).fillna(arg_12).unique()\n\n                arg_15 = pd.Series(arg_14=arg_14, arg_15=range(1, len(arg_14) + 1))\n\n                if arg_4 == 'value' and ~arg_15.index.isnull().any():\n                    arg_15.loc[arg_12] = -2\n                elif arg_4 == 'return_nan':\n                    arg_15.loc[arg_12] = -2\n\n                arg_7.append({'col': arg_11, 'mapping': arg_15, 'data_type': arg_6[arg_11].dtype}, )\n\n        return arg_6, arg_7", "path": "category_encoders/ordinal.py", "identifier": "OrdinalEncoder.ordinal_encoding", "docstring": "Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed\n        in, in this case we use the knowledge that there is some true order to the classes themselves. Otherwise, the classes\n        are assumed to have no true order and integers are selected at random.", "docstring_tokens": ["Ordinal", "encoding", "uses", "a", "single", "column", "of", "integers", "to", "represent", "the", "classes", ".", "An", "optional", "mapping", "dict", "can", "be", "passed", "in", "in", "this", "case", "we", "use", "the", "knowledge", "that", "there", "is", "some", "true", "order", "to", "the", "classes", "themselves", ".", "Otherwise", "the", "classes", "are", "assumed", "to", "have", "no", "true", "order", "and", "integers", "are", "selected", "at", "random", "."], "nwo": "scikit-learn-contrib/categorical-encoding", "score": 0.948361178849178, "idx": 261032}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1080-L1095", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Double-click and drag the left mouse button without modifiers\n        pressed.", "language": "python", "parameters": "(self, coord, dest_coord, interval=0.5)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "0.5", ")", ":", "arg_4", "=", "0", "arg_0", ".", "_queueMouseButton", "(", "arg_1", ",", "Quartz", ".", "kCGMouseButtonLeft", ",", "arg_4", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "_queueMouseButton", "(", "arg_1", ",", "Quartz", ".", "kCGMouseButtonLeft", ",", "arg_4", ",", "arg_2", "=", "arg_2", ",", "clickCount", "=", "2", ")", "arg_0", ".", "_postQueuedEvents", "(", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=0.5):\n        \"\"\"Double-click and drag the left mouse button without modifiers\n        pressed.\n\n        Parameters: coordinates to double-click on screen (tuple (x, y))\n                    dest coordinates to drag to (tuple (x, y))\n                    interval to send event of btn down, drag and up\n        Returns: None\n        \"\"\"\n        arg_4 = 0\n        arg_0._queueMouseButton(arg_1, Quartz.kCGMouseButtonLeft, arg_4,\n                               arg_2=arg_2)\n        arg_0._queueMouseButton(arg_1, Quartz.kCGMouseButtonLeft, arg_4,\n                               arg_2=arg_2,\n                               clickCount=2)\n        arg_0._postQueuedEvents(arg_3=arg_3)", "path": "atomac/AXClasses.py", "identifier": "NativeUIElement.doubleClickDragMouseButtonLeft", "docstring": "Double-click and drag the left mouse button without modifiers\n        pressed.\n\n        Parameters: coordinates to double-click on screen (tuple (x, y))\n                    dest coordinates to drag to (tuple (x, y))\n                    interval to send event of btn down, drag and up\n        Returns: None", "docstring_tokens": ["Double", "-", "click", "and", "drag", "the", "left", "mouse", "button", "without", "modifiers", "pressed", "."], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 261033}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/dag_processing.py#L779-L787", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Helper method to clean up DAG file processors to avoid leaving orphan processes.", "language": "python", "parameters": "(self, signum, frame)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "log", ".", "info", "(", "\"Exiting gracefully upon receiving signal %s\"", ",", "arg_1", ")", "arg_0", ".", "terminate", "(", ")", "arg_0", ".", "end", "(", ")", "arg_0", ".", "log", ".", "debug", "(", "\"Finished terminating DAG processors.\"", ")", "sys", ".", "exit", "(", "os", ".", "EX_OK", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Helper method to clean up DAG file processors to avoid leaving orphan processes.\n        \"\"\"\n        arg_0.log.info(\"Exiting gracefully upon receiving signal %s\", arg_1)\n        arg_0.terminate()\n        arg_0.end()\n        arg_0.log.debug(\"Finished terminating DAG processors.\")\n        sys.exit(os.EX_OK)", "path": "airflow/utils/dag_processing.py", "identifier": "DagFileProcessorManager._exit_gracefully", "docstring": "Helper method to clean up DAG file processors to avoid leaving orphan processes.", "docstring_tokens": ["Helper", "method", "to", "clean", "up", "DAG", "file", "processors", "to", "avoid", "leaving", "orphan", "processes", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261034}
{"url": "https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/__init__.py#L103-L115", "sha": "51010195cbb5361dcd4b414ff132b87244c9e1cb", "docstring_summary": "Back-end version.", "language": "python", "parameters": "(backend, childprocess=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "childprocess_default_value", "(", ")", "if", "not", "arg_1", ":", "return", "_Func", "(", "arg_0", ")", "else", ":", "return", "run_in_childprocess", "(", "_Func", ",", "None", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"Back-end version.\n\n    :param backend: back-end (examples:scrot, wx,..)\n    :param childprocess: see :py:func:`grab`\n    :return: version as string\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = childprocess_default_value()\n    if not arg_1:\n        return _Func(arg_0)\n    else:\n        return run_in_childprocess(_Func, None, arg_0)", "path": "pyscreenshot/__init__.py", "identifier": "backend_version", "docstring": "Back-end version.\n\n    :param backend: back-end (examples:scrot, wx,..)\n    :param childprocess: see :py:func:`grab`\n    :return: version as string", "docstring_tokens": ["Back", "-", "end", "version", "."], "nwo": "ponty/pyscreenshot", "score": 0.5737175809698164, "idx": 261035}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L113-L121", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "A rule that accepts a token of kind ``kind`` and returns its location, or returns None.", "language": "python", "parameters": "(kind, loc=None)", "return_statement": "return rule", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "@", "llrule", "(", "arg_1", ",", "lambda", "arg_2", ":", "[", "arg_0", "]", ")", "def", "rule", "(", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "_accept", "(", "arg_0", ")", "if", "arg_3", "is", "unmatched", ":", "return", "arg_3", "return", "arg_3", ".", "loc", "return", "rule"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"A rule that accepts a token of kind ``kind`` and returns its location, or returns None.\"\"\"\n    @llrule(arg_1, lambda arg_2: [arg_0])\n    def rule(arg_2):\n        arg_3 = arg_2._accept(arg_0)\n        if arg_3 is unmatched:\n            return arg_3\n        return arg_3.loc\n    return rule", "path": "third_party/pythonparser/parser.py", "identifier": "Loc", "docstring": "A rule that accepts a token of kind ``kind`` and returns its location, or returns None.", "docstring_tokens": ["A", "rule", "that", "accepts", "a", "token", "of", "kind", "kind", "and", "returns", "its", "location", "or", "returns", "None", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 261036}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/transport.py#L490-L509", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Add a node to the network", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_nodes", ".", "add", "(", "arg_1", ")", "arg_0", ".", "_nodeAddrToNode", "[", "arg_1", ".", "address", "]", "=", "arg_1", "if", "arg_0", ".", "_shouldConnect", "(", "arg_1", ")", ":", "arg_4", "=", "TcpConnection", "(", "poller", "=", "arg_0", ".", "_syncObj", ".", "_poller", ",", "timeout", "=", "arg_0", ".", "_syncObj", ".", "conf", ".", "connectionTimeout", ",", "sendBufferSize", "=", "arg_0", ".", "_syncObj", ".", "conf", ".", "sendBufferSize", ",", "recvBufferSize", "=", "arg_0", ".", "_syncObj", ".", "conf", ".", "recvBufferSize", ")", "arg_4", ".", "encryptor", "=", "arg_0", ".", "_syncObj", ".", "encryptor", "arg_4", ".", "setOnConnectedCallback", "(", "functools", ".", "partial", "(", "arg_0", ".", "_onOutgoingConnected", ",", "arg_4", ")", ")", "arg_4", ".", "setOnMessageReceivedCallback", "(", "functools", ".", "partial", "(", "arg_0", ".", "_onMessageReceived", ",", "arg_1", ")", ")", "arg_4", ".", "setOnDisconnectedCallback", "(", "functools", ".", "partial", "(", "arg_0", ".", "_onDisconnected", ",", "arg_4", ")", ")", "arg_0", ".", "_connections", "[", "arg_1", "]", "=", "arg_4"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Add a node to the network\n\n        :param node: node to add\n        :type node: TCPNode\n        \"\"\"\n\n        arg_0._nodes.add(arg_1)\n        arg_0._nodeAddrToNode[arg_1.address] = arg_1\n        if arg_0._shouldConnect(arg_1):\n            arg_4 = TcpConnection(poller = arg_0._syncObj._poller,\n                                 timeout = arg_0._syncObj.conf.connectionTimeout,\n                                 sendBufferSize = arg_0._syncObj.conf.sendBufferSize,\n                                 recvBufferSize = arg_0._syncObj.conf.recvBufferSize)\n            arg_4.encryptor = arg_0._syncObj.encryptor\n            arg_4.setOnConnectedCallback(functools.partial(arg_0._onOutgoingConnected, arg_4))\n            arg_4.setOnMessageReceivedCallback(functools.partial(arg_0._onMessageReceived, arg_1))\n            arg_4.setOnDisconnectedCallback(functools.partial(arg_0._onDisconnected, arg_4))\n            arg_0._connections[arg_1] = arg_4", "path": "pysyncobj/transport.py", "identifier": "TCPTransport.addNode", "docstring": "Add a node to the network\n\n        :param node: node to add\n        :type node: TCPNode", "docstring_tokens": ["Add", "a", "node", "to", "the", "network"], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 261037}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/settings.py#L279-L297", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Return an integer range validator to be used with `add_setting`.", "language": "python", "parameters": "(start, stop)", "return_statement": "return validate_int_range", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "validate_int_range", "(", "arg_2", ")", ":", "arg_2", "=", "int", "(", "arg_2", ")", "if", "arg_2", ">=", "arg_0", "and", "arg_2", "<", "arg_1", ":", "return", "arg_2", "raise", "ValueError", "(", "\"Not in <{0},{1}) range\"", ".", "format", "(", "arg_0", ",", "arg_1", ")", ")", "return", "validate_int_range"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return an integer range validator to be used with `add_setting`.\n\n        :Parameters:\n            - `start`: minimum value for the integer\n            - `stop`: the upper bound (maximum value + 1)\n        :Types:\n            - `start`: `int`\n            - `stop`: `int`\n\n        :return: a validator function\n        \"\"\"\n        def validate_int_range(arg_2):\n            \"\"\"Integer range validator.\"\"\"\n            arg_2 = int(arg_2)\n            if arg_2 >= arg_0 and arg_2 < arg_1:\n                return arg_2\n            raise ValueError(\"Not in <{0},{1}) range\".format(arg_0, arg_1))\n        return validate_int_range", "path": "pyxmpp2/settings.py", "identifier": "XMPPSettings.get_int_range_validator", "docstring": "Return an integer range validator to be used with `add_setting`.\n\n        :Parameters:\n            - `start`: minimum value for the integer\n            - `stop`: the upper bound (maximum value + 1)\n        :Types:\n            - `start`: `int`\n            - `stop`: `int`\n\n        :return: a validator function", "docstring_tokens": ["Return", "an", "integer", "range", "validator", "to", "be", "used", "with", "add_setting", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 261038}
{"url": "https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/vcf2clinvar/common.py#L116-L129", "sha": "d5bbf6df2902c6cabe9ef1894cfac527e90fa32a", "docstring_summary": "Parse the VCF info field", "language": "python", "parameters": "(self, info_field)", "return_statement": "return info", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", ")", "for", "arg_3", "in", "arg_1", ".", "split", "(", "';'", ")", ":", "arg_4", "=", "arg_3", ".", "split", "(", "'='", ")", "if", "len", "(", "arg_4", ")", "==", "1", ":", "arg_2", "[", "arg_4", "[", "0", "]", "]", "=", "True", "elif", "len", "(", "arg_4", ")", "==", "2", ":", "arg_2", "[", "arg_4", "[", "0", "]", "]", "=", "arg_4", "[", "1", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Parse the VCF info field\"\"\"\n        arg_2 = dict()\n        for arg_3 in arg_1.split(';'):\n            # Info fields may be \"foo=bar\" or just \"foo\".\n            # For the first case, store key \"foo\" with value \"bar\"\n            # For the second case, store key \"foo\" with value True.\n            arg_4 = arg_3.split('=')\n            # If length is one, just store as a key with value = true.\n            if len(arg_4) == 1:\n                arg_2[arg_4[0]] = True\n            elif len(arg_4) == 2:\n                arg_2[arg_4[0]] = arg_4[1]\n        return arg_2", "path": "vcf2clinvar/common.py", "identifier": "VCFLine._parse_info", "docstring": "Parse the VCF info field", "docstring_tokens": ["Parse", "the", "VCF", "info", "field"], "nwo": "madprime/vcf2clinvar", "score": 0.16246995141409282, "idx": 261039}
{"url": "https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/backends/base/backend.py#L192-L206", "sha": "c23ce9732720856e2f6dc54060db71a8182c7d4b", "docstring_summary": "Like ``generate`` but writes to disk.", "language": "python", "parameters": "(self, name, path='./')", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'./'", ")", ":", "arg_3", "=", "arg_0", ".", "generate", "(", ")", "arg_4", "=", "'{0}.tar.gz'", ".", "format", "(", "arg_1", ")", "if", "not", "arg_2", ".", "endswith", "(", "'/'", ")", ":", "arg_2", "+=", "'/'", "arg_5", "=", "open", "(", "'{0}{1}'", ".", "format", "(", "arg_2", ",", "arg_4", ")", ",", "'wb'", ")", "arg_5", ".", "Func", "(", "arg_3", ".", "getvalue", "(", ")", ")", "arg_5", ".", "close", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2='./'):\n        \"\"\"\n        Like ``generate`` but Funcs to disk.\n\n        :param name: file name, the tar.gz extension will be added automatically\n        :param path: directory where the file will be written to, defaults to ``./``\n        :returns: None\n        \"\"\"\n        arg_3 = arg_0.generate()\n        arg_4 = '{0}.tar.gz'.format(arg_1)\n        if not arg_2.endswith('/'):\n            arg_2 += '/'\n        arg_5 = open('{0}{1}'.format(arg_2, arg_4), 'wb')\n        arg_5.Func(arg_3.getvalue())\n        arg_5.close()", "path": "netjsonconfig/backends/base/backend.py", "identifier": "BaseBackend.write", "docstring": "Like ``generate`` but writes to disk.\n\n        :param name: file name, the tar.gz extension will be added automatically\n        :param path: directory where the file will be written to, defaults to ``./``\n        :returns: None", "docstring_tokens": ["Like", "generate", "but", "writes", "to", "disk", "."], "nwo": "openwisp/netjsonconfig", "score": 0.6422153945684831, "idx": 261040}
{"url": "https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/validate.py#L26-L33", "sha": "5e613f486f29fe350999d6b990d32847ac16a1b8", "docstring_summary": "Runs the correct validator for given `obj`ects. Assumes all same type", "language": "python", "parameters": "(*objs)", "return_statement": "return validator(*[obj.file for obj in objs])", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "from", ".", "main", "import", "Collection", ",", "Module", "arg_1", "=", "{", "Collection", ":", "cnxml", ".", "validate_collxml", ",", "Module", ":", "cnxml", ".", "validate_cnxml", ",", "}", "[", "type", "(", "arg_0", "[", "0", "]", ")", "]", "return", "arg_1", "(", "*", "[", "arg_2", ".", "file", "for", "arg_2", "in", "arg_0", "]", ")"], "function": "def Func(*arg_0):\n    \"\"\"Runs the correct validator for given `obj`ects. Assumes all same type\"\"\"\n    from .main import Collection, Module\n    arg_1 = {\n        Collection: cnxml.validate_collxml,\n        Module: cnxml.validate_cnxml,\n    }[type(arg_0[0])]\n    return arg_1(*[arg_2.file for arg_2 in arg_0])", "path": "litezip/validate.py", "identifier": "validate_content", "docstring": "Runs the correct validator for given `obj`ects. Assumes all same type", "docstring_tokens": ["Runs", "the", "correct", "validator", "for", "given", "obj", "ects", ".", "Assumes", "all", "same", "type"], "nwo": "openstax/cnx-litezip", "score": 0.3282631104312029, "idx": 261041}
{"url": "https://github.com/edavis/django-override-settings/blob/016a2ba44cf7132d3aeefbfeddaf201217b1d4b6/override_settings/__init__.py#L66-L73", "sha": "016a2ba44cf7132d3aeefbfeddaf201217b1d4b6", "docstring_summary": "Class decorator that makes sure the passed apps are present in\n    INSTALLED_APPS.", "language": "python", "parameters": "(*apps)", "return_statement": "return override_settings(INSTALLED_APPS=list(apps_set))", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "arg_1", "=", "set", "(", "settings", ".", "INSTALLED_APPS", ")", "arg_1", ".", "update", "(", "arg_0", ")", "return", "override_settings", "(", "INSTALLED_APPS", "=", "list", "(", "arg_1", ")", ")"], "function": "def Func(*arg_0):\n    \"\"\"\n    Class decorator that makes sure the passed apps are present in\n    INSTALLED_APPS.\n    \"\"\"\n    arg_1 = set(settings.INSTALLED_APPS)\n    arg_1.update(arg_0)\n    return override_settings(INSTALLED_APPS=list(arg_1))", "path": "override_settings/__init__.py", "identifier": "with_apps", "docstring": "Class decorator that makes sure the passed apps are present in\n    INSTALLED_APPS.", "docstring_tokens": ["Class", "decorator", "that", "makes", "sure", "the", "passed", "apps", "are", "present", "in", "INSTALLED_APPS", "."], "nwo": "edavis/django-override-settings", "score": 0.28597268934051834, "idx": 261042}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/networks.py#L200-L226", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Retrieve a list of networks.", "language": "python", "parameters": "(context, limit=None, sorts=['id'], marker=None,\n                 page_reverse=False, filters=None, fields=None)", "return_statement": "return nets", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "[", "'id'", "]", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Func for tenant %s with filters %s, fields %s\"", "%", "(", "arg_0", ".", "tenant_id", ",", "arg_5", ",", "arg_6", ")", ")", "arg_5", "=", "arg_5", "or", "{", "}", "arg_7", "=", "db_api", ".", "network_find", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "join_subnets", "=", "True", ",", "**", "arg_5", ")", "or", "[", "]", "arg_7", "=", "[", "v", ".", "_make_network_dict", "(", "net", ",", "arg_6", "=", "arg_6", ")", "for", "net", "in", "arg_7", "]", "return", "arg_7"], "function": "def Func(arg_0, arg_1=None, arg_2=['id'], arg_3=None,\n                 arg_4=False, arg_5=None, arg_6=None):\n    \"\"\"Retrieve a list of networks.\n\n    The contents of the list depends on the identity of the user\n    making the request (as indicated by the context) as well as any\n    filters.\n    : param context: neutron api request context\n    : param filters: a dictionary with keys that are valid keys for\n        a network as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictiontary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n    : param fields: a list of strings that are valid keys in a\n        network dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.\n    \"\"\"\n    LOG.info(\"Func for tenant %s with filters %s, fields %s\" %\n             (arg_0.tenant_id, arg_5, arg_6))\n    arg_5 = arg_5 or {}\n    arg_7 = db_api.network_find(arg_0, arg_1, arg_2, arg_3, arg_4,\n                               join_subnets=True, **arg_5) or []\n    arg_7 = [v._make_network_dict(net, arg_6=arg_6) for net in arg_7]\n    return arg_7", "path": "quark/plugin_modules/networks.py", "identifier": "get_networks", "docstring": "Retrieve a list of networks.\n\n    The contents of the list depends on the identity of the user\n    making the request (as indicated by the context) as well as any\n    filters.\n    : param context: neutron api request context\n    : param filters: a dictionary with keys that are valid keys for\n        a network as listed in the RESOURCE_ATTRIBUTE_MAP object\n        in neutron/api/v2/attributes.py.  Values in this dictiontary\n        are an iterable containing values that will be used for an exact\n        match comparison for that value.  Each result returned by this\n        function will have matched one of the values for each key in\n        filters.\n    : param fields: a list of strings that are valid keys in a\n        network dictionary as listed in the RESOURCE_ATTRIBUTE_MAP\n        object in neutron/api/v2/attributes.py. Only these fields\n        will be returned.", "docstring_tokens": ["Retrieve", "a", "list", "of", "networks", "."], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 261043}
{"url": "https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L395-L418", "sha": "b22ffe2470bba9fcc98a30cb55b437bfa1521e7f", "docstring_summary": "Keyword scan for feature collections.", "language": "python", "parameters": "(self, query_id=None, query_fc=None, feature_names=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "arg_0", ".", "_Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ")", "for", "arg_5", "in", "arg_4", ":", "arg_6", "=", "arg_0", ".", "fc_from_dict", "(", "arg_5", "[", "'_source'", "]", "[", "'fc'", "]", ")", "yield", "did", "(", "arg_5", "[", "'_id'", "]", ")", ",", "arg_6"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        '''Keyword scan for feature collections.\n\n        This performs a keyword scan using the query given. A keyword\n        scan searches for FCs with terms in each of the query's indexed\n        fields.\n\n        At least one of ``query_id`` or ``query_fc`` must be provided.\n        If ``query_fc`` is ``None``, then the query is retrieved\n        automatically corresponding to ``query_id``.\n\n        :param str query_id: Optional query id.\n        :param query_fc: Optional query feature collection.\n        :type query_fc: :class:`dossier.fc.FeatureCollection`\n        :param [str] feature_names:\n          A list of feature names to retrieve. When ``None``, all\n          features are retrieved. Wildcards are allowed.\n        :rtype: Iterable of ``(content_id, FC)``\n        '''\n        arg_4 = arg_0._Func(arg_1, arg_2,\n                                arg_3=arg_3)\n        for arg_5 in arg_4:\n            arg_6 = arg_0.fc_from_dict(arg_5['_source']['fc'])\n            yield did(arg_5['_id']), arg_6", "path": "dossier/store/elastic.py", "identifier": "ElasticStore.keyword_scan", "docstring": "Keyword scan for feature collections.\n\n        This performs a keyword scan using the query given. A keyword\n        scan searches for FCs with terms in each of the query's indexed\n        fields.\n\n        At least one of ``query_id`` or ``query_fc`` must be provided.\n        If ``query_fc`` is ``None``, then the query is retrieved\n        automatically corresponding to ``query_id``.\n\n        :param str query_id: Optional query id.\n        :param query_fc: Optional query feature collection.\n        :type query_fc: :class:`dossier.fc.FeatureCollection`\n        :param [str] feature_names:\n          A list of feature names to retrieve. When ``None``, all\n          features are retrieved. Wildcards are allowed.\n        :rtype: Iterable of ``(content_id, FC)``", "docstring_tokens": ["Keyword", "scan", "for", "feature", "collections", "."], "nwo": "dossier/dossier.store", "score": 0.08529914490135834, "idx": 261044}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L108-L117", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Turn on the pull-up resistor for the specified pin if enabled is True,\n        otherwise turn off the pull-up resistor.", "language": "python", "parameters": "(self, pin, enabled)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_validate_pin", "(", "arg_1", ")", "if", "arg_2", ":", "arg_0", ".", "gppu", "[", "int", "(", "arg_1", "/", "8", ")", "]", "|=", "1", "<<", "(", "int", "(", "arg_1", "%", "8", ")", ")", "else", ":", "arg_0", ".", "gppu", "[", "int", "(", "arg_1", "/", "8", ")", "]", "&=", "~", "(", "1", "<<", "(", "int", "(", "arg_1", "%", "8", ")", ")", ")", "arg_0", ".", "write_gppu", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Turn on the pull-up resistor for the specified pin if enabled is True,\n        otherwise turn off the pull-up resistor.\n        \"\"\"\n        arg_0._validate_pin(arg_1)\n        if arg_2:\n            arg_0.gppu[int(arg_1/8)] |= 1 << (int(arg_1%8))\n        else:\n            arg_0.gppu[int(arg_1/8)] &= ~(1 << (int(arg_1%8)))\n        arg_0.write_gppu()", "path": "Adafruit_GPIO/MCP230xx.py", "identifier": "MCP230xxBase.pullup", "docstring": "Turn on the pull-up resistor for the specified pin if enabled is True,\n        otherwise turn off the pull-up resistor.", "docstring_tokens": ["Turn", "on", "the", "pull", "-", "up", "resistor", "for", "the", "specified", "pin", "if", "enabled", "is", "True", "otherwise", "turn", "off", "the", "pull", "-", "up", "resistor", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 261045}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L337-L365", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Extract self, first, next, last links from a request response", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "dict", "(", ")", "try", ":", "for", "arg_2", ",", "arg_3", "in", "arg_0", ".", "request", ".", "links", ".", "items", "(", ")", ":", "arg_4", "=", "urlparse", "(", "arg_3", "[", "\"url\"", "]", ")", "arg_5", "=", "\"{path}?{query}\"", ".", "format", "(", "path", "=", "arg_4", "[", "2", "]", ",", "query", "=", "arg_4", "[", "4", "]", ")", "arg_1", "[", "arg_2", "]", "=", "arg_5", "arg_4", "=", "list", "(", "urlparse", "(", "arg_0", ".", "self_link", ")", ")", "arg_6", "=", "\"&\"", ".", "join", "(", "[", "\"%s=%s\"", "%", "(", "p", "[", "0", "]", ",", "p", "[", "1", "]", ")", "for", "p", "in", "parse_qsl", "(", "arg_4", "[", "4", "]", ")", "if", "p", "[", "0", "]", "!=", "\"format\"", "]", ")", "arg_1", "[", "\"self\"", "]", "=", "urlunparse", "(", "[", "arg_4", "[", "0", "]", ",", "arg_4", "[", "1", "]", ",", "arg_4", "[", "2", "]", ",", "arg_4", "[", "3", "]", ",", "arg_6", ",", "arg_4", "[", "5", "]", "]", ")", "return", "arg_1", "except", "KeyError", ":", "return", "None"], "function": "def Func(arg_0):\n        \"\"\"\n        Extract self, first, next, last links from a request response\n        \"\"\"\n        arg_1 = dict()\n        try:\n            for arg_2, arg_3 in arg_0.request.links.items():\n                arg_4 = urlparse(arg_3[\"url\"])\n                arg_5 = \"{path}?{query}\".format(path=arg_4[2], query=arg_4[4])\n                arg_1[arg_2] = arg_5\n            # add a 'self' link\n            arg_4 = list(urlparse(arg_0.self_link))\n            # strip 'format' query parameter\n            arg_6 = \"&\".join(\n                [\n                    \"%s=%s\" % (p[0], p[1])\n                    for p in parse_qsl(arg_4[4])\n                    if p[0] != \"format\"\n                ]\n            )\n            # rebuild url fragment\n            # this is a death march\n            arg_1[\"self\"] = urlunparse(\n                [arg_4[0], arg_4[1], arg_4[2], arg_4[3], arg_6, arg_4[5]]\n            )\n            return arg_1\n        except KeyError:\n            # No links present, because it's a single item\n            return None", "path": "pyzotero/zotero.py", "identifier": "Zotero._extract_links", "docstring": "Extract self, first, next, last links from a request response", "docstring_tokens": ["Extract", "self", "first", "next", "last", "links", "from", "a", "request", "response"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 261046}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/viscosity.py#L1503-L1538", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Method to calculate low-pressure gas viscosity at\n        tempearture `T` with a given method.", "language": "python", "parameters": "(self, T, method)", "return_statement": "return mu", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "==", "GHARAGHEIZI", ":", "arg_3", "=", "Gharagheizi_gas_viscosity", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "MW", ")", "elif", "arg_2", "==", "COOLPROP", ":", "arg_3", "=", "CoolProp_T_dependent_property", "(", "arg_1", ",", "arg_0", ".", "CASRN", ",", "'V'", ",", "'g'", ")", "elif", "arg_2", "==", "DIPPR_PERRY_8E", ":", "arg_3", "=", "EQ102", "(", "arg_1", ",", "*", "arg_0", ".", "Perrys2_312_coeffs", ")", "elif", "arg_2", "==", "VDI_PPDS", ":", "arg_3", "=", "horner", "(", "arg_0", ".", "VDI_PPDS_coeffs", ",", "arg_1", ")", "elif", "arg_2", "==", "YOON_THODOS", ":", "arg_3", "=", "Yoon_Thodos", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "MW", ")", "elif", "arg_2", "==", "STIEL_THODOS", ":", "arg_3", "=", "Stiel_Thodos", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "MW", ")", "elif", "arg_2", "==", "LUCAS_GAS", ":", "arg_3", "=", "lucas_gas", "(", "arg_1", ",", "arg_0", ".", "Tc", ",", "arg_0", ".", "Pc", ",", "arg_0", ".", "Zc", ",", "arg_0", ".", "MW", ",", "arg_0", ".", "dipole", ",", "CASRN", "=", "arg_0", ".", "CASRN", ")", "elif", "arg_2", "in", "arg_0", ".", "tabular_data", ":", "arg_3", "=", "arg_0", ".", "interpolate", "(", "arg_1", ",", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        r'''Method to Func low-pressure gas viscosity at\n        tempearture `T` with a given method.\n\n        This method has no exception handling; see `T_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature of the gas, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        mu : float\n            Viscosity of the gas at T and a low pressure, [Pa*S]\n        '''\n        if arg_2 == GHARAGHEIZI:\n            arg_3 = Gharagheizi_gas_viscosity(arg_1, arg_0.Tc, arg_0.Pc, arg_0.MW)\n        elif arg_2 == COOLPROP:\n            arg_3 = CoolProp_T_dependent_property(arg_1, arg_0.CASRN, 'V', 'g')\n        elif arg_2 == DIPPR_PERRY_8E:\n            arg_3 = EQ102(arg_1, *arg_0.Perrys2_312_coeffs)\n        elif arg_2 == VDI_PPDS:\n            arg_3 =  horner(arg_0.VDI_PPDS_coeffs, arg_1)\n        elif arg_2 == YOON_THODOS:\n            arg_3 = Yoon_Thodos(arg_1, arg_0.Tc, arg_0.Pc, arg_0.MW)\n        elif arg_2 == STIEL_THODOS:\n            arg_3 = Stiel_Thodos(arg_1, arg_0.Tc, arg_0.Pc, arg_0.MW)\n        elif arg_2 == LUCAS_GAS:\n            arg_3 = lucas_gas(arg_1, arg_0.Tc, arg_0.Pc, arg_0.Zc, arg_0.MW, arg_0.dipole, CASRN=arg_0.CASRN)\n        elif arg_2 in arg_0.tabular_data:\n            arg_3 = arg_0.interpolate(arg_1, arg_2)\n        return arg_3", "path": "thermo/viscosity.py", "identifier": "ViscosityGas.calculate", "docstring": "r'''Method to calculate low-pressure gas viscosity at\n        tempearture `T` with a given method.\n\n        This method has no exception handling; see `T_dependent_property`\n        for that.\n\n        Parameters\n        ----------\n        T : float\n            Temperature of the gas, [K]\n        method : str\n            Name of the method to use\n\n        Returns\n        -------\n        mu : float\n            Viscosity of the gas at T and a low pressure, [Pa*S]", "docstring_tokens": ["r", "Method", "to", "calculate", "low", "-", "pressure", "gas", "viscosity", "at", "tempearture", "T", "with", "a", "given", "method", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 261047}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/panels.py#L12-L29", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Show all gene panels in the database", "language": "python", "parameters": "(context, institute)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "LOG", ".", "info", "(", "\"Running scout view Func\"", ")", "arg_2", "=", "arg_0", ".", "obj", "[", "'adapter'", "]", "arg_3", "=", "arg_2", ".", "gene_Func", "(", "institute_id", "=", "arg_1", ")", "if", "arg_3", ".", "count", "(", ")", "==", "0", ":", "LOG", ".", "info", "(", "\"No Func found\"", ")", "arg_0", ".", "abort", "(", ")", "click", ".", "echo", "(", "\"#panel_name\\tversion\\tnr_genes\\tdate\"", ")", "for", "arg_4", "in", "arg_3", ":", "click", ".", "echo", "(", "\"{0}\\t{1}\\t{2}\\t{3}\"", ".", "format", "(", "arg_4", "[", "'panel_name'", "]", ",", "str", "(", "arg_4", "[", "'version'", "]", ")", ",", "len", "(", "arg_4", "[", "'genes'", "]", ")", ",", "str", "(", "arg_4", "[", "'date'", "]", ".", "strftime", "(", "'%Y-%m-%d'", ")", ")", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Show all gene Func in the database\"\"\"\n    LOG.info(\"Running scout view Func\")\n    arg_2 = arg_0.obj['adapter']\n\n    arg_3 = arg_2.gene_Func(institute_id=arg_1)\n    if arg_3.count() == 0:\n        LOG.info(\"No Func found\")\n        arg_0.abort()\n    click.echo(\"#panel_name\\tversion\\tnr_genes\\tdate\")\n\n    for arg_4 in arg_3:\n        click.echo(\"{0}\\t{1}\\t{2}\\t{3}\".format(\n            arg_4['panel_name'],\n            str(arg_4['version']),\n            len(arg_4['genes']),\n            str(arg_4['date'].strftime('%Y-%m-%d'))\n        ))", "path": "scout/commands/view/panels.py", "identifier": "panels", "docstring": "Show all gene panels in the database", "docstring_tokens": ["Show", "all", "gene", "panels", "in", "the", "database"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 261048}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/lcvfeatures.py#L283-L301", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This wraps varfeatures.", "language": "python", "parameters": "(task)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "=", "arg_0", "return", "get_varfeatures", "(", "arg_1", ",", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_8", "=", "arg_8", ")", "except", "Exception", "as", "e", ":", "return", "None"], "function": "def Func(arg_0):\n    '''\n    This wraps varfeatures.\n\n    '''\n\n    try:\n        (arg_1, arg_2, arg_3, arg_4, arg_5,\n         arg_6, arg_7, arg_8) = arg_0\n        return get_varfeatures(arg_1, arg_2,\n                               arg_3=arg_3,\n                               arg_4=arg_4,\n                               arg_5=arg_5,\n                               arg_6=arg_6,\n                               arg_7=arg_7,\n                               arg_8=arg_8)\n\n    except Exception as e:\n        return None", "path": "astrobase/lcproc/lcvfeatures.py", "identifier": "_varfeatures_worker", "docstring": "This wraps varfeatures.", "docstring_tokens": ["This", "wraps", "varfeatures", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 261049}
{"url": "https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/netcdf/grids/collection.py#L128-L152", "sha": "7ea7626695abf095df6a67f66e5b3e9ae91b16df", "docstring_summary": "Combine many files into a single file on disk.  Defaults to using the 'time' dimension.", "language": "python", "parameters": "(self, members, output_file, dimension=None, start_index=None, stop_index=None, stride=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "None", "try", ":", "arg_7", "=", "Nco", "(", ")", "except", "BaseException", ":", "raise", "ImportError", "(", "\"NCO not found.  The NCO python bindings are required to use 'Collection.Func'.\"", ")", "if", "len", "(", "arg_1", ")", ">", "0", "and", "hasattr", "(", "arg_1", "[", "0", "]", ",", "'path'", ")", ":", "arg_1", "=", "[", "m", ".", "path", "for", "m", "in", "arg_1", "]", "arg_8", "=", "[", "'-4'", "]", "arg_8", "+=", "[", "'-L'", ",", "'3'", "]", "arg_8", "+=", "[", "'-h'", "]", "if", "arg_3", "is", "not", "None", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "0", "if", "arg_5", "is", "None", ":", "arg_5", "=", "''", "if", "arg_6", "is", "None", ":", "arg_6", "=", "1", "arg_8", "+=", "[", "'-d'", ",", "'{0},{1},{2},{3}'", ".", "format", "(", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "]", "arg_7", ".", "ncrcat", "(", "input", "=", "arg_1", ",", "output", "=", "arg_2", ",", "arg_8", "=", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=None):\n        \"\"\" Combine many files into a single file on disk.  Defaults to using the 'time' dimension. \"\"\"\n        arg_7 = None\n        try:\n            arg_7 = Nco()\n        except BaseException:\n            # This is not necessarily an import error (could be wrong PATH)\n            raise ImportError(\"NCO not found.  The NCO python bindings are required to use 'Collection.Func'.\")\n\n        if len(arg_1) > 0 and hasattr(arg_1[0], 'path'):\n            # A member DotDoct was passed in, we only need the paths\n            arg_1 = [ m.path for m in arg_1 ]\n\n        arg_8  = ['-4']  # NetCDF4\n        arg_8 += ['-L', '3']  # Level 3 compression\n        arg_8 += ['-h']  # Don't append to the history global attribute\n        if arg_3 is not None:\n            if arg_4 is None:\n                arg_4 = 0\n            if arg_5 is None:\n                arg_5 = ''\n            if arg_6 is None:\n                arg_6 = 1\n            arg_8 += ['-d', '{0},{1},{2},{3}'.format(arg_3, arg_4, arg_5, arg_6)]\n        arg_7.ncrcat(input=arg_1, output=arg_2, arg_8=arg_8)", "path": "pyaxiom/netcdf/grids/collection.py", "identifier": "Collection.combine", "docstring": "Combine many files into a single file on disk.  Defaults to using the 'time' dimension.", "docstring_tokens": ["Combine", "many", "files", "into", "a", "single", "file", "on", "disk", ".", "Defaults", "to", "using", "the", "time", "dimension", "."], "nwo": "axiom-data-science/pyaxiom", "score": 0.138843686048881, "idx": 261050}
{"url": "https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/validator.py#L41-L51", "sha": "97cdd1e241498446b46157b79b2a1ea2ec6d387a", "docstring_summary": "Returns all errors found with the bundle.", "language": "python", "parameters": "(self)", "return_statement": "return self._errors", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "_Func", ".", "extend", "(", "arg_0", ".", "_validator", ")", "except", "StopIteration", ":", "pass", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        # type: () -> List[Text]\n        \"\"\"\n        Returns all Func found with the bundle.\n        \"\"\"\n        try:\n            arg_0._Func.extend(arg_0._validator)  # type: List[Text]\n        except StopIteration:\n            pass\n\n        return arg_0._Func", "path": "iota/transaction/validator.py", "identifier": "BundleValidator.errors", "docstring": "Returns all errors found with the bundle.", "docstring_tokens": ["Returns", "all", "errors", "found", "with", "the", "bundle", "."], "nwo": "iotaledger/iota.lib.py", "score": 0.7132834846011566, "idx": 261051}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/input_output.py#L455-L473", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Writes results to file using the standard MIREX format.", "language": "python", "parameters": "(times, labels, out_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "msaf", ".", "utils", ".", "times_to_intervals", "(", "arg_0", ")", "assert", "len", "(", "arg_3", ")", "==", "len", "(", "arg_1", ")", "arg_4", "=", "\"\"", "for", "arg_5", ",", "arg_6", "in", "zip", "(", "arg_3", ",", "arg_1", ")", ":", "arg_4", "+=", "\"%.3f\\t%.3f\\t%s\\n\"", "%", "(", "arg_5", "[", "0", "]", ",", "arg_5", "[", "1", "]", ",", "arg_6", ")", "with", "open", "(", "arg_2", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "arg_4", "[", ":", "-", "1", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Writes results to file using the standard MIREX format.\n\n    Parameters\n    ----------\n    times: np.array\n        Times in seconds of the boundaries.\n    labels: np.array\n        Labels associated to the segments defined by the boundaries.\n    out_file: str\n        Output file path to save the results.\n    \"\"\"\n    arg_3 = msaf.utils.times_to_intervals(arg_0)\n    assert len(arg_3) == len(arg_1)\n    arg_4 = \"\"\n    for arg_5, arg_6 in zip(arg_3, arg_1):\n        arg_4 += \"%.3f\\t%.3f\\t%s\\n\" % (arg_5[0], arg_5[1], arg_6)\n    with open(arg_2, \"w\") as f:\n        f.write(arg_4[:-1])", "path": "msaf/input_output.py", "identifier": "write_mirex", "docstring": "Writes results to file using the standard MIREX format.\n\n    Parameters\n    ----------\n    times: np.array\n        Times in seconds of the boundaries.\n    labels: np.array\n        Labels associated to the segments defined by the boundaries.\n    out_file: str\n        Output file path to save the results.", "docstring_tokens": ["Writes", "results", "to", "file", "using", "the", "standard", "MIREX", "format", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 261052}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py#L261-L268", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Retrieves a history item, possibly with temporary edits.", "language": "python", "parameters": "(self, index)", "return_statement": "return self._history[index]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_history_edits", ":", "return", "arg_0", ".", "_history_edits", "[", "arg_1", "]", "elif", "arg_1", "==", "len", "(", "arg_0", ".", "_history", ")", ":", "return", "unicode", "(", ")", "return", "arg_0", ".", "_history", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Retrieves a history item, possibly with temporary edits.\n        \"\"\"\n        if arg_1 in arg_0._history_edits:\n            return arg_0._history_edits[arg_1]\n        elif arg_1 == len(arg_0._history):\n            return unicode()\n        return arg_0._history[arg_1]", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py", "identifier": "HistoryConsoleWidget._get_edited_history", "docstring": "Retrieves a history item, possibly with temporary edits.", "docstring_tokens": ["Retrieves", "a", "history", "item", "possibly", "with", "temporary", "edits", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261053}
{"url": "https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L71-L74", "sha": "afbb569ae04002743db041d3629a5be8c290bd89", "docstring_summary": "Returns an absolute expanded path", "language": "python", "parameters": "(path)", "return_statement": "return os.path.abspath(os.path.expandvars(os.path.expanduser(path)))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expandvars", "(", "os", ".", "path", ".", "expanduser", "(", "arg_0", ")", ")", ")"], "function": "def Func(arg_0):\n    '''Returns an absolute expanded path'''\n\n    return os.path.abspath(os.path.expandvars(os.path.expanduser(arg_0)))", "path": "cpenv/utils.py", "identifier": "expandpath", "docstring": "Returns an absolute expanded path", "docstring_tokens": ["Returns", "an", "absolute", "expanded", "path"], "nwo": "cpenv/cpenv", "score": 0.12050106452410352, "idx": 261054}
{"url": "https://github.com/twneale/nmmd/blob/ab3b3f1290c85b8d05bbf59b54c7f22da8972b6f/nmmd/base.py#L202-L208", "sha": "ab3b3f1290c85b8d05bbf59b54c7f22da8972b6f", "docstring_summary": "Find the first method this input dispatches to.", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "gen_methods", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "return", "arg_3", "arg_4", "=", "'No method was found for %r on %r.'", "raise", "arg_0", ".", "DispatchError", "(", "arg_4", "%", "(", "(", "arg_1", ",", "arg_2", ")", ",", "arg_0", ".", "inst", ")", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        '''Find the first method this input dispatches to.\n        '''\n        for arg_3 in arg_0.gen_methods(*arg_1, **arg_2):\n            return arg_3\n        arg_4 = 'No method was found for %r on %r.'\n        raise arg_0.DispatchError(arg_4 % ((arg_1, arg_2), arg_0.inst))", "path": "nmmd/base.py", "identifier": "Dispatcher.get_method", "docstring": "Find the first method this input dispatches to.", "docstring_tokens": ["Find", "the", "first", "method", "this", "input", "dispatches", "to", "."], "nwo": "twneale/nmmd", "score": 0.17782712273869106, "idx": 261055}
{"url": "https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/Client.py#L100-L103", "sha": "63f55c3d726d24c4cfd3674d3cd6aab6f5be110d", "docstring_summary": "Unregisters a hook. For further explanation, please have a look at ``register_hook``.", "language": "python", "parameters": "(self, func)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "hooks", ":", "arg_0", ".", "hooks", ".", "remove", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\r\n        \"\"\" Unregisters a hook. For further explanation, please have a look at ``register_hook``. \"\"\"\r\n        if arg_1 in arg_0.hooks:\r\n            arg_0.hooks.remove(arg_1)", "path": "lavalink/Client.py", "identifier": "Client.unregister_hook", "docstring": "Unregisters a hook. For further explanation, please have a look at ``register_hook``.", "docstring_tokens": ["Unregisters", "a", "hook", ".", "For", "further", "explanation", "please", "have", "a", "look", "at", "register_hook", "."], "nwo": "Devoxin/Lavalink.py", "score": 0.6942938383447541, "idx": 261056}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/base_operator.py#L105-L131", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Reshape input and output dimensions of operator.", "language": "python", "parameters": "(self, input_dims=None, output_dims=None)", "return_statement": "return self", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "if", "np", ".", "product", "(", "arg_1", ")", "!=", "arg_0", ".", "_input_dim", ":", "raise", "QiskitError", "(", "\"Reshaped input_dims are incompatible with combined input dimension.\"", ")", "arg_0", ".", "_input_dims", "=", "tuple", "(", "arg_1", ")", "if", "arg_2", "is", "not", "None", ":", "if", "np", ".", "product", "(", "arg_2", ")", "!=", "arg_0", ".", "_output_dim", ":", "raise", "QiskitError", "(", "\"Reshaped input_dims are incompatible with combined input dimension.\"", ")", "arg_0", ".", "_output_dims", "=", "tuple", "(", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n        \"\"\"Reshape input and output dimensions of operator.\n\n        Arg:\n            input_dims (tuple): new subsystem input dimensions.\n            output_dims (tuple): new subsystem output dimensions.\n\n        Returns:\n            Operator: returns self with reshaped input and output dimensions.\n\n        Raises:\n            QiskitError: if combined size of all subsystem input dimension or\n            subsystem output dimensions is not constant.\n        \"\"\"\n        if arg_1 is not None:\n            if np.product(arg_1) != arg_0._input_dim:\n                raise QiskitError(\n                    \"Reshaped input_dims are incompatible with combined input dimension.\"\n                )\n            arg_0._input_dims = tuple(arg_1)\n        if arg_2 is not None:\n            if np.product(arg_2) != arg_0._output_dim:\n                raise QiskitError(\n                    \"Reshaped input_dims are incompatible with combined input dimension.\"\n                )\n            arg_0._output_dims = tuple(arg_2)\n        return arg_0", "path": "qiskit/quantum_info/operators/base_operator.py", "identifier": "BaseOperator._reshape", "docstring": "Reshape input and output dimensions of operator.\n\n        Arg:\n            input_dims (tuple): new subsystem input dimensions.\n            output_dims (tuple): new subsystem output dimensions.\n\n        Returns:\n            Operator: returns self with reshaped input and output dimensions.\n\n        Raises:\n            QiskitError: if combined size of all subsystem input dimension or\n            subsystem output dimensions is not constant.", "docstring_tokens": ["Reshape", "input", "and", "output", "dimensions", "of", "operator", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 261057}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/packet.py#L318-L340", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Get analog data.", "language": "python", "parameters": "(self, component_info=None, data=None, component_position=None)", "return_statement": "return components", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "[", "]", "arg_5", "=", "arg_4", ".", "append", "for", "arg_6", "in", "range", "(", "arg_1", ".", "device_count", ")", ":", "arg_3", ",", "arg_7", "=", "QRTPacket", ".", "_get_exact", "(", "RTAnalogDevice", ",", "arg_2", ",", "arg_3", ")", "if", "arg_7", ".", "sample_count", ">", "0", ":", "arg_3", ",", "arg_8", "=", "QRTPacket", ".", "_get_exact", "(", "RTSampleNumber", ",", "arg_2", ",", "arg_3", ")", "arg_9", ".", "format", "=", "struct", ".", "Struct", "(", "arg_9", ".", "format_str", "%", "arg_7", ".", "sample_count", ")", "for", "arg_6", "in", "range", "(", "arg_7", ".", "channel_count", ")", ":", "arg_3", ",", "arg_11", "=", "QRTPacket", ".", "_get_tuple", "(", "arg_9", ",", "arg_2", ",", "arg_3", ")", "arg_5", "(", "(", "arg_7", ",", "arg_8", ",", "arg_11", ")", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\n        \"\"\"Get analog data.\"\"\"\n        arg_4 = []\n        arg_5 = arg_4.append\n        for arg_6 in range(arg_1.device_count):\n            arg_3, arg_7 = QRTPacket._get_exact(\n                RTAnalogDevice, arg_2, arg_3\n            )\n            if arg_7.sample_count > 0:\n                arg_3, arg_8 = QRTPacket._get_exact(\n                    RTSampleNumber, arg_2, arg_3\n                )\n\n                arg_9.format = struct.Struct(\n                    arg_9.format_str % arg_7.sample_count\n                )\n                for arg_6 in range(arg_7.channel_count):\n                    arg_3, arg_11 = QRTPacket._get_tuple(\n                        arg_9, arg_2, arg_3\n                    )\n                    arg_5((arg_7, arg_8, arg_11))\n\n        return arg_4", "path": "qtm/packet.py", "identifier": "QRTPacket.get_analog", "docstring": "Get analog data.", "docstring_tokens": ["Get", "analog", "data", "."], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 261058}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L297-L300", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "move cursor right", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "_index", "arg_0", ".", "_select_index", "(", "arg_1", ",", "arg_2", "+", "1", ")"], "function": "def Func(arg_0):\n        \"\"\"move cursor right\"\"\"\n        arg_1, arg_2 = arg_0._index\n        arg_0._select_index(arg_1, arg_2+1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py", "identifier": "CompletionHtml.select_right", "docstring": "move cursor right", "docstring_tokens": ["move", "cursor", "right"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261059}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/typecheck.py#L948-L983", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "check that if assigning to a function call, the function is\n        possibly returning something valuable", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "isinstance", "(", "arg_1", ".", "value", ",", "astroid", ".", "Call", ")", ":", "return", "arg_2", "=", "safe_infer", "(", "arg_1", ".", "value", ".", "func", ")", "arg_3", "=", "(", "astroid", ".", "FunctionDef", ",", "astroid", ".", "UnboundMethod", ",", "astroid", ".", "BoundMethod", ")", "if", "not", "(", "isinstance", "(", "arg_2", ",", "arg_3", ")", "and", "arg_2", ".", "root", "(", ")", ".", "fully_defined", "(", ")", "and", "not", "arg_2", ".", "decorators", ")", ":", "return", "if", "(", "arg_2", ".", "is_generator", "(", ")", "or", "arg_2", ".", "is_abstract", "(", "pass_is_abstract", "=", "False", ")", "or", "isinstance", "(", "arg_2", ",", "astroid", ".", "AsyncFunctionDef", ")", ")", ":", "return", "arg_4", "=", "list", "(", "arg_2", ".", "nodes_of_class", "(", "astroid", ".", "Return", ",", "skip_klass", "=", "astroid", ".", "FunctionDef", ")", ")", "if", "not", "arg_4", ":", "arg_0", ".", "add_message", "(", "\"assignment-from-no-return\"", ",", "arg_1", "=", "arg_1", ")", "else", ":", "for", "arg_5", "in", "arg_4", ":", "if", "not", "(", "isinstance", "(", "arg_5", ".", "value", ",", "astroid", ".", "Const", ")", "and", "arg_5", ".", "value", ".", "value", "is", "None", "or", "arg_5", ".", "value", "is", "None", ")", ":", "break", "else", ":", "arg_0", ".", "add_message", "(", "\"assignment-from-none\"", ",", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"check that if assigning to a function call, the function is\n        possibly returning something valuable\n        \"\"\"\n        if not isinstance(arg_1.value, astroid.Call):\n            return\n        arg_2 = safe_infer(arg_1.value.func)\n        # skip class, generator and incomplete function definition\n        arg_3 = (astroid.FunctionDef, astroid.UnboundMethod, astroid.BoundMethod)\n        if not (\n            isinstance(arg_2, arg_3)\n            and arg_2.root().fully_defined()\n            and not arg_2.decorators\n        ):\n            return\n        if (\n            arg_2.is_generator()\n            or arg_2.is_abstract(pass_is_abstract=False)\n            or isinstance(arg_2, astroid.AsyncFunctionDef)\n        ):\n            return\n        arg_4 = list(\n            arg_2.nodes_of_class(astroid.Return, skip_klass=astroid.FunctionDef)\n        )\n        if not arg_4:\n            arg_0.add_message(\"assignment-from-no-return\", arg_1=arg_1)\n        else:\n            for arg_5 in arg_4:\n                if not (\n                    isinstance(arg_5.value, astroid.Const)\n                    and arg_5.value.value is None\n                    or arg_5.value is None\n                ):\n                    break\n            else:\n                arg_0.add_message(\"assignment-from-none\", arg_1=arg_1)", "path": "pylint/checkers/typecheck.py", "identifier": "TypeChecker.visit_assign", "docstring": "check that if assigning to a function call, the function is\n        possibly returning something valuable", "docstring_tokens": ["check", "that", "if", "assigning", "to", "a", "function", "call", "the", "function", "is", "possibly", "returning", "something", "valuable"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 261060}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/ast/state.py#L92-L99", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "write a '.png' file.", "language": "python", "parameters": "(self, fname: str)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "pipes", ".", "Template", "(", ")", "arg_3", ".", "append", "(", "'dot -Tpng > %s'", "%", "arg_1", ",", "'-.'", ")", "with", "arg_3", ".", "open", "(", "'pipefile'", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_0", ".", "to_dot", "(", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"\n        write a '.png' file.\n        \"\"\"\n        arg_3 = pipes.Template()\n        arg_3.append('dot -Tpng > %s' % arg_1, '-.')\n        with arg_3.open('pipefile', 'w') as f:\n            f.write(arg_0.to_dot())", "path": "pyrser/ast/state.py", "identifier": "StateRegister.to_png_file", "docstring": "write a '.png' file.", "docstring_tokens": ["write", "a", ".", "png", "file", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 261061}
{"url": "https://github.com/sbneto/s3conf/blob/92fd2973beccc85bb21d3157ff227929e62ed695/s3conf/client.py#L40-L62", "sha": "92fd2973beccc85bb21d3157ff227929e62ed695", "docstring_summary": "Simple command line tool to help manage environment variables stored in a S3-like system. Facilitates editing text\n    files remotely stored, as well as downloading and uploading files.", "language": "python", "parameters": "(ctx, edit, create)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "click_log", ".", "basic_config", "(", "'s3conf'", ")", "logger", ".", "debug", "(", "'Running Func entrypoint'", ")", "if", "arg_1", ":", "if", "arg_0", ".", "invoked_subcommand", "is", "None", ":", "logger", ".", "debug", "(", "'Using config file %s'", ",", "config", ".", "LOCAL_CONFIG_FILE", ")", "config", ".", "ConfigFileResolver", "(", "config", ".", "LOCAL_CONFIG_FILE", ")", ".", "edit", "(", "arg_2", "=", "arg_2", ")", "return", "else", ":", "raise", "UsageError", "(", "'Edit should not be called with a subcommand.'", ")", "if", "arg_0", ".", "invoked_subcommand", "is", "None", ":", "click", ".", "echo", "(", "Func", ".", "get_help", "(", "arg_0", ")", ")", "except", "exceptions", ".", "FileDoesNotExist", "as", "e", ":", "raise", "UsageError", "(", "'The file {} does not exist. Try \"-c\" option if you want to create it.'", ".", "format", "(", "str", "(", "e", ")", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Simple command line tool to help manage environment variables stored in a S3-like system. Facilitates editing text\n    files remotely stored, as well as downloading and uploading files.\n    \"\"\"\n    # configs this module logger to behave properly\n    # logger messages will go to stderr (check __init__.py/patch.py)\n    # client output should be generated with click.echo() to go to stdout\n    try:\n        click_log.basic_config('s3conf')\n        logger.debug('Running Func entrypoint')\n        if arg_1:\n            if arg_0.invoked_subcommand is None:\n                logger.debug('Using config file %s', config.LOCAL_CONFIG_FILE)\n                config.ConfigFileResolver(config.LOCAL_CONFIG_FILE).edit(arg_2=arg_2)\n                return\n            else:\n                raise UsageError('Edit should not be called with a subcommand.')\n        # manually call help in case no relevant settings were defined\n        if arg_0.invoked_subcommand is None:\n            click.echo(Func.get_help(arg_0))\n    except exceptions.FileDoesNotExist as e:\n        raise UsageError('The file {} does not exist. Try \"-c\" option if you want to create it.'.format(str(e)))", "path": "s3conf/client.py", "identifier": "main", "docstring": "Simple command line tool to help manage environment variables stored in a S3-like system. Facilitates editing text\n    files remotely stored, as well as downloading and uploading files.", "docstring_tokens": ["Simple", "command", "line", "tool", "to", "help", "manage", "environment", "variables", "stored", "in", "a", "S3", "-", "like", "system", ".", "Facilitates", "editing", "text", "files", "remotely", "stored", "as", "well", "as", "downloading", "and", "uploading", "files", "."], "nwo": "sbneto/s3conf", "score": 0.3282631104312029, "idx": 261062}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L650-L660", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Attempts to load plugins from a list of directories.", "language": "python", "parameters": "(dirs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "[", "os", ".", "path", ".", "expanduser", "(", "d", ")", "for", "d", "in", "arg_0", "]", "for", "arg_1", "in", "arg_0", ":", "if", "os", ".", "path", ".", "isdir", "(", "arg_1", ")", ":", "streamlink", ".", "Func", "(", "arg_1", ")", "else", ":", "log", ".", "warning", "(", "\"Plugin path {0} does not exist or is not \"", "\"a directory!\"", ",", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Attempts to load plugins from a list of directories.\"\"\"\n\n    arg_0 = [os.path.expanduser(d) for d in arg_0]\n\n    for arg_1 in arg_0:\n        if os.path.isdir(arg_1):\n            streamlink.Func(arg_1)\n        else:\n            log.warning(\"Plugin path {0} does not exist or is not \"\n                        \"a directory!\", arg_1)", "path": "src/streamlink_cli/main.py", "identifier": "load_plugins", "docstring": "Attempts to load plugins from a list of directories.", "docstring_tokens": ["Attempts", "to", "load", "plugins", "from", "a", "list", "of", "directories", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 261063}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L90-L109", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Yield egg or source distribution objects based on basename", "language": "python", "parameters": "(location, basename, metadata=None)", "return_statement": "return []", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", ".", "endswith", "(", "'.egg.zip'", ")", ":", "arg_1", "=", "arg_1", "[", ":", "-", "4", "]", "if", "arg_1", ".", "endswith", "(", "'.egg'", ")", "and", "'-'", "in", "arg_1", ":", "return", "[", "Distribution", ".", "from_location", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "]", "if", "arg_1", ".", "endswith", "(", "'.exe'", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "parse_bdist_wininst", "(", "arg_1", ")", "if", "arg_3", "is", "not", "None", ":", "return", "interpret_distro_name", "(", "arg_0", ",", "arg_3", ",", "arg_2", ",", "arg_4", ",", "BINARY_DIST", ",", "arg_5", ")", "for", "arg_6", "in", "EXTENSIONS", ":", "if", "arg_1", ".", "endswith", "(", "arg_6", ")", ":", "arg_1", "=", "arg_1", "[", ":", "-", "len", "(", "arg_6", ")", "]", "return", "interpret_distro_name", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "return", "[", "]"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Yield egg or source distribution objects based on basename\"\"\"\n    if arg_1.endswith('.egg.zip'):\n        arg_1 = arg_1[:-4]    # strip the .zip\n    if arg_1.endswith('.egg') and '-' in arg_1:\n        # only one, unambiguous interpretation\n        return [Distribution.from_location(arg_0, arg_1, arg_2)]\n    if arg_1.endswith('.exe'):\n        arg_3, arg_4, arg_5 = parse_bdist_wininst(arg_1)\n        if arg_3 is not None:\n            return interpret_distro_name(\n                arg_0, arg_3, arg_2, arg_4, BINARY_DIST, arg_5\n            )\n    # Try source distro extensions (.zip, .tgz, etc.)\n    #\n    for arg_6 in EXTENSIONS:\n        if arg_1.endswith(arg_6):\n            arg_1 = arg_1[:-len(arg_6)]\n            return interpret_distro_name(arg_0, arg_1, arg_2)\n    return []", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py", "identifier": "distros_for_location", "docstring": "Yield egg or source distribution objects based on basename", "docstring_tokens": ["Yield", "egg", "or", "source", "distribution", "objects", "based", "on", "basename"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 261064}
{"url": "https://github.com/analytehealth/django-analytics/blob/7782d3f81249dcb1b266afb0cb1e90000108c74d/djanalytics/reports/utils.py#L12-L19", "sha": "7782d3f81249dcb1b266afb0cb1e90000108c74d", "docstring_summary": "Method to calculate and format an average duration safely", "language": "python", "parameters": "(total_duration, visits)", "return_statement": "return str(duration)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ":", "arg_2", "=", "0", "else", ":", "arg_2", "=", "int", "(", "round", "(", "arg_0", "/", "Decimal", "(", "arg_1", ")", ")", ")", "arg_3", "=", "timedelta", "(", "arg_2", "=", "arg_2", ")", "return", "str", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Method to calculate and format an average duration safely \"\"\"\n    if not arg_1:\n        arg_2 = 0\n    else:\n        arg_2 = int(round(arg_0 / Decimal(arg_1)))\n    arg_3 = timedelta(arg_2=arg_2)\n    return str(arg_3)", "path": "djanalytics/reports/utils.py", "identifier": "average_duration", "docstring": "Method to calculate and format an average duration safely", "docstring_tokens": ["Method", "to", "calculate", "and", "format", "an", "average", "duration", "safely"], "nwo": "analytehealth/django-analytics", "score": 0.2718259314615454, "idx": 261065}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L182-L221", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Enable event loop integration with wxPython.", "language": "python", "parameters": "(self, app=None)", "return_statement": "return app", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "import", "wx", "arg_2", "=", "V", "(", "wx", ".", "__version__", ")", ".", "version", "if", "arg_2", "<", "[", "2", ",", "8", "]", ":", "raise", "ValueError", "(", "\"requires wxPython >= 2.8, but you have %s\"", "%", "wx", ".", "__version__", ")", "from", "IPython", ".", "lib", ".", "inputhookwx", "import", "inputhook_wx", "arg_0", ".", "set_inputhook", "(", "inputhook_wx", ")", "arg_0", ".", "_current_gui", "=", "arg_6", "import", "wx", "if", "arg_1", "is", "None", ":", "arg_1", "=", "wx", ".", "GetApp", "(", ")", "if", "arg_1", "is", "None", ":", "arg_1", "=", "wx", ".", "App", "(", "redirect", "=", "False", ",", "clearSigInt", "=", "False", ")", "arg_1", ".", "_in_event_loop", "=", "True", "arg_0", ".", "_apps", "[", "arg_6", "]", "=", "arg_1", "return", "arg_1"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Enable event loop integration with wxPython.\n\n        Parameters\n        ----------\n        app : WX Application, optional.\n            Running application to use.  If not given, we probe WX for an\n            existing application object, and create a new one if none is found.\n\n        Notes\n        -----\n        This methods sets the ``PyOS_InputHook`` for wxPython, which allows\n        the wxPython to integrate with terminal based applications like\n        IPython.\n\n        If ``app`` is not given we probe for an existing one, and return it if\n        found.  If no existing app is found, we create an :class:`wx.App` as\n        follows::\n\n            import wx\n            app = wx.App(redirect=False, clearSigInt=False)\n        \"\"\"\n        import wx\n        \n        arg_2 = V(wx.__version__).version\n        \n        if arg_2 < [2, 8]:\n            raise ValueError(\"requires wxPython >= 2.8, but you have %s\" % wx.__version__)\n        \n        from IPython.lib.inputhookwx import inputhook_wx\n        arg_0.set_inputhook(inputhook_wx)\n        arg_0._current_gui = arg_6\n        import wx\n        if arg_1 is None:\n            arg_1 = wx.GetApp()\n        if arg_1 is None:\n            arg_1 = wx.App(redirect=False, clearSigInt=False)\n        arg_1._in_event_loop = True\n        arg_0._apps[arg_6] = arg_1\n        return arg_1", "path": "environment/lib/python2.7/site-packages/IPython/lib/inputhook.py", "identifier": "InputHookManager.enable_wx", "docstring": "Enable event loop integration with wxPython.\n\n        Parameters\n        ----------\n        app : WX Application, optional.\n            Running application to use.  If not given, we probe WX for an\n            existing application object, and create a new one if none is found.\n\n        Notes\n        -----\n        This methods sets the ``PyOS_InputHook`` for wxPython, which allows\n        the wxPython to integrate with terminal based applications like\n        IPython.\n\n        If ``app`` is not given we probe for an existing one, and return it if\n        found.  If no existing app is found, we create an :class:`wx.App` as\n        follows::\n\n            import wx\n            app = wx.App(redirect=False, clearSigInt=False)", "docstring_tokens": ["Enable", "event", "loop", "integration", "with", "wxPython", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261066}
{"url": "https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/qrt.py#L15-L34", "sha": "127d7eeebc2b38b5cafdfa5d1d0198437fedd274", "docstring_summary": "Decorator to validate responses from QTM", "language": "python", "parameters": "(expected_responses)", "return_statement": "return internal_decorator", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "internal_decorator", "(", "arg_1", ")", ":", "@", "wraps", "(", "arg_1", ")", "async", "def", "wrapper", "(", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "await", "arg_1", "(", "*", "arg_2", ",", "**", "arg_3", ")", "for", "arg_5", "in", "arg_0", ":", "if", "arg_4", ".", "startswith", "(", "arg_5", ")", ":", "return", "arg_4", "raise", "QRTCommandException", "(", "\"Expected %s but got %s\"", "%", "(", "arg_0", ",", "arg_4", ")", ")", "return", "wrapper", "return", "internal_decorator"], "function": "def Func(arg_0):\n    \"\"\" Decorator to validate responses from QTM \"\"\"\n\n    def internal_decorator(arg_1):\n        @wraps(arg_1)\n        async def wrapper(*arg_2, **arg_3):\n\n            arg_4 = await arg_1(*arg_2, **arg_3)\n\n            for arg_5 in arg_0:\n                if arg_4.startswith(arg_5):\n                    return arg_4\n\n            raise QRTCommandException(\n                \"Expected %s but got %s\" % (arg_0, arg_4)\n            )\n\n        return wrapper\n\n    return internal_decorator", "path": "qtm/qrt.py", "identifier": "validate_response", "docstring": "Decorator to validate responses from QTM", "docstring_tokens": ["Decorator", "to", "validate", "responses", "from", "QTM"], "nwo": "qualisys/qualisys_python_sdk", "score": 0.2888524677165775, "idx": 261067}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L167-L183", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "read the ABF header and save it HTML formatted.", "language": "python", "parameters": "(self,fname=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "fname", ".", "replace", "(", "\".abf\"", ",", "\"_header.html\"", ")", "arg_2", "=", "\"<html><body><code>\"", "arg_2", "+=", "\"<h2>abfinfo() for %s.abf</h2>\"", "%", "arg_0", ".", "ID", "arg_2", "+=", "arg_0", ".", "abfinfo", "(", ")", ".", "replace", "(", "\"<\"", ",", "\"&lt;\"", ")", ".", "replace", "(", "\">\"", ",", "\"&gt;\"", ")", ".", "replace", "(", "\"\\n\"", ",", "\"<br>\"", ")", "arg_2", "+=", "\"<h2>Header for %s.abf</h2>\"", "%", "arg_0", ".", "ID", "arg_2", "+=", "pprint", ".", "pformat", "(", "arg_0", ".", "header", ",", "indent", "=", "1", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "\"\\n\"", ",", "'<br>'", ")", ".", "replace", "(", "\" \"", ",", "\"&nbsp;\"", ")", "arg_2", "=", "arg_2", ".", "replace", "(", "r\"\\x00\"", ",", "\"\"", ")", "arg_2", "+=", "\"</code></body></html>\"", "print", "(", "\"WRITING HEADER TO:\"", ")", "print", "(", "arg_1", ")", "arg_3", "=", "open", "(", "arg_1", ",", "'w'", ")", "arg_3", ".", "write", "(", "arg_2", ")", "arg_3", ".", "close", "(", ")"], "function": "def Func(arg_0,arg_1=None):\n        \"\"\"read the ABF header and save it HTML formatted.\"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.fname.replace(\".abf\",\"_header.html\")\n        arg_2=\"<html><body><code>\"\n        arg_2+=\"<h2>abfinfo() for %s.abf</h2>\"%arg_0.ID\n        arg_2+=arg_0.abfinfo().replace(\"<\",\"&lt;\").replace(\">\",\"&gt;\").replace(\"\\n\",\"<br>\")\n        arg_2+=\"<h2>Header for %s.abf</h2>\"%arg_0.ID\n        arg_2+=pprint.pformat(arg_0.header, indent=1)\n        arg_2=arg_2.replace(\"\\n\",'<br>').replace(\" \",\"&nbsp;\")\n        arg_2=arg_2.replace(r\"\\x00\",\"\")\n        arg_2+=\"</code></body></html>\"\n        print(\"WRITING HEADER TO:\")\n        print(arg_1)\n        arg_3=open(arg_1,'w')\n        arg_3.write(arg_2)\n        arg_3.close()", "path": "doc/oldcode/swhlab/core/abf.py", "identifier": "ABF.headerHTML", "docstring": "read the ABF header and save it HTML formatted.", "docstring_tokens": ["read", "the", "ABF", "header", "and", "save", "it", "HTML", "formatted", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 261068}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/file_tree_map.py#L382-L401", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Remove the nodes that match the pattern.", "language": "python", "parameters": "(self, pattern, adict)", "return_statement": "return mydict", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_filetree", "if", "arg_2", "is", "None", "else", "arg_2", "if", "isinstance", "(", "arg_3", ",", "dict", ")", ":", "for", "arg_4", "in", "arg_3", ".", "keys", "(", ")", ":", "if", "isinstance", "(", "arg_3", "[", "arg_4", "]", ",", "dict", ")", ":", "arg_5", "=", "filter_list", "(", "arg_3", "[", "arg_4", "]", ",", "arg_1", ")", "for", "arg_4", "in", "arg_5", ":", "arg_3", "=", "arg_0", ".", "Func", "(", "arg_1", ",", "arg_3", "[", "arg_4", "]", ")", "arg_3", ".", "pop", "(", "arg_4", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "filter_list", "(", "arg_3", "[", "arg_4", "]", ",", "arg_1", ")", "else", ":", "arg_5", "=", "set", "(", "filter_list", "(", "arg_3", ",", "arg_1", ")", ")", "arg_3", "=", "set", "(", "arg_3", ")", "-", "arg_5", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Remove the nodes that match the pattern.\n        \"\"\"\n        arg_3 = arg_0._filetree if arg_2 is None else arg_2\n\n        if isinstance(arg_3, dict):\n            for arg_4 in arg_3.keys():\n                if isinstance(arg_3[arg_4], dict):\n                    arg_5 = filter_list(arg_3[arg_4], arg_1)\n                    for arg_4 in arg_5:\n                        arg_3 = arg_0.Func(arg_1, arg_3[arg_4])\n                        arg_3.pop(arg_4)\n                else:\n                    arg_3[arg_4] = filter_list(arg_3[arg_4], arg_1)\n        else:\n            arg_5 = set(filter_list(arg_3, arg_1))\n            arg_3 = set(arg_3) - arg_5\n\n        return arg_3", "path": "boyle/files/file_tree_map.py", "identifier": "FileTreeMap.remove_nodes", "docstring": "Remove the nodes that match the pattern.", "docstring_tokens": ["Remove", "the", "nodes", "that", "match", "the", "pattern", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 261069}
{"url": "https://github.com/inveniosoftware/invenio-app/blob/6ef600f28913a501c05d75ffbe203e941e229f49/invenio_app/ext.py#L88-L110", "sha": "6ef600f28913a501c05d75ffbe203e941e229f49", "docstring_summary": "Initialize configuration.", "language": "python", "parameters": "(self, app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "'APP_'", ",", "'RATELIMIT_'", "]", "arg_3", "=", "[", "\"'unsafe-inline'\"", "]", "for", "arg_4", "in", "dir", "(", "config", ")", ":", "if", "any", "(", "[", "arg_4", ".", "startswith", "(", "arg_5", ")", "for", "arg_5", "in", "arg_2", "]", ")", ":", "arg_1", ".", "config", ".", "setdefault", "(", "arg_4", ",", "getattr", "(", "config", ",", "arg_4", ")", ")", "if", "arg_1", ".", "config", "[", "'DEBUG'", "]", ":", "arg_1", ".", "config", ".", "setdefault", "(", "'APP_DEFAULT_SECURE_HEADERS'", ",", "{", "}", ")", "arg_6", "=", "arg_1", ".", "config", "[", "'APP_DEFAULT_SECURE_HEADERS'", "]", "if", "arg_6", ".", "get", "(", "'content_security_policy'", ")", "!=", "{", "}", ":", "arg_6", ".", "setdefault", "(", "'content_security_policy'", ",", "{", "}", ")", "arg_7", "=", "arg_6", "[", "'content_security_policy'", "]", "if", "arg_7", ".", "get", "(", "'default-src'", ")", "!=", "[", "]", ":", "arg_7", ".", "setdefault", "(", "'default-src'", ",", "[", "]", ")", "arg_7", "[", "'default-src'", "]", "+=", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Initialize configuration.\n\n        :param app: An instance of :class:`~flask.Flask`.\n        \"\"\"\n        arg_2 = ['APP_', 'RATELIMIT_']\n        arg_3 = [\"'unsafe-inline'\"]\n        for arg_4 in dir(config):\n            if any([arg_4.startswith(arg_5) for arg_5 in arg_2]):\n                arg_1.config.setdefault(arg_4, getattr(config, arg_4))\n\n        if arg_1.config['DEBUG']:\n            arg_1.config.setdefault('APP_DEFAULT_SECURE_HEADERS', {})\n            arg_6 = arg_1.config['APP_DEFAULT_SECURE_HEADERS']\n            # ensure `content_security_policy` is not set to {}\n            if arg_6.get('content_security_policy') != {}:\n                arg_6.setdefault('content_security_policy', {})\n                arg_7 = arg_6['content_security_policy']\n                # ensure `default-src` is not set to []\n                if arg_7.get('default-src') != []:\n                    arg_7.setdefault('default-src', [])\n                    # add default `content_security_policy` value when debug\n                    arg_7['default-src'] += arg_3", "path": "invenio_app/ext.py", "identifier": "InvenioApp.init_config", "docstring": "Initialize configuration.\n\n        :param app: An instance of :class:`~flask.Flask`.", "docstring_tokens": ["Initialize", "configuration", "."], "nwo": "inveniosoftware/invenio-app", "score": 0.19114614593059856, "idx": 261070}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L361-L389", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Find all offset fronts which are composed of at least one offset which corresponds to one of the onsets in the\n    given onset front.\n    The offset front which contains the most of such offsets is the match.\n    If there are no such offset fronts, return -1.", "language": "python", "parameters": "(onset_front_id, onset_fronts, offset_fronts, onsets, offsets)", "return_statement": "return chosen_offset_front_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "_get_front_idxs_from_id", "(", "arg_1", ",", "arg_0", ")", "arg_6", "=", "[", "_lookup_offset_by_onset_idx", "(", "i", ",", "arg_3", ",", "arg_4", ")", "for", "i", "in", "arg_5", "]", "arg_7", "=", "set", "(", "[", "int", "(", "arg_2", "[", "f", ",", "i", "]", ")", "for", "f", ",", "i", "in", "arg_6", "]", ")", "arg_7", "=", "[", "id", "for", "id", "in", "arg_7", "if", "id", "!=", "0", "]", "if", "arg_7", ":", "arg_8", "=", "_choose_front_id_from_candidates", "(", "arg_7", ",", "arg_2", ",", "arg_6", ")", "else", ":", "arg_8", "=", "_get_offset_front_id_after_onset_front", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n    \"\"\"\n    Find all offset fronts which are composed of at least one offset which corresponds to one of the onsets in the\n    given onset front.\n    The offset front which contains the most of such offsets is the match.\n    If there are no such offset fronts, return -1.\n    \"\"\"\n    # find all offset fronts which are composed of at least one offset which corresponds to one of the onsets in the onset front\n    # the offset front which contains the most of such offsets is the match\n\n    # get the onsets that make up front_id\n    arg_5 = _get_front_idxs_from_id(arg_1, arg_0)\n\n    # get the offsets that match the onsets in front_id\n    arg_6 = [_lookup_offset_by_onset_idx(i, arg_3, arg_4) for i in arg_5]\n\n    # get all offset_fronts which contain at least one of these offsets\n    arg_7 = set([int(arg_2[f, i]) for f, i in arg_6])\n\n    # It is possible that offset_idxs contains offset indexes that correspond to offsets that did not\n    # get formed into a front - those will have a front ID of 0. Remove them.\n    arg_7 = [id for id in arg_7 if id != 0]\n\n    if arg_7:\n        arg_8 = _choose_front_id_from_candidates(arg_7, arg_2, arg_6)\n    else:\n        arg_8 = _get_offset_front_id_after_onset_front(arg_0, arg_1, arg_2)\n\n    return arg_8", "path": "algorithms/asa.py", "identifier": "_match_offset_front_id_to_onset_front_id", "docstring": "Find all offset fronts which are composed of at least one offset which corresponds to one of the onsets in the\n    given onset front.\n    The offset front which contains the most of such offsets is the match.\n    If there are no such offset fronts, return -1.", "docstring_tokens": ["Find", "all", "offset", "fronts", "which", "are", "composed", "of", "at", "least", "one", "offset", "which", "corresponds", "to", "one", "of", "the", "onsets", "in", "the", "given", "onset", "front", ".", "The", "offset", "front", "which", "contains", "the", "most", "of", "such", "offsets", "is", "the", "match", ".", "If", "there", "are", "no", "such", "offset", "fronts", "return", "-", "1", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 261071}
{"url": "https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/deletion.py#L184-L225", "sha": "9d1987cdb3a395cf4125a3439c3b002ff2be2009", "docstring_summary": "Knock out each reaction from a given list.", "language": "python", "parameters": "(model, reaction_list=None, method=\"fba\",\n                             solution=None, processes=None, **kwargs)", "return_statement": "return _multi_deletion(\n        model, 'reaction',\n        element_lists=_element_lists(model.reactions, reaction_list),\n        method=method, solution=solution, processes=processes, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "\"fba\"", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "return", "_multi_deletion", "(", "arg_0", ",", "'reaction'", ",", "element_lists", "=", "_element_lists", "(", "arg_0", ".", "reactions", ",", "arg_1", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "**", "arg_5", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=\"fba\",\n                             arg_3=None, arg_4=None, **arg_5):\n    \"\"\"\n    Knock out each reaction from a given list.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    reaction_list : iterable, optional\n        ``cobra.Reaction``s to be deleted. If not passed,\n        all the reactions from the model are used.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Keyword arguments are passed on to underlying simulation functions\n        such as ``add_room``.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all single reaction deletions. The columns are\n        'growth' and 'status', where\n\n        index : frozenset([str])\n            The reaction identifier that was knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.\n\n    \"\"\"\n    return _multi_deletion(\n        arg_0, 'reaction',\n        element_lists=_element_lists(arg_0.reactions, arg_1),\n        arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, **arg_5)", "path": "cobra/flux_analysis/deletion.py", "identifier": "single_reaction_deletion", "docstring": "Knock out each reaction from a given list.\n\n    Parameters\n    ----------\n    model : cobra.Model\n        The metabolic model to perform deletions in.\n    reaction_list : iterable, optional\n        ``cobra.Reaction``s to be deleted. If not passed,\n        all the reactions from the model are used.\n    method: {\"fba\", \"moma\", \"linear moma\", \"room\", \"linear room\"}, optional\n        Method used to predict the growth rate.\n    solution : cobra.Solution, optional\n        A previous solution to use as a reference for (linear) MOMA or ROOM.\n    processes : int, optional\n        The number of parallel processes to run. Can speed up the computations\n        if the number of knockouts to perform is large. If not passed,\n        will be set to the number of CPUs found.\n    kwargs :\n        Keyword arguments are passed on to underlying simulation functions\n        such as ``add_room``.\n\n    Returns\n    -------\n    pandas.DataFrame\n        A representation of all single reaction deletions. The columns are\n        'growth' and 'status', where\n\n        index : frozenset([str])\n            The reaction identifier that was knocked out.\n        growth : float\n            The growth rate of the adjusted model.\n        status : str\n            The solution's status.", "docstring_tokens": ["Knock", "out", "each", "reaction", "from", "a", "given", "list", "."], "nwo": "opencobra/cobrapy", "score": 0.7616079334549548, "idx": 261072}
{"url": "https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L1226-L1250", "sha": "39e840be0b12ce326edac0bba69aeb1be930dcb8", "docstring_summary": "Process INFO lines sent by the server to reconfigure client\n        with latest updates from cluster to enable server discovery.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "'connect_urls'", "in", "arg_1", ":", "if", "arg_1", "[", "'connect_urls'", "]", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", "[", "'connect_urls'", "]", ":", "arg_4", "=", "urlparse", "(", "\"nats://%s\"", "%", "arg_3", ")", "arg_5", "=", "Srv", "(", "arg_4", ")", "arg_5", ".", "discovered", "=", "True", "arg_7", "=", "True", "for", "arg_8", "in", "arg_0", ".", "_server_pool", ":", "if", "arg_4", ".", "netloc", "==", "arg_8", ".", "uri", ".", "netloc", ":", "arg_7", "=", "False", "if", "arg_7", ":", "arg_2", ".", "append", "(", "arg_5", ")", "if", "arg_0", ".", "options", "[", "\"dont_randomize\"", "]", "is", "not", "True", ":", "shuffle", "(", "arg_2", ")", "for", "arg_5", "in", "arg_2", ":", "arg_0", ".", "_server_pool", ".", "append", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Process INFO lines sent by the server to reconfigure client\n        with latest updates from cluster to enable server discovery.\n        \"\"\"\n        if 'connect_urls' in arg_1:\n            if arg_1['connect_urls']:\n                arg_2 = []\n                for arg_3 in arg_1['connect_urls']:\n                    arg_4 = urlparse(\"nats://%s\" % arg_3)\n                    arg_5 = Srv(arg_4)\n                    arg_5.discovered = True\n\n                    # Filter for any similar server in the server pool already.\n                    arg_7 = True\n                    for arg_8 in arg_0._server_pool:\n                        if arg_4.netloc == arg_8.uri.netloc:\n                            arg_7 = False\n                    if arg_7:\n                        arg_2.append(arg_5)\n\n                if arg_0.options[\"dont_randomize\"] is not True:\n                    shuffle(arg_2)\n                for arg_5 in arg_2:\n                    arg_0._server_pool.append(arg_5)", "path": "nats/aio/client.py", "identifier": "Client._process_info", "docstring": "Process INFO lines sent by the server to reconfigure client\n        with latest updates from cluster to enable server discovery.", "docstring_tokens": ["Process", "INFO", "lines", "sent", "by", "the", "server", "to", "reconfigure", "client", "with", "latest", "updates", "from", "cluster", "to", "enable", "server", "discovery", "."], "nwo": "nats-io/asyncio-nats", "score": 0.745233017668433, "idx": 261073}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/inspector.py#L176-L186", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "visit an astroid.Function node", "language": "python", "parameters": "(self, node)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_1", ",", "\"locals_type\"", ")", ":", "return", "arg_1", ".", "locals_type", "=", "collections", ".", "defaultdict", "(", "list", ")", "if", "arg_0", ".", "tag", ":", "arg_1", ".", "uid", "=", "arg_0", ".", "generate_id", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"visit an astroid.Function node\n\n         * set the locals_type mapping\n         * optionally tag the node with a unique id\n        \"\"\"\n        if hasattr(arg_1, \"locals_type\"):\n            return\n        arg_1.locals_type = collections.defaultdict(list)\n        if arg_0.tag:\n            arg_1.uid = arg_0.generate_id()", "path": "pylint/pyreverse/inspector.py", "identifier": "Linker.visit_functiondef", "docstring": "visit an astroid.Function node\n\n         * set the locals_type mapping\n         * optionally tag the node with a unique id", "docstring_tokens": ["visit", "an", "astroid", ".", "Function", "node"], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 261074}
{"url": "https://github.com/padelt/temper-python/blob/cbdbace7e6755b1d91a2603ab63c9cb778078f79/temperusb/temper.py#L38-L46", "sha": "cbdbace7e6755b1d91a2603ab63c9cb778078f79", "docstring_summary": "Read attribute from sysfs and return as string", "language": "python", "parameters": "(path, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "open", "(", "USB_SYS_PREFIX", "+", "arg_0", "+", "\"/\"", "+", "arg_1", ")", "return", "arg_2", ".", "readline", "(", ")", ".", "rstrip", "(", "\"\\n\"", ")", "except", "IOError", ":", "return", "None"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Read attribute from sysfs and return as string\n    \"\"\"\n    try:\n        arg_2 = open(USB_SYS_PREFIX + arg_0 + \"/\" + arg_1)\n        return arg_2.readline().rstrip(\"\\n\")\n    except IOError:\n        return None", "path": "temperusb/temper.py", "identifier": "readattr", "docstring": "Read attribute from sysfs and return as string", "docstring_tokens": ["Read", "attribute", "from", "sysfs", "and", "return", "as", "string"], "nwo": "padelt/temper-python", "score": 0.5855497206829942, "idx": 261075}
{"url": "https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/container.py#L237-L260", "sha": "1151be665b26cc8a479f6307086ba919e4d32d85", "docstring_summary": "Redraws the background and contents, including scrollbar.\n        \n        This method will also check the scrollbar for any movement and will be automatically called on movement of the slider.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_scrollbar", ".", "n", "arg_0", ".", "offset_y", "=", "-", "arg_1", "arg_3", "=", "24", "arg_4", "=", "arg_0", ".", "size", "[", "1", "]", "arg_5", "=", "arg_0", ".", "size", "[", "0", "]", "-", "arg_3", "arg_6", "=", "0", "arg_0", ".", "_scrollbar", ".", "_size", "=", "arg_3", ",", "arg_4", "arg_0", ".", "_scrollbar", ".", "_pos", "=", "arg_5", ",", "arg_6", "arg_0", ".", "_scrollbar", ".", "_nmax", "=", "arg_0", ".", "content_height", "super", "(", "ScrollableContainer", ",", "arg_0", ")", ".", "Func", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Redraws the background and contents, including scrollbar.\n        \n        This method will also check the scrollbar for any movement and will be automatically called on movement of the slider.\n        \"\"\"\n        arg_1 = arg_0._scrollbar.n\n        arg_0.offset_y = -arg_1 # Causes the content to move in the opposite direction of the slider\n        \n        # Size of scrollbar\n        arg_3=24 # Currently constant, TODO: add dynamic sx of scrollbar\n        arg_4=arg_0.size[1]\n        # Pos of scrollbar\n        arg_5=arg_0.size[0]-arg_3\n        arg_6=0 # Currently constant, TODO: add dynamic y-pos of scrollbar\n        \n        # Dynamic pos/size may be added via align/lambda/etc.\n        \n        # Note that the values are written to the _* variant of the attribute to avoid 3 uneccessary redraws\n        arg_0._scrollbar._size = arg_3,arg_4\n        arg_0._scrollbar._pos = arg_5,arg_6\n        arg_0._scrollbar._nmax = arg_0.content_height\n        \n        super(ScrollableContainer,arg_0).Func()", "path": "peng3d/gui/container.py", "identifier": "ScrollableContainer.on_redraw", "docstring": "Redraws the background and contents, including scrollbar.\n        \n        This method will also check the scrollbar for any movement and will be automatically called on movement of the slider.", "docstring_tokens": ["Redraws", "the", "background", "and", "contents", "including", "scrollbar", ".", "This", "method", "will", "also", "check", "the", "scrollbar", "for", "any", "movement", "and", "will", "be", "automatically", "called", "on", "movement", "of", "the", "slider", "."], "nwo": "not-na/peng3d", "score": 0.17385480483333982, "idx": 261076}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/create.py#L411-L458", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Write the data encoding the Create response payload to a buffer.", "language": "python", "parameters": "(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "arg_6", "=", "utils", ".", "BytearrayStream", "(", ")", "if", "arg_0", ".", "_object_type", ":", "arg_0", ".", "_object_type", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The Create response payload is missing the object type field.\"", ")", "if", "arg_0", ".", "_unique_identifier", ":", "arg_0", ".", "_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "exceptions", ".", "InvalidField", "(", "\"The Create response payload is missing the unique identifier \"", "\"field.\"", ")", "if", "arg_2", "<", "arg_3", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "if", "arg_0", ".", "_template_attribute", ":", "arg_0", ".", "_template_attribute", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "length", "=", "arg_6", ".", "length", "(", ")", "super", "(", "CreateResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_1", ".", "Func", "(", "arg_6", ".", "buffer", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Write the data encoding the Create response payload to a buffer.\n\n        Args:\n            output_buffer (stream): A data buffer in which to encode object\n                data, supporting a Func method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidField: Raised if the object type attribute or unique\n                identifier is not defined.\n        \"\"\"\n        arg_6 = utils.BytearrayStream()\n\n        if arg_0._object_type:\n            arg_0._object_type.Func(arg_6, arg_2=arg_2)\n        else:\n            raise exceptions.InvalidField(\n                \"The Create response payload is missing the object type field.\"\n            )\n\n        if arg_0._unique_identifier:\n            arg_0._unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise exceptions.InvalidField(\n                \"The Create response payload is missing the unique identifier \"\n                \"field.\"\n            )\n\n        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:\n            if arg_0._template_attribute:\n                arg_0._template_attribute.Func(\n                    arg_6,\n                    arg_2=arg_2\n                )\n\n        arg_0.length = arg_6.length()\n        super(CreateResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_1.Func(arg_6.buffer)", "path": "kmip/core/messages/payloads/create.py", "identifier": "CreateResponsePayload.write", "docstring": "Write the data encoding the Create response payload to a buffer.\n\n        Args:\n            output_buffer (stream): A data buffer in which to encode object\n                data, supporting a write method.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be encoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            InvalidField: Raised if the object type attribute or unique\n                identifier is not defined.", "docstring_tokens": ["Write", "the", "data", "encoding", "the", "Create", "response", "payload", "to", "a", "buffer", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 261077}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/sirmordred.py#L194-L200", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Just a wrapper to the execute_batch_tasks method", "language": "python", "parameters": "(self, tasks_cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "execute_batch_tasks", "(", "arg_1", ",", "arg_0", ".", "conf", "[", "'sortinghat'", "]", "[", "'sleep_for'", "]", ",", "arg_0", ".", "conf", "[", "'general'", "]", "[", "'min_update_delay'", "]", ",", "False", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n            Just a wrapper to the execute_batch_tasks method\n        \"\"\"\n        arg_0.execute_batch_tasks(arg_1,\n                                 arg_0.conf['sortinghat']['sleep_for'],\n                                 arg_0.conf['general']['min_update_delay'], False)", "path": "sirmordred/sirmordred.py", "identifier": "SirMordred.execute_nonstop_tasks", "docstring": "Just a wrapper to the execute_batch_tasks method", "docstring_tokens": ["Just", "a", "wrapper", "to", "the", "execute_batch_tasks", "method"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 261078}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/mysql.py#L594-L623", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Create a MySQL database.", "language": "python", "parameters": "(name, owner=None, owner_host='localhost', charset='utf8',\n                    collate='utf8_general_ci', **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "'localhost'", ",", "arg_3", "=", "'utf8'", ",", "arg_4", "=", "'utf8_general_ci'", ",", "**", "arg_5", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ")", ")", ":", "query", "(", "\"CREATE DATABASE %(name)s CHARACTER SET %(charset)s COLLATE %(collate)s;\"", "%", "{", "'name'", ":", "arg_0", ",", "'charset'", ":", "arg_3", ",", "'collate'", ":", "arg_4", "}", ",", "**", "arg_5", ")", "if", "arg_1", ":", "query", "(", "\"GRANT ALL PRIVILEGES ON %(name)s.* TO '%(owner)s'@'%(owner_host)s' WITH GRANT OPTION;\"", "%", "{", "'name'", ":", "arg_0", ",", "'owner'", ":", "arg_1", ",", "'owner_host'", ":", "arg_2", "}", ",", "**", "arg_5", ")", "puts", "(", "\"Created MySQL database '%s'.\"", "%", "arg_0", ")"], "function": "def Func(arg_0, arg_1=None, arg_2='localhost', arg_3='utf8',\n                    arg_4='utf8_general_ci', **arg_5):\n    \"\"\"\n    Create a MySQL database.\n\n    Example::\n\n        import burlap\n\n        # Create DB if it does not exist\n        if not burlap.mysql.database_exists('myapp'):\n            burlap.mysql.Func('myapp', owner='dbuser')\n\n    \"\"\"\n    with settings(hide('running')):\n\n        query(\"CREATE DATABASE %(name)s CHARACTER SET %(charset)s COLLATE %(collate)s;\" % {\n            'name': arg_0,\n            'charset': arg_3,\n            'collate': arg_4\n        }, **arg_5)\n\n        if arg_1:\n            query(\"GRANT ALL PRIVILEGES ON %(name)s.* TO '%(owner)s'@'%(owner_host)s' WITH GRANT OPTION;\" % {\n                'name': arg_0,\n                'owner': arg_1,\n                'owner_host': arg_2\n            }, **arg_5)\n\n    puts(\"Created MySQL database '%s'.\" % arg_0)", "path": "burlap/mysql.py", "identifier": "create_database", "docstring": "Create a MySQL database.\n\n    Example::\n\n        import burlap\n\n        # Create DB if it does not exist\n        if not burlap.mysql.database_exists('myapp'):\n            burlap.mysql.create_database('myapp', owner='dbuser')", "docstring_tokens": ["Create", "a", "MySQL", "database", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 261079}
{"url": "https://github.com/vingd/encrypted-pickle-python/blob/7656233598e02e65971f69e11849a0f288b2b2a5/encryptedpickle/encryptedpickle.py#L682-L702", "sha": "7656233598e02e65971f69e11849a0f288b2b2a5", "docstring_summary": "Update algorithm definition type dictionaries", "language": "python", "parameters": "(data, default_data, replace_data=False)", "return_statement": "return data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "not", "arg_0", ":", "arg_0", "=", "arg_1", ".", "copy", "(", ")", "return", "arg_0", "if", "not", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "raise", "TypeError", "(", "'Value not dict type'", ")", "if", "len", "(", "arg_0", ")", ">", "255", ":", "raise", "ValueError", "(", "'More than 255 values defined'", ")", "for", "arg_3", "in", "arg_0", ".", "keys", "(", ")", ":", "if", "not", "isinstance", "(", "arg_3", ",", "int", ")", ":", "raise", "TypeError", "(", "'Index not int type'", ")", "if", "arg_3", "<", "0", "or", "arg_3", ">", "255", ":", "raise", "ValueError", "(", "'Index value out of range'", ")", "if", "not", "arg_2", ":", "arg_0", ".", "update", "(", "arg_1", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        '''Update algorithm definition type dictionaries'''\n\n        if not arg_0:\n            arg_0 = arg_1.copy()\n            return arg_0\n\n        if not isinstance(arg_0, dict):\n            raise TypeError('Value not dict type')\n        if len(arg_0) > 255:\n            raise ValueError('More than 255 values defined')\n        for arg_3 in arg_0.keys():\n            if not isinstance(arg_3, int):\n                raise TypeError('Index not int type')\n            if arg_3 < 0 or arg_3 > 255:\n                raise ValueError('Index value out of range')\n\n        if not arg_2:\n            arg_0.update(arg_1)\n\n        return arg_0", "path": "encryptedpickle/encryptedpickle.py", "identifier": "EncryptedPickle._update_dict", "docstring": "Update algorithm definition type dictionaries", "docstring_tokens": ["Update", "algorithm", "definition", "type", "dictionaries"], "nwo": "vingd/encrypted-pickle-python", "score": 0.1861985637721619, "idx": 261080}
{"url": "https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/rdf.py#L83-L91", "sha": "301d72f6ae57c832c1da7f6402fa49b192de6810", "docstring_summary": "Reports a value error using ERROR_MESSAGES dict.\n        key - key to use for ERROR_MESSAGES.\n        bad_value - is passed to format which is called on what key maps to\n        in ERROR_MESSAGES.", "language": "python", "parameters": "(self, key, bad_value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "ERROR_MESSAGES", "[", "arg_1", "]", ".", "format", "(", "arg_2", ")", "arg_0", ".", "logger", ".", "log", "(", "arg_3", ")", "arg_0", ".", "error", "=", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Reports a value error using ERROR_MESSAGES dict.\n        key - key to use for ERROR_MESSAGES.\n        bad_value - is passed to format which is called on what key maps to\n        in ERROR_MESSAGES.\n        \"\"\"\n        arg_3 = ERROR_MESSAGES[arg_1].format(arg_2)\n        arg_0.logger.log(arg_3)\n        arg_0.error = True", "path": "spdx/parsers/rdf.py", "identifier": "BaseParser.value_error", "docstring": "Reports a value error using ERROR_MESSAGES dict.\n        key - key to use for ERROR_MESSAGES.\n        bad_value - is passed to format which is called on what key maps to\n        in ERROR_MESSAGES.", "docstring_tokens": ["Reports", "a", "value", "error", "using", "ERROR_MESSAGES", "dict", ".", "key", "-", "key", "to", "use", "for", "ERROR_MESSAGES", ".", "bad_value", "-", "is", "passed", "to", "format", "which", "is", "called", "on", "what", "key", "maps", "to", "in", "ERROR_MESSAGES", "."], "nwo": "spdx/tools-python", "score": 0.8936869982558252, "idx": 261081}
{"url": "https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/utils.py#L33-L49", "sha": "5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3", "docstring_summary": "Get the user instance from the template context, if possible.", "language": "python", "parameters": "(context)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "arg_0", "[", "'user'", "]", "except", "KeyError", ":", "pass", "try", ":", "arg_1", "=", "arg_0", "[", "'request'", "]", "return", "arg_1", ".", "user", "except", "(", "KeyError", ",", "AttributeError", ")", ":", "pass", "return", "None"], "function": "def Func(arg_0):\n    \"\"\"\n    Get the user instance from the template context, if possible.\n\n    If the context does not contain a `request` or `user` attribute,\n    `None` is returned.\n    \"\"\"\n    try:\n        return arg_0['user']\n    except KeyError:\n        pass\n    try:\n        arg_1 = arg_0['request']\n        return arg_1.user\n    except (KeyError, AttributeError):\n        pass\n    return None", "path": "analytical/utils.py", "identifier": "get_user_from_context", "docstring": "Get the user instance from the template context, if possible.\n\n    If the context does not contain a `request` or `user` attribute,\n    `None` is returned.", "docstring_tokens": ["Get", "the", "user", "instance", "from", "the", "template", "context", "if", "possible", "."], "nwo": "jazzband/django-analytical", "score": 0.7610395530003209, "idx": 261082}
{"url": "https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L51-L63", "sha": "42e3490c138abc8e10f2e9f8f8f3b40240a80412", "docstring_summary": "Get list of users in the room.", "language": "python", "parameters": "(self, sort=True)", "return_statement": "return self.users", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_0", ".", "_load", "(", ")", "if", "arg_1", ":", "arg_0", ".", "users", ".", "sort", "(", "key", "=", "operator", ".", "itemgetter", "(", "\"name\"", ")", ")", "return", "arg_0", ".", "users"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\" Get list of users in the room.\n\n        Kwargs:\n            sort (bool): If True, sort rooms by name\n\n        Returns:\n            array. List of users\n        \"\"\"\n        arg_0._load()\n        if arg_1:\n            arg_0.users.sort(key=operator.itemgetter(\"name\"))\n        return arg_0.users", "path": "pyfire/room.py", "identifier": "Room.get_users", "docstring": "Get list of users in the room.\n\n        Kwargs:\n            sort (bool): If True, sort rooms by name\n\n        Returns:\n            array. List of users", "docstring_tokens": ["Get", "list", "of", "users", "in", "the", "room", "."], "nwo": "mariano/pyfire", "score": 0.16941397159673272, "idx": 261083}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2291-L2311", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Recursively finds the most recent timestamp in the given directory.", "language": "python", "parameters": "(path, ignore=None)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_1", "=", "arg_1", "or", "[", "]", "if", "not", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "return", "arg_2", "=", "''", "if", "arg_1", ":", "assert", "isinstance", "(", "arg_1", ",", "(", "tuple", ",", "list", ")", ")", "arg_2", "=", "' '", ".", "join", "(", "\"! -name '%s'\"", "%", "_", "for", "_", "in", "arg_1", ")", "arg_3", "=", "'find \"'", "+", "arg_0", "+", "'\" '", "+", "arg_2", "+", "' -type f -printf \"%T@ %p\\n\" | sort -n | tail -1 | cut -f 1 -d \" \"'", "arg_4", "=", "subprocess", ".", "check_output", "(", "arg_3", ",", "shell", "=", "True", ")", "try", ":", "arg_4", "=", "round", "(", "float", "(", "arg_4", ")", ",", "2", ")", "except", "ValueError", ":", "return", "return", "arg_4"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\"\n    Recursively finds the most recent timestamp in the given directory.\n    \"\"\"\n    arg_1 = arg_1 or []\n    if not isinstance(arg_0, six.string_types):\n        return\n    arg_2 = ''\n    if arg_1:\n        assert isinstance(arg_1, (tuple, list))\n        arg_2 = ' '.join(\"! -name '%s'\" % _ for _ in arg_1)\n    arg_3 = 'find \"'+arg_0+'\" ' + arg_2 + ' -type f -printf \"%T@ %p\\n\" | sort -n | tail -1 | cut -f 1 -d \" \"'\n         #'find '+path+' -type f -printf \"%T@ %p\\n\" | sort -n | tail -1 | cut -d \" \" -f1\n    arg_4 = subprocess.check_output(arg_3, shell=True)\n    # Note, we round now to avoid rounding errors later on where some formatters\n    # use different decimal contexts.\n    try:\n        arg_4 = round(float(arg_4), 2)\n    except ValueError:\n        return\n    return arg_4", "path": "burlap/common.py", "identifier": "get_last_modified_timestamp", "docstring": "Recursively finds the most recent timestamp in the given directory.", "docstring_tokens": ["Recursively", "finds", "the", "most", "recent", "timestamp", "in", "the", "given", "directory", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 261084}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L728-L736", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Returns the nth rest sequence of coll, or coll if i is 0.", "language": "python", "parameters": "(coll, i: int)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "while", "True", ":", "if", "arg_0", "is", "None", ":", "return", "None", "if", "arg_1", "==", "0", ":", "return", "arg_0", "arg_1", "-=", "1", "arg_0", "=", "rest", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1: arg_2):\n    \"\"\"Returns the nth rest sequence of coll, or coll if i is 0.\"\"\"\n    while True:\n        if arg_0 is None:\n            return None\n        if arg_1 == 0:\n            return arg_0\n        arg_1 -= 1\n        arg_0 = rest(arg_0)", "path": "src/basilisp/lang/runtime.py", "identifier": "nthrest", "docstring": "Returns the nth rest sequence of coll, or coll if i is 0.", "docstring_tokens": ["Returns", "the", "nth", "rest", "sequence", "of", "coll", "or", "coll", "if", "i", "is", "0", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 261085}
{"url": "https://github.com/kmmbvnr/django-any/blob/6f64ebd05476e2149e2e71deeefbb10f8edfc412/django_any/forms.py#L20-L35", "sha": "6f64ebd05476e2149e2e71deeefbb10f8edfc412", "docstring_summary": "Returns tuple with form data and files", "language": "python", "parameters": "(form_cls, **kwargs)", "return_statement": "return form_data, form_files", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "{", "}", "arg_3", "=", "{", "}", "arg_4", ",", "arg_5", "=", "split_model_kwargs", "(", "arg_1", ")", "for", "arg_6", ",", "arg_7", "in", "arg_0", ".", "base_fields", ".", "iteritems", "(", ")", ":", "if", "arg_6", "in", "arg_4", ":", "arg_2", "[", "arg_6", "]", "=", "arg_1", "[", "arg_6", "]", "else", ":", "arg_2", "[", "arg_6", "]", "=", "any_form_field", "(", "arg_7", ",", "**", "arg_5", "[", "arg_6", "]", ")", "return", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, **arg_1):\n    \"\"\"\n    Returns tuple with form data and files\n    \"\"\"\n    arg_2 = {}\n    arg_3 = {}\n\n    arg_4, arg_5 = split_model_kwargs(arg_1)\n\n    for arg_6, arg_7 in arg_0.base_fields.iteritems():\n        if arg_6 in arg_4:\n            arg_2[arg_6] = arg_1[arg_6]\n        else:\n            arg_2[arg_6] = any_form_field(arg_7, **arg_5[arg_6])\n\n    return arg_2, arg_3", "path": "django_any/forms.py", "identifier": "any_form_default", "docstring": "Returns tuple with form data and files", "docstring_tokens": ["Returns", "tuple", "with", "form", "data", "and", "files"], "nwo": "kmmbvnr/django-any", "score": 0.18384731799856882, "idx": 261086}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/resourceAnalyzer/analyzer.py#L113-L163", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Gues resource usage by HWProcess", "language": "python", "parameters": "(cls, proc: HWProcess, ctx: ResourceContext)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "Func", ",", "arg_3", ":", "arg_4", ")", "->", "None", ":", "arg_5", "=", "arg_3", ".", "seen", "for", "arg_6", "in", "arg_1", ".", "statements", ":", "arg_7", "=", "arg_6", ".", "_enclosed_for", "arg_8", "=", "arg_6", ".", "_is_completly_event_dependent", "arg_9", "=", "arg_6", ".", "_now_is_event_dependent", "arg_10", "=", "arg_8", "or", "arg_9", "arg_11", "=", "count_mux_inputs_for_outputs", "(", "arg_6", ")", "for", "arg_12", "in", "arg_6", ".", "_outputs", ":", "if", "arg_12", "in", "arg_5", ":", "continue", "arg_13", "=", "arg_11", "[", "arg_12", "]", "if", "isinstance", "(", "arg_12", ".", "_dtype", ",", "HArray", ")", ":", "assert", "arg_13", "==", "1", ",", "(", "arg_12", ",", "arg_13", ",", "\" only one ram port per HWProcess\"", ")", "for", "arg_14", "in", "walk_assignments", "(", "arg_6", ",", "arg_12", ")", ":", "assert", "len", "(", "arg_14", ".", "indexes", ")", "==", "1", ",", "\"one address per RAM port\"", "arg_15", "=", "arg_14", ".", "indexes", "[", "0", "]", "arg_3", ".", "registerRAM_write_port", "(", "arg_12", ",", "arg_15", ",", "arg_10", ")", "elif", "arg_10", ":", "arg_3", ".", "registerFF", "(", "arg_12", ")", "if", "arg_13", ">", "1", ":", "arg_3", ".", "registerMUX", "(", "arg_6", ",", "arg_12", ",", "arg_13", ")", "elif", "arg_12", "not", "in", "arg_7", ":", "arg_3", ".", "registerLatch", "(", "arg_12", ")", "if", "arg_13", ">", "1", ":", "arg_3", ".", "registerMUX", "(", "arg_6", ",", "arg_12", ",", "arg_13", ")", "elif", "arg_13", ">", "1", ":", "arg_3", ".", "registerMUX", "(", "arg_6", ",", "arg_12", ",", "arg_13", ")", "else", ":", "continue", "if", "isinstance", "(", "arg_6", ",", "SwitchContainer", ")", ":", "arg_16", "=", "set", "(", "[", "arg_6", ".", "switchOn", ".", "_eq", "(", "c", "[", "0", "]", ")", "for", "c", "in", "arg_6", ".", "cases", "]", ")", "arg_17", "=", "chain", "(", "[", "sig", "for", "sig", "in", "arg_6", ".", "_inputs", "if", "sig", "not", "in", "arg_16", "]", ",", "[", "arg_6", ".", "switchOn", "]", ")", "else", ":", "arg_17", "=", "arg_6", ".", "_inputs", "for", "arg_13", "in", "arg_17", ":", "if", "not", "arg_13", ".", "hidden", "or", "arg_13", "in", "arg_5", ":", "continue", "arg_0", ".", "HWProcess_operators", "(", "arg_13", ",", "arg_3", ",", "arg_10", ")"], "function": "def Func(arg_0, arg_1: Func, arg_3: arg_4) -> None:\n        \"\"\"\n        Gues resource usage by HWProcess\n        \"\"\"\n        arg_5 = arg_3.seen\n        for arg_6 in arg_1.statements:\n            arg_7 = arg_6._enclosed_for\n            arg_8 = arg_6._is_completly_event_dependent\n            arg_9 = arg_6._now_is_event_dependent\n            arg_10 = arg_8 or arg_9\n\n            arg_11 = count_mux_inputs_for_outputs(arg_6)\n            for arg_12 in arg_6._outputs:\n                if arg_12 in arg_5:\n                    continue\n\n                arg_13 = arg_11[arg_12]\n                if isinstance(arg_12._dtype, HArray):\n                    assert arg_13 == 1, (arg_12, arg_13, \" only one ram port per HWProcess\")\n                    for arg_14 in walk_assignments(arg_6, arg_12):\n                        assert len(arg_14.indexes) == 1, \"one address per RAM port\"\n                        arg_15 = arg_14.indexes[0]\n                    arg_3.registerRAM_write_port(arg_12, arg_15, arg_10)\n                elif arg_10:\n                    arg_3.registerFF(arg_12)\n                    if arg_13 > 1:\n                        arg_3.registerMUX(arg_6, arg_12, arg_13)\n                elif arg_12 not in arg_7:\n                    arg_3.registerLatch(arg_12)\n                    if arg_13 > 1:\n                        arg_3.registerMUX(arg_6, arg_12, arg_13)\n                elif arg_13 > 1:\n                    arg_3.registerMUX(arg_6, arg_12, arg_13)\n                else:\n                    # just a connection\n                    continue\n\n            if isinstance(arg_6, SwitchContainer):\n                arg_16 = set([arg_6.switchOn._eq(c[0]) for c in arg_6.cases])\n                arg_17 = chain(\n                    [sig for sig in arg_6._inputs if sig not in arg_16], [arg_6.switchOn])\n            else:\n                arg_17 = arg_6._inputs\n\n            for arg_13 in arg_17:\n                # discover only internal signals in this statements for\n                # operators\n                if not arg_13.hidden or arg_13 in arg_5:\n                    continue\n\n                arg_0.HWProcess_operators(arg_13, arg_3, arg_10)", "path": "hwt/serializer/resourceAnalyzer/analyzer.py", "identifier": "ResourceAnalyzer.HWProcess", "docstring": "Gues resource usage by HWProcess", "docstring_tokens": ["Gues", "resource", "usage", "by", "HWProcess"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 261087}
{"url": "https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L767-L803", "sha": "bddba4b74faae6c1b91202f19184811e326547e5", "docstring_summary": "Starting from a specific point and time, get complete single source\n        shortest path spreading dynamics as trips, or \"events\".", "language": "python", "parameters": "(self, start_time_ut, lat, lon,\n                            max_duration_ut=4 * 3600,\n                            min_transfer_time=30,\n                            use_shapes=False)", "return_statement": "return spreader.spread()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "4", "*", "3600", ",", "arg_5", "=", "30", ",", "arg_6", "=", "False", ")", ":", "from", "gtfspy", ".", "spreading", ".", "spreader", "import", "Spreader", "arg_7", "=", "Spreader", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ")", "return", "arg_7", ".", "spread", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                            arg_4=4 * 3600,\n                            arg_5=30,\n                            arg_6=False):\n        \"\"\"\n        Starting from a specific point and time, get complete single source\n        shortest path spreading dynamics as trips, or \"events\".\n\n        Parameters\n        ----------\n        start_time_ut: number\n            Start time of the spreading.\n        lat: float\n            latitude of the spreading seed location\n        lon: float\n            longitude of the spreading seed location\n        max_duration_ut: int\n            maximum duration of the spreading process (in seconds)\n        min_transfer_time : int\n            minimum transfer time in seconds\n        use_shapes : bool\n            whether to include shapes\n\n        Returns\n        -------\n        trips: dict\n            trips['trips'] is a list whose each element (e.g. el = trips['trips'][0])\n            is a dict with the following properties:\n                el['lats'] : list of latitudes\n                el['lons'] : list of longitudes\n                el['times'] : list of passage_times\n                el['route_type'] : type of vehicle as specified by GTFS, or -1 if walking\n                el['name'] : name of the route\n        \"\"\"\n        from gtfspy.spreading.spreader import Spreader\n        arg_7 = Spreader(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6)\n        return arg_7.spread()", "path": "gtfspy/gtfs.py", "identifier": "GTFS.get_spreading_trips", "docstring": "Starting from a specific point and time, get complete single source\n        shortest path spreading dynamics as trips, or \"events\".\n\n        Parameters\n        ----------\n        start_time_ut: number\n            Start time of the spreading.\n        lat: float\n            latitude of the spreading seed location\n        lon: float\n            longitude of the spreading seed location\n        max_duration_ut: int\n            maximum duration of the spreading process (in seconds)\n        min_transfer_time : int\n            minimum transfer time in seconds\n        use_shapes : bool\n            whether to include shapes\n\n        Returns\n        -------\n        trips: dict\n            trips['trips'] is a list whose each element (e.g. el = trips['trips'][0])\n            is a dict with the following properties:\n                el['lats'] : list of latitudes\n                el['lons'] : list of longitudes\n                el['times'] : list of passage_times\n                el['route_type'] : type of vehicle as specified by GTFS, or -1 if walking\n                el['name'] : name of the route", "docstring_tokens": ["Starting", "from", "a", "specific", "point", "and", "time", "get", "complete", "single", "source", "shortest", "path", "spreading", "dynamics", "as", "trips", "or", "events", "."], "nwo": "CxAalto/gtfspy", "score": 0.5661496572092297, "idx": 261088}
{"url": "https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/stack.py#L50-L68", "sha": "9cd7104aa085498da3097b72696184b9d3651c51", "docstring_summary": "Make an intermediate RDD where all records are combined into a\n        list of keys and larger ndarray along a new 0th dimension.", "language": "python", "parameters": "(self, size)", "return_statement": "return self._constructor(rdd).__finalize__(self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "def", "toFuncs", "(", "arg_2", ")", ":", "arg_3", "=", "[", "]", "arg_4", "=", "[", "]", "for", "arg_5", ",", "arg_6", "in", "arg_2", ":", "arg_3", ".", "append", "(", "arg_5", ")", "arg_4", ".", "append", "(", "arg_6", ")", "if", "arg_1", "and", "0", "<=", "arg_1", "<=", "len", "(", "arg_3", ")", ":", "yield", "(", "arg_3", ",", "asarray", "(", "arg_4", ")", ")", "arg_3", ",", "arg_4", "=", "[", "]", ",", "[", "]", "if", "arg_3", ":", "yield", "(", "arg_3", ",", "asarray", "(", "arg_4", ")", ")", "arg_7", "=", "arg_0", ".", "_rdd", ".", "mapPartitions", "(", "toFuncs", ")", "return", "arg_0", ".", "_constructor", "(", "arg_7", ")", ".", "__finalize__", "(", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Make an intermediate RDD where all records are combined into a\n        list of keys and larger ndarray along a new 0th dimension.\n        \"\"\"\n        def toFuncs(arg_2):\n            arg_3 = []\n            arg_4 = []\n            for arg_5, arg_6 in arg_2:\n                arg_3.append(arg_5)\n                arg_4.append(arg_6)\n                if arg_1 and 0 <= arg_1 <= len(arg_3):\n                    yield (arg_3, asarray(arg_4))\n                    arg_3, arg_4 = [], []\n            if arg_3:\n                yield (arg_3, asarray(arg_4))\n\n        arg_7 = arg_0._rdd.mapPartitions(toFuncs)\n        return arg_0._constructor(arg_7).__finalize__(arg_0)", "path": "bolt/spark/stack.py", "identifier": "StackedArray.stack", "docstring": "Make an intermediate RDD where all records are combined into a\n        list of keys and larger ndarray along a new 0th dimension.", "docstring_tokens": ["Make", "an", "intermediate", "RDD", "where", "all", "records", "are", "combined", "into", "a", "list", "of", "keys", "and", "larger", "ndarray", "along", "a", "new", "0th", "dimension", "."], "nwo": "bolt-project/bolt", "score": 0.19616129380514286, "idx": 261089}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/dps_certificate_operations.py#L192-L292", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Delete the Provisioning Service Certificate.", "language": "python", "parameters": "(\n            self, resource_group_name, if_match, provisioning_service_name, certificate_name, certificatename=None, certificateraw_bytes=None, certificateis_verified=None, certificatepurpose=None, certificatecreated=None, certificatelast_updated=None, certificatehas_private_key=None, certificatenonce=None, custom_headers=None, raw=False, **operation_config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "None", ",", "arg_12", "=", "None", ",", "arg_13", "=", "None", ",", "arg_14", "=", "False", ",", "**", "arg_15", ")", ":", "arg_16", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_17", "=", "{", "'subscriptionId'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.config.subscription_id\"", ",", "arg_0", ".", "config", ".", "subscription_id", ",", "'str'", ")", ",", "'resourceGroupName'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"resource_group_name\"", ",", "arg_1", ",", "'str'", ")", ",", "'provisioningServiceName'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"provisioning_service_name\"", ",", "arg_3", ",", "'str'", ")", ",", "'certificateName'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"certificate_name\"", ",", "arg_4", ",", "'str'", ")", "}", "arg_16", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_16", ",", "**", "arg_17", ")", "arg_18", "=", "{", "}", "if", "arg_5", "is", "not", "None", ":", "arg_18", "[", "'certificate.name'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificatename\"", ",", "arg_5", ",", "'str'", ")", "if", "arg_6", "is", "not", "None", ":", "arg_18", "[", "'certificate.rawBytes'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificateraw_bytes\"", ",", "arg_6", ",", "'bytearray'", ")", "if", "arg_7", "is", "not", "None", ":", "arg_18", "[", "'certificate.isVerified'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificateis_verified\"", ",", "arg_7", ",", "'bool'", ")", "if", "arg_8", "is", "not", "None", ":", "arg_18", "[", "'certificate.purpose'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificatepurpose\"", ",", "arg_8", ",", "'str'", ")", "if", "arg_9", "is", "not", "None", ":", "arg_18", "[", "'certificate.created'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificatecreated\"", ",", "arg_9", ",", "'iso-8601'", ")", "if", "arg_10", "is", "not", "None", ":", "arg_18", "[", "'certificate.lastUpdated'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificatelast_updated\"", ",", "arg_10", ",", "'iso-8601'", ")", "if", "arg_11", "is", "not", "None", ":", "arg_18", "[", "'certificate.hasPrivateKey'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificatehas_private_key\"", ",", "arg_11", ",", "'bool'", ")", "if", "arg_12", "is", "not", "None", ":", "arg_18", "[", "'certificate.nonce'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"certificatenonce\"", ",", "arg_12", ",", "'str'", ")", "arg_18", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "arg_19", "=", "{", "}", "arg_19", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_19", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_13", ":", "arg_19", ".", "update", "(", "arg_13", ")", "arg_19", "[", "'If-Match'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"if_match\"", ",", "arg_2", ",", "'str'", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_19", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_20", "=", "arg_0", ".", "_client", ".", "Func", "(", "arg_16", ",", "arg_18", ")", "arg_21", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_20", ",", "arg_19", ",", "stream", "=", "False", ",", "**", "arg_15", ")", "if", "arg_21", ".", "status_code", "not", "in", "[", "200", ",", "204", "]", ":", "raise", "models", ".", "ErrorDetailsException", "(", "arg_0", ".", "_deserialize", ",", "arg_21", ")", "if", "arg_14", ":", "arg_22", "=", "ClientRawResponse", "(", "None", ",", "arg_21", ")", "return", "arg_22"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=None, arg_11=None, arg_12=None, arg_13=None, arg_14=False, **arg_15):\n        \"\"\"Delete the Provisioning Service Certificate.\n\n        Deletes the specified certificate assosciated with the Provisioning\n        Service.\n\n        :param resource_group_name: Resource group identifier.\n        :type resource_group_name: str\n        :param if_match: ETag of the certificate\n        :type if_match: str\n        :param provisioning_service_name: The name of the provisioning\n         service.\n        :type provisioning_service_name: str\n        :param certificate_name: This is a mandatory field, and is the logical\n         name of the certificate that the provisioning service will access by.\n        :type certificate_name: str\n        :param certificatename: This is optional, and it is the Common Name of\n         the certificate.\n        :type certificatename: str\n        :param certificateraw_bytes: Raw data within the certificate.\n        :type certificateraw_bytes: bytearray\n        :param certificateis_verified: Indicates if certificate has been\n         verified by owner of the private key.\n        :type certificateis_verified: bool\n        :param certificatepurpose: A description that mentions the purpose of\n         the certificate. Possible values include: 'clientAuthentication',\n         'serverAuthentication'\n        :type certificatepurpose: str or\n         ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose\n        :param certificatecreated: Time the certificate is created.\n        :type certificatecreated: datetime\n        :param certificatelast_updated: Time the certificate is last updated.\n        :type certificatelast_updated: datetime\n        :param certificatehas_private_key: Indicates if the certificate\n         contains a private key.\n        :type certificatehas_private_key: bool\n        :param certificatenonce: Random number generated to indicate Proof of\n         Possession.\n        :type certificatenonce: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: None or ClientRawResponse if raw=true\n        :rtype: None or ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`ErrorDetailsException<azure.mgmt.iothubprovisioningservices.models.ErrorDetailsException>`\n        \"\"\"\n        # Construct URL\n        arg_16 = arg_0.Func.metadata['url']\n        arg_17 = {\n            'subscriptionId': arg_0._serialize.url(\"self.config.subscription_id\", arg_0.config.subscription_id, 'str'),\n            'resourceGroupName': arg_0._serialize.url(\"resource_group_name\", arg_1, 'str'),\n            'provisioningServiceName': arg_0._serialize.url(\"provisioning_service_name\", arg_3, 'str'),\n            'certificateName': arg_0._serialize.url(\"certificate_name\", arg_4, 'str')\n        }\n        arg_16 = arg_0._client.format_url(arg_16, **arg_17)\n\n        # Construct parameters\n        arg_18 = {}\n        if arg_5 is not None:\n            arg_18['certificate.name'] = arg_0._serialize.query(\"certificatename\", arg_5, 'str')\n        if arg_6 is not None:\n            arg_18['certificate.rawBytes'] = arg_0._serialize.query(\"certificateraw_bytes\", arg_6, 'bytearray')\n        if arg_7 is not None:\n            arg_18['certificate.isVerified'] = arg_0._serialize.query(\"certificateis_verified\", arg_7, 'bool')\n        if arg_8 is not None:\n            arg_18['certificate.purpose'] = arg_0._serialize.query(\"certificatepurpose\", arg_8, 'str')\n        if arg_9 is not None:\n            arg_18['certificate.created'] = arg_0._serialize.query(\"certificatecreated\", arg_9, 'iso-8601')\n        if arg_10 is not None:\n            arg_18['certificate.lastUpdated'] = arg_0._serialize.query(\"certificatelast_updated\", arg_10, 'iso-8601')\n        if arg_11 is not None:\n            arg_18['certificate.hasPrivateKey'] = arg_0._serialize.query(\"certificatehas_private_key\", arg_11, 'bool')\n        if arg_12 is not None:\n            arg_18['certificate.nonce'] = arg_0._serialize.query(\"certificatenonce\", arg_12, 'str')\n        arg_18['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n\n        # Construct headers\n        arg_19 = {}\n        arg_19['Content-Type'] = 'application/json; charset=utf-8'\n        if arg_0.config.generate_client_request_id:\n            arg_19['x-ms-client-request-id'] = str(uuid.uuid1())\n        if arg_13:\n            arg_19.update(arg_13)\n        arg_19['If-Match'] = arg_0._serialize.header(\"if_match\", arg_2, 'str')\n        if arg_0.config.accept_language is not None:\n            arg_19['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n        # Construct and send request\n        arg_20 = arg_0._client.Func(arg_16, arg_18)\n        arg_21 = arg_0._client.send(arg_20, arg_19, stream=False, **arg_15)\n\n        if arg_21.status_code not in [200, 204]:\n            raise models.ErrorDetailsException(arg_0._deserialize, arg_21)\n\n        if arg_14:\n            arg_22 = ClientRawResponse(None, arg_21)\n            return arg_22", "path": "azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/dps_certificate_operations.py", "identifier": "DpsCertificateOperations.delete", "docstring": "Delete the Provisioning Service Certificate.\n\n        Deletes the specified certificate assosciated with the Provisioning\n        Service.\n\n        :param resource_group_name: Resource group identifier.\n        :type resource_group_name: str\n        :param if_match: ETag of the certificate\n        :type if_match: str\n        :param provisioning_service_name: The name of the provisioning\n         service.\n        :type provisioning_service_name: str\n        :param certificate_name: This is a mandatory field, and is the logical\n         name of the certificate that the provisioning service will access by.\n        :type certificate_name: str\n        :param certificatename: This is optional, and it is the Common Name of\n         the certificate.\n        :type certificatename: str\n        :param certificateraw_bytes: Raw data within the certificate.\n        :type certificateraw_bytes: bytearray\n        :param certificateis_verified: Indicates if certificate has been\n         verified by owner of the private key.\n        :type certificateis_verified: bool\n        :param certificatepurpose: A description that mentions the purpose of\n         the certificate. Possible values include: 'clientAuthentication',\n         'serverAuthentication'\n        :type certificatepurpose: str or\n         ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose\n        :param certificatecreated: Time the certificate is created.\n        :type certificatecreated: datetime\n        :param certificatelast_updated: Time the certificate is last updated.\n        :type certificatelast_updated: datetime\n        :param certificatehas_private_key: Indicates if the certificate\n         contains a private key.\n        :type certificatehas_private_key: bool\n        :param certificatenonce: Random number generated to indicate Proof of\n         Possession.\n        :type certificatenonce: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: None or ClientRawResponse if raw=true\n        :rtype: None or ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`ErrorDetailsException<azure.mgmt.iothubprovisioningservices.models.ErrorDetailsException>`", "docstring_tokens": ["Delete", "the", "Provisioning", "Service", "Certificate", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 261090}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/types/simBits.py#L12-L22", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Construct SimBitsT with cache", "language": "python", "parameters": "(width: int, signed: Union[bool, None])", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "[", "arg_4", ",", "None", "]", ")", ":", "arg_5", "=", "(", "arg_0", ",", "arg_2", ")", "try", ":", "return", "arg_7", "[", "arg_5", "]", "except", "KeyError", ":", "arg_6", "=", "SimBitsT", "(", "arg_0", ",", "arg_2", ")", "arg_7", "[", "arg_5", "]", "=", "arg_6", "return", "arg_6"], "function": "def Func(arg_0: arg_1, arg_2: arg_3[arg_4, None]):\n    \"\"\"\n    Construct SimBitsT with cache\n    \"\"\"\n    arg_5 = (arg_0, arg_2)\n    try:\n        return arg_7[arg_5]\n    except KeyError:\n        arg_6 = SimBitsT(arg_0, arg_2)\n        arg_7[arg_5] = arg_6\n        return arg_6", "path": "hwt/simulator/types/simBits.py", "identifier": "simBitsT", "docstring": "Construct SimBitsT with cache", "docstring_tokens": ["Construct", "SimBitsT", "with", "cache"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 261091}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/h2o.py#L773-L789", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Create a deep clone of the frame ``data``.", "language": "python", "parameters": "(data, xid)", "return_statement": "return duplicate", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert_is_type", "(", "arg_0", ",", "H2OFrame", ")", "assert_is_type", "(", "arg_1", ",", "str", ")", "assert_satisfies", "(", "arg_1", ",", "arg_1", "!=", "arg_0", ".", "frame_id", ")", "check_frame_id", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "apply", "(", "lambda", "x", ":", "x", ")", "arg_2", ".", "_ex", "=", "ExprNode", "(", "\"assign\"", ",", "arg_1", ",", "arg_2", ")", ".", "_eval_driver", "(", "False", ")", "arg_2", ".", "_ex", ".", "_cache", ".", "_id", "=", "arg_1", "arg_2", ".", "_ex", ".", "_children", "=", "None", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Create a deep clone of the frame ``data``.\n\n    :param data: an H2OFrame to be cloned\n    :param xid: (internal) id to be assigned to the new frame.\n    :returns: new :class:`H2OFrame` which is the clone of the passed frame.\n    \"\"\"\n    assert_is_type(arg_0, H2OFrame)\n    assert_is_type(arg_1, str)\n    assert_satisfies(arg_1, arg_1 != arg_0.frame_id)\n    check_frame_id(arg_1)\n    arg_2 = arg_0.apply(lambda x: x)\n    arg_2._ex = ExprNode(\"assign\", arg_1, arg_2)._eval_driver(False)\n    arg_2._ex._cache._id = arg_1\n    arg_2._ex._children = None\n    return arg_2", "path": "h2o-py/h2o/h2o.py", "identifier": "deep_copy", "docstring": "Create a deep clone of the frame ``data``.\n\n    :param data: an H2OFrame to be cloned\n    :param xid: (internal) id to be assigned to the new frame.\n    :returns: new :class:`H2OFrame` which is the clone of the passed frame.", "docstring_tokens": ["Create", "a", "deep", "clone", "of", "the", "frame", "data", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 261092}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L57-L104", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Check if the criterias for Likely Pathogenic is fullfilled", "language": "python", "parameters": "(pvs, ps_terms, pm_terms, pp_terms)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_0", ":", "if", "arg_2", ":", "return", "True", "if", "arg_1", ":", "if", "arg_2", ":", "return", "True", "if", "len", "(", "arg_3", ")", ">=", "2", ":", "return", "True", "if", "arg_2", ":", "if", "len", "(", "arg_2", ")", ">=", "3", ":", "return", "True", "elif", "len", "(", "arg_2", ")", ">=", "2", ":", "if", "len", "(", "arg_3", ")", ">=", "2", ":", "return", "True", "elif", "len", "(", "arg_3", ")", ">=", "4", ":", "return", "True", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"Check if the criterias for Likely Pathogenic is fullfilled\n\n    The following are descriptions of Likely Pathogenic clasification from ACMG paper:\n\n    Likely pathogenic\n      (i) 1 Very strong (PVS1) AND 1 moderate (PM1\u2013 PM6) OR\n      (ii) 1 Strong (PS1\u2013PS4) AND 1\u20132 moderate (PM1\u2013PM6) OR\n      (iii) 1 Strong (PS1\u2013PS4) AND \u22652 supporting (PP1\u2013PP5) OR\n      (iv)  \u22653 Moderate (PM1\u2013PM6) OR\n      (v) 2 Moderate (PM1\u2013PM6) AND \u22652 supporting (PP1\u2013PP5) OR\n      (vi) 1 Moderate (PM1\u2013PM6) AND \u22654 supportin (PP1\u2013PP5)\n\n    Args:\n        pvs(bool): Pathogenic Very Strong\n        ps_terms(list(str)): Pathogenic Strong terms\n        pm_terms(list(str)): Pathogenic Moderate terms\n        pp_terms(list(str)): Pathogenic Supporting terms\n\n    Returns:\n        bool: if classification indicates Likely Pathogenic level\n    \"\"\"\n    if arg_0:\n        # Likely Pathogenic (i):\n        if arg_2:\n            return True\n\n    if arg_1:\n        # Likely Pathogenic (ii):\n        if arg_2:\n            return True\n        # Likely Pathogenic (iii):\n        if len(arg_3) >= 2:\n            return True\n\n    if arg_2:\n        # Likely Pathogenic (iv):\n        if len(arg_2) >= 3:\n            return True\n        # Likely Pathogenic (v):\n        elif len(arg_2) >= 2:\n            if len(arg_3) >= 2:\n                return True\n        # Likely Pathogenic (vi):\n        elif len(arg_3) >= 4:\n            return True\n\n    return False", "path": "scout/utils/acmg.py", "identifier": "is_likely_pathogenic", "docstring": "Check if the criterias for Likely Pathogenic is fullfilled\n\n    The following are descriptions of Likely Pathogenic clasification from ACMG paper:\n\n    Likely pathogenic\n      (i) 1 Very strong (PVS1) AND 1 moderate (PM1\u2013 PM6) OR\n      (ii) 1 Strong (PS1\u2013PS4) AND 1\u20132 moderate (PM1\u2013PM6) OR\n      (iii) 1 Strong (PS1\u2013PS4) AND \u22652 supporting (PP1\u2013PP5) OR\n      (iv)  \u22653 Moderate (PM1\u2013PM6) OR\n      (v) 2 Moderate (PM1\u2013PM6) AND \u22652 supporting (PP1\u2013PP5) OR\n      (vi) 1 Moderate (PM1\u2013PM6) AND \u22654 supportin (PP1\u2013PP5)\n\n    Args:\n        pvs(bool): Pathogenic Very Strong\n        ps_terms(list(str)): Pathogenic Strong terms\n        pm_terms(list(str)): Pathogenic Moderate terms\n        pp_terms(list(str)): Pathogenic Supporting terms\n\n    Returns:\n        bool: if classification indicates Likely Pathogenic level", "docstring_tokens": ["Check", "if", "the", "criterias", "for", "Likely", "Pathogenic", "is", "fullfilled"], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 261093}
{"url": "https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2145-L2198", "sha": "f9c85adcf5218dac25acb06eedc63fc2950816fa", "docstring_summary": "_doSave - Internal function to save a single object. Don't call this directly. \n\t\t\t            Use \"save\" instead.", "language": "python", "parameters": "(self, obj, isInsert, conn, pipeline=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_3", "arg_5", "=", "arg_1", ".", "asDict", "(", "forStorage", "=", "True", ")", "arg_6", "=", "arg_0", ".", "_get_key_for_id", "(", "arg_1", ".", "_id", ")", "if", "arg_2", "is", "True", ":", "for", "arg_7", "in", "arg_0", ".", "fields", ":", "arg_8", "=", "arg_5", ".", "get", "(", "arg_7", ",", "arg_7", ".", "getDefaultValue", "(", ")", ")", "arg_4", ".", "hset", "(", "arg_6", ",", "arg_7", ",", "arg_8", ")", "if", "arg_8", "==", "IR_NULL_STR", ":", "arg_1", ".", "_origData", "[", "arg_7", "]", "=", "irNull", "else", ":", "arg_1", ".", "_origData", "[", "arg_7", "]", "=", "object", ".", "__getattribute__", "(", "arg_1", ",", "str", "(", "arg_7", ")", ")", "arg_0", ".", "_add_id_to_keys", "(", "arg_1", ".", "_id", ",", "arg_4", ")", "for", "arg_10", "in", "arg_0", ".", "indexedFields", ":", "arg_0", ".", "_add_id_to_index", "(", "arg_10", ",", "arg_1", ".", "_id", ",", "arg_1", ".", "_origData", "[", "arg_10", "]", ",", "arg_4", ")", "else", ":", "arg_11", "=", "arg_1", ".", "getUpdatedFields", "(", ")", "for", "arg_7", ",", "arg_8", "in", "arg_11", ".", "items", "(", ")", ":", "(", "arg_12", ",", "arg_13", ")", "=", "arg_8", "arg_14", "=", "arg_7", ".", "toStorage", "(", "arg_12", ")", "arg_15", "=", "arg_7", ".", "toStorage", "(", "arg_13", ")", "arg_4", ".", "hset", "(", "arg_6", ",", "arg_7", ",", "arg_15", ")", "if", "arg_7", "in", "arg_0", ".", "indexedFields", ":", "arg_0", ".", "_rem_id_from_index", "(", "arg_7", ",", "arg_1", ".", "_id", ",", "arg_14", ",", "arg_4", ")", "arg_0", ".", "_add_id_to_index", "(", "arg_7", ",", "arg_1", ".", "_id", ",", "arg_15", ",", "arg_4", ")", "arg_1", ".", "_origData", "[", "arg_7", "]", "=", "arg_13"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n\t\t'''\n\t\t\tFunc - Internal function to save a single object. Don't call this directly. \n\t\t\t            Use \"save\" instead.\n\n\t\t\t  If a pipeline is provided, the operations (setting values, updating indexes, etc)\n\t\t\t    will be queued into that pipeline.\n\t\t\t  Otherwise, everything will be executed right away.\n\n\t\t\t  @param obj - Object to save\n\t\t\t  @param isInsert - Bool, if insert or update. Either way, obj._id is expected to be set.\n\t\t\t  @param conn - Redis connection\n\t\t\t  @param pipeline - Optional pipeline, if present the items will be queued onto it. Otherwise, go directly to conn.\n\t\t'''\n\n\t\tif arg_4 is None:\n\t\t\targ_4 = arg_3\n\n\t\targ_5 = arg_1.asDict(forStorage=True)\n\t\targ_6 = arg_0._get_key_for_id(arg_1._id)\n\n\t\tif arg_2 is True:\n\t\t\tfor arg_7 in arg_0.fields:\n\n\t\t\t\targ_8 = arg_5.get(arg_7, arg_7.getDefaultValue())\n\n\t\t\t\targ_4.hset(arg_6, arg_7, arg_8)\n\n\t\t\t\t# Update origData with the new data\n\t\t\t\tif arg_8 == IR_NULL_STR:\n\t\t\t\t\targ_1._origData[arg_7] = irNull\n\t\t\t\telse:\n\t\t\t\t\targ_1._origData[arg_7] = object.__getattribute__(arg_1, str(arg_7))\n\n\t\t\targ_0._add_id_to_keys(arg_1._id, arg_4)\n\n\t\t\tfor arg_10 in arg_0.indexedFields:\n\t\t\t\targ_0._add_id_to_index(arg_10, arg_1._id, arg_1._origData[arg_10], arg_4)\n\t\telse:\n\t\t\targ_11 = arg_1.getUpdatedFields()\n\t\t\tfor arg_7, arg_8 in arg_11.items():\n\t\t\t\t(arg_12, arg_13) = arg_8\n\n\t\t\t\targ_14 = arg_7.toStorage(arg_12)\n\t\t\t\targ_15 = arg_7.toStorage(arg_13)\n\n\t\t\t\targ_4.hset(arg_6, arg_7, arg_15)\n\n\t\t\t\tif arg_7 in arg_0.indexedFields:\n\t\t\t\t\targ_0._rem_id_from_index(arg_7, arg_1._id, arg_14, arg_4)\n\t\t\t\t\targ_0._add_id_to_index(arg_7, arg_1._id, arg_15, arg_4)\n\n\t\t\t\t# Update origData with the new data\n\t\t\t\targ_1._origData[arg_7] = arg_13", "path": "IndexedRedis/__init__.py", "identifier": "IndexedRedisSave._doSave", "docstring": "_doSave - Internal function to save a single object. Don't call this directly. \n\t\t\t            Use \"save\" instead.\n\n\t\t\t  If a pipeline is provided, the operations (setting values, updating indexes, etc)\n\t\t\t    will be queued into that pipeline.\n\t\t\t  Otherwise, everything will be executed right away.\n\n\t\t\t  @param obj - Object to save\n\t\t\t  @param isInsert - Bool, if insert or update. Either way, obj._id is expected to be set.\n\t\t\t  @param conn - Redis connection\n\t\t\t  @param pipeline - Optional pipeline, if present the items will be queued onto it. Otherwise, go directly to conn.", "docstring_tokens": ["_doSave", "-", "Internal", "function", "to", "save", "a", "single", "object", ".", "Don", "t", "call", "this", "directly", ".", "Use", "save", "instead", "."], "nwo": "kata198/indexedredis", "score": 0.16246995141409282, "idx": 261094}
{"url": "https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/plugins/gdk3pixbuf.py#L33-L63", "sha": "51010195cbb5361dcd4b414ff132b87244c9e1cb", "docstring_summary": "Grabs an image directly to a buffer.", "language": "python", "parameters": "(self, bbox=None)", "return_statement": "return Image.frombytes(\n            'RGB', (width, height), pixel_bytes, 'raw', 'RGB', pb.get_rowstride(), 1)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "Gdk", ".", "get_default_root_window", "(", ")", "if", "arg_1", "is", "not", "None", ":", "arg_3", "=", "[", "arg_1", "[", "0", "]", ",", "arg_1", "[", "1", "]", ",", "arg_1", "[", "2", "]", "-", "arg_1", "[", "0", "]", ",", "arg_1", "[", "3", "]", "-", "arg_1", "[", "1", "]", "]", "else", ":", "arg_3", "=", "arg_2", ".", "get_geometry", "(", ")", "arg_4", "=", "Gdk", ".", "pixbuf_get_from_window", "(", "arg_2", ",", "*", "arg_3", ")", "if", "arg_4", ".", "get_bits_per_sample", "(", ")", "!=", "8", ":", "raise", "ValueError", "(", "'Expected 8 bits per pixel.'", ")", "elif", "arg_4", ".", "get_n_channels", "(", ")", "!=", "3", ":", "raise", "ValueError", "(", "'Expected RGB image.'", ")", "arg_5", "=", "arg_4", ".", "read_pixel_bytes", "(", ")", ".", "get_data", "(", ")", "arg_6", ",", "arg_7", "=", "arg_3", "[", "2", "]", ",", "arg_3", "[", "3", "]", "return", "Image", ".", "frombytes", "(", "'RGB'", ",", "(", "arg_6", ",", "arg_7", ")", ",", "arg_5", ",", "'raw'", ",", "'RGB'", ",", "arg_4", ".", "get_rowstride", "(", ")", ",", "1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Grabs an image directly to a buffer.\n\n        :param bbox: Optional tuple or list containing (x1, y1, x2, y2) coordinates\n            of sub-region to capture.\n        :return: PIL RGB image\n        :raises: ValueError, if image data does not have 3 channels (RGB), each with 8\n            bits.\n        :rtype: Image\n        \"\"\"\n        arg_2 = Gdk.get_default_root_window()\n        if arg_1 is not None:\n            arg_3 = [arg_1[0], arg_1[1], arg_1[2] - arg_1[0], arg_1[3] - arg_1[1]]\n        else:\n            arg_3 = arg_2.get_geometry()\n        arg_4 = Gdk.pixbuf_get_from_window(arg_2, *arg_3)\n        if arg_4.get_bits_per_sample() != 8:\n            raise ValueError('Expected 8 bits per pixel.')\n        elif arg_4.get_n_channels() != 3:\n            raise ValueError('Expected RGB image.')\n\n        # Read the entire buffer into a python bytes object.\n        # read_pixel_bytes: New in version 2.32.\n        arg_5 = arg_4.read_pixel_bytes().get_data()  # type: bytes\n        arg_6, arg_7 = arg_3[2], arg_3[3]\n\n        # Probably for SSE alignment reasons, the pixbuf has extra data in each line.\n        # The args after \"raw\" help handle this; see\n        # http://effbot.org/imagingbook/decoder.htm#the-raw-decoder\n        return Image.frombytes(\n            'RGB', (arg_6, arg_7), arg_5, 'raw', 'RGB', arg_4.get_rowstride(), 1)", "path": "pyscreenshot/plugins/gdk3pixbuf.py", "identifier": "Gdk3PixbufWrapper.grab", "docstring": "Grabs an image directly to a buffer.\n\n        :param bbox: Optional tuple or list containing (x1, y1, x2, y2) coordinates\n            of sub-region to capture.\n        :return: PIL RGB image\n        :raises: ValueError, if image data does not have 3 channels (RGB), each with 8\n            bits.\n        :rtype: Image", "docstring_tokens": ["Grabs", "an", "image", "directly", "to", "a", "buffer", "."], "nwo": "ponty/pyscreenshot", "score": 0.5737175809698164, "idx": 261095}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/util.py#L58-L75", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Generates a map of vector lengths from the center point to each coordinate.", "language": "python", "parameters": "(width, height, x_mult=1, y_mult=1)", "return_statement": "return [[length(x, y) for x in range(width)] for y in range(height)]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ",", "arg_3", "=", "1", ")", ":", "arg_4", "=", "(", "arg_0", "-", "1", ")", "/", "2", "arg_5", "=", "(", "arg_1", "-", "1", ")", "/", "2", "def", "length", "(", "arg_6", ",", "arg_7", ")", ":", "arg_8", "=", "math", ".", "pow", "(", "arg_6", "-", "arg_4", ",", "2", "*", "arg_2", ")", "arg_9", "=", "math", ".", "pow", "(", "arg_7", "-", "arg_5", ",", "2", "*", "arg_3", ")", "return", "int", "(", "math", ".", "sqrt", "(", "arg_8", "+", "arg_9", ")", ")", "return", "[", "[", "length", "(", "arg_6", ",", "arg_7", ")", "for", "arg_6", "in", "range", "(", "arg_0", ")", "]", "for", "arg_7", "in", "range", "(", "arg_1", ")", "]"], "function": "def Func(arg_0, arg_1, arg_2=1, arg_3=1):\n    \"\"\"\n    Generates a map of vector lengths from the center point to each coordinate.\n\n    width - width of matrix to generate\n    height - height of matrix to generate\n    x_mult - value to scale x-axis by\n    y_mult - value to scale y-axis by\n    \"\"\"\n    arg_4 = (arg_0 - 1) / 2\n    arg_5 = (arg_1 - 1) / 2\n\n    def length(arg_6, arg_7):\n        arg_8 = math.pow(arg_6 - arg_4, 2 * arg_2)\n        arg_9 = math.pow(arg_7 - arg_5, 2 * arg_3)\n        return int(math.sqrt(arg_8 + arg_9))\n\n    return [[length(arg_6, arg_7) for arg_6 in range(arg_0)] for arg_7 in range(arg_1)]", "path": "bibliopixel/util/util.py", "identifier": "genVector", "docstring": "Generates a map of vector lengths from the center point to each coordinate.\n\n    width - width of matrix to generate\n    height - height of matrix to generate\n    x_mult - value to scale x-axis by\n    y_mult - value to scale y-axis by", "docstring_tokens": ["Generates", "a", "map", "of", "vector", "lengths", "from", "the", "center", "point", "to", "each", "coordinate", "."], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 261096}
{"url": "https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L124-L132", "sha": "bb51075bf43703e7cd95aa39288cf7732ec13a6d", "docstring_summary": "Decorator to log function calls.", "language": "python", "parameters": "(func)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "def", "wrapper", "(", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "\"%s(%s)\"", "%", "(", "arg_0", ".", "__name__", ",", "\", \"", ".", "join", "(", "[", "repr", "(", "p", ")", "for", "p", "in", "arg_1", "]", "+", "[", "\"%s=%s\"", "%", "(", "k", ",", "repr", "(", "v", ")", ")", "for", "(", "k", ",", "v", ")", "in", "list", "(", "arg_2", ".", "items", "(", ")", ")", "]", ")", ")", "debug", "(", "\">> %s\"", ",", "arg_3", ")", "arg_4", "=", "arg_0", "(", "*", "arg_1", ",", "**", "arg_2", ")", "debug", "(", "\"<< %s: %s\"", ",", "arg_3", ",", "repr", "(", "arg_4", ")", ")", "return", "arg_4", "return", "wrapper"], "function": "def Func(arg_0):\n  '''Decorator to log function calls.'''\n  def wrapper(*arg_1, **arg_2):\n    arg_3 = \"%s(%s)\" % (arg_0.__name__, \", \".join([repr(p) for p in arg_1] + [\"%s=%s\" % (k, repr(v)) for (k, v) in list(arg_2.items())]))\n    debug(\">> %s\", arg_3)\n    arg_4 = arg_0(*arg_1, **arg_2)\n    debug(\"<< %s: %s\", arg_3, repr(arg_4))\n    return arg_4\n  return wrapper", "path": "s4cmd.py", "identifier": "log_calls", "docstring": "Decorator to log function calls.", "docstring_tokens": ["Decorator", "to", "log", "function", "calls", "."], "nwo": "bloomreach/s4cmd", "score": 0.8896933387401051, "idx": 261097}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/example/qq.py#L45-L53", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Update some required parameters for OAuth2.0 API calls", "language": "python", "parameters": "(data={})", "return_statement": "return defaults", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "{", "}", ")", ":", "arg_1", "=", "{", "'openid'", ":", "session", ".", "get", "(", "'qq_openid'", ")", ",", "'access_token'", ":", "session", ".", "get", "(", "'qq_token'", ")", "[", "0", "]", ",", "'oauth_consumer_key'", ":", "QQ_APP_ID", ",", "}", "arg_1", ".", "update", "(", "arg_0", ")", "return", "arg_1"], "function": "def Func(arg_0={}):\n    '''Update some required parameters for OAuth2.0 API calls'''\n    arg_1 = {\n        'openid': session.get('qq_openid'),\n        'access_token': session.get('qq_token')[0],\n        'oauth_consumer_key': QQ_APP_ID,\n    }\n    arg_1.update(arg_0)\n    return arg_1", "path": "example/qq.py", "identifier": "update_qq_api_request_data", "docstring": "Update some required parameters for OAuth2.0 API calls", "docstring_tokens": ["Update", "some", "required", "parameters", "for", "OAuth2", ".", "0", "API", "calls"], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 261098}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L644-L650", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Checks on whether the task instance is in the right state and timeframe\n        to be retried.", "language": "python", "parameters": "(self)", "return_statement": "return (self.state == State.UP_FOR_RETRY and\n                self.next_retry_datetime() < timezone.utcnow())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "arg_0", ".", "state", "==", "State", ".", "UP_FOR_RETRY", "and", "arg_0", ".", "next_retry_datetime", "(", ")", "<", "timezone", ".", "utcnow", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Checks on whether the task instance is in the right state and timeframe\n        to be retried.\n        \"\"\"\n        return (arg_0.state == State.UP_FOR_RETRY and\n                arg_0.next_retry_datetime() < timezone.utcnow())", "path": "airflow/models/taskinstance.py", "identifier": "TaskInstance.ready_for_retry", "docstring": "Checks on whether the task instance is in the right state and timeframe\n        to be retried.", "docstring_tokens": ["Checks", "on", "whether", "the", "task", "instance", "is", "in", "the", "right", "state", "and", "timeframe", "to", "be", "retried", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261099}
{"url": "https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/plugin.py#L38-L65", "sha": "0fedc08cfdb6db927ff93c09f25f24ce5a04c541", "docstring_summary": "Loads plugins from the specified directory.", "language": "python", "parameters": "(self, directory)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "for", "arg_2", "in", "os", ".", "listdir", "(", "arg_1", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_2", ")", "arg_4", ",", "arg_5", "=", "os", ".", "path", ".", "splitext", "(", "arg_2", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_3", ")", "and", "arg_5", "==", "'.py'", ":", "arg_6", ",", "arg_7", ",", "arg_8", "=", "imp", ".", "find_module", "(", "arg_4", ",", "[", "arg_1", "]", ")", "if", "arg_6", ":", "arg_9", "=", "imp", ".", "load_module", "(", "arg_4", ",", "arg_6", ",", "arg_7", ",", "arg_8", ")", "if", "os", ".", "path", ".", "isdir", "(", "arg_3", ")", ":", "arg_0", ".", "Func", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Loads plugins from the specified directory.\n\n        `directory` is the full path to a directory containing python modules\n        which each contain a subclass of the Plugin class.\n\n        There is no criteria for a valid plugin at this level - any python\n        module found in the directory will be loaded. Only modules that\n        implement a subclass of the Plugin class above will be collected.\n\n        The directory will be traversed recursively.\n        \"\"\"\n        # walk directory\n        for arg_2 in os.listdir(arg_1):\n            # path to file\n            arg_3 = os.path.join(arg_1, arg_2)\n\n            # if it's a file, load it\n            arg_4, arg_5 = os.path.splitext(arg_2)\n            if os.path.isfile(arg_3) and arg_5 == '.py':\n                arg_6, arg_7, arg_8 = imp.find_module(arg_4, [arg_1])\n                if arg_6:\n                    arg_9 = imp.load_module(arg_4, arg_6, arg_7, arg_8)\n\n            # if it's a directory, recurse into it\n            if os.path.isdir(arg_3):\n                arg_0.Func(arg_3)", "path": "scruffy/plugin.py", "identifier": "PluginManager.load_plugins", "docstring": "Loads plugins from the specified directory.\n\n        `directory` is the full path to a directory containing python modules\n        which each contain a subclass of the Plugin class.\n\n        There is no criteria for a valid plugin at this level - any python\n        module found in the directory will be loaded. Only modules that\n        implement a subclass of the Plugin class above will be collected.\n\n        The directory will be traversed recursively.", "docstring_tokens": ["Loads", "plugins", "from", "the", "specified", "directory", "."], "nwo": "snare/scruffy", "score": 0.18112697196067942, "idx": 261100}
{"url": "https://github.com/gaqzi/py-gocd/blob/6fe5b62dea51e665c11a343aba5fc98e130c5c63/gocd/api/template_config.py#L58-L75", "sha": "6fe5b62dea51e665c11a343aba5fc98e130c5c63", "docstring_summary": "Create template config for specified template name.", "language": "python", "parameters": "(self, config)", "return_statement": "return self._request(\"\",\n                             ok_status=None,\n                             data=data,\n                             headers=headers)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert", "arg_1", "[", "\"name\"", "]", "==", "arg_0", ".", "name", ",", "\"Given config is not for this template\"", "arg_2", "=", "arg_0", ".", "_json_encode", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "_default_headers", "(", ")", "return", "arg_0", ".", "_request", "(", "\"\"", ",", "ok_status", "=", "None", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Create template config for specified template name.\n\n        .. __: https://api.go.cd/current/#Func-template-config\n\n        Returns:\n          Response: :class:`gocd.api.response.Response` object\n        \"\"\"\n\n        assert arg_1[\"name\"] == arg_0.name, \"Given config is not for this template\"\n\n        arg_2 = arg_0._json_encode(arg_1)\n        arg_3 = arg_0._default_headers()\n\n        return arg_0._request(\"\",\n                             ok_status=None,\n                             arg_2=arg_2,\n                             arg_3=arg_3)", "path": "gocd/api/template_config.py", "identifier": "TemplateConfig.create", "docstring": "Create template config for specified template name.\n\n        .. __: https://api.go.cd/current/#create-template-config\n\n        Returns:\n          Response: :class:`gocd.api.response.Response` object", "docstring_tokens": ["Create", "template", "config", "for", "specified", "template", "name", "."], "nwo": "gaqzi/py-gocd", "score": 0.19238082074498727, "idx": 261101}
{"url": "https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/grouped_dataframe.py#L159-L179", "sha": "39992e23293393cc1320d1b9c1c8d2c325fc5626", "docstring_summary": "Aggregate the rows of each group into a single value.", "language": "python", "parameters": "(self, clazz, new_col, *args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "*", "arg_3", ")", ":", "if", "is_callable", "(", "arg_1", ")", "and", "not", "is_none", "(", "arg_2", ")", "and", "has_elements", "(", "*", "arg_3", ")", "and", "is_disjoint", "(", "arg_0", ".", "__grouping", ".", "grouping_colnames", ",", "arg_3", ",", "__DISJOINT_SETS_ERROR__", ")", ":", "return", "arg_0", ".", "__do_Func", "(", "arg_1", ",", "arg_2", ",", "*", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, *arg_3):\n        \"\"\"\n        Aggregate the rows of each group into a single value.\n\n        :param clazz: name of a class that extends class Callable\n        :type clazz: class\n        :param new_col: name of the new column\n        :type new_col: str\n        :param args: list of column names of the object that\n         function should be applied to\n        :type args: varargs\n        :return: returns a new dataframe object with the Funcd value\n        :rtype: DataFrame\n        \"\"\"\n        if is_callable(arg_1) \\\n                and not is_none(arg_2) \\\n                and has_elements(*arg_3) \\\n                and is_disjoint(arg_0.__grouping.grouping_colnames,\n                                arg_3,\n                                __DISJOINT_SETS_ERROR__):\n            return arg_0.__do_Func(arg_1, arg_2, *arg_3)", "path": "dataframe/grouped_dataframe.py", "identifier": "GroupedDataFrame.aggregate", "docstring": "Aggregate the rows of each group into a single value.\n\n        :param clazz: name of a class that extends class Callable\n        :type clazz: class\n        :param new_col: name of the new column\n        :type new_col: str\n        :param args: list of column names of the object that\n         function should be applied to\n        :type args: varargs\n        :return: returns a new dataframe object with the aggregated value\n        :rtype: DataFrame", "docstring_tokens": ["Aggregate", "the", "rows", "of", "each", "group", "into", "a", "single", "value", "."], "nwo": "dirmeier/dataframe", "score": 0.17385480483333982, "idx": 261102}
{"url": "https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L136-L144", "sha": "2092b0cb30898139a247176bcf433d5a4abde7cb", "docstring_summary": "This function adds the given stream to the logger, but does not check with a ConnectorDB database\n        to make sure that the stream exists. Use at your own risk.", "language": "python", "parameters": "(self, streamname, schema=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "database", ".", "cursor", "(", ")", "arg_3", ".", "execute", "(", "\"INSERT OR REPLACE INTO streams VALUES (?,?);\"", ",", "(", "arg_1", ",", "json", ".", "dumps", "(", "arg_2", ")", ")", ")", "arg_0", ".", "streams", "[", "arg_1", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"This function adds the given stream to the logger, but does not check with a ConnectorDB database\n        to make sure that the stream exists. Use at your own risk.\"\"\"\n\n        arg_3 = arg_0.database.cursor()\n        arg_3.execute(\"INSERT OR REPLACE INTO streams VALUES (?,?);\",\n                  (arg_1, json.dumps(arg_2)))\n\n        arg_0.streams[arg_1] = arg_2", "path": "connectordb/logger.py", "identifier": "Logger.addStream_force", "docstring": "This function adds the given stream to the logger, but does not check with a ConnectorDB database\n        to make sure that the stream exists. Use at your own risk.", "docstring_tokens": ["This", "function", "adds", "the", "given", "stream", "to", "the", "logger", "but", "does", "not", "check", "with", "a", "ConnectorDB", "database", "to", "make", "sure", "that", "the", "stream", "exists", ".", "Use", "at", "your", "own", "risk", "."], "nwo": "connectordb/connectordb-python", "score": 0.25890992733444657, "idx": 261103}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/network.py#L7-L40", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Compute and save coactivation map given input image as seed.", "language": "python", "parameters": "(dataset, seed, threshold=0.0, output_dir='.', prefix='', r=6)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0.0", ",", "arg_3", "=", "'.'", ",", "arg_4", "=", "''", ",", "arg_5", "=", "6", ")", ":", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", ":", "arg_6", "=", "arg_0", ".", "get_studies", "(", "mask", "=", "arg_1", ",", "activation_threshold", "=", "arg_2", ")", "else", ":", "arg_6", "=", "arg_0", ".", "get_studies", "(", "peaks", "=", "arg_1", ",", "arg_5", "=", "arg_5", ",", "activation_threshold", "=", "arg_2", ")", "arg_7", "=", "meta", ".", "MetaAnalysis", "(", "arg_0", ",", "arg_6", ")", "arg_7", ".", "save_results", "(", "arg_3", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2=0.0, arg_3='.', arg_4='', arg_5=6):\n    \"\"\" Compute and save Func map given input image as seed.\n\n    This is essentially just a wrapper for a meta-analysis defined\n    by the contrast between those studies that activate within the seed\n    and those that don't.\n\n    Args:\n      dataset: a Dataset instance containing study and activation data.\n      seed: either a Nifti or Analyze image defining the boundaries of the\n        seed, or a list of triples (x/y/z) defining the seed(s). Note that\n        voxels do not need to be contiguous to define a seed--all supra-\n        threshold voxels will be lumped together.\n      threshold: optional float indicating the threshold above which voxels\n        are considered to be part of the seed ROI (default = 0)\n      r: optional integer indicating radius (in mm) of spheres to grow\n        (only used if seed is a list of coordinates).\n      output_dir: output directory to write to. Defaults to current.\n        If none, defaults to using the first part of the seed filename.\n      prefix: optional string to prepend to all Func images.\n\n    Output:\n      A set of meta-analysis images identical to that generated by\n      meta.MetaAnalysis.\n    \"\"\"\n\n    if isinstance(arg_1, string_types):\n        arg_6 = arg_0.get_studies(mask=arg_1, activation_threshold=arg_2)\n    else:\n        arg_6 = arg_0.get_studies(peaks=arg_1, arg_5=arg_5,\n                                  activation_threshold=arg_2)\n\n    arg_7 = meta.MetaAnalysis(arg_0, arg_6)\n    arg_7.save_results(arg_3, arg_4)", "path": "neurosynth/analysis/network.py", "identifier": "coactivation", "docstring": "Compute and save coactivation map given input image as seed.\n\n    This is essentially just a wrapper for a meta-analysis defined\n    by the contrast between those studies that activate within the seed\n    and those that don't.\n\n    Args:\n      dataset: a Dataset instance containing study and activation data.\n      seed: either a Nifti or Analyze image defining the boundaries of the\n        seed, or a list of triples (x/y/z) defining the seed(s). Note that\n        voxels do not need to be contiguous to define a seed--all supra-\n        threshold voxels will be lumped together.\n      threshold: optional float indicating the threshold above which voxels\n        are considered to be part of the seed ROI (default = 0)\n      r: optional integer indicating radius (in mm) of spheres to grow\n        (only used if seed is a list of coordinates).\n      output_dir: output directory to write to. Defaults to current.\n        If none, defaults to using the first part of the seed filename.\n      prefix: optional string to prepend to all coactivation images.\n\n    Output:\n      A set of meta-analysis images identical to that generated by\n      meta.MetaAnalysis.", "docstring_tokens": ["Compute", "and", "save", "coactivation", "map", "given", "input", "image", "as", "seed", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 261104}
{"url": "https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_dosage.py#L245-L350", "sha": "3f66a39e15a71b981e8c5f887a4adc3ad486a45f", "docstring_summary": "r\"\"\" Allele expectation.", "language": "python", "parameters": "(bgen, variant_idx)", "return_statement": "return stack(expec, axis=0)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", "[", "\"genotype\"", "]", "[", "arg_1", "]", ".", "compute", "(", ")", "if", "arg_2", "[", "\"phased\"", "]", ":", "raise", "ValueError", "(", "\"Allele expectation is define for unphased genotypes only.\"", ")", "arg_3", "=", "arg_0", "[", "\"variants\"", "]", ".", "loc", "[", "arg_1", ",", "\"nalleles\"", "]", ".", "compute", "(", ")", ".", "item", "(", ")", "arg_4", "=", "get_genotypes", "(", "arg_2", "[", "\"ploidy\"", "]", ",", "arg_3", ")", "arg_5", "=", "[", "]", "for", "arg_6", "in", "range", "(", "len", "(", "arg_4", ")", ")", ":", "arg_7", "=", "asarray", "(", "genotypes_to_allele_counts", "(", "arg_4", "[", "arg_6", "]", ")", ",", "float", ")", "arg_8", "=", "arg_7", ".", "shape", "[", "0", "]", "arg_5", ".", "append", "(", "(", "arg_7", ".", "T", "*", "arg_2", "[", "\"probs\"", "]", "[", "arg_6", ",", ":", "arg_8", "]", ")", ".", "sum", "(", "1", ")", ")", "return", "stack", "(", "arg_5", ",", "axis", "=", "0", ")"], "function": "def Func(arg_0, arg_1):\n    r\"\"\" Allele expectation.\n\n    Compute the expectation of each allele from the genotype probabilities.\n\n    Parameters\n    ----------\n    bgen : bgen_file\n        Bgen file handler.\n    variant_idx : int\n        Variant index.\n\n    Returns\n    -------\n    :class:`numpy.ndarray`\n        Samples-by-alleles matrix of allele expectations.\n\n    Note\n    ----\n    This function supports unphased genotypes only.\n\n    Examples\n    --------\n    .. doctest::\n\n        >>> from bgen_reader import Func, example_files, read_bgen\n        >>>\n        >>> from texttable import Texttable\n        >>>\n        >>> # Download an example.\n        >>> example = example_files(\"example.32bits.bgen\")\n        >>> filepath = example.filepath\n        >>>\n        >>> # Read the example.\n        >>> bgen = read_bgen(filepath, verbose=False)\n        >>>\n        >>> variants = bgen[\"variants\"]\n        >>> samples = bgen[\"samples\"]\n        >>> genotype = bgen[\"genotype\"]\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> # This `compute` call will return a pandas data frame,\n        >>> variant = variants[variants[\"rsid\"] == \"RSID_6\"].compute()\n        >>> # from which we retrieve the variant index.\n        >>> variant_idx = variant.index.item()\n        >>> print(variant)\n                id    rsid chrom   pos  nalleles allele_ids  vaddr\n        4  SNPID_6  RSID_6    01  6000         2        A,G  19377\n        >>> genotype = bgen[\"genotype\"]\n        >>> # Samples is a pandas series, and we retrieve the\n        >>> # sample index from the sample name.\n        >>> sample_idx = samples[samples == \"sample_005\"].index.item()\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> # This `compute` call will return a dictionary from which\n        >>> # we can get the probability matrix the corresponding\n        >>> # variant.\n        >>> p = genotype[variant_idx].compute()[\"probs\"][sample_idx]\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> # Allele expectation makes sense for unphased genotypes only,\n        >>> # which is the case here.\n        >>> e = Func(bgen, variant_idx)[sample_idx]\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> alleles = variant[\"allele_ids\"].item().split(\",\")\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>>\n        >>> # Print what we have got in a nice format.\n        >>> table = Texttable()\n        >>> table = table.add_rows(\n        ...     [\n        ...         [\"\", \"AA\", \"AG\", \"GG\", \"E[.]\"],\n        ...         [\"p\"] + list(p) + [\"na\"],\n        ...         [\"#\" + alleles[0], 2, 1, 0, e[0]],\n        ...         [\"#\" + alleles[1], 0, 1, 2, e[1]],\n        ...     ]\n        ... )\n        >>> print(table.draw())\n        +----+-------+-------+-------+-------+\n        |    |  AA   |  AG   |  GG   | E[.]  |\n        +====+=======+=======+=======+=======+\n        | p  | 0.012 | 0.987 | 0.001 | na    |\n        +----+-------+-------+-------+-------+\n        | #A | 2     | 1     | 0     | 1.011 |\n        +----+-------+-------+-------+-------+\n        | #G | 0     | 1     | 2     | 0.989 |\n        +----+-------+-------+-------+-------+\n        >>>\n        >>> # Clean-up.\n        >>> example.close()\n    \"\"\"\n    arg_2 = arg_0[\"genotype\"][arg_1].compute()\n    if arg_2[\"phased\"]:\n        raise ValueError(\"Allele expectation is define for unphased genotypes only.\")\n\n    arg_3 = arg_0[\"variants\"].loc[arg_1, \"nalleles\"].compute().item()\n    arg_4 = get_genotypes(arg_2[\"ploidy\"], arg_3)\n    arg_5 = []\n    for arg_6 in range(len(arg_4)):\n        arg_7 = asarray(genotypes_to_allele_counts(arg_4[arg_6]), float)\n        arg_8 = arg_7.shape[0]\n        arg_5.append((arg_7.T * arg_2[\"probs\"][arg_6, :arg_8]).sum(1))\n\n    return stack(arg_5, axis=0)", "path": "bgen_reader/_dosage.py", "identifier": "allele_expectation", "docstring": "r\"\"\" Allele expectation.\n\n    Compute the expectation of each allele from the genotype probabilities.\n\n    Parameters\n    ----------\n    bgen : bgen_file\n        Bgen file handler.\n    variant_idx : int\n        Variant index.\n\n    Returns\n    -------\n    :class:`numpy.ndarray`\n        Samples-by-alleles matrix of allele expectations.\n\n    Note\n    ----\n    This function supports unphased genotypes only.\n\n    Examples\n    --------\n    .. doctest::\n\n        >>> from bgen_reader import allele_expectation, example_files, read_bgen\n        >>>\n        >>> from texttable import Texttable\n        >>>\n        >>> # Download an example.\n        >>> example = example_files(\"example.32bits.bgen\")\n        >>> filepath = example.filepath\n        >>>\n        >>> # Read the example.\n        >>> bgen = read_bgen(filepath, verbose=False)\n        >>>\n        >>> variants = bgen[\"variants\"]\n        >>> samples = bgen[\"samples\"]\n        >>> genotype = bgen[\"genotype\"]\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> # This `compute` call will return a pandas data frame,\n        >>> variant = variants[variants[\"rsid\"] == \"RSID_6\"].compute()\n        >>> # from which we retrieve the variant index.\n        >>> variant_idx = variant.index.item()\n        >>> print(variant)\n                id    rsid chrom   pos  nalleles allele_ids  vaddr\n        4  SNPID_6  RSID_6    01  6000         2        A,G  19377\n        >>> genotype = bgen[\"genotype\"]\n        >>> # Samples is a pandas series, and we retrieve the\n        >>> # sample index from the sample name.\n        >>> sample_idx = samples[samples == \"sample_005\"].index.item()\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> # This `compute` call will return a dictionary from which\n        >>> # we can get the probability matrix the corresponding\n        >>> # variant.\n        >>> p = genotype[variant_idx].compute()[\"probs\"][sample_idx]\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> # Allele expectation makes sense for unphased genotypes only,\n        >>> # which is the case here.\n        >>> e = allele_expectation(bgen, variant_idx)[sample_idx]\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>> alleles = variant[\"allele_ids\"].item().split(\",\")\n        >>>\n        >>> genotype = bgen[\"genotype\"]\n        >>>\n        >>> # Print what we have got in a nice format.\n        >>> table = Texttable()\n        >>> table = table.add_rows(\n        ...     [\n        ...         [\"\", \"AA\", \"AG\", \"GG\", \"E[.]\"],\n        ...         [\"p\"] + list(p) + [\"na\"],\n        ...         [\"#\" + alleles[0], 2, 1, 0, e[0]],\n        ...         [\"#\" + alleles[1], 0, 1, 2, e[1]],\n        ...     ]\n        ... )\n        >>> print(table.draw())\n        +----+-------+-------+-------+-------+\n        |    |  AA   |  AG   |  GG   | E[.]  |\n        +====+=======+=======+=======+=======+\n        | p  | 0.012 | 0.987 | 0.001 | na    |\n        +----+-------+-------+-------+-------+\n        | #A | 2     | 1     | 0     | 1.011 |\n        +----+-------+-------+-------+-------+\n        | #G | 0     | 1     | 2     | 0.989 |\n        +----+-------+-------+-------+-------+\n        >>>\n        >>> # Clean-up.\n        >>> example.close()", "docstring_tokens": ["r", "Allele", "expectation", "."], "nwo": "limix/bgen-reader-py", "score": 0.37729991823847475, "idx": 261105}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/dims.py#L293-L299", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "Returns true if the file version support the point_format_id", "language": "python", "parameters": "(point_format_id, file_version)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "return", "arg_0", "in", "VERSION_TO_POINT_FMT", "[", "str", "(", "arg_1", ")", "]", "except", "KeyError", ":", "raise", "errors", ".", "FileVersionNotSupported", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"  Returns true if the file version support the point_format_id\n    \"\"\"\n    try:\n        return arg_0 in VERSION_TO_POINT_FMT[str(arg_1)]\n    except KeyError:\n        raise errors.FileVersionNotSupported(arg_1)", "path": "pylas/point/dims.py", "identifier": "is_point_fmt_compatible_with_version", "docstring": "Returns true if the file version support the point_format_id", "docstring_tokens": ["Returns", "true", "if", "the", "file", "version", "support", "the", "point_format_id"], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 261106}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/utils/loss.py#L177-L191", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Compute the loss model.", "language": "python", "parameters": "(self, pred, target)", "return_statement": "return loss", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "th", ".", "FloatTensor", "(", "[", "0", "]", ")", "for", "arg_4", "in", "range", "(", "1", ",", "arg_0", ".", "moments", ")", ":", "arg_5", "=", "th", ".", "mean", "(", "th", ".", "pow", "(", "arg_1", ",", "arg_4", ")", ",", "0", ")", "arg_6", "=", "th", ".", "mean", "(", "th", ".", "pow", "(", "arg_2", ",", "arg_4", ")", ",", "0", ")", "arg_3", ".", "add_", "(", "th", ".", "mean", "(", "(", "arg_5", "-", "arg_6", ")", "**", "2", ")", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Compute the loss model.\n\n        :param pred: predicted Variable\n        :param target: Target Variable\n        :return: Loss\n        \"\"\"\n        arg_3 = th.FloatTensor([0])\n        for arg_4 in range(1, arg_0.moments):\n            arg_5 = th.mean(th.pow(arg_1, arg_4), 0)\n            arg_6 = th.mean(th.pow(arg_2, arg_4), 0)\n\n            arg_3.add_(th.mean((arg_5 - arg_6) ** 2))  # L2\n\n        return arg_3", "path": "cdt/utils/loss.py", "identifier": "MomentMatchingLoss.forward", "docstring": "Compute the loss model.\n\n        :param pred: predicted Variable\n        :param target: Target Variable\n        :return: Loss", "docstring_tokens": ["Compute", "the", "loss", "model", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 261107}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/compiler.py#L240-L266", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Gets the field on a model with the specified name.", "language": "python", "parameters": "(self, name: str)", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_normalize_field_name", "(", "arg_1", ")", "if", "arg_3", "==", "'pk'", "and", "arg_0", ".", "query", ".", "model", ".", "_meta", ".", "pk", ":", "return", "arg_0", ".", "query", ".", "model", ".", "_meta", ".", "pk", "for", "arg_4", "in", "arg_0", ".", "query", ".", "model", ".", "_meta", ".", "local_concrete_fields", ":", "if", "arg_4", ".", "name", "==", "arg_3", "or", "arg_4", ".", "column", "==", "arg_3", ":", "return", "arg_4", "return", "None"], "function": "def Func(arg_0, arg_1: arg_2):\n        \"\"\"Gets the field on a model with the specified name.\n\n        Arguments:\n            name:\n                The name of the field to look for.\n\n                This can be both the actual field name, or\n                the name of the column, both will work :)\n\n        Returns:\n            The field with the specified name or None if\n            no such field exists.\n        \"\"\"\n\n        arg_3 = arg_0._normalize_field_name(arg_1)\n\n        # 'pk' has special meaning and always refers to the primary\n        # key of a model, we have to respect this de-facto standard behaviour\n        if arg_3 == 'pk' and arg_0.query.model._meta.pk:\n            return arg_0.query.model._meta.pk\n\n        for arg_4 in arg_0.query.model._meta.local_concrete_fields:\n            if arg_4.name == arg_3 or arg_4.column == arg_3:\n                return arg_4\n\n        return None", "path": "psqlextra/compiler.py", "identifier": "PostgresInsertCompiler._get_model_field", "docstring": "Gets the field on a model with the specified name.\n\n        Arguments:\n            name:\n                The name of the field to look for.\n\n                This can be both the actual field name, or\n                the name of the column, both will work :)\n\n        Returns:\n            The field with the specified name or None if\n            no such field exists.", "docstring_tokens": ["Gets", "the", "field", "on", "a", "model", "with", "the", "specified", "name", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 261108}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1550-L1552", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Return the time part, with tzinfo None.", "language": "python", "parameters": "(self)", "return_statement": "return time(self.hour, self.minute, self.second, self.microsecond)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "Func", "(", "arg_0", ".", "hour", ",", "arg_0", ".", "minute", ",", "arg_0", ".", "second", ",", "arg_0", ".", "microsecond", ")"], "function": "def Func(arg_0):\n        \"Return the Func part, with tzinfo None.\"\n        return Func(arg_0.hour, arg_0.minute, arg_0.second, arg_0.microsecond)", "path": "third_party/pypy/datetime.py", "identifier": "datetime.time", "docstring": "Return the time part, with tzinfo None.", "docstring_tokens": ["Return", "the", "time", "part", "with", "tzinfo", "None", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 261109}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/random/utils.py#L107-L125", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Return a normally distributed complex random matrix.", "language": "python", "parameters": "(nrow, ncol=None, seed=None)", "return_statement": "return G", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", "if", "arg_2", "is", "not", "None", ":", "np", ".", "random", ".", "seed", "(", "arg_2", ")", "arg_3", "=", "np", ".", "random", ".", "normal", "(", "size", "=", "(", "arg_0", ",", "arg_1", ")", ")", "+", "np", ".", "random", ".", "normal", "(", "size", "=", "(", "arg_0", ",", "arg_1", ")", ")", "*", "1j", "return", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None):\n    \"\"\"\n    Return a normally distributed complex random matrix.\n\n    Args:\n        nrow (int): number of rows in output matrix.\n        ncol (int): number of columns in output matrix.\n        seed (int): Optional. To set a random seed.\n    Returns:\n        ndarray: A complex rectangular matrix where each real and imaginary\n            entry is sampled from the normal distribution.\n    \"\"\"\n    if arg_1 is None:\n        arg_1 = arg_0\n    if arg_2 is not None:\n        np.random.seed(arg_2)\n    arg_3 = np.random.normal(size=(arg_0, arg_1)) + \\\n        np.random.normal(size=(arg_0, arg_1)) * 1j\n    return arg_3", "path": "qiskit/quantum_info/random/utils.py", "identifier": "__ginibre_matrix", "docstring": "Return a normally distributed complex random matrix.\n\n    Args:\n        nrow (int): number of rows in output matrix.\n        ncol (int): number of columns in output matrix.\n        seed (int): Optional. To set a random seed.\n    Returns:\n        ndarray: A complex rectangular matrix where each real and imaginary\n            entry is sampled from the normal distribution.", "docstring_tokens": ["Return", "a", "normally", "distributed", "complex", "random", "matrix", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 261110}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L523-L537", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "The name of the application.  This is usually the import name\n        with the difference that it's guessed from the run file if the\n        import name is main.  This name is used as a display name when\n        Flask needs the name of the application.  It can be set and overridden\n        to change the value.", "language": "python", "parameters": "(self)", "return_statement": "return self.import_name", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "import_Func", "==", "'__main__'", ":", "arg_1", "=", "getattr", "(", "sys", ".", "modules", "[", "'__main__'", "]", ",", "'__file__'", ",", "None", ")", "if", "arg_1", "is", "None", ":", "return", "'__main__'", "return", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "baseFunc", "(", "arg_1", ")", ")", "[", "0", "]", "return", "arg_0", ".", "import_Func"], "function": "def Func(arg_0):\n        \"\"\"The Func of the application.  This is usually the import Func\n        with the difference that it's guessed from the run file if the\n        import Func is main.  This Func is used as a display Func when\n        Flask needs the Func of the application.  It can be set and overridden\n        to change the value.\n\n        .. versionadded:: 0.8\n        \"\"\"\n        if arg_0.import_Func == '__main__':\n            arg_1 = getattr(sys.modules['__main__'], '__file__', None)\n            if arg_1 is None:\n                return '__main__'\n            return os.path.splitext(os.path.baseFunc(arg_1))[0]\n        return arg_0.import_Func", "path": "capybara/virtualenv/lib/python2.7/site-packages/flask/app.py", "identifier": "Flask.name", "docstring": "The name of the application.  This is usually the import name\n        with the difference that it's guessed from the run file if the\n        import name is main.  This name is used as a display name when\n        Flask needs the name of the application.  It can be set and overridden\n        to change the value.\n\n        .. versionadded:: 0.8", "docstring_tokens": ["The", "name", "of", "the", "application", ".", "This", "is", "usually", "the", "import", "name", "with", "the", "difference", "that", "it", "s", "guessed", "from", "the", "run", "file", "if", "the", "import", "name", "is", "main", ".", "This", "name", "is", "used", "as", "a", "display", "name", "when", "Flask", "needs", "the", "name", "of", "the", "application", ".", "It", "can", "be", "set", "and", "overridden", "to", "change", "the", "value", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 261111}
{"url": "https://github.com/bitlabstudio/django-dashboard-app/blob/ed98f2bca91a4ced36d0dd1aa1baee78e989cf64/dashboard_app/widget_base.py#L77-L87", "sha": "ed98f2bca91a4ced36d0dd1aa1baee78e989cf64", "docstring_summary": "Saves the setting value into the database.", "language": "python", "parameters": "(self, setting_name, value)", "return_statement": "return setting", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "get_setting", "(", "arg_1", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "models", ".", "DashboardWidgetSettings", ".", "objects", ".", "create", "(", "widget_name", "=", "arg_0", ".", "get_name", "(", ")", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_3", ".", "value", "=", "arg_2", "arg_3", ".", "save", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Saves the setting value into the database.\"\"\"\n        arg_3 = arg_0.get_setting(arg_1)\n        if arg_3 is None:\n            arg_3 = models.DashboardWidgetSettings.objects.create(\n                widget_name=arg_0.get_name(),\n                arg_1=arg_1,\n                arg_2=arg_2)\n        arg_3.value = arg_2\n        arg_3.save()\n        return arg_3", "path": "dashboard_app/widget_base.py", "identifier": "DashboardWidgetBase.save_setting", "docstring": "Saves the setting value into the database.", "docstring_tokens": ["Saves", "the", "setting", "value", "into", "the", "database", "."], "nwo": "bitlabstudio/django-dashboard-app", "score": 0.19645210594164048, "idx": 261112}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L589-L598", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Clear all configuration properties from in-memory cache, but do NOT\n    alter the custom configuration file. Used in unit-testing.", "language": "python", "parameters": "(cls)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "super", "(", "Configuration", ",", "arg_0", ")", ".", "Func", "(", ")", "_CustomConfigurationFileWrapper", ".", "Func", "(", "persistent", "=", "False", ")"], "function": "def Func(arg_0):\n    \"\"\" Clear all configuration properties from in-memory cache, but do NOT\n    alter the custom configuration file. Used in unit-testing.\n    \"\"\"\n    # Clear the in-memory settings cache, forcing reload upon subsequent \"get\"\n    # request.\n    super(Configuration, arg_0).Func()\n\n    # Reset in-memory custom configuration info.\n    _CustomConfigurationFileWrapper.Func(persistent=False)", "path": "src/nupic/swarming/hypersearch/support.py", "identifier": "Configuration.clear", "docstring": "Clear all configuration properties from in-memory cache, but do NOT\n    alter the custom configuration file. Used in unit-testing.", "docstring_tokens": ["Clear", "all", "configuration", "properties", "from", "in", "-", "memory", "cache", "but", "do", "NOT", "alter", "the", "custom", "configuration", "file", ".", "Used", "in", "unit", "-", "testing", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261113}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L241-L274", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Utility function that creates JSON repr. of a Credentials object.", "language": "python", "parameters": "(self, strip, to_serialize=None)", "return_statement": "return json.dumps(to_serialize)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_0", ".", "__class__", "if", "arg_2", "is", "None", ":", "arg_2", "=", "copy", ".", "copy", "(", "arg_0", ".", "__dict__", ")", "else", ":", "arg_2", "=", "copy", ".", "copy", "(", "arg_2", ")", "for", "arg_4", "in", "arg_1", ":", "if", "arg_4", "in", "arg_2", ":", "del", "arg_2", "[", "arg_4", "]", "arg_2", "[", "'token_expiry'", "]", "=", "_parse_expiry", "(", "arg_2", ".", "get", "(", "'token_expiry'", ")", ")", "arg_2", "[", "'_class'", "]", "=", "arg_3", ".", "__name__", "arg_2", "[", "'_module'", "]", "=", "arg_3", ".", "__module__", "for", "arg_5", ",", "arg_6", "in", "arg_2", ".", "items", "(", ")", ":", "if", "isinstance", "(", "arg_6", ",", "bytes", ")", ":", "arg_2", "[", "arg_5", "]", "=", "arg_6", ".", "decode", "(", "'utf-8'", ")", "if", "isinstance", "(", "arg_6", ",", "set", ")", ":", "arg_2", "[", "arg_5", "]", "=", "list", "(", "arg_6", ")", "return", "json", ".", "dumps", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"Utility function that creates JSON repr. of a Credentials object.\n\n        Args:\n            strip: array, An array of names of members to exclude from the\n                   JSON.\n            to_serialize: dict, (Optional) The properties for this object\n                          that will be serialized. This allows callers to\n                          modify before serializing.\n\n        Returns:\n            string, a JSON representation of this instance, suitable to pass to\n            from_json().\n        \"\"\"\n        arg_3 = arg_0.__class__\n        if arg_2 is None:\n            arg_2 = copy.copy(arg_0.__dict__)\n        else:\n            # Assumes it is a str->str dictionary, so we don't deep copy.\n            arg_2 = copy.copy(arg_2)\n        for arg_4 in arg_1:\n            if arg_4 in arg_2:\n                del arg_2[arg_4]\n        arg_2['token_expiry'] = _parse_expiry(\n            arg_2.get('token_expiry'))\n        # Add in information we will need later to reconstitute this instance.\n        arg_2['_class'] = arg_3.__name__\n        arg_2['_module'] = arg_3.__module__\n        for arg_5, arg_6 in arg_2.items():\n            if isinstance(arg_6, bytes):\n                arg_2[arg_5] = arg_6.decode('utf-8')\n            if isinstance(arg_6, set):\n                arg_2[arg_5] = list(arg_6)\n        return json.dumps(arg_2)", "path": "oauth2client/client.py", "identifier": "Credentials._to_json", "docstring": "Utility function that creates JSON repr. of a Credentials object.\n\n        Args:\n            strip: array, An array of names of members to exclude from the\n                   JSON.\n            to_serialize: dict, (Optional) The properties for this object\n                          that will be serialized. This allows callers to\n                          modify before serializing.\n\n        Returns:\n            string, a JSON representation of this instance, suitable to pass to\n            from_json().", "docstring_tokens": ["Utility", "function", "that", "creates", "JSON", "repr", ".", "of", "a", "Credentials", "object", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 261114}
{"url": "https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/__init__.py#L350-L358", "sha": "f777067076f62c9ab74ffea6e90fd54402b7a1b4", "docstring_summary": "Associate the provided rule definition name ``def_name`` with the\n        category group ``cat_group`` in the category ``cat``.", "language": "python", "parameters": "(self, cat, cat_group, def_name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_0", ".", "cat_groups", ".", "setdefault", "(", "arg_1", ",", "{", "}", ")", ".", "setdefault", "(", "arg_2", ",", "deque", "(", ")", ")", ".", "append", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Associate the provided rule definition name ``def_name`` with the\n        category group ``cat_group`` in the category ``cat``.\n\n        :param str cat: The category the rule definition was declared in\n        :param str cat_group: The group within the category the rule belongs to\n        :param str def_name: The name of the rule definition\n        \"\"\"\n        arg_0.cat_groups.setdefault(arg_1, {}).setdefault(arg_2, deque()).append(arg_3)", "path": "gramfuzz/gramfuzz/__init__.py", "identifier": "GramFuzzer.add_to_cat_group", "docstring": "Associate the provided rule definition name ``def_name`` with the\n        category group ``cat_group`` in the category ``cat``.\n\n        :param str cat: The category the rule definition was declared in\n        :param str cat_group: The group within the category the rule belongs to\n        :param str def_name: The name of the rule definition", "docstring_tokens": ["Associate", "the", "provided", "rule", "definition", "name", "def_name", "with", "the", "category", "group", "cat_group", "in", "the", "category", "cat", "."], "nwo": "mseclab/PyJFuzz", "score": 0.7046043146469614, "idx": 261115}
{"url": "https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/util.py#L22-L44", "sha": "d97414a05541f48231381f607d1d2e6b50781d39", "docstring_summary": "Convert a function taking multiple arguments into a function taking a single iterable argument.", "language": "python", "parameters": "(f: Callable[..., A])", "return_statement": "return splatted", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", "[", "...", ",", "arg_2", "]", ")", "->", "arg_1", "[", "[", "Iterable", "]", ",", "arg_2", "]", ":", "def", "Functed", "(", "arg_3", ")", ":", "return", "arg_0", "(", "*", "arg_3", ")", "return", "Functed"], "function": "def Func(arg_0: arg_1[..., arg_2]) -> arg_1[[Iterable], arg_2]:\n    \"\"\"Convert a function taking multiple arguments into a function taking a single iterable argument.\n\n    Args:\n        f: Any function\n\n    Returns:\n        A function that accepts a single iterable argument. Each element of this iterable argument is passed as an\n        argument to ``f``.\n\n    Example:\n        $ def f(a, b, c):\n        $     return a + b + c\n        $\n        $ f(1, 2, 3)  # 6\n        $ g = Func(f)\n        $ g([1, 2, 3])  # 6\n    \"\"\"\n\n    def Functed(arg_3):\n        return arg_0(*arg_3)\n\n    return Functed", "path": "parsita/util.py", "identifier": "splat", "docstring": "Convert a function taking multiple arguments into a function taking a single iterable argument.\n\n    Args:\n        f: Any function\n\n    Returns:\n        A function that accepts a single iterable argument. Each element of this iterable argument is passed as an\n        argument to ``f``.\n\n    Example:\n        $ def f(a, b, c):\n        $     return a + b + c\n        $\n        $ f(1, 2, 3)  # 6\n        $ g = splat(f)\n        $ g([1, 2, 3])  # 6", "docstring_tokens": ["Convert", "a", "function", "taking", "multiple", "arguments", "into", "a", "function", "taking", "a", "single", "iterable", "argument", "."], "nwo": "drhagen/parsita", "score": 0.2757871243566705, "idx": 261116}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L1809-L1826", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Sets the continuation prompt.", "language": "python", "parameters": "(self, prompt, html=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "if", "arg_2", ":", "arg_0", ".", "_continuation_prompt_html", "=", "arg_1", "else", ":", "arg_0", ".", "_continuation_prompt", "=", "arg_1", "arg_0", ".", "_continuation_prompt_html", "=", "None"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\" Sets the continuation prompt.\n\n        Parameters\n        ----------\n        prompt : str\n            The prompt to show when more input is needed.\n\n        html : bool, optional (default False)\n            If set, the prompt will be inserted as formatted HTML. Otherwise,\n            the prompt will be treated as plain text, though ANSI color codes\n            will be handled.\n        \"\"\"\n        if arg_2:\n            arg_0._continuation_prompt_html = arg_1\n        else:\n            arg_0._continuation_prompt = arg_1\n            arg_0._continuation_prompt_html = None", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._set_continuation_prompt", "docstring": "Sets the continuation prompt.\n\n        Parameters\n        ----------\n        prompt : str\n            The prompt to show when more input is needed.\n\n        html : bool, optional (default False)\n            If set, the prompt will be inserted as formatted HTML. Otherwise,\n            the prompt will be treated as plain text, though ANSI color codes\n            will be handled.", "docstring_tokens": ["Sets", "the", "continuation", "prompt", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261117}
{"url": "https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L55-L74", "sha": "d6ac94d28d707fae23170064d078f1edf937d13e", "docstring_summary": "Compose projects.json for gerrit, but using the git lists", "language": "python", "parameters": "(projects)", "return_statement": "return projects", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "arg_2", "for", "arg_2", "in", "arg_0", "if", "'git'", "in", "arg_0", "[", "arg_2", "]", "]", "for", "arg_2", "in", "arg_1", ":", "arg_3", "=", "[", "arg_4", "for", "arg_4", "in", "arg_0", "[", "arg_2", "]", "[", "'git'", "]", "if", "'gitroot'", "in", "arg_4", "]", "if", "len", "(", "arg_3", ")", ">", "0", ":", "arg_0", "[", "arg_2", "]", "[", "'gerrit'", "]", "=", "[", "]", "for", "arg_4", "in", "arg_3", ":", "arg_5", "=", "arg_4", ".", "replace", "(", "\"http://git.eclipse.org/gitroot/\"", ",", "\"\"", ")", "arg_5", "=", "arg_5", ".", "replace", "(", "\".git\"", ",", "\"\"", ")", "arg_0", "[", "arg_2", "]", "[", "'gerrit'", "]", ".", "append", "(", "\"git.eclipse.org_\"", "+", "arg_5", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\" Compose projects.json for gerrit, but using the git lists\n\n    change: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'\n    to: 'git.eclipse.org_xwt/org.eclipse.xwt\n\n    :param projects: projects.json\n    :return: projects.json with gerrit\n    \"\"\"\n    arg_1 = [arg_2 for arg_2 in arg_0 if 'git' in arg_0[arg_2]]\n    for arg_2 in arg_1:\n        arg_3 = [arg_4 for arg_4 in arg_0[arg_2]['git'] if 'gitroot' in arg_4]\n        if len(arg_3) > 0:\n            arg_0[arg_2]['gerrit'] = []\n        for arg_4 in arg_3:\n            arg_5 = arg_4.replace(\"http://git.eclipse.org/gitroot/\", \"\")\n            arg_5 = arg_5.replace(\".git\", \"\")\n            arg_0[arg_2]['gerrit'].append(\"git.eclipse.org_\" + arg_5)\n\n    return arg_0", "path": "sirmordred/eclipse_projects_lib.py", "identifier": "compose_gerrit", "docstring": "Compose projects.json for gerrit, but using the git lists\n\n    change: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'\n    to: 'git.eclipse.org_xwt/org.eclipse.xwt\n\n    :param projects: projects.json\n    :return: projects.json with gerrit", "docstring_tokens": ["Compose", "projects", ".", "json", "for", "gerrit", "but", "using", "the", "git", "lists"], "nwo": "chaoss/grimoirelab-sirmordred", "score": 0.5814958181722067, "idx": 261118}
{"url": "https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L275-L318", "sha": "ce2cf3f1425d02ba4f3ad3202cfca43a1892558a", "docstring_summary": "Create a new access request.", "language": "python", "parameters": "(cls, recid=None, receiver=None, sender_full_name=None,\n               sender_email=None, justification=None, sender=None)", "return_statement": "return obj", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "None", "if", "arg_6", "is", "None", "else", "arg_6", ".", "id", "assert", "arg_1", "assert", "arg_2", "assert", "arg_3", "assert", "arg_4", "assert", "arg_5", "arg_8", "=", "RequestStatus", ".", "EMAIL_VALIDATION", "if", "arg_6", "and", "arg_6", ".", "confirmed_at", ":", "arg_8", "=", "RequestStatus", ".", "PENDING", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "arg_9", "=", "arg_0", "(", "arg_8", "=", "arg_8", ",", "arg_1", "=", "arg_1", ",", "receiver_user_id", "=", "arg_2", ".", "id", ",", "arg_7", "=", "arg_7", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "db", ".", "session", ".", "add", "(", "arg_9", ")", "if", "arg_9", ".", "status", "==", "RequestStatus", ".", "EMAIL_VALIDATION", ":", "request_Funcd", ".", "send", "(", "arg_9", ")", "else", ":", "request_confirmed", ".", "send", "(", "arg_9", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n               arg_4=None, arg_5=None, arg_6=None):\n        \"\"\"Create a new access request.\n\n        :param recid: Record id (required).\n        :param receiver: User object of receiver (required).\n        :param sender_full_name: Full name of sender (required).\n        :param sender_email: Email address of sender (required).\n        :param justification: Justification message (required).\n        :param sender: User object of sender (optional).\n        \"\"\"\n        arg_7 = None if arg_6 is None else arg_6.id\n\n        assert arg_1\n        assert arg_2\n        assert arg_3\n        assert arg_4\n        assert arg_5\n\n        # Determine status\n        arg_8 = RequestStatus.EMAIL_VALIDATION\n        if arg_6 and arg_6.confirmed_at:\n            arg_8 = RequestStatus.PENDING\n\n        with db.session.begin_nested():\n            # Create object\n            arg_9 = arg_0(\n                arg_8=arg_8,\n                arg_1=arg_1,\n                receiver_user_id=arg_2.id,\n                arg_7=arg_7,\n                arg_3=arg_3,\n                arg_4=arg_4,\n                arg_5=arg_5\n            )\n\n            db.session.add(arg_9)\n\n        # Send signal\n        if arg_9.status == RequestStatus.EMAIL_VALIDATION:\n            request_Funcd.send(arg_9)\n        else:\n            request_confirmed.send(arg_9)\n        return arg_9", "path": "zenodo_accessrequests/models.py", "identifier": "AccessRequest.create", "docstring": "Create a new access request.\n\n        :param recid: Record id (required).\n        :param receiver: User object of receiver (required).\n        :param sender_full_name: Full name of sender (required).\n        :param sender_email: Email address of sender (required).\n        :param justification: Justification message (required).\n        :param sender: User object of sender (optional).", "docstring_tokens": ["Create", "a", "new", "access", "request", "."], "nwo": "zenodo/zenodo-accessrequests", "score": 0.2718259314615454, "idx": 261119}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/ecm.py#L90-L97", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Dispatch to cache predictor to get cache stats.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "results", ".", "update", "(", "{", "'cycles'", ":", "[", "]", ",", "'misses'", ":", "arg_0", ".", "predictor", ".", "get_misses", "(", ")", ",", "'hits'", ":", "arg_0", ".", "predictor", ".", "get_hits", "(", ")", ",", "'evicts'", ":", "arg_0", ".", "predictor", ".", "get_evicts", "(", ")", ",", "'verbose infos'", ":", "arg_0", ".", "predictor", ".", "get_infos", "(", ")", "}", ")"], "function": "def Func(arg_0):\n        \"\"\"Dispatch to cache predictor to get cache stats.\"\"\"\n        arg_0.results.update({\n                        'cycles': [],  # will be filled by caclculate_cycles()\n                        'misses': arg_0.predictor.get_misses(),\n                        'hits': arg_0.predictor.get_hits(),\n                        'evicts': arg_0.predictor.get_evicts(),\n                        'verbose infos': arg_0.predictor.get_infos()})", "path": "kerncraft/models/ecm.py", "identifier": "ECMData.calculate_cache_access", "docstring": "Dispatch to cache predictor to get cache stats.", "docstring_tokens": ["Dispatch", "to", "cache", "predictor", "to", "get", "cache", "stats", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 261120}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/video.py#L38-L59", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Run the command to resize the video and remove the output file if the\n    processing fails.", "language": "python", "parameters": "(cmd, source, outname)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "logging", ".", "getLogger", "(", "__name__", ")", "try", ":", "arg_4", "=", "subprocess", ".", "run", "(", "arg_0", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "except", "KeyboardInterrupt", ":", "arg_3", ".", "debug", "(", "'Process terminated, removing file %s'", ",", "arg_2", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "os", ".", "remove", "(", "arg_2", ")", "raise", "if", "arg_4", ".", "returncode", ":", "arg_3", ".", "debug", "(", "'STDOUT:\\n %s'", ",", "arg_4", ".", "stdout", ".", "decode", "(", "'utf8'", ")", ")", "arg_3", ".", "debug", "(", "'STDERR:\\n %s'", ",", "arg_4", ".", "stderr", ".", "decode", "(", "'utf8'", ")", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_2", ")", ":", "arg_3", ".", "debug", "(", "'Removing file %s'", ",", "arg_2", ")", "os", ".", "remove", "(", "arg_2", ")", "raise", "SubprocessException", "(", "'Failed to process '", "+", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Run the command to resize the video and remove the output file if the\n    processing fails.\n\n    \"\"\"\n    arg_3 = logging.getLogger(__name__)\n    try:\n        arg_4 = subprocess.run(arg_0, stdout=subprocess.PIPE,\n                             stderr=subprocess.PIPE)\n    except KeyboardInterrupt:\n        arg_3.debug('Process terminated, removing file %s', arg_2)\n        if os.path.isfile(arg_2):\n            os.remove(arg_2)\n        raise\n\n    if arg_4.returncode:\n        arg_3.debug('STDOUT:\\n %s', arg_4.stdout.decode('utf8'))\n        arg_3.debug('STDERR:\\n %s', arg_4.stderr.decode('utf8'))\n        if os.path.isfile(arg_2):\n            arg_3.debug('Removing file %s', arg_2)\n            os.remove(arg_2)\n        raise SubprocessException('Failed to process ' + arg_1)", "path": "sigal/video.py", "identifier": "check_subprocess", "docstring": "Run the command to resize the video and remove the output file if the\n    processing fails.", "docstring_tokens": ["Run", "the", "command", "to", "resize", "the", "video", "and", "remove", "the", "output", "file", "if", "the", "processing", "fails", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 261121}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/__init__.py#L76-L82", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Return all dirs in base_path, relative to base_path", "language": "python", "parameters": "(base_path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "for", "arg_1", ",", "arg_2", ",", "arg_3", "in", "os", ".", "walk", "(", "arg_0", ",", "followlinks", "=", "True", ")", ":", "for", "arg_4", "in", "arg_2", ":", "yield", "os", ".", "path", ".", "relpath", "(", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_4", ")", ",", "arg_0", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Return all dirs in base_path, relative to base_path\n        \"\"\"\n        for arg_1, arg_2, arg_3 in os.walk(arg_0, followlinks=True):\n            for arg_4 in arg_2:\n                yield os.path.relpath(os.path.join(arg_1, arg_4), arg_0)", "path": "capybara/virtualenv/lib/python2.7/site-packages/setuptools/__init__.py", "identifier": "PackageFinder._all_dirs", "docstring": "Return all dirs in base_path, relative to base_path", "docstring_tokens": ["Return", "all", "dirs", "in", "base_path", "relative", "to", "base_path"], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 261122}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L103-L118", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Execute command and wait for it to finish. Proceed with caution because\n        if you run a command that causes a prompt this will hang", "language": "python", "parameters": "(self, cmd, raise_on_error=True)", "return_statement": "return output", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ")", ":", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", ".", "exec_command", "(", "arg_1", ")", "arg_4", ".", "channel", ".", "recv_exit_status", "(", ")", "arg_6", "=", "arg_4", ".", "read", "(", ")", "if", "arg_0", ".", "interactive", ":", "print", "(", "arg_6", ")", "arg_7", "=", "arg_5", ".", "read", "(", ")", "if", "arg_0", ".", "interactive", ":", "print", "(", "arg_7", ")", "if", "arg_7", "and", "arg_2", ":", "raise", "ValueError", "(", "arg_7", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=True):\n        \"\"\"\n        Execute command and Func for it to finish. Proceed with caution because\n        if you run a command that causes a prompt this will hang\n        \"\"\"\n        arg_3, arg_4, arg_5 = arg_0.exec_command(arg_1)\n        arg_4.channel.recv_exit_status()\n        arg_6 = arg_4.read()\n        if arg_0.interactive:\n            print(arg_6)\n        arg_7 = arg_5.read()\n        if arg_0.interactive:\n            print(arg_7)\n        if arg_7 and arg_2:\n            raise ValueError(arg_7)\n        return arg_6", "path": "poseidon/ssh.py", "identifier": "SSHClient.wait", "docstring": "Execute command and wait for it to finish. Proceed with caution because\n        if you run a command that causes a prompt this will hang", "docstring_tokens": ["Execute", "command", "and", "wait", "for", "it", "to", "finish", ".", "Proceed", "with", "caution", "because", "if", "you", "run", "a", "command", "that", "causes", "a", "prompt", "this", "will", "hang"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 261123}
{"url": "https://github.com/elyase/masstable/blob/3eb72b22cd3337bc5c6bb95bb7bb73fdbe6ae9e2/masstable/masstable.py#L96-L112", "sha": "3eb72b22cd3337bc5c6bb95bb7bb73fdbe6ae9e2", "docstring_summary": "Export the contents to a file as comma separated values.", "language": "python", "parameters": "(self, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "'Z   N   M\\n'", ")", "arg_0", ".", "df", ".", "to_csv", "(", "arg_1", ",", "sep", "=", "'\\t'", ",", "mode", "=", "'a'", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Export the contents to a file as comma separated values.\n\n        Parameters\n        ----------\n        path : string\n            File path where the data should be saved to\n\n        Example\n        -------\n        Export the last ten elements of AME2012 to a new file:\n\n        >>> Table('AME2012').tail(10).Func('last_ten.txt')\n        \"\"\"\n        with open(arg_1, 'w') as f:\n            f.write('Z   N   M\\n')\n        arg_0.df.to_csv(arg_1, sep='\\t', mode='a')", "path": "masstable/masstable.py", "identifier": "Table.to_file", "docstring": "Export the contents to a file as comma separated values.\n\n        Parameters\n        ----------\n        path : string\n            File path where the data should be saved to\n\n        Example\n        -------\n        Export the last ten elements of AME2012 to a new file:\n\n        >>> Table('AME2012').tail(10).to_file('last_ten.txt')", "docstring_tokens": ["Export", "the", "contents", "to", "a", "file", "as", "comma", "separated", "values", "."], "nwo": "elyase/masstable", "score": 0.15726537023232431, "idx": 261124}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/data.py#L101-L104", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Chop a sequence into chunks of the given size.", "language": "python", "parameters": "(seq, size)", "return_statement": "return map(chunk,xrange(0,len(seq),size))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "lambda", "i", ":", "arg_0", "[", "i", ":", "i", "+", "arg_1", "]", "return", "map", "(", "arg_2", ",", "xrange", "(", "0", ",", "len", "(", "arg_0", ")", ",", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Chop a sequence into chunks of the given size.\"\"\"\n    arg_2 = lambda i: arg_0[i:i+arg_1]\n    return map(arg_2,xrange(0,len(arg_0),arg_1))", "path": "environment/lib/python2.7/site-packages/IPython/utils/data.py", "identifier": "chop", "docstring": "Chop a sequence into chunks of the given size.", "docstring_tokens": ["Chop", "a", "sequence", "into", "chunks", "of", "the", "given", "size", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261125}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L3318-L3324", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Copies data from `insert_dict` into a pytables `row`.", "language": "python", "parameters": "(self, row, insert_dict)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", ",", "arg_4", "in", "arg_2", ".", "items", "(", ")", ":", "try", ":", "arg_1", "[", "arg_3", "]", "=", "arg_4", "except", "KeyError", "as", "ke", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'Could not write `%s` into a table, '", "%", "arg_3", "+", "repr", "(", "ke", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Copies data from `insert_dict` into a pytables `row`.\"\"\"\n        for arg_3, arg_4 in arg_2.items():\n            try:\n                arg_1[arg_3] = arg_4\n            except KeyError as ke:\n                arg_0._logger.warning('Could not write `%s` into a table, ' % arg_3 + repr(ke))", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._all_insert_into_row", "docstring": "Copies data from `insert_dict` into a pytables `row`.", "docstring_tokens": ["Copies", "data", "from", "insert_dict", "into", "a", "pytables", "row", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 261126}
{"url": "https://github.com/willemarcel/osmcha/blob/9a22ed11834ed20c6b91e7b5685f66880ea09350/osmcha/changeset.py#L97-L107", "sha": "9a22ed11834ed20c6b91e7b5685f66880ea09350", "docstring_summary": "Get the changeset using the OSM API and return the content as a XML\n    ElementTree.", "language": "python", "parameters": "(changeset)", "return_statement": "return ET.fromstring(requests.get(url).content)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'https://www.openstreetmap.org/api/0.6/changeset/{}/download'", ".", "format", "(", "arg_0", ")", "return", "ET", ".", "fromstring", "(", "requests", ".", "get", "(", "arg_1", ")", ".", "content", ")"], "function": "def Func(arg_0):\n    \"\"\"Get the changeset using the OSM API and return the content as a XML\n    ElementTree.\n\n    Args:\n        changeset: the id of the changeset.\n    \"\"\"\n    arg_1 = 'https://www.openstreetmap.org/api/0.6/changeset/{}/download'.format(\n        arg_0\n        )\n    return ET.fromstring(requests.get(arg_1).content)", "path": "osmcha/changeset.py", "identifier": "get_changeset", "docstring": "Get the changeset using the OSM API and return the content as a XML\n    ElementTree.\n\n    Args:\n        changeset: the id of the changeset.", "docstring_tokens": ["Get", "the", "changeset", "using", "the", "OSM", "API", "and", "return", "the", "content", "as", "a", "XML", "ElementTree", "."], "nwo": "willemarcel/osmcha", "score": 0.19358971820395612, "idx": 261127}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/ssh/tunnel.py#L74-L87", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Attempt to make an ssh connection without a password.\n    This is mainly used for requiring password input only once\n    when many tunnels may be connected to the same server.", "language": "python", "parameters": "(server, keyfile, paramiko=None)", "return_statement": "return f(server, keyfile)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "sys", ".", "platform", "==", "'win32'", "if", "not", "arg_2", ":", "arg_3", "=", "_try_passwordless_openssh", "else", ":", "arg_3", "=", "_try_passwordless_paramiko", "return", "arg_3", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"Attempt to make an ssh connection without a password.\n    This is mainly used for requiring password input only once\n    when many tunnels may be connected to the same server.\n\n    If paramiko is None, the default for the platform is chosen.\n    \"\"\"\n    if arg_2 is None:\n        arg_2 = sys.platform == 'win32'\n    if not arg_2:\n        arg_3 = _try_passwordless_openssh\n    else:\n        arg_3 = _try_passwordless_paramiko\n    return arg_3(arg_0, arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/external/ssh/tunnel.py", "identifier": "try_passwordless_ssh", "docstring": "Attempt to make an ssh connection without a password.\n    This is mainly used for requiring password input only once\n    when many tunnels may be connected to the same server.\n\n    If paramiko is None, the default for the platform is chosen.", "docstring_tokens": ["Attempt", "to", "make", "an", "ssh", "connection", "without", "a", "password", ".", "This", "is", "mainly", "used", "for", "requiring", "password", "input", "only", "once", "when", "many", "tunnels", "may", "be", "connected", "to", "the", "same", "server", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261128}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L477-L484", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Remove quotes from a string.", "language": "python", "parameters": "(s)", "return_statement": "return s", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "len", "(", "arg_0", ")", ">", "1", ":", "if", "arg_0", ".", "startswith", "(", "'\"'", ")", "and", "arg_0", ".", "endswith", "(", "'\"'", ")", ":", "return", "arg_0", "[", "1", ":", "-", "1", "]", ".", "replace", "(", "'\\\\\\\\'", ",", "'\\\\'", ")", ".", "replace", "(", "'\\\\\"'", ",", "'\"'", ")", "if", "arg_0", ".", "startswith", "(", "'<'", ")", "and", "arg_0", ".", "endswith", "(", "'>'", ")", ":", "return", "arg_0", "[", "1", ":", "-", "1", "]", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Remove quotes from a string.\"\"\"\n    if len(arg_0) > 1:\n        if arg_0.startswith('\"') and arg_0.endswith('\"'):\n            return arg_0[1:-1].replace('\\\\\\\\', '\\\\').replace('\\\\\"', '\"')\n        if arg_0.startswith('<') and arg_0.endswith('>'):\n            return arg_0[1:-1]\n    return arg_0", "path": "third_party/stdlib/rfc822.py", "identifier": "unquote", "docstring": "Remove quotes from a string.", "docstring_tokens": ["Remove", "quotes", "from", "a", "string", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 261129}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py#L8-L61", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Return all physical tokens, even line continuations.", "language": "python", "parameters": "(toks)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "None", "arg_2", "=", "-", "1", "arg_3", "=", "None", "for", "arg_4", ",", "arg_5", ",", "(", "arg_6", ",", "arg_7", ")", ",", "(", "arg_8", ",", "arg_9", ")", ",", "arg_10", "in", "arg_0", ":", "if", "arg_2", "!=", "arg_8", ":", "if", "arg_1", "and", "arg_1", ".", "endswith", "(", "\"\\\\\\n\"", ")", ":", "arg_11", "=", "True", "if", "arg_3", "==", "tokenize", ".", "COMMENT", ":", "arg_11", "=", "False", "elif", "arg_4", "==", "token", ".", "STRING", ":", "if", "\"\\n\"", "in", "arg_5", "and", "arg_5", ".", "split", "(", "'\\n'", ",", "1", ")", "[", "0", "]", "[", "-", "1", "]", "==", "'\\\\'", ":", "arg_11", "=", "False", "if", "arg_11", ":", "arg_12", "=", "len", "(", "arg_1", ".", "split", "(", "\"\\n\"", ")", "[", "-", "2", "]", ")", "-", "1", "yield", "(", "99999", ",", "\"\\\\\\n\"", ",", "(", "arg_6", ",", "arg_12", ")", ",", "(", "arg_6", ",", "arg_12", "+", "2", ")", ",", "arg_1", ")", "arg_1", "=", "arg_10", "arg_3", "=", "arg_4", "yield", "arg_4", ",", "arg_5", ",", "(", "arg_6", ",", "arg_7", ")", ",", "(", "arg_8", ",", "arg_9", ")", ",", "arg_10", "arg_2", "=", "arg_8"], "function": "def Func(arg_0):\n    \"\"\"Return all physical tokens, even line continuations.\n\n    tokenize.generate_tokens() doesn't return a token for the backslash that\n    continues lines.  This wrapper provides those tokens so that we can\n    re-create a faithful representation of the original source.\n\n    Returns the same values as generate_tokens()\n\n    \"\"\"\n    arg_1 = None\n    arg_2 = -1\n    arg_3 = None\n    for arg_4, arg_5, (arg_6, arg_7), (arg_8, arg_9), arg_10 in arg_0:\n        if arg_2 != arg_8:\n            if arg_1 and arg_1.endswith(\"\\\\\\n\"):\n                # We are at the beginning of a new line, and the last line\n                # ended with a backslash.  We probably have to inject a\n                # backslash token into the stream. Unfortunately, there's more\n                # to figure out.  This code::\n                #\n                #   usage = \"\"\"\\\n                #   HEY THERE\n                #   \"\"\"\n                #\n                # triggers this condition, but the token text is::\n                #\n                #   '\"\"\"\\\\\\nHEY THERE\\n\"\"\"'\n                #\n                # so we need to figure out if the backslash is already in the\n                # string token or not.\n                arg_11 = True\n                if arg_3 == tokenize.COMMENT:\n                    # Comments like this \\\n                    # should never result in a new token.\n                    arg_11 = False\n                elif arg_4 == token.STRING:\n                    if \"\\n\" in arg_5 and arg_5.split('\\n', 1)[0][-1] == '\\\\':\n                        # It's a multiline string and the first line ends with\n                        # a backslash, so we don't need to inject another.\n                        arg_11 = False\n                if arg_11:\n                    # Figure out what column the backslash is in.\n                    arg_12 = len(arg_1.split(\"\\n\")[-2]) - 1\n                    # Yield the token, with a fake token type.\n                    yield (\n                        99999, \"\\\\\\n\",\n                        (arg_6, arg_12), (arg_6, arg_12+2),\n                        arg_1\n                        )\n            arg_1 = arg_10\n            arg_3 = arg_4\n        yield arg_4, arg_5, (arg_6, arg_7), (arg_8, arg_9), arg_10\n        arg_2 = arg_8", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py", "identifier": "phys_tokens", "docstring": "Return all physical tokens, even line continuations.\n\n    tokenize.generate_tokens() doesn't return a token for the backslash that\n    continues lines.  This wrapper provides those tokens so that we can\n    re-create a faithful representation of the original source.\n\n    Returns the same values as generate_tokens()", "docstring_tokens": ["Return", "all", "physical", "tokens", "even", "line", "continuations", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 261130}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/regression.py#L56-L66", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Mean squared error regression loss", "language": "python", "parameters": "(y_actual, y_predicted, weights=None)", "return_statement": "return _colmean((y_predicted - y_actual) ** 2)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "ModelBase", ".", "_check_targets", "(", "arg_0", ",", "arg_1", ")", "return", "_colmean", "(", "(", "arg_1", "-", "arg_0", ")", "**", "2", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    \"\"\"\n    Mean squared error regression loss\n\n    :param y_actual: H2OFrame of actual response.\n    :param y_predicted: H2OFrame of predicted response.\n    :param weights: (Optional) sample weights\n    :returns: mean squared error loss (best is 0.0).\n    \"\"\"\n    ModelBase._check_targets(arg_0, arg_1)\n    return _colmean((arg_1 - arg_0) ** 2)", "path": "h2o-py/h2o/model/regression.py", "identifier": "h2o_mean_squared_error", "docstring": "Mean squared error regression loss\n\n    :param y_actual: H2OFrame of actual response.\n    :param y_predicted: H2OFrame of predicted response.\n    :param weights: (Optional) sample weights\n    :returns: mean squared error loss (best is 0.0).", "docstring_tokens": ["Mean", "squared", "error", "regression", "loss"], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 261131}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/project.py#L205-L267", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Trigger a project update job within Ansible Tower.\n        Only meaningful on non-manual projects.", "language": "python", "parameters": "(self, pk=None, create_on_missing=False, monitor=False,\n               wait=False, timeout=None, name=None, organization=None)", "return_statement": "return {\n            'id': project_update_id,\n            'changed': True,\n        }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "False", ",", "arg_3", "=", "False", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ")", ":", "arg_8", "=", "arg_0", ".", "get", "(", "arg_1", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "arg_1", "=", "arg_8", "[", "'id'", "]", "debug", ".", "log", "(", "'Asking whether the project can be Funcd.'", ",", "header", "=", "'details'", ")", "arg_9", "=", "client", ".", "get", "(", "'/projects/%d/Func/'", "%", "arg_1", ")", "if", "not", "arg_9", ".", "json", "(", ")", "[", "'can_Func'", "]", ":", "raise", "exc", ".", "CannotStartJob", "(", "'Cannot Func project.'", ")", "debug", ".", "log", "(", "'Updating the project.'", ",", "header", "=", "'details'", ")", "arg_9", "=", "client", ".", "post", "(", "'/projects/%d/Func/'", "%", "arg_1", ")", "arg_10", "=", "arg_9", ".", "json", "(", ")", "[", "'project_Func'", "]", "if", "arg_3", ":", "return", "arg_0", ".", "monitor", "(", "arg_10", ",", "parent_pk", "=", "arg_1", ",", "arg_5", "=", "arg_5", ")", "elif", "arg_4", ":", "return", "arg_0", ".", "wait", "(", "arg_10", ",", "parent_pk", "=", "arg_1", ",", "arg_5", "=", "arg_5", ")", "return", "{", "'id'", ":", "arg_10", ",", "'changed'", ":", "True", ",", "}"], "function": "def Func(arg_0, arg_1=None, arg_2=False, arg_3=False,\n               arg_4=False, arg_5=None, arg_6=None, arg_7=None):\n        \"\"\"Trigger a project Func job within Ansible Tower.\n        Only meaningful on non-manual projects.\n\n        =====API DOCS=====\n        Update the given project.\n\n        :param pk: Primary key of the project to be Funcd.\n        :type pk: int\n        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly launched project Func\n                        rather than exiting with a success.\n        :type monitor: bool\n        :param wait: Flag that if set, monitor the status of the project Func, but do not print while it is\n                     in progress.\n        :type wait: bool\n        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number\n                        of seconds.\n        :type timeout: int\n        :param name: Name of the project to be Funcd if ``pk`` is not set.\n        :type name: str\n        :param organization: Primary key or name of the organization the project to be Funcd belonging to if\n                             ``pk`` is not set.\n        :type organization: str\n        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``\n                  call if ``wait`` flag is on; dictionary of \"status\" if none of the two flags are on.\n        :rtype: dict\n        :raises tower_cli.exceptions.CannotStartJob: When the project cannot be Funcd.\n\n        =====API DOCS=====\n        \"\"\"\n        # First, get the appropriate project.\n        # This should be uniquely identified at this point, and if not, then\n        # we just want the error that `get` will throw to bubble up.\n        arg_8 = arg_0.get(arg_1, arg_6=arg_6, arg_7=arg_7)\n        arg_1 = arg_8['id']\n\n        # Determine whether this project is able to be Funcd.\n        debug.log('Asking whether the project can be Funcd.',\n                  header='details')\n        arg_9 = client.get('/projects/%d/Func/' % arg_1)\n        if not arg_9.json()['can_Func']:\n            raise exc.CannotStartJob('Cannot Func project.')\n\n        # Okay, this project can be Funcd, according to Tower.\n        # Commence the Func.\n        debug.log('Updating the project.', header='details')\n        arg_9 = client.post('/projects/%d/Func/' % arg_1)\n\n        arg_10 = arg_9.json()['project_Func']\n\n        # If we were told to monitor the project Func's status, do so.\n        if arg_3:\n            return arg_0.monitor(arg_10, parent_pk=arg_1,\n                                arg_5=arg_5)\n        elif arg_4:\n            return arg_0.wait(arg_10, parent_pk=arg_1, arg_5=arg_5)\n\n        # Return the project Func ID.\n        return {\n            'id': arg_10,\n            'changed': True,\n        }", "path": "tower_cli/resources/project.py", "identifier": "Resource.update", "docstring": "Trigger a project update job within Ansible Tower.\n        Only meaningful on non-manual projects.\n\n        =====API DOCS=====\n        Update the given project.\n\n        :param pk: Primary key of the project to be updated.\n        :type pk: int\n        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly launched project update\n                        rather than exiting with a success.\n        :type monitor: bool\n        :param wait: Flag that if set, monitor the status of the project update, but do not print while it is\n                     in progress.\n        :type wait: bool\n        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number\n                        of seconds.\n        :type timeout: int\n        :param name: Name of the project to be updated if ``pk`` is not set.\n        :type name: str\n        :param organization: Primary key or name of the organization the project to be updated belonging to if\n                             ``pk`` is not set.\n        :type organization: str\n        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``\n                  call if ``wait`` flag is on; dictionary of \"status\" if none of the two flags are on.\n        :rtype: dict\n        :raises tower_cli.exceptions.CannotStartJob: When the project cannot be updated.\n\n        =====API DOCS=====", "docstring_tokens": ["Trigger", "a", "project", "update", "job", "within", "Ansible", "Tower", ".", "Only", "meaningful", "on", "non", "-", "manual", "projects", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 261132}
{"url": "https://github.com/tek/ribosome/blob/b2ce9e118faa46d93506cbbb5f27ecfbd4e8a1cc/ribosome/nvim/io/compute.py#L242-L245", "sha": "b2ce9e118faa46d93506cbbb5f27ecfbd4e8a1cc", "docstring_summary": "calls `map` to shift the recover execution to flat_map_nvim_io", "language": "python", "parameters": "(self, io: NvimIORecover[A])", "return_statement": "return eval_step(self.vim)(io.map(lambda a: a))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ")", "->", "NvimIO", "[", "B", "]", ":", "return", "eval_step", "(", "arg_0", ".", "vim", ")", "(", "arg_1", ".", "map", "(", "lambda", "a", ":", "a", ")", ")"], "function": "def Func(arg_0, arg_1: arg_2[arg_3]) -> NvimIO[B]:\n        '''calls `map` to shift the recover execution to flat_map_nvim_io\n        '''\n        return eval_step(arg_0.vim)(arg_1.map(lambda a: a))", "path": "ribosome/nvim/io/compute.py", "identifier": "eval_step.nvim_io_recover", "docstring": "calls `map` to shift the recover execution to flat_map_nvim_io", "docstring_tokens": ["calls", "map", "to", "shift", "the", "recover", "execution", "to", "flat_map_nvim_io"], "nwo": "tek/ribosome", "score": 0.18261785916548806, "idx": 261133}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L367-L400", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "Construct the actual transaction and store it in the class's dict\n            store", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", ")", "for", "arg_2", "in", "arg_0", ".", "ops", ":", "if", "isinstance", "(", "arg_2", ",", "ProposalBuilder", ")", ":", "arg_3", "=", "arg_2", ".", "get_raw", "(", ")", "if", "arg_3", ":", "arg_1", ".", "append", "(", "arg_3", ")", "elif", "isinstance", "(", "arg_2", ",", "arg_0", ".", "operation_class", ")", ":", "arg_1", ".", "extend", "(", "[", "arg_2", "]", ")", "else", ":", "arg_1", ".", "extend", "(", "[", "arg_0", ".", "operation_class", "(", "arg_2", ")", "]", ")", "arg_1", "=", "arg_0", ".", "add_required_fees", "(", "arg_1", ",", "asset_id", "=", "arg_0", ".", "fee_asset_id", ")", "arg_4", "=", "formatTimeFromNow", "(", "arg_0", ".", "expiration", "or", "arg_0", ".", "blockchain", ".", "expiration", "or", "30", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "get_block_params", "(", ")", "arg_0", ".", "tx", "=", "arg_0", ".", "signed_transaction_class", "(", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_4", "=", "arg_4", ",", "operations", "=", "arg_1", ",", ")", "dict", ".", "update", "(", "arg_0", ",", "arg_0", ".", "tx", ".", "json", "(", ")", ")", "arg_0", ".", "_unset_require_reconstruction", "(", ")"], "function": "def Func(arg_0):\n        \"\"\" Construct the actual transaction and store it in the class's dict\n            store\n        \"\"\"\n        arg_1 = list()\n        for arg_2 in arg_0.ops:\n            if isinstance(arg_2, ProposalBuilder):\n                # This operation is a proposal an needs to be deal with\n                # differently\n                arg_3 = arg_2.get_raw()\n                if arg_3:\n                    arg_1.append(arg_3)\n            elif isinstance(arg_2, arg_0.operation_class):\n                arg_1.extend([arg_2])\n            else:\n                # otherwise, we simply wrap ops into Operations\n                arg_1.extend([arg_0.operation_class(arg_2)])\n\n        # We now wrap everything into an actual transaction\n        arg_1 = arg_0.add_required_fees(arg_1, asset_id=arg_0.fee_asset_id)\n        arg_4 = formatTimeFromNow(\n            arg_0.expiration\n            or arg_0.blockchain.expiration\n            or 30  # defaults to 30 seconds\n        )\n        arg_5, arg_6 = arg_0.get_block_params()\n        arg_0.tx = arg_0.signed_transaction_class(\n            arg_5=arg_5,\n            arg_6=arg_6,\n            arg_4=arg_4,\n            operations=arg_1,\n        )\n        dict.update(arg_0, arg_0.tx.json())\n        arg_0._unset_require_reconstruction()", "path": "graphenecommon/transactionbuilder.py", "identifier": "TransactionBuilder.constructTx", "docstring": "Construct the actual transaction and store it in the class's dict\n            store", "docstring_tokens": ["Construct", "the", "actual", "transaction", "and", "store", "it", "in", "the", "class", "s", "dict", "store"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 261134}
{"url": "https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/thing.py#L402-L410", "sha": "65d467c89ed79d0bbc42b8b3c8f9e5a320edd237", "docstring_summary": "Add a new websocket subscriber to an event.", "language": "python", "parameters": "(self, name, ws)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "in", "arg_0", ".", "available_events", ":", "arg_0", ".", "available_events", "[", "arg_1", "]", "[", "'subscribers'", "]", ".", "add", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Add a new websocket subscriber to an event.\n\n        name -- name of the event\n        ws -- the websocket\n        \"\"\"\n        if arg_1 in arg_0.available_events:\n            arg_0.available_events[arg_1]['subscribers'].add(arg_2)", "path": "webthing/thing.py", "identifier": "Thing.add_event_subscriber", "docstring": "Add a new websocket subscriber to an event.\n\n        name -- name of the event\n        ws -- the websocket", "docstring_tokens": ["Add", "a", "new", "websocket", "subscriber", "to", "an", "event", "."], "nwo": "mozilla-iot/webthing-python", "score": 0.9433856865863764, "idx": 261135}
{"url": "https://github.com/dhhagan/py-opc/blob/2c8f19530fb64bf5fd4ee0d694a47850161ed8a7/opc/__init__.py#L235-L258", "sha": "2c8f19530fb64bf5fd4ee0d694a47850161ed8a7", "docstring_summary": "Reads the information string for the OPC", "language": "python", "parameters": "(self)", "return_statement": "return ''.join(infostring)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x3F", "]", ")", "sleep", "(", "9e-3", ")", "for", "arg_2", "in", "range", "(", "60", ")", ":", "arg_3", "=", "arg_0", ".", "cnxn", ".", "xfer", "(", "[", "0x00", "]", ")", "[", "0", "]", "arg_1", ".", "append", "(", "chr", "(", "arg_3", ")", ")", "sleep", "(", "0.1", ")", "return", "''", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n        \"\"\"Reads the information string for the OPC\n\n        :rtype: string\n\n        :Example:\n\n        >>> alpha.Func()\n        'OPC-N2 FirmwareVer=OPC-018.2....................BD'\n        \"\"\"\n        arg_1 = []\n\n        # Send the command byte and sleep for 9 ms\n        arg_0.cnxn.xfer([0x3F])\n        sleep(9e-3)\n\n        # Read the info string by sending 60 empty bytes\n        for arg_2 in range(60):\n            arg_3 = arg_0.cnxn.xfer([0x00])[0]\n            arg_1.append(chr(arg_3))\n\n        sleep(0.1)\n\n        return ''.join(arg_1)", "path": "opc/__init__.py", "identifier": "_OPC.read_info_string", "docstring": "Reads the information string for the OPC\n\n        :rtype: string\n\n        :Example:\n\n        >>> alpha.read_info_string()\n        'OPC-N2 FirmwareVer=OPC-018.2....................BD'", "docstring_tokens": ["Reads", "the", "information", "string", "for", "the", "OPC"], "nwo": "dhhagan/py-opc", "score": 0.2904380171157967, "idx": 261136}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-mixedreality/azure/mgmt/mixedreality/mixed_reality_client.py#L90-L157", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Check Name Availability for global uniqueness.", "language": "python", "parameters": "(\n            self, location, name, type, custom_headers=None, raw=False, **operation_config)", "return_statement": "return deserialized", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ",", "**", "arg_6", ")", ":", "arg_7", "=", "models", ".", "CheckNameAvailabilityRequest", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_8", "=", "arg_0", ".", "Func", ".", "metadata", "[", "'url'", "]", "arg_9", "=", "{", "'subscriptionId'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"self.config.subscription_id\"", ",", "arg_0", ".", "config", ".", "subscription_id", ",", "'str'", ")", ",", "'location'", ":", "arg_0", ".", "_serialize", ".", "url", "(", "\"location\"", ",", "arg_1", ",", "'str'", ",", "max_length", "=", "90", ",", "min_length", "=", "1", ",", "pattern", "=", "r'^[-\\w\\._\\(\\)]+$'", ")", "}", "arg_8", "=", "arg_0", ".", "_client", ".", "format_url", "(", "arg_8", ",", "**", "arg_9", ")", "arg_10", "=", "{", "}", "arg_10", "[", "'api-version'", "]", "=", "arg_0", ".", "_serialize", ".", "query", "(", "\"self.api_version\"", ",", "arg_0", ".", "api_version", ",", "'str'", ")", "arg_11", "=", "{", "}", "arg_11", "[", "'Accept'", "]", "=", "'application/json'", "arg_11", "[", "'Content-Type'", "]", "=", "'application/json; charset=utf-8'", "if", "arg_0", ".", "config", ".", "generate_client_request_id", ":", "arg_11", "[", "'x-ms-client-request-id'", "]", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "arg_4", ":", "arg_11", ".", "update", "(", "arg_4", ")", "if", "arg_0", ".", "config", ".", "accept_language", "is", "not", "None", ":", "arg_11", "[", "'accept-language'", "]", "=", "arg_0", ".", "_serialize", ".", "header", "(", "\"self.config.accept_language\"", ",", "arg_0", ".", "config", ".", "accept_language", ",", "'str'", ")", "arg_12", "=", "arg_0", ".", "_serialize", ".", "body", "(", "arg_7", ",", "'CheckNameAvailabilityRequest'", ")", "arg_13", "=", "arg_0", ".", "_client", ".", "post", "(", "arg_8", ",", "arg_10", ",", "arg_11", ",", "arg_12", ")", "arg_14", "=", "arg_0", ".", "_client", ".", "send", "(", "arg_13", ",", "stream", "=", "False", ",", "**", "arg_6", ")", "if", "arg_14", ".", "status_code", "not", "in", "[", "200", "]", ":", "raise", "models", ".", "ErrorResponseException", "(", "arg_0", ".", "_deserialize", ",", "arg_14", ")", "arg_15", "=", "None", "if", "arg_14", ".", "status_code", "==", "200", ":", "arg_15", "=", "arg_0", ".", "_deserialize", "(", "'CheckNameAvailabilityResponse'", ",", "arg_14", ")", "if", "arg_5", ":", "arg_16", "=", "ClientRawResponse", "(", "arg_15", ",", "arg_14", ")", "return", "arg_16", "return", "arg_15"], "function": "def Func(\n            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=False, **arg_6):\n        \"\"\"Check Name Availability for global uniqueness.\n\n        :param location: The location in which uniqueness will be verified.\n        :type location: str\n        :param name: Resource Name To Verify\n        :type name: str\n        :param type: Fully qualified resource type which includes provider\n         namespace\n        :type type: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: CheckNameAvailabilityResponse or ClientRawResponse if\n         raw=true\n        :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse\n         or ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`\n        \"\"\"\n        arg_7 = models.CheckNameAvailabilityRequest(arg_2=arg_2, arg_3=arg_3)\n\n        # Construct URL\n        arg_8 = arg_0.Func.metadata['url']\n        arg_9 = {\n            'subscriptionId': arg_0._serialize.url(\"self.config.subscription_id\", arg_0.config.subscription_id, 'str'),\n            'location': arg_0._serialize.url(\"location\", arg_1, 'str', max_length=90, min_length=1, pattern=r'^[-\\w\\._\\(\\)]+$')\n        }\n        arg_8 = arg_0._client.format_url(arg_8, **arg_9)\n\n        # Construct parameters\n        arg_10 = {}\n        arg_10['api-version'] = arg_0._serialize.query(\"self.api_version\", arg_0.api_version, 'str')\n\n        # Construct headers\n        arg_11 = {}\n        arg_11['Accept'] = 'application/json'\n        arg_11['Content-Type'] = 'application/json; charset=utf-8'\n        if arg_0.config.generate_client_request_id:\n            arg_11['x-ms-client-request-id'] = str(uuid.uuid1())\n        if arg_4:\n            arg_11.update(arg_4)\n        if arg_0.config.accept_language is not None:\n            arg_11['accept-language'] = arg_0._serialize.header(\"self.config.accept_language\", arg_0.config.accept_language, 'str')\n\n        # Construct body\n        arg_12 = arg_0._serialize.body(arg_7, 'CheckNameAvailabilityRequest')\n\n        # Construct and send request\n        arg_13 = arg_0._client.post(arg_8, arg_10, arg_11, arg_12)\n        arg_14 = arg_0._client.send(arg_13, stream=False, **arg_6)\n\n        if arg_14.status_code not in [200]:\n            raise models.ErrorResponseException(arg_0._deserialize, arg_14)\n\n        arg_15 = None\n\n        if arg_14.status_code == 200:\n            arg_15 = arg_0._deserialize('CheckNameAvailabilityResponse', arg_14)\n\n        if arg_5:\n            arg_16 = ClientRawResponse(arg_15, arg_14)\n            return arg_16\n\n        return arg_15", "path": "azure-mgmt-mixedreality/azure/mgmt/mixedreality/mixed_reality_client.py", "identifier": "MixedRealityClient.check_name_availability_local", "docstring": "Check Name Availability for global uniqueness.\n\n        :param location: The location in which uniqueness will be verified.\n        :type location: str\n        :param name: Resource Name To Verify\n        :type name: str\n        :param type: Fully qualified resource type which includes provider\n         namespace\n        :type type: str\n        :param dict custom_headers: headers that will be added to the request\n        :param bool raw: returns the direct response alongside the\n         deserialized response\n        :param operation_config: :ref:`Operation configuration\n         overrides<msrest:optionsforoperations>`.\n        :return: CheckNameAvailabilityResponse or ClientRawResponse if\n         raw=true\n        :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse\n         or ~msrest.pipeline.ClientRawResponse\n        :raises:\n         :class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`", "docstring_tokens": ["Check", "Name", "Availability", "for", "global", "uniqueness", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 261137}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L431-L437", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "DDP method handler.", "language": "python", "parameters": "(self, method, params, id_, randomSeed=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ")", ":", "if", "arg_4", "is", "not", "None", ":", "arg_5", ".", "random_streams", ".", "random_seed", "=", "arg_4", "arg_5", ".", "alea_random", "=", "alea", ".", "Alea", "(", "arg_4", ")", "arg_0", ".", "api", ".", "method", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", "arg_0", ".", "reply", "(", "'updated'", ",", "methods", "=", "[", "arg_3", "]", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):\n        \"\"\"DDP method handler.\"\"\"\n        if arg_4 is not None:\n            arg_5.random_streams.random_seed = arg_4\n            arg_5.alea_random = alea.Alea(arg_4)\n        arg_0.api.method(arg_1, arg_2, arg_3)\n        arg_0.reply('updated', methods=[arg_3])", "path": "dddp/websocket.py", "identifier": "DDPWebSocketApplication.recv_method", "docstring": "DDP method handler.", "docstring_tokens": ["DDP", "method", "handler", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 261138}
{"url": "https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L285-L328", "sha": "a92a23d6b5869663b2bc1ccf78bb11585076a9c4", "docstring_summary": "Full-duplex SPI read and write.  If assert_ss is true, the SS line\n        will be asserted low, the specified bytes will be clocked out the MOSI\n        line while bytes will also be read from the MISO line, and if\n        deassert_ss is true the SS line will be put back high.  Bytes which are\n        read will be returned as a bytearray object.", "language": "python", "parameters": "(self, data, assert_ss=True, deassert_ss=True)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "True", ",", "arg_3", "=", "True", ")", ":", "if", "arg_0", ".", "_mosi", "is", "None", ":", "raise", "RuntimeError", "(", "'Write attempted with no MOSI pin specified.'", ")", "if", "arg_0", ".", "_miso", "is", "None", ":", "raise", "RuntimeError", "(", "'Read attempted with no MISO pin specified.'", ")", "if", "arg_2", "and", "arg_0", ".", "_ss", "is", "not", "None", ":", "arg_0", ".", "_gpio", ".", "set_low", "(", "arg_0", ".", "_ss", ")", "arg_4", "=", "bytearray", "(", "len", "(", "arg_1", ")", ")", "for", "arg_5", "in", "range", "(", "len", "(", "arg_1", ")", ")", ":", "for", "arg_6", "in", "range", "(", "8", ")", ":", "if", "arg_0", ".", "_write_shift", "(", "arg_1", "[", "arg_5", "]", ",", "arg_6", ")", "&", "arg_0", ".", "_mask", ":", "arg_0", ".", "_gpio", ".", "set_high", "(", "arg_0", ".", "_mosi", ")", "else", ":", "arg_0", ".", "_gpio", ".", "set_low", "(", "arg_0", ".", "_mosi", ")", "arg_0", ".", "_gpio", ".", "output", "(", "arg_0", ".", "_sclk", ",", "not", "arg_0", ".", "_clock_base", ")", "if", "arg_0", ".", "_read_leading", ":", "if", "arg_0", ".", "_gpio", ".", "is_high", "(", "arg_0", ".", "_miso", ")", ":", "arg_4", "[", "arg_5", "]", "|=", "arg_0", ".", "_read_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "else", ":", "arg_4", "[", "arg_5", "]", "&=", "~", "arg_0", ".", "_read_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "arg_0", ".", "_gpio", ".", "output", "(", "arg_0", ".", "_sclk", ",", "arg_0", ".", "_clock_base", ")", "if", "not", "arg_0", ".", "_read_leading", ":", "if", "arg_0", ".", "_gpio", ".", "is_high", "(", "arg_0", ".", "_miso", ")", ":", "arg_4", "[", "arg_5", "]", "|=", "arg_0", ".", "_read_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "else", ":", "arg_4", "[", "arg_5", "]", "&=", "~", "arg_0", ".", "_read_shift", "(", "arg_0", ".", "_mask", ",", "arg_6", ")", "if", "arg_3", "and", "arg_0", ".", "_ss", "is", "not", "None", ":", "arg_0", ".", "_gpio", ".", "set_high", "(", "arg_0", ".", "_ss", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=True, arg_3=True):\n        \"\"\"Full-duplex SPI read and write.  If assert_ss is true, the SS line\n        will be asserted low, the specified bytes will be clocked out the MOSI\n        line while bytes will also be read from the MISO line, and if\n        deassert_ss is true the SS line will be put back high.  Bytes which are\n        read will be returned as a bytearray object.\n        \"\"\"\n        if arg_0._mosi is None:\n            raise RuntimeError('Write attempted with no MOSI pin specified.')\n        if arg_0._miso is None:\n            raise RuntimeError('Read attempted with no MISO pin specified.')\n        if arg_2 and arg_0._ss is not None:\n            arg_0._gpio.set_low(arg_0._ss)\n        arg_4 = bytearray(len(arg_1))\n        for arg_5 in range(len(arg_1)):\n            for arg_6 in range(8):\n                # Write bit to MOSI.\n                if arg_0._write_shift(arg_1[arg_5], arg_6) & arg_0._mask:\n                    arg_0._gpio.set_high(arg_0._mosi)\n                else:\n                    arg_0._gpio.set_low(arg_0._mosi)\n                # Flip clock off base.\n                arg_0._gpio.output(arg_0._sclk, not arg_0._clock_base)\n                # Handle read on leading edge of clock.\n                if arg_0._read_leading:\n                    if arg_0._gpio.is_high(arg_0._miso):\n                        # Set bit to 1 at appropriate location.\n                        arg_4[arg_5] |= arg_0._read_shift(arg_0._mask, arg_6)\n                    else:\n                        # Set bit to 0 at appropriate location.\n                        arg_4[arg_5] &= ~arg_0._read_shift(arg_0._mask, arg_6)\n                # Return clock to base.\n                arg_0._gpio.output(arg_0._sclk, arg_0._clock_base)\n                # Handle read on trailing edge of clock.\n                if not arg_0._read_leading:\n                    if arg_0._gpio.is_high(arg_0._miso):\n                        # Set bit to 1 at appropriate location.\n                        arg_4[arg_5] |= arg_0._read_shift(arg_0._mask, arg_6)\n                    else:\n                        # Set bit to 0 at appropriate location.\n                        arg_4[arg_5] &= ~arg_0._read_shift(arg_0._mask, arg_6)\n        if arg_3 and arg_0._ss is not None:\n            arg_0._gpio.set_high(arg_0._ss)\n        return arg_4", "path": "Adafruit_GPIO/SPI.py", "identifier": "BitBang.transfer", "docstring": "Full-duplex SPI read and write.  If assert_ss is true, the SS line\n        will be asserted low, the specified bytes will be clocked out the MOSI\n        line while bytes will also be read from the MISO line, and if\n        deassert_ss is true the SS line will be put back high.  Bytes which are\n        read will be returned as a bytearray object.", "docstring_tokens": ["Full", "-", "duplex", "SPI", "read", "and", "write", ".", "If", "assert_ss", "is", "true", "the", "SS", "line", "will", "be", "asserted", "low", "the", "specified", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "while", "bytes", "will", "also", "be", "read", "from", "the", "MISO", "line", "and", "if", "deassert_ss", "is", "true", "the", "SS", "line", "will", "be", "put", "back", "high", ".", "Bytes", "which", "are", "read", "will", "be", "returned", "as", "a", "bytearray", "object", "."], "nwo": "adafruit/Adafruit_Python_GPIO", "score": 0.7815748574082514, "idx": 261139}
{"url": "https://github.com/textbook/aslack/blob/9ac6a44e4464180109fa4be130ad7a980a9d1acc/aslack/slack_bot/bot.py#L231-L245", "sha": "9ac6a44e4464180109fa4be130ad7a980a9d1acc", "docstring_summary": "Respond to a message on the current socket.", "language": "python", "parameters": "(self, channel, text)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_format_message", "(", "arg_1", ",", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "logger", ".", "info", "(", "'Sending message: %r'", ",", "truncate", "(", "arg_3", ",", "max_len", "=", "50", ")", ",", ")", "arg_0", ".", "socket", ".", "send_str", "(", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Respond to a message on the current socket.\n\n        Args:\n          channel (:py:class:`str`): The channel to send to.\n          text (:py:class:`str`): The message text to send.\n\n        \"\"\"\n        arg_3 = arg_0._format_message(arg_1, arg_2)\n        if arg_3 is not None:\n            logger.info(\n                'Sending message: %r',\n                truncate(arg_3, max_len=50),\n            )\n        arg_0.socket.send_str(arg_3)", "path": "aslack/slack_bot/bot.py", "identifier": "SlackBot._respond", "docstring": "Respond to a message on the current socket.\n\n        Args:\n          channel (:py:class:`str`): The channel to send to.\n          text (:py:class:`str`): The message text to send.", "docstring_tokens": ["Respond", "to", "a", "message", "on", "the", "current", "socket", "."], "nwo": "textbook/aslack", "score": 0.18261785916548806, "idx": 261140}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pkginfo/commandline.py#L184-L204", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Entry point for pkginfo tool", "language": "python", "parameters": "(args=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "arg_1", ",", "arg_2", "=", "_parse_options", "(", "arg_0", ")", "arg_3", "=", "getattr", "(", "arg_1", ",", "'output'", ",", "'simple'", ")", "arg_4", "=", "_FORMATTERS", "[", "arg_3", "]", "(", "arg_1", ")", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "get_metadata", "(", "arg_5", ",", "arg_1", ".", "metadata_version", ")", "if", "arg_6", "is", "None", ":", "continue", "if", "arg_1", ".", "download_url_prefix", ":", "if", "arg_6", ".", "download_url", "is", "None", ":", "arg_7", "=", "os", ".", "path", ".", "basename", "(", "arg_5", ")", "arg_6", ".", "download_url", "=", "'%s/%s'", "%", "(", "arg_1", ".", "download_url_prefix", ",", "arg_7", ")", "arg_4", "(", "arg_6", ")", "arg_4", ".", "finish", "(", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Entry point for pkginfo tool\n    \"\"\"\n    arg_1, arg_2 = _parse_options(arg_0)\n    arg_3 = getattr(arg_1, 'output', 'simple')\n    arg_4 = _FORMATTERS[arg_3](arg_1)\n\n    for arg_5 in arg_2:\n        arg_6 = get_metadata(arg_5, arg_1.metadata_version)\n        if arg_6 is None:\n            continue\n\n        if arg_1.download_url_prefix:\n            if arg_6.download_url is None:\n                arg_7 = os.path.basename(arg_5)\n                arg_6.download_url = '%s/%s' % (arg_1.download_url_prefix,\n                                               arg_7)\n\n        arg_4(arg_6)\n\n    arg_4.finish()", "path": "virtualEnvironment/lib/python2.7/site-packages/pkginfo/commandline.py", "identifier": "main", "docstring": "Entry point for pkginfo tool", "docstring_tokens": ["Entry", "point", "for", "pkginfo", "tool"], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 261141}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L1247-L1272", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Load the positions of an image.", "language": "python", "parameters": "(positions_path)", "return_statement": "return positions", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "with", "open", "(", "arg_0", ")", "as", "f", ":", "arg_1", "=", "f", ".", "readlines", "(", ")", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_4", "=", "ast", ".", "literal_eval", "(", "arg_3", ")", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Load the positions of an image.\n\n    Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \\\n    multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \\\n    one another are resampled during the non-linear search.\n\n    Positions are stored in a .dat file, where each line of the file gives a list of list of (y,x) positions which \\\n    correspond to the same region of the source-plane. Thus, multiple source-plane regions can be input over multiple \\\n    lines of the same positions file.\n\n    Parameters\n    ----------\n    positions_path : str\n        The path to the positions .dat file containing the positions (e.g. '/path/to/positions.dat')\n    \"\"\"\n    with open(arg_0) as f:\n        arg_1 = f.readlines()\n\n    arg_2 = []\n\n    for arg_3 in arg_1:\n        arg_4 = ast.literal_eval(arg_3)\n        arg_2.append(arg_4)\n\n    return arg_2", "path": "autolens/data/ccd.py", "identifier": "load_positions", "docstring": "Load the positions of an image.\n\n    Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \\\n    multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \\\n    one another are resampled during the non-linear search.\n\n    Positions are stored in a .dat file, where each line of the file gives a list of list of (y,x) positions which \\\n    correspond to the same region of the source-plane. Thus, multiple source-plane regions can be input over multiple \\\n    lines of the same positions file.\n\n    Parameters\n    ----------\n    positions_path : str\n        The path to the positions .dat file containing the positions (e.g. '/path/to/positions.dat')", "docstring_tokens": ["Load", "the", "positions", "of", "an", "image", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 261142}
{"url": "https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L97-L117", "sha": "8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06", "docstring_summary": "private function to handle reading of the points record parts\n        of the las file.", "language": "python", "parameters": "(self, vlrs)", "return_statement": "return points", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "try", ":", "arg_2", "=", "arg_1", ".", "get", "(", "\"ExtraBytesVlr\"", ")", "[", "0", "]", ".", "type_of_extra_dims", "(", ")", "except", "IndexError", ":", "arg_2", "=", "None", "arg_3", "=", "PointFormat", "(", "arg_0", ".", "header", ".", "point_format_id", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "header", ".", "are_points_compressed", ":", "arg_4", "=", "arg_1", ".", "pop", "(", "arg_1", ".", "index", "(", "\"LasZipVlr\"", ")", ")", "arg_5", "=", "arg_0", ".", "_read_compressed_points_data", "(", "arg_4", ",", "arg_3", ")", "else", ":", "arg_5", "=", "record", ".", "PackedPointRecord", ".", "from_stream", "(", "arg_0", ".", "stream", ",", "arg_3", ",", "arg_0", ".", "header", ".", "point_count", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1):\n        \"\"\" private function to handle reading of the points record parts\n        of the las file.\n\n        the header is needed for the point format and number of points\n        the vlrs are need to get the potential laszip vlr as well as the extra bytes vlr\n        \"\"\"\n        try:\n            arg_2 = arg_1.get(\"ExtraBytesVlr\")[0].type_of_extra_dims()\n        except IndexError:\n            arg_2 = None\n\n        arg_3 = PointFormat(arg_0.header.point_format_id, arg_2=arg_2)\n        if arg_0.header.are_points_compressed:\n            arg_4 = arg_1.pop(arg_1.index(\"LasZipVlr\"))\n            arg_5 = arg_0._read_compressed_points_data(arg_4, arg_3)\n        else:\n            arg_5 = record.PackedPointRecord.from_stream(\n                arg_0.stream, arg_3, arg_0.header.point_count\n            )\n        return arg_5", "path": "pylas/lasreader.py", "identifier": "LasReader._read_points", "docstring": "private function to handle reading of the points record parts\n        of the las file.\n\n        the header is needed for the point format and number of points\n        the vlrs are need to get the potential laszip vlr as well as the extra bytes vlr", "docstring_tokens": ["private", "function", "to", "handle", "reading", "of", "the", "points", "record", "parts", "of", "the", "las", "file", "."], "nwo": "tmontaigu/pylas", "score": 0.6835733806313566, "idx": 261143}
{"url": "https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L425-L446", "sha": "ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14", "docstring_summary": "Parse documentclass options.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "LatexCommand", "(", "'documentclass'", ",", "{", "'name'", ":", "'options'", ",", "'required'", ":", "False", ",", "'bracket'", ":", "'['", "}", ",", "{", "'name'", ":", "'class_name'", ",", "'required'", ":", "True", ",", "'bracket'", ":", "'{'", "}", ")", "try", ":", "arg_2", "=", "next", "(", "arg_1", ".", "parse", "(", "arg_0", ".", "_tex", ")", ")", "except", "StopIteration", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'lsstdoc has no documentclass'", ")", "arg_0", ".", "_document_options", "=", "[", "]", "try", ":", "arg_4", "=", "arg_2", "[", "'options'", "]", "arg_0", ".", "_document_options", "=", "[", "opt", ".", "strip", "(", ")", "for", "opt", "in", "arg_4", ".", "split", "(", "','", ")", "]", "except", "KeyError", ":", "arg_0", ".", "_logger", ".", "warning", "(", "'lsstdoc has no documentclass options'", ")", "arg_0", ".", "_document_options", "=", "[", "]"], "function": "def Func(arg_0):\n        \"\"\"Parse documentclass options.\n\n        Sets the the ``_document_options`` attribute.\n        \"\"\"\n        arg_1 = LatexCommand(\n            'documentclass',\n            {'name': 'options', 'required': False, 'bracket': '['},\n            {'name': 'class_name', 'required': True, 'bracket': '{'})\n        try:\n            arg_2 = next(arg_1.parse(arg_0._tex))\n        except StopIteration:\n            arg_0._logger.warning('lsstdoc has no documentclass')\n            arg_0._document_options = []\n\n        try:\n            arg_4 = arg_2['options']\n            arg_0._document_options = [opt.strip()\n                                      for opt in arg_4.split(',')]\n        except KeyError:\n            arg_0._logger.warning('lsstdoc has no documentclass options')\n            arg_0._document_options = []", "path": "lsstprojectmeta/tex/lsstdoc.py", "identifier": "LsstLatexDoc._parse_documentclass", "docstring": "Parse documentclass options.\n\n        Sets the the ``_document_options`` attribute.", "docstring_tokens": ["Parse", "documentclass", "options", "."], "nwo": "lsst-sqre/lsst-projectmeta-kit", "score": 0.138843686048881, "idx": 261144}
{"url": "https://github.com/cdriehuys/django-rest-email-auth/blob/7e752c4d77ae02d2d046f214f56e743aa12ab23f/rest_email_auth/serializers.py#L117-L139", "sha": "7e752c4d77ae02d2d046f214f56e743aa12ab23f", "docstring_summary": "Validate the provided 'is_primary' parameter.", "language": "python", "parameters": "(self, is_primary)", "return_statement": "return is_primary", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "and", "not", "(", "arg_0", ".", "instance", "and", "arg_0", ".", "instance", ".", "is_verified", ")", ":", "raise", "serializers", ".", "ValidationError", "(", "_", "(", "\"Unverified email addresses may not be used as the \"", "\"primary address.\"", ")", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Validate the provided 'is_primary' parameter.\n\n        Returns:\n            The validated 'is_primary' value.\n\n        Raises:\n            serializers.ValidationError:\n                If the user attempted to mark an unverified email as\n                their primary email address.\n        \"\"\"\n        # TODO: Setting 'is_primary' to 'False' should probably not be\n        #       allowed.\n        if arg_1 and not (arg_0.instance and arg_0.instance.is_verified):\n            raise serializers.ValidationError(\n                _(\n                    \"Unverified email addresses may not be used as the \"\n                    \"primary address.\"\n                )\n            )\n\n        return arg_1", "path": "rest_email_auth/serializers.py", "identifier": "EmailSerializer.validate_is_primary", "docstring": "Validate the provided 'is_primary' parameter.\n\n        Returns:\n            The validated 'is_primary' value.\n\n        Raises:\n            serializers.ValidationError:\n                If the user attempted to mark an unverified email as\n                their primary email address.", "docstring_tokens": ["Validate", "the", "provided", "is_primary", "parameter", "."], "nwo": "cdriehuys/django-rest-email-auth", "score": 0.28490879858232004, "idx": 261145}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L582-L618", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns RGB values based on a descriptive string.", "language": "python", "parameters": "(self, str)", "return_statement": "return named_colors[\"transparent\"]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "arg_1", ".", "lower", "(", ")", "for", "arg_2", "in", "\"_- \"", ":", "arg_1", "=", "arg_1", ".", "replace", "(", "arg_2", ",", "\"\"", ")", "if", "named_colors", ".", "has_key", "(", "arg_1", ")", ":", "return", "named_colors", "[", "arg_1", "]", "for", "arg_3", "in", "[", "\"ish\"", ",", "\"ed\"", ",", "\"y\"", ",", "\"like\"", "]", ":", "arg_1", "=", "re", ".", "sub", "(", "\"(.*?)\"", "+", "arg_3", "+", "\"$\"", ",", "\"\\\\1\"", ",", "arg_1", ")", "arg_1", "=", "re", ".", "sub", "(", "\"(.*?)dd$\"", ",", "\"\\\\1d\"", ",", "arg_1", ")", "arg_4", "=", "[", "]", "for", "arg_5", "in", "named_colors", ":", "if", "arg_5", "in", "arg_1", "or", "arg_1", "in", "arg_5", ":", "arg_4", ".", "append", "(", "named_colors", "[", "arg_5", "]", ")", "if", "len", "(", "arg_4", ")", ">", "0", ":", "return", "choice", "(", "arg_4", ")", "return", "named_colors", "[", "\"transparent\"", "]"], "function": "def Func(arg_0, arg_1):\n\n        \"\"\" Returns RGB values based on a descriptive string.\n\n        If the given str is a named color, return its RGB values.\n        Otherwise, return a random named color that has str\n        in its name, or a random named color which name appears in str.\n\n        Specific suffixes (-ish, -ed, -y and -like) are recognised\n        as well, for example, if you need a random variation of \"red\"\n        you can use reddish (or greenish, yellowy, etc.)\n\n        \"\"\"\n\n        arg_1 = arg_1.lower()\n        for arg_2 in \"_- \":\n            arg_1 = arg_1.replace(arg_2, \"\")\n\n        # if named_hues.has_key(str):\n        #    clr = color(named_hues[str], 1, 1, mode=\"hsb\")\n        #    return clr.r, clr.g, clr.b\n\n        if named_colors.has_key(arg_1):\n            return named_colors[arg_1]\n\n        for arg_3 in [\"ish\", \"ed\", \"y\", \"like\"]:\n            arg_1 = re.sub(\"(.*?)\" + arg_3 + \"$\", \"\\\\1\", arg_1)\n        arg_1 = re.sub(\"(.*?)dd$\", \"\\\\1d\", arg_1)\n\n        arg_4 = []\n        for arg_5 in named_colors:\n            if arg_5 in arg_1 or arg_1 in arg_5:\n                arg_4.append(named_colors[arg_5])\n        if len(arg_4) > 0:\n            return choice(arg_4)\n\n        return named_colors[\"transparent\"]", "path": "lib/colors/__init__.py", "identifier": "Color.str_to_rgb", "docstring": "Returns RGB values based on a descriptive string.\n\n        If the given str is a named color, return its RGB values.\n        Otherwise, return a random named color that has str\n        in its name, or a random named color which name appears in str.\n\n        Specific suffixes (-ish, -ed, -y and -like) are recognised\n        as well, for example, if you need a random variation of \"red\"\n        you can use reddish (or greenish, yellowy, etc.)", "docstring_tokens": ["Returns", "RGB", "values", "based", "on", "a", "descriptive", "string", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 261146}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L1034-L1053", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Updates the current set of parameter values and previous values,\n        sets a flag to re-calculate J.", "language": "python", "parameters": "(self, new_vals, incremental=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_0", ".", "_last_vals", "=", "arg_0", ".", "param_vals", ".", "copy", "(", ")", "if", "arg_2", ":", "arg_0", ".", "param_vals", "+=", "arg_1", "else", ":", "arg_0", ".", "param_vals", "=", "arg_1", ".", "copy", "(", ")", "arg_0", ".", "_fresh_JTJ", "=", "False"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Updates the current set of parameter values and previous values,\n        sets a flag to re-calculate J.\n\n        Parameters\n        ----------\n            new_vals : numpy.ndarray\n                The new values to update to\n            incremental : Bool, optional\n                Set to True to make it an incremental update relative\n                to the old parameters. Default is False\n        \"\"\"\n        arg_0._last_vals = arg_0.param_vals.copy()\n        if arg_2:\n            arg_0.param_vals += arg_1\n        else:\n            arg_0.param_vals = arg_1.copy()\n        #And we've updated, so JTJ is no longer valid:\n        arg_0._fresh_JTJ = False", "path": "peri/opt/optimize.py", "identifier": "LMEngine.update_param_vals", "docstring": "Updates the current set of parameter values and previous values,\n        sets a flag to re-calculate J.\n\n        Parameters\n        ----------\n            new_vals : numpy.ndarray\n                The new values to update to\n            incremental : Bool, optional\n                Set to True to make it an incremental update relative\n                to the old parameters. Default is False", "docstring_tokens": ["Updates", "the", "current", "set", "of", "parameter", "values", "and", "previous", "values", "sets", "a", "flag", "to", "re", "-", "calculate", "J", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 261147}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Droplet.py#L619-L639", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "Get a list of kernels available", "language": "python", "parameters": "(self)", "return_statement": "return kernels", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "list", "(", ")", "arg_2", "=", "arg_0", ".", "get_data", "(", "\"droplets/%s/kernels/\"", "%", "arg_0", ".", "id", ")", "while", "True", ":", "for", "arg_3", "in", "arg_2", "[", "u'kernels'", "]", ":", "arg_4", "=", "Kernel", "(", "**", "arg_3", ")", "arg_4", ".", "token", "=", "arg_0", ".", "token", "arg_1", ".", "append", "(", "arg_4", ")", "try", ":", "arg_6", "=", "arg_2", "[", "u'links'", "]", "[", "u'pages'", "]", ".", "get", "(", "u'next'", ")", "if", "not", "arg_6", ":", "break", "arg_2", "=", "arg_0", ".", "get_data", "(", "arg_6", ")", "except", "KeyError", ":", "break", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n            Get a list of kernels available\n        \"\"\"\n\n        arg_1 = list()\n        arg_2 = arg_0.get_data(\"droplets/%s/kernels/\" % arg_0.id)\n        while True:\n            for arg_3 in arg_2[u'kernels']:\n                arg_4 = Kernel(**arg_3)\n                arg_4.token = arg_0.token\n                arg_1.append(arg_4)\n            try:\n                arg_6 = arg_2[u'links'][u'pages'].get(u'next')\n                if not arg_6:\n                        break\n                arg_2 = arg_0.get_data(arg_6)\n            except KeyError:  # No links.\n                break\n\n        return arg_1", "path": "digitalocean/Droplet.py", "identifier": "Droplet.get_kernel_available", "docstring": "Get a list of kernels available", "docstring_tokens": ["Get", "a", "list", "of", "kernels", "available"], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 261148}
{"url": "https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L138-L143", "sha": "443ce31daa6023dc2fd65ef2051796e19d18d5a7", "docstring_summary": "Return True if we should retry, False otherwise.", "language": "python", "parameters": "(exception)", "return_statement": "return isinstance(exception, oauth2client.client.AccessTokenRefreshError)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "'%Y-%m-%d %H:%M:%S.%f'", ")", "print_error", "(", "'%s: Exception %s: %s'", "%", "(", "arg_1", ",", "type", "(", "arg_0", ")", ".", "__name__", ",", "str", "(", "arg_0", ")", ")", ")", "return", "isinstance", "(", "arg_0", ",", "oauth2client", ".", "client", ".", "AccessTokenRefreshError", ")"], "function": "def Func(arg_0):\n  \"\"\"Return True if we should retry, False otherwise.\"\"\"\n  arg_1 = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')\n  print_error(\n      '%s: Exception %s: %s' % (arg_1, type(arg_0).__name__, str(arg_0)))\n  return isinstance(arg_0, oauth2client.client.AccessTokenRefreshError)", "path": "dsub/lib/dsub_util.py", "identifier": "_retry_storage_check", "docstring": "Return True if we should retry, False otherwise.", "docstring_tokens": ["Return", "True", "if", "we", "should", "retry", "False", "otherwise", "."], "nwo": "DataBiosphere/dsub", "score": 0.5786746797032198, "idx": 261149}
{"url": "https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_spinn3r_feed_storage.py#L226-L240", "sha": "8bb82ea1beb83c6b40ed03fa1659df2897c2292a", "docstring_summary": "Given a spinn3r feed, produce a sequence of valid StreamItems.", "language": "python", "parameters": "(f)", "return_statement": "return itertools.ifilter(\n        lambda x: x is not None,\n        itertools.imap(_make_stream_item, reader))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "ProtoStreamReader", "(", "arg_0", ")", "return", "itertools", ".", "ifilter", "(", "lambda", "x", ":", "x", "is", "not", "None", ",", "itertools", ".", "imap", "(", "_make_stream_item", ",", "arg_1", ")", ")"], "function": "def Func(arg_0):\n    \"\"\"Given a spinn3r feed, produce a sequence of valid StreamItems.\n\n    Because of goopy Python interactions, you probably need to call\n    this and re-yield its results, as\n\n    >>> with open(filename, 'rb') as f:\n    ...   for si in Func(f):\n    ...     yield si\n\n    \"\"\"\n    arg_1 = ProtoStreamReader(arg_0)\n    return itertools.ifilter(\n        lambda x: x is not None,\n        itertools.imap(_make_stream_item, arg_1))", "path": "streamcorpus_pipeline/_spinn3r_feed_storage.py", "identifier": "_make_stream_items", "docstring": "Given a spinn3r feed, produce a sequence of valid StreamItems.\n\n    Because of goopy Python interactions, you probably need to call\n    this and re-yield its results, as\n\n    >>> with open(filename, 'rb') as f:\n    ...   for si in _make_stream_items(f):\n    ...     yield si", "docstring_tokens": ["Given", "a", "spinn3r", "feed", "produce", "a", "sequence", "of", "valid", "StreamItems", "."], "nwo": "trec-kba/streamcorpus-pipeline", "score": 0.16638194949711382, "idx": 261150}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L268-L275", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Prefilter a line that has been converted to a LineInfo object.", "language": "python", "parameters": "(self, line_info)", "return_statement": "return handler.handle(line_info)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "find_handler", "(", "arg_1", ")", "return", "arg_2", ".", "handle", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Prefilter a line that has been converted to a LineInfo object.\n\n        This implements the checker/handler part of the prefilter pipe.\n        \"\"\"\n        # print \"Func: \", line_info\n        arg_2 = arg_0.find_handler(arg_1)\n        return arg_2.handle(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/core/prefilter.py", "identifier": "PrefilterManager.prefilter_line_info", "docstring": "Prefilter a line that has been converted to a LineInfo object.\n\n        This implements the checker/handler part of the prefilter pipe.", "docstring_tokens": ["Prefilter", "a", "line", "that", "has", "been", "converted", "to", "a", "LineInfo", "object", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261151}
{"url": "https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L145-L158", "sha": "85c0bf0a57698d077461283895707260f9dbf931", "docstring_summary": "Get cached refresh token.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "info", "(", "'Loading refresh_token from %s'", ",", "repr", "(", "arg_0", ".", "_filename", ")", ")", "try", ":", "with", "open", "(", "arg_0", ".", "_filename", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")", "except", "IOError", "as", "e", ":", "logger", ".", "info", "(", "'Failed to load refresh_token: %s'", ",", "e", ")"], "function": "def Func(arg_0):\n        \"\"\"Get cached refresh token.\n\n        Returns:\n            Cached refresh token, or ``None`` on failure.\n        \"\"\"\n        logger.info(\n            'Loading refresh_token from %s', repr(arg_0._filename)\n        )\n        try:\n            with open(arg_0._filename) as f:\n                return f.read()\n        except IOError as e:\n            logger.info('Failed to load refresh_token: %s', e)", "path": "hangups/auth.py", "identifier": "RefreshTokenCache.get", "docstring": "Get cached refresh token.\n\n        Returns:\n            Cached refresh token, or ``None`` on failure.", "docstring_tokens": ["Get", "cached", "refresh", "token", "."], "nwo": "tdryer/hangups", "score": 0.7463257586360665, "idx": 261152}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/publishsettings.py#L23-L77", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Writes a certificate file to the specified location.  This can then be used \n    to instantiate ServiceManagementService.  Returns the subscription ID.", "language": "python", "parameters": "(publish_settings_path, path_to_write_certificate, subscription_id=None)", "return_statement": "return subscription.get('Id')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "import", "base64", "try", ":", "from", "xml", ".", "etree", "import", "cElementTree", "as", "ET", "except", "ImportError", ":", "from", "xml", ".", "etree", "import", "ElementTree", "as", "ET", "try", ":", "import", "OpenSSL", ".", "crypto", "as", "crypto", "except", ":", "raise", "Exception", "(", "\"pyopenssl is required to use Func\"", ")", "_validate_not_none", "(", "'publish_settings_path'", ",", "arg_0", ")", "_validate_not_none", "(", "'path_to_write_certificate'", ",", "arg_1", ")", "arg_3", "=", "ET", ".", "parse", "(", "arg_0", ")", "arg_4", "=", "arg_3", ".", "getroot", "(", ")", ".", "findall", "(", "\"./PublishProfile/Subscription\"", ")", "if", "arg_2", ":", "arg_5", "=", "next", "(", "(", "s", "for", "s", "in", "arg_4", "if", "s", ".", "get", "(", "'Id'", ")", ".", "lower", "(", ")", "==", "arg_2", ".", "lower", "(", ")", ")", ",", "None", ")", "else", ":", "arg_5", "=", "arg_4", "[", "0", "]", "if", "arg_5", "is", "None", ":", "raise", "ValueError", "(", "\"The provided subscription_id '{}' was not found in the publish settings file provided at '{}'\"", ".", "format", "(", "arg_2", ",", "arg_0", ")", ")", "arg_6", "=", "_decode_base64_to_bytes", "(", "arg_5", ".", "get", "(", "'ManagementCertificate'", ")", ")", "arg_7", "=", "crypto", ".", "load_pkcs12", "(", "arg_6", ",", "b''", ")", "with", "open", "(", "arg_1", ",", "'wb'", ")", "as", "f", ":", "f", ".", "write", "(", "crypto", ".", "dump_certificate", "(", "crypto", ".", "FILETYPE_PEM", ",", "arg_7", ".", "get_certificate", "(", ")", ")", ")", "f", ".", "write", "(", "crypto", ".", "dump_privatekey", "(", "crypto", ".", "FILETYPE_PEM", ",", "arg_7", ".", "get_privatekey", "(", ")", ")", ")", "return", "arg_5", ".", "get", "(", "'Id'", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n    '''\n    Writes a certificate file to the specified location.  This can then be used \n    to instantiate ServiceManagementService.  Returns the subscription ID.\n\n    publish_settings_path: \n        Path to subscription file downloaded from \n        http://go.microsoft.com/fwlink/?LinkID=301775\n    path_to_write_certificate:\n        Path to write the certificate file.\n    subscription_id:\n        (optional)  Provide a subscription id here if you wish to use a \n        specific subscription under the publish settings file.\n    '''\n    import base64\n\n    try:\n        from xml.etree import cElementTree as ET\n    except ImportError:\n        from xml.etree import ElementTree as ET\n\n    try:\n        import OpenSSL.crypto as crypto\n    except:\n        raise Exception(\"pyopenssl is required to use Func\")\n\n    _validate_not_none('publish_settings_path', arg_0)\n    _validate_not_none('path_to_write_certificate', arg_1)\n\n    # parse the publishsettings file and find the ManagementCertificate Entry\n    arg_3 = ET.parse(arg_0)\n    arg_4 = arg_3.getroot().findall(\"./PublishProfile/Subscription\")\n    \n    # Default to the first subscription in the file if they don't specify\n    # or get the matching subscription or return none.\n    if arg_2:\n        arg_5 = next((s for s in arg_4 if s.get('Id').lower() == arg_2.lower()), None)\n    else:\n        arg_5 = arg_4[0]\n\n    # validate that subscription was found\n    if arg_5 is None:\n        raise ValueError(\"The provided subscription_id '{}' was not found in the publish settings file provided at '{}'\".format(arg_2, arg_0))\n\n    arg_6 = _decode_base64_to_bytes(arg_5.get('ManagementCertificate'))\n\n    # Load the string in pkcs12 format.  Don't provide a password as it isn't encrypted.\n    arg_7 = crypto.load_pkcs12(arg_6, b'') \n\n    # Write the data out as a PEM format to a random location in temp for use under this run.\n    with open(arg_1, 'wb') as f:\n        f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, arg_7.get_certificate()))\n        f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, arg_7.get_privatekey()))\n\n    return arg_5.get('Id')", "path": "azure-servicemanagement-legacy/azure/servicemanagement/publishsettings.py", "identifier": "get_certificate_from_publish_settings", "docstring": "Writes a certificate file to the specified location.  This can then be used \n    to instantiate ServiceManagementService.  Returns the subscription ID.\n\n    publish_settings_path: \n        Path to subscription file downloaded from \n        http://go.microsoft.com/fwlink/?LinkID=301775\n    path_to_write_certificate:\n        Path to write the certificate file.\n    subscription_id:\n        (optional)  Provide a subscription id here if you wish to use a \n        specific subscription under the publish settings file.", "docstring_tokens": ["Writes", "a", "certificate", "file", "to", "the", "specified", "location", ".", "This", "can", "then", "be", "used", "to", "instantiate", "ServiceManagementService", ".", "Returns", "the", "subscription", "ID", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 261153}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L216-L219", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Unregister a checker instance.", "language": "python", "parameters": "(self, checker)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "in", "arg_0", ".", "_checkers", ":", "arg_0", ".", "_checkers", ".", "remove", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Unregister a checker instance.\"\"\"\n        if arg_1 in arg_0._checkers:\n            arg_0._checkers.remove(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/core/prefilter.py", "identifier": "PrefilterManager.unregister_checker", "docstring": "Unregister a checker instance.", "docstring_tokens": ["Unregister", "a", "checker", "instance", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261154}
{"url": "https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/internal/well_known_types.py#L384-L388", "sha": "3616845fb91459aacd8df6bf82c5d91f4542bee7", "docstring_summary": "Converts string to FieldMask according to proto3 JSON spec.", "language": "python", "parameters": "(self, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "Clear", "(", ")", "for", "arg_2", "in", "arg_1", ".", "split", "(", "','", ")", ":", "arg_0", ".", "paths", ".", "append", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Converts string to FieldMask according to proto3 JSON spec.\"\"\"\n    arg_0.Clear()\n    for arg_2 in arg_1.split(','):\n      arg_0.paths.append(arg_2)", "path": "typy/google/protobuf/internal/well_known_types.py", "identifier": "FieldMask.FromJsonString", "docstring": "Converts string to FieldMask according to proto3 JSON spec.", "docstring_tokens": ["Converts", "string", "to", "FieldMask", "according", "to", "proto3", "JSON", "spec", "."], "nwo": "ibelie/typy", "score": 0.0, "idx": 261155}
{"url": "https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L255-L320", "sha": "673e9ec1391e3b14d3e8a4353117151fd2cb9345", "docstring_summary": "The main function to rank an expression table.", "language": "python", "parameters": "(df, method, pos, neg, classes, ascending)", "return_statement": "return ser", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "arg_0", ".", "groupby", "(", "by", "=", "arg_4", ",", "axis", "=", "1", ")", ".", "mean", "(", ")", "arg_7", "=", "arg_0", ".", "groupby", "(", "by", "=", "arg_4", ",", "axis", "=", "1", ")", ".", "std", "(", ")", "if", "arg_1", "==", "'signal_to_noise'", ":", "arg_8", "=", "(", "arg_6", "[", "arg_2", "]", "-", "arg_6", "[", "arg_3", "]", ")", "/", "(", "arg_7", "[", "arg_2", "]", "+", "arg_7", "[", "arg_3", "]", ")", "elif", "arg_1", "==", "'t_test'", ":", "arg_8", "=", "(", "arg_6", "[", "arg_2", "]", "-", "arg_6", "[", "arg_3", "]", ")", "/", "np", ".", "sqrt", "(", "arg_7", "[", "arg_2", "]", "**", "2", "/", "len", "(", "arg_7", ")", "+", "arg_7", "[", "arg_3", "]", "**", "2", "/", "len", "(", "arg_7", ")", ")", "elif", "arg_1", "==", "'ratio_of_classes'", ":", "arg_8", "=", "arg_6", "[", "arg_2", "]", "/", "arg_6", "[", "arg_3", "]", "elif", "arg_1", "==", "'diff_of_classes'", ":", "arg_8", "=", "arg_6", "[", "arg_2", "]", "-", "arg_6", "[", "arg_3", "]", "elif", "arg_1", "==", "'log2_ratio_of_classes'", ":", "arg_8", "=", "np", ".", "log2", "(", "arg_6", "[", "arg_2", "]", "/", "arg_6", "[", "arg_3", "]", ")", "else", ":", "logging", ".", "error", "(", "\"Please provide correct method name!!!\"", ")", "sys", ".", "exit", "(", "0", ")", "arg_8", "=", "arg_8", ".", "sort_values", "(", "arg_5", "=", "arg_5", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"The main function to rank an expression table.\n\n       :param df:      gene_expression DataFrame.\n       :param method:  The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'.\n                       Others methods are:\n\n                       1. 'signal_to_noise'\n\n                          You must have at least three samples for each phenotype to use this metric.\n                          The larger the signal-to-noise ratio, the larger the differences of the means (scaled by the standard deviations);\n                          that is, the more distinct the gene expression is in each phenotype and the more the gene acts as a \u201cclass marker.\u201d\n\n                       2. 't_test'\n\n                          Uses the difference of means scaled by the standard deviation and number of samples.\n                          Note: You must have at least three samples for each phenotype to use this metric.\n                          The larger the tTest ratio, the more distinct the gene expression is in each phenotype\n                          and the more the gene acts as a \u201cclass marker.\u201d\n\n                       3. 'ratio_of_classes' (also referred to as fold change).\n\n                          Uses the ratio of class means to calculate fold change for natural scale data.\n\n                       4. 'diff_of_classes'\n\n                          Uses the difference of class means to calculate fold change for natural scale data\n\n                       5. 'log2_ratio_of_classes'\n\n                          Uses the log2 ratio of class means to calculate fold change for natural scale data.\n                          This is the recommended statistic for calculating fold change for log scale data.\n\n\n       :param str pos: one of labels of phenotype's names.\n       :param str neg: one of labels of phenotype's names.\n       :param list classes:  a list of phenotype labels, to specify which column of dataframe belongs to what category of phenotype.\n       :param bool ascending:  bool or list of bool. Sort ascending vs. descending.\n       :return:\n\n            returns a pd.Series of correlation to class of each variable. Gene_name is index, and value is rankings.\n\n            visit here for more docs: http://software.broadinstitute.org/gsea/doc/GSEAUserGuideFrame.html\n    \"\"\"\n\n    # exclude any zero stds.\n    arg_6 = arg_0.groupby(by=arg_4, axis=1).mean()\n    arg_7 =  arg_0.groupby(by=arg_4, axis=1).std()\n\n\n    if arg_1 == 'signal_to_noise':\n        arg_8 = (arg_6[arg_2] - arg_6[arg_3])/(arg_7[arg_2] + arg_7[arg_3])\n    elif arg_1 == 't_test':\n        arg_8 = (arg_6[arg_2] - arg_6[arg_3])/ np.sqrt(arg_7[arg_2]**2/len(arg_7)+arg_7[arg_3]**2/len(arg_7) )\n    elif arg_1 == 'ratio_of_classes':\n        arg_8 = arg_6[arg_2] / arg_6[arg_3]\n    elif arg_1 == 'diff_of_classes':\n        arg_8  = arg_6[arg_2] - arg_6[arg_3]\n    elif arg_1 == 'log2_ratio_of_classes':\n        arg_8  =  np.log2(arg_6[arg_2] / arg_6[arg_3])\n    else:\n        logging.error(\"Please provide correct method name!!!\")\n        sys.exit(0)\n    arg_8 = arg_8.sort_values(arg_5=arg_5)\n\n    return arg_8", "path": "gseapy/algorithm.py", "identifier": "ranking_metric", "docstring": "The main function to rank an expression table.\n\n       :param df:      gene_expression DataFrame.\n       :param method:  The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'.\n                       Others methods are:\n\n                       1. 'signal_to_noise'\n\n                          You must have at least three samples for each phenotype to use this metric.\n                          The larger the signal-to-noise ratio, the larger the differences of the means (scaled by the standard deviations);\n                          that is, the more distinct the gene expression is in each phenotype and the more the gene acts as a \u201cclass marker.\u201d\n\n                       2. 't_test'\n\n                          Uses the difference of means scaled by the standard deviation and number of samples.\n                          Note: You must have at least three samples for each phenotype to use this metric.\n                          The larger the tTest ratio, the more distinct the gene expression is in each phenotype\n                          and the more the gene acts as a \u201cclass marker.\u201d\n\n                       3. 'ratio_of_classes' (also referred to as fold change).\n\n                          Uses the ratio of class means to calculate fold change for natural scale data.\n\n                       4. 'diff_of_classes'\n\n                          Uses the difference of class means to calculate fold change for natural scale data\n\n                       5. 'log2_ratio_of_classes'\n\n                          Uses the log2 ratio of class means to calculate fold change for natural scale data.\n                          This is the recommended statistic for calculating fold change for log scale data.\n\n\n       :param str pos: one of labels of phenotype's names.\n       :param str neg: one of labels of phenotype's names.\n       :param list classes:  a list of phenotype labels, to specify which column of dataframe belongs to what category of phenotype.\n       :param bool ascending:  bool or list of bool. Sort ascending vs. descending.\n       :return:\n\n            returns a pd.Series of correlation to class of each variable. Gene_name is index, and value is rankings.\n\n            visit here for more docs: http://software.broadinstitute.org/gsea/doc/GSEAUserGuideFrame.html", "docstring_tokens": ["The", "main", "function", "to", "rank", "an", "expression", "table", "."], "nwo": "zqfang/GSEApy", "score": 0.7702436323138905, "idx": 261156}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/names.py#L94-L115", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Try to coerce the argument into a color - a 3-tuple of numbers-", "language": "python", "parameters": "(c)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "numbers", ".", "Number", ")", ":", "return", "arg_0", ",", "arg_0", ",", "arg_0", "if", "not", "arg_0", ":", "raise", "ValueError", "(", "'Cannot create color from empty \"%s\"'", "%", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "name_Func", "(", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "list", ")", ":", "arg_0", "=", "tuple", "(", "arg_0", ")", "if", "isinstance", "(", "arg_0", ",", "tuple", ")", ":", "if", "len", "(", "arg_0", ")", ">", "3", ":", "return", "arg_0", "[", ":", "3", "]", "while", "len", "(", "arg_0", ")", "<", "3", ":", "arg_0", "+=", "(", "arg_0", "[", "-", "1", "]", ",", ")", "return", "arg_0", "raise", "ValueError", "(", "'Cannot create color from \"%s\"'", "%", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Try to coerce the argument into a color - a 3-tuple of numbers-\"\"\"\n    if isinstance(arg_0, numbers.Number):\n        return arg_0, arg_0, arg_0\n\n    if not arg_0:\n        raise ValueError('Cannot create color from empty \"%s\"' % arg_0)\n\n    if isinstance(arg_0, str):\n        return name_Func(arg_0)\n\n    if isinstance(arg_0, list):\n        arg_0 = tuple(arg_0)\n\n    if isinstance(arg_0, tuple):\n        if len(arg_0) > 3:\n            return arg_0[:3]\n        while len(arg_0) < 3:\n            arg_0 += (arg_0[-1],)\n        return arg_0\n\n    raise ValueError('Cannot create color from \"%s\"' % arg_0)", "path": "bibliopixel/colors/names.py", "identifier": "to_color", "docstring": "Try to coerce the argument into a color - a 3-tuple of numbers-", "docstring_tokens": ["Try", "to", "coerce", "the", "argument", "into", "a", "color", "-", "a", "3", "-", "tuple", "of", "numbers", "-"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 261157}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_psmswindows.py#L109-L117", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return system CPU times as a named tuple.", "language": "python", "parameters": "()", "return_statement": "return _cputimes_ntuple(user, system, idle)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "0", ",", "0", "for", "arg_3", "in", "_psutil_mswindows", ".", "Func", "(", ")", ":", "arg_0", "+=", "arg_3", "[", "0", "]", "arg_1", "+=", "arg_3", "[", "1", "]", "arg_2", "+=", "arg_3", "[", "2", "]", "return", "_cputimes_ntuple", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")"], "function": "def Func():\n    \"\"\"Return system CPU times as a named tuple.\"\"\"\n    arg_0, arg_1, arg_2 = 0, 0, 0\n    # computes system global times summing each processor value\n    for arg_3 in _psutil_mswindows.Func():\n        arg_0 += arg_3[0]\n        arg_1 += arg_3[1]\n        arg_2 += arg_3[2]\n    return _cputimes_ntuple(arg_0, arg_1, arg_2)", "path": "environment/lib/python2.7/site-packages/psutil/_psmswindows.py", "identifier": "get_system_cpu_times", "docstring": "Return system CPU times as a named tuple.", "docstring_tokens": ["Return", "system", "CPU", "times", "as", "a", "named", "tuple", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261158}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/utils/strings.py#L127-L144", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Checks whether the re module can compile the given regular expression.", "language": "python", "parameters": "(string)", "return_statement": "return is_valid", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "re", ".", "compile", "(", "arg_0", ")", "arg_1", "=", "True", "except", "re", ".", "error", ":", "arg_1", "=", "False", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Checks whether the re module can compile the given regular expression.\n\n    Parameters\n    ----------\n    string: str\n\n    Returns\n    -------\n    boolean\n    \"\"\"\n    try:\n        re.compile(arg_0)\n        arg_1 = True\n    except re.error:\n        arg_1 = False\n    return arg_1", "path": "boyle/utils/strings.py", "identifier": "is_valid_regex", "docstring": "Checks whether the re module can compile the given regular expression.\n\n    Parameters\n    ----------\n    string: str\n\n    Returns\n    -------\n    boolean", "docstring_tokens": ["Checks", "whether", "the", "re", "module", "can", "compile", "the", "given", "regular", "expression", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 261159}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/files/search.py#L84-L107", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Creates a list of files that match the search_regex within file_dir.\n    The list of files will have file_dir as path prefix.", "language": "python", "parameters": "(file_dir, regex='')", "return_statement": "return file_list", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "arg_2", "=", "os", ".", "listdir", "(", "arg_0", ")", "arg_2", ".", "sort", "(", ")", "if", "arg_1", ":", "arg_2", "=", "search_list", "(", "arg_2", ",", "arg_1", ")", "arg_2", "=", "[", "op", ".", "join", "(", "arg_0", ",", "fname", ")", "for", "fname", "in", "arg_2", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1=''):\n    \"\"\"\n    Creates a list of files that match the search_regex within file_dir.\n    The list of files will have file_dir as path prefix.\n\n    Parameters\n    ----------\n    @param file_dir:\n\n    @param search_regex:\n\n    Returns:\n    --------\n    List of paths to files that match the search_regex\n    \"\"\"\n    arg_2 = os.listdir(arg_0)\n    arg_2.sort()\n\n    if arg_1:\n        arg_2 = search_list(arg_2, arg_1)\n\n    arg_2 = [op.join(arg_0, fname) for fname in arg_2]\n\n    return arg_2", "path": "boyle/files/search.py", "identifier": "get_file_list", "docstring": "Creates a list of files that match the search_regex within file_dir.\n    The list of files will have file_dir as path prefix.\n\n    Parameters\n    ----------\n    @param file_dir:\n\n    @param search_regex:\n\n    Returns:\n    --------\n    List of paths to files that match the search_regex", "docstring_tokens": ["Creates", "a", "list", "of", "files", "that", "match", "the", "search_regex", "within", "file_dir", ".", "The", "list", "of", "files", "will", "have", "file_dir", "as", "path", "prefix", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 261160}
{"url": "https://github.com/josuebrunel/yahoo-oauth/blob/40eff7809366850c46e1a3340469044f33cd1713/yahoo_oauth/utils.py#L29-L34", "sha": "40eff7809366850c46e1a3340469044f33cd1713", "docstring_summary": "Calls right function according to file extension", "language": "python", "parameters": "(filename)", "return_statement": "return func(filename)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "get_file_extension", "(", "arg_0", ")", "arg_3", "=", "json_Func", "if", "arg_2", "==", "'.json'", "else", "yaml_Func", "return", "arg_3", "(", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"Calls right function according to file extension\n    \"\"\"\n    arg_1, arg_2 = get_file_extension(arg_0)\n    arg_3 = json_Func if arg_2 == '.json' else yaml_Func\n    return arg_3(arg_0)", "path": "yahoo_oauth/utils.py", "identifier": "get_data", "docstring": "Calls right function according to file extension", "docstring_tokens": ["Calls", "right", "function", "according", "to", "file", "extension"], "nwo": "josuebrunel/yahoo-oauth", "score": 0.19492780499114437, "idx": 261161}
{"url": "https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/core/neural_var.py#L29-L34", "sha": "090fbad22a08a809b12951cd0d4984f5bd432698", "docstring_summary": "Apply a function to tensors.", "language": "python", "parameters": "(self, func, dim=None)", "return_statement": "return NeuralVariable(func(self.tensor), output_dim)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_3", "=", "arg_2", "if", "arg_2", "else", "arg_0", ".", "output_dim", "return", "NeuralVariable", "(", "arg_1", "(", "arg_0", ".", "tensor", ")", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Apply a function to tensors.\n        \"\"\"\n        arg_3 = arg_2 if arg_2 else arg_0.output_dim\n        return NeuralVariable(arg_1(arg_0.tensor), arg_3)", "path": "deepy/core/neural_var.py", "identifier": "NeuralVariable.apply", "docstring": "Apply a function to tensors.", "docstring_tokens": ["Apply", "a", "function", "to", "tensors", "."], "nwo": "zomux/deepy", "score": 0.562122088286705, "idx": 261162}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/results.py#L231-L238", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Returns a single percentage value for coverage.", "language": "python", "parameters": "(self)", "return_statement": "return pc_cov", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "n_statements", ">", "0", ":", "arg_1", "=", "(", "100.0", "*", "(", "arg_0", ".", "n_executed", "+", "arg_0", ".", "n_executed_branches", ")", "/", "(", "arg_0", ".", "n_statements", "+", "arg_0", ".", "n_branches", ")", ")", "else", ":", "arg_1", "=", "100.0", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Returns a single percentage value for coverage.\"\"\"\n        if arg_0.n_statements > 0:\n            arg_1 = (100.0 * (arg_0.n_executed + arg_0.n_executed_branches) /\n                        (arg_0.n_statements + arg_0.n_branches))\n        else:\n            arg_1 = 100.0\n        return arg_1", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/results.py", "identifier": "Numbers._get_pc_covered", "docstring": "Returns a single percentage value for coverage.", "docstring_tokens": ["Returns", "a", "single", "percentage", "value", "for", "coverage", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 261163}
{"url": "https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdfdocument.py#L71-L86", "sha": "ac2501f30d6619eae9dea5644717575ca9263d0a", "docstring_summary": "Default color object is black letters\r\n            & black lines.", "language": "python", "parameters": "(self, draw_color=None, fill_color=None, text_color=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "PDFColor", "(", ")", "arg_1", ".", "_set_type", "(", "'d'", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "PDFColor", "(", ")", "arg_2", ".", "_set_type", "(", "'f'", ")", "if", "arg_3", "is", "None", ":", "arg_3", "=", "PDFColor", "(", ")", "arg_3", ".", "_set_type", "(", "'t'", ")", "arg_0", ".", "draw_color", "=", "arg_1", "arg_0", ".", "fill_color", "=", "arg_2", "arg_0", ".", "text_color", "=", "arg_3"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):\r\n        \"\"\" Default color object is black letters\r\n            & black lines.\"\"\"\r\n        if arg_1 is None:\r\n            arg_1 = PDFColor()\r\n            arg_1._set_type('d')\r\n        if arg_2 is None:\r\n            arg_2 = PDFColor()\r\n            arg_2._set_type('f')\r\n        if arg_3 is None:\r\n            arg_3 = PDFColor()\r\n            arg_3._set_type('t')\r\n\r\n        arg_0.draw_color = arg_1\r\n        arg_0.fill_color = arg_2\r\n        arg_0.text_color = arg_3", "path": "pypdflite/pdfdocument.py", "identifier": "PDFDocument._set_color_scheme", "docstring": "Default color object is black letters\r\n            & black lines.", "docstring_tokens": ["Default", "color", "object", "is", "black", "letters", "&", "black", "lines", "."], "nwo": "katerina7479/pypdflite", "score": 0.1792979536242127, "idx": 261164}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L210-L240", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Remove the tag, but not its children or text.  The children and text\n        are merged into the parent.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "getparent", "(", ")", "assert", "arg_1", "is", "not", "None", "arg_2", "=", "arg_0", ".", "getprevious", "(", ")", "if", "arg_0", ".", "text", "and", "isinstance", "(", "arg_0", ".", "tag", ",", "basestring", ")", ":", "if", "arg_2", "is", "None", ":", "arg_1", ".", "text", "=", "(", "arg_1", ".", "text", "or", "''", ")", "+", "arg_0", ".", "text", "else", ":", "arg_2", ".", "tail", "=", "(", "arg_2", ".", "tail", "or", "''", ")", "+", "arg_0", ".", "text", "if", "arg_0", ".", "tail", ":", "if", "len", "(", "arg_0", ")", ":", "arg_5", "=", "arg_0", "[", "-", "1", "]", "arg_5", ".", "tail", "=", "(", "arg_5", ".", "tail", "or", "''", ")", "+", "arg_0", ".", "tail", "elif", "arg_2", "is", "None", ":", "arg_1", ".", "text", "=", "(", "arg_1", ".", "text", "or", "''", ")", "+", "arg_0", ".", "tail", "else", ":", "arg_2", ".", "tail", "=", "(", "arg_2", ".", "tail", "or", "''", ")", "+", "arg_0", ".", "tail", "arg_6", "=", "arg_1", ".", "index", "(", "arg_0", ")", "arg_1", "[", "arg_6", ":", "arg_6", "+", "1", "]", "=", "arg_0", "[", ":", "]"], "function": "def Func(arg_0):\n        \"\"\"\n        Remove the tag, but not its children or text.  The children and text\n        are merged into the parent.\n\n        Example::\n\n            >>> h = fragment_fromstring('<div>Hello <b>World!</b></div>')\n            >>> h.find('.//b').Func()\n            >>> print(tostring(h, encoding='unicode'))\n            <div>Hello World!</div>\n        \"\"\"\n        arg_1 = arg_0.getparent()\n        assert arg_1 is not None\n        arg_2 = arg_0.getprevious()\n        if arg_0.text and isinstance(arg_0.tag, basestring):\n            # not a Comment, etc.\n            if arg_2 is None:\n                arg_1.text = (arg_1.text or '') + arg_0.text\n            else:\n                arg_2.tail = (arg_2.tail or '') + arg_0.text\n        if arg_0.tail:\n            if len(arg_0):\n                arg_5 = arg_0[-1]\n                arg_5.tail = (arg_5.tail or '') + arg_0.tail\n            elif arg_2 is None:\n                arg_1.text = (arg_1.text or '') + arg_0.tail\n            else:\n                arg_2.tail = (arg_2.tail or '') + arg_0.tail\n        arg_6 = arg_1.index(arg_0)\n        arg_1[arg_6:arg_6+1] = arg_0[:]", "path": "capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py", "identifier": "HtmlMixin.drop_tag", "docstring": "Remove the tag, but not its children or text.  The children and text\n        are merged into the parent.\n\n        Example::\n\n            >>> h = fragment_fromstring('<div>Hello <b>World!</b></div>')\n            >>> h.find('.//b').drop_tag()\n            >>> print(tostring(h, encoding='unicode'))\n            <div>Hello World!</div>", "docstring_tokens": ["Remove", "the", "tag", "but", "not", "its", "children", "or", "text", ".", "The", "children", "and", "text", "are", "merged", "into", "the", "parent", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 261165}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L710-L769", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Removes a subtree from the trajectory tree.", "language": "python", "parameters": "(self, start_node, name, predicate=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "def", "_delete_from_children", "(", "arg_4", ",", "arg_5", ")", ":", "del", "arg_4", ".", "_children", "[", "arg_5", "]", "if", "arg_5", "in", "arg_4", ".", "_groups", ":", "del", "arg_4", ".", "_groups", "[", "arg_5", "]", "elif", "arg_5", "in", "arg_4", ".", "_leaves", ":", "del", "arg_4", ".", "_leaves", "[", "arg_5", "]", "else", ":", "raise", "RuntimeError", "(", "'You shall not pass!'", ")", "def", "Func_inner", "(", "arg_4", ",", "arg_3", ")", ":", "if", "not", "arg_3", "(", "arg_4", ")", ":", "return", "False", "elif", "arg_4", ".", "v_is_group", ":", "for", "arg_6", "in", "itools", ".", "chain", "(", "list", "(", "arg_4", ".", "_leaves", ".", "keys", "(", ")", ")", ",", "list", "(", "arg_4", ".", "_groups", ".", "keys", "(", ")", ")", ")", ":", "arg_7", "=", "arg_4", ".", "_children", "[", "arg_6", "]", "arg_8", "=", "Func_inner", "(", "arg_7", ",", "arg_3", ")", "if", "arg_8", ":", "_delete_from_children", "(", "arg_4", ",", "arg_6", ")", "del", "arg_7", "for", "arg_9", "in", "list", "(", "arg_4", ".", "_links", ".", "keys", "(", ")", ")", ":", "arg_4", ".", "f_remove_link", "(", "arg_9", ")", "if", "len", "(", "arg_4", ".", "_children", ")", "==", "0", ":", "arg_0", ".", "_delete_node", "(", "arg_4", ")", "return", "True", "else", ":", "return", "False", "else", ":", "arg_0", ".", "_delete_node", "(", "arg_4", ")", "return", "True", "if", "arg_2", "in", "arg_1", ".", "_links", ":", "arg_1", ".", "f_remove_link", "(", "arg_2", ")", "else", ":", "arg_10", "=", "arg_1", ".", "_children", "[", "arg_2", "]", "if", "arg_3", "is", "None", ":", "arg_3", "=", "lambda", "x", ":", "True", "if", "Func_inner", "(", "arg_10", ",", "arg_3", ")", ":", "_delete_from_children", "(", "arg_1", ",", "arg_2", ")", "del", "arg_10", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n        \"\"\"Removes a subtree from the trajectory tree.\n\n        Does not delete stuff from disk only from RAM.\n\n        :param start_node: The parent node from where to start\n        :param name: Name of child which will be deleted and recursively all nodes below the child\n        :param predicate:\n\n            Predicate that can be used to compute for individual nodes if they should be removed\n            ``True`` or kept ``False``.\n\n        \"\"\"\n        def _delete_from_children(arg_4, arg_5):\n            del arg_4._children[arg_5]\n            if arg_5 in arg_4._groups:\n                del arg_4._groups[arg_5]\n            elif arg_5 in arg_4._leaves:\n                del arg_4._leaves[arg_5]\n            else:\n                raise RuntimeError('You shall not pass!')\n\n        def Func_inner(arg_4, arg_3):\n\n            if not arg_3(arg_4):\n                return False\n            elif arg_4.v_is_group:\n                for arg_6 in itools.chain(list(arg_4._leaves.keys()),\n                                          list(arg_4._groups.keys())):\n                    arg_7 = arg_4._children[arg_6]\n                    arg_8 = Func_inner(arg_7, arg_3)\n                    if arg_8:\n                        _delete_from_children(arg_4, arg_6)\n                        del arg_7\n\n                for arg_9 in list(arg_4._links.keys()):\n                    arg_4.f_remove_link(arg_9)\n\n                if len(arg_4._children) == 0:\n                    arg_0._delete_node(arg_4)\n                    return True\n                else:\n                    return False\n            else:\n                arg_0._delete_node(arg_4)\n                return True\n\n        if arg_2 in arg_1._links:\n            arg_1.f_remove_link(arg_2)\n        else:\n            arg_10 = arg_1._children[arg_2]\n            if arg_3 is None:\n                arg_3 = lambda x: True\n\n            if Func_inner(arg_10, arg_3):\n                _delete_from_children(arg_1, arg_2)\n                del arg_10\n                return True\n            else:\n                return False", "path": "pypet/naturalnaming.py", "identifier": "NaturalNamingInterface._remove_subtree", "docstring": "Removes a subtree from the trajectory tree.\n\n        Does not delete stuff from disk only from RAM.\n\n        :param start_node: The parent node from where to start\n        :param name: Name of child which will be deleted and recursively all nodes below the child\n        :param predicate:\n\n            Predicate that can be used to compute for individual nodes if they should be removed\n            ``True`` or kept ``False``.", "docstring_tokens": ["Removes", "a", "subtree", "from", "the", "trajectory", "tree", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 261166}
{"url": "https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/backend/hstore_unique.py#L149-L155", "sha": "eef2ed5504d225858d4e4f5d77a838082ca6053e", "docstring_summary": "Drops a UNIQUE constraint for the specified hstore keys.", "language": "python", "parameters": "(self, model, field, keys)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "arg_0", ".", "_unique_constraint_name", "(", "arg_1", ".", "_meta", ".", "db_table", ",", "arg_2", ",", "arg_3", ")", "arg_5", "=", "arg_0", ".", "sql_hstore_unique_drop", ".", "format", "(", "arg_4", "=", "arg_0", ".", "quote_name", "(", "arg_4", ")", ")", "arg_0", ".", "execute", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Drops a UNIQUE constraint for the specified hstore keys.\"\"\"\n\n        arg_4 = arg_0._unique_constraint_name(\n            arg_1._meta.db_table, arg_2, arg_3)\n        arg_5 = arg_0.sql_hstore_unique_drop.format(arg_4=arg_0.quote_name(arg_4))\n        arg_0.execute(arg_5)", "path": "psqlextra/backend/hstore_unique.py", "identifier": "HStoreUniqueSchemaEditorMixin._drop_hstore_unique", "docstring": "Drops a UNIQUE constraint for the specified hstore keys.", "docstring_tokens": ["Drops", "a", "UNIQUE", "constraint", "for", "the", "specified", "hstore", "keys", "."], "nwo": "SectorLabs/django-postgres-extra", "score": 0.938393672171891, "idx": 261167}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L237-L326", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Populate Filterbank instance with data from Filterbank file", "language": "python", "parameters": "(self, filename=None, f_start=None, f_stop=None,\n                        t_start=None, t_stop=None, load_data=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "True", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "filename", "else", ":", "arg_0", ".", "filename", "=", "arg_1", "arg_0", ".", "header", "=", "read_header", "(", "arg_1", ")", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", "=", "arg_0", ".", "_setup_freqs", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "arg_12", "=", "arg_0", ".", "header", "[", "b'nbits'", "]", "arg_13", "=", "int", "(", "arg_0", ".", "header", "[", "b'nbits'", "]", "/", "8", ")", "arg_14", "=", "arg_0", ".", "header", "[", "b'nchans'", "]", "arg_15", "=", "arg_0", ".", "freqs", ".", "shape", "[", "0", "]", "arg_16", "=", "arg_0", ".", "header", "[", "b'nifs'", "]", "arg_0", ".", "idx_data", "=", "len_header", "(", "arg_1", ")", "arg_18", "=", "open", "(", "arg_1", ",", "'rb'", ")", "arg_18", ".", "seek", "(", "arg_0", ".", "idx_data", ")", "arg_19", "=", "os", ".", "path", ".", "getsize", "(", "arg_0", ".", "filename", ")", "arg_20", "=", "arg_19", "-", "arg_0", ".", "idx_data", "arg_0", ".", "n_ints_in_file", "=", "calc_n_ints_in_file", "(", "arg_0", ".", "filename", ")", "arg_0", ".", "file_size_bytes", "=", "arg_19", "arg_23", ",", "arg_24", ",", "arg_25", "=", "arg_0", ".", "_setup_time_axis", "(", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "arg_18", ".", "seek", "(", "int", "(", "arg_23", "*", "arg_12", "*", "arg_16", "*", "arg_14", "/", "8", ")", ",", "1", ")", "arg_26", "=", "np", ".", "min", "(", "(", "arg_10", ",", "arg_11", ")", ")", "arg_27", "=", "np", ".", "max", "(", "(", "arg_10", ",", "arg_11", ")", ")", "if", "arg_12", "==", "2", ":", "arg_28", "=", "b'uint8'", "arg_15", "=", "int", "(", "arg_15", "/", "4", ")", "elif", "arg_13", "==", "4", ":", "arg_28", "=", "b'float32'", "elif", "arg_13", "==", "2", ":", "arg_28", "=", "b'uint16'", "elif", "arg_13", "==", "1", ":", "arg_28", "=", "b'uint8'", "if", "arg_6", ":", "if", "arg_25", "*", "arg_16", "*", "arg_15", ">", "MAX_DATA_ARRAY_SIZE", ":", "print", "(", "\"[Filterbank]  Error: data array is too large to load. Either select fewer points or manually increase MAX_DATA_ARRAY_SIZE. Large files are now handle with Waterfall .\"", ")", "sys", ".", "exit", "(", ")", "if", "arg_12", "==", "2", ":", "arg_0", ".", "data", "=", "np", ".", "zeros", "(", "(", "arg_25", ",", "arg_16", ",", "arg_15", "*", "4", ")", ",", "dtype", "=", "arg_28", ")", "else", ":", "arg_0", ".", "data", "=", "np", ".", "zeros", "(", "(", "arg_25", ",", "arg_16", ",", "arg_15", ")", ",", "dtype", "=", "arg_28", ")", "for", "arg_30", "in", "range", "(", "arg_25", ")", ":", "for", "arg_31", "in", "range", "(", "arg_16", ")", ":", "arg_18", ".", "seek", "(", "arg_13", "*", "arg_26", ",", "1", ")", "arg_32", "=", "np", ".", "fromfile", "(", "arg_18", ",", "count", "=", "arg_15", ",", "dtype", "=", "arg_28", ")", "if", "arg_12", "==", "2", ":", "arg_32", "=", "unpack_2to8", "(", "arg_32", ")", "arg_0", ".", "data", "[", "arg_30", ",", "arg_31", "]", "=", "arg_32", "arg_18", ".", "seek", "(", "arg_13", "*", "(", "arg_14", "-", "arg_27", ")", ",", "1", ")", "else", ":", "print", "(", "\"Skipping data load...\"", ")", "arg_0", ".", "data", "=", "np", ".", "array", "(", "[", "0", "]", ",", "dtype", "=", "arg_28", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,\n                        arg_4=None, arg_5=None, arg_6=True):\n        \"\"\" Populate Filterbank instance with data from Filterbank file\n\n        Note:\n            This is to be deprecated in future, please use Waterfall() to open files.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.filename\n        else:\n            arg_0.filename = arg_1\n\n        arg_0.header = read_header(arg_1)\n\n        #convert input frequencies into what their corresponding index would be\n        arg_8, arg_9, arg_10, arg_11 = arg_0._setup_freqs(arg_2=arg_2, arg_3=arg_3)\n\n        arg_12  = arg_0.header[b'nbits']\n        arg_13  = int(arg_0.header[b'nbits'] / 8)\n        arg_14 = arg_0.header[b'nchans']\n        arg_15 = arg_0.freqs.shape[0]\n        arg_16   = arg_0.header[b'nifs']\n\n        # Load binary data\n        arg_0.idx_data = len_header(arg_1)\n        arg_18 = open(arg_1, 'rb')\n        arg_18.seek(arg_0.idx_data)\n        arg_19 = os.path.getsize(arg_0.filename)\n        arg_20 = arg_19 - arg_0.idx_data\n\n        # Finally add some other info to the class as objects\n        arg_0.n_ints_in_file  = calc_n_ints_in_file(arg_0.filename)\n        arg_0.file_size_bytes = arg_19\n\n        ## Setup time axis\n        arg_23, arg_24, arg_25 = arg_0._setup_time_axis(arg_4=arg_4, arg_5=arg_5)\n\n        # Seek to first integration\n        arg_18.seek(int(arg_23 * arg_12 * arg_16 * arg_14 / 8), 1)\n\n        # Set up indexes used in file read (taken out of loop for speed)\n        arg_26 = np.min((arg_10, arg_11))\n        arg_27 = np.max((arg_10, arg_11))\n\n        #Set up the data type (taken out of loop for speed)\n        if arg_12 == 2:\n            arg_28 = b'uint8'\n            arg_15 = int(arg_15/4)\n        elif arg_13 == 4:\n            arg_28 = b'float32'\n        elif arg_13 == 2:\n            arg_28 = b'uint16'\n        elif arg_13 == 1:\n            arg_28 = b'uint8'\n\n        if arg_6:\n\n            if arg_25 * arg_16 * arg_15 > MAX_DATA_ARRAY_SIZE:\n                print(\"[Filterbank]  Error: data array is too large to load. Either select fewer points or manually increase MAX_DATA_ARRAY_SIZE. Large files are now handle with Waterfall .\")\n                sys.exit()\n\n            if arg_12 == 2:\n                arg_0.data = np.zeros((arg_25, arg_16, arg_15*4), dtype=arg_28)\n            else:\n                arg_0.data = np.zeros((arg_25, arg_16, arg_15), dtype=arg_28)\n\n            for arg_30 in range(arg_25):\n                \"\"\"d = f.read(n_bytes * n_chans * n_ifs)\n                \"\"\"\n\n                for arg_31 in range(arg_16):\n\n                    arg_18.seek(arg_13 * arg_26, 1) # 1 = from current location\n                    #d = f.read(n_bytes * n_chans_selected)\n                    #bytes_to_read = n_bytes * n_chans_selected\n\n                    arg_32 = np.fromfile(arg_18, count=arg_15, dtype=arg_28)\n\n                    # Reverse array if frequency axis is flipped\n#                     if f_delt < 0:\n#                         dd = dd[::-1]\n\n                    if arg_12 == 2:\n                        arg_32 = unpack_2to8(arg_32)\n                    arg_0.data[arg_30, arg_31] = arg_32\n\n                    arg_18.seek(arg_13 * (arg_14 - arg_27), 1)  # Seek to start of next block\n        else:\n            print(\"Skipping data load...\")\n            arg_0.data = np.array([0], dtype=arg_28)", "path": "blimpy/filterbank.py", "identifier": "Filterbank.read_filterbank", "docstring": "Populate Filterbank instance with data from Filterbank file\n\n        Note:\n            This is to be deprecated in future, please use Waterfall() to open files.", "docstring_tokens": ["Populate", "Filterbank", "instance", "with", "data", "from", "Filterbank", "file"], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 261168}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/widgets.py#L132-L140", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Prepare widget data for template.", "language": "python", "parameters": "(self)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "for", "arg_2", "in", "arg_0", ".", "fields", ":", "arg_3", "=", "arg_0", ".", "data", ".", "get", "(", "arg_2", ".", "name", ")", "arg_1", "[", "arg_2", ".", "name", "]", "=", "arg_2", ".", "Func", "(", "arg_3", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"Prepare widget data for template.\"\"\"\n        arg_1 = {}\n\n        for arg_2 in arg_0.fields:\n            arg_3 = arg_0.data.get(arg_2.name)\n            arg_1[arg_2.name] = arg_2.Func(arg_3)\n\n        return arg_1", "path": "dispatch/theme/widgets.py", "identifier": "Widget.prepare_data", "docstring": "Prepare widget data for template.", "docstring_tokens": ["Prepare", "widget", "data", "for", "template", "."], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 261169}
{"url": "https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/project/config/__init__.py#L5-L20", "sha": "d0308408ebb248dd752b77123b845f8ec637fab2", "docstring_summary": "Load config.", "language": "python", "parameters": "()", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "os", ".", "environ", ".", "get", "(", "'MODE'", ")", "try", ":", "if", "arg_0", "==", "'PRODUCTION'", ":", "from", ".", "production", "import", "ProductionConfig", "return", "ProductionConfig", "elif", "arg_0", "==", "'TESTING'", ":", "from", ".", "testing", "import", "TestingConfig", "return", "TestingConfig", "else", ":", "from", ".", "development", "import", "DevelopmentConfig", "return", "DevelopmentConfig", "except", "ImportError", ":", "from", ".", "default", "import", "Config", "return", "Config"], "function": "def Func():\n    \"\"\"Load config.\"\"\"\n    arg_0 = os.environ.get('MODE')\n    try:\n        if arg_0 == 'PRODUCTION':\n            from .production import ProductionConfig\n            return ProductionConfig\n        elif arg_0 == 'TESTING':\n            from .testing import TestingConfig\n            return TestingConfig\n        else:\n            from .development import DevelopmentConfig\n            return DevelopmentConfig\n    except ImportError:\n        from .default import Config\n        return Config", "path": "flask_boost/project/config/__init__.py", "identifier": "load_config", "docstring": "Load config.", "docstring_tokens": ["Load", "config", "."], "nwo": "hustlzp/Flask-Boost", "score": 0.7273423281932334, "idx": 261170}
{"url": "https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/__init__.py#L19-L39", "sha": "a2b151fed93c47725018d3034848cb3a1814bed7", "docstring_summary": "Mark this method as a CLI command.", "language": "python", "parameters": "(method=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ",", "**", "arg_1", ")", ":", "def", "actual_decorator", "(", "arg_0", ")", ":", "arg_0", ".", "_cli_Func", "=", "True", "arg_0", ".", "_cli_Func_attrs", "=", "arg_1", "return", "arg_0", "if", "arg_0", "and", "isinstance", "(", "arg_0", ",", "types", ".", "FunctionType", ")", ":", "return", "actual_decorator", "(", "arg_0", ")", "else", ":", "return", "actual_decorator"], "function": "def Func(arg_0=None, **arg_1):\n    \"\"\"Mark this method as a CLI Func.\n\n    This will only have any meaningful effect in methods that are members of a\n    Resource subclass.\n    \"\"\"\n    # Create the actual decorator to be applied.\n    # This is done in such a way to make `@resources.Func`,\n    # `@resources.Func()`, and `@resources.Func(foo='bar')` all work.\n    def actual_decorator(arg_0):\n        arg_0._cli_Func = True\n        arg_0._cli_Func_attrs = arg_1\n        return arg_0\n\n    # If we got the method straight-up, apply the decorator and return\n    # the decorated method; otherwise, return the actual decorator for\n    # the Python interpreter to apply.\n    if arg_0 and isinstance(arg_0, types.FunctionType):\n        return actual_decorator(arg_0)\n    else:\n        return actual_decorator", "path": "tower_cli/resources/__init__.py", "identifier": "command", "docstring": "Mark this method as a CLI command.\n\n    This will only have any meaningful effect in methods that are members of a\n    Resource subclass.", "docstring_tokens": ["Mark", "this", "method", "as", "a", "CLI", "command", "."], "nwo": "ansible/tower-cli", "score": 0.9473998005989943, "idx": 261171}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/datasets.py#L101-L121", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "r\"\"\"Return a noisy cosine at a given frequency.", "language": "python", "parameters": "(N=1024, A=0.1, sampling=1024., freq=200)", "return_statement": "return x", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "1024", ",", "arg_1", "=", "0.1", ",", "arg_2", "=", "1024.", ",", "arg_3", "=", "200", ")", ":", "arg_4", "=", "arange", "(", "0", ",", "float", "(", "arg_0", ")", "/", "arg_2", ",", "1.", "/", "arg_2", ")", "arg_5", "=", "cos", "(", "2.", "*", "pi", "*", "arg_4", "*", "arg_3", ")", "+", "arg_1", "*", "randn", "(", "arg_4", ".", "size", ")", "return", "arg_5"], "function": "def Func(arg_0=1024, arg_1=0.1, arg_2=1024., arg_3=200):\n    r\"\"\"Return a noisy cosine at a given frequency.\n\n    :param N:           the final data size\n    :param A:           the strength of the noise\n    :param float sampling: sampling frequency of the input :attr:`data`.\n    :param float freq:  the frequency :math:`f_0` of the cosine.\n\n    .. math:: x[t] = cos(2\\pi t * f_0) + A w[t]\n\n    where w[t] is a white noise of variance 1.\n\n    .. doctest::\n\n        >>> from spectrum import Func\n        >>> a = Func(N=1024, sampling=1024, A=0.5, freq=100)\n\n    \"\"\"\n    arg_4 = arange(0, float(arg_0)/arg_2, 1./arg_2)\n    arg_5 = cos(2.*pi*arg_4*arg_3) + arg_1 * randn(arg_4.size)\n    return arg_5", "path": "src/spectrum/datasets.py", "identifier": "data_cosine", "docstring": "r\"\"\"Return a noisy cosine at a given frequency.\n\n    :param N:           the final data size\n    :param A:           the strength of the noise\n    :param float sampling: sampling frequency of the input :attr:`data`.\n    :param float freq:  the frequency :math:`f_0` of the cosine.\n\n    .. math:: x[t] = cos(2\\pi t * f_0) + A w[t]\n\n    where w[t] is a white noise of variance 1.\n\n    .. doctest::\n\n        >>> from spectrum import data_cosine\n        >>> a = data_cosine(N=1024, sampling=1024, A=0.5, freq=100)", "docstring_tokens": ["r", "Return", "a", "noisy", "cosine", "at", "a", "given", "frequency", "."], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 261172}
{"url": "https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/advanced.py#L61-L68", "sha": "188e1bf1f15a44d9a599028d020083af9fb43ea7", "docstring_summary": "If the form and formsets are valid, save the associated models.", "language": "python", "parameters": "(self, form, inlines)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "form_valid", "(", "arg_1", ")", "for", "arg_4", "in", "arg_2", ":", "arg_4", ".", "save", "(", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        If the form and formsets are valid, save the associated models.\n        \"\"\"\n        arg_3 = arg_0.form_valid(arg_1)\n        for arg_4 in arg_2:\n            arg_4.save()\n        return arg_3", "path": "extra_views/advanced.py", "identifier": "ModelFormWithInlinesMixin.forms_valid", "docstring": "If the form and formsets are valid, save the associated models.", "docstring_tokens": ["If", "the", "form", "and", "formsets", "are", "valid", "save", "the", "associated", "models", "."], "nwo": "AndrewIngram/django-extra-views", "score": 0.5916871811422788, "idx": 261173}
{"url": "https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/source_data/loaders.py#L49-L69", "sha": "5e9e803c9131b377af305d5302723ba2415001da", "docstring_summary": "Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column.", "language": "python", "parameters": "()", "return_statement": "return X, y, mapping", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "pd", ".", "read_csv", "(", "'source_data/splice/splice.csv'", ")", "arg_1", "=", "arg_0", ".", "reindex", "(", "columns", "=", "[", "x", "for", "x", "in", "arg_0", ".", "columns", ".", "values", "if", "x", "!=", "'class'", "]", ")", "arg_1", "[", "'dna'", "]", "=", "arg_1", "[", "'dna'", "]", ".", "map", "(", "lambda", "x", ":", "list", "(", "str", "(", "x", ")", ".", "strip", "(", ")", ")", ")", "for", "arg_2", "in", "range", "(", "60", ")", ":", "arg_1", "[", "'dna_%d'", "%", "(", "arg_2", ",", ")", "]", "=", "arg_1", "[", "'dna'", "]", ".", "map", "(", "lambda", "x", ":", "x", "[", "arg_2", "]", ")", "del", "arg_1", "[", "'dna'", "]", "arg_3", "=", "arg_0", ".", "reindex", "(", "columns", "=", "[", "'class'", "]", ")", "arg_3", "=", "preprocessing", ".", "LabelEncoder", "(", ")", ".", "fit_transform", "(", "arg_3", ".", "values", ".", "reshape", "(", "-", "1", ",", ")", ")", "arg_4", "=", "None", "return", "arg_1", ",", "arg_3", ",", "arg_4"], "function": "def Func():\n    \"\"\"\n    Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column.\n\n    :return:\n    \"\"\"\n\n    arg_0 = pd.read_csv('source_data/splice/splice.csv')\n    arg_1 = arg_0.reindex(columns=[x for x in arg_0.columns.values if x != 'class'])\n    arg_1['dna'] = arg_1['dna'].map(lambda x: list(str(x).strip()))\n    for arg_2 in range(60):\n        arg_1['dna_%d' % (arg_2, )] = arg_1['dna'].map(lambda x: x[arg_2])\n    del arg_1['dna']\n\n    arg_3 = arg_0.reindex(columns=['class'])\n    arg_3 = preprocessing.LabelEncoder().fit_transform(arg_3.values.reshape(-1, ))\n\n    # this data is truly categorical, with no known concept of ordering\n    arg_4 = None\n\n    return arg_1, arg_3, arg_4", "path": "examples/source_data/loaders.py", "identifier": "get_splice_data", "docstring": "Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column.\n\n    :return:", "docstring_tokens": ["Load", "the", "mushroom", "dataset", "split", "it", "into", "X", "and", "y", "and", "then", "call", "the", "label", "encoder", "to", "get", "an", "integer", "y", "column", "."], "nwo": "scikit-learn-contrib/categorical-encoding", "score": 0.948361178849178, "idx": 261174}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2647-L2658", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Returns the parent of the node.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "v_is_root", ":", "raise", "TypeError", "(", "'Root does not have a parent'", ")", "elif", "arg_0", ".", "v_location", "==", "''", ":", "return", "arg_0", ".", "v_root", "else", ":", "return", "arg_0", ".", "v_root", ".", "f_get", "(", "arg_0", ".", "v_location", ",", "fast_access", "=", "False", ",", "shortcuts", "=", "False", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns the parent of the node.\n\n        Raises a TypeError if current node is root.\n\n        \"\"\"\n        if arg_0.v_is_root:\n            raise TypeError('Root does not have a parent')\n        elif arg_0.v_location == '':\n            return arg_0.v_root\n        else:\n            return arg_0.v_root.f_get(arg_0.v_location, fast_access=False, shortcuts=False)", "path": "pypet/naturalnaming.py", "identifier": "NNGroupNode.f_get_parent", "docstring": "Returns the parent of the node.\n\n        Raises a TypeError if current node is root.", "docstring_tokens": ["Returns", "the", "parent", "of", "the", "node", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 261175}
{"url": "https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/docs.py#L24-L29", "sha": "f04f8a4248c571f3d5ce882b325884a3e5d80203", "docstring_summary": "Call the Sphinx Makefile with the specified targets.", "language": "python", "parameters": "(*targets)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "*", "arg_0", ")", ":", "sh", "(", "'make %s'", "%", "' '", ".", "join", "(", "arg_0", ")", ",", "cwd", "=", "options", ".", "paved", ".", "docs", ".", "path", ")"], "function": "def Func(*arg_0):\n    \"\"\"Call the Sphinx Makefile with the specified targets.\n\n    `options.paved.docs.path`: the path to the Sphinx folder (where the Makefile resides).\n    \"\"\"\n    sh('make %s' % ' '.join(arg_0), cwd=options.paved.docs.path)", "path": "paved/docs.py", "identifier": "sphinx_make", "docstring": "Call the Sphinx Makefile with the specified targets.\n\n    `options.paved.docs.path`: the path to the Sphinx folder (where the Makefile resides).", "docstring_tokens": ["Call", "the", "Sphinx", "Makefile", "with", "the", "specified", "targets", "."], "nwo": "eykd/paved", "score": 0.09252797783733271, "idx": 261176}
{"url": "https://github.com/IEMLdev/ieml/blob/4c842ba7e6165e2f1b4a4e2e98759f9f33af5f25/ieml/grammar/paths/tools.py#L77-L103", "sha": "4c842ba7e6165e2f1b4a4e2e98759f9f33af5f25", "docstring_summary": "path is a mul of coord or a coord", "language": "python", "parameters": "(obj, path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "__class__", "not", "in", "arg_1", ".", "context", ".", "accept", ":", "arg_2", "=", "set", "(", ")", "for", "arg_3", "in", "arg_1", ".", "context", ".", "accept", ":", "arg_2", "|=", "{", "arg_5", "for", "arg_4", "in", "arg_0", "[", "arg_3", "]", "for", "arg_5", "in", "Func", "(", "arg_4", ",", "arg_1", ")", "}", "return", "arg_2", "if", "isinstance", "(", "arg_0", ",", "Text", ")", ":", "if", "arg_1", ".", "index", "is", "not", "None", ":", "return", "{", "arg_0", ".", "children", "[", "arg_1", ".", "index", "]", "}", "return", "set", "(", "arg_0", ".", "children", ")", "if", "isinstance", "(", "arg_0", ",", "(", "Fact", ",", "Theory", ")", ")", ":", "return", "Func_tree_graph", "(", "arg_0", ".", "tree_graph", ",", "arg_1", ")", "if", "isinstance", "(", "arg_0", ",", "Topic", ")", ":", "if", "arg_1", ".", "kind", "==", "'r'", ":", "if", "arg_1", ".", "index", "is", "not", "None", ":", "return", "{", "arg_0", ".", "root", "[", "arg_1", ".", "index", "]", "}", "return", "set", "(", "arg_0", ".", "root", ")", "else", ":", "if", "arg_1", ".", "index", "is", "not", "None", ":", "return", "{", "arg_0", ".", "flexing", "[", "arg_1", ".", "index", "]", "}", "return", "set", "(", "arg_0", ".", "flexing", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"path is a mul of coord or a coord\"\"\"\n    if arg_0.__class__ not in arg_1.context.accept:\n        arg_2 = set()\n        for arg_3 in arg_1.context.accept:\n            arg_2 |= {arg_5 for arg_4 in arg_0[arg_3] for arg_5 in Func(arg_4, arg_1)}\n\n        return arg_2\n\n    if isinstance(arg_0, Text):\n        if arg_1.index is not None:\n            return {arg_0.children[arg_1.index]}\n\n        return set(arg_0.children)\n\n    if isinstance(arg_0, (Fact, Theory)):\n        return Func_tree_graph(arg_0.tree_graph, arg_1)\n\n    if isinstance(arg_0, Topic):\n        if arg_1.kind == 'r':\n            if arg_1.index is not None:\n                return {arg_0.root[arg_1.index]}\n            return set(arg_0.root)\n        else:\n            if arg_1.index is not None:\n                return {arg_0.flexing[arg_1.index]}\n            return set(arg_0.flexing)", "path": "ieml/grammar/paths/tools.py", "identifier": "_resolve_path", "docstring": "path is a mul of coord or a coord", "docstring_tokens": ["path", "is", "a", "mul", "of", "coord", "or", "a", "coord"], "nwo": "IEMLdev/ieml", "score": 0.5001792556934819, "idx": 261177}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1272-L1322", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Creates a box plot of daily, weekly, and monthly return\n    distributions.", "language": "python", "parameters": "(returns, live_start_date=None, ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "plt", ".", "gca", "(", ")", "arg_4", "=", "arg_0", "if", "arg_1", "is", "None", "else", "arg_0", ".", "loc", "[", "arg_0", ".", "index", "<", "arg_1", "]", "arg_5", "=", "ep", ".", "aggregate_returns", "(", "arg_4", ",", "'weekly'", ")", "arg_6", "=", "ep", ".", "aggregate_returns", "(", "arg_4", ",", "'monthly'", ")", "sns", ".", "boxplot", "(", "data", "=", "[", "arg_4", ",", "arg_5", ",", "arg_6", "]", ",", "palette", "=", "[", "\"#4c72B0\"", ",", "\"#55A868\"", ",", "\"#CCB974\"", "]", ",", "arg_2", "=", "arg_2", ",", "**", "arg_3", ")", "if", "arg_1", "is", "not", "None", ":", "arg_7", "=", "arg_0", ".", "loc", "[", "arg_0", ".", "index", ">=", "arg_1", "]", "arg_8", "=", "ep", ".", "aggregate_returns", "(", "arg_7", ",", "'weekly'", ")", "arg_9", "=", "ep", ".", "aggregate_returns", "(", "arg_7", ",", "'monthly'", ")", "sns", ".", "swarmplot", "(", "data", "=", "[", "arg_7", ",", "arg_8", ",", "arg_9", "]", ",", "arg_2", "=", "arg_2", ",", "color", "=", "\"red\"", ",", "marker", "=", "\"d\"", ",", "**", "arg_3", ")", "arg_10", "=", "matplotlib", ".", "lines", ".", "Line2D", "(", "[", "]", ",", "[", "]", ",", "color", "=", "\"red\"", ",", "marker", "=", "\"d\"", ",", "label", "=", "\"Out-of-sample data\"", ",", "linestyle", "=", "''", ")", "arg_2", ".", "legend", "(", "handles", "=", "[", "arg_10", "]", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "arg_2", ".", "set_xticklabels", "(", "[", "'Daily'", ",", "'Weekly'", ",", "'Monthly'", "]", ")", "arg_2", ".", "set_title", "(", "'Return quantiles'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None, arg_2=None, **arg_3):\n    \"\"\"\n    Creates a box plot of daily, weekly, and monthly return\n    distributions.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    live_start_date : datetime, optional\n        The point in time when the strategy began live trading, after\n        its backtest period.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_2 is None:\n        arg_2 = plt.gca()\n\n    arg_4 = arg_0 if arg_1 is None \\\n        else arg_0.loc[arg_0.index < arg_1]\n    arg_5 = ep.aggregate_returns(arg_4, 'weekly')\n    arg_6 = ep.aggregate_returns(arg_4, 'monthly')\n    sns.boxplot(data=[arg_4, arg_5, arg_6],\n                palette=[\"#4c72B0\", \"#55A868\", \"#CCB974\"],\n                arg_2=arg_2, **arg_3)\n\n    if arg_1 is not None:\n        arg_7 = arg_0.loc[arg_0.index >= arg_1]\n        arg_8 = ep.aggregate_returns(arg_7, 'weekly')\n        arg_9 = ep.aggregate_returns(arg_7, 'monthly')\n\n        sns.swarmplot(data=[arg_7, arg_8, arg_9], arg_2=arg_2,\n                      color=\"red\",\n                      marker=\"d\", **arg_3)\n        arg_10 = matplotlib.lines.Line2D([], [], color=\"red\", marker=\"d\",\n                                           label=\"Out-of-sample data\",\n                                           linestyle='')\n        arg_2.legend(handles=[arg_10], frameon=True, framealpha=0.5)\n    arg_2.set_xticklabels(['Daily', 'Weekly', 'Monthly'])\n    arg_2.set_title('Return quantiles')\n\n    return arg_2", "path": "pyfolio/plotting.py", "identifier": "plot_return_quantiles", "docstring": "Creates a box plot of daily, weekly, and monthly return\n    distributions.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    live_start_date : datetime, optional\n        The point in time when the strategy began live trading, after\n        its backtest period.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to seaborn plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Creates", "a", "box", "plot", "of", "daily", "weekly", "and", "monthly", "return", "distributions", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 261178}
{"url": "https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/rein.py#L122-L161", "sha": "aa9e52e36c7058a7e6fd81d36563ca6850b21956", "docstring_summary": "Choice and return an an action by given the action probability distribution.", "language": "python", "parameters": "(probs=(0.5, 0.5), action_list=None)", "return_statement": "return np.random.choice(action_list, p=probs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "(", "0.5", ",", "0.5", ")", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_2", "=", "len", "(", "arg_0", ")", "arg_1", "=", "np", ".", "arange", "(", "arg_2", ")", "else", ":", "if", "len", "(", "arg_1", ")", "!=", "len", "(", "arg_0", ")", ":", "raise", "Exception", "(", "\"number of actions should equal to number of probabilities.\"", ")", "return", "np", ".", "random", ".", "choice", "(", "arg_1", ",", "p", "=", "arg_0", ")"], "function": "def Func(arg_0=(0.5, 0.5), arg_1=None):\n    \"\"\"Choice and return an an action by given the action probability distribution.\n\n    Parameters\n    ------------\n    probs : list of float.\n        The probability distribution of all actions.\n    action_list : None or a list of int or others\n        A list of action in integer, string or others. If None, returns an integer range between 0 and len(probs)-1.\n\n    Returns\n    --------\n    float int or str\n        The chosen action.\n\n    Examples\n    ----------\n    >>> for _ in range(5):\n    >>>     a = Func([0.2, 0.4, 0.4])\n    >>>     print(a)\n    0\n    1\n    1\n    2\n    1\n    >>> for _ in range(3):\n    >>>     a = Func([0.5, 0.5], ['a', 'b'])\n    >>>     print(a)\n    a\n    b\n    b\n\n    \"\"\"\n    if arg_1 is None:\n        arg_2 = len(arg_0)\n        arg_1 = np.arange(arg_2)\n    else:\n        if len(arg_1) != len(arg_0):\n            raise Exception(\"number of actions should equal to number of probabilities.\")\n    return np.random.choice(arg_1, p=arg_0)", "path": "tensorlayer/rein.py", "identifier": "choice_action_by_probs", "docstring": "Choice and return an an action by given the action probability distribution.\n\n    Parameters\n    ------------\n    probs : list of float.\n        The probability distribution of all actions.\n    action_list : None or a list of int or others\n        A list of action in integer, string or others. If None, returns an integer range between 0 and len(probs)-1.\n\n    Returns\n    --------\n    float int or str\n        The chosen action.\n\n    Examples\n    ----------\n    >>> for _ in range(5):\n    >>>     a = choice_action_by_probs([0.2, 0.4, 0.4])\n    >>>     print(a)\n    0\n    1\n    1\n    2\n    1\n    >>> for _ in range(3):\n    >>>     a = choice_action_by_probs([0.5, 0.5], ['a', 'b'])\n    >>>     print(a)\n    a\n    b\n    b", "docstring_tokens": ["Choice", "and", "return", "an", "an", "action", "by", "given", "the", "action", "probability", "distribution", "."], "nwo": "tensorlayer/tensorlayer", "score": 0.9872073548695997, "idx": 261179}
{"url": "https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L42-L54", "sha": "1e1954b06fe140346acea43582515991685e4e01", "docstring_summary": "Debug print name and val.", "language": "python", "parameters": "(name, val)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "from", "pprint", "import", "pformat", "print", "(", "'% 5s: %s'", "%", "(", "arg_0", ",", "'\\n       '", ".", "join", "(", "pformat", "(", "arg_1", ",", "indent", "=", "4", ",", "width", "=", "75", ",", ")", ".", "split", "(", "'\\n'", ")", ")", ",", ")", ",", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Debug print name and val.\"\"\"\n    from pprint import pformat\n    print(\n        '% 5s: %s' % (\n            arg_0,\n            '\\n       '.join(\n                pformat(\n                    arg_1, indent=4, width=75,\n                ).split('\\n')\n            ),\n        ),\n    )", "path": "dddp/websocket.py", "identifier": "dprint", "docstring": "Debug print name and val.", "docstring_tokens": ["Debug", "print", "name", "and", "val", "."], "nwo": "jazzband/django-ddp", "score": 0.19488351150718342, "idx": 261180}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/psfcalc.py#L702-L797", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Calculates the point spread function of a line-scanning confocal.", "language": "python", "parameters": "(x, y, z, normalize=False, kfki=0.889, zint=100.,\n        polar_angle=0., wrap=True, **kwargs)", "return_statement": "return hdet if normalize else hdet / hdet.sum()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ",", "arg_4", "=", "0.889", ",", "arg_5", "=", "100.", ",", "arg_6", "=", "0.", ",", "arg_7", "=", "True", ",", "**", "arg_8", ")", ":", "if", "arg_7", ":", "arg_9", "=", "vec_to_halfvec", "(", "arg_0", ")", "arg_10", "=", "vec_to_halfvec", "(", "arg_1", ")", "arg_11", ",", "arg_12", ",", "arg_13", "=", "np", ".", "meshgrid", "(", "arg_9", ",", "arg_10", ",", "arg_2", ",", "indexing", "=", "'ij'", ")", "else", ":", "arg_11", ",", "arg_12", ",", "arg_13", "=", "np", ".", "meshgrid", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "indexing", "=", "'ij'", ")", "arg_14", "=", "np", ".", "sqrt", "(", "arg_11", "*", "arg_11", "+", "arg_12", "*", "arg_12", ")", "if", "arg_7", ":", "arg_15", ",", "arg_16", "=", "np", ".", "meshgrid", "(", "arg_10", ",", "arg_2", ",", "indexing", "=", "'ij'", ")", "arg_17", "=", "calculate_linescan_ilm_psf", "(", "arg_15", ",", "arg_16", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "**", "arg_8", ")", "if", "arg_10", "[", "0", "]", "==", "0", ":", "arg_18", "=", "np", ".", "append", "(", "arg_17", "[", "-", "1", ":", "0", ":", "-", "1", "]", ",", "arg_17", ",", "axis", "=", "0", ")", "else", ":", "arg_18", "=", "np", ".", "append", "(", "arg_17", "[", ":", ":", "-", "1", "]", ",", "arg_17", ",", "axis", "=", "0", ")", "else", ":", "arg_15", ",", "arg_16", "=", "np", ".", "meshgrid", "(", "arg_1", ",", "arg_2", ",", "indexing", "=", "'ij'", ")", "arg_18", "=", "calculate_linescan_ilm_psf", "(", "arg_15", ",", "arg_16", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "**", "arg_8", ")", "if", "arg_7", ":", "arg_19", "=", "lambda", "*", "args", ":", "get_hsym_asym", "(", "arg_14", "*", "arg_4", ",", "arg_13", "*", "arg_4", ",", "arg_5", "=", "arg_4", "*", "arg_5", ",", "get_hdet", "=", "True", ",", "**", "arg_8", ")", "[", "0", "]", "arg_20", "=", "wrap_and_calc_psf", "(", "arg_9", ",", "arg_10", ",", "arg_2", ",", "arg_19", ")", "else", ":", "arg_20", ",", "arg_21", "=", "get_hsym_asym", "(", "arg_14", "*", "arg_4", ",", "arg_13", "*", "arg_4", ",", "arg_5", "=", "arg_4", "*", "arg_5", ",", "get_hdet", "=", "True", ",", "**", "arg_8", ")", "if", "arg_3", ":", "arg_18", "/=", "arg_18", ".", "sum", "(", ")", "arg_20", "/=", "arg_20", ".", "sum", "(", ")", "for", "arg_22", "in", "range", "(", "arg_0", ".", "size", ")", ":", "arg_20", "[", "arg_22", "]", "*=", "arg_18", "return", "arg_20", "if", "arg_3", "else", "arg_20", "/", "arg_20", ".", "sum", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=0.889, arg_5=100.,\n        arg_6=0., arg_7=True, **arg_8):\n    \"\"\"\n    Calculates the point spread function of a line-scanning confocal.\n\n    Make x,y,z  __1D__ numpy.arrays, with x the direction along the\n    scan line. (to make the calculation faster since I dont' need the line\n    ilm for each x).\n\n    Parameters\n    ----------\n        x : numpy.ndarray\n            _One_dimensional_ array of the x grid points (along the line\n            illumination) at which to evaluate the psf. In units of\n            1/k_incoming.\n        y : numpy.ndarray\n            _One_dimensional_ array of the y grid points (in plane,\n            perpendicular to the line illumination) at which to evaluate\n            the psf. In units of 1/k_incoming.\n        z : numpy.ndarray\n            _One_dimensional_ array of the z grid points (along the\n            optical axis) at which to evaluate the psf. In units of\n            1/k_incoming.\n        normalize : Bool, optional\n            Set to True to include the effects of PSF normalization on\n            the image intensity. Default is False.\n        kfki : Float, optional\n            The ratio of the final light's wavevector to the incoming.\n            Default is 0.889\n        zint : Float, optional\n            The position of the optical interface, in units of 1/k_incoming\n            Default is 100.\n        wrap : Bool, optional\n            If True, wraps the psf calculation for speed, assuming that\n            the input x, y are regularly-spaced points. If x,y are not\n            regularly spaced then `wrap` must be set to False. Default is True.\n        polar_angle : Float, optional\n            The polarization angle of the light (radians) with respect to\n            the line direction (x). Default is 0.\n\n    Other Parameters\n    ----------------\n        alpha : Float\n            The opening angle of the lens. Default is 1.\n        n2n1 : Float\n            The ratio of the index in the 2nd medium to that in the first.\n            Default is 0.95\n\n    Returns\n    -------\n        numpy.ndarray\n            A 3D- numpy.array of the point-spread function. Indexing is\n            psf[x,y,z]; shape is [x.size, y,size, z.size]\n    \"\"\"\n\n    #0. Set up vecs\n    if arg_7:\n        arg_9 = vec_to_halfvec(arg_0)\n        arg_10 = vec_to_halfvec(arg_1)\n        arg_11, arg_12, arg_13 = np.meshgrid(arg_9, arg_10, arg_2, indexing='ij')\n    else:\n        arg_11,arg_12,arg_13 = np.meshgrid(arg_0, arg_1, arg_2, indexing='ij')\n    arg_14 = np.sqrt(arg_11*arg_11 + arg_12*arg_12)\n\n    #1. Hilm\n    if arg_7:\n        arg_15,arg_16 = np.meshgrid(arg_10, arg_2, indexing='ij')\n        arg_17 = calculate_linescan_ilm_psf(arg_15, arg_16, arg_5=arg_5,\n                arg_6=arg_6, **arg_8)\n        if arg_10[0] == 0:\n            arg_18 = np.append(arg_17[-1:0:-1], arg_17, axis=0)\n        else:\n            arg_18 = np.append(arg_17[::-1], arg_17, axis=0)\n    else:\n        arg_15,arg_16 = np.meshgrid(arg_1, arg_2, indexing='ij')\n        arg_18 = calculate_linescan_ilm_psf(arg_15, arg_16, arg_5=arg_5,\n                arg_6=arg_6, **arg_8)\n\n    #2. Hdet\n    if arg_7:\n        #Lambda function that ignores its args but still returns correct values\n        arg_19 = lambda *args: get_hsym_asym(arg_14*arg_4, arg_13*arg_4, arg_5=arg_4*arg_5,\n                    get_hdet=True, **arg_8)[0]\n        arg_20 = wrap_and_calc_psf(arg_9, arg_10, arg_2, arg_19)\n    else:\n        arg_20, arg_21 = get_hsym_asym(arg_14*arg_4, arg_13*arg_4, arg_5=arg_4*arg_5,\n                get_hdet=True, **arg_8)\n\n    if arg_3:\n        arg_18 /= arg_18.sum()\n        arg_20 /= arg_20.sum()\n\n    for arg_22 in range(arg_0.size):\n        arg_20[arg_22] *= arg_18\n\n    return arg_20 if arg_3 else arg_20 / arg_20.sum()", "path": "peri/comp/psfcalc.py", "identifier": "calculate_linescan_psf", "docstring": "Calculates the point spread function of a line-scanning confocal.\n\n    Make x,y,z  __1D__ numpy.arrays, with x the direction along the\n    scan line. (to make the calculation faster since I dont' need the line\n    ilm for each x).\n\n    Parameters\n    ----------\n        x : numpy.ndarray\n            _One_dimensional_ array of the x grid points (along the line\n            illumination) at which to evaluate the psf. In units of\n            1/k_incoming.\n        y : numpy.ndarray\n            _One_dimensional_ array of the y grid points (in plane,\n            perpendicular to the line illumination) at which to evaluate\n            the psf. In units of 1/k_incoming.\n        z : numpy.ndarray\n            _One_dimensional_ array of the z grid points (along the\n            optical axis) at which to evaluate the psf. In units of\n            1/k_incoming.\n        normalize : Bool, optional\n            Set to True to include the effects of PSF normalization on\n            the image intensity. Default is False.\n        kfki : Float, optional\n            The ratio of the final light's wavevector to the incoming.\n            Default is 0.889\n        zint : Float, optional\n            The position of the optical interface, in units of 1/k_incoming\n            Default is 100.\n        wrap : Bool, optional\n            If True, wraps the psf calculation for speed, assuming that\n            the input x, y are regularly-spaced points. If x,y are not\n            regularly spaced then `wrap` must be set to False. Default is True.\n        polar_angle : Float, optional\n            The polarization angle of the light (radians) with respect to\n            the line direction (x). Default is 0.\n\n    Other Parameters\n    ----------------\n        alpha : Float\n            The opening angle of the lens. Default is 1.\n        n2n1 : Float\n            The ratio of the index in the 2nd medium to that in the first.\n            Default is 0.95\n\n    Returns\n    -------\n        numpy.ndarray\n            A 3D- numpy.array of the point-spread function. Indexing is\n            psf[x,y,z]; shape is [x.size, y,size, z.size]", "docstring_tokens": ["Calculates", "the", "point", "spread", "function", "of", "a", "line", "-", "scanning", "confocal", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 261181}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/transforms/functional.py#L597-L641", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "Adjust hue of an image.", "language": "python", "parameters": "(img, hue_factor)", "return_statement": "return img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "(", "-", "0.5", "<=", "arg_1", "<=", "0.5", ")", ":", "raise", "ValueError", "(", "'hue_factor is not in [-0.5, 0.5].'", ".", "format", "(", "arg_1", ")", ")", "if", "not", "_is_pil_image", "(", "arg_0", ")", ":", "raise", "TypeError", "(", "'img should be PIL Image. Got {}'", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")", "arg_2", "=", "arg_0", ".", "mode", "if", "arg_2", "in", "{", "'L'", ",", "'1'", ",", "'I'", ",", "'F'", "}", ":", "return", "arg_0", "arg_3", ",", "arg_4", ",", "arg_5", "=", "arg_0", ".", "convert", "(", "'HSV'", ")", ".", "split", "(", ")", "arg_6", "=", "np", ".", "array", "(", "arg_3", ",", "dtype", "=", "np", ".", "uint8", ")", "with", "np", ".", "errstate", "(", "over", "=", "'ignore'", ")", ":", "arg_6", "+=", "np", ".", "uint8", "(", "arg_1", "*", "255", ")", "arg_3", "=", "Image", ".", "fromarray", "(", "arg_6", ",", "'L'", ")", "arg_0", "=", "Image", ".", "merge", "(", "'HSV'", ",", "(", "arg_3", ",", "arg_4", ",", "arg_5", ")", ")", ".", "convert", "(", "arg_2", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Adjust hue of an image.\n\n    The image hue is adjusted by converting the image to HSV and\n    cyclically shifting the intensities in the hue channel (H).\n    The image is then converted back to original image mode.\n\n    `hue_factor` is the amount of shift in H channel and must be in the\n    interval `[-0.5, 0.5]`.\n\n    See `Hue`_ for more details.\n\n    .. _Hue: https://en.wikipedia.org/wiki/Hue\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        hue_factor (float):  How much to shift the hue channel. Should be in\n            [-0.5, 0.5]. 0.5 and -0.5 give complete reversal of hue channel in\n            HSV space in positive and negative direction respectively.\n            0 means no shift. Therefore, both -0.5 and 0.5 will give an image\n            with complementary colors while 0 gives the original image.\n\n    Returns:\n        PIL Image: Hue adjusted image.\n    \"\"\"\n    if not(-0.5 <= arg_1 <= 0.5):\n        raise ValueError('hue_factor is not in [-0.5, 0.5].'.format(arg_1))\n\n    if not _is_pil_image(arg_0):\n        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))\n\n    arg_2 = arg_0.mode\n    if arg_2 in {'L', '1', 'I', 'F'}:\n        return arg_0\n\n    arg_3, arg_4, arg_5 = arg_0.convert('HSV').split()\n\n    arg_6 = np.array(arg_3, dtype=np.uint8)\n    # uint8 addition take cares of rotation across boundaries\n    with np.errstate(over='ignore'):\n        arg_6 += np.uint8(arg_1 * 255)\n    arg_3 = Image.fromarray(arg_6, 'L')\n\n    arg_0 = Image.merge('HSV', (arg_3, arg_4, arg_5)).convert(arg_2)\n    return arg_0", "path": "torchvision/transforms/functional.py", "identifier": "adjust_hue", "docstring": "Adjust hue of an image.\n\n    The image hue is adjusted by converting the image to HSV and\n    cyclically shifting the intensities in the hue channel (H).\n    The image is then converted back to original image mode.\n\n    `hue_factor` is the amount of shift in H channel and must be in the\n    interval `[-0.5, 0.5]`.\n\n    See `Hue`_ for more details.\n\n    .. _Hue: https://en.wikipedia.org/wiki/Hue\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        hue_factor (float):  How much to shift the hue channel. Should be in\n            [-0.5, 0.5]. 0.5 and -0.5 give complete reversal of hue channel in\n            HSV space in positive and negative direction respectively.\n            0 means no shift. Therefore, both -0.5 and 0.5 will give an image\n            with complementary colors while 0 gives the original image.\n\n    Returns:\n        PIL Image: Hue adjusted image.", "docstring_tokens": ["Adjust", "hue", "of", "an", "image", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 261182}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/compiler/assembler.py#L255-L389", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Assemble a list of circuits or pulse schedules into a Qobj.", "language": "python", "parameters": "(experiments,\n             backend=None,\n             qobj_id=None, qobj_header=None,  # common run options\n             shots=1024, memory=False, max_credits=None, seed_simulator=None,\n             default_qubit_los=None, default_meas_los=None,  # schedule run options\n             schedule_los=None, meas_level=2, meas_return='avg',\n             memory_slots=None, memory_slot_size=100, rep_time=None, parameter_binds=None,\n             config=None, seed=None,  # deprecated\n             **run_config)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "1024", ",", "arg_5", "=", "False", ",", "arg_6", "=", "None", ",", "arg_7", "=", "None", ",", "arg_8", "=", "None", ",", "arg_9", "=", "None", ",", "arg_10", "=", "None", ",", "arg_11", "=", "2", ",", "arg_12", "=", "'avg'", ",", "arg_13", "=", "None", ",", "arg_14", "=", "100", ",", "arg_15", "=", "None", ",", "arg_16", "=", "None", ",", "arg_17", "=", "None", ",", "arg_18", "=", "None", ",", "**", "arg_19", ")", ":", "if", "arg_17", ":", "warnings", ".", "warn", "(", "'config is not used anymore. Set all configs in '", "'run_config.'", ",", "DeprecationWarning", ")", "arg_19", "=", "arg_19", "or", "arg_17", "if", "arg_18", ":", "warnings", ".", "warn", "(", "'seed is deprecated in favor of seed_simulator.'", ",", "DeprecationWarning", ")", "arg_7", "=", "arg_7", "or", "arg_18", "arg_0", "=", "arg_0", "if", "isinstance", "(", "arg_0", ",", "list", ")", "else", "[", "arg_0", "]", "arg_2", ",", "arg_3", ",", "arg_19", "=", "_parse_run_args", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_11", ",", "arg_12", ",", "arg_13", ",", "arg_14", ",", "arg_15", ",", "arg_16", ",", "**", "arg_19", ")", "if", "all", "(", "isinstance", "(", "arg_20", ",", "QuantumCircuit", ")", "for", "arg_20", "in", "arg_0", ")", ":", "arg_21", ",", "arg_19", "=", "_expand_parameters", "(", "circuits", "=", "arg_0", ",", "arg_19", "=", "arg_19", ")", "return", "Func_circuits", "(", "circuits", "=", "arg_21", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_19", "=", "arg_19", ")", "elif", "all", "(", "isinstance", "(", "arg_20", ",", "Schedule", ")", "for", "arg_20", "in", "arg_0", ")", ":", "return", "Func_schedules", "(", "schedules", "=", "arg_0", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_19", "=", "arg_19", ")", "else", ":", "raise", "QiskitError", "(", "\"bad input to Func() function; \"", "\"must be either circuits or schedules\"", ")"], "function": "def Func(arg_0,\n             arg_1=None,\n             arg_2=None, arg_3=None,  # common run options\n             arg_4=1024, arg_5=False, arg_6=None, arg_7=None,\n             arg_8=None, arg_9=None,  # schedule run options\n             arg_10=None, arg_11=2, arg_12='avg',\n             arg_13=None, arg_14=100, arg_15=None, arg_16=None,\n             arg_17=None, arg_18=None,  # deprecated\n             **arg_19):\n    \"\"\"Assemble a list of circuits or pulse schedules into a Qobj.\n\n    This function serializes the payloads, which could be either circuits or schedules,\n    to create Qobj \"experiments\". It further annotates the experiment payload with\n    header and configurations.\n\n    Args:\n        experiments (QuantumCircuit or list[QuantumCircuit] or Schedule or list[Schedule]):\n            Circuit(s) or pulse schedule(s) to execute\n\n        backend (BaseBackend):\n            If set, some runtime options are automatically grabbed from\n            backend.configuration() and backend.defaults().\n            If any other option is explicitly set (e.g. rep_rate), it\n            will override the backend's.\n            If any other options is set in the run_config, it will\n            also override the backend's.\n\n        qobj_id (str):\n            String identifier to annotate the Qobj\n\n        qobj_header (QobjHeader or dict):\n            User input that will be inserted in Qobj header, and will also be\n            copied to the corresponding Result header. Headers do not affect the run.\n\n        shots (int):\n            Number of repetitions of each circuit, for sampling. Default: 2014\n\n        memory (bool):\n            If True, per-shot measurement bitstrings are returned as well\n            (provided the backend supports it). For OpenPulse jobs, only\n            measurement level 2 supports this option. Default: False\n\n        max_credits (int):\n            Maximum credits to spend on job. Default: 10\n\n        seed_simulator (int):\n            Random seed to control sampling, for when backend is a simulator\n\n        default_qubit_los (list):\n            List of default qubit lo frequencies\n\n        default_meas_los (list):\n            List of default meas lo frequencies\n\n        schedule_los (None or list[Union[Dict[PulseChannel, float], LoConfig]] or\n                      Union[Dict[PulseChannel, float], LoConfig]):\n            Experiment LO configurations\n\n        meas_level (int):\n            Set the appropriate level of the measurement output for pulse experiments.\n\n        meas_return (str):\n            Level of measurement data for the backend to return\n            For `meas_level` 0 and 1:\n                \"single\" returns information from every shot.\n                \"avg\" returns average measurement output (averaged over number of shots).\n\n        memory_slots (int):\n            Number of classical memory slots used in this job.\n\n        memory_slot_size (int):\n            Size of each memory slot if the output is Level 0.\n\n        rep_time (int): repetition time of the experiment in \u03bcs.\n            The delay between experiments will be rep_time.\n            Must be from the list provided by the device.\n\n        parameter_binds (list[dict{Parameter: Value}]):\n            List of Parameter bindings over which the set of experiments will be\n            executed. Each list element (bind) should be of the form\n            {Parameter1: value1, Parameter2: value2, ...}. All binds will be\n            executed across all experiments, e.g. if parameter_binds is a\n            length-n list, and there are m experiments, a total of m x n\n            experiments will be run (one for each experiment/bind pair).\n\n        seed (int):\n            DEPRECATED in 0.8: use ``seed_simulator`` kwarg instead\n\n        config (dict):\n            DEPRECATED in 0.8: use run_config instead\n\n        run_config (dict):\n            extra arguments used to configure the run (e.g. for Aer configurable backends)\n            Refer to the backend documentation for details on these arguments\n\n    Returns:\n        Qobj: a qobj which can be run on a backend. Depending on the type of input,\n            this will be either a QasmQobj or a PulseQobj.\n\n    Raises:\n        QiskitError: if the input cannot be interpreted as either circuits or schedules\n    \"\"\"\n    # deprecation matter\n    if arg_17:\n        warnings.warn('config is not used anymore. Set all configs in '\n                      'run_config.', DeprecationWarning)\n        arg_19 = arg_19 or arg_17\n    if arg_18:\n        warnings.warn('seed is deprecated in favor of seed_simulator.', DeprecationWarning)\n        arg_7 = arg_7 or arg_18\n\n    # Get RunConfig(s) that will be inserted in Qobj to configure the run\n    arg_0 = arg_0 if isinstance(arg_0, list) else [arg_0]\n    arg_2, arg_3, arg_19 = _parse_run_args(arg_1, arg_2, arg_3,\n                                                       arg_4, arg_5, arg_6, arg_7,\n                                                       arg_8, arg_9,\n                                                       arg_10, arg_11, arg_12,\n                                                       arg_13, arg_14, arg_15,\n                                                       arg_16, **arg_19)\n\n    # Func either circuits or schedules\n    if all(isinstance(arg_20, QuantumCircuit) for arg_20 in arg_0):\n        # If circuits are parameterized, bind parameters and remove from run_config\n        arg_21, arg_19 = _expand_parameters(circuits=arg_0,\n                                                           arg_19=arg_19)\n        return Func_circuits(circuits=arg_21, arg_2=arg_2,\n                                 arg_3=arg_3, arg_19=arg_19)\n\n    elif all(isinstance(arg_20, Schedule) for arg_20 in arg_0):\n        return Func_schedules(schedules=arg_0, arg_2=arg_2,\n                                  arg_3=arg_3, arg_19=arg_19)\n\n    else:\n        raise QiskitError(\"bad input to Func() function; \"\n                          \"must be either circuits or schedules\")", "path": "qiskit/compiler/assembler.py", "identifier": "assemble", "docstring": "Assemble a list of circuits or pulse schedules into a Qobj.\n\n    This function serializes the payloads, which could be either circuits or schedules,\n    to create Qobj \"experiments\". It further annotates the experiment payload with\n    header and configurations.\n\n    Args:\n        experiments (QuantumCircuit or list[QuantumCircuit] or Schedule or list[Schedule]):\n            Circuit(s) or pulse schedule(s) to execute\n\n        backend (BaseBackend):\n            If set, some runtime options are automatically grabbed from\n            backend.configuration() and backend.defaults().\n            If any other option is explicitly set (e.g. rep_rate), it\n            will override the backend's.\n            If any other options is set in the run_config, it will\n            also override the backend's.\n\n        qobj_id (str):\n            String identifier to annotate the Qobj\n\n        qobj_header (QobjHeader or dict):\n            User input that will be inserted in Qobj header, and will also be\n            copied to the corresponding Result header. Headers do not affect the run.\n\n        shots (int):\n            Number of repetitions of each circuit, for sampling. Default: 2014\n\n        memory (bool):\n            If True, per-shot measurement bitstrings are returned as well\n            (provided the backend supports it). For OpenPulse jobs, only\n            measurement level 2 supports this option. Default: False\n\n        max_credits (int):\n            Maximum credits to spend on job. Default: 10\n\n        seed_simulator (int):\n            Random seed to control sampling, for when backend is a simulator\n\n        default_qubit_los (list):\n            List of default qubit lo frequencies\n\n        default_meas_los (list):\n            List of default meas lo frequencies\n\n        schedule_los (None or list[Union[Dict[PulseChannel, float], LoConfig]] or\n                      Union[Dict[PulseChannel, float], LoConfig]):\n            Experiment LO configurations\n\n        meas_level (int):\n            Set the appropriate level of the measurement output for pulse experiments.\n\n        meas_return (str):\n            Level of measurement data for the backend to return\n            For `meas_level` 0 and 1:\n                \"single\" returns information from every shot.\n                \"avg\" returns average measurement output (averaged over number of shots).\n\n        memory_slots (int):\n            Number of classical memory slots used in this job.\n\n        memory_slot_size (int):\n            Size of each memory slot if the output is Level 0.\n\n        rep_time (int): repetition time of the experiment in \u03bcs.\n            The delay between experiments will be rep_time.\n            Must be from the list provided by the device.\n\n        parameter_binds (list[dict{Parameter: Value}]):\n            List of Parameter bindings over which the set of experiments will be\n            executed. Each list element (bind) should be of the form\n            {Parameter1: value1, Parameter2: value2, ...}. All binds will be\n            executed across all experiments, e.g. if parameter_binds is a\n            length-n list, and there are m experiments, a total of m x n\n            experiments will be run (one for each experiment/bind pair).\n\n        seed (int):\n            DEPRECATED in 0.8: use ``seed_simulator`` kwarg instead\n\n        config (dict):\n            DEPRECATED in 0.8: use run_config instead\n\n        run_config (dict):\n            extra arguments used to configure the run (e.g. for Aer configurable backends)\n            Refer to the backend documentation for details on these arguments\n\n    Returns:\n        Qobj: a qobj which can be run on a backend. Depending on the type of input,\n            this will be either a QasmQobj or a PulseQobj.\n\n    Raises:\n        QiskitError: if the input cannot be interpreted as either circuits or schedules", "docstring_tokens": ["Assemble", "a", "list", "of", "circuits", "or", "pulse", "schedules", "into", "a", "Qobj", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 261183}
{"url": "https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/mysql.py#L165-L178", "sha": "a92b0a8e5206850bb777c74af8421ea8b33779bd", "docstring_summary": "Enters the root password prompt entries into the debconf cache\n        so we can set them without user interaction.", "language": "python", "parameters": "(self, password=None, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "database_renderer", "(", "**", "arg_2", ")", "arg_3", ".", "env", ".", "root_password", "=", "arg_1", "or", "arg_3", ".", "genv", ".", "get", "(", "'db_root_password'", ")", "arg_3", ".", "sudo", "(", "\"DEBIAN_FRONTEND=noninteractive dpkg --configure -a\"", ")", "arg_3", ".", "sudo", "(", "\"debconf-set-selections <<< 'mysql-server mysql-server/root_password password {root_password}'\"", ")", "arg_3", ".", "sudo", "(", "\"debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password {root_password}'\"", ")"], "function": "def Func(arg_0, arg_1=None, **arg_2):\n        \"\"\"\n        Enters the root password prompt entries into the debconf cache\n        so we can set them without user interaction.\n\n        We keep this process separate from set_root_password() because we also need to do\n        this before installing the base MySQL package, because that will also prompt the user\n        for a root login.\n        \"\"\"\n        arg_3 = arg_0.database_renderer(**arg_2)\n        arg_3.env.root_password = arg_1 or arg_3.genv.get('db_root_password')\n        arg_3.sudo(\"DEBIAN_FRONTEND=noninteractive dpkg --configure -a\")\n        arg_3.sudo(\"debconf-set-selections <<< 'mysql-server mysql-server/root_password password {root_password}'\")\n        arg_3.sudo(\"debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password {root_password}'\")", "path": "burlap/mysql.py", "identifier": "MySQLSatchel.prep_root_password", "docstring": "Enters the root password prompt entries into the debconf cache\n        so we can set them without user interaction.\n\n        We keep this process separate from set_root_password() because we also need to do\n        this before installing the base MySQL package, because that will also prompt the user\n        for a root login.", "docstring_tokens": ["Enters", "the", "root", "password", "prompt", "entries", "into", "the", "debconf", "cache", "so", "we", "can", "set", "them", "without", "user", "interaction", "."], "nwo": "chrisspen/burlap", "score": 0.5077900286616083, "idx": 261184}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/aio/async_client.py#L593-L647", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Get a Receiver for the deadletter endpoint of the entity.", "language": "python", "parameters": "(\n            self, transfer_deadletter=False, prefetch=0,\n            mode=ReceiveSettleMode.PeekLock, idle_timeout=0, **kwargs)", "return_statement": "return Receiver(\n            handler_id,\n            entity_uri,\n            self.auth_config,\n            loop=self.loop,\n            debug=self.debug,\n            timeout=int(idle_timeout * 1000),\n            prefetch=prefetch,\n            mode=mode,\n            **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "0", ",", "arg_3", "=", "arg_4", ".", "PeekLock", ",", "arg_6", "=", "0", ",", "**", "arg_7", ")", ":", "if", "int", "(", "arg_2", ")", "<", "0", "or", "int", "(", "arg_2", ")", ">", "50000", ":", "raise", "ValueError", "(", "\"Prefetch must be an integer between 0 and 50000 inclusive.\"", ")", "arg_2", "+=", "1", "arg_8", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "if", "arg_1", ":", "arg_9", "=", "arg_0", ".", "mgmt_client", ".", "format_transfer_dead_letter_queue_name", "(", "arg_0", ".", "entity_uri", ")", "else", ":", "arg_9", "=", "arg_0", ".", "mgmt_client", ".", "format_dead_letter_queue_name", "(", "arg_0", ".", "entity_uri", ")", "return", "Receiver", "(", "arg_8", ",", "arg_9", ",", "arg_0", ".", "auth_config", ",", "loop", "=", "arg_0", ".", "loop", ",", "debug", "=", "arg_0", ".", "debug", ",", "timeout", "=", "int", "(", "arg_6", "*", "1000", ")", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "**", "arg_7", ")"], "function": "def Func(\n            arg_0, arg_1=False, arg_2=0,\n            arg_3=arg_4.PeekLock, arg_6=0, **arg_7):\n        \"\"\"Get a Receiver for the deadletter endpoint of the entity.\n\n        A Receiver represents a single open connection with which multiple receive operations can be made.\n\n        :param transfer_deadletter: Whether to connect to the transfer deadletter queue, or the standard\n         deadletter queue. Default is False, using the standard deadletter endpoint.\n        :type transfer_deadletter: bool\n        :param prefetch: The maximum number of messages to cache with each request to the service.\n         The default value is 0, meaning messages will be received from the service and processed\n         one at a time. Increasing this value will improve message throughput performance but increase\n         the change that messages will expire while they are cached if they're not processed fast enough.\n        :type prefetch: int\n        :param mode: The mode with which messages will be retrieved from the entity. The two options\n         are PeekLock and ReceiveAndDelete. Messages received with PeekLock must be settled within a given\n         lock period before they will be removed from the queue. Messages received with ReceiveAndDelete\n         will be immediately removed from the queue, and cannot be subsequently rejected or re-received if\n         the client fails to process the message. The default mode is PeekLock.\n        :type mode: ~azure.servicebus.common.constants.ReceiveSettleMode\n        :param idle_timeout: The timeout in seconds between received messages after which the receiver will\n         automatically shutdown. The default value is 0, meaning no timeout.\n        :type idle_timeout: int\n        :returns: A Receiver instance with an unopened Connection.\n        :rtype: ~azure.servicebus.aio.async_receive_handler.Receiver\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START receiver_deadletter_messages]\n                :end-before: [END receiver_deadletter_messages]\n                :language: python\n                :dedent: 4\n                :caption: Receive dead-lettered messages.\n\n        \"\"\"\n        if int(arg_2) < 0 or int(arg_2) > 50000:\n            raise ValueError(\"Prefetch must be an integer between 0 and 50000 inclusive.\")\n\n        arg_2 += 1\n        arg_8 = str(uuid.uuid4())\n        if arg_1:\n            arg_9 = arg_0.mgmt_client.format_transfer_dead_letter_queue_name(arg_0.entity_uri)\n        else:\n            arg_9 = arg_0.mgmt_client.format_dead_letter_queue_name(arg_0.entity_uri)\n        return Receiver(\n            arg_8,\n            arg_9,\n            arg_0.auth_config,\n            loop=arg_0.loop,\n            debug=arg_0.debug,\n            timeout=int(arg_6 * 1000),\n            arg_2=arg_2,\n            arg_3=arg_3,\n            **arg_7)", "path": "azure-servicebus/azure/servicebus/aio/async_client.py", "identifier": "ReceiveClientMixin.get_deadletter_receiver", "docstring": "Get a Receiver for the deadletter endpoint of the entity.\n\n        A Receiver represents a single open connection with which multiple receive operations can be made.\n\n        :param transfer_deadletter: Whether to connect to the transfer deadletter queue, or the standard\n         deadletter queue. Default is False, using the standard deadletter endpoint.\n        :type transfer_deadletter: bool\n        :param prefetch: The maximum number of messages to cache with each request to the service.\n         The default value is 0, meaning messages will be received from the service and processed\n         one at a time. Increasing this value will improve message throughput performance but increase\n         the change that messages will expire while they are cached if they're not processed fast enough.\n        :type prefetch: int\n        :param mode: The mode with which messages will be retrieved from the entity. The two options\n         are PeekLock and ReceiveAndDelete. Messages received with PeekLock must be settled within a given\n         lock period before they will be removed from the queue. Messages received with ReceiveAndDelete\n         will be immediately removed from the queue, and cannot be subsequently rejected or re-received if\n         the client fails to process the message. The default mode is PeekLock.\n        :type mode: ~azure.servicebus.common.constants.ReceiveSettleMode\n        :param idle_timeout: The timeout in seconds between received messages after which the receiver will\n         automatically shutdown. The default value is 0, meaning no timeout.\n        :type idle_timeout: int\n        :returns: A Receiver instance with an unopened Connection.\n        :rtype: ~azure.servicebus.aio.async_receive_handler.Receiver\n\n        Example:\n            .. literalinclude:: ../examples/async_examples/test_examples_async.py\n                :start-after: [START receiver_deadletter_messages]\n                :end-before: [END receiver_deadletter_messages]\n                :language: python\n                :dedent: 4\n                :caption: Receive dead-lettered messages.", "docstring_tokens": ["Get", "a", "Receiver", "for", "the", "deadletter", "endpoint", "of", "the", "entity", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 261185}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L75-L78", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "write back json response", "language": "python", "parameters": "(self, response)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "write", "(", "tornado", ".", "escape", ".", "json_encode", "(", "arg_1", ")", ")", "arg_0", ".", "set_header", "(", "\"Content-Type\"", ",", "\"application/json\"", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\" write back json response \"\"\"\n    arg_0.write(tornado.escape.json_encode(arg_1))\n    arg_0.set_header(\"Content-Type\", \"application/json\")", "path": "heron/tools/tracker/src/python/handlers/basehandler.py", "identifier": "BaseHandler.write_json_response", "docstring": "write back json response", "docstring_tokens": ["write", "back", "json", "response"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 261186}
{"url": "https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/config.py#L80-L92", "sha": "195d69816fb5a6e1e9ab0ab66b606b1248b4780d", "docstring_summary": "Path to certificate related files, either a single file path or a\n    tuple. In the case of no security, returns None.", "language": "python", "parameters": "()", "return_statement": "return None", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "security_type", "(", ")", "if", "arg_0", "==", "'pem'", ":", "return", "get_config_value", "(", "'pem_path'", ",", "fallback", "=", "None", ")", "if", "arg_0", "==", "'cert'", ":", "arg_1", "=", "get_config_value", "(", "'cert_path'", ",", "fallback", "=", "None", ")", "arg_2", "=", "get_config_value", "(", "'key_path'", ",", "fallback", "=", "None", ")", "return", "arg_1", ",", "arg_2", "return", "None"], "function": "def Func():\n    \"\"\"Path to certificate related files, either a single file path or a\n    tuple. In the case of no security, returns None.\"\"\"\n\n    arg_0 = security_type()\n    if arg_0 == 'pem':\n        return get_config_value('pem_path', fallback=None)\n    if arg_0 == 'cert':\n        arg_1 = get_config_value('cert_path', fallback=None)\n        arg_2 = get_config_value('key_path', fallback=None)\n        return arg_1, arg_2\n\n    return None", "path": "rcctl/rcctl/config.py", "identifier": "cert_info", "docstring": "Path to certificate related files, either a single file path or a\n    tuple. In the case of no security, returns None.", "docstring_tokens": ["Path", "to", "certificate", "related", "files", "either", "a", "single", "file", "path", "or", "a", "tuple", ".", "In", "the", "case", "of", "no", "security", "returns", "None", "."], "nwo": "shalabhms/reliable-collections-cli", "score": 0.17553651708052445, "idx": 261187}
{"url": "https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L6-L27", "sha": "8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a", "docstring_summary": "Transforms predictions into probability values.", "language": "python", "parameters": "(logits)", "return_statement": "return e / np.sum(e)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "arg_0", ".", "ndim", "==", "1", "arg_0", "=", "arg_0", "-", "np", ".", "max", "(", "arg_0", ")", "arg_1", "=", "np", ".", "exp", "(", "arg_0", ")", "return", "arg_1", "/", "np", ".", "sum", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"Transforms predictions into probability values.\n\n    Parameters\n    ----------\n    logits : array_like\n        The logits predicted by the model.\n\n    Returns\n    -------\n    `numpy.ndarray`\n        Probability values corresponding to the logits.\n    \"\"\"\n\n    assert arg_0.ndim == 1\n\n    # for numerical reasons we subtract the max logit\n    # (mathematically it doesn't matter!)\n    # otherwise exp(logits) might become too large or too small\n    arg_0 = arg_0 - np.max(arg_0)\n    arg_1 = np.exp(arg_0)\n    return arg_1 / np.sum(arg_1)", "path": "foolbox/utils.py", "identifier": "softmax", "docstring": "Transforms predictions into probability values.\n\n    Parameters\n    ----------\n    logits : array_like\n        The logits predicted by the model.\n\n    Returns\n    -------\n    `numpy.ndarray`\n        Probability values corresponding to the logits.", "docstring_tokens": ["Transforms", "predictions", "into", "probability", "values", "."], "nwo": "bethgelab/foolbox", "score": 0.9736489737470888, "idx": 261188}
{"url": "https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L138-L148", "sha": "c60baf8043e4da8d8d66da7575021c2f4c6c78af", "docstring_summary": "Return list of array references in AST.", "language": "python", "parameters": "(ast, node_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "type", "(", "arg_0", ")", "is", "arg_1", ":", "return", "[", "arg_0", "]", "elif", "type", "(", "arg_0", ")", "is", "list", ":", "return", "reduce", "(", "operator", ".", "add", ",", "list", "(", "map", "(", "lambda", "a", ":", "Func", "(", "a", ",", "arg_1", ")", ",", "arg_0", ")", ")", ",", "[", "]", ")", "elif", "arg_0", "is", "None", ":", "return", "[", "]", "else", ":", "return", "reduce", "(", "operator", ".", "add", ",", "[", "Func", "(", "arg_2", "[", "1", "]", ",", "arg_1", ")", "for", "arg_2", "in", "arg_0", ".", "children", "(", ")", "]", ",", "[", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Return list of array references in AST.\"\"\"\n    if type(arg_0) is arg_1:\n        return [arg_0]\n    elif type(arg_0) is list:\n        return reduce(operator.add, list(map(lambda a: Func(a, arg_1), arg_0)), [])\n    elif arg_0 is None:\n        return []\n    else:\n        return reduce(operator.add,\n                      [Func(arg_2[1], arg_1) for arg_2 in arg_0.children()], [])", "path": "kerncraft/kernel.py", "identifier": "find_node_type", "docstring": "Return list of array references in AST.", "docstring_tokens": ["Return", "list", "of", "array", "references", "in", "AST", "."], "nwo": "RRZE-HPC/kerncraft", "score": 0.3938336572392353, "idx": 261189}
{"url": "https://github.com/cyberdelia/metrology/blob/7599bea7de1fd59374c06e2f8041a217e3cf9c01/metrology/instruments/derive.py#L20-L28", "sha": "7599bea7de1fd59374c06e2f8041a217e3cf9c01", "docstring_summary": "Record an event with the derive.", "language": "python", "parameters": "(self, value=1)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "1", ")", ":", "arg_2", "=", "arg_0", ".", "last", ".", "get_and_set", "(", "arg_1", ")", "if", "arg_2", "<=", "arg_1", ":", "arg_1", "=", "arg_1", "-", "arg_2", "super", "(", "Derive", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=1):\n        \"\"\"Record an event with the derive.\n\n        :param value: counter value to record\n        \"\"\"\n        arg_2 = arg_0.last.get_and_set(arg_1)\n        if arg_2 <= arg_1:\n            arg_1 = arg_1 - arg_2\n        super(Derive, arg_0).Func(arg_1)", "path": "metrology/instruments/derive.py", "identifier": "Derive.mark", "docstring": "Record an event with the derive.\n\n        :param value: counter value to record", "docstring_tokens": ["Record", "an", "event", "with", "the", "derive", "."], "nwo": "cyberdelia/metrology", "score": 0.49807038967310463, "idx": 261190}
{"url": "https://github.com/nir0s/ghost/blob/77da967a4577ca4cf100cfe34e87b39ad88bf21c/ghost.py#L1031-L1042", "sha": "77da967a4577ca4cf100cfe34e87b39ad88bf21c", "docstring_summary": "Create a bucket.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "client", ".", "create_bucket", "(", "Bucket", "=", "arg_0", ".", "db_path", ",", "CreateBucketConfiguration", "=", "arg_0", ".", "bucket_configuration", ")", "except", "botocore", ".", "exceptions", ".", "ClientError", "as", "e", ":", "if", "'BucketAlreadyOwnedByYou'", "not", "in", "str", "(", "e", ".", "response", "[", "'Error'", "]", "[", "'Code'", "]", ")", ":", "raise", "e"], "function": "def Func(arg_0):\n        \"\"\"Create a bucket.\n        \"\"\"\n        try:\n            arg_0.client.create_bucket(\n                Bucket=arg_0.db_path,\n                CreateBucketConfiguration=arg_0.bucket_configuration)\n        except botocore.exceptions.ClientError as e:\n            # If the bucket already exists\n            if 'BucketAlreadyOwnedByYou' not in str(\n                    e.response['Error']['Code']):\n                raise e", "path": "ghost.py", "identifier": "S3Storage.init", "docstring": "Create a bucket.", "docstring_tokens": ["Create", "a", "bucket", "."], "nwo": "nir0s/ghost", "score": 0.38293700229723676, "idx": 261191}
{"url": "https://github.com/bakwc/PySyncObj/blob/be3b0aaa932d5156f5df140c23c962430f51b7b8/pysyncobj/syncobj.py#L664-L668", "sha": "be3b0aaa932d5156f5df140c23c962430f51b7b8", "docstring_summary": "Dumps different debug info about cluster to default logger", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "getStatus", "(", ")", "for", "arg_2", ",", "arg_3", "in", "iteritems", "(", "arg_1", ")", ":", "logging", ".", "info", "(", "'%s: %s'", "%", "(", "str", "(", "arg_2", ")", ",", "str", "(", "arg_3", ")", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Dumps different debug info about cluster to default logger\"\"\"\n        arg_1 = arg_0.getStatus()\n        for arg_2, arg_3 in iteritems(arg_1):\n            logging.info('%s: %s' % (str(arg_2), str(arg_3)))", "path": "pysyncobj/syncobj.py", "identifier": "SyncObj.printStatus", "docstring": "Dumps different debug info about cluster to default logger", "docstring_tokens": ["Dumps", "different", "debug", "info", "about", "cluster", "to", "default", "logger"], "nwo": "bakwc/PySyncObj", "score": 0.7477979215817477, "idx": 261192}
{"url": "https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/modifiers.py#L111-L139", "sha": "b1c6aa159ab380a033740f4aa392cf0d125e0ac6", "docstring_summary": "A modifier hook function.  This is called in reverse-priority\n        order after invoking the ``Action`` for the step.  This allows\n        a modifier to inspect or alter the result of the step.", "language": "python", "parameters": "(self, ctxt, result, action, post_mod, pre_mod)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_2", ".", "ignore", "=", "arg_0", ".", "config", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n        \"\"\"\n        A modifier hook function.  This is called in reverse-priority\n        order after invoking the ``Action`` for the step.  This allows\n        a modifier to inspect or alter the result of the step.\n\n        :param ctxt: The context object.\n        :param result: The result of the action.  This will be a\n                       ``StepResult`` object.\n        :param action: The action that was performed.\n        :param post_mod: A list of modifiers following this modifier\n                         in the list of modifiers that is applicable\n                         to the action.  This list is in priority\n                         order.\n        :param pre_mod: A list of modifiers preceding this modifier in\n                        the list of modifiers that is applicable to\n                        the action.  This list is in priority order.\n\n        :returns: The result for the action, optionally modified.  If\n                  the result is not modified, ``result`` must be\n                  returned unchanged.  This implementation alters the\n                  ``ignore`` property of the ``result`` object to\n                  match the configured value.\n        \"\"\"\n\n        # Set the ignore state\n        arg_2.ignore = arg_0.config\n\n        return arg_2", "path": "timid/modifiers.py", "identifier": "IgnoreErrorsModifier.post_call", "docstring": "A modifier hook function.  This is called in reverse-priority\n        order after invoking the ``Action`` for the step.  This allows\n        a modifier to inspect or alter the result of the step.\n\n        :param ctxt: The context object.\n        :param result: The result of the action.  This will be a\n                       ``StepResult`` object.\n        :param action: The action that was performed.\n        :param post_mod: A list of modifiers following this modifier\n                         in the list of modifiers that is applicable\n                         to the action.  This list is in priority\n                         order.\n        :param pre_mod: A list of modifiers preceding this modifier in\n                        the list of modifiers that is applicable to\n                        the action.  This list is in priority order.\n\n        :returns: The result for the action, optionally modified.  If\n                  the result is not modified, ``result`` must be\n                  returned unchanged.  This implementation alters the\n                  ``ignore`` property of the ``result`` object to\n                  match the configured value.", "docstring_tokens": ["A", "modifier", "hook", "function", ".", "This", "is", "called", "in", "reverse", "-", "priority", "order", "after", "invoking", "the", "Action", "for", "the", "step", ".", "This", "allows", "a", "modifier", "to", "inspect", "or", "alter", "the", "result", "of", "the", "step", "."], "nwo": "rackerlabs/timid", "score": 0.0, "idx": 261193}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L535-L565", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Given a series of expression AST nodes, create a function AST node\n    with the given name that can be called and will return the result of\n    the final expression in the input body nodes.", "language": "python", "parameters": "(\n    body: GeneratedPyAST,\n    fn_name: str,\n    args: Optional[Iterable[ast.arg]] = None,\n    vargs: Optional[ast.arg] = None,\n)", "return_statement": "return ast.FunctionDef(\n        name=fn_name,\n        args=ast.arguments(\n            args=args,\n            kwarg=None,\n            vararg=vargs,\n            kwonlyargs=[],\n            defaults=[],\n            kw_defaults=[],\n        ),\n        body=body_nodes,\n        decorator_list=[],\n        returns=None,\n    )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ",", "arg_4", ":", "arg_5", "[", "arg_6", "[", "arg_7", ".", "arg", "]", "]", "=", "None", ",", "arg_9", ":", "arg_5", "[", "arg_7", ".", "arg", "]", "=", "None", ",", ")", "->", "arg_7", ".", "FunctionDef", ":", "arg_4", "=", "Maybe", "(", "arg_4", ")", ".", "or_else_get", "(", "[", "]", ")", "arg_10", ":", "List", "[", "arg_7", ".", "AST", "]", "=", "list", "(", "map", "(", "statementize", ",", "arg_0", ".", "dependencies", ")", ")", "arg_10", ".", "append", "(", "arg_7", ".", "Return", "(", "value", "=", "arg_0", ".", "node", ")", ")", "return", "arg_7", ".", "FunctionDef", "(", "name", "=", "arg_2", ",", "arg_4", "=", "arg_7", ".", "arguments", "(", "arg_4", "=", "arg_4", ",", "kwarg", "=", "None", ",", "vararg", "=", "arg_9", ",", "kwonlyargs", "=", "[", "]", ",", "defaults", "=", "[", "]", ",", "kw_defaults", "=", "[", "]", ",", ")", ",", "arg_0", "=", "arg_10", ",", "decorator_list", "=", "[", "]", ",", "returns", "=", "None", ",", ")"], "function": "def Func(\n    arg_0: arg_1,\n    arg_2: arg_3,\n    arg_4: arg_5[arg_6[arg_7.arg]] = None,\n    arg_9: arg_5[arg_7.arg] = None,\n) -> arg_7.FunctionDef:\n    \"\"\"Given a series of expression AST nodes, create a function AST node\n    with the given name that can be called and will return the result of\n    the final expression in the input body nodes.\n\n    This helps to fix the impedance mismatch of Python, which includes\n    statements and expressions, and Lisps, which have only expressions.\n    \"\"\"\n    arg_4 = Maybe(arg_4).or_else_get([])\n    arg_10: List[arg_7.AST] = list(map(statementize, arg_0.dependencies))\n    arg_10.append(arg_7.Return(value=arg_0.node))\n\n    return arg_7.FunctionDef(\n        name=arg_2,\n        arg_4=arg_7.arguments(\n            arg_4=arg_4,\n            kwarg=None,\n            vararg=arg_9,\n            kwonlyargs=[],\n            defaults=[],\n            kw_defaults=[],\n        ),\n        arg_0=arg_10,\n        decorator_list=[],\n        returns=None,\n    )", "path": "src/basilisp/lang/compiler/generator.py", "identifier": "expressionize", "docstring": "Given a series of expression AST nodes, create a function AST node\n    with the given name that can be called and will return the result of\n    the final expression in the input body nodes.\n\n    This helps to fix the impedance mismatch of Python, which includes\n    statements and expressions, and Lisps, which have only expressions.", "docstring_tokens": ["Given", "a", "series", "of", "expression", "AST", "nodes", "create", "a", "function", "AST", "node", "with", "the", "given", "name", "that", "can", "be", "called", "and", "will", "return", "the", "result", "of", "the", "final", "expression", "in", "the", "input", "body", "nodes", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 261194}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1064-L1111", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Plots a cake chart of the long and short exposure.", "language": "python", "parameters": "(returns, positions, ax=None, **kwargs)", "return_statement": "return ax", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "**", "arg_3", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "plt", ".", "gca", "(", ")", "arg_4", "=", "arg_1", ".", "drop", "(", "'cash'", ",", "axis", "=", "1", ")", "arg_5", "=", "arg_4", "[", "arg_4", ">", "0", "]", ".", "sum", "(", "axis", "=", "1", ")", "/", "arg_1", ".", "sum", "(", "axis", "=", "1", ")", "arg_6", "=", "arg_4", "[", "arg_4", "<", "0", "]", ".", "sum", "(", "axis", "=", "1", ")", "/", "arg_1", ".", "sum", "(", "axis", "=", "1", ")", "arg_7", "=", "arg_4", ".", "sum", "(", "axis", "=", "1", ")", "/", "arg_1", ".", "sum", "(", "axis", "=", "1", ")", "arg_2", ".", "fill_between", "(", "arg_5", ".", "index", ",", "0", ",", "arg_5", ".", "values", ",", "label", "=", "'Long'", ",", "color", "=", "'green'", ",", "alpha", "=", "0.5", ")", "arg_2", ".", "fill_between", "(", "arg_6", ".", "index", ",", "0", ",", "arg_6", ".", "values", ",", "label", "=", "'Short'", ",", "color", "=", "'red'", ",", "alpha", "=", "0.5", ")", "arg_2", ".", "plot", "(", "arg_7", ".", "index", ",", "arg_7", ".", "values", ",", "label", "=", "'Net'", ",", "color", "=", "'black'", ",", "linestyle", "=", "'dotted'", ")", "arg_2", ".", "set_xlim", "(", "(", "arg_0", ".", "index", "[", "0", "]", ",", "arg_0", ".", "index", "[", "-", "1", "]", ")", ")", "arg_2", ".", "set_title", "(", "\"Exposure\"", ")", "arg_2", ".", "set_ylabel", "(", "'Exposure'", ")", "arg_2", ".", "legend", "(", "loc", "=", "'lower left'", ",", "frameon", "=", "True", ",", "framealpha", "=", "0.5", ")", "arg_2", ".", "set_xlabel", "(", "''", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2=None, **arg_3):\n    \"\"\"\n    Plots a cake chart of the long and short exposure.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions_alloc : pd.DataFrame\n        Portfolio allocation of positions. See\n        pos.get_percent_alloc.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.\n    \"\"\"\n\n    if arg_2 is None:\n        arg_2 = plt.gca()\n\n    arg_4 = arg_1.drop('cash', axis=1)\n    arg_5 = arg_4[arg_4 > 0].sum(axis=1) / arg_1.sum(axis=1)\n    arg_6 = arg_4[arg_4 < 0].sum(axis=1) / arg_1.sum(axis=1)\n    arg_7 = arg_4.sum(axis=1) / arg_1.sum(axis=1)\n\n    arg_2.fill_between(arg_5.index,\n                    0,\n                    arg_5.values,\n                    label='Long', color='green', alpha=0.5)\n    arg_2.fill_between(arg_6.index,\n                    0,\n                    arg_6.values,\n                    label='Short', color='red', alpha=0.5)\n    arg_2.plot(arg_7.index, arg_7.values,\n            label='Net', color='black', linestyle='dotted')\n\n    arg_2.set_xlim((arg_0.index[0], arg_0.index[-1]))\n    arg_2.set_title(\"Exposure\")\n    arg_2.set_ylabel('Exposure')\n    arg_2.legend(loc='lower left', frameon=True, framealpha=0.5)\n    arg_2.set_xlabel('')\n    return arg_2", "path": "pyfolio/plotting.py", "identifier": "plot_exposures", "docstring": "Plots a cake chart of the long and short exposure.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    positions_alloc : pd.DataFrame\n        Portfolio allocation of positions. See\n        pos.get_percent_alloc.\n    ax : matplotlib.Axes, optional\n        Axes upon which to plot.\n    **kwargs, optional\n        Passed to plotting function.\n\n    Returns\n    -------\n    ax : matplotlib.Axes\n        The axes that were plotted on.", "docstring_tokens": ["Plots", "a", "cake", "chart", "of", "the", "long", "and", "short", "exposure", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 261195}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1020-L1023", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "r\"\\-\\>", "language": "python", "parameters": "(self, t)", "return_statement": "return t", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "endlexpos", "=", "arg_1", ".", "lexpos", "+", "len", "(", "arg_1", ".", "value", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        r\"\\-\\>\"\n        arg_1.endlexpos = arg_1.lexpos + len(arg_1.value)\n        return arg_1", "path": "bridgepoint/oal.py", "identifier": "OALParser.t_ARROW", "docstring": "r\"\\-\\>", "docstring_tokens": ["r", "\\", "-", "\\", ">"], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 261196}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1095-L1111", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns one average color for the colors in the list.", "language": "python", "parameters": "(self)", "return_statement": "return color(r, g, b, a, mode=\"rgb\")", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "0", ",", "0", ",", "0", ",", "0", "for", "arg_5", "in", "arg_0", ":", "arg_1", "+=", "arg_5", ".", "r", "arg_2", "+=", "arg_5", ".", "g", "arg_3", "+=", "arg_5", ".", "b", "arg_4", "+=", "arg_5", ".", "alpha", "arg_1", "/=", "len", "(", "arg_0", ")", "arg_2", "/=", "len", "(", "arg_0", ")", "arg_3", "/=", "len", "(", "arg_0", ")", "arg_4", "/=", "len", "(", "arg_0", ")", "return", "color", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "mode", "=", "\"rgb\"", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns one average color for the colors in the list.\n        \"\"\"\n        arg_1, arg_2, arg_3, arg_4 = 0, 0, 0, 0\n        for arg_5 in arg_0:\n            arg_1 += arg_5.r\n            arg_2 += arg_5.g\n            arg_3 += arg_5.b\n            arg_4 += arg_5.alpha\n\n        arg_1 /= len(arg_0)\n        arg_2 /= len(arg_0)\n        arg_3 /= len(arg_0)\n        arg_4 /= len(arg_0)\n\n        return color(arg_1, arg_2, arg_3, arg_4, mode=\"rgb\")", "path": "lib/colors/__init__.py", "identifier": "ColorList._average", "docstring": "Returns one average color for the colors in the list.", "docstring_tokens": ["Returns", "one", "average", "color", "for", "the", "colors", "in", "the", "list", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 261197}
{"url": "https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L45-L110", "sha": "b8822d3e3e911944370d84371a91fa0c29e9772e", "docstring_summary": "Making sure the selection if time and frequency are within the file limits.", "language": "python", "parameters": "(self, f_start=None, f_stop=None, t_start=None, t_stop=None, init=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "arg_5", "=", "False", ")", ":", "if", "arg_5", "is", "True", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "t_begin", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "t_end", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "f_begin", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "f_end", "else", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "f_start", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "f_stop", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "t_start", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "t_stop", "if", "arg_4", ">=", "0", "and", "arg_3", ">=", "0", "and", "arg_4", "<", "arg_3", ":", "arg_4", ",", "arg_3", "=", "arg_3", ",", "arg_4", "logger", ".", "warning", "(", "'Given t_stop < t_start, assuming reversed values.'", ")", "if", "arg_2", "and", "arg_1", "and", "arg_2", "<", "arg_1", ":", "arg_2", ",", "arg_1", "=", "arg_1", ",", "arg_2", "logger", ".", "warning", "(", "'Given f_stop < f_start, assuming reversed values.'", ")", "if", "arg_3", ">=", "arg_0", ".", "t_begin", "and", "arg_3", "<", "arg_0", ".", "t_end", ":", "arg_0", ".", "t_start", "=", "int", "(", "arg_3", ")", "else", ":", "if", "arg_5", "is", "False", "or", "arg_3", "!=", "None", ":", "logger", ".", "warning", "(", "'Setting t_start = %f, since t_start not given or not valid.'", "%", "arg_0", ".", "t_begin", ")", "arg_0", ".", "t_start", "=", "arg_0", ".", "t_begin", "if", "arg_4", "<=", "arg_0", ".", "t_end", "and", "arg_4", ">", "arg_0", ".", "t_begin", ":", "arg_0", ".", "t_stop", "=", "int", "(", "arg_4", ")", "else", ":", "if", "arg_5", "is", "False", "or", "arg_4", ":", "logger", ".", "warning", "(", "'Setting t_stop = %f, since t_stop not given or not valid.'", "%", "arg_0", ".", "t_end", ")", "arg_0", ".", "t_stop", "=", "arg_0", ".", "t_end", "if", "arg_1", ">=", "arg_0", ".", "f_begin", "and", "arg_1", "<", "arg_0", ".", "f_end", ":", "arg_0", ".", "f_start", "=", "arg_1", "else", ":", "if", "arg_5", "is", "False", "or", "arg_1", ":", "logger", ".", "warning", "(", "'Setting f_start = %f, since f_start not given or not valid.'", "%", "arg_0", ".", "f_begin", ")", "arg_0", ".", "f_start", "=", "arg_0", ".", "f_begin", "if", "arg_2", "<=", "arg_0", ".", "f_end", "and", "arg_2", ">", "arg_0", ".", "f_begin", ":", "arg_0", ".", "f_stop", "=", "arg_2", "else", ":", "if", "arg_5", "is", "False", "or", "arg_2", ":", "logger", ".", "warning", "(", "'Setting f_stop = %f, since f_stop not given or not valid.'", "%", "arg_0", ".", "f_end", ")", "arg_0", ".", "f_stop", "=", "arg_0", ".", "f_end", "arg_0", ".", "selection_shape", "=", "arg_0", ".", "_calc_selection_shape", "(", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=False):\n        \"\"\"Making sure the selection if time and frequency are within the file limits.\n\n        Args:\n            init (bool): If call during __init__\n        \"\"\"\n\n        # This avoids resetting values\n        if arg_5 is True:\n            if arg_3 is None:\n                arg_3 = arg_0.t_begin\n            if arg_4 is None:\n                arg_4 = arg_0.t_end\n            if arg_1 is None:\n                arg_1 = arg_0.f_begin\n            if arg_2 is None:\n                arg_2 = arg_0.f_end\n        else:\n            if arg_1 is None:\n                arg_1 = arg_0.f_start\n            if arg_2 is None:\n                arg_2 = arg_0.f_stop\n            if arg_3 is None:\n                arg_3 = arg_0.t_start\n            if arg_4 is None:\n                arg_4 = arg_0.t_stop\n\n        # By now, all values start/stop are populated.\n\n        if arg_4 >= 0 and arg_3 >= 0 and arg_4 < arg_3:\n            arg_4, arg_3 = arg_3,arg_4\n            logger.warning('Given t_stop < t_start, assuming reversed values.')\n        if arg_2 and arg_1 and arg_2 < arg_1:\n            arg_2, arg_1 = arg_1,arg_2\n            logger.warning('Given f_stop < f_start, assuming reversed values.')\n\n        if arg_3 >= arg_0.t_begin and arg_3 < arg_0.t_end:\n            arg_0.t_start = int(arg_3)\n        else:\n            if arg_5 is False or arg_3 != None:\n                logger.warning('Setting t_start = %f, since t_start not given or not valid.'%arg_0.t_begin)\n            arg_0.t_start = arg_0.t_begin\n\n        if arg_4 <= arg_0.t_end  and arg_4 > arg_0.t_begin:\n            arg_0.t_stop = int(arg_4)\n        else:\n            if arg_5 is False or arg_4:\n                logger.warning('Setting t_stop = %f, since t_stop not given or not valid.'%arg_0.t_end)\n            arg_0.t_stop = arg_0.t_end\n\n        if arg_1 >= arg_0.f_begin and arg_1 < arg_0.f_end:\n            arg_0.f_start = arg_1\n        else:\n            if arg_5 is False or arg_1:\n                logger.warning('Setting f_start = %f, since f_start not given or not valid.'%arg_0.f_begin)\n            arg_0.f_start = arg_0.f_begin\n\n        if arg_2 <= arg_0.f_end and arg_2 > arg_0.f_begin:\n            arg_0.f_stop = arg_2\n        else:\n            if arg_5 is False or arg_2:\n                logger.warning('Setting f_stop = %f, since f_stop not given or not valid.'%arg_0.f_end)\n            arg_0.f_stop = arg_0.f_end\n\n        # Now we have setup bounds, we can calculate shape of selection\n        arg_0.selection_shape = arg_0._calc_selection_shape()", "path": "blimpy/file_wrapper.py", "identifier": "Reader._setup_selection_range", "docstring": "Making sure the selection if time and frequency are within the file limits.\n\n        Args:\n            init (bool): If call during __init__", "docstring_tokens": ["Making", "sure", "the", "selection", "if", "time", "and", "frequency", "are", "within", "the", "file", "limits", "."], "nwo": "UCBerkeleySETI/blimpy", "score": 0.4108803658098165, "idx": 261198}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py#L798-L814", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Append new content for a cell magic in line mode.", "language": "python", "parameters": "(self, lines)", "return_statement": "return self._is_complete", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "_store", "(", "arg_1", ",", "arg_0", ".", "_buffer_raw", ",", "'source_raw'", ")", "arg_0", ".", "cell_magic_parts", ".", "append", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "cell_magic_parts", "[", "-", "1", "]", "arg_0", ".", "_is_complete", "=", "last_blank", "(", "arg_2", ")", "and", "arg_1", ".", "isspace", "(", ")", "return", "arg_0", ".", "_is_complete"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Append new content for a cell magic in line mode.\n        \"\"\"\n        # Only store the raw input.  Lines beyond the first one are only only\n        # stored for history purposes; for execution the caller will grab the\n        # magic pieces from cell_magic_parts and will assemble the cell body\n        arg_0._store(arg_1, arg_0._buffer_raw, 'source_raw')\n        arg_0.cell_magic_parts.append(arg_1)\n        # Find out if the last stored block has a whitespace line as its\n        # last line and also this line is whitespace, case in which we're\n        # done (two contiguous blank lines signal termination).  Note that\n        # the storage logic *enforces* that every stored block is\n        # newline-terminated, so we grab everything but the last character\n        # so we can have the body of the block alone.\n        arg_2 = arg_0.cell_magic_parts[-1]\n        arg_0._is_complete = last_blank(arg_2) and arg_1.isspace()\n        return arg_0._is_complete", "path": "environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py", "identifier": "IPythonInputSplitter._line_mode_cell_append", "docstring": "Append new content for a cell magic in line mode.", "docstring_tokens": ["Append", "new", "content", "for", "a", "cell", "magic", "in", "line", "mode", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261199}
{"url": "https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/common.py#L213-L218", "sha": "a86c3c65323cec809a4bd4f81919644927094bf5", "docstring_summary": "given text, make it a temporary HTML file and launch it.", "language": "python", "parameters": "(html)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tempfile", ".", "gettempdir", "(", ")", "+", "\"/swhlab/temp.html\"", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "arg_0", ")", "webbrowser", ".", "open", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"given text, make it a temporary HTML file and launch it.\"\"\"\n    arg_1 = tempfile.gettempdir()+\"/swhlab/temp.html\"\n    with open(arg_1,'w') as f:\n        f.write(arg_0)\n    webbrowser.open(arg_1)", "path": "doc/oldcode/swhlab/core/common.py", "identifier": "html_temp_launch", "docstring": "given text, make it a temporary HTML file and launch it.", "docstring_tokens": ["given", "text", "make", "it", "a", "temporary", "HTML", "file", "and", "launch", "it", "."], "nwo": "swharden/SWHLab", "score": 0.1832591465193378, "idx": 261200}
{"url": "https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/rtlLevel/optimalizator.py#L106-L133", "sha": "8cbb399e326da3b22c233b98188a9d08dec057e6", "docstring_summary": "Try to merge processes as much is possible", "language": "python", "parameters": "(processes)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "sort", "(", "key", "=", "lambda", "x", ":", "(", "x", ".", "name", ",", "maxStmId", "(", "x", ")", ")", ",", "reverse", "=", "True", ")", "for", "arg_1", ",", "arg_2", "in", "groupedby", "(", "arg_0", ",", "lambda", "arg_7", ":", "arg_7", ".", "rank", ")", ":", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_2", ")", ":", "if", "arg_4", "is", "None", ":", "continue", "for", "arg_5", ",", "arg_6", "in", "enumerate", "(", "islice", "(", "arg_2", ",", "arg_3", "+", "1", ",", "None", ")", ")", ":", "if", "arg_6", "is", "None", ":", "continue", "try", ":", "arg_4", "=", "tryToMerge", "(", "arg_4", ",", "arg_6", ")", "except", "IncompatibleStructure", ":", "continue", "arg_2", "[", "arg_3", "+", "1", "+", "arg_5", "]", "=", "None", "for", "arg_7", "in", "arg_2", ":", "if", "arg_7", "is", "not", "None", ":", "yield", "arg_7"], "function": "def Func(arg_0):\n    \"\"\"\n    Try to merge processes as much is possible\n\n    :param processes: list of processes instances\n    \"\"\"\n    # sort to make order of merging same deterministic\n    arg_0.sort(key=lambda x: (x.name, maxStmId(x)), reverse=True)\n    # now try to reduce processes with nearly same structure of statements into one\n    # to minimize number of processes\n    for arg_1, arg_2 in groupedby(arg_0, lambda arg_7: arg_7.rank):\n        for arg_3, arg_4 in enumerate(arg_2):\n            if arg_4 is None:\n                continue\n            for arg_5, arg_6 in enumerate(islice(arg_2, arg_3 + 1, None)):\n                if arg_6 is None:\n                    continue\n\n                try:\n                    arg_4 = tryToMerge(arg_4, arg_6)\n                except IncompatibleStructure:\n                    continue\n                arg_2[arg_3 + 1 + arg_5] = None\n                # procs[iA] = pA\n\n        for arg_7 in arg_2:\n            if arg_7 is not None:\n                yield arg_7", "path": "hwt/synthesizer/rtlLevel/optimalizator.py", "identifier": "reduceProcesses", "docstring": "Try to merge processes as much is possible\n\n    :param processes: list of processes instances", "docstring_tokens": ["Try", "to", "merge", "processes", "as", "much", "is", "possible"], "nwo": "Nic30/hwt", "score": 0.5566260839589935, "idx": 261201}
{"url": "https://github.com/playpauseandstop/bootstrapper/blob/b216a05f2acb0b9f4919c4e010ff7b0f63fc1393/bootstrapper.py#L586-L626", "sha": "b216a05f2acb0b9f4919c4e010ff7b0f63fc1393", "docstring_summary": "r\"\"\"Call given command with ``subprocess.call`` function.", "language": "python", "parameters": "(cmd, echo=False, fail_silently=False, **kwargs)", "return_statement": "return retcode", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "None", ",", "None", "if", "arg_1", ":", "arg_6", "=", "arg_0", "if", "isinstance", "(", "arg_0", ",", "string_types", ")", "else", "' '", ".", "join", "(", "arg_0", ")", "arg_3", "[", "'stdout'", "]", ",", "arg_3", "[", "'stderr'", "]", "=", "sys", ".", "stdout", ",", "sys", ".", "stderr", "print_message", "(", "'$ {0}'", ".", "format", "(", "arg_6", ")", ")", "else", ":", "arg_4", ",", "arg_5", "=", "get_temp_streams", "(", ")", "arg_3", "[", "'stdout'", "]", ",", "arg_3", "[", "'stderr'", "]", "=", "arg_4", ",", "arg_5", "try", ":", "arg_7", "=", "subprocess", ".", "call", "(", "arg_0", ",", "**", "arg_3", ")", "except", "subprocess", ".", "CalledProcessError", "as", "arg_5", ":", "if", "arg_2", ":", "return", "False", "print_error", "(", "str", "(", "arg_5", ")", "if", "IS_PY3", "else", "unicode", "(", "arg_5", ")", ")", "finally", ":", "if", "arg_4", ":", "arg_4", ".", "close", "(", ")", "if", "arg_5", ":", "arg_5", ".", "close", "(", ")", "if", "arg_7", "and", "arg_1", "and", "not", "arg_2", ":", "print_error", "(", "'Command {0!r} returned non-zero exit status {1}'", ".", "format", "(", "arg_6", ",", "arg_7", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=False, arg_2=False, **arg_3):\n    r\"\"\"Call given command with ``subprocess.call`` function.\n\n    :param cmd: Command to run.\n    :type cmd: tuple or str\n    :param echo:\n        If enabled show command to call and its output in STDOUT, otherwise\n        hide all output. By default: False\n    :param fail_silently: Do not raise exception on error. By default: False\n    :param \\*\\*kwargs:\n        Additional keyword arguments to be passed to ``subprocess.call``\n        function. STDOUT and STDERR streams would be setup inside of function\n        to ensure hiding command output in case of disabling ``echo``.\n    \"\"\"\n    arg_4, arg_5 = None, None\n\n    if arg_1:\n        arg_6 = arg_0 if isinstance(arg_0, string_types) else ' '.join(arg_0)\n        arg_3['stdout'], arg_3['stderr'] = sys.stdout, sys.stderr\n        print_message('$ {0}'.format(arg_6))\n    else:\n        arg_4, arg_5 = get_temp_streams()\n        arg_3['stdout'], arg_3['stderr'] = arg_4, arg_5\n\n    try:\n        arg_7 = subprocess.call(arg_0, **arg_3)\n    except subprocess.CalledProcessError as arg_5:\n        if arg_2:\n            return False\n        print_error(str(arg_5) if IS_PY3 else unicode(arg_5))  # noqa\n    finally:\n        if arg_4:\n            arg_4.close()\n        if arg_5:\n            arg_5.close()\n\n    if arg_7 and arg_1 and not arg_2:\n        print_error('Command {0!r} returned non-zero exit status {1}'.\n                    format(arg_6, arg_7))\n\n    return arg_7", "path": "bootstrapper.py", "identifier": "run_cmd", "docstring": "r\"\"\"Call given command with ``subprocess.call`` function.\n\n    :param cmd: Command to run.\n    :type cmd: tuple or str\n    :param echo:\n        If enabled show command to call and its output in STDOUT, otherwise\n        hide all output. By default: False\n    :param fail_silently: Do not raise exception on error. By default: False\n    :param \\*\\*kwargs:\n        Additional keyword arguments to be passed to ``subprocess.call``\n        function. STDOUT and STDERR streams would be setup inside of function\n        to ensure hiding command output in case of disabling ``echo``.", "docstring_tokens": ["r", "Call", "given", "command", "with", "subprocess", ".", "call", "function", "."], "nwo": "playpauseandstop/bootstrapper", "score": 0.17697123869542528, "idx": 261202}
{"url": "https://github.com/scrapinghub/dateparser/blob/11a761c99d3ee522a3c63756b70c106a579e8b5c/dateparser/languages/locale.py#L114-L149", "sha": "11a761c99d3ee522a3c63756b70c106a579e8b5c", "docstring_summary": "Translate the date string to its English equivalent.", "language": "python", "parameters": "(self, date_string, keep_formatting=False, settings=None)", "return_statement": "return self._join(list(filter(bool, date_string_tokens)),\n                          separator=\"\" if keep_formatting else \" \", settings=settings)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ",", "arg_3", "=", "None", ")", ":", "arg_1", "=", "arg_0", ".", "_Func_numerals", "(", "arg_1", ")", "if", "arg_3", ".", "NORMALIZE", ":", "arg_1", "=", "normalize_unicode", "(", "arg_1", ")", "arg_1", "=", "arg_0", ".", "_simplify", "(", "arg_1", ",", "arg_3", "=", "arg_3", ")", "arg_4", "=", "arg_0", ".", "_get_dictionary", "(", "arg_3", ")", "arg_5", "=", "arg_4", ".", "split", "(", "arg_1", ",", "arg_2", ")", "arg_6", "=", "arg_0", ".", "_get_relative_translations", "(", "arg_3", "=", "arg_3", ")", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_5", ")", ":", "arg_8", "=", "arg_8", ".", "lower", "(", ")", "for", "arg_9", ",", "arg_10", "in", "arg_6", ".", "items", "(", ")", ":", "if", "arg_9", ".", "match", "(", "arg_8", ")", ":", "arg_5", "[", "arg_7", "]", "=", "arg_9", ".", "sub", "(", "arg_10", ",", "arg_8", ")", "else", ":", "if", "arg_8", "in", "arg_4", ":", "arg_5", "[", "arg_7", "]", "=", "arg_4", "[", "arg_8", "]", "or", "''", "if", "\"in\"", "in", "arg_5", ":", "arg_5", "=", "arg_0", ".", "_clear_future_words", "(", "arg_5", ")", "return", "arg_0", ".", "_join", "(", "list", "(", "filter", "(", "bool", ",", "arg_5", ")", ")", ",", "separator", "=", "\"\"", "if", "arg_2", "else", "\" \"", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=False, arg_3=None):\n        \"\"\"\n        Translate the date string to its English equivalent.\n\n        :param date_string:\n            A string representing date and/or time in a recognizably valid format.\n        :type date_string: str|unicode\n\n        :param keep_formatting:\n            If True, retain formatting of the date string after translation.\n        :type keep_formatting: bool\n\n        :return: Funcd date string.\n        \"\"\"\n        arg_1 = arg_0._Func_numerals(arg_1)\n        if arg_3.NORMALIZE:\n            arg_1 = normalize_unicode(arg_1)\n        arg_1 = arg_0._simplify(arg_1, arg_3=arg_3)\n        arg_4 = arg_0._get_dictionary(arg_3)\n        arg_5 = arg_4.split(arg_1, arg_2)\n\n        arg_6 = arg_0._get_relative_translations(arg_3=arg_3)\n\n        for arg_7, arg_8 in enumerate(arg_5):\n            arg_8 = arg_8.lower()\n            for arg_9, arg_10 in arg_6.items():\n                if arg_9.match(arg_8):\n                    arg_5[arg_7] = arg_9.sub(arg_10, arg_8)\n            else:\n                if arg_8 in arg_4:\n                    arg_5[arg_7] = arg_4[arg_8] or ''\n        if \"in\" in arg_5:\n            arg_5 = arg_0._clear_future_words(arg_5)\n\n        return arg_0._join(list(filter(bool, arg_5)),\n                          separator=\"\" if arg_2 else \" \", arg_3=arg_3)", "path": "dateparser/languages/locale.py", "identifier": "Locale.translate", "docstring": "Translate the date string to its English equivalent.\n\n        :param date_string:\n            A string representing date and/or time in a recognizably valid format.\n        :type date_string: str|unicode\n\n        :param keep_formatting:\n            If True, retain formatting of the date string after translation.\n        :type keep_formatting: bool\n\n        :return: translated date string.", "docstring_tokens": ["Translate", "the", "date", "string", "to", "its", "English", "equivalent", "."], "nwo": "scrapinghub/dateparser", "score": 0.9721260912575203, "idx": 261203}
{"url": "https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L290-L312", "sha": "6d1c77c61fc2827b71f1b3d5aa3332d7f5807820", "docstring_summary": "This method is used mainly internally, but it can be handy if you work\n        with with raw MARC XML object and not using getters.", "language": "python", "parameters": "(self, num, is_oai=None)", "return_statement": "return i_name + str(num)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "if", "arg_1", "not", "in", "(", "1", ",", "2", ")", ":", "raise", "ValueError", "(", "\"`num` parameter have to be 1 or 2!\"", ")", "if", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "oai_marc", "arg_3", "=", "\"ind\"", "if", "not", "arg_2", "else", "\"i\"", "return", "arg_3", "+", "str", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        This method is used mainly internally, but it can be handy if you work\n        with with raw MARC XML object and not using getters.\n\n        Args:\n            num (int): Which indicator you need (1/2).\n            is_oai (bool/None): If None, :attr:`.oai_marc` is\n                   used.\n\n        Returns:\n            str: current name of ``i1``/``ind1`` parameter based on \\\n                 :attr:`oai_marc` property.\n        \"\"\"\n        if arg_1 not in (1, 2):\n            raise ValueError(\"`num` parameter have to be 1 or 2!\")\n\n        if arg_2 is None:\n            arg_2 = arg_0.oai_marc\n\n        arg_3 = \"ind\" if not arg_2 else \"i\"\n\n        return arg_3 + str(arg_1)", "path": "src/marcxml_parser/parser.py", "identifier": "MARCXMLParser.get_i_name", "docstring": "This method is used mainly internally, but it can be handy if you work\n        with with raw MARC XML object and not using getters.\n\n        Args:\n            num (int): Which indicator you need (1/2).\n            is_oai (bool/None): If None, :attr:`.oai_marc` is\n                   used.\n\n        Returns:\n            str: current name of ``i1``/``ind1`` parameter based on \\\n                 :attr:`oai_marc` property.", "docstring_tokens": ["This", "method", "is", "used", "mainly", "internally", "but", "it", "can", "be", "handy", "if", "you", "work", "with", "with", "raw", "MARC", "XML", "object", "and", "not", "using", "getters", "."], "nwo": "edeposit/marcxml_parser", "score": 0.17185066990864498, "idx": 261204}
{"url": "https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L91-L95", "sha": "3572b2fb92039b4a1abe384be8545560fbd3d470", "docstring_summary": "Fig. 3.10", "language": "python", "parameters": "(self, problem, action)", "return_statement": "return Node(next, self, action,\n                    problem.path_cost(self.path_cost, self.state, action, next))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_1", ".", "result", "(", "arg_0", ".", "state", ",", "arg_2", ")", "return", "Node", "(", "arg_3", ",", "arg_0", ",", "arg_2", ",", "arg_1", ".", "path_cost", "(", "arg_0", ".", "path_cost", ",", "arg_0", ".", "state", ",", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"Fig. 3.10\"\n        arg_3 = arg_1.result(arg_0.state, arg_2)\n        return Node(arg_3, arg_0, arg_2,\n                    arg_1.path_cost(arg_0.path_cost, arg_0.state, arg_2, arg_3))", "path": "aima/search.py", "identifier": "Node.child_node", "docstring": "Fig. 3.10", "docstring_tokens": ["Fig", ".", "3", ".", "10"], "nwo": "hobson/aima", "score": 0.19017271795726579, "idx": 261205}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L357-L401", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Compute the probability that the current value plus anomaly score represents\n    an anomaly given the historical distribution of anomaly scores. The closer\n    the number is to 1, the higher the chance it is an anomaly.", "language": "python", "parameters": "(self, value, anomalyScore, timestamp=None)", "return_statement": "return likelihood", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "if", "arg_3", "is", "None", ":", "arg_3", "=", "arg_0", ".", "_iteration", "arg_4", "=", "(", "arg_3", ",", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "_iteration", "<", "arg_0", ".", "_probationaryPeriod", ":", "arg_5", "=", "0.5", "else", ":", "if", "(", "(", "arg_0", ".", "_distribution", "is", "None", ")", "or", "(", "arg_0", ".", "_iteration", "%", "arg_0", ".", "_reestimationPeriod", "==", "0", ")", ")", ":", "arg_6", "=", "arg_0", ".", "_calcSkipRecords", "(", "numIngested", "=", "arg_0", ".", "_iteration", ",", "windowSize", "=", "arg_0", ".", "_historicalScores", ".", "maxlen", ",", "learningPeriod", "=", "arg_0", ".", "_learningPeriod", ")", "arg_7", ",", "arg_7", ",", "arg_0", ".", "_distribution", "=", "estimateAnomalyLikelihoods", "(", "arg_0", ".", "_historicalScores", ",", "skipRecords", "=", "arg_6", ")", "arg_9", ",", "arg_7", ",", "arg_0", ".", "_distribution", "=", "updateAnomalyLikelihoods", "(", "[", "arg_4", "]", ",", "arg_0", ".", "_distribution", ")", "arg_5", "=", "1.0", "-", "arg_9", "[", "0", "]", "arg_0", ".", "_historicalScores", ".", "append", "(", "arg_4", ")", "arg_0", ".", "_iteration", "+=", "1", "return", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"\n    Compute the probability that the current value plus anomaly score represents\n    an anomaly given the historical distribution of anomaly scores. The closer\n    the number is to 1, the higher the chance it is an anomaly.\n\n    :param value: the current metric (\"raw\") input value, eg. \"orange\", or\n                   '21.2' (deg. Celsius), ...\n    :param anomalyScore: the current anomaly score\n    :param timestamp: [optional] timestamp of the ocurrence,\n                       default (None) results in using iteration step.\n    :returns: the anomalyLikelihood for this record.\n    \"\"\"\n    if arg_3 is None:\n      arg_3 = arg_0._iteration\n\n    arg_4 = (arg_3, arg_1, arg_2)\n    # We ignore the first probationaryPeriod data points\n    if arg_0._iteration < arg_0._probationaryPeriod:\n      arg_5 = 0.5\n    else:\n      # On a rolling basis we re-estimate the distribution\n      if ( (arg_0._distribution is None) or\n           (arg_0._iteration % arg_0._reestimationPeriod == 0) ):\n\n        arg_6 = arg_0._calcSkipRecords(\n          numIngested=arg_0._iteration,\n          windowSize=arg_0._historicalScores.maxlen,\n          learningPeriod=arg_0._learningPeriod)\n\n        arg_7, arg_7, arg_0._distribution = estimateAnomalyLikelihoods(\n          arg_0._historicalScores,\n          skipRecords=arg_6)\n\n      arg_9, arg_7, arg_0._distribution = updateAnomalyLikelihoods(\n        [arg_4],\n        arg_0._distribution)\n\n      arg_5 = 1.0 - arg_9[0]\n\n    # Before we exit update historical scores and iteration\n    arg_0._historicalScores.append(arg_4)\n    arg_0._iteration += 1\n\n    return arg_5", "path": "src/nupic/algorithms/anomaly_likelihood.py", "identifier": "AnomalyLikelihood.anomalyProbability", "docstring": "Compute the probability that the current value plus anomaly score represents\n    an anomaly given the historical distribution of anomaly scores. The closer\n    the number is to 1, the higher the chance it is an anomaly.\n\n    :param value: the current metric (\"raw\") input value, eg. \"orange\", or\n                   '21.2' (deg. Celsius), ...\n    :param anomalyScore: the current anomaly score\n    :param timestamp: [optional] timestamp of the ocurrence,\n                       default (None) results in using iteration step.\n    :returns: the anomalyLikelihood for this record.", "docstring_tokens": ["Compute", "the", "probability", "that", "the", "current", "value", "plus", "anomaly", "score", "represents", "an", "anomaly", "given", "the", "historical", "distribution", "of", "anomaly", "scores", ".", "The", "closer", "the", "number", "is", "to", "1", "the", "higher", "the", "chance", "it", "is", "an", "anomaly", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261206}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/S3_hook.py#L233-L277", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Reads a key with S3 Select.", "language": "python", "parameters": "(self, key, bucket_name=None,\n                   expression='SELECT * FROM S3Object',\n                   expression_type='SQL',\n                   input_serialization=None,\n                   output_serialization=None)", "return_statement": "return ''.join(event['Records']['Payload'].decode('utf-8')\n                       for event in response['Payload']\n                       if 'Records' in event)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "'SELECT * FROM S3Object'", ",", "arg_4", "=", "'SQL'", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "if", "arg_5", "is", "None", ":", "arg_5", "=", "{", "'CSV'", ":", "{", "}", "}", "if", "arg_6", "is", "None", ":", "arg_6", "=", "{", "'CSV'", ":", "{", "}", "}", "if", "not", "arg_2", ":", "(", "arg_2", ",", "arg_1", ")", "=", "arg_0", ".", "parse_s3_url", "(", "arg_1", ")", "arg_7", "=", "arg_0", ".", "get_conn", "(", ")", ".", "select_object_content", "(", "Bucket", "=", "arg_2", ",", "Key", "=", "arg_1", ",", "Expression", "=", "arg_3", ",", "ExpressionType", "=", "arg_4", ",", "InputSerialization", "=", "arg_5", ",", "OutputSerialization", "=", "arg_6", ")", "return", "''", ".", "join", "(", "arg_8", "[", "'Records'", "]", "[", "'Payload'", "]", ".", "decode", "(", "'utf-8'", ")", "for", "arg_8", "in", "arg_7", "[", "'Payload'", "]", "if", "'Records'", "in", "arg_8", ")"], "function": "def Func(arg_0, arg_1, arg_2=None,\n                   arg_3='SELECT * FROM S3Object',\n                   arg_4='SQL',\n                   arg_5=None,\n                   arg_6=None):\n        \"\"\"\n        Reads a key with S3 Select.\n\n        :param key: S3 key that will point to the file\n        :type key: str\n        :param bucket_name: Name of the bucket in which the file is stored\n        :type bucket_name: str\n        :param expression: S3 Select expression\n        :type expression: str\n        :param expression_type: S3 Select expression type\n        :type expression_type: str\n        :param input_serialization: S3 Select input data serialization format\n        :type input_serialization: dict\n        :param output_serialization: S3 Select output data serialization format\n        :type output_serialization: dict\n        :return: retrieved subset of original data by S3 Select\n        :rtype: str\n\n        .. seealso::\n            For more details about S3 Select parameters:\n            http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.select_object_content\n        \"\"\"\n        if arg_5 is None:\n            arg_5 = {'CSV': {}}\n        if arg_6 is None:\n            arg_6 = {'CSV': {}}\n        if not arg_2:\n            (arg_2, arg_1) = arg_0.parse_s3_url(arg_1)\n\n        arg_7 = arg_0.get_conn().select_object_content(\n            Bucket=arg_2,\n            Key=arg_1,\n            Expression=arg_3,\n            ExpressionType=arg_4,\n            InputSerialization=arg_5,\n            OutputSerialization=arg_6)\n\n        return ''.join(arg_8['Records']['Payload'].decode('utf-8')\n                       for arg_8 in arg_7['Payload']\n                       if 'Records' in arg_8)", "path": "airflow/hooks/S3_hook.py", "identifier": "S3Hook.select_key", "docstring": "Reads a key with S3 Select.\n\n        :param key: S3 key that will point to the file\n        :type key: str\n        :param bucket_name: Name of the bucket in which the file is stored\n        :type bucket_name: str\n        :param expression: S3 Select expression\n        :type expression: str\n        :param expression_type: S3 Select expression type\n        :type expression_type: str\n        :param input_serialization: S3 Select input data serialization format\n        :type input_serialization: dict\n        :param output_serialization: S3 Select output data serialization format\n        :type output_serialization: dict\n        :return: retrieved subset of original data by S3 Select\n        :rtype: str\n\n        .. seealso::\n            For more details about S3 Select parameters:\n            http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.select_object_content", "docstring_tokens": ["Reads", "a", "key", "with", "S3", "Select", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261207}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2829-L2907", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Look through the models table for an orphaned model, which is a model\n    that is not completed yet, whose _eng_last_update_time is more than\n    maxUpdateInterval seconds ago.", "language": "python", "parameters": "(self, jobId, maxUpdateInterval)", "return_statement": "return adoptedModelID", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "@", "g_retrySQL", "def", "findCandidateModelWithRetries", "(", ")", ":", "arg_3", "=", "None", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_4", "=", "'SELECT model_id FROM %s '", "'   WHERE  status=%%s '", "'          AND job_id=%%s '", "'          AND TIMESTAMPDIFF(SECOND, '", "'                            _eng_last_update_time, '", "'                            UTC_TIMESTAMP()) > %%s '", "'   LIMIT 1 '", "%", "(", "arg_0", ".", "modelsTableName", ",", ")", "arg_5", "=", "[", "arg_0", ".", "STATUS_RUNNING", ",", "arg_1", ",", "arg_2", "]", "arg_6", "=", "conn", ".", "cursor", ".", "execute", "(", "arg_4", ",", "arg_5", ")", "arg_7", "=", "conn", ".", "cursor", ".", "fetchall", "(", ")", "assert", "arg_6", "<=", "1", ",", "\"Unexpected numRows: %r\"", "%", "arg_6", "if", "arg_6", "==", "1", ":", "(", "arg_3", ",", ")", "=", "arg_7", "[", "0", "]", "return", "arg_3", "@", "g_retrySQL", "def", "adoptModelWithRetries", "(", "arg_3", ")", ":", "arg_8", "=", "False", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_4", "=", "'UPDATE %s SET _eng_worker_conn_id=%%s, '", "'            _eng_last_update_time=UTC_TIMESTAMP() '", "'        WHERE model_id=%%s '", "'              AND status=%%s'", "'              AND TIMESTAMPDIFF(SECOND, '", "'                                _eng_last_update_time, '", "'                                UTC_TIMESTAMP()) > %%s '", "'        LIMIT 1 '", "%", "(", "arg_0", ".", "modelsTableName", ",", ")", "arg_5", "=", "[", "arg_0", ".", "_connectionID", ",", "arg_3", ",", "arg_0", ".", "STATUS_RUNNING", ",", "arg_2", "]", "arg_9", "=", "conn", ".", "cursor", ".", "execute", "(", "arg_4", ",", "arg_5", ")", "assert", "arg_9", "<=", "1", ",", "'Unexpected numRowsAffected=%r'", "%", "(", "arg_9", ",", ")", "if", "arg_9", "==", "1", ":", "arg_8", "=", "True", "else", ":", "(", "arg_10", ",", "arg_11", ")", "=", "arg_0", ".", "_getOneMatchingRowNoRetries", "(", "arg_0", ".", "_models", ",", "conn", ",", "{", "'model_id'", ":", "arg_3", "}", ",", "[", "'status'", ",", "'_eng_worker_conn_id'", "]", ")", "arg_8", "=", "(", "arg_10", "==", "arg_0", ".", "STATUS_RUNNING", "and", "arg_11", "==", "arg_0", ".", "_connectionID", ")", "return", "arg_8", "arg_12", "=", "None", "while", "True", ":", "arg_3", "=", "findCandidateModelWithRetries", "(", ")", "if", "arg_3", "is", "None", ":", "break", "if", "adoptModelWithRetries", "(", "arg_3", ")", ":", "arg_12", "=", "arg_3", "break", "return", "arg_12"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\" Look through the models table for an orphaned model, which is a model\n    that is not completed yet, whose _eng_last_update_time is more than\n    maxUpdateInterval seconds ago.\n\n    If one is found, change its _eng_worker_conn_id to the current worker's\n    and return the model id.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:    modelId of the model we adopted, or None if none found\n    \"\"\"\n\n    @g_retrySQL\n    def findCandidateModelWithRetries():\n      arg_3 = None\n      with ConnectionFactory.get() as conn:\n        # TODO: may need a table index on job_id/status for speed\n        arg_4 = 'SELECT model_id FROM %s ' \\\n                '   WHERE  status=%%s ' \\\n                '          AND job_id=%%s ' \\\n                '          AND TIMESTAMPDIFF(SECOND, ' \\\n                '                            _eng_last_update_time, ' \\\n                '                            UTC_TIMESTAMP()) > %%s ' \\\n                '   LIMIT 1 ' \\\n                % (arg_0.modelsTableName,)\n        arg_5 = [arg_0.STATUS_RUNNING, arg_1, arg_2]\n        arg_6 = conn.cursor.execute(arg_4, arg_5)\n        arg_7 = conn.cursor.fetchall()\n\n      assert arg_6 <= 1, \"Unexpected numRows: %r\" % arg_6\n      if arg_6 == 1:\n        (arg_3,) = arg_7[0]\n\n      return arg_3\n\n    @g_retrySQL\n    def adoptModelWithRetries(arg_3):\n      arg_8 = False\n      with ConnectionFactory.get() as conn:\n        arg_4 = 'UPDATE %s SET _eng_worker_conn_id=%%s, ' \\\n                  '            _eng_last_update_time=UTC_TIMESTAMP() ' \\\n                  '        WHERE model_id=%%s ' \\\n                  '              AND status=%%s' \\\n                  '              AND TIMESTAMPDIFF(SECOND, ' \\\n                  '                                _eng_last_update_time, ' \\\n                  '                                UTC_TIMESTAMP()) > %%s ' \\\n                  '        LIMIT 1 ' \\\n                  % (arg_0.modelsTableName,)\n        arg_5 = [arg_0._connectionID, arg_3, arg_0.STATUS_RUNNING,\n                     arg_2]\n        arg_9 = conn.cursor.execute(arg_4, arg_5)\n\n        assert arg_9 <= 1, 'Unexpected numRowsAffected=%r' % (\n          arg_9,)\n\n        if arg_9 == 1:\n          arg_8 = True\n        else:\n          # Discern between transient failure during update and someone else\n          # claiming this model\n          (arg_10, arg_11) = arg_0._getOneMatchingRowNoRetries(\n            arg_0._models, conn, {'model_id':arg_3},\n            ['status', '_eng_worker_conn_id'])\n          arg_8 = (arg_10 == arg_0.STATUS_RUNNING and\n                     arg_11 == arg_0._connectionID)\n      return arg_8\n\n\n    arg_12 = None\n    while True:\n      arg_3 = findCandidateModelWithRetries()\n      if arg_3 is None:\n        break\n      if adoptModelWithRetries(arg_3):\n        arg_12 = arg_3\n        break\n\n    return arg_12", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.modelAdoptNextOrphan", "docstring": "Look through the models table for an orphaned model, which is a model\n    that is not completed yet, whose _eng_last_update_time is more than\n    maxUpdateInterval seconds ago.\n\n    If one is found, change its _eng_worker_conn_id to the current worker's\n    and return the model id.\n\n    Parameters:\n    ----------------------------------------------------------------\n    retval:    modelId of the model we adopted, or None if none found", "docstring_tokens": ["Look", "through", "the", "models", "table", "for", "an", "orphaned", "model", "which", "is", "a", "model", "that", "is", "not", "completed", "yet", "whose", "_eng_last_update_time", "is", "more", "than", "maxUpdateInterval", "seconds", "ago", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261208}
{"url": "https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/ooaofooa.py#L433-L445", "sha": "7dd9343b9a0191d1db1887ab9288d0a026608d9a", "docstring_summary": "Create a pyxtuml association from a R_REL in ooaofooa.", "language": "python", "parameters": "(m, r_rel)", "return_statement": "return fn(m, inst)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "'R_SIMP'", ":", "mk_simple_association", ",", "'R_ASSOC'", ":", "mk_linked_association", ",", "'R_SUBSUP'", ":", "mk_subsuper_association", ",", "'R_COMP'", ":", "mk_derived_association", ",", "}", "arg_3", "=", "subtype", "(", "arg_1", ",", "206", ")", "arg_4", "=", "arg_2", ".", "get", "(", "type", "(", "arg_3", ")", ".", "__name__", ")", "return", "arg_4", "(", "arg_0", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n    '''\n    Create a pyxtuml association from a R_REL in ooaofooa.\n    '''\n    arg_2 = {\n        'R_SIMP': mk_simple_association,\n        'R_ASSOC': mk_linked_association,\n        'R_SUBSUP': mk_subsuper_association,\n        'R_COMP': mk_derived_association,\n    }\n    arg_3 = subtype(arg_1, 206)\n    arg_4 = arg_2.get(type(arg_3).__name__)\n    return arg_4(arg_0, arg_3)", "path": "bridgepoint/ooaofooa.py", "identifier": "mk_association", "docstring": "Create a pyxtuml association from a R_REL in ooaofooa.", "docstring_tokens": ["Create", "a", "pyxtuml", "association", "from", "a", "R_REL", "in", "ooaofooa", "."], "nwo": "xtuml/pyxtuml", "score": 0.08529914490135834, "idx": 261209}
{"url": "https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/ctllib.py#L95-L104", "sha": "6ac71bda1de6706fb34244ae4972e36db5f062d3", "docstring_summary": "Remove a process", "language": "python", "parameters": "(places, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "filepath", ".", "FilePath", "(", "arg_0", ".", "config", ")", "arg_3", "=", "arg_2", ".", "child", "(", "arg_1", ")", "arg_3", ".", "Func", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Remove a process\n\n    :params places: a Places instance\n    :params name: string, the logical name of the process\n    :returns: None\n    \"\"\"\n    arg_2 = filepath.FilePath(arg_0.config)\n    arg_3 = arg_2.child(arg_1)\n    arg_3.Func()", "path": "ncolony/ctllib.py", "identifier": "remove", "docstring": "Remove a process\n\n    :params places: a Places instance\n    :params name: string, the logical name of the process\n    :returns: None", "docstring_tokens": ["Remove", "a", "process"], "nwo": "ncolony/ncolony", "score": 0.2757871243566705, "idx": 261210}
{"url": "https://github.com/isambard-uob/budeff/blob/8be099b7e50d4855ad3cc4aa875938da2c9449e6/src/budeff/force_field.py#L10-L49", "sha": "8be099b7e50d4855ad3cc4aa875938da2c9449e6", "docstring_summary": "Assigns force field parameters to Atoms in the AMPAL object.", "language": "python", "parameters": "(ampal_obj, ff)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "hasattr", "(", "arg_0", ",", "'ligands'", ")", ":", "arg_2", "=", "arg_0", ".", "get_atoms", "(", "ligands", "=", "True", ",", "inc_alt_states", "=", "True", ")", "else", ":", "arg_2", "=", "arg_0", ".", "get_atoms", "(", "inc_alt_states", "=", "True", ")", "for", "arg_3", "in", "arg_2", ":", "arg_4", "=", "None", "arg_5", "=", "None", "if", "arg_3", ".", "element", "==", "'H'", ":", "continue", "elif", "arg_3", ".", "parent", ".", "mol_code", ".", "upper", "(", ")", "in", "arg_1", ":", "if", "arg_3", ".", "res_label", ".", "upper", "(", ")", "in", "arg_1", "[", "arg_3", ".", "parent", ".", "mol_code", "]", ":", "arg_5", "=", "(", "arg_3", ".", "parent", ".", "mol_code", ".", "upper", "(", ")", ",", "arg_3", ".", "res_label", ".", "upper", "(", ")", ")", "elif", "arg_3", ".", "res_label", ".", "upper", "(", ")", "in", "arg_1", "[", "'WLD'", "]", ":", "arg_5", "=", "(", "'WLD'", ",", "arg_3", ".", "res_label", ".", "upper", "(", ")", ")", "else", ":", "arg_4", "=", "(", "'{} atom is not parameterised in the selected '", "'force field for {} residues, this will be '", "'ignored.'", ")", ".", "format", "(", "arg_3", ".", "res_label", ",", "arg_3", ".", "parent", ".", "mol_code", ")", "elif", "arg_3", ".", "res_label", ".", "upper", "(", ")", "in", "arg_1", "[", "'WLD'", "]", ":", "arg_5", "=", "(", "'WLD'", ",", "arg_3", ".", "res_label", ".", "upper", "(", ")", ")", "else", ":", "arg_4", "=", "(", "'{} ({}) atom is not parameterised in the selected'", "' residue force field.'", ")", ".", "format", "(", "arg_3", ".", "res_label", ",", "arg_3", ".", "parent", ".", "mol_code", ")", "if", "arg_4", ":", "warnings", ".", "warn", "(", "arg_4", ",", "NotParameterisedWarning", ")", "arg_3", ".", "tags", "[", "'_buff_ff_id'", "]", "=", "arg_5", "return"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Assigns force field parameters to Atoms in the AMPAL object.\n\n    Parameters\n    ----------\n    ampal_obj : AMPAL Object\n        Any AMPAL object with a `get_atoms` method.\n    ff: BuffForceField\n        The force field to be used for scoring.\n    \"\"\"\n    if hasattr(arg_0, 'ligands'):\n        arg_2 = arg_0.get_atoms(ligands=True, inc_alt_states=True)\n    else:\n        arg_2 = arg_0.get_atoms(inc_alt_states=True)\n    for arg_3 in arg_2:\n        arg_4 = None\n        arg_5 = None\n        if arg_3.element == 'H':\n            continue\n        elif arg_3.parent.mol_code.upper() in arg_1:\n            if arg_3.res_label.upper() in arg_1[arg_3.parent.mol_code]:\n                arg_5 = (arg_3.parent.mol_code.upper(),\n                           arg_3.res_label.upper())\n            elif arg_3.res_label.upper() in arg_1['WLD']:\n                arg_5 = ('WLD', arg_3.res_label.upper())\n            else:\n                arg_4 = ('{} atom is not parameterised in the selected '\n                         'force field for {} residues, this will be '\n                         'ignored.').format(\n                             arg_3.res_label, arg_3.parent.mol_code)\n        elif arg_3.res_label.upper() in arg_1['WLD']:\n            arg_5 = ('WLD', arg_3.res_label.upper())\n        else:\n            arg_4 = ('{} ({}) atom is not parameterised in the selected'\n                     ' residue force field.').format(\n                         arg_3.res_label, arg_3.parent.mol_code)\n        if arg_4:\n            warnings.warn(arg_4, NotParameterisedWarning)\n        arg_3.tags['_buff_ff_id'] = arg_5\n    return", "path": "src/budeff/force_field.py", "identifier": "assign_force_field", "docstring": "Assigns force field parameters to Atoms in the AMPAL object.\n\n    Parameters\n    ----------\n    ampal_obj : AMPAL Object\n        Any AMPAL object with a `get_atoms` method.\n    ff: BuffForceField\n        The force field to be used for scoring.", "docstring_tokens": ["Assigns", "force", "field", "parameters", "to", "Atoms", "in", "the", "AMPAL", "object", "."], "nwo": "isambard-uob/budeff", "score": 0.138843686048881, "idx": 261211}
{"url": "https://github.com/makearl/tornado-profile/blob/1b721480d7edc6229f991469e88b9f7a8bb914f3/tornado_profile.py#L212-L217", "sha": "1b721480d7edc6229f991469e88b9f7a8bb914f3", "docstring_summary": "Stop the profiler.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "CProfileWrapper", ".", "profiler", ".", "disable", "(", ")", "arg_0", ".", "running", "=", "False", "arg_0", ".", "set_status", "(", "204", ")", "arg_0", ".", "finish", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Stop the profiler.\"\"\"\n        CProfileWrapper.profiler.disable()\n        arg_0.running = False\n        arg_0.set_status(204)\n        arg_0.finish()", "path": "tornado_profile.py", "identifier": "CProfileHandler.delete", "docstring": "Stop the profiler.", "docstring_tokens": ["Stop", "the", "profiler", "."], "nwo": "makearl/tornado-profile", "score": 0.17553651708052445, "idx": 261212}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L1162-L1170", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Returns a sorted copy with the colors arranged according to the given comparison.", "language": "python", "parameters": "(self, comparison, reversed=False)", "return_statement": "return sorted", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "copy", "(", ")", "_list", ".", "sort", "(", "arg_3", ",", "arg_1", ")", "if", "arg_2", ":", "_list", ".", "reverse", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Returns a sorted copy with the colors arranged according to the given comparison.\n        \"\"\"\n        arg_3 = arg_0.copy()\n        _list.sort(arg_3, arg_1)\n        if arg_2:\n            _list.reverse(arg_3)\n        return arg_3", "path": "lib/colors/__init__.py", "identifier": "ColorList._sorted_copy", "docstring": "Returns a sorted copy with the colors arranged according to the given comparison.", "docstring_tokens": ["Returns", "a", "sorted", "copy", "with", "the", "colors", "arranged", "according", "to", "the", "given", "comparison", "."], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 261213}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/model.py#L475-L502", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "Saves the current entity to Redis. Will only save changed data by\n        default, but you can force a full save by passing ``full=True``.", "language": "python", "parameters": "(self, full=False, force=False)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "arg_2", "=", "False", ")", ":", "arg_3", "=", "arg_0", ".", "_new", "if", "arg_3", ":", "arg_0", ".", "_before_insert", "(", ")", "else", ":", "arg_0", ".", "_before_update", "(", ")", "arg_4", "=", "arg_0", ".", "to_dict", "(", ")", "arg_5", ",", "arg_6", "=", "arg_0", ".", "_apply_changes", "(", "arg_0", ".", "_last", ",", "arg_4", ",", "arg_1", "or", "arg_0", ".", "_new", "or", "arg_2", ",", "is_new", "=", "arg_0", ".", "_new", "or", "arg_2", ")", "arg_0", ".", "_last", "=", "arg_6", "arg_0", ".", "_new", "=", "False", "arg_0", ".", "_modified", "=", "False", "arg_0", ".", "_deleted", "=", "False", "if", "arg_3", ":", "arg_0", ".", "_after_insert", "(", ")", "else", ":", "arg_0", ".", "_after_update", "(", ")", "return", "arg_5"], "function": "def Func(arg_0, arg_1=False, arg_2=False):\n        '''\n        Saves the current entity to Redis. Will only Func changed data by\n        default, but you can force a full Func by passing ``full=True``.\n\n        If the underlying entity was deleted and you want to re-Func the entity,\n        you can pass ``force=True`` to force a full re-Func of the entity.\n        '''\n        # handle the pre-commit hooks\n        arg_3 = arg_0._new\n        if arg_3:\n            arg_0._before_insert()\n        else:\n            arg_0._before_update()\n\n        arg_4 = arg_0.to_dict()\n        arg_5, arg_6 = arg_0._apply_changes(\n            arg_0._last, arg_4, arg_1 or arg_0._new or arg_2, is_new=arg_0._new or arg_2)\n        arg_0._last = arg_6\n        arg_0._new = False\n        arg_0._modified = False\n        arg_0._deleted = False\n        # handle the post-commit hooks\n        if arg_3:\n            arg_0._after_insert()\n        else:\n            arg_0._after_update()\n        return arg_5", "path": "rom/model.py", "identifier": "Model.save", "docstring": "Saves the current entity to Redis. Will only save changed data by\n        default, but you can force a full save by passing ``full=True``.\n\n        If the underlying entity was deleted and you want to re-save the entity,\n        you can pass ``force=True`` to force a full re-save of the entity.", "docstring_tokens": ["Saves", "the", "current", "entity", "to", "Redis", ".", "Will", "only", "save", "changed", "data", "by", "default", "but", "you", "can", "force", "a", "full", "save", "by", "passing", "full", "=", "True", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 261214}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/boxscores.py#L143-L151", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Returns the year ID of the season in which this game took place.\n        Useful for week 17 January games.", "language": "python", "parameters": "(self)", "return_statement": "return date.year - 1 if date.month <= 3 else date.year", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "date", "(", ")", "return", "arg_1", ".", "year", "-", "1", "if", "arg_1", ".", "month", "<=", "3", "else", "arg_1", ".", "year"], "function": "def Func(arg_0):\n        \"\"\"\n        Returns the year ID of the Func in which this game took place.\n        Useful for week 17 January games.\n\n        :returns: An int representing the year of the Func.\n        \"\"\"\n        arg_1 = arg_0.date()\n        return arg_1.year - 1 if arg_1.month <= 3 else arg_1.year", "path": "sportsref/nfl/boxscores.py", "identifier": "BoxScore.season", "docstring": "Returns the year ID of the season in which this game took place.\n        Useful for week 17 January games.\n\n        :returns: An int representing the year of the season.", "docstring_tokens": ["Returns", "the", "year", "ID", "of", "the", "season", "in", "which", "this", "game", "took", "place", ".", "Useful", "for", "week", "17", "January", "games", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 261215}
{"url": "https://github.com/edx/edx-search/blob/476cf02b71ceba34ae7d8b798f36d60692317c55/search/elastic.py#L391-L413", "sha": "476cf02b71ceba34ae7d8b798f36d60692317c55", "docstring_summary": "Implements call to remove the documents from the index", "language": "python", "parameters": "(self, doc_type, doc_ids, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "try", ":", "arg_4", "=", "[", "]", "for", "arg_5", "in", "arg_2", ":", "log", ".", "debug", "(", "\"Removing document of type %s and index %s\"", ",", "arg_1", ",", "arg_5", ")", "arg_6", "=", "{", "'_op_type'", ":", "'delete'", ",", "\"_index\"", ":", "arg_0", ".", "index_name", ",", "\"_type\"", ":", "arg_1", ",", "\"_id\"", ":", "arg_5", "}", "arg_4", ".", "append", "(", "arg_6", ")", "bulk", "(", "arg_0", ".", "_es", ",", "arg_4", ",", "**", "arg_3", ")", "except", "BulkIndexError", "as", "ex", ":", "arg_7", "=", "[", "error", "for", "error", "in", "ex", ".", "errors", "if", "error", "[", "'delete'", "]", "[", "'status'", "]", "!=", "404", "]", "if", "arg_7", ":", "log", ".", "exception", "(", "\"An error occurred while removing documents from the index.\"", ")", "raise"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\" Implements call to Func the documents from the index \"\"\"\n\n        try:\n            # ignore is flagged as an unexpected-keyword-arg; ES python client documents that it can be used\n            # pylint: disable=unexpected-keyword-arg\n            arg_4 = []\n            for arg_5 in arg_2:\n                log.debug(\"Removing document of type %s and index %s\", arg_1, arg_5)\n                arg_6 = {\n                    '_op_type': 'delete',\n                    \"_index\": arg_0.index_name,\n                    \"_type\": arg_1,\n                    \"_id\": arg_5\n                }\n                arg_4.append(arg_6)\n            bulk(arg_0._es, arg_4, **arg_3)\n        except BulkIndexError as ex:\n            arg_7 = [error for error in ex.errors if error['delete']['status'] != 404]\n\n            if arg_7:\n                log.exception(\"An error occurred while removing documents from the index.\")\n                raise", "path": "search/elastic.py", "identifier": "ElasticSearchEngine.remove", "docstring": "Implements call to remove the documents from the index", "docstring_tokens": ["Implements", "call", "to", "remove", "the", "documents", "from", "the", "index"], "nwo": "edx/edx-search", "score": 0.5271177144519781, "idx": 261216}
{"url": "https://github.com/its-rigs/Trolly/blob/483dc94c352df40dc05ead31820b059b2545cf82/trolly/card.py#L42-L51", "sha": "483dc94c352df40dc05ead31820b059b2545cf82", "docstring_summary": "Get list information for this card. Returns a List object.", "language": "python", "parameters": "(self, **query_params)", "return_statement": "return self.create_list(list_json)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "Func_json", "(", "arg_0", ".", "base_uri", ",", "arg_1", "=", "arg_1", ")", "return", "arg_0", ".", "create_list", "(", "arg_2", ")"], "function": "def Func(arg_0, **arg_1):\n        '''\n        Get list information for this card. Returns a List object.\n\n        Returns:\n            List: The list this card is attached to\n        '''\n        arg_2 = arg_0.Func_json(arg_0.base_uri,\n                                       arg_1=arg_1)\n        return arg_0.create_list(arg_2)", "path": "trolly/card.py", "identifier": "Card.get_list", "docstring": "Get list information for this card. Returns a List object.\n\n        Returns:\n            List: The list this card is attached to", "docstring_tokens": ["Get", "list", "information", "for", "this", "card", ".", "Returns", "a", "List", "object", "."], "nwo": "its-rigs/Trolly", "score": 0.28433842921098695, "idx": 261217}
{"url": "https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/cli.py#L63-L68", "sha": "3d82670ee218ec64eb066289c82766d14d18cc92", "docstring_summary": "Evaluate the forms in stdin into a Python module AST node.", "language": "python", "parameters": "(stream, ctx: compiler.CompilerContext, module: types.ModuleType)", "return_statement": "return last", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "CompilerContext", ",", "arg_4", ":", "arg_5", ".", "ModuleType", ")", ":", "arg_7", "=", "None", "for", "arg_8", "in", "reader", ".", "read", "(", "arg_0", ",", "resolver", "=", "runtime", ".", "resolve_alias", ")", ":", "arg_7", "=", "arg_2", ".", "compile_and_exec_form", "(", "arg_8", ",", "arg_1", ",", "arg_4", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1: arg_2.CompilerContext, arg_4: arg_5.ModuleType):\n    \"\"\"Evaluate the forms in stdin into a Python module AST node.\"\"\"\n    arg_7 = None\n    for arg_8 in reader.read(arg_0, resolver=runtime.resolve_alias):\n        arg_7 = arg_2.compile_and_exec_form(arg_8, arg_1, arg_4)\n    return arg_7", "path": "src/basilisp/cli.py", "identifier": "eval_stream", "docstring": "Evaluate the forms in stdin into a Python module AST node.", "docstring_tokens": ["Evaluate", "the", "forms", "in", "stdin", "into", "a", "Python", "module", "AST", "node", "."], "nwo": "chrisrink10/basilisp", "score": 0.3609409501251981, "idx": 261218}
{"url": "https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/client.py#L1588-L1614", "sha": "50d20532a748f18e53f7d24ccbe6647132c979a9", "docstring_summary": "Parses response of an exchange token request.", "language": "python", "parameters": "(content)", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "}", "arg_0", "=", "_helpers", ".", "_from_bytes", "(", "arg_0", ")", "try", ":", "arg_1", "=", "json", ".", "loads", "(", "arg_0", ")", "except", "Exception", ":", "arg_1", "=", "_helpers", ".", "parse_unique_urlencoded", "(", "arg_0", ")", "if", "arg_1", "and", "'expires'", "in", "arg_1", ":", "arg_1", "[", "'expires_in'", "]", "=", "arg_1", ".", "pop", "(", "'expires'", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Parses response of an exchange token request.\n\n    Most providers return JSON but some (e.g. Facebook) return a\n    url-encoded string.\n\n    Args:\n        content: The body of a response\n\n    Returns:\n        Content as a dictionary object. Note that the dict could be empty,\n        i.e. {}. That basically indicates a failure.\n    \"\"\"\n    arg_1 = {}\n    arg_0 = _helpers._from_bytes(arg_0)\n    try:\n        arg_1 = json.loads(arg_0)\n    except Exception:\n        # different JSON libs raise different exceptions,\n        # so we just do a catch-all here\n        arg_1 = _helpers.parse_unique_urlencoded(arg_0)\n\n    # some providers respond with 'expires', others with 'expires_in'\n    if arg_1 and 'expires' in arg_1:\n        arg_1['expires_in'] = arg_1.pop('expires')\n\n    return arg_1", "path": "oauth2client/client.py", "identifier": "_parse_exchange_token_response", "docstring": "Parses response of an exchange token request.\n\n    Most providers return JSON but some (e.g. Facebook) return a\n    url-encoded string.\n\n    Args:\n        content: The body of a response\n\n    Returns:\n        Content as a dictionary object. Note that the dict could be empty,\n        i.e. {}. That basically indicates a failure.", "docstring_tokens": ["Parses", "response", "of", "an", "exchange", "token", "request", "."], "nwo": "googleapis/oauth2client", "score": 0.7662739292310984, "idx": 261219}
{"url": "https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/layout/matrix.py#L285-L287", "sha": "fd97e6c651a4bbcade64733847f4eec8f7704b7c", "docstring_summary": "Fill the matrix with the given RGB color", "language": "python", "parameters": "(self, color=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "md", ".", "fill_rect", "(", "arg_0", ".", "set", ",", "0", ",", "0", ",", "arg_0", ".", "width", ",", "arg_0", ".", "height", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Fill the matrix with the given RGB color\"\"\"\n        md.fill_rect(arg_0.set, 0, 0, arg_0.width, arg_0.height, arg_1)", "path": "bibliopixel/layout/matrix.py", "identifier": "Matrix.fillScreen", "docstring": "Fill the matrix with the given RGB color", "docstring_tokens": ["Fill", "the", "matrix", "with", "the", "given", "RGB", "color"], "nwo": "ManiacalLabs/BiblioPixel", "score": 0.6805866629861919, "idx": 261220}
{"url": "https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L826-L846", "sha": "2bf5c61a3ff6ae90613b81679de42c0f19aea600", "docstring_summary": "Check if the given node is from a fallback import block.", "language": "python", "parameters": "(node: astroid.node_classes.NodeNG)", "return_statement": "return ignores_import_error or has_fallback_imports", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "node_classes", ".", "NodeNG", ")", "->", "bool", ":", "arg_4", "=", "find_try_except_wrapper_node", "(", "arg_0", ")", "if", "not", "arg_4", ":", "return", "False", "if", "isinstance", "(", "arg_4", ",", "arg_1", ".", "ExceptHandler", ")", ":", "arg_5", "=", "arg_4", ".", "parent", ".", "body", "arg_6", "=", "arg_4", ".", "parent", ".", "handlers", "else", ":", "arg_5", "=", "itertools", ".", "chain", ".", "from_iterable", "(", "handler", ".", "body", "for", "handler", "in", "arg_4", ".", "handlers", ")", "arg_6", "=", "arg_4", ".", "handlers", "arg_7", "=", "any", "(", "isinstance", "(", "import_node", ",", "(", "arg_1", ".", "ImportFrom", ",", "arg_1", ".", "Import", ")", ")", "for", "import_node", "in", "arg_5", ")", "arg_8", "=", "_except_handlers_ignores_exception", "(", "arg_6", ",", "ImportError", ")", "return", "arg_8", "or", "arg_7"], "function": "def Func(arg_0: arg_1.node_classes.NodeNG) -> bool:\n    \"\"\"Check if the given node is from a fallback import block.\"\"\"\n    arg_4 = find_try_except_wrapper_node(arg_0)\n    if not arg_4:\n        return False\n\n    if isinstance(arg_4, arg_1.ExceptHandler):\n        arg_5 = arg_4.parent.body\n        arg_6 = arg_4.parent.handlers\n    else:\n        arg_5 = itertools.chain.from_iterable(\n            handler.body for handler in arg_4.handlers\n        )\n        arg_6 = arg_4.handlers\n\n    arg_7 = any(\n        isinstance(import_node, (arg_1.ImportFrom, arg_1.Import))\n        for import_node in arg_5\n    )\n    arg_8 = _except_handlers_ignores_exception(arg_6, ImportError)\n    return arg_8 or arg_7", "path": "pylint/checkers/utils.py", "identifier": "is_from_fallback_block", "docstring": "Check if the given node is from a fallback import block.", "docstring_tokens": ["Check", "if", "the", "given", "node", "is", "from", "a", "fallback", "import", "block", "."], "nwo": "PyCQA/pylint", "score": 0.7960905782143469, "idx": 261221}
{"url": "https://github.com/timheap/django-enumchoicefield/blob/59e230f8eed086c87ac6a9243448d2cd9adfc250/enumchoicefield/fields.py#L51-L59", "sha": "59e230f8eed086c87ac6a9243448d2cd9adfc250", "docstring_summary": "Convert a string from a form into an Enum value.", "language": "python", "parameters": "(self, value)", "return_statement": "return self.enum[value]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "is", "None", ":", "return", "arg_1", "if", "isinstance", "(", "arg_1", ",", "arg_0", ".", "enum", ")", ":", "return", "arg_1", "return", "arg_0", ".", "enum", "[", "arg_1", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Convert a string from a form into an Enum value.\n        \"\"\"\n        if arg_1 is None:\n            return arg_1\n        if isinstance(arg_1, arg_0.enum):\n            return arg_1\n        return arg_0.enum[arg_1]", "path": "enumchoicefield/fields.py", "identifier": "EnumChoiceField.to_python", "docstring": "Convert a string from a form into an Enum value.", "docstring_tokens": ["Convert", "a", "string", "from", "a", "form", "into", "an", "Enum", "value", "."], "nwo": "timheap/django-enumchoicefield", "score": 0.5020158257059026, "idx": 261222}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/edward2/random_variable.py#L287-L295", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Human-readable representation of a tensor's numpy value.", "language": "python", "parameters": "(tensor, is_repr=False)", "return_statement": "return text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ")", ":", "if", "arg_0", ".", "dtype", ".", "is_numpy_compatible", ":", "arg_2", "=", "repr", "(", "arg_0", ".", "numpy", "(", ")", ")", "if", "arg_1", "else", "str", "(", "arg_0", ".", "numpy", "(", ")", ")", "else", ":", "arg_2", "=", "\"<unprintable>\"", "if", "\"\\n\"", "in", "arg_2", ":", "arg_2", "=", "\"\\n\"", "+", "arg_2", "return", "arg_2"], "function": "def Func(arg_0, arg_1=False):\n  \"\"\"Human-readable representation of a tensor's numpy value.\"\"\"\n  if arg_0.dtype.is_numpy_compatible:\n    arg_2 = repr(arg_0.numpy()) if arg_1 else str(arg_0.numpy())\n  else:\n    arg_2 = \"<unprintable>\"\n  if \"\\n\" in arg_2:\n    arg_2 = \"\\n\" + arg_2\n  return arg_2", "path": "tensorflow_probability/python/edward2/random_variable.py", "identifier": "_numpy_text", "docstring": "Human-readable representation of a tensor's numpy value.", "docstring_tokens": ["Human", "-", "readable", "representation", "of", "a", "tensor", "s", "numpy", "value", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 261223}
{"url": "https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/passes/topython.py#L106-L133", "sha": "f153a97ef2b6bf915a1ed468c0252a9a59b754d5", "docstring_summary": "Generates python code to capture text consumed by a clause.", "language": "python", "parameters": "(self, node: parsing.Capture)", "return_statement": "return res", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ".", "Capture", ")", "->", "[", "ast", ".", "stmt", "]", "or", "ast", ".", "expr", ":", "arg_4", "=", "ast", ".", "Attribute", "(", "ast", ".", "Name", "(", "'self'", ",", "ast", ".", "Load", "(", ")", ")", ",", "'beginTag'", ",", "ast", ".", "Load", "(", ")", ")", "arg_5", "=", "ast", ".", "Attribute", "(", "ast", ".", "Name", "(", "'self'", ",", "ast", ".", "Load", "(", ")", ")", ",", "'endTag'", ",", "ast", ".", "Load", "(", ")", ")", "arg_6", "=", "ast", ".", "Call", "(", "arg_4", ",", "[", "ast", ".", "Str", "(", "arg_1", ".", "tagname", ")", "]", ",", "[", "]", ",", "None", ",", "None", ")", "arg_7", "=", "ast", ".", "Call", "(", "arg_5", ",", "[", "ast", ".", "Str", "(", "arg_1", ".", "tagname", ")", "]", ",", "[", "]", ",", "None", ",", "None", ")", "arg_8", "=", "[", "arg_6", ",", "arg_0", ".", "visit", "(", "arg_1", ".", "pt", ")", ",", "arg_7", "]", "for", "arg_9", "in", "arg_8", ":", "if", "not", "isinstance", "(", "arg_9", ",", "ast", ".", "expr", ")", ":", "break", "else", ":", "return", "ast", ".", "BoolOp", "(", "ast", ".", "And", "(", ")", ",", "arg_8", ")", "arg_10", "=", "[", "]", "for", "arg_11", "in", "map", "(", "arg_0", ".", "_clause", ",", "arg_8", ")", ":", "arg_10", ".", "extend", "(", "arg_11", ")", "return", "arg_10"], "function": "def Func(arg_0, arg_1: arg_2.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 not self.beginTag('tagname'):\n            return False\n        <code for the clause>\n        if not self.endTag('tagname'):\n            return False\n        \"\"\"\n        arg_4 = ast.Attribute(\n            ast.Name('self', ast.Load()), 'beginTag', ast.Load())\n        arg_5 = ast.Attribute(\n            ast.Name('self', ast.Load()), 'endTag', ast.Load())\n        arg_6 = ast.Call(arg_4, [ast.Str(arg_1.tagname)], [], None, None)\n        arg_7 = ast.Call(arg_5, [ast.Str(arg_1.tagname)], [], None, None)\n        arg_8 = [arg_6, arg_0.visit(arg_1.pt), arg_7]\n        for arg_9 in arg_8:\n            if not isinstance(arg_9, ast.expr):\n                break\n        else:\n            return ast.BoolOp(ast.And(), arg_8)\n        arg_10 = []\n        for arg_11 in map(arg_0._clause, arg_8):\n            arg_10.extend(arg_11)\n        return arg_10", "path": "pyrser/passes/topython.py", "identifier": "RuleVisitor.visit_Capture", "docstring": "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 not self.beginTag('tagname'):\n            return False\n        <code for the clause>\n        if not self.endTag('tagname'):\n            return False", "docstring_tokens": ["Generates", "python", "code", "to", "capture", "text", "consumed", "by", "a", "clause", "."], "nwo": "LionelAuroux/pyrser", "score": 0.17697123869542528, "idx": 261224}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_transfer_hook.py#L182-L200", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Updates a transfer job that runs periodically.", "language": "python", "parameters": "(self, job_name, body)", "return_statement": "return (\n            self.get_conn()\n            .transferJobs()\n            .patch(jobName=job_name, body=body)\n            .execute(num_retries=self.num_retries)\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_2", "=", "arg_0", ".", "_inject_project_id", "(", "arg_2", ",", "BODY", ",", "PROJECT_ID", ")", "return", "(", "arg_0", ".", "get_conn", "(", ")", ".", "transferJobs", "(", ")", ".", "patch", "(", "jobName", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ".", "execute", "(", "num_retries", "=", "arg_0", ".", "num_retries", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Updates a transfer job that runs periodically.\n\n        :param job_name: (Required) Name of the job to be updated\n        :type job_name: str\n        :param body: A request body, as described in\n            https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body\n        :type body: dict\n        :return: If successful, TransferJob.\n        :rtype: dict\n        \"\"\"\n        arg_2 = arg_0._inject_project_id(arg_2, BODY, PROJECT_ID)\n        return (\n            arg_0.get_conn()\n            .transferJobs()\n            .patch(jobName=arg_1, arg_2=arg_2)\n            .execute(num_retries=arg_0.num_retries)\n        )", "path": "airflow/contrib/hooks/gcp_transfer_hook.py", "identifier": "GCPTransferServiceHook.update_transfer_job", "docstring": "Updates a transfer job that runs periodically.\n\n        :param job_name: (Required) Name of the job to be updated\n        :type job_name: str\n        :param body: A request body, as described in\n            https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body\n        :type body: dict\n        :return: If successful, TransferJob.\n        :rtype: dict", "docstring_tokens": ["Updates", "a", "transfer", "job", "that", "runs", "periodically", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261225}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L438-L444", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "applies read depths filter", "language": "python", "parameters": "(data, reps)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "sum", "(", "arg_1", ")", ">=", "arg_0", ".", "paramsdict", "[", "\"mindepth_majrule\"", "]", "and", "sum", "(", "arg_1", ")", "<=", "arg_0", ".", "paramsdict", "[", "\"maxdepth\"", "]", ":", "return", "1", "else", ":", "return", "0"], "function": "def Func(arg_0, arg_1):\n    \"\"\" applies read depths filter \"\"\"\n    if sum(arg_1) >= arg_0.paramsdict[\"mindepth_majrule\"] and \\\n        sum(arg_1) <= arg_0.paramsdict[\"maxdepth\"]:\n        return 1\n    else:\n        return 0", "path": "ipyrad/assemble/consens_se.py", "identifier": "nfilter1", "docstring": "applies read depths filter", "docstring_tokens": ["applies", "read", "depths", "filter"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 261226}
{"url": "https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L674-L683", "sha": "1701526a91c14dc8ebc6452c45c8ec9a563a56db", "docstring_summary": "Normalised data points using pure Python.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "(", "arg_0", ".", "screen", ".", "width", "/", "float", "(", "len", "(", "arg_0", ".", "points", ")", ")", ")", "arg_2", "=", "(", "arg_0", ".", "screen", ".", "height", ")", "for", "arg_3", ",", "arg_4", "in", "enumerate", "(", "arg_0", ".", "points", ")", ":", "arg_5", "=", "(", "arg_4", "-", "arg_0", ".", "minimum", ")", "*", "4.0", "/", "arg_0", ".", "extents", "*", "arg_0", ".", "size", ".", "y", "yield", "Point", "(", "(", "arg_1", "*", "arg_3", ",", "min", "(", "arg_2", ",", "arg_2", "-", "arg_5", ")", ",", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Normalised data points using pure Python.\"\"\"\n        arg_1 = (arg_0.screen.width / float(len(arg_0.points)))\n        arg_2 = (arg_0.screen.height)\n        for arg_3, arg_4 in enumerate(arg_0.points):\n            arg_5 = (arg_4 - arg_0.minimum) * 4.0 / arg_0.extents * arg_0.size.y\n            yield Point((\n                arg_1 * arg_3,\n                min(arg_2, arg_2 - arg_5),\n            ))", "path": "diagram.py", "identifier": "AxisGraph._normalised_python", "docstring": "Normalised data points using pure Python.", "docstring_tokens": ["Normalised", "data", "points", "using", "pure", "Python", "."], "nwo": "tehmaze/diagram", "score": 0.5330178463252985, "idx": 261227}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/sqlalchemy.py#L156-L170", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Processes DateTimes from the DB making sure it is always\n        returning UTC. Not using timezone.convert_to_utc as that\n        converts to configured TIMEZONE while the DB might be\n        running with some other setting. We assume UTC datetimes\n        in the database.", "language": "python", "parameters": "(self, value, dialect)", "return_statement": "return value", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "is", "not", "None", ":", "if", "arg_1", ".", "tzinfo", "is", "None", ":", "arg_1", "=", "arg_1", ".", "replace", "(", "tzinfo", "=", "utc", ")", "else", ":", "arg_1", "=", "arg_1", ".", "astimezone", "(", "utc", ")", "return", "arg_1"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Processes DateTimes from the DB making sure it is always\n        returning UTC. Not using timezone.convert_to_utc as that\n        converts to configured TIMEZONE while the DB might be\n        running with some other setting. We assume UTC datetimes\n        in the database.\n        \"\"\"\n        if arg_1 is not None:\n            if arg_1.tzinfo is None:\n                arg_1 = arg_1.replace(tzinfo=utc)\n            else:\n                arg_1 = arg_1.astimezone(utc)\n\n        return arg_1", "path": "airflow/utils/sqlalchemy.py", "identifier": "UtcDateTime.process_result_value", "docstring": "Processes DateTimes from the DB making sure it is always\n        returning UTC. Not using timezone.convert_to_utc as that\n        converts to configured TIMEZONE while the DB might be\n        running with some other setting. We assume UTC datetimes\n        in the database.", "docstring_tokens": ["Processes", "DateTimes", "from", "the", "DB", "making", "sure", "it", "is", "always", "returning", "UTC", ".", "Not", "using", "timezone", ".", "convert_to_utc", "as", "that", "converts", "to", "configured", "TIMEZONE", "while", "the", "DB", "might", "be", "running", "with", "some", "other", "setting", ".", "We", "assume", "UTC", "datetimes", "in", "the", "database", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261228}
{"url": "https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L842-L856", "sha": "b378966b30146a952f7953c23202fb5a1ddf81d9", "docstring_summary": "Format and return data from API calls which return Items", "language": "python", "parameters": "(self, retrieved)", "return_statement": "return items", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "}", "if", "arg_0", ".", "preserve_json_order", ":", "arg_2", "[", "\"object_pairs_hook\"", "]", "=", "OrderedDict", "try", ":", "arg_3", "=", "[", "json", ".", "loads", "(", "e", "[", "\"content\"", "]", "[", "0", "]", "[", "\"value\"", "]", ",", "**", "arg_2", ")", "for", "e", "in", "arg_1", ".", "entries", "]", "except", "KeyError", ":", "return", "arg_0", ".", "_tags_data", "(", "arg_1", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Format and return data from API calls which return Items\n        \"\"\"\n        arg_2 = {}\n        if arg_0.preserve_json_order:\n            arg_2[\"object_pairs_hook\"] = OrderedDict\n        # send entries to _tags_data if there's no JSON\n        try:\n            arg_3 = [\n                json.loads(e[\"content\"][0][\"value\"], **arg_2)\n                for e in arg_1.entries\n            ]\n        except KeyError:\n            return arg_0._tags_data(arg_1)\n        return arg_3", "path": "pyzotero/zotero.py", "identifier": "Zotero._json_processor", "docstring": "Format and return data from API calls which return Items", "docstring_tokens": ["Format", "and", "return", "data", "from", "API", "calls", "which", "return", "Items"], "nwo": "urschrei/pyzotero", "score": 0.7369639044867552, "idx": 261229}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L559-L579", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Delete a project. It will recursively delete all the content.", "language": "python", "parameters": "(self, project)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "is_valid_uuid", "(", "arg_1", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for project: {0}'", ".", "format", "(", "arg_1", ")", ")", "arg_0", ".", "_authenticated_request", ".", "to_endpoint", "(", "'project/{}/'", ".", "format", "(", "arg_1", ")", ")", ".", "delete", "(", ")"], "function": "def Func(arg_0, arg_1):\n        '''Delete a project. It will recursively delete all the content.\n\n        Args:\n            project (str): The UUID of the project to be deleted.\n\n        Returns:\n            None\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: 403\n            StorageNotFoundException: 404\n            HTTPError: other non-20x error codes\n        '''\n        if not is_valid_uuid(arg_1):\n            raise StorageArgumentException(\n                'Invalid UUID for project: {0}'.format(arg_1))\n        arg_0._authenticated_request \\\n            .to_endpoint('project/{}/'.format(arg_1)) \\\n            .delete()", "path": "hbp_service_client/storage_service/api.py", "identifier": "ApiClient.delete_project", "docstring": "Delete a project. It will recursively delete all the content.\n\n        Args:\n            project (str): The UUID of the project to be deleted.\n\n        Returns:\n            None\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: 403\n            StorageNotFoundException: 404\n            HTTPError: other non-20x error codes", "docstring_tokens": ["Delete", "a", "project", ".", "It", "will", "recursively", "delete", "all", "the", "content", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 261230}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/plugins/plugin_pylearn2.py#L31-L41", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "Get mappable parameters from YAML.", "language": "python", "parameters": "(self)", "return_statement": "return names", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "Template", "(", "arg_0", ".", "yaml_string", ")", "arg_2", "=", "[", "'yaml_string'", "]", "for", "arg_3", "in", "re", ".", "finditer", "(", "arg_1", ".", "pattern", ",", "arg_1", ".", "template", ")", ":", "arg_4", "=", "arg_3", ".", "group", "(", "'named'", ")", "or", "arg_3", ".", "group", "(", "'braced'", ")", "assert", "arg_4", "is", "not", "None", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Get mappable parameters from YAML.\n        \"\"\"\n        arg_1 = Template(arg_0.yaml_string)\n        arg_2 = ['yaml_string']  # always include the template\n        for arg_3 in re.finditer(arg_1.pattern, arg_1.template):\n            arg_4 = arg_3.group('named') or arg_3.group('braced')\n            assert arg_4 is not None\n            arg_2.append(arg_4)\n        return arg_2", "path": "osprey/plugins/plugin_pylearn2.py", "identifier": "Pylearn2Estimator._get_param_names", "docstring": "Get mappable parameters from YAML.", "docstring_tokens": ["Get", "mappable", "parameters", "from", "YAML", "."], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 261231}
{"url": "https://github.com/NLeSC/pycoeman/blob/246d517b55cb98eb46f69aae453492cf9dd9d5af/pycoeman/utils_execution.py#L51-L57", "sha": "246d517b55cb98eb46f69aae453492cf9dd9d5af", "docstring_summary": "Apply the argument parser.", "language": "python", "parameters": "(argumentsParser, options=None)", "return_statement": "return args", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "not", "None", ":", "arg_2", "=", "arg_0", ".", "parse_args", "(", "arg_1", ")", "else", ":", "arg_2", "=", "arg_0", ".", "parse_args", "(", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Apply the argument parser. \"\"\"\n    if arg_1 is not None:\n        arg_2 = arg_0.parse_args(arg_1)\n    else:\n        arg_2 = arg_0.parse_args()\n    return arg_2", "path": "pycoeman/utils_execution.py", "identifier": "apply_argument_parser", "docstring": "Apply the argument parser.", "docstring_tokens": ["Apply", "the", "argument", "parser", "."], "nwo": "NLeSC/pycoeman", "score": 0.27637529583590154, "idx": 261232}
{"url": "https://github.com/hotdogee/gff3-py/blob/d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9/gff3/gff3.py#L826-L870", "sha": "d239bc9ed1eb7014c174f5fbed754f0f02d6e1b9", "docstring_summary": "Transfer children from old_parent to new_parent", "language": "python", "parameters": "(self, old_parent, new_parent)", "return_statement": "return children", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "try", ":", "arg_3", "=", "arg_1", "[", "'attributes'", "]", "[", "'ID'", "]", "except", "TypeError", ":", "try", ":", "arg_3", "=", "arg_0", ".", "lines", "[", "arg_1", "]", "[", "'attributes'", "]", "[", "'ID'", "]", "except", "TypeError", ":", "arg_3", "=", "arg_1", "arg_4", "=", "arg_0", ".", "features", "[", "arg_3", "]", "arg_5", "=", "[", "ld", "[", "'line_index'", "]", "for", "ld", "in", "arg_4", "]", "try", ":", "arg_6", "=", "arg_2", "[", "'attributes'", "]", "[", "'ID'", "]", "except", "TypeError", ":", "try", ":", "arg_6", "=", "arg_0", ".", "lines", "[", "arg_2", "]", "[", "'attributes'", "]", "[", "'ID'", "]", "except", "TypeError", ":", "arg_6", "=", "arg_2", "arg_7", "=", "arg_0", ".", "features", "[", "arg_6", "]", "arg_8", "=", "[", "ld", "[", "'line_index'", "]", "for", "ld", "in", "arg_7", "]", "arg_9", "=", "arg_4", "[", "0", "]", "[", "'children'", "]", "arg_10", "=", "set", "(", "[", "ld", "[", "'line_index'", "]", "for", "ld", "in", "arg_7", "[", "0", "]", "[", "'children'", "]", "]", ")", "for", "arg_11", "in", "arg_9", ":", "if", "arg_11", "[", "'line_index'", "]", "not", "in", "arg_10", ":", "arg_10", ".", "add", "(", "arg_11", "[", "'line_index'", "]", ")", "for", "arg_12", "in", "arg_7", ":", "arg_12", "[", "'children'", "]", ".", "append", "(", "arg_11", ")", "arg_11", "[", "'parents'", "]", ".", "append", "(", "arg_7", ")", "arg_11", "[", "'attributes'", "]", "[", "'Parent'", "]", ".", "append", "(", "arg_6", ")", "arg_11", "[", "'parents'", "]", "=", "[", "f", "for", "f", "in", "arg_11", "[", "'parents'", "]", "if", "f", "[", "0", "]", "[", "'attributes'", "]", "[", "'ID'", "]", "!=", "arg_3", "]", "arg_11", "[", "'attributes'", "]", "[", "'Parent'", "]", "=", "[", "d", "for", "d", "in", "arg_11", "[", "'attributes'", "]", "[", "'Parent'", "]", "if", "d", "!=", "arg_3", "]", "for", "arg_13", "in", "arg_4", ":", "arg_13", "[", "'children'", "]", "=", "[", "]", "return", "arg_9"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Transfer children from old_parent to new_parent\n\n        :param old_parent: feature_id(str) or line_index(int) or line_data(dict) or feature\n        :param new_parent: feature_id(str) or line_index(int) or line_data(dict)\n        :return: List of children transferred\n        \"\"\"\n        try: # assume line_data(dict)\n            arg_3 = arg_1['attributes']['ID']\n        except TypeError:\n            try: # assume line_index(int)\n                arg_3 = arg_0.lines[arg_1]['attributes']['ID']\n            except TypeError: # assume feature_id(str)\n                arg_3 = arg_1\n        arg_4 = arg_0.features[arg_3]\n        arg_5 = [ld['line_index'] for ld in arg_4]\n        try: # assume line_data(dict)\n            arg_6 = arg_2['attributes']['ID']\n        except TypeError:\n            try: # assume line_index(int)\n                arg_6 = arg_0.lines[arg_2]['attributes']['ID']\n            except TypeError: # assume feature_id(str)\n                arg_6 = arg_2\n        arg_7 = arg_0.features[arg_6]\n        arg_8 = [ld['line_index'] for ld in arg_7]\n        # build a list of children to be moved\n        # add the child to the new parent's children list if its not already there\n        # update the child's parent list and parent attribute\n        # finally remove the old parent's children list\n        arg_9 = arg_4[0]['children']\n        arg_10 = set([ld['line_index'] for ld in arg_7[0]['children']])\n        for arg_11 in arg_9:\n            if arg_11['line_index'] not in arg_10:\n                arg_10.add(arg_11['line_index'])\n                for arg_12 in arg_7:\n                    arg_12['children'].append(arg_11)\n                arg_11['parents'].append(arg_7)\n                arg_11['attributes']['Parent'].append(arg_6)\n            # remove multiple, list.remove() only removes 1\n            arg_11['parents'] = [f for f in arg_11['parents'] if f[0]['attributes']['ID'] != arg_3]\n            arg_11['attributes']['Parent'] = [d for d in arg_11['attributes']['Parent'] if d != arg_3]\n        for arg_13 in arg_4:\n            arg_13['children'] = []\n        return arg_9", "path": "gff3/gff3.py", "identifier": "Gff3.adopt", "docstring": "Transfer children from old_parent to new_parent\n\n        :param old_parent: feature_id(str) or line_index(int) or line_data(dict) or feature\n        :param new_parent: feature_id(str) or line_index(int) or line_data(dict)\n        :return: List of children transferred", "docstring_tokens": ["Transfer", "children", "from", "old_parent", "to", "new_parent"], "nwo": "hotdogee/gff3-py", "score": 0.18384731799856882, "idx": 261233}
{"url": "https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L797-L858", "sha": "68fea68646922b920d55975f9f2adaeafd84df4f", "docstring_summary": "Return exit status.", "language": "python", "parameters": "(argv, standard_out, standard_error)", "return_statement": "return 1 if failure else 0", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "import", "argparse", "arg_3", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ",", "prog", "=", "'autoflake'", ")", "arg_3", ".", "add_argument", "(", "'-c'", ",", "'--check'", ",", "action", "=", "'store_true'", ",", "help", "=", "'return error code if changes are needed'", ")", "arg_3", ".", "add_argument", "(", "'-i'", ",", "'--in-place'", ",", "action", "=", "'store_true'", ",", "help", "=", "'make changes to files instead of printing diffs'", ")", "arg_3", ".", "add_argument", "(", "'-r'", ",", "'--recursive'", ",", "action", "=", "'store_true'", ",", "help", "=", "'drill down directories recursively'", ")", "arg_3", ".", "add_argument", "(", "'--exclude'", ",", "metavar", "=", "'globs'", ",", "help", "=", "'exclude file/directory names that match these '", "'comma-separated globs'", ")", "arg_3", ".", "add_argument", "(", "'--imports'", ",", "help", "=", "'by default, only unused standard library '", "'imports are removed; specify a comma-separated '", "'list of additional modules/packages'", ")", "arg_3", ".", "add_argument", "(", "'--expand-star-imports'", ",", "action", "=", "'store_true'", ",", "help", "=", "'expand wildcard star imports with undefined '", "'names; this only triggers if there is only '", "'one star import in the file; this is skipped if '", "'there are any uses of `__all__` or `del` in the '", "'file'", ")", "arg_3", ".", "add_argument", "(", "'--remove-all-unused-imports'", ",", "action", "=", "'store_true'", ",", "help", "=", "'remove all unused imports (not just those from '", "'the standard library)'", ")", "arg_3", ".", "add_argument", "(", "'--ignore-init-module-imports'", ",", "action", "=", "'store_true'", ",", "help", "=", "'exclude __init__.py when removing unused '", "'imports'", ")", "arg_3", ".", "add_argument", "(", "'--remove-duplicate-keys'", ",", "action", "=", "'store_true'", ",", "help", "=", "'remove all duplicate keys in objects'", ")", "arg_3", ".", "add_argument", "(", "'--remove-unused-variables'", ",", "action", "=", "'store_true'", ",", "help", "=", "'remove unused variables'", ")", "arg_3", ".", "add_argument", "(", "'--version'", ",", "action", "=", "'version'", ",", "version", "=", "'%(prog)s '", "+", "__version__", ")", "arg_3", ".", "add_argument", "(", "'files'", ",", "nargs", "=", "'+'", ",", "help", "=", "'files to format'", ")", "arg_4", "=", "arg_3", ".", "parse_args", "(", "arg_0", "[", "1", ":", "]", ")", "if", "arg_4", ".", "remove_all_unused_imports", "and", "arg_4", ".", "imports", ":", "print", "(", "'Using both --remove-all and --imports is redundant'", ",", "file", "=", "arg_2", ")", "return", "1", "if", "arg_4", ".", "exclude", ":", "arg_4", ".", "exclude", "=", "_split_comma_separated", "(", "arg_4", ".", "exclude", ")", "else", ":", "arg_4", ".", "exclude", "=", "set", "(", "[", "]", ")", "arg_6", "=", "list", "(", "set", "(", "arg_4", ".", "files", ")", ")", "arg_7", "=", "False", "for", "arg_8", "in", "find_files", "(", "arg_6", ",", "arg_4", ".", "recursive", ",", "arg_4", ".", "exclude", ")", ":", "try", ":", "fix_file", "(", "arg_8", ",", "arg_4", "=", "arg_4", ",", "arg_1", "=", "arg_1", ")", "except", "IOError", "as", "exception", ":", "print", "(", "unicode", "(", "exception", ")", ",", "file", "=", "arg_2", ")", "arg_7", "=", "True", "return", "1", "if", "arg_7", "else", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Return exit status.\n\n    0 means no error.\n    \"\"\"\n    import argparse\n    arg_3 = argparse.ArgumentParser(description=__doc__, prog='autoflake')\n    arg_3.add_argument('-c', '--check', action='store_true',\n                        help='return error code if changes are needed')\n    arg_3.add_argument('-i', '--in-place', action='store_true',\n                        help='make changes to files instead of printing diffs')\n    arg_3.add_argument('-r', '--recursive', action='store_true',\n                        help='drill down directories recursively')\n    arg_3.add_argument('--exclude', metavar='globs',\n                        help='exclude file/directory names that match these '\n                             'comma-separated globs')\n    arg_3.add_argument('--imports',\n                        help='by default, only unused standard library '\n                             'imports are removed; specify a comma-separated '\n                             'list of additional modules/packages')\n    arg_3.add_argument('--expand-star-imports', action='store_true',\n                        help='expand wildcard star imports with undefined '\n                             'names; this only triggers if there is only '\n                             'one star import in the file; this is skipped if '\n                             'there are any uses of `__all__` or `del` in the '\n                             'file')\n    arg_3.add_argument('--remove-all-unused-imports', action='store_true',\n                        help='remove all unused imports (not just those from '\n                             'the standard library)')\n    arg_3.add_argument('--ignore-init-module-imports', action='store_true',\n                        help='exclude __init__.py when removing unused '\n                             'imports')\n    arg_3.add_argument('--remove-duplicate-keys', action='store_true',\n                        help='remove all duplicate keys in objects')\n    arg_3.add_argument('--remove-unused-variables', action='store_true',\n                        help='remove unused variables')\n    arg_3.add_argument('--version', action='version',\n                        version='%(prog)s ' + __version__)\n    arg_3.add_argument('files', nargs='+', help='files to format')\n\n    arg_4 = arg_3.parse_args(arg_0[1:])\n\n    if arg_4.remove_all_unused_imports and arg_4.imports:\n        print('Using both --remove-all and --imports is redundant',\n              file=arg_2)\n        return 1\n\n    if arg_4.exclude:\n        arg_4.exclude = _split_comma_separated(arg_4.exclude)\n    else:\n        arg_4.exclude = set([])\n\n    arg_6 = list(set(arg_4.files))\n    arg_7 = False\n    for arg_8 in find_files(arg_6, arg_4.recursive, arg_4.exclude):\n        try:\n            fix_file(arg_8, arg_4=arg_4, arg_1=arg_1)\n        except IOError as exception:\n            print(unicode(exception), file=arg_2)\n            arg_7 = True\n\n    return 1 if arg_7 else 0", "path": "autoflake.py", "identifier": "_main", "docstring": "Return exit status.\n\n    0 means no error.", "docstring_tokens": ["Return", "exit", "status", "."], "nwo": "myint/autoflake", "score": 0.7284243731837068, "idx": 261234}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L411-L421", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Same as `send_stream_error`, but expects `lock` acquired.", "language": "python", "parameters": "(self, condition)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "_output_state", "is", "\"closed\"", ":", "return", "if", "arg_0", ".", "_output_state", "in", "(", "None", ",", "\"restart\"", ")", ":", "arg_0", ".", "_send_stream_start", "(", ")", "arg_2", "=", "StreamErrorElement", "(", "arg_1", ")", ".", "as_xml", "(", ")", "arg_0", ".", "transport", ".", "send_element", "(", "arg_2", ")", "arg_0", ".", "transport", ".", "disconnect", "(", ")", "arg_0", ".", "_output_state", "=", "\"closed\""], "function": "def Func(arg_0, arg_1):\n        \"\"\"Same as `send_stream_error`, but expects `lock` acquired.\n        \"\"\"\n        if arg_0._output_state is \"closed\":\n            return\n        if arg_0._output_state in (None, \"restart\"):\n            arg_0._send_stream_start()\n        arg_2 = StreamErrorElement(arg_1).as_xml()\n        arg_0.transport.send_element(arg_2)\n        arg_0.transport.disconnect()\n        arg_0._output_state = \"closed\"", "path": "pyxmpp2/streambase.py", "identifier": "StreamBase._send_stream_error", "docstring": "Same as `send_stream_error`, but expects `lock` acquired.", "docstring_tokens": ["Same", "as", "send_stream_error", "but", "expects", "lock", "acquired", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 261235}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py#L141-L164", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "get properties from entry xml", "language": "python", "parameters": "(entry, include_id, id_prefix_to_skip=None, use_title_as_id=False)", "return_statement": "return properties", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "{", "}", "arg_5", "=", "arg_0", ".", "getAttributeNS", "(", "METADATA_NS", ",", "'etag'", ")", "if", "arg_5", ":", "arg_4", "[", "'etag'", "]", "=", "arg_5", "for", "arg_6", "in", "_MinidomXmlToObject", ".", "get_child_nodes", "(", "arg_0", ",", "'updated'", ")", ":", "arg_4", "[", "'updated'", "]", "=", "arg_6", ".", "firstChild", ".", "nodeValue", "for", "arg_7", "in", "_MinidomXmlToObject", ".", "get_children_from_path", "(", "arg_0", ",", "'author'", ",", "'name'", ")", ":", "if", "arg_7", ".", "firstChild", "is", "not", "None", ":", "arg_4", "[", "'author'", "]", "=", "arg_7", ".", "firstChild", ".", "nodeValue", "if", "arg_1", ":", "if", "arg_3", ":", "for", "arg_8", "in", "_MinidomXmlToObject", ".", "get_child_nodes", "(", "arg_0", ",", "'title'", ")", ":", "arg_4", "[", "'name'", "]", "=", "arg_8", ".", "firstChild", ".", "nodeValue", "else", ":", "for", "arg_9", "in", "_MinidomXmlToObject", ".", "get_child_nodes", "(", "arg_0", ",", "'id'", ")", ":", "arg_4", "[", "'name'", "]", "=", "_get_readable_id", "(", "arg_9", ".", "firstChild", ".", "nodeValue", ",", "arg_2", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=False):\n        ''' get properties from entry xml '''\n        arg_4 = {}\n\n        arg_5 = arg_0.getAttributeNS(METADATA_NS, 'etag')\n        if arg_5:\n            arg_4['etag'] = arg_5\n        for arg_6 in _MinidomXmlToObject.get_child_nodes(arg_0, 'updated'):\n            arg_4['updated'] = arg_6.firstChild.nodeValue\n        for arg_7 in _MinidomXmlToObject.get_children_from_path(arg_0, 'author', 'name'):\n            if arg_7.firstChild is not None:\n                arg_4['author'] = arg_7.firstChild.nodeValue\n\n        if arg_1:\n            if arg_3:\n                for arg_8 in _MinidomXmlToObject.get_child_nodes(arg_0, 'title'):\n                    arg_4['name'] = arg_8.firstChild.nodeValue\n            else:\n                # TODO: check if this is used\n                for arg_9 in _MinidomXmlToObject.get_child_nodes(arg_0, 'id'):\n                    arg_4['name'] = _get_readable_id(\n                        arg_9.firstChild.nodeValue, arg_2)\n\n        return arg_4", "path": "azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py", "identifier": "_MinidomXmlToObject.get_entry_properties_from_node", "docstring": "get properties from entry xml", "docstring_tokens": ["get", "properties", "from", "entry", "xml"], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 261236}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L303-L308", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles display of the graph dot traits.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "initialized", ":", "arg_0", ".", "model", ".", "edit_traits", "(", "parent", "=", "arg_1", ".", "ui", ".", "control", ",", "kind", "=", "\"live\"", ",", "view", "=", "attr_view", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handles display of the graph dot traits.\n        \"\"\"\n        if arg_1.initialized:\n            arg_0.model.edit_traits(parent=arg_1.ui.control,\n                kind=\"live\", view=attr_view)", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel.configure_graph", "docstring": "Handles display of the graph dot traits.", "docstring_tokens": ["Handles", "display", "of", "the", "graph", "dot", "traits", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 261237}
{"url": "https://github.com/acristoffers/ahio/blob/5d47f1697c173bd1cbdeac930546f97ad8570a38/ahio/drivers/arduino.py#L50-L70", "sha": "5d47f1697c173bd1cbdeac930546f97ad8570a38", "docstring_summary": "Connects to an Arduino UNO on serial port `port`.", "language": "python", "parameters": "(self, port)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "str", "(", "arg_1", ")", "arg_0", ".", "_serial", "=", "serial", ".", "Serial", "(", "arg_1", ",", "115200", ",", "timeout", "=", "2", ")", "time", ".", "sleep", "(", "2", ")", "if", "not", "arg_0", ".", "_serial", ".", "is_open", ":", "raise", "RuntimeError", "(", "'Could not connect to Arduino'", ")", "arg_0", ".", "_serial", ".", "write", "(", "b'\\x01'", ")", "if", "arg_0", ".", "_serial", ".", "read", "(", ")", "!=", "b'\\x06'", ":", "raise", "RuntimeError", "(", "'Could not connect to Arduino'", ")", "arg_3", "=", "[", "p", "for", "p", "in", "arg_0", ".", "available_pins", "(", ")", "if", "p", "[", "'digital'", "]", "[", "'output'", "]", "]", "for", "arg_4", "in", "arg_3", ":", "arg_0", ".", "_set_pin_direction", "(", "arg_4", "[", "'id'", "]", ",", "ahio", ".", "Direction", ".", "Output", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Connects to an Arduino UNO on serial port `port`.\n\n        @throw RuntimeError can't connect to Arduino\n        \"\"\"\n        arg_1 = str(arg_1)\n        # timeout is used by all I/O operations\n        arg_0._serial = serial.Serial(arg_1, 115200, timeout=2)\n        time.sleep(2)  # time to Arduino reset\n\n        if not arg_0._serial.is_open:\n            raise RuntimeError('Could not connect to Arduino')\n\n        arg_0._serial.write(b'\\x01')\n\n        if arg_0._serial.read() != b'\\x06':\n            raise RuntimeError('Could not connect to Arduino')\n\n        arg_3 = [p for p in arg_0.available_pins() if p['digital']['output']]\n        for arg_4 in arg_3:\n            arg_0._set_pin_direction(arg_4['id'], ahio.Direction.Output)", "path": "ahio/drivers/arduino.py", "identifier": "Driver.setup", "docstring": "Connects to an Arduino UNO on serial port `port`.\n\n        @throw RuntimeError can't connect to Arduino", "docstring_tokens": ["Connects", "to", "an", "Arduino", "UNO", "on", "serial", "port", "port", "."], "nwo": "acristoffers/ahio", "score": 0.21302904236143622, "idx": 261238}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/protocol.py#L229-L232", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Generates a random REQID for request", "language": "python", "parameters": "()", "return_statement": "return REQID(data_bytes)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "bytearray", "(", "random", ".", "getrandbits", "(", "8", ")", "for", "i", "in", "range", "(", "REQID", ".", "REQID_SIZE", ")", ")", "return", "REQID", "(", "arg_0", ")"], "function": "def Func():\n    \"\"\"Generates a random REQID for request\"\"\"\n    arg_0 = bytearray(random.getrandbits(8) for i in range(REQID.REQID_SIZE))\n    return REQID(arg_0)", "path": "heron/instance/src/python/network/protocol.py", "identifier": "REQID.generate", "docstring": "Generates a random REQID for request", "docstring_tokens": ["Generates", "a", "random", "REQID", "for", "request"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 261239}
{"url": "https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L158-L167", "sha": "881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea", "docstring_summary": "Retrieves the number of teams of the organization.", "language": "python", "parameters": "(self)", "return_statement": "return counter", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "print", "'Getting teams.'", "arg_1", "=", "0", "for", "arg_2", "in", "arg_0", ".", "org_retrieved", ".", "iter_teams", "(", ")", ":", "arg_0", ".", "teams_json", "[", "arg_2", ".", "id", "]", "=", "arg_2", ".", "to_json", "(", ")", "arg_1", "+=", "1", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"\n        Retrieves the number of teams of the organization.\n        \"\"\"\n        print 'Getting teams.'\n        arg_1 = 0\n        for arg_2 in arg_0.org_retrieved.iter_teams():\n            arg_0.teams_json[arg_2.id] = arg_2.to_json()\n            arg_1 += 1\n        return arg_1", "path": "scripts/github_stats.py", "identifier": "GitHub_LLNL_Stats.get_teams_of_org", "docstring": "Retrieves the number of teams of the organization.", "docstring_tokens": ["Retrieves", "the", "number", "of", "teams", "of", "the", "organization", "."], "nwo": "LLNL/scraper", "score": 0.5080454153836005, "idx": 261240}
{"url": "https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/invoice.py#L28-L48", "sha": "461d5846c6f9f3b7099322a94f5d9911564448e4", "docstring_summary": "Returns an invoice object for a given cart at its current revision.\n        If such an invoice does not exist, the cart is validated, and if valid,\n        an invoice is generated.", "language": "python", "parameters": "(cls, cart)", "return_statement": "return cls(invoice)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", ".", "refresh_from_db", "(", ")", "try", ":", "arg_2", "=", "commerce", ".", "Invoice", ".", "objects", ".", "exclude", "(", "status", "=", "commerce", ".", "Invoice", ".", "STATUS_VOID", ",", ")", ".", "get", "(", "arg_1", "=", "arg_1", ",", "cart_revision", "=", "arg_1", ".", "revision", ",", ")", "except", "ObjectDoesNotExist", ":", "arg_3", "=", "CartController", "(", "arg_1", ")", "arg_3", ".", "validate_cart", "(", ")", "arg_0", ".", "update_old_invoices", "(", "arg_1", ")", "arg_2", "=", "arg_0", ".", "_generate_from_cart", "(", "arg_1", ")", "return", "arg_0", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1):\n        ''' Returns an invoice object for a given cart at its current revision.\n        If such an invoice does not exist, the cart is validated, and if valid,\n        an invoice is generated.'''\n\n        arg_1.refresh_from_db()\n        try:\n            arg_2 = commerce.Invoice.objects.exclude(\n                status=commerce.Invoice.STATUS_VOID,\n            ).get(\n                arg_1=arg_1,\n                cart_revision=arg_1.revision,\n            )\n        except ObjectDoesNotExist:\n            arg_3 = CartController(arg_1)\n            arg_3.validate_cart()  # Raises ValidationError on fail.\n\n            arg_0.update_old_invoices(arg_1)\n            arg_2 = arg_0._generate_from_cart(arg_1)\n\n        return arg_0(arg_2)", "path": "registrasion/controllers/invoice.py", "identifier": "InvoiceController.for_cart", "docstring": "Returns an invoice object for a given cart at its current revision.\n        If such an invoice does not exist, the cart is validated, and if valid,\n        an invoice is generated.", "docstring_tokens": ["Returns", "an", "invoice", "object", "for", "a", "given", "cart", "at", "its", "current", "revision", ".", "If", "such", "an", "invoice", "does", "not", "exist", "the", "cart", "is", "validated", "and", "if", "valid", "an", "invoice", "is", "generated", "."], "nwo": "chrisjrn/registrasion", "score": 0.2778869743536733, "idx": 261241}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/mixins.py#L153-L191", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Delete files in `root_folder` which match `regex` before file ext.", "language": "python", "parameters": "(self, root_folder, regex)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "not", "arg_0", ".", "name", ":", "return", "try", ":", "arg_3", ",", "arg_4", "=", "arg_0", ".", "storage", ".", "listdir", "(", "arg_1", ")", "except", "OSError", ":", "pass", "else", ":", "arg_5", ",", "arg_6", "=", "os", ".", "path", ".", "split", "(", "arg_0", ".", "name", ")", "arg_7", ",", "arg_8", "=", "os", ".", "path", ".", "splitext", "(", "arg_6", ")", "for", "arg_9", "in", "arg_4", ":", "if", "not", "arg_9", ".", "startswith", "(", "arg_7", ")", "or", "not", "arg_9", ".", "endswith", "(", "arg_8", ")", ":", "continue", "arg_10", "=", "arg_9", "[", "len", "(", "arg_7", ")", ":", "-", "len", "(", "arg_8", ")", "]", "assert", "arg_9", "==", "arg_7", "+", "arg_10", "+", "arg_8", "if", "arg_2", ".", "match", "(", "arg_10", ")", "is", "not", "None", ":", "arg_11", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_9", ")", "arg_0", ".", "storage", ".", "delete", "(", "arg_11", ")", "cache", ".", "delete", "(", "arg_0", ".", "storage", ".", "url", "(", "arg_11", ")", ")", "print", "(", "\"Deleted {file} (created from: {original})\"", ".", "format", "(", "file", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "arg_9", ")", ",", "original", "=", "arg_0", ".", "name", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Delete files in `root_folder` which match `regex` before file ext.\n\n        Example values:\n            * root_folder = 'foo/'\n            * self.name = 'bar.jpg'\n            * regex = re.compile('-baz')\n\n            Result:\n                * foo/bar-baz.jpg <- Deleted\n                * foo/bar-biz.jpg <- Not deleted\n        \"\"\"\n        if not arg_0.name:   # pragma: no cover\n            return\n        try:\n            arg_3, arg_4 = arg_0.storage.listdir(arg_1)\n        except OSError:   # pragma: no cover\n            pass\n        else:\n            arg_5, arg_6 = os.path.split(arg_0.name)\n            arg_7, arg_8 = os.path.splitext(arg_6)\n            for arg_9 in arg_4:\n                if not arg_9.startswith(arg_7) or not arg_9.endswith(arg_8):   # pragma: no cover\n                    continue\n                arg_10 = arg_9[len(arg_7):-len(arg_8)]\n                assert arg_9 == arg_7 + arg_10 + arg_8\n                if arg_2.match(arg_10) is not None:\n                    arg_11 = os.path.join(arg_1, arg_9)\n                    arg_0.storage.delete(arg_11)\n                    cache.delete(\n                        arg_0.storage.url(arg_11)\n                    )\n                    print(\n                        \"Deleted {file} (created from: {original})\".format(\n                            file=os.path.join(arg_1, arg_9),\n                            original=arg_0.name\n                        )\n                    )", "path": "versatileimagefield/mixins.py", "identifier": "VersatileImageMixIn.delete_matching_files_from_storage", "docstring": "Delete files in `root_folder` which match `regex` before file ext.\n\n        Example values:\n            * root_folder = 'foo/'\n            * self.name = 'bar.jpg'\n            * regex = re.compile('-baz')\n\n            Result:\n                * foo/bar-baz.jpg <- Deleted\n                * foo/bar-biz.jpg <- Not deleted", "docstring_tokens": ["Delete", "files", "in", "root_folder", "which", "match", "regex", "before", "file", "ext", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 261242}
{"url": "https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/widgets/console.py#L71-L77", "sha": "821e000ea2e2638a82ce095a559e69afd9bd4f38", "docstring_summary": "Update terminal color scheme based on the pygments color scheme colors", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "color_scheme", "=", "arg_0", ".", "create_color_scheme", "(", "background", "=", "arg_0", ".", "syntax_highlighter", ".", "color_scheme", ".", "background", ",", "foreground", "=", "arg_0", ".", "syntax_highlighter", ".", "color_scheme", ".", "formats", "[", "'normal'", "]", ".", "foreground", "(", ")", ".", "color", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Update terminal color scheme based on the pygments color scheme colors\n        \"\"\"\n        arg_0.color_scheme = arg_0.create_color_scheme(\n            background=arg_0.syntax_highlighter.color_scheme.background,\n            foreground=arg_0.syntax_highlighter.color_scheme.formats['normal'].foreground().color())", "path": "pyqode/python/widgets/console.py", "identifier": "PyConsole.update_terminal_colors", "docstring": "Update terminal color scheme based on the pygments color scheme colors", "docstring_tokens": ["Update", "terminal", "color", "scheme", "based", "on", "the", "pygments", "color", "scheme", "colors"], "nwo": "pyQode/pyqode.python", "score": 0.37758032261644603, "idx": 261243}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/sts/fitting.py#L65-L89", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Built a transformed-normal variational dist over a parameter's support.", "language": "python", "parameters": "(param, initial_loc_fn)", "return_statement": "return tfd.TransformedDistribution(q, param.bijector)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "tf", ".", "compat", ".", "v1", ".", "get_variable", "(", "arg_0", ".", "name", "+", "'_loc'", ",", "initializer", "=", "lambda", ":", "arg_1", "(", "arg_0", ")", ",", "dtype", "=", "arg_0", ".", "prior", ".", "dtype", ",", "use_resource", "=", "True", ")", "arg_3", "=", "tf", ".", "nn", ".", "softplus", "(", "tf", ".", "compat", ".", "v1", ".", "get_variable", "(", "arg_0", ".", "name", "+", "'_scale'", ",", "initializer", "=", "lambda", ":", "-", "4", "*", "tf", ".", "ones_like", "(", "arg_1", "(", "arg_0", ")", ")", ",", "dtype", "=", "arg_0", ".", "prior", ".", "dtype", ",", "use_resource", "=", "True", ")", ")", "arg_4", "=", "tfd", ".", "Normal", "(", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", "if", "(", "arg_0", ".", "prior", ".", "event_shape", ".", "ndims", "is", "None", "or", "arg_0", ".", "prior", ".", "event_shape", ".", "ndims", ">", "0", ")", ":", "arg_4", "=", "tfd", ".", "Independent", "(", "arg_4", ",", "reinterpreted_batch_ndims", "=", "arg_0", ".", "prior", ".", "event_shape", ".", "ndims", ")", "return", "tfd", ".", "TransformedDistribution", "(", "arg_4", ",", "arg_0", ".", "bijector", ")"], "function": "def Func(arg_0, arg_1):\n  \"\"\"Built a transformed-normal variational dist over a parameter's support.\"\"\"\n  arg_2 = tf.compat.v1.get_variable(\n      arg_0.name + '_loc',\n      initializer=lambda: arg_1(arg_0),\n      dtype=arg_0.prior.dtype,\n      use_resource=True)\n  arg_3 = tf.nn.softplus(\n      tf.compat.v1.get_variable(\n          arg_0.name + '_scale',\n          initializer=lambda: -4 * tf.ones_like(arg_1(arg_0)),\n          dtype=arg_0.prior.dtype,\n          use_resource=True))\n\n  arg_4 = tfd.Normal(arg_2=arg_2, arg_3=arg_3)\n\n  # Ensure the `event_shape` of the variational distribution matches the\n  # parameter.\n  if (arg_0.prior.event_shape.ndims is None\n      or arg_0.prior.event_shape.ndims > 0):\n    arg_4 = tfd.Independent(\n        arg_4, reinterpreted_batch_ndims=arg_0.prior.event_shape.ndims)\n\n  # Transform to constrained parameter space.\n  return tfd.TransformedDistribution(arg_4, arg_0.bijector)", "path": "tensorflow_probability/python/sts/fitting.py", "identifier": "_build_trainable_posterior", "docstring": "Built a transformed-normal variational dist over a parameter's support.", "docstring_tokens": ["Built", "a", "transformed", "-", "normal", "variational", "dist", "over", "a", "parameter", "s", "support", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 261244}
{"url": "https://github.com/blockstack/zone-file-py/blob/c1078c8c3c28f0881bc9a3af53d4972c4a6862d0/blockstack_zones/parse_zone_file.py#L182-L195", "sha": "c1078c8c3c28f0881bc9a3af53d4972c4a6862d0", "docstring_summary": "Remove comments from a zonefile", "language": "python", "parameters": "(text)", "return_statement": "return \"\\n\".join(ret)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "arg_0", ".", "split", "(", "\"\\n\"", ")", "for", "arg_3", "in", "arg_2", ":", "if", "len", "(", "arg_3", ")", "==", "0", ":", "continue", "arg_3", "=", "serialize", "(", "tokenize_line", "(", "arg_3", ")", ")", "arg_1", ".", "append", "(", "arg_3", ")", "return", "\"\\n\"", ".", "join", "(", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Remove comments from a zonefile\n    \"\"\"\n    arg_1 = []\n    arg_2 = arg_0.split(\"\\n\")\n    for arg_3 in arg_2:\n        if len(arg_3) == 0:\n            continue \n\n        arg_3 = serialize(tokenize_line(arg_3))\n        arg_1.append(arg_3)\n\n    return \"\\n\".join(arg_1)", "path": "blockstack_zones/parse_zone_file.py", "identifier": "remove_comments", "docstring": "Remove comments from a zonefile", "docstring_tokens": ["Remove", "comments", "from", "a", "zonefile"], "nwo": "blockstack/zone-file-py", "score": 0.4104459992179242, "idx": 261245}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/coordinate.py#L165-L175", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns the order for a coordinate.", "language": "python", "parameters": "(cls, coordinate)", "return_statement": "return rng.getReal64()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_hashCoordinate", "(", "arg_1", ")", "arg_3", "=", "Random", "(", "arg_2", ")", "return", "arg_3", ".", "getReal64", "(", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the order for a coordinate.\n\n    @param coordinate (numpy.array) Coordinate\n    @return (float) A value in the interval [0, 1), representing the\n                    order of the coordinate\n    \"\"\"\n    arg_2 = arg_0._hashCoordinate(arg_1)\n    arg_3 = Random(arg_2)\n    return arg_3.getReal64()", "path": "src/nupic/encoders/coordinate.py", "identifier": "CoordinateEncoder._orderForCoordinate", "docstring": "Returns the order for a coordinate.\n\n    @param coordinate (numpy.array) Coordinate\n    @return (float) A value in the interval [0, 1), representing the\n                    order of the coordinate", "docstring_tokens": ["Returns", "the", "order", "for", "a", "coordinate", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261246}
{"url": "https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/_decode.py#L13-L36", "sha": "af778bf1c88bf6c4a7342f5353b130686a5bbe1c", "docstring_summary": "Tries decoding a byte string from the OS into a unicode string", "language": "python", "parameters": "(byte_string)", "return_statement": "return str_cls(byte_string, errors='replace')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "return", "str_cls", "(", "arg_0", ",", "_encoding", ")", "except", "(", "UnicodeDecodeError", ")", ":", "for", "arg_1", "in", "_fallback_encodings", ":", "try", ":", "return", "str_cls", "(", "arg_0", ",", "arg_1", ",", "errors", "=", "'strict'", ")", "except", "(", "UnicodeDecodeError", ")", ":", "pass", "return", "str_cls", "(", "arg_0", ",", "errors", "=", "'replace'", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Tries decoding a byte string from the OS into a unicode string\n\n    :param byte_string:\n        A byte string\n\n    :return:\n        A unicode string\n    \"\"\"\n\n    try:\n        return str_cls(arg_0, _encoding)\n\n    # If the \"correct\" encoding did not work, try some defaults, and then just\n    # obliterate characters that we can't seen to decode properly\n    except (UnicodeDecodeError):\n        for arg_1 in _fallback_encodings:\n            try:\n                return str_cls(arg_0, arg_1, errors='strict')\n            except (UnicodeDecodeError):\n                pass\n\n    return str_cls(arg_0, errors='replace')", "path": "oscrypto/_win/_decode.py", "identifier": "_try_decode", "docstring": "Tries decoding a byte string from the OS into a unicode string\n\n    :param byte_string:\n        A byte string\n\n    :return:\n        A unicode string", "docstring_tokens": ["Tries", "decoding", "a", "byte", "string", "from", "the", "OS", "into", "a", "unicode", "string"], "nwo": "wbond/oscrypto", "score": 0.5566939757839513, "idx": 261247}
{"url": "https://github.com/jjangsangy/py-translate/blob/fe6279b2ee353f42ce73333ffae104e646311956/translate/__main__.py#L107-L115", "sha": "fe6279b2ee353f42ce73333ffae104e646311956", "docstring_summary": "Main Entry point for translator and argument parser", "language": "python", "parameters": "()", "return_statement": "return source(spool(set_task(translate, translit=args.translit)), args.text)", "argument_list": "", "function_tokens": ["def", "Func", "(", ")", ":", "arg_0", "=", "command_line", "(", ")", "arg_1", "=", "partial", "(", "translator", ",", "arg_0", ".", "source", ",", "arg_0", ".", "dest", ",", "version", "=", "' '", ".", "join", "(", "[", "__version__", ",", "__build__", "]", ")", ")", "return", "source", "(", "spool", "(", "set_task", "(", "arg_1", ",", "translit", "=", "arg_0", ".", "translit", ")", ")", ",", "arg_0", ".", "text", ")"], "function": "def Func():\n    '''\n    Main Entry point for translator and argument parser\n    '''\n    arg_0      = command_line()\n    arg_1 = partial(translator, arg_0.source, arg_0.dest,\n                        version=' '.join([__version__, __build__]))\n\n    return source(spool(set_task(arg_1, translit=arg_0.translit)), arg_0.text)", "path": "translate/__main__.py", "identifier": "main", "docstring": "Main Entry point for translator and argument parser", "docstring_tokens": ["Main", "Entry", "point", "for", "translator", "and", "argument", "parser"], "nwo": "jjangsangy/py-translate", "score": 0.4707749115306036, "idx": 261248}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L386-L407", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Function internally used to detect the notation of the\n    given IP or netmask.", "language": "python", "parameters": "(ip, _isnm)", "return_statement": "return IP_UNKNOWN", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", "=", "str", "(", "arg_0", ")", "if", "len", "(", "arg_0", ")", ">", "1", ":", "if", "arg_0", "[", "0", ":", "2", "]", "==", "'0x'", ":", "if", "_CHECK_FUNCT", "[", "IP_HEX", "]", "[", "arg_1", "]", "(", "arg_0", ")", ":", "return", "IP_HEX", "elif", "arg_0", "[", "0", "]", "==", "'0'", ":", "if", "_CHECK_FUNCT", "[", "IP_OCT", "]", "[", "arg_1", "]", "(", "arg_0", ")", ":", "return", "IP_OCT", "if", "_CHECK_FUNCT", "[", "IP_DOT", "]", "[", "arg_1", "]", "(", "arg_0", ")", ":", "return", "IP_DOT", "elif", "arg_1", "and", "_CHECK_FUNCT", "[", "NM_BITS", "]", "[", "arg_1", "]", "(", "arg_0", ")", ":", "return", "NM_BITS", "elif", "_CHECK_FUNCT", "[", "IP_DEC", "]", "[", "arg_1", "]", "(", "arg_0", ")", ":", "return", "IP_DEC", "elif", "arg_1", "and", "_CHECK_FUNCT", "[", "NM_WILDCARD", "]", "[", "arg_1", "]", "(", "arg_0", ")", ":", "return", "NM_WILDCARD", "elif", "_CHECK_FUNCT", "[", "IP_BIN", "]", "[", "arg_1", "]", "(", "arg_0", ")", ":", "return", "IP_BIN", "return", "IP_UNKNOWN"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Function internally used to detect the notation of the\n    given IP or netmask.\"\"\"\n    arg_0 = str(arg_0)\n    if len(arg_0) > 1:\n        if arg_0[0:2] == '0x':\n            if _CHECK_FUNCT[IP_HEX][arg_1](arg_0):\n                return IP_HEX\n        elif arg_0[0] == '0':\n            if _CHECK_FUNCT[IP_OCT][arg_1](arg_0):\n                return IP_OCT\n    if _CHECK_FUNCT[IP_DOT][arg_1](arg_0):\n        return IP_DOT\n    elif arg_1 and _CHECK_FUNCT[NM_BITS][arg_1](arg_0):\n        return NM_BITS\n    elif _CHECK_FUNCT[IP_DEC][arg_1](arg_0):\n        return IP_DEC\n    elif arg_1 and _CHECK_FUNCT[NM_WILDCARD][arg_1](arg_0):\n        return NM_WILDCARD\n    elif _CHECK_FUNCT[IP_BIN][arg_1](arg_0):\n        return IP_BIN\n    return IP_UNKNOWN", "path": "iplib.py", "identifier": "_detect", "docstring": "Function internally used to detect the notation of the\n    given IP or netmask.", "docstring_tokens": ["Function", "internally", "used", "to", "detect", "the", "notation", "of", "the", "given", "IP", "or", "netmask", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 261249}
{"url": "https://github.com/Infinidat/infi.gevent_utils/blob/7eb3c1601b8f2c9aaa3a83154ee7dfce8e5e5a5a/src/infi/gevent_utils/gevent_loop.py#L57-L62", "sha": "7eb3c1601b8f2c9aaa3a83154ee7dfce8e5e5a5a", "docstring_summary": "Kills the running loop and waits till it gets killed.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "assert", "arg_0", ".", "has_started", "(", ")", ",", "\"called Func() on a non-active GeventLoop\"", "arg_0", ".", "_stop_event", ".", "set", "(", ")", "arg_0", ".", "_greenlet", ".", "Func", "(", ")", "arg_0", ".", "_clear", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Kills the running loop and waits till it gets Funced.\"\"\"\n        assert arg_0.has_started(), \"called Func() on a non-active GeventLoop\"\n        arg_0._stop_event.set()\n        arg_0._greenlet.Func()\n        arg_0._clear()", "path": "src/infi/gevent_utils/gevent_loop.py", "identifier": "GeventLoopBase.kill", "docstring": "Kills the running loop and waits till it gets killed.", "docstring_tokens": ["Kills", "the", "running", "loop", "and", "waits", "till", "it", "gets", "killed", "."], "nwo": "Infinidat/infi.gevent_utils", "score": 0.09252797783733271, "idx": 261250}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/extended_logger.py#L71-L80", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Log 'msg % args' with severity 'WARNING'.", "language": "python", "parameters": "(self, msg, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_0", ".", "_baseLogger", ".", "Func", "(", "arg_0", ",", "arg_0", ".", "getExtendedMsg", "(", "arg_1", ")", ",", "*", "arg_2", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, *arg_2, **arg_3):\n    \"\"\"\n    Log 'msg % args' with severity 'WARNING'.\n\n    To pass exception information, use the keyword argument exc_info with\n    a true value, e.g.\n\n    logger.Func(\"Houston, we have a %s\", \"bit of a problem\", exc_info=1)\n    \"\"\"\n    arg_0._baseLogger.Func(arg_0, arg_0.getExtendedMsg(arg_1), *arg_2, **arg_3)", "path": "src/nupic/swarming/hypersearch/extended_logger.py", "identifier": "ExtendedLogger.warning", "docstring": "Log 'msg % args' with severity 'WARNING'.\n\n    To pass exception information, use the keyword argument exc_info with\n    a true value, e.g.\n\n    logger.warning(\"Houston, we have a %s\", \"bit of a problem\", exc_info=1)", "docstring_tokens": ["Log", "msg", "%", "args", "with", "severity", "WARNING", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261251}
{"url": "https://github.com/Crypto-toolbox/btfxwss/blob/16827fa6aacb2c0e289aa852bf61a18df6905835/btfxwss/connection.py#L276-L289", "sha": "16827fa6aacb2c0e289aa852bf61a18df6905835", "docstring_summary": "Checks if a Pong message was received.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "pong_timer", ".", "cancel", "(", ")", "if", "arg_0", ".", "pong_received", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Func(): Pong received in time.\"", ")", "arg_0", ".", "pong_received", "=", "False", "else", ":", "arg_0", ".", "log", ".", "debug", "(", "\"Func(): Pong not received in time.\"", "\"Issuing reconnect..\"", ")", "arg_0", ".", "reconnect", "(", ")"], "function": "def Func(arg_0):\n        \"\"\"Checks if a Pong message was received.\n\n        :return:\n        \"\"\"\n        arg_0.pong_timer.cancel()\n        if arg_0.pong_received:\n            arg_0.log.debug(\"Func(): Pong received in time.\")\n            arg_0.pong_received = False\n        else:\n            # reconnect\n            arg_0.log.debug(\"Func(): Pong not received in time.\"\n                           \"Issuing reconnect..\")\n            arg_0.reconnect()", "path": "btfxwss/connection.py", "identifier": "WebSocketConnection._check_pong", "docstring": "Checks if a Pong message was received.\n\n        :return:", "docstring_tokens": ["Checks", "if", "a", "Pong", "message", "was", "received", "."], "nwo": "Crypto-toolbox/btfxwss", "score": 0.6139886433376424, "idx": 261252}
{"url": "https://github.com/trp07/messages/blob/7789ebc960335a59ea5d319fceed3dd349023648/messages/api.py#L29-L62", "sha": "7789ebc960335a59ea5d319fceed3dd349023648", "docstring_summary": "Constructs a message class and sends the message.\n    Defaults to sending synchronously.  Set send_async=True to send\n    asynchronously.", "language": "python", "parameters": "(msg_type, send_async=False, *args, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "message_factory", "(", "arg_0", ",", "*", "arg_2", ",", "**", "arg_3", ")", "try", ":", "if", "arg_1", ":", "arg_4", ".", "Func_async", "(", ")", "else", ":", "arg_4", ".", "Func", "(", ")", "except", "MessageSendError", "as", "e", ":", "err_exit", "(", "\"Unable to Func message: \"", ",", "e", ")"], "function": "def Func(arg_0, arg_1=False, *arg_2, **arg_3):\n    \"\"\"\n    Constructs a message class and Funcs the message.\n    Defaults to Funcing synchronously.  Set Func_async=True to Func\n    asynchronously.\n\n    Args:\n        :msg_type: (str) the type of message to Func, i.e. 'Email'\n        :Func_async: (bool) default is False, set True to Func asynchronously.\n        :kwargs: (dict) keywords arguments that are required for the\n            various message types.  See docstrings for each type.\n            i.e. help(messages.Email), help(messages.Twilio), etc.\n\n    Example:\n        >>> kwargs = {\n                  from_: 'me@here.com',\n                  to: 'you@there.com',\n                  auth: 'yourPassword',\n                  subject: 'Email Subject',\n                  body: 'Your message to Func',\n                  attachments: ['filepath1', 'filepath2'],\n            }\n        >>> messages.Func('email', **kwargs)\n        Message sent...\n    \"\"\"\n    arg_4 = message_factory(arg_0, *arg_2, **arg_3)\n\n    try:\n        if arg_1:\n            arg_4.Func_async()\n        else:\n            arg_4.Func()\n    except MessageSendError as e:\n        err_exit(\"Unable to Func message: \", e)", "path": "messages/api.py", "identifier": "send", "docstring": "Constructs a message class and sends the message.\n    Defaults to sending synchronously.  Set send_async=True to send\n    asynchronously.\n\n    Args:\n        :msg_type: (str) the type of message to send, i.e. 'Email'\n        :send_async: (bool) default is False, set True to send asynchronously.\n        :kwargs: (dict) keywords arguments that are required for the\n            various message types.  See docstrings for each type.\n            i.e. help(messages.Email), help(messages.Twilio), etc.\n\n    Example:\n        >>> kwargs = {\n                  from_: 'me@here.com',\n                  to: 'you@there.com',\n                  auth: 'yourPassword',\n                  subject: 'Email Subject',\n                  body: 'Your message to send',\n                  attachments: ['filepath1', 'filepath2'],\n            }\n        >>> messages.send('email', **kwargs)\n        Message sent...", "docstring_tokens": ["Constructs", "a", "message", "class", "and", "sends", "the", "message", ".", "Defaults", "to", "sending", "synchronously", ".", "Set", "send_async", "=", "True", "to", "send", "asynchronously", "."], "nwo": "trp07/messages", "score": 0.19142540061431407, "idx": 261253}
{"url": "https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muccore.py#L440-L451", "sha": "14a40a3950910a9cd008b55f0d8905aa0186ce18", "docstring_summary": "Initialize a `MucStatus` element from a status code.", "language": "python", "parameters": "(self,code)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_1", "=", "int", "(", "arg_1", ")", "if", "arg_1", "<", "0", "or", "arg_1", ">", "999", ":", "raise", "ValueError", "(", "\"Bad status code\"", ")", "arg_0", ".", "code", "=", "arg_1"], "function": "def Func(arg_0,arg_1):\n        \"\"\"Initialize a `MucStatus` element from a status code.\n\n        :Parameters:\n            - `code`: the status code.\n        :Types:\n            - `code`: `int`\n        \"\"\"\n        arg_1=int(arg_1)\n        if arg_1<0 or arg_1>999:\n            raise ValueError(\"Bad status code\")\n        arg_0.code=arg_1", "path": "pyxmpp2/ext/muc/muccore.py", "identifier": "MucStatus.__init", "docstring": "Initialize a `MucStatus` element from a status code.\n\n        :Parameters:\n            - `code`: the status code.\n        :Types:\n            - `code`: `int`", "docstring_tokens": ["Initialize", "a", "MucStatus", "element", "from", "a", "status", "code", "."], "nwo": "Jajcus/pyxmpp2", "score": 0.4106374656686744, "idx": 261254}
{"url": "https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/core/time_frequency.py#L792-L827", "sha": "180e8e6eb8f958fa6b20b8cba389f7945d508247", "docstring_summary": "Compute the center frequencies of Constant-Q bins.", "language": "python", "parameters": "(n_bins, fmin, bins_per_octave=12, tuning=0.0)", "return_statement": "return correction * fmin * frequencies", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "12", ",", "arg_3", "=", "0.0", ")", ":", "arg_4", "=", "2.0", "**", "(", "float", "(", "arg_3", ")", "/", "arg_2", ")", "arg_5", "=", "2.0", "**", "(", "np", ".", "arange", "(", "0", ",", "arg_0", ",", "dtype", "=", "float", ")", "/", "arg_2", ")", "return", "arg_4", "*", "arg_1", "*", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2=12, arg_3=0.0):\n    \"\"\"Compute the center frequencies of Constant-Q bins.\n\n    Examples\n    --------\n    >>> # Get the CQT frequencies for 24 notes, starting at C2\n    >>> librosa.Func(24, fmin=librosa.note_to_hz('C2'))\n    array([  65.406,   69.296,   73.416,   77.782,   82.407,   87.307,\n             92.499,   97.999,  103.826,  110.   ,  116.541,  123.471,\n            130.813,  138.591,  146.832,  155.563,  164.814,  174.614,\n            184.997,  195.998,  207.652,  220.   ,  233.082,  246.942])\n\n    Parameters\n    ----------\n    n_bins  : int > 0 [scalar]\n        Number of constant-Q bins\n\n    fmin    : float > 0 [scalar]\n        Minimum frequency\n\n    bins_per_octave : int > 0 [scalar]\n        Number of bins per octave\n\n    tuning : float in `[-0.5, +0.5)`\n        Deviation from A440 tuning in fractional bins (cents)\n\n    Returns\n    -------\n    frequencies : np.ndarray [shape=(n_bins,)]\n        Center frequency for each CQT bin\n    \"\"\"\n\n    arg_4 = 2.0**(float(arg_3) / arg_2)\n    arg_5 = 2.0**(np.arange(0, arg_0, dtype=float) / arg_2)\n\n    return arg_4 * arg_1 * arg_5", "path": "librosa/core/time_frequency.py", "identifier": "cqt_frequencies", "docstring": "Compute the center frequencies of Constant-Q bins.\n\n    Examples\n    --------\n    >>> # Get the CQT frequencies for 24 notes, starting at C2\n    >>> librosa.cqt_frequencies(24, fmin=librosa.note_to_hz('C2'))\n    array([  65.406,   69.296,   73.416,   77.782,   82.407,   87.307,\n             92.499,   97.999,  103.826,  110.   ,  116.541,  123.471,\n            130.813,  138.591,  146.832,  155.563,  164.814,  174.614,\n            184.997,  195.998,  207.652,  220.   ,  233.082,  246.942])\n\n    Parameters\n    ----------\n    n_bins  : int > 0 [scalar]\n        Number of constant-Q bins\n\n    fmin    : float > 0 [scalar]\n        Minimum frequency\n\n    bins_per_octave : int > 0 [scalar]\n        Number of bins per octave\n\n    tuning : float in `[-0.5, +0.5)`\n        Deviation from A440 tuning in fractional bins (cents)\n\n    Returns\n    -------\n    frequencies : np.ndarray [shape=(n_bins,)]\n        Center frequency for each CQT bin", "docstring_tokens": ["Compute", "the", "center", "frequencies", "of", "Constant", "-", "Q", "bins", "."], "nwo": "librosa/librosa", "score": 0.98482969517341, "idx": 261255}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/utils/io.py#L34-L81", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Convert a ChaLearn Cause effect pairs challenge format into numpy.ndarray.", "language": "python", "parameters": "(filename, scale=True, **kwargs)", "return_statement": "return df", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "**", "arg_2", ")", ":", "def", "convert_row", "(", "arg_3", ",", "arg_1", ")", ":", "arg_4", "=", "arg_3", "[", "\"A\"", "]", ".", "split", "(", "\" \"", ")", "arg_5", "=", "arg_3", "[", "\"B\"", "]", ".", "split", "(", "\" \"", ")", "if", "arg_4", "[", "0", "]", "==", "\"\"", ":", "arg_4", ".", "pop", "(", "0", ")", "arg_5", ".", "pop", "(", "0", ")", "if", "arg_4", "[", "-", "1", "]", "==", "\"\"", ":", "arg_4", ".", "pop", "(", "-", "1", ")", "arg_5", ".", "pop", "(", "-", "1", ")", "arg_4", "=", "array", "(", "[", "float", "(", "i", ")", "for", "i", "in", "arg_4", "]", ")", "arg_5", "=", "array", "(", "[", "float", "(", "i", ")", "for", "i", "in", "arg_5", "]", ")", "if", "arg_1", ":", "arg_4", "=", "scaler", "(", "arg_4", ")", "arg_5", "=", "scaler", "(", "arg_5", ")", "return", "arg_3", "[", "'SampleID'", "]", ",", "arg_4", ",", "arg_5", "if", "isinstance", "(", "arg_0", ",", "str", ")", ":", "arg_6", "=", "read_csv", "(", "arg_0", ",", "**", "arg_2", ")", "elif", "isinstance", "(", "arg_0", ",", "DataFrame", ")", ":", "arg_6", "=", "arg_0", "else", ":", "raise", "TypeError", "(", "\"Type not supported.\"", ")", "arg_7", "=", "[", "]", "for", "arg_8", ",", "arg_3", "in", "arg_6", ".", "iterrows", "(", ")", ":", "arg_7", ".", "append", "(", "convert_row", "(", "arg_3", ",", "arg_1", ")", ")", "arg_9", "=", "DataFrame", "(", "arg_7", ",", "columns", "=", "[", "'SampleID'", ",", "'A'", ",", "'B'", "]", ")", "arg_9", "=", "arg_9", ".", "set_index", "(", "\"SampleID\"", ")", "return", "arg_9"], "function": "def Func(arg_0, arg_1=True, **arg_2):\n    \"\"\"Convert a ChaLearn Cause effect pairs challenge format into numpy.ndarray.\n\n    :param filename: path of the file to read or DataFrame containing the data\n    :type filename: str or pandas.DataFrame\n    :param scale: Scale the data\n    :type scale: bool\n    :param kwargs: parameters to be passed to pandas.read_csv\n    :return: Dataframe composed of (SampleID, a (numpy.ndarray) , b (numpy.ndarray))\n    :rtype: pandas.DataFrame\n    \"\"\"\n    def convert_row(arg_3, arg_1):\n        \"\"\"Convert a CCEPC row into numpy.ndarrays.\n\n        :param row:\n        :type row: pandas.Series\n        :return: tuple of sample ID and the converted data into numpy.ndarrays\n        :rtype: tuple\n        \"\"\"\n        arg_4 = arg_3[\"A\"].split(\" \")\n        arg_5 = arg_3[\"B\"].split(\" \")\n\n        if arg_4[0] == \"\":\n            arg_4.pop(0)\n            arg_5.pop(0)\n        if arg_4[-1] == \"\":\n            arg_4.pop(-1)\n            arg_5.pop(-1)\n\n        arg_4 = array([float(i) for i in arg_4])\n        arg_5 = array([float(i) for i in arg_5])\n        if arg_1:\n            arg_4 = scaler(arg_4)\n            arg_5 = scaler(arg_5)\n        return arg_3['SampleID'], arg_4, arg_5\n    if isinstance(arg_0, str):\n        arg_6 = read_csv(arg_0, **arg_2)\n    elif isinstance(arg_0, DataFrame):\n        arg_6 = arg_0\n    else:\n        raise TypeError(\"Type not supported.\")\n    arg_7 = []\n\n    for arg_8, arg_3 in arg_6.iterrows():\n        arg_7.append(convert_row(arg_3, arg_1))\n    arg_9 = DataFrame(arg_7, columns=['SampleID', 'A', 'B'])\n    arg_9 = arg_9.set_index(\"SampleID\")\n    return arg_9", "path": "cdt/utils/io.py", "identifier": "read_causal_pairs", "docstring": "Convert a ChaLearn Cause effect pairs challenge format into numpy.ndarray.\n\n    :param filename: path of the file to read or DataFrame containing the data\n    :type filename: str or pandas.DataFrame\n    :param scale: Scale the data\n    :type scale: bool\n    :param kwargs: parameters to be passed to pandas.read_csv\n    :return: Dataframe composed of (SampleID, a (numpy.ndarray) , b (numpy.ndarray))\n    :rtype: pandas.DataFrame", "docstring_tokens": ["Convert", "a", "ChaLearn", "Cause", "effect", "pairs", "challenge", "format", "into", "numpy", ".", "ndarray", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 261256}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L976-L996", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Takes the given `mask` and `stft`, which must be matrices of shape `frequencies, times`\n    and downsamples one of them into the other one's times, so that the time dimensions\n    are equal. Leaves the frequency dimension untouched.", "language": "python", "parameters": "(mask, mask_indexes, stft, stft_indexes)", "return_statement": "return mask, mask_indexes, stft, stft_indexes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "assert", "len", "(", "arg_0", ".", "shape", ")", "==", "2", ",", "\"Expected a two-dimensional `mask`, but got one of {} dimensions.\"", ".", "format", "(", "len", "(", "arg_0", ".", "shape", ")", ")", "assert", "len", "(", "arg_2", ".", "shape", ")", "==", "2", ",", "\"Expected a two-dimensional `stft`, but got one of {} dimensions.\"", ".", "format", "(", "len", "(", "arg_2", ".", "shape", ")", ")", "if", "arg_0", ".", "shape", "[", "1", "]", ">", "arg_2", ".", "shape", "[", "1", "]", ":", "arg_4", "=", "arg_0", ".", "shape", "[", "1", "]", "/", "arg_2", ".", "shape", "[", "1", "]", "arg_5", "=", "_get_downsampled_indexes", "(", "arg_0", ",", "arg_4", ")", "arg_0", "=", "arg_0", "[", ":", ",", "arg_5", "]", "arg_1", "=", "np", ".", "array", "(", "arg_5", ")", "elif", "arg_0", ".", "shape", "[", "1", "]", "<", "arg_2", ".", "shape", "[", "1", "]", ":", "arg_4", "=", "arg_2", ".", "shape", "[", "1", "]", "/", "arg_0", ".", "shape", "[", "1", "]", "arg_5", "=", "_get_downsampled_indexes", "(", "arg_2", ",", "arg_4", ")", "arg_2", "=", "arg_2", "[", ":", ",", "arg_5", "]", "arg_3", "=", "np", ".", "array", "(", "arg_5", ")", "return", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n    \"\"\"\n    Takes the given `mask` and `stft`, which must be matrices of shape `frequencies, times`\n    and downsamples one of them into the other one's times, so that the time dimensions\n    are equal. Leaves the frequency dimension untouched.\n    \"\"\"\n    assert len(arg_0.shape) == 2, \"Expected a two-dimensional `mask`, but got one of {} dimensions.\".format(len(arg_0.shape))\n    assert len(arg_2.shape) == 2, \"Expected a two-dimensional `stft`, but got one of {} dimensions.\".format(len(arg_2.shape))\n\n    if arg_0.shape[1] > arg_2.shape[1]:\n        arg_4 = arg_0.shape[1] / arg_2.shape[1]\n        arg_5 = _get_downsampled_indexes(arg_0, arg_4)\n        arg_0 = arg_0[:, arg_5]\n        arg_1 = np.array(arg_5)\n    elif arg_0.shape[1] < arg_2.shape[1]:\n        arg_4 = arg_2.shape[1] / arg_0.shape[1]\n        arg_5 = _get_downsampled_indexes(arg_2, arg_4)\n        arg_2 = arg_2[:, arg_5]\n        arg_3 = np.array(arg_5)\n\n    return arg_0, arg_1, arg_2, arg_3", "path": "algorithms/asa.py", "identifier": "_downsample_one_or_the_other", "docstring": "Takes the given `mask` and `stft`, which must be matrices of shape `frequencies, times`\n    and downsamples one of them into the other one's times, so that the time dimensions\n    are equal. Leaves the frequency dimension untouched.", "docstring_tokens": ["Takes", "the", "given", "mask", "and", "stft", "which", "must", "be", "matrices", "of", "shape", "frequencies", "times", "and", "downsamples", "one", "of", "them", "into", "the", "other", "one", "s", "times", "so", "that", "the", "time", "dimensions", "are", "equal", ".", "Leaves", "the", "frequency", "dimension", "untouched", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 261257}
{"url": "https://github.com/ndrlslz/ternya/blob/c05aec10029e645d63ff04313dbcf2644743481f/ternya/ternya.py#L80-L88", "sha": "c05aec10029e645d63ff04313dbcf2644743481f", "docstring_summary": "Import customer's service modules.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "config", ":", "raise", "ValueError", "(", "\"please read your config file.\"", ")", "log", ".", "debug", "(", "\"begin to import customer's service modules.\"", ")", "arg_1", "=", "ServiceModules", "(", "arg_0", ".", "config", ")", "arg_1", ".", "import_modules", "(", ")", "log", ".", "debug", "(", "\"end to import customer's service modules.\"", ")"], "function": "def Func(arg_0):\n        \"\"\"Import customer's service modules.\"\"\"\n        if not arg_0.config:\n            raise ValueError(\"please read your config file.\")\n\n        log.debug(\"begin to import customer's service modules.\")\n        arg_1 = ServiceModules(arg_0.config)\n        arg_1.import_modules()\n        log.debug(\"end to import customer's service modules.\")", "path": "ternya/ternya.py", "identifier": "Ternya.init_modules", "docstring": "Import customer's service modules.", "docstring_tokens": ["Import", "customer", "s", "service", "modules", "."], "nwo": "ndrlslz/ternya", "score": 0.09252797783733271, "idx": 261258}
{"url": "https://github.com/xmartlabs/benderthon/blob/810b6fb90f56136257e7ed12e5a30d17ad7ce6ba/benderthon/tf_freeze.py#L85-L92", "sha": "810b6fb90f56136257e7ed12e5a30d17ad7ce6ba", "docstring_summary": "Save the weights of the trainable variables given a checkpoint, each one in a different file in output_path.", "language": "python", "parameters": "(input_checkpoint, output_path, conv_var_names=None, conv_transpose_var_names=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "check_input_checkpoint", "(", "arg_0", ")", "with", "tf", ".", "Session", "(", ")", "as", "sess", ":", "restore_from_checkpoint", "(", "sess", ",", "arg_0", ")", "save_weights", "(", "sess", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n    \"\"\"Save the weights of the trainable variables given a checkpoint, each one in a different file in output_path.\"\"\"\n    check_input_checkpoint(arg_0)\n\n    with tf.Session() as sess:\n        restore_from_checkpoint(sess, arg_0)\n        save_weights(sess, arg_1, arg_2=arg_2,\n                     arg_3=arg_3)", "path": "benderthon/tf_freeze.py", "identifier": "save_weights_from_checkpoint", "docstring": "Save the weights of the trainable variables given a checkpoint, each one in a different file in output_path.", "docstring_tokens": ["Save", "the", "weights", "of", "the", "trainable", "variables", "given", "a", "checkpoint", "each", "one", "in", "a", "different", "file", "in", "output_path", "."], "nwo": "xmartlabs/benderthon", "score": 0.2751458370028208, "idx": 261259}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L315-L359", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Start running.", "language": "python", "parameters": "(self, data_loaders, workflow, max_epochs, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", ":", "assert", "isinstance", "(", "arg_1", ",", "list", ")", "assert", "mmcv", ".", "is_list_of", "(", "arg_2", ",", "tuple", ")", "assert", "len", "(", "arg_1", ")", "==", "len", "(", "arg_2", ")", "arg_0", ".", "_max_epochs", "=", "arg_3", "arg_6", "=", "arg_0", ".", "work_dir", "if", "arg_0", ".", "work_dir", "is", "not", "None", "else", "'NONE'", "arg_0", ".", "logger", ".", "info", "(", "'Start Funcning, host: %s, work_dir: %s'", ",", "get_host_info", "(", ")", ",", "arg_6", ")", "arg_0", ".", "logger", ".", "info", "(", "'workflow: %s, max: %d epochs'", ",", "arg_2", ",", "arg_3", ")", "arg_0", ".", "call_hook", "(", "'before_Func'", ")", "while", "arg_0", ".", "epoch", "<", "arg_3", ":", "for", "arg_7", ",", "arg_8", "in", "enumerate", "(", "arg_2", ")", ":", "arg_9", ",", "arg_10", "=", "arg_8", "if", "isinstance", "(", "arg_9", ",", "str", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "arg_9", ")", ":", "raise", "ValueError", "(", "'Funcner has no method named \"{}\" to Func an epoch'", ".", "format", "(", "arg_9", ")", ")", "arg_11", "=", "getattr", "(", "arg_0", ",", "arg_9", ")", "elif", "callable", "(", "arg_9", ")", ":", "arg_11", "=", "arg_9", "else", ":", "raise", "TypeError", "(", "'mode in workflow must be a str or '", "'callable function, not {}'", ".", "format", "(", "type", "(", "arg_9", ")", ")", ")", "for", "arg_12", "in", "range", "(", "arg_10", ")", ":", "if", "arg_9", "==", "'train'", "and", "arg_0", ".", "epoch", ">=", "arg_3", ":", "return", "arg_11", "(", "arg_1", "[", "arg_7", "]", ",", "**", "arg_4", ")", "time", ".", "sleep", "(", "1", ")", "arg_0", ".", "call_hook", "(", "'after_Func'", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):\n        \"\"\"Start Funcning.\n\n        Args:\n            data_loaders (list[:obj:`DataLoader`]): Dataloaders for training\n                and validation.\n            workflow (list[tuple]): A list of (phase, epochs) to specify the\n                Funcning order and epochs. E.g, [('train', 2), ('val', 1)] means\n                Funcning 2 epochs for training and 1 epoch for validation,\n                iteratively.\n            max_epochs (int): Total training epochs.\n        \"\"\"\n        assert isinstance(arg_1, list)\n        assert mmcv.is_list_of(arg_2, tuple)\n        assert len(arg_1) == len(arg_2)\n\n        arg_0._max_epochs = arg_3\n        arg_6 = arg_0.work_dir if arg_0.work_dir is not None else 'NONE'\n        arg_0.logger.info('Start Funcning, host: %s, work_dir: %s',\n                         get_host_info(), arg_6)\n        arg_0.logger.info('workflow: %s, max: %d epochs', arg_2, arg_3)\n        arg_0.call_hook('before_Func')\n\n        while arg_0.epoch < arg_3:\n            for arg_7, arg_8 in enumerate(arg_2):\n                arg_9, arg_10 = arg_8\n                if isinstance(arg_9, str):  # self.train()\n                    if not hasattr(arg_0, arg_9):\n                        raise ValueError(\n                            'Funcner has no method named \"{}\" to Func an epoch'.\n                            format(arg_9))\n                    arg_11 = getattr(arg_0, arg_9)\n                elif callable(arg_9):  # custom train()\n                    arg_11 = arg_9\n                else:\n                    raise TypeError('mode in workflow must be a str or '\n                                    'callable function, not {}'.format(\n                                        type(arg_9)))\n                for arg_12 in range(arg_10):\n                    if arg_9 == 'train' and arg_0.epoch >= arg_3:\n                        return\n                    arg_11(arg_1[arg_7], **arg_4)\n\n        time.sleep(1)  # wait for some hooks like loggers to finish\n        arg_0.call_hook('after_Func')", "path": "mmcv/runner/runner.py", "identifier": "Runner.run", "docstring": "Start running.\n\n        Args:\n            data_loaders (list[:obj:`DataLoader`]): Dataloaders for training\n                and validation.\n            workflow (list[tuple]): A list of (phase, epochs) to specify the\n                running order and epochs. E.g, [('train', 2), ('val', 1)] means\n                running 2 epochs for training and 1 epoch for validation,\n                iteratively.\n            max_epochs (int): Total training epochs.", "docstring_tokens": ["Start", "running", "."], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 261260}
{"url": "https://github.com/albertyw/pyziptax/blob/c56dd440e4cadff7f2dd4b72e5dcced06a44969d/pyziptax/ziptax.py#L69-L81", "sha": "c56dd440e4cadff7f2dd4b72e5dcced06a44969d", "docstring_summary": "Check if there are exceptions that should be raised", "language": "python", "parameters": "(self, resp, multiple_rates)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_1", "[", "'rCode'", "]", "!=", "100", ":", "raise", "exceptions", ".", "get_exception_for_code", "(", "arg_1", "[", "'rCode'", "]", ")", "(", "arg_1", ")", "arg_3", "=", "arg_1", "[", "'results'", "]", "if", "len", "(", "arg_3", ")", "==", "0", ":", "raise", "exceptions", ".", "ZipTaxNoResults", "(", "'No results found'", ")", "if", "len", "(", "arg_3", ")", ">", "1", "and", "not", "arg_2", ":", "arg_4", "=", "[", "result", "[", "'taxSales'", "]", "for", "result", "in", "arg_3", "]", "if", "len", "(", "set", "(", "arg_4", ")", ")", "!=", "1", ":", "raise", "exceptions", ".", "ZipTaxMultipleResults", "(", "'Multiple results found but requested only one'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\" Check if there are exceptions that should be raised \"\"\"\n        if arg_1['rCode'] != 100:\n            raise exceptions.get_exception_for_code(arg_1['rCode'])(arg_1)\n\n        arg_3 = arg_1['results']\n        if len(arg_3) == 0:\n            raise exceptions.ZipTaxNoResults('No results found')\n        if len(arg_3) > 1 and not arg_2:\n            # It's fine if all the taxes are the same\n            arg_4 = [result['taxSales'] for result in arg_3]\n            if len(set(arg_4)) != 1:\n                raise exceptions.ZipTaxMultipleResults('Multiple results found but requested only one')", "path": "pyziptax/ziptax.py", "identifier": "ZipTaxClient._check_for_exceptions", "docstring": "Check if there are exceptions that should be raised", "docstring_tokens": ["Check", "if", "there", "are", "exceptions", "that", "should", "be", "raised"], "nwo": "albertyw/pyziptax", "score": 0.23137166388621372, "idx": 261261}
{"url": "https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/execution.py#L346-L371", "sha": "4119f8c773089de64831b1dfb9e168e353d401dc", "docstring_summary": "Wraps the output of a user provided function that may yield or return a value and\n    returns a generator that asserts it only yields a single value.", "language": "python", "parameters": "(user_fn, error_cls, msg)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "check", ".", "callable_param", "(", "arg_0", ",", "'user_fn'", ")", "check", ".", "subclass_param", "(", "arg_1", ",", "'error_cls'", ",", "DagsterUserCodeExecutionError", ")", "with", "user_code_error_boundary", "(", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", "(", ")", "arg_4", "=", "_ensure_gen", "(", "arg_3", ")", "try", ":", "arg_5", "=", "next", "(", "arg_4", ")", "except", "StopIteration", ":", "check", ".", "failed", "(", "'Must yield one item. You did not yield anything.'", ")", "yield", "arg_5", "arg_6", "=", "False", "try", ":", "next", "(", "arg_4", ")", "except", "StopIteration", ":", "arg_6", "=", "True", "check", ".", "invariant", "(", "arg_6", ",", "'Must yield one item. Yielded more than one item'", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    '''Wraps the output of a user provided function that may yield or return a value and\n    returns a generator that asserts it only yields a single value.\n    '''\n    check.callable_param(arg_0, 'user_fn')\n    check.subclass_param(arg_1, 'error_cls', DagsterUserCodeExecutionError)\n\n    with user_code_error_boundary(arg_1, arg_2):\n        arg_3 = arg_0()\n        arg_4 = _ensure_gen(arg_3)\n\n        try:\n            arg_5 = next(arg_4)\n        except StopIteration:\n            check.failed('Must yield one item. You did not yield anything.')\n\n        yield arg_5\n\n        arg_6 = False\n\n        try:\n            next(arg_4)\n        except StopIteration:\n            arg_6 = True\n\n        check.invariant(arg_6, 'Must yield one item. Yielded more than one item')", "path": "python_modules/dagster/dagster/core/execution.py", "identifier": "user_code_context_manager", "docstring": "Wraps the output of a user provided function that may yield or return a value and\n    returns a generator that asserts it only yields a single value.", "docstring_tokens": ["Wraps", "the", "output", "of", "a", "user", "provided", "function", "that", "may", "yield", "or", "return", "a", "value", "and", "returns", "a", "generator", "that", "asserts", "it", "only", "yields", "a", "single", "value", "."], "nwo": "dagster-io/dagster", "score": 0.9668997379845927, "idx": 261262}
{"url": "https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L509-L513", "sha": "8da6084fe61726f20e9cf675190480cfc45ee764", "docstring_summary": "Returns the medium size image URL.", "language": "python", "parameters": "(self)", "return_statement": "return '%s%s-%s.jpg' % (settings.MEDIA_URL, self.get_name(), 'medium')", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "is_gif", "(", ")", ":", "return", "arg_0", ".", "get_absolute_url", "(", ")", "return", "'%s%s-%s.jpg'", "%", "(", "settings", ".", "MEDIA_URL", ",", "arg_0", ".", "get_name", "(", ")", ",", "'medium'", ")"], "function": "def Func(arg_0):\n        \"\"\"Returns the medium size image URL.\"\"\"\n        if arg_0.is_gif():\n            return arg_0.get_absolute_url()\n        return '%s%s-%s.jpg' % (settings.MEDIA_URL, arg_0.get_name(), 'medium')", "path": "dispatch/modules/content/models.py", "identifier": "Image.get_medium_url", "docstring": "Returns the medium size image URL.", "docstring_tokens": ["Returns", "the", "medium", "size", "image", "URL", "."], "nwo": "ubyssey/dispatch", "score": 0.6771035331576564, "idx": 261263}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1801-L1833", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "write a map file with linkage information for SNPs file", "language": "python", "parameters": "(data)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "time", ".", "time", "(", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_0", ".", "dirs", ".", "outfiles", ",", "\"tmp-{}.h5\"", ".", "format", "(", "arg_0", ".", "name", ")", ")", "with", "h5py", ".", "File", "(", "arg_2", ",", "'r'", ")", "as", "io5", ":", "arg_3", "=", "io5", "[", "\"maparr\"", "]", "[", ":", "]", "arg_4", "=", "np", ".", "where", "(", "np", ".", "all", "(", "arg_3", "[", ":", "]", "==", "0", ",", "axis", "=", "1", ")", ")", "[", "0", "]", "if", "np", ".", "any", "(", "arg_4", ")", ":", "arg_4", "=", "arg_4", ".", "min", "(", ")", "else", ":", "arg_4", "=", "arg_3", ".", "shape", "[", "0", "]", "arg_5", "=", "[", "]", "with", "open", "(", "arg_0", ".", "outfiles", ".", "snpsmap", ",", "'w'", ")", "as", "out", ":", "for", "arg_6", "in", "xrange", "(", "arg_4", ")", ":", "arg_7", "=", "arg_3", "[", "arg_6", ",", ":", "]", "arg_5", ".", "append", "(", "\"{}\\trad{}_snp{}\\t{}\\t{}\\n\"", ".", "format", "(", "arg_7", "[", "0", "]", ",", "arg_7", "[", "1", "]", ",", "arg_7", "[", "2", "]", ",", "0", ",", "arg_7", "[", "3", "]", ")", ")", "if", "not", "arg_6", "%", "10000", ":", "out", ".", "write", "(", "\"\"", ".", "join", "(", "arg_5", ")", ")", "arg_5", "=", "[", "]", "out", ".", "write", "(", "\"\"", ".", "join", "(", "arg_5", ")", ")", "LOGGER", ".", "debug", "(", "\"finished writing snps_map in: %s\"", ",", "time", ".", "time", "(", ")", "-", "arg_1", ")"], "function": "def Func(arg_0):\n    \"\"\" write a map file with linkage information for SNPs file\"\"\"\n\n    ## grab map data from tmparr\n    arg_1 = time.time()\n    arg_2 = os.path.join(arg_0.dirs.outfiles, \"tmp-{}.h5\".format(arg_0.name)) \n    with h5py.File(arg_2, 'r') as io5:\n        arg_3 = io5[\"maparr\"][:]\n\n        ## get last data \n        arg_4 = np.where(np.all(arg_3[:] == 0, axis=1))[0]\n        if np.any(arg_4):\n            arg_4 = arg_4.min()\n        else:\n            arg_4 = arg_3.shape[0]\n\n        ## write to map file (this is too slow...)\n        arg_5 = []\n        with open(arg_0.outfiles.snpsmap, 'w') as out:\n            for arg_6 in xrange(arg_4):\n                ## build to list\n                arg_7 = arg_3[arg_6, :]\n                #print(line)\n                arg_5.append(\\\n                    \"{}\\trad{}_snp{}\\t{}\\t{}\\n\"\\\n                    .format(arg_7[0], arg_7[1], arg_7[2], 0, arg_7[3]))\n                ## clear list\n                if not arg_6 % 10000:\n                    out.write(\"\".join(arg_5))\n                    arg_5 = []\n            ## write remaining\n            out.write(\"\".join(arg_5))\n    LOGGER.debug(\"finished writing snps_map in: %s\", time.time() - arg_1)", "path": "ipyrad/assemble/write_outfiles.py", "identifier": "write_snps_map", "docstring": "write a map file with linkage information for SNPs file", "docstring_tokens": ["write", "a", "map", "file", "with", "linkage", "information", "for", "SNPs", "file"], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 261264}
{"url": "https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L357-L375", "sha": "d0221b57856fb1e131cafecf99d826f7b07a947c", "docstring_summary": "This function returns a list of Firewall objects.", "language": "python", "parameters": "(self)", "return_statement": "return firewalls", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "get_data", "(", "\"firewalls\"", ")", "arg_2", "=", "list", "(", ")", "for", "arg_3", "in", "arg_1", "[", "'firewalls'", "]", ":", "arg_4", "=", "Firewall", "(", "**", "arg_3", ")", "arg_4", ".", "token", "=", "arg_0", ".", "token", "arg_6", "=", "list", "(", ")", "for", "arg_7", "in", "arg_3", "[", "'inbound_rules'", "]", ":", "arg_6", ".", "append", "(", "InboundRule", "(", "**", "arg_7", ")", ")", "arg_4", ".", "inbound_rules", "=", "arg_6", "arg_9", "=", "list", "(", ")", "for", "arg_7", "in", "arg_3", "[", "'outbound_rules'", "]", ":", "arg_9", ".", "append", "(", "OutboundRule", "(", "**", "arg_7", ")", ")", "arg_4", ".", "outbound_rules", "=", "arg_9", "arg_2", ".", "append", "(", "arg_4", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n            This function returns a list of Firewall objects.\n        \"\"\"\n        arg_1 = arg_0.get_data(\"firewalls\")\n        arg_2 = list()\n        for arg_3 in arg_1['firewalls']:\n            arg_4 = Firewall(**arg_3)\n            arg_4.token = arg_0.token\n            arg_6 = list()\n            for arg_7 in arg_3['inbound_rules']:\n                arg_6.append(InboundRule(**arg_7))\n            arg_4.inbound_rules = arg_6\n            arg_9 = list()\n            for arg_7 in arg_3['outbound_rules']:\n                arg_9.append(OutboundRule(**arg_7))\n            arg_4.outbound_rules = arg_9\n            arg_2.append(arg_4)\n        return arg_2", "path": "digitalocean/Manager.py", "identifier": "Manager.get_all_firewalls", "docstring": "This function returns a list of Firewall objects.", "docstring_tokens": ["This", "function", "returns", "a", "list", "of", "Firewall", "objects", "."], "nwo": "koalalorenzo/python-digitalocean", "score": 0.7834693399936417, "idx": 261265}
{"url": "https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L54-L57", "sha": "6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851", "docstring_summary": "Make a guess about the cache file location an try loading it.", "language": "python", "parameters": "(cls, *args, **kwargs)", "return_statement": "return cls.from_file(file, *args, **kwargs)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "os", ".", "path", ".", "join", "(", "Cache", ".", "cache_dir", ",", "Cache", ".", "cache_name", ")", "return", "arg_0", ".", "from_file", "(", "arg_3", ",", "*", "arg_1", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        \"\"\"Make a guess about the cache file location an try loading it.\"\"\"\n        arg_3 = os.path.join(Cache.cache_dir, Cache.cache_name)\n        return arg_0.from_file(arg_3, *arg_1, **arg_2)", "path": "twtxt/cache.py", "identifier": "Cache.discover", "docstring": "Make a guess about the cache file location an try loading it.", "docstring_tokens": ["Make", "a", "guess", "about", "the", "cache", "file", "location", "an", "try", "loading", "it", "."], "nwo": "buckket/twtxt", "score": 0.5783854231140674, "idx": 261266}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_anomaly_classifier_region.py#L408-L470", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Construct a _HTMClassificationRecord based on the state of the model\n    passed in through the inputs.", "language": "python", "parameters": "(self, inputs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_1", "[", "\"spBottomUpOut\"", "]", "arg_3", "=", "arg_2", ".", "nonzero", "(", ")", "[", "0", "]", "arg_4", "=", "anomaly", ".", "computeRawAnomalyScore", "(", "arg_3", ",", "arg_0", ".", "_prevPredictedColumns", ")", "arg_5", "=", "len", "(", "arg_2", ")", "arg_6", "=", "arg_1", "[", "'tpTopDownOut'", "]", "arg_7", "=", "len", "(", "arg_1", "[", "'tpLrnActiveStateT'", "]", ")", "arg_8", "=", "arg_11", ".", "array", "(", "[", "]", ")", "if", "arg_0", ".", "classificationVectorType", "==", "1", ":", "arg_8", "=", "arg_11", ".", "zeros", "(", "arg_7", ")", "arg_9", "=", "arg_1", "[", "\"tpLrnActiveStateT\"", "]", ".", "reshape", "(", "arg_7", ",", "1", ")", "arg_10", "=", "arg_11", ".", "where", "(", "arg_9", ">", "0", ")", "[", "0", "]", "if", "arg_10", ".", "shape", "[", "0", "]", ">", "0", ":", "arg_8", "[", "arg_11", ".", "array", "(", "arg_10", ",", "arg_13", "=", "arg_11", ".", "uint16", ")", "]", "=", "1", "elif", "arg_0", ".", "classificationVectorType", "==", "2", ":", "arg_8", "=", "arg_11", ".", "zeros", "(", "arg_5", "+", "arg_5", ")", "if", "arg_3", ".", "shape", "[", "0", "]", ">", "0", ":", "arg_8", "[", "arg_3", "]", "=", "1.0", "arg_15", "=", "arg_11", ".", "setdiff1d", "(", "arg_0", ".", "_prevPredictedColumns", ",", "arg_3", ")", "if", "arg_15", ".", "shape", "[", "0", "]", ">", "0", ":", "arg_16", "=", "(", "arg_11", ".", "array", "(", "arg_15", ",", "arg_13", "=", "arg_11", ".", "uint16", ")", "+", "arg_5", ")", "arg_8", "[", "arg_16", "]", "=", "1.0", "else", ":", "raise", "TypeError", "(", "\"Classification vector type must be either 'tpc' or\"", "\" 'sp_tpe', current value is %s\"", "%", "(", "arg_0", ".", "classificationVectorType", ")", ")", "arg_17", "=", "len", "(", "arg_0", ".", "_prevPredictedColumns", ")", "arg_18", "=", "arg_6", ".", "nonzero", "(", ")", "[", "0", "]", "arg_0", ".", "_prevPredictedColumns", "=", "copy", ".", "deepcopy", "(", "arg_18", ")", "if", "arg_0", ".", "_anomalyVectorLength", "is", "None", ":", "arg_0", ".", "_anomalyVectorLength", "=", "len", "(", "arg_8", ")", "arg_21", "=", "_CLAClassificationRecord", "(", "ROWID", "=", "arg_0", ".", "_iteration", ",", "anomalyScore", "=", "arg_4", ",", "anomalyVector", "=", "arg_8", ".", "nonzero", "(", ")", "[", "0", "]", ".", "tolist", "(", ")", ",", "anomalyLabel", "=", "[", "]", ")", "return", "arg_21"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Construct a _HTMClassificationRecord based on the state of the model\n    passed in through the inputs.\n\n    Types for self.classificationVectorType:\n      1 - TM active cells in learn state\n      2 - SP columns concatenated with error from TM column predictions and SP\n    \"\"\"\n    # Count the number of unpredicted columns\n    arg_2 = arg_1[\"spBottomUpOut\"]\n    arg_3 = arg_2.nonzero()[0]\n\n    arg_4 = anomaly.computeRawAnomalyScore(arg_3,\n                                           arg_0._prevPredictedColumns)\n\n    arg_5 = len(arg_2)\n\n\n    arg_6 = arg_1['tpTopDownOut']\n    arg_7 = len(arg_1['tpLrnActiveStateT'])\n\n    arg_8 = arg_11.array([])\n\n    if arg_0.classificationVectorType == 1:\n      # Classification Vector: [---TM Cells---]\n      arg_8 = arg_11.zeros(arg_7)\n      arg_9 = arg_1[\"tpLrnActiveStateT\"].reshape(arg_7, 1)\n      arg_10 = arg_11.where(arg_9 > 0)[0]\n      if arg_10.shape[0] > 0:\n        arg_8[arg_11.array(arg_10, arg_13=arg_11.uint16)] = 1\n    elif arg_0.classificationVectorType == 2:\n      # Classification Vecotr: [---SP---|---(TM-SP)----]\n      arg_8 = arg_11.zeros(arg_5+arg_5)\n      if arg_3.shape[0] > 0:\n        arg_8[arg_3] = 1.0\n\n      arg_15 = arg_11.setdiff1d(arg_0._prevPredictedColumns,\n          arg_3)\n      if arg_15.shape[0] > 0:\n        arg_16 = ( arg_11.array(arg_15, arg_13=arg_11.uint16) +\n          arg_5 )\n        arg_8[arg_16] = 1.0\n    else:\n      raise TypeError(\"Classification vector type must be either 'tpc' or\"\n        \" 'sp_tpe', current value is %s\" % (arg_0.classificationVectorType))\n\n    # Store the state for next time step\n    arg_17 = len(arg_0._prevPredictedColumns)\n    arg_18 = arg_6.nonzero()[0]\n    arg_0._prevPredictedColumns = copy.deepcopy(arg_18)\n\n    if arg_0._anomalyVectorLength is None:\n      arg_0._anomalyVectorLength = len(arg_8)\n\n    arg_21 = _CLAClassificationRecord(\n      ROWID=arg_0._iteration, #__numRunCalls called\n        #at beginning of model.run\n      anomalyScore=arg_4,\n      anomalyVector=arg_8.nonzero()[0].tolist(),\n      anomalyLabel=[]\n    )\n    return arg_21", "path": "src/nupic/regions/knn_anomaly_classifier_region.py", "identifier": "KNNAnomalyClassifierRegion._constructClassificationRecord", "docstring": "Construct a _HTMClassificationRecord based on the state of the model\n    passed in through the inputs.\n\n    Types for self.classificationVectorType:\n      1 - TM active cells in learn state\n      2 - SP columns concatenated with error from TM column predictions and SP", "docstring_tokens": ["Construct", "a", "_HTMClassificationRecord", "based", "on", "the", "state", "of", "the", "model", "passed", "in", "through", "the", "inputs", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261267}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gerrit.py#L165-L178", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Parse a Gerrit reviews list.", "language": "python", "parameters": "(raw_data)", "return_statement": "return reviews", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"[\"", "+", "arg_0", ".", "replace", "(", "\"\\n\"", ",", "\",\"", ")", "+", "\"]\"", "arg_1", "=", "arg_1", ".", "replace", "(", "\",]\"", ",", "\"]\"", ")", "arg_2", "=", "json", ".", "loads", "(", "arg_1", ")", "arg_3", "=", "[", "]", "for", "arg_4", "in", "arg_2", ":", "if", "'project'", "in", "arg_4", ".", "keys", "(", ")", ":", "arg_3", ".", "append", "(", "arg_4", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Parse a Gerrit reviews list.\"\"\"\n\n        # Join isolated reviews in JSON in array for parsing\n        arg_1 = \"[\" + arg_0.replace(\"\\n\", \",\") + \"]\"\n        arg_1 = arg_1.replace(\",]\", \"]\")\n        arg_2 = json.loads(arg_1)\n        arg_3 = []\n\n        for arg_4 in arg_2:\n            if 'project' in arg_4.keys():\n                arg_3.append(arg_4)\n\n        return arg_3", "path": "perceval/backends/core/gerrit.py", "identifier": "Gerrit.parse_reviews", "docstring": "Parse a Gerrit reviews list.", "docstring_tokens": ["Parse", "a", "Gerrit", "reviews", "list", "."], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 261268}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completer.py#L667-L685", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Return the list of default arguments of obj if it is callable,\n        or empty list otherwise.", "language": "python", "parameters": "(self, obj)", "return_statement": "return []", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "(", "inspect", ".", "isfunction", "(", "arg_1", ")", "or", "inspect", ".", "ismethod", "(", "arg_1", ")", ")", ":", "if", "inspect", ".", "isclass", "(", "arg_1", ")", ":", "arg_1", "=", "(", "getattr", "(", "arg_1", ",", "'__init__'", ",", "None", ")", "or", "getattr", "(", "arg_1", ",", "'__new__'", ",", "None", ")", ")", "elif", "hasattr", "(", "arg_1", ",", "'__call__'", ")", ":", "arg_1", "=", "arg_1", ".", "__call__", "try", ":", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "inspect", ".", "getargspec", "(", "arg_1", ")", "if", "arg_5", ":", "return", "arg_2", "[", "-", "len", "(", "arg_5", ")", ":", "]", "except", "TypeError", ":", "pass", "return", "[", "]"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return the list of default arguments of obj if it is callable,\n        or empty list otherwise.\"\"\"\n\n        if not (inspect.isfunction(arg_1) or inspect.ismethod(arg_1)):\n            # for classes, check for __init__,__new__\n            if inspect.isclass(arg_1):\n                arg_1 = (getattr(arg_1,'__init__',None) or\n                       getattr(arg_1,'__new__',None))\n            # for all others, check if they are __call__able\n            elif hasattr(arg_1, '__call__'):\n                arg_1 = arg_1.__call__\n            # XXX: is there a way to handle the builtins ?\n        try:\n            arg_2,arg_3,arg_4,arg_5 = inspect.getargspec(arg_1)\n            if arg_5:\n                return arg_2[-len(arg_5):]\n        except TypeError: pass\n        return []", "path": "environment/lib/python2.7/site-packages/IPython/core/completer.py", "identifier": "IPCompleter._default_arguments", "docstring": "Return the list of default arguments of obj if it is callable,\n        or empty list otherwise.", "docstring_tokens": ["Return", "the", "list", "of", "default", "arguments", "of", "obj", "if", "it", "is", "callable", "or", "empty", "list", "otherwise", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261269}
{"url": "https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/oauth2.py#L324-L330", "sha": "9e6f152a5bb360e7496210da21561c3e6d41b0e1", "docstring_summary": "Get the Grant object with the given client ID and code", "language": "python", "parameters": "(self, client_id, code)", "return_statement": "return self.query.filter_by(client_id=client_id, code=code).first()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "return", "arg_0", ".", "query", ".", "filter_by", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ")", ".", "first", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Get the Grant object with the given client ID and code\n\n        :param client_id: ID of the client\n        :param code:\n        \"\"\"\n        return arg_0.query.filter_by(arg_1=arg_1, arg_2=arg_2).first()", "path": "flask_oauthlib/contrib/oauth2.py", "identifier": "GrantBinding.get", "docstring": "Get the Grant object with the given client ID and code\n\n        :param client_id: ID of the client\n        :param code:", "docstring_tokens": ["Get", "the", "Grant", "object", "with", "the", "given", "client", "ID", "and", "code"], "nwo": "lepture/flask-oauthlib", "score": 0.7824232869066697, "idx": 261270}
{"url": "https://github.com/HydraChain/hydrachain/blob/6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3/hydrachain/consensus/simulation.py#L104-L109", "sha": "6c0919b0575dc8aa481f3a8c703e1a7f0575ecc3", "docstring_summary": "deliver on edge of timeout_window", "language": "python", "parameters": "(self, sender, receiver, packet)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "arg_4", "=", "ConsensusManager", ".", "round_timeout", "assert", "arg_4", ">", "0", "print", "\"in slow transport Func\"", "super", "(", "SlowTransport", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", ",", "arg_3", ",", "add_delay", "=", "arg_4", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"Func on edge of timeout_window\"\n        arg_4 = ConsensusManager.round_timeout\n        assert arg_4 > 0\n        print \"in slow transport Func\"\n        super(SlowTransport, arg_0).Func(arg_1, arg_2, arg_3, add_delay=arg_4)", "path": "hydrachain/consensus/simulation.py", "identifier": "SlowTransport.deliver", "docstring": "deliver on edge of timeout_window", "docstring_tokens": ["deliver", "on", "edge", "of", "timeout_window"], "nwo": "HydraChain/hydrachain", "score": 0.19890262478871212, "idx": 261271}
{"url": "https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/GNN.py#L105-L125", "sha": "be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1", "docstring_summary": "Run an instance of GNN, testing causal direction.", "language": "python", "parameters": "(x, idx=0, device=None, nh=20, **kwargs)", "return_statement": "return [XY, YX]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "None", ",", "arg_3", "=", "20", ",", "**", "arg_4", ")", ":", "arg_2", "=", "SETTINGS", ".", "get_default", "(", "arg_2", "=", "arg_2", ")", "arg_5", "=", "scale", "(", "arg_0", ")", ".", "astype", "(", "'float32'", ")", "arg_6", "=", "th", ".", "FloatTensor", "(", "arg_5", "[", ":", ",", "[", "0", "]", "]", ")", ".", "to", "(", "arg_2", ")", "arg_7", "=", "th", ".", "FloatTensor", "(", "arg_5", "[", ":", ",", "[", "1", "]", "]", ")", ".", "to", "(", "arg_2", ")", "arg_8", "=", "GNN_model", "(", "arg_0", ".", "shape", "[", "0", "]", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ".", "to", "(", "arg_2", ")", "arg_9", "=", "GNN_model", "(", "arg_0", ".", "shape", "[", "0", "]", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ")", ".", "to", "(", "arg_2", ")", "arg_8", ".", "reset_parameters", "(", ")", "arg_9", ".", "reset_parameters", "(", ")", "arg_10", "=", "arg_8", ".", "run", "(", "arg_6", ",", "arg_7", ",", "**", "arg_4", ")", "arg_11", "=", "arg_9", ".", "run", "(", "arg_7", ",", "arg_6", ",", "**", "arg_4", ")", "return", "[", "arg_10", ",", "arg_11", "]"], "function": "def Func(arg_0, arg_1=0, arg_2=None, arg_3=20, **arg_4):\n    \"\"\"Run an instance of GNN, testing causal direction.\n\n    :param m: data corresponding to the config : (N, 2) data, [:, 0] cause and [:, 1] effect\n    :param pair_idx: print purposes\n    :param run: numner of the run (for GPU dispatch)\n    :param device: device on with the algorithm is going to be run on.\n    :return:\n    \"\"\"\n    arg_2 = SETTINGS.get_default(arg_2=arg_2)\n    arg_5 = scale(arg_0).astype('float32')\n    arg_6 = th.FloatTensor(arg_5[:, [0]]).to(arg_2)\n    arg_7 = th.FloatTensor(arg_5[:, [1]]).to(arg_2)\n    arg_8 = GNN_model(arg_0.shape[0], arg_2=arg_2, arg_3=arg_3).to(arg_2)\n    arg_9 = GNN_model(arg_0.shape[0], arg_2=arg_2, arg_3=arg_3).to(arg_2)\n    arg_8.reset_parameters()\n    arg_9.reset_parameters()\n    arg_10 = arg_8.run(arg_6, arg_7, **arg_4)\n    arg_11 = arg_9.run(arg_7, arg_6, **arg_4)\n\n    return [arg_10, arg_11]", "path": "cdt/causality/pairwise/GNN.py", "identifier": "GNN_instance", "docstring": "Run an instance of GNN, testing causal direction.\n\n    :param m: data corresponding to the config : (N, 2) data, [:, 0] cause and [:, 1] effect\n    :param pair_idx: print purposes\n    :param run: numner of the run (for GPU dispatch)\n    :param device: device on with the algorithm is going to be run on.\n    :return:", "docstring_tokens": ["Run", "an", "instance", "of", "GNN", "testing", "causal", "direction", "."], "nwo": "Diviyan-Kalainathan/CausalDiscoveryToolbox", "score": 0.9388847825715934, "idx": 261272}
{"url": "https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mediawiki.py#L202-L243", "sha": "41c908605e88b7ebc3a536c643fa0f212eaf9e0e", "docstring_summary": "Fetch the pages from the backend url for MediaWiki >=1.27", "language": "python", "parameters": "(self, from_date=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "logger", ".", "info", "(", "\"Looking for pages at url '%s'\"", ",", "arg_0", ".", "url", ")", "arg_2", "=", "0", "arg_3", "=", "0", "arg_4", "=", "[", "]", "arg_5", "=", "arg_0", ".", "__get_namespaces_contents", "(", ")", "arg_6", "=", "''", "while", "arg_6", "is", "not", "None", ":", "arg_7", "=", "arg_0", ".", "client", ".", "get_pages_from_allrevisions", "(", "arg_5", ",", "arg_1", ",", "arg_6", ")", "arg_8", "=", "json", ".", "loads", "(", "arg_7", ")", "arg_6", "=", "arg_8", "[", "'continue'", "]", "[", "'arvcontinue'", "]", "if", "'continue'", "in", "arg_8", "else", "None", "arg_9", "=", "arg_8", "[", "'query'", "]", "[", "'allrevisions'", "]", "for", "arg_10", "in", "arg_9", ":", "if", "arg_10", "[", "'pageid'", "]", "in", "arg_4", ":", "logger", ".", "debug", "(", "\"Page %s already processed; skipped\"", ",", "arg_10", "[", "'pageid'", "]", ")", "continue", "arg_3", "+=", "1", "arg_4", ".", "append", "(", "arg_10", "[", "'pageid'", "]", ")", "arg_11", "=", "arg_0", ".", "__get_page_reviews", "(", "arg_10", ")", "if", "not", "arg_11", ":", "logger", ".", "warning", "(", "\"Revisions not found in %s [page id: %s], page skipped\"", ",", "arg_10", "[", "'title'", "]", ",", "arg_10", "[", "'pageid'", "]", ")", "continue", "yield", "arg_11", "arg_2", "+=", "1", "logger", ".", "info", "(", "\"Total number of pages: %i, skipped %i\"", ",", "arg_3", ",", "arg_3", "-", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Fetch the pages from the backend url for MediaWiki >=1.27\n\n        The method retrieves, from a MediaWiki url, the\n        wiki pages.\n\n        :returns: a generator of pages\n        \"\"\"\n\n        logger.info(\"Looking for pages at url '%s'\", arg_0.url)\n\n        arg_2 = 0  # number of pages processed\n        arg_3 = 0  # number of total pages\n        arg_4 = []  # pages already retrieved in reviews API\n\n        arg_5 = arg_0.__get_namespaces_contents()\n\n        arg_6 = ''  # pagination for getting revisions and their pages\n        while arg_6 is not None:\n            arg_7 = arg_0.client.get_pages_from_allrevisions(arg_5, arg_1, arg_6)\n            arg_8 = json.loads(arg_7)\n            arg_6 = arg_8['continue']['arvcontinue'] if 'continue' in arg_8 else None\n            arg_9 = arg_8['query']['allrevisions']\n            for arg_10 in arg_9:\n\n                if arg_10['pageid'] in arg_4:\n                    logger.debug(\"Page %s already processed; skipped\", arg_10['pageid'])\n                    continue\n\n                arg_3 += 1\n                arg_4.append(arg_10['pageid'])\n                arg_11 = arg_0.__get_page_reviews(arg_10)\n\n                if not arg_11:\n                    logger.warning(\"Revisions not found in %s [page id: %s], page skipped\",\n                                   arg_10['title'], arg_10['pageid'])\n                    continue\n\n                yield arg_11\n                arg_2 += 1\n\n        logger.info(\"Total number of pages: %i, skipped %i\", arg_3, arg_3 - arg_2)", "path": "perceval/backends/core/mediawiki.py", "identifier": "MediaWiki.__fetch_1_27", "docstring": "Fetch the pages from the backend url for MediaWiki >=1.27\n\n        The method retrieves, from a MediaWiki url, the\n        wiki pages.\n\n        :returns: a generator of pages", "docstring_tokens": ["Fetch", "the", "pages", "from", "the", "backend", "url", "for", "MediaWiki", ">", "=", "1", ".", "27"], "nwo": "chaoss/grimoirelab-perceval", "score": 0.9310814614895903, "idx": 261273}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L3656-L3720", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Adds data to the summary tables and returns if `instance`s comment has to be stored.", "language": "python", "parameters": "(self, instance)", "return_statement": "return definitely_store_comment", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", ".", "v_comment", "==", "''", ":", "return", "False", "arg_2", "=", "arg_1", ".", "v_branch", "arg_3", "=", "True", "arg_4", "=", "arg_1", ".", "v_comment", ".", "encode", "(", "'utf-8'", ")", "arg_5", "=", "hashlib", ".", "sha1", "(", "arg_4", ")", ".", "hexdigest", "(", ")", "arg_5", "=", "arg_5", ".", "encode", "(", "'utf-8'", ")", "arg_6", "=", "arg_2", "+", "'_summary'", "if", "arg_6", "in", "arg_0", ".", "_overview_group", ":", "arg_7", "=", "getattr", "(", "arg_0", ".", "_overview_group", ",", "arg_6", ")", "else", ":", "return", "arg_3", "try", ":", "arg_8", "=", "{", "'hexdigestcol'", ":", "arg_7", ".", "cols", ".", "hexdigest", ",", "'hexdigest'", ":", "arg_5", "}", "arg_9", "=", "\"\"\"(hexdigestcol == hexdigest)\"\"\"", "arg_10", "=", "arg_7", ".", "where", "(", "arg_9", ",", "arg_8", "=", "arg_8", ")", "arg_11", "=", "None", "try", ":", "arg_11", "=", "next", "(", "arg_10", ")", "except", "StopIteration", ":", "pass", "if", "arg_11", "is", "None", ":", "arg_0", ".", "_all_store_param_or_result_table_entry", "(", "arg_1", ",", "arg_7", ",", "flags", "=", "(", "HDF5StorageService", ".", "ADD_ROW", ",", ")", ",", "additional_info", "=", "{", "'hexdigest'", ":", "arg_5", "}", ")", "arg_3", "=", "True", "else", ":", "arg_3", "=", "False", "arg_0", ".", "_all_kill_iterator", "(", "arg_10", ")", "except", "pt", ".", "NoSuchNodeError", ":", "arg_3", "=", "True", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Adds data to the summary tables and returns if `instance`s comment has to be stored.\n\n        Also moves comments upwards in the hierarchy if purge_duplicate_comments is true\n        and a lower index run has completed. Only necessary for *multiprocessing*.\n\n        :return: Tuple\n\n            * String specifying the subtree\n\n            * Boolean whether to store the comment to `instance`s hdf5 node\n\n        \"\"\"\n        if arg_1.v_comment == '':\n            return False\n\n        arg_2 = arg_1.v_branch\n        arg_3 = True\n\n        # Get the hexdigest of the comment to see if such a comment has been stored before\n        arg_4 = arg_1.v_comment.encode('utf-8')\n        arg_5 = hashlib.sha1(arg_4).hexdigest()\n        arg_5 = arg_5.encode('utf-8')\n\n        # Get the overview table\n        arg_6 = arg_2 + '_summary'\n\n        # Check if the overview table exists, otherwise skip the rest of\n        # the meta adding\n        if arg_6 in arg_0._overview_group:\n            arg_7 = getattr(arg_0._overview_group, arg_6)\n        else:\n            return arg_3\n\n\n        try:\n            arg_8 = {'hexdigestcol': arg_7.cols.hexdigest,\n                'hexdigest': arg_5}\n\n            arg_9 = \"\"\"(hexdigestcol == hexdigest)\"\"\"\n\n            arg_10 = arg_7.where(arg_9, arg_8=arg_8)\n\n            arg_11 = None\n            try:\n                arg_11 = next(arg_10)\n            except StopIteration:\n                pass\n\n            if arg_11 is None:\n                arg_0._all_store_param_or_result_table_entry(arg_1, arg_7,\n                                                            flags=(\n                                                                HDF5StorageService.ADD_ROW,),\n                                                            additional_info={\n                                                                'hexdigest': arg_5})\n\n                arg_3 = True\n            else:\n                arg_3 = False\n                arg_0._all_kill_iterator(arg_10)\n\n        except pt.NoSuchNodeError:\n            arg_3 = True\n\n        return arg_3", "path": "pypet/storageservice.py", "identifier": "HDF5StorageService._prm_meta_add_summary", "docstring": "Adds data to the summary tables and returns if `instance`s comment has to be stored.\n\n        Also moves comments upwards in the hierarchy if purge_duplicate_comments is true\n        and a lower index run has completed. Only necessary for *multiprocessing*.\n\n        :return: Tuple\n\n            * String specifying the subtree\n\n            * Boolean whether to store the comment to `instance`s hdf5 node", "docstring_tokens": ["Adds", "data", "to", "the", "summary", "tables", "and", "returns", "if", "instance", "s", "comment", "has", "to", "be", "stored", "."], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 261274}
{"url": "https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/agent/agent.py#L48-L59", "sha": "1112e6a66917d3e98e44cb7b33b107fd5a74bb2e", "docstring_summary": "Determine if a vif is on isonet", "language": "python", "parameters": "(vif)", "return_statement": "return False", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "record", ".", "get", "(", "'other_config'", ")", ".", "get", "(", "'nicira-iface-id'", ")", "if", "arg_1", ":", "return", "True", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"Determine if a vif is on isonet\n\n    Returns True if a vif belongs to an isolated network by checking\n    for a nicira interface id.\n    \"\"\"\n    arg_1 = arg_0.record.get('other_config').get('nicira-iface-id')\n\n    if arg_1:\n        return True\n\n    return False", "path": "quark/agent/agent.py", "identifier": "is_isonet_vif", "docstring": "Determine if a vif is on isonet\n\n    Returns True if a vif belongs to an isolated network by checking\n    for a nicira interface id.", "docstring_tokens": ["Determine", "if", "a", "vif", "is", "on", "isonet"], "nwo": "openstack/quark", "score": 0.37834514764359445, "idx": 261275}
{"url": "https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/irc.py#L146-L168", "sha": "f9d2bd6369aafe6cb0916c9406270ca8ecea2080", "docstring_summary": "\\\n        Low-level dispatching of socket data based on regex matching, in general\n        handles", "language": "python", "parameters": "(self)", "return_statement": "return (\n            (self.nick_re, self.new_nick),\n            (self.nick_change_re, self.handle_nick_change),\n            (self.ping_re, self.handle_ping),\n            (self.part_re, self.handle_part),\n            (self.join_re, self.handle_join),\n            (self.quit_re, self.handle_quit),\n            (self.chanmsg_re, self.handle_channel_message),\n            (self.privmsg_re, self.handle_private_message),\n            (self.registered_re, self.handle_registered),\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "(", "(", "arg_0", ".", "nick_re", ",", "arg_0", ".", "new_nick", ")", ",", "(", "arg_0", ".", "nick_change_re", ",", "arg_0", ".", "handle_nick_change", ")", ",", "(", "arg_0", ".", "ping_re", ",", "arg_0", ".", "handle_ping", ")", ",", "(", "arg_0", ".", "part_re", ",", "arg_0", ".", "handle_part", ")", ",", "(", "arg_0", ".", "join_re", ",", "arg_0", ".", "handle_join", ")", ",", "(", "arg_0", ".", "quit_re", ",", "arg_0", ".", "handle_quit", ")", ",", "(", "arg_0", ".", "chanmsg_re", ",", "arg_0", ".", "handle_channel_message", ")", ",", "(", "arg_0", ".", "privmsg_re", ",", "arg_0", ".", "handle_private_message", ")", ",", "(", "arg_0", ".", "registered_re", ",", "arg_0", ".", "handle_registered", ")", ",", ")"], "function": "def Func(arg_0):\n        \"\"\"\\\n        Low-level dispatching of socket data based on regex matching, in general\n        handles\n\n        * In event a nickname is taken, registers under a different one\n        * Responds to periodic PING messages from server\n        * Dispatches to registered callbacks when\n            - any user leaves or enters a room currently connected to\n            - a channel message is observed\n            - a private message is received\n        \"\"\"\n        return (\n            (arg_0.nick_re, arg_0.new_nick),\n            (arg_0.nick_change_re, arg_0.handle_nick_change),\n            (arg_0.ping_re, arg_0.handle_ping),\n            (arg_0.part_re, arg_0.handle_part),\n            (arg_0.join_re, arg_0.handle_join),\n            (arg_0.quit_re, arg_0.handle_quit),\n            (arg_0.chanmsg_re, arg_0.handle_channel_message),\n            (arg_0.privmsg_re, arg_0.handle_private_message),\n            (arg_0.registered_re, arg_0.handle_registered),\n        )", "path": "irc.py", "identifier": "IRCConnection.dispatch_patterns", "docstring": "\\\n        Low-level dispatching of socket data based on regex matching, in general\n        handles\n\n        * In event a nickname is taken, registers under a different one\n        * Responds to periodic PING messages from server\n        * Dispatches to registered callbacks when\n            - any user leaves or enters a room currently connected to\n            - a channel message is observed\n            - a private message is received", "docstring_tokens": ["\\", "Low", "-", "level", "dispatching", "of", "socket", "data", "based", "on", "regex", "matching", "in", "general", "handles"], "nwo": "coleifer/irc", "score": 0.28749967694495965, "idx": 261276}
{"url": "https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/scripts/snapshot.py#L20-L37", "sha": "6d1cecbe02f1e510dd185fe23f88f7af35eb737f", "docstring_summary": "Take a snapshot of a droplet", "language": "python", "parameters": "(droplet, name)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "print", "\"powering off\"", "arg_0", ".", "power_off", "(", ")", "arg_0", ".", "wait", "(", ")", "print", "\"taking snapshot\"", "arg_0", ".", "Func", "(", "arg_1", ")", "arg_0", ".", "wait", "(", ")", "arg_2", "=", "arg_0", ".", "snapshots", "(", ")", "print", "\"Current snapshots\"", "print", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Take a snapshot of a droplet\n\n    Parameters\n    ----------\n    name: str\n        name for snapshot\n    \"\"\"\n    print \"powering off\"\n    arg_0.power_off()\n    arg_0.wait() # wait for pending actions to complete\n    print \"taking snapshot\"\n    arg_0.Func(arg_1)\n    arg_0.wait()\n    arg_2 = arg_0.snapshots()\n    print \"Current snapshots\"\n    print arg_2", "path": "scripts/snapshot.py", "identifier": "take_snapshot", "docstring": "Take a snapshot of a droplet\n\n    Parameters\n    ----------\n    name: str\n        name for snapshot", "docstring_tokens": ["Take", "a", "snapshot", "of", "a", "droplet"], "nwo": "changhiskhan/poseidon", "score": 0.1792979536242127, "idx": 261277}
{"url": "https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dav_provider.py#L827-L831", "sha": "cec0d84222fc24bea01be1cea91729001963f172", "docstring_summary": "Return True, if URI is locked.", "language": "python", "parameters": "(self)", "return_statement": "return self.provider.lock_manager.is_url_locked(self.get_ref_url())", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "provider", ".", "lock_manager", "is", "None", ":", "return", "False", "return", "arg_0", ".", "provider", ".", "lock_manager", ".", "is_url_locked", "(", "arg_0", ".", "get_ref_url", "(", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"Return True, if URI is locked.\"\"\"\n        if arg_0.provider.lock_manager is None:\n            return False\n        return arg_0.provider.lock_manager.is_url_locked(arg_0.get_ref_url())", "path": "wsgidav/dav_provider.py", "identifier": "_DAVResource.is_locked", "docstring": "Return True, if URI is locked.", "docstring_tokens": ["Return", "True", "if", "URI", "is", "locked", "."], "nwo": "mar10/wsgidav", "score": 0.762416315178035, "idx": 261278}
{"url": "https://github.com/penguinmenac3/opendatalake/blob/77c888377095e1812a16982c8efbd2f6b1697a33/opendatalake/detection/utils.py#L771-L784", "sha": "77c888377095e1812a16982c8efbd2f6b1697a33", "docstring_summary": "Move detections in direction dx, dy.", "language": "python", "parameters": "(label, dy, dx)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "arg_0", ".", "keys", "(", ")", ":", "if", "arg_3", ".", "startswith", "(", "\"detection\"", ")", ":", "arg_4", "=", "arg_0", "[", "arg_3", "]", "for", "arg_5", "in", "arg_4", ":", "arg_5", ".", "move_image", "(", "-", "arg_2", ",", "-", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Move detections in direction dx, dy.\n\n    :param label: The label dict containing all detection lists.\n    :param dy: The delta in y direction as a number.\n    :param dx: The delta in x direction as a number.\n    :return:\n    \"\"\"\n    for arg_3 in arg_0.keys():\n        if arg_3.startswith(\"detection\"):\n            arg_4 = arg_0[arg_3]\n            for arg_5 in arg_4:\n                arg_5.move_image(-arg_2, -arg_1)", "path": "opendatalake/detection/utils.py", "identifier": "move_detections", "docstring": "Move detections in direction dx, dy.\n\n    :param label: The label dict containing all detection lists.\n    :param dy: The delta in y direction as a number.\n    :param dx: The delta in x direction as a number.\n    :return:", "docstring_tokens": ["Move", "detections", "in", "direction", "dx", "dy", "."], "nwo": "penguinmenac3/opendatalake", "score": 0.37032166861975024, "idx": 261279}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1975-L1989", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Compare twolists using given comparing function.", "language": "python", "parameters": "(list1, list2, custom_cmp)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "len", "(", "arg_0", ")", "!=", "len", "(", "arg_1", ")", ":", "return", "False", "for", "arg_3", ",", "arg_4", "in", "zip", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_2", "(", "arg_3", ",", "arg_4", ")", ":", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Compare twolists using given comparing function.\n\n    :param list1: first list to compare\n    :param list2: second list to compare\n    :param custom_cmp: a function taking two arguments (element of\n        list 1, element of list 2) and\n    :return: True or False depending if the values are the same\n    \"\"\"\n    if len(arg_0) != len(arg_1):\n        return False\n    for arg_3, arg_4 in zip(arg_0, arg_1):\n        if not arg_2(arg_3, arg_4):\n            return False\n    return True", "path": "harvestingkit/bibrecord.py", "identifier": "_compare_lists", "docstring": "Compare twolists using given comparing function.\n\n    :param list1: first list to compare\n    :param list2: second list to compare\n    :param custom_cmp: a function taking two arguments (element of\n        list 1, element of list 2) and\n    :return: True or False depending if the values are the same", "docstring_tokens": ["Compare", "twolists", "using", "given", "comparing", "function", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 261280}
{"url": "https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/utils.py#L38-L54", "sha": "ea09da24e45820e1300e24a52fefa6c849f7a986", "docstring_summary": "Recursively merge two dictionaries, with the elements from `top`\n    taking precedence over elements from `top`.", "language": "python", "parameters": "(base, top)", "return_statement": "return out", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dict", "(", "arg_1", ")", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", "in", "arg_1", ":", "if", "isinstance", "(", "arg_0", "[", "arg_3", "]", ",", "dict", ")", "and", "isinstance", "(", "arg_1", "[", "arg_3", "]", ",", "dict", ")", ":", "arg_2", "[", "arg_3", "]", "=", "Func", "(", "arg_0", "[", "arg_3", "]", ",", "arg_1", "[", "arg_3", "]", ")", "else", ":", "arg_2", "[", "arg_3", "]", "=", "arg_0", "[", "arg_3", "]", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Recursively merge two dictionaries, with the elements from `top`\n    taking precedence over elements from `top`.\n\n    Returns\n    -------\n    out : dict\n        A new dict, containing the merged records.\n    \"\"\"\n    arg_2 = dict(arg_1)\n    for arg_3 in arg_0:\n        if arg_3 in arg_1:\n            if isinstance(arg_0[arg_3], dict) and isinstance(arg_1[arg_3], dict):\n                arg_2[arg_3] = Func(arg_0[arg_3], arg_1[arg_3])\n        else:\n            arg_2[arg_3] = arg_0[arg_3]\n    return arg_2", "path": "osprey/utils.py", "identifier": "dict_merge", "docstring": "Recursively merge two dictionaries, with the elements from `top`\n    taking precedence over elements from `top`.\n\n    Returns\n    -------\n    out : dict\n        A new dict, containing the merged records.", "docstring_tokens": ["Recursively", "merge", "two", "dictionaries", "with", "the", "elements", "from", "top", "taking", "precedence", "over", "elements", "from", "top", "."], "nwo": "msmbuilder/osprey", "score": 0.387051491793819, "idx": 261281}
{"url": "https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L422-L491", "sha": "a7f5eed74d4d909cad79059f3c21c58606881449", "docstring_summary": "List experiments for this project.", "language": "python", "parameters": "(ctx, metrics, declarations, independent, group, query, sort, page)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", ",", "arg_7", ")", ":", "arg_8", ",", "arg_9", "=", "get_project_or_local", "(", "arg_0", ".", "obj", ".", "get", "(", "'project'", ")", ")", "arg_7", "=", "arg_7", "or", "1", "try", ":", "arg_10", "=", "PolyaxonClient", "(", ")", ".", "project", ".", "list_Func", "(", "username", "=", "arg_8", ",", "arg_9", "=", "arg_9", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ")", "except", "(", "PolyaxonHTTPError", ",", "PolyaxonShouldExitError", ",", "PolyaxonClientException", ")", "as", "e", ":", "Printer", ".", "print_error", "(", "'Could not get Func for project `{}`.'", ".", "format", "(", "arg_9", ")", ")", "Printer", ".", "print_error", "(", "'Error message `{}`.'", ".", "format", "(", "e", ")", ")", "sys", ".", "exit", "(", "1", ")", "arg_11", "=", "get_meta_response", "(", "arg_10", ")", "if", "arg_11", ":", "Printer", ".", "print_header", "(", "'Experiments for project `{}/{}`.'", ".", "format", "(", "arg_8", ",", "arg_9", ")", ")", "Printer", ".", "print_header", "(", "'Navigation:'", ")", "dict_tabulate", "(", "arg_11", ")", "else", ":", "Printer", ".", "print_header", "(", "'No Func found for project `{}/{}`.'", ".", "format", "(", "arg_8", ",", "arg_9", ")", ")", "if", "arg_1", ":", "arg_12", "=", "get_Func_with_metrics", "(", "arg_10", ")", "elif", "arg_2", ":", "arg_12", "=", "get_Func_with_declarations", "(", "arg_10", ")", "else", ":", "arg_12", "=", "[", "Printer", ".", "add_status_color", "(", "o", ".", "to_light_dict", "(", "humanize_values", "=", "True", ")", ")", "for", "o", "in", "arg_10", "[", "'results'", "]", "]", "arg_12", "=", "list_dicts_to_tabulate", "(", "arg_12", ")", "if", "arg_12", ":", "Printer", ".", "print_header", "(", "\"Experiments:\"", ")", "arg_12", ".", "pop", "(", "'project_name'", ",", "None", ")", "dict_tabulate", "(", "arg_12", ",", "is_list_dict", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7):\n    \"\"\"List Func for this project.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    Get all Func:\n\n    \\b\n    ```bash\n    $ polyaxon project Func\n    ```\n\n    Get all Func with with status {created or running}, and\n    creation date between 2018-01-01 and 2018-01-02, and declarations activation equal to sigmoid\n    and metric loss less or equal to 0.2\n\n    \\b\n    ```bash\n    $ polyaxon project Func \\\n      -q \"status:created|running, started_at:2018-01-01..2018-01-02, \\\n          declarations.activation:sigmoid, metric.loss:<=0.2\"\n    ```\n\n    Get all Func sorted by update date\n\n    \\b\n    ```bash\n    $ polyaxon project Func -s \"-updated_at\"\n    ```\n    \"\"\"\n    arg_8, arg_9 = get_project_or_local(arg_0.obj.get('project'))\n\n    arg_7 = arg_7 or 1\n    try:\n        arg_10 = PolyaxonClient().project.list_Func(username=arg_8,\n                                                             arg_9=arg_9,\n                                                             arg_3=arg_3,\n                                                             arg_4=arg_4,\n                                                             arg_1=arg_1,\n                                                             arg_2=arg_2,\n                                                             arg_5=arg_5,\n                                                             arg_6=arg_6,\n                                                             arg_7=arg_7)\n    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:\n        Printer.print_error('Could not get Func for project `{}`.'.format(arg_9))\n        Printer.print_error('Error message `{}`.'.format(e))\n        sys.exit(1)\n\n    arg_11 = get_meta_response(arg_10)\n    if arg_11:\n        Printer.print_header('Experiments for project `{}/{}`.'.format(arg_8, arg_9))\n        Printer.print_header('Navigation:')\n        dict_tabulate(arg_11)\n    else:\n        Printer.print_header('No Func found for project `{}/{}`.'.format(arg_8, arg_9))\n\n    if arg_1:\n        arg_12 = get_Func_with_metrics(arg_10)\n    elif arg_2:\n        arg_12 = get_Func_with_declarations(arg_10)\n    else:\n        arg_12 = [Printer.add_status_color(o.to_light_dict(humanize_values=True))\n                   for o in arg_10['results']]\n    arg_12 = list_dicts_to_tabulate(arg_12)\n    if arg_12:\n        Printer.print_header(\"Experiments:\")\n        arg_12.pop('project_name', None)\n        dict_tabulate(arg_12, is_list_dict=True)", "path": "polyaxon_cli/cli/project.py", "identifier": "experiments", "docstring": "List experiments for this project.\n\n    Uses [Caching](/references/polyaxon-cli/#caching)\n\n    Examples:\n\n    Get all experiments:\n\n    \\b\n    ```bash\n    $ polyaxon project experiments\n    ```\n\n    Get all experiments with with status {created or running}, and\n    creation date between 2018-01-01 and 2018-01-02, and declarations activation equal to sigmoid\n    and metric loss less or equal to 0.2\n\n    \\b\n    ```bash\n    $ polyaxon project experiments \\\n      -q \"status:created|running, started_at:2018-01-01..2018-01-02, \\\n          declarations.activation:sigmoid, metric.loss:<=0.2\"\n    ```\n\n    Get all experiments sorted by update date\n\n    \\b\n    ```bash\n    $ polyaxon project experiments -s \"-updated_at\"\n    ```", "docstring_tokens": ["List", "experiments", "for", "this", "project", "."], "nwo": "polyaxon/polyaxon-cli", "score": 0.288315270050036, "idx": 261282}
{"url": "https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L83-L106", "sha": "1a23a5b37a973a1dc69ad4c69e81edea5d096ac9", "docstring_summary": "Convert a 2D array of items into a Markdown table.", "language": "python", "parameters": "(table, *, padding=DEFAULT_PADDING, divider='|', header_div='-')", "return_statement": "return '\\n'.join(table)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", ",", "arg_1", "=", "arg_2", ",", "arg_3", "=", "'|'", ",", "arg_4", "=", "'-'", ")", ":", "arg_0", "=", "normalize_cols", "(", "arg_0", ")", "arg_0", "=", "pad_cells", "(", "arg_0", ")", "arg_5", "=", "arg_0", "[", "0", "]", "arg_6", "=", "arg_0", "[", "1", ":", "]", "arg_7", "=", "[", "len", "(", "cell", ")", "for", "cell", "in", "arg_5", "]", "arg_8", "=", "horiz_div", "(", "arg_7", ",", "arg_4", ",", "arg_3", ",", "arg_1", ")", "arg_5", "=", "add_dividers", "(", "arg_5", ",", "arg_3", ",", "arg_1", ")", "arg_6", "=", "[", "add_dividers", "(", "row", ",", "arg_3", ",", "arg_1", ")", "for", "row", "in", "arg_6", "]", "arg_0", "=", "[", "arg_5", ",", "arg_8", "]", "arg_0", ".", "extend", "(", "arg_6", ")", "arg_0", "=", "[", "row", ".", "rstrip", "(", ")", "for", "row", "in", "arg_0", "]", "return", "'\\n'", ".", "join", "(", "arg_0", ")"], "function": "def Func(arg_0, *, arg_1=arg_2, arg_3='|', arg_4='-'):\n    \"\"\"\n    Convert a 2D array of items into a Markdown table.\n\n    padding: the number of padding spaces on either side of each divider\n    divider: the vertical divider to place between columns\n    header_div: the horizontal divider to place between the header row and\n        body cells\n    \"\"\"\n    arg_0 = normalize_cols(arg_0)\n    arg_0 = pad_cells(arg_0)\n    arg_5 = arg_0[0]\n    arg_6 = arg_0[1:]\n\n    arg_7 = [len(cell) for cell in arg_5]\n    arg_8 = horiz_div(arg_7, arg_4, arg_3, arg_1)\n\n    arg_5 = add_dividers(arg_5, arg_3, arg_1)\n    arg_6 = [add_dividers(row, arg_3, arg_1) for row in arg_6]\n\n    arg_0 = [arg_5, arg_8]\n    arg_0.extend(arg_6)\n    arg_0 = [row.rstrip() for row in arg_0]\n    return '\\n'.join(arg_0)", "path": "csvtomd/csvtomd.py", "identifier": "md_table", "docstring": "Convert a 2D array of items into a Markdown table.\n\n    padding: the number of padding spaces on either side of each divider\n    divider: the vertical divider to place between columns\n    header_div: the horizontal divider to place between the header row and\n        body cells", "docstring_tokens": ["Convert", "a", "2D", "array", "of", "items", "into", "a", "Markdown", "table", "."], "nwo": "mplewis/csvtomd", "score": 0.7560419399185694, "idx": 261283}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/geospatial_coordinate.py#L101-L118", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Returns coordinate for given GPS position.", "language": "python", "parameters": "(self, longitude, latitude, altitude=None)", "return_statement": "return coordinate.astype(int)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ")", ":", "arg_4", "=", "PROJ", "(", "arg_1", ",", "arg_2", ")", "if", "arg_3", "is", "not", "None", ":", "arg_4", "=", "transform", "(", "PROJ", ",", "geocentric", ",", "arg_4", "[", "0", "]", ",", "arg_4", "[", "1", "]", ",", "arg_3", ")", "arg_5", "=", "numpy", ".", "array", "(", "arg_4", ")", "arg_5", "=", "arg_5", "/", "arg_0", ".", "scale", "return", "arg_5", ".", "astype", "(", "int", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None):\n    \"\"\"\n    Returns coordinate for given GPS position.\n\n    :param: longitude (float) Longitude of position\n    :param: latitude (float) Latitude of position\n    :param: altitude (float) Altitude of position\n    :returns: (numpy.array) Coordinate that the given GPS position\n                          maps to\n    \"\"\"\n    arg_4 = PROJ(arg_1, arg_2)\n\n    if arg_3 is not None:\n      arg_4 = transform(PROJ, geocentric, arg_4[0], arg_4[1], arg_3)\n\n    arg_5 = numpy.array(arg_4)\n    arg_5 = arg_5 / arg_0.scale\n    return arg_5.astype(int)", "path": "src/nupic/encoders/geospatial_coordinate.py", "identifier": "GeospatialCoordinateEncoder.coordinateForPosition", "docstring": "Returns coordinate for given GPS position.\n\n    :param: longitude (float) Longitude of position\n    :param: latitude (float) Latitude of position\n    :param: altitude (float) Altitude of position\n    :returns: (numpy.array) Coordinate that the given GPS position\n                          maps to", "docstring_tokens": ["Returns", "coordinate", "for", "given", "GPS", "position", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261284}
{"url": "https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L229-L239", "sha": "488b56fe57ad836b27feec9e76f51883db28faa6", "docstring_summary": "Dotted decimal notation to decimal conversion.", "language": "python", "parameters": "(ip, check=True)", "return_statement": "return dec", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "if", "arg_1", "and", "not", "is_dot", "(", "arg_0", ")", ":", "raise", "ValueError", "(", "'Func: invalid IP: \"%s\"'", "%", "arg_0", ")", "arg_2", "=", "str", "(", "arg_0", ")", ".", "split", "(", "'.'", ")", "arg_3", "=", "0", "arg_3", "|=", "int", "(", "arg_2", "[", "0", "]", ")", "<<", "24", "arg_3", "|=", "int", "(", "arg_2", "[", "1", "]", ")", "<<", "16", "arg_3", "|=", "int", "(", "arg_2", "[", "2", "]", ")", "<<", "8", "arg_3", "|=", "int", "(", "arg_2", "[", "3", "]", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1=True):\n    \"\"\"Dotted decimal notation to decimal conversion.\"\"\"\n    if arg_1 and not is_dot(arg_0):\n        raise ValueError('Func: invalid IP: \"%s\"' % arg_0)\n    arg_2 = str(arg_0).split('.')\n    arg_3 = 0\n    arg_3 |= int(arg_2[0]) << 24\n    arg_3 |= int(arg_2[1]) << 16\n    arg_3 |= int(arg_2[2]) << 8\n    arg_3 |= int(arg_2[3])\n    return arg_3", "path": "iplib.py", "identifier": "_dot_to_dec", "docstring": "Dotted decimal notation to decimal conversion.", "docstring_tokens": ["Dotted", "decimal", "notation", "to", "decimal", "conversion", "."], "nwo": "alberanid/python-iplib", "score": 0.18693279483006084, "idx": 261285}
{"url": "https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L237-L244", "sha": "e86c2173ea386654f4ae061148e8fbe3f25e715c", "docstring_summary": "Ensure that if a link can be found for this, that it is found.", "language": "python", "parameters": "(self, finder, upgrade)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_0", ".", "link", "is", "None", ":", "arg_0", ".", "link", "=", "arg_1", ".", "find_requirement", "(", "arg_0", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Ensure that if a link can be found for this, that it is found.\n\n        Note that self.link may still be None - if Upgrade is False and the\n        requirement is already installed.\n        \"\"\"\n        if arg_0.link is None:\n            arg_0.link = arg_1.find_requirement(arg_0, arg_2)", "path": "capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py", "identifier": "InstallRequirement.populate_link", "docstring": "Ensure that if a link can be found for this, that it is found.\n\n        Note that self.link may still be None - if Upgrade is False and the\n        requirement is already installed.", "docstring_tokens": ["Ensure", "that", "if", "a", "link", "can", "be", "found", "for", "this", "that", "it", "is", "found", "."], "nwo": "AkihikoITOH/capybara", "score": 0.24979334806965703, "idx": 261286}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/compiler/util.py#L137-L149", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Returns value as a valid Go string literal.", "language": "python", "parameters": "(value)", "return_statement": "return io.getvalue()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "StringIO", ".", "StringIO", "(", ")", "arg_1", ".", "write", "(", "'\"'", ")", "for", "arg_2", "in", "arg_0", ":", "if", "arg_2", "in", "_ESCAPES", ":", "arg_1", ".", "write", "(", "_ESCAPES", "[", "arg_2", "]", ")", "elif", "arg_2", "in", "_SIMPLE_CHARS", ":", "arg_1", ".", "write", "(", "arg_2", ")", "else", ":", "arg_1", ".", "write", "(", "r'\\x{:02x}'", ".", "format", "(", "ord", "(", "arg_2", ")", ")", ")", "arg_1", ".", "write", "(", "'\"'", ")", "return", "arg_1", ".", "getvalue", "(", ")"], "function": "def Func(arg_0):\n  \"\"\"Returns value as a valid Go string literal.\"\"\"\n  arg_1 = StringIO.StringIO()\n  arg_1.write('\"')\n  for arg_2 in arg_0:\n    if arg_2 in _ESCAPES:\n      arg_1.write(_ESCAPES[arg_2])\n    elif arg_2 in _SIMPLE_CHARS:\n      arg_1.write(arg_2)\n    else:\n      arg_1.write(r'\\x{:02x}'.format(ord(arg_2)))\n  arg_1.write('\"')\n  return arg_1.getvalue()", "path": "compiler/util.py", "identifier": "go_str", "docstring": "Returns value as a valid Go string literal.", "docstring_tokens": ["Returns", "value", "as", "a", "valid", "Go", "string", "literal", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 261287}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/metrics/metrics_helper.py#L192-L194", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Apply update to serialization metrics", "language": "python", "parameters": "(self, stream_id, latency_in_ns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "update_count", "(", "arg_0", ".", "TUPLE_SERIALIZATION_TIME_NS", ",", "incr_by", "=", "arg_2", ",", "key", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Apply update to serialization metrics\"\"\"\n    arg_0.update_count(arg_0.TUPLE_SERIALIZATION_TIME_NS, incr_by=arg_2, key=arg_1)", "path": "heron/instance/src/python/utils/metrics/metrics_helper.py", "identifier": "ComponentMetrics.serialize_data_tuple", "docstring": "Apply update to serialization metrics", "docstring_tokens": ["Apply", "update", "to", "serialization", "metrics"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 261288}
{"url": "https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/transfer.py#L83-L112", "sha": "bad6c32e3f10e185098748f67bb421b378b06afe", "docstring_summary": "Given two list or arrays, pad with zeros the shortest array", "language": "python", "parameters": "(b,a)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "abs", "(", "len", "(", "arg_0", ")", "-", "len", "(", "arg_1", ")", ")", "if", "arg_2", "!=", "0", ":", "if", "len", "(", "arg_1", ")", ">", "len", "(", "arg_0", ")", ":", "try", ":", "arg_0", ".", "extend", "(", "[", "0.", "]", "*", "arg_2", ")", "except", ":", "arg_0", "=", "np", ".", "append", "(", "arg_0", ",", "[", "0", "]", "*", "arg_2", ")", "elif", "len", "(", "arg_0", ")", ">", "len", "(", "arg_1", ")", ":", "try", ":", "arg_1", ".", "extend", "(", "[", "0.", "]", "*", "arg_2", ")", "except", ":", "arg_1", "=", "np", ".", "append", "(", "arg_1", ",", "[", "0", "]", "*", "arg_2", ")", "return", "arg_0", ",", "arg_1", "else", ":", "return", "arg_0", ",", "arg_1"], "function": "def Func(arg_0,arg_1):\n    \"\"\"Given two list or arrays, pad with zeros the shortest array\n\n    :param b: list or array\n    :param a: list or array\n\n\n    .. doctest::\n\n        >>> from spectrum.transfer import Func\n        >>> a = [1,2]\n        >>> b = [1,2,3,4]\n        >>> a, b, = Func(a,b)\n\n    \"\"\"\n    arg_2 = abs(len(arg_0)-len(arg_1))\n    if arg_2 != 0:\n        if len(arg_1) > len(arg_0):\n            try:\n                arg_0.extend([0.]*arg_2)\n            except:\n                arg_0 = np.append(arg_0, [0]*arg_2)\n        elif len(arg_0)>len(arg_1):\n            try:\n                arg_1.extend([0.]*arg_2)\n            except:\n                arg_1 = np.append(arg_1, [0]*arg_2)\n        return arg_0,arg_1\n    else:\n        return arg_0,arg_1", "path": "src/spectrum/transfer.py", "identifier": "eqtflength", "docstring": "Given two list or arrays, pad with zeros the shortest array\n\n    :param b: list or array\n    :param a: list or array\n\n\n    .. doctest::\n\n        >>> from spectrum.transfer import eqtflength\n        >>> a = [1,2]\n        >>> b = [1,2,3,4]\n        >>> a, b, = eqtflength(a,b)", "docstring_tokens": ["Given", "two", "list", "or", "arrays", "pad", "with", "zeros", "the", "shortest", "array"], "nwo": "cokelaer/spectrum", "score": 0.7288957086127092, "idx": 261289}
{"url": "https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L177-L196", "sha": "cd5c6e10c6c4e653669e11d735d5773766986bda", "docstring_summary": "Call the API with a PUT request.", "language": "python", "parameters": "(self, url, params=None, data=None, files=None, **kwargs)", "return_statement": "return self.call_api(\n            \"PUT\",\n            url,\n            params=params,\n            data=data,\n            files=files,\n            **kwargs\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "return", "arg_0", ".", "call_api", "(", "\"PUT\"", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", "arg_4", "=", "arg_4", ",", "**", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, **arg_5):\n        \"\"\" Call the API with a PUT request.\n\n        Args:\n            url (str): Resource location relative to the base URL.\n            params (dict or None): Query-string parameters.\n            data (dict or None): Request body contents.\n            files (dict or None: Files to be passed to the request.\n\n        Returns:\n            An instance of ResultParser or ErrorParser.\n        \"\"\"\n        return arg_0.call_api(\n            \"PUT\",\n            arg_1,\n            arg_2=arg_2,\n            arg_3=arg_3,\n            arg_4=arg_4,\n            **arg_5\n        )", "path": "nerd/client.py", "identifier": "ApiClient.put", "docstring": "Call the API with a PUT request.\n\n        Args:\n            url (str): Resource location relative to the base URL.\n            params (dict or None): Query-string parameters.\n            data (dict or None): Request body contents.\n            files (dict or None: Files to be passed to the request.\n\n        Returns:\n            An instance of ResultParser or ErrorParser.", "docstring_tokens": ["Call", "the", "API", "with", "a", "PUT", "request", "."], "nwo": "hirmeos/entity-fishing-client-python", "score": 0.36576314591848075, "idx": 261290}
{"url": "https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/signature_verify.py#L568-L630", "sha": "b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e", "docstring_summary": "Read the data encoding the SignatureVerify response payload and decode\n        it into its constituent parts.", "language": "python", "parameters": "(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_3", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "SignatureVerifyResponsePayload", ",", "arg_0", ")", ".", "Func", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "arg_6", "=", "utils", ".", "BytearrayStream", "(", "arg_1", ".", "Func", "(", "arg_0", ".", "length", ")", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ",", "arg_6", ")", ":", "arg_0", ".", "_unique_identifier", "=", "primitives", ".", "TextString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "UNIQUE_IDENTIFIER", ")", "arg_0", ".", "_unique_identifier", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Parsed payload encoding is missing the unique identifier \"", "\"field.\"", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "VALIDITY_INDICATOR", ",", "arg_6", ")", ":", "arg_0", ".", "_validity_indicator", "=", "primitives", ".", "Enumeration", "(", "arg_3", ".", "ValidityIndicator", ",", "tag", "=", "arg_3", ".", "Tags", ".", "VALIDITY_INDICATOR", ")", "arg_0", ".", "_validity_indicator", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "else", ":", "raise", "ValueError", "(", "\"Parsed payload encoding is missing the validity indicator \"", "\"field.\"", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "DATA", ",", "arg_6", ")", ":", "arg_0", ".", "_data", "=", "primitives", ".", "ByteString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "DATA", ")", "arg_0", ".", "_data", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "if", "arg_0", ".", "is_tag_next", "(", "arg_3", ".", "Tags", ".", "CORRELATION_VALUE", ",", "arg_6", ")", ":", "arg_0", ".", "_correlation_value", "=", "primitives", ".", "ByteString", "(", "tag", "=", "arg_3", ".", "Tags", ".", "CORRELATION_VALUE", ")", "arg_0", ".", "_correlation_value", ".", "Func", "(", "arg_6", ",", "arg_2", "=", "arg_2", ")", "arg_0", ".", "is_oversized", "(", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):\n        \"\"\"\n        Read the data encoding the SignatureVerify response payload and decode\n        it into its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a Func method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.\n        \"\"\"\n        super(SignatureVerifyResponsePayload, arg_0).Func(\n            arg_1,\n            arg_2=arg_2\n        )\n        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))\n\n        if arg_0.is_tag_next(arg_3.Tags.UNIQUE_IDENTIFIER, arg_6):\n            arg_0._unique_identifier = primitives.TextString(\n                tag=arg_3.Tags.UNIQUE_IDENTIFIER\n            )\n            arg_0._unique_identifier.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise ValueError(\n                \"Parsed payload encoding is missing the unique identifier \"\n                \"field.\"\n            )\n        if arg_0.is_tag_next(arg_3.Tags.VALIDITY_INDICATOR, arg_6):\n            arg_0._validity_indicator = primitives.Enumeration(\n                arg_3.ValidityIndicator,\n                tag=arg_3.Tags.VALIDITY_INDICATOR\n            )\n            arg_0._validity_indicator.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n        else:\n            raise ValueError(\n                \"Parsed payload encoding is missing the validity indicator \"\n                \"field.\"\n            )\n        if arg_0.is_tag_next(arg_3.Tags.DATA, arg_6):\n            arg_0._data = primitives.ByteString(tag=arg_3.Tags.DATA)\n            arg_0._data.Func(arg_6, arg_2=arg_2)\n        if arg_0.is_tag_next(arg_3.Tags.CORRELATION_VALUE, arg_6):\n            arg_0._correlation_value = primitives.ByteString(\n                tag=arg_3.Tags.CORRELATION_VALUE\n            )\n            arg_0._correlation_value.Func(\n                arg_6,\n                arg_2=arg_2\n            )\n\n        arg_0.is_oversized(arg_6)", "path": "kmip/core/messages/payloads/signature_verify.py", "identifier": "SignatureVerifyResponsePayload.read", "docstring": "Read the data encoding the SignatureVerify response payload and decode\n        it into its constituent parts.\n\n        Args:\n            input_stream (stream): A data stream containing encoded object\n                data, supporting a read method; usually a BytearrayStream\n                object.\n            kmip_version (KMIPVersion): An enumeration defining the KMIP\n                version with which the object will be decoded. Optional,\n                defaults to KMIP 1.0.\n\n        Raises:\n            ValueError: Raised if the data attribute is missing from the\n                encoded payload.", "docstring_tokens": ["Read", "the", "data", "encoding", "the", "SignatureVerify", "response", "payload", "and", "decode", "it", "into", "its", "constituent", "parts", "."], "nwo": "OpenKMIP/PyKMIP", "score": 0.7283203957767634, "idx": 261291}
{"url": "https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/hyperloglog.py#L89-L124", "sha": "b3e4129987890a2beb04f2c0b6dc618ae35f2e14", "docstring_summary": "Update the HyperLogLog with a new data value in bytes.\n        The value will be hashed using the hash function specified by\n        the `hashfunc` argument in the constructor.", "language": "python", "parameters": "(self, b)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "hashfunc", "(", "arg_1", ")", "arg_3", "=", "arg_2", "&", "(", "arg_0", ".", "m", "-", "1", ")", "arg_4", "=", "arg_2", ">>", "arg_0", ".", "p", "arg_0", ".", "reg", "[", "arg_3", "]", "=", "max", "(", "arg_0", ".", "reg", "[", "arg_3", "]", ",", "arg_0", ".", "_get_rank", "(", "arg_4", ")", ")"], "function": "def Func(arg_0, arg_1):\n        '''\n        Update the HyperLogLog with a new data value in bytes.\n        The value will be hashed using the hash function specified by\n        the `hashfunc` argument in the constructor.\n\n        Args:\n            b: The value to be hashed using the hash function specified.\n\n        Example:\n            To Func with a new string value (using the default SHA1 hash\n            function, which requires bytes as input):\n\n            .. code-block:: python\n\n                hll = HyperLogLog()\n                hll.Func(\"new value\".encode('utf-8'))\n\n            We can also use a different hash function, for example, `pyfarmhash`:\n\n            .. code-block:: python\n\n                import farmhash\n                def _hash_32(b):\n                    return farmhash.hash32(b)\n                hll = HyperLogLog(hashfunc=_hash_32)\n                hll.Func(\"new value\")\n        '''\n        # Digest the hash object to get the hash value\n        arg_2 = arg_0.hashfunc(arg_1)\n        # Get the index of the register using the first p bits of the hash\n        arg_3 = arg_2 & (arg_0.m - 1)\n        # Get the rest of the hash\n        arg_4 = arg_2 >> arg_0.p\n        # Update the register\n        arg_0.reg[arg_3] = max(arg_0.reg[arg_3], arg_0._get_rank(arg_4))", "path": "datasketch/hyperloglog.py", "identifier": "HyperLogLog.update", "docstring": "Update the HyperLogLog with a new data value in bytes.\n        The value will be hashed using the hash function specified by\n        the `hashfunc` argument in the constructor.\n\n        Args:\n            b: The value to be hashed using the hash function specified.\n\n        Example:\n            To update with a new string value (using the default SHA1 hash\n            function, which requires bytes as input):\n\n            .. code-block:: python\n\n                hll = HyperLogLog()\n                hll.update(\"new value\".encode('utf-8'))\n\n            We can also use a different hash function, for example, `pyfarmhash`:\n\n            .. code-block:: python\n\n                import farmhash\n                def _hash_32(b):\n                    return farmhash.hash32(b)\n                hll = HyperLogLog(hashfunc=_hash_32)\n                hll.update(\"new value\")", "docstring_tokens": ["Update", "the", "HyperLogLog", "with", "a", "new", "data", "value", "in", "bytes", ".", "The", "value", "will", "be", "hashed", "using", "the", "hash", "function", "specified", "by", "the", "hashfunc", "argument", "in", "the", "constructor", "."], "nwo": "ekzhu/datasketch", "score": 0.9610309423191535, "idx": 261292}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/connectors/pulsar/pulsarspout.py#L72-L119", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Implements Pulsar Spout's initialize method", "language": "python", "parameters": "(self, config, context)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "logger", ".", "info", "(", "\"Initializing PulsarSpout with the following\"", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Component-specific config: \\n%s\"", "%", "str", "(", "arg_1", ")", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Context: \\n%s\"", "%", "str", "(", "arg_2", ")", ")", "arg_0", ".", "emit_count", "=", "0", "arg_0", ".", "ack_count", "=", "0", "arg_0", ".", "fail_count", "=", "0", "if", "not", "PulsarSpout", ".", "serviceUrl", "in", "arg_1", "or", "not", "PulsarSpout", ".", "topicName", "in", "arg_1", ":", "arg_0", ".", "logger", ".", "fatal", "(", "\"Need to specify both serviceUrl and topicName\"", ")", "arg_0", ".", "pulsar_cluster", "=", "str", "(", "arg_1", "[", "PulsarSpout", ".", "serviceUrl", "]", ")", "arg_0", ".", "topic", "=", "str", "(", "arg_1", "[", "PulsarSpout", ".", "topicName", "]", ")", "arg_8", "=", "arg_1", "[", "api_constants", ".", "TOPOLOGY_RELIABILITY_MODE", "]", "if", "arg_8", "==", "api_constants", ".", "TopologyReliabilityMode", ".", "ATLEAST_ONCE", ":", "arg_0", ".", "acking_timeout", "=", "1000", "*", "int", "(", "arg_1", "[", "api_constants", ".", "TOPOLOGY_MESSAGE_TIMEOUT_SECS", "]", ")", "else", ":", "arg_0", ".", "acking_timeout", "=", "30000", "if", "PulsarSpout", ".", "receiveTimeoutMs", "in", "arg_1", ":", "arg_0", ".", "receive_timeout_ms", "=", "arg_1", "[", "PulsarSpout", ".", "receiveTimeoutMs", "]", "else", ":", "arg_0", ".", "receive_timeout_ms", "=", "10", "if", "PulsarSpout", ".", "deserializer", "in", "arg_1", ":", "arg_0", ".", "deserializer", "=", "arg_1", "[", "PulsarSpout", ".", "deserializer", "]", "if", "not", "callable", "(", "arg_0", ".", "deserializer", ")", ":", "arg_0", ".", "logger", ".", "fatal", "(", "\"Pulsar Message Deserializer needs to be callable\"", ")", "else", ":", "arg_0", ".", "deserializer", "=", "arg_0", ".", "default_deserializer", "arg_0", ".", "logConfFileName", "=", "GenerateLogConfig", "(", "arg_2", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Generated LogConf at %s\"", "%", "arg_0", ".", "logConfFileName", ")", "arg_0", ".", "client", "=", "pulsar", ".", "Client", "(", "arg_0", ".", "pulsar_cluster", ",", "log_conf_file_path", "=", "arg_0", ".", "logConfFileName", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Setup Client with cluster %s\"", "%", "arg_0", ".", "pulsar_cluster", ")", "try", ":", "arg_0", ".", "consumer", "=", "arg_0", ".", "client", ".", "subscribe", "(", "arg_0", ".", "topic", ",", "arg_2", ".", "get_topology_name", "(", ")", ",", "consumer_type", "=", "pulsar", ".", "ConsumerType", ".", "Failover", ",", "unacked_messages_timeout_ms", "=", "arg_0", ".", "acking_timeout", ")", "except", "Exception", "as", "e", ":", "arg_0", ".", "logger", ".", "fatal", "(", "\"Pulsar client subscription failed: %s\"", "%", "str", "(", "e", ")", ")", "arg_0", ".", "logger", ".", "info", "(", "\"Subscribed to topic %s\"", "%", "arg_0", ".", "topic", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Implements Pulsar Spout's Func method\"\"\"\n    arg_0.logger.info(\"Initializing PulsarSpout with the following\")\n    arg_0.logger.info(\"Component-specific config: \\n%s\" % str(arg_1))\n    arg_0.logger.info(\"Context: \\n%s\" % str(arg_2))\n\n    arg_0.emit_count = 0\n    arg_0.ack_count = 0\n    arg_0.fail_count = 0\n\n    if not PulsarSpout.serviceUrl in arg_1 or not PulsarSpout.topicName in arg_1:\n      arg_0.logger.fatal(\"Need to specify both serviceUrl and topicName\")\n    arg_0.pulsar_cluster = str(arg_1[PulsarSpout.serviceUrl])\n    arg_0.topic = str(arg_1[PulsarSpout.topicName])\n    arg_8 = arg_1[api_constants.TOPOLOGY_RELIABILITY_MODE]\n    if arg_8 == api_constants.TopologyReliabilityMode.ATLEAST_ONCE:\n      arg_0.acking_timeout = 1000 * int(arg_1[api_constants.TOPOLOGY_MESSAGE_TIMEOUT_SECS])\n    else:\n      arg_0.acking_timeout = 30000\n    if PulsarSpout.receiveTimeoutMs in arg_1:\n      arg_0.receive_timeout_ms = arg_1[PulsarSpout.receiveTimeoutMs]\n    else:\n      arg_0.receive_timeout_ms = 10\n    if PulsarSpout.deserializer in arg_1:\n      arg_0.deserializer = arg_1[PulsarSpout.deserializer]\n      if not callable(arg_0.deserializer):\n        arg_0.logger.fatal(\"Pulsar Message Deserializer needs to be callable\")\n    else:\n      arg_0.deserializer = arg_0.default_deserializer\n\n    # First generate the config\n    arg_0.logConfFileName = GenerateLogConfig(arg_2)\n    arg_0.logger.info(\"Generated LogConf at %s\" % arg_0.logConfFileName)\n\n    # We currently use the high level consumer API\n    # For supporting effectively once, we will need to switch\n    # to using lower level Reader API, when it becomes\n    # available in python\n    arg_0.client = pulsar.Client(arg_0.pulsar_cluster, log_conf_file_path=arg_0.logConfFileName)\n    arg_0.logger.info(\"Setup Client with cluster %s\" % arg_0.pulsar_cluster)\n    try:\n      arg_0.consumer = arg_0.client.subscribe(arg_0.topic, arg_2.get_topology_name(),\n                                            consumer_type=pulsar.ConsumerType.Failover,\n                                            unacked_messages_timeout_ms=arg_0.acking_timeout)\n    except Exception as e:\n      arg_0.logger.fatal(\"Pulsar client subscription failed: %s\" % str(e))\n\n    arg_0.logger.info(\"Subscribed to topic %s\" % arg_0.topic)", "path": "heronpy/connectors/pulsar/pulsarspout.py", "identifier": "PulsarSpout.initialize", "docstring": "Implements Pulsar Spout's initialize method", "docstring_tokens": ["Implements", "Pulsar", "Spout", "s", "initialize", "method"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 261293}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/movies.py#L53-L68", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get the basic movie information for a specific movie id.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get the basic movie Funcrmation for a specific movie id.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/movies.py", "identifier": "Movies.info", "docstring": "Get the basic movie information for a specific movie id.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            append_to_response: (optional) Comma separated, any movie method.\n\n        Returns:\n            A dict representation of the JSON returned from the API.", "docstring_tokens": ["Get", "the", "basic", "movie", "information", "for", "a", "specific", "movie", "id", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 261294}
{"url": "https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L77-L94", "sha": "cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174", "docstring_summary": "Method to request a PIN from ecobee for authorization", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "'https://api.ecobee.com/authorize'", "arg_2", "=", "{", "'response_type'", ":", "'ecobeePin'", ",", "'client_id'", ":", "arg_0", ".", "api_key", ",", "'scope'", ":", "'smartWrite'", "}", "try", ":", "arg_3", "=", "requests", ".", "get", "(", "arg_1", ",", "arg_2", "=", "arg_2", ")", "except", "RequestException", ":", "logger", ".", "warn", "(", "\"Error connecting to Ecobee.  Possible connectivity outage.\"", "\"Could not request pin.\"", ")", "return", "arg_0", ".", "authorization_code", "=", "arg_3", ".", "json", "(", ")", "[", "'code'", "]", "arg_0", ".", "pin", "=", "arg_3", ".", "json", "(", ")", "[", "'ecobeePin'", "]", "logger", ".", "error", "(", "'Please authorize your ecobee developer app with PIN code '", "+", "arg_0", ".", "pin", "+", "'\\nGoto https://www.ecobee.com/consumerportal'", "'/index.html, click\\nMy Apps, Add application, Enter Pin'", "' and click Authorize.\\nAfter authorizing, call request_'", "'tokens() method.'", ")"], "function": "def Func(arg_0):\n        ''' Method to request a PIN from ecobee for authorization '''\n        arg_1 = 'https://api.ecobee.com/authorize'\n        arg_2 = {'response_type': 'ecobeePin',\n                  'client_id': arg_0.api_key, 'scope': 'smartWrite'}\n        try:\n            arg_3 = requests.get(arg_1, arg_2=arg_2)\n        except RequestException:\n            logger.warn(\"Error connecting to Ecobee.  Possible connectivity outage.\"\n                        \"Could not request pin.\")\n            return\n        arg_0.authorization_code = arg_3.json()['code']\n        arg_0.pin = arg_3.json()['ecobeePin']\n        logger.error('Please authorize your ecobee developer app with PIN code '\n              + arg_0.pin + '\\nGoto https://www.ecobee.com/consumerportal'\n              '/index.html, click\\nMy Apps, Add application, Enter Pin'\n              ' and click Authorize.\\nAfter authorizing, call request_'\n              'tokens() method.')", "path": "pyecobee/__init__.py", "identifier": "Ecobee.request_pin", "docstring": "Method to request a PIN from ecobee for authorization", "docstring_tokens": ["Method", "to", "request", "a", "PIN", "from", "ecobee", "for", "authorization"], "nwo": "nkgilley/python-ecobee-api", "score": 0.37994208506696864, "idx": 261295}
{"url": "https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/image.py#L235-L268", "sha": "912ca39991355d358dc85fd55c7aeabdd7acc386", "docstring_summary": "Return a dict with the raw IPTC data.", "language": "python", "parameters": "(filename)", "return_statement": "return iptc_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "logging", ".", "getLogger", "(", "__name__", ")", "arg_2", "=", "{", "}", "arg_3", "=", "{", "}", "try", ":", "arg_4", "=", "_read_image", "(", "arg_0", ")", "arg_3", "=", "IptcImagePlugin", ".", "getiptcinfo", "(", "arg_4", ")", "except", "SyntaxError", ":", "arg_1", ".", "info", "(", "'IPTC Error in %s'", ",", "arg_0", ")", "if", "arg_3", "and", "(", "2", ",", "5", ")", "in", "arg_3", ":", "arg_2", "[", "\"title\"", "]", "=", "arg_3", "[", "(", "2", ",", "5", ")", "]", ".", "decode", "(", "'utf-8'", ",", "errors", "=", "'replace'", ")", "if", "arg_3", "and", "(", "2", ",", "120", ")", "in", "arg_3", ":", "arg_2", "[", "\"description\"", "]", "=", "arg_3", "[", "(", "2", ",", "120", ")", "]", ".", "decode", "(", "'utf-8'", ",", "errors", "=", "'replace'", ")", "if", "arg_3", "and", "(", "2", ",", "105", ")", "in", "arg_3", ":", "arg_2", "[", "\"headline\"", "]", "=", "arg_3", "[", "(", "2", ",", "105", ")", "]", ".", "decode", "(", "'utf-8'", ",", "errors", "=", "'replace'", ")", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Return a dict with the raw IPTC data.\"\"\"\n\n    arg_1 = logging.getLogger(__name__)\n\n    arg_2 = {}\n    arg_3 = {}\n\n    # PILs IptcImagePlugin issues a SyntaxError in certain circumstances\n    # with malformed metadata, see PIL/IptcImagePlugin.py\", line 71.\n    # ( https://github.com/python-pillow/Pillow/blob/9dd0348be2751beb2c617e32ff9985aa2f92ae5f/src/PIL/IptcImagePlugin.py#L71 )\n    try:\n        arg_4 = _read_image(arg_0)\n        arg_3 = IptcImagePlugin.getiptcinfo(arg_4)\n    except SyntaxError:\n        arg_1.info('IPTC Error in %s', arg_0)\n\n    # IPTC fields are catalogued in:\n    # https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata\n    # 2:05 is the IPTC title property\n    if arg_3 and (2, 5) in arg_3:\n        arg_2[\"title\"] = arg_3[(2, 5)].decode('utf-8', errors='replace')\n\n    # 2:120 is the IPTC description property\n    if arg_3 and (2, 120) in arg_3:\n        arg_2[\"description\"] = arg_3[(2, 120)].decode('utf-8',\n                                                             errors='replace')\n\n    # 2:105 is the IPTC headline property\n    if arg_3 and (2, 105) in arg_3:\n        arg_2[\"headline\"] = arg_3[(2, 105)].decode('utf-8',\n                                                          errors='replace')\n\n    return arg_2", "path": "sigal/image.py", "identifier": "get_iptc_data", "docstring": "Return a dict with the raw IPTC data.", "docstring_tokens": ["Return", "a", "dict", "with", "the", "raw", "IPTC", "data", "."], "nwo": "saimn/sigal", "score": 0.7190587544888096, "idx": 261296}
{"url": "https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/catalog.py#L264-L285", "sha": "532f561f32b91ea8debea0573c503dd20988bf40", "docstring_summary": "saves an object to the REST service\n        gets the object's REST location and the data from the object,\n        then POSTS the request.", "language": "python", "parameters": "(self, obj, content_type=\"application/xml\")", "return_statement": "return resp", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "\"application/xml\"", ")", ":", "arg_3", "=", "arg_1", ".", "href", "arg_4", "=", "arg_1", ".", "message", "(", ")", "arg_5", "=", "{", "\"Content-type\"", ":", "arg_2", ",", "\"Accept\"", ":", "arg_2", "}", "logger", ".", "debug", "(", "\"{} {}\"", ".", "format", "(", "arg_1", ".", "Func_method", ",", "arg_1", ".", "href", ")", ")", "arg_6", "=", "arg_0", ".", "http_request", "(", "arg_3", ",", "method", "=", "arg_1", ".", "Func_method", ".", "lower", "(", ")", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ")", "if", "arg_6", ".", "status_code", "not", "in", "(", "200", ",", "201", ")", ":", "raise", "FailedRequestError", "(", "'Failed to Func to Geoserver catalog: {}, {}'", ".", "format", "(", "arg_6", ".", "status_code", ",", "arg_6", ".", "text", ")", ")", "arg_0", ".", "_cache", ".", "clear", "(", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=\"application/xml\"):\n        \"\"\"\n        Funcs an object to the REST service\n        gets the object's REST location and the data from the object,\n        then POSTS the request.\n        \"\"\"\n        arg_3 = arg_1.href\n        arg_4 = arg_1.message()\n\n        arg_5 = {\n            \"Content-type\": arg_2,\n            \"Accept\": arg_2\n        }\n\n        logger.debug(\"{} {}\".format(arg_1.Func_method, arg_1.href))\n        arg_6 = arg_0.http_request(arg_3, method=arg_1.Func_method.lower(), arg_4=arg_4, arg_5=arg_5)\n\n        if arg_6.status_code not in (200, 201):\n            raise FailedRequestError('Failed to Func to Geoserver catalog: {}, {}'.format(arg_6.status_code, arg_6.text))\n\n        arg_0._cache.clear()\n        return arg_6", "path": "src/geoserver/catalog.py", "identifier": "Catalog.save", "docstring": "saves an object to the REST service\n        gets the object's REST location and the data from the object,\n        then POSTS the request.", "docstring_tokens": ["saves", "an", "object", "to", "the", "REST", "service", "gets", "the", "object", "s", "REST", "location", "and", "the", "data", "from", "the", "object", "then", "POSTS", "the", "request", "."], "nwo": "boundlessgeo/gsconfig", "score": 0.7627023200281134, "idx": 261297}
{"url": "https://github.com/bbusenius/Diablo-Python/blob/646ac5a6f1c79cf9b928a4e2a7979988698b6c82/simple_math/simple_math.py#L190-L218", "sha": "646ac5a6f1c79cf9b928a4e2a7979988698b6c82", "docstring_summary": "Uses Heron's formula to find the area of a triangle\n    based on the coordinates of three points.", "language": "python", "parameters": "(point1, point2, point3)", "return_statement": "return math.sqrt(s * (s - a) * (s - b) * (s - c))", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "\"\"\"Lengths of the three sides of the triangle\"\"\"", "arg_3", "=", "point_distance", "(", "arg_0", ",", "arg_1", ")", "arg_4", "=", "point_distance", "(", "arg_0", ",", "arg_2", ")", "arg_5", "=", "point_distance", "(", "arg_1", ",", "arg_2", ")", "\"\"\"Where s is the semiperimeter\"\"\"", "arg_6", "=", "(", "arg_3", "+", "arg_4", "+", "arg_5", ")", "/", "2.0", "\"\"\"Return the area of the triangle (using Heron's formula)\"\"\"", "return", "math", ".", "sqrt", "(", "arg_6", "*", "(", "arg_6", "-", "arg_3", ")", "*", "(", "arg_6", "-", "arg_4", ")", "*", "(", "arg_6", "-", "arg_5", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"\n    Uses Heron's formula to find the area of a triangle\n    based on the coordinates of three points.\n\n    Args:\n        point1: list or tuple, the x y coordinate of point one.\n\n        point2: list or tuple, the x y coordinate of point two.\n\n        point3: list or tuple, the x y coordinate of point three.\n\n    Returns:\n        The area of a triangle as a floating point number.\n\n    Requires:\n        The math module, point_distance().\n    \"\"\"\n\n    \"\"\"Lengths of the three sides of the triangle\"\"\"\n    arg_3 = point_distance(arg_0, arg_1)\n    arg_4 = point_distance(arg_0, arg_2)\n    arg_5 = point_distance(arg_1, arg_2)\n\n    \"\"\"Where s is the semiperimeter\"\"\"\n    arg_6 = (arg_3 + arg_4 + arg_5) / 2.0\n\n    \"\"\"Return the area of the triangle (using Heron's formula)\"\"\"\n    return math.sqrt(arg_6 * (arg_6 - arg_3) * (arg_6 - arg_4) * (arg_6 - arg_5))", "path": "simple_math/simple_math.py", "identifier": "triangle_area", "docstring": "Uses Heron's formula to find the area of a triangle\n    based on the coordinates of three points.\n\n    Args:\n        point1: list or tuple, the x y coordinate of point one.\n\n        point2: list or tuple, the x y coordinate of point two.\n\n        point3: list or tuple, the x y coordinate of point three.\n\n    Returns:\n        The area of a triangle as a floating point number.\n\n    Requires:\n        The math module, point_distance().", "docstring_tokens": ["Uses", "Heron", "s", "formula", "to", "find", "the", "area", "of", "a", "triangle", "based", "on", "the", "coordinates", "of", "three", "points", "."], "nwo": "bbusenius/Diablo-Python", "score": 0.24979334806965703, "idx": 261298}
{"url": "https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/util_functions.py#L474-L482", "sha": "a7890ed403da94d03726b0639cd8ebda45af6bbb", "docstring_summary": "Literally encodes the plus sign\n    input is a string\n    returns the string with plus signs encoded", "language": "python", "parameters": "(s)", "return_statement": "return pat.sub(\"%2B\", s)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "r\"\\+\"", "arg_2", "=", "re", ".", "compile", "(", "arg_1", ")", "return", "arg_2", ".", "sub", "(", "\"%2B\"", ",", "arg_0", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Literally encodes the plus sign\n    input is a string\n    returns the string with plus signs encoded\n    \"\"\"\n    arg_1 = r\"\\+\"\n    arg_2 = re.compile(arg_1)\n    return arg_2.sub(\"%2B\", arg_0)", "path": "ease/util_functions.py", "identifier": "encode_plus", "docstring": "Literally encodes the plus sign\n    input is a string\n    returns the string with plus signs encoded", "docstring_tokens": ["Literally", "encodes", "the", "plus", "sign", "input", "is", "a", "string", "returns", "the", "string", "with", "plus", "signs", "encoded"], "nwo": "edx/ease", "score": 0.9062694361919131, "idx": 261299}
{"url": "https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/tasks.py#L49-L61", "sha": "f55b4a2c45d8618737288f1b74b4139d5ac74154", "docstring_summary": "This exposes the celery app. The app is actually created as part\n    of the configuration. However, this does make the celery app functional\n    as a stand-alone celery application.", "language": "python", "parameters": "(config)", "return_statement": "return config.registry.celery_app", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "registry", ".", "celery_app", ".", "conf", "[", "'pyramid_config'", "]", "=", "arg_0", "return", "arg_0", ".", "registry", ".", "celery_app"], "function": "def Func(arg_0):\n    \"\"\"This exposes the celery app. The app is actually created as part\n    of the configuration. However, this does make the celery app functional\n    as a stand-alone celery application.\n\n    This puts the pyramid configuration object on the celery app to be\n    used for making the registry available to tasks running inside the\n    celery worker process pool. See ``CustomTask.__call__``.\n\n    \"\"\"\n    # Tack the pyramid config on the celery app for later use.\n    arg_0.registry.celery_app.conf['pyramid_config'] = arg_0\n    return arg_0.registry.celery_app", "path": "cnxpublishing/tasks.py", "identifier": "_make_celery_app", "docstring": "This exposes the celery app. The app is actually created as part\n    of the configuration. However, this does make the celery app functional\n    as a stand-alone celery application.\n\n    This puts the pyramid configuration object on the celery app to be\n    used for making the registry available to tasks running inside the\n    celery worker process pool. See ``CustomTask.__call__``.", "docstring_tokens": ["This", "exposes", "the", "celery", "app", ".", "The", "app", "is", "actually", "created", "as", "part", "of", "the", "configuration", ".", "However", "this", "does", "make", "the", "celery", "app", "functional", "as", "a", "stand", "-", "alone", "celery", "application", "."], "nwo": "openstax/cnx-publishing", "score": 0.3713261431913858, "idx": 261300}
{"url": "https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/pbp.py#L508-L537", "sha": "09f11ac856a23c96d666d1d510bb35d6f050b5c3", "docstring_summary": "Function that adds 'team' and 'opp' columns to the features by iterating\n    through the rows in order. A precondition is that the features dicts are in\n    order in a continuous game sense and that all rows are from the same game.", "language": "python", "parameters": "(features)", "return_statement": "return features", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "to_dict", "(", "'records'", ")", "arg_1", "=", "arg_4", "=", "None", "arg_2", "=", "False", "for", "arg_3", "in", "arg_0", ":", "if", "arg_3", "[", "'isKickoff'", "]", "or", "arg_2", ":", "arg_1", ",", "arg_4", "=", "_team_and_opp", "(", "arg_3", ")", "else", ":", "arg_1", ",", "arg_4", "=", "_team_and_opp", "(", "arg_3", ",", "arg_1", ",", "arg_4", ")", "arg_3", "[", "'team'", "]", ",", "arg_3", "[", "'opp'", "]", "=", "arg_1", ",", "arg_4", "arg_2", "=", "arg_3", "[", "'isKickoff'", "]", "arg_0", "=", "pd", ".", "DataFrame", "(", "arg_0", ")", "arg_0", ".", "team", ".", "fillna", "(", "method", "=", "'bfill'", ",", "inplace", "=", "True", ")", "arg_0", ".", "opp", ".", "fillna", "(", "method", "=", "'bfill'", ",", "inplace", "=", "True", ")", "arg_0", ".", "team", ".", "fillna", "(", "method", "=", "'ffill'", ",", "inplace", "=", "True", ")", "arg_0", ".", "opp", ".", "fillna", "(", "method", "=", "'ffill'", ",", "inplace", "=", "True", ")", "return", "arg_0"], "function": "def Func(arg_0):\n    \"\"\"Function that adds 'team' and 'opp' columns to the features by iterating\n    through the rows in order. A precondition is that the features dicts are in\n    order in a continuous game sense and that all rows are from the same game.\n\n    :features: A DataFrame with each row representing each play (in order).\n    :returns: A similar DataFrame but with 'team' and 'opp' columns added.\n    \"\"\"\n    arg_0 = arg_0.to_dict('records')\n    arg_1 = arg_4 = None\n    arg_2 = False\n    # fill in team and opp columns\n    for arg_3 in arg_0:\n        # if it's a kickoff or the play after a kickoff,\n        # figure out who has possession manually\n        if arg_3['isKickoff'] or arg_2:\n            arg_1, arg_4 = _team_and_opp(arg_3)\n        else:\n            arg_1, arg_4 = _team_and_opp(arg_3, arg_1, arg_4)\n        arg_3['team'], arg_3['opp'] = arg_1, arg_4\n        # set playAfterKickoff\n        arg_2 = arg_3['isKickoff']\n\n    arg_0 = pd.DataFrame(arg_0)\n    arg_0.team.fillna(method='bfill', inplace=True)\n    arg_0.opp.fillna(method='bfill', inplace=True)\n    # ffill for last row\n    arg_0.team.fillna(method='ffill', inplace=True)\n    arg_0.opp.fillna(method='ffill', inplace=True)\n    return arg_0", "path": "sportsref/nfl/pbp.py", "identifier": "_add_team_columns", "docstring": "Function that adds 'team' and 'opp' columns to the features by iterating\n    through the rows in order. A precondition is that the features dicts are in\n    order in a continuous game sense and that all rows are from the same game.\n\n    :features: A DataFrame with each row representing each play (in order).\n    :returns: A similar DataFrame but with 'team' and 'opp' columns added.", "docstring_tokens": ["Function", "that", "adds", "team", "and", "opp", "columns", "to", "the", "features", "by", "iterating", "through", "the", "rows", "in", "order", ".", "A", "precondition", "is", "that", "the", "features", "dicts", "are", "in", "order", "in", "a", "continuous", "game", "sense", "and", "that", "all", "rows", "are", "from", "the", "same", "game", "."], "nwo": "mdgoldberg/sportsref", "score": 0.18915638823512385, "idx": 261301}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1704-L1723", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Restarts the specified virtual machine.", "language": "python", "parameters": "(self, service_name, deployment_name, role_name)", "return_statement": "return self._perform_post(\n            self._get_role_instance_operations_path(\n                service_name, deployment_name, role_name),\n            _XmlSerializer.restart_role_operation_to_xml(\n            ),\n            as_async=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'deployment_name'", ",", "arg_2", ")", "_validate_not_none", "(", "'role_name'", ",", "arg_3", ")", "return", "arg_0", ".", "_perform_post", "(", "arg_0", ".", "_get_role_instance_operations_path", "(", "arg_1", ",", "arg_2", ",", "arg_3", ")", ",", "_XmlSerializer", ".", "Func_operation_to_xml", "(", ")", ",", "as_async", "=", "True", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''\n        Restarts the specified virtual machine.\n\n        service_name:\n            The name of the service.\n        deployment_name:\n            The name of the deployment.\n        role_name:\n            The name of the role.\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('deployment_name', arg_2)\n        _validate_not_none('role_name', arg_3)\n        return arg_0._perform_post(\n            arg_0._get_role_instance_operations_path(\n                arg_1, arg_2, arg_3),\n            _XmlSerializer.Func_operation_to_xml(\n            ),\n            as_async=True)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.restart_role", "docstring": "Restarts the specified virtual machine.\n\n        service_name:\n            The name of the service.\n        deployment_name:\n            The name of the deployment.\n        role_name:\n            The name of the role.", "docstring_tokens": ["Restarts", "the", "specified", "virtual", "machine", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 261302}
{"url": "https://github.com/tek/amino/blob/51b314933e047a45587a24ecff02c836706d27ff/amino/tc/foldable.py#L64-L70", "sha": "51b314933e047a45587a24ecff02c836706d27ff", "docstring_summary": "map `f` over the traversable, then fold over the result\n        using the supplied initial element `z` and operation `g`,\n        defaulting to addition for the latter.", "language": "python", "parameters": "(self, fa: F[A], z: B, f: Callable[[A], B], g: Callable[[Z, B], Z]=operator.add)", "return_statement": "return self.fold_left(mapped)(z)(g)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", "[", "arg_3", "]", ",", "arg_4", ":", "arg_5", ",", "arg_6", ":", "arg_7", "[", "[", "arg_3", "]", ",", "arg_5", "]", ",", "arg_8", ":", "arg_7", "[", "[", "arg_9", ",", "arg_5", "]", ",", "arg_9", "]", "=", "arg_10", ".", "add", ")", "->", "arg_9", ":", "arg_12", "=", "Functor", ".", "fatal", "(", "type", "(", "arg_1", ")", ")", ".", "map", "(", "arg_1", ",", "arg_6", ")", "return", "arg_0", ".", "fold_left", "(", "arg_12", ")", "(", "arg_4", ")", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1: arg_2[arg_3], arg_4: arg_5, arg_6: arg_7[[arg_3], arg_5], arg_8: arg_7[[arg_9, arg_5], arg_9]=arg_10.add) -> arg_9:\n        ''' map `f` over the traversable, then fold over the result\n        using the supplied initial element `z` and operation `g`,\n        defaulting to addition for the latter.\n        '''\n        arg_12 = Functor.fatal(type(arg_1)).map(arg_1, arg_6)\n        return arg_0.fold_left(arg_12)(arg_4)(arg_8)", "path": "amino/tc/foldable.py", "identifier": "Foldable.fold_map", "docstring": "map `f` over the traversable, then fold over the result\n        using the supplied initial element `z` and operation `g`,\n        defaulting to addition for the latter.", "docstring_tokens": ["map", "f", "over", "the", "traversable", "then", "fold", "over", "the", "result", "using", "the", "supplied", "initial", "element", "z", "and", "operation", "g", "defaulting", "to", "addition", "for", "the", "latter", "."], "nwo": "tek/amino", "score": 0.2827006957945985, "idx": 261303}
{"url": "https://github.com/ixc/django-model-settings/blob/654233bf7f13619e4531741f9158e7034eac031b/model_settings/templatetags/model_settings_tags.py#L33-L41", "sha": "654233bf7f13619e4531741f9158e7034eac031b", "docstring_summary": "Returns a ``SettingDict`` object.", "language": "python", "parameters": "(self, context, default)", "return_statement": "return settings", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "arg_2", "is", "None", ":", "arg_3", "=", "arg_0", ".", "setting_model", ".", "objects", ".", "as_dict", "(", ")", "else", ":", "arg_3", "=", "arg_0", ".", "setting_model", ".", "objects", ".", "as_dict", "(", "arg_2", "=", "arg_2", ")", "return", "arg_3"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Returns a ``SettingDict`` object.\n        \"\"\"\n        if arg_2 is None:\n            arg_3 = arg_0.setting_model.objects.as_dict()\n        else:\n            arg_3 = arg_0.setting_model.objects.as_dict(arg_2=arg_2)\n        return arg_3", "path": "model_settings/templatetags/model_settings_tags.py", "identifier": "GetSettings.get_value", "docstring": "Returns a ``SettingDict`` object.", "docstring_tokens": ["Returns", "a", "SettingDict", "object", "."], "nwo": "ixc/django-model-settings", "score": 0.19017271795726579, "idx": 261304}
{"url": "https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L431-L440", "sha": "51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126", "docstring_summary": "Load lexer with content from `file` which can be a path or a file\n        like object.", "language": "python", "parameters": "(self, file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", ":", "with", "open", "(", "arg_1", ")", "as", "f", ":", "arg_0", ".", "lexer", ".", "Func", "(", "f", ".", "read", "(", ")", ")", "else", ":", "arg_0", ".", "lexer", ".", "Func", "(", "arg_1", ".", "read", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Load lexer with content from `file` which can be a path or a file\n        like object.\n        \"\"\"\n        if isinstance(arg_1, string_types):\n            with open(arg_1) as f:\n                arg_0.lexer.Func(f.read())\n        else:\n            arg_0.lexer.Func(arg_1.read())", "path": "lesscpy/lessc/lexer.py", "identifier": "LessLexer.input", "docstring": "Load lexer with content from `file` which can be a path or a file\n        like object.", "docstring_tokens": ["Load", "lexer", "with", "content", "from", "file", "which", "can", "be", "a", "path", "or", "a", "file", "like", "object", "."], "nwo": "lesscpy/lesscpy", "score": 0.36630042150969844, "idx": 261305}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/circuit/quantumcircuit.py#L725-L728", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Assigns a parameter value to matching instructions in-place.", "language": "python", "parameters": "(self, parameter, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "(", "arg_3", ",", "arg_4", ")", "in", "arg_0", ".", "_parameter_table", "[", "arg_1", "]", ":", "arg_3", ".", "params", "[", "arg_4", "]", "=", "arg_2"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Assigns a parameter value to matching instructions in-place.\"\"\"\n        for (arg_3, arg_4) in arg_0._parameter_table[arg_1]:\n            arg_3.params[arg_4] = arg_2", "path": "qiskit/circuit/quantumcircuit.py", "identifier": "QuantumCircuit._bind_parameter", "docstring": "Assigns a parameter value to matching instructions in-place.", "docstring_tokens": ["Assigns", "a", "parameter", "value", "to", "matching", "instructions", "in", "-", "place", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 261306}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L522-L556", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Check for conflicts and problems in the options.", "language": "python", "parameters": "(self, options, args)", "return_statement": "return True", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "for", "arg_3", "in", "[", "'erase'", ",", "'execute'", "]", ":", "for", "arg_4", "in", "[", "'annotate'", ",", "'html'", ",", "'report'", ",", "'combine'", "]", ":", "if", "(", "arg_3", "in", "arg_1", ".", "actions", ")", "and", "(", "arg_4", "in", "arg_1", ".", "actions", ")", ":", "arg_0", ".", "help_fn", "(", "\"You can't specify the '%s' and '%s' \"", "\"options at the same time.\"", "%", "(", "arg_3", ",", "arg_4", ")", ")", "return", "False", "if", "not", "arg_1", ".", "actions", ":", "arg_0", ".", "help_fn", "(", "\"You must specify at least one of -e, -x, -c, -r, -a, or -b.\"", ")", "return", "False", "arg_5", "=", "(", "'execute'", "in", "arg_1", ".", "actions", "or", "'annotate'", "in", "arg_1", ".", "actions", "or", "'html'", "in", "arg_1", ".", "actions", "or", "'debug'", "in", "arg_1", ".", "actions", "or", "'report'", "in", "arg_1", ".", "actions", "or", "'xml'", "in", "arg_1", ".", "actions", ")", "if", "not", "arg_5", "and", "arg_2", ":", "arg_0", ".", "help_fn", "(", "\"Unexpected arguments: %s\"", "%", "\" \"", ".", "join", "(", "arg_2", ")", ")", "return", "False", "if", "'execute'", "in", "arg_1", ".", "actions", "and", "not", "arg_2", ":", "arg_0", ".", "help_fn", "(", "\"Nothing to do.\"", ")", "return", "False", "return", "True"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Check for conflicts and problems in the options.\n\n        Returns True if everything is ok, or False if not.\n\n        \"\"\"\n        for arg_3 in ['erase', 'execute']:\n            for arg_4 in ['annotate', 'html', 'report', 'combine']:\n                if (arg_3 in arg_1.actions) and (arg_4 in arg_1.actions):\n                    arg_0.help_fn(\"You can't specify the '%s' and '%s' \"\n                              \"options at the same time.\" % (arg_3, arg_4))\n                    return False\n\n        if not arg_1.actions:\n            arg_0.help_fn(\n                \"You must specify at least one of -e, -x, -c, -r, -a, or -b.\"\n                )\n            return False\n        arg_5 = (\n            'execute' in arg_1.actions or\n            'annotate' in arg_1.actions or\n            'html' in arg_1.actions or\n            'debug' in arg_1.actions or\n            'report' in arg_1.actions or\n            'xml' in arg_1.actions\n            )\n        if not arg_5 and arg_2:\n            arg_0.help_fn(\"Unexpected arguments: %s\" % \" \".join(arg_2))\n            return False\n\n        if 'execute' in arg_1.actions and not arg_2:\n            arg_0.help_fn(\"Nothing to do.\")\n            return False\n\n        return True", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py", "identifier": "CoverageScript.args_ok", "docstring": "Check for conflicts and problems in the options.\n\n        Returns True if everything is ok, or False if not.", "docstring_tokens": ["Check", "for", "conflicts", "and", "problems", "in", "the", "options", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 261307}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L349-L373", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Prepare the entity for execution.", "language": "python", "parameters": "(self, clock, period_count)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "period_count", "=", "arg_2", "arg_0", ".", "_exec_year_end_datetime", "=", "arg_1", ".", "get_datetime_at_period_ix", "(", "arg_2", ")", "arg_0", ".", "_prev_year_end_datetime", "=", "arg_1", ".", "start_datetime", "arg_0", ".", "_curr_year_end_datetime", "=", "arg_1", ".", "start_datetime", "+", "relativedelta", "(", "years", "=", "1", ")", "del", "arg_0", ".", "gl", ".", "transactions", "[", ":", "]", "for", "arg_6", "in", "arg_0", ".", "components", ":", "arg_6", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "arg_0", ".", "negative_income_tax_total", "=", "0"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Prepare the entity for execution.\n\n        :param clock: The clock containing the execution start time and\n          execution period information.\n        :param period_count: The total amount of periods this activity will be\n          requested to be run for.\n        \"\"\"\n\n        arg_0.period_count = arg_2\n\n        arg_0._exec_year_end_datetime = arg_1.get_datetime_at_period_ix(\n            arg_2)\n        arg_0._prev_year_end_datetime = arg_1.start_datetime\n        arg_0._curr_year_end_datetime = arg_1.start_datetime + relativedelta(\n            years=1)\n\n        # Remove all the transactions\n        del arg_0.gl.transactions[:]\n\n        for arg_6 in arg_0.components:\n            arg_6.Func(arg_1, arg_2)\n\n        arg_0.negative_income_tax_total = 0", "path": "auxi/modelling/business/structure.py", "identifier": "Entity.prepare_to_run", "docstring": "Prepare the entity for execution.\n\n        :param clock: The clock containing the execution start time and\n          execution period information.\n        :param period_count: The total amount of periods this activity will be\n          requested to be run for.", "docstring_tokens": ["Prepare", "the", "entity", "for", "execution", "."], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 261308}
{"url": "https://github.com/nvdv/vprof/blob/4c3ff78f8920ab10cb9c00b14143452aa09ff6bb/vprof/base_profiler.py#L125-L130", "sha": "4c3ff78f8920ab10cb9c00b14143452aa09ff6bb", "docstring_summary": "Initializes profiler with a package.", "language": "python", "parameters": "(self, run_object)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "profile", "=", "arg_0", ".", "profile_package", "arg_0", ".", "_run_object", ",", "arg_4", ",", "arg_0", ".", "_run_args", "=", "arg_1", ".", "partition", "(", "' '", ")", "arg_0", ".", "_object_name", "=", "'%s (package)'", "%", "arg_0", ".", "_run_object", "arg_0", ".", "_replace_sysargs", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Initializes profiler with a package.\"\"\"\n        arg_0.profile = arg_0.profile_package\n        arg_0._run_object, arg_4, arg_0._run_args = arg_1.partition(' ')\n        arg_0._object_name = '%s (package)' % arg_0._run_object\n        arg_0._replace_sysargs()", "path": "vprof/base_profiler.py", "identifier": "BaseProfiler.init_package", "docstring": "Initializes profiler with a package.", "docstring_tokens": ["Initializes", "profiler", "with", "a", "package", "."], "nwo": "nvdv/vprof", "score": 0.7654797592775568, "idx": 261309}
{"url": "https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3545-L3554", "sha": "54c5a15b1119c523ae54c09972413e8b97f11629", "docstring_summary": "Loops if ECX counter is nonzero.", "language": "python", "parameters": "(cpu, target)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "{", "16", ":", "'CX'", ",", "32", ":", "'ECX'", ",", "64", ":", "'RCX'", "}", "[", "arg_0", ".", "address_bit_size", "]", "arg_3", "=", "arg_0", ".", "write_register", "(", "arg_2", ",", "arg_0", ".", "read_register", "(", "arg_2", ")", "-", "1", ")", "arg_0", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "arg_0", ".", "address_bit_size", ",", "arg_3", "!=", "0", ",", "(", "arg_0", ".", "PC", "+", "arg_1", ".", "read", "(", ")", ")", "&", "(", "(", "1", "<<", "arg_1", ".", "size", ")", "-", "1", ")", ",", "arg_0", ".", "PC", "+", "arg_0", ".", "instruction", ".", "size", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Loops if ECX counter is nonzero.\n\n        :param cpu: current CPU.\n        :param target: destination operand.\n        \"\"\"\n        arg_2 = {16: 'CX', 32: 'ECX', 64: 'RCX'}[arg_0.address_bit_size]\n        arg_3 = arg_0.write_register(arg_2, arg_0.read_register(arg_2) - 1)\n        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, arg_3 != 0, (arg_0.PC + arg_1.read()) & ((1 << arg_1.size) - 1), arg_0.PC + arg_0.instruction.size)", "path": "manticore/native/cpu/x86.py", "identifier": "X86Cpu.LOOPNZ", "docstring": "Loops if ECX counter is nonzero.\n\n        :param cpu: current CPU.\n        :param target: destination operand.", "docstring_tokens": ["Loops", "if", "ECX", "counter", "is", "nonzero", "."], "nwo": "trailofbits/manticore", "score": 0.9483643694003796, "idx": 261310}
{"url": "https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/webexteamssdk/api/webhooks.py#L187-L223", "sha": "6fc2cc3557e080ba4b2a380664cb2a0532ae45cd", "docstring_summary": "Update a webhook, by ID.", "language": "python", "parameters": "(self, webhookId, name=None, targetUrl=None,\n               **request_parameters)", "return_statement": "return self._object_factory(OBJECT_TYPE, json_data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "**", "arg_4", ")", ":", "check_type", "(", "arg_1", ",", "basestring", ",", "may_be_none", "=", "False", ")", "check_type", "(", "arg_2", ",", "basestring", ")", "check_type", "(", "arg_3", ",", "basestring", ")", "arg_5", "=", "dict_from_items_with_values", "(", "arg_4", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", ")", "arg_6", "=", "arg_0", ".", "_session", ".", "put", "(", "API_ENDPOINT", "+", "'/'", "+", "arg_1", ",", "json", "=", "arg_5", ")", "return", "arg_0", ".", "_object_factory", "(", "OBJECT_TYPE", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n               **arg_4):\n        \"\"\"Update a webhook, by ID.\n\n        Args:\n            webhookId(basestring): The webhook ID.\n            name(basestring): A user-friendly name for this webhook.\n            targetUrl(basestring): The URL that receives POST requests for\n                each event.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Webhook: A Webhook object with the Funcd Webex Teams webhook\n                details.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.\n\n        \"\"\"\n        check_type(arg_1, basestring, may_be_none=False)\n        check_type(arg_2, basestring)\n        check_type(arg_3, basestring)\n\n        arg_5 = dict_from_items_with_values(\n            arg_4,\n            arg_2=arg_2,\n            arg_3=arg_3,\n        )\n\n        # API request\n        arg_6 = arg_0._session.put(API_ENDPOINT + '/' + arg_1,\n                                      json=arg_5)\n\n        # Return a webhook object created from the response JSON data\n        return arg_0._object_factory(OBJECT_TYPE, arg_6)", "path": "webexteamssdk/api/webhooks.py", "identifier": "WebhooksAPI.update", "docstring": "Update a webhook, by ID.\n\n        Args:\n            webhookId(basestring): The webhook ID.\n            name(basestring): A user-friendly name for this webhook.\n            targetUrl(basestring): The URL that receives POST requests for\n                each event.\n            **request_parameters: Additional request parameters (provides\n                support for parameters that may be added in the future).\n\n        Returns:\n            Webhook: A Webhook object with the updated Webex Teams webhook\n                details.\n\n        Raises:\n            TypeError: If the parameter types are incorrect.\n            ApiError: If the Webex Teams cloud returns an error.", "docstring_tokens": ["Update", "a", "webhook", "by", "ID", "."], "nwo": "CiscoDevNet/webexteamssdk", "score": 0.65331156387872, "idx": 261311}
{"url": "https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L2147-L2183", "sha": "8033b673a151f96c29802b43763e863519a3124c", "docstring_summary": "Crop to a new depth range.", "language": "python", "parameters": "(self, extent, copy=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "False", ")", ":", "try", ":", "if", "arg_1", "[", "0", "]", "is", "None", ":", "arg_1", "=", "(", "arg_0", ".", "start", ".", "z", ",", "arg_1", "[", "1", "]", ")", "if", "arg_1", "[", "1", "]", "is", "None", ":", "arg_1", "=", "(", "arg_1", "[", "0", "]", ",", "arg_0", ".", "stop", ".", "z", ")", "except", ":", "arg_3", "=", "\"You must provide a 2-tuple for the new extents. Use None for\"", "arg_3", "+=", "\" the existing start or stop.\"", "raise", "StriplogError", "(", "arg_3", ")", "arg_4", "=", "arg_0", ".", "read_at", "(", "arg_1", "[", "0", "]", ",", "index", "=", "True", ")", "arg_5", "=", "arg_0", ".", "read_at", "(", "arg_1", "[", "1", "]", ",", "index", "=", "True", ")", "arg_6", "=", "arg_0", "[", "arg_4", "]", ".", "split_at", "(", "arg_1", "[", "0", "]", ")", "[", "1", "]", "arg_7", "=", "arg_0", "[", "arg_5", "]", ".", "split_at", "(", "arg_1", "[", "1", "]", ")", "[", "0", "]", "arg_8", "=", "arg_0", ".", "__list", "[", "arg_4", ":", "arg_5", "+", "1", "]", ".", "copy", "(", ")", "arg_8", "[", "0", "]", "=", "arg_6", "arg_8", "[", "-", "1", "]", "=", "arg_7", "if", "arg_2", ":", "return", "Striplog", "(", "arg_8", ")", "else", ":", "arg_0", ".", "__list", "=", "arg_8", "return"], "function": "def Func(arg_0, arg_1, arg_2=False):\n        \"\"\"\n        Crop to a new depth range.\n\n        Args:\n            extent (tuple): The new start and stop depth. Must be 'inside'\n                existing striplog.\n            copy (bool): Whether to operate in place or make a copy.\n\n        Returns:\n            Operates in place by deault; if copy is True, returns a striplog.\n        \"\"\"\n        try:\n            if arg_1[0] is None:\n                arg_1 = (arg_0.start.z, arg_1[1])\n            if arg_1[1] is None:\n                arg_1 = (arg_1[0], arg_0.stop.z)\n        except:\n            arg_3 = \"You must provide a 2-tuple for the new extents. Use None for\"\n            arg_3 += \" the existing start or stop.\"\n            raise StriplogError(arg_3)\n\n        arg_4 = arg_0.read_at(arg_1[0], index=True)\n        arg_5 = arg_0.read_at(arg_1[1], index=True)\n\n        arg_6 = arg_0[arg_4].split_at(arg_1[0])[1]\n        arg_7 = arg_0[arg_5].split_at(arg_1[1])[0]\n\n        arg_8 = arg_0.__list[arg_4:arg_5+1].copy()\n        arg_8[0] = arg_6\n        arg_8[-1] = arg_7\n\n        if arg_2:\n            return Striplog(arg_8)\n        else:\n            arg_0.__list = arg_8\n            return", "path": "striplog/striplog.py", "identifier": "Striplog.crop", "docstring": "Crop to a new depth range.\n\n        Args:\n            extent (tuple): The new start and stop depth. Must be 'inside'\n                existing striplog.\n            copy (bool): Whether to operate in place or make a copy.\n\n        Returns:\n            Operates in place by deault; if copy is True, returns a striplog.", "docstring_tokens": ["Crop", "to", "a", "new", "depth", "range", "."], "nwo": "agile-geoscience/striplog", "score": 0.7068418776760582, "idx": 261312}
{"url": "https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/combo_box.py#L179-L219", "sha": "3f46f6feb4504315eec07abb18bb41be4d257aeb", "docstring_summary": "Get all combo box item", "language": "python", "parameters": "(self, window_name, object_name)", "return_statement": "return items", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "_get_object_handle", "(", "arg_1", ",", "arg_2", ")", "if", "not", "arg_3", ".", "AXEnabled", ":", "raise", "LdtpServerException", "(", "u\"Object %s state disabled\"", "%", "arg_2", ")", "arg_3", ".", "Press", "(", ")", "arg_0", ".", "wait", "(", "1", ")", "arg_4", "=", "None", "try", ":", "if", "not", "arg_3", ".", "AXChildren", ":", "raise", "LdtpServerException", "(", "u\"Unable to find menu\"", ")", "arg_5", "=", "arg_3", ".", "AXChildren", "[", "0", "]", "if", "not", "arg_5", ":", "raise", "LdtpServerException", "(", "u\"Unable to find menu\"", ")", "arg_5", "=", "arg_5", ".", "AXChildren", "arg_6", "=", "[", "]", "for", "arg_4", "in", "arg_5", ":", "arg_7", "=", "arg_0", ".", "_get_title", "(", "arg_4", ")", "if", "arg_7", ":", "arg_6", ".", "append", "(", "arg_7", ")", "finally", ":", "if", "arg_4", ":", "arg_4", ".", "Cancel", "(", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Get all combo box item\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob. \n        @type object_name: string\n\n        @return: list of string on success.\n        @rtype: list\n        \"\"\"\n        arg_3 = arg_0._get_object_handle(arg_1, arg_2)\n        if not arg_3.AXEnabled:\n            raise LdtpServerException(u\"Object %s state disabled\" % arg_2)\n        arg_3.Press()\n        # Required for menuitem to appear in accessibility list\n        arg_0.wait(1)\n        arg_4 = None\n        try:\n            if not arg_3.AXChildren:\n                raise LdtpServerException(u\"Unable to find menu\")\n            # Get AXMenu\n            arg_5 = arg_3.AXChildren[0]\n            if not arg_5:\n                raise LdtpServerException(u\"Unable to find menu\")\n            arg_5 = arg_5.AXChildren\n            arg_6 = []\n            for arg_4 in arg_5:\n                arg_7 = arg_0._get_title(arg_4)\n                # Don't add empty label\n                # Menu separator have empty label's\n                if arg_7:\n                    arg_6.append(arg_7)\n        finally:\n            if arg_4:\n                # Set it back, by clicking combo box\n                arg_4.Cancel()\n        return arg_6", "path": "atomac/ldtpd/combo_box.py", "identifier": "ComboBox.getallitem", "docstring": "Get all combo box item\n\n        @param window_name: Window name to type in, either full name,\n        LDTP's name convention, or a Unix glob.\n        @type window_name: string\n        @param object_name: Object name to type in, either full name,\n        LDTP's name convention, or a Unix glob. \n        @type object_name: string\n\n        @return: list of string on success.\n        @rtype: list", "docstring_tokens": ["Get", "all", "combo", "box", "item"], "nwo": "alex-kostirin/pyatomac", "score": 0.2787265416094946, "idx": 261313}
{"url": "https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L52-L60", "sha": "abc96140a1d15b5e96d83432e1e0e1f4f8f36331", "docstring_summary": "since the user needs a job id and other parameters, save this\n           for them.", "language": "python", "parameters": "(self)", "return_statement": "return metadata", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "{", "'SREGISTRY_GITLAB_FOLDER'", ":", "arg_0", ".", "artifacts", ",", "'api_base'", ":", "arg_0", ".", "api_base", ",", "'SREGISTRY_GITLAB_BASE'", ":", "arg_0", ".", "base", ",", "'SREGISTRY_GITLAB_JOB'", ":", "arg_0", ".", "job", "}", "return", "arg_1"], "function": "def Func(arg_0):\n        '''since the user needs a job id and other parameters, save this\n           for them.\n        '''\n        arg_1 = {'SREGISTRY_GITLAB_FOLDER': arg_0.artifacts,\n                    'api_base': arg_0.api_base,\n                    'SREGISTRY_GITLAB_BASE': arg_0.base,\n                    'SREGISTRY_GITLAB_JOB': arg_0.job }\n        return arg_1", "path": "sregistry/main/gitlab/__init__.py", "identifier": "Client._get_metadata", "docstring": "since the user needs a job id and other parameters, save this\n           for them.", "docstring_tokens": ["since", "the", "user", "needs", "a", "job", "id", "and", "other", "parameters", "save", "this", "for", "them", "."], "nwo": "singularityhub/sregistry-cli", "score": 0.5194483352233341, "idx": 261314}
{"url": "https://github.com/uploadcare/pyuploadcare/blob/cefddc0306133a71e37b18e8700df5948ef49b37/pyuploadcare/api_resources.py#L394-L434", "sha": "cefddc0306133a71e37b18e8700df5948ef49b37", "docstring_summary": "Uploads file from given url and returns ``FileFromUrl`` instance.", "language": "python", "parameters": "(cls, url, store=None, filename=None)", "return_statement": "return file_from_url", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ")", ":", "if", "arg_2", "is", "None", ":", "arg_2", "=", "'auto'", "elif", "arg_2", ":", "arg_2", "=", "'1'", "else", ":", "arg_2", "=", "'0'", "arg_4", "=", "{", "'source_url'", ":", "arg_1", ",", "'store'", ":", "arg_2", ",", "}", "if", "arg_3", ":", "arg_4", "[", "'filename'", "]", "=", "arg_3", "arg_5", "=", "uploading_request", "(", "'POST'", ",", "'from_url/'", ",", "arg_4", "=", "arg_4", ")", "if", "'token'", "not", "in", "arg_5", ":", "raise", "APIError", "(", "'could not find token in result: {0}'", ".", "format", "(", "arg_5", ")", ")", "arg_6", "=", "arg_0", ".", "FileFromUrl", "(", "arg_5", "[", "'token'", "]", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None):\n        \"\"\"Uploads file from given url and returns ``FileFromUrl`` instance.\n\n        Args:\n            - url (str): URL of file to upload to\n            - store (Optional[bool]): Should the file be automatically stored\n                upon upload. Defaults to None.\n                - False - do not store file\n                - True - store file (can result in error if autostore\n                               is disabled for project)\n                - None - use project settings\n            - filename (Optional[str]): Name of the uploaded file. If this not\n                specified the filename will be obtained from response headers\n                or source URL. Defaults to None.\n\n        Returns:\n            ``FileFromUrl`` instance\n\n        \"\"\"\n        if arg_2 is None:\n            arg_2 = 'auto'\n        elif arg_2:\n            arg_2 = '1'\n        else:\n            arg_2 = '0'\n\n        arg_4 = {\n            'source_url': arg_1,\n            'store': arg_2,\n        }\n        if arg_3:\n            arg_4['filename'] = arg_3\n\n        arg_5 = uploading_request('POST', 'from_url/',\n                                   arg_4=arg_4)\n        if 'token' not in arg_5:\n            raise APIError(\n                'could not find token in result: {0}'.format(arg_5)\n            )\n        arg_6 = arg_0.FileFromUrl(arg_5['token'])\n        return arg_6", "path": "pyuploadcare/api_resources.py", "identifier": "File.upload_from_url", "docstring": "Uploads file from given url and returns ``FileFromUrl`` instance.\n\n        Args:\n            - url (str): URL of file to upload to\n            - store (Optional[bool]): Should the file be automatically stored\n                upon upload. Defaults to None.\n                - False - do not store file\n                - True - store file (can result in error if autostore\n                               is disabled for project)\n                - None - use project settings\n            - filename (Optional[str]): Name of the uploaded file. If this not\n                specified the filename will be obtained from response headers\n                or source URL. Defaults to None.\n\n        Returns:\n            ``FileFromUrl`` instance", "docstring_tokens": ["Uploads", "file", "from", "given", "url", "and", "returns", "FileFromUrl", "instance", "."], "nwo": "uploadcare/pyuploadcare", "score": 0.289876796890331, "idx": 261315}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/loader.py#L648-L672", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "self.parsed_data->self.config, parse unrecognized extra args via KVLoader.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'_flags'", "in", "arg_0", ".", "parsed_data", ":", "arg_1", "=", "arg_0", ".", "parsed_data", ".", "_flags", "del", "arg_0", ".", "parsed_data", ".", "_flags", "else", ":", "arg_1", "=", "[", "]", "for", "arg_2", ",", "arg_3", "in", "vars", "(", "arg_0", ".", "parsed_data", ")", ".", "iteritems", "(", ")", ":", "if", "arg_3", "is", "None", ":", "arg_1", ".", "append", "(", "arg_0", ".", "alias_flags", "[", "arg_2", "]", ")", "else", ":", "arg_0", ".", "_exec_config_str", "(", "arg_2", ",", "arg_3", ")", "for", "arg_4", "in", "arg_1", ":", "arg_0", ".", "_load_flag", "(", "arg_4", ")", "if", "arg_0", ".", "extra_args", ":", "arg_5", "=", "KeyValueConfigLoader", "(", ")", "arg_5", ".", "load_config", "(", "arg_0", ".", "extra_args", ")", "arg_0", ".", "config", ".", "_merge", "(", "arg_5", ".", "config", ")", "arg_0", ".", "extra_args", "=", "arg_5", ".", "extra_args"], "function": "def Func(arg_0):\n        \"\"\"self.parsed_data->self.config, parse unrecognized extra args via KVLoader.\"\"\"\n        # remove subconfigs list from namespace before transforming the Namespace\n        if '_flags' in arg_0.parsed_data:\n            arg_1 = arg_0.parsed_data._flags\n            del arg_0.parsed_data._flags\n        else:\n            arg_1 = []\n\n        for arg_2, arg_3 in vars(arg_0.parsed_data).iteritems():\n            if arg_3 is None:\n                # it was a flag that shares the name of an alias\n                arg_1.append(arg_0.alias_flags[arg_2])\n            else:\n                # eval the KV assignment\n                arg_0._exec_config_str(arg_2, arg_3)\n\n        for arg_4 in arg_1:\n            arg_0._load_flag(arg_4)\n\n        if arg_0.extra_args:\n            arg_5 = KeyValueConfigLoader()\n            arg_5.load_config(arg_0.extra_args)\n            arg_0.config._merge(arg_5.config)\n            arg_0.extra_args = arg_5.extra_args", "path": "environment/lib/python2.7/site-packages/IPython/config/loader.py", "identifier": "KVArgParseConfigLoader._convert_to_config", "docstring": "self.parsed_data->self.config, parse unrecognized extra args via KVLoader.", "docstring_tokens": ["self", ".", "parsed_data", "-", ">", "self", ".", "config", "parse", "unrecognized", "extra", "args", "via", "KVLoader", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261316}
{"url": "https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/optparse.py#L261-L271", "sha": "3ec87959189cfcdeae82eb68a47648ac25ceb10b", "docstring_summary": "Format a paragraph of free-form text for inclusion in the\n        help output at the current indentation level.", "language": "python", "parameters": "(self, text)", "return_statement": "return textwrap.fill(text,\n                             text_width,\n                             initial_indent=indent,\n                             subsequent_indent=indent)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "max", "(", "arg_0", ".", "width", "-", "arg_0", ".", "current_indent", ",", "11", ")", "arg_3", "=", "\" \"", "*", "arg_0", ".", "current_indent", "return", "textwrap", ".", "fill", "(", "arg_1", ",", "arg_2", ",", "initial_indent", "=", "arg_3", ",", "subsequent_indent", "=", "arg_3", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Format a paragraph of free-form text for inclusion in the\n        help output at the current indentation level.\n        \"\"\"\n        arg_2 = max(arg_0.width - arg_0.current_indent, 11)\n        arg_3 = \" \"*arg_0.current_indent\n        return textwrap.fill(arg_1,\n                             arg_2,\n                             initial_indent=arg_3,\n                             subsequent_indent=arg_3)", "path": "third_party/stdlib/optparse.py", "identifier": "HelpFormatter._format_text", "docstring": "Format a paragraph of free-form text for inclusion in the\n        help output at the current indentation level.", "docstring_tokens": ["Format", "a", "paragraph", "of", "free", "-", "form", "text", "for", "inclusion", "in", "the", "help", "output", "at", "the", "current", "indentation", "level", "."], "nwo": "google/grumpy", "score": 0.9826819915211343, "idx": 261317}
{"url": "https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L197-L225", "sha": "92bd3b02954422665260116adda8eb899546c365", "docstring_summary": "Actual method to read celery settings from app configuration and initialize the celery instance.", "language": "python", "parameters": "(self, app)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", ".", "_register_app", "=", "arg_0", ".", "original_register_app", "if", "not", "hasattr", "(", "arg_1", ",", "'extensions'", ")", ":", "arg_1", ".", "extensions", "=", "dict", "(", ")", "if", "'celery'", "in", "arg_1", ".", "extensions", ":", "raise", "ValueError", "(", "'Already registered extension CELERY.'", ")", "arg_1", ".", "extensions", "[", "'celery'", "]", "=", "_CeleryState", "(", "arg_0", ",", "arg_1", ")", "super", "(", "Celery", ",", "arg_0", ")", ".", "__init__", "(", "arg_1", ".", "import_name", ",", "broker", "=", "arg_1", ".", "config", "[", "'CELERY_BROKER_URL'", "]", ")", "if", "'CELERY_RESULT_BACKEND'", "in", "arg_1", ".", "config", ":", "arg_0", ".", "_preconf", "[", "'CELERY_RESULT_BACKEND'", "]", "=", "arg_1", ".", "config", "[", "'CELERY_RESULT_BACKEND'", "]", "arg_0", ".", "conf", ".", "update", "(", "arg_1", ".", "config", ")", "arg_6", "=", "arg_0", ".", "Task", "class", "ContextTask", "(", "arg_6", ")", ":", "def", "__call__", "(", "arg_0", ",", "*", "arg_7", ",", "**", "arg_8", ")", ":", "with", "arg_1", ".", "app_context", "(", ")", ":", "return", "arg_6", ".", "__call__", "(", "arg_0", ",", "*", "arg_7", ",", "**", "arg_8", ")", "setattr", "(", "ContextTask", ",", "'abstract'", ",", "True", ")", "setattr", "(", "arg_0", ",", "'Task'", ",", "ContextTask", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Actual method to read celery settings from app configuration and initialize the celery instance.\n\n        :param app: Flask application instance.\n        \"\"\"\n        arg_2._register_app = arg_0.original_register_app  # Restore Celery app registration function.\n        if not hasattr(arg_1, 'extensions'):\n            arg_1.extensions = dict()\n        if 'celery' in arg_1.extensions:\n            raise ValueError('Already registered extension CELERY.')\n        arg_1.extensions['celery'] = _CeleryState(arg_0, arg_1)\n\n        # Instantiate celery and read config.\n        super(Celery, arg_0).__init__(arg_1.import_name, broker=arg_1.config['CELERY_BROKER_URL'])\n\n        # Set result backend default.\n        if 'CELERY_RESULT_BACKEND' in arg_1.config:\n            arg_0._preconf['CELERY_RESULT_BACKEND'] = arg_1.config['CELERY_RESULT_BACKEND']\n\n        arg_0.conf.update(arg_1.config)\n        arg_6 = arg_0.Task\n\n        # Add Flask app context to celery instance.\n        class ContextTask(arg_6):\n            def __call__(arg_0, *arg_7, **arg_8):\n                with arg_1.app_context():\n                    return arg_6.__call__(arg_0, *arg_7, **arg_8)\n        setattr(ContextTask, 'abstract', True)\n        setattr(arg_0, 'Task', ContextTask)", "path": "flask_celery.py", "identifier": "Celery.init_app", "docstring": "Actual method to read celery settings from app configuration and initialize the celery instance.\n\n        :param app: Flask application instance.", "docstring_tokens": ["Actual", "method", "to", "read", "celery", "settings", "from", "app", "configuration", "and", "initialize", "the", "celery", "instance", "."], "nwo": "Robpol86/Flask-Celery-Helper", "score": 0.5367470188175552, "idx": 261318}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/chemical.py#L603-L632", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "r'''Interface for drawing a 2D image of the molecule.\n        Requires an HTML5 browser, and the libraries RDKit and\n        IPython. An exception is raised if either of these libraries is\n        absent.", "language": "python", "parameters": "(self, width=300, height=300, Hs=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "300", ",", "arg_2", "=", "300", ",", "arg_3", "=", "False", ")", ":", "try", ":", "from", "rdkit", ".", "Chem", "import", "Draw", "from", "rdkit", ".", "Chem", ".", "Draw", "import", "IPythonConsole", "if", "arg_3", ":", "arg_4", "=", "arg_0", ".", "rdkitmol_Hs", "else", ":", "arg_4", "=", "arg_0", ".", "rdkitmol", "return", "Draw", ".", "MolToImage", "(", "arg_4", ",", "size", "=", "(", "arg_1", ",", "arg_2", ")", ")", "except", ":", "return", "'Rdkit is required for this feature.'"], "function": "def Func(arg_0, arg_1=300, arg_2=300, arg_3=False): # pragma: no cover\n        r'''Interface for drawing a 2D image of the molecule.\n        Requires an HTML5 browser, and the libraries RDKit and\n        IPython. An exception is raised if either of these libraries is\n        absent.\n\n        Parameters\n        ----------\n        width : int\n            Number of pixels wide for the view\n        height : int\n            Number of pixels tall for the view\n        Hs : bool\n            Whether or not to show hydrogen\n\n        Examples\n        --------\n        >>> Chemical('decane').Func() # doctest: +ELLIPSIS\n        <PIL.Image.Image image mode=RGBA size=300x300 at 0x...>\n        '''\n        try:\n            from rdkit.Chem import Draw\n            from rdkit.Chem.Draw import IPythonConsole\n            if arg_3:\n                arg_4 = arg_0.rdkitmol_Hs\n            else:\n                arg_4 = arg_0.rdkitmol\n            return Draw.MolToImage(arg_4, size=(arg_1, arg_2))\n        except:\n            return 'Rdkit is required for this feature.'", "path": "thermo/chemical.py", "identifier": "Chemical.draw_2d", "docstring": "r'''Interface for drawing a 2D image of the molecule.\n        Requires an HTML5 browser, and the libraries RDKit and\n        IPython. An exception is raised if either of these libraries is\n        absent.\n\n        Parameters\n        ----------\n        width : int\n            Number of pixels wide for the view\n        height : int\n            Number of pixels tall for the view\n        Hs : bool\n            Whether or not to show hydrogen\n\n        Examples\n        --------\n        >>> Chemical('decane').draw_2d() # doctest: +ELLIPSIS\n        <PIL.Image.Image image mode=RGBA size=300x300 at 0x...>", "docstring_tokens": ["r", "Interface", "for", "drawing", "a", "2D", "image", "of", "the", "molecule", ".", "Requires", "an", "HTML5", "browser", "and", "the", "libraries", "RDKit", "and", "IPython", ".", "An", "exception", "is", "raised", "if", "either", "of", "these", "libraries", "is", "absent", "."], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 261319}
{"url": "https://github.com/amyth/django-instapush/blob/f8643a2e342fc73a16c95dff79c3daac8ce4b034/instapush/libs/gcm.py#L83-L118", "sha": "f8643a2e342fc73a16c95dff79c3daac8ce4b034", "docstring_summary": "Sends a json GCM message", "language": "python", "parameters": "(self, ids=None)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "arg_1", "or", "arg_0", ".", "_registration_id", "arg_3", "=", "{", "\"registration_ids\"", ":", "arg_2", "}", "if", "arg_0", ".", "_data", "is", "not", "None", ":", "arg_3", "[", "\"data\"", "]", "=", "arg_0", ".", "_data", "for", "arg_4", ",", "arg_5", "in", "arg_0", ".", "_kwargs", ".", "items", "(", ")", ":", "if", "arg_5", ":", "arg_3", "[", "arg_4", "]", "=", "arg_5", "arg_6", "=", "json", ".", "dumps", "(", "arg_3", ",", "separators", "=", "(", "\",\"", ",", "\":\"", ")", ",", "sort_keys", "=", "True", ")", ".", "encode", "(", "arg_0", ".", "encoding", ")", "arg_7", "=", "json", ".", "loads", "(", "arg_0", ".", "_send", "(", "arg_6", ",", "\"application/json\"", ")", ")", "if", "(", "\"failure\"", "in", "arg_7", ")", "and", "(", "arg_7", "[", "\"failure\"", "]", ")", ":", "arg_8", "=", "[", "]", "arg_9", "=", "False", "for", "arg_10", ",", "arg_11", "in", "enumerate", "(", "arg_7", ".", "get", "(", "\"results\"", ",", "[", "]", ")", ")", ":", "arg_11", "=", "arg_11", ".", "get", "(", "\"error\"", ",", "\"\"", ")", "if", "arg_11", "in", "(", "\"NotRegistered\"", ",", "\"InvalidRegistration\"", ")", ":", "arg_8", ".", "append", "(", "arg_2", "[", "arg_10", "]", ")", "elif", "arg_11", "!=", "\"\"", ":", "arg_9", "=", "True", "arg_0", ".", "deactivate_unregistered_devices", "(", "arg_8", ")", "if", "arg_9", ":", "raise", "GCMPushError", "(", "arg_7", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Sends a json GCM message\n        \"\"\"\n\n        arg_2 = arg_1 or arg_0._registration_id\n        arg_3 = {\"registration_ids\": arg_2}\n\n        if arg_0._data is not None:\n            arg_3[\"data\"] = arg_0._data\n\n        for arg_4, arg_5 in arg_0._kwargs.items():\n            if arg_5:\n                arg_3[arg_4] = arg_5\n\n        arg_6 = json.dumps(arg_3, separators=(\",\", \":\"), sort_keys=True).encode(\n                arg_0.encoding)\n\n        arg_7 = json.loads(arg_0._send(arg_6, \"application/json\"))\n\n        if (\"failure\" in arg_7) and (arg_7[\"failure\"]):\n            arg_8 = []\n            arg_9 = False\n\n            for arg_10, arg_11 in enumerate(arg_7.get(\"results\", [])):\n                arg_11 = arg_11.get(\"error\", \"\")\n                if arg_11 in (\"NotRegistered\", \"InvalidRegistration\"):\n                    arg_8.append(arg_2[arg_10])\n                elif arg_11 != \"\":\n                    arg_9 = True\n\n            arg_0.deactivate_unregistered_devices(arg_8)\n            if arg_9:\n                raise GCMPushError(arg_7)\n\n        return arg_7", "path": "instapush/libs/gcm.py", "identifier": "GCMMessenger.send_json", "docstring": "Sends a json GCM message", "docstring_tokens": ["Sends", "a", "json", "GCM", "message"], "nwo": "amyth/django-instapush", "score": 0.194552411663553, "idx": 261320}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/mailchimpclient.py#L101-L134", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Handle authenticated POST requests", "language": "python", "parameters": "(self, url, data=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ")", ":", "arg_1", "=", "urljoin", "(", "arg_0", ".", "base_url", ",", "arg_1", ")", "try", ":", "arg_3", "=", "arg_0", ".", "_make_request", "(", "**", "dict", "(", "method", "=", "'POST'", ",", "arg_1", "=", "arg_1", ",", "json", "=", "arg_2", ",", "auth", "=", "arg_0", ".", "auth", ",", "timeout", "=", "arg_0", ".", "timeout", ",", "hooks", "=", "arg_0", ".", "request_hooks", ",", "headers", "=", "arg_0", ".", "request_headers", ")", ")", "except", "requests", ".", "exceptions", ".", "RequestException", "as", "e", ":", "raise", "e", "else", ":", "if", "arg_3", ".", "status_code", ">=", "400", ":", "try", ":", "arg_4", "=", "arg_3", ".", "json", "(", ")", "except", "ValueError", ":", "arg_4", "=", "{", "\"response\"", ":", "arg_3", "}", "raise", "MailChimpError", "(", "arg_4", ")", "if", "arg_3", ".", "status_code", "==", "204", ":", "return", "None", "return", "arg_3", ".", "json", "(", ")"], "function": "def Func(arg_0, arg_1, arg_2=None):\n        \"\"\"\n        Handle authenticated POST requests\n\n        :param url: The url for the endpoint including path parameters\n        :type url: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:data:`none` or :py:class:`dict`\n        :returns: The JSON output from the API or an error message\n        \"\"\"\n        arg_1 = urljoin(arg_0.base_url, arg_1)\n        try:\n            arg_3 = arg_0._make_request(**dict(\n                method='POST',\n                arg_1=arg_1,\n                json=arg_2,\n                auth=arg_0.auth,\n                timeout=arg_0.timeout,\n                hooks=arg_0.request_hooks,\n                headers=arg_0.request_headers\n            ))\n        except requests.exceptions.RequestException as e:\n            raise e\n        else:\n            if arg_3.status_code >= 400:\n                # in case of a 500 error, the response might not be a JSON\n                try:\n                    arg_4 = arg_3.json()\n                except ValueError:\n                    arg_4 = { \"response\": arg_3 }\n                raise MailChimpError(arg_4)\n            if arg_3.status_code == 204:\n                return None\n            return arg_3.json()", "path": "mailchimp3/mailchimpclient.py", "identifier": "MailChimpClient._post", "docstring": "Handle authenticated POST requests\n\n        :param url: The url for the endpoint including path parameters\n        :type url: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:data:`none` or :py:class:`dict`\n        :returns: The JSON output from the API or an error message", "docstring_tokens": ["Handle", "authenticated", "POST", "requests"], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 261321}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/hmc.py#L516-L554", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Runs one iteration of Hamiltonian Monte Carlo.", "language": "python", "parameters": "(self, current_state, previous_kernel_results)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "(", "[", "]", "if", "arg_0", ".", "step_size_update_fn", "is", "None", "else", "(", "arg_2", ".", "extra", ".", "step_size_assign", "if", "mcmc_util", ".", "is_list_like", "(", "arg_2", ".", "extra", ".", "step_size_assign", ")", "else", "[", "arg_2", ".", "extra", ".", "step_size_assign", "]", ")", ")", "with", "tf", ".", "control_dependencies", "(", "arg_3", ")", ":", "arg_4", ",", "arg_5", "=", "arg_0", ".", "_impl", ".", "Func", "(", "arg_1", ",", "arg_2", ")", "if", "arg_0", ".", "step_size_update_fn", "is", "not", "None", ":", "arg_6", "=", "arg_0", ".", "step_size_update_fn", "(", "arg_0", ".", "step_size", ",", "arg_5", ")", "arg_5", "=", "arg_5", ".", "_replace", "(", "extra", "=", "HamiltonianMonteCarloExtraKernelResults", "(", "arg_6", "=", "arg_6", ")", ")", "return", "arg_4", ",", "arg_5"], "function": "def Func(arg_0, arg_1, arg_2):\n    \"\"\"Runs one iteration of Hamiltonian Monte Carlo.\n\n    Args:\n      current_state: `Tensor` or Python `list` of `Tensor`s representing the\n        current state(s) of the Markov chain(s). The first `r` dimensions index\n        independent chains, `r = tf.rank(target_log_prob_fn(*current_state))`.\n      previous_kernel_results: `collections.namedtuple` containing `Tensor`s\n        representing values from previous calls to this function (or from the\n        `bootstrap_results` function.)\n\n    Returns:\n      next_state: Tensor or Python list of `Tensor`s representing the state(s)\n        of the Markov chain(s) after taking exactly one step. Has same type and\n        shape as `current_state`.\n      kernel_results: `collections.namedtuple` of internal calculations used to\n        advance the chain.\n\n    Raises:\n      ValueError: if there isn't one `step_size` or a list with same length as\n        `current_state`.\n    \"\"\"\n    arg_3 = (\n        [] if arg_0.step_size_update_fn is None\n        else (arg_2.extra.step_size_assign\n              if mcmc_util.is_list_like(\n                  arg_2.extra.step_size_assign)\n              else [arg_2.extra.step_size_assign]))\n\n    with tf.control_dependencies(arg_3):\n      arg_4, arg_5 = arg_0._impl.Func(\n          arg_1, arg_2)\n      if arg_0.step_size_update_fn is not None:\n        arg_6 = arg_0.step_size_update_fn(  # pylint: disable=not-callable\n            arg_0.step_size, arg_5)\n        arg_5 = arg_5._replace(\n            extra=HamiltonianMonteCarloExtraKernelResults(\n                arg_6=arg_6))\n      return arg_4, arg_5", "path": "tensorflow_probability/python/mcmc/hmc.py", "identifier": "HamiltonianMonteCarlo.one_step", "docstring": "Runs one iteration of Hamiltonian Monte Carlo.\n\n    Args:\n      current_state: `Tensor` or Python `list` of `Tensor`s representing the\n        current state(s) of the Markov chain(s). The first `r` dimensions index\n        independent chains, `r = tf.rank(target_log_prob_fn(*current_state))`.\n      previous_kernel_results: `collections.namedtuple` containing `Tensor`s\n        representing values from previous calls to this function (or from the\n        `bootstrap_results` function.)\n\n    Returns:\n      next_state: Tensor or Python list of `Tensor`s representing the state(s)\n        of the Markov chain(s) after taking exactly one step. Has same type and\n        shape as `current_state`.\n      kernel_results: `collections.namedtuple` of internal calculations used to\n        advance the chain.\n\n    Raises:\n      ValueError: if there isn't one `step_size` or a list with same length as\n        `current_state`.", "docstring_tokens": ["Runs", "one", "iteration", "of", "Hamiltonian", "Monte", "Carlo", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 261322}
{"url": "https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L265-L289", "sha": "0334545885445834307c075a445fba9fe6f0c9e7", "docstring_summary": "Decorator to convert a function which takes a single value and returns\n    a key into one which takes a list of values and returns a dict of key-group\n    mappings.", "language": "python", "parameters": "(function)", "return_statement": "return wrapper", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "@", "wraps", "(", "arg_0", ")", "def", "wrapper", "(", "arg_1", ",", "*", "arg_2", ",", "**", "arg_3", ")", ":", "arg_4", "=", "{", "}", "for", "arg_5", "in", "arg_1", ":", "arg_6", "=", "arg_0", "(", "arg_5", ",", "*", "arg_2", ",", "**", "arg_3", ")", "if", "arg_6", "is", "not", "None", ":", "arg_4", ".", "setdefault", "(", "arg_6", ",", "set", "(", ")", ")", ".", "add", "(", "arg_5", ")", "return", "arg_4", "return", "wrapper"], "function": "def Func(arg_0):\n    \"\"\"Decorator to convert a function which takes a single value and returns\n    a key into one which takes a list of values and returns a dict of key-group\n    mappings.\n\n    :param function: A function which takes a value and returns a hash key.\n    :type function: ``function(value) -> key``\n\n    :rtype:\n        .. parsed-literal::\n            function(iterable) ->\n                {key: :class:`~__builtins__.set` ([value, ...]), ...}\n    \"\"\"\n\n    @wraps(arg_0)\n    def wrapper(arg_1, *arg_2, **arg_3):  # pylint: disable=missing-docstring\n        arg_4 = {}\n\n        for arg_5 in arg_1:\n            arg_6 = arg_0(arg_5, *arg_2, **arg_3)\n            if arg_6 is not None:\n                arg_4.setdefault(arg_6, set()).add(arg_5)\n\n        return arg_4\n    return wrapper", "path": "fastdupes.py", "identifier": "groupify", "docstring": "Decorator to convert a function which takes a single value and returns\n    a key into one which takes a list of values and returns a dict of key-group\n    mappings.\n\n    :param function: A function which takes a value and returns a hash key.\n    :type function: ``function(value) -> key``\n\n    :rtype:\n        .. parsed-literal::\n            function(iterable) ->\n                {key: :class:`~__builtins__.set` ([value, ...]), ...}", "docstring_tokens": ["Decorator", "to", "convert", "a", "function", "which", "takes", "a", "single", "value", "and", "returns", "a", "key", "into", "one", "which", "takes", "a", "list", "of", "values", "and", "returns", "a", "dict", "of", "key", "-", "group", "mappings", "."], "nwo": "ssokolow/fastdupes", "score": 0.4039778193346996, "idx": 261323}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/sensors/aws_glue_catalog_partition_sensor.py#L83-L93", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Gets the AwsGlueCatalogHook", "language": "python", "parameters": "(self)", "return_statement": "return self.hook", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "hasattr", "(", "arg_0", ",", "'hook'", ")", ":", "from", "airflow", ".", "contrib", ".", "hooks", ".", "aws_glue_catalog_hook", "import", "AwsGlueCatalogHook", "arg_0", ".", "hook", "=", "AwsGlueCatalogHook", "(", "aws_conn_id", "=", "arg_0", ".", "aws_conn_id", ",", "region_name", "=", "arg_0", ".", "region_name", ")", "return", "arg_0", ".", "hook"], "function": "def Func(arg_0):\n        \"\"\"\n        Gets the AwsGlueCatalogHook\n        \"\"\"\n        if not hasattr(arg_0, 'hook'):\n            from airflow.contrib.hooks.aws_glue_catalog_hook import AwsGlueCatalogHook\n            arg_0.hook = AwsGlueCatalogHook(\n                aws_conn_id=arg_0.aws_conn_id,\n                region_name=arg_0.region_name)\n\n        return arg_0.hook", "path": "airflow/contrib/sensors/aws_glue_catalog_partition_sensor.py", "identifier": "AwsGlueCatalogPartitionSensor.get_hook", "docstring": "Gets the AwsGlueCatalogHook", "docstring_tokens": ["Gets", "the", "AwsGlueCatalogHook"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261324}
{"url": "https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L332-L344", "sha": "c8ed1daff14ac03195870238b9b900c1109dd5c1", "docstring_summary": "Sets plugin specific options used by plugins originating\n        from this session object.", "language": "python", "parameters": "(self, plugin, key, value)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_1", "in", "arg_0", ".", "plugins", ":", "arg_1", "=", "arg_0", ".", "plugins", "[", "arg_1", "]", "arg_1", ".", "set_option", "(", "arg_2", ",", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\"Sets plugin specific options used by plugins originating\n        from this session object.\n\n        :param plugin: name of the plugin\n        :param key: key of the option\n        :param value: value to set the option to\n\n        \"\"\"\n\n        if arg_1 in arg_0.plugins:\n            arg_1 = arg_0.plugins[arg_1]\n            arg_1.set_option(arg_2, arg_3)", "path": "src/streamlink/session.py", "identifier": "Streamlink.set_plugin_option", "docstring": "Sets plugin specific options used by plugins originating\n        from this session object.\n\n        :param plugin: name of the plugin\n        :param key: key of the option\n        :param value: value to set the option to", "docstring_tokens": ["Sets", "plugin", "specific", "options", "used", "by", "plugins", "originating", "from", "this", "session", "object", "."], "nwo": "streamlink/streamlink", "score": 0.9895819447546034, "idx": 261325}
{"url": "https://github.com/GoogleCloudPlatform/psq/blob/3c5130731d72b6c32d09a6a5d478f3580ff36d50/psq/queue.py#L100-L120", "sha": "3c5130731d72b6c32d09a6a5d478f3580ff36d50", "docstring_summary": "Enqueues a task directly. This is used when a task is retried or if\n        a task was manually created.", "language": "python", "parameters": "(self, task)", "return_statement": "return TaskResult(task.id, self)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "dumps", "(", "arg_1", ")", "if", "arg_0", ".", "_async", ":", "arg_0", ".", "publisher_client", ".", "publish", "(", "arg_0", ".", "topic_path", ",", "arg_2", "=", "arg_2", ")", "logger", ".", "info", "(", "'Task {} queued.'", ".", "format", "(", "arg_1", ".", "id", ")", ")", "else", ":", "arg_3", "=", "unpickle", "(", "arg_2", ")", "logger", ".", "info", "(", "'Executing task {} synchronously.'", ".", "format", "(", "arg_3", ".", "id", ")", ")", "with", "measure_time", "(", ")", "as", "summary", ",", "arg_0", ".", "queue_context", "(", ")", ":", "arg_3", ".", "execute", "(", "queue", "=", "arg_0", ")", "summary", "(", "arg_3", ".", "summary", "(", ")", ")", "return", "TaskResult", "(", "arg_1", ".", "id", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Enqueues a task directly. This is used when a task is retried or if\n        a task was manually created.\n\n        Note that this does not store the task.\n        \"\"\"\n        arg_2 = dumps(arg_1)\n\n        if arg_0._async:\n            arg_0.publisher_client.publish(arg_0.topic_path, arg_2=arg_2)\n            logger.info('Task {} queued.'.format(arg_1.id))\n        else:\n            arg_3 = unpickle(arg_2)\n            logger.info(\n                'Executing task {} synchronously.'.format(arg_3.id)\n            )\n            with measure_time() as summary, arg_0.queue_context():\n                arg_3.execute(queue=arg_0)\n                summary(arg_3.summary())\n\n        return TaskResult(arg_1.id, arg_0)", "path": "psq/queue.py", "identifier": "Queue.enqueue_task", "docstring": "Enqueues a task directly. This is used when a task is retried or if\n        a task was manually created.\n\n        Note that this does not store the task.", "docstring_tokens": ["Enqueues", "a", "task", "directly", ".", "This", "is", "used", "when", "a", "task", "is", "retried", "or", "if", "a", "task", "was", "manually", "created", "."], "nwo": "GoogleCloudPlatform/psq", "score": 0.5618802531255049, "idx": 261326}
{"url": "https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L690-L701", "sha": "2c804b141688eccb07d6ae56601d5c60a62abebd", "docstring_summary": "Removes a single IP block from your account.", "language": "python", "parameters": "(self, ipblock_id)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_perform_request", "(", "url", "=", "'/ipblocks/'", "+", "arg_1", ",", "method", "=", "'DELETE'", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Removes a single IP block from your account.\n\n        :param      ipblock_id: The unique ID of the IP block.\n        :type       ipblock_id: ``str``\n\n        \"\"\"\n        arg_2 = arg_0._perform_request(\n            url='/ipblocks/' + arg_1, method='DELETE')\n\n        return arg_2", "path": "profitbricks/client.py", "identifier": "ProfitBricksService.delete_ipblock", "docstring": "Removes a single IP block from your account.\n\n        :param      ipblock_id: The unique ID of the IP block.\n        :type       ipblock_id: ``str``", "docstring_tokens": ["Removes", "a", "single", "IP", "block", "from", "your", "account", "."], "nwo": "profitbricks/profitbricks-sdk-python", "score": 0.3863798767157053, "idx": 261327}
{"url": "https://github.com/Toblerity/rtree/blob/5d33357c8e88f1a8344415dc15a7d2440211b281/rtree/index.py#L606-L619", "sha": "5d33357c8e88f1a8344415dc15a7d2440211b281", "docstring_summary": "Returns the bounds of the index", "language": "python", "parameters": "(self, coordinate_interleaved=None)", "return_statement": "return _get_bounds(\n            self.handle, core.rt.Index_GetBounds, coordinate_interleaved)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "arg_1", "is", "None", ":", "arg_1", "=", "arg_0", ".", "interleaved", "return", "_Func", "(", "arg_0", ".", "handle", ",", "core", ".", "rt", ".", "Index_GetBounds", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"Returns the bounds of the index\n\n        :param coordinate_interleaved: If True, the coordinates are turned\n            in the form [xmin, ymin, ..., kmin, xmax, ymax, ..., kmax],\n            otherwise they are returned as\n            [xmin, xmax, ymin, ymax, ..., ..., kmin, kmax].  If not specified,\n            the :attr:`interleaved` member of the index is used, which\n            defaults to True.\n        \"\"\"\n        if arg_1 is None:\n            arg_1 = arg_0.interleaved\n        return _Func(\n            arg_0.handle, core.rt.Index_GetBounds, arg_1)", "path": "rtree/index.py", "identifier": "Index.get_bounds", "docstring": "Returns the bounds of the index\n\n        :param coordinate_interleaved: If True, the coordinates are turned\n            in the form [xmin, ymin, ..., kmin, xmax, ymax, ..., kmax],\n            otherwise they are returned as\n            [xmin, xmax, ymin, ymax, ..., ..., kmin, kmax].  If not specified,\n            the :attr:`interleaved` member of the index is used, which\n            defaults to True.", "docstring_tokens": ["Returns", "the", "bounds", "of", "the", "index"], "nwo": "Toblerity/rtree", "score": 0.6128222292729003, "idx": 261328}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/logcapture.py#L225-L233", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Add captured log messages to error output.", "language": "python", "parameters": "(self, test, err)", "return_statement": "return (ec, self.addCaptureToErr(ev, records), tb)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_1", ".", "capturedLogging", "=", "records", "=", "arg_0", ".", "formatLogRecords", "(", ")", "if", "not", "records", ":", "return", "arg_2", "arg_4", ",", "arg_5", ",", "arg_6", "=", "arg_2", "return", "(", "arg_4", ",", "arg_0", ".", "addCaptureToErr", "(", "arg_5", ",", "records", ")", ",", "arg_6", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Add captured log messages to error output.\n        \"\"\"\n        # logic flow copied from Capture.Func\n        arg_1.capturedLogging = records = arg_0.formatLogRecords()\n        if not records:\n            return arg_2\n        arg_4, arg_5, arg_6 = arg_2\n        return (arg_4, arg_0.addCaptureToErr(arg_5, records), arg_6)", "path": "environment/lib/python2.7/site-packages/nose/plugins/logcapture.py", "identifier": "LogCapture.formatError", "docstring": "Add captured log messages to error output.", "docstring_tokens": ["Add", "captured", "log", "messages", "to", "error", "output", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261329}
{"url": "https://github.com/uploadcare/pyuploadcare/blob/cefddc0306133a71e37b18e8700df5948ef49b37/pyuploadcare/api_resources.py#L289-L333", "sha": "cefddc0306133a71e37b18e8700df5948ef49b37", "docstring_summary": "Creates file copy in remote storage.", "language": "python", "parameters": "(self, target, effects=None, make_public=None,\n                           pattern=None)", "return_statement": "return rest_request('POST', 'files/', data=data)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "arg_2", "=", "arg_0", ".", "_build_effects", "(", "arg_2", ")", "arg_5", "=", "{", "'source'", ":", "arg_0", ".", "cdn_path", "(", "arg_2", ")", ",", "'target'", ":", "arg_1", "}", "if", "arg_3", "is", "not", "None", ":", "arg_5", "[", "'make_public'", "]", "=", "arg_3", "if", "arg_4", "is", "not", "None", ":", "arg_5", "[", "'pattern'", "]", "=", "arg_4", "return", "rest_request", "(", "'POST'", ",", "'files/'", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=None,\n                           arg_4=None):\n        \"\"\"Creates file copy in remote storage.\n\n        Args:\n            - target:\n                Name of a custom storage connected to the project.\n            - effects:\n                Adds CDN image effects to ``self.default_effects`` if any.\n            - make_public:\n                To forbid public from accessing your files on the storage set\n                ``make_public`` option to be False.\n                Default value is None. Files have public access by default.\n            - pattern:\n                Specify ``pattern`` option to set S3 object key name.\n                Takes precedence over pattern set in project settings.\n                If neither is specified defaults to\n                `${uuid}/${filename}${effects}${ext}`.\n\n        For more information on each of the options above please refer to\n        REST API docs https://uploadcare.com/docs/api_reference/rest/accessing_files/.\n\n        Following example copies a file to custom storage named ``samplefs``:\n\n             >>> file = File('e8ebfe20-8c11-4a94-9b40-52ecad7d8d1a')\n             >>> file.Func(target='samplefs',\n             >>>                         make_public=True,\n             >>>                         pattern='${uuid}/${filename}${ext}')\n\n        Now custom storage ``samplefs`` contains publicly available file\n        with original filename billmurray.jpg in\n        in the directory named ``e8ebfe20-8c11-4a94-9b40-52ecad7d8d1a``.\n\n        \"\"\"\n        arg_2 = arg_0._build_effects(arg_2)\n        arg_5 = {\n            'source': arg_0.cdn_path(arg_2),\n            'target': arg_1\n        }\n\n        if arg_3 is not None:\n            arg_5['make_public'] = arg_3\n        if arg_4 is not None:\n            arg_5['pattern'] = arg_4\n        return rest_request('POST', 'files/', arg_5=arg_5)", "path": "pyuploadcare/api_resources.py", "identifier": "File.create_remote_copy", "docstring": "Creates file copy in remote storage.\n\n        Args:\n            - target:\n                Name of a custom storage connected to the project.\n            - effects:\n                Adds CDN image effects to ``self.default_effects`` if any.\n            - make_public:\n                To forbid public from accessing your files on the storage set\n                ``make_public`` option to be False.\n                Default value is None. Files have public access by default.\n            - pattern:\n                Specify ``pattern`` option to set S3 object key name.\n                Takes precedence over pattern set in project settings.\n                If neither is specified defaults to\n                `${uuid}/${filename}${effects}${ext}`.\n\n        For more information on each of the options above please refer to\n        REST API docs https://uploadcare.com/docs/api_reference/rest/accessing_files/.\n\n        Following example copies a file to custom storage named ``samplefs``:\n\n             >>> file = File('e8ebfe20-8c11-4a94-9b40-52ecad7d8d1a')\n             >>> file.create_remote_copy(target='samplefs',\n             >>>                         make_public=True,\n             >>>                         pattern='${uuid}/${filename}${ext}')\n\n        Now custom storage ``samplefs`` contains publicly available file\n        with original filename billmurray.jpg in\n        in the directory named ``e8ebfe20-8c11-4a94-9b40-52ecad7d8d1a``.", "docstring_tokens": ["Creates", "file", "copy", "in", "remote", "storage", "."], "nwo": "uploadcare/pyuploadcare", "score": 0.289876796890331, "idx": 261330}
{"url": "https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/mixins.py#L108-L133", "sha": "d41e279c39cccffafbe876c67596184704ae8877", "docstring_summary": "Build the filters and sizers for a field.", "language": "python", "parameters": "(self, ppoi_value, create_on_demand)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_3", "=", "arg_0", ".", "name", "if", "not", "arg_3", "and", "arg_0", ".", "field", ".", "placeholder_image_name", ":", "arg_3", "=", "arg_0", ".", "field", ".", "placeholder_image_name", "arg_0", ".", "filters", "=", "FilterLibrary", "(", "arg_3", ",", "arg_0", ".", "storage", ",", "versatileimagefield_registry", ",", "arg_1", ",", "arg_2", ")", "for", "(", "arg_5", ",", "arg_6", ")", "in", "iteritems", "(", "versatileimagefield_registry", ".", "_sizedimage_registry", ")", ":", "setattr", "(", "arg_0", ",", "arg_5", ",", "arg_6", "(", "path_to_image", "=", "arg_3", ",", "storage", "=", "arg_0", ".", "storage", ",", "arg_2", "=", "arg_2", ",", "ppoi", "=", "arg_1", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Build the filters and sizers for a field.\"\"\"\n        arg_3 = arg_0.name\n        if not arg_3 and arg_0.field.placeholder_image_name:\n            arg_3 = arg_0.field.placeholder_image_name\n        arg_0.filters = FilterLibrary(\n            arg_3,\n            arg_0.storage,\n            versatileimagefield_registry,\n            arg_1,\n            arg_2\n        )\n        for (\n            arg_5,\n            arg_6\n        ) in iteritems(versatileimagefield_registry._sizedimage_registry):\n            setattr(\n                arg_0,\n                arg_5,\n                arg_6(\n                    path_to_image=arg_3,\n                    storage=arg_0.storage,\n                    arg_2=arg_2,\n                    ppoi=arg_1\n                )\n            )", "path": "versatileimagefield/mixins.py", "identifier": "VersatileImageMixIn.build_filters_and_sizers", "docstring": "Build the filters and sizers for a field.", "docstring_tokens": ["Build", "the", "filters", "and", "sizers", "for", "a", "field", "."], "nwo": "respondcreate/django-versatileimagefield", "score": 0.6045936651713567, "idx": 261331}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1918-L1930", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Return the number of jobs for the given clientInfo and a status that is\n    not completed.", "language": "python", "parameters": "(self, clientInfo)", "return_statement": "return activeJobCount", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "arg_2", "=", "'SELECT count(job_id) '", "'FROM %s '", "'WHERE client_info = %%s '", "' AND status != %%s'", "%", "arg_0", ".", "jobsTableName", "conn", ".", "cursor", ".", "execute", "(", "arg_2", ",", "[", "arg_1", ",", "arg_0", ".", "STATUS_COMPLETED", "]", ")", "arg_3", "=", "conn", ".", "cursor", ".", "fetchone", "(", ")", "[", "0", "]", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\" Return the number of jobs for the given clientInfo and a status that is\n    not completed.\n    \"\"\"\n    with ConnectionFactory.get() as conn:\n      arg_2 = 'SELECT count(job_id) ' \\\n              'FROM %s ' \\\n              'WHERE client_info = %%s ' \\\n              ' AND status != %%s' %  arg_0.jobsTableName\n      conn.cursor.execute(arg_2, [arg_1, arg_0.STATUS_COMPLETED])\n      arg_3 = conn.cursor.fetchone()[0]\n\n    return arg_3", "path": "src/nupic/database/client_jobs_dao.py", "identifier": "ClientJobsDAO.getActiveJobCountForClientInfo", "docstring": "Return the number of jobs for the given clientInfo and a status that is\n    not completed.", "docstring_tokens": ["Return", "the", "number", "of", "jobs", "for", "the", "given", "clientInfo", "and", "a", "status", "that", "is", "not", "completed", "."], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261332}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pkginfo/distribution.py#L14-L22", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "``Description`` header must preserve newlines; all others need not", "language": "python", "parameters": "(header, txt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_0", ".", "lower", "(", ")", "==", "'description'", ":", "return", "'\\n'", ".", "join", "(", "[", "arg_2", "[", "8", ":", "]", "if", "arg_2", ".", "startswith", "(", "' '", "*", "8", ")", "else", "arg_2", "for", "arg_2", "in", "arg_1", ".", "strip", "(", ")", ".", "splitlines", "(", ")", "]", ")", "else", ":", "return", "' '", ".", "join", "(", "[", "arg_2", ".", "strip", "(", ")", "for", "arg_2", "in", "arg_1", ".", "splitlines", "(", ")", "]", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    ``Description`` header must preserve newlines; all others need not\n    \"\"\"\n    if arg_0.lower() == 'description':  # preserve newlines\n        return '\\n'.join([arg_2[8:] if arg_2.startswith(' ' * 8) else arg_2\n                          for arg_2 in arg_1.strip().splitlines()])\n    else:\n        return ' '.join([arg_2.strip() for arg_2 in arg_1.splitlines()])", "path": "virtualEnvironment/lib/python2.7/site-packages/pkginfo/distribution.py", "identifier": "_collapse_leading_ws", "docstring": "``Description`` header must preserve newlines; all others need not", "docstring_tokens": ["Description", "header", "must", "preserve", "newlines", ";", "all", "others", "need", "not"], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 261333}
{"url": "https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/util.py#L41-L66", "sha": "177cce21e92baca500f56a932d66bd9a33257af8", "docstring_summary": "Read color_names.txt and find the red, green, and blue values\n        for a named color.", "language": "python", "parameters": "(color)", "return_statement": "return red, green, blue", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "inspect", ".", "getsourcefile", "(", "lambda", ":", "0", ")", ")", ")", "arg_2", "=", "os", ".", "path", ".", "join", "(", "arg_1", ",", "'color_names.txt'", ")", "arg_3", "=", "False", "for", "arg_4", "in", "open", "(", "arg_2", ",", "'r'", ")", ":", "arg_4", "=", "arg_4", ".", "rstrip", "(", ")", "if", "arg_0", ".", "lower", "(", ")", "==", "arg_4", ".", "split", "(", ")", "[", "0", "]", ":", "arg_5", "=", "arg_4", ".", "split", "(", ")", "[", "2", "]", "arg_6", "=", "arg_4", ".", "split", "(", ")", "[", "3", "]", "arg_7", "=", "arg_4", ".", "split", "(", ")", "[", "4", "]", "arg_3", "=", "True", "break", "if", "not", "arg_3", ":", "print", "(", "'Color name \"%s\" not found, using default (white)'", "%", "arg_0", ")", "arg_5", "=", "255", "arg_6", "=", "255", "arg_7", "=", "255", "return", "arg_5", ",", "arg_6", ",", "arg_7"], "function": "def Func(arg_0):\n    \"\"\"Read color_names.txt and find the red, green, and blue values\n        for a named color.\n    \"\"\"\n    # Get the directory where this script file is located:\n    arg_1 = os.path.dirname(\n        os.path.realpath(\n            inspect.getsourcefile(\n                lambda: 0)))\n    arg_2 = os.path.join(arg_1, 'color_names.txt')\n    arg_3 = False\n    for arg_4 in open(arg_2, 'r'):\n        arg_4 = arg_4.rstrip()\n        if arg_0.lower() == arg_4.split()[0]:\n            #hex_color = line.split()[1]\n            arg_5 = arg_4.split()[2]\n            arg_6 = arg_4.split()[3]\n            arg_7 = arg_4.split()[4]\n            arg_3 = True\n            break\n    if not arg_3:\n        print('Color name \"%s\" not found, using default (white)' % arg_0)\n        arg_5 = 255\n        arg_6 = 255\n        arg_7 = 255\n    return arg_5, arg_6, arg_7", "path": "meshlabxml/util.py", "identifier": "color_values", "docstring": "Read color_names.txt and find the red, green, and blue values\n        for a named color.", "docstring_tokens": ["Read", "color_names", ".", "txt", "and", "find", "the", "red", "green", "and", "blue", "values", "for", "a", "named", "color", "."], "nwo": "3DLIRIOUS/MeshLabXML", "score": 0.7657835195107487, "idx": 261334}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/spout_instance.py#L276-L300", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Checks whether we still need to do more work", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "not", "arg_0", ".", "_is_topology_running", "(", ")", ":", "return", "False", "arg_1", "=", "arg_0", ".", "pplan_helper", ".", "context", ".", "get_cluster_config", "(", ")", ".", "get", "(", "api_constants", ".", "TOPOLOGY_MAX_SPOUT_PENDING", ")", "if", "not", "arg_0", ".", "acking_enabled", "and", "arg_0", ".", "output_helper", ".", "is_out_queue_available", "(", ")", ":", "return", "True", "elif", "arg_0", ".", "acking_enabled", "and", "arg_0", ".", "output_helper", ".", "is_out_queue_available", "(", ")", "and", "len", "(", "arg_0", ".", "in_flight_tuples", ")", "<", "arg_1", ":", "return", "True", "elif", "arg_0", ".", "acking_enabled", "and", "not", "arg_0", ".", "in_stream", ".", "is_empty", "(", ")", ":", "return", "True", "else", ":", "return", "False"], "function": "def Func(arg_0):\n    \"\"\"Checks whether we still need to do more work\n\n    When the topology state is RUNNING:\n    1. if the out_queue is not full and ack is not enabled, we could wake up next time to\n       produce more tuples and push to the out_queue\n    2. if the out_queue is not full but the acking is enabled, we need to make sure that\n      the number of pending tuples is smaller than max_spout_pending\n    3. if there are more to read, we will wake up itself next time.\n    \"\"\"\n    if not arg_0._is_topology_running():\n      return False\n\n    arg_1 = \\\n      arg_0.pplan_helper.context.get_cluster_config().get(api_constants.TOPOLOGY_MAX_SPOUT_PENDING)\n\n    if not arg_0.acking_enabled and arg_0.output_helper.is_out_queue_available():\n      return True\n    elif arg_0.acking_enabled and arg_0.output_helper.is_out_queue_available() and \\\n        len(arg_0.in_flight_tuples) < arg_1:\n      return True\n    elif arg_0.acking_enabled and not arg_0.in_stream.is_empty():\n      return True\n    else:\n      return False", "path": "heron/instance/src/python/basics/spout_instance.py", "identifier": "SpoutInstance._is_continue_to_work", "docstring": "Checks whether we still need to do more work\n\n    When the topology state is RUNNING:\n    1. if the out_queue is not full and ack is not enabled, we could wake up next time to\n       produce more tuples and push to the out_queue\n    2. if the out_queue is not full but the acking is enabled, we need to make sure that\n      the number of pending tuples is smaller than max_spout_pending\n    3. if there are more to read, we will wake up itself next time.", "docstring_tokens": ["Checks", "whether", "we", "still", "need", "to", "do", "more", "work"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 261335}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L573-L592", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Wait for a Nomad job to start", "language": "python", "parameters": "(single_master, job)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "0", "while", "True", ":", "try", ":", "arg_3", "=", "requests", ".", "get", "(", "\"http://%s:4646/v1/job/%s\"", "%", "(", "arg_0", ",", "arg_1", ")", ")", "if", "arg_3", ".", "status_code", "==", "200", "and", "arg_3", ".", "json", "(", ")", "[", "\"Status\"", "]", "==", "\"running\"", ":", "break", "else", ":", "raise", "RuntimeError", "(", ")", "except", ":", "Log", ".", "debug", "(", "sys", ".", "exc_info", "(", ")", "[", "0", "]", ")", "Log", ".", "info", "(", "\"Waiting for %s to come up... %s\"", "%", "(", "arg_1", ",", "arg_2", ")", ")", "time", ".", "sleep", "(", "1", ")", "if", "arg_2", ">", "20", ":", "Log", ".", "error", "(", "\"Failed to start Nomad Cluster!\"", ")", "sys", ".", "exit", "(", "-", "1", ")", "arg_2", "=", "arg_2", "+", "1"], "function": "def Func(arg_0, arg_1):\n  '''\n  Wait for a Nomad job to start\n  '''\n  arg_2 = 0\n  while True:\n    try:\n      arg_3 = requests.get(\"http://%s:4646/v1/job/%s\" % (arg_0, arg_1))\n      if arg_3.status_code == 200 and arg_3.json()[\"Status\"] == \"running\":\n        break\n      else:\n        raise RuntimeError()\n    except:\n      Log.debug(sys.exc_info()[0])\n      Log.info(\"Waiting for %s to come up... %s\" % (arg_1, arg_2))\n      time.sleep(1)\n      if arg_2 > 20:\n        Log.error(\"Failed to start Nomad Cluster!\")\n        sys.exit(-1)\n    arg_2 = arg_2 + 1", "path": "heron/tools/admin/src/python/standalone.py", "identifier": "wait_for_job_to_start", "docstring": "Wait for a Nomad job to start", "docstring_tokens": ["Wait", "for", "a", "Nomad", "job", "to", "start"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 261336}
{"url": "https://github.com/m0n5t3r/sentry-zabbix/blob/3dc6e245b3d67de54e4bd41d2bc9b715fee2dbd2/src/sentry_zabbix/plugin.py#L52-L83", "sha": "3dc6e245b3d67de54e4bd41d2bc9b715fee2dbd2", "docstring_summary": "Process error.", "language": "python", "parameters": "(self, group, event, is_new, is_sample, **kwargs)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "**", "arg_5", ")", ":", "if", "not", "arg_0", ".", "is_configured", "(", "arg_1", ".", "project", ")", ":", "return", "arg_6", "=", "arg_0", ".", "get_option", "(", "'server_host'", ",", "arg_1", ".", "project", ")", "arg_7", "=", "int", "(", "arg_0", ".", "get_option", "(", "'server_port'", ",", "arg_1", ".", "project", ")", ")", "arg_8", "=", "arg_0", ".", "get_option", "(", "'prefix'", ",", "arg_1", ".", "project", ")", "arg_9", "=", "arg_0", ".", "get_option", "(", "'hostname'", ",", "arg_1", ".", "project", ")", "or", "socket", ".", "gethostname", "(", ")", "arg_10", "=", "arg_1", ".", "project", ".", "get_option", "(", "'sentry:resolve_age'", ",", "None", ")", "arg_11", "=", "int", "(", "time", ".", "time", "(", ")", ")", "arg_12", "=", "'%s.%%s[%s]'", "%", "(", "arg_8", ",", "arg_1", ".", "project", ".", "slug", ")", "arg_13", "=", "arg_1", ".", "get_level_display", "(", ")", "arg_14", "=", "arg_12", "%", "arg_13", "arg_15", "=", "arg_1", ".", "project", ".", "group_set", ".", "filter", "(", "status", "=", "STATUS_UNRESOLVED", ")", "if", "arg_10", ":", "arg_16", "=", "timezone", ".", "now", "(", ")", "-", "timedelta", "(", "hours", "=", "int", "(", "arg_10", ")", ")", "arg_15", "=", "arg_15", ".", "filter", "(", "last_seen__gt", "=", "arg_16", ")", "arg_17", "=", "arg_15", ".", "filter", "(", "arg_13", "=", "arg_1", ".", "level", ")", ".", "count", "(", ")", "arg_18", "=", "Metric", "(", "arg_9", ",", "arg_14", ",", "arg_17", ",", "arg_11", ")", "log", ".", "info", "(", "'will send %s=%s to zabbix'", ",", "arg_14", ",", "arg_17", ")", "send_to_zabbix", "(", "[", "arg_18", "]", ",", "arg_6", ",", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, **arg_5):\n        \"\"\"\n        Process error.\n        \"\"\"\n        if not arg_0.is_configured(arg_1.project):\n            return\n\n        arg_6 = arg_0.get_option('server_host', arg_1.project)\n        arg_7 = int(arg_0.get_option('server_port', arg_1.project))\n        arg_8 = arg_0.get_option('prefix', arg_1.project)\n        arg_9 = arg_0.get_option('hostname', arg_1.project) or socket.gethostname()\n        arg_10 = arg_1.project.get_option('sentry:resolve_age', None)\n\n        arg_11 = int(time.time())\n        arg_12 = '%s.%%s[%s]' % (arg_8, arg_1.project.slug)\n\n        arg_13 = arg_1.get_level_display()\n        arg_14 = arg_12 % arg_13\n\n        arg_15 = arg_1.project.group_set.filter(status=STATUS_UNRESOLVED)\n\n        if arg_10:\n            arg_16 = timezone.now() - timedelta(hours=int(arg_10))\n            arg_15 = arg_15.filter(last_seen__gt=arg_16)\n\n        arg_17 = arg_15.filter(arg_13=arg_1.level).count()\n\n        arg_18 = Metric(arg_9, arg_14, arg_17, arg_11)\n\n        log.info('will send %s=%s to zabbix', arg_14, arg_17)\n\n        send_to_zabbix([arg_18], arg_6, arg_7)", "path": "src/sentry_zabbix/plugin.py", "identifier": "ZabbixPlugin.post_process", "docstring": "Process error.", "docstring_tokens": ["Process", "error", "."], "nwo": "m0n5t3r/sentry-zabbix", "score": 0.2855681421870085, "idx": 261337}
{"url": "https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L237-L248", "sha": "b0fc49e157189932c70231077ed35e1aa5717da9", "docstring_summary": "Configure engines so that remote methods returning values of type\n        `real_type` will instead return by proxy, as type `proxy_type`", "language": "python", "parameters": "(cls, real_type, proxy_type)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "if", "distob", ".", "engine", "is", "None", ":", "arg_0", ".", "_initial_proxy_types", "[", "arg_1", "]", "=", "arg_2", "elif", "isinstance", "(", "distob", ".", "engine", ",", "ObjectHub", ")", ":", "distob", ".", "engine", ".", "_runtime_reg_proxy_type", "(", "arg_1", ",", "arg_2", ")", "else", ":", "distob", ".", "engine", ".", "_singleeng_reg_proxy_type", "(", "arg_1", ",", "arg_2", ")", "pass"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Configure engines so that remote methods returning values of type\n        `real_type` will instead return by proxy, as type `proxy_type`\n        \"\"\"\n        if distob.engine is None:\n            arg_0._initial_proxy_types[arg_1] = arg_2\n        elif isinstance(distob.engine, ObjectHub):\n            distob.engine._runtime_reg_proxy_type(arg_1, arg_2)\n        else:\n            # TODO: remove next line after issue #58 in dill is fixed.\n            distob.engine._singleeng_reg_proxy_type(arg_1, arg_2)\n            pass", "path": "distob/distob.py", "identifier": "ObjectHub.register_proxy_type", "docstring": "Configure engines so that remote methods returning values of type\n        `real_type` will instead return by proxy, as type `proxy_type`", "docstring_tokens": ["Configure", "engines", "so", "that", "remote", "methods", "returning", "values", "of", "type", "real_type", "will", "instead", "return", "by", "proxy", "as", "type", "proxy_type"], "nwo": "mattja/distob", "score": 0.12050106452410352, "idx": 261338}
{"url": "https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L617-L623", "sha": "9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59", "docstring_summary": "Receive ACK in REBINDING state.", "language": "python", "parameters": "(self, pkt)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"C3. Received ACK?, in REBINDING state.\"", ")", "if", "arg_0", ".", "process_received_ack", "(", "arg_1", ")", ":", "logger", ".", "debug", "(", "\"C3: T. Received ACK, in REBINDING state, \"", "\"raise BOUND.\"", ")", "raise", "arg_0", ".", "BOUND", "(", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Receive ACK in REBINDING state.\"\"\"\n        logger.debug(\"C3. Received ACK?, in REBINDING state.\")\n        if arg_0.process_received_ack(arg_1):\n            logger.debug(\"C3: T. Received ACK, in REBINDING state, \"\n                         \"raise BOUND.\")\n            raise arg_0.BOUND()", "path": "dhcpcanon/dhcpcapfsm.py", "identifier": "DHCPCAPFSM.receive_ack_rebinding", "docstring": "Receive ACK in REBINDING state.", "docstring_tokens": ["Receive", "ACK", "in", "REBINDING", "state", "."], "nwo": "juga0/dhcpcanon", "score": 0.37977197872528695, "idx": 261339}
{"url": "https://github.com/pinterest/thrift-tools/blob/64e74aec89e2491c781fc62d1c45944dc15aba28/thrift_tools/util.py#L34-L56", "sha": "64e74aec89e2491c781fc62d1c45944dc15aba28", "docstring_summary": "if client_port is 0 any client_port is good", "language": "python", "parameters": "(data, client_port, server_port, is_loopback=False)", "return_statement": "return header.data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "arg_4", "=", "_loopback", "if", "arg_3", "else", "_ethernet", "try", ":", "arg_4", ".", "unpack", "(", "arg_0", ")", "except", "Exception", "as", "ex", ":", "raise", "ValueError", "(", "'Bad header: %s'", "%", "ex", ")", "arg_5", "=", "getattr", "(", "arg_4", ".", "data", ",", "'data'", ",", "None", ")", "if", "type", "(", "arg_5", ")", "!=", "dpkt", ".", "tcp", ".", "TCP", ":", "raise", "ValueError", "(", "'Not a TCP packet'", ")", "if", "arg_5", ".", "dport", "==", "arg_2", ":", "if", "arg_1", "!=", "0", "and", "arg_5", ".", "sport", "!=", "arg_1", ":", "raise", "ValueError", "(", "'Request from different client'", ")", "elif", "arg_5", ".", "sport", "==", "arg_2", ":", "if", "arg_1", "!=", "0", "and", "arg_5", ".", "dport", "!=", "arg_1", ":", "raise", "ValueError", "(", "'Reply for different client'", ")", "else", ":", "raise", "ValueError", "(", "'Packet not for/from client/server'", ")", "return", "arg_4", ".", "data"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\" if client_port is 0 any client_port is good \"\"\"\n    arg_4 = _loopback if arg_3 else _ethernet\n\n    try:\n        arg_4.unpack(arg_0)\n    except Exception as ex:\n        raise ValueError('Bad header: %s' % ex)\n\n    arg_5 = getattr(arg_4.data, 'data', None)\n    if type(arg_5) != dpkt.tcp.TCP:\n        raise ValueError('Not a TCP packet')\n\n    if arg_5.dport == arg_2:\n        if arg_1 != 0 and arg_5.sport != arg_1:\n            raise ValueError('Request from different client')\n    elif arg_5.sport == arg_2:\n        if arg_1 != 0 and arg_5.dport != arg_1:\n            raise ValueError('Reply for different client')\n    else:\n        raise ValueError('Packet not for/from client/server')\n\n    return arg_4.data", "path": "thrift_tools/util.py", "identifier": "get_ip_packet", "docstring": "if client_port is 0 any client_port is good", "docstring_tokens": ["if", "client_port", "is", "0", "any", "client_port", "is", "good"], "nwo": "pinterest/thrift-tools", "score": 0.3868024438139195, "idx": 261340}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/linear_gaussian_ssm.py#L1622-L1685", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Build a callable for one step of Kalman sampling recursion.", "language": "python", "parameters": "(get_transition_matrix_for_timestep,\n                             get_transition_noise_for_timestep,\n                             get_observation_matrix_for_timestep,\n                             get_observation_noise_for_timestep,\n                             full_sample_and_batch_shape,\n                             stream,\n                             validate_args=False)", "return_statement": "return sample_step", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ",", "arg_6", "=", "False", ")", ":", "def", "sample_step", "(", "arg_7", ",", "arg_8", ")", ":", "arg_9", ",", "arg_10", "=", "arg_7", "arg_11", "=", "arg_0", "(", "arg_8", "-", "1", ")", "arg_12", "=", "arg_1", "(", "arg_8", "-", "1", ")", "arg_13", "=", "arg_11", ".", "matmul", "(", "arg_9", ")", "arg_14", "=", "arg_13", "+", "arg_12", ".", "sample", "(", "sample_shape", "=", "_augment_sample_shape", "(", "arg_12", ",", "arg_4", ",", "arg_6", ")", ",", "seed", "=", "arg_5", "(", ")", ")", "[", "...", ",", "tf", ".", "newaxis", "]", "arg_15", "=", "arg_2", "(", "arg_8", ")", "arg_16", "=", "arg_3", "(", "arg_8", ")", "arg_17", "=", "arg_15", ".", "matmul", "(", "arg_14", ")", "arg_18", "=", "arg_17", "+", "arg_16", ".", "sample", "(", "sample_shape", "=", "_augment_sample_shape", "(", "arg_16", ",", "arg_4", ",", "arg_6", ")", ",", "seed", "=", "arg_5", "(", ")", ")", "[", "...", ",", "tf", ".", "newaxis", "]", "return", "(", "arg_14", ",", "arg_18", ")", "return", "sample_step"], "function": "def Func(arg_0,\n                             arg_1,\n                             arg_2,\n                             arg_3,\n                             arg_4,\n                             arg_5,\n                             arg_6=False):\n  \"\"\"Build a callable for one step of Kalman sampling recursion.\n\n  Args:\n    get_transition_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[latent_size, latent_size]`.\n    get_transition_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[latent_size]`.\n    get_observation_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[observation_size, observation_size]`.\n    get_observation_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[observation_size]`.\n    full_sample_and_batch_shape: Desired sample and batch shape of the\n      returned samples, concatenated in a single `Tensor`.\n    stream: `tfd.SeedStream` instance used to generate a\n      sequence of random seeds.\n    validate_args: if True, perform error checking at runtime.\n\n  Returns:\n    sample_step: a callable that samples the latent state and\n      observation at time `t`, given latent state at time `t-1`.\n  \"\"\"\n\n  def sample_step(arg_7, arg_8):\n    \"\"\"Sample values for a single timestep.\"\"\"\n    arg_9, arg_10 = arg_7\n\n    arg_11 = arg_0(arg_8 - 1)\n    arg_12 = arg_1(arg_8 - 1)\n\n    arg_13 = arg_11.matmul(arg_9)\n    arg_14 = arg_13 + arg_12.sample(\n        sample_shape=_augment_sample_shape(\n            arg_12,\n            arg_4,\n            arg_6),\n        seed=arg_5())[..., tf.newaxis]\n\n    arg_15 = arg_2(arg_8)\n    arg_16 = arg_3(arg_8)\n\n    arg_17 = arg_15.matmul(arg_14)\n    arg_18 = arg_17 + arg_16.sample(\n        sample_shape=_augment_sample_shape(\n            arg_16,\n            arg_4,\n            arg_6),\n        seed=arg_5())[..., tf.newaxis]\n\n    return (arg_14, arg_18)\n\n  return sample_step", "path": "tensorflow_probability/python/distributions/linear_gaussian_ssm.py", "identifier": "build_kalman_sample_step", "docstring": "Build a callable for one step of Kalman sampling recursion.\n\n  Args:\n    get_transition_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[latent_size, latent_size]`.\n    get_transition_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[latent_size]`.\n    get_observation_matrix_for_timestep: callable taking a timestep\n      as an integer `Tensor` argument, and returning a `LinearOperator`\n      of shape `[observation_size, observation_size]`.\n    get_observation_noise_for_timestep: callable taking a timestep as\n      an integer `Tensor` argument, and returning a\n      `MultivariateNormalLinearOperator` of event shape\n      `[observation_size]`.\n    full_sample_and_batch_shape: Desired sample and batch shape of the\n      returned samples, concatenated in a single `Tensor`.\n    stream: `tfd.SeedStream` instance used to generate a\n      sequence of random seeds.\n    validate_args: if True, perform error checking at runtime.\n\n  Returns:\n    sample_step: a callable that samples the latent state and\n      observation at time `t`, given latent state at time `t-1`.", "docstring_tokens": ["Build", "a", "callable", "for", "one", "step", "of", "Kalman", "sampling", "recursion", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 261341}
{"url": "https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/latools.py#L3290-L3367", "sha": "cd25a650cfee318152f234d992708511f7047fbe", "docstring_summary": "Plot analytes as a function of time.", "language": "python", "parameters": "(self, analytes=None, samples=None, ranges=False,\n                    focus=None, outdir=None, filt=None, scale='log',\n                    figsize=[10, 4], stats=False, stat='nanmean',\n                    err='nanstd', subset='All_Analyses')", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "False", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ",", "arg_7", "=", "'log'", ",", "arg_8", "=", "[", "10", ",", "4", "]", ",", "arg_9", "=", "False", ",", "arg_10", "=", "'nanmean'", ",", "arg_11", "=", "'nanstd'", ",", "arg_12", "=", "'All_Analyses'", ")", ":", "if", "arg_4", "is", "None", ":", "arg_4", "=", "arg_0", ".", "focus_stage", "if", "arg_5", "is", "None", ":", "arg_5", "=", "arg_0", ".", "report_dir", "+", "'/'", "+", "arg_4", "if", "not", "os", ".", "path", ".", "isdir", "(", "arg_5", ")", ":", "os", ".", "mkdir", "(", "arg_5", ")", "if", "arg_12", "is", "not", "None", ":", "arg_2", "=", "arg_0", ".", "_get_samples", "(", "arg_12", ")", "elif", "arg_2", "is", "None", ":", "arg_2", "=", "arg_0", ".", "subsets", "[", "'All_Analyses'", "]", "elif", "isinstance", "(", "arg_2", ",", "str", ")", ":", "arg_2", "=", "[", "arg_2", "]", "with", "arg_0", ".", "pbar", ".", "set", "(", "total", "=", "len", "(", "arg_2", ")", ",", "desc", "=", "'Drawing Plots'", ")", "as", "prog", ":", "for", "arg_13", "in", "arg_2", ":", "arg_14", ",", "arg_15", "=", "arg_0", ".", "data", "[", "arg_13", "]", ".", "tplot", "(", "arg_1", "=", "arg_1", ",", "arg_8", "=", "arg_8", ",", "arg_7", "=", "arg_7", ",", "arg_6", "=", "arg_6", ",", "arg_3", "=", "arg_3", ",", "arg_9", "=", "arg_9", ",", "arg_10", "=", "arg_10", ",", "arg_11", "=", "arg_11", ",", "focus_stage", "=", "arg_4", ")", "arg_14", ".", "savefig", "(", "arg_5", "+", "'/'", "+", "arg_13", "+", "'_traces.pdf'", ")", "plt", ".", "close", "(", "arg_14", ")", "prog", ".", "update", "(", ")", "return"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=False,\n                    arg_4=None, arg_5=None, arg_6=None, arg_7='log',\n                    arg_8=[10, 4], arg_9=False, arg_10='nanmean',\n                    arg_11='nanstd', arg_12='All_Analyses'):\n        \"\"\"\n        Plot analytes as a function of time.\n\n        Parameters\n        ----------\n        analytes : optional, array_like or str\n            The analyte(s) to plot. Defaults to all analytes.\n        samples: optional, array_like or str\n            The sample(s) to plot. Defaults to all samples.\n        ranges : bool\n            Whether or not to show the signal/backgroudn regions\n            identified by 'autorange'.\n        focus : str\n            The focus 'stage' of the analysis to plot. Can be\n            'rawdata', 'despiked':, 'signal', 'background',\n            'bkgsub', 'ratios' or 'calibrated'.\n        outdir : str\n            Path to a directory where you'd like the plots to be\n            saved. Defaults to 'reports/[focus]' in your data directory.\n        filt : str, dict or bool\n            Either logical filter expression contained in a str,\n            a dict of expressions specifying the filter string to\n            use for each analyte or a boolean. Passed to `grab_filt`.\n        scale : str\n            If 'log', plots the data on a log scale.\n        figsize : array_like\n            Array of length 2 specifying figure [width, height] in\n            inches.\n        stats : bool\n            Whether or not to overlay the mean and standard deviations\n            for each trace.\n        stat, err: str\n            The names of the statistic and error components to plot.\n            Deafaults to 'nanmean' and 'nanstd'.\n\n\n        Returns\n        -------\n        None\n        \"\"\"\n        if arg_4 is None:\n            arg_4 = arg_0.focus_stage\n        if arg_5 is None:\n            arg_5 = arg_0.report_dir + '/' + arg_4\n        if not os.path.isdir(arg_5):\n            os.mkdir(arg_5)\n\n        # if samples is not None:\n        #     subset = self.make_subset(samples)\n\n        if arg_12 is not None:\n            arg_2 = arg_0._get_samples(arg_12)\n        elif arg_2 is None:\n            arg_2 = arg_0.subsets['All_Analyses']\n        elif isinstance(arg_2, str):\n            arg_2 = [arg_2]\n        \n        with arg_0.pbar.set(total=len(arg_2), desc='Drawing Plots') as prog:\n            for arg_13 in arg_2:\n                arg_14, arg_15 = arg_0.data[arg_13].tplot(arg_1=arg_1, arg_8=arg_8,\n                                        arg_7=arg_7, arg_6=arg_6,\n                                        arg_3=arg_3, arg_9=arg_9,\n                                        arg_10=arg_10, arg_11=arg_11, focus_stage=arg_4)\n                # ax = fig.axes[0]\n                # for l, u in s.sigrng:\n                #     ax.axvspan(l, u, color='r', alpha=0.1)\n                # for l, u in s.bkgrng:\n                #     ax.axvspan(l, u, color='k', alpha=0.1)\n                arg_14.savefig(arg_5 + '/' + arg_13 + '_traces.pdf')\n                # TODO: on older(?) computers raises\n                # 'OSError: [Errno 24] Too many open files'\n                plt.close(arg_14)\n                prog.update()\n        return", "path": "latools/latools.py", "identifier": "analyse.trace_plots", "docstring": "Plot analytes as a function of time.\n\n        Parameters\n        ----------\n        analytes : optional, array_like or str\n            The analyte(s) to plot. Defaults to all analytes.\n        samples: optional, array_like or str\n            The sample(s) to plot. Defaults to all samples.\n        ranges : bool\n            Whether or not to show the signal/backgroudn regions\n            identified by 'autorange'.\n        focus : str\n            The focus 'stage' of the analysis to plot. Can be\n            'rawdata', 'despiked':, 'signal', 'background',\n            'bkgsub', 'ratios' or 'calibrated'.\n        outdir : str\n            Path to a directory where you'd like the plots to be\n            saved. Defaults to 'reports/[focus]' in your data directory.\n        filt : str, dict or bool\n            Either logical filter expression contained in a str,\n            a dict of expressions specifying the filter string to\n            use for each analyte or a boolean. Passed to `grab_filt`.\n        scale : str\n            If 'log', plots the data on a log scale.\n        figsize : array_like\n            Array of length 2 specifying figure [width, height] in\n            inches.\n        stats : bool\n            Whether or not to overlay the mean and standard deviations\n            for each trace.\n        stat, err: str\n            The names of the statistic and error components to plot.\n            Deafaults to 'nanmean' and 'nanstd'.\n\n\n        Returns\n        -------\n        None", "docstring_tokens": ["Plot", "analytes", "as", "a", "function", "of", "time", "."], "nwo": "oscarbranson/latools", "score": 0.2827006957945985, "idx": 261342}
{"url": "https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/updates.py#L46-L61", "sha": "6c9236fd3b6a8f9e2d70dbf1bc01529242b73075", "docstring_summary": "Returns an array of updates that have been sent from the buffer for an\n      individual social media profile.", "language": "python", "parameters": "(self)", "return_statement": "return self.__sent", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "[", "]", "arg_2", "=", "PATHS", "[", "'GET_SENT'", "]", "%", "arg_0", ".", "profile_id", "arg_3", "=", "arg_0", ".", "api", ".", "get", "(", "arg_2", "=", "arg_2", ")", "for", "arg_4", "in", "arg_3", "[", "'updates'", "]", ":", "arg_1", ".", "append", "(", "Update", "(", "api", "=", "arg_0", ".", "api", ",", "raw_response", "=", "arg_4", ")", ")", "arg_0", ".", "__Func", "=", "arg_1", "return", "arg_0", ".", "__Func"], "function": "def Func(arg_0):\n    '''\n      Returns an array of updates that have been Func from the buffer for an\n      individual social media profile.\n    '''\n\n    arg_1 = []\n    arg_2 = PATHS['GET_SENT'] % arg_0.profile_id\n\n    arg_3 = arg_0.api.get(arg_2=arg_2)\n    for arg_4 in arg_3['updates']:\n      arg_1.append(Update(api=arg_0.api, raw_response=arg_4))\n\n    arg_0.__Func = arg_1\n\n    return arg_0.__Func", "path": "buffpy/managers/updates.py", "identifier": "Updates.sent", "docstring": "Returns an array of updates that have been sent from the buffer for an\n      individual social media profile.", "docstring_tokens": ["Returns", "an", "array", "of", "updates", "that", "have", "been", "sent", "from", "the", "buffer", "for", "an", "individual", "social", "media", "profile", "."], "nwo": "vtemian/buffpy", "score": 0.2727920376977753, "idx": 261343}
{"url": "https://github.com/bkg/greenwich/blob/57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141/greenwich/raster.py#L459-L468", "sha": "57ec644dadfe43ce0ecf2cfd32a2de71e0c8c141", "docstring_summary": "Returns the minimum bounding rectangle as a tuple of min X, min Y,\n        max X, max Y.", "language": "python", "parameters": "(self)", "return_statement": "return self._envelope", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "arg_0", ".", "_Func", "is", "None", ":", "arg_1", "=", "arg_0", ".", "affine", ".", "origin", "arg_2", "=", "arg_1", "[", "0", "]", "+", "arg_0", ".", "ds", ".", "RasterXSize", "*", "arg_0", ".", "affine", ".", "scale", "[", "0", "]", "arg_3", "=", "arg_1", "[", "1", "]", "+", "arg_0", ".", "ds", ".", "RasterYSize", "*", "arg_0", ".", "affine", ".", "scale", "[", "1", "]", "arg_0", ".", "_Func", "=", "Envelope", "(", "arg_1", "[", "0", "]", ",", "arg_3", ",", "arg_2", ",", "arg_1", "[", "1", "]", ")", "return", "arg_0", ".", "_Func"], "function": "def Func(arg_0):\n        \"\"\"Returns the minimum bounding rectangle as a tuple of min X, min Y,\n        max X, max Y.\n        \"\"\"\n        if arg_0._Func is None:\n            arg_1 = arg_0.affine.origin\n            arg_2 = arg_1[0] + arg_0.ds.RasterXSize * arg_0.affine.scale[0]\n            arg_3 = arg_1[1] + arg_0.ds.RasterYSize * arg_0.affine.scale[1]\n            arg_0._Func = Envelope(arg_1[0], arg_3, arg_2, arg_1[1])\n        return arg_0._Func", "path": "greenwich/raster.py", "identifier": "Raster.envelope", "docstring": "Returns the minimum bounding rectangle as a tuple of min X, min Y,\n        max X, max Y.", "docstring_tokens": ["Returns", "the", "minimum", "bounding", "rectangle", "as", "a", "tuple", "of", "min", "X", "min", "Y", "max", "X", "max", "Y", "."], "nwo": "bkg/greenwich", "score": 0.15726537023232431, "idx": 261344}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/more_collections.py#L6-L8", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Transform a named tuple into a dictionary", "language": "python", "parameters": "(a_named_tuple)", "return_statement": "return dict((s, getattr(a_named_tuple, s)) for s in a_named_tuple._fields)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "dict", "(", "(", "arg_1", ",", "getattr", "(", "arg_0", ",", "arg_1", ")", ")", "for", "arg_1", "in", "arg_0", ".", "_fields", ")"], "function": "def Func(arg_0):\n    \"\"\"Transform a named tuple into a dictionary\"\"\"\n    return dict((arg_1, getattr(arg_0, arg_1)) for arg_1 in arg_0._fields)", "path": "boyle/more_collections.py", "identifier": "dictify", "docstring": "Transform a named tuple into a dictionary", "docstring_tokens": ["Transform", "a", "named", "tuple", "into", "a", "dictionary"], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 261345}
{"url": "https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1026-L1045", "sha": "712716ab0cdebbec9fabb25eea3bf40e4354749d", "docstring_summary": "Determines the rolling volatility of a strategy.", "language": "python", "parameters": "(returns, rolling_vol_window)", "return_statement": "return returns.rolling(rolling_vol_window).std() \\\n        * np.sqrt(APPROX_BDAYS_PER_YEAR)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "arg_0", ".", "rolling", "(", "arg_1", ")", ".", "std", "(", ")", "*", "np", ".", "sqrt", "(", "APPROX_BDAYS_PER_YEAR", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Determines the rolling volatility of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    rolling_vol_window : int\n        Length of rolling window, in days, over which to compute.\n\n    Returns\n    -------\n    pd.Series\n        Rolling volatility.\n    \"\"\"\n\n    return arg_0.rolling(arg_1).std() \\\n        * np.sqrt(APPROX_BDAYS_PER_YEAR)", "path": "pyfolio/timeseries.py", "identifier": "rolling_volatility", "docstring": "Determines the rolling volatility of a strategy.\n\n    Parameters\n    ----------\n    returns : pd.Series\n        Daily returns of the strategy, noncumulative.\n         - See full explanation in tears.create_full_tear_sheet.\n    rolling_vol_window : int\n        Length of rolling window, in days, over which to compute.\n\n    Returns\n    -------\n    pd.Series\n        Rolling volatility.", "docstring_tokens": ["Determines", "the", "rolling", "volatility", "of", "a", "strategy", "."], "nwo": "quantopian/pyfolio", "score": 0.9901923308584412, "idx": 261346}
{"url": "https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L925-L942", "sha": "33a7f8aa9dade1d863110c6d8b27dfd955cb471f", "docstring_summary": "Add subfield into specified position.", "language": "python", "parameters": "(rec, tag, subfield_code, value,\n                             subfield_position=None,\n                             field_position_global=None,\n                             field_position_local=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", "=", "None", ",", "arg_5", "=", "None", ",", "arg_6", "=", "None", ")", ":", "arg_7", "=", "record_get_subfields", "(", "arg_0", ",", "arg_1", ",", "arg_5", "=", "arg_5", ",", "arg_6", "=", "arg_6", ")", "if", "arg_4", "is", "None", ":", "arg_7", ".", "append", "(", "(", "arg_2", ",", "arg_3", ")", ")", "else", ":", "arg_7", ".", "insert", "(", "arg_4", ",", "(", "arg_2", ",", "arg_3", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3,\n                             arg_4=None,\n                             arg_5=None,\n                             arg_6=None):\n    \"\"\"Add subfield into specified position.\n\n    Specify the subfield by tag, field number and optionally by subfield\n    position.\n    \"\"\"\n    arg_7 = record_get_subfields(\n        arg_0, arg_1,\n        arg_5=arg_5,\n        arg_6=arg_6)\n\n    if arg_4 is None:\n        arg_7.append((arg_2, arg_3))\n    else:\n        arg_7.insert(arg_4, (arg_2, arg_3))", "path": "harvestingkit/bibrecord.py", "identifier": "record_add_subfield_into", "docstring": "Add subfield into specified position.\n\n    Specify the subfield by tag, field number and optionally by subfield\n    position.", "docstring_tokens": ["Add", "subfield", "into", "specified", "position", "."], "nwo": "inspirehep/harvesting-kit", "score": 0.23137166388621372, "idx": 261347}
{"url": "https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L551-L592", "sha": "e5f9e96e754fb2dc5da187b05e4abc77a9b2affd", "docstring_summary": "Get a folder id from a path on the server.", "language": "python", "parameters": "(path)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ".", "token", "=", "verify_credentials", "(", ")", "arg_3", "=", "arg_0", ".", "split", "(", "'/'", ")", "if", "arg_3", "[", "-", "1", "]", "==", "''", ":", "arg_3", ".", "pop", "(", ")", "if", "arg_0", ".", "startswith", "(", "'/users/'", ")", ":", "arg_3", ".", "pop", "(", "0", ")", "arg_3", ".", "pop", "(", "0", ")", "arg_4", "=", "arg_3", ".", "pop", "(", "0", ")", "arg_5", ",", "arg_6", "=", "arg_4", ".", "split", "(", "'_'", ")", "arg_7", "=", "arg_3", ".", "pop", "(", ")", "arg_8", "=", "arg_1", ".", "communicator", ".", "get_user_by_name", "(", "arg_5", ",", "arg_6", ")", "arg_9", "=", "_descend_folder_for_id", "(", "arg_3", ",", "arg_8", "[", "'folder_id'", "]", ")", "return", "_search_folder_for_item_or_folder", "(", "arg_7", ",", "arg_9", ")", "elif", "arg_0", ".", "startswith", "(", "'/communities/'", ")", ":", "print", "(", "arg_3", ")", "arg_3", ".", "pop", "(", "0", ")", "arg_3", ".", "pop", "(", "0", ")", "arg_10", "=", "arg_3", ".", "pop", "(", "0", ")", "arg_7", "=", "arg_3", ".", "pop", "(", ")", "arg_11", "=", "arg_1", ".", "communicator", ".", "get_community_by_name", "(", "arg_10", ")", "arg_9", "=", "_descend_folder_for_id", "(", "arg_3", ",", "arg_11", "[", "'folder_id'", "]", ")", "return", "_search_folder_for_item_or_folder", "(", "arg_7", ",", "arg_9", ")", "else", ":", "return", "False", ",", "-", "1"], "function": "def Func(arg_0):\n    \"\"\"\n    Get a folder id from a path on the server.\n\n    Warning: This is NOT efficient at all.\n\n    The schema for this path is:\n    path := \"/users/<name>/\" | \"/communities/<name>\" , {<subfolder>/}\n    name := <firstname> , \"_\" , <lastname>\n\n    :param path: The virtual path on the server.\n    :type path: string\n    :returns: a tuple indicating True or False about whether the resource is an\n        item and id of the resource i.e. (True, item_id) or (False, folder_id)\n    :rtype: (bool, int | long)\n    \"\"\"\n    arg_1.token = verify_credentials()\n\n    arg_3 = arg_0.split('/')\n    if arg_3[-1] == '':\n        arg_3.pop()\n    if arg_0.startswith('/users/'):\n        arg_3.pop(0)  # remove '' before /\n        arg_3.pop(0)  # remove 'users'\n        arg_4 = arg_3.pop(0)  # remove '<firstname>_<lastname>'\n        arg_5, arg_6 = arg_4.split('_')\n        arg_7 = arg_3.pop()\n        arg_8 = arg_1.communicator.get_user_by_name(arg_5, arg_6)\n        arg_9 = _descend_folder_for_id(arg_3, arg_8['folder_id'])\n        return _search_folder_for_item_or_folder(arg_7, arg_9)\n    elif arg_0.startswith('/communities/'):\n        print(arg_3)\n        arg_3.pop(0)  # remove '' before /\n        arg_3.pop(0)  # remove 'communities'\n        arg_10 = arg_3.pop(0)  # remove '<community>'\n        arg_7 = arg_3.pop()\n        arg_11 = arg_1.communicator.get_community_by_name(arg_10)\n        arg_9 = _descend_folder_for_id(arg_3,\n                                                arg_11['folder_id'])\n        return _search_folder_for_item_or_folder(arg_7, arg_9)\n    else:\n        return False, -1", "path": "pydas/api.py", "identifier": "_find_resource_id_from_path", "docstring": "Get a folder id from a path on the server.\n\n    Warning: This is NOT efficient at all.\n\n    The schema for this path is:\n    path := \"/users/<name>/\" | \"/communities/<name>\" , {<subfolder>/}\n    name := <firstname> , \"_\" , <lastname>\n\n    :param path: The virtual path on the server.\n    :type path: string\n    :returns: a tuple indicating True or False about whether the resource is an\n        item and id of the resource i.e. (True, item_id) or (False, folder_id)\n    :rtype: (bool, int | long)", "docstring_tokens": ["Get", "a", "folder", "id", "from", "a", "path", "on", "the", "server", "."], "nwo": "midasplatform/pydas", "score": 0.21302904236143622, "idx": 261348}
{"url": "https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L471-L482", "sha": "91e50369c7a9c048c83d217625578b72423cd5a7", "docstring_summary": "Map a 1D array the same dimension as the grid to its original masked 2D array and return it as a scaled \\\n        array.", "language": "python", "parameters": "(self, array_1d)", "return_statement": "return scaled_array.ScaledSquarePixelArray(array=self.array_2d_from_array_1d(array_1d),\n                                                   pixel_scale=self.mask.pixel_scale,\n                                                   origin=self.mask.origin)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "return", "scaled_array", ".", "ScaledSquarePixelArray", "(", "array", "=", "arg_0", ".", "array_2d_from_array_1d", "(", "arg_1", ")", ",", "pixel_scale", "=", "arg_0", ".", "mask", ".", "pixel_scale", ",", "origin", "=", "arg_0", ".", "mask", ".", "origin", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Map a 1D array the same dimension as the grid to its original masked 2D array and return it as a scaled \\\n        array.\n\n        Parameters\n        -----------\n        array_1d : ndarray\n            The 1D array of which is mapped to a 2D scaled array.\n        \"\"\"\n        return scaled_array.ScaledSquarePixelArray(array=arg_0.array_2d_from_array_1d(arg_1),\n                                                   pixel_scale=arg_0.mask.pixel_scale,\n                                                   origin=arg_0.mask.origin)", "path": "autolens/data/array/grids.py", "identifier": "RegularGrid.scaled_array_2d_from_array_1d", "docstring": "Map a 1D array the same dimension as the grid to its original masked 2D array and return it as a scaled \\\n        array.\n\n        Parameters\n        -----------\n        array_1d : ndarray\n            The 1D array of which is mapped to a 2D scaled array.", "docstring_tokens": ["Map", "a", "1D", "array", "the", "same", "dimension", "as", "the", "grid", "to", "its", "original", "masked", "2D", "array", "and", "return", "it", "as", "a", "scaled", "\\", "array", "."], "nwo": "Jammy2211/PyAutoLens", "score": 0.5473199673219723, "idx": 261349}
{"url": "https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L434-L441", "sha": "7fe62732eb5194b7246215d5277fb37c398097bf", "docstring_summary": "Retrieves the domains of the users from elastic.", "language": "python", "parameters": "(self)", "return_statement": "return [entry.key for entry in response.aggregations.domains.buckets]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "User", ".", "search", "(", ")", "arg_1", ".", "aggs", ".", "bucket", "(", "'domains'", ",", "'terms'", ",", "field", "=", "'domain'", ",", "order", "=", "{", "'_count'", ":", "'desc'", "}", ",", "size", "=", "100", ")", "arg_2", "=", "arg_1", ".", "execute", "(", ")", "return", "[", "arg_3", ".", "key", "for", "arg_3", "in", "arg_2", ".", "aggregations", ".", "domains", ".", "buckets", "]"], "function": "def Func(arg_0):\n        \"\"\"\n            Retrieves the domains of the users from elastic.\n        \"\"\"\n        arg_1 = User.search()\n        arg_1.aggs.bucket('domains', 'terms', field='domain', order={'_count': 'desc'}, size=100)\n        arg_2 = arg_1.execute()\n        return [arg_3.key for arg_3 in arg_2.aggregations.domains.buckets]", "path": "jackal/core.py", "identifier": "UserSearch.get_domains", "docstring": "Retrieves the domains of the users from elastic.", "docstring_tokens": ["Retrieves", "the", "domains", "of", "the", "users", "from", "elastic", "."], "nwo": "mwgielen/jackal", "score": 0.15726537023232431, "idx": 261350}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskreschedule.py#L67-L85", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Returns all task reschedules for the task instance and try number,\n        in ascending order.", "language": "python", "parameters": "(task_instance, session)", "return_statement": "return (\n            session\n            .query(TR)\n            .filter(TR.dag_id == task_instance.dag_id,\n                    TR.task_id == task_instance.task_id,\n                    TR.execution_date == task_instance.execution_date,\n                    TR.try_number == task_instance.try_number)\n            .order_by(asc(TR.id))\n            .all()\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "TaskReschedule", "return", "(", "arg_1", ".", "query", "(", "arg_2", ")", ".", "filter", "(", "arg_2", ".", "dag_id", "==", "arg_0", ".", "dag_id", ",", "arg_2", ".", "task_id", "==", "arg_0", ".", "task_id", ",", "arg_2", ".", "execution_date", "==", "arg_0", ".", "execution_date", ",", "arg_2", ".", "try_number", "==", "arg_0", ".", "try_number", ")", ".", "order_by", "(", "asc", "(", "arg_2", ".", "id", ")", ")", ".", "all", "(", ")", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Returns all task reschedules for the task instance and try number,\n        in ascending order.\n\n        :param task_instance: the task instance to find task reschedules for\n        :type task_instance: airflow.models.TaskInstance\n        \"\"\"\n        arg_2 = TaskReschedule\n        return (\n            arg_1\n            .query(arg_2)\n            .filter(arg_2.dag_id == arg_0.dag_id,\n                    arg_2.task_id == arg_0.task_id,\n                    arg_2.execution_date == arg_0.execution_date,\n                    arg_2.try_number == arg_0.try_number)\n            .order_by(asc(arg_2.id))\n            .all()\n        )", "path": "airflow/models/taskreschedule.py", "identifier": "TaskReschedule.find_for_task_instance", "docstring": "Returns all task reschedules for the task instance and try number,\n        in ascending order.\n\n        :param task_instance: the task instance to find task reschedules for\n        :type task_instance: airflow.models.TaskInstance", "docstring_tokens": ["Returns", "all", "task", "reschedules", "for", "the", "task", "instance", "and", "try", "number", "in", "ascending", "order", "."], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261351}
{"url": "https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/core.py#L717-L734", "sha": "b16778399b9528efbd71434842a079f7691a7a66", "docstring_summary": "Add observations from column-major storage.", "language": "python", "parameters": "(self, columns)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "append_records", "(", "[", "dict", "(", "time", "=", "arg_2", ",", "duration", "=", "arg_3", ",", "value", "=", "arg_4", ",", "confidence", "=", "arg_5", ")", "for", "(", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", "in", "six", ".", "moves", ".", "zip", "(", "arg_1", "[", "'time'", "]", ",", "arg_1", "[", "'duration'", "]", ",", "arg_1", "[", "'value'", "]", ",", "arg_1", "[", "'confidence'", "]", ")", "]", ")"], "function": "def Func(arg_0, arg_1):\n        '''Add observations from column-major storage.\n\n        This is primarily used for deserializing densely packed data.\n\n        Parameters\n        ----------\n        columns : dict of lists\n            Keys must be `time, duration, value, confidence`,\n            and each much be a list of equal length.\n\n        '''\n        arg_0.append_records([dict(time=arg_2, duration=arg_3, value=arg_4, confidence=arg_5)\n                             for (arg_2, arg_3, arg_4, arg_5)\n                             in six.moves.zip(arg_1['time'],\n                                              arg_1['duration'],\n                                              arg_1['value'],\n                                              arg_1['confidence'])])", "path": "jams/core.py", "identifier": "Annotation.append_columns", "docstring": "Add observations from column-major storage.\n\n        This is primarily used for deserializing densely packed data.\n\n        Parameters\n        ----------\n        columns : dict of lists\n            Keys must be `time, duration, value, confidence`,\n            and each much be a list of equal length.", "docstring_tokens": ["Add", "observations", "from", "column", "-", "major", "storage", "."], "nwo": "marl/jams", "score": 0.41097029610471103, "idx": 261352}
{"url": "https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graph.py#L34-L48", "sha": "dce007bd7f078427c73a2a1d6f4b834af1b4dc03", "docstring_summary": "Depth-first search.", "language": "python", "parameters": "(self, root=None)", "return_statement": "return self._DFS_prefix(root)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "if", "not", "arg_1", ":", "arg_1", "=", "arg_0", ".", "_root", "return", "arg_0", ".", "_Func", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Depth-first search.\n\n        .. seealso::\n           `Wikipedia DFS descritpion <http://en.wikipedia.org/wiki/Depth-first_search>`_\n\n        :param root: first to start the search\n        :return: list of nodes\n        \"\"\"\n\n        if not arg_1:\n            arg_1 = arg_0._root\n\n        return arg_0._Func(arg_1)", "path": "pygraphml/graph.py", "identifier": "Graph.DFS_prefix", "docstring": "Depth-first search.\n\n        .. seealso::\n           `Wikipedia DFS descritpion <http://en.wikipedia.org/wiki/Depth-first_search>`_\n\n        :param root: first to start the search\n        :return: list of nodes", "docstring_tokens": ["Depth", "-", "first", "search", "."], "nwo": "hadim/pygraphml", "score": 0.33005860181868024, "idx": 261353}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L562-L596", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This concatenates all text LCs for the given objectidlist.", "language": "python", "parameters": "(lcbasedir,\n                          objectidlist,\n                          aperture='TF1',\n                          postfix='.gz',\n                          sortby='rjd',\n                          normalize=True,\n                          outdir=None,\n                          recursive=True,\n                          nworkers=32,\n                          maxworkertasks=1000)", "return_statement": "return {x:y for (x,y) in zip(objectidlist, results)}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'TF1'", ",", "arg_3", "=", "'.gz'", ",", "arg_4", "=", "'rjd'", ",", "arg_5", "=", "True", ",", "arg_6", "=", "None", ",", "arg_7", "=", "True", ",", "arg_8", "=", "32", ",", "arg_9", "=", "1000", ")", ":", "if", "not", "arg_6", ":", "arg_6", "=", "'pklcs'", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "os", ".", "mkdir", "(", "arg_6", ")", "arg_10", "=", "[", "(", "arg_0", ",", "arg_13", ",", "{", "'aperture'", ":", "arg_2", ",", "'postfix'", ":", "arg_3", ",", "'sortby'", ":", "arg_4", ",", "'normalize'", ":", "arg_5", ",", "'outdir'", ":", "arg_6", ",", "'recursive'", ":", "arg_7", "}", ")", "for", "arg_13", "in", "arg_1", "]", "arg_11", "=", "mp", ".", "Pool", "(", "arg_8", ",", "maxtasksperchild", "=", "arg_9", ")", "arg_12", "=", "arg_11", ".", "map", "(", "parallel_concat_worker", ",", "arg_10", ")", "arg_11", ".", "close", "(", ")", "arg_11", ".", "join", "(", ")", "return", "{", "arg_13", ":", "arg_14", "for", "(", "arg_13", ",", "arg_14", ")", "in", "zip", "(", "arg_1", ",", "arg_12", ")", "}"], "function": "def Func(arg_0,\n                          arg_1,\n                          arg_2='TF1',\n                          arg_3='.gz',\n                          arg_4='rjd',\n                          arg_5=True,\n                          arg_6=None,\n                          arg_7=True,\n                          arg_8=32,\n                          arg_9=1000):\n    '''This concatenates all text LCs for the given objectidlist.\n\n\n    '''\n\n    if not arg_6:\n        arg_6 = 'pklcs'\n\n    if not os.path.exists(arg_6):\n        os.mkdir(arg_6)\n\n    arg_10 = [(arg_0, arg_13, {'aperture':arg_2,\n                             'postfix':arg_3,\n                             'sortby':arg_4,\n                             'normalize':arg_5,\n                             'outdir':arg_6,\n                             'recursive':arg_7}) for arg_13 in arg_1]\n\n    arg_11 = mp.Pool(arg_8, maxtasksperchild=arg_9)\n    arg_12 = arg_11.map(parallel_concat_worker, arg_10)\n\n    arg_11.close()\n    arg_11.join()\n\n    return {arg_13:arg_14 for (arg_13,arg_14) in zip(arg_1, arg_12)}", "path": "astrobase/hatsurveys/hplc.py", "identifier": "parallel_concat_lcdir", "docstring": "This concatenates all text LCs for the given objectidlist.", "docstring_tokens": ["This", "concatenates", "all", "text", "LCs", "for", "the", "given", "objectidlist", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 261354}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L1830-L1840", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Return a new ``GroupBy`` object using this frame and the desired grouping columns.", "language": "python", "parameters": "(self, by)", "return_statement": "return GroupBy(self, by)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "assert_is_type", "(", "arg_1", ",", "str", ",", "int", ",", "[", "str", ",", "int", "]", ")", "return", "GroupBy", "(", "arg_0", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Return a new ``GroupBy`` object using this frame and the desired grouping columns.\n\n        The returned groups are sorted by the natural group-by column sort.\n\n        :param by: The columns to group on (either a single column name, or a list of column names, or\n            a list of column indices).\n        \"\"\"\n        assert_is_type(arg_1, str, int, [str, int])\n        return GroupBy(arg_0, arg_1)", "path": "h2o-py/h2o/frame.py", "identifier": "H2OFrame.group_by", "docstring": "Return a new ``GroupBy`` object using this frame and the desired grouping columns.\n\n        The returned groups are sorted by the natural group-by column sort.\n\n        :param by: The columns to group on (either a single column name, or a list of column names, or\n            a list of column indices).", "docstring_tokens": ["Return", "a", "new", "GroupBy", "object", "using", "this", "frame", "and", "the", "desired", "grouping", "columns", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 261355}
{"url": "https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/docs/conf.py#L182-L193", "sha": "520a8d992230e382f08e315ede5fc477f5e26bfb", "docstring_summary": "Enable markdown syntax in docstrings", "language": "python", "parameters": "(app, what, name, obj, options, lines)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "\"\\n\"", ".", "join", "(", "arg_5", ")", "arg_7", "=", "m2r", "(", "arg_6", ")", "arg_7", ".", "replace", "(", "\"\\r\\n\"", ",", "\"\\n\"", ")", "del", "arg_5", "[", ":", "]", "arg_5", ".", "extend", "(", "arg_7", ".", "split", "(", "\"\\n\"", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\"Enable markdown syntax in docstrings\"\"\"\n    \n    arg_6 = \"\\n\".join(arg_5)\n\n    # ast = cm_parser.parse(markdown)\n    # html = cm_renderer.render(ast)\n    arg_7 = m2r(arg_6)\n\n    arg_7.replace(\"\\r\\n\", \"\\n\")\n    del arg_5[:]\n    arg_5.extend(arg_7.split(\"\\n\"))", "path": "docs/conf.py", "identifier": "process_docstring", "docstring": "Enable markdown syntax in docstrings", "docstring_tokens": ["Enable", "markdown", "syntax", "in", "docstrings"], "nwo": "tensorforce/tensorforce", "score": 0.9811516139513479, "idx": 261356}
{"url": "https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/postgres_hook.py#L91-L95", "sha": "b69c686ad8a0c89b9136bb4b31767257eb7b2597", "docstring_summary": "Dumps a database table into a tab-delimited file", "language": "python", "parameters": "(self, table, tmp_file)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "copy_expert", "(", "\"COPY {table} TO STDOUT\"", ".", "format", "(", "arg_1", "=", "arg_1", ")", ",", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"\n        Dumps a database table into a tab-delimited file\n        \"\"\"\n        arg_0.copy_expert(\"COPY {table} TO STDOUT\".format(arg_1=arg_1), arg_2)", "path": "airflow/hooks/postgres_hook.py", "identifier": "PostgresHook.bulk_dump", "docstring": "Dumps a database table into a tab-delimited file", "docstring_tokens": ["Dumps", "a", "database", "table", "into", "a", "tab", "-", "delimited", "file"], "nwo": "apache/airflow", "score": 0.9994400765917697, "idx": 261357}
{"url": "https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L904-L923", "sha": "d7306fde32f60a293a7567678692bdad31e4b667", "docstring_summary": "Returns the public data for the specified X.509 certificate associated\n        with a hosted service.", "language": "python", "parameters": "(self, service_name, thumbalgorithm, thumbprint)", "return_statement": "return self._perform_get(\n            '/' + self.subscription_id + '/services/hostedservices/' +\n            _str(service_name) + '/certificates/' +\n            _str(thumbalgorithm) + '-' + _str(thumbprint) + '',\n            Certificate)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "_validate_not_none", "(", "'service_name'", ",", "arg_1", ")", "_validate_not_none", "(", "'thumbalgorithm'", ",", "arg_2", ")", "_validate_not_none", "(", "'thumbprint'", ",", "arg_3", ")", "return", "arg_0", ".", "_perform_get", "(", "'/'", "+", "arg_0", ".", "subscription_id", "+", "'/services/hostedservices/'", "+", "_str", "(", "arg_1", ")", "+", "'/certificates/'", "+", "_str", "(", "arg_2", ")", "+", "'-'", "+", "_str", "(", "arg_3", ")", "+", "''", ",", "Certificate", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        '''\n        Returns the public data for the specified X.509 certificate associated\n        with a hosted service.\n\n        service_name:\n            Name of the hosted service.\n        thumbalgorithm:\n            The algorithm for the certificate's thumbprint.\n        thumbprint:\n            The hexadecimal representation of the thumbprint.\n        '''\n        _validate_not_none('service_name', arg_1)\n        _validate_not_none('thumbalgorithm', arg_2)\n        _validate_not_none('thumbprint', arg_3)\n        return arg_0._perform_get(\n            '/' + arg_0.subscription_id + '/services/hostedservices/' +\n            _str(arg_1) + '/certificates/' +\n            _str(arg_2) + '-' + _str(arg_3) + '',\n            Certificate)", "path": "azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py", "identifier": "ServiceManagementService.get_service_certificate", "docstring": "Returns the public data for the specified X.509 certificate associated\n        with a hosted service.\n\n        service_name:\n            Name of the hosted service.\n        thumbalgorithm:\n            The algorithm for the certificate's thumbprint.\n        thumbprint:\n            The hexadecimal representation of the thumbprint.", "docstring_tokens": ["Returns", "the", "public", "data", "for", "the", "specified", "X", ".", "509", "certificate", "associated", "with", "a", "hosted", "service", "."], "nwo": "Azure/azure-sdk-for-python", "score": 0.9896694324020353, "idx": 261358}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L268-L276", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Create a new notebook and return its notebook_id.", "language": "python", "parameters": "(self)", "return_statement": "return notebook_id", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", ",", "arg_2", "=", "arg_0", ".", "increment_filename", "(", "'Untitled'", ")", "arg_3", "=", "arg_0", ".", "Func_id", "(", "arg_2", ")", "arg_4", "=", "current", ".", "new_metadata", "(", "arg_2", "=", "arg_2", ")", "arg_5", "=", "current", ".", "Func", "(", "arg_4", "=", "arg_4", ")", "with", "open", "(", "arg_1", ",", "'w'", ")", "as", "f", ":", "current", ".", "write", "(", "arg_5", ",", "f", ",", "u'json'", ")", "return", "arg_3"], "function": "def Func(arg_0):\n        \"\"\"Create a new notebook and return its notebook_id.\"\"\"\n        arg_1, arg_2 = arg_0.increment_filename('Untitled')\n        arg_3 = arg_0.Func_id(arg_2)\n        arg_4 = current.new_metadata(arg_2=arg_2)\n        arg_5 = current.Func(arg_4=arg_4)\n        with open(arg_1,'w') as f:\n            current.write(arg_5, f, u'json')\n        return arg_3", "path": "environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py", "identifier": "NotebookManager.new_notebook", "docstring": "Create a new notebook and return its notebook_id.", "docstring_tokens": ["Create", "a", "new", "notebook", "and", "return", "its", "notebook_id", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261359}
{"url": "https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/db.py#L129-L212", "sha": "b2a5108f7b40cb0c437509b64eaa28f941f7ac8b", "docstring_summary": "For a given issue issue, find its local UUID.", "language": "python", "parameters": "(tw, keys, issue, legacy_matching=False)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "False", ")", ":", "if", "not", "arg_2", "[", "'description'", "]", ":", "raise", "ValueError", "(", "'Issue %s has no description.'", "%", "arg_2", ")", "arg_4", "=", "set", "(", "[", "]", ")", "if", "arg_3", ":", "arg_5", "=", "arg_2", ".", "get_default_description", "(", ")", ".", "rsplit", "(", "'..'", ",", "1", ")", "[", "0", "]", "arg_5", "=", "arg_5", ".", "split", "(", "\"'\"", ")", "[", "0", "]", "arg_6", "=", "arg_0", ".", "filter_tasks", "(", "{", "'description.startswith'", ":", "arg_5", ",", "'or'", ":", "[", "(", "'status'", ",", "'pending'", ")", ",", "(", "'status'", ",", "'waiting'", ")", ",", "]", ",", "}", ")", "arg_4", "=", "arg_4", "|", "set", "(", "[", "task", "[", "'uuid'", "]", "for", "task", "in", "arg_6", "]", ")", "for", "arg_7", ",", "arg_8", "in", "six", ".", "iteritems", "(", "arg_1", ")", ":", "if", "any", "(", "[", "arg_9", "in", "arg_2", "for", "arg_9", "in", "arg_8", "]", ")", ":", "arg_6", "=", "arg_0", ".", "filter_tasks", "(", "{", "'and'", ":", "[", "(", "\"%s.is\"", "%", "arg_9", ",", "arg_2", "[", "arg_9", "]", ")", "for", "arg_9", "in", "arg_8", "]", ",", "'or'", ":", "[", "(", "'status'", ",", "'pending'", ")", ",", "(", "'status'", ",", "'waiting'", ")", ",", "]", ",", "}", ")", "arg_4", "=", "arg_4", "|", "set", "(", "[", "task", "[", "'uuid'", "]", "for", "task", "in", "arg_6", "]", ")", "if", "len", "(", "arg_4", ")", "==", "1", ":", "return", "arg_4", ".", "pop", "(", ")", "if", "len", "(", "arg_4", ")", ">", "1", ":", "raise", "MultipleMatches", "(", "\"Issue %s matched multiple IDs: %s\"", "%", "(", "arg_2", "[", "'description'", "]", ",", "arg_4", ")", ")", "raise", "NotFound", "(", "\"No issue was found matching %s\"", "%", "arg_2", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=False):\n    \"\"\" For a given issue issue, find its local UUID.\n\n    Assembles a list of task IDs existing in taskwarrior\n    matching the supplied issue (`issue`) on the combination of any\n    set of supplied unique identifiers (`keys`) or, optionally,\n    the task's description field (should `legacy_matching` be `True`).\n\n    :params:\n    * `tw`: An instance of `taskw.TaskWarriorShellout`\n    * `keys`: A list of lists of keys to use for uniquely identifying\n      an issue.  To clarify the \"list of lists\" behavior, assume that\n      there are two services, one having a single primary key field\n      -- 'serviceAid' -- and another having a pair of fields composing\n      its primary key -- 'serviceBproject' and 'serviceBnumber' --, the\n      incoming data for this field would be::\n\n        [\n            ['serviceAid'],\n            ['serviceBproject', 'serviceBnumber'],\n        ]\n\n    * `issue`: An instance of a subclass of `bugwarrior.services.Issue`.\n    * `legacy_matching`: By default, this is disabled, and it allows\n      the matching algorithm to -- in addition to searching by stored\n      issue keys -- search using the task's description for a match.\n      It is prone to error and should avoided if possible.\n\n    :returns:\n    * A single string UUID.\n\n    :raises:\n    * `bugwarrior.db.MultipleMatches`: if multiple matches were found.\n    * `bugwarrior.db.NotFound`: if an issue was not found.\n\n    \"\"\"\n    if not arg_2['description']:\n        raise ValueError('Issue %s has no description.' % arg_2)\n\n    arg_4 = set([])\n\n    if arg_3:\n        arg_5 = arg_2.get_default_description().rsplit('..', 1)[0]\n        # Furthermore, we have to kill off any single quotes which break in\n        # task-2.4.x, as much as it saddens me.\n        arg_5 = arg_5.split(\"'\")[0]\n        arg_6 = arg_0.filter_tasks({\n            'description.startswith': arg_5,\n            'or': [\n                ('status', 'pending'),\n                ('status', 'waiting'),\n            ],\n        })\n        arg_4 = arg_4 | set([\n            task['uuid'] for task in arg_6\n        ])\n\n    for arg_7, arg_8 in six.iteritems(arg_1):\n        if any([arg_9 in arg_2 for arg_9 in arg_8]):\n            arg_6 = arg_0.filter_tasks({\n                'and': [(\"%s.is\" % arg_9, arg_2[arg_9]) for arg_9 in arg_8],\n                'or': [\n                    ('status', 'pending'),\n                    ('status', 'waiting'),\n                ],\n            })\n            arg_4 = arg_4 | set([\n                task['uuid'] for task in arg_6\n            ])\n\n    if len(arg_4) == 1:\n        return arg_4.pop()\n\n    if len(arg_4) > 1:\n        raise MultipleMatches(\n            \"Issue %s matched multiple IDs: %s\" % (\n                arg_2['description'],\n                arg_4\n            )\n        )\n\n    raise NotFound(\n        \"No issue was found matching %s\" % arg_2\n    )", "path": "bugwarrior/db.py", "identifier": "find_local_uuid", "docstring": "For a given issue issue, find its local UUID.\n\n    Assembles a list of task IDs existing in taskwarrior\n    matching the supplied issue (`issue`) on the combination of any\n    set of supplied unique identifiers (`keys`) or, optionally,\n    the task's description field (should `legacy_matching` be `True`).\n\n    :params:\n    * `tw`: An instance of `taskw.TaskWarriorShellout`\n    * `keys`: A list of lists of keys to use for uniquely identifying\n      an issue.  To clarify the \"list of lists\" behavior, assume that\n      there are two services, one having a single primary key field\n      -- 'serviceAid' -- and another having a pair of fields composing\n      its primary key -- 'serviceBproject' and 'serviceBnumber' --, the\n      incoming data for this field would be::\n\n        [\n            ['serviceAid'],\n            ['serviceBproject', 'serviceBnumber'],\n        ]\n\n    * `issue`: An instance of a subclass of `bugwarrior.services.Issue`.\n    * `legacy_matching`: By default, this is disabled, and it allows\n      the matching algorithm to -- in addition to searching by stored\n      issue keys -- search using the task's description for a match.\n      It is prone to error and should avoided if possible.\n\n    :returns:\n    * A single string UUID.\n\n    :raises:\n    * `bugwarrior.db.MultipleMatches`: if multiple matches were found.\n    * `bugwarrior.db.NotFound`: if an issue was not found.", "docstring_tokens": ["For", "a", "given", "issue", "issue", "find", "its", "local", "UUID", "."], "nwo": "ralphbean/bugwarrior", "score": 0.7772106714844577, "idx": 261360}
{"url": "https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/joint_distribution_sequential.py#L475-L487", "sha": "e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5", "docstring_summary": "Returns the distribution's required args.", "language": "python", "parameters": "(fn)", "return_statement": "return tuple(args)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "tf_inspect", ".", "getfullargspec", "(", "arg_0", ")", "arg_2", "=", "arg_1", ".", "args", "if", "tf_inspect", ".", "isclass", "(", "arg_0", ")", ":", "arg_2", "=", "arg_2", "[", "1", ":", "]", "if", "arg_1", ".", "defaults", ":", "arg_2", "=", "arg_2", "[", ":", "-", "len", "(", "arg_1", ".", "defaults", ")", "]", "return", "tuple", "(", "arg_2", ")"], "function": "def Func(arg_0):\n  \"\"\"Returns the distribution's required args.\"\"\"\n  arg_1 = tf_inspect.getfullargspec(arg_0)\n  arg_2 = arg_1.args\n  if tf_inspect.isclass(arg_0):\n    arg_2 = arg_2[1:]  # Remove the `self` arg.\n  if arg_1.defaults:\n    # Remove the args which have defaults. By convention we only feed\n    # *required args*. This means some distributions must always be wrapped\n    # with a `lambda`, e.g., `lambda logits: tfd.Bernoulli(logits=logits)`\n    # or `lambda probs: tfd.Bernoulli(probs=probs)`.\n    arg_2 = arg_2[:-len(arg_1.defaults)]\n  return tuple(arg_2)", "path": "tensorflow_probability/python/distributions/joint_distribution_sequential.py", "identifier": "_get_required_args", "docstring": "Returns the distribution's required args.", "docstring_tokens": ["Returns", "the", "distribution", "s", "required", "args", "."], "nwo": "tensorflow/probability", "score": 0.9937575147981225, "idx": 261361}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/__init__.py#L25-L38", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Set neurosynth's logging level", "language": "python", "parameters": "(level=None)", "return_statement": "return logger.getEffectiveLevel()", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", "=", "None", ")", ":", "if", "arg_0", "is", "None", ":", "arg_0", "=", "os", ".", "environ", ".", "get", "(", "'NEUROSYNTH_LOGLEVEL'", ",", "'warn'", ")", "if", "arg_0", "is", "not", "None", ":", "logger", ".", "setLevel", "(", "getattr", "(", "logging", ",", "arg_0", ".", "upper", "(", ")", ")", ")", "return", "logger", ".", "getEffectiveLevel", "(", ")"], "function": "def Func(arg_0=None):\n    \"\"\"Set neurosynth's logging level\n\n    Args\n      level : str\n        Name of the logging level (warning, error, info, etc) known\n        to logging module.  If no level provided, it would get that one\n        from environment variable NEUROSYNTH_LOGLEVEL\n    \"\"\"\n    if arg_0 is None:\n        arg_0 = os.environ.get('NEUROSYNTH_LOGLEVEL', 'warn')\n    if arg_0 is not None:\n        logger.setLevel(getattr(logging, arg_0.upper()))\n    return logger.getEffectiveLevel()", "path": "neurosynth/__init__.py", "identifier": "set_logging_level", "docstring": "Set neurosynth's logging level\n\n    Args\n      level : str\n        Name of the logging level (warning, error, info, etc) known\n        to logging module.  If no level provided, it would get that one\n        from environment variable NEUROSYNTH_LOGLEVEL", "docstring_tokens": ["Set", "neurosynth", "s", "logging", "level"], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 261362}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/error_summary.py#L167-L176", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Takes the names from the graph in a given namespace and the erroneous names from the same namespace and returns\n    them together as a unioned set", "language": "python", "parameters": "(graph: BELGraph)", "return_statement": "return {\n        namespace: get_names_including_errors_by_namespace(graph, namespace)\n        for namespace in get_namespaces(graph)\n    }", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ")", "->", "Mapping", "[", "str", ",", "Set", "[", "str", "]", "]", ":", "return", "{", "arg_2", ":", "Func_by_namespace", "(", "arg_0", ",", "arg_2", ")", "for", "arg_2", "in", "get_namespaces", "(", "arg_0", ")", "}"], "function": "def Func(arg_0: arg_1) -> Mapping[str, Set[str]]:\n    \"\"\"Takes the names from the graph in a given namespace and the erroneous names from the same namespace and returns\n    them together as a unioned set\n\n    :return: The dict of the sets of all correct and incorrect names from the given namespace in the graph\n    \"\"\"\n    return {\n        arg_2: Func_by_namespace(arg_0, arg_2)\n        for arg_2 in get_namespaces(arg_0)\n    }", "path": "src/pybel_tools/summary/error_summary.py", "identifier": "get_names_including_errors", "docstring": "Takes the names from the graph in a given namespace and the erroneous names from the same namespace and returns\n    them together as a unioned set\n\n    :return: The dict of the sets of all correct and incorrect names from the given namespace in the graph", "docstring_tokens": ["Takes", "the", "names", "from", "the", "graph", "in", "a", "given", "namespace", "and", "the", "erroneous", "names", "from", "the", "same", "namespace", "and", "returns", "them", "together", "as", "a", "unioned", "set"], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 261363}
{"url": "https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/trajectory.py#L1475-L1486", "sha": "97ad3e80d46dbdea02deeb98ea41f05a19565826", "docstring_summary": "Final rollback initiated by the environment", "language": "python", "parameters": "(self, store_meta_data=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ")", ":", "arg_0", ".", "_is_run", "=", "False", "arg_0", ".", "f_set_crun", "(", "None", ")", "if", "arg_1", ":", "arg_0", ".", "f_store", "(", "only_init", "=", "True", ")"], "function": "def Func(arg_0, arg_1=True):\n        \"\"\"Final rollback initiated by the environment\n\n        Restores the trajectory as root of the tree, and stores meta data to disk.\n        This updates the trajectory's information about single runs, i.e. if they've been\n        completed, when they were started, etc.\n\n        \"\"\"\n        arg_0._is_run = False\n        arg_0.f_set_crun(None)\n        if arg_1:\n            arg_0.f_store(only_init=True)", "path": "pypet/trajectory.py", "identifier": "Trajectory._finalize", "docstring": "Final rollback initiated by the environment\n\n        Restores the trajectory as root of the tree, and stores meta data to disk.\n        This updates the trajectory's information about single runs, i.e. if they've been\n        completed, when they were started, etc.", "docstring_tokens": ["Final", "rollback", "initiated", "by", "the", "environment"], "nwo": "SmokinCaterpillar/pypet", "score": 0.3804160374473955, "idx": 261364}
{"url": "https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/reference.py#L86-L93", "sha": "32fd036d64fab19c554e841f162466f6eb28b50f", "docstring_summary": "Increments the number of times this resource has been modified by all\n        processes.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "conn", ".", "client", ".", "incr", "(", "arg_0", ".", "times_modified_key", ")", "arg_0", ".", "conn", ".", "client", ".", "pexpire", "(", "arg_0", ".", "times_modified_key", ",", "phonon", ".", "s_to_ms", "(", "TTL", ")", ")"], "function": "def Func(arg_0):\n        \"\"\"\n        Increments the number of times this resource has been modified by all\n        processes.\n        \"\"\"\n        arg_1 = arg_0.conn.client.incr(arg_0.times_modified_key)\n        arg_0.conn.client.pexpire(arg_0.times_modified_key,\n                                 phonon.s_to_ms(TTL))", "path": "phonon/reference.py", "identifier": "Reference.increment_times_modified", "docstring": "Increments the number of times this resource has been modified by all\n        processes.", "docstring_tokens": ["Increments", "the", "number", "of", "times", "this", "resource", "has", "been", "modified", "by", "all", "processes", "."], "nwo": "buzzfeed/phonon", "score": 0.2757871243566705, "idx": 261365}
{"url": "https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L1311-L1321", "sha": "dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8", "docstring_summary": "Obtain a list of cross-validation models.", "language": "python", "parameters": "(self)", "return_statement": "return m", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_model_json", "[", "\"output\"", "]", "[", "\"Func\"", "]", "if", "arg_1", "is", "None", ":", "return", "None", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "arg_2", ".", "append", "(", "h2o", ".", "get_model", "(", "arg_3", "[", "\"name\"", "]", ")", ")", "return", "arg_2"], "function": "def Func(arg_0):\n        \"\"\"\n        Obtain a list of cross-validation models.\n\n        :returns: list of H2OModel objects.\n        \"\"\"\n        arg_1 = arg_0._model_json[\"output\"][\"Func\"]\n        if arg_1 is None: return None\n        arg_2 = []\n        for arg_3 in arg_1: arg_2.append(h2o.get_model(arg_3[\"name\"]))\n        return arg_2", "path": "h2o-py/h2o/model/model_base.py", "identifier": "ModelBase.cross_validation_models", "docstring": "Obtain a list of cross-validation models.\n\n        :returns: list of H2OModel objects.", "docstring_tokens": ["Obtain", "a", "list", "of", "cross", "-", "validation", "models", "."], "nwo": "h2oai/h2o-3", "score": 0.9922845645433422, "idx": 261366}
{"url": "https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/util.py#L254-L272", "sha": "8b5607a856341df85df33422accc30ba9294dbdb", "docstring_summary": "This is a basic full-text index keygen function. Words are lowercased, split\n    by whitespace, and stripped of punctuation from both ends before an inverted\n    index is created for term searching.", "language": "python", "parameters": "(val)", "return_statement": "return r", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "isinstance", "(", "arg_0", ",", "float", ")", ":", "arg_0", "=", "repr", "(", "arg_0", ")", "elif", "arg_0", "in", "(", "None", ",", "''", ")", ":", "return", "None", "elif", "not", "isinstance", "(", "arg_0", ",", "six", ".", "string_types", ")", ":", "if", "six", ".", "PY3", "and", "isinstance", "(", "arg_0", ",", "bytes", ")", ":", "arg_0", "=", "arg_0", ".", "decode", "(", "'latin-1'", ")", "else", ":", "arg_0", "=", "str", "(", "arg_0", ")", "arg_1", "=", "sorted", "(", "set", "(", "[", "x", "for", "x", "in", "[", "arg_2", ".", "lower", "(", ")", ".", "strip", "(", "string", ".", "punctuation", ")", "for", "arg_2", "in", "arg_0", ".", "split", "(", ")", "]", "if", "x", "]", ")", ")", "if", "not", "isinstance", "(", "arg_0", ",", "str", ")", ":", "return", "[", "arg_2", ".", "encode", "(", "'utf-8'", ")", "for", "arg_2", "in", "arg_1", "]", "return", "arg_1"], "function": "def Func(arg_0):\n    '''\n    This is a basic full-text index keygen function. Words are lowercased, split\n    by whitespace, and stripped of punctuation from both ends before an inverted\n    index is created for term searching.\n    '''\n    if isinstance(arg_0, float):\n        arg_0 = repr(arg_0)\n    elif arg_0 in (None, ''):\n        return None\n    elif not isinstance(arg_0, six.string_types):\n        if six.PY3 and isinstance(arg_0, bytes):\n            arg_0 = arg_0.decode('latin-1')\n        else:\n            arg_0 = str(arg_0)\n    arg_1 = sorted(set([x for x in [arg_2.lower().strip(string.punctuation) for arg_2 in arg_0.split()] if x]))\n    if not isinstance(arg_0, str):  # unicode on py2k\n        return [arg_2.encode('utf-8') for arg_2 in arg_1]\n    return arg_1", "path": "rom/util.py", "identifier": "FULL_TEXT", "docstring": "This is a basic full-text index keygen function. Words are lowercased, split\n    by whitespace, and stripped of punctuation from both ends before an inverted\n    index is created for term searching.", "docstring_tokens": ["This", "is", "a", "basic", "full", "-", "text", "index", "keygen", "function", ".", "Words", "are", "lowercased", "split", "by", "whitespace", "and", "stripped", "of", "punctuation", "from", "both", "ends", "before", "an", "inverted", "index", "is", "created", "for", "term", "searching", "."], "nwo": "josiahcarlson/rom", "score": 0.578350737988803, "idx": 261367}
{"url": "https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/models.py#L84-L96", "sha": "d80762d891fa18b248709ff0b0f97ebb65ec64c2", "docstring_summary": "Store a \"populate failed\" event.", "language": "python", "parameters": "(cls, resource: str, session: Optional[Session] = None)", "return_statement": "return action", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ":", "arg_2", ",", "arg_3", ":", "arg_4", "[", "arg_5", "]", "=", "None", ")", "->", "'Action'", ":", "arg_6", "=", "arg_0", ".", "make_populate_failed", "(", "arg_1", ")", "_store_helper", "(", "arg_6", ",", "arg_3", "=", "arg_3", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1: arg_2, arg_3: arg_4[arg_5] = None) -> 'Action':\n        \"\"\"Store a \"populate failed\" event.\n\n        :param resource: The normalized name of the resource to store\n\n        Example:\n\n        >>> from bio2bel.models import Action\n        >>> Action.Func('hgnc')\n        \"\"\"\n        arg_6 = arg_0.make_populate_failed(arg_1)\n        _store_helper(arg_6, arg_3=arg_3)\n        return arg_6", "path": "src/bio2bel/models.py", "identifier": "Action.store_populate_failed", "docstring": "Store a \"populate failed\" event.\n\n        :param resource: The normalized name of the resource to store\n\n        Example:\n\n        >>> from bio2bel.models import Action\n        >>> Action.store_populate_failed('hgnc')", "docstring_tokens": ["Store", "a", "populate", "failed", "event", "."], "nwo": "bio2bel/bio2bel", "score": 0.3726785709016597, "idx": 261368}
{"url": "https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/streamlet.py#L142-L148", "sha": "ad10325a0febe89ad337e561ebcbe37ec5d9a5ac", "docstring_summary": "Logs all elements of this streamlet. This returns nothing", "language": "python", "parameters": "(self)", "return_statement": "return", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "from", "heronpy", ".", "streamlet", ".", "impl", ".", "Funcbolt", "import", "LogStreamlet", "arg_1", "=", "LogStreamlet", "(", "arg_0", ")", "arg_0", ".", "_add_child", "(", "arg_1", ")", "return"], "function": "def Func(arg_0):\n    \"\"\"Logs all elements of this streamlet. This returns nothing\n    \"\"\"\n    from heronpy.streamlet.impl.Funcbolt import LogStreamlet\n    arg_1 = LogStreamlet(arg_0)\n    arg_0._add_child(arg_1)\n    return", "path": "heronpy/streamlet/streamlet.py", "identifier": "Streamlet.log", "docstring": "Logs all elements of this streamlet. This returns nothing", "docstring_tokens": ["Logs", "all", "elements", "of", "this", "streamlet", ".", "This", "returns", "nothing"], "nwo": "apache/incubator-heron", "score": 0.969213053566734, "idx": 261369}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/cli.py#L171-L174", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Output PubMed identifiers from a graph to a stream.", "language": "python", "parameters": "(graph: BELGraph, output: TextIO)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", ")", ":", "for", "arg_4", "in", "get_pubmed_identifiers", "(", "arg_0", ")", ":", "click", ".", "echo", "(", "arg_4", ",", "file", "=", "arg_2", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3):\n    \"\"\"Output PubMed identifiers from a graph to a stream.\"\"\"\n    for arg_4 in get_pubmed_identifiers(arg_0):\n        click.echo(arg_4, file=arg_2)", "path": "src/pybel_tools/cli.py", "identifier": "get_pmids", "docstring": "Output PubMed identifiers from a graph to a stream.", "docstring_tokens": ["Output", "PubMed", "identifiers", "from", "a", "graph", "to", "a", "stream", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 261370}
{"url": "https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/transforms/functional.py#L644-L677", "sha": "3afcf3cd49661c466c75ea536b0b2a7ff57f9a05", "docstring_summary": "r\"\"\"Perform gamma correction on an image.", "language": "python", "parameters": "(img, gamma, gain=1)", "return_statement": "return img", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "1", ")", ":", "if", "not", "_is_pil_image", "(", "arg_0", ")", ":", "raise", "TypeError", "(", "'img should be PIL Image. Got {}'", ".", "format", "(", "type", "(", "arg_0", ")", ")", ")", "if", "arg_1", "<", "0", ":", "raise", "ValueError", "(", "'Gamma should be a non-negative real number'", ")", "arg_3", "=", "arg_0", ".", "mode", "arg_0", "=", "arg_0", ".", "convert", "(", "'RGB'", ")", "arg_4", "=", "[", "255", "*", "arg_2", "*", "pow", "(", "ele", "/", "255.", ",", "arg_1", ")", "for", "ele", "in", "range", "(", "256", ")", "]", "*", "3", "arg_0", "=", "arg_0", ".", "point", "(", "arg_4", ")", "arg_0", "=", "arg_0", ".", "convert", "(", "arg_3", ")", "return", "arg_0"], "function": "def Func(arg_0, arg_1, arg_2=1):\n    r\"\"\"Perform gamma correction on an image.\n\n    Also known as Power Law Transform. Intensities in RGB mode are adjusted\n    based on the following equation:\n\n    .. math::\n        I_{\\text{out}} = 255 \\times \\text{gain} \\times \\left(\\frac{I_{\\text{in}}}{255}\\right)^{\\gamma}\n\n    See `Gamma Correction`_ for more details.\n\n    .. _Gamma Correction: https://en.wikipedia.org/wiki/Gamma_correction\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        gamma (float): Non negative real number, same as :math:`\\gamma` in the equation.\n            gamma larger than 1 make the shadows darker,\n            while gamma smaller than 1 make dark regions lighter.\n        gain (float): The constant multiplier.\n    \"\"\"\n    if not _is_pil_image(arg_0):\n        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))\n\n    if arg_1 < 0:\n        raise ValueError('Gamma should be a non-negative real number')\n\n    arg_3 = arg_0.mode\n    arg_0 = arg_0.convert('RGB')\n\n    arg_4 = [255 * arg_2 * pow(ele / 255., arg_1) for ele in range(256)] * 3\n    arg_0 = arg_0.point(arg_4)  # use PIL's point-function to accelerate this part\n\n    arg_0 = arg_0.convert(arg_3)\n    return arg_0", "path": "torchvision/transforms/functional.py", "identifier": "adjust_gamma", "docstring": "r\"\"\"Perform gamma correction on an image.\n\n    Also known as Power Law Transform. Intensities in RGB mode are adjusted\n    based on the following equation:\n\n    .. math::\n        I_{\\text{out}} = 255 \\times \\text{gain} \\times \\left(\\frac{I_{\\text{in}}}{255}\\right)^{\\gamma}\n\n    See `Gamma Correction`_ for more details.\n\n    .. _Gamma Correction: https://en.wikipedia.org/wiki/Gamma_correction\n\n    Args:\n        img (PIL Image): PIL Image to be adjusted.\n        gamma (float): Non negative real number, same as :math:`\\gamma` in the equation.\n            gamma larger than 1 make the shadows darker,\n            while gamma smaller than 1 make dark regions lighter.\n        gain (float): The constant multiplier.", "docstring_tokens": ["r", "Perform", "gamma", "correction", "on", "an", "image", "."], "nwo": "pytorch/vision", "score": 0.9938861972228624, "idx": 261371}
{"url": "https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L811-L831", "sha": "fc3f4bddded1efc76006600016dc71a06dd908c0", "docstring_summary": "Sets the main raw inputs and secondary inputs on the init process", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "logger", ".", "debug", "(", "\"========================\"", ")", "logger", ".", "debug", "(", "\"Setting secondary inputs\"", ")", "logger", ".", "debug", "(", "\"========================\"", ")", "arg_1", "=", "arg_0", ".", "processes", "[", "0", "]", "logger", ".", "debug", "(", "\"Setting main raw inputs: \"", "\"{}\"", ".", "format", "(", "arg_0", ".", "main_raw_inputs", ")", ")", "arg_1", ".", "set_raw_inputs", "(", "arg_0", ".", "main_raw_inputs", ")", "logger", ".", "debug", "(", "\"Setting extra inputs: {}\"", ".", "format", "(", "arg_0", ".", "extra_inputs", ")", ")", "arg_1", ".", "set_extra_inputs", "(", "arg_0", ".", "extra_inputs", ")"], "function": "def Func(arg_0):\n        \"\"\"Sets the main raw inputs and secondary inputs on the init process\n\n        This method will fetch the :class:`flowcraft.process.Init` process\n        instance and sets the raw input (\n        :func:`flowcraft.process.Init.set_raw_inputs`) for\n        that process. This will handle the connection of the user parameters\n        with channels that are then consumed in the pipeline.\n        \"\"\"\n\n        logger.debug(\"========================\")\n        logger.debug(\"Setting secondary inputs\")\n        logger.debug(\"========================\")\n\n        # Get init process\n        arg_1 = arg_0.processes[0]\n        logger.debug(\"Setting main raw inputs: \"\n                     \"{}\".format(arg_0.main_raw_inputs))\n        arg_1.set_raw_inputs(arg_0.main_raw_inputs)\n        logger.debug(\"Setting extra inputs: {}\".format(arg_0.extra_inputs))\n        arg_1.set_extra_inputs(arg_0.extra_inputs)", "path": "flowcraft/generator/engine.py", "identifier": "NextflowGenerator._set_init_process", "docstring": "Sets the main raw inputs and secondary inputs on the init process\n\n        This method will fetch the :class:`flowcraft.process.Init` process\n        instance and sets the raw input (\n        :func:`flowcraft.process.Init.set_raw_inputs`) for\n        that process. This will handle the connection of the user parameters\n        with channels that are then consumed in the pipeline.", "docstring_tokens": ["Sets", "the", "main", "raw", "inputs", "and", "secondary", "inputs", "on", "the", "init", "process"], "nwo": "assemblerflow/flowcraft", "score": 0.4720820331667317, "idx": 261372}
{"url": "https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/operations.py#L88-L109", "sha": "8bb5396bc79998ee424cf3813af478304173f3a6", "docstring_summary": "This is an example how to sort votes prior to using them in the\n            Object", "language": "python", "parameters": "(self, *args, **kwargs)", "return_statement": "return OrderedDict(\n            [\n                (\"memo_key\", PublicKey(kwargs[\"memo_key\"], prefix=prefix)),\n                (\"voting_account\", ObjectId(kwargs[\"voting_account\"], \"account\")),\n                (\"num_witness\", Uint16(kwargs[\"num_witness\"])),\n                (\"num_committee\", Uint16(kwargs[\"num_committee\"])),\n                (\"votes\", Array([VoteId(o) for o in kwargs[\"votes\"]])),\n                (\"extensions\", Set([])),\n            ]\n        )", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ",", "**", "arg_2", ")", ":", "arg_3", "=", "arg_2", ".", "pop", "(", "\"prefix\"", ",", "default_prefix", ")", "arg_2", "[", "\"votes\"", "]", "=", "list", "(", "set", "(", "arg_2", "[", "\"votes\"", "]", ")", ")", "return", "OrderedDict", "(", "[", "(", "\"memo_key\"", ",", "PublicKey", "(", "arg_2", "[", "\"memo_key\"", "]", ",", "arg_3", "=", "arg_3", ")", ")", ",", "(", "\"voting_account\"", ",", "ObjectId", "(", "arg_2", "[", "\"voting_account\"", "]", ",", "\"account\"", ")", ")", ",", "(", "\"num_witness\"", ",", "Uint16", "(", "arg_2", "[", "\"num_witness\"", "]", ")", ")", ",", "(", "\"num_committee\"", ",", "Uint16", "(", "arg_2", "[", "\"num_committee\"", "]", ")", ")", ",", "(", "\"votes\"", ",", "Array", "(", "[", "VoteId", "(", "arg_4", ")", "for", "arg_4", "in", "arg_2", "[", "\"votes\"", "]", "]", ")", ")", ",", "(", "\"extensions\"", ",", "Set", "(", "[", "]", ")", ")", ",", "]", ")"], "function": "def Func(arg_0, *arg_1, **arg_2):\n        arg_3 = arg_2.pop(\"prefix\", default_prefix)\n        # remove dublicates\n        arg_2[\"votes\"] = list(set(arg_2[\"votes\"]))\n        \"\"\" This is an example how to sort votes prior to using them in the\n            Object\n        \"\"\"\n        # # Sort votes\n        # kwargs[\"votes\"] = sorted(\n        #     kwargs[\"votes\"],\n        #     key=lambda x: float(x.split(\":\")[1]),\n        # )\n        return OrderedDict(\n            [\n                (\"memo_key\", PublicKey(arg_2[\"memo_key\"], arg_3=arg_3)),\n                (\"voting_account\", ObjectId(arg_2[\"voting_account\"], \"account\")),\n                (\"num_witness\", Uint16(arg_2[\"num_witness\"])),\n                (\"num_committee\", Uint16(arg_2[\"num_committee\"])),\n                (\"votes\", Array([VoteId(arg_4) for arg_4 in arg_2[\"votes\"]])),\n                (\"extensions\", Set([])),\n            ]\n        )", "path": "graphenebase/operations.py", "identifier": "AccountOptions.detail", "docstring": "This is an example how to sort votes prior to using them in the\n            Object", "docstring_tokens": ["This", "is", "an", "example", "how", "to", "sort", "votes", "prior", "to", "using", "them", "in", "the", "Object"], "nwo": "xeroc/python-graphenelib", "score": 0.6686115100602262, "idx": 261373}
{"url": "https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/sbio/shell.py#L318-L323", "sha": "d554c1765c1899fa25727c9fc6805d221585562b", "docstring_summary": "Un-fullscreen the current window", "language": "python", "parameters": "(self, line)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_0", ".", "bot", ".", "canvas", ".", "sink", ".", "trigger_fullscreen_action", "(", "False", ")", "print", "(", "arg_0", ".", "response_prompt", ",", "file", "=", "arg_0", ".", "stdout", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Un-fullscreen the current window\n        \"\"\"\n        arg_0.bot.canvas.sink.trigger_fullscreen_action(False)\n        print(arg_0.response_prompt, file=arg_0.stdout)", "path": "shoebot/sbio/shell.py", "identifier": "ShoebotCmd.do_windowed", "docstring": "Un-fullscreen the current window", "docstring_tokens": ["Un", "-", "fullscreen", "the", "current", "window"], "nwo": "shoebot/shoebot", "score": 0.39344269781873226, "idx": 261374}
{"url": "https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/annotate.py#L40-L93", "sha": "0a5091a664b9b4d836e091e9ba583e944f438fd8", "docstring_summary": "Return usage information about a context or function.", "language": "python", "parameters": "(func)", "return_statement": "return help_text", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "\"\"", "if", "isinstance", "(", "arg_0", ",", "dict", ")", ":", "arg_2", "=", "context_name", "(", "arg_0", ")", "arg_1", "=", "\"\\n\"", "+", "arg_2", "+", "\"\\n\\n\"", "arg_3", "=", "inspect", ".", "getdoc", "(", "arg_0", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "=", "inspect", ".", "cleandoc", "(", "arg_3", ")", "arg_1", "+=", "arg_3", "+", "'\\n'", "return", "arg_1", "arg_4", "=", "arg_0", ".", "metadata", ".", "signature", "(", ")", "arg_3", "=", "inspect", ".", "getdoc", "(", "arg_0", ")", "if", "arg_3", "is", "not", "None", ":", "arg_3", "=", "inspect", ".", "cleandoc", "(", "arg_3", ")", "arg_1", "+=", "\"\\n\"", "+", "arg_4", "+", "\"\\n\\n\"", "if", "arg_3", "is", "not", "None", ":", "arg_1", "+=", "arg_3", "+", "'\\n'", "if", "inspect", ".", "isclass", "(", "arg_0", ")", ":", "arg_0", "=", "arg_0", ".", "__init__", "if", "arg_0", ".", "metadata", ".", "load_from_doc", ":", "return", "arg_1", "arg_1", "+=", "\"\\nArguments:\\n\"", "for", "arg_5", ",", "arg_6", "in", "arg_0", ".", "metadata", ".", "annotated_params", ".", "items", "(", ")", ":", "arg_7", "=", "arg_6", ".", "type_name", "arg_8", "=", "\"\"", "if", "arg_6", ".", "desc", "is", "not", "None", ":", "arg_8", "=", "arg_6", ".", "desc", "arg_1", "+=", "\"  - %s (%s): %s\\n\"", "%", "(", "arg_5", ",", "arg_7", ",", "arg_8", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"Return usage information about a context or function.\n\n    For contexts, just return the context name and its docstring\n    For functions, return the function signature as well as its\n    argument types.\n\n    Args:\n        func (callable): An annotated callable function\n\n    Returns:\n        str: The formatted help text\n    \"\"\"\n\n    arg_1 = \"\"\n    if isinstance(arg_0, dict):\n        arg_2 = context_name(arg_0)\n\n        arg_1 = \"\\n\" + arg_2 + \"\\n\\n\"\n        arg_3 = inspect.getdoc(arg_0)\n        if arg_3 is not None:\n            arg_3 = inspect.cleandoc(arg_3)\n            arg_1 += arg_3 + '\\n'\n\n        return arg_1\n\n    arg_4 = arg_0.metadata.signature()\n    arg_3 = inspect.getdoc(arg_0)\n    if arg_3 is not None:\n        arg_3 = inspect.cleandoc(arg_3)\n\n    arg_1 += \"\\n\" + arg_4 + \"\\n\\n\"\n    if arg_3 is not None:\n        arg_1 += arg_3 + '\\n'\n\n    if inspect.isclass(arg_0):\n        arg_0 = arg_0.__init__\n\n    # If we derived the parameter annotations from a docstring,\n    # don't insert a custom arguments section since it already\n    # exists.\n    if arg_0.metadata.load_from_doc:\n        return arg_1\n\n    arg_1 += \"\\nArguments:\\n\"\n    for arg_5, arg_6 in arg_0.metadata.annotated_params.items():\n        arg_7 = arg_6.type_name\n        arg_8 = \"\"\n        if arg_6.desc is not None:\n            arg_8 = arg_6.desc\n\n        arg_1 += \"  - %s (%s): %s\\n\" % (arg_5, arg_7, arg_8)\n\n    return arg_1", "path": "typedargs/annotate.py", "identifier": "get_help", "docstring": "Return usage information about a context or function.\n\n    For contexts, just return the context name and its docstring\n    For functions, return the function signature as well as its\n    argument types.\n\n    Args:\n        func (callable): An annotated callable function\n\n    Returns:\n        str: The formatted help text", "docstring_tokens": ["Return", "usage", "information", "about", "a", "context", "or", "function", "."], "nwo": "iotile/typedargs", "score": 0.3492961840108217, "idx": 261375}
{"url": "https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L217-L263", "sha": "0334545885445834307c075a445fba9fe6f0c9e7", "docstring_summary": "Subdivide groups of paths according to a function.", "language": "python", "parameters": "(groups_in, classifier, fun_desc='?', keep_uniques=False,\n            *args, **kwargs)", "return_statement": "return groups", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'?'", ",", "arg_3", "=", "False", ",", "*", "arg_4", ",", "**", "arg_5", ")", ":", "arg_6", ",", "arg_7", ",", "arg_8", "=", "{", "}", ",", "0", ",", "len", "(", "arg_0", ")", "for", "arg_9", ",", "arg_10", "in", "enumerate", "(", "arg_0", ".", "values", "(", ")", ")", ":", "out", ".", "write", "(", "\"Subdividing group %d of %d by %s... (%d files examined, %d \"", "\"in current group)\"", "%", "(", "arg_9", "+", "1", ",", "arg_8", ",", "arg_2", ",", "arg_7", ",", "len", "(", "arg_10", ")", ")", ")", "for", "arg_11", ",", "arg_12", "in", "arg_1", "(", "arg_10", ",", "*", "arg_4", ",", "**", "arg_5", ")", ".", "items", "(", ")", ":", "arg_6", ".", "setdefault", "(", "arg_11", ",", "set", "(", ")", ")", ".", "update", "(", "arg_12", ")", "arg_7", "+=", "len", "(", "arg_12", ")", "if", "not", "arg_3", ":", "arg_6", "=", "dict", "(", "[", "(", "x", ",", "arg_6", "[", "x", "]", ")", "for", "x", "in", "arg_6", "if", "len", "(", "arg_6", "[", "x", "]", ")", ">", "1", "]", ")", "out", ".", "write", "(", "\"Found %s sets of files with identical %s. (%d files examined)\"", "%", "(", "len", "(", "arg_6", ")", ",", "arg_2", ",", "arg_7", ")", ",", "newline", "=", "True", ")", "return", "arg_6"], "function": "def Func(arg_0, arg_1, arg_2='?', arg_3=False,\n            *arg_4, **arg_5):\n    \"\"\"Subdivide groups of paths according to a function.\n\n    :param groups_in: Grouped sets of paths.\n    :type groups_in: :class:`~__builtins__.dict` of iterables\n\n    :param classifier: Function to group a list of paths by some attribute.\n    :type classifier: ``function(list, *args, **kwargs) -> str``\n\n    :param fun_desc: Human-readable term for what the classifier operates on.\n        (Used in log messages)\n    :type fun_desc: :class:`~__builtins__.str`\n\n    :param keep_uniques: If ``False``, discard groups with only one member.\n    :type keep_uniques: :class:`~__builtins__.bool`\n\n\n    :returns: A dict mapping classifier keys to groups of matches.\n    :rtype: :class:`~__builtins__.dict`\n\n\n    :attention: Grouping functions generally use a :class:`~__builtins__.set`\n        ``groups`` as extra protection against accidentally counting a given\n        file twice. (Complimentary to use of :func:`os.path.realpath` in\n        :func:`~fastdupes.getPaths`)\n\n    .. todo:: Find some way to bring back the file-by-file status text\n    \"\"\"\n    arg_6, arg_7, arg_8 = {}, 0, len(arg_0)\n    for arg_9, arg_10 in enumerate(arg_0.values()):\n        out.write(\"Subdividing group %d of %d by %s... (%d files examined, %d \"\n                  \"in current group)\" % (\n                      arg_9 + 1, arg_8, arg_2, arg_7, len(arg_10)\n                  ))\n\n        for arg_11, arg_12 in arg_1(arg_10, *arg_4, **arg_5).items():\n            arg_6.setdefault(arg_11, set()).update(arg_12)\n            arg_7 += len(arg_12)\n\n    if not arg_3:\n        # Return only the groups with more than one file.\n        arg_6 = dict([(x, arg_6[x]) for x in arg_6 if len(arg_6[x]) > 1])\n\n    out.write(\"Found %s sets of files with identical %s. (%d files examined)\"\n              % (len(arg_6), arg_2, arg_7), newline=True)\n    return arg_6", "path": "fastdupes.py", "identifier": "groupBy", "docstring": "Subdivide groups of paths according to a function.\n\n    :param groups_in: Grouped sets of paths.\n    :type groups_in: :class:`~__builtins__.dict` of iterables\n\n    :param classifier: Function to group a list of paths by some attribute.\n    :type classifier: ``function(list, *args, **kwargs) -> str``\n\n    :param fun_desc: Human-readable term for what the classifier operates on.\n        (Used in log messages)\n    :type fun_desc: :class:`~__builtins__.str`\n\n    :param keep_uniques: If ``False``, discard groups with only one member.\n    :type keep_uniques: :class:`~__builtins__.bool`\n\n\n    :returns: A dict mapping classifier keys to groups of matches.\n    :rtype: :class:`~__builtins__.dict`\n\n\n    :attention: Grouping functions generally use a :class:`~__builtins__.set`\n        ``groups`` as extra protection against accidentally counting a given\n        file twice. (Complimentary to use of :func:`os.path.realpath` in\n        :func:`~fastdupes.getPaths`)\n\n    .. todo:: Find some way to bring back the file-by-file status text", "docstring_tokens": ["Subdivide", "groups", "of", "paths", "according", "to", "a", "function", "."], "nwo": "ssokolow/fastdupes", "score": 0.4039778193346996, "idx": 261376}
{"url": "https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/scripts.py#L314-L353", "sha": "000cb127db51e03cb4070aae6943e956193cbad5", "docstring_summary": "Parse `filename` appropriately and then output calls according to the\n    `args` specified.", "language": "python", "parameters": "(filename, args)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "os", ".", "path", ".", "dirname", "(", "arg_0", ")", "if", "os", ".", "path", ".", "isfile", "(", "arg_0", ")", ":", "arg_3", "=", "_parse_file", "(", "arg_0", ",", "arg_2", ")", "elif", "os", ".", "path", ".", "isdir", "(", "arg_0", ")", ":", "arg_3", "=", "_parse_dir", "(", "arg_0", ",", "arg_2", ")", "else", ":", "_error", "(", "\"Could not determine file type: %r\"", ",", "arg_0", ")", "if", "not", "arg_3", ":", "_error", "(", "\"No pyconfig calls.\"", ")", "if", "arg_1", ".", "load_configs", ":", "arg_4", "=", "set", "(", ")", "for", "arg_5", "in", "arg_3", ":", "arg_4", ".", "add", "(", "arg_5", ".", "key", ")", "arg_6", "=", "pyconfig", ".", "Config", "(", ")", "for", "arg_7", ",", "arg_8", "in", "arg_6", ".", "settings", ".", "items", "(", ")", ":", "if", "arg_7", "in", "arg_4", ":", "continue", "arg_3", ".", "append", "(", "_PyconfigCall", "(", "'set'", ",", "arg_7", ",", "arg_8", ",", "[", "None", "]", "*", "4", ")", ")", "_output", "(", "arg_3", ",", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Parse `filename` appropriately and then output calls according to the\n    `args` specified.\n\n    :param filename: A file or directory\n    :param args: Command arguments\n    :type filename: str\n\n    \"\"\"\n    arg_2 = os.path.dirname(arg_0)\n    if os.path.isfile(arg_0):\n        arg_3 = _parse_file(arg_0, arg_2)\n    elif os.path.isdir(arg_0):\n        arg_3 = _parse_dir(arg_0, arg_2)\n    else:\n        # XXX(shakefu): This is an error of some sort, maybe symlinks?\n        # Probably need some thorough testing\n        _error(\"Could not determine file type: %r\", arg_0)\n\n    if not arg_3:\n        # XXX(shakefu): Probably want to change this to not be an error and\n        # just be a normal fail (e.g. command runs, no output).\n        _error(\"No pyconfig calls.\")\n\n    if arg_1.load_configs:\n        # We want to iterate over the configs and add any keys which haven't\n        # already been found\n        arg_4 = set()\n        for arg_5 in arg_3:\n            arg_4.add(arg_5.key)\n\n        # Iterate the loaded keys and make _PyconfigCall instances\n        arg_6 = pyconfig.Config()\n        for arg_7, arg_8 in arg_6.settings.items():\n            if arg_7 in arg_4:\n                continue\n            arg_3.append(_PyconfigCall('set', arg_7, arg_8, [None]*4))\n\n    _output(arg_3, arg_1)", "path": "pyconfig/scripts.py", "identifier": "_parse_and_output", "docstring": "Parse `filename` appropriately and then output calls according to the\n    `args` specified.\n\n    :param filename: A file or directory\n    :param args: Command arguments\n    :type filename: str", "docstring_tokens": ["Parse", "filename", "appropriately", "and", "then", "output", "calls", "according", "to", "the", "args", "specified", "."], "nwo": "shakefu/pyconfig", "score": 0.3889680301858685, "idx": 261377}
{"url": "https://github.com/bjoernricks/python-quilt/blob/fae88237f601848cc34d073584d9dcb409f01777/quilt/cli/parser.py#L442-L460", "sha": "fae88237f601848cc34d073584d9dcb409f01777", "docstring_summary": "Adds the subparsers to an argparse.ArgumentParser", "language": "python", "parameters": "(self, parser)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "getattr", "(", "arg_0", ",", "\"subparser_group\"", ",", "None", ")", "if", "arg_2", ":", "arg_2", ".", "add_to_parser", "(", "arg_0", ")", "if", "not", "arg_0", ".", "subparsers", ":", "return", "arg_3", "=", "arg_0", ".", "subparsers_args", "or", "arg_0", ".", "get_default_subparsers_args", "(", ")", "arg_4", "=", "arg_0", ".", "subparsers_kwargs", "or", "arg_0", ".", "get_default_subparsers_kwargs", "(", ")", "arg_5", "=", "arg_1", ".", "Func", "(", "*", "arg_3", ",", "**", "arg_4", ")", "for", "arg_6", "in", "arg_0", ".", "subparsers", ":", "arg_6", ".", "add_to_parser", "(", "arg_5", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Adds the subparsers to an argparse.ArgumentParser\n\n        @param parser An argparse.ArgumentParser instance\n        \"\"\"\n        arg_2 = getattr(arg_0, \"subparser_group\", None)\n        if arg_2:\n            arg_2.add_to_parser(arg_0)\n\n        if not arg_0.subparsers:\n            return\n\n        arg_3 = arg_0.subparsers_args or arg_0.get_default_subparsers_args()\n        arg_4 = arg_0.subparsers_kwargs or arg_0.get_default_subparsers_kwargs()\n        arg_5 = arg_1.Func(*arg_3, **arg_4)\n\n        for arg_6 in arg_0.subparsers:\n            arg_6.add_to_parser(arg_5)", "path": "quilt/cli/parser.py", "identifier": "SubParsersMixin.add_subparsers", "docstring": "Adds the subparsers to an argparse.ArgumentParser\n\n        @param parser An argparse.ArgumentParser instance", "docstring_tokens": ["Adds", "the", "subparsers", "to", "an", "argparse", ".", "ArgumentParser"], "nwo": "bjoernricks/python-quilt", "score": 0.3756179881544838, "idx": 261378}
{"url": "https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/eval.py#L164-L225", "sha": "9dbb57d77a1310465a65cc40f1641d083ca74385", "docstring_summary": "Computes the results by using the ground truth dataset identified by\n    the annotator parameter.", "language": "python", "parameters": "(est_file, ref_file, boundaries_id, labels_id, config,\n                       bins=251, annotator_id=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", "=", "251", ",", "arg_6", "=", "0", ")", ":", "if", "arg_4", "[", "\"hier\"", "]", ":", "arg_7", ",", "arg_8", ",", "arg_9", "=", "msaf", ".", "io", ".", "read_hier_references", "(", "arg_1", ",", "annotation_id", "=", "arg_6", ",", "exclude_levels", "=", "[", "\"segment_salami_function\"", "]", ")", "else", ":", "arg_10", "=", "jams", ".", "load", "(", "arg_1", ",", "validate", "=", "False", ")", "arg_11", "=", "arg_10", ".", "search", "(", "namespace", "=", "'segment_.*'", ")", "[", "arg_6", "]", "arg_12", ",", "arg_8", "=", "arg_11", ".", "to_interval_values", "(", ")", "arg_13", ",", "arg_14", "=", "io", ".", "read_estimations", "(", "arg_0", ",", "arg_2", ",", "arg_3", ",", "**", "arg_4", ")", "logging", ".", "info", "(", "\"Evaluating %s\"", "%", "os", ".", "path", ".", "basename", "(", "arg_0", ")", ")", "if", "arg_4", "[", "\"hier\"", "]", ":", "assert", "len", "(", "arg_13", ")", "==", "len", "(", "arg_14", ")", ",", "\"Same number of levels \"", "\"are required in the boundaries and labels for the hierarchical \"", "\"evaluation.\"", "arg_15", "=", "[", "]", "arg_14", "=", "[", "]", "arg_13", "=", "sorted", "(", "arg_13", ",", "key", "=", "lambda", "level", ":", "len", "(", "level", ")", ")", "for", "arg_16", "in", "arg_13", ":", "arg_15", ".", "append", "(", "msaf", ".", "utils", ".", "intervals_to_times", "(", "arg_16", ")", ")", "arg_14", ".", "append", "(", "np", ".", "ones", "(", "len", "(", "arg_15", "[", "-", "1", "]", ")", "-", "1", ")", "*", "-", "1", ")", "utils", ".", "align_end_hierarchies", "(", "arg_15", ",", "arg_7", ",", "thres", "=", "1", ")", "arg_17", "=", "[", "utils", ".", "times_to_intervals", "(", "times", ")", "for", "times", "in", "arg_15", "]", "arg_18", "=", "[", "utils", ".", "times_to_intervals", "(", "times", ")", "for", "times", "in", "arg_7", "]", "arg_19", "=", "{", "}", "arg_19", "[", "\"t_recall10\"", "]", ",", "arg_19", "[", "\"t_precision10\"", "]", ",", "arg_19", "[", "\"t_measure10\"", "]", "=", "mir_eval", ".", "hierarchy", ".", "tmeasure", "(", "arg_18", ",", "arg_17", ",", "window", "=", "10", ")", "arg_19", "[", "\"t_recall15\"", "]", ",", "arg_19", "[", "\"t_precision15\"", "]", ",", "arg_19", "[", "\"t_measure15\"", "]", "=", "mir_eval", ".", "hierarchy", ".", "tmeasure", "(", "arg_18", ",", "arg_17", ",", "window", "=", "15", ")", "arg_19", "[", "\"track_id\"", "]", "=", "os", ".", "path", ".", "basename", "(", "arg_0", ")", "[", ":", "-", "5", "]", "return", "arg_19", "else", ":", "return", "compute_results", "(", "arg_12", ",", "arg_13", ",", "arg_8", ",", "arg_14", ",", "arg_5", ",", "arg_0", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4,\n                       arg_5=251, arg_6=0):\n    \"\"\"Computes the results by using the ground truth dataset identified by\n    the annotator parameter.\n\n    Return\n    ------\n    results : dict\n        Dictionary of the results (see function compute_results).\n    \"\"\"\n    if arg_4[\"hier\"]:\n        arg_7, arg_8, arg_9 = \\\n            msaf.io.read_hier_references(\n                arg_1, annotation_id=arg_6,\n                exclude_levels=[\"segment_salami_function\"])\n    else:\n        arg_10 = jams.load(arg_1, validate=False)\n        arg_11 = arg_10.search(namespace='segment_.*')[arg_6]\n        arg_12, arg_8 = arg_11.to_interval_values()\n\n    # Read estimations with correct configuration\n    arg_13, arg_14 = io.read_estimations(arg_0, arg_2,\n                                                arg_3, **arg_4)\n\n    # Compute the results and return\n    logging.info(\"Evaluating %s\" % os.path.basename(arg_0))\n    if arg_4[\"hier\"]:\n        # Hierarchical\n        assert len(arg_13) == len(arg_14), \"Same number of levels \" \\\n            \"are required in the boundaries and labels for the hierarchical \" \\\n            \"evaluation.\"\n        arg_15 = []\n        arg_14 = []\n\n        # Sort based on how many segments per level\n        arg_13 = sorted(arg_13, key=lambda level: len(level))\n\n        for arg_16 in arg_13:\n            arg_15.append(msaf.utils.intervals_to_times(arg_16))\n            # Add fake labels (hierarchical eval does not use labels --yet--)\n            arg_14.append(np.ones(len(arg_15[-1]) - 1) * -1)\n\n        # Align the times\n        utils.align_end_hierarchies(arg_15, arg_7, thres=1)\n\n        # To intervals\n        arg_17 = [utils.times_to_intervals(times) for times in arg_15]\n        arg_18 = [utils.times_to_intervals(times) for times in arg_7]\n\n        # Compute evaluations\n        arg_19 = {}\n        arg_19[\"t_recall10\"], arg_19[\"t_precision10\"], arg_19[\"t_measure10\"] = \\\n            mir_eval.hierarchy.tmeasure(arg_18, arg_17, window=10)\n        arg_19[\"t_recall15\"], arg_19[\"t_precision15\"], arg_19[\"t_measure15\"] = \\\n            mir_eval.hierarchy.tmeasure(arg_18, arg_17, window=15)\n\n        arg_19[\"track_id\"] = os.path.basename(arg_0)[:-5]\n        return arg_19\n    else:\n        # Flat\n        return compute_results(arg_12, arg_13, arg_8, arg_14,\n                               arg_5, arg_0)", "path": "msaf/eval.py", "identifier": "compute_gt_results", "docstring": "Computes the results by using the ground truth dataset identified by\n    the annotator parameter.\n\n    Return\n    ------\n    results : dict\n        Dictionary of the results (see function compute_results).", "docstring_tokens": ["Computes", "the", "results", "by", "using", "the", "ground", "truth", "dataset", "identified", "by", "the", "annotator", "parameter", "."], "nwo": "urinieto/msaf", "score": 0.4718871297352587, "idx": 261379}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L666-L677", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Sets the base font for the ConsoleWidget to the specified QFont.", "language": "python", "parameters": "(self, font)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "QtGui", ".", "QFontMetrics", "(", "arg_1", ")", "arg_0", ".", "_control", ".", "setTabStopWidth", "(", "arg_0", ".", "tab_width", "*", "arg_2", ".", "width", "(", "' '", ")", ")", "arg_0", ".", "_completion_widget", ".", "setFont", "(", "arg_1", ")", "arg_0", ".", "_control", ".", "document", "(", ")", ".", "setDefaultFont", "(", "arg_1", ")", "if", "arg_0", ".", "_page_control", ":", "arg_0", ".", "_page_control", ".", "document", "(", ")", ".", "setDefaultFont", "(", "arg_1", ")", "arg_0", ".", "font_changed", ".", "emit", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Sets the base font for the ConsoleWidget to the specified QFont.\n        \"\"\"\n        arg_2 = QtGui.QFontMetrics(arg_1)\n        arg_0._control.setTabStopWidth(arg_0.tab_width * arg_2.width(' '))\n\n        arg_0._completion_widget.setFont(arg_1)\n        arg_0._control.document().setDefaultFont(arg_1)\n        if arg_0._page_control:\n            arg_0._page_control.document().setDefaultFont(arg_1)\n\n        arg_0.font_changed.emit(arg_1)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", "identifier": "ConsoleWidget._set_font", "docstring": "Sets the base font for the ConsoleWidget to the specified QFont.", "docstring_tokens": ["Sets", "the", "base", "font", "for", "the", "ConsoleWidget", "to", "the", "specified", "QFont", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261380}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/mainwindow.py#L121-L132", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "create a new frontend attached to the same kernel as the current tab", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "tab_widget", ".", "currentWidget", "(", ")", "arg_2", "=", "arg_0", ".", "tab_widget", ".", "indexOf", "(", "arg_1", ")", "arg_3", "=", "arg_0", ".", "tab_widget", ".", "tabText", "(", "arg_2", ")", "arg_4", "=", "arg_0", ".", "slave_frontend_factory", "(", "arg_1", ")", "if", "'slave'", "in", "arg_3", ":", "arg_5", "=", "arg_3", "else", ":", "arg_5", "=", "'(%s) slave'", "%", "arg_3", "arg_0", ".", "add_tab_with_frontend", "(", "arg_4", ",", "arg_5", "=", "arg_5", ")"], "function": "def Func(arg_0):\n        \"\"\"create a new frontend attached to the same kernel as the current tab\"\"\"\n        arg_1 = arg_0.tab_widget.currentWidget()\n        arg_2 = arg_0.tab_widget.indexOf(arg_1)\n        arg_3 = arg_0.tab_widget.tabText(arg_2)\n        arg_4 = arg_0.slave_frontend_factory(arg_1)\n        if 'slave' in arg_3:\n            # don't keep stacking slaves\n            arg_5 = arg_3\n        else:\n            arg_5 = '(%s) slave' % arg_3\n        arg_0.add_tab_with_frontend(arg_4,arg_5=arg_5)", "path": "environment/lib/python2.7/site-packages/IPython/frontend/qt/console/mainwindow.py", "identifier": "MainWindow.create_tab_with_current_kernel", "docstring": "create a new frontend attached to the same kernel as the current tab", "docstring_tokens": ["create", "a", "new", "frontend", "attached", "to", "the", "same", "kernel", "as", "the", "current", "tab"], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261381}
{"url": "https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/activity.py#L1039-L1070", "sha": "3857ed023a3e64fd3039a32d53576c24990ef1c3", "docstring_summary": "Calculates bubble point for a given pressure", "language": "python", "parameters": "(P, zs, vapor_pressure_eqns, fugacities=None, gammas=None)", "return_statement": "return T_bubble", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", "=", "None", ",", "arg_4", "=", "None", ")", ":", "def", "bubble_P_error", "(", "arg_5", ")", ":", "arg_6", "=", "[", "VP", "(", "arg_5", ")", "for", "VP", "in", "arg_2", "]", "arg_7", "=", "bubble_at_T", "(", "arg_1", ",", "arg_6", ",", "arg_3", ",", "arg_4", ")", "return", "arg_0", "-", "arg_7", "arg_8", "=", "newton", "(", "bubble_P_error", ",", "300", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):\n    '''Calculates bubble point for a given pressure\n\n    Parameters\n    ----------\n    P : float\n        Pressure, [Pa]\n    zs : list[float]\n        Overall mole fractions of all species, [-]\n    vapor_pressure_eqns : list[functions]\n        Temperature dependent function for each specie, Returns Psat, [Pa]\n    fugacities : list[float], optional\n        fugacities of each species, defaults to list of ones, [-]\n    gammas : list[float], optional\n        gammas of each species, defaults to list of ones, [-]\n\n    Returns\n    -------\n    Tbubble : float, optional\n        Temperature of bubble point at pressure `P`, [K]\n\n    '''\n\n    def bubble_P_error(arg_5):\n        arg_6 = [VP(arg_5) for VP in arg_2]\n        arg_7 = bubble_at_T(arg_1, arg_6, arg_3, arg_4)\n\n        return arg_0 - arg_7\n\n    arg_8 = newton(bubble_P_error, 300)\n\n    return arg_8", "path": "thermo/activity.py", "identifier": "bubble_at_P", "docstring": "Calculates bubble point for a given pressure\n\n    Parameters\n    ----------\n    P : float\n        Pressure, [Pa]\n    zs : list[float]\n        Overall mole fractions of all species, [-]\n    vapor_pressure_eqns : list[functions]\n        Temperature dependent function for each specie, Returns Psat, [Pa]\n    fugacities : list[float], optional\n        fugacities of each species, defaults to list of ones, [-]\n    gammas : list[float], optional\n        gammas of each species, defaults to list of ones, [-]\n\n    Returns\n    -------\n    Tbubble : float, optional\n        Temperature of bubble point at pressure `P`, [K]", "docstring_tokens": ["Calculates", "bubble", "point", "for", "a", "given", "pressure"], "nwo": "CalebBell/thermo", "score": 0.7491901936017268, "idx": 261382}
{"url": "https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/convert.py#L105-L127", "sha": "2dae7199849395a209c887d5f30506e1de8a9ad9", "docstring_summary": "Converts all DICOM files within `work_dir` into one or more\n    NifTi files by calling dcm2nii on this folder.", "language": "python", "parameters": "(work_dir, arguments='')", "return_statement": "return subprocess.check_call(cmd_line, shell=True)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "''", ")", ":", "if", "not", "op", ".", "exists", "(", "arg_0", ")", ":", "raise", "IOError", "(", "'Folder {} not found.'", ".", "format", "(", "arg_0", ")", ")", "arg_2", "=", "'dcm2nii {0} \"{1}\"'", ".", "format", "(", "arg_1", ",", "arg_0", ")", "log", ".", "info", "(", "arg_2", ")", "return", "subprocess", ".", "check_call", "(", "arg_2", ",", "shell", "=", "True", ")"], "function": "def Func(arg_0, arg_1=''):\n    \"\"\"Converts all DICOM files within `work_dir` into one or more\n    NifTi files by calling dcm2nii on this folder.\n\n    Parameters\n    ----------\n    work_dir: str\n        Path to the folder that contain the DICOM files\n\n    arguments: str\n        String containing all the flag arguments for `dcm2nii` CLI.\n\n    Returns\n    -------\n    sys_code: int\n        dcm2nii execution return code\n    \"\"\"\n    if not op.exists(arg_0):\n        raise IOError('Folder {} not found.'.format(arg_0))\n\n    arg_2 = 'dcm2nii {0} \"{1}\"'.format(arg_1, arg_0)\n    log.info(arg_2)\n    return subprocess.check_call(arg_2, shell=True)", "path": "boyle/dicom/convert.py", "identifier": "call_dcm2nii", "docstring": "Converts all DICOM files within `work_dir` into one or more\n    NifTi files by calling dcm2nii on this folder.\n\n    Parameters\n    ----------\n    work_dir: str\n        Path to the folder that contain the DICOM files\n\n    arguments: str\n        String containing all the flag arguments for `dcm2nii` CLI.\n\n    Returns\n    -------\n    sys_code: int\n        dcm2nii execution return code", "docstring_tokens": ["Converts", "all", "DICOM", "files", "within", "work_dir", "into", "one", "or", "more", "NifTi", "files", "by", "calling", "dcm2nii", "on", "this", "folder", "."], "nwo": "Neurita/boyle", "score": 0.17553651708052445, "idx": 261383}
{"url": "https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/group_nodes.py#L22-L33", "sha": "3491adea0ac4ee60f57275ef72f9b73da6dbfe0c", "docstring_summary": "Group the nodes occurring in edges by the given annotation.", "language": "python", "parameters": "(graph: BELGraph, annotation: str = 'Subgraph')", "return_statement": "return dict(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ",", "arg_2", ":", "arg_3", "=", "'Subgraph'", ")", "->", "Mapping", "[", "arg_3", ",", "Set", "[", "BaseEntity", "]", "]", ":", "arg_4", "=", "defaultdict", "(", "set", ")", "for", "arg_5", ",", "arg_6", ",", "arg_7", "in", "arg_0", ".", "edges", "(", "data", "=", "True", ")", ":", "if", "not", "edge_has_annotation", "(", "arg_7", ",", "arg_2", ")", ":", "continue", "arg_4", "[", "arg_7", "[", "ANNOTATIONS", "]", "[", "arg_2", "]", "]", ".", "add", "(", "arg_5", ")", "arg_4", "[", "arg_7", "[", "ANNOTATIONS", "]", "[", "arg_2", "]", "]", ".", "add", "(", "arg_6", ")", "return", "dict", "(", "arg_4", ")"], "function": "def Func(arg_0: arg_1, arg_2: arg_3 = 'Subgraph') -> Mapping[arg_3, Set[BaseEntity]]:\n    \"\"\"Group the nodes occurring in edges by the given annotation.\"\"\"\n    arg_4 = defaultdict(set)\n\n    for arg_5, arg_6, arg_7 in arg_0.edges(data=True):\n        if not edge_has_annotation(arg_7, arg_2):\n            continue\n\n        arg_4[arg_7[ANNOTATIONS][arg_2]].add(arg_5)\n        arg_4[arg_7[ANNOTATIONS][arg_2]].add(arg_6)\n\n    return dict(arg_4)", "path": "src/pybel_tools/selection/group_nodes.py", "identifier": "group_nodes_by_annotation", "docstring": "Group the nodes occurring in edges by the given annotation.", "docstring_tokens": ["Group", "the", "nodes", "occurring", "in", "edges", "by", "the", "given", "annotation", "."], "nwo": "pybel/pybel-tools", "score": 0.27946077266739355, "idx": 261384}
{"url": "https://github.com/ghcollin/multitables/blob/9654a45800289a20e66d2b0e0666149f0d370f93/multitables.py#L508-L568", "sha": "9654a45800289a20e66d2b0e0666149f0d370f93", "docstring_summary": "Get a queue that allows direct access to the internal buffer. If the dataset to be read is chunked, the\n        block_size should be a multiple of the chunk size to maximise performance. In this case it is best to leave it\n        to the default. When cyclic=False, and block_size does not divide the dataset evenly, the remainder elements\n        will not be returned by the queue. When cyclic=True, the remainder elements will be part of a block that wraps\n        around the end and includes element from the beginning of the dataset. By default, blocks are returned in the\n        order in which they become available. The ordered option will force blocks to be returned in on-disk order.", "language": "python", "parameters": "(self, path, n_procs=4, read_ahead=None, cyclic=False, block_size=None, ordered=False)", "return_statement": "return Streamer.Queue(cbuf, stop, block_size)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "4", ",", "arg_3", "=", "None", ",", "arg_4", "=", "False", ",", "arg_5", "=", "None", ",", "arg_6", "=", "False", ")", ":", "arg_7", "=", "arg_0", ".", "__get_batch", "(", "arg_1", ",", "arg_5", ")", "arg_5", "=", "arg_7", ".", "shape", "[", "0", "]", "if", "arg_3", "is", "None", ":", "arg_3", "=", "2", "*", "arg_2", "+", "1", "arg_8", "=", "SharedCircBuf", "(", "arg_3", ",", "arg_7", ")", "arg_9", "=", "multiprocessing", ".", "Event", "(", ")", "arg_10", "=", "Barrier", "(", "arg_2", ")", "arg_11", "=", "GuardSynchronizer", "(", ")", "if", "arg_6", "else", "None", "arg_12", "=", "[", "]", "for", "arg_13", "in", "range", "(", "arg_2", ")", ":", "arg_14", "=", "multiprocessing", ".", "Process", "(", "target", "=", "_Streamer__read_process", ",", "args", "=", "(", "arg_0", ",", "arg_1", ",", "arg_5", ",", "arg_8", ",", "arg_9", ",", "arg_10", ",", "arg_4", ",", "arg_13", "*", "arg_5", ",", "arg_2", "*", "arg_5", ",", "arg_11", ")", ")", "arg_14", ".", "daemon", "=", "True", "arg_14", ".", "start", "(", ")", "arg_12", ".", "append", "(", "arg_14", ")", "if", "not", "arg_4", ":", "def", "monitor", "(", ")", ":", "for", "arg_16", "in", "arg_12", ":", "arg_16", ".", "join", "(", ")", "arg_8", ".", "close", "(", ")", "arg_17", "=", "threading", ".", "Thread", "(", "target", "=", "monitor", ")", "arg_17", ".", "daemon", "=", "True", "arg_17", ".", "start", "(", ")", "return", "Streamer", ".", "Queue", "(", "arg_8", ",", "arg_9", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1, arg_2=4, arg_3=None, arg_4=False, arg_5=None, arg_6=False):\n        \"\"\"\n        Get a queue that allows direct access to the internal buffer. If the dataset to be read is chunked, the\n        block_size should be a multiple of the chunk size to maximise performance. In this case it is best to leave it\n        to the default. When cyclic=False, and block_size does not divide the dataset evenly, the remainder elements\n        will not be returned by the queue. When cyclic=True, the remainder elements will be part of a block that wraps\n        around the end and includes element from the beginning of the dataset. By default, blocks are returned in the\n        order in which they become available. The ordered option will force blocks to be returned in on-disk order.\n\n        :param path: The HDF5 path to the dataset that should be read.\n        :param n_procs: The number of background processes used to read the datset in parallel.\n        :param read_ahead: The number of blocks to allocate in the internal buffer.\n        :param cyclic: True if the queue should wrap at the end of the dataset.\n        :param block_size: The size along the outer dimension of the blocks to be read. Defaults to a multiple of\n            the chunk size, or to a 128KB sized block if the dataset is not chunked.\n        :param ordered: Force the reader return data in on-disk order. May result in performance penalty.\n        :return: A queue object that allows access to the internal buffer.\n        \"\"\"\n        # Get a block_size length of elements from the dataset to serve as a template for creating the buffer.\n        # If block_size=None, then get_batch calculates an appropriate block size.\n        arg_7 = arg_0.__get_batch(arg_1, arg_5)\n        arg_5 = arg_7.shape[0]\n\n        if arg_3 is None:\n            # 2x No. of processes for writing, 1 extra for reading.\n            arg_3 = 2*arg_2 + 1\n\n        arg_8 = SharedCircBuf(arg_3, arg_7)\n        arg_9 = multiprocessing.Event()\n        arg_10 = Barrier(arg_2)\n\n        # If ordering has been requested, create a synchronizer.\n        arg_11 = GuardSynchronizer() if arg_6 else None\n\n        arg_12 = []\n        for arg_13 in range(arg_2):\n            # Each process is offset in the dataset by i*block_size\n            # The skip length is set to n_procs*block_size so that no block is read by 2 processes.\n            arg_14 = multiprocessing.Process(target=_Streamer__read_process, args=(\n                arg_0, arg_1, arg_5, arg_8, arg_9, arg_10, arg_4,\n                arg_13 * arg_5, arg_2 * arg_5, arg_11\n            ))\n            arg_14.daemon = True\n            arg_14.start()\n            arg_12.append(arg_14)\n\n        # If the queue is not cyclic, then the cessation of reading data needs to be monitored.\n        if not arg_4:\n\n            # This closure defines a background thread that waits until all processes have finished.\n            # At this point, all data from the dataset has been read, and the buffer is closed.\n            def monitor():\n                for arg_16 in arg_12:\n                    arg_16.join()\n                arg_8.close()\n\n            arg_17 = threading.Thread(target=monitor)\n            arg_17.daemon = True\n            arg_17.start()\n\n        return Streamer.Queue(arg_8, arg_9, arg_5)", "path": "multitables.py", "identifier": "Streamer.get_queue", "docstring": "Get a queue that allows direct access to the internal buffer. If the dataset to be read is chunked, the\n        block_size should be a multiple of the chunk size to maximise performance. In this case it is best to leave it\n        to the default. When cyclic=False, and block_size does not divide the dataset evenly, the remainder elements\n        will not be returned by the queue. When cyclic=True, the remainder elements will be part of a block that wraps\n        around the end and includes element from the beginning of the dataset. By default, blocks are returned in the\n        order in which they become available. The ordered option will force blocks to be returned in on-disk order.\n\n        :param path: The HDF5 path to the dataset that should be read.\n        :param n_procs: The number of background processes used to read the datset in parallel.\n        :param read_ahead: The number of blocks to allocate in the internal buffer.\n        :param cyclic: True if the queue should wrap at the end of the dataset.\n        :param block_size: The size along the outer dimension of the blocks to be read. Defaults to a multiple of\n            the chunk size, or to a 128KB sized block if the dataset is not chunked.\n        :param ordered: Force the reader return data in on-disk order. May result in performance penalty.\n        :return: A queue object that allows access to the internal buffer.", "docstring_tokens": ["Get", "a", "queue", "that", "allows", "direct", "access", "to", "the", "internal", "buffer", ".", "If", "the", "dataset", "to", "be", "read", "is", "chunked", "the", "block_size", "should", "be", "a", "multiple", "of", "the", "chunk", "size", "to", "maximise", "performance", ".", "In", "this", "case", "it", "is", "best", "to", "leave", "it", "to", "the", "default", ".", "When", "cyclic", "=", "False", "and", "block_size", "does", "not", "divide", "the", "dataset", "evenly", "the", "remainder", "elements", "will", "not", "be", "returned", "by", "the", "queue", ".", "When", "cyclic", "=", "True", "the", "remainder", "elements", "will", "be", "part", "of", "a", "block", "that", "wraps", "around", "the", "end", "and", "includes", "element", "from", "the", "beginning", "of", "the", "dataset", ".", "By", "default", "blocks", "are", "returned", "in", "the", "order", "in", "which", "they", "become", "available", ".", "The", "ordered", "option", "will", "force", "blocks", "to", "be", "returned", "in", "on", "-", "disk", "order", "."], "nwo": "ghcollin/multitables", "score": 0.18892572326127263, "idx": 261385}
{"url": "https://github.com/dsandersAzure/python_cowbull_game/blob/82a0d8ee127869123d4fad51a8cd1707879e368f/python_cowbull_game/GameObject.py#L174-L191", "sha": "82a0d8ee127869123d4fad51a8cd1707879e368f", "docstring_summary": "Create a new instance of a game. Note, a mode MUST be provided and MUST be of\n        type GameMode.", "language": "python", "parameters": "(self, mode)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "DigitWord", "(", "wordtype", "=", "arg_1", ".", "digit_type", ")", "arg_2", ".", "random", "(", "arg_1", ".", "digits", ")", "arg_0", ".", "_key", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "arg_0", ".", "_status", "=", "\"\"", "arg_0", ".", "_ttl", "=", "3600", "arg_0", ".", "_answer", "=", "arg_2", "arg_0", ".", "_mode", "=", "arg_1", "arg_0", ".", "_guesses_remaining", "=", "arg_1", ".", "guesses_allowed", "arg_0", ".", "_guesses_made", "=", "0"], "function": "def Func(arg_0, arg_1):\n        \"\"\"\n        Create a Func instance of a game. Note, a mode MUST be provided and MUST be of\n        type GameMode.\n\n        :param mode: <required>\n\n        \"\"\"\n        arg_2 = DigitWord(wordtype=arg_1.digit_type)\n        arg_2.random(arg_1.digits)\n\n        arg_0._key = str(uuid.uuid4())\n        arg_0._status = \"\"\n        arg_0._ttl = 3600\n        arg_0._answer = arg_2\n        arg_0._mode = arg_1\n        arg_0._guesses_remaining = arg_1.guesses_allowed\n        arg_0._guesses_made = 0", "path": "python_cowbull_game/GameObject.py", "identifier": "GameObject.new", "docstring": "Create a new instance of a game. Note, a mode MUST be provided and MUST be of\n        type GameMode.\n\n        :param mode: <required>", "docstring_tokens": ["Create", "a", "new", "instance", "of", "a", "game", ".", "Note", "a", "mode", "MUST", "be", "provided", "and", "MUST", "be", "of", "type", "GameMode", "."], "nwo": "dsandersAzure/python_cowbull_game", "score": 0.09252797783733271, "idx": 261386}
{"url": "https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L948-L973", "sha": "b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d", "docstring_summary": "Get a signed unauthenticated URL.", "language": "python", "parameters": "(self, file_id)", "return_statement": "return self._authenticated_request \\\n            .to_endpoint('file/{}/content/secure_link/'.format(file_id)) \\\n            .return_body() \\\n            .get()['signed_url']", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "is_valid_uuid", "(", "arg_1", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for file_id: {0}'", ".", "format", "(", "arg_1", ")", ")", "return", "arg_0", ".", "_authenticated_request", ".", "to_endpoint", "(", "'file/{}/content/secure_link/'", ".", "format", "(", "arg_1", ")", ")", ".", "return_body", "(", ")", ".", "get", "(", ")", "[", "'signed_url'", "]"], "function": "def Func(arg_0, arg_1):\n        '''Get a signed unauthenticated URL.\n\n        It can be used to download the file content without the need for a\n        token. The signed URL expires after 5 seconds.\n\n        Args:\n            file_id (str): The UUID of the file to get the link for.\n\n        Returns:\n            The signed url as a string\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes\n        '''\n        if not is_valid_uuid(arg_1):\n            raise StorageArgumentException(\n                'Invalid UUID for file_id: {0}'.format(arg_1))\n\n        return arg_0._authenticated_request \\\n            .to_endpoint('file/{}/content/secure_link/'.format(arg_1)) \\\n            .return_body() \\\n            .get()['signed_url']", "path": "hbp_service_client/storage_service/api.py", "identifier": "ApiClient.get_signed_url", "docstring": "Get a signed unauthenticated URL.\n\n        It can be used to download the file content without the need for a\n        token. The signed URL expires after 5 seconds.\n\n        Args:\n            file_id (str): The UUID of the file to get the link for.\n\n        Returns:\n            The signed url as a string\n\n        Raises:\n            StorageArgumentException: Invalid arguments\n            StorageForbiddenException: Server response code 403\n            StorageNotFoundException: Server response code 404\n            StorageException: other 400-600 error codes", "docstring_tokens": ["Get", "a", "signed", "unauthenticated", "URL", "."], "nwo": "HumanBrainProject/hbp-service-client", "score": 0.2619419494340654, "idx": 261387}
{"url": "https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/storecustomers.py#L86-L100", "sha": "1b472f1b64fdde974732ac4b7ed48908bb707260", "docstring_summary": "Get information about a specific customer.", "language": "python", "parameters": "(self, store_id, customer_id, **queryparams)", "return_statement": "return self._mc_client._get(url=self._build_path(store_id, 'customers', customer_id), **queryparams)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "**", "arg_3", ")", ":", "arg_0", ".", "store_id", "=", "arg_1", "arg_0", ".", "customer_id", "=", "arg_2", "return", "arg_0", ".", "_mc_client", ".", "_Func", "(", "url", "=", "arg_0", ".", "_build_path", "(", "arg_1", ",", "'customers'", ",", "arg_2", ")", ",", "**", "arg_3", ")"], "function": "def Func(arg_0, arg_1, arg_2, **arg_3):\n        \"\"\"\n        Get information about a specific customer.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        arg_0.store_id = arg_1\n        arg_0.customer_id = arg_2\n        return arg_0._mc_client._Func(url=arg_0._build_path(arg_1, 'customers', arg_2), **arg_3)", "path": "mailchimp3/entities/storecustomers.py", "identifier": "StoreCustomers.get", "docstring": "Get information about a specific customer.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []", "docstring_tokens": ["Get", "information", "about", "a", "specific", "customer", "."], "nwo": "VingtCinq/python-mailchimp", "score": 0.7638792683232226, "idx": 261388}
{"url": "https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/slurry.py#L521-L529", "sha": "2dcdae74154f136f8ca58289fe5b20772f215046", "docstring_summary": "Set all the size class masses and H20_mass in the package to zero\n        and the solid_density to 1.0", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "solid_density", "=", "1.0", "arg_0", ".", "H2O_mass", "=", "0.0", "arg_0", ".", "size_class_masses", "=", "arg_0", ".", "size_class_masses", "*", "0.0"], "function": "def Func(arg_0):\n        \"\"\"\n        Set all the size class masses and H20_mass in the package to zero\n        and the solid_density to 1.0\n        \"\"\"\n\n        arg_0.solid_density = 1.0\n        arg_0.H2O_mass = 0.0\n        arg_0.size_class_masses = arg_0.size_class_masses * 0.0", "path": "auxi/modelling/process/materials/slurry.py", "identifier": "MaterialPackage.clear", "docstring": "Set all the size class masses and H20_mass in the package to zero\n        and the solid_density to 1.0", "docstring_tokens": ["Set", "all", "the", "size", "class", "masses", "and", "H20_mass", "in", "the", "package", "to", "zero", "and", "the", "solid_density", "to", "1", ".", "0"], "nwo": "Ex-Mente/auxi.0", "score": 0.2778869743536733, "idx": 261389}
{"url": "https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L313-L337", "sha": "1daefb8de626ddff3ff7016697c3ad31d262ecd6", "docstring_summary": "Returns the offset_front_id which corresponds to the offset front which occurs\n    first entirely after the given onset sample_idx.", "language": "python", "parameters": "(onset_sample_idx, offset_fronts)", "return_statement": "return best_id_so_far", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "i", "for", "i", "in", "np", ".", "unique", "(", "arg_1", ")", "if", "i", "!=", "0", "]", "arg_3", "=", "-", "1", "arg_4", "=", "sys", ".", "maxsize", "for", "arg_5", "in", "arg_2", ":", "arg_6", "=", "_get_front_idxs_from_id", "(", "arg_1", ",", "arg_5", ")", "arg_7", "=", "[", "s", "for", "_f", ",", "s", "in", "arg_6", "]", "arg_8", "=", "min", "(", "arg_7", ")", "if", "arg_8", ">", "arg_0", "and", "arg_8", "<", "arg_4", ":", "arg_4", "=", "arg_8", "arg_3", "=", "arg_5", "assert", "arg_3", ">", "1", "or", "arg_3", "==", "-", "1", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Returns the offset_front_id which corresponds to the offset front which occurs\n    first entirely after the given onset sample_idx.\n    \"\"\"\n    # get all the offset_front_ids\n    arg_2 = [i for i in np.unique(arg_1) if i != 0]\n\n    arg_3 = -1\n    arg_4 = sys.maxsize\n    for arg_5 in arg_2:\n        # get all that offset front's indexes\n        arg_6 = _get_front_idxs_from_id(arg_1, arg_5)\n\n        # get the sample indexes\n        arg_7 = [s for _f, s in arg_6]\n\n        # if each sample index is greater than onset_sample_idx, keep this offset front if it is the best one so far\n        arg_8 = min(arg_7)\n        if arg_8 > arg_0 and arg_8 < arg_4:\n            arg_4 = arg_8\n            arg_3 = arg_5\n\n    assert arg_3 > 1 or arg_3 == -1\n    return arg_3", "path": "algorithms/asa.py", "identifier": "_get_offset_front_id_after_onset_sample_idx", "docstring": "Returns the offset_front_id which corresponds to the offset front which occurs\n    first entirely after the given onset sample_idx.", "docstring_tokens": ["Returns", "the", "offset_front_id", "which", "corresponds", "to", "the", "offset", "front", "which", "occurs", "first", "entirely", "after", "the", "given", "onset", "sample_idx", "."], "nwo": "MaxStrange/AudioSegment", "score": 0.5614929997940116, "idx": 261390}
{"url": "https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L75-L80", "sha": "21d7b2ed4ff68e0a1457e7df2db27f6334f1a379", "docstring_summary": "Get item of chunk meta table", "language": "python", "parameters": "(self, chunk_meta, grp, pug, chk)", "return_statement": "return chunk_meta[index]", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ")", ":", "arg_5", "=", "arg_0", ".", "envs", "[", "\"NUM_CHK\"", "]", "arg_6", "=", "arg_0", ".", "envs", "[", "\"NUM_PU\"", "]", "arg_7", "=", "arg_2", "*", "arg_6", "*", "arg_5", "+", "arg_3", "*", "arg_5", "+", "arg_4", "return", "arg_1", "[", "arg_7", "]"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4):\n        \"\"\"Get item of chunk meta table\"\"\"\n        arg_5 = arg_0.envs[\"NUM_CHK\"]\n        arg_6 = arg_0.envs[\"NUM_PU\"]\n        arg_7 = arg_2 * arg_6 * arg_5 + arg_3 * arg_5 + arg_4\n        return arg_1[arg_7]", "path": "deprecated/modules/cij/liblight.py", "identifier": "Nvm.get_chunk_meta_item", "docstring": "Get item of chunk meta table", "docstring_tokens": ["Get", "item", "of", "chunk", "meta", "table"], "nwo": "refenv/cijoe", "score": 0.665287191474368, "idx": 261391}
{"url": "https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L246-L260", "sha": "f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1", "docstring_summary": "Select file path by access time.", "language": "python", "parameters": "(self, min_time=0, max_time=ts_2100, recursive=True)", "return_statement": "return self.select_file(filters, recursive)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "0", ",", "arg_2", "=", "arg_3", ",", "arg_4", "=", "True", ")", ":", "def", "filters", "(", "arg_5", ")", ":", "return", "arg_1", "<=", "arg_5", ".", "atime", "<=", "arg_2", "return", "arg_0", ".", "select_file", "(", "filters", ",", "arg_4", ")"], "function": "def Func(arg_0, arg_1=0, arg_2=arg_3, arg_4=True):\n        \"\"\"\n        Select file path by access time.\n\n        :param min_time: lower bound timestamp\n        :param max_time: upper bound timestamp\n\n        **\u4e2d\u6587\u6587\u6863**\n\n        \u9009\u62e9\u6240\u6709 :attr:`pathlib_mate.pathlib2.Path.atime` \u5728\u4e00\u5b9a\u8303\u56f4\u5185\u7684\u6587\u4ef6\u3002\n        \"\"\"\n\n        def filters(arg_5): return arg_1 <= arg_5.atime <= arg_2\n\n        return arg_0.select_file(filters, arg_4)", "path": "pathlib_mate/mate_path_filters.py", "identifier": "PathFilters.select_by_atime", "docstring": "Select file path by access time.\n\n        :param min_time: lower bound timestamp\n        :param max_time: upper bound timestamp\n\n        **\u4e2d\u6587\u6587\u6863**\n\n        \u9009\u62e9\u6240\u6709 :attr:`pathlib_mate.pathlib2.Path.atime` \u5728\u4e00\u5b9a\u8303\u56f4\u5185\u7684\u6587\u4ef6\u3002", "docstring_tokens": ["Select", "file", "path", "by", "access", "time", "."], "nwo": "MacHu-GWU/pathlib_mate-project", "score": 0.2619419494340654, "idx": 261392}
{"url": "https://github.com/glottobank/python-newick/blob/e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702/src/newick.py#L451-L473", "sha": "e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702", "docstring_summary": "Parse a Newick formatted string into a `Node` object.", "language": "python", "parameters": "(s, strip_comments=False, **kw)", "return_statement": "return Node.create(name=name, length=length, descendants=descendants, **kw)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "False", ",", "**", "arg_2", ")", ":", "if", "arg_1", ":", "arg_0", "=", "COMMENT", ".", "sub", "(", "''", ",", "arg_0", ")", "arg_0", "=", "arg_0", ".", "strip", "(", ")", "arg_3", "=", "arg_0", ".", "split", "(", "')'", ")", "if", "len", "(", "arg_3", ")", "==", "1", ":", "arg_4", ",", "arg_5", "=", "[", "]", ",", "arg_0", "else", ":", "if", "not", "arg_3", "[", "0", "]", ".", "startswith", "(", "'('", ")", ":", "raise", "ValueError", "(", "'unmatched braces %s'", "%", "arg_3", "[", "0", "]", "[", ":", "100", "]", ")", "arg_4", "=", "list", "(", "_parse_siblings", "(", "')'", ".", "join", "(", "arg_3", "[", ":", "-", "1", "]", ")", "[", "1", ":", "]", ",", "**", "arg_2", ")", ")", "arg_5", "=", "arg_3", "[", "-", "1", "]", "arg_6", ",", "arg_7", "=", "_parse_name_and_length", "(", "arg_5", ")", "return", "Node", ".", "create", "(", "arg_6", "=", "arg_6", ",", "arg_7", "=", "arg_7", ",", "arg_4", "=", "arg_4", ",", "**", "arg_2", ")"], "function": "def Func(arg_0, arg_1=False, **arg_2):\n    \"\"\"\n    Parse a Newick formatted string into a `Node` object.\n\n    :param s: Newick formatted string to parse.\n    :param strip_comments: Flag signaling whether to strip comments enclosed in square \\\n    brackets.\n    :param kw: Keyword arguments are passed through to `Node.create`.\n    :return: `Node` instance.\n    \"\"\"\n    if arg_1:\n        arg_0 = COMMENT.sub('', arg_0)\n    arg_0 = arg_0.strip()\n    arg_3 = arg_0.split(')')\n    if len(arg_3) == 1:\n        arg_4, arg_5 = [], arg_0\n    else:\n        if not arg_3[0].startswith('('):\n            raise ValueError('unmatched braces %s' % arg_3[0][:100])\n        arg_4 = list(_parse_siblings(')'.join(arg_3[:-1])[1:], **arg_2))\n        arg_5 = arg_3[-1]\n    arg_6, arg_7 = _parse_name_and_length(arg_5)\n    return Node.create(arg_6=arg_6, arg_7=arg_7, arg_4=arg_4, **arg_2)", "path": "src/newick.py", "identifier": "parse_node", "docstring": "Parse a Newick formatted string into a `Node` object.\n\n    :param s: Newick formatted string to parse.\n    :param strip_comments: Flag signaling whether to strip comments enclosed in square \\\n    brackets.\n    :param kw: Keyword arguments are passed through to `Node.create`.\n    :return: `Node` instance.", "docstring_tokens": ["Parse", "a", "Newick", "formatted", "string", "into", "a", "Node", "object", "."], "nwo": "glottobank/python-newick", "score": 0.19358971820395612, "idx": 261393}
{"url": "https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L26-L56", "sha": "fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb", "docstring_summary": "Nicely format a list of line numbers.", "language": "python", "parameters": "(statements, lines)", "return_statement": "return ret", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "0", "arg_4", "=", "0", "arg_5", "=", "None", "arg_0", "=", "sorted", "(", "arg_0", ")", "arg_1", "=", "sorted", "(", "arg_1", ")", "while", "arg_3", "<", "len", "(", "arg_0", ")", "and", "arg_4", "<", "len", "(", "arg_1", ")", ":", "if", "arg_0", "[", "arg_3", "]", "==", "arg_1", "[", "arg_4", "]", ":", "if", "arg_5", "==", "None", ":", "arg_5", "=", "arg_1", "[", "arg_4", "]", "arg_6", "=", "arg_1", "[", "arg_4", "]", "arg_4", "+=", "1", "elif", "arg_5", ":", "arg_2", ".", "append", "(", "(", "arg_5", ",", "arg_6", ")", ")", "arg_5", "=", "None", "arg_3", "+=", "1", "if", "arg_5", ":", "arg_2", ".", "append", "(", "(", "arg_5", ",", "arg_6", ")", ")", "arg_7", "=", "', '", ".", "join", "(", "map", "(", "nice_pair", ",", "arg_2", ")", ")", "return", "arg_7"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Nicely format a list of line numbers.\n\n    Format a list of line numbers for printing by coalescing groups of lines as\n    long as the lines represent consecutive statements.  This will coalesce\n    even if there are gaps between statements.\n\n    For example, if `statements` is [1,2,3,4,5,10,11,12,13,14] and\n    `lines` is [1,2,5,10,11,13,14] then the result will be \"1-2, 5-11, 13-14\".\n\n    \"\"\"\n    arg_2 = []\n    arg_3 = 0\n    arg_4 = 0\n    arg_5 = None\n    arg_0 = sorted(arg_0)\n    arg_1 = sorted(arg_1)\n    while arg_3 < len(arg_0) and arg_4 < len(arg_1):\n        if arg_0[arg_3] == arg_1[arg_4]:\n            if arg_5 == None:\n                arg_5 = arg_1[arg_4]\n            arg_6 = arg_1[arg_4]\n            arg_4 += 1\n        elif arg_5:\n            arg_2.append((arg_5, arg_6))\n            arg_5 = None\n        arg_3 += 1\n    if arg_5:\n        arg_2.append((arg_5, arg_6))\n    arg_7 = ', '.join(map(nice_pair, arg_2))\n    return arg_7", "path": "virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py", "identifier": "format_lines", "docstring": "Nicely format a list of line numbers.\n\n    Format a list of line numbers for printing by coalescing groups of lines as\n    long as the lines represent consecutive statements.  This will coalesce\n    even if there are gaps between statements.\n\n    For example, if `statements` is [1,2,3,4,5,10,11,12,13,14] and\n    `lines` is [1,2,5,10,11,13,14] then the result will be \"1-2, 5-11, 13-14\".", "docstring_tokens": ["Nicely", "format", "a", "list", "of", "line", "numbers", "."], "nwo": "tnkteja/myhelp", "score": 0.0, "idx": 261394}
{"url": "https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L690-L701", "sha": "61beed5deaaf978ab31ed716e8470d86ba639867", "docstring_summary": "Keeps all user supplied options the same, but resets counters etc.", "language": "python", "parameters": "(self, new_damping=None)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_0", ".", "_num_iter", "=", "0", "arg_0", ".", "_inner_run_counter", "=", "0", "arg_0", ".", "_J_update_counter", "=", "arg_0", ".", "update_J_frequency", "arg_0", ".", "_fresh_JTJ", "=", "False", "arg_0", ".", "_has_run", "=", "False", "if", "arg_1", "is", "not", "None", ":", "arg_0", ".", "damping", "=", "np", ".", "array", "(", "arg_1", ")", ".", "astype", "(", "'float'", ")", "arg_0", ".", "_set_err_paramvals", "(", ")"], "function": "def Func(arg_0, arg_1=None):\n        \"\"\"\n        Keeps all user supplied options the same, but Funcs counters etc.\n        \"\"\"\n        arg_0._num_iter = 0\n        arg_0._inner_run_counter = 0\n        arg_0._J_update_counter = arg_0.update_J_frequency\n        arg_0._fresh_JTJ = False\n        arg_0._has_run = False\n        if arg_1 is not None:\n            arg_0.damping = np.array(arg_1).astype('float')\n        arg_0._set_err_paramvals()", "path": "peri/opt/optimize.py", "identifier": "LMEngine.reset", "docstring": "Keeps all user supplied options the same, but resets counters etc.", "docstring_tokens": ["Keeps", "all", "user", "supplied", "options", "the", "same", "but", "resets", "counters", "etc", "."], "nwo": "peri-source/peri", "score": 0.2727920376977753, "idx": 261395}
{"url": "https://github.com/ZeitOnline/briefkasten/blob/ce6b6eeb89196014fe21d68614c20059d02daa11/application/briefkasten/notifications.py#L18-L23", "sha": "ce6b6eeb89196014fe21d68614c20059d02daa11", "docstring_summary": "connects and optionally authenticates a connection.", "language": "python", "parameters": "(self)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_0", ".", "connect", "(", "arg_0", ".", "host", ",", "arg_0", ".", "port", ")", "if", "arg_0", ".", "user", ":", "arg_0", ".", "starttls", "(", ")", "arg_0", ".", "login", "(", "arg_0", ".", "user", ",", "arg_0", ".", "password", ")"], "function": "def Func(arg_0):\n        \"\"\" connects and optionally authenticates a connection.\"\"\"\n        arg_0.connect(arg_0.host, arg_0.port)\n        if arg_0.user:\n            arg_0.starttls()\n            arg_0.login(arg_0.user, arg_0.password)", "path": "application/briefkasten/notifications.py", "identifier": "CustomSMTP.begin", "docstring": "connects and optionally authenticates a connection.", "docstring_tokens": ["connects", "and", "optionally", "authenticates", "a", "connection", "."], "nwo": "ZeitOnline/briefkasten", "score": 0.3726785709016597, "idx": 261396}
{"url": "https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L290-L347", "sha": "90a551e2e1653a319e654c2405c2866f93d0ebb9", "docstring_summary": "Parse case information from config or PED files.", "language": "python", "parameters": "(config)", "return_statement": "return case_data", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "if", "'owner'", "not", "in", "arg_0", ":", "raise", "ConfigError", "(", "\"A case has to have a owner\"", ")", "if", "'family'", "not", "in", "arg_0", ":", "raise", "ConfigError", "(", "\"A case has to have a 'family'\"", ")", "arg_1", "=", "parse_individuals", "(", "arg_0", "[", "'samples'", "]", ")", "arg_2", "=", "{", "'owner'", ":", "arg_0", "[", "'owner'", "]", ",", "'collaborators'", ":", "[", "arg_0", "[", "'owner'", "]", "]", ",", "'case_id'", ":", "arg_0", "[", "'family'", "]", ",", "'display_name'", ":", "arg_0", ".", "get", "(", "'family_name'", ",", "arg_0", "[", "'family'", "]", ")", ",", "'genome_build'", ":", "arg_0", ".", "get", "(", "'human_genome_build'", ")", ",", "'rank_model_version'", ":", "arg_0", ".", "get", "(", "'rank_model_version'", ")", ",", "'rank_score_threshold'", ":", "arg_0", ".", "get", "(", "'rank_score_threshold'", ",", "0", ")", ",", "'analysis_date'", ":", "arg_0", "[", "'analysis_date'", "]", ",", "'individuals'", ":", "arg_1", ",", "'vcf_files'", ":", "{", "'vcf_snv'", ":", "arg_0", ".", "get", "(", "'vcf_snv'", ")", ",", "'vcf_sv'", ":", "arg_0", ".", "get", "(", "'vcf_sv'", ")", ",", "'vcf_str'", ":", "arg_0", ".", "get", "(", "'vcf_str'", ")", ",", "'vcf_cancer'", ":", "arg_0", ".", "get", "(", "'vcf_cancer'", ")", ",", "'vcf_snv_research'", ":", "arg_0", ".", "get", "(", "'vcf_snv_research'", ")", ",", "'vcf_sv_research'", ":", "arg_0", ".", "get", "(", "'vcf_sv_research'", ")", ",", "'vcf_cancer_research'", ":", "arg_0", ".", "get", "(", "'vcf_cancer_research'", ")", ",", "}", ",", "'default_panels'", ":", "arg_0", ".", "get", "(", "'default_gene_panels'", ",", "[", "]", ")", ",", "'gene_panels'", ":", "arg_0", ".", "get", "(", "'gene_panels'", ",", "[", "]", ")", ",", "'assignee'", ":", "arg_0", ".", "get", "(", "'assignee'", ")", ",", "'peddy_ped'", ":", "arg_0", ".", "get", "(", "'peddy_ped'", ")", ",", "'peddy_sex'", ":", "arg_0", ".", "get", "(", "'peddy_sex'", ")", ",", "'peddy_check'", ":", "arg_0", ".", "get", "(", "'peddy_check'", ")", ",", "'delivery_report'", ":", "arg_0", ".", "get", "(", "'delivery_report'", ")", ",", "'multiqc'", ":", "arg_0", ".", "get", "(", "'multiqc'", ")", ",", "'track'", ":", "arg_0", ".", "get", "(", "'track'", ",", "'rare'", ")", ",", "}", "if", "'madeline'", "in", "arg_0", ":", "arg_3", "=", "Path", "(", "arg_0", "[", "'madeline'", "]", ")", "if", "not", "arg_3", ".", "exists", "(", ")", ":", "raise", "ValueError", "(", "\"madeline path not found: {}\"", ".", "format", "(", "arg_3", ")", ")", "with", "arg_3", ".", "open", "(", "'r'", ")", "as", "in_handle", ":", "arg_2", "[", "'madeline_info'", "]", "=", "in_handle", ".", "read", "(", ")", "if", "(", "arg_2", "[", "'vcf_files'", "]", "[", "'vcf_cancer'", "]", "or", "arg_2", "[", "'vcf_files'", "]", "[", "'vcf_cancer_research'", "]", ")", ":", "arg_2", "[", "'track'", "]", "=", "'cancer'", "return", "arg_2"], "function": "def Func(arg_0):\n    \"\"\"Parse case information from config or PED files.\n\n    Args:\n        config (dict): case config with detailed information\n\n    Returns:\n        dict: parsed case data\n    \"\"\"\n    if 'owner' not in arg_0:\n        raise ConfigError(\"A case has to have a owner\")\n\n    if 'family' not in arg_0:\n        raise ConfigError(\"A case has to have a 'family'\")\n\n    arg_1 = parse_individuals(arg_0['samples'])\n    arg_2 = {\n        'owner': arg_0['owner'],\n        'collaborators': [arg_0['owner']],\n        'case_id': arg_0['family'],\n        'display_name': arg_0.get('family_name', arg_0['family']),\n        'genome_build': arg_0.get('human_genome_build'),\n        'rank_model_version': arg_0.get('rank_model_version'),\n        'rank_score_threshold': arg_0.get('rank_score_threshold', 0),\n        'analysis_date': arg_0['analysis_date'],\n        'individuals': arg_1,\n        'vcf_files': {\n            'vcf_snv': arg_0.get('vcf_snv'),\n            'vcf_sv': arg_0.get('vcf_sv'),\n            'vcf_str': arg_0.get('vcf_str'),\n            'vcf_cancer': arg_0.get('vcf_cancer'),\n            'vcf_snv_research': arg_0.get('vcf_snv_research'),\n            'vcf_sv_research': arg_0.get('vcf_sv_research'),\n            'vcf_cancer_research': arg_0.get('vcf_cancer_research'),\n        },\n        'default_panels': arg_0.get('default_gene_panels', []),\n        'gene_panels': arg_0.get('gene_panels', []),\n        'assignee': arg_0.get('assignee'),\n        'peddy_ped': arg_0.get('peddy_ped'),\n        'peddy_sex': arg_0.get('peddy_sex'),\n        'peddy_check': arg_0.get('peddy_check'),\n        'delivery_report': arg_0.get('delivery_report'),\n        'multiqc': arg_0.get('multiqc'),\n        'track': arg_0.get('track', 'rare'),\n    }\n\n    # add the pedigree figure, this is a xml file which is dumped in the db\n    if 'madeline' in arg_0:\n        arg_3 = Path(arg_0['madeline'])\n        if not arg_3.exists():\n            raise ValueError(\"madeline path not found: {}\".format(arg_3))\n        with arg_3.open('r') as in_handle:\n            arg_2['madeline_info'] = in_handle.read()\n    \n    if (arg_2['vcf_files']['vcf_cancer'] or arg_2['vcf_files']['vcf_cancer_research']):\n        arg_2['track'] = 'cancer'\n    \n    return arg_2", "path": "scout/parse/case.py", "identifier": "parse_case", "docstring": "Parse case information from config or PED files.\n\n    Args:\n        config (dict): case config with detailed information\n\n    Returns:\n        dict: parsed case data", "docstring_tokens": ["Parse", "case", "information", "from", "config", "or", "PED", "files", "."], "nwo": "Clinical-Genomics/scout", "score": 0.41124813484918504, "idx": 261397}
{"url": "https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L856-L877", "sha": "0dc47c8924fa3d9ab676c3a6e195f03f728b72c6", "docstring_summary": "Given the total number of items, determine the number of items that\n\tcan be added to each bin with a limit on the bin size.", "language": "python", "parameters": "(count, bin_size)", "return_statement": "return bins", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "int", "(", "math", ".", "ceil", "(", "arg_0", "/", "float", "(", "arg_1", ")", ")", ")", "arg_3", "=", "[", "0", "]", "*", "arg_2", "for", "arg_4", "in", "range", "(", "arg_0", ")", ":", "arg_3", "[", "arg_4", "%", "arg_2", "]", "+=", "1", "return", "arg_3"], "function": "def Func(arg_0, arg_1):\n\t\"\"\"\n\tGiven the total number of items, determine the number of items that\n\tcan be added to each bin with a limit on the bin size.\n\n\tSo if you want to partition 11 items into groups of 3, you'll want\n\tthree of three and one of two.\n\n\t>>> Func(11, 3)\n\t[3, 3, 3, 2]\n\n\tBut if you only have ten items, you'll have two groups of three and\n\ttwo of two.\n\n\t>>> Func(10, 3)\n\t[3, 3, 2, 2]\n\t\"\"\"\n\targ_2 = int(math.ceil(arg_0 / float(arg_1)))\n\targ_3 = [0] * arg_2\n\tfor arg_4 in range(arg_0):\n\t\targ_3[arg_4 % arg_2] += 1\n\treturn arg_3", "path": "jaraco/itertools.py", "identifier": "partition_items", "docstring": "Given the total number of items, determine the number of items that\n\tcan be added to each bin with a limit on the bin size.\n\n\tSo if you want to partition 11 items into groups of 3, you'll want\n\tthree of three and one of two.\n\n\t>>> partition_items(11, 3)\n\t[3, 3, 3, 2]\n\n\tBut if you only have ten items, you'll have two groups of three and\n\ttwo of two.\n\n\t>>> partition_items(10, 3)\n\t[3, 3, 2, 2]", "docstring_tokens": ["Given", "the", "total", "number", "of", "items", "determine", "the", "number", "of", "items", "that", "can", "be", "added", "to", "each", "bin", "with", "a", "limit", "on", "the", "bin", "size", "."], "nwo": "jaraco/jaraco.itertools", "score": 0.2751458370028208, "idx": 261398}
{"url": "https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L581-L589", "sha": "1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e", "docstring_summary": "Simple replacement for numpy linspace", "language": "python", "parameters": "(self, start, stop, n)", "return_statement": "return L", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ")", ":", "if", "arg_3", "==", "1", ":", "return", "[", "arg_1", "]", "arg_4", "=", "[", "0.0", "]", "*", "arg_3", "arg_5", "=", "arg_3", "-", "1", "arg_6", "=", "1.0", "/", "arg_5", "for", "arg_7", "in", "range", "(", "arg_3", ")", ":", "arg_4", "[", "arg_7", "]", "=", "arg_6", "*", "(", "arg_1", "*", "(", "arg_5", "-", "arg_7", ")", "+", "arg_2", "*", "arg_7", ")", "return", "arg_4"], "function": "def Func(arg_0, arg_1, arg_2, arg_3):\n        \"\"\" Simple replacement for numpy Func\"\"\"\n        if arg_3 == 1: return [arg_1]\n        arg_4 = [0.0] * arg_3\n        arg_5 = arg_3 - 1\n        arg_6 = 1.0 / arg_5\n        for arg_7 in range(arg_3):\n            arg_4[arg_7] = arg_6 * (arg_1*(arg_5 - arg_7) + arg_2*arg_7)\n        return arg_4", "path": "lancet/core.py", "identifier": "Range.linspace", "docstring": "Simple replacement for numpy linspace", "docstring_tokens": ["Simple", "replacement", "for", "numpy", "linspace"], "nwo": "ioam/lancet", "score": 0.1832591465193378, "idx": 261399}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/davinci/wordfreq.py#L21-L28", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Print the n most common words and counts in the freqs dict.", "language": "python", "parameters": "(freqs, n=10)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "10", ")", ":", "arg_2", ",", "arg_3", "=", "arg_0", ".", "keys", "(", ")", ",", "arg_0", ".", "values", "(", ")", "arg_4", "=", "zip", "(", "arg_3", ",", "arg_2", ")", "arg_4", ".", "sort", "(", "reverse", "=", "True", ")", "for", "(", "arg_5", ",", "arg_6", ")", "in", "arg_4", "[", ":", "arg_1", "]", ":", "print", "(", "arg_6", ",", "arg_5", ")"], "function": "def Func(arg_0, arg_1=10):\n    \"\"\"Print the n most common words and counts in the freqs dict.\"\"\"\n    \n    arg_2, arg_3 = arg_0.keys(), arg_0.values()\n    arg_4 = zip(arg_3, arg_2)\n    arg_4.sort(reverse=True)\n    for (arg_5, arg_6) in arg_4[:arg_1]:\n        print(arg_6, arg_5)", "path": "environment/share/doc/ipython/examples/parallel/davinci/wordfreq.py", "identifier": "print_wordfreq", "docstring": "Print the n most common words and counts in the freqs dict.", "docstring_tokens": ["Print", "the", "n", "most", "common", "words", "and", "counts", "in", "the", "freqs", "dict", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261400}
{"url": "https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/decode.py#L64-L117", "sha": "948ce7edce15d7df693446e76834e0c23bfe8f11", "docstring_summary": "Decodes a set of images.", "language": "python", "parameters": "(self, images, save=None, round=4, names=None, **kwargs)", "return_statement": "return result", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "None", ",", "arg_3", "=", "4", ",", "arg_4", "=", "None", ",", "**", "arg_5", ")", ":", "if", "isinstance", "(", "arg_1", ",", "string_types", ")", ":", "arg_1", "=", "[", "arg_1", "]", "if", "isinstance", "(", "arg_1", ",", "list", ")", ":", "arg_6", "=", "imageutils", ".", "load_imgs", "(", "arg_1", ",", "arg_0", ".", "masker", ")", "else", ":", "arg_6", "=", "arg_1", "arg_7", "=", "{", "'pearson'", ":", "arg_0", ".", "_pearson_correlation", ",", "'dot'", ":", "arg_0", ".", "_dot_product", ",", "'roi'", ":", "arg_0", ".", "_roi_association", "}", "arg_8", "=", "np", ".", "around", "(", "arg_7", "[", "arg_0", ".", "method", "]", "(", "arg_6", ",", "**", "arg_5", ")", ",", "arg_3", ")", "if", "arg_4", "is", "None", ":", "if", "type", "(", "arg_1", ")", ".", "__module__", "==", "np", ".", "__name__", ":", "arg_4", "=", "[", "'image_%d'", "%", "i", "for", "i", "in", "range", "(", "arg_1", ".", "shape", "[", "1", "]", ")", "]", "elif", "arg_0", ".", "method", "==", "'roi'", ":", "arg_4", "=", "[", "'cluster_%d'", "%", "i", "for", "i", "in", "range", "(", "arg_8", ".", "shape", "[", "1", "]", ")", "]", "else", ":", "arg_4", "=", "arg_1", "arg_8", "=", "pd", ".", "DataFrame", "(", "arg_8", ",", "columns", "=", "arg_4", ",", "index", "=", "arg_0", ".", "feature_names", ")", "if", "arg_2", "is", "not", "None", ":", "arg_8", ".", "to_csv", "(", "arg_2", ",", "index_label", "=", "'Feature'", ")", "return", "arg_8"], "function": "def Func(arg_0, arg_1, arg_2=None, arg_3=4, arg_4=None, **arg_5):\n        \"\"\" Decodes a set of images.\n\n        Args:\n          images: The images to Func. Can be:\n            - A single String specifying the filename of the image to Func\n            - A list of filenames\n            - A single NumPy array containing the image data\n          save: Optional filename to save results to. If None (default), returns\n            all results as an array.\n          round: Optional integer indicating number of decimals to round result\n            to. Defaults to 4.\n          names: Optional list of names corresponding to the images in filenames.\n            If passed, must be of same length and in same order as filenames.\n            By default, the columns in the output will be named using the image\n            filenames.\n\n        Returns:\n          An n_features x n_files numpy array, where each feature is a row and\n          each image is a column. The meaning of the values depends on the\n          decoding method used. \"\"\"\n\n        if isinstance(arg_1, string_types):\n            arg_1 = [arg_1]\n\n        if isinstance(arg_1, list):\n            arg_6 = imageutils.load_imgs(arg_1, arg_0.masker)\n        else:\n            arg_6 = arg_1\n\n        arg_7 = {\n            'pearson': arg_0._pearson_correlation,\n            'dot': arg_0._dot_product,\n            'roi': arg_0._roi_association\n        }\n\n        arg_8 = np.around(\n            arg_7[arg_0.method](arg_6, **arg_5), arg_3)\n\n        # if save is not None:\n\n        if arg_4 is None:\n            if type(arg_1).__module__ == np.__name__:\n                arg_4 = ['image_%d' % i for i in range(arg_1.shape[1])]\n            elif arg_0.method == 'roi':\n                arg_4 = ['cluster_%d' % i for i in range(arg_8.shape[1])]\n            else:\n                arg_4 = arg_1\n\n        arg_8 = pd.DataFrame(arg_8, columns=arg_4, index=arg_0.feature_names)\n\n        if arg_2 is not None:\n            arg_8.to_csv(arg_2, index_label='Feature')\n        return arg_8", "path": "neurosynth/analysis/decode.py", "identifier": "Decoder.decode", "docstring": "Decodes a set of images.\n\n        Args:\n          images: The images to decode. Can be:\n            - A single String specifying the filename of the image to decode\n            - A list of filenames\n            - A single NumPy array containing the image data\n          save: Optional filename to save results to. If None (default), returns\n            all results as an array.\n          round: Optional integer indicating number of decimals to round result\n            to. Defaults to 4.\n          names: Optional list of names corresponding to the images in filenames.\n            If passed, must be of same length and in same order as filenames.\n            By default, the columns in the output will be named using the image\n            filenames.\n\n        Returns:\n          An n_features x n_files numpy array, where each feature is a row and\n          each image is a column. The meaning of the values depends on the\n          decoding method used.", "docstring_tokens": ["Decodes", "a", "set", "of", "images", "."], "nwo": "neurosynth/neurosynth", "score": 0.7434649707053465, "idx": 261401}
{"url": "https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/previous_value_model.py#L153-L173", "sha": "5922fafffdccc8812e72b3324965ad2f7d4bbdad", "docstring_summary": "Deserialize via capnp", "language": "python", "parameters": "(cls, proto)", "return_statement": "return instance", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "object", ".", "__new__", "(", "arg_0", ")", "super", "(", "PreviousValueModel", ",", "arg_2", ")", ".", "__init__", "(", "arg_1", "=", "arg_1", ".", "modelBase", ")", "arg_2", ".", "_logger", "=", "opf_utils", ".", "initLogger", "(", "arg_2", ")", "if", "len", "(", "arg_1", ".", "predictedField", ")", ":", "arg_2", ".", "_predictedField", "=", "arg_1", ".", "predictedField", "else", ":", "arg_2", ".", "_predictedField", "=", "None", "arg_2", ".", "_fieldNames", "=", "list", "(", "arg_1", ".", "fieldNames", ")", "arg_2", ".", "_fieldTypes", "=", "list", "(", "arg_1", ".", "fieldTypes", ")", "arg_2", ".", "_predictionSteps", "=", "list", "(", "arg_1", ".", "predictionSteps", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"Deserialize via capnp\n\n    :param proto: capnp PreviousValueModelProto message Funcer\n\n    :returns: new instance of PreviousValueModel deserialized from the given\n              proto\n    \"\"\"\n    arg_2 = object.__new__(arg_0)\n    super(PreviousValueModel, arg_2).__init__(arg_1=arg_1.modelBase)\n\n    arg_2._logger = opf_utils.initLogger(arg_2)\n    if len(arg_1.predictedField):\n      arg_2._predictedField = arg_1.predictedField\n    else:\n      arg_2._predictedField = None\n    arg_2._fieldNames = list(arg_1.fieldNames)\n    arg_2._fieldTypes = list(arg_1.fieldTypes)\n    arg_2._predictionSteps = list(arg_1.predictionSteps)\n\n    return arg_2", "path": "src/nupic/frameworks/opf/previous_value_model.py", "identifier": "PreviousValueModel.read", "docstring": "Deserialize via capnp\n\n    :param proto: capnp PreviousValueModelProto message reader\n\n    :returns: new instance of PreviousValueModel deserialized from the given\n              proto", "docstring_tokens": ["Deserialize", "via", "capnp"], "nwo": "numenta/nupic", "score": 0.9869177850423402, "idx": 261402}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/dagcircuit/dagcircuit.py#L1020-L1026", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Get the set of \"op\" nodes with the given name.", "language": "python", "parameters": "(self, *names)", "return_statement": "return named_nodes", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "Func", "=", "[", "]", "for", "arg_3", "in", "arg_0", ".", "_multi_graph", ".", "nodes", "(", ")", ":", "if", "arg_3", ".", "type", "==", "'op'", "and", "arg_3", ".", "op", ".", "name", "in", "arg_1", ":", "Func", ".", "append", "(", "arg_3", ")", "return", "Func"], "function": "def Func(arg_0, *arg_1):\n        \"\"\"Get the set of \"op\" nodes with the given name.\"\"\"\n        Func = []\n        for arg_3 in arg_0._multi_graph.nodes():\n            if arg_3.type == 'op' and arg_3.op.name in arg_1:\n                Func.append(arg_3)\n        return Func", "path": "qiskit/dagcircuit/dagcircuit.py", "identifier": "DAGCircuit.named_nodes", "docstring": "Get the set of \"op\" nodes with the given name.", "docstring_tokens": ["Get", "the", "set", "of", "op", "nodes", "with", "the", "given", "name", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 261403}
{"url": "https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/validators.py#L31-L39", "sha": "aea91379ab0a87cd3bc798961fce28b60ee49a80", "docstring_summary": "Validate that a particular image size.", "language": "python", "parameters": "(image)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "get_app_config", "(", ")", "arg_2", "=", "arg_1", ".", "valid_max_image_size", "*", "1024", "if", "arg_1", "and", "not", "arg_0", ".", "size", "<=", "arg_2", ":", "raise", "ValidationError", "(", "_", "(", "\"The logo image file size must be less than or equal to %s KB.\"", ")", "%", "arg_1", ".", "valid_max_image_size", ")"], "function": "def Func(arg_0):\n    \"\"\"\n    Validate that a particular image size.\n    \"\"\"\n    arg_1 = get_app_config()\n    arg_2 = arg_1.valid_max_image_size * 1024\n    if arg_1 and not arg_0.size <= arg_2:\n        raise ValidationError(\n            _(\"The logo image file size must be less than or equal to %s KB.\") % arg_1.valid_max_image_size)", "path": "enterprise/validators.py", "identifier": "validate_image_size", "docstring": "Validate that a particular image size.", "docstring_tokens": ["Validate", "that", "a", "particular", "image", "size", "."], "nwo": "edx/edx-enterprise", "score": 0.6522400190762081, "idx": 261404}
{"url": "https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_paice_husk.py#L201-L256", "sha": "165466b3ff6afd8024a4c8660421b0c4e7773db9", "docstring_summary": "Return Paice-Husk stem.", "language": "python", "parameters": "(self, word)", "return_statement": "return word", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "False", "arg_3", "=", "True", "while", "not", "arg_2", ":", "for", "arg_4", "in", "range", "(", "6", ",", "0", ",", "-", "1", ")", ":", "if", "arg_1", "[", "-", "arg_4", ":", "]", "in", "arg_0", ".", "_rule_table", "[", "arg_4", "]", ":", "accept", "=", "False", "if", "len", "(", "arg_0", ".", "_rule_table", "[", "arg_4", "]", "[", "arg_1", "[", "-", "arg_4", ":", "]", "]", ")", "<", "4", ":", "for", "rule", "in", "arg_0", ".", "_rule_table", "[", "arg_4", "]", "[", "arg_1", "[", "-", "arg_4", ":", "]", "]", ":", "(", "arg_1", ",", "accept", ",", "arg_3", ",", "arg_2", ",", ")", "=", "arg_0", ".", "_apply_rule", "(", "arg_1", ",", "rule", ",", "arg_3", ",", "arg_2", ")", "if", "accept", ":", "break", "else", ":", "rule", "=", "arg_0", ".", "_rule_table", "[", "arg_4", "]", "[", "arg_1", "[", "-", "arg_4", ":", "]", "]", "(", "arg_1", ",", "accept", ",", "arg_3", ",", "arg_2", ")", "=", "arg_0", ".", "_apply_rule", "(", "arg_1", ",", "rule", ",", "arg_3", ",", "arg_2", ")", "if", "accept", ":", "break", "else", ":", "break", "return", "arg_1"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Return Paice-Husk Func.\n\n        Parameters\n        ----------\n        word : str\n            The word to Func\n\n        Returns\n        -------\n        str\n            Word Func\n\n        Examples\n        --------\n        >>> stmr = PaiceHusk()\n        >>> stmr.Func('assumption')\n        'assum'\n        >>> stmr.Func('verifiable')\n        'ver'\n        >>> stmr.Func('fancies')\n        'fant'\n        >>> stmr.Func('fanciful')\n        'fancy'\n        >>> stmr.Func('torment')\n        'tor'\n\n        \"\"\"\n        arg_2 = False\n        arg_3 = True\n        while not arg_2:\n            for arg_4 in range(6, 0, -1):\n                if arg_1[-arg_4:] in arg_0._rule_table[arg_4]:\n                    accept = False\n                    if len(arg_0._rule_table[arg_4][arg_1[-arg_4:]]) < 4:\n                        for rule in arg_0._rule_table[arg_4][arg_1[-arg_4:]]:\n                            (\n                                arg_1,\n                                accept,\n                                arg_3,\n                                arg_2,\n                            ) = arg_0._apply_rule(arg_1, rule, arg_3, arg_2)\n                            if accept:\n                                break\n                    else:\n                        rule = arg_0._rule_table[arg_4][arg_1[-arg_4:]]\n                        (arg_1, accept, arg_3, arg_2) = arg_0._apply_rule(\n                            arg_1, rule, arg_3, arg_2\n                        )\n\n                    if accept:\n                        break\n            else:\n                break\n\n        return arg_1", "path": "abydos/stemmer/_paice_husk.py", "identifier": "PaiceHusk.stem", "docstring": "Return Paice-Husk stem.\n\n        Parameters\n        ----------\n        word : str\n            The word to stem\n\n        Returns\n        -------\n        str\n            Word stem\n\n        Examples\n        --------\n        >>> stmr = PaiceHusk()\n        >>> stmr.stem('assumption')\n        'assum'\n        >>> stmr.stem('verifiable')\n        'ver'\n        >>> stmr.stem('fancies')\n        'fant'\n        >>> stmr.stem('fanciful')\n        'fancy'\n        >>> stmr.stem('torment')\n        'tor'", "docstring_tokens": ["Return", "Paice", "-", "Husk", "stem", "."], "nwo": "chrislit/abydos", "score": 0.5338669015842415, "idx": 261405}
{"url": "https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L1674-L1684", "sha": "4b2b2d4f83ffeaac7708e44409fe34896a01a278", "docstring_summary": "If true, handle uncompressed data", "language": "python", "parameters": "(self)", "return_statement": "return ISUNCOMPRESSED", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "verboseRead", "(", "BoolCode", "(", "'UNCMPR'", ",", "description", "=", "'Is Func?'", ")", ")", "if", "arg_1", ":", "arg_0", ".", "verboseRead", "(", "FillerAlphabet", "(", "streamPos", "=", "arg_0", ".", "stream", ".", "pos", ")", ")", "print", "(", "'Uncompressed data:'", ")", "arg_0", ".", "output", "+=", "arg_0", ".", "stream", ".", "readBytes", "(", "arg_0", ".", "MLEN", ")", "print", "(", "outputFormatter", "(", "arg_0", ".", "output", "[", "-", "arg_0", ".", "MLEN", ":", "]", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n        \"\"\"If true, handle Func data\n        \"\"\"\n        arg_1 = arg_0.verboseRead(\n            BoolCode('UNCMPR', description='Is Func?'))\n        if arg_1:\n            arg_0.verboseRead(FillerAlphabet(streamPos=arg_0.stream.pos))\n            print('Uncompressed data:')\n            arg_0.output += arg_0.stream.readBytes(arg_0.MLEN)\n            print(outputFormatter(arg_0.output[-arg_0.MLEN:]))\n        return arg_1", "path": "research/brotlidump.py", "identifier": "Layout.uncompressed", "docstring": "If true, handle uncompressed data", "docstring_tokens": ["If", "true", "handle", "uncompressed", "data"], "nwo": "google/brotli", "score": 0.9868702902363511, "idx": 261406}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/providers/basicaer/unitary_simulator.py#L257-L283", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Run experiments in qobj.", "language": "python", "parameters": "(self, job_id, qobj)", "return_statement": "return Result.from_dict(result)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ")", ":", "arg_0", ".", "_validate", "(", "arg_2", ")", "arg_3", "=", "[", "]", "arg_4", "=", "time", ".", "time", "(", ")", "for", "arg_5", "in", "arg_2", ".", "experiments", ":", "arg_3", ".", "append", "(", "arg_0", ".", "run_experiment", "(", "arg_5", ")", ")", "arg_6", "=", "time", ".", "time", "(", ")", "arg_7", "=", "{", "'backend_name'", ":", "arg_0", ".", "name", "(", ")", ",", "'backend_version'", ":", "arg_0", ".", "_configuration", ".", "backend_version", ",", "'qobj_id'", ":", "arg_2", ".", "qobj_id", ",", "'job_id'", ":", "arg_1", ",", "'results'", ":", "arg_3", ",", "'status'", ":", "'COMPLETED'", ",", "'success'", ":", "True", ",", "'time_taken'", ":", "(", "arg_6", "-", "arg_4", ")", ",", "'header'", ":", "arg_2", ".", "header", ".", "as_dict", "(", ")", "}", "return", "Result", ".", "from_dict", "(", "arg_7", ")"], "function": "def Func(arg_0, arg_1, arg_2):\n        \"\"\"Run experiments in qobj.\n\n        Args:\n            job_id (str): unique id for the job.\n            qobj (Qobj): job description\n\n        Returns:\n            Result: Result object\n        \"\"\"\n        arg_0._validate(arg_2)\n        arg_3 = []\n        arg_4 = time.time()\n        for arg_5 in arg_2.experiments:\n            arg_3.append(arg_0.run_experiment(arg_5))\n        arg_6 = time.time()\n        arg_7 = {'backend_name': arg_0.name(),\n                  'backend_version': arg_0._configuration.backend_version,\n                  'qobj_id': arg_2.qobj_id,\n                  'job_id': arg_1,\n                  'results': arg_3,\n                  'status': 'COMPLETED',\n                  'success': True,\n                  'time_taken': (arg_6 - arg_4),\n                  'header': arg_2.header.as_dict()}\n\n        return Result.from_dict(arg_7)", "path": "qiskit/providers/basicaer/unitary_simulator.py", "identifier": "UnitarySimulatorPy._run_job", "docstring": "Run experiments in qobj.\n\n        Args:\n            job_id (str): unique id for the job.\n            qobj (Qobj): job description\n\n        Returns:\n            Result: Result object", "docstring_tokens": ["Run", "experiments", "in", "qobj", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 261407}
{"url": "https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/movies.py#L152-L167", "sha": "ff17893110c99771d6398a62c35d36dd9735f4b9", "docstring_summary": "Get a list of recommended movies for a movie.", "language": "python", "parameters": "(self, **kwargs)", "return_statement": "return response", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "**", "arg_1", ")", ":", "arg_2", "=", "arg_0", ".", "_get_id_path", "(", "'Func'", ")", "arg_3", "=", "arg_0", ".", "_GET", "(", "arg_2", ",", "arg_1", ")", "arg_0", ".", "_set_attrs_to_values", "(", "arg_3", ")", "return", "arg_3"], "function": "def Func(arg_0, **arg_1):\n        \"\"\"\n        Get a list of recommended movies for a movie.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            page: (optional) Minimum value of 1.  Expected value is an integer.\n\n        Returns:\n            A dict representation of the JSON returned from the API.\n        \"\"\"\n        arg_2 = arg_0._get_id_path('Func')\n\n        arg_3 = arg_0._GET(arg_2, arg_1)\n        arg_0._set_attrs_to_values(arg_3)\n        return arg_3", "path": "tmdbsimple/movies.py", "identifier": "Movies.recommendations", "docstring": "Get a list of recommended movies for a movie.\n\n        Args:\n            language: (optional) ISO 639-1 code.\n            page: (optional) Minimum value of 1.  Expected value is an integer.\n\n        Returns:\n            A dict representation of the JSON returned from the API.", "docstring_tokens": ["Get", "a", "list", "of", "recommended", "movies", "for", "a", "movie", "."], "nwo": "celiao/tmdbsimple", "score": 0.9199997416852759, "idx": 261408}
{"url": "https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_platform.py#L168-L187", "sha": "db802f3ad8abba025db74b54f86e6892b8927325", "docstring_summary": "Calls `get_app_config_dir` but ensures the directory exists.", "language": "python", "parameters": "(appname, *args)", "return_statement": "return dpath", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "*", "arg_1", ")", ":", "from", "ubelt", "import", "util_path", "arg_2", "=", "get_app_config_dir", "(", "arg_0", ",", "*", "arg_1", ")", "util_path", ".", "ensuredir", "(", "arg_2", ")", "return", "arg_2"], "function": "def Func(arg_0, *arg_1):\n    \"\"\"\n    Calls `get_app_config_dir` but ensures the directory exists.\n\n    Args:\n        appname (str): the name of the application\n        *args: any other subdirectories may be specified\n\n    SeeAlso:\n        get_app_config_dir\n\n    Example:\n        >>> import ubelt as ub\n        >>> dpath = ub.Func('ubelt')\n        >>> assert exists(dpath)\n    \"\"\"\n    from ubelt import util_path\n    arg_2 = get_app_config_dir(arg_0, *arg_1)\n    util_path.ensuredir(arg_2)\n    return arg_2", "path": "ubelt/util_platform.py", "identifier": "ensure_app_config_dir", "docstring": "Calls `get_app_config_dir` but ensures the directory exists.\n\n    Args:\n        appname (str): the name of the application\n        *args: any other subdirectories may be specified\n\n    SeeAlso:\n        get_app_config_dir\n\n    Example:\n        >>> import ubelt as ub\n        >>> dpath = ub.ensure_app_config_dir('ubelt')\n        >>> assert exists(dpath)", "docstring_tokens": ["Calls", "get_app_config_dir", "but", "ensures", "the", "directory", "exists", "."], "nwo": "Erotemic/ubelt", "score": 0.9423075079767973, "idx": 261409}
{"url": "https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/geojson.py#L229-L248", "sha": "d482918d0e66a5b414dff6aa7cc854e01fc60ee4", "docstring_summary": "Read data from process output.", "language": "python", "parameters": "(self, validity_check=True, no_neighbors=False, **kwargs)", "return_statement": "return self._from_cache(validity_check=validity_check)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "True", ",", "arg_2", "=", "False", ",", "**", "arg_3", ")", ":", "if", "arg_2", ":", "raise", "NotImplementedError", "(", ")", "return", "arg_0", ".", "_from_cache", "(", "arg_1", "=", "arg_1", ")"], "function": "def Func(arg_0, arg_1=True, arg_2=False, **arg_3):\n        \"\"\"\n        Read data from process output.\n\n        Parameters\n        ----------\n        validity_check : bool\n            run geometry validity check (default: True)\n        no_neighbors : bool\n            don't include neighbor tiles if there is a pixelbuffer (default:\n            False)\n\n        Returns\n        -------\n        features : list\n            GeoJSON-like list of features\n        \"\"\"\n        if arg_2:\n            raise NotImplementedError()\n        return arg_0._from_cache(arg_1=arg_1)", "path": "mapchete/formats/default/geojson.py", "identifier": "InputTile.read", "docstring": "Read data from process output.\n\n        Parameters\n        ----------\n        validity_check : bool\n            run geometry validity check (default: True)\n        no_neighbors : bool\n            don't include neighbor tiles if there is a pixelbuffer (default:\n            False)\n\n        Returns\n        -------\n        features : list\n            GeoJSON-like list of features", "docstring_tokens": ["Read", "data", "from", "process", "output", "."], "nwo": "ungarj/mapchete", "score": 0.5734506828600171, "idx": 261410}
{"url": "https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L356-L386", "sha": "013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f", "docstring_summary": "Handles adding an Edge to the graph.", "language": "python", "parameters": "(self, info)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "not", "arg_1", ".", "initialized", ":", "return", "arg_2", "=", "arg_0", ".", "_request_graph", "(", "arg_1", ".", "ui", ".", "control", ")", "if", "arg_2", "is", "None", ":", "return", "arg_3", "=", "len", "(", "arg_2", ".", "nodes", ")", "arg_4", "=", "[", "v", ".", "ID", "for", "v", "in", "arg_2", ".", "nodes", "]", "if", "arg_3", "==", "0", ":", "arg_5", "=", "Node", "(", "ID", "=", "make_unique_name", "(", "\"node\"", ",", "arg_4", ")", ")", "arg_6", "=", "make_unique_name", "(", "\"node\"", ",", "arg_4", "+", "[", "arg_5", ".", "ID", "]", ")", "arg_7", "=", "Node", "(", "ID", "=", "arg_6", ")", "elif", "arg_3", "==", "1", ":", "arg_5", "=", "arg_2", ".", "nodes", "[", "0", "]", "arg_7", "=", "Node", "(", "ID", "=", "make_unique_name", "(", "\"node\"", ",", "arg_4", ")", ")", "else", ":", "arg_5", "=", "arg_2", ".", "nodes", "[", "0", "]", "arg_7", "=", "arg_2", ".", "nodes", "[", "1", "]", "arg_8", "=", "Edge", "(", "arg_5", ",", "arg_7", ",", "_nodes", "=", "arg_2", ".", "nodes", ")", "arg_9", "=", "arg_8", ".", "edit_traits", "(", "parent", "=", "arg_1", ".", "ui", ".", "control", ",", "kind", "=", "\"livemodal\"", ")", "if", "arg_9", ".", "result", ":", "arg_2", ".", "edges", ".", "append", "(", "arg_8", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\" Handles adding an Edge to the graph.\n        \"\"\"\n        if not arg_1.initialized:\n            return\n\n        arg_2 = arg_0._request_graph(arg_1.ui.control)\n\n        if arg_2 is None:\n            return\n\n        arg_3 = len(arg_2.nodes)\n        arg_4 = [v.ID for v in arg_2.nodes]\n\n        if arg_3 == 0:\n            arg_5 = Node(ID=make_unique_name(\"node\", arg_4))\n            arg_6 = make_unique_name(\"node\", arg_4 + [arg_5.ID])\n            arg_7 = Node(ID=arg_6)\n        elif arg_3 == 1:\n            arg_5 = arg_2.nodes[0]\n            arg_7 = Node(ID=make_unique_name(\"node\", arg_4))\n        else:\n            arg_5 = arg_2.nodes[0]\n            arg_7 = arg_2.nodes[1]\n\n        arg_8 = Edge(arg_5, arg_7, _nodes=arg_2.nodes)\n\n        arg_9 = arg_8.edit_traits(parent=arg_1.ui.control, kind=\"livemodal\")\n\n        if arg_9.result:\n            arg_2.edges.append(arg_8)", "path": "godot/ui/graph_view_model.py", "identifier": "GraphViewModel.add_edge", "docstring": "Handles adding an Edge to the graph.", "docstring_tokens": ["Handles", "adding", "an", "Edge", "to", "the", "graph", "."], "nwo": "rwl/godot", "score": 0.2424429654267875, "idx": 261411}
{"url": "https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2multinex.py#L134-L157", "sha": "5eeb8a178160f45faf71bf47cec4abe998a575d1", "docstring_summary": "function that takes a dictionary mapping names to \n    sequences, and a locus number, and writes it as a NEXUS\n    file with a mrbayes analysis block.", "language": "python", "parameters": "(mdict, nlocus, dirs, mcmc_burnin, mcmc_ngen, mcmc_sample_freq)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", ",", "arg_3", ",", "arg_4", ",", "arg_5", ")", ":", "arg_6", "=", "max", "(", "[", "len", "(", "arg_9", ")", "for", "arg_9", "in", "arg_0", "]", ")", "arg_7", "=", "\"{:<\"", "+", "str", "(", "arg_6", "+", "1", ")", "+", "\"} {}\\n\"", "arg_8", "=", "\"\"", "for", "arg_9", "in", "arg_0", ".", "items", "(", ")", ":", "arg_8", "+=", "arg_7", ".", "format", "(", "arg_9", "[", "0", "]", ",", "arg_9", "[", "1", "]", ")", "arg_10", "=", "os", ".", "path", ".", "join", "(", "arg_2", ",", "\"{}.nex\"", ".", "format", "(", "arg_1", ")", ")", "with", "open", "(", "arg_10", ",", "'w'", ")", "as", "outnex", ":", "outnex", ".", "write", "(", "NEXBLOCK", ".", "format", "(", "**", "{", "\"ntax\"", ":", "len", "(", "arg_0", ")", ",", "\"nchar\"", ":", "len", "(", "arg_0", ".", "values", "(", ")", "[", "0", "]", ")", ",", "\"matrix\"", ":", "arg_8", ",", "\"ngen\"", ":", "arg_4", ",", "\"sfreq\"", ":", "arg_5", ",", "\"burnin\"", ":", "arg_3", ",", "}", ")", ")"], "function": "def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):\n    \"\"\" \n    function that takes a dictionary mapping names to \n    sequences, and a locus number, and writes it as a NEXUS\n    file with a mrbayes analysis block.\n    \"\"\"\n    ## create matrix as a string\n    arg_6 = max([len(arg_9) for arg_9 in arg_0])\n    arg_7 = \"{:<\" + str(arg_6+1) + \"} {}\\n\"\n    arg_8 = \"\"\n    for arg_9 in arg_0.items():\n        arg_8 += arg_7.format(arg_9[0], arg_9[1])\n    \n    ## write nexus block\n    arg_10 = os.path.join(arg_2, \"{}.nex\".format(arg_1))\n    with open(arg_10, 'w') as outnex:\n        outnex.write(NEXBLOCK.format(**{\n            \"ntax\": len(arg_0), \n            \"nchar\": len(arg_0.values()[0]), \n            \"matrix\": arg_8,\n            \"ngen\": arg_4, \n            \"sfreq\": arg_5, \n            \"burnin\": arg_3, \n            }))", "path": "ipyrad/file_conversion/loci2multinex.py", "identifier": "nexmake", "docstring": "function that takes a dictionary mapping names to \n    sequences, and a locus number, and writes it as a NEXUS\n    file with a mrbayes analysis block.", "docstring_tokens": ["function", "that", "takes", "a", "dictionary", "mapping", "names", "to", "sequences", "and", "a", "locus", "number", "and", "writes", "it", "as", "a", "NEXUS", "file", "with", "a", "mrbayes", "analysis", "block", "."], "nwo": "dereneaton/ipyrad", "score": 0.4137745335171406, "idx": 261412}
{"url": "https://github.com/OpenMath/py-openmath/blob/4906aa9ccf606f533675c28823772e07c30fd220/openmath/encoder.py#L107-L117", "sha": "4906aa9ccf606f533675c28823772e07c30fd220", "docstring_summary": "Encodes an OpenMath element into a string.", "language": "python", "parameters": "(obj, nsprefix=None)", "return_statement": "return etree.tostring(node)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ")", ":", "arg_2", "=", "encode_xml", "(", "arg_0", ",", "arg_1", ")", "return", "etree", ".", "tostring", "(", "arg_2", ")"], "function": "def Func(arg_0, arg_1=None):\n    \"\"\" Encodes an OpenMath element into a string.\n\n    :param obj: Object to encode as string.\n    :type obj: OMAny\n\n    :rtype: bytes\n    \"\"\"\n\n    arg_2 = encode_xml(arg_0, arg_1)\n    return etree.tostring(arg_2)", "path": "openmath/encoder.py", "identifier": "encode_bytes", "docstring": "Encodes an OpenMath element into a string.\n\n    :param obj: Object to encode as string.\n    :type obj: OMAny\n\n    :rtype: bytes", "docstring_tokens": ["Encodes", "an", "OpenMath", "element", "into", "a", "string", "."], "nwo": "OpenMath/py-openmath", "score": 0.18384731799856882, "idx": 261413}
{"url": "https://github.com/ioam/parambokeh/blob/fb9744f216273c7b24e65d037b1d621c08d7fde6/parambokeh/__init__.py#L80-L94", "sha": "fb9744f216273c7b24e65d037b1d621c08d7fde6", "docstring_summary": "Temporary fix to patch HoloViews plot comms", "language": "python", "parameters": "(widgets, plots)", "return_statement": "return bokeh_plots", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "for", "arg_3", "in", "arg_1", ":", "if", "hasattr", "(", "arg_3", ",", "'_update_callbacks'", ")", ":", "for", "arg_4", "in", "arg_3", ".", "traverse", "(", "lambda", "x", ":", "x", ")", ":", "arg_4", ".", "comm", "=", "arg_0", ".", "server_comm", "for", "arg_6", "in", "arg_4", ".", "callbacks", ":", "for", "arg_7", "in", "arg_6", ".", "callbacks", ":", "arg_7", ".", "code", "=", "arg_7", ".", "code", ".", "replace", "(", "arg_3", ".", "id", ",", "arg_0", ".", "plot_id", ")", "arg_3", "=", "arg_3", ".", "state", "arg_2", ".", "append", "(", "arg_3", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n    \"\"\"\n    Temporary fix to patch HoloViews plot comms\n    \"\"\"\n    arg_2 = []\n    for arg_3 in arg_1:\n        if hasattr(arg_3, '_update_callbacks'):\n            for arg_4 in arg_3.traverse(lambda x: x):\n                arg_4.comm = arg_0.server_comm\n                for arg_6 in arg_4.callbacks:\n                    for arg_7 in arg_6.callbacks:\n                        arg_7.code = arg_7.code.replace(arg_3.id, arg_0.plot_id)\n            arg_3 = arg_3.state\n        arg_2.append(arg_3)\n    return arg_2", "path": "parambokeh/__init__.py", "identifier": "process_hv_plots", "docstring": "Temporary fix to patch HoloViews plot comms", "docstring_tokens": ["Temporary", "fix", "to", "patch", "HoloViews", "plot", "comms"], "nwo": "ioam/parambokeh", "score": 0.28708038950088577, "idx": 261414}
{"url": "https://github.com/multiformats/py-multicodec/blob/23213b8b40b21e17e2e1844224498cbd8e359bfa/multicodec/multicodec.py#L21-L34", "sha": "23213b8b40b21e17e2e1844224498cbd8e359bfa", "docstring_summary": "Returns prefix for a given multicodec", "language": "python", "parameters": "(multicodec)", "return_statement": "return prefix", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "try", ":", "arg_1", "=", "varint", ".", "encode", "(", "NAME_TABLE", "[", "arg_0", "]", ")", "except", "KeyError", ":", "raise", "ValueError", "(", "'{} multicodec is not supported.'", ".", "format", "(", "arg_0", ")", ")", "return", "arg_1"], "function": "def Func(arg_0):\n    \"\"\"\n    Returns prefix for a given multicodec\n\n    :param str multicodec: multicodec codec name\n    :return: the prefix for the given multicodec\n    :rtype: byte\n    :raises ValueError: if an invalid multicodec name is provided\n    \"\"\"\n    try:\n        arg_1 = varint.encode(NAME_TABLE[arg_0])\n    except KeyError:\n        raise ValueError('{} multicodec is not supported.'.format(arg_0))\n    return arg_1", "path": "multicodec/multicodec.py", "identifier": "get_prefix", "docstring": "Returns prefix for a given multicodec\n\n    :param str multicodec: multicodec codec name\n    :return: the prefix for the given multicodec\n    :rtype: byte\n    :raises ValueError: if an invalid multicodec name is provided", "docstring_tokens": ["Returns", "prefix", "for", "a", "given", "multicodec"], "nwo": "multiformats/py-multicodec", "score": 0.3705463963430013, "idx": 261415}
{"url": "https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/scene/scene.py#L56-L74", "sha": "6466128a3029c4d09631420ccce73024025bd5b6", "docstring_summary": "Draw all the nodes in the scene", "language": "python", "parameters": "(self, projection_matrix=None, camera_matrix=None, time=0)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", "=", "None", ",", "arg_2", "=", "None", ",", "arg_3", "=", "0", ")", ":", "arg_1", "=", "arg_1", ".", "astype", "(", "'f4'", ")", ".", "tobytes", "(", ")", "arg_2", "=", "arg_2", ".", "astype", "(", "'f4'", ")", ".", "tobytes", "(", ")", "for", "arg_4", "in", "arg_0", ".", "root_nodes", ":", "arg_4", ".", "Func", "(", "arg_1", "=", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_3", "=", "arg_3", ",", ")", "arg_0", ".", "ctx", ".", "clear_samplers", "(", "0", ",", "4", ")"], "function": "def Func(arg_0, arg_1=None, arg_2=None, arg_3=0):\n        \"\"\"\n        Draw all the nodes in the scene\n\n        :param projection_matrix: projection matrix (bytes)\n        :param camera_matrix: camera_matrix (bytes)\n        :param time: The current time\n        \"\"\"\n        arg_1 = arg_1.astype('f4').tobytes()\n        arg_2 = arg_2.astype('f4').tobytes()\n\n        for arg_4 in arg_0.root_nodes:\n            arg_4.Func(\n                arg_1=arg_1,\n                arg_2=arg_2,\n                arg_3=arg_3,\n            )\n\n        arg_0.ctx.clear_samplers(0, 4)", "path": "demosys/scene/scene.py", "identifier": "Scene.draw", "docstring": "Draw all the nodes in the scene\n\n        :param projection_matrix: projection matrix (bytes)\n        :param camera_matrix: camera_matrix (bytes)\n        :param time: The current time", "docstring_tokens": ["Draw", "all", "the", "nodes", "in", "the", "scene"], "nwo": "Contraz/demosys-py", "score": 0.534901783741059, "idx": 261416}
{"url": "https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L506-L537", "sha": "2922a14619d183fb28005fa7d02027ac436f2265", "docstring_summary": "This concatenates all text LCs for the given object and writes to a pklc.", "language": "python", "parameters": "(lcbasedir,\n                      objectid,\n                      aperture='TF1',\n                      postfix='.gz',\n                      sortby='rjd',\n                      normalize=True,\n                      outdir=None,\n                      recursive=True)", "return_statement": "return pklc", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "'TF1'", ",", "arg_3", "=", "'.gz'", ",", "arg_4", "=", "'rjd'", ",", "arg_5", "=", "True", ",", "arg_6", "=", "None", ",", "arg_7", "=", "True", ")", ":", "arg_8", "=", "concatenate_textlcs_for_objectid", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "arg_2", ",", "arg_4", "=", "arg_4", ",", "arg_5", "=", "arg_5", ",", "arg_7", "=", "arg_7", ")", "if", "not", "arg_6", ":", "arg_6", "=", "'pklcs'", "if", "not", "os", ".", "path", ".", "exists", "(", "arg_6", ")", ":", "os", ".", "mkdir", "(", "arg_6", ")", "arg_9", "=", "os", ".", "path", ".", "join", "(", "arg_6", ",", "'%s-%s-pklc.pkl'", "%", "(", "arg_8", "[", "'objectid'", "]", ",", "arg_2", ")", ")", "arg_10", "=", "lcdict_to_pickle", "(", "arg_8", ",", "outfile", "=", "arg_9", ")", "return", "arg_10"], "function": "def Func(arg_0,\n                      arg_1,\n                      arg_2='TF1',\n                      arg_3='.gz',\n                      arg_4='rjd',\n                      arg_5=True,\n                      arg_6=None,\n                      arg_7=True):\n    '''This concatenates all text LCs for the given object and writes to a pklc.\n\n    Basically a rollup for the concatenate_textlcs_for_objectid and\n    lcdict_to_pickle functions.\n\n    '''\n\n    arg_8 = concatenate_textlcs_for_objectid(arg_0,\n                                                 arg_1,\n                                                 arg_2=arg_2,\n                                                 arg_4=arg_4,\n                                                 arg_5=arg_5,\n                                                 arg_7=arg_7)\n\n    if not arg_6:\n        arg_6 = 'pklcs'\n\n    if not os.path.exists(arg_6):\n        os.mkdir(arg_6)\n\n    arg_9 = os.path.join(arg_6, '%s-%s-pklc.pkl' % (arg_8['objectid'],\n                                                        arg_2))\n    arg_10 = lcdict_to_pickle(arg_8, outfile=arg_9)\n    return arg_10", "path": "astrobase/hatsurveys/hplc.py", "identifier": "concat_write_pklc", "docstring": "This concatenates all text LCs for the given object and writes to a pklc.\n\n    Basically a rollup for the concatenate_textlcs_for_objectid and\n    lcdict_to_pickle functions.", "docstring_tokens": ["This", "concatenates", "all", "text", "LCs", "for", "the", "given", "object", "and", "writes", "to", "a", "pklc", "."], "nwo": "waqasbhatti/astrobase", "score": 0.5072804572339592, "idx": 261417}
{"url": "https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/pulse_lib/continuous.py#L37-L47", "sha": "d4f58d903bc96341b816f7c35df936d6421267d1", "docstring_summary": "Continuous square wave.", "language": "python", "parameters": "(times: np.ndarray, amp: complex, period: float, phase: float = 0)", "return_statement": "return amp*(2*(2*np.floor(x) - np.floor(2*x)) + 1).astype(np.complex_)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ":", "arg_1", ".", "ndarray", ",", "arg_3", ":", "arg_4", ",", "arg_5", ":", "arg_6", ",", "arg_7", ":", "arg_6", "=", "0", ")", "->", "arg_1", ".", "ndarray", ":", "arg_8", "=", "arg_0", "/", "arg_5", "+", "arg_7", "/", "arg_1", ".", "pi", "return", "arg_3", "*", "(", "2", "*", "(", "2", "*", "arg_1", ".", "floor", "(", "arg_8", ")", "-", "arg_1", ".", "floor", "(", "2", "*", "arg_8", ")", ")", "+", "1", ")", ".", "astype", "(", "arg_1", ".", "complex_", ")"], "function": "def Func(arg_0: arg_1.ndarray, arg_3: arg_4, arg_5: arg_6, arg_7: arg_6 = 0) -> arg_1.ndarray:\n    \"\"\"Continuous Func wave.\n\n    Args:\n        times: Times to output wave for.\n        amp: Pulse amplitude. Wave range is [-amp, amp].\n        period: Pulse period, units of dt.\n        phase: Pulse phase.\n    \"\"\"\n    arg_8 = arg_0/arg_5+arg_7/arg_1.pi\n    return arg_3*(2*(2*arg_1.floor(arg_8) - arg_1.floor(2*arg_8)) + 1).astype(arg_1.complex_)", "path": "qiskit/pulse/pulse_lib/continuous.py", "identifier": "square", "docstring": "Continuous square wave.\n\n    Args:\n        times: Times to output wave for.\n        amp: Pulse amplitude. Wave range is [-amp, amp].\n        period: Pulse period, units of dt.\n        phase: Pulse phase.", "docstring_tokens": ["Continuous", "square", "wave", "."], "nwo": "Qiskit/qiskit-terra", "score": 0.9746485763042565, "idx": 261418}
{"url": "https://github.com/joopert/nad_receiver/blob/416de0173a330c75cc73f9c90b0c5df32e5e0ba3/nad_receiver/__init__.py#L215-L237", "sha": "416de0173a330c75cc73f9c90b0c5df32e5e0ba3", "docstring_summary": "Return the status of the device.", "language": "python", "parameters": "(self)", "return_statement": "return {'volume': int(nad_status[0][-2:], 16),\n                'power': nad_status[1][-2:] == '01',\n                'muted': nad_status[2][-2:] == '01',\n                'source': self.SOURCES_REVERSED[nad_status[3][-2:]]}", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "arg_1", "=", "arg_0", ".", "_send", "(", "arg_0", ".", "POLL_VOLUME", "+", "arg_0", ".", "POLL_POWER", "+", "arg_0", ".", "POLL_MUTED", "+", "arg_0", ".", "POLL_SOURCE", ",", "read_reply", "=", "True", ")", "if", "arg_1", "is", "None", ":", "return", "arg_2", "=", "10", "arg_3", "=", "[", "arg_1", "[", "i", ":", "i", "+", "arg_2", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "arg_1", ")", ",", "arg_2", ")", "]", "return", "{", "'volume'", ":", "int", "(", "arg_3", "[", "0", "]", "[", "-", "2", ":", "]", ",", "16", ")", ",", "'power'", ":", "arg_3", "[", "1", "]", "[", "-", "2", ":", "]", "==", "'01'", ",", "'muted'", ":", "arg_3", "[", "2", "]", "[", "-", "2", ":", "]", "==", "'01'", ",", "'source'", ":", "arg_0", ".", "SOURCES_REVERSED", "[", "arg_3", "[", "3", "]", "[", "-", "2", ":", "]", "]", "}"], "function": "def Func(arg_0):\n        \"\"\"\n        Return the Func of the device.\n\n        Returns a dictionary with keys 'volume' (int 0-200) , 'power' (bool),\n         'muted' (bool) and 'source' (str).\n        \"\"\"\n        arg_1 = arg_0._send(arg_0.POLL_VOLUME +\n                               arg_0.POLL_POWER +\n                               arg_0.POLL_MUTED +\n                               arg_0.POLL_SOURCE, read_reply=True)\n        if arg_1 is None:\n            return\n\n        # split reply into parts of 10 characters\n        arg_2 = 10\n        arg_3 = [arg_1[i:i + arg_2]\n                      for i in range(0, len(arg_1), arg_2)]\n\n        return {'volume': int(arg_3[0][-2:], 16),\n                'power': arg_3[1][-2:] == '01',\n                'muted': arg_3[2][-2:] == '01',\n                'source': arg_0.SOURCES_REVERSED[arg_3[3][-2:]]}", "path": "nad_receiver/__init__.py", "identifier": "NADReceiverTCP.status", "docstring": "Return the status of the device.\n\n        Returns a dictionary with keys 'volume' (int 0-200) , 'power' (bool),\n         'muted' (bool) and 'source' (str).", "docstring_tokens": ["Return", "the", "status", "of", "the", "device", "."], "nwo": "joopert/nad_receiver", "score": 0.1878804938561529, "idx": 261419}
{"url": "https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/io.py#L207-L250", "sha": "0d77f61450aab4dde8b8585a577cc496acb95d7f", "docstring_summary": "Convert a video to frame images", "language": "python", "parameters": "(self,\n                   frame_dir,\n                   file_start=0,\n                   filename_tmpl='{:06d}.jpg',\n                   start=0,\n                   max_num=0,\n                   show_progress=True)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ",", "arg_2", "=", "0", ",", "arg_3", "=", "'{:06d}.jpg'", ",", "arg_4", "=", "0", ",", "arg_5", "=", "0", ",", "arg_6", "=", "True", ")", ":", "mkdir_or_exist", "(", "arg_1", ")", "if", "arg_5", "==", "0", ":", "arg_7", "=", "arg_0", ".", "frame_cnt", "-", "arg_4", "else", ":", "arg_7", "=", "min", "(", "arg_0", ".", "frame_cnt", "-", "arg_4", ",", "arg_5", ")", "if", "arg_7", "<=", "0", ":", "raise", "ValueError", "(", "'start must be less than total frame number'", ")", "if", "arg_4", ">", "0", ":", "arg_0", ".", "_set_real_position", "(", "arg_4", ")", "def", "write_frame", "(", "arg_8", ")", ":", "arg_9", "=", "arg_0", ".", "read", "(", ")", "arg_10", "=", "osp", ".", "join", "(", "arg_1", ",", "arg_3", ".", "format", "(", "arg_8", ")", ")", "cv2", ".", "imwrite", "(", "arg_10", ",", "arg_9", ")", "if", "arg_6", ":", "track_progress", "(", "write_frame", ",", "range", "(", "arg_2", ",", "arg_2", "+", "arg_7", ")", ")", "else", ":", "for", "arg_11", "in", "range", "(", "arg_7", ")", ":", "arg_9", "=", "arg_0", ".", "read", "(", ")", "if", "arg_9", "is", "None", ":", "break", "arg_10", "=", "osp", ".", "join", "(", "arg_1", ",", "arg_3", ".", "format", "(", "arg_11", "+", "arg_2", ")", ")", "cv2", ".", "imwrite", "(", "arg_10", ",", "arg_9", ")"], "function": "def Func(arg_0,\n                   arg_1,\n                   arg_2=0,\n                   arg_3='{:06d}.jpg',\n                   arg_4=0,\n                   arg_5=0,\n                   arg_6=True):\n        \"\"\"Convert a video to frame images\n\n        Args:\n            frame_dir (str): Output directory to store all the frame images.\n            file_start (int): Filenames will start from the specified number.\n            filename_tmpl (str): Filename template with the index as the\n                placeholder.\n            start (int): The starting frame index.\n            max_num (int): Maximum number of frames to be written.\n            show_progress (bool): Whether to show a progress bar.\n        \"\"\"\n        mkdir_or_exist(arg_1)\n        if arg_5 == 0:\n            arg_7 = arg_0.frame_cnt - arg_4\n        else:\n            arg_7 = min(arg_0.frame_cnt - arg_4, arg_5)\n        if arg_7 <= 0:\n            raise ValueError('start must be less than total frame number')\n        if arg_4 > 0:\n            arg_0._set_real_position(arg_4)\n\n        def write_frame(arg_8):\n            arg_9 = arg_0.read()\n            arg_10 = osp.join(arg_1, arg_3.format(arg_8))\n            cv2.imwrite(arg_10, arg_9)\n\n        if arg_6:\n            track_progress(write_frame, range(arg_2,\n                                              arg_2 + arg_7))\n        else:\n            for arg_11 in range(arg_7):\n                arg_9 = arg_0.read()\n                if arg_9 is None:\n                    break\n                arg_10 = osp.join(arg_1,\n                                    arg_3.format(arg_11 + arg_2))\n                cv2.imwrite(arg_10, arg_9)", "path": "mmcv/video/io.py", "identifier": "VideoReader.cvt2frames", "docstring": "Convert a video to frame images\n\n        Args:\n            frame_dir (str): Output directory to store all the frame images.\n            file_start (int): Filenames will start from the specified number.\n            filename_tmpl (str): Filename template with the index as the\n                placeholder.\n            start (int): The starting frame index.\n            max_num (int): Maximum number of frames to be written.\n            show_progress (bool): Whether to show a progress bar.", "docstring_tokens": ["Convert", "a", "video", "to", "frame", "images"], "nwo": "open-mmlab/mmcv", "score": 0.9830119364646916, "idx": 261420}
{"url": "https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dictdb.py#L111-L124", "sha": "075dc74d1ee62a8c6b7a8bf2b271364f01629d1e", "docstring_summary": "Find all the matches for a check dict.", "language": "python", "parameters": "(self, check)", "return_statement": "return matches", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "arg_2", "=", "[", "]", "arg_3", "=", "{", "}", "for", "arg_4", ",", "arg_5", "in", "arg_1", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "arg_5", ",", "dict", ")", ":", "arg_3", "[", "arg_4", "]", "=", "CompositeFilter", "(", "arg_5", ")", "else", ":", "arg_3", "[", "arg_4", "]", "=", "lambda", "o", ":", "o", "==", "arg_5", "for", "arg_6", "in", "arg_0", ".", "_records", ".", "itervalues", "(", ")", ":", "if", "arg_0", ".", "Func_one", "(", "arg_6", ",", "arg_3", ")", ":", "arg_2", ".", "append", "(", "copy", "(", "arg_6", ")", ")", "return", "arg_2"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Find all the matches for a check dict.\"\"\"\n        arg_2 = []\n        arg_3 = {}\n        for arg_4,arg_5 in arg_1.iteritems():\n            if isinstance(arg_5, dict):\n                arg_3[arg_4] = CompositeFilter(arg_5)\n            else:\n                arg_3[arg_4] = lambda o: o==arg_5\n\n        for arg_6 in arg_0._records.itervalues():\n            if arg_0.Func_one(arg_6, arg_3):\n                arg_2.append(copy(arg_6))\n        return arg_2", "path": "environment/lib/python2.7/site-packages/IPython/parallel/controller/dictdb.py", "identifier": "DictDB._match", "docstring": "Find all the matches for a check dict.", "docstring_tokens": ["Find", "all", "the", "matches", "for", "a", "check", "dict", "."], "nwo": "cloud9ers/gurumate", "score": 0.0, "idx": 261421}
{"url": "https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/parser.py#L22-L24", "sha": "6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851", "docstring_summary": "Appends tzinfo and assumes UTC, if datetime object has no tzinfo already.", "language": "python", "parameters": "(dt)", "return_statement": "return dt if dt.tzinfo else dt.replace(tzinfo=timezone.utc)", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ")", ":", "return", "arg_0", "if", "arg_0", ".", "tzinfo", "else", "arg_0", ".", "replace", "(", "tzinfo", "=", "timezone", ".", "utc", ")"], "function": "def Func(arg_0):\n    \"\"\"Appends tzinfo and assumes UTC, if datetime object has no tzinfo already.\"\"\"\n    return arg_0 if arg_0.tzinfo else arg_0.replace(tzinfo=timezone.utc)", "path": "twtxt/parser.py", "identifier": "make_aware", "docstring": "Appends tzinfo and assumes UTC, if datetime object has no tzinfo already.", "docstring_tokens": ["Appends", "tzinfo", "and", "assumes", "UTC", "if", "datetime", "object", "has", "no", "tzinfo", "already", "."], "nwo": "buckket/twtxt", "score": 0.5783854231140674, "idx": 261422}
{"url": "https://github.com/shonenada/flask-rbac/blob/e085121ff11825114e2d6f8419f0b6de6f9ba476/flask_rbac/__init__.py#L83-L89", "sha": "e085121ff11825114e2d6f8419f0b6de6f9ba476", "docstring_summary": "Exempt a view function from being checked permission", "language": "python", "parameters": "(self, resource)", "return_statement": "", "argument_list": "", "function_tokens": ["def", "Func", "(", "arg_0", ",", "arg_1", ")", ":", "if", "arg_1", "not", "in", "arg_0", ".", "_Func", ":", "arg_0", ".", "_Func", ".", "append", "(", "arg_1", ")"], "function": "def Func(arg_0, arg_1):\n        \"\"\"Exempt a view function from being checked permission\n\n        :param resource: The view function Func from checking.\n        \"\"\"\n        if arg_1 not in arg_0._Func:\n            arg_0._Func.append(arg_1)", "path": "flask_rbac/__init__.py", "identifier": "AccessControlList.exempt", "docstring": "Exempt a view function from being checked permission\n\n        :param resource: The view function exempt from checking.", "docstring_tokens": ["Exempt", "a", "view", "function", "from", "being", "checked", "permission"], "nwo": "shonenada/flask-rbac", "score": 0.7078405050276594, "idx": 261423}
